vite-plus 0.1.1 → 0.1.3

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.
Files changed (43) hide show
  1. package/binding/index.cjs +2 -0
  2. package/binding/index.d.cts +32 -0
  3. package/dist/global/{prompts-CAIahN1u.js → agent-BE4Xze8Q.js} +380 -1280
  4. package/dist/global/{browser-CY4NBwxR.js → browser-CBapUTD0.js} +579 -1023
  5. package/dist/global/{browser-DFpJ6sKb.js → browser-EZnNDcaO.js} +2 -3
  6. package/dist/global/{chunk-CtfvYSle.js → chunk-CgnkrU7a.js} +13 -22
  7. package/dist/global/{cli-truncate-BxinOqz5.js → cli-truncate-Da6Y8aM8.js} +25 -74
  8. package/dist/global/config.js +95 -165
  9. package/dist/global/create.js +353 -496
  10. package/dist/global/{terminal-Cb-NuRkb.js → help-BAGHa8fD.js} +22 -54
  11. package/dist/global/{json-Bfvtp2rL.js → json-BRdVJ52a.js} +24 -58
  12. package/dist/global/{lib-CibYHP32.js → lib-DxappLRQ.js} +19 -43
  13. package/dist/global/{log-update-DdU6_LCN.js → log-update-C8WCYCbc.js} +102 -281
  14. package/dist/global/mcp.js +97 -169
  15. package/dist/global/migrate.js +223 -72
  16. package/dist/global/{package-Pq2biU7_.js → package-YAMvX5PJ.js} +6 -13
  17. package/dist/global/{slice-ansi-BhwAwMdF.js → slice-ansi-Fap0ehe9.js} +21 -52
  18. package/dist/global/{src-C6aLHRsS.js → src-DwSJ0s0I.js} +28 -110
  19. package/dist/global/staged.js +654 -1521
  20. package/dist/global/{strip-ansi-BL-dgd7n.js → strip-ansi-CE-VDMdw.js} +20 -67
  21. package/dist/global/version.js +16 -37
  22. package/dist/global/{workspace-De4OKHV7.js → workspace-lRm8huz4.js} +1645 -2806
  23. package/dist/global/wrap-ansi-Ou9oAs-a.js +3 -0
  24. package/dist/global/{wrap-ansi-Iww6Ak1s.js → wrap-ansi-eywLlPVQ.js} +29 -80
  25. package/dist/index.d.ts +1 -1
  26. package/dist/init-config.js +10 -2
  27. package/dist/run-config.d.ts +17 -0
  28. package/dist/utils/agent.d.ts +15 -1
  29. package/dist/utils/agent.js +104 -20
  30. package/dist/utils/constants.d.ts +1 -0
  31. package/dist/utils/constants.js +2 -0
  32. package/dist/utils/editor.d.ts +16 -3
  33. package/dist/utils/editor.js +55 -17
  34. package/dist/utils/prompts.d.ts +32 -3
  35. package/dist/utils/prompts.js +32 -8
  36. package/dist/utils/skills.js +18 -2
  37. package/dist/utils/tsconfig.d.ts +6 -0
  38. package/dist/utils/tsconfig.js +16 -0
  39. package/package.json +13 -13
  40. package/templates/monorepo/package.json +1 -1
  41. package/dist/global/wrap-ansi-BJxjUEQR.js +0 -4
  42. package/dist/oxlint-config.d.ts +0 -498
  43. package/dist/oxlint-config.js +0 -309
@@ -1,192 +1,84 @@
1
- import { t as stripAnsi } from "./strip-ansi-BL-dgd7n.js";
2
- import { t as sliceAnsi } from "./slice-ansi-BhwAwMdF.js";
3
- import { t as wrapAnsi } from "./wrap-ansi-Iww6Ak1s.js";
1
+ import { t as stripAnsi } from "./strip-ansi-CE-VDMdw.js";
2
+ import { t as sliceAnsi } from "./slice-ansi-Fap0ehe9.js";
3
+ import { t as wrapAnsi } from "./wrap-ansi-eywLlPVQ.js";
4
4
  import process$1 from "node:process";
5
5
  import nodeos__default from "node:os";
6
-
7
6
  //#region ../../node_modules/.pnpm/environment@1.1.0/node_modules/environment/index.js
8
- const isBrowser = globalThis.window?.document !== undefined;
9
- const isNode = globalThis.process?.versions?.node !== undefined;
10
- const isBun = globalThis.process?.versions?.bun !== undefined;
11
- const isDeno = globalThis.Deno?.version?.deno !== undefined;
12
- const isElectron = globalThis.process?.versions?.electron !== undefined;
13
- const isJsDom = globalThis.navigator?.userAgent?.includes("jsdom") === true;
14
- const isWebWorker = typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
15
- const isDedicatedWorker = typeof DedicatedWorkerGlobalScope !== "undefined" && globalThis instanceof DedicatedWorkerGlobalScope;
16
- const isSharedWorker = typeof SharedWorkerGlobalScope !== "undefined" && globalThis instanceof SharedWorkerGlobalScope;
17
- const isServiceWorker = typeof ServiceWorkerGlobalScope !== "undefined" && globalThis instanceof ServiceWorkerGlobalScope;
7
+ const isBrowser = globalThis.window?.document !== void 0;
8
+ globalThis.process?.versions?.node;
9
+ globalThis.process?.versions?.bun;
10
+ globalThis.Deno?.version?.deno;
11
+ globalThis.process?.versions?.electron;
12
+ globalThis.navigator?.userAgent?.includes("jsdom");
13
+ typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
14
+ typeof DedicatedWorkerGlobalScope !== "undefined" && globalThis instanceof DedicatedWorkerGlobalScope;
15
+ typeof SharedWorkerGlobalScope !== "undefined" && globalThis instanceof SharedWorkerGlobalScope;
16
+ typeof ServiceWorkerGlobalScope !== "undefined" && globalThis instanceof ServiceWorkerGlobalScope;
18
17
  const platform = globalThis.navigator?.userAgentData?.platform;
19
- const isMacOs = platform === "macOS" || globalThis.navigator?.platform === "MacIntel" || globalThis.navigator?.userAgent?.includes(" Mac ") === true || globalThis.process?.platform === "darwin";
20
- const isWindows$1 = platform === "Windows" || globalThis.navigator?.platform === "Win32" || globalThis.process?.platform === "win32";
21
- const isLinux = platform === "Linux" || globalThis.navigator?.platform?.startsWith("Linux") === true || globalThis.navigator?.userAgent?.includes(" Linux ") === true || globalThis.process?.platform === "linux";
22
- const isIos = platform === "iOS" || globalThis.navigator?.platform === "MacIntel" && globalThis.navigator?.maxTouchPoints > 1 || /iPad|iPhone|iPod/.test(globalThis.navigator?.platform);
23
- const isAndroid = platform === "Android" || globalThis.navigator?.platform === "Android" || globalThis.navigator?.userAgent?.includes(" Android ") === true || globalThis.process?.platform === "android";
24
-
18
+ platform === "macOS" || globalThis.navigator?.platform === "MacIntel" || globalThis.navigator?.userAgent?.includes(" Mac ") === true || globalThis.process?.platform;
19
+ platform === "Windows" || globalThis.navigator?.platform === "Win32" || globalThis.process?.platform;
20
+ platform === "Linux" || globalThis.navigator?.platform?.startsWith("Linux") === true || globalThis.navigator?.userAgent?.includes(" Linux ") === true || globalThis.process?.platform;
21
+ platform === "iOS" || globalThis.navigator?.platform === "MacIntel" && globalThis.navigator?.maxTouchPoints > 1 || /iPad|iPhone|iPod/.test(globalThis.navigator?.platform);
22
+ platform === "Android" || globalThis.navigator?.platform === "Android" || globalThis.navigator?.userAgent?.includes(" Android ") === true || globalThis.process?.platform;
25
23
  //#endregion
26
24
  //#region ../../node_modules/.pnpm/ansi-escapes@7.2.0/node_modules/ansi-escapes/base.js
27
25
  const ESC = "\x1B[";
28
- const OSC = "\x1B]";
29
- const BEL = "\x07";
30
- const SEP = ";";
31
26
  const isTerminalApp = !isBrowser && process$1.env.TERM_PROGRAM === "Apple_Terminal";
32
27
  const isWindows = !isBrowser && process$1.platform === "win32";
33
- const isTmux = !isBrowser && (process$1.env.TERM?.startsWith("screen") || process$1.env.TERM?.startsWith("tmux") || process$1.env.TMUX !== undefined);
34
- const cwdFunction = isBrowser ? () => {
35
- throw new Error("`process.cwd()` only works in Node.js, not the browser.");
36
- } : process$1.cwd;
37
- const wrapOsc = (sequence) => {
38
- if (isTmux) {
39
- return "\x1BPtmux;" + sequence.replaceAll("\x1B", "\x1B\x1B") + "\x1B\\";
40
- }
41
- return sequence;
42
- };
43
- const cursorTo = (x, y) => {
44
- if (typeof x !== "number") {
45
- throw new TypeError("The `x` argument is required");
46
- }
47
- if (typeof y !== "number") {
48
- return ESC + (x + 1) + "G";
49
- }
50
- return ESC + (y + 1) + SEP + (x + 1) + "H";
51
- };
52
- const cursorMove = (x, y) => {
53
- if (typeof x !== "number") {
54
- throw new TypeError("The `x` argument is required");
55
- }
56
- let returnValue = "";
57
- if (x < 0) {
58
- returnValue += ESC + -x + "D";
59
- } else if (x > 0) {
60
- returnValue += ESC + x + "C";
61
- }
62
- if (y < 0) {
63
- returnValue += ESC + -y + "A";
64
- } else if (y > 0) {
65
- returnValue += ESC + y + "B";
66
- }
67
- return returnValue;
68
- };
28
+ !isBrowser && (process$1.env.TERM?.startsWith("screen") || process$1.env.TERM?.startsWith("tmux") || process$1.env.TMUX);
29
+ isBrowser || process$1.cwd;
69
30
  const cursorUp = (count = 1) => ESC + count + "A";
70
- const cursorDown = (count = 1) => ESC + count + "B";
71
- const cursorForward = (count = 1) => ESC + count + "C";
72
- const cursorBackward = (count = 1) => ESC + count + "D";
73
- const cursorLeft = ESC + "G";
74
- const cursorSavePosition = isTerminalApp ? "\x1B7" : ESC + "s";
75
- const cursorRestorePosition = isTerminalApp ? "\x1B8" : ESC + "u";
76
- const cursorGetPosition = ESC + "6n";
77
- const cursorNextLine = ESC + "E";
78
- const cursorPrevLine = ESC + "F";
79
- const cursorHide = ESC + "?25l";
80
- const cursorShow = ESC + "?25h";
31
+ ESC + "";
32
+ isTerminalApp || ESC + "";
33
+ isTerminalApp || ESC + "";
34
+ ESC + "";
35
+ ESC + "";
36
+ ESC + "";
37
+ ESC + "";
38
+ ESC + "";
81
39
  const eraseLines = (count) => {
82
40
  let clear = "";
83
- for (let i = 0; i < count; i++) {
84
- clear += eraseLine + (i < count - 1 ? cursorUp() : "");
85
- }
86
- if (count) {
87
- clear += cursorLeft;
88
- }
41
+ for (let i = 0; i < count; i++) clear += eraseLine + (i < count - 1 ? cursorUp() : "");
42
+ if (count) clear += "\x1B[G";
89
43
  return clear;
90
44
  };
91
- const eraseEndLine = ESC + "K";
92
- const eraseStartLine = ESC + "1K";
45
+ ESC + "";
46
+ ESC + "";
93
47
  const eraseLine = ESC + "2K";
94
- const eraseDown = ESC + "J";
95
- const eraseUp = ESC + "1J";
48
+ ESC + "";
49
+ ESC + "";
96
50
  const eraseScreen = ESC + "2J";
97
- const scrollUp = ESC + "S";
98
- const scrollDown = ESC + "T";
99
- const clearScreen = "\x1Bc";
100
- const clearViewport = `${eraseScreen}${ESC}H`;
51
+ ESC + "";
52
+ ESC + "";
53
+ `${eraseScreen}${ESC}`;
101
54
  const isOldWindows = () => {
102
- if (isBrowser || !isWindows) {
103
- return false;
104
- }
55
+ if (isBrowser || !isWindows) return false;
105
56
  const parts = nodeos__default.release().split(".");
106
57
  const major = Number(parts[0]);
107
58
  const build = Number(parts[2] ?? 0);
108
- if (major < 10) {
109
- return true;
110
- }
111
- if (major === 10 && build < 10586) {
112
- return true;
113
- }
59
+ if (major < 10) return true;
60
+ if (major === 10 && build < 10586) return true;
114
61
  return false;
115
62
  };
116
- const clearTerminal = isOldWindows() ? `${eraseScreen}${ESC}0f` : `${eraseScreen}${ESC}3J${ESC}H`;
117
- const enterAlternativeScreen = ESC + "?1049h";
118
- const exitAlternativeScreen = ESC + "?1049l";
119
- const beep = BEL;
120
- const link = (text, url) => {
121
- const openLink = wrapOsc(`${OSC}8${SEP}${SEP}${url}${BEL}`);
122
- const closeLink = wrapOsc(`${OSC}8${SEP}${SEP}${BEL}`);
123
- return openLink + text + closeLink;
124
- };
125
- const image = (data, options = {}) => {
126
- let returnValue = `${OSC}1337;File=inline=1`;
127
- if (options.width) {
128
- returnValue += `;width=${options.width}`;
129
- }
130
- if (options.height) {
131
- returnValue += `;height=${options.height}`;
132
- }
133
- if (options.preserveAspectRatio === false) {
134
- returnValue += ";preserveAspectRatio=0";
135
- }
136
- const imageBuffer = Buffer.from(data);
137
- return wrapOsc(returnValue + `;size=${imageBuffer.byteLength}` + ":" + imageBuffer.toString("base64") + BEL);
138
- };
139
- const iTerm = {
140
- setCwd: (cwd = cwdFunction()) => wrapOsc(`${OSC}50;CurrentDir=${cwd}${BEL}`),
141
- annotation(message, options = {}) {
142
- let returnValue = `${OSC}1337;`;
143
- const hasX = options.x !== undefined;
144
- const hasY = options.y !== undefined;
145
- if ((hasX || hasY) && !(hasX && hasY && options.length !== undefined)) {
146
- throw new Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");
147
- }
148
- message = message.replaceAll("|", "");
149
- returnValue += options.isHidden ? "AddHiddenAnnotation=" : "AddAnnotation=";
150
- if (options.length > 0) {
151
- returnValue += (hasX ? [
152
- message,
153
- options.length,
154
- options.x,
155
- options.y
156
- ] : [options.length, message]).join("|");
157
- } else {
158
- returnValue += message;
159
- }
160
- return wrapOsc(returnValue + BEL);
161
- }
162
- };
163
- const ConEmu = { setCwd: (cwd = cwdFunction()) => wrapOsc(`${OSC}9;9;${cwd}${BEL}`) };
164
- const setCwd = (cwd = cwdFunction()) => iTerm.setCwd(cwd) + ConEmu.setCwd(cwd);
165
-
63
+ isOldWindows() ? `${eraseScreen}${ESC}` : `${eraseScreen}${ESC}${ESC}`;
64
+ ESC + "";
65
+ ESC + "";
166
66
  //#endregion
167
67
  //#region ../../node_modules/.pnpm/mimic-function@5.0.1/node_modules/mimic-function/index.js
168
68
  const copyProperty = (to, from, property, ignoreNonConfigurable) => {
169
- if (property === "length" || property === "prototype") {
170
- return;
171
- }
172
- if (property === "arguments" || property === "caller") {
173
- return;
174
- }
69
+ if (property === "length" || property === "prototype") return;
70
+ if (property === "arguments" || property === "caller") return;
175
71
  const toDescriptor = Object.getOwnPropertyDescriptor(to, property);
176
72
  const fromDescriptor = Object.getOwnPropertyDescriptor(from, property);
177
- if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {
178
- return;
179
- }
73
+ if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) return;
180
74
  Object.defineProperty(to, property, fromDescriptor);
181
75
  };
182
76
  const canCopyProperty = function(toDescriptor, fromDescriptor) {
183
- return toDescriptor === undefined || toDescriptor.configurable || toDescriptor.writable === fromDescriptor.writable && toDescriptor.enumerable === fromDescriptor.enumerable && toDescriptor.configurable === fromDescriptor.configurable && (toDescriptor.writable || toDescriptor.value === fromDescriptor.value);
77
+ return toDescriptor === void 0 || toDescriptor.configurable || toDescriptor.writable === fromDescriptor.writable && toDescriptor.enumerable === fromDescriptor.enumerable && toDescriptor.configurable === fromDescriptor.configurable && (toDescriptor.writable || toDescriptor.value === fromDescriptor.value);
184
78
  };
185
79
  const changePrototype = (to, from) => {
186
80
  const fromPrototype = Object.getPrototypeOf(from);
187
- if (fromPrototype === Object.getPrototypeOf(to)) {
188
- return;
189
- }
81
+ if (fromPrototype === Object.getPrototypeOf(to)) return;
190
82
  Object.setPrototypeOf(to, fromPrototype);
191
83
  };
192
84
  const wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/\n${fromBody}`;
@@ -206,21 +98,16 @@ const changeToString = (to, from, name) => {
206
98
  };
207
99
  function mimicFunction(to, from, { ignoreNonConfigurable = false } = {}) {
208
100
  const { name } = to;
209
- for (const property of Reflect.ownKeys(from)) {
210
- copyProperty(to, from, property, ignoreNonConfigurable);
211
- }
101
+ for (const property of Reflect.ownKeys(from)) copyProperty(to, from, property, ignoreNonConfigurable);
212
102
  changePrototype(to, from);
213
103
  changeToString(to, from, name);
214
104
  return to;
215
105
  }
216
-
217
106
  //#endregion
218
107
  //#region ../../node_modules/.pnpm/onetime@7.0.0/node_modules/onetime/index.js
219
- const calledFunctions = new WeakMap();
108
+ const calledFunctions = /* @__PURE__ */ new WeakMap();
220
109
  const onetime = (function_, options = {}) => {
221
- if (typeof function_ !== "function") {
222
- throw new TypeError("Expected a function");
223
- }
110
+ if (typeof function_ !== "function") throw new TypeError("Expected a function");
224
111
  let returnValue;
225
112
  let callCount = 0;
226
113
  const functionName = function_.displayName || function_.name || "<anonymous>";
@@ -228,10 +115,8 @@ const onetime = (function_, options = {}) => {
228
115
  calledFunctions.set(onetime, ++callCount);
229
116
  if (callCount === 1) {
230
117
  returnValue = function_.apply(this, arguments_);
231
- function_ = undefined;
232
- } else if (options.throw === true) {
233
- throw new Error(`Function \`${functionName}\` can only be called once`);
234
- }
118
+ function_ = void 0;
119
+ } else if (options.throw === true) throw new Error(`Function \`${functionName}\` can only be called once`);
235
120
  return returnValue;
236
121
  };
237
122
  mimicFunction(onetime, function_);
@@ -239,12 +124,9 @@ const onetime = (function_, options = {}) => {
239
124
  return onetime;
240
125
  };
241
126
  onetime.callCount = (function_) => {
242
- if (!calledFunctions.has(function_)) {
243
- throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
244
- }
127
+ if (!calledFunctions.has(function_)) throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
245
128
  return calledFunctions.get(function_);
246
129
  };
247
-
248
130
  //#endregion
249
131
  //#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
250
132
  /**
@@ -275,13 +157,8 @@ onetime.callCount = (function_) => {
275
157
  */
276
158
  const signals = [];
277
159
  signals.push("SIGHUP", "SIGINT", "SIGTERM");
278
- if (process.platform !== "win32") {
279
- signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
280
- }
281
- if (process.platform === "linux") {
282
- signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
283
- }
284
-
160
+ if (process.platform !== "win32") signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
161
+ if (process.platform === "linux") signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
285
162
  //#endregion
286
163
  //#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
287
164
  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";
@@ -300,9 +177,7 @@ var Emitter = class {
300
177
  count = 0;
301
178
  id = Math.random();
302
179
  constructor() {
303
- if (global[kExitEmitter]) {
304
- return global[kExitEmitter];
305
- }
180
+ if (global[kExitEmitter]) return global[kExitEmitter];
306
181
  ObjectDefineProperty(global, kExitEmitter, {
307
182
  value: this,
308
183
  writable: false,
@@ -317,28 +192,17 @@ var Emitter = class {
317
192
  const list = this.listeners[ev];
318
193
  const i = list.indexOf(fn);
319
194
  /* c8 ignore start */
320
- if (i === -1) {
321
- return;
322
- }
195
+ if (i === -1) return;
323
196
  /* c8 ignore stop */
324
- if (i === 0 && list.length === 1) {
325
- list.length = 0;
326
- } else {
327
- list.splice(i, 1);
328
- }
197
+ if (i === 0 && list.length === 1) list.length = 0;
198
+ else list.splice(i, 1);
329
199
  }
330
200
  emit(ev, code, signal) {
331
- if (this.emitted[ev]) {
332
- return false;
333
- }
201
+ if (this.emitted[ev]) return false;
334
202
  this.emitted[ev] = true;
335
203
  let ret = false;
336
- for (const fn of this.listeners[ev]) {
337
- ret = fn(code, signal) === true || ret;
338
- }
339
- if (ev === "exit") {
340
- ret = this.emit("afterExit", code, signal) || ret;
341
- }
204
+ for (const fn of this.listeners[ev]) ret = fn(code, signal) === true || ret;
205
+ if (ev === "exit") ret = this.emit("afterExit", code, signal) || ret;
342
206
  return ret;
343
207
  }
344
208
  };
@@ -377,58 +241,44 @@ var SignalExit = class extends SignalExitBase {
377
241
  super();
378
242
  this.#process = process;
379
243
  this.#sigListeners = {};
380
- for (const sig of signals) {
381
- this.#sigListeners[sig] = () => {
382
- const listeners = this.#process.listeners(sig);
383
- let { count } = this.#emitter;
244
+ for (const sig of signals) this.#sigListeners[sig] = () => {
245
+ const listeners = this.#process.listeners(sig);
246
+ let { count } = this.#emitter;
247
+ /* c8 ignore start */
248
+ const p = process;
249
+ if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") count += p.__signal_exit_emitter__.count;
250
+ /* c8 ignore stop */
251
+ if (listeners.length === count) {
252
+ this.unload();
253
+ const ret = this.#emitter.emit("exit", null, sig);
384
254
  /* c8 ignore start */
385
- const p = process;
386
- if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
387
- count += p.__signal_exit_emitter__.count;
388
- }
389
- /* c8 ignore stop */
390
- if (listeners.length === count) {
391
- this.unload();
392
- const ret = this.#emitter.emit("exit", null, sig);
393
- /* c8 ignore start */
394
- const s = sig === "SIGHUP" ? this.#hupSig : sig;
395
- if (!ret) process.kill(process.pid, s);
396
- }
397
- };
398
- }
255
+ const s = sig === "SIGHUP" ? this.#hupSig : sig;
256
+ if (!ret) process.kill(process.pid, s);
257
+ }
258
+ };
399
259
  this.#originalProcessReallyExit = process.reallyExit;
400
260
  this.#originalProcessEmit = process.emit;
401
261
  }
402
262
  onExit(cb, opts) {
403
263
  /* c8 ignore start */
404
- if (!processOk(this.#process)) {
405
- return () => {};
406
- }
264
+ if (!processOk(this.#process)) return () => {};
407
265
  /* c8 ignore stop */
408
- if (this.#loaded === false) {
409
- this.load();
410
- }
266
+ if (this.#loaded === false) this.load();
411
267
  const ev = opts?.alwaysLast ? "afterExit" : "exit";
412
268
  this.#emitter.on(ev, cb);
413
269
  return () => {
414
270
  this.#emitter.removeListener(ev, cb);
415
- if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) {
416
- this.unload();
417
- }
271
+ if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) this.unload();
418
272
  };
419
273
  }
420
274
  load() {
421
- if (this.#loaded) {
422
- return;
423
- }
275
+ if (this.#loaded) return;
424
276
  this.#loaded = true;
425
277
  this.#emitter.count += 1;
426
- for (const sig of signals) {
427
- try {
428
- const fn = this.#sigListeners[sig];
429
- if (fn) this.#process.on(sig, fn);
430
- } catch (_) {}
431
- }
278
+ for (const sig of signals) try {
279
+ const fn = this.#sigListeners[sig];
280
+ if (fn) this.#process.on(sig, fn);
281
+ } catch (_) {}
432
282
  this.#process.emit = (ev, ...a) => {
433
283
  return this.#processEmit(ev, ...a);
434
284
  };
@@ -437,16 +287,12 @@ var SignalExit = class extends SignalExitBase {
437
287
  };
438
288
  }
439
289
  unload() {
440
- if (!this.#loaded) {
441
- return;
442
- }
290
+ if (!this.#loaded) return;
443
291
  this.#loaded = false;
444
292
  signals.forEach((sig) => {
445
293
  const listener = this.#sigListeners[sig];
446
294
  /* c8 ignore start */
447
- if (!listener) {
448
- throw new Error("Listener not defined for signal: " + sig);
449
- }
295
+ if (!listener) throw new Error("Listener not defined for signal: " + sig);
450
296
  /* c8 ignore stop */
451
297
  try {
452
298
  this.#process.removeListener(sig, listener);
@@ -459,9 +305,7 @@ var SignalExit = class extends SignalExitBase {
459
305
  }
460
306
  #processReallyExit(code) {
461
307
  /* c8 ignore start */
462
- if (!processOk(this.#process)) {
463
- return 0;
464
- }
308
+ if (!processOk(this.#process)) return 0;
465
309
  this.#process.exitCode = code || 0;
466
310
  /* c8 ignore stop */
467
311
  this.#emitter.emit("exit", this.#process.exitCode, null);
@@ -470,62 +314,46 @@ var SignalExit = class extends SignalExitBase {
470
314
  #processEmit(ev, ...args) {
471
315
  const og = this.#originalProcessEmit;
472
316
  if (ev === "exit" && processOk(this.#process)) {
473
- if (typeof args[0] === "number") {
474
- this.#process.exitCode = args[0];
475
- }
317
+ if (typeof args[0] === "number") this.#process.exitCode = args[0];
476
318
  /* c8 ignore start */
477
319
  const ret = og.call(this.#process, ev, ...args);
478
320
  /* c8 ignore start */
479
321
  this.#emitter.emit("exit", this.#process.exitCode, null);
480
322
  /* c8 ignore stop */
481
323
  return ret;
482
- } else {
483
- return og.call(this.#process, ev, ...args);
484
- }
324
+ } else return og.call(this.#process, ev, ...args);
485
325
  }
486
326
  };
487
327
  const process$2 = globalThis.process;
488
328
  const { onExit, load, unload } = signalExitWrap(processOk(process$2) ? new SignalExit(process$2) : new SignalExitFallback());
489
-
490
329
  //#endregion
491
330
  //#region ../../node_modules/.pnpm/restore-cursor@5.1.0/node_modules/restore-cursor/index.js
492
- const terminal = process$1.stderr.isTTY ? process$1.stderr : process$1.stdout.isTTY ? process$1.stdout : undefined;
331
+ const terminal = process$1.stderr.isTTY ? process$1.stderr : process$1.stdout.isTTY ? process$1.stdout : void 0;
493
332
  const restoreCursor = terminal ? onetime(() => {
494
333
  onExit(() => {
495
334
  terminal.write("\x1B[?25h");
496
335
  }, { alwaysLast: true });
497
336
  }) : () => {};
498
-
499
337
  //#endregion
500
338
  //#region ../../node_modules/.pnpm/cli-cursor@5.0.0/node_modules/cli-cursor/index.js
501
339
  let isHidden = false;
502
340
  const cliCursor = {};
503
341
  cliCursor.show = (writableStream = process$1.stderr) => {
504
- if (!writableStream.isTTY) {
505
- return;
506
- }
342
+ if (!writableStream.isTTY) return;
507
343
  isHidden = false;
508
344
  writableStream.write("\x1B[?25h");
509
345
  };
510
346
  cliCursor.hide = (writableStream = process$1.stderr) => {
511
- if (!writableStream.isTTY) {
512
- return;
513
- }
347
+ if (!writableStream.isTTY) return;
514
348
  restoreCursor();
515
349
  isHidden = true;
516
350
  writableStream.write("\x1B[?25l");
517
351
  };
518
352
  cliCursor.toggle = (force, writableStream) => {
519
- if (force !== undefined) {
520
- isHidden = force;
521
- }
522
- if (isHidden) {
523
- cliCursor.show(writableStream);
524
- } else {
525
- cliCursor.hide(writableStream);
526
- }
353
+ if (force !== void 0) isHidden = force;
354
+ if (isHidden) cliCursor.show(writableStream);
355
+ else cliCursor.hide(writableStream);
527
356
  };
528
-
529
357
  //#endregion
530
358
  //#region ../../node_modules/.pnpm/log-update@6.1.0/node_modules/log-update/index.js
531
359
  const defaultTerminalHeight = 24;
@@ -546,14 +374,10 @@ function createLogUpdate(stream, { showCursor = false } = {}) {
546
374
  previousLineCount = 0;
547
375
  };
548
376
  const render = (...arguments_) => {
549
- if (!showCursor) {
550
- cliCursor.hide();
551
- }
377
+ if (!showCursor) cliCursor.hide();
552
378
  let output = fitToTerminalHeight(stream, arguments_.join(" ") + "\n");
553
379
  const width = getWidth(stream);
554
- if (output === previousOutput && previousWidth === width) {
555
- return;
556
- }
380
+ if (output === previousOutput && previousWidth === width) return;
557
381
  previousOutput = output;
558
382
  previousWidth = width;
559
383
  output = wrapAnsi(output, width, {
@@ -570,14 +394,11 @@ function createLogUpdate(stream, { showCursor = false } = {}) {
570
394
  };
571
395
  render.done = () => {
572
396
  reset();
573
- if (!showCursor) {
574
- cliCursor.show();
575
- }
397
+ if (!showCursor) cliCursor.show();
576
398
  };
577
399
  return render;
578
400
  }
579
- const logUpdate = createLogUpdate(process$1.stdout);
580
- const logUpdateStderr = createLogUpdate(process$1.stderr);
581
-
401
+ createLogUpdate(process$1.stdout);
402
+ createLogUpdate(process$1.stderr);
582
403
  //#endregion
583
- export { createLogUpdate };
404
+ export { createLogUpdate };