Update client-side dependencies
Change-Id: Id360336f74d3f4d946c131bd4ed6d4c5f9d6ddce
diff --git a/dev/js/lib/almond.js b/dev/js/lib/almond.js
index 2a06588..1c7c0eb 100644
--- a/dev/js/lib/almond.js
+++ b/dev/js/lib/almond.js
@@ -1,11 +1,9 @@
/**
- * @license almond 0.3.1 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved.
- * Available via the MIT or new BSD license.
- * see: http://github.com/jrburke/almond for details
+ * @license almond 0.3.3 Copyright jQuery Foundation and other contributors.
+ * Released under MIT license, http://github.com/requirejs/almond/LICENSE
*/
//Going sloppy to avoid 'use strict' string cost, but strict practices should
//be followed.
-/*jslint sloppy: true */
/*global setTimeout: false */
var requirejs, require, define;
@@ -33,60 +31,58 @@
*/
function normalize(name, baseName) {
var nameParts, nameSegment, mapValue, foundMap, lastIndex,
- foundI, foundStarMap, starI, i, j, part,
+ foundI, foundStarMap, starI, i, j, part, normalizedBaseParts,
baseParts = baseName && baseName.split("/"),
map = config.map,
starMap = (map && map['*']) || {};
//Adjust any relative paths.
- if (name && name.charAt(0) === ".") {
- //If have a base name, try to normalize against it,
- //otherwise, assume it is a top-level require that will
- //be relative to baseUrl in the end.
- if (baseName) {
- name = name.split('/');
- lastIndex = name.length - 1;
+ if (name) {
+ name = name.split('/');
+ lastIndex = name.length - 1;
- // Node .js allowance:
- if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {
- name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');
- }
+ // 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, '');
+ }
- //Lop off the last part of baseParts, so that . matches the
- //"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.
- name = baseParts.slice(0, baseParts.length - 1).concat(name);
+ // Starts with a '.' so need the baseName
+ if (name[0].charAt(0) === '.' && baseParts) {
+ //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.
+ normalizedBaseParts = baseParts.slice(0, baseParts.length - 1);
+ name = normalizedBaseParts.concat(name);
+ }
- //start trimDots
- for (i = 0; i < name.length; i += 1) {
- part = name[i];
- if (part === ".") {
- name.splice(i, 1);
- i -= 1;
- } else if (part === "..") {
- if (i === 1 && (name[2] === '..' || name[0] === '..')) {
- //End of the line. Keep at least one non-dot
- //path segment at the front so it can be mapped
- //correctly to disk. Otherwise, there is likely
- //no path mapping for a path starting with '..'.
- //This can still fail, but catches the most reasonable
- //uses of ..
- break;
- } else if (i > 0) {
- name.splice(i - 1, 2);
- i -= 2;
- }
+ //start trimDots
+ for (i = 0; i < name.length; i++) {
+ part = name[i];
+ if (part === '.') {
+ name.splice(i, 1);
+ i -= 1;
+ } else if (part === '..') {
+ // If at the start, or previous value is still ..,
+ // keep them so that when converted to a path it may
+ // still work when converted to a path, even though
+ // as an ID it is less than ideal. In larger point
+ // releases, may be better to just kick out an error.
+ if (i === 0 || (i === 1 && name[2] === '..') || name[i - 1] === '..') {
+ continue;
+ } else if (i > 0) {
+ name.splice(i - 1, 2);
+ i -= 2;
}
}
- //end trimDots
-
- 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);
}
+ //end trimDots
+
+ name = name.join('/');
}
//Apply map config if available.
@@ -199,32 +195,39 @@
return [prefix, name];
}
+ //Creates a parts array for a relName where first part is plugin ID,
+ //second part is resource ID. Assumes relName has already been normalized.
+ function makeRelParts(relName) {
+ return relName ? splitPrefix(relName) : [];
+ }
+
/**
* Makes a name map, normalizing the name, and using a plugin
* for normalization if necessary. Grabs a ref to plugin
* too, as an optimization.
*/
- makeMap = function (name, relName) {
+ makeMap = function (name, relParts) {
var plugin,
parts = splitPrefix(name),
- prefix = parts[0];
+ prefix = parts[0],
+ relResourceName = relParts[1];
name = parts[1];
if (prefix) {
- prefix = normalize(prefix, relName);
+ prefix = normalize(prefix, relResourceName);
plugin = callDep(prefix);
}
//Normalize according
if (prefix) {
if (plugin && plugin.normalize) {
- name = plugin.normalize(name, makeNormalize(relName));
+ name = plugin.normalize(name, makeNormalize(relResourceName));
} else {
- name = normalize(name, relName);
+ name = normalize(name, relResourceName);
}
} else {
- name = normalize(name, relName);
+ name = normalize(name, relResourceName);
parts = splitPrefix(name);
prefix = parts[0];
name = parts[1];
@@ -271,13 +274,14 @@
};
main = function (name, deps, callback, relName) {
- var cjsModule, depName, ret, map, i,
+ var cjsModule, depName, ret, map, i, relParts,
args = [],
callbackType = typeof callback,
usingExports;
//Use name if no relName
relName = relName || name;
+ relParts = makeRelParts(relName);
//Call the callback to define the module, if necessary.
if (callbackType === 'undefined' || callbackType === 'function') {
@@ -286,7 +290,7 @@
//Default to [require, exports, module] if no deps
deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps;
for (i = 0; i < deps.length; i += 1) {
- map = makeMap(deps[i], relName);
+ map = makeMap(deps[i], relParts);
depName = map.f;
//Fast path CommonJS standard dependencies.
@@ -342,7 +346,7 @@
//deps arg is the module name, and second arg (if passed)
//is just the relName.
//Normalize module name, if it contains . or ..
- return callDep(makeMap(deps, callback).f);
+ return callDep(makeMap(deps, makeRelParts(callback)).f);
} else if (!deps.splice) {
//deps is a config object, not an array.
config = deps;
diff --git a/dev/js/lib/require.js b/dev/js/lib/require.js
index babfa9a..051e284 100644
--- a/dev/js/lib/require.js
+++ b/dev/js/lib/require.js
@@ -1,7 +1,6 @@
/** vim: et:ts=4:sw=4:sts=4
- * @license RequireJS 2.1.17 Copyright (c) 2010-2015, The Dojo Foundation All Rights Reserved.
- * Available via the MIT or new BSD license.
- * see: http://github.com/jrburke/requirejs for details
+ * @license RequireJS 2.3.5 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.
@@ -9,19 +8,17 @@
/*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.17',
- commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
+ version = '2.3.5',
+ commentRegExp = /\/\*[\s\S]*?\*\/|([^:"'=]|^)\/\/.*$/mg,
cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
jsSuffixRegExp = /\.js$/,
currDirRegExp = /^\.\//,
op = Object.prototype,
ostring = op.toString,
hasOwn = op.hasOwnProperty,
- ap = Array.prototype,
- apsp = ap.splice,
isBrowser = !!(typeof window !== 'undefined' && typeof navigator !== 'undefined' && window.document),
isWebWorker = !isBrowser && typeof importScripts !== 'undefined',
//PS3 indicates loaded and complete, but need to wait for complete
@@ -38,6 +35,11 @@
globalDefQueue = [],
useInteractive = false;
+ //Could match something like ')//comment', do not lose the prefix to comment.
+ function commentReplace(match, singlePrefix) {
+ return singlePrefix || '';
+ }
+
function isFunction(it) {
return ostring.call(it) === '[object Function]';
}
@@ -438,7 +440,9 @@
//Account for relative paths if there is a base name.
if (name) {
if (prefix) {
- if (pluginModule && pluginModule.normalize) {
+ if (isNormalized) {
+ normalizedName = name;
+ } else if (pluginModule && pluginModule.normalize) {
//Plugin is loaded, use its normalize method.
normalizedName = pluginModule.normalize(name, function (name) {
return normalize(name, parentName, applyMap);
@@ -554,11 +558,13 @@
function takeGlobalQueue() {
//Push all the globalDefQueue items into the context's defQueue
if (globalDefQueue.length) {
- //Array splice in the values since the context code has a
- //local var ref to defQueue, so cannot just reassign the one
- //on context.
- apsp.apply(defQueue,
- [defQueue.length, 0].concat(globalDefQueue));
+ each(globalDefQueue, function(queueItem) {
+ var id = queueItem[0];
+ if (typeof id === 'string') {
+ context.defQueueMap[id] = true;
+ }
+ defQueue.push(queueItem);
+ });
globalDefQueue = [];
}
}
@@ -589,7 +595,7 @@
id: mod.map.id,
uri: mod.map.url,
config: function () {
- return getOwn(config.config, mod.map.id) || {};
+ return getOwn(config.config, mod.map.id) || {};
},
exports: mod.exports || (mod.exports = {})
});
@@ -845,7 +851,10 @@
factory = this.factory;
if (!this.inited) {
- this.fetch();
+ // Only fetch if not already in the defQueue.
+ if (!hasProp(context.defQueueMap, id)) {
+ this.fetch();
+ }
} else if (this.error) {
this.emit('error', this.error);
} else if (!this.defining) {
@@ -905,7 +914,11 @@
defined[id] = exports;
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);
}
}
@@ -961,9 +974,11 @@
//prefix and name should already be normalized, no need
//for applying map config again either.
normalizedMap = makeModuleMap(map.prefix + '!' + name,
- this.map.parentMap);
+ this.map.parentMap,
+ true);
on(normalizedMap,
'defined', bind(this, function (value) {
+ this.map.normalizedMap = normalizedMap;
this.init([], function () { return value; }, null, {
enabled: true,
ignore: true
@@ -1117,6 +1132,9 @@
this.depCount += 1;
on(depMap, 'defined', bind(this, function (depExports) {
+ if (this.undefed) {
+ return;
+ }
this.defineDep(i, depExports);
this.check();
}));
@@ -1233,13 +1251,15 @@
while (defQueue.length) {
args = defQueue.shift();
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 {
//args are id, deps, factory. Should be normalized by the
//define() function.
callGetModule(args);
}
}
+ context.defQueueMap = {};
}
context = {
@@ -1249,6 +1269,7 @@
defined: defined,
urlFetched: urlFetched,
defQueue: defQueue,
+ defQueueMap: {},
Module: Module,
makeModuleMap: makeModuleMap,
nextTick: req.nextTick,
@@ -1266,6 +1287,14 @@
}
}
+ // 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,
//they are additive.
var shim = config.shim,
@@ -1320,7 +1349,7 @@
each(cfg.packages, function (pkgObj) {
var location, name;
- pkgObj = typeof pkgObj === 'string' ? { name: pkgObj } : pkgObj;
+ pkgObj = typeof pkgObj === 'string' ? {name: pkgObj} : pkgObj;
name = pkgObj.name;
location = pkgObj.location;
@@ -1347,7 +1376,7 @@
//late to modify them, and ignore unnormalized ones
//since they are transient.
if (!mod.inited && !mod.map.unnormalized) {
- mod.map = makeModuleMap(id);
+ mod.map = makeModuleMap(id, null, true);
}
});
@@ -1483,6 +1512,7 @@
var map = makeModuleMap(id, relMap, true),
mod = getOwn(registry, id);
+ mod.undefed = true;
removeScript(id);
delete defined[id];
@@ -1493,10 +1523,11 @@
//in array so that the splices do not
//mess up the iteration.
eachReverse(defQueue, function(args, i) {
- if(args[0] === id) {
+ if (args[0] === id) {
defQueue.splice(i, 1);
}
});
+ delete context.defQueueMap[id];
if (mod) {
//Hold on to listeners in case the
@@ -1558,6 +1589,7 @@
callGetModule(args);
}
+ context.defQueueMap = {};
//Do this after the cycle of callGetModule in case the result
//of those calls/init calls changes the registry.
@@ -1639,13 +1671,12 @@
//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 +
- ((url.indexOf('?') === -1 ? '?' : '&') +
- config.urlArgs) : url;
+ return config.urlArgs && !/^blob\:/.test(url) ?
+ url + config.urlArgs(moduleName, url) : url;
},
//Delegates to req.load. Broken out as a separate function to
@@ -1693,7 +1724,21 @@
onScriptError: function (evt) {
var data = getScriptData(evt);
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]));
}
}
};
@@ -1867,11 +1912,11 @@
if (node.attachEvent &&
//Check if node.attachEvent is artificially added by custom script or
//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.
//in IE8, node.attachEvent does not have toString()
//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) &&
!isOpera) {
//Probably IE. IE (at least 6-8) do not fire
@@ -1899,6 +1944,12 @@
}
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
//of the appendChild execution, so to tie an anonymous define
//call to the module name (which is stored on the node), hold on
@@ -1917,9 +1968,14 @@
//In a web worker, use importScripts. This is not a very
//efficient use of importScripts, importScripts will block until
//its script is downloaded and evaluated. However, if web workers
- //are in play, the expectation that a build has been done so that
- //only one script needs to be loaded anyway. This may need to be
- //reevaluated if other use cases become common.
+ //are in play, the expectation is that a build has been done so
+ //that only one script needs to be loaded anyway. This may need
+ //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);
//Account for anonymous modules
@@ -1965,8 +2021,10 @@
//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('/');
@@ -1980,7 +2038,7 @@
//like a module name.
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)) {
mainScript = dataMain;
}
@@ -2027,7 +2085,7 @@
if (callback.length) {
callback
.toString()
- .replace(commentRegExp, '')
+ .replace(commentRegExp, commentReplace)
.replace(cjsRequireRegExp, function (match, dep) {
deps.push(dep);
});
@@ -2059,14 +2117,18 @@
//where the module name is not known until the script onload event
//occurs. If no context, use the global queue, and get it processed
//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 = {
jQuery: true
};
-
/**
* Executes the text. Normally just uses eval, but can be modified
* to use a better, environment-specific call. Only used for transpiling
@@ -2080,4 +2142,4 @@
//Set up with config info.
req(cfg);
-}(this));
+}(this, (typeof setTimeout === 'undefined' ? undefined : setTimeout)));