@npmcli/arborist 9.4.1 → 9.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/arborist/reify.js +9 -3
- package/lib/override-set.js +23 -2
- package/package.json +1 -1
package/lib/arborist/reify.js
CHANGED
|
@@ -117,9 +117,11 @@ module.exports = cls => class Reifier extends cls {
|
|
|
117
117
|
// of Node/Link trees
|
|
118
118
|
log.warn('reify', 'The "linked" install strategy is EXPERIMENTAL and may contain bugs.')
|
|
119
119
|
this.idealTree = await this.createIsolatedTree()
|
|
120
|
-
this
|
|
121
|
-
this
|
|
122
|
-
|
|
120
|
+
if (this.actualTree) {
|
|
121
|
+
this.#linkedActualForDiff = this.#buildLinkedActualForDiff(
|
|
122
|
+
this.idealTree, this.actualTree
|
|
123
|
+
)
|
|
124
|
+
}
|
|
123
125
|
}
|
|
124
126
|
await this[_diffTrees]()
|
|
125
127
|
await this.#reifyPackages()
|
|
@@ -815,6 +817,10 @@ module.exports = cls => class Reifier extends cls {
|
|
|
815
817
|
if (combined.has(child.path) || !existsSync(child.path)) {
|
|
816
818
|
continue
|
|
817
819
|
}
|
|
820
|
+
// Skip store links whose ideal realpath doesn't exist on disk yet — the store hash changed and the symlink needs recreating via ADD.
|
|
821
|
+
if (child.isLink && child.resolved?.startsWith('file:.store/') && !existsSync(child.realpath)) {
|
|
822
|
+
continue
|
|
823
|
+
}
|
|
818
824
|
let entry
|
|
819
825
|
if (child.isLink) {
|
|
820
826
|
entry = new IsolatedLink(child)
|
package/lib/override-set.js
CHANGED
|
@@ -195,8 +195,29 @@ class OverrideSet {
|
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
-
// The override sets are incomparable.
|
|
199
|
-
|
|
198
|
+
// The override sets are incomparable (e.g. siblings like the "react" and "react-dom" children of the root override set). Check if they have semantically conflicting rules before treating this as an error.
|
|
199
|
+
if (this.haveConflictingRules(first, second)) {
|
|
200
|
+
log.silly('Conflicting override sets', first, second)
|
|
201
|
+
return undefined
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// The override sets are structurally incomparable but have compatible rules. Fall back to their nearest common ancestor so the node still has a valid override set.
|
|
205
|
+
return this.findCommonAncestor(first, second)
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
static findCommonAncestor (first, second) {
|
|
209
|
+
const firstAncestors = []
|
|
210
|
+
for (const ancestor of first.ancestry()) {
|
|
211
|
+
firstAncestors.push(ancestor)
|
|
212
|
+
}
|
|
213
|
+
for (const secondAnc of second.ancestry()) {
|
|
214
|
+
for (const firstAnc of firstAncestors) {
|
|
215
|
+
if (firstAnc.isEqual(secondAnc)) {
|
|
216
|
+
return firstAnc
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
return null
|
|
200
221
|
}
|
|
201
222
|
|
|
202
223
|
static doOverrideSetsConflict (first, second) {
|