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