Skip to content

Commit 606200e

Browse files
committed
update
1 parent 7eefffc commit 606200e

File tree

1 file changed

+34
-14
lines changed

1 file changed

+34
-14
lines changed

dist/r.js

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @license r.js 1.0.4+ 20120124 7pm Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
2+
* @license r.js 1.0.4+ 20120125 8:40pm Copyright (c) 2010-2011, 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;
2020

2121
var fileName, env, fs, vm, path, exec, rhinoContext, dir, nodeRequire,
2222
nodeDefine, exists, reqMain, loadedOptimizedLib,
23-
version = '1.0.4+ 20120124 7pm',
23+
version = '1.0.4+ 20120125 8:40pm',
2424
jsSuffixRegExp = /\.js$/,
2525
commandOption = '',
2626
useLibLoaded = {},
@@ -2961,6 +2961,14 @@ define('lang', function () {
29612961
return lang.ostring.call(it) === "[object Array]";
29622962
},
29632963

2964+
isFunction: function(it) {
2965+
return lang.ostring.call(it) === "[object Function]";
2966+
},
2967+
2968+
isRegExp: function(it) {
2969+
return it && it instanceof RegExp;
2970+
},
2971+
29642972
/**
29652973
* Simple function to mix in properties from source into target,
29662974
* but only if target does not already have a property of the same name.
@@ -6933,6 +6941,8 @@ define('parse', ['uglifyjs/index'], function (uglify) {
69336941
* @param {String} fileContents
69346942
*
69356943
* @returns {Object} a config object. Will be null if no config.
6944+
* Can throw an error if the config in the file cannot be evaluated in
6945+
* a build context to valid JavaScript.
69366946
*/
69376947
parse.findConfig = function (fileName, fileContents) {
69386948
/*jslint evil: true */
@@ -6947,14 +6957,8 @@ define('parse', ['uglifyjs/index'], function (uglify) {
69476957

69486958
if (!foundConfig && configNode) {
69496959
jsConfig = parse.nodeToString(configNode);
6950-
if (jsConfig) {
6951-
try {
6952-
foundConfig = eval('(' + jsConfig + ')');
6953-
} catch (e) {
6954-
foundConfig = null;
6955-
}
6956-
return foundConfig;
6957-
}
6960+
foundConfig = eval('(' + jsConfig + ')');
6961+
return foundConfig;
69586962
}
69596963
return undefined;
69606964
}, null, parse.parseConfigNode);
@@ -8876,7 +8880,8 @@ function (lang, logger, file, parse, optimize, pragma,
88768880
if (config.paths) {
88778881
for (prop in config.paths) {
88788882
if (config.paths.hasOwnProperty(prop)) {
8879-
config.paths[prop] = build.makeAbsPath(config.paths[prop], config.baseUrl);
8883+
config.paths[prop] = build.makeAbsPath(config.paths[prop],
8884+
(config.baseUrl || absFilePath));
88808885
}
88818886
}
88828887
}
@@ -8898,11 +8903,16 @@ function (lang, logger, file, parse, optimize, pragma,
88988903
* nested config, like paths, correctly.
88998904
*/
89008905
function mixConfig(target, source) {
8901-
var prop;
8906+
var prop, value;
89028907

89038908
for (prop in source) {
89048909
if (source.hasOwnProperty(prop)) {
8905-
if (build.nestedMix[prop]) {
8910+
//If the value of the property is a plain object, then
8911+
//allow a one-level-deep mixing of it.
8912+
value = source[prop];
8913+
if (typeof value === 'object' && value &&
8914+
!lang.isArray(value) && !lang.isFunction(value) &&
8915+
!lang.isRegExp(value)) {
89068916
if (!target[prop]) {
89078917
target[prop] = {};
89088918
}
@@ -8963,7 +8973,17 @@ function (lang, logger, file, parse, optimize, pragma,
89638973
mainConfigFile = config.mainConfigFile || (buildFileConfig && buildFileConfig.mainConfigFile);
89648974
if (mainConfigFile) {
89658975
mainConfigFile = build.makeAbsPath(mainConfigFile, absFilePath);
8966-
mainConfig = parse.findConfig(mainConfigFile, file.readFile(mainConfigFile));
8976+
try {
8977+
mainConfig = parse.findConfig(mainConfigFile, file.readFile(mainConfigFile));
8978+
} catch (configError) {
8979+
throw new Error('The config in mainConfigFile ' +
8980+
mainConfigFile +
8981+
' cannot be used because it cannot be evaluated' +
8982+
' correctly while running in the optimizer. Try only' +
8983+
' using a config that is also valid JSON, or do not use' +
8984+
' mainConfigFile and instead copy the config values needed' +
8985+
' into a build file or command line arguments given to the optimizer.');
8986+
}
89678987
if (mainConfig) {
89688988
//If no baseUrl, then use the directory holding the main config.
89698989
if (!mainConfig.baseUrl) {

0 commit comments

Comments
 (0)