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/rollup.d.ts CHANGED
@@ -1081,16 +1081,14 @@ export interface AwaitingEventEmitter<T extends Record<string, (...parameters: a
1081
1081
  off<K extends keyof T>(event: K, listener: AwaitedEventListener<T, K>): this;
1082
1082
  /**
1083
1083
  * Registers an event listener that will be awaited before Rollup continues.
1084
- * All listeners will be awaited in parallel while rejections are tracked via
1085
- * Promise.all.
1084
+ * All listeners are invoked and awaited in parallel. Rollup waits until all
1085
+ * of them have settled and then throws the first rejection, if any.
1086
1086
  */
1087
1087
  on<K extends keyof T>(event: K, listener: AwaitedEventListener<T, K>): this;
1088
1088
  /**
1089
- * Registers an event listener that will be awaited before Rollup continues.
1090
- * All listeners will be awaited in parallel while rejections are tracked via
1091
- * Promise.all.
1092
- * Listeners are removed automatically when removeListenersForCurrentRun is
1093
- * called, which happens automatically after each run.
1089
+ * Registers an event listener like `on`. Listeners are removed automatically
1090
+ * when removeListenersForCurrentRun is called, which happens right before each
1091
+ * rebuild, after the changes that triggered it were announced.
1094
1092
  */
1095
1093
  onCurrentRun<K extends keyof T>(
1096
1094
  event: K,
package/dist/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
 
@@ -12,118 +12,20 @@
12
12
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
13
13
 
14
14
  const rollup = require('./shared/rollup.js');
15
- const parseAst_js = require('./shared/parseAst.js');
16
- const fseventsImporter = require('./shared/fsevents-importer.js');
17
- require('node:process');
15
+ const rollup_js = require('./shared/node-entry.js');
16
+ require('./shared/parseAst.js');
17
+ require('./native.js');
18
18
  require('node:path');
19
+ require('node:process');
19
20
  require('path');
20
- require('./native.js');
21
21
  require('node:perf_hooks');
22
22
  require('node:fs/promises');
23
+ require('./shared/fsevents-importer.js');
23
24
 
24
- class WatchEmitter {
25
- constructor() {
26
- this.currentHandlers = Object.create(null);
27
- this.persistentHandlers = Object.create(null);
28
- }
29
- // Will be overwritten by Rollup
30
- async close() { }
31
- emit(event, ...parameters) {
32
- return Promise.all([...this.getCurrentHandlers(event), ...this.getPersistentHandlers(event)].map(handler => handler(...parameters)));
33
- }
34
- off(event, listener) {
35
- const listeners = this.persistentHandlers[event];
36
- if (listeners) {
37
- // A hack stolen from "mitt": ">>> 0" does not change numbers >= 0, but -1
38
- // (which would remove the last array element if used unchanged) is turned
39
- // into max_int, which is outside the array and does not change anything.
40
- listeners.splice(listeners.indexOf(listener) >>> 0, 1);
41
- }
42
- return this;
43
- }
44
- on(event, listener) {
45
- this.getPersistentHandlers(event).push(listener);
46
- return this;
47
- }
48
- onCurrentRun(event, listener) {
49
- this.getCurrentHandlers(event).push(listener);
50
- return this;
51
- }
52
- once(event, listener) {
53
- const selfRemovingListener = (...parameters) => {
54
- this.off(event, selfRemovingListener);
55
- return listener(...parameters);
56
- };
57
- this.on(event, selfRemovingListener);
58
- return this;
59
- }
60
- removeAllListeners() {
61
- this.removeListenersForCurrentRun();
62
- this.persistentHandlers = Object.create(null);
63
- return this;
64
- }
65
- removeListenersForCurrentRun() {
66
- this.currentHandlers = Object.create(null);
67
- return this;
68
- }
69
- getCurrentHandlers(event) {
70
- return this.currentHandlers[event] || (this.currentHandlers[event] = []);
71
- }
72
- getPersistentHandlers(event) {
73
- return this.persistentHandlers[event] || (this.persistentHandlers[event] = []);
74
- }
75
- }
76
-
77
- function watch(configs) {
78
- const emitter = new WatchEmitter();
79
- watchInternal(configs, emitter).catch(error => {
80
- rollup.handleError(error);
81
- });
82
- return emitter;
83
- }
84
- function ensureTrailingSlash(path) {
85
- if (path[path.length - 1] !== '/') {
86
- return `${path}/`;
87
- }
88
- return path;
89
- }
90
- function checkWatchConfig(config) {
91
- for (const item of config) {
92
- if (typeof item.watch !== 'boolean' && item.watch?.allowInputInsideOutputPath) {
93
- break;
94
- }
95
- if (item.input && item.output) {
96
- const input = typeof item.input === 'string' ? rollup.ensureArray(item.input) : item.input;
97
- const outputs = rollup.ensureArray(item.output);
98
- for (const index in input) {
99
- const inputPath = input[index];
100
- if (typeof inputPath !== 'string') {
101
- continue;
102
- }
103
- const outputWithInputAsSubPath = outputs.find(({ dir }) => dir && ensureTrailingSlash(inputPath).startsWith(ensureTrailingSlash(dir)));
104
- if (outputWithInputAsSubPath) {
105
- parseAst_js.error(parseAst_js.logInvalidOption('watch', parseAst_js.URL_WATCH, `the input "${inputPath}" is a subpath of the output "${outputWithInputAsSubPath.dir}"`));
106
- }
107
- }
108
- }
109
- }
110
- }
111
- async function watchInternal(configs, emitter) {
112
- const optionsList = await Promise.all(rollup.ensureArray(configs).map(config => rollup.mergeOptions(config, true)));
113
- const watchOptionsList = optionsList.filter(config => config.watch !== false);
114
- if (watchOptionsList.length === 0) {
115
- return parseAst_js.error(parseAst_js.logInvalidOption('watch', parseAst_js.URL_WATCH, 'there must be at least one config where "watch" is not set to "false"'));
116
- }
117
- checkWatchConfig(watchOptionsList);
118
- await fseventsImporter.loadFsEvents();
119
- const { Watcher } = await Promise.resolve().then(() => require('./shared/watch.js'));
120
- new Watcher(watchOptionsList, emitter);
121
- }
122
25
 
123
- const VERSION = rollup.package_.version;
124
26
 
125
27
  exports.defineConfig = rollup.defineConfig;
126
28
  exports.rollup = rollup.rollup;
127
- exports.VERSION = VERSION;
128
- exports.watch = watch;
29
+ exports.VERSION = rollup_js.VERSION;
30
+ exports.watch = rollup_js.watch;
129
31
  //# sourceMappingURL=rollup.js.map
@@ -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
 
@@ -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
 
@@ -0,0 +1,147 @@
1
+ /*
2
+ @license
3
+ Rollup.js v4.63.6
4
+ Thu, 01 Oct 2026 06:50:26 GMT - commit 966ac85d64887ed38abd4eef67c3813633cbc2f6
5
+
6
+ https://github.com/rollup/rollup
7
+
8
+ Released under the MIT License.
9
+ */
10
+ 'use strict';
11
+
12
+ const rollup = require('./rollup.js');
13
+ const parseAst_js = require('./parseAst.js');
14
+ const fseventsImporter = require('./fsevents-importer.js');
15
+
16
+ function waitForAllAndRethrowFirstFailure(promises) {
17
+ return Promise.allSettled(promises).then(results => {
18
+ for (const result of results) {
19
+ if (result.status === 'rejected') {
20
+ throw result.reason;
21
+ }
22
+ }
23
+ });
24
+ }
25
+ class WatchEmitter {
26
+ constructor() {
27
+ this.currentHandlers = Object.create(null);
28
+ this.persistentHandlers = Object.create(null);
29
+ }
30
+ // Will be overwritten by Rollup
31
+ async close() { }
32
+ emit(event, ...parameters) {
33
+ // The async wrapper turns a synchronous throw into a rejection so that no sibling listener is skipped.
34
+ return waitForAllAndRethrowFirstFailure([...this.getCurrentHandlers(event), ...this.getPersistentHandlers(event)].map(async (handler) => handler(...parameters)));
35
+ }
36
+ off(event, listener) {
37
+ const listeners = this.persistentHandlers[event];
38
+ if (listeners) {
39
+ // A hack stolen from "mitt": ">>> 0" does not change numbers >= 0, but -1
40
+ // (which would remove the last array element if used unchanged) is turned
41
+ // into max_int, which is outside the array and does not change anything.
42
+ listeners.splice(listeners.indexOf(listener) >>> 0, 1);
43
+ }
44
+ return this;
45
+ }
46
+ on(event, listener) {
47
+ this.getPersistentHandlers(event).push(listener);
48
+ return this;
49
+ }
50
+ onCurrentRun(event, listener) {
51
+ this.getCurrentHandlers(event).push(listener);
52
+ return this;
53
+ }
54
+ once(event, listener) {
55
+ const selfRemovingListener = (...parameters) => {
56
+ this.off(event, selfRemovingListener);
57
+ return listener(...parameters);
58
+ };
59
+ this.on(event, selfRemovingListener);
60
+ return this;
61
+ }
62
+ removeAllListeners() {
63
+ this.removeListenersForCurrentRun();
64
+ this.persistentHandlers = Object.create(null);
65
+ return this;
66
+ }
67
+ removeListenersForCurrentRun() {
68
+ this.currentHandlers = Object.create(null);
69
+ return this;
70
+ }
71
+ getCurrentHandlers(event) {
72
+ return this.currentHandlers[event] || (this.currentHandlers[event] = []);
73
+ }
74
+ getPersistentHandlers(event) {
75
+ return this.persistentHandlers[event] || (this.persistentHandlers[event] = []);
76
+ }
77
+ }
78
+
79
+ function watch(configs) {
80
+ const emitter = new WatchEmitter();
81
+ let isClosed = false;
82
+ // Until the watcher takes over closing, a close prevents its construction
83
+ // and emits close itself, as no watcher will.
84
+ emitter.close = async () => {
85
+ if (isClosed)
86
+ return;
87
+ isClosed = true;
88
+ try {
89
+ await emitter.emit('close');
90
+ }
91
+ finally {
92
+ emitter.removeAllListeners();
93
+ }
94
+ };
95
+ watchInternal(configs, emitter, () => isClosed).catch(error => {
96
+ rollup.handleError(error);
97
+ });
98
+ return emitter;
99
+ }
100
+ function ensureTrailingSlash(path) {
101
+ if (path[path.length - 1] !== '/') {
102
+ return `${path}/`;
103
+ }
104
+ return path;
105
+ }
106
+ function checkWatchConfig(config) {
107
+ for (const item of config) {
108
+ if (typeof item.watch !== 'boolean' && item.watch?.allowInputInsideOutputPath) {
109
+ break;
110
+ }
111
+ if (item.input && item.output) {
112
+ const input = typeof item.input === 'string' ? rollup.ensureArray(item.input) : item.input;
113
+ const outputs = rollup.ensureArray(item.output);
114
+ for (const index in input) {
115
+ const inputPath = input[index];
116
+ if (typeof inputPath !== 'string') {
117
+ continue;
118
+ }
119
+ const outputWithInputAsSubPath = outputs.find(({ dir }) => dir && ensureTrailingSlash(inputPath).startsWith(ensureTrailingSlash(dir)));
120
+ if (outputWithInputAsSubPath) {
121
+ parseAst_js.error(parseAst_js.logInvalidOption('watch', parseAst_js.URL_WATCH, `the input "${inputPath}" is a subpath of the output "${outputWithInputAsSubPath.dir}"`));
122
+ }
123
+ }
124
+ }
125
+ }
126
+ }
127
+ async function watchInternal(configs, emitter, wasClosed) {
128
+ const optionsList = await Promise.all(rollup.ensureArray(configs).map(config => rollup.mergeOptions(config, true)));
129
+ const watchOptionsList = optionsList.filter(config => config.watch !== false);
130
+ if (watchOptionsList.length === 0) {
131
+ return parseAst_js.error(parseAst_js.logInvalidOption('watch', parseAst_js.URL_WATCH, 'there must be at least one config where "watch" is not set to "false"'));
132
+ }
133
+ checkWatchConfig(watchOptionsList);
134
+ await fseventsImporter.loadFsEvents();
135
+ const { Watcher } = await Promise.resolve().then(() => require('./watch.js'));
136
+ if (wasClosed()) {
137
+ return;
138
+ }
139
+ new Watcher(watchOptionsList, emitter);
140
+ }
141
+
142
+ const VERSION = rollup.package_.version;
143
+
144
+ exports.VERSION = VERSION;
145
+ exports.waitForAllAndRethrowFirstFailure = waitForAllAndRethrowFirstFailure;
146
+ exports.watch = watch;
147
+ //# sourceMappingURL=node-entry.js.map
@@ -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
 
@@ -42,7 +42,7 @@ function _mergeNamespaces(n, m) {
42
42
 
43
43
  const promises__namespace = /*#__PURE__*/_interopNamespaceDefault(promises);
44
44
 
45
- var version = "4.63.4";
45
+ var version = "4.63.6";
46
46
  const package_ = {
47
47
  version: version};
48
48
 
@@ -4507,7 +4507,7 @@ var Chunk$1 = class Chunk {
4507
4507
  this.outro = "";
4508
4508
  this.end = index;
4509
4509
  if (this.edited) {
4510
- newChunk.edit("", false);
4510
+ newChunk.edit("", false, true);
4511
4511
  this.content = "";
4512
4512
  } else this.content = originalBefore;
4513
4513
  newChunk.next = this.next;
@@ -5485,7 +5485,7 @@ var MagicString = class MagicString {
5485
5485
  * Content appended or prepended at positions strictly inside the range is removed with it, while
5486
5486
  * content attached at `start` or `end` is preserved — use `s.overwrite(start, end, '')` to remove
5487
5487
  * the range including its edge inserts.
5488
- * Removing the same content twice, or making removals that partially overlap, will cause an error.
5488
+ * Repeated removals and removals with partially overlapping ranges are allowed.
5489
5489
  */
5490
5490
  remove(start, end) {
5491
5491
  start = start + this.offset;
@@ -5767,10 +5767,16 @@ var MagicString = class MagicString {
5767
5767
  * @internal
5768
5768
  */
5769
5769
  _hasRemovedContent(start, end) {
5770
- let chunk = this.firstChunk;
5771
- while (chunk) {
5772
- if (chunk.content === "" && chunk.start < end && chunk.end > start) return true;
5773
- chunk = chunk.next;
5770
+ let chunk = this.byStart.get(start);
5771
+ if (!chunk) {
5772
+ chunk = this.lastSearchedChunk;
5773
+ const searchForward = start >= chunk.end;
5774
+ while (chunk && !chunk.contains(start)) chunk = searchForward ? this.byStart.get(chunk.end) : this.byEnd.get(chunk.start);
5775
+ if (chunk) this.lastSearchedChunk = chunk;
5776
+ }
5777
+ while (chunk && chunk.start < end) {
5778
+ if (chunk.content === "") return true;
5779
+ chunk = this.byStart.get(chunk.end);
5774
5780
  }
5775
5781
  return false;
5776
5782
  }
@@ -5834,6 +5840,7 @@ var MagicString = class MagicString {
5834
5840
  const stringLength = string.length;
5835
5841
  if (stringLength === 0) {
5836
5842
  for (let index = 0; index <= original.length; index += 1) {
5843
+ if (this._hasRemovedContent(index, index)) continue;
5837
5844
  const _replacement = typeof replacement === "function" ? replacement("", index, original) : expandReplacement(replacement, "", index, original, [], void 0);
5838
5845
  if (_replacement !== "") this.appendRight(index, _replacement);
5839
5846
  }
@@ -11672,9 +11679,9 @@ class Literal extends NodeBase {
11672
11679
  this.regex = esTreeNode.regex;
11673
11680
  return super.parseNode(esTreeNode);
11674
11681
  }
11675
- render(code) {
11682
+ render() {
11676
11683
  if (typeof this.value === 'string') {
11677
- code.indentExclusionRanges.push([this.start + 1, this.end - 1]);
11684
+ this.scope.context.addIndentExclusionRange([this.start + 1, this.end - 1]);
11678
11685
  }
11679
11686
  }
11680
11687
  }
@@ -12845,6 +12852,8 @@ const builtinModules = [
12845
12852
  "assert/strict",
12846
12853
  "node:async_hooks",
12847
12854
  "async_hooks",
12855
+ "node:bench",
12856
+ "node:bench/reporters",
12848
12857
  "node:buffer",
12849
12858
  "buffer",
12850
12859
  "node:child_process",
@@ -17272,7 +17281,7 @@ class TemplateLiteral extends NodeBase {
17272
17281
  }
17273
17282
  }
17274
17283
  render(code, options) {
17275
- code.indentExclusionRanges.push([this.start, this.end]);
17284
+ this.scope.context.addIndentExclusionRange([this.start, this.end]);
17276
17285
  super.render(code, options);
17277
17286
  }
17278
17287
  }
@@ -19166,6 +19175,7 @@ class Module {
19166
19175
  this.exportedVariablesByName = null;
19167
19176
  this.exportNamesByVariable = null;
19168
19177
  this.exportShimVariable = new ExportShimVariable(this);
19178
+ this.indentExclusionRanges = [];
19169
19179
  this.namespaceReexportsByName = new Map();
19170
19180
  this.reexportDescriptions = new Map();
19171
19181
  this.relevantDependencies = null;
@@ -19571,6 +19581,7 @@ class Module {
19571
19581
  this.options.onLog(level, properties);
19572
19582
  }
19573
19583
  render(options) {
19584
+ this.indentExclusionRanges = [];
19574
19585
  const source = this.magicString.clone();
19575
19586
  this.ast.render(source, options);
19576
19587
  source.trim();
@@ -19578,7 +19589,7 @@ class Module {
19578
19589
  if (usesTopLevelAwait && options.format !== 'es' && options.format !== 'system') {
19579
19590
  return parseAst_js.error(parseAst_js.logInvalidFormatForTopLevelAwait(this.id, options.format));
19580
19591
  }
19581
- return { source, usesTopLevelAwait };
19592
+ return { indentExclusionRanges: this.indentExclusionRanges, source, usesTopLevelAwait };
19582
19593
  }
19583
19594
  async setSource({ ast, code, customTransformCache, originalCode, originalSourcemap, resolvedIds, sourcemapChain, transformDependencies, transformFiles, safeVariableNames, ...moduleOptions }) {
19584
19595
  timeStart('generate ast', 3);
@@ -19607,8 +19618,7 @@ class Module {
19607
19618
  // can change that, but it makes sense to use it for the source file name
19608
19619
  const fileName = this.id;
19609
19620
  this.magicString = new MagicString(code, {
19610
- filename: (this.excludeFromSourcemap ? null : fileName), // don't include plugin helpers in sourcemap
19611
- indentExclusionRanges: []
19621
+ filename: (this.excludeFromSourcemap ? null : fileName) // don't include plugin helpers in sourcemap
19612
19622
  });
19613
19623
  this.astContext = {
19614
19624
  addDynamicImport: this.addDynamicImport.bind(this),
@@ -19616,6 +19626,7 @@ class Module {
19616
19626
  addImport: this.addImport.bind(this),
19617
19627
  addImportMeta: this.addImportMeta.bind(this),
19618
19628
  addImportSource: this.addImportSource.bind(this),
19629
+ addIndentExclusionRange: (range) => this.indentExclusionRanges.push(range),
19619
19630
  code, // Only needed for debugging
19620
19631
  deoptimizationTracker: this.graph.deoptimizationTracker,
19621
19632
  error: this.error.bind(this),
@@ -20910,6 +20921,9 @@ class Chunk {
20910
20921
  }
20911
20922
  }
20912
20923
  }
20924
+ else if (exportingModule instanceof ExternalModule && importedVariable.included) {
20925
+ includedReexports.push(importedVariable);
20926
+ }
20913
20927
  }
20914
20928
  }
20915
20929
  if (includedReexports.length > 0) {
@@ -21340,7 +21354,10 @@ class Chunk {
21340
21354
  if (renderedLength) {
21341
21355
  if (compact && source.lastLine().includes('//'))
21342
21356
  source.append('\n');
21343
- magicString.addSource(source);
21357
+ magicString.addSource({
21358
+ content: source,
21359
+ indentExclusionRanges: rendered.indentExclusionRanges
21360
+ });
21344
21361
  usedModules.push(module);
21345
21362
  }
21346
21363
  const namespace = module.namespace;
@@ -21643,7 +21660,7 @@ function* concatLazy(iterables) {
21643
21660
  * per dynamic entry to marks all dynamic entry dependencies as "dirty" and put
21644
21661
  * them back into the iteration. As an additional optimization, we note for
21645
21662
  * each dynamic entry which dynamic dependent entries have changed and only
21646
- * intersect those entries again on subsequent interations.
21663
+ * intersect those entries again on subsequent iterations.
21647
21664
  *
21648
21665
  * Then we remove the dynamic entries from the list of dependent entries for
21649
21666
  * those chunks that are already loaded for that dynamic entry and create
@@ -23826,7 +23843,7 @@ function normalizeEntryModules(entryModules) {
23826
23843
  }));
23827
23844
  }
23828
23845
  class Graph {
23829
- constructor(options, watcher) {
23846
+ constructor(options, registerWatchHooks) {
23830
23847
  this.options = options;
23831
23848
  this.astLru = flru(5);
23832
23849
  this.cachedModules = new Map();
@@ -23861,12 +23878,12 @@ class Graph {
23861
23878
  value[0]++;
23862
23879
  }
23863
23880
  }
23864
- if (watcher) {
23881
+ if (registerWatchHooks) {
23865
23882
  this.watchMode = true;
23866
- const handleChange = (...parameters) => this.pluginDriver.hookParallel('watchChange', parameters);
23867
- const handleClose = () => this.pluginDriver.hookParallel('closeWatcher', []);
23868
- watcher.onCurrentRun('change', handleChange);
23869
- watcher.onCurrentRun('close', handleClose);
23883
+ registerWatchHooks({
23884
+ closeWatcher: () => this.pluginDriver.hookParallel('closeWatcher', []),
23885
+ watchChange: (...parameters) => this.pluginDriver.hookParallel('watchChange', parameters)
23886
+ });
23870
23887
  }
23871
23888
  this.pluginDriver = new PluginDriver(this, options, options.plugins, this.pluginCache);
23872
23889
  this.moduleLoader = new ModuleLoader(this, this.modulesById, this.options, this.pluginDriver);
@@ -24519,11 +24536,11 @@ Symbol.asyncDispose ??= Symbol('Symbol.asyncDispose');
24519
24536
  function rollup(rawInputOptions) {
24520
24537
  return rollupInternal(rawInputOptions, null);
24521
24538
  }
24522
- async function rollupInternal(rawInputOptions, watcher) {
24523
- const { options: inputOptions, unsetOptions: unsetInputOptions } = await getInputOptions(rawInputOptions, watcher !== null);
24539
+ async function rollupInternal(rawInputOptions, registerWatchHooks) {
24540
+ const { options: inputOptions, unsetOptions: unsetInputOptions } = await getInputOptions(rawInputOptions, registerWatchHooks !== null);
24524
24541
  initialiseTimers(inputOptions);
24525
24542
  await initWasm();
24526
- const graph = new Graph(inputOptions, watcher);
24543
+ const graph = new Graph(inputOptions, registerWatchHooks);
24527
24544
  // remove the cache object from the memory after graph creation (cache is not used anymore)
24528
24545
  const useCache = rawInputOptions.cache !== false;
24529
24546
  if (rawInputOptions.cache) {
@@ -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
 
@@ -15,7 +15,7 @@ const index = require('./index.js');
15
15
  const promises = require('node:fs/promises');
16
16
  const process$2 = require('node:process');
17
17
  const cli = require('../bin/rollup');
18
- const rollup_js = require('../rollup.js');
18
+ const rollup_js = require('./node-entry.js');
19
19
  const rollup = require('./rollup.js');
20
20
  const parseAst_js = require('./parseAst.js');
21
21
  const loadConfigFile_js = require('./loadConfigFile.js');
@@ -520,13 +520,22 @@ async function watch(command) {
520
520
  }
521
521
  function close(code) {
522
522
  process$2.removeListener('uncaughtException', closeWithError);
523
- // removing a non-existent listener is a no-op
524
- process$2.stdin.removeListener('end', close);
525
523
  if (configWatcher)
526
524
  configWatcher.close();
527
- Promise.resolve(watcher?.close()).finally(() => {
528
- process$2.exit(typeof code === 'number' ? code : 0);
529
- });
525
+ Promise.resolve(watcher?.close())
526
+ .finally(() => {
527
+ // The numeric branch is only evaluated while the process is already exiting,
528
+ // after coverage tools have written their counters.
529
+ /* istanbul ignore next */
530
+ const exitCode = typeof code === 'number' ? code : 0;
531
+ process$2.exitCode = exitCode;
532
+ // Calling process.exit directly can deadlock while V8 background tasks are
533
+ // still running, see https://github.com/nodejs/node/issues/54918. Letting the
534
+ // process exit naturally avoids this, but plugins may keep handles open.
535
+ // The ".unref()" ensures this handler does not block exit
536
+ setTimeout(() => process$2.exit(exitCode), 200).unref();
537
+ })
538
+ .catch(error => rollup.handleError(error, true));
530
539
  // Tell signal-exit that we are handling this gracefully
531
540
  return true;
532
541
  }