@@ -374,7 +374,7 @@ fn flatten_dependencies(dependencies: Vec<Dependency>) -> Vec<Dependency> {
374374    flattened
375375} 
376376
377- fn  read_package_name ( package_dir :  & str )  -> Result < String >  { 
377+ pub   fn  read_package_name ( package_dir :  & str )  -> Result < String >  { 
378378    let  package_json_path = if  package_dir. is_empty ( )  { 
379379        "package.json" . to_string ( ) 
380380    }  else  { 
@@ -415,8 +415,10 @@ fn make_package(config: config::Config, package_path: &str, is_pinned_dep: bool,
415415        } 
416416    } ; 
417417
418+     let  package_name = read_package_name ( package_path) . expect ( "Could not read package name" ) ; 
419+     println ! ( "creating package: {:?}" ,  package_name) ; 
418420    Package  { 
419-         name :  read_package_name ( package_path ) . expect ( "Could not read package name" ) , 
421+         name :  package_name , 
420422        config :  config. to_owned ( ) , 
421423        source_folders, 
422424        source_files :  None , 
@@ -444,10 +446,8 @@ fn read_packages(
444446
445447    // Store all packages and completely deduplicate them 
446448    let  mut  map:  AHashMap < String ,  Package >  = AHashMap :: new ( ) ; 
447-     map. insert ( 
448-         root_config. name . to_owned ( ) , 
449-         make_package ( root_config. to_owned ( ) ,  project_root,  false ,  true ) , 
450-     ) ; 
449+     let  root_package = make_package ( root_config. to_owned ( ) ,  project_root,  false ,  true ) ; 
450+     map. insert ( root_package. name . to_string ( ) ,  root_package) ; 
451451
452452    let  mut  registered_dependencies_set:  AHashSet < String >  = AHashSet :: new ( ) ; 
453453    let  dependencies = flatten_dependencies ( read_dependencies ( 
@@ -460,10 +460,8 @@ fn read_packages(
460460    ) ) ; 
461461    dependencies. iter ( ) . for_each ( |d| { 
462462        if  !map. contains_key ( & d. name )  { 
463-             map. insert ( 
464-                 d. name . to_owned ( ) , 
465-                 make_package ( d. config . to_owned ( ) ,  & d. path ,  d. is_pinned ,  false ) , 
466-             ) ; 
463+             let  package = make_package ( d. config . to_owned ( ) ,  & d. path ,  d. is_pinned ,  false ) ; 
464+             map. insert ( package. name . to_string ( ) ,  package) ; 
467465        } 
468466    } ) ; 
469467
@@ -581,12 +579,6 @@ pub fn make(
581579    Ok ( result) 
582580} 
583581
584- pub  fn  get_package_name ( path :  & str )  -> Result < String >  { 
585-     let  config = read_config ( path) ?; 
586- 
587-     Ok ( config. name ) 
588- } 
589- 
590582pub  fn  parse_packages ( build_state :  & mut  BuildState )  { 
591583    build_state
592584        . packages 
0 commit comments