mirror of
https://github.com/patruusbarba/ObsidianSpoilerPlugin.git
synced 2026-07-22 07:48:59 +00:00
- Drop plugin id/name from command id and name - Replace builtin-modules dep with node:module builtinModules - Commit package-lock.json for reproducible builds Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
35 lines
775 B
JavaScript
35 lines
775 B
JavaScript
import esbuild from "esbuild";
|
|
import process from "process";
|
|
import { builtinModules } from "module";
|
|
|
|
const builtins = [...builtinModules, ...builtinModules.map((m) => `node:${m}`)];
|
|
|
|
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.argv[2] === "production";
|
|
|
|
const context = await esbuild.context({
|
|
banner: {
|
|
js: banner,
|
|
},
|
|
entryPoints: ["main.ts"],
|
|
bundle: true,
|
|
external: ["obsidian", "electron", ...builtins],
|
|
format: "cjs",
|
|
target: "es2018",
|
|
logLevel: "info",
|
|
sourcemap: prod ? false : "inline",
|
|
treeShaking: true,
|
|
outfile: "main.js",
|
|
});
|
|
|
|
if (prod) {
|
|
await context.rebuild();
|
|
process.exit(0);
|
|
} else {
|
|
await context.watch();
|
|
}
|