mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-26 11:02:01 -04:00
fix: make use of function instead of getter
This commit is contained in:
committed by
Zoltan Kochan
parent
170334a764
commit
2b6981556f
@@ -64,7 +64,7 @@ export type InstalledPackages = {
|
||||
|
||||
export type TreeNode = {
|
||||
nodeId: string,
|
||||
children: {[alias: string]: string}, // child nodeId by child alias name
|
||||
children: () => {[alias: string]: string}, // child nodeId by child alias name
|
||||
pkg: InstalledPackage,
|
||||
depth: number,
|
||||
installable: boolean,
|
||||
@@ -440,10 +440,8 @@ async function installInContext (
|
||||
installCtx.tree[nodeToBuild.nodeId] = {
|
||||
nodeId: nodeToBuild.nodeId,
|
||||
pkg: nodeToBuild.pkg,
|
||||
get children() {
|
||||
return buildTree(installCtx, nodeToBuild.nodeId, nodeToBuild.pkg.id,
|
||||
installCtx.childrenByParentId[nodeToBuild.pkg.id], nodeToBuild.depth + 1, nodeToBuild.installable)
|
||||
},
|
||||
children: () => buildTree(installCtx, nodeToBuild.nodeId, nodeToBuild.pkg.id,
|
||||
installCtx.childrenByParentId[nodeToBuild.pkg.id], nodeToBuild.depth + 1, nodeToBuild.installable),
|
||||
depth: nodeToBuild.depth,
|
||||
installable: nodeToBuild.installable,
|
||||
}
|
||||
@@ -658,9 +656,7 @@ function buildTree (
|
||||
ctx.tree[childNodeId] = {
|
||||
nodeId: childNodeId,
|
||||
pkg: ctx.installs[child.pkgId],
|
||||
get children() {
|
||||
return buildTree(ctx, childNodeId, child.pkgId, ctx.childrenByParentId[child.pkgId], depth + 1, installable);
|
||||
},
|
||||
children: () => buildTree(ctx, childNodeId, child.pkgId, ctx.childrenByParentId[child.pkgId], depth + 1, installable),
|
||||
depth,
|
||||
installable,
|
||||
}
|
||||
|
||||
@@ -426,7 +426,7 @@ async function install (
|
||||
ctx.tree[nodeId] = {
|
||||
nodeId,
|
||||
pkg: ctx.installs[fetchedPkg.id],
|
||||
children: children.reduce((children, child) => {
|
||||
children: () => children.reduce((children, child) => {
|
||||
children[child.alias] = child.nodeId
|
||||
return children
|
||||
}, {}),
|
||||
|
||||
@@ -125,14 +125,15 @@ function resolvePeersOfNode (
|
||||
return {}
|
||||
}
|
||||
|
||||
const parentPkgs = R.isEmpty(node.children)
|
||||
const children = node.children();
|
||||
const parentPkgs = R.isEmpty(children)
|
||||
? parentParentPkgs
|
||||
: Object.assign(
|
||||
{},
|
||||
parentParentPkgs,
|
||||
toPkgByName(R.keys(node.children).map(alias => ({alias: alias, node: ctx.tree[node.children[alias]]})))
|
||||
toPkgByName(R.keys(children).map(alias => ({alias: alias, node: ctx.tree[children[alias]]})))
|
||||
)
|
||||
const unknownResolvedPeersOfChildren = resolvePeersOfChildren(node.children, parentPkgs, ctx, nodeId)
|
||||
const unknownResolvedPeersOfChildren = resolvePeersOfChildren(children, parentPkgs, ctx, nodeId)
|
||||
|
||||
const resolvedPeers = R.isEmpty(node.pkg.peerDependencies)
|
||||
? {}
|
||||
@@ -177,7 +178,7 @@ function resolvePeersOfNode (
|
||||
hardlinkedLocation,
|
||||
independent,
|
||||
optionalDependencies: node.pkg.optionalDependencies,
|
||||
children: Object.assign(node.children, resolvedPeers),
|
||||
children: Object.assign(children, resolvedPeers),
|
||||
depth: node.depth,
|
||||
absolutePath,
|
||||
prod: node.pkg.prod,
|
||||
|
||||
Reference in New Issue
Block a user