rollup 4.63.4 → 4.63.6

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.63.4
5
- Sat, 19 Sep 2026 06:35:38 GMT - commit ba78d5752a1e1ff4ff4af3a8bffab7691d822f7d
4
+ Rollup.js v4.63.6
5
+ Thu, 01 Oct 2026 06:50:26 GMT - commit 966ac85d64887ed38abd4eef67c3813633cbc2f6
6
6
 
7
7
  https://github.com/rollup/rollup
8
8
 
@@ -27,7 +27,7 @@ require('node:perf_hooks');
27
27
  require('node:url');
28
28
  require('../getLogFilter.js');
29
29
 
30
- const help = "rollup version 4.63.4\n=====================================\n\nUsage: rollup [options] <entry file>\n\nOptions:\n\n-c, --config <filename> Use this config file (if argument is used but value\n is unspecified, Rollup will try to load configuration files in\n the following order:\n rollup.config.mjs -> rollup.config.cjs -> rollup.config.js)\n-d, --dir <dirname> Directory for chunks (if absent, prints to stdout)\n-e, --external <ids> Comma-separate list of module IDs to exclude\n-f, --format <format> Type of output (amd, cjs, es, iife, umd, system)\n-g, --globals <pairs> Comma-separate list of `moduleID:Global` pairs\n-h, --help Show this help message\n-i, --input <filename> Input (alternative to <entry file>)\n-m, --sourcemap Generate sourcemap (`-m inline` for inline map)\n-n, --name <name> Name for UMD export\n-o, --file <output> Single output file (if absent, prints to stdout)\n-p, --plugin <plugin> Use the plugin specified (may be repeated)\n-v, --version Show version number\n-w, --watch Watch files in bundle and rebuild on changes\n--amd.autoId Generate the AMD ID based off the chunk name\n--amd.basePath <prefix> Path to prepend to auto generated AMD ID\n--amd.define <name> Function to use in place of `define`\n--amd.forceJsExtensionForImports Use `.js` extension in AMD imports\n--amd.id <id> ID for AMD module (default is anonymous)\n--assetFileNames <pattern> Name pattern for emitted assets\n--banner <text> Code to insert at top of bundle (outside wrapper)\n--chunkFileNames <pattern> Name pattern for emitted secondary chunks\n--compact Minify wrapper code\n--context <variable> Specify top-level `this` value\n--no-dynamicImportInCjs Write external dynamic CommonJS imports as require\n--entryFileNames <pattern> Name pattern for emitted entry chunks\n--environment <values> Settings passed to config file (see example)\n--no-esModule Do not add __esModule property\n--exports <mode> Specify export mode (auto, default, named, none)\n--extend Extend global variable defined by --name\n--no-externalImportAttributes Omit import attributes in \"es\" output\n--no-externalLiveBindings Do not generate code to support live bindings\n--failAfterWarnings Exit with an error if the build produced warnings\n--filterLogs <filter> Filter log messages\n--footer <text> Code to insert at end of bundle (outside wrapper)\n--forceExit Force exit the process when done\n--no-freeze Do not freeze namespace objects\n--generatedCode <preset> Which code features to use (es5/es2015)\n--generatedCode.arrowFunctions Use arrow functions in generated code\n--generatedCode.constBindings Use \"const\" in generated code\n--generatedCode.objectShorthand Use shorthand properties in generated code\n--no-generatedCode.reservedNamesAsProps Always quote reserved names as props\n--generatedCode.symbols Use symbols in generated code\n--hashCharacters <name> Use the specified character set for file hashes\n--no-hoistTransitiveImports Do not hoist transitive imports into entry chunks\n--importAttributesKey <name> Use the specified keyword for import attributes\n--no-indent Don't indent result\n--inlineDynamicImports Create single bundle when using dynamic imports\n--no-interop Do not include interop block\n--intro <text> Code to insert at top of bundle (inside wrapper)\n--logLevel <level> Which kind of logs to display\n--no-makeAbsoluteExternalsRelative Prevent normalization of external imports\n--maxParallelFileOps <value> How many files to read in parallel\n--minifyInternalExports Force or disable minification of internal exports\n--noConflict Generate a noConflict method for UMD globals\n--outro <text> Code to insert at end of bundle (inside wrapper)\n--perf Display performance timings\n--no-preserveEntrySignatures Avoid facade chunks for entry points\n--preserveModules Preserve module structure\n--preserveModulesRoot Put preserved modules under this path at root level\n--preserveSymlinks Do not follow symlinks when resolving files\n--no-reexportProtoFromExternal Ignore `__proto__` in star re-exports\n--no-sanitizeFileName Do not replace invalid characters in file names\n--shimMissingExports Create shim variables for missing exports\n--silent Don't print warnings\n--sourcemapBaseUrl <url> Emit absolute sourcemap URLs with given base\n--sourcemapDebugIds Emit unique debug ids in source and sourcemaps\n--sourcemapExcludeSources Do not include source code in source maps\n--sourcemapFile <file> Specify bundle position for source maps\n--sourcemapFileNames <pattern> Name pattern for emitted sourcemaps\n--stdin=ext Specify file extension used for stdin input\n--no-stdin Do not read \"-\" from stdin\n--no-strict Don't emit `\"use strict\";` in the generated modules\n--strictDeprecations Throw errors for deprecated features\n--no-systemNullSetters Do not replace empty SystemJS setters with `null`\n--no-treeshake Disable tree-shaking optimisations\n--no-treeshake.annotations Ignore pure call annotations\n--treeshake.correctVarValueBeforeDeclaration Deoptimize variables until declared\n--treeshake.manualPureFunctions <names> Manually declare functions as pure\n--no-treeshake.moduleSideEffects Assume modules have no side effects\n--no-treeshake.propertyReadSideEffects Ignore property access side effects\n--no-treeshake.tryCatchDeoptimization Do not turn off try-catch-tree-shaking\n--no-treeshake.unknownGlobalSideEffects Assume unknown globals do not throw\n--validate Validate output\n--waitForBundleInput Wait for bundle input files\n--watch.allowInputInsideOutputPath Whether the input path is allowed to be a\n subpath of the output path\n--watch.buildDelay <number> Throttle watch rebuilds\n--no-watch.clearScreen Do not clear the screen when rebuilding\n--watch.exclude <files> Exclude files from being watched\n--watch.include <files> Limit watching to specified files\n--watch.onBundleEnd <cmd> Shell command to run on `\"BUNDLE_END\"` event\n--watch.onBundleStart <cmd> Shell command to run on `\"BUNDLE_START\"` event\n--watch.onEnd <cmd> Shell command to run on `\"END\"` event\n--watch.onError <cmd> Shell command to run on `\"ERROR\"` event\n--watch.onStart <cmd> Shell command to run on `\"START\"` event\n--watch.skipWrite Do not write files to disk when watching\n\nExamples:\n\n# use settings in config file\nrollup -c\n\n# in config file, process.env.INCLUDE_DEPS === 'true'\n# and process.env.BUILD === 'production'\nrollup -c --environment INCLUDE_DEPS,BUILD:production\n\n# create CommonJS bundle.js from src/main.js\nrollup --format=cjs --file=bundle.js -- src/main.js\n\n# create self-executing IIFE using `window.jQuery`\n# and `window._` as external globals\nrollup -f iife --globals jquery:jQuery,lodash:_ \\\n -i src/app.js -o build/app.js -m build/app.js.map\n\nNotes:\n\n* When piping to stdout, only inline sourcemaps are permitted\n\nFor more information visit https://rollupjs.org\n";
30
+ const help = "rollup version 4.63.6\n=====================================\n\nUsage: rollup [options] <entry file>\n\nOptions:\n\n-c, --config <filename> Use this config file (if argument is used but value\n is unspecified, Rollup will try to load configuration files in\n the following order:\n rollup.config.mjs -> rollup.config.cjs -> rollup.config.js)\n-d, --dir <dirname> Directory for chunks (if absent, prints to stdout)\n-e, --external <ids> Comma-separate list of module IDs to exclude\n-f, --format <format> Type of output (amd, cjs, es, iife, umd, system)\n-g, --globals <pairs> Comma-separate list of `moduleID:Global` pairs\n-h, --help Show this help message\n-i, --input <filename> Input (alternative to <entry file>)\n-m, --sourcemap Generate sourcemap (`-m inline` for inline map)\n-n, --name <name> Name for UMD export\n-o, --file <output> Single output file (if absent, prints to stdout)\n-p, --plugin <plugin> Use the plugin specified (may be repeated)\n-v, --version Show version number\n-w, --watch Watch files in bundle and rebuild on changes\n--amd.autoId Generate the AMD ID based off the chunk name\n--amd.basePath <prefix> Path to prepend to auto generated AMD ID\n--amd.define <name> Function to use in place of `define`\n--amd.forceJsExtensionForImports Use `.js` extension in AMD imports\n--amd.id <id> ID for AMD module (default is anonymous)\n--assetFileNames <pattern> Name pattern for emitted assets\n--banner <text> Code to insert at top of bundle (outside wrapper)\n--chunkFileNames <pattern> Name pattern for emitted secondary chunks\n--compact Minify wrapper code\n--context <variable> Specify top-level `this` value\n--no-dynamicImportInCjs Write external dynamic CommonJS imports as require\n--entryFileNames <pattern> Name pattern for emitted entry chunks\n--environment <values> Settings passed to config file (see example)\n--no-esModule Do not add __esModule property\n--exports <mode> Specify export mode (auto, default, named, none)\n--extend Extend global variable defined by --name\n--no-externalImportAttributes Omit import attributes in \"es\" output\n--no-externalLiveBindings Do not generate code to support live bindings\n--failAfterWarnings Exit with an error if the build produced warnings\n--filterLogs <filter> Filter log messages\n--footer <text> Code to insert at end of bundle (outside wrapper)\n--forceExit Force exit the process when done\n--no-freeze Do not freeze namespace objects\n--generatedCode <preset> Which code features to use (es5/es2015)\n--generatedCode.arrowFunctions Use arrow functions in generated code\n--generatedCode.constBindings Use \"const\" in generated code\n--generatedCode.objectShorthand Use shorthand properties in generated code\n--no-generatedCode.reservedNamesAsProps Always quote reserved names as props\n--generatedCode.symbols Use symbols in generated code\n--hashCharacters <name> Use the specified character set for file hashes\n--no-hoistTransitiveImports Do not hoist transitive imports into entry chunks\n--importAttributesKey <name> Use the specified keyword for import attributes\n--no-indent Don't indent result\n--inlineDynamicImports Create single bundle when using dynamic imports\n--no-interop Do not include interop block\n--intro <text> Code to insert at top of bundle (inside wrapper)\n--logLevel <level> Which kind of logs to display\n--no-makeAbsoluteExternalsRelative Prevent normalization of external imports\n--maxParallelFileOps <value> How many files to read in parallel\n--minifyInternalExports Force or disable minification of internal exports\n--noConflict Generate a noConflict method for UMD globals\n--outro <text> Code to insert at end of bundle (inside wrapper)\n--perf Display performance timings\n--no-preserveEntrySignatures Avoid facade chunks for entry points\n--preserveModules Preserve module structure\n--preserveModulesRoot Put preserved modules under this path at root level\n--preserveSymlinks Do not follow symlinks when resolving files\n--no-reexportProtoFromExternal Ignore `__proto__` in star re-exports\n--no-sanitizeFileName Do not replace invalid characters in file names\n--shimMissingExports Create shim variables for missing exports\n--silent Don't print warnings\n--sourcemapBaseUrl <url> Emit absolute sourcemap URLs with given base\n--sourcemapDebugIds Emit unique debug ids in source and sourcemaps\n--sourcemapExcludeSources Do not include source code in source maps\n--sourcemapFile <file> Specify bundle position for source maps\n--sourcemapFileNames <pattern> Name pattern for emitted sourcemaps\n--stdin=ext Specify file extension used for stdin input\n--no-stdin Do not read \"-\" from stdin\n--no-strict Don't emit `\"use strict\";` in the generated modules\n--strictDeprecations Throw errors for deprecated features\n--no-systemNullSetters Do not replace empty SystemJS setters with `null`\n--no-treeshake Disable tree-shaking optimisations\n--no-treeshake.annotations Ignore pure call annotations\n--treeshake.correctVarValueBeforeDeclaration Deoptimize variables until declared\n--treeshake.manualPureFunctions <names> Manually declare functions as pure\n--no-treeshake.moduleSideEffects Assume modules have no side effects\n--no-treeshake.propertyReadSideEffects Ignore property access side effects\n--no-treeshake.tryCatchDeoptimization Do not turn off try-catch-tree-shaking\n--no-treeshake.unknownGlobalSideEffects Assume unknown globals do not throw\n--validate Validate output\n--waitForBundleInput Wait for bundle input files\n--watch.allowInputInsideOutputPath Whether the input path is allowed to be a\n subpath of the output path\n--watch.buildDelay <number> Throttle watch rebuilds\n--no-watch.clearScreen Do not clear the screen when rebuilding\n--watch.exclude <files> Exclude files from being watched\n--watch.include <files> Limit watching to specified files\n--watch.onBundleEnd <cmd> Shell command to run on `\"BUNDLE_END\"` event\n--watch.onBundleStart <cmd> Shell command to run on `\"BUNDLE_START\"` event\n--watch.onEnd <cmd> Shell command to run on `\"END\"` event\n--watch.onError <cmd> Shell command to run on `\"ERROR\"` event\n--watch.onStart <cmd> Shell command to run on `\"START\"` event\n--watch.skipWrite Do not write files to disk when watching\n\nExamples:\n\n# use settings in config file\nrollup -c\n\n# in config file, process.env.INCLUDE_DEPS === 'true'\n# and process.env.BUILD === 'production'\nrollup -c --environment INCLUDE_DEPS,BUILD:production\n\n# create CommonJS bundle.js from src/main.js\nrollup --format=cjs --file=bundle.js -- src/main.js\n\n# create self-executing IIFE using `window.jQuery`\n# and `window._` as external globals\nrollup -f iife --globals jquery:jQuery,lodash:_ \\\n -i src/app.js -o build/app.js -m build/app.js.map\n\nNotes:\n\n* When piping to stdout, only inline sourcemaps are permitted\n\nFor more information visit https://rollupjs.org\n";
31
31
 
32
32
  /**
33
33
  * @license
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.63.4
4
- Sat, 19 Sep 2026 06:35:38 GMT - commit ba78d5752a1e1ff4ff4af3a8bffab7691d822f7d
3
+ Rollup.js v4.63.6
4
+ Thu, 01 Oct 2026 06:50:26 GMT - commit 966ac85d64887ed38abd4eef67c3813633cbc2f6
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.63.4
4
- Sat, 19 Sep 2026 06:35:38 GMT - commit ba78d5752a1e1ff4ff4af3a8bffab7691d822f7d
3
+ Rollup.js v4.63.6
4
+ Thu, 01 Oct 2026 06:50:26 GMT - commit 966ac85d64887ed38abd4eef67c3813633cbc2f6
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.63.4
4
- Sat, 19 Sep 2026 06:35:38 GMT - commit ba78d5752a1e1ff4ff4af3a8bffab7691d822f7d
3
+ Rollup.js v4.63.6
4
+ Thu, 01 Oct 2026 06:50:26 GMT - commit 966ac85d64887ed38abd4eef67c3813633cbc2f6
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.63.4
4
- Sat, 19 Sep 2026 06:35:38 GMT - commit ba78d5752a1e1ff4ff4af3a8bffab7691d822f7d
3
+ Rollup.js v4.63.6
4
+ Thu, 01 Oct 2026 06:50:26 GMT - commit 966ac85d64887ed38abd4eef67c3813633cbc2f6
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -27,7 +27,7 @@ function _mergeNamespaces(n, m) {
27
27
  return Object.defineProperty(n, Symbol.toStringTag, { value: 'Module' });
28
28
  }
29
29
 
30
- var version = "4.63.4";
30
+ var version = "4.63.6";
31
31
  const pkg = {
32
32
  version: version};
33
33
 
@@ -317,7 +317,7 @@ var Chunk$1 = class Chunk {
317
317
  this.outro = "";
318
318
  this.end = index;
319
319
  if (this.edited) {
320
- newChunk.edit("", false);
320
+ newChunk.edit("", false, true);
321
321
  this.content = "";
322
322
  } else this.content = originalBefore;
323
323
  newChunk.next = this.next;
@@ -1295,7 +1295,7 @@ var MagicString = class MagicString {
1295
1295
  * Content appended or prepended at positions strictly inside the range is removed with it, while
1296
1296
  * content attached at `start` or `end` is preserved — use `s.overwrite(start, end, '')` to remove
1297
1297
  * the range including its edge inserts.
1298
- * Removing the same content twice, or making removals that partially overlap, will cause an error.
1298
+ * Repeated removals and removals with partially overlapping ranges are allowed.
1299
1299
  */
1300
1300
  remove(start, end) {
1301
1301
  start = start + this.offset;
@@ -1577,10 +1577,16 @@ var MagicString = class MagicString {
1577
1577
  * @internal
1578
1578
  */
1579
1579
  _hasRemovedContent(start, end) {
1580
- let chunk = this.firstChunk;
1581
- while (chunk) {
1582
- if (chunk.content === "" && chunk.start < end && chunk.end > start) return true;
1583
- chunk = chunk.next;
1580
+ let chunk = this.byStart.get(start);
1581
+ if (!chunk) {
1582
+ chunk = this.lastSearchedChunk;
1583
+ const searchForward = start >= chunk.end;
1584
+ while (chunk && !chunk.contains(start)) chunk = searchForward ? this.byStart.get(chunk.end) : this.byEnd.get(chunk.start);
1585
+ if (chunk) this.lastSearchedChunk = chunk;
1586
+ }
1587
+ while (chunk && chunk.start < end) {
1588
+ if (chunk.content === "") return true;
1589
+ chunk = this.byStart.get(chunk.end);
1584
1590
  }
1585
1591
  return false;
1586
1592
  }
@@ -1644,6 +1650,7 @@ var MagicString = class MagicString {
1644
1650
  const stringLength = string.length;
1645
1651
  if (stringLength === 0) {
1646
1652
  for (let index = 0; index <= original.length; index += 1) {
1653
+ if (this._hasRemovedContent(index, index)) continue;
1647
1654
  const _replacement = typeof replacement === "function" ? replacement("", index, original) : expandReplacement(replacement, "", index, original, [], void 0);
1648
1655
  if (_replacement !== "") this.appendRight(index, _replacement);
1649
1656
  }
@@ -7512,9 +7519,9 @@ class Literal extends NodeBase {
7512
7519
  this.regex = esTreeNode.regex;
7513
7520
  return super.parseNode(esTreeNode);
7514
7521
  }
7515
- render(code) {
7522
+ render() {
7516
7523
  if (typeof this.value === 'string') {
7517
- code.indentExclusionRanges.push([this.start + 1, this.end - 1]);
7524
+ this.scope.context.addIndentExclusionRange([this.start + 1, this.end - 1]);
7518
7525
  }
7519
7526
  }
7520
7527
  }
@@ -8685,6 +8692,8 @@ const builtinModules = [
8685
8692
  "assert/strict",
8686
8693
  "node:async_hooks",
8687
8694
  "async_hooks",
8695
+ "node:bench",
8696
+ "node:bench/reporters",
8688
8697
  "node:buffer",
8689
8698
  "buffer",
8690
8699
  "node:child_process",
@@ -15655,7 +15664,7 @@ class TemplateLiteral extends NodeBase {
15655
15664
  }
15656
15665
  }
15657
15666
  render(code, options) {
15658
- code.indentExclusionRanges.push([this.start, this.end]);
15667
+ this.scope.context.addIndentExclusionRange([this.start, this.end]);
15659
15668
  super.render(code, options);
15660
15669
  }
15661
15670
  }
@@ -17556,6 +17565,7 @@ class Module {
17556
17565
  this.exportedVariablesByName = null;
17557
17566
  this.exportNamesByVariable = null;
17558
17567
  this.exportShimVariable = new ExportShimVariable(this);
17568
+ this.indentExclusionRanges = [];
17559
17569
  this.namespaceReexportsByName = new Map();
17560
17570
  this.reexportDescriptions = new Map();
17561
17571
  this.relevantDependencies = null;
@@ -17961,6 +17971,7 @@ class Module {
17961
17971
  this.options.onLog(level, properties);
17962
17972
  }
17963
17973
  render(options) {
17974
+ this.indentExclusionRanges = [];
17964
17975
  const source = this.magicString.clone();
17965
17976
  this.ast.render(source, options);
17966
17977
  source.trim();
@@ -17968,7 +17979,7 @@ class Module {
17968
17979
  if (usesTopLevelAwait && options.format !== 'es' && options.format !== 'system') {
17969
17980
  return error(logInvalidFormatForTopLevelAwait(this.id, options.format));
17970
17981
  }
17971
- return { source, usesTopLevelAwait };
17982
+ return { indentExclusionRanges: this.indentExclusionRanges, source, usesTopLevelAwait };
17972
17983
  }
17973
17984
  async setSource({ ast, code, customTransformCache, originalCode, originalSourcemap, resolvedIds, sourcemapChain, transformDependencies, transformFiles, safeVariableNames, ...moduleOptions }) {
17974
17985
  timeStart('generate ast', 3);
@@ -17997,8 +18008,7 @@ class Module {
17997
18008
  // can change that, but it makes sense to use it for the source file name
17998
18009
  const fileName = this.id;
17999
18010
  this.magicString = new MagicString(code, {
18000
- filename: (this.excludeFromSourcemap ? null : fileName), // don't include plugin helpers in sourcemap
18001
- indentExclusionRanges: []
18011
+ filename: (this.excludeFromSourcemap ? null : fileName) // don't include plugin helpers in sourcemap
18002
18012
  });
18003
18013
  this.astContext = {
18004
18014
  addDynamicImport: this.addDynamicImport.bind(this),
@@ -18006,6 +18016,7 @@ class Module {
18006
18016
  addImport: this.addImport.bind(this),
18007
18017
  addImportMeta: this.addImportMeta.bind(this),
18008
18018
  addImportSource: this.addImportSource.bind(this),
18019
+ addIndentExclusionRange: (range) => this.indentExclusionRanges.push(range),
18009
18020
  code, // Only needed for debugging
18010
18021
  deoptimizationTracker: this.graph.deoptimizationTracker,
18011
18022
  error: this.error.bind(this),
@@ -19414,6 +19425,9 @@ class Chunk {
19414
19425
  }
19415
19426
  }
19416
19427
  }
19428
+ else if (exportingModule instanceof ExternalModule && importedVariable.included) {
19429
+ includedReexports.push(importedVariable);
19430
+ }
19417
19431
  }
19418
19432
  }
19419
19433
  if (includedReexports.length > 0) {
@@ -19844,7 +19858,10 @@ class Chunk {
19844
19858
  if (renderedLength) {
19845
19859
  if (compact && source.lastLine().includes('//'))
19846
19860
  source.append('\n');
19847
- magicString.addSource(source);
19861
+ magicString.addSource({
19862
+ content: source,
19863
+ indentExclusionRanges: rendered.indentExclusionRanges
19864
+ });
19848
19865
  usedModules.push(module);
19849
19866
  }
19850
19867
  const namespace = module.namespace;
@@ -20147,7 +20164,7 @@ function* concatLazy(iterables) {
20147
20164
  * per dynamic entry to marks all dynamic entry dependencies as "dirty" and put
20148
20165
  * them back into the iteration. As an additional optimization, we note for
20149
20166
  * each dynamic entry which dynamic dependent entries have changed and only
20150
- * intersect those entries again on subsequent interations.
20167
+ * intersect those entries again on subsequent iterations.
20151
20168
  *
20152
20169
  * Then we remove the dynamic entries from the list of dependent entries for
20153
20170
  * those chunks that are already loaded for that dynamic entry and create
@@ -23453,7 +23470,7 @@ function normalizeEntryModules(entryModules) {
23453
23470
  }));
23454
23471
  }
23455
23472
  class Graph {
23456
- constructor(options, watcher) {
23473
+ constructor(options, registerWatchHooks) {
23457
23474
  this.options = options;
23458
23475
  this.astLru = flru(5);
23459
23476
  this.cachedModules = new Map();
@@ -23488,12 +23505,12 @@ class Graph {
23488
23505
  value[0]++;
23489
23506
  }
23490
23507
  }
23491
- if (watcher) {
23508
+ if (registerWatchHooks) {
23492
23509
  this.watchMode = true;
23493
- const handleChange = (...parameters) => this.pluginDriver.hookParallel('watchChange', parameters);
23494
- const handleClose = () => this.pluginDriver.hookParallel('closeWatcher', []);
23495
- watcher.onCurrentRun('change', handleChange);
23496
- watcher.onCurrentRun('close', handleClose);
23510
+ registerWatchHooks({
23511
+ closeWatcher: () => this.pluginDriver.hookParallel('closeWatcher', []),
23512
+ watchChange: (...parameters) => this.pluginDriver.hookParallel('watchChange', parameters)
23513
+ });
23497
23514
  }
23498
23515
  this.pluginDriver = new PluginDriver(this, options, options.plugins, this.pluginCache);
23499
23516
  this.moduleLoader = new ModuleLoader(this, this.modulesById, this.options, this.pluginDriver);
@@ -24182,11 +24199,11 @@ Symbol.asyncDispose ??= Symbol('Symbol.asyncDispose');
24182
24199
  function rollup(rawInputOptions) {
24183
24200
  return rollupInternal(rawInputOptions, null);
24184
24201
  }
24185
- async function rollupInternal(rawInputOptions, watcher) {
24186
- const { options: inputOptions, unsetOptions: unsetInputOptions } = await getInputOptions(rawInputOptions, watcher !== null);
24202
+ async function rollupInternal(rawInputOptions, registerWatchHooks) {
24203
+ const { options: inputOptions, unsetOptions: unsetInputOptions } = await getInputOptions(rawInputOptions, registerWatchHooks !== null);
24187
24204
  initialiseTimers(inputOptions);
24188
24205
  await initWasm();
24189
- const graph = new Graph(inputOptions, watcher);
24206
+ const graph = new Graph(inputOptions, registerWatchHooks);
24190
24207
  // remove the cache object from the memory after graph creation (cache is not used anymore)
24191
24208
  const useCache = rawInputOptions.cache !== false;
24192
24209
  if (rawInputOptions.cache) {
@@ -24712,6 +24729,15 @@ const fseventsImporter = /*#__PURE__*/Object.defineProperty({
24712
24729
  loadFsEvents
24713
24730
  }, Symbol.toStringTag, { value: 'Module' });
24714
24731
 
24732
+ function waitForAllAndRethrowFirstFailure(promises) {
24733
+ return Promise.allSettled(promises).then(results => {
24734
+ for (const result of results) {
24735
+ if (result.status === 'rejected') {
24736
+ throw result.reason;
24737
+ }
24738
+ }
24739
+ });
24740
+ }
24715
24741
  class WatchEmitter {
24716
24742
  constructor() {
24717
24743
  this.currentHandlers = Object.create(null);
@@ -24720,7 +24746,8 @@ class WatchEmitter {
24720
24746
  // Will be overwritten by Rollup
24721
24747
  async close() { }
24722
24748
  emit(event, ...parameters) {
24723
- return Promise.all([...this.getCurrentHandlers(event), ...this.getPersistentHandlers(event)].map(handler => handler(...parameters)));
24749
+ // The async wrapper turns a synchronous throw into a rejection so that no sibling listener is skipped.
24750
+ return waitForAllAndRethrowFirstFailure([...this.getCurrentHandlers(event), ...this.getPersistentHandlers(event)].map(async (handler) => handler(...parameters)));
24724
24751
  }
24725
24752
  off(event, listener) {
24726
24753
  const listeners = this.persistentHandlers[event];
@@ -24767,7 +24794,21 @@ class WatchEmitter {
24767
24794
 
24768
24795
  function watch(configs) {
24769
24796
  const emitter = new WatchEmitter();
24770
- watchInternal(configs, emitter).catch(error => {
24797
+ let isClosed = false;
24798
+ // Until the watcher takes over closing, a close prevents its construction
24799
+ // and emits close itself, as no watcher will.
24800
+ emitter.close = async () => {
24801
+ if (isClosed)
24802
+ return;
24803
+ isClosed = true;
24804
+ try {
24805
+ await emitter.emit('close');
24806
+ }
24807
+ finally {
24808
+ emitter.removeAllListeners();
24809
+ }
24810
+ };
24811
+ watchInternal(configs, emitter, () => isClosed).catch(error => {
24771
24812
  handleError(error);
24772
24813
  });
24773
24814
  return emitter;
@@ -24799,7 +24840,7 @@ function checkWatchConfig(config) {
24799
24840
  }
24800
24841
  }
24801
24842
  }
24802
- async function watchInternal(configs, emitter) {
24843
+ async function watchInternal(configs, emitter, wasClosed) {
24803
24844
  const optionsList = await Promise.all(ensureArray(configs).map(config => mergeOptions(config, true)));
24804
24845
  const watchOptionsList = optionsList.filter(config => config.watch !== false);
24805
24846
  if (watchOptionsList.length === 0) {
@@ -24808,9 +24849,12 @@ async function watchInternal(configs, emitter) {
24808
24849
  checkWatchConfig(watchOptionsList);
24809
24850
  await loadFsEvents();
24810
24851
  const { Watcher } = await import('./watch.js');
24852
+ if (wasClosed()) {
24853
+ return;
24854
+ }
24811
24855
  new Watcher(watchOptionsList, emitter);
24812
24856
  }
24813
24857
 
24814
24858
  const VERSION = pkg.version;
24815
24859
 
24816
- export { VERSION, createFilter$1 as createFilter, defineConfig, fseventsImporter, getAugmentedNamespace, getDefaultExportFromCjs, rollup, rollupInternal, watch };
24860
+ export { VERSION, createFilter$1 as createFilter, defineConfig, fseventsImporter, getAugmentedNamespace, getDefaultExportFromCjs, rollup, rollupInternal, waitForAllAndRethrowFirstFailure, watch };
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.63.4
4
- Sat, 19 Sep 2026 06:35:38 GMT - commit ba78d5752a1e1ff4ff4af3a8bffab7691d822f7d
3
+ Rollup.js v4.63.6
4
+ Thu, 01 Oct 2026 06:50:26 GMT - commit 966ac85d64887ed38abd4eef67c3813633cbc2f6
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,13 +1,13 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.63.4
4
- Sat, 19 Sep 2026 06:35:38 GMT - commit ba78d5752a1e1ff4ff4af3a8bffab7691d822f7d
3
+ Rollup.js v4.63.6
4
+ Thu, 01 Oct 2026 06:50:26 GMT - commit 966ac85d64887ed38abd4eef67c3813633cbc2f6
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
8
8
  Released under the MIT License.
9
9
  */
10
- import { getAugmentedNamespace, fseventsImporter, getDefaultExportFromCjs, createFilter, rollupInternal } from './node-entry.js';
10
+ import { getAugmentedNamespace, fseventsImporter, getDefaultExportFromCjs, waitForAllAndRethrowFirstFailure, createFilter, rollupInternal } from './node-entry.js';
11
11
  import path from 'node:path';
12
12
  import process$1 from 'node:process';
13
13
  import require$$0$1 from 'path';
@@ -9690,11 +9690,12 @@ const eventsRewrites = {
9690
9690
  };
9691
9691
  class Watcher {
9692
9692
  constructor(optionsList, emitter) {
9693
+ this.closed = false;
9693
9694
  this.buildDelay = 0;
9694
9695
  this.buildTimeout = null;
9695
- this.closed = false;
9696
9696
  this.invalidatedIds = new Map();
9697
9697
  this.rerun = false;
9698
+ // Starts held so that invalidations before the initial run only request a rerun.
9698
9699
  this.running = true;
9699
9700
  this.emitter = emitter;
9700
9701
  emitter.close = this.close.bind(this);
@@ -9704,7 +9705,7 @@ class Watcher {
9704
9705
  this.buildDelay = Math.max(this.buildDelay, watch.buildDelay);
9705
9706
  }
9706
9707
  }
9707
- process$1.nextTick(() => this.run().catch(error => this.reportError(error)));
9708
+ process$1.nextTick(() => this.runExclusively(() => this.run()));
9708
9709
  }
9709
9710
  async close() {
9710
9711
  if (this.closed)
@@ -9712,13 +9713,19 @@ class Watcher {
9712
9713
  this.closed = true;
9713
9714
  if (this.buildTimeout)
9714
9715
  clearTimeout(this.buildTimeout);
9715
- for (const task of this.tasks) {
9716
- task.close();
9716
+ try {
9717
+ await waitForAllAndRethrowFirstFailure([
9718
+ ...this.tasks.map(task => task.close()),
9719
+ this.emitter.emit('close')
9720
+ ]);
9721
+ }
9722
+ finally {
9723
+ this.emitter.removeAllListeners();
9717
9724
  }
9718
- await this.emitter.emit('close');
9719
- this.emitter.removeAllListeners();
9720
9725
  }
9721
9726
  invalidate(file) {
9727
+ if (this.closed)
9728
+ return;
9722
9729
  if (file) {
9723
9730
  const previousEvent = this.invalidatedIds.get(file.id);
9724
9731
  const event = previousEvent ? eventsRewrites[previousEvent][file.event] : file.event;
@@ -9739,22 +9746,64 @@ class Watcher {
9739
9746
  }
9740
9747
  if (this.buildTimeout)
9741
9748
  clearTimeout(this.buildTimeout);
9742
- this.buildTimeout = setTimeout(async () => {
9749
+ this.buildTimeout = setTimeout(() => {
9743
9750
  this.buildTimeout = null;
9744
- try {
9745
- await Promise.all([...this.invalidatedIds].map(([id, event]) => this.emitter.emit('change', id, { event })));
9746
- this.invalidatedIds.clear();
9747
- await this.emitter.emit('restart');
9748
- this.emitter.removeListenersForCurrentRun();
9749
- await this.run();
9750
- }
9751
- catch (error) {
9752
- await this.reportError(error);
9753
- }
9751
+ this.runExclusively(() => this.announceChangesAndRebuild());
9754
9752
  }, this.buildDelay);
9755
9753
  }
9756
- async reportError(error) {
9754
+ // The running flag spans the whole cycle, including async listeners, so
9755
+ // that invalidations meanwhile only request a rerun.
9756
+ async runExclusively(cycle) {
9757
+ this.running = true;
9758
+ try {
9759
+ await cycle();
9760
+ }
9761
+ catch (error) {
9762
+ await this.reportError(error);
9763
+ }
9764
+ finally {
9765
+ this.running = false;
9766
+ }
9767
+ if (this.rerun) {
9768
+ this.rerun = false;
9769
+ this.invalidate();
9770
+ }
9771
+ }
9772
+ async announceChangesAndRebuild() {
9773
+ await this.announcePendingChanges();
9774
+ if (this.closed || !this.hasInvalidatedTask())
9775
+ return;
9776
+ await this.emitter.emit('restart');
9777
+ await this.announcePendingChanges();
9778
+ if (this.closed)
9779
+ return;
9780
+ this.emitter.removeListenersForCurrentRun();
9781
+ await this.run();
9782
+ }
9783
+ // The upcoming run consumes announced changes via the task flags, making
9784
+ // their rerun requests obsolete. The reset must directly follow the last
9785
+ // emptiness check so that no change slips through unannounced.
9786
+ async announcePendingChanges() {
9787
+ while (this.invalidatedIds.size > 0 && !this.closed) {
9788
+ await this.announceChangeBatch();
9789
+ }
9790
+ this.rerun = false;
9791
+ }
9792
+ // Cleared before emitting so that changes arriving during slow hooks,
9793
+ // including follow-ups of the same file, form the next batch instead of
9794
+ // being dropped with this one.
9795
+ async announceChangeBatch() {
9796
+ const changes = [...this.invalidatedIds];
9757
9797
  this.invalidatedIds.clear();
9798
+ await waitForAllAndRethrowFirstFailure(changes.flatMap(([id, event]) => [
9799
+ ...this.tasks.map(task => task.announceChange(id, event)),
9800
+ this.emitter.emit('change', id, { event })
9801
+ ]));
9802
+ }
9803
+ hasInvalidatedTask() {
9804
+ return this.tasks.some(task => task.isInvalidated());
9805
+ }
9806
+ async reportError(error) {
9758
9807
  await this.emitter.emit('event', {
9759
9808
  code: 'ERROR',
9760
9809
  error,
@@ -9765,37 +9814,26 @@ class Watcher {
9765
9814
  });
9766
9815
  }
9767
9816
  async run() {
9768
- this.running = true;
9769
- // Drop a rerun request left over from a failed run: honoring it after this run
9770
- // would start an empty run that removes the plugin event listeners of this run.
9771
- this.rerun = false;
9772
- try {
9773
- await this.emitter.emit('event', {
9774
- code: 'START'
9775
- });
9776
- for (const task of this.tasks) {
9777
- await task.run();
9778
- }
9779
- }
9780
- finally {
9781
- this.running = false;
9817
+ await this.emitter.emit('event', {
9818
+ code: 'START'
9819
+ });
9820
+ for (const task of this.tasks) {
9821
+ await task.run();
9782
9822
  }
9823
+ if (this.closed)
9824
+ return;
9783
9825
  await this.emitter.emit('event', {
9784
9826
  code: 'END'
9785
9827
  });
9786
- if (this.rerun) {
9787
- this.rerun = false;
9788
- this.invalidate();
9789
- }
9790
9828
  }
9791
9829
  }
9792
9830
  class Task {
9793
9831
  constructor(watcher, options) {
9794
9832
  this.cache = { modules: [] };
9795
9833
  this.watchFiles = [];
9796
- this.closed = false;
9797
9834
  this.invalidated = true;
9798
9835
  this.watched = new Set();
9836
+ this.watchHooks = null;
9799
9837
  this.watcher = watcher;
9800
9838
  this.options = options;
9801
9839
  this.skipWrite = Boolean(options.watch && options.watch.skipWrite);
@@ -9813,9 +9851,14 @@ class Task {
9813
9851
  ignoreInitial: true
9814
9852
  });
9815
9853
  }
9816
- close() {
9817
- this.closed = true;
9854
+ async announceChange(id, event) {
9855
+ await this.watchHooks?.watchChange(id, { event });
9856
+ }
9857
+ async close() {
9818
9858
  this.fileWatcher.close();
9859
+ const watchHooks = this.watchHooks;
9860
+ this.watchHooks = null;
9861
+ await watchHooks?.closeWatcher();
9819
9862
  }
9820
9863
  invalidate(id, details) {
9821
9864
  this.invalidated = true;
@@ -9830,8 +9873,11 @@ class Task {
9830
9873
  this.watcher.invalidate({ event: details.event, id });
9831
9874
  this.watchOptions.onInvalidate?.(id);
9832
9875
  }
9876
+ isInvalidated() {
9877
+ return this.invalidated;
9878
+ }
9833
9879
  async run() {
9834
- if (!this.invalidated)
9880
+ if (!this.invalidated || this.watcher.closed)
9835
9881
  return;
9836
9882
  this.invalidated = false;
9837
9883
  const options = {
@@ -9844,16 +9890,22 @@ class Task {
9844
9890
  input: this.options.input,
9845
9891
  output: this.outputFiles
9846
9892
  });
9893
+ if (this.watcher.closed) {
9894
+ return;
9895
+ }
9847
9896
  let result = null;
9848
9897
  try {
9849
- result = await rollupInternal(options, this.watcher.emitter);
9850
- if (this.closed) {
9898
+ result = await rollupInternal(options, watchHooks => {
9899
+ if (!this.watcher.closed)
9900
+ this.watchHooks = watchHooks;
9901
+ });
9902
+ if (this.watcher.closed) {
9851
9903
  return;
9852
9904
  }
9853
9905
  this.updateWatchedFiles(result);
9854
9906
  if (!this.skipWrite) {
9855
9907
  await Promise.all(this.outputs.map(output => result.write(output)));
9856
- if (this.closed) {
9908
+ if (this.watcher.closed) {
9857
9909
  return;
9858
9910
  }
9859
9911
  this.updateWatchedFiles(result);
@@ -9867,7 +9919,7 @@ class Task {
9867
9919
  });
9868
9920
  }
9869
9921
  catch (error) {
9870
- if (!this.closed) {
9922
+ if (!this.watcher.closed) {
9871
9923
  if (Array.isArray(error.watchFiles)) {
9872
9924
  for (const id of error.watchFiles) {
9873
9925
  this.watchFile(id);
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.63.4
4
- Sat, 19 Sep 2026 06:35:38 GMT - commit ba78d5752a1e1ff4ff4af3a8bffab7691d822f7d
3
+ Rollup.js v4.63.6
4
+ Thu, 01 Oct 2026 06:50:26 GMT - commit 966ac85d64887ed38abd4eef67c3813633cbc2f6
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.63.4
4
- Sat, 19 Sep 2026 06:35:38 GMT - commit ba78d5752a1e1ff4ff4af3a8bffab7691d822f7d
3
+ Rollup.js v4.63.6
4
+ Thu, 01 Oct 2026 06:50:26 GMT - commit 966ac85d64887ed38abd4eef67c3813633cbc2f6
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.63.4
4
- Sat, 19 Sep 2026 06:35:38 GMT - commit ba78d5752a1e1ff4ff4af3a8bffab7691d822f7d
3
+ Rollup.js v4.63.6
4
+ Thu, 01 Oct 2026 06:50:26 GMT - commit 966ac85d64887ed38abd4eef67c3813633cbc2f6
5
5
 
6
6
  https://github.com/rollup/rollup
7
7