@@ -6,7 +6,7 @@ use radix_trie::Trie;
6
6
use serde:: Deserialize ;
7
7
use serde_with:: { serde_as, DefaultOnNull } ;
8
8
use simple_error:: { self , bail, SimpleError } ;
9
- use std:: { path:: { Path , PathBuf , Component } , fs, collections:: { HashSet , HashMap } } ;
9
+ use std:: { path:: { Path , PathBuf , Component } , fs, collections:: { HashSet , HashMap , hash_map :: Entry } } ;
10
10
use util:: RegexDef ;
11
11
12
12
pub enum Resolution {
@@ -231,6 +231,16 @@ pub fn init_pnp_manifest(manifest: &mut Manifest, p: &Path) {
231
231
} ) ;
232
232
}
233
233
}
234
+
235
+ let top_level_pkg = manifest. package_registry_data
236
+ . get ( "" ) . expect ( "Assertion failed: Should have a top-level name key" )
237
+ . get ( "" ) . expect ( "Assertion failed: Should have a top-level range key" ) ;
238
+
239
+ for ( name, dependency) in & top_level_pkg. package_dependencies {
240
+ if let Entry :: Vacant ( entry) = manifest. fallback_pool . entry ( name. clone ( ) ) {
241
+ entry. insert ( dependency. clone ( ) ) ;
242
+ }
243
+ }
234
244
}
235
245
236
246
pub fn find_pnp_manifest ( parent : & Path ) -> Result < Option < Manifest > , Box < dyn std:: error:: Error > > {
@@ -291,8 +301,8 @@ pub fn resolve_to_unqualified(specifier: &str, parent: &Path, config: &PnpResolu
291
301
let mut is_set = false ;
292
302
293
303
if !is_set {
294
- if let Some ( binding) = parent_pkg. package_dependencies . get ( & ident) {
295
- reference_or_alias = binding. clone ( ) ;
304
+ if let Some ( Some ( binding) ) = parent_pkg. package_dependencies . get ( & ident) {
305
+ reference_or_alias = Some ( binding. clone ( ) ) ;
296
306
is_set = true ;
297
307
}
298
308
}
0 commit comments