Socket
Socket
Sign inDemoInstall

snyk-resolve-deps

Package Overview
Dependencies
Maintainers
2
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

snyk-resolve-deps - npm Package Compare versions

Comparing version 1.7.1 to 1.8.0

.nyc_output/3404.json

34

lib/deps.js

@@ -13,6 +13,20 @@ module.exports = loadModules;

function applyExtraFields(src, dest, extraFields) {
if (!extraFields || !extraFields.length) {
return;
}
extraFields.forEach(function applyExtraField(field) {
_.set(dest, field, _.get(src, field) || null);
});
};
// FIXME only supports dependancies & dev deps not opt-deps
function loadModules(root, depType) {
function loadModules(root, depType, options) {
tryRequire.cache.reset(); // reset the package cache on re-run
return loadModulesInternal(root, depType || null).then(function (tree) {
return loadModulesInternal(
root,
depType || null,
null,
options
).then(function (tree) {
// ensure there's no missing packages our known root deps

@@ -51,3 +65,4 @@ var missing = [];

function loadModulesInternal(root, rootDepType, parent) {
function loadModulesInternal(root, rootDepType, parent, options) {
options = options || {}
if (!rootDepType) {

@@ -68,3 +83,5 @@ rootDepType = depTypes.EXTRANEOUS;

var full = pkg.name + '@' + (pkg.version || '0.0.0');
modules = {
modules = {};
applyExtraFields(pkg, modules, options.extraFields);
_.assign(modules, {
name: pkg.name,

@@ -83,3 +100,3 @@ version: pkg.version || null,

__filename: pkg.__filename,
};
});

@@ -162,4 +179,5 @@ // allows us to add to work out the full path that the package was

var full = curr.name + '@' + (curr.version || '0.0.0');
acc[curr.name] = {
acc[curr.name] = {}
applyExtraFields(curr, acc[curr.name], options.extraFields);
_.assign(acc[curr.name], {
name: curr.name,

@@ -180,3 +198,3 @@ version: curr.version || null,

__filename: curr.__filename,
};
});

@@ -183,0 +201,0 @@ if (depInfo.bundled) {

module.exports = function (dir, options) {
return physicalTree(dir).then(function (res) {
return physicalTree(dir, null, options).then(function (res) {
return logicalTree(res, options);

@@ -4,0 +4,0 @@ });

@@ -51,3 +51,3 @@ {

},
"version": "1.7.1"
"version": "1.8.0"
}

@@ -10,6 +10,7 @@ # snyk-resolve-deps

```js
var resolveDeps = require('snyn-resolve-deps');
var resolveDeps = require('snyk-resolve-deps');
var asTree = require('snyk-tree');
var options = { dev: true };
resolveDeps(process.cwd(), { dev: true }).then(function (tree) {
resolveDeps(process.cwd(), options).then(function (tree) {
console.log(asTree(tree));

@@ -23,2 +24,11 @@ }).catch(function (error) {

### API
#### resolveDeps(root, options)
- root: path to project root
- options (optional)
- dev: [default, `false`] report only development options
- extraFields: [default, `undefined`] extract extra fields from dependencies' package.json files. example: `['files']`
## CLI usage

@@ -60,2 +70,2 @@

* [CONTRIBUTING.md](CONTRIBUTING.md)
* [License: Apache License, Version 2.0](LICENSE)
* [License: Apache License, Version 2.0](LICENSE)

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc