rollup 4.63.3 → 4.63.5
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 +3 -3
- package/dist/es/getLogFilter.js +2 -2
- package/dist/es/parseAst.js +2 -2
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/node-entry.js +394 -95
- package/dist/es/shared/parseAst.js +2 -2
- package/dist/es/shared/watch.js +99 -47
- package/dist/getLogFilter.js +2 -2
- package/dist/loadConfigFile.js +2 -2
- package/dist/native.js +10 -1
- package/dist/parseAst.js +2 -2
- package/dist/rollup.d.ts +5 -7
- package/dist/rollup.js +9 -107
- package/dist/shared/fsevents-importer.js +2 -2
- package/dist/shared/index.js +2 -2
- package/dist/shared/loadConfigFile.js +2 -2
- package/dist/shared/node-entry.js +147 -0
- package/dist/shared/parseAst.js +2 -2
- package/dist/shared/rollup.js +363 -91
- package/dist/shared/watch-cli.js +17 -8
- package/dist/shared/watch.js +99 -46
- package/package.json +32 -30
package/dist/shared/watch-cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v4.63.
|
|
4
|
-
|
|
3
|
+
Rollup.js v4.63.5
|
|
4
|
+
Thu, 24 Sep 2026 10:07:23 GMT - commit 3722484c33c58b3ab0cbbfcca09b8f267d420329
|
|
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('
|
|
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())
|
|
528
|
-
|
|
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
|
}
|
package/dist/shared/watch.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v4.63.
|
|
4
|
-
|
|
3
|
+
Rollup.js v4.63.5
|
|
4
|
+
Thu, 24 Sep 2026 10:07:23 GMT - commit 3722484c33c58b3ab0cbbfcca09b8f267d420329
|
|
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.
|
|
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
|
-
|
|
129
|
-
|
|
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(
|
|
163
|
+
this.buildTimeout = setTimeout(() => {
|
|
156
164
|
this.buildTimeout = null;
|
|
157
|
-
|
|
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
|
|
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.
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
this.
|
|
185
|
-
|
|
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
|
-
|
|
230
|
-
this.
|
|
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,
|
|
263
|
-
|
|
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.
|
|
3
|
+
"version": "4.63.5",
|
|
4
4
|
"description": "Next-generation ES module bundler",
|
|
5
5
|
"main": "dist/rollup.js",
|
|
6
6
|
"module": "dist/es/rollup.js",
|
|
@@ -62,6 +62,8 @@
|
|
|
62
62
|
"ci:lint": "concurrently -c red,yellow,green,blue 'npm:lint:js:nofix' 'npm:lint:native-js' 'npm:lint:markdown:nofix' 'npm:lint:rust:nofix'",
|
|
63
63
|
"ci:test:all": "concurrently --kill-others-on-fail -c green,blue,magenta,cyan 'npm:test:only' 'npm:test:typescript' 'npm:test:leak' 'npm:test:browser'",
|
|
64
64
|
"ci:coverage": "NODE_OPTIONS=--no-experimental-require-module nyc --reporter lcovonly mocha",
|
|
65
|
+
"build:napi:coverage": "bash -c 'coverage_env=\"$(cd rust && cargo llvm-cov show-env --sh)\" && eval \"$coverage_env\" && (cd rust && cargo llvm-cov clean --workspace) && npm run build:napi'",
|
|
66
|
+
"test:coverage:rust": "bash scripts/coverage-rust.sh",
|
|
65
67
|
"lint": "concurrently -c red,yellow,green,blue 'npm:lint:js' 'npm:lint:native-js' 'npm:lint:markdown' 'npm:lint:rust'",
|
|
66
68
|
"lint:js": "eslint . --fix --cache --concurrency auto",
|
|
67
69
|
"lint:js:nofix": "eslint . --cache --concurrency auto",
|
|
@@ -115,31 +117,31 @@
|
|
|
115
117
|
"optionalDependencies": {
|
|
116
118
|
"@napi-rs/lzma-linux-x64-gnu": "1.5.1",
|
|
117
119
|
"fsevents": "~2.3.2",
|
|
118
|
-
"@rollup/rollup-darwin-arm64": "4.63.
|
|
119
|
-
"@rollup/rollup-android-arm64": "4.63.
|
|
120
|
-
"@rollup/rollup-win32-arm64-msvc": "4.63.
|
|
121
|
-
"@rollup/rollup-freebsd-arm64": "4.63.
|
|
122
|
-
"@rollup/rollup-linux-arm64-gnu": "4.63.
|
|
123
|
-
"@rollup/rollup-linux-arm64-musl": "4.63.
|
|
124
|
-
"@rollup/rollup-android-arm-eabi": "4.63.
|
|
125
|
-
"@rollup/rollup-linux-arm-gnueabihf": "4.63.
|
|
126
|
-
"@rollup/rollup-linux-arm-musleabihf": "4.63.
|
|
127
|
-
"@rollup/rollup-win32-ia32-msvc": "4.63.
|
|
128
|
-
"@rollup/rollup-linux-loong64-gnu": "4.63.
|
|
129
|
-
"@rollup/rollup-linux-loong64-musl": "4.63.
|
|
130
|
-
"@rollup/rollup-linux-riscv64-gnu": "4.63.
|
|
131
|
-
"@rollup/rollup-linux-riscv64-musl": "4.63.
|
|
132
|
-
"@rollup/rollup-linux-ppc64-gnu": "4.63.
|
|
133
|
-
"@rollup/rollup-linux-ppc64-musl": "4.63.
|
|
134
|
-
"@rollup/rollup-linux-s390x-gnu": "4.63.
|
|
135
|
-
"@rollup/rollup-darwin-x64": "4.63.
|
|
136
|
-
"@rollup/rollup-win32-x64-gnu": "4.63.
|
|
137
|
-
"@rollup/rollup-win32-x64-msvc": "4.63.
|
|
138
|
-
"@rollup/rollup-freebsd-x64": "4.63.
|
|
139
|
-
"@rollup/rollup-linux-x64-gnu": "4.63.
|
|
140
|
-
"@rollup/rollup-linux-x64-musl": "4.63.
|
|
141
|
-
"@rollup/rollup-openbsd-x64": "4.63.
|
|
142
|
-
"@rollup/rollup-openharmony-arm64": "4.63.
|
|
120
|
+
"@rollup/rollup-darwin-arm64": "4.63.5",
|
|
121
|
+
"@rollup/rollup-android-arm64": "4.63.5",
|
|
122
|
+
"@rollup/rollup-win32-arm64-msvc": "4.63.5",
|
|
123
|
+
"@rollup/rollup-freebsd-arm64": "4.63.5",
|
|
124
|
+
"@rollup/rollup-linux-arm64-gnu": "4.63.5",
|
|
125
|
+
"@rollup/rollup-linux-arm64-musl": "4.63.5",
|
|
126
|
+
"@rollup/rollup-android-arm-eabi": "4.63.5",
|
|
127
|
+
"@rollup/rollup-linux-arm-gnueabihf": "4.63.5",
|
|
128
|
+
"@rollup/rollup-linux-arm-musleabihf": "4.63.5",
|
|
129
|
+
"@rollup/rollup-win32-ia32-msvc": "4.63.5",
|
|
130
|
+
"@rollup/rollup-linux-loong64-gnu": "4.63.5",
|
|
131
|
+
"@rollup/rollup-linux-loong64-musl": "4.63.5",
|
|
132
|
+
"@rollup/rollup-linux-riscv64-gnu": "4.63.5",
|
|
133
|
+
"@rollup/rollup-linux-riscv64-musl": "4.63.5",
|
|
134
|
+
"@rollup/rollup-linux-ppc64-gnu": "4.63.5",
|
|
135
|
+
"@rollup/rollup-linux-ppc64-musl": "4.63.5",
|
|
136
|
+
"@rollup/rollup-linux-s390x-gnu": "4.63.5",
|
|
137
|
+
"@rollup/rollup-darwin-x64": "4.63.5",
|
|
138
|
+
"@rollup/rollup-win32-x64-gnu": "4.63.5",
|
|
139
|
+
"@rollup/rollup-win32-x64-msvc": "4.63.5",
|
|
140
|
+
"@rollup/rollup-freebsd-x64": "4.63.5",
|
|
141
|
+
"@rollup/rollup-linux-x64-gnu": "4.63.5",
|
|
142
|
+
"@rollup/rollup-linux-x64-musl": "4.63.5",
|
|
143
|
+
"@rollup/rollup-openbsd-x64": "4.63.5",
|
|
144
|
+
"@rollup/rollup-openharmony-arm64": "4.63.5"
|
|
143
145
|
},
|
|
144
146
|
"dependencies": {
|
|
145
147
|
"@types/estree": "1.0.9"
|
|
@@ -201,10 +203,10 @@
|
|
|
201
203
|
"globals": "^17.12.0",
|
|
202
204
|
"husky": "^9.1.7",
|
|
203
205
|
"is-reference": "^3.0.3",
|
|
204
|
-
"lint-staged": "^17.5.
|
|
206
|
+
"lint-staged": "^17.5.1",
|
|
205
207
|
"locate-character": "^3.0.0",
|
|
206
|
-
"magic-string": "^1.
|
|
207
|
-
"memfs": "^4.
|
|
208
|
+
"magic-string": "^1.4.1",
|
|
209
|
+
"memfs": "^4.78.0",
|
|
208
210
|
"mocha": "^11.8.0",
|
|
209
211
|
"nodemon": "^3.1.14",
|
|
210
212
|
"npm-audit-resolver": "^3.0.0-RC.0",
|
|
@@ -218,7 +220,7 @@
|
|
|
218
220
|
"pretty-bytes": "^7.1.3",
|
|
219
221
|
"pretty-ms": "^9.3.1",
|
|
220
222
|
"requirejs": "^2.3.8",
|
|
221
|
-
"rollup": "^4.63.
|
|
223
|
+
"rollup": "^4.63.3",
|
|
222
224
|
"rollup-plugin-license": "^3.7.1",
|
|
223
225
|
"semver": "^7.8.5",
|
|
224
226
|
"shx": "^0.4.0",
|