@@ -24,6 +24,9 @@ var fs = require("graceful-fs"),
2424// For compat with older versions of Node.js.
2525require ( "es6-promise" ) . polyfill ( ) ;
2626
27+ // Suppress Node.js deprecation warnings during build output.
28+ // process.noDeprecation = true;
29+
2730// To suppress memory leak warning from gulp.watch().
2831require ( "events" ) . EventEmitter . prototype . _maxListeners = 100 ;
2932
@@ -121,16 +124,31 @@ function resolveAssetGroupPaths(assetGroup, assetManifestPath) {
121124 assetGroup . inputs . forEach ( inputPath => {
122125
123126 var resolvedPath = path . resolve ( path . join ( assetGroup . basePath , inputPath ) ) . replace ( / \\ / g, '/' ) ;
127+ var isNodeModulesPath = inputPath . startsWith ( "node_modules/" ) || inputPath . startsWith ( "./node_modules/" ) ;
124128
125129 if ( resolvedPath . includes ( '*' ) ) {
126130 var sortedPaths = glob . sync ( resolvedPath , { } ) ;
127131
132+ // Fall back to repo root 'node_modules' when modules are not restored locally.
133+ if ( isNodeModulesPath && sortedPaths . length === 0 ) {
134+ var rootResolvedPath = path . resolve ( inputPath ) . replace ( / \\ / g, '/' ) ;
135+ sortedPaths = glob . sync ( rootResolvedPath , { } ) ;
136+ }
137+
128138 sortedPaths . sort ( ) ;
129139
130140 sortedPaths . forEach ( sortedPath => {
131141 inputPaths . push ( sortedPath . replace ( / \\ / g, '/' ) ) ;
132142 } ) ;
133143 } else {
144+ // Fall back to repo root 'node_modules' when modules are not restored locally.
145+ if ( isNodeModulesPath && ! fs . existsSync ( resolvedPath ) ) {
146+ var rootResolvedPath = path . resolve ( inputPath ) . replace ( / \\ / g, '/' ) ;
147+ if ( fs . existsSync ( rootResolvedPath ) ) {
148+ resolvedPath = rootResolvedPath ;
149+ }
150+ }
151+
134152 inputPaths . push ( resolvedPath ) ;
135153 }
136154 } ) ;
@@ -205,6 +223,7 @@ function buildCssPipeline(assetGroup, doConcat, doRebuild) {
205223 . pipe ( gulpif ( "*.less" , less ( ) ) )
206224 . pipe ( gulpif ( "*.scss" , scss ( {
207225 precision : 10 ,
226+ silenceDeprecations : [ "legacy-js-api" ] ,
208227
209228 } ) ) )
210229 . pipe ( gulpif ( doConcat , concat ( assetGroup . outputFileName ) ) )
@@ -239,7 +258,8 @@ function buildCssPipeline(assetGroup, doConcat, doRebuild) {
239258 . pipe ( gulpif ( generateSourceMaps , sourcemaps . init ( ) ) )
240259 . pipe ( gulpif ( "*.less" , less ( ) ) )
241260 . pipe ( gulpif ( "*.scss" , scss ( {
242- precision : 10
261+ precision : 10 ,
262+ silenceDeprecations : [ "legacy-js-api" ]
243263 } ) ) )
244264 . pipe ( gulpif ( doConcat , concat ( assetGroup . outputFileName ) ) )
245265 . pipe ( gulpif ( generateRTL , postcss ( [ rtl ( ) ] ) ) )
@@ -266,12 +286,6 @@ function buildJsPipeline(assetGroup, doConcat, doRebuild) {
266286 declaration : false ,
267287 noImplicitAny : true ,
268288 noEmitOnError : true ,
269- lib : [
270- "dom" ,
271- "es5" ,
272- "scripthost" ,
273- "es2015.iterable"
274- ] ,
275289 target : "es5" ,
276290 } ;
277291
0 commit comments