@npmcli/arborist 7.0.0 → 7.2.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)
@@ -695,7 +695,11 @@ const depTypes = {
695
695
  // the compare nodes array
696
696
  const hasParent = (node, compareNodes) => {
697
697
  // All it takes is one so we loop and return on the first hit
698
- for (const compareNode of compareNodes) {
698
+ for (let compareNode of compareNodes) {
699
+ if (compareNode.isLink) {
700
+ compareNode = compareNode.target
701
+ }
702
+
699
703
  // follows logical parent for link anscestors
700
704
  if (node.isTop && (node.resolveParent === compareNode)) {
701
705
  return true
@@ -719,7 +723,10 @@ const hasAscendant = (node, compareNodes, seen = new Set()) => {
719
723
  }
720
724
 
721
725
  if (node.isTop && node.resolveParent) {
722
- return hasAscendant(node.resolveParent, compareNodes)
726
+ /* istanbul ignore if - investigate if linksIn check obviates need for this */
727
+ if (hasAscendant(node.resolveParent, compareNodes)) {
728
+ return true
729
+ }
723
730
  }
724
731
  for (const edge of node.edgesIn) {
725
732
  // TODO Need a test with an infinite loop
@@ -731,6 +738,11 @@ const hasAscendant = (node, compareNodes, seen = new Set()) => {
731
738
  return true
732
739
  }
733
740
  }
741
+ for (const linkNode of node.linksIn) {
742
+ if (hasAscendant(linkNode, compareNodes, seen)) {
743
+ return true
744
+ }
745
+ }
734
746
  return false
735
747
  }
736
748
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@npmcli/arborist",
3
- "version": "7.0.0",
3
+ "version": "7.2.0",
4
4
  "description": "Manage node_modules trees",
5
5
  "dependencies": {
6
6
  "@isaacs/string-locale-compare": "^1.1.0",
@@ -11,18 +11,18 @@
11
11
  "@npmcli/name-from-folder": "^2.0.0",
12
12
  "@npmcli/node-gyp": "^3.0.0",
13
13
  "@npmcli/package-json": "^5.0.0",
14
- "@npmcli/query": "^3.0.0",
14
+ "@npmcli/query": "^3.0.1",
15
15
  "@npmcli/run-script": "^7.0.1",
16
16
  "bin-links": "^4.0.1",
17
17
  "cacache": "^18.0.0",
18
18
  "common-ancestor-path": "^1.0.1",
19
- "hosted-git-info": "^7.0.0",
19
+ "hosted-git-info": "^7.0.1",
20
20
  "json-parse-even-better-errors": "^3.0.0",
21
21
  "json-stringify-nice": "^1.1.4",
22
22
  "minimatch": "^9.0.0",
23
23
  "nopt": "^7.0.0",
24
24
  "npm-install-checks": "^6.2.0",
25
- "npm-package-arg": "^11.0.0",
25
+ "npm-package-arg": "^11.0.1",
26
26
  "npm-pick-manifest": "^9.0.0",
27
27
  "npm-registry-fetch": "^16.0.0",
28
28
  "npmlog": "^7.0.1",
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "devDependencies": {
41
41
  "@npmcli/eslint-config": "^4.0.0",
42
- "@npmcli/template-oss": "4.18.0",
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.3",
@@ -90,13 +90,7 @@
90
90
  },
91
91
  "templateOSS": {
92
92
  "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
93
- "version": "4.18.0",
94
- "content": "../../scripts/template-oss/index.js",
95
- "ciVersions": [
96
- "16.14.0",
97
- "16.x",
98
- "18.0.0",
99
- "18.x"
100
- ]
93
+ "version": "4.19.0",
94
+ "content": "../../scripts/template-oss/index.js"
101
95
  }
102
96
  }