rollup 3.4.0-1 → 3.5.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 CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  /*
4
4
  @license
5
- Rollup.js v3.4.0-1
6
- Mon, 21 Nov 2022 05:22:41 GMT - commit f7a081a72fd85e7e80e3cbefa55fbfd88eb52a3f
5
+ Rollup.js v3.5.0-0
6
+ Fri, 25 Nov 2022 05:53:50 GMT - commit b8beb21aa83e193ed6ef82f06127e95a7ef5fe22
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
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.4.0-1
4
- Mon, 21 Nov 2022 05:22:41 GMT - commit f7a081a72fd85e7e80e3cbefa55fbfd88eb52a3f
3
+ Rollup.js v3.5.0-0
4
+ Fri, 25 Nov 2022 05:53:50 GMT - commit b8beb21aa83e193ed6ef82f06127e95a7ef5fe22
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.4.0-1
4
- Mon, 21 Nov 2022 05:22:41 GMT - commit f7a081a72fd85e7e80e3cbefa55fbfd88eb52a3f
3
+ Rollup.js v3.5.0-0
4
+ Fri, 25 Nov 2022 05:53:50 GMT - commit b8beb21aa83e193ed6ef82f06127e95a7ef5fe22
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.4.0-1";
19
+ var version$1 = "3.5.0-0";
20
20
 
21
21
  var charToInteger = {};
22
22
  var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
@@ -7038,6 +7038,7 @@ const knownGlobals = {
7038
7038
  // deoptimizes everything anyway
7039
7039
  defineProperty: MUTATES_ARG_WITHOUT_ACCESSOR,
7040
7040
  defineProperties: MUTATES_ARG_WITHOUT_ACCESSOR,
7041
+ freeze: MUTATES_ARG_WITHOUT_ACCESSOR,
7041
7042
  getOwnPropertyDescriptor: PF,
7042
7043
  getOwnPropertyNames: PF,
7043
7044
  getOwnPropertySymbols: PF,
@@ -11252,7 +11253,12 @@ class PrivateIdentifier extends NodeBase {
11252
11253
  class Program extends NodeBase {
11253
11254
  constructor() {
11254
11255
  super(...arguments);
11255
- this.hasCachedEffect = false;
11256
+ this.hasCachedEffect = null;
11257
+ }
11258
+ hasCachedEffects() {
11259
+ return this.hasCachedEffect === null
11260
+ ? (this.hasCachedEffect = this.hasEffects(createHasEffectsContext()))
11261
+ : this.hasCachedEffect;
11256
11262
  }
11257
11263
  hasEffects(context) {
11258
11264
  // We are caching here to later more efficiently identify side-effect-free modules
@@ -13095,8 +13101,7 @@ class Module {
13095
13101
  return [null];
13096
13102
  }
13097
13103
  hasEffects() {
13098
- return (this.info.moduleSideEffects === 'no-treeshake' ||
13099
- (this.ast.included && this.ast.hasEffects(createHasEffectsContext())));
13104
+ return this.info.moduleSideEffects === 'no-treeshake' || this.ast.hasCachedEffects();
13100
13105
  }
13101
13106
  include() {
13102
13107
  const context = createInclusionContext();
@@ -15693,12 +15698,132 @@ function getImportedBindingsPerDependency(renderedDependencies, resolveFileName)
15693
15698
  const QUERY_HASH_REGEX = /[#?]/;
15694
15699
  const resolveFileName = (dependency) => dependency.getFileName();
15695
15700
 
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
+
15696
15821
  /**
15697
15822
  * Concatenate a number of iterables to a new iterable without fully evaluating
15698
15823
  * their iterators. Useful when e.g. working with large sets or lists and when
15699
15824
  * there is a chance that the iterators will not be fully exhausted.
15700
15825
  */
15701
- function* concatLazy(...iterables) {
15826
+ function* concatLazy(iterables) {
15702
15827
  for (const iterable of iterables) {
15703
15828
  yield* iterable;
15704
15829
  }
@@ -15824,43 +15949,37 @@ function createChunks(allEntryPoints, assignedEntryPointsByModule, minChunkSize)
15824
15949
  alias: null,
15825
15950
  modules
15826
15951
  }))
15827
- : getOptimizedChunks(chunkModulesBySignature, minChunkSize);
15952
+ : getOptimizedChunks(chunkModulesBySignature, minChunkSize).map(({ modules }) => ({
15953
+ alias: null,
15954
+ modules
15955
+ }));
15828
15956
  }
15829
15957
  function getOptimizedChunks(chunkModulesBySignature, minChunkSize) {
15830
15958
  timeStart('optimize chunks', 3);
15831
- const { chunksToBeMerged, unmergeableChunks } = getMergeableChunks(chunkModulesBySignature, minChunkSize);
15832
- for (const sourceChunk of chunksToBeMerged) {
15833
- chunksToBeMerged.delete(sourceChunk);
15834
- let closestChunk = null;
15835
- let closestChunkDistance = Infinity;
15836
- const { signature, size, modules } = sourceChunk;
15837
- for (const targetChunk of concatLazy(chunksToBeMerged, unmergeableChunks)) {
15838
- const distance = getSignatureDistance(signature, targetChunk.signature, !chunksToBeMerged.has(targetChunk));
15839
- if (distance === 1) {
15840
- closestChunk = targetChunk;
15841
- break;
15842
- }
15843
- else if (distance < closestChunkDistance) {
15844
- closestChunk = targetChunk;
15845
- closestChunkDistance = distance;
15846
- }
15847
- }
15848
- if (closestChunk) {
15849
- closestChunk.modules.push(...modules);
15850
- if (chunksToBeMerged.has(closestChunk)) {
15851
- closestChunk.signature = mergeSignatures(signature, closestChunk.signature);
15852
- if ((closestChunk.size += size) > minChunkSize) {
15853
- chunksToBeMerged.delete(closestChunk);
15854
- unmergeableChunks.push(closestChunk);
15855
- }
15856
- }
15857
- }
15858
- else {
15859
- unmergeableChunks.push(sourceChunk);
15860
- }
15861
- }
15959
+ const chunkPartition = getPartitionedChunks(chunkModulesBySignature, minChunkSize);
15960
+ console.log(`Created ${chunkPartition.big.pure.size +
15961
+ chunkPartition.big.sideEffect.size +
15962
+ chunkPartition.small.pure.size +
15963
+ chunkPartition.small.sideEffect.size} chunks
15964
+ ----- pure side effects
15965
+ small ${`${chunkPartition.small.pure.size}`.padEnd(5, ' ')} ${chunkPartition.small.sideEffect.size}
15966
+ big ${`${chunkPartition.big.pure.size}`.padEnd(5, ' ')} ${chunkPartition.big.sideEffect.size}
15967
+ `);
15968
+ console.log(`Trying to find merge targets for ${chunkPartition.small.sideEffect.size} chunks smaller than ${prettyBytes(minChunkSize)} with side effects...`);
15969
+ mergeChunks(chunkPartition.small.sideEffect, [chunkPartition.small.pure, chunkPartition.big.pure], minChunkSize, chunkPartition);
15970
+ console.log(`${chunkPartition.small.sideEffect.size} chunks smaller than ${prettyBytes(minChunkSize)} with side effects remaining.\n`);
15971
+ console.log(`Trying to find merge targets for ${chunkPartition.small.pure.size} pure chunks smaller than ${prettyBytes(minChunkSize)}...`);
15972
+ mergeChunks(chunkPartition.small.pure, [chunkPartition.small.pure, chunkPartition.big.sideEffect, chunkPartition.big.pure], minChunkSize, chunkPartition);
15973
+ console.log(`${chunkPartition.small.pure.size} pure chunks smaller than ${prettyBytes(minChunkSize)} remaining.\n`);
15862
15974
  timeEnd('optimize chunks', 3);
15863
- return unmergeableChunks;
15975
+ const result = [
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;
15864
15983
  }
15865
15984
  const CHAR_DEPENDENT = 'X';
15866
15985
  const CHAR_INDEPENDENT = '_';
@@ -15882,28 +16001,76 @@ function getChunkModulesBySignature(assignedEntryPointsByModule, allEntryPoints)
15882
16001
  }
15883
16002
  return chunkModules;
15884
16003
  }
15885
- function getMergeableChunks(chunkModulesBySignature, minChunkSize) {
15886
- const chunksToBeMerged = new Set();
15887
- const unmergeableChunks = [];
15888
- const alias = null;
16004
+ function getPartitionedChunks(chunkModulesBySignature, minChunkSize) {
16005
+ const smallPureChunks = [];
16006
+ const bigPureChunks = [];
16007
+ const smallSideEffectChunks = [];
16008
+ const bigSideEffectChunks = [];
15889
16009
  for (const [signature, modules] of Object.entries(chunkModulesBySignature)) {
15890
16010
  let size = 0;
15891
- checkModules: {
15892
- for (const module of modules) {
15893
- if (module.hasEffects()) {
15894
- break checkModules;
15895
- }
15896
- size += module.magicString.toString().length;
15897
- if (size > minChunkSize) {
15898
- break checkModules;
15899
- }
16011
+ let pure = true;
16012
+ for (const module of modules) {
16013
+ pure && (pure = !module.hasEffects());
16014
+ size += module.magicString.toString().length;
16015
+ }
16016
+ (size < minChunkSize
16017
+ ? pure
16018
+ ? smallPureChunks
16019
+ : smallSideEffectChunks
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;
15900
16058
  }
15901
- chunksToBeMerged.add({ alias, modules, signature, size });
15902
- continue;
15903
16059
  }
15904
- unmergeableChunks.push({ alias, modules, signature, size: null });
16060
+ if (closestChunk) {
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
+ }
15905
16069
  }
15906
- return { chunksToBeMerged, unmergeableChunks };
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;
15907
16074
  }
15908
16075
  function getSignatureDistance(sourceSignature, targetSignature, enforceSubset) {
15909
16076
  let distance = 0;
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.4.0-1
4
- Mon, 21 Nov 2022 05:22:41 GMT - commit f7a081a72fd85e7e80e3cbefa55fbfd88eb52a3f
3
+ Rollup.js v3.5.0-0
4
+ Fri, 25 Nov 2022 05:53:50 GMT - commit b8beb21aa83e193ed6ef82f06127e95a7ef5fe22
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.4.0-1
4
- Mon, 21 Nov 2022 05:22:41 GMT - commit f7a081a72fd85e7e80e3cbefa55fbfd88eb52a3f
3
+ Rollup.js v3.5.0-0
4
+ Fri, 25 Nov 2022 05:53:50 GMT - commit b8beb21aa83e193ed6ef82f06127e95a7ef5fe22
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
package/dist/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.4.0-1
4
- Mon, 21 Nov 2022 05:22:41 GMT - commit f7a081a72fd85e7e80e3cbefa55fbfd88eb52a3f
3
+ Rollup.js v3.5.0-0
4
+ Fri, 25 Nov 2022 05:53:50 GMT - commit b8beb21aa83e193ed6ef82f06127e95a7ef5fe22
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.4.0-1
4
- Mon, 21 Nov 2022 05:22:41 GMT - commit f7a081a72fd85e7e80e3cbefa55fbfd88eb52a3f
3
+ Rollup.js v3.5.0-0
4
+ Fri, 25 Nov 2022 05:53:50 GMT - commit b8beb21aa83e193ed6ef82f06127e95a7ef5fe22
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.4.0-1
4
- Mon, 21 Nov 2022 05:22:41 GMT - commit f7a081a72fd85e7e80e3cbefa55fbfd88eb52a3f
3
+ Rollup.js v3.5.0-0
4
+ Fri, 25 Nov 2022 05:53:50 GMT - commit b8beb21aa83e193ed6ef82f06127e95a7ef5fe22
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.4.0-1
4
- Mon, 21 Nov 2022 05:22:41 GMT - commit f7a081a72fd85e7e80e3cbefa55fbfd88eb52a3f
3
+ Rollup.js v3.5.0-0
4
+ Fri, 25 Nov 2022 05:53:50 GMT - commit b8beb21aa83e193ed6ef82f06127e95a7ef5fe22
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.4.0-1";
34
+ var version$1 = "3.5.0-0";
35
35
 
36
36
  function ensureArray$1(items) {
37
37
  if (Array.isArray(items)) {
@@ -7553,6 +7553,7 @@ const knownGlobals = {
7553
7553
  // deoptimizes everything anyway
7554
7554
  defineProperty: MUTATES_ARG_WITHOUT_ACCESSOR,
7555
7555
  defineProperties: MUTATES_ARG_WITHOUT_ACCESSOR,
7556
+ freeze: MUTATES_ARG_WITHOUT_ACCESSOR,
7556
7557
  getOwnPropertyDescriptor: PF,
7557
7558
  getOwnPropertyNames: PF,
7558
7559
  getOwnPropertySymbols: PF,
@@ -11767,7 +11768,12 @@ class PrivateIdentifier extends NodeBase {
11767
11768
  class Program extends NodeBase {
11768
11769
  constructor() {
11769
11770
  super(...arguments);
11770
- this.hasCachedEffect = false;
11771
+ this.hasCachedEffect = null;
11772
+ }
11773
+ hasCachedEffects() {
11774
+ return this.hasCachedEffect === null
11775
+ ? (this.hasCachedEffect = this.hasEffects(createHasEffectsContext()))
11776
+ : this.hasCachedEffect;
11771
11777
  }
11772
11778
  hasEffects(context) {
11773
11779
  // We are caching here to later more efficiently identify side-effect-free modules
@@ -13610,8 +13616,7 @@ class Module {
13610
13616
  return [null];
13611
13617
  }
13612
13618
  hasEffects() {
13613
- return (this.info.moduleSideEffects === 'no-treeshake' ||
13614
- (this.ast.included && this.ast.hasEffects(createHasEffectsContext())));
13619
+ return this.info.moduleSideEffects === 'no-treeshake' || this.ast.hasCachedEffects();
13615
13620
  }
13616
13621
  include() {
13617
13622
  const context = createInclusionContext();
@@ -16208,12 +16213,132 @@ function getImportedBindingsPerDependency(renderedDependencies, resolveFileName)
16208
16213
  const QUERY_HASH_REGEX = /[#?]/;
16209
16214
  const resolveFileName = (dependency) => dependency.getFileName();
16210
16215
 
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
+
16211
16336
  /**
16212
16337
  * Concatenate a number of iterables to a new iterable without fully evaluating
16213
16338
  * their iterators. Useful when e.g. working with large sets or lists and when
16214
16339
  * there is a chance that the iterators will not be fully exhausted.
16215
16340
  */
16216
- function* concatLazy(...iterables) {
16341
+ function* concatLazy(iterables) {
16217
16342
  for (const iterable of iterables) {
16218
16343
  yield* iterable;
16219
16344
  }
@@ -16339,43 +16464,37 @@ function createChunks(allEntryPoints, assignedEntryPointsByModule, minChunkSize)
16339
16464
  alias: null,
16340
16465
  modules
16341
16466
  }))
16342
- : getOptimizedChunks(chunkModulesBySignature, minChunkSize);
16467
+ : getOptimizedChunks(chunkModulesBySignature, minChunkSize).map(({ modules }) => ({
16468
+ alias: null,
16469
+ modules
16470
+ }));
16343
16471
  }
16344
16472
  function getOptimizedChunks(chunkModulesBySignature, minChunkSize) {
16345
16473
  timeStart('optimize chunks', 3);
16346
- const { chunksToBeMerged, unmergeableChunks } = getMergeableChunks(chunkModulesBySignature, minChunkSize);
16347
- for (const sourceChunk of chunksToBeMerged) {
16348
- chunksToBeMerged.delete(sourceChunk);
16349
- let closestChunk = null;
16350
- let closestChunkDistance = Infinity;
16351
- const { signature, size, modules } = sourceChunk;
16352
- for (const targetChunk of concatLazy(chunksToBeMerged, unmergeableChunks)) {
16353
- const distance = getSignatureDistance(signature, targetChunk.signature, !chunksToBeMerged.has(targetChunk));
16354
- if (distance === 1) {
16355
- closestChunk = targetChunk;
16356
- break;
16357
- }
16358
- else if (distance < closestChunkDistance) {
16359
- closestChunk = targetChunk;
16360
- closestChunkDistance = distance;
16361
- }
16362
- }
16363
- if (closestChunk) {
16364
- closestChunk.modules.push(...modules);
16365
- if (chunksToBeMerged.has(closestChunk)) {
16366
- closestChunk.signature = mergeSignatures(signature, closestChunk.signature);
16367
- if ((closestChunk.size += size) > minChunkSize) {
16368
- chunksToBeMerged.delete(closestChunk);
16369
- unmergeableChunks.push(closestChunk);
16370
- }
16371
- }
16372
- }
16373
- else {
16374
- unmergeableChunks.push(sourceChunk);
16375
- }
16376
- }
16474
+ const chunkPartition = getPartitionedChunks(chunkModulesBySignature, minChunkSize);
16475
+ console.log(`Created ${chunkPartition.big.pure.size +
16476
+ chunkPartition.big.sideEffect.size +
16477
+ chunkPartition.small.pure.size +
16478
+ chunkPartition.small.sideEffect.size} chunks
16479
+ ----- pure side effects
16480
+ small ${`${chunkPartition.small.pure.size}`.padEnd(5, ' ')} ${chunkPartition.small.sideEffect.size}
16481
+ big ${`${chunkPartition.big.pure.size}`.padEnd(5, ' ')} ${chunkPartition.big.sideEffect.size}
16482
+ `);
16483
+ console.log(`Trying to find merge targets for ${chunkPartition.small.sideEffect.size} chunks smaller than ${prettyBytes(minChunkSize)} with side effects...`);
16484
+ mergeChunks(chunkPartition.small.sideEffect, [chunkPartition.small.pure, chunkPartition.big.pure], minChunkSize, chunkPartition);
16485
+ console.log(`${chunkPartition.small.sideEffect.size} chunks smaller than ${prettyBytes(minChunkSize)} with side effects remaining.\n`);
16486
+ console.log(`Trying to find merge targets for ${chunkPartition.small.pure.size} pure chunks smaller than ${prettyBytes(minChunkSize)}...`);
16487
+ mergeChunks(chunkPartition.small.pure, [chunkPartition.small.pure, chunkPartition.big.sideEffect, chunkPartition.big.pure], minChunkSize, chunkPartition);
16488
+ console.log(`${chunkPartition.small.pure.size} pure chunks smaller than ${prettyBytes(minChunkSize)} remaining.\n`);
16377
16489
  timeEnd('optimize chunks', 3);
16378
- return unmergeableChunks;
16490
+ const result = [
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;
16379
16498
  }
16380
16499
  const CHAR_DEPENDENT = 'X';
16381
16500
  const CHAR_INDEPENDENT = '_';
@@ -16397,28 +16516,76 @@ function getChunkModulesBySignature(assignedEntryPointsByModule, allEntryPoints)
16397
16516
  }
16398
16517
  return chunkModules;
16399
16518
  }
16400
- function getMergeableChunks(chunkModulesBySignature, minChunkSize) {
16401
- const chunksToBeMerged = new Set();
16402
- const unmergeableChunks = [];
16403
- const alias = null;
16519
+ function getPartitionedChunks(chunkModulesBySignature, minChunkSize) {
16520
+ const smallPureChunks = [];
16521
+ const bigPureChunks = [];
16522
+ const smallSideEffectChunks = [];
16523
+ const bigSideEffectChunks = [];
16404
16524
  for (const [signature, modules] of Object.entries(chunkModulesBySignature)) {
16405
16525
  let size = 0;
16406
- checkModules: {
16407
- for (const module of modules) {
16408
- if (module.hasEffects()) {
16409
- break checkModules;
16410
- }
16411
- size += module.magicString.toString().length;
16412
- if (size > minChunkSize) {
16413
- break checkModules;
16414
- }
16526
+ let pure = true;
16527
+ for (const module of modules) {
16528
+ pure && (pure = !module.hasEffects());
16529
+ size += module.magicString.toString().length;
16530
+ }
16531
+ (size < minChunkSize
16532
+ ? pure
16533
+ ? smallPureChunks
16534
+ : smallSideEffectChunks
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;
16415
16573
  }
16416
- chunksToBeMerged.add({ alias, modules, signature, size });
16417
- continue;
16418
16574
  }
16419
- unmergeableChunks.push({ alias, modules, signature, size: null });
16575
+ if (closestChunk) {
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
+ }
16420
16584
  }
16421
- return { chunksToBeMerged, unmergeableChunks };
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;
16422
16589
  }
16423
16590
  function getSignatureDistance(sourceSignature, targetSignature, enforceSubset) {
16424
16591
  let distance = 0;
@@ -25252,6 +25419,7 @@ exports.loadFsEvents = loadFsEvents;
25252
25419
  exports.mergeOptions = mergeOptions;
25253
25420
  exports.normalizePluginOption = normalizePluginOption;
25254
25421
  exports.picomatch = picomatch$1;
25422
+ exports.prettyBytes = prettyBytes;
25255
25423
  exports.printQuotedStringList = printQuotedStringList;
25256
25424
  exports.relativeId = relativeId;
25257
25425
  exports.rollup = rollup;
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.4.0-1
4
- Mon, 21 Nov 2022 05:22:41 GMT - commit f7a081a72fd85e7e80e3cbefa55fbfd88eb52a3f
3
+ Rollup.js v3.5.0-0
4
+ Fri, 25 Nov 2022 05:53:50 GMT - commit b8beb21aa83e193ed6ef82f06127e95a7ef5fe22
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.4.0-1
4
- Mon, 21 Nov 2022 05:22:41 GMT - commit f7a081a72fd85e7e80e3cbefa55fbfd88eb52a3f
3
+ Rollup.js v3.5.0-0
4
+ Fri, 25 Nov 2022 05:53:50 GMT - commit b8beb21aa83e193ed6ef82f06127e95a7ef5fe22
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rollup",
3
- "version": "3.4.0-1",
3
+ "version": "3.5.0-0",
4
4
  "description": "Next-generation ES module bundler",
5
5
  "main": "dist/rollup.js",
6
6
  "module": "dist/es/rollup.js",