@listr2/manager 3.0.1 → 3.0.2
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/index.cjs +23 -2360
- package/dist/index.js +1 -2361
- package/package.json +5 -3
- package/dist/chunk-DWy1uDak.cjs +0 -39
- package/dist/chunk-Ye9CTm_R.js +0 -27
- package/dist/cli-truncate-BZsUcSxP.cjs +0 -125
- package/dist/cli-truncate-DY-z6Ecp.js +0 -125
- package/dist/log-update-4uRZgyzJ.cjs +0 -521
- package/dist/log-update-waQufObt.js +0 -520
- package/dist/string-width-BnS-vObO.js +0 -245
- package/dist/string-width-fWmCaoVR.cjs +0 -268
- package/dist/wrap-ansi-CVXwzrKr.js +0 -4
- package/dist/wrap-ansi-CguIj--u.cjs +0 -4
- package/dist/wrap-ansi-DS_DM18W.cjs +0 -134
- package/dist/wrap-ansi-WE3HDX1z.js +0 -129
|
@@ -1,521 +0,0 @@
|
|
|
1
|
-
const require_chunk = require('./chunk-DWy1uDak.cjs');
|
|
2
|
-
const require_string_width = require('./string-width-fWmCaoVR.cjs');
|
|
3
|
-
const require_wrap_ansi = require('./wrap-ansi-DS_DM18W.cjs');
|
|
4
|
-
const node_process = require_chunk.__toESM(require("node:process"));
|
|
5
|
-
|
|
6
|
-
//#region ../../node_modules/.pnpm/environment@1.1.0/node_modules/environment/index.js
|
|
7
|
-
const isBrowser = globalThis.window?.document !== void 0;
|
|
8
|
-
const isNode = globalThis.process?.versions?.node !== void 0;
|
|
9
|
-
const isBun = globalThis.process?.versions?.bun !== void 0;
|
|
10
|
-
const isDeno = globalThis.Deno?.version?.deno !== void 0;
|
|
11
|
-
const isElectron = globalThis.process?.versions?.electron !== void 0;
|
|
12
|
-
const isJsDom = globalThis.navigator?.userAgent?.includes("jsdom") === true;
|
|
13
|
-
const isWebWorker = typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
|
|
14
|
-
const isDedicatedWorker = typeof DedicatedWorkerGlobalScope !== "undefined" && globalThis instanceof DedicatedWorkerGlobalScope;
|
|
15
|
-
const isSharedWorker = typeof SharedWorkerGlobalScope !== "undefined" && globalThis instanceof SharedWorkerGlobalScope;
|
|
16
|
-
const isServiceWorker = typeof ServiceWorkerGlobalScope !== "undefined" && globalThis instanceof ServiceWorkerGlobalScope;
|
|
17
|
-
const platform = globalThis.navigator?.userAgentData?.platform;
|
|
18
|
-
const isMacOs = platform === "macOS" || globalThis.navigator?.platform === "MacIntel" || globalThis.navigator?.userAgent?.includes(" Mac ") === true || globalThis.process?.platform === "darwin";
|
|
19
|
-
const isWindows$1 = platform === "Windows" || globalThis.navigator?.platform === "Win32" || globalThis.process?.platform === "win32";
|
|
20
|
-
const isLinux = platform === "Linux" || globalThis.navigator?.platform?.startsWith("Linux") === true || globalThis.navigator?.userAgent?.includes(" Linux ") === true || globalThis.process?.platform === "linux";
|
|
21
|
-
const isIos = platform === "iOS" || globalThis.navigator?.platform === "MacIntel" && globalThis.navigator?.maxTouchPoints > 1 || /iPad|iPhone|iPod/.test(globalThis.navigator?.platform);
|
|
22
|
-
const isAndroid = platform === "Android" || globalThis.navigator?.platform === "Android" || globalThis.navigator?.userAgent?.includes(" Android ") === true || globalThis.process?.platform === "android";
|
|
23
|
-
|
|
24
|
-
//#endregion
|
|
25
|
-
//#region ../../node_modules/.pnpm/ansi-escapes@7.0.0/node_modules/ansi-escapes/base.js
|
|
26
|
-
const ESC = "\x1B[";
|
|
27
|
-
const isTerminalApp = !isBrowser && node_process.default.env.TERM_PROGRAM === "Apple_Terminal";
|
|
28
|
-
const isWindows = !isBrowser && node_process.default.platform === "win32";
|
|
29
|
-
const cwdFunction = isBrowser ? () => {
|
|
30
|
-
throw new Error("`process.cwd()` only works in Node.js, not the browser.");
|
|
31
|
-
} : node_process.default.cwd;
|
|
32
|
-
const cursorUp = (count = 1) => ESC + count + "A";
|
|
33
|
-
const cursorLeft = ESC + "G";
|
|
34
|
-
const cursorSavePosition = isTerminalApp ? "\x1B7" : ESC + "s";
|
|
35
|
-
const cursorRestorePosition = isTerminalApp ? "\x1B8" : ESC + "u";
|
|
36
|
-
const cursorGetPosition = ESC + "6n";
|
|
37
|
-
const cursorNextLine = ESC + "E";
|
|
38
|
-
const cursorPrevLine = ESC + "F";
|
|
39
|
-
const cursorHide = ESC + "?25l";
|
|
40
|
-
const cursorShow = ESC + "?25h";
|
|
41
|
-
const eraseLines = (count) => {
|
|
42
|
-
let clear = "";
|
|
43
|
-
for (let i = 0; i < count; i++) clear += eraseLine + (i < count - 1 ? cursorUp() : "");
|
|
44
|
-
if (count) clear += cursorLeft;
|
|
45
|
-
return clear;
|
|
46
|
-
};
|
|
47
|
-
const eraseEndLine = ESC + "K";
|
|
48
|
-
const eraseStartLine = ESC + "1K";
|
|
49
|
-
const eraseLine = ESC + "2K";
|
|
50
|
-
const eraseDown = ESC + "J";
|
|
51
|
-
const eraseUp = ESC + "1J";
|
|
52
|
-
const eraseScreen = ESC + "2J";
|
|
53
|
-
const scrollUp = ESC + "S";
|
|
54
|
-
const scrollDown = ESC + "T";
|
|
55
|
-
const clearTerminal = isWindows ? `${eraseScreen}${ESC}0f` : `${eraseScreen}${ESC}3J${ESC}H`;
|
|
56
|
-
const enterAlternativeScreen = ESC + "?1049h";
|
|
57
|
-
const exitAlternativeScreen = ESC + "?1049l";
|
|
58
|
-
|
|
59
|
-
//#endregion
|
|
60
|
-
//#region ../../node_modules/.pnpm/mimic-function@5.0.1/node_modules/mimic-function/index.js
|
|
61
|
-
const copyProperty = (to, from, property, ignoreNonConfigurable) => {
|
|
62
|
-
if (property === "length" || property === "prototype") return;
|
|
63
|
-
if (property === "arguments" || property === "caller") return;
|
|
64
|
-
const toDescriptor = Object.getOwnPropertyDescriptor(to, property);
|
|
65
|
-
const fromDescriptor = Object.getOwnPropertyDescriptor(from, property);
|
|
66
|
-
if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) return;
|
|
67
|
-
Object.defineProperty(to, property, fromDescriptor);
|
|
68
|
-
};
|
|
69
|
-
const canCopyProperty = function(toDescriptor, fromDescriptor) {
|
|
70
|
-
return toDescriptor === void 0 || toDescriptor.configurable || toDescriptor.writable === fromDescriptor.writable && toDescriptor.enumerable === fromDescriptor.enumerable && toDescriptor.configurable === fromDescriptor.configurable && (toDescriptor.writable || toDescriptor.value === fromDescriptor.value);
|
|
71
|
-
};
|
|
72
|
-
const changePrototype = (to, from) => {
|
|
73
|
-
const fromPrototype = Object.getPrototypeOf(from);
|
|
74
|
-
if (fromPrototype === Object.getPrototypeOf(to)) return;
|
|
75
|
-
Object.setPrototypeOf(to, fromPrototype);
|
|
76
|
-
};
|
|
77
|
-
const wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/\n${fromBody}`;
|
|
78
|
-
const toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, "toString");
|
|
79
|
-
const toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, "name");
|
|
80
|
-
const changeToString = (to, from, name) => {
|
|
81
|
-
const withName = name === "" ? "" : `with ${name.trim()}() `;
|
|
82
|
-
const newToString = wrappedToString.bind(null, withName, from.toString());
|
|
83
|
-
Object.defineProperty(newToString, "name", toStringName);
|
|
84
|
-
const { writable, enumerable, configurable } = toStringDescriptor;
|
|
85
|
-
Object.defineProperty(to, "toString", {
|
|
86
|
-
value: newToString,
|
|
87
|
-
writable,
|
|
88
|
-
enumerable,
|
|
89
|
-
configurable
|
|
90
|
-
});
|
|
91
|
-
};
|
|
92
|
-
function mimicFunction(to, from, { ignoreNonConfigurable = false } = {}) {
|
|
93
|
-
const { name } = to;
|
|
94
|
-
for (const property of Reflect.ownKeys(from)) copyProperty(to, from, property, ignoreNonConfigurable);
|
|
95
|
-
changePrototype(to, from);
|
|
96
|
-
changeToString(to, from, name);
|
|
97
|
-
return to;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
//#endregion
|
|
101
|
-
//#region ../../node_modules/.pnpm/onetime@7.0.0/node_modules/onetime/index.js
|
|
102
|
-
const calledFunctions = /* @__PURE__ */ new WeakMap();
|
|
103
|
-
const onetime = (function_, options = {}) => {
|
|
104
|
-
if (typeof function_ !== "function") throw new TypeError("Expected a function");
|
|
105
|
-
let returnValue;
|
|
106
|
-
let callCount = 0;
|
|
107
|
-
const functionName = function_.displayName || function_.name || "<anonymous>";
|
|
108
|
-
const onetime$1 = function(...arguments_) {
|
|
109
|
-
calledFunctions.set(onetime$1, ++callCount);
|
|
110
|
-
if (callCount === 1) {
|
|
111
|
-
returnValue = function_.apply(this, arguments_);
|
|
112
|
-
function_ = void 0;
|
|
113
|
-
} else if (options.throw === true) throw new Error(`Function \`${functionName}\` can only be called once`);
|
|
114
|
-
return returnValue;
|
|
115
|
-
};
|
|
116
|
-
mimicFunction(onetime$1, function_);
|
|
117
|
-
calledFunctions.set(onetime$1, callCount);
|
|
118
|
-
return onetime$1;
|
|
119
|
-
};
|
|
120
|
-
onetime.callCount = (function_) => {
|
|
121
|
-
if (!calledFunctions.has(function_)) throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
|
|
122
|
-
return calledFunctions.get(function_);
|
|
123
|
-
};
|
|
124
|
-
var onetime_default = onetime;
|
|
125
|
-
|
|
126
|
-
//#endregion
|
|
127
|
-
//#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
|
|
128
|
-
/**
|
|
129
|
-
* This is not the set of all possible signals.
|
|
130
|
-
*
|
|
131
|
-
* It IS, however, the set of all signals that trigger
|
|
132
|
-
* an exit on either Linux or BSD systems. Linux is a
|
|
133
|
-
* superset of the signal names supported on BSD, and
|
|
134
|
-
* the unknown signals just fail to register, so we can
|
|
135
|
-
* catch that easily enough.
|
|
136
|
-
*
|
|
137
|
-
* Windows signals are a different set, since there are
|
|
138
|
-
* signals that terminate Windows processes, but don't
|
|
139
|
-
* terminate (or don't even exist) on Posix systems.
|
|
140
|
-
*
|
|
141
|
-
* Don't bother with SIGKILL. It's uncatchable, which
|
|
142
|
-
* means that we can't fire any callbacks anyway.
|
|
143
|
-
*
|
|
144
|
-
* If a user does happen to register a handler on a non-
|
|
145
|
-
* fatal signal like SIGWINCH or something, and then
|
|
146
|
-
* exit, it'll end up firing `process.emit('exit')`, so
|
|
147
|
-
* the handler will be fired anyway.
|
|
148
|
-
*
|
|
149
|
-
* SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
|
|
150
|
-
* artificially, inherently leave the process in a
|
|
151
|
-
* state from which it is not safe to try and enter JS
|
|
152
|
-
* listeners.
|
|
153
|
-
*/
|
|
154
|
-
const signals = [];
|
|
155
|
-
signals.push("SIGHUP", "SIGINT", "SIGTERM");
|
|
156
|
-
if (process.platform !== "win32") signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
|
|
157
|
-
if (process.platform === "linux") signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
|
|
158
|
-
|
|
159
|
-
//#endregion
|
|
160
|
-
//#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
|
|
161
|
-
const processOk = (process$6) => !!process$6 && typeof process$6 === "object" && typeof process$6.removeListener === "function" && typeof process$6.emit === "function" && typeof process$6.reallyExit === "function" && typeof process$6.listeners === "function" && typeof process$6.kill === "function" && typeof process$6.pid === "number" && typeof process$6.on === "function";
|
|
162
|
-
const kExitEmitter = Symbol.for("signal-exit emitter");
|
|
163
|
-
const global = globalThis;
|
|
164
|
-
const ObjectDefineProperty = Object.defineProperty.bind(Object);
|
|
165
|
-
var Emitter = class {
|
|
166
|
-
emitted = {
|
|
167
|
-
afterExit: false,
|
|
168
|
-
exit: false
|
|
169
|
-
};
|
|
170
|
-
listeners = {
|
|
171
|
-
afterExit: [],
|
|
172
|
-
exit: []
|
|
173
|
-
};
|
|
174
|
-
count = 0;
|
|
175
|
-
id = Math.random();
|
|
176
|
-
constructor() {
|
|
177
|
-
if (global[kExitEmitter]) return global[kExitEmitter];
|
|
178
|
-
ObjectDefineProperty(global, kExitEmitter, {
|
|
179
|
-
value: this,
|
|
180
|
-
writable: false,
|
|
181
|
-
enumerable: false,
|
|
182
|
-
configurable: false
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
on(ev, fn) {
|
|
186
|
-
this.listeners[ev].push(fn);
|
|
187
|
-
}
|
|
188
|
-
removeListener(ev, fn) {
|
|
189
|
-
const list = this.listeners[ev];
|
|
190
|
-
const i = list.indexOf(fn);
|
|
191
|
-
/* c8 ignore start */
|
|
192
|
-
if (i === -1) return;
|
|
193
|
-
/* c8 ignore stop */
|
|
194
|
-
if (i === 0 && list.length === 1) list.length = 0;
|
|
195
|
-
else list.splice(i, 1);
|
|
196
|
-
}
|
|
197
|
-
emit(ev, code, signal) {
|
|
198
|
-
if (this.emitted[ev]) return false;
|
|
199
|
-
this.emitted[ev] = true;
|
|
200
|
-
let ret = false;
|
|
201
|
-
for (const fn of this.listeners[ev]) ret = fn(code, signal) === true || ret;
|
|
202
|
-
if (ev === "exit") ret = this.emit("afterExit", code, signal) || ret;
|
|
203
|
-
return ret;
|
|
204
|
-
}
|
|
205
|
-
};
|
|
206
|
-
var SignalExitBase = class {};
|
|
207
|
-
const signalExitWrap = (handler) => {
|
|
208
|
-
return {
|
|
209
|
-
onExit(cb, opts) {
|
|
210
|
-
return handler.onExit(cb, opts);
|
|
211
|
-
},
|
|
212
|
-
load() {
|
|
213
|
-
return handler.load();
|
|
214
|
-
},
|
|
215
|
-
unload() {
|
|
216
|
-
return handler.unload();
|
|
217
|
-
}
|
|
218
|
-
};
|
|
219
|
-
};
|
|
220
|
-
var SignalExitFallback = class extends SignalExitBase {
|
|
221
|
-
onExit() {
|
|
222
|
-
return () => {};
|
|
223
|
-
}
|
|
224
|
-
load() {}
|
|
225
|
-
unload() {}
|
|
226
|
-
};
|
|
227
|
-
var SignalExit = class extends SignalExitBase {
|
|
228
|
-
/* c8 ignore start */
|
|
229
|
-
#hupSig = process$4.platform === "win32" ? "SIGINT" : "SIGHUP";
|
|
230
|
-
/* c8 ignore stop */
|
|
231
|
-
#emitter = new Emitter();
|
|
232
|
-
#process;
|
|
233
|
-
#originalProcessEmit;
|
|
234
|
-
#originalProcessReallyExit;
|
|
235
|
-
#sigListeners = {};
|
|
236
|
-
#loaded = false;
|
|
237
|
-
constructor(process$6) {
|
|
238
|
-
super();
|
|
239
|
-
this.#process = process$6;
|
|
240
|
-
this.#sigListeners = {};
|
|
241
|
-
for (const sig of signals) this.#sigListeners[sig] = () => {
|
|
242
|
-
const listeners = this.#process.listeners(sig);
|
|
243
|
-
let { count } = this.#emitter;
|
|
244
|
-
/* c8 ignore start */
|
|
245
|
-
const p = process$6;
|
|
246
|
-
if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") count += p.__signal_exit_emitter__.count;
|
|
247
|
-
/* c8 ignore stop */
|
|
248
|
-
if (listeners.length === count) {
|
|
249
|
-
this.unload();
|
|
250
|
-
const ret = this.#emitter.emit("exit", null, sig);
|
|
251
|
-
/* c8 ignore start */
|
|
252
|
-
const s = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
253
|
-
if (!ret) process$6.kill(process$6.pid, s);
|
|
254
|
-
}
|
|
255
|
-
};
|
|
256
|
-
this.#originalProcessReallyExit = process$6.reallyExit;
|
|
257
|
-
this.#originalProcessEmit = process$6.emit;
|
|
258
|
-
}
|
|
259
|
-
onExit(cb, opts) {
|
|
260
|
-
/* c8 ignore start */
|
|
261
|
-
if (!processOk(this.#process)) return () => {};
|
|
262
|
-
/* c8 ignore stop */
|
|
263
|
-
if (this.#loaded === false) this.load();
|
|
264
|
-
const ev = opts?.alwaysLast ? "afterExit" : "exit";
|
|
265
|
-
this.#emitter.on(ev, cb);
|
|
266
|
-
return () => {
|
|
267
|
-
this.#emitter.removeListener(ev, cb);
|
|
268
|
-
if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) this.unload();
|
|
269
|
-
};
|
|
270
|
-
}
|
|
271
|
-
load() {
|
|
272
|
-
if (this.#loaded) return;
|
|
273
|
-
this.#loaded = true;
|
|
274
|
-
this.#emitter.count += 1;
|
|
275
|
-
for (const sig of signals) try {
|
|
276
|
-
const fn = this.#sigListeners[sig];
|
|
277
|
-
if (fn) this.#process.on(sig, fn);
|
|
278
|
-
} catch (_) {}
|
|
279
|
-
this.#process.emit = (ev, ...a) => {
|
|
280
|
-
return this.#processEmit(ev, ...a);
|
|
281
|
-
};
|
|
282
|
-
this.#process.reallyExit = (code) => {
|
|
283
|
-
return this.#processReallyExit(code);
|
|
284
|
-
};
|
|
285
|
-
}
|
|
286
|
-
unload() {
|
|
287
|
-
if (!this.#loaded) return;
|
|
288
|
-
this.#loaded = false;
|
|
289
|
-
signals.forEach((sig) => {
|
|
290
|
-
const listener = this.#sigListeners[sig];
|
|
291
|
-
/* c8 ignore start */
|
|
292
|
-
if (!listener) throw new Error("Listener not defined for signal: " + sig);
|
|
293
|
-
/* c8 ignore stop */
|
|
294
|
-
try {
|
|
295
|
-
this.#process.removeListener(sig, listener);
|
|
296
|
-
} catch (_) {}
|
|
297
|
-
/* c8 ignore stop */
|
|
298
|
-
});
|
|
299
|
-
this.#process.emit = this.#originalProcessEmit;
|
|
300
|
-
this.#process.reallyExit = this.#originalProcessReallyExit;
|
|
301
|
-
this.#emitter.count -= 1;
|
|
302
|
-
}
|
|
303
|
-
#processReallyExit(code) {
|
|
304
|
-
/* c8 ignore start */
|
|
305
|
-
if (!processOk(this.#process)) return 0;
|
|
306
|
-
this.#process.exitCode = code || 0;
|
|
307
|
-
/* c8 ignore stop */
|
|
308
|
-
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
309
|
-
return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
|
|
310
|
-
}
|
|
311
|
-
#processEmit(ev, ...args) {
|
|
312
|
-
const og = this.#originalProcessEmit;
|
|
313
|
-
if (ev === "exit" && processOk(this.#process)) {
|
|
314
|
-
if (typeof args[0] === "number") this.#process.exitCode = args[0];
|
|
315
|
-
/* c8 ignore start */
|
|
316
|
-
const ret = og.call(this.#process, ev, ...args);
|
|
317
|
-
/* c8 ignore start */
|
|
318
|
-
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
319
|
-
/* c8 ignore stop */
|
|
320
|
-
return ret;
|
|
321
|
-
} else return og.call(this.#process, ev, ...args);
|
|
322
|
-
}
|
|
323
|
-
};
|
|
324
|
-
const process$4 = globalThis.process;
|
|
325
|
-
const { onExit, load, unload } = signalExitWrap(processOk(process$4) ? new SignalExit(process$4) : new SignalExitFallback());
|
|
326
|
-
|
|
327
|
-
//#endregion
|
|
328
|
-
//#region ../../node_modules/.pnpm/restore-cursor@5.1.0/node_modules/restore-cursor/index.js
|
|
329
|
-
const terminal = node_process.default.stderr.isTTY ? node_process.default.stderr : node_process.default.stdout.isTTY ? node_process.default.stdout : void 0;
|
|
330
|
-
const restoreCursor = terminal ? onetime_default(() => {
|
|
331
|
-
onExit(() => {
|
|
332
|
-
terminal.write("\x1B[?25h");
|
|
333
|
-
}, { alwaysLast: true });
|
|
334
|
-
}) : () => {};
|
|
335
|
-
var restore_cursor_default = restoreCursor;
|
|
336
|
-
|
|
337
|
-
//#endregion
|
|
338
|
-
//#region ../../node_modules/.pnpm/cli-cursor@5.0.0/node_modules/cli-cursor/index.js
|
|
339
|
-
let isHidden = false;
|
|
340
|
-
const cliCursor = {};
|
|
341
|
-
cliCursor.show = (writableStream = node_process.default.stderr) => {
|
|
342
|
-
if (!writableStream.isTTY) return;
|
|
343
|
-
isHidden = false;
|
|
344
|
-
writableStream.write("\x1B[?25h");
|
|
345
|
-
};
|
|
346
|
-
cliCursor.hide = (writableStream = node_process.default.stderr) => {
|
|
347
|
-
if (!writableStream.isTTY) return;
|
|
348
|
-
restore_cursor_default();
|
|
349
|
-
isHidden = true;
|
|
350
|
-
writableStream.write("\x1B[?25l");
|
|
351
|
-
};
|
|
352
|
-
cliCursor.toggle = (force, writableStream) => {
|
|
353
|
-
if (force !== void 0) isHidden = force;
|
|
354
|
-
if (isHidden) cliCursor.show(writableStream);
|
|
355
|
-
else cliCursor.hide(writableStream);
|
|
356
|
-
};
|
|
357
|
-
var cli_cursor_default = cliCursor;
|
|
358
|
-
|
|
359
|
-
//#endregion
|
|
360
|
-
//#region ../../node_modules/.pnpm/is-fullwidth-code-point@5.0.0/node_modules/is-fullwidth-code-point/index.js
|
|
361
|
-
function isFullwidthCodePoint(codePoint) {
|
|
362
|
-
if (!Number.isInteger(codePoint)) return false;
|
|
363
|
-
return require_string_width.eastAsianWidth(codePoint) === 2;
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
//#endregion
|
|
367
|
-
//#region ../../node_modules/.pnpm/slice-ansi@7.1.0/node_modules/slice-ansi/index.js
|
|
368
|
-
const ESCAPES = new Set([27, 155]);
|
|
369
|
-
const CODE_POINT_0 = "0".codePointAt(0);
|
|
370
|
-
const CODE_POINT_9 = "9".codePointAt(0);
|
|
371
|
-
const endCodesSet = /* @__PURE__ */ new Set();
|
|
372
|
-
const endCodesMap = /* @__PURE__ */ new Map();
|
|
373
|
-
for (const [start, end] of require_string_width.ansi_styles_default.codes) {
|
|
374
|
-
endCodesSet.add(require_string_width.ansi_styles_default.color.ansi(end));
|
|
375
|
-
endCodesMap.set(require_string_width.ansi_styles_default.color.ansi(start), require_string_width.ansi_styles_default.color.ansi(end));
|
|
376
|
-
}
|
|
377
|
-
function getEndCode(code) {
|
|
378
|
-
if (endCodesSet.has(code)) return code;
|
|
379
|
-
if (endCodesMap.has(code)) return endCodesMap.get(code);
|
|
380
|
-
code = code.slice(2);
|
|
381
|
-
if (code.includes(";")) code = code[0] + "0";
|
|
382
|
-
const returnValue = require_string_width.ansi_styles_default.codes.get(Number.parseInt(code, 10));
|
|
383
|
-
if (returnValue) return require_string_width.ansi_styles_default.color.ansi(returnValue);
|
|
384
|
-
return require_string_width.ansi_styles_default.reset.open;
|
|
385
|
-
}
|
|
386
|
-
function findNumberIndex(string) {
|
|
387
|
-
for (let index = 0; index < string.length; index++) {
|
|
388
|
-
const codePoint = string.codePointAt(index);
|
|
389
|
-
if (codePoint >= CODE_POINT_0 && codePoint <= CODE_POINT_9) return index;
|
|
390
|
-
}
|
|
391
|
-
return -1;
|
|
392
|
-
}
|
|
393
|
-
function parseAnsiCode(string, offset) {
|
|
394
|
-
string = string.slice(offset, offset + 19);
|
|
395
|
-
const startIndex = findNumberIndex(string);
|
|
396
|
-
if (startIndex !== -1) {
|
|
397
|
-
let endIndex = string.indexOf("m", startIndex);
|
|
398
|
-
if (endIndex === -1) endIndex = string.length;
|
|
399
|
-
return string.slice(0, endIndex + 1);
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
function tokenize(string, endCharacter = Number.POSITIVE_INFINITY) {
|
|
403
|
-
const returnValue = [];
|
|
404
|
-
let index = 0;
|
|
405
|
-
let visibleCount = 0;
|
|
406
|
-
while (index < string.length) {
|
|
407
|
-
const codePoint = string.codePointAt(index);
|
|
408
|
-
if (ESCAPES.has(codePoint)) {
|
|
409
|
-
const code = parseAnsiCode(string, index);
|
|
410
|
-
if (code) {
|
|
411
|
-
returnValue.push({
|
|
412
|
-
type: "ansi",
|
|
413
|
-
code,
|
|
414
|
-
endCode: getEndCode(code)
|
|
415
|
-
});
|
|
416
|
-
index += code.length;
|
|
417
|
-
continue;
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
const isFullWidth = isFullwidthCodePoint(codePoint);
|
|
421
|
-
const character = String.fromCodePoint(codePoint);
|
|
422
|
-
returnValue.push({
|
|
423
|
-
type: "character",
|
|
424
|
-
value: character,
|
|
425
|
-
isFullWidth
|
|
426
|
-
});
|
|
427
|
-
index += character.length;
|
|
428
|
-
visibleCount += isFullWidth ? 2 : character.length;
|
|
429
|
-
if (visibleCount >= endCharacter) break;
|
|
430
|
-
}
|
|
431
|
-
return returnValue;
|
|
432
|
-
}
|
|
433
|
-
function reduceAnsiCodes(codes) {
|
|
434
|
-
let returnValue = [];
|
|
435
|
-
for (const code of codes) if (code.code === require_string_width.ansi_styles_default.reset.open) returnValue = [];
|
|
436
|
-
else if (endCodesSet.has(code.code)) returnValue = returnValue.filter((returnValueCode) => returnValueCode.endCode !== code.code);
|
|
437
|
-
else {
|
|
438
|
-
returnValue = returnValue.filter((returnValueCode) => returnValueCode.endCode !== code.endCode);
|
|
439
|
-
returnValue.push(code);
|
|
440
|
-
}
|
|
441
|
-
return returnValue;
|
|
442
|
-
}
|
|
443
|
-
function undoAnsiCodes(codes) {
|
|
444
|
-
const reduced = reduceAnsiCodes(codes);
|
|
445
|
-
const endCodes = reduced.map(({ endCode }) => endCode);
|
|
446
|
-
return endCodes.reverse().join("");
|
|
447
|
-
}
|
|
448
|
-
function sliceAnsi(string, start, end) {
|
|
449
|
-
const tokens = tokenize(string, end);
|
|
450
|
-
let activeCodes = [];
|
|
451
|
-
let position = 0;
|
|
452
|
-
let returnValue = "";
|
|
453
|
-
let include = false;
|
|
454
|
-
for (const token of tokens) {
|
|
455
|
-
if (end !== void 0 && position >= end) break;
|
|
456
|
-
if (token.type === "ansi") {
|
|
457
|
-
activeCodes.push(token);
|
|
458
|
-
if (include) returnValue += token.code;
|
|
459
|
-
} else {
|
|
460
|
-
if (!include && position >= start) {
|
|
461
|
-
include = true;
|
|
462
|
-
activeCodes = reduceAnsiCodes(activeCodes);
|
|
463
|
-
returnValue = activeCodes.map(({ code }) => code).join("");
|
|
464
|
-
}
|
|
465
|
-
if (include) returnValue += token.value;
|
|
466
|
-
position += token.isFullWidth ? 2 : token.value.length;
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
returnValue += undoAnsiCodes(activeCodes);
|
|
470
|
-
return returnValue;
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
//#endregion
|
|
474
|
-
//#region ../../node_modules/.pnpm/log-update@6.1.0/node_modules/log-update/index.js
|
|
475
|
-
const defaultTerminalHeight = 24;
|
|
476
|
-
const getWidth = ({ columns = 80 }) => columns;
|
|
477
|
-
const fitToTerminalHeight = (stream, text) => {
|
|
478
|
-
const terminalHeight = stream.rows ?? defaultTerminalHeight;
|
|
479
|
-
const lines = text.split("\n");
|
|
480
|
-
const toRemove = Math.max(0, lines.length - terminalHeight);
|
|
481
|
-
return toRemove ? sliceAnsi(text, require_string_width.stripAnsi(lines.slice(0, toRemove).join("\n")).length + 1) : text;
|
|
482
|
-
};
|
|
483
|
-
function createLogUpdate(stream, { showCursor = false } = {}) {
|
|
484
|
-
let previousLineCount = 0;
|
|
485
|
-
let previousWidth = getWidth(stream);
|
|
486
|
-
let previousOutput = "";
|
|
487
|
-
const reset = () => {
|
|
488
|
-
previousOutput = "";
|
|
489
|
-
previousWidth = getWidth(stream);
|
|
490
|
-
previousLineCount = 0;
|
|
491
|
-
};
|
|
492
|
-
const render = (...arguments_) => {
|
|
493
|
-
if (!showCursor) cli_cursor_default.hide();
|
|
494
|
-
let output = fitToTerminalHeight(stream, arguments_.join(" ") + "\n");
|
|
495
|
-
const width = getWidth(stream);
|
|
496
|
-
if (output === previousOutput && previousWidth === width) return;
|
|
497
|
-
previousOutput = output;
|
|
498
|
-
previousWidth = width;
|
|
499
|
-
output = require_wrap_ansi.wrapAnsi(output, width, {
|
|
500
|
-
trim: false,
|
|
501
|
-
hard: true,
|
|
502
|
-
wordWrap: false
|
|
503
|
-
});
|
|
504
|
-
stream.write(eraseLines(previousLineCount) + output);
|
|
505
|
-
previousLineCount = output.split("\n").length;
|
|
506
|
-
};
|
|
507
|
-
render.clear = () => {
|
|
508
|
-
stream.write(eraseLines(previousLineCount));
|
|
509
|
-
reset();
|
|
510
|
-
};
|
|
511
|
-
render.done = () => {
|
|
512
|
-
reset();
|
|
513
|
-
if (!showCursor) cli_cursor_default.show();
|
|
514
|
-
};
|
|
515
|
-
return render;
|
|
516
|
-
}
|
|
517
|
-
const logUpdate = createLogUpdate(node_process.default.stdout);
|
|
518
|
-
const logUpdateStderr = createLogUpdate(node_process.default.stderr);
|
|
519
|
-
|
|
520
|
-
//#endregion
|
|
521
|
-
exports.createLogUpdate = createLogUpdate;
|