rollup 3.12.1 → 3.14.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.12.1
6
- Wed, 01 Feb 2023 09:25:11 GMT - commit 0c5aa76cb0e30a66ce7c7972f484c003a5b7b8c1
5
+ Rollup.js v3.14.0
6
+ Sun, 05 Feb 2023 05:33:16 GMT - commit b8526485935ef21c65a5cd5474adbddf24ec7a32
7
7
 
8
8
  https://github.com/rollup/rollup
9
9
 
package/dist/es/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.12.1
4
- Wed, 01 Feb 2023 09:25:11 GMT - commit 0c5aa76cb0e30a66ce7c7972f484c003a5b7b8c1
3
+ Rollup.js v3.14.0
4
+ Sun, 05 Feb 2023 05:33:16 GMT - commit b8526485935ef21c65a5cd5474adbddf24ec7a32
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.12.1
4
- Wed, 01 Feb 2023 09:25:11 GMT - commit 0c5aa76cb0e30a66ce7c7972f484c003a5b7b8c1
3
+ Rollup.js v3.14.0
4
+ Sun, 05 Feb 2023 05:33:16 GMT - commit b8526485935ef21c65a5cd5474adbddf24ec7a32
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -16,7 +16,7 @@ import { lstat, realpath, readdir, readFile, mkdir, writeFile } from 'node:fs/pr
16
16
  import { EventEmitter } from 'node:events';
17
17
  import * as tty from 'tty';
18
18
 
19
- var version$1 = "3.12.1";
19
+ var version$1 = "3.14.0";
20
20
 
21
21
  const comma = ','.charCodeAt(0);
22
22
  const semicolon = ';'.charCodeAt(0);
@@ -6625,7 +6625,7 @@ class LocalVariable extends Variable {
6625
6625
  case INTERACTION_ACCESSED: {
6626
6626
  if (this.isReassigned)
6627
6627
  return true;
6628
- return (this.init &&
6628
+ return !!(this.init &&
6629
6629
  !context.accessed.trackEntityAtPathAndGetIfTracked(path, this) &&
6630
6630
  this.init.hasEffectsOnInteractionAtPath(path, interaction, context));
6631
6631
  }
@@ -6636,14 +6636,14 @@ class LocalVariable extends Variable {
6636
6636
  return false;
6637
6637
  if (this.isReassigned)
6638
6638
  return true;
6639
- return (this.init &&
6639
+ return !!(this.init &&
6640
6640
  !context.assigned.trackEntityAtPathAndGetIfTracked(path, this) &&
6641
6641
  this.init.hasEffectsOnInteractionAtPath(path, interaction, context));
6642
6642
  }
6643
6643
  case INTERACTION_CALLED: {
6644
6644
  if (this.isReassigned)
6645
6645
  return true;
6646
- return (this.init &&
6646
+ return !!(this.init &&
6647
6647
  !(interaction.withNew ? context.instantiated : context.called).trackEntityAtPathAndGetIfTracked(path, interaction.args, this) &&
6648
6648
  this.init.hasEffectsOnInteractionAtPath(path, interaction, context));
6649
6649
  }
@@ -11419,12 +11419,14 @@ class PrivateIdentifier extends NodeBase {
11419
11419
  class Program extends NodeBase {
11420
11420
  constructor() {
11421
11421
  super(...arguments);
11422
- this.hasCachedEffect = false;
11422
+ this.hasCachedEffect = null;
11423
+ }
11424
+ hasCachedEffects() {
11425
+ return this.hasCachedEffect === null
11426
+ ? (this.hasCachedEffect = this.hasEffects(createHasEffectsContext()))
11427
+ : this.hasCachedEffect;
11423
11428
  }
11424
11429
  hasEffects(context) {
11425
- // We are caching here to later more efficiently identify side-effect-free modules
11426
- if (this.hasCachedEffect)
11427
- return true;
11428
11430
  for (const node of this.body) {
11429
11431
  if (node.hasEffects(context)) {
11430
11432
  return (this.hasCachedEffect = true);
@@ -13322,8 +13324,7 @@ class Module {
13322
13324
  return [null];
13323
13325
  }
13324
13326
  hasEffects() {
13325
- return (this.info.moduleSideEffects === 'no-treeshake' ||
13326
- (this.ast.included && this.ast.hasEffects(createHasEffectsContext())));
13327
+ return this.info.moduleSideEffects === 'no-treeshake' || this.ast.hasCachedEffects();
13327
13328
  }
13328
13329
  include() {
13329
13330
  const context = createInclusionContext();
@@ -16041,13 +16042,13 @@ const resolveFileName = (dependency) => dependency.getFileName();
16041
16042
  * their iterators. Useful when e.g. working with large sets or lists and when
16042
16043
  * there is a chance that the iterators will not be fully exhausted.
16043
16044
  */
16044
- function* concatLazy(...iterables) {
16045
+ function* concatLazy(iterables) {
16045
16046
  for (const iterable of iterables) {
16046
16047
  yield* iterable;
16047
16048
  }
16048
16049
  }
16049
16050
 
16050
- function getChunkAssignments(entries, manualChunkAliasByEntry, minChunkSize) {
16051
+ function getChunkAssignments(entries, manualChunkAliasByEntry, minChunkSize, deepChunkOptimization) {
16051
16052
  const chunkDefinitions = [];
16052
16053
  const modulesInManualChunks = new Set(manualChunkAliasByEntry.keys());
16053
16054
  const manualChunkModulesByAlias = Object.create(null);
@@ -16062,7 +16063,7 @@ function getChunkAssignments(entries, manualChunkAliasByEntry, minChunkSize) {
16062
16063
  const assignedEntriesByModule = new Map();
16063
16064
  for (const entry of allEntries) {
16064
16065
  if (!modulesInManualChunks.has(entry)) {
16065
- assignEntryToStaticDependencies(entry, dependentEntriesByModule, assignedEntriesByModule, modulesInManualChunks, staticEntries, dynamicallyDependentEntriesByDynamicEntry);
16066
+ assignEntryToStaticDependencies(entry, dependentEntriesByModule, assignedEntriesByModule, modulesInManualChunks, staticEntries, dynamicallyDependentEntriesByDynamicEntry, deepChunkOptimization);
16066
16067
  }
16067
16068
  }
16068
16069
  chunkDefinitions.push(...createChunks(allEntries, assignedEntriesByModule, minChunkSize));
@@ -16130,13 +16131,13 @@ function getDynamicallyDependentEntriesByDynamicEntry(dependentEntriesByModule,
16130
16131
  }
16131
16132
  return dynamicallyDependentEntriesByDynamicEntry;
16132
16133
  }
16133
- function assignEntryToStaticDependencies(entry, dependentEntriesByModule, assignedEntriesByModule, modulesInManualChunks, staticEntries, dynamicallyDependentEntriesByDynamicEntry) {
16134
+ function assignEntryToStaticDependencies(entry, dependentEntriesByModule, assignedEntriesByModule, modulesInManualChunks, staticEntries, dynamicallyDependentEntriesByDynamicEntry, deepChunkOptimization) {
16134
16135
  const dynamicallyDependentEntries = dynamicallyDependentEntriesByDynamicEntry.get(entry);
16135
16136
  const modulesToHandle = new Set([entry]);
16136
16137
  for (const module of modulesToHandle) {
16137
16138
  const assignedEntries = getOrCreate(assignedEntriesByModule, module, getNewSet);
16138
16139
  if (dynamicallyDependentEntries &&
16139
- isModuleAlreadyLoaded(dynamicallyDependentEntries, dependentEntriesByModule.get(module), staticEntries, dynamicallyDependentEntriesByDynamicEntry)) {
16140
+ isModuleAlreadyLoaded(dynamicallyDependentEntries, dependentEntriesByModule.get(module), staticEntries, dynamicallyDependentEntriesByDynamicEntry, deepChunkOptimization)) {
16140
16141
  continue;
16141
16142
  }
16142
16143
  else {
@@ -16154,8 +16155,9 @@ const MAX_ENTRIES_TO_CHECK_FOR_SHARED_DEPENDENCIES = 3;
16154
16155
  // - first, create chunks without looking for modules already in memory
16155
16156
  // - all modules that are in the same chunk after this will behave the same
16156
16157
  // -> Do not iterate by module but by equivalence group and merge chunks
16157
- function isModuleAlreadyLoaded(dynamicallyDependentEntries, containedIn, staticEntries, dynamicallyDependentEntriesByDynamicEntry) {
16158
- if (dynamicallyDependentEntries.size > MAX_ENTRIES_TO_CHECK_FOR_SHARED_DEPENDENCIES) {
16158
+ function isModuleAlreadyLoaded(dynamicallyDependentEntries, containedIn, staticEntries, dynamicallyDependentEntriesByDynamicEntry, deepChunkOptimization) {
16159
+ if (!deepChunkOptimization &&
16160
+ dynamicallyDependentEntries.size > MAX_ENTRIES_TO_CHECK_FOR_SHARED_DEPENDENCIES) {
16159
16161
  return false;
16160
16162
  }
16161
16163
  const entriesToCheck = new Set(dynamicallyDependentEntries);
@@ -16165,7 +16167,8 @@ function isModuleAlreadyLoaded(dynamicallyDependentEntries, containedIn, staticE
16165
16167
  return false;
16166
16168
  }
16167
16169
  const dynamicallyDependentEntries = dynamicallyDependentEntriesByDynamicEntry.get(entry);
16168
- if (dynamicallyDependentEntries.size > MAX_ENTRIES_TO_CHECK_FOR_SHARED_DEPENDENCIES) {
16170
+ if (!deepChunkOptimization &&
16171
+ dynamicallyDependentEntries.size > MAX_ENTRIES_TO_CHECK_FOR_SHARED_DEPENDENCIES) {
16169
16172
  return false;
16170
16173
  }
16171
16174
  for (const dependentEntry of dynamicallyDependentEntries) {
@@ -16182,47 +16185,11 @@ function createChunks(allEntries, assignedEntriesByModule, minChunkSize) {
16182
16185
  alias: null,
16183
16186
  modules
16184
16187
  }))
16185
- : getOptimizedChunks(chunkModulesBySignature, minChunkSize);
16186
- }
16187
- function getOptimizedChunks(chunkModulesBySignature, minChunkSize) {
16188
- timeStart('optimize chunks', 3);
16189
- const { chunksToBeMerged, unmergeableChunks } = getMergeableChunks(chunkModulesBySignature, minChunkSize);
16190
- for (const sourceChunk of chunksToBeMerged) {
16191
- chunksToBeMerged.delete(sourceChunk);
16192
- let closestChunk = null;
16193
- let closestChunkDistance = Infinity;
16194
- const { signature, size, modules } = sourceChunk;
16195
- for (const targetChunk of concatLazy(chunksToBeMerged, unmergeableChunks)) {
16196
- const distance = getSignatureDistance(signature, targetChunk.signature, !chunksToBeMerged.has(targetChunk));
16197
- if (distance === 1) {
16198
- closestChunk = targetChunk;
16199
- break;
16200
- }
16201
- else if (distance < closestChunkDistance) {
16202
- closestChunk = targetChunk;
16203
- closestChunkDistance = distance;
16204
- }
16205
- }
16206
- if (closestChunk) {
16207
- closestChunk.modules.push(...modules);
16208
- if (chunksToBeMerged.has(closestChunk)) {
16209
- closestChunk.signature = mergeSignatures(signature, closestChunk.signature);
16210
- if ((closestChunk.size += size) > minChunkSize) {
16211
- chunksToBeMerged.delete(closestChunk);
16212
- unmergeableChunks.push(closestChunk);
16213
- }
16214
- }
16215
- }
16216
- else {
16217
- unmergeableChunks.push(sourceChunk);
16218
- }
16219
- }
16220
- timeEnd('optimize chunks', 3);
16221
- return unmergeableChunks;
16188
+ : getOptimizedChunks(chunkModulesBySignature, minChunkSize).map(({ modules }) => ({
16189
+ alias: null,
16190
+ modules
16191
+ }));
16222
16192
  }
16223
- const CHAR_DEPENDENT = 'X';
16224
- const CHAR_INDEPENDENT = '_';
16225
- const CHAR_CODE_DEPENDENT = CHAR_DEPENDENT.charCodeAt(0);
16226
16193
  function getChunkModulesBySignature(assignedEntriesByModule, allEntries) {
16227
16194
  const chunkModules = Object.create(null);
16228
16195
  for (const [module, assignedEntries] of assignedEntriesByModule) {
@@ -16240,28 +16207,167 @@ function getChunkModulesBySignature(assignedEntriesByModule, allEntries) {
16240
16207
  }
16241
16208
  return chunkModules;
16242
16209
  }
16243
- function getMergeableChunks(chunkModulesBySignature, minChunkSize) {
16244
- const chunksToBeMerged = new Set();
16245
- const unmergeableChunks = [];
16246
- const alias = null;
16210
+ /**
16211
+ * This function tries to get rid of small chunks by merging them with other
16212
+ * chunks. In order to merge chunks, one must obey the following rule:
16213
+ * - When merging several chunks, at most one of the chunks can have side
16214
+ * effects
16215
+ * - When one of the chunks has side effects, the entry points depending on that
16216
+ * chunk need to be a super set of the entry points depending on the other
16217
+ * chunks
16218
+ * - Pure chunks can always be merged
16219
+ * - We use the entry point dependence signature to calculate "chunk distance",
16220
+ * i.e. how likely it is that two chunks are loaded together
16221
+ */
16222
+ function getOptimizedChunks(chunkModulesBySignature, minChunkSize) {
16223
+ timeStart('optimize chunks', 3);
16224
+ const chunkPartition = getPartitionedChunks(chunkModulesBySignature, minChunkSize);
16225
+ if (chunkPartition.small.sideEffect.size > 0) {
16226
+ mergeChunks(chunkPartition.small.sideEffect, [chunkPartition.small.pure, chunkPartition.big.pure], minChunkSize, chunkPartition);
16227
+ }
16228
+ if (chunkPartition.small.pure.size > 0) {
16229
+ mergeChunks(chunkPartition.small.pure, [chunkPartition.small.pure, chunkPartition.big.sideEffect, chunkPartition.big.pure], minChunkSize, chunkPartition);
16230
+ }
16231
+ timeEnd('optimize chunks', 3);
16232
+ return [
16233
+ ...chunkPartition.small.sideEffect,
16234
+ ...chunkPartition.small.pure,
16235
+ ...chunkPartition.big.sideEffect,
16236
+ ...chunkPartition.big.pure
16237
+ ];
16238
+ }
16239
+ const CHAR_DEPENDENT = 'X';
16240
+ const CHAR_INDEPENDENT = '_';
16241
+ const CHAR_CODE_DEPENDENT = CHAR_DEPENDENT.charCodeAt(0);
16242
+ function getPartitionedChunks(chunkModulesBySignature, minChunkSize) {
16243
+ const smallPureChunks = [];
16244
+ const bigPureChunks = [];
16245
+ const smallSideEffectChunks = [];
16246
+ const bigSideEffectChunks = [];
16247
+ const chunkByModule = new Map();
16247
16248
  for (const [signature, modules] of Object.entries(chunkModulesBySignature)) {
16249
+ const chunkDescription = {
16250
+ dependencies: new Set(),
16251
+ dependentChunks: new Set(),
16252
+ modules,
16253
+ pure: true,
16254
+ signature,
16255
+ size: 0
16256
+ };
16248
16257
  let size = 0;
16249
- checkModules: {
16258
+ let pure = true;
16259
+ for (const module of modules) {
16260
+ chunkByModule.set(module, chunkDescription);
16261
+ pure && (pure = !module.hasEffects());
16262
+ // Unfortunately, we cannot take tree-shaking into account here because
16263
+ // rendering did not happen yet
16264
+ size += module.originalCode.length;
16265
+ }
16266
+ chunkDescription.pure = pure;
16267
+ chunkDescription.size = size;
16268
+ (size < minChunkSize
16269
+ ? pure
16270
+ ? smallPureChunks
16271
+ : smallSideEffectChunks
16272
+ : pure
16273
+ ? bigPureChunks
16274
+ : bigSideEffectChunks).push(chunkDescription);
16275
+ }
16276
+ sortChunksAndAddDependencies([bigPureChunks, bigSideEffectChunks, smallPureChunks, smallSideEffectChunks], chunkByModule);
16277
+ return {
16278
+ big: { pure: new Set(bigPureChunks), sideEffect: new Set(bigSideEffectChunks) },
16279
+ small: { pure: new Set(smallPureChunks), sideEffect: new Set(smallSideEffectChunks) }
16280
+ };
16281
+ }
16282
+ function sortChunksAndAddDependencies(chunkLists, chunkByModule) {
16283
+ for (const chunks of chunkLists) {
16284
+ chunks.sort(compareChunks);
16285
+ for (const chunk of chunks) {
16286
+ const { dependencies, modules } = chunk;
16250
16287
  for (const module of modules) {
16251
- if (module.hasEffects()) {
16252
- break checkModules;
16288
+ for (const dependency of module.getDependenciesToBeIncluded()) {
16289
+ const dependencyChunk = chunkByModule.get(dependency);
16290
+ if (dependencyChunk && dependencyChunk !== chunk) {
16291
+ dependencies.add(dependencyChunk);
16292
+ dependencyChunk.dependentChunks.add(chunk);
16293
+ }
16253
16294
  }
16254
- size += module.magicString.toString().length;
16255
- if (size > minChunkSize) {
16256
- break checkModules;
16295
+ }
16296
+ }
16297
+ }
16298
+ }
16299
+ function compareChunks({ size: sizeA }, { size: sizeB }) {
16300
+ return sizeA - sizeB;
16301
+ }
16302
+ function mergeChunks(chunksToBeMerged, targetChunks, minChunkSize, chunkPartition) {
16303
+ for (const mergedChunk of chunksToBeMerged) {
16304
+ let closestChunk = null;
16305
+ let closestChunkDistance = Infinity;
16306
+ const { signature, modules, pure, size } = mergedChunk;
16307
+ for (const targetChunk of concatLazy(targetChunks)) {
16308
+ if (mergedChunk === targetChunk)
16309
+ continue;
16310
+ // Possible improvement:
16311
+ // For dynamic entries depending on a pure chunk, it is safe to merge that
16312
+ // chunk into the chunk doing the dynamic import (i.e. into an "already
16313
+ // loaded chunk") even if it is not pure.
16314
+ // One way of handling this could be to add all "already loaded entries"
16315
+ // of the dynamic importers into the signature as well. That could also
16316
+ // change the way we do code-splitting for already loaded entries.
16317
+ const distance = pure
16318
+ ? getSignatureDistance(signature, targetChunk.signature, !targetChunk.pure)
16319
+ : getSignatureDistance(targetChunk.signature, signature, true);
16320
+ if (distance < closestChunkDistance && isValidMerge(mergedChunk, targetChunk)) {
16321
+ if (distance === 1) {
16322
+ closestChunk = targetChunk;
16323
+ break;
16257
16324
  }
16325
+ closestChunk = targetChunk;
16326
+ closestChunkDistance = distance;
16258
16327
  }
16259
- chunksToBeMerged.add({ alias, modules, signature, size });
16260
- continue;
16261
16328
  }
16262
- unmergeableChunks.push({ alias, modules, signature, size: null });
16329
+ if (closestChunk) {
16330
+ chunksToBeMerged.delete(mergedChunk);
16331
+ getChunksInPartition(closestChunk, minChunkSize, chunkPartition).delete(closestChunk);
16332
+ closestChunk.modules.push(...modules);
16333
+ closestChunk.size += size;
16334
+ closestChunk.pure && (closestChunk.pure = pure);
16335
+ closestChunk.signature = mergeSignatures(signature, closestChunk.signature);
16336
+ const { dependencies, dependentChunks } = closestChunk;
16337
+ for (const dependency of mergedChunk.dependencies) {
16338
+ dependencies.add(dependency);
16339
+ }
16340
+ for (const dependentChunk of mergedChunk.dependentChunks) {
16341
+ dependentChunks.add(dependentChunk);
16342
+ dependentChunk.dependencies.delete(mergedChunk);
16343
+ dependentChunk.dependencies.add(closestChunk);
16344
+ }
16345
+ dependencies.delete(closestChunk);
16346
+ getChunksInPartition(closestChunk, minChunkSize, chunkPartition).add(closestChunk);
16347
+ }
16263
16348
  }
16264
- return { chunksToBeMerged, unmergeableChunks };
16349
+ }
16350
+ // Merging will not produce cycles if none of the direct non-merged dependencies
16351
+ // of a chunk have the other chunk as a transitive dependency
16352
+ function isValidMerge(mergedChunk, targetChunk) {
16353
+ return !(hasTransitiveDependency(mergedChunk, targetChunk) ||
16354
+ hasTransitiveDependency(targetChunk, mergedChunk));
16355
+ }
16356
+ function hasTransitiveDependency(dependentChunk, dependencyChunk) {
16357
+ const chunksToCheck = new Set(dependentChunk.dependencies);
16358
+ for (const { dependencies } of chunksToCheck) {
16359
+ for (const dependency of dependencies) {
16360
+ if (dependency === dependencyChunk) {
16361
+ return true;
16362
+ }
16363
+ chunksToCheck.add(dependency);
16364
+ }
16365
+ }
16366
+ return false;
16367
+ }
16368
+ function getChunksInPartition(chunk, minChunkSize, chunkPartition) {
16369
+ const subPartition = chunk.size < minChunkSize ? chunkPartition.small : chunkPartition.big;
16370
+ return chunk.pure ? subPartition.pure : subPartition.sideEffect;
16265
16371
  }
16266
16372
  function getSignatureDistance(sourceSignature, targetSignature, enforceSubset) {
16267
16373
  let distance = 0;
@@ -16889,7 +16995,7 @@ class Bundle {
16889
16995
  this.pluginDriver.finaliseAssets();
16890
16996
  }
16891
16997
  async generateChunks(bundle, getHashPlaceholder) {
16892
- const { experimentalMinChunkSize, inlineDynamicImports, manualChunks, preserveModules } = this.outputOptions;
16998
+ const { experimentalDeepDynamicChunkOptimization, experimentalMinChunkSize, inlineDynamicImports, manualChunks, preserveModules } = this.outputOptions;
16893
16999
  const manualChunkAliasByEntry = typeof manualChunks === 'object'
16894
17000
  ? await this.addManualChunks(manualChunks)
16895
17001
  : this.assignManualChunks(manualChunks);
@@ -16903,7 +17009,7 @@ class Bundle {
16903
17009
  ? [{ alias: null, modules: includedModules }]
16904
17010
  : preserveModules
16905
17011
  ? includedModules.map(module => ({ alias: null, modules: [module] }))
16906
- : getChunkAssignments(this.graph.entryModules, manualChunkAliasByEntry, experimentalMinChunkSize)) {
17012
+ : getChunkAssignments(this.graph.entryModules, manualChunkAliasByEntry, experimentalMinChunkSize, experimentalDeepDynamicChunkOptimization)) {
16907
17013
  sortByExecutionOrder(modules);
16908
17014
  const chunk = new Chunk(modules, this.inputOptions, this.outputOptions, this.unsetOptions, this.pluginDriver, this.graph.modulesById, chunkByModule, externalChunkByModule, this.facadeChunkByModule, this.includedNamespaces, alias, getHashPlaceholder, bundle, inputBase, snippets);
16909
17015
  chunks.push(chunk);
@@ -24694,6 +24800,7 @@ async function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
24694
24800
  dynamicImportInCjs: config.dynamicImportInCjs ?? true,
24695
24801
  entryFileNames: getEntryFileNames(config, unsetOptions),
24696
24802
  esModule: config.esModule ?? 'if-default-prop',
24803
+ experimentalDeepDynamicChunkOptimization: config.experimentalDeepDynamicChunkOptimization || false,
24697
24804
  experimentalMinChunkSize: config.experimentalMinChunkSize || 0,
24698
24805
  exports: getExports(config, unsetOptions),
24699
24806
  extend: config.extend || false,
@@ -25385,6 +25492,7 @@ async function mergeOutputOptions(config, overrides, warn) {
25385
25492
  dynamicImportInCjs: getOption('dynamicImportInCjs'),
25386
25493
  entryFileNames: getOption('entryFileNames'),
25387
25494
  esModule: getOption('esModule'),
25495
+ experimentalDeepDynamicChunkOptimization: getOption('experimentalDeepDynamicChunkOptimization'),
25388
25496
  experimentalMinChunkSize: getOption('experimentalMinChunkSize'),
25389
25497
  exports: getOption('exports'),
25390
25498
  extend: getOption('extend'),
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.12.1
4
- Wed, 01 Feb 2023 09:25:11 GMT - commit 0c5aa76cb0e30a66ce7c7972f484c003a5b7b8c1
3
+ Rollup.js v3.14.0
4
+ Sun, 05 Feb 2023 05:33:16 GMT - commit b8526485935ef21c65a5cd5474adbddf24ec7a32
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.12.1
4
- Wed, 01 Feb 2023 09:25:11 GMT - commit 0c5aa76cb0e30a66ce7c7972f484c003a5b7b8c1
3
+ Rollup.js v3.14.0
4
+ Sun, 05 Feb 2023 05:33:16 GMT - commit b8526485935ef21c65a5cd5474adbddf24ec7a32
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
package/dist/rollup.d.ts CHANGED
@@ -647,6 +647,7 @@ export interface OutputOptions {
647
647
  dynamicImportInCjs?: boolean;
648
648
  entryFileNames?: string | ((chunkInfo: PreRenderedChunk) => string);
649
649
  esModule?: boolean | 'if-default-prop';
650
+ experimentalDeepDynamicChunkOptimization?: boolean;
650
651
  experimentalMinChunkSize?: number;
651
652
  exports?: 'default' | 'named' | 'none' | 'auto';
652
653
  extend?: boolean;
@@ -700,6 +701,7 @@ export interface NormalizedOutputOptions {
700
701
  dynamicImportInCjs: boolean;
701
702
  entryFileNames: string | ((chunkInfo: PreRenderedChunk) => string);
702
703
  esModule: boolean | 'if-default-prop';
704
+ experimentalDeepDynamicChunkOptimization: boolean;
703
705
  experimentalMinChunkSize: number;
704
706
  exports: 'default' | 'named' | 'none' | 'auto';
705
707
  extend: boolean;
package/dist/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.12.1
4
- Wed, 01 Feb 2023 09:25:11 GMT - commit 0c5aa76cb0e30a66ce7c7972f484c003a5b7b8c1
3
+ Rollup.js v3.14.0
4
+ Sun, 05 Feb 2023 05:33:16 GMT - commit b8526485935ef21c65a5cd5474adbddf24ec7a32
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.12.1
4
- Wed, 01 Feb 2023 09:25:11 GMT - commit 0c5aa76cb0e30a66ce7c7972f484c003a5b7b8c1
3
+ Rollup.js v3.14.0
4
+ Sun, 05 Feb 2023 05:33:16 GMT - commit b8526485935ef21c65a5cd5474adbddf24ec7a32
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.12.1
4
- Wed, 01 Feb 2023 09:25:11 GMT - commit 0c5aa76cb0e30a66ce7c7972f484c003a5b7b8c1
3
+ Rollup.js v3.14.0
4
+ Sun, 05 Feb 2023 05:33:16 GMT - commit b8526485935ef21c65a5cd5474adbddf24ec7a32
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.12.1
4
- Wed, 01 Feb 2023 09:25:11 GMT - commit 0c5aa76cb0e30a66ce7c7972f484c003a5b7b8c1
3
+ Rollup.js v3.14.0
4
+ Sun, 05 Feb 2023 05:33:16 GMT - commit b8526485935ef21c65a5cd5474adbddf24ec7a32
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.12.1";
34
+ var version$1 = "3.14.0";
35
35
 
36
36
  function ensureArray$1(items) {
37
37
  if (Array.isArray(items)) {
@@ -1081,6 +1081,7 @@ async function mergeOutputOptions(config, overrides, warn) {
1081
1081
  dynamicImportInCjs: getOption('dynamicImportInCjs'),
1082
1082
  entryFileNames: getOption('entryFileNames'),
1083
1083
  esModule: getOption('esModule'),
1084
+ experimentalDeepDynamicChunkOptimization: getOption('experimentalDeepDynamicChunkOptimization'),
1084
1085
  experimentalMinChunkSize: getOption('experimentalMinChunkSize'),
1085
1086
  exports: getOption('exports'),
1086
1087
  extend: getOption('extend'),
@@ -7143,7 +7144,7 @@ class LocalVariable extends Variable {
7143
7144
  case INTERACTION_ACCESSED: {
7144
7145
  if (this.isReassigned)
7145
7146
  return true;
7146
- return (this.init &&
7147
+ return !!(this.init &&
7147
7148
  !context.accessed.trackEntityAtPathAndGetIfTracked(path, this) &&
7148
7149
  this.init.hasEffectsOnInteractionAtPath(path, interaction, context));
7149
7150
  }
@@ -7154,14 +7155,14 @@ class LocalVariable extends Variable {
7154
7155
  return false;
7155
7156
  if (this.isReassigned)
7156
7157
  return true;
7157
- return (this.init &&
7158
+ return !!(this.init &&
7158
7159
  !context.assigned.trackEntityAtPathAndGetIfTracked(path, this) &&
7159
7160
  this.init.hasEffectsOnInteractionAtPath(path, interaction, context));
7160
7161
  }
7161
7162
  case INTERACTION_CALLED: {
7162
7163
  if (this.isReassigned)
7163
7164
  return true;
7164
- return (this.init &&
7165
+ return !!(this.init &&
7165
7166
  !(interaction.withNew ? context.instantiated : context.called).trackEntityAtPathAndGetIfTracked(path, interaction.args, this) &&
7166
7167
  this.init.hasEffectsOnInteractionAtPath(path, interaction, context));
7167
7168
  }
@@ -11937,12 +11938,14 @@ class PrivateIdentifier extends NodeBase {
11937
11938
  class Program extends NodeBase {
11938
11939
  constructor() {
11939
11940
  super(...arguments);
11940
- this.hasCachedEffect = false;
11941
+ this.hasCachedEffect = null;
11942
+ }
11943
+ hasCachedEffects() {
11944
+ return this.hasCachedEffect === null
11945
+ ? (this.hasCachedEffect = this.hasEffects(createHasEffectsContext()))
11946
+ : this.hasCachedEffect;
11941
11947
  }
11942
11948
  hasEffects(context) {
11943
- // We are caching here to later more efficiently identify side-effect-free modules
11944
- if (this.hasCachedEffect)
11945
- return true;
11946
11949
  for (const node of this.body) {
11947
11950
  if (node.hasEffects(context)) {
11948
11951
  return (this.hasCachedEffect = true);
@@ -13840,8 +13843,7 @@ class Module {
13840
13843
  return [null];
13841
13844
  }
13842
13845
  hasEffects() {
13843
- return (this.info.moduleSideEffects === 'no-treeshake' ||
13844
- (this.ast.included && this.ast.hasEffects(createHasEffectsContext())));
13846
+ return this.info.moduleSideEffects === 'no-treeshake' || this.ast.hasCachedEffects();
13845
13847
  }
13846
13848
  include() {
13847
13849
  const context = createInclusionContext();
@@ -16559,13 +16561,13 @@ const resolveFileName = (dependency) => dependency.getFileName();
16559
16561
  * their iterators. Useful when e.g. working with large sets or lists and when
16560
16562
  * there is a chance that the iterators will not be fully exhausted.
16561
16563
  */
16562
- function* concatLazy(...iterables) {
16564
+ function* concatLazy(iterables) {
16563
16565
  for (const iterable of iterables) {
16564
16566
  yield* iterable;
16565
16567
  }
16566
16568
  }
16567
16569
 
16568
- function getChunkAssignments(entries, manualChunkAliasByEntry, minChunkSize) {
16570
+ function getChunkAssignments(entries, manualChunkAliasByEntry, minChunkSize, deepChunkOptimization) {
16569
16571
  const chunkDefinitions = [];
16570
16572
  const modulesInManualChunks = new Set(manualChunkAliasByEntry.keys());
16571
16573
  const manualChunkModulesByAlias = Object.create(null);
@@ -16580,7 +16582,7 @@ function getChunkAssignments(entries, manualChunkAliasByEntry, minChunkSize) {
16580
16582
  const assignedEntriesByModule = new Map();
16581
16583
  for (const entry of allEntries) {
16582
16584
  if (!modulesInManualChunks.has(entry)) {
16583
- assignEntryToStaticDependencies(entry, dependentEntriesByModule, assignedEntriesByModule, modulesInManualChunks, staticEntries, dynamicallyDependentEntriesByDynamicEntry);
16585
+ assignEntryToStaticDependencies(entry, dependentEntriesByModule, assignedEntriesByModule, modulesInManualChunks, staticEntries, dynamicallyDependentEntriesByDynamicEntry, deepChunkOptimization);
16584
16586
  }
16585
16587
  }
16586
16588
  chunkDefinitions.push(...createChunks(allEntries, assignedEntriesByModule, minChunkSize));
@@ -16648,13 +16650,13 @@ function getDynamicallyDependentEntriesByDynamicEntry(dependentEntriesByModule,
16648
16650
  }
16649
16651
  return dynamicallyDependentEntriesByDynamicEntry;
16650
16652
  }
16651
- function assignEntryToStaticDependencies(entry, dependentEntriesByModule, assignedEntriesByModule, modulesInManualChunks, staticEntries, dynamicallyDependentEntriesByDynamicEntry) {
16653
+ function assignEntryToStaticDependencies(entry, dependentEntriesByModule, assignedEntriesByModule, modulesInManualChunks, staticEntries, dynamicallyDependentEntriesByDynamicEntry, deepChunkOptimization) {
16652
16654
  const dynamicallyDependentEntries = dynamicallyDependentEntriesByDynamicEntry.get(entry);
16653
16655
  const modulesToHandle = new Set([entry]);
16654
16656
  for (const module of modulesToHandle) {
16655
16657
  const assignedEntries = getOrCreate(assignedEntriesByModule, module, getNewSet);
16656
16658
  if (dynamicallyDependentEntries &&
16657
- isModuleAlreadyLoaded(dynamicallyDependentEntries, dependentEntriesByModule.get(module), staticEntries, dynamicallyDependentEntriesByDynamicEntry)) {
16659
+ isModuleAlreadyLoaded(dynamicallyDependentEntries, dependentEntriesByModule.get(module), staticEntries, dynamicallyDependentEntriesByDynamicEntry, deepChunkOptimization)) {
16658
16660
  continue;
16659
16661
  }
16660
16662
  else {
@@ -16672,8 +16674,9 @@ const MAX_ENTRIES_TO_CHECK_FOR_SHARED_DEPENDENCIES = 3;
16672
16674
  // - first, create chunks without looking for modules already in memory
16673
16675
  // - all modules that are in the same chunk after this will behave the same
16674
16676
  // -> Do not iterate by module but by equivalence group and merge chunks
16675
- function isModuleAlreadyLoaded(dynamicallyDependentEntries, containedIn, staticEntries, dynamicallyDependentEntriesByDynamicEntry) {
16676
- if (dynamicallyDependentEntries.size > MAX_ENTRIES_TO_CHECK_FOR_SHARED_DEPENDENCIES) {
16677
+ function isModuleAlreadyLoaded(dynamicallyDependentEntries, containedIn, staticEntries, dynamicallyDependentEntriesByDynamicEntry, deepChunkOptimization) {
16678
+ if (!deepChunkOptimization &&
16679
+ dynamicallyDependentEntries.size > MAX_ENTRIES_TO_CHECK_FOR_SHARED_DEPENDENCIES) {
16677
16680
  return false;
16678
16681
  }
16679
16682
  const entriesToCheck = new Set(dynamicallyDependentEntries);
@@ -16683,7 +16686,8 @@ function isModuleAlreadyLoaded(dynamicallyDependentEntries, containedIn, staticE
16683
16686
  return false;
16684
16687
  }
16685
16688
  const dynamicallyDependentEntries = dynamicallyDependentEntriesByDynamicEntry.get(entry);
16686
- if (dynamicallyDependentEntries.size > MAX_ENTRIES_TO_CHECK_FOR_SHARED_DEPENDENCIES) {
16689
+ if (!deepChunkOptimization &&
16690
+ dynamicallyDependentEntries.size > MAX_ENTRIES_TO_CHECK_FOR_SHARED_DEPENDENCIES) {
16687
16691
  return false;
16688
16692
  }
16689
16693
  for (const dependentEntry of dynamicallyDependentEntries) {
@@ -16700,47 +16704,11 @@ function createChunks(allEntries, assignedEntriesByModule, minChunkSize) {
16700
16704
  alias: null,
16701
16705
  modules
16702
16706
  }))
16703
- : getOptimizedChunks(chunkModulesBySignature, minChunkSize);
16704
- }
16705
- function getOptimizedChunks(chunkModulesBySignature, minChunkSize) {
16706
- timeStart('optimize chunks', 3);
16707
- const { chunksToBeMerged, unmergeableChunks } = getMergeableChunks(chunkModulesBySignature, minChunkSize);
16708
- for (const sourceChunk of chunksToBeMerged) {
16709
- chunksToBeMerged.delete(sourceChunk);
16710
- let closestChunk = null;
16711
- let closestChunkDistance = Infinity;
16712
- const { signature, size, modules } = sourceChunk;
16713
- for (const targetChunk of concatLazy(chunksToBeMerged, unmergeableChunks)) {
16714
- const distance = getSignatureDistance(signature, targetChunk.signature, !chunksToBeMerged.has(targetChunk));
16715
- if (distance === 1) {
16716
- closestChunk = targetChunk;
16717
- break;
16718
- }
16719
- else if (distance < closestChunkDistance) {
16720
- closestChunk = targetChunk;
16721
- closestChunkDistance = distance;
16722
- }
16723
- }
16724
- if (closestChunk) {
16725
- closestChunk.modules.push(...modules);
16726
- if (chunksToBeMerged.has(closestChunk)) {
16727
- closestChunk.signature = mergeSignatures(signature, closestChunk.signature);
16728
- if ((closestChunk.size += size) > minChunkSize) {
16729
- chunksToBeMerged.delete(closestChunk);
16730
- unmergeableChunks.push(closestChunk);
16731
- }
16732
- }
16733
- }
16734
- else {
16735
- unmergeableChunks.push(sourceChunk);
16736
- }
16737
- }
16738
- timeEnd('optimize chunks', 3);
16739
- return unmergeableChunks;
16707
+ : getOptimizedChunks(chunkModulesBySignature, minChunkSize).map(({ modules }) => ({
16708
+ alias: null,
16709
+ modules
16710
+ }));
16740
16711
  }
16741
- const CHAR_DEPENDENT = 'X';
16742
- const CHAR_INDEPENDENT = '_';
16743
- const CHAR_CODE_DEPENDENT = CHAR_DEPENDENT.charCodeAt(0);
16744
16712
  function getChunkModulesBySignature(assignedEntriesByModule, allEntries) {
16745
16713
  const chunkModules = Object.create(null);
16746
16714
  for (const [module, assignedEntries] of assignedEntriesByModule) {
@@ -16758,28 +16726,167 @@ function getChunkModulesBySignature(assignedEntriesByModule, allEntries) {
16758
16726
  }
16759
16727
  return chunkModules;
16760
16728
  }
16761
- function getMergeableChunks(chunkModulesBySignature, minChunkSize) {
16762
- const chunksToBeMerged = new Set();
16763
- const unmergeableChunks = [];
16764
- const alias = null;
16729
+ /**
16730
+ * This function tries to get rid of small chunks by merging them with other
16731
+ * chunks. In order to merge chunks, one must obey the following rule:
16732
+ * - When merging several chunks, at most one of the chunks can have side
16733
+ * effects
16734
+ * - When one of the chunks has side effects, the entry points depending on that
16735
+ * chunk need to be a super set of the entry points depending on the other
16736
+ * chunks
16737
+ * - Pure chunks can always be merged
16738
+ * - We use the entry point dependence signature to calculate "chunk distance",
16739
+ * i.e. how likely it is that two chunks are loaded together
16740
+ */
16741
+ function getOptimizedChunks(chunkModulesBySignature, minChunkSize) {
16742
+ timeStart('optimize chunks', 3);
16743
+ const chunkPartition = getPartitionedChunks(chunkModulesBySignature, minChunkSize);
16744
+ if (chunkPartition.small.sideEffect.size > 0) {
16745
+ mergeChunks(chunkPartition.small.sideEffect, [chunkPartition.small.pure, chunkPartition.big.pure], minChunkSize, chunkPartition);
16746
+ }
16747
+ if (chunkPartition.small.pure.size > 0) {
16748
+ mergeChunks(chunkPartition.small.pure, [chunkPartition.small.pure, chunkPartition.big.sideEffect, chunkPartition.big.pure], minChunkSize, chunkPartition);
16749
+ }
16750
+ timeEnd('optimize chunks', 3);
16751
+ return [
16752
+ ...chunkPartition.small.sideEffect,
16753
+ ...chunkPartition.small.pure,
16754
+ ...chunkPartition.big.sideEffect,
16755
+ ...chunkPartition.big.pure
16756
+ ];
16757
+ }
16758
+ const CHAR_DEPENDENT = 'X';
16759
+ const CHAR_INDEPENDENT = '_';
16760
+ const CHAR_CODE_DEPENDENT = CHAR_DEPENDENT.charCodeAt(0);
16761
+ function getPartitionedChunks(chunkModulesBySignature, minChunkSize) {
16762
+ const smallPureChunks = [];
16763
+ const bigPureChunks = [];
16764
+ const smallSideEffectChunks = [];
16765
+ const bigSideEffectChunks = [];
16766
+ const chunkByModule = new Map();
16765
16767
  for (const [signature, modules] of Object.entries(chunkModulesBySignature)) {
16768
+ const chunkDescription = {
16769
+ dependencies: new Set(),
16770
+ dependentChunks: new Set(),
16771
+ modules,
16772
+ pure: true,
16773
+ signature,
16774
+ size: 0
16775
+ };
16766
16776
  let size = 0;
16767
- checkModules: {
16777
+ let pure = true;
16778
+ for (const module of modules) {
16779
+ chunkByModule.set(module, chunkDescription);
16780
+ pure && (pure = !module.hasEffects());
16781
+ // Unfortunately, we cannot take tree-shaking into account here because
16782
+ // rendering did not happen yet
16783
+ size += module.originalCode.length;
16784
+ }
16785
+ chunkDescription.pure = pure;
16786
+ chunkDescription.size = size;
16787
+ (size < minChunkSize
16788
+ ? pure
16789
+ ? smallPureChunks
16790
+ : smallSideEffectChunks
16791
+ : pure
16792
+ ? bigPureChunks
16793
+ : bigSideEffectChunks).push(chunkDescription);
16794
+ }
16795
+ sortChunksAndAddDependencies([bigPureChunks, bigSideEffectChunks, smallPureChunks, smallSideEffectChunks], chunkByModule);
16796
+ return {
16797
+ big: { pure: new Set(bigPureChunks), sideEffect: new Set(bigSideEffectChunks) },
16798
+ small: { pure: new Set(smallPureChunks), sideEffect: new Set(smallSideEffectChunks) }
16799
+ };
16800
+ }
16801
+ function sortChunksAndAddDependencies(chunkLists, chunkByModule) {
16802
+ for (const chunks of chunkLists) {
16803
+ chunks.sort(compareChunks);
16804
+ for (const chunk of chunks) {
16805
+ const { dependencies, modules } = chunk;
16768
16806
  for (const module of modules) {
16769
- if (module.hasEffects()) {
16770
- break checkModules;
16807
+ for (const dependency of module.getDependenciesToBeIncluded()) {
16808
+ const dependencyChunk = chunkByModule.get(dependency);
16809
+ if (dependencyChunk && dependencyChunk !== chunk) {
16810
+ dependencies.add(dependencyChunk);
16811
+ dependencyChunk.dependentChunks.add(chunk);
16812
+ }
16771
16813
  }
16772
- size += module.magicString.toString().length;
16773
- if (size > minChunkSize) {
16774
- break checkModules;
16814
+ }
16815
+ }
16816
+ }
16817
+ }
16818
+ function compareChunks({ size: sizeA }, { size: sizeB }) {
16819
+ return sizeA - sizeB;
16820
+ }
16821
+ function mergeChunks(chunksToBeMerged, targetChunks, minChunkSize, chunkPartition) {
16822
+ for (const mergedChunk of chunksToBeMerged) {
16823
+ let closestChunk = null;
16824
+ let closestChunkDistance = Infinity;
16825
+ const { signature, modules, pure, size } = mergedChunk;
16826
+ for (const targetChunk of concatLazy(targetChunks)) {
16827
+ if (mergedChunk === targetChunk)
16828
+ continue;
16829
+ // Possible improvement:
16830
+ // For dynamic entries depending on a pure chunk, it is safe to merge that
16831
+ // chunk into the chunk doing the dynamic import (i.e. into an "already
16832
+ // loaded chunk") even if it is not pure.
16833
+ // One way of handling this could be to add all "already loaded entries"
16834
+ // of the dynamic importers into the signature as well. That could also
16835
+ // change the way we do code-splitting for already loaded entries.
16836
+ const distance = pure
16837
+ ? getSignatureDistance(signature, targetChunk.signature, !targetChunk.pure)
16838
+ : getSignatureDistance(targetChunk.signature, signature, true);
16839
+ if (distance < closestChunkDistance && isValidMerge(mergedChunk, targetChunk)) {
16840
+ if (distance === 1) {
16841
+ closestChunk = targetChunk;
16842
+ break;
16775
16843
  }
16844
+ closestChunk = targetChunk;
16845
+ closestChunkDistance = distance;
16776
16846
  }
16777
- chunksToBeMerged.add({ alias, modules, signature, size });
16778
- continue;
16779
16847
  }
16780
- unmergeableChunks.push({ alias, modules, signature, size: null });
16848
+ if (closestChunk) {
16849
+ chunksToBeMerged.delete(mergedChunk);
16850
+ getChunksInPartition(closestChunk, minChunkSize, chunkPartition).delete(closestChunk);
16851
+ closestChunk.modules.push(...modules);
16852
+ closestChunk.size += size;
16853
+ closestChunk.pure && (closestChunk.pure = pure);
16854
+ closestChunk.signature = mergeSignatures(signature, closestChunk.signature);
16855
+ const { dependencies, dependentChunks } = closestChunk;
16856
+ for (const dependency of mergedChunk.dependencies) {
16857
+ dependencies.add(dependency);
16858
+ }
16859
+ for (const dependentChunk of mergedChunk.dependentChunks) {
16860
+ dependentChunks.add(dependentChunk);
16861
+ dependentChunk.dependencies.delete(mergedChunk);
16862
+ dependentChunk.dependencies.add(closestChunk);
16863
+ }
16864
+ dependencies.delete(closestChunk);
16865
+ getChunksInPartition(closestChunk, minChunkSize, chunkPartition).add(closestChunk);
16866
+ }
16781
16867
  }
16782
- return { chunksToBeMerged, unmergeableChunks };
16868
+ }
16869
+ // Merging will not produce cycles if none of the direct non-merged dependencies
16870
+ // of a chunk have the other chunk as a transitive dependency
16871
+ function isValidMerge(mergedChunk, targetChunk) {
16872
+ return !(hasTransitiveDependency(mergedChunk, targetChunk) ||
16873
+ hasTransitiveDependency(targetChunk, mergedChunk));
16874
+ }
16875
+ function hasTransitiveDependency(dependentChunk, dependencyChunk) {
16876
+ const chunksToCheck = new Set(dependentChunk.dependencies);
16877
+ for (const { dependencies } of chunksToCheck) {
16878
+ for (const dependency of dependencies) {
16879
+ if (dependency === dependencyChunk) {
16880
+ return true;
16881
+ }
16882
+ chunksToCheck.add(dependency);
16883
+ }
16884
+ }
16885
+ return false;
16886
+ }
16887
+ function getChunksInPartition(chunk, minChunkSize, chunkPartition) {
16888
+ const subPartition = chunk.size < minChunkSize ? chunkPartition.small : chunkPartition.big;
16889
+ return chunk.pure ? subPartition.pure : subPartition.sideEffect;
16783
16890
  }
16784
16891
  function getSignatureDistance(sourceSignature, targetSignature, enforceSubset) {
16785
16892
  let distance = 0;
@@ -17407,7 +17514,7 @@ class Bundle {
17407
17514
  this.pluginDriver.finaliseAssets();
17408
17515
  }
17409
17516
  async generateChunks(bundle, getHashPlaceholder) {
17410
- const { experimentalMinChunkSize, inlineDynamicImports, manualChunks, preserveModules } = this.outputOptions;
17517
+ const { experimentalDeepDynamicChunkOptimization, experimentalMinChunkSize, inlineDynamicImports, manualChunks, preserveModules } = this.outputOptions;
17411
17518
  const manualChunkAliasByEntry = typeof manualChunks === 'object'
17412
17519
  ? await this.addManualChunks(manualChunks)
17413
17520
  : this.assignManualChunks(manualChunks);
@@ -17421,7 +17528,7 @@ class Bundle {
17421
17528
  ? [{ alias: null, modules: includedModules }]
17422
17529
  : preserveModules
17423
17530
  ? includedModules.map(module => ({ alias: null, modules: [module] }))
17424
- : getChunkAssignments(this.graph.entryModules, manualChunkAliasByEntry, experimentalMinChunkSize)) {
17531
+ : getChunkAssignments(this.graph.entryModules, manualChunkAliasByEntry, experimentalMinChunkSize, experimentalDeepDynamicChunkOptimization)) {
17425
17532
  sortByExecutionOrder(modules);
17426
17533
  const chunk = new Chunk(modules, this.inputOptions, this.outputOptions, this.unsetOptions, this.pluginDriver, this.graph.modulesById, chunkByModule, externalChunkByModule, this.facadeChunkByModule, this.includedNamespaces, alias, getHashPlaceholder, bundle, inputBase, snippets);
17427
17534
  chunks.push(chunk);
@@ -25116,6 +25223,7 @@ async function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
25116
25223
  dynamicImportInCjs: config.dynamicImportInCjs ?? true,
25117
25224
  entryFileNames: getEntryFileNames(config, unsetOptions),
25118
25225
  esModule: config.esModule ?? 'if-default-prop',
25226
+ experimentalDeepDynamicChunkOptimization: config.experimentalDeepDynamicChunkOptimization || false,
25119
25227
  experimentalMinChunkSize: config.experimentalMinChunkSize || 0,
25120
25228
  exports: getExports(config, unsetOptions),
25121
25229
  extend: config.extend || false,
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.12.1
4
- Wed, 01 Feb 2023 09:25:11 GMT - commit 0c5aa76cb0e30a66ce7c7972f484c003a5b7b8c1
3
+ Rollup.js v3.14.0
4
+ Sun, 05 Feb 2023 05:33:16 GMT - commit b8526485935ef21c65a5cd5474adbddf24ec7a32
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.12.1
4
- Wed, 01 Feb 2023 09:25:11 GMT - commit 0c5aa76cb0e30a66ce7c7972f484c003a5b7b8c1
3
+ Rollup.js v3.14.0
4
+ Sun, 05 Feb 2023 05:33:16 GMT - commit b8526485935ef21c65a5cd5474adbddf24ec7a32
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.12.1",
3
+ "version": "3.14.0",
4
4
  "description": "Next-generation ES module bundler",
5
5
  "main": "dist/rollup.js",
6
6
  "module": "dist/es/rollup.js",