Socket
Socket
Sign inDemoInstall

enhanced-require

Package Overview
Dependencies
3
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.4.0-beta to 0.4.0-beta2

test/fixtures/circular1.js

18

lib/execModule.js

@@ -35,5 +35,9 @@ /*

var wrappedFunction = runInThisContext(wrappedCode, request, request == filename);
wrappedFunction.call(m.exports, m.exports, req, req.define, m, filename, path.dirname(filename));
m.loaded = true;
return m;
var exec = function() {
wrappedFunction.call(m.exports, m.exports, req, req.define, m, filename, path.dirname(filename));
m.loaded = true;
return m.exports;
}
exec.module = m;
return exec;
} else {

@@ -46,5 +50,9 @@ var m = new Module(request, parent);

m.paths = Module._nodeModulePaths(path.dirname(filename));
m._compile(code, filename);
return m;
var exec = function() {
m._compile(code, filename);
return m.exports;
}
exec.module = m;
return exec;
}
}

@@ -55,4 +55,5 @@ /*

// check in cache
if(this.cache[filename]) {
var m = this.cache[filename];
var cache = this.cache;
if(cache[filename]) {
var m = cache[filename];
if(parent) {

@@ -95,15 +96,24 @@ m.parents = addToSet(m.parents, parent.id);

// eval the source code
var mod = execModule(source, parent, filenameWithLoaders, filename, loaders.length > 0 || this.options.recursive, this.options, this);
// load the source code
var exec = execModule(
source,
parent,
filenameWithLoaders,
filename,
loaders.length > 0 || this.options.recursive,
this.options,
this
);
// add to cache
this.cache[filenameWithLoaders] = mod;
cache[filenameWithLoaders] = exec.module;
// make dependency graph
if(parent) {
mod.parents = [parent.id];
parent.children.push(mod);
exec.module.parents = [parent.id];
parent.children.push(exec.module);
}
return mod.exports;
// execute
return exec();
}

@@ -110,0 +120,0 @@ }

{
"name": "enhanced-require",
"version": "0.4.0-beta",
"version": "0.4.0-beta2",
"author": "Tobias Koppers @sokra",

@@ -5,0 +5,0 @@ "description": "Enhance the require function in node.js with support for loaders which preprocess files and really async require (AMD). Enables Hot Code Replacement.",

@@ -33,2 +33,8 @@ var should = require("should");

it("should handle circular requires", function() {
var c = req("./fixtures/circular1");
should.exist(c);
c.should.be.eql({ two: { one: 1 } });
});
});
SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc