File tree Expand file tree Collapse file tree 6 files changed +2017
-74
lines changed
Expand file tree Collapse file tree 6 files changed +2017
-74
lines changed Original file line number Diff line number Diff line change 11/out /
2+ /dist /
23/node_modules /
34/.vscode-test /
45/git-commit-message-plus-99.99.99.vsix
Original file line number Diff line number Diff line change 22.vscode-test /**
33** /* .blend *
44** /test * /
5+
6+ # Source:
7+ # https://code.visualstudio.com/api/working-with-extensions/bundling-extension#publishing
8+ .vscode
9+ node_modules
10+ out /
11+ src /
12+ tsconfig.json
13+ webpack.config.js
14+ esbuild.js
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 ( ` ${ location . file } :${ location . line } :${ location . column } :` ) ;
46+ } ) ;
47+ console . log ( '[watch] build finished' ) ;
48+ } ) ;
49+ }
50+ } ;
51+
52+ main ( ) . catch ( e => {
53+ console . error ( e ) ;
54+ process . exit ( 1 ) ;
55+ } ) ;
You can’t perform that action at this time.
0 commit comments