rollup 2.77.2 → 2.77.4-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/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.77.2
4
- Wed, 27 Jul 2022 05:18:41 GMT - commit 22b2f68aa8638ffaac4de69011e10480f5d50546
3
+ Rollup.js v2.77.4-0
4
+ Sun, 04 Dec 2022 18:27:04 GMT - commit 43b5e1cddb8a5b9ae0aa6349112523b5b89db783
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.77.2
4
- Wed, 27 Jul 2022 05:18:41 GMT - commit 22b2f68aa8638ffaac4de69011e10480f5d50546
3
+ Rollup.js v2.77.4-0
4
+ Sun, 04 Dec 2022 18:27:04 GMT - commit 43b5e1cddb8a5b9ae0aa6349112523b5b89db783
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.77.2
4
- Wed, 27 Jul 2022 05:18:41 GMT - commit 22b2f68aa8638ffaac4de69011e10480f5d50546
3
+ Rollup.js v2.77.4-0
4
+ Sun, 04 Dec 2022 18:27:04 GMT - commit 43b5e1cddb8a5b9ae0aa6349112523b5b89db783
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.77.2
4
- Wed, 27 Jul 2022 05:18:41 GMT - commit 22b2f68aa8638ffaac4de69011e10480f5d50546
3
+ Rollup.js v2.77.4-0
4
+ Sun, 04 Dec 2022 18:27:04 GMT - commit 43b5e1cddb8a5b9ae0aa6349112523b5b89db783
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.77.2
4
- Wed, 27 Jul 2022 05:18:41 GMT - commit 22b2f68aa8638ffaac4de69011e10480f5d50546
3
+ Rollup.js v2.77.4-0
4
+ Sun, 04 Dec 2022 18:27:04 GMT - commit 43b5e1cddb8a5b9ae0aa6349112523b5b89db783
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -27,7 +27,7 @@ function _interopNamespaceDefault(e) {
27
27
  return n;
28
28
  }
29
29
 
30
- var version$1 = "2.77.2";
30
+ var version$1 = "2.77.4-0";
31
31
 
32
32
  function ensureArray$1(items) {
33
33
  if (Array.isArray(items)) {
@@ -14735,7 +14735,7 @@ class Chunk {
14735
14735
  });
14736
14736
  const currentPath = `${currentDir}/${fileName}`;
14737
14737
  const { preserveModulesRoot } = options;
14738
- if (preserveModulesRoot && currentPath.startsWith(preserveModulesRoot)) {
14738
+ if (preserveModulesRoot && require$$0.resolve(currentPath).startsWith(preserveModulesRoot)) {
14739
14739
  path = currentPath.slice(preserveModulesRoot.length).replace(/^[\\/]/, '');
14740
14740
  }
14741
14741
  else {
@@ -15789,23 +15789,21 @@ function getChunkAssignments(entryModules, manualChunkAliasByEntry) {
15789
15789
  const modulesInManualChunks = new Set(manualChunkAliasByEntry.keys());
15790
15790
  const manualChunkModulesByAlias = Object.create(null);
15791
15791
  for (const [entry, alias] of manualChunkAliasByEntry) {
15792
- const chunkModules = (manualChunkModulesByAlias[alias] =
15793
- manualChunkModulesByAlias[alias] || []);
15794
- addStaticDependenciesToManualChunk(entry, chunkModules, modulesInManualChunks);
15792
+ addStaticDependenciesToManualChunk(entry, (manualChunkModulesByAlias[alias] || (manualChunkModulesByAlias[alias] = [])), modulesInManualChunks);
15795
15793
  }
15796
15794
  for (const [alias, modules] of Object.entries(manualChunkModulesByAlias)) {
15797
15795
  chunkDefinitions.push({ alias, modules });
15798
15796
  }
15799
15797
  const assignedEntryPointsByModule = new Map();
15800
- const { dependentEntryPointsByModule, dynamicEntryModules } = analyzeModuleGraph(entryModules);
15801
- const dynamicallyDependentEntryPointsByDynamicEntry = getDynamicDependentEntryPoints(dependentEntryPointsByModule, dynamicEntryModules);
15802
- const staticEntries = new Set(entryModules);
15803
- function assignEntryToStaticDependencies(entry, dynamicDependentEntryPoints) {
15798
+ const { allModules, dependentEntryPointsByModule, dynamicallyDependentEntryPointsByDynamicEntry, dynamicImportsByEntry } = analyzeModuleGraph(entryModules);
15799
+ const alreadyLoadedModulesByDynamicEntry = getAlreadyLoadedModulesByDynamicEntry(allModules, dependentEntryPointsByModule, dynamicImportsByEntry, dynamicallyDependentEntryPointsByDynamicEntry);
15800
+ function assignEntryToStaticDependencies(entry, alreadyLoadedModules) {
15804
15801
  const modulesToHandle = new Set([entry]);
15805
15802
  for (const module of modulesToHandle) {
15806
15803
  const assignedEntryPoints = getOrCreate(assignedEntryPointsByModule, module, () => new Set());
15807
- if (dynamicDependentEntryPoints &&
15808
- areEntryPointsContainedOrDynamicallyDependent(dynamicDependentEntryPoints, dependentEntryPointsByModule.get(module))) {
15804
+ // If the module is "already loaded" for this dynamic entry, we do not need
15805
+ // to mark it for this dynamic entry
15806
+ if (alreadyLoadedModules === null || alreadyLoadedModules === void 0 ? void 0 : alreadyLoadedModules.has(module)) {
15809
15807
  continue;
15810
15808
  }
15811
15809
  else {
@@ -15818,31 +15816,17 @@ function getChunkAssignments(entryModules, manualChunkAliasByEntry) {
15818
15816
  }
15819
15817
  }
15820
15818
  }
15821
- function areEntryPointsContainedOrDynamicallyDependent(entryPoints, containedIn) {
15822
- const entriesToCheck = new Set(entryPoints);
15823
- for (const entry of entriesToCheck) {
15824
- if (!containedIn.has(entry)) {
15825
- if (staticEntries.has(entry))
15826
- return false;
15827
- const dynamicallyDependentEntryPoints = dynamicallyDependentEntryPointsByDynamicEntry.get(entry);
15828
- for (const dependentEntry of dynamicallyDependentEntryPoints) {
15829
- entriesToCheck.add(dependentEntry);
15830
- }
15831
- }
15832
- }
15833
- return true;
15834
- }
15835
15819
  for (const entry of entryModules) {
15836
15820
  if (!modulesInManualChunks.has(entry)) {
15837
15821
  assignEntryToStaticDependencies(entry, null);
15838
15822
  }
15839
15823
  }
15840
- for (const entry of dynamicEntryModules) {
15824
+ for (const entry of dynamicallyDependentEntryPointsByDynamicEntry.keys()) {
15841
15825
  if (!modulesInManualChunks.has(entry)) {
15842
- assignEntryToStaticDependencies(entry, dynamicallyDependentEntryPointsByDynamicEntry.get(entry));
15826
+ assignEntryToStaticDependencies(entry, alreadyLoadedModulesByDynamicEntry.get(entry) || null);
15843
15827
  }
15844
15828
  }
15845
- chunkDefinitions.push(...createChunks([...entryModules, ...dynamicEntryModules], assignedEntryPointsByModule));
15829
+ chunkDefinitions.push(...createChunks([...entryModules, ...dynamicallyDependentEntryPointsByDynamicEntry.keys()], assignedEntryPointsByModule));
15846
15830
  return chunkDefinitions;
15847
15831
  }
15848
15832
  function addStaticDependenciesToManualChunk(entry, manualChunkModules, modulesInManualChunks) {
@@ -15858,46 +15842,69 @@ function addStaticDependenciesToManualChunk(entry, manualChunkModules, modulesIn
15858
15842
  }
15859
15843
  }
15860
15844
  function analyzeModuleGraph(entryModules) {
15861
- const dynamicEntryModules = new Set();
15845
+ const allModules = new Set(entryModules);
15862
15846
  const dependentEntryPointsByModule = new Map();
15847
+ const dynamicImportsByEntry = new Map();
15848
+ const dynamicallyDependentEntryPointsByDynamicEntry = new Map();
15863
15849
  const entriesToHandle = new Set(entryModules);
15864
15850
  for (const currentEntry of entriesToHandle) {
15865
15851
  const modulesToHandle = new Set([currentEntry]);
15852
+ const dynamicImports = new Set();
15853
+ dynamicImportsByEntry.set(currentEntry, dynamicImports);
15866
15854
  for (const module of modulesToHandle) {
15867
15855
  getOrCreate(dependentEntryPointsByModule, module, () => new Set()).add(currentEntry);
15868
15856
  for (const dependency of module.getDependenciesToBeIncluded()) {
15869
15857
  if (!(dependency instanceof ExternalModule)) {
15870
15858
  modulesToHandle.add(dependency);
15859
+ allModules.add(dependency);
15871
15860
  }
15872
15861
  }
15873
15862
  for (const { resolution } of module.dynamicImports) {
15874
15863
  if (resolution instanceof Module && resolution.includedDynamicImporters.length > 0) {
15875
- dynamicEntryModules.add(resolution);
15864
+ dynamicImports.add(resolution);
15865
+ getOrCreate(dynamicallyDependentEntryPointsByDynamicEntry, resolution, () => new Set()).add(currentEntry);
15876
15866
  entriesToHandle.add(resolution);
15867
+ allModules.add(resolution);
15877
15868
  }
15878
15869
  }
15879
15870
  for (const dependency of module.implicitlyLoadedBefore) {
15880
- dynamicEntryModules.add(dependency);
15871
+ dynamicImports.add(dependency);
15872
+ getOrCreate(dynamicallyDependentEntryPointsByDynamicEntry, dependency, () => new Set()).add(currentEntry);
15881
15873
  entriesToHandle.add(dependency);
15874
+ allModules.add(dependency);
15882
15875
  }
15883
15876
  }
15884
15877
  }
15885
- return { dependentEntryPointsByModule, dynamicEntryModules };
15878
+ return {
15879
+ allModules,
15880
+ dependentEntryPointsByModule,
15881
+ dynamicallyDependentEntryPointsByDynamicEntry,
15882
+ dynamicImportsByEntry
15883
+ };
15886
15884
  }
15887
- function getDynamicDependentEntryPoints(dependentEntryPointsByModule, dynamicEntryModules) {
15888
- const dynamicallyDependentEntryPointsByDynamicEntry = new Map();
15889
- for (const dynamicEntry of dynamicEntryModules) {
15890
- const dynamicDependentEntryPoints = getOrCreate(dynamicallyDependentEntryPointsByDynamicEntry, dynamicEntry, () => new Set());
15891
- for (const importer of [
15892
- ...dynamicEntry.includedDynamicImporters,
15893
- ...dynamicEntry.implicitlyLoadedAfter
15894
- ]) {
15895
- for (const entryPoint of dependentEntryPointsByModule.get(importer)) {
15896
- dynamicDependentEntryPoints.add(entryPoint);
15885
+ function getAlreadyLoadedModulesByDynamicEntry(allModules, dependentEntryPointsByModule, dynamicImportsByEntry, dynamicallyDependentEntryPointsByDynamicEntry) {
15886
+ var _a, _b;
15887
+ const alreadyLoadedModulesByEntry = new Map();
15888
+ for (const module of allModules) {
15889
+ const dependentEntryPoints = dependentEntryPointsByModule.get(module);
15890
+ for (const entry of dependentEntryPoints) {
15891
+ const dynamicEntriesToHandle = [...dynamicImportsByEntry.get(entry)];
15892
+ nextDynamicEntry: for (const dynamicEntry of dynamicEntriesToHandle) {
15893
+ if ((_a = alreadyLoadedModulesByEntry.get(dynamicEntry)) === null || _a === void 0 ? void 0 : _a.has(module)) {
15894
+ continue;
15895
+ }
15896
+ for (const siblingDependentEntry of dynamicallyDependentEntryPointsByDynamicEntry.get(dynamicEntry)) {
15897
+ if (!(dependentEntryPoints.has(siblingDependentEntry) ||
15898
+ ((_b = alreadyLoadedModulesByEntry.get(siblingDependentEntry)) === null || _b === void 0 ? void 0 : _b.has(module)))) {
15899
+ continue nextDynamicEntry;
15900
+ }
15901
+ }
15902
+ getOrCreate(alreadyLoadedModulesByEntry, dynamicEntry, () => new Set()).add(module);
15903
+ dynamicEntriesToHandle.push(...dynamicImportsByEntry.get(dynamicEntry));
15897
15904
  }
15898
15905
  }
15899
15906
  }
15900
- return dynamicallyDependentEntryPointsByDynamicEntry;
15907
+ return alreadyLoadedModulesByEntry;
15901
15908
  }
15902
15909
  function createChunks(allEntryPoints, assignedEntryPointsByModule) {
15903
15910
  const chunkModules = Object.create(null);
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.77.2
4
- Wed, 27 Jul 2022 05:18:41 GMT - commit 22b2f68aa8638ffaac4de69011e10480f5d50546
3
+ Rollup.js v2.77.4-0
4
+ Sun, 04 Dec 2022 18:27:04 GMT - commit 43b5e1cddb8a5b9ae0aa6349112523b5b89db783
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.77.2
4
- Wed, 27 Jul 2022 05:18:41 GMT - commit 22b2f68aa8638ffaac4de69011e10480f5d50546
3
+ Rollup.js v2.77.4-0
4
+ Sun, 04 Dec 2022 18:27:04 GMT - commit 43b5e1cddb8a5b9ae0aa6349112523b5b89db783
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": "2.77.2",
3
+ "version": "2.77.4-0",
4
4
  "description": "Next-generation ES module bundler",
5
5
  "main": "dist/rollup.js",
6
6
  "module": "dist/es/rollup.js",
@@ -11,7 +11,7 @@
11
11
  "scripts": {
12
12
  "build": "shx rm -rf dist && node scripts/update-git-commit.js && rollup --config rollup.config.ts --configPlugin typescript && shx cp src/rollup/types.d.ts dist/rollup.d.ts && shx chmod a+x dist/bin/rollup",
13
13
  "build:cjs": "shx rm -rf dist && rollup --config rollup.config.ts --configPlugin typescript --configTest && shx cp src/rollup/types.d.ts dist/rollup.d.ts && shx chmod a+x dist/bin/rollup",
14
- "build:bootstrap": "node dist/bin/rollup --config rollup.config.ts --configPlugin typescript && shx cp src/rollup/types.d.ts dist/rollup.d.ts && shx chmod a+x dist/bin/rollup",
14
+ "build:bootstrap": "node dist/bin/rollup --config rollup.config.ts --configPlugin typescript && shx cp src/rollup/types.d.ts dist/rollup.d.ts && shx chmod a+x dist/bin/rollup && cp -r dist browser/",
15
15
  "ci:lint": "npm run lint:nofix",
16
16
  "ci:test": "npm run build:cjs && npm run build:bootstrap && npm run test:all",
17
17
  "ci:test:only": "npm run build:cjs && npm run build:bootstrap && npm run test:only",