mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 04:22:07 +02:00
MDL-56009 lib: update RequireJS to 2.3.2
This commit is contained in:
parent
ddd8dc0d1b
commit
bc963d98d8
@ -1,6 +1,6 @@
|
||||
/** vim: et:ts=4:sw=4:sts=4
|
||||
* @license RequireJS 2.1.22 Copyright jQuery Foundation and other contributors.
|
||||
* Released under MIT license, http://github.com/requirejs/requirejs/LICENSE
|
||||
* @license RequireJS 2.3.2 Copyright jQuery Foundation and other contributors.
|
||||
* Released under MIT license, https://github.com/requirejs/requirejs/blob/master/LICENSE
|
||||
*/
|
||||
//Not using strict: uneven strict support in browsers, #392, and causes
|
||||
//problems with requirejs.exec()/transpiler plugins that may not be strict.
|
||||
@ -8,11 +8,11 @@
|
||||
/*global window, navigator, document, importScripts, setTimeout, opera */
|
||||
|
||||
var requirejs, require, define;
|
||||
(function (global) {
|
||||
(function (global, setTimeout) {
|
||||
var req, s, head, baseElement, dataMain, src,
|
||||
interactiveScript, currentlyAddingScript, mainScript, subPath,
|
||||
version = '2.1.22',
|
||||
commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
|
||||
version = '2.3.2',
|
||||
commentRegExp = /\/\*[\s\S]*?\*\/|([^:"'=]|^)\/\/.*$/mg,
|
||||
cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
|
||||
jsSuffixRegExp = /\.js$/,
|
||||
currDirRegExp = /^\.\//,
|
||||
@ -36,7 +36,7 @@ var requirejs, require, define;
|
||||
useInteractive = false;
|
||||
|
||||
//Could match something like ')//comment', do not lose the prefix to comment.
|
||||
function commentReplace(match, multi, multiText, singlePrefix) {
|
||||
function commentReplace(match, singlePrefix) {
|
||||
return singlePrefix || '';
|
||||
}
|
||||
|
||||
@ -864,10 +864,21 @@ var requirejs, require, define;
|
||||
|
||||
if (this.depCount < 1 && !this.defined) {
|
||||
if (isFunction(factory)) {
|
||||
try {
|
||||
//If there is an error listener, favor passing
|
||||
//to that instead of throwing an error. However,
|
||||
//only do it for define()'d modules. require
|
||||
//errbacks should not be called for failures in
|
||||
//their callbacks (#699). However if a global
|
||||
//onError is set, use that.
|
||||
if ((this.events.error && this.map.isDefine) ||
|
||||
req.onError !== defaultOnError) {
|
||||
try {
|
||||
exports = context.execCb(id, factory, depExports, exports);
|
||||
} catch (e) {
|
||||
err = e;
|
||||
}
|
||||
} else {
|
||||
exports = context.execCb(id, factory, depExports, exports);
|
||||
} catch (e) {
|
||||
err = e;
|
||||
}
|
||||
|
||||
// Favor return value over exports. If node/cjs in play,
|
||||
@ -884,30 +895,12 @@ var requirejs, require, define;
|
||||
}
|
||||
|
||||
if (err) {
|
||||
// If there is an error listener, favor passing
|
||||
// to that instead of throwing an error. However,
|
||||
// only do it for define()'d modules. require
|
||||
// errbacks should not be called for failures in
|
||||
// their callbacks (#699). However if a global
|
||||
// onError is set, use that.
|
||||
if ((this.events.error && this.map.isDefine) ||
|
||||
req.onError !== defaultOnError) {
|
||||
err.requireMap = this.map;
|
||||
err.requireModules = this.map.isDefine ? [this.map.id] : null;
|
||||
err.requireType = this.map.isDefine ? 'define' : 'require';
|
||||
return onError((this.error = err));
|
||||
} else if (typeof console !== 'undefined' &&
|
||||
console.error) {
|
||||
// Log the error for debugging. If promises could be
|
||||
// used, this would be different, but making do.
|
||||
console.error(err);
|
||||
} else {
|
||||
// Do not want to completely lose the error. While this
|
||||
// will mess up processing and lead to similar results
|
||||
// as bug 1440, it at least surfaces the error.
|
||||
req.onError(err);
|
||||
}
|
||||
err.requireMap = this.map;
|
||||
err.requireModules = this.map.isDefine ? [this.map.id] : null;
|
||||
err.requireType = this.map.isDefine ? 'define' : 'require';
|
||||
return onError((this.error = err));
|
||||
}
|
||||
|
||||
} else {
|
||||
//Just a literal value
|
||||
exports = factory;
|
||||
@ -1675,12 +1668,12 @@ var requirejs, require, define;
|
||||
|
||||
//Join the path parts together, then figure out if baseUrl is needed.
|
||||
url = syms.join('/');
|
||||
url += (ext || (/^data\:|\?/.test(url) || skipExt ? '' : '.js'));
|
||||
url += (ext || (/^data\:|^blob\:|\?/.test(url) || skipExt ? '' : '.js'));
|
||||
url = (url.charAt(0) === '/' || url.match(/^[\w\+\.\-]+:/) ? '' : config.baseUrl) + url;
|
||||
}
|
||||
|
||||
return config.urlArgs ? url + config.urlArgs(moduleName, url) :
|
||||
url;
|
||||
return config.urlArgs && !/^blob\:/.test(url) ?
|
||||
url + config.urlArgs(moduleName, url) : url;
|
||||
},
|
||||
|
||||
//Delegates to req.load. Broken out as a separate function to
|
||||
@ -2025,8 +2018,10 @@ var requirejs, require, define;
|
||||
//Preserve dataMain in case it is a path (i.e. contains '?')
|
||||
mainScript = dataMain;
|
||||
|
||||
//Set final baseUrl if there is not already an explicit one.
|
||||
if (!cfg.baseUrl) {
|
||||
//Set final baseUrl if there is not already an explicit one,
|
||||
//but only do so if the data-main value is not a loader plugin
|
||||
//module ID.
|
||||
if (!cfg.baseUrl && mainScript.indexOf('!') === -1) {
|
||||
//Pull off the directory of data-main for use as the
|
||||
//baseUrl.
|
||||
src = mainScript.split('/');
|
||||
@ -2144,4 +2139,4 @@ var requirejs, require, define;
|
||||
|
||||
//Set up with config info.
|
||||
req(cfg);
|
||||
}(this));
|
||||
}(this, (typeof setTimeout === 'undefined' ? undefined : setTimeout)));
|
||||
|
41
lib/requirejs/require.min.js
vendored
41
lib/requirejs/require.min.js
vendored
File diff suppressed because one or more lines are too long
@ -214,7 +214,7 @@
|
||||
<location>requirejs</location>
|
||||
<name>RequireJS</name>
|
||||
<license>MIT</license>
|
||||
<version>2.1.22</version>
|
||||
<version>2.3.2</version>
|
||||
<licenseversion></licenseversion>
|
||||
</library>
|
||||
<library>
|
||||
|
Loading…
x
Reference in New Issue
Block a user