@rolldown/browser 1.0.0-beta.49 → 1.0.0-beta.51
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/cli.mjs +12 -8
- package/dist/config.d.mts +3 -3
- package/dist/config.mjs +9 -5
- package/dist/constructors-DoUEJY6G.js +65 -0
- package/dist/experimental-index.browser.mjs +17 -11
- package/dist/experimental-index.d.mts +52 -15
- package/dist/experimental-index.mjs +21 -13
- package/dist/filter-index.d.mts +3 -3
- package/dist/filter-index.mjs +2 -1
- package/dist/index.browser.mjs +161 -2
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +36 -4
- package/dist/normalize-string-or-regex-BXFT9GiS.js +830 -0
- package/dist/parallel-plugin-worker.mjs +5 -4
- package/dist/parallel-plugin.d.mts +3 -3
- package/dist/parse-ast-index.d.mts +1 -1
- package/dist/parse-ast-index.mjs +1 -1
- package/dist/plugins-index.browser.mjs +2 -2
- package/dist/plugins-index.d.mts +3 -3
- package/dist/plugins-index.mjs +3 -2
- package/dist/rolldown-binding.wasi-browser.js +5 -2
- package/dist/rolldown-binding.wasi.cjs +5 -2
- package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
- package/dist/{src-CnMyHYgB.js → rolldown-build-C0UB1WZy.js} +32 -756
- package/dist/shared/{binding-B4uTNiw2.d.mts → binding-lSvYApx7.d.mts} +198 -89
- package/dist/shared/bindingify-input-options-CSdAtTcQ.mjs +1568 -0
- package/dist/shared/{composable-filters-CBpK2Fbc.mjs → composable-filters-DZ5ToxRJ.mjs} +1 -22
- package/dist/shared/constructors-DF6M1PTb.mjs +65 -0
- package/dist/shared/constructors-DgFF472b.d.mts +31 -0
- package/dist/shared/{define-config-BAQ9c-hh.d.mts → define-config-BKu-xa_0.d.mts} +10 -49
- package/dist/shared/define-config-DfeZGBEt.mjs +7 -0
- package/dist/shared/{load-config-DQI-2sfE.mjs → load-config-Beo_LOwd.mjs} +1 -1
- package/dist/shared/misc-5GYLGQ20.mjs +22 -0
- package/dist/shared/normalize-string-or-regex-DvECZN2V.mjs +629 -0
- package/dist/shared/{parse-ast-index-D9jH_38U.mjs → parse-ast-index-C_M-Y4oC.mjs} +3 -3
- package/dist/shared/{prompt-Ckjl2FdJ.mjs → prompt-pmGBC3ws.mjs} +1 -1
- package/dist/shared/rolldown-BhV7L6Kg.mjs +10 -0
- package/dist/shared/rolldown-build-DYR94CyF.mjs +2121 -0
- package/dist/shared/utils-BJWI2OzT.d.mts +62 -0
- package/dist/shared/watch-Cjxo-3u4.mjs +338 -0
- package/package.json +1 -1
- package/dist/constructors-EhfoQfqh.js +0 -68
- package/dist/normalize-string-or-regex-d47jXr3r.js +0 -231
- package/dist/shared/constructors-CaN9lKj2.d.mts +0 -32
- package/dist/shared/constructors-DcEzB0nc.mjs +0 -68
- package/dist/shared/normalize-string-or-regex-CbDij6KB.mjs +0 -46
- package/dist/shared/src-CZ_U2fML.mjs +0 -4597
- package/dist/shared/utils-CduIqa7h.d.mts +0 -18
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { t as BindingBuiltinPluginName } from "./binding-lSvYApx7.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/log/logging.d.ts
|
|
4
|
+
type LogLevel = "info" | "debug" | "warn";
|
|
5
|
+
type LogLevelOption = LogLevel | "silent";
|
|
6
|
+
type LogLevelWithError = LogLevel | "error";
|
|
7
|
+
interface RollupLog {
|
|
8
|
+
binding?: string;
|
|
9
|
+
cause?: unknown;
|
|
10
|
+
code?: string;
|
|
11
|
+
exporter?: string;
|
|
12
|
+
frame?: string;
|
|
13
|
+
hook?: string;
|
|
14
|
+
id?: string;
|
|
15
|
+
ids?: string[];
|
|
16
|
+
loc?: {
|
|
17
|
+
column: number;
|
|
18
|
+
file?: string;
|
|
19
|
+
line: number;
|
|
20
|
+
};
|
|
21
|
+
message: string;
|
|
22
|
+
meta?: any;
|
|
23
|
+
names?: string[];
|
|
24
|
+
plugin?: string;
|
|
25
|
+
pluginCode?: unknown;
|
|
26
|
+
pos?: number;
|
|
27
|
+
reexporter?: string;
|
|
28
|
+
stack?: string;
|
|
29
|
+
url?: string;
|
|
30
|
+
}
|
|
31
|
+
type RollupLogWithString = RollupLog | string;
|
|
32
|
+
interface RollupError extends RollupLog {
|
|
33
|
+
name?: string;
|
|
34
|
+
stack?: string;
|
|
35
|
+
watchFiles?: string[];
|
|
36
|
+
}
|
|
37
|
+
type LogOrStringHandler = (level: LogLevelWithError, log: RollupLogWithString) => void;
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region src/types/utils.d.ts
|
|
40
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
41
|
+
type NullValue<T = void> = T | undefined | null | void;
|
|
42
|
+
type PartialNull<T> = { [P in keyof T]: T[P] | null };
|
|
43
|
+
type MakeAsync<Function_> = Function_ extends ((this: infer This, ...parameters: infer Arguments) => infer Return) ? (this: This, ...parameters: Arguments) => Return | Promise<Return> : never;
|
|
44
|
+
type MaybeArray<T> = T | T[];
|
|
45
|
+
type StringOrRegExp = string | RegExp;
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region src/log/log-handler.d.ts
|
|
48
|
+
type LoggingFunction = (log: RollupLog | string | (() => RollupLog | string)) => void;
|
|
49
|
+
type LoggingFunctionWithPosition = (log: RollupLog | string | (() => RollupLog | string), pos?: number | {
|
|
50
|
+
column: number;
|
|
51
|
+
line: number;
|
|
52
|
+
}) => void;
|
|
53
|
+
type WarningHandlerWithDefault = (warning: RollupLog, defaultHandler: LoggingFunction) => void;
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/builtin-plugin/utils.d.ts
|
|
56
|
+
declare class BuiltinPlugin {
|
|
57
|
+
name: BindingBuiltinPluginName;
|
|
58
|
+
_options?: unknown;
|
|
59
|
+
constructor(name: BindingBuiltinPluginName, _options?: unknown);
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
export { MakeAsync as a, NullValue as c, LogLevel as d, LogLevelOption as f, RollupLogWithString as g, RollupLog as h, WarningHandlerWithDefault as i, PartialNull as l, RollupError as m, LoggingFunction as n, MaybeArray as o, LogOrStringHandler as p, LoggingFunctionWithPosition as r, MaybePromise as s, BuiltinPlugin as t, StringOrRegExp as u };
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import { o as logMultiplyNotifyOption } from "./logs-CPsamAuj.mjs";
|
|
2
|
+
import { t as arraify } from "./misc-5GYLGQ20.mjs";
|
|
3
|
+
import { w as LOG_LEVEL_WARN } from "./normalize-string-or-regex-DvECZN2V.mjs";
|
|
4
|
+
import { l as PluginDriver, n as createBundlerOptions } from "./rolldown-build-DYR94CyF.mjs";
|
|
5
|
+
import { a as aggregateBindingErrorsIntoJsError } from "./bindingify-input-options-CSdAtTcQ.mjs";
|
|
6
|
+
import { BindingWatcher, shutdownAsyncRuntime } from "../rolldown-binding.wasi.cjs";
|
|
7
|
+
|
|
8
|
+
//#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
|
|
9
|
+
/**
|
|
10
|
+
* This is not the set of all possible signals.
|
|
11
|
+
*
|
|
12
|
+
* It IS, however, the set of all signals that trigger
|
|
13
|
+
* an exit on either Linux or BSD systems. Linux is a
|
|
14
|
+
* superset of the signal names supported on BSD, and
|
|
15
|
+
* the unknown signals just fail to register, so we can
|
|
16
|
+
* catch that easily enough.
|
|
17
|
+
*
|
|
18
|
+
* Windows signals are a different set, since there are
|
|
19
|
+
* signals that terminate Windows processes, but don't
|
|
20
|
+
* terminate (or don't even exist) on Posix systems.
|
|
21
|
+
*
|
|
22
|
+
* Don't bother with SIGKILL. It's uncatchable, which
|
|
23
|
+
* means that we can't fire any callbacks anyway.
|
|
24
|
+
*
|
|
25
|
+
* If a user does happen to register a handler on a non-
|
|
26
|
+
* fatal signal like SIGWINCH or something, and then
|
|
27
|
+
* exit, it'll end up firing `process.emit('exit')`, so
|
|
28
|
+
* the handler will be fired anyway.
|
|
29
|
+
*
|
|
30
|
+
* SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
|
|
31
|
+
* artificially, inherently leave the process in a
|
|
32
|
+
* state from which it is not safe to try and enter JS
|
|
33
|
+
* listeners.
|
|
34
|
+
*/
|
|
35
|
+
const signals = [];
|
|
36
|
+
signals.push("SIGHUP", "SIGINT", "SIGTERM");
|
|
37
|
+
if (process.platform !== "win32") signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
|
|
38
|
+
if (process.platform === "linux") signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
|
|
42
|
+
const processOk = (process$2) => !!process$2 && typeof process$2 === "object" && typeof process$2.removeListener === "function" && typeof process$2.emit === "function" && typeof process$2.reallyExit === "function" && typeof process$2.listeners === "function" && typeof process$2.kill === "function" && typeof process$2.pid === "number" && typeof process$2.on === "function";
|
|
43
|
+
const kExitEmitter = Symbol.for("signal-exit emitter");
|
|
44
|
+
const global = globalThis;
|
|
45
|
+
const ObjectDefineProperty = Object.defineProperty.bind(Object);
|
|
46
|
+
var Emitter = class {
|
|
47
|
+
emitted = {
|
|
48
|
+
afterExit: false,
|
|
49
|
+
exit: false
|
|
50
|
+
};
|
|
51
|
+
listeners = {
|
|
52
|
+
afterExit: [],
|
|
53
|
+
exit: []
|
|
54
|
+
};
|
|
55
|
+
count = 0;
|
|
56
|
+
id = Math.random();
|
|
57
|
+
constructor() {
|
|
58
|
+
if (global[kExitEmitter]) return global[kExitEmitter];
|
|
59
|
+
ObjectDefineProperty(global, kExitEmitter, {
|
|
60
|
+
value: this,
|
|
61
|
+
writable: false,
|
|
62
|
+
enumerable: false,
|
|
63
|
+
configurable: false
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
on(ev, fn) {
|
|
67
|
+
this.listeners[ev].push(fn);
|
|
68
|
+
}
|
|
69
|
+
removeListener(ev, fn) {
|
|
70
|
+
const list = this.listeners[ev];
|
|
71
|
+
const i = list.indexOf(fn);
|
|
72
|
+
/* c8 ignore start */
|
|
73
|
+
if (i === -1) return;
|
|
74
|
+
/* c8 ignore stop */
|
|
75
|
+
if (i === 0 && list.length === 1) list.length = 0;
|
|
76
|
+
else list.splice(i, 1);
|
|
77
|
+
}
|
|
78
|
+
emit(ev, code, signal) {
|
|
79
|
+
if (this.emitted[ev]) return false;
|
|
80
|
+
this.emitted[ev] = true;
|
|
81
|
+
let ret = false;
|
|
82
|
+
for (const fn of this.listeners[ev]) ret = fn(code, signal) === true || ret;
|
|
83
|
+
if (ev === "exit") ret = this.emit("afterExit", code, signal) || ret;
|
|
84
|
+
return ret;
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
var SignalExitBase = class {};
|
|
88
|
+
const signalExitWrap = (handler) => {
|
|
89
|
+
return {
|
|
90
|
+
onExit(cb, opts) {
|
|
91
|
+
return handler.onExit(cb, opts);
|
|
92
|
+
},
|
|
93
|
+
load() {
|
|
94
|
+
return handler.load();
|
|
95
|
+
},
|
|
96
|
+
unload() {
|
|
97
|
+
return handler.unload();
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
var SignalExitFallback = class extends SignalExitBase {
|
|
102
|
+
onExit() {
|
|
103
|
+
return () => {};
|
|
104
|
+
}
|
|
105
|
+
load() {}
|
|
106
|
+
unload() {}
|
|
107
|
+
};
|
|
108
|
+
var SignalExit = class extends SignalExitBase {
|
|
109
|
+
/* c8 ignore start */
|
|
110
|
+
#hupSig = process$1.platform === "win32" ? "SIGINT" : "SIGHUP";
|
|
111
|
+
/* c8 ignore stop */
|
|
112
|
+
#emitter = new Emitter();
|
|
113
|
+
#process;
|
|
114
|
+
#originalProcessEmit;
|
|
115
|
+
#originalProcessReallyExit;
|
|
116
|
+
#sigListeners = {};
|
|
117
|
+
#loaded = false;
|
|
118
|
+
constructor(process$2) {
|
|
119
|
+
super();
|
|
120
|
+
this.#process = process$2;
|
|
121
|
+
this.#sigListeners = {};
|
|
122
|
+
for (const sig of signals) this.#sigListeners[sig] = () => {
|
|
123
|
+
const listeners = this.#process.listeners(sig);
|
|
124
|
+
let { count } = this.#emitter;
|
|
125
|
+
/* c8 ignore start */
|
|
126
|
+
const p = process$2;
|
|
127
|
+
if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") count += p.__signal_exit_emitter__.count;
|
|
128
|
+
/* c8 ignore stop */
|
|
129
|
+
if (listeners.length === count) {
|
|
130
|
+
this.unload();
|
|
131
|
+
const ret = this.#emitter.emit("exit", null, sig);
|
|
132
|
+
/* c8 ignore start */
|
|
133
|
+
const s = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
134
|
+
if (!ret) process$2.kill(process$2.pid, s);
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
this.#originalProcessReallyExit = process$2.reallyExit;
|
|
138
|
+
this.#originalProcessEmit = process$2.emit;
|
|
139
|
+
}
|
|
140
|
+
onExit(cb, opts) {
|
|
141
|
+
/* c8 ignore start */
|
|
142
|
+
if (!processOk(this.#process)) return () => {};
|
|
143
|
+
/* c8 ignore stop */
|
|
144
|
+
if (this.#loaded === false) this.load();
|
|
145
|
+
const ev = opts?.alwaysLast ? "afterExit" : "exit";
|
|
146
|
+
this.#emitter.on(ev, cb);
|
|
147
|
+
return () => {
|
|
148
|
+
this.#emitter.removeListener(ev, cb);
|
|
149
|
+
if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) this.unload();
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
load() {
|
|
153
|
+
if (this.#loaded) return;
|
|
154
|
+
this.#loaded = true;
|
|
155
|
+
this.#emitter.count += 1;
|
|
156
|
+
for (const sig of signals) try {
|
|
157
|
+
const fn = this.#sigListeners[sig];
|
|
158
|
+
if (fn) this.#process.on(sig, fn);
|
|
159
|
+
} catch (_) {}
|
|
160
|
+
this.#process.emit = (ev, ...a) => {
|
|
161
|
+
return this.#processEmit(ev, ...a);
|
|
162
|
+
};
|
|
163
|
+
this.#process.reallyExit = (code) => {
|
|
164
|
+
return this.#processReallyExit(code);
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
unload() {
|
|
168
|
+
if (!this.#loaded) return;
|
|
169
|
+
this.#loaded = false;
|
|
170
|
+
signals.forEach((sig) => {
|
|
171
|
+
const listener = this.#sigListeners[sig];
|
|
172
|
+
/* c8 ignore start */
|
|
173
|
+
if (!listener) throw new Error("Listener not defined for signal: " + sig);
|
|
174
|
+
/* c8 ignore stop */
|
|
175
|
+
try {
|
|
176
|
+
this.#process.removeListener(sig, listener);
|
|
177
|
+
} catch (_) {}
|
|
178
|
+
/* c8 ignore stop */
|
|
179
|
+
});
|
|
180
|
+
this.#process.emit = this.#originalProcessEmit;
|
|
181
|
+
this.#process.reallyExit = this.#originalProcessReallyExit;
|
|
182
|
+
this.#emitter.count -= 1;
|
|
183
|
+
}
|
|
184
|
+
#processReallyExit(code) {
|
|
185
|
+
/* c8 ignore start */
|
|
186
|
+
if (!processOk(this.#process)) return 0;
|
|
187
|
+
this.#process.exitCode = code || 0;
|
|
188
|
+
/* c8 ignore stop */
|
|
189
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
190
|
+
return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
|
|
191
|
+
}
|
|
192
|
+
#processEmit(ev, ...args) {
|
|
193
|
+
const og = this.#originalProcessEmit;
|
|
194
|
+
if (ev === "exit" && processOk(this.#process)) {
|
|
195
|
+
if (typeof args[0] === "number") this.#process.exitCode = args[0];
|
|
196
|
+
/* c8 ignore start */
|
|
197
|
+
const ret = og.call(this.#process, ev, ...args);
|
|
198
|
+
/* c8 ignore start */
|
|
199
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
200
|
+
/* c8 ignore stop */
|
|
201
|
+
return ret;
|
|
202
|
+
} else return og.call(this.#process, ev, ...args);
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
const process$1 = globalThis.process;
|
|
206
|
+
const { onExit, load, unload } = signalExitWrap(processOk(process$1) ? new SignalExit(process$1) : new SignalExitFallback());
|
|
207
|
+
|
|
208
|
+
//#endregion
|
|
209
|
+
//#region src/api/watch/watch-emitter.ts
|
|
210
|
+
var WatcherEmitter = class {
|
|
211
|
+
listeners = /* @__PURE__ */ new Map();
|
|
212
|
+
timer;
|
|
213
|
+
constructor() {
|
|
214
|
+
this.timer = setInterval(() => {}, 1e9);
|
|
215
|
+
}
|
|
216
|
+
on(event, listener) {
|
|
217
|
+
const listeners = this.listeners.get(event);
|
|
218
|
+
if (listeners) listeners.push(listener);
|
|
219
|
+
else this.listeners.set(event, [listener]);
|
|
220
|
+
return this;
|
|
221
|
+
}
|
|
222
|
+
off(event, listener) {
|
|
223
|
+
const listeners = this.listeners.get(event);
|
|
224
|
+
if (listeners) {
|
|
225
|
+
const index = listeners.indexOf(listener);
|
|
226
|
+
if (index !== -1) listeners.splice(index, 1);
|
|
227
|
+
}
|
|
228
|
+
return this;
|
|
229
|
+
}
|
|
230
|
+
clear(event) {
|
|
231
|
+
if (this.listeners.has(event)) this.listeners.delete(event);
|
|
232
|
+
}
|
|
233
|
+
async onEvent(event) {
|
|
234
|
+
const listeners = this.listeners.get(event.eventKind());
|
|
235
|
+
if (listeners) switch (event.eventKind()) {
|
|
236
|
+
case "close":
|
|
237
|
+
case "restart":
|
|
238
|
+
for (const listener of listeners) await listener();
|
|
239
|
+
break;
|
|
240
|
+
case "event":
|
|
241
|
+
for (const listener of listeners) {
|
|
242
|
+
const code = event.bundleEventKind();
|
|
243
|
+
switch (code) {
|
|
244
|
+
case "BUNDLE_END":
|
|
245
|
+
const { duration, output, result } = event.bundleEndData();
|
|
246
|
+
await listener({
|
|
247
|
+
code: "BUNDLE_END",
|
|
248
|
+
duration,
|
|
249
|
+
output: [output],
|
|
250
|
+
result
|
|
251
|
+
});
|
|
252
|
+
break;
|
|
253
|
+
case "ERROR":
|
|
254
|
+
const data = event.bundleErrorData();
|
|
255
|
+
await listener({
|
|
256
|
+
code: "ERROR",
|
|
257
|
+
error: aggregateBindingErrorsIntoJsError(data.error),
|
|
258
|
+
result: data.result
|
|
259
|
+
});
|
|
260
|
+
break;
|
|
261
|
+
default:
|
|
262
|
+
await listener({ code });
|
|
263
|
+
break;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
break;
|
|
267
|
+
case "change":
|
|
268
|
+
for (const listener of listeners) {
|
|
269
|
+
const { path, kind } = event.watchChangeData();
|
|
270
|
+
await listener(path, { event: kind });
|
|
271
|
+
}
|
|
272
|
+
break;
|
|
273
|
+
default: throw new Error(`Unknown event: ${event}`);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
async close() {
|
|
277
|
+
clearInterval(this.timer);
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
//#endregion
|
|
282
|
+
//#region src/api/watch/watcher.ts
|
|
283
|
+
var Watcher = class {
|
|
284
|
+
closed;
|
|
285
|
+
inner;
|
|
286
|
+
emitter;
|
|
287
|
+
stopWorkers;
|
|
288
|
+
constructor(emitter, inner, stopWorkers) {
|
|
289
|
+
this.closed = false;
|
|
290
|
+
this.inner = inner;
|
|
291
|
+
this.emitter = emitter;
|
|
292
|
+
const originClose = emitter.close.bind(emitter);
|
|
293
|
+
emitter.close = async () => {
|
|
294
|
+
await this.close();
|
|
295
|
+
originClose();
|
|
296
|
+
};
|
|
297
|
+
this.stopWorkers = stopWorkers;
|
|
298
|
+
}
|
|
299
|
+
async close() {
|
|
300
|
+
if (this.closed) return;
|
|
301
|
+
this.closed = true;
|
|
302
|
+
for (const stop of this.stopWorkers) await stop?.();
|
|
303
|
+
await this.inner.close();
|
|
304
|
+
shutdownAsyncRuntime();
|
|
305
|
+
}
|
|
306
|
+
start() {
|
|
307
|
+
process.nextTick(() => this.inner.start(this.emitter.onEvent.bind(this.emitter)));
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
async function createWatcher(emitter, input) {
|
|
311
|
+
const options = arraify(input);
|
|
312
|
+
const bundlerOptions = await Promise.all(options.map((option) => arraify(option.output || {}).map(async (output) => {
|
|
313
|
+
return createBundlerOptions(await PluginDriver.callOptionsHook(option, true), output, true);
|
|
314
|
+
})).flat());
|
|
315
|
+
const notifyOptions = getValidNotifyOption(bundlerOptions);
|
|
316
|
+
new Watcher(emitter, new BindingWatcher(bundlerOptions.map((option) => option.bundlerOptions), notifyOptions), bundlerOptions.map((option) => option.stopWorkers)).start();
|
|
317
|
+
}
|
|
318
|
+
function getValidNotifyOption(bundlerOptions) {
|
|
319
|
+
let result;
|
|
320
|
+
for (const option of bundlerOptions) if (option.inputOptions.watch) {
|
|
321
|
+
const notifyOption = option.inputOptions.watch.notify;
|
|
322
|
+
if (notifyOption) if (result) {
|
|
323
|
+
option.onLog(LOG_LEVEL_WARN, logMultiplyNotifyOption());
|
|
324
|
+
return result;
|
|
325
|
+
} else result = notifyOption;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
//#endregion
|
|
330
|
+
//#region src/api/watch/index.ts
|
|
331
|
+
const watch = (input) => {
|
|
332
|
+
const emitter = new WatcherEmitter();
|
|
333
|
+
createWatcher(emitter, input);
|
|
334
|
+
return emitter;
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
//#endregion
|
|
338
|
+
export { onExit as n, watch as t };
|
package/package.json
CHANGED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { i as makeBuiltinPluginCallable, n as BuiltinPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-d47jXr3r.js";
|
|
2
|
-
|
|
3
|
-
//#region src/builtin-plugin/constructors.ts
|
|
4
|
-
function modulePreloadPolyfillPlugin(config) {
|
|
5
|
-
return new BuiltinPlugin("builtin:module-preload-polyfill", config);
|
|
6
|
-
}
|
|
7
|
-
function dynamicImportVarsPlugin(config) {
|
|
8
|
-
if (config) {
|
|
9
|
-
config.include = normalizedStringOrRegex(config.include);
|
|
10
|
-
config.exclude = normalizedStringOrRegex(config.exclude);
|
|
11
|
-
}
|
|
12
|
-
return new BuiltinPlugin("builtin:dynamic-import-vars", config);
|
|
13
|
-
}
|
|
14
|
-
function importGlobPlugin(config) {
|
|
15
|
-
return new BuiltinPlugin("builtin:import-glob", config);
|
|
16
|
-
}
|
|
17
|
-
function reporterPlugin(config) {
|
|
18
|
-
return new BuiltinPlugin("builtin:reporter", config);
|
|
19
|
-
}
|
|
20
|
-
function manifestPlugin(config) {
|
|
21
|
-
return new BuiltinPlugin("builtin:manifest", config);
|
|
22
|
-
}
|
|
23
|
-
function wasmHelperPlugin(config) {
|
|
24
|
-
return new BuiltinPlugin("builtin:wasm-helper", config);
|
|
25
|
-
}
|
|
26
|
-
function wasmFallbackPlugin() {
|
|
27
|
-
return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:wasm-fallback"));
|
|
28
|
-
}
|
|
29
|
-
function loadFallbackPlugin() {
|
|
30
|
-
return new BuiltinPlugin("builtin:load-fallback");
|
|
31
|
-
}
|
|
32
|
-
function jsonPlugin(config) {
|
|
33
|
-
return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:json", config));
|
|
34
|
-
}
|
|
35
|
-
function buildImportAnalysisPlugin(config) {
|
|
36
|
-
return new BuiltinPlugin("builtin:build-import-analysis", config);
|
|
37
|
-
}
|
|
38
|
-
function viteResolvePlugin(config) {
|
|
39
|
-
return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:vite-resolve", config));
|
|
40
|
-
}
|
|
41
|
-
function isolatedDeclarationPlugin(config) {
|
|
42
|
-
return new BuiltinPlugin("builtin:isolated-declaration", config);
|
|
43
|
-
}
|
|
44
|
-
function webWorkerPostPlugin() {
|
|
45
|
-
return new BuiltinPlugin("builtin:web-worker-post");
|
|
46
|
-
}
|
|
47
|
-
function esmExternalRequirePlugin(config) {
|
|
48
|
-
return new BuiltinPlugin("builtin:esm-external-require", config);
|
|
49
|
-
}
|
|
50
|
-
function reactRefreshWrapperPlugin(config) {
|
|
51
|
-
if (config) {
|
|
52
|
-
config.include = normalizedStringOrRegex(config.include);
|
|
53
|
-
config.exclude = normalizedStringOrRegex(config.exclude);
|
|
54
|
-
}
|
|
55
|
-
return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:react-refresh-wrapper", config));
|
|
56
|
-
}
|
|
57
|
-
function viteCSSPostPlugin(config) {
|
|
58
|
-
return new BuiltinPlugin("builtin:vite-css-post", config);
|
|
59
|
-
}
|
|
60
|
-
function viteHtmlPlugin(config) {
|
|
61
|
-
return new BuiltinPlugin("builtin:vite-html", config);
|
|
62
|
-
}
|
|
63
|
-
function htmlInlineProxyPlugin() {
|
|
64
|
-
return new BuiltinPlugin("builtin:html-inline-proxy");
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
//#endregion
|
|
68
|
-
export { wasmHelperPlugin as _, importGlobPlugin as a, loadFallbackPlugin as c, reactRefreshWrapperPlugin as d, reporterPlugin as f, wasmFallbackPlugin as g, viteResolvePlugin as h, htmlInlineProxyPlugin as i, manifestPlugin as l, viteHtmlPlugin as m, dynamicImportVarsPlugin as n, isolatedDeclarationPlugin as o, viteCSSPostPlugin as p, esmExternalRequirePlugin as r, jsonPlugin as s, buildImportAnalysisPlugin as t, modulePreloadPolyfillPlugin as u, webWorkerPostPlugin as v };
|