summaryrefslogtreecommitdiff
path: root/cli/args/lockfile.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2023-04-13 10:47:45 -0400
committerGitHub <noreply@github.com>2023-04-13 10:47:45 -0400
commitefa7c19890f58d9d446477e03e460b1190023c85 (patch)
treecce52a3abd56dd0a65adbedd2b94bc88ea68f1c2 /cli/args/lockfile.rs
parent2eb0f9fb5cc3fd4c0d318cd04bdc03603b9ef70a (diff)
refactor: upgrade to deno_npm 0.3.0 (#18671)
This allows us to specify the `@types/node` version constraint in the CLI instead of in deno_npm.
Diffstat (limited to 'cli/args/lockfile.rs')
-rw-r--r--cli/args/lockfile.rs15
1 files changed, 8 insertions, 7 deletions
diff --git a/cli/args/lockfile.rs b/cli/args/lockfile.rs
index 48a3e89c1..8cb21781a 100644
--- a/cli/args/lockfile.rs
+++ b/cli/args/lockfile.rs
@@ -11,9 +11,9 @@ use deno_core::futures::stream::FuturesOrdered;
use deno_core::futures::StreamExt;
use deno_core::parking_lot::Mutex;
use deno_npm::registry::NpmRegistryApi;
-use deno_npm::resolution::NpmResolutionSnapshot;
-use deno_npm::resolution::NpmResolutionSnapshotCreateOptions;
-use deno_npm::resolution::NpmResolutionSnapshotCreateOptionsPackage;
+use deno_npm::resolution::SerializedNpmResolutionSnapshot;
+use deno_npm::resolution::SerializedNpmResolutionSnapshotPackage;
+use deno_npm::resolution::ValidSerializedNpmResolutionSnapshot;
use deno_npm::NpmPackageId;
use deno_semver::npm::NpmPackageReq;
@@ -77,7 +77,7 @@ pub fn discover(
pub async fn snapshot_from_lockfile(
lockfile: Arc<Mutex<Lockfile>>,
api: &CliNpmRegistryApi,
-) -> Result<NpmResolutionSnapshot, AnyError> {
+) -> Result<ValidSerializedNpmResolutionSnapshot, AnyError> {
let (root_packages, mut packages) = {
let lockfile = lockfile.lock();
@@ -105,7 +105,7 @@ pub async fn snapshot_from_lockfile(
dependencies.insert(name.clone(), dep_id);
}
- packages.push(NpmResolutionSnapshotCreateOptionsPackage {
+ packages.push(SerializedNpmResolutionSnapshotPackage {
pkg_id,
dist: Default::default(), // temporarily empty
dependencies,
@@ -154,9 +154,10 @@ pub async fn snapshot_from_lockfile(
// clear the memory cache to reduce memory usage
api.clear_memory_cache();
- NpmResolutionSnapshot::from_packages(NpmResolutionSnapshotCreateOptions {
+ SerializedNpmResolutionSnapshot {
packages,
root_packages,
- })
+ }
+ .into_valid()
.context("The lockfile is corrupt. You can recreate it with --lock-write")
}