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.es.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
|
|
@@ -349,7 +349,12 @@ function deprecateOptions(options, deprecateConfig) {
|
|
|
349
349
|
}
|
|
350
350
|
}
|
|
351
351
|
|
|
352
|
-
function
|
|
352
|
+
var createGetOption = function (config, command) { return function (name, defaultValue) {
|
|
353
|
+
return command[name] !== undefined
|
|
354
|
+
? command[name]
|
|
355
|
+
: config[name] !== undefined ? config[name] : defaultValue;
|
|
356
|
+
}; };
|
|
357
|
+
var normalizeObjectOptionValue = function (optionValue) {
|
|
353
358
|
if (!optionValue) {
|
|
354
359
|
return optionValue;
|
|
355
360
|
}
|
|
@@ -357,7 +362,17 @@ function normalizeObjectOptionValue(optionValue) {
|
|
|
357
362
|
return {};
|
|
358
363
|
}
|
|
359
364
|
return optionValue;
|
|
360
|
-
}
|
|
365
|
+
};
|
|
366
|
+
var getObjectOption = function (config, command, name) {
|
|
367
|
+
var commandOption = normalizeObjectOptionValue(command[name]);
|
|
368
|
+
var configOption = normalizeObjectOptionValue(config[name]);
|
|
369
|
+
if (commandOption !== undefined) {
|
|
370
|
+
return commandOption && configOption
|
|
371
|
+
? Object.assign({}, configOption, commandOption)
|
|
372
|
+
: commandOption;
|
|
373
|
+
}
|
|
374
|
+
return configOption;
|
|
375
|
+
};
|
|
361
376
|
var defaultOnWarn = function (warning) {
|
|
362
377
|
if (typeof warning === 'string') {
|
|
363
378
|
console.warn(warning); // eslint-disable-line no-console
|
|
@@ -366,148 +381,147 @@ var defaultOnWarn = function (warning) {
|
|
|
366
381
|
console.warn(warning.message); // eslint-disable-line no-console
|
|
367
382
|
}
|
|
368
383
|
};
|
|
384
|
+
var getOnWarn = function (config, command, defaultOnWarnHandler) {
|
|
385
|
+
if (defaultOnWarnHandler === void 0) { defaultOnWarnHandler = defaultOnWarn; }
|
|
386
|
+
return command.silent
|
|
387
|
+
? function () { }
|
|
388
|
+
: config.onwarn
|
|
389
|
+
? function (warning) { return config.onwarn(warning, defaultOnWarnHandler); }
|
|
390
|
+
: defaultOnWarnHandler;
|
|
391
|
+
};
|
|
392
|
+
var getExternal = function (config, command) {
|
|
393
|
+
var configExternal = config.external;
|
|
394
|
+
return typeof configExternal === 'function'
|
|
395
|
+
? function (id) {
|
|
396
|
+
var rest = [];
|
|
397
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
398
|
+
rest[_i - 1] = arguments[_i];
|
|
399
|
+
}
|
|
400
|
+
return configExternal.apply(void 0, [id].concat(rest)) || command.external.indexOf(id) !== -1;
|
|
401
|
+
}
|
|
402
|
+
: (configExternal || []).concat(command.external);
|
|
403
|
+
};
|
|
404
|
+
var commandAliases = {
|
|
405
|
+
c: 'config',
|
|
406
|
+
d: 'indent',
|
|
407
|
+
e: 'external',
|
|
408
|
+
f: 'format',
|
|
409
|
+
g: 'globals',
|
|
410
|
+
h: 'help',
|
|
411
|
+
i: 'input',
|
|
412
|
+
l: 'legacy',
|
|
413
|
+
m: 'sourcemap',
|
|
414
|
+
n: 'name',
|
|
415
|
+
o: 'file',
|
|
416
|
+
v: 'version',
|
|
417
|
+
w: 'watch'
|
|
418
|
+
};
|
|
369
419
|
function mergeOptions(_a) {
|
|
370
|
-
var
|
|
371
|
-
var deprecations = deprecate(config,
|
|
372
|
-
var
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
420
|
+
var _b = _a.config, config = _b === void 0 ? {} : _b, _c = _a.command, rawCommandOptions = _c === void 0 ? {} : _c, deprecateConfig = _a.deprecateConfig, defaultOnWarnHandler = _a.defaultOnWarnHandler;
|
|
421
|
+
var deprecations = deprecate(config, rawCommandOptions, deprecateConfig);
|
|
422
|
+
var command = getCommandOptions(rawCommandOptions);
|
|
423
|
+
var inputOptions = getInputOptions(config, command, defaultOnWarnHandler);
|
|
424
|
+
if (command.output) {
|
|
425
|
+
Object.assign(command, command.output);
|
|
426
|
+
}
|
|
427
|
+
var normalizedOutputOptions = ensureArray(config.output);
|
|
428
|
+
if (normalizedOutputOptions.length === 0)
|
|
429
|
+
normalizedOutputOptions.push({});
|
|
430
|
+
var outputOptions = normalizedOutputOptions.map(function (singleOutputOptions) {
|
|
431
|
+
return getOutputOptions(singleOutputOptions, command);
|
|
432
|
+
});
|
|
433
|
+
var unknownOptionErrors = [];
|
|
434
|
+
var validInputOptions = Object.keys(inputOptions);
|
|
435
|
+
addUnknownOptionErrors(unknownOptionErrors, Object.keys(config), validInputOptions, 'input option', /^output$/);
|
|
436
|
+
var validOutputOptions = Object.keys(outputOptions[0]);
|
|
437
|
+
addUnknownOptionErrors(unknownOptionErrors, outputOptions.reduce(function (allKeys, options) { return allKeys.concat(Object.keys(options)); }, []), validOutputOptions, 'output option');
|
|
438
|
+
addUnknownOptionErrors(unknownOptionErrors, Object.keys(command), validInputOptions.concat(validOutputOptions, Object.keys(commandAliases), 'config', 'environment', 'silent'), 'CLI flag', /^_|output|(config.*)$/);
|
|
439
|
+
return {
|
|
440
|
+
inputOptions: inputOptions,
|
|
441
|
+
outputOptions: outputOptions,
|
|
442
|
+
deprecations: deprecations,
|
|
443
|
+
optionError: unknownOptionErrors.length > 0 ? unknownOptionErrors.join('\n') : null
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
function addUnknownOptionErrors(errors, options, validOptions, optionType, ignoredKeys) {
|
|
447
|
+
if (ignoredKeys === void 0) { ignoredKeys = /$./; }
|
|
448
|
+
var unknownOptions = options.filter(function (key) { return validOptions.indexOf(key) === -1 && !ignoredKeys.test(key); });
|
|
449
|
+
if (unknownOptions.length > 0)
|
|
450
|
+
errors.push("Unknown " + optionType + ": " + unknownOptions.join(', ') + ". Allowed options: " + validOptions.sort().join(', '));
|
|
451
|
+
}
|
|
452
|
+
function getCommandOptions(rawCommandOptions) {
|
|
453
|
+
var command = Object.assign({}, rawCommandOptions);
|
|
454
|
+
command.external = (rawCommandOptions.external || '').split(',');
|
|
455
|
+
if (rawCommandOptions.globals) {
|
|
456
|
+
command.globals = Object.create(null);
|
|
457
|
+
rawCommandOptions.globals.split(',').forEach(function (str) {
|
|
458
|
+
var names = str.split(':');
|
|
459
|
+
command.globals[names[0]] = names[1];
|
|
460
|
+
// Add missing Module IDs to external.
|
|
461
|
+
if (command.external.indexOf(names[0]) === -1) {
|
|
462
|
+
command.external.push(names[0]);
|
|
463
|
+
}
|
|
464
|
+
});
|
|
394
465
|
}
|
|
466
|
+
return command;
|
|
467
|
+
}
|
|
468
|
+
function getInputOptions(config, command, defaultOnWarnHandler) {
|
|
469
|
+
if (command === void 0) { command = {}; }
|
|
470
|
+
var getOption = createGetOption(config, command);
|
|
395
471
|
var inputOptions = {
|
|
396
472
|
acorn: config.acorn,
|
|
397
473
|
acornInjectPlugins: config.acornInjectPlugins,
|
|
398
|
-
cache:
|
|
474
|
+
cache: getOption('cache'),
|
|
399
475
|
context: config.context,
|
|
400
|
-
experimentalCodeSplitting:
|
|
401
|
-
experimentalDynamicImport:
|
|
402
|
-
experimentalPreserveModules:
|
|
403
|
-
|
|
404
|
-
|
|
476
|
+
experimentalCodeSplitting: getOption('experimentalCodeSplitting'),
|
|
477
|
+
experimentalDynamicImport: getOption('experimentalDynamicImport'),
|
|
478
|
+
experimentalPreserveModules: getOption('experimentalPreserveModules'),
|
|
479
|
+
external: getExternal(config, command),
|
|
480
|
+
input: getOption('input'),
|
|
405
481
|
moduleContext: config.moduleContext,
|
|
406
|
-
onwarn:
|
|
407
|
-
perf:
|
|
482
|
+
onwarn: getOnWarn(config, command, defaultOnWarnHandler),
|
|
483
|
+
perf: getOption('perf', false),
|
|
408
484
|
plugins: config.plugins,
|
|
409
|
-
preferConst:
|
|
410
|
-
preserveSymlinks:
|
|
411
|
-
treeshake: getObjectOption('treeshake'),
|
|
485
|
+
preferConst: getOption('preferConst'),
|
|
486
|
+
preserveSymlinks: getOption('preserveSymlinks'),
|
|
487
|
+
treeshake: getObjectOption(config, command, 'treeshake'),
|
|
412
488
|
watch: config.watch
|
|
413
489
|
};
|
|
414
|
-
// legacy, to ensure e.g. commonjs plugin still works
|
|
415
|
-
inputOptions.entry = inputOptions.input;
|
|
416
|
-
var commandExternal = (command.external || '').split(',');
|
|
417
|
-
var configExternal = config.external;
|
|
418
|
-
if (command.globals) {
|
|
419
|
-
var globals_1 = Object.create(null);
|
|
420
|
-
command.globals.split(',').forEach(function (str) {
|
|
421
|
-
var names = str.split(':');
|
|
422
|
-
globals_1[names[0]] = names[1];
|
|
423
|
-
// Add missing Module IDs to external.
|
|
424
|
-
if (commandExternal.indexOf(names[0]) === -1) {
|
|
425
|
-
commandExternal.push(names[0]);
|
|
426
|
-
}
|
|
427
|
-
});
|
|
428
|
-
command.globals = globals_1;
|
|
429
|
-
}
|
|
430
|
-
if (typeof configExternal === 'function') {
|
|
431
|
-
inputOptions.external = function (id) {
|
|
432
|
-
var rest = [];
|
|
433
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
434
|
-
rest[_i - 1] = arguments[_i];
|
|
435
|
-
}
|
|
436
|
-
return configExternal.apply(void 0, [id].concat(rest)) || commandExternal.indexOf(id) !== -1;
|
|
437
|
-
};
|
|
438
|
-
}
|
|
439
|
-
else {
|
|
440
|
-
inputOptions.external = (configExternal || []).concat(commandExternal);
|
|
441
|
-
}
|
|
442
|
-
if (command.silent) {
|
|
443
|
-
inputOptions.onwarn = function () { };
|
|
444
|
-
}
|
|
445
|
-
// Make sure the CLI treats this the same way as when we are code-splitting
|
|
446
490
|
if (inputOptions.experimentalPreserveModules && !Array.isArray(inputOptions.input)) {
|
|
447
491
|
inputOptions.input = [inputOptions.input];
|
|
448
492
|
}
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
freeze: getOutputOption('freeze'),
|
|
459
|
-
globals: getOutputOption('globals'),
|
|
460
|
-
indent: getOutputOption('indent'),
|
|
461
|
-
interop: getOutputOption('interop'),
|
|
462
|
-
intro: getOutputOption('intro'),
|
|
463
|
-
legacy: getOutputOption('legacy'),
|
|
464
|
-
name: getOutputOption('name'),
|
|
465
|
-
namespaceToStringTag: getOutputOption('namespaceToStringTag'),
|
|
466
|
-
noConflict: getOutputOption('noConflict'),
|
|
467
|
-
outro: getOutputOption('outro'),
|
|
468
|
-
paths: getOutputOption('paths'),
|
|
469
|
-
sourcemap: getOutputOption('sourcemap'),
|
|
470
|
-
sourcemapFile: getOutputOption('sourcemapFile'),
|
|
471
|
-
strict: getOutputOption('strict')
|
|
472
|
-
};
|
|
473
|
-
var mergedOutputOptions;
|
|
474
|
-
if (Array.isArray(config.output)) {
|
|
475
|
-
mergedOutputOptions = config.output.map(function (output) {
|
|
476
|
-
return Object.assign({}, output, command.output);
|
|
477
|
-
});
|
|
478
|
-
}
|
|
479
|
-
else if (config.output && command.output) {
|
|
480
|
-
mergedOutputOptions = [Object.assign({}, config.output, command.output)];
|
|
481
|
-
}
|
|
482
|
-
else {
|
|
483
|
-
mergedOutputOptions =
|
|
484
|
-
command.output || config.output
|
|
485
|
-
? ensureArray(command.output || config.output)
|
|
486
|
-
: [
|
|
487
|
-
{
|
|
488
|
-
file: command.output ? command.output.file : null,
|
|
489
|
-
format: command.output ? command.output.format : null
|
|
490
|
-
}
|
|
491
|
-
];
|
|
492
|
-
}
|
|
493
|
-
var outputOptions = mergedOutputOptions.map(function (output) {
|
|
494
|
-
return Object.assign({}, baseOutputOptions, output);
|
|
495
|
-
});
|
|
496
|
-
// check for errors
|
|
497
|
-
var validKeys = Object.keys(inputOptions).concat(Object.keys(baseOutputOptions), [
|
|
498
|
-
'pureExternalModules' // (backward compatibility) till everyone moves to treeshake.pureExternalModules
|
|
499
|
-
]);
|
|
500
|
-
var outputOptionKeys = Array.isArray(config.output)
|
|
501
|
-
? config.output.reduce(function (keys, o) { return keys.concat(Object.keys(o)); }, [])
|
|
502
|
-
: Object.keys(config.output || {});
|
|
503
|
-
var errors = Object.keys(config || {}).concat(outputOptionKeys).filter(function (k) { return k !== 'output' && validKeys.indexOf(k) === -1; });
|
|
493
|
+
// legacy to make sure certain plugins still work
|
|
494
|
+
inputOptions.entry = Array.isArray(inputOptions.input)
|
|
495
|
+
? inputOptions.input[0]
|
|
496
|
+
: inputOptions.input;
|
|
497
|
+
return inputOptions;
|
|
498
|
+
}
|
|
499
|
+
function getOutputOptions(config, command) {
|
|
500
|
+
if (command === void 0) { command = {}; }
|
|
501
|
+
var getOption = createGetOption(config, command);
|
|
504
502
|
return {
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
503
|
+
amd: Object.assign({}, config.amd, command.amd),
|
|
504
|
+
banner: getOption('banner'),
|
|
505
|
+
dir: getOption('dir'),
|
|
506
|
+
exports: getOption('exports'),
|
|
507
|
+
extend: getOption('extend'),
|
|
508
|
+
file: getOption('file'),
|
|
509
|
+
footer: getOption('footer'),
|
|
510
|
+
format: getOption('format'),
|
|
511
|
+
freeze: getOption('freeze'),
|
|
512
|
+
globals: getOption('globals'),
|
|
513
|
+
indent: getOption('indent', true),
|
|
514
|
+
interop: getOption('interop', true),
|
|
515
|
+
intro: getOption('intro'),
|
|
516
|
+
legacy: getOption('legacy', false),
|
|
517
|
+
name: getOption('name'),
|
|
518
|
+
namespaceToStringTag: getOption('namespaceToStringTag'),
|
|
519
|
+
noConflict: getOption('noConflict'),
|
|
520
|
+
outro: getOption('outro'),
|
|
521
|
+
paths: getOption('paths'),
|
|
522
|
+
sourcemap: getOption('sourcemap'),
|
|
523
|
+
sourcemapFile: getOption('sourcemapFile'),
|
|
524
|
+
strict: getOption('strict', true)
|
|
511
525
|
};
|
|
512
526
|
}
|
|
513
527
|
function deprecate(config, command, deprecateConfig) {
|
|
@@ -525,17 +539,10 @@ function deprecate(config, command, deprecateConfig) {
|
|
|
525
539
|
if (typeof command.output === 'string') {
|
|
526
540
|
deprecations.push({
|
|
527
541
|
old: '--output',
|
|
528
|
-
new: '--
|
|
542
|
+
new: '--file'
|
|
529
543
|
});
|
|
530
544
|
command.output = { file: command.output };
|
|
531
545
|
}
|
|
532
|
-
if (command.format) {
|
|
533
|
-
deprecations.push({
|
|
534
|
-
old: '--format',
|
|
535
|
-
new: '--output.format'
|
|
536
|
-
});
|
|
537
|
-
(command.output || (command.output = {})).format = command.format;
|
|
538
|
-
}
|
|
539
546
|
// config file
|
|
540
547
|
deprecations.push.apply(deprecations, deprecateOptions(config, deprecateConfig));
|
|
541
548
|
return deprecations;
|
|
@@ -5978,48 +5985,56 @@ function first(candidates) {
|
|
|
5978
5985
|
};
|
|
5979
5986
|
}
|
|
5980
5987
|
|
|
5981
|
-
var
|
|
5982
|
-
|
|
5983
|
-
|
|
5984
|
-
|
|
5985
|
-
|
|
5986
|
-
|
|
5987
|
-
|
|
5988
|
-
|
|
5989
|
-
|
|
5990
|
-
|
|
5991
|
-
|
|
5992
|
-
|
|
5993
|
-
|
|
5994
|
-
|
|
5995
|
-
|
|
5996
|
-
|
|
5997
|
-
|
|
5998
|
-
|
|
5999
|
-
|
|
5988
|
+
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
5989
|
+
function encode(decoded) {
|
|
5990
|
+
var sourceFileIndex = 0; // second field
|
|
5991
|
+
var sourceCodeLine = 0; // third field
|
|
5992
|
+
var sourceCodeColumn = 0; // fourth field
|
|
5993
|
+
var nameIndex = 0; // fifth field
|
|
5994
|
+
var mappings = '';
|
|
5995
|
+
for (var i = 0; i < decoded.length; i++) {
|
|
5996
|
+
var line = decoded[i];
|
|
5997
|
+
if (i > 0)
|
|
5998
|
+
mappings += ';';
|
|
5999
|
+
if (line.length === 0)
|
|
6000
|
+
continue;
|
|
6001
|
+
var generatedCodeColumn = 0; // first field
|
|
6002
|
+
var lineMappings = [];
|
|
6003
|
+
for (var _i = 0, line_1 = line; _i < line_1.length; _i++) {
|
|
6004
|
+
var segment = line_1[_i];
|
|
6005
|
+
var segmentMappings = encodeInteger(segment[0] - generatedCodeColumn);
|
|
6006
|
+
generatedCodeColumn = segment[0];
|
|
6007
|
+
if (segment.length > 1) {
|
|
6008
|
+
segmentMappings +=
|
|
6009
|
+
encodeInteger(segment[1] - sourceFileIndex) +
|
|
6010
|
+
encodeInteger(segment[2] - sourceCodeLine) +
|
|
6011
|
+
encodeInteger(segment[3] - sourceCodeColumn);
|
|
6012
|
+
sourceFileIndex = segment[1];
|
|
6013
|
+
sourceCodeLine = segment[2];
|
|
6014
|
+
sourceCodeColumn = segment[3];
|
|
6015
|
+
}
|
|
6016
|
+
if (segment.length === 5) {
|
|
6017
|
+
segmentMappings += encodeInteger(segment[4] - nameIndex);
|
|
6018
|
+
nameIndex = segment[4];
|
|
6019
|
+
}
|
|
6020
|
+
lineMappings.push(segmentMappings);
|
|
6021
|
+
}
|
|
6022
|
+
mappings += lineMappings.join(',');
|
|
6023
|
+
}
|
|
6024
|
+
return mappings;
|
|
6000
6025
|
}
|
|
6001
|
-
|
|
6002
|
-
|
|
6003
|
-
|
|
6004
|
-
|
|
6005
|
-
|
|
6006
|
-
|
|
6007
|
-
|
|
6008
|
-
|
|
6009
|
-
|
|
6010
|
-
|
|
6011
|
-
|
|
6012
|
-
|
|
6013
|
-
num >>= 5;
|
|
6014
|
-
|
|
6015
|
-
if ( num > 0 ) {
|
|
6016
|
-
clamped |= 32;
|
|
6017
|
-
}
|
|
6018
|
-
|
|
6019
|
-
result += integerToChar[ clamped ];
|
|
6020
|
-
} while ( num > 0 );
|
|
6021
|
-
|
|
6022
|
-
return result;
|
|
6026
|
+
function encodeInteger(num) {
|
|
6027
|
+
var result = '';
|
|
6028
|
+
num = num < 0 ? (-num << 1) | 1 : num << 1;
|
|
6029
|
+
do {
|
|
6030
|
+
var clamped = num & 31;
|
|
6031
|
+
num >>= 5;
|
|
6032
|
+
if (num > 0) {
|
|
6033
|
+
clamped |= 32;
|
|
6034
|
+
}
|
|
6035
|
+
result += chars[clamped];
|
|
6036
|
+
} while (num > 0);
|
|
6037
|
+
return result;
|
|
6023
6038
|
}
|
|
6024
6039
|
|
|
6025
6040
|
function Chunk ( start, end, content ) {
|
|
@@ -6200,7 +6215,7 @@ function SourceMap ( properties ) {
|
|
|
6200
6215
|
this.sources = properties.sources;
|
|
6201
6216
|
this.sourcesContent = properties.sourcesContent;
|
|
6202
6217
|
this.names = properties.names;
|
|
6203
|
-
this.mappings = properties.mappings;
|
|
6218
|
+
this.mappings = encode(properties.mappings);
|
|
6204
6219
|
}
|
|
6205
6220
|
|
|
6206
6221
|
SourceMap.prototype = {
|
|
@@ -6266,51 +6281,33 @@ function isObject ( thing ) {
|
|
|
6266
6281
|
|
|
6267
6282
|
function getLocator ( source ) {
|
|
6268
6283
|
var originalLines = source.split( '\n' );
|
|
6284
|
+
var lineOffsets = [];
|
|
6269
6285
|
|
|
6270
|
-
var
|
|
6271
|
-
|
|
6272
|
-
|
|
6273
|
-
var range = { start: start, end: end, line: i };
|
|
6274
|
-
|
|
6275
|
-
start = end;
|
|
6276
|
-
return range;
|
|
6277
|
-
});
|
|
6278
|
-
|
|
6279
|
-
var i = 0;
|
|
6280
|
-
|
|
6281
|
-
function rangeContains ( range, index ) {
|
|
6282
|
-
return range.start <= index && index < range.end;
|
|
6283
|
-
}
|
|
6284
|
-
|
|
6285
|
-
function getLocation ( range, index ) {
|
|
6286
|
-
return { line: range.line, column: index - range.start };
|
|
6286
|
+
for ( var i = 0, pos = 0; i < originalLines.length; i++ ) {
|
|
6287
|
+
lineOffsets.push( pos );
|
|
6288
|
+
pos += originalLines[i].length + 1;
|
|
6287
6289
|
}
|
|
6288
6290
|
|
|
6289
6291
|
return function locate ( index ) {
|
|
6290
|
-
var
|
|
6291
|
-
|
|
6292
|
-
|
|
6293
|
-
|
|
6294
|
-
|
|
6295
|
-
|
|
6296
|
-
|
|
6297
|
-
|
|
6298
|
-
|
|
6292
|
+
var i = 0;
|
|
6293
|
+
var j = lineOffsets.length;
|
|
6294
|
+
while ( i < j ) {
|
|
6295
|
+
var m = ( i + j ) >> 1;
|
|
6296
|
+
if ( index < lineOffsets[m] ) {
|
|
6297
|
+
j = m;
|
|
6298
|
+
} else {
|
|
6299
|
+
i = m + 1;
|
|
6300
|
+
}
|
|
6299
6301
|
}
|
|
6302
|
+
var line = i - 1;
|
|
6303
|
+
var column = index - lineOffsets[line];
|
|
6304
|
+
return { line: line, column: column };
|
|
6300
6305
|
};
|
|
6301
6306
|
}
|
|
6302
6307
|
|
|
6303
6308
|
function Mappings ( hires ) {
|
|
6304
6309
|
var this$1 = this;
|
|
6305
6310
|
|
|
6306
|
-
var offsets = {
|
|
6307
|
-
generatedCodeColumn: 0,
|
|
6308
|
-
sourceIndex: 0,
|
|
6309
|
-
sourceCodeLine: 0,
|
|
6310
|
-
sourceCodeColumn: 0,
|
|
6311
|
-
sourceCodeName: 0
|
|
6312
|
-
};
|
|
6313
|
-
|
|
6314
6311
|
var generatedCodeLine = 0;
|
|
6315
6312
|
var generatedCodeColumn = 0;
|
|
6316
6313
|
|
|
@@ -6319,14 +6316,18 @@ function Mappings ( hires ) {
|
|
|
6319
6316
|
|
|
6320
6317
|
var pending = null;
|
|
6321
6318
|
|
|
6322
|
-
this.addEdit = function ( sourceIndex, content,
|
|
6319
|
+
this.addEdit = function ( sourceIndex, content, loc, nameIndex ) {
|
|
6323
6320
|
if ( content.length ) {
|
|
6324
|
-
|
|
6321
|
+
var segment = [
|
|
6325
6322
|
generatedCodeColumn,
|
|
6326
6323
|
sourceIndex,
|
|
6327
6324
|
loc.line,
|
|
6328
|
-
loc.column
|
|
6329
|
-
|
|
6325
|
+
loc.column
|
|
6326
|
+
];
|
|
6327
|
+
if ( nameIndex >= 0 ) {
|
|
6328
|
+
segment.push( nameIndex );
|
|
6329
|
+
}
|
|
6330
|
+
rawSegments.push( segment );
|
|
6330
6331
|
} else if ( pending ) {
|
|
6331
6332
|
rawSegments.push( pending );
|
|
6332
6333
|
}
|
|
@@ -6345,8 +6346,7 @@ function Mappings ( hires ) {
|
|
|
6345
6346
|
generatedCodeColumn,
|
|
6346
6347
|
sourceIndex,
|
|
6347
6348
|
loc.line,
|
|
6348
|
-
loc.column
|
|
6349
|
-
-1
|
|
6349
|
+
loc.column
|
|
6350
6350
|
]);
|
|
6351
6351
|
}
|
|
6352
6352
|
|
|
@@ -6369,50 +6369,24 @@ function Mappings ( hires ) {
|
|
|
6369
6369
|
generatedCodeColumn,
|
|
6370
6370
|
sourceIndex,
|
|
6371
6371
|
loc.line,
|
|
6372
|
-
loc.column
|
|
6373
|
-
|
|
6372
|
+
loc.column
|
|
6373
|
+
];
|
|
6374
6374
|
};
|
|
6375
6375
|
|
|
6376
6376
|
this.advance = function (str) {
|
|
6377
6377
|
if ( !str ) { return; }
|
|
6378
6378
|
|
|
6379
6379
|
var lines = str.split( '\n' );
|
|
6380
|
-
var lastLine = lines.pop();
|
|
6381
6380
|
|
|
6382
|
-
if ( lines.length ) {
|
|
6383
|
-
|
|
6384
|
-
|
|
6385
|
-
|
|
6386
|
-
|
|
6387
|
-
generatedCodeColumn
|
|
6381
|
+
if ( lines.length > 1 ) {
|
|
6382
|
+
for ( var i = 0; i < lines.length - 1; i++ ) {
|
|
6383
|
+
generatedCodeLine++;
|
|
6384
|
+
this$1.raw[generatedCodeLine] = rawSegments = [];
|
|
6385
|
+
}
|
|
6386
|
+
generatedCodeColumn = 0;
|
|
6388
6387
|
}
|
|
6389
|
-
};
|
|
6390
6388
|
|
|
6391
|
-
|
|
6392
|
-
return this$1.raw.map( function (segments) {
|
|
6393
|
-
var generatedCodeColumn = 0;
|
|
6394
|
-
|
|
6395
|
-
return segments.map( function (segment) {
|
|
6396
|
-
var arr = [
|
|
6397
|
-
segment[0] - generatedCodeColumn,
|
|
6398
|
-
segment[1] - offsets.sourceIndex,
|
|
6399
|
-
segment[2] - offsets.sourceCodeLine,
|
|
6400
|
-
segment[3] - offsets.sourceCodeColumn
|
|
6401
|
-
];
|
|
6402
|
-
|
|
6403
|
-
generatedCodeColumn = segment[0];
|
|
6404
|
-
offsets.sourceIndex = segment[1];
|
|
6405
|
-
offsets.sourceCodeLine = segment[2];
|
|
6406
|
-
offsets.sourceCodeColumn = segment[3];
|
|
6407
|
-
|
|
6408
|
-
if ( ~segment[4] ) {
|
|
6409
|
-
arr.push( segment[4] - offsets.sourceCodeName );
|
|
6410
|
-
offsets.sourceCodeName = segment[4];
|
|
6411
|
-
}
|
|
6412
|
-
|
|
6413
|
-
return encode( arr );
|
|
6414
|
-
}).join( ',' );
|
|
6415
|
-
}).join( ';' );
|
|
6389
|
+
generatedCodeColumn += lines[lines.length - 1].length;
|
|
6416
6390
|
};
|
|
6417
6391
|
}
|
|
6418
6392
|
|
|
@@ -6527,7 +6501,7 @@ MagicString$1.prototype = {
|
|
|
6527
6501
|
return cloned;
|
|
6528
6502
|
},
|
|
6529
6503
|
|
|
6530
|
-
|
|
6504
|
+
generateDecodedMap: function generateDecodedMap ( options ) {
|
|
6531
6505
|
var this$1 = this;
|
|
6532
6506
|
|
|
6533
6507
|
options = options || {};
|
|
@@ -6548,7 +6522,7 @@ MagicString$1.prototype = {
|
|
|
6548
6522
|
if ( chunk.intro.length ) { mappings.advance( chunk.intro ); }
|
|
6549
6523
|
|
|
6550
6524
|
if ( chunk.edited ) {
|
|
6551
|
-
mappings.addEdit( sourceIndex, chunk.content,
|
|
6525
|
+
mappings.addEdit( sourceIndex, chunk.content, loc, chunk.storeName ? names.indexOf( chunk.original ) : -1 );
|
|
6552
6526
|
} else {
|
|
6553
6527
|
mappings.addUneditedChunk( sourceIndex, chunk, this$1.original, loc, this$1.sourcemapLocations );
|
|
6554
6528
|
}
|
|
@@ -6556,14 +6530,17 @@ MagicString$1.prototype = {
|
|
|
6556
6530
|
if ( chunk.outro.length ) { mappings.advance( chunk.outro ); }
|
|
6557
6531
|
});
|
|
6558
6532
|
|
|
6559
|
-
|
|
6533
|
+
return {
|
|
6560
6534
|
file: ( options.file ? options.file.split( /[\/\\]/ ).pop() : null ),
|
|
6561
6535
|
sources: [ options.source ? getRelativePath( options.file || '', options.source ) : null ],
|
|
6562
6536
|
sourcesContent: options.includeContent ? [ this.original ] : [ null ],
|
|
6563
6537
|
names: names,
|
|
6564
|
-
mappings: mappings.
|
|
6565
|
-
}
|
|
6566
|
-
|
|
6538
|
+
mappings: mappings.raw
|
|
6539
|
+
};
|
|
6540
|
+
},
|
|
6541
|
+
|
|
6542
|
+
generateMap: function generateMap ( options ) {
|
|
6543
|
+
return new SourceMap(this.generateDecodedMap( options ));
|
|
6567
6544
|
},
|
|
6568
6545
|
|
|
6569
6546
|
getIndentString: function getIndentString () {
|
|
@@ -7103,7 +7080,7 @@ Bundle.prototype = {
|
|
|
7103
7080
|
return bundle;
|
|
7104
7081
|
},
|
|
7105
7082
|
|
|
7106
|
-
|
|
7083
|
+
generateDecodedMap: function generateDecodedMap ( options ) {
|
|
7107
7084
|
var this$1 = this;
|
|
7108
7085
|
if ( options === void 0 ) options = {};
|
|
7109
7086
|
|
|
@@ -7140,7 +7117,7 @@ Bundle.prototype = {
|
|
|
7140
7117
|
|
|
7141
7118
|
if ( source.filename ) {
|
|
7142
7119
|
if ( chunk.edited ) {
|
|
7143
|
-
mappings.addEdit( sourceIndex, chunk.content,
|
|
7120
|
+
mappings.addEdit( sourceIndex, chunk.content, loc, chunk.storeName ? names.indexOf( chunk.original ) : -1 );
|
|
7144
7121
|
} else {
|
|
7145
7122
|
mappings.addUneditedChunk( sourceIndex, chunk, magicString.original, loc, magicString.sourcemapLocations );
|
|
7146
7123
|
}
|
|
@@ -7158,7 +7135,7 @@ Bundle.prototype = {
|
|
|
7158
7135
|
}
|
|
7159
7136
|
});
|
|
7160
7137
|
|
|
7161
|
-
return
|
|
7138
|
+
return {
|
|
7162
7139
|
file: ( options.file ? options.file.split( /[\/\\]/ ).pop() : null ),
|
|
7163
7140
|
sources: this.uniqueSources.map( function (source) {
|
|
7164
7141
|
return options.file ? getRelativePath( options.file, source.filename ) : source.filename;
|
|
@@ -7167,8 +7144,12 @@ Bundle.prototype = {
|
|
|
7167
7144
|
return options.includeContent ? source.content : null;
|
|
7168
7145
|
}),
|
|
7169
7146
|
names: names,
|
|
7170
|
-
mappings: mappings.
|
|
7171
|
-
}
|
|
7147
|
+
mappings: mappings.raw
|
|
7148
|
+
};
|
|
7149
|
+
},
|
|
7150
|
+
|
|
7151
|
+
generateMap: function generateMap ( options ) {
|
|
7152
|
+
return new SourceMap(this.generateDecodedMap( options ));
|
|
7172
7153
|
},
|
|
7173
7154
|
|
|
7174
7155
|
getIndentString: function getIndentString () {
|
|
@@ -14800,7 +14781,11 @@ var ExportDefaultDeclaration = /** @class */ (function (_super) {
|
|
|
14800
14781
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
14801
14782
|
}
|
|
14802
14783
|
ExportDefaultDeclaration.prototype.bindNode = function () {
|
|
14803
|
-
if (this.declarationName
|
|
14784
|
+
if (this.declarationName &&
|
|
14785
|
+
// Do not set it for Class and FunctionExpressions otherwise they get treeshaken away
|
|
14786
|
+
(isFunctionDeclaration(this.declaration) ||
|
|
14787
|
+
isClassDeclaration(this.declaration) ||
|
|
14788
|
+
isIdentifier(this.declaration))) {
|
|
14804
14789
|
this.variable.setOriginalVariable(this.scope.findVariable(this.declarationName));
|
|
14805
14790
|
}
|
|
14806
14791
|
};
|
|
@@ -16536,15 +16521,14 @@ var Module = /** @class */ (function () {
|
|
|
16536
16521
|
timeEnd('analyse ast', 3);
|
|
16537
16522
|
};
|
|
16538
16523
|
Module.prototype.removeExistingSourceMap = function () {
|
|
16539
|
-
var
|
|
16540
|
-
|
|
16524
|
+
for (var _i = 0, _a = this.comments; _i < _a.length; _i++) {
|
|
16525
|
+
var comment = _a[_i];
|
|
16541
16526
|
if (!comment.block && SOURCEMAPPING_URL_RE.test(comment.text)) {
|
|
16542
|
-
|
|
16527
|
+
this.magicString.remove(comment.start, comment.end);
|
|
16543
16528
|
}
|
|
16544
|
-
}
|
|
16529
|
+
}
|
|
16545
16530
|
};
|
|
16546
16531
|
Module.prototype.addExport = function (node) {
|
|
16547
|
-
var _this = this;
|
|
16548
16532
|
var source = node.source && node.source.value;
|
|
16549
16533
|
// export { name } from './other'
|
|
16550
16534
|
if (source) {
|
|
@@ -16556,21 +16540,22 @@ var Module = /** @class */ (function () {
|
|
|
16556
16540
|
this.exportAllSources.push(source);
|
|
16557
16541
|
}
|
|
16558
16542
|
else {
|
|
16559
|
-
node.specifiers.
|
|
16543
|
+
for (var _i = 0, _a = node.specifiers; _i < _a.length; _i++) {
|
|
16544
|
+
var specifier = _a[_i];
|
|
16560
16545
|
var name = specifier.exported.name;
|
|
16561
|
-
if (
|
|
16562
|
-
|
|
16546
|
+
if (this.exports[name] || this.reexports[name]) {
|
|
16547
|
+
this.error({
|
|
16563
16548
|
code: 'DUPLICATE_EXPORT',
|
|
16564
16549
|
message: "A module cannot have multiple exports with the same name ('" + name + "')"
|
|
16565
16550
|
}, specifier.start);
|
|
16566
16551
|
}
|
|
16567
|
-
|
|
16552
|
+
this.reexports[name] = {
|
|
16568
16553
|
start: specifier.start,
|
|
16569
16554
|
source: source,
|
|
16570
16555
|
localName: specifier.local.name,
|
|
16571
16556
|
module: null // filled in later
|
|
16572
16557
|
};
|
|
16573
|
-
}
|
|
16558
|
+
}
|
|
16574
16559
|
}
|
|
16575
16560
|
}
|
|
16576
16561
|
else if (node.type === NodeType.ExportDefaultDeclaration) {
|
|
@@ -16598,11 +16583,13 @@ var Module = /** @class */ (function () {
|
|
|
16598
16583
|
// export function foo () {}
|
|
16599
16584
|
var declaration = node.declaration;
|
|
16600
16585
|
if (declaration.type === NodeType.VariableDeclaration) {
|
|
16601
|
-
declaration.declarations.
|
|
16602
|
-
|
|
16603
|
-
|
|
16604
|
-
|
|
16605
|
-
|
|
16586
|
+
for (var _b = 0, _c = declaration.declarations; _b < _c.length; _b++) {
|
|
16587
|
+
var decl = _c[_b];
|
|
16588
|
+
for (var _d = 0, _e = extractNames(decl.id); _d < _e.length; _d++) {
|
|
16589
|
+
var localName = _e[_d];
|
|
16590
|
+
this.exports[localName] = { localName: localName };
|
|
16591
|
+
}
|
|
16592
|
+
}
|
|
16606
16593
|
}
|
|
16607
16594
|
else {
|
|
16608
16595
|
// export function foo () {}
|
|
@@ -16612,28 +16599,29 @@ var Module = /** @class */ (function () {
|
|
|
16612
16599
|
}
|
|
16613
16600
|
else {
|
|
16614
16601
|
// export { foo, bar, baz }
|
|
16615
|
-
node.specifiers.
|
|
16602
|
+
for (var _f = 0, _g = node.specifiers; _f < _g.length; _f++) {
|
|
16603
|
+
var specifier = _g[_f];
|
|
16616
16604
|
var localName = specifier.local.name;
|
|
16617
16605
|
var exportedName = specifier.exported.name;
|
|
16618
|
-
if (
|
|
16619
|
-
|
|
16606
|
+
if (this.exports[exportedName] || this.reexports[exportedName]) {
|
|
16607
|
+
this.error({
|
|
16620
16608
|
code: 'DUPLICATE_EXPORT',
|
|
16621
16609
|
message: "A module cannot have multiple exports with the same name ('" + exportedName + "')"
|
|
16622
16610
|
}, specifier.start);
|
|
16623
16611
|
}
|
|
16624
|
-
|
|
16625
|
-
}
|
|
16612
|
+
this.exports[exportedName] = { localName: localName };
|
|
16613
|
+
}
|
|
16626
16614
|
}
|
|
16627
16615
|
};
|
|
16628
16616
|
Module.prototype.addImport = function (node) {
|
|
16629
|
-
var _this = this;
|
|
16630
16617
|
var source = node.source.value;
|
|
16631
16618
|
if (this.sources.indexOf(source) === -1)
|
|
16632
16619
|
this.sources.push(source);
|
|
16633
|
-
node.specifiers.
|
|
16620
|
+
for (var _i = 0, _a = node.specifiers; _i < _a.length; _i++) {
|
|
16621
|
+
var specifier = _a[_i];
|
|
16634
16622
|
var localName = specifier.local.name;
|
|
16635
|
-
if (
|
|
16636
|
-
|
|
16623
|
+
if (this.imports[localName]) {
|
|
16624
|
+
this.error({
|
|
16637
16625
|
code: 'DUPLICATE_IMPORT',
|
|
16638
16626
|
message: "Duplicated import '" + localName + "'"
|
|
16639
16627
|
}, specifier.start);
|
|
@@ -16643,21 +16631,21 @@ var Module = /** @class */ (function () {
|
|
|
16643
16631
|
var name = isDefault
|
|
16644
16632
|
? 'default'
|
|
16645
16633
|
: isNamespace ? '*' : specifier.imported.name;
|
|
16646
|
-
|
|
16647
|
-
}
|
|
16634
|
+
this.imports[localName] = { source: source, specifier: specifier, name: name, module: null };
|
|
16635
|
+
}
|
|
16648
16636
|
};
|
|
16649
16637
|
Module.prototype.analyse = function () {
|
|
16650
|
-
var _this = this;
|
|
16651
16638
|
enhance(this.ast, this, this.dynamicImports);
|
|
16652
|
-
this.ast.body.
|
|
16639
|
+
for (var _i = 0, _a = this.ast.body; _i < _a.length; _i++) {
|
|
16640
|
+
var node = _a[_i];
|
|
16653
16641
|
if (node.isImportDeclaration) {
|
|
16654
|
-
|
|
16642
|
+
this.addImport(node);
|
|
16655
16643
|
}
|
|
16656
16644
|
else if (node
|
|
16657
16645
|
.isExportDeclaration) {
|
|
16658
|
-
|
|
16646
|
+
this.addExport(node);
|
|
16659
16647
|
}
|
|
16660
|
-
}
|
|
16648
|
+
}
|
|
16661
16649
|
};
|
|
16662
16650
|
Module.prototype.basename = function () {
|
|
16663
16651
|
var base = basename(this.id);
|
|
@@ -16665,17 +16653,18 @@ var Module = /** @class */ (function () {
|
|
|
16665
16653
|
return makeLegal(ext ? base.slice(0, -ext.length) : base);
|
|
16666
16654
|
};
|
|
16667
16655
|
Module.prototype.markExports = function () {
|
|
16668
|
-
var
|
|
16669
|
-
|
|
16670
|
-
var variable =
|
|
16671
|
-
variable.exportName =
|
|
16656
|
+
for (var _i = 0, _a = this.getExports(); _i < _a.length; _i++) {
|
|
16657
|
+
var exportName = _a[_i];
|
|
16658
|
+
var variable = this.traceExport(exportName);
|
|
16659
|
+
variable.exportName = exportName;
|
|
16672
16660
|
variable.includeVariable();
|
|
16673
16661
|
if (variable.isNamespace) {
|
|
16674
16662
|
variable.needsNamespaceBlock = true;
|
|
16675
16663
|
}
|
|
16676
|
-
}
|
|
16677
|
-
this.getReexports().
|
|
16678
|
-
var
|
|
16664
|
+
}
|
|
16665
|
+
for (var _b = 0, _c = this.getReexports(); _b < _c.length; _b++) {
|
|
16666
|
+
var name = _c[_b];
|
|
16667
|
+
var variable = this.traceExport(name);
|
|
16679
16668
|
variable.exportName = name;
|
|
16680
16669
|
if (variable.isExternal) {
|
|
16681
16670
|
variable.reexported = variable.module.reexported = true;
|
|
@@ -16683,31 +16672,38 @@ var Module = /** @class */ (function () {
|
|
|
16683
16672
|
else {
|
|
16684
16673
|
variable.includeVariable();
|
|
16685
16674
|
}
|
|
16686
|
-
}
|
|
16675
|
+
}
|
|
16687
16676
|
};
|
|
16688
16677
|
Module.prototype.linkDependencies = function () {
|
|
16689
16678
|
var _this = this;
|
|
16690
|
-
this.sources.
|
|
16691
|
-
var
|
|
16679
|
+
for (var _i = 0, _a = this.sources; _i < _a.length; _i++) {
|
|
16680
|
+
var source = _a[_i];
|
|
16681
|
+
var id = this.resolvedIds[source];
|
|
16692
16682
|
if (id) {
|
|
16693
|
-
var module =
|
|
16694
|
-
|
|
16683
|
+
var module = this.graph.moduleById.get(id);
|
|
16684
|
+
this.dependencies.push(module);
|
|
16695
16685
|
}
|
|
16696
|
-
}
|
|
16697
|
-
|
|
16698
|
-
Object.keys(specifiers).
|
|
16686
|
+
}
|
|
16687
|
+
var resolveSpecifiers = function (specifiers) {
|
|
16688
|
+
for (var _i = 0, _a = Object.keys(specifiers); _i < _a.length; _i++) {
|
|
16689
|
+
var name = _a[_i];
|
|
16699
16690
|
var specifier = specifiers[name];
|
|
16700
16691
|
var id = _this.resolvedIds[specifier.source];
|
|
16701
16692
|
specifier.module = _this.graph.moduleById.get(id);
|
|
16702
|
-
}
|
|
16703
|
-
}
|
|
16693
|
+
}
|
|
16694
|
+
};
|
|
16695
|
+
resolveSpecifiers(this.imports);
|
|
16696
|
+
resolveSpecifiers(this.reexports);
|
|
16704
16697
|
this.exportAllModules = this.exportAllSources.map(function (source) {
|
|
16705
16698
|
var id = _this.resolvedIds[source];
|
|
16706
16699
|
return _this.graph.moduleById.get(id);
|
|
16707
16700
|
});
|
|
16708
16701
|
};
|
|
16709
16702
|
Module.prototype.bindReferences = function () {
|
|
16710
|
-
this.ast.body
|
|
16703
|
+
for (var _i = 0, _a = this.ast.body; _i < _a.length; _i++) {
|
|
16704
|
+
var node = _a[_i];
|
|
16705
|
+
node.bind();
|
|
16706
|
+
}
|
|
16711
16707
|
};
|
|
16712
16708
|
Module.prototype.getDynamicImportExpressions = function () {
|
|
16713
16709
|
return this.dynamicImports.map(function (node) {
|
|
@@ -16791,10 +16787,11 @@ var Module = /** @class */ (function () {
|
|
|
16791
16787
|
allExports["*" + module.id] = true;
|
|
16792
16788
|
return;
|
|
16793
16789
|
}
|
|
16794
|
-
module.getAllExports().
|
|
16790
|
+
for (var _i = 0, _a = module.getAllExports(); _i < _a.length; _i++) {
|
|
16791
|
+
var name = _a[_i];
|
|
16795
16792
|
if (name !== 'default')
|
|
16796
16793
|
allExports[name] = true;
|
|
16797
|
-
}
|
|
16794
|
+
}
|
|
16798
16795
|
});
|
|
16799
16796
|
return Object.keys(allExports);
|
|
16800
16797
|
};
|
|
@@ -16803,36 +16800,38 @@ var Module = /** @class */ (function () {
|
|
|
16803
16800
|
};
|
|
16804
16801
|
Module.prototype.getReexports = function () {
|
|
16805
16802
|
var reexports = blank();
|
|
16806
|
-
|
|
16803
|
+
for (var name in this.reexports) {
|
|
16807
16804
|
reexports[name] = true;
|
|
16808
|
-
}
|
|
16805
|
+
}
|
|
16809
16806
|
this.exportAllModules.forEach(function (module) {
|
|
16810
16807
|
if (module.isExternal) {
|
|
16811
16808
|
reexports["*" + module.id] = true;
|
|
16812
16809
|
return;
|
|
16813
16810
|
}
|
|
16814
|
-
module
|
|
16815
|
-
|
|
16816
|
-
.concat(module.getReexports())
|
|
16817
|
-
.forEach(function (name) {
|
|
16811
|
+
for (var _i = 0, _a = module.getExports().concat(module.getReexports()); _i < _a.length; _i++) {
|
|
16812
|
+
var name = _a[_i];
|
|
16818
16813
|
if (name !== 'default')
|
|
16819
16814
|
reexports[name] = true;
|
|
16820
|
-
}
|
|
16815
|
+
}
|
|
16821
16816
|
});
|
|
16822
16817
|
return Object.keys(reexports);
|
|
16823
16818
|
};
|
|
16824
16819
|
Module.prototype.includeAllInBundle = function () {
|
|
16825
|
-
this.ast.body.
|
|
16820
|
+
for (var _i = 0, _a = this.ast.body; _i < _a.length; _i++) {
|
|
16821
|
+
var node = _a[_i];
|
|
16822
|
+
includeFully(node);
|
|
16823
|
+
}
|
|
16826
16824
|
};
|
|
16827
16825
|
Module.prototype.includeInBundle = function () {
|
|
16828
16826
|
var addedNewNodes = false;
|
|
16829
|
-
this.ast.body.
|
|
16827
|
+
for (var _i = 0, _a = this.ast.body; _i < _a.length; _i++) {
|
|
16828
|
+
var node = _a[_i];
|
|
16830
16829
|
if (node.shouldBeIncluded()) {
|
|
16831
16830
|
if (node.includeInBundle()) {
|
|
16832
16831
|
addedNewNodes = true;
|
|
16833
16832
|
}
|
|
16834
16833
|
}
|
|
16835
|
-
}
|
|
16834
|
+
}
|
|
16836
16835
|
return addedNewNodes;
|
|
16837
16836
|
};
|
|
16838
16837
|
Module.prototype.namespace = function () {
|
|
@@ -17040,12 +17039,12 @@ function handleMissingExport(exportName, importingModule, importedModule, import
|
|
|
17040
17039
|
}, importerStart);
|
|
17041
17040
|
}
|
|
17042
17041
|
|
|
17043
|
-
var charToInteger
|
|
17044
|
-
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
17045
|
-
for (var i = 0; i < chars.length; i++) {
|
|
17046
|
-
charToInteger$1
|
|
17042
|
+
var charToInteger = {};
|
|
17043
|
+
var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
17044
|
+
for (var i = 0; i < chars$1.length; i++) {
|
|
17045
|
+
charToInteger[chars$1.charCodeAt(i)] = i;
|
|
17047
17046
|
}
|
|
17048
|
-
function decode
|
|
17047
|
+
function decode(mappings) {
|
|
17049
17048
|
var generatedCodeColumn = 0; // first field
|
|
17050
17049
|
var sourceFileIndex = 0; // second field
|
|
17051
17050
|
var sourceCodeLine = 0; // third field
|
|
@@ -17072,7 +17071,7 @@ function decode$1(mappings) {
|
|
|
17072
17071
|
generatedCodeColumn = 0;
|
|
17073
17072
|
}
|
|
17074
17073
|
else {
|
|
17075
|
-
var integer = charToInteger
|
|
17074
|
+
var integer = charToInteger[c];
|
|
17076
17075
|
if (integer === undefined) {
|
|
17077
17076
|
throw new Error('Invalid character (' + String.fromCharCode(c) + ')');
|
|
17078
17077
|
}
|
|
@@ -17116,62 +17115,12 @@ function decode$1(mappings) {
|
|
|
17116
17115
|
decoded.push(line);
|
|
17117
17116
|
return decoded;
|
|
17118
17117
|
}
|
|
17119
|
-
function encode$1(decoded) {
|
|
17120
|
-
var sourceFileIndex = 0; // second field
|
|
17121
|
-
var sourceCodeLine = 0; // third field
|
|
17122
|
-
var sourceCodeColumn = 0; // fourth field
|
|
17123
|
-
var nameIndex = 0; // fifth field
|
|
17124
|
-
var mappings = '';
|
|
17125
|
-
for (var i = 0; i < decoded.length; i++) {
|
|
17126
|
-
var line = decoded[i];
|
|
17127
|
-
if (i > 0)
|
|
17128
|
-
mappings += ';';
|
|
17129
|
-
if (line.length === 0)
|
|
17130
|
-
continue;
|
|
17131
|
-
var generatedCodeColumn = 0; // first field
|
|
17132
|
-
var lineMappings = [];
|
|
17133
|
-
for (var _i = 0, line_1 = line; _i < line_1.length; _i++) {
|
|
17134
|
-
var segment = line_1[_i];
|
|
17135
|
-
var segmentMappings = encodeInteger$1(segment[0] - generatedCodeColumn);
|
|
17136
|
-
generatedCodeColumn = segment[0];
|
|
17137
|
-
if (segment.length > 1) {
|
|
17138
|
-
segmentMappings +=
|
|
17139
|
-
encodeInteger$1(segment[1] - sourceFileIndex) +
|
|
17140
|
-
encodeInteger$1(segment[2] - sourceCodeLine) +
|
|
17141
|
-
encodeInteger$1(segment[3] - sourceCodeColumn);
|
|
17142
|
-
sourceFileIndex = segment[1];
|
|
17143
|
-
sourceCodeLine = segment[2];
|
|
17144
|
-
sourceCodeColumn = segment[3];
|
|
17145
|
-
}
|
|
17146
|
-
if (segment.length === 5) {
|
|
17147
|
-
segmentMappings += encodeInteger$1(segment[4] - nameIndex);
|
|
17148
|
-
nameIndex = segment[4];
|
|
17149
|
-
}
|
|
17150
|
-
lineMappings.push(segmentMappings);
|
|
17151
|
-
}
|
|
17152
|
-
mappings += lineMappings.join(',');
|
|
17153
|
-
}
|
|
17154
|
-
return mappings;
|
|
17155
|
-
}
|
|
17156
|
-
function encodeInteger$1(num) {
|
|
17157
|
-
var result = '';
|
|
17158
|
-
num = num < 0 ? (-num << 1) | 1 : num << 1;
|
|
17159
|
-
do {
|
|
17160
|
-
var clamped = num & 31;
|
|
17161
|
-
num >>= 5;
|
|
17162
|
-
if (num > 0) {
|
|
17163
|
-
clamped |= 32;
|
|
17164
|
-
}
|
|
17165
|
-
result += chars[clamped];
|
|
17166
|
-
} while (num > 0);
|
|
17167
|
-
return result;
|
|
17168
|
-
}
|
|
17169
17118
|
|
|
17170
17119
|
function transform(graph, source, id, plugins) {
|
|
17171
17120
|
var sourcemapChain = [];
|
|
17172
17121
|
var originalSourcemap = typeof source.map === 'string' ? JSON.parse(source.map) : source.map;
|
|
17173
17122
|
if (originalSourcemap && typeof originalSourcemap.mappings === 'string') {
|
|
17174
|
-
originalSourcemap.mappings = decode
|
|
17123
|
+
originalSourcemap.mappings = decode(originalSourcemap.mappings);
|
|
17175
17124
|
}
|
|
17176
17125
|
var originalCode = source.code;
|
|
17177
17126
|
var ast = source.ast;
|
|
@@ -17243,7 +17192,7 @@ function transform(graph, source, id, plugins) {
|
|
|
17243
17192
|
result.map = JSON.parse(result.map);
|
|
17244
17193
|
}
|
|
17245
17194
|
if (result.map && typeof result.map.mappings === 'string') {
|
|
17246
|
-
result.map.mappings = decode
|
|
17195
|
+
result.map.mappings = decode(result.map.mappings);
|
|
17247
17196
|
}
|
|
17248
17197
|
// strict null check allows 'null' maps to not be pushed to the chain, while 'undefined' gets the missing map warning
|
|
17249
17198
|
if (result.map !== null) {
|
|
@@ -18005,9 +17954,7 @@ function transformBundle(code, plugins, sourcemapChain, options) {
|
|
|
18005
17954
|
return promise;
|
|
18006
17955
|
return promise.then(function (code) {
|
|
18007
17956
|
return Promise.resolve()
|
|
18008
|
-
.then(function () {
|
|
18009
|
-
return plugin.transformBundle(code, options);
|
|
18010
|
-
})
|
|
17957
|
+
.then(function () { return plugin.transformBundle(code, options); })
|
|
18011
17958
|
.then(function (result) {
|
|
18012
17959
|
if (result == null)
|
|
18013
17960
|
return code;
|
|
@@ -18019,7 +17966,7 @@ function transformBundle(code, plugins, sourcemapChain, options) {
|
|
|
18019
17966
|
}
|
|
18020
17967
|
var map = typeof result.map === 'string' ? JSON.parse(result.map) : result.map;
|
|
18021
17968
|
if (map && typeof map.mappings === 'string') {
|
|
18022
|
-
map.mappings = decode
|
|
17969
|
+
map.mappings = decode(map.mappings);
|
|
18023
17970
|
}
|
|
18024
17971
|
// strict null check allows 'null' maps to not be pushed to the chain, while 'undefined' gets the missing map warning
|
|
18025
17972
|
if (map !== null) {
|
|
@@ -18056,23 +18003,22 @@ var Link = /** @class */ (function () {
|
|
|
18056
18003
|
this.mappings = map.mappings;
|
|
18057
18004
|
}
|
|
18058
18005
|
Link.prototype.traceMappings = function () {
|
|
18059
|
-
var _this = this;
|
|
18060
18006
|
var sources = [];
|
|
18061
18007
|
var sourcesContent = [];
|
|
18062
18008
|
var names = [];
|
|
18063
|
-
var mappings =
|
|
18009
|
+
var mappings = [];
|
|
18010
|
+
for (var _i = 0, _a = this.mappings; _i < _a.length; _i++) {
|
|
18011
|
+
var line = _a[_i];
|
|
18064
18012
|
var tracedLine = [];
|
|
18065
|
-
line.
|
|
18066
|
-
var
|
|
18013
|
+
for (var _b = 0, line_1 = line; _b < line_1.length; _b++) {
|
|
18014
|
+
var segment = line_1[_b];
|
|
18015
|
+
var source = this.sources[segment[1]];
|
|
18067
18016
|
if (!source)
|
|
18068
|
-
|
|
18069
|
-
var traced = source.traceSegment(segment[2], segment[3],
|
|
18017
|
+
continue;
|
|
18018
|
+
var traced = source.traceSegment(segment[2], segment[3], this.names[segment[4]]);
|
|
18070
18019
|
if (traced) {
|
|
18071
|
-
var sourceIndex = null;
|
|
18072
|
-
var nameIndex = null;
|
|
18073
|
-
segment = [segment[0], null, traced.line, traced.column];
|
|
18074
18020
|
// newer sources are more likely to be used, so search backwards.
|
|
18075
|
-
sourceIndex = sources.lastIndexOf(traced.source.filename);
|
|
18021
|
+
var sourceIndex = sources.lastIndexOf(traced.source.filename);
|
|
18076
18022
|
if (sourceIndex === -1) {
|
|
18077
18023
|
sourceIndex = sources.length;
|
|
18078
18024
|
sources.push(traced.source.filename);
|
|
@@ -18087,28 +18033,33 @@ var Link = /** @class */ (function () {
|
|
|
18087
18033
|
message: "Multiple conflicting contents for sourcemap source " + source.filename
|
|
18088
18034
|
});
|
|
18089
18035
|
}
|
|
18090
|
-
|
|
18036
|
+
var tracedSegment = [
|
|
18037
|
+
segment[0],
|
|
18038
|
+
sourceIndex,
|
|
18039
|
+
traced.line,
|
|
18040
|
+
traced.column
|
|
18041
|
+
];
|
|
18091
18042
|
if (traced.name) {
|
|
18092
|
-
nameIndex = names.indexOf(traced.name);
|
|
18043
|
+
var nameIndex = names.indexOf(traced.name);
|
|
18093
18044
|
if (nameIndex === -1) {
|
|
18094
18045
|
nameIndex = names.length;
|
|
18095
18046
|
names.push(traced.name);
|
|
18096
18047
|
}
|
|
18097
|
-
|
|
18048
|
+
tracedSegment[4] = nameIndex;
|
|
18098
18049
|
}
|
|
18099
|
-
tracedLine.push(
|
|
18050
|
+
tracedLine.push(tracedSegment);
|
|
18100
18051
|
}
|
|
18101
|
-
}
|
|
18102
|
-
|
|
18103
|
-
}
|
|
18052
|
+
}
|
|
18053
|
+
mappings.push(tracedLine);
|
|
18054
|
+
}
|
|
18104
18055
|
return { sources: sources, sourcesContent: sourcesContent, names: names, mappings: mappings };
|
|
18105
18056
|
};
|
|
18106
18057
|
Link.prototype.traceSegment = function (line, column, name) {
|
|
18107
18058
|
var segments = this.mappings[line];
|
|
18108
18059
|
if (!segments)
|
|
18109
18060
|
return null;
|
|
18110
|
-
for (var
|
|
18111
|
-
var segment =
|
|
18061
|
+
for (var _i = 0, segments_1 = segments; _i < segments_1.length; _i++) {
|
|
18062
|
+
var segment = segments_1[_i];
|
|
18112
18063
|
if (segment[0] > column)
|
|
18113
18064
|
return null;
|
|
18114
18065
|
if (segment[0] === column) {
|
|
@@ -18172,14 +18123,9 @@ function collapseSourcemaps(bundle, file, map, modules, bundleSourcemapChain) {
|
|
|
18172
18123
|
if (file) {
|
|
18173
18124
|
var directory_2 = dirname(file);
|
|
18174
18125
|
sources = sources.map(function (source) { return relative(directory_2, source); });
|
|
18175
|
-
|
|
18126
|
+
file = basename(file);
|
|
18176
18127
|
}
|
|
18177
|
-
|
|
18178
|
-
map.sources = sources;
|
|
18179
|
-
map.sourcesContent = sourcesContent;
|
|
18180
|
-
map.names = names;
|
|
18181
|
-
map.mappings = encode$1(mappings);
|
|
18182
|
-
return map;
|
|
18128
|
+
return new SourceMap({ file: file, sources: sources, sourcesContent: sourcesContent, names: names, mappings: mappings });
|
|
18183
18129
|
}
|
|
18184
18130
|
|
|
18185
18131
|
function callIfFunction(thing) {
|
|
@@ -18730,7 +18676,7 @@ var Chunk$1 = /** @class */ (function () {
|
|
|
18730
18676
|
timeStart('render modules', 3);
|
|
18731
18677
|
var indentString = getIndentString(_this.orderedModules, options);
|
|
18732
18678
|
var renderOptions = {
|
|
18733
|
-
legacy:
|
|
18679
|
+
legacy: options.legacy,
|
|
18734
18680
|
freeze: options.freeze !== false,
|
|
18735
18681
|
namespaceToStringTag: options.namespaceToStringTag === true,
|
|
18736
18682
|
indent: indentString,
|
|
@@ -18791,9 +18737,9 @@ var Chunk$1 = /** @class */ (function () {
|
|
|
18791
18737
|
if (footer)
|
|
18792
18738
|
magicString.append('\n' + footer);
|
|
18793
18739
|
var prevCode = magicString.toString();
|
|
18794
|
-
var map = null;
|
|
18795
18740
|
var bundleSourcemapChain = [];
|
|
18796
18741
|
return transformBundle(prevCode, _this.graph.plugins, bundleSourcemapChain, options).then(function (code) {
|
|
18742
|
+
var map;
|
|
18797
18743
|
if (options.sourcemap) {
|
|
18798
18744
|
timeStart('sourcemap', 3);
|
|
18799
18745
|
var file = options.file ? options.sourcemapFile || options.file : _this.id;
|
|
@@ -18803,11 +18749,8 @@ var Chunk$1 = /** @class */ (function () {
|
|
|
18803
18749
|
_this.graph.plugins.find(function (plugin) {
|
|
18804
18750
|
return Boolean(plugin.transform || plugin.transformBundle);
|
|
18805
18751
|
})) {
|
|
18806
|
-
|
|
18807
|
-
|
|
18808
|
-
map.mappings = decode$1(map.mappings);
|
|
18809
|
-
}
|
|
18810
|
-
map = collapseSourcemaps(_this, file, map, usedModules, bundleSourcemapChain);
|
|
18752
|
+
var decodedMap = magicString.generateDecodedMap({});
|
|
18753
|
+
map = collapseSourcemaps(_this, file, decodedMap, usedModules, bundleSourcemapChain);
|
|
18811
18754
|
}
|
|
18812
18755
|
else {
|
|
18813
18756
|
map = magicString.generateMap({ file: file, includeContent: true });
|
|
@@ -18946,16 +18889,18 @@ var Graph = /** @class */ (function () {
|
|
|
18946
18889
|
this.cachedModules = new Map();
|
|
18947
18890
|
if (options.cache) {
|
|
18948
18891
|
if (options.cache.modules) {
|
|
18949
|
-
options.cache.modules.
|
|
18950
|
-
|
|
18951
|
-
|
|
18892
|
+
for (var _i = 0, _a = options.cache.modules; _i < _a.length; _i++) {
|
|
18893
|
+
var module = _a[_i];
|
|
18894
|
+
this.cachedModules.set(module.id, module);
|
|
18895
|
+
}
|
|
18952
18896
|
}
|
|
18953
18897
|
else {
|
|
18954
18898
|
var chunks = options.cache.chunks;
|
|
18955
18899
|
for (var chunkName in chunks) {
|
|
18956
|
-
chunks[chunkName].modules.
|
|
18957
|
-
|
|
18958
|
-
|
|
18900
|
+
for (var _b = 0, _c = chunks[chunkName].modules; _b < _c.length; _b++) {
|
|
18901
|
+
var module = _c[_b];
|
|
18902
|
+
this.cachedModules.set(module.id, module);
|
|
18903
|
+
}
|
|
18959
18904
|
}
|
|
18960
18905
|
}
|
|
18961
18906
|
}
|
|
@@ -19012,9 +18957,10 @@ var Graph = /** @class */ (function () {
|
|
|
19012
18957
|
.concat(handleMissingExport));
|
|
19013
18958
|
this.scope = new GlobalScope();
|
|
19014
18959
|
// TODO strictly speaking, this only applies with non-ES6, non-default-only bundles
|
|
19015
|
-
['module', 'exports', '_interopDefault'].
|
|
19016
|
-
|
|
19017
|
-
|
|
18960
|
+
for (var _d = 0, _e = ['module', 'exports', '_interopDefault']; _d < _e.length; _d++) {
|
|
18961
|
+
var name = _e[_d];
|
|
18962
|
+
this.scope.findVariable(name); // creates global variable as side-effect
|
|
18963
|
+
}
|
|
19018
18964
|
this.moduleById = new Map();
|
|
19019
18965
|
this.modules = [];
|
|
19020
18966
|
this.externalModules = [];
|
|
@@ -19025,9 +18971,9 @@ var Graph = /** @class */ (function () {
|
|
|
19025
18971
|
}
|
|
19026
18972
|
else if (typeof optionsModuleContext === 'object') {
|
|
19027
18973
|
var moduleContext_1 = new Map();
|
|
19028
|
-
|
|
19029
|
-
|
|
19030
|
-
}
|
|
18974
|
+
for (var key in optionsModuleContext) {
|
|
18975
|
+
moduleContext_1.set(resolve(key), optionsModuleContext[key]);
|
|
18976
|
+
}
|
|
19031
18977
|
this.getModuleContext = function (id) { return moduleContext_1.get(id) || _this.context; };
|
|
19032
18978
|
}
|
|
19033
18979
|
else {
|
|
@@ -19042,7 +18988,6 @@ var Graph = /** @class */ (function () {
|
|
|
19042
18988
|
}
|
|
19043
18989
|
this.onwarn = options.onwarn || makeOnwarn();
|
|
19044
18990
|
this.varOrConst = options.preferConst ? 'const' : 'var';
|
|
19045
|
-
this.legacy = options.legacy;
|
|
19046
18991
|
this.acornOptions = options.acorn || {};
|
|
19047
18992
|
var acornPluginsToInject = [];
|
|
19048
18993
|
this.dynamicImport =
|
|
@@ -19088,26 +19033,36 @@ var Graph = /** @class */ (function () {
|
|
|
19088
19033
|
});
|
|
19089
19034
|
};
|
|
19090
19035
|
Graph.prototype.link = function () {
|
|
19091
|
-
this.modules
|
|
19092
|
-
|
|
19036
|
+
for (var _i = 0, _a = this.modules; _i < _a.length; _i++) {
|
|
19037
|
+
var module = _a[_i];
|
|
19038
|
+
module.linkDependencies();
|
|
19039
|
+
}
|
|
19040
|
+
for (var _b = 0, _c = this.modules; _b < _c.length; _b++) {
|
|
19041
|
+
var module = _c[_b];
|
|
19042
|
+
module.bindReferences();
|
|
19043
|
+
}
|
|
19093
19044
|
};
|
|
19094
19045
|
Graph.prototype.includeMarked = function (modules) {
|
|
19095
19046
|
if (this.treeshake) {
|
|
19096
|
-
var
|
|
19047
|
+
var addedNewNodes = void 0, treeshakingPass = 1;
|
|
19097
19048
|
do {
|
|
19098
19049
|
timeStart("treeshaking pass " + treeshakingPass, 3);
|
|
19099
|
-
|
|
19100
|
-
modules.
|
|
19050
|
+
addedNewNodes = false;
|
|
19051
|
+
for (var _i = 0, modules_1 = modules; _i < modules_1.length; _i++) {
|
|
19052
|
+
var module = modules_1[_i];
|
|
19101
19053
|
if (module.includeInBundle()) {
|
|
19102
|
-
|
|
19054
|
+
addedNewNodes = true;
|
|
19103
19055
|
}
|
|
19104
|
-
}
|
|
19056
|
+
}
|
|
19105
19057
|
timeEnd("treeshaking pass " + treeshakingPass++, 3);
|
|
19106
|
-
} while (
|
|
19058
|
+
} while (addedNewNodes);
|
|
19107
19059
|
}
|
|
19108
19060
|
else {
|
|
19109
19061
|
// Necessary to properly replace namespace imports
|
|
19110
|
-
|
|
19062
|
+
for (var _a = 0, modules_2 = modules; _a < modules_2.length; _a++) {
|
|
19063
|
+
var module = modules_2[_a];
|
|
19064
|
+
module.includeAllInBundle();
|
|
19065
|
+
}
|
|
19111
19066
|
}
|
|
19112
19067
|
};
|
|
19113
19068
|
Graph.prototype.buildSingle = function (entryModuleId) {
|
|
@@ -19122,21 +19077,25 @@ var Graph = /** @class */ (function () {
|
|
|
19122
19077
|
// determine the topological execution order for the bundle
|
|
19123
19078
|
timeStart('analyse dependency graph', 2);
|
|
19124
19079
|
_this.link();
|
|
19125
|
-
var _a = _this.analyseExecution([entryModule]), orderedModules = _a.orderedModules, dynamicImports = _a.dynamicImports;
|
|
19080
|
+
var _a = _this.analyseExecution([entryModule], false), orderedModules = _a.orderedModules, dynamicImports = _a.dynamicImports;
|
|
19126
19081
|
timeEnd('analyse dependency graph', 2);
|
|
19127
19082
|
// Phase 3 – marking. We include all statements that should be included
|
|
19128
19083
|
timeStart('mark included statements', 2);
|
|
19129
19084
|
entryModule.markExports();
|
|
19130
|
-
dynamicImports.
|
|
19085
|
+
for (var _i = 0, dynamicImports_1 = dynamicImports; _i < dynamicImports_1.length; _i++) {
|
|
19086
|
+
var dynamicImportModule = dynamicImports_1[_i];
|
|
19131
19087
|
if (entryModule !== dynamicImportModule)
|
|
19132
19088
|
dynamicImportModule.markExports();
|
|
19133
19089
|
// all dynamic import modules inlined for single-file build
|
|
19134
19090
|
dynamicImportModule.namespace().includeVariable();
|
|
19135
|
-
}
|
|
19091
|
+
}
|
|
19136
19092
|
// only include statements that should appear in the bundle
|
|
19137
19093
|
_this.includeMarked(orderedModules);
|
|
19138
19094
|
// check for unused external imports
|
|
19139
|
-
_this.externalModules
|
|
19095
|
+
for (var _b = 0, _c = _this.externalModules; _b < _c.length; _b++) {
|
|
19096
|
+
var module = _c[_b];
|
|
19097
|
+
module.warnUnusedImports();
|
|
19098
|
+
}
|
|
19140
19099
|
timeEnd('mark included statements', 2);
|
|
19141
19100
|
// Phase 4 – we construct the chunk itself, generating its import and export facades
|
|
19142
19101
|
timeStart('generate chunks', 2);
|
|
@@ -19162,21 +19121,26 @@ var Graph = /** @class */ (function () {
|
|
|
19162
19121
|
// determine the topological execution order for the bundle
|
|
19163
19122
|
timeStart('analyse dependency graph', 2);
|
|
19164
19123
|
_this.link();
|
|
19165
|
-
var _a = _this.analyseExecution(entryModules, preserveModules), orderedModules = _a.orderedModules, dynamicImports = _a.dynamicImports;
|
|
19166
|
-
dynamicImports.
|
|
19124
|
+
var _a = _this.analyseExecution(entryModules, !preserveModules), orderedModules = _a.orderedModules, dynamicImports = _a.dynamicImports;
|
|
19125
|
+
for (var _i = 0, dynamicImports_2 = dynamicImports; _i < dynamicImports_2.length; _i++) {
|
|
19126
|
+
var dynamicImportModule = dynamicImports_2[_i];
|
|
19167
19127
|
if (entryModules.indexOf(dynamicImportModule) === -1)
|
|
19168
19128
|
entryModules.push(dynamicImportModule);
|
|
19169
|
-
}
|
|
19129
|
+
}
|
|
19170
19130
|
timeEnd('analyse dependency graph', 2);
|
|
19171
19131
|
// Phase 3 – marking. We include all statements that should be included
|
|
19172
19132
|
timeStart('mark included statements', 2);
|
|
19173
|
-
entryModules.
|
|
19133
|
+
for (var _b = 0, entryModules_1 = entryModules; _b < entryModules_1.length; _b++) {
|
|
19134
|
+
var entryModule = entryModules_1[_b];
|
|
19174
19135
|
entryModule.markExports();
|
|
19175
|
-
}
|
|
19136
|
+
}
|
|
19176
19137
|
// only include statements that should appear in the bundle
|
|
19177
19138
|
_this.includeMarked(orderedModules);
|
|
19178
19139
|
// check for unused external imports
|
|
19179
|
-
_this.externalModules
|
|
19140
|
+
for (var _c = 0, _d = _this.externalModules; _c < _d.length; _c++) {
|
|
19141
|
+
var externalModule = _d[_c];
|
|
19142
|
+
externalModule.warnUnusedImports();
|
|
19143
|
+
}
|
|
19180
19144
|
timeEnd('mark included statements', 2);
|
|
19181
19145
|
// Phase 4 – we construct the chunks, working out the optimal chunking using
|
|
19182
19146
|
// entry point graph colouring, before generating the import and export facades
|
|
@@ -19187,43 +19151,47 @@ var Graph = /** @class */ (function () {
|
|
|
19187
19151
|
// should be made to be its own entry point module before chunking
|
|
19188
19152
|
var chunkList = [];
|
|
19189
19153
|
if (!preserveModules) {
|
|
19190
|
-
var
|
|
19191
|
-
orderedModules.
|
|
19154
|
+
var chunkModules = {};
|
|
19155
|
+
for (var _e = 0, orderedModules_1 = orderedModules; _e < orderedModules_1.length; _e++) {
|
|
19156
|
+
var module = orderedModules_1[_e];
|
|
19192
19157
|
var entryPointsHashStr = Uint8ArrayToHexString(module.entryPointsHash);
|
|
19193
|
-
var curChunk =
|
|
19158
|
+
var curChunk = chunkModules[entryPointsHashStr];
|
|
19194
19159
|
if (curChunk) {
|
|
19195
19160
|
curChunk.push(module);
|
|
19196
19161
|
}
|
|
19197
19162
|
else {
|
|
19198
|
-
|
|
19163
|
+
chunkModules[entryPointsHashStr] = [module];
|
|
19199
19164
|
}
|
|
19200
|
-
}
|
|
19165
|
+
}
|
|
19201
19166
|
// create each chunk
|
|
19202
|
-
|
|
19203
|
-
var chunk =
|
|
19167
|
+
for (var entryHashSum in chunkModules) {
|
|
19168
|
+
var chunk = chunkModules[entryHashSum];
|
|
19204
19169
|
var chunkModulesOrdered = chunk.sort(function (moduleA, moduleB) { return (moduleA.execIndex > moduleB.execIndex ? 1 : -1); });
|
|
19205
19170
|
chunkList.push(new Chunk$1(_this, chunkModulesOrdered));
|
|
19206
|
-
}
|
|
19171
|
+
}
|
|
19207
19172
|
}
|
|
19208
19173
|
else {
|
|
19209
|
-
orderedModules.
|
|
19174
|
+
for (var _f = 0, orderedModules_2 = orderedModules; _f < orderedModules_2.length; _f++) {
|
|
19175
|
+
var module = orderedModules_2[_f];
|
|
19210
19176
|
var chunkInstance = new Chunk$1(_this, [module]);
|
|
19211
19177
|
chunkInstance.entryModule = module;
|
|
19212
19178
|
chunkInstance.isEntryModuleFacade = true;
|
|
19213
19179
|
chunkList.push(chunkInstance);
|
|
19214
|
-
}
|
|
19180
|
+
}
|
|
19215
19181
|
}
|
|
19216
19182
|
// for each entry point module, ensure its exports
|
|
19217
19183
|
// are exported by the chunk itself, with safe name deduping
|
|
19218
|
-
entryModules.
|
|
19184
|
+
for (var _g = 0, entryModules_2 = entryModules; _g < entryModules_2.length; _g++) {
|
|
19185
|
+
var entryModule = entryModules_2[_g];
|
|
19219
19186
|
entryModule.chunk.generateEntryExports(entryModule);
|
|
19220
|
-
}
|
|
19187
|
+
}
|
|
19221
19188
|
// for each chunk module, set up its imports to other
|
|
19222
19189
|
// chunks, if those variables are included after treeshaking
|
|
19223
|
-
chunkList.
|
|
19190
|
+
for (var _h = 0, chunkList_1 = chunkList; _h < chunkList_1.length; _h++) {
|
|
19191
|
+
var chunk = chunkList_1[_h];
|
|
19224
19192
|
chunk.collectDependencies();
|
|
19225
19193
|
chunk.generateImports();
|
|
19226
|
-
}
|
|
19194
|
+
}
|
|
19227
19195
|
// finally prepare output chunks
|
|
19228
19196
|
var chunks = {};
|
|
19229
19197
|
var inputRelativeDir;
|
|
@@ -19269,66 +19237,69 @@ var Graph = /** @class */ (function () {
|
|
|
19269
19237
|
return chunks;
|
|
19270
19238
|
});
|
|
19271
19239
|
};
|
|
19272
|
-
Graph.prototype.analyseExecution = function (entryModules,
|
|
19240
|
+
Graph.prototype.analyseExecution = function (entryModules, graphColouring) {
|
|
19273
19241
|
var _this = this;
|
|
19274
|
-
if (preserveModules === void 0) { preserveModules = false; }
|
|
19275
19242
|
var curEntry, curEntryHash;
|
|
19276
19243
|
var allSeen = {};
|
|
19277
19244
|
var ordered = [];
|
|
19278
19245
|
var dynamicImports = [];
|
|
19279
|
-
var
|
|
19280
|
-
|
|
19246
|
+
var parents;
|
|
19247
|
+
var visit = function (module) {
|
|
19281
19248
|
if (module.isEntryPoint && module !== curEntry)
|
|
19282
19249
|
return;
|
|
19283
19250
|
// Track entry point graph colouring by tracing all modules loaded by a given
|
|
19284
19251
|
// entry point and colouring those modules by the hash of its id. Colours are mixed as
|
|
19285
19252
|
// hash xors, providing the unique colouring of the graph into unique hash chunks.
|
|
19286
19253
|
// This is really all there is to automated chunking, the rest is chunk wiring.
|
|
19287
|
-
if (
|
|
19254
|
+
if (graphColouring) {
|
|
19288
19255
|
Uint8ArrayXor(module.entryPointsHash, curEntryHash);
|
|
19289
19256
|
}
|
|
19290
|
-
module.dependencies.
|
|
19291
|
-
|
|
19292
|
-
|
|
19293
|
-
|
|
19294
|
-
|
|
19295
|
-
|
|
19296
|
-
|
|
19257
|
+
for (var _i = 0, _a = module.dependencies; _i < _a.length; _i++) {
|
|
19258
|
+
var depModule = _a[_i];
|
|
19259
|
+
if (depModule.isExternal)
|
|
19260
|
+
continue;
|
|
19261
|
+
if (depModule.id in parents) {
|
|
19262
|
+
if (!allSeen[depModule.id]) {
|
|
19263
|
+
_this.warnCycle(depModule.id, module.id, parents);
|
|
19297
19264
|
}
|
|
19298
|
-
|
|
19299
|
-
visit(depModule, parents);
|
|
19265
|
+
continue;
|
|
19300
19266
|
}
|
|
19301
|
-
|
|
19267
|
+
parents[depModule.id] = module.id;
|
|
19268
|
+
visit(depModule);
|
|
19269
|
+
}
|
|
19302
19270
|
if (_this.dynamicImport) {
|
|
19303
|
-
module.dynamicImportResolutions.
|
|
19304
|
-
|
|
19305
|
-
|
|
19306
|
-
|
|
19271
|
+
for (var _b = 0, _c = module.dynamicImportResolutions; _b < _c.length; _b++) {
|
|
19272
|
+
var dynamicModule = _c[_b];
|
|
19273
|
+
if (dynamicModule instanceof Module) {
|
|
19274
|
+
if (dynamicImports.indexOf(dynamicModule) === -1) {
|
|
19275
|
+
dynamicImports.push(dynamicModule);
|
|
19307
19276
|
}
|
|
19308
19277
|
}
|
|
19309
|
-
}
|
|
19278
|
+
}
|
|
19310
19279
|
}
|
|
19311
19280
|
if (allSeen[module.id])
|
|
19312
19281
|
return;
|
|
19313
19282
|
allSeen[module.id] = true;
|
|
19314
19283
|
module.execIndex = ordered.length;
|
|
19315
19284
|
ordered.push(module);
|
|
19316
|
-
var _a;
|
|
19317
19285
|
};
|
|
19318
|
-
for (var
|
|
19319
|
-
curEntry =
|
|
19286
|
+
for (var _i = 0, entryModules_3 = entryModules; _i < entryModules_3.length; _i++) {
|
|
19287
|
+
curEntry = entryModules_3[_i];
|
|
19320
19288
|
curEntry.isEntryPoint = true;
|
|
19321
19289
|
curEntryHash = randomUint8Array(10);
|
|
19290
|
+
parents = (_a = {}, _a[curEntry.id] = null, _a);
|
|
19322
19291
|
visit(curEntry);
|
|
19323
19292
|
}
|
|
19324
19293
|
// new items can be added during this loop
|
|
19325
|
-
for (var
|
|
19326
|
-
curEntry =
|
|
19294
|
+
for (var _b = 0, dynamicImports_3 = dynamicImports; _b < dynamicImports_3.length; _b++) {
|
|
19295
|
+
curEntry = dynamicImports_3[_b];
|
|
19327
19296
|
curEntry.isEntryPoint = true;
|
|
19328
19297
|
curEntryHash = randomUint8Array(10);
|
|
19298
|
+
parents = (_c = {}, _c[curEntry.id] = null, _c);
|
|
19329
19299
|
visit(curEntry);
|
|
19330
19300
|
}
|
|
19331
19301
|
return { orderedModules: ordered, dynamicImports: dynamicImports };
|
|
19302
|
+
var _a, _c;
|
|
19332
19303
|
};
|
|
19333
19304
|
Graph.prototype.warnCycle = function (id, parentId, parents) {
|
|
19334
19305
|
var path$$1 = [relativeId(id)];
|
|
@@ -19398,17 +19369,17 @@ var Graph = /** @class */ (function () {
|
|
|
19398
19369
|
_this.modules.push(module);
|
|
19399
19370
|
_this.moduleById.set(id, module);
|
|
19400
19371
|
return _this.fetchAllDependencies(module).then(function () {
|
|
19401
|
-
|
|
19372
|
+
for (var name in module.exports) {
|
|
19402
19373
|
if (name !== 'default') {
|
|
19403
19374
|
module.exportsAll[name] = module.id;
|
|
19404
19375
|
}
|
|
19405
|
-
}
|
|
19376
|
+
}
|
|
19406
19377
|
module.exportAllSources.forEach(function (source) {
|
|
19407
19378
|
var id = module.resolvedIds[source];
|
|
19408
19379
|
var exportAllModule = _this.moduleById.get(id);
|
|
19409
19380
|
if (exportAllModule.isExternal)
|
|
19410
19381
|
return;
|
|
19411
|
-
|
|
19382
|
+
for (var name in exportAllModule.exportsAll) {
|
|
19412
19383
|
if (name in module.exportsAll) {
|
|
19413
19384
|
_this.warn({
|
|
19414
19385
|
code: 'NAMESPACE_CONFLICT',
|
|
@@ -19421,7 +19392,7 @@ var Graph = /** @class */ (function () {
|
|
|
19421
19392
|
else {
|
|
19422
19393
|
module.exportsAll[name] = exportAllModule.exportsAll[name];
|
|
19423
19394
|
}
|
|
19424
|
-
}
|
|
19395
|
+
}
|
|
19425
19396
|
});
|
|
19426
19397
|
return module;
|
|
19427
19398
|
});
|
|
@@ -19496,14 +19467,14 @@ var Graph = /** @class */ (function () {
|
|
|
19496
19467
|
_this.externalModules.push(module_1);
|
|
19497
19468
|
_this.moduleById.set(externalId, module_1);
|
|
19498
19469
|
}
|
|
19499
|
-
var
|
|
19470
|
+
var externalModule = _this.moduleById.get(externalId);
|
|
19500
19471
|
// add external declarations so we can detect which are never used
|
|
19501
|
-
|
|
19472
|
+
for (var name in module.imports) {
|
|
19502
19473
|
var importDeclaration = module.imports[name];
|
|
19503
19474
|
if (importDeclaration.source !== source)
|
|
19504
19475
|
return;
|
|
19505
|
-
|
|
19506
|
-
}
|
|
19476
|
+
externalModule.traceExport(importDeclaration.name);
|
|
19477
|
+
}
|
|
19507
19478
|
}
|
|
19508
19479
|
else {
|
|
19509
19480
|
module.resolvedIds[source] = resolvedId;
|
|
@@ -19570,7 +19541,7 @@ function applyOptionHook(inputOptions, plugin) {
|
|
|
19570
19541
|
return plugin.options(inputOptions) || inputOptions;
|
|
19571
19542
|
return inputOptions;
|
|
19572
19543
|
}
|
|
19573
|
-
function getInputOptions(rawInputOptions) {
|
|
19544
|
+
function getInputOptions$1(rawInputOptions) {
|
|
19574
19545
|
if (!rawInputOptions) {
|
|
19575
19546
|
throw new Error('You must supply an options object to rollup');
|
|
19576
19547
|
}
|
|
@@ -19588,7 +19559,7 @@ function getInputOptions(rawInputOptions) {
|
|
|
19588
19559
|
}
|
|
19589
19560
|
function rollup(rawInputOptions) {
|
|
19590
19561
|
try {
|
|
19591
|
-
var inputOptions_1 = getInputOptions(rawInputOptions);
|
|
19562
|
+
var inputOptions_1 = getInputOptions$1(rawInputOptions);
|
|
19592
19563
|
initialiseTimers(inputOptions_1);
|
|
19593
19564
|
var graph_1 = new Graph(inputOptions_1);
|
|
19594
19565
|
timeStart('BUILD', 1);
|
|
@@ -22275,7 +22246,7 @@ utils.escapeRe = function escapeRe(str) {
|
|
|
22275
22246
|
module.exports = utils;
|
|
22276
22247
|
});
|
|
22277
22248
|
|
|
22278
|
-
var chars$
|
|
22249
|
+
var chars$2 = {}, unesc, temp;
|
|
22279
22250
|
|
|
22280
22251
|
function reverse(object, prepender) {
|
|
22281
22252
|
return Object.keys(object).reduce(function(reversed, key) {
|
|
@@ -22289,7 +22260,7 @@ function reverse(object, prepender) {
|
|
|
22289
22260
|
* Regex for common characters
|
|
22290
22261
|
*/
|
|
22291
22262
|
|
|
22292
|
-
chars$
|
|
22263
|
+
chars$2.escapeRegex = {
|
|
22293
22264
|
'?': /\?/g,
|
|
22294
22265
|
'@': /\@/g,
|
|
22295
22266
|
'!': /\!/g,
|
|
@@ -22305,7 +22276,7 @@ chars$1.escapeRegex = {
|
|
|
22305
22276
|
* Escape characters
|
|
22306
22277
|
*/
|
|
22307
22278
|
|
|
22308
|
-
chars$
|
|
22279
|
+
chars$2.ESC = {
|
|
22309
22280
|
'?': '__UNESC_QMRK__',
|
|
22310
22281
|
'@': '__UNESC_AMPE__',
|
|
22311
22282
|
'!': '__UNESC_EXCL__',
|
|
@@ -22322,9 +22293,9 @@ chars$1.ESC = {
|
|
|
22322
22293
|
* Unescape characters
|
|
22323
22294
|
*/
|
|
22324
22295
|
|
|
22325
|
-
chars$
|
|
22296
|
+
chars$2.UNESC = unesc || (unesc = reverse(chars$2.ESC, '\\'));
|
|
22326
22297
|
|
|
22327
|
-
chars$
|
|
22298
|
+
chars$2.ESC_TEMP = {
|
|
22328
22299
|
'?': '__TEMP_QMRK__',
|
|
22329
22300
|
'@': '__TEMP_AMPE__',
|
|
22330
22301
|
'!': '__TEMP_EXCL__',
|
|
@@ -22337,9 +22308,9 @@ chars$1.ESC_TEMP = {
|
|
|
22337
22308
|
']': '__TEMP_RTBRACK__'
|
|
22338
22309
|
};
|
|
22339
22310
|
|
|
22340
|
-
chars$
|
|
22311
|
+
chars$2.TEMP = temp || (temp = reverse(chars$2.ESC_TEMP));
|
|
22341
22312
|
|
|
22342
|
-
var chars_1 = chars$
|
|
22313
|
+
var chars_1 = chars$2;
|
|
22343
22314
|
|
|
22344
22315
|
var glob = createCommonjsModule(function (module) {
|
|
22345
22316
|
|
|
@@ -23607,7 +23578,7 @@ function watch$1(configs) {
|
|
|
23607
23578
|
return new Watcher(configs);
|
|
23608
23579
|
}
|
|
23609
23580
|
|
|
23610
|
-
var version$1 = "0.57.
|
|
23581
|
+
var version$1 = "0.57.1";
|
|
23611
23582
|
|
|
23612
23583
|
/// <reference path="../typings/package.json.d.ts" />
|
|
23613
23584
|
|