rollup 4.7.0 → 4.9.0

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.7.0
4
- Fri, 08 Dec 2023 07:57:30 GMT - commit 098e29ca3e0643006870f9ed94710fd3004a9043
3
+ Rollup.js v4.9.0
4
+ Wed, 13 Dec 2023 09:23:48 GMT - commit c5337ef28a71c796e768a9f0edb3d7259a93f1aa
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -12,21 +12,89 @@
12
12
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
13
13
 
14
14
  const rollup = require('./shared/rollup.js');
15
- const watchProxy = require('./shared/watch-proxy.js');
16
- require('./shared/parseAst.js');
17
- require('./native.js');
18
- require('node:path');
15
+ const parseAst_js = require('./shared/parseAst.js');
16
+ const fseventsImporter = require('./shared/fsevents-importer.js');
19
17
  require('node:process');
20
18
  require('tty');
19
+ require('node:path');
21
20
  require('path');
22
21
  require('node:perf_hooks');
22
+ require('./native.js');
23
23
  require('node:fs/promises');
24
- require('./shared/fsevents-importer.js');
25
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
+ return Promise.all([...this.getCurrentHandlers(event), ...this.getPersistentHandlers(event)].map(handler => handler(...parameters)));
34
+ }
35
+ off(event, listener) {
36
+ const listeners = this.persistentHandlers[event];
37
+ if (listeners) {
38
+ // A hack stolen from "mitt": ">>> 0" does not change numbers >= 0, but -1
39
+ // (which would remove the last array element if used unchanged) is turned
40
+ // into max_int, which is outside the array and does not change anything.
41
+ listeners.splice(listeners.indexOf(listener) >>> 0, 1);
42
+ }
43
+ return this;
44
+ }
45
+ on(event, listener) {
46
+ this.getPersistentHandlers(event).push(listener);
47
+ return this;
48
+ }
49
+ onCurrentRun(event, listener) {
50
+ this.getCurrentHandlers(event).push(listener);
51
+ return this;
52
+ }
53
+ once(event, listener) {
54
+ const selfRemovingListener = (...parameters) => {
55
+ this.off(event, selfRemovingListener);
56
+ return listener(...parameters);
57
+ };
58
+ this.on(event, selfRemovingListener);
59
+ return this;
60
+ }
61
+ removeAllListeners() {
62
+ this.removeListenersForCurrentRun();
63
+ this.persistentHandlers = Object.create(null);
64
+ return this;
65
+ }
66
+ removeListenersForCurrentRun() {
67
+ this.currentHandlers = Object.create(null);
68
+ return this;
69
+ }
70
+ getCurrentHandlers(event) {
71
+ return this.currentHandlers[event] || (this.currentHandlers[event] = []);
72
+ }
73
+ getPersistentHandlers(event) {
74
+ return this.persistentHandlers[event] || (this.persistentHandlers[event] = []);
75
+ }
76
+ }
26
77
 
78
+ function watch(configs) {
79
+ const emitter = new WatchEmitter();
80
+ watchInternal(configs, emitter).catch(error => {
81
+ rollup.handleError(error);
82
+ });
83
+ return emitter;
84
+ }
85
+ async function watchInternal(configs, emitter) {
86
+ const optionsList = await Promise.all(rollup.ensureArray(configs).map(config => rollup.mergeOptions(config, true)));
87
+ const watchOptionsList = optionsList.filter(config => config.watch !== false);
88
+ if (watchOptionsList.length === 0) {
89
+ 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"'));
90
+ }
91
+ await fseventsImporter.loadFsEvents();
92
+ const { Watcher } = await Promise.resolve().then(() => require('./shared/watch.js'));
93
+ new Watcher(watchOptionsList, emitter);
94
+ }
27
95
 
28
96
  exports.VERSION = rollup.version;
29
97
  exports.defineConfig = rollup.defineConfig;
30
98
  exports.rollup = rollup.rollup;
31
- exports.watch = watchProxy.watch;
99
+ exports.watch = watch;
32
100
  //# sourceMappingURL=rollup.js.map
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.7.0
4
- Fri, 08 Dec 2023 07:57:30 GMT - commit 098e29ca3e0643006870f9ed94710fd3004a9043
3
+ Rollup.js v4.9.0
4
+ Wed, 13 Dec 2023 09:23:48 GMT - commit c5337ef28a71c796e768a9f0edb3d7259a93f1aa
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.7.0
4
- Fri, 08 Dec 2023 07:57:30 GMT - commit 098e29ca3e0643006870f9ed94710fd3004a9043
3
+ Rollup.js v4.9.0
4
+ Wed, 13 Dec 2023 09:23:48 GMT - commit c5337ef28a71c796e768a9f0edb3d7259a93f1aa
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.7.0
4
- Fri, 08 Dec 2023 07:57:30 GMT - commit 098e29ca3e0643006870f9ed94710fd3004a9043
3
+ Rollup.js v4.9.0
4
+ Wed, 13 Dec 2023 09:23:48 GMT - commit c5337ef28a71c796e768a9f0edb3d7259a93f1aa
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.7.0
4
- Fri, 08 Dec 2023 07:57:30 GMT - commit 098e29ca3e0643006870f9ed94710fd3004a9043
3
+ Rollup.js v4.9.0
4
+ Wed, 13 Dec 2023 09:23:48 GMT - commit c5337ef28a71c796e768a9f0edb3d7259a93f1aa
5
5
 
6
6
  https://github.com/rollup/rollup
7
7