mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-31 05:22:00 -04:00
fix(resolve-dependencies): optimize splitNodeId, fix invalid nodeId (#6755)
This commit is contained in:
5
.changeset/nice-geese-fly.md
Normal file
5
.changeset/nice-geese-fly.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/resolve-dependencies": patch
|
||||
---
|
||||
|
||||
Fix edge case where invalid "nodeId" was created. Small optimization.
|
||||
@@ -18,5 +18,5 @@ export function createNodeId (parentNodeId: string, pkgId: string) {
|
||||
}
|
||||
|
||||
export function splitNodeId (nodeId: string) {
|
||||
return nodeId.slice(1, -1).split('>')
|
||||
return nodeId.split('>').slice(1, -1)
|
||||
}
|
||||
|
||||
@@ -1241,7 +1241,7 @@ async function resolveDependency (
|
||||
// In case of leaf dependencies (dependencies that have no prod deps or peer deps),
|
||||
// we only ever need to analyze one leaf dep in a graph, so the nodeId can be short and stateless.
|
||||
const nodeId = pkgIsLeaf(pkg)
|
||||
? pkgResponse.body.id
|
||||
? `>${depPath}>`
|
||||
: createNodeId(options.parentPkg.nodeId, depPath)
|
||||
|
||||
const parentIsInstallable = options.parentPkg.installable === undefined || options.parentPkg.installable
|
||||
|
||||
Reference in New Issue
Block a user