mirror of
https://github.com/pnpm/pnpm.git
synced 2026-04-28 02:53:15 -04:00
fix: an edge case with peer resolutions and circular deps (#4588)
This commit is contained in:
6
.changeset/angry-eggs-rhyme.md
Normal file
6
.changeset/angry-eggs-rhyme.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@pnpm/resolve-dependencies": patch
|
||||
"pnpm": patch
|
||||
---
|
||||
|
||||
Fix an error with peer resolutions, which was happening when there was a circular dependency and another dependency that had the name of the circular dependency as a substring.
|
||||
@@ -334,17 +334,17 @@ function getPreviouslyResolvedChildren<T extends PartialResolvedPackage> (nodeId
|
||||
|
||||
if (!ownId || !parentIds.includes(ownId)) return allChildren
|
||||
|
||||
const nodeIdChunks = parentIds.join('>').split(ownId)
|
||||
const nodeIdChunks = parentIds.join('>').split(`>${ownId}>`)
|
||||
nodeIdChunks.pop()
|
||||
nodeIdChunks.reduce((accNodeId, part) => {
|
||||
accNodeId += `${part}${ownId}`
|
||||
accNodeId += `>${part}>${ownId}`
|
||||
const parentNode = dependenciesTree[`${accNodeId}>`]
|
||||
Object.assign(
|
||||
allChildren,
|
||||
typeof parentNode.children === 'function' ? parentNode.children() : parentNode.children
|
||||
)
|
||||
return accNodeId
|
||||
}, '>')
|
||||
}, '')
|
||||
return allChildren
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user