diff --git a/cli/npm/resolution/mod.rs b/cli/npm/resolution/mod.rs index 18158bd172..c4d05598c8 100644 --- a/cli/npm/resolution/mod.rs +++ b/cli/npm/resolution/mod.rs @@ -382,10 +382,6 @@ impl NpmResolution { .cloned() } - pub fn all_packages(&self) -> Vec { - self.snapshot.read().all_packages() - } - pub fn all_packages_partitioned(&self) -> NpmPackagesPartitioned { self.snapshot.read().all_packages_partitioned() } @@ -398,15 +394,12 @@ impl NpmResolution { self.snapshot.read().clone() } - pub fn lock( - &self, - lockfile: &mut Lockfile, - snapshot: &NpmResolutionSnapshot, - ) -> Result<(), AnyError> { + pub fn lock(&self, lockfile: &mut Lockfile) -> Result<(), AnyError> { + let snapshot = self.snapshot.read(); for (package_req, package_id) in snapshot.package_reqs.iter() { lockfile.insert_npm_specifier(package_req, package_id); } - for package in self.all_packages() { + for package in snapshot.all_packages() { lockfile.check_or_insert_npm_package(&package)?; } Ok(()) diff --git a/cli/npm/resolvers/global.rs b/cli/npm/resolvers/global.rs index d73ccbe9b6..41a1329ec2 100644 --- a/cli/npm/resolvers/global.rs +++ b/cli/npm/resolvers/global.rs @@ -169,8 +169,7 @@ impl InnerNpmPackageResolver for GlobalNpmPackageResolver { } fn lock(&self, lockfile: &mut Lockfile) -> Result<(), AnyError> { - let snapshot = self.resolution.snapshot(); - self.resolution.lock(lockfile, &snapshot) + self.resolution.lock(lockfile) } } diff --git a/cli/npm/resolvers/local.rs b/cli/npm/resolvers/local.rs index b702d3bb35..7c1f38b471 100644 --- a/cli/npm/resolvers/local.rs +++ b/cli/npm/resolvers/local.rs @@ -263,7 +263,7 @@ impl InnerNpmPackageResolver for LocalNpmPackageResolver { } fn lock(&self, lockfile: &mut Lockfile) -> Result<(), AnyError> { - self.resolution.lock(lockfile, &self.snapshot()) + self.resolution.lock(lockfile) } }