11/**
2- * @license r.js 2.1.4+ Wed, 20 Feb 2013 00:21:47 GMT Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
2+ * @license r.js 2.1.4+ Wed, 20 Feb 2013 06:35:07 GMT Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
33 * Available via the MIT or new BSD license.
44 * see: http://github.com/jrburke/requirejs for details
55 */
@@ -20,7 +20,7 @@ var requirejs, require, define, xpcUtil;
2020(function (console, args, readFileFunc) {
2121 var fileName, env, fs, vm, path, exec, rhinoContext, dir, nodeRequire,
2222 nodeDefine, exists, reqMain, loadedOptimizedLib, existsForNode, Cc, Ci,
23- version = '2.1.4+ Wed, 20 Feb 2013 00:21:47 GMT',
23+ version = '2.1.4+ Wed, 20 Feb 2013 06:35:07 GMT',
2424 jsSuffixRegExp = /\.js$/,
2525 commandOption = '',
2626 useLibLoaded = {},
@@ -2509,6 +2509,10 @@ var requirejs, require, define, xpcUtil;
25092509 }
25102510
25112511 define('env', {
2512+ get: function () {
2513+ return env;
2514+ },
2515+
25122516 load: function (name, req, load, config) {
25132517 //Allow override in the config.
25142518 if (config.env) {
@@ -22677,7 +22681,7 @@ define('commonJs', ['env!env/file', 'parse'], function (file, parse) {
2267722681 */
2267822682
2267922683/*jslint plusplus: true, nomen: true, regexp: true */
22680- /*global define, require, requirejs */
22684+ /*global define, requirejs */
2268122685
2268222686
2268322687define('build', function (require) {
@@ -22692,8 +22696,8 @@ define('build', function (require) {
2269222696 optimize = require('optimize'),
2269322697 pragma = require('pragma'),
2269422698 transform = require('transform'),
22695- load = require('env!env/load'),
2269622699 requirePatch = require('requirePatch'),
22700+ env = require('env'),
2269722701 quit = require('env!env/quit'),
2269822702 commonJs = require('commonJs'),
2269922703 hasProp = lang.hasProp,
@@ -22881,15 +22885,15 @@ define('build', function (require) {
2288122885 var buildPaths, fileName, fileNames,
2288222886 paths, i,
2288322887 baseConfig, config,
22884- modules, builtModule, srcPath, buildContext,
22888+ modules, srcPath, buildContext,
2288522889 destPath, moduleMap, parentModuleMap, context,
2288622890 resources, resource, plugin, fileContents,
2288722891 pluginProcessed = {},
2288822892 buildFileContents = "",
2288922893 pluginCollector = {};
2289022894
2289122895 return prim().start(function () {
22892- var prop, moduleName ;
22896+ var prop;
2289322897
2289422898 //Can now run the patches to require.js to allow it to be used for
2289522899 //build generation. Do it here instead of at the top of the module
@@ -23061,7 +23065,6 @@ define('build', function (require) {
2306123065 //of those modules end up being one of the excluded values.
2306223066 actions = modules.map(function (module) {
2306323067 return function () {
23064- var actions;
2306523068 if (module.exclude) {
2306623069 module.excludeLayers = [];
2306723070 return prim.serial(module.exclude.map(function (exclude, i) {
@@ -23180,7 +23183,7 @@ define('build', function (require) {
2318023183
2318123184 //JS optimizations.
2318223185 fileNames = file.getFilteredFileList(config.dir, /\.js$/, true);
23183- fileNames.forEach(function (fileName, i ) {
23186+ fileNames.forEach(function (fileName) {
2318423187 var cfg, override, moduleIndex;
2318523188
2318623189 //Generate the module name from the config.dir root.
@@ -23326,8 +23329,7 @@ define('build', function (require) {
2332623329 * name=value splitting has already happened.
2332723330 */
2332823331 function stringDotToObj(result, name, value) {
23329- var parts = name.split('.'),
23330- prop = parts[0];
23332+ var parts = name.split('.');
2333123333
2333223334 parts.forEach(function (prop, i) {
2333323335 if (i === parts.length - 1) {
@@ -23548,7 +23550,7 @@ define('build', function (require) {
2354823550 build.createConfig = function (cfg) {
2354923551 /*jslint evil: true */
2355023552 var config = {}, buildFileContents, buildFileConfig, mainConfig,
23551- mainConfigFile, mainConfigPath, prop, buildFile, absFilePath;
23553+ mainConfigFile, mainConfigPath, buildFile, absFilePath;
2355223554
2355323555 //Make sure all paths are relative to current directory.
2355423556 absFilePath = file.absPath('.');
@@ -23890,14 +23892,12 @@ define('build', function (require) {
2389023892 */
2389123893 build.traceDependencies = function (module, config) {
2389223894 var include, override, layer, context, baseConfig, oldContext,
23893- registry, id, idParts, pluginId, mod, errUrl, rawTextByIds,
23894- errMessage = '',
23895- failedPluginMap = {},
23896- failedPluginIds = [],
23897- errIds = [],
23898- errUrlMap = {},
23899- errUrlConflicts = {},
23900- hasErrUrl = false,
23895+ rawTextByIds,
23896+ syncChecks = {
23897+ rhino: true,
23898+ node: true,
23899+ xpconnect: true
23900+ },
2390123901 deferred = prim();
2390223902
2390323903 //Reset some state set up in requirePatch.js, and clean up require's
@@ -23945,75 +23945,100 @@ define('build', function (require) {
2394523945 deferred.reject.__requireJsBuild = true;
2394623946 require(include, deferred.resolve, deferred.reject);
2394723947
23948- return deferred.promise.then(function () {
23949- var id, prop;
23948+ //If a sync build environment, check for errors here, instead of
23949+ //in the then callback below, since some errors, like two IDs pointed
23950+ //to same URL but only one anon ID will leave the loader in an
23951+ //unresolved state since a setTimeout cannot be used to check for
23952+ //timeout.
23953+ if (syncChecks[env.get()]) {
23954+ try {
23955+ build.checkForErrors(context);
23956+ } catch (e) {
23957+ deferred.reject(e);
23958+ }
23959+ }
2395023960
23961+ return deferred.promise.then(function () {
2395123962 //Reset config
2395223963 if (module.override) {
2395323964 require(baseConfig);
2395423965 }
2395523966
23956- //Check to see if it all loaded. If not, then stop, and give
23957- //a message on what is left.
23967+ build.checkForErrors(context);
23968+
23969+ return layer;
23970+ });
23971+ };
23972+
23973+ build.checkForErrors = function (context) {
23974+ //Check to see if it all loaded. If not, then throw, and give
23975+ //a message on what is left.
23976+ var id, prop, mod, errUrl, idParts, pluginId,
23977+ errMessage = '',
23978+ failedPluginMap = {},
23979+ failedPluginIds = [],
23980+ errIds = [],
23981+ errUrlMap = {},
23982+ errUrlConflicts = {},
23983+ hasErrUrl = false,
2395823984 registry = context.registry;
23959- for (id in registry) {
23960- if (hasProp(registry, id) && id.indexOf('_@r') !== 0) {
23961- mod = getOwn(registry, id);
23962- if (id.indexOf('_unnormalized') === -1 && mod && mod.enabled) {
23963- errIds.push(id);
23964- errUrl = mod.map.url;
23965-
23966- if (errUrlMap[errUrl]) {
23967- hasErrUrl = true;
23968- //This error module has the same URL as another
23969- //error module, could be misconfiguration.
23970- if (!errUrlConflicts[errUrl]) {
23971- errUrlConflicts[errUrl] = [];
23972- //Store the original module that had the same URL.
23973- errUrlConflicts[errUrl].push(errUrlMap[errUrl]);
23974- }
23975- errUrlConflicts[errUrl].push(id);
23976- } else {
23977- errUrlMap[errUrl] = id;
23985+
23986+ for (id in registry) {
23987+ if (hasProp(registry, id) && id.indexOf('_@r') !== 0) {
23988+ mod = getOwn(registry, id);
23989+ if (id.indexOf('_unnormalized') === -1 && mod && mod.enabled) {
23990+ errIds.push(id);
23991+ errUrl = mod.map.url;
23992+
23993+ if (errUrlMap[errUrl]) {
23994+ hasErrUrl = true;
23995+ //This error module has the same URL as another
23996+ //error module, could be misconfiguration.
23997+ if (!errUrlConflicts[errUrl]) {
23998+ errUrlConflicts[errUrl] = [];
23999+ //Store the original module that had the same URL.
24000+ errUrlConflicts[errUrl].push(errUrlMap[errUrl]);
2397824001 }
24002+ errUrlConflicts[errUrl].push(id);
24003+ } else {
24004+ errUrlMap[errUrl] = id;
2397924005 }
24006+ }
2398024007
23981- //Look for plugins that did not call load()
23982- idParts = id.split('!');
23983- pluginId = idParts[0];
23984- if (idParts.length > 1 && falseProp(failedPluginMap, pluginId)) {
23985- failedPluginIds.push(pluginId);
23986- failedPluginMap[pluginId] = true;
23987- }
24008+ //Look for plugins that did not call load()
24009+ idParts = id.split('!');
24010+ pluginId = idParts[0];
24011+ if (idParts.length > 1 && falseProp(failedPluginMap, pluginId)) {
24012+ failedPluginIds.push(pluginId);
24013+ failedPluginMap[pluginId] = true;
2398824014 }
2398924015 }
24016+ }
2399024017
23991- if (errIds.length || failedPluginIds.length) {
23992- if (failedPluginIds.length) {
23993- errMessage += 'Loader plugin' +
23994- (failedPluginIds.length === 1 ? '' : 's') +
23995- ' did not call ' +
23996- 'the load callback in the build: ' +
23997- failedPluginIds.join(', ') + '\n';
23998- }
23999- errMessage += 'Module loading did not complete for: ' + errIds.join(', ');
24018+ if (errIds.length || failedPluginIds.length) {
24019+ if (failedPluginIds.length) {
24020+ errMessage += 'Loader plugin' +
24021+ (failedPluginIds.length === 1 ? '' : 's') +
24022+ ' did not call ' +
24023+ 'the load callback in the build: ' +
24024+ failedPluginIds.join(', ') + '\n';
24025+ }
24026+ errMessage += 'Module loading did not complete for: ' + errIds.join(', ');
2400024027
24001- if (hasErrUrl) {
24002- errMessage += '\nThe following modules share the same URL. This ' +
24003- 'could be a misconfiguration if that URL only has ' +
24004- 'one anonymous module in it:';
24005- for (prop in errUrlConflicts) {
24006- if (hasProp(errUrlConflicts, prop)) {
24007- errMessage += '\n' + prop + ': ' +
24008- errUrlConflicts[prop].join(', ');
24009- }
24028+ if (hasErrUrl) {
24029+ errMessage += '\nThe following modules share the same URL. This ' +
24030+ 'could be a misconfiguration if that URL only has ' +
24031+ 'one anonymous module in it:';
24032+ for (prop in errUrlConflicts) {
24033+ if (hasProp(errUrlConflicts, prop)) {
24034+ errMessage += '\n' + prop + ': ' +
24035+ errUrlConflicts[prop].join(', ');
2401024036 }
2401124037 }
24012- throw new Error(errMessage);
2401324038 }
24039+ throw new Error(errMessage);
24040+ }
2401424041
24015- return layer;
24016- });
2401724042 };
2401824043
2401924044 build.createOverrideConfig = function (config, override) {
@@ -24053,11 +24078,10 @@ define('build', function (require) {
2405324078 buildFileContents = '';
2405424079
2405524080 return prim().start(function () {
24056- var path, reqIndex, currContents,
24057- i, moduleName, shim, packageConfig, nonPackageName,
24058- parts, builder, writeApi, tempPragmas,
24081+ var reqIndex, currContents,
24082+ moduleName, shim, packageConfig, nonPackageName,
24083+ parts, builder, writeApi,
2405924084 namespace, namespaceWithDot, stubModulesByName,
24060- newConfig = {},
2406124085 context = layer.context,
2406224086 onLayerEnds = [],
2406324087 onLayerEndAdded = {};
@@ -24452,6 +24476,7 @@ function (args, build) {
2445224476 }
2445324477
2445424478}((typeof console !== 'undefined' ? console : undefined),
24455- (typeof Packages !== 'undefined' || (typeof Components !== 'undefined' && Components.interfaces) ?
24479+ (typeof Packages !== 'undefined' || (typeof window === 'undefined' &&
24480+ typeof Components !== 'undefined' && Components.interfaces) ?
2445624481 Array.prototype.slice.call(arguments, 0) : []),
2445724482 (typeof readFile !== 'undefined' ? readFile : undefined)));
0 commit comments