pubm 0.0.0-alpha.19 → 0.0.0-alpha.20
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/bin/cli.js +4402 -58
- package/dist/index.cjs +4393 -70
- package/dist/index.js +4409 -61
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -1,15 +1,4368 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
var __create = Object.create;
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __typeError = (msg) => {
|
|
10
|
+
throw TypeError(msg);
|
|
11
|
+
};
|
|
4
12
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
+
var __esm = (fn, res) => function __init() {
|
|
14
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
15
|
+
};
|
|
16
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
17
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
18
|
+
};
|
|
19
|
+
var __export = (target, all) => {
|
|
20
|
+
for (var name in all)
|
|
21
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
22
|
+
};
|
|
23
|
+
var __copyProps = (to, from, except, desc) => {
|
|
24
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
25
|
+
for (let key of __getOwnPropNames(from))
|
|
26
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
27
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
28
|
+
}
|
|
29
|
+
return to;
|
|
30
|
+
};
|
|
31
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
32
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
33
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
34
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
35
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
36
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
37
|
+
mod
|
|
38
|
+
));
|
|
5
39
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
40
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
41
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
42
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
43
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
44
|
+
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
45
|
+
|
|
46
|
+
// node_modules/.pnpm/eventemitter3@5.0.1/node_modules/eventemitter3/index.js
|
|
47
|
+
var require_eventemitter3 = __commonJS({
|
|
48
|
+
"node_modules/.pnpm/eventemitter3@5.0.1/node_modules/eventemitter3/index.js"(exports, module) {
|
|
49
|
+
"use strict";
|
|
50
|
+
var has = Object.prototype.hasOwnProperty;
|
|
51
|
+
var prefix = "~";
|
|
52
|
+
function Events() {
|
|
53
|
+
}
|
|
54
|
+
if (Object.create) {
|
|
55
|
+
Events.prototype = /* @__PURE__ */ Object.create(null);
|
|
56
|
+
if (!new Events().__proto__) prefix = false;
|
|
57
|
+
}
|
|
58
|
+
function EE(fn, context, once) {
|
|
59
|
+
this.fn = fn;
|
|
60
|
+
this.context = context;
|
|
61
|
+
this.once = once || false;
|
|
62
|
+
}
|
|
63
|
+
function addListener(emitter, event, fn, context, once) {
|
|
64
|
+
if (typeof fn !== "function") {
|
|
65
|
+
throw new TypeError("The listener must be a function");
|
|
66
|
+
}
|
|
67
|
+
var listener = new EE(fn, context || emitter, once), evt = prefix ? prefix + event : event;
|
|
68
|
+
if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;
|
|
69
|
+
else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);
|
|
70
|
+
else emitter._events[evt] = [emitter._events[evt], listener];
|
|
71
|
+
return emitter;
|
|
72
|
+
}
|
|
73
|
+
function clearEvent(emitter, evt) {
|
|
74
|
+
if (--emitter._eventsCount === 0) emitter._events = new Events();
|
|
75
|
+
else delete emitter._events[evt];
|
|
76
|
+
}
|
|
77
|
+
function EventEmitter2() {
|
|
78
|
+
this._events = new Events();
|
|
79
|
+
this._eventsCount = 0;
|
|
80
|
+
}
|
|
81
|
+
EventEmitter2.prototype.eventNames = function eventNames() {
|
|
82
|
+
var names = [], events, name;
|
|
83
|
+
if (this._eventsCount === 0) return names;
|
|
84
|
+
for (name in events = this._events) {
|
|
85
|
+
if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
|
|
86
|
+
}
|
|
87
|
+
if (Object.getOwnPropertySymbols) {
|
|
88
|
+
return names.concat(Object.getOwnPropertySymbols(events));
|
|
89
|
+
}
|
|
90
|
+
return names;
|
|
91
|
+
};
|
|
92
|
+
EventEmitter2.prototype.listeners = function listeners(event) {
|
|
93
|
+
var evt = prefix ? prefix + event : event, handlers = this._events[evt];
|
|
94
|
+
if (!handlers) return [];
|
|
95
|
+
if (handlers.fn) return [handlers.fn];
|
|
96
|
+
for (var i = 0, l2 = handlers.length, ee = new Array(l2); i < l2; i++) {
|
|
97
|
+
ee[i] = handlers[i].fn;
|
|
98
|
+
}
|
|
99
|
+
return ee;
|
|
100
|
+
};
|
|
101
|
+
EventEmitter2.prototype.listenerCount = function listenerCount(event) {
|
|
102
|
+
var evt = prefix ? prefix + event : event, listeners = this._events[evt];
|
|
103
|
+
if (!listeners) return 0;
|
|
104
|
+
if (listeners.fn) return 1;
|
|
105
|
+
return listeners.length;
|
|
106
|
+
};
|
|
107
|
+
EventEmitter2.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
|
|
108
|
+
var evt = prefix ? prefix + event : event;
|
|
109
|
+
if (!this._events[evt]) return false;
|
|
110
|
+
var listeners = this._events[evt], len = arguments.length, args, i;
|
|
111
|
+
if (listeners.fn) {
|
|
112
|
+
if (listeners.once) this.removeListener(event, listeners.fn, void 0, true);
|
|
113
|
+
switch (len) {
|
|
114
|
+
case 1:
|
|
115
|
+
return listeners.fn.call(listeners.context), true;
|
|
116
|
+
case 2:
|
|
117
|
+
return listeners.fn.call(listeners.context, a1), true;
|
|
118
|
+
case 3:
|
|
119
|
+
return listeners.fn.call(listeners.context, a1, a2), true;
|
|
120
|
+
case 4:
|
|
121
|
+
return listeners.fn.call(listeners.context, a1, a2, a3), true;
|
|
122
|
+
case 5:
|
|
123
|
+
return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
|
|
124
|
+
case 6:
|
|
125
|
+
return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
|
|
126
|
+
}
|
|
127
|
+
for (i = 1, args = new Array(len - 1); i < len; i++) {
|
|
128
|
+
args[i - 1] = arguments[i];
|
|
129
|
+
}
|
|
130
|
+
listeners.fn.apply(listeners.context, args);
|
|
131
|
+
} else {
|
|
132
|
+
var length = listeners.length, j;
|
|
133
|
+
for (i = 0; i < length; i++) {
|
|
134
|
+
if (listeners[i].once) this.removeListener(event, listeners[i].fn, void 0, true);
|
|
135
|
+
switch (len) {
|
|
136
|
+
case 1:
|
|
137
|
+
listeners[i].fn.call(listeners[i].context);
|
|
138
|
+
break;
|
|
139
|
+
case 2:
|
|
140
|
+
listeners[i].fn.call(listeners[i].context, a1);
|
|
141
|
+
break;
|
|
142
|
+
case 3:
|
|
143
|
+
listeners[i].fn.call(listeners[i].context, a1, a2);
|
|
144
|
+
break;
|
|
145
|
+
case 4:
|
|
146
|
+
listeners[i].fn.call(listeners[i].context, a1, a2, a3);
|
|
147
|
+
break;
|
|
148
|
+
default:
|
|
149
|
+
if (!args) for (j = 1, args = new Array(len - 1); j < len; j++) {
|
|
150
|
+
args[j - 1] = arguments[j];
|
|
151
|
+
}
|
|
152
|
+
listeners[i].fn.apply(listeners[i].context, args);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return true;
|
|
157
|
+
};
|
|
158
|
+
EventEmitter2.prototype.on = function on(event, fn, context) {
|
|
159
|
+
return addListener(this, event, fn, context, false);
|
|
160
|
+
};
|
|
161
|
+
EventEmitter2.prototype.once = function once(event, fn, context) {
|
|
162
|
+
return addListener(this, event, fn, context, true);
|
|
163
|
+
};
|
|
164
|
+
EventEmitter2.prototype.removeListener = function removeListener(event, fn, context, once) {
|
|
165
|
+
var evt = prefix ? prefix + event : event;
|
|
166
|
+
if (!this._events[evt]) return this;
|
|
167
|
+
if (!fn) {
|
|
168
|
+
clearEvent(this, evt);
|
|
169
|
+
return this;
|
|
170
|
+
}
|
|
171
|
+
var listeners = this._events[evt];
|
|
172
|
+
if (listeners.fn) {
|
|
173
|
+
if (listeners.fn === fn && (!once || listeners.once) && (!context || listeners.context === context)) {
|
|
174
|
+
clearEvent(this, evt);
|
|
175
|
+
}
|
|
176
|
+
} else {
|
|
177
|
+
for (var i = 0, events = [], length = listeners.length; i < length; i++) {
|
|
178
|
+
if (listeners[i].fn !== fn || once && !listeners[i].once || context && listeners[i].context !== context) {
|
|
179
|
+
events.push(listeners[i]);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
|
|
183
|
+
else clearEvent(this, evt);
|
|
184
|
+
}
|
|
185
|
+
return this;
|
|
186
|
+
};
|
|
187
|
+
EventEmitter2.prototype.removeAllListeners = function removeAllListeners(event) {
|
|
188
|
+
var evt;
|
|
189
|
+
if (event) {
|
|
190
|
+
evt = prefix ? prefix + event : event;
|
|
191
|
+
if (this._events[evt]) clearEvent(this, evt);
|
|
192
|
+
} else {
|
|
193
|
+
this._events = new Events();
|
|
194
|
+
this._eventsCount = 0;
|
|
195
|
+
}
|
|
196
|
+
return this;
|
|
197
|
+
};
|
|
198
|
+
EventEmitter2.prototype.off = EventEmitter2.prototype.removeListener;
|
|
199
|
+
EventEmitter2.prototype.addListener = EventEmitter2.prototype.on;
|
|
200
|
+
EventEmitter2.prefixed = prefix;
|
|
201
|
+
EventEmitter2.EventEmitter = EventEmitter2;
|
|
202
|
+
if ("undefined" !== typeof module) {
|
|
203
|
+
module.exports = EventEmitter2;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
// node_modules/.pnpm/rfdc@1.4.1/node_modules/rfdc/index.js
|
|
209
|
+
var require_rfdc = __commonJS({
|
|
210
|
+
"node_modules/.pnpm/rfdc@1.4.1/node_modules/rfdc/index.js"(exports, module) {
|
|
211
|
+
"use strict";
|
|
212
|
+
module.exports = rfdc2;
|
|
213
|
+
function copyBuffer(cur) {
|
|
214
|
+
if (cur instanceof Buffer) {
|
|
215
|
+
return Buffer.from(cur);
|
|
216
|
+
}
|
|
217
|
+
return new cur.constructor(cur.buffer.slice(), cur.byteOffset, cur.length);
|
|
218
|
+
}
|
|
219
|
+
function rfdc2(opts) {
|
|
220
|
+
opts = opts || {};
|
|
221
|
+
if (opts.circles) return rfdcCircles(opts);
|
|
222
|
+
const constructorHandlers = /* @__PURE__ */ new Map();
|
|
223
|
+
constructorHandlers.set(Date, (o) => new Date(o));
|
|
224
|
+
constructorHandlers.set(Map, (o, fn) => new Map(cloneArray(Array.from(o), fn)));
|
|
225
|
+
constructorHandlers.set(Set, (o, fn) => new Set(cloneArray(Array.from(o), fn)));
|
|
226
|
+
if (opts.constructorHandlers) {
|
|
227
|
+
for (const handler2 of opts.constructorHandlers) {
|
|
228
|
+
constructorHandlers.set(handler2[0], handler2[1]);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
let handler = null;
|
|
232
|
+
return opts.proto ? cloneProto : clone2;
|
|
233
|
+
function cloneArray(a2, fn) {
|
|
234
|
+
const keys = Object.keys(a2);
|
|
235
|
+
const a22 = new Array(keys.length);
|
|
236
|
+
for (let i = 0; i < keys.length; i++) {
|
|
237
|
+
const k2 = keys[i];
|
|
238
|
+
const cur = a2[k2];
|
|
239
|
+
if (typeof cur !== "object" || cur === null) {
|
|
240
|
+
a22[k2] = cur;
|
|
241
|
+
} else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {
|
|
242
|
+
a22[k2] = handler(cur, fn);
|
|
243
|
+
} else if (ArrayBuffer.isView(cur)) {
|
|
244
|
+
a22[k2] = copyBuffer(cur);
|
|
245
|
+
} else {
|
|
246
|
+
a22[k2] = fn(cur);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
return a22;
|
|
250
|
+
}
|
|
251
|
+
function clone2(o) {
|
|
252
|
+
if (typeof o !== "object" || o === null) return o;
|
|
253
|
+
if (Array.isArray(o)) return cloneArray(o, clone2);
|
|
254
|
+
if (o.constructor !== Object && (handler = constructorHandlers.get(o.constructor))) {
|
|
255
|
+
return handler(o, clone2);
|
|
256
|
+
}
|
|
257
|
+
const o2 = {};
|
|
258
|
+
for (const k2 in o) {
|
|
259
|
+
if (Object.hasOwnProperty.call(o, k2) === false) continue;
|
|
260
|
+
const cur = o[k2];
|
|
261
|
+
if (typeof cur !== "object" || cur === null) {
|
|
262
|
+
o2[k2] = cur;
|
|
263
|
+
} else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {
|
|
264
|
+
o2[k2] = handler(cur, clone2);
|
|
265
|
+
} else if (ArrayBuffer.isView(cur)) {
|
|
266
|
+
o2[k2] = copyBuffer(cur);
|
|
267
|
+
} else {
|
|
268
|
+
o2[k2] = clone2(cur);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
return o2;
|
|
272
|
+
}
|
|
273
|
+
function cloneProto(o) {
|
|
274
|
+
if (typeof o !== "object" || o === null) return o;
|
|
275
|
+
if (Array.isArray(o)) return cloneArray(o, cloneProto);
|
|
276
|
+
if (o.constructor !== Object && (handler = constructorHandlers.get(o.constructor))) {
|
|
277
|
+
return handler(o, cloneProto);
|
|
278
|
+
}
|
|
279
|
+
const o2 = {};
|
|
280
|
+
for (const k2 in o) {
|
|
281
|
+
const cur = o[k2];
|
|
282
|
+
if (typeof cur !== "object" || cur === null) {
|
|
283
|
+
o2[k2] = cur;
|
|
284
|
+
} else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {
|
|
285
|
+
o2[k2] = handler(cur, cloneProto);
|
|
286
|
+
} else if (ArrayBuffer.isView(cur)) {
|
|
287
|
+
o2[k2] = copyBuffer(cur);
|
|
288
|
+
} else {
|
|
289
|
+
o2[k2] = cloneProto(cur);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
return o2;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
function rfdcCircles(opts) {
|
|
296
|
+
const refs = [];
|
|
297
|
+
const refsNew = [];
|
|
298
|
+
const constructorHandlers = /* @__PURE__ */ new Map();
|
|
299
|
+
constructorHandlers.set(Date, (o) => new Date(o));
|
|
300
|
+
constructorHandlers.set(Map, (o, fn) => new Map(cloneArray(Array.from(o), fn)));
|
|
301
|
+
constructorHandlers.set(Set, (o, fn) => new Set(cloneArray(Array.from(o), fn)));
|
|
302
|
+
if (opts.constructorHandlers) {
|
|
303
|
+
for (const handler2 of opts.constructorHandlers) {
|
|
304
|
+
constructorHandlers.set(handler2[0], handler2[1]);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
let handler = null;
|
|
308
|
+
return opts.proto ? cloneProto : clone2;
|
|
309
|
+
function cloneArray(a2, fn) {
|
|
310
|
+
const keys = Object.keys(a2);
|
|
311
|
+
const a22 = new Array(keys.length);
|
|
312
|
+
for (let i = 0; i < keys.length; i++) {
|
|
313
|
+
const k2 = keys[i];
|
|
314
|
+
const cur = a2[k2];
|
|
315
|
+
if (typeof cur !== "object" || cur === null) {
|
|
316
|
+
a22[k2] = cur;
|
|
317
|
+
} else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {
|
|
318
|
+
a22[k2] = handler(cur, fn);
|
|
319
|
+
} else if (ArrayBuffer.isView(cur)) {
|
|
320
|
+
a22[k2] = copyBuffer(cur);
|
|
321
|
+
} else {
|
|
322
|
+
const index = refs.indexOf(cur);
|
|
323
|
+
if (index !== -1) {
|
|
324
|
+
a22[k2] = refsNew[index];
|
|
325
|
+
} else {
|
|
326
|
+
a22[k2] = fn(cur);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
return a22;
|
|
331
|
+
}
|
|
332
|
+
function clone2(o) {
|
|
333
|
+
if (typeof o !== "object" || o === null) return o;
|
|
334
|
+
if (Array.isArray(o)) return cloneArray(o, clone2);
|
|
335
|
+
if (o.constructor !== Object && (handler = constructorHandlers.get(o.constructor))) {
|
|
336
|
+
return handler(o, clone2);
|
|
337
|
+
}
|
|
338
|
+
const o2 = {};
|
|
339
|
+
refs.push(o);
|
|
340
|
+
refsNew.push(o2);
|
|
341
|
+
for (const k2 in o) {
|
|
342
|
+
if (Object.hasOwnProperty.call(o, k2) === false) continue;
|
|
343
|
+
const cur = o[k2];
|
|
344
|
+
if (typeof cur !== "object" || cur === null) {
|
|
345
|
+
o2[k2] = cur;
|
|
346
|
+
} else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {
|
|
347
|
+
o2[k2] = handler(cur, clone2);
|
|
348
|
+
} else if (ArrayBuffer.isView(cur)) {
|
|
349
|
+
o2[k2] = copyBuffer(cur);
|
|
350
|
+
} else {
|
|
351
|
+
const i = refs.indexOf(cur);
|
|
352
|
+
if (i !== -1) {
|
|
353
|
+
o2[k2] = refsNew[i];
|
|
354
|
+
} else {
|
|
355
|
+
o2[k2] = clone2(cur);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
refs.pop();
|
|
360
|
+
refsNew.pop();
|
|
361
|
+
return o2;
|
|
362
|
+
}
|
|
363
|
+
function cloneProto(o) {
|
|
364
|
+
if (typeof o !== "object" || o === null) return o;
|
|
365
|
+
if (Array.isArray(o)) return cloneArray(o, cloneProto);
|
|
366
|
+
if (o.constructor !== Object && (handler = constructorHandlers.get(o.constructor))) {
|
|
367
|
+
return handler(o, cloneProto);
|
|
368
|
+
}
|
|
369
|
+
const o2 = {};
|
|
370
|
+
refs.push(o);
|
|
371
|
+
refsNew.push(o2);
|
|
372
|
+
for (const k2 in o) {
|
|
373
|
+
const cur = o[k2];
|
|
374
|
+
if (typeof cur !== "object" || cur === null) {
|
|
375
|
+
o2[k2] = cur;
|
|
376
|
+
} else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {
|
|
377
|
+
o2[k2] = handler(cur, cloneProto);
|
|
378
|
+
} else if (ArrayBuffer.isView(cur)) {
|
|
379
|
+
o2[k2] = copyBuffer(cur);
|
|
380
|
+
} else {
|
|
381
|
+
const i = refs.indexOf(cur);
|
|
382
|
+
if (i !== -1) {
|
|
383
|
+
o2[k2] = refsNew[i];
|
|
384
|
+
} else {
|
|
385
|
+
o2[k2] = cloneProto(cur);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
refs.pop();
|
|
390
|
+
refsNew.pop();
|
|
391
|
+
return o2;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
// node_modules/.pnpm/environment@1.1.0/node_modules/environment/index.js
|
|
398
|
+
var isBrowser, isNode, isBun, isDeno, isElectron, isJsDom, isWebWorker, isDedicatedWorker, isSharedWorker, isServiceWorker, platform2, isMacOs, isWindows2, isLinux, isIos, isAndroid;
|
|
399
|
+
var init_environment = __esm({
|
|
400
|
+
"node_modules/.pnpm/environment@1.1.0/node_modules/environment/index.js"() {
|
|
401
|
+
"use strict";
|
|
402
|
+
isBrowser = globalThis.window?.document !== void 0;
|
|
403
|
+
isNode = globalThis.process?.versions?.node !== void 0;
|
|
404
|
+
isBun = globalThis.process?.versions?.bun !== void 0;
|
|
405
|
+
isDeno = globalThis.Deno?.version?.deno !== void 0;
|
|
406
|
+
isElectron = globalThis.process?.versions?.electron !== void 0;
|
|
407
|
+
isJsDom = globalThis.navigator?.userAgent?.includes("jsdom") === true;
|
|
408
|
+
isWebWorker = typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
|
|
409
|
+
isDedicatedWorker = typeof DedicatedWorkerGlobalScope !== "undefined" && globalThis instanceof DedicatedWorkerGlobalScope;
|
|
410
|
+
isSharedWorker = typeof SharedWorkerGlobalScope !== "undefined" && globalThis instanceof SharedWorkerGlobalScope;
|
|
411
|
+
isServiceWorker = typeof ServiceWorkerGlobalScope !== "undefined" && globalThis instanceof ServiceWorkerGlobalScope;
|
|
412
|
+
platform2 = globalThis.navigator?.userAgentData?.platform;
|
|
413
|
+
isMacOs = platform2 === "macOS" || globalThis.navigator?.platform === "MacIntel" || globalThis.navigator?.userAgent?.includes(" Mac ") === true || globalThis.process?.platform === "darwin";
|
|
414
|
+
isWindows2 = platform2 === "Windows" || globalThis.navigator?.platform === "Win32" || globalThis.process?.platform === "win32";
|
|
415
|
+
isLinux = platform2 === "Linux" || globalThis.navigator?.platform?.startsWith("Linux") === true || globalThis.navigator?.userAgent?.includes(" Linux ") === true || globalThis.process?.platform === "linux";
|
|
416
|
+
isIos = platform2 === "iOS" || globalThis.navigator?.platform === "MacIntel" && globalThis.navigator?.maxTouchPoints > 1 || /iPad|iPhone|iPod/.test(globalThis.navigator?.platform);
|
|
417
|
+
isAndroid = platform2 === "Android" || globalThis.navigator?.platform === "Android" || globalThis.navigator?.userAgent?.includes(" Android ") === true || globalThis.process?.platform === "android";
|
|
418
|
+
}
|
|
419
|
+
});
|
|
420
|
+
|
|
421
|
+
// node_modules/.pnpm/ansi-escapes@7.0.0/node_modules/ansi-escapes/base.js
|
|
422
|
+
var base_exports = {};
|
|
423
|
+
__export(base_exports, {
|
|
424
|
+
beep: () => beep,
|
|
425
|
+
clearScreen: () => clearScreen,
|
|
426
|
+
clearTerminal: () => clearTerminal,
|
|
427
|
+
cursorBackward: () => cursorBackward,
|
|
428
|
+
cursorDown: () => cursorDown,
|
|
429
|
+
cursorForward: () => cursorForward,
|
|
430
|
+
cursorGetPosition: () => cursorGetPosition,
|
|
431
|
+
cursorHide: () => cursorHide,
|
|
432
|
+
cursorLeft: () => cursorLeft,
|
|
433
|
+
cursorMove: () => cursorMove,
|
|
434
|
+
cursorNextLine: () => cursorNextLine,
|
|
435
|
+
cursorPrevLine: () => cursorPrevLine,
|
|
436
|
+
cursorRestorePosition: () => cursorRestorePosition,
|
|
437
|
+
cursorSavePosition: () => cursorSavePosition,
|
|
438
|
+
cursorShow: () => cursorShow,
|
|
439
|
+
cursorTo: () => cursorTo,
|
|
440
|
+
cursorUp: () => cursorUp,
|
|
441
|
+
enterAlternativeScreen: () => enterAlternativeScreen,
|
|
442
|
+
eraseDown: () => eraseDown,
|
|
443
|
+
eraseEndLine: () => eraseEndLine,
|
|
444
|
+
eraseLine: () => eraseLine,
|
|
445
|
+
eraseLines: () => eraseLines,
|
|
446
|
+
eraseScreen: () => eraseScreen,
|
|
447
|
+
eraseStartLine: () => eraseStartLine,
|
|
448
|
+
eraseUp: () => eraseUp,
|
|
449
|
+
exitAlternativeScreen: () => exitAlternativeScreen,
|
|
450
|
+
iTerm: () => iTerm,
|
|
451
|
+
image: () => image,
|
|
452
|
+
link: () => link,
|
|
453
|
+
scrollDown: () => scrollDown,
|
|
454
|
+
scrollUp: () => scrollUp
|
|
455
|
+
});
|
|
456
|
+
import process2 from "node:process";
|
|
457
|
+
var ESC, OSC, BEL, SEP, isTerminalApp, isWindows3, cwdFunction, cursorTo, cursorMove, cursorUp, cursorDown, cursorForward, cursorBackward, cursorLeft, cursorSavePosition, cursorRestorePosition, cursorGetPosition, cursorNextLine, cursorPrevLine, cursorHide, cursorShow, eraseLines, eraseEndLine, eraseStartLine, eraseLine, eraseDown, eraseUp, eraseScreen, scrollUp, scrollDown, clearScreen, clearTerminal, enterAlternativeScreen, exitAlternativeScreen, beep, link, image, iTerm;
|
|
458
|
+
var init_base = __esm({
|
|
459
|
+
"node_modules/.pnpm/ansi-escapes@7.0.0/node_modules/ansi-escapes/base.js"() {
|
|
460
|
+
"use strict";
|
|
461
|
+
init_environment();
|
|
462
|
+
ESC = "\x1B[";
|
|
463
|
+
OSC = "\x1B]";
|
|
464
|
+
BEL = "\x07";
|
|
465
|
+
SEP = ";";
|
|
466
|
+
isTerminalApp = !isBrowser && process2.env.TERM_PROGRAM === "Apple_Terminal";
|
|
467
|
+
isWindows3 = !isBrowser && process2.platform === "win32";
|
|
468
|
+
cwdFunction = isBrowser ? () => {
|
|
469
|
+
throw new Error("`process.cwd()` only works in Node.js, not the browser.");
|
|
470
|
+
} : process2.cwd;
|
|
471
|
+
cursorTo = (x, y) => {
|
|
472
|
+
if (typeof x !== "number") {
|
|
473
|
+
throw new TypeError("The `x` argument is required");
|
|
474
|
+
}
|
|
475
|
+
if (typeof y !== "number") {
|
|
476
|
+
return ESC + (x + 1) + "G";
|
|
477
|
+
}
|
|
478
|
+
return ESC + (y + 1) + SEP + (x + 1) + "H";
|
|
479
|
+
};
|
|
480
|
+
cursorMove = (x, y) => {
|
|
481
|
+
if (typeof x !== "number") {
|
|
482
|
+
throw new TypeError("The `x` argument is required");
|
|
483
|
+
}
|
|
484
|
+
let returnValue = "";
|
|
485
|
+
if (x < 0) {
|
|
486
|
+
returnValue += ESC + -x + "D";
|
|
487
|
+
} else if (x > 0) {
|
|
488
|
+
returnValue += ESC + x + "C";
|
|
489
|
+
}
|
|
490
|
+
if (y < 0) {
|
|
491
|
+
returnValue += ESC + -y + "A";
|
|
492
|
+
} else if (y > 0) {
|
|
493
|
+
returnValue += ESC + y + "B";
|
|
494
|
+
}
|
|
495
|
+
return returnValue;
|
|
496
|
+
};
|
|
497
|
+
cursorUp = (count = 1) => ESC + count + "A";
|
|
498
|
+
cursorDown = (count = 1) => ESC + count + "B";
|
|
499
|
+
cursorForward = (count = 1) => ESC + count + "C";
|
|
500
|
+
cursorBackward = (count = 1) => ESC + count + "D";
|
|
501
|
+
cursorLeft = ESC + "G";
|
|
502
|
+
cursorSavePosition = isTerminalApp ? "\x1B7" : ESC + "s";
|
|
503
|
+
cursorRestorePosition = isTerminalApp ? "\x1B8" : ESC + "u";
|
|
504
|
+
cursorGetPosition = ESC + "6n";
|
|
505
|
+
cursorNextLine = ESC + "E";
|
|
506
|
+
cursorPrevLine = ESC + "F";
|
|
507
|
+
cursorHide = ESC + "?25l";
|
|
508
|
+
cursorShow = ESC + "?25h";
|
|
509
|
+
eraseLines = (count) => {
|
|
510
|
+
let clear = "";
|
|
511
|
+
for (let i = 0; i < count; i++) {
|
|
512
|
+
clear += eraseLine + (i < count - 1 ? cursorUp() : "");
|
|
513
|
+
}
|
|
514
|
+
if (count) {
|
|
515
|
+
clear += cursorLeft;
|
|
516
|
+
}
|
|
517
|
+
return clear;
|
|
518
|
+
};
|
|
519
|
+
eraseEndLine = ESC + "K";
|
|
520
|
+
eraseStartLine = ESC + "1K";
|
|
521
|
+
eraseLine = ESC + "2K";
|
|
522
|
+
eraseDown = ESC + "J";
|
|
523
|
+
eraseUp = ESC + "1J";
|
|
524
|
+
eraseScreen = ESC + "2J";
|
|
525
|
+
scrollUp = ESC + "S";
|
|
526
|
+
scrollDown = ESC + "T";
|
|
527
|
+
clearScreen = "\x1Bc";
|
|
528
|
+
clearTerminal = isWindows3 ? `${eraseScreen}${ESC}0f` : `${eraseScreen}${ESC}3J${ESC}H`;
|
|
529
|
+
enterAlternativeScreen = ESC + "?1049h";
|
|
530
|
+
exitAlternativeScreen = ESC + "?1049l";
|
|
531
|
+
beep = BEL;
|
|
532
|
+
link = (text, url) => [
|
|
533
|
+
OSC,
|
|
534
|
+
"8",
|
|
535
|
+
SEP,
|
|
536
|
+
SEP,
|
|
537
|
+
url,
|
|
538
|
+
BEL,
|
|
539
|
+
text,
|
|
540
|
+
OSC,
|
|
541
|
+
"8",
|
|
542
|
+
SEP,
|
|
543
|
+
SEP,
|
|
544
|
+
BEL
|
|
545
|
+
].join("");
|
|
546
|
+
image = (data, options2 = {}) => {
|
|
547
|
+
let returnValue = `${OSC}1337;File=inline=1`;
|
|
548
|
+
if (options2.width) {
|
|
549
|
+
returnValue += `;width=${options2.width}`;
|
|
550
|
+
}
|
|
551
|
+
if (options2.height) {
|
|
552
|
+
returnValue += `;height=${options2.height}`;
|
|
553
|
+
}
|
|
554
|
+
if (options2.preserveAspectRatio === false) {
|
|
555
|
+
returnValue += ";preserveAspectRatio=0";
|
|
556
|
+
}
|
|
557
|
+
return returnValue + ":" + Buffer.from(data).toString("base64") + BEL;
|
|
558
|
+
};
|
|
559
|
+
iTerm = {
|
|
560
|
+
setCwd: (cwd = cwdFunction()) => `${OSC}50;CurrentDir=${cwd}${BEL}`,
|
|
561
|
+
annotation(message, options2 = {}) {
|
|
562
|
+
let returnValue = `${OSC}1337;`;
|
|
563
|
+
const hasX = options2.x !== void 0;
|
|
564
|
+
const hasY = options2.y !== void 0;
|
|
565
|
+
if ((hasX || hasY) && !(hasX && hasY && options2.length !== void 0)) {
|
|
566
|
+
throw new Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");
|
|
567
|
+
}
|
|
568
|
+
message = message.replaceAll("|", "");
|
|
569
|
+
returnValue += options2.isHidden ? "AddHiddenAnnotation=" : "AddAnnotation=";
|
|
570
|
+
if (options2.length > 0) {
|
|
571
|
+
returnValue += (hasX ? [message, options2.length, options2.x, options2.y] : [options2.length, message]).join("|");
|
|
572
|
+
} else {
|
|
573
|
+
returnValue += message;
|
|
574
|
+
}
|
|
575
|
+
return returnValue + BEL;
|
|
576
|
+
}
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
});
|
|
580
|
+
|
|
581
|
+
// node_modules/.pnpm/ansi-escapes@7.0.0/node_modules/ansi-escapes/index.js
|
|
582
|
+
var init_ansi_escapes = __esm({
|
|
583
|
+
"node_modules/.pnpm/ansi-escapes@7.0.0/node_modules/ansi-escapes/index.js"() {
|
|
584
|
+
"use strict";
|
|
585
|
+
init_base();
|
|
586
|
+
init_base();
|
|
587
|
+
}
|
|
588
|
+
});
|
|
589
|
+
|
|
590
|
+
// node_modules/.pnpm/mimic-function@5.0.1/node_modules/mimic-function/index.js
|
|
591
|
+
function mimicFunction(to, from, { ignoreNonConfigurable = false } = {}) {
|
|
592
|
+
const { name } = to;
|
|
593
|
+
for (const property of Reflect.ownKeys(from)) {
|
|
594
|
+
copyProperty(to, from, property, ignoreNonConfigurable);
|
|
595
|
+
}
|
|
596
|
+
changePrototype(to, from);
|
|
597
|
+
changeToString(to, from, name);
|
|
598
|
+
return to;
|
|
599
|
+
}
|
|
600
|
+
var copyProperty, canCopyProperty, changePrototype, wrappedToString, toStringDescriptor, toStringName, changeToString;
|
|
601
|
+
var init_mimic_function = __esm({
|
|
602
|
+
"node_modules/.pnpm/mimic-function@5.0.1/node_modules/mimic-function/index.js"() {
|
|
603
|
+
"use strict";
|
|
604
|
+
copyProperty = (to, from, property, ignoreNonConfigurable) => {
|
|
605
|
+
if (property === "length" || property === "prototype") {
|
|
606
|
+
return;
|
|
607
|
+
}
|
|
608
|
+
if (property === "arguments" || property === "caller") {
|
|
609
|
+
return;
|
|
610
|
+
}
|
|
611
|
+
const toDescriptor = Object.getOwnPropertyDescriptor(to, property);
|
|
612
|
+
const fromDescriptor = Object.getOwnPropertyDescriptor(from, property);
|
|
613
|
+
if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {
|
|
614
|
+
return;
|
|
615
|
+
}
|
|
616
|
+
Object.defineProperty(to, property, fromDescriptor);
|
|
617
|
+
};
|
|
618
|
+
canCopyProperty = function(toDescriptor, fromDescriptor) {
|
|
619
|
+
return toDescriptor === void 0 || toDescriptor.configurable || toDescriptor.writable === fromDescriptor.writable && toDescriptor.enumerable === fromDescriptor.enumerable && toDescriptor.configurable === fromDescriptor.configurable && (toDescriptor.writable || toDescriptor.value === fromDescriptor.value);
|
|
620
|
+
};
|
|
621
|
+
changePrototype = (to, from) => {
|
|
622
|
+
const fromPrototype = Object.getPrototypeOf(from);
|
|
623
|
+
if (fromPrototype === Object.getPrototypeOf(to)) {
|
|
624
|
+
return;
|
|
625
|
+
}
|
|
626
|
+
Object.setPrototypeOf(to, fromPrototype);
|
|
627
|
+
};
|
|
628
|
+
wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/
|
|
629
|
+
${fromBody}`;
|
|
630
|
+
toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, "toString");
|
|
631
|
+
toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, "name");
|
|
632
|
+
changeToString = (to, from, name) => {
|
|
633
|
+
const withName = name === "" ? "" : `with ${name.trim()}() `;
|
|
634
|
+
const newToString = wrappedToString.bind(null, withName, from.toString());
|
|
635
|
+
Object.defineProperty(newToString, "name", toStringName);
|
|
636
|
+
const { writable, enumerable, configurable } = toStringDescriptor;
|
|
637
|
+
Object.defineProperty(to, "toString", { value: newToString, writable, enumerable, configurable });
|
|
638
|
+
};
|
|
639
|
+
}
|
|
640
|
+
});
|
|
641
|
+
|
|
642
|
+
// node_modules/.pnpm/onetime@7.0.0/node_modules/onetime/index.js
|
|
643
|
+
var calledFunctions, onetime, onetime_default;
|
|
644
|
+
var init_onetime = __esm({
|
|
645
|
+
"node_modules/.pnpm/onetime@7.0.0/node_modules/onetime/index.js"() {
|
|
646
|
+
"use strict";
|
|
647
|
+
init_mimic_function();
|
|
648
|
+
calledFunctions = /* @__PURE__ */ new WeakMap();
|
|
649
|
+
onetime = (function_, options2 = {}) => {
|
|
650
|
+
if (typeof function_ !== "function") {
|
|
651
|
+
throw new TypeError("Expected a function");
|
|
652
|
+
}
|
|
653
|
+
let returnValue;
|
|
654
|
+
let callCount = 0;
|
|
655
|
+
const functionName = function_.displayName || function_.name || "<anonymous>";
|
|
656
|
+
const onetime2 = function(...arguments_) {
|
|
657
|
+
calledFunctions.set(onetime2, ++callCount);
|
|
658
|
+
if (callCount === 1) {
|
|
659
|
+
returnValue = function_.apply(this, arguments_);
|
|
660
|
+
function_ = void 0;
|
|
661
|
+
} else if (options2.throw === true) {
|
|
662
|
+
throw new Error(`Function \`${functionName}\` can only be called once`);
|
|
663
|
+
}
|
|
664
|
+
return returnValue;
|
|
665
|
+
};
|
|
666
|
+
mimicFunction(onetime2, function_);
|
|
667
|
+
calledFunctions.set(onetime2, callCount);
|
|
668
|
+
return onetime2;
|
|
669
|
+
};
|
|
670
|
+
onetime.callCount = (function_) => {
|
|
671
|
+
if (!calledFunctions.has(function_)) {
|
|
672
|
+
throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
|
|
673
|
+
}
|
|
674
|
+
return calledFunctions.get(function_);
|
|
675
|
+
};
|
|
676
|
+
onetime_default = onetime;
|
|
677
|
+
}
|
|
678
|
+
});
|
|
679
|
+
|
|
680
|
+
// node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
|
|
681
|
+
var signals;
|
|
682
|
+
var init_signals = __esm({
|
|
683
|
+
"node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js"() {
|
|
684
|
+
"use strict";
|
|
685
|
+
signals = [];
|
|
686
|
+
signals.push("SIGHUP", "SIGINT", "SIGTERM");
|
|
687
|
+
if (process.platform !== "win32") {
|
|
688
|
+
signals.push(
|
|
689
|
+
"SIGALRM",
|
|
690
|
+
"SIGABRT",
|
|
691
|
+
"SIGVTALRM",
|
|
692
|
+
"SIGXCPU",
|
|
693
|
+
"SIGXFSZ",
|
|
694
|
+
"SIGUSR2",
|
|
695
|
+
"SIGTRAP",
|
|
696
|
+
"SIGSYS",
|
|
697
|
+
"SIGQUIT",
|
|
698
|
+
"SIGIOT"
|
|
699
|
+
// should detect profiler and enable/disable accordingly.
|
|
700
|
+
// see #21
|
|
701
|
+
// 'SIGPROF'
|
|
702
|
+
);
|
|
703
|
+
}
|
|
704
|
+
if (process.platform === "linux") {
|
|
705
|
+
signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
});
|
|
709
|
+
|
|
710
|
+
// node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
|
|
711
|
+
var processOk, kExitEmitter, global, ObjectDefineProperty, Emitter, SignalExitBase, signalExitWrap, SignalExitFallback, _hupSig, _emitter, _process, _originalProcessEmit, _originalProcessReallyExit, _sigListeners, _loaded, _SignalExit_instances, processReallyExit_fn, processEmit_fn, SignalExit, process3, onExit, load, unload;
|
|
712
|
+
var init_mjs = __esm({
|
|
713
|
+
"node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js"() {
|
|
714
|
+
"use strict";
|
|
715
|
+
init_signals();
|
|
716
|
+
processOk = (process9) => !!process9 && typeof process9 === "object" && typeof process9.removeListener === "function" && typeof process9.emit === "function" && typeof process9.reallyExit === "function" && typeof process9.listeners === "function" && typeof process9.kill === "function" && typeof process9.pid === "number" && typeof process9.on === "function";
|
|
717
|
+
kExitEmitter = Symbol.for("signal-exit emitter");
|
|
718
|
+
global = globalThis;
|
|
719
|
+
ObjectDefineProperty = Object.defineProperty.bind(Object);
|
|
720
|
+
Emitter = class {
|
|
721
|
+
constructor() {
|
|
722
|
+
__publicField(this, "emitted", {
|
|
723
|
+
afterExit: false,
|
|
724
|
+
exit: false
|
|
725
|
+
});
|
|
726
|
+
__publicField(this, "listeners", {
|
|
727
|
+
afterExit: [],
|
|
728
|
+
exit: []
|
|
729
|
+
});
|
|
730
|
+
__publicField(this, "count", 0);
|
|
731
|
+
__publicField(this, "id", Math.random());
|
|
732
|
+
if (global[kExitEmitter]) {
|
|
733
|
+
return global[kExitEmitter];
|
|
734
|
+
}
|
|
735
|
+
ObjectDefineProperty(global, kExitEmitter, {
|
|
736
|
+
value: this,
|
|
737
|
+
writable: false,
|
|
738
|
+
enumerable: false,
|
|
739
|
+
configurable: false
|
|
740
|
+
});
|
|
741
|
+
}
|
|
742
|
+
on(ev, fn) {
|
|
743
|
+
this.listeners[ev].push(fn);
|
|
744
|
+
}
|
|
745
|
+
removeListener(ev, fn) {
|
|
746
|
+
const list = this.listeners[ev];
|
|
747
|
+
const i = list.indexOf(fn);
|
|
748
|
+
if (i === -1) {
|
|
749
|
+
return;
|
|
750
|
+
}
|
|
751
|
+
if (i === 0 && list.length === 1) {
|
|
752
|
+
list.length = 0;
|
|
753
|
+
} else {
|
|
754
|
+
list.splice(i, 1);
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
emit(ev, code, signal) {
|
|
758
|
+
if (this.emitted[ev]) {
|
|
759
|
+
return false;
|
|
760
|
+
}
|
|
761
|
+
this.emitted[ev] = true;
|
|
762
|
+
let ret = false;
|
|
763
|
+
for (const fn of this.listeners[ev]) {
|
|
764
|
+
ret = fn(code, signal) === true || ret;
|
|
765
|
+
}
|
|
766
|
+
if (ev === "exit") {
|
|
767
|
+
ret = this.emit("afterExit", code, signal) || ret;
|
|
768
|
+
}
|
|
769
|
+
return ret;
|
|
770
|
+
}
|
|
771
|
+
};
|
|
772
|
+
SignalExitBase = class {
|
|
773
|
+
};
|
|
774
|
+
signalExitWrap = (handler) => {
|
|
775
|
+
return {
|
|
776
|
+
onExit(cb, opts) {
|
|
777
|
+
return handler.onExit(cb, opts);
|
|
778
|
+
},
|
|
779
|
+
load() {
|
|
780
|
+
return handler.load();
|
|
781
|
+
},
|
|
782
|
+
unload() {
|
|
783
|
+
return handler.unload();
|
|
784
|
+
}
|
|
785
|
+
};
|
|
786
|
+
};
|
|
787
|
+
SignalExitFallback = class extends SignalExitBase {
|
|
788
|
+
onExit() {
|
|
789
|
+
return () => {
|
|
790
|
+
};
|
|
791
|
+
}
|
|
792
|
+
load() {
|
|
793
|
+
}
|
|
794
|
+
unload() {
|
|
795
|
+
}
|
|
796
|
+
};
|
|
797
|
+
SignalExit = class extends SignalExitBase {
|
|
798
|
+
constructor(process9) {
|
|
799
|
+
super();
|
|
800
|
+
__privateAdd(this, _SignalExit_instances);
|
|
801
|
+
// "SIGHUP" throws an `ENOSYS` error on Windows,
|
|
802
|
+
// so use a supported signal instead
|
|
803
|
+
/* c8 ignore start */
|
|
804
|
+
__privateAdd(this, _hupSig, process3.platform === "win32" ? "SIGINT" : "SIGHUP");
|
|
805
|
+
/* c8 ignore stop */
|
|
806
|
+
__privateAdd(this, _emitter, new Emitter());
|
|
807
|
+
__privateAdd(this, _process);
|
|
808
|
+
__privateAdd(this, _originalProcessEmit);
|
|
809
|
+
__privateAdd(this, _originalProcessReallyExit);
|
|
810
|
+
__privateAdd(this, _sigListeners, {});
|
|
811
|
+
__privateAdd(this, _loaded, false);
|
|
812
|
+
__privateSet(this, _process, process9);
|
|
813
|
+
__privateSet(this, _sigListeners, {});
|
|
814
|
+
for (const sig of signals) {
|
|
815
|
+
__privateGet(this, _sigListeners)[sig] = () => {
|
|
816
|
+
const listeners = __privateGet(this, _process).listeners(sig);
|
|
817
|
+
let { count } = __privateGet(this, _emitter);
|
|
818
|
+
const p = process9;
|
|
819
|
+
if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
|
|
820
|
+
count += p.__signal_exit_emitter__.count;
|
|
821
|
+
}
|
|
822
|
+
if (listeners.length === count) {
|
|
823
|
+
this.unload();
|
|
824
|
+
const ret = __privateGet(this, _emitter).emit("exit", null, sig);
|
|
825
|
+
const s = sig === "SIGHUP" ? __privateGet(this, _hupSig) : sig;
|
|
826
|
+
if (!ret)
|
|
827
|
+
process9.kill(process9.pid, s);
|
|
828
|
+
}
|
|
829
|
+
};
|
|
830
|
+
}
|
|
831
|
+
__privateSet(this, _originalProcessReallyExit, process9.reallyExit);
|
|
832
|
+
__privateSet(this, _originalProcessEmit, process9.emit);
|
|
833
|
+
}
|
|
834
|
+
onExit(cb, opts) {
|
|
835
|
+
if (!processOk(__privateGet(this, _process))) {
|
|
836
|
+
return () => {
|
|
837
|
+
};
|
|
838
|
+
}
|
|
839
|
+
if (__privateGet(this, _loaded) === false) {
|
|
840
|
+
this.load();
|
|
841
|
+
}
|
|
842
|
+
const ev = opts?.alwaysLast ? "afterExit" : "exit";
|
|
843
|
+
__privateGet(this, _emitter).on(ev, cb);
|
|
844
|
+
return () => {
|
|
845
|
+
__privateGet(this, _emitter).removeListener(ev, cb);
|
|
846
|
+
if (__privateGet(this, _emitter).listeners["exit"].length === 0 && __privateGet(this, _emitter).listeners["afterExit"].length === 0) {
|
|
847
|
+
this.unload();
|
|
848
|
+
}
|
|
849
|
+
};
|
|
850
|
+
}
|
|
851
|
+
load() {
|
|
852
|
+
if (__privateGet(this, _loaded)) {
|
|
853
|
+
return;
|
|
854
|
+
}
|
|
855
|
+
__privateSet(this, _loaded, true);
|
|
856
|
+
__privateGet(this, _emitter).count += 1;
|
|
857
|
+
for (const sig of signals) {
|
|
858
|
+
try {
|
|
859
|
+
const fn = __privateGet(this, _sigListeners)[sig];
|
|
860
|
+
if (fn)
|
|
861
|
+
__privateGet(this, _process).on(sig, fn);
|
|
862
|
+
} catch (_) {
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
__privateGet(this, _process).emit = (ev, ...a2) => {
|
|
866
|
+
return __privateMethod(this, _SignalExit_instances, processEmit_fn).call(this, ev, ...a2);
|
|
867
|
+
};
|
|
868
|
+
__privateGet(this, _process).reallyExit = (code) => {
|
|
869
|
+
return __privateMethod(this, _SignalExit_instances, processReallyExit_fn).call(this, code);
|
|
870
|
+
};
|
|
871
|
+
}
|
|
872
|
+
unload() {
|
|
873
|
+
if (!__privateGet(this, _loaded)) {
|
|
874
|
+
return;
|
|
875
|
+
}
|
|
876
|
+
__privateSet(this, _loaded, false);
|
|
877
|
+
signals.forEach((sig) => {
|
|
878
|
+
const listener = __privateGet(this, _sigListeners)[sig];
|
|
879
|
+
if (!listener) {
|
|
880
|
+
throw new Error("Listener not defined for signal: " + sig);
|
|
881
|
+
}
|
|
882
|
+
try {
|
|
883
|
+
__privateGet(this, _process).removeListener(sig, listener);
|
|
884
|
+
} catch (_) {
|
|
885
|
+
}
|
|
886
|
+
});
|
|
887
|
+
__privateGet(this, _process).emit = __privateGet(this, _originalProcessEmit);
|
|
888
|
+
__privateGet(this, _process).reallyExit = __privateGet(this, _originalProcessReallyExit);
|
|
889
|
+
__privateGet(this, _emitter).count -= 1;
|
|
890
|
+
}
|
|
891
|
+
};
|
|
892
|
+
_hupSig = new WeakMap();
|
|
893
|
+
_emitter = new WeakMap();
|
|
894
|
+
_process = new WeakMap();
|
|
895
|
+
_originalProcessEmit = new WeakMap();
|
|
896
|
+
_originalProcessReallyExit = new WeakMap();
|
|
897
|
+
_sigListeners = new WeakMap();
|
|
898
|
+
_loaded = new WeakMap();
|
|
899
|
+
_SignalExit_instances = new WeakSet();
|
|
900
|
+
processReallyExit_fn = function(code) {
|
|
901
|
+
if (!processOk(__privateGet(this, _process))) {
|
|
902
|
+
return 0;
|
|
903
|
+
}
|
|
904
|
+
__privateGet(this, _process).exitCode = code || 0;
|
|
905
|
+
__privateGet(this, _emitter).emit("exit", __privateGet(this, _process).exitCode, null);
|
|
906
|
+
return __privateGet(this, _originalProcessReallyExit).call(__privateGet(this, _process), __privateGet(this, _process).exitCode);
|
|
907
|
+
};
|
|
908
|
+
processEmit_fn = function(ev, ...args) {
|
|
909
|
+
const og = __privateGet(this, _originalProcessEmit);
|
|
910
|
+
if (ev === "exit" && processOk(__privateGet(this, _process))) {
|
|
911
|
+
if (typeof args[0] === "number") {
|
|
912
|
+
__privateGet(this, _process).exitCode = args[0];
|
|
913
|
+
}
|
|
914
|
+
const ret = og.call(__privateGet(this, _process), ev, ...args);
|
|
915
|
+
__privateGet(this, _emitter).emit("exit", __privateGet(this, _process).exitCode, null);
|
|
916
|
+
return ret;
|
|
917
|
+
} else {
|
|
918
|
+
return og.call(__privateGet(this, _process), ev, ...args);
|
|
919
|
+
}
|
|
920
|
+
};
|
|
921
|
+
process3 = globalThis.process;
|
|
922
|
+
({
|
|
923
|
+
onExit: (
|
|
924
|
+
/**
|
|
925
|
+
* Called when the process is exiting, whether via signal, explicit
|
|
926
|
+
* exit, or running out of stuff to do.
|
|
927
|
+
*
|
|
928
|
+
* If the global process object is not suitable for instrumentation,
|
|
929
|
+
* then this will be a no-op.
|
|
930
|
+
*
|
|
931
|
+
* Returns a function that may be used to unload signal-exit.
|
|
932
|
+
*/
|
|
933
|
+
onExit
|
|
934
|
+
),
|
|
935
|
+
load: (
|
|
936
|
+
/**
|
|
937
|
+
* Load the listeners. Likely you never need to call this, unless
|
|
938
|
+
* doing a rather deep integration with signal-exit functionality.
|
|
939
|
+
* Mostly exposed for the benefit of testing.
|
|
940
|
+
*
|
|
941
|
+
* @internal
|
|
942
|
+
*/
|
|
943
|
+
load
|
|
944
|
+
),
|
|
945
|
+
unload: (
|
|
946
|
+
/**
|
|
947
|
+
* Unload the listeners. Likely you never need to call this, unless
|
|
948
|
+
* doing a rather deep integration with signal-exit functionality.
|
|
949
|
+
* Mostly exposed for the benefit of testing.
|
|
950
|
+
*
|
|
951
|
+
* @internal
|
|
952
|
+
*/
|
|
953
|
+
unload
|
|
954
|
+
)
|
|
955
|
+
} = signalExitWrap(processOk(process3) ? new SignalExit(process3) : new SignalExitFallback()));
|
|
956
|
+
}
|
|
957
|
+
});
|
|
958
|
+
|
|
959
|
+
// node_modules/.pnpm/restore-cursor@5.1.0/node_modules/restore-cursor/index.js
|
|
960
|
+
import process4 from "node:process";
|
|
961
|
+
var terminal, restoreCursor, restore_cursor_default;
|
|
962
|
+
var init_restore_cursor = __esm({
|
|
963
|
+
"node_modules/.pnpm/restore-cursor@5.1.0/node_modules/restore-cursor/index.js"() {
|
|
964
|
+
"use strict";
|
|
965
|
+
init_onetime();
|
|
966
|
+
init_mjs();
|
|
967
|
+
terminal = process4.stderr.isTTY ? process4.stderr : process4.stdout.isTTY ? process4.stdout : void 0;
|
|
968
|
+
restoreCursor = terminal ? onetime_default(() => {
|
|
969
|
+
onExit(() => {
|
|
970
|
+
terminal.write("\x1B[?25h");
|
|
971
|
+
}, { alwaysLast: true });
|
|
972
|
+
}) : () => {
|
|
973
|
+
};
|
|
974
|
+
restore_cursor_default = restoreCursor;
|
|
975
|
+
}
|
|
976
|
+
});
|
|
977
|
+
|
|
978
|
+
// node_modules/.pnpm/cli-cursor@5.0.0/node_modules/cli-cursor/index.js
|
|
979
|
+
import process5 from "node:process";
|
|
980
|
+
var isHidden, cliCursor, cli_cursor_default;
|
|
981
|
+
var init_cli_cursor = __esm({
|
|
982
|
+
"node_modules/.pnpm/cli-cursor@5.0.0/node_modules/cli-cursor/index.js"() {
|
|
983
|
+
"use strict";
|
|
984
|
+
init_restore_cursor();
|
|
985
|
+
isHidden = false;
|
|
986
|
+
cliCursor = {};
|
|
987
|
+
cliCursor.show = (writableStream = process5.stderr) => {
|
|
988
|
+
if (!writableStream.isTTY) {
|
|
989
|
+
return;
|
|
990
|
+
}
|
|
991
|
+
isHidden = false;
|
|
992
|
+
writableStream.write("\x1B[?25h");
|
|
993
|
+
};
|
|
994
|
+
cliCursor.hide = (writableStream = process5.stderr) => {
|
|
995
|
+
if (!writableStream.isTTY) {
|
|
996
|
+
return;
|
|
997
|
+
}
|
|
998
|
+
restore_cursor_default();
|
|
999
|
+
isHidden = true;
|
|
1000
|
+
writableStream.write("\x1B[?25l");
|
|
1001
|
+
};
|
|
1002
|
+
cliCursor.toggle = (force, writableStream) => {
|
|
1003
|
+
if (force !== void 0) {
|
|
1004
|
+
isHidden = force;
|
|
1005
|
+
}
|
|
1006
|
+
if (isHidden) {
|
|
1007
|
+
cliCursor.show(writableStream);
|
|
1008
|
+
} else {
|
|
1009
|
+
cliCursor.hide(writableStream);
|
|
1010
|
+
}
|
|
1011
|
+
};
|
|
1012
|
+
cli_cursor_default = cliCursor;
|
|
1013
|
+
}
|
|
1014
|
+
});
|
|
1015
|
+
|
|
1016
|
+
// node_modules/.pnpm/ansi-regex@6.1.0/node_modules/ansi-regex/index.js
|
|
1017
|
+
function ansiRegex({ onlyFirst = false } = {}) {
|
|
1018
|
+
const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
|
|
1019
|
+
const pattern = [
|
|
1020
|
+
`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`,
|
|
1021
|
+
"(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"
|
|
1022
|
+
].join("|");
|
|
1023
|
+
return new RegExp(pattern, onlyFirst ? void 0 : "g");
|
|
1024
|
+
}
|
|
1025
|
+
var init_ansi_regex = __esm({
|
|
1026
|
+
"node_modules/.pnpm/ansi-regex@6.1.0/node_modules/ansi-regex/index.js"() {
|
|
1027
|
+
"use strict";
|
|
1028
|
+
}
|
|
1029
|
+
});
|
|
1030
|
+
|
|
1031
|
+
// node_modules/.pnpm/strip-ansi@7.1.0/node_modules/strip-ansi/index.js
|
|
1032
|
+
function stripAnsi(string) {
|
|
1033
|
+
if (typeof string !== "string") {
|
|
1034
|
+
throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
|
1035
|
+
}
|
|
1036
|
+
return string.replace(regex, "");
|
|
1037
|
+
}
|
|
1038
|
+
var regex;
|
|
1039
|
+
var init_strip_ansi = __esm({
|
|
1040
|
+
"node_modules/.pnpm/strip-ansi@7.1.0/node_modules/strip-ansi/index.js"() {
|
|
1041
|
+
"use strict";
|
|
1042
|
+
init_ansi_regex();
|
|
1043
|
+
regex = ansiRegex();
|
|
1044
|
+
}
|
|
1045
|
+
});
|
|
1046
|
+
|
|
1047
|
+
// node_modules/.pnpm/get-east-asian-width@1.2.0/node_modules/get-east-asian-width/lookup.js
|
|
1048
|
+
function isAmbiguous(x) {
|
|
1049
|
+
return x === 161 || x === 164 || x === 167 || x === 168 || x === 170 || x === 173 || x === 174 || x >= 176 && x <= 180 || x >= 182 && x <= 186 || x >= 188 && x <= 191 || x === 198 || x === 208 || x === 215 || x === 216 || x >= 222 && x <= 225 || x === 230 || x >= 232 && x <= 234 || x === 236 || x === 237 || x === 240 || x === 242 || x === 243 || x >= 247 && x <= 250 || x === 252 || x === 254 || x === 257 || x === 273 || x === 275 || x === 283 || x === 294 || x === 295 || x === 299 || x >= 305 && x <= 307 || x === 312 || x >= 319 && x <= 322 || x === 324 || x >= 328 && x <= 331 || x === 333 || x === 338 || x === 339 || x === 358 || x === 359 || x === 363 || x === 462 || x === 464 || x === 466 || x === 468 || x === 470 || x === 472 || x === 474 || x === 476 || x === 593 || x === 609 || x === 708 || x === 711 || x >= 713 && x <= 715 || x === 717 || x === 720 || x >= 728 && x <= 731 || x === 733 || x === 735 || x >= 768 && x <= 879 || x >= 913 && x <= 929 || x >= 931 && x <= 937 || x >= 945 && x <= 961 || x >= 963 && x <= 969 || x === 1025 || x >= 1040 && x <= 1103 || x === 1105 || x === 8208 || x >= 8211 && x <= 8214 || x === 8216 || x === 8217 || x === 8220 || x === 8221 || x >= 8224 && x <= 8226 || x >= 8228 && x <= 8231 || x === 8240 || x === 8242 || x === 8243 || x === 8245 || x === 8251 || x === 8254 || x === 8308 || x === 8319 || x >= 8321 && x <= 8324 || x === 8364 || x === 8451 || x === 8453 || x === 8457 || x === 8467 || x === 8470 || x === 8481 || x === 8482 || x === 8486 || x === 8491 || x === 8531 || x === 8532 || x >= 8539 && x <= 8542 || x >= 8544 && x <= 8555 || x >= 8560 && x <= 8569 || x === 8585 || x >= 8592 && x <= 8601 || x === 8632 || x === 8633 || x === 8658 || x === 8660 || x === 8679 || x === 8704 || x === 8706 || x === 8707 || x === 8711 || x === 8712 || x === 8715 || x === 8719 || x === 8721 || x === 8725 || x === 8730 || x >= 8733 && x <= 8736 || x === 8739 || x === 8741 || x >= 8743 && x <= 8748 || x === 8750 || x >= 8756 && x <= 8759 || x === 8764 || x === 8765 || x === 8776 || x === 8780 || x === 8786 || x === 8800 || x === 8801 || x >= 8804 && x <= 8807 || x === 8810 || x === 8811 || x === 8814 || x === 8815 || x === 8834 || x === 8835 || x === 8838 || x === 8839 || x === 8853 || x === 8857 || x === 8869 || x === 8895 || x === 8978 || x >= 9312 && x <= 9449 || x >= 9451 && x <= 9547 || x >= 9552 && x <= 9587 || x >= 9600 && x <= 9615 || x >= 9618 && x <= 9621 || x === 9632 || x === 9633 || x >= 9635 && x <= 9641 || x === 9650 || x === 9651 || x === 9654 || x === 9655 || x === 9660 || x === 9661 || x === 9664 || x === 9665 || x >= 9670 && x <= 9672 || x === 9675 || x >= 9678 && x <= 9681 || x >= 9698 && x <= 9701 || x === 9711 || x === 9733 || x === 9734 || x === 9737 || x === 9742 || x === 9743 || x === 9756 || x === 9758 || x === 9792 || x === 9794 || x === 9824 || x === 9825 || x >= 9827 && x <= 9829 || x >= 9831 && x <= 9834 || x === 9836 || x === 9837 || x === 9839 || x === 9886 || x === 9887 || x === 9919 || x >= 9926 && x <= 9933 || x >= 9935 && x <= 9939 || x >= 9941 && x <= 9953 || x === 9955 || x === 9960 || x === 9961 || x >= 9963 && x <= 9969 || x === 9972 || x >= 9974 && x <= 9977 || x === 9979 || x === 9980 || x === 9982 || x === 9983 || x === 10045 || x >= 10102 && x <= 10111 || x >= 11094 && x <= 11097 || x >= 12872 && x <= 12879 || x >= 57344 && x <= 63743 || x >= 65024 && x <= 65039 || x === 65533 || x >= 127232 && x <= 127242 || x >= 127248 && x <= 127277 || x >= 127280 && x <= 127337 || x >= 127344 && x <= 127373 || x === 127375 || x === 127376 || x >= 127387 && x <= 127404 || x >= 917760 && x <= 917999 || x >= 983040 && x <= 1048573 || x >= 1048576 && x <= 1114109;
|
|
1050
|
+
}
|
|
1051
|
+
function isFullWidth(x) {
|
|
1052
|
+
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
1053
|
+
}
|
|
1054
|
+
function isWide(x) {
|
|
1055
|
+
return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9800 && x <= 9811 || x === 9855 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12771 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 19903 || x >= 19968 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x === 94192 || x === 94193 || x >= 94208 && x <= 100343 || x >= 100352 && x <= 101589 || x >= 101632 && x <= 101640 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128727 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129672 || x >= 129680 && x <= 129725 || x >= 129727 && x <= 129733 || x >= 129742 && x <= 129755 || x >= 129760 && x <= 129768 || x >= 129776 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
1056
|
+
}
|
|
1057
|
+
var init_lookup = __esm({
|
|
1058
|
+
"node_modules/.pnpm/get-east-asian-width@1.2.0/node_modules/get-east-asian-width/lookup.js"() {
|
|
1059
|
+
"use strict";
|
|
1060
|
+
}
|
|
1061
|
+
});
|
|
1062
|
+
|
|
1063
|
+
// node_modules/.pnpm/get-east-asian-width@1.2.0/node_modules/get-east-asian-width/index.js
|
|
1064
|
+
function validate(codePoint) {
|
|
1065
|
+
if (!Number.isSafeInteger(codePoint)) {
|
|
1066
|
+
throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
|
|
1070
|
+
validate(codePoint);
|
|
1071
|
+
if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) {
|
|
1072
|
+
return 2;
|
|
1073
|
+
}
|
|
1074
|
+
return 1;
|
|
1075
|
+
}
|
|
1076
|
+
var init_get_east_asian_width = __esm({
|
|
1077
|
+
"node_modules/.pnpm/get-east-asian-width@1.2.0/node_modules/get-east-asian-width/index.js"() {
|
|
1078
|
+
"use strict";
|
|
1079
|
+
init_lookup();
|
|
1080
|
+
}
|
|
1081
|
+
});
|
|
1082
|
+
|
|
1083
|
+
// node_modules/.pnpm/emoji-regex@10.4.0/node_modules/emoji-regex/index.mjs
|
|
1084
|
+
var emoji_regex_default;
|
|
1085
|
+
var init_emoji_regex = __esm({
|
|
1086
|
+
"node_modules/.pnpm/emoji-regex@10.4.0/node_modules/emoji-regex/index.mjs"() {
|
|
1087
|
+
"use strict";
|
|
1088
|
+
emoji_regex_default = () => {
|
|
1089
|
+
return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
|
|
1090
|
+
};
|
|
1091
|
+
}
|
|
1092
|
+
});
|
|
1093
|
+
|
|
1094
|
+
// node_modules/.pnpm/string-width@7.2.0/node_modules/string-width/index.js
|
|
1095
|
+
function stringWidth(string, options2 = {}) {
|
|
1096
|
+
if (typeof string !== "string" || string.length === 0) {
|
|
1097
|
+
return 0;
|
|
1098
|
+
}
|
|
1099
|
+
const {
|
|
1100
|
+
ambiguousIsNarrow = true,
|
|
1101
|
+
countAnsiEscapeCodes = false
|
|
1102
|
+
} = options2;
|
|
1103
|
+
if (!countAnsiEscapeCodes) {
|
|
1104
|
+
string = stripAnsi(string);
|
|
1105
|
+
}
|
|
1106
|
+
if (string.length === 0) {
|
|
1107
|
+
return 0;
|
|
1108
|
+
}
|
|
1109
|
+
let width = 0;
|
|
1110
|
+
const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
|
|
1111
|
+
for (const { segment: character } of segmenter.segment(string)) {
|
|
1112
|
+
const codePoint = character.codePointAt(0);
|
|
1113
|
+
if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
|
|
1114
|
+
continue;
|
|
1115
|
+
}
|
|
1116
|
+
if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) {
|
|
1117
|
+
continue;
|
|
1118
|
+
}
|
|
1119
|
+
if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) {
|
|
1120
|
+
continue;
|
|
1121
|
+
}
|
|
1122
|
+
if (codePoint >= 55296 && codePoint <= 57343) {
|
|
1123
|
+
continue;
|
|
1124
|
+
}
|
|
1125
|
+
if (codePoint >= 65024 && codePoint <= 65039) {
|
|
1126
|
+
continue;
|
|
1127
|
+
}
|
|
1128
|
+
if (defaultIgnorableCodePointRegex.test(character)) {
|
|
1129
|
+
continue;
|
|
1130
|
+
}
|
|
1131
|
+
if (emoji_regex_default().test(character)) {
|
|
1132
|
+
width += 2;
|
|
1133
|
+
continue;
|
|
1134
|
+
}
|
|
1135
|
+
width += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
|
1136
|
+
}
|
|
1137
|
+
return width;
|
|
1138
|
+
}
|
|
1139
|
+
var segmenter, defaultIgnorableCodePointRegex;
|
|
1140
|
+
var init_string_width = __esm({
|
|
1141
|
+
"node_modules/.pnpm/string-width@7.2.0/node_modules/string-width/index.js"() {
|
|
1142
|
+
"use strict";
|
|
1143
|
+
init_strip_ansi();
|
|
1144
|
+
init_get_east_asian_width();
|
|
1145
|
+
init_emoji_regex();
|
|
1146
|
+
segmenter = new Intl.Segmenter();
|
|
1147
|
+
defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
|
|
1148
|
+
}
|
|
1149
|
+
});
|
|
1150
|
+
|
|
1151
|
+
// node_modules/.pnpm/ansi-styles@6.2.1/node_modules/ansi-styles/index.js
|
|
1152
|
+
function assembleStyles() {
|
|
1153
|
+
const codes = /* @__PURE__ */ new Map();
|
|
1154
|
+
for (const [groupName, group] of Object.entries(styles)) {
|
|
1155
|
+
for (const [styleName, style] of Object.entries(group)) {
|
|
1156
|
+
styles[styleName] = {
|
|
1157
|
+
open: `\x1B[${style[0]}m`,
|
|
1158
|
+
close: `\x1B[${style[1]}m`
|
|
1159
|
+
};
|
|
1160
|
+
group[styleName] = styles[styleName];
|
|
1161
|
+
codes.set(style[0], style[1]);
|
|
1162
|
+
}
|
|
1163
|
+
Object.defineProperty(styles, groupName, {
|
|
1164
|
+
value: group,
|
|
1165
|
+
enumerable: false
|
|
1166
|
+
});
|
|
1167
|
+
}
|
|
1168
|
+
Object.defineProperty(styles, "codes", {
|
|
1169
|
+
value: codes,
|
|
1170
|
+
enumerable: false
|
|
1171
|
+
});
|
|
1172
|
+
styles.color.close = "\x1B[39m";
|
|
1173
|
+
styles.bgColor.close = "\x1B[49m";
|
|
1174
|
+
styles.color.ansi = wrapAnsi16();
|
|
1175
|
+
styles.color.ansi256 = wrapAnsi256();
|
|
1176
|
+
styles.color.ansi16m = wrapAnsi16m();
|
|
1177
|
+
styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
|
1178
|
+
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
|
1179
|
+
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
|
1180
|
+
Object.defineProperties(styles, {
|
|
1181
|
+
rgbToAnsi256: {
|
|
1182
|
+
value: (red2, green2, blue2) => {
|
|
1183
|
+
if (red2 === green2 && green2 === blue2) {
|
|
1184
|
+
if (red2 < 8) {
|
|
1185
|
+
return 16;
|
|
1186
|
+
}
|
|
1187
|
+
if (red2 > 248) {
|
|
1188
|
+
return 231;
|
|
1189
|
+
}
|
|
1190
|
+
return Math.round((red2 - 8) / 247 * 24) + 232;
|
|
1191
|
+
}
|
|
1192
|
+
return 16 + 36 * Math.round(red2 / 255 * 5) + 6 * Math.round(green2 / 255 * 5) + Math.round(blue2 / 255 * 5);
|
|
1193
|
+
},
|
|
1194
|
+
enumerable: false
|
|
1195
|
+
},
|
|
1196
|
+
hexToRgb: {
|
|
1197
|
+
value: (hex) => {
|
|
1198
|
+
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
|
1199
|
+
if (!matches) {
|
|
1200
|
+
return [0, 0, 0];
|
|
1201
|
+
}
|
|
1202
|
+
let [colorString] = matches;
|
|
1203
|
+
if (colorString.length === 3) {
|
|
1204
|
+
colorString = [...colorString].map((character) => character + character).join("");
|
|
1205
|
+
}
|
|
1206
|
+
const integer = Number.parseInt(colorString, 16);
|
|
1207
|
+
return [
|
|
1208
|
+
/* eslint-disable no-bitwise */
|
|
1209
|
+
integer >> 16 & 255,
|
|
1210
|
+
integer >> 8 & 255,
|
|
1211
|
+
integer & 255
|
|
1212
|
+
/* eslint-enable no-bitwise */
|
|
1213
|
+
];
|
|
1214
|
+
},
|
|
1215
|
+
enumerable: false
|
|
1216
|
+
},
|
|
1217
|
+
hexToAnsi256: {
|
|
1218
|
+
value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
|
|
1219
|
+
enumerable: false
|
|
1220
|
+
},
|
|
1221
|
+
ansi256ToAnsi: {
|
|
1222
|
+
value: (code) => {
|
|
1223
|
+
if (code < 8) {
|
|
1224
|
+
return 30 + code;
|
|
1225
|
+
}
|
|
1226
|
+
if (code < 16) {
|
|
1227
|
+
return 90 + (code - 8);
|
|
1228
|
+
}
|
|
1229
|
+
let red2;
|
|
1230
|
+
let green2;
|
|
1231
|
+
let blue2;
|
|
1232
|
+
if (code >= 232) {
|
|
1233
|
+
red2 = ((code - 232) * 10 + 8) / 255;
|
|
1234
|
+
green2 = red2;
|
|
1235
|
+
blue2 = red2;
|
|
1236
|
+
} else {
|
|
1237
|
+
code -= 16;
|
|
1238
|
+
const remainder = code % 36;
|
|
1239
|
+
red2 = Math.floor(code / 36) / 5;
|
|
1240
|
+
green2 = Math.floor(remainder / 6) / 5;
|
|
1241
|
+
blue2 = remainder % 6 / 5;
|
|
1242
|
+
}
|
|
1243
|
+
const value = Math.max(red2, green2, blue2) * 2;
|
|
1244
|
+
if (value === 0) {
|
|
1245
|
+
return 30;
|
|
1246
|
+
}
|
|
1247
|
+
let result = 30 + (Math.round(blue2) << 2 | Math.round(green2) << 1 | Math.round(red2));
|
|
1248
|
+
if (value === 2) {
|
|
1249
|
+
result += 60;
|
|
1250
|
+
}
|
|
1251
|
+
return result;
|
|
1252
|
+
},
|
|
1253
|
+
enumerable: false
|
|
1254
|
+
},
|
|
1255
|
+
rgbToAnsi: {
|
|
1256
|
+
value: (red2, green2, blue2) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red2, green2, blue2)),
|
|
1257
|
+
enumerable: false
|
|
1258
|
+
},
|
|
1259
|
+
hexToAnsi: {
|
|
1260
|
+
value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
|
|
1261
|
+
enumerable: false
|
|
1262
|
+
}
|
|
1263
|
+
});
|
|
1264
|
+
return styles;
|
|
1265
|
+
}
|
|
1266
|
+
var ANSI_BACKGROUND_OFFSET, wrapAnsi16, wrapAnsi256, wrapAnsi16m, styles, modifierNames, foregroundColorNames, backgroundColorNames, colorNames, ansiStyles, ansi_styles_default;
|
|
1267
|
+
var init_ansi_styles = __esm({
|
|
1268
|
+
"node_modules/.pnpm/ansi-styles@6.2.1/node_modules/ansi-styles/index.js"() {
|
|
1269
|
+
"use strict";
|
|
1270
|
+
ANSI_BACKGROUND_OFFSET = 10;
|
|
1271
|
+
wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
1272
|
+
wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
1273
|
+
wrapAnsi16m = (offset = 0) => (red2, green2, blue2) => `\x1B[${38 + offset};2;${red2};${green2};${blue2}m`;
|
|
1274
|
+
styles = {
|
|
1275
|
+
modifier: {
|
|
1276
|
+
reset: [0, 0],
|
|
1277
|
+
// 21 isn't widely supported and 22 does the same thing
|
|
1278
|
+
bold: [1, 22],
|
|
1279
|
+
dim: [2, 22],
|
|
1280
|
+
italic: [3, 23],
|
|
1281
|
+
underline: [4, 24],
|
|
1282
|
+
overline: [53, 55],
|
|
1283
|
+
inverse: [7, 27],
|
|
1284
|
+
hidden: [8, 28],
|
|
1285
|
+
strikethrough: [9, 29]
|
|
1286
|
+
},
|
|
1287
|
+
color: {
|
|
1288
|
+
black: [30, 39],
|
|
1289
|
+
red: [31, 39],
|
|
1290
|
+
green: [32, 39],
|
|
1291
|
+
yellow: [33, 39],
|
|
1292
|
+
blue: [34, 39],
|
|
1293
|
+
magenta: [35, 39],
|
|
1294
|
+
cyan: [36, 39],
|
|
1295
|
+
white: [37, 39],
|
|
1296
|
+
// Bright color
|
|
1297
|
+
blackBright: [90, 39],
|
|
1298
|
+
gray: [90, 39],
|
|
1299
|
+
// Alias of `blackBright`
|
|
1300
|
+
grey: [90, 39],
|
|
1301
|
+
// Alias of `blackBright`
|
|
1302
|
+
redBright: [91, 39],
|
|
1303
|
+
greenBright: [92, 39],
|
|
1304
|
+
yellowBright: [93, 39],
|
|
1305
|
+
blueBright: [94, 39],
|
|
1306
|
+
magentaBright: [95, 39],
|
|
1307
|
+
cyanBright: [96, 39],
|
|
1308
|
+
whiteBright: [97, 39]
|
|
1309
|
+
},
|
|
1310
|
+
bgColor: {
|
|
1311
|
+
bgBlack: [40, 49],
|
|
1312
|
+
bgRed: [41, 49],
|
|
1313
|
+
bgGreen: [42, 49],
|
|
1314
|
+
bgYellow: [43, 49],
|
|
1315
|
+
bgBlue: [44, 49],
|
|
1316
|
+
bgMagenta: [45, 49],
|
|
1317
|
+
bgCyan: [46, 49],
|
|
1318
|
+
bgWhite: [47, 49],
|
|
1319
|
+
// Bright color
|
|
1320
|
+
bgBlackBright: [100, 49],
|
|
1321
|
+
bgGray: [100, 49],
|
|
1322
|
+
// Alias of `bgBlackBright`
|
|
1323
|
+
bgGrey: [100, 49],
|
|
1324
|
+
// Alias of `bgBlackBright`
|
|
1325
|
+
bgRedBright: [101, 49],
|
|
1326
|
+
bgGreenBright: [102, 49],
|
|
1327
|
+
bgYellowBright: [103, 49],
|
|
1328
|
+
bgBlueBright: [104, 49],
|
|
1329
|
+
bgMagentaBright: [105, 49],
|
|
1330
|
+
bgCyanBright: [106, 49],
|
|
1331
|
+
bgWhiteBright: [107, 49]
|
|
1332
|
+
}
|
|
1333
|
+
};
|
|
1334
|
+
modifierNames = Object.keys(styles.modifier);
|
|
1335
|
+
foregroundColorNames = Object.keys(styles.color);
|
|
1336
|
+
backgroundColorNames = Object.keys(styles.bgColor);
|
|
1337
|
+
colorNames = [...foregroundColorNames, ...backgroundColorNames];
|
|
1338
|
+
ansiStyles = assembleStyles();
|
|
1339
|
+
ansi_styles_default = ansiStyles;
|
|
1340
|
+
}
|
|
1341
|
+
});
|
|
1342
|
+
|
|
1343
|
+
// node_modules/.pnpm/wrap-ansi@9.0.0/node_modules/wrap-ansi/index.js
|
|
1344
|
+
var wrap_ansi_exports = {};
|
|
1345
|
+
__export(wrap_ansi_exports, {
|
|
1346
|
+
default: () => wrapAnsi
|
|
1347
|
+
});
|
|
1348
|
+
function wrapAnsi(string, columns, options2) {
|
|
1349
|
+
return String(string).normalize().replaceAll("\r\n", "\n").split("\n").map((line) => exec(line, columns, options2)).join("\n");
|
|
1350
|
+
}
|
|
1351
|
+
var ESCAPES, END_CODE, ANSI_ESCAPE_BELL, ANSI_CSI, ANSI_OSC, ANSI_SGR_TERMINATOR, ANSI_ESCAPE_LINK, wrapAnsiCode, wrapAnsiHyperlink, wordLengths, wrapWord, stringVisibleTrimSpacesRight, exec;
|
|
1352
|
+
var init_wrap_ansi = __esm({
|
|
1353
|
+
"node_modules/.pnpm/wrap-ansi@9.0.0/node_modules/wrap-ansi/index.js"() {
|
|
1354
|
+
"use strict";
|
|
1355
|
+
init_string_width();
|
|
1356
|
+
init_strip_ansi();
|
|
1357
|
+
init_ansi_styles();
|
|
1358
|
+
ESCAPES = /* @__PURE__ */ new Set([
|
|
1359
|
+
"\x1B",
|
|
1360
|
+
"\x9B"
|
|
1361
|
+
]);
|
|
1362
|
+
END_CODE = 39;
|
|
1363
|
+
ANSI_ESCAPE_BELL = "\x07";
|
|
1364
|
+
ANSI_CSI = "[";
|
|
1365
|
+
ANSI_OSC = "]";
|
|
1366
|
+
ANSI_SGR_TERMINATOR = "m";
|
|
1367
|
+
ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
|
1368
|
+
wrapAnsiCode = (code) => `${ESCAPES.values().next().value}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
|
|
1369
|
+
wrapAnsiHyperlink = (url) => `${ESCAPES.values().next().value}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
|
|
1370
|
+
wordLengths = (string) => string.split(" ").map((character) => stringWidth(character));
|
|
1371
|
+
wrapWord = (rows, word, columns) => {
|
|
1372
|
+
const characters = [...word];
|
|
1373
|
+
let isInsideEscape = false;
|
|
1374
|
+
let isInsideLinkEscape = false;
|
|
1375
|
+
let visible = stringWidth(stripAnsi(rows.at(-1)));
|
|
1376
|
+
for (const [index, character] of characters.entries()) {
|
|
1377
|
+
const characterLength = stringWidth(character);
|
|
1378
|
+
if (visible + characterLength <= columns) {
|
|
1379
|
+
rows[rows.length - 1] += character;
|
|
1380
|
+
} else {
|
|
1381
|
+
rows.push(character);
|
|
1382
|
+
visible = 0;
|
|
1383
|
+
}
|
|
1384
|
+
if (ESCAPES.has(character)) {
|
|
1385
|
+
isInsideEscape = true;
|
|
1386
|
+
const ansiEscapeLinkCandidate = characters.slice(index + 1, index + 1 + ANSI_ESCAPE_LINK.length).join("");
|
|
1387
|
+
isInsideLinkEscape = ansiEscapeLinkCandidate === ANSI_ESCAPE_LINK;
|
|
1388
|
+
}
|
|
1389
|
+
if (isInsideEscape) {
|
|
1390
|
+
if (isInsideLinkEscape) {
|
|
1391
|
+
if (character === ANSI_ESCAPE_BELL) {
|
|
1392
|
+
isInsideEscape = false;
|
|
1393
|
+
isInsideLinkEscape = false;
|
|
1394
|
+
}
|
|
1395
|
+
} else if (character === ANSI_SGR_TERMINATOR) {
|
|
1396
|
+
isInsideEscape = false;
|
|
1397
|
+
}
|
|
1398
|
+
continue;
|
|
1399
|
+
}
|
|
1400
|
+
visible += characterLength;
|
|
1401
|
+
if (visible === columns && index < characters.length - 1) {
|
|
1402
|
+
rows.push("");
|
|
1403
|
+
visible = 0;
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1406
|
+
if (!visible && rows.at(-1).length > 0 && rows.length > 1) {
|
|
1407
|
+
rows[rows.length - 2] += rows.pop();
|
|
1408
|
+
}
|
|
1409
|
+
};
|
|
1410
|
+
stringVisibleTrimSpacesRight = (string) => {
|
|
1411
|
+
const words = string.split(" ");
|
|
1412
|
+
let last = words.length;
|
|
1413
|
+
while (last > 0) {
|
|
1414
|
+
if (stringWidth(words[last - 1]) > 0) {
|
|
1415
|
+
break;
|
|
1416
|
+
}
|
|
1417
|
+
last--;
|
|
1418
|
+
}
|
|
1419
|
+
if (last === words.length) {
|
|
1420
|
+
return string;
|
|
1421
|
+
}
|
|
1422
|
+
return words.slice(0, last).join(" ") + words.slice(last).join("");
|
|
1423
|
+
};
|
|
1424
|
+
exec = (string, columns, options2 = {}) => {
|
|
1425
|
+
if (options2.trim !== false && string.trim() === "") {
|
|
1426
|
+
return "";
|
|
1427
|
+
}
|
|
1428
|
+
let returnValue = "";
|
|
1429
|
+
let escapeCode;
|
|
1430
|
+
let escapeUrl;
|
|
1431
|
+
const lengths = wordLengths(string);
|
|
1432
|
+
let rows = [""];
|
|
1433
|
+
for (const [index, word] of string.split(" ").entries()) {
|
|
1434
|
+
if (options2.trim !== false) {
|
|
1435
|
+
rows[rows.length - 1] = rows.at(-1).trimStart();
|
|
1436
|
+
}
|
|
1437
|
+
let rowLength = stringWidth(rows.at(-1));
|
|
1438
|
+
if (index !== 0) {
|
|
1439
|
+
if (rowLength >= columns && (options2.wordWrap === false || options2.trim === false)) {
|
|
1440
|
+
rows.push("");
|
|
1441
|
+
rowLength = 0;
|
|
1442
|
+
}
|
|
1443
|
+
if (rowLength > 0 || options2.trim === false) {
|
|
1444
|
+
rows[rows.length - 1] += " ";
|
|
1445
|
+
rowLength++;
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1448
|
+
if (options2.hard && lengths[index] > columns) {
|
|
1449
|
+
const remainingColumns = columns - rowLength;
|
|
1450
|
+
const breaksStartingThisLine = 1 + Math.floor((lengths[index] - remainingColumns - 1) / columns);
|
|
1451
|
+
const breaksStartingNextLine = Math.floor((lengths[index] - 1) / columns);
|
|
1452
|
+
if (breaksStartingNextLine < breaksStartingThisLine) {
|
|
1453
|
+
rows.push("");
|
|
1454
|
+
}
|
|
1455
|
+
wrapWord(rows, word, columns);
|
|
1456
|
+
continue;
|
|
1457
|
+
}
|
|
1458
|
+
if (rowLength + lengths[index] > columns && rowLength > 0 && lengths[index] > 0) {
|
|
1459
|
+
if (options2.wordWrap === false && rowLength < columns) {
|
|
1460
|
+
wrapWord(rows, word, columns);
|
|
1461
|
+
continue;
|
|
1462
|
+
}
|
|
1463
|
+
rows.push("");
|
|
1464
|
+
}
|
|
1465
|
+
if (rowLength + lengths[index] > columns && options2.wordWrap === false) {
|
|
1466
|
+
wrapWord(rows, word, columns);
|
|
1467
|
+
continue;
|
|
1468
|
+
}
|
|
1469
|
+
rows[rows.length - 1] += word;
|
|
1470
|
+
}
|
|
1471
|
+
if (options2.trim !== false) {
|
|
1472
|
+
rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
|
|
1473
|
+
}
|
|
1474
|
+
const preString = rows.join("\n");
|
|
1475
|
+
const pre = [...preString];
|
|
1476
|
+
let preStringIndex = 0;
|
|
1477
|
+
for (const [index, character] of pre.entries()) {
|
|
1478
|
+
returnValue += character;
|
|
1479
|
+
if (ESCAPES.has(character)) {
|
|
1480
|
+
const { groups } = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`).exec(preString.slice(preStringIndex)) || { groups: {} };
|
|
1481
|
+
if (groups.code !== void 0) {
|
|
1482
|
+
const code2 = Number.parseFloat(groups.code);
|
|
1483
|
+
escapeCode = code2 === END_CODE ? void 0 : code2;
|
|
1484
|
+
} else if (groups.uri !== void 0) {
|
|
1485
|
+
escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1488
|
+
const code = ansi_styles_default.codes.get(Number(escapeCode));
|
|
1489
|
+
if (pre[index + 1] === "\n") {
|
|
1490
|
+
if (escapeUrl) {
|
|
1491
|
+
returnValue += wrapAnsiHyperlink("");
|
|
1492
|
+
}
|
|
1493
|
+
if (escapeCode && code) {
|
|
1494
|
+
returnValue += wrapAnsiCode(code);
|
|
1495
|
+
}
|
|
1496
|
+
} else if (character === "\n") {
|
|
1497
|
+
if (escapeCode && code) {
|
|
1498
|
+
returnValue += wrapAnsiCode(escapeCode);
|
|
1499
|
+
}
|
|
1500
|
+
if (escapeUrl) {
|
|
1501
|
+
returnValue += wrapAnsiHyperlink(escapeUrl);
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
1504
|
+
preStringIndex += character.length;
|
|
1505
|
+
}
|
|
1506
|
+
return returnValue;
|
|
1507
|
+
};
|
|
1508
|
+
}
|
|
1509
|
+
});
|
|
1510
|
+
|
|
1511
|
+
// node_modules/.pnpm/is-fullwidth-code-point@5.0.0/node_modules/is-fullwidth-code-point/index.js
|
|
1512
|
+
function isFullwidthCodePoint(codePoint) {
|
|
1513
|
+
if (!Number.isInteger(codePoint)) {
|
|
1514
|
+
return false;
|
|
1515
|
+
}
|
|
1516
|
+
return eastAsianWidth(codePoint) === 2;
|
|
1517
|
+
}
|
|
1518
|
+
var init_is_fullwidth_code_point = __esm({
|
|
1519
|
+
"node_modules/.pnpm/is-fullwidth-code-point@5.0.0/node_modules/is-fullwidth-code-point/index.js"() {
|
|
1520
|
+
"use strict";
|
|
1521
|
+
init_get_east_asian_width();
|
|
1522
|
+
}
|
|
1523
|
+
});
|
|
1524
|
+
|
|
1525
|
+
// node_modules/.pnpm/slice-ansi@7.1.0/node_modules/slice-ansi/index.js
|
|
1526
|
+
function getEndCode(code) {
|
|
1527
|
+
if (endCodesSet.has(code)) {
|
|
1528
|
+
return code;
|
|
1529
|
+
}
|
|
1530
|
+
if (endCodesMap.has(code)) {
|
|
1531
|
+
return endCodesMap.get(code);
|
|
1532
|
+
}
|
|
1533
|
+
code = code.slice(2);
|
|
1534
|
+
if (code.includes(";")) {
|
|
1535
|
+
code = code[0] + "0";
|
|
1536
|
+
}
|
|
1537
|
+
const returnValue = ansi_styles_default.codes.get(Number.parseInt(code, 10));
|
|
1538
|
+
if (returnValue) {
|
|
1539
|
+
return ansi_styles_default.color.ansi(returnValue);
|
|
1540
|
+
}
|
|
1541
|
+
return ansi_styles_default.reset.open;
|
|
1542
|
+
}
|
|
1543
|
+
function findNumberIndex(string) {
|
|
1544
|
+
for (let index = 0; index < string.length; index++) {
|
|
1545
|
+
const codePoint = string.codePointAt(index);
|
|
1546
|
+
if (codePoint >= CODE_POINT_0 && codePoint <= CODE_POINT_9) {
|
|
1547
|
+
return index;
|
|
1548
|
+
}
|
|
1549
|
+
}
|
|
1550
|
+
return -1;
|
|
1551
|
+
}
|
|
1552
|
+
function parseAnsiCode(string, offset) {
|
|
1553
|
+
string = string.slice(offset, offset + 19);
|
|
1554
|
+
const startIndex = findNumberIndex(string);
|
|
1555
|
+
if (startIndex !== -1) {
|
|
1556
|
+
let endIndex = string.indexOf("m", startIndex);
|
|
1557
|
+
if (endIndex === -1) {
|
|
1558
|
+
endIndex = string.length;
|
|
1559
|
+
}
|
|
1560
|
+
return string.slice(0, endIndex + 1);
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
function tokenize(string, endCharacter = Number.POSITIVE_INFINITY) {
|
|
1564
|
+
const returnValue = [];
|
|
1565
|
+
let index = 0;
|
|
1566
|
+
let visibleCount = 0;
|
|
1567
|
+
while (index < string.length) {
|
|
1568
|
+
const codePoint = string.codePointAt(index);
|
|
1569
|
+
if (ESCAPES2.has(codePoint)) {
|
|
1570
|
+
const code = parseAnsiCode(string, index);
|
|
1571
|
+
if (code) {
|
|
1572
|
+
returnValue.push({
|
|
1573
|
+
type: "ansi",
|
|
1574
|
+
code,
|
|
1575
|
+
endCode: getEndCode(code)
|
|
1576
|
+
});
|
|
1577
|
+
index += code.length;
|
|
1578
|
+
continue;
|
|
1579
|
+
}
|
|
1580
|
+
}
|
|
1581
|
+
const isFullWidth2 = isFullwidthCodePoint(codePoint);
|
|
1582
|
+
const character = String.fromCodePoint(codePoint);
|
|
1583
|
+
returnValue.push({
|
|
1584
|
+
type: "character",
|
|
1585
|
+
value: character,
|
|
1586
|
+
isFullWidth: isFullWidth2
|
|
1587
|
+
});
|
|
1588
|
+
index += character.length;
|
|
1589
|
+
visibleCount += isFullWidth2 ? 2 : character.length;
|
|
1590
|
+
if (visibleCount >= endCharacter) {
|
|
1591
|
+
break;
|
|
1592
|
+
}
|
|
1593
|
+
}
|
|
1594
|
+
return returnValue;
|
|
1595
|
+
}
|
|
1596
|
+
function reduceAnsiCodes(codes) {
|
|
1597
|
+
let returnValue = [];
|
|
1598
|
+
for (const code of codes) {
|
|
1599
|
+
if (code.code === ansi_styles_default.reset.open) {
|
|
1600
|
+
returnValue = [];
|
|
1601
|
+
} else if (endCodesSet.has(code.code)) {
|
|
1602
|
+
returnValue = returnValue.filter((returnValueCode) => returnValueCode.endCode !== code.code);
|
|
1603
|
+
} else {
|
|
1604
|
+
returnValue = returnValue.filter((returnValueCode) => returnValueCode.endCode !== code.endCode);
|
|
1605
|
+
returnValue.push(code);
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1608
|
+
return returnValue;
|
|
1609
|
+
}
|
|
1610
|
+
function undoAnsiCodes(codes) {
|
|
1611
|
+
const reduced = reduceAnsiCodes(codes);
|
|
1612
|
+
const endCodes = reduced.map(({ endCode }) => endCode);
|
|
1613
|
+
return endCodes.reverse().join("");
|
|
1614
|
+
}
|
|
1615
|
+
function sliceAnsi(string, start, end) {
|
|
1616
|
+
const tokens = tokenize(string, end);
|
|
1617
|
+
let activeCodes = [];
|
|
1618
|
+
let position = 0;
|
|
1619
|
+
let returnValue = "";
|
|
1620
|
+
let include = false;
|
|
1621
|
+
for (const token of tokens) {
|
|
1622
|
+
if (end !== void 0 && position >= end) {
|
|
1623
|
+
break;
|
|
1624
|
+
}
|
|
1625
|
+
if (token.type === "ansi") {
|
|
1626
|
+
activeCodes.push(token);
|
|
1627
|
+
if (include) {
|
|
1628
|
+
returnValue += token.code;
|
|
1629
|
+
}
|
|
1630
|
+
} else {
|
|
1631
|
+
if (!include && position >= start) {
|
|
1632
|
+
include = true;
|
|
1633
|
+
activeCodes = reduceAnsiCodes(activeCodes);
|
|
1634
|
+
returnValue = activeCodes.map(({ code }) => code).join("");
|
|
1635
|
+
}
|
|
1636
|
+
if (include) {
|
|
1637
|
+
returnValue += token.value;
|
|
1638
|
+
}
|
|
1639
|
+
position += token.isFullWidth ? 2 : token.value.length;
|
|
1640
|
+
}
|
|
1641
|
+
}
|
|
1642
|
+
returnValue += undoAnsiCodes(activeCodes);
|
|
1643
|
+
return returnValue;
|
|
1644
|
+
}
|
|
1645
|
+
var ESCAPES2, CODE_POINT_0, CODE_POINT_9, endCodesSet, endCodesMap;
|
|
1646
|
+
var init_slice_ansi = __esm({
|
|
1647
|
+
"node_modules/.pnpm/slice-ansi@7.1.0/node_modules/slice-ansi/index.js"() {
|
|
1648
|
+
"use strict";
|
|
1649
|
+
init_ansi_styles();
|
|
1650
|
+
init_is_fullwidth_code_point();
|
|
1651
|
+
ESCAPES2 = /* @__PURE__ */ new Set([27, 155]);
|
|
1652
|
+
CODE_POINT_0 = "0".codePointAt(0);
|
|
1653
|
+
CODE_POINT_9 = "9".codePointAt(0);
|
|
1654
|
+
endCodesSet = /* @__PURE__ */ new Set();
|
|
1655
|
+
endCodesMap = /* @__PURE__ */ new Map();
|
|
1656
|
+
for (const [start, end] of ansi_styles_default.codes) {
|
|
1657
|
+
endCodesSet.add(ansi_styles_default.color.ansi(end));
|
|
1658
|
+
endCodesMap.set(ansi_styles_default.color.ansi(start), ansi_styles_default.color.ansi(end));
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
});
|
|
1662
|
+
|
|
1663
|
+
// node_modules/.pnpm/log-update@6.1.0/node_modules/log-update/index.js
|
|
1664
|
+
var log_update_exports = {};
|
|
1665
|
+
__export(log_update_exports, {
|
|
1666
|
+
createLogUpdate: () => createLogUpdate,
|
|
1667
|
+
default: () => log_update_default,
|
|
1668
|
+
logUpdateStderr: () => logUpdateStderr
|
|
1669
|
+
});
|
|
1670
|
+
import process6 from "node:process";
|
|
1671
|
+
function createLogUpdate(stream, { showCursor = false } = {}) {
|
|
1672
|
+
let previousLineCount = 0;
|
|
1673
|
+
let previousWidth = getWidth(stream);
|
|
1674
|
+
let previousOutput = "";
|
|
1675
|
+
const reset2 = () => {
|
|
1676
|
+
previousOutput = "";
|
|
1677
|
+
previousWidth = getWidth(stream);
|
|
1678
|
+
previousLineCount = 0;
|
|
1679
|
+
};
|
|
1680
|
+
const render = (...arguments_) => {
|
|
1681
|
+
if (!showCursor) {
|
|
1682
|
+
cli_cursor_default.hide();
|
|
1683
|
+
}
|
|
1684
|
+
let output = fitToTerminalHeight(stream, arguments_.join(" ") + "\n");
|
|
1685
|
+
const width = getWidth(stream);
|
|
1686
|
+
if (output === previousOutput && previousWidth === width) {
|
|
1687
|
+
return;
|
|
1688
|
+
}
|
|
1689
|
+
previousOutput = output;
|
|
1690
|
+
previousWidth = width;
|
|
1691
|
+
output = wrapAnsi(output, width, { trim: false, hard: true, wordWrap: false });
|
|
1692
|
+
stream.write(base_exports.eraseLines(previousLineCount) + output);
|
|
1693
|
+
previousLineCount = output.split("\n").length;
|
|
1694
|
+
};
|
|
1695
|
+
render.clear = () => {
|
|
1696
|
+
stream.write(base_exports.eraseLines(previousLineCount));
|
|
1697
|
+
reset2();
|
|
1698
|
+
};
|
|
1699
|
+
render.done = () => {
|
|
1700
|
+
reset2();
|
|
1701
|
+
if (!showCursor) {
|
|
1702
|
+
cli_cursor_default.show();
|
|
1703
|
+
}
|
|
1704
|
+
};
|
|
1705
|
+
return render;
|
|
1706
|
+
}
|
|
1707
|
+
var defaultTerminalHeight, getWidth, fitToTerminalHeight, logUpdate, log_update_default, logUpdateStderr;
|
|
1708
|
+
var init_log_update = __esm({
|
|
1709
|
+
"node_modules/.pnpm/log-update@6.1.0/node_modules/log-update/index.js"() {
|
|
1710
|
+
"use strict";
|
|
1711
|
+
init_ansi_escapes();
|
|
1712
|
+
init_cli_cursor();
|
|
1713
|
+
init_wrap_ansi();
|
|
1714
|
+
init_slice_ansi();
|
|
1715
|
+
init_strip_ansi();
|
|
1716
|
+
defaultTerminalHeight = 24;
|
|
1717
|
+
getWidth = ({ columns = 80 }) => columns;
|
|
1718
|
+
fitToTerminalHeight = (stream, text) => {
|
|
1719
|
+
const terminalHeight = stream.rows ?? defaultTerminalHeight;
|
|
1720
|
+
const lines = text.split("\n");
|
|
1721
|
+
const toRemove = Math.max(0, lines.length - terminalHeight);
|
|
1722
|
+
return toRemove ? sliceAnsi(text, stripAnsi(lines.slice(0, toRemove).join("\n")).length + 1) : text;
|
|
1723
|
+
};
|
|
1724
|
+
logUpdate = createLogUpdate(process6.stdout);
|
|
1725
|
+
log_update_default = logUpdate;
|
|
1726
|
+
logUpdateStderr = createLogUpdate(process6.stderr);
|
|
1727
|
+
}
|
|
1728
|
+
});
|
|
1729
|
+
|
|
1730
|
+
// node_modules/.pnpm/is-fullwidth-code-point@4.0.0/node_modules/is-fullwidth-code-point/index.js
|
|
1731
|
+
function isFullwidthCodePoint2(codePoint) {
|
|
1732
|
+
if (!Number.isInteger(codePoint)) {
|
|
1733
|
+
return false;
|
|
1734
|
+
}
|
|
1735
|
+
return codePoint >= 4352 && (codePoint <= 4447 || // Hangul Jamo
|
|
1736
|
+
codePoint === 9001 || // LEFT-POINTING ANGLE BRACKET
|
|
1737
|
+
codePoint === 9002 || // RIGHT-POINTING ANGLE BRACKET
|
|
1738
|
+
// CJK Radicals Supplement .. Enclosed CJK Letters and Months
|
|
1739
|
+
11904 <= codePoint && codePoint <= 12871 && codePoint !== 12351 || // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
|
|
1740
|
+
12880 <= codePoint && codePoint <= 19903 || // CJK Unified Ideographs .. Yi Radicals
|
|
1741
|
+
19968 <= codePoint && codePoint <= 42182 || // Hangul Jamo Extended-A
|
|
1742
|
+
43360 <= codePoint && codePoint <= 43388 || // Hangul Syllables
|
|
1743
|
+
44032 <= codePoint && codePoint <= 55203 || // CJK Compatibility Ideographs
|
|
1744
|
+
63744 <= codePoint && codePoint <= 64255 || // Vertical Forms
|
|
1745
|
+
65040 <= codePoint && codePoint <= 65049 || // CJK Compatibility Forms .. Small Form Variants
|
|
1746
|
+
65072 <= codePoint && codePoint <= 65131 || // Halfwidth and Fullwidth Forms
|
|
1747
|
+
65281 <= codePoint && codePoint <= 65376 || 65504 <= codePoint && codePoint <= 65510 || // Kana Supplement
|
|
1748
|
+
110592 <= codePoint && codePoint <= 110593 || // Enclosed Ideographic Supplement
|
|
1749
|
+
127488 <= codePoint && codePoint <= 127569 || // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
|
|
1750
|
+
131072 <= codePoint && codePoint <= 262141);
|
|
1751
|
+
}
|
|
1752
|
+
var init_is_fullwidth_code_point2 = __esm({
|
|
1753
|
+
"node_modules/.pnpm/is-fullwidth-code-point@4.0.0/node_modules/is-fullwidth-code-point/index.js"() {
|
|
1754
|
+
"use strict";
|
|
1755
|
+
}
|
|
1756
|
+
});
|
|
1757
|
+
|
|
1758
|
+
// node_modules/.pnpm/slice-ansi@5.0.0/node_modules/slice-ansi/index.js
|
|
1759
|
+
function sliceAnsi2(string, begin, end) {
|
|
1760
|
+
const characters = [...string];
|
|
1761
|
+
const ansiCodes = [];
|
|
1762
|
+
let stringEnd = typeof end === "number" ? end : characters.length;
|
|
1763
|
+
let isInsideEscape = false;
|
|
1764
|
+
let ansiCode;
|
|
1765
|
+
let visible = 0;
|
|
1766
|
+
let output = "";
|
|
1767
|
+
for (const [index, character] of characters.entries()) {
|
|
1768
|
+
let leftEscape = false;
|
|
1769
|
+
if (ESCAPES3.includes(character)) {
|
|
1770
|
+
const code = /\d[^m]*/.exec(string.slice(index, index + 18));
|
|
1771
|
+
ansiCode = code && code.length > 0 ? code[0] : void 0;
|
|
1772
|
+
if (visible < stringEnd) {
|
|
1773
|
+
isInsideEscape = true;
|
|
1774
|
+
if (ansiCode !== void 0) {
|
|
1775
|
+
ansiCodes.push(ansiCode);
|
|
1776
|
+
}
|
|
1777
|
+
}
|
|
1778
|
+
} else if (isInsideEscape && character === "m") {
|
|
1779
|
+
isInsideEscape = false;
|
|
1780
|
+
leftEscape = true;
|
|
1781
|
+
}
|
|
1782
|
+
if (!isInsideEscape && !leftEscape) {
|
|
1783
|
+
visible++;
|
|
1784
|
+
}
|
|
1785
|
+
if (!astralRegex.test(character) && isFullwidthCodePoint2(character.codePointAt())) {
|
|
1786
|
+
visible++;
|
|
1787
|
+
if (typeof end !== "number") {
|
|
1788
|
+
stringEnd++;
|
|
1789
|
+
}
|
|
1790
|
+
}
|
|
1791
|
+
if (visible > begin && visible <= stringEnd) {
|
|
1792
|
+
output += character;
|
|
1793
|
+
} else if (visible === begin && !isInsideEscape && ansiCode !== void 0) {
|
|
1794
|
+
output = checkAnsi(ansiCodes);
|
|
1795
|
+
} else if (visible >= stringEnd) {
|
|
1796
|
+
output += checkAnsi(ansiCodes, true, ansiCode);
|
|
1797
|
+
break;
|
|
1798
|
+
}
|
|
1799
|
+
}
|
|
1800
|
+
return output;
|
|
1801
|
+
}
|
|
1802
|
+
var astralRegex, ESCAPES3, wrapAnsi2, checkAnsi;
|
|
1803
|
+
var init_slice_ansi2 = __esm({
|
|
1804
|
+
"node_modules/.pnpm/slice-ansi@5.0.0/node_modules/slice-ansi/index.js"() {
|
|
1805
|
+
"use strict";
|
|
1806
|
+
init_is_fullwidth_code_point2();
|
|
1807
|
+
init_ansi_styles();
|
|
1808
|
+
astralRegex = /^[\uD800-\uDBFF][\uDC00-\uDFFF]$/;
|
|
1809
|
+
ESCAPES3 = [
|
|
1810
|
+
"\x1B",
|
|
1811
|
+
"\x9B"
|
|
1812
|
+
];
|
|
1813
|
+
wrapAnsi2 = (code) => `${ESCAPES3[0]}[${code}m`;
|
|
1814
|
+
checkAnsi = (ansiCodes, isEscapes, endAnsiCode) => {
|
|
1815
|
+
let output = [];
|
|
1816
|
+
ansiCodes = [...ansiCodes];
|
|
1817
|
+
for (let ansiCode of ansiCodes) {
|
|
1818
|
+
const ansiCodeOrigin = ansiCode;
|
|
1819
|
+
if (ansiCode.includes(";")) {
|
|
1820
|
+
ansiCode = ansiCode.split(";")[0][0] + "0";
|
|
1821
|
+
}
|
|
1822
|
+
const item = ansi_styles_default.codes.get(Number.parseInt(ansiCode, 10));
|
|
1823
|
+
if (item) {
|
|
1824
|
+
const indexEscape = ansiCodes.indexOf(item.toString());
|
|
1825
|
+
if (indexEscape === -1) {
|
|
1826
|
+
output.push(wrapAnsi2(isEscapes ? item : ansiCodeOrigin));
|
|
1827
|
+
} else {
|
|
1828
|
+
ansiCodes.splice(indexEscape, 1);
|
|
1829
|
+
}
|
|
1830
|
+
} else if (isEscapes) {
|
|
1831
|
+
output.push(wrapAnsi2(0));
|
|
1832
|
+
break;
|
|
1833
|
+
} else {
|
|
1834
|
+
output.push(wrapAnsi2(ansiCodeOrigin));
|
|
1835
|
+
}
|
|
1836
|
+
}
|
|
1837
|
+
if (isEscapes) {
|
|
1838
|
+
output = output.filter((element, index) => output.indexOf(element) === index);
|
|
1839
|
+
if (endAnsiCode !== void 0) {
|
|
1840
|
+
const fistEscapeCode = wrapAnsi2(ansi_styles_default.codes.get(Number.parseInt(endAnsiCode, 10)));
|
|
1841
|
+
output = output.reduce((current, next) => next === fistEscapeCode ? [next, ...current] : [...current, next], []);
|
|
1842
|
+
}
|
|
1843
|
+
}
|
|
1844
|
+
return output.join("");
|
|
1845
|
+
};
|
|
1846
|
+
}
|
|
1847
|
+
});
|
|
1848
|
+
|
|
1849
|
+
// node_modules/.pnpm/cli-truncate@4.0.0/node_modules/cli-truncate/index.js
|
|
1850
|
+
var cli_truncate_exports = {};
|
|
1851
|
+
__export(cli_truncate_exports, {
|
|
1852
|
+
default: () => cliTruncate
|
|
1853
|
+
});
|
|
1854
|
+
function getIndexOfNearestSpace(string, wantedIndex, shouldSearchRight) {
|
|
1855
|
+
if (string.charAt(wantedIndex) === " ") {
|
|
1856
|
+
return wantedIndex;
|
|
1857
|
+
}
|
|
1858
|
+
const direction = shouldSearchRight ? 1 : -1;
|
|
1859
|
+
for (let index = 0; index <= 3; index++) {
|
|
1860
|
+
const finalIndex = wantedIndex + index * direction;
|
|
1861
|
+
if (string.charAt(finalIndex) === " ") {
|
|
1862
|
+
return finalIndex;
|
|
1863
|
+
}
|
|
1864
|
+
}
|
|
1865
|
+
return wantedIndex;
|
|
1866
|
+
}
|
|
1867
|
+
function cliTruncate(text, columns, options2 = {}) {
|
|
1868
|
+
const {
|
|
1869
|
+
position = "end",
|
|
1870
|
+
space = false,
|
|
1871
|
+
preferTruncationOnSpace = false
|
|
1872
|
+
} = options2;
|
|
1873
|
+
let { truncationCharacter = "\u2026" } = options2;
|
|
1874
|
+
if (typeof text !== "string") {
|
|
1875
|
+
throw new TypeError(`Expected \`input\` to be a string, got ${typeof text}`);
|
|
1876
|
+
}
|
|
1877
|
+
if (typeof columns !== "number") {
|
|
1878
|
+
throw new TypeError(`Expected \`columns\` to be a number, got ${typeof columns}`);
|
|
1879
|
+
}
|
|
1880
|
+
if (columns < 1) {
|
|
1881
|
+
return "";
|
|
1882
|
+
}
|
|
1883
|
+
if (columns === 1) {
|
|
1884
|
+
return truncationCharacter;
|
|
1885
|
+
}
|
|
1886
|
+
const length = stringWidth(text);
|
|
1887
|
+
if (length <= columns) {
|
|
1888
|
+
return text;
|
|
1889
|
+
}
|
|
1890
|
+
if (position === "start") {
|
|
1891
|
+
if (preferTruncationOnSpace) {
|
|
1892
|
+
const nearestSpace = getIndexOfNearestSpace(text, length - columns + 1, true);
|
|
1893
|
+
return truncationCharacter + sliceAnsi2(text, nearestSpace, length).trim();
|
|
1894
|
+
}
|
|
1895
|
+
if (space === true) {
|
|
1896
|
+
truncationCharacter += " ";
|
|
1897
|
+
}
|
|
1898
|
+
return truncationCharacter + sliceAnsi2(text, length - columns + stringWidth(truncationCharacter), length);
|
|
1899
|
+
}
|
|
1900
|
+
if (position === "middle") {
|
|
1901
|
+
if (space === true) {
|
|
1902
|
+
truncationCharacter = ` ${truncationCharacter} `;
|
|
1903
|
+
}
|
|
1904
|
+
const half = Math.floor(columns / 2);
|
|
1905
|
+
if (preferTruncationOnSpace) {
|
|
1906
|
+
const spaceNearFirstBreakPoint = getIndexOfNearestSpace(text, half);
|
|
1907
|
+
const spaceNearSecondBreakPoint = getIndexOfNearestSpace(text, length - (columns - half) + 1, true);
|
|
1908
|
+
return sliceAnsi2(text, 0, spaceNearFirstBreakPoint) + truncationCharacter + sliceAnsi2(text, spaceNearSecondBreakPoint, length).trim();
|
|
1909
|
+
}
|
|
1910
|
+
return sliceAnsi2(text, 0, half) + truncationCharacter + sliceAnsi2(text, length - (columns - half) + stringWidth(truncationCharacter), length);
|
|
1911
|
+
}
|
|
1912
|
+
if (position === "end") {
|
|
1913
|
+
if (preferTruncationOnSpace) {
|
|
1914
|
+
const nearestSpace = getIndexOfNearestSpace(text, columns - 1);
|
|
1915
|
+
return sliceAnsi2(text, 0, nearestSpace) + truncationCharacter;
|
|
1916
|
+
}
|
|
1917
|
+
if (space === true) {
|
|
1918
|
+
truncationCharacter = ` ${truncationCharacter}`;
|
|
1919
|
+
}
|
|
1920
|
+
return sliceAnsi2(text, 0, columns - stringWidth(truncationCharacter)) + truncationCharacter;
|
|
1921
|
+
}
|
|
1922
|
+
throw new Error(`Expected \`options.position\` to be either \`start\`, \`middle\` or \`end\`, got ${position}`);
|
|
1923
|
+
}
|
|
1924
|
+
var init_cli_truncate = __esm({
|
|
1925
|
+
"node_modules/.pnpm/cli-truncate@4.0.0/node_modules/cli-truncate/index.js"() {
|
|
1926
|
+
"use strict";
|
|
1927
|
+
init_slice_ansi2();
|
|
1928
|
+
init_string_width();
|
|
1929
|
+
}
|
|
1930
|
+
});
|
|
6
1931
|
|
|
7
1932
|
// src/cli.ts
|
|
8
1933
|
import cac from "cac";
|
|
9
1934
|
import semver2 from "semver";
|
|
10
1935
|
|
|
1936
|
+
// node_modules/.pnpm/eventemitter3@5.0.1/node_modules/eventemitter3/index.mjs
|
|
1937
|
+
var import_index = __toESM(require_eventemitter3(), 1);
|
|
1938
|
+
var eventemitter3_default = import_index.default;
|
|
1939
|
+
|
|
1940
|
+
// node_modules/.pnpm/colorette@2.0.20/node_modules/colorette/index.js
|
|
1941
|
+
import * as tty from "tty";
|
|
1942
|
+
var {
|
|
1943
|
+
env = {},
|
|
1944
|
+
argv = [],
|
|
1945
|
+
platform = ""
|
|
1946
|
+
} = typeof process === "undefined" ? {} : process;
|
|
1947
|
+
var isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
|
|
1948
|
+
var isForced = "FORCE_COLOR" in env || argv.includes("--color");
|
|
1949
|
+
var isWindows = platform === "win32";
|
|
1950
|
+
var isDumbTerminal = env.TERM === "dumb";
|
|
1951
|
+
var isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env.TERM && !isDumbTerminal;
|
|
1952
|
+
var isCI = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
|
|
1953
|
+
var isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
|
|
1954
|
+
var replaceClose = (index, string, close, replace, head = string.substring(0, index) + replace, tail = string.substring(index + close.length), next = tail.indexOf(close)) => head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
|
|
1955
|
+
var clearBleed = (index, string, open2, close, replace) => index < 0 ? open2 + string + close : open2 + replaceClose(index, string, close, replace) + close;
|
|
1956
|
+
var filterEmpty = (open2, close, replace = open2, at = open2.length + 1) => (string) => string || !(string === "" || string === void 0) ? clearBleed(
|
|
1957
|
+
("" + string).indexOf(close, at),
|
|
1958
|
+
string,
|
|
1959
|
+
open2,
|
|
1960
|
+
close,
|
|
1961
|
+
replace
|
|
1962
|
+
) : "";
|
|
1963
|
+
var init = (open2, close, replace) => filterEmpty(`\x1B[${open2}m`, `\x1B[${close}m`, replace);
|
|
1964
|
+
var colors = {
|
|
1965
|
+
reset: init(0, 0),
|
|
1966
|
+
bold: init(1, 22, "\x1B[22m\x1B[1m"),
|
|
1967
|
+
dim: init(2, 22, "\x1B[22m\x1B[2m"),
|
|
1968
|
+
italic: init(3, 23),
|
|
1969
|
+
underline: init(4, 24),
|
|
1970
|
+
inverse: init(7, 27),
|
|
1971
|
+
hidden: init(8, 28),
|
|
1972
|
+
strikethrough: init(9, 29),
|
|
1973
|
+
black: init(30, 39),
|
|
1974
|
+
red: init(31, 39),
|
|
1975
|
+
green: init(32, 39),
|
|
1976
|
+
yellow: init(33, 39),
|
|
1977
|
+
blue: init(34, 39),
|
|
1978
|
+
magenta: init(35, 39),
|
|
1979
|
+
cyan: init(36, 39),
|
|
1980
|
+
white: init(37, 39),
|
|
1981
|
+
gray: init(90, 39),
|
|
1982
|
+
bgBlack: init(40, 49),
|
|
1983
|
+
bgRed: init(41, 49),
|
|
1984
|
+
bgGreen: init(42, 49),
|
|
1985
|
+
bgYellow: init(43, 49),
|
|
1986
|
+
bgBlue: init(44, 49),
|
|
1987
|
+
bgMagenta: init(45, 49),
|
|
1988
|
+
bgCyan: init(46, 49),
|
|
1989
|
+
bgWhite: init(47, 49),
|
|
1990
|
+
blackBright: init(90, 39),
|
|
1991
|
+
redBright: init(91, 39),
|
|
1992
|
+
greenBright: init(92, 39),
|
|
1993
|
+
yellowBright: init(93, 39),
|
|
1994
|
+
blueBright: init(94, 39),
|
|
1995
|
+
magentaBright: init(95, 39),
|
|
1996
|
+
cyanBright: init(96, 39),
|
|
1997
|
+
whiteBright: init(97, 39),
|
|
1998
|
+
bgBlackBright: init(100, 49),
|
|
1999
|
+
bgRedBright: init(101, 49),
|
|
2000
|
+
bgGreenBright: init(102, 49),
|
|
2001
|
+
bgYellowBright: init(103, 49),
|
|
2002
|
+
bgBlueBright: init(104, 49),
|
|
2003
|
+
bgMagentaBright: init(105, 49),
|
|
2004
|
+
bgCyanBright: init(106, 49),
|
|
2005
|
+
bgWhiteBright: init(107, 49)
|
|
2006
|
+
};
|
|
2007
|
+
var createColors = ({ useColor = isColorSupported } = {}) => useColor ? colors : Object.keys(colors).reduce(
|
|
2008
|
+
(colors2, key) => ({ ...colors2, [key]: String }),
|
|
2009
|
+
{}
|
|
2010
|
+
);
|
|
2011
|
+
var {
|
|
2012
|
+
reset,
|
|
2013
|
+
bold,
|
|
2014
|
+
dim,
|
|
2015
|
+
italic,
|
|
2016
|
+
underline,
|
|
2017
|
+
inverse,
|
|
2018
|
+
hidden,
|
|
2019
|
+
strikethrough,
|
|
2020
|
+
black,
|
|
2021
|
+
red,
|
|
2022
|
+
green,
|
|
2023
|
+
yellow,
|
|
2024
|
+
blue,
|
|
2025
|
+
magenta,
|
|
2026
|
+
cyan,
|
|
2027
|
+
white,
|
|
2028
|
+
gray,
|
|
2029
|
+
bgBlack,
|
|
2030
|
+
bgRed,
|
|
2031
|
+
bgGreen,
|
|
2032
|
+
bgYellow,
|
|
2033
|
+
bgBlue,
|
|
2034
|
+
bgMagenta,
|
|
2035
|
+
bgCyan,
|
|
2036
|
+
bgWhite,
|
|
2037
|
+
blackBright,
|
|
2038
|
+
redBright,
|
|
2039
|
+
greenBright,
|
|
2040
|
+
yellowBright,
|
|
2041
|
+
blueBright,
|
|
2042
|
+
magentaBright,
|
|
2043
|
+
cyanBright,
|
|
2044
|
+
whiteBright,
|
|
2045
|
+
bgBlackBright,
|
|
2046
|
+
bgRedBright,
|
|
2047
|
+
bgGreenBright,
|
|
2048
|
+
bgYellowBright,
|
|
2049
|
+
bgBlueBright,
|
|
2050
|
+
bgMagentaBright,
|
|
2051
|
+
bgCyanBright,
|
|
2052
|
+
bgWhiteBright
|
|
2053
|
+
} = createColors();
|
|
2054
|
+
|
|
2055
|
+
// node_modules/.pnpm/listr2@8.2.5_patch_hash=dzzw7eoo3mv4jvfzuqul4v6lc4/node_modules/listr2/dist/index.js
|
|
2056
|
+
var import_rfdc = __toESM(require_rfdc(), 1);
|
|
2057
|
+
import { format } from "util";
|
|
2058
|
+
import { EOL } from "os";
|
|
2059
|
+
import { StringDecoder } from "string_decoder";
|
|
2060
|
+
import { EOL as EOL2 } from "os";
|
|
2061
|
+
import { Writable } from "stream";
|
|
2062
|
+
import { EOL as EOL3 } from "os";
|
|
2063
|
+
import { randomUUID } from "crypto";
|
|
2064
|
+
var __defProp2 = Object.defineProperty;
|
|
2065
|
+
var __name = (target, value) => __defProp2(target, "name", { value, configurable: true });
|
|
2066
|
+
var ANSI_ESCAPE = "\x1B[";
|
|
2067
|
+
var ANSI_ESCAPE_CODES = {
|
|
2068
|
+
CURSOR_HIDE: ANSI_ESCAPE + "?25l",
|
|
2069
|
+
CURSOR_SHOW: ANSI_ESCAPE + "?25h"
|
|
2070
|
+
};
|
|
2071
|
+
var ListrTaskState = /* @__PURE__ */ ((ListrTaskState2) => {
|
|
2072
|
+
ListrTaskState2["WAITING"] = "WAITING";
|
|
2073
|
+
ListrTaskState2["STARTED"] = "STARTED";
|
|
2074
|
+
ListrTaskState2["COMPLETED"] = "COMPLETED";
|
|
2075
|
+
ListrTaskState2["FAILED"] = "FAILED";
|
|
2076
|
+
ListrTaskState2["SKIPPED"] = "SKIPPED";
|
|
2077
|
+
ListrTaskState2["ROLLING_BACK"] = "ROLLING_BACK";
|
|
2078
|
+
ListrTaskState2["ROLLED_BACK"] = "ROLLED_BACK";
|
|
2079
|
+
ListrTaskState2["RETRY"] = "RETRY";
|
|
2080
|
+
ListrTaskState2["PAUSED"] = "PAUSED";
|
|
2081
|
+
ListrTaskState2["PROMPT"] = "PROMPT";
|
|
2082
|
+
ListrTaskState2["PROMPT_COMPLETED"] = "PROMPT_COMPLETED";
|
|
2083
|
+
ListrTaskState2["PROMPT_FAILED"] = "PROMPT_FAILED";
|
|
2084
|
+
return ListrTaskState2;
|
|
2085
|
+
})(ListrTaskState || {});
|
|
2086
|
+
var _a;
|
|
2087
|
+
var EventManager = (_a = class {
|
|
2088
|
+
constructor() {
|
|
2089
|
+
__publicField(this, "emitter", new eventemitter3_default());
|
|
2090
|
+
}
|
|
2091
|
+
emit(dispatch, args) {
|
|
2092
|
+
this.emitter.emit(dispatch, args);
|
|
2093
|
+
}
|
|
2094
|
+
on(dispatch, handler) {
|
|
2095
|
+
this.emitter.addListener(dispatch, handler);
|
|
2096
|
+
}
|
|
2097
|
+
once(dispatch, handler) {
|
|
2098
|
+
this.emitter.once(dispatch, handler);
|
|
2099
|
+
}
|
|
2100
|
+
off(dispatch, handler) {
|
|
2101
|
+
this.emitter.off(dispatch, handler);
|
|
2102
|
+
}
|
|
2103
|
+
complete() {
|
|
2104
|
+
this.emitter.removeAllListeners();
|
|
2105
|
+
}
|
|
2106
|
+
}, __name(_a, "EventManager"), _a);
|
|
2107
|
+
var _a2;
|
|
2108
|
+
var BaseEventMap = (_a2 = class {
|
|
2109
|
+
}, __name(_a2, "BaseEventMap"), _a2);
|
|
2110
|
+
function isObservable(obj) {
|
|
2111
|
+
return !!obj && typeof obj === "object" && typeof obj.subscribe === "function";
|
|
2112
|
+
}
|
|
2113
|
+
__name(isObservable, "isObservable");
|
|
2114
|
+
function isReadable(obj) {
|
|
2115
|
+
return !!obj && typeof obj === "object" && obj.readable === true && typeof obj.read === "function" && typeof obj.on === "function";
|
|
2116
|
+
}
|
|
2117
|
+
__name(isReadable, "isReadable");
|
|
2118
|
+
function isUnicodeSupported() {
|
|
2119
|
+
return !!process.env[
|
|
2120
|
+
"LISTR_FORCE_UNICODE"
|
|
2121
|
+
/* FORCE_UNICODE */
|
|
2122
|
+
] || process.platform !== "win32" || !!process.env.CI || !!process.env.WT_SESSION || process.env.TERM_PROGRAM === "vscode" || process.env.TERM === "xterm-256color" || process.env.TERM === "alacritty";
|
|
2123
|
+
}
|
|
2124
|
+
__name(isUnicodeSupported, "isUnicodeSupported");
|
|
2125
|
+
var CLEAR_LINE_REGEX = "(?:\\u001b|\\u009b)\\[[\\=><~/#&.:=?%@~_-]*[0-9]*[\\a-ln-tqyz=><~/#&.:=?%@~_-]+";
|
|
2126
|
+
var BELL_REGEX = /\u0007/;
|
|
2127
|
+
var HYPERLINK_REGEX = /(?:\u001b\]8;;.*?\u0007.*?\u001b\]8;;\u0007)/g;
|
|
2128
|
+
function cleanseAnsi(chunk) {
|
|
2129
|
+
const hyperlinks = chunk.match(HYPERLINK_REGEX) || [];
|
|
2130
|
+
let cleansedChunk = String(chunk).replace(new RegExp(HYPERLINK_REGEX, "g"), "__HYPERLINK__").replace(new RegExp(CLEAR_LINE_REGEX, "gmi"), "").replace(new RegExp(BELL_REGEX, "gmi"), "").trim();
|
|
2131
|
+
hyperlinks.forEach((link3) => {
|
|
2132
|
+
cleansedChunk = cleansedChunk.replace("__HYPERLINK__", link3);
|
|
2133
|
+
});
|
|
2134
|
+
return cleansedChunk;
|
|
2135
|
+
}
|
|
2136
|
+
__name(cleanseAnsi, "cleanseAnsi");
|
|
2137
|
+
var color = createColors();
|
|
2138
|
+
function indent(string, count) {
|
|
2139
|
+
return string.replace(/^(?!\s*$)/gm, " ".repeat(count));
|
|
2140
|
+
}
|
|
2141
|
+
__name(indent, "indent");
|
|
2142
|
+
var FIGURES_MAIN = {
|
|
2143
|
+
warning: "\u26A0",
|
|
2144
|
+
cross: "\u2716",
|
|
2145
|
+
arrowDown: "\u2193",
|
|
2146
|
+
tick: "\u2714",
|
|
2147
|
+
arrowRight: "\u2192",
|
|
2148
|
+
pointer: "\u276F",
|
|
2149
|
+
checkboxOn: "\u2612",
|
|
2150
|
+
arrowLeft: "\u2190",
|
|
2151
|
+
squareSmallFilled: "\u25FC",
|
|
2152
|
+
pointerSmall: "\u203A"
|
|
2153
|
+
};
|
|
2154
|
+
var FIGURES_FALLBACK = {
|
|
2155
|
+
...FIGURES_MAIN,
|
|
2156
|
+
warning: "\u203C",
|
|
2157
|
+
cross: "\xD7",
|
|
2158
|
+
tick: "\u221A",
|
|
2159
|
+
pointer: ">",
|
|
2160
|
+
checkboxOn: "[\xD7]",
|
|
2161
|
+
squareSmallFilled: "\u25A0"
|
|
2162
|
+
};
|
|
2163
|
+
var figures = isUnicodeSupported() ? FIGURES_MAIN : FIGURES_FALLBACK;
|
|
2164
|
+
function splat(message, ...splat2) {
|
|
2165
|
+
return format(String(message), ...splat2);
|
|
2166
|
+
}
|
|
2167
|
+
__name(splat, "splat");
|
|
2168
|
+
var LISTR_LOGGER_STYLE = {
|
|
2169
|
+
icon: {
|
|
2170
|
+
[
|
|
2171
|
+
"STARTED"
|
|
2172
|
+
/* STARTED */
|
|
2173
|
+
]: figures.pointer,
|
|
2174
|
+
[
|
|
2175
|
+
"FAILED"
|
|
2176
|
+
/* FAILED */
|
|
2177
|
+
]: figures.cross,
|
|
2178
|
+
[
|
|
2179
|
+
"SKIPPED"
|
|
2180
|
+
/* SKIPPED */
|
|
2181
|
+
]: figures.arrowDown,
|
|
2182
|
+
[
|
|
2183
|
+
"COMPLETED"
|
|
2184
|
+
/* COMPLETED */
|
|
2185
|
+
]: figures.tick,
|
|
2186
|
+
[
|
|
2187
|
+
"OUTPUT"
|
|
2188
|
+
/* OUTPUT */
|
|
2189
|
+
]: figures.pointerSmall,
|
|
2190
|
+
[
|
|
2191
|
+
"TITLE"
|
|
2192
|
+
/* TITLE */
|
|
2193
|
+
]: figures.arrowRight,
|
|
2194
|
+
[
|
|
2195
|
+
"RETRY"
|
|
2196
|
+
/* RETRY */
|
|
2197
|
+
]: figures.warning,
|
|
2198
|
+
[
|
|
2199
|
+
"ROLLBACK"
|
|
2200
|
+
/* ROLLBACK */
|
|
2201
|
+
]: figures.arrowLeft,
|
|
2202
|
+
[
|
|
2203
|
+
"PAUSED"
|
|
2204
|
+
/* PAUSED */
|
|
2205
|
+
]: figures.squareSmallFilled
|
|
2206
|
+
},
|
|
2207
|
+
color: {
|
|
2208
|
+
[
|
|
2209
|
+
"STARTED"
|
|
2210
|
+
/* STARTED */
|
|
2211
|
+
]: color.yellow,
|
|
2212
|
+
[
|
|
2213
|
+
"FAILED"
|
|
2214
|
+
/* FAILED */
|
|
2215
|
+
]: color.red,
|
|
2216
|
+
[
|
|
2217
|
+
"SKIPPED"
|
|
2218
|
+
/* SKIPPED */
|
|
2219
|
+
]: color.yellow,
|
|
2220
|
+
[
|
|
2221
|
+
"COMPLETED"
|
|
2222
|
+
/* COMPLETED */
|
|
2223
|
+
]: color.green,
|
|
2224
|
+
[
|
|
2225
|
+
"RETRY"
|
|
2226
|
+
/* RETRY */
|
|
2227
|
+
]: color.yellowBright,
|
|
2228
|
+
[
|
|
2229
|
+
"ROLLBACK"
|
|
2230
|
+
/* ROLLBACK */
|
|
2231
|
+
]: color.redBright,
|
|
2232
|
+
[
|
|
2233
|
+
"PAUSED"
|
|
2234
|
+
/* PAUSED */
|
|
2235
|
+
]: color.yellowBright
|
|
2236
|
+
}
|
|
2237
|
+
};
|
|
2238
|
+
var LISTR_LOGGER_STDERR_LEVELS = [
|
|
2239
|
+
"RETRY",
|
|
2240
|
+
"ROLLBACK",
|
|
2241
|
+
"FAILED"
|
|
2242
|
+
/* FAILED */
|
|
2243
|
+
];
|
|
2244
|
+
var _a3;
|
|
2245
|
+
var ListrLogger = (_a3 = class {
|
|
2246
|
+
constructor(options2) {
|
|
2247
|
+
__publicField(this, "process");
|
|
2248
|
+
var _a24, _b, _c;
|
|
2249
|
+
this.options = options2;
|
|
2250
|
+
this.options = {
|
|
2251
|
+
useIcons: true,
|
|
2252
|
+
toStderr: [],
|
|
2253
|
+
...options2 ?? {}
|
|
2254
|
+
};
|
|
2255
|
+
(_a24 = this.options).fields ?? (_a24.fields = {});
|
|
2256
|
+
(_b = this.options.fields).prefix ?? (_b.prefix = []);
|
|
2257
|
+
(_c = this.options.fields).suffix ?? (_c.suffix = []);
|
|
2258
|
+
this.process = this.options.processOutput ?? new ProcessOutput();
|
|
2259
|
+
}
|
|
2260
|
+
log(level, message, options2) {
|
|
2261
|
+
const output = this.format(level, message, options2);
|
|
2262
|
+
if (this.options.toStderr.includes(level)) {
|
|
2263
|
+
this.process.toStderr(output);
|
|
2264
|
+
return;
|
|
2265
|
+
}
|
|
2266
|
+
this.process.toStdout(output);
|
|
2267
|
+
}
|
|
2268
|
+
toStdout(message, options2, eol = true) {
|
|
2269
|
+
this.process.toStdout(this.format(null, message, options2), eol);
|
|
2270
|
+
}
|
|
2271
|
+
toStderr(message, options2, eol = true) {
|
|
2272
|
+
this.process.toStderr(this.format(null, message, options2), eol);
|
|
2273
|
+
}
|
|
2274
|
+
wrap(message, options2) {
|
|
2275
|
+
if (!message) {
|
|
2276
|
+
return message;
|
|
2277
|
+
}
|
|
2278
|
+
return this.applyFormat(`[${message}]`, options2);
|
|
2279
|
+
}
|
|
2280
|
+
splat(...args) {
|
|
2281
|
+
const message = args.shift() ?? "";
|
|
2282
|
+
return args.length === 0 ? message : splat(message, args);
|
|
2283
|
+
}
|
|
2284
|
+
suffix(message, ...suffixes) {
|
|
2285
|
+
suffixes.filter(Boolean).forEach((suffix) => {
|
|
2286
|
+
message += this.spacing(message);
|
|
2287
|
+
if (typeof suffix === "string") {
|
|
2288
|
+
message += this.wrap(suffix);
|
|
2289
|
+
} else if (typeof suffix === "object") {
|
|
2290
|
+
suffix.args ?? (suffix.args = []);
|
|
2291
|
+
if (typeof suffix.condition === "function" ? !suffix.condition(...suffix.args) : !(suffix.condition ?? true)) {
|
|
2292
|
+
return message;
|
|
2293
|
+
}
|
|
2294
|
+
message += this.wrap(typeof suffix.field === "function" ? suffix.field(...suffix.args) : suffix.field, {
|
|
2295
|
+
format: suffix?.format(...suffix.args)
|
|
2296
|
+
});
|
|
2297
|
+
}
|
|
2298
|
+
});
|
|
2299
|
+
return message;
|
|
2300
|
+
}
|
|
2301
|
+
prefix(message, ...prefixes) {
|
|
2302
|
+
prefixes.filter(Boolean).forEach((prefix) => {
|
|
2303
|
+
message = this.spacing(message) + message;
|
|
2304
|
+
if (typeof prefix === "string") {
|
|
2305
|
+
message = this.wrap(prefix) + message;
|
|
2306
|
+
} else if (typeof prefix === "object") {
|
|
2307
|
+
prefix.args ?? (prefix.args = []);
|
|
2308
|
+
if (typeof prefix.condition === "function" ? !prefix.condition(...prefix.args) : !(prefix.condition ?? true)) {
|
|
2309
|
+
return message;
|
|
2310
|
+
}
|
|
2311
|
+
message = this.wrap(typeof prefix.field === "function" ? prefix.field(...prefix.args) : prefix.field, {
|
|
2312
|
+
format: prefix?.format()
|
|
2313
|
+
}) + message;
|
|
2314
|
+
}
|
|
2315
|
+
});
|
|
2316
|
+
return message;
|
|
2317
|
+
}
|
|
2318
|
+
fields(message, options2) {
|
|
2319
|
+
if (this.options?.fields?.prefix) {
|
|
2320
|
+
message = this.prefix(message, ...this.options.fields.prefix);
|
|
2321
|
+
}
|
|
2322
|
+
if (options2?.prefix) {
|
|
2323
|
+
message = this.prefix(message, ...options2.prefix);
|
|
2324
|
+
}
|
|
2325
|
+
if (options2?.suffix) {
|
|
2326
|
+
message = this.suffix(message, ...options2.suffix);
|
|
2327
|
+
}
|
|
2328
|
+
if (this.options?.fields?.suffix) {
|
|
2329
|
+
message = this.suffix(message, ...this.options.fields.suffix);
|
|
2330
|
+
}
|
|
2331
|
+
return message;
|
|
2332
|
+
}
|
|
2333
|
+
icon(level, icon) {
|
|
2334
|
+
if (!level) {
|
|
2335
|
+
return null;
|
|
2336
|
+
}
|
|
2337
|
+
icon || (icon = this.options.icon?.[level]);
|
|
2338
|
+
const coloring = this.options.color?.[level];
|
|
2339
|
+
if (icon && coloring) {
|
|
2340
|
+
icon = coloring(icon);
|
|
2341
|
+
}
|
|
2342
|
+
return icon;
|
|
2343
|
+
}
|
|
2344
|
+
format(level, message, options2) {
|
|
2345
|
+
if (!Array.isArray(message)) {
|
|
2346
|
+
message = [message];
|
|
2347
|
+
}
|
|
2348
|
+
message = this.splat(message.shift(), ...message).toString().split(EOL).filter((m) => !m || m.trim() !== "").map((m) => {
|
|
2349
|
+
return this.style(
|
|
2350
|
+
level,
|
|
2351
|
+
this.fields(m, {
|
|
2352
|
+
prefix: Array.isArray(options2?.prefix) ? options2.prefix : [options2?.prefix],
|
|
2353
|
+
suffix: Array.isArray(options2?.suffix) ? options2.suffix : [options2?.suffix]
|
|
2354
|
+
})
|
|
2355
|
+
);
|
|
2356
|
+
}).join(EOL);
|
|
2357
|
+
return message;
|
|
2358
|
+
}
|
|
2359
|
+
style(level, message) {
|
|
2360
|
+
if (!level || !message) {
|
|
2361
|
+
return message;
|
|
2362
|
+
}
|
|
2363
|
+
const icon = this.icon(level, !this.options.useIcons && this.wrap(level));
|
|
2364
|
+
if (icon) {
|
|
2365
|
+
message = icon + " " + message;
|
|
2366
|
+
}
|
|
2367
|
+
return message;
|
|
2368
|
+
}
|
|
2369
|
+
applyFormat(message, options2) {
|
|
2370
|
+
if (options2?.format) {
|
|
2371
|
+
return options2.format(message);
|
|
2372
|
+
}
|
|
2373
|
+
return message;
|
|
2374
|
+
}
|
|
2375
|
+
spacing(message) {
|
|
2376
|
+
return typeof message === "undefined" || message.trim() === "" ? "" : " ";
|
|
2377
|
+
}
|
|
2378
|
+
}, __name(_a3, "ListrLogger"), _a3);
|
|
2379
|
+
var _a4;
|
|
2380
|
+
var ProcessOutputBuffer = (_a4 = class {
|
|
2381
|
+
constructor(options2) {
|
|
2382
|
+
__publicField(this, "buffer", []);
|
|
2383
|
+
__publicField(this, "decoder", new StringDecoder());
|
|
2384
|
+
this.options = options2;
|
|
2385
|
+
}
|
|
2386
|
+
get all() {
|
|
2387
|
+
return this.buffer;
|
|
2388
|
+
}
|
|
2389
|
+
get last() {
|
|
2390
|
+
return this.buffer.at(-1);
|
|
2391
|
+
}
|
|
2392
|
+
get length() {
|
|
2393
|
+
return this.buffer.length;
|
|
2394
|
+
}
|
|
2395
|
+
write(data, ...args) {
|
|
2396
|
+
const callback = args[args.length - 1];
|
|
2397
|
+
this.buffer.push({
|
|
2398
|
+
time: Date.now(),
|
|
2399
|
+
stream: this.options?.stream,
|
|
2400
|
+
entry: this.decoder.write(typeof data === "string" ? Buffer.from(data, typeof args[0] === "string" ? args[0] : void 0) : Buffer.from(data))
|
|
2401
|
+
});
|
|
2402
|
+
if (this.options?.limit) {
|
|
2403
|
+
this.buffer = this.buffer.slice(-this.options.limit);
|
|
2404
|
+
}
|
|
2405
|
+
if (typeof callback === "function") {
|
|
2406
|
+
callback();
|
|
2407
|
+
}
|
|
2408
|
+
return true;
|
|
2409
|
+
}
|
|
2410
|
+
reset() {
|
|
2411
|
+
this.buffer = [];
|
|
2412
|
+
}
|
|
2413
|
+
}, __name(_a4, "ProcessOutputBuffer"), _a4);
|
|
2414
|
+
var _a5;
|
|
2415
|
+
var ProcessOutputStream = (_a5 = class {
|
|
2416
|
+
constructor(stream) {
|
|
2417
|
+
__publicField(this, "method");
|
|
2418
|
+
__publicField(this, "buffer");
|
|
2419
|
+
this.stream = stream;
|
|
2420
|
+
this.method = stream.write;
|
|
2421
|
+
this.buffer = new ProcessOutputBuffer({ stream });
|
|
2422
|
+
}
|
|
2423
|
+
get out() {
|
|
2424
|
+
return Object.assign({}, this.stream, {
|
|
2425
|
+
write: this.write.bind(this)
|
|
2426
|
+
});
|
|
2427
|
+
}
|
|
2428
|
+
hijack() {
|
|
2429
|
+
this.stream.write = this.buffer.write.bind(this.buffer);
|
|
2430
|
+
}
|
|
2431
|
+
release() {
|
|
2432
|
+
this.stream.write = this.method;
|
|
2433
|
+
const buffer = [...this.buffer.all];
|
|
2434
|
+
this.buffer.reset();
|
|
2435
|
+
return buffer;
|
|
2436
|
+
}
|
|
2437
|
+
write(...args) {
|
|
2438
|
+
return this.method.apply(this.stream, args);
|
|
2439
|
+
}
|
|
2440
|
+
}, __name(_a5, "ProcessOutputStream"), _a5);
|
|
2441
|
+
var _a6;
|
|
2442
|
+
var ProcessOutput = (_a6 = class {
|
|
2443
|
+
constructor(stdout, stderr, options2) {
|
|
2444
|
+
__publicField(this, "stream");
|
|
2445
|
+
__publicField(this, "active");
|
|
2446
|
+
this.options = options2;
|
|
2447
|
+
this.stream = {
|
|
2448
|
+
stdout: new ProcessOutputStream(stdout ?? process.stdout),
|
|
2449
|
+
stderr: new ProcessOutputStream(stderr ?? process.stderr)
|
|
2450
|
+
};
|
|
2451
|
+
this.options = {
|
|
2452
|
+
dump: ["stdout", "stderr"],
|
|
2453
|
+
leaveEmptyLine: true,
|
|
2454
|
+
...options2
|
|
2455
|
+
};
|
|
2456
|
+
}
|
|
2457
|
+
get stdout() {
|
|
2458
|
+
return this.stream.stdout.out;
|
|
2459
|
+
}
|
|
2460
|
+
get stderr() {
|
|
2461
|
+
return this.stream.stderr.out;
|
|
2462
|
+
}
|
|
2463
|
+
hijack() {
|
|
2464
|
+
if (this.active) {
|
|
2465
|
+
throw new Error("ProcessOutput has been already hijacked!");
|
|
2466
|
+
}
|
|
2467
|
+
this.stream.stdout.write(ANSI_ESCAPE_CODES.CURSOR_HIDE);
|
|
2468
|
+
Object.values(this.stream).forEach((stream) => stream.hijack());
|
|
2469
|
+
this.active = true;
|
|
2470
|
+
}
|
|
2471
|
+
release() {
|
|
2472
|
+
const output = Object.entries(this.stream).map(([name, stream]) => ({ name, buffer: stream.release() })).filter((output2) => this.options.dump.includes(output2.name)).flatMap((output2) => output2.buffer).sort((a2, b) => a2.time - b.time).map((message) => {
|
|
2473
|
+
return {
|
|
2474
|
+
...message,
|
|
2475
|
+
entry: cleanseAnsi(message.entry)
|
|
2476
|
+
};
|
|
2477
|
+
}).filter((message) => message.entry);
|
|
2478
|
+
if (output.length > 0) {
|
|
2479
|
+
if (this.options.leaveEmptyLine) {
|
|
2480
|
+
this.stdout.write(EOL2);
|
|
2481
|
+
}
|
|
2482
|
+
output.forEach((message) => {
|
|
2483
|
+
const stream = message.stream ?? this.stdout;
|
|
2484
|
+
stream.write(message.entry + EOL2);
|
|
2485
|
+
});
|
|
2486
|
+
}
|
|
2487
|
+
this.stream.stdout.write(ANSI_ESCAPE_CODES.CURSOR_SHOW);
|
|
2488
|
+
this.active = false;
|
|
2489
|
+
}
|
|
2490
|
+
toStdout(buffer, eol = true) {
|
|
2491
|
+
if (eol) {
|
|
2492
|
+
buffer = buffer + EOL2;
|
|
2493
|
+
}
|
|
2494
|
+
return this.stream.stdout.write(buffer);
|
|
2495
|
+
}
|
|
2496
|
+
toStderr(buffer, eol = true) {
|
|
2497
|
+
if (eol) {
|
|
2498
|
+
buffer = buffer + EOL2;
|
|
2499
|
+
}
|
|
2500
|
+
return this.stream.stderr.write(buffer);
|
|
2501
|
+
}
|
|
2502
|
+
}, __name(_a6, "ProcessOutput"), _a6);
|
|
2503
|
+
function createWritable(cb) {
|
|
2504
|
+
const writable = new Writable();
|
|
2505
|
+
writable.rows = Infinity;
|
|
2506
|
+
writable.columns = Infinity;
|
|
2507
|
+
writable.write = (chunk) => {
|
|
2508
|
+
cb(chunk.toString());
|
|
2509
|
+
return true;
|
|
2510
|
+
};
|
|
2511
|
+
return writable;
|
|
2512
|
+
}
|
|
2513
|
+
__name(createWritable, "createWritable");
|
|
2514
|
+
var _a7;
|
|
2515
|
+
var ListrPromptAdapter = (_a7 = class {
|
|
2516
|
+
constructor(task, wrapper) {
|
|
2517
|
+
__publicField(this, "state");
|
|
2518
|
+
this.task = task;
|
|
2519
|
+
this.wrapper = wrapper;
|
|
2520
|
+
}
|
|
2521
|
+
reportStarted() {
|
|
2522
|
+
this.state = this.task.state;
|
|
2523
|
+
if (this.task.prompt) {
|
|
2524
|
+
throw new PromptError("There is already an active prompt attached to this task which may not be cleaned up properly.");
|
|
2525
|
+
}
|
|
2526
|
+
this.task.prompt = this;
|
|
2527
|
+
this.task.state$ = "PROMPT";
|
|
2528
|
+
}
|
|
2529
|
+
reportFailed() {
|
|
2530
|
+
this.task.state$ = "PROMPT_FAILED";
|
|
2531
|
+
this.restoreState();
|
|
2532
|
+
}
|
|
2533
|
+
reportCompleted() {
|
|
2534
|
+
this.task.state$ = "PROMPT_COMPLETED";
|
|
2535
|
+
this.restoreState();
|
|
2536
|
+
}
|
|
2537
|
+
restoreState() {
|
|
2538
|
+
this.task.prompt = void 0;
|
|
2539
|
+
if (this.state) {
|
|
2540
|
+
this.task.state = this.state;
|
|
2541
|
+
}
|
|
2542
|
+
}
|
|
2543
|
+
}, __name(_a7, "ListrPromptAdapter"), _a7);
|
|
2544
|
+
var _a8;
|
|
2545
|
+
var Spinner = (_a8 = class {
|
|
2546
|
+
constructor() {
|
|
2547
|
+
__publicField(this, "spinner", !isUnicodeSupported() ? ["-", "\\", "|", "/"] : ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"]);
|
|
2548
|
+
__publicField(this, "id");
|
|
2549
|
+
__publicField(this, "spinnerPosition", 0);
|
|
2550
|
+
}
|
|
2551
|
+
spin() {
|
|
2552
|
+
this.spinnerPosition = ++this.spinnerPosition % this.spinner.length;
|
|
2553
|
+
}
|
|
2554
|
+
fetch() {
|
|
2555
|
+
return this.spinner[this.spinnerPosition];
|
|
2556
|
+
}
|
|
2557
|
+
isRunning() {
|
|
2558
|
+
return !!this.id;
|
|
2559
|
+
}
|
|
2560
|
+
start(cb, interval = 100) {
|
|
2561
|
+
this.id = setInterval(() => {
|
|
2562
|
+
this.spin();
|
|
2563
|
+
if (cb) {
|
|
2564
|
+
cb();
|
|
2565
|
+
}
|
|
2566
|
+
}, interval);
|
|
2567
|
+
}
|
|
2568
|
+
stop() {
|
|
2569
|
+
clearInterval(this.id);
|
|
2570
|
+
}
|
|
2571
|
+
}, __name(_a8, "Spinner"), _a8);
|
|
2572
|
+
var LISTR_DEFAULT_RENDERER_STYLE = {
|
|
2573
|
+
icon: {
|
|
2574
|
+
[
|
|
2575
|
+
"SKIPPED_WITH_COLLAPSE"
|
|
2576
|
+
/* SKIPPED_WITH_COLLAPSE */
|
|
2577
|
+
]: figures.arrowDown,
|
|
2578
|
+
[
|
|
2579
|
+
"SKIPPED_WITHOUT_COLLAPSE"
|
|
2580
|
+
/* SKIPPED_WITHOUT_COLLAPSE */
|
|
2581
|
+
]: figures.warning,
|
|
2582
|
+
[
|
|
2583
|
+
"OUTPUT"
|
|
2584
|
+
/* OUTPUT */
|
|
2585
|
+
]: figures.pointerSmall,
|
|
2586
|
+
[
|
|
2587
|
+
"OUTPUT_WITH_BOTTOMBAR"
|
|
2588
|
+
/* OUTPUT_WITH_BOTTOMBAR */
|
|
2589
|
+
]: figures.pointerSmall,
|
|
2590
|
+
[
|
|
2591
|
+
"PENDING"
|
|
2592
|
+
/* PENDING */
|
|
2593
|
+
]: figures.pointer,
|
|
2594
|
+
[
|
|
2595
|
+
"COMPLETED"
|
|
2596
|
+
/* COMPLETED */
|
|
2597
|
+
]: figures.tick,
|
|
2598
|
+
[
|
|
2599
|
+
"COMPLETED_WITH_FAILED_SUBTASKS"
|
|
2600
|
+
/* COMPLETED_WITH_FAILED_SUBTASKS */
|
|
2601
|
+
]: figures.warning,
|
|
2602
|
+
[
|
|
2603
|
+
"COMPLETED_WITH_SISTER_TASKS_FAILED"
|
|
2604
|
+
/* COMPLETED_WITH_FAILED_SISTER_TASKS */
|
|
2605
|
+
]: figures.squareSmallFilled,
|
|
2606
|
+
[
|
|
2607
|
+
"RETRY"
|
|
2608
|
+
/* RETRY */
|
|
2609
|
+
]: figures.warning,
|
|
2610
|
+
[
|
|
2611
|
+
"ROLLING_BACK"
|
|
2612
|
+
/* ROLLING_BACK */
|
|
2613
|
+
]: figures.warning,
|
|
2614
|
+
[
|
|
2615
|
+
"ROLLED_BACK"
|
|
2616
|
+
/* ROLLED_BACK */
|
|
2617
|
+
]: figures.arrowLeft,
|
|
2618
|
+
[
|
|
2619
|
+
"FAILED"
|
|
2620
|
+
/* FAILED */
|
|
2621
|
+
]: figures.cross,
|
|
2622
|
+
[
|
|
2623
|
+
"FAILED_WITH_SUBTASKS"
|
|
2624
|
+
/* FAILED_WITH_FAILED_SUBTASKS */
|
|
2625
|
+
]: figures.pointer,
|
|
2626
|
+
[
|
|
2627
|
+
"WAITING"
|
|
2628
|
+
/* WAITING */
|
|
2629
|
+
]: figures.squareSmallFilled,
|
|
2630
|
+
[
|
|
2631
|
+
"PAUSED"
|
|
2632
|
+
/* PAUSED */
|
|
2633
|
+
]: figures.squareSmallFilled
|
|
2634
|
+
},
|
|
2635
|
+
color: {
|
|
2636
|
+
[
|
|
2637
|
+
"SKIPPED_WITH_COLLAPSE"
|
|
2638
|
+
/* SKIPPED_WITH_COLLAPSE */
|
|
2639
|
+
]: color.yellow,
|
|
2640
|
+
[
|
|
2641
|
+
"SKIPPED_WITHOUT_COLLAPSE"
|
|
2642
|
+
/* SKIPPED_WITHOUT_COLLAPSE */
|
|
2643
|
+
]: color.yellow,
|
|
2644
|
+
[
|
|
2645
|
+
"PENDING"
|
|
2646
|
+
/* PENDING */
|
|
2647
|
+
]: color.yellow,
|
|
2648
|
+
[
|
|
2649
|
+
"COMPLETED"
|
|
2650
|
+
/* COMPLETED */
|
|
2651
|
+
]: color.green,
|
|
2652
|
+
[
|
|
2653
|
+
"COMPLETED_WITH_FAILED_SUBTASKS"
|
|
2654
|
+
/* COMPLETED_WITH_FAILED_SUBTASKS */
|
|
2655
|
+
]: color.yellow,
|
|
2656
|
+
[
|
|
2657
|
+
"COMPLETED_WITH_SISTER_TASKS_FAILED"
|
|
2658
|
+
/* COMPLETED_WITH_FAILED_SISTER_TASKS */
|
|
2659
|
+
]: color.red,
|
|
2660
|
+
[
|
|
2661
|
+
"RETRY"
|
|
2662
|
+
/* RETRY */
|
|
2663
|
+
]: color.yellowBright,
|
|
2664
|
+
[
|
|
2665
|
+
"ROLLING_BACK"
|
|
2666
|
+
/* ROLLING_BACK */
|
|
2667
|
+
]: color.redBright,
|
|
2668
|
+
[
|
|
2669
|
+
"ROLLED_BACK"
|
|
2670
|
+
/* ROLLED_BACK */
|
|
2671
|
+
]: color.redBright,
|
|
2672
|
+
[
|
|
2673
|
+
"FAILED"
|
|
2674
|
+
/* FAILED */
|
|
2675
|
+
]: color.red,
|
|
2676
|
+
[
|
|
2677
|
+
"FAILED_WITH_SUBTASKS"
|
|
2678
|
+
/* FAILED_WITH_FAILED_SUBTASKS */
|
|
2679
|
+
]: color.red,
|
|
2680
|
+
[
|
|
2681
|
+
"WAITING"
|
|
2682
|
+
/* WAITING */
|
|
2683
|
+
]: color.dim,
|
|
2684
|
+
[
|
|
2685
|
+
"PAUSED"
|
|
2686
|
+
/* PAUSED */
|
|
2687
|
+
]: color.yellowBright
|
|
2688
|
+
}
|
|
2689
|
+
};
|
|
2690
|
+
function parseTimer(duration) {
|
|
2691
|
+
const seconds = Math.floor(duration / 1e3);
|
|
2692
|
+
const minutes = Math.floor(seconds / 60);
|
|
2693
|
+
let parsedTime;
|
|
2694
|
+
if (seconds === 0 && minutes === 0) {
|
|
2695
|
+
parsedTime = `0.${Math.floor(duration / 100)}s`;
|
|
2696
|
+
}
|
|
2697
|
+
if (seconds > 0) {
|
|
2698
|
+
parsedTime = `${seconds % 60}s`;
|
|
2699
|
+
}
|
|
2700
|
+
if (minutes > 0) {
|
|
2701
|
+
parsedTime = `${minutes}m${parsedTime}`;
|
|
2702
|
+
}
|
|
2703
|
+
return parsedTime;
|
|
2704
|
+
}
|
|
2705
|
+
__name(parseTimer, "parseTimer");
|
|
2706
|
+
var PRESET_TIMER = {
|
|
2707
|
+
condition: true,
|
|
2708
|
+
field: parseTimer,
|
|
2709
|
+
format: /* @__PURE__ */ __name(() => color.dim, "format")
|
|
2710
|
+
};
|
|
2711
|
+
function parseTimestamp() {
|
|
2712
|
+
const now = /* @__PURE__ */ new Date();
|
|
2713
|
+
return String(now.getHours()).padStart(2, "0") + ":" + String(now.getMinutes()).padStart(2, "0") + ":" + String(now.getSeconds()).padStart(2, "0");
|
|
2714
|
+
}
|
|
2715
|
+
__name(parseTimestamp, "parseTimestamp");
|
|
2716
|
+
var _a9;
|
|
2717
|
+
var DefaultRenderer = (_a9 = class {
|
|
2718
|
+
constructor(tasks, options2, events) {
|
|
2719
|
+
__publicField(this, "prompt");
|
|
2720
|
+
__publicField(this, "activePrompt");
|
|
2721
|
+
__publicField(this, "spinner");
|
|
2722
|
+
__publicField(this, "logger");
|
|
2723
|
+
__publicField(this, "updater");
|
|
2724
|
+
__publicField(this, "truncate");
|
|
2725
|
+
__publicField(this, "wrap");
|
|
2726
|
+
__publicField(this, "buffer", {
|
|
2727
|
+
output: /* @__PURE__ */ new Map(),
|
|
2728
|
+
bottom: /* @__PURE__ */ new Map()
|
|
2729
|
+
});
|
|
2730
|
+
__publicField(this, "cache", {
|
|
2731
|
+
render: /* @__PURE__ */ new Map(),
|
|
2732
|
+
rendererOptions: /* @__PURE__ */ new Map(),
|
|
2733
|
+
rendererTaskOptions: /* @__PURE__ */ new Map()
|
|
2734
|
+
});
|
|
2735
|
+
this.tasks = tasks;
|
|
2736
|
+
this.options = options2;
|
|
2737
|
+
this.events = events;
|
|
2738
|
+
this.options = {
|
|
2739
|
+
..._a9.rendererOptions,
|
|
2740
|
+
...this.options,
|
|
2741
|
+
icon: {
|
|
2742
|
+
...LISTR_DEFAULT_RENDERER_STYLE.icon,
|
|
2743
|
+
...options2?.icon ?? {}
|
|
2744
|
+
},
|
|
2745
|
+
color: {
|
|
2746
|
+
...LISTR_DEFAULT_RENDERER_STYLE.color,
|
|
2747
|
+
...options2?.color ?? {}
|
|
2748
|
+
}
|
|
2749
|
+
};
|
|
2750
|
+
this.spinner = this.options.spinner ?? new Spinner();
|
|
2751
|
+
this.logger = this.options.logger ?? new ListrLogger({ useIcons: true, toStderr: [] });
|
|
2752
|
+
this.logger.options.icon = this.options.icon;
|
|
2753
|
+
this.logger.options.color = this.options.color;
|
|
2754
|
+
}
|
|
2755
|
+
async render() {
|
|
2756
|
+
const { createLogUpdate: createLogUpdate2 } = await Promise.resolve().then(() => (init_log_update(), log_update_exports));
|
|
2757
|
+
const { default: truncate } = await Promise.resolve().then(() => (init_cli_truncate(), cli_truncate_exports));
|
|
2758
|
+
const { default: wrap } = await Promise.resolve().then(() => (init_wrap_ansi(), wrap_ansi_exports));
|
|
2759
|
+
this.updater = createLogUpdate2(this.logger.process.stdout);
|
|
2760
|
+
this.truncate = truncate;
|
|
2761
|
+
this.wrap = wrap;
|
|
2762
|
+
this.logger.process.hijack();
|
|
2763
|
+
if (!this.options?.lazy) {
|
|
2764
|
+
this.spinner.start(() => {
|
|
2765
|
+
this.update();
|
|
2766
|
+
});
|
|
2767
|
+
}
|
|
2768
|
+
this.events.on("SHOUD_REFRESH_RENDER", () => {
|
|
2769
|
+
this.update();
|
|
2770
|
+
});
|
|
2771
|
+
}
|
|
2772
|
+
update() {
|
|
2773
|
+
this.updater(this.create());
|
|
2774
|
+
}
|
|
2775
|
+
end() {
|
|
2776
|
+
this.spinner.stop();
|
|
2777
|
+
this.updater.clear();
|
|
2778
|
+
this.updater.done();
|
|
2779
|
+
if (!this.options.clearOutput) {
|
|
2780
|
+
this.logger.process.toStdout(this.create({ prompt: false }));
|
|
2781
|
+
}
|
|
2782
|
+
this.logger.process.release();
|
|
2783
|
+
}
|
|
2784
|
+
create(options2) {
|
|
2785
|
+
options2 = {
|
|
2786
|
+
tasks: true,
|
|
2787
|
+
bottomBar: true,
|
|
2788
|
+
prompt: true,
|
|
2789
|
+
...options2
|
|
2790
|
+
};
|
|
2791
|
+
const render = [];
|
|
2792
|
+
const renderTasks = this.renderer(this.tasks);
|
|
2793
|
+
const renderBottomBar = this.renderBottomBar();
|
|
2794
|
+
const renderPrompt = this.renderPrompt();
|
|
2795
|
+
if (options2.tasks && renderTasks.length > 0) {
|
|
2796
|
+
render.push(...renderTasks);
|
|
2797
|
+
}
|
|
2798
|
+
if (options2.bottomBar && renderBottomBar.length > 0) {
|
|
2799
|
+
if (render.length > 0) {
|
|
2800
|
+
render.push("");
|
|
2801
|
+
}
|
|
2802
|
+
render.push(...renderBottomBar);
|
|
2803
|
+
}
|
|
2804
|
+
if (options2.prompt && renderPrompt.length > 0) {
|
|
2805
|
+
if (render.length > 0) {
|
|
2806
|
+
render.push("");
|
|
2807
|
+
}
|
|
2808
|
+
render.push(...renderPrompt);
|
|
2809
|
+
}
|
|
2810
|
+
return render.join(EOL3);
|
|
2811
|
+
}
|
|
2812
|
+
// eslint-disable-next-line complexity
|
|
2813
|
+
style(task, output = false) {
|
|
2814
|
+
const rendererOptions = this.cache.rendererOptions.get(task.id);
|
|
2815
|
+
if (task.isSkipped()) {
|
|
2816
|
+
if (output || rendererOptions.collapseSkips) {
|
|
2817
|
+
return this.logger.icon(
|
|
2818
|
+
"SKIPPED_WITH_COLLAPSE"
|
|
2819
|
+
/* SKIPPED_WITH_COLLAPSE */
|
|
2820
|
+
);
|
|
2821
|
+
} else if (rendererOptions.collapseSkips === false) {
|
|
2822
|
+
return this.logger.icon(
|
|
2823
|
+
"SKIPPED_WITHOUT_COLLAPSE"
|
|
2824
|
+
/* SKIPPED_WITHOUT_COLLAPSE */
|
|
2825
|
+
);
|
|
2826
|
+
}
|
|
2827
|
+
}
|
|
2828
|
+
if (output) {
|
|
2829
|
+
if (this.shouldOutputToBottomBar(task)) {
|
|
2830
|
+
return this.logger.icon(
|
|
2831
|
+
"OUTPUT_WITH_BOTTOMBAR"
|
|
2832
|
+
/* OUTPUT_WITH_BOTTOMBAR */
|
|
2833
|
+
);
|
|
2834
|
+
}
|
|
2835
|
+
return this.logger.icon(
|
|
2836
|
+
"OUTPUT"
|
|
2837
|
+
/* OUTPUT */
|
|
2838
|
+
);
|
|
2839
|
+
}
|
|
2840
|
+
if (task.hasSubtasks()) {
|
|
2841
|
+
if (task.isStarted() || task.isPrompt() && rendererOptions.showSubtasks !== false && !task.subtasks.every((subtask) => !subtask.hasTitle())) {
|
|
2842
|
+
return this.logger.icon(
|
|
2843
|
+
"PENDING"
|
|
2844
|
+
/* PENDING */
|
|
2845
|
+
);
|
|
2846
|
+
} else if (task.isCompleted() && task.subtasks.some((subtask) => subtask.hasFailed())) {
|
|
2847
|
+
return this.logger.icon(
|
|
2848
|
+
"COMPLETED_WITH_FAILED_SUBTASKS"
|
|
2849
|
+
/* COMPLETED_WITH_FAILED_SUBTASKS */
|
|
2850
|
+
);
|
|
2851
|
+
} else if (task.hasFailed()) {
|
|
2852
|
+
return this.logger.icon(
|
|
2853
|
+
"FAILED_WITH_SUBTASKS"
|
|
2854
|
+
/* FAILED_WITH_FAILED_SUBTASKS */
|
|
2855
|
+
);
|
|
2856
|
+
}
|
|
2857
|
+
}
|
|
2858
|
+
if (task.isStarted() || task.isPrompt()) {
|
|
2859
|
+
return this.logger.icon("PENDING", !this.options?.lazy && this.spinner.fetch());
|
|
2860
|
+
} else if (task.isCompleted()) {
|
|
2861
|
+
return this.logger.icon(
|
|
2862
|
+
"COMPLETED"
|
|
2863
|
+
/* COMPLETED */
|
|
2864
|
+
);
|
|
2865
|
+
} else if (task.isRetrying()) {
|
|
2866
|
+
return this.logger.icon("RETRY", !this.options?.lazy && this.spinner.fetch());
|
|
2867
|
+
} else if (task.isRollingBack()) {
|
|
2868
|
+
return this.logger.icon("ROLLING_BACK", !this.options?.lazy && this.spinner.fetch());
|
|
2869
|
+
} else if (task.hasRolledBack()) {
|
|
2870
|
+
return this.logger.icon(
|
|
2871
|
+
"ROLLED_BACK"
|
|
2872
|
+
/* ROLLED_BACK */
|
|
2873
|
+
);
|
|
2874
|
+
} else if (task.hasFailed()) {
|
|
2875
|
+
return this.logger.icon(
|
|
2876
|
+
"FAILED"
|
|
2877
|
+
/* FAILED */
|
|
2878
|
+
);
|
|
2879
|
+
} else if (task.isPaused()) {
|
|
2880
|
+
return this.logger.icon(
|
|
2881
|
+
"PAUSED"
|
|
2882
|
+
/* PAUSED */
|
|
2883
|
+
);
|
|
2884
|
+
}
|
|
2885
|
+
return this.logger.icon(
|
|
2886
|
+
"WAITING"
|
|
2887
|
+
/* WAITING */
|
|
2888
|
+
);
|
|
2889
|
+
}
|
|
2890
|
+
format(message, icon, level) {
|
|
2891
|
+
if (message.trim() === "") {
|
|
2892
|
+
return [];
|
|
2893
|
+
}
|
|
2894
|
+
if (icon) {
|
|
2895
|
+
message = icon + " " + message;
|
|
2896
|
+
}
|
|
2897
|
+
let parsed;
|
|
2898
|
+
const columns = (process.stdout.columns ?? 80) - level * this.options.indentation - 2;
|
|
2899
|
+
switch (this.options.formatOutput) {
|
|
2900
|
+
case "truncate":
|
|
2901
|
+
parsed = message.split(EOL3).map((s, i) => {
|
|
2902
|
+
return this.truncate(this.indent(s, i), columns);
|
|
2903
|
+
});
|
|
2904
|
+
break;
|
|
2905
|
+
case "wrap":
|
|
2906
|
+
parsed = this.wrap(message, columns, { hard: true }).split(EOL3).map((s, i) => this.indent(s, i));
|
|
2907
|
+
break;
|
|
2908
|
+
default:
|
|
2909
|
+
throw new ListrRendererError("Format option for the renderer is wrong.");
|
|
2910
|
+
}
|
|
2911
|
+
if (this.options.removeEmptyLines) {
|
|
2912
|
+
parsed = parsed.filter(Boolean);
|
|
2913
|
+
}
|
|
2914
|
+
return parsed.map((str) => indent(str, level * this.options.indentation));
|
|
2915
|
+
}
|
|
2916
|
+
shouldOutputToOutputBar(task) {
|
|
2917
|
+
const outputBar = this.cache.rendererTaskOptions.get(task.id).outputBar;
|
|
2918
|
+
return typeof outputBar === "number" && outputBar !== 0 || typeof outputBar === "boolean" && outputBar !== false;
|
|
2919
|
+
}
|
|
2920
|
+
shouldOutputToBottomBar(task) {
|
|
2921
|
+
const bottomBar = this.cache.rendererTaskOptions.get(task.id).bottomBar;
|
|
2922
|
+
return typeof bottomBar === "number" && bottomBar !== 0 || typeof bottomBar === "boolean" && bottomBar !== false || !task.hasTitle();
|
|
2923
|
+
}
|
|
2924
|
+
renderer(tasks, level = 0) {
|
|
2925
|
+
return tasks.flatMap((task) => {
|
|
2926
|
+
if (!task.isEnabled()) {
|
|
2927
|
+
return [];
|
|
2928
|
+
}
|
|
2929
|
+
if (this.cache.render.has(task.id)) {
|
|
2930
|
+
return this.cache.render.get(task.id);
|
|
2931
|
+
}
|
|
2932
|
+
this.calculate(task);
|
|
2933
|
+
this.setupBuffer(task);
|
|
2934
|
+
const rendererOptions = this.cache.rendererOptions.get(task.id);
|
|
2935
|
+
const rendererTaskOptions = this.cache.rendererTaskOptions.get(task.id);
|
|
2936
|
+
const output = [];
|
|
2937
|
+
if (task.isPrompt()) {
|
|
2938
|
+
if (this.activePrompt && this.activePrompt !== task.id) {
|
|
2939
|
+
throw new ListrRendererError("Only one prompt can be active at the given time, please re-evaluate your task design.");
|
|
2940
|
+
} else if (!this.activePrompt) {
|
|
2941
|
+
task.on("PROMPT", (prompt) => {
|
|
2942
|
+
const cleansed = cleanseAnsi(prompt);
|
|
2943
|
+
if (cleansed) {
|
|
2944
|
+
this.prompt = cleansed;
|
|
2945
|
+
}
|
|
2946
|
+
});
|
|
2947
|
+
task.on("STATE", (state) => {
|
|
2948
|
+
if (state === "PROMPT_COMPLETED" || task.hasFinalized() || task.hasReset()) {
|
|
2949
|
+
this.prompt = null;
|
|
2950
|
+
this.activePrompt = null;
|
|
2951
|
+
task.off(
|
|
2952
|
+
"PROMPT"
|
|
2953
|
+
/* PROMPT */
|
|
2954
|
+
);
|
|
2955
|
+
}
|
|
2956
|
+
});
|
|
2957
|
+
this.activePrompt = task.id;
|
|
2958
|
+
}
|
|
2959
|
+
}
|
|
2960
|
+
if (task.hasTitle()) {
|
|
2961
|
+
if (!(tasks.some((task2) => task2.hasFailed()) && !task.hasFailed() && task.options.exitOnError !== false && !(task.isCompleted() || task.isSkipped()))) {
|
|
2962
|
+
if (task.hasFailed() && rendererOptions.collapseErrors) {
|
|
2963
|
+
output.push(...this.format(!task.hasSubtasks() && task.message.error && rendererOptions.showErrorMessage ? task.message.error : task.title, this.style(task), level));
|
|
2964
|
+
} else if (task.isSkipped() && rendererOptions.collapseSkips) {
|
|
2965
|
+
output.push(
|
|
2966
|
+
...this.format(
|
|
2967
|
+
this.logger.suffix(task.message.skip && rendererOptions.showSkipMessage ? task.message.skip : task.title, {
|
|
2968
|
+
field: "SKIPPED",
|
|
2969
|
+
condition: rendererOptions.suffixSkips,
|
|
2970
|
+
format: /* @__PURE__ */ __name(() => color.dim, "format")
|
|
2971
|
+
}),
|
|
2972
|
+
this.style(task),
|
|
2973
|
+
level
|
|
2974
|
+
)
|
|
2975
|
+
);
|
|
2976
|
+
} else if (task.isRetrying()) {
|
|
2977
|
+
output.push(
|
|
2978
|
+
...this.format(
|
|
2979
|
+
this.logger.suffix(task.title, {
|
|
2980
|
+
field: `${"RETRY"}:${task.message.retry.count}`,
|
|
2981
|
+
format: /* @__PURE__ */ __name(() => color.yellow, "format"),
|
|
2982
|
+
condition: rendererOptions.suffixRetries
|
|
2983
|
+
}),
|
|
2984
|
+
this.style(task),
|
|
2985
|
+
level
|
|
2986
|
+
)
|
|
2987
|
+
);
|
|
2988
|
+
} else if (task.isCompleted() && task.hasTitle() && assertFunctionOrSelf(rendererTaskOptions.timer?.condition, task.message.duration)) {
|
|
2989
|
+
output.push(
|
|
2990
|
+
...this.format(
|
|
2991
|
+
this.logger.suffix(task?.title, {
|
|
2992
|
+
...rendererTaskOptions.timer,
|
|
2993
|
+
args: [task.message.duration]
|
|
2994
|
+
}),
|
|
2995
|
+
this.style(task),
|
|
2996
|
+
level
|
|
2997
|
+
)
|
|
2998
|
+
);
|
|
2999
|
+
} else if (task.isPaused()) {
|
|
3000
|
+
output.push(
|
|
3001
|
+
...this.format(
|
|
3002
|
+
this.logger.suffix(task.title, {
|
|
3003
|
+
...rendererOptions.pausedTimer,
|
|
3004
|
+
args: [task.message.paused - Date.now()]
|
|
3005
|
+
}),
|
|
3006
|
+
this.style(task),
|
|
3007
|
+
level
|
|
3008
|
+
)
|
|
3009
|
+
);
|
|
3010
|
+
} else {
|
|
3011
|
+
output.push(...this.format(task.title, this.style(task), level));
|
|
3012
|
+
}
|
|
3013
|
+
} else {
|
|
3014
|
+
output.push(...this.format(task.title, this.logger.icon(
|
|
3015
|
+
"COMPLETED_WITH_SISTER_TASKS_FAILED"
|
|
3016
|
+
/* COMPLETED_WITH_FAILED_SISTER_TASKS */
|
|
3017
|
+
), level));
|
|
3018
|
+
}
|
|
3019
|
+
}
|
|
3020
|
+
if (!task.hasSubtasks() || !rendererOptions.showSubtasks) {
|
|
3021
|
+
if (task.hasFailed() && rendererOptions.collapseErrors === false && (rendererOptions.showErrorMessage || !rendererOptions.showSubtasks)) {
|
|
3022
|
+
output.push(...this.dump(
|
|
3023
|
+
task,
|
|
3024
|
+
level,
|
|
3025
|
+
"FAILED"
|
|
3026
|
+
/* FAILED */
|
|
3027
|
+
));
|
|
3028
|
+
} else if (task.isSkipped() && rendererOptions.collapseSkips === false && (rendererOptions.showSkipMessage || !rendererOptions.showSubtasks)) {
|
|
3029
|
+
output.push(...this.dump(
|
|
3030
|
+
task,
|
|
3031
|
+
level,
|
|
3032
|
+
"SKIPPED"
|
|
3033
|
+
/* SKIPPED */
|
|
3034
|
+
));
|
|
3035
|
+
}
|
|
3036
|
+
}
|
|
3037
|
+
if (task.isPending() || rendererTaskOptions.persistentOutput) {
|
|
3038
|
+
output.push(...this.renderOutputBar(task, level));
|
|
3039
|
+
}
|
|
3040
|
+
if (
|
|
3041
|
+
// check if renderer option is on first
|
|
3042
|
+
rendererOptions.showSubtasks !== false && // if it doesnt have subtasks no need to check
|
|
3043
|
+
task.hasSubtasks() && (task.isPending() || task.hasFinalized() && !task.hasTitle() || // have to be completed and have subtasks
|
|
3044
|
+
task.isCompleted() && rendererOptions.collapseSubtasks === false && !task.subtasks.some((subtask) => this.cache.rendererOptions.get(subtask.id)?.collapseSubtasks === true) || // if any of the subtasks have the collapse option of
|
|
3045
|
+
task.subtasks.some((subtask) => this.cache.rendererOptions.get(subtask.id)?.collapseSubtasks === false) || // if any of the subtasks has failed
|
|
3046
|
+
task.subtasks.some((subtask) => subtask.hasFailed()) || // if any of the subtasks rolled back
|
|
3047
|
+
task.subtasks.some((subtask) => subtask.hasRolledBack()))
|
|
3048
|
+
) {
|
|
3049
|
+
const subtaskLevel = !task.hasTitle() ? level : level + 1;
|
|
3050
|
+
const subtaskRender = this.renderer(task.subtasks, subtaskLevel);
|
|
3051
|
+
output.push(...subtaskRender);
|
|
3052
|
+
}
|
|
3053
|
+
if (task.hasFinalized()) {
|
|
3054
|
+
if (!rendererTaskOptions.persistentOutput) {
|
|
3055
|
+
this.buffer.bottom.delete(task.id);
|
|
3056
|
+
this.buffer.output.delete(task.id);
|
|
3057
|
+
}
|
|
3058
|
+
}
|
|
3059
|
+
if (task.isClosed()) {
|
|
3060
|
+
this.cache.render.set(task.id, output);
|
|
3061
|
+
this.reset(task);
|
|
3062
|
+
}
|
|
3063
|
+
return output;
|
|
3064
|
+
});
|
|
3065
|
+
}
|
|
3066
|
+
renderOutputBar(task, level) {
|
|
3067
|
+
const output = this.buffer.output.get(task.id);
|
|
3068
|
+
if (!output) {
|
|
3069
|
+
return [];
|
|
3070
|
+
}
|
|
3071
|
+
return output.all.flatMap((o) => this.dump(task, level, "OUTPUT", o.entry));
|
|
3072
|
+
}
|
|
3073
|
+
renderBottomBar() {
|
|
3074
|
+
if (this.buffer.bottom.size === 0) {
|
|
3075
|
+
return [];
|
|
3076
|
+
}
|
|
3077
|
+
return Array.from(this.buffer.bottom.values()).flatMap((output) => output.all).sort((a2, b) => a2.time - b.time).map((output) => output.entry);
|
|
3078
|
+
}
|
|
3079
|
+
renderPrompt() {
|
|
3080
|
+
if (!this.prompt) {
|
|
3081
|
+
return [];
|
|
3082
|
+
}
|
|
3083
|
+
return [this.prompt];
|
|
3084
|
+
}
|
|
3085
|
+
calculate(task) {
|
|
3086
|
+
if (this.cache.rendererOptions.has(task.id) && this.cache.rendererTaskOptions.has(task.id)) {
|
|
3087
|
+
return;
|
|
3088
|
+
}
|
|
3089
|
+
const rendererOptions = {
|
|
3090
|
+
...this.options,
|
|
3091
|
+
...task.rendererOptions
|
|
3092
|
+
};
|
|
3093
|
+
this.cache.rendererOptions.set(task.id, rendererOptions);
|
|
3094
|
+
this.cache.rendererTaskOptions.set(task.id, {
|
|
3095
|
+
..._a9.rendererTaskOptions,
|
|
3096
|
+
timer: rendererOptions.timer,
|
|
3097
|
+
...task.rendererTaskOptions
|
|
3098
|
+
});
|
|
3099
|
+
}
|
|
3100
|
+
setupBuffer(task) {
|
|
3101
|
+
if (this.buffer.bottom.has(task.id) || this.buffer.output.has(task.id)) {
|
|
3102
|
+
return;
|
|
3103
|
+
}
|
|
3104
|
+
const rendererTaskOptions = this.cache.rendererTaskOptions.get(task.id);
|
|
3105
|
+
if (this.shouldOutputToBottomBar(task) && !this.buffer.bottom.has(task.id)) {
|
|
3106
|
+
this.buffer.bottom.set(task.id, new ProcessOutputBuffer({ limit: typeof rendererTaskOptions.bottomBar === "number" ? rendererTaskOptions.bottomBar : 1 }));
|
|
3107
|
+
task.on("OUTPUT", (output) => {
|
|
3108
|
+
const data = this.dump(task, -1, "OUTPUT", output);
|
|
3109
|
+
this.buffer.bottom.get(task.id).write(data.join(EOL3));
|
|
3110
|
+
});
|
|
3111
|
+
task.on("STATE", (state) => {
|
|
3112
|
+
switch (state) {
|
|
3113
|
+
case "RETRY":
|
|
3114
|
+
this.buffer.bottom.delete(task.id);
|
|
3115
|
+
break;
|
|
3116
|
+
}
|
|
3117
|
+
});
|
|
3118
|
+
} else if (this.shouldOutputToOutputBar(task) && !this.buffer.output.has(task.id)) {
|
|
3119
|
+
this.buffer.output.set(task.id, new ProcessOutputBuffer({ limit: typeof rendererTaskOptions.outputBar === "number" ? rendererTaskOptions.outputBar : 1 }));
|
|
3120
|
+
task.on("OUTPUT", (output) => {
|
|
3121
|
+
this.buffer.output.get(task.id).write(output);
|
|
3122
|
+
});
|
|
3123
|
+
task.on("STATE", (state) => {
|
|
3124
|
+
switch (state) {
|
|
3125
|
+
case "RETRY":
|
|
3126
|
+
this.buffer.output.delete(task.id);
|
|
3127
|
+
break;
|
|
3128
|
+
}
|
|
3129
|
+
});
|
|
3130
|
+
}
|
|
3131
|
+
}
|
|
3132
|
+
reset(task) {
|
|
3133
|
+
this.cache.rendererOptions.delete(task.id);
|
|
3134
|
+
this.cache.rendererTaskOptions.delete(task.id);
|
|
3135
|
+
this.buffer.output.delete(task.id);
|
|
3136
|
+
}
|
|
3137
|
+
dump(task, level, source = "OUTPUT", data) {
|
|
3138
|
+
if (!data) {
|
|
3139
|
+
switch (source) {
|
|
3140
|
+
case "OUTPUT":
|
|
3141
|
+
data = task.output;
|
|
3142
|
+
break;
|
|
3143
|
+
case "SKIPPED":
|
|
3144
|
+
data = task.message.skip;
|
|
3145
|
+
break;
|
|
3146
|
+
case "FAILED":
|
|
3147
|
+
data = task.message.error;
|
|
3148
|
+
break;
|
|
3149
|
+
}
|
|
3150
|
+
}
|
|
3151
|
+
if (task.hasTitle() && source === "FAILED" && data === task.title || typeof data !== "string") {
|
|
3152
|
+
return [];
|
|
3153
|
+
}
|
|
3154
|
+
if (source === "OUTPUT") {
|
|
3155
|
+
data = cleanseAnsi(data);
|
|
3156
|
+
}
|
|
3157
|
+
return this.format(data, this.style(task, true), level + 1);
|
|
3158
|
+
}
|
|
3159
|
+
indent(str, i) {
|
|
3160
|
+
return i > 0 ? indent(str.trim(), this.options.indentation) : str.trim();
|
|
3161
|
+
}
|
|
3162
|
+
}, __name(_a9, "DefaultRenderer"), __publicField(_a9, "nonTTY", false), __publicField(_a9, "rendererOptions", {
|
|
3163
|
+
indentation: 2,
|
|
3164
|
+
clearOutput: false,
|
|
3165
|
+
showSubtasks: true,
|
|
3166
|
+
collapseSubtasks: true,
|
|
3167
|
+
collapseSkips: true,
|
|
3168
|
+
showSkipMessage: true,
|
|
3169
|
+
suffixSkips: false,
|
|
3170
|
+
collapseErrors: true,
|
|
3171
|
+
showErrorMessage: true,
|
|
3172
|
+
suffixRetries: true,
|
|
3173
|
+
lazy: false,
|
|
3174
|
+
removeEmptyLines: true,
|
|
3175
|
+
formatOutput: "wrap",
|
|
3176
|
+
pausedTimer: {
|
|
3177
|
+
...PRESET_TIMER,
|
|
3178
|
+
format: /* @__PURE__ */ __name(() => color.yellowBright, "format")
|
|
3179
|
+
}
|
|
3180
|
+
}), __publicField(_a9, "rendererTaskOptions", {
|
|
3181
|
+
outputBar: true
|
|
3182
|
+
}), _a9);
|
|
3183
|
+
var _a10;
|
|
3184
|
+
var SilentRenderer = (_a10 = class {
|
|
3185
|
+
constructor(tasks, options2) {
|
|
3186
|
+
this.tasks = tasks;
|
|
3187
|
+
this.options = options2;
|
|
3188
|
+
}
|
|
3189
|
+
render() {
|
|
3190
|
+
return;
|
|
3191
|
+
}
|
|
3192
|
+
end() {
|
|
3193
|
+
return;
|
|
3194
|
+
}
|
|
3195
|
+
}, __name(_a10, "SilentRenderer"), __publicField(_a10, "nonTTY", true), __publicField(_a10, "rendererOptions"), __publicField(_a10, "rendererTaskOptions"), _a10);
|
|
3196
|
+
var _a11;
|
|
3197
|
+
var SimpleRenderer = (_a11 = class {
|
|
3198
|
+
constructor(tasks, options2) {
|
|
3199
|
+
__publicField(this, "logger");
|
|
3200
|
+
__publicField(this, "cache", {
|
|
3201
|
+
rendererOptions: /* @__PURE__ */ new Map(),
|
|
3202
|
+
rendererTaskOptions: /* @__PURE__ */ new Map()
|
|
3203
|
+
});
|
|
3204
|
+
this.tasks = tasks;
|
|
3205
|
+
this.options = options2;
|
|
3206
|
+
this.options = {
|
|
3207
|
+
..._a11.rendererOptions,
|
|
3208
|
+
...options2,
|
|
3209
|
+
icon: {
|
|
3210
|
+
...LISTR_LOGGER_STYLE.icon,
|
|
3211
|
+
...options2?.icon ?? {}
|
|
3212
|
+
},
|
|
3213
|
+
color: {
|
|
3214
|
+
...LISTR_LOGGER_STYLE.color,
|
|
3215
|
+
...options2?.color ?? {}
|
|
3216
|
+
}
|
|
3217
|
+
};
|
|
3218
|
+
this.logger = this.options.logger ?? new ListrLogger({ useIcons: true, toStderr: LISTR_LOGGER_STDERR_LEVELS });
|
|
3219
|
+
this.logger.options.icon = this.options.icon;
|
|
3220
|
+
this.logger.options.color = this.options.color;
|
|
3221
|
+
if (this.options.timestamp) {
|
|
3222
|
+
this.logger.options.fields.prefix.unshift(this.options.timestamp);
|
|
3223
|
+
}
|
|
3224
|
+
}
|
|
3225
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
3226
|
+
end() {
|
|
3227
|
+
}
|
|
3228
|
+
render() {
|
|
3229
|
+
this.renderer(this.tasks);
|
|
3230
|
+
}
|
|
3231
|
+
renderer(tasks) {
|
|
3232
|
+
tasks.forEach((task) => {
|
|
3233
|
+
this.calculate(task);
|
|
3234
|
+
task.once("CLOSED", () => {
|
|
3235
|
+
this.reset(task);
|
|
3236
|
+
});
|
|
3237
|
+
const rendererOptions = this.cache.rendererOptions.get(task.id);
|
|
3238
|
+
const rendererTaskOptions = this.cache.rendererTaskOptions.get(task.id);
|
|
3239
|
+
task.on("SUBTASK", (subtasks) => {
|
|
3240
|
+
this.renderer(subtasks);
|
|
3241
|
+
});
|
|
3242
|
+
task.on("STATE", (state) => {
|
|
3243
|
+
if (!task.hasTitle()) {
|
|
3244
|
+
return;
|
|
3245
|
+
}
|
|
3246
|
+
if (state === "STARTED") {
|
|
3247
|
+
this.logger.log("STARTED", task.title);
|
|
3248
|
+
} else if (state === "COMPLETED") {
|
|
3249
|
+
const timer = rendererTaskOptions?.timer;
|
|
3250
|
+
this.logger.log(
|
|
3251
|
+
"COMPLETED",
|
|
3252
|
+
task.title,
|
|
3253
|
+
timer && {
|
|
3254
|
+
suffix: {
|
|
3255
|
+
...timer,
|
|
3256
|
+
condition: !!task.message?.duration && timer.condition,
|
|
3257
|
+
args: [task.message.duration]
|
|
3258
|
+
}
|
|
3259
|
+
}
|
|
3260
|
+
);
|
|
3261
|
+
} else if (state === "PROMPT") {
|
|
3262
|
+
this.logger.process.hijack();
|
|
3263
|
+
task.on("PROMPT", (prompt) => {
|
|
3264
|
+
this.logger.process.toStderr(prompt, false);
|
|
3265
|
+
});
|
|
3266
|
+
} else if (state === "PROMPT_COMPLETED") {
|
|
3267
|
+
task.off(
|
|
3268
|
+
"PROMPT"
|
|
3269
|
+
/* PROMPT */
|
|
3270
|
+
);
|
|
3271
|
+
this.logger.process.release();
|
|
3272
|
+
}
|
|
3273
|
+
});
|
|
3274
|
+
task.on("OUTPUT", (output) => {
|
|
3275
|
+
this.logger.log("OUTPUT", output);
|
|
3276
|
+
});
|
|
3277
|
+
task.on("MESSAGE", (message) => {
|
|
3278
|
+
if (message.error) {
|
|
3279
|
+
this.logger.log("FAILED", task.title, {
|
|
3280
|
+
suffix: {
|
|
3281
|
+
field: `${"FAILED"}: ${message.error}`,
|
|
3282
|
+
format: /* @__PURE__ */ __name(() => color.red, "format")
|
|
3283
|
+
}
|
|
3284
|
+
});
|
|
3285
|
+
} else if (message.skip) {
|
|
3286
|
+
this.logger.log("SKIPPED", task.title, {
|
|
3287
|
+
suffix: {
|
|
3288
|
+
field: `${"SKIPPED"}: ${message.skip}`,
|
|
3289
|
+
format: /* @__PURE__ */ __name(() => color.yellow, "format")
|
|
3290
|
+
}
|
|
3291
|
+
});
|
|
3292
|
+
} else if (message.rollback) {
|
|
3293
|
+
this.logger.log("ROLLBACK", task.title, {
|
|
3294
|
+
suffix: {
|
|
3295
|
+
field: `${"ROLLBACK"}: ${message.rollback}`,
|
|
3296
|
+
format: /* @__PURE__ */ __name(() => color.red, "format")
|
|
3297
|
+
}
|
|
3298
|
+
});
|
|
3299
|
+
} else if (message.retry) {
|
|
3300
|
+
this.logger.log("RETRY", task.title, {
|
|
3301
|
+
suffix: {
|
|
3302
|
+
field: `${"RETRY"}:${message.retry.count}`,
|
|
3303
|
+
format: /* @__PURE__ */ __name(() => color.red, "format")
|
|
3304
|
+
}
|
|
3305
|
+
});
|
|
3306
|
+
} else if (message.paused) {
|
|
3307
|
+
const timer = rendererOptions?.pausedTimer;
|
|
3308
|
+
this.logger.log(
|
|
3309
|
+
"PAUSED",
|
|
3310
|
+
task.title,
|
|
3311
|
+
timer && {
|
|
3312
|
+
suffix: {
|
|
3313
|
+
...timer,
|
|
3314
|
+
condition: !!message?.paused && timer.condition,
|
|
3315
|
+
args: [message.paused - Date.now()]
|
|
3316
|
+
}
|
|
3317
|
+
}
|
|
3318
|
+
);
|
|
3319
|
+
}
|
|
3320
|
+
});
|
|
3321
|
+
});
|
|
3322
|
+
}
|
|
3323
|
+
calculate(task) {
|
|
3324
|
+
if (this.cache.rendererOptions.has(task.id) && this.cache.rendererTaskOptions.has(task.id)) {
|
|
3325
|
+
return;
|
|
3326
|
+
}
|
|
3327
|
+
const rendererOptions = {
|
|
3328
|
+
...this.options,
|
|
3329
|
+
...task.rendererOptions
|
|
3330
|
+
};
|
|
3331
|
+
this.cache.rendererOptions.set(task.id, rendererOptions);
|
|
3332
|
+
this.cache.rendererTaskOptions.set(task.id, {
|
|
3333
|
+
..._a11.rendererTaskOptions,
|
|
3334
|
+
timer: rendererOptions.timer,
|
|
3335
|
+
...task.rendererTaskOptions
|
|
3336
|
+
});
|
|
3337
|
+
}
|
|
3338
|
+
reset(task) {
|
|
3339
|
+
this.cache.rendererOptions.delete(task.id);
|
|
3340
|
+
this.cache.rendererTaskOptions.delete(task.id);
|
|
3341
|
+
}
|
|
3342
|
+
}, __name(_a11, "SimpleRenderer"), __publicField(_a11, "nonTTY", true), __publicField(_a11, "rendererOptions", {
|
|
3343
|
+
pausedTimer: {
|
|
3344
|
+
...PRESET_TIMER,
|
|
3345
|
+
field: /* @__PURE__ */ __name((time) => `${"PAUSED"}:${time}`, "field"),
|
|
3346
|
+
format: /* @__PURE__ */ __name(() => color.yellowBright, "format")
|
|
3347
|
+
}
|
|
3348
|
+
}), __publicField(_a11, "rendererTaskOptions", {}), _a11);
|
|
3349
|
+
var _a12;
|
|
3350
|
+
var TestRendererSerializer = (_a12 = class {
|
|
3351
|
+
constructor(options2) {
|
|
3352
|
+
this.options = options2;
|
|
3353
|
+
}
|
|
3354
|
+
serialize(event, data, task) {
|
|
3355
|
+
return JSON.stringify(this.generate(event, data, task));
|
|
3356
|
+
}
|
|
3357
|
+
generate(event, data, task) {
|
|
3358
|
+
const output = {
|
|
3359
|
+
event,
|
|
3360
|
+
data
|
|
3361
|
+
};
|
|
3362
|
+
if (typeof this.options?.task !== "boolean") {
|
|
3363
|
+
const t = Object.fromEntries(
|
|
3364
|
+
this.options.task.map((entity) => {
|
|
3365
|
+
const property = task[entity];
|
|
3366
|
+
if (typeof property === "function") {
|
|
3367
|
+
return [entity, property.call(task)];
|
|
3368
|
+
}
|
|
3369
|
+
return [entity, property];
|
|
3370
|
+
})
|
|
3371
|
+
);
|
|
3372
|
+
if (Object.keys(task).length > 0) {
|
|
3373
|
+
output.task = t;
|
|
3374
|
+
}
|
|
3375
|
+
}
|
|
3376
|
+
return output;
|
|
3377
|
+
}
|
|
3378
|
+
}, __name(_a12, "TestRendererSerializer"), _a12);
|
|
3379
|
+
var _a13;
|
|
3380
|
+
var TestRenderer = (_a13 = class {
|
|
3381
|
+
constructor(tasks, options2) {
|
|
3382
|
+
__publicField(this, "logger");
|
|
3383
|
+
__publicField(this, "serializer");
|
|
3384
|
+
this.tasks = tasks;
|
|
3385
|
+
this.options = options2;
|
|
3386
|
+
this.options = { ..._a13.rendererOptions, ...this.options };
|
|
3387
|
+
this.logger = this.options.logger ?? new ListrLogger({ useIcons: false });
|
|
3388
|
+
this.serializer = new TestRendererSerializer(this.options);
|
|
3389
|
+
}
|
|
3390
|
+
render() {
|
|
3391
|
+
this.renderer(this.tasks);
|
|
3392
|
+
}
|
|
3393
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
3394
|
+
end() {
|
|
3395
|
+
}
|
|
3396
|
+
// verbose renderer multi-level
|
|
3397
|
+
renderer(tasks) {
|
|
3398
|
+
tasks.forEach((task) => {
|
|
3399
|
+
if (this.options.subtasks) {
|
|
3400
|
+
task.on("SUBTASK", (subtasks) => {
|
|
3401
|
+
this.renderer(subtasks);
|
|
3402
|
+
});
|
|
3403
|
+
}
|
|
3404
|
+
if (this.options.state) {
|
|
3405
|
+
task.on("STATE", (state) => {
|
|
3406
|
+
this.logger.toStdout(this.serializer.serialize("STATE", state, task));
|
|
3407
|
+
});
|
|
3408
|
+
}
|
|
3409
|
+
if (this.options.output) {
|
|
3410
|
+
task.on("OUTPUT", (data) => {
|
|
3411
|
+
this.logger.toStdout(this.serializer.serialize("OUTPUT", data, task));
|
|
3412
|
+
});
|
|
3413
|
+
}
|
|
3414
|
+
if (this.options.prompt) {
|
|
3415
|
+
task.on("PROMPT", (prompt) => {
|
|
3416
|
+
this.logger.toStdout(this.serializer.serialize("PROMPT", prompt, task));
|
|
3417
|
+
});
|
|
3418
|
+
}
|
|
3419
|
+
if (this.options.title) {
|
|
3420
|
+
task.on("TITLE", (title) => {
|
|
3421
|
+
this.logger.toStdout(this.serializer.serialize("TITLE", title, task));
|
|
3422
|
+
});
|
|
3423
|
+
}
|
|
3424
|
+
task.on("MESSAGE", (message) => {
|
|
3425
|
+
const parsed = Object.fromEntries(
|
|
3426
|
+
Object.entries(message).map(([key, value]) => {
|
|
3427
|
+
if (this.options.messages.includes(key)) {
|
|
3428
|
+
return [key, value];
|
|
3429
|
+
}
|
|
3430
|
+
}).filter(Boolean)
|
|
3431
|
+
);
|
|
3432
|
+
if (Object.keys(parsed).length > 0) {
|
|
3433
|
+
const output = this.serializer.serialize("MESSAGE", parsed, task);
|
|
3434
|
+
if (this.options.messagesToStderr.some((state) => Object.keys(parsed).includes(state))) {
|
|
3435
|
+
this.logger.toStderr(output);
|
|
3436
|
+
} else {
|
|
3437
|
+
this.logger.toStdout(output);
|
|
3438
|
+
}
|
|
3439
|
+
}
|
|
3440
|
+
});
|
|
3441
|
+
});
|
|
3442
|
+
}
|
|
3443
|
+
}, __name(_a13, "TestRenderer"), __publicField(_a13, "nonTTY", true), __publicField(_a13, "rendererOptions", {
|
|
3444
|
+
subtasks: true,
|
|
3445
|
+
state: Object.values(ListrTaskState),
|
|
3446
|
+
output: true,
|
|
3447
|
+
prompt: true,
|
|
3448
|
+
title: true,
|
|
3449
|
+
messages: ["skip", "error", "retry", "rollback", "paused"],
|
|
3450
|
+
messagesToStderr: ["error", "rollback", "retry"],
|
|
3451
|
+
task: [
|
|
3452
|
+
"hasRolledBack",
|
|
3453
|
+
"isRollingBack",
|
|
3454
|
+
"isCompleted",
|
|
3455
|
+
"isSkipped",
|
|
3456
|
+
"hasFinalized",
|
|
3457
|
+
"hasSubtasks",
|
|
3458
|
+
"title",
|
|
3459
|
+
"hasReset",
|
|
3460
|
+
"hasTitle",
|
|
3461
|
+
"isPrompt",
|
|
3462
|
+
"isPaused",
|
|
3463
|
+
"isPending",
|
|
3464
|
+
"isSkipped",
|
|
3465
|
+
"isStarted",
|
|
3466
|
+
"hasFailed",
|
|
3467
|
+
"isEnabled",
|
|
3468
|
+
"isRetrying",
|
|
3469
|
+
"path"
|
|
3470
|
+
]
|
|
3471
|
+
}), __publicField(_a13, "rendererTaskOptions"), _a13);
|
|
3472
|
+
var _a14;
|
|
3473
|
+
var VerboseRenderer = (_a14 = class {
|
|
3474
|
+
constructor(tasks, options2) {
|
|
3475
|
+
__publicField(this, "logger");
|
|
3476
|
+
__publicField(this, "cache", {
|
|
3477
|
+
rendererOptions: /* @__PURE__ */ new Map(),
|
|
3478
|
+
rendererTaskOptions: /* @__PURE__ */ new Map()
|
|
3479
|
+
});
|
|
3480
|
+
this.tasks = tasks;
|
|
3481
|
+
this.options = options2;
|
|
3482
|
+
this.options = {
|
|
3483
|
+
..._a14.rendererOptions,
|
|
3484
|
+
...this.options,
|
|
3485
|
+
icon: {
|
|
3486
|
+
...LISTR_LOGGER_STYLE.icon,
|
|
3487
|
+
...options2?.icon ?? {}
|
|
3488
|
+
},
|
|
3489
|
+
color: {
|
|
3490
|
+
...LISTR_LOGGER_STYLE.color,
|
|
3491
|
+
...options2?.color ?? {}
|
|
3492
|
+
}
|
|
3493
|
+
};
|
|
3494
|
+
this.logger = this.options.logger ?? new ListrLogger({ useIcons: false, toStderr: LISTR_LOGGER_STDERR_LEVELS });
|
|
3495
|
+
this.logger.options.icon = this.options.icon;
|
|
3496
|
+
this.logger.options.color = this.options.color;
|
|
3497
|
+
if (this.options.timestamp) {
|
|
3498
|
+
this.logger.options.fields.prefix.unshift(this.options.timestamp);
|
|
3499
|
+
}
|
|
3500
|
+
}
|
|
3501
|
+
render() {
|
|
3502
|
+
this.renderer(this.tasks);
|
|
3503
|
+
}
|
|
3504
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
3505
|
+
end() {
|
|
3506
|
+
}
|
|
3507
|
+
renderer(tasks) {
|
|
3508
|
+
tasks.forEach((task) => {
|
|
3509
|
+
this.calculate(task);
|
|
3510
|
+
task.once("CLOSED", () => {
|
|
3511
|
+
this.reset(task);
|
|
3512
|
+
});
|
|
3513
|
+
const rendererOptions = this.cache.rendererOptions.get(task.id);
|
|
3514
|
+
const rendererTaskOptions = this.cache.rendererTaskOptions.get(task.id);
|
|
3515
|
+
task.on("SUBTASK", (subtasks) => {
|
|
3516
|
+
this.renderer(subtasks);
|
|
3517
|
+
});
|
|
3518
|
+
task.on("STATE", (state) => {
|
|
3519
|
+
if (!task.hasTitle()) {
|
|
3520
|
+
return;
|
|
3521
|
+
}
|
|
3522
|
+
if (state === "STARTED") {
|
|
3523
|
+
this.logger.log("STARTED", task.title);
|
|
3524
|
+
} else if (state === "COMPLETED") {
|
|
3525
|
+
const timer = rendererTaskOptions.timer;
|
|
3526
|
+
this.logger.log(
|
|
3527
|
+
"COMPLETED",
|
|
3528
|
+
task.title,
|
|
3529
|
+
timer && {
|
|
3530
|
+
suffix: {
|
|
3531
|
+
...timer,
|
|
3532
|
+
condition: !!task.message?.duration && timer.condition,
|
|
3533
|
+
args: [task.message.duration]
|
|
3534
|
+
}
|
|
3535
|
+
}
|
|
3536
|
+
);
|
|
3537
|
+
}
|
|
3538
|
+
});
|
|
3539
|
+
task.on("OUTPUT", (data) => {
|
|
3540
|
+
this.logger.log("OUTPUT", data);
|
|
3541
|
+
});
|
|
3542
|
+
task.on("PROMPT", (prompt) => {
|
|
3543
|
+
const cleansed = cleanseAnsi(prompt);
|
|
3544
|
+
if (cleansed) {
|
|
3545
|
+
this.logger.log("PROMPT", cleansed);
|
|
3546
|
+
}
|
|
3547
|
+
});
|
|
3548
|
+
if (this.options?.logTitleChange !== false) {
|
|
3549
|
+
task.on("TITLE", (title) => {
|
|
3550
|
+
this.logger.log("TITLE", title);
|
|
3551
|
+
});
|
|
3552
|
+
}
|
|
3553
|
+
task.on("MESSAGE", (message) => {
|
|
3554
|
+
if (message?.error) {
|
|
3555
|
+
this.logger.log("FAILED", message.error);
|
|
3556
|
+
} else if (message?.skip) {
|
|
3557
|
+
this.logger.log("SKIPPED", message.skip);
|
|
3558
|
+
} else if (message?.rollback) {
|
|
3559
|
+
this.logger.log("ROLLBACK", message.rollback);
|
|
3560
|
+
} else if (message?.retry) {
|
|
3561
|
+
this.logger.log("RETRY", task.title, { suffix: message.retry.count.toString() });
|
|
3562
|
+
} else if (message?.paused) {
|
|
3563
|
+
const timer = rendererOptions?.pausedTimer;
|
|
3564
|
+
this.logger.log(
|
|
3565
|
+
"PAUSED",
|
|
3566
|
+
task.title,
|
|
3567
|
+
timer && {
|
|
3568
|
+
suffix: {
|
|
3569
|
+
...timer,
|
|
3570
|
+
condition: !!message?.paused && timer.condition,
|
|
3571
|
+
args: [message.paused - Date.now()]
|
|
3572
|
+
}
|
|
3573
|
+
}
|
|
3574
|
+
);
|
|
3575
|
+
}
|
|
3576
|
+
});
|
|
3577
|
+
});
|
|
3578
|
+
}
|
|
3579
|
+
calculate(task) {
|
|
3580
|
+
if (this.cache.rendererOptions.has(task.id) && this.cache.rendererTaskOptions.has(task.id)) {
|
|
3581
|
+
return;
|
|
3582
|
+
}
|
|
3583
|
+
const rendererOptions = {
|
|
3584
|
+
...this.options,
|
|
3585
|
+
...task.rendererOptions
|
|
3586
|
+
};
|
|
3587
|
+
this.cache.rendererOptions.set(task.id, rendererOptions);
|
|
3588
|
+
this.cache.rendererTaskOptions.set(task.id, {
|
|
3589
|
+
..._a14.rendererTaskOptions,
|
|
3590
|
+
timer: rendererOptions.timer,
|
|
3591
|
+
...task.rendererTaskOptions
|
|
3592
|
+
});
|
|
3593
|
+
}
|
|
3594
|
+
reset(task) {
|
|
3595
|
+
this.cache.rendererOptions.delete(task.id);
|
|
3596
|
+
this.cache.rendererTaskOptions.delete(task.id);
|
|
3597
|
+
}
|
|
3598
|
+
}, __name(_a14, "VerboseRenderer"), __publicField(_a14, "nonTTY", true), __publicField(_a14, "rendererOptions", {
|
|
3599
|
+
logTitleChange: false,
|
|
3600
|
+
pausedTimer: {
|
|
3601
|
+
...PRESET_TIMER,
|
|
3602
|
+
format: /* @__PURE__ */ __name(() => color.yellowBright, "format")
|
|
3603
|
+
}
|
|
3604
|
+
}), __publicField(_a14, "rendererTaskOptions"), _a14);
|
|
3605
|
+
var RENDERERS = {
|
|
3606
|
+
default: DefaultRenderer,
|
|
3607
|
+
simple: SimpleRenderer,
|
|
3608
|
+
verbose: VerboseRenderer,
|
|
3609
|
+
test: TestRenderer,
|
|
3610
|
+
silent: SilentRenderer
|
|
3611
|
+
};
|
|
3612
|
+
function isRendererSupported(renderer) {
|
|
3613
|
+
return process.stdout.isTTY === true || renderer.nonTTY === true;
|
|
3614
|
+
}
|
|
3615
|
+
__name(isRendererSupported, "isRendererSupported");
|
|
3616
|
+
function getRendererClass(renderer) {
|
|
3617
|
+
if (typeof renderer === "string") {
|
|
3618
|
+
return RENDERERS[renderer] ?? RENDERERS.default;
|
|
3619
|
+
}
|
|
3620
|
+
return typeof renderer === "function" ? renderer : RENDERERS.default;
|
|
3621
|
+
}
|
|
3622
|
+
__name(getRendererClass, "getRendererClass");
|
|
3623
|
+
function getRenderer(options2) {
|
|
3624
|
+
if (assertFunctionOrSelf(options2?.silentRendererCondition)) {
|
|
3625
|
+
return {
|
|
3626
|
+
renderer: getRendererClass("silent"),
|
|
3627
|
+
selection: "SILENT"
|
|
3628
|
+
/* SILENT */
|
|
3629
|
+
};
|
|
3630
|
+
}
|
|
3631
|
+
const r = {
|
|
3632
|
+
renderer: getRendererClass(options2.renderer),
|
|
3633
|
+
options: options2.rendererOptions,
|
|
3634
|
+
selection: "PRIMARY"
|
|
3635
|
+
/* PRIMARY */
|
|
3636
|
+
};
|
|
3637
|
+
if (!isRendererSupported(r.renderer) || assertFunctionOrSelf(options2?.fallbackRendererCondition)) {
|
|
3638
|
+
return {
|
|
3639
|
+
renderer: getRendererClass(options2.fallbackRenderer),
|
|
3640
|
+
options: options2.fallbackRendererOptions,
|
|
3641
|
+
selection: "SECONDARY"
|
|
3642
|
+
/* SECONDARY */
|
|
3643
|
+
};
|
|
3644
|
+
}
|
|
3645
|
+
return r;
|
|
3646
|
+
}
|
|
3647
|
+
__name(getRenderer, "getRenderer");
|
|
3648
|
+
function assertFunctionOrSelf(functionOrSelf, ...args) {
|
|
3649
|
+
if (typeof functionOrSelf === "function") {
|
|
3650
|
+
return functionOrSelf(...args);
|
|
3651
|
+
} else {
|
|
3652
|
+
return functionOrSelf;
|
|
3653
|
+
}
|
|
3654
|
+
}
|
|
3655
|
+
__name(assertFunctionOrSelf, "assertFunctionOrSelf");
|
|
3656
|
+
var clone = (0, import_rfdc.default)({ circles: true });
|
|
3657
|
+
function cloneObject(obj) {
|
|
3658
|
+
return clone(obj);
|
|
3659
|
+
}
|
|
3660
|
+
__name(cloneObject, "cloneObject");
|
|
3661
|
+
var _a15;
|
|
3662
|
+
var Concurrency = (_a15 = class {
|
|
3663
|
+
constructor(options2) {
|
|
3664
|
+
__publicField(this, "concurrency");
|
|
3665
|
+
__publicField(this, "count");
|
|
3666
|
+
__publicField(this, "queue");
|
|
3667
|
+
this.concurrency = options2.concurrency;
|
|
3668
|
+
this.count = 0;
|
|
3669
|
+
this.queue = /* @__PURE__ */ new Set();
|
|
3670
|
+
}
|
|
3671
|
+
add(fn) {
|
|
3672
|
+
if (this.count < this.concurrency) {
|
|
3673
|
+
return this.run(fn);
|
|
3674
|
+
}
|
|
3675
|
+
return new Promise((resolve) => {
|
|
3676
|
+
const callback = /* @__PURE__ */ __name(() => resolve(this.run(fn)), "callback");
|
|
3677
|
+
this.queue.add(callback);
|
|
3678
|
+
});
|
|
3679
|
+
}
|
|
3680
|
+
flush() {
|
|
3681
|
+
for (const callback of this.queue) {
|
|
3682
|
+
if (this.count >= this.concurrency) {
|
|
3683
|
+
break;
|
|
3684
|
+
}
|
|
3685
|
+
this.queue.delete(callback);
|
|
3686
|
+
callback();
|
|
3687
|
+
}
|
|
3688
|
+
}
|
|
3689
|
+
run(fn) {
|
|
3690
|
+
this.count++;
|
|
3691
|
+
const promise = fn();
|
|
3692
|
+
const cleanup = /* @__PURE__ */ __name(() => {
|
|
3693
|
+
this.count--;
|
|
3694
|
+
this.flush();
|
|
3695
|
+
}, "cleanup");
|
|
3696
|
+
promise.then(cleanup, () => {
|
|
3697
|
+
this.queue.clear();
|
|
3698
|
+
});
|
|
3699
|
+
return promise;
|
|
3700
|
+
}
|
|
3701
|
+
}, __name(_a15, "Concurrency"), _a15);
|
|
3702
|
+
function delay(time) {
|
|
3703
|
+
return new Promise((resolve) => {
|
|
3704
|
+
setTimeout(resolve, time);
|
|
3705
|
+
});
|
|
3706
|
+
}
|
|
3707
|
+
__name(delay, "delay");
|
|
3708
|
+
var _a16;
|
|
3709
|
+
var ListrError = (_a16 = class extends Error {
|
|
3710
|
+
constructor(error, type, task) {
|
|
3711
|
+
super(error.message);
|
|
3712
|
+
__publicField(this, "path");
|
|
3713
|
+
__publicField(this, "ctx");
|
|
3714
|
+
this.error = error;
|
|
3715
|
+
this.type = type;
|
|
3716
|
+
this.task = task;
|
|
3717
|
+
this.name = "ListrError";
|
|
3718
|
+
this.path = task.path;
|
|
3719
|
+
if (task?.options.collectErrors === "full") {
|
|
3720
|
+
this.task = cloneObject(task);
|
|
3721
|
+
this.ctx = cloneObject(task.listr.ctx);
|
|
3722
|
+
}
|
|
3723
|
+
this.stack = error?.stack;
|
|
3724
|
+
}
|
|
3725
|
+
}, __name(_a16, "ListrError"), _a16);
|
|
3726
|
+
var _a17;
|
|
3727
|
+
var ListrRendererError = (_a17 = class extends Error {
|
|
3728
|
+
}, __name(_a17, "ListrRendererError"), _a17);
|
|
3729
|
+
var _a18;
|
|
3730
|
+
var PromptError = (_a18 = class extends Error {
|
|
3731
|
+
}, __name(_a18, "PromptError"), _a18);
|
|
3732
|
+
var _a19;
|
|
3733
|
+
var TaskWrapper = (_a19 = class {
|
|
3734
|
+
constructor(task) {
|
|
3735
|
+
this.task = task;
|
|
3736
|
+
}
|
|
3737
|
+
/* istanbul ignore next */
|
|
3738
|
+
get title() {
|
|
3739
|
+
return this.task.title;
|
|
3740
|
+
}
|
|
3741
|
+
/**
|
|
3742
|
+
* Title of the current task.
|
|
3743
|
+
*
|
|
3744
|
+
* @see {@link https://listr2.kilic.dev/task/title.html}
|
|
3745
|
+
*/
|
|
3746
|
+
set title(title) {
|
|
3747
|
+
title = Array.isArray(title) ? title : [title];
|
|
3748
|
+
this.task.title$ = splat(title.shift(), ...title);
|
|
3749
|
+
}
|
|
3750
|
+
/* istanbul ignore next */
|
|
3751
|
+
get output() {
|
|
3752
|
+
return this.task.output;
|
|
3753
|
+
}
|
|
3754
|
+
/* istanbul ignore next */
|
|
3755
|
+
/**
|
|
3756
|
+
* Send output from the current task to the renderer.
|
|
3757
|
+
*
|
|
3758
|
+
* @see {@link https://listr2.kilic.dev/task/output.html}
|
|
3759
|
+
*/
|
|
3760
|
+
set output(output) {
|
|
3761
|
+
output = Array.isArray(output) ? output : [output];
|
|
3762
|
+
this.task.output$ = splat(output.shift(), ...output);
|
|
3763
|
+
}
|
|
3764
|
+
/* istanbul ignore next */
|
|
3765
|
+
/** Send an output to the output channel as prompt. */
|
|
3766
|
+
set promptOutput(output) {
|
|
3767
|
+
this.task.promptOutput$ = output;
|
|
3768
|
+
}
|
|
3769
|
+
/**
|
|
3770
|
+
* Creates a new set of Listr subtasks.
|
|
3771
|
+
*
|
|
3772
|
+
* @see {@link https://listr2.kilic.dev/task/subtasks.html}
|
|
3773
|
+
*/
|
|
3774
|
+
newListr(task, options2) {
|
|
3775
|
+
let tasks;
|
|
3776
|
+
if (typeof task === "function") {
|
|
3777
|
+
tasks = task(this);
|
|
3778
|
+
} else {
|
|
3779
|
+
tasks = task;
|
|
3780
|
+
}
|
|
3781
|
+
return new Listr(tasks, options2, this.task);
|
|
3782
|
+
}
|
|
3783
|
+
/**
|
|
3784
|
+
* Report an error that has to be collected and handled.
|
|
3785
|
+
*
|
|
3786
|
+
* @see {@link https://listr2.kilic.dev/task/error-handling.html}
|
|
3787
|
+
*/
|
|
3788
|
+
report(error, type) {
|
|
3789
|
+
if (this.task.options.collectErrors !== false) {
|
|
3790
|
+
this.task.listr.errors.push(new ListrError(error, type, this.task));
|
|
3791
|
+
}
|
|
3792
|
+
this.task.message$ = { error: error.message ?? this.task?.title };
|
|
3793
|
+
}
|
|
3794
|
+
/**
|
|
3795
|
+
* Skip the current task.
|
|
3796
|
+
*
|
|
3797
|
+
* @see {@link https://listr2.kilic.dev/task/skip.html}
|
|
3798
|
+
*/
|
|
3799
|
+
skip(message, ...metadata) {
|
|
3800
|
+
this.task.state$ = "SKIPPED";
|
|
3801
|
+
if (message) {
|
|
3802
|
+
this.task.message$ = { skip: message ? splat(message, ...metadata) : this.task?.title };
|
|
3803
|
+
}
|
|
3804
|
+
}
|
|
3805
|
+
/**
|
|
3806
|
+
* Check whether this task is currently in a retry state.
|
|
3807
|
+
*
|
|
3808
|
+
* @see {@link https://listr2.kilic.dev/task/retry.html}
|
|
3809
|
+
*/
|
|
3810
|
+
isRetrying() {
|
|
3811
|
+
return this.task.isRetrying() ? this.task.retry : { count: 0 };
|
|
3812
|
+
}
|
|
3813
|
+
/* istanbul ignore next */
|
|
3814
|
+
/**
|
|
3815
|
+
* Create a new prompt for getting user input through the prompt adapter.
|
|
3816
|
+
* This will create a new prompt through the adapter if the task is not currently rendering a prompt or will return the active instance.
|
|
3817
|
+
*
|
|
3818
|
+
* This part of the application requires optional peer dependencies, please refer to documentation.
|
|
3819
|
+
*
|
|
3820
|
+
* @see {@link https://listr2.kilic.dev/task/prompt.html}
|
|
3821
|
+
*/
|
|
3822
|
+
prompt(adapter) {
|
|
3823
|
+
if (this.task.prompt) {
|
|
3824
|
+
return this.task.prompt;
|
|
3825
|
+
}
|
|
3826
|
+
return new adapter(this.task, this);
|
|
3827
|
+
}
|
|
3828
|
+
/* istanbul ignore next */
|
|
3829
|
+
/**
|
|
3830
|
+
* Generates a fake stdout for your use case, where it will be tunnelled through Listr to handle the rendering process.
|
|
3831
|
+
*
|
|
3832
|
+
* @see {@link https://listr2.kilic.dev/renderer/process-output.html}
|
|
3833
|
+
*/
|
|
3834
|
+
stdout(type) {
|
|
3835
|
+
return createWritable((chunk) => {
|
|
3836
|
+
switch (type) {
|
|
3837
|
+
case "PROMPT":
|
|
3838
|
+
this.promptOutput = chunk;
|
|
3839
|
+
break;
|
|
3840
|
+
default:
|
|
3841
|
+
this.output = chunk;
|
|
3842
|
+
}
|
|
3843
|
+
});
|
|
3844
|
+
}
|
|
3845
|
+
/** Run this task. */
|
|
3846
|
+
run(ctx) {
|
|
3847
|
+
return this.task.run(ctx, this);
|
|
3848
|
+
}
|
|
3849
|
+
}, __name(_a19, "TaskWrapper"), _a19);
|
|
3850
|
+
var _a20;
|
|
3851
|
+
var ListrTaskEventManager = (_a20 = class extends EventManager {
|
|
3852
|
+
}, __name(_a20, "ListrTaskEventManager"), _a20);
|
|
3853
|
+
var _a21;
|
|
3854
|
+
var Task = (_a21 = class extends ListrTaskEventManager {
|
|
3855
|
+
constructor(listr, task, options2, rendererOptions, rendererTaskOptions) {
|
|
3856
|
+
super();
|
|
3857
|
+
/** Unique id per task, can be used for identifying a Task. */
|
|
3858
|
+
__publicField(this, "id", randomUUID());
|
|
3859
|
+
/** The current state of the task. */
|
|
3860
|
+
__publicField(this, "state", "WAITING");
|
|
3861
|
+
/** Subtasks of the current task. */
|
|
3862
|
+
__publicField(this, "subtasks");
|
|
3863
|
+
/** Title of the task. */
|
|
3864
|
+
__publicField(this, "title");
|
|
3865
|
+
/** Initial/Untouched version of the title for using whenever task has a reset. */
|
|
3866
|
+
__publicField(this, "initialTitle");
|
|
3867
|
+
/** Output channel for the task. */
|
|
3868
|
+
__publicField(this, "output");
|
|
3869
|
+
/** Current state of the retry process whenever the task is retrying. */
|
|
3870
|
+
__publicField(this, "retry");
|
|
3871
|
+
/**
|
|
3872
|
+
* A channel for messages.
|
|
3873
|
+
*
|
|
3874
|
+
* This requires a separate channel for messages like error, skip or runtime messages to further utilize in the renderers.
|
|
3875
|
+
*/
|
|
3876
|
+
__publicField(this, "message", {});
|
|
3877
|
+
/** Current prompt instance or prompt error whenever the task is prompting. */
|
|
3878
|
+
__publicField(this, "prompt");
|
|
3879
|
+
/** Parent task of the current task. */
|
|
3880
|
+
__publicField(this, "parent");
|
|
3881
|
+
/** Enable flag of this task. */
|
|
3882
|
+
__publicField(this, "enabled");
|
|
3883
|
+
/** User provided Task callback function to run. */
|
|
3884
|
+
__publicField(this, "taskFn");
|
|
3885
|
+
/** Marks the task as closed. This is different from finalized since this is not really related to task itself. */
|
|
3886
|
+
__publicField(this, "closed");
|
|
3887
|
+
this.listr = listr;
|
|
3888
|
+
this.task = task;
|
|
3889
|
+
this.options = options2;
|
|
3890
|
+
this.rendererOptions = rendererOptions;
|
|
3891
|
+
this.rendererTaskOptions = rendererTaskOptions;
|
|
3892
|
+
if (task.title) {
|
|
3893
|
+
const title = Array.isArray(task?.title) ? task.title : [task.title];
|
|
3894
|
+
this.title = splat(title.shift(), ...title);
|
|
3895
|
+
this.initialTitle = this.title;
|
|
3896
|
+
}
|
|
3897
|
+
this.taskFn = task.task;
|
|
3898
|
+
this.parent = listr.parentTask;
|
|
3899
|
+
}
|
|
3900
|
+
/**
|
|
3901
|
+
* Update the current state of the Task and emit the neccassary events.
|
|
3902
|
+
*/
|
|
3903
|
+
set state$(state) {
|
|
3904
|
+
this.state = state;
|
|
3905
|
+
this.emit("STATE", state);
|
|
3906
|
+
if (this.hasSubtasks() && this.hasFailed()) {
|
|
3907
|
+
for (const subtask of this.subtasks) {
|
|
3908
|
+
if (subtask.state === "STARTED") {
|
|
3909
|
+
subtask.state$ = "FAILED";
|
|
3910
|
+
}
|
|
3911
|
+
}
|
|
3912
|
+
}
|
|
3913
|
+
this.listr.events.emit(
|
|
3914
|
+
"SHOUD_REFRESH_RENDER"
|
|
3915
|
+
/* SHOULD_REFRESH_RENDER */
|
|
3916
|
+
);
|
|
3917
|
+
}
|
|
3918
|
+
/**
|
|
3919
|
+
* Update the current output of the Task and emit the neccassary events.
|
|
3920
|
+
*/
|
|
3921
|
+
set output$(data) {
|
|
3922
|
+
this.output = data;
|
|
3923
|
+
this.emit("OUTPUT", data);
|
|
3924
|
+
this.listr.events.emit(
|
|
3925
|
+
"SHOUD_REFRESH_RENDER"
|
|
3926
|
+
/* SHOULD_REFRESH_RENDER */
|
|
3927
|
+
);
|
|
3928
|
+
}
|
|
3929
|
+
/**
|
|
3930
|
+
* Update the current prompt output of the Task and emit the neccassary events.
|
|
3931
|
+
*/
|
|
3932
|
+
set promptOutput$(data) {
|
|
3933
|
+
this.emit("PROMPT", data);
|
|
3934
|
+
if (cleanseAnsi(data)) {
|
|
3935
|
+
this.listr.events.emit(
|
|
3936
|
+
"SHOUD_REFRESH_RENDER"
|
|
3937
|
+
/* SHOULD_REFRESH_RENDER */
|
|
3938
|
+
);
|
|
3939
|
+
}
|
|
3940
|
+
}
|
|
3941
|
+
/**
|
|
3942
|
+
* Update or extend the current message of the Task and emit the neccassary events.
|
|
3943
|
+
*/
|
|
3944
|
+
set message$(data) {
|
|
3945
|
+
this.message = { ...this.message, ...data };
|
|
3946
|
+
this.emit("MESSAGE", data);
|
|
3947
|
+
this.listr.events.emit(
|
|
3948
|
+
"SHOUD_REFRESH_RENDER"
|
|
3949
|
+
/* SHOULD_REFRESH_RENDER */
|
|
3950
|
+
);
|
|
3951
|
+
}
|
|
3952
|
+
/**
|
|
3953
|
+
* Update the current title of the Task and emit the neccassary events.
|
|
3954
|
+
*/
|
|
3955
|
+
set title$(title) {
|
|
3956
|
+
this.title = title;
|
|
3957
|
+
this.emit("TITLE", title);
|
|
3958
|
+
this.listr.events.emit(
|
|
3959
|
+
"SHOUD_REFRESH_RENDER"
|
|
3960
|
+
/* SHOULD_REFRESH_RENDER */
|
|
3961
|
+
);
|
|
3962
|
+
}
|
|
3963
|
+
/**
|
|
3964
|
+
* Current task path in the hierarchy.
|
|
3965
|
+
*/
|
|
3966
|
+
get path() {
|
|
3967
|
+
return [...this.listr.path, this.initialTitle];
|
|
3968
|
+
}
|
|
3969
|
+
/**
|
|
3970
|
+
* Checks whether the current task with the given context should be set as enabled.
|
|
3971
|
+
*/
|
|
3972
|
+
async check(ctx) {
|
|
3973
|
+
if (this.state === "WAITING") {
|
|
3974
|
+
this.enabled = await assertFunctionOrSelf(this.task?.enabled ?? true, ctx);
|
|
3975
|
+
this.emit("ENABLED", this.enabled);
|
|
3976
|
+
this.listr.events.emit(
|
|
3977
|
+
"SHOUD_REFRESH_RENDER"
|
|
3978
|
+
/* SHOULD_REFRESH_RENDER */
|
|
3979
|
+
);
|
|
3980
|
+
}
|
|
3981
|
+
return this.enabled;
|
|
3982
|
+
}
|
|
3983
|
+
/** Returns whether this task has subtasks. */
|
|
3984
|
+
hasSubtasks() {
|
|
3985
|
+
return this.subtasks?.length > 0;
|
|
3986
|
+
}
|
|
3987
|
+
/** Returns whether this task is finalized in someform. */
|
|
3988
|
+
hasFinalized() {
|
|
3989
|
+
return this.isCompleted() || this.hasFailed() || this.isSkipped() || this.hasRolledBack();
|
|
3990
|
+
}
|
|
3991
|
+
/** Returns whether this task is in progress. */
|
|
3992
|
+
isPending() {
|
|
3993
|
+
return this.isStarted() || this.isPrompt() || this.hasReset();
|
|
3994
|
+
}
|
|
3995
|
+
/** Returns whether this task has started. */
|
|
3996
|
+
isStarted() {
|
|
3997
|
+
return this.state === "STARTED";
|
|
3998
|
+
}
|
|
3999
|
+
/** Returns whether this task is skipped. */
|
|
4000
|
+
isSkipped() {
|
|
4001
|
+
return this.state === "SKIPPED";
|
|
4002
|
+
}
|
|
4003
|
+
/** Returns whether this task has been completed. */
|
|
4004
|
+
isCompleted() {
|
|
4005
|
+
return this.state === "COMPLETED";
|
|
4006
|
+
}
|
|
4007
|
+
/** Returns whether this task has been failed. */
|
|
4008
|
+
hasFailed() {
|
|
4009
|
+
return this.state === "FAILED";
|
|
4010
|
+
}
|
|
4011
|
+
/** Returns whether this task has an active rollback task going on. */
|
|
4012
|
+
isRollingBack() {
|
|
4013
|
+
return this.state === "ROLLING_BACK";
|
|
4014
|
+
}
|
|
4015
|
+
/** Returns whether the rollback action was successful. */
|
|
4016
|
+
hasRolledBack() {
|
|
4017
|
+
return this.state === "ROLLED_BACK";
|
|
4018
|
+
}
|
|
4019
|
+
/** Returns whether this task has an actively retrying task going on. */
|
|
4020
|
+
isRetrying() {
|
|
4021
|
+
return this.state === "RETRY";
|
|
4022
|
+
}
|
|
4023
|
+
/** Returns whether this task has some kind of reset like retry and rollback going on. */
|
|
4024
|
+
hasReset() {
|
|
4025
|
+
return this.state === "RETRY" || this.state === "ROLLING_BACK";
|
|
4026
|
+
}
|
|
4027
|
+
/** Returns whether enabled function resolves to true. */
|
|
4028
|
+
isEnabled() {
|
|
4029
|
+
return this.enabled;
|
|
4030
|
+
}
|
|
4031
|
+
/** Returns whether this task actually has a title. */
|
|
4032
|
+
hasTitle() {
|
|
4033
|
+
return typeof this?.title === "string";
|
|
4034
|
+
}
|
|
4035
|
+
/** Returns whether this task has a prompt inside. */
|
|
4036
|
+
isPrompt() {
|
|
4037
|
+
return this.state === "PROMPT" || this.state === "PROMPT_COMPLETED";
|
|
4038
|
+
}
|
|
4039
|
+
/** Returns whether this task is currently paused. */
|
|
4040
|
+
isPaused() {
|
|
4041
|
+
return this.state === "PAUSED";
|
|
4042
|
+
}
|
|
4043
|
+
/** Returns whether this task is closed. */
|
|
4044
|
+
isClosed() {
|
|
4045
|
+
return this.closed;
|
|
4046
|
+
}
|
|
4047
|
+
/** Pause the given task for certain time. */
|
|
4048
|
+
async pause(time) {
|
|
4049
|
+
const state = this.state;
|
|
4050
|
+
this.state$ = "PAUSED";
|
|
4051
|
+
this.message$ = {
|
|
4052
|
+
paused: Date.now() + time
|
|
4053
|
+
};
|
|
4054
|
+
await delay(time);
|
|
4055
|
+
this.state$ = state;
|
|
4056
|
+
this.message$ = {
|
|
4057
|
+
paused: null
|
|
4058
|
+
};
|
|
4059
|
+
}
|
|
4060
|
+
/** Run the current task. */
|
|
4061
|
+
async run(context, wrapper) {
|
|
4062
|
+
const handleResult = /* @__PURE__ */ __name((result) => {
|
|
4063
|
+
if (result instanceof Listr) {
|
|
4064
|
+
result.options = { ...this.options, ...result.options };
|
|
4065
|
+
result.rendererClass = getRendererClass("silent");
|
|
4066
|
+
this.subtasks = result.tasks;
|
|
4067
|
+
result.errors = this.listr.errors;
|
|
4068
|
+
this.emit("SUBTASK", this.subtasks);
|
|
4069
|
+
result = result.run(context);
|
|
4070
|
+
} else if (result instanceof Promise) {
|
|
4071
|
+
result = result.then(handleResult);
|
|
4072
|
+
} else if (isReadable(result)) {
|
|
4073
|
+
result = new Promise((resolve, reject) => {
|
|
4074
|
+
result.on("data", (data) => {
|
|
4075
|
+
this.output$ = data.toString();
|
|
4076
|
+
});
|
|
4077
|
+
result.on("error", (error) => reject(error));
|
|
4078
|
+
result.on("end", () => resolve(null));
|
|
4079
|
+
});
|
|
4080
|
+
} else if (isObservable(result)) {
|
|
4081
|
+
result = new Promise((resolve, reject) => {
|
|
4082
|
+
result.subscribe({
|
|
4083
|
+
next: /* @__PURE__ */ __name((data) => {
|
|
4084
|
+
this.output$ = data;
|
|
4085
|
+
}, "next"),
|
|
4086
|
+
error: reject,
|
|
4087
|
+
complete: resolve
|
|
4088
|
+
});
|
|
4089
|
+
});
|
|
4090
|
+
}
|
|
4091
|
+
return result;
|
|
4092
|
+
}, "handleResult");
|
|
4093
|
+
const startTime = Date.now();
|
|
4094
|
+
this.state$ = "STARTED";
|
|
4095
|
+
const skipped = await assertFunctionOrSelf(this.task?.skip ?? false, context);
|
|
4096
|
+
if (skipped) {
|
|
4097
|
+
if (typeof skipped === "string") {
|
|
4098
|
+
this.message$ = { skip: skipped };
|
|
4099
|
+
} else if (this.hasTitle()) {
|
|
4100
|
+
this.message$ = { skip: this.title };
|
|
4101
|
+
} else {
|
|
4102
|
+
this.message$ = { skip: "Skipped task without a title." };
|
|
4103
|
+
}
|
|
4104
|
+
this.state$ = "SKIPPED";
|
|
4105
|
+
return;
|
|
4106
|
+
}
|
|
4107
|
+
try {
|
|
4108
|
+
const retryCount = typeof this.task?.retry === "number" && this.task.retry > 0 ? this.task.retry + 1 : typeof this.task?.retry === "object" && this.task.retry.tries > 0 ? this.task.retry.tries + 1 : 1;
|
|
4109
|
+
const retryDelay = typeof this.task.retry === "object" && this.task.retry.delay;
|
|
4110
|
+
for (let retries = 1; retries <= retryCount; retries++) {
|
|
4111
|
+
try {
|
|
4112
|
+
await handleResult(this.taskFn(context, wrapper));
|
|
4113
|
+
break;
|
|
4114
|
+
} catch (err) {
|
|
4115
|
+
if (retries !== retryCount) {
|
|
4116
|
+
this.retry = { count: retries, error: err };
|
|
4117
|
+
this.message$ = { retry: this.retry };
|
|
4118
|
+
this.title$ = this.initialTitle;
|
|
4119
|
+
this.output = void 0;
|
|
4120
|
+
wrapper.report(
|
|
4121
|
+
err,
|
|
4122
|
+
"WILL_RETRY"
|
|
4123
|
+
/* WILL_RETRY */
|
|
4124
|
+
);
|
|
4125
|
+
this.state$ = "RETRY";
|
|
4126
|
+
if (retryDelay) {
|
|
4127
|
+
await this.pause(retryDelay);
|
|
4128
|
+
}
|
|
4129
|
+
} else {
|
|
4130
|
+
throw err;
|
|
4131
|
+
}
|
|
4132
|
+
}
|
|
4133
|
+
}
|
|
4134
|
+
if (this.isStarted() || this.isRetrying()) {
|
|
4135
|
+
this.message$ = { duration: Date.now() - startTime };
|
|
4136
|
+
this.state$ = "COMPLETED";
|
|
4137
|
+
}
|
|
4138
|
+
} catch (error) {
|
|
4139
|
+
if (this.prompt instanceof PromptError) {
|
|
4140
|
+
error = this.prompt;
|
|
4141
|
+
}
|
|
4142
|
+
if (this.task?.rollback) {
|
|
4143
|
+
wrapper.report(
|
|
4144
|
+
error,
|
|
4145
|
+
"WILL_ROLLBACK"
|
|
4146
|
+
/* WILL_ROLLBACK */
|
|
4147
|
+
);
|
|
4148
|
+
try {
|
|
4149
|
+
this.state$ = "ROLLING_BACK";
|
|
4150
|
+
await this.task.rollback(context, wrapper);
|
|
4151
|
+
this.message$ = { rollback: this.title };
|
|
4152
|
+
this.state$ = "ROLLED_BACK";
|
|
4153
|
+
} catch (err) {
|
|
4154
|
+
this.state$ = "FAILED";
|
|
4155
|
+
wrapper.report(
|
|
4156
|
+
err,
|
|
4157
|
+
"HAS_FAILED_TO_ROLLBACK"
|
|
4158
|
+
/* HAS_FAILED_TO_ROLLBACK */
|
|
4159
|
+
);
|
|
4160
|
+
this.close();
|
|
4161
|
+
throw err;
|
|
4162
|
+
}
|
|
4163
|
+
if (this.listr.options?.exitAfterRollback !== false) {
|
|
4164
|
+
this.close();
|
|
4165
|
+
throw error;
|
|
4166
|
+
}
|
|
4167
|
+
} else {
|
|
4168
|
+
this.state$ = "FAILED";
|
|
4169
|
+
if (this.listr.options.exitOnError !== false && await assertFunctionOrSelf(this.task?.exitOnError, context) !== false) {
|
|
4170
|
+
wrapper.report(
|
|
4171
|
+
error,
|
|
4172
|
+
"HAS_FAILED"
|
|
4173
|
+
/* HAS_FAILED */
|
|
4174
|
+
);
|
|
4175
|
+
this.close();
|
|
4176
|
+
throw error;
|
|
4177
|
+
} else if (!this.hasSubtasks()) {
|
|
4178
|
+
wrapper.report(
|
|
4179
|
+
error,
|
|
4180
|
+
"HAS_FAILED_WITHOUT_ERROR"
|
|
4181
|
+
/* HAS_FAILED_WITHOUT_ERROR */
|
|
4182
|
+
);
|
|
4183
|
+
}
|
|
4184
|
+
}
|
|
4185
|
+
} finally {
|
|
4186
|
+
this.close();
|
|
4187
|
+
}
|
|
4188
|
+
}
|
|
4189
|
+
close() {
|
|
4190
|
+
this.emit(
|
|
4191
|
+
"CLOSED"
|
|
4192
|
+
/* CLOSED */
|
|
4193
|
+
);
|
|
4194
|
+
this.listr.events.emit(
|
|
4195
|
+
"SHOUD_REFRESH_RENDER"
|
|
4196
|
+
/* SHOULD_REFRESH_RENDER */
|
|
4197
|
+
);
|
|
4198
|
+
this.complete();
|
|
4199
|
+
}
|
|
4200
|
+
}, __name(_a21, "Task"), _a21);
|
|
4201
|
+
var _a22;
|
|
4202
|
+
var ListrEventManager = (_a22 = class extends EventManager {
|
|
4203
|
+
}, __name(_a22, "ListrEventManager"), _a22);
|
|
4204
|
+
var _a23;
|
|
4205
|
+
var Listr = (_a23 = class {
|
|
4206
|
+
constructor(task, options2, parentTask) {
|
|
4207
|
+
__publicField(this, "tasks", []);
|
|
4208
|
+
__publicField(this, "errors", []);
|
|
4209
|
+
__publicField(this, "ctx");
|
|
4210
|
+
__publicField(this, "events");
|
|
4211
|
+
__publicField(this, "path", []);
|
|
4212
|
+
__publicField(this, "rendererClass");
|
|
4213
|
+
__publicField(this, "rendererClassOptions");
|
|
4214
|
+
__publicField(this, "rendererSelection");
|
|
4215
|
+
__publicField(this, "boundSignalHandler");
|
|
4216
|
+
__publicField(this, "concurrency");
|
|
4217
|
+
__publicField(this, "renderer");
|
|
4218
|
+
this.task = task;
|
|
4219
|
+
this.options = options2;
|
|
4220
|
+
this.parentTask = parentTask;
|
|
4221
|
+
this.options = {
|
|
4222
|
+
concurrent: false,
|
|
4223
|
+
renderer: "default",
|
|
4224
|
+
fallbackRenderer: "simple",
|
|
4225
|
+
exitOnError: true,
|
|
4226
|
+
exitAfterRollback: true,
|
|
4227
|
+
collectErrors: false,
|
|
4228
|
+
registerSignalListeners: true,
|
|
4229
|
+
...this.parentTask?.options ?? {},
|
|
4230
|
+
...options2
|
|
4231
|
+
};
|
|
4232
|
+
if (this.options.concurrent === true) {
|
|
4233
|
+
this.options.concurrent = Infinity;
|
|
4234
|
+
} else if (typeof this.options.concurrent !== "number") {
|
|
4235
|
+
this.options.concurrent = 1;
|
|
4236
|
+
}
|
|
4237
|
+
this.concurrency = new Concurrency({ concurrency: this.options.concurrent });
|
|
4238
|
+
if (parentTask) {
|
|
4239
|
+
this.path = [...parentTask.listr.path, parentTask.title];
|
|
4240
|
+
this.errors = parentTask.listr.errors;
|
|
4241
|
+
}
|
|
4242
|
+
if (this.parentTask?.listr.events instanceof ListrEventManager) {
|
|
4243
|
+
this.events = this.parentTask.listr.events;
|
|
4244
|
+
} else {
|
|
4245
|
+
this.events = new ListrEventManager();
|
|
4246
|
+
}
|
|
4247
|
+
const renderer = getRenderer({
|
|
4248
|
+
renderer: this.options.renderer,
|
|
4249
|
+
rendererOptions: this.options.rendererOptions,
|
|
4250
|
+
fallbackRenderer: this.options.fallbackRenderer,
|
|
4251
|
+
fallbackRendererOptions: this.options.fallbackRendererOptions,
|
|
4252
|
+
fallbackRendererCondition: this.options?.fallbackRendererCondition,
|
|
4253
|
+
silentRendererCondition: this.options?.silentRendererCondition
|
|
4254
|
+
});
|
|
4255
|
+
this.rendererClass = renderer.renderer;
|
|
4256
|
+
this.rendererClassOptions = renderer.options;
|
|
4257
|
+
this.rendererSelection = renderer.selection;
|
|
4258
|
+
this.add(task ?? []);
|
|
4259
|
+
if (this.options.registerSignalListeners) {
|
|
4260
|
+
this.boundSignalHandler = this.signalHandler.bind(this);
|
|
4261
|
+
process.once("SIGINT", this.boundSignalHandler).setMaxListeners(0);
|
|
4262
|
+
}
|
|
4263
|
+
if (this.options?.forceTTY || process.env[
|
|
4264
|
+
"LISTR_FORCE_TTY"
|
|
4265
|
+
/* FORCE_TTY */
|
|
4266
|
+
]) {
|
|
4267
|
+
process.stdout.isTTY = true;
|
|
4268
|
+
process.stderr.isTTY = true;
|
|
4269
|
+
}
|
|
4270
|
+
if (this.options?.forceUnicode) {
|
|
4271
|
+
process.env[
|
|
4272
|
+
"LISTR_FORCE_UNICODE"
|
|
4273
|
+
/* FORCE_UNICODE */
|
|
4274
|
+
] = "1";
|
|
4275
|
+
}
|
|
4276
|
+
}
|
|
4277
|
+
/**
|
|
4278
|
+
* Whether this is the root task.
|
|
4279
|
+
*/
|
|
4280
|
+
isRoot() {
|
|
4281
|
+
return !this.parentTask;
|
|
4282
|
+
}
|
|
4283
|
+
/**
|
|
4284
|
+
* Whether this is a subtask of another task list.
|
|
4285
|
+
*/
|
|
4286
|
+
isSubtask() {
|
|
4287
|
+
return !!this.parentTask;
|
|
4288
|
+
}
|
|
4289
|
+
/**
|
|
4290
|
+
* Add tasks to current task list.
|
|
4291
|
+
*
|
|
4292
|
+
* @see {@link https://listr2.kilic.dev/task/task.html}
|
|
4293
|
+
*/
|
|
4294
|
+
add(tasks) {
|
|
4295
|
+
this.tasks.push(...this.generate(tasks));
|
|
4296
|
+
}
|
|
4297
|
+
/**
|
|
4298
|
+
* Run the task list.
|
|
4299
|
+
*
|
|
4300
|
+
* @see {@link https://listr2.kilic.dev/listr/listr.html#run-the-generated-task-list}
|
|
4301
|
+
*/
|
|
4302
|
+
async run(context) {
|
|
4303
|
+
if (!this.renderer) {
|
|
4304
|
+
this.renderer = new this.rendererClass(this.tasks, this.rendererClassOptions, this.events);
|
|
4305
|
+
}
|
|
4306
|
+
await this.renderer.render();
|
|
4307
|
+
this.ctx = this.options?.ctx ?? context ?? {};
|
|
4308
|
+
await Promise.all(this.tasks.map((task) => task.check(this.ctx)));
|
|
4309
|
+
try {
|
|
4310
|
+
await Promise.all(this.tasks.map((task) => this.concurrency.add(() => this.runTask(task))));
|
|
4311
|
+
this.renderer.end();
|
|
4312
|
+
this.removeSignalHandler();
|
|
4313
|
+
} catch (err) {
|
|
4314
|
+
if (this.options.exitOnError !== false) {
|
|
4315
|
+
this.renderer.end(err);
|
|
4316
|
+
this.removeSignalHandler();
|
|
4317
|
+
throw err;
|
|
4318
|
+
}
|
|
4319
|
+
}
|
|
4320
|
+
return this.ctx;
|
|
4321
|
+
}
|
|
4322
|
+
generate(tasks) {
|
|
4323
|
+
tasks = Array.isArray(tasks) ? tasks : [tasks];
|
|
4324
|
+
return tasks.map((task) => {
|
|
4325
|
+
let rendererTaskOptions;
|
|
4326
|
+
if (this.rendererSelection === "PRIMARY") {
|
|
4327
|
+
rendererTaskOptions = task.rendererOptions;
|
|
4328
|
+
} else if (this.rendererSelection === "SECONDARY") {
|
|
4329
|
+
rendererTaskOptions = task.fallbackRendererOptions;
|
|
4330
|
+
}
|
|
4331
|
+
return new Task(
|
|
4332
|
+
this,
|
|
4333
|
+
task,
|
|
4334
|
+
this.options,
|
|
4335
|
+
this.rendererClassOptions,
|
|
4336
|
+
rendererTaskOptions
|
|
4337
|
+
);
|
|
4338
|
+
});
|
|
4339
|
+
}
|
|
4340
|
+
async runTask(task) {
|
|
4341
|
+
if (!await task.check(this.ctx)) {
|
|
4342
|
+
return;
|
|
4343
|
+
}
|
|
4344
|
+
return new TaskWrapper(task).run(this.ctx);
|
|
4345
|
+
}
|
|
4346
|
+
async signalHandler() {
|
|
4347
|
+
this.tasks?.forEach(async (task) => {
|
|
4348
|
+
if (task.isPending()) {
|
|
4349
|
+
task.state$ = "FAILED";
|
|
4350
|
+
}
|
|
4351
|
+
});
|
|
4352
|
+
await this.externalSignalHandler?.(this.ctx);
|
|
4353
|
+
if (this.isRoot()) {
|
|
4354
|
+
this.renderer.end(new Error("Interrupted."));
|
|
4355
|
+
process.exit(127);
|
|
4356
|
+
}
|
|
4357
|
+
}
|
|
4358
|
+
removeSignalHandler() {
|
|
4359
|
+
if (this.boundSignalHandler) {
|
|
4360
|
+
process.removeListener("SIGINT", this.boundSignalHandler);
|
|
4361
|
+
}
|
|
4362
|
+
}
|
|
4363
|
+
}, __name(_a23, "Listr"), _a23);
|
|
4364
|
+
|
|
11
4365
|
// src/error.ts
|
|
12
|
-
import { color } from "listr2";
|
|
13
4366
|
var AbstractError = class extends Error {
|
|
14
4367
|
constructor(message, { cause } = {}) {
|
|
15
4368
|
super(message, { cause });
|
|
@@ -58,14 +4411,13 @@ function resolveOptions(options2) {
|
|
|
58
4411
|
}
|
|
59
4412
|
|
|
60
4413
|
// src/tasks/runner.ts
|
|
61
|
-
import
|
|
4414
|
+
import process8 from "node:process";
|
|
62
4415
|
import npmCli from "@npmcli/promise-spawn";
|
|
63
|
-
import { color as color5 } from "listr2";
|
|
64
4416
|
import SemVer from "semver";
|
|
65
|
-
import { exec as
|
|
4417
|
+
import { exec as exec6 } from "tinyexec";
|
|
66
4418
|
|
|
67
4419
|
// src/git.ts
|
|
68
|
-
import { exec } from "tinyexec";
|
|
4420
|
+
import { exec as exec2 } from "tinyexec";
|
|
69
4421
|
var GitError = class extends AbstractError {
|
|
70
4422
|
constructor() {
|
|
71
4423
|
super(...arguments);
|
|
@@ -74,7 +4426,7 @@ var GitError = class extends AbstractError {
|
|
|
74
4426
|
};
|
|
75
4427
|
var Git = class {
|
|
76
4428
|
async git(args) {
|
|
77
|
-
const { stdout, stderr } = await
|
|
4429
|
+
const { stdout, stderr } = await exec2("git", args);
|
|
78
4430
|
if (stderr) throw stderr;
|
|
79
4431
|
return stdout;
|
|
80
4432
|
}
|
|
@@ -315,7 +4667,7 @@ var Git = class {
|
|
|
315
4667
|
async push(options2) {
|
|
316
4668
|
const args = ["push", options2].filter((v) => v);
|
|
317
4669
|
try {
|
|
318
|
-
const { stderr } = await
|
|
4670
|
+
const { stderr } = await exec2("git", args, { throwOnError: true });
|
|
319
4671
|
if (`${stderr}`.includes("GH006")) {
|
|
320
4672
|
return false;
|
|
321
4673
|
}
|
|
@@ -332,15 +4684,11 @@ var Git = class {
|
|
|
332
4684
|
};
|
|
333
4685
|
|
|
334
4686
|
// src/utils/cli.ts
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
function link(text, url) {
|
|
4687
|
+
var warningBadge = color.bgYellow(" Warning ");
|
|
4688
|
+
function link2(text, url) {
|
|
338
4689
|
return `\x1B]8;;${url}\x07${text}\x1B]8;;\x07`;
|
|
339
4690
|
}
|
|
340
4691
|
|
|
341
|
-
// src/utils/listr.ts
|
|
342
|
-
import { Listr } from "listr2";
|
|
343
|
-
|
|
344
4692
|
// src/utils/rollback.ts
|
|
345
4693
|
var rollbacks = [];
|
|
346
4694
|
function addRollback(rollback2, context) {
|
|
@@ -367,13 +4715,13 @@ function createListr(...args) {
|
|
|
367
4715
|
// src/utils/package.ts
|
|
368
4716
|
import { readFile, stat, writeFile } from "node:fs/promises";
|
|
369
4717
|
import path from "node:path";
|
|
370
|
-
import
|
|
4718
|
+
import process7 from "node:process";
|
|
371
4719
|
var cachedPackageJson = {};
|
|
372
4720
|
var cachedJsrJson = {};
|
|
373
|
-
async function patchCachedJsrJson(contents, { cwd =
|
|
4721
|
+
async function patchCachedJsrJson(contents, { cwd = process7.cwd() } = {}) {
|
|
374
4722
|
cachedJsrJson[cwd] = { ...cachedJsrJson[cwd], ...contents };
|
|
375
4723
|
}
|
|
376
|
-
async function findOutFile(file, { cwd =
|
|
4724
|
+
async function findOutFile(file, { cwd = process7.cwd() } = {}) {
|
|
377
4725
|
let directory = cwd;
|
|
378
4726
|
let filePath = "";
|
|
379
4727
|
const { root } = path.parse(cwd);
|
|
@@ -391,7 +4739,7 @@ async function findOutFile(file, { cwd = process.cwd() } = {}) {
|
|
|
391
4739
|
return filePath;
|
|
392
4740
|
}
|
|
393
4741
|
async function getPackageJson({
|
|
394
|
-
cwd =
|
|
4742
|
+
cwd = process7.cwd(),
|
|
395
4743
|
fallbackJsr = true
|
|
396
4744
|
} = {}) {
|
|
397
4745
|
if (cachedPackageJson[cwd]) return cachedPackageJson[cwd];
|
|
@@ -424,7 +4772,7 @@ async function getPackageJson({
|
|
|
424
4772
|
}
|
|
425
4773
|
}
|
|
426
4774
|
async function getJsrJson({
|
|
427
|
-
cwd =
|
|
4775
|
+
cwd = process7.cwd(),
|
|
428
4776
|
fallbackPackage = true
|
|
429
4777
|
} = {}) {
|
|
430
4778
|
if (cachedJsrJson[cwd]) return cachedJsrJson[cwd];
|
|
@@ -502,7 +4850,7 @@ async function jsrJsonToPackageJson(jsrJson) {
|
|
|
502
4850
|
return convertedExports;
|
|
503
4851
|
}
|
|
504
4852
|
}
|
|
505
|
-
async function version({ cwd =
|
|
4853
|
+
async function version({ cwd = process7.cwd() } = {}) {
|
|
506
4854
|
let version2 = (await getPackageJson({ cwd }))?.version;
|
|
507
4855
|
if (!version2) {
|
|
508
4856
|
version2 = (await getJsrJson({ cwd }))?.version;
|
|
@@ -557,10 +4905,9 @@ async function getPackageManager() {
|
|
|
557
4905
|
|
|
558
4906
|
// src/tasks/jsr.ts
|
|
559
4907
|
import { ListrEnquirerPromptAdapter } from "@listr2/prompt-adapter-enquirer";
|
|
560
|
-
import { color as color3 } from "listr2";
|
|
561
4908
|
|
|
562
4909
|
// src/registry/jsr.ts
|
|
563
|
-
import { exec as
|
|
4910
|
+
import { exec as exec3 } from "tinyexec";
|
|
564
4911
|
|
|
565
4912
|
// src/utils/db.ts
|
|
566
4913
|
import { createCipheriv, createDecipheriv, createHash } from "node:crypto";
|
|
@@ -684,7 +5031,7 @@ var JsrRegisry = class extends Registry {
|
|
|
684
5031
|
this.client = new JsrClient(getApiEndpoint(this.registry));
|
|
685
5032
|
}
|
|
686
5033
|
async jsr(args) {
|
|
687
|
-
const { stdout, stderr } = await
|
|
5034
|
+
const { stdout, stderr } = await exec3("jsr", args);
|
|
688
5035
|
if (stderr) throw stderr;
|
|
689
5036
|
return stdout;
|
|
690
5037
|
}
|
|
@@ -701,7 +5048,7 @@ var JsrRegisry = class extends Registry {
|
|
|
701
5048
|
}
|
|
702
5049
|
async ping() {
|
|
703
5050
|
try {
|
|
704
|
-
const { stdout, stderr } = await
|
|
5051
|
+
const { stdout, stderr } = await exec3("ping", [
|
|
705
5052
|
new URL(this.registry).hostname,
|
|
706
5053
|
"-c",
|
|
707
5054
|
"1"
|
|
@@ -717,7 +5064,7 @@ var JsrRegisry = class extends Registry {
|
|
|
717
5064
|
}
|
|
718
5065
|
async publish() {
|
|
719
5066
|
try {
|
|
720
|
-
await
|
|
5067
|
+
await exec3(
|
|
721
5068
|
"jsr",
|
|
722
5069
|
["publish", "--allow-dirty", "--token", `${JsrClient.token}`],
|
|
723
5070
|
{
|
|
@@ -759,12 +5106,12 @@ var _JsrClient = class _JsrClient {
|
|
|
759
5106
|
constructor(apiEndpoint) {
|
|
760
5107
|
this.apiEndpoint = apiEndpoint;
|
|
761
5108
|
}
|
|
762
|
-
async fetch(endpoint,
|
|
5109
|
+
async fetch(endpoint, init2) {
|
|
763
5110
|
const pubmVersion = await version({ cwd: import.meta.dirname });
|
|
764
5111
|
return fetch(new URL(endpoint, this.apiEndpoint), {
|
|
765
|
-
...
|
|
5112
|
+
...init2,
|
|
766
5113
|
headers: {
|
|
767
|
-
...
|
|
5114
|
+
...init2?.headers,
|
|
768
5115
|
Authorization: `Bearer ${_JsrClient.token}`,
|
|
769
5116
|
"User-Agent": `pubm/${pubmVersion}; https://github.com/syi0808/pubm`
|
|
770
5117
|
}
|
|
@@ -908,7 +5255,7 @@ async function jsrRegistry() {
|
|
|
908
5255
|
}
|
|
909
5256
|
|
|
910
5257
|
// src/registry/npm.ts
|
|
911
|
-
import { exec as
|
|
5258
|
+
import { exec as exec4 } from "tinyexec";
|
|
912
5259
|
var NpmError = class extends AbstractError {
|
|
913
5260
|
constructor() {
|
|
914
5261
|
super(...arguments);
|
|
@@ -921,7 +5268,7 @@ var NpmRegistry = class extends Registry {
|
|
|
921
5268
|
__publicField(this, "registry", "https://registry.npmjs.org");
|
|
922
5269
|
}
|
|
923
5270
|
async npm(args) {
|
|
924
|
-
const { stdout, stderr } = await
|
|
5271
|
+
const { stdout, stderr } = await exec4("npm", args);
|
|
925
5272
|
if (stderr) throw stderr;
|
|
926
5273
|
return stdout;
|
|
927
5274
|
}
|
|
@@ -1007,7 +5354,7 @@ var NpmRegistry = class extends Registry {
|
|
|
1007
5354
|
}
|
|
1008
5355
|
async ping() {
|
|
1009
5356
|
try {
|
|
1010
|
-
await
|
|
5357
|
+
await exec4("npm", ["ping"], { throwOnError: true });
|
|
1011
5358
|
return true;
|
|
1012
5359
|
} catch (error) {
|
|
1013
5360
|
throw new NpmError("Failed to run `npm ping`", { cause: error });
|
|
@@ -1066,9 +5413,9 @@ var jsrAvailableCheckTasks = {
|
|
|
1066
5413
|
while (true) {
|
|
1067
5414
|
JsrClient.token = await task.prompt(ListrEnquirerPromptAdapter).run({
|
|
1068
5415
|
type: "password",
|
|
1069
|
-
message: `Please enter the jsr ${
|
|
5416
|
+
message: `Please enter the jsr ${color.bold("API token")}`,
|
|
1070
5417
|
footer: `
|
|
1071
|
-
Generate a token from ${
|
|
5418
|
+
Generate a token from ${color.bold(link2("jsr.io", "https://jsr.io/account/tokens/create/"))}. ${color.red("You should select")} ${color.bold("'Interact with the JSR API'")}.`
|
|
1072
5419
|
});
|
|
1073
5420
|
try {
|
|
1074
5421
|
if (await jsr.client.user()) break;
|
|
@@ -1113,17 +5460,17 @@ Generate a token from ${color3.bold(link("jsr.io", "https://jsr.io/account/token
|
|
|
1113
5460
|
message: "jsr.json does not exist, and the package name is not scoped. Please select a scope for the 'jsr' package",
|
|
1114
5461
|
choices: [
|
|
1115
5462
|
{
|
|
1116
|
-
message: `@${jsr.packageName}/${jsr.packageName} ${
|
|
5463
|
+
message: `@${jsr.packageName}/${jsr.packageName} ${color.dim("scoped by package name")}${scopes.includes(jsr.packageName) ? " (already created)" : ""}`,
|
|
1117
5464
|
name: `@${jsr.packageName}/${jsr.packageName}`
|
|
1118
5465
|
},
|
|
1119
5466
|
{
|
|
1120
|
-
message: `@${userName}/${jsr.packageName} ${
|
|
5467
|
+
message: `@${userName}/${jsr.packageName} ${color.dim("scoped by git name")}${scopes.includes(userName) ? " (already created)" : ""}`,
|
|
1121
5468
|
name: `@${userName}/${jsr.packageName}`
|
|
1122
5469
|
},
|
|
1123
5470
|
...scopes.flatMap(
|
|
1124
5471
|
(scope2) => scope2 === jsr.packageName || scope2 === userName ? [] : [
|
|
1125
5472
|
{
|
|
1126
|
-
message: `@${scope2}/${jsr.packageName} ${
|
|
5473
|
+
message: `@${scope2}/${jsr.packageName} ${color.dim("scope from jsr")}`,
|
|
1127
5474
|
name: `@${scope2}/${jsr.packageName}`
|
|
1128
5475
|
}
|
|
1129
5476
|
]
|
|
@@ -1161,21 +5508,21 @@ Generate a token from ${color3.bold(link("jsr.io", "https://jsr.io/account/token
|
|
|
1161
5508
|
const hasPermission = await jsr.hasPermission();
|
|
1162
5509
|
if (isScopedPackage(npm.packageName) && !hasPermission) {
|
|
1163
5510
|
throw new JsrAvailableError(
|
|
1164
|
-
`You do not have permission to publish scope '${getScope(npm.packageName)}'. If you want to claim it, please contact ${
|
|
5511
|
+
`You do not have permission to publish scope '${getScope(npm.packageName)}'. If you want to claim it, please contact ${link2("help@jsr.io", "mailto:help@jsr.io")}.`
|
|
1165
5512
|
);
|
|
1166
5513
|
}
|
|
1167
5514
|
if (await jsr.isPublished()) {
|
|
1168
5515
|
if (!hasPermission) {
|
|
1169
5516
|
throw new JsrAvailableError(
|
|
1170
|
-
`You do not have permission to publish this package on ${
|
|
5517
|
+
`You do not have permission to publish this package on ${color.yellow("jsr")}.`
|
|
1171
5518
|
);
|
|
1172
5519
|
}
|
|
1173
5520
|
return void 0;
|
|
1174
5521
|
}
|
|
1175
5522
|
if (!await jsr.isPackageNameAvaliable()) {
|
|
1176
5523
|
throw new JsrAvailableError(
|
|
1177
|
-
`Package is not published on ${
|
|
1178
|
-
More information: ${
|
|
5524
|
+
`Package is not published on ${color.yellow("jsr")}, and the package name is not available. Please change the package name.
|
|
5525
|
+
More information: ${link2("npm naming rules", "https://github.com/npm/validate-npm-package-name?tab=readme-ov-file#naming-rules")}`
|
|
1179
5526
|
);
|
|
1180
5527
|
}
|
|
1181
5528
|
}
|
|
@@ -1191,7 +5538,6 @@ var jsrPublishTasks = {
|
|
|
1191
5538
|
|
|
1192
5539
|
// src/tasks/npm.ts
|
|
1193
5540
|
import { ListrEnquirerPromptAdapter as ListrEnquirerPromptAdapter2 } from "@listr2/prompt-adapter-enquirer";
|
|
1194
|
-
import { color as color4 } from "listr2";
|
|
1195
5541
|
var NpmAvailableError = class extends AbstractError {
|
|
1196
5542
|
constructor(message, { cause } = {}) {
|
|
1197
5543
|
super(message, { cause });
|
|
@@ -1207,15 +5553,15 @@ var npmAvailableCheckTasks = {
|
|
|
1207
5553
|
if (await npm.isPublished()) {
|
|
1208
5554
|
if (!await npm.hasPermission()) {
|
|
1209
5555
|
throw new NpmAvailableError(
|
|
1210
|
-
`You do not have permission to publish this package on ${
|
|
5556
|
+
`You do not have permission to publish this package on ${color.green("npm")}.`
|
|
1211
5557
|
);
|
|
1212
5558
|
}
|
|
1213
5559
|
return void 0;
|
|
1214
5560
|
}
|
|
1215
5561
|
if (!await npm.isPackageNameAvaliable()) {
|
|
1216
5562
|
throw new NpmAvailableError(
|
|
1217
|
-
`Package is not published on ${
|
|
1218
|
-
More information: ${
|
|
5563
|
+
`Package is not published on ${color.green("npm")}, and the package name is not available. Please change the package name.
|
|
5564
|
+
More information: ${link2("npm naming rules", "https://github.com/npm/validate-npm-package-name?tab=readme-ov-file#naming-rules")}`
|
|
1219
5565
|
);
|
|
1220
5566
|
}
|
|
1221
5567
|
}
|
|
@@ -1394,10 +5740,10 @@ var prerequisitesCheckTask = (options2) => {
|
|
|
1394
5740
|
import { ListrEnquirerPromptAdapter as ListrEnquirerPromptAdapter4 } from "@listr2/prompt-adapter-enquirer";
|
|
1395
5741
|
|
|
1396
5742
|
// src/registry/custom-registry.ts
|
|
1397
|
-
import { exec as
|
|
5743
|
+
import { exec as exec5 } from "tinyexec";
|
|
1398
5744
|
var CustomRegistry = class extends NpmRegistry {
|
|
1399
5745
|
async npm(args) {
|
|
1400
|
-
const { stdout, stderr } = await
|
|
5746
|
+
const { stdout, stderr } = await exec5(
|
|
1401
5747
|
"npm",
|
|
1402
5748
|
args.concat("--registry", this.registry)
|
|
1403
5749
|
);
|
|
@@ -1573,7 +5919,7 @@ async function run(options2) {
|
|
|
1573
5919
|
lastRev: await git.latestTag() || await git.firstCommit()
|
|
1574
5920
|
};
|
|
1575
5921
|
try {
|
|
1576
|
-
if (options2.contents)
|
|
5922
|
+
if (options2.contents) process8.chdir(options2.contents);
|
|
1577
5923
|
await prerequisitesCheckTask({ skip: options2.skipPrerequisitesCheck }).run(
|
|
1578
5924
|
ctx
|
|
1579
5925
|
);
|
|
@@ -1586,7 +5932,7 @@ async function run(options2) {
|
|
|
1586
5932
|
title: "Running tests",
|
|
1587
5933
|
task: async (ctx2) => {
|
|
1588
5934
|
const packageManager = await getPackageManager();
|
|
1589
|
-
const { stderr } = await
|
|
5935
|
+
const { stderr } = await exec6(packageManager, [
|
|
1590
5936
|
"run",
|
|
1591
5937
|
ctx2.testScript
|
|
1592
5938
|
]);
|
|
@@ -1604,7 +5950,7 @@ async function run(options2) {
|
|
|
1604
5950
|
task: async (ctx2) => {
|
|
1605
5951
|
const packageManager = await getPackageManager();
|
|
1606
5952
|
try {
|
|
1607
|
-
await
|
|
5953
|
+
await exec6(packageManager, ["run", ctx2.buildScript], {
|
|
1608
5954
|
throwOnError: true
|
|
1609
5955
|
});
|
|
1610
5956
|
} catch (error) {
|
|
@@ -1698,7 +6044,7 @@ ${repositoryUrl}/compare/${ctx2.lastRev}...${latestTag}`;
|
|
|
1698
6044
|
"prerelease",
|
|
1699
6045
|
`${!!prerelease(ctx2.version)}`
|
|
1700
6046
|
);
|
|
1701
|
-
const linkUrl =
|
|
6047
|
+
const linkUrl = link2("Link", releaseDraftUrl.toString());
|
|
1702
6048
|
task.title += ` ${linkUrl}`;
|
|
1703
6049
|
await open(releaseDraftUrl.toString());
|
|
1704
6050
|
}
|
|
@@ -1709,13 +6055,13 @@ ${repositoryUrl}/compare/${ctx2.lastRev}...${latestTag}`;
|
|
|
1709
6055
|
console.log(
|
|
1710
6056
|
`
|
|
1711
6057
|
|
|
1712
|
-
\u{1F680} Successfully published ${
|
|
6058
|
+
\u{1F680} Successfully published ${color.bold(npmPackageName)} on ${color.green("npm")} and ${color.bold(jsrPackageName)} on ${color.yellow("jsr")} ${color.blueBright(`v${ctx.version}`)} \u{1F680}
|
|
1713
6059
|
`
|
|
1714
6060
|
);
|
|
1715
6061
|
} catch (e2) {
|
|
1716
6062
|
consoleError(e2);
|
|
1717
6063
|
await rollback();
|
|
1718
|
-
|
|
6064
|
+
process8.exit(1);
|
|
1719
6065
|
}
|
|
1720
6066
|
}
|
|
1721
6067
|
|
|
@@ -1727,7 +6073,6 @@ async function pubm(options2) {
|
|
|
1727
6073
|
|
|
1728
6074
|
// src/tasks/required-missing-information.ts
|
|
1729
6075
|
import { ListrEnquirerPromptAdapter as ListrEnquirerPromptAdapter5 } from "@listr2/prompt-adapter-enquirer";
|
|
1730
|
-
import { color as color6 } from "listr2";
|
|
1731
6076
|
import semver from "semver";
|
|
1732
6077
|
var { RELEASE_TYPES, SemVer: SemVer2, prerelease: prerelease2 } = semver;
|
|
1733
6078
|
var requiredMissingInformationTasks = (options2) => createListr({
|
|
@@ -1745,7 +6090,7 @@ var requiredMissingInformationTasks = (options2) => createListr({
|
|
|
1745
6090
|
choices: RELEASE_TYPES.map((releaseType) => {
|
|
1746
6091
|
const increasedVersion = new SemVer2(currentVersion).inc(releaseType).toString();
|
|
1747
6092
|
return {
|
|
1748
|
-
message: `${releaseType} ${
|
|
6093
|
+
message: `${releaseType} ${color.dim(increasedVersion)}`,
|
|
1749
6094
|
name: increasedVersion
|
|
1750
6095
|
};
|
|
1751
6096
|
}).concat([
|
|
@@ -1802,8 +6147,7 @@ var requiredMissingInformationTasks = (options2) => createListr({
|
|
|
1802
6147
|
});
|
|
1803
6148
|
|
|
1804
6149
|
// src/utils/notify-new-version.ts
|
|
1805
|
-
import {
|
|
1806
|
-
import { exec as exec6 } from "tinyexec";
|
|
6150
|
+
import { exec as exec7 } from "tinyexec";
|
|
1807
6151
|
async function notifyNewVersion() {
|
|
1808
6152
|
const currentVersion = await version({ cwd: import.meta.dirname });
|
|
1809
6153
|
await Promise.all([
|
|
@@ -1817,12 +6161,12 @@ async function notifyNewVersion() {
|
|
|
1817
6161
|
cwd: import.meta.dirname,
|
|
1818
6162
|
fallbackJsr: false
|
|
1819
6163
|
});
|
|
1820
|
-
const { stdout } = await
|
|
6164
|
+
const { stdout } = await exec7("npm", ["info", name, "version"]);
|
|
1821
6165
|
const newVersion = stdout.trim();
|
|
1822
6166
|
if (newVersion !== currentVersion) {
|
|
1823
6167
|
console.log(
|
|
1824
6168
|
`
|
|
1825
|
-
Update available! \`${name}\` ${
|
|
6169
|
+
Update available! \`${name}\` ${color.red(currentVersion)} \u2192 ${color.green(newVersion)}
|
|
1826
6170
|
`
|
|
1827
6171
|
);
|
|
1828
6172
|
}
|
|
@@ -1847,7 +6191,7 @@ Update available! \`${name}\` ${color7.red(currentVersion)} \u2192 ${color7.gree
|
|
|
1847
6191
|
if (newVersion && newVersion !== currentVersion) {
|
|
1848
6192
|
console.log(
|
|
1849
6193
|
`
|
|
1850
|
-
Update available! \`${name}\` ${
|
|
6194
|
+
Update available! \`${name}\` ${color.red(currentVersion)} \u2192 ${color.green(newVersion)}
|
|
1851
6195
|
`
|
|
1852
6196
|
);
|
|
1853
6197
|
}
|