Skip to content

Commit 5125e73

Browse files
committed
update deps; fix preview modal
1 parent 26cf166 commit 5125e73

19 files changed

+1513
-1450
lines changed

esbuild.config.mjs

Lines changed: 49 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,60 @@
11
import esbuild from 'esbuild';
2-
import process from 'process';
32
import builtins from 'builtin-modules';
43
import esbuildSvelte from 'esbuild-svelte';
54
import sveltePreprocess from 'svelte-preprocess';
5+
import manifest from './manifest.json' assert { type: 'json' };
66

77
const banner = `/*
8+
-------------------------------------------
9+
${manifest.name} - Release Build
10+
-------------------------------------------
11+
By: ${manifest.author} (${manifest.authorUrl})
12+
Time: ${new Date().toUTCString()}
13+
Version: ${manifest.version}
14+
-------------------------------------------
815
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
916
if you want to view the source, please visit the github repository of this plugin
1017
*/
1118
`;
1219

13-
const prod = process.argv[2] === 'production';
14-
15-
esbuild
16-
.build({
17-
banner: {
18-
js: banner,
19-
},
20-
entryPoints: ['src/main.ts'],
21-
bundle: true,
22-
external: [
23-
'obsidian',
24-
'electron',
25-
'@codemirror/autocomplete',
26-
'@codemirror/closebrackets',
27-
'@codemirror/collab',
28-
'@codemirror/commands',
29-
'@codemirror/comment',
30-
'@codemirror/fold',
31-
'@codemirror/gutter',
32-
'@codemirror/highlight',
33-
'@codemirror/history',
34-
'@codemirror/language',
35-
'@codemirror/lint',
36-
'@codemirror/matchbrackets',
37-
'@codemirror/panel',
38-
'@codemirror/rangeset',
39-
'@codemirror/rectangular-selection',
40-
'@codemirror/search',
41-
'@codemirror/state',
42-
'@codemirror/stream-parser',
43-
'@codemirror/text',
44-
'@codemirror/tooltip',
45-
'@codemirror/view',
46-
...builtins,
47-
],
48-
format: 'cjs',
49-
watch: !prod,
50-
target: 'es2018',
51-
logLevel: 'info',
52-
sourcemap: prod ? false : 'inline',
53-
treeShaking: true,
54-
outfile: 'main.js',
55-
plugins: [
56-
esbuildSvelte({
57-
compilerOptions: { css: true },
58-
preprocess: sveltePreprocess(),
59-
}),
60-
],
61-
})
62-
.catch(() => process.exit(1));
20+
const build = await esbuild.build({
21+
banner: {
22+
js: banner,
23+
},
24+
entryPoints: ['src/main.ts'],
25+
bundle: true,
26+
external: [
27+
'obsidian',
28+
'electron',
29+
'@codemirror/autocomplete',
30+
'@codemirror/collab',
31+
'@codemirror/commands',
32+
'@codemirror/language',
33+
'@codemirror/lint',
34+
'@codemirror/search',
35+
'@codemirror/state',
36+
'@codemirror/view',
37+
'@lezer/common',
38+
'@lezer/highlight',
39+
'@lezer/lr',
40+
...builtins,
41+
],
42+
format: 'cjs',
43+
target: 'es2018',
44+
logLevel: 'info',
45+
sourcemap: false,
46+
treeShaking: true,
47+
outfile: 'main.js',
48+
minify: true,
49+
metafile: true,
50+
plugins: [
51+
esbuildSvelte({
52+
compilerOptions: { css: 'injected' },
53+
preprocess: sveltePreprocess(),
54+
filterWarnings: warning => {
55+
// we don't want warnings from node modules that we can do nothing about
56+
return !warning.filename.includes('node_modules');
57+
},
58+
}),
59+
],
60+
});

esbuild.dev.config.mjs

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import esbuild from 'esbuild';
2+
import process from 'process';
3+
import builtins from 'builtin-modules';
4+
import esbuildSvelte from 'esbuild-svelte';
5+
import sveltePreprocess from 'svelte-preprocess';
6+
import manifest from './manifest.json' assert { type: 'json' };
7+
8+
const banner = `/*
9+
-------------------------------------------
10+
${manifest.name} - Dev Build
11+
-------------------------------------------
12+
By: ${manifest.author} (${manifest.authorUrl})
13+
Time: ${new Date().toUTCString()}
14+
Version: Dev Build
15+
-------------------------------------------
16+
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
17+
if you want to view the source, please visit the github repository of this plugin
18+
*/
19+
`;
20+
21+
const context = await esbuild
22+
.context({
23+
banner: {
24+
js: banner,
25+
},
26+
entryPoints: ['src/main.ts'],
27+
bundle: true,
28+
external: [
29+
'obsidian',
30+
'electron',
31+
'@codemirror/autocomplete',
32+
'@codemirror/collab',
33+
'@codemirror/commands',
34+
'@codemirror/language',
35+
'@codemirror/lint',
36+
'@codemirror/search',
37+
'@codemirror/state',
38+
'@codemirror/view',
39+
'@lezer/common',
40+
'@lezer/highlight',
41+
'@lezer/lr',
42+
...builtins,
43+
],
44+
format: 'cjs',
45+
target: 'es2018',
46+
logLevel: 'info',
47+
sourcemap: 'inline',
48+
treeShaking: true,
49+
outfile: 'main.js',
50+
plugins: [
51+
esbuildSvelte({
52+
compilerOptions: { css: 'injected' },
53+
preprocess: sveltePreprocess(),
54+
filterWarnings: warning => {
55+
// we don't want warnings from node modules that we can do nothing about
56+
return !warning.filename.includes('node_modules');
57+
},
58+
}),
59+
],
60+
})
61+
.catch(() => process.exit(1));
62+
63+
await context.watch();

0 commit comments

Comments
 (0)