@npmcli/arborist
Advanced tools
Comparing version 0.0.0 to 0.0.1
@@ -341,5 +341,5 @@ // mixin implementing the buildIdealTree method | ||
if (bundler) { | ||
this.log.warn(`audit fix ${node.name}@${node.package.version}`, | ||
this.log.warn(`audit fix ${node.name}@${node.version}`, | ||
`${node.location}\nis a bundled dependency of\n${ | ||
bundler.name}@${bundler.package.version} at ${bundler.location}\n` + | ||
bundler.name}@${bundler.version} at ${bundler.location}\n` + | ||
'It cannot be fixed automatically.\n' + | ||
@@ -920,4 +920,4 @@ `Check for updates to the ${bundler.name} package.`) | ||
// if the version is greater, try to use the new one | ||
const curVer = current.package.version | ||
const newVer = dep.package.version | ||
const curVer = current.version | ||
const newVer = dep.version | ||
// always try to replace if the version is greater | ||
@@ -924,0 +924,0 @@ const tryReplace = curVer && newVer && semver.gte(newVer, curVer) |
@@ -40,4 +40,6 @@ // mixin providing the loadVirtual method | ||
return Shrinkwrap.load({ path: this.path }).then(s => { | ||
if (!s.loadedFromDisk && !options.root) | ||
throw new Error('loadVirtual requires existing shrinkwrap file') | ||
if (!s.loadedFromDisk && !options.root) { | ||
const er = new Error('loadVirtual requires existing shrinkwrap file') | ||
throw Object.assign(er, { code: 'ENOLOCK' }) | ||
} | ||
@@ -44,0 +46,0 @@ // when building the ideal tree, we pass in a root node to this function |
@@ -399,4 +399,4 @@ // mixin implementing the reify method | ||
const res = node.resolved ? this[_registryResolved](node.resolved) | ||
: node.package.name && node.package.version | ||
? `${node.package.name}@${node.package.version}` | ||
: node.package.name && node.version | ||
? `${node.package.name}@${node.version}` | ||
: null | ||
@@ -759,3 +759,3 @@ | ||
if (req.registry) { | ||
const version = child.package.version | ||
const version = child.version | ||
const range = this[_savePrefix] + version | ||
@@ -762,0 +762,0 @@ const pname = child.package.name |
@@ -255,3 +255,3 @@ // an object representing the set of vulnerabilities in a tree | ||
// not a dep that comes from the registry, apparently | ||
metaVuln.push(p.package.version) | ||
metaVuln.push(p.version) | ||
} else { | ||
@@ -429,3 +429,3 @@ for (const [version, pmani] of Object.entries(paku.versions)) { | ||
for (const node of tree.inventory.query('name', name)) { | ||
set.add(node.package.version) | ||
set.add(node.version) | ||
} | ||
@@ -432,0 +432,0 @@ payload[name] = [...set] |
@@ -37,2 +37,3 @@ // inventory, path, realpath, root, and parent | ||
const {getPaths: getBinPaths} = require('bin-links') | ||
const npa = require('npm-package-arg') | ||
@@ -267,2 +268,15 @@ /* istanbul ignore next */ | ||
get version () { | ||
return this[_package].version || '' | ||
} | ||
get pkgid () { | ||
const { name = '', version = '' } = this.package | ||
// root package will prefer package name over folder name, | ||
// and never be called an alias. | ||
const myname = this.isRoot ? name || this.name : this.name | ||
const alias = !this.isRoot && name && myname !== name ? `npm:${name}@` : '' | ||
return `${myname}@${alias}${version}` | ||
} | ||
get package () { | ||
@@ -507,2 +521,16 @@ return this[_package] | ||
satisfies (requested) { | ||
if (requested instanceof Edge) | ||
return this.name === requested.name && requested.satisfiedBy(this) | ||
const parsed = npa(requested) | ||
const { name = this.name, rawSpec: spec } = parsed | ||
return this.name === name && this.satisfies(new Edge({ | ||
from: new Node({ path: this.root.path }), | ||
type: 'prod', | ||
name, | ||
spec, | ||
})) | ||
} | ||
matches (node) { | ||
@@ -538,4 +566,4 @@ // if the nodes are literally the same object, obviously a match. | ||
this.package.name === node.package.name && | ||
this.package.version && node.package.version && | ||
this.package.version === node.package.version | ||
this.version && node.version && | ||
this.version === node.version | ||
} | ||
@@ -542,0 +570,0 @@ |
@@ -718,3 +718,3 @@ // a module that manages a shrinkwrap file (npm-shrinkwrap.json or | ||
if (!entry || | ||
mismatch(node.package.version, entry.version) || | ||
mismatch(node.version, entry.version) || | ||
mismatch(node.integrity, entry.integrity) || | ||
@@ -769,4 +769,4 @@ mismatch(pathFixed, entry.resolved)) | ||
lock.name = node.package.name || node.name | ||
if (node.package.version) | ||
lock.version = node.package.version | ||
if (node.version) | ||
lock.version = node.version | ||
} | ||
@@ -816,5 +816,5 @@ | ||
node.package.name !== node.name) | ||
lock.version = `npm:${node.package.name}@${node.package.version}` | ||
else if (node.package && node.package.version) | ||
lock.version = node.package.version | ||
lock.version = `npm:${node.package.name}@${node.version}` | ||
else if (node.package && node.version) | ||
lock.version = node.version | ||
@@ -821,0 +821,0 @@ if (node.inBundle) |
@@ -273,4 +273,4 @@ // parse a yarn lock file | ||
n.optionalDependencies = node.package.optionalDependencies | ||
if (node.package.version) | ||
n.version = node.package.version | ||
if (node.version) | ||
n.version = node.version | ||
if (node.resolved) | ||
@@ -277,0 +277,0 @@ n.resolved = consistentResolve( |
{ | ||
"name": "@npmcli/arborist", | ||
"version": "0.0.0", | ||
"version": "0.0.1", | ||
"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
250848
6096