File tree Expand file tree Collapse file tree 5 files changed +2637
-60
lines changed
Expand file tree Collapse file tree 5 files changed +2637
-60
lines changed Original file line number Diff line number Diff line change 1- # Compiled output
1+ # Compiled output (old TypeScript output)
22out /
3+
4+ # Bundled output (but keep the build script)
5+ dist /
36* .js
7+ ! esbuild.js
48* .js.map
59
610# Node modules
Original file line number Diff line number Diff line change 11
2+ # With bundling, we can exclude much more since everything is bundled into dist/extension.js
3+
4+ # Development files
25.vscode /**
36.vscode-test /**
4- test /**
5- .gitignore
6- internal /**
77.github /**
8- * .vsix
8+ esbuild.js
9+
10+ # Source files (now bundled)
11+ src /**
12+ out /**
13+ node_modules /**
14+
15+ # Build configuration
16+ tsconfig.json
17+ jsconfig.json
18+
19+ # Test files
20+ test /**
21+
22+ # Documentation and meta files
923vsc-extension-quickstart.md
1024CONTRIBUTING.md
25+
26+ # Logs and temporary files
1127* .log
1228npm-debug.log *
1329* .tmp
1430* .temp
31+
32+ # OS files
1533.DS_Store
1634Thumbs.db
1735
18- node_modules /**
19- ! node_modules /cloudinary /**
20- ! node_modules /lodash /**
21- ! node_modules /q /**
22-
23- src /** /* .ts
24- src /** /test /**
25- out /test /**
26- ** /* .map
27- tsconfig.json
28- jsconfig.json
29-
36+ # Editor files
3037* .swp
3138* .swo
3239* ~
33- .yarnrc
40+
41+ # Package files
42+ * .vsix
43+
44+ # Git files
45+ .gitignore
46+ .yarnrc
47+
48+ # Internal development
49+ internal /**
Original file line number Diff line number Diff line change 1+ const esbuild = require ( "esbuild" ) ;
2+
3+ const production = process . argv . includes ( "--production" ) ;
4+ const watch = process . argv . includes ( "--watch" ) ;
5+
6+ async function main ( ) {
7+ const ctx = await esbuild . context ( {
8+ entryPoints : [ "src/extension.ts" ] ,
9+ bundle : true ,
10+ format : "cjs" ,
11+ minify : production ,
12+ sourcemap : ! production ,
13+ sourcesContent : false ,
14+ platform : "node" ,
15+ outfile : "dist/extension.js" ,
16+ external : [ "vscode" ] ,
17+ logLevel : "warning" ,
18+ plugins : [
19+ /* add to the end of plugins array */
20+ esbuildProblemMatcherPlugin ,
21+ ] ,
22+ } ) ;
23+ if ( watch ) {
24+ await ctx . watch ( ) ;
25+ } else {
26+ await ctx . rebuild ( ) ;
27+ await ctx . dispose ( ) ;
28+ }
29+ }
30+
31+ /**
32+ * @type {import('esbuild').Plugin }
33+ */
34+ const esbuildProblemMatcherPlugin = {
35+ name : "esbuild-problem-matcher" ,
36+
37+ setup ( build ) {
38+ build . onStart ( ( ) => {
39+ console . log ( "[watch] build started" ) ;
40+ } ) ;
41+ build . onEnd ( ( result ) => {
42+ result . errors . forEach ( ( { text, location } ) => {
43+ console . error ( `✘ [ERROR] ${ text } ` ) ;
44+ if ( location == null ) return ;
45+ console . error (
46+ ` ${ location . file } :${ location . line } :${ location . column } :`
47+ ) ;
48+ } ) ;
49+ console . log ( "[watch] build finished" ) ;
50+ } ) ;
51+ } ,
52+ } ;
53+
54+ main ( ) . catch ( ( e ) => {
55+ console . error ( e ) ;
56+ process . exit ( 1 ) ;
57+ } ) ;
You can’t perform that action at this time.
0 commit comments