@rolldown/browser 1.0.0-beta.33 → 1.0.0-beta.35
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.cjs +243 -238
- package/dist/cli.mjs +232 -232
- package/dist/config.cjs +3 -3
- package/dist/config.d.cts +2 -2
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +3 -3
- package/dist/experimental-index.browser.mjs +51 -6
- package/dist/experimental-index.cjs +57 -7
- package/dist/experimental-index.d.cts +45 -4
- package/dist/experimental-index.d.mts +45 -4
- package/dist/experimental-index.mjs +52 -7
- package/dist/filter-index.d.cts +2 -2
- package/dist/filter-index.d.mts +2 -2
- package/dist/index.browser.mjs +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/parallel-plugin-worker.cjs +6 -4
- package/dist/parallel-plugin-worker.mjs +3 -3
- package/dist/parallel-plugin.d.cts +2 -2
- package/dist/parallel-plugin.d.mts +2 -2
- package/dist/parse-ast-index.cjs +1 -1
- package/dist/parse-ast-index.d.cts +1 -1
- package/dist/parse-ast-index.d.mts +1 -1
- package/dist/parse-ast-index.mjs +1 -1
- package/dist/rolldown-binding.wasi-browser.js +7 -0
- package/dist/rolldown-binding.wasi.cjs +7 -0
- package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
- package/dist/shared/{binding-CFhvYkVn.d.mts → binding-9k0egz6L.d.mts} +107 -7
- package/dist/shared/{binding-DQk9TN_A.d.cts → binding-D13M6Llu.d.cts} +107 -7
- package/dist/shared/{define-config-B3QOs3Kt.d.cts → define-config-DJXaSinS.d.mts} +90 -24
- package/dist/shared/{define-config-DyjJkNqG.d.mts → define-config-DhrkZ_o7.d.cts} +90 -24
- package/dist/shared/{load-config-CLPLfZVe.mjs → load-config-BCjD-AGJ.mjs} +1 -1
- package/dist/shared/{load-config-xKQFLlGV.cjs → load-config-BJKhRKZL.cjs} +11 -6
- package/dist/shared/{parse-ast-index-BGzB5Bo-.mjs → parse-ast-index-C_CZT4St.mjs} +1 -1
- package/dist/shared/{parse-ast-index-BZfwAN9P.cjs → parse-ast-index-J0xVKZRe.cjs} +3 -2
- package/dist/shared/{prompt-QNI93ne7.cjs → prompt-Q05EYrFb.cjs} +8 -4
- package/dist/shared/{src-CZgQg1yE.mjs → src-B0RCtUy7.mjs} +160 -101
- package/dist/shared/{src-CGziNJPr.cjs → src-Bd4BGX4v.cjs} +193 -116
- package/dist/{src-D_htlJ_o.js → src-C8U06Im1.js} +157 -98
- package/package.json +19 -11
package/dist/cli.cjs
CHANGED
|
@@ -1,14 +1,220 @@
|
|
|
1
1
|
const require_chunk = require('./shared/chunk-DDkG_k5U.cjs');
|
|
2
|
-
const require_src = require('./shared/src-
|
|
3
|
-
require('./shared/parse-ast-index-
|
|
2
|
+
const require_src = require('./shared/src-Bd4BGX4v.cjs');
|
|
3
|
+
require('./shared/parse-ast-index-J0xVKZRe.cjs');
|
|
4
4
|
const require_dist = require('./shared/dist-CK0hotcm.cjs');
|
|
5
|
-
const require_load_config = require('./shared/load-config-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
const require_load_config = require('./shared/load-config-BJKhRKZL.cjs');
|
|
6
|
+
let node_path = require("node:path");
|
|
7
|
+
node_path = require_chunk.__toESM(node_path);
|
|
8
|
+
let node_process = require("node:process");
|
|
9
|
+
node_process = require_chunk.__toESM(node_process);
|
|
10
|
+
let node_util = require("node:util");
|
|
11
|
+
node_util = require_chunk.__toESM(node_util);
|
|
12
|
+
let node_tty = require("node:tty");
|
|
13
|
+
node_tty = require_chunk.__toESM(node_tty);
|
|
14
|
+
let node_perf_hooks = require("node:perf_hooks");
|
|
15
|
+
node_perf_hooks = require_chunk.__toESM(node_perf_hooks);
|
|
11
16
|
|
|
17
|
+
//#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
|
|
18
|
+
/**
|
|
19
|
+
* This is not the set of all possible signals.
|
|
20
|
+
*
|
|
21
|
+
* It IS, however, the set of all signals that trigger
|
|
22
|
+
* an exit on either Linux or BSD systems. Linux is a
|
|
23
|
+
* superset of the signal names supported on BSD, and
|
|
24
|
+
* the unknown signals just fail to register, so we can
|
|
25
|
+
* catch that easily enough.
|
|
26
|
+
*
|
|
27
|
+
* Windows signals are a different set, since there are
|
|
28
|
+
* signals that terminate Windows processes, but don't
|
|
29
|
+
* terminate (or don't even exist) on Posix systems.
|
|
30
|
+
*
|
|
31
|
+
* Don't bother with SIGKILL. It's uncatchable, which
|
|
32
|
+
* means that we can't fire any callbacks anyway.
|
|
33
|
+
*
|
|
34
|
+
* If a user does happen to register a handler on a non-
|
|
35
|
+
* fatal signal like SIGWINCH or something, and then
|
|
36
|
+
* exit, it'll end up firing `process.emit('exit')`, so
|
|
37
|
+
* the handler will be fired anyway.
|
|
38
|
+
*
|
|
39
|
+
* SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
|
|
40
|
+
* artificially, inherently leave the process in a
|
|
41
|
+
* state from which it is not safe to try and enter JS
|
|
42
|
+
* listeners.
|
|
43
|
+
*/
|
|
44
|
+
const signals = [];
|
|
45
|
+
signals.push("SIGHUP", "SIGINT", "SIGTERM");
|
|
46
|
+
if (process.platform !== "win32") signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
|
|
47
|
+
if (process.platform === "linux") signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
|
|
48
|
+
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
|
|
51
|
+
const processOk = (process$3) => !!process$3 && typeof process$3 === "object" && typeof process$3.removeListener === "function" && typeof process$3.emit === "function" && typeof process$3.reallyExit === "function" && typeof process$3.listeners === "function" && typeof process$3.kill === "function" && typeof process$3.pid === "number" && typeof process$3.on === "function";
|
|
52
|
+
const kExitEmitter = Symbol.for("signal-exit emitter");
|
|
53
|
+
const global = globalThis;
|
|
54
|
+
const ObjectDefineProperty = Object.defineProperty.bind(Object);
|
|
55
|
+
var Emitter = class {
|
|
56
|
+
emitted = {
|
|
57
|
+
afterExit: false,
|
|
58
|
+
exit: false
|
|
59
|
+
};
|
|
60
|
+
listeners = {
|
|
61
|
+
afterExit: [],
|
|
62
|
+
exit: []
|
|
63
|
+
};
|
|
64
|
+
count = 0;
|
|
65
|
+
id = Math.random();
|
|
66
|
+
constructor() {
|
|
67
|
+
if (global[kExitEmitter]) return global[kExitEmitter];
|
|
68
|
+
ObjectDefineProperty(global, kExitEmitter, {
|
|
69
|
+
value: this,
|
|
70
|
+
writable: false,
|
|
71
|
+
enumerable: false,
|
|
72
|
+
configurable: false
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
on(ev, fn) {
|
|
76
|
+
this.listeners[ev].push(fn);
|
|
77
|
+
}
|
|
78
|
+
removeListener(ev, fn) {
|
|
79
|
+
const list = this.listeners[ev];
|
|
80
|
+
const i$1 = list.indexOf(fn);
|
|
81
|
+
/* c8 ignore start */
|
|
82
|
+
if (i$1 === -1) return;
|
|
83
|
+
/* c8 ignore stop */
|
|
84
|
+
if (i$1 === 0 && list.length === 1) list.length = 0;
|
|
85
|
+
else list.splice(i$1, 1);
|
|
86
|
+
}
|
|
87
|
+
emit(ev, code, signal) {
|
|
88
|
+
if (this.emitted[ev]) return false;
|
|
89
|
+
this.emitted[ev] = true;
|
|
90
|
+
let ret = false;
|
|
91
|
+
for (const fn of this.listeners[ev]) ret = fn(code, signal) === true || ret;
|
|
92
|
+
if (ev === "exit") ret = this.emit("afterExit", code, signal) || ret;
|
|
93
|
+
return ret;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
var SignalExitBase = class {};
|
|
97
|
+
const signalExitWrap = (handler) => {
|
|
98
|
+
return {
|
|
99
|
+
onExit(cb, opts) {
|
|
100
|
+
return handler.onExit(cb, opts);
|
|
101
|
+
},
|
|
102
|
+
load() {
|
|
103
|
+
return handler.load();
|
|
104
|
+
},
|
|
105
|
+
unload() {
|
|
106
|
+
return handler.unload();
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
var SignalExitFallback = class extends SignalExitBase {
|
|
111
|
+
onExit() {
|
|
112
|
+
return () => {};
|
|
113
|
+
}
|
|
114
|
+
load() {}
|
|
115
|
+
unload() {}
|
|
116
|
+
};
|
|
117
|
+
var SignalExit = class extends SignalExitBase {
|
|
118
|
+
/* c8 ignore start */
|
|
119
|
+
#hupSig = process$2.platform === "win32" ? "SIGINT" : "SIGHUP";
|
|
120
|
+
/* c8 ignore stop */
|
|
121
|
+
#emitter = new Emitter();
|
|
122
|
+
#process;
|
|
123
|
+
#originalProcessEmit;
|
|
124
|
+
#originalProcessReallyExit;
|
|
125
|
+
#sigListeners = {};
|
|
126
|
+
#loaded = false;
|
|
127
|
+
constructor(process$3) {
|
|
128
|
+
super();
|
|
129
|
+
this.#process = process$3;
|
|
130
|
+
this.#sigListeners = {};
|
|
131
|
+
for (const sig of signals) this.#sigListeners[sig] = () => {
|
|
132
|
+
const listeners = this.#process.listeners(sig);
|
|
133
|
+
let { count } = this.#emitter;
|
|
134
|
+
/* c8 ignore start */
|
|
135
|
+
const p = process$3;
|
|
136
|
+
if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") count += p.__signal_exit_emitter__.count;
|
|
137
|
+
/* c8 ignore stop */
|
|
138
|
+
if (listeners.length === count) {
|
|
139
|
+
this.unload();
|
|
140
|
+
const ret = this.#emitter.emit("exit", null, sig);
|
|
141
|
+
/* c8 ignore start */
|
|
142
|
+
const s$1 = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
143
|
+
if (!ret) process$3.kill(process$3.pid, s$1);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
this.#originalProcessReallyExit = process$3.reallyExit;
|
|
147
|
+
this.#originalProcessEmit = process$3.emit;
|
|
148
|
+
}
|
|
149
|
+
onExit(cb, opts) {
|
|
150
|
+
/* c8 ignore start */
|
|
151
|
+
if (!processOk(this.#process)) return () => {};
|
|
152
|
+
/* c8 ignore stop */
|
|
153
|
+
if (this.#loaded === false) this.load();
|
|
154
|
+
const ev = opts?.alwaysLast ? "afterExit" : "exit";
|
|
155
|
+
this.#emitter.on(ev, cb);
|
|
156
|
+
return () => {
|
|
157
|
+
this.#emitter.removeListener(ev, cb);
|
|
158
|
+
if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) this.unload();
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
load() {
|
|
162
|
+
if (this.#loaded) return;
|
|
163
|
+
this.#loaded = true;
|
|
164
|
+
this.#emitter.count += 1;
|
|
165
|
+
for (const sig of signals) try {
|
|
166
|
+
const fn = this.#sigListeners[sig];
|
|
167
|
+
if (fn) this.#process.on(sig, fn);
|
|
168
|
+
} catch (_$1) {}
|
|
169
|
+
this.#process.emit = (ev, ...a$1) => {
|
|
170
|
+
return this.#processEmit(ev, ...a$1);
|
|
171
|
+
};
|
|
172
|
+
this.#process.reallyExit = (code) => {
|
|
173
|
+
return this.#processReallyExit(code);
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
unload() {
|
|
177
|
+
if (!this.#loaded) return;
|
|
178
|
+
this.#loaded = false;
|
|
179
|
+
signals.forEach((sig) => {
|
|
180
|
+
const listener = this.#sigListeners[sig];
|
|
181
|
+
/* c8 ignore start */
|
|
182
|
+
if (!listener) throw new Error("Listener not defined for signal: " + sig);
|
|
183
|
+
/* c8 ignore stop */
|
|
184
|
+
try {
|
|
185
|
+
this.#process.removeListener(sig, listener);
|
|
186
|
+
} catch (_$1) {}
|
|
187
|
+
/* c8 ignore stop */
|
|
188
|
+
});
|
|
189
|
+
this.#process.emit = this.#originalProcessEmit;
|
|
190
|
+
this.#process.reallyExit = this.#originalProcessReallyExit;
|
|
191
|
+
this.#emitter.count -= 1;
|
|
192
|
+
}
|
|
193
|
+
#processReallyExit(code) {
|
|
194
|
+
/* c8 ignore start */
|
|
195
|
+
if (!processOk(this.#process)) return 0;
|
|
196
|
+
this.#process.exitCode = code || 0;
|
|
197
|
+
/* c8 ignore stop */
|
|
198
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
199
|
+
return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
|
|
200
|
+
}
|
|
201
|
+
#processEmit(ev, ...args) {
|
|
202
|
+
const og = this.#originalProcessEmit;
|
|
203
|
+
if (ev === "exit" && processOk(this.#process)) {
|
|
204
|
+
if (typeof args[0] === "number") this.#process.exitCode = args[0];
|
|
205
|
+
/* c8 ignore start */
|
|
206
|
+
const ret = og.call(this.#process, ev, ...args);
|
|
207
|
+
/* c8 ignore start */
|
|
208
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
209
|
+
/* c8 ignore stop */
|
|
210
|
+
return ret;
|
|
211
|
+
} else return og.call(this.#process, ev, ...args);
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
const process$2 = globalThis.process;
|
|
215
|
+
const { onExit, load, unload } = signalExitWrap(processOk(process$2) ? new SignalExit(process$2) : new SignalExitFallback());
|
|
216
|
+
|
|
217
|
+
//#endregion
|
|
12
218
|
//#region ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/core.mjs
|
|
13
219
|
const LogLevels = {
|
|
14
220
|
silent: Number.NEGATIVE_INFINITY,
|
|
@@ -526,9 +732,9 @@ const colorDefs = {
|
|
|
526
732
|
function createColors(useColor = isColorSupported) {
|
|
527
733
|
return useColor ? colorDefs : Object.fromEntries(Object.keys(colorDefs).map((key) => [key, String]));
|
|
528
734
|
}
|
|
529
|
-
const colors
|
|
735
|
+
const colors = createColors();
|
|
530
736
|
function getColor$1(color, fallback = "reset") {
|
|
531
|
-
return colors
|
|
737
|
+
return colors[color] || colors[fallback];
|
|
532
738
|
}
|
|
533
739
|
const ansiRegex$1 = [String.raw`[\u001B\u009B][[\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\d\/#&.:=?%@~_]+)*|[a-zA-Z\d]+(?:;[-a-zA-Z\d\/#&.:=?%@~_]*)*)?\u0007)`, String.raw`(?:(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PR-TZcf-nq-uy=><~]))`].join("|");
|
|
534
740
|
function stripAnsi(text) {
|
|
@@ -905,12 +1111,12 @@ var FancyReporter = class extends BasicReporter {
|
|
|
905
1111
|
formatStack(stack, message, opts) {
|
|
906
1112
|
const indent = " ".repeat((opts?.errorLevel || 0) + 1);
|
|
907
1113
|
return `
|
|
908
|
-
${indent}` + parseStack(stack, message).map((line) => " " + line.replace(/^at +/, (m) => colors
|
|
1114
|
+
${indent}` + parseStack(stack, message).map((line) => " " + line.replace(/^at +/, (m) => colors.gray(m)).replace(/\((.+)\)/, (_$1, m) => `(${colors.cyan(m)})`)).join(`
|
|
909
1115
|
${indent}`);
|
|
910
1116
|
}
|
|
911
1117
|
formatType(logObj, isBadge, opts) {
|
|
912
1118
|
const typeColor = TYPE_COLOR_MAP[logObj.type] || LEVEL_COLOR_MAP[logObj.level] || "gray";
|
|
913
|
-
if (isBadge) return getBgColor(typeColor)(colors
|
|
1119
|
+
if (isBadge) return getBgColor(typeColor)(colors.black(` ${logObj.type.toUpperCase()} `));
|
|
914
1120
|
const _type = typeof TYPE_ICONS[logObj.type] === "string" ? TYPE_ICONS[logObj.type] : logObj.icon || logObj.type;
|
|
915
1121
|
return _type ? getColor(typeColor)(_type) : "";
|
|
916
1122
|
}
|
|
@@ -921,15 +1127,15 @@ ${indent}`);
|
|
|
921
1127
|
style: logObj.style
|
|
922
1128
|
});
|
|
923
1129
|
const date = this.formatDate(logObj.date, opts);
|
|
924
|
-
const coloredDate = date && colors
|
|
1130
|
+
const coloredDate = date && colors.gray(date);
|
|
925
1131
|
const isBadge = logObj.badge ?? logObj.level < 2;
|
|
926
1132
|
const type = this.formatType(logObj, isBadge, opts);
|
|
927
|
-
const tag = logObj.tag ? colors
|
|
1133
|
+
const tag = logObj.tag ? colors.gray(logObj.tag) : "";
|
|
928
1134
|
let line;
|
|
929
1135
|
const left = this.filterAndJoin([type, characterFormat(message)]);
|
|
930
1136
|
const right = this.filterAndJoin(opts.columns ? [tag, coloredDate] : [tag]);
|
|
931
1137
|
const space = (opts.columns || 0) - stringWidth(left) - stringWidth(right) - 2;
|
|
932
|
-
line = space > 0 && (opts.columns || 0) >= 80 ? left + " ".repeat(space) + right : (right ? `${colors
|
|
1138
|
+
line = space > 0 && (opts.columns || 0) >= 80 ? left + " ".repeat(space) + right : (right ? `${colors.gray(`[${right}]`)} ` : "") + left;
|
|
933
1139
|
line += characterFormat(additional.length > 0 ? "\n" + additional.join("\n") : "");
|
|
934
1140
|
if (logObj.type === "trace") {
|
|
935
1141
|
const _err = /* @__PURE__ */ new Error("Trace: " + logObj.message);
|
|
@@ -939,13 +1145,13 @@ ${indent}`);
|
|
|
939
1145
|
}
|
|
940
1146
|
};
|
|
941
1147
|
function characterFormat(str) {
|
|
942
|
-
return str.replace(/`([^`]+)`/gm, (_$1, m) => colors
|
|
1148
|
+
return str.replace(/`([^`]+)`/gm, (_$1, m) => colors.cyan(m)).replace(/\s+_([^_]+)_\s+/gm, (_$1, m) => ` ${colors.underline(m)} `);
|
|
943
1149
|
}
|
|
944
1150
|
function getColor(color = "white") {
|
|
945
|
-
return colors
|
|
1151
|
+
return colors[color] || colors.white;
|
|
946
1152
|
}
|
|
947
1153
|
function getBgColor(color = "bgWhite") {
|
|
948
|
-
return colors
|
|
1154
|
+
return colors[`bg${color[0].toUpperCase()}${color.slice(1)}`] || colors.bgWhite;
|
|
949
1155
|
}
|
|
950
1156
|
function createConsola(options$1 = {}) {
|
|
951
1157
|
let level = _getDefaultLogLevel();
|
|
@@ -955,7 +1161,7 @@ function createConsola(options$1 = {}) {
|
|
|
955
1161
|
defaults: { level },
|
|
956
1162
|
stdout: process.stdout,
|
|
957
1163
|
stderr: process.stderr,
|
|
958
|
-
prompt: (...args) => Promise.resolve().then(() => require("./shared/prompt-
|
|
1164
|
+
prompt: (...args) => Promise.resolve().then(() => require("./shared/prompt-Q05EYrFb.cjs")).then((m) => m.prompt(...args)),
|
|
959
1165
|
reporters: options$1.reporters || [options$1.fancy ?? !(T || R) ? new FancyReporter() : new BasicReporter()],
|
|
960
1166
|
...options$1
|
|
961
1167
|
});
|
|
@@ -1221,207 +1427,6 @@ function parseCliArguments() {
|
|
|
1221
1427
|
return normalizeCliOptions(values, positionals);
|
|
1222
1428
|
}
|
|
1223
1429
|
|
|
1224
|
-
//#endregion
|
|
1225
|
-
//#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
|
|
1226
|
-
/**
|
|
1227
|
-
* This is not the set of all possible signals.
|
|
1228
|
-
*
|
|
1229
|
-
* It IS, however, the set of all signals that trigger
|
|
1230
|
-
* an exit on either Linux or BSD systems. Linux is a
|
|
1231
|
-
* superset of the signal names supported on BSD, and
|
|
1232
|
-
* the unknown signals just fail to register, so we can
|
|
1233
|
-
* catch that easily enough.
|
|
1234
|
-
*
|
|
1235
|
-
* Windows signals are a different set, since there are
|
|
1236
|
-
* signals that terminate Windows processes, but don't
|
|
1237
|
-
* terminate (or don't even exist) on Posix systems.
|
|
1238
|
-
*
|
|
1239
|
-
* Don't bother with SIGKILL. It's uncatchable, which
|
|
1240
|
-
* means that we can't fire any callbacks anyway.
|
|
1241
|
-
*
|
|
1242
|
-
* If a user does happen to register a handler on a non-
|
|
1243
|
-
* fatal signal like SIGWINCH or something, and then
|
|
1244
|
-
* exit, it'll end up firing `process.emit('exit')`, so
|
|
1245
|
-
* the handler will be fired anyway.
|
|
1246
|
-
*
|
|
1247
|
-
* SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
|
|
1248
|
-
* artificially, inherently leave the process in a
|
|
1249
|
-
* state from which it is not safe to try and enter JS
|
|
1250
|
-
* listeners.
|
|
1251
|
-
*/
|
|
1252
|
-
const signals = [];
|
|
1253
|
-
signals.push("SIGHUP", "SIGINT", "SIGTERM");
|
|
1254
|
-
if (process.platform !== "win32") signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
|
|
1255
|
-
if (process.platform === "linux") signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
|
|
1256
|
-
|
|
1257
|
-
//#endregion
|
|
1258
|
-
//#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
|
|
1259
|
-
const processOk = (process$3) => !!process$3 && typeof process$3 === "object" && typeof process$3.removeListener === "function" && typeof process$3.emit === "function" && typeof process$3.reallyExit === "function" && typeof process$3.listeners === "function" && typeof process$3.kill === "function" && typeof process$3.pid === "number" && typeof process$3.on === "function";
|
|
1260
|
-
const kExitEmitter = Symbol.for("signal-exit emitter");
|
|
1261
|
-
const global = globalThis;
|
|
1262
|
-
const ObjectDefineProperty = Object.defineProperty.bind(Object);
|
|
1263
|
-
var Emitter = class {
|
|
1264
|
-
emitted = {
|
|
1265
|
-
afterExit: false,
|
|
1266
|
-
exit: false
|
|
1267
|
-
};
|
|
1268
|
-
listeners = {
|
|
1269
|
-
afterExit: [],
|
|
1270
|
-
exit: []
|
|
1271
|
-
};
|
|
1272
|
-
count = 0;
|
|
1273
|
-
id = Math.random();
|
|
1274
|
-
constructor() {
|
|
1275
|
-
if (global[kExitEmitter]) return global[kExitEmitter];
|
|
1276
|
-
ObjectDefineProperty(global, kExitEmitter, {
|
|
1277
|
-
value: this,
|
|
1278
|
-
writable: false,
|
|
1279
|
-
enumerable: false,
|
|
1280
|
-
configurable: false
|
|
1281
|
-
});
|
|
1282
|
-
}
|
|
1283
|
-
on(ev, fn) {
|
|
1284
|
-
this.listeners[ev].push(fn);
|
|
1285
|
-
}
|
|
1286
|
-
removeListener(ev, fn) {
|
|
1287
|
-
const list = this.listeners[ev];
|
|
1288
|
-
const i$1 = list.indexOf(fn);
|
|
1289
|
-
/* c8 ignore start */
|
|
1290
|
-
if (i$1 === -1) return;
|
|
1291
|
-
/* c8 ignore stop */
|
|
1292
|
-
if (i$1 === 0 && list.length === 1) list.length = 0;
|
|
1293
|
-
else list.splice(i$1, 1);
|
|
1294
|
-
}
|
|
1295
|
-
emit(ev, code, signal) {
|
|
1296
|
-
if (this.emitted[ev]) return false;
|
|
1297
|
-
this.emitted[ev] = true;
|
|
1298
|
-
let ret = false;
|
|
1299
|
-
for (const fn of this.listeners[ev]) ret = fn(code, signal) === true || ret;
|
|
1300
|
-
if (ev === "exit") ret = this.emit("afterExit", code, signal) || ret;
|
|
1301
|
-
return ret;
|
|
1302
|
-
}
|
|
1303
|
-
};
|
|
1304
|
-
var SignalExitBase = class {};
|
|
1305
|
-
const signalExitWrap = (handler) => {
|
|
1306
|
-
return {
|
|
1307
|
-
onExit(cb, opts) {
|
|
1308
|
-
return handler.onExit(cb, opts);
|
|
1309
|
-
},
|
|
1310
|
-
load() {
|
|
1311
|
-
return handler.load();
|
|
1312
|
-
},
|
|
1313
|
-
unload() {
|
|
1314
|
-
return handler.unload();
|
|
1315
|
-
}
|
|
1316
|
-
};
|
|
1317
|
-
};
|
|
1318
|
-
var SignalExitFallback = class extends SignalExitBase {
|
|
1319
|
-
onExit() {
|
|
1320
|
-
return () => {};
|
|
1321
|
-
}
|
|
1322
|
-
load() {}
|
|
1323
|
-
unload() {}
|
|
1324
|
-
};
|
|
1325
|
-
var SignalExit = class extends SignalExitBase {
|
|
1326
|
-
/* c8 ignore start */
|
|
1327
|
-
#hupSig = process$2.platform === "win32" ? "SIGINT" : "SIGHUP";
|
|
1328
|
-
/* c8 ignore stop */
|
|
1329
|
-
#emitter = new Emitter();
|
|
1330
|
-
#process;
|
|
1331
|
-
#originalProcessEmit;
|
|
1332
|
-
#originalProcessReallyExit;
|
|
1333
|
-
#sigListeners = {};
|
|
1334
|
-
#loaded = false;
|
|
1335
|
-
constructor(process$3) {
|
|
1336
|
-
super();
|
|
1337
|
-
this.#process = process$3;
|
|
1338
|
-
this.#sigListeners = {};
|
|
1339
|
-
for (const sig of signals) this.#sigListeners[sig] = () => {
|
|
1340
|
-
const listeners = this.#process.listeners(sig);
|
|
1341
|
-
let { count } = this.#emitter;
|
|
1342
|
-
/* c8 ignore start */
|
|
1343
|
-
const p = process$3;
|
|
1344
|
-
if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") count += p.__signal_exit_emitter__.count;
|
|
1345
|
-
/* c8 ignore stop */
|
|
1346
|
-
if (listeners.length === count) {
|
|
1347
|
-
this.unload();
|
|
1348
|
-
const ret = this.#emitter.emit("exit", null, sig);
|
|
1349
|
-
/* c8 ignore start */
|
|
1350
|
-
const s$1 = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
1351
|
-
if (!ret) process$3.kill(process$3.pid, s$1);
|
|
1352
|
-
}
|
|
1353
|
-
};
|
|
1354
|
-
this.#originalProcessReallyExit = process$3.reallyExit;
|
|
1355
|
-
this.#originalProcessEmit = process$3.emit;
|
|
1356
|
-
}
|
|
1357
|
-
onExit(cb, opts) {
|
|
1358
|
-
/* c8 ignore start */
|
|
1359
|
-
if (!processOk(this.#process)) return () => {};
|
|
1360
|
-
/* c8 ignore stop */
|
|
1361
|
-
if (this.#loaded === false) this.load();
|
|
1362
|
-
const ev = opts?.alwaysLast ? "afterExit" : "exit";
|
|
1363
|
-
this.#emitter.on(ev, cb);
|
|
1364
|
-
return () => {
|
|
1365
|
-
this.#emitter.removeListener(ev, cb);
|
|
1366
|
-
if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) this.unload();
|
|
1367
|
-
};
|
|
1368
|
-
}
|
|
1369
|
-
load() {
|
|
1370
|
-
if (this.#loaded) return;
|
|
1371
|
-
this.#loaded = true;
|
|
1372
|
-
this.#emitter.count += 1;
|
|
1373
|
-
for (const sig of signals) try {
|
|
1374
|
-
const fn = this.#sigListeners[sig];
|
|
1375
|
-
if (fn) this.#process.on(sig, fn);
|
|
1376
|
-
} catch (_$1) {}
|
|
1377
|
-
this.#process.emit = (ev, ...a$1) => {
|
|
1378
|
-
return this.#processEmit(ev, ...a$1);
|
|
1379
|
-
};
|
|
1380
|
-
this.#process.reallyExit = (code) => {
|
|
1381
|
-
return this.#processReallyExit(code);
|
|
1382
|
-
};
|
|
1383
|
-
}
|
|
1384
|
-
unload() {
|
|
1385
|
-
if (!this.#loaded) return;
|
|
1386
|
-
this.#loaded = false;
|
|
1387
|
-
signals.forEach((sig) => {
|
|
1388
|
-
const listener = this.#sigListeners[sig];
|
|
1389
|
-
/* c8 ignore start */
|
|
1390
|
-
if (!listener) throw new Error("Listener not defined for signal: " + sig);
|
|
1391
|
-
/* c8 ignore stop */
|
|
1392
|
-
try {
|
|
1393
|
-
this.#process.removeListener(sig, listener);
|
|
1394
|
-
} catch (_$1) {}
|
|
1395
|
-
/* c8 ignore stop */
|
|
1396
|
-
});
|
|
1397
|
-
this.#process.emit = this.#originalProcessEmit;
|
|
1398
|
-
this.#process.reallyExit = this.#originalProcessReallyExit;
|
|
1399
|
-
this.#emitter.count -= 1;
|
|
1400
|
-
}
|
|
1401
|
-
#processReallyExit(code) {
|
|
1402
|
-
/* c8 ignore start */
|
|
1403
|
-
if (!processOk(this.#process)) return 0;
|
|
1404
|
-
this.#process.exitCode = code || 0;
|
|
1405
|
-
/* c8 ignore stop */
|
|
1406
|
-
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
1407
|
-
return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
|
|
1408
|
-
}
|
|
1409
|
-
#processEmit(ev, ...args) {
|
|
1410
|
-
const og = this.#originalProcessEmit;
|
|
1411
|
-
if (ev === "exit" && processOk(this.#process)) {
|
|
1412
|
-
if (typeof args[0] === "number") this.#process.exitCode = args[0];
|
|
1413
|
-
/* c8 ignore start */
|
|
1414
|
-
const ret = og.call(this.#process, ev, ...args);
|
|
1415
|
-
/* c8 ignore start */
|
|
1416
|
-
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
1417
|
-
/* c8 ignore stop */
|
|
1418
|
-
return ret;
|
|
1419
|
-
} else return og.call(this.#process, ev, ...args);
|
|
1420
|
-
}
|
|
1421
|
-
};
|
|
1422
|
-
const process$2 = globalThis.process;
|
|
1423
|
-
const { onExit, load, unload } = signalExitWrap(processOk(process$2) ? new SignalExit(process$2) : new SignalExitFallback());
|
|
1424
|
-
|
|
1425
1430
|
//#endregion
|
|
1426
1431
|
//#region src/utils/clear-screen.ts
|
|
1427
1432
|
const CLEAR_SCREEN = "\x1Bc";
|
|
@@ -1434,8 +1439,8 @@ function getClearScreenFunction(options$1) {
|
|
|
1434
1439
|
}
|
|
1435
1440
|
|
|
1436
1441
|
//#endregion
|
|
1437
|
-
//#region ../../node_modules/.pnpm/@oxc-project+runtime@0.82.
|
|
1438
|
-
var require_usingCtx = /* @__PURE__ */ require_chunk.__commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.82.
|
|
1442
|
+
//#region ../../node_modules/.pnpm/@oxc-project+runtime@0.82.3/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js
|
|
1443
|
+
var require_usingCtx = /* @__PURE__ */ require_chunk.__commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.82.3/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js": ((exports, module) => {
|
|
1439
1444
|
function _usingCtx() {
|
|
1440
1445
|
var r$1 = "function" == typeof SuppressedError ? SuppressedError : function(r$2, e$1) {
|
|
1441
1446
|
var n$2 = Error();
|
|
@@ -1528,7 +1533,7 @@ async function bundleWithCliOptions(cliOptions) {
|
|
|
1528
1533
|
process.exit(1);
|
|
1529
1534
|
}
|
|
1530
1535
|
for (const file of outputs) {
|
|
1531
|
-
if (outputs.length > 1) logger.log(`\n${require_src.
|
|
1536
|
+
if (outputs.length > 1) logger.log(`\n${require_src.ansis_default.cyan(require_src.ansis_default.bold(`|→ ${file.fileName}:`))}\n`);
|
|
1532
1537
|
console.log(file.type === "asset" ? file.source : file.code);
|
|
1533
1538
|
}
|
|
1534
1539
|
} catch (_$1) {
|
|
@@ -1568,12 +1573,12 @@ async function watchInner(config, cliOptions) {
|
|
|
1568
1573
|
clearScreen?.();
|
|
1569
1574
|
break;
|
|
1570
1575
|
case "BUNDLE_START":
|
|
1571
|
-
if (changedFile.length > 0) logger.log(`Found ${require_src.
|
|
1576
|
+
if (changedFile.length > 0) logger.log(`Found ${require_src.ansis_default.bold(changedFile.map(relativeId).join(", "))} changed, rebuilding...`);
|
|
1572
1577
|
changedFile.length = 0;
|
|
1573
1578
|
break;
|
|
1574
1579
|
case "BUNDLE_END":
|
|
1575
1580
|
await event.result.close();
|
|
1576
|
-
logger.success(`Rebuilt ${require_src.
|
|
1581
|
+
logger.success(`Rebuilt ${require_src.ansis_default.bold(relativeId(event.output[0]))} in ${require_src.ansis_default.green(ms(event.duration))}.`);
|
|
1577
1582
|
break;
|
|
1578
1583
|
case "ERROR":
|
|
1579
1584
|
await event.result.close();
|
|
@@ -1607,7 +1612,7 @@ async function bundleInner(config, cliOptions) {
|
|
|
1607
1612
|
logger.log(``);
|
|
1608
1613
|
const endTime = node_perf_hooks.performance.now();
|
|
1609
1614
|
const duration = endTime - startTime;
|
|
1610
|
-
logger.success(`rolldown v${require_src.version} Finished in ${require_src.
|
|
1615
|
+
logger.success(`rolldown v${require_src.version} Finished in ${require_src.ansis_default.green(ms(duration))}`);
|
|
1611
1616
|
}
|
|
1612
1617
|
function printBundleOutputPretty(output) {
|
|
1613
1618
|
const outputEntries = collectOutputEntries(output.output);
|
|
@@ -1654,10 +1659,10 @@ function printOutputEntries(entries, sizeAdjustment, distPath) {
|
|
|
1654
1659
|
const filtered = entries.filter((e) => e.type === group.type);
|
|
1655
1660
|
if (!filtered.length) continue;
|
|
1656
1661
|
for (const entry of filtered.sort((a$1, z) => a$1.size - z.size)) {
|
|
1657
|
-
let log = require_src.
|
|
1658
|
-
log += require_src.
|
|
1659
|
-
log += require_src.
|
|
1660
|
-
log += require_src.
|
|
1662
|
+
let log = require_src.ansis_default.dim(withTrailingSlash(distPath));
|
|
1663
|
+
log += require_src.ansis_default[group.color](entry.fileName.padEnd(sizeAdjustment.longest + 2));
|
|
1664
|
+
log += require_src.ansis_default.dim(entry.type);
|
|
1665
|
+
log += require_src.ansis_default.dim(` │ size: ${displaySize(entry.size).padStart(sizeAdjustment.sizePad)}`);
|
|
1661
1666
|
logger.log(log);
|
|
1662
1667
|
}
|
|
1663
1668
|
}
|
|
@@ -1676,9 +1681,9 @@ function relativeId(id) {
|
|
|
1676
1681
|
|
|
1677
1682
|
//#endregion
|
|
1678
1683
|
//#region src/cli/commands/help.ts
|
|
1679
|
-
const introduction = `${require_src.
|
|
1684
|
+
const introduction = `${require_src.ansis_default.gray(`${require_src.description} (rolldown v${require_src.version})`)}
|
|
1680
1685
|
|
|
1681
|
-
${require_src.
|
|
1686
|
+
${require_src.ansis_default.bold(require_src.ansis_default.underline("USAGE"))} ${require_src.ansis_default.cyan("rolldown -c <config>")} or ${require_src.ansis_default.cyan("rolldown <input> <options>")}`;
|
|
1682
1687
|
const examples = [
|
|
1683
1688
|
{
|
|
1684
1689
|
title: "Bundle with a config file `rolldown.config.mjs`",
|
|
@@ -1710,7 +1715,7 @@ const notes = [
|
|
|
1710
1715
|
function showHelp() {
|
|
1711
1716
|
logger.log(introduction);
|
|
1712
1717
|
logger.log("");
|
|
1713
|
-
logger.log(`${require_src.
|
|
1718
|
+
logger.log(`${require_src.ansis_default.bold(require_src.ansis_default.underline("OPTIONS"))}`);
|
|
1714
1719
|
logger.log("");
|
|
1715
1720
|
logger.log(Object.entries(options).sort(([a$1], [b$1]) => {
|
|
1716
1721
|
if (options[a$1].short && !options[b$1].short) return -1;
|
|
@@ -1723,20 +1728,20 @@ function showHelp() {
|
|
|
1723
1728
|
if (short) optionStr += `-${short}, `;
|
|
1724
1729
|
if (type === "string") optionStr += `<${hint ?? option}>`;
|
|
1725
1730
|
if (description$1 && description$1.length > 0) description$1 = description$1[0].toUpperCase() + description$1.slice(1);
|
|
1726
|
-
return require_src.
|
|
1731
|
+
return require_src.ansis_default.cyan(optionStr.padEnd(30)) + description$1 + (description$1 && description$1?.endsWith(".") ? "" : ".");
|
|
1727
1732
|
}).join("\n"));
|
|
1728
1733
|
logger.log("");
|
|
1729
|
-
logger.log(`${require_src.
|
|
1734
|
+
logger.log(`${require_src.ansis_default.bold(require_src.ansis_default.underline("EXAMPLES"))}`);
|
|
1730
1735
|
logger.log("");
|
|
1731
1736
|
examples.forEach(({ title, command }, ord) => {
|
|
1732
1737
|
logger.log(` ${ord + 1}. ${title}:`);
|
|
1733
|
-
logger.log(` ${require_src.
|
|
1738
|
+
logger.log(` ${require_src.ansis_default.cyan(command)}`);
|
|
1734
1739
|
logger.log("");
|
|
1735
1740
|
});
|
|
1736
|
-
logger.log(`${require_src.
|
|
1741
|
+
logger.log(`${require_src.ansis_default.bold(require_src.ansis_default.underline("NOTES"))}`);
|
|
1737
1742
|
logger.log("");
|
|
1738
1743
|
notes.forEach((note) => {
|
|
1739
|
-
logger.log(` * ${require_src.
|
|
1744
|
+
logger.log(` * ${require_src.ansis_default.gray(note)}`);
|
|
1740
1745
|
});
|
|
1741
1746
|
}
|
|
1742
1747
|
|