rolldown 1.0.0-beta.34 → 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 +217 -211
- package/dist/cli.mjs +204 -204
- package/dist/config.cjs +3 -3
- package/dist/config.d.cts +1 -1
- package/dist/config.d.mts +1 -1
- package/dist/config.mjs +3 -3
- package/dist/experimental-index.cjs +23 -8
- package/dist/experimental-index.d.cts +13 -4
- package/dist/experimental-index.d.mts +13 -4
- package/dist/experimental-index.mjs +21 -7
- package/dist/filter-index.cjs +2 -1
- package/dist/filter-index.d.cts +1 -1
- package/dist/filter-index.d.mts +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +2 -2
- package/dist/parallel-plugin-worker.cjs +4 -3
- package/dist/parallel-plugin-worker.mjs +2 -2
- package/dist/parallel-plugin.d.cts +1 -1
- package/dist/parallel-plugin.d.mts +1 -1
- package/dist/parse-ast-index.cjs +1 -1
- package/dist/parse-ast-index.mjs +1 -1
- package/dist/shared/{define-config-DVSr6Unb.d.mts → define-config-3arq8OPE.d.mts} +29 -2
- package/dist/shared/{define-config-D5AluabE.d.cts → define-config-DhrkZ_o7.d.cts} +29 -2
- package/dist/shared/{load-config-CXpGBNqp.mjs → load-config-C93_L4MP.mjs} +1 -1
- package/dist/shared/{load-config-CefxSUnT.cjs → load-config-S_ofSLrj.cjs} +11 -6
- package/dist/shared/{parse-ast-index-DjojK-Vf.mjs → parse-ast-index-BadydpMA.mjs} +25 -25
- package/dist/shared/{parse-ast-index-BCv3Y1TT.cjs → parse-ast-index-cePJvlvW.cjs} +36 -24
- package/dist/shared/{prompt-QNI93ne7.cjs → prompt-Q05EYrFb.cjs} +8 -4
- package/dist/shared/{src-djpzntWm.cjs → src-BBMxhaqf.cjs} +93 -42
- package/dist/shared/{src-Chn1S4O2.mjs → src-D954P1TH.mjs} +75 -31
- package/package.json +18 -19
package/dist/cli.cjs
CHANGED
|
@@ -1,15 +1,222 @@
|
|
|
1
1
|
const require_chunk = require('./shared/chunk-DDkG_k5U.cjs');
|
|
2
|
-
|
|
3
|
-
require('./shared/
|
|
2
|
+
require('./shared/parse-ast-index-cePJvlvW.cjs');
|
|
3
|
+
const require_src = require('./shared/src-BBMxhaqf.cjs');
|
|
4
4
|
const require_misc = require('./shared/misc-DksvspN4.cjs');
|
|
5
|
-
const require_load_config = require('./shared/load-config-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
const require_load_config = require('./shared/load-config-S_ofSLrj.cjs');
|
|
6
|
+
let node_path = require("node:path");
|
|
7
|
+
node_path = require_chunk.__toESM(node_path);
|
|
8
|
+
let ansis = require("ansis");
|
|
9
|
+
ansis = require_chunk.__toESM(ansis);
|
|
10
|
+
let node_process = require("node:process");
|
|
11
|
+
node_process = require_chunk.__toESM(node_process);
|
|
12
|
+
let node_util = require("node:util");
|
|
13
|
+
node_util = require_chunk.__toESM(node_util);
|
|
14
|
+
let node_tty = require("node:tty");
|
|
15
|
+
node_tty = require_chunk.__toESM(node_tty);
|
|
16
|
+
let node_perf_hooks = require("node:perf_hooks");
|
|
17
|
+
node_perf_hooks = require_chunk.__toESM(node_perf_hooks);
|
|
12
18
|
|
|
19
|
+
//#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
|
|
20
|
+
/**
|
|
21
|
+
* This is not the set of all possible signals.
|
|
22
|
+
*
|
|
23
|
+
* It IS, however, the set of all signals that trigger
|
|
24
|
+
* an exit on either Linux or BSD systems. Linux is a
|
|
25
|
+
* superset of the signal names supported on BSD, and
|
|
26
|
+
* the unknown signals just fail to register, so we can
|
|
27
|
+
* catch that easily enough.
|
|
28
|
+
*
|
|
29
|
+
* Windows signals are a different set, since there are
|
|
30
|
+
* signals that terminate Windows processes, but don't
|
|
31
|
+
* terminate (or don't even exist) on Posix systems.
|
|
32
|
+
*
|
|
33
|
+
* Don't bother with SIGKILL. It's uncatchable, which
|
|
34
|
+
* means that we can't fire any callbacks anyway.
|
|
35
|
+
*
|
|
36
|
+
* If a user does happen to register a handler on a non-
|
|
37
|
+
* fatal signal like SIGWINCH or something, and then
|
|
38
|
+
* exit, it'll end up firing `process.emit('exit')`, so
|
|
39
|
+
* the handler will be fired anyway.
|
|
40
|
+
*
|
|
41
|
+
* SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
|
|
42
|
+
* artificially, inherently leave the process in a
|
|
43
|
+
* state from which it is not safe to try and enter JS
|
|
44
|
+
* listeners.
|
|
45
|
+
*/
|
|
46
|
+
const signals = [];
|
|
47
|
+
signals.push("SIGHUP", "SIGINT", "SIGTERM");
|
|
48
|
+
if (process.platform !== "win32") signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
|
|
49
|
+
if (process.platform === "linux") signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
|
|
50
|
+
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
|
|
53
|
+
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";
|
|
54
|
+
const kExitEmitter = Symbol.for("signal-exit emitter");
|
|
55
|
+
const global = globalThis;
|
|
56
|
+
const ObjectDefineProperty = Object.defineProperty.bind(Object);
|
|
57
|
+
var Emitter = class {
|
|
58
|
+
emitted = {
|
|
59
|
+
afterExit: false,
|
|
60
|
+
exit: false
|
|
61
|
+
};
|
|
62
|
+
listeners = {
|
|
63
|
+
afterExit: [],
|
|
64
|
+
exit: []
|
|
65
|
+
};
|
|
66
|
+
count = 0;
|
|
67
|
+
id = Math.random();
|
|
68
|
+
constructor() {
|
|
69
|
+
if (global[kExitEmitter]) return global[kExitEmitter];
|
|
70
|
+
ObjectDefineProperty(global, kExitEmitter, {
|
|
71
|
+
value: this,
|
|
72
|
+
writable: false,
|
|
73
|
+
enumerable: false,
|
|
74
|
+
configurable: false
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
on(ev, fn) {
|
|
78
|
+
this.listeners[ev].push(fn);
|
|
79
|
+
}
|
|
80
|
+
removeListener(ev, fn) {
|
|
81
|
+
const list = this.listeners[ev];
|
|
82
|
+
const i$1 = list.indexOf(fn);
|
|
83
|
+
/* c8 ignore start */
|
|
84
|
+
if (i$1 === -1) return;
|
|
85
|
+
/* c8 ignore stop */
|
|
86
|
+
if (i$1 === 0 && list.length === 1) list.length = 0;
|
|
87
|
+
else list.splice(i$1, 1);
|
|
88
|
+
}
|
|
89
|
+
emit(ev, code, signal) {
|
|
90
|
+
if (this.emitted[ev]) return false;
|
|
91
|
+
this.emitted[ev] = true;
|
|
92
|
+
let ret = false;
|
|
93
|
+
for (const fn of this.listeners[ev]) ret = fn(code, signal) === true || ret;
|
|
94
|
+
if (ev === "exit") ret = this.emit("afterExit", code, signal) || ret;
|
|
95
|
+
return ret;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
var SignalExitBase = class {};
|
|
99
|
+
const signalExitWrap = (handler) => {
|
|
100
|
+
return {
|
|
101
|
+
onExit(cb, opts) {
|
|
102
|
+
return handler.onExit(cb, opts);
|
|
103
|
+
},
|
|
104
|
+
load() {
|
|
105
|
+
return handler.load();
|
|
106
|
+
},
|
|
107
|
+
unload() {
|
|
108
|
+
return handler.unload();
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
var SignalExitFallback = class extends SignalExitBase {
|
|
113
|
+
onExit() {
|
|
114
|
+
return () => {};
|
|
115
|
+
}
|
|
116
|
+
load() {}
|
|
117
|
+
unload() {}
|
|
118
|
+
};
|
|
119
|
+
var SignalExit = class extends SignalExitBase {
|
|
120
|
+
/* c8 ignore start */
|
|
121
|
+
#hupSig = process$2.platform === "win32" ? "SIGINT" : "SIGHUP";
|
|
122
|
+
/* c8 ignore stop */
|
|
123
|
+
#emitter = new Emitter();
|
|
124
|
+
#process;
|
|
125
|
+
#originalProcessEmit;
|
|
126
|
+
#originalProcessReallyExit;
|
|
127
|
+
#sigListeners = {};
|
|
128
|
+
#loaded = false;
|
|
129
|
+
constructor(process$3) {
|
|
130
|
+
super();
|
|
131
|
+
this.#process = process$3;
|
|
132
|
+
this.#sigListeners = {};
|
|
133
|
+
for (const sig of signals) this.#sigListeners[sig] = () => {
|
|
134
|
+
const listeners = this.#process.listeners(sig);
|
|
135
|
+
let { count } = this.#emitter;
|
|
136
|
+
/* c8 ignore start */
|
|
137
|
+
const p = process$3;
|
|
138
|
+
if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") count += p.__signal_exit_emitter__.count;
|
|
139
|
+
/* c8 ignore stop */
|
|
140
|
+
if (listeners.length === count) {
|
|
141
|
+
this.unload();
|
|
142
|
+
const ret = this.#emitter.emit("exit", null, sig);
|
|
143
|
+
/* c8 ignore start */
|
|
144
|
+
const s$1 = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
145
|
+
if (!ret) process$3.kill(process$3.pid, s$1);
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
this.#originalProcessReallyExit = process$3.reallyExit;
|
|
149
|
+
this.#originalProcessEmit = process$3.emit;
|
|
150
|
+
}
|
|
151
|
+
onExit(cb, opts) {
|
|
152
|
+
/* c8 ignore start */
|
|
153
|
+
if (!processOk(this.#process)) return () => {};
|
|
154
|
+
/* c8 ignore stop */
|
|
155
|
+
if (this.#loaded === false) this.load();
|
|
156
|
+
const ev = opts?.alwaysLast ? "afterExit" : "exit";
|
|
157
|
+
this.#emitter.on(ev, cb);
|
|
158
|
+
return () => {
|
|
159
|
+
this.#emitter.removeListener(ev, cb);
|
|
160
|
+
if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) this.unload();
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
load() {
|
|
164
|
+
if (this.#loaded) return;
|
|
165
|
+
this.#loaded = true;
|
|
166
|
+
this.#emitter.count += 1;
|
|
167
|
+
for (const sig of signals) try {
|
|
168
|
+
const fn = this.#sigListeners[sig];
|
|
169
|
+
if (fn) this.#process.on(sig, fn);
|
|
170
|
+
} catch (_$1) {}
|
|
171
|
+
this.#process.emit = (ev, ...a$1) => {
|
|
172
|
+
return this.#processEmit(ev, ...a$1);
|
|
173
|
+
};
|
|
174
|
+
this.#process.reallyExit = (code) => {
|
|
175
|
+
return this.#processReallyExit(code);
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
unload() {
|
|
179
|
+
if (!this.#loaded) return;
|
|
180
|
+
this.#loaded = false;
|
|
181
|
+
signals.forEach((sig) => {
|
|
182
|
+
const listener = this.#sigListeners[sig];
|
|
183
|
+
/* c8 ignore start */
|
|
184
|
+
if (!listener) throw new Error("Listener not defined for signal: " + sig);
|
|
185
|
+
/* c8 ignore stop */
|
|
186
|
+
try {
|
|
187
|
+
this.#process.removeListener(sig, listener);
|
|
188
|
+
} catch (_$1) {}
|
|
189
|
+
/* c8 ignore stop */
|
|
190
|
+
});
|
|
191
|
+
this.#process.emit = this.#originalProcessEmit;
|
|
192
|
+
this.#process.reallyExit = this.#originalProcessReallyExit;
|
|
193
|
+
this.#emitter.count -= 1;
|
|
194
|
+
}
|
|
195
|
+
#processReallyExit(code) {
|
|
196
|
+
/* c8 ignore start */
|
|
197
|
+
if (!processOk(this.#process)) return 0;
|
|
198
|
+
this.#process.exitCode = code || 0;
|
|
199
|
+
/* c8 ignore stop */
|
|
200
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
201
|
+
return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
|
|
202
|
+
}
|
|
203
|
+
#processEmit(ev, ...args) {
|
|
204
|
+
const og = this.#originalProcessEmit;
|
|
205
|
+
if (ev === "exit" && processOk(this.#process)) {
|
|
206
|
+
if (typeof args[0] === "number") this.#process.exitCode = args[0];
|
|
207
|
+
/* c8 ignore start */
|
|
208
|
+
const ret = og.call(this.#process, ev, ...args);
|
|
209
|
+
/* c8 ignore start */
|
|
210
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
211
|
+
/* c8 ignore stop */
|
|
212
|
+
return ret;
|
|
213
|
+
} else return og.call(this.#process, ev, ...args);
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
const process$2 = globalThis.process;
|
|
217
|
+
const { onExit, load, unload } = signalExitWrap(processOk(process$2) ? new SignalExit(process$2) : new SignalExitFallback());
|
|
218
|
+
|
|
219
|
+
//#endregion
|
|
13
220
|
//#region ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/core.mjs
|
|
14
221
|
const LogLevels = {
|
|
15
222
|
silent: Number.NEGATIVE_INFINITY,
|
|
@@ -956,7 +1163,7 @@ function createConsola(options$1 = {}) {
|
|
|
956
1163
|
defaults: { level },
|
|
957
1164
|
stdout: process.stdout,
|
|
958
1165
|
stderr: process.stderr,
|
|
959
|
-
prompt: (...args) => Promise.resolve().then(() => require("./shared/prompt-
|
|
1166
|
+
prompt: (...args) => Promise.resolve().then(() => require("./shared/prompt-Q05EYrFb.cjs")).then((m) => m.prompt(...args)),
|
|
960
1167
|
reporters: options$1.reporters || [options$1.fancy ?? !(T || R) ? new FancyReporter() : new BasicReporter()],
|
|
961
1168
|
...options$1
|
|
962
1169
|
});
|
|
@@ -1222,207 +1429,6 @@ function parseCliArguments() {
|
|
|
1222
1429
|
return normalizeCliOptions(values, positionals);
|
|
1223
1430
|
}
|
|
1224
1431
|
|
|
1225
|
-
//#endregion
|
|
1226
|
-
//#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
|
|
1227
|
-
/**
|
|
1228
|
-
* This is not the set of all possible signals.
|
|
1229
|
-
*
|
|
1230
|
-
* It IS, however, the set of all signals that trigger
|
|
1231
|
-
* an exit on either Linux or BSD systems. Linux is a
|
|
1232
|
-
* superset of the signal names supported on BSD, and
|
|
1233
|
-
* the unknown signals just fail to register, so we can
|
|
1234
|
-
* catch that easily enough.
|
|
1235
|
-
*
|
|
1236
|
-
* Windows signals are a different set, since there are
|
|
1237
|
-
* signals that terminate Windows processes, but don't
|
|
1238
|
-
* terminate (or don't even exist) on Posix systems.
|
|
1239
|
-
*
|
|
1240
|
-
* Don't bother with SIGKILL. It's uncatchable, which
|
|
1241
|
-
* means that we can't fire any callbacks anyway.
|
|
1242
|
-
*
|
|
1243
|
-
* If a user does happen to register a handler on a non-
|
|
1244
|
-
* fatal signal like SIGWINCH or something, and then
|
|
1245
|
-
* exit, it'll end up firing `process.emit('exit')`, so
|
|
1246
|
-
* the handler will be fired anyway.
|
|
1247
|
-
*
|
|
1248
|
-
* SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
|
|
1249
|
-
* artificially, inherently leave the process in a
|
|
1250
|
-
* state from which it is not safe to try and enter JS
|
|
1251
|
-
* listeners.
|
|
1252
|
-
*/
|
|
1253
|
-
const signals = [];
|
|
1254
|
-
signals.push("SIGHUP", "SIGINT", "SIGTERM");
|
|
1255
|
-
if (process.platform !== "win32") signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
|
|
1256
|
-
if (process.platform === "linux") signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
|
|
1257
|
-
|
|
1258
|
-
//#endregion
|
|
1259
|
-
//#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
|
|
1260
|
-
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";
|
|
1261
|
-
const kExitEmitter = Symbol.for("signal-exit emitter");
|
|
1262
|
-
const global = globalThis;
|
|
1263
|
-
const ObjectDefineProperty = Object.defineProperty.bind(Object);
|
|
1264
|
-
var Emitter = class {
|
|
1265
|
-
emitted = {
|
|
1266
|
-
afterExit: false,
|
|
1267
|
-
exit: false
|
|
1268
|
-
};
|
|
1269
|
-
listeners = {
|
|
1270
|
-
afterExit: [],
|
|
1271
|
-
exit: []
|
|
1272
|
-
};
|
|
1273
|
-
count = 0;
|
|
1274
|
-
id = Math.random();
|
|
1275
|
-
constructor() {
|
|
1276
|
-
if (global[kExitEmitter]) return global[kExitEmitter];
|
|
1277
|
-
ObjectDefineProperty(global, kExitEmitter, {
|
|
1278
|
-
value: this,
|
|
1279
|
-
writable: false,
|
|
1280
|
-
enumerable: false,
|
|
1281
|
-
configurable: false
|
|
1282
|
-
});
|
|
1283
|
-
}
|
|
1284
|
-
on(ev, fn) {
|
|
1285
|
-
this.listeners[ev].push(fn);
|
|
1286
|
-
}
|
|
1287
|
-
removeListener(ev, fn) {
|
|
1288
|
-
const list = this.listeners[ev];
|
|
1289
|
-
const i$1 = list.indexOf(fn);
|
|
1290
|
-
/* c8 ignore start */
|
|
1291
|
-
if (i$1 === -1) return;
|
|
1292
|
-
/* c8 ignore stop */
|
|
1293
|
-
if (i$1 === 0 && list.length === 1) list.length = 0;
|
|
1294
|
-
else list.splice(i$1, 1);
|
|
1295
|
-
}
|
|
1296
|
-
emit(ev, code, signal) {
|
|
1297
|
-
if (this.emitted[ev]) return false;
|
|
1298
|
-
this.emitted[ev] = true;
|
|
1299
|
-
let ret = false;
|
|
1300
|
-
for (const fn of this.listeners[ev]) ret = fn(code, signal) === true || ret;
|
|
1301
|
-
if (ev === "exit") ret = this.emit("afterExit", code, signal) || ret;
|
|
1302
|
-
return ret;
|
|
1303
|
-
}
|
|
1304
|
-
};
|
|
1305
|
-
var SignalExitBase = class {};
|
|
1306
|
-
const signalExitWrap = (handler) => {
|
|
1307
|
-
return {
|
|
1308
|
-
onExit(cb, opts) {
|
|
1309
|
-
return handler.onExit(cb, opts);
|
|
1310
|
-
},
|
|
1311
|
-
load() {
|
|
1312
|
-
return handler.load();
|
|
1313
|
-
},
|
|
1314
|
-
unload() {
|
|
1315
|
-
return handler.unload();
|
|
1316
|
-
}
|
|
1317
|
-
};
|
|
1318
|
-
};
|
|
1319
|
-
var SignalExitFallback = class extends SignalExitBase {
|
|
1320
|
-
onExit() {
|
|
1321
|
-
return () => {};
|
|
1322
|
-
}
|
|
1323
|
-
load() {}
|
|
1324
|
-
unload() {}
|
|
1325
|
-
};
|
|
1326
|
-
var SignalExit = class extends SignalExitBase {
|
|
1327
|
-
/* c8 ignore start */
|
|
1328
|
-
#hupSig = process$2.platform === "win32" ? "SIGINT" : "SIGHUP";
|
|
1329
|
-
/* c8 ignore stop */
|
|
1330
|
-
#emitter = new Emitter();
|
|
1331
|
-
#process;
|
|
1332
|
-
#originalProcessEmit;
|
|
1333
|
-
#originalProcessReallyExit;
|
|
1334
|
-
#sigListeners = {};
|
|
1335
|
-
#loaded = false;
|
|
1336
|
-
constructor(process$3) {
|
|
1337
|
-
super();
|
|
1338
|
-
this.#process = process$3;
|
|
1339
|
-
this.#sigListeners = {};
|
|
1340
|
-
for (const sig of signals) this.#sigListeners[sig] = () => {
|
|
1341
|
-
const listeners = this.#process.listeners(sig);
|
|
1342
|
-
let { count } = this.#emitter;
|
|
1343
|
-
/* c8 ignore start */
|
|
1344
|
-
const p = process$3;
|
|
1345
|
-
if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") count += p.__signal_exit_emitter__.count;
|
|
1346
|
-
/* c8 ignore stop */
|
|
1347
|
-
if (listeners.length === count) {
|
|
1348
|
-
this.unload();
|
|
1349
|
-
const ret = this.#emitter.emit("exit", null, sig);
|
|
1350
|
-
/* c8 ignore start */
|
|
1351
|
-
const s$1 = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
1352
|
-
if (!ret) process$3.kill(process$3.pid, s$1);
|
|
1353
|
-
}
|
|
1354
|
-
};
|
|
1355
|
-
this.#originalProcessReallyExit = process$3.reallyExit;
|
|
1356
|
-
this.#originalProcessEmit = process$3.emit;
|
|
1357
|
-
}
|
|
1358
|
-
onExit(cb, opts) {
|
|
1359
|
-
/* c8 ignore start */
|
|
1360
|
-
if (!processOk(this.#process)) return () => {};
|
|
1361
|
-
/* c8 ignore stop */
|
|
1362
|
-
if (this.#loaded === false) this.load();
|
|
1363
|
-
const ev = opts?.alwaysLast ? "afterExit" : "exit";
|
|
1364
|
-
this.#emitter.on(ev, cb);
|
|
1365
|
-
return () => {
|
|
1366
|
-
this.#emitter.removeListener(ev, cb);
|
|
1367
|
-
if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) this.unload();
|
|
1368
|
-
};
|
|
1369
|
-
}
|
|
1370
|
-
load() {
|
|
1371
|
-
if (this.#loaded) return;
|
|
1372
|
-
this.#loaded = true;
|
|
1373
|
-
this.#emitter.count += 1;
|
|
1374
|
-
for (const sig of signals) try {
|
|
1375
|
-
const fn = this.#sigListeners[sig];
|
|
1376
|
-
if (fn) this.#process.on(sig, fn);
|
|
1377
|
-
} catch (_$1) {}
|
|
1378
|
-
this.#process.emit = (ev, ...a$1) => {
|
|
1379
|
-
return this.#processEmit(ev, ...a$1);
|
|
1380
|
-
};
|
|
1381
|
-
this.#process.reallyExit = (code) => {
|
|
1382
|
-
return this.#processReallyExit(code);
|
|
1383
|
-
};
|
|
1384
|
-
}
|
|
1385
|
-
unload() {
|
|
1386
|
-
if (!this.#loaded) return;
|
|
1387
|
-
this.#loaded = false;
|
|
1388
|
-
signals.forEach((sig) => {
|
|
1389
|
-
const listener = this.#sigListeners[sig];
|
|
1390
|
-
/* c8 ignore start */
|
|
1391
|
-
if (!listener) throw new Error("Listener not defined for signal: " + sig);
|
|
1392
|
-
/* c8 ignore stop */
|
|
1393
|
-
try {
|
|
1394
|
-
this.#process.removeListener(sig, listener);
|
|
1395
|
-
} catch (_$1) {}
|
|
1396
|
-
/* c8 ignore stop */
|
|
1397
|
-
});
|
|
1398
|
-
this.#process.emit = this.#originalProcessEmit;
|
|
1399
|
-
this.#process.reallyExit = this.#originalProcessReallyExit;
|
|
1400
|
-
this.#emitter.count -= 1;
|
|
1401
|
-
}
|
|
1402
|
-
#processReallyExit(code) {
|
|
1403
|
-
/* c8 ignore start */
|
|
1404
|
-
if (!processOk(this.#process)) return 0;
|
|
1405
|
-
this.#process.exitCode = code || 0;
|
|
1406
|
-
/* c8 ignore stop */
|
|
1407
|
-
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
1408
|
-
return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
|
|
1409
|
-
}
|
|
1410
|
-
#processEmit(ev, ...args) {
|
|
1411
|
-
const og = this.#originalProcessEmit;
|
|
1412
|
-
if (ev === "exit" && processOk(this.#process)) {
|
|
1413
|
-
if (typeof args[0] === "number") this.#process.exitCode = args[0];
|
|
1414
|
-
/* c8 ignore start */
|
|
1415
|
-
const ret = og.call(this.#process, ev, ...args);
|
|
1416
|
-
/* c8 ignore start */
|
|
1417
|
-
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
1418
|
-
/* c8 ignore stop */
|
|
1419
|
-
return ret;
|
|
1420
|
-
} else return og.call(this.#process, ev, ...args);
|
|
1421
|
-
}
|
|
1422
|
-
};
|
|
1423
|
-
const process$2 = globalThis.process;
|
|
1424
|
-
const { onExit, load, unload } = signalExitWrap(processOk(process$2) ? new SignalExit(process$2) : new SignalExitFallback());
|
|
1425
|
-
|
|
1426
1432
|
//#endregion
|
|
1427
1433
|
//#region src/utils/clear-screen.ts
|
|
1428
1434
|
const CLEAR_SCREEN = "\x1Bc";
|