source: imaps-frontend/node_modules/rollup/dist/rollup.js

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 3.4 KB
Line 
1/*
2 @license
3 Rollup.js v4.20.0
4 Sat, 03 Aug 2024 04:48:21 GMT - commit df12edfea6e9c1a71bda1a01bed1ab787b7514d5
5
6 https://github.com/rollup/rollup
7
8 Released under the MIT License.
9*/
10'use strict';
11
12Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
13
14const rollup = require('./shared/rollup.js');
15const parseAst_js = require('./shared/parseAst.js');
16const fseventsImporter = require('./shared/fsevents-importer.js');
17require('node:process');
18require('tty');
19require('node:path');
20require('path');
21require('./native.js');
22require('node:perf_hooks');
23require('node:fs/promises');
24
25class 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}
77
78function watch(configs) {
79 const emitter = new WatchEmitter();
80 watchInternal(configs, emitter).catch(error => {
81 rollup.handleError(error);
82 });
83 return emitter;
84}
85async 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}
95
96exports.VERSION = rollup.version;
97exports.defineConfig = rollup.defineConfig;
98exports.rollup = rollup.rollup;
99exports.watch = watch;
100//# sourceMappingURL=rollup.js.map
Note: See TracBrowser for help on using the repository browser.