Skip to content

Commit cd678bf

Browse files
committed
Update npm fixes based on npm/cli#7025
1 parent da3e497 commit cd678bf

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/shadow/arborist.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ type NodeClass = Omit<
109109
new (...args: any): NodeClass
110110
addEdgeIn(edge: SafeEdge): void
111111
addEdgeOut(edge: SafeEdge): void
112+
canDedupe(preferDedupe: boolean): boolean
112113
canReplace(node: NodeClass, ignorePeers?: string[]): boolean
113114
canReplaceWith(node: NodeClass, ignorePeers?: string[]): boolean
114115
deleteEdgeIn(edge: SafeEdge): void
@@ -329,6 +330,15 @@ async function* batchScan(
329330
}
330331
}
331332

333+
// Patch adding doOverrideSetsConflict is based on
334+
// https://github.com/npm/cli/pull/7025.
335+
function doOverrideSetsConflict(
336+
first: OverrideSetClass | undefined,
337+
second: OverrideSetClass | undefined
338+
) {
339+
return findSpecificOverrideSet(first, second) === undefined
340+
}
341+
332342
function findSocketYmlSync() {
333343
let prevDir = null
334344
let dir = process.cwd()
@@ -654,7 +664,7 @@ class SafeEdge extends Edge {
654664
else if (
655665
this.overrides &&
656666
this.#safeTo.edgesOut.size &&
657-
!findSpecificOverrideSet(this.overrides, this.#safeTo.overrides)
667+
doOverrideSetsConflict(this.overrides, this.#safeTo.overrides)
658668
) {
659669
// Any inconsistency between the edge's override set and the target's
660670
// override set is potentially problematic. But we only say the edge is
@@ -873,7 +883,7 @@ class SafeNode extends Node {
873883
// Return true if it's safe to remove this node, because anything that is
874884
// depending on it would be fine with the thing that they would resolve to if
875885
// it was removed, or nothing is depending on it in the first place.
876-
canDedupe(preferDedupe = false) {
886+
override canDedupe(preferDedupe = false) {
877887
// Not allowed to mess with shrinkwraps or bundles.
878888
if (this.inDepBundle || this.inShrinkwrap) {
879889
return false
@@ -1107,7 +1117,7 @@ class SafeNode extends Node {
11071117
}
11081118
// This is an error condition. We can only get here if the new override set
11091119
// is in conflict with the existing.
1110-
log!.silly(`Conflicting override requirements for node ${this.name}`, this)
1120+
log!.silly('Conflicting override sets', this.name)
11111121
return false
11121122
}
11131123

0 commit comments

Comments
 (0)