1
1
/**
2
- * @license r.js 2.1.1+ Tue, 20 Nov 2012 03:36:45 GMT Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
2
+ * @license r.js 2.1.1+ Tue, 20 Nov 2012 04:04:09 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+ Tue, 20 Nov 2012 03:36:45 GMT',
24
+ version = '2.1.1+ Tue, 20 Nov 2012 04:04:09 GMT',
25
25
jsSuffixRegExp = /\.js$/,
26
26
commandOption = '',
27
27
useLibLoaded = {},
@@ -19506,17 +19506,35 @@ define('parse', ['./esprima'], function (esprima) {
19506
19506
19507
19507
if (arg && arg.type === 'ObjectExpression') {
19508
19508
jsConfig = parse.nodeToString(fileContents, arg);
19509
- foundConfig = eval('(' + jsConfig + ')');
19509
+ return false;
19510
+ }
19511
+ } else {
19512
+ arg = parse.getRequireObjectLiteral(node);
19513
+ if (arg) {
19514
+ jsConfig = parse.nodeToString(fileContents, arg);
19510
19515
return false;
19511
19516
}
19512
19517
}
19513
-
19514
-
19515
19518
});
19516
19519
19520
+ if (jsConfig) {
19521
+ foundConfig = eval('(' + jsConfig + ')');
19522
+ }
19523
+
19517
19524
return foundConfig;
19518
19525
};
19519
19526
19527
+ /** Returns the node for the object literal assigned to require/requirejs,
19528
+ * for holding a declarative config.
19529
+ */
19530
+ parse.getRequireObjectLiteral = function (node) {
19531
+ if (node.id && node.id.type === 'Identifier' &&
19532
+ (node.id.name === 'require' || node.id.name === 'requirejs') &&
19533
+ node.init && node.init.type === 'ObjectExpression') {
19534
+ return node.init;
19535
+ }
19536
+ };
19537
+
19520
19538
/**
19521
19539
* Finds all dependencies specified in dependency arrays and inside
19522
19540
* simplified commonjs wrappers.
0 commit comments