@npmcli/arborist 5.6.2 → 5.6.3

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.
@@ -9,6 +9,7 @@ const semver = require('semver')
9
9
  const debug = require('../debug.js')
10
10
  const walkUp = require('walk-up-path')
11
11
  const log = require('proc-log')
12
+ const hgi = require('hosted-git-info')
12
13
 
13
14
  const { dirname, resolve, relative } = require('path')
14
15
  const { depth: dfwalk } = require('treeverse')
@@ -638,10 +639,15 @@ module.exports = cls => class Reifier extends cls {
638
639
  // and no 'bundled: true' setting.
639
640
  // Do the best with what we have, or else remove it from the tree
640
641
  // entirely, since we can't possibly reify it.
641
- const res = node.resolved ? `${node.name}@${this[_registryResolved](node.resolved)}`
642
- : node.packageName && node.version
643
- ? `${node.packageName}@${node.version}`
644
- : null
642
+ let res = null
643
+ if (node.resolved) {
644
+ const registryResolved = this[_registryResolved](node.resolved)
645
+ if (registryResolved) {
646
+ res = `${node.name}@${registryResolved}`
647
+ }
648
+ } else if (node.packageName && node.version) {
649
+ res = `${node.packageName}@${node.version}`
650
+ }
645
651
 
646
652
  // no idea what this thing is. remove it from the tree.
647
653
  if (!res) {
@@ -718,12 +724,20 @@ module.exports = cls => class Reifier extends cls {
718
724
  // ${REGISTRY} or something. This has to be threaded through the
719
725
  // Shrinkwrap and Node classes carefully, so for now, just treat
720
726
  // the default reg as the magical animal that it has been.
721
- const resolvedURL = new URL(resolved)
727
+ const resolvedURL = hgi.parseUrl(resolved)
728
+
729
+ if (!resolvedURL) {
730
+ // if we could not parse the url at all then returning nothing
731
+ // here means it will get removed from the tree in the next step
732
+ return
733
+ }
734
+
722
735
  if ((this.options.replaceRegistryHost === resolvedURL.hostname)
723
736
  || this.options.replaceRegistryHost === 'always') {
724
737
  // this.registry always has a trailing slash
725
- resolved = `${this.registry.slice(0, -1)}${resolvedURL.pathname}${resolvedURL.searchParams}`
738
+ return `${this.registry.slice(0, -1)}${resolvedURL.pathname}${resolvedURL.searchParams}`
726
739
  }
740
+
727
741
  return resolved
728
742
  }
729
743
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@npmcli/arborist",
3
- "version": "5.6.2",
3
+ "version": "5.6.3",
4
4
  "description": "Manage node_modules trees",
5
5
  "dependencies": {
6
6
  "@isaacs/string-locale-compare": "^1.1.0",
@@ -16,6 +16,7 @@
16
16
  "bin-links": "^3.0.3",
17
17
  "cacache": "^16.1.3",
18
18
  "common-ancestor-path": "^1.0.1",
19
+ "hosted-git-info": "^5.2.1",
19
20
  "json-parse-even-better-errors": "^2.3.1",
20
21
  "json-stringify-nice": "^1.1.4",
21
22
  "minimatch": "^5.1.0",
@@ -42,7 +43,7 @@
42
43
  },
43
44
  "devDependencies": {
44
45
  "@npmcli/eslint-config": "^3.1.0",
45
- "@npmcli/template-oss": "4.1.1",
46
+ "@npmcli/template-oss": "4.8.0",
46
47
  "benchmark": "^2.1.4",
47
48
  "chalk": "^4.1.0",
48
49
  "minify-registry-metadata": "^2.1.0",
@@ -52,13 +53,13 @@
52
53
  },
53
54
  "scripts": {
54
55
  "test": "tap",
55
- "posttest": "npm run lint",
56
+ "posttest": "node ../.. run lint",
56
57
  "snap": "tap",
57
58
  "postsnap": "npm run lintfix",
58
59
  "test-proxy": "ARBORIST_TEST_PROXY=1 tap --snapshot",
59
60
  "eslint": "eslint",
60
61
  "lint": "eslint \"**/*.js\"",
61
- "lintfix": "npm run lint -- --fix",
62
+ "lintfix": "node ../.. run lint -- --fix",
62
63
  "benchmark": "node scripts/benchmark.js",
63
64
  "benchclean": "rm -rf scripts/benchmark/*/",
64
65
  "npmclilint": "npmcli-lint",
@@ -93,13 +94,18 @@
93
94
  "--no-warnings",
94
95
  "--no-deprecation"
95
96
  ],
96
- "timeout": "360"
97
+ "timeout": "360",
98
+ "nyc-arg": [
99
+ "--exclude",
100
+ "tap-snapshots/**"
101
+ ]
97
102
  },
98
103
  "engines": {
99
104
  "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
100
105
  },
101
106
  "templateOSS": {
102
107
  "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
103
- "version": "4.1.1"
108
+ "version": "4.8.0",
109
+ "content": "../../scripts/template-oss/index.js"
104
110
  }
105
111
  }