rollup 3.5.0 → 3.6.0-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 +3 -123
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/rollup.js +235 -57
- 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 +236 -57
- package/dist/shared/watch-cli.js +2 -2
- package/dist/shared/watch.js +2 -2
- package/package.json +1 -1
package/dist/bin/rollup
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
@license
|
|
5
|
-
Rollup.js v3.
|
|
6
|
-
Sun, 27 Nov 2022 06:
|
|
5
|
+
Rollup.js v3.6.0-0
|
|
6
|
+
Sun, 27 Nov 2022 06:53:45 GMT - commit 03fdcc007bd49a4c88579d93053248ebe03dcef9
|
|
7
7
|
|
|
8
8
|
https://github.com/rollup/rollup
|
|
9
9
|
|
|
@@ -1388,130 +1388,10 @@ 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
|
-
|
|
1511
1391
|
function printTimings(timings) {
|
|
1512
1392
|
for (const [label, [time, memory, total]] of Object.entries(timings)) {
|
|
1513
1393
|
const appliedColor = label[0] === '#' ? (label[1] !== '#' ? rollup.underline : rollup.bold) : (text) => text;
|
|
1514
|
-
const row = `${label}: ${time.toFixed(0)}ms, ${prettyBytes(memory)} / ${prettyBytes(total)}`;
|
|
1394
|
+
const row = `${label}: ${time.toFixed(0)}ms, ${rollup.prettyBytes(memory)} / ${rollup.prettyBytes(total)}`;
|
|
1515
1395
|
console.info(appliedColor(row));
|
|
1516
1396
|
}
|
|
1517
1397
|
}
|
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.
|
|
4
|
-
Sun, 27 Nov 2022 06:
|
|
3
|
+
Rollup.js v3.6.0-0
|
|
4
|
+
Sun, 27 Nov 2022 06:53:45 GMT - commit 03fdcc007bd49a4c88579d93053248ebe03dcef9
|
|
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.
|
|
19
|
+
var version$1 = "3.6.0-0";
|
|
20
20
|
|
|
21
21
|
var charToInteger = {};
|
|
22
22
|
var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
@@ -11253,7 +11253,12 @@ class PrivateIdentifier extends NodeBase {
|
|
|
11253
11253
|
class Program extends NodeBase {
|
|
11254
11254
|
constructor() {
|
|
11255
11255
|
super(...arguments);
|
|
11256
|
-
this.hasCachedEffect =
|
|
11256
|
+
this.hasCachedEffect = null;
|
|
11257
|
+
}
|
|
11258
|
+
hasCachedEffects() {
|
|
11259
|
+
return this.hasCachedEffect === null
|
|
11260
|
+
? (this.hasCachedEffect = this.hasEffects(createHasEffectsContext()))
|
|
11261
|
+
: this.hasCachedEffect;
|
|
11257
11262
|
}
|
|
11258
11263
|
hasEffects(context) {
|
|
11259
11264
|
// We are caching here to later more efficiently identify side-effect-free modules
|
|
@@ -13096,8 +13101,7 @@ class Module {
|
|
|
13096
13101
|
return [null];
|
|
13097
13102
|
}
|
|
13098
13103
|
hasEffects() {
|
|
13099
|
-
return
|
|
13100
|
-
(this.ast.included && this.ast.hasEffects(createHasEffectsContext())));
|
|
13104
|
+
return this.info.moduleSideEffects === 'no-treeshake' || this.ast.hasCachedEffects();
|
|
13101
13105
|
}
|
|
13102
13106
|
include() {
|
|
13103
13107
|
const context = createInclusionContext();
|
|
@@ -15696,12 +15700,132 @@ function getImportedBindingsPerDependency(renderedDependencies, resolveFileName)
|
|
|
15696
15700
|
const QUERY_HASH_REGEX = /[#?]/;
|
|
15697
15701
|
const resolveFileName = (dependency) => dependency.getFileName();
|
|
15698
15702
|
|
|
15703
|
+
const BYTE_UNITS = [
|
|
15704
|
+
'B',
|
|
15705
|
+
'kB',
|
|
15706
|
+
'MB',
|
|
15707
|
+
'GB',
|
|
15708
|
+
'TB',
|
|
15709
|
+
'PB',
|
|
15710
|
+
'EB',
|
|
15711
|
+
'ZB',
|
|
15712
|
+
'YB',
|
|
15713
|
+
];
|
|
15714
|
+
|
|
15715
|
+
const BIBYTE_UNITS = [
|
|
15716
|
+
'B',
|
|
15717
|
+
'kiB',
|
|
15718
|
+
'MiB',
|
|
15719
|
+
'GiB',
|
|
15720
|
+
'TiB',
|
|
15721
|
+
'PiB',
|
|
15722
|
+
'EiB',
|
|
15723
|
+
'ZiB',
|
|
15724
|
+
'YiB',
|
|
15725
|
+
];
|
|
15726
|
+
|
|
15727
|
+
const BIT_UNITS = [
|
|
15728
|
+
'b',
|
|
15729
|
+
'kbit',
|
|
15730
|
+
'Mbit',
|
|
15731
|
+
'Gbit',
|
|
15732
|
+
'Tbit',
|
|
15733
|
+
'Pbit',
|
|
15734
|
+
'Ebit',
|
|
15735
|
+
'Zbit',
|
|
15736
|
+
'Ybit',
|
|
15737
|
+
];
|
|
15738
|
+
|
|
15739
|
+
const BIBIT_UNITS = [
|
|
15740
|
+
'b',
|
|
15741
|
+
'kibit',
|
|
15742
|
+
'Mibit',
|
|
15743
|
+
'Gibit',
|
|
15744
|
+
'Tibit',
|
|
15745
|
+
'Pibit',
|
|
15746
|
+
'Eibit',
|
|
15747
|
+
'Zibit',
|
|
15748
|
+
'Yibit',
|
|
15749
|
+
];
|
|
15750
|
+
|
|
15751
|
+
/*
|
|
15752
|
+
Formats the given number using `Number#toLocaleString`.
|
|
15753
|
+
- If locale is a string, the value is expected to be a locale-key (for example: `de`).
|
|
15754
|
+
- If locale is true, the system default locale is used for translation.
|
|
15755
|
+
- If no value for locale is specified, the number is returned unmodified.
|
|
15756
|
+
*/
|
|
15757
|
+
const toLocaleString = (number, locale, options) => {
|
|
15758
|
+
let result = number;
|
|
15759
|
+
if (typeof locale === 'string' || Array.isArray(locale)) {
|
|
15760
|
+
result = number.toLocaleString(locale, options);
|
|
15761
|
+
} else if (locale === true || options !== undefined) {
|
|
15762
|
+
result = number.toLocaleString(undefined, options);
|
|
15763
|
+
}
|
|
15764
|
+
|
|
15765
|
+
return result;
|
|
15766
|
+
};
|
|
15767
|
+
|
|
15768
|
+
function prettyBytes(number, options) {
|
|
15769
|
+
if (!Number.isFinite(number)) {
|
|
15770
|
+
throw new TypeError(`Expected a finite number, got ${typeof number}: ${number}`);
|
|
15771
|
+
}
|
|
15772
|
+
|
|
15773
|
+
options = {
|
|
15774
|
+
bits: false,
|
|
15775
|
+
binary: false,
|
|
15776
|
+
...options,
|
|
15777
|
+
};
|
|
15778
|
+
|
|
15779
|
+
const UNITS = options.bits
|
|
15780
|
+
? (options.binary ? BIBIT_UNITS : BIT_UNITS)
|
|
15781
|
+
: (options.binary ? BIBYTE_UNITS : BYTE_UNITS);
|
|
15782
|
+
|
|
15783
|
+
if (options.signed && number === 0) {
|
|
15784
|
+
return ` 0 ${UNITS[0]}`;
|
|
15785
|
+
}
|
|
15786
|
+
|
|
15787
|
+
const isNegative = number < 0;
|
|
15788
|
+
const prefix = isNegative ? '-' : (options.signed ? '+' : '');
|
|
15789
|
+
|
|
15790
|
+
if (isNegative) {
|
|
15791
|
+
number = -number;
|
|
15792
|
+
}
|
|
15793
|
+
|
|
15794
|
+
let localeOptions;
|
|
15795
|
+
|
|
15796
|
+
if (options.minimumFractionDigits !== undefined) {
|
|
15797
|
+
localeOptions = {minimumFractionDigits: options.minimumFractionDigits};
|
|
15798
|
+
}
|
|
15799
|
+
|
|
15800
|
+
if (options.maximumFractionDigits !== undefined) {
|
|
15801
|
+
localeOptions = {maximumFractionDigits: options.maximumFractionDigits, ...localeOptions};
|
|
15802
|
+
}
|
|
15803
|
+
|
|
15804
|
+
if (number < 1) {
|
|
15805
|
+
const numberString = toLocaleString(number, options.locale, localeOptions);
|
|
15806
|
+
return prefix + numberString + ' ' + UNITS[0];
|
|
15807
|
+
}
|
|
15808
|
+
|
|
15809
|
+
const exponent = Math.min(Math.floor(options.binary ? Math.log(number) / Math.log(1024) : Math.log10(number) / 3), UNITS.length - 1);
|
|
15810
|
+
number /= (options.binary ? 1024 : 1000) ** exponent;
|
|
15811
|
+
|
|
15812
|
+
if (!localeOptions) {
|
|
15813
|
+
number = number.toPrecision(3);
|
|
15814
|
+
}
|
|
15815
|
+
|
|
15816
|
+
const numberString = toLocaleString(Number(number), options.locale, localeOptions);
|
|
15817
|
+
|
|
15818
|
+
const unit = UNITS[exponent];
|
|
15819
|
+
|
|
15820
|
+
return prefix + numberString + ' ' + unit;
|
|
15821
|
+
}
|
|
15822
|
+
|
|
15699
15823
|
/**
|
|
15700
15824
|
* Concatenate a number of iterables to a new iterable without fully evaluating
|
|
15701
15825
|
* their iterators. Useful when e.g. working with large sets or lists and when
|
|
15702
15826
|
* there is a chance that the iterators will not be fully exhausted.
|
|
15703
15827
|
*/
|
|
15704
|
-
function* concatLazy(
|
|
15828
|
+
function* concatLazy(iterables) {
|
|
15705
15829
|
for (const iterable of iterables) {
|
|
15706
15830
|
yield* iterable;
|
|
15707
15831
|
}
|
|
@@ -15827,43 +15951,49 @@ function createChunks(allEntryPoints, assignedEntryPointsByModule, minChunkSize)
|
|
|
15827
15951
|
alias: null,
|
|
15828
15952
|
modules
|
|
15829
15953
|
}))
|
|
15830
|
-
: getOptimizedChunks(chunkModulesBySignature, minChunkSize)
|
|
15954
|
+
: getOptimizedChunks(chunkModulesBySignature, minChunkSize).map(({ modules }) => ({
|
|
15955
|
+
alias: null,
|
|
15956
|
+
modules
|
|
15957
|
+
}));
|
|
15831
15958
|
}
|
|
15959
|
+
/**
|
|
15960
|
+
* This function tries to get rid of small chunks by merging them with other
|
|
15961
|
+
* chunks. In order to merge chunks, one must obey the following rule:
|
|
15962
|
+
* - When merging several chunks, at most one of the chunks can have side
|
|
15963
|
+
* effects
|
|
15964
|
+
* - When one of the chunks has side effects, the entry points depending on that
|
|
15965
|
+
* chunk need to be a super set of the entry points depending on the other
|
|
15966
|
+
* chunks
|
|
15967
|
+
* - Pure chunks can always be merged
|
|
15968
|
+
* - We use the entry point dependence signature to calculate "chunk distance",
|
|
15969
|
+
* i.e. how likely it is that two chunks are loaded together
|
|
15970
|
+
*/
|
|
15832
15971
|
function getOptimizedChunks(chunkModulesBySignature, minChunkSize) {
|
|
15833
15972
|
timeStart('optimize chunks', 3);
|
|
15834
|
-
const
|
|
15835
|
-
|
|
15836
|
-
|
|
15837
|
-
|
|
15838
|
-
|
|
15839
|
-
|
|
15840
|
-
|
|
15841
|
-
|
|
15842
|
-
|
|
15843
|
-
|
|
15844
|
-
|
|
15845
|
-
|
|
15846
|
-
|
|
15847
|
-
|
|
15848
|
-
|
|
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
|
-
}
|
|
15973
|
+
const chunkPartition = getPartitionedChunks(chunkModulesBySignature, minChunkSize);
|
|
15974
|
+
console.log(`Created ${chunkPartition.big.pure.size +
|
|
15975
|
+
chunkPartition.big.sideEffect.size +
|
|
15976
|
+
chunkPartition.small.pure.size +
|
|
15977
|
+
chunkPartition.small.sideEffect.size} chunks
|
|
15978
|
+
----- pure side effects
|
|
15979
|
+
small ${`${chunkPartition.small.pure.size}`.padEnd(5, ' ')} ${chunkPartition.small.sideEffect.size}
|
|
15980
|
+
big ${`${chunkPartition.big.pure.size}`.padEnd(5, ' ')} ${chunkPartition.big.sideEffect.size}
|
|
15981
|
+
`);
|
|
15982
|
+
console.log(`Trying to find merge targets for ${chunkPartition.small.sideEffect.size} chunks smaller than ${prettyBytes(minChunkSize)} with side effects...`);
|
|
15983
|
+
mergeChunks(chunkPartition.small.sideEffect, [chunkPartition.small.pure, chunkPartition.big.pure], minChunkSize, chunkPartition);
|
|
15984
|
+
console.log(`${chunkPartition.small.sideEffect.size} chunks smaller than ${prettyBytes(minChunkSize)} with side effects remaining.\n`);
|
|
15985
|
+
console.log(`Trying to find merge targets for ${chunkPartition.small.pure.size} pure chunks smaller than ${prettyBytes(minChunkSize)}...`);
|
|
15986
|
+
mergeChunks(chunkPartition.small.pure, [chunkPartition.small.pure, chunkPartition.big.sideEffect, chunkPartition.big.pure], minChunkSize, chunkPartition);
|
|
15987
|
+
console.log(`${chunkPartition.small.pure.size} pure chunks smaller than ${prettyBytes(minChunkSize)} remaining.\n`);
|
|
15865
15988
|
timeEnd('optimize chunks', 3);
|
|
15866
|
-
|
|
15989
|
+
const result = [
|
|
15990
|
+
...chunkPartition.small.sideEffect,
|
|
15991
|
+
...chunkPartition.small.pure,
|
|
15992
|
+
...chunkPartition.big.sideEffect,
|
|
15993
|
+
...chunkPartition.big.pure
|
|
15994
|
+
];
|
|
15995
|
+
console.log(`${result.length} chunks remaining.`);
|
|
15996
|
+
return result;
|
|
15867
15997
|
}
|
|
15868
15998
|
const CHAR_DEPENDENT = 'X';
|
|
15869
15999
|
const CHAR_INDEPENDENT = '_';
|
|
@@ -15885,28 +16015,76 @@ function getChunkModulesBySignature(assignedEntryPointsByModule, allEntryPoints)
|
|
|
15885
16015
|
}
|
|
15886
16016
|
return chunkModules;
|
|
15887
16017
|
}
|
|
15888
|
-
function
|
|
15889
|
-
const
|
|
15890
|
-
const
|
|
15891
|
-
const
|
|
16018
|
+
function getPartitionedChunks(chunkModulesBySignature, minChunkSize) {
|
|
16019
|
+
const smallPureChunks = [];
|
|
16020
|
+
const bigPureChunks = [];
|
|
16021
|
+
const smallSideEffectChunks = [];
|
|
16022
|
+
const bigSideEffectChunks = [];
|
|
15892
16023
|
for (const [signature, modules] of Object.entries(chunkModulesBySignature)) {
|
|
15893
16024
|
let size = 0;
|
|
15894
|
-
|
|
15895
|
-
|
|
15896
|
-
|
|
15897
|
-
|
|
15898
|
-
|
|
15899
|
-
|
|
15900
|
-
|
|
15901
|
-
|
|
15902
|
-
|
|
16025
|
+
let pure = true;
|
|
16026
|
+
for (const module of modules) {
|
|
16027
|
+
pure && (pure = !module.hasEffects());
|
|
16028
|
+
size += module.magicString.toString().length;
|
|
16029
|
+
}
|
|
16030
|
+
(size < minChunkSize
|
|
16031
|
+
? pure
|
|
16032
|
+
? smallPureChunks
|
|
16033
|
+
: smallSideEffectChunks
|
|
16034
|
+
: pure
|
|
16035
|
+
? bigPureChunks
|
|
16036
|
+
: bigSideEffectChunks).push({ modules, pure, signature, size });
|
|
16037
|
+
}
|
|
16038
|
+
for (const chunks of [
|
|
16039
|
+
bigPureChunks,
|
|
16040
|
+
bigSideEffectChunks,
|
|
16041
|
+
smallPureChunks,
|
|
16042
|
+
smallSideEffectChunks
|
|
16043
|
+
]) {
|
|
16044
|
+
chunks.sort(compareChunks);
|
|
16045
|
+
}
|
|
16046
|
+
return {
|
|
16047
|
+
big: { pure: new Set(bigPureChunks), sideEffect: new Set(bigSideEffectChunks) },
|
|
16048
|
+
small: { pure: new Set(smallPureChunks), sideEffect: new Set(smallSideEffectChunks) }
|
|
16049
|
+
};
|
|
16050
|
+
}
|
|
16051
|
+
function compareChunks({ size: sizeA }, { size: sizeB }) {
|
|
16052
|
+
return sizeA - sizeB;
|
|
16053
|
+
}
|
|
16054
|
+
function mergeChunks(chunksToBeMerged, targetChunks, minChunkSize, chunkPartition) {
|
|
16055
|
+
for (const mergedChunk of chunksToBeMerged) {
|
|
16056
|
+
let closestChunk = null;
|
|
16057
|
+
let closestChunkDistance = Infinity;
|
|
16058
|
+
const { signature, modules, pure, size } = mergedChunk;
|
|
16059
|
+
for (const targetChunk of concatLazy(targetChunks)) {
|
|
16060
|
+
if (mergedChunk === targetChunk)
|
|
16061
|
+
continue;
|
|
16062
|
+
const distance = pure
|
|
16063
|
+
? getSignatureDistance(signature, targetChunk.signature, !targetChunk.pure)
|
|
16064
|
+
: getSignatureDistance(targetChunk.signature, signature, true);
|
|
16065
|
+
if (distance === 1) {
|
|
16066
|
+
closestChunk = targetChunk;
|
|
16067
|
+
break;
|
|
16068
|
+
}
|
|
16069
|
+
else if (distance < closestChunkDistance) {
|
|
16070
|
+
closestChunk = targetChunk;
|
|
16071
|
+
closestChunkDistance = distance;
|
|
15903
16072
|
}
|
|
15904
|
-
chunksToBeMerged.add({ alias, modules, signature, size });
|
|
15905
|
-
continue;
|
|
15906
16073
|
}
|
|
15907
|
-
|
|
16074
|
+
if (closestChunk) {
|
|
16075
|
+
chunksToBeMerged.delete(mergedChunk);
|
|
16076
|
+
getChunksInPartition(closestChunk, minChunkSize, chunkPartition).delete(closestChunk);
|
|
16077
|
+
closestChunk.modules.push(...modules);
|
|
16078
|
+
closestChunk.size += size;
|
|
16079
|
+
closestChunk.pure && (closestChunk.pure = pure);
|
|
16080
|
+
closestChunk.signature = mergeSignatures(signature, closestChunk.signature);
|
|
16081
|
+
getChunksInPartition(closestChunk, minChunkSize, chunkPartition).add(closestChunk);
|
|
16082
|
+
}
|
|
15908
16083
|
}
|
|
15909
|
-
|
|
16084
|
+
}
|
|
16085
|
+
function getChunksInPartition(chunk, minChunkSize, chunkPartition) {
|
|
16086
|
+
const subPartition = chunk.size < minChunkSize ? chunkPartition.small : chunkPartition.big;
|
|
16087
|
+
return chunk.pure ? subPartition.pure : subPartition.sideEffect;
|
|
15910
16088
|
}
|
|
15911
16089
|
function getSignatureDistance(sourceSignature, targetSignature, enforceSubset) {
|
|
15912
16090
|
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.
|
|
4
|
-
Sun, 27 Nov 2022 06:
|
|
3
|
+
Rollup.js v3.6.0-0
|
|
4
|
+
Sun, 27 Nov 2022 06:53:45 GMT - commit 03fdcc007bd49a4c88579d93053248ebe03dcef9
|
|
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.
|
|
34
|
+
var version$1 = "3.6.0-0";
|
|
35
35
|
|
|
36
36
|
function ensureArray$1(items) {
|
|
37
37
|
if (Array.isArray(items)) {
|
|
@@ -11768,7 +11768,12 @@ class PrivateIdentifier extends NodeBase {
|
|
|
11768
11768
|
class Program extends NodeBase {
|
|
11769
11769
|
constructor() {
|
|
11770
11770
|
super(...arguments);
|
|
11771
|
-
this.hasCachedEffect =
|
|
11771
|
+
this.hasCachedEffect = null;
|
|
11772
|
+
}
|
|
11773
|
+
hasCachedEffects() {
|
|
11774
|
+
return this.hasCachedEffect === null
|
|
11775
|
+
? (this.hasCachedEffect = this.hasEffects(createHasEffectsContext()))
|
|
11776
|
+
: this.hasCachedEffect;
|
|
11772
11777
|
}
|
|
11773
11778
|
hasEffects(context) {
|
|
11774
11779
|
// We are caching here to later more efficiently identify side-effect-free modules
|
|
@@ -13611,8 +13616,7 @@ class Module {
|
|
|
13611
13616
|
return [null];
|
|
13612
13617
|
}
|
|
13613
13618
|
hasEffects() {
|
|
13614
|
-
return
|
|
13615
|
-
(this.ast.included && this.ast.hasEffects(createHasEffectsContext())));
|
|
13619
|
+
return this.info.moduleSideEffects === 'no-treeshake' || this.ast.hasCachedEffects();
|
|
13616
13620
|
}
|
|
13617
13621
|
include() {
|
|
13618
13622
|
const context = createInclusionContext();
|
|
@@ -16211,12 +16215,132 @@ function getImportedBindingsPerDependency(renderedDependencies, resolveFileName)
|
|
|
16211
16215
|
const QUERY_HASH_REGEX = /[#?]/;
|
|
16212
16216
|
const resolveFileName = (dependency) => dependency.getFileName();
|
|
16213
16217
|
|
|
16218
|
+
const BYTE_UNITS = [
|
|
16219
|
+
'B',
|
|
16220
|
+
'kB',
|
|
16221
|
+
'MB',
|
|
16222
|
+
'GB',
|
|
16223
|
+
'TB',
|
|
16224
|
+
'PB',
|
|
16225
|
+
'EB',
|
|
16226
|
+
'ZB',
|
|
16227
|
+
'YB',
|
|
16228
|
+
];
|
|
16229
|
+
|
|
16230
|
+
const BIBYTE_UNITS = [
|
|
16231
|
+
'B',
|
|
16232
|
+
'kiB',
|
|
16233
|
+
'MiB',
|
|
16234
|
+
'GiB',
|
|
16235
|
+
'TiB',
|
|
16236
|
+
'PiB',
|
|
16237
|
+
'EiB',
|
|
16238
|
+
'ZiB',
|
|
16239
|
+
'YiB',
|
|
16240
|
+
];
|
|
16241
|
+
|
|
16242
|
+
const BIT_UNITS = [
|
|
16243
|
+
'b',
|
|
16244
|
+
'kbit',
|
|
16245
|
+
'Mbit',
|
|
16246
|
+
'Gbit',
|
|
16247
|
+
'Tbit',
|
|
16248
|
+
'Pbit',
|
|
16249
|
+
'Ebit',
|
|
16250
|
+
'Zbit',
|
|
16251
|
+
'Ybit',
|
|
16252
|
+
];
|
|
16253
|
+
|
|
16254
|
+
const BIBIT_UNITS = [
|
|
16255
|
+
'b',
|
|
16256
|
+
'kibit',
|
|
16257
|
+
'Mibit',
|
|
16258
|
+
'Gibit',
|
|
16259
|
+
'Tibit',
|
|
16260
|
+
'Pibit',
|
|
16261
|
+
'Eibit',
|
|
16262
|
+
'Zibit',
|
|
16263
|
+
'Yibit',
|
|
16264
|
+
];
|
|
16265
|
+
|
|
16266
|
+
/*
|
|
16267
|
+
Formats the given number using `Number#toLocaleString`.
|
|
16268
|
+
- If locale is a string, the value is expected to be a locale-key (for example: `de`).
|
|
16269
|
+
- If locale is true, the system default locale is used for translation.
|
|
16270
|
+
- If no value for locale is specified, the number is returned unmodified.
|
|
16271
|
+
*/
|
|
16272
|
+
const toLocaleString = (number, locale, options) => {
|
|
16273
|
+
let result = number;
|
|
16274
|
+
if (typeof locale === 'string' || Array.isArray(locale)) {
|
|
16275
|
+
result = number.toLocaleString(locale, options);
|
|
16276
|
+
} else if (locale === true || options !== undefined) {
|
|
16277
|
+
result = number.toLocaleString(undefined, options);
|
|
16278
|
+
}
|
|
16279
|
+
|
|
16280
|
+
return result;
|
|
16281
|
+
};
|
|
16282
|
+
|
|
16283
|
+
function prettyBytes(number, options) {
|
|
16284
|
+
if (!Number.isFinite(number)) {
|
|
16285
|
+
throw new TypeError(`Expected a finite number, got ${typeof number}: ${number}`);
|
|
16286
|
+
}
|
|
16287
|
+
|
|
16288
|
+
options = {
|
|
16289
|
+
bits: false,
|
|
16290
|
+
binary: false,
|
|
16291
|
+
...options,
|
|
16292
|
+
};
|
|
16293
|
+
|
|
16294
|
+
const UNITS = options.bits
|
|
16295
|
+
? (options.binary ? BIBIT_UNITS : BIT_UNITS)
|
|
16296
|
+
: (options.binary ? BIBYTE_UNITS : BYTE_UNITS);
|
|
16297
|
+
|
|
16298
|
+
if (options.signed && number === 0) {
|
|
16299
|
+
return ` 0 ${UNITS[0]}`;
|
|
16300
|
+
}
|
|
16301
|
+
|
|
16302
|
+
const isNegative = number < 0;
|
|
16303
|
+
const prefix = isNegative ? '-' : (options.signed ? '+' : '');
|
|
16304
|
+
|
|
16305
|
+
if (isNegative) {
|
|
16306
|
+
number = -number;
|
|
16307
|
+
}
|
|
16308
|
+
|
|
16309
|
+
let localeOptions;
|
|
16310
|
+
|
|
16311
|
+
if (options.minimumFractionDigits !== undefined) {
|
|
16312
|
+
localeOptions = {minimumFractionDigits: options.minimumFractionDigits};
|
|
16313
|
+
}
|
|
16314
|
+
|
|
16315
|
+
if (options.maximumFractionDigits !== undefined) {
|
|
16316
|
+
localeOptions = {maximumFractionDigits: options.maximumFractionDigits, ...localeOptions};
|
|
16317
|
+
}
|
|
16318
|
+
|
|
16319
|
+
if (number < 1) {
|
|
16320
|
+
const numberString = toLocaleString(number, options.locale, localeOptions);
|
|
16321
|
+
return prefix + numberString + ' ' + UNITS[0];
|
|
16322
|
+
}
|
|
16323
|
+
|
|
16324
|
+
const exponent = Math.min(Math.floor(options.binary ? Math.log(number) / Math.log(1024) : Math.log10(number) / 3), UNITS.length - 1);
|
|
16325
|
+
number /= (options.binary ? 1024 : 1000) ** exponent;
|
|
16326
|
+
|
|
16327
|
+
if (!localeOptions) {
|
|
16328
|
+
number = number.toPrecision(3);
|
|
16329
|
+
}
|
|
16330
|
+
|
|
16331
|
+
const numberString = toLocaleString(Number(number), options.locale, localeOptions);
|
|
16332
|
+
|
|
16333
|
+
const unit = UNITS[exponent];
|
|
16334
|
+
|
|
16335
|
+
return prefix + numberString + ' ' + unit;
|
|
16336
|
+
}
|
|
16337
|
+
|
|
16214
16338
|
/**
|
|
16215
16339
|
* Concatenate a number of iterables to a new iterable without fully evaluating
|
|
16216
16340
|
* their iterators. Useful when e.g. working with large sets or lists and when
|
|
16217
16341
|
* there is a chance that the iterators will not be fully exhausted.
|
|
16218
16342
|
*/
|
|
16219
|
-
function* concatLazy(
|
|
16343
|
+
function* concatLazy(iterables) {
|
|
16220
16344
|
for (const iterable of iterables) {
|
|
16221
16345
|
yield* iterable;
|
|
16222
16346
|
}
|
|
@@ -16342,43 +16466,49 @@ function createChunks(allEntryPoints, assignedEntryPointsByModule, minChunkSize)
|
|
|
16342
16466
|
alias: null,
|
|
16343
16467
|
modules
|
|
16344
16468
|
}))
|
|
16345
|
-
: getOptimizedChunks(chunkModulesBySignature, minChunkSize)
|
|
16469
|
+
: getOptimizedChunks(chunkModulesBySignature, minChunkSize).map(({ modules }) => ({
|
|
16470
|
+
alias: null,
|
|
16471
|
+
modules
|
|
16472
|
+
}));
|
|
16346
16473
|
}
|
|
16474
|
+
/**
|
|
16475
|
+
* This function tries to get rid of small chunks by merging them with other
|
|
16476
|
+
* chunks. In order to merge chunks, one must obey the following rule:
|
|
16477
|
+
* - When merging several chunks, at most one of the chunks can have side
|
|
16478
|
+
* effects
|
|
16479
|
+
* - When one of the chunks has side effects, the entry points depending on that
|
|
16480
|
+
* chunk need to be a super set of the entry points depending on the other
|
|
16481
|
+
* chunks
|
|
16482
|
+
* - Pure chunks can always be merged
|
|
16483
|
+
* - We use the entry point dependence signature to calculate "chunk distance",
|
|
16484
|
+
* i.e. how likely it is that two chunks are loaded together
|
|
16485
|
+
*/
|
|
16347
16486
|
function getOptimizedChunks(chunkModulesBySignature, minChunkSize) {
|
|
16348
16487
|
timeStart('optimize chunks', 3);
|
|
16349
|
-
const
|
|
16350
|
-
|
|
16351
|
-
|
|
16352
|
-
|
|
16353
|
-
|
|
16354
|
-
|
|
16355
|
-
|
|
16356
|
-
|
|
16357
|
-
|
|
16358
|
-
|
|
16359
|
-
|
|
16360
|
-
|
|
16361
|
-
|
|
16362
|
-
|
|
16363
|
-
|
|
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
|
-
}
|
|
16488
|
+
const chunkPartition = getPartitionedChunks(chunkModulesBySignature, minChunkSize);
|
|
16489
|
+
console.log(`Created ${chunkPartition.big.pure.size +
|
|
16490
|
+
chunkPartition.big.sideEffect.size +
|
|
16491
|
+
chunkPartition.small.pure.size +
|
|
16492
|
+
chunkPartition.small.sideEffect.size} chunks
|
|
16493
|
+
----- pure side effects
|
|
16494
|
+
small ${`${chunkPartition.small.pure.size}`.padEnd(5, ' ')} ${chunkPartition.small.sideEffect.size}
|
|
16495
|
+
big ${`${chunkPartition.big.pure.size}`.padEnd(5, ' ')} ${chunkPartition.big.sideEffect.size}
|
|
16496
|
+
`);
|
|
16497
|
+
console.log(`Trying to find merge targets for ${chunkPartition.small.sideEffect.size} chunks smaller than ${prettyBytes(minChunkSize)} with side effects...`);
|
|
16498
|
+
mergeChunks(chunkPartition.small.sideEffect, [chunkPartition.small.pure, chunkPartition.big.pure], minChunkSize, chunkPartition);
|
|
16499
|
+
console.log(`${chunkPartition.small.sideEffect.size} chunks smaller than ${prettyBytes(minChunkSize)} with side effects remaining.\n`);
|
|
16500
|
+
console.log(`Trying to find merge targets for ${chunkPartition.small.pure.size} pure chunks smaller than ${prettyBytes(minChunkSize)}...`);
|
|
16501
|
+
mergeChunks(chunkPartition.small.pure, [chunkPartition.small.pure, chunkPartition.big.sideEffect, chunkPartition.big.pure], minChunkSize, chunkPartition);
|
|
16502
|
+
console.log(`${chunkPartition.small.pure.size} pure chunks smaller than ${prettyBytes(minChunkSize)} remaining.\n`);
|
|
16380
16503
|
timeEnd('optimize chunks', 3);
|
|
16381
|
-
|
|
16504
|
+
const result = [
|
|
16505
|
+
...chunkPartition.small.sideEffect,
|
|
16506
|
+
...chunkPartition.small.pure,
|
|
16507
|
+
...chunkPartition.big.sideEffect,
|
|
16508
|
+
...chunkPartition.big.pure
|
|
16509
|
+
];
|
|
16510
|
+
console.log(`${result.length} chunks remaining.`);
|
|
16511
|
+
return result;
|
|
16382
16512
|
}
|
|
16383
16513
|
const CHAR_DEPENDENT = 'X';
|
|
16384
16514
|
const CHAR_INDEPENDENT = '_';
|
|
@@ -16400,28 +16530,76 @@ function getChunkModulesBySignature(assignedEntryPointsByModule, allEntryPoints)
|
|
|
16400
16530
|
}
|
|
16401
16531
|
return chunkModules;
|
|
16402
16532
|
}
|
|
16403
|
-
function
|
|
16404
|
-
const
|
|
16405
|
-
const
|
|
16406
|
-
const
|
|
16533
|
+
function getPartitionedChunks(chunkModulesBySignature, minChunkSize) {
|
|
16534
|
+
const smallPureChunks = [];
|
|
16535
|
+
const bigPureChunks = [];
|
|
16536
|
+
const smallSideEffectChunks = [];
|
|
16537
|
+
const bigSideEffectChunks = [];
|
|
16407
16538
|
for (const [signature, modules] of Object.entries(chunkModulesBySignature)) {
|
|
16408
16539
|
let size = 0;
|
|
16409
|
-
|
|
16410
|
-
|
|
16411
|
-
|
|
16412
|
-
|
|
16413
|
-
|
|
16414
|
-
|
|
16415
|
-
|
|
16416
|
-
|
|
16417
|
-
|
|
16540
|
+
let pure = true;
|
|
16541
|
+
for (const module of modules) {
|
|
16542
|
+
pure && (pure = !module.hasEffects());
|
|
16543
|
+
size += module.magicString.toString().length;
|
|
16544
|
+
}
|
|
16545
|
+
(size < minChunkSize
|
|
16546
|
+
? pure
|
|
16547
|
+
? smallPureChunks
|
|
16548
|
+
: smallSideEffectChunks
|
|
16549
|
+
: pure
|
|
16550
|
+
? bigPureChunks
|
|
16551
|
+
: bigSideEffectChunks).push({ modules, pure, signature, size });
|
|
16552
|
+
}
|
|
16553
|
+
for (const chunks of [
|
|
16554
|
+
bigPureChunks,
|
|
16555
|
+
bigSideEffectChunks,
|
|
16556
|
+
smallPureChunks,
|
|
16557
|
+
smallSideEffectChunks
|
|
16558
|
+
]) {
|
|
16559
|
+
chunks.sort(compareChunks);
|
|
16560
|
+
}
|
|
16561
|
+
return {
|
|
16562
|
+
big: { pure: new Set(bigPureChunks), sideEffect: new Set(bigSideEffectChunks) },
|
|
16563
|
+
small: { pure: new Set(smallPureChunks), sideEffect: new Set(smallSideEffectChunks) }
|
|
16564
|
+
};
|
|
16565
|
+
}
|
|
16566
|
+
function compareChunks({ size: sizeA }, { size: sizeB }) {
|
|
16567
|
+
return sizeA - sizeB;
|
|
16568
|
+
}
|
|
16569
|
+
function mergeChunks(chunksToBeMerged, targetChunks, minChunkSize, chunkPartition) {
|
|
16570
|
+
for (const mergedChunk of chunksToBeMerged) {
|
|
16571
|
+
let closestChunk = null;
|
|
16572
|
+
let closestChunkDistance = Infinity;
|
|
16573
|
+
const { signature, modules, pure, size } = mergedChunk;
|
|
16574
|
+
for (const targetChunk of concatLazy(targetChunks)) {
|
|
16575
|
+
if (mergedChunk === targetChunk)
|
|
16576
|
+
continue;
|
|
16577
|
+
const distance = pure
|
|
16578
|
+
? getSignatureDistance(signature, targetChunk.signature, !targetChunk.pure)
|
|
16579
|
+
: getSignatureDistance(targetChunk.signature, signature, true);
|
|
16580
|
+
if (distance === 1) {
|
|
16581
|
+
closestChunk = targetChunk;
|
|
16582
|
+
break;
|
|
16583
|
+
}
|
|
16584
|
+
else if (distance < closestChunkDistance) {
|
|
16585
|
+
closestChunk = targetChunk;
|
|
16586
|
+
closestChunkDistance = distance;
|
|
16418
16587
|
}
|
|
16419
|
-
chunksToBeMerged.add({ alias, modules, signature, size });
|
|
16420
|
-
continue;
|
|
16421
16588
|
}
|
|
16422
|
-
|
|
16589
|
+
if (closestChunk) {
|
|
16590
|
+
chunksToBeMerged.delete(mergedChunk);
|
|
16591
|
+
getChunksInPartition(closestChunk, minChunkSize, chunkPartition).delete(closestChunk);
|
|
16592
|
+
closestChunk.modules.push(...modules);
|
|
16593
|
+
closestChunk.size += size;
|
|
16594
|
+
closestChunk.pure && (closestChunk.pure = pure);
|
|
16595
|
+
closestChunk.signature = mergeSignatures(signature, closestChunk.signature);
|
|
16596
|
+
getChunksInPartition(closestChunk, minChunkSize, chunkPartition).add(closestChunk);
|
|
16597
|
+
}
|
|
16423
16598
|
}
|
|
16424
|
-
|
|
16599
|
+
}
|
|
16600
|
+
function getChunksInPartition(chunk, minChunkSize, chunkPartition) {
|
|
16601
|
+
const subPartition = chunk.size < minChunkSize ? chunkPartition.small : chunkPartition.big;
|
|
16602
|
+
return chunk.pure ? subPartition.pure : subPartition.sideEffect;
|
|
16425
16603
|
}
|
|
16426
16604
|
function getSignatureDistance(sourceSignature, targetSignature, enforceSubset) {
|
|
16427
16605
|
let distance = 0;
|
|
@@ -25255,6 +25433,7 @@ exports.loadFsEvents = loadFsEvents;
|
|
|
25255
25433
|
exports.mergeOptions = mergeOptions;
|
|
25256
25434
|
exports.normalizePluginOption = normalizePluginOption;
|
|
25257
25435
|
exports.picomatch = picomatch$1;
|
|
25436
|
+
exports.prettyBytes = prettyBytes;
|
|
25258
25437
|
exports.printQuotedStringList = printQuotedStringList;
|
|
25259
25438
|
exports.relativeId = relativeId;
|
|
25260
25439
|
exports.rollup = rollup;
|
package/dist/shared/watch-cli.js
CHANGED
package/dist/shared/watch.js
CHANGED