@rollipop/rolldown 0.0.0-beta.0 → 0.0.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/.editorconfig +10 -0
- package/.gitattributes +4 -0
- package/README.md +1 -11
- package/package.json +2 -126
- package/LICENSE +0 -25
- package/bin/cli.mjs +0 -3
- package/dist/cli-setup.d.mts +0 -1
- package/dist/cli-setup.mjs +0 -17
- package/dist/cli.d.mts +0 -1
- package/dist/cli.mjs +0 -1581
- package/dist/config.d.mts +0 -10
- package/dist/config.mjs +0 -14
- package/dist/experimental-index.d.mts +0 -239
- package/dist/experimental-index.mjs +0 -299
- package/dist/experimental-runtime-types.d.ts +0 -92
- package/dist/filter-index.d.mts +0 -4
- package/dist/filter-index.mjs +0 -369
- package/dist/get-log-filter.d.mts +0 -7
- package/dist/get-log-filter.mjs +0 -48
- package/dist/index.d.mts +0 -4
- package/dist/index.mjs +0 -38
- package/dist/parallel-plugin-worker.d.mts +0 -1
- package/dist/parallel-plugin-worker.mjs +0 -32
- package/dist/parallel-plugin.d.mts +0 -14
- package/dist/parallel-plugin.mjs +0 -7
- package/dist/parse-ast-index.d.mts +0 -8
- package/dist/parse-ast-index.mjs +0 -4
- package/dist/plugins-index.d.mts +0 -31
- package/dist/plugins-index.mjs +0 -40
- package/dist/shared/binding-DmMMxMk0.mjs +0 -584
- package/dist/shared/binding-kAegJ1Bj.d.mts +0 -1775
- package/dist/shared/bindingify-input-options-D0BAGfk2.mjs +0 -1622
- package/dist/shared/constructors-F44lhsH3.d.mts +0 -30
- package/dist/shared/constructors-Rl_oLd2F.mjs +0 -67
- package/dist/shared/define-config-BF4P-Pum.mjs +0 -7
- package/dist/shared/define-config-DJ1-iIdx.d.mts +0 -2562
- package/dist/shared/load-config-BEpugZky.mjs +0 -114
- package/dist/shared/logging-DsnCZi19.d.mts +0 -42
- package/dist/shared/logs-cyjC0SDv.mjs +0 -183
- package/dist/shared/misc-DpjTMcQQ.mjs +0 -22
- package/dist/shared/normalize-string-or-regex-DbTZ9prS.mjs +0 -670
- package/dist/shared/parse-ast-index-BuuhACPk.mjs +0 -99
- package/dist/shared/prompt-5sWCM0jm.mjs +0 -847
- package/dist/shared/rolldown-build-viDZfkdI.mjs +0 -2292
- package/dist/shared/rolldown-il0-nWH9.mjs +0 -11
- package/dist/shared/watch-BSdMzY6q.mjs +0 -352
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { l as PluginDriver, s as validateOption, t as RolldownBuild } from "./rolldown-build-viDZfkdI.mjs";
|
|
2
|
-
|
|
3
|
-
//#region src/api/rolldown/index.ts
|
|
4
|
-
/** @category Programmatic APIs */
|
|
5
|
-
const rolldown = async (input) => {
|
|
6
|
-
validateOption("input", input);
|
|
7
|
-
return new RolldownBuild(await PluginDriver.callOptionsHook(input));
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
//#endregion
|
|
11
|
-
export { rolldown as t };
|
|
@@ -1,352 +0,0 @@
|
|
|
1
|
-
import { n as __toESM, t as require_binding } from "./binding-DmMMxMk0.mjs";
|
|
2
|
-
import { o as logMultiplyNotifyOption } from "./logs-cyjC0SDv.mjs";
|
|
3
|
-
import { t as arraify } from "./misc-DpjTMcQQ.mjs";
|
|
4
|
-
import { E as LOG_LEVEL_WARN } from "./normalize-string-or-regex-DbTZ9prS.mjs";
|
|
5
|
-
import { l as PluginDriver, n as createBundlerOptions } from "./rolldown-build-viDZfkdI.mjs";
|
|
6
|
-
import { a as aggregateBindingErrorsIntoJsError } from "./bindingify-input-options-D0BAGfk2.mjs";
|
|
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) => !!process && typeof process === "object" && typeof process.removeListener === "function" && typeof process.emit === "function" && typeof process.reallyExit === "function" && typeof process.listeners === "function" && typeof process.kill === "function" && typeof process.pid === "number" && typeof process.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) {
|
|
119
|
-
super();
|
|
120
|
-
this.#process = process;
|
|
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;
|
|
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.kill(process.pid, s);
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
this.#originalProcessReallyExit = process.reallyExit;
|
|
138
|
-
this.#originalProcessEmit = process.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: onExit$1, load, unload } = signalExitWrap(processOk(process$1) ? new SignalExit(process$1) : new SignalExitFallback());
|
|
207
|
-
|
|
208
|
-
//#endregion
|
|
209
|
-
//#region src/utils/signal-exit.ts
|
|
210
|
-
function onExit(...args) {
|
|
211
|
-
if (typeof process === "object" && process.versions.webcontainer) {
|
|
212
|
-
process.on("exit", (code) => {
|
|
213
|
-
args[0](code, null);
|
|
214
|
-
});
|
|
215
|
-
return;
|
|
216
|
-
}
|
|
217
|
-
onExit$1(...args);
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
//#endregion
|
|
221
|
-
//#region src/api/watch/watch-emitter.ts
|
|
222
|
-
var import_binding = /* @__PURE__ */ __toESM(require_binding());
|
|
223
|
-
var WatcherEmitter = class {
|
|
224
|
-
listeners = /* @__PURE__ */ new Map();
|
|
225
|
-
timer;
|
|
226
|
-
constructor() {
|
|
227
|
-
this.timer = setInterval(() => {}, 1e9);
|
|
228
|
-
}
|
|
229
|
-
on(event, listener) {
|
|
230
|
-
const listeners = this.listeners.get(event);
|
|
231
|
-
if (listeners) listeners.push(listener);
|
|
232
|
-
else this.listeners.set(event, [listener]);
|
|
233
|
-
return this;
|
|
234
|
-
}
|
|
235
|
-
off(event, listener) {
|
|
236
|
-
const listeners = this.listeners.get(event);
|
|
237
|
-
if (listeners) {
|
|
238
|
-
const index = listeners.indexOf(listener);
|
|
239
|
-
if (index !== -1) listeners.splice(index, 1);
|
|
240
|
-
}
|
|
241
|
-
return this;
|
|
242
|
-
}
|
|
243
|
-
clear(event) {
|
|
244
|
-
if (this.listeners.has(event)) this.listeners.delete(event);
|
|
245
|
-
}
|
|
246
|
-
async onEvent(event) {
|
|
247
|
-
const listeners = this.listeners.get(event.eventKind());
|
|
248
|
-
if (listeners) switch (event.eventKind()) {
|
|
249
|
-
case "close":
|
|
250
|
-
case "restart":
|
|
251
|
-
for (const listener of listeners) await listener();
|
|
252
|
-
break;
|
|
253
|
-
case "event":
|
|
254
|
-
for (const listener of listeners) {
|
|
255
|
-
const code = event.bundleEventKind();
|
|
256
|
-
switch (code) {
|
|
257
|
-
case "BUNDLE_END":
|
|
258
|
-
const { duration, output, result } = event.bundleEndData();
|
|
259
|
-
await listener({
|
|
260
|
-
code: "BUNDLE_END",
|
|
261
|
-
duration,
|
|
262
|
-
output: [output],
|
|
263
|
-
result
|
|
264
|
-
});
|
|
265
|
-
break;
|
|
266
|
-
case "ERROR":
|
|
267
|
-
const data = event.bundleErrorData();
|
|
268
|
-
await listener({
|
|
269
|
-
code: "ERROR",
|
|
270
|
-
error: aggregateBindingErrorsIntoJsError(data.error),
|
|
271
|
-
result: data.result
|
|
272
|
-
});
|
|
273
|
-
break;
|
|
274
|
-
default:
|
|
275
|
-
await listener({ code });
|
|
276
|
-
break;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
break;
|
|
280
|
-
case "change":
|
|
281
|
-
for (const listener of listeners) {
|
|
282
|
-
const { path, kind } = event.watchChangeData();
|
|
283
|
-
await listener(path, { event: kind });
|
|
284
|
-
}
|
|
285
|
-
break;
|
|
286
|
-
default: throw new Error(`Unknown event: ${event}`);
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
async close() {
|
|
290
|
-
clearInterval(this.timer);
|
|
291
|
-
}
|
|
292
|
-
};
|
|
293
|
-
|
|
294
|
-
//#endregion
|
|
295
|
-
//#region src/api/watch/watcher.ts
|
|
296
|
-
var Watcher = class {
|
|
297
|
-
closed;
|
|
298
|
-
inner;
|
|
299
|
-
emitter;
|
|
300
|
-
stopWorkers;
|
|
301
|
-
constructor(emitter, inner, stopWorkers) {
|
|
302
|
-
this.closed = false;
|
|
303
|
-
this.inner = inner;
|
|
304
|
-
this.emitter = emitter;
|
|
305
|
-
const originClose = emitter.close.bind(emitter);
|
|
306
|
-
emitter.close = async () => {
|
|
307
|
-
await this.close();
|
|
308
|
-
originClose();
|
|
309
|
-
};
|
|
310
|
-
this.stopWorkers = stopWorkers;
|
|
311
|
-
}
|
|
312
|
-
async close() {
|
|
313
|
-
if (this.closed) return;
|
|
314
|
-
this.closed = true;
|
|
315
|
-
for (const stop of this.stopWorkers) await stop?.();
|
|
316
|
-
await this.inner.close();
|
|
317
|
-
(0, import_binding.shutdownAsyncRuntime)();
|
|
318
|
-
}
|
|
319
|
-
start() {
|
|
320
|
-
process.nextTick(() => this.inner.start(this.emitter.onEvent.bind(this.emitter)));
|
|
321
|
-
}
|
|
322
|
-
};
|
|
323
|
-
async function createWatcher(emitter, input) {
|
|
324
|
-
const options = arraify(input);
|
|
325
|
-
const bundlerOptions = await Promise.all(options.map((option) => arraify(option.output || {}).map(async (output) => {
|
|
326
|
-
return createBundlerOptions(await PluginDriver.callOptionsHook(option, true), output, true);
|
|
327
|
-
})).flat());
|
|
328
|
-
const notifyOptions = getValidNotifyOption(bundlerOptions);
|
|
329
|
-
new Watcher(emitter, new import_binding.BindingWatcher(bundlerOptions.map((option) => option.bundlerOptions), notifyOptions), bundlerOptions.map((option) => option.stopWorkers)).start();
|
|
330
|
-
}
|
|
331
|
-
function getValidNotifyOption(bundlerOptions) {
|
|
332
|
-
let result;
|
|
333
|
-
for (const option of bundlerOptions) if (option.inputOptions.watch) {
|
|
334
|
-
const notifyOption = option.inputOptions.watch.notify;
|
|
335
|
-
if (notifyOption) if (result) {
|
|
336
|
-
option.onLog(LOG_LEVEL_WARN, logMultiplyNotifyOption());
|
|
337
|
-
return result;
|
|
338
|
-
} else result = notifyOption;
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
//#endregion
|
|
343
|
-
//#region src/api/watch/index.ts
|
|
344
|
-
/** @category Programmatic APIs */
|
|
345
|
-
const watch = (input) => {
|
|
346
|
-
const emitter = new WatcherEmitter();
|
|
347
|
-
createWatcher(emitter, input);
|
|
348
|
-
return emitter;
|
|
349
|
-
};
|
|
350
|
-
|
|
351
|
-
//#endregion
|
|
352
|
-
export { onExit as n, watch as t };
|