1- import esbuild from "esbuild" ;
2- import process from "process" ;
3- import builtins from "builtin-modules" ;
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' ;
46
5- const banner =
6- `/*
7+ const banner = `/*
78THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
89if you want to view the source, please visit the github repository of this plugin
910*/
1011` ;
1112
12- const prod = ( process . argv [ 2 ] === " production" ) ;
13+ const prod = process . argv [ 2 ] === ' production' ;
1314
14- const context = await esbuild . context ( {
15- banner : {
16- js : banner ,
17- } ,
18- entryPoints : [ "main.ts" ] ,
19- bundle : true ,
20- external : [
21- "obsidian" ,
22- "electron" ,
23- "@codemirror/autocomplete" ,
24- "@codemirror/collab" ,
25- "@codemirror/commands" ,
26- "@codemirror/language" ,
27- "@codemirror/lint" ,
28- "@codemirror/search" ,
29- "@codemirror/state" ,
30- "@codemirror/view" ,
31- "@lezer/common" ,
32- "@lezer/highlight" ,
33- "@lezer/lr" ,
34- ...builtins ] ,
35- format : "cjs" ,
36- target : "es2018" ,
37- logLevel : "info" ,
38- sourcemap : prod ? false : "inline" ,
39- treeShaking : true ,
40- outfile : "main.js" ,
41- } ) ;
42-
43- if ( prod ) {
44- await context . rebuild ( ) ;
45- process . exit ( 0 ) ;
46- } else {
47- await context . watch ( ) ;
48- }
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+ minify : true ,
56+ plugins : [
57+ esbuildSvelte ( {
58+ compilerOptions : { css : true } ,
59+ preprocess : sveltePreprocess ( ) ,
60+ } ) ,
61+ ] ,
62+ } )
63+ . catch ( ( ) => process . exit ( 1 ) ) ;
0 commit comments