rollup 3.5.0-0 → 3.5.0
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/dist/bin/rollup +124 -4
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/rollup.js +60 -224
- package/dist/es/shared/watch.js +2 -2
- package/dist/loadConfigFile.js +2 -2
- package/dist/rollup.js +2 -2
- package/dist/shared/index.js +2 -2
- package/dist/shared/loadConfigFile.js +2 -2
- package/dist/shared/rollup.js +60 -225
- package/dist/shared/watch-cli.js +2 -2
- package/dist/shared/watch.js +2 -2
- package/package.json +3 -2
package/dist/bin/rollup
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
@license
|
|
5
|
-
Rollup.js v3.5.0
|
|
6
|
-
|
|
5
|
+
Rollup.js v3.5.0
|
|
6
|
+
Sun, 27 Nov 2022 06:34:25 GMT - commit 290b07d3685e8d4b4f3f5d3d673d41995d504239
|
|
7
7
|
|
|
8
8
|
https://github.com/rollup/rollup
|
|
9
9
|
|
|
@@ -27,7 +27,7 @@ require('node:events');
|
|
|
27
27
|
require('tty');
|
|
28
28
|
require('node:url');
|
|
29
29
|
|
|
30
|
-
const help = "rollup version __VERSION__\n=====================================\n\nUsage: rollup [options] <entry file>\n\nBasic options:\n\n-c, --config <filename> Use this config file (if argument is used but value\n is unspecified, defaults to rollup.config.js)\n-d, --dir <dirname> Directory for chunks (if absent, prints to stdout)\n-e, --external <ids> Comma-separate list of module IDs to exclude\n-f, --format <format> Type of output (amd, cjs, es, iife, umd, system)\n-g, --globals <pairs> Comma-separate list of `moduleID:Global` pairs\n-h, --help Show this help message\n-i, --input <filename> Input (alternative to <entry file>)\n-m, --sourcemap Generate sourcemap (`-m inline` for inline map)\n-n, --name <name> Name for UMD export\n-o, --file <output> Single output file (if absent, prints to stdout)\n-p, --plugin <plugin> Use the plugin specified (may be repeated)\n-v, --version Show version number\n-w, --watch Watch files in bundle and rebuild on changes\n--amd.
|
|
30
|
+
const help = "rollup version __VERSION__\n=====================================\n\nUsage: rollup [options] <entry file>\n\nBasic options:\n\n-c, --config <filename> Use this config file (if argument is used but value\n is unspecified, defaults to rollup.config.js)\n-d, --dir <dirname> Directory for chunks (if absent, prints to stdout)\n-e, --external <ids> Comma-separate list of module IDs to exclude\n-f, --format <format> Type of output (amd, cjs, es, iife, umd, system)\n-g, --globals <pairs> Comma-separate list of `moduleID:Global` pairs\n-h, --help Show this help message\n-i, --input <filename> Input (alternative to <entry file>)\n-m, --sourcemap Generate sourcemap (`-m inline` for inline map)\n-n, --name <name> Name for UMD export\n-o, --file <output> Single output file (if absent, prints to stdout)\n-p, --plugin <plugin> Use the plugin specified (may be repeated)\n-v, --version Show version number\n-w, --watch Watch files in bundle and rebuild on changes\n--amd.autoId Generate the AMD ID based off the chunk name\n--amd.basePath <prefix> Path to prepend to auto generated AMD ID\n--amd.define <name> Function to use in place of `define`\n--amd.forceJsExtensionForImports Use `.js` extension in AMD imports\n--amd.id <id> ID for AMD module (default is anonymous)\n--assetFileNames <pattern> Name pattern for emitted assets\n--banner <text> Code to insert at top of bundle (outside wrapper)\n--chunkFileNames <pattern> Name pattern for emitted secondary chunks\n--compact Minify wrapper code\n--context <variable> Specify top-level `this` value\n--no-dynamicImportInCjs Write external dynamic CommonJS imports as require\n--entryFileNames <pattern> Name pattern for emitted entry chunks\n--environment <values> Settings passed to config file (see example)\n--no-esModule Do not add __esModule property\n--exports <mode> Specify export mode (auto, default, named, none)\n--extend Extend global variable defined by --name\n--no-externalImportAssertions Omit import assertions in \"es\" output\n--no-externalLiveBindings Do not generate code to support live bindings\n--failAfterWarnings Exit with an error if the build produced warnings\n--footer <text> Code to insert at end of bundle (outside wrapper)\n--no-freeze Do not freeze namespace objects\n--generatedCode <preset> Which code features to use (es5/es2015)\n--generatedCode.arrowFunctions Use arrow functions in generated code\n--generatedCode.constBindings Use \"const\" in generated code\n--generatedCode.objectShorthand Use shorthand properties in generated code\n--no-generatedCode.reservedNamesAsProps Always quote reserved names as props\n--generatedCode.symbols Use symbols in generated code\n--no-hoistTransitiveImports Do not hoist transitive imports into entry chunks\n--no-indent Don't indent result\n--inlineDynamicImports Create single bundle when using dynamic imports\n--no-interop Do not include interop block\n--intro <text> Code to insert at top of bundle (inside wrapper)\n--no-makeAbsoluteExternalsRelative Prevent normalization of external imports\n--maxParallelFileOps <value> How many files to read in parallel\n--minifyInternalExports Force or disable minification of internal exports\n--noConflict Generate a noConflict method for UMD globals\n--outro <text> Code to insert at end of bundle (inside wrapper)\n--perf Display performance timings\n--no-preserveEntrySignatures Avoid facade chunks for entry points\n--preserveModules Preserve module structure\n--preserveModulesRoot Put preserved modules under this path at root level\n--preserveSymlinks Do not follow symlinks when resolving files\n--no-sanitizeFileName Do not replace invalid characters in file names\n--shimMissingExports Create shim variables for missing exports\n--silent Don't print warnings\n--sourcemapBaseUrl <url> Emit absolute sourcemap URLs with given base\n--sourcemapExcludeSources Do not include source code in source maps\n--sourcemapFile <file> Specify bundle position for source maps\n--stdin=ext Specify file extension used for stdin input\n--no-stdin Do not read \"-\" from stdin\n--no-strict Don't emit `\"use strict\";` in the generated modules\n--strictDeprecations Throw errors for deprecated features\n--no-systemNullSetters Do not replace empty SystemJS setters with `null`\n--no-treeshake Disable tree-shaking optimisations\n--no-treeshake.annotations Ignore pure call annotations\n--treeshake.correctVarValueBeforeDeclaration Deoptimize variables until declared\n--treeshake.manualPureFunctions <names> Manually declare functions as pure\n--no-treeshake.moduleSideEffects Assume modules have no side effects\n--no-treeshake.propertyReadSideEffects Ignore property access side effects\n--no-treeshake.tryCatchDeoptimization Do not turn off try-catch-tree-shaking\n--no-treeshake.unknownGlobalSideEffects Assume unknown globals do not throw\n--validate Validate output\n--waitForBundleInput Wait for bundle input files\n--watch.buildDelay <number> Throttle watch rebuilds\n--no-watch.clearScreen Do not clear the screen when rebuilding\n--watch.exclude <files> Exclude files from being watched\n--watch.include <files> Limit watching to specified files\n--watch.onBundleEnd <cmd> Shell command to run on `\"BUNDLE_END\"` event\n--watch.onBundleStart <cmd> Shell command to run on `\"BUNDLE_START\"` event\n--watch.onEnd <cmd> Shell command to run on `\"END\"` event\n--watch.onError <cmd> Shell command to run on `\"ERROR\"` event\n--watch.onStart <cmd> Shell command to run on `\"START\"` event\n--watch.skipWrite Do not write files to disk when watching\n\nExamples:\n\n# use settings in config file\nrollup -c\n\n# in config file, process.env.INCLUDE_DEPS === 'true'\n# and process.env.BUILD === 'production'\nrollup -c --environment INCLUDE_DEPS,BUILD:production\n\n# create CommonJS bundle.js from src/main.js\nrollup --format=cjs --file=bundle.js -- src/main.js\n\n# create self-executing IIFE using `window.jQuery`\n# and `window._` as external globals\nrollup -f iife --globals jquery:jQuery,lodash:_ \\\n -i src/app.js -o build/app.js -m build/app.js.map\n\nNotes:\n\n* When piping to stdout, only inline sourcemaps are permitted\n\nFor more information visit https://rollupjs.org\n";
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* @license
|
|
@@ -1388,10 +1388,130 @@ function prettyMilliseconds(milliseconds, options = {}) {
|
|
|
1388
1388
|
return options.colonNotation ? result.join('') : result.join(' ');
|
|
1389
1389
|
}
|
|
1390
1390
|
|
|
1391
|
+
const BYTE_UNITS = [
|
|
1392
|
+
'B',
|
|
1393
|
+
'kB',
|
|
1394
|
+
'MB',
|
|
1395
|
+
'GB',
|
|
1396
|
+
'TB',
|
|
1397
|
+
'PB',
|
|
1398
|
+
'EB',
|
|
1399
|
+
'ZB',
|
|
1400
|
+
'YB',
|
|
1401
|
+
];
|
|
1402
|
+
|
|
1403
|
+
const BIBYTE_UNITS = [
|
|
1404
|
+
'B',
|
|
1405
|
+
'kiB',
|
|
1406
|
+
'MiB',
|
|
1407
|
+
'GiB',
|
|
1408
|
+
'TiB',
|
|
1409
|
+
'PiB',
|
|
1410
|
+
'EiB',
|
|
1411
|
+
'ZiB',
|
|
1412
|
+
'YiB',
|
|
1413
|
+
];
|
|
1414
|
+
|
|
1415
|
+
const BIT_UNITS = [
|
|
1416
|
+
'b',
|
|
1417
|
+
'kbit',
|
|
1418
|
+
'Mbit',
|
|
1419
|
+
'Gbit',
|
|
1420
|
+
'Tbit',
|
|
1421
|
+
'Pbit',
|
|
1422
|
+
'Ebit',
|
|
1423
|
+
'Zbit',
|
|
1424
|
+
'Ybit',
|
|
1425
|
+
];
|
|
1426
|
+
|
|
1427
|
+
const BIBIT_UNITS = [
|
|
1428
|
+
'b',
|
|
1429
|
+
'kibit',
|
|
1430
|
+
'Mibit',
|
|
1431
|
+
'Gibit',
|
|
1432
|
+
'Tibit',
|
|
1433
|
+
'Pibit',
|
|
1434
|
+
'Eibit',
|
|
1435
|
+
'Zibit',
|
|
1436
|
+
'Yibit',
|
|
1437
|
+
];
|
|
1438
|
+
|
|
1439
|
+
/*
|
|
1440
|
+
Formats the given number using `Number#toLocaleString`.
|
|
1441
|
+
- If locale is a string, the value is expected to be a locale-key (for example: `de`).
|
|
1442
|
+
- If locale is true, the system default locale is used for translation.
|
|
1443
|
+
- If no value for locale is specified, the number is returned unmodified.
|
|
1444
|
+
*/
|
|
1445
|
+
const toLocaleString = (number, locale, options) => {
|
|
1446
|
+
let result = number;
|
|
1447
|
+
if (typeof locale === 'string' || Array.isArray(locale)) {
|
|
1448
|
+
result = number.toLocaleString(locale, options);
|
|
1449
|
+
} else if (locale === true || options !== undefined) {
|
|
1450
|
+
result = number.toLocaleString(undefined, options);
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
return result;
|
|
1454
|
+
};
|
|
1455
|
+
|
|
1456
|
+
function prettyBytes(number, options) {
|
|
1457
|
+
if (!Number.isFinite(number)) {
|
|
1458
|
+
throw new TypeError(`Expected a finite number, got ${typeof number}: ${number}`);
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1461
|
+
options = {
|
|
1462
|
+
bits: false,
|
|
1463
|
+
binary: false,
|
|
1464
|
+
...options,
|
|
1465
|
+
};
|
|
1466
|
+
|
|
1467
|
+
const UNITS = options.bits
|
|
1468
|
+
? (options.binary ? BIBIT_UNITS : BIT_UNITS)
|
|
1469
|
+
: (options.binary ? BIBYTE_UNITS : BYTE_UNITS);
|
|
1470
|
+
|
|
1471
|
+
if (options.signed && number === 0) {
|
|
1472
|
+
return ` 0 ${UNITS[0]}`;
|
|
1473
|
+
}
|
|
1474
|
+
|
|
1475
|
+
const isNegative = number < 0;
|
|
1476
|
+
const prefix = isNegative ? '-' : (options.signed ? '+' : '');
|
|
1477
|
+
|
|
1478
|
+
if (isNegative) {
|
|
1479
|
+
number = -number;
|
|
1480
|
+
}
|
|
1481
|
+
|
|
1482
|
+
let localeOptions;
|
|
1483
|
+
|
|
1484
|
+
if (options.minimumFractionDigits !== undefined) {
|
|
1485
|
+
localeOptions = {minimumFractionDigits: options.minimumFractionDigits};
|
|
1486
|
+
}
|
|
1487
|
+
|
|
1488
|
+
if (options.maximumFractionDigits !== undefined) {
|
|
1489
|
+
localeOptions = {maximumFractionDigits: options.maximumFractionDigits, ...localeOptions};
|
|
1490
|
+
}
|
|
1491
|
+
|
|
1492
|
+
if (number < 1) {
|
|
1493
|
+
const numberString = toLocaleString(number, options.locale, localeOptions);
|
|
1494
|
+
return prefix + numberString + ' ' + UNITS[0];
|
|
1495
|
+
}
|
|
1496
|
+
|
|
1497
|
+
const exponent = Math.min(Math.floor(options.binary ? Math.log(number) / Math.log(1024) : Math.log10(number) / 3), UNITS.length - 1);
|
|
1498
|
+
number /= (options.binary ? 1024 : 1000) ** exponent;
|
|
1499
|
+
|
|
1500
|
+
if (!localeOptions) {
|
|
1501
|
+
number = number.toPrecision(3);
|
|
1502
|
+
}
|
|
1503
|
+
|
|
1504
|
+
const numberString = toLocaleString(Number(number), options.locale, localeOptions);
|
|
1505
|
+
|
|
1506
|
+
const unit = UNITS[exponent];
|
|
1507
|
+
|
|
1508
|
+
return prefix + numberString + ' ' + unit;
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1391
1511
|
function printTimings(timings) {
|
|
1392
1512
|
for (const [label, [time, memory, total]] of Object.entries(timings)) {
|
|
1393
1513
|
const appliedColor = label[0] === '#' ? (label[1] !== '#' ? rollup.underline : rollup.bold) : (text) => text;
|
|
1394
|
-
const row = `${label}: ${time.toFixed(0)}ms, ${
|
|
1514
|
+
const row = `${label}: ${time.toFixed(0)}ms, ${prettyBytes(memory)} / ${prettyBytes(total)}`;
|
|
1395
1515
|
console.info(appliedColor(row));
|
|
1396
1516
|
}
|
|
1397
1517
|
}
|
package/dist/es/rollup.js
CHANGED
package/dist/es/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v3.5.0
|
|
4
|
-
|
|
3
|
+
Rollup.js v3.5.0
|
|
4
|
+
Sun, 27 Nov 2022 06:34:25 GMT - commit 290b07d3685e8d4b4f3f5d3d673d41995d504239
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -16,7 +16,7 @@ import { promises } from 'node:fs';
|
|
|
16
16
|
import { EventEmitter } from 'node:events';
|
|
17
17
|
import * as tty from 'tty';
|
|
18
18
|
|
|
19
|
-
var version$1 = "3.5.0
|
|
19
|
+
var version$1 = "3.5.0";
|
|
20
20
|
|
|
21
21
|
var charToInteger = {};
|
|
22
22
|
var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
@@ -11253,12 +11253,7 @@ class PrivateIdentifier extends NodeBase {
|
|
|
11253
11253
|
class Program extends NodeBase {
|
|
11254
11254
|
constructor() {
|
|
11255
11255
|
super(...arguments);
|
|
11256
|
-
this.hasCachedEffect =
|
|
11257
|
-
}
|
|
11258
|
-
hasCachedEffects() {
|
|
11259
|
-
return this.hasCachedEffect === null
|
|
11260
|
-
? (this.hasCachedEffect = this.hasEffects(createHasEffectsContext()))
|
|
11261
|
-
: this.hasCachedEffect;
|
|
11256
|
+
this.hasCachedEffect = false;
|
|
11262
11257
|
}
|
|
11263
11258
|
hasEffects(context) {
|
|
11264
11259
|
// We are caching here to later more efficiently identify side-effect-free modules
|
|
@@ -13101,7 +13096,8 @@ class Module {
|
|
|
13101
13096
|
return [null];
|
|
13102
13097
|
}
|
|
13103
13098
|
hasEffects() {
|
|
13104
|
-
return this.info.moduleSideEffects === 'no-treeshake' ||
|
|
13099
|
+
return (this.info.moduleSideEffects === 'no-treeshake' ||
|
|
13100
|
+
(this.ast.included && this.ast.hasEffects(createHasEffectsContext())));
|
|
13105
13101
|
}
|
|
13106
13102
|
include() {
|
|
13107
13103
|
const context = createInclusionContext();
|
|
@@ -13143,7 +13139,9 @@ class Module {
|
|
|
13143
13139
|
this.includeAllExports(false);
|
|
13144
13140
|
}
|
|
13145
13141
|
isIncluded() {
|
|
13146
|
-
|
|
13142
|
+
// Modules where this.ast is missing have been loaded via this.load and are
|
|
13143
|
+
// not yet fully processed, hence they cannot be included.
|
|
13144
|
+
return (this.ast && (this.ast.included || this.namespace.included || this.importedFromNotTreeshaken));
|
|
13147
13145
|
}
|
|
13148
13146
|
linkImports() {
|
|
13149
13147
|
this.addModulesToImportDescriptions(this.importDescriptions);
|
|
@@ -15698,132 +15696,12 @@ function getImportedBindingsPerDependency(renderedDependencies, resolveFileName)
|
|
|
15698
15696
|
const QUERY_HASH_REGEX = /[#?]/;
|
|
15699
15697
|
const resolveFileName = (dependency) => dependency.getFileName();
|
|
15700
15698
|
|
|
15701
|
-
const BYTE_UNITS = [
|
|
15702
|
-
'B',
|
|
15703
|
-
'kB',
|
|
15704
|
-
'MB',
|
|
15705
|
-
'GB',
|
|
15706
|
-
'TB',
|
|
15707
|
-
'PB',
|
|
15708
|
-
'EB',
|
|
15709
|
-
'ZB',
|
|
15710
|
-
'YB',
|
|
15711
|
-
];
|
|
15712
|
-
|
|
15713
|
-
const BIBYTE_UNITS = [
|
|
15714
|
-
'B',
|
|
15715
|
-
'kiB',
|
|
15716
|
-
'MiB',
|
|
15717
|
-
'GiB',
|
|
15718
|
-
'TiB',
|
|
15719
|
-
'PiB',
|
|
15720
|
-
'EiB',
|
|
15721
|
-
'ZiB',
|
|
15722
|
-
'YiB',
|
|
15723
|
-
];
|
|
15724
|
-
|
|
15725
|
-
const BIT_UNITS = [
|
|
15726
|
-
'b',
|
|
15727
|
-
'kbit',
|
|
15728
|
-
'Mbit',
|
|
15729
|
-
'Gbit',
|
|
15730
|
-
'Tbit',
|
|
15731
|
-
'Pbit',
|
|
15732
|
-
'Ebit',
|
|
15733
|
-
'Zbit',
|
|
15734
|
-
'Ybit',
|
|
15735
|
-
];
|
|
15736
|
-
|
|
15737
|
-
const BIBIT_UNITS = [
|
|
15738
|
-
'b',
|
|
15739
|
-
'kibit',
|
|
15740
|
-
'Mibit',
|
|
15741
|
-
'Gibit',
|
|
15742
|
-
'Tibit',
|
|
15743
|
-
'Pibit',
|
|
15744
|
-
'Eibit',
|
|
15745
|
-
'Zibit',
|
|
15746
|
-
'Yibit',
|
|
15747
|
-
];
|
|
15748
|
-
|
|
15749
|
-
/*
|
|
15750
|
-
Formats the given number using `Number#toLocaleString`.
|
|
15751
|
-
- If locale is a string, the value is expected to be a locale-key (for example: `de`).
|
|
15752
|
-
- If locale is true, the system default locale is used for translation.
|
|
15753
|
-
- If no value for locale is specified, the number is returned unmodified.
|
|
15754
|
-
*/
|
|
15755
|
-
const toLocaleString = (number, locale, options) => {
|
|
15756
|
-
let result = number;
|
|
15757
|
-
if (typeof locale === 'string' || Array.isArray(locale)) {
|
|
15758
|
-
result = number.toLocaleString(locale, options);
|
|
15759
|
-
} else if (locale === true || options !== undefined) {
|
|
15760
|
-
result = number.toLocaleString(undefined, options);
|
|
15761
|
-
}
|
|
15762
|
-
|
|
15763
|
-
return result;
|
|
15764
|
-
};
|
|
15765
|
-
|
|
15766
|
-
function prettyBytes(number, options) {
|
|
15767
|
-
if (!Number.isFinite(number)) {
|
|
15768
|
-
throw new TypeError(`Expected a finite number, got ${typeof number}: ${number}`);
|
|
15769
|
-
}
|
|
15770
|
-
|
|
15771
|
-
options = {
|
|
15772
|
-
bits: false,
|
|
15773
|
-
binary: false,
|
|
15774
|
-
...options,
|
|
15775
|
-
};
|
|
15776
|
-
|
|
15777
|
-
const UNITS = options.bits
|
|
15778
|
-
? (options.binary ? BIBIT_UNITS : BIT_UNITS)
|
|
15779
|
-
: (options.binary ? BIBYTE_UNITS : BYTE_UNITS);
|
|
15780
|
-
|
|
15781
|
-
if (options.signed && number === 0) {
|
|
15782
|
-
return ` 0 ${UNITS[0]}`;
|
|
15783
|
-
}
|
|
15784
|
-
|
|
15785
|
-
const isNegative = number < 0;
|
|
15786
|
-
const prefix = isNegative ? '-' : (options.signed ? '+' : '');
|
|
15787
|
-
|
|
15788
|
-
if (isNegative) {
|
|
15789
|
-
number = -number;
|
|
15790
|
-
}
|
|
15791
|
-
|
|
15792
|
-
let localeOptions;
|
|
15793
|
-
|
|
15794
|
-
if (options.minimumFractionDigits !== undefined) {
|
|
15795
|
-
localeOptions = {minimumFractionDigits: options.minimumFractionDigits};
|
|
15796
|
-
}
|
|
15797
|
-
|
|
15798
|
-
if (options.maximumFractionDigits !== undefined) {
|
|
15799
|
-
localeOptions = {maximumFractionDigits: options.maximumFractionDigits, ...localeOptions};
|
|
15800
|
-
}
|
|
15801
|
-
|
|
15802
|
-
if (number < 1) {
|
|
15803
|
-
const numberString = toLocaleString(number, options.locale, localeOptions);
|
|
15804
|
-
return prefix + numberString + ' ' + UNITS[0];
|
|
15805
|
-
}
|
|
15806
|
-
|
|
15807
|
-
const exponent = Math.min(Math.floor(options.binary ? Math.log(number) / Math.log(1024) : Math.log10(number) / 3), UNITS.length - 1);
|
|
15808
|
-
number /= (options.binary ? 1024 : 1000) ** exponent;
|
|
15809
|
-
|
|
15810
|
-
if (!localeOptions) {
|
|
15811
|
-
number = number.toPrecision(3);
|
|
15812
|
-
}
|
|
15813
|
-
|
|
15814
|
-
const numberString = toLocaleString(Number(number), options.locale, localeOptions);
|
|
15815
|
-
|
|
15816
|
-
const unit = UNITS[exponent];
|
|
15817
|
-
|
|
15818
|
-
return prefix + numberString + ' ' + unit;
|
|
15819
|
-
}
|
|
15820
|
-
|
|
15821
15699
|
/**
|
|
15822
15700
|
* Concatenate a number of iterables to a new iterable without fully evaluating
|
|
15823
15701
|
* their iterators. Useful when e.g. working with large sets or lists and when
|
|
15824
15702
|
* there is a chance that the iterators will not be fully exhausted.
|
|
15825
15703
|
*/
|
|
15826
|
-
function* concatLazy(iterables) {
|
|
15704
|
+
function* concatLazy(...iterables) {
|
|
15827
15705
|
for (const iterable of iterables) {
|
|
15828
15706
|
yield* iterable;
|
|
15829
15707
|
}
|
|
@@ -15949,37 +15827,43 @@ function createChunks(allEntryPoints, assignedEntryPointsByModule, minChunkSize)
|
|
|
15949
15827
|
alias: null,
|
|
15950
15828
|
modules
|
|
15951
15829
|
}))
|
|
15952
|
-
: getOptimizedChunks(chunkModulesBySignature, minChunkSize)
|
|
15953
|
-
alias: null,
|
|
15954
|
-
modules
|
|
15955
|
-
}));
|
|
15830
|
+
: getOptimizedChunks(chunkModulesBySignature, minChunkSize);
|
|
15956
15831
|
}
|
|
15957
15832
|
function getOptimizedChunks(chunkModulesBySignature, minChunkSize) {
|
|
15958
15833
|
timeStart('optimize chunks', 3);
|
|
15959
|
-
const
|
|
15960
|
-
|
|
15961
|
-
|
|
15962
|
-
|
|
15963
|
-
|
|
15964
|
-
|
|
15965
|
-
|
|
15966
|
-
|
|
15967
|
-
|
|
15968
|
-
|
|
15969
|
-
|
|
15970
|
-
|
|
15971
|
-
|
|
15972
|
-
|
|
15973
|
-
|
|
15834
|
+
const { chunksToBeMerged, unmergeableChunks } = getMergeableChunks(chunkModulesBySignature, minChunkSize);
|
|
15835
|
+
for (const sourceChunk of chunksToBeMerged) {
|
|
15836
|
+
chunksToBeMerged.delete(sourceChunk);
|
|
15837
|
+
let closestChunk = null;
|
|
15838
|
+
let closestChunkDistance = Infinity;
|
|
15839
|
+
const { signature, size, modules } = sourceChunk;
|
|
15840
|
+
for (const targetChunk of concatLazy(chunksToBeMerged, unmergeableChunks)) {
|
|
15841
|
+
const distance = getSignatureDistance(signature, targetChunk.signature, !chunksToBeMerged.has(targetChunk));
|
|
15842
|
+
if (distance === 1) {
|
|
15843
|
+
closestChunk = targetChunk;
|
|
15844
|
+
break;
|
|
15845
|
+
}
|
|
15846
|
+
else if (distance < closestChunkDistance) {
|
|
15847
|
+
closestChunk = targetChunk;
|
|
15848
|
+
closestChunkDistance = distance;
|
|
15849
|
+
}
|
|
15850
|
+
}
|
|
15851
|
+
if (closestChunk) {
|
|
15852
|
+
closestChunk.modules.push(...modules);
|
|
15853
|
+
if (chunksToBeMerged.has(closestChunk)) {
|
|
15854
|
+
closestChunk.signature = mergeSignatures(signature, closestChunk.signature);
|
|
15855
|
+
if ((closestChunk.size += size) > minChunkSize) {
|
|
15856
|
+
chunksToBeMerged.delete(closestChunk);
|
|
15857
|
+
unmergeableChunks.push(closestChunk);
|
|
15858
|
+
}
|
|
15859
|
+
}
|
|
15860
|
+
}
|
|
15861
|
+
else {
|
|
15862
|
+
unmergeableChunks.push(sourceChunk);
|
|
15863
|
+
}
|
|
15864
|
+
}
|
|
15974
15865
|
timeEnd('optimize chunks', 3);
|
|
15975
|
-
|
|
15976
|
-
...chunkPartition.small.sideEffect,
|
|
15977
|
-
...chunkPartition.small.pure,
|
|
15978
|
-
...chunkPartition.big.sideEffect,
|
|
15979
|
-
...chunkPartition.big.pure
|
|
15980
|
-
];
|
|
15981
|
-
console.log(`${result.length} chunks remaining.`);
|
|
15982
|
-
return result;
|
|
15866
|
+
return unmergeableChunks;
|
|
15983
15867
|
}
|
|
15984
15868
|
const CHAR_DEPENDENT = 'X';
|
|
15985
15869
|
const CHAR_INDEPENDENT = '_';
|
|
@@ -16001,76 +15885,28 @@ function getChunkModulesBySignature(assignedEntryPointsByModule, allEntryPoints)
|
|
|
16001
15885
|
}
|
|
16002
15886
|
return chunkModules;
|
|
16003
15887
|
}
|
|
16004
|
-
function
|
|
16005
|
-
const
|
|
16006
|
-
const
|
|
16007
|
-
const
|
|
16008
|
-
const bigSideEffectChunks = [];
|
|
15888
|
+
function getMergeableChunks(chunkModulesBySignature, minChunkSize) {
|
|
15889
|
+
const chunksToBeMerged = new Set();
|
|
15890
|
+
const unmergeableChunks = [];
|
|
15891
|
+
const alias = null;
|
|
16009
15892
|
for (const [signature, modules] of Object.entries(chunkModulesBySignature)) {
|
|
16010
15893
|
let size = 0;
|
|
16011
|
-
|
|
16012
|
-
|
|
16013
|
-
|
|
16014
|
-
|
|
16015
|
-
|
|
16016
|
-
|
|
16017
|
-
|
|
16018
|
-
|
|
16019
|
-
|
|
16020
|
-
: pure
|
|
16021
|
-
? bigPureChunks
|
|
16022
|
-
: bigSideEffectChunks).push({ modules, pure, signature, size });
|
|
16023
|
-
}
|
|
16024
|
-
for (const chunks of [
|
|
16025
|
-
bigPureChunks,
|
|
16026
|
-
bigSideEffectChunks,
|
|
16027
|
-
smallPureChunks,
|
|
16028
|
-
smallSideEffectChunks
|
|
16029
|
-
]) {
|
|
16030
|
-
chunks.sort(compareChunks);
|
|
16031
|
-
}
|
|
16032
|
-
return {
|
|
16033
|
-
big: { pure: new Set(bigPureChunks), sideEffect: new Set(bigSideEffectChunks) },
|
|
16034
|
-
small: { pure: new Set(smallPureChunks), sideEffect: new Set(smallSideEffectChunks) }
|
|
16035
|
-
};
|
|
16036
|
-
}
|
|
16037
|
-
function compareChunks({ size: sizeA }, { size: sizeB }) {
|
|
16038
|
-
return sizeA - sizeB;
|
|
16039
|
-
}
|
|
16040
|
-
function mergeChunks(chunksToBeMerged, targetChunks, minChunkSize, chunkPartition) {
|
|
16041
|
-
for (const mergedChunk of chunksToBeMerged) {
|
|
16042
|
-
let closestChunk = null;
|
|
16043
|
-
let closestChunkDistance = Infinity;
|
|
16044
|
-
const { signature, modules, pure, size } = mergedChunk;
|
|
16045
|
-
for (const targetChunk of concatLazy(targetChunks)) {
|
|
16046
|
-
if (mergedChunk === targetChunk)
|
|
16047
|
-
continue;
|
|
16048
|
-
const distance = pure
|
|
16049
|
-
? getSignatureDistance(signature, targetChunk.signature, !targetChunk.pure)
|
|
16050
|
-
: getSignatureDistance(targetChunk.signature, signature, true);
|
|
16051
|
-
if (distance === 1) {
|
|
16052
|
-
closestChunk = targetChunk;
|
|
16053
|
-
break;
|
|
16054
|
-
}
|
|
16055
|
-
else if (distance < closestChunkDistance) {
|
|
16056
|
-
closestChunk = targetChunk;
|
|
16057
|
-
closestChunkDistance = distance;
|
|
15894
|
+
checkModules: {
|
|
15895
|
+
for (const module of modules) {
|
|
15896
|
+
if (module.hasEffects()) {
|
|
15897
|
+
break checkModules;
|
|
15898
|
+
}
|
|
15899
|
+
size += module.magicString.toString().length;
|
|
15900
|
+
if (size > minChunkSize) {
|
|
15901
|
+
break checkModules;
|
|
15902
|
+
}
|
|
16058
15903
|
}
|
|
15904
|
+
chunksToBeMerged.add({ alias, modules, signature, size });
|
|
15905
|
+
continue;
|
|
16059
15906
|
}
|
|
16060
|
-
|
|
16061
|
-
chunksToBeMerged.delete(mergedChunk);
|
|
16062
|
-
getChunksInPartition(closestChunk, minChunkSize, chunkPartition).delete(closestChunk);
|
|
16063
|
-
closestChunk.modules.push(...modules);
|
|
16064
|
-
closestChunk.size += size;
|
|
16065
|
-
closestChunk.pure && (closestChunk.pure = pure);
|
|
16066
|
-
closestChunk.signature = mergeSignatures(signature, closestChunk.signature);
|
|
16067
|
-
getChunksInPartition(closestChunk, minChunkSize, chunkPartition).add(closestChunk);
|
|
16068
|
-
}
|
|
15907
|
+
unmergeableChunks.push({ alias, modules, signature, size: null });
|
|
16069
15908
|
}
|
|
16070
|
-
}
|
|
16071
|
-
function getChunksInPartition(chunk, minChunkSize, chunkPartition) {
|
|
16072
|
-
const subPartition = chunk.size < minChunkSize ? chunkPartition.small : chunkPartition.big;
|
|
16073
|
-
return chunk.pure ? subPartition.pure : subPartition.sideEffect;
|
|
15909
|
+
return { chunksToBeMerged, unmergeableChunks };
|
|
16074
15910
|
}
|
|
16075
15911
|
function getSignatureDistance(sourceSignature, targetSignature, enforceSubset) {
|
|
16076
15912
|
let distance = 0;
|
package/dist/es/shared/watch.js
CHANGED
package/dist/loadConfigFile.js
CHANGED
package/dist/rollup.js
CHANGED
package/dist/shared/index.js
CHANGED
package/dist/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v3.5.0
|
|
4
|
-
|
|
3
|
+
Rollup.js v3.5.0
|
|
4
|
+
Sun, 27 Nov 2022 06:34:25 GMT - commit 290b07d3685e8d4b4f3f5d3d673d41995d504239
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -31,7 +31,7 @@ function _interopNamespaceDefault(e) {
|
|
|
31
31
|
|
|
32
32
|
const tty__namespace = /*#__PURE__*/_interopNamespaceDefault(tty);
|
|
33
33
|
|
|
34
|
-
var version$1 = "3.5.0
|
|
34
|
+
var version$1 = "3.5.0";
|
|
35
35
|
|
|
36
36
|
function ensureArray$1(items) {
|
|
37
37
|
if (Array.isArray(items)) {
|
|
@@ -11768,12 +11768,7 @@ class PrivateIdentifier extends NodeBase {
|
|
|
11768
11768
|
class Program extends NodeBase {
|
|
11769
11769
|
constructor() {
|
|
11770
11770
|
super(...arguments);
|
|
11771
|
-
this.hasCachedEffect =
|
|
11772
|
-
}
|
|
11773
|
-
hasCachedEffects() {
|
|
11774
|
-
return this.hasCachedEffect === null
|
|
11775
|
-
? (this.hasCachedEffect = this.hasEffects(createHasEffectsContext()))
|
|
11776
|
-
: this.hasCachedEffect;
|
|
11771
|
+
this.hasCachedEffect = false;
|
|
11777
11772
|
}
|
|
11778
11773
|
hasEffects(context) {
|
|
11779
11774
|
// We are caching here to later more efficiently identify side-effect-free modules
|
|
@@ -13616,7 +13611,8 @@ class Module {
|
|
|
13616
13611
|
return [null];
|
|
13617
13612
|
}
|
|
13618
13613
|
hasEffects() {
|
|
13619
|
-
return this.info.moduleSideEffects === 'no-treeshake' ||
|
|
13614
|
+
return (this.info.moduleSideEffects === 'no-treeshake' ||
|
|
13615
|
+
(this.ast.included && this.ast.hasEffects(createHasEffectsContext())));
|
|
13620
13616
|
}
|
|
13621
13617
|
include() {
|
|
13622
13618
|
const context = createInclusionContext();
|
|
@@ -13658,7 +13654,9 @@ class Module {
|
|
|
13658
13654
|
this.includeAllExports(false);
|
|
13659
13655
|
}
|
|
13660
13656
|
isIncluded() {
|
|
13661
|
-
|
|
13657
|
+
// Modules where this.ast is missing have been loaded via this.load and are
|
|
13658
|
+
// not yet fully processed, hence they cannot be included.
|
|
13659
|
+
return (this.ast && (this.ast.included || this.namespace.included || this.importedFromNotTreeshaken));
|
|
13662
13660
|
}
|
|
13663
13661
|
linkImports() {
|
|
13664
13662
|
this.addModulesToImportDescriptions(this.importDescriptions);
|
|
@@ -16213,132 +16211,12 @@ function getImportedBindingsPerDependency(renderedDependencies, resolveFileName)
|
|
|
16213
16211
|
const QUERY_HASH_REGEX = /[#?]/;
|
|
16214
16212
|
const resolveFileName = (dependency) => dependency.getFileName();
|
|
16215
16213
|
|
|
16216
|
-
const BYTE_UNITS = [
|
|
16217
|
-
'B',
|
|
16218
|
-
'kB',
|
|
16219
|
-
'MB',
|
|
16220
|
-
'GB',
|
|
16221
|
-
'TB',
|
|
16222
|
-
'PB',
|
|
16223
|
-
'EB',
|
|
16224
|
-
'ZB',
|
|
16225
|
-
'YB',
|
|
16226
|
-
];
|
|
16227
|
-
|
|
16228
|
-
const BIBYTE_UNITS = [
|
|
16229
|
-
'B',
|
|
16230
|
-
'kiB',
|
|
16231
|
-
'MiB',
|
|
16232
|
-
'GiB',
|
|
16233
|
-
'TiB',
|
|
16234
|
-
'PiB',
|
|
16235
|
-
'EiB',
|
|
16236
|
-
'ZiB',
|
|
16237
|
-
'YiB',
|
|
16238
|
-
];
|
|
16239
|
-
|
|
16240
|
-
const BIT_UNITS = [
|
|
16241
|
-
'b',
|
|
16242
|
-
'kbit',
|
|
16243
|
-
'Mbit',
|
|
16244
|
-
'Gbit',
|
|
16245
|
-
'Tbit',
|
|
16246
|
-
'Pbit',
|
|
16247
|
-
'Ebit',
|
|
16248
|
-
'Zbit',
|
|
16249
|
-
'Ybit',
|
|
16250
|
-
];
|
|
16251
|
-
|
|
16252
|
-
const BIBIT_UNITS = [
|
|
16253
|
-
'b',
|
|
16254
|
-
'kibit',
|
|
16255
|
-
'Mibit',
|
|
16256
|
-
'Gibit',
|
|
16257
|
-
'Tibit',
|
|
16258
|
-
'Pibit',
|
|
16259
|
-
'Eibit',
|
|
16260
|
-
'Zibit',
|
|
16261
|
-
'Yibit',
|
|
16262
|
-
];
|
|
16263
|
-
|
|
16264
|
-
/*
|
|
16265
|
-
Formats the given number using `Number#toLocaleString`.
|
|
16266
|
-
- If locale is a string, the value is expected to be a locale-key (for example: `de`).
|
|
16267
|
-
- If locale is true, the system default locale is used for translation.
|
|
16268
|
-
- If no value for locale is specified, the number is returned unmodified.
|
|
16269
|
-
*/
|
|
16270
|
-
const toLocaleString = (number, locale, options) => {
|
|
16271
|
-
let result = number;
|
|
16272
|
-
if (typeof locale === 'string' || Array.isArray(locale)) {
|
|
16273
|
-
result = number.toLocaleString(locale, options);
|
|
16274
|
-
} else if (locale === true || options !== undefined) {
|
|
16275
|
-
result = number.toLocaleString(undefined, options);
|
|
16276
|
-
}
|
|
16277
|
-
|
|
16278
|
-
return result;
|
|
16279
|
-
};
|
|
16280
|
-
|
|
16281
|
-
function prettyBytes(number, options) {
|
|
16282
|
-
if (!Number.isFinite(number)) {
|
|
16283
|
-
throw new TypeError(`Expected a finite number, got ${typeof number}: ${number}`);
|
|
16284
|
-
}
|
|
16285
|
-
|
|
16286
|
-
options = {
|
|
16287
|
-
bits: false,
|
|
16288
|
-
binary: false,
|
|
16289
|
-
...options,
|
|
16290
|
-
};
|
|
16291
|
-
|
|
16292
|
-
const UNITS = options.bits
|
|
16293
|
-
? (options.binary ? BIBIT_UNITS : BIT_UNITS)
|
|
16294
|
-
: (options.binary ? BIBYTE_UNITS : BYTE_UNITS);
|
|
16295
|
-
|
|
16296
|
-
if (options.signed && number === 0) {
|
|
16297
|
-
return ` 0 ${UNITS[0]}`;
|
|
16298
|
-
}
|
|
16299
|
-
|
|
16300
|
-
const isNegative = number < 0;
|
|
16301
|
-
const prefix = isNegative ? '-' : (options.signed ? '+' : '');
|
|
16302
|
-
|
|
16303
|
-
if (isNegative) {
|
|
16304
|
-
number = -number;
|
|
16305
|
-
}
|
|
16306
|
-
|
|
16307
|
-
let localeOptions;
|
|
16308
|
-
|
|
16309
|
-
if (options.minimumFractionDigits !== undefined) {
|
|
16310
|
-
localeOptions = {minimumFractionDigits: options.minimumFractionDigits};
|
|
16311
|
-
}
|
|
16312
|
-
|
|
16313
|
-
if (options.maximumFractionDigits !== undefined) {
|
|
16314
|
-
localeOptions = {maximumFractionDigits: options.maximumFractionDigits, ...localeOptions};
|
|
16315
|
-
}
|
|
16316
|
-
|
|
16317
|
-
if (number < 1) {
|
|
16318
|
-
const numberString = toLocaleString(number, options.locale, localeOptions);
|
|
16319
|
-
return prefix + numberString + ' ' + UNITS[0];
|
|
16320
|
-
}
|
|
16321
|
-
|
|
16322
|
-
const exponent = Math.min(Math.floor(options.binary ? Math.log(number) / Math.log(1024) : Math.log10(number) / 3), UNITS.length - 1);
|
|
16323
|
-
number /= (options.binary ? 1024 : 1000) ** exponent;
|
|
16324
|
-
|
|
16325
|
-
if (!localeOptions) {
|
|
16326
|
-
number = number.toPrecision(3);
|
|
16327
|
-
}
|
|
16328
|
-
|
|
16329
|
-
const numberString = toLocaleString(Number(number), options.locale, localeOptions);
|
|
16330
|
-
|
|
16331
|
-
const unit = UNITS[exponent];
|
|
16332
|
-
|
|
16333
|
-
return prefix + numberString + ' ' + unit;
|
|
16334
|
-
}
|
|
16335
|
-
|
|
16336
16214
|
/**
|
|
16337
16215
|
* Concatenate a number of iterables to a new iterable without fully evaluating
|
|
16338
16216
|
* their iterators. Useful when e.g. working with large sets or lists and when
|
|
16339
16217
|
* there is a chance that the iterators will not be fully exhausted.
|
|
16340
16218
|
*/
|
|
16341
|
-
function* concatLazy(iterables) {
|
|
16219
|
+
function* concatLazy(...iterables) {
|
|
16342
16220
|
for (const iterable of iterables) {
|
|
16343
16221
|
yield* iterable;
|
|
16344
16222
|
}
|
|
@@ -16464,37 +16342,43 @@ function createChunks(allEntryPoints, assignedEntryPointsByModule, minChunkSize)
|
|
|
16464
16342
|
alias: null,
|
|
16465
16343
|
modules
|
|
16466
16344
|
}))
|
|
16467
|
-
: getOptimizedChunks(chunkModulesBySignature, minChunkSize)
|
|
16468
|
-
alias: null,
|
|
16469
|
-
modules
|
|
16470
|
-
}));
|
|
16345
|
+
: getOptimizedChunks(chunkModulesBySignature, minChunkSize);
|
|
16471
16346
|
}
|
|
16472
16347
|
function getOptimizedChunks(chunkModulesBySignature, minChunkSize) {
|
|
16473
16348
|
timeStart('optimize chunks', 3);
|
|
16474
|
-
const
|
|
16475
|
-
|
|
16476
|
-
|
|
16477
|
-
|
|
16478
|
-
|
|
16479
|
-
|
|
16480
|
-
|
|
16481
|
-
|
|
16482
|
-
|
|
16483
|
-
|
|
16484
|
-
|
|
16485
|
-
|
|
16486
|
-
|
|
16487
|
-
|
|
16488
|
-
|
|
16349
|
+
const { chunksToBeMerged, unmergeableChunks } = getMergeableChunks(chunkModulesBySignature, minChunkSize);
|
|
16350
|
+
for (const sourceChunk of chunksToBeMerged) {
|
|
16351
|
+
chunksToBeMerged.delete(sourceChunk);
|
|
16352
|
+
let closestChunk = null;
|
|
16353
|
+
let closestChunkDistance = Infinity;
|
|
16354
|
+
const { signature, size, modules } = sourceChunk;
|
|
16355
|
+
for (const targetChunk of concatLazy(chunksToBeMerged, unmergeableChunks)) {
|
|
16356
|
+
const distance = getSignatureDistance(signature, targetChunk.signature, !chunksToBeMerged.has(targetChunk));
|
|
16357
|
+
if (distance === 1) {
|
|
16358
|
+
closestChunk = targetChunk;
|
|
16359
|
+
break;
|
|
16360
|
+
}
|
|
16361
|
+
else if (distance < closestChunkDistance) {
|
|
16362
|
+
closestChunk = targetChunk;
|
|
16363
|
+
closestChunkDistance = distance;
|
|
16364
|
+
}
|
|
16365
|
+
}
|
|
16366
|
+
if (closestChunk) {
|
|
16367
|
+
closestChunk.modules.push(...modules);
|
|
16368
|
+
if (chunksToBeMerged.has(closestChunk)) {
|
|
16369
|
+
closestChunk.signature = mergeSignatures(signature, closestChunk.signature);
|
|
16370
|
+
if ((closestChunk.size += size) > minChunkSize) {
|
|
16371
|
+
chunksToBeMerged.delete(closestChunk);
|
|
16372
|
+
unmergeableChunks.push(closestChunk);
|
|
16373
|
+
}
|
|
16374
|
+
}
|
|
16375
|
+
}
|
|
16376
|
+
else {
|
|
16377
|
+
unmergeableChunks.push(sourceChunk);
|
|
16378
|
+
}
|
|
16379
|
+
}
|
|
16489
16380
|
timeEnd('optimize chunks', 3);
|
|
16490
|
-
|
|
16491
|
-
...chunkPartition.small.sideEffect,
|
|
16492
|
-
...chunkPartition.small.pure,
|
|
16493
|
-
...chunkPartition.big.sideEffect,
|
|
16494
|
-
...chunkPartition.big.pure
|
|
16495
|
-
];
|
|
16496
|
-
console.log(`${result.length} chunks remaining.`);
|
|
16497
|
-
return result;
|
|
16381
|
+
return unmergeableChunks;
|
|
16498
16382
|
}
|
|
16499
16383
|
const CHAR_DEPENDENT = 'X';
|
|
16500
16384
|
const CHAR_INDEPENDENT = '_';
|
|
@@ -16516,76 +16400,28 @@ function getChunkModulesBySignature(assignedEntryPointsByModule, allEntryPoints)
|
|
|
16516
16400
|
}
|
|
16517
16401
|
return chunkModules;
|
|
16518
16402
|
}
|
|
16519
|
-
function
|
|
16520
|
-
const
|
|
16521
|
-
const
|
|
16522
|
-
const
|
|
16523
|
-
const bigSideEffectChunks = [];
|
|
16403
|
+
function getMergeableChunks(chunkModulesBySignature, minChunkSize) {
|
|
16404
|
+
const chunksToBeMerged = new Set();
|
|
16405
|
+
const unmergeableChunks = [];
|
|
16406
|
+
const alias = null;
|
|
16524
16407
|
for (const [signature, modules] of Object.entries(chunkModulesBySignature)) {
|
|
16525
16408
|
let size = 0;
|
|
16526
|
-
|
|
16527
|
-
|
|
16528
|
-
|
|
16529
|
-
|
|
16530
|
-
|
|
16531
|
-
|
|
16532
|
-
|
|
16533
|
-
|
|
16534
|
-
|
|
16535
|
-
: pure
|
|
16536
|
-
? bigPureChunks
|
|
16537
|
-
: bigSideEffectChunks).push({ modules, pure, signature, size });
|
|
16538
|
-
}
|
|
16539
|
-
for (const chunks of [
|
|
16540
|
-
bigPureChunks,
|
|
16541
|
-
bigSideEffectChunks,
|
|
16542
|
-
smallPureChunks,
|
|
16543
|
-
smallSideEffectChunks
|
|
16544
|
-
]) {
|
|
16545
|
-
chunks.sort(compareChunks);
|
|
16546
|
-
}
|
|
16547
|
-
return {
|
|
16548
|
-
big: { pure: new Set(bigPureChunks), sideEffect: new Set(bigSideEffectChunks) },
|
|
16549
|
-
small: { pure: new Set(smallPureChunks), sideEffect: new Set(smallSideEffectChunks) }
|
|
16550
|
-
};
|
|
16551
|
-
}
|
|
16552
|
-
function compareChunks({ size: sizeA }, { size: sizeB }) {
|
|
16553
|
-
return sizeA - sizeB;
|
|
16554
|
-
}
|
|
16555
|
-
function mergeChunks(chunksToBeMerged, targetChunks, minChunkSize, chunkPartition) {
|
|
16556
|
-
for (const mergedChunk of chunksToBeMerged) {
|
|
16557
|
-
let closestChunk = null;
|
|
16558
|
-
let closestChunkDistance = Infinity;
|
|
16559
|
-
const { signature, modules, pure, size } = mergedChunk;
|
|
16560
|
-
for (const targetChunk of concatLazy(targetChunks)) {
|
|
16561
|
-
if (mergedChunk === targetChunk)
|
|
16562
|
-
continue;
|
|
16563
|
-
const distance = pure
|
|
16564
|
-
? getSignatureDistance(signature, targetChunk.signature, !targetChunk.pure)
|
|
16565
|
-
: getSignatureDistance(targetChunk.signature, signature, true);
|
|
16566
|
-
if (distance === 1) {
|
|
16567
|
-
closestChunk = targetChunk;
|
|
16568
|
-
break;
|
|
16569
|
-
}
|
|
16570
|
-
else if (distance < closestChunkDistance) {
|
|
16571
|
-
closestChunk = targetChunk;
|
|
16572
|
-
closestChunkDistance = distance;
|
|
16409
|
+
checkModules: {
|
|
16410
|
+
for (const module of modules) {
|
|
16411
|
+
if (module.hasEffects()) {
|
|
16412
|
+
break checkModules;
|
|
16413
|
+
}
|
|
16414
|
+
size += module.magicString.toString().length;
|
|
16415
|
+
if (size > minChunkSize) {
|
|
16416
|
+
break checkModules;
|
|
16417
|
+
}
|
|
16573
16418
|
}
|
|
16419
|
+
chunksToBeMerged.add({ alias, modules, signature, size });
|
|
16420
|
+
continue;
|
|
16574
16421
|
}
|
|
16575
|
-
|
|
16576
|
-
chunksToBeMerged.delete(mergedChunk);
|
|
16577
|
-
getChunksInPartition(closestChunk, minChunkSize, chunkPartition).delete(closestChunk);
|
|
16578
|
-
closestChunk.modules.push(...modules);
|
|
16579
|
-
closestChunk.size += size;
|
|
16580
|
-
closestChunk.pure && (closestChunk.pure = pure);
|
|
16581
|
-
closestChunk.signature = mergeSignatures(signature, closestChunk.signature);
|
|
16582
|
-
getChunksInPartition(closestChunk, minChunkSize, chunkPartition).add(closestChunk);
|
|
16583
|
-
}
|
|
16422
|
+
unmergeableChunks.push({ alias, modules, signature, size: null });
|
|
16584
16423
|
}
|
|
16585
|
-
}
|
|
16586
|
-
function getChunksInPartition(chunk, minChunkSize, chunkPartition) {
|
|
16587
|
-
const subPartition = chunk.size < minChunkSize ? chunkPartition.small : chunkPartition.big;
|
|
16588
|
-
return chunk.pure ? subPartition.pure : subPartition.sideEffect;
|
|
16424
|
+
return { chunksToBeMerged, unmergeableChunks };
|
|
16589
16425
|
}
|
|
16590
16426
|
function getSignatureDistance(sourceSignature, targetSignature, enforceSubset) {
|
|
16591
16427
|
let distance = 0;
|
|
@@ -25419,7 +25255,6 @@ exports.loadFsEvents = loadFsEvents;
|
|
|
25419
25255
|
exports.mergeOptions = mergeOptions;
|
|
25420
25256
|
exports.normalizePluginOption = normalizePluginOption;
|
|
25421
25257
|
exports.picomatch = picomatch$1;
|
|
25422
|
-
exports.prettyBytes = prettyBytes;
|
|
25423
25258
|
exports.printQuotedStringList = printQuotedStringList;
|
|
25424
25259
|
exports.relativeId = relativeId;
|
|
25425
25260
|
exports.rollup = rollup;
|
package/dist/shared/watch-cli.js
CHANGED
package/dist/shared/watch.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rollup",
|
|
3
|
-
"version": "3.5.0
|
|
3
|
+
"version": "3.5.0",
|
|
4
4
|
"description": "Next-generation ES module bundler",
|
|
5
5
|
"main": "dist/rollup.js",
|
|
6
6
|
"module": "dist/es/rollup.js",
|
|
@@ -29,11 +29,12 @@
|
|
|
29
29
|
"test": "npm run build && npm run test:all",
|
|
30
30
|
"test:cjs": "npm run build:cjs && npm run test:only",
|
|
31
31
|
"test:quick": "mocha -b test/test.js",
|
|
32
|
-
"test:all": "concurrently --kill-others-on-fail -c green,blue,magenta,cyan,red 'npm:test:only' 'npm:test:browser' 'npm:test:typescript' 'npm:test:leak' 'npm:test:package'",
|
|
32
|
+
"test:all": "concurrently --kill-others-on-fail -c green,blue,magenta,cyan,red 'npm:test:only' 'npm:test:browser' 'npm:test:typescript' 'npm:test:leak' 'npm:test:package' 'npm:test:options'",
|
|
33
33
|
"test:coverage": "npm run build:cjs && shx rm -rf coverage/* && nyc --reporter html mocha test/test.js",
|
|
34
34
|
"test:coverage:browser": "npm run build && shx rm -rf coverage/* && nyc mocha test/browser/index.js",
|
|
35
35
|
"test:leak": "node --expose-gc test/leak/index.js",
|
|
36
36
|
"test:package": "node scripts/test-package.js",
|
|
37
|
+
"test:options": "node scripts/test-options.js",
|
|
37
38
|
"test:only": "mocha test/test.js",
|
|
38
39
|
"test:typescript": "shx rm -rf test/typescript/dist && shx cp -r dist test/typescript/ && tsc --noEmit -p test/typescript && tsc --noEmit",
|
|
39
40
|
"test:browser": "mocha test/browser/index.js",
|