snyk-resolve-deps
Advanced tools
Comparing version 1.3.2 to 1.4.0
@@ -33,3 +33,3 @@ #!/usr/bin/env node | ||
if (found) { | ||
return resolveTree.physicalTree(src, args) | ||
return resolveTree.physicalTree(src) | ||
.then(function (res) { | ||
@@ -40,9 +40,5 @@ if (args.disk) { | ||
return resolveTree.logicalTree(res); | ||
return resolveTree.logicalTree(res, args); | ||
}) | ||
.then(function (res) { | ||
if (args.json) { | ||
return echo(res); | ||
} | ||
filter(args, res); | ||
@@ -57,2 +53,6 @@ | ||
if (args.json) { | ||
return echo(res); | ||
} | ||
print(args, res); | ||
@@ -59,0 +59,0 @@ }); |
@@ -23,3 +23,3 @@ module.exports = loadModules; | ||
return loadModulesInternal(dir, depTypes.PROD, { | ||
__from: [tree.name, name], | ||
__from: [tree.name + '@' + tree.version, name], | ||
}); | ||
@@ -65,2 +65,3 @@ }).catch(function (e) { | ||
if (pkg) { | ||
var full = pkg.name + '@' + (pkg.version || '0.0.0'); | ||
modules = { | ||
@@ -72,3 +73,3 @@ name: pkg.name, | ||
hasDevDependencies: !!pkg.devDependencies, | ||
full: pkg.name + '@' + (pkg.version || '0.0.0'), | ||
full: full, | ||
__from: (parent || { __from: [] }).__from, | ||
@@ -84,3 +85,3 @@ __devDependencies: pkg.devDependencies, | ||
// introduced via | ||
pkg.__from = modules.__from.concat(pkg.name); | ||
pkg.__from = modules.__from.concat(full); | ||
@@ -90,3 +91,3 @@ // this is a special case for the root package to get a consistent | ||
if (modules.__from.length === 0) { | ||
modules.__from.push(pkg.name); | ||
modules.__from.push(full); | ||
} | ||
@@ -151,6 +152,8 @@ } else { | ||
var full = curr.name + '@' + (curr.version || '0.0.0'); | ||
acc[curr.name] = { | ||
name: curr.name, | ||
version: curr.version || null, | ||
full: curr.name + '@' + (curr.version || '0.0.0'), | ||
full: full, | ||
valid: valid, | ||
@@ -161,4 +164,3 @@ depType: depType, | ||
dep: depFrom || null, | ||
bundled: depInfo.bundled, | ||
__from: pkg.__from.concat(curr.name), | ||
__from: pkg.__from.concat(full), | ||
__devDependencies: curr.devDependencies, | ||
@@ -170,2 +172,7 @@ __dependencies: curr.dependencies, | ||
}; | ||
if (depInfo.bundled) { | ||
acc[curr.name].bundled = acc[curr.name].__from.slice(0); | ||
} | ||
return acc; | ||
@@ -172,0 +179,0 @@ }, modules.dependencies); |
@@ -9,2 +9,3 @@ module.exports = logicalTree; | ||
var colour = require('ansicolors'); | ||
var moduleToObject = require('snyk-module'); | ||
var _ = require('lodash'); | ||
@@ -94,3 +95,6 @@ var format = require('util').format; | ||
function insertLeaf(tree, leaf, from) { | ||
var path = (from || []).slice(1, -1); // remove the root of the path | ||
// remove the root of the path and covert to names only | ||
var path = (from || []).slice(1, -1).map(function (pkg) { | ||
return moduleToObject(pkg).name; | ||
}); | ||
var entry = tree.dependencies; | ||
@@ -128,4 +132,4 @@ for (var i = 0; i < path.length; i++) { | ||
if (from.indexOf(dep.name) === -1) { | ||
var pkg = acc[dep.name] = copy(dep, from.concat(dep.name)); | ||
if (from.indexOf(dep.full) === -1) { | ||
var pkg = acc[dep.name] = copy(dep, from.concat(dep.full)); | ||
dep.__used = true; | ||
@@ -142,3 +146,3 @@ var info = depTypes(dep.name, { | ||
if (tree.bundled) { // carry the bundled flag down from the parent | ||
dep.bundled = pkg.bundled = true; | ||
dep.bundled = pkg.bundled = tree.bundled; | ||
} | ||
@@ -145,0 +149,0 @@ |
@@ -47,3 +47,3 @@ { | ||
}, | ||
"version": "1.3.2" | ||
"version": "1.4.0" | ||
} |
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
206071
678