Update require.js library to the latest version.

pull/42/head
Murtuza Zabuawala 2021-05-04 17:48:13 +05:30 committed by Akshay Joshi
parent 7e79814cb0
commit 98546e1876
4 changed files with 128 additions and 117 deletions

View File

@ -114,7 +114,6 @@
"raf": "^3.4.1", "raf": "^3.4.1",
"react": "^17.0.1", "react": "^17.0.1",
"react-dom": "^17.0.1", "react-dom": "^17.0.1",
"requirejs": "~2.3.6",
"select2": "^4.0.13", "select2": "^4.0.13",
"shim-loader": "^1.0.1", "shim-loader": "^1.0.1",
"slickgrid": "git+https://github.com/6pac/SlickGrid.git#2.3.16", "slickgrid": "git+https://github.com/6pac/SlickGrid.git#2.3.16",

View File

@ -1,16 +1,6 @@
/////////////////////////////////////////////////////////////
//
// pgAdmin 4 - PostgreSQL Tools
//
// Copyright (C) 2013 - 2021, The pgAdmin Development Team
// This software is released under the PostgreSQL Licence
//
//////////////////////////////////////////////////////////////
/** vim: et:ts=4:sw=4:sts=4 /** vim: et:ts=4:sw=4:sts=4
* @license RequireJS 2.1.17 Copyright (c) 2010-2015, The Dojo Foundation All Rights Reserved. * @license RequireJS 2.3.6 Copyright jQuery Foundation and other contributors.
* Available via the MIT or new BSD license. * Released under MIT license, https://github.com/requirejs/requirejs/blob/master/LICENSE
* see: http://github.com/jrburke/requirejs for details
*/ */
//Not using strict: uneven strict support in browsers, #392, and causes //Not using strict: uneven strict support in browsers, #392, and causes
//problems with requirejs.exec()/transpiler plugins that may not be strict. //problems with requirejs.exec()/transpiler plugins that may not be strict.
@ -18,19 +8,17 @@
/*global window, navigator, document, importScripts, setTimeout, opera */ /*global window, navigator, document, importScripts, setTimeout, opera */
var requirejs, require, define; var requirejs, require, define;
(function (global) { (function (global, setTimeout) {
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.17', version = '2.3.6',
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$/,
currDirRegExp = /^\.\//, currDirRegExp = /^\.\//,
op = Object.prototype, op = Object.prototype,
ostring = op.toString, ostring = op.toString,
hasOwn = op.hasOwnProperty, hasOwn = op.hasOwnProperty,
ap = Array.prototype,
apsp = ap.splice,
isBrowser = !!(typeof window !== 'undefined' && typeof navigator !== 'undefined' && window.document), isBrowser = !!(typeof window !== 'undefined' && typeof navigator !== 'undefined' && window.document),
isWebWorker = !isBrowser && typeof importScripts !== 'undefined', isWebWorker = !isBrowser && typeof importScripts !== 'undefined',
//PS3 indicates loaded and complete, but need to wait for complete //PS3 indicates loaded and complete, but need to wait for complete
@ -47,6 +35,11 @@ var requirejs, require, define;
globalDefQueue = [], globalDefQueue = [],
useInteractive = false; useInteractive = false;
//Could match something like ')//comment', do not lose the prefix to comment.
function commentReplace(match, singlePrefix) {
return singlePrefix || '';
}
function isFunction(it) { function isFunction(it) {
return ostring.call(it) === '[object Function]'; return ostring.call(it) === '[object Function]';
} }
@ -172,7 +165,7 @@ var requirejs, require, define;
* @returns {Error} * @returns {Error}
*/ */
function makeError(id, msg, err, requireModules) { function makeError(id, msg, err, requireModules) {
var e = new Error(msg + '\nhttp://requirejs.org/docs/errors.html#' + id); var e = new Error(msg + '\nhttps://requirejs.org/docs/errors.html#' + id);
e.requireType = id; e.requireType = id;
e.requireModules = requireModules; e.requireModules = requireModules;
if (err) { if (err) {
@ -447,10 +440,12 @@ var requirejs, require, define;
//Account for relative paths if there is a base name. //Account for relative paths if there is a base name.
if (name) { if (name) {
if (prefix) { if (prefix) {
if (pluginModule && pluginModule.normalize) { if (isNormalized) {
normalizedName = name;
} else if (pluginModule && pluginModule.normalize) {
//Plugin is loaded, use its normalize method. //Plugin is loaded, use its normalize method.
normalizedName = pluginModule.normalize(name, function (_name) { normalizedName = pluginModule.normalize(name, function (name) {
return normalize(_name, parentName, applyMap); return normalize(name, parentName, applyMap);
}); });
} else { } else {
// If nested plugin references, then do not try to // If nested plugin references, then do not try to
@ -563,11 +558,13 @@ var requirejs, require, define;
function takeGlobalQueue() { function takeGlobalQueue() {
//Push all the globalDefQueue items into the context's defQueue //Push all the globalDefQueue items into the context's defQueue
if (globalDefQueue.length) { if (globalDefQueue.length) {
//Array splice in the values since the context code has a each(globalDefQueue, function(queueItem) {
//local var ref to defQueue, so cannot just reassign the one var id = queueItem[0];
//on context. if (typeof id === 'string') {
apsp.apply(defQueue, context.defQueueMap[id] = true;
[defQueue.length, 0].concat(globalDefQueue)); }
defQueue.push(queueItem);
});
globalDefQueue = []; globalDefQueue = [];
} }
} }
@ -598,7 +595,7 @@ var requirejs, require, define;
id: mod.map.id, id: mod.map.id,
uri: mod.map.url, uri: mod.map.url,
config: function () { config: function () {
return getOwn(config.config, mod.map.id) || {}; return getOwn(config.config, mod.map.id) || {};
}, },
exports: mod.exports || (mod.exports = {}) exports: mod.exports || (mod.exports = {})
}); });
@ -854,7 +851,10 @@ var requirejs, require, define;
factory = this.factory; factory = this.factory;
if (!this.inited) { if (!this.inited) {
this.fetch(); // Only fetch if not already in the defQueue.
if (!hasProp(context.defQueueMap, id)) {
this.fetch();
}
} else if (this.error) { } else if (this.error) {
this.emit('error', this.error); this.emit('error', this.error);
} else if (!this.defining) { } else if (!this.defining) {
@ -914,7 +914,11 @@ var requirejs, require, define;
defined[id] = exports; defined[id] = exports;
if (req.onResourceLoad) { if (req.onResourceLoad) {
req.onResourceLoad(context, this.map, this.depMaps); var resLoadMaps = [];
each(this.depMaps, function (depMap) {
resLoadMaps.push(depMap.normalizedMap || depMap);
});
req.onResourceLoad(context, this.map, resLoadMaps);
} }
} }
@ -962,17 +966,19 @@ var requirejs, require, define;
if (this.map.unnormalized) { if (this.map.unnormalized) {
//Normalize the ID if the plugin allows it. //Normalize the ID if the plugin allows it.
if (plugin.normalize) { if (plugin.normalize) {
name = plugin.normalize(name, function (_name) { name = plugin.normalize(name, function (name) {
return normalize(_name, parentName, true); return normalize(name, parentName, true);
}) || ''; }) || '';
} }
//prefix and name should already be normalized, no need //prefix and name should already be normalized, no need
//for applying map config again either. //for applying map config again either.
normalizedMap = makeModuleMap(map.prefix + '!' + name, normalizedMap = makeModuleMap(map.prefix + '!' + name,
this.map.parentMap); this.map.parentMap,
true);
on(normalizedMap, on(normalizedMap,
'defined', bind(this, function (value) { 'defined', bind(this, function (value) {
this.map.normalizedMap = normalizedMap;
this.init([], function () { return value; }, null, { this.init([], function () { return value; }, null, {
enabled: true, enabled: true,
ignore: true ignore: true
@ -1126,6 +1132,9 @@ var requirejs, require, define;
this.depCount += 1; this.depCount += 1;
on(depMap, 'defined', bind(this, function (depExports) { on(depMap, 'defined', bind(this, function (depExports) {
if (this.undefed) {
return;
}
this.defineDep(i, depExports); this.defineDep(i, depExports);
this.check(); this.check();
})); }));
@ -1242,13 +1251,15 @@ var requirejs, require, define;
while (defQueue.length) { while (defQueue.length) {
args = defQueue.shift(); args = defQueue.shift();
if (args[0] === null) { if (args[0] === null) {
return onError(makeError('mismatch', 'Mismatched anonymous define() module: ' + args[args.length - 1])); return onError(makeError('mismatch', 'Mismatched anonymous define() module: ' +
args[args.length - 1]));
} else { } else {
//args are id, deps, factory. Should be normalized by the //args are id, deps, factory. Should be normalized by the
//define() function. //define() function.
callGetModule(args); callGetModule(args);
} }
} }
context.defQueueMap = {};
} }
context = { context = {
@ -1258,6 +1269,7 @@ var requirejs, require, define;
defined: defined, defined: defined,
urlFetched: urlFetched, urlFetched: urlFetched,
defQueue: defQueue, defQueue: defQueue,
defQueueMap: {},
Module: Module, Module: Module,
makeModuleMap: makeModuleMap, makeModuleMap: makeModuleMap,
nextTick: req.nextTick, nextTick: req.nextTick,
@ -1267,14 +1279,22 @@ var requirejs, require, define;
* Set a configuration for the context. * Set a configuration for the context.
* @param {Object} cfg config object to integrate. * @param {Object} cfg config object to integrate.
*/ */
configure: function (_cfg) { configure: function (cfg) {
//Make sure the baseUrl ends in a slash. //Make sure the baseUrl ends in a slash.
if (_cfg.baseUrl) { if (cfg.baseUrl) {
if (_cfg.baseUrl.charAt(_cfg.baseUrl.length - 1) !== '/') { if (cfg.baseUrl.charAt(cfg.baseUrl.length - 1) !== '/') {
_cfg.baseUrl += '/'; cfg.baseUrl += '/';
} }
} }
// Convert old style urlArgs string to a function.
if (typeof cfg.urlArgs === 'string') {
var urlArgs = cfg.urlArgs;
cfg.urlArgs = function(id, url) {
return (url.indexOf('?') === -1 ? '?' : '&') + urlArgs;
};
}
//Save off the paths since they require special processing, //Save off the paths since they require special processing,
//they are additive. //they are additive.
var shim = config.shim, var shim = config.shim,
@ -1285,7 +1305,7 @@ var requirejs, require, define;
map: true map: true
}; };
eachProp(_cfg, function (value, prop) { eachProp(cfg, function (value, prop) {
if (objs[prop]) { if (objs[prop]) {
if (!config[prop]) { if (!config[prop]) {
config[prop] = {}; config[prop] = {};
@ -1297,8 +1317,8 @@ var requirejs, require, define;
}); });
//Reverse map the bundles //Reverse map the bundles
if (_cfg.bundles) { if (cfg.bundles) {
eachProp(_cfg.bundles, function (value, prop) { eachProp(cfg.bundles, function (value, prop) {
each(value, function (v) { each(value, function (v) {
if (v !== prop) { if (v !== prop) {
bundlesMap[v] = prop; bundlesMap[v] = prop;
@ -1308,8 +1328,8 @@ var requirejs, require, define;
} }
//Merge shim //Merge shim
if (_cfg.shim) { if (cfg.shim) {
eachProp(_cfg.shim, function (value, id) { eachProp(cfg.shim, function (value, id) {
//Normalize the structure //Normalize the structure
if (isArray(value)) { if (isArray(value)) {
value = { value = {
@ -1325,11 +1345,11 @@ var requirejs, require, define;
} }
//Adjust packages if necessary. //Adjust packages if necessary.
if (_cfg.packages) { if (cfg.packages) {
each(_cfg.packages, function (pkgObj) { each(cfg.packages, function (pkgObj) {
var location, name; var location, name;
pkgObj = typeof pkgObj === 'string' ? { name: pkgObj } : pkgObj; pkgObj = typeof pkgObj === 'string' ? {name: pkgObj} : pkgObj;
name = pkgObj.name; name = pkgObj.name;
location = pkgObj.location; location = pkgObj.location;
@ -1356,15 +1376,15 @@ var requirejs, require, define;
//late to modify them, and ignore unnormalized ones //late to modify them, and ignore unnormalized ones
//since they are transient. //since they are transient.
if (!mod.inited && !mod.map.unnormalized) { if (!mod.inited && !mod.map.unnormalized) {
mod.map = makeModuleMap(id); mod.map = makeModuleMap(id, null, true);
} }
}); });
//If a deps array or a config callback is specified, then call //If a deps array or a config callback is specified, then call
//require with those args. This is useful when require is defined as a //require with those args. This is useful when require is defined as a
//config object before require.js is loaded. //config object before require.js is loaded.
if (_cfg.deps || _cfg.callback) { if (cfg.deps || cfg.callback) {
context.require(_cfg.deps || [], _cfg.callback); context.require(cfg.deps || [], cfg.callback);
} }
}, },
@ -1492,6 +1512,7 @@ var requirejs, require, define;
var map = makeModuleMap(id, relMap, true), var map = makeModuleMap(id, relMap, true),
mod = getOwn(registry, id); mod = getOwn(registry, id);
mod.undefed = true;
removeScript(id); removeScript(id);
delete defined[id]; delete defined[id];
@ -1502,10 +1523,11 @@ var requirejs, require, define;
//in array so that the splices do not //in array so that the splices do not
//mess up the iteration. //mess up the iteration.
eachReverse(defQueue, function(args, i) { eachReverse(defQueue, function(args, i) {
if(args[0] === id) { if (args[0] === id) {
defQueue.splice(i, 1); defQueue.splice(i, 1);
} }
}); });
delete context.defQueueMap[id];
if (mod) { if (mod) {
//Hold on to listeners in case the //Hold on to listeners in case the
@ -1567,6 +1589,7 @@ var requirejs, require, define;
callGetModule(args); callGetModule(args);
} }
context.defQueueMap = {};
//Do this after the cycle of callGetModule in case the result //Do this after the cycle of callGetModule in case the result
//of those calls/init calls changes the registry. //of those calls/init calls changes the registry.
@ -1648,13 +1671,12 @@ var requirejs, require, define;
//Join the path parts together, then figure out if baseUrl is needed. //Join the path parts together, then figure out if baseUrl is needed.
url = syms.join('/'); 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; url = (url.charAt(0) === '/' || url.match(/^[\w\+\.\-]+:/) ? '' : config.baseUrl) + url;
} }
return config.urlArgs ? url + return config.urlArgs && !/^blob\:/.test(url) ?
((url.indexOf('?') === -1 ? '?' : '&') + url + config.urlArgs(moduleName, url) : url;
config.urlArgs) : url;
}, },
//Delegates to req.load. Broken out as a separate function to //Delegates to req.load. Broken out as a separate function to
@ -1702,7 +1724,21 @@ var requirejs, require, define;
onScriptError: function (evt) { onScriptError: function (evt) {
var data = getScriptData(evt); var data = getScriptData(evt);
if (!hasPathFallback(data.id)) { if (!hasPathFallback(data.id)) {
return onError(makeError('scripterror', 'Script error for: ' + data.id, evt, [data.id])); var parents = [];
eachProp(registry, function(value, key) {
if (key.indexOf('_@r') !== 0) {
each(value.depMaps, function(depMap) {
if (depMap.id === data.id) {
parents.push(key);
return true;
}
});
}
});
return onError(makeError('scripterror', 'Script error for "' + data.id +
(parents.length ?
'", needed by: ' + parents.join(', ') :
'"'), evt, [data.id]));
} }
} }
}; };
@ -1876,11 +1912,11 @@ var requirejs, require, define;
if (node.attachEvent && if (node.attachEvent &&
//Check if node.attachEvent is artificially added by custom script or //Check if node.attachEvent is artificially added by custom script or
//natively supported by browser //natively supported by browser
//read https://github.com/jrburke/requirejs/issues/187 //read https://github.com/requirejs/requirejs/issues/187
//if we can NOT find [native code] then it must NOT natively supported. //if we can NOT find [native code] then it must NOT natively supported.
//in IE8, node.attachEvent does not have toString() //in IE8, node.attachEvent does not have toString()
//Note the test for "[native code" with no closing brace, see: //Note the test for "[native code" with no closing brace, see:
//https://github.com/jrburke/requirejs/issues/273 //https://github.com/requirejs/requirejs/issues/273
!(node.attachEvent.toString && node.attachEvent.toString().indexOf('[native code') < 0) && !(node.attachEvent.toString && node.attachEvent.toString().indexOf('[native code') < 0) &&
!isOpera) { !isOpera) {
//Probably IE. IE (at least 6-8) do not fire //Probably IE. IE (at least 6-8) do not fire
@ -1908,6 +1944,12 @@ var requirejs, require, define;
} }
node.src = url; node.src = url;
//Calling onNodeCreated after all properties on the node have been
//set, but before it is placed in the DOM.
if (config.onNodeCreated) {
config.onNodeCreated(node, config, moduleName, url);
}
//For some cache cases in IE 6-8, the script executes before the end //For some cache cases in IE 6-8, the script executes before the end
//of the appendChild execution, so to tie an anonymous define //of the appendChild execution, so to tie an anonymous define
//call to the module name (which is stored on the node), hold on //call to the module name (which is stored on the node), hold on
@ -1926,9 +1968,14 @@ var requirejs, require, define;
//In a web worker, use importScripts. This is not a very //In a web worker, use importScripts. This is not a very
//efficient use of importScripts, importScripts will block until //efficient use of importScripts, importScripts will block until
//its script is downloaded and evaluated. However, if web workers //its script is downloaded and evaluated. However, if web workers
//are in play, the expectation that a build has been done so that //are in play, the expectation is that a build has been done so
//only one script needs to be loaded anyway. This may need to be //that only one script needs to be loaded anyway. This may need
//reevaluated if other use cases become common. //to be reevaluated if other use cases become common.
// Post a task to the event loop to work around a bug in WebKit
// where the worker gets garbage-collected after calling
// importScripts(): https://webkit.org/b/153317
setTimeout(function() {}, 0);
importScripts(url); importScripts(url);
//Account for anonymous modules //Account for anonymous modules
@ -1974,8 +2021,10 @@ var requirejs, require, define;
//Preserve dataMain in case it is a path (i.e. contains '?') //Preserve dataMain in case it is a path (i.e. contains '?')
mainScript = dataMain; mainScript = dataMain;
//Set final baseUrl if there is not already an explicit one. //Set final baseUrl if there is not already an explicit one,
if (!cfg.baseUrl) { //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 //Pull off the directory of data-main for use as the
//baseUrl. //baseUrl.
src = mainScript.split('/'); src = mainScript.split('/');
@ -1989,7 +2038,7 @@ var requirejs, require, define;
//like a module name. //like a module name.
mainScript = mainScript.replace(jsSuffixRegExp, ''); mainScript = mainScript.replace(jsSuffixRegExp, '');
//If mainScript is still a path, fall back to dataMain //If mainScript is still a path, fall back to dataMain
if (req.jsExtRegExp.test(mainScript)) { if (req.jsExtRegExp.test(mainScript)) {
mainScript = dataMain; mainScript = dataMain;
} }
@ -2036,7 +2085,7 @@ var requirejs, require, define;
if (callback.length) { if (callback.length) {
callback callback
.toString() .toString()
.replace(commentRegExp, '') .replace(commentRegExp, commentReplace)
.replace(cjsRequireRegExp, function (match, dep) { .replace(cjsRequireRegExp, function (match, dep) {
deps.push(dep); deps.push(dep);
}); });
@ -2068,14 +2117,18 @@ var requirejs, require, define;
//where the module name is not known until the script onload event //where the module name is not known until the script onload event
//occurs. If no context, use the global queue, and get it processed //occurs. If no context, use the global queue, and get it processed
//in the onscript load callback. //in the onscript load callback.
(context ? context.defQueue : globalDefQueue).push([name, deps, callback]); if (context) {
context.defQueue.push([name, deps, callback]);
context.defQueueMap[name] = true;
} else {
globalDefQueue.push([name, deps, callback]);
}
}; };
define.amd = { define.amd = {
jQuery: true jQuery: true
}; };
/** /**
* Executes the text. Normally just uses eval, but can be modified * Executes the text. Normally just uses eval, but can be modified
* to use a better, environment-specific call. Only used for transpiling * to use a better, environment-specific call. Only used for transpiling
@ -2089,4 +2142,4 @@ var requirejs, require, define;
//Set up with config info. //Set up with config info.
req(cfg); req(cfg);
}(this)); }(this, (typeof setTimeout === 'undefined' ? undefined : setTimeout)));

File diff suppressed because one or more lines are too long

View File

@ -7824,11 +7824,6 @@ require-from-string@^2.0.2:
resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909"
integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==
requirejs@~2.3.6:
version "2.3.6"
resolved "https://registry.yarnpkg.com/requirejs/-/requirejs-2.3.6.tgz#e5093d9601c2829251258c0b9445d4d19fa9e7c9"
integrity sha512-ipEzlWQe6RK3jkzikgCupiTbTvm4S0/CAU5GlgptkN5SO6F3u0UD0K18wy6ErDqiCyP4J4YYe1HuAShvsxePLg==
requires-port@^1.0.0: requires-port@^1.0.0:
version "1.0.0" version "1.0.0"
resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff"