@npmcli/arborist 7.5.3 → 7.5.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/calc-dep-flags.js +11 -4
- package/lib/shrinkwrap.js +3 -1
- package/package.json +1 -1
package/lib/calc-dep-flags.js
CHANGED
|
@@ -31,6 +31,10 @@ const calcDepFlagsStep = (node) => {
|
|
|
31
31
|
|
|
32
32
|
// for links, map their hierarchy appropriately
|
|
33
33
|
if (node.isLink) {
|
|
34
|
+
// node.target can be null, we check to ensure it's not null before proceeding
|
|
35
|
+
if (node.target == null) {
|
|
36
|
+
return node
|
|
37
|
+
}
|
|
34
38
|
node.target.dev = node.dev
|
|
35
39
|
node.target.optional = node.optional
|
|
36
40
|
node.target.devOptional = node.devOptional
|
|
@@ -97,15 +101,18 @@ const unsetFlag = (node, flag) => {
|
|
|
97
101
|
tree: node,
|
|
98
102
|
visit: node => {
|
|
99
103
|
node.extraneous = node[flag] = false
|
|
100
|
-
if (node.isLink) {
|
|
104
|
+
if (node.isLink && node.target) {
|
|
101
105
|
node.target.extraneous = node.target[flag] = false
|
|
102
106
|
}
|
|
103
107
|
},
|
|
104
108
|
getChildren: node => {
|
|
105
109
|
const children = []
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
110
|
+
const targetNode = node.isLink && node.target ? node.target : node
|
|
111
|
+
for (const edge of targetNode.edgesOut.values()) {
|
|
112
|
+
if (
|
|
113
|
+
edge.to &&
|
|
114
|
+
edge.to[flag] &&
|
|
115
|
+
((flag !== 'peer' && edge.type === 'peer') || edge.type === 'prod')
|
|
109
116
|
) {
|
|
110
117
|
children.push(edge.to)
|
|
111
118
|
}
|
package/lib/shrinkwrap.js
CHANGED
|
@@ -50,6 +50,7 @@ const versionFromTgz = require('./version-from-tgz.js')
|
|
|
50
50
|
const npa = require('npm-package-arg')
|
|
51
51
|
const pkgJson = require('@npmcli/package-json')
|
|
52
52
|
const parseJSON = require('parse-conflict-json')
|
|
53
|
+
const nameFromFolder = require('@npmcli/name-from-folder')
|
|
53
54
|
|
|
54
55
|
const stringify = require('json-stringify-nice')
|
|
55
56
|
const swKeyOrder = [
|
|
@@ -233,7 +234,8 @@ class Shrinkwrap {
|
|
|
233
234
|
// root to help prevent churn based on the name of the directory the
|
|
234
235
|
// project is in
|
|
235
236
|
const pname = node.packageName
|
|
236
|
-
|
|
237
|
+
// when Target package name and Target node share the same name, we include the name, target node should have name as per realpath.
|
|
238
|
+
if (pname && (node === node.root || pname !== node.name || nameFromFolder(node.realpath) !== pname)) {
|
|
237
239
|
meta.name = pname
|
|
238
240
|
}
|
|
239
241
|
|