44 *--------------------------------------------------------------------------------------------*/
55
66import * as es from 'event-stream' ;
7+ import * as fs from 'fs' ;
8+ import * as glob from 'glob' ;
9+ import * as gulp from 'gulp' ;
10+ import * as path from 'path' ;
711import { Stream } from 'stream' ;
12+ import * as File from 'vinyl' ;
13+ import * as vsce from 'vsce' ;
14+ import * as util2 from './util' ;
815import assign = require( 'object-assign' ) ;
916import remote = require( 'gulp-remote-src' ) ;
1017const flatmap = require ( 'gulp-flatmap' ) ;
@@ -16,13 +23,6 @@ const buffer = require('gulp-buffer');
1623const json = require ( 'gulp-json-editor' ) ;
1724const webpack = require ( 'webpack' ) ;
1825const webpackGulp = require ( 'webpack-stream' ) ;
19- import * as fs from 'fs' ;
20- import * as path from 'path' ;
21- import * as vsce from 'vsce' ;
22- import * as File from 'vinyl' ;
23- import * as glob from 'glob' ;
24- import * as gulp from 'gulp' ;
25- import * as util2 from './util' ;
2626
2727const root = path . resolve ( path . join ( __dirname , '..' , '..' ) ) ;
2828
@@ -67,15 +67,29 @@ export function fromLocal(extensionPath: string, sourceMappingURLBase?: string):
6767 } ) )
6868 . pipe ( packageJsonFilter . restore ) ;
6969
70+ const webpackDone = ( err , stats ) => {
71+ if ( err ) {
72+ result . emit ( 'error' , err ) ;
73+ }
74+ const { compilation } = stats ;
75+ if ( compilation . errors . length > 0 ) {
76+ result . emit ( 'error' , compilation . errors . join ( '\n' ) ) ;
77+ }
78+ if ( compilation . warnings . length > 0 ) {
79+ result . emit ( 'error' , compilation . warnings . join ( '\n' ) ) ;
80+ }
81+ } ;
82+
7083 const webpackStreams = webpackConfigLocations . map ( webpackConfigPath => {
84+ util . log ( `Bundling extension: ${ util . colors . yellow ( path . basename ( extensionPath ) ) } ...` ) ;
85+
7186 const webpackConfig = {
7287 ...require ( webpackConfigPath ) ,
73- ...{ mode : 'production' , stats : 'errors-only' }
88+ ...{ mode : 'production' }
7489 } ;
7590 let relativeOutputPath = path . relative ( extensionPath , webpackConfig . output . path ) ;
76- let webpackBaseDir = path . dirname ( webpackConfigPath ) ;
7791
78- return webpackGulp ( webpackConfig , webpack )
92+ return webpackGulp ( webpackConfig , webpack , webpackDone )
7993 . pipe ( es . through ( function ( data ) {
8094 data . stat = data . stat || { } ;
8195 data . base = extensionPath ;
@@ -260,4 +274,4 @@ export function packageExtensionsStream(opts?: IPackageExtensionsOptions): NodeJ
260274 return es . merge ( localExtensions , localExtensionDependencies , marketplaceExtensions )
261275 . pipe ( util2 . setExecutableBit ( [ '**/*.sh' ] ) )
262276 . pipe ( filter ( [ '**' , '!**/*.js.map' ] ) ) ;
263- }
277+ }
0 commit comments