mirror of
https://github.com/uthvah/sync-embeds.git
synced 2026-07-22 06:43:40 +00:00
- Replace deprecated builtin-modules with node:module built-in - Pin monkey-around to exact version 3.0.0 - Upgrade esbuild 0.17.3 → 0.28.1 (fixes high-severity CVE) - Commit package-lock.json for reproducible builds - Add CONTRIBUTING.md and GitHub Actions release workflow with artifact attestation - Fix #ccc shorthand hex in print styles - Neutralize Obsidian's readable-line-width per-line margin-inline inside sync embeds Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
51 lines
No EOL
1.1 KiB
JavaScript
51 lines
No EOL
1.1 KiB
JavaScript
import esbuild from "esbuild";
|
|
import process from "process";
|
|
import { builtinModules as builtins } from "node:module";
|
|
|
|
const banner = `/*
|
|
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
|
if you want to view the source, please visit the github repository of this plugin
|
|
*/
|
|
`;
|
|
|
|
const prod = process.env.NODE_ENV === 'production';
|
|
|
|
const context = await esbuild.context({
|
|
banner: {
|
|
js: banner,
|
|
},
|
|
entryPoints: ["src/main.js"],
|
|
bundle: true,
|
|
external: [
|
|
"obsidian",
|
|
"electron",
|
|
"@codemirror/autocomplete",
|
|
"@codemirror/collab",
|
|
"@codemirror/commands",
|
|
"@codemirror/language",
|
|
"@codemirror/lint",
|
|
"@codemirror/search",
|
|
"@codemirror/state",
|
|
"@codemirror/view",
|
|
"@lezer/common",
|
|
"@lezer/highlight",
|
|
"@lezer/lr",
|
|
...builtins
|
|
],
|
|
format: "cjs",
|
|
target: "es2018",
|
|
logLevel: "info",
|
|
sourcemap: prod ? false : "inline",
|
|
treeShaking: true,
|
|
outfile: "main.js", // Outputs to root for Obsidian
|
|
define: {
|
|
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development')
|
|
},
|
|
});
|
|
|
|
if (prod) {
|
|
await context.rebuild();
|
|
process.exit(0);
|
|
} else {
|
|
await context.watch();
|
|
} |