@npmcli/arborist
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -11,2 +11,3 @@ // mixin implementing the buildIdealTree method | ||
const debug = require('../debug.js') | ||
const fromPath = require('../from-path.js') | ||
@@ -1273,12 +1274,12 @@ const calcDepFlags = require('../calc-dep-flags.js') | ||
// XXX - Useful testing thingie right here. | ||
// This assertion is commented out because we don't want to blow up user | ||
// projects if it happens. But the peerEntryEdge should *always* be a | ||
// non-peer dependency, or a peer dependency from the root node. When we | ||
// get spurious ERESOLVE errors, or *don't* get ERESOLVE errors when we | ||
// should, try uncommenting this and seeing if it fails, because it means | ||
// we got off track somehow. | ||
// if (peerEntryEdge && peerEntryEdge.peer && !peerEntryEdge.from.isTop) { | ||
// throw new Error('this should never happen') | ||
// } | ||
// Useful testing thingie right here. | ||
// peerEntryEdge should *always* be a non-peer dependency, or a peer | ||
// dependency from the root node. When we get spurious ERESOLVE errors, | ||
// or *don't* get ERESOLVE errors when we should, check to see if this | ||
// fails, because it MAY mean we got off track somehow. | ||
/* istanbul ignore next - debug check, should be impossible */ | ||
debug(() => { | ||
if (peerEntryEdge && peerEntryEdge.peer && !peerEntryEdge.from.isTop) | ||
throw new Error('lost original peerEntryEdge somehow?') | ||
}) | ||
@@ -1285,0 +1286,0 @@ if (target.children.has(edge.name)) { |
@@ -37,7 +37,4 @@ // inventory, path, realpath, root, and parent | ||
const npa = require('npm-package-arg') | ||
const debug = require('./debug.js') | ||
/* istanbul ignore next */ | ||
const dassert = /\barborist\b/.test(process.env.NODE_DEBUG || '') | ||
? require('assert') : () => {} | ||
const {resolve, relative, dirname, basename} = require('path') | ||
@@ -482,4 +479,7 @@ const _package = Symbol('_package') | ||
this.children.forEach(c => c.root = root) | ||
/* istanbul ignore next */ | ||
dassert(this === root || this.inventory.size === 0) | ||
/* istanbul ignore next - debug check */ | ||
debug(() => { | ||
if (this !== root && this.inventory.size !== 0) | ||
throw new Error('non-root has non-zero inventory') | ||
}) | ||
} | ||
@@ -492,3 +492,4 @@ | ||
[_loadWorkspaces] () { | ||
if (!this[_workspaces]) return | ||
if (!this[_workspaces]) | ||
return | ||
@@ -563,2 +564,10 @@ for (const [name, path] of this[_workspaces].entries()) | ||
debug(() => { | ||
if (!this.fsParent && this.realpath.indexOf(fsParent.realpath) !== 0) | ||
throw new Error('attempting to set fsParent improperly') | ||
if (fsParent.isLink) | ||
throw new Error('attempting to set fsParent to link node') | ||
}) | ||
// prune off the original location, so we don't leave edges lying around | ||
@@ -684,4 +693,10 @@ if (current) | ||
node[_parent] = this[_parent] | ||
this.fsChildren.forEach(c => c.fsParent = node) | ||
this.children.forEach(c => c.parent = node) | ||
// if we're replacing a non-link node with a link, then all the children | ||
// and fsChildren just go along with it, because links don't have those. | ||
if (!node.isLink) { | ||
this.fsChildren.forEach(c => c.fsParent = node) | ||
this.children.forEach(c => c.parent = node) | ||
} | ||
// now remove the hidden reference, and call parent setter to finalize. | ||
@@ -688,0 +703,0 @@ node[_parent] = null |
{ | ||
"name": "@npmcli/arborist", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "Manage node_modules trees", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
286835
41
6922
5