Upgrade esbuild to v0.17.x (#47)

This commit is contained in:
Tim Rogers 2023-01-25 18:49:50 +00:00 committed by GitHub
parent 49fba8aa1f
commit 0b5e5a2f6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 24 deletions

View File

@ -1,6 +1,6 @@
import esbuild from "esbuild"; import esbuild from "esbuild";
import process from "process"; import process from "process";
import builtins from 'builtin-modules' import builtins from "builtin-modules";
const banner = const banner =
`/* `/*
@ -9,34 +9,40 @@ if you want to view the source, please visit the github repository of this plugi
*/ */
`; `;
const prod = (process.argv[2] === 'production'); const prod = (process.argv[2] === "production");
esbuild.build({ const context = await esbuild.context({
banner: { banner: {
js: banner, js: banner,
}, },
entryPoints: ['main.ts'], entryPoints: ["main.ts"],
bundle: true, bundle: true,
external: [ external: [
'obsidian', "obsidian",
'electron', "electron",
'@codemirror/autocomplete', "@codemirror/autocomplete",
'@codemirror/collab', "@codemirror/collab",
'@codemirror/commands', "@codemirror/commands",
'@codemirror/language', "@codemirror/language",
'@codemirror/lint', "@codemirror/lint",
'@codemirror/search', "@codemirror/search",
'@codemirror/state', "@codemirror/state",
'@codemirror/view', "@codemirror/view",
'@lezer/common', "@lezer/common",
'@lezer/highlight', "@lezer/highlight",
'@lezer/lr', "@lezer/lr",
...builtins], ...builtins],
format: 'cjs', format: "cjs",
watch: !prod, target: "es2018",
target: 'es2018',
logLevel: "info", logLevel: "info",
sourcemap: prod ? false : 'inline', sourcemap: prod ? false : "inline",
treeShaking: true, treeShaking: true,
outfile: 'main.js', outfile: "main.js",
}).catch(() => process.exit(1)); });
if (prod) {
await context.rebuild();
process.exit(0);
} else {
await context.watch();
}

View File

@ -16,7 +16,7 @@
"@typescript-eslint/eslint-plugin": "5.29.0", "@typescript-eslint/eslint-plugin": "5.29.0",
"@typescript-eslint/parser": "5.29.0", "@typescript-eslint/parser": "5.29.0",
"builtin-modules": "3.3.0", "builtin-modules": "3.3.0",
"esbuild": "0.14.47", "esbuild": "0.17.3",
"obsidian": "latest", "obsidian": "latest",
"tslib": "2.4.0", "tslib": "2.4.0",
"typescript": "4.7.4" "typescript": "4.7.4"