Skip to content

Commit

Permalink
Update to new lockfile interface
Browse files Browse the repository at this point in the history
  • Loading branch information
zebreus committed Jul 27, 2024
1 parent bc7e773 commit fb230f2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

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

0 comments on commit fb230f2

Please sign in to comment.