@npmcli/arborist 6.2.10 → 6.4.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.
@@ -22,7 +22,15 @@ module.exports = cls => class Auditor extends cls {
22
22
  options = { ...this.options, ...options }
23
23
 
24
24
  process.emit('time', 'audit')
25
- const tree = await this.loadVirtual()
25
+ let tree
26
+ if (options.packageLock === false) {
27
+ // build ideal tree
28
+ await this.loadActual(options)
29
+ await this.buildIdealTree()
30
+ tree = this.idealTree
31
+ } else {
32
+ tree = await this.loadVirtual()
33
+ }
26
34
  if (this[_workspaces] && this[_workspaces].length) {
27
35
  options.filterSet = this.workspaceDependencySet(
28
36
  tree,
@@ -628,7 +628,7 @@ module.exports = cls => class Reifier extends cls {
628
628
  process.emit('time', timer)
629
629
  this.addTracker('reify', node.name, node.location)
630
630
 
631
- const { npmVersion, nodeVersion } = this.options
631
+ const { npmVersion, nodeVersion, cpu, os } = this.options
632
632
  const p = Promise.resolve().then(async () => {
633
633
  // when we reify an optional node, check the engine and platform
634
634
  // first. be sure to ignore the --force and --engine-strict flags,
@@ -638,7 +638,7 @@ module.exports = cls => class Reifier extends cls {
638
638
  // eslint-disable-next-line promise/always-return
639
639
  if (node.optional) {
640
640
  checkEngine(node.package, npmVersion, nodeVersion, false)
641
- checkPlatform(node.package, false)
641
+ checkPlatform(node.package, false, { cpu, os })
642
642
  }
643
643
  await this[_checkBins](node)
644
644
  await this[_extractOrLink](node)
@@ -1423,8 +1423,7 @@ module.exports = cls => class Reifier extends cls {
1423
1423
  for (const tree of updatedTrees) {
1424
1424
  // refresh the edges so they have the correct specs
1425
1425
  tree.package = tree.package
1426
- const pkgJson = await PackageJson.load(tree.path)
1427
- .catch(() => new PackageJson(tree.path))
1426
+ const pkgJson = await PackageJson.load(tree.path, { create: true })
1428
1427
  const {
1429
1428
  dependencies = {},
1430
1429
  devDependencies = {},
@@ -719,7 +719,10 @@ const hasAscendant = (node, compareNodes, seen = new Set()) => {
719
719
  }
720
720
 
721
721
  if (node.isTop && node.resolveParent) {
722
- return hasAscendant(node.resolveParent, compareNodes)
722
+ /* istanbul ignore if - investigate if linksIn check obviates need for this */
723
+ if (hasAscendant(node.resolveParent, compareNodes)) {
724
+ return true
725
+ }
723
726
  }
724
727
  for (const edge of node.edgesIn) {
725
728
  // TODO Need a test with an infinite loop
@@ -731,6 +734,11 @@ const hasAscendant = (node, compareNodes, seen = new Set()) => {
731
734
  return true
732
735
  }
733
736
  }
737
+ for (const linkNode of node.linksIn) {
738
+ if (hasAscendant(linkNode, compareNodes, seen)) {
739
+ return true
740
+ }
741
+ }
734
742
  return false
735
743
  }
736
744
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@npmcli/arborist",
3
- "version": "6.2.10",
3
+ "version": "6.4.0",
4
4
  "description": "Manage node_modules trees",
5
5
  "dependencies": {
6
6
  "@isaacs/string-locale-compare": "^1.1.0",
@@ -10,7 +10,7 @@
10
10
  "@npmcli/metavuln-calculator": "^5.0.0",
11
11
  "@npmcli/name-from-folder": "^2.0.0",
12
12
  "@npmcli/node-gyp": "^3.0.0",
13
- "@npmcli/package-json": "^3.0.0",
13
+ "@npmcli/package-json": "^4.0.0",
14
14
  "@npmcli/query": "^3.0.0",
15
15
  "@npmcli/run-script": "^6.0.0",
16
16
  "bin-links": "^4.0.1",
@@ -21,7 +21,7 @@
21
21
  "json-stringify-nice": "^1.1.4",
22
22
  "minimatch": "^9.0.0",
23
23
  "nopt": "^7.0.0",
24
- "npm-install-checks": "^6.0.0",
24
+ "npm-install-checks": "^6.2.0",
25
25
  "npm-package-arg": "^10.1.0",
26
26
  "npm-pick-manifest": "^8.0.1",
27
27
  "npm-registry-fetch": "^14.0.3",
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "devDependencies": {
41
41
  "@npmcli/eslint-config": "^4.0.0",
42
- "@npmcli/template-oss": "4.14.1",
42
+ "@npmcli/template-oss": "4.19.0",
43
43
  "benchmark": "^2.1.4",
44
44
  "minify-registry-metadata": "^3.0.0",
45
45
  "nock": "^13.3.0",
@@ -91,7 +91,7 @@
91
91
  },
92
92
  "templateOSS": {
93
93
  "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
94
- "version": "4.14.1",
94
+ "version": "4.19.0",
95
95
  "content": "../../scripts/template-oss/index.js"
96
96
  }
97
97
  }