@@ -115,7 +115,7 @@ pub struct ResolverGeneric<Fs> {
115115 options : ResolveOptions ,
116116 cache : Arc < Cache < Fs > > ,
117117 #[ cfg( feature = "yarn_pnp" ) ]
118- pnp_manifest : Arc < arc_swap:: ArcSwapOption < pnp:: Manifest > > ,
118+ pnp_manifest : Arc < arc_swap:: ArcSwapOption < ( PathBuf , pnp:: Manifest ) > > ,
119119 /// Paths that have been searched and confirmed to have no `.pnp.cjs` reachable by filesystem walk.
120120 #[ cfg( feature = "yarn_pnp" ) ]
121121 pnp_no_manifest_cache : Arc < DashSet < CachedPath > > ,
@@ -957,7 +957,7 @@ impl<Fs: FileSystem + Send + Sync> ResolverGeneric<Fs> {
957957
958958 #[ cfg( feature = "yarn_pnp" ) ]
959959 #[ cfg_attr( feature = "enable_instrument" , tracing:: instrument( level=tracing:: Level :: DEBUG , skip_all, fields( path = %cached_path. path( ) . to_string_lossy( ) ) ) ) ]
960- fn find_pnp_manifest ( & self , cached_path : & CachedPath ) -> Option < Arc < pnp:: Manifest > > {
960+ fn find_pnp_manifest ( & self , cached_path : & CachedPath ) -> Option < Arc < ( PathBuf , pnp:: Manifest ) > > {
961961 // 1. Already have a manifest → return it (covers global cache paths too)
962962 if let Some ( manifest) = self . pnp_manifest . load_full ( ) {
963963 return Some ( manifest) ;
@@ -986,7 +986,7 @@ impl<Fs: FileSystem + Send + Sync> ResolverGeneric<Fs> {
986986 tracing:: debug!( "use manifest path: {:?}" , manifest_path) ;
987987
988988 let manifest = pnp:: load_pnp_manifest ( & manifest_path) . ok ( ) ?;
989- let manifest = Arc :: new ( manifest) ;
989+ let manifest = Arc :: new ( ( manifest_path , manifest) ) ;
990990
991991 let previous = self
992992 . pnp_manifest
@@ -1007,13 +1007,15 @@ impl<Fs: FileSystem + Send + Sync> ResolverGeneric<Fs> {
10071007 specifier : & str ,
10081008 ctx : & mut Ctx ,
10091009 ) -> Result < Option < CachedPath > , ResolveError > {
1010- let Some ( manifest ) = self . find_pnp_manifest ( cached_path) else {
1010+ let Some ( pnp_data ) = self . find_pnp_manifest ( cached_path) else {
10111011 return Ok ( None ) ;
10121012 } ;
1013+ let ( manifest_path, manifest) = pnp_data. as_ref ( ) ;
1014+ ctx. add_file_dependency ( manifest_path) ;
10131015
10141016 let mut path = cached_path. to_path_buf ( ) ;
10151017 path. push ( "" ) ;
1016- let resolution = pnp:: resolve_to_unqualified_via_manifest ( & manifest, specifier, & path) ;
1018+ let resolution = pnp:: resolve_to_unqualified_via_manifest ( manifest, specifier, & path) ;
10171019
10181020 tracing:: debug!( "pnp resolve unqualified as: {:?}" , resolution) ;
10191021
0 commit comments