diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2023-02-21 12:03:48 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-21 12:03:48 -0500 |
commit | 3479bc76613761cf31f7557d482e691274c365f1 (patch) | |
tree | cd608c4206d61cde4141ea3ecfe5f4ef285b1d80 /cli/tools/installer.rs | |
parent | 608c855f1166e0ed76762fd9afd00bb52cc65032 (diff) |
fix(npm): improve peer dependency resolution (#17835)
This PR fixes peer dependency resolution to only resolve peers based on
the current graph traversal path. Previously, it would resolve a peers
by looking at a graph node's ancestors, which is not correct because
graph nodes are shared by different resolutions.
It also stores more information about peer dependency resolution in the
lockfile.
Diffstat (limited to 'cli/tools/installer.rs')
-rw-r--r-- | cli/tools/installer.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/cli/tools/installer.rs b/cli/tools/installer.rs index 68e52d8f4..a43ec84d5 100644 --- a/cli/tools/installer.rs +++ b/cli/tools/installer.rs @@ -15,7 +15,7 @@ use deno_core::error::generic_error; use deno_core::error::AnyError; use deno_core::resolve_url_or_path; use deno_core::url::Url; -use deno_graph::npm::NpmPackageReference; +use deno_graph::npm::NpmPackageReqReference; use log::Level; use once_cell::sync::Lazy; use regex::Regex; @@ -139,7 +139,7 @@ pub async fn infer_name_from_url(url: &Url) -> Option<String> { } } - if let Ok(npm_ref) = NpmPackageReference::from_specifier(&url) { + if let Ok(npm_ref) = NpmPackageReqReference::from_specifier(&url) { if let Some(sub_path) = npm_ref.sub_path { if !sub_path.contains('/') { return Some(sub_path); @@ -430,7 +430,7 @@ async fn resolve_shim_data( executable_args.push("--no-lock".to_string()); } else if flags.lock.is_some() // always use a lockfile for an npm entrypoint unless --no-lock - || NpmPackageReference::from_specifier(&module_url).is_ok() + || NpmPackageReqReference::from_specifier(&module_url).is_ok() { let copy_path = get_hidden_file_with_ext(&file_path, "lock.json"); executable_args.push("--lock".to_string()); |