@npmcli/arborist
Advanced tools
Comparing version 5.0.3 to 5.0.4
@@ -358,2 +358,17 @@ // mixin implementing the buildIdealTree method | ||
.then(tree => { | ||
// search the virtual tree for invalid edges, if any are found add their source to | ||
// the depsQueue so that we'll fix it later | ||
depth({ | ||
tree, | ||
getChildren: (node) => [...node.edgesOut.values()].map(edge => edge.to), | ||
filter: node => node, | ||
visit: node => { | ||
for (const edge of node.edgesOut.values()) { | ||
if (!edge.valid) { | ||
this[_depsQueue].push(node) | ||
break // no need to continue the loop after the first hit | ||
} | ||
} | ||
}, | ||
}) | ||
// null the virtual tree, because we're about to hack away at it | ||
@@ -747,2 +762,8 @@ // if you want another one, load another copy. | ||
// if the node's location isn't within node_modules then this is actually | ||
// a link target, so skip it. the link node itself will be queued later. | ||
if (!node.location.startsWith('node_modules')) { | ||
continue | ||
} | ||
queue.push(async () => { | ||
@@ -755,4 +776,3 @@ log.silly('inflate', node.location) | ||
) | ||
const id = useResolved ? resolved | ||
: version || `file:${node.path}` | ||
const id = useResolved ? resolved : version | ||
const spec = npa.resolve(name, id, dirname(path)) | ||
@@ -759,0 +779,0 @@ const t = `idealTree:inflate:${location}` |
@@ -82,3 +82,3 @@ // mixin providing the loadVirtual method | ||
const pkg = await rpj(pj).catch(() => s.data.packages['']) || {} | ||
return this[loadWorkspaces](this[loadNode]('', pkg)) | ||
return this[loadWorkspaces](this[loadNode]('', pkg, true)) | ||
} | ||
@@ -268,3 +268,3 @@ | ||
[loadNode] (location, sw) { | ||
[loadNode] (location, sw, loadOverrides) { | ||
const p = this.virtualTree ? this.virtualTree.realpath : this.path | ||
@@ -295,2 +295,3 @@ const path = resolve(p, location) | ||
peer, | ||
loadOverrides, | ||
}) | ||
@@ -297,0 +298,0 @@ // cast to boolean because they're undefined in the lock file when false |
@@ -1311,3 +1311,3 @@ // mixin implementing the reify method | ||
const filterDirectDependencies = node => | ||
!node.isRoot && node.resolveParent.isRoot | ||
!node.isRoot && node.resolveParent && node.resolveParent.isRoot | ||
&& (!names || names.includes(node.name)) | ||
@@ -1314,0 +1314,0 @@ && exactVersion(node) // skip update for exact ranges |
const _progress = Symbol('_progress') | ||
const _onError = Symbol('_onError') | ||
const _setProgress = Symbol('_setProgess') | ||
const npmlog = require('npmlog') | ||
@@ -8,2 +9,3 @@ | ||
super(options) | ||
this[_setProgress] = !!options.progress | ||
this[_progress] = new Map() | ||
@@ -31,3 +33,3 @@ } | ||
// starts progress bar | ||
if (this[_progress].size === 0) { | ||
if (this[_setProgress] && this[_progress].size === 0) { | ||
npmlog.enableProgress() | ||
@@ -81,3 +83,3 @@ } | ||
// trackers are finished | ||
if (this[_progress].size === 0) { | ||
if (this[_setProgress] && this[_progress].size === 0) { | ||
npmlog.disableProgress() | ||
@@ -98,5 +100,7 @@ } | ||
[_onError] (msg) { | ||
npmlog.disableProgress() | ||
if (this[_setProgress]) { | ||
npmlog.disableProgress() | ||
} | ||
throw new Error(msg) | ||
} | ||
} |
{ | ||
"name": "@npmcli/arborist", | ||
"version": "5.0.3", | ||
"version": "5.0.4", | ||
"description": "Manage node_modules trees", | ||
@@ -42,3 +42,4 @@ "dependencies": { | ||
"devDependencies": { | ||
"@npmcli/template-oss": "^2.4.2", | ||
"@npmcli/eslint-config": "^3.0.1", | ||
"@npmcli/template-oss": "3.2.2", | ||
"benchmark": "^2.1.4", | ||
@@ -61,3 +62,3 @@ "chalk": "^4.1.0", | ||
"eslint": "eslint", | ||
"lint": "eslint '**/*.js'", | ||
"lint": "eslint \"**/*.js\"", | ||
"lintfix": "npm run lint -- --fix", | ||
@@ -67,8 +68,8 @@ "benchmark": "node scripts/benchmark.js", | ||
"npmclilint": "npmcli-lint", | ||
"postlint": "npm-template-check", | ||
"template-copy": "npm-template-copy --force" | ||
"postlint": "template-oss-check", | ||
"template-oss-apply": "template-oss-apply --force" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/npm/cli", | ||
"url": "https://github.com/npm/cli.git", | ||
"directory": "workspaces/arborist" | ||
@@ -79,4 +80,4 @@ }, | ||
"files": [ | ||
"bin", | ||
"lib" | ||
"bin/", | ||
"lib/" | ||
], | ||
@@ -103,11 +104,8 @@ "main": "lib/index.js", | ||
"engines": { | ||
"node": "^12.13.0 || ^14.15.0 || >=16" | ||
"node": "^12.13.0 || ^14.15.0 || >=16.0.0" | ||
}, | ||
"eslintIgnore": [ | ||
"test/fixtures/", | ||
"!test/fixtures/*.js" | ||
], | ||
"templateOSS": { | ||
"version": "2.9.2" | ||
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", | ||
"version": "3.2.2" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
411996
10886
8