1
1
/**
2
- * @license r.js 2.1.22+ Tue, 15 Mar 2016 23:27:47 GMT Copyright jQuery Foundation and other contributors.
2
+ * @license r.js 2.1.22+ Thu, 17 Mar 2016 00:36:23 GMT Copyright jQuery Foundation and other contributors.
3
3
* Released under MIT license, http://github.com/requirejs/r.js/LICENSE
4
4
*/
5
5
@@ -19,7 +19,7 @@ var requirejs, require, define, xpcUtil;
19
19
(function (console, args, readFileFunc) {
20
20
var fileName, env, fs, vm, path, exec, rhinoContext, dir, nodeRequire,
21
21
nodeDefine, exists, reqMain, loadedOptimizedLib, existsForNode, Cc, Ci,
22
- version = '2.1.22+ Tue, 15 Mar 2016 23:27:47 GMT',
22
+ version = '2.1.22+ Thu, 17 Mar 2016 00:36:23 GMT',
23
23
jsSuffixRegExp = /\.js$/,
24
24
commandOption = '',
25
25
useLibLoaded = {},
@@ -5598,6 +5598,7 @@ define('logger', ['env!env/print'], function (print) {
5598
5598
}
5599
5599
5600
5600
if (quote !== '') {
5601
+ index = start;
5601
5602
throwUnexpectedToken();
5602
5603
}
5603
5604
@@ -7190,7 +7191,7 @@ define('logger', ['env!env/print'], function (print) {
7190
7191
7191
7192
return node.finishProperty(
7192
7193
'init', key, false,
7193
- new WrappingNode(keyToken).finishAssignmentPattern(key, init), false, false );
7194
+ new WrappingNode(keyToken).finishAssignmentPattern(key, init), false, true );
7194
7195
} else if (!match(':')) {
7195
7196
params.push(keyToken);
7196
7197
return node.finishProperty('init', key, false, key, false, true);
@@ -7725,6 +7726,9 @@ define('logger', ['env!env/print'], function (print) {
7725
7726
if (!strict && state.allowYield && matchKeyword('yield')) {
7726
7727
return parseNonComputedProperty();
7727
7728
}
7729
+ if (!strict && matchKeyword('let')) {
7730
+ return node.finishIdentifier(lex().value);
7731
+ }
7728
7732
isAssignmentTarget = isBindingElement = false;
7729
7733
if (matchKeyword('function')) {
7730
7734
return parseFunctionExpression();
@@ -7736,9 +7740,6 @@ define('logger', ['env!env/print'], function (print) {
7736
7740
if (matchKeyword('class')) {
7737
7741
return parseClassExpression();
7738
7742
}
7739
- if (!strict && matchKeyword('let')) {
7740
- return node.finishIdentifier(lex().value);
7741
- }
7742
7743
throwUnexpectedToken(lex());
7743
7744
} else if (type === Token.BooleanLiteral) {
7744
7745
isAssignmentTarget = isBindingElement = false;
@@ -8316,6 +8317,7 @@ define('logger', ['env!env/print'], function (print) {
8316
8317
8317
8318
argument = null;
8318
8319
expr = new Node();
8320
+ delegate = false;
8319
8321
8320
8322
expectKeyword('yield');
8321
8323
@@ -8521,15 +8523,15 @@ define('logger', ['env!env/print'], function (print) {
8521
8523
}
8522
8524
8523
8525
function parseVariableDeclarationList(options) {
8524
- var list = [] ;
8526
+ var opt, list ;
8525
8527
8526
- do {
8527
- list.push(parseVariableDeclaration({ inFor: options.inFor }));
8528
- if (!match(',')) {
8529
- break;
8530
- }
8528
+ opt = { inFor: options.inFor };
8529
+ list = [parseVariableDeclaration(opt)];
8530
+
8531
+ while (match(',')) {
8531
8532
lex();
8532
- } while (startIndex < length);
8533
+ list.push(parseVariableDeclaration(opt));
8534
+ }
8533
8535
8534
8536
return list;
8535
8537
}
@@ -8572,15 +8574,12 @@ define('logger', ['env!env/print'], function (print) {
8572
8574
}
8573
8575
8574
8576
function parseBindingList(kind, options) {
8575
- var list = [];
8577
+ var list = [parseLexicalBinding(kind, options) ];
8576
8578
8577
- do {
8578
- list.push(parseLexicalBinding(kind, options));
8579
- if (!match(',')) {
8580
- break;
8581
- }
8579
+ while (match(',')) {
8582
8580
lex();
8583
- } while (startIndex < length);
8581
+ list.push(parseLexicalBinding(kind, options));
8582
+ }
8584
8583
8585
8584
return list;
8586
8585
}
@@ -9284,7 +9283,7 @@ define('logger', ['env!env/print'], function (print) {
9284
9283
9285
9284
function parseFunctionSourceElements() {
9286
9285
var statement, body = [], token, directive, firstRestricted,
9287
- oldLabelSet, oldInIteration, oldInSwitch, oldInFunctionBody, oldParenthesisCount,
9286
+ oldLabelSet, oldInIteration, oldInSwitch, oldInFunctionBody,
9288
9287
node = new Node();
9289
9288
9290
9289
expect('{');
@@ -9318,13 +9317,11 @@ define('logger', ['env!env/print'], function (print) {
9318
9317
oldInIteration = state.inIteration;
9319
9318
oldInSwitch = state.inSwitch;
9320
9319
oldInFunctionBody = state.inFunctionBody;
9321
- oldParenthesisCount = state.parenthesizedCount;
9322
9320
9323
9321
state.labelSet = {};
9324
9322
state.inIteration = false;
9325
9323
state.inSwitch = false;
9326
9324
state.inFunctionBody = true;
9327
- state.parenthesizedCount = 0;
9328
9325
9329
9326
while (startIndex < length) {
9330
9327
if (match('}')) {
@@ -9339,7 +9336,6 @@ define('logger', ['env!env/print'], function (print) {
9339
9336
state.inIteration = oldInIteration;
9340
9337
state.inSwitch = oldInSwitch;
9341
9338
state.inFunctionBody = oldInFunctionBody;
9342
- state.parenthesizedCount = oldParenthesisCount;
9343
9339
9344
9340
return node.finishBlockStatement(body);
9345
9341
}
@@ -10173,7 +10169,7 @@ define('logger', ['env!env/print'], function (print) {
10173
10169
}
10174
10170
10175
10171
// Sync with *.json manifests.
10176
- exports.version = '2.7.0 ';
10172
+ exports.version = '2.7.2 ';
10177
10173
10178
10174
exports.tokenize = tokenize;
10179
10175
@@ -22480,6 +22476,33 @@ define('parse', ['./esprimaAdapter', 'lang'], function (esprima, lang) {
22480
22476
return name;
22481
22477
};
22482
22478
22479
+ /**
22480
+ * Finds all the named define module IDs in a file.
22481
+ */
22482
+ parse.getAllNamedDefines = function (fileContents, excludeMap) {
22483
+ var names = [];
22484
+ parse.recurse(esprima.parse(fileContents),
22485
+ function (callName, config, name, deps, node, factoryIdentifier, fnExpScope) {
22486
+ if (callName === 'define' && name) {
22487
+ if (!excludeMap.hasOwnProperty(name)) {
22488
+ names.push(name);
22489
+ }
22490
+ }
22491
+
22492
+ //If a UMD definition that points to a factory that is an Identifier,
22493
+ //indicate processing should not traverse inside the UMD definition.
22494
+ if (callName === 'define' && factoryIdentifier && hasProp(fnExpScope, factoryIdentifier)) {
22495
+ return factoryIdentifier;
22496
+ }
22497
+
22498
+ //If define was found, no need to dive deeper, unless
22499
+ //the config explicitly wants to dig deeper.
22500
+ return true;
22501
+ }, {});
22502
+
22503
+ return names;
22504
+ };
22505
+
22483
22506
/**
22484
22507
* Determines if define(), require({}|[]) or requirejs was called in the
22485
22508
* file. Also finds out if define() is declared and if define.amd is called.
@@ -25408,17 +25431,36 @@ define('build', function (require) {
25408
25431
}));
25409
25432
}
25410
25433
}).then(function () {
25411
- var moduleName, outOrigSourceMap;
25434
+ var moduleName, outOrigSourceMap,
25435
+ bundlesConfig = {},
25436
+ bundlesConfigOutFile = config.bundlesConfigOutFile;
25437
+
25412
25438
if (modules) {
25413
25439
//Now move the build layers to their final position.
25414
25440
modules.forEach(function (module) {
25415
- var finalPath = module._buildPath;
25441
+ var entryConfig,
25442
+ finalPath = module._buildPath;
25443
+
25416
25444
if (finalPath !== 'FUNCTION') {
25417
25445
if (file.exists(finalPath)) {
25418
25446
file.deleteFile(finalPath);
25419
25447
}
25420
25448
file.renameFile(finalPath + '-temp', finalPath);
25421
25449
25450
+ //If bundles config should be written out, scan the
25451
+ //built file for module IDs. Favor doing this reparse
25452
+ //since tracking the IDs as the file is built has some
25453
+ //edge cases around files that had more than one ID in
25454
+ //them already, and likely loader plugin-written contents.
25455
+ if (bundlesConfigOutFile) {
25456
+ entryConfig = bundlesConfig[module.name] = [];
25457
+ var bundleContents = file.readFile(finalPath);
25458
+ var excludeMap = {};
25459
+ excludeMap[module.name] = true;
25460
+ var parsedIds = parse.getAllNamedDefines(bundleContents, excludeMap);
25461
+ entryConfig.push.apply(entryConfig, parsedIds);
25462
+ }
25463
+
25422
25464
//And finally, if removeCombined is specified, remove
25423
25465
//any of the files that were used in this layer.
25424
25466
//Be sure not to remove other build layers.
@@ -25445,6 +25487,24 @@ define('build', function (require) {
25445
25487
config.onModuleBundleComplete(module.onCompleteData);
25446
25488
}
25447
25489
});
25490
+
25491
+ //Write out bundles config, if it is wanted.
25492
+ if (bundlesConfigOutFile) {
25493
+ var text = file.readFile(bundlesConfigOutFile);
25494
+ text = transform.modifyConfig(text, function (config) {
25495
+ if (!config.bundles) {
25496
+ config.bundles = {};
25497
+ }
25498
+
25499
+ lang.eachProp(bundlesConfig, function (value, prop) {
25500
+ config.bundles[prop] = value;
25501
+ });
25502
+
25503
+ return config;
25504
+ });
25505
+
25506
+ file.saveUtf8File(bundlesConfigOutFile, text);
25507
+ }
25448
25508
}
25449
25509
25450
25510
//If removeCombined in play, remove any empty directories that
@@ -26131,6 +26191,13 @@ define('build', function (require) {
26131
26191
config.dirBaseUrl = endsWithSlash(config.dirBaseUrl);
26132
26192
}
26133
26193
26194
+ if (config.bundlesConfigOutFile) {
26195
+ if (!config.dir) {
26196
+ throw new Error('bundlesConfigOutFile can only be used with optimizations ' +
26197
+ 'that use "dir".');
26198
+ }
26199
+ config.bundlesConfigOutFile = build.makeAbsPath(config.bundlesConfigOutFile, config.dir);
26200
+ }
26134
26201
26135
26202
//If out=stdout, write output to STDOUT instead of a file.
26136
26203
if (config.out && config.out === 'stdout') {
0 commit comments