rollup 0.57.0 → 0.57.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/bin/rollup +147 -158
- package/dist/rollup.browser.js +478 -507
- package/dist/rollup.es.js +485 -514
- package/dist/rollup.js +485 -514
- package/dist/typings/Graph.d.ts +1 -2
- package/dist/typings/rollup/index.d.ts +0 -1
- package/dist/typings/utils/collapseSourcemaps.d.ts +2 -2
- package/dist/typings/utils/mergeOptions.d.ts +4 -1
- package/package.json +2 -2
package/dist/rollup.browser.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Rollup.js v0.57.
|
|
3
|
-
|
|
2
|
+
Rollup.js v0.57.1
|
|
3
|
+
Sat, 17 Mar 2018 08:30:04 GMT - commit 23256e40cfaddf96fef80edd2fa35f194ff05a62
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
@@ -384,7 +384,12 @@ function deprecateOptions(options, deprecateConfig) {
|
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
386
|
|
|
387
|
-
function
|
|
387
|
+
var createGetOption = function (config, command) { return function (name, defaultValue) {
|
|
388
|
+
return command[name] !== undefined
|
|
389
|
+
? command[name]
|
|
390
|
+
: config[name] !== undefined ? config[name] : defaultValue;
|
|
391
|
+
}; };
|
|
392
|
+
var normalizeObjectOptionValue = function (optionValue) {
|
|
388
393
|
if (!optionValue) {
|
|
389
394
|
return optionValue;
|
|
390
395
|
}
|
|
@@ -392,7 +397,17 @@ function normalizeObjectOptionValue(optionValue) {
|
|
|
392
397
|
return {};
|
|
393
398
|
}
|
|
394
399
|
return optionValue;
|
|
395
|
-
}
|
|
400
|
+
};
|
|
401
|
+
var getObjectOption = function (config, command, name) {
|
|
402
|
+
var commandOption = normalizeObjectOptionValue(command[name]);
|
|
403
|
+
var configOption = normalizeObjectOptionValue(config[name]);
|
|
404
|
+
if (commandOption !== undefined) {
|
|
405
|
+
return commandOption && configOption
|
|
406
|
+
? Object.assign({}, configOption, commandOption)
|
|
407
|
+
: commandOption;
|
|
408
|
+
}
|
|
409
|
+
return configOption;
|
|
410
|
+
};
|
|
396
411
|
var defaultOnWarn = function (warning) {
|
|
397
412
|
if (typeof warning === 'string') {
|
|
398
413
|
console.warn(warning); // eslint-disable-line no-console
|
|
@@ -401,148 +416,147 @@ var defaultOnWarn = function (warning) {
|
|
|
401
416
|
console.warn(warning.message); // eslint-disable-line no-console
|
|
402
417
|
}
|
|
403
418
|
};
|
|
419
|
+
var getOnWarn = function (config, command, defaultOnWarnHandler) {
|
|
420
|
+
if (defaultOnWarnHandler === void 0) { defaultOnWarnHandler = defaultOnWarn; }
|
|
421
|
+
return command.silent
|
|
422
|
+
? function () { }
|
|
423
|
+
: config.onwarn
|
|
424
|
+
? function (warning) { return config.onwarn(warning, defaultOnWarnHandler); }
|
|
425
|
+
: defaultOnWarnHandler;
|
|
426
|
+
};
|
|
427
|
+
var getExternal = function (config, command) {
|
|
428
|
+
var configExternal = config.external;
|
|
429
|
+
return typeof configExternal === 'function'
|
|
430
|
+
? function (id) {
|
|
431
|
+
var rest = [];
|
|
432
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
433
|
+
rest[_i - 1] = arguments[_i];
|
|
434
|
+
}
|
|
435
|
+
return configExternal.apply(void 0, [id].concat(rest)) || command.external.indexOf(id) !== -1;
|
|
436
|
+
}
|
|
437
|
+
: (configExternal || []).concat(command.external);
|
|
438
|
+
};
|
|
439
|
+
var commandAliases = {
|
|
440
|
+
c: 'config',
|
|
441
|
+
d: 'indent',
|
|
442
|
+
e: 'external',
|
|
443
|
+
f: 'format',
|
|
444
|
+
g: 'globals',
|
|
445
|
+
h: 'help',
|
|
446
|
+
i: 'input',
|
|
447
|
+
l: 'legacy',
|
|
448
|
+
m: 'sourcemap',
|
|
449
|
+
n: 'name',
|
|
450
|
+
o: 'file',
|
|
451
|
+
v: 'version',
|
|
452
|
+
w: 'watch'
|
|
453
|
+
};
|
|
404
454
|
function mergeOptions(_a) {
|
|
405
|
-
var
|
|
406
|
-
var deprecations = deprecate(config,
|
|
407
|
-
var
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
455
|
+
var _b = _a.config, config = _b === void 0 ? {} : _b, _c = _a.command, rawCommandOptions = _c === void 0 ? {} : _c, deprecateConfig = _a.deprecateConfig, defaultOnWarnHandler = _a.defaultOnWarnHandler;
|
|
456
|
+
var deprecations = deprecate(config, rawCommandOptions, deprecateConfig);
|
|
457
|
+
var command = getCommandOptions(rawCommandOptions);
|
|
458
|
+
var inputOptions = getInputOptions(config, command, defaultOnWarnHandler);
|
|
459
|
+
if (command.output) {
|
|
460
|
+
Object.assign(command, command.output);
|
|
461
|
+
}
|
|
462
|
+
var normalizedOutputOptions = ensureArray(config.output);
|
|
463
|
+
if (normalizedOutputOptions.length === 0)
|
|
464
|
+
normalizedOutputOptions.push({});
|
|
465
|
+
var outputOptions = normalizedOutputOptions.map(function (singleOutputOptions) {
|
|
466
|
+
return getOutputOptions(singleOutputOptions, command);
|
|
467
|
+
});
|
|
468
|
+
var unknownOptionErrors = [];
|
|
469
|
+
var validInputOptions = Object.keys(inputOptions);
|
|
470
|
+
addUnknownOptionErrors(unknownOptionErrors, Object.keys(config), validInputOptions, 'input option', /^output$/);
|
|
471
|
+
var validOutputOptions = Object.keys(outputOptions[0]);
|
|
472
|
+
addUnknownOptionErrors(unknownOptionErrors, outputOptions.reduce(function (allKeys, options) { return allKeys.concat(Object.keys(options)); }, []), validOutputOptions, 'output option');
|
|
473
|
+
addUnknownOptionErrors(unknownOptionErrors, Object.keys(command), validInputOptions.concat(validOutputOptions, Object.keys(commandAliases), 'config', 'environment', 'silent'), 'CLI flag', /^_|output|(config.*)$/);
|
|
474
|
+
return {
|
|
475
|
+
inputOptions: inputOptions,
|
|
476
|
+
outputOptions: outputOptions,
|
|
477
|
+
deprecations: deprecations,
|
|
478
|
+
optionError: unknownOptionErrors.length > 0 ? unknownOptionErrors.join('\n') : null
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
function addUnknownOptionErrors(errors, options, validOptions, optionType, ignoredKeys) {
|
|
482
|
+
if (ignoredKeys === void 0) { ignoredKeys = /$./; }
|
|
483
|
+
var unknownOptions = options.filter(function (key) { return validOptions.indexOf(key) === -1 && !ignoredKeys.test(key); });
|
|
484
|
+
if (unknownOptions.length > 0)
|
|
485
|
+
errors.push("Unknown " + optionType + ": " + unknownOptions.join(', ') + ". Allowed options: " + validOptions.sort().join(', '));
|
|
486
|
+
}
|
|
487
|
+
function getCommandOptions(rawCommandOptions) {
|
|
488
|
+
var command = Object.assign({}, rawCommandOptions);
|
|
489
|
+
command.external = (rawCommandOptions.external || '').split(',');
|
|
490
|
+
if (rawCommandOptions.globals) {
|
|
491
|
+
command.globals = Object.create(null);
|
|
492
|
+
rawCommandOptions.globals.split(',').forEach(function (str) {
|
|
493
|
+
var names = str.split(':');
|
|
494
|
+
command.globals[names[0]] = names[1];
|
|
495
|
+
// Add missing Module IDs to external.
|
|
496
|
+
if (command.external.indexOf(names[0]) === -1) {
|
|
497
|
+
command.external.push(names[0]);
|
|
498
|
+
}
|
|
499
|
+
});
|
|
429
500
|
}
|
|
501
|
+
return command;
|
|
502
|
+
}
|
|
503
|
+
function getInputOptions(config, command, defaultOnWarnHandler) {
|
|
504
|
+
if (command === void 0) { command = {}; }
|
|
505
|
+
var getOption = createGetOption(config, command);
|
|
430
506
|
var inputOptions = {
|
|
431
507
|
acorn: config.acorn,
|
|
432
508
|
acornInjectPlugins: config.acornInjectPlugins,
|
|
433
|
-
cache:
|
|
509
|
+
cache: getOption('cache'),
|
|
434
510
|
context: config.context,
|
|
435
|
-
experimentalCodeSplitting:
|
|
436
|
-
experimentalDynamicImport:
|
|
437
|
-
experimentalPreserveModules:
|
|
438
|
-
|
|
439
|
-
|
|
511
|
+
experimentalCodeSplitting: getOption('experimentalCodeSplitting'),
|
|
512
|
+
experimentalDynamicImport: getOption('experimentalDynamicImport'),
|
|
513
|
+
experimentalPreserveModules: getOption('experimentalPreserveModules'),
|
|
514
|
+
external: getExternal(config, command),
|
|
515
|
+
input: getOption('input'),
|
|
440
516
|
moduleContext: config.moduleContext,
|
|
441
|
-
onwarn:
|
|
442
|
-
perf:
|
|
517
|
+
onwarn: getOnWarn(config, command, defaultOnWarnHandler),
|
|
518
|
+
perf: getOption('perf', false),
|
|
443
519
|
plugins: config.plugins,
|
|
444
|
-
preferConst:
|
|
445
|
-
preserveSymlinks:
|
|
446
|
-
treeshake: getObjectOption('treeshake'),
|
|
520
|
+
preferConst: getOption('preferConst'),
|
|
521
|
+
preserveSymlinks: getOption('preserveSymlinks'),
|
|
522
|
+
treeshake: getObjectOption(config, command, 'treeshake'),
|
|
447
523
|
watch: config.watch
|
|
448
524
|
};
|
|
449
|
-
// legacy, to ensure e.g. commonjs plugin still works
|
|
450
|
-
inputOptions.entry = inputOptions.input;
|
|
451
|
-
var commandExternal = (command.external || '').split(',');
|
|
452
|
-
var configExternal = config.external;
|
|
453
|
-
if (command.globals) {
|
|
454
|
-
var globals_1 = Object.create(null);
|
|
455
|
-
command.globals.split(',').forEach(function (str) {
|
|
456
|
-
var names = str.split(':');
|
|
457
|
-
globals_1[names[0]] = names[1];
|
|
458
|
-
// Add missing Module IDs to external.
|
|
459
|
-
if (commandExternal.indexOf(names[0]) === -1) {
|
|
460
|
-
commandExternal.push(names[0]);
|
|
461
|
-
}
|
|
462
|
-
});
|
|
463
|
-
command.globals = globals_1;
|
|
464
|
-
}
|
|
465
|
-
if (typeof configExternal === 'function') {
|
|
466
|
-
inputOptions.external = function (id) {
|
|
467
|
-
var rest = [];
|
|
468
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
469
|
-
rest[_i - 1] = arguments[_i];
|
|
470
|
-
}
|
|
471
|
-
return configExternal.apply(void 0, [id].concat(rest)) || commandExternal.indexOf(id) !== -1;
|
|
472
|
-
};
|
|
473
|
-
}
|
|
474
|
-
else {
|
|
475
|
-
inputOptions.external = (configExternal || []).concat(commandExternal);
|
|
476
|
-
}
|
|
477
|
-
if (command.silent) {
|
|
478
|
-
inputOptions.onwarn = function () { };
|
|
479
|
-
}
|
|
480
|
-
// Make sure the CLI treats this the same way as when we are code-splitting
|
|
481
525
|
if (inputOptions.experimentalPreserveModules && !Array.isArray(inputOptions.input)) {
|
|
482
526
|
inputOptions.input = [inputOptions.input];
|
|
483
527
|
}
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
freeze: getOutputOption('freeze'),
|
|
494
|
-
globals: getOutputOption('globals'),
|
|
495
|
-
indent: getOutputOption('indent'),
|
|
496
|
-
interop: getOutputOption('interop'),
|
|
497
|
-
intro: getOutputOption('intro'),
|
|
498
|
-
legacy: getOutputOption('legacy'),
|
|
499
|
-
name: getOutputOption('name'),
|
|
500
|
-
namespaceToStringTag: getOutputOption('namespaceToStringTag'),
|
|
501
|
-
noConflict: getOutputOption('noConflict'),
|
|
502
|
-
outro: getOutputOption('outro'),
|
|
503
|
-
paths: getOutputOption('paths'),
|
|
504
|
-
sourcemap: getOutputOption('sourcemap'),
|
|
505
|
-
sourcemapFile: getOutputOption('sourcemapFile'),
|
|
506
|
-
strict: getOutputOption('strict')
|
|
507
|
-
};
|
|
508
|
-
var mergedOutputOptions;
|
|
509
|
-
if (Array.isArray(config.output)) {
|
|
510
|
-
mergedOutputOptions = config.output.map(function (output) {
|
|
511
|
-
return Object.assign({}, output, command.output);
|
|
512
|
-
});
|
|
513
|
-
}
|
|
514
|
-
else if (config.output && command.output) {
|
|
515
|
-
mergedOutputOptions = [Object.assign({}, config.output, command.output)];
|
|
516
|
-
}
|
|
517
|
-
else {
|
|
518
|
-
mergedOutputOptions =
|
|
519
|
-
command.output || config.output
|
|
520
|
-
? ensureArray(command.output || config.output)
|
|
521
|
-
: [
|
|
522
|
-
{
|
|
523
|
-
file: command.output ? command.output.file : null,
|
|
524
|
-
format: command.output ? command.output.format : null
|
|
525
|
-
}
|
|
526
|
-
];
|
|
527
|
-
}
|
|
528
|
-
var outputOptions = mergedOutputOptions.map(function (output) {
|
|
529
|
-
return Object.assign({}, baseOutputOptions, output);
|
|
530
|
-
});
|
|
531
|
-
// check for errors
|
|
532
|
-
var validKeys = Object.keys(inputOptions).concat(Object.keys(baseOutputOptions), [
|
|
533
|
-
'pureExternalModules' // (backward compatibility) till everyone moves to treeshake.pureExternalModules
|
|
534
|
-
]);
|
|
535
|
-
var outputOptionKeys = Array.isArray(config.output)
|
|
536
|
-
? config.output.reduce(function (keys, o) { return keys.concat(Object.keys(o)); }, [])
|
|
537
|
-
: Object.keys(config.output || {});
|
|
538
|
-
var errors = Object.keys(config || {}).concat(outputOptionKeys).filter(function (k) { return k !== 'output' && validKeys.indexOf(k) === -1; });
|
|
528
|
+
// legacy to make sure certain plugins still work
|
|
529
|
+
inputOptions.entry = Array.isArray(inputOptions.input)
|
|
530
|
+
? inputOptions.input[0]
|
|
531
|
+
: inputOptions.input;
|
|
532
|
+
return inputOptions;
|
|
533
|
+
}
|
|
534
|
+
function getOutputOptions(config, command) {
|
|
535
|
+
if (command === void 0) { command = {}; }
|
|
536
|
+
var getOption = createGetOption(config, command);
|
|
539
537
|
return {
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
538
|
+
amd: Object.assign({}, config.amd, command.amd),
|
|
539
|
+
banner: getOption('banner'),
|
|
540
|
+
dir: getOption('dir'),
|
|
541
|
+
exports: getOption('exports'),
|
|
542
|
+
extend: getOption('extend'),
|
|
543
|
+
file: getOption('file'),
|
|
544
|
+
footer: getOption('footer'),
|
|
545
|
+
format: getOption('format'),
|
|
546
|
+
freeze: getOption('freeze'),
|
|
547
|
+
globals: getOption('globals'),
|
|
548
|
+
indent: getOption('indent', true),
|
|
549
|
+
interop: getOption('interop', true),
|
|
550
|
+
intro: getOption('intro'),
|
|
551
|
+
legacy: getOption('legacy', false),
|
|
552
|
+
name: getOption('name'),
|
|
553
|
+
namespaceToStringTag: getOption('namespaceToStringTag'),
|
|
554
|
+
noConflict: getOption('noConflict'),
|
|
555
|
+
outro: getOption('outro'),
|
|
556
|
+
paths: getOption('paths'),
|
|
557
|
+
sourcemap: getOption('sourcemap'),
|
|
558
|
+
sourcemapFile: getOption('sourcemapFile'),
|
|
559
|
+
strict: getOption('strict', true)
|
|
546
560
|
};
|
|
547
561
|
}
|
|
548
562
|
function deprecate(config, command, deprecateConfig) {
|
|
@@ -560,17 +574,10 @@ function deprecate(config, command, deprecateConfig) {
|
|
|
560
574
|
if (typeof command.output === 'string') {
|
|
561
575
|
deprecations.push({
|
|
562
576
|
old: '--output',
|
|
563
|
-
new: '--
|
|
577
|
+
new: '--file'
|
|
564
578
|
});
|
|
565
579
|
command.output = { file: command.output };
|
|
566
580
|
}
|
|
567
|
-
if (command.format) {
|
|
568
|
-
deprecations.push({
|
|
569
|
-
old: '--format',
|
|
570
|
-
new: '--output.format'
|
|
571
|
-
});
|
|
572
|
-
(command.output || (command.output = {})).format = command.format;
|
|
573
|
-
}
|
|
574
581
|
// config file
|
|
575
582
|
deprecations.push.apply(deprecations, deprecateOptions(config, deprecateConfig));
|
|
576
583
|
return deprecations;
|
|
@@ -6013,48 +6020,56 @@ function first(candidates) {
|
|
|
6013
6020
|
};
|
|
6014
6021
|
}
|
|
6015
6022
|
|
|
6016
|
-
var
|
|
6017
|
-
|
|
6018
|
-
|
|
6019
|
-
|
|
6020
|
-
|
|
6021
|
-
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
|
|
6025
|
-
|
|
6026
|
-
|
|
6027
|
-
|
|
6028
|
-
|
|
6029
|
-
|
|
6030
|
-
|
|
6031
|
-
|
|
6032
|
-
|
|
6033
|
-
|
|
6034
|
-
|
|
6023
|
+
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
6024
|
+
function encode(decoded) {
|
|
6025
|
+
var sourceFileIndex = 0; // second field
|
|
6026
|
+
var sourceCodeLine = 0; // third field
|
|
6027
|
+
var sourceCodeColumn = 0; // fourth field
|
|
6028
|
+
var nameIndex = 0; // fifth field
|
|
6029
|
+
var mappings = '';
|
|
6030
|
+
for (var i = 0; i < decoded.length; i++) {
|
|
6031
|
+
var line = decoded[i];
|
|
6032
|
+
if (i > 0)
|
|
6033
|
+
mappings += ';';
|
|
6034
|
+
if (line.length === 0)
|
|
6035
|
+
continue;
|
|
6036
|
+
var generatedCodeColumn = 0; // first field
|
|
6037
|
+
var lineMappings = [];
|
|
6038
|
+
for (var _i = 0, line_1 = line; _i < line_1.length; _i++) {
|
|
6039
|
+
var segment = line_1[_i];
|
|
6040
|
+
var segmentMappings = encodeInteger(segment[0] - generatedCodeColumn);
|
|
6041
|
+
generatedCodeColumn = segment[0];
|
|
6042
|
+
if (segment.length > 1) {
|
|
6043
|
+
segmentMappings +=
|
|
6044
|
+
encodeInteger(segment[1] - sourceFileIndex) +
|
|
6045
|
+
encodeInteger(segment[2] - sourceCodeLine) +
|
|
6046
|
+
encodeInteger(segment[3] - sourceCodeColumn);
|
|
6047
|
+
sourceFileIndex = segment[1];
|
|
6048
|
+
sourceCodeLine = segment[2];
|
|
6049
|
+
sourceCodeColumn = segment[3];
|
|
6050
|
+
}
|
|
6051
|
+
if (segment.length === 5) {
|
|
6052
|
+
segmentMappings += encodeInteger(segment[4] - nameIndex);
|
|
6053
|
+
nameIndex = segment[4];
|
|
6054
|
+
}
|
|
6055
|
+
lineMappings.push(segmentMappings);
|
|
6056
|
+
}
|
|
6057
|
+
mappings += lineMappings.join(',');
|
|
6058
|
+
}
|
|
6059
|
+
return mappings;
|
|
6035
6060
|
}
|
|
6036
|
-
|
|
6037
|
-
|
|
6038
|
-
|
|
6039
|
-
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
|
|
6044
|
-
|
|
6045
|
-
|
|
6046
|
-
|
|
6047
|
-
|
|
6048
|
-
num >>= 5;
|
|
6049
|
-
|
|
6050
|
-
if ( num > 0 ) {
|
|
6051
|
-
clamped |= 32;
|
|
6052
|
-
}
|
|
6053
|
-
|
|
6054
|
-
result += integerToChar[ clamped ];
|
|
6055
|
-
} while ( num > 0 );
|
|
6056
|
-
|
|
6057
|
-
return result;
|
|
6061
|
+
function encodeInteger(num) {
|
|
6062
|
+
var result = '';
|
|
6063
|
+
num = num < 0 ? (-num << 1) | 1 : num << 1;
|
|
6064
|
+
do {
|
|
6065
|
+
var clamped = num & 31;
|
|
6066
|
+
num >>= 5;
|
|
6067
|
+
if (num > 0) {
|
|
6068
|
+
clamped |= 32;
|
|
6069
|
+
}
|
|
6070
|
+
result += chars[clamped];
|
|
6071
|
+
} while (num > 0);
|
|
6072
|
+
return result;
|
|
6058
6073
|
}
|
|
6059
6074
|
|
|
6060
6075
|
function Chunk ( start, end, content ) {
|
|
@@ -6235,7 +6250,7 @@ function SourceMap ( properties ) {
|
|
|
6235
6250
|
this.sources = properties.sources;
|
|
6236
6251
|
this.sourcesContent = properties.sourcesContent;
|
|
6237
6252
|
this.names = properties.names;
|
|
6238
|
-
this.mappings = properties.mappings;
|
|
6253
|
+
this.mappings = encode(properties.mappings);
|
|
6239
6254
|
}
|
|
6240
6255
|
|
|
6241
6256
|
SourceMap.prototype = {
|
|
@@ -6301,51 +6316,33 @@ function isObject ( thing ) {
|
|
|
6301
6316
|
|
|
6302
6317
|
function getLocator ( source ) {
|
|
6303
6318
|
var originalLines = source.split( '\n' );
|
|
6319
|
+
var lineOffsets = [];
|
|
6304
6320
|
|
|
6305
|
-
var
|
|
6306
|
-
|
|
6307
|
-
|
|
6308
|
-
var range = { start: start, end: end, line: i };
|
|
6309
|
-
|
|
6310
|
-
start = end;
|
|
6311
|
-
return range;
|
|
6312
|
-
});
|
|
6313
|
-
|
|
6314
|
-
var i = 0;
|
|
6315
|
-
|
|
6316
|
-
function rangeContains ( range, index ) {
|
|
6317
|
-
return range.start <= index && index < range.end;
|
|
6318
|
-
}
|
|
6319
|
-
|
|
6320
|
-
function getLocation ( range, index ) {
|
|
6321
|
-
return { line: range.line, column: index - range.start };
|
|
6321
|
+
for ( var i = 0, pos = 0; i < originalLines.length; i++ ) {
|
|
6322
|
+
lineOffsets.push( pos );
|
|
6323
|
+
pos += originalLines[i].length + 1;
|
|
6322
6324
|
}
|
|
6323
6325
|
|
|
6324
6326
|
return function locate ( index ) {
|
|
6325
|
-
var
|
|
6326
|
-
|
|
6327
|
-
|
|
6328
|
-
|
|
6329
|
-
|
|
6330
|
-
|
|
6331
|
-
|
|
6332
|
-
|
|
6333
|
-
|
|
6327
|
+
var i = 0;
|
|
6328
|
+
var j = lineOffsets.length;
|
|
6329
|
+
while ( i < j ) {
|
|
6330
|
+
var m = ( i + j ) >> 1;
|
|
6331
|
+
if ( index < lineOffsets[m] ) {
|
|
6332
|
+
j = m;
|
|
6333
|
+
} else {
|
|
6334
|
+
i = m + 1;
|
|
6335
|
+
}
|
|
6334
6336
|
}
|
|
6337
|
+
var line = i - 1;
|
|
6338
|
+
var column = index - lineOffsets[line];
|
|
6339
|
+
return { line: line, column: column };
|
|
6335
6340
|
};
|
|
6336
6341
|
}
|
|
6337
6342
|
|
|
6338
6343
|
function Mappings ( hires ) {
|
|
6339
6344
|
var this$1 = this;
|
|
6340
6345
|
|
|
6341
|
-
var offsets = {
|
|
6342
|
-
generatedCodeColumn: 0,
|
|
6343
|
-
sourceIndex: 0,
|
|
6344
|
-
sourceCodeLine: 0,
|
|
6345
|
-
sourceCodeColumn: 0,
|
|
6346
|
-
sourceCodeName: 0
|
|
6347
|
-
};
|
|
6348
|
-
|
|
6349
6346
|
var generatedCodeLine = 0;
|
|
6350
6347
|
var generatedCodeColumn = 0;
|
|
6351
6348
|
|
|
@@ -6354,14 +6351,18 @@ function Mappings ( hires ) {
|
|
|
6354
6351
|
|
|
6355
6352
|
var pending = null;
|
|
6356
6353
|
|
|
6357
|
-
this.addEdit = function ( sourceIndex, content,
|
|
6354
|
+
this.addEdit = function ( sourceIndex, content, loc, nameIndex ) {
|
|
6358
6355
|
if ( content.length ) {
|
|
6359
|
-
|
|
6356
|
+
var segment = [
|
|
6360
6357
|
generatedCodeColumn,
|
|
6361
6358
|
sourceIndex,
|
|
6362
6359
|
loc.line,
|
|
6363
|
-
loc.column
|
|
6364
|
-
|
|
6360
|
+
loc.column
|
|
6361
|
+
];
|
|
6362
|
+
if ( nameIndex >= 0 ) {
|
|
6363
|
+
segment.push( nameIndex );
|
|
6364
|
+
}
|
|
6365
|
+
rawSegments.push( segment );
|
|
6365
6366
|
} else if ( pending ) {
|
|
6366
6367
|
rawSegments.push( pending );
|
|
6367
6368
|
}
|
|
@@ -6380,8 +6381,7 @@ function Mappings ( hires ) {
|
|
|
6380
6381
|
generatedCodeColumn,
|
|
6381
6382
|
sourceIndex,
|
|
6382
6383
|
loc.line,
|
|
6383
|
-
loc.column
|
|
6384
|
-
-1
|
|
6384
|
+
loc.column
|
|
6385
6385
|
]);
|
|
6386
6386
|
}
|
|
6387
6387
|
|
|
@@ -6404,50 +6404,24 @@ function Mappings ( hires ) {
|
|
|
6404
6404
|
generatedCodeColumn,
|
|
6405
6405
|
sourceIndex,
|
|
6406
6406
|
loc.line,
|
|
6407
|
-
loc.column
|
|
6408
|
-
|
|
6407
|
+
loc.column
|
|
6408
|
+
];
|
|
6409
6409
|
};
|
|
6410
6410
|
|
|
6411
6411
|
this.advance = function (str) {
|
|
6412
6412
|
if ( !str ) { return; }
|
|
6413
6413
|
|
|
6414
6414
|
var lines = str.split( '\n' );
|
|
6415
|
-
var lastLine = lines.pop();
|
|
6416
6415
|
|
|
6417
|
-
if ( lines.length ) {
|
|
6418
|
-
|
|
6419
|
-
|
|
6420
|
-
|
|
6421
|
-
|
|
6422
|
-
generatedCodeColumn
|
|
6416
|
+
if ( lines.length > 1 ) {
|
|
6417
|
+
for ( var i = 0; i < lines.length - 1; i++ ) {
|
|
6418
|
+
generatedCodeLine++;
|
|
6419
|
+
this$1.raw[generatedCodeLine] = rawSegments = [];
|
|
6420
|
+
}
|
|
6421
|
+
generatedCodeColumn = 0;
|
|
6423
6422
|
}
|
|
6424
|
-
};
|
|
6425
6423
|
|
|
6426
|
-
|
|
6427
|
-
return this$1.raw.map( function (segments) {
|
|
6428
|
-
var generatedCodeColumn = 0;
|
|
6429
|
-
|
|
6430
|
-
return segments.map( function (segment) {
|
|
6431
|
-
var arr = [
|
|
6432
|
-
segment[0] - generatedCodeColumn,
|
|
6433
|
-
segment[1] - offsets.sourceIndex,
|
|
6434
|
-
segment[2] - offsets.sourceCodeLine,
|
|
6435
|
-
segment[3] - offsets.sourceCodeColumn
|
|
6436
|
-
];
|
|
6437
|
-
|
|
6438
|
-
generatedCodeColumn = segment[0];
|
|
6439
|
-
offsets.sourceIndex = segment[1];
|
|
6440
|
-
offsets.sourceCodeLine = segment[2];
|
|
6441
|
-
offsets.sourceCodeColumn = segment[3];
|
|
6442
|
-
|
|
6443
|
-
if ( ~segment[4] ) {
|
|
6444
|
-
arr.push( segment[4] - offsets.sourceCodeName );
|
|
6445
|
-
offsets.sourceCodeName = segment[4];
|
|
6446
|
-
}
|
|
6447
|
-
|
|
6448
|
-
return encode( arr );
|
|
6449
|
-
}).join( ',' );
|
|
6450
|
-
}).join( ';' );
|
|
6424
|
+
generatedCodeColumn += lines[lines.length - 1].length;
|
|
6451
6425
|
};
|
|
6452
6426
|
}
|
|
6453
6427
|
|
|
@@ -6562,7 +6536,7 @@ MagicString$1.prototype = {
|
|
|
6562
6536
|
return cloned;
|
|
6563
6537
|
},
|
|
6564
6538
|
|
|
6565
|
-
|
|
6539
|
+
generateDecodedMap: function generateDecodedMap ( options ) {
|
|
6566
6540
|
var this$1 = this;
|
|
6567
6541
|
|
|
6568
6542
|
options = options || {};
|
|
@@ -6583,7 +6557,7 @@ MagicString$1.prototype = {
|
|
|
6583
6557
|
if ( chunk.intro.length ) { mappings.advance( chunk.intro ); }
|
|
6584
6558
|
|
|
6585
6559
|
if ( chunk.edited ) {
|
|
6586
|
-
mappings.addEdit( sourceIndex, chunk.content,
|
|
6560
|
+
mappings.addEdit( sourceIndex, chunk.content, loc, chunk.storeName ? names.indexOf( chunk.original ) : -1 );
|
|
6587
6561
|
} else {
|
|
6588
6562
|
mappings.addUneditedChunk( sourceIndex, chunk, this$1.original, loc, this$1.sourcemapLocations );
|
|
6589
6563
|
}
|
|
@@ -6591,14 +6565,17 @@ MagicString$1.prototype = {
|
|
|
6591
6565
|
if ( chunk.outro.length ) { mappings.advance( chunk.outro ); }
|
|
6592
6566
|
});
|
|
6593
6567
|
|
|
6594
|
-
|
|
6568
|
+
return {
|
|
6595
6569
|
file: ( options.file ? options.file.split( /[\/\\]/ ).pop() : null ),
|
|
6596
6570
|
sources: [ options.source ? getRelativePath( options.file || '', options.source ) : null ],
|
|
6597
6571
|
sourcesContent: options.includeContent ? [ this.original ] : [ null ],
|
|
6598
6572
|
names: names,
|
|
6599
|
-
mappings: mappings.
|
|
6600
|
-
}
|
|
6601
|
-
|
|
6573
|
+
mappings: mappings.raw
|
|
6574
|
+
};
|
|
6575
|
+
},
|
|
6576
|
+
|
|
6577
|
+
generateMap: function generateMap ( options ) {
|
|
6578
|
+
return new SourceMap(this.generateDecodedMap( options ));
|
|
6602
6579
|
},
|
|
6603
6580
|
|
|
6604
6581
|
getIndentString: function getIndentString () {
|
|
@@ -7138,7 +7115,7 @@ Bundle.prototype = {
|
|
|
7138
7115
|
return bundle;
|
|
7139
7116
|
},
|
|
7140
7117
|
|
|
7141
|
-
|
|
7118
|
+
generateDecodedMap: function generateDecodedMap ( options ) {
|
|
7142
7119
|
var this$1 = this;
|
|
7143
7120
|
if ( options === void 0 ) options = {};
|
|
7144
7121
|
|
|
@@ -7175,7 +7152,7 @@ Bundle.prototype = {
|
|
|
7175
7152
|
|
|
7176
7153
|
if ( source.filename ) {
|
|
7177
7154
|
if ( chunk.edited ) {
|
|
7178
|
-
mappings.addEdit( sourceIndex, chunk.content,
|
|
7155
|
+
mappings.addEdit( sourceIndex, chunk.content, loc, chunk.storeName ? names.indexOf( chunk.original ) : -1 );
|
|
7179
7156
|
} else {
|
|
7180
7157
|
mappings.addUneditedChunk( sourceIndex, chunk, magicString.original, loc, magicString.sourcemapLocations );
|
|
7181
7158
|
}
|
|
@@ -7193,7 +7170,7 @@ Bundle.prototype = {
|
|
|
7193
7170
|
}
|
|
7194
7171
|
});
|
|
7195
7172
|
|
|
7196
|
-
return
|
|
7173
|
+
return {
|
|
7197
7174
|
file: ( options.file ? options.file.split( /[\/\\]/ ).pop() : null ),
|
|
7198
7175
|
sources: this.uniqueSources.map( function (source) {
|
|
7199
7176
|
return options.file ? getRelativePath( options.file, source.filename ) : source.filename;
|
|
@@ -7202,8 +7179,12 @@ Bundle.prototype = {
|
|
|
7202
7179
|
return options.includeContent ? source.content : null;
|
|
7203
7180
|
}),
|
|
7204
7181
|
names: names,
|
|
7205
|
-
mappings: mappings.
|
|
7206
|
-
}
|
|
7182
|
+
mappings: mappings.raw
|
|
7183
|
+
};
|
|
7184
|
+
},
|
|
7185
|
+
|
|
7186
|
+
generateMap: function generateMap ( options ) {
|
|
7187
|
+
return new SourceMap(this.generateDecodedMap( options ));
|
|
7207
7188
|
},
|
|
7208
7189
|
|
|
7209
7190
|
getIndentString: function getIndentString () {
|
|
@@ -14835,7 +14816,11 @@ var ExportDefaultDeclaration = /** @class */ (function (_super) {
|
|
|
14835
14816
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
14836
14817
|
}
|
|
14837
14818
|
ExportDefaultDeclaration.prototype.bindNode = function () {
|
|
14838
|
-
if (this.declarationName
|
|
14819
|
+
if (this.declarationName &&
|
|
14820
|
+
// Do not set it for Class and FunctionExpressions otherwise they get treeshaken away
|
|
14821
|
+
(isFunctionDeclaration(this.declaration) ||
|
|
14822
|
+
isClassDeclaration(this.declaration) ||
|
|
14823
|
+
isIdentifier(this.declaration))) {
|
|
14839
14824
|
this.variable.setOriginalVariable(this.scope.findVariable(this.declarationName));
|
|
14840
14825
|
}
|
|
14841
14826
|
};
|
|
@@ -16571,15 +16556,14 @@ var Module = /** @class */ (function () {
|
|
|
16571
16556
|
timeEnd('analyse ast', 3);
|
|
16572
16557
|
};
|
|
16573
16558
|
Module.prototype.removeExistingSourceMap = function () {
|
|
16574
|
-
var
|
|
16575
|
-
|
|
16559
|
+
for (var _i = 0, _a = this.comments; _i < _a.length; _i++) {
|
|
16560
|
+
var comment = _a[_i];
|
|
16576
16561
|
if (!comment.block && SOURCEMAPPING_URL_RE.test(comment.text)) {
|
|
16577
|
-
|
|
16562
|
+
this.magicString.remove(comment.start, comment.end);
|
|
16578
16563
|
}
|
|
16579
|
-
}
|
|
16564
|
+
}
|
|
16580
16565
|
};
|
|
16581
16566
|
Module.prototype.addExport = function (node) {
|
|
16582
|
-
var _this = this;
|
|
16583
16567
|
var source = node.source && node.source.value;
|
|
16584
16568
|
// export { name } from './other'
|
|
16585
16569
|
if (source) {
|
|
@@ -16591,21 +16575,22 @@ var Module = /** @class */ (function () {
|
|
|
16591
16575
|
this.exportAllSources.push(source);
|
|
16592
16576
|
}
|
|
16593
16577
|
else {
|
|
16594
|
-
node.specifiers.
|
|
16578
|
+
for (var _i = 0, _a = node.specifiers; _i < _a.length; _i++) {
|
|
16579
|
+
var specifier = _a[_i];
|
|
16595
16580
|
var name = specifier.exported.name;
|
|
16596
|
-
if (
|
|
16597
|
-
|
|
16581
|
+
if (this.exports[name] || this.reexports[name]) {
|
|
16582
|
+
this.error({
|
|
16598
16583
|
code: 'DUPLICATE_EXPORT',
|
|
16599
16584
|
message: "A module cannot have multiple exports with the same name ('" + name + "')"
|
|
16600
16585
|
}, specifier.start);
|
|
16601
16586
|
}
|
|
16602
|
-
|
|
16587
|
+
this.reexports[name] = {
|
|
16603
16588
|
start: specifier.start,
|
|
16604
16589
|
source: source,
|
|
16605
16590
|
localName: specifier.local.name,
|
|
16606
16591
|
module: null // filled in later
|
|
16607
16592
|
};
|
|
16608
|
-
}
|
|
16593
|
+
}
|
|
16609
16594
|
}
|
|
16610
16595
|
}
|
|
16611
16596
|
else if (node.type === NodeType.ExportDefaultDeclaration) {
|
|
@@ -16633,11 +16618,13 @@ var Module = /** @class */ (function () {
|
|
|
16633
16618
|
// export function foo () {}
|
|
16634
16619
|
var declaration = node.declaration;
|
|
16635
16620
|
if (declaration.type === NodeType.VariableDeclaration) {
|
|
16636
|
-
declaration.declarations.
|
|
16637
|
-
|
|
16638
|
-
|
|
16639
|
-
|
|
16640
|
-
|
|
16621
|
+
for (var _b = 0, _c = declaration.declarations; _b < _c.length; _b++) {
|
|
16622
|
+
var decl = _c[_b];
|
|
16623
|
+
for (var _d = 0, _e = extractNames(decl.id); _d < _e.length; _d++) {
|
|
16624
|
+
var localName = _e[_d];
|
|
16625
|
+
this.exports[localName] = { localName: localName };
|
|
16626
|
+
}
|
|
16627
|
+
}
|
|
16641
16628
|
}
|
|
16642
16629
|
else {
|
|
16643
16630
|
// export function foo () {}
|
|
@@ -16647,28 +16634,29 @@ var Module = /** @class */ (function () {
|
|
|
16647
16634
|
}
|
|
16648
16635
|
else {
|
|
16649
16636
|
// export { foo, bar, baz }
|
|
16650
|
-
node.specifiers.
|
|
16637
|
+
for (var _f = 0, _g = node.specifiers; _f < _g.length; _f++) {
|
|
16638
|
+
var specifier = _g[_f];
|
|
16651
16639
|
var localName = specifier.local.name;
|
|
16652
16640
|
var exportedName = specifier.exported.name;
|
|
16653
|
-
if (
|
|
16654
|
-
|
|
16641
|
+
if (this.exports[exportedName] || this.reexports[exportedName]) {
|
|
16642
|
+
this.error({
|
|
16655
16643
|
code: 'DUPLICATE_EXPORT',
|
|
16656
16644
|
message: "A module cannot have multiple exports with the same name ('" + exportedName + "')"
|
|
16657
16645
|
}, specifier.start);
|
|
16658
16646
|
}
|
|
16659
|
-
|
|
16660
|
-
}
|
|
16647
|
+
this.exports[exportedName] = { localName: localName };
|
|
16648
|
+
}
|
|
16661
16649
|
}
|
|
16662
16650
|
};
|
|
16663
16651
|
Module.prototype.addImport = function (node) {
|
|
16664
|
-
var _this = this;
|
|
16665
16652
|
var source = node.source.value;
|
|
16666
16653
|
if (this.sources.indexOf(source) === -1)
|
|
16667
16654
|
this.sources.push(source);
|
|
16668
|
-
node.specifiers.
|
|
16655
|
+
for (var _i = 0, _a = node.specifiers; _i < _a.length; _i++) {
|
|
16656
|
+
var specifier = _a[_i];
|
|
16669
16657
|
var localName = specifier.local.name;
|
|
16670
|
-
if (
|
|
16671
|
-
|
|
16658
|
+
if (this.imports[localName]) {
|
|
16659
|
+
this.error({
|
|
16672
16660
|
code: 'DUPLICATE_IMPORT',
|
|
16673
16661
|
message: "Duplicated import '" + localName + "'"
|
|
16674
16662
|
}, specifier.start);
|
|
@@ -16678,21 +16666,21 @@ var Module = /** @class */ (function () {
|
|
|
16678
16666
|
var name = isDefault
|
|
16679
16667
|
? 'default'
|
|
16680
16668
|
: isNamespace ? '*' : specifier.imported.name;
|
|
16681
|
-
|
|
16682
|
-
}
|
|
16669
|
+
this.imports[localName] = { source: source, specifier: specifier, name: name, module: null };
|
|
16670
|
+
}
|
|
16683
16671
|
};
|
|
16684
16672
|
Module.prototype.analyse = function () {
|
|
16685
|
-
var _this = this;
|
|
16686
16673
|
enhance(this.ast, this, this.dynamicImports);
|
|
16687
|
-
this.ast.body.
|
|
16674
|
+
for (var _i = 0, _a = this.ast.body; _i < _a.length; _i++) {
|
|
16675
|
+
var node = _a[_i];
|
|
16688
16676
|
if (node.isImportDeclaration) {
|
|
16689
|
-
|
|
16677
|
+
this.addImport(node);
|
|
16690
16678
|
}
|
|
16691
16679
|
else if (node
|
|
16692
16680
|
.isExportDeclaration) {
|
|
16693
|
-
|
|
16681
|
+
this.addExport(node);
|
|
16694
16682
|
}
|
|
16695
|
-
}
|
|
16683
|
+
}
|
|
16696
16684
|
};
|
|
16697
16685
|
Module.prototype.basename = function () {
|
|
16698
16686
|
var base = basename(this.id);
|
|
@@ -16700,17 +16688,18 @@ var Module = /** @class */ (function () {
|
|
|
16700
16688
|
return makeLegal(ext ? base.slice(0, -ext.length) : base);
|
|
16701
16689
|
};
|
|
16702
16690
|
Module.prototype.markExports = function () {
|
|
16703
|
-
var
|
|
16704
|
-
|
|
16705
|
-
var variable =
|
|
16706
|
-
variable.exportName =
|
|
16691
|
+
for (var _i = 0, _a = this.getExports(); _i < _a.length; _i++) {
|
|
16692
|
+
var exportName = _a[_i];
|
|
16693
|
+
var variable = this.traceExport(exportName);
|
|
16694
|
+
variable.exportName = exportName;
|
|
16707
16695
|
variable.includeVariable();
|
|
16708
16696
|
if (variable.isNamespace) {
|
|
16709
16697
|
variable.needsNamespaceBlock = true;
|
|
16710
16698
|
}
|
|
16711
|
-
}
|
|
16712
|
-
this.getReexports().
|
|
16713
|
-
var
|
|
16699
|
+
}
|
|
16700
|
+
for (var _b = 0, _c = this.getReexports(); _b < _c.length; _b++) {
|
|
16701
|
+
var name = _c[_b];
|
|
16702
|
+
var variable = this.traceExport(name);
|
|
16714
16703
|
variable.exportName = name;
|
|
16715
16704
|
if (variable.isExternal) {
|
|
16716
16705
|
variable.reexported = variable.module.reexported = true;
|
|
@@ -16718,31 +16707,38 @@ var Module = /** @class */ (function () {
|
|
|
16718
16707
|
else {
|
|
16719
16708
|
variable.includeVariable();
|
|
16720
16709
|
}
|
|
16721
|
-
}
|
|
16710
|
+
}
|
|
16722
16711
|
};
|
|
16723
16712
|
Module.prototype.linkDependencies = function () {
|
|
16724
16713
|
var _this = this;
|
|
16725
|
-
this.sources.
|
|
16726
|
-
var
|
|
16714
|
+
for (var _i = 0, _a = this.sources; _i < _a.length; _i++) {
|
|
16715
|
+
var source = _a[_i];
|
|
16716
|
+
var id = this.resolvedIds[source];
|
|
16727
16717
|
if (id) {
|
|
16728
|
-
var module =
|
|
16729
|
-
|
|
16718
|
+
var module = this.graph.moduleById.get(id);
|
|
16719
|
+
this.dependencies.push(module);
|
|
16730
16720
|
}
|
|
16731
|
-
}
|
|
16732
|
-
|
|
16733
|
-
Object.keys(specifiers).
|
|
16721
|
+
}
|
|
16722
|
+
var resolveSpecifiers = function (specifiers) {
|
|
16723
|
+
for (var _i = 0, _a = Object.keys(specifiers); _i < _a.length; _i++) {
|
|
16724
|
+
var name = _a[_i];
|
|
16734
16725
|
var specifier = specifiers[name];
|
|
16735
16726
|
var id = _this.resolvedIds[specifier.source];
|
|
16736
16727
|
specifier.module = _this.graph.moduleById.get(id);
|
|
16737
|
-
}
|
|
16738
|
-
}
|
|
16728
|
+
}
|
|
16729
|
+
};
|
|
16730
|
+
resolveSpecifiers(this.imports);
|
|
16731
|
+
resolveSpecifiers(this.reexports);
|
|
16739
16732
|
this.exportAllModules = this.exportAllSources.map(function (source) {
|
|
16740
16733
|
var id = _this.resolvedIds[source];
|
|
16741
16734
|
return _this.graph.moduleById.get(id);
|
|
16742
16735
|
});
|
|
16743
16736
|
};
|
|
16744
16737
|
Module.prototype.bindReferences = function () {
|
|
16745
|
-
this.ast.body
|
|
16738
|
+
for (var _i = 0, _a = this.ast.body; _i < _a.length; _i++) {
|
|
16739
|
+
var node = _a[_i];
|
|
16740
|
+
node.bind();
|
|
16741
|
+
}
|
|
16746
16742
|
};
|
|
16747
16743
|
Module.prototype.getDynamicImportExpressions = function () {
|
|
16748
16744
|
return this.dynamicImports.map(function (node) {
|
|
@@ -16826,10 +16822,11 @@ var Module = /** @class */ (function () {
|
|
|
16826
16822
|
allExports["*" + module.id] = true;
|
|
16827
16823
|
return;
|
|
16828
16824
|
}
|
|
16829
|
-
module.getAllExports().
|
|
16825
|
+
for (var _i = 0, _a = module.getAllExports(); _i < _a.length; _i++) {
|
|
16826
|
+
var name = _a[_i];
|
|
16830
16827
|
if (name !== 'default')
|
|
16831
16828
|
allExports[name] = true;
|
|
16832
|
-
}
|
|
16829
|
+
}
|
|
16833
16830
|
});
|
|
16834
16831
|
return Object.keys(allExports);
|
|
16835
16832
|
};
|
|
@@ -16838,36 +16835,38 @@ var Module = /** @class */ (function () {
|
|
|
16838
16835
|
};
|
|
16839
16836
|
Module.prototype.getReexports = function () {
|
|
16840
16837
|
var reexports = blank();
|
|
16841
|
-
|
|
16838
|
+
for (var name in this.reexports) {
|
|
16842
16839
|
reexports[name] = true;
|
|
16843
|
-
}
|
|
16840
|
+
}
|
|
16844
16841
|
this.exportAllModules.forEach(function (module) {
|
|
16845
16842
|
if (module.isExternal) {
|
|
16846
16843
|
reexports["*" + module.id] = true;
|
|
16847
16844
|
return;
|
|
16848
16845
|
}
|
|
16849
|
-
module
|
|
16850
|
-
|
|
16851
|
-
.concat(module.getReexports())
|
|
16852
|
-
.forEach(function (name) {
|
|
16846
|
+
for (var _i = 0, _a = module.getExports().concat(module.getReexports()); _i < _a.length; _i++) {
|
|
16847
|
+
var name = _a[_i];
|
|
16853
16848
|
if (name !== 'default')
|
|
16854
16849
|
reexports[name] = true;
|
|
16855
|
-
}
|
|
16850
|
+
}
|
|
16856
16851
|
});
|
|
16857
16852
|
return Object.keys(reexports);
|
|
16858
16853
|
};
|
|
16859
16854
|
Module.prototype.includeAllInBundle = function () {
|
|
16860
|
-
this.ast.body.
|
|
16855
|
+
for (var _i = 0, _a = this.ast.body; _i < _a.length; _i++) {
|
|
16856
|
+
var node = _a[_i];
|
|
16857
|
+
includeFully(node);
|
|
16858
|
+
}
|
|
16861
16859
|
};
|
|
16862
16860
|
Module.prototype.includeInBundle = function () {
|
|
16863
16861
|
var addedNewNodes = false;
|
|
16864
|
-
this.ast.body.
|
|
16862
|
+
for (var _i = 0, _a = this.ast.body; _i < _a.length; _i++) {
|
|
16863
|
+
var node = _a[_i];
|
|
16865
16864
|
if (node.shouldBeIncluded()) {
|
|
16866
16865
|
if (node.includeInBundle()) {
|
|
16867
16866
|
addedNewNodes = true;
|
|
16868
16867
|
}
|
|
16869
16868
|
}
|
|
16870
|
-
}
|
|
16869
|
+
}
|
|
16871
16870
|
return addedNewNodes;
|
|
16872
16871
|
};
|
|
16873
16872
|
Module.prototype.namespace = function () {
|
|
@@ -17075,12 +17074,12 @@ function handleMissingExport(exportName, importingModule, importedModule, import
|
|
|
17075
17074
|
}, importerStart);
|
|
17076
17075
|
}
|
|
17077
17076
|
|
|
17078
|
-
var charToInteger
|
|
17079
|
-
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
17080
|
-
for (var i = 0; i < chars.length; i++) {
|
|
17081
|
-
charToInteger$1
|
|
17077
|
+
var charToInteger = {};
|
|
17078
|
+
var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
17079
|
+
for (var i = 0; i < chars$1.length; i++) {
|
|
17080
|
+
charToInteger[chars$1.charCodeAt(i)] = i;
|
|
17082
17081
|
}
|
|
17083
|
-
function decode
|
|
17082
|
+
function decode(mappings) {
|
|
17084
17083
|
var generatedCodeColumn = 0; // first field
|
|
17085
17084
|
var sourceFileIndex = 0; // second field
|
|
17086
17085
|
var sourceCodeLine = 0; // third field
|
|
@@ -17107,7 +17106,7 @@ function decode$1(mappings) {
|
|
|
17107
17106
|
generatedCodeColumn = 0;
|
|
17108
17107
|
}
|
|
17109
17108
|
else {
|
|
17110
|
-
var integer = charToInteger
|
|
17109
|
+
var integer = charToInteger[c];
|
|
17111
17110
|
if (integer === undefined) {
|
|
17112
17111
|
throw new Error('Invalid character (' + String.fromCharCode(c) + ')');
|
|
17113
17112
|
}
|
|
@@ -17151,62 +17150,12 @@ function decode$1(mappings) {
|
|
|
17151
17150
|
decoded.push(line);
|
|
17152
17151
|
return decoded;
|
|
17153
17152
|
}
|
|
17154
|
-
function encode$1(decoded) {
|
|
17155
|
-
var sourceFileIndex = 0; // second field
|
|
17156
|
-
var sourceCodeLine = 0; // third field
|
|
17157
|
-
var sourceCodeColumn = 0; // fourth field
|
|
17158
|
-
var nameIndex = 0; // fifth field
|
|
17159
|
-
var mappings = '';
|
|
17160
|
-
for (var i = 0; i < decoded.length; i++) {
|
|
17161
|
-
var line = decoded[i];
|
|
17162
|
-
if (i > 0)
|
|
17163
|
-
mappings += ';';
|
|
17164
|
-
if (line.length === 0)
|
|
17165
|
-
continue;
|
|
17166
|
-
var generatedCodeColumn = 0; // first field
|
|
17167
|
-
var lineMappings = [];
|
|
17168
|
-
for (var _i = 0, line_1 = line; _i < line_1.length; _i++) {
|
|
17169
|
-
var segment = line_1[_i];
|
|
17170
|
-
var segmentMappings = encodeInteger$1(segment[0] - generatedCodeColumn);
|
|
17171
|
-
generatedCodeColumn = segment[0];
|
|
17172
|
-
if (segment.length > 1) {
|
|
17173
|
-
segmentMappings +=
|
|
17174
|
-
encodeInteger$1(segment[1] - sourceFileIndex) +
|
|
17175
|
-
encodeInteger$1(segment[2] - sourceCodeLine) +
|
|
17176
|
-
encodeInteger$1(segment[3] - sourceCodeColumn);
|
|
17177
|
-
sourceFileIndex = segment[1];
|
|
17178
|
-
sourceCodeLine = segment[2];
|
|
17179
|
-
sourceCodeColumn = segment[3];
|
|
17180
|
-
}
|
|
17181
|
-
if (segment.length === 5) {
|
|
17182
|
-
segmentMappings += encodeInteger$1(segment[4] - nameIndex);
|
|
17183
|
-
nameIndex = segment[4];
|
|
17184
|
-
}
|
|
17185
|
-
lineMappings.push(segmentMappings);
|
|
17186
|
-
}
|
|
17187
|
-
mappings += lineMappings.join(',');
|
|
17188
|
-
}
|
|
17189
|
-
return mappings;
|
|
17190
|
-
}
|
|
17191
|
-
function encodeInteger$1(num) {
|
|
17192
|
-
var result = '';
|
|
17193
|
-
num = num < 0 ? (-num << 1) | 1 : num << 1;
|
|
17194
|
-
do {
|
|
17195
|
-
var clamped = num & 31;
|
|
17196
|
-
num >>= 5;
|
|
17197
|
-
if (num > 0) {
|
|
17198
|
-
clamped |= 32;
|
|
17199
|
-
}
|
|
17200
|
-
result += chars[clamped];
|
|
17201
|
-
} while (num > 0);
|
|
17202
|
-
return result;
|
|
17203
|
-
}
|
|
17204
17153
|
|
|
17205
17154
|
function transform(graph, source, id, plugins) {
|
|
17206
17155
|
var sourcemapChain = [];
|
|
17207
17156
|
var originalSourcemap = typeof source.map === 'string' ? JSON.parse(source.map) : source.map;
|
|
17208
17157
|
if (originalSourcemap && typeof originalSourcemap.mappings === 'string') {
|
|
17209
|
-
originalSourcemap.mappings = decode
|
|
17158
|
+
originalSourcemap.mappings = decode(originalSourcemap.mappings);
|
|
17210
17159
|
}
|
|
17211
17160
|
var originalCode = source.code;
|
|
17212
17161
|
var ast = source.ast;
|
|
@@ -17278,7 +17227,7 @@ function transform(graph, source, id, plugins) {
|
|
|
17278
17227
|
result.map = JSON.parse(result.map);
|
|
17279
17228
|
}
|
|
17280
17229
|
if (result.map && typeof result.map.mappings === 'string') {
|
|
17281
|
-
result.map.mappings = decode
|
|
17230
|
+
result.map.mappings = decode(result.map.mappings);
|
|
17282
17231
|
}
|
|
17283
17232
|
// strict null check allows 'null' maps to not be pushed to the chain, while 'undefined' gets the missing map warning
|
|
17284
17233
|
if (result.map !== null) {
|
|
@@ -18040,9 +17989,7 @@ function transformBundle(code, plugins, sourcemapChain, options) {
|
|
|
18040
17989
|
return promise;
|
|
18041
17990
|
return promise.then(function (code) {
|
|
18042
17991
|
return Promise.resolve()
|
|
18043
|
-
.then(function () {
|
|
18044
|
-
return plugin.transformBundle(code, options);
|
|
18045
|
-
})
|
|
17992
|
+
.then(function () { return plugin.transformBundle(code, options); })
|
|
18046
17993
|
.then(function (result) {
|
|
18047
17994
|
if (result == null)
|
|
18048
17995
|
return code;
|
|
@@ -18054,7 +18001,7 @@ function transformBundle(code, plugins, sourcemapChain, options) {
|
|
|
18054
18001
|
}
|
|
18055
18002
|
var map = typeof result.map === 'string' ? JSON.parse(result.map) : result.map;
|
|
18056
18003
|
if (map && typeof map.mappings === 'string') {
|
|
18057
|
-
map.mappings = decode
|
|
18004
|
+
map.mappings = decode(map.mappings);
|
|
18058
18005
|
}
|
|
18059
18006
|
// strict null check allows 'null' maps to not be pushed to the chain, while 'undefined' gets the missing map warning
|
|
18060
18007
|
if (map !== null) {
|
|
@@ -18091,23 +18038,22 @@ var Link = /** @class */ (function () {
|
|
|
18091
18038
|
this.mappings = map.mappings;
|
|
18092
18039
|
}
|
|
18093
18040
|
Link.prototype.traceMappings = function () {
|
|
18094
|
-
var _this = this;
|
|
18095
18041
|
var sources = [];
|
|
18096
18042
|
var sourcesContent = [];
|
|
18097
18043
|
var names = [];
|
|
18098
|
-
var mappings =
|
|
18044
|
+
var mappings = [];
|
|
18045
|
+
for (var _i = 0, _a = this.mappings; _i < _a.length; _i++) {
|
|
18046
|
+
var line = _a[_i];
|
|
18099
18047
|
var tracedLine = [];
|
|
18100
|
-
line.
|
|
18101
|
-
var
|
|
18048
|
+
for (var _b = 0, line_1 = line; _b < line_1.length; _b++) {
|
|
18049
|
+
var segment = line_1[_b];
|
|
18050
|
+
var source = this.sources[segment[1]];
|
|
18102
18051
|
if (!source)
|
|
18103
|
-
|
|
18104
|
-
var traced = source.traceSegment(segment[2], segment[3],
|
|
18052
|
+
continue;
|
|
18053
|
+
var traced = source.traceSegment(segment[2], segment[3], this.names[segment[4]]);
|
|
18105
18054
|
if (traced) {
|
|
18106
|
-
var sourceIndex = null;
|
|
18107
|
-
var nameIndex = null;
|
|
18108
|
-
segment = [segment[0], null, traced.line, traced.column];
|
|
18109
18055
|
// newer sources are more likely to be used, so search backwards.
|
|
18110
|
-
sourceIndex = sources.lastIndexOf(traced.source.filename);
|
|
18056
|
+
var sourceIndex = sources.lastIndexOf(traced.source.filename);
|
|
18111
18057
|
if (sourceIndex === -1) {
|
|
18112
18058
|
sourceIndex = sources.length;
|
|
18113
18059
|
sources.push(traced.source.filename);
|
|
@@ -18122,28 +18068,33 @@ var Link = /** @class */ (function () {
|
|
|
18122
18068
|
message: "Multiple conflicting contents for sourcemap source " + source.filename
|
|
18123
18069
|
});
|
|
18124
18070
|
}
|
|
18125
|
-
|
|
18071
|
+
var tracedSegment = [
|
|
18072
|
+
segment[0],
|
|
18073
|
+
sourceIndex,
|
|
18074
|
+
traced.line,
|
|
18075
|
+
traced.column
|
|
18076
|
+
];
|
|
18126
18077
|
if (traced.name) {
|
|
18127
|
-
nameIndex = names.indexOf(traced.name);
|
|
18078
|
+
var nameIndex = names.indexOf(traced.name);
|
|
18128
18079
|
if (nameIndex === -1) {
|
|
18129
18080
|
nameIndex = names.length;
|
|
18130
18081
|
names.push(traced.name);
|
|
18131
18082
|
}
|
|
18132
|
-
|
|
18083
|
+
tracedSegment[4] = nameIndex;
|
|
18133
18084
|
}
|
|
18134
|
-
tracedLine.push(
|
|
18085
|
+
tracedLine.push(tracedSegment);
|
|
18135
18086
|
}
|
|
18136
|
-
}
|
|
18137
|
-
|
|
18138
|
-
}
|
|
18087
|
+
}
|
|
18088
|
+
mappings.push(tracedLine);
|
|
18089
|
+
}
|
|
18139
18090
|
return { sources: sources, sourcesContent: sourcesContent, names: names, mappings: mappings };
|
|
18140
18091
|
};
|
|
18141
18092
|
Link.prototype.traceSegment = function (line, column, name) {
|
|
18142
18093
|
var segments = this.mappings[line];
|
|
18143
18094
|
if (!segments)
|
|
18144
18095
|
return null;
|
|
18145
|
-
for (var
|
|
18146
|
-
var segment =
|
|
18096
|
+
for (var _i = 0, segments_1 = segments; _i < segments_1.length; _i++) {
|
|
18097
|
+
var segment = segments_1[_i];
|
|
18147
18098
|
if (segment[0] > column)
|
|
18148
18099
|
return null;
|
|
18149
18100
|
if (segment[0] === column) {
|
|
@@ -18207,14 +18158,9 @@ function collapseSourcemaps(bundle, file, map, modules, bundleSourcemapChain) {
|
|
|
18207
18158
|
if (file) {
|
|
18208
18159
|
var directory_2 = dirname(file);
|
|
18209
18160
|
sources = sources.map(function (source) { return relative(directory_2, source); });
|
|
18210
|
-
|
|
18161
|
+
file = basename(file);
|
|
18211
18162
|
}
|
|
18212
|
-
|
|
18213
|
-
map.sources = sources;
|
|
18214
|
-
map.sourcesContent = sourcesContent;
|
|
18215
|
-
map.names = names;
|
|
18216
|
-
map.mappings = encode$1(mappings);
|
|
18217
|
-
return map;
|
|
18163
|
+
return new SourceMap({ file: file, sources: sources, sourcesContent: sourcesContent, names: names, mappings: mappings });
|
|
18218
18164
|
}
|
|
18219
18165
|
|
|
18220
18166
|
function callIfFunction(thing) {
|
|
@@ -18765,7 +18711,7 @@ var Chunk$1 = /** @class */ (function () {
|
|
|
18765
18711
|
timeStart('render modules', 3);
|
|
18766
18712
|
var indentString = getIndentString(_this.orderedModules, options);
|
|
18767
18713
|
var renderOptions = {
|
|
18768
|
-
legacy:
|
|
18714
|
+
legacy: options.legacy,
|
|
18769
18715
|
freeze: options.freeze !== false,
|
|
18770
18716
|
namespaceToStringTag: options.namespaceToStringTag === true,
|
|
18771
18717
|
indent: indentString,
|
|
@@ -18826,9 +18772,9 @@ var Chunk$1 = /** @class */ (function () {
|
|
|
18826
18772
|
if (footer)
|
|
18827
18773
|
magicString.append('\n' + footer);
|
|
18828
18774
|
var prevCode = magicString.toString();
|
|
18829
|
-
var map = null;
|
|
18830
18775
|
var bundleSourcemapChain = [];
|
|
18831
18776
|
return transformBundle(prevCode, _this.graph.plugins, bundleSourcemapChain, options).then(function (code) {
|
|
18777
|
+
var map;
|
|
18832
18778
|
if (options.sourcemap) {
|
|
18833
18779
|
timeStart('sourcemap', 3);
|
|
18834
18780
|
var file = options.file ? options.sourcemapFile || options.file : _this.id;
|
|
@@ -18838,11 +18784,8 @@ var Chunk$1 = /** @class */ (function () {
|
|
|
18838
18784
|
_this.graph.plugins.find(function (plugin) {
|
|
18839
18785
|
return Boolean(plugin.transform || plugin.transformBundle);
|
|
18840
18786
|
})) {
|
|
18841
|
-
|
|
18842
|
-
|
|
18843
|
-
map.mappings = decode$1(map.mappings);
|
|
18844
|
-
}
|
|
18845
|
-
map = collapseSourcemaps(_this, file, map, usedModules, bundleSourcemapChain);
|
|
18787
|
+
var decodedMap = magicString.generateDecodedMap({});
|
|
18788
|
+
map = collapseSourcemaps(_this, file, decodedMap, usedModules, bundleSourcemapChain);
|
|
18846
18789
|
}
|
|
18847
18790
|
else {
|
|
18848
18791
|
map = magicString.generateMap({ file: file, includeContent: true });
|
|
@@ -18981,16 +18924,18 @@ var Graph = /** @class */ (function () {
|
|
|
18981
18924
|
this.cachedModules = new Map();
|
|
18982
18925
|
if (options.cache) {
|
|
18983
18926
|
if (options.cache.modules) {
|
|
18984
|
-
options.cache.modules.
|
|
18985
|
-
|
|
18986
|
-
|
|
18927
|
+
for (var _i = 0, _a = options.cache.modules; _i < _a.length; _i++) {
|
|
18928
|
+
var module = _a[_i];
|
|
18929
|
+
this.cachedModules.set(module.id, module);
|
|
18930
|
+
}
|
|
18987
18931
|
}
|
|
18988
18932
|
else {
|
|
18989
18933
|
var chunks = options.cache.chunks;
|
|
18990
18934
|
for (var chunkName in chunks) {
|
|
18991
|
-
chunks[chunkName].modules.
|
|
18992
|
-
|
|
18993
|
-
|
|
18935
|
+
for (var _b = 0, _c = chunks[chunkName].modules; _b < _c.length; _b++) {
|
|
18936
|
+
var module = _c[_b];
|
|
18937
|
+
this.cachedModules.set(module.id, module);
|
|
18938
|
+
}
|
|
18994
18939
|
}
|
|
18995
18940
|
}
|
|
18996
18941
|
}
|
|
@@ -19047,9 +18992,10 @@ var Graph = /** @class */ (function () {
|
|
|
19047
18992
|
.concat(handleMissingExport));
|
|
19048
18993
|
this.scope = new GlobalScope();
|
|
19049
18994
|
// TODO strictly speaking, this only applies with non-ES6, non-default-only bundles
|
|
19050
|
-
['module', 'exports', '_interopDefault'].
|
|
19051
|
-
|
|
19052
|
-
|
|
18995
|
+
for (var _d = 0, _e = ['module', 'exports', '_interopDefault']; _d < _e.length; _d++) {
|
|
18996
|
+
var name = _e[_d];
|
|
18997
|
+
this.scope.findVariable(name); // creates global variable as side-effect
|
|
18998
|
+
}
|
|
19053
18999
|
this.moduleById = new Map();
|
|
19054
19000
|
this.modules = [];
|
|
19055
19001
|
this.externalModules = [];
|
|
@@ -19060,9 +19006,9 @@ var Graph = /** @class */ (function () {
|
|
|
19060
19006
|
}
|
|
19061
19007
|
else if (typeof optionsModuleContext === 'object') {
|
|
19062
19008
|
var moduleContext_1 = new Map();
|
|
19063
|
-
|
|
19064
|
-
|
|
19065
|
-
}
|
|
19009
|
+
for (var key in optionsModuleContext) {
|
|
19010
|
+
moduleContext_1.set(resolve(key), optionsModuleContext[key]);
|
|
19011
|
+
}
|
|
19066
19012
|
this.getModuleContext = function (id) { return moduleContext_1.get(id) || _this.context; };
|
|
19067
19013
|
}
|
|
19068
19014
|
else {
|
|
@@ -19077,7 +19023,6 @@ var Graph = /** @class */ (function () {
|
|
|
19077
19023
|
}
|
|
19078
19024
|
this.onwarn = options.onwarn || makeOnwarn();
|
|
19079
19025
|
this.varOrConst = options.preferConst ? 'const' : 'var';
|
|
19080
|
-
this.legacy = options.legacy;
|
|
19081
19026
|
this.acornOptions = options.acorn || {};
|
|
19082
19027
|
var acornPluginsToInject = [];
|
|
19083
19028
|
this.dynamicImport =
|
|
@@ -19123,26 +19068,36 @@ var Graph = /** @class */ (function () {
|
|
|
19123
19068
|
});
|
|
19124
19069
|
};
|
|
19125
19070
|
Graph.prototype.link = function () {
|
|
19126
|
-
this.modules
|
|
19127
|
-
|
|
19071
|
+
for (var _i = 0, _a = this.modules; _i < _a.length; _i++) {
|
|
19072
|
+
var module = _a[_i];
|
|
19073
|
+
module.linkDependencies();
|
|
19074
|
+
}
|
|
19075
|
+
for (var _b = 0, _c = this.modules; _b < _c.length; _b++) {
|
|
19076
|
+
var module = _c[_b];
|
|
19077
|
+
module.bindReferences();
|
|
19078
|
+
}
|
|
19128
19079
|
};
|
|
19129
19080
|
Graph.prototype.includeMarked = function (modules) {
|
|
19130
19081
|
if (this.treeshake) {
|
|
19131
|
-
var
|
|
19082
|
+
var addedNewNodes = void 0, treeshakingPass = 1;
|
|
19132
19083
|
do {
|
|
19133
19084
|
timeStart("treeshaking pass " + treeshakingPass, 3);
|
|
19134
|
-
|
|
19135
|
-
modules.
|
|
19085
|
+
addedNewNodes = false;
|
|
19086
|
+
for (var _i = 0, modules_1 = modules; _i < modules_1.length; _i++) {
|
|
19087
|
+
var module = modules_1[_i];
|
|
19136
19088
|
if (module.includeInBundle()) {
|
|
19137
|
-
|
|
19089
|
+
addedNewNodes = true;
|
|
19138
19090
|
}
|
|
19139
|
-
}
|
|
19091
|
+
}
|
|
19140
19092
|
timeEnd("treeshaking pass " + treeshakingPass++, 3);
|
|
19141
|
-
} while (
|
|
19093
|
+
} while (addedNewNodes);
|
|
19142
19094
|
}
|
|
19143
19095
|
else {
|
|
19144
19096
|
// Necessary to properly replace namespace imports
|
|
19145
|
-
|
|
19097
|
+
for (var _a = 0, modules_2 = modules; _a < modules_2.length; _a++) {
|
|
19098
|
+
var module = modules_2[_a];
|
|
19099
|
+
module.includeAllInBundle();
|
|
19100
|
+
}
|
|
19146
19101
|
}
|
|
19147
19102
|
};
|
|
19148
19103
|
Graph.prototype.buildSingle = function (entryModuleId) {
|
|
@@ -19157,21 +19112,25 @@ var Graph = /** @class */ (function () {
|
|
|
19157
19112
|
// determine the topological execution order for the bundle
|
|
19158
19113
|
timeStart('analyse dependency graph', 2);
|
|
19159
19114
|
_this.link();
|
|
19160
|
-
var _a = _this.analyseExecution([entryModule]), orderedModules = _a.orderedModules, dynamicImports = _a.dynamicImports;
|
|
19115
|
+
var _a = _this.analyseExecution([entryModule], false), orderedModules = _a.orderedModules, dynamicImports = _a.dynamicImports;
|
|
19161
19116
|
timeEnd('analyse dependency graph', 2);
|
|
19162
19117
|
// Phase 3 – marking. We include all statements that should be included
|
|
19163
19118
|
timeStart('mark included statements', 2);
|
|
19164
19119
|
entryModule.markExports();
|
|
19165
|
-
dynamicImports.
|
|
19120
|
+
for (var _i = 0, dynamicImports_1 = dynamicImports; _i < dynamicImports_1.length; _i++) {
|
|
19121
|
+
var dynamicImportModule = dynamicImports_1[_i];
|
|
19166
19122
|
if (entryModule !== dynamicImportModule)
|
|
19167
19123
|
dynamicImportModule.markExports();
|
|
19168
19124
|
// all dynamic import modules inlined for single-file build
|
|
19169
19125
|
dynamicImportModule.namespace().includeVariable();
|
|
19170
|
-
}
|
|
19126
|
+
}
|
|
19171
19127
|
// only include statements that should appear in the bundle
|
|
19172
19128
|
_this.includeMarked(orderedModules);
|
|
19173
19129
|
// check for unused external imports
|
|
19174
|
-
_this.externalModules
|
|
19130
|
+
for (var _b = 0, _c = _this.externalModules; _b < _c.length; _b++) {
|
|
19131
|
+
var module = _c[_b];
|
|
19132
|
+
module.warnUnusedImports();
|
|
19133
|
+
}
|
|
19175
19134
|
timeEnd('mark included statements', 2);
|
|
19176
19135
|
// Phase 4 – we construct the chunk itself, generating its import and export facades
|
|
19177
19136
|
timeStart('generate chunks', 2);
|
|
@@ -19197,21 +19156,26 @@ var Graph = /** @class */ (function () {
|
|
|
19197
19156
|
// determine the topological execution order for the bundle
|
|
19198
19157
|
timeStart('analyse dependency graph', 2);
|
|
19199
19158
|
_this.link();
|
|
19200
|
-
var _a = _this.analyseExecution(entryModules, preserveModules), orderedModules = _a.orderedModules, dynamicImports = _a.dynamicImports;
|
|
19201
|
-
dynamicImports.
|
|
19159
|
+
var _a = _this.analyseExecution(entryModules, !preserveModules), orderedModules = _a.orderedModules, dynamicImports = _a.dynamicImports;
|
|
19160
|
+
for (var _i = 0, dynamicImports_2 = dynamicImports; _i < dynamicImports_2.length; _i++) {
|
|
19161
|
+
var dynamicImportModule = dynamicImports_2[_i];
|
|
19202
19162
|
if (entryModules.indexOf(dynamicImportModule) === -1)
|
|
19203
19163
|
entryModules.push(dynamicImportModule);
|
|
19204
|
-
}
|
|
19164
|
+
}
|
|
19205
19165
|
timeEnd('analyse dependency graph', 2);
|
|
19206
19166
|
// Phase 3 – marking. We include all statements that should be included
|
|
19207
19167
|
timeStart('mark included statements', 2);
|
|
19208
|
-
entryModules.
|
|
19168
|
+
for (var _b = 0, entryModules_1 = entryModules; _b < entryModules_1.length; _b++) {
|
|
19169
|
+
var entryModule = entryModules_1[_b];
|
|
19209
19170
|
entryModule.markExports();
|
|
19210
|
-
}
|
|
19171
|
+
}
|
|
19211
19172
|
// only include statements that should appear in the bundle
|
|
19212
19173
|
_this.includeMarked(orderedModules);
|
|
19213
19174
|
// check for unused external imports
|
|
19214
|
-
_this.externalModules
|
|
19175
|
+
for (var _c = 0, _d = _this.externalModules; _c < _d.length; _c++) {
|
|
19176
|
+
var externalModule = _d[_c];
|
|
19177
|
+
externalModule.warnUnusedImports();
|
|
19178
|
+
}
|
|
19215
19179
|
timeEnd('mark included statements', 2);
|
|
19216
19180
|
// Phase 4 – we construct the chunks, working out the optimal chunking using
|
|
19217
19181
|
// entry point graph colouring, before generating the import and export facades
|
|
@@ -19222,43 +19186,47 @@ var Graph = /** @class */ (function () {
|
|
|
19222
19186
|
// should be made to be its own entry point module before chunking
|
|
19223
19187
|
var chunkList = [];
|
|
19224
19188
|
if (!preserveModules) {
|
|
19225
|
-
var
|
|
19226
|
-
orderedModules.
|
|
19189
|
+
var chunkModules = {};
|
|
19190
|
+
for (var _e = 0, orderedModules_1 = orderedModules; _e < orderedModules_1.length; _e++) {
|
|
19191
|
+
var module = orderedModules_1[_e];
|
|
19227
19192
|
var entryPointsHashStr = Uint8ArrayToHexString(module.entryPointsHash);
|
|
19228
|
-
var curChunk =
|
|
19193
|
+
var curChunk = chunkModules[entryPointsHashStr];
|
|
19229
19194
|
if (curChunk) {
|
|
19230
19195
|
curChunk.push(module);
|
|
19231
19196
|
}
|
|
19232
19197
|
else {
|
|
19233
|
-
|
|
19198
|
+
chunkModules[entryPointsHashStr] = [module];
|
|
19234
19199
|
}
|
|
19235
|
-
}
|
|
19200
|
+
}
|
|
19236
19201
|
// create each chunk
|
|
19237
|
-
|
|
19238
|
-
var chunk =
|
|
19202
|
+
for (var entryHashSum in chunkModules) {
|
|
19203
|
+
var chunk = chunkModules[entryHashSum];
|
|
19239
19204
|
var chunkModulesOrdered = chunk.sort(function (moduleA, moduleB) { return (moduleA.execIndex > moduleB.execIndex ? 1 : -1); });
|
|
19240
19205
|
chunkList.push(new Chunk$1(_this, chunkModulesOrdered));
|
|
19241
|
-
}
|
|
19206
|
+
}
|
|
19242
19207
|
}
|
|
19243
19208
|
else {
|
|
19244
|
-
orderedModules.
|
|
19209
|
+
for (var _f = 0, orderedModules_2 = orderedModules; _f < orderedModules_2.length; _f++) {
|
|
19210
|
+
var module = orderedModules_2[_f];
|
|
19245
19211
|
var chunkInstance = new Chunk$1(_this, [module]);
|
|
19246
19212
|
chunkInstance.entryModule = module;
|
|
19247
19213
|
chunkInstance.isEntryModuleFacade = true;
|
|
19248
19214
|
chunkList.push(chunkInstance);
|
|
19249
|
-
}
|
|
19215
|
+
}
|
|
19250
19216
|
}
|
|
19251
19217
|
// for each entry point module, ensure its exports
|
|
19252
19218
|
// are exported by the chunk itself, with safe name deduping
|
|
19253
|
-
entryModules.
|
|
19219
|
+
for (var _g = 0, entryModules_2 = entryModules; _g < entryModules_2.length; _g++) {
|
|
19220
|
+
var entryModule = entryModules_2[_g];
|
|
19254
19221
|
entryModule.chunk.generateEntryExports(entryModule);
|
|
19255
|
-
}
|
|
19222
|
+
}
|
|
19256
19223
|
// for each chunk module, set up its imports to other
|
|
19257
19224
|
// chunks, if those variables are included after treeshaking
|
|
19258
|
-
chunkList.
|
|
19225
|
+
for (var _h = 0, chunkList_1 = chunkList; _h < chunkList_1.length; _h++) {
|
|
19226
|
+
var chunk = chunkList_1[_h];
|
|
19259
19227
|
chunk.collectDependencies();
|
|
19260
19228
|
chunk.generateImports();
|
|
19261
|
-
}
|
|
19229
|
+
}
|
|
19262
19230
|
// finally prepare output chunks
|
|
19263
19231
|
var chunks = {};
|
|
19264
19232
|
var inputRelativeDir;
|
|
@@ -19304,66 +19272,69 @@ var Graph = /** @class */ (function () {
|
|
|
19304
19272
|
return chunks;
|
|
19305
19273
|
});
|
|
19306
19274
|
};
|
|
19307
|
-
Graph.prototype.analyseExecution = function (entryModules,
|
|
19275
|
+
Graph.prototype.analyseExecution = function (entryModules, graphColouring) {
|
|
19308
19276
|
var _this = this;
|
|
19309
|
-
if (preserveModules === void 0) { preserveModules = false; }
|
|
19310
19277
|
var curEntry, curEntryHash;
|
|
19311
19278
|
var allSeen = {};
|
|
19312
19279
|
var ordered = [];
|
|
19313
19280
|
var dynamicImports = [];
|
|
19314
|
-
var
|
|
19315
|
-
|
|
19281
|
+
var parents;
|
|
19282
|
+
var visit = function (module) {
|
|
19316
19283
|
if (module.isEntryPoint && module !== curEntry)
|
|
19317
19284
|
return;
|
|
19318
19285
|
// Track entry point graph colouring by tracing all modules loaded by a given
|
|
19319
19286
|
// entry point and colouring those modules by the hash of its id. Colours are mixed as
|
|
19320
19287
|
// hash xors, providing the unique colouring of the graph into unique hash chunks.
|
|
19321
19288
|
// This is really all there is to automated chunking, the rest is chunk wiring.
|
|
19322
|
-
if (
|
|
19289
|
+
if (graphColouring) {
|
|
19323
19290
|
Uint8ArrayXor(module.entryPointsHash, curEntryHash);
|
|
19324
19291
|
}
|
|
19325
|
-
module.dependencies.
|
|
19326
|
-
|
|
19327
|
-
|
|
19328
|
-
|
|
19329
|
-
|
|
19330
|
-
|
|
19331
|
-
|
|
19292
|
+
for (var _i = 0, _a = module.dependencies; _i < _a.length; _i++) {
|
|
19293
|
+
var depModule = _a[_i];
|
|
19294
|
+
if (depModule.isExternal)
|
|
19295
|
+
continue;
|
|
19296
|
+
if (depModule.id in parents) {
|
|
19297
|
+
if (!allSeen[depModule.id]) {
|
|
19298
|
+
_this.warnCycle(depModule.id, module.id, parents);
|
|
19332
19299
|
}
|
|
19333
|
-
|
|
19334
|
-
visit(depModule, parents);
|
|
19300
|
+
continue;
|
|
19335
19301
|
}
|
|
19336
|
-
|
|
19302
|
+
parents[depModule.id] = module.id;
|
|
19303
|
+
visit(depModule);
|
|
19304
|
+
}
|
|
19337
19305
|
if (_this.dynamicImport) {
|
|
19338
|
-
module.dynamicImportResolutions.
|
|
19339
|
-
|
|
19340
|
-
|
|
19341
|
-
|
|
19306
|
+
for (var _b = 0, _c = module.dynamicImportResolutions; _b < _c.length; _b++) {
|
|
19307
|
+
var dynamicModule = _c[_b];
|
|
19308
|
+
if (dynamicModule instanceof Module) {
|
|
19309
|
+
if (dynamicImports.indexOf(dynamicModule) === -1) {
|
|
19310
|
+
dynamicImports.push(dynamicModule);
|
|
19342
19311
|
}
|
|
19343
19312
|
}
|
|
19344
|
-
}
|
|
19313
|
+
}
|
|
19345
19314
|
}
|
|
19346
19315
|
if (allSeen[module.id])
|
|
19347
19316
|
return;
|
|
19348
19317
|
allSeen[module.id] = true;
|
|
19349
19318
|
module.execIndex = ordered.length;
|
|
19350
19319
|
ordered.push(module);
|
|
19351
|
-
var _a;
|
|
19352
19320
|
};
|
|
19353
|
-
for (var
|
|
19354
|
-
curEntry =
|
|
19321
|
+
for (var _i = 0, entryModules_3 = entryModules; _i < entryModules_3.length; _i++) {
|
|
19322
|
+
curEntry = entryModules_3[_i];
|
|
19355
19323
|
curEntry.isEntryPoint = true;
|
|
19356
19324
|
curEntryHash = randomUint8Array(10);
|
|
19325
|
+
parents = (_a = {}, _a[curEntry.id] = null, _a);
|
|
19357
19326
|
visit(curEntry);
|
|
19358
19327
|
}
|
|
19359
19328
|
// new items can be added during this loop
|
|
19360
|
-
for (var
|
|
19361
|
-
curEntry =
|
|
19329
|
+
for (var _b = 0, dynamicImports_3 = dynamicImports; _b < dynamicImports_3.length; _b++) {
|
|
19330
|
+
curEntry = dynamicImports_3[_b];
|
|
19362
19331
|
curEntry.isEntryPoint = true;
|
|
19363
19332
|
curEntryHash = randomUint8Array(10);
|
|
19333
|
+
parents = (_c = {}, _c[curEntry.id] = null, _c);
|
|
19364
19334
|
visit(curEntry);
|
|
19365
19335
|
}
|
|
19366
19336
|
return { orderedModules: ordered, dynamicImports: dynamicImports };
|
|
19337
|
+
var _a, _c;
|
|
19367
19338
|
};
|
|
19368
19339
|
Graph.prototype.warnCycle = function (id, parentId, parents) {
|
|
19369
19340
|
var path = [relativeId(id)];
|
|
@@ -19433,17 +19404,17 @@ var Graph = /** @class */ (function () {
|
|
|
19433
19404
|
_this.modules.push(module);
|
|
19434
19405
|
_this.moduleById.set(id, module);
|
|
19435
19406
|
return _this.fetchAllDependencies(module).then(function () {
|
|
19436
|
-
|
|
19407
|
+
for (var name in module.exports) {
|
|
19437
19408
|
if (name !== 'default') {
|
|
19438
19409
|
module.exportsAll[name] = module.id;
|
|
19439
19410
|
}
|
|
19440
|
-
}
|
|
19411
|
+
}
|
|
19441
19412
|
module.exportAllSources.forEach(function (source) {
|
|
19442
19413
|
var id = module.resolvedIds[source];
|
|
19443
19414
|
var exportAllModule = _this.moduleById.get(id);
|
|
19444
19415
|
if (exportAllModule.isExternal)
|
|
19445
19416
|
return;
|
|
19446
|
-
|
|
19417
|
+
for (var name in exportAllModule.exportsAll) {
|
|
19447
19418
|
if (name in module.exportsAll) {
|
|
19448
19419
|
_this.warn({
|
|
19449
19420
|
code: 'NAMESPACE_CONFLICT',
|
|
@@ -19456,7 +19427,7 @@ var Graph = /** @class */ (function () {
|
|
|
19456
19427
|
else {
|
|
19457
19428
|
module.exportsAll[name] = exportAllModule.exportsAll[name];
|
|
19458
19429
|
}
|
|
19459
|
-
}
|
|
19430
|
+
}
|
|
19460
19431
|
});
|
|
19461
19432
|
return module;
|
|
19462
19433
|
});
|
|
@@ -19531,14 +19502,14 @@ var Graph = /** @class */ (function () {
|
|
|
19531
19502
|
_this.externalModules.push(module_1);
|
|
19532
19503
|
_this.moduleById.set(externalId, module_1);
|
|
19533
19504
|
}
|
|
19534
|
-
var
|
|
19505
|
+
var externalModule = _this.moduleById.get(externalId);
|
|
19535
19506
|
// add external declarations so we can detect which are never used
|
|
19536
|
-
|
|
19507
|
+
for (var name in module.imports) {
|
|
19537
19508
|
var importDeclaration = module.imports[name];
|
|
19538
19509
|
if (importDeclaration.source !== source)
|
|
19539
19510
|
return;
|
|
19540
|
-
|
|
19541
|
-
}
|
|
19511
|
+
externalModule.traceExport(importDeclaration.name);
|
|
19512
|
+
}
|
|
19542
19513
|
}
|
|
19543
19514
|
else {
|
|
19544
19515
|
module.resolvedIds[source] = resolvedId;
|
|
@@ -19605,7 +19576,7 @@ function applyOptionHook(inputOptions, plugin) {
|
|
|
19605
19576
|
return plugin.options(inputOptions) || inputOptions;
|
|
19606
19577
|
return inputOptions;
|
|
19607
19578
|
}
|
|
19608
|
-
function getInputOptions(rawInputOptions) {
|
|
19579
|
+
function getInputOptions$1(rawInputOptions) {
|
|
19609
19580
|
if (!rawInputOptions) {
|
|
19610
19581
|
throw new Error('You must supply an options object to rollup');
|
|
19611
19582
|
}
|
|
@@ -19623,7 +19594,7 @@ function getInputOptions(rawInputOptions) {
|
|
|
19623
19594
|
}
|
|
19624
19595
|
function rollup(rawInputOptions) {
|
|
19625
19596
|
try {
|
|
19626
|
-
var inputOptions_1 = getInputOptions(rawInputOptions);
|
|
19597
|
+
var inputOptions_1 = getInputOptions$1(rawInputOptions);
|
|
19627
19598
|
initialiseTimers(inputOptions_1);
|
|
19628
19599
|
var graph_1 = new Graph(inputOptions_1);
|
|
19629
19600
|
timeStart('BUILD', 1);
|
|
@@ -19847,7 +19818,7 @@ function getAndCheckOutputOptions(inputOptions, rawOutputOptions) {
|
|
|
19847
19818
|
return outputOptions;
|
|
19848
19819
|
}
|
|
19849
19820
|
|
|
19850
|
-
var version$1 = "0.57.
|
|
19821
|
+
var version$1 = "0.57.1";
|
|
19851
19822
|
|
|
19852
19823
|
exports.rollup = rollup;
|
|
19853
19824
|
exports.VERSION = version$1;
|