Skip to content

Commit

Permalink
Merge branch 'main' into add-deprecated-field
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret committed Aug 19, 2024
2 parents c2e4808 + 2e134b4 commit 1f63f8d
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 60 deletions.
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "eszip"
version = "0.73.0"
version = "0.74.0"
authors = ["the Deno authors"]
edition = "2021"
repository = "https://github.com/denoland/eszip"
Expand Down Expand Up @@ -49,7 +49,7 @@ async-trait = "0.1.68"
base64 = "0.21.0"
deno_ast = { workspace = true }
deno_graph = { workspace = true }
deno_npm = "0.21.0"
deno_npm = "0.22.0"
deno_semver = "0.5.4"
futures = "0.3.26"
hashlink = "0.8.2"
Expand Down
90 changes: 45 additions & 45 deletions src/snapshots/eszip__v2__tests__npm_packages.snap
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ expression: bytes
0,
0,
0,
4,
3,
0,
0,
0,
Expand All @@ -159,7 +159,7 @@ expression: bytes
0,
0,
0,
0,
5,
0,
0,
0,
Expand All @@ -178,53 +178,14 @@ expression: bytes
0,
0,
0,
0,
5,
0,
0,
0,
158,
0,
0,
0,
13,
112,
97,
99,
107,
97,
103,
101,
64,
49,
46,
50,
46,
50,
0,
0,
0,
2,
0,
0,
0,
1,
97,
0,
0,
0,
1,
0,
0,
0,
1,
98,
0,
0,
0,
2,
0,
0,
0,
7,
97,
64,
Expand Down Expand Up @@ -277,7 +238,7 @@ expression: bytes
0,
0,
0,
3,
2,
0,
0,
0,
Expand Down Expand Up @@ -316,7 +277,7 @@ expression: bytes
0,
0,
0,
5,
4,
0,
0,
0,
Expand All @@ -340,7 +301,46 @@ expression: bytes
0,
0,
0,
4,
3,
0,
0,
0,
13,
112,
97,
99,
107,
97,
103,
101,
64,
49,
46,
50,
46,
50,
0,
0,
0,
2,
0,
0,
0,
1,
97,
0,
0,
0,
0,
0,
0,
0,
1,
98,
0,
0,
0,
1,
0,
0,
0,
Expand Down
18 changes: 10 additions & 8 deletions src/v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1156,7 +1156,8 @@ impl EszipV2 {

// add npm snapshot entries to the header and fill the npm bytes
if let Some(npm_snapshot) = self.npm_snapshot {
let npm_snapshot = npm_snapshot.into_serialized();
let mut npm_snapshot = npm_snapshot.into_serialized();
npm_snapshot.packages.sort_by(|a, b| a.id.cmp(&b.id)); // determinism
let ids_to_eszip_ids = npm_snapshot
.packages
.iter()
Expand All @@ -1165,7 +1166,7 @@ impl EszipV2 {
.collect::<HashMap<_, _>>();

let mut root_packages: Vec<_> =
npm_snapshot.root_packages.into_iter().collect();
npm_snapshot.root_packages.iter().collect();
root_packages.sort();
for (req, id) in root_packages {
append_string(&mut modules_header, &req.to_string());
Expand All @@ -1178,11 +1179,7 @@ impl EszipV2 {
append_string(&mut npm_bytes, &pkg.id.as_serialized());
let deps_len = pkg.dependencies.len() as u32;
npm_bytes.extend_from_slice(&deps_len.to_be_bytes());
let mut deps: Vec<_> = pkg
.dependencies
.iter()
.map(|(a, b)| (a.clone(), b.clone()))
.collect();
let mut deps: Vec<_> = pkg.dependencies.iter().collect();
deps.sort();
for (req, id) in deps {
append_string(&mut npm_bytes, &req.to_string());
Expand Down Expand Up @@ -2899,7 +2896,12 @@ mod tests {
.await
.unwrap();
let snapshot = eszip.take_npm_snapshot().unwrap();
assert_eq!(snapshot.as_serialized(), original_snapshot.as_serialized());
assert_eq!(snapshot.into_serialized(), {
let mut original = original_snapshot.into_serialized();
// this will be sorted for determinism
original.packages.sort_by(|a, b| a.id.cmp(&b.id));
original
});

// ensure the eszip still works otherwise
fut.await.unwrap();
Expand Down

0 comments on commit 1f63f8d

Please sign in to comment.