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.3 to 0.11.0

test/stream.js

45

index.js

@@ -9,3 +9,3 @@ var fs = require('fs');

var through = require('through');
var concatStream = require('concat-stream');
var concat = require('concat-stream');

@@ -18,3 +18,3 @@ module.exports = function (mains, opts) {

mains = mains.map(function (file) {
return path.resolve(file);
return typeof file === 'object' ? file : path.resolve(file);
});

@@ -44,2 +44,20 @@

if (id && typeof id === 'object' && typeof id.pipe === 'function') {
return id.pipe(concat(function (src) {
var n = Math.floor(Math.pow(16,8) * Math.random()).toString(16);
var basedir = opts.basedir || process.cwd();
var file = path.join(basedir, 'fake_' + n + '.js');
var pkgfile = path.join(basedir, 'package.json');
fs.readFile(pkgfile, function (err, pkgsrc) {
var pkg = {};
if (!err) {
try { pkg = JSON.parse(pkgsrc) }
catch (e) {};
}
var trx = getTransform(pkg);
applyTransforms(file, trx, src, pkg);
});
}));
}
var c = opts.cache && opts.cache[parent.id];

@@ -69,10 +87,3 @@ var resolver = c && typeof c === 'object'

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);
}
var trx = getTransform(pkg);

@@ -89,2 +100,14 @@ if (cache && cache[file]) {

function getTransform (pkg) {
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);
}
return trx;
}
function applyTransforms (file, trx, src, pkg) {

@@ -104,3 +127,3 @@ var isTopLevel = mains.some(function (main) {

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

@@ -107,0 +130,0 @@ ap(trs.slice(1));

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

@@ -5,0 +5,0 @@ "main": "index.js",

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