@npmcli/arborist 7.5.3 → 8.0.0

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.
@@ -195,7 +195,10 @@ module.exports = cls => class IdealTreeBuilder extends cls {
195
195
  for (const node of this.idealTree.inventory.values()) {
196
196
  if (!node.optional) {
197
197
  try {
198
- checkEngine(node.package, npmVersion, nodeVersion, this.options.force)
198
+ // if devEngines is present in the root node we ignore the engines check
199
+ if (!(node.isRoot && node.package.devEngines)) {
200
+ checkEngine(node.package, npmVersion, nodeVersion, this.options.force)
201
+ }
199
202
  } catch (err) {
200
203
  if (engineStrict) {
201
204
  throw err
@@ -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
- for (const edge of node.target.edgesOut.values()) {
107
- if (edge.to && edge.to[flag] &&
108
- (flag !== 'peer' && edge.type === 'peer' || edge.type === 'prod')
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
- if (pname && (node === node.root || pname !== node.name)) {
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
 
package/package.json CHANGED
@@ -1,49 +1,49 @@
1
1
  {
2
2
  "name": "@npmcli/arborist",
3
- "version": "7.5.3",
3
+ "version": "8.0.0",
4
4
  "description": "Manage node_modules trees",
5
5
  "dependencies": {
6
6
  "@isaacs/string-locale-compare": "^1.1.0",
7
- "@npmcli/fs": "^3.1.1",
8
- "@npmcli/installed-package-contents": "^2.1.0",
9
- "@npmcli/map-workspaces": "^3.0.2",
10
- "@npmcli/metavuln-calculator": "^7.1.1",
11
- "@npmcli/name-from-folder": "^2.0.0",
12
- "@npmcli/node-gyp": "^3.0.0",
13
- "@npmcli/package-json": "^5.1.0",
14
- "@npmcli/query": "^3.1.0",
15
- "@npmcli/redact": "^2.0.0",
16
- "@npmcli/run-script": "^8.1.0",
17
- "bin-links": "^4.0.4",
18
- "cacache": "^18.0.3",
7
+ "@npmcli/fs": "^4.0.0",
8
+ "@npmcli/installed-package-contents": "^3.0.0",
9
+ "@npmcli/map-workspaces": "^4.0.1",
10
+ "@npmcli/metavuln-calculator": "^8.0.0",
11
+ "@npmcli/name-from-folder": "^3.0.0",
12
+ "@npmcli/node-gyp": "^4.0.0",
13
+ "@npmcli/package-json": "^6.0.1",
14
+ "@npmcli/query": "^4.0.0",
15
+ "@npmcli/redact": "^3.0.0",
16
+ "@npmcli/run-script": "^9.0.1",
17
+ "bin-links": "^5.0.0",
18
+ "cacache": "^19.0.1",
19
19
  "common-ancestor-path": "^1.0.1",
20
- "hosted-git-info": "^7.0.2",
21
- "json-parse-even-better-errors": "^3.0.2",
20
+ "hosted-git-info": "^8.0.0",
21
+ "json-parse-even-better-errors": "^4.0.0",
22
22
  "json-stringify-nice": "^1.1.4",
23
23
  "lru-cache": "^10.2.2",
24
24
  "minimatch": "^9.0.4",
25
- "nopt": "^7.2.1",
26
- "npm-install-checks": "^6.2.0",
27
- "npm-package-arg": "^11.0.2",
28
- "npm-pick-manifest": "^9.0.1",
29
- "npm-registry-fetch": "^17.0.1",
30
- "pacote": "^18.0.6",
31
- "parse-conflict-json": "^3.0.0",
32
- "proc-log": "^4.2.0",
33
- "proggy": "^2.0.0",
25
+ "nopt": "^8.0.0",
26
+ "npm-install-checks": "^7.1.0",
27
+ "npm-package-arg": "^12.0.0",
28
+ "npm-pick-manifest": "^10.0.0",
29
+ "npm-registry-fetch": "^18.0.1",
30
+ "pacote": "^19.0.0",
31
+ "parse-conflict-json": "^4.0.0",
32
+ "proc-log": "^5.0.0",
33
+ "proggy": "^3.0.0",
34
34
  "promise-all-reject-late": "^1.0.0",
35
35
  "promise-call-limit": "^3.0.1",
36
- "read-package-json-fast": "^3.0.2",
36
+ "read-package-json-fast": "^4.0.0",
37
37
  "semver": "^7.3.7",
38
- "ssri": "^10.0.6",
38
+ "ssri": "^12.0.0",
39
39
  "treeverse": "^3.0.0",
40
40
  "walk-up-path": "^3.0.1"
41
41
  },
42
42
  "devDependencies": {
43
- "@npmcli/eslint-config": "^4.0.0",
44
- "@npmcli/template-oss": "4.22.0",
43
+ "@npmcli/eslint-config": "^5.0.1",
44
+ "@npmcli/template-oss": "4.23.3",
45
45
  "benchmark": "^2.1.4",
46
- "minify-registry-metadata": "^3.0.0",
46
+ "minify-registry-metadata": "^4.0.0",
47
47
  "nock": "^13.3.3",
48
48
  "tap": "^16.3.8",
49
49
  "tar-stream": "^3.0.0",
@@ -54,12 +54,13 @@
54
54
  "posttest": "npm run lint",
55
55
  "snap": "tap",
56
56
  "test-proxy": "ARBORIST_TEST_PROXY=1 tap --snapshot",
57
- "lint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"",
58
- "lintfix": "npm run lint -- --fix",
57
+ "lint": "npm run eslint",
58
+ "lintfix": "npm run eslint -- --fix",
59
59
  "benchmark": "node scripts/benchmark.js",
60
60
  "benchclean": "rm -rf scripts/benchmark/*/",
61
61
  "postlint": "template-oss-check",
62
- "template-oss-apply": "template-oss-apply --force"
62
+ "template-oss-apply": "template-oss-apply --force",
63
+ "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
63
64
  },
64
65
  "repository": {
65
66
  "type": "git",
@@ -88,11 +89,11 @@
88
89
  ]
89
90
  },
90
91
  "engines": {
91
- "node": "^16.14.0 || >=18.0.0"
92
+ "node": "^18.17.0 || >=20.5.0"
92
93
  },
93
94
  "templateOSS": {
94
95
  "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
95
- "version": "4.22.0",
96
+ "version": "4.23.3",
96
97
  "content": "../../scripts/template-oss/index.js"
97
98
  }
98
99
  }