rollup 3.16.0 → 3.17.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.
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.16.0
4
- Fri, 17 Feb 2023 13:26:29 GMT - commit 8ba73f4f643e5ffe01fc9ad846748f6d5b7963c2
3
+ Rollup.js v3.17.0
4
+ Sat, 18 Feb 2023 05:06:04 GMT - commit 0c33497a7de91e150a7d242125e8da9dd4e4a3ac
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -20,16 +20,18 @@ const require$$0 = require('assert');
20
20
  const require$$0$1 = require('events');
21
21
  const loadConfigFile_js = require('./loadConfigFile.js');
22
22
  const node_child_process = require('node:child_process');
23
+ const watchProxy = require('./watch-proxy.js');
23
24
  require('fs');
24
25
  require('util');
25
26
  require('stream');
26
27
  require('path');
27
28
  require('os');
29
+ require('./fsevents-importer.js');
28
30
  require('node:path');
31
+ require('tty');
29
32
  require('node:perf_hooks');
30
33
  require('node:crypto');
31
34
  require('node:events');
32
- require('tty');
33
35
  require('node:url');
34
36
 
35
37
  function timeZone(date = new Date()) {
@@ -449,7 +451,7 @@ async function watch(command) {
449
451
  await start(options, warnings);
450
452
  }
451
453
  async function start(configs, warnings) {
452
- watcher = rollup.watch(configs);
454
+ watcher = watchProxy.watch(configs);
453
455
  watcher.on('event', event => {
454
456
  switch (event.code) {
455
457
  case 'ERROR': {
@@ -0,0 +1,87 @@
1
+ /*
2
+ @license
3
+ Rollup.js v3.17.0
4
+ Sat, 18 Feb 2023 05:06:04 GMT - commit 0c33497a7de91e150a7d242125e8da9dd4e4a3ac
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 fseventsImporter = require('./fsevents-importer.js');
14
+
15
+ class WatchEmitter {
16
+ constructor() {
17
+ this.currentHandlers = Object.create(null);
18
+ this.persistentHandlers = Object.create(null);
19
+ }
20
+ // Will be overwritten by Rollup
21
+ async close() { }
22
+ emit(event, ...parameters) {
23
+ return Promise.all([...this.getCurrentHandlers(event), ...this.getPersistentHandlers(event)].map(handler => handler(...parameters)));
24
+ }
25
+ off(event, listener) {
26
+ const listeners = this.persistentHandlers[event];
27
+ if (listeners) {
28
+ // A hack stolen from "mitt": ">>> 0" does not change numbers >= 0, but -1
29
+ // (which would remove the last array element if used unchanged) is turned
30
+ // into max_int, which is outside the array and does not change anything.
31
+ listeners.splice(listeners.indexOf(listener) >>> 0, 1);
32
+ }
33
+ return this;
34
+ }
35
+ on(event, listener) {
36
+ this.getPersistentHandlers(event).push(listener);
37
+ return this;
38
+ }
39
+ onCurrentRun(event, listener) {
40
+ this.getCurrentHandlers(event).push(listener);
41
+ return this;
42
+ }
43
+ once(event, listener) {
44
+ const selfRemovingListener = (...parameters) => {
45
+ this.off(event, selfRemovingListener);
46
+ return listener(...parameters);
47
+ };
48
+ this.on(event, selfRemovingListener);
49
+ return this;
50
+ }
51
+ removeAllListeners() {
52
+ this.removeListenersForCurrentRun();
53
+ this.persistentHandlers = Object.create(null);
54
+ return this;
55
+ }
56
+ removeListenersForCurrentRun() {
57
+ this.currentHandlers = Object.create(null);
58
+ return this;
59
+ }
60
+ getCurrentHandlers(event) {
61
+ return this.currentHandlers[event] || (this.currentHandlers[event] = []);
62
+ }
63
+ getPersistentHandlers(event) {
64
+ return this.persistentHandlers[event] || (this.persistentHandlers[event] = []);
65
+ }
66
+ }
67
+
68
+ function watch(configs) {
69
+ const emitter = new WatchEmitter();
70
+ watchInternal(configs, emitter).catch(error => {
71
+ rollup.handleError(error);
72
+ });
73
+ return emitter;
74
+ }
75
+ async function watchInternal(configs, emitter) {
76
+ const optionsList = await Promise.all(rollup.ensureArray(configs).map(config => rollup.mergeOptions(config)));
77
+ const watchOptionsList = optionsList.filter(config => config.watch !== false);
78
+ if (watchOptionsList.length === 0) {
79
+ return rollup.error(rollup.errorInvalidOption('watch', rollup.URL_WATCH, 'there must be at least one config where "watch" is not set to "false"'));
80
+ }
81
+ await fseventsImporter.loadFsEvents();
82
+ const { Watcher } = await Promise.resolve().then(() => require('./watch.js'));
83
+ new Watcher(watchOptionsList, emitter);
84
+ }
85
+
86
+ exports.watch = watch;
87
+ //# sourceMappingURL=watch-proxy.js.map
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.16.0
4
- Fri, 17 Feb 2023 13:26:29 GMT - commit 8ba73f4f643e5ffe01fc9ad846748f6d5b7963c2
3
+ Rollup.js v3.17.0
4
+ Sat, 18 Feb 2023 05:06:04 GMT - commit 0c33497a7de91e150a7d242125e8da9dd4e4a3ac
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -16,16 +16,17 @@ const process = require('node:process');
16
16
  const rollup = require('./rollup.js');
17
17
  const node_os = require('node:os');
18
18
  const index = require('./index.js');
19
+ require('tty');
19
20
  require('path');
20
21
  require('node:perf_hooks');
21
22
  require('node:crypto');
22
23
  require('node:fs/promises');
23
24
  require('node:events');
24
- require('tty');
25
25
  require('fs');
26
26
  require('util');
27
27
  require('stream');
28
28
  require('os');
29
+ require('./fsevents-importer.js');
29
30
  require('events');
30
31
 
31
32
  class FileWatcher {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rollup",
3
- "version": "3.16.0",
3
+ "version": "3.17.0",
4
4
  "description": "Next-generation ES module bundler",
5
5
  "main": "dist/rollup.js",
6
6
  "module": "dist/es/rollup.js",
@@ -124,7 +124,7 @@
124
124
  "pretty-bytes": "^6.0.0",
125
125
  "pretty-ms": "^8.0.0",
126
126
  "requirejs": "^2.3.6",
127
- "rollup": "^3.9.1",
127
+ "rollup": "^3.16.0",
128
128
  "rollup-plugin-license": "^3.0.1",
129
129
  "rollup-plugin-string": "^3.0.0",
130
130
  "rollup-plugin-thatworks": "^1.0.4",