Socket
Socket
Sign inDemoInstall

module-deps

Package Overview
Dependencies
Maintainers
1
Versions
139
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

module-deps - npm Package Compare versions

Comparing version 0.10.1 to 0.10.2

test/files/tr_2dep_module/f.js

41

index.js

@@ -42,16 +42,2 @@ var fs = require('fs');

var trx = [];
parent.packageFilter = function (pkg) {
if (opts.packageFilter) pkg = opts.packageFilter(pkg);
if (opts.transformKey) {
var n = pkg;
opts.transformKey.forEach(function (key) {
if (n && typeof n === 'object') n = n[key];
});
trx = [].concat(n).filter(Boolean);
}
return pkg;
};
var c = opts.cache && opts.cache[parent.id];

@@ -66,3 +52,3 @@ var resolver = c && typeof c === 'object'

resolver(id, parent, function (err, file) {
resolver(id, parent, function (err, file, pkg) {
if (err) return output.emit('error', err);

@@ -80,8 +66,17 @@ if (!file) return output.emit('error', new Error([

var trx = [];
if (opts.transformKey) {
var n = pkg;
opts.transformKey.forEach(function (key) {
if (n && typeof n === 'object') n = n[key];
});
trx = [].concat(n).filter(Boolean);
}
if (cache && cache[file]) {
parseDeps(file, cache[file]);
parseDeps(file, cache[file], pkg);
}
else fs.readFile(file, 'utf8', function (err, src) {
if (err) return output.emit('error', err);
applyTransforms(file, trx, src);
applyTransforms(file, trx, src, pkg);
});

@@ -91,3 +86,3 @@ });

function applyTransforms (file, trx, src) {
function applyTransforms (file, trx, src, pkg) {
var isTopLevel = mains.some(function (main) {

@@ -106,3 +101,3 @@ var m = path.relative(path.dirname(main), file);

s.on('error', output.emit.bind(output, 'error'));
s.pipe(concatStream(function (err, data) {
s.pipe(concatStream(function (data) {
src = data;

@@ -116,7 +111,7 @@ ap(trs.slice(1));

function done () {
parseDeps(file, src);
parseDeps(file, src, pkg);
}
}
function parseDeps (file, src) {
function parseDeps (file, src, pkg) {
var deps;

@@ -143,3 +138,3 @@ if (!Buffer.isBuffer(src) && typeof src === 'object') {

var p = deps.length;
var current = { id: file, filename: file, paths: [] };
var current = { id: file, filename: file, paths: [], package: pkg };
var resolved = {};

@@ -153,3 +148,3 @@

}
walk(id, current, function (r) {

@@ -156,0 +151,0 @@ resolved[id] = r;

{
"name": "module-deps",
"version": "0.10.1",
"version": "0.10.2",
"description": "walk the dependency graph to generate json output that can be fed into browser-pack",

@@ -10,8 +10,8 @@ "main": "index.js",

"dependencies": {
"through": "~2.3.2",
"JSONStream": "~0.4.3",
"browser-resolve": "~0.1.0",
"resolve": "~0.3.0",
"detective": "~2.1.1",
"concat-stream": "~0.1.1"
"through": "~2.3.4",
"JSONStream": "~0.6.4",
"browser-resolve": "git://github.com/substack/node-browser-resolve.git#dir-replace",
"resolve": "~0.4.0",
"detective": "~2.1.2",
"concat-stream": "~1.0.0"
},

@@ -18,0 +18,0 @@ "devDependencies": {

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