@@ -28,183 +28,184 @@ const ext = require('./lib/extensions');
2828// ignore: ['**/out/**', '**/node_modules/**']
2929// });
3030const compilations = [
31- 'extensions/configuration-editing/tsconfig.json' ,
32- 'extensions/css-language-features/client/tsconfig.json' ,
33- 'extensions/css-language-features/server/tsconfig.json' ,
34- 'extensions/debug-auto-launch/tsconfig.json' ,
35- 'extensions/debug-server-ready/tsconfig.json' ,
36- 'extensions/emmet/tsconfig.json' ,
37- 'extensions/extension-editing/tsconfig.json' ,
38- 'extensions/git/tsconfig.json' ,
39- 'extensions/git-base/tsconfig.json' ,
40- 'extensions/github/tsconfig.json' ,
41- 'extensions/github-authentication/tsconfig.json' ,
42- 'extensions/grunt/tsconfig.json' ,
43- 'extensions/gulp/tsconfig.json' ,
44- 'extensions/html-language-features/client/tsconfig.json' ,
45- 'extensions/html-language-features/server/tsconfig.json' ,
46- 'extensions/ipynb/tsconfig.json' ,
47- 'extensions/jake/tsconfig.json' ,
48- 'extensions/json-language-features/client/tsconfig.json' ,
49- 'extensions/json-language-features/server/tsconfig.json' ,
50- 'extensions/markdown-language-features/preview-src/tsconfig.json' ,
51- 'extensions/markdown-language-features/server/tsconfig.json' ,
52- 'extensions/markdown-language-features/tsconfig.json' ,
53- 'extensions/markdown-math/tsconfig.json' ,
54- 'extensions/media-preview/tsconfig.json' ,
55- 'extensions/merge-conflict/tsconfig.json' ,
56- 'extensions/microsoft-authentication/tsconfig.json' ,
57- 'extensions/notebook-renderers/tsconfig.json' ,
58- 'extensions/npm/tsconfig.json' ,
59- 'extensions/php-language-features/tsconfig.json' ,
60- 'extensions/references-view/tsconfig.json' ,
61- 'extensions/search-result/tsconfig.json' ,
62- 'extensions/simple-browser/tsconfig.json' ,
63- 'extensions/sagemaker-extension/tsconfig.json' ,
64- 'extensions/sagemaker-idle-extension/tsconfig.json' ,
65- 'extensions/sagemaker-terminal-crash-mitigation/tsconfig.json' ,
66- 'extensions/sagemaker-open-notebook-extension/tsconfig.json' ,
67- 'extensions/sagemaker-ui-dark-theme/tsconfig.json' ,
68- 'extensions/post-startup-notifications/tsconfig.json' ,
69- 'extensions/tunnel-forwarding/tsconfig.json' ,
70- 'extensions/typescript-language-features/test-workspace/tsconfig.json' ,
71- 'extensions/typescript-language-features/web/tsconfig.json' ,
72- 'extensions/typescript-language-features/tsconfig.json' ,
73- 'extensions/vscode-api-tests/tsconfig.json' ,
74- 'extensions/vscode-colorize-tests/tsconfig.json' ,
75- 'extensions/vscode-test-resolver/tsconfig.json' ,
76- '.vscode/extensions/vscode-selfhost-test-provider/tsconfig.json' ,
31+ 'extensions/configuration-editing/tsconfig.json' ,
32+ 'extensions/css-language-features/client/tsconfig.json' ,
33+ 'extensions/css-language-features/server/tsconfig.json' ,
34+ 'extensions/debug-auto-launch/tsconfig.json' ,
35+ 'extensions/debug-server-ready/tsconfig.json' ,
36+ 'extensions/emmet/tsconfig.json' ,
37+ 'extensions/extension-editing/tsconfig.json' ,
38+ 'extensions/git/tsconfig.json' ,
39+ 'extensions/git-base/tsconfig.json' ,
40+ 'extensions/github/tsconfig.json' ,
41+ 'extensions/github-authentication/tsconfig.json' ,
42+ 'extensions/grunt/tsconfig.json' ,
43+ 'extensions/gulp/tsconfig.json' ,
44+ 'extensions/html-language-features/client/tsconfig.json' ,
45+ 'extensions/html-language-features/server/tsconfig.json' ,
46+ 'extensions/ipynb/tsconfig.json' ,
47+ 'extensions/jake/tsconfig.json' ,
48+ 'extensions/json-language-features/client/tsconfig.json' ,
49+ 'extensions/json-language-features/server/tsconfig.json' ,
50+ 'extensions/markdown-language-features/preview-src/tsconfig.json' ,
51+ 'extensions/markdown-language-features/server/tsconfig.json' ,
52+ 'extensions/markdown-language-features/tsconfig.json' ,
53+ 'extensions/markdown-math/tsconfig.json' ,
54+ 'extensions/media-preview/tsconfig.json' ,
55+ 'extensions/merge-conflict/tsconfig.json' ,
56+ 'extensions/microsoft-authentication/tsconfig.json' ,
57+ 'extensions/notebook-renderers/tsconfig.json' ,
58+ 'extensions/npm/tsconfig.json' ,
59+ 'extensions/php-language-features/tsconfig.json' ,
60+ 'extensions/references-view/tsconfig.json' ,
61+ 'extensions/search-result/tsconfig.json' ,
62+ 'extensions/simple-browser/tsconfig.json' ,
63+ 'extensions/sagemaker-extension/tsconfig.json' ,
64+ 'extensions/sagemaker-idle-extension/tsconfig.json' ,
65+ 'extensions/sagemaker-terminal-crash-mitigation/tsconfig.json' ,
66+ 'extensions/sagemaker-open-notebook-extension/tsconfig.json' ,
67+ 'extensions/sagemaker-ui-dark-theme/tsconfig.json' ,
68+ 'extensions/post-startup-notifications/tsconfig.json' ,
69+ 'extensions/tunnel-forwarding/tsconfig.json' ,
70+ 'extensions/typescript-language-features/test-workspace/tsconfig.json' ,
71+ 'extensions/typescript-language-features/web/tsconfig.json' ,
72+ 'extensions/typescript-language-features/tsconfig.json' ,
73+ 'extensions/vscode-api-tests/tsconfig.json' ,
74+ 'extensions/vscode-colorize-tests/tsconfig.json' ,
75+ 'extensions/vscode-test-resolver/tsconfig.json' ,
76+
77+ '.vscode/extensions/vscode-selfhost-test-provider/tsconfig.json' ,
7778] ;
7879
7980const getBaseUrl = out => `https://ticino.blob.core.windows.net/sourcemaps/${ commit } /${ out } ` ;
8081
8182const tasks = compilations . map ( function ( tsconfigFile ) {
82- const absolutePath = path . join ( root , tsconfigFile ) ;
83- const relativeDirname = path . dirname ( tsconfigFile . replace ( / ^ ( .* \/ ) ? e x t e n s i o n s \/ / i, '' ) ) ;
84-
85- const overrideOptions = { } ;
86- overrideOptions . sourceMap = true ;
87-
88- const name = relativeDirname . replace ( / \/ / g, '-' ) ;
89-
90- const srcRoot = path . dirname ( tsconfigFile ) ;
91- const srcBase = path . join ( srcRoot , 'src' ) ;
92- const src = path . join ( srcBase , '**' ) ;
93- const srcOpts = { cwd : root , base : srcBase , dot : true } ;
94-
95- const out = path . join ( srcRoot , 'out' ) ;
96- const baseUrl = getBaseUrl ( out ) ;
97-
98- let headerId , headerOut ;
99- const index = relativeDirname . indexOf ( '/' ) ;
100- if ( index < 0 ) {
101- headerId = 'vscode.' + relativeDirname ;
102- headerOut = 'out' ;
103- } else {
104- headerId = 'vscode.' + relativeDirname . substr ( 0 , index ) ;
105- headerOut = relativeDirname . substr ( index + 1 ) + '/out' ;
106- }
107-
108- function createPipeline ( build , emitError , transpileOnly ) {
109- const nlsDev = require ( 'vscode-nls-dev' ) ;
110- const tsb = require ( './lib/tsb' ) ;
111- const sourcemaps = require ( 'gulp-sourcemaps' ) ;
112-
113- const reporter = createReporter ( 'extensions' ) ;
114-
115- overrideOptions . inlineSources = Boolean ( build ) ;
116- overrideOptions . base = path . dirname ( absolutePath ) ;
117-
118- const compilation = tsb . create ( absolutePath , overrideOptions , { verbose : false , transpileOnly, transpileOnlyIncludesDts : transpileOnly , transpileWithSwc : true } , err => reporter ( err . toString ( ) ) ) ;
119-
120- const pipeline = function ( ) {
121- const input = es . through ( ) ;
122- const tsFilter = filter ( [ '**/*.ts' , '!**/lib/lib*.d.ts' , '!**/node_modules/**' ] , { restore : true , dot : true } ) ;
123- const output = input
124- . pipe ( plumber ( {
125- errorHandler : function ( err ) {
126- if ( err && ! err . __reporter__ ) {
127- reporter ( err ) ;
128- }
129- }
130- } ) )
131- . pipe ( tsFilter )
132- . pipe ( util . loadSourcemaps ( ) )
133- . pipe ( compilation ( ) )
134- . pipe ( build ? nlsDev . rewriteLocalizeCalls ( ) : es . through ( ) )
135- . pipe ( build ? util . stripSourceMappingURL ( ) : es . through ( ) )
136- . pipe ( sourcemaps . write ( '.' , {
137- sourceMappingURL : ! build ? null : f => `${ baseUrl } /${ f . relative } .map` ,
138- addComment : ! ! build ,
139- includeContent : ! ! build ,
140- // note: trailing slash is important, else the source URLs in V8's file coverage are incorrect
141- sourceRoot : '../src/' ,
142- } ) )
143- . pipe ( tsFilter . restore )
144- . pipe ( build ? nlsDev . bundleMetaDataFiles ( headerId , headerOut ) : es . through ( ) )
145- // Filter out *.nls.json file. We needed them only to bundle meta data file.
146- . pipe ( filter ( [ '**' , '!**/*.nls.json' ] , { dot : true } ) )
147- . pipe ( reporter . end ( emitError ) ) ;
148-
149- return es . duplex ( input , output ) ;
150- } ;
151-
152- // add src-stream for project files
153- pipeline . tsProjectSrc = ( ) => {
154- return compilation . src ( srcOpts ) ;
155- } ;
156- return pipeline ;
157- }
158-
159- const cleanTask = task . define ( `clean-extension-${ name } ` , util . rimraf ( out ) ) ;
160-
161- const transpileTask = task . define ( `transpile-extension:${ name } ` , task . series ( cleanTask , ( ) => {
162- const pipeline = createPipeline ( false , true , true ) ;
163- const nonts = gulp . src ( src , srcOpts ) . pipe ( filter ( [ '**' , '!**/*.ts' ] ) ) ;
164- const input = es . merge ( nonts , pipeline . tsProjectSrc ( ) ) ;
165-
166- return input
167- . pipe ( pipeline ( ) )
168- . pipe ( gulp . dest ( out ) ) ;
169- } ) ) ;
170-
171- const compileTask = task . define ( `compile-extension:${ name } ` , task . series ( cleanTask , ( ) => {
172- const pipeline = createPipeline ( false , true ) ;
173- const nonts = gulp . src ( src , srcOpts ) . pipe ( filter ( [ '**' , '!**/*.ts' ] ) ) ;
174- const input = es . merge ( nonts , pipeline . tsProjectSrc ( ) ) ;
175-
176- return input
177- . pipe ( pipeline ( ) )
178- . pipe ( gulp . dest ( out ) ) ;
179- } ) ) ;
180-
181- const watchTask = task . define ( `watch-extension:${ name } ` , task . series ( cleanTask , ( ) => {
182- const pipeline = createPipeline ( false ) ;
183- const nonts = gulp . src ( src , srcOpts ) . pipe ( filter ( [ '**' , '!**/*.ts' ] ) ) ;
184- const input = es . merge ( nonts , pipeline . tsProjectSrc ( ) ) ;
185- const watchInput = watcher ( src , { ...srcOpts , ...{ readDelay : 200 } } ) ;
186-
187- return watchInput
188- . pipe ( util . incremental ( pipeline , input ) )
189- . pipe ( gulp . dest ( out ) ) ;
190- } ) ) ;
191-
192- const compileBuildTask = task . define ( `compile-build-extension-${ name } ` , task . series ( cleanTask , ( ) => {
193- const pipeline = createPipeline ( true , true ) ;
194- const nonts = gulp . src ( src , srcOpts ) . pipe ( filter ( [ '**' , '!**/*.ts' ] ) ) ;
195- const input = es . merge ( nonts , pipeline . tsProjectSrc ( ) ) ;
196-
197- return input
198- . pipe ( pipeline ( ) )
199- . pipe ( gulp . dest ( out ) ) ;
200- } ) ) ;
201-
202- // Tasks
203- gulp . task ( transpileTask ) ;
204- gulp . task ( compileTask ) ;
205- gulp . task ( watchTask ) ;
206-
207- return { transpileTask, compileTask, watchTask, compileBuildTask } ;
83+ const absolutePath = path . join ( root , tsconfigFile ) ;
84+ const relativeDirname = path . dirname ( tsconfigFile . replace ( / ^ ( .* \/ ) ? e x t e n s i o n s \/ / i, '' ) ) ;
85+
86+ const overrideOptions = { } ;
87+ overrideOptions . sourceMap = true ;
88+
89+ const name = relativeDirname . replace ( / \/ / g, '-' ) ;
90+
91+ const srcRoot = path . dirname ( tsconfigFile ) ;
92+ const srcBase = path . join ( srcRoot , 'src' ) ;
93+ const src = path . join ( srcBase , '**' ) ;
94+ const srcOpts = { cwd : root , base : srcBase , dot : true } ;
95+
96+ const out = path . join ( srcRoot , 'out' ) ;
97+ const baseUrl = getBaseUrl ( out ) ;
98+
99+ let headerId , headerOut ;
100+ const index = relativeDirname . indexOf ( '/' ) ;
101+ if ( index < 0 ) {
102+ headerId = 'vscode.' + relativeDirname ;
103+ headerOut = 'out' ;
104+ } else {
105+ headerId = 'vscode.' + relativeDirname . substr ( 0 , index ) ;
106+ headerOut = relativeDirname . substr ( index + 1 ) + '/out' ;
107+ }
108+
109+ function createPipeline ( build , emitError , transpileOnly ) {
110+ const nlsDev = require ( 'vscode-nls-dev' ) ;
111+ const tsb = require ( './lib/tsb' ) ;
112+ const sourcemaps = require ( 'gulp-sourcemaps' ) ;
113+
114+ const reporter = createReporter ( 'extensions' ) ;
115+
116+ overrideOptions . inlineSources = Boolean ( build ) ;
117+ overrideOptions . base = path . dirname ( absolutePath ) ;
118+
119+ const compilation = tsb . create ( absolutePath , overrideOptions , { verbose : false , transpileOnly, transpileOnlyIncludesDts : transpileOnly , transpileWithSwc : true } , err => reporter ( err . toString ( ) ) ) ;
120+
121+ const pipeline = function ( ) {
122+ const input = es . through ( ) ;
123+ const tsFilter = filter ( [ '**/*.ts' , '!**/lib/lib*.d.ts' , '!**/node_modules/**' ] , { restore : true , dot : true } ) ;
124+ const output = input
125+ . pipe ( plumber ( {
126+ errorHandler : function ( err ) {
127+ if ( err && ! err . __reporter__ ) {
128+ reporter ( err ) ;
129+ }
130+ }
131+ } ) )
132+ . pipe ( tsFilter )
133+ . pipe ( util . loadSourcemaps ( ) )
134+ . pipe ( compilation ( ) )
135+ . pipe ( build ? nlsDev . rewriteLocalizeCalls ( ) : es . through ( ) )
136+ . pipe ( build ? util . stripSourceMappingURL ( ) : es . through ( ) )
137+ . pipe ( sourcemaps . write ( '.' , {
138+ sourceMappingURL : ! build ? null : f => `${ baseUrl } /${ f . relative } .map` ,
139+ addComment : ! ! build ,
140+ includeContent : ! ! build ,
141+ // note: trailing slash is important, else the source URLs in V8's file coverage are incorrect
142+ sourceRoot : '../src/' ,
143+ } ) )
144+ . pipe ( tsFilter . restore )
145+ . pipe ( build ? nlsDev . bundleMetaDataFiles ( headerId , headerOut ) : es . through ( ) )
146+ // Filter out *.nls.json file. We needed them only to bundle meta data file.
147+ . pipe ( filter ( [ '**' , '!**/*.nls.json' ] , { dot : true } ) )
148+ . pipe ( reporter . end ( emitError ) ) ;
149+
150+ return es . duplex ( input , output ) ;
151+ } ;
152+
153+ // add src-stream for project files
154+ pipeline . tsProjectSrc = ( ) => {
155+ return compilation . src ( srcOpts ) ;
156+ } ;
157+ return pipeline ;
158+ }
159+
160+ const cleanTask = task . define ( `clean-extension-${ name } ` , util . rimraf ( out ) ) ;
161+
162+ const transpileTask = task . define ( `transpile-extension:${ name } ` , task . series ( cleanTask , ( ) => {
163+ const pipeline = createPipeline ( false , true , true ) ;
164+ const nonts = gulp . src ( src , srcOpts ) . pipe ( filter ( [ '**' , '!**/*.ts' ] ) ) ;
165+ const input = es . merge ( nonts , pipeline . tsProjectSrc ( ) ) ;
166+
167+ return input
168+ . pipe ( pipeline ( ) )
169+ . pipe ( gulp . dest ( out ) ) ;
170+ } ) ) ;
171+
172+ const compileTask = task . define ( `compile-extension:${ name } ` , task . series ( cleanTask , ( ) => {
173+ const pipeline = createPipeline ( false , true ) ;
174+ const nonts = gulp . src ( src , srcOpts ) . pipe ( filter ( [ '**' , '!**/*.ts' ] ) ) ;
175+ const input = es . merge ( nonts , pipeline . tsProjectSrc ( ) ) ;
176+
177+ return input
178+ . pipe ( pipeline ( ) )
179+ . pipe ( gulp . dest ( out ) ) ;
180+ } ) ) ;
181+
182+ const watchTask = task . define ( `watch-extension:${ name } ` , task . series ( cleanTask , ( ) => {
183+ const pipeline = createPipeline ( false ) ;
184+ const nonts = gulp . src ( src , srcOpts ) . pipe ( filter ( [ '**' , '!**/*.ts' ] ) ) ;
185+ const input = es . merge ( nonts , pipeline . tsProjectSrc ( ) ) ;
186+ const watchInput = watcher ( src , { ...srcOpts , ...{ readDelay : 200 } } ) ;
187+
188+ return watchInput
189+ . pipe ( util . incremental ( pipeline , input ) )
190+ . pipe ( gulp . dest ( out ) ) ;
191+ } ) ) ;
192+
193+ const compileBuildTask = task . define ( `compile-build-extension-${ name } ` , task . series ( cleanTask , ( ) => {
194+ const pipeline = createPipeline ( true , true ) ;
195+ const nonts = gulp . src ( src , srcOpts ) . pipe ( filter ( [ '**' , '!**/*.ts' ] ) ) ;
196+ const input = es . merge ( nonts , pipeline . tsProjectSrc ( ) ) ;
197+
198+ return input
199+ . pipe ( pipeline ( ) )
200+ . pipe ( gulp . dest ( out ) ) ;
201+ } ) ) ;
202+
203+ // Tasks
204+ gulp . task ( transpileTask ) ;
205+ gulp . task ( compileTask ) ;
206+ gulp . task ( watchTask ) ;
207+
208+ return { transpileTask, compileTask, watchTask, compileBuildTask } ;
208209} ) ;
209210
210211const transpileExtensionsTask = task . define ( 'transpile-extensions' , task . parallel ( ...tasks . map ( t => t . transpileTask ) ) ) ;
@@ -241,18 +242,18 @@ exports.compileExtensionMediaBuildTask = compileExtensionMediaBuildTask;
241242
242243const cleanExtensionsBuildTask = task . define ( 'clean-extensions-build' , util . rimraf ( '.build/extensions' ) ) ;
243244const compileExtensionsBuildTask = task . define ( 'compile-extensions-build' , task . series (
244- cleanExtensionsBuildTask ,
245- task . define ( 'bundle-marketplace-extensions-build' , ( ) => ext . packageMarketplaceExtensionsStream ( false ) . pipe ( gulp . dest ( '.build' ) ) ) ,
246- task . define ( 'bundle-extensions-build' , ( ) => ext . packageLocalExtensionsStream ( false , false ) . pipe ( gulp . dest ( '.build' ) ) ) ,
245+ cleanExtensionsBuildTask ,
246+ task . define ( 'bundle-marketplace-extensions-build' , ( ) => ext . packageMarketplaceExtensionsStream ( false ) . pipe ( gulp . dest ( '.build' ) ) ) ,
247+ task . define ( 'bundle-extensions-build' , ( ) => ext . packageLocalExtensionsStream ( false , false ) . pipe ( gulp . dest ( '.build' ) ) ) ,
247248) ) ;
248249
249250gulp . task ( compileExtensionsBuildTask ) ;
250251gulp . task ( task . define ( 'extensions-ci' , task . series ( compileExtensionsBuildTask , compileExtensionMediaBuildTask ) ) ) ;
251252
252253const compileExtensionsBuildPullRequestTask = task . define ( 'compile-extensions-build-pr' , task . series (
253- cleanExtensionsBuildTask ,
254- task . define ( 'bundle-marketplace-extensions-build' , ( ) => ext . packageMarketplaceExtensionsStream ( false ) . pipe ( gulp . dest ( '.build' ) ) ) ,
255- task . define ( 'bundle-extensions-build-pr' , ( ) => ext . packageLocalExtensionsStream ( false , true ) . pipe ( gulp . dest ( '.build' ) ) ) ,
254+ cleanExtensionsBuildTask ,
255+ task . define ( 'bundle-marketplace-extensions-build' , ( ) => ext . packageMarketplaceExtensionsStream ( false ) . pipe ( gulp . dest ( '.build' ) ) ) ,
256+ task . define ( 'bundle-extensions-build-pr' , ( ) => ext . packageLocalExtensionsStream ( false , true ) . pipe ( gulp . dest ( '.build' ) ) ) ,
256257) ) ;
257258
258259gulp . task ( compileExtensionsBuildPullRequestTask ) ;
@@ -275,10 +276,10 @@ exports.watchWebExtensionsTask = watchWebExtensionsTask;
275276 * @param {boolean } isWatch
276277 */
277278async function buildWebExtensions ( isWatch ) {
278- const extensionsPath = path . join ( root , 'extensions' ) ;
279- const webpackConfigLocations = await nodeUtil . promisify ( glob ) (
280- path . join ( extensionsPath , '**' , 'extension-browser.webpack.config.js' ) ,
281- { ignore : [ '**/node_modules' ] }
282- ) ;
283- return ext . webpackExtensions ( 'packaging web extension' , isWatch , webpackConfigLocations . map ( configPath => ( { configPath } ) ) ) ;
279+ const extensionsPath = path . join ( root , 'extensions' ) ;
280+ const webpackConfigLocations = await nodeUtil . promisify ( glob ) (
281+ path . join ( extensionsPath , '**' , 'extension-browser.webpack.config.js' ) ,
282+ { ignore : [ '**/node_modules' ] }
283+ ) ;
284+ return ext . webpackExtensions ( 'packaging web extension' , isWatch , webpackConfigLocations . map ( configPath => ( { configPath } ) ) ) ;
284285}
0 commit comments