rollup 3.6.0-0 → 3.6.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.6.0-0
6
- Sun, 27 Nov 2022 06:53:45 GMT - commit 03fdcc007bd49a4c88579d93053248ebe03dcef9
5
+ Rollup.js v3.6.0
6
+ Mon, 05 Dec 2022 11:26:13 GMT - commit de6675b4404a53f664769ba56bfdfdc56bf68531
7
7
 
8
8
  https://github.com/rollup/rollup
9
9
 
@@ -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, ${rollup.prettyBytes(memory)} / ${rollup.prettyBytes(total)}`;
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
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.6.0-0
4
- Sun, 27 Nov 2022 06:53:45 GMT - commit 03fdcc007bd49a4c88579d93053248ebe03dcef9
3
+ Rollup.js v3.6.0
4
+ Mon, 05 Dec 2022 11:26:13 GMT - commit de6675b4404a53f664769ba56bfdfdc56bf68531
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.6.0-0
4
- Sun, 27 Nov 2022 06:53:45 GMT - commit 03fdcc007bd49a4c88579d93053248ebe03dcef9
3
+ Rollup.js v3.6.0
4
+ Mon, 05 Dec 2022 11:26:13 GMT - commit de6675b4404a53f664769ba56bfdfdc56bf68531
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.6.0-0";
19
+ var version$1 = "3.6.0";
20
20
 
21
21
  var charToInteger = {};
22
22
  var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
@@ -2629,6 +2629,8 @@ class ExternalModule {
2629
2629
  get dynamicImporters() {
2630
2630
  return dynamicImporters.sort();
2631
2631
  },
2632
+ exportedBindings: null,
2633
+ exports: null,
2632
2634
  hasDefaultExport: null,
2633
2635
  get hasModuleSideEffects() {
2634
2636
  warnDeprecation('Accessing ModuleInfo.hasModuleSideEffects from plugins is deprecated. Please use ModuleInfo.moduleSideEffects instead.', true, options);
@@ -11253,12 +11255,7 @@ class PrivateIdentifier extends NodeBase {
11253
11255
  class Program extends NodeBase {
11254
11256
  constructor() {
11255
11257
  super(...arguments);
11256
- this.hasCachedEffect = null;
11257
- }
11258
- hasCachedEffects() {
11259
- return this.hasCachedEffect === null
11260
- ? (this.hasCachedEffect = this.hasEffects(createHasEffectsContext()))
11261
- : this.hasCachedEffect;
11258
+ this.hasCachedEffect = false;
11262
11259
  }
11263
11260
  hasEffects(context) {
11264
11261
  // We are caching here to later more efficiently identify side-effect-free modules
@@ -12820,7 +12817,7 @@ class Module {
12820
12817
  this.preserveSignature = this.options.preserveEntrySignatures;
12821
12818
  // eslint-disable-next-line @typescript-eslint/no-this-alias
12822
12819
  const module = this;
12823
- const { dynamicImports, dynamicImporters, implicitlyLoadedAfter, implicitlyLoadedBefore, importers, reexportDescriptions, sourcesWithAssertions } = this;
12820
+ const { dynamicImports, dynamicImporters, exportAllSources, exports, implicitlyLoadedAfter, implicitlyLoadedBefore, importers, reexportDescriptions, sourcesWithAssertions } = this;
12824
12821
  this.info = {
12825
12822
  assertions,
12826
12823
  ast: null,
@@ -12838,6 +12835,23 @@ class Module {
12838
12835
  get dynamicImporters() {
12839
12836
  return dynamicImporters.sort();
12840
12837
  },
12838
+ get exportedBindings() {
12839
+ const exportBindings = { '.': [...exports.keys()] };
12840
+ for (const [name, { source }] of reexportDescriptions) {
12841
+ (exportBindings[source] ?? (exportBindings[source] = [])).push(name);
12842
+ }
12843
+ for (const source of exportAllSources) {
12844
+ (exportBindings[source] ?? (exportBindings[source] = [])).push('*');
12845
+ }
12846
+ return exportBindings;
12847
+ },
12848
+ get exports() {
12849
+ return [
12850
+ ...exports.keys(),
12851
+ ...reexportDescriptions.keys(),
12852
+ ...[...exportAllSources].map(() => '*')
12853
+ ];
12854
+ },
12841
12855
  get hasDefaultExport() {
12842
12856
  // This information is only valid after parsing
12843
12857
  if (!module.ast) {
@@ -13101,7 +13115,8 @@ class Module {
13101
13115
  return [null];
13102
13116
  }
13103
13117
  hasEffects() {
13104
- return this.info.moduleSideEffects === 'no-treeshake' || this.ast.hasCachedEffects();
13118
+ return (this.info.moduleSideEffects === 'no-treeshake' ||
13119
+ (this.ast.included && this.ast.hasEffects(createHasEffectsContext())));
13105
13120
  }
13106
13121
  include() {
13107
13122
  const context = createInclusionContext();
@@ -15700,132 +15715,12 @@ function getImportedBindingsPerDependency(renderedDependencies, resolveFileName)
15700
15715
  const QUERY_HASH_REGEX = /[#?]/;
15701
15716
  const resolveFileName = (dependency) => dependency.getFileName();
15702
15717
 
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
-
15823
15718
  /**
15824
15719
  * Concatenate a number of iterables to a new iterable without fully evaluating
15825
15720
  * their iterators. Useful when e.g. working with large sets or lists and when
15826
15721
  * there is a chance that the iterators will not be fully exhausted.
15827
15722
  */
15828
- function* concatLazy(iterables) {
15723
+ function* concatLazy(...iterables) {
15829
15724
  for (const iterable of iterables) {
15830
15725
  yield* iterable;
15831
15726
  }
@@ -15951,49 +15846,43 @@ function createChunks(allEntryPoints, assignedEntryPointsByModule, minChunkSize)
15951
15846
  alias: null,
15952
15847
  modules
15953
15848
  }))
15954
- : getOptimizedChunks(chunkModulesBySignature, minChunkSize).map(({ modules }) => ({
15955
- alias: null,
15956
- modules
15957
- }));
15849
+ : getOptimizedChunks(chunkModulesBySignature, minChunkSize);
15958
15850
  }
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
- */
15971
15851
  function getOptimizedChunks(chunkModulesBySignature, minChunkSize) {
15972
15852
  timeStart('optimize chunks', 3);
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`);
15853
+ const { chunksToBeMerged, unmergeableChunks } = getMergeableChunks(chunkModulesBySignature, minChunkSize);
15854
+ for (const sourceChunk of chunksToBeMerged) {
15855
+ chunksToBeMerged.delete(sourceChunk);
15856
+ let closestChunk = null;
15857
+ let closestChunkDistance = Infinity;
15858
+ const { signature, size, modules } = sourceChunk;
15859
+ for (const targetChunk of concatLazy(chunksToBeMerged, unmergeableChunks)) {
15860
+ const distance = getSignatureDistance(signature, targetChunk.signature, !chunksToBeMerged.has(targetChunk));
15861
+ if (distance === 1) {
15862
+ closestChunk = targetChunk;
15863
+ break;
15864
+ }
15865
+ else if (distance < closestChunkDistance) {
15866
+ closestChunk = targetChunk;
15867
+ closestChunkDistance = distance;
15868
+ }
15869
+ }
15870
+ if (closestChunk) {
15871
+ closestChunk.modules.push(...modules);
15872
+ if (chunksToBeMerged.has(closestChunk)) {
15873
+ closestChunk.signature = mergeSignatures(signature, closestChunk.signature);
15874
+ if ((closestChunk.size += size) > minChunkSize) {
15875
+ chunksToBeMerged.delete(closestChunk);
15876
+ unmergeableChunks.push(closestChunk);
15877
+ }
15878
+ }
15879
+ }
15880
+ else {
15881
+ unmergeableChunks.push(sourceChunk);
15882
+ }
15883
+ }
15988
15884
  timeEnd('optimize chunks', 3);
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;
15885
+ return unmergeableChunks;
15997
15886
  }
15998
15887
  const CHAR_DEPENDENT = 'X';
15999
15888
  const CHAR_INDEPENDENT = '_';
@@ -16015,76 +15904,28 @@ function getChunkModulesBySignature(assignedEntryPointsByModule, allEntryPoints)
16015
15904
  }
16016
15905
  return chunkModules;
16017
15906
  }
16018
- function getPartitionedChunks(chunkModulesBySignature, minChunkSize) {
16019
- const smallPureChunks = [];
16020
- const bigPureChunks = [];
16021
- const smallSideEffectChunks = [];
16022
- const bigSideEffectChunks = [];
15907
+ function getMergeableChunks(chunkModulesBySignature, minChunkSize) {
15908
+ const chunksToBeMerged = new Set();
15909
+ const unmergeableChunks = [];
15910
+ const alias = null;
16023
15911
  for (const [signature, modules] of Object.entries(chunkModulesBySignature)) {
16024
15912
  let size = 0;
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;
15913
+ checkModules: {
15914
+ for (const module of modules) {
15915
+ if (module.hasEffects()) {
15916
+ break checkModules;
15917
+ }
15918
+ size += module.magicString.toString().length;
15919
+ if (size > minChunkSize) {
15920
+ break checkModules;
15921
+ }
16072
15922
  }
15923
+ chunksToBeMerged.add({ alias, modules, signature, size });
15924
+ continue;
16073
15925
  }
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
- }
15926
+ unmergeableChunks.push({ alias, modules, signature, size: null });
16083
15927
  }
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;
15928
+ return { chunksToBeMerged, unmergeableChunks };
16088
15929
  }
16089
15930
  function getSignatureDistance(sourceSignature, targetSignature, enforceSubset) {
16090
15931
  let distance = 0;
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.6.0-0
4
- Sun, 27 Nov 2022 06:53:45 GMT - commit 03fdcc007bd49a4c88579d93053248ebe03dcef9
3
+ Rollup.js v3.6.0
4
+ Mon, 05 Dec 2022 11:26:13 GMT - commit de6675b4404a53f664769ba56bfdfdc56bf68531
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.6.0-0
4
- Sun, 27 Nov 2022 06:53:45 GMT - commit 03fdcc007bd49a4c88579d93053248ebe03dcef9
3
+ Rollup.js v3.6.0
4
+ Mon, 05 Dec 2022 11:26:13 GMT - commit de6675b4404a53f664769ba56bfdfdc56bf68531
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
package/dist/rollup.d.ts CHANGED
@@ -157,6 +157,8 @@ interface ModuleInfo extends ModuleOptions {
157
157
  dynamicImporters: readonly string[];
158
158
  dynamicallyImportedIdResolutions: readonly ResolvedId[];
159
159
  dynamicallyImportedIds: readonly string[];
160
+ exportedBindings: Record<string, string[]> | null;
161
+ exports: string[] | null;
160
162
  hasDefaultExport: boolean | null;
161
163
  /** @deprecated Use `moduleSideEffects` instead */
162
164
  hasModuleSideEffects: boolean | 'no-treeshake';
@@ -927,3 +929,8 @@ interface AcornNode {
927
929
 
928
930
  export function defineConfig(options: RollupOptions): RollupOptions;
929
931
  export function defineConfig(options: RollupOptions[]): RollupOptions[];
932
+ export function defineConfig(optionsFunction: RollupOptionsFunction): RollupOptionsFunction;
933
+
934
+ export type RollupOptionsFunction = (
935
+ commandLineArguments: Record<string, any>
936
+ ) => MaybePromise<RollupOptions | RollupOptions[]>;
package/dist/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.6.0-0
4
- Sun, 27 Nov 2022 06:53:45 GMT - commit 03fdcc007bd49a4c88579d93053248ebe03dcef9
3
+ Rollup.js v3.6.0
4
+ Mon, 05 Dec 2022 11:26:13 GMT - commit de6675b4404a53f664769ba56bfdfdc56bf68531
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.6.0-0
4
- Sun, 27 Nov 2022 06:53:45 GMT - commit 03fdcc007bd49a4c88579d93053248ebe03dcef9
3
+ Rollup.js v3.6.0
4
+ Mon, 05 Dec 2022 11:26:13 GMT - commit de6675b4404a53f664769ba56bfdfdc56bf68531
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.6.0-0
4
- Sun, 27 Nov 2022 06:53:45 GMT - commit 03fdcc007bd49a4c88579d93053248ebe03dcef9
3
+ Rollup.js v3.6.0
4
+ Mon, 05 Dec 2022 11:26:13 GMT - commit de6675b4404a53f664769ba56bfdfdc56bf68531
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.6.0-0
4
- Sun, 27 Nov 2022 06:53:45 GMT - commit 03fdcc007bd49a4c88579d93053248ebe03dcef9
3
+ Rollup.js v3.6.0
4
+ Mon, 05 Dec 2022 11:26:13 GMT - commit de6675b4404a53f664769ba56bfdfdc56bf68531
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.6.0-0";
34
+ var version$1 = "3.6.0";
35
35
 
36
36
  function ensureArray$1(items) {
37
37
  if (Array.isArray(items)) {
@@ -3142,6 +3142,8 @@ class ExternalModule {
3142
3142
  get dynamicImporters() {
3143
3143
  return dynamicImporters.sort();
3144
3144
  },
3145
+ exportedBindings: null,
3146
+ exports: null,
3145
3147
  hasDefaultExport: null,
3146
3148
  get hasModuleSideEffects() {
3147
3149
  warnDeprecation('Accessing ModuleInfo.hasModuleSideEffects from plugins is deprecated. Please use ModuleInfo.moduleSideEffects instead.', true, options);
@@ -11768,12 +11770,7 @@ class PrivateIdentifier extends NodeBase {
11768
11770
  class Program extends NodeBase {
11769
11771
  constructor() {
11770
11772
  super(...arguments);
11771
- this.hasCachedEffect = null;
11772
- }
11773
- hasCachedEffects() {
11774
- return this.hasCachedEffect === null
11775
- ? (this.hasCachedEffect = this.hasEffects(createHasEffectsContext()))
11776
- : this.hasCachedEffect;
11773
+ this.hasCachedEffect = false;
11777
11774
  }
11778
11775
  hasEffects(context) {
11779
11776
  // We are caching here to later more efficiently identify side-effect-free modules
@@ -13335,7 +13332,7 @@ class Module {
13335
13332
  this.preserveSignature = this.options.preserveEntrySignatures;
13336
13333
  // eslint-disable-next-line @typescript-eslint/no-this-alias
13337
13334
  const module = this;
13338
- const { dynamicImports, dynamicImporters, implicitlyLoadedAfter, implicitlyLoadedBefore, importers, reexportDescriptions, sourcesWithAssertions } = this;
13335
+ const { dynamicImports, dynamicImporters, exportAllSources, exports, implicitlyLoadedAfter, implicitlyLoadedBefore, importers, reexportDescriptions, sourcesWithAssertions } = this;
13339
13336
  this.info = {
13340
13337
  assertions,
13341
13338
  ast: null,
@@ -13353,6 +13350,23 @@ class Module {
13353
13350
  get dynamicImporters() {
13354
13351
  return dynamicImporters.sort();
13355
13352
  },
13353
+ get exportedBindings() {
13354
+ const exportBindings = { '.': [...exports.keys()] };
13355
+ for (const [name, { source }] of reexportDescriptions) {
13356
+ (exportBindings[source] ?? (exportBindings[source] = [])).push(name);
13357
+ }
13358
+ for (const source of exportAllSources) {
13359
+ (exportBindings[source] ?? (exportBindings[source] = [])).push('*');
13360
+ }
13361
+ return exportBindings;
13362
+ },
13363
+ get exports() {
13364
+ return [
13365
+ ...exports.keys(),
13366
+ ...reexportDescriptions.keys(),
13367
+ ...[...exportAllSources].map(() => '*')
13368
+ ];
13369
+ },
13356
13370
  get hasDefaultExport() {
13357
13371
  // This information is only valid after parsing
13358
13372
  if (!module.ast) {
@@ -13616,7 +13630,8 @@ class Module {
13616
13630
  return [null];
13617
13631
  }
13618
13632
  hasEffects() {
13619
- return this.info.moduleSideEffects === 'no-treeshake' || this.ast.hasCachedEffects();
13633
+ return (this.info.moduleSideEffects === 'no-treeshake' ||
13634
+ (this.ast.included && this.ast.hasEffects(createHasEffectsContext())));
13620
13635
  }
13621
13636
  include() {
13622
13637
  const context = createInclusionContext();
@@ -16215,132 +16230,12 @@ function getImportedBindingsPerDependency(renderedDependencies, resolveFileName)
16215
16230
  const QUERY_HASH_REGEX = /[#?]/;
16216
16231
  const resolveFileName = (dependency) => dependency.getFileName();
16217
16232
 
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
-
16338
16233
  /**
16339
16234
  * Concatenate a number of iterables to a new iterable without fully evaluating
16340
16235
  * their iterators. Useful when e.g. working with large sets or lists and when
16341
16236
  * there is a chance that the iterators will not be fully exhausted.
16342
16237
  */
16343
- function* concatLazy(iterables) {
16238
+ function* concatLazy(...iterables) {
16344
16239
  for (const iterable of iterables) {
16345
16240
  yield* iterable;
16346
16241
  }
@@ -16466,49 +16361,43 @@ function createChunks(allEntryPoints, assignedEntryPointsByModule, minChunkSize)
16466
16361
  alias: null,
16467
16362
  modules
16468
16363
  }))
16469
- : getOptimizedChunks(chunkModulesBySignature, minChunkSize).map(({ modules }) => ({
16470
- alias: null,
16471
- modules
16472
- }));
16364
+ : getOptimizedChunks(chunkModulesBySignature, minChunkSize);
16473
16365
  }
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
- */
16486
16366
  function getOptimizedChunks(chunkModulesBySignature, minChunkSize) {
16487
16367
  timeStart('optimize chunks', 3);
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`);
16368
+ const { chunksToBeMerged, unmergeableChunks } = getMergeableChunks(chunkModulesBySignature, minChunkSize);
16369
+ for (const sourceChunk of chunksToBeMerged) {
16370
+ chunksToBeMerged.delete(sourceChunk);
16371
+ let closestChunk = null;
16372
+ let closestChunkDistance = Infinity;
16373
+ const { signature, size, modules } = sourceChunk;
16374
+ for (const targetChunk of concatLazy(chunksToBeMerged, unmergeableChunks)) {
16375
+ const distance = getSignatureDistance(signature, targetChunk.signature, !chunksToBeMerged.has(targetChunk));
16376
+ if (distance === 1) {
16377
+ closestChunk = targetChunk;
16378
+ break;
16379
+ }
16380
+ else if (distance < closestChunkDistance) {
16381
+ closestChunk = targetChunk;
16382
+ closestChunkDistance = distance;
16383
+ }
16384
+ }
16385
+ if (closestChunk) {
16386
+ closestChunk.modules.push(...modules);
16387
+ if (chunksToBeMerged.has(closestChunk)) {
16388
+ closestChunk.signature = mergeSignatures(signature, closestChunk.signature);
16389
+ if ((closestChunk.size += size) > minChunkSize) {
16390
+ chunksToBeMerged.delete(closestChunk);
16391
+ unmergeableChunks.push(closestChunk);
16392
+ }
16393
+ }
16394
+ }
16395
+ else {
16396
+ unmergeableChunks.push(sourceChunk);
16397
+ }
16398
+ }
16503
16399
  timeEnd('optimize chunks', 3);
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;
16400
+ return unmergeableChunks;
16512
16401
  }
16513
16402
  const CHAR_DEPENDENT = 'X';
16514
16403
  const CHAR_INDEPENDENT = '_';
@@ -16530,76 +16419,28 @@ function getChunkModulesBySignature(assignedEntryPointsByModule, allEntryPoints)
16530
16419
  }
16531
16420
  return chunkModules;
16532
16421
  }
16533
- function getPartitionedChunks(chunkModulesBySignature, minChunkSize) {
16534
- const smallPureChunks = [];
16535
- const bigPureChunks = [];
16536
- const smallSideEffectChunks = [];
16537
- const bigSideEffectChunks = [];
16422
+ function getMergeableChunks(chunkModulesBySignature, minChunkSize) {
16423
+ const chunksToBeMerged = new Set();
16424
+ const unmergeableChunks = [];
16425
+ const alias = null;
16538
16426
  for (const [signature, modules] of Object.entries(chunkModulesBySignature)) {
16539
16427
  let size = 0;
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;
16428
+ checkModules: {
16429
+ for (const module of modules) {
16430
+ if (module.hasEffects()) {
16431
+ break checkModules;
16432
+ }
16433
+ size += module.magicString.toString().length;
16434
+ if (size > minChunkSize) {
16435
+ break checkModules;
16436
+ }
16587
16437
  }
16438
+ chunksToBeMerged.add({ alias, modules, signature, size });
16439
+ continue;
16588
16440
  }
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
- }
16441
+ unmergeableChunks.push({ alias, modules, signature, size: null });
16598
16442
  }
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;
16443
+ return { chunksToBeMerged, unmergeableChunks };
16603
16444
  }
16604
16445
  function getSignatureDistance(sourceSignature, targetSignature, enforceSubset) {
16605
16446
  let distance = 0;
@@ -25433,7 +25274,6 @@ exports.loadFsEvents = loadFsEvents;
25433
25274
  exports.mergeOptions = mergeOptions;
25434
25275
  exports.normalizePluginOption = normalizePluginOption;
25435
25276
  exports.picomatch = picomatch$1;
25436
- exports.prettyBytes = prettyBytes;
25437
25277
  exports.printQuotedStringList = printQuotedStringList;
25438
25278
  exports.relativeId = relativeId;
25439
25279
  exports.rollup = rollup;
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.6.0-0
4
- Sun, 27 Nov 2022 06:53:45 GMT - commit 03fdcc007bd49a4c88579d93053248ebe03dcef9
3
+ Rollup.js v3.6.0
4
+ Mon, 05 Dec 2022 11:26:13 GMT - commit de6675b4404a53f664769ba56bfdfdc56bf68531
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.6.0-0
4
- Sun, 27 Nov 2022 06:53:45 GMT - commit 03fdcc007bd49a4c88579d93053248ebe03dcef9
3
+ Rollup.js v3.6.0
4
+ Mon, 05 Dec 2022 11:26:13 GMT - commit de6675b4404a53f664769ba56bfdfdc56bf68531
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.6.0-0",
3
+ "version": "3.6.0",
4
4
  "description": "Next-generation ES module bundler",
5
5
  "main": "dist/rollup.js",
6
6
  "module": "dist/es/rollup.js",