File tree Expand file tree Collapse file tree 4 files changed +10
-16
lines changed Expand file tree Collapse file tree 4 files changed +10
-16
lines changed Original file line number Diff line number Diff line change @@ -146,7 +146,6 @@ const { safeGetenv } = internalBinding('credentials');
146146const  { 
147147  getCjsConditions, 
148148  initializeCjsConditions, 
149-   isUnderNodeModules, 
150149  loadBuiltinModule, 
151150  makeRequireFunction, 
152151  setHasStartedUserCJSExecution, 
Original file line number Diff line number Diff line change 33const  { 
44  RegExpPrototypeExec, 
55}  =  primordials ; 
6- const  {  kEmptyObject }  =  require ( 'internal/util' ) ; 
6+ const  { 
7+   isUnderNodeModules, 
8+   kEmptyObject, 
9+ }  =  require ( 'internal/util' ) ; 
710
811const  {  defaultGetFormat }  =  require ( 'internal/modules/esm/get_format' ) ; 
912const  {  validateAttributes,  emitImportAssertionWarning }  =  require ( 'internal/modules/esm/assert' ) ; 
@@ -14,9 +17,6 @@ const defaultType =
1417  getOptionValue ( '--experimental-default-type' ) ; 
1518
1619const  {  Buffer : {  from : BufferFrom  }  }  =  require ( 'buffer' ) ; 
17- const  { 
18-   isUnderNodeModules, 
19- }  =  require ( 'internal/modules/helpers' ) ; 
2020
2121const  {  URL  }  =  require ( 'internal/url' ) ; 
2222const  { 
Original file line number Diff line number Diff line change 22
33const  { 
44  ArrayPrototypeForEach, 
5-   ArrayPrototypeIncludes, 
65  ObjectDefineProperty, 
76  ObjectFreeze, 
87  ObjectPrototypeHasOwnProperty, 
@@ -11,7 +10,6 @@ const {
1110  StringPrototypeCharCodeAt, 
1211  StringPrototypeIncludes, 
1312  StringPrototypeSlice, 
14-   StringPrototypeSplit, 
1513  StringPrototypeStartsWith, 
1614}  =  primordials ; 
1715const  { 
@@ -387,13 +385,6 @@ function stripTypeScriptTypes(source, filename) {
387385  return  `${ code } ${ filename }  ; 
388386} 
389387
390- function  isUnderNodeModules ( filename )  { 
391-   const  resolvedPath  =  path . resolve ( filename ) ; 
392-   const  normalizedPath  =  path . normalize ( resolvedPath ) ; 
393-   const  splitPath  =  StringPrototypeSplit ( normalizedPath ,  path . sep ) ; 
394-   return  ArrayPrototypeIncludes ( splitPath ,  'node_modules' ) ; 
395- } 
396- 
397388/** 
398389 * Enable on-disk compiled cache for all user modules being complied in the current Node.js instance 
399390 * after this method is called. 
@@ -493,7 +484,6 @@ module.exports = {
493484  getCjsConditions, 
494485  getCompileCacheDir, 
495486  initializeCjsConditions, 
496-   isUnderNodeModules, 
497487  loadBuiltinModule, 
498488  makeRequireFunction, 
499489  normalizeReferrerURL, 
Original file line number Diff line number Diff line change @@ -481,6 +481,10 @@ function spliceOne(list, index) {
481481
482482const  kNodeModulesRE  =  / ^ (?: .* ) [ \\ / ] n o d e _ m o d u l e s [ \\ / ] / ; 
483483
484+ function  isUnderNodeModules ( filename )  { 
485+   return  filename  &&  ( RegExpPrototypeExec ( kNodeModulesRE ,  filename )  !==  null ) ; 
486+ } 
487+ 
484488let  getStructuredStackImpl ; 
485489
486490function  lazyGetStructuredStack ( )  { 
@@ -528,7 +532,7 @@ function isInsideNodeModules() {
528532      )  { 
529533        continue ; 
530534      } 
531-       return  RegExpPrototypeExec ( kNodeModulesRE ,   filename )   !==   null ; 
535+       return  isUnderNodeModules ( filename ) ; 
532536    } 
533537  } 
534538  return  false ; 
@@ -908,6 +912,7 @@ module.exports = {
908912  guessHandleType, 
909913  isError, 
910914  isInsideNodeModules, 
915+   isUnderNodeModules, 
911916  isMacOS, 
912917  isWindows, 
913918  join, 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments