Socket
Socket
Sign inDemoInstall

module-deps

Package Overview
Dependencies
35
Maintainers
4
Versions
139
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.0.4 to 4.0.5

41

index.js

@@ -72,2 +72,14 @@ var fs = require('fs');

Deps.prototype._isTopLevel = function (file) {
var isTopLevel = this.entries.some(function (main) {
var m = path.relative(path.dirname(main), file);
return m.split(/[\\\/]/).indexOf('node_modules') < 0;
});
if (!isTopLevel) {
var m = path.relative(this.basedir, file);
isTopLevel = m.split(/[\\\/]/).indexOf('node_modules') < 0;
}
return isTopLevel;
};
Deps.prototype._transform = function (row, enc, next) {

@@ -201,3 +213,2 @@ var self = this;

Deps.prototype.getTransforms = function (file, pkg, opts) {
// TODO: Needs FAKE path here.
if (!opts) opts = {};

@@ -207,11 +218,4 @@ var self = this;

var isTopLevel;
if (opts.builtin) isTopLevel = false;
else isTopLevel = this.entries.some(function (main) {
var m = path.relative(path.dirname(main), file);
return m.split(/[\\\/]/).indexOf('node_modules') < 0;
});
if (!isTopLevel && !opts.builtin) {
var m = path.relative(this.basedir, file);
isTopLevel = m.split(/[\\\/]/).indexOf('node_modules') < 0;
}
if (opts.builtin || opts.inNodeModules) isTopLevel = false;
else isTopLevel = this._isTopLevel(file);

@@ -374,10 +378,11 @@ var transforms = [].concat(isTopLevel ? this.transforms : [])

var c = self.cache && self.cache[file];
if (c) return fromDeps(file, c.source, c.package, Object.keys(c.deps));
if (c) return fromDeps(file, c.source, c.package, fakePath, Object.keys(c.deps));
self.readFile(file, id, pkg)
.pipe(self.getTransforms(fakePath || file, pkg, {
builtin: builtin
builtin: builtin,
inNodeModules: parent.inNodeModules
}))
.pipe(concat(function (body) {
fromSource(file, body.toString('utf8'), pkg);
fromSource(file, body.toString('utf8'), pkg, fakePath);
}))

@@ -387,8 +392,8 @@ ;

function fromSource (file, src, pkg) {
function fromSource (file, src, pkg, fakePath) {
var deps = rec.noparse ? [] : self.parseDeps(file, src);
if (deps) fromDeps(file, src, pkg, deps);
if (deps) fromDeps(file, src, pkg, fakePath, deps);
}
function fromDeps (file, src, pkg, deps) {
function fromDeps (file, src, pkg, fakePath, deps) {
var p = deps.length;

@@ -407,2 +412,3 @@ var resolved = {};

}
var isTopLevel = self._isTopLevel(fakePath || file);
var current = {

@@ -412,3 +418,4 @@ id: file,

paths: self.paths,
package: pkg
package: pkg,
inNodeModules: parent.inNodeModules || !isTopLevel
};

@@ -415,0 +422,0 @@ self.walk(id, current, function (err, r) {

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

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

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc