rollup 4.63.4 → 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/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.5
4
+ Thu, 24 Sep 2026 10:07:23 GMT - commit 3722484c33c58b3ab0cbbfcca09b8f267d420329
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.5
4
+ Thu, 24 Sep 2026 10:07:23 GMT - commit 3722484c33c58b3ab0cbbfcca09b8f267d420329
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.5
4
+ Thu, 24 Sep 2026 10:07:23 GMT - commit 3722484c33c58b3ab0cbbfcca09b8f267d420329
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.5
4
+ Thu, 24 Sep 2026 10:07:23 GMT - commit 3722484c33c58b3ab0cbbfcca09b8f267d420329
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -0,0 +1,147 @@
1
+ /*
2
+ @license
3
+ Rollup.js v4.63.5
4
+ Thu, 24 Sep 2026 10:07:23 GMT - commit 3722484c33c58b3ab0cbbfcca09b8f267d420329
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.5
4
+ Thu, 24 Sep 2026 10:07:23 GMT - commit 3722484c33c58b3ab0cbbfcca09b8f267d420329
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.5
4
+ Thu, 24 Sep 2026 10:07:23 GMT - commit 3722484c33c58b3ab0cbbfcca09b8f267d420329
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.5";
46
46
  const package_ = {
47
47
  version: version};
48
48
 
@@ -12845,6 +12845,8 @@ const builtinModules = [
12845
12845
  "assert/strict",
12846
12846
  "node:async_hooks",
12847
12847
  "async_hooks",
12848
+ "node:bench",
12849
+ "node:bench/reporters",
12848
12850
  "node:buffer",
12849
12851
  "buffer",
12850
12852
  "node:child_process",
@@ -21643,7 +21645,7 @@ function* concatLazy(iterables) {
21643
21645
  * per dynamic entry to marks all dynamic entry dependencies as "dirty" and put
21644
21646
  * them back into the iteration. As an additional optimization, we note for
21645
21647
  * each dynamic entry which dynamic dependent entries have changed and only
21646
- * intersect those entries again on subsequent interations.
21648
+ * intersect those entries again on subsequent iterations.
21647
21649
  *
21648
21650
  * Then we remove the dynamic entries from the list of dependent entries for
21649
21651
  * those chunks that are already loaded for that dynamic entry and create
@@ -23826,7 +23828,7 @@ function normalizeEntryModules(entryModules) {
23826
23828
  }));
23827
23829
  }
23828
23830
  class Graph {
23829
- constructor(options, watcher) {
23831
+ constructor(options, registerWatchHooks) {
23830
23832
  this.options = options;
23831
23833
  this.astLru = flru(5);
23832
23834
  this.cachedModules = new Map();
@@ -23861,12 +23863,12 @@ class Graph {
23861
23863
  value[0]++;
23862
23864
  }
23863
23865
  }
23864
- if (watcher) {
23866
+ if (registerWatchHooks) {
23865
23867
  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);
23868
+ registerWatchHooks({
23869
+ closeWatcher: () => this.pluginDriver.hookParallel('closeWatcher', []),
23870
+ watchChange: (...parameters) => this.pluginDriver.hookParallel('watchChange', parameters)
23871
+ });
23870
23872
  }
23871
23873
  this.pluginDriver = new PluginDriver(this, options, options.plugins, this.pluginCache);
23872
23874
  this.moduleLoader = new ModuleLoader(this, this.modulesById, this.options, this.pluginDriver);
@@ -24519,11 +24521,11 @@ Symbol.asyncDispose ??= Symbol('Symbol.asyncDispose');
24519
24521
  function rollup(rawInputOptions) {
24520
24522
  return rollupInternal(rawInputOptions, null);
24521
24523
  }
24522
- async function rollupInternal(rawInputOptions, watcher) {
24523
- const { options: inputOptions, unsetOptions: unsetInputOptions } = await getInputOptions(rawInputOptions, watcher !== null);
24524
+ async function rollupInternal(rawInputOptions, registerWatchHooks) {
24525
+ const { options: inputOptions, unsetOptions: unsetInputOptions } = await getInputOptions(rawInputOptions, registerWatchHooks !== null);
24524
24526
  initialiseTimers(inputOptions);
24525
24527
  await initWasm();
24526
- const graph = new Graph(inputOptions, watcher);
24528
+ const graph = new Graph(inputOptions, registerWatchHooks);
24527
24529
  // remove the cache object from the memory after graph creation (cache is not used anymore)
24528
24530
  const useCache = rawInputOptions.cache !== false;
24529
24531
  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.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('../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
  }