File tree Expand file tree Collapse file tree 3 files changed +16
-11
lines changed Expand file tree Collapse file tree 3 files changed +16
-11
lines changed Original file line number Diff line number Diff line change @@ -312,12 +312,16 @@ impl<Fs: FileSystem> Cache<Fs> {
312312 ) -> Result < CachedPath , ResolveError > {
313313 // Check cache first - if this path was already canonicalized, return the cached result
314314 if let Some ( ( weak, path_buf) ) = path. canonicalized . get ( ) {
315- return weak. upgrade ( ) . map ( CachedPath ) . or_else ( || {
316- // Weak pointer upgrade failed - recreate from stored PathBuf
317- Some ( self . value ( path_buf) )
318- } ) . ok_or_else ( || {
319- io:: Error :: new ( io:: ErrorKind :: NotFound , "Cached path no longer exists" ) . into ( )
320- } ) ;
315+ return weak
316+ . upgrade ( )
317+ . map ( CachedPath )
318+ . or_else ( || {
319+ // Weak pointer upgrade failed - recreate from stored PathBuf
320+ Some ( self . value ( path_buf) )
321+ } )
322+ . ok_or_else ( || {
323+ io:: Error :: new ( io:: ErrorKind :: NotFound , "Cached path no longer exists" ) . into ( )
324+ } ) ;
321325 }
322326
323327 // Check for circular symlink by tracking visited paths in the current canonicalization chain
Original file line number Diff line number Diff line change @@ -110,9 +110,8 @@ impl CachedPath {
110110 ) -> Option < Self > {
111111 self . node_modules
112112 . get_or_init ( || {
113- self . module_directory ( "node_modules" , cache, ctx) . map ( |cp| {
114- ( Arc :: downgrade ( & cp. 0 ) , cp. to_path_buf ( ) )
115- } )
113+ self . module_directory ( "node_modules" , cache, ctx)
114+ . map ( |cp| ( Arc :: downgrade ( & cp. 0 ) , cp. to_path_buf ( ) ) )
116115 } )
117116 . as_ref ( )
118117 . and_then ( |( weak, path_buf) | {
Original file line number Diff line number Diff line change @@ -876,7 +876,8 @@ impl<Fs: FileSystem> ResolverGeneric<Fs> {
876876 // 1. let DIRS = NODE_MODULES_PATHS(START)
877877 // 2. for each DIR in DIRS:
878878 for module_name in & self . options . modules {
879- for cached_path in std:: iter:: successors ( Some ( cached_path. clone ( ) ) , |cp| cp. parent ( & self . cache ) )
879+ for cached_path in
880+ std:: iter:: successors ( Some ( cached_path. clone ( ) ) , |cp| cp. parent ( & self . cache ) )
880881 {
881882 // Skip if /path/to/node_modules does not exist
882883 if !self . cache . is_dir ( & cached_path, ctx) {
@@ -1426,7 +1427,8 @@ impl<Fs: FileSystem> ResolverGeneric<Fs> {
14261427
14271428 // 11. While parentURL is not the file system root,
14281429 for module_name in & self . options . modules {
1429- for cached_path in std:: iter:: successors ( Some ( cached_path. clone ( ) ) , |cp| cp. parent ( & self . cache ) )
1430+ for cached_path in
1431+ std:: iter:: successors ( Some ( cached_path. clone ( ) ) , |cp| cp. parent ( & self . cache ) )
14301432 {
14311433 // 1. Let packageURL be the URL resolution of "node_modules/" concatenated with packageSpecifier, relative to parentURL.
14321434 let Some ( cached_path) = self . get_module_directory ( & cached_path, module_name, ctx)
You can’t perform that action at this time.
0 commit comments