mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-11 03:17:49 +00:00
Update vendor/requirejs and fix AMD dependencies to avoid circular dependency issues.
Former-commit-id: 4af19b824f7018d7e3473ba7fe98584b5d6949c5
This commit is contained in:
28
build.js
28
build.js
@@ -832,10 +832,11 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
var getDepPath = function(dep, fromPath) {
|
var getDepPath = function(dep, fromPath) {
|
||||||
fromPath || (fromPath = '');
|
if (dep == 'require') {
|
||||||
|
return dep;
|
||||||
|
}
|
||||||
var toPath = getPath(dep),
|
var toPath = getPath(dep),
|
||||||
relative = path.relative(fromPath, toPath).replace(RegExp(path.sepEscaped, 'g'), sep);
|
relative = path.relative(fromPath || '', toPath).replace(RegExp(path.sepEscaped, 'g'), sep);
|
||||||
|
|
||||||
if (relative.charAt(0) != '.') {
|
if (relative.charAt(0) != '.') {
|
||||||
relative = '.' + (relative ? sep + relative : '');
|
relative = '.' + (relative ? sep + relative : '');
|
||||||
@@ -857,19 +858,26 @@
|
|||||||
|
|
||||||
// create modules for each identifier
|
// create modules for each identifier
|
||||||
identifiers.forEach(function(identifier) {
|
identifiers.forEach(function(identifier) {
|
||||||
var circDeps = circularDependencyMap[identifier];
|
var circDeps = circularDependencyMap[identifier],
|
||||||
|
modulePath = getPath(identifier),
|
||||||
|
iife = [];
|
||||||
|
|
||||||
var deps = _.difference(
|
var deps = _.difference(
|
||||||
getDependencies(identifier, true)
|
getDependencies(identifier, true)
|
||||||
.concat(propDependencyMap[identifier] || [])
|
.concat(propDependencyMap[identifier] || arrayRef)
|
||||||
.concat(varDependencyMap[identifier] || [])
|
.concat(varDependencyMap[identifier] || arrayRef)
|
||||||
, circDeps)
|
, circDeps)
|
||||||
.sort();
|
.sort();
|
||||||
|
|
||||||
var modulePath = getPath(identifier),
|
if (circDeps) {
|
||||||
depArgs = deps.join(', '),
|
deps.unshift('require');
|
||||||
depPaths = '[' + (deps.length ? "'" + getDepPaths(deps, modulePath).join("', '") + "'" : '') + '], ',
|
}
|
||||||
iife = [];
|
var depArgs = deps.join(', ');
|
||||||
|
|
||||||
|
if (circDeps) {
|
||||||
|
push.apply(deps, circDeps);
|
||||||
|
}
|
||||||
|
var depPaths = '[' + (deps.length ? "'" + getDepPaths(deps, modulePath).join("', '") + "'" : '') + '], ';
|
||||||
|
|
||||||
if (isAMD) {
|
if (isAMD) {
|
||||||
iife.push(
|
iife.push(
|
||||||
|
|||||||
@@ -1152,7 +1152,7 @@
|
|||||||
// return the compiled function
|
// return the compiled function
|
||||||
return factory(
|
return factory(
|
||||||
errorClass, errorProto, hasOwnProperty, indicatorObject, isArguments,
|
errorClass, errorProto, hasOwnProperty, indicatorObject, isArguments,
|
||||||
isArray, isString, keys, lodash, objectProto, objectTypes, nonEnumProps,
|
isArray, isString, data.useKeys && keys, lodash, objectProto, objectTypes, nonEnumProps,
|
||||||
stringClass, stringProto, toString
|
stringClass, stringProto, toString
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1315,7 +1315,8 @@
|
|||||||
'args': 'object',
|
'args': 'object',
|
||||||
'init': '[]',
|
'init': '[]',
|
||||||
'top': 'if (!(objectTypes[typeof object])) return result',
|
'top': 'if (!(objectTypes[typeof object])) return result',
|
||||||
'loop': 'result.push(index)'
|
'loop': 'result.push(index)',
|
||||||
|
'useKeys': false
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
24
vendor/requirejs/require.js
vendored
24
vendor/requirejs/require.js
vendored
@@ -1,5 +1,5 @@
|
|||||||
/** vim: et:ts=4:sw=4:sts=4
|
/** vim: et:ts=4:sw=4:sts=4
|
||||||
* @license RequireJS 2.1.6 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
|
* @license RequireJS 2.1.8 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
|
||||||
* Available via the MIT or new BSD license.
|
* Available via the MIT or new BSD license.
|
||||||
* see: http://github.com/jrburke/requirejs for details
|
* see: http://github.com/jrburke/requirejs for details
|
||||||
*/
|
*/
|
||||||
@@ -12,7 +12,7 @@ var requirejs, require, define;
|
|||||||
(function (global) {
|
(function (global) {
|
||||||
var req, s, head, baseElement, dataMain, src,
|
var req, s, head, baseElement, dataMain, src,
|
||||||
interactiveScript, currentlyAddingScript, mainScript, subPath,
|
interactiveScript, currentlyAddingScript, mainScript, subPath,
|
||||||
version = '2.1.6',
|
version = '2.1.8',
|
||||||
commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
|
commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
|
||||||
cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
|
cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
|
||||||
jsSuffixRegExp = /\.js$/,
|
jsSuffixRegExp = /\.js$/,
|
||||||
@@ -1794,6 +1794,19 @@ var requirejs, require, define;
|
|||||||
*/
|
*/
|
||||||
req.onError = defaultOnError;
|
req.onError = defaultOnError;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the node for the load command. Only used in browser envs.
|
||||||
|
*/
|
||||||
|
req.createNode = function (config, moduleName, url) {
|
||||||
|
var node = config.xhtml ?
|
||||||
|
document.createElementNS('http://www.w3.org/1999/xhtml', 'html:script') :
|
||||||
|
document.createElement('script');
|
||||||
|
node.type = config.scriptType || 'text/javascript';
|
||||||
|
node.charset = 'utf-8';
|
||||||
|
node.async = true;
|
||||||
|
return node;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does the request to load a module for the browser case.
|
* Does the request to load a module for the browser case.
|
||||||
* Make this a separate function to allow other environments
|
* Make this a separate function to allow other environments
|
||||||
@@ -1808,12 +1821,7 @@ var requirejs, require, define;
|
|||||||
node;
|
node;
|
||||||
if (isBrowser) {
|
if (isBrowser) {
|
||||||
//In the browser so use a script tag
|
//In the browser so use a script tag
|
||||||
node = config.xhtml ?
|
node = req.createNode(config, moduleName, url);
|
||||||
document.createElementNS('http://www.w3.org/1999/xhtml', 'html:script') :
|
|
||||||
document.createElement('script');
|
|
||||||
node.type = config.scriptType || 'text/javascript';
|
|
||||||
node.charset = 'utf-8';
|
|
||||||
node.async = true;
|
|
||||||
|
|
||||||
node.setAttribute('data-requirecontext', context.contextName);
|
node.setAttribute('data-requirecontext', context.contextName);
|
||||||
node.setAttribute('data-requiremodule', moduleName);
|
node.setAttribute('data-requiremodule', moduleName);
|
||||||
|
|||||||
Reference in New Issue
Block a user