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/npm/resolution/specifier.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/npm/resolution/specifier.rs')
-rw-r--r-- | cli/npm/resolution/specifier.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/cli/npm/resolution/specifier.rs b/cli/npm/resolution/specifier.rs index f8b3776a3..29d65c747 100644 --- a/cli/npm/resolution/specifier.rs +++ b/cli/npm/resolution/specifier.rs @@ -6,8 +6,8 @@ use std::collections::HashSet; use std::collections::VecDeque; use deno_ast::ModuleSpecifier; -use deno_graph::npm::NpmPackageReference; use deno_graph::npm::NpmPackageReq; +use deno_graph::npm::NpmPackageReqReference; use deno_graph::ModuleGraph; pub struct GraphNpmInfo { @@ -113,7 +113,7 @@ pub fn resolve_graph_npm_info(graph: &ModuleGraph) -> GraphNpmInfo { // fill this leaf's information for specifier in &specifiers { - if let Ok(npm_ref) = NpmPackageReference::from_specifier(specifier) { + if let Ok(npm_ref) = NpmPackageReqReference::from_specifier(specifier) { leaf.reqs.insert(npm_ref.req); } else if !specifier.as_str().starts_with(parent_specifier.as_str()) { leaf @@ -165,7 +165,7 @@ pub fn resolve_graph_npm_info(graph: &ModuleGraph) -> GraphNpmInfo { let mut result = Vec::new(); for specifier in &root_specifiers { - match NpmPackageReference::from_specifier(specifier) { + match NpmPackageReqReference::from_specifier(specifier) { Ok(npm_ref) => result.push(npm_ref.req), Err(_) => { pending_specifiers.push_back(get_folder_path_specifier(specifier)) |