mirror of
https://github.com/pnpm/pnpm.git
synced 2026-04-28 02:53:15 -04:00
perf: don't duplicate leaf nodes in dependenciesTree (#8751)
This commit is contained in:
5
.changeset/hot-numbers-live.md
Normal file
5
.changeset/hot-numbers-live.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/resolve-dependencies": patch
|
||||
---
|
||||
|
||||
Don't duplicate leaf nodes in dependenciesTree.
|
||||
@@ -219,6 +219,7 @@ export type PeerDependencies = Record<string, PeerDependency>
|
||||
|
||||
export interface ResolvedPackage {
|
||||
id: PkgResolutionId
|
||||
isLeaf: boolean
|
||||
resolution: Resolution
|
||||
prod: boolean
|
||||
dev: boolean
|
||||
@@ -1609,6 +1610,7 @@ function getResolvedPackage (
|
||||
os: options.pkg.os,
|
||||
libc: options.pkg.libc,
|
||||
},
|
||||
isLeaf: pkgIsLeaf(options.pkg),
|
||||
pkgIdWithPatchHash: options.pkgIdWithPatchHash,
|
||||
dev: options.wantedDependency.dev,
|
||||
fetching: options.pkgResponse.fetching!,
|
||||
|
||||
@@ -305,6 +305,10 @@ function buildTree (
|
||||
if (parentIdsContainSequence(parentIds, parentId, child.id) || parentId === child.id) {
|
||||
continue
|
||||
}
|
||||
if (ctx.resolvedPkgsById[child.id].isLeaf) {
|
||||
childrenNodeIds[child.alias] = child.id as unknown as NodeId
|
||||
continue
|
||||
}
|
||||
const childNodeId = nextNodeId()
|
||||
childrenNodeIds[child.alias] = childNodeId
|
||||
installable = installable || !ctx.skipped.has(child.id)
|
||||
|
||||
Reference in New Issue
Block a user