Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

loader.js

Package Overview
Dependencies
Maintainers
4
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

loader.js - npm Package Compare versions

Comparing version 4.0.7 to 4.0.8

benchmarks/scenarios/ember-just-modules.js

96

lib/loader/loader.js

@@ -17,3 +17,10 @@ var loader, define, requireModule, require, requirejs;

stats.require++;
return findModule(name, '(require)').module.exports;
var pending = [];
var mod = findModule(name, '(require)', pending);
for (var i = pending.length - 1; i >= 0; i--) {
pending[i].exports();
}
return mod.module.exports;
};

@@ -26,6 +33,5 @@

reify: 0,
build: 0,
findDeps: 0,
modules: 0,
exports: 0,
ensureBuild: 0,
resolve: 0,

@@ -69,4 +75,2 @@ resolveRelative: 0,

var seen = {};
var FAILED = false;
var LOADED = true;

@@ -89,3 +93,2 @@ var uuid = 0;

this.callback = callback;
this.state = undefined;
this.finalized = false;

@@ -95,2 +98,3 @@ this.hasExportsAsDep = false;

this.reified = new Array(deps.length);
this._foundDeps = false;
}

@@ -108,17 +112,20 @@

Module.prototype.exports = function() {
stats.exports ++;
if (this.finalized) {
return this.module.exports;
} else {
if (loader.wrapModules) {
this.callback = loader.wrapModules(this.name, this.callback);
}
var result = this.callback.apply(this, this.reified);
if (!(this.hasExportsAsDep && result === undefined)) {
this.module.exports = result;
}
this.makeDefaultExport();
this.finalized = true;
return this.module.exports;
if (this.finalized) { return this.module.exports; }
stats.exports++;
this.finalized = true;
if (loader.wrapModules) {
this.callback = loader.wrapModules(this.name, this.callback);
}
this.reify();
var result = this.callback.apply(this, this.reified);
if (!(this.hasExportsAsDep && result === undefined)) {
this.module.exports = result;
}
this.makeDefaultExport();
return this.module.exports;
};

@@ -128,3 +135,3 @@

this.finalized = false;
this.state = undefined;
this._foundDeps = false;
this.module = { exports: {}};

@@ -135,17 +142,31 @@ };

stats.reify++;
var deps = this.deps;
var dep;
var reified = this.reified;
for (var i = 0; i < reified.length; i++) {
var mod = reified[i];
reified[i] = mod.exports ? mod.exports : mod.module.exports();
}
};
Module.prototype.findDeps = function(pending) {
if (this._foundDeps) {
return;
}
stats.findDeps++;
this._foundDeps = true;
var deps = this.deps;
for (var i = 0; i < deps.length; i++) {
dep = deps[i];
var dep = deps[i];
var entry = this.reified[i] = { exports: undefined, module: undefined };
if (dep === 'exports') {
this.hasExportsAsDep = true;
reified[i] = this.module.exports;
entry.exports = this.module.exports;
} else if (dep === 'require') {
reified[i] = this.makeRequire();
entry.exports = this.makeRequire();
} else if (dep === 'module') {
reified[i] = this.module;
entry.exports = this.module;
} else {
reified[i] = findModule(resolve(dep, this.name), this.name).module.exports;
entry.module = findModule(resolve(dep, this.name), this.name, pending);
}

@@ -167,12 +188,2 @@ }

Module.prototype.build = function() {
stats.ensureBuild++;
if (this.state === FAILED || this.state === LOADED) { return; }
stats.build++;
this.state = FAILED;
this.reify()
this.exports();
this.state = LOADED;
};
define = function(name, deps, callback) {

@@ -213,3 +224,3 @@ stats.define++;

function findModule(name, referrer) {
function findModule(name, referrer, pending) {
stats.findModule++;

@@ -224,3 +235,6 @@ var mod = registry[name] || registry[name + '/index'];

mod.build();
if (pending) {
mod.findDeps(pending);
pending.push(mod);
}
return mod;

@@ -261,3 +275,3 @@ }

requirejs.unsee = function(moduleName) {
findModule(moduleName, '(unsee)').unsee();
findModule(moduleName, '(unsee)', false).unsee();
};

@@ -264,0 +278,0 @@

{
"name": "loader.js",
"version": "4.0.7",
"version": "4.0.8",
"description": "loader.js =========",

@@ -5,0 +5,0 @@ "main": "lib/loader/loader.js",

@@ -71,5 +71,4 @@ /*globals newDefine:false, newLoader:false, newRequire:false*/

deepEqual(require._stats, {
build: 0,
findDeps: 0,
define: 1,
ensureBuild: 0,
exports: 0,

@@ -90,5 +89,4 @@ findModule: 0,

deepEqual(require._stats, {
build: 1,
findDeps: 1,
define: 1,
ensureBuild: 1,
exports: 1,

@@ -108,5 +106,4 @@ findModule: 1,

deepEqual(require._stats, {
build: 1,
findDeps: 1,
define: 1,
ensureBuild: 2,
exports: 1,

@@ -135,5 +132,4 @@ findModule: 2,

deepEqual(require._stats, {
build: 1,
findDeps: 1,
define: 1,
ensureBuild: 1,
exports: 1,

@@ -162,5 +158,4 @@ findModule: 1,

deepEqual(require._stats, {
build: 0,
findDeps: 0,
define: 1,
ensureBuild: 0,
exports: 0,

@@ -180,5 +175,4 @@ findModule: 0,

deepEqual(require._stats, {
build: 0,
findDeps: 0,
define: 2,
ensureBuild: 0,
exports: 0,

@@ -213,5 +207,4 @@ findModule: 0,

deepEqual(require._stats, {
build: 0,
findDeps: 0,
define: 2,
ensureBuild: 0,
exports: 0,

@@ -229,5 +222,4 @@ findModule: 0,

deepEqual(require._stats, {
build: 2,
findDeps: 2,
define: 2,
ensureBuild: 2,
exports: 2,

@@ -257,5 +249,4 @@ findModule: 2,

deepEqual(require._stats, {
build: 0,
findDeps: 0,
define: 2,
ensureBuild: 0,
exports: 0,

@@ -273,5 +264,4 @@ findModule: 0,

deepEqual(require._stats, {
build: 2,
findDeps: 2,
define: 2,
ensureBuild: 2,
exports: 2,

@@ -302,5 +292,4 @@ findModule: 2,

deepEqual(require._stats, {
build: 0,
findDeps: 0,
define: 2,
ensureBuild: 0,
exports: 0,

@@ -318,5 +307,4 @@ findModule: 0,

deepEqual(require._stats, {
build: 2,
findDeps: 2,
define: 2,
ensureBuild: 2,
exports: 2,

@@ -348,5 +336,4 @@ findModule: 2,

deepEqual(require._stats, {
build: 0,
findDeps: 0,
define: 2,
ensureBuild: 0,
exports: 0,

@@ -364,5 +351,4 @@ findModule: 0,

deepEqual(require._stats, {
build: 2,
findDeps: 2,
define: 2,
ensureBuild: 2,
exports: 2,

@@ -415,5 +401,4 @@ findModule: 2,

deepEqual(require._stats, {
build: 2,
findDeps: 2,
define: 2,
ensureBuild: 2,
exports: 2,

@@ -446,5 +431,4 @@ findModule: 2,

deepEqual(require._stats, {
build: 2,
findDeps: 2,
define: 2,
ensureBuild: 4,
exports: 2,

@@ -480,5 +464,4 @@ findModule: 4,

deepEqual(require._stats, {
build: 2,
findDeps: 2,
define: 2,
ensureBuild: 2,
exports: 2,

@@ -515,5 +498,4 @@ findModule: 2,

deepEqual(require._stats, {
build: 1,
findDeps: 1,
define: 1,
ensureBuild: 1,
exports: 1,

@@ -541,5 +523,4 @@ findModule: 1,

deepEqual(require._stats, {
build: 1,
findDeps: 1,
define: 1,
ensureBuild: 1,
exports: 1,

@@ -571,5 +552,4 @@ findModule: 1,

deepEqual(require._stats, {
build: 1,
findDeps: 1,
define: 1,
ensureBuild: 1,
exports: 1,

@@ -596,5 +576,4 @@ findModule: 1,

deepEqual(require._stats, {
build: 1,
findDeps: 1,
define: 1,
ensureBuild: 2,
exports: 1,

@@ -681,5 +660,4 @@ findModule: 2,

deepEqual(require._stats, {
build: 3,
findDeps: 3,
define: 3,
ensureBuild: 3,
exports: 3,

@@ -709,5 +687,4 @@ findModule: 3,

deepEqual(require._stats, {
build: 1,
findDeps: 1,
define: 3,
ensureBuild: 2,
exports: 1,

@@ -735,5 +712,4 @@ findModule: 2,

deepEqual(require._stats, {
build: 1,
findDeps: 1,
define: 2,
ensureBuild: 2,
exports: 1,

@@ -763,5 +739,4 @@ findModule: 2,

deepEqual(require._stats, {
build: 2,
findDeps: 2,
define: 2,
ensureBuild: 4,
exports: 2,

@@ -795,5 +770,4 @@ findModule: 4,

deepEqual(require._stats, {
build: 3,
findDeps: 3,
define: 3,
ensureBuild: 4,
exports: 3,

@@ -829,5 +803,4 @@ findModule: 4,

deepEqual(require._stats, {
build: 2,
findDeps: 2,
define: 1,
ensureBuild: 5,
exports: 2,

@@ -859,5 +832,4 @@ findModule: 5,

deepEqual(require._stats, {
build: 2,
findDeps: 2,
define: 3,
ensureBuild: 4,
exports: 2,

@@ -893,5 +865,4 @@ findModule: 4,

deepEqual(require._stats, {
build: 2,
findDeps: 2,
define: 4,
ensureBuild: 4,
exports: 2,

@@ -927,5 +898,4 @@ findModule: 4,

deepEqual(require._stats, {
build: 2,
findDeps: 2,
define: 4,
ensureBuild: 4,
exports: 2,

@@ -957,5 +927,4 @@ findModule: 4,

deepEqual(require._stats, {
build: 1,
findDeps: 1,
define: 2,
ensureBuild: 2,
exports: 1,

@@ -997,5 +966,4 @@ findModule: 2,

deepEqual(require._stats, {
build: 3,
findDeps: 3,
define: 2,
ensureBuild: 6,
exports: 3,

@@ -1025,5 +993,4 @@ findModule: 6,

deepEqual(require._stats, {
build: 2,
findDeps: 2,
define: 3,
ensureBuild: 2,
exports: 2,

@@ -1050,5 +1017,4 @@ findModule: 2,

deepEqual(require._stats, {
build: 1,
findDeps: 1,
define: 3,
ensureBuild: 1,
exports: 1,

@@ -1077,5 +1043,4 @@ findModule: 1,

deepEqual(require._stats, {
build: 1,
findDeps: 1,
define: 5,
ensureBuild: 1,
exports: 1,

@@ -1114,5 +1079,4 @@ findModule: 1,

deepEqual(require._stats, {
build: 2,
findDeps: 2,
define: 8,
ensureBuild: 2,
exports: 2,

@@ -1150,5 +1114,4 @@ findModule: 2,

deepEqual(require._stats, {
build: 2,
findDeps: 2,
define: 3,
ensureBuild: 4,
exports: 2,

@@ -1181,5 +1144,4 @@ findModule: 4,

deepEqual(require._stats, {
build: 2,
findDeps: 2,
define: 4,
ensureBuild: 4,
exports: 2,

@@ -1211,5 +1173,4 @@ findModule: 4,

deepEqual(require._stats, {
build: 1,
findDeps: 1,
define: 1,
ensureBuild: 1,
exports: 1,

@@ -1237,5 +1198,4 @@ findModule: 1,

deepEqual(require._stats, {
build: 2,
findDeps: 2,
define: 2,
ensureBuild: 2,
exports: 2,

@@ -1265,5 +1225,4 @@ findModule: 2,

deepEqual(require._stats, {
build: 2,
findDeps: 2,
define: 2,
ensureBuild: 2,
exports: 2,

@@ -1270,0 +1229,0 @@ findModule: 2,

Sorry, the diff of this file is too big to display

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