@npmcli/arborist 5.3.0 → 5.3.1

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.
@@ -484,7 +484,7 @@ Try using the package name instead, e.g:
484
484
  .catch(/* istanbul ignore next */ er => null)
485
485
  if (st && st.isSymbolicLink()) {
486
486
  const target = await readlink(dir)
487
- const real = resolve(dirname(dir), target)
487
+ const real = resolve(dirname(dir), target).replace(/#/g, '%23')
488
488
  tree.package.dependencies[name] = `file:${real}`
489
489
  } else {
490
490
  tree.package.dependencies[name] = '*'
@@ -603,7 +603,7 @@ Try using the package name instead, e.g:
603
603
  if (filepath) {
604
604
  const { name } = spec
605
605
  const tree = this.idealTree.target
606
- spec = npa(`file:${relpath(tree.path, filepath)}`, tree.path)
606
+ spec = npa(`file:${relpath(tree.path, filepath).replace(/#/g, '%23')}`, tree.path)
607
607
  spec.name = name
608
608
  }
609
609
  return spec
@@ -196,7 +196,7 @@ module.exports = cls => class ActualLoader extends cls {
196
196
  const actualRoot = tree.isLink ? tree.target : tree
197
197
  const { dependencies = {} } = actualRoot.package
198
198
  for (const [name, kid] of actualRoot.children.entries()) {
199
- const def = kid.isLink ? `file:${kid.realpath}` : '*'
199
+ const def = kid.isLink ? `file:${kid.realpath.replace(/#/g, '%23')}` : '*'
200
200
  dependencies[name] = dependencies[name] || def
201
201
  }
202
202
  actualRoot.package = { ...actualRoot.package, dependencies }
@@ -162,7 +162,7 @@ module.exports = cls => class VirtualLoader extends cls {
162
162
  lockfile: s.data,
163
163
  })
164
164
  for (const [name, path] of workspaces.entries()) {
165
- lockWS.push(['workspace', name, `file:${path}`])
165
+ lockWS.push(['workspace', name, `file:${path.replace(/#/g, '%23')}`])
166
166
  }
167
167
 
168
168
  const lockEdges = [
@@ -1241,7 +1241,7 @@ module.exports = cls => class Reifier extends cls {
1241
1241
  // path initially, in which case we can end up with the wrong
1242
1242
  // thing, so just get the ultimate fetchSpec and relativize it.
1243
1243
  const p = req.fetchSpec.replace(/^file:/, '')
1244
- const rel = relpath(addTree.realpath, p)
1244
+ const rel = relpath(addTree.realpath, p).replace(/#/g, '%23')
1245
1245
  newSpec = `file:${rel}`
1246
1246
  }
1247
1247
  } else {
@@ -20,8 +20,8 @@ const consistentResolve = (resolved, fromPath, toPath, relPaths = false) => {
20
20
  raw,
21
21
  } = npa(resolved, fromPath)
22
22
  const isPath = type === 'file' || type === 'directory'
23
- return isPath && !relPaths ? `file:${fetchSpec}`
24
- : isPath ? 'file:' + (toPath ? relpath(toPath, fetchSpec) : fetchSpec)
23
+ return isPath && !relPaths ? `file:${fetchSpec.replace(/#/g, '%23')}`
24
+ : isPath ? 'file:' + (toPath ? relpath(toPath, fetchSpec.replace(/#/g, '%23')) : fetchSpec.replace(/#/g, '%23'))
25
25
  : hosted ? `git+${
26
26
  hosted.auth ? hosted.https(hostedOpt) : hosted.sshurl(hostedOpt)
27
27
  }`
package/lib/link.js CHANGED
@@ -118,7 +118,7 @@ class Link extends Node {
118
118
  // the path/realpath guard is there for the benefit of setting
119
119
  // these things in the "wrong" order
120
120
  return this.path && this.realpath
121
- ? `file:${relpath(dirname(this.path), this.realpath)}`
121
+ ? `file:${relpath(dirname(this.path), this.realpath).replace(/#/g, '%23')}`
122
122
  : null
123
123
  }
124
124
 
package/lib/node.js CHANGED
@@ -824,7 +824,7 @@ class Node {
824
824
  }
825
825
 
826
826
  for (const [name, path] of this[_workspaces].entries()) {
827
- new Edge({ from: this, name, spec: `file:${path}`, type: 'workspace' })
827
+ new Edge({ from: this, name, spec: `file:${path.replace(/#/g, '%23')}`, type: 'workspace' })
828
828
  }
829
829
  }
830
830
 
package/lib/shrinkwrap.js CHANGED
@@ -815,7 +815,7 @@ class Shrinkwrap {
815
815
  const pathFixed = !resolved ? null
816
816
  : !/^file:/.test(resolved) ? resolved
817
817
  // resolve onto the metadata path
818
- : `file:${resolve(this.path, resolved.slice(5))}`
818
+ : `file:${resolve(this.path, resolved.slice(5)).replace(/#/g, '%23')}`
819
819
 
820
820
  // if we have one, only set the other if it matches
821
821
  // otherwise it could be for a completely different thing.
@@ -996,7 +996,7 @@ class Shrinkwrap {
996
996
  : npa.resolve(node.name, edge.spec, edge.from.realpath)
997
997
 
998
998
  if (node.isLink) {
999
- lock.version = `file:${relpath(this.path, node.realpath)}`
999
+ lock.version = `file:${relpath(this.path, node.realpath).replace(/#/g, '%23')}`
1000
1000
  } else if (spec && (spec.type === 'file' || spec.type === 'remote')) {
1001
1001
  lock.version = spec.saveSpec
1002
1002
  } else if (spec && spec.type === 'git' || rSpec.type === 'git') {
@@ -1074,7 +1074,7 @@ class Shrinkwrap {
1074
1074
  // this especially shows up with workspace edges when the root
1075
1075
  // node is also a workspace in the set.
1076
1076
  const p = resolve(node.realpath, spec.slice('file:'.length))
1077
- set[k] = `file:${relpath(node.realpath, p)}`
1077
+ set[k] = `file:${relpath(node.realpath, p).replace(/#/g, '%23')}`
1078
1078
  } else {
1079
1079
  set[k] = spec
1080
1080
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@npmcli/arborist",
3
- "version": "5.3.0",
3
+ "version": "5.3.1",
4
4
  "description": "Manage node_modules trees",
5
5
  "dependencies": {
6
6
  "@isaacs/string-locale-compare": "^1.1.0",