@@ -7,6 +7,7 @@ mod bin_entries;
7
7
use std:: borrow:: Cow ;
8
8
use std:: cell:: RefCell ;
9
9
use std:: cmp:: Ordering ;
10
+ use std:: collections:: BTreeMap ;
10
11
use std:: collections:: HashMap ;
11
12
use std:: collections:: HashSet ;
12
13
use std:: fs;
@@ -515,10 +516,13 @@ async fn sync_resolution_with_fs(
515
516
Ok ( ( ) )
516
517
}
517
518
519
+ // Uses BTreeMap to preserve the ordering of the elements in memory, to ensure
520
+ // the file generated from this datastructure is deterministic.
521
+ // See: https://github.com/denoland/deno/issues/24479
518
522
/// Represents a dependency at `node_modules/.deno/<package_id>/`
519
523
struct SetupCacheDep < ' a > {
520
- previous : Option < & ' a HashMap < String , String > > ,
521
- current : & ' a mut HashMap < String , String > ,
524
+ previous : Option < & ' a BTreeMap < String , String > > ,
525
+ current : & ' a mut BTreeMap < String , String > ,
522
526
}
523
527
524
528
impl < ' a > SetupCacheDep < ' a > {
@@ -534,11 +538,14 @@ impl<'a> SetupCacheDep<'a> {
534
538
}
535
539
}
536
540
541
+ // Uses BTreeMap to preserve the ordering of the elements in memory, to ensure
542
+ // the file generated from this datastructure is deterministic.
543
+ // See: https://github.com/denoland/deno/issues/24479
537
544
#[ derive( Debug , Default , Serialize , Deserialize , PartialEq , Eq ) ]
538
545
struct SetupCacheData {
539
- root_symlinks : HashMap < String , String > ,
540
- deno_symlinks : HashMap < String , String > ,
541
- dep_symlinks : HashMap < String , HashMap < String , String > > ,
546
+ root_symlinks : BTreeMap < String , String > ,
547
+ deno_symlinks : BTreeMap < String , String > ,
548
+ dep_symlinks : BTreeMap < String , BTreeMap < String , String > > ,
542
549
}
543
550
544
551
/// It is very slow to try to re-setup the symlinks each time, so this will
0 commit comments