rollup 3.7.1 → 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.
package/dist/bin/rollup CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  /*
4
4
  @license
5
- Rollup.js v3.7.1
6
- Fri, 09 Dec 2022 19:58:22 GMT - commit cc54a2439bb274d91c74cc74a70e4c25e3dbb206
5
+ Rollup.js v3.7.2
6
+ Sat, 10 Dec 2022 06:16:44 GMT - commit f368adf4943a11207157ec44a83345da7a905a13
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.7.1
4
- Fri, 09 Dec 2022 19:58:22 GMT - commit cc54a2439bb274d91c74cc74a70e4c25e3dbb206
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
4
- Fri, 09 Dec 2022 19:58:22 GMT - commit cc54a2439bb274d91c74cc74a70e4c25e3dbb206
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
 
@@ -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.1";
19
+ var version$1 = "3.7.2";
20
20
 
21
21
  var charToInteger = {};
22
22
  var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
@@ -1681,13 +1681,19 @@ function formatAssertions$1(assertions, { getObject }) {
1681
1681
 
1682
1682
  function getOrCreate(map, key, init) {
1683
1683
  const existing = map.get(key);
1684
- if (existing) {
1684
+ if (existing !== undefined) {
1685
1685
  return existing;
1686
1686
  }
1687
1687
  const value = init();
1688
1688
  map.set(key, value);
1689
1689
  return value;
1690
1690
  }
1691
+ function getNewSet() {
1692
+ return new Set();
1693
+ }
1694
+ function getNewArray() {
1695
+ return [];
1696
+ }
1691
1697
 
1692
1698
  const UnknownKey = Symbol('Unknown Key');
1693
1699
  const UnknownNonAccessorKey = Symbol('Unknown Non-Accessor Key');
@@ -1749,7 +1755,7 @@ class DiscriminatedPathTracker {
1749
1755
  currentPaths[pathSegment] ||
1750
1756
  Object.create(null, { [EntitiesKey]: { value: new Map() } });
1751
1757
  }
1752
- const trackedEntities = getOrCreate(currentPaths[EntitiesKey], discriminator, () => new Set());
1758
+ const trackedEntities = getOrCreate(currentPaths[EntitiesKey], discriminator, getNewSet);
1753
1759
  if (trackedEntities.has(entity))
1754
1760
  return true;
1755
1761
  trackedEntities.add(entity);
@@ -12754,7 +12760,7 @@ function getVariableForExportNameRecursive(target, name, importerForSideEffects,
12754
12760
  });
12755
12761
  }
12756
12762
  function getAndExtendSideEffectModules(variable, module) {
12757
- const sideEffectModules = getOrCreate(module.sideEffectDependenciesByVariable, variable, () => new Set());
12763
+ const sideEffectModules = getOrCreate(module.sideEffectDependenciesByVariable, variable, getNewSet);
12758
12764
  let currentVariable = variable;
12759
12765
  const referencedVariables = new Set([currentVariable]);
12760
12766
  while (true) {
@@ -13093,7 +13099,7 @@ class Module {
13093
13099
  searchedNamesAndModules
13094
13100
  });
13095
13101
  if (importerForSideEffects) {
13096
- getOrCreate(importerForSideEffects.sideEffectDependenciesByVariable, variable, () => new Set()).add(this);
13102
+ getOrCreate(importerForSideEffects.sideEffectDependenciesByVariable, variable, getNewSet).add(this);
13097
13103
  setAlternativeExporterIfCyclic(variable, importerForSideEffects, this);
13098
13104
  }
13099
13105
  return [variable];
@@ -15321,7 +15327,7 @@ class Chunk {
15321
15327
  dependency = this.chunkByModule.get(module);
15322
15328
  imported = dependency.getVariableExportName(variable);
15323
15329
  }
15324
- getOrCreate(importsByDependency, dependency, () => []).push({
15330
+ getOrCreate(importsByDependency, dependency, getNewArray).push({
15325
15331
  imported,
15326
15332
  local: variable.getName(this.snippets.getPropertyAccess)
15327
15333
  });
@@ -15433,7 +15439,7 @@ class Chunk {
15433
15439
  (imported !== 'default' || isDefaultAProperty(interop(module.id), true));
15434
15440
  }
15435
15441
  }
15436
- getOrCreate(reexportSpecifiers, dependency, () => []).push({
15442
+ getOrCreate(reexportSpecifiers, dependency, getNewArray).push({
15437
15443
  imported,
15438
15444
  needsLiveBinding,
15439
15445
  reexported: exportName
@@ -15734,7 +15740,7 @@ function* concatLazy(...iterables) {
15734
15740
  }
15735
15741
  }
15736
15742
 
15737
- function getChunkAssignments(entryModules, manualChunkAliasByEntry, minChunkSize) {
15743
+ function getChunkAssignments(entries, manualChunkAliasByEntry, minChunkSize) {
15738
15744
  const chunkDefinitions = [];
15739
15745
  const modulesInManualChunks = new Set(manualChunkAliasByEntry.keys());
15740
15746
  const manualChunkModulesByAlias = Object.create(null);
@@ -15744,53 +15750,15 @@ function getChunkAssignments(entryModules, manualChunkAliasByEntry, minChunkSize
15744
15750
  for (const [alias, modules] of Object.entries(manualChunkModulesByAlias)) {
15745
15751
  chunkDefinitions.push({ alias, modules });
15746
15752
  }
15747
- const assignedEntryPointsByModule = new Map();
15748
- const { dependentEntryPointsByModule, dynamicEntryModules } = analyzeModuleGraph(entryModules);
15749
- const dynamicallyDependentEntryPointsByDynamicEntry = getDynamicDependentEntryPoints(dependentEntryPointsByModule, dynamicEntryModules);
15750
- const staticEntries = new Set(entryModules);
15751
- function assignEntryToStaticDependencies(entry, dynamicDependentEntryPoints) {
15752
- const modulesToHandle = new Set([entry]);
15753
- for (const module of modulesToHandle) {
15754
- const assignedEntryPoints = getOrCreate(assignedEntryPointsByModule, module, () => new Set());
15755
- if (dynamicDependentEntryPoints &&
15756
- areEntryPointsContainedOrDynamicallyDependent(dynamicDependentEntryPoints, dependentEntryPointsByModule.get(module))) {
15757
- continue;
15758
- }
15759
- else {
15760
- assignedEntryPoints.add(entry);
15761
- }
15762
- for (const dependency of module.getDependenciesToBeIncluded()) {
15763
- if (!(dependency instanceof ExternalModule || modulesInManualChunks.has(dependency))) {
15764
- modulesToHandle.add(dependency);
15765
- }
15766
- }
15767
- }
15768
- }
15769
- function areEntryPointsContainedOrDynamicallyDependent(entryPoints, containedIn) {
15770
- const entriesToCheck = new Set(entryPoints);
15771
- for (const entry of entriesToCheck) {
15772
- if (!containedIn.has(entry)) {
15773
- if (staticEntries.has(entry))
15774
- return false;
15775
- const dynamicallyDependentEntryPoints = dynamicallyDependentEntryPointsByDynamicEntry.get(entry);
15776
- for (const dependentEntry of dynamicallyDependentEntryPoints) {
15777
- entriesToCheck.add(dependentEntry);
15778
- }
15779
- }
15780
- }
15781
- return true;
15782
- }
15783
- for (const entry of entryModules) {
15784
- if (!modulesInManualChunks.has(entry)) {
15785
- assignEntryToStaticDependencies(entry, null);
15786
- }
15787
- }
15788
- for (const entry of dynamicEntryModules) {
15753
+ const { allEntries, dependentEntriesByModule, dynamicallyDependentEntriesByDynamicEntry } = analyzeModuleGraph(entries);
15754
+ const staticEntries = new Set(entries);
15755
+ const assignedEntriesByModule = new Map();
15756
+ for (const entry of allEntries) {
15789
15757
  if (!modulesInManualChunks.has(entry)) {
15790
- assignEntryToStaticDependencies(entry, dynamicallyDependentEntryPointsByDynamicEntry.get(entry));
15758
+ assignEntryToStaticDependencies(entry, dependentEntriesByModule, assignedEntriesByModule, modulesInManualChunks, staticEntries, dynamicallyDependentEntriesByDynamicEntry);
15791
15759
  }
15792
15760
  }
15793
- chunkDefinitions.push(...createChunks([...entryModules, ...dynamicEntryModules], assignedEntryPointsByModule, minChunkSize));
15761
+ chunkDefinitions.push(...createChunks(allEntries, assignedEntriesByModule, minChunkSize));
15794
15762
  return chunkDefinitions;
15795
15763
  }
15796
15764
  function addStaticDependenciesToManualChunk(entry, manualChunkModules, modulesInManualChunks) {
@@ -15805,50 +15773,103 @@ function addStaticDependenciesToManualChunk(entry, manualChunkModules, modulesIn
15805
15773
  }
15806
15774
  }
15807
15775
  }
15808
- function analyzeModuleGraph(entryModules) {
15809
- const dynamicEntryModules = new Set();
15810
- const dependentEntryPointsByModule = new Map();
15811
- const entriesToHandle = new Set(entryModules);
15812
- for (const currentEntry of entriesToHandle) {
15776
+ function analyzeModuleGraph(entries) {
15777
+ const dynamicEntries = new Set();
15778
+ const dependentEntriesByModule = new Map();
15779
+ const allEntries = new Set(entries);
15780
+ for (const currentEntry of allEntries) {
15813
15781
  const modulesToHandle = new Set([currentEntry]);
15814
15782
  for (const module of modulesToHandle) {
15815
- getOrCreate(dependentEntryPointsByModule, module, () => new Set()).add(currentEntry);
15783
+ getOrCreate(dependentEntriesByModule, module, getNewSet).add(currentEntry);
15816
15784
  for (const dependency of module.getDependenciesToBeIncluded()) {
15817
15785
  if (!(dependency instanceof ExternalModule)) {
15818
15786
  modulesToHandle.add(dependency);
15819
15787
  }
15820
15788
  }
15821
15789
  for (const { resolution } of module.dynamicImports) {
15822
- if (resolution instanceof Module && resolution.includedDynamicImporters.length > 0) {
15823
- dynamicEntryModules.add(resolution);
15824
- entriesToHandle.add(resolution);
15790
+ if (resolution instanceof Module &&
15791
+ resolution.includedDynamicImporters.length > 0 &&
15792
+ !allEntries.has(resolution)) {
15793
+ dynamicEntries.add(resolution);
15794
+ allEntries.add(resolution);
15825
15795
  }
15826
15796
  }
15827
15797
  for (const dependency of module.implicitlyLoadedBefore) {
15828
- dynamicEntryModules.add(dependency);
15829
- entriesToHandle.add(dependency);
15798
+ if (!allEntries.has(dependency)) {
15799
+ dynamicEntries.add(dependency);
15800
+ allEntries.add(dependency);
15801
+ }
15830
15802
  }
15831
15803
  }
15832
15804
  }
15833
- return { dependentEntryPointsByModule, dynamicEntryModules };
15805
+ return {
15806
+ allEntries,
15807
+ dependentEntriesByModule,
15808
+ dynamicallyDependentEntriesByDynamicEntry: getDynamicallyDependentEntriesByDynamicEntry(dependentEntriesByModule, dynamicEntries)
15809
+ };
15834
15810
  }
15835
- function getDynamicDependentEntryPoints(dependentEntryPointsByModule, dynamicEntryModules) {
15836
- const dynamicallyDependentEntryPointsByDynamicEntry = new Map();
15837
- for (const dynamicEntry of dynamicEntryModules) {
15838
- const dynamicDependentEntryPoints = getOrCreate(dynamicallyDependentEntryPointsByDynamicEntry, dynamicEntry, () => new Set());
15811
+ function getDynamicallyDependentEntriesByDynamicEntry(dependentEntriesByModule, dynamicEntries) {
15812
+ const dynamicallyDependentEntriesByDynamicEntry = new Map();
15813
+ for (const dynamicEntry of dynamicEntries) {
15814
+ const dynamicallyDependentEntries = getOrCreate(dynamicallyDependentEntriesByDynamicEntry, dynamicEntry, getNewSet);
15839
15815
  for (const importer of [
15840
15816
  ...dynamicEntry.includedDynamicImporters,
15841
15817
  ...dynamicEntry.implicitlyLoadedAfter
15842
15818
  ]) {
15843
- for (const entryPoint of dependentEntryPointsByModule.get(importer)) {
15844
- dynamicDependentEntryPoints.add(entryPoint);
15819
+ for (const entry of dependentEntriesByModule.get(importer)) {
15820
+ dynamicallyDependentEntries.add(entry);
15821
+ }
15822
+ }
15823
+ }
15824
+ return dynamicallyDependentEntriesByDynamicEntry;
15825
+ }
15826
+ function assignEntryToStaticDependencies(entry, dependentEntriesByModule, assignedEntriesByModule, modulesInManualChunks, staticEntries, dynamicallyDependentEntriesByDynamicEntry) {
15827
+ const dynamicallyDependentEntries = dynamicallyDependentEntriesByDynamicEntry.get(entry);
15828
+ const modulesToHandle = new Set([entry]);
15829
+ for (const module of modulesToHandle) {
15830
+ const assignedEntries = getOrCreate(assignedEntriesByModule, module, getNewSet);
15831
+ if (dynamicallyDependentEntries &&
15832
+ isModuleAlreadyLoaded(dynamicallyDependentEntries, dependentEntriesByModule.get(module), staticEntries, dynamicallyDependentEntriesByDynamicEntry)) {
15833
+ continue;
15834
+ }
15835
+ else {
15836
+ assignedEntries.add(entry);
15837
+ }
15838
+ for (const dependency of module.getDependenciesToBeIncluded()) {
15839
+ if (!(dependency instanceof ExternalModule || modulesInManualChunks.has(dependency))) {
15840
+ modulesToHandle.add(dependency);
15841
+ }
15842
+ }
15843
+ }
15844
+ }
15845
+ const MAX_ENTRIES_TO_CHECK_FOR_SHARED_DEPENDENCIES = 3;
15846
+ // An approach to further speed this up might be
15847
+ // - first, create chunks without looking for modules already in memory
15848
+ // - all modules that are in the same chunk after this will behave the same
15849
+ // -> Do not iterate by module but by equivalence group and merge chunks
15850
+ function isModuleAlreadyLoaded(dynamicallyDependentEntries, containedIn, staticEntries, dynamicallyDependentEntriesByDynamicEntry) {
15851
+ if (dynamicallyDependentEntries.size > MAX_ENTRIES_TO_CHECK_FOR_SHARED_DEPENDENCIES) {
15852
+ return false;
15853
+ }
15854
+ const entriesToCheck = new Set(dynamicallyDependentEntries);
15855
+ for (const entry of entriesToCheck) {
15856
+ if (!containedIn.has(entry)) {
15857
+ if (staticEntries.has(entry)) {
15858
+ return false;
15859
+ }
15860
+ const dynamicallyDependentEntries = dynamicallyDependentEntriesByDynamicEntry.get(entry);
15861
+ if (dynamicallyDependentEntries.size > MAX_ENTRIES_TO_CHECK_FOR_SHARED_DEPENDENCIES) {
15862
+ return false;
15863
+ }
15864
+ for (const dependentEntry of dynamicallyDependentEntries) {
15865
+ entriesToCheck.add(dependentEntry);
15845
15866
  }
15846
15867
  }
15847
15868
  }
15848
- return dynamicallyDependentEntryPointsByDynamicEntry;
15869
+ return true;
15849
15870
  }
15850
- function createChunks(allEntryPoints, assignedEntryPointsByModule, minChunkSize) {
15851
- const chunkModulesBySignature = getChunkModulesBySignature(assignedEntryPointsByModule, allEntryPoints);
15871
+ function createChunks(allEntries, assignedEntriesByModule, minChunkSize) {
15872
+ const chunkModulesBySignature = getChunkModulesBySignature(assignedEntriesByModule, allEntries);
15852
15873
  return minChunkSize === 0
15853
15874
  ? Object.values(chunkModulesBySignature).map(modules => ({
15854
15875
  alias: null,
@@ -15895,12 +15916,12 @@ function getOptimizedChunks(chunkModulesBySignature, minChunkSize) {
15895
15916
  const CHAR_DEPENDENT = 'X';
15896
15917
  const CHAR_INDEPENDENT = '_';
15897
15918
  const CHAR_CODE_DEPENDENT = CHAR_DEPENDENT.charCodeAt(0);
15898
- function getChunkModulesBySignature(assignedEntryPointsByModule, allEntryPoints) {
15919
+ function getChunkModulesBySignature(assignedEntriesByModule, allEntries) {
15899
15920
  const chunkModules = Object.create(null);
15900
- for (const [module, assignedEntryPoints] of assignedEntryPointsByModule) {
15921
+ for (const [module, assignedEntries] of assignedEntriesByModule) {
15901
15922
  let chunkSignature = '';
15902
- for (const entry of allEntryPoints) {
15903
- chunkSignature += assignedEntryPoints.has(entry) ? CHAR_DEPENDENT : CHAR_INDEPENDENT;
15923
+ for (const entry of allEntries) {
15924
+ chunkSignature += assignedEntries.has(entry) ? CHAR_DEPENDENT : CHAR_INDEPENDENT;
15904
15925
  }
15905
15926
  const chunk = chunkModules[chunkSignature];
15906
15927
  if (chunk) {
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.7.1
4
- Fri, 09 Dec 2022 19:58:22 GMT - commit cc54a2439bb274d91c74cc74a70e4c25e3dbb206
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
4
- Fri, 09 Dec 2022 19:58:22 GMT - commit cc54a2439bb274d91c74cc74a70e4c25e3dbb206
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/dist/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.7.1
4
- Fri, 09 Dec 2022 19:58:22 GMT - commit cc54a2439bb274d91c74cc74a70e4c25e3dbb206
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
4
- Fri, 09 Dec 2022 19:58:22 GMT - commit cc54a2439bb274d91c74cc74a70e4c25e3dbb206
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
4
- Fri, 09 Dec 2022 19:58:22 GMT - commit cc54a2439bb274d91c74cc74a70e4c25e3dbb206
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
 
@@ -24,7 +24,7 @@ function batchWarnings() {
24
24
  count += 1;
25
25
  warningOccurred = true;
26
26
  if (warning.code in deferredHandlers) {
27
- rollup.getOrCreate(deferredWarnings, warning.code, () => []).push(warning);
27
+ rollup.getOrCreate(deferredWarnings, warning.code, rollup.getNewArray).push(warning);
28
28
  }
29
29
  else if (warning.code in immediateHandlers) {
30
30
  immediateHandlers[warning.code](warning);
@@ -169,7 +169,7 @@ const deferredHandlers = {
169
169
  info('https://rollupjs.org/guide/en/#warning-treating-module-as-external-dependency');
170
170
  const dependencies = new Map();
171
171
  for (const warning of warnings) {
172
- rollup.getOrCreate(dependencies, rollup.relativeId(warning.exporter), () => []).push(rollup.relativeId(warning.id));
172
+ rollup.getOrCreate(dependencies, rollup.relativeId(warning.exporter), rollup.getNewArray).push(rollup.relativeId(warning.id));
173
173
  }
174
174
  for (const [dependency, importers] of dependencies) {
175
175
  rollup.stderr(`${rollup.bold(dependency)} (imported by ${rollup.printQuotedStringList(importers)})`);
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.7.1
4
- Fri, 09 Dec 2022 19:58:22 GMT - commit cc54a2439bb274d91c74cc74a70e4c25e3dbb206
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";
34
+ var version$1 = "3.7.2";
35
35
 
36
36
  function ensureArray$1(items) {
37
37
  if (Array.isArray(items)) {
@@ -2829,13 +2829,19 @@ function formatAssertions(assertions, { getObject }) {
2829
2829
 
2830
2830
  function getOrCreate(map, key, init) {
2831
2831
  const existing = map.get(key);
2832
- if (existing) {
2832
+ if (existing !== undefined) {
2833
2833
  return existing;
2834
2834
  }
2835
2835
  const value = init();
2836
2836
  map.set(key, value);
2837
2837
  return value;
2838
2838
  }
2839
+ function getNewSet() {
2840
+ return new Set();
2841
+ }
2842
+ function getNewArray() {
2843
+ return [];
2844
+ }
2839
2845
 
2840
2846
  const UnknownKey = Symbol('Unknown Key');
2841
2847
  const UnknownNonAccessorKey = Symbol('Unknown Non-Accessor Key');
@@ -2897,7 +2903,7 @@ class DiscriminatedPathTracker {
2897
2903
  currentPaths[pathSegment] ||
2898
2904
  Object.create(null, { [EntitiesKey]: { value: new Map() } });
2899
2905
  }
2900
- const trackedEntities = getOrCreate(currentPaths[EntitiesKey], discriminator, () => new Set());
2906
+ const trackedEntities = getOrCreate(currentPaths[EntitiesKey], discriminator, getNewSet);
2901
2907
  if (trackedEntities.has(entity))
2902
2908
  return true;
2903
2909
  trackedEntities.add(entity);
@@ -13269,7 +13275,7 @@ function getVariableForExportNameRecursive(target, name, importerForSideEffects,
13269
13275
  });
13270
13276
  }
13271
13277
  function getAndExtendSideEffectModules(variable, module) {
13272
- const sideEffectModules = getOrCreate(module.sideEffectDependenciesByVariable, variable, () => new Set());
13278
+ const sideEffectModules = getOrCreate(module.sideEffectDependenciesByVariable, variable, getNewSet);
13273
13279
  let currentVariable = variable;
13274
13280
  const referencedVariables = new Set([currentVariable]);
13275
13281
  while (true) {
@@ -13608,7 +13614,7 @@ class Module {
13608
13614
  searchedNamesAndModules
13609
13615
  });
13610
13616
  if (importerForSideEffects) {
13611
- getOrCreate(importerForSideEffects.sideEffectDependenciesByVariable, variable, () => new Set()).add(this);
13617
+ getOrCreate(importerForSideEffects.sideEffectDependenciesByVariable, variable, getNewSet).add(this);
13612
13618
  setAlternativeExporterIfCyclic(variable, importerForSideEffects, this);
13613
13619
  }
13614
13620
  return [variable];
@@ -15836,7 +15842,7 @@ class Chunk {
15836
15842
  dependency = this.chunkByModule.get(module);
15837
15843
  imported = dependency.getVariableExportName(variable);
15838
15844
  }
15839
- getOrCreate(importsByDependency, dependency, () => []).push({
15845
+ getOrCreate(importsByDependency, dependency, getNewArray).push({
15840
15846
  imported,
15841
15847
  local: variable.getName(this.snippets.getPropertyAccess)
15842
15848
  });
@@ -15948,7 +15954,7 @@ class Chunk {
15948
15954
  (imported !== 'default' || isDefaultAProperty(interop(module.id), true));
15949
15955
  }
15950
15956
  }
15951
- getOrCreate(reexportSpecifiers, dependency, () => []).push({
15957
+ getOrCreate(reexportSpecifiers, dependency, getNewArray).push({
15952
15958
  imported,
15953
15959
  needsLiveBinding,
15954
15960
  reexported: exportName
@@ -16249,7 +16255,7 @@ function* concatLazy(...iterables) {
16249
16255
  }
16250
16256
  }
16251
16257
 
16252
- function getChunkAssignments(entryModules, manualChunkAliasByEntry, minChunkSize) {
16258
+ function getChunkAssignments(entries, manualChunkAliasByEntry, minChunkSize) {
16253
16259
  const chunkDefinitions = [];
16254
16260
  const modulesInManualChunks = new Set(manualChunkAliasByEntry.keys());
16255
16261
  const manualChunkModulesByAlias = Object.create(null);
@@ -16259,53 +16265,15 @@ function getChunkAssignments(entryModules, manualChunkAliasByEntry, minChunkSize
16259
16265
  for (const [alias, modules] of Object.entries(manualChunkModulesByAlias)) {
16260
16266
  chunkDefinitions.push({ alias, modules });
16261
16267
  }
16262
- const assignedEntryPointsByModule = new Map();
16263
- const { dependentEntryPointsByModule, dynamicEntryModules } = analyzeModuleGraph(entryModules);
16264
- const dynamicallyDependentEntryPointsByDynamicEntry = getDynamicDependentEntryPoints(dependentEntryPointsByModule, dynamicEntryModules);
16265
- const staticEntries = new Set(entryModules);
16266
- function assignEntryToStaticDependencies(entry, dynamicDependentEntryPoints) {
16267
- const modulesToHandle = new Set([entry]);
16268
- for (const module of modulesToHandle) {
16269
- const assignedEntryPoints = getOrCreate(assignedEntryPointsByModule, module, () => new Set());
16270
- if (dynamicDependentEntryPoints &&
16271
- areEntryPointsContainedOrDynamicallyDependent(dynamicDependentEntryPoints, dependentEntryPointsByModule.get(module))) {
16272
- continue;
16273
- }
16274
- else {
16275
- assignedEntryPoints.add(entry);
16276
- }
16277
- for (const dependency of module.getDependenciesToBeIncluded()) {
16278
- if (!(dependency instanceof ExternalModule || modulesInManualChunks.has(dependency))) {
16279
- modulesToHandle.add(dependency);
16280
- }
16281
- }
16282
- }
16283
- }
16284
- function areEntryPointsContainedOrDynamicallyDependent(entryPoints, containedIn) {
16285
- const entriesToCheck = new Set(entryPoints);
16286
- for (const entry of entriesToCheck) {
16287
- if (!containedIn.has(entry)) {
16288
- if (staticEntries.has(entry))
16289
- return false;
16290
- const dynamicallyDependentEntryPoints = dynamicallyDependentEntryPointsByDynamicEntry.get(entry);
16291
- for (const dependentEntry of dynamicallyDependentEntryPoints) {
16292
- entriesToCheck.add(dependentEntry);
16293
- }
16294
- }
16295
- }
16296
- return true;
16297
- }
16298
- for (const entry of entryModules) {
16299
- if (!modulesInManualChunks.has(entry)) {
16300
- assignEntryToStaticDependencies(entry, null);
16301
- }
16302
- }
16303
- for (const entry of dynamicEntryModules) {
16268
+ const { allEntries, dependentEntriesByModule, dynamicallyDependentEntriesByDynamicEntry } = analyzeModuleGraph(entries);
16269
+ const staticEntries = new Set(entries);
16270
+ const assignedEntriesByModule = new Map();
16271
+ for (const entry of allEntries) {
16304
16272
  if (!modulesInManualChunks.has(entry)) {
16305
- assignEntryToStaticDependencies(entry, dynamicallyDependentEntryPointsByDynamicEntry.get(entry));
16273
+ assignEntryToStaticDependencies(entry, dependentEntriesByModule, assignedEntriesByModule, modulesInManualChunks, staticEntries, dynamicallyDependentEntriesByDynamicEntry);
16306
16274
  }
16307
16275
  }
16308
- chunkDefinitions.push(...createChunks([...entryModules, ...dynamicEntryModules], assignedEntryPointsByModule, minChunkSize));
16276
+ chunkDefinitions.push(...createChunks(allEntries, assignedEntriesByModule, minChunkSize));
16309
16277
  return chunkDefinitions;
16310
16278
  }
16311
16279
  function addStaticDependenciesToManualChunk(entry, manualChunkModules, modulesInManualChunks) {
@@ -16320,50 +16288,103 @@ function addStaticDependenciesToManualChunk(entry, manualChunkModules, modulesIn
16320
16288
  }
16321
16289
  }
16322
16290
  }
16323
- function analyzeModuleGraph(entryModules) {
16324
- const dynamicEntryModules = new Set();
16325
- const dependentEntryPointsByModule = new Map();
16326
- const entriesToHandle = new Set(entryModules);
16327
- for (const currentEntry of entriesToHandle) {
16291
+ function analyzeModuleGraph(entries) {
16292
+ const dynamicEntries = new Set();
16293
+ const dependentEntriesByModule = new Map();
16294
+ const allEntries = new Set(entries);
16295
+ for (const currentEntry of allEntries) {
16328
16296
  const modulesToHandle = new Set([currentEntry]);
16329
16297
  for (const module of modulesToHandle) {
16330
- getOrCreate(dependentEntryPointsByModule, module, () => new Set()).add(currentEntry);
16298
+ getOrCreate(dependentEntriesByModule, module, getNewSet).add(currentEntry);
16331
16299
  for (const dependency of module.getDependenciesToBeIncluded()) {
16332
16300
  if (!(dependency instanceof ExternalModule)) {
16333
16301
  modulesToHandle.add(dependency);
16334
16302
  }
16335
16303
  }
16336
16304
  for (const { resolution } of module.dynamicImports) {
16337
- if (resolution instanceof Module && resolution.includedDynamicImporters.length > 0) {
16338
- dynamicEntryModules.add(resolution);
16339
- entriesToHandle.add(resolution);
16305
+ if (resolution instanceof Module &&
16306
+ resolution.includedDynamicImporters.length > 0 &&
16307
+ !allEntries.has(resolution)) {
16308
+ dynamicEntries.add(resolution);
16309
+ allEntries.add(resolution);
16340
16310
  }
16341
16311
  }
16342
16312
  for (const dependency of module.implicitlyLoadedBefore) {
16343
- dynamicEntryModules.add(dependency);
16344
- entriesToHandle.add(dependency);
16313
+ if (!allEntries.has(dependency)) {
16314
+ dynamicEntries.add(dependency);
16315
+ allEntries.add(dependency);
16316
+ }
16345
16317
  }
16346
16318
  }
16347
16319
  }
16348
- return { dependentEntryPointsByModule, dynamicEntryModules };
16320
+ return {
16321
+ allEntries,
16322
+ dependentEntriesByModule,
16323
+ dynamicallyDependentEntriesByDynamicEntry: getDynamicallyDependentEntriesByDynamicEntry(dependentEntriesByModule, dynamicEntries)
16324
+ };
16349
16325
  }
16350
- function getDynamicDependentEntryPoints(dependentEntryPointsByModule, dynamicEntryModules) {
16351
- const dynamicallyDependentEntryPointsByDynamicEntry = new Map();
16352
- for (const dynamicEntry of dynamicEntryModules) {
16353
- const dynamicDependentEntryPoints = getOrCreate(dynamicallyDependentEntryPointsByDynamicEntry, dynamicEntry, () => new Set());
16326
+ function getDynamicallyDependentEntriesByDynamicEntry(dependentEntriesByModule, dynamicEntries) {
16327
+ const dynamicallyDependentEntriesByDynamicEntry = new Map();
16328
+ for (const dynamicEntry of dynamicEntries) {
16329
+ const dynamicallyDependentEntries = getOrCreate(dynamicallyDependentEntriesByDynamicEntry, dynamicEntry, getNewSet);
16354
16330
  for (const importer of [
16355
16331
  ...dynamicEntry.includedDynamicImporters,
16356
16332
  ...dynamicEntry.implicitlyLoadedAfter
16357
16333
  ]) {
16358
- for (const entryPoint of dependentEntryPointsByModule.get(importer)) {
16359
- dynamicDependentEntryPoints.add(entryPoint);
16334
+ for (const entry of dependentEntriesByModule.get(importer)) {
16335
+ dynamicallyDependentEntries.add(entry);
16336
+ }
16337
+ }
16338
+ }
16339
+ return dynamicallyDependentEntriesByDynamicEntry;
16340
+ }
16341
+ function assignEntryToStaticDependencies(entry, dependentEntriesByModule, assignedEntriesByModule, modulesInManualChunks, staticEntries, dynamicallyDependentEntriesByDynamicEntry) {
16342
+ const dynamicallyDependentEntries = dynamicallyDependentEntriesByDynamicEntry.get(entry);
16343
+ const modulesToHandle = new Set([entry]);
16344
+ for (const module of modulesToHandle) {
16345
+ const assignedEntries = getOrCreate(assignedEntriesByModule, module, getNewSet);
16346
+ if (dynamicallyDependentEntries &&
16347
+ isModuleAlreadyLoaded(dynamicallyDependentEntries, dependentEntriesByModule.get(module), staticEntries, dynamicallyDependentEntriesByDynamicEntry)) {
16348
+ continue;
16349
+ }
16350
+ else {
16351
+ assignedEntries.add(entry);
16352
+ }
16353
+ for (const dependency of module.getDependenciesToBeIncluded()) {
16354
+ if (!(dependency instanceof ExternalModule || modulesInManualChunks.has(dependency))) {
16355
+ modulesToHandle.add(dependency);
16356
+ }
16357
+ }
16358
+ }
16359
+ }
16360
+ const MAX_ENTRIES_TO_CHECK_FOR_SHARED_DEPENDENCIES = 3;
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) {
16367
+ return false;
16368
+ }
16369
+ const entriesToCheck = new Set(dynamicallyDependentEntries);
16370
+ for (const entry of entriesToCheck) {
16371
+ if (!containedIn.has(entry)) {
16372
+ if (staticEntries.has(entry)) {
16373
+ return false;
16374
+ }
16375
+ const dynamicallyDependentEntries = dynamicallyDependentEntriesByDynamicEntry.get(entry);
16376
+ if (dynamicallyDependentEntries.size > MAX_ENTRIES_TO_CHECK_FOR_SHARED_DEPENDENCIES) {
16377
+ return false;
16378
+ }
16379
+ for (const dependentEntry of dynamicallyDependentEntries) {
16380
+ entriesToCheck.add(dependentEntry);
16360
16381
  }
16361
16382
  }
16362
16383
  }
16363
- return dynamicallyDependentEntryPointsByDynamicEntry;
16384
+ return true;
16364
16385
  }
16365
- function createChunks(allEntryPoints, assignedEntryPointsByModule, minChunkSize) {
16366
- const chunkModulesBySignature = getChunkModulesBySignature(assignedEntryPointsByModule, allEntryPoints);
16386
+ function createChunks(allEntries, assignedEntriesByModule, minChunkSize) {
16387
+ const chunkModulesBySignature = getChunkModulesBySignature(assignedEntriesByModule, allEntries);
16367
16388
  return minChunkSize === 0
16368
16389
  ? Object.values(chunkModulesBySignature).map(modules => ({
16369
16390
  alias: null,
@@ -16410,12 +16431,12 @@ function getOptimizedChunks(chunkModulesBySignature, minChunkSize) {
16410
16431
  const CHAR_DEPENDENT = 'X';
16411
16432
  const CHAR_INDEPENDENT = '_';
16412
16433
  const CHAR_CODE_DEPENDENT = CHAR_DEPENDENT.charCodeAt(0);
16413
- function getChunkModulesBySignature(assignedEntryPointsByModule, allEntryPoints) {
16434
+ function getChunkModulesBySignature(assignedEntriesByModule, allEntries) {
16414
16435
  const chunkModules = Object.create(null);
16415
- for (const [module, assignedEntryPoints] of assignedEntryPointsByModule) {
16436
+ for (const [module, assignedEntries] of assignedEntriesByModule) {
16416
16437
  let chunkSignature = '';
16417
- for (const entry of allEntryPoints) {
16418
- chunkSignature += assignedEntryPoints.has(entry) ? CHAR_DEPENDENT : CHAR_INDEPENDENT;
16438
+ for (const entry of allEntries) {
16439
+ chunkSignature += assignedEntries.has(entry) ? CHAR_DEPENDENT : CHAR_INDEPENDENT;
16419
16440
  }
16420
16441
  const chunk = chunkModules[chunkSignature];
16421
16442
  if (chunk) {
@@ -25273,6 +25294,7 @@ exports.errorOnlyInlineSourcemapsForStdout = errorOnlyInlineSourcemapsForStdout;
25273
25294
  exports.fseventsImporter = fseventsImporter;
25274
25295
  exports.getAliasName = getAliasName;
25275
25296
  exports.getAugmentedNamespace = getAugmentedNamespace;
25297
+ exports.getNewArray = getNewArray;
25276
25298
  exports.getOrCreate = getOrCreate;
25277
25299
  exports.gray = gray;
25278
25300
  exports.green = green;
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.7.1
4
- Fri, 09 Dec 2022 19:58:22 GMT - commit cc54a2439bb274d91c74cc74a70e4c25e3dbb206
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
4
- Fri, 09 Dec 2022 19:58:22 GMT - commit cc54a2439bb274d91c74cc74a70e4c25e3dbb206
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",
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",