@@ -1430,7 +1430,7 @@ impl NpmCrawler {
14301430 /// project. The one exception is pnpm's virtual store (see below),
14311431 /// whose entries are returned whole: which of them get enqueued is
14321432 /// decided by the caller's pending-name filter
1433- /// ([`Self::pending_store_entries `]) at replay time.
1433+ /// ([`Self::store_entry_may_hold `]) at replay time.
14341434 ///
14351435 /// Entries are examined in parallel; their contributions keep listing
14361436 /// order.
@@ -1561,7 +1561,7 @@ impl NpmCrawler {
15611561 }
15621562 }
15631563
1564- /// The virtual-store entries that can still hold a pending target.
1564+ /// Whether a virtual-store entry can still hold a pending target.
15651565 /// A manifest routinely lists packages that simply aren't installed
15661566 /// here, and probing every entry of a large monorepo store for them
15671567 /// would add a readdir+stat storm to every apply/rollback run. The
@@ -1576,21 +1576,9 @@ impl NpmCrawler {
15761576 /// only advertises the entry's OWN package, so a target present solely
15771577 /// as a bundled dependency INSIDE another package's entry hides behind
15781578 /// a non-matching name — `find_by_purls`' pass-2 fallback probes every
1579- /// entry for exactly those. Both enumerators only yield entries whose
1580- /// `node_modules` exists, so no re-stat here.
1581- fn pending_store_entries (
1582- entries : Vec < StoreEntry > ,
1583- pending_names : Option < & HashSet < & str > > ,
1584- ) -> Vec < PathBuf > {
1585- entries
1586- . into_iter ( )
1587- . filter ( |entry| Self :: store_entry_may_hold ( entry, pending_names) )
1588- . map ( |entry| entry. node_modules )
1589- . collect ( )
1590- }
1591-
1592- /// Whether [`Self::pending_store_entries`] keeps `entry`: no filter, an
1593- /// undecodable name, or an advertised package that is still pending.
1579+ /// entry for exactly those. (An entry skipped here still has its own
1580+ /// package's bundled tree walked, see
1581+ /// [`Self::skipped_entry_bundled_tree`].)
15941582 fn store_entry_may_hold ( entry : & StoreEntry , pending_names : Option < & HashSet < & str > > ) -> bool {
15951583 match ( pending_names, & entry. advertised ) {
15961584 ( Some ( filter) , Some ( ( entry_pkg, _version) ) ) => filter. contains ( entry_pkg. as_str ( ) ) ,
@@ -3989,17 +3977,23 @@ mod tests {
39893977 ]
39903978 } ;
39913979 let pending: HashSet < & str > = [ "foo" , "@s/p" ] . into_iter ( ) . collect ( ) ;
3980+ let kept = |entries : Vec < StoreEntry > | -> Vec < PathBuf > {
3981+ entries
3982+ . into_iter ( )
3983+ . filter ( |e| NpmCrawler :: store_entry_may_hold ( e, Some ( & pending) ) )
3984+ . map ( |e| e. node_modules )
3985+ . collect ( )
3986+ } ;
39923987 assert_eq ! (
3993- NpmCrawler :: pending_store_entries ( StoreEntry :: vlt( entries( ) ) , Some ( & pending ) ) ,
3988+ kept ( StoreEntry :: vlt( entries( ) ) ) ,
39943989 vec![ PathBuf :: from( "a" ) , PathBuf :: from( "b" ) , PathBuf :: from( "c" ) ]
39953990 ) ;
39963991 let as_pnpm = entries ( )
39973992 . into_iter ( )
39983993 . map ( |( n, p) | ( n. into_string ( ) . unwrap ( ) , p) )
39993994 . collect ( ) ;
40003995 assert ! (
4001- !NpmCrawler :: pending_store_entries( StoreEntry :: pnpm( as_pnpm) , Some ( & pending) )
4002- . contains( & PathBuf :: from( "a" ) ) ,
3996+ !kept( StoreEntry :: pnpm( as_pnpm) ) . contains( & PathBuf :: from( "a" ) ) ,
40033997 "the pnpm decoder misreads the legacy name"
40043998 ) ;
40053999 }
0 commit comments