Comparing version 4.0.4 to 4.0.5
@@ -7,2 +7,3 @@ 'use strict'; | ||
init: function() { | ||
this._super.apply(this, arguments); | ||
this.treePaths['vendor'] = 'lib'; | ||
@@ -9,0 +10,0 @@ }, |
@@ -15,2 +15,26 @@ var loader, define, requireModule, require, requirejs; | ||
requirejs = require = requireModule = function(name) { | ||
stats.require++; | ||
return findModule(name, '(require)').module.exports; | ||
}; | ||
function resetStats() { | ||
stats = { | ||
define: 0, | ||
require: 0, | ||
reify: 0, | ||
build: 0, | ||
modules: 0, | ||
exports: 0, | ||
ensureBuild: 0, | ||
resolve: 0, | ||
resolveRelative: 0, | ||
findModule: 0, | ||
}; | ||
requirejs._stats = stats; | ||
} | ||
var stats; | ||
resetStats(); | ||
loader = { | ||
@@ -57,2 +81,3 @@ noConflict: function(aliases) { | ||
function Module(name, deps, callback, alias) { | ||
stats.modules ++; | ||
this.id = uuid++; | ||
@@ -80,2 +105,3 @@ this.name = name; | ||
Module.prototype.exports = function() { | ||
stats.exports ++; | ||
if (this.finalized) { | ||
@@ -104,2 +130,3 @@ return this.module.exports; | ||
Module.prototype.reify = function() { | ||
stats.reify++; | ||
var deps = this.deps; | ||
@@ -137,3 +164,5 @@ var dep; | ||
Module.prototype.build = function() { | ||
stats.ensureBuild++; | ||
if (this.state === FAILED || this.state === LOADED) { return; } | ||
stats.build++; | ||
this.state = FAILED; | ||
@@ -146,2 +175,3 @@ this.reify() | ||
define = function(name, deps, callback) { | ||
stats.define++; | ||
if (arguments.length < 2) { | ||
@@ -180,7 +210,4 @@ unsupportedModule(arguments.length); | ||
requirejs = require = requireModule = function(name) { | ||
return findModule(name, '(require)').module.exports; | ||
}; | ||
function findModule(name, referrer) { | ||
stats.findModule++; | ||
var mod = registry[name] || registry[name + '/index']; | ||
@@ -199,3 +226,5 @@ | ||
function resolve(child, name) { | ||
stats.resolve++; | ||
if (child.charAt(0) !== '.') { return child; } | ||
stats.resolveRelative++; | ||
@@ -233,2 +262,3 @@ var parts = child.split('/'); | ||
requirejs.clear = function() { | ||
resetStats(); | ||
requirejs.entries = requirejs._eak_seen = registry = {}; | ||
@@ -235,0 +265,0 @@ seen = {}; |
{ | ||
"name": "loader.js", | ||
"version": "4.0.4", | ||
"version": "4.0.5", | ||
"description": "loader.js =========", | ||
@@ -11,3 +11,3 @@ "main": "lib/loader/loader.js", | ||
"devDependencies": { | ||
"ara": "0.0.2", | ||
"ara": "0.0.3", | ||
"ora": "^0.2.1", | ||
@@ -14,0 +14,0 @@ "promise-map-series": "^0.2.2", |
@@ -30,3 +30,3 @@ loader.js [![Build Status](https://travis-ci.org/ember-cli/loader.js.png?branch=master)](https://travis-ci.org/ember-cli/loader.js) | ||
``` | ||
```js | ||
loader.wrapModules = function(name, callback) { | ||
@@ -46,3 +46,3 @@ if (shouldTransform(name) { | ||
You may run them with: | ||
```bash | ||
```sh | ||
npm test | ||
@@ -52,3 +52,3 @@ ``` | ||
You can also launch testem development mode with: | ||
```bash | ||
```sh | ||
npm run test:dev | ||
@@ -55,0 +55,0 @@ ``` |
547
tests/all.js
@@ -70,2 +70,15 @@ /*globals newDefine:false, newLoader:false, newRequire:false*/ | ||
deepEqual(require._stats, { | ||
build: 0, | ||
define: 1, | ||
ensureBuild: 0, | ||
exports: 0, | ||
findModule: 0, | ||
modules: 1, | ||
reify: 0, | ||
require: 0, | ||
resolve: 0, | ||
resolveRelative: 0 | ||
}); | ||
var foo = require('foo'); | ||
@@ -76,2 +89,15 @@ equal(foo, undefined); | ||
deepEqual(require._stats, { | ||
build: 1, | ||
define: 1, | ||
ensureBuild: 1, | ||
exports: 1, | ||
findModule: 1, | ||
modules: 1, | ||
reify: 1, | ||
require: 1, | ||
resolve: 0, | ||
resolveRelative: 0 | ||
}); | ||
var fooAgain = require('foo'); | ||
@@ -81,2 +107,15 @@ equal(fooAgain, undefined); | ||
deepEqual(require._stats, { | ||
build: 1, | ||
define: 1, | ||
ensureBuild: 2, | ||
exports: 1, | ||
findModule: 2, | ||
modules: 1, | ||
reify: 1, | ||
require: 2, | ||
resolve: 0, | ||
resolveRelative: 0 | ||
}); | ||
deepEqual(keys(requirejs.entries), ['foo']); | ||
@@ -94,2 +133,16 @@ }); | ||
var foo = require('foo'); | ||
deepEqual(require._stats, { | ||
build: 1, | ||
define: 1, | ||
ensureBuild: 1, | ||
exports: 1, | ||
findModule: 1, | ||
modules: 1, | ||
reify: 1, | ||
require: 1, | ||
resolve: 0, | ||
resolveRelative: 0 | ||
}); | ||
equal(foo, undefined); | ||
@@ -108,2 +161,15 @@ equal(fooCalled, 1); | ||
deepEqual(require._stats, { | ||
build: 0, | ||
define: 1, | ||
ensureBuild: 0, | ||
exports: 0, | ||
findModule: 0, | ||
modules: 1, | ||
reify: 0, | ||
require: 0, | ||
resolve: 0, | ||
resolveRelative: 0 | ||
}); | ||
define('bar', [], function() { | ||
@@ -113,2 +179,15 @@ | ||
deepEqual(require._stats, { | ||
build: 0, | ||
define: 2, | ||
ensureBuild: 0, | ||
exports: 0, | ||
findModule: 0, | ||
modules: 2, | ||
reify: 0, | ||
require: 0, | ||
resolve: 0, | ||
resolveRelative: 0 | ||
}); | ||
deepEqual(keys(requirejs.entries), ['foo', 'bar']); | ||
@@ -119,3 +198,4 @@ }); | ||
test('simple import/export', function() { | ||
expect(2); | ||
expect(4); | ||
define('foo', ['bar'], function(bar) { | ||
@@ -133,8 +213,34 @@ equal(bar.baz, 'baz'); | ||
deepEqual(require._stats, { | ||
build: 0, | ||
define: 2, | ||
ensureBuild: 0, | ||
exports: 0, | ||
findModule: 0, | ||
modules: 2, | ||
reify: 0, | ||
require: 0, | ||
resolve: 0, | ||
resolveRelative: 0 | ||
}); | ||
equal(require('foo'), 'baz'); | ||
deepEqual(require._stats, { | ||
build: 2, | ||
define: 2, | ||
ensureBuild: 2, | ||
exports: 2, | ||
findModule: 2, | ||
modules: 2, | ||
reify: 2, | ||
require: 1, | ||
resolve: 1, | ||
resolveRelative: 0 | ||
}); | ||
}); | ||
test('simple import/export with `exports`', function() { | ||
expect(4); | ||
test('simple import/export with `exports`', function() { | ||
expect(2); | ||
define('foo', ['bar', 'exports'], function(bar, __exports__) { | ||
@@ -150,7 +256,33 @@ equal(bar.baz, 'baz'); | ||
deepEqual(require._stats, { | ||
build: 0, | ||
define: 2, | ||
ensureBuild: 0, | ||
exports: 0, | ||
findModule: 0, | ||
modules: 2, | ||
reify: 0, | ||
require: 0, | ||
resolve: 0, | ||
resolveRelative: 0 | ||
}); | ||
equal(require('foo').baz, 'baz'); | ||
deepEqual(require._stats, { | ||
build: 2, | ||
define: 2, | ||
ensureBuild: 2, | ||
exports: 2, | ||
findModule: 2, | ||
modules: 2, | ||
reify: 2, | ||
require: 1, | ||
resolve: 1, | ||
resolveRelative: 0 | ||
}); | ||
}); | ||
test('relative import/export', function() { | ||
expect(2); | ||
expect(4); | ||
define('foo/a', ['./b'], function(bar) { | ||
@@ -168,7 +300,33 @@ equal(bar.baz, 'baz'); | ||
deepEqual(require._stats, { | ||
build: 0, | ||
define: 2, | ||
ensureBuild: 0, | ||
exports: 0, | ||
findModule: 0, | ||
modules: 2, | ||
reify: 0, | ||
require: 0, | ||
resolve: 0, | ||
resolveRelative: 0 | ||
}); | ||
equal(require('foo/a'), 'baz'); | ||
deepEqual(require._stats, { | ||
build: 2, | ||
define: 2, | ||
ensureBuild: 2, | ||
exports: 2, | ||
findModule: 2, | ||
modules: 2, | ||
reify: 2, | ||
require: 1, | ||
resolve: 1, | ||
resolveRelative: 1 | ||
}); | ||
}); | ||
test('deep nested relative import/export', function() { | ||
expect(2); | ||
expect(4); | ||
@@ -187,3 +345,29 @@ define('foo/a/b/c', ['../../b/b/c'], function(bar) { | ||
deepEqual(require._stats, { | ||
build: 0, | ||
define: 2, | ||
ensureBuild: 0, | ||
exports: 0, | ||
findModule: 0, | ||
modules: 2, | ||
reify: 0, | ||
require: 0, | ||
resolve: 0, | ||
resolveRelative: 0 | ||
}); | ||
equal(require('foo/a/b/c'), 'baz'); | ||
deepEqual(require._stats, { | ||
build: 2, | ||
define: 2, | ||
ensureBuild: 2, | ||
exports: 2, | ||
findModule: 2, | ||
modules: 2, | ||
reify: 2, | ||
require: 1, | ||
resolve: 1, | ||
resolveRelative: 1 | ||
}); | ||
}); | ||
@@ -211,3 +395,3 @@ | ||
test('top-level relative import/export', function() { | ||
expect(2); | ||
expect(3); | ||
@@ -227,2 +411,15 @@ define('foo', ['./bar'], function(bar) { | ||
equal(require('foo'), 'baz'); | ||
deepEqual(require._stats, { | ||
build: 2, | ||
define: 2, | ||
ensureBuild: 2, | ||
exports: 2, | ||
findModule: 2, | ||
modules: 2, | ||
reify: 2, | ||
require: 1, | ||
resolve: 1, | ||
resolveRelative: 1 | ||
}); | ||
}); | ||
@@ -246,2 +443,15 @@ | ||
deepEqual(require._stats, { | ||
build: 2, | ||
define: 2, | ||
ensureBuild: 4, | ||
exports: 2, | ||
findModule: 4, | ||
modules: 2, | ||
reify: 2, | ||
require: 2, | ||
resolve: 2, | ||
resolveRelative: 0 | ||
}); | ||
ok(foo.quz()); | ||
@@ -267,2 +477,15 @@ ok(bar.baz()); | ||
deepEqual(require._stats, { | ||
build: 2, | ||
define: 2, | ||
ensureBuild: 2, | ||
exports: 2, | ||
findModule: 2, | ||
modules: 2, | ||
reify: 2, | ||
require: 2, | ||
resolve: 1, | ||
resolveRelative: 1 | ||
}); | ||
equal(foo.bar, 'bar'); | ||
@@ -289,2 +512,15 @@ }); | ||
deepEqual(require._stats, { | ||
build: 1, | ||
define: 1, | ||
ensureBuild: 1, | ||
exports: 1, | ||
findModule: 1, | ||
modules: 1, | ||
reify: 1, | ||
require: 1, | ||
resolve: 0, | ||
resolveRelative: 0 | ||
}); | ||
equal(foo.bar, 'bar'); | ||
@@ -302,2 +538,15 @@ }); | ||
deepEqual(require._stats, { | ||
build: 1, | ||
define: 1, | ||
ensureBuild: 1, | ||
exports: 1, | ||
findModule: 1, | ||
modules: 1, | ||
reify: 1, | ||
require: 1, | ||
resolve: 0, | ||
resolveRelative: 0 | ||
}); | ||
equal(foo.bar, 'bar'); | ||
@@ -318,2 +567,15 @@ }); | ||
equal(foo.bar, 'bar'); | ||
deepEqual(require._stats, { | ||
build: 1, | ||
define: 1, | ||
ensureBuild: 1, | ||
exports: 1, | ||
findModule: 1, | ||
modules: 1, | ||
reify: 1, | ||
require: 1, | ||
resolve: 0, | ||
resolveRelative: 0 | ||
}); | ||
}); | ||
@@ -330,2 +592,15 @@ | ||
equal(require('foo'), theFunction); | ||
deepEqual(require._stats, { | ||
build: 1, | ||
define: 1, | ||
ensureBuild: 2, | ||
exports: 1, | ||
findModule: 2, | ||
modules: 1, | ||
reify: 1, | ||
require: 2, | ||
resolve: 0, | ||
resolveRelative: 0 | ||
}); | ||
}); | ||
@@ -402,2 +677,15 @@ | ||
equal(require('foo/a'), 'c-content'); | ||
deepEqual(require._stats, { | ||
build: 3, | ||
define: 3, | ||
ensureBuild: 3, | ||
exports: 3, | ||
findModule: 3, | ||
modules: 3, | ||
reify: 3, | ||
require: 3, | ||
resolve: 2, | ||
resolveRelative: 2, | ||
}); | ||
}); | ||
@@ -417,2 +705,15 @@ | ||
deepEqual(require('foo'), require('foo/index')); | ||
deepEqual(require._stats, { | ||
build: 1, | ||
define: 3, | ||
ensureBuild: 2, | ||
exports: 1, | ||
findModule: 2, | ||
modules: 3, | ||
reify: 1, | ||
require: 2, | ||
resolve: 0, | ||
resolveRelative: 0, | ||
}); | ||
}); | ||
@@ -430,2 +731,15 @@ | ||
deepEqual(require('foo'), require('foo/index')); | ||
deepEqual(require._stats, { | ||
build: 1, | ||
define: 2, | ||
ensureBuild: 2, | ||
exports: 1, | ||
findModule: 2, | ||
modules: 2, | ||
reify: 1, | ||
require: 2, | ||
resolve: 0, | ||
resolveRelative: 0, | ||
}); | ||
}); | ||
@@ -445,2 +759,15 @@ | ||
equal(require('bar'), 'I AM bar with: I AM foo/index'); | ||
deepEqual(require._stats, { | ||
build: 2, | ||
define: 2, | ||
ensureBuild: 4, | ||
exports: 2, | ||
findModule: 4, | ||
modules: 2, | ||
reify: 2, | ||
require: 3, | ||
resolve: 1, | ||
resolveRelative: 0, | ||
}); | ||
}); | ||
@@ -464,2 +791,15 @@ | ||
equal(require('bar'), 'I AM bar with: I AM foo'); | ||
deepEqual(require._stats, { | ||
build: 3, | ||
define: 3, | ||
ensureBuild: 4, | ||
exports: 3, | ||
findModule: 4, | ||
modules: 3, | ||
reify: 3, | ||
require: 3, | ||
resolve: 1, | ||
resolveRelative: 0, | ||
}); | ||
}); | ||
@@ -485,2 +825,15 @@ | ||
equal(counter, 2); | ||
deepEqual(require._stats, { | ||
build: 2, | ||
define: 1, | ||
ensureBuild: 5, | ||
exports: 2, | ||
findModule: 5, | ||
modules: 1, | ||
reify: 2, | ||
require: 4, | ||
resolve: 0, | ||
resolveRelative: 0, | ||
}); | ||
}); | ||
@@ -502,2 +855,15 @@ | ||
equal(require('bar'), 'I AM bar with: I AM foo/index'); | ||
deepEqual(require._stats, { | ||
build: 2, | ||
define: 3, | ||
ensureBuild: 4, | ||
exports: 2, | ||
findModule: 4, | ||
modules: 3, | ||
reify: 2, | ||
require: 3, | ||
resolve: 1, | ||
resolveRelative: 0, | ||
}); | ||
}); | ||
@@ -523,2 +889,15 @@ | ||
equal(require('bar'), 'I AM bar with: I AM foo/index'); | ||
deepEqual(require._stats, { | ||
build: 2, | ||
define: 4, | ||
ensureBuild: 4, | ||
exports: 2, | ||
findModule: 4, | ||
modules: 4, | ||
reify: 2, | ||
require: 3, | ||
resolve: 1, | ||
resolveRelative: 0, | ||
}); | ||
}); | ||
@@ -544,2 +923,15 @@ | ||
equal(require('bar'), 'I AM bar with: I AM foo/index'); | ||
deepEqual(require._stats, { | ||
build: 2, | ||
define: 4, | ||
ensureBuild: 4, | ||
exports: 2, | ||
findModule: 4, | ||
modules: 4, | ||
reify: 2, | ||
require: 3, | ||
resolve: 1, | ||
resolveRelative: 0, | ||
}); | ||
}); | ||
@@ -561,2 +953,15 @@ | ||
equal(count, 1, 'second require should use existing instance'); | ||
deepEqual(require._stats, { | ||
build: 1, | ||
define: 2, | ||
ensureBuild: 2, | ||
exports: 1, | ||
findModule: 2, | ||
modules: 2, | ||
reify: 1, | ||
require: 2, | ||
resolve: 0, | ||
resolveRelative: 0, | ||
}); | ||
}); | ||
@@ -588,2 +993,15 @@ | ||
equal(count, 3); | ||
deepEqual(require._stats, { | ||
build: 3, | ||
define: 2, | ||
ensureBuild: 6, | ||
exports: 3, | ||
findModule: 6, | ||
modules: 2, | ||
reify: 3, | ||
require: 4, | ||
resolve: 0, | ||
resolveRelative: 0, | ||
}); | ||
}); | ||
@@ -603,2 +1021,15 @@ | ||
equal(require('quz'), 'I AM BAR'); | ||
deepEqual(require._stats, { | ||
build: 2, | ||
define: 3, | ||
ensureBuild: 2, | ||
exports: 2, | ||
findModule: 2, | ||
modules: 3, | ||
reify: 2, | ||
require: 1, | ||
resolve: 1, | ||
resolveRelative: 0, | ||
}); | ||
}); | ||
@@ -615,2 +1046,15 @@ | ||
equal(require('quz'), 'I AM BAR'); | ||
deepEqual(require._stats, { | ||
build: 1, | ||
define: 3, | ||
ensureBuild: 1, | ||
exports: 1, | ||
findModule: 1, | ||
modules: 3, | ||
reify: 1, | ||
require: 1, | ||
resolve: 0, | ||
resolveRelative: 0, | ||
}); | ||
}); | ||
@@ -629,2 +1073,15 @@ | ||
equal(require('bozo'), 'I AM BAR'); | ||
deepEqual(require._stats, { | ||
build: 1, | ||
define: 5, | ||
ensureBuild: 1, | ||
exports: 1, | ||
findModule: 1, | ||
modules: 5, | ||
reify: 1, | ||
require: 1, | ||
resolve: 0, | ||
resolveRelative: 0, | ||
}); | ||
}); | ||
@@ -653,2 +1110,15 @@ | ||
equal(require('bozo'), 'I AM BAR2'); | ||
deepEqual(require._stats, { | ||
build: 2, | ||
define: 8, | ||
ensureBuild: 2, | ||
exports: 2, | ||
findModule: 2, | ||
modules: 8, | ||
reify: 2, | ||
require: 2, | ||
resolve: 0, | ||
resolveRelative: 0, | ||
}); | ||
}); | ||
@@ -676,2 +1146,15 @@ | ||
equal(counter, 2); | ||
deepEqual(require._stats, { | ||
build: 2, | ||
define: 3, | ||
ensureBuild: 4, | ||
exports: 2, | ||
findModule: 4, | ||
modules: 3, | ||
reify: 2, | ||
require: 3, | ||
resolve: 0, | ||
resolveRelative: 0, | ||
}); | ||
}); | ||
@@ -694,2 +1177,15 @@ | ||
equal(require('bar'), 'I AM foo/index: I AM baz'); | ||
deepEqual(require._stats, { | ||
build: 2, | ||
define: 4, | ||
ensureBuild: 4, | ||
exports: 2, | ||
findModule: 4, | ||
modules: 4, | ||
reify: 2, | ||
require: 3, | ||
resolve: 1, | ||
resolveRelative: 1, | ||
}); | ||
}); | ||
@@ -711,2 +1207,15 @@ | ||
equal(annotatorCalled, 1); | ||
deepEqual(require._stats, { | ||
build: 1, | ||
define: 1, | ||
ensureBuild: 1, | ||
exports: 1, | ||
findModule: 1, | ||
modules: 1, | ||
reify: 1, | ||
require: 1, | ||
resolve: 0, | ||
resolveRelative: 0, | ||
}); | ||
}); | ||
@@ -724,2 +1233,15 @@ | ||
equal(require('foo'), 'I AM baz'); | ||
deepEqual(require._stats, { | ||
build: 2, | ||
define: 2, | ||
ensureBuild: 2, | ||
exports: 2, | ||
findModule: 2, | ||
modules: 2, | ||
reify: 2, | ||
require: 2, | ||
resolve: 1, | ||
resolveRelative: 1, | ||
}); | ||
}); | ||
@@ -739,2 +1261,15 @@ | ||
equal(require('foo'), 'I AM baz'); | ||
deepEqual(require._stats, { | ||
build: 2, | ||
define: 2, | ||
ensureBuild: 2, | ||
exports: 2, | ||
findModule: 2, | ||
modules: 2, | ||
reify: 2, | ||
require: 2, | ||
resolve: 2, | ||
resolveRelative: 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
185036
2412