@npmcli/arborist 4.0.3 → 4.0.4
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 +7 -3
- package/lib/place-dep.js +4 -3
- package/package.json +1 -1
package/lib/arborist/reify.js
CHANGED
|
@@ -1173,6 +1173,10 @@ module.exports = cls => class Reifier extends cls {
|
|
|
1173
1173
|
}
|
|
1174
1174
|
|
|
1175
1175
|
let newSpec
|
|
1176
|
+
// True if the dependency is getting installed from a local file path
|
|
1177
|
+
// In this case it is not possible to do the normal version comparisons
|
|
1178
|
+
// as the new version will be a file path
|
|
1179
|
+
const isLocalDep = req.type === 'directory' || req.type === 'file'
|
|
1176
1180
|
if (req.registry) {
|
|
1177
1181
|
const version = child.version
|
|
1178
1182
|
const prefixRange = version ? this[_savePrefix] + version : '*'
|
|
@@ -1204,7 +1208,7 @@ module.exports = cls => class Reifier extends cls {
|
|
|
1204
1208
|
} else {
|
|
1205
1209
|
newSpec = h.shortcut(opt)
|
|
1206
1210
|
}
|
|
1207
|
-
} else if (
|
|
1211
|
+
} else if (isLocalDep) {
|
|
1208
1212
|
// save the relative path in package.json
|
|
1209
1213
|
// Normally saveSpec is updated with the proper relative
|
|
1210
1214
|
// path already, but it's possible to specify a full absolute
|
|
@@ -1233,11 +1237,11 @@ module.exports = cls => class Reifier extends cls {
|
|
|
1233
1237
|
if (hasSubKey(pkg, 'devDependencies', name)) {
|
|
1234
1238
|
pkg.devDependencies[name] = newSpec
|
|
1235
1239
|
// don't update peer or optional if we don't have to
|
|
1236
|
-
if (hasSubKey(pkg, 'peerDependencies', name) && !intersects(newSpec, pkg.peerDependencies[name])) {
|
|
1240
|
+
if (hasSubKey(pkg, 'peerDependencies', name) && (isLocalDep || !intersects(newSpec, pkg.peerDependencies[name]))) {
|
|
1237
1241
|
pkg.peerDependencies[name] = newSpec
|
|
1238
1242
|
}
|
|
1239
1243
|
|
|
1240
|
-
if (hasSubKey(pkg, 'optionalDependencies', name) && !intersects(newSpec, pkg.optionalDependencies[name])) {
|
|
1244
|
+
if (hasSubKey(pkg, 'optionalDependencies', name) && (isLocalDep || !intersects(newSpec, pkg.optionalDependencies[name]))) {
|
|
1241
1245
|
pkg.optionalDependencies[name] = newSpec
|
|
1242
1246
|
}
|
|
1243
1247
|
} else {
|
package/lib/place-dep.js
CHANGED
|
@@ -407,11 +407,12 @@ class PlaceDep {
|
|
|
407
407
|
for (const entryEdge of peerEntrySets(edge.from).keys()) {
|
|
408
408
|
// either this one needs to be pruned and re-evaluated, or marked
|
|
409
409
|
// as peerConflicted and warned about. If the entryEdge comes in from
|
|
410
|
-
// the root, then we have to leave it alone, and in that
|
|
411
|
-
// will have already warned or crashed by getting to this point
|
|
410
|
+
// the root or a workspace, then we have to leave it alone, and in that
|
|
411
|
+
// case, it will have already warned or crashed by getting to this point
|
|
412
412
|
const entryNode = entryEdge.to
|
|
413
413
|
const deepestTarget = deepestNestingTarget(entryNode)
|
|
414
|
-
if (deepestTarget !== target &&
|
|
414
|
+
if (deepestTarget !== target &&
|
|
415
|
+
!(entryEdge.from.isProjectRoot || entryEdge.from.isWorkspace)) {
|
|
415
416
|
prunePeerSets.push(...gatherDepSet([entryNode], e => {
|
|
416
417
|
return e.to !== entryNode && !e.peerConflicted
|
|
417
418
|
}))
|