@npmcli/arborist 6.2.9 → 6.3.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.
Files changed (2) hide show
  1. package/lib/arborist/reify.js +24 -13
  2. package/package.json +3 -10
@@ -483,17 +483,29 @@ module.exports = cls => class Reifier extends cls {
483
483
 
484
484
  process.emit('time', 'reify:trashOmits')
485
485
 
486
- const filter = node =>
487
- node.top.isProjectRoot &&
488
- (
489
- node.peer && this[_omitPeer] ||
490
- node.dev && this[_omitDev] ||
491
- node.optional && this[_omitOptional] ||
492
- node.devOptional && this[_omitOptional] && this[_omitDev]
493
- )
494
-
495
- for (const node of this.idealTree.inventory.filter(filter)) {
496
- this[_addNodeToTrashList](node)
486
+ for (const node of this.idealTree.inventory.values()) {
487
+ const { top } = node
488
+
489
+ // if the top is not the root or workspace then we do not want to omit it
490
+ if (!top.isProjectRoot && !top.isWorkspace) {
491
+ continue
492
+ }
493
+
494
+ // if a diff filter has been created, then we do not omit the node if the
495
+ // top node is not in that set
496
+ if (this.diff?.filterSet?.size && !this.diff.filterSet.has(top)) {
497
+ continue
498
+ }
499
+
500
+ // omit node if the dep type matches any omit flags that were set
501
+ if (
502
+ node.peer && this[_omitPeer] ||
503
+ node.dev && this[_omitDev] ||
504
+ node.optional && this[_omitOptional] ||
505
+ node.devOptional && this[_omitOptional] && this[_omitDev]
506
+ ) {
507
+ this[_addNodeToTrashList](node)
508
+ }
497
509
  }
498
510
 
499
511
  process.emit('timeEnd', 'reify:trashOmits')
@@ -1411,8 +1423,7 @@ module.exports = cls => class Reifier extends cls {
1411
1423
  for (const tree of updatedTrees) {
1412
1424
  // refresh the edges so they have the correct specs
1413
1425
  tree.package = tree.package
1414
- const pkgJson = await PackageJson.load(tree.path)
1415
- .catch(() => new PackageJson(tree.path))
1426
+ const pkgJson = await PackageJson.load(tree.path, { create: true })
1416
1427
  const {
1417
1428
  dependencies = {},
1418
1429
  devDependencies = {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@npmcli/arborist",
3
- "version": "6.2.9",
3
+ "version": "6.3.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",
@@ -41,7 +41,6 @@
41
41
  "@npmcli/eslint-config": "^4.0.0",
42
42
  "@npmcli/template-oss": "4.14.1",
43
43
  "benchmark": "^2.1.4",
44
- "chalk": "^4.1.0",
45
44
  "minify-registry-metadata": "^3.0.0",
46
45
  "nock": "^13.3.0",
47
46
  "tap": "^16.3.4",
@@ -75,18 +74,12 @@
75
74
  "bin": {
76
75
  "arborist": "bin/index.js"
77
76
  },
78
- "//": "sk test-env locale to catch locale-specific sorting",
79
77
  "tap": {
80
- "color": true,
81
78
  "after": "test/fixtures/cleanup.js",
82
79
  "test-env": [
83
- "NODE_OPTIONS=--no-warnings",
84
80
  "LC_ALL=sk"
85
81
  ],
86
- "node-arg": [
87
- "--no-warnings",
88
- "--no-deprecation"
89
- ],
82
+ "color": 1,
90
83
  "timeout": "360",
91
84
  "nyc-arg": [
92
85
  "--exclude",