diff --git a/Cargo.lock b/Cargo.lock index 77dc2cb4c4..9e000ddafc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1981,9 +1981,9 @@ dependencies = [ [[package]] name = "deno_npm" -version = "0.25.5" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ded7af9db5d9f2986a739d1b5fbe1c57f498e4f996ae4114728e7c6dad213f" +checksum = "f2f125a5dba7839c46394a0a9c835da9fe60f5f412587ab4956a76492a1cc6a8" dependencies = [ "anyhow", "async-trait", diff --git a/Cargo.toml b/Cargo.toml index f6606b54c3..068046607f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -53,7 +53,7 @@ deno_bench_util = { version = "0.174.0", path = "./bench_util" } deno_config = { version = "=0.39.3", features = ["workspace", "sync"] } deno_lockfile = "=0.23.2" deno_media_type = { version = "0.2.0", features = ["module_specifier"] } -deno_npm = "=0.25.5" +deno_npm = "=0.26.0" deno_path_util = "=0.2.1" deno_permissions = { version = "0.40.0", path = "./runtime/permissions" } deno_runtime = { version = "0.189.0", path = "./runtime" } diff --git a/cli/npm/managed/resolution.rs b/cli/npm/managed/resolution.rs index ecfe5cb25c..033c853233 100644 --- a/cli/npm/managed/resolution.rs +++ b/cli/npm/managed/resolution.rs @@ -8,11 +8,10 @@ use deno_core::error::AnyError; use deno_lockfile::NpmPackageDependencyLockfileInfo; use deno_lockfile::NpmPackageLockfileInfo; use deno_npm::registry::NpmRegistryApi; +use deno_npm::resolution::AddPkgReqsOptions; use deno_npm::resolution::NpmPackagesPartitioned; use deno_npm::resolution::NpmResolutionError; use deno_npm::resolution::NpmResolutionSnapshot; -use deno_npm::resolution::NpmResolutionSnapshotPendingResolver; -use deno_npm::resolution::NpmResolutionSnapshotPendingResolverOptions; use deno_npm::resolution::PackageCacheFolderIdNotFoundError; use deno_npm::resolution::PackageNotFoundFromReferrerError; use deno_npm::resolution::PackageNvNotFoundError; @@ -283,8 +282,9 @@ async fn add_package_reqs_to_snapshot( /* this string is used in tests */ "Running npm resolution." ); - let pending_resolver = get_npm_pending_resolver(api); - let result = pending_resolver.add_pkg_reqs(snapshot, package_reqs).await; + let result = snapshot + .add_pkg_reqs(api, get_add_pkg_reqs_options(package_reqs)) + .await; api.clear_memory_cache(); let result = match &result.dep_graph_result { Err(NpmResolutionError::Resolution(err)) if api.mark_force_reload() => { @@ -293,7 +293,9 @@ async fn add_package_reqs_to_snapshot( // try again let snapshot = get_new_snapshot(); - let result = pending_resolver.add_pkg_reqs(snapshot, package_reqs).await; + let result = snapshot + .add_pkg_reqs(api, get_add_pkg_reqs_options(package_reqs)) + .await; api.clear_memory_cache(); result } @@ -309,19 +311,15 @@ async fn add_package_reqs_to_snapshot( result } -fn get_npm_pending_resolver( - api: &CliNpmRegistryApi, -) -> NpmResolutionSnapshotPendingResolver { - NpmResolutionSnapshotPendingResolver::new( - NpmResolutionSnapshotPendingResolverOptions { - api, - // WARNING: When bumping this version, check if anything needs to be - // updated in the `setNodeOnlyGlobalNames` call in 99_main_compiler.js - types_node_version_req: Some( - VersionReq::parse_from_npm("22.0.0 - 22.5.4").unwrap(), - ), - }, - ) +fn get_add_pkg_reqs_options(package_reqs: &[PackageReq]) -> AddPkgReqsOptions { + AddPkgReqsOptions { + package_reqs, + // WARNING: When bumping this version, check if anything needs to be + // updated in the `setNodeOnlyGlobalNames` call in 99_main_compiler.js + types_node_version_req: Some( + VersionReq::parse_from_npm("22.0.0 - 22.5.4").unwrap(), + ), + } } fn populate_lockfile_from_snapshot(