File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed 
packages/cli/src/services/check-parser 
__tests__/check-parser-fixtures/builtin-with-node-prefix Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change 11import  { }  from  'node:path' 
22import  { }  from  'node:url' 
3+ import  { }  from  'node:fs/promises' 
34import  { }  from  'crypto' 
5+ import  { }  from  'timers/promises' 
Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ export class Parser {
100100    this . checkUnsupportedModules  =  options . checkUnsupportedModules  ??  true 
101101  } 
102102
103-   supportsModule  ( importPath : string )  { 
103+   supportsModule  ( importPath : string ) :  boolean  { 
104104    if  ( this . supportedModules . has ( importPath ) )  { 
105105      return  true 
106106    } 
@@ -109,6 +109,21 @@ export class Parser {
109109      return  true 
110110    } 
111111
112+     // Check namespaced modules and module subpaths. 
113+     if  ( importPath . indexOf ( '/' )  !==  - 1 )  { 
114+       if  ( importPath . startsWith ( '@' ) )  { 
115+         const  [ namespace ,  moduleName ]  =  importPath . split ( '/' ,  3 ) 
116+         if  ( this . supportedModules . has ( namespace  +  '/'  +  moduleName ) )  { 
117+           return  true 
118+         } 
119+       }  else  { 
120+         // Recurse to cover values with and without node: prefix. 
121+         // This will not endlessly recurse because we remove the slash. 
122+         const  [ moduleName ]  =  importPath . split ( '/' ,  2 ) 
123+         return  this . supportsModule ( moduleName ) 
124+       } 
125+     } 
126+ 
112127    return  false 
113128  } 
114129
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments