mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 17:47:49 +00:00
Update vendor folder.
Former-commit-id: dde7c53eee254e2f50608e65540893764ab8d9cb
This commit is contained in:
53
vendor/requirejs/require.js
vendored
53
vendor/requirejs/require.js
vendored
@@ -1,5 +1,5 @@
|
||||
/** vim: et:ts=4:sw=4:sts=4
|
||||
* @license RequireJS 2.0.2 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
|
||||
* @license RequireJS 2.0.4 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
|
||||
* Available via the MIT or new BSD license.
|
||||
* see: http://github.com/jrburke/requirejs for details
|
||||
*/
|
||||
@@ -10,9 +10,9 @@ var requirejs, require, define;
|
||||
(function (global) {
|
||||
'use strict';
|
||||
|
||||
var version = '2.0.2',
|
||||
var version = '2.0.4',
|
||||
commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
|
||||
cjsRequireRegExp = /require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
|
||||
cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
|
||||
jsSuffixRegExp = /\.js$/,
|
||||
currDirRegExp = /^\.\//,
|
||||
ostring = Object.prototype.toString,
|
||||
@@ -288,6 +288,7 @@ var requirejs, require, define;
|
||||
*/
|
||||
function normalize(name, baseName, applyMap) {
|
||||
var baseParts = baseName && baseName.split('/'),
|
||||
normalizedBaseParts = baseParts,
|
||||
map = config.map,
|
||||
starMap = map && map['*'],
|
||||
pkgName, pkgConfig, mapValue, nameParts, i, j, nameSegment,
|
||||
@@ -302,17 +303,17 @@ var requirejs, require, define;
|
||||
if (config.pkgs[baseName]) {
|
||||
//If the baseName is a package name, then just treat it as one
|
||||
//name to concat the name with.
|
||||
baseParts = [baseName];
|
||||
normalizedBaseParts = baseParts = [baseName];
|
||||
} else {
|
||||
//Convert baseName to array, and lop off the last part,
|
||||
//so that . matches that 'directory' and not name of the baseName's
|
||||
//module. For instance, baseName of 'one/two/three', maps to
|
||||
//'one/two/three.js', but we want the directory, 'one/two' for
|
||||
//this normalization.
|
||||
baseParts = baseParts.slice(0, baseParts.length - 1);
|
||||
normalizedBaseParts = baseParts.slice(0, baseParts.length - 1);
|
||||
}
|
||||
|
||||
name = baseParts.concat(name.split('/'));
|
||||
name = normalizedBaseParts.concat(name.split('/'));
|
||||
trimDots(name);
|
||||
|
||||
//Some use of packages may use a . path to reference the
|
||||
@@ -450,17 +451,7 @@ var requirejs, require, define;
|
||||
} else {
|
||||
//A regular module.
|
||||
normalizedName = normalize(name, parentName, applyMap);
|
||||
|
||||
//Calculate url for the module, if it has a name.
|
||||
//Use name here since nameToUrl also calls normalize,
|
||||
//and for relative names that are outside the baseUrl
|
||||
//this causes havoc. Was thinking of just removing
|
||||
//parentModuleMap to avoid extra normalization, but
|
||||
//normalize() still does a dot removal because of
|
||||
//issue #142, so just pass in name here and redo
|
||||
//the normalization. Paths outside baseUrl are just
|
||||
//messy to support.
|
||||
url = context.nameToUrl(name, null, parentModuleMap);
|
||||
url = context.nameToUrl(normalizedName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1583,20 +1574,21 @@ var requirejs, require, define;
|
||||
moduleNamePlusExt = moduleNamePlusExt.substring(0, index);
|
||||
}
|
||||
|
||||
return context.nameToUrl(moduleNamePlusExt, ext, relModuleMap);
|
||||
return context.nameToUrl(normalize(moduleNamePlusExt, relModuleMap && relModuleMap.id, true),
|
||||
ext);
|
||||
},
|
||||
|
||||
/**
|
||||
* Converts a module name to a file path. Supports cases where
|
||||
* moduleName may actually be just an URL.
|
||||
* Note that it **does not** call normalize on the moduleName,
|
||||
* it is assumed to have already been normalized. This is an
|
||||
* internal API, not a public one. Use toUrl for the public API.
|
||||
*/
|
||||
nameToUrl: function (moduleName, ext, relModuleMap) {
|
||||
nameToUrl: function (moduleName, ext) {
|
||||
var paths, pkgs, pkg, pkgPath, syms, i, parentModule, url,
|
||||
parentPath;
|
||||
|
||||
//Normalize module name if have a base relative module name to work from.
|
||||
moduleName = normalize(moduleName, relModuleMap && relModuleMap.id, true);
|
||||
|
||||
//If a colon is in the URL, it indicates a protocol is used and it is just
|
||||
//an URL to a file, or if it starts with a slash, contains a query arg (i.e. ?)
|
||||
//or ends with .js, then assume the user meant to use an url and not a module id.
|
||||
@@ -1822,6 +1814,7 @@ var requirejs, require, define;
|
||||
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-requiremodule', moduleName);
|
||||
@@ -1924,21 +1917,21 @@ var requirejs, require, define;
|
||||
//baseUrl, if it is not already set.
|
||||
dataMain = script.getAttribute('data-main');
|
||||
if (dataMain) {
|
||||
|
||||
//Pull off the directory of data-main for use as the
|
||||
//baseUrl.
|
||||
src = dataMain.split('/');
|
||||
mainScript = src.pop();
|
||||
subPath = src.length ? src.join('/') + '/' : './';
|
||||
|
||||
//Set final baseUrl if there is not already an explicit one.
|
||||
if (!cfg.baseUrl) {
|
||||
//Pull off the directory of data-main for use as the
|
||||
//baseUrl.
|
||||
src = dataMain.split('/');
|
||||
mainScript = src.pop();
|
||||
subPath = src.length ? src.join('/') + '/' : './';
|
||||
|
||||
cfg.baseUrl = subPath;
|
||||
dataMain = mainScript;
|
||||
}
|
||||
|
||||
//Strip off any trailing .js since dataMain is now
|
||||
//like a module name.
|
||||
dataMain = mainScript.replace(jsSuffixRegExp, '');
|
||||
dataMain = dataMain.replace(jsSuffixRegExp, '');
|
||||
|
||||
//Put the data-main script in the files to load.
|
||||
cfg.deps = cfg.deps ? cfg.deps.concat(dataMain) : [dataMain];
|
||||
|
||||
Reference in New Issue
Block a user