File tree Expand file tree Collapse file tree 4 files changed +563
-34
lines changed
Expand file tree Collapse file tree 4 files changed +563
-34
lines changed Original file line number Diff line number Diff line change @@ -12,26 +12,6 @@ vsc-extension-quickstart.md
1212test /**
1313.github /**
1414** /* .vsix
15- node_modules /** /test /**
16- node_modules /** /tests /**
17- node_modules /** /spec /**
18- node_modules /** /example /**
19- node_modules /** /examples /**
20- node_modules /** /demo /**
21- node_modules /** /demos /**
22- node_modules /** /docs /**
23- node_modules /** /doc /**
24- node_modules /** /* .md
25- node_modules /** /* .markdown
26- node_modules /** /LICENSE *
27- node_modules /** /LICENCE *
28- node_modules /** /license *
29- node_modules /** /licence *
30- node_modules /** /.npmignore
31- node_modules /** /.gitignore
32- node_modules /** /.editorconfig
33- node_modules /** /.eslintrc *
34- node_modules /** /.prettierrc *
35- node_modules /** /Makefile
36- node_modules /** /Gulpfile.js
37- node_modules /** /Gruntfile.js
15+ node_modules /**
16+ esbuild.js
17+ ** /* .map
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 : 'out/extension.js' ,
16+ external : [ 'vscode' ] ,
17+ logLevel : 'info' ,
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+ console . error ( ` ${ location . file } :${ location . line } :${ location . column } :` ) ;
45+ } ) ;
46+ console . log ( '[watch] build finished' ) ;
47+ } ) ;
48+ } ,
49+ } ;
50+
51+ main ( ) . catch ( e => {
52+ console . error ( e ) ;
53+ process . exit ( 1 ) ;
54+ } ) ;
You can’t perform that action at this time.
0 commit comments