1
1
/**
2
- * @license r.js 2.1.1+ Fri, 16 Nov 2012 19:22:11 GMT Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
2
+ * @license r.js 2.1.1+ Sat, 17 Nov 2012 00:42:08 GMT Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
3
3
* Available via the MIT or new BSD license.
4
4
* see: http://github.com/jrburke/requirejs for details
5
5
*/
@@ -21,7 +21,7 @@ var requirejs, require, define;
21
21
22
22
var fileName, env, fs, vm, path, exec, rhinoContext, dir, nodeRequire,
23
23
nodeDefine, exists, reqMain, loadedOptimizedLib, existsForNode,
24
- version = '2.1.1+ Fri, 16 Nov 2012 19:22:11 GMT',
24
+ version = '2.1.1+ Sat, 17 Nov 2012 00:42:08 GMT',
25
25
jsSuffixRegExp = /\.js$/,
26
26
commandOption = '',
27
27
useLibLoaded = {},
@@ -15075,7 +15075,7 @@ define('build', function (require) {
15075
15075
//JS optimizations.
15076
15076
fileNames = file.getFilteredFileList(config.dir, /\.js$/, true);
15077
15077
fileNames.forEach(function (fileName, i) {
15078
- var cfg, moduleIndex, override ;
15078
+ var cfg, override, moduleIndex ;
15079
15079
15080
15080
//Generate the module name from the config.dir root.
15081
15081
moduleName = fileName.replace(config.dir, '');
@@ -15094,16 +15094,23 @@ define('build', function (require) {
15094
15094
fileContents = commonJs.convert(fileName, fileContents);
15095
15095
}
15096
15096
15097
- fileContents = build.toTransport(config.namespace,
15098
- null,
15099
- fileName,
15100
- fileContents);
15101
-
15102
15097
//If there is an override for a specific layer build module,
15103
15098
//and this file is that module, mix in the override for use
15104
15099
//by optimize.jsFile.
15105
15100
moduleIndex = getOwn(config._buildPathToModuleIndex, fileName);
15106
- override = moduleIndex === 0 || moduleIndex > 0 ?
15101
+ //Normalize, since getOwn could have returned undefined
15102
+ moduleIndex = moduleIndex === 0 || moduleIndex > 0 ? moduleIndex : -1;
15103
+
15104
+ //Only do transport normalization if this is not a build layer
15105
+ //and if normalizeDefines indicated all should be done.
15106
+ if (moduleIndex === -1 && config.normalizeDefines === "all") {
15107
+ fileContents = build.toTransport(config.namespace,
15108
+ null,
15109
+ fileName,
15110
+ fileContents);
15111
+ }
15112
+
15113
+ override = moduleIndex > -1 ?
15107
15114
config.modules[moduleIndex].override : null;
15108
15115
if (override) {
15109
15116
cfg = build.createOverrideConfig(config, override);
@@ -15638,6 +15645,16 @@ define('build', function (require) {
15638
15645
' pages.');
15639
15646
}
15640
15647
15648
+ //Set up normalizeDefines. If not explicitly set, if optimize "none",
15649
+ //set to "skip" otherwise set to "all".
15650
+ if (!hasProp(config, 'normalizeDefines')) {
15651
+ if (config.optimize === 'none') {
15652
+ config.normalizeDefines = 'skip';
15653
+ } else {
15654
+ config.normalizeDefines = 'all';
15655
+ }
15656
+ }
15657
+
15641
15658
//Set file.fileExclusionRegExp if desired
15642
15659
if (hasProp(config, 'fileExclusionRegExp')) {
15643
15660
if (typeof config.fileExclusionRegExp === "string") {
0 commit comments