Comparing version 4.0.9 to 4.0.10
@@ -7,3 +7,3 @@ ### Running benchmarks | ||
```sh | ||
env NODE_ENV=production node runner.js ./benchmarks/scenarios/<name of scenario> | ||
env NODE_ENV=production node ./benchmarks/runner.js ./benchmarks/scenarios/<name of scenario> | ||
``` | ||
@@ -15,3 +15,3 @@ | ||
```sh | ||
env NODE_ENV=production node run-once.js ./benchmarks/scenarios/<name of scenario> | ||
env NODE_ENV=production node ./benchmarks/run-once.js ./benchmarks/scenarios/<name of scenario> | ||
``` | ||
@@ -22,3 +22,3 @@ | ||
```sh | ||
env NODE_ENV=production node --prof run-once.js ./benchmarks/scenarios/<name of scenario> | ||
env NODE_ENV=production node --prof ./benchmarks/run-once.js ./benchmarks/scenarios/<name of scenario> | ||
@@ -25,0 +25,0 @@ # to view the output: |
@@ -8,3 +8,3 @@ 'use strict'; | ||
this._super.init && this._super.init.apply(this, arguments); | ||
this.treePaths['vendor'] = 'lib'; | ||
@@ -11,0 +11,0 @@ }, |
@@ -38,2 +38,3 @@ var loader, define, requireModule, require, requirejs; | ||
findModule: 0, | ||
pendingQueueLength: 0 | ||
}; | ||
@@ -44,2 +45,3 @@ requirejs._stats = stats; | ||
var stats; | ||
resetStats(); | ||
@@ -86,3 +88,3 @@ | ||
function Module(name, deps, callback, alias) { | ||
stats.modules ++; | ||
stats.modules++; | ||
this.id = uuid++; | ||
@@ -98,2 +100,3 @@ this.name = name; | ||
this._foundDeps = false; | ||
this.isPending = false; | ||
} | ||
@@ -115,2 +118,3 @@ | ||
this.finalized = true; | ||
this.isPending = false; | ||
@@ -135,2 +139,3 @@ if (loader.wrapModules) { | ||
this._foundDeps = false; | ||
this.isPending = false; | ||
this.module = { exports: {}}; | ||
@@ -155,2 +160,3 @@ }; | ||
this._foundDeps = true; | ||
this.isPending = true; | ||
@@ -232,5 +238,6 @@ var deps = this.deps; | ||
if (pending) { | ||
if (pending && !mod.finalized && !mod.isPending) { | ||
mod.findDeps(pending); | ||
pending.push(mod); | ||
stats.pendingQueueLength++; | ||
} | ||
@@ -237,0 +244,0 @@ return mod; |
{ | ||
"name": "loader.js", | ||
"version": "4.0.9", | ||
"version": "4.0.10", | ||
"description": "loader.js =========", | ||
@@ -5,0 +5,0 @@ "main": "lib/loader/loader.js", |
153
tests/all.js
@@ -79,3 +79,4 @@ /*globals newDefine:false, newLoader:false, newRequire:false*/ | ||
resolve: 0, | ||
resolveRelative: 0 | ||
resolveRelative: 0, | ||
pendingQueueLength: 0 | ||
}); | ||
@@ -97,3 +98,4 @@ | ||
resolve: 0, | ||
resolveRelative: 0 | ||
resolveRelative: 0, | ||
pendingQueueLength: 1 | ||
}); | ||
@@ -114,3 +116,4 @@ | ||
resolve: 0, | ||
resolveRelative: 0 | ||
resolveRelative: 0, | ||
pendingQueueLength: 1 | ||
}); | ||
@@ -140,3 +143,4 @@ | ||
resolve: 0, | ||
resolveRelative: 0 | ||
resolveRelative: 0, | ||
pendingQueueLength: 1 | ||
}); | ||
@@ -166,3 +170,4 @@ | ||
resolve: 0, | ||
resolveRelative: 0 | ||
resolveRelative: 0, | ||
pendingQueueLength: 0 | ||
}); | ||
@@ -183,3 +188,4 @@ | ||
resolve: 0, | ||
resolveRelative: 0 | ||
resolveRelative: 0, | ||
pendingQueueLength: 0 | ||
}); | ||
@@ -215,3 +221,4 @@ | ||
resolve: 0, | ||
resolveRelative: 0 | ||
resolveRelative: 0, | ||
pendingQueueLength: 0 | ||
}); | ||
@@ -230,3 +237,4 @@ | ||
resolve: 1, | ||
resolveRelative: 0 | ||
resolveRelative: 0, | ||
pendingQueueLength: 2 | ||
}); | ||
@@ -257,3 +265,4 @@ }); | ||
resolve: 0, | ||
resolveRelative: 0 | ||
resolveRelative: 0, | ||
pendingQueueLength: 0 | ||
}); | ||
@@ -272,3 +281,4 @@ | ||
resolve: 1, | ||
resolveRelative: 0 | ||
resolveRelative: 0, | ||
pendingQueueLength: 2 | ||
}); | ||
@@ -300,3 +310,4 @@ }); | ||
resolve: 0, | ||
resolveRelative: 0 | ||
resolveRelative: 0, | ||
pendingQueueLength: 0 | ||
}); | ||
@@ -315,3 +326,4 @@ | ||
resolve: 1, | ||
resolveRelative: 1 | ||
resolveRelative: 1, | ||
pendingQueueLength: 2 | ||
}); | ||
@@ -344,3 +356,4 @@ }); | ||
resolve: 0, | ||
resolveRelative: 0 | ||
resolveRelative: 0, | ||
pendingQueueLength: 0 | ||
}); | ||
@@ -359,3 +372,4 @@ | ||
resolve: 1, | ||
resolveRelative: 1 | ||
resolveRelative: 1, | ||
pendingQueueLength: 2 | ||
}); | ||
@@ -409,3 +423,4 @@ }); | ||
resolve: 1, | ||
resolveRelative: 1 | ||
resolveRelative: 1, | ||
pendingQueueLength: 2 | ||
}); | ||
@@ -439,3 +454,4 @@ }); | ||
resolve: 2, | ||
resolveRelative: 0 | ||
resolveRelative: 0, | ||
pendingQueueLength: 2 | ||
}); | ||
@@ -450,2 +466,72 @@ | ||
test('already evaluated modules are not pushed into the queue', function() { | ||
define('foo', ['bar', 'exports'], function(bar, __exports__) { | ||
__exports__.quz = function() { | ||
return bar.baz; | ||
}; | ||
}); | ||
define('bar', ['foo', 'exports'], function(foo, __exports__) { | ||
__exports__.baz = function() { | ||
return foo.quz; | ||
}; | ||
}); | ||
var bar = require('bar'); | ||
deepEqual(require._stats, { | ||
findDeps: 2, | ||
define: 2, | ||
exports: 2, | ||
findModule: 3, | ||
modules: 2, | ||
reify: 2, | ||
require: 1, | ||
resolve: 2, | ||
resolveRelative: 0, | ||
pendingQueueLength: 2 | ||
}); | ||
var foo = require('foo'); | ||
deepEqual(require._stats, { | ||
findDeps: 2, | ||
define: 2, | ||
exports: 2, | ||
findModule: 4, | ||
modules: 2, | ||
reify: 2, | ||
require: 2, | ||
resolve: 2, | ||
resolveRelative: 0, | ||
pendingQueueLength: 2 | ||
}); | ||
}); | ||
test('same pending modules should not be pushed to the queue more than once', function() { | ||
define('foo', ['bar', 'exports'], function(bar, __exports__) { | ||
__exports__.quz = function() { | ||
return bar.baz; | ||
}; | ||
}); | ||
define('bar', ['foo', 'exports'], function(foo, __exports__) { | ||
__exports__.baz = function() { | ||
return foo.quz; | ||
}; | ||
}); | ||
var bar = require('bar'); | ||
deepEqual(require._stats, { | ||
findDeps: 2, | ||
define: 2, | ||
exports: 2, | ||
findModule: 3, | ||
modules: 2, | ||
reify: 2, | ||
require: 1, | ||
resolve: 2, | ||
resolveRelative: 0, | ||
pendingQueueLength: 2 | ||
}); | ||
}) | ||
test('basic CJS mode', function() { | ||
@@ -473,3 +559,4 @@ define('a/foo', ['require', 'exports', 'module'], function(require, exports, module) { | ||
resolve: 1, | ||
resolveRelative: 1 | ||
resolveRelative: 1, | ||
pendingQueueLength: 2 | ||
}); | ||
@@ -507,3 +594,4 @@ | ||
resolve: 0, | ||
resolveRelative: 0 | ||
resolveRelative: 0, | ||
pendingQueueLength: 1 | ||
}); | ||
@@ -532,3 +620,4 @@ | ||
resolve: 0, | ||
resolveRelative: 0 | ||
resolveRelative: 0, | ||
pendingQueueLength: 1 | ||
}); | ||
@@ -561,3 +650,4 @@ | ||
resolve: 0, | ||
resolveRelative: 0 | ||
resolveRelative: 0, | ||
pendingQueueLength: 1 | ||
}); | ||
@@ -585,3 +675,4 @@ }); | ||
resolve: 0, | ||
resolveRelative: 0 | ||
resolveRelative: 0, | ||
pendingQueueLength: 1 | ||
}); | ||
@@ -670,2 +761,3 @@ }); | ||
resolveRelative: 2, | ||
pendingQueueLength: 3 | ||
}); | ||
@@ -697,2 +789,3 @@ }); | ||
resolveRelative: 0, | ||
pendingQueueLength: 1 | ||
}); | ||
@@ -722,2 +815,3 @@ }); | ||
resolveRelative: 0, | ||
pendingQueueLength: 1 | ||
}); | ||
@@ -749,2 +843,3 @@ }); | ||
resolveRelative: 0, | ||
pendingQueueLength: 2 | ||
}); | ||
@@ -780,2 +875,3 @@ }); | ||
resolveRelative: 0, | ||
pendingQueueLength: 3 | ||
}); | ||
@@ -813,2 +909,3 @@ }); | ||
resolveRelative: 0, | ||
pendingQueueLength: 2 | ||
}); | ||
@@ -842,2 +939,3 @@ }); | ||
resolveRelative: 0, | ||
pendingQueueLength: 2 | ||
}); | ||
@@ -875,2 +973,3 @@ }); | ||
resolveRelative: 0, | ||
pendingQueueLength: 2 | ||
}); | ||
@@ -908,2 +1007,3 @@ }); | ||
resolveRelative: 0, | ||
pendingQueueLength: 2 | ||
}); | ||
@@ -937,2 +1037,3 @@ }); | ||
resolveRelative: 0, | ||
pendingQueueLength: 1 | ||
}); | ||
@@ -976,2 +1077,3 @@ }); | ||
resolveRelative: 0, | ||
pendingQueueLength: 3 | ||
}); | ||
@@ -1003,2 +1105,3 @@ }); | ||
resolveRelative: 0, | ||
pendingQueueLength: 2 | ||
}); | ||
@@ -1027,2 +1130,3 @@ }); | ||
resolveRelative: 0, | ||
pendingQueueLength: 1 | ||
}); | ||
@@ -1053,2 +1157,3 @@ }); | ||
resolveRelative: 0, | ||
pendingQueueLength: 1 | ||
}); | ||
@@ -1089,2 +1194,3 @@ }); | ||
resolveRelative: 0, | ||
pendingQueueLength: 2 | ||
}); | ||
@@ -1124,2 +1230,3 @@ }); | ||
resolveRelative: 0, | ||
pendingQueueLength: 2 | ||
}); | ||
@@ -1154,2 +1261,3 @@ }); | ||
resolveRelative: 1, | ||
pendingQueueLength: 2 | ||
}); | ||
@@ -1183,2 +1291,3 @@ }); | ||
resolveRelative: 0, | ||
pendingQueueLength: 1 | ||
}); | ||
@@ -1208,2 +1317,3 @@ }); | ||
resolveRelative: 1, | ||
pendingQueueLength: 2 | ||
}); | ||
@@ -1235,3 +1345,4 @@ }); | ||
resolveRelative: 2, | ||
pendingQueueLength: 2 | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2372694
57150