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.
@@ -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
 
@@ -16,6 +16,7 @@ const path = require('node:path');
16
16
  const process = require('node:process');
17
17
  const index = require('./index.js');
18
18
  const node_os = require('node:os');
19
+ const rollup_js = require('./node-entry.js');
19
20
  require('./parseAst.js');
20
21
  require('../native.js');
21
22
  require('path');
@@ -103,11 +104,12 @@ const eventsRewrites = {
103
104
  };
104
105
  class Watcher {
105
106
  constructor(optionsList, emitter) {
107
+ this.closed = false;
106
108
  this.buildDelay = 0;
107
109
  this.buildTimeout = null;
108
- this.closed = false;
109
110
  this.invalidatedIds = new Map();
110
111
  this.rerun = false;
112
+ // Starts held so that invalidations before the initial run only request a rerun.
111
113
  this.running = true;
112
114
  this.emitter = emitter;
113
115
  emitter.close = this.close.bind(this);
@@ -117,7 +119,7 @@ class Watcher {
117
119
  this.buildDelay = Math.max(this.buildDelay, watch.buildDelay);
118
120
  }
119
121
  }
120
- process.nextTick(() => this.run().catch(error => this.reportError(error)));
122
+ process.nextTick(() => this.runExclusively(() => this.run()));
121
123
  }
122
124
  async close() {
123
125
  if (this.closed)
@@ -125,13 +127,19 @@ class Watcher {
125
127
  this.closed = true;
126
128
  if (this.buildTimeout)
127
129
  clearTimeout(this.buildTimeout);
128
- for (const task of this.tasks) {
129
- task.close();
130
+ try {
131
+ await rollup_js.waitForAllAndRethrowFirstFailure([
132
+ ...this.tasks.map(task => task.close()),
133
+ this.emitter.emit('close')
134
+ ]);
135
+ }
136
+ finally {
137
+ this.emitter.removeAllListeners();
130
138
  }
131
- await this.emitter.emit('close');
132
- this.emitter.removeAllListeners();
133
139
  }
134
140
  invalidate(file) {
141
+ if (this.closed)
142
+ return;
135
143
  if (file) {
136
144
  const previousEvent = this.invalidatedIds.get(file.id);
137
145
  const event = previousEvent ? eventsRewrites[previousEvent][file.event] : file.event;
@@ -152,22 +160,64 @@ class Watcher {
152
160
  }
153
161
  if (this.buildTimeout)
154
162
  clearTimeout(this.buildTimeout);
155
- this.buildTimeout = setTimeout(async () => {
163
+ this.buildTimeout = setTimeout(() => {
156
164
  this.buildTimeout = null;
157
- try {
158
- await Promise.all([...this.invalidatedIds].map(([id, event]) => this.emitter.emit('change', id, { event })));
159
- this.invalidatedIds.clear();
160
- await this.emitter.emit('restart');
161
- this.emitter.removeListenersForCurrentRun();
162
- await this.run();
163
- }
164
- catch (error) {
165
- await this.reportError(error);
166
- }
165
+ this.runExclusively(() => this.announceChangesAndRebuild());
167
166
  }, this.buildDelay);
168
167
  }
169
- async reportError(error) {
168
+ // The running flag spans the whole cycle, including async listeners, so
169
+ // that invalidations meanwhile only request a rerun.
170
+ async runExclusively(cycle) {
171
+ this.running = true;
172
+ try {
173
+ await cycle();
174
+ }
175
+ catch (error) {
176
+ await this.reportError(error);
177
+ }
178
+ finally {
179
+ this.running = false;
180
+ }
181
+ if (this.rerun) {
182
+ this.rerun = false;
183
+ this.invalidate();
184
+ }
185
+ }
186
+ async announceChangesAndRebuild() {
187
+ await this.announcePendingChanges();
188
+ if (this.closed || !this.hasInvalidatedTask())
189
+ return;
190
+ await this.emitter.emit('restart');
191
+ await this.announcePendingChanges();
192
+ if (this.closed)
193
+ return;
194
+ this.emitter.removeListenersForCurrentRun();
195
+ await this.run();
196
+ }
197
+ // The upcoming run consumes announced changes via the task flags, making
198
+ // their rerun requests obsolete. The reset must directly follow the last
199
+ // emptiness check so that no change slips through unannounced.
200
+ async announcePendingChanges() {
201
+ while (this.invalidatedIds.size > 0 && !this.closed) {
202
+ await this.announceChangeBatch();
203
+ }
204
+ this.rerun = false;
205
+ }
206
+ // Cleared before emitting so that changes arriving during slow hooks,
207
+ // including follow-ups of the same file, form the next batch instead of
208
+ // being dropped with this one.
209
+ async announceChangeBatch() {
210
+ const changes = [...this.invalidatedIds];
170
211
  this.invalidatedIds.clear();
212
+ await rollup_js.waitForAllAndRethrowFirstFailure(changes.flatMap(([id, event]) => [
213
+ ...this.tasks.map(task => task.announceChange(id, event)),
214
+ this.emitter.emit('change', id, { event })
215
+ ]));
216
+ }
217
+ hasInvalidatedTask() {
218
+ return this.tasks.some(task => task.isInvalidated());
219
+ }
220
+ async reportError(error) {
171
221
  await this.emitter.emit('event', {
172
222
  code: 'ERROR',
173
223
  error,
@@ -178,37 +228,26 @@ class Watcher {
178
228
  });
179
229
  }
180
230
  async run() {
181
- this.running = true;
182
- // Drop a rerun request left over from a failed run: honoring it after this run
183
- // would start an empty run that removes the plugin event listeners of this run.
184
- this.rerun = false;
185
- try {
186
- await this.emitter.emit('event', {
187
- code: 'START'
188
- });
189
- for (const task of this.tasks) {
190
- await task.run();
191
- }
192
- }
193
- finally {
194
- this.running = false;
231
+ await this.emitter.emit('event', {
232
+ code: 'START'
233
+ });
234
+ for (const task of this.tasks) {
235
+ await task.run();
195
236
  }
237
+ if (this.closed)
238
+ return;
196
239
  await this.emitter.emit('event', {
197
240
  code: 'END'
198
241
  });
199
- if (this.rerun) {
200
- this.rerun = false;
201
- this.invalidate();
202
- }
203
242
  }
204
243
  }
205
244
  class Task {
206
245
  constructor(watcher, options) {
207
246
  this.cache = { modules: [] };
208
247
  this.watchFiles = [];
209
- this.closed = false;
210
248
  this.invalidated = true;
211
249
  this.watched = new Set();
250
+ this.watchHooks = null;
212
251
  this.watcher = watcher;
213
252
  this.options = options;
214
253
  this.skipWrite = Boolean(options.watch && options.watch.skipWrite);
@@ -226,9 +265,14 @@ class Task {
226
265
  ignoreInitial: true
227
266
  });
228
267
  }
229
- close() {
230
- this.closed = true;
268
+ async announceChange(id, event) {
269
+ await this.watchHooks?.watchChange(id, { event });
270
+ }
271
+ async close() {
231
272
  this.fileWatcher.close();
273
+ const watchHooks = this.watchHooks;
274
+ this.watchHooks = null;
275
+ await watchHooks?.closeWatcher();
232
276
  }
233
277
  invalidate(id, details) {
234
278
  this.invalidated = true;
@@ -243,8 +287,11 @@ class Task {
243
287
  this.watcher.invalidate({ event: details.event, id });
244
288
  this.watchOptions.onInvalidate?.(id);
245
289
  }
290
+ isInvalidated() {
291
+ return this.invalidated;
292
+ }
246
293
  async run() {
247
- if (!this.invalidated)
294
+ if (!this.invalidated || this.watcher.closed)
248
295
  return;
249
296
  this.invalidated = false;
250
297
  const options = {
@@ -257,16 +304,22 @@ class Task {
257
304
  input: this.options.input,
258
305
  output: this.outputFiles
259
306
  });
307
+ if (this.watcher.closed) {
308
+ return;
309
+ }
260
310
  let result = null;
261
311
  try {
262
- result = await rollup.rollupInternal(options, this.watcher.emitter);
263
- if (this.closed) {
312
+ result = await rollup.rollupInternal(options, watchHooks => {
313
+ if (!this.watcher.closed)
314
+ this.watchHooks = watchHooks;
315
+ });
316
+ if (this.watcher.closed) {
264
317
  return;
265
318
  }
266
319
  this.updateWatchedFiles(result);
267
320
  if (!this.skipWrite) {
268
321
  await Promise.all(this.outputs.map(output => result.write(output)));
269
- if (this.closed) {
322
+ if (this.watcher.closed) {
270
323
  return;
271
324
  }
272
325
  this.updateWatchedFiles(result);
@@ -280,7 +333,7 @@ class Task {
280
333
  });
281
334
  }
282
335
  catch (error) {
283
- if (!this.closed) {
336
+ if (!this.watcher.closed) {
284
337
  if (Array.isArray(error.watchFiles)) {
285
338
  for (const id of error.watchFiles) {
286
339
  this.watchFile(id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rollup",
3
- "version": "4.63.4",
3
+ "version": "4.63.6",
4
4
  "description": "Next-generation ES module bundler",
5
5
  "main": "dist/rollup.js",
6
6
  "module": "dist/es/rollup.js",
@@ -117,31 +117,31 @@
117
117
  "optionalDependencies": {
118
118
  "@napi-rs/lzma-linux-x64-gnu": "1.5.1",
119
119
  "fsevents": "~2.3.2",
120
- "@rollup/rollup-darwin-arm64": "4.63.4",
121
- "@rollup/rollup-android-arm64": "4.63.4",
122
- "@rollup/rollup-win32-arm64-msvc": "4.63.4",
123
- "@rollup/rollup-freebsd-arm64": "4.63.4",
124
- "@rollup/rollup-linux-arm64-gnu": "4.63.4",
125
- "@rollup/rollup-linux-arm64-musl": "4.63.4",
126
- "@rollup/rollup-android-arm-eabi": "4.63.4",
127
- "@rollup/rollup-linux-arm-gnueabihf": "4.63.4",
128
- "@rollup/rollup-linux-arm-musleabihf": "4.63.4",
129
- "@rollup/rollup-win32-ia32-msvc": "4.63.4",
130
- "@rollup/rollup-linux-loong64-gnu": "4.63.4",
131
- "@rollup/rollup-linux-loong64-musl": "4.63.4",
132
- "@rollup/rollup-linux-riscv64-gnu": "4.63.4",
133
- "@rollup/rollup-linux-riscv64-musl": "4.63.4",
134
- "@rollup/rollup-linux-ppc64-gnu": "4.63.4",
135
- "@rollup/rollup-linux-ppc64-musl": "4.63.4",
136
- "@rollup/rollup-linux-s390x-gnu": "4.63.4",
137
- "@rollup/rollup-darwin-x64": "4.63.4",
138
- "@rollup/rollup-win32-x64-gnu": "4.63.4",
139
- "@rollup/rollup-win32-x64-msvc": "4.63.4",
140
- "@rollup/rollup-freebsd-x64": "4.63.4",
141
- "@rollup/rollup-linux-x64-gnu": "4.63.4",
142
- "@rollup/rollup-linux-x64-musl": "4.63.4",
143
- "@rollup/rollup-openbsd-x64": "4.63.4",
144
- "@rollup/rollup-openharmony-arm64": "4.63.4"
120
+ "@rollup/rollup-darwin-arm64": "4.63.6",
121
+ "@rollup/rollup-android-arm64": "4.63.6",
122
+ "@rollup/rollup-win32-arm64-msvc": "4.63.6",
123
+ "@rollup/rollup-freebsd-arm64": "4.63.6",
124
+ "@rollup/rollup-linux-arm64-gnu": "4.63.6",
125
+ "@rollup/rollup-linux-arm64-musl": "4.63.6",
126
+ "@rollup/rollup-android-arm-eabi": "4.63.6",
127
+ "@rollup/rollup-linux-arm-gnueabihf": "4.63.6",
128
+ "@rollup/rollup-linux-arm-musleabihf": "4.63.6",
129
+ "@rollup/rollup-win32-ia32-msvc": "4.63.6",
130
+ "@rollup/rollup-linux-loong64-gnu": "4.63.6",
131
+ "@rollup/rollup-linux-loong64-musl": "4.63.6",
132
+ "@rollup/rollup-linux-riscv64-gnu": "4.63.6",
133
+ "@rollup/rollup-linux-riscv64-musl": "4.63.6",
134
+ "@rollup/rollup-linux-ppc64-gnu": "4.63.6",
135
+ "@rollup/rollup-linux-ppc64-musl": "4.63.6",
136
+ "@rollup/rollup-linux-s390x-gnu": "4.63.6",
137
+ "@rollup/rollup-darwin-x64": "4.63.6",
138
+ "@rollup/rollup-win32-x64-gnu": "4.63.6",
139
+ "@rollup/rollup-win32-x64-msvc": "4.63.6",
140
+ "@rollup/rollup-freebsd-x64": "4.63.6",
141
+ "@rollup/rollup-linux-x64-gnu": "4.63.6",
142
+ "@rollup/rollup-linux-x64-musl": "4.63.6",
143
+ "@rollup/rollup-openbsd-x64": "4.63.6",
144
+ "@rollup/rollup-openharmony-arm64": "4.63.6"
145
145
  },
146
146
  "dependencies": {
147
147
  "@types/estree": "1.0.9"
@@ -150,12 +150,12 @@
150
150
  "core-js": "We only update manually as every update requires a snapshot update"
151
151
  },
152
152
  "devDependencies": {
153
- "@codemirror/commands": "^6.11.0",
153
+ "@codemirror/commands": "^6.11.1",
154
154
  "@codemirror/lang-javascript": "^6.2.5",
155
155
  "@codemirror/language": "^6.12.4",
156
156
  "@codemirror/search": "^6.7.2",
157
- "@codemirror/state": "^6.7.4",
158
- "@codemirror/view": "^6.43.11",
157
+ "@codemirror/state": "^6.7.5",
158
+ "@codemirror/view": "^6.43.12",
159
159
  "@emnapi/core": "^1.11.3",
160
160
  "@emnapi/runtime": "^1.11.3",
161
161
  "@eslint/js": "^10.0.1",
@@ -184,17 +184,17 @@
184
184
  "acorn-import-phases": "^1.0.4",
185
185
  "acorn-jsx": "^5.3.2",
186
186
  "buble": "^0.20.0",
187
- "builtin-modules": "^5.3.0",
187
+ "builtin-modules": "^5.4.0",
188
188
  "chokidar": "^3.6.0",
189
189
  "concurrently": "^9.2.4",
190
190
  "core-js": "3.38.1",
191
191
  "date-time": "^4.0.0",
192
192
  "es5-shim": "^4.6.7",
193
193
  "es6-shim": "^0.35.8",
194
- "eslint": "^10.10.0",
194
+ "eslint": "^10.11.0",
195
195
  "eslint-config-prettier": "^10.1.8",
196
196
  "eslint-plugin-prettier": "^5.5.6",
197
- "eslint-plugin-unicorn": "^74.0.0",
197
+ "eslint-plugin-unicorn": "^76.0.0",
198
198
  "eslint-plugin-vue": "^10.11.0",
199
199
  "fixturify": "^3.0.0",
200
200
  "flru": "^1.0.2",
@@ -206,7 +206,7 @@
206
206
  "lint-staged": "^17.5.1",
207
207
  "locate-character": "^3.0.0",
208
208
  "magic-string": "^1.4.1",
209
- "memfs": "^4.78.0",
209
+ "memfs": "^4.78.1",
210
210
  "mocha": "^11.8.0",
211
211
  "nodemon": "^3.1.14",
212
212
  "npm-audit-resolver": "^3.0.0-RC.0",
@@ -215,12 +215,12 @@
215
215
  "picocolors": "^1.1.1",
216
216
  "picomatch": "^4.0.7",
217
217
  "pinia": "^4.0.3",
218
- "prettier": "^3.9.6",
218
+ "prettier": "^3.9.8",
219
219
  "prettier-plugin-organize-imports": "^4.3.0",
220
220
  "pretty-bytes": "^7.1.3",
221
221
  "pretty-ms": "^9.3.1",
222
222
  "requirejs": "^2.3.8",
223
- "rollup": "^4.63.3",
223
+ "rollup": "^4.63.4",
224
224
  "rollup-plugin-license": "^3.7.1",
225
225
  "semver": "^7.8.5",
226
226
  "shx": "^0.4.0",
@@ -231,10 +231,10 @@
231
231
  "terser": "^5.51.2",
232
232
  "tslib": "^2.8.1",
233
233
  "typescript": "^5.9.3",
234
- "typescript-eslint": "^8.70.0",
234
+ "typescript-eslint": "^8.70.1",
235
235
  "vite": "^7.3.6",
236
236
  "vitepress": "^1.6.4",
237
- "vue": "^3.5.42",
237
+ "vue": "^3.5.43",
238
238
  "vue-eslint-parser": "^10.4.1",
239
239
  "vue-tsc": "^3.3.11",
240
240
  "wasm-pack": "^0.15.0",