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.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
|
|
@@ -356,7 +356,12 @@ function deprecateOptions(options, deprecateConfig) {
|
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
358
|
|
|
359
|
-
function
|
|
359
|
+
var createGetOption = function (config, command) { return function (name, defaultValue) {
|
|
360
|
+
return command[name] !== undefined
|
|
361
|
+
? command[name]
|
|
362
|
+
: config[name] !== undefined ? config[name] : defaultValue;
|
|
363
|
+
}; };
|
|
364
|
+
var normalizeObjectOptionValue = function (optionValue) {
|
|
360
365
|
if (!optionValue) {
|
|
361
366
|
return optionValue;
|
|
362
367
|
}
|
|
@@ -364,7 +369,17 @@ function normalizeObjectOptionValue(optionValue) {
|
|
|
364
369
|
return {};
|
|
365
370
|
}
|
|
366
371
|
return optionValue;
|
|
367
|
-
}
|
|
372
|
+
};
|
|
373
|
+
var getObjectOption = function (config, command, name) {
|
|
374
|
+
var commandOption = normalizeObjectOptionValue(command[name]);
|
|
375
|
+
var configOption = normalizeObjectOptionValue(config[name]);
|
|
376
|
+
if (commandOption !== undefined) {
|
|
377
|
+
return commandOption && configOption
|
|
378
|
+
? Object.assign({}, configOption, commandOption)
|
|
379
|
+
: commandOption;
|
|
380
|
+
}
|
|
381
|
+
return configOption;
|
|
382
|
+
};
|
|
368
383
|
var defaultOnWarn = function (warning) {
|
|
369
384
|
if (typeof warning === 'string') {
|
|
370
385
|
console.warn(warning); // eslint-disable-line no-console
|
|
@@ -373,148 +388,147 @@ var defaultOnWarn = function (warning) {
|
|
|
373
388
|
console.warn(warning.message); // eslint-disable-line no-console
|
|
374
389
|
}
|
|
375
390
|
};
|
|
391
|
+
var getOnWarn = function (config, command, defaultOnWarnHandler) {
|
|
392
|
+
if (defaultOnWarnHandler === void 0) { defaultOnWarnHandler = defaultOnWarn; }
|
|
393
|
+
return command.silent
|
|
394
|
+
? function () { }
|
|
395
|
+
: config.onwarn
|
|
396
|
+
? function (warning) { return config.onwarn(warning, defaultOnWarnHandler); }
|
|
397
|
+
: defaultOnWarnHandler;
|
|
398
|
+
};
|
|
399
|
+
var getExternal = function (config, command) {
|
|
400
|
+
var configExternal = config.external;
|
|
401
|
+
return typeof configExternal === 'function'
|
|
402
|
+
? function (id) {
|
|
403
|
+
var rest = [];
|
|
404
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
405
|
+
rest[_i - 1] = arguments[_i];
|
|
406
|
+
}
|
|
407
|
+
return configExternal.apply(void 0, [id].concat(rest)) || command.external.indexOf(id) !== -1;
|
|
408
|
+
}
|
|
409
|
+
: (configExternal || []).concat(command.external);
|
|
410
|
+
};
|
|
411
|
+
var commandAliases = {
|
|
412
|
+
c: 'config',
|
|
413
|
+
d: 'indent',
|
|
414
|
+
e: 'external',
|
|
415
|
+
f: 'format',
|
|
416
|
+
g: 'globals',
|
|
417
|
+
h: 'help',
|
|
418
|
+
i: 'input',
|
|
419
|
+
l: 'legacy',
|
|
420
|
+
m: 'sourcemap',
|
|
421
|
+
n: 'name',
|
|
422
|
+
o: 'file',
|
|
423
|
+
v: 'version',
|
|
424
|
+
w: 'watch'
|
|
425
|
+
};
|
|
376
426
|
function mergeOptions(_a) {
|
|
377
|
-
var
|
|
378
|
-
var deprecations = deprecate(config,
|
|
379
|
-
var
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
427
|
+
var _b = _a.config, config = _b === void 0 ? {} : _b, _c = _a.command, rawCommandOptions = _c === void 0 ? {} : _c, deprecateConfig = _a.deprecateConfig, defaultOnWarnHandler = _a.defaultOnWarnHandler;
|
|
428
|
+
var deprecations = deprecate(config, rawCommandOptions, deprecateConfig);
|
|
429
|
+
var command = getCommandOptions(rawCommandOptions);
|
|
430
|
+
var inputOptions = getInputOptions(config, command, defaultOnWarnHandler);
|
|
431
|
+
if (command.output) {
|
|
432
|
+
Object.assign(command, command.output);
|
|
433
|
+
}
|
|
434
|
+
var normalizedOutputOptions = ensureArray(config.output);
|
|
435
|
+
if (normalizedOutputOptions.length === 0)
|
|
436
|
+
normalizedOutputOptions.push({});
|
|
437
|
+
var outputOptions = normalizedOutputOptions.map(function (singleOutputOptions) {
|
|
438
|
+
return getOutputOptions(singleOutputOptions, command);
|
|
439
|
+
});
|
|
440
|
+
var unknownOptionErrors = [];
|
|
441
|
+
var validInputOptions = Object.keys(inputOptions);
|
|
442
|
+
addUnknownOptionErrors(unknownOptionErrors, Object.keys(config), validInputOptions, 'input option', /^output$/);
|
|
443
|
+
var validOutputOptions = Object.keys(outputOptions[0]);
|
|
444
|
+
addUnknownOptionErrors(unknownOptionErrors, outputOptions.reduce(function (allKeys, options) { return allKeys.concat(Object.keys(options)); }, []), validOutputOptions, 'output option');
|
|
445
|
+
addUnknownOptionErrors(unknownOptionErrors, Object.keys(command), validInputOptions.concat(validOutputOptions, Object.keys(commandAliases), 'config', 'environment', 'silent'), 'CLI flag', /^_|output|(config.*)$/);
|
|
446
|
+
return {
|
|
447
|
+
inputOptions: inputOptions,
|
|
448
|
+
outputOptions: outputOptions,
|
|
449
|
+
deprecations: deprecations,
|
|
450
|
+
optionError: unknownOptionErrors.length > 0 ? unknownOptionErrors.join('\n') : null
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
function addUnknownOptionErrors(errors, options, validOptions, optionType, ignoredKeys) {
|
|
454
|
+
if (ignoredKeys === void 0) { ignoredKeys = /$./; }
|
|
455
|
+
var unknownOptions = options.filter(function (key) { return validOptions.indexOf(key) === -1 && !ignoredKeys.test(key); });
|
|
456
|
+
if (unknownOptions.length > 0)
|
|
457
|
+
errors.push("Unknown " + optionType + ": " + unknownOptions.join(', ') + ". Allowed options: " + validOptions.sort().join(', '));
|
|
458
|
+
}
|
|
459
|
+
function getCommandOptions(rawCommandOptions) {
|
|
460
|
+
var command = Object.assign({}, rawCommandOptions);
|
|
461
|
+
command.external = (rawCommandOptions.external || '').split(',');
|
|
462
|
+
if (rawCommandOptions.globals) {
|
|
463
|
+
command.globals = Object.create(null);
|
|
464
|
+
rawCommandOptions.globals.split(',').forEach(function (str) {
|
|
465
|
+
var names = str.split(':');
|
|
466
|
+
command.globals[names[0]] = names[1];
|
|
467
|
+
// Add missing Module IDs to external.
|
|
468
|
+
if (command.external.indexOf(names[0]) === -1) {
|
|
469
|
+
command.external.push(names[0]);
|
|
470
|
+
}
|
|
471
|
+
});
|
|
401
472
|
}
|
|
473
|
+
return command;
|
|
474
|
+
}
|
|
475
|
+
function getInputOptions(config, command, defaultOnWarnHandler) {
|
|
476
|
+
if (command === void 0) { command = {}; }
|
|
477
|
+
var getOption = createGetOption(config, command);
|
|
402
478
|
var inputOptions = {
|
|
403
479
|
acorn: config.acorn,
|
|
404
480
|
acornInjectPlugins: config.acornInjectPlugins,
|
|
405
|
-
cache:
|
|
481
|
+
cache: getOption('cache'),
|
|
406
482
|
context: config.context,
|
|
407
|
-
experimentalCodeSplitting:
|
|
408
|
-
experimentalDynamicImport:
|
|
409
|
-
experimentalPreserveModules:
|
|
410
|
-
|
|
411
|
-
|
|
483
|
+
experimentalCodeSplitting: getOption('experimentalCodeSplitting'),
|
|
484
|
+
experimentalDynamicImport: getOption('experimentalDynamicImport'),
|
|
485
|
+
experimentalPreserveModules: getOption('experimentalPreserveModules'),
|
|
486
|
+
external: getExternal(config, command),
|
|
487
|
+
input: getOption('input'),
|
|
412
488
|
moduleContext: config.moduleContext,
|
|
413
|
-
onwarn:
|
|
414
|
-
perf:
|
|
489
|
+
onwarn: getOnWarn(config, command, defaultOnWarnHandler),
|
|
490
|
+
perf: getOption('perf', false),
|
|
415
491
|
plugins: config.plugins,
|
|
416
|
-
preferConst:
|
|
417
|
-
preserveSymlinks:
|
|
418
|
-
treeshake: getObjectOption('treeshake'),
|
|
492
|
+
preferConst: getOption('preferConst'),
|
|
493
|
+
preserveSymlinks: getOption('preserveSymlinks'),
|
|
494
|
+
treeshake: getObjectOption(config, command, 'treeshake'),
|
|
419
495
|
watch: config.watch
|
|
420
496
|
};
|
|
421
|
-
// legacy, to ensure e.g. commonjs plugin still works
|
|
422
|
-
inputOptions.entry = inputOptions.input;
|
|
423
|
-
var commandExternal = (command.external || '').split(',');
|
|
424
|
-
var configExternal = config.external;
|
|
425
|
-
if (command.globals) {
|
|
426
|
-
var globals_1 = Object.create(null);
|
|
427
|
-
command.globals.split(',').forEach(function (str) {
|
|
428
|
-
var names = str.split(':');
|
|
429
|
-
globals_1[names[0]] = names[1];
|
|
430
|
-
// Add missing Module IDs to external.
|
|
431
|
-
if (commandExternal.indexOf(names[0]) === -1) {
|
|
432
|
-
commandExternal.push(names[0]);
|
|
433
|
-
}
|
|
434
|
-
});
|
|
435
|
-
command.globals = globals_1;
|
|
436
|
-
}
|
|
437
|
-
if (typeof configExternal === 'function') {
|
|
438
|
-
inputOptions.external = function (id) {
|
|
439
|
-
var rest = [];
|
|
440
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
441
|
-
rest[_i - 1] = arguments[_i];
|
|
442
|
-
}
|
|
443
|
-
return configExternal.apply(void 0, [id].concat(rest)) || commandExternal.indexOf(id) !== -1;
|
|
444
|
-
};
|
|
445
|
-
}
|
|
446
|
-
else {
|
|
447
|
-
inputOptions.external = (configExternal || []).concat(commandExternal);
|
|
448
|
-
}
|
|
449
|
-
if (command.silent) {
|
|
450
|
-
inputOptions.onwarn = function () { };
|
|
451
|
-
}
|
|
452
|
-
// Make sure the CLI treats this the same way as when we are code-splitting
|
|
453
497
|
if (inputOptions.experimentalPreserveModules && !Array.isArray(inputOptions.input)) {
|
|
454
498
|
inputOptions.input = [inputOptions.input];
|
|
455
499
|
}
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
freeze: getOutputOption('freeze'),
|
|
466
|
-
globals: getOutputOption('globals'),
|
|
467
|
-
indent: getOutputOption('indent'),
|
|
468
|
-
interop: getOutputOption('interop'),
|
|
469
|
-
intro: getOutputOption('intro'),
|
|
470
|
-
legacy: getOutputOption('legacy'),
|
|
471
|
-
name: getOutputOption('name'),
|
|
472
|
-
namespaceToStringTag: getOutputOption('namespaceToStringTag'),
|
|
473
|
-
noConflict: getOutputOption('noConflict'),
|
|
474
|
-
outro: getOutputOption('outro'),
|
|
475
|
-
paths: getOutputOption('paths'),
|
|
476
|
-
sourcemap: getOutputOption('sourcemap'),
|
|
477
|
-
sourcemapFile: getOutputOption('sourcemapFile'),
|
|
478
|
-
strict: getOutputOption('strict')
|
|
479
|
-
};
|
|
480
|
-
var mergedOutputOptions;
|
|
481
|
-
if (Array.isArray(config.output)) {
|
|
482
|
-
mergedOutputOptions = config.output.map(function (output) {
|
|
483
|
-
return Object.assign({}, output, command.output);
|
|
484
|
-
});
|
|
485
|
-
}
|
|
486
|
-
else if (config.output && command.output) {
|
|
487
|
-
mergedOutputOptions = [Object.assign({}, config.output, command.output)];
|
|
488
|
-
}
|
|
489
|
-
else {
|
|
490
|
-
mergedOutputOptions =
|
|
491
|
-
command.output || config.output
|
|
492
|
-
? ensureArray(command.output || config.output)
|
|
493
|
-
: [
|
|
494
|
-
{
|
|
495
|
-
file: command.output ? command.output.file : null,
|
|
496
|
-
format: command.output ? command.output.format : null
|
|
497
|
-
}
|
|
498
|
-
];
|
|
499
|
-
}
|
|
500
|
-
var outputOptions = mergedOutputOptions.map(function (output) {
|
|
501
|
-
return Object.assign({}, baseOutputOptions, output);
|
|
502
|
-
});
|
|
503
|
-
// check for errors
|
|
504
|
-
var validKeys = Object.keys(inputOptions).concat(Object.keys(baseOutputOptions), [
|
|
505
|
-
'pureExternalModules' // (backward compatibility) till everyone moves to treeshake.pureExternalModules
|
|
506
|
-
]);
|
|
507
|
-
var outputOptionKeys = Array.isArray(config.output)
|
|
508
|
-
? config.output.reduce(function (keys, o) { return keys.concat(Object.keys(o)); }, [])
|
|
509
|
-
: Object.keys(config.output || {});
|
|
510
|
-
var errors = Object.keys(config || {}).concat(outputOptionKeys).filter(function (k) { return k !== 'output' && validKeys.indexOf(k) === -1; });
|
|
500
|
+
// legacy to make sure certain plugins still work
|
|
501
|
+
inputOptions.entry = Array.isArray(inputOptions.input)
|
|
502
|
+
? inputOptions.input[0]
|
|
503
|
+
: inputOptions.input;
|
|
504
|
+
return inputOptions;
|
|
505
|
+
}
|
|
506
|
+
function getOutputOptions(config, command) {
|
|
507
|
+
if (command === void 0) { command = {}; }
|
|
508
|
+
var getOption = createGetOption(config, command);
|
|
511
509
|
return {
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
510
|
+
amd: Object.assign({}, config.amd, command.amd),
|
|
511
|
+
banner: getOption('banner'),
|
|
512
|
+
dir: getOption('dir'),
|
|
513
|
+
exports: getOption('exports'),
|
|
514
|
+
extend: getOption('extend'),
|
|
515
|
+
file: getOption('file'),
|
|
516
|
+
footer: getOption('footer'),
|
|
517
|
+
format: getOption('format'),
|
|
518
|
+
freeze: getOption('freeze'),
|
|
519
|
+
globals: getOption('globals'),
|
|
520
|
+
indent: getOption('indent', true),
|
|
521
|
+
interop: getOption('interop', true),
|
|
522
|
+
intro: getOption('intro'),
|
|
523
|
+
legacy: getOption('legacy', false),
|
|
524
|
+
name: getOption('name'),
|
|
525
|
+
namespaceToStringTag: getOption('namespaceToStringTag'),
|
|
526
|
+
noConflict: getOption('noConflict'),
|
|
527
|
+
outro: getOption('outro'),
|
|
528
|
+
paths: getOption('paths'),
|
|
529
|
+
sourcemap: getOption('sourcemap'),
|
|
530
|
+
sourcemapFile: getOption('sourcemapFile'),
|
|
531
|
+
strict: getOption('strict', true)
|
|
518
532
|
};
|
|
519
533
|
}
|
|
520
534
|
function deprecate(config, command, deprecateConfig) {
|
|
@@ -532,17 +546,10 @@ function deprecate(config, command, deprecateConfig) {
|
|
|
532
546
|
if (typeof command.output === 'string') {
|
|
533
547
|
deprecations.push({
|
|
534
548
|
old: '--output',
|
|
535
|
-
new: '--
|
|
549
|
+
new: '--file'
|
|
536
550
|
});
|
|
537
551
|
command.output = { file: command.output };
|
|
538
552
|
}
|
|
539
|
-
if (command.format) {
|
|
540
|
-
deprecations.push({
|
|
541
|
-
old: '--format',
|
|
542
|
-
new: '--output.format'
|
|
543
|
-
});
|
|
544
|
-
(command.output || (command.output = {})).format = command.format;
|
|
545
|
-
}
|
|
546
553
|
// config file
|
|
547
554
|
deprecations.push.apply(deprecations, deprecateOptions(config, deprecateConfig));
|
|
548
555
|
return deprecations;
|
|
@@ -5985,48 +5992,56 @@ function first(candidates) {
|
|
|
5985
5992
|
};
|
|
5986
5993
|
}
|
|
5987
5994
|
|
|
5988
|
-
var
|
|
5989
|
-
|
|
5990
|
-
|
|
5991
|
-
|
|
5992
|
-
|
|
5993
|
-
|
|
5994
|
-
|
|
5995
|
-
|
|
5996
|
-
|
|
5997
|
-
|
|
5998
|
-
|
|
5999
|
-
|
|
6000
|
-
|
|
6001
|
-
|
|
6002
|
-
|
|
6003
|
-
|
|
6004
|
-
|
|
6005
|
-
|
|
6006
|
-
|
|
5995
|
+
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
5996
|
+
function encode(decoded) {
|
|
5997
|
+
var sourceFileIndex = 0; // second field
|
|
5998
|
+
var sourceCodeLine = 0; // third field
|
|
5999
|
+
var sourceCodeColumn = 0; // fourth field
|
|
6000
|
+
var nameIndex = 0; // fifth field
|
|
6001
|
+
var mappings = '';
|
|
6002
|
+
for (var i = 0; i < decoded.length; i++) {
|
|
6003
|
+
var line = decoded[i];
|
|
6004
|
+
if (i > 0)
|
|
6005
|
+
mappings += ';';
|
|
6006
|
+
if (line.length === 0)
|
|
6007
|
+
continue;
|
|
6008
|
+
var generatedCodeColumn = 0; // first field
|
|
6009
|
+
var lineMappings = [];
|
|
6010
|
+
for (var _i = 0, line_1 = line; _i < line_1.length; _i++) {
|
|
6011
|
+
var segment = line_1[_i];
|
|
6012
|
+
var segmentMappings = encodeInteger(segment[0] - generatedCodeColumn);
|
|
6013
|
+
generatedCodeColumn = segment[0];
|
|
6014
|
+
if (segment.length > 1) {
|
|
6015
|
+
segmentMappings +=
|
|
6016
|
+
encodeInteger(segment[1] - sourceFileIndex) +
|
|
6017
|
+
encodeInteger(segment[2] - sourceCodeLine) +
|
|
6018
|
+
encodeInteger(segment[3] - sourceCodeColumn);
|
|
6019
|
+
sourceFileIndex = segment[1];
|
|
6020
|
+
sourceCodeLine = segment[2];
|
|
6021
|
+
sourceCodeColumn = segment[3];
|
|
6022
|
+
}
|
|
6023
|
+
if (segment.length === 5) {
|
|
6024
|
+
segmentMappings += encodeInteger(segment[4] - nameIndex);
|
|
6025
|
+
nameIndex = segment[4];
|
|
6026
|
+
}
|
|
6027
|
+
lineMappings.push(segmentMappings);
|
|
6028
|
+
}
|
|
6029
|
+
mappings += lineMappings.join(',');
|
|
6030
|
+
}
|
|
6031
|
+
return mappings;
|
|
6007
6032
|
}
|
|
6008
|
-
|
|
6009
|
-
|
|
6010
|
-
|
|
6011
|
-
|
|
6012
|
-
|
|
6013
|
-
|
|
6014
|
-
|
|
6015
|
-
|
|
6016
|
-
|
|
6017
|
-
|
|
6018
|
-
|
|
6019
|
-
|
|
6020
|
-
num >>= 5;
|
|
6021
|
-
|
|
6022
|
-
if ( num > 0 ) {
|
|
6023
|
-
clamped |= 32;
|
|
6024
|
-
}
|
|
6025
|
-
|
|
6026
|
-
result += integerToChar[ clamped ];
|
|
6027
|
-
} while ( num > 0 );
|
|
6028
|
-
|
|
6029
|
-
return result;
|
|
6033
|
+
function encodeInteger(num) {
|
|
6034
|
+
var result = '';
|
|
6035
|
+
num = num < 0 ? (-num << 1) | 1 : num << 1;
|
|
6036
|
+
do {
|
|
6037
|
+
var clamped = num & 31;
|
|
6038
|
+
num >>= 5;
|
|
6039
|
+
if (num > 0) {
|
|
6040
|
+
clamped |= 32;
|
|
6041
|
+
}
|
|
6042
|
+
result += chars[clamped];
|
|
6043
|
+
} while (num > 0);
|
|
6044
|
+
return result;
|
|
6030
6045
|
}
|
|
6031
6046
|
|
|
6032
6047
|
function Chunk ( start, end, content ) {
|
|
@@ -6207,7 +6222,7 @@ function SourceMap ( properties ) {
|
|
|
6207
6222
|
this.sources = properties.sources;
|
|
6208
6223
|
this.sourcesContent = properties.sourcesContent;
|
|
6209
6224
|
this.names = properties.names;
|
|
6210
|
-
this.mappings = properties.mappings;
|
|
6225
|
+
this.mappings = encode(properties.mappings);
|
|
6211
6226
|
}
|
|
6212
6227
|
|
|
6213
6228
|
SourceMap.prototype = {
|
|
@@ -6273,51 +6288,33 @@ function isObject ( thing ) {
|
|
|
6273
6288
|
|
|
6274
6289
|
function getLocator ( source ) {
|
|
6275
6290
|
var originalLines = source.split( '\n' );
|
|
6291
|
+
var lineOffsets = [];
|
|
6276
6292
|
|
|
6277
|
-
var
|
|
6278
|
-
|
|
6279
|
-
|
|
6280
|
-
var range = { start: start, end: end, line: i };
|
|
6281
|
-
|
|
6282
|
-
start = end;
|
|
6283
|
-
return range;
|
|
6284
|
-
});
|
|
6285
|
-
|
|
6286
|
-
var i = 0;
|
|
6287
|
-
|
|
6288
|
-
function rangeContains ( range, index ) {
|
|
6289
|
-
return range.start <= index && index < range.end;
|
|
6290
|
-
}
|
|
6291
|
-
|
|
6292
|
-
function getLocation ( range, index ) {
|
|
6293
|
-
return { line: range.line, column: index - range.start };
|
|
6293
|
+
for ( var i = 0, pos = 0; i < originalLines.length; i++ ) {
|
|
6294
|
+
lineOffsets.push( pos );
|
|
6295
|
+
pos += originalLines[i].length + 1;
|
|
6294
6296
|
}
|
|
6295
6297
|
|
|
6296
6298
|
return function locate ( index ) {
|
|
6297
|
-
var
|
|
6298
|
-
|
|
6299
|
-
|
|
6300
|
-
|
|
6301
|
-
|
|
6302
|
-
|
|
6303
|
-
|
|
6304
|
-
|
|
6305
|
-
|
|
6299
|
+
var i = 0;
|
|
6300
|
+
var j = lineOffsets.length;
|
|
6301
|
+
while ( i < j ) {
|
|
6302
|
+
var m = ( i + j ) >> 1;
|
|
6303
|
+
if ( index < lineOffsets[m] ) {
|
|
6304
|
+
j = m;
|
|
6305
|
+
} else {
|
|
6306
|
+
i = m + 1;
|
|
6307
|
+
}
|
|
6306
6308
|
}
|
|
6309
|
+
var line = i - 1;
|
|
6310
|
+
var column = index - lineOffsets[line];
|
|
6311
|
+
return { line: line, column: column };
|
|
6307
6312
|
};
|
|
6308
6313
|
}
|
|
6309
6314
|
|
|
6310
6315
|
function Mappings ( hires ) {
|
|
6311
6316
|
var this$1 = this;
|
|
6312
6317
|
|
|
6313
|
-
var offsets = {
|
|
6314
|
-
generatedCodeColumn: 0,
|
|
6315
|
-
sourceIndex: 0,
|
|
6316
|
-
sourceCodeLine: 0,
|
|
6317
|
-
sourceCodeColumn: 0,
|
|
6318
|
-
sourceCodeName: 0
|
|
6319
|
-
};
|
|
6320
|
-
|
|
6321
6318
|
var generatedCodeLine = 0;
|
|
6322
6319
|
var generatedCodeColumn = 0;
|
|
6323
6320
|
|
|
@@ -6326,14 +6323,18 @@ function Mappings ( hires ) {
|
|
|
6326
6323
|
|
|
6327
6324
|
var pending = null;
|
|
6328
6325
|
|
|
6329
|
-
this.addEdit = function ( sourceIndex, content,
|
|
6326
|
+
this.addEdit = function ( sourceIndex, content, loc, nameIndex ) {
|
|
6330
6327
|
if ( content.length ) {
|
|
6331
|
-
|
|
6328
|
+
var segment = [
|
|
6332
6329
|
generatedCodeColumn,
|
|
6333
6330
|
sourceIndex,
|
|
6334
6331
|
loc.line,
|
|
6335
|
-
loc.column
|
|
6336
|
-
|
|
6332
|
+
loc.column
|
|
6333
|
+
];
|
|
6334
|
+
if ( nameIndex >= 0 ) {
|
|
6335
|
+
segment.push( nameIndex );
|
|
6336
|
+
}
|
|
6337
|
+
rawSegments.push( segment );
|
|
6337
6338
|
} else if ( pending ) {
|
|
6338
6339
|
rawSegments.push( pending );
|
|
6339
6340
|
}
|
|
@@ -6352,8 +6353,7 @@ function Mappings ( hires ) {
|
|
|
6352
6353
|
generatedCodeColumn,
|
|
6353
6354
|
sourceIndex,
|
|
6354
6355
|
loc.line,
|
|
6355
|
-
loc.column
|
|
6356
|
-
-1
|
|
6356
|
+
loc.column
|
|
6357
6357
|
]);
|
|
6358
6358
|
}
|
|
6359
6359
|
|
|
@@ -6376,50 +6376,24 @@ function Mappings ( hires ) {
|
|
|
6376
6376
|
generatedCodeColumn,
|
|
6377
6377
|
sourceIndex,
|
|
6378
6378
|
loc.line,
|
|
6379
|
-
loc.column
|
|
6380
|
-
|
|
6379
|
+
loc.column
|
|
6380
|
+
];
|
|
6381
6381
|
};
|
|
6382
6382
|
|
|
6383
6383
|
this.advance = function (str) {
|
|
6384
6384
|
if ( !str ) { return; }
|
|
6385
6385
|
|
|
6386
6386
|
var lines = str.split( '\n' );
|
|
6387
|
-
var lastLine = lines.pop();
|
|
6388
6387
|
|
|
6389
|
-
if ( lines.length ) {
|
|
6390
|
-
|
|
6391
|
-
|
|
6392
|
-
|
|
6393
|
-
|
|
6394
|
-
generatedCodeColumn
|
|
6388
|
+
if ( lines.length > 1 ) {
|
|
6389
|
+
for ( var i = 0; i < lines.length - 1; i++ ) {
|
|
6390
|
+
generatedCodeLine++;
|
|
6391
|
+
this$1.raw[generatedCodeLine] = rawSegments = [];
|
|
6392
|
+
}
|
|
6393
|
+
generatedCodeColumn = 0;
|
|
6395
6394
|
}
|
|
6396
|
-
};
|
|
6397
6395
|
|
|
6398
|
-
|
|
6399
|
-
return this$1.raw.map( function (segments) {
|
|
6400
|
-
var generatedCodeColumn = 0;
|
|
6401
|
-
|
|
6402
|
-
return segments.map( function (segment) {
|
|
6403
|
-
var arr = [
|
|
6404
|
-
segment[0] - generatedCodeColumn,
|
|
6405
|
-
segment[1] - offsets.sourceIndex,
|
|
6406
|
-
segment[2] - offsets.sourceCodeLine,
|
|
6407
|
-
segment[3] - offsets.sourceCodeColumn
|
|
6408
|
-
];
|
|
6409
|
-
|
|
6410
|
-
generatedCodeColumn = segment[0];
|
|
6411
|
-
offsets.sourceIndex = segment[1];
|
|
6412
|
-
offsets.sourceCodeLine = segment[2];
|
|
6413
|
-
offsets.sourceCodeColumn = segment[3];
|
|
6414
|
-
|
|
6415
|
-
if ( ~segment[4] ) {
|
|
6416
|
-
arr.push( segment[4] - offsets.sourceCodeName );
|
|
6417
|
-
offsets.sourceCodeName = segment[4];
|
|
6418
|
-
}
|
|
6419
|
-
|
|
6420
|
-
return encode( arr );
|
|
6421
|
-
}).join( ',' );
|
|
6422
|
-
}).join( ';' );
|
|
6396
|
+
generatedCodeColumn += lines[lines.length - 1].length;
|
|
6423
6397
|
};
|
|
6424
6398
|
}
|
|
6425
6399
|
|
|
@@ -6534,7 +6508,7 @@ MagicString$1.prototype = {
|
|
|
6534
6508
|
return cloned;
|
|
6535
6509
|
},
|
|
6536
6510
|
|
|
6537
|
-
|
|
6511
|
+
generateDecodedMap: function generateDecodedMap ( options ) {
|
|
6538
6512
|
var this$1 = this;
|
|
6539
6513
|
|
|
6540
6514
|
options = options || {};
|
|
@@ -6555,7 +6529,7 @@ MagicString$1.prototype = {
|
|
|
6555
6529
|
if ( chunk.intro.length ) { mappings.advance( chunk.intro ); }
|
|
6556
6530
|
|
|
6557
6531
|
if ( chunk.edited ) {
|
|
6558
|
-
mappings.addEdit( sourceIndex, chunk.content,
|
|
6532
|
+
mappings.addEdit( sourceIndex, chunk.content, loc, chunk.storeName ? names.indexOf( chunk.original ) : -1 );
|
|
6559
6533
|
} else {
|
|
6560
6534
|
mappings.addUneditedChunk( sourceIndex, chunk, this$1.original, loc, this$1.sourcemapLocations );
|
|
6561
6535
|
}
|
|
@@ -6563,14 +6537,17 @@ MagicString$1.prototype = {
|
|
|
6563
6537
|
if ( chunk.outro.length ) { mappings.advance( chunk.outro ); }
|
|
6564
6538
|
});
|
|
6565
6539
|
|
|
6566
|
-
|
|
6540
|
+
return {
|
|
6567
6541
|
file: ( options.file ? options.file.split( /[\/\\]/ ).pop() : null ),
|
|
6568
6542
|
sources: [ options.source ? getRelativePath( options.file || '', options.source ) : null ],
|
|
6569
6543
|
sourcesContent: options.includeContent ? [ this.original ] : [ null ],
|
|
6570
6544
|
names: names,
|
|
6571
|
-
mappings: mappings.
|
|
6572
|
-
}
|
|
6573
|
-
|
|
6545
|
+
mappings: mappings.raw
|
|
6546
|
+
};
|
|
6547
|
+
},
|
|
6548
|
+
|
|
6549
|
+
generateMap: function generateMap ( options ) {
|
|
6550
|
+
return new SourceMap(this.generateDecodedMap( options ));
|
|
6574
6551
|
},
|
|
6575
6552
|
|
|
6576
6553
|
getIndentString: function getIndentString () {
|
|
@@ -7110,7 +7087,7 @@ Bundle.prototype = {
|
|
|
7110
7087
|
return bundle;
|
|
7111
7088
|
},
|
|
7112
7089
|
|
|
7113
|
-
|
|
7090
|
+
generateDecodedMap: function generateDecodedMap ( options ) {
|
|
7114
7091
|
var this$1 = this;
|
|
7115
7092
|
if ( options === void 0 ) options = {};
|
|
7116
7093
|
|
|
@@ -7147,7 +7124,7 @@ Bundle.prototype = {
|
|
|
7147
7124
|
|
|
7148
7125
|
if ( source.filename ) {
|
|
7149
7126
|
if ( chunk.edited ) {
|
|
7150
|
-
mappings.addEdit( sourceIndex, chunk.content,
|
|
7127
|
+
mappings.addEdit( sourceIndex, chunk.content, loc, chunk.storeName ? names.indexOf( chunk.original ) : -1 );
|
|
7151
7128
|
} else {
|
|
7152
7129
|
mappings.addUneditedChunk( sourceIndex, chunk, magicString.original, loc, magicString.sourcemapLocations );
|
|
7153
7130
|
}
|
|
@@ -7165,7 +7142,7 @@ Bundle.prototype = {
|
|
|
7165
7142
|
}
|
|
7166
7143
|
});
|
|
7167
7144
|
|
|
7168
|
-
return
|
|
7145
|
+
return {
|
|
7169
7146
|
file: ( options.file ? options.file.split( /[\/\\]/ ).pop() : null ),
|
|
7170
7147
|
sources: this.uniqueSources.map( function (source) {
|
|
7171
7148
|
return options.file ? getRelativePath( options.file, source.filename ) : source.filename;
|
|
@@ -7174,8 +7151,12 @@ Bundle.prototype = {
|
|
|
7174
7151
|
return options.includeContent ? source.content : null;
|
|
7175
7152
|
}),
|
|
7176
7153
|
names: names,
|
|
7177
|
-
mappings: mappings.
|
|
7178
|
-
}
|
|
7154
|
+
mappings: mappings.raw
|
|
7155
|
+
};
|
|
7156
|
+
},
|
|
7157
|
+
|
|
7158
|
+
generateMap: function generateMap ( options ) {
|
|
7159
|
+
return new SourceMap(this.generateDecodedMap( options ));
|
|
7179
7160
|
},
|
|
7180
7161
|
|
|
7181
7162
|
getIndentString: function getIndentString () {
|
|
@@ -14807,7 +14788,11 @@ var ExportDefaultDeclaration = /** @class */ (function (_super) {
|
|
|
14807
14788
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
14808
14789
|
}
|
|
14809
14790
|
ExportDefaultDeclaration.prototype.bindNode = function () {
|
|
14810
|
-
if (this.declarationName
|
|
14791
|
+
if (this.declarationName &&
|
|
14792
|
+
// Do not set it for Class and FunctionExpressions otherwise they get treeshaken away
|
|
14793
|
+
(isFunctionDeclaration(this.declaration) ||
|
|
14794
|
+
isClassDeclaration(this.declaration) ||
|
|
14795
|
+
isIdentifier(this.declaration))) {
|
|
14811
14796
|
this.variable.setOriginalVariable(this.scope.findVariable(this.declarationName));
|
|
14812
14797
|
}
|
|
14813
14798
|
};
|
|
@@ -16543,15 +16528,14 @@ var Module = /** @class */ (function () {
|
|
|
16543
16528
|
timeEnd('analyse ast', 3);
|
|
16544
16529
|
};
|
|
16545
16530
|
Module.prototype.removeExistingSourceMap = function () {
|
|
16546
|
-
var
|
|
16547
|
-
|
|
16531
|
+
for (var _i = 0, _a = this.comments; _i < _a.length; _i++) {
|
|
16532
|
+
var comment = _a[_i];
|
|
16548
16533
|
if (!comment.block && SOURCEMAPPING_URL_RE.test(comment.text)) {
|
|
16549
|
-
|
|
16534
|
+
this.magicString.remove(comment.start, comment.end);
|
|
16550
16535
|
}
|
|
16551
|
-
}
|
|
16536
|
+
}
|
|
16552
16537
|
};
|
|
16553
16538
|
Module.prototype.addExport = function (node) {
|
|
16554
|
-
var _this = this;
|
|
16555
16539
|
var source = node.source && node.source.value;
|
|
16556
16540
|
// export { name } from './other'
|
|
16557
16541
|
if (source) {
|
|
@@ -16563,21 +16547,22 @@ var Module = /** @class */ (function () {
|
|
|
16563
16547
|
this.exportAllSources.push(source);
|
|
16564
16548
|
}
|
|
16565
16549
|
else {
|
|
16566
|
-
node.specifiers.
|
|
16550
|
+
for (var _i = 0, _a = node.specifiers; _i < _a.length; _i++) {
|
|
16551
|
+
var specifier = _a[_i];
|
|
16567
16552
|
var name = specifier.exported.name;
|
|
16568
|
-
if (
|
|
16569
|
-
|
|
16553
|
+
if (this.exports[name] || this.reexports[name]) {
|
|
16554
|
+
this.error({
|
|
16570
16555
|
code: 'DUPLICATE_EXPORT',
|
|
16571
16556
|
message: "A module cannot have multiple exports with the same name ('" + name + "')"
|
|
16572
16557
|
}, specifier.start);
|
|
16573
16558
|
}
|
|
16574
|
-
|
|
16559
|
+
this.reexports[name] = {
|
|
16575
16560
|
start: specifier.start,
|
|
16576
16561
|
source: source,
|
|
16577
16562
|
localName: specifier.local.name,
|
|
16578
16563
|
module: null // filled in later
|
|
16579
16564
|
};
|
|
16580
|
-
}
|
|
16565
|
+
}
|
|
16581
16566
|
}
|
|
16582
16567
|
}
|
|
16583
16568
|
else if (node.type === NodeType.ExportDefaultDeclaration) {
|
|
@@ -16605,11 +16590,13 @@ var Module = /** @class */ (function () {
|
|
|
16605
16590
|
// export function foo () {}
|
|
16606
16591
|
var declaration = node.declaration;
|
|
16607
16592
|
if (declaration.type === NodeType.VariableDeclaration) {
|
|
16608
|
-
declaration.declarations.
|
|
16609
|
-
|
|
16610
|
-
|
|
16611
|
-
|
|
16612
|
-
|
|
16593
|
+
for (var _b = 0, _c = declaration.declarations; _b < _c.length; _b++) {
|
|
16594
|
+
var decl = _c[_b];
|
|
16595
|
+
for (var _d = 0, _e = extractNames(decl.id); _d < _e.length; _d++) {
|
|
16596
|
+
var localName = _e[_d];
|
|
16597
|
+
this.exports[localName] = { localName: localName };
|
|
16598
|
+
}
|
|
16599
|
+
}
|
|
16613
16600
|
}
|
|
16614
16601
|
else {
|
|
16615
16602
|
// export function foo () {}
|
|
@@ -16619,28 +16606,29 @@ var Module = /** @class */ (function () {
|
|
|
16619
16606
|
}
|
|
16620
16607
|
else {
|
|
16621
16608
|
// export { foo, bar, baz }
|
|
16622
|
-
node.specifiers.
|
|
16609
|
+
for (var _f = 0, _g = node.specifiers; _f < _g.length; _f++) {
|
|
16610
|
+
var specifier = _g[_f];
|
|
16623
16611
|
var localName = specifier.local.name;
|
|
16624
16612
|
var exportedName = specifier.exported.name;
|
|
16625
|
-
if (
|
|
16626
|
-
|
|
16613
|
+
if (this.exports[exportedName] || this.reexports[exportedName]) {
|
|
16614
|
+
this.error({
|
|
16627
16615
|
code: 'DUPLICATE_EXPORT',
|
|
16628
16616
|
message: "A module cannot have multiple exports with the same name ('" + exportedName + "')"
|
|
16629
16617
|
}, specifier.start);
|
|
16630
16618
|
}
|
|
16631
|
-
|
|
16632
|
-
}
|
|
16619
|
+
this.exports[exportedName] = { localName: localName };
|
|
16620
|
+
}
|
|
16633
16621
|
}
|
|
16634
16622
|
};
|
|
16635
16623
|
Module.prototype.addImport = function (node) {
|
|
16636
|
-
var _this = this;
|
|
16637
16624
|
var source = node.source.value;
|
|
16638
16625
|
if (this.sources.indexOf(source) === -1)
|
|
16639
16626
|
this.sources.push(source);
|
|
16640
|
-
node.specifiers.
|
|
16627
|
+
for (var _i = 0, _a = node.specifiers; _i < _a.length; _i++) {
|
|
16628
|
+
var specifier = _a[_i];
|
|
16641
16629
|
var localName = specifier.local.name;
|
|
16642
|
-
if (
|
|
16643
|
-
|
|
16630
|
+
if (this.imports[localName]) {
|
|
16631
|
+
this.error({
|
|
16644
16632
|
code: 'DUPLICATE_IMPORT',
|
|
16645
16633
|
message: "Duplicated import '" + localName + "'"
|
|
16646
16634
|
}, specifier.start);
|
|
@@ -16650,21 +16638,21 @@ var Module = /** @class */ (function () {
|
|
|
16650
16638
|
var name = isDefault
|
|
16651
16639
|
? 'default'
|
|
16652
16640
|
: isNamespace ? '*' : specifier.imported.name;
|
|
16653
|
-
|
|
16654
|
-
}
|
|
16641
|
+
this.imports[localName] = { source: source, specifier: specifier, name: name, module: null };
|
|
16642
|
+
}
|
|
16655
16643
|
};
|
|
16656
16644
|
Module.prototype.analyse = function () {
|
|
16657
|
-
var _this = this;
|
|
16658
16645
|
enhance(this.ast, this, this.dynamicImports);
|
|
16659
|
-
this.ast.body.
|
|
16646
|
+
for (var _i = 0, _a = this.ast.body; _i < _a.length; _i++) {
|
|
16647
|
+
var node = _a[_i];
|
|
16660
16648
|
if (node.isImportDeclaration) {
|
|
16661
|
-
|
|
16649
|
+
this.addImport(node);
|
|
16662
16650
|
}
|
|
16663
16651
|
else if (node
|
|
16664
16652
|
.isExportDeclaration) {
|
|
16665
|
-
|
|
16653
|
+
this.addExport(node);
|
|
16666
16654
|
}
|
|
16667
|
-
}
|
|
16655
|
+
}
|
|
16668
16656
|
};
|
|
16669
16657
|
Module.prototype.basename = function () {
|
|
16670
16658
|
var base = path.basename(this.id);
|
|
@@ -16672,17 +16660,18 @@ var Module = /** @class */ (function () {
|
|
|
16672
16660
|
return makeLegal(ext ? base.slice(0, -ext.length) : base);
|
|
16673
16661
|
};
|
|
16674
16662
|
Module.prototype.markExports = function () {
|
|
16675
|
-
var
|
|
16676
|
-
|
|
16677
|
-
var variable =
|
|
16678
|
-
variable.exportName =
|
|
16663
|
+
for (var _i = 0, _a = this.getExports(); _i < _a.length; _i++) {
|
|
16664
|
+
var exportName = _a[_i];
|
|
16665
|
+
var variable = this.traceExport(exportName);
|
|
16666
|
+
variable.exportName = exportName;
|
|
16679
16667
|
variable.includeVariable();
|
|
16680
16668
|
if (variable.isNamespace) {
|
|
16681
16669
|
variable.needsNamespaceBlock = true;
|
|
16682
16670
|
}
|
|
16683
|
-
}
|
|
16684
|
-
this.getReexports().
|
|
16685
|
-
var
|
|
16671
|
+
}
|
|
16672
|
+
for (var _b = 0, _c = this.getReexports(); _b < _c.length; _b++) {
|
|
16673
|
+
var name = _c[_b];
|
|
16674
|
+
var variable = this.traceExport(name);
|
|
16686
16675
|
variable.exportName = name;
|
|
16687
16676
|
if (variable.isExternal) {
|
|
16688
16677
|
variable.reexported = variable.module.reexported = true;
|
|
@@ -16690,31 +16679,38 @@ var Module = /** @class */ (function () {
|
|
|
16690
16679
|
else {
|
|
16691
16680
|
variable.includeVariable();
|
|
16692
16681
|
}
|
|
16693
|
-
}
|
|
16682
|
+
}
|
|
16694
16683
|
};
|
|
16695
16684
|
Module.prototype.linkDependencies = function () {
|
|
16696
16685
|
var _this = this;
|
|
16697
|
-
this.sources.
|
|
16698
|
-
var
|
|
16686
|
+
for (var _i = 0, _a = this.sources; _i < _a.length; _i++) {
|
|
16687
|
+
var source = _a[_i];
|
|
16688
|
+
var id = this.resolvedIds[source];
|
|
16699
16689
|
if (id) {
|
|
16700
|
-
var module =
|
|
16701
|
-
|
|
16690
|
+
var module = this.graph.moduleById.get(id);
|
|
16691
|
+
this.dependencies.push(module);
|
|
16702
16692
|
}
|
|
16703
|
-
}
|
|
16704
|
-
|
|
16705
|
-
Object.keys(specifiers).
|
|
16693
|
+
}
|
|
16694
|
+
var resolveSpecifiers = function (specifiers) {
|
|
16695
|
+
for (var _i = 0, _a = Object.keys(specifiers); _i < _a.length; _i++) {
|
|
16696
|
+
var name = _a[_i];
|
|
16706
16697
|
var specifier = specifiers[name];
|
|
16707
16698
|
var id = _this.resolvedIds[specifier.source];
|
|
16708
16699
|
specifier.module = _this.graph.moduleById.get(id);
|
|
16709
|
-
}
|
|
16710
|
-
}
|
|
16700
|
+
}
|
|
16701
|
+
};
|
|
16702
|
+
resolveSpecifiers(this.imports);
|
|
16703
|
+
resolveSpecifiers(this.reexports);
|
|
16711
16704
|
this.exportAllModules = this.exportAllSources.map(function (source) {
|
|
16712
16705
|
var id = _this.resolvedIds[source];
|
|
16713
16706
|
return _this.graph.moduleById.get(id);
|
|
16714
16707
|
});
|
|
16715
16708
|
};
|
|
16716
16709
|
Module.prototype.bindReferences = function () {
|
|
16717
|
-
this.ast.body
|
|
16710
|
+
for (var _i = 0, _a = this.ast.body; _i < _a.length; _i++) {
|
|
16711
|
+
var node = _a[_i];
|
|
16712
|
+
node.bind();
|
|
16713
|
+
}
|
|
16718
16714
|
};
|
|
16719
16715
|
Module.prototype.getDynamicImportExpressions = function () {
|
|
16720
16716
|
return this.dynamicImports.map(function (node) {
|
|
@@ -16798,10 +16794,11 @@ var Module = /** @class */ (function () {
|
|
|
16798
16794
|
allExports["*" + module.id] = true;
|
|
16799
16795
|
return;
|
|
16800
16796
|
}
|
|
16801
|
-
module.getAllExports().
|
|
16797
|
+
for (var _i = 0, _a = module.getAllExports(); _i < _a.length; _i++) {
|
|
16798
|
+
var name = _a[_i];
|
|
16802
16799
|
if (name !== 'default')
|
|
16803
16800
|
allExports[name] = true;
|
|
16804
|
-
}
|
|
16801
|
+
}
|
|
16805
16802
|
});
|
|
16806
16803
|
return Object.keys(allExports);
|
|
16807
16804
|
};
|
|
@@ -16810,36 +16807,38 @@ var Module = /** @class */ (function () {
|
|
|
16810
16807
|
};
|
|
16811
16808
|
Module.prototype.getReexports = function () {
|
|
16812
16809
|
var reexports = blank();
|
|
16813
|
-
|
|
16810
|
+
for (var name in this.reexports) {
|
|
16814
16811
|
reexports[name] = true;
|
|
16815
|
-
}
|
|
16812
|
+
}
|
|
16816
16813
|
this.exportAllModules.forEach(function (module) {
|
|
16817
16814
|
if (module.isExternal) {
|
|
16818
16815
|
reexports["*" + module.id] = true;
|
|
16819
16816
|
return;
|
|
16820
16817
|
}
|
|
16821
|
-
module
|
|
16822
|
-
|
|
16823
|
-
.concat(module.getReexports())
|
|
16824
|
-
.forEach(function (name) {
|
|
16818
|
+
for (var _i = 0, _a = module.getExports().concat(module.getReexports()); _i < _a.length; _i++) {
|
|
16819
|
+
var name = _a[_i];
|
|
16825
16820
|
if (name !== 'default')
|
|
16826
16821
|
reexports[name] = true;
|
|
16827
|
-
}
|
|
16822
|
+
}
|
|
16828
16823
|
});
|
|
16829
16824
|
return Object.keys(reexports);
|
|
16830
16825
|
};
|
|
16831
16826
|
Module.prototype.includeAllInBundle = function () {
|
|
16832
|
-
this.ast.body.
|
|
16827
|
+
for (var _i = 0, _a = this.ast.body; _i < _a.length; _i++) {
|
|
16828
|
+
var node = _a[_i];
|
|
16829
|
+
includeFully(node);
|
|
16830
|
+
}
|
|
16833
16831
|
};
|
|
16834
16832
|
Module.prototype.includeInBundle = function () {
|
|
16835
16833
|
var addedNewNodes = false;
|
|
16836
|
-
this.ast.body.
|
|
16834
|
+
for (var _i = 0, _a = this.ast.body; _i < _a.length; _i++) {
|
|
16835
|
+
var node = _a[_i];
|
|
16837
16836
|
if (node.shouldBeIncluded()) {
|
|
16838
16837
|
if (node.includeInBundle()) {
|
|
16839
16838
|
addedNewNodes = true;
|
|
16840
16839
|
}
|
|
16841
16840
|
}
|
|
16842
|
-
}
|
|
16841
|
+
}
|
|
16843
16842
|
return addedNewNodes;
|
|
16844
16843
|
};
|
|
16845
16844
|
Module.prototype.namespace = function () {
|
|
@@ -17047,12 +17046,12 @@ function handleMissingExport(exportName, importingModule, importedModule, import
|
|
|
17047
17046
|
}, importerStart);
|
|
17048
17047
|
}
|
|
17049
17048
|
|
|
17050
|
-
var charToInteger
|
|
17051
|
-
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
17052
|
-
for (var i = 0; i < chars.length; i++) {
|
|
17053
|
-
charToInteger$1
|
|
17049
|
+
var charToInteger = {};
|
|
17050
|
+
var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
17051
|
+
for (var i = 0; i < chars$1.length; i++) {
|
|
17052
|
+
charToInteger[chars$1.charCodeAt(i)] = i;
|
|
17054
17053
|
}
|
|
17055
|
-
function decode
|
|
17054
|
+
function decode(mappings) {
|
|
17056
17055
|
var generatedCodeColumn = 0; // first field
|
|
17057
17056
|
var sourceFileIndex = 0; // second field
|
|
17058
17057
|
var sourceCodeLine = 0; // third field
|
|
@@ -17079,7 +17078,7 @@ function decode$1(mappings) {
|
|
|
17079
17078
|
generatedCodeColumn = 0;
|
|
17080
17079
|
}
|
|
17081
17080
|
else {
|
|
17082
|
-
var integer = charToInteger
|
|
17081
|
+
var integer = charToInteger[c];
|
|
17083
17082
|
if (integer === undefined) {
|
|
17084
17083
|
throw new Error('Invalid character (' + String.fromCharCode(c) + ')');
|
|
17085
17084
|
}
|
|
@@ -17123,62 +17122,12 @@ function decode$1(mappings) {
|
|
|
17123
17122
|
decoded.push(line);
|
|
17124
17123
|
return decoded;
|
|
17125
17124
|
}
|
|
17126
|
-
function encode$1(decoded) {
|
|
17127
|
-
var sourceFileIndex = 0; // second field
|
|
17128
|
-
var sourceCodeLine = 0; // third field
|
|
17129
|
-
var sourceCodeColumn = 0; // fourth field
|
|
17130
|
-
var nameIndex = 0; // fifth field
|
|
17131
|
-
var mappings = '';
|
|
17132
|
-
for (var i = 0; i < decoded.length; i++) {
|
|
17133
|
-
var line = decoded[i];
|
|
17134
|
-
if (i > 0)
|
|
17135
|
-
mappings += ';';
|
|
17136
|
-
if (line.length === 0)
|
|
17137
|
-
continue;
|
|
17138
|
-
var generatedCodeColumn = 0; // first field
|
|
17139
|
-
var lineMappings = [];
|
|
17140
|
-
for (var _i = 0, line_1 = line; _i < line_1.length; _i++) {
|
|
17141
|
-
var segment = line_1[_i];
|
|
17142
|
-
var segmentMappings = encodeInteger$1(segment[0] - generatedCodeColumn);
|
|
17143
|
-
generatedCodeColumn = segment[0];
|
|
17144
|
-
if (segment.length > 1) {
|
|
17145
|
-
segmentMappings +=
|
|
17146
|
-
encodeInteger$1(segment[1] - sourceFileIndex) +
|
|
17147
|
-
encodeInteger$1(segment[2] - sourceCodeLine) +
|
|
17148
|
-
encodeInteger$1(segment[3] - sourceCodeColumn);
|
|
17149
|
-
sourceFileIndex = segment[1];
|
|
17150
|
-
sourceCodeLine = segment[2];
|
|
17151
|
-
sourceCodeColumn = segment[3];
|
|
17152
|
-
}
|
|
17153
|
-
if (segment.length === 5) {
|
|
17154
|
-
segmentMappings += encodeInteger$1(segment[4] - nameIndex);
|
|
17155
|
-
nameIndex = segment[4];
|
|
17156
|
-
}
|
|
17157
|
-
lineMappings.push(segmentMappings);
|
|
17158
|
-
}
|
|
17159
|
-
mappings += lineMappings.join(',');
|
|
17160
|
-
}
|
|
17161
|
-
return mappings;
|
|
17162
|
-
}
|
|
17163
|
-
function encodeInteger$1(num) {
|
|
17164
|
-
var result = '';
|
|
17165
|
-
num = num < 0 ? (-num << 1) | 1 : num << 1;
|
|
17166
|
-
do {
|
|
17167
|
-
var clamped = num & 31;
|
|
17168
|
-
num >>= 5;
|
|
17169
|
-
if (num > 0) {
|
|
17170
|
-
clamped |= 32;
|
|
17171
|
-
}
|
|
17172
|
-
result += chars[clamped];
|
|
17173
|
-
} while (num > 0);
|
|
17174
|
-
return result;
|
|
17175
|
-
}
|
|
17176
17125
|
|
|
17177
17126
|
function transform(graph, source, id, plugins) {
|
|
17178
17127
|
var sourcemapChain = [];
|
|
17179
17128
|
var originalSourcemap = typeof source.map === 'string' ? JSON.parse(source.map) : source.map;
|
|
17180
17129
|
if (originalSourcemap && typeof originalSourcemap.mappings === 'string') {
|
|
17181
|
-
originalSourcemap.mappings = decode
|
|
17130
|
+
originalSourcemap.mappings = decode(originalSourcemap.mappings);
|
|
17182
17131
|
}
|
|
17183
17132
|
var originalCode = source.code;
|
|
17184
17133
|
var ast = source.ast;
|
|
@@ -17250,7 +17199,7 @@ function transform(graph, source, id, plugins) {
|
|
|
17250
17199
|
result.map = JSON.parse(result.map);
|
|
17251
17200
|
}
|
|
17252
17201
|
if (result.map && typeof result.map.mappings === 'string') {
|
|
17253
|
-
result.map.mappings = decode
|
|
17202
|
+
result.map.mappings = decode(result.map.mappings);
|
|
17254
17203
|
}
|
|
17255
17204
|
// strict null check allows 'null' maps to not be pushed to the chain, while 'undefined' gets the missing map warning
|
|
17256
17205
|
if (result.map !== null) {
|
|
@@ -18012,9 +17961,7 @@ function transformBundle(code, plugins, sourcemapChain, options) {
|
|
|
18012
17961
|
return promise;
|
|
18013
17962
|
return promise.then(function (code) {
|
|
18014
17963
|
return Promise.resolve()
|
|
18015
|
-
.then(function () {
|
|
18016
|
-
return plugin.transformBundle(code, options);
|
|
18017
|
-
})
|
|
17964
|
+
.then(function () { return plugin.transformBundle(code, options); })
|
|
18018
17965
|
.then(function (result) {
|
|
18019
17966
|
if (result == null)
|
|
18020
17967
|
return code;
|
|
@@ -18026,7 +17973,7 @@ function transformBundle(code, plugins, sourcemapChain, options) {
|
|
|
18026
17973
|
}
|
|
18027
17974
|
var map = typeof result.map === 'string' ? JSON.parse(result.map) : result.map;
|
|
18028
17975
|
if (map && typeof map.mappings === 'string') {
|
|
18029
|
-
map.mappings = decode
|
|
17976
|
+
map.mappings = decode(map.mappings);
|
|
18030
17977
|
}
|
|
18031
17978
|
// strict null check allows 'null' maps to not be pushed to the chain, while 'undefined' gets the missing map warning
|
|
18032
17979
|
if (map !== null) {
|
|
@@ -18063,23 +18010,22 @@ var Link = /** @class */ (function () {
|
|
|
18063
18010
|
this.mappings = map.mappings;
|
|
18064
18011
|
}
|
|
18065
18012
|
Link.prototype.traceMappings = function () {
|
|
18066
|
-
var _this = this;
|
|
18067
18013
|
var sources = [];
|
|
18068
18014
|
var sourcesContent = [];
|
|
18069
18015
|
var names = [];
|
|
18070
|
-
var mappings =
|
|
18016
|
+
var mappings = [];
|
|
18017
|
+
for (var _i = 0, _a = this.mappings; _i < _a.length; _i++) {
|
|
18018
|
+
var line = _a[_i];
|
|
18071
18019
|
var tracedLine = [];
|
|
18072
|
-
line.
|
|
18073
|
-
var
|
|
18020
|
+
for (var _b = 0, line_1 = line; _b < line_1.length; _b++) {
|
|
18021
|
+
var segment = line_1[_b];
|
|
18022
|
+
var source = this.sources[segment[1]];
|
|
18074
18023
|
if (!source)
|
|
18075
|
-
|
|
18076
|
-
var traced = source.traceSegment(segment[2], segment[3],
|
|
18024
|
+
continue;
|
|
18025
|
+
var traced = source.traceSegment(segment[2], segment[3], this.names[segment[4]]);
|
|
18077
18026
|
if (traced) {
|
|
18078
|
-
var sourceIndex = null;
|
|
18079
|
-
var nameIndex = null;
|
|
18080
|
-
segment = [segment[0], null, traced.line, traced.column];
|
|
18081
18027
|
// newer sources are more likely to be used, so search backwards.
|
|
18082
|
-
sourceIndex = sources.lastIndexOf(traced.source.filename);
|
|
18028
|
+
var sourceIndex = sources.lastIndexOf(traced.source.filename);
|
|
18083
18029
|
if (sourceIndex === -1) {
|
|
18084
18030
|
sourceIndex = sources.length;
|
|
18085
18031
|
sources.push(traced.source.filename);
|
|
@@ -18094,28 +18040,33 @@ var Link = /** @class */ (function () {
|
|
|
18094
18040
|
message: "Multiple conflicting contents for sourcemap source " + source.filename
|
|
18095
18041
|
});
|
|
18096
18042
|
}
|
|
18097
|
-
|
|
18043
|
+
var tracedSegment = [
|
|
18044
|
+
segment[0],
|
|
18045
|
+
sourceIndex,
|
|
18046
|
+
traced.line,
|
|
18047
|
+
traced.column
|
|
18048
|
+
];
|
|
18098
18049
|
if (traced.name) {
|
|
18099
|
-
nameIndex = names.indexOf(traced.name);
|
|
18050
|
+
var nameIndex = names.indexOf(traced.name);
|
|
18100
18051
|
if (nameIndex === -1) {
|
|
18101
18052
|
nameIndex = names.length;
|
|
18102
18053
|
names.push(traced.name);
|
|
18103
18054
|
}
|
|
18104
|
-
|
|
18055
|
+
tracedSegment[4] = nameIndex;
|
|
18105
18056
|
}
|
|
18106
|
-
tracedLine.push(
|
|
18057
|
+
tracedLine.push(tracedSegment);
|
|
18107
18058
|
}
|
|
18108
|
-
}
|
|
18109
|
-
|
|
18110
|
-
}
|
|
18059
|
+
}
|
|
18060
|
+
mappings.push(tracedLine);
|
|
18061
|
+
}
|
|
18111
18062
|
return { sources: sources, sourcesContent: sourcesContent, names: names, mappings: mappings };
|
|
18112
18063
|
};
|
|
18113
18064
|
Link.prototype.traceSegment = function (line, column, name) {
|
|
18114
18065
|
var segments = this.mappings[line];
|
|
18115
18066
|
if (!segments)
|
|
18116
18067
|
return null;
|
|
18117
|
-
for (var
|
|
18118
|
-
var segment =
|
|
18068
|
+
for (var _i = 0, segments_1 = segments; _i < segments_1.length; _i++) {
|
|
18069
|
+
var segment = segments_1[_i];
|
|
18119
18070
|
if (segment[0] > column)
|
|
18120
18071
|
return null;
|
|
18121
18072
|
if (segment[0] === column) {
|
|
@@ -18179,14 +18130,9 @@ function collapseSourcemaps(bundle, file, map, modules, bundleSourcemapChain) {
|
|
|
18179
18130
|
if (file) {
|
|
18180
18131
|
var directory_2 = path.dirname(file);
|
|
18181
18132
|
sources = sources.map(function (source) { return path.relative(directory_2, source); });
|
|
18182
|
-
|
|
18133
|
+
file = path.basename(file);
|
|
18183
18134
|
}
|
|
18184
|
-
|
|
18185
|
-
map.sources = sources;
|
|
18186
|
-
map.sourcesContent = sourcesContent;
|
|
18187
|
-
map.names = names;
|
|
18188
|
-
map.mappings = encode$1(mappings);
|
|
18189
|
-
return map;
|
|
18135
|
+
return new SourceMap({ file: file, sources: sources, sourcesContent: sourcesContent, names: names, mappings: mappings });
|
|
18190
18136
|
}
|
|
18191
18137
|
|
|
18192
18138
|
function callIfFunction(thing) {
|
|
@@ -18737,7 +18683,7 @@ var Chunk$1 = /** @class */ (function () {
|
|
|
18737
18683
|
timeStart('render modules', 3);
|
|
18738
18684
|
var indentString = getIndentString(_this.orderedModules, options);
|
|
18739
18685
|
var renderOptions = {
|
|
18740
|
-
legacy:
|
|
18686
|
+
legacy: options.legacy,
|
|
18741
18687
|
freeze: options.freeze !== false,
|
|
18742
18688
|
namespaceToStringTag: options.namespaceToStringTag === true,
|
|
18743
18689
|
indent: indentString,
|
|
@@ -18798,9 +18744,9 @@ var Chunk$1 = /** @class */ (function () {
|
|
|
18798
18744
|
if (footer)
|
|
18799
18745
|
magicString.append('\n' + footer);
|
|
18800
18746
|
var prevCode = magicString.toString();
|
|
18801
|
-
var map = null;
|
|
18802
18747
|
var bundleSourcemapChain = [];
|
|
18803
18748
|
return transformBundle(prevCode, _this.graph.plugins, bundleSourcemapChain, options).then(function (code) {
|
|
18749
|
+
var map;
|
|
18804
18750
|
if (options.sourcemap) {
|
|
18805
18751
|
timeStart('sourcemap', 3);
|
|
18806
18752
|
var file = options.file ? options.sourcemapFile || options.file : _this.id;
|
|
@@ -18810,11 +18756,8 @@ var Chunk$1 = /** @class */ (function () {
|
|
|
18810
18756
|
_this.graph.plugins.find(function (plugin) {
|
|
18811
18757
|
return Boolean(plugin.transform || plugin.transformBundle);
|
|
18812
18758
|
})) {
|
|
18813
|
-
|
|
18814
|
-
|
|
18815
|
-
map.mappings = decode$1(map.mappings);
|
|
18816
|
-
}
|
|
18817
|
-
map = collapseSourcemaps(_this, file, map, usedModules, bundleSourcemapChain);
|
|
18759
|
+
var decodedMap = magicString.generateDecodedMap({});
|
|
18760
|
+
map = collapseSourcemaps(_this, file, decodedMap, usedModules, bundleSourcemapChain);
|
|
18818
18761
|
}
|
|
18819
18762
|
else {
|
|
18820
18763
|
map = magicString.generateMap({ file: file, includeContent: true });
|
|
@@ -18953,16 +18896,18 @@ var Graph = /** @class */ (function () {
|
|
|
18953
18896
|
this.cachedModules = new Map();
|
|
18954
18897
|
if (options.cache) {
|
|
18955
18898
|
if (options.cache.modules) {
|
|
18956
|
-
options.cache.modules.
|
|
18957
|
-
|
|
18958
|
-
|
|
18899
|
+
for (var _i = 0, _a = options.cache.modules; _i < _a.length; _i++) {
|
|
18900
|
+
var module = _a[_i];
|
|
18901
|
+
this.cachedModules.set(module.id, module);
|
|
18902
|
+
}
|
|
18959
18903
|
}
|
|
18960
18904
|
else {
|
|
18961
18905
|
var chunks = options.cache.chunks;
|
|
18962
18906
|
for (var chunkName in chunks) {
|
|
18963
|
-
chunks[chunkName].modules.
|
|
18964
|
-
|
|
18965
|
-
|
|
18907
|
+
for (var _b = 0, _c = chunks[chunkName].modules; _b < _c.length; _b++) {
|
|
18908
|
+
var module = _c[_b];
|
|
18909
|
+
this.cachedModules.set(module.id, module);
|
|
18910
|
+
}
|
|
18966
18911
|
}
|
|
18967
18912
|
}
|
|
18968
18913
|
}
|
|
@@ -19019,9 +18964,10 @@ var Graph = /** @class */ (function () {
|
|
|
19019
18964
|
.concat(handleMissingExport));
|
|
19020
18965
|
this.scope = new GlobalScope();
|
|
19021
18966
|
// TODO strictly speaking, this only applies with non-ES6, non-default-only bundles
|
|
19022
|
-
['module', 'exports', '_interopDefault'].
|
|
19023
|
-
|
|
19024
|
-
|
|
18967
|
+
for (var _d = 0, _e = ['module', 'exports', '_interopDefault']; _d < _e.length; _d++) {
|
|
18968
|
+
var name = _e[_d];
|
|
18969
|
+
this.scope.findVariable(name); // creates global variable as side-effect
|
|
18970
|
+
}
|
|
19025
18971
|
this.moduleById = new Map();
|
|
19026
18972
|
this.modules = [];
|
|
19027
18973
|
this.externalModules = [];
|
|
@@ -19032,9 +18978,9 @@ var Graph = /** @class */ (function () {
|
|
|
19032
18978
|
}
|
|
19033
18979
|
else if (typeof optionsModuleContext === 'object') {
|
|
19034
18980
|
var moduleContext_1 = new Map();
|
|
19035
|
-
|
|
19036
|
-
|
|
19037
|
-
}
|
|
18981
|
+
for (var key in optionsModuleContext) {
|
|
18982
|
+
moduleContext_1.set(path.resolve(key), optionsModuleContext[key]);
|
|
18983
|
+
}
|
|
19038
18984
|
this.getModuleContext = function (id) { return moduleContext_1.get(id) || _this.context; };
|
|
19039
18985
|
}
|
|
19040
18986
|
else {
|
|
@@ -19049,7 +18995,6 @@ var Graph = /** @class */ (function () {
|
|
|
19049
18995
|
}
|
|
19050
18996
|
this.onwarn = options.onwarn || makeOnwarn();
|
|
19051
18997
|
this.varOrConst = options.preferConst ? 'const' : 'var';
|
|
19052
|
-
this.legacy = options.legacy;
|
|
19053
18998
|
this.acornOptions = options.acorn || {};
|
|
19054
18999
|
var acornPluginsToInject = [];
|
|
19055
19000
|
this.dynamicImport =
|
|
@@ -19095,26 +19040,36 @@ var Graph = /** @class */ (function () {
|
|
|
19095
19040
|
});
|
|
19096
19041
|
};
|
|
19097
19042
|
Graph.prototype.link = function () {
|
|
19098
|
-
this.modules
|
|
19099
|
-
|
|
19043
|
+
for (var _i = 0, _a = this.modules; _i < _a.length; _i++) {
|
|
19044
|
+
var module = _a[_i];
|
|
19045
|
+
module.linkDependencies();
|
|
19046
|
+
}
|
|
19047
|
+
for (var _b = 0, _c = this.modules; _b < _c.length; _b++) {
|
|
19048
|
+
var module = _c[_b];
|
|
19049
|
+
module.bindReferences();
|
|
19050
|
+
}
|
|
19100
19051
|
};
|
|
19101
19052
|
Graph.prototype.includeMarked = function (modules) {
|
|
19102
19053
|
if (this.treeshake) {
|
|
19103
|
-
var
|
|
19054
|
+
var addedNewNodes = void 0, treeshakingPass = 1;
|
|
19104
19055
|
do {
|
|
19105
19056
|
timeStart("treeshaking pass " + treeshakingPass, 3);
|
|
19106
|
-
|
|
19107
|
-
modules.
|
|
19057
|
+
addedNewNodes = false;
|
|
19058
|
+
for (var _i = 0, modules_1 = modules; _i < modules_1.length; _i++) {
|
|
19059
|
+
var module = modules_1[_i];
|
|
19108
19060
|
if (module.includeInBundle()) {
|
|
19109
|
-
|
|
19061
|
+
addedNewNodes = true;
|
|
19110
19062
|
}
|
|
19111
|
-
}
|
|
19063
|
+
}
|
|
19112
19064
|
timeEnd("treeshaking pass " + treeshakingPass++, 3);
|
|
19113
|
-
} while (
|
|
19065
|
+
} while (addedNewNodes);
|
|
19114
19066
|
}
|
|
19115
19067
|
else {
|
|
19116
19068
|
// Necessary to properly replace namespace imports
|
|
19117
|
-
|
|
19069
|
+
for (var _a = 0, modules_2 = modules; _a < modules_2.length; _a++) {
|
|
19070
|
+
var module = modules_2[_a];
|
|
19071
|
+
module.includeAllInBundle();
|
|
19072
|
+
}
|
|
19118
19073
|
}
|
|
19119
19074
|
};
|
|
19120
19075
|
Graph.prototype.buildSingle = function (entryModuleId) {
|
|
@@ -19129,21 +19084,25 @@ var Graph = /** @class */ (function () {
|
|
|
19129
19084
|
// determine the topological execution order for the bundle
|
|
19130
19085
|
timeStart('analyse dependency graph', 2);
|
|
19131
19086
|
_this.link();
|
|
19132
|
-
var _a = _this.analyseExecution([entryModule]), orderedModules = _a.orderedModules, dynamicImports = _a.dynamicImports;
|
|
19087
|
+
var _a = _this.analyseExecution([entryModule], false), orderedModules = _a.orderedModules, dynamicImports = _a.dynamicImports;
|
|
19133
19088
|
timeEnd('analyse dependency graph', 2);
|
|
19134
19089
|
// Phase 3 – marking. We include all statements that should be included
|
|
19135
19090
|
timeStart('mark included statements', 2);
|
|
19136
19091
|
entryModule.markExports();
|
|
19137
|
-
dynamicImports.
|
|
19092
|
+
for (var _i = 0, dynamicImports_1 = dynamicImports; _i < dynamicImports_1.length; _i++) {
|
|
19093
|
+
var dynamicImportModule = dynamicImports_1[_i];
|
|
19138
19094
|
if (entryModule !== dynamicImportModule)
|
|
19139
19095
|
dynamicImportModule.markExports();
|
|
19140
19096
|
// all dynamic import modules inlined for single-file build
|
|
19141
19097
|
dynamicImportModule.namespace().includeVariable();
|
|
19142
|
-
}
|
|
19098
|
+
}
|
|
19143
19099
|
// only include statements that should appear in the bundle
|
|
19144
19100
|
_this.includeMarked(orderedModules);
|
|
19145
19101
|
// check for unused external imports
|
|
19146
|
-
_this.externalModules
|
|
19102
|
+
for (var _b = 0, _c = _this.externalModules; _b < _c.length; _b++) {
|
|
19103
|
+
var module = _c[_b];
|
|
19104
|
+
module.warnUnusedImports();
|
|
19105
|
+
}
|
|
19147
19106
|
timeEnd('mark included statements', 2);
|
|
19148
19107
|
// Phase 4 – we construct the chunk itself, generating its import and export facades
|
|
19149
19108
|
timeStart('generate chunks', 2);
|
|
@@ -19169,21 +19128,26 @@ var Graph = /** @class */ (function () {
|
|
|
19169
19128
|
// determine the topological execution order for the bundle
|
|
19170
19129
|
timeStart('analyse dependency graph', 2);
|
|
19171
19130
|
_this.link();
|
|
19172
|
-
var _a = _this.analyseExecution(entryModules, preserveModules), orderedModules = _a.orderedModules, dynamicImports = _a.dynamicImports;
|
|
19173
|
-
dynamicImports.
|
|
19131
|
+
var _a = _this.analyseExecution(entryModules, !preserveModules), orderedModules = _a.orderedModules, dynamicImports = _a.dynamicImports;
|
|
19132
|
+
for (var _i = 0, dynamicImports_2 = dynamicImports; _i < dynamicImports_2.length; _i++) {
|
|
19133
|
+
var dynamicImportModule = dynamicImports_2[_i];
|
|
19174
19134
|
if (entryModules.indexOf(dynamicImportModule) === -1)
|
|
19175
19135
|
entryModules.push(dynamicImportModule);
|
|
19176
|
-
}
|
|
19136
|
+
}
|
|
19177
19137
|
timeEnd('analyse dependency graph', 2);
|
|
19178
19138
|
// Phase 3 – marking. We include all statements that should be included
|
|
19179
19139
|
timeStart('mark included statements', 2);
|
|
19180
|
-
entryModules.
|
|
19140
|
+
for (var _b = 0, entryModules_1 = entryModules; _b < entryModules_1.length; _b++) {
|
|
19141
|
+
var entryModule = entryModules_1[_b];
|
|
19181
19142
|
entryModule.markExports();
|
|
19182
|
-
}
|
|
19143
|
+
}
|
|
19183
19144
|
// only include statements that should appear in the bundle
|
|
19184
19145
|
_this.includeMarked(orderedModules);
|
|
19185
19146
|
// check for unused external imports
|
|
19186
|
-
_this.externalModules
|
|
19147
|
+
for (var _c = 0, _d = _this.externalModules; _c < _d.length; _c++) {
|
|
19148
|
+
var externalModule = _d[_c];
|
|
19149
|
+
externalModule.warnUnusedImports();
|
|
19150
|
+
}
|
|
19187
19151
|
timeEnd('mark included statements', 2);
|
|
19188
19152
|
// Phase 4 – we construct the chunks, working out the optimal chunking using
|
|
19189
19153
|
// entry point graph colouring, before generating the import and export facades
|
|
@@ -19194,43 +19158,47 @@ var Graph = /** @class */ (function () {
|
|
|
19194
19158
|
// should be made to be its own entry point module before chunking
|
|
19195
19159
|
var chunkList = [];
|
|
19196
19160
|
if (!preserveModules) {
|
|
19197
|
-
var
|
|
19198
|
-
orderedModules.
|
|
19161
|
+
var chunkModules = {};
|
|
19162
|
+
for (var _e = 0, orderedModules_1 = orderedModules; _e < orderedModules_1.length; _e++) {
|
|
19163
|
+
var module = orderedModules_1[_e];
|
|
19199
19164
|
var entryPointsHashStr = Uint8ArrayToHexString(module.entryPointsHash);
|
|
19200
|
-
var curChunk =
|
|
19165
|
+
var curChunk = chunkModules[entryPointsHashStr];
|
|
19201
19166
|
if (curChunk) {
|
|
19202
19167
|
curChunk.push(module);
|
|
19203
19168
|
}
|
|
19204
19169
|
else {
|
|
19205
|
-
|
|
19170
|
+
chunkModules[entryPointsHashStr] = [module];
|
|
19206
19171
|
}
|
|
19207
|
-
}
|
|
19172
|
+
}
|
|
19208
19173
|
// create each chunk
|
|
19209
|
-
|
|
19210
|
-
var chunk =
|
|
19174
|
+
for (var entryHashSum in chunkModules) {
|
|
19175
|
+
var chunk = chunkModules[entryHashSum];
|
|
19211
19176
|
var chunkModulesOrdered = chunk.sort(function (moduleA, moduleB) { return (moduleA.execIndex > moduleB.execIndex ? 1 : -1); });
|
|
19212
19177
|
chunkList.push(new Chunk$1(_this, chunkModulesOrdered));
|
|
19213
|
-
}
|
|
19178
|
+
}
|
|
19214
19179
|
}
|
|
19215
19180
|
else {
|
|
19216
|
-
orderedModules.
|
|
19181
|
+
for (var _f = 0, orderedModules_2 = orderedModules; _f < orderedModules_2.length; _f++) {
|
|
19182
|
+
var module = orderedModules_2[_f];
|
|
19217
19183
|
var chunkInstance = new Chunk$1(_this, [module]);
|
|
19218
19184
|
chunkInstance.entryModule = module;
|
|
19219
19185
|
chunkInstance.isEntryModuleFacade = true;
|
|
19220
19186
|
chunkList.push(chunkInstance);
|
|
19221
|
-
}
|
|
19187
|
+
}
|
|
19222
19188
|
}
|
|
19223
19189
|
// for each entry point module, ensure its exports
|
|
19224
19190
|
// are exported by the chunk itself, with safe name deduping
|
|
19225
|
-
entryModules.
|
|
19191
|
+
for (var _g = 0, entryModules_2 = entryModules; _g < entryModules_2.length; _g++) {
|
|
19192
|
+
var entryModule = entryModules_2[_g];
|
|
19226
19193
|
entryModule.chunk.generateEntryExports(entryModule);
|
|
19227
|
-
}
|
|
19194
|
+
}
|
|
19228
19195
|
// for each chunk module, set up its imports to other
|
|
19229
19196
|
// chunks, if those variables are included after treeshaking
|
|
19230
|
-
chunkList.
|
|
19197
|
+
for (var _h = 0, chunkList_1 = chunkList; _h < chunkList_1.length; _h++) {
|
|
19198
|
+
var chunk = chunkList_1[_h];
|
|
19231
19199
|
chunk.collectDependencies();
|
|
19232
19200
|
chunk.generateImports();
|
|
19233
|
-
}
|
|
19201
|
+
}
|
|
19234
19202
|
// finally prepare output chunks
|
|
19235
19203
|
var chunks = {};
|
|
19236
19204
|
var inputRelativeDir;
|
|
@@ -19276,66 +19244,69 @@ var Graph = /** @class */ (function () {
|
|
|
19276
19244
|
return chunks;
|
|
19277
19245
|
});
|
|
19278
19246
|
};
|
|
19279
|
-
Graph.prototype.analyseExecution = function (entryModules,
|
|
19247
|
+
Graph.prototype.analyseExecution = function (entryModules, graphColouring) {
|
|
19280
19248
|
var _this = this;
|
|
19281
|
-
if (preserveModules === void 0) { preserveModules = false; }
|
|
19282
19249
|
var curEntry, curEntryHash;
|
|
19283
19250
|
var allSeen = {};
|
|
19284
19251
|
var ordered = [];
|
|
19285
19252
|
var dynamicImports = [];
|
|
19286
|
-
var
|
|
19287
|
-
|
|
19253
|
+
var parents;
|
|
19254
|
+
var visit = function (module) {
|
|
19288
19255
|
if (module.isEntryPoint && module !== curEntry)
|
|
19289
19256
|
return;
|
|
19290
19257
|
// Track entry point graph colouring by tracing all modules loaded by a given
|
|
19291
19258
|
// entry point and colouring those modules by the hash of its id. Colours are mixed as
|
|
19292
19259
|
// hash xors, providing the unique colouring of the graph into unique hash chunks.
|
|
19293
19260
|
// This is really all there is to automated chunking, the rest is chunk wiring.
|
|
19294
|
-
if (
|
|
19261
|
+
if (graphColouring) {
|
|
19295
19262
|
Uint8ArrayXor(module.entryPointsHash, curEntryHash);
|
|
19296
19263
|
}
|
|
19297
|
-
module.dependencies.
|
|
19298
|
-
|
|
19299
|
-
|
|
19300
|
-
|
|
19301
|
-
|
|
19302
|
-
|
|
19303
|
-
|
|
19264
|
+
for (var _i = 0, _a = module.dependencies; _i < _a.length; _i++) {
|
|
19265
|
+
var depModule = _a[_i];
|
|
19266
|
+
if (depModule.isExternal)
|
|
19267
|
+
continue;
|
|
19268
|
+
if (depModule.id in parents) {
|
|
19269
|
+
if (!allSeen[depModule.id]) {
|
|
19270
|
+
_this.warnCycle(depModule.id, module.id, parents);
|
|
19304
19271
|
}
|
|
19305
|
-
|
|
19306
|
-
visit(depModule, parents);
|
|
19272
|
+
continue;
|
|
19307
19273
|
}
|
|
19308
|
-
|
|
19274
|
+
parents[depModule.id] = module.id;
|
|
19275
|
+
visit(depModule);
|
|
19276
|
+
}
|
|
19309
19277
|
if (_this.dynamicImport) {
|
|
19310
|
-
module.dynamicImportResolutions.
|
|
19311
|
-
|
|
19312
|
-
|
|
19313
|
-
|
|
19278
|
+
for (var _b = 0, _c = module.dynamicImportResolutions; _b < _c.length; _b++) {
|
|
19279
|
+
var dynamicModule = _c[_b];
|
|
19280
|
+
if (dynamicModule instanceof Module) {
|
|
19281
|
+
if (dynamicImports.indexOf(dynamicModule) === -1) {
|
|
19282
|
+
dynamicImports.push(dynamicModule);
|
|
19314
19283
|
}
|
|
19315
19284
|
}
|
|
19316
|
-
}
|
|
19285
|
+
}
|
|
19317
19286
|
}
|
|
19318
19287
|
if (allSeen[module.id])
|
|
19319
19288
|
return;
|
|
19320
19289
|
allSeen[module.id] = true;
|
|
19321
19290
|
module.execIndex = ordered.length;
|
|
19322
19291
|
ordered.push(module);
|
|
19323
|
-
var _a;
|
|
19324
19292
|
};
|
|
19325
|
-
for (var
|
|
19326
|
-
curEntry =
|
|
19293
|
+
for (var _i = 0, entryModules_3 = entryModules; _i < entryModules_3.length; _i++) {
|
|
19294
|
+
curEntry = entryModules_3[_i];
|
|
19327
19295
|
curEntry.isEntryPoint = true;
|
|
19328
19296
|
curEntryHash = randomUint8Array(10);
|
|
19297
|
+
parents = (_a = {}, _a[curEntry.id] = null, _a);
|
|
19329
19298
|
visit(curEntry);
|
|
19330
19299
|
}
|
|
19331
19300
|
// new items can be added during this loop
|
|
19332
|
-
for (var
|
|
19333
|
-
curEntry =
|
|
19301
|
+
for (var _b = 0, dynamicImports_3 = dynamicImports; _b < dynamicImports_3.length; _b++) {
|
|
19302
|
+
curEntry = dynamicImports_3[_b];
|
|
19334
19303
|
curEntry.isEntryPoint = true;
|
|
19335
19304
|
curEntryHash = randomUint8Array(10);
|
|
19305
|
+
parents = (_c = {}, _c[curEntry.id] = null, _c);
|
|
19336
19306
|
visit(curEntry);
|
|
19337
19307
|
}
|
|
19338
19308
|
return { orderedModules: ordered, dynamicImports: dynamicImports };
|
|
19309
|
+
var _a, _c;
|
|
19339
19310
|
};
|
|
19340
19311
|
Graph.prototype.warnCycle = function (id, parentId, parents) {
|
|
19341
19312
|
var path$$1 = [relativeId(id)];
|
|
@@ -19405,17 +19376,17 @@ var Graph = /** @class */ (function () {
|
|
|
19405
19376
|
_this.modules.push(module);
|
|
19406
19377
|
_this.moduleById.set(id, module);
|
|
19407
19378
|
return _this.fetchAllDependencies(module).then(function () {
|
|
19408
|
-
|
|
19379
|
+
for (var name in module.exports) {
|
|
19409
19380
|
if (name !== 'default') {
|
|
19410
19381
|
module.exportsAll[name] = module.id;
|
|
19411
19382
|
}
|
|
19412
|
-
}
|
|
19383
|
+
}
|
|
19413
19384
|
module.exportAllSources.forEach(function (source) {
|
|
19414
19385
|
var id = module.resolvedIds[source];
|
|
19415
19386
|
var exportAllModule = _this.moduleById.get(id);
|
|
19416
19387
|
if (exportAllModule.isExternal)
|
|
19417
19388
|
return;
|
|
19418
|
-
|
|
19389
|
+
for (var name in exportAllModule.exportsAll) {
|
|
19419
19390
|
if (name in module.exportsAll) {
|
|
19420
19391
|
_this.warn({
|
|
19421
19392
|
code: 'NAMESPACE_CONFLICT',
|
|
@@ -19428,7 +19399,7 @@ var Graph = /** @class */ (function () {
|
|
|
19428
19399
|
else {
|
|
19429
19400
|
module.exportsAll[name] = exportAllModule.exportsAll[name];
|
|
19430
19401
|
}
|
|
19431
|
-
}
|
|
19402
|
+
}
|
|
19432
19403
|
});
|
|
19433
19404
|
return module;
|
|
19434
19405
|
});
|
|
@@ -19503,14 +19474,14 @@ var Graph = /** @class */ (function () {
|
|
|
19503
19474
|
_this.externalModules.push(module_1);
|
|
19504
19475
|
_this.moduleById.set(externalId, module_1);
|
|
19505
19476
|
}
|
|
19506
|
-
var
|
|
19477
|
+
var externalModule = _this.moduleById.get(externalId);
|
|
19507
19478
|
// add external declarations so we can detect which are never used
|
|
19508
|
-
|
|
19479
|
+
for (var name in module.imports) {
|
|
19509
19480
|
var importDeclaration = module.imports[name];
|
|
19510
19481
|
if (importDeclaration.source !== source)
|
|
19511
19482
|
return;
|
|
19512
|
-
|
|
19513
|
-
}
|
|
19483
|
+
externalModule.traceExport(importDeclaration.name);
|
|
19484
|
+
}
|
|
19514
19485
|
}
|
|
19515
19486
|
else {
|
|
19516
19487
|
module.resolvedIds[source] = resolvedId;
|
|
@@ -19577,7 +19548,7 @@ function applyOptionHook(inputOptions, plugin) {
|
|
|
19577
19548
|
return plugin.options(inputOptions) || inputOptions;
|
|
19578
19549
|
return inputOptions;
|
|
19579
19550
|
}
|
|
19580
|
-
function getInputOptions(rawInputOptions) {
|
|
19551
|
+
function getInputOptions$1(rawInputOptions) {
|
|
19581
19552
|
if (!rawInputOptions) {
|
|
19582
19553
|
throw new Error('You must supply an options object to rollup');
|
|
19583
19554
|
}
|
|
@@ -19595,7 +19566,7 @@ function getInputOptions(rawInputOptions) {
|
|
|
19595
19566
|
}
|
|
19596
19567
|
function rollup(rawInputOptions) {
|
|
19597
19568
|
try {
|
|
19598
|
-
var inputOptions_1 = getInputOptions(rawInputOptions);
|
|
19569
|
+
var inputOptions_1 = getInputOptions$1(rawInputOptions);
|
|
19599
19570
|
initialiseTimers(inputOptions_1);
|
|
19600
19571
|
var graph_1 = new Graph(inputOptions_1);
|
|
19601
19572
|
timeStart('BUILD', 1);
|
|
@@ -22282,7 +22253,7 @@ utils.escapeRe = function escapeRe(str) {
|
|
|
22282
22253
|
module.exports = utils;
|
|
22283
22254
|
});
|
|
22284
22255
|
|
|
22285
|
-
var chars$
|
|
22256
|
+
var chars$2 = {}, unesc, temp;
|
|
22286
22257
|
|
|
22287
22258
|
function reverse(object, prepender) {
|
|
22288
22259
|
return Object.keys(object).reduce(function(reversed, key) {
|
|
@@ -22296,7 +22267,7 @@ function reverse(object, prepender) {
|
|
|
22296
22267
|
* Regex for common characters
|
|
22297
22268
|
*/
|
|
22298
22269
|
|
|
22299
|
-
chars$
|
|
22270
|
+
chars$2.escapeRegex = {
|
|
22300
22271
|
'?': /\?/g,
|
|
22301
22272
|
'@': /\@/g,
|
|
22302
22273
|
'!': /\!/g,
|
|
@@ -22312,7 +22283,7 @@ chars$1.escapeRegex = {
|
|
|
22312
22283
|
* Escape characters
|
|
22313
22284
|
*/
|
|
22314
22285
|
|
|
22315
|
-
chars$
|
|
22286
|
+
chars$2.ESC = {
|
|
22316
22287
|
'?': '__UNESC_QMRK__',
|
|
22317
22288
|
'@': '__UNESC_AMPE__',
|
|
22318
22289
|
'!': '__UNESC_EXCL__',
|
|
@@ -22329,9 +22300,9 @@ chars$1.ESC = {
|
|
|
22329
22300
|
* Unescape characters
|
|
22330
22301
|
*/
|
|
22331
22302
|
|
|
22332
|
-
chars$
|
|
22303
|
+
chars$2.UNESC = unesc || (unesc = reverse(chars$2.ESC, '\\'));
|
|
22333
22304
|
|
|
22334
|
-
chars$
|
|
22305
|
+
chars$2.ESC_TEMP = {
|
|
22335
22306
|
'?': '__TEMP_QMRK__',
|
|
22336
22307
|
'@': '__TEMP_AMPE__',
|
|
22337
22308
|
'!': '__TEMP_EXCL__',
|
|
@@ -22344,9 +22315,9 @@ chars$1.ESC_TEMP = {
|
|
|
22344
22315
|
']': '__TEMP_RTBRACK__'
|
|
22345
22316
|
};
|
|
22346
22317
|
|
|
22347
|
-
chars$
|
|
22318
|
+
chars$2.TEMP = temp || (temp = reverse(chars$2.ESC_TEMP));
|
|
22348
22319
|
|
|
22349
|
-
var chars_1 = chars$
|
|
22320
|
+
var chars_1 = chars$2;
|
|
22350
22321
|
|
|
22351
22322
|
var glob = createCommonjsModule(function (module) {
|
|
22352
22323
|
|
|
@@ -23614,7 +23585,7 @@ function watch(configs) {
|
|
|
23614
23585
|
return new Watcher(configs);
|
|
23615
23586
|
}
|
|
23616
23587
|
|
|
23617
|
-
var version$1 = "0.57.
|
|
23588
|
+
var version$1 = "0.57.1";
|
|
23618
23589
|
|
|
23619
23590
|
/// <reference path="../typings/package.json.d.ts" />
|
|
23620
23591
|
|