File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
packages/cubejs-schema-compiler/compiler Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -247,10 +247,16 @@ class DataSchemaCompiler {
247
247
path . resolve ( 'node_modules' , modulePath ) ;
248
248
249
249
if ( absPath . indexOf ( nodeModulesPath ) !== 0 ) {
250
+ if ( this . allowNodeRequire ) {
251
+ return null ;
252
+ }
250
253
throw new UserError ( `'${ modulePath } ' restricted` ) ;
251
254
}
252
255
const packagePath = absPath . replace ( nodeModulesPath , '' ) . split ( '/' ) . filter ( s => ! ! s ) [ 0 ] ;
253
256
if ( ! packagePath ) {
257
+ if ( this . allowNodeRequire ) {
258
+ return null ;
259
+ }
254
260
throw new UserError ( `'${ modulePath } ' is incorrect` ) ;
255
261
}
256
262
if ( ! this . isWhiteListedPackage ( packagePath ) ) {
@@ -267,6 +273,9 @@ class DataSchemaCompiler {
267
273
}
268
274
absPath = path . extname ( absPath ) !== '.js' ? absPath + '.js' : absPath ;
269
275
if ( ! fs . existsSync ( absPath ) ) {
276
+ if ( this . allowNodeRequire ) {
277
+ return null ;
278
+ }
270
279
throw new UserError ( `Path '${ absPath . replace ( nodeModulesPath + '/' , '' ) } ' not found` ) ;
271
280
}
272
281
return this . readModuleFile ( absPath , errorsReport ) ;
You can’t perform that action at this time.
0 commit comments