@npmcli/arborist 9.1.0 → 9.1.2

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 debug = require('../debug.js')
9
9
  const { walkUp } = require('walk-up-path')
10
10
  const { log, time } = require('proc-log')
11
11
  const rpj = require('read-package-json-fast')
12
+ const hgi = require('hosted-git-info')
12
13
 
13
14
  const { dirname, resolve, relative, join } = require('node:path')
14
15
  const { depth: dfwalk } = require('treeverse')
@@ -871,13 +872,9 @@ module.exports = cls => class Reifier extends cls {
871
872
  return relative(dir, resolve(rootDir, overridePath))
872
873
  }
873
874
 
874
- // Fallback: derive the package name from node.resolved in a platform-agnostic way
875
+ // Fallback: derive the file path from node.resolved in a platform-agnostic way
875
876
  const filePath = node.resolved.replace(/^file:/, '')
876
- // A node.package.name could be different than the folder name
877
- const pathParts = filePath.split(/[\\/]/)
878
- const packageName = pathParts[pathParts.length - 1]
879
-
880
- return join('..', packageName)
877
+ return join(filePath)
881
878
  }
882
879
 
883
880
  #registryResolved (resolved) {
@@ -890,7 +887,7 @@ module.exports = cls => class Reifier extends cls {
890
887
  // Shrinkwrap and Node classes carefully, so for now, just treat
891
888
  // the default reg as the magical animal that it has been.
892
889
  try {
893
- const resolvedURL = new URL(resolved)
890
+ const resolvedURL = hgi.parseUrl(resolved)
894
891
 
895
892
  if ((this.options.replaceRegistryHost === resolvedURL.hostname) ||
896
893
  this.options.replaceRegistryHost === 'always') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@npmcli/arborist",
3
- "version": "9.1.0",
3
+ "version": "9.1.2",
4
4
  "description": "Manage node_modules trees",
5
5
  "dependencies": {
6
6
  "@isaacs/string-locale-compare": "^1.1.0",