rollup 3.7.5 → 3.7.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.7.5
6
- Sat, 17 Dec 2022 05:47:48 GMT - commit 5613b96ac5f32a881ed50a275398e140fbf6ba2b
5
+ Rollup.js v3.7.6-0
6
+ Sun, 18 Dec 2022 05:56:49 GMT - commit d226f7976dc543ff814af389e183d627d4e94ed4
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.7.5
4
- Sat, 17 Dec 2022 05:47:48 GMT - commit 5613b96ac5f32a881ed50a275398e140fbf6ba2b
3
+ Rollup.js v3.7.6-0
4
+ Sun, 18 Dec 2022 05:56:49 GMT - commit d226f7976dc543ff814af389e183d627d4e94ed4
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.7.5
4
- Sat, 17 Dec 2022 05:47:48 GMT - commit 5613b96ac5f32a881ed50a275398e140fbf6ba2b
3
+ Rollup.js v3.7.6-0
4
+ Sun, 18 Dec 2022 05:56:49 GMT - commit d226f7976dc543ff814af389e183d627d4e94ed4
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.7.5";
19
+ var version$1 = "3.7.6-0";
20
20
 
21
21
  var charToInteger = {};
22
22
  var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
@@ -11279,7 +11279,12 @@ class PrivateIdentifier extends NodeBase {
11279
11279
  class Program extends NodeBase {
11280
11280
  constructor() {
11281
11281
  super(...arguments);
11282
- this.hasCachedEffect = false;
11282
+ this.hasCachedEffect = null;
11283
+ }
11284
+ hasCachedEffects() {
11285
+ return this.hasCachedEffect === null
11286
+ ? (this.hasCachedEffect = this.hasEffects(createHasEffectsContext()))
11287
+ : this.hasCachedEffect;
11283
11288
  }
11284
11289
  hasEffects(context) {
11285
11290
  // We are caching here to later more efficiently identify side-effect-free modules
@@ -13181,8 +13186,7 @@ class Module {
13181
13186
  return [null];
13182
13187
  }
13183
13188
  hasEffects() {
13184
- return (this.info.moduleSideEffects === 'no-treeshake' ||
13185
- (this.ast.included && this.ast.hasEffects(createHasEffectsContext())));
13189
+ return this.info.moduleSideEffects === 'no-treeshake' || this.ast.hasCachedEffects();
13186
13190
  }
13187
13191
  include() {
13188
13192
  const context = createInclusionContext();
@@ -15781,12 +15785,132 @@ function getImportedBindingsPerDependency(renderedDependencies, resolveFileName)
15781
15785
  const QUERY_HASH_REGEX = /[#?]/;
15782
15786
  const resolveFileName = (dependency) => dependency.getFileName();
15783
15787
 
15788
+ const BYTE_UNITS = [
15789
+ 'B',
15790
+ 'kB',
15791
+ 'MB',
15792
+ 'GB',
15793
+ 'TB',
15794
+ 'PB',
15795
+ 'EB',
15796
+ 'ZB',
15797
+ 'YB',
15798
+ ];
15799
+
15800
+ const BIBYTE_UNITS = [
15801
+ 'B',
15802
+ 'kiB',
15803
+ 'MiB',
15804
+ 'GiB',
15805
+ 'TiB',
15806
+ 'PiB',
15807
+ 'EiB',
15808
+ 'ZiB',
15809
+ 'YiB',
15810
+ ];
15811
+
15812
+ const BIT_UNITS = [
15813
+ 'b',
15814
+ 'kbit',
15815
+ 'Mbit',
15816
+ 'Gbit',
15817
+ 'Tbit',
15818
+ 'Pbit',
15819
+ 'Ebit',
15820
+ 'Zbit',
15821
+ 'Ybit',
15822
+ ];
15823
+
15824
+ const BIBIT_UNITS = [
15825
+ 'b',
15826
+ 'kibit',
15827
+ 'Mibit',
15828
+ 'Gibit',
15829
+ 'Tibit',
15830
+ 'Pibit',
15831
+ 'Eibit',
15832
+ 'Zibit',
15833
+ 'Yibit',
15834
+ ];
15835
+
15836
+ /*
15837
+ Formats the given number using `Number#toLocaleString`.
15838
+ - If locale is a string, the value is expected to be a locale-key (for example: `de`).
15839
+ - If locale is true, the system default locale is used for translation.
15840
+ - If no value for locale is specified, the number is returned unmodified.
15841
+ */
15842
+ const toLocaleString = (number, locale, options) => {
15843
+ let result = number;
15844
+ if (typeof locale === 'string' || Array.isArray(locale)) {
15845
+ result = number.toLocaleString(locale, options);
15846
+ } else if (locale === true || options !== undefined) {
15847
+ result = number.toLocaleString(undefined, options);
15848
+ }
15849
+
15850
+ return result;
15851
+ };
15852
+
15853
+ function prettyBytes(number, options) {
15854
+ if (!Number.isFinite(number)) {
15855
+ throw new TypeError(`Expected a finite number, got ${typeof number}: ${number}`);
15856
+ }
15857
+
15858
+ options = {
15859
+ bits: false,
15860
+ binary: false,
15861
+ ...options,
15862
+ };
15863
+
15864
+ const UNITS = options.bits
15865
+ ? (options.binary ? BIBIT_UNITS : BIT_UNITS)
15866
+ : (options.binary ? BIBYTE_UNITS : BYTE_UNITS);
15867
+
15868
+ if (options.signed && number === 0) {
15869
+ return ` 0 ${UNITS[0]}`;
15870
+ }
15871
+
15872
+ const isNegative = number < 0;
15873
+ const prefix = isNegative ? '-' : (options.signed ? '+' : '');
15874
+
15875
+ if (isNegative) {
15876
+ number = -number;
15877
+ }
15878
+
15879
+ let localeOptions;
15880
+
15881
+ if (options.minimumFractionDigits !== undefined) {
15882
+ localeOptions = {minimumFractionDigits: options.minimumFractionDigits};
15883
+ }
15884
+
15885
+ if (options.maximumFractionDigits !== undefined) {
15886
+ localeOptions = {maximumFractionDigits: options.maximumFractionDigits, ...localeOptions};
15887
+ }
15888
+
15889
+ if (number < 1) {
15890
+ const numberString = toLocaleString(number, options.locale, localeOptions);
15891
+ return prefix + numberString + ' ' + UNITS[0];
15892
+ }
15893
+
15894
+ const exponent = Math.min(Math.floor(options.binary ? Math.log(number) / Math.log(1024) : Math.log10(number) / 3), UNITS.length - 1);
15895
+ number /= (options.binary ? 1024 : 1000) ** exponent;
15896
+
15897
+ if (!localeOptions) {
15898
+ number = number.toPrecision(3);
15899
+ }
15900
+
15901
+ const numberString = toLocaleString(Number(number), options.locale, localeOptions);
15902
+
15903
+ const unit = UNITS[exponent];
15904
+
15905
+ return prefix + numberString + ' ' + unit;
15906
+ }
15907
+
15784
15908
  /**
15785
15909
  * Concatenate a number of iterables to a new iterable without fully evaluating
15786
15910
  * their iterators. Useful when e.g. working with large sets or lists and when
15787
15911
  * there is a chance that the iterators will not be fully exhausted.
15788
15912
  */
15789
- function* concatLazy(...iterables) {
15913
+ function* concatLazy(iterables) {
15790
15914
  for (const iterable of iterables) {
15791
15915
  yield* iterable;
15792
15916
  }
@@ -15927,47 +16051,11 @@ function createChunks(allEntries, assignedEntriesByModule, minChunkSize) {
15927
16051
  alias: null,
15928
16052
  modules
15929
16053
  }))
15930
- : getOptimizedChunks(chunkModulesBySignature, minChunkSize);
15931
- }
15932
- function getOptimizedChunks(chunkModulesBySignature, minChunkSize) {
15933
- timeStart('optimize chunks', 3);
15934
- const { chunksToBeMerged, unmergeableChunks } = getMergeableChunks(chunkModulesBySignature, minChunkSize);
15935
- for (const sourceChunk of chunksToBeMerged) {
15936
- chunksToBeMerged.delete(sourceChunk);
15937
- let closestChunk = null;
15938
- let closestChunkDistance = Infinity;
15939
- const { signature, size, modules } = sourceChunk;
15940
- for (const targetChunk of concatLazy(chunksToBeMerged, unmergeableChunks)) {
15941
- const distance = getSignatureDistance(signature, targetChunk.signature, !chunksToBeMerged.has(targetChunk));
15942
- if (distance === 1) {
15943
- closestChunk = targetChunk;
15944
- break;
15945
- }
15946
- else if (distance < closestChunkDistance) {
15947
- closestChunk = targetChunk;
15948
- closestChunkDistance = distance;
15949
- }
15950
- }
15951
- if (closestChunk) {
15952
- closestChunk.modules.push(...modules);
15953
- if (chunksToBeMerged.has(closestChunk)) {
15954
- closestChunk.signature = mergeSignatures(signature, closestChunk.signature);
15955
- if ((closestChunk.size += size) > minChunkSize) {
15956
- chunksToBeMerged.delete(closestChunk);
15957
- unmergeableChunks.push(closestChunk);
15958
- }
15959
- }
15960
- }
15961
- else {
15962
- unmergeableChunks.push(sourceChunk);
15963
- }
15964
- }
15965
- timeEnd('optimize chunks', 3);
15966
- return unmergeableChunks;
16054
+ : getOptimizedChunks(chunkModulesBySignature, minChunkSize).map(({ modules }) => ({
16055
+ alias: null,
16056
+ modules
16057
+ }));
15967
16058
  }
15968
- const CHAR_DEPENDENT = 'X';
15969
- const CHAR_INDEPENDENT = '_';
15970
- const CHAR_CODE_DEPENDENT = CHAR_DEPENDENT.charCodeAt(0);
15971
16059
  function getChunkModulesBySignature(assignedEntriesByModule, allEntries) {
15972
16060
  const chunkModules = Object.create(null);
15973
16061
  for (const [module, assignedEntries] of assignedEntriesByModule) {
@@ -15985,28 +16073,205 @@ function getChunkModulesBySignature(assignedEntriesByModule, allEntries) {
15985
16073
  }
15986
16074
  return chunkModules;
15987
16075
  }
15988
- function getMergeableChunks(chunkModulesBySignature, minChunkSize) {
15989
- const chunksToBeMerged = new Set();
15990
- const unmergeableChunks = [];
15991
- const alias = null;
16076
+ /**
16077
+ * This function tries to get rid of small chunks by merging them with other
16078
+ * chunks. In order to merge chunks, one must obey the following rule:
16079
+ * - When merging several chunks, at most one of the chunks can have side
16080
+ * effects
16081
+ * - When one of the chunks has side effects, the entry points depending on that
16082
+ * chunk need to be a super set of the entry points depending on the other
16083
+ * chunks
16084
+ * - Pure chunks can always be merged
16085
+ * - We use the entry point dependence signature to calculate "chunk distance",
16086
+ * i.e. how likely it is that two chunks are loaded together
16087
+ */
16088
+ function getOptimizedChunks(chunkModulesBySignature, minChunkSize) {
16089
+ timeStart('optimize chunks', 3);
16090
+ const chunkPartition = getPartitionedChunks(chunkModulesBySignature, minChunkSize);
16091
+ console.log(`Created ${chunkPartition.big.pure.size +
16092
+ chunkPartition.big.sideEffect.size +
16093
+ chunkPartition.small.pure.size +
16094
+ chunkPartition.small.sideEffect.size} chunks
16095
+ ----- pure side effects
16096
+ small ${`${chunkPartition.small.pure.size}`.padEnd(5, ' ')} ${chunkPartition.small.sideEffect.size}
16097
+ big ${`${chunkPartition.big.pure.size}`.padEnd(5, ' ')} ${chunkPartition.big.sideEffect.size}
16098
+ Unoptimized chunks contain ${getNumberOfCycles(chunkPartition)} cycles.
16099
+ `);
16100
+ if (chunkPartition.small.sideEffect.size > 0) {
16101
+ console.log(`Trying to find merge targets for ${chunkPartition.small.sideEffect.size} chunks smaller than ${prettyBytes(minChunkSize)} with side effects...`);
16102
+ mergeChunks(chunkPartition.small.sideEffect, [chunkPartition.small.pure, chunkPartition.big.pure], minChunkSize, chunkPartition);
16103
+ console.log(`${chunkPartition.small.sideEffect.size} chunks smaller than ${prettyBytes(minChunkSize)} with side effects remaining.\nGenerated chunks contain ${getNumberOfCycles(chunkPartition)} cycles.\n`);
16104
+ }
16105
+ if (chunkPartition.small.pure.size > 0) {
16106
+ console.log(`Trying to find merge targets for ${chunkPartition.small.pure.size} pure chunks smaller than ${prettyBytes(minChunkSize)}...`);
16107
+ mergeChunks(chunkPartition.small.pure, [chunkPartition.small.pure, chunkPartition.big.sideEffect, chunkPartition.big.pure], minChunkSize, chunkPartition);
16108
+ console.log(`${chunkPartition.small.pure.size} pure chunks smaller than ${prettyBytes(minChunkSize)} remaining.\nGenerated chunks contain ${getNumberOfCycles(chunkPartition)} cycles.\n`);
16109
+ }
16110
+ timeEnd('optimize chunks', 3);
16111
+ const result = [
16112
+ ...chunkPartition.small.sideEffect,
16113
+ ...chunkPartition.small.pure,
16114
+ ...chunkPartition.big.sideEffect,
16115
+ ...chunkPartition.big.pure
16116
+ ];
16117
+ console.log(`${result.length} chunks remaining.`);
16118
+ return result;
16119
+ }
16120
+ const CHAR_DEPENDENT = 'X';
16121
+ const CHAR_INDEPENDENT = '_';
16122
+ const CHAR_CODE_DEPENDENT = CHAR_DEPENDENT.charCodeAt(0);
16123
+ function getPartitionedChunks(chunkModulesBySignature, minChunkSize) {
16124
+ const smallPureChunks = [];
16125
+ const bigPureChunks = [];
16126
+ const smallSideEffectChunks = [];
16127
+ const bigSideEffectChunks = [];
16128
+ const chunkByModule = new Map();
15992
16129
  for (const [signature, modules] of Object.entries(chunkModulesBySignature)) {
16130
+ const chunkDescription = {
16131
+ dependencies: new Set(),
16132
+ dependentChunks: new Set(),
16133
+ modules,
16134
+ pure: true,
16135
+ signature,
16136
+ size: 0
16137
+ };
15993
16138
  let size = 0;
15994
- checkModules: {
16139
+ let pure = true;
16140
+ for (const module of modules) {
16141
+ chunkByModule.set(module, chunkDescription);
16142
+ pure && (pure = !module.hasEffects());
16143
+ // Unfortunately, we cannot take tree-shaking into account here because
16144
+ // rendering did not happen yet
16145
+ size += module.originalCode.length;
16146
+ }
16147
+ chunkDescription.pure = pure;
16148
+ chunkDescription.size = size;
16149
+ (size < minChunkSize
16150
+ ? pure
16151
+ ? smallPureChunks
16152
+ : smallSideEffectChunks
16153
+ : pure
16154
+ ? bigPureChunks
16155
+ : bigSideEffectChunks).push(chunkDescription);
16156
+ }
16157
+ sortChunksAndAddDependencies([bigPureChunks, bigSideEffectChunks, smallPureChunks, smallSideEffectChunks], chunkByModule);
16158
+ return {
16159
+ big: { pure: new Set(bigPureChunks), sideEffect: new Set(bigSideEffectChunks) },
16160
+ small: { pure: new Set(smallPureChunks), sideEffect: new Set(smallSideEffectChunks) }
16161
+ };
16162
+ }
16163
+ function getNumberOfCycles(partition) {
16164
+ const parents = new Set();
16165
+ const analysedChunks = new Set();
16166
+ let cycles = 0;
16167
+ const analyseChunk = (chunk) => {
16168
+ for (const dependency of chunk.dependencies) {
16169
+ if (parents.has(dependency)) {
16170
+ if (!analysedChunks.has(dependency)) {
16171
+ cycles++;
16172
+ }
16173
+ continue;
16174
+ }
16175
+ parents.add(dependency);
16176
+ analyseChunk(dependency);
16177
+ }
16178
+ analysedChunks.add(chunk);
16179
+ };
16180
+ for (const chunk of [
16181
+ ...partition.big.pure,
16182
+ ...partition.big.sideEffect,
16183
+ ...partition.small.pure,
16184
+ ...partition.small.sideEffect
16185
+ ]) {
16186
+ if (!parents.has(chunk)) {
16187
+ parents.add(chunk);
16188
+ analyseChunk(chunk);
16189
+ }
16190
+ }
16191
+ return cycles;
16192
+ }
16193
+ function sortChunksAndAddDependencies(chunkLists, chunkByModule) {
16194
+ for (const chunks of chunkLists) {
16195
+ chunks.sort(compareChunks);
16196
+ for (const chunk of chunks) {
16197
+ const { dependencies, modules } = chunk;
15995
16198
  for (const module of modules) {
15996
- if (module.hasEffects()) {
15997
- break checkModules;
16199
+ for (const dependency of module.getDependenciesToBeIncluded()) {
16200
+ const dependencyChunk = chunkByModule.get(dependency);
16201
+ if (dependencyChunk && dependencyChunk !== chunk) {
16202
+ dependencies.add(dependencyChunk);
16203
+ dependencyChunk.dependentChunks.add(chunk);
16204
+ }
15998
16205
  }
15999
- size += module.magicString.toString().length;
16000
- if (size > minChunkSize) {
16001
- break checkModules;
16206
+ }
16207
+ }
16208
+ }
16209
+ }
16210
+ function compareChunks({ size: sizeA }, { size: sizeB }) {
16211
+ return sizeA - sizeB;
16212
+ }
16213
+ function mergeChunks(chunksToBeMerged, targetChunks, minChunkSize, chunkPartition) {
16214
+ for (const mergedChunk of chunksToBeMerged) {
16215
+ let closestChunk = null;
16216
+ let closestChunkDistance = Infinity;
16217
+ const { signature, modules, pure, size } = mergedChunk;
16218
+ for (const targetChunk of concatLazy(targetChunks)) {
16219
+ if (mergedChunk === targetChunk)
16220
+ continue;
16221
+ const distance = pure
16222
+ ? getSignatureDistance(signature, targetChunk.signature, !targetChunk.pure)
16223
+ : getSignatureDistance(targetChunk.signature, signature, true);
16224
+ if (distance < closestChunkDistance && isValidMerge(mergedChunk, targetChunk)) {
16225
+ if (distance === 1) {
16226
+ closestChunk = targetChunk;
16227
+ break;
16002
16228
  }
16229
+ closestChunk = targetChunk;
16230
+ closestChunkDistance = distance;
16003
16231
  }
16004
- chunksToBeMerged.add({ alias, modules, signature, size });
16005
- continue;
16006
16232
  }
16007
- unmergeableChunks.push({ alias, modules, signature, size: null });
16233
+ if (closestChunk) {
16234
+ chunksToBeMerged.delete(mergedChunk);
16235
+ getChunksInPartition(closestChunk, minChunkSize, chunkPartition).delete(closestChunk);
16236
+ closestChunk.modules.push(...modules);
16237
+ closestChunk.size += size;
16238
+ closestChunk.pure && (closestChunk.pure = pure);
16239
+ closestChunk.signature = mergeSignatures(signature, closestChunk.signature);
16240
+ const { dependencies, dependentChunks } = closestChunk;
16241
+ for (const dependency of mergedChunk.dependencies) {
16242
+ dependencies.add(dependency);
16243
+ }
16244
+ for (const dependentChunk of mergedChunk.dependentChunks) {
16245
+ dependentChunks.add(dependentChunk);
16246
+ dependentChunk.dependencies.delete(mergedChunk);
16247
+ dependentChunk.dependencies.add(closestChunk);
16248
+ }
16249
+ dependencies.delete(closestChunk);
16250
+ getChunksInPartition(closestChunk, minChunkSize, chunkPartition).add(closestChunk);
16251
+ }
16252
+ }
16253
+ }
16254
+ // Merging will not produce cycles if none of the direct non-merged dependencies
16255
+ // of a chunk have the other chunk as a transitive dependency
16256
+ function isValidMerge(mergedChunk, targetChunk) {
16257
+ return !(hasTransitiveDependency(mergedChunk, targetChunk) ||
16258
+ hasTransitiveDependency(targetChunk, mergedChunk));
16259
+ }
16260
+ function hasTransitiveDependency(dependentChunk, dependencyChunk) {
16261
+ const chunksToCheck = new Set(dependentChunk.dependencies);
16262
+ for (const { dependencies } of chunksToCheck) {
16263
+ for (const dependency of dependencies) {
16264
+ if (dependency === dependencyChunk) {
16265
+ return true;
16266
+ }
16267
+ chunksToCheck.add(dependency);
16268
+ }
16008
16269
  }
16009
- return { chunksToBeMerged, unmergeableChunks };
16270
+ return false;
16271
+ }
16272
+ function getChunksInPartition(chunk, minChunkSize, chunkPartition) {
16273
+ const subPartition = chunk.size < minChunkSize ? chunkPartition.small : chunkPartition.big;
16274
+ return chunk.pure ? subPartition.pure : subPartition.sideEffect;
16010
16275
  }
16011
16276
  function getSignatureDistance(sourceSignature, targetSignature, enforceSubset) {
16012
16277
  let distance = 0;
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.7.5
4
- Sat, 17 Dec 2022 05:47:48 GMT - commit 5613b96ac5f32a881ed50a275398e140fbf6ba2b
3
+ Rollup.js v3.7.6-0
4
+ Sun, 18 Dec 2022 05:56:49 GMT - commit d226f7976dc543ff814af389e183d627d4e94ed4
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.7.5
4
- Sat, 17 Dec 2022 05:47:48 GMT - commit 5613b96ac5f32a881ed50a275398e140fbf6ba2b
3
+ Rollup.js v3.7.6-0
4
+ Sun, 18 Dec 2022 05:56:49 GMT - commit d226f7976dc543ff814af389e183d627d4e94ed4
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.7.5
4
- Sat, 17 Dec 2022 05:47:48 GMT - commit 5613b96ac5f32a881ed50a275398e140fbf6ba2b
3
+ Rollup.js v3.7.6-0
4
+ Sun, 18 Dec 2022 05:56:49 GMT - commit d226f7976dc543ff814af389e183d627d4e94ed4
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.7.5
4
- Sat, 17 Dec 2022 05:47:48 GMT - commit 5613b96ac5f32a881ed50a275398e140fbf6ba2b
3
+ Rollup.js v3.7.6-0
4
+ Sun, 18 Dec 2022 05:56:49 GMT - commit d226f7976dc543ff814af389e183d627d4e94ed4
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.7.5
4
- Sat, 17 Dec 2022 05:47:48 GMT - commit 5613b96ac5f32a881ed50a275398e140fbf6ba2b
3
+ Rollup.js v3.7.6-0
4
+ Sun, 18 Dec 2022 05:56:49 GMT - commit d226f7976dc543ff814af389e183d627d4e94ed4
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.7.5
4
- Sat, 17 Dec 2022 05:47:48 GMT - commit 5613b96ac5f32a881ed50a275398e140fbf6ba2b
3
+ Rollup.js v3.7.6-0
4
+ Sun, 18 Dec 2022 05:56:49 GMT - commit d226f7976dc543ff814af389e183d627d4e94ed4
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.7.5";
34
+ var version$1 = "3.7.6-0";
35
35
 
36
36
  function ensureArray$1(items) {
37
37
  if (Array.isArray(items)) {
@@ -11795,7 +11795,12 @@ class PrivateIdentifier extends NodeBase {
11795
11795
  class Program extends NodeBase {
11796
11796
  constructor() {
11797
11797
  super(...arguments);
11798
- this.hasCachedEffect = false;
11798
+ this.hasCachedEffect = null;
11799
+ }
11800
+ hasCachedEffects() {
11801
+ return this.hasCachedEffect === null
11802
+ ? (this.hasCachedEffect = this.hasEffects(createHasEffectsContext()))
11803
+ : this.hasCachedEffect;
11799
11804
  }
11800
11805
  hasEffects(context) {
11801
11806
  // We are caching here to later more efficiently identify side-effect-free modules
@@ -13697,8 +13702,7 @@ class Module {
13697
13702
  return [null];
13698
13703
  }
13699
13704
  hasEffects() {
13700
- return (this.info.moduleSideEffects === 'no-treeshake' ||
13701
- (this.ast.included && this.ast.hasEffects(createHasEffectsContext())));
13705
+ return this.info.moduleSideEffects === 'no-treeshake' || this.ast.hasCachedEffects();
13702
13706
  }
13703
13707
  include() {
13704
13708
  const context = createInclusionContext();
@@ -16297,12 +16301,132 @@ function getImportedBindingsPerDependency(renderedDependencies, resolveFileName)
16297
16301
  const QUERY_HASH_REGEX = /[#?]/;
16298
16302
  const resolveFileName = (dependency) => dependency.getFileName();
16299
16303
 
16304
+ const BYTE_UNITS = [
16305
+ 'B',
16306
+ 'kB',
16307
+ 'MB',
16308
+ 'GB',
16309
+ 'TB',
16310
+ 'PB',
16311
+ 'EB',
16312
+ 'ZB',
16313
+ 'YB',
16314
+ ];
16315
+
16316
+ const BIBYTE_UNITS = [
16317
+ 'B',
16318
+ 'kiB',
16319
+ 'MiB',
16320
+ 'GiB',
16321
+ 'TiB',
16322
+ 'PiB',
16323
+ 'EiB',
16324
+ 'ZiB',
16325
+ 'YiB',
16326
+ ];
16327
+
16328
+ const BIT_UNITS = [
16329
+ 'b',
16330
+ 'kbit',
16331
+ 'Mbit',
16332
+ 'Gbit',
16333
+ 'Tbit',
16334
+ 'Pbit',
16335
+ 'Ebit',
16336
+ 'Zbit',
16337
+ 'Ybit',
16338
+ ];
16339
+
16340
+ const BIBIT_UNITS = [
16341
+ 'b',
16342
+ 'kibit',
16343
+ 'Mibit',
16344
+ 'Gibit',
16345
+ 'Tibit',
16346
+ 'Pibit',
16347
+ 'Eibit',
16348
+ 'Zibit',
16349
+ 'Yibit',
16350
+ ];
16351
+
16352
+ /*
16353
+ Formats the given number using `Number#toLocaleString`.
16354
+ - If locale is a string, the value is expected to be a locale-key (for example: `de`).
16355
+ - If locale is true, the system default locale is used for translation.
16356
+ - If no value for locale is specified, the number is returned unmodified.
16357
+ */
16358
+ const toLocaleString = (number, locale, options) => {
16359
+ let result = number;
16360
+ if (typeof locale === 'string' || Array.isArray(locale)) {
16361
+ result = number.toLocaleString(locale, options);
16362
+ } else if (locale === true || options !== undefined) {
16363
+ result = number.toLocaleString(undefined, options);
16364
+ }
16365
+
16366
+ return result;
16367
+ };
16368
+
16369
+ function prettyBytes(number, options) {
16370
+ if (!Number.isFinite(number)) {
16371
+ throw new TypeError(`Expected a finite number, got ${typeof number}: ${number}`);
16372
+ }
16373
+
16374
+ options = {
16375
+ bits: false,
16376
+ binary: false,
16377
+ ...options,
16378
+ };
16379
+
16380
+ const UNITS = options.bits
16381
+ ? (options.binary ? BIBIT_UNITS : BIT_UNITS)
16382
+ : (options.binary ? BIBYTE_UNITS : BYTE_UNITS);
16383
+
16384
+ if (options.signed && number === 0) {
16385
+ return ` 0 ${UNITS[0]}`;
16386
+ }
16387
+
16388
+ const isNegative = number < 0;
16389
+ const prefix = isNegative ? '-' : (options.signed ? '+' : '');
16390
+
16391
+ if (isNegative) {
16392
+ number = -number;
16393
+ }
16394
+
16395
+ let localeOptions;
16396
+
16397
+ if (options.minimumFractionDigits !== undefined) {
16398
+ localeOptions = {minimumFractionDigits: options.minimumFractionDigits};
16399
+ }
16400
+
16401
+ if (options.maximumFractionDigits !== undefined) {
16402
+ localeOptions = {maximumFractionDigits: options.maximumFractionDigits, ...localeOptions};
16403
+ }
16404
+
16405
+ if (number < 1) {
16406
+ const numberString = toLocaleString(number, options.locale, localeOptions);
16407
+ return prefix + numberString + ' ' + UNITS[0];
16408
+ }
16409
+
16410
+ const exponent = Math.min(Math.floor(options.binary ? Math.log(number) / Math.log(1024) : Math.log10(number) / 3), UNITS.length - 1);
16411
+ number /= (options.binary ? 1024 : 1000) ** exponent;
16412
+
16413
+ if (!localeOptions) {
16414
+ number = number.toPrecision(3);
16415
+ }
16416
+
16417
+ const numberString = toLocaleString(Number(number), options.locale, localeOptions);
16418
+
16419
+ const unit = UNITS[exponent];
16420
+
16421
+ return prefix + numberString + ' ' + unit;
16422
+ }
16423
+
16300
16424
  /**
16301
16425
  * Concatenate a number of iterables to a new iterable without fully evaluating
16302
16426
  * their iterators. Useful when e.g. working with large sets or lists and when
16303
16427
  * there is a chance that the iterators will not be fully exhausted.
16304
16428
  */
16305
- function* concatLazy(...iterables) {
16429
+ function* concatLazy(iterables) {
16306
16430
  for (const iterable of iterables) {
16307
16431
  yield* iterable;
16308
16432
  }
@@ -16443,47 +16567,11 @@ function createChunks(allEntries, assignedEntriesByModule, minChunkSize) {
16443
16567
  alias: null,
16444
16568
  modules
16445
16569
  }))
16446
- : getOptimizedChunks(chunkModulesBySignature, minChunkSize);
16447
- }
16448
- function getOptimizedChunks(chunkModulesBySignature, minChunkSize) {
16449
- timeStart('optimize chunks', 3);
16450
- const { chunksToBeMerged, unmergeableChunks } = getMergeableChunks(chunkModulesBySignature, minChunkSize);
16451
- for (const sourceChunk of chunksToBeMerged) {
16452
- chunksToBeMerged.delete(sourceChunk);
16453
- let closestChunk = null;
16454
- let closestChunkDistance = Infinity;
16455
- const { signature, size, modules } = sourceChunk;
16456
- for (const targetChunk of concatLazy(chunksToBeMerged, unmergeableChunks)) {
16457
- const distance = getSignatureDistance(signature, targetChunk.signature, !chunksToBeMerged.has(targetChunk));
16458
- if (distance === 1) {
16459
- closestChunk = targetChunk;
16460
- break;
16461
- }
16462
- else if (distance < closestChunkDistance) {
16463
- closestChunk = targetChunk;
16464
- closestChunkDistance = distance;
16465
- }
16466
- }
16467
- if (closestChunk) {
16468
- closestChunk.modules.push(...modules);
16469
- if (chunksToBeMerged.has(closestChunk)) {
16470
- closestChunk.signature = mergeSignatures(signature, closestChunk.signature);
16471
- if ((closestChunk.size += size) > minChunkSize) {
16472
- chunksToBeMerged.delete(closestChunk);
16473
- unmergeableChunks.push(closestChunk);
16474
- }
16475
- }
16476
- }
16477
- else {
16478
- unmergeableChunks.push(sourceChunk);
16479
- }
16480
- }
16481
- timeEnd('optimize chunks', 3);
16482
- return unmergeableChunks;
16570
+ : getOptimizedChunks(chunkModulesBySignature, minChunkSize).map(({ modules }) => ({
16571
+ alias: null,
16572
+ modules
16573
+ }));
16483
16574
  }
16484
- const CHAR_DEPENDENT = 'X';
16485
- const CHAR_INDEPENDENT = '_';
16486
- const CHAR_CODE_DEPENDENT = CHAR_DEPENDENT.charCodeAt(0);
16487
16575
  function getChunkModulesBySignature(assignedEntriesByModule, allEntries) {
16488
16576
  const chunkModules = Object.create(null);
16489
16577
  for (const [module, assignedEntries] of assignedEntriesByModule) {
@@ -16501,28 +16589,205 @@ function getChunkModulesBySignature(assignedEntriesByModule, allEntries) {
16501
16589
  }
16502
16590
  return chunkModules;
16503
16591
  }
16504
- function getMergeableChunks(chunkModulesBySignature, minChunkSize) {
16505
- const chunksToBeMerged = new Set();
16506
- const unmergeableChunks = [];
16507
- const alias = null;
16592
+ /**
16593
+ * This function tries to get rid of small chunks by merging them with other
16594
+ * chunks. In order to merge chunks, one must obey the following rule:
16595
+ * - When merging several chunks, at most one of the chunks can have side
16596
+ * effects
16597
+ * - When one of the chunks has side effects, the entry points depending on that
16598
+ * chunk need to be a super set of the entry points depending on the other
16599
+ * chunks
16600
+ * - Pure chunks can always be merged
16601
+ * - We use the entry point dependence signature to calculate "chunk distance",
16602
+ * i.e. how likely it is that two chunks are loaded together
16603
+ */
16604
+ function getOptimizedChunks(chunkModulesBySignature, minChunkSize) {
16605
+ timeStart('optimize chunks', 3);
16606
+ const chunkPartition = getPartitionedChunks(chunkModulesBySignature, minChunkSize);
16607
+ console.log(`Created ${chunkPartition.big.pure.size +
16608
+ chunkPartition.big.sideEffect.size +
16609
+ chunkPartition.small.pure.size +
16610
+ chunkPartition.small.sideEffect.size} chunks
16611
+ ----- pure side effects
16612
+ small ${`${chunkPartition.small.pure.size}`.padEnd(5, ' ')} ${chunkPartition.small.sideEffect.size}
16613
+ big ${`${chunkPartition.big.pure.size}`.padEnd(5, ' ')} ${chunkPartition.big.sideEffect.size}
16614
+ Unoptimized chunks contain ${getNumberOfCycles(chunkPartition)} cycles.
16615
+ `);
16616
+ if (chunkPartition.small.sideEffect.size > 0) {
16617
+ console.log(`Trying to find merge targets for ${chunkPartition.small.sideEffect.size} chunks smaller than ${prettyBytes(minChunkSize)} with side effects...`);
16618
+ mergeChunks(chunkPartition.small.sideEffect, [chunkPartition.small.pure, chunkPartition.big.pure], minChunkSize, chunkPartition);
16619
+ console.log(`${chunkPartition.small.sideEffect.size} chunks smaller than ${prettyBytes(minChunkSize)} with side effects remaining.\nGenerated chunks contain ${getNumberOfCycles(chunkPartition)} cycles.\n`);
16620
+ }
16621
+ if (chunkPartition.small.pure.size > 0) {
16622
+ console.log(`Trying to find merge targets for ${chunkPartition.small.pure.size} pure chunks smaller than ${prettyBytes(minChunkSize)}...`);
16623
+ mergeChunks(chunkPartition.small.pure, [chunkPartition.small.pure, chunkPartition.big.sideEffect, chunkPartition.big.pure], minChunkSize, chunkPartition);
16624
+ console.log(`${chunkPartition.small.pure.size} pure chunks smaller than ${prettyBytes(minChunkSize)} remaining.\nGenerated chunks contain ${getNumberOfCycles(chunkPartition)} cycles.\n`);
16625
+ }
16626
+ timeEnd('optimize chunks', 3);
16627
+ const result = [
16628
+ ...chunkPartition.small.sideEffect,
16629
+ ...chunkPartition.small.pure,
16630
+ ...chunkPartition.big.sideEffect,
16631
+ ...chunkPartition.big.pure
16632
+ ];
16633
+ console.log(`${result.length} chunks remaining.`);
16634
+ return result;
16635
+ }
16636
+ const CHAR_DEPENDENT = 'X';
16637
+ const CHAR_INDEPENDENT = '_';
16638
+ const CHAR_CODE_DEPENDENT = CHAR_DEPENDENT.charCodeAt(0);
16639
+ function getPartitionedChunks(chunkModulesBySignature, minChunkSize) {
16640
+ const smallPureChunks = [];
16641
+ const bigPureChunks = [];
16642
+ const smallSideEffectChunks = [];
16643
+ const bigSideEffectChunks = [];
16644
+ const chunkByModule = new Map();
16508
16645
  for (const [signature, modules] of Object.entries(chunkModulesBySignature)) {
16646
+ const chunkDescription = {
16647
+ dependencies: new Set(),
16648
+ dependentChunks: new Set(),
16649
+ modules,
16650
+ pure: true,
16651
+ signature,
16652
+ size: 0
16653
+ };
16509
16654
  let size = 0;
16510
- checkModules: {
16655
+ let pure = true;
16656
+ for (const module of modules) {
16657
+ chunkByModule.set(module, chunkDescription);
16658
+ pure && (pure = !module.hasEffects());
16659
+ // Unfortunately, we cannot take tree-shaking into account here because
16660
+ // rendering did not happen yet
16661
+ size += module.originalCode.length;
16662
+ }
16663
+ chunkDescription.pure = pure;
16664
+ chunkDescription.size = size;
16665
+ (size < minChunkSize
16666
+ ? pure
16667
+ ? smallPureChunks
16668
+ : smallSideEffectChunks
16669
+ : pure
16670
+ ? bigPureChunks
16671
+ : bigSideEffectChunks).push(chunkDescription);
16672
+ }
16673
+ sortChunksAndAddDependencies([bigPureChunks, bigSideEffectChunks, smallPureChunks, smallSideEffectChunks], chunkByModule);
16674
+ return {
16675
+ big: { pure: new Set(bigPureChunks), sideEffect: new Set(bigSideEffectChunks) },
16676
+ small: { pure: new Set(smallPureChunks), sideEffect: new Set(smallSideEffectChunks) }
16677
+ };
16678
+ }
16679
+ function getNumberOfCycles(partition) {
16680
+ const parents = new Set();
16681
+ const analysedChunks = new Set();
16682
+ let cycles = 0;
16683
+ const analyseChunk = (chunk) => {
16684
+ for (const dependency of chunk.dependencies) {
16685
+ if (parents.has(dependency)) {
16686
+ if (!analysedChunks.has(dependency)) {
16687
+ cycles++;
16688
+ }
16689
+ continue;
16690
+ }
16691
+ parents.add(dependency);
16692
+ analyseChunk(dependency);
16693
+ }
16694
+ analysedChunks.add(chunk);
16695
+ };
16696
+ for (const chunk of [
16697
+ ...partition.big.pure,
16698
+ ...partition.big.sideEffect,
16699
+ ...partition.small.pure,
16700
+ ...partition.small.sideEffect
16701
+ ]) {
16702
+ if (!parents.has(chunk)) {
16703
+ parents.add(chunk);
16704
+ analyseChunk(chunk);
16705
+ }
16706
+ }
16707
+ return cycles;
16708
+ }
16709
+ function sortChunksAndAddDependencies(chunkLists, chunkByModule) {
16710
+ for (const chunks of chunkLists) {
16711
+ chunks.sort(compareChunks);
16712
+ for (const chunk of chunks) {
16713
+ const { dependencies, modules } = chunk;
16511
16714
  for (const module of modules) {
16512
- if (module.hasEffects()) {
16513
- break checkModules;
16715
+ for (const dependency of module.getDependenciesToBeIncluded()) {
16716
+ const dependencyChunk = chunkByModule.get(dependency);
16717
+ if (dependencyChunk && dependencyChunk !== chunk) {
16718
+ dependencies.add(dependencyChunk);
16719
+ dependencyChunk.dependentChunks.add(chunk);
16720
+ }
16514
16721
  }
16515
- size += module.magicString.toString().length;
16516
- if (size > minChunkSize) {
16517
- break checkModules;
16722
+ }
16723
+ }
16724
+ }
16725
+ }
16726
+ function compareChunks({ size: sizeA }, { size: sizeB }) {
16727
+ return sizeA - sizeB;
16728
+ }
16729
+ function mergeChunks(chunksToBeMerged, targetChunks, minChunkSize, chunkPartition) {
16730
+ for (const mergedChunk of chunksToBeMerged) {
16731
+ let closestChunk = null;
16732
+ let closestChunkDistance = Infinity;
16733
+ const { signature, modules, pure, size } = mergedChunk;
16734
+ for (const targetChunk of concatLazy(targetChunks)) {
16735
+ if (mergedChunk === targetChunk)
16736
+ continue;
16737
+ const distance = pure
16738
+ ? getSignatureDistance(signature, targetChunk.signature, !targetChunk.pure)
16739
+ : getSignatureDistance(targetChunk.signature, signature, true);
16740
+ if (distance < closestChunkDistance && isValidMerge(mergedChunk, targetChunk)) {
16741
+ if (distance === 1) {
16742
+ closestChunk = targetChunk;
16743
+ break;
16518
16744
  }
16745
+ closestChunk = targetChunk;
16746
+ closestChunkDistance = distance;
16519
16747
  }
16520
- chunksToBeMerged.add({ alias, modules, signature, size });
16521
- continue;
16522
16748
  }
16523
- unmergeableChunks.push({ alias, modules, signature, size: null });
16749
+ if (closestChunk) {
16750
+ chunksToBeMerged.delete(mergedChunk);
16751
+ getChunksInPartition(closestChunk, minChunkSize, chunkPartition).delete(closestChunk);
16752
+ closestChunk.modules.push(...modules);
16753
+ closestChunk.size += size;
16754
+ closestChunk.pure && (closestChunk.pure = pure);
16755
+ closestChunk.signature = mergeSignatures(signature, closestChunk.signature);
16756
+ const { dependencies, dependentChunks } = closestChunk;
16757
+ for (const dependency of mergedChunk.dependencies) {
16758
+ dependencies.add(dependency);
16759
+ }
16760
+ for (const dependentChunk of mergedChunk.dependentChunks) {
16761
+ dependentChunks.add(dependentChunk);
16762
+ dependentChunk.dependencies.delete(mergedChunk);
16763
+ dependentChunk.dependencies.add(closestChunk);
16764
+ }
16765
+ dependencies.delete(closestChunk);
16766
+ getChunksInPartition(closestChunk, minChunkSize, chunkPartition).add(closestChunk);
16767
+ }
16768
+ }
16769
+ }
16770
+ // Merging will not produce cycles if none of the direct non-merged dependencies
16771
+ // of a chunk have the other chunk as a transitive dependency
16772
+ function isValidMerge(mergedChunk, targetChunk) {
16773
+ return !(hasTransitiveDependency(mergedChunk, targetChunk) ||
16774
+ hasTransitiveDependency(targetChunk, mergedChunk));
16775
+ }
16776
+ function hasTransitiveDependency(dependentChunk, dependencyChunk) {
16777
+ const chunksToCheck = new Set(dependentChunk.dependencies);
16778
+ for (const { dependencies } of chunksToCheck) {
16779
+ for (const dependency of dependencies) {
16780
+ if (dependency === dependencyChunk) {
16781
+ return true;
16782
+ }
16783
+ chunksToCheck.add(dependency);
16784
+ }
16524
16785
  }
16525
- return { chunksToBeMerged, unmergeableChunks };
16786
+ return false;
16787
+ }
16788
+ function getChunksInPartition(chunk, minChunkSize, chunkPartition) {
16789
+ const subPartition = chunk.size < minChunkSize ? chunkPartition.small : chunkPartition.big;
16790
+ return chunk.pure ? subPartition.pure : subPartition.sideEffect;
16526
16791
  }
16527
16792
  function getSignatureDistance(sourceSignature, targetSignature, enforceSubset) {
16528
16793
  let distance = 0;
@@ -25356,6 +25621,7 @@ exports.loadFsEvents = loadFsEvents;
25356
25621
  exports.mergeOptions = mergeOptions;
25357
25622
  exports.normalizePluginOption = normalizePluginOption;
25358
25623
  exports.picomatch = picomatch$1;
25624
+ exports.prettyBytes = prettyBytes;
25359
25625
  exports.printQuotedStringList = printQuotedStringList;
25360
25626
  exports.relativeId = relativeId;
25361
25627
  exports.rollup = rollup;
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.7.5
4
- Sat, 17 Dec 2022 05:47:48 GMT - commit 5613b96ac5f32a881ed50a275398e140fbf6ba2b
3
+ Rollup.js v3.7.6-0
4
+ Sun, 18 Dec 2022 05:56:49 GMT - commit d226f7976dc543ff814af389e183d627d4e94ed4
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.7.5
4
- Sat, 17 Dec 2022 05:47:48 GMT - commit 5613b96ac5f32a881ed50a275398e140fbf6ba2b
3
+ Rollup.js v3.7.6-0
4
+ Sun, 18 Dec 2022 05:56:49 GMT - commit d226f7976dc543ff814af389e183d627d4e94ed4
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.7.5",
3
+ "version": "3.7.6-0",
4
4
  "description": "Next-generation ES module bundler",
5
5
  "main": "dist/rollup.js",
6
6
  "module": "dist/es/rollup.js",