rollup 3.7.1-0 → 3.7.2

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.
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.7.1-0
4
- Thu, 08 Dec 2022 05:48:12 GMT - commit a3259be5f30c0b2c85c985459782207fb05f50c3
3
+ Rollup.js v3.7.2
4
+ Sat, 10 Dec 2022 06:16:44 GMT - commit f368adf4943a11207157ec44a83345da7a905a13
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.1-0";
34
+ var version$1 = "3.7.2";
35
35
 
36
36
  function ensureArray$1(items) {
37
37
  if (Array.isArray(items)) {
@@ -95,6 +95,19 @@ function locate(source, search, options) {
95
95
  return getLocator$1(source, options)(search, options && options.startIndex);
96
96
  }
97
97
 
98
+ const ABSOLUTE_PATH_REGEX = /^(?:\/|(?:[A-Za-z]:)?[/\\|])/;
99
+ const RELATIVE_PATH_REGEX = /^\.?\.(\/|$)/;
100
+ function isAbsolute(path) {
101
+ return ABSOLUTE_PATH_REGEX.test(path);
102
+ }
103
+ function isRelative(path) {
104
+ return RELATIVE_PATH_REGEX.test(path);
105
+ }
106
+ const BACKSLASH_REGEX = /\\/g;
107
+ function normalize(path) {
108
+ return path.replace(BACKSLASH_REGEX, '/');
109
+ }
110
+
98
111
  function spaces(index) {
99
112
  let result = '';
100
113
  while (index--)
@@ -163,19 +176,6 @@ function relative(from, to) {
163
176
  return toParts.join('/');
164
177
  }
165
178
 
166
- const ABSOLUTE_PATH_REGEX = /^(?:\/|(?:[A-Za-z]:)?[/\\|])/;
167
- const RELATIVE_PATH_REGEX = /^\.?\.(\/|$)/;
168
- function isAbsolute(path) {
169
- return ABSOLUTE_PATH_REGEX.test(path);
170
- }
171
- function isRelative(path) {
172
- return RELATIVE_PATH_REGEX.test(path);
173
- }
174
- const BACKSLASH_REGEX = /\\/g;
175
- function normalize(path) {
176
- return path.replace(BACKSLASH_REGEX, '/');
177
- }
178
-
179
179
  function getAliasName(id) {
180
180
  const base = node_path.basename(id);
181
181
  return base.slice(0, Math.max(0, base.length - node_path.extname(id).length));
@@ -535,12 +535,13 @@ function errorMissingConfig() {
535
535
  };
536
536
  }
537
537
  function errorMissingExport(binding, importingModule, exporter) {
538
+ const isJson = node_path.extname(exporter) === '.json';
538
539
  return {
539
540
  binding,
540
541
  code: MISSING_EXPORT,
541
542
  exporter,
542
543
  id: importingModule,
543
- message: `"${binding}" is not exported by "${relativeId(exporter)}", imported by "${relativeId(importingModule)}".`,
544
+ message: `"${binding}" is not exported by "${relativeId(exporter)}", imported by "${relativeId(importingModule)}".${isJson ? ' (Note that you need @rollup/plugin-json to import JSON files)' : ''}`,
544
545
  url: `https://rollupjs.org/guide/en/#error-name-is-not-exported-by-module`
545
546
  };
546
547
  }
@@ -2835,6 +2836,12 @@ function getOrCreate(map, key, init) {
2835
2836
  map.set(key, value);
2836
2837
  return value;
2837
2838
  }
2839
+ function getNewSet() {
2840
+ return new Set();
2841
+ }
2842
+ function getNewArray() {
2843
+ return [];
2844
+ }
2838
2845
 
2839
2846
  const UnknownKey = Symbol('Unknown Key');
2840
2847
  const UnknownNonAccessorKey = Symbol('Unknown Non-Accessor Key');
@@ -2896,7 +2903,7 @@ class DiscriminatedPathTracker {
2896
2903
  currentPaths[pathSegment] ||
2897
2904
  Object.create(null, { [EntitiesKey]: { value: new Map() } });
2898
2905
  }
2899
- const trackedEntities = getOrCreate(currentPaths[EntitiesKey], discriminator, () => new Set());
2906
+ const trackedEntities = getOrCreate(currentPaths[EntitiesKey], discriminator, getNewSet);
2900
2907
  if (trackedEntities.has(entity))
2901
2908
  return true;
2902
2909
  trackedEntities.add(entity);
@@ -11777,12 +11784,7 @@ class PrivateIdentifier extends NodeBase {
11777
11784
  class Program extends NodeBase {
11778
11785
  constructor() {
11779
11786
  super(...arguments);
11780
- this.hasCachedEffect = null;
11781
- }
11782
- hasCachedEffects() {
11783
- return this.hasCachedEffect === null
11784
- ? (this.hasCachedEffect = this.hasEffects(createHasEffectsContext()))
11785
- : this.hasCachedEffect;
11787
+ this.hasCachedEffect = false;
11786
11788
  }
11787
11789
  hasEffects(context) {
11788
11790
  // We are caching here to later more efficiently identify side-effect-free modules
@@ -13273,7 +13275,7 @@ function getVariableForExportNameRecursive(target, name, importerForSideEffects,
13273
13275
  });
13274
13276
  }
13275
13277
  function getAndExtendSideEffectModules(variable, module) {
13276
- const sideEffectModules = getOrCreate(module.sideEffectDependenciesByVariable, variable, () => new Set());
13278
+ const sideEffectModules = getOrCreate(module.sideEffectDependenciesByVariable, variable, getNewSet);
13277
13279
  let currentVariable = variable;
13278
13280
  const referencedVariables = new Set([currentVariable]);
13279
13281
  while (true) {
@@ -13612,7 +13614,7 @@ class Module {
13612
13614
  searchedNamesAndModules
13613
13615
  });
13614
13616
  if (importerForSideEffects) {
13615
- getOrCreate(importerForSideEffects.sideEffectDependenciesByVariable, variable, () => new Set()).add(this);
13617
+ getOrCreate(importerForSideEffects.sideEffectDependenciesByVariable, variable, getNewSet).add(this);
13616
13618
  setAlternativeExporterIfCyclic(variable, importerForSideEffects, this);
13617
13619
  }
13618
13620
  return [variable];
@@ -13642,7 +13644,8 @@ class Module {
13642
13644
  return [null];
13643
13645
  }
13644
13646
  hasEffects() {
13645
- return this.info.moduleSideEffects === 'no-treeshake' || this.ast.hasCachedEffects();
13647
+ return (this.info.moduleSideEffects === 'no-treeshake' ||
13648
+ (this.ast.included && this.ast.hasEffects(createHasEffectsContext())));
13646
13649
  }
13647
13650
  include() {
13648
13651
  const context = createInclusionContext();
@@ -15839,7 +15842,7 @@ class Chunk {
15839
15842
  dependency = this.chunkByModule.get(module);
15840
15843
  imported = dependency.getVariableExportName(variable);
15841
15844
  }
15842
- getOrCreate(importsByDependency, dependency, () => []).push({
15845
+ getOrCreate(importsByDependency, dependency, getNewArray).push({
15843
15846
  imported,
15844
15847
  local: variable.getName(this.snippets.getPropertyAccess)
15845
15848
  });
@@ -15951,7 +15954,7 @@ class Chunk {
15951
15954
  (imported !== 'default' || isDefaultAProperty(interop(module.id), true));
15952
15955
  }
15953
15956
  }
15954
- getOrCreate(reexportSpecifiers, dependency, () => []).push({
15957
+ getOrCreate(reexportSpecifiers, dependency, getNewArray).push({
15955
15958
  imported,
15956
15959
  needsLiveBinding,
15957
15960
  reexported: exportName
@@ -16241,132 +16244,12 @@ function getImportedBindingsPerDependency(renderedDependencies, resolveFileName)
16241
16244
  const QUERY_HASH_REGEX = /[#?]/;
16242
16245
  const resolveFileName = (dependency) => dependency.getFileName();
16243
16246
 
16244
- const BYTE_UNITS = [
16245
- 'B',
16246
- 'kB',
16247
- 'MB',
16248
- 'GB',
16249
- 'TB',
16250
- 'PB',
16251
- 'EB',
16252
- 'ZB',
16253
- 'YB',
16254
- ];
16255
-
16256
- const BIBYTE_UNITS = [
16257
- 'B',
16258
- 'kiB',
16259
- 'MiB',
16260
- 'GiB',
16261
- 'TiB',
16262
- 'PiB',
16263
- 'EiB',
16264
- 'ZiB',
16265
- 'YiB',
16266
- ];
16267
-
16268
- const BIT_UNITS = [
16269
- 'b',
16270
- 'kbit',
16271
- 'Mbit',
16272
- 'Gbit',
16273
- 'Tbit',
16274
- 'Pbit',
16275
- 'Ebit',
16276
- 'Zbit',
16277
- 'Ybit',
16278
- ];
16279
-
16280
- const BIBIT_UNITS = [
16281
- 'b',
16282
- 'kibit',
16283
- 'Mibit',
16284
- 'Gibit',
16285
- 'Tibit',
16286
- 'Pibit',
16287
- 'Eibit',
16288
- 'Zibit',
16289
- 'Yibit',
16290
- ];
16291
-
16292
- /*
16293
- Formats the given number using `Number#toLocaleString`.
16294
- - If locale is a string, the value is expected to be a locale-key (for example: `de`).
16295
- - If locale is true, the system default locale is used for translation.
16296
- - If no value for locale is specified, the number is returned unmodified.
16297
- */
16298
- const toLocaleString = (number, locale, options) => {
16299
- let result = number;
16300
- if (typeof locale === 'string' || Array.isArray(locale)) {
16301
- result = number.toLocaleString(locale, options);
16302
- } else if (locale === true || options !== undefined) {
16303
- result = number.toLocaleString(undefined, options);
16304
- }
16305
-
16306
- return result;
16307
- };
16308
-
16309
- function prettyBytes(number, options) {
16310
- if (!Number.isFinite(number)) {
16311
- throw new TypeError(`Expected a finite number, got ${typeof number}: ${number}`);
16312
- }
16313
-
16314
- options = {
16315
- bits: false,
16316
- binary: false,
16317
- ...options,
16318
- };
16319
-
16320
- const UNITS = options.bits
16321
- ? (options.binary ? BIBIT_UNITS : BIT_UNITS)
16322
- : (options.binary ? BIBYTE_UNITS : BYTE_UNITS);
16323
-
16324
- if (options.signed && number === 0) {
16325
- return ` 0 ${UNITS[0]}`;
16326
- }
16327
-
16328
- const isNegative = number < 0;
16329
- const prefix = isNegative ? '-' : (options.signed ? '+' : '');
16330
-
16331
- if (isNegative) {
16332
- number = -number;
16333
- }
16334
-
16335
- let localeOptions;
16336
-
16337
- if (options.minimumFractionDigits !== undefined) {
16338
- localeOptions = {minimumFractionDigits: options.minimumFractionDigits};
16339
- }
16340
-
16341
- if (options.maximumFractionDigits !== undefined) {
16342
- localeOptions = {maximumFractionDigits: options.maximumFractionDigits, ...localeOptions};
16343
- }
16344
-
16345
- if (number < 1) {
16346
- const numberString = toLocaleString(number, options.locale, localeOptions);
16347
- return prefix + numberString + ' ' + UNITS[0];
16348
- }
16349
-
16350
- const exponent = Math.min(Math.floor(options.binary ? Math.log(number) / Math.log(1024) : Math.log10(number) / 3), UNITS.length - 1);
16351
- number /= (options.binary ? 1024 : 1000) ** exponent;
16352
-
16353
- if (!localeOptions) {
16354
- number = number.toPrecision(3);
16355
- }
16356
-
16357
- const numberString = toLocaleString(Number(number), options.locale, localeOptions);
16358
-
16359
- const unit = UNITS[exponent];
16360
-
16361
- return prefix + numberString + ' ' + unit;
16362
- }
16363
-
16364
16247
  /**
16365
16248
  * Concatenate a number of iterables to a new iterable without fully evaluating
16366
16249
  * their iterators. Useful when e.g. working with large sets or lists and when
16367
16250
  * there is a chance that the iterators will not be fully exhausted.
16368
16251
  */
16369
- function* concatLazy(iterables) {
16252
+ function* concatLazy(...iterables) {
16370
16253
  for (const iterable of iterables) {
16371
16254
  yield* iterable;
16372
16255
  }
@@ -16443,25 +16326,25 @@ function analyzeModuleGraph(entries) {
16443
16326
  function getDynamicallyDependentEntriesByDynamicEntry(dependentEntriesByModule, dynamicEntries) {
16444
16327
  const dynamicallyDependentEntriesByDynamicEntry = new Map();
16445
16328
  for (const dynamicEntry of dynamicEntries) {
16446
- const dynamicDependentEntries = getOrCreate(dynamicallyDependentEntriesByDynamicEntry, dynamicEntry, getNewSet);
16329
+ const dynamicallyDependentEntries = getOrCreate(dynamicallyDependentEntriesByDynamicEntry, dynamicEntry, getNewSet);
16447
16330
  for (const importer of [
16448
16331
  ...dynamicEntry.includedDynamicImporters,
16449
16332
  ...dynamicEntry.implicitlyLoadedAfter
16450
16333
  ]) {
16451
16334
  for (const entry of dependentEntriesByModule.get(importer)) {
16452
- dynamicDependentEntries.add(entry);
16335
+ dynamicallyDependentEntries.add(entry);
16453
16336
  }
16454
16337
  }
16455
16338
  }
16456
16339
  return dynamicallyDependentEntriesByDynamicEntry;
16457
16340
  }
16458
16341
  function assignEntryToStaticDependencies(entry, dependentEntriesByModule, assignedEntriesByModule, modulesInManualChunks, staticEntries, dynamicallyDependentEntriesByDynamicEntry) {
16459
- const dynamicDependentEntries = dynamicallyDependentEntriesByDynamicEntry.get(entry);
16342
+ const dynamicallyDependentEntries = dynamicallyDependentEntriesByDynamicEntry.get(entry);
16460
16343
  const modulesToHandle = new Set([entry]);
16461
16344
  for (const module of modulesToHandle) {
16462
16345
  const assignedEntries = getOrCreate(assignedEntriesByModule, module, getNewSet);
16463
- if (dynamicDependentEntries &&
16464
- areEntriesContainedOrDynamicallyDependent(dynamicDependentEntries, dependentEntriesByModule.get(module), staticEntries, dynamicallyDependentEntriesByDynamicEntry)) {
16346
+ if (dynamicallyDependentEntries &&
16347
+ isModuleAlreadyLoaded(dynamicallyDependentEntries, dependentEntriesByModule.get(module), staticEntries, dynamicallyDependentEntriesByDynamicEntry)) {
16465
16348
  continue;
16466
16349
  }
16467
16350
  else {
@@ -16475,11 +16358,15 @@ function assignEntryToStaticDependencies(entry, dependentEntriesByModule, assign
16475
16358
  }
16476
16359
  }
16477
16360
  const MAX_ENTRIES_TO_CHECK_FOR_SHARED_DEPENDENCIES = 3;
16478
- function areEntriesContainedOrDynamicallyDependent(entries, containedIn, staticEntries, dynamicallyDependentEntriesByDynamicEntry) {
16479
- if (entries.size > MAX_ENTRIES_TO_CHECK_FOR_SHARED_DEPENDENCIES) {
16361
+ // An approach to further speed this up might be
16362
+ // - first, create chunks without looking for modules already in memory
16363
+ // - all modules that are in the same chunk after this will behave the same
16364
+ // -> Do not iterate by module but by equivalence group and merge chunks
16365
+ function isModuleAlreadyLoaded(dynamicallyDependentEntries, containedIn, staticEntries, dynamicallyDependentEntriesByDynamicEntry) {
16366
+ if (dynamicallyDependentEntries.size > MAX_ENTRIES_TO_CHECK_FOR_SHARED_DEPENDENCIES) {
16480
16367
  return false;
16481
16368
  }
16482
- const entriesToCheck = new Set(entries);
16369
+ const entriesToCheck = new Set(dynamicallyDependentEntries);
16483
16370
  for (const entry of entriesToCheck) {
16484
16371
  if (!containedIn.has(entry)) {
16485
16372
  if (staticEntries.has(entry)) {
@@ -16503,50 +16390,43 @@ function createChunks(allEntries, assignedEntriesByModule, minChunkSize) {
16503
16390
  alias: null,
16504
16391
  modules
16505
16392
  }))
16506
- : getOptimizedChunks(chunkModulesBySignature, minChunkSize).map(({ modules }) => ({
16507
- alias: null,
16508
- modules
16509
- }));
16393
+ : getOptimizedChunks(chunkModulesBySignature, minChunkSize);
16510
16394
  }
16511
- /**
16512
- * This function tries to get rid of small chunks by merging them with other
16513
- * chunks. In order to merge chunks, one must obey the following rule:
16514
- * - When merging several chunks, at most one of the chunks can have side
16515
- * effects
16516
- * - When one of the chunks has side effects, the entry points depending on that
16517
- * chunk need to be a super set of the entry points depending on the other
16518
- * chunks
16519
- * - Pure chunks can always be merged
16520
- * - We use the entry point dependence signature to calculate "chunk distance",
16521
- * i.e. how likely it is that two chunks are loaded together
16522
- */
16523
16395
  function getOptimizedChunks(chunkModulesBySignature, minChunkSize) {
16524
16396
  timeStart('optimize chunks', 3);
16525
- const chunkPartition = getPartitionedChunks(chunkModulesBySignature, minChunkSize);
16526
- console.log(`Created ${chunkPartition.big.pure.size +
16527
- chunkPartition.big.sideEffect.size +
16528
- chunkPartition.small.pure.size +
16529
- chunkPartition.small.sideEffect.size} chunks
16530
- ----- pure side effects
16531
- small ${`${chunkPartition.small.pure.size}`.padEnd(5, ' ')} ${chunkPartition.small.sideEffect.size}
16532
- big ${`${chunkPartition.big.pure.size}`.padEnd(5, ' ')} ${chunkPartition.big.sideEffect.size}
16533
- Unoptimized chunks contain ${getNumberOfCycles(chunkPartition)} cycles.
16534
- `);
16535
- console.log(`Trying to find merge targets for ${chunkPartition.small.sideEffect.size} chunks smaller than ${prettyBytes(minChunkSize)} with side effects...`);
16536
- mergeChunks(chunkPartition.small.sideEffect, [chunkPartition.small.pure, chunkPartition.big.pure], minChunkSize, chunkPartition);
16537
- console.log(`${chunkPartition.small.sideEffect.size} chunks smaller than ${prettyBytes(minChunkSize)} with side effects remaining.\nGenerated chunks contain ${getNumberOfCycles(chunkPartition)} cycles.\n`);
16538
- console.log(`Trying to find merge targets for ${chunkPartition.small.pure.size} pure chunks smaller than ${prettyBytes(minChunkSize)}...`);
16539
- mergeChunks(chunkPartition.small.pure, [chunkPartition.small.pure, chunkPartition.big.sideEffect, chunkPartition.big.pure], minChunkSize, chunkPartition);
16540
- console.log(`${chunkPartition.small.pure.size} pure chunks smaller than ${prettyBytes(minChunkSize)} remaining.\nGenerated chunks contain ${getNumberOfCycles(chunkPartition)} cycles.\n`);
16397
+ const { chunksToBeMerged, unmergeableChunks } = getMergeableChunks(chunkModulesBySignature, minChunkSize);
16398
+ for (const sourceChunk of chunksToBeMerged) {
16399
+ chunksToBeMerged.delete(sourceChunk);
16400
+ let closestChunk = null;
16401
+ let closestChunkDistance = Infinity;
16402
+ const { signature, size, modules } = sourceChunk;
16403
+ for (const targetChunk of concatLazy(chunksToBeMerged, unmergeableChunks)) {
16404
+ const distance = getSignatureDistance(signature, targetChunk.signature, !chunksToBeMerged.has(targetChunk));
16405
+ if (distance === 1) {
16406
+ closestChunk = targetChunk;
16407
+ break;
16408
+ }
16409
+ else if (distance < closestChunkDistance) {
16410
+ closestChunk = targetChunk;
16411
+ closestChunkDistance = distance;
16412
+ }
16413
+ }
16414
+ if (closestChunk) {
16415
+ closestChunk.modules.push(...modules);
16416
+ if (chunksToBeMerged.has(closestChunk)) {
16417
+ closestChunk.signature = mergeSignatures(signature, closestChunk.signature);
16418
+ if ((closestChunk.size += size) > minChunkSize) {
16419
+ chunksToBeMerged.delete(closestChunk);
16420
+ unmergeableChunks.push(closestChunk);
16421
+ }
16422
+ }
16423
+ }
16424
+ else {
16425
+ unmergeableChunks.push(sourceChunk);
16426
+ }
16427
+ }
16541
16428
  timeEnd('optimize chunks', 3);
16542
- const result = [
16543
- ...chunkPartition.small.sideEffect,
16544
- ...chunkPartition.small.pure,
16545
- ...chunkPartition.big.sideEffect,
16546
- ...chunkPartition.big.pure
16547
- ];
16548
- console.log(`${result.length} chunks remaining.`);
16549
- return result;
16429
+ return unmergeableChunks;
16550
16430
  }
16551
16431
  const CHAR_DEPENDENT = 'X';
16552
16432
  const CHAR_INDEPENDENT = '_';
@@ -16568,171 +16448,28 @@ function getChunkModulesBySignature(assignedEntriesByModule, allEntries) {
16568
16448
  }
16569
16449
  return chunkModules;
16570
16450
  }
16571
- function getPartitionedChunks(chunkModulesBySignature, minChunkSize) {
16572
- const smallPureChunks = [];
16573
- const bigPureChunks = [];
16574
- const smallSideEffectChunks = [];
16575
- const bigSideEffectChunks = [];
16576
- const chunkByModule = new Map();
16451
+ function getMergeableChunks(chunkModulesBySignature, minChunkSize) {
16452
+ const chunksToBeMerged = new Set();
16453
+ const unmergeableChunks = [];
16454
+ const alias = null;
16577
16455
  for (const [signature, modules] of Object.entries(chunkModulesBySignature)) {
16578
- const chunkDescription = {
16579
- dependencies: new Set(),
16580
- modules,
16581
- pure: true,
16582
- signature,
16583
- size: 0,
16584
- transitiveDependencies: new Set(),
16585
- transitiveDependentChunks: new Set()
16586
- };
16587
16456
  let size = 0;
16588
- let pure = true;
16589
- for (const module of modules) {
16590
- chunkByModule.set(module, chunkDescription);
16591
- pure && (pure = !module.hasEffects());
16592
- size += module.magicString.toString().length;
16593
- }
16594
- chunkDescription.pure = pure;
16595
- chunkDescription.size = size;
16596
- (size < minChunkSize
16597
- ? pure
16598
- ? smallPureChunks
16599
- : smallSideEffectChunks
16600
- : pure
16601
- ? bigPureChunks
16602
- : bigSideEffectChunks).push(chunkDescription);
16603
- }
16604
- sortChunksAndAddDependencies([bigPureChunks, bigSideEffectChunks, smallPureChunks, smallSideEffectChunks], chunkByModule);
16605
- return {
16606
- big: { pure: new Set(bigPureChunks), sideEffect: new Set(bigSideEffectChunks) },
16607
- small: { pure: new Set(smallPureChunks), sideEffect: new Set(smallSideEffectChunks) }
16608
- };
16609
- }
16610
- function getNumberOfCycles(partition) {
16611
- const parents = new Set();
16612
- const analysedChunks = new Set();
16613
- let cycles = 0;
16614
- const analyseChunk = (chunk) => {
16615
- for (const dependency of chunk.dependencies) {
16616
- if (parents.has(dependency)) {
16617
- if (!analysedChunks.has(dependency)) {
16618
- cycles++;
16619
- }
16620
- continue;
16621
- }
16622
- parents.add(dependency);
16623
- analyseChunk(dependency);
16624
- }
16625
- analysedChunks.add(chunk);
16626
- };
16627
- for (const chunk of [
16628
- ...partition.big.pure,
16629
- ...partition.big.sideEffect,
16630
- ...partition.small.pure,
16631
- ...partition.small.sideEffect
16632
- ]) {
16633
- if (!parents.has(chunk)) {
16634
- parents.add(chunk);
16635
- analyseChunk(chunk);
16636
- }
16637
- }
16638
- return cycles;
16639
- }
16640
- function sortChunksAndAddDependencies(chunkLists, chunkByModule) {
16641
- for (const chunks of chunkLists) {
16642
- chunks.sort(compareChunks);
16643
- for (const chunk of chunks) {
16644
- const { dependencies, modules, transitiveDependencies } = chunk;
16645
- const transitiveDependencyModules = new Set();
16457
+ checkModules: {
16646
16458
  for (const module of modules) {
16647
- for (const dependency of module.getDependenciesToBeIncluded()) {
16648
- const dependencyChunk = chunkByModule.get(dependency);
16649
- if (dependencyChunk && dependencyChunk !== chunk) {
16650
- dependencies.add(dependencyChunk);
16651
- transitiveDependencyModules.add(dependency);
16652
- }
16459
+ if (module.hasEffects()) {
16460
+ break checkModules;
16653
16461
  }
16654
- }
16655
- for (const module of transitiveDependencyModules) {
16656
- const transitiveDependency = chunkByModule.get(module);
16657
- if (transitiveDependency !== chunk) {
16658
- transitiveDependencies.add(transitiveDependency);
16659
- transitiveDependency.transitiveDependentChunks.add(chunk);
16660
- for (const dependency of module.getDependenciesToBeIncluded()) {
16661
- if (!(dependency instanceof ExternalModule)) {
16662
- transitiveDependencyModules.add(dependency);
16663
- }
16664
- }
16462
+ size += module.magicString.toString().length;
16463
+ if (size > minChunkSize) {
16464
+ break checkModules;
16665
16465
  }
16666
16466
  }
16467
+ chunksToBeMerged.add({ alias, modules, signature, size });
16468
+ continue;
16667
16469
  }
16470
+ unmergeableChunks.push({ alias, modules, signature, size: null });
16668
16471
  }
16669
- }
16670
- function compareChunks({ size: sizeA }, { size: sizeB }) {
16671
- return sizeA - sizeB;
16672
- }
16673
- function mergeChunks(chunksToBeMerged, targetChunks, minChunkSize, chunkPartition) {
16674
- for (const mergedChunk of chunksToBeMerged) {
16675
- let closestChunk = null;
16676
- let closestChunkDistance = Infinity;
16677
- const { signature, modules, pure, size } = mergedChunk;
16678
- for (const targetChunk of concatLazy(targetChunks)) {
16679
- if (mergedChunk === targetChunk)
16680
- continue;
16681
- const distance = pure
16682
- ? getSignatureDistance(signature, targetChunk.signature, !targetChunk.pure)
16683
- : getSignatureDistance(targetChunk.signature, signature, true);
16684
- if (distance < closestChunkDistance && isValidMerge(mergedChunk, targetChunk)) {
16685
- if (distance === 1) {
16686
- closestChunk = targetChunk;
16687
- break;
16688
- }
16689
- closestChunk = targetChunk;
16690
- closestChunkDistance = distance;
16691
- }
16692
- }
16693
- if (closestChunk) {
16694
- chunksToBeMerged.delete(mergedChunk);
16695
- getChunksInPartition(closestChunk, minChunkSize, chunkPartition).delete(closestChunk);
16696
- closestChunk.modules.push(...modules);
16697
- closestChunk.size += size;
16698
- closestChunk.pure && (closestChunk.pure = pure);
16699
- closestChunk.signature = mergeSignatures(signature, closestChunk.signature);
16700
- const { dependencies, transitiveDependencies, transitiveDependentChunks } = closestChunk;
16701
- for (const dependency of mergedChunk.dependencies) {
16702
- dependencies.add(dependency);
16703
- }
16704
- for (const dependency of mergedChunk.transitiveDependencies) {
16705
- transitiveDependencies.add(dependency);
16706
- dependency.transitiveDependentChunks.delete(mergedChunk);
16707
- dependency.transitiveDependentChunks.add(closestChunk);
16708
- }
16709
- for (const dependentChunk of mergedChunk.transitiveDependentChunks) {
16710
- transitiveDependentChunks.add(dependentChunk);
16711
- if (dependentChunk.dependencies.has(mergedChunk)) {
16712
- dependentChunk.dependencies.delete(mergedChunk);
16713
- dependentChunk.dependencies.add(closestChunk);
16714
- }
16715
- dependentChunk.transitiveDependencies.delete(mergedChunk);
16716
- dependentChunk.transitiveDependencies.add(closestChunk);
16717
- }
16718
- dependencies.delete(closestChunk);
16719
- transitiveDependencies.delete(closestChunk);
16720
- transitiveDependentChunks.delete(closestChunk);
16721
- getChunksInPartition(closestChunk, minChunkSize, chunkPartition).add(closestChunk);
16722
- }
16723
- }
16724
- }
16725
- // If a module is a transitive but not a direct dependency of the other chunk,
16726
- // merging is prohibited as that would create a new cyclic dependency.
16727
- function isValidMerge(mergedChunk, targetChunk) {
16728
- return ((!targetChunk.transitiveDependencies.has(mergedChunk) ||
16729
- targetChunk.dependencies.has(mergedChunk)) &&
16730
- (!mergedChunk.transitiveDependencies.has(targetChunk) ||
16731
- mergedChunk.dependencies.has(targetChunk)));
16732
- }
16733
- function getChunksInPartition(chunk, minChunkSize, chunkPartition) {
16734
- const subPartition = chunk.size < minChunkSize ? chunkPartition.small : chunkPartition.big;
16735
- return chunk.pure ? subPartition.pure : subPartition.sideEffect;
16472
+ return { chunksToBeMerged, unmergeableChunks };
16736
16473
  }
16737
16474
  function getSignatureDistance(sourceSignature, targetSignature, enforceSubset) {
16738
16475
  let distance = 0;
@@ -16760,9 +16497,6 @@ function mergeSignatures(sourceSignature, targetSignature) {
16760
16497
  }
16761
16498
  return signature;
16762
16499
  }
16763
- function getNewSet() {
16764
- return new Set();
16765
- }
16766
16500
 
16767
16501
  // ported from https://github.com/substack/node-commondir
16768
16502
  function commondir(files) {
@@ -25560,6 +25294,7 @@ exports.errorOnlyInlineSourcemapsForStdout = errorOnlyInlineSourcemapsForStdout;
25560
25294
  exports.fseventsImporter = fseventsImporter;
25561
25295
  exports.getAliasName = getAliasName;
25562
25296
  exports.getAugmentedNamespace = getAugmentedNamespace;
25297
+ exports.getNewArray = getNewArray;
25563
25298
  exports.getOrCreate = getOrCreate;
25564
25299
  exports.gray = gray;
25565
25300
  exports.green = green;
@@ -25569,7 +25304,6 @@ exports.loadFsEvents = loadFsEvents;
25569
25304
  exports.mergeOptions = mergeOptions;
25570
25305
  exports.normalizePluginOption = normalizePluginOption;
25571
25306
  exports.picomatch = picomatch$1;
25572
- exports.prettyBytes = prettyBytes;
25573
25307
  exports.printQuotedStringList = printQuotedStringList;
25574
25308
  exports.relativeId = relativeId;
25575
25309
  exports.rollup = rollup;
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.7.1-0
4
- Thu, 08 Dec 2022 05:48:12 GMT - commit a3259be5f30c0b2c85c985459782207fb05f50c3
3
+ Rollup.js v3.7.2
4
+ Sat, 10 Dec 2022 06:16:44 GMT - commit f368adf4943a11207157ec44a83345da7a905a13
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.1-0
4
- Thu, 08 Dec 2022 05:48:12 GMT - commit a3259be5f30c0b2c85c985459782207fb05f50c3
3
+ Rollup.js v3.7.2
4
+ Sat, 10 Dec 2022 06:16:44 GMT - commit f368adf4943a11207157ec44a83345da7a905a13
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.1-0",
3
+ "version": "3.7.2",
4
4
  "description": "Next-generation ES module bundler",
5
5
  "main": "dist/rollup.js",
6
6
  "module": "dist/es/rollup.js",