Comparing version 3.1.0 to 3.2.0
@@ -70,2 +70,10 @@ var define, requireModule, require, requirejs; | ||
function Alias(path) { | ||
this.name = path; | ||
} | ||
define.alias = function(path) { | ||
return new Alias(path); | ||
}; | ||
function reify(mod, name, seen) { | ||
@@ -108,8 +116,15 @@ var deps = mod.deps; | ||
function missingModule(name) { | ||
throw new Error('Could not find module ' + name); | ||
} | ||
requirejs = require = requireModule = function(name) { | ||
var mod = registry[name]; | ||
if (!mod) { | ||
throw new Error('Could not find module ' + name); | ||
if (mod && mod.callback instanceof Alias) { | ||
mod = registry[mod.callback.name]; | ||
} | ||
if (!mod) { missingModule(name); } | ||
if (mod.state !== FAILED && | ||
@@ -116,0 +131,0 @@ seen.hasOwnProperty(name)) { |
{ | ||
"name": "loader.js", | ||
"version": "3.1.0", | ||
"version": "3.2.0", | ||
"description": "loader.js =========", | ||
@@ -5,0 +5,0 @@ "main": "loader.js", |
@@ -342,3 +342,2 @@ var keys; | ||
define('foo/b', ['module', 'exports', 'require'], function(module, exports, require) { | ||
@@ -354,1 +353,15 @@ module.exports = require('./c'); | ||
}); | ||
test('foo foo/index are the same thing', function() { | ||
define('foo/index', [] , function() { | ||
return { 'default': 'hi' }; | ||
}); | ||
define('foo', [ ], define.alias('foo/index')); | ||
define('bar', ['foo', 'foo/index'] , function(foo, fooIndex) { | ||
deepEqual(foo, fooIndex); | ||
}); | ||
deepEqual(require('foo'), require('foo/index')); | ||
}); |
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
15600
455