Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to lockfile v4 #60

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ license = "MIT"
anyhow = "1.0.70"
async-trait = "0.1.68"
deno_semver = "0.5.4"
deno_lockfile = "0.20.0"
deno_lockfile = { git = "https://github.com/zebreus/deno_lockfile.git", branch = "work-on-lockfile" }
Copy link

@birkskyum birkskyum Sep 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be v0.22 or later, which default lockfile v4?

monch = "0.5.0"
log = "0.4"
serde = { version = "1.0.130", features = ["derive", "rc"] }
Expand Down
10 changes: 5 additions & 5 deletions src/resolution/snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -812,10 +812,10 @@ pub fn incomplete_snapshot_from_lockfile(
lockfile: &Lockfile,
) -> Result<IncompleteSnapshot, IncompleteSnapshotFromLockfileError> {
let mut root_packages = HashMap::<PackageReq, NpmPackageId>::with_capacity(
lockfile.content.packages.specifiers.len(),
lockfile.content().specifiers.len(),
);
// collect the specifiers to version mappings
for (key, value) in &lockfile.content.packages.specifiers {
for (key, value) in &lockfile.content().specifiers {
if let Some(key) = key.strip_prefix("npm:") {
if let Some(value) = value.strip_prefix("npm:") {
let package_req = PackageReq::from_str(key).map_err(|e| {
Expand All @@ -831,8 +831,8 @@ pub fn incomplete_snapshot_from_lockfile(
}

// now fill the packages except for the dist information
let mut packages = Vec::with_capacity(lockfile.content.packages.npm.len());
for (key, package) in &lockfile.content.packages.npm {
let mut packages = Vec::with_capacity(lockfile.content().npm.len());
for (key, package) in &lockfile.content().npm {
let id = NpmPackageId::from_serialized(key)?;

// collect the dependencies
Expand All @@ -850,7 +850,7 @@ pub fn incomplete_snapshot_from_lockfile(
}

Ok(IncompleteSnapshot {
lockfile_file_name: lockfile.filename.clone(),
lockfile_file_name: lockfile.filename().clone(),
root_packages,
packages,
})
Expand Down
Loading