mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-11 03:17:49 +00:00
Update requires.
This commit is contained in:
2
vendor/requirejs/LICENSE
vendored
2
vendor/requirejs/LICENSE
vendored
@@ -37,7 +37,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
MIT License
|
MIT License
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
Copyright (c) 2010-2013, The Dojo Foundation
|
Copyright (c) 2010-2014, The Dojo Foundation
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
88
vendor/requirejs/require.js
vendored
88
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.11 Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved.
|
* @license RequireJS 2.1.14 Copyright (c) 2010-2014, 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.11',
|
version = '2.1.14',
|
||||||
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$/,
|
||||||
@@ -180,7 +180,7 @@ var requirejs, require, define;
|
|||||||
|
|
||||||
if (typeof requirejs !== 'undefined') {
|
if (typeof requirejs !== 'undefined') {
|
||||||
if (isFunction(requirejs)) {
|
if (isFunction(requirejs)) {
|
||||||
//Do not overwrite and existing requirejs instance.
|
//Do not overwrite an existing requirejs instance.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
cfg = requirejs;
|
cfg = requirejs;
|
||||||
@@ -232,21 +232,20 @@ var requirejs, require, define;
|
|||||||
* @param {Array} ary the array of path segments.
|
* @param {Array} ary the array of path segments.
|
||||||
*/
|
*/
|
||||||
function trimDots(ary) {
|
function trimDots(ary) {
|
||||||
var i, part, length = ary.length;
|
var i, part;
|
||||||
for (i = 0; i < length; i++) {
|
for (i = 0; i < ary.length; i++) {
|
||||||
part = ary[i];
|
part = ary[i];
|
||||||
if (part === '.') {
|
if (part === '.') {
|
||||||
ary.splice(i, 1);
|
ary.splice(i, 1);
|
||||||
i -= 1;
|
i -= 1;
|
||||||
} else if (part === '..') {
|
} else if (part === '..') {
|
||||||
if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
|
// If at the start, or previous value is still ..,
|
||||||
//End of the line. Keep at least one non-dot
|
// keep them so that when converted to a path it may
|
||||||
//path segment at the front so it can be mapped
|
// still work when converted to a path, even though
|
||||||
//correctly to disk. Otherwise, there is likely
|
// as an ID it is less than ideal. In larger point
|
||||||
//no path mapping for a path starting with '..'.
|
// releases, may be better to just kick out an error.
|
||||||
//This can still fail, but catches the most reasonable
|
if (i === 0 || (i == 1 && ary[2] === '..') || ary[i - 1] === '..') {
|
||||||
//uses of ..
|
continue;
|
||||||
break;
|
|
||||||
} else if (i > 0) {
|
} else if (i > 0) {
|
||||||
ary.splice(i - 1, 2);
|
ary.splice(i - 1, 2);
|
||||||
i -= 2;
|
i -= 2;
|
||||||
@@ -267,43 +266,37 @@ var requirejs, require, define;
|
|||||||
*/
|
*/
|
||||||
function normalize(name, baseName, applyMap) {
|
function normalize(name, baseName, applyMap) {
|
||||||
var pkgMain, mapValue, nameParts, i, j, nameSegment, lastIndex,
|
var pkgMain, mapValue, nameParts, i, j, nameSegment, lastIndex,
|
||||||
foundMap, foundI, foundStarMap, starI,
|
foundMap, foundI, foundStarMap, starI, normalizedBaseParts,
|
||||||
baseParts = baseName && baseName.split('/'),
|
baseParts = (baseName && baseName.split('/')),
|
||||||
normalizedBaseParts = baseParts,
|
|
||||||
map = config.map,
|
map = config.map,
|
||||||
starMap = map && map['*'];
|
starMap = map && map['*'];
|
||||||
|
|
||||||
//Adjust any relative paths.
|
//Adjust any relative paths.
|
||||||
if (name && name.charAt(0) === '.') {
|
if (name) {
|
||||||
//If have a base name, try to normalize against it,
|
name = name.split('/');
|
||||||
//otherwise, assume it is a top-level require that will
|
lastIndex = name.length - 1;
|
||||||
//be relative to baseUrl in the end.
|
|
||||||
if (baseName) {
|
// If wanting node ID compatibility, strip .js from end
|
||||||
|
// of IDs. Have to do this here, and not in nameToUrl
|
||||||
|
// because node allows either .js or non .js to map
|
||||||
|
// to same file.
|
||||||
|
if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {
|
||||||
|
name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Starts with a '.' so need the baseName
|
||||||
|
if (name[0].charAt(0) === '.' && baseParts) {
|
||||||
//Convert baseName to array, and lop off the last part,
|
//Convert baseName to array, and lop off the last part,
|
||||||
//so that . matches that 'directory' and not name of the baseName's
|
//so that . matches that 'directory' and not name of the baseName's
|
||||||
//module. For instance, baseName of 'one/two/three', maps to
|
//module. For instance, baseName of 'one/two/three', maps to
|
||||||
//'one/two/three.js', but we want the directory, 'one/two' for
|
//'one/two/three.js', but we want the directory, 'one/two' for
|
||||||
//this normalization.
|
//this normalization.
|
||||||
normalizedBaseParts = baseParts.slice(0, baseParts.length - 1);
|
normalizedBaseParts = baseParts.slice(0, baseParts.length - 1);
|
||||||
name = name.split('/');
|
|
||||||
lastIndex = name.length - 1;
|
|
||||||
|
|
||||||
// If wanting node ID compatibility, strip .js from end
|
|
||||||
// of IDs. Have to do this here, and not in nameToUrl
|
|
||||||
// because node allows either .js or non .js to map
|
|
||||||
// to same file.
|
|
||||||
if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {
|
|
||||||
name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');
|
|
||||||
}
|
|
||||||
|
|
||||||
name = normalizedBaseParts.concat(name);
|
name = normalizedBaseParts.concat(name);
|
||||||
trimDots(name);
|
|
||||||
name = name.join('/');
|
|
||||||
} else if (name.indexOf('./') === 0) {
|
|
||||||
// No baseName, so this is ID is resolved relative
|
|
||||||
// to baseUrl, pull off the leading dot.
|
|
||||||
name = name.substring(2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
trimDots(name);
|
||||||
|
name = name.join('/');
|
||||||
}
|
}
|
||||||
|
|
||||||
//Apply map config if available.
|
//Apply map config if available.
|
||||||
@@ -379,7 +372,13 @@ var requirejs, require, define;
|
|||||||
//retry
|
//retry
|
||||||
pathConfig.shift();
|
pathConfig.shift();
|
||||||
context.require.undef(id);
|
context.require.undef(id);
|
||||||
context.require([id]);
|
|
||||||
|
//Custom require that does not do map translation, since
|
||||||
|
//ID is "absolute", already mapped/resolved.
|
||||||
|
context.makeRequire(null, {
|
||||||
|
skipMap: true
|
||||||
|
})([id]);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -445,7 +444,16 @@ var requirejs, require, define;
|
|||||||
return normalize(name, parentName, applyMap);
|
return normalize(name, parentName, applyMap);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
normalizedName = normalize(name, parentName, applyMap);
|
// If nested plugin references, then do not try to
|
||||||
|
// normalize, as it will not normalize correctly. This
|
||||||
|
// places a restriction on resourceIds, and the longer
|
||||||
|
// term solution is not to normalize until plugins are
|
||||||
|
// loaded and all normalizations to allow for async
|
||||||
|
// loading of a loader plugin. But for now, fixes the
|
||||||
|
// common uses. Details in #1131
|
||||||
|
normalizedName = name.indexOf('!') === -1 ?
|
||||||
|
normalize(name, parentName, applyMap) :
|
||||||
|
name;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//A regular module.
|
//A regular module.
|
||||||
|
|||||||
Reference in New Issue
Block a user