Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions workspaces/arborist/lib/arborist/build-ideal-tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -1200,23 +1200,21 @@ This is a one-time fix-up, please be patient...
return false
}

// If the edge has no destination, that's a problem
if (!edge.to) {
return true
}

// If it's already been logged as a load failure, skip it.
if (edge.to && this[_loadFailures].has(edge.to)) {
if (this[_loadFailures].has(edge.to)) {
return false
}

// If it's shrinkwrapped, we use what the shrinkwap wants.
if (edge.to && edge.to.inShrinkwrap) {
if (edge.to.inShrinkwrap) {
return false
}

// If the edge has no destination, that's a problem, unless
// if it's peerOptional and not explicitly requested.
if (!edge.to) {
return edge.type !== 'peerOptional' ||
this[_explicitRequests].has(edge)
}

// If the edge has an error, there's a problem.
if (!edge.valid) {
return true
Expand Down
22 changes: 21 additions & 1 deletion workspaces/arborist/lib/place-dep.js
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,27 @@ class PlaceDep {
}

get conflictOk () {
return this.force || (!this.isMine && !this.strictPeerDeps)
if (this.force) {
return true
}

if (!this.isMine && !this.strictPeerDeps) {
return true
}

if (this.top.edge.type === 'peerOptional') {
return true
}

let fromIsOptional = !!this.top.edge.from.edgesIn.size
for (const edgeIn of this.top.edge.from.edgesIn.values()) {
if (edgeIn.type !== 'peerOptional') {
fromIsOptional = false
break
}
}

return fromIsOptional
}

get isMine () {
Expand Down
40,747 changes: 38,406 additions & 2,341 deletions workspaces/arborist/tap-snapshots/test/arborist/build-ideal-tree.js.test.cjs

Large diffs are not rendered by default.

Loading