File tree Expand file tree Collapse file tree 20 files changed +277
-239
lines changed
Expand file tree Collapse file tree 20 files changed +277
-239
lines changed Original file line number Diff line number Diff line change 66 "script" : " watch" ,
77 "problemMatcher" : {
88 "owner" : " typescript" ,
9- "pattern" :[
10- {
11- "regexp" : " \\ [tsl\\ ] ERROR" ,
12- "file" : 1 ,
13- "location" : 2 ,
14- "message" : 3
15- }
16- ],
9+ "pattern" : {
10+ "regexp" : " ✘ \\ [ERROR\\ ] (.+)" ,
11+ "message" : 1
12+ },
1713 "background" : {
1814 "activeOnStart" : true ,
19- "beginsPattern" : " \\ w+ " ,
20- "endsPattern" : " webpack .* compiled "
15+ "beginsPattern" : " \\ [watch \\ ] build started " ,
16+ "endsPattern" : " \\ [watch \\ ] build finished "
2117 }
2218 },
2319 "isBackground" : true ,
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ build.sh
2323
2424# Build tooling
2525node_modules
26- webpack.config .js
26+ esbuild .js
2727
2828# Compiler output (old tsc output)
2929out /**
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 : [ 'lib/Main.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 : 'silent' ,
18+ plugins : [
19+ esbuildProblemMatcherPlugin
20+ ]
21+ } ) ;
22+ if ( watch ) {
23+ await ctx . watch ( ) ;
24+ } else {
25+ await ctx . rebuild ( ) ;
26+ await ctx . dispose ( ) ;
27+ }
28+ }
29+
30+ /**
31+ * This plugin hooks into the build process to print errors in a format
32+ * that the VS Code problem matcher (`$esbuild-watch`) can detect.
33+ */
34+ const esbuildProblemMatcherPlugin = {
35+ name : 'esbuild-problem-matcher' ,
36+ setup ( build ) {
37+ build . onStart ( ( ) => {
38+ console . log ( '[watch] build started' ) ;
39+ } ) ;
40+ build . onEnd ( result => {
41+ result . errors . forEach ( ( { text, location } ) => {
42+ console . error ( `✘ [ERROR] ${ text } ` ) ;
43+ if ( location ) {
44+ console . error ( ` ${ location . file } :${ location . line } :${ location . column } :` ) ;
45+ }
46+ } ) ;
47+ console . log ( '[watch] build finished' ) ;
48+ } ) ;
49+ }
50+ } ;
51+
52+ main ( ) . catch ( e => {
53+ console . error ( e ) ;
54+ process . exit ( 1 ) ;
55+ } ) ;
Original file line number Diff line number Diff line change 134134 },
135135 "main" : " ./dist/extension" ,
136136 "scripts" : {
137- "vscode:prepublish" : " npm run package" ,
138- "package" : " webpack --mode production --devtool hidden-source-map" ,
139- "compile" : " webpack --mode development" ,
140- "watch" : " webpack --mode development --watch" ,
137+ "vscode:prepublish" : " npm run check-types && npm run package" ,
138+ "package" : " node esbuild.js --production" ,
139+ "check-types" : " tsc --noEmit" ,
140+ "compile" : " node esbuild.js" ,
141+ "watch" : " node esbuild.js --watch" ,
141142 "clean" : " rm -fr node_modules out dist *.vsix package-lock.json" ,
142143 "vsce-package" : " vsce package" ,
143144 "vsce-pre-release-package" : " vsce package --pre-release"
150151 "@types/node" : " ^18.8.0" ,
151152 "@types/vscode" : " 1.75.0" ,
152153 "@vscode/vsce" : " ^2.22.0" ,
153- "ts-loader" : " ^9.5.1" ,
154- "typescript" : " ^4.8.0" ,
155- "webpack" : " ^5.91.0" ,
156- "webpack-cli" : " ^5.1.4"
154+ "esbuild" : " ^0.25.0" ,
155+ "typescript" : " ^4.8.0"
157156 }
158157}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 66 "script" : " watch" ,
77 "problemMatcher" : {
88 "owner" : " typescript" ,
9- "pattern" :[
10- {
11- "regexp" : " \\ [tsl\\ ] ERROR" ,
12- "file" : 1 ,
13- "location" : 2 ,
14- "message" : 3
15- }
16- ],
9+ "pattern" : {
10+ "regexp" : " ✘ \\ [ERROR\\ ] (.+)" ,
11+ "message" : 1
12+ },
1713 "background" : {
1814 "activeOnStart" : true ,
19- "beginsPattern" : " \\ w+ " ,
20- "endsPattern" : " webpack .* compiled "
15+ "beginsPattern" : " \\ [watch \\ ] build started " ,
16+ "endsPattern" : " \\ [watch \\ ] build finished "
2117 }
2218 },
2319 "isBackground" : true ,
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ build.sh
2323
2424# Build tooling
2525node_modules
26- webpack.config .js
26+ esbuild .js
2727
2828# Compiler output (old tsc output)
2929out /**
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 : [ 'lib/Main.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 : 'silent' ,
18+ plugins : [
19+ esbuildProblemMatcherPlugin
20+ ]
21+ } ) ;
22+ if ( watch ) {
23+ await ctx . watch ( ) ;
24+ } else {
25+ await ctx . rebuild ( ) ;
26+ await ctx . dispose ( ) ;
27+ }
28+ }
29+
30+ /**
31+ * This plugin hooks into the build process to print errors in a format
32+ * that the VS Code problem matcher (`$esbuild-watch`) can detect.
33+ */
34+ const esbuildProblemMatcherPlugin = {
35+ name : 'esbuild-problem-matcher' ,
36+ setup ( build ) {
37+ build . onStart ( ( ) => {
38+ console . log ( '[watch] build started' ) ;
39+ } ) ;
40+ build . onEnd ( result => {
41+ result . errors . forEach ( ( { text, location } ) => {
42+ console . error ( `✘ [ERROR] ${ text } ` ) ;
43+ if ( location ) {
44+ console . error ( ` ${ location . file } :${ location . line } :${ location . column } :` ) ;
45+ }
46+ } ) ;
47+ console . log ( '[watch] build finished' ) ;
48+ } ) ;
49+ }
50+ } ;
51+
52+ main ( ) . catch ( e => {
53+ console . error ( e ) ;
54+ process . exit ( 1 ) ;
55+ } ) ;
Original file line number Diff line number Diff line change 134134 },
135135 "main" : " ./dist/extension" ,
136136 "scripts" : {
137- "vscode:prepublish" : " npm run package" ,
138- "package" : " webpack --mode production --devtool hidden-source-map" ,
139- "compile" : " webpack --mode development" ,
140- "watch" : " webpack --mode development --watch" ,
137+ "vscode:prepublish" : " npm run check-types && npm run package" ,
138+ "package" : " node esbuild.js --production" ,
139+ "check-types" : " tsc --noEmit" ,
140+ "compile" : " node esbuild.js" ,
141+ "watch" : " node esbuild.js --watch" ,
141142 "clean" : " rm -fr node_modules out dist *.vsix package-lock.json" ,
142143 "vsce-package" : " vsce package" ,
143144 "vsce-pre-release-package" : " vsce package --pre-release"
150151 "@types/node" : " ^18.8.0" ,
151152 "@types/vscode" : " 1.75.0" ,
152153 "@vscode/vsce" : " ^2.22.0" ,
153- "ts-loader" : " ^9.5.1" ,
154- "typescript" : " ^4.8.0" ,
155- "webpack" : " ^5.91.0" ,
156- "webpack-cli" : " ^5.1.4"
154+ "esbuild" : " ^0.25.0" ,
155+ "typescript" : " ^4.8.0"
157156 }
158157}
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments