@npmcli/arborist 9.1.9 → 9.2.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
|
-
//
|
|
514
|
-
//
|
|
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
|
|
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}`)
|
|
@@ -5,7 +5,7 @@ const { dirname, join, normalize, relative, resolve } = require('node:path')
|
|
|
5
5
|
const PackageJson = require('@npmcli/package-json')
|
|
6
6
|
const { readdirScoped } = require('@npmcli/fs')
|
|
7
7
|
const { walkUp } = require('walk-up-path')
|
|
8
|
-
const
|
|
8
|
+
const { commonAncestorPath } = require('common-ancestor-path')
|
|
9
9
|
const treeCheck = require('../tree-check.js')
|
|
10
10
|
|
|
11
11
|
const Shrinkwrap = require('../shrinkwrap.js')
|
|
@@ -364,7 +364,7 @@ module.exports = cls => class ActualLoader extends cls {
|
|
|
364
364
|
const nmContents = new Map()
|
|
365
365
|
const tree = this.#actualTree
|
|
366
366
|
for (const node of tree.inventory.values()) {
|
|
367
|
-
const ancestor =
|
|
367
|
+
const ancestor = commonAncestorPath(node.realpath, this.path)
|
|
368
368
|
|
|
369
369
|
const depPromises = []
|
|
370
370
|
for (const [name, edge] of node.edgesOut.entries()) {
|
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.
|
|
3
|
+
"version": "9.2.0",
|
|
4
4
|
"description": "Manage node_modules trees",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@isaacs/string-locale-compare": "^1.1.0",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"@npmcli/run-script": "^10.0.0",
|
|
17
17
|
"bin-links": "^6.0.0",
|
|
18
18
|
"cacache": "^20.0.1",
|
|
19
|
-
"common-ancestor-path": "^
|
|
19
|
+
"common-ancestor-path": "^2.0.0",
|
|
20
20
|
"hosted-git-info": "^9.0.0",
|
|
21
21
|
"json-stringify-nice": "^1.1.4",
|
|
22
22
|
"lru-cache": "^11.2.1",
|