1
1
/**
2
- * @license r.js 2.1.1+ Sat, 17 Nov 2012 02:00:39 GMT Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
2
+ * @license r.js 2.1.1+ Sat, 17 Nov 2012 23:32:03 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+ Sat, 17 Nov 2012 02:00:39 GMT',
24
+ version = '2.1.1+ Sat, 17 Nov 2012 23:32:03 GMT',
25
25
jsSuffixRegExp = /\.js$/,
26
26
commandOption = '',
27
27
useLibLoaded = {},
@@ -15080,43 +15080,53 @@ define('build', function (require) {
15080
15080
//Get rid of the extension
15081
15081
moduleName = moduleName.substring(0, moduleName.length - 3);
15082
15082
15083
- //Convert the file to transport format, but without a name
15084
- //inserted (by passing null for moduleName) since the files are
15085
- //standalone, one module per file.
15086
- fileContents = file.readFile(fileName);
15087
-
15088
- //For builds, if wanting cjs translation, do it now, so that
15089
- //the individual modules can be loaded cross domain via
15090
- //plain script tags.
15091
- if (config.cjsTranslate) {
15092
- fileContents = commonJs.convert(fileName, fileContents);
15093
- }
15094
-
15095
15083
//If there is an override for a specific layer build module,
15096
15084
//and this file is that module, mix in the override for use
15097
15085
//by optimize.jsFile.
15098
15086
moduleIndex = getOwn(config._buildPathToModuleIndex, fileName);
15099
15087
//Normalize, since getOwn could have returned undefined
15100
15088
moduleIndex = moduleIndex === 0 || moduleIndex > 0 ? moduleIndex : -1;
15101
15089
15102
- //Only do transport normalization if this is not a build layer
15103
- //and if normalizeDefines indicated all should be done.
15104
- if (moduleIndex === -1 && config.normalizeDefines === "all") {
15105
- fileContents = build.toTransport(config.namespace,
15106
- null,
15107
- fileName,
15108
- fileContents);
15109
- }
15090
+ //Try to avoid extra work if the other files do not need to
15091
+ //be read. Build layers should be processed at the very
15092
+ //least for optimization.
15093
+ if (moduleIndex > -1 || !config.skipDirOptimize ||
15094
+ config.normalizeDirDefines === "all" ||
15095
+ config.cjsTranslate) {
15096
+ //Convert the file to transport format, but without a name
15097
+ //inserted (by passing null for moduleName) since the files are
15098
+ //standalone, one module per file.
15099
+ fileContents = file.readFile(fileName);
15110
15100
15111
- override = moduleIndex > -1 ?
15112
- config.modules[moduleIndex].override : null;
15113
- if (override) {
15114
- cfg = build.createOverrideConfig(config, override);
15115
- } else {
15116
- cfg = config;
15117
- }
15101
+ //For builds, if wanting cjs translation, do it now, so that
15102
+ //the individual modules can be loaded cross domain via
15103
+ //plain script tags.
15104
+ if (config.cjsTranslate) {
15105
+ fileContents = commonJs.convert(fileName, fileContents);
15106
+ }
15107
+
15108
+ //Only do transport normalization if this is not a build
15109
+ //layer (since it was already normalized) and if
15110
+ //normalizeDirDefines indicated all should be done.
15111
+ if (moduleIndex === -1 && config.normalizeDirDefines === "all") {
15112
+ fileContents = build.toTransport(config.namespace,
15113
+ null,
15114
+ fileName,
15115
+ fileContents);
15116
+ }
15117
+
15118
+ override = moduleIndex > -1 ?
15119
+ config.modules[moduleIndex].override : null;
15120
+ if (override) {
15121
+ cfg = build.createOverrideConfig(config, override);
15122
+ } else {
15123
+ cfg = config;
15124
+ }
15118
15125
15119
- optimize.jsFile(fileName, fileContents, fileName, cfg, pluginCollector);
15126
+ if (moduleIndex > -1 || !config.skipDirOptimize) {
15127
+ optimize.jsFile(fileName, fileContents, fileName, cfg, pluginCollector);
15128
+ }
15129
+ }
15120
15130
});
15121
15131
15122
15132
//Normalize all the plugin resources.
@@ -15649,13 +15659,13 @@ define('build', function (require) {
15649
15659
' pages.');
15650
15660
}
15651
15661
15652
- //Set up normalizeDefines . If not explicitly set, if optimize "none",
15662
+ //Set up normalizeDirDefines . If not explicitly set, if optimize "none",
15653
15663
//set to "skip" otherwise set to "all".
15654
- if (!hasProp(config, 'normalizeDefines ')) {
15655
- if (config.optimize === 'none') {
15656
- config.normalizeDefines = 'skip';
15664
+ if (!hasProp(config, 'normalizeDirDefines ')) {
15665
+ if (config.optimize === 'none' || config.skipDirOptimize ) {
15666
+ config.normalizeDirDefines = 'skip';
15657
15667
} else {
15658
- config.normalizeDefines = 'all';
15668
+ config.normalizeDirDefines = 'all';
15659
15669
}
15660
15670
}
15661
15671
0 commit comments