rollup 4.38.0 → 4.39.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
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  /*
3
3
  @license
4
- Rollup.js v4.38.0
5
- Sat, 29 Mar 2025 06:28:32 GMT - commit 22b64bcc511dfc40ce463e3f662a928915908713
4
+ Rollup.js v4.39.0
5
+ Wed, 02 Apr 2025 04:49:00 GMT - commit 5c001245779063abac3899aa9d25294ab003581b
6
6
 
7
7
  https://github.com/rollup/rollup
8
8
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.38.0
4
- Sat, 29 Mar 2025 06:28:32 GMT - commit 22b64bcc511dfc40ce463e3f662a928915908713
3
+ Rollup.js v4.39.0
4
+ Wed, 02 Apr 2025 04:49:00 GMT - commit 5c001245779063abac3899aa9d25294ab003581b
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.38.0
4
- Sat, 29 Mar 2025 06:28:32 GMT - commit 22b64bcc511dfc40ce463e3f662a928915908713
3
+ Rollup.js v4.39.0
4
+ Wed, 02 Apr 2025 04:49:00 GMT - commit 5c001245779063abac3899aa9d25294ab003581b
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
package/dist/es/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.38.0
4
- Sat, 29 Mar 2025 06:28:32 GMT - commit 22b64bcc511dfc40ce463e3f662a928915908713
3
+ Rollup.js v4.39.0
4
+ Wed, 02 Apr 2025 04:49:00 GMT - commit 5c001245779063abac3899aa9d25294ab003581b
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.38.0
4
- Sat, 29 Mar 2025 06:28:32 GMT - commit 22b64bcc511dfc40ce463e3f662a928915908713
3
+ Rollup.js v4.39.0
4
+ Wed, 02 Apr 2025 04:49:00 GMT - commit 5c001245779063abac3899aa9d25294ab003581b
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -15,7 +15,7 @@ import process$1, { env } from 'node:process';
15
15
  import { performance } from 'node:perf_hooks';
16
16
  import { lstat, realpath, readdir, readFile, mkdir, writeFile } from 'node:fs/promises';
17
17
 
18
- var version = "4.38.0";
18
+ var version = "4.39.0";
19
19
 
20
20
  const comma = ','.charCodeAt(0);
21
21
  const semicolon = ';'.charCodeAt(0);
@@ -17964,6 +17964,8 @@ class Chunk {
17964
17964
  this.renderedModules = Object.create(null);
17965
17965
  this.sortedExportNames = null;
17966
17966
  this.strictFacade = false;
17967
+ /** Modules with 'allow-extension' that should have preserved exports within the chunk */
17968
+ this.allowExtensionModules = new Set();
17967
17969
  this.execIndex = orderedModules.length > 0 ? orderedModules[0].execIndex : Infinity;
17968
17970
  const chunkModules = new Set(orderedModules);
17969
17971
  for (const module of orderedModules) {
@@ -18069,6 +18071,16 @@ class Chunk {
18069
18071
  remainingExports.delete(variable);
18070
18072
  }
18071
18073
  }
18074
+ for (const module of this.allowExtensionModules) {
18075
+ const exportNamesByVariable = module.getExportNamesByVariable();
18076
+ for (const [variable, exportNames] of exportNamesByVariable) {
18077
+ this.exportNamesByVariable.set(variable, [...exportNames]);
18078
+ for (const exportName of exportNames) {
18079
+ this.exportsByName.set(exportName, variable);
18080
+ }
18081
+ remainingExports.delete(variable);
18082
+ }
18083
+ }
18072
18084
  if (this.outputOptions.minifyInternalExports) {
18073
18085
  assignExportsToMangledNames(remainingExports, this.exportsByName, this.exportNamesByVariable);
18074
18086
  }
@@ -18083,16 +18095,19 @@ class Chunk {
18083
18095
  const entryModules = new Set([...this.entryModules, ...this.implicitEntryModules]);
18084
18096
  const exposedVariables = new Set(this.dynamicEntryModules.map(({ namespace }) => namespace));
18085
18097
  for (const module of entryModules) {
18086
- if (module.preserveSignature) {
18087
- for (const exportedVariable of module.getExportNamesByVariable().keys()) {
18088
- // We need to expose all entry exports from this chunk
18089
- if (this.chunkByModule.get(exportedVariable.module) === this) {
18090
- exposedVariables.add(exportedVariable);
18098
+ if (module.preserveSignature === 'allow-extension') {
18099
+ const canPreserveExports = this.canPreserveModuleExports(module);
18100
+ if (canPreserveExports) {
18101
+ this.allowExtensionModules.add(module);
18102
+ if (!this.facadeModule) {
18103
+ this.facadeModule = module;
18104
+ this.strictFacade = false;
18105
+ this.assignFacadeName({}, module, this.outputOptions.preserveModules);
18091
18106
  }
18107
+ this.facadeChunkByModule.set(module, this);
18108
+ continue;
18092
18109
  }
18093
18110
  }
18094
- }
18095
- for (const module of entryModules) {
18096
18111
  const requiredFacades = Array.from(new Set(module.chunkNames.filter(({ isUserDefined }) => isUserDefined).map(({ name }) => name)),
18097
18112
  // mapping must run after Set 'name' dedupe
18098
18113
  name => ({
@@ -18147,6 +18162,26 @@ class Chunk {
18147
18162
  }
18148
18163
  return facades;
18149
18164
  }
18165
+ canPreserveModuleExports(module) {
18166
+ const exportNamesByVariable = module.getExportNamesByVariable();
18167
+ // Check for conflicts - an export name is a conflict if it points to a different module or definition
18168
+ for (const [variable, exportNames] of exportNamesByVariable) {
18169
+ for (const exportName of exportNames) {
18170
+ const existingVariable = this.exportsByName.get(exportName);
18171
+ // It's ok if the same export name in two modules references the exact same variable
18172
+ if (existingVariable && existingVariable !== variable) {
18173
+ return false;
18174
+ }
18175
+ }
18176
+ }
18177
+ // No actual conflicts found, add export names for future conflict checks
18178
+ for (const [variable, exportNames] of exportNamesByVariable) {
18179
+ for (const exportName of exportNames) {
18180
+ this.exportsByName.set(exportName, variable);
18181
+ }
18182
+ }
18183
+ return true;
18184
+ }
18150
18185
  getChunkName() {
18151
18186
  return (this.name ??= this.outputOptions.sanitizeFileName(this.getFallbackChunkName()));
18152
18187
  }
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.38.0
4
- Sat, 29 Mar 2025 06:28:32 GMT - commit 22b64bcc511dfc40ce463e3f662a928915908713
3
+ Rollup.js v4.39.0
4
+ Wed, 02 Apr 2025 04:49:00 GMT - commit 5c001245779063abac3899aa9d25294ab003581b
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.38.0
4
- Sat, 29 Mar 2025 06:28:32 GMT - commit 22b64bcc511dfc40ce463e3f662a928915908713
3
+ Rollup.js v4.39.0
4
+ Wed, 02 Apr 2025 04:49:00 GMT - commit 5c001245779063abac3899aa9d25294ab003581b
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.38.0
4
- Sat, 29 Mar 2025 06:28:32 GMT - commit 22b64bcc511dfc40ce463e3f662a928915908713
3
+ Rollup.js v4.39.0
4
+ Wed, 02 Apr 2025 04:49:00 GMT - commit 5c001245779063abac3899aa9d25294ab003581b
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.38.0
4
- Sat, 29 Mar 2025 06:28:32 GMT - commit 22b64bcc511dfc40ce463e3f662a928915908713
3
+ Rollup.js v4.39.0
4
+ Wed, 02 Apr 2025 04:49:00 GMT - commit 5c001245779063abac3899aa9d25294ab003581b
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
package/dist/parseAst.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.38.0
4
- Sat, 29 Mar 2025 06:28:32 GMT - commit 22b64bcc511dfc40ce463e3f662a928915908713
3
+ Rollup.js v4.39.0
4
+ Wed, 02 Apr 2025 04:49:00 GMT - commit 5c001245779063abac3899aa9d25294ab003581b
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
package/dist/rollup.d.ts CHANGED
@@ -545,7 +545,7 @@ export type HookFilterExtension<K extends keyof FunctionPluginHooks> = K extends
545
545
  : K extends 'load'
546
546
  ? { filter?: Pick<HookFilter, 'id'> }
547
547
  : K extends 'resolveId'
548
- ? { filter?: { id: StringFilter<RegExp> } }
548
+ ? { filter?: { id?: StringFilter<RegExp> } }
549
549
  : // eslint-disable-next-line @typescript-eslint/no-empty-object-type
550
550
  {};
551
551
 
package/dist/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.38.0
4
- Sat, 29 Mar 2025 06:28:32 GMT - commit 22b64bcc511dfc40ce463e3f662a928915908713
3
+ Rollup.js v4.39.0
4
+ Wed, 02 Apr 2025 04:49:00 GMT - commit 5c001245779063abac3899aa9d25294ab003581b
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.38.0
4
- Sat, 29 Mar 2025 06:28:32 GMT - commit 22b64bcc511dfc40ce463e3f662a928915908713
3
+ Rollup.js v4.39.0
4
+ Wed, 02 Apr 2025 04:49:00 GMT - commit 5c001245779063abac3899aa9d25294ab003581b
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.38.0
4
- Sat, 29 Mar 2025 06:28:32 GMT - commit 22b64bcc511dfc40ce463e3f662a928915908713
3
+ Rollup.js v4.39.0
4
+ Wed, 02 Apr 2025 04:49:00 GMT - commit 5c001245779063abac3899aa9d25294ab003581b
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.38.0
4
- Sat, 29 Mar 2025 06:28:32 GMT - commit 22b64bcc511dfc40ce463e3f662a928915908713
3
+ Rollup.js v4.39.0
4
+ Wed, 02 Apr 2025 04:49:00 GMT - commit 5c001245779063abac3899aa9d25294ab003581b
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.38.0
4
- Sat, 29 Mar 2025 06:28:32 GMT - commit 22b64bcc511dfc40ce463e3f662a928915908713
3
+ Rollup.js v4.39.0
4
+ Wed, 02 Apr 2025 04:49:00 GMT - commit 5c001245779063abac3899aa9d25294ab003581b
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.38.0
4
- Sat, 29 Mar 2025 06:28:32 GMT - commit 22b64bcc511dfc40ce463e3f662a928915908713
3
+ Rollup.js v4.39.0
4
+ Wed, 02 Apr 2025 04:49:00 GMT - commit 5c001245779063abac3899aa9d25294ab003581b
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -17,7 +17,7 @@ const native_js = require('../native.js');
17
17
  const node_perf_hooks = require('node:perf_hooks');
18
18
  const promises = require('node:fs/promises');
19
19
 
20
- var version = "4.38.0";
20
+ var version = "4.39.0";
21
21
 
22
22
  function ensureArray$1(items) {
23
23
  if (Array.isArray(items)) {
@@ -19449,6 +19449,8 @@ class Chunk {
19449
19449
  this.renderedModules = Object.create(null);
19450
19450
  this.sortedExportNames = null;
19451
19451
  this.strictFacade = false;
19452
+ /** Modules with 'allow-extension' that should have preserved exports within the chunk */
19453
+ this.allowExtensionModules = new Set();
19452
19454
  this.execIndex = orderedModules.length > 0 ? orderedModules[0].execIndex : Infinity;
19453
19455
  const chunkModules = new Set(orderedModules);
19454
19456
  for (const module of orderedModules) {
@@ -19554,6 +19556,16 @@ class Chunk {
19554
19556
  remainingExports.delete(variable);
19555
19557
  }
19556
19558
  }
19559
+ for (const module of this.allowExtensionModules) {
19560
+ const exportNamesByVariable = module.getExportNamesByVariable();
19561
+ for (const [variable, exportNames] of exportNamesByVariable) {
19562
+ this.exportNamesByVariable.set(variable, [...exportNames]);
19563
+ for (const exportName of exportNames) {
19564
+ this.exportsByName.set(exportName, variable);
19565
+ }
19566
+ remainingExports.delete(variable);
19567
+ }
19568
+ }
19557
19569
  if (this.outputOptions.minifyInternalExports) {
19558
19570
  assignExportsToMangledNames(remainingExports, this.exportsByName, this.exportNamesByVariable);
19559
19571
  }
@@ -19568,16 +19580,19 @@ class Chunk {
19568
19580
  const entryModules = new Set([...this.entryModules, ...this.implicitEntryModules]);
19569
19581
  const exposedVariables = new Set(this.dynamicEntryModules.map(({ namespace }) => namespace));
19570
19582
  for (const module of entryModules) {
19571
- if (module.preserveSignature) {
19572
- for (const exportedVariable of module.getExportNamesByVariable().keys()) {
19573
- // We need to expose all entry exports from this chunk
19574
- if (this.chunkByModule.get(exportedVariable.module) === this) {
19575
- exposedVariables.add(exportedVariable);
19583
+ if (module.preserveSignature === 'allow-extension') {
19584
+ const canPreserveExports = this.canPreserveModuleExports(module);
19585
+ if (canPreserveExports) {
19586
+ this.allowExtensionModules.add(module);
19587
+ if (!this.facadeModule) {
19588
+ this.facadeModule = module;
19589
+ this.strictFacade = false;
19590
+ this.assignFacadeName({}, module, this.outputOptions.preserveModules);
19576
19591
  }
19592
+ this.facadeChunkByModule.set(module, this);
19593
+ continue;
19577
19594
  }
19578
19595
  }
19579
- }
19580
- for (const module of entryModules) {
19581
19596
  const requiredFacades = Array.from(new Set(module.chunkNames.filter(({ isUserDefined }) => isUserDefined).map(({ name }) => name)),
19582
19597
  // mapping must run after Set 'name' dedupe
19583
19598
  name => ({
@@ -19632,6 +19647,26 @@ class Chunk {
19632
19647
  }
19633
19648
  return facades;
19634
19649
  }
19650
+ canPreserveModuleExports(module) {
19651
+ const exportNamesByVariable = module.getExportNamesByVariable();
19652
+ // Check for conflicts - an export name is a conflict if it points to a different module or definition
19653
+ for (const [variable, exportNames] of exportNamesByVariable) {
19654
+ for (const exportName of exportNames) {
19655
+ const existingVariable = this.exportsByName.get(exportName);
19656
+ // It's ok if the same export name in two modules references the exact same variable
19657
+ if (existingVariable && existingVariable !== variable) {
19658
+ return false;
19659
+ }
19660
+ }
19661
+ }
19662
+ // No actual conflicts found, add export names for future conflict checks
19663
+ for (const [variable, exportNames] of exportNamesByVariable) {
19664
+ for (const exportName of exportNames) {
19665
+ this.exportsByName.set(exportName, variable);
19666
+ }
19667
+ }
19668
+ return true;
19669
+ }
19635
19670
  getChunkName() {
19636
19671
  return (this.name ??= this.outputOptions.sanitizeFileName(this.getFallbackChunkName()));
19637
19672
  }
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.38.0
4
- Sat, 29 Mar 2025 06:28:32 GMT - commit 22b64bcc511dfc40ce463e3f662a928915908713
3
+ Rollup.js v4.39.0
4
+ Wed, 02 Apr 2025 04:49:00 GMT - commit 5c001245779063abac3899aa9d25294ab003581b
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.38.0
4
- Sat, 29 Mar 2025 06:28:32 GMT - commit 22b64bcc511dfc40ce463e3f662a928915908713
3
+ Rollup.js v4.39.0
4
+ Wed, 02 Apr 2025 04:49:00 GMT - commit 5c001245779063abac3899aa9d25294ab003581b
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": "4.38.0",
3
+ "version": "4.39.0",
4
4
  "description": "Next-generation ES module bundler",
5
5
  "main": "dist/rollup.js",
6
6
  "module": "dist/es/rollup.js",
@@ -111,26 +111,26 @@
111
111
  "homepage": "https://rollupjs.org/",
112
112
  "optionalDependencies": {
113
113
  "fsevents": "~2.3.2",
114
- "@rollup/rollup-darwin-arm64": "4.38.0",
115
- "@rollup/rollup-android-arm64": "4.38.0",
116
- "@rollup/rollup-win32-arm64-msvc": "4.38.0",
117
- "@rollup/rollup-freebsd-arm64": "4.38.0",
118
- "@rollup/rollup-linux-arm64-gnu": "4.38.0",
119
- "@rollup/rollup-linux-arm64-musl": "4.38.0",
120
- "@rollup/rollup-android-arm-eabi": "4.38.0",
121
- "@rollup/rollup-linux-arm-gnueabihf": "4.38.0",
122
- "@rollup/rollup-linux-arm-musleabihf": "4.38.0",
123
- "@rollup/rollup-win32-ia32-msvc": "4.38.0",
124
- "@rollup/rollup-linux-loongarch64-gnu": "4.38.0",
125
- "@rollup/rollup-linux-riscv64-gnu": "4.38.0",
126
- "@rollup/rollup-linux-riscv64-musl": "4.38.0",
127
- "@rollup/rollup-linux-powerpc64le-gnu": "4.38.0",
128
- "@rollup/rollup-linux-s390x-gnu": "4.38.0",
129
- "@rollup/rollup-darwin-x64": "4.38.0",
130
- "@rollup/rollup-win32-x64-msvc": "4.38.0",
131
- "@rollup/rollup-freebsd-x64": "4.38.0",
132
- "@rollup/rollup-linux-x64-gnu": "4.38.0",
133
- "@rollup/rollup-linux-x64-musl": "4.38.0"
114
+ "@rollup/rollup-darwin-arm64": "4.39.0",
115
+ "@rollup/rollup-android-arm64": "4.39.0",
116
+ "@rollup/rollup-win32-arm64-msvc": "4.39.0",
117
+ "@rollup/rollup-freebsd-arm64": "4.39.0",
118
+ "@rollup/rollup-linux-arm64-gnu": "4.39.0",
119
+ "@rollup/rollup-linux-arm64-musl": "4.39.0",
120
+ "@rollup/rollup-android-arm-eabi": "4.39.0",
121
+ "@rollup/rollup-linux-arm-gnueabihf": "4.39.0",
122
+ "@rollup/rollup-linux-arm-musleabihf": "4.39.0",
123
+ "@rollup/rollup-win32-ia32-msvc": "4.39.0",
124
+ "@rollup/rollup-linux-loongarch64-gnu": "4.39.0",
125
+ "@rollup/rollup-linux-riscv64-gnu": "4.39.0",
126
+ "@rollup/rollup-linux-riscv64-musl": "4.39.0",
127
+ "@rollup/rollup-linux-powerpc64le-gnu": "4.39.0",
128
+ "@rollup/rollup-linux-s390x-gnu": "4.39.0",
129
+ "@rollup/rollup-darwin-x64": "4.39.0",
130
+ "@rollup/rollup-win32-x64-msvc": "4.39.0",
131
+ "@rollup/rollup-freebsd-x64": "4.39.0",
132
+ "@rollup/rollup-linux-x64-gnu": "4.39.0",
133
+ "@rollup/rollup-linux-x64-musl": "4.39.0"
134
134
  },
135
135
  "dependencies": {
136
136
  "@types/estree": "1.0.7"