obsidian-catui-acp 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,29 @@
1
+ import esbuild from "esbuild";
2
+ import builtins from "builtin-modules";
3
+ import { readFileSync, writeFileSync } from "node:fs";
4
+
5
+ const prod = process.argv[2] === "production";
6
+
7
+ const context = await esbuild.context({
8
+ banner: { js: "/* CatUI ACP Obsidian plugin */" },
9
+ bundle: true,
10
+ entryPoints: ["src/main.ts"],
11
+ external: ["obsidian", "electron", "@codemirror/autocomplete", "@codemirror/collab", "@codemirror/commands", "@codemirror/language", "@codemirror/lint", "@codemirror/search", "@codemirror/state", "@codemirror/view", ...builtins],
12
+ format: "cjs",
13
+ logLevel: "info",
14
+ minify: prod,
15
+ outfile: "main.js",
16
+ platform: "node",
17
+ sourcemap: prod ? false : "inline",
18
+ target: "es2022",
19
+ treeShaking: true
20
+ });
21
+
22
+ if (prod) {
23
+ await context.rebuild();
24
+ await context.dispose();
25
+ const output = readFileSync("main.js", "utf8").replace(/[ \t]+$/gm, "");
26
+ writeFileSync("main.js", output);
27
+ } else {
28
+ await context.watch();
29
+ }