@npmcli/arborist 9.1.10 → 9.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.
@@ -504,27 +504,25 @@ module.exports = cls => class IdealTreeBuilder extends cls {
504
504
  this.#depsQueue.push(tree)
505
505
  }
506
506
 
507
- // This returns a promise because we might not have the name yet, and need to
508
- // call pacote.manifest to find the name.
507
+ // This returns a promise because we might not have the name yet, and need to call pacote.manifest to find the name.
509
508
  async #add (tree, { add, saveType = null, saveBundle = false }) {
510
509
  // If we have a link it will need to be added relative to the target's path
511
510
  const path = tree.target.path
512
511
 
513
- // get the name for each of the specs in the list.
514
- // ie, doing `foo@bar` we just return foo but if it's a url or git, we
515
- // don't know the name until we fetch it and look in its manifest.
512
+ // Get the name for each of the specs in the list.
513
+ // e.g. doing `foo@bar` we just return foo but if it's a url or git, we don't know the name until we fetch it and look in its manifest.
516
514
  await Promise.all(add.map(async rawSpec => {
517
- // We do NOT provide the path to npa here, because user-additions need to
518
- // be resolved relative to the tree being added to.
515
+ // We do NOT provide the path to npa here, because user-additions need to be resolved relative to the tree being added to.
519
516
  let spec = npa(rawSpec)
520
517
 
521
- // if it's just @'' then we reload whatever's there, or get latest
522
- // if it's an explicit tag, we need to install that specific tag version
518
+ // if it's just @'' then we reload whatever's there, or get latest.
519
+ // if it's an explicit tag, we need to install that specific tag version.
523
520
  const isTag = spec.rawSpec && spec.type === 'tag'
524
521
 
525
522
  // look up the names of file/directory/git specs
526
523
  if (!spec.name || isTag) {
527
- const mani = await pacote.manifest(spec, { ...this.options })
524
+ const _isRoot = tree.isProjectRoot || tree.isWorkspace
525
+ const mani = await pacote.manifest(spec, { ...this.options, _isRoot })
528
526
  if (isTag) {
529
527
  // translate tag to a version
530
528
  spec = npa(`${mani.name}@${mani.version}`)
package/lib/dep-valid.js CHANGED
@@ -82,7 +82,7 @@ const depValid = (child, requested, requestor) => {
82
82
  const resRepo = npa(child.resolved || '')
83
83
  const resHost = resRepo.hosted
84
84
  const reqHost = requested.hosted
85
- const reqCommit = /^[a-fA-F0-9]{40}$/.test(requested.gitCommittish || '')
85
+ const reqCommit = /^[a-fA-F0-9]{40,64}$/.test(requested.gitCommittish || '')
86
86
  const nc = { noCommittish: !reqCommit }
87
87
  if (!resHost) {
88
88
  if (resRepo.fetchSpec !== requested.fetchSpec) {
package/lib/node.js CHANGED
@@ -584,9 +584,7 @@ class Node {
584
584
  }
585
585
 
586
586
  get isProjectRoot () {
587
- // only treat as project root if it's the actual link that is the root,
588
- // or the target of the root link, but NOT if it's another link to the
589
- // same root that happens to be somewhere else.
587
+ // only treat as project root if it's the actual link that is the root, or the target of the root link, but NOT if it's another link to the same root that happens to be somewhere else.
590
588
  return this === this.root || this === this.root.target
591
589
  }
592
590
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@npmcli/arborist",
3
- "version": "9.1.10",
3
+ "version": "9.3.0",
4
4
  "description": "Manage node_modules trees",
5
5
  "dependencies": {
6
6
  "@isaacs/string-locale-compare": "^1.1.0",