@cleartrip/frontguard 0.1.1 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +3304 -233
- package/dist/cli.js.map +1 -1
- package/dist/index.js +55 -3
- package/dist/index.js.map +1 -1
- package/package.json +7 -8
package/dist/cli.js
CHANGED
|
@@ -1,17 +1,2403 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
2
|
+
import { formatWithOptions } from 'util';
|
|
3
|
+
import g, { stdin, stdout, cwd } from 'process';
|
|
4
|
+
import f from 'readline';
|
|
5
|
+
import * as tty from 'tty';
|
|
6
|
+
import { WriteStream } from 'tty';
|
|
7
|
+
import path, { sep, normalize, delimiter, resolve, dirname } from 'path';
|
|
4
8
|
import fs from 'fs/promises';
|
|
5
|
-
import path from 'path';
|
|
6
|
-
import { fetch } from 'undici';
|
|
7
9
|
import { createRequire } from 'module';
|
|
8
10
|
import fs4 from 'fs';
|
|
9
11
|
import { pathToFileURL } from 'url';
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
+
import { spawn } from 'child_process';
|
|
13
|
+
import { pipeline } from 'stream/promises';
|
|
14
|
+
import { PassThrough } from 'stream';
|
|
12
15
|
import fg from 'fast-glob';
|
|
13
|
-
import pc from 'picocolors';
|
|
14
16
|
|
|
17
|
+
var __create = Object.create;
|
|
18
|
+
var __defProp = Object.defineProperty;
|
|
19
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
20
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
21
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
22
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
23
|
+
var __esm = (fn, res) => function __init() {
|
|
24
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
25
|
+
};
|
|
26
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
27
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
28
|
+
};
|
|
29
|
+
var __export = (target, all) => {
|
|
30
|
+
for (var name in all)
|
|
31
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
32
|
+
};
|
|
33
|
+
var __copyProps = (to, from, except, desc) => {
|
|
34
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
35
|
+
for (let key of __getOwnPropNames(from))
|
|
36
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
37
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
38
|
+
}
|
|
39
|
+
return to;
|
|
40
|
+
};
|
|
41
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
42
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
43
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
44
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
45
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
46
|
+
__defProp(target, "default", { value: mod, enumerable: true }) ,
|
|
47
|
+
mod
|
|
48
|
+
));
|
|
49
|
+
|
|
50
|
+
// node_modules/consola/dist/chunks/prompt.mjs
|
|
51
|
+
var prompt_exports = {};
|
|
52
|
+
__export(prompt_exports, {
|
|
53
|
+
kCancel: () => kCancel,
|
|
54
|
+
prompt: () => prompt
|
|
55
|
+
});
|
|
56
|
+
function getDefaultExportFromCjs(x3) {
|
|
57
|
+
return x3 && x3.__esModule && Object.prototype.hasOwnProperty.call(x3, "default") ? x3["default"] : x3;
|
|
58
|
+
}
|
|
59
|
+
function requireSrc() {
|
|
60
|
+
if (hasRequiredSrc) return src;
|
|
61
|
+
hasRequiredSrc = 1;
|
|
62
|
+
const ESC = "\x1B";
|
|
63
|
+
const CSI = `${ESC}[`;
|
|
64
|
+
const beep = "\x07";
|
|
65
|
+
const cursor = {
|
|
66
|
+
to(x3, y4) {
|
|
67
|
+
if (!y4) return `${CSI}${x3 + 1}G`;
|
|
68
|
+
return `${CSI}${y4 + 1};${x3 + 1}H`;
|
|
69
|
+
},
|
|
70
|
+
move(x3, y4) {
|
|
71
|
+
let ret = "";
|
|
72
|
+
if (x3 < 0) ret += `${CSI}${-x3}D`;
|
|
73
|
+
else if (x3 > 0) ret += `${CSI}${x3}C`;
|
|
74
|
+
if (y4 < 0) ret += `${CSI}${-y4}A`;
|
|
75
|
+
else if (y4 > 0) ret += `${CSI}${y4}B`;
|
|
76
|
+
return ret;
|
|
77
|
+
},
|
|
78
|
+
up: (count = 1) => `${CSI}${count}A`,
|
|
79
|
+
down: (count = 1) => `${CSI}${count}B`,
|
|
80
|
+
forward: (count = 1) => `${CSI}${count}C`,
|
|
81
|
+
backward: (count = 1) => `${CSI}${count}D`,
|
|
82
|
+
nextLine: (count = 1) => `${CSI}E`.repeat(count),
|
|
83
|
+
prevLine: (count = 1) => `${CSI}F`.repeat(count),
|
|
84
|
+
left: `${CSI}G`,
|
|
85
|
+
hide: `${CSI}?25l`,
|
|
86
|
+
show: `${CSI}?25h`,
|
|
87
|
+
save: `${ESC}7`,
|
|
88
|
+
restore: `${ESC}8`
|
|
89
|
+
};
|
|
90
|
+
const scroll = {
|
|
91
|
+
up: (count = 1) => `${CSI}S`.repeat(count),
|
|
92
|
+
down: (count = 1) => `${CSI}T`.repeat(count)
|
|
93
|
+
};
|
|
94
|
+
const erase = {
|
|
95
|
+
screen: `${CSI}2J`,
|
|
96
|
+
up: (count = 1) => `${CSI}1J`.repeat(count),
|
|
97
|
+
down: (count = 1) => `${CSI}J`.repeat(count),
|
|
98
|
+
line: `${CSI}2K`,
|
|
99
|
+
lineEnd: `${CSI}K`,
|
|
100
|
+
lineStart: `${CSI}1K`,
|
|
101
|
+
lines(count) {
|
|
102
|
+
let clear = "";
|
|
103
|
+
for (let i3 = 0; i3 < count; i3++)
|
|
104
|
+
clear += this.line + (i3 < count - 1 ? cursor.up() : "");
|
|
105
|
+
if (count)
|
|
106
|
+
clear += cursor.left;
|
|
107
|
+
return clear;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
src = { cursor, scroll, erase, beep };
|
|
111
|
+
return src;
|
|
112
|
+
}
|
|
113
|
+
function requirePicocolors() {
|
|
114
|
+
if (hasRequiredPicocolors) return picocolors.exports;
|
|
115
|
+
hasRequiredPicocolors = 1;
|
|
116
|
+
let p2 = process || {}, argv2 = p2.argv || [], env2 = p2.env || {};
|
|
117
|
+
let isColorSupported2 = !(!!env2.NO_COLOR || argv2.includes("--no-color")) && (!!env2.FORCE_COLOR || argv2.includes("--color") || p2.platform === "win32" || (p2.stdout || {}).isTTY && env2.TERM !== "dumb" || !!env2.CI);
|
|
118
|
+
let formatter = (open, close, replace = open) => (input) => {
|
|
119
|
+
let string = "" + input, index = string.indexOf(close, open.length);
|
|
120
|
+
return ~index ? open + replaceClose2(string, close, replace, index) + close : open + string + close;
|
|
121
|
+
};
|
|
122
|
+
let replaceClose2 = (string, close, replace, index) => {
|
|
123
|
+
let result = "", cursor = 0;
|
|
124
|
+
do {
|
|
125
|
+
result += string.substring(cursor, index) + replace;
|
|
126
|
+
cursor = index + close.length;
|
|
127
|
+
index = string.indexOf(close, cursor);
|
|
128
|
+
} while (~index);
|
|
129
|
+
return result + string.substring(cursor);
|
|
130
|
+
};
|
|
131
|
+
let createColors2 = (enabled = isColorSupported2) => {
|
|
132
|
+
let f4 = enabled ? formatter : () => String;
|
|
133
|
+
return {
|
|
134
|
+
isColorSupported: enabled,
|
|
135
|
+
reset: f4("\x1B[0m", "\x1B[0m"),
|
|
136
|
+
bold: f4("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
137
|
+
dim: f4("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
138
|
+
italic: f4("\x1B[3m", "\x1B[23m"),
|
|
139
|
+
underline: f4("\x1B[4m", "\x1B[24m"),
|
|
140
|
+
inverse: f4("\x1B[7m", "\x1B[27m"),
|
|
141
|
+
hidden: f4("\x1B[8m", "\x1B[28m"),
|
|
142
|
+
strikethrough: f4("\x1B[9m", "\x1B[29m"),
|
|
143
|
+
black: f4("\x1B[30m", "\x1B[39m"),
|
|
144
|
+
red: f4("\x1B[31m", "\x1B[39m"),
|
|
145
|
+
green: f4("\x1B[32m", "\x1B[39m"),
|
|
146
|
+
yellow: f4("\x1B[33m", "\x1B[39m"),
|
|
147
|
+
blue: f4("\x1B[34m", "\x1B[39m"),
|
|
148
|
+
magenta: f4("\x1B[35m", "\x1B[39m"),
|
|
149
|
+
cyan: f4("\x1B[36m", "\x1B[39m"),
|
|
150
|
+
white: f4("\x1B[37m", "\x1B[39m"),
|
|
151
|
+
gray: f4("\x1B[90m", "\x1B[39m"),
|
|
152
|
+
bgBlack: f4("\x1B[40m", "\x1B[49m"),
|
|
153
|
+
bgRed: f4("\x1B[41m", "\x1B[49m"),
|
|
154
|
+
bgGreen: f4("\x1B[42m", "\x1B[49m"),
|
|
155
|
+
bgYellow: f4("\x1B[43m", "\x1B[49m"),
|
|
156
|
+
bgBlue: f4("\x1B[44m", "\x1B[49m"),
|
|
157
|
+
bgMagenta: f4("\x1B[45m", "\x1B[49m"),
|
|
158
|
+
bgCyan: f4("\x1B[46m", "\x1B[49m"),
|
|
159
|
+
bgWhite: f4("\x1B[47m", "\x1B[49m"),
|
|
160
|
+
blackBright: f4("\x1B[90m", "\x1B[39m"),
|
|
161
|
+
redBright: f4("\x1B[91m", "\x1B[39m"),
|
|
162
|
+
greenBright: f4("\x1B[92m", "\x1B[39m"),
|
|
163
|
+
yellowBright: f4("\x1B[93m", "\x1B[39m"),
|
|
164
|
+
blueBright: f4("\x1B[94m", "\x1B[39m"),
|
|
165
|
+
magentaBright: f4("\x1B[95m", "\x1B[39m"),
|
|
166
|
+
cyanBright: f4("\x1B[96m", "\x1B[39m"),
|
|
167
|
+
whiteBright: f4("\x1B[97m", "\x1B[39m"),
|
|
168
|
+
bgBlackBright: f4("\x1B[100m", "\x1B[49m"),
|
|
169
|
+
bgRedBright: f4("\x1B[101m", "\x1B[49m"),
|
|
170
|
+
bgGreenBright: f4("\x1B[102m", "\x1B[49m"),
|
|
171
|
+
bgYellowBright: f4("\x1B[103m", "\x1B[49m"),
|
|
172
|
+
bgBlueBright: f4("\x1B[104m", "\x1B[49m"),
|
|
173
|
+
bgMagentaBright: f4("\x1B[105m", "\x1B[49m"),
|
|
174
|
+
bgCyanBright: f4("\x1B[106m", "\x1B[49m"),
|
|
175
|
+
bgWhiteBright: f4("\x1B[107m", "\x1B[49m")
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
picocolors.exports = createColors2();
|
|
179
|
+
picocolors.exports.createColors = createColors2;
|
|
180
|
+
return picocolors.exports;
|
|
181
|
+
}
|
|
182
|
+
function J({ onlyFirst: t3 = false } = {}) {
|
|
183
|
+
const F4 = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
|
|
184
|
+
return new RegExp(F4, t3 ? void 0 : "g");
|
|
185
|
+
}
|
|
186
|
+
function T$1(t3) {
|
|
187
|
+
if (typeof t3 != "string") throw new TypeError(`Expected a \`string\`, got \`${typeof t3}\``);
|
|
188
|
+
return t3.replace(Q, "");
|
|
189
|
+
}
|
|
190
|
+
function O(t3) {
|
|
191
|
+
return t3 && t3.__esModule && Object.prototype.hasOwnProperty.call(t3, "default") ? t3.default : t3;
|
|
192
|
+
}
|
|
193
|
+
function A$1(t3, u4 = {}) {
|
|
194
|
+
if (typeof t3 != "string" || t3.length === 0 || (u4 = { ambiguousIsNarrow: true, ...u4 }, t3 = T$1(t3), t3.length === 0)) return 0;
|
|
195
|
+
t3 = t3.replace(FD(), " ");
|
|
196
|
+
const F4 = u4.ambiguousIsNarrow ? 1 : 2;
|
|
197
|
+
let e3 = 0;
|
|
198
|
+
for (const s3 of t3) {
|
|
199
|
+
const i3 = s3.codePointAt(0);
|
|
200
|
+
if (i3 <= 31 || i3 >= 127 && i3 <= 159 || i3 >= 768 && i3 <= 879) continue;
|
|
201
|
+
switch (DD.eastAsianWidth(s3)) {
|
|
202
|
+
case "F":
|
|
203
|
+
case "W":
|
|
204
|
+
e3 += 2;
|
|
205
|
+
break;
|
|
206
|
+
case "A":
|
|
207
|
+
e3 += F4;
|
|
208
|
+
break;
|
|
209
|
+
default:
|
|
210
|
+
e3 += 1;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
return e3;
|
|
214
|
+
}
|
|
215
|
+
function sD() {
|
|
216
|
+
const t3 = /* @__PURE__ */ new Map();
|
|
217
|
+
for (const [u4, F4] of Object.entries(r)) {
|
|
218
|
+
for (const [e3, s3] of Object.entries(F4)) r[e3] = { open: `\x1B[${s3[0]}m`, close: `\x1B[${s3[1]}m` }, F4[e3] = r[e3], t3.set(s3[0], s3[1]);
|
|
219
|
+
Object.defineProperty(r, u4, { value: F4, enumerable: false });
|
|
220
|
+
}
|
|
221
|
+
return Object.defineProperty(r, "codes", { value: t3, enumerable: false }), r.color.close = "\x1B[39m", r.bgColor.close = "\x1B[49m", r.color.ansi = L$1(), r.color.ansi256 = N(), r.color.ansi16m = I(), r.bgColor.ansi = L$1(m), r.bgColor.ansi256 = N(m), r.bgColor.ansi16m = I(m), Object.defineProperties(r, { rgbToAnsi256: { value: (u4, F4, e3) => u4 === F4 && F4 === e3 ? u4 < 8 ? 16 : u4 > 248 ? 231 : Math.round((u4 - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(u4 / 255 * 5) + 6 * Math.round(F4 / 255 * 5) + Math.round(e3 / 255 * 5), enumerable: false }, hexToRgb: { value: (u4) => {
|
|
222
|
+
const F4 = /[a-f\d]{6}|[a-f\d]{3}/i.exec(u4.toString(16));
|
|
223
|
+
if (!F4) return [0, 0, 0];
|
|
224
|
+
let [e3] = F4;
|
|
225
|
+
e3.length === 3 && (e3 = [...e3].map((i3) => i3 + i3).join(""));
|
|
226
|
+
const s3 = Number.parseInt(e3, 16);
|
|
227
|
+
return [s3 >> 16 & 255, s3 >> 8 & 255, s3 & 255];
|
|
228
|
+
}, enumerable: false }, hexToAnsi256: { value: (u4) => r.rgbToAnsi256(...r.hexToRgb(u4)), enumerable: false }, ansi256ToAnsi: { value: (u4) => {
|
|
229
|
+
if (u4 < 8) return 30 + u4;
|
|
230
|
+
if (u4 < 16) return 90 + (u4 - 8);
|
|
231
|
+
let F4, e3, s3;
|
|
232
|
+
if (u4 >= 232) F4 = ((u4 - 232) * 10 + 8) / 255, e3 = F4, s3 = F4;
|
|
233
|
+
else {
|
|
234
|
+
u4 -= 16;
|
|
235
|
+
const C4 = u4 % 36;
|
|
236
|
+
F4 = Math.floor(u4 / 36) / 5, e3 = Math.floor(C4 / 6) / 5, s3 = C4 % 6 / 5;
|
|
237
|
+
}
|
|
238
|
+
const i3 = Math.max(F4, e3, s3) * 2;
|
|
239
|
+
if (i3 === 0) return 30;
|
|
240
|
+
let D3 = 30 + (Math.round(s3) << 2 | Math.round(e3) << 1 | Math.round(F4));
|
|
241
|
+
return i3 === 2 && (D3 += 60), D3;
|
|
242
|
+
}, enumerable: false }, rgbToAnsi: { value: (u4, F4, e3) => r.ansi256ToAnsi(r.rgbToAnsi256(u4, F4, e3)), enumerable: false }, hexToAnsi: { value: (u4) => r.ansi256ToAnsi(r.hexToAnsi256(u4)), enumerable: false } }), r;
|
|
243
|
+
}
|
|
244
|
+
function G(t3, u4, F4) {
|
|
245
|
+
return String(t3).normalize().replace(/\r\n/g, `
|
|
246
|
+
`).split(`
|
|
247
|
+
`).map((e3) => oD(e3, u4, F4)).join(`
|
|
248
|
+
`);
|
|
249
|
+
}
|
|
250
|
+
function k$1(t3, u4) {
|
|
251
|
+
if (typeof t3 == "string") return c.aliases.get(t3) === u4;
|
|
252
|
+
for (const F4 of t3) if (F4 !== void 0 && k$1(F4, u4)) return true;
|
|
253
|
+
return false;
|
|
254
|
+
}
|
|
255
|
+
function lD(t3, u4) {
|
|
256
|
+
if (t3 === u4) return;
|
|
257
|
+
const F4 = t3.split(`
|
|
258
|
+
`), e3 = u4.split(`
|
|
259
|
+
`), s3 = [];
|
|
260
|
+
for (let i3 = 0; i3 < Math.max(F4.length, e3.length); i3++) F4[i3] !== e3[i3] && s3.push(i3);
|
|
261
|
+
return s3;
|
|
262
|
+
}
|
|
263
|
+
function d$1(t3, u4) {
|
|
264
|
+
const F4 = t3;
|
|
265
|
+
F4.isTTY && F4.setRawMode(u4);
|
|
266
|
+
}
|
|
267
|
+
function ce() {
|
|
268
|
+
return g.platform !== "win32" ? g.env.TERM !== "linux" : !!g.env.CI || !!g.env.WT_SESSION || !!g.env.TERMINUS_SUBLIME || g.env.ConEmuTask === "{cmd::Cmder}" || g.env.TERM_PROGRAM === "Terminus-Sublime" || g.env.TERM_PROGRAM === "vscode" || g.env.TERM === "xterm-256color" || g.env.TERM === "alacritty" || g.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
269
|
+
}
|
|
270
|
+
async function prompt(message, opts = {}) {
|
|
271
|
+
const handleCancel = (value) => {
|
|
272
|
+
if (typeof value !== "symbol" || value.toString() !== "Symbol(clack:cancel)") {
|
|
273
|
+
return value;
|
|
274
|
+
}
|
|
275
|
+
switch (opts.cancel) {
|
|
276
|
+
case "reject": {
|
|
277
|
+
const error = new Error("Prompt cancelled.");
|
|
278
|
+
error.name = "ConsolaPromptCancelledError";
|
|
279
|
+
if (Error.captureStackTrace) {
|
|
280
|
+
Error.captureStackTrace(error, prompt);
|
|
281
|
+
}
|
|
282
|
+
throw error;
|
|
283
|
+
}
|
|
284
|
+
case "undefined": {
|
|
285
|
+
return void 0;
|
|
286
|
+
}
|
|
287
|
+
case "null": {
|
|
288
|
+
return null;
|
|
289
|
+
}
|
|
290
|
+
case "symbol": {
|
|
291
|
+
return kCancel;
|
|
292
|
+
}
|
|
293
|
+
default:
|
|
294
|
+
case "default": {
|
|
295
|
+
return opts.default ?? opts.initial;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
if (!opts.type || opts.type === "text") {
|
|
300
|
+
return await he({
|
|
301
|
+
message,
|
|
302
|
+
defaultValue: opts.default,
|
|
303
|
+
placeholder: opts.placeholder,
|
|
304
|
+
initialValue: opts.initial
|
|
305
|
+
}).then(handleCancel);
|
|
306
|
+
}
|
|
307
|
+
if (opts.type === "confirm") {
|
|
308
|
+
return await ye({
|
|
309
|
+
message,
|
|
310
|
+
initialValue: opts.initial
|
|
311
|
+
}).then(handleCancel);
|
|
312
|
+
}
|
|
313
|
+
if (opts.type === "select") {
|
|
314
|
+
return await ve({
|
|
315
|
+
message,
|
|
316
|
+
options: opts.options.map(
|
|
317
|
+
(o4) => typeof o4 === "string" ? { value: o4, label: o4 } : o4
|
|
318
|
+
),
|
|
319
|
+
initialValue: opts.initial
|
|
320
|
+
}).then(handleCancel);
|
|
321
|
+
}
|
|
322
|
+
if (opts.type === "multiselect") {
|
|
323
|
+
return await fe({
|
|
324
|
+
message,
|
|
325
|
+
options: opts.options.map(
|
|
326
|
+
(o4) => typeof o4 === "string" ? { value: o4, label: o4 } : o4
|
|
327
|
+
),
|
|
328
|
+
required: opts.required,
|
|
329
|
+
initialValues: opts.initial
|
|
330
|
+
}).then(handleCancel);
|
|
331
|
+
}
|
|
332
|
+
throw new Error(`Unknown prompt type: ${opts.type}`);
|
|
333
|
+
}
|
|
334
|
+
var src, hasRequiredSrc, srcExports, picocolors, hasRequiredPicocolors, picocolorsExports, e, Q, P$1, X, DD, uD, FD, m, L$1, N, I, r, tD, eD, iD, v, CD, w$1, W$1, rD, R, y, V$1, z, ED, _, nD, oD, aD, c, S, AD, pD, h, x, fD, bD, mD, Y, wD, SD, $D, q, jD, PD, V, u, le, L, W, C, o, d, k, P, A, T, F, w, B, he, ye, ve, fe, kCancel;
|
|
335
|
+
var init_prompt = __esm({
|
|
336
|
+
"node_modules/consola/dist/chunks/prompt.mjs"() {
|
|
337
|
+
srcExports = requireSrc();
|
|
338
|
+
picocolors = { exports: {} };
|
|
339
|
+
picocolorsExports = /* @__PURE__ */ requirePicocolors();
|
|
340
|
+
e = /* @__PURE__ */ getDefaultExportFromCjs(picocolorsExports);
|
|
341
|
+
Q = J();
|
|
342
|
+
P$1 = { exports: {} };
|
|
343
|
+
(function(t3) {
|
|
344
|
+
var u4 = {};
|
|
345
|
+
t3.exports = u4, u4.eastAsianWidth = function(e3) {
|
|
346
|
+
var s3 = e3.charCodeAt(0), i3 = e3.length == 2 ? e3.charCodeAt(1) : 0, D3 = s3;
|
|
347
|
+
return 55296 <= s3 && s3 <= 56319 && 56320 <= i3 && i3 <= 57343 && (s3 &= 1023, i3 &= 1023, D3 = s3 << 10 | i3, D3 += 65536), D3 == 12288 || 65281 <= D3 && D3 <= 65376 || 65504 <= D3 && D3 <= 65510 ? "F" : D3 == 8361 || 65377 <= D3 && D3 <= 65470 || 65474 <= D3 && D3 <= 65479 || 65482 <= D3 && D3 <= 65487 || 65490 <= D3 && D3 <= 65495 || 65498 <= D3 && D3 <= 65500 || 65512 <= D3 && D3 <= 65518 ? "H" : 4352 <= D3 && D3 <= 4447 || 4515 <= D3 && D3 <= 4519 || 4602 <= D3 && D3 <= 4607 || 9001 <= D3 && D3 <= 9002 || 11904 <= D3 && D3 <= 11929 || 11931 <= D3 && D3 <= 12019 || 12032 <= D3 && D3 <= 12245 || 12272 <= D3 && D3 <= 12283 || 12289 <= D3 && D3 <= 12350 || 12353 <= D3 && D3 <= 12438 || 12441 <= D3 && D3 <= 12543 || 12549 <= D3 && D3 <= 12589 || 12593 <= D3 && D3 <= 12686 || 12688 <= D3 && D3 <= 12730 || 12736 <= D3 && D3 <= 12771 || 12784 <= D3 && D3 <= 12830 || 12832 <= D3 && D3 <= 12871 || 12880 <= D3 && D3 <= 13054 || 13056 <= D3 && D3 <= 19903 || 19968 <= D3 && D3 <= 42124 || 42128 <= D3 && D3 <= 42182 || 43360 <= D3 && D3 <= 43388 || 44032 <= D3 && D3 <= 55203 || 55216 <= D3 && D3 <= 55238 || 55243 <= D3 && D3 <= 55291 || 63744 <= D3 && D3 <= 64255 || 65040 <= D3 && D3 <= 65049 || 65072 <= D3 && D3 <= 65106 || 65108 <= D3 && D3 <= 65126 || 65128 <= D3 && D3 <= 65131 || 110592 <= D3 && D3 <= 110593 || 127488 <= D3 && D3 <= 127490 || 127504 <= D3 && D3 <= 127546 || 127552 <= D3 && D3 <= 127560 || 127568 <= D3 && D3 <= 127569 || 131072 <= D3 && D3 <= 194367 || 177984 <= D3 && D3 <= 196605 || 196608 <= D3 && D3 <= 262141 ? "W" : 32 <= D3 && D3 <= 126 || 162 <= D3 && D3 <= 163 || 165 <= D3 && D3 <= 166 || D3 == 172 || D3 == 175 || 10214 <= D3 && D3 <= 10221 || 10629 <= D3 && D3 <= 10630 ? "Na" : D3 == 161 || D3 == 164 || 167 <= D3 && D3 <= 168 || D3 == 170 || 173 <= D3 && D3 <= 174 || 176 <= D3 && D3 <= 180 || 182 <= D3 && D3 <= 186 || 188 <= D3 && D3 <= 191 || D3 == 198 || D3 == 208 || 215 <= D3 && D3 <= 216 || 222 <= D3 && D3 <= 225 || D3 == 230 || 232 <= D3 && D3 <= 234 || 236 <= D3 && D3 <= 237 || D3 == 240 || 242 <= D3 && D3 <= 243 || 247 <= D3 && D3 <= 250 || D3 == 252 || D3 == 254 || D3 == 257 || D3 == 273 || D3 == 275 || D3 == 283 || 294 <= D3 && D3 <= 295 || D3 == 299 || 305 <= D3 && D3 <= 307 || D3 == 312 || 319 <= D3 && D3 <= 322 || D3 == 324 || 328 <= D3 && D3 <= 331 || D3 == 333 || 338 <= D3 && D3 <= 339 || 358 <= D3 && D3 <= 359 || D3 == 363 || D3 == 462 || D3 == 464 || D3 == 466 || D3 == 468 || D3 == 470 || D3 == 472 || D3 == 474 || D3 == 476 || D3 == 593 || D3 == 609 || D3 == 708 || D3 == 711 || 713 <= D3 && D3 <= 715 || D3 == 717 || D3 == 720 || 728 <= D3 && D3 <= 731 || D3 == 733 || D3 == 735 || 768 <= D3 && D3 <= 879 || 913 <= D3 && D3 <= 929 || 931 <= D3 && D3 <= 937 || 945 <= D3 && D3 <= 961 || 963 <= D3 && D3 <= 969 || D3 == 1025 || 1040 <= D3 && D3 <= 1103 || D3 == 1105 || D3 == 8208 || 8211 <= D3 && D3 <= 8214 || 8216 <= D3 && D3 <= 8217 || 8220 <= D3 && D3 <= 8221 || 8224 <= D3 && D3 <= 8226 || 8228 <= D3 && D3 <= 8231 || D3 == 8240 || 8242 <= D3 && D3 <= 8243 || D3 == 8245 || D3 == 8251 || D3 == 8254 || D3 == 8308 || D3 == 8319 || 8321 <= D3 && D3 <= 8324 || D3 == 8364 || D3 == 8451 || D3 == 8453 || D3 == 8457 || D3 == 8467 || D3 == 8470 || 8481 <= D3 && D3 <= 8482 || D3 == 8486 || D3 == 8491 || 8531 <= D3 && D3 <= 8532 || 8539 <= D3 && D3 <= 8542 || 8544 <= D3 && D3 <= 8555 || 8560 <= D3 && D3 <= 8569 || D3 == 8585 || 8592 <= D3 && D3 <= 8601 || 8632 <= D3 && D3 <= 8633 || D3 == 8658 || D3 == 8660 || D3 == 8679 || D3 == 8704 || 8706 <= D3 && D3 <= 8707 || 8711 <= D3 && D3 <= 8712 || D3 == 8715 || D3 == 8719 || D3 == 8721 || D3 == 8725 || D3 == 8730 || 8733 <= D3 && D3 <= 8736 || D3 == 8739 || D3 == 8741 || 8743 <= D3 && D3 <= 8748 || D3 == 8750 || 8756 <= D3 && D3 <= 8759 || 8764 <= D3 && D3 <= 8765 || D3 == 8776 || D3 == 8780 || D3 == 8786 || 8800 <= D3 && D3 <= 8801 || 8804 <= D3 && D3 <= 8807 || 8810 <= D3 && D3 <= 8811 || 8814 <= D3 && D3 <= 8815 || 8834 <= D3 && D3 <= 8835 || 8838 <= D3 && D3 <= 8839 || D3 == 8853 || D3 == 8857 || D3 == 8869 || D3 == 8895 || D3 == 8978 || 9312 <= D3 && D3 <= 9449 || 9451 <= D3 && D3 <= 9547 || 9552 <= D3 && D3 <= 9587 || 9600 <= D3 && D3 <= 9615 || 9618 <= D3 && D3 <= 9621 || 9632 <= D3 && D3 <= 9633 || 9635 <= D3 && D3 <= 9641 || 9650 <= D3 && D3 <= 9651 || 9654 <= D3 && D3 <= 9655 || 9660 <= D3 && D3 <= 9661 || 9664 <= D3 && D3 <= 9665 || 9670 <= D3 && D3 <= 9672 || D3 == 9675 || 9678 <= D3 && D3 <= 9681 || 9698 <= D3 && D3 <= 9701 || D3 == 9711 || 9733 <= D3 && D3 <= 9734 || D3 == 9737 || 9742 <= D3 && D3 <= 9743 || 9748 <= D3 && D3 <= 9749 || D3 == 9756 || D3 == 9758 || D3 == 9792 || D3 == 9794 || 9824 <= D3 && D3 <= 9825 || 9827 <= D3 && D3 <= 9829 || 9831 <= D3 && D3 <= 9834 || 9836 <= D3 && D3 <= 9837 || D3 == 9839 || 9886 <= D3 && D3 <= 9887 || 9918 <= D3 && D3 <= 9919 || 9924 <= D3 && D3 <= 9933 || 9935 <= D3 && D3 <= 9953 || D3 == 9955 || 9960 <= D3 && D3 <= 9983 || D3 == 10045 || D3 == 10071 || 10102 <= D3 && D3 <= 10111 || 11093 <= D3 && D3 <= 11097 || 12872 <= D3 && D3 <= 12879 || 57344 <= D3 && D3 <= 63743 || 65024 <= D3 && D3 <= 65039 || D3 == 65533 || 127232 <= D3 && D3 <= 127242 || 127248 <= D3 && D3 <= 127277 || 127280 <= D3 && D3 <= 127337 || 127344 <= D3 && D3 <= 127386 || 917760 <= D3 && D3 <= 917999 || 983040 <= D3 && D3 <= 1048573 || 1048576 <= D3 && D3 <= 1114109 ? "A" : "N";
|
|
348
|
+
}, u4.characterLength = function(e3) {
|
|
349
|
+
var s3 = this.eastAsianWidth(e3);
|
|
350
|
+
return s3 == "F" || s3 == "W" || s3 == "A" ? 2 : 1;
|
|
351
|
+
};
|
|
352
|
+
function F4(e3) {
|
|
353
|
+
return e3.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
|
|
354
|
+
}
|
|
355
|
+
u4.length = function(e3) {
|
|
356
|
+
for (var s3 = F4(e3), i3 = 0, D3 = 0; D3 < s3.length; D3++) i3 = i3 + this.characterLength(s3[D3]);
|
|
357
|
+
return i3;
|
|
358
|
+
}, u4.slice = function(e3, s3, i3) {
|
|
359
|
+
textLen = u4.length(e3), s3 = s3 || 0, i3 = i3 || 1, s3 < 0 && (s3 = textLen + s3), i3 < 0 && (i3 = textLen + i3);
|
|
360
|
+
for (var D3 = "", C4 = 0, o4 = F4(e3), E2 = 0; E2 < o4.length; E2++) {
|
|
361
|
+
var a3 = o4[E2], n3 = u4.length(a3);
|
|
362
|
+
if (C4 >= s3 - (n3 == 2 ? 1 : 0)) if (C4 + n3 <= i3) D3 += a3;
|
|
363
|
+
else break;
|
|
364
|
+
C4 += n3;
|
|
365
|
+
}
|
|
366
|
+
return D3;
|
|
367
|
+
};
|
|
368
|
+
})(P$1);
|
|
369
|
+
X = P$1.exports;
|
|
370
|
+
DD = O(X);
|
|
371
|
+
uD = function() {
|
|
372
|
+
return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\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|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\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]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\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-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
|
|
373
|
+
};
|
|
374
|
+
FD = O(uD);
|
|
375
|
+
m = 10;
|
|
376
|
+
L$1 = (t3 = 0) => (u4) => `\x1B[${u4 + t3}m`;
|
|
377
|
+
N = (t3 = 0) => (u4) => `\x1B[${38 + t3};5;${u4}m`;
|
|
378
|
+
I = (t3 = 0) => (u4, F4, e3) => `\x1B[${38 + t3};2;${u4};${F4};${e3}m`;
|
|
379
|
+
r = { modifier: { reset: [0, 0], bold: [1, 22], dim: [2, 22], italic: [3, 23], underline: [4, 24], overline: [53, 55], inverse: [7, 27], hidden: [8, 28], strikethrough: [9, 29] }, color: { black: [30, 39], red: [31, 39], green: [32, 39], yellow: [33, 39], blue: [34, 39], magenta: [35, 39], cyan: [36, 39], white: [37, 39], blackBright: [90, 39], gray: [90, 39], grey: [90, 39], redBright: [91, 39], greenBright: [92, 39], yellowBright: [93, 39], blueBright: [94, 39], magentaBright: [95, 39], cyanBright: [96, 39], whiteBright: [97, 39] }, bgColor: { bgBlack: [40, 49], bgRed: [41, 49], bgGreen: [42, 49], bgYellow: [43, 49], bgBlue: [44, 49], bgMagenta: [45, 49], bgCyan: [46, 49], bgWhite: [47, 49], bgBlackBright: [100, 49], bgGray: [100, 49], bgGrey: [100, 49], bgRedBright: [101, 49], bgGreenBright: [102, 49], bgYellowBright: [103, 49], bgBlueBright: [104, 49], bgMagentaBright: [105, 49], bgCyanBright: [106, 49], bgWhiteBright: [107, 49] } };
|
|
380
|
+
Object.keys(r.modifier);
|
|
381
|
+
tD = Object.keys(r.color);
|
|
382
|
+
eD = Object.keys(r.bgColor);
|
|
383
|
+
[...tD, ...eD];
|
|
384
|
+
iD = sD();
|
|
385
|
+
v = /* @__PURE__ */ new Set(["\x1B", "\x9B"]);
|
|
386
|
+
CD = 39;
|
|
387
|
+
w$1 = "\x07";
|
|
388
|
+
W$1 = "[";
|
|
389
|
+
rD = "]";
|
|
390
|
+
R = "m";
|
|
391
|
+
y = `${rD}8;;`;
|
|
392
|
+
V$1 = (t3) => `${v.values().next().value}${W$1}${t3}${R}`;
|
|
393
|
+
z = (t3) => `${v.values().next().value}${y}${t3}${w$1}`;
|
|
394
|
+
ED = (t3) => t3.split(" ").map((u4) => A$1(u4));
|
|
395
|
+
_ = (t3, u4, F4) => {
|
|
396
|
+
const e3 = [...u4];
|
|
397
|
+
let s3 = false, i3 = false, D3 = A$1(T$1(t3[t3.length - 1]));
|
|
398
|
+
for (const [C4, o4] of e3.entries()) {
|
|
399
|
+
const E2 = A$1(o4);
|
|
400
|
+
if (D3 + E2 <= F4 ? t3[t3.length - 1] += o4 : (t3.push(o4), D3 = 0), v.has(o4) && (s3 = true, i3 = e3.slice(C4 + 1).join("").startsWith(y)), s3) {
|
|
401
|
+
i3 ? o4 === w$1 && (s3 = false, i3 = false) : o4 === R && (s3 = false);
|
|
402
|
+
continue;
|
|
403
|
+
}
|
|
404
|
+
D3 += E2, D3 === F4 && C4 < e3.length - 1 && (t3.push(""), D3 = 0);
|
|
405
|
+
}
|
|
406
|
+
!D3 && t3[t3.length - 1].length > 0 && t3.length > 1 && (t3[t3.length - 2] += t3.pop());
|
|
407
|
+
};
|
|
408
|
+
nD = (t3) => {
|
|
409
|
+
const u4 = t3.split(" ");
|
|
410
|
+
let F4 = u4.length;
|
|
411
|
+
for (; F4 > 0 && !(A$1(u4[F4 - 1]) > 0); ) F4--;
|
|
412
|
+
return F4 === u4.length ? t3 : u4.slice(0, F4).join(" ") + u4.slice(F4).join("");
|
|
413
|
+
};
|
|
414
|
+
oD = (t3, u4, F4 = {}) => {
|
|
415
|
+
if (F4.trim !== false && t3.trim() === "") return "";
|
|
416
|
+
let e3 = "", s3, i3;
|
|
417
|
+
const D3 = ED(t3);
|
|
418
|
+
let C4 = [""];
|
|
419
|
+
for (const [E2, a3] of t3.split(" ").entries()) {
|
|
420
|
+
F4.trim !== false && (C4[C4.length - 1] = C4[C4.length - 1].trimStart());
|
|
421
|
+
let n3 = A$1(C4[C4.length - 1]);
|
|
422
|
+
if (E2 !== 0 && (n3 >= u4 && (F4.wordWrap === false || F4.trim === false) && (C4.push(""), n3 = 0), (n3 > 0 || F4.trim === false) && (C4[C4.length - 1] += " ", n3++)), F4.hard && D3[E2] > u4) {
|
|
423
|
+
const B3 = u4 - n3, p2 = 1 + Math.floor((D3[E2] - B3 - 1) / u4);
|
|
424
|
+
Math.floor((D3[E2] - 1) / u4) < p2 && C4.push(""), _(C4, a3, u4);
|
|
425
|
+
continue;
|
|
426
|
+
}
|
|
427
|
+
if (n3 + D3[E2] > u4 && n3 > 0 && D3[E2] > 0) {
|
|
428
|
+
if (F4.wordWrap === false && n3 < u4) {
|
|
429
|
+
_(C4, a3, u4);
|
|
430
|
+
continue;
|
|
431
|
+
}
|
|
432
|
+
C4.push("");
|
|
433
|
+
}
|
|
434
|
+
if (n3 + D3[E2] > u4 && F4.wordWrap === false) {
|
|
435
|
+
_(C4, a3, u4);
|
|
436
|
+
continue;
|
|
437
|
+
}
|
|
438
|
+
C4[C4.length - 1] += a3;
|
|
439
|
+
}
|
|
440
|
+
F4.trim !== false && (C4 = C4.map((E2) => nD(E2)));
|
|
441
|
+
const o4 = [...C4.join(`
|
|
442
|
+
`)];
|
|
443
|
+
for (const [E2, a3] of o4.entries()) {
|
|
444
|
+
if (e3 += a3, v.has(a3)) {
|
|
445
|
+
const { groups: B3 } = new RegExp(`(?:\\${W$1}(?<code>\\d+)m|\\${y}(?<uri>.*)${w$1})`).exec(o4.slice(E2).join("")) || { groups: {} };
|
|
446
|
+
if (B3.code !== void 0) {
|
|
447
|
+
const p2 = Number.parseFloat(B3.code);
|
|
448
|
+
s3 = p2 === CD ? void 0 : p2;
|
|
449
|
+
} else B3.uri !== void 0 && (i3 = B3.uri.length === 0 ? void 0 : B3.uri);
|
|
450
|
+
}
|
|
451
|
+
const n3 = iD.codes.get(Number(s3));
|
|
452
|
+
o4[E2 + 1] === `
|
|
453
|
+
` ? (i3 && (e3 += z("")), s3 && n3 && (e3 += V$1(n3))) : a3 === `
|
|
454
|
+
` && (s3 && n3 && (e3 += V$1(s3)), i3 && (e3 += z(i3)));
|
|
455
|
+
}
|
|
456
|
+
return e3;
|
|
457
|
+
};
|
|
458
|
+
aD = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
459
|
+
c = { actions: new Set(aD), aliases: /* @__PURE__ */ new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["", "cancel"], ["escape", "cancel"]]) };
|
|
460
|
+
globalThis.process.platform.startsWith("win");
|
|
461
|
+
S = /* @__PURE__ */ Symbol("clack:cancel");
|
|
462
|
+
AD = Object.defineProperty;
|
|
463
|
+
pD = (t3, u4, F4) => u4 in t3 ? AD(t3, u4, { enumerable: true, configurable: true, writable: true, value: F4 }) : t3[u4] = F4;
|
|
464
|
+
h = (t3, u4, F4) => (pD(t3, typeof u4 != "symbol" ? u4 + "" : u4, F4), F4);
|
|
465
|
+
x = class {
|
|
466
|
+
constructor(u4, F4 = true) {
|
|
467
|
+
h(this, "input"), h(this, "output"), h(this, "_abortSignal"), h(this, "rl"), h(this, "opts"), h(this, "_render"), h(this, "_track", false), h(this, "_prevFrame", ""), h(this, "_subscribers", /* @__PURE__ */ new Map()), h(this, "_cursor", 0), h(this, "state", "initial"), h(this, "error", ""), h(this, "value");
|
|
468
|
+
const { input: e3 = stdin, output: s3 = stdout, render: i3, signal: D3, ...C4 } = u4;
|
|
469
|
+
this.opts = C4, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = i3.bind(this), this._track = F4, this._abortSignal = D3, this.input = e3, this.output = s3;
|
|
470
|
+
}
|
|
471
|
+
unsubscribe() {
|
|
472
|
+
this._subscribers.clear();
|
|
473
|
+
}
|
|
474
|
+
setSubscriber(u4, F4) {
|
|
475
|
+
const e3 = this._subscribers.get(u4) ?? [];
|
|
476
|
+
e3.push(F4), this._subscribers.set(u4, e3);
|
|
477
|
+
}
|
|
478
|
+
on(u4, F4) {
|
|
479
|
+
this.setSubscriber(u4, { cb: F4 });
|
|
480
|
+
}
|
|
481
|
+
once(u4, F4) {
|
|
482
|
+
this.setSubscriber(u4, { cb: F4, once: true });
|
|
483
|
+
}
|
|
484
|
+
emit(u4, ...F4) {
|
|
485
|
+
const e3 = this._subscribers.get(u4) ?? [], s3 = [];
|
|
486
|
+
for (const i3 of e3) i3.cb(...F4), i3.once && s3.push(() => e3.splice(e3.indexOf(i3), 1));
|
|
487
|
+
for (const i3 of s3) i3();
|
|
488
|
+
}
|
|
489
|
+
prompt() {
|
|
490
|
+
return new Promise((u4, F4) => {
|
|
491
|
+
if (this._abortSignal) {
|
|
492
|
+
if (this._abortSignal.aborted) return this.state = "cancel", this.close(), u4(S);
|
|
493
|
+
this._abortSignal.addEventListener("abort", () => {
|
|
494
|
+
this.state = "cancel", this.close();
|
|
495
|
+
}, { once: true });
|
|
496
|
+
}
|
|
497
|
+
const e3 = new WriteStream(0);
|
|
498
|
+
e3._write = (s3, i3, D3) => {
|
|
499
|
+
this._track && (this.value = this.rl?.line.replace(/\t/g, ""), this._cursor = this.rl?.cursor ?? 0, this.emit("value", this.value)), D3();
|
|
500
|
+
}, this.input.pipe(e3), this.rl = f.createInterface({ input: this.input, output: e3, tabSize: 2, prompt: "", escapeCodeTimeout: 50 }), f.emitKeypressEvents(this.input, this.rl), this.rl.prompt(), this.opts.initialValue !== void 0 && this._track && this.rl.write(this.opts.initialValue), this.input.on("keypress", this.onKeypress), d$1(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
501
|
+
this.output.write(srcExports.cursor.show), this.output.off("resize", this.render), d$1(this.input, false), u4(this.value);
|
|
502
|
+
}), this.once("cancel", () => {
|
|
503
|
+
this.output.write(srcExports.cursor.show), this.output.off("resize", this.render), d$1(this.input, false), u4(S);
|
|
504
|
+
});
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
onKeypress(u4, F4) {
|
|
508
|
+
if (this.state === "error" && (this.state = "active"), F4?.name && (!this._track && c.aliases.has(F4.name) && this.emit("cursor", c.aliases.get(F4.name)), c.actions.has(F4.name) && this.emit("cursor", F4.name)), u4 && (u4.toLowerCase() === "y" || u4.toLowerCase() === "n") && this.emit("confirm", u4.toLowerCase() === "y"), u4 === " " && this.opts.placeholder && (this.value || (this.rl?.write(this.opts.placeholder), this.emit("value", this.opts.placeholder))), u4 && this.emit("key", u4.toLowerCase()), F4?.name === "return") {
|
|
509
|
+
if (this.opts.validate) {
|
|
510
|
+
const e3 = this.opts.validate(this.value);
|
|
511
|
+
e3 && (this.error = e3 instanceof Error ? e3.message : e3, this.state = "error", this.rl?.write(this.value));
|
|
512
|
+
}
|
|
513
|
+
this.state !== "error" && (this.state = "submit");
|
|
514
|
+
}
|
|
515
|
+
k$1([u4, F4?.name, F4?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
516
|
+
}
|
|
517
|
+
close() {
|
|
518
|
+
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
519
|
+
`), d$1(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
520
|
+
}
|
|
521
|
+
restoreCursor() {
|
|
522
|
+
const u4 = G(this._prevFrame, process.stdout.columns, { hard: true }).split(`
|
|
523
|
+
`).length - 1;
|
|
524
|
+
this.output.write(srcExports.cursor.move(-999, u4 * -1));
|
|
525
|
+
}
|
|
526
|
+
render() {
|
|
527
|
+
const u4 = G(this._render(this) ?? "", process.stdout.columns, { hard: true });
|
|
528
|
+
if (u4 !== this._prevFrame) {
|
|
529
|
+
if (this.state === "initial") this.output.write(srcExports.cursor.hide);
|
|
530
|
+
else {
|
|
531
|
+
const F4 = lD(this._prevFrame, u4);
|
|
532
|
+
if (this.restoreCursor(), F4 && F4?.length === 1) {
|
|
533
|
+
const e3 = F4[0];
|
|
534
|
+
this.output.write(srcExports.cursor.move(0, e3)), this.output.write(srcExports.erase.lines(1));
|
|
535
|
+
const s3 = u4.split(`
|
|
536
|
+
`);
|
|
537
|
+
this.output.write(s3[e3]), this._prevFrame = u4, this.output.write(srcExports.cursor.move(0, s3.length - e3 - 1));
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
if (F4 && F4?.length > 1) {
|
|
541
|
+
const e3 = F4[0];
|
|
542
|
+
this.output.write(srcExports.cursor.move(0, e3)), this.output.write(srcExports.erase.down());
|
|
543
|
+
const s3 = u4.split(`
|
|
544
|
+
`).slice(e3);
|
|
545
|
+
this.output.write(s3.join(`
|
|
546
|
+
`)), this._prevFrame = u4;
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
this.output.write(srcExports.erase.down());
|
|
550
|
+
}
|
|
551
|
+
this.output.write(u4), this.state === "initial" && (this.state = "active"), this._prevFrame = u4;
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
};
|
|
555
|
+
fD = class extends x {
|
|
556
|
+
get cursor() {
|
|
557
|
+
return this.value ? 0 : 1;
|
|
558
|
+
}
|
|
559
|
+
get _value() {
|
|
560
|
+
return this.cursor === 0;
|
|
561
|
+
}
|
|
562
|
+
constructor(u4) {
|
|
563
|
+
super(u4, false), this.value = !!u4.initialValue, this.on("value", () => {
|
|
564
|
+
this.value = this._value;
|
|
565
|
+
}), this.on("confirm", (F4) => {
|
|
566
|
+
this.output.write(srcExports.cursor.move(0, -1)), this.value = F4, this.state = "submit", this.close();
|
|
567
|
+
}), this.on("cursor", () => {
|
|
568
|
+
this.value = !this.value;
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
};
|
|
572
|
+
bD = Object.defineProperty;
|
|
573
|
+
mD = (t3, u4, F4) => u4 in t3 ? bD(t3, u4, { enumerable: true, configurable: true, writable: true, value: F4 }) : t3[u4] = F4;
|
|
574
|
+
Y = (t3, u4, F4) => (mD(t3, typeof u4 != "symbol" ? u4 + "" : u4, F4), F4);
|
|
575
|
+
wD = class extends x {
|
|
576
|
+
constructor(u4) {
|
|
577
|
+
super(u4, false), Y(this, "options"), Y(this, "cursor", 0), this.options = u4.options, this.value = [...u4.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: F4 }) => F4 === u4.cursorAt), 0), this.on("key", (F4) => {
|
|
578
|
+
F4 === "a" && this.toggleAll();
|
|
579
|
+
}), this.on("cursor", (F4) => {
|
|
580
|
+
switch (F4) {
|
|
581
|
+
case "left":
|
|
582
|
+
case "up":
|
|
583
|
+
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
584
|
+
break;
|
|
585
|
+
case "down":
|
|
586
|
+
case "right":
|
|
587
|
+
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
588
|
+
break;
|
|
589
|
+
case "space":
|
|
590
|
+
this.toggleValue();
|
|
591
|
+
break;
|
|
592
|
+
}
|
|
593
|
+
});
|
|
594
|
+
}
|
|
595
|
+
get _value() {
|
|
596
|
+
return this.options[this.cursor].value;
|
|
597
|
+
}
|
|
598
|
+
toggleAll() {
|
|
599
|
+
const u4 = this.value.length === this.options.length;
|
|
600
|
+
this.value = u4 ? [] : this.options.map((F4) => F4.value);
|
|
601
|
+
}
|
|
602
|
+
toggleValue() {
|
|
603
|
+
const u4 = this.value.includes(this._value);
|
|
604
|
+
this.value = u4 ? this.value.filter((F4) => F4 !== this._value) : [...this.value, this._value];
|
|
605
|
+
}
|
|
606
|
+
};
|
|
607
|
+
SD = Object.defineProperty;
|
|
608
|
+
$D = (t3, u4, F4) => u4 in t3 ? SD(t3, u4, { enumerable: true, configurable: true, writable: true, value: F4 }) : t3[u4] = F4;
|
|
609
|
+
q = (t3, u4, F4) => ($D(t3, typeof u4 != "symbol" ? u4 + "" : u4, F4), F4);
|
|
610
|
+
jD = class extends x {
|
|
611
|
+
constructor(u4) {
|
|
612
|
+
super(u4, false), q(this, "options"), q(this, "cursor", 0), this.options = u4.options, this.cursor = this.options.findIndex(({ value: F4 }) => F4 === u4.initialValue), this.cursor === -1 && (this.cursor = 0), this.changeValue(), this.on("cursor", (F4) => {
|
|
613
|
+
switch (F4) {
|
|
614
|
+
case "left":
|
|
615
|
+
case "up":
|
|
616
|
+
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
617
|
+
break;
|
|
618
|
+
case "down":
|
|
619
|
+
case "right":
|
|
620
|
+
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
621
|
+
break;
|
|
622
|
+
}
|
|
623
|
+
this.changeValue();
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
get _value() {
|
|
627
|
+
return this.options[this.cursor];
|
|
628
|
+
}
|
|
629
|
+
changeValue() {
|
|
630
|
+
this.value = this._value.value;
|
|
631
|
+
}
|
|
632
|
+
};
|
|
633
|
+
PD = class extends x {
|
|
634
|
+
get valueWithCursor() {
|
|
635
|
+
if (this.state === "submit") return this.value;
|
|
636
|
+
if (this.cursor >= this.value.length) return `${this.value}\u2588`;
|
|
637
|
+
const u4 = this.value.slice(0, this.cursor), [F4, ...e$1] = this.value.slice(this.cursor);
|
|
638
|
+
return `${u4}${e.inverse(F4)}${e$1.join("")}`;
|
|
639
|
+
}
|
|
640
|
+
get cursor() {
|
|
641
|
+
return this._cursor;
|
|
642
|
+
}
|
|
643
|
+
constructor(u4) {
|
|
644
|
+
super(u4), this.on("finalize", () => {
|
|
645
|
+
this.value || (this.value = u4.defaultValue);
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
};
|
|
649
|
+
V = ce();
|
|
650
|
+
u = (t3, n3) => V ? t3 : n3;
|
|
651
|
+
le = u("\u276F", ">");
|
|
652
|
+
L = u("\u25A0", "x");
|
|
653
|
+
W = u("\u25B2", "x");
|
|
654
|
+
C = u("\u2714", "\u221A");
|
|
655
|
+
o = u("");
|
|
656
|
+
d = u("");
|
|
657
|
+
k = u("\u25CF", ">");
|
|
658
|
+
P = u("\u25CB", " ");
|
|
659
|
+
A = u("\u25FB", "[\u2022]");
|
|
660
|
+
T = u("\u25FC", "[+]");
|
|
661
|
+
F = u("\u25FB", "[ ]");
|
|
662
|
+
w = (t3) => {
|
|
663
|
+
switch (t3) {
|
|
664
|
+
case "initial":
|
|
665
|
+
case "active":
|
|
666
|
+
return e.cyan(le);
|
|
667
|
+
case "cancel":
|
|
668
|
+
return e.red(L);
|
|
669
|
+
case "error":
|
|
670
|
+
return e.yellow(W);
|
|
671
|
+
case "submit":
|
|
672
|
+
return e.green(C);
|
|
673
|
+
}
|
|
674
|
+
};
|
|
675
|
+
B = (t3) => {
|
|
676
|
+
const { cursor: n3, options: s3, style: r4 } = t3, i3 = t3.maxItems ?? Number.POSITIVE_INFINITY, a3 = Math.max(process.stdout.rows - 4, 0), c4 = Math.min(a3, Math.max(i3, 5));
|
|
677
|
+
let l3 = 0;
|
|
678
|
+
n3 >= l3 + c4 - 3 ? l3 = Math.max(Math.min(n3 - c4 + 3, s3.length - c4), 0) : n3 < l3 + 2 && (l3 = Math.max(n3 - 2, 0));
|
|
679
|
+
const $ = c4 < s3.length && l3 > 0, p2 = c4 < s3.length && l3 + c4 < s3.length;
|
|
680
|
+
return s3.slice(l3, l3 + c4).map((M2, v3, x3) => {
|
|
681
|
+
const j2 = v3 === 0 && $, E2 = v3 === x3.length - 1 && p2;
|
|
682
|
+
return j2 || E2 ? e.dim("...") : r4(M2, v3 + l3 === n3);
|
|
683
|
+
});
|
|
684
|
+
};
|
|
685
|
+
he = (t3) => new PD({ validate: t3.validate, placeholder: t3.placeholder, defaultValue: t3.defaultValue, initialValue: t3.initialValue, render() {
|
|
686
|
+
const n3 = `${e.gray(o)}
|
|
687
|
+
${w(this.state)} ${t3.message}
|
|
688
|
+
`, s3 = t3.placeholder ? e.inverse(t3.placeholder[0]) + e.dim(t3.placeholder.slice(1)) : e.inverse(e.hidden("_")), r4 = this.value ? this.valueWithCursor : s3;
|
|
689
|
+
switch (this.state) {
|
|
690
|
+
case "error":
|
|
691
|
+
return `${n3.trim()}
|
|
692
|
+
${e.yellow(o)} ${r4}
|
|
693
|
+
${e.yellow(d)} ${e.yellow(this.error)}
|
|
694
|
+
`;
|
|
695
|
+
case "submit":
|
|
696
|
+
return `${n3}${e.gray(o)} ${e.dim(this.value || t3.placeholder)}`;
|
|
697
|
+
case "cancel":
|
|
698
|
+
return `${n3}${e.gray(o)} ${e.strikethrough(e.dim(this.value ?? ""))}${this.value?.trim() ? `
|
|
699
|
+
${e.gray(o)}` : ""}`;
|
|
700
|
+
default:
|
|
701
|
+
return `${n3}${e.cyan(o)} ${r4}
|
|
702
|
+
${e.cyan(d)}
|
|
703
|
+
`;
|
|
704
|
+
}
|
|
705
|
+
} }).prompt();
|
|
706
|
+
ye = (t3) => {
|
|
707
|
+
const n3 = t3.active ?? "Yes", s3 = t3.inactive ?? "No";
|
|
708
|
+
return new fD({ active: n3, inactive: s3, initialValue: t3.initialValue ?? true, render() {
|
|
709
|
+
const r4 = `${e.gray(o)}
|
|
710
|
+
${w(this.state)} ${t3.message}
|
|
711
|
+
`, i3 = this.value ? n3 : s3;
|
|
712
|
+
switch (this.state) {
|
|
713
|
+
case "submit":
|
|
714
|
+
return `${r4}${e.gray(o)} ${e.dim(i3)}`;
|
|
715
|
+
case "cancel":
|
|
716
|
+
return `${r4}${e.gray(o)} ${e.strikethrough(e.dim(i3))}
|
|
717
|
+
${e.gray(o)}`;
|
|
718
|
+
default:
|
|
719
|
+
return `${r4}${e.cyan(o)} ${this.value ? `${e.green(k)} ${n3}` : `${e.dim(P)} ${e.dim(n3)}`} ${e.dim("/")} ${this.value ? `${e.dim(P)} ${e.dim(s3)}` : `${e.green(k)} ${s3}`}
|
|
720
|
+
${e.cyan(d)}
|
|
721
|
+
`;
|
|
722
|
+
}
|
|
723
|
+
} }).prompt();
|
|
724
|
+
};
|
|
725
|
+
ve = (t3) => {
|
|
726
|
+
const n3 = (s3, r4) => {
|
|
727
|
+
const i3 = s3.label ?? String(s3.value);
|
|
728
|
+
switch (r4) {
|
|
729
|
+
case "selected":
|
|
730
|
+
return `${e.dim(i3)}`;
|
|
731
|
+
case "active":
|
|
732
|
+
return `${e.green(k)} ${i3} ${s3.hint ? e.dim(`(${s3.hint})`) : ""}`;
|
|
733
|
+
case "cancelled":
|
|
734
|
+
return `${e.strikethrough(e.dim(i3))}`;
|
|
735
|
+
default:
|
|
736
|
+
return `${e.dim(P)} ${e.dim(i3)}`;
|
|
737
|
+
}
|
|
738
|
+
};
|
|
739
|
+
return new jD({ options: t3.options, initialValue: t3.initialValue, render() {
|
|
740
|
+
const s3 = `${e.gray(o)}
|
|
741
|
+
${w(this.state)} ${t3.message}
|
|
742
|
+
`;
|
|
743
|
+
switch (this.state) {
|
|
744
|
+
case "submit":
|
|
745
|
+
return `${s3}${e.gray(o)} ${n3(this.options[this.cursor], "selected")}`;
|
|
746
|
+
case "cancel":
|
|
747
|
+
return `${s3}${e.gray(o)} ${n3(this.options[this.cursor], "cancelled")}
|
|
748
|
+
${e.gray(o)}`;
|
|
749
|
+
default:
|
|
750
|
+
return `${s3}${e.cyan(o)} ${B({ cursor: this.cursor, options: this.options, maxItems: t3.maxItems, style: (r4, i3) => n3(r4, i3 ? "active" : "inactive") }).join(`
|
|
751
|
+
${e.cyan(o)} `)}
|
|
752
|
+
${e.cyan(d)}
|
|
753
|
+
`;
|
|
754
|
+
}
|
|
755
|
+
} }).prompt();
|
|
756
|
+
};
|
|
757
|
+
fe = (t3) => {
|
|
758
|
+
const n3 = (s3, r4) => {
|
|
759
|
+
const i3 = s3.label ?? String(s3.value);
|
|
760
|
+
return r4 === "active" ? `${e.cyan(A)} ${i3} ${s3.hint ? e.dim(`(${s3.hint})`) : ""}` : r4 === "selected" ? `${e.green(T)} ${e.dim(i3)}` : r4 === "cancelled" ? `${e.strikethrough(e.dim(i3))}` : r4 === "active-selected" ? `${e.green(T)} ${i3} ${s3.hint ? e.dim(`(${s3.hint})`) : ""}` : r4 === "submitted" ? `${e.dim(i3)}` : `${e.dim(F)} ${e.dim(i3)}`;
|
|
761
|
+
};
|
|
762
|
+
return new wD({ options: t3.options, initialValues: t3.initialValues, required: t3.required ?? true, cursorAt: t3.cursorAt, validate(s3) {
|
|
763
|
+
if (this.required && s3.length === 0) return `Please select at least one option.
|
|
764
|
+
${e.reset(e.dim(`Press ${e.gray(e.bgWhite(e.inverse(" space ")))} to select, ${e.gray(e.bgWhite(e.inverse(" enter ")))} to submit`))}`;
|
|
765
|
+
}, render() {
|
|
766
|
+
const s3 = `${e.gray(o)}
|
|
767
|
+
${w(this.state)} ${t3.message}
|
|
768
|
+
`, r4 = (i3, a3) => {
|
|
769
|
+
const c4 = this.value.includes(i3.value);
|
|
770
|
+
return a3 && c4 ? n3(i3, "active-selected") : c4 ? n3(i3, "selected") : n3(i3, a3 ? "active" : "inactive");
|
|
771
|
+
};
|
|
772
|
+
switch (this.state) {
|
|
773
|
+
case "submit":
|
|
774
|
+
return `${s3}${e.gray(o)} ${this.options.filter(({ value: i3 }) => this.value.includes(i3)).map((i3) => n3(i3, "submitted")).join(e.dim(", ")) || e.dim("none")}`;
|
|
775
|
+
case "cancel": {
|
|
776
|
+
const i3 = this.options.filter(({ value: a3 }) => this.value.includes(a3)).map((a3) => n3(a3, "cancelled")).join(e.dim(", "));
|
|
777
|
+
return `${s3}${e.gray(o)} ${i3.trim() ? `${i3}
|
|
778
|
+
${e.gray(o)}` : ""}`;
|
|
779
|
+
}
|
|
780
|
+
case "error": {
|
|
781
|
+
const i3 = this.error.split(`
|
|
782
|
+
`).map((a3, c4) => c4 === 0 ? `${e.yellow(d)} ${e.yellow(a3)}` : ` ${a3}`).join(`
|
|
783
|
+
`);
|
|
784
|
+
return `${s3 + e.yellow(o)} ${B({ options: this.options, cursor: this.cursor, maxItems: t3.maxItems, style: r4 }).join(`
|
|
785
|
+
${e.yellow(o)} `)}
|
|
786
|
+
${i3}
|
|
787
|
+
`;
|
|
788
|
+
}
|
|
789
|
+
default:
|
|
790
|
+
return `${s3}${e.cyan(o)} ${B({ options: this.options, cursor: this.cursor, maxItems: t3.maxItems, style: r4 }).join(`
|
|
791
|
+
${e.cyan(o)} `)}
|
|
792
|
+
${e.cyan(d)}
|
|
793
|
+
`;
|
|
794
|
+
}
|
|
795
|
+
} }).prompt();
|
|
796
|
+
};
|
|
797
|
+
`${e.gray(o)} `;
|
|
798
|
+
kCancel = /* @__PURE__ */ Symbol.for("cancel");
|
|
799
|
+
}
|
|
800
|
+
});
|
|
801
|
+
|
|
802
|
+
// node_modules/picocolors/picocolors.js
|
|
803
|
+
var require_picocolors = __commonJS({
|
|
804
|
+
"node_modules/picocolors/picocolors.js"(exports$1, module) {
|
|
805
|
+
var p2 = process || {};
|
|
806
|
+
var argv2 = p2.argv || [];
|
|
807
|
+
var env2 = p2.env || {};
|
|
808
|
+
var isColorSupported2 = !(!!env2.NO_COLOR || argv2.includes("--no-color")) && (!!env2.FORCE_COLOR || argv2.includes("--color") || p2.platform === "win32" || (p2.stdout || {}).isTTY && env2.TERM !== "dumb" || !!env2.CI);
|
|
809
|
+
var formatter = (open, close, replace = open) => (input) => {
|
|
810
|
+
let string = "" + input, index = string.indexOf(close, open.length);
|
|
811
|
+
return ~index ? open + replaceClose2(string, close, replace, index) + close : open + string + close;
|
|
812
|
+
};
|
|
813
|
+
var replaceClose2 = (string, close, replace, index) => {
|
|
814
|
+
let result = "", cursor = 0;
|
|
815
|
+
do {
|
|
816
|
+
result += string.substring(cursor, index) + replace;
|
|
817
|
+
cursor = index + close.length;
|
|
818
|
+
index = string.indexOf(close, cursor);
|
|
819
|
+
} while (~index);
|
|
820
|
+
return result + string.substring(cursor);
|
|
821
|
+
};
|
|
822
|
+
var createColors2 = (enabled = isColorSupported2) => {
|
|
823
|
+
let f4 = enabled ? formatter : () => String;
|
|
824
|
+
return {
|
|
825
|
+
isColorSupported: enabled,
|
|
826
|
+
reset: f4("\x1B[0m", "\x1B[0m"),
|
|
827
|
+
bold: f4("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
828
|
+
dim: f4("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
829
|
+
italic: f4("\x1B[3m", "\x1B[23m"),
|
|
830
|
+
underline: f4("\x1B[4m", "\x1B[24m"),
|
|
831
|
+
inverse: f4("\x1B[7m", "\x1B[27m"),
|
|
832
|
+
hidden: f4("\x1B[8m", "\x1B[28m"),
|
|
833
|
+
strikethrough: f4("\x1B[9m", "\x1B[29m"),
|
|
834
|
+
black: f4("\x1B[30m", "\x1B[39m"),
|
|
835
|
+
red: f4("\x1B[31m", "\x1B[39m"),
|
|
836
|
+
green: f4("\x1B[32m", "\x1B[39m"),
|
|
837
|
+
yellow: f4("\x1B[33m", "\x1B[39m"),
|
|
838
|
+
blue: f4("\x1B[34m", "\x1B[39m"),
|
|
839
|
+
magenta: f4("\x1B[35m", "\x1B[39m"),
|
|
840
|
+
cyan: f4("\x1B[36m", "\x1B[39m"),
|
|
841
|
+
white: f4("\x1B[37m", "\x1B[39m"),
|
|
842
|
+
gray: f4("\x1B[90m", "\x1B[39m"),
|
|
843
|
+
bgBlack: f4("\x1B[40m", "\x1B[49m"),
|
|
844
|
+
bgRed: f4("\x1B[41m", "\x1B[49m"),
|
|
845
|
+
bgGreen: f4("\x1B[42m", "\x1B[49m"),
|
|
846
|
+
bgYellow: f4("\x1B[43m", "\x1B[49m"),
|
|
847
|
+
bgBlue: f4("\x1B[44m", "\x1B[49m"),
|
|
848
|
+
bgMagenta: f4("\x1B[45m", "\x1B[49m"),
|
|
849
|
+
bgCyan: f4("\x1B[46m", "\x1B[49m"),
|
|
850
|
+
bgWhite: f4("\x1B[47m", "\x1B[49m"),
|
|
851
|
+
blackBright: f4("\x1B[90m", "\x1B[39m"),
|
|
852
|
+
redBright: f4("\x1B[91m", "\x1B[39m"),
|
|
853
|
+
greenBright: f4("\x1B[92m", "\x1B[39m"),
|
|
854
|
+
yellowBright: f4("\x1B[93m", "\x1B[39m"),
|
|
855
|
+
blueBright: f4("\x1B[94m", "\x1B[39m"),
|
|
856
|
+
magentaBright: f4("\x1B[95m", "\x1B[39m"),
|
|
857
|
+
cyanBright: f4("\x1B[96m", "\x1B[39m"),
|
|
858
|
+
whiteBright: f4("\x1B[97m", "\x1B[39m"),
|
|
859
|
+
bgBlackBright: f4("\x1B[100m", "\x1B[49m"),
|
|
860
|
+
bgRedBright: f4("\x1B[101m", "\x1B[49m"),
|
|
861
|
+
bgGreenBright: f4("\x1B[102m", "\x1B[49m"),
|
|
862
|
+
bgYellowBright: f4("\x1B[103m", "\x1B[49m"),
|
|
863
|
+
bgBlueBright: f4("\x1B[104m", "\x1B[49m"),
|
|
864
|
+
bgMagentaBright: f4("\x1B[105m", "\x1B[49m"),
|
|
865
|
+
bgCyanBright: f4("\x1B[106m", "\x1B[49m"),
|
|
866
|
+
bgWhiteBright: f4("\x1B[107m", "\x1B[49m")
|
|
867
|
+
};
|
|
868
|
+
};
|
|
869
|
+
module.exports = createColors2();
|
|
870
|
+
module.exports.createColors = createColors2;
|
|
871
|
+
}
|
|
872
|
+
});
|
|
873
|
+
|
|
874
|
+
// node_modules/consola/dist/core.mjs
|
|
875
|
+
var LogLevels = {
|
|
876
|
+
fatal: 0,
|
|
877
|
+
error: 0,
|
|
878
|
+
warn: 1,
|
|
879
|
+
log: 2,
|
|
880
|
+
info: 3,
|
|
881
|
+
success: 3,
|
|
882
|
+
fail: 3,
|
|
883
|
+
debug: 4,
|
|
884
|
+
trace: 5,
|
|
885
|
+
verbose: Number.POSITIVE_INFINITY
|
|
886
|
+
};
|
|
887
|
+
var LogTypes = {
|
|
888
|
+
// Silent
|
|
889
|
+
silent: {
|
|
890
|
+
level: -1
|
|
891
|
+
},
|
|
892
|
+
// Level 0
|
|
893
|
+
fatal: {
|
|
894
|
+
level: LogLevels.fatal
|
|
895
|
+
},
|
|
896
|
+
error: {
|
|
897
|
+
level: LogLevels.error
|
|
898
|
+
},
|
|
899
|
+
// Level 1
|
|
900
|
+
warn: {
|
|
901
|
+
level: LogLevels.warn
|
|
902
|
+
},
|
|
903
|
+
// Level 2
|
|
904
|
+
log: {
|
|
905
|
+
level: LogLevels.log
|
|
906
|
+
},
|
|
907
|
+
// Level 3
|
|
908
|
+
info: {
|
|
909
|
+
level: LogLevels.info
|
|
910
|
+
},
|
|
911
|
+
success: {
|
|
912
|
+
level: LogLevels.success
|
|
913
|
+
},
|
|
914
|
+
fail: {
|
|
915
|
+
level: LogLevels.fail
|
|
916
|
+
},
|
|
917
|
+
ready: {
|
|
918
|
+
level: LogLevels.info
|
|
919
|
+
},
|
|
920
|
+
start: {
|
|
921
|
+
level: LogLevels.info
|
|
922
|
+
},
|
|
923
|
+
box: {
|
|
924
|
+
level: LogLevels.info
|
|
925
|
+
},
|
|
926
|
+
// Level 4
|
|
927
|
+
debug: {
|
|
928
|
+
level: LogLevels.debug
|
|
929
|
+
},
|
|
930
|
+
// Level 5
|
|
931
|
+
trace: {
|
|
932
|
+
level: LogLevels.trace
|
|
933
|
+
},
|
|
934
|
+
// Verbose
|
|
935
|
+
verbose: {
|
|
936
|
+
level: LogLevels.verbose
|
|
937
|
+
}
|
|
938
|
+
};
|
|
939
|
+
function isPlainObject$1(value) {
|
|
940
|
+
if (value === null || typeof value !== "object") {
|
|
941
|
+
return false;
|
|
942
|
+
}
|
|
943
|
+
const prototype = Object.getPrototypeOf(value);
|
|
944
|
+
if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
|
|
945
|
+
return false;
|
|
946
|
+
}
|
|
947
|
+
if (Symbol.iterator in value) {
|
|
948
|
+
return false;
|
|
949
|
+
}
|
|
950
|
+
if (Symbol.toStringTag in value) {
|
|
951
|
+
return Object.prototype.toString.call(value) === "[object Module]";
|
|
952
|
+
}
|
|
953
|
+
return true;
|
|
954
|
+
}
|
|
955
|
+
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
956
|
+
if (!isPlainObject$1(defaults)) {
|
|
957
|
+
return _defu(baseObject, {}, namespace);
|
|
958
|
+
}
|
|
959
|
+
const object = Object.assign({}, defaults);
|
|
960
|
+
for (const key in baseObject) {
|
|
961
|
+
if (key === "__proto__" || key === "constructor") {
|
|
962
|
+
continue;
|
|
963
|
+
}
|
|
964
|
+
const value = baseObject[key];
|
|
965
|
+
if (value === null || value === void 0) {
|
|
966
|
+
continue;
|
|
967
|
+
}
|
|
968
|
+
if (Array.isArray(value) && Array.isArray(object[key])) {
|
|
969
|
+
object[key] = [...value, ...object[key]];
|
|
970
|
+
} else if (isPlainObject$1(value) && isPlainObject$1(object[key])) {
|
|
971
|
+
object[key] = _defu(
|
|
972
|
+
value,
|
|
973
|
+
object[key],
|
|
974
|
+
(namespace ? `${namespace}.` : "") + key.toString());
|
|
975
|
+
} else {
|
|
976
|
+
object[key] = value;
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
return object;
|
|
980
|
+
}
|
|
981
|
+
function createDefu(merger) {
|
|
982
|
+
return (...arguments_) => (
|
|
983
|
+
// eslint-disable-next-line unicorn/no-array-reduce
|
|
984
|
+
arguments_.reduce((p2, c4) => _defu(p2, c4, ""), {})
|
|
985
|
+
);
|
|
986
|
+
}
|
|
987
|
+
var defu = createDefu();
|
|
988
|
+
function isPlainObject(obj) {
|
|
989
|
+
return Object.prototype.toString.call(obj) === "[object Object]";
|
|
990
|
+
}
|
|
991
|
+
function isLogObj(arg) {
|
|
992
|
+
if (!isPlainObject(arg)) {
|
|
993
|
+
return false;
|
|
994
|
+
}
|
|
995
|
+
if (!arg.message && !arg.args) {
|
|
996
|
+
return false;
|
|
997
|
+
}
|
|
998
|
+
if (arg.stack) {
|
|
999
|
+
return false;
|
|
1000
|
+
}
|
|
1001
|
+
return true;
|
|
1002
|
+
}
|
|
1003
|
+
var paused = false;
|
|
1004
|
+
var queue = [];
|
|
1005
|
+
var Consola = class _Consola {
|
|
1006
|
+
options;
|
|
1007
|
+
_lastLog;
|
|
1008
|
+
_mockFn;
|
|
1009
|
+
/**
|
|
1010
|
+
* Creates an instance of Consola with specified options or defaults.
|
|
1011
|
+
*
|
|
1012
|
+
* @param {Partial<ConsolaOptions>} [options={}] - Configuration options for the Consola instance.
|
|
1013
|
+
*/
|
|
1014
|
+
constructor(options = {}) {
|
|
1015
|
+
const types = options.types || LogTypes;
|
|
1016
|
+
this.options = defu(
|
|
1017
|
+
{
|
|
1018
|
+
...options,
|
|
1019
|
+
defaults: { ...options.defaults },
|
|
1020
|
+
level: _normalizeLogLevel(options.level, types),
|
|
1021
|
+
reporters: [...options.reporters || []]
|
|
1022
|
+
},
|
|
1023
|
+
{
|
|
1024
|
+
types: LogTypes,
|
|
1025
|
+
throttle: 1e3,
|
|
1026
|
+
throttleMin: 5,
|
|
1027
|
+
formatOptions: {
|
|
1028
|
+
date: true,
|
|
1029
|
+
colors: false,
|
|
1030
|
+
compact: true
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
);
|
|
1034
|
+
for (const type in types) {
|
|
1035
|
+
const defaults = {
|
|
1036
|
+
type,
|
|
1037
|
+
...this.options.defaults,
|
|
1038
|
+
...types[type]
|
|
1039
|
+
};
|
|
1040
|
+
this[type] = this._wrapLogFn(defaults);
|
|
1041
|
+
this[type].raw = this._wrapLogFn(
|
|
1042
|
+
defaults,
|
|
1043
|
+
true
|
|
1044
|
+
);
|
|
1045
|
+
}
|
|
1046
|
+
if (this.options.mockFn) {
|
|
1047
|
+
this.mockTypes();
|
|
1048
|
+
}
|
|
1049
|
+
this._lastLog = {};
|
|
1050
|
+
}
|
|
1051
|
+
/**
|
|
1052
|
+
* Gets the current log level of the Consola instance.
|
|
1053
|
+
*
|
|
1054
|
+
* @returns {number} The current log level.
|
|
1055
|
+
*/
|
|
1056
|
+
get level() {
|
|
1057
|
+
return this.options.level;
|
|
1058
|
+
}
|
|
1059
|
+
/**
|
|
1060
|
+
* Sets the minimum log level that will be output by the instance.
|
|
1061
|
+
*
|
|
1062
|
+
* @param {number} level - The new log level to set.
|
|
1063
|
+
*/
|
|
1064
|
+
set level(level) {
|
|
1065
|
+
this.options.level = _normalizeLogLevel(
|
|
1066
|
+
level,
|
|
1067
|
+
this.options.types,
|
|
1068
|
+
this.options.level
|
|
1069
|
+
);
|
|
1070
|
+
}
|
|
1071
|
+
/**
|
|
1072
|
+
* Displays a prompt to the user and returns the response.
|
|
1073
|
+
* Throw an error if `prompt` is not supported by the current configuration.
|
|
1074
|
+
*
|
|
1075
|
+
* @template T
|
|
1076
|
+
* @param {string} message - The message to display in the prompt.
|
|
1077
|
+
* @param {T} [opts] - Optional options for the prompt. See {@link PromptOptions}.
|
|
1078
|
+
* @returns {promise<T>} A promise that infer with the prompt options. See {@link PromptOptions}.
|
|
1079
|
+
*/
|
|
1080
|
+
prompt(message, opts) {
|
|
1081
|
+
if (!this.options.prompt) {
|
|
1082
|
+
throw new Error("prompt is not supported!");
|
|
1083
|
+
}
|
|
1084
|
+
return this.options.prompt(message, opts);
|
|
1085
|
+
}
|
|
1086
|
+
/**
|
|
1087
|
+
* Creates a new instance of Consola, inheriting options from the current instance, with possible overrides.
|
|
1088
|
+
*
|
|
1089
|
+
* @param {Partial<ConsolaOptions>} options - Optional overrides for the new instance. See {@link ConsolaOptions}.
|
|
1090
|
+
* @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
|
|
1091
|
+
*/
|
|
1092
|
+
create(options) {
|
|
1093
|
+
const instance = new _Consola({
|
|
1094
|
+
...this.options,
|
|
1095
|
+
...options
|
|
1096
|
+
});
|
|
1097
|
+
if (this._mockFn) {
|
|
1098
|
+
instance.mockTypes(this._mockFn);
|
|
1099
|
+
}
|
|
1100
|
+
return instance;
|
|
1101
|
+
}
|
|
1102
|
+
/**
|
|
1103
|
+
* Creates a new Consola instance with the specified default log object properties.
|
|
1104
|
+
*
|
|
1105
|
+
* @param {InputLogObject} defaults - Default properties to include in any log from the new instance. See {@link InputLogObject}.
|
|
1106
|
+
* @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
|
|
1107
|
+
*/
|
|
1108
|
+
withDefaults(defaults) {
|
|
1109
|
+
return this.create({
|
|
1110
|
+
...this.options,
|
|
1111
|
+
defaults: {
|
|
1112
|
+
...this.options.defaults,
|
|
1113
|
+
...defaults
|
|
1114
|
+
}
|
|
1115
|
+
});
|
|
1116
|
+
}
|
|
1117
|
+
/**
|
|
1118
|
+
* Creates a new Consola instance with a specified tag, which will be included in every log.
|
|
1119
|
+
*
|
|
1120
|
+
* @param {string} tag - The tag to include in each log of the new instance.
|
|
1121
|
+
* @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
|
|
1122
|
+
*/
|
|
1123
|
+
withTag(tag) {
|
|
1124
|
+
return this.withDefaults({
|
|
1125
|
+
tag: this.options.defaults.tag ? this.options.defaults.tag + ":" + tag : tag
|
|
1126
|
+
});
|
|
1127
|
+
}
|
|
1128
|
+
/**
|
|
1129
|
+
* Adds a custom reporter to the Consola instance.
|
|
1130
|
+
* Reporters will be called for each log message, depending on their implementation and log level.
|
|
1131
|
+
*
|
|
1132
|
+
* @param {ConsolaReporter} reporter - The reporter to add. See {@link ConsolaReporter}.
|
|
1133
|
+
* @returns {Consola} The current Consola instance.
|
|
1134
|
+
*/
|
|
1135
|
+
addReporter(reporter) {
|
|
1136
|
+
this.options.reporters.push(reporter);
|
|
1137
|
+
return this;
|
|
1138
|
+
}
|
|
1139
|
+
/**
|
|
1140
|
+
* Removes a custom reporter from the Consola instance.
|
|
1141
|
+
* If no reporter is specified, all reporters will be removed.
|
|
1142
|
+
*
|
|
1143
|
+
* @param {ConsolaReporter} reporter - The reporter to remove. See {@link ConsolaReporter}.
|
|
1144
|
+
* @returns {Consola} The current Consola instance.
|
|
1145
|
+
*/
|
|
1146
|
+
removeReporter(reporter) {
|
|
1147
|
+
if (reporter) {
|
|
1148
|
+
const i3 = this.options.reporters.indexOf(reporter);
|
|
1149
|
+
if (i3 !== -1) {
|
|
1150
|
+
return this.options.reporters.splice(i3, 1);
|
|
1151
|
+
}
|
|
1152
|
+
} else {
|
|
1153
|
+
this.options.reporters.splice(0);
|
|
1154
|
+
}
|
|
1155
|
+
return this;
|
|
1156
|
+
}
|
|
1157
|
+
/**
|
|
1158
|
+
* Replaces all reporters of the Consola instance with the specified array of reporters.
|
|
1159
|
+
*
|
|
1160
|
+
* @param {ConsolaReporter[]} reporters - The new reporters to set. See {@link ConsolaReporter}.
|
|
1161
|
+
* @returns {Consola} The current Consola instance.
|
|
1162
|
+
*/
|
|
1163
|
+
setReporters(reporters) {
|
|
1164
|
+
this.options.reporters = Array.isArray(reporters) ? reporters : [reporters];
|
|
1165
|
+
return this;
|
|
1166
|
+
}
|
|
1167
|
+
wrapAll() {
|
|
1168
|
+
this.wrapConsole();
|
|
1169
|
+
this.wrapStd();
|
|
1170
|
+
}
|
|
1171
|
+
restoreAll() {
|
|
1172
|
+
this.restoreConsole();
|
|
1173
|
+
this.restoreStd();
|
|
1174
|
+
}
|
|
1175
|
+
/**
|
|
1176
|
+
* Overrides console methods with Consola logging methods for consistent logging.
|
|
1177
|
+
*/
|
|
1178
|
+
wrapConsole() {
|
|
1179
|
+
for (const type in this.options.types) {
|
|
1180
|
+
if (!console["__" + type]) {
|
|
1181
|
+
console["__" + type] = console[type];
|
|
1182
|
+
}
|
|
1183
|
+
console[type] = this[type].raw;
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
/**
|
|
1187
|
+
* Restores the original console methods, removing Consola overrides.
|
|
1188
|
+
*/
|
|
1189
|
+
restoreConsole() {
|
|
1190
|
+
for (const type in this.options.types) {
|
|
1191
|
+
if (console["__" + type]) {
|
|
1192
|
+
console[type] = console["__" + type];
|
|
1193
|
+
delete console["__" + type];
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
/**
|
|
1198
|
+
* Overrides standard output and error streams to redirect them through Consola.
|
|
1199
|
+
*/
|
|
1200
|
+
wrapStd() {
|
|
1201
|
+
this._wrapStream(this.options.stdout, "log");
|
|
1202
|
+
this._wrapStream(this.options.stderr, "log");
|
|
1203
|
+
}
|
|
1204
|
+
_wrapStream(stream, type) {
|
|
1205
|
+
if (!stream) {
|
|
1206
|
+
return;
|
|
1207
|
+
}
|
|
1208
|
+
if (!stream.__write) {
|
|
1209
|
+
stream.__write = stream.write;
|
|
1210
|
+
}
|
|
1211
|
+
stream.write = (data) => {
|
|
1212
|
+
this[type].raw(String(data).trim());
|
|
1213
|
+
};
|
|
1214
|
+
}
|
|
1215
|
+
/**
|
|
1216
|
+
* Restores the original standard output and error streams, removing the Consola redirection.
|
|
1217
|
+
*/
|
|
1218
|
+
restoreStd() {
|
|
1219
|
+
this._restoreStream(this.options.stdout);
|
|
1220
|
+
this._restoreStream(this.options.stderr);
|
|
1221
|
+
}
|
|
1222
|
+
_restoreStream(stream) {
|
|
1223
|
+
if (!stream) {
|
|
1224
|
+
return;
|
|
1225
|
+
}
|
|
1226
|
+
if (stream.__write) {
|
|
1227
|
+
stream.write = stream.__write;
|
|
1228
|
+
delete stream.__write;
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1231
|
+
/**
|
|
1232
|
+
* Pauses logging, queues incoming logs until resumed.
|
|
1233
|
+
*/
|
|
1234
|
+
pauseLogs() {
|
|
1235
|
+
paused = true;
|
|
1236
|
+
}
|
|
1237
|
+
/**
|
|
1238
|
+
* Resumes logging, processing any queued logs.
|
|
1239
|
+
*/
|
|
1240
|
+
resumeLogs() {
|
|
1241
|
+
paused = false;
|
|
1242
|
+
const _queue = queue.splice(0);
|
|
1243
|
+
for (const item of _queue) {
|
|
1244
|
+
item[0]._logFn(item[1], item[2]);
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
/**
|
|
1248
|
+
* Replaces logging methods with mocks if a mock function is provided.
|
|
1249
|
+
*
|
|
1250
|
+
* @param {ConsolaOptions["mockFn"]} mockFn - The function to use for mocking logging methods. See {@link ConsolaOptions["mockFn"]}.
|
|
1251
|
+
*/
|
|
1252
|
+
mockTypes(mockFn) {
|
|
1253
|
+
const _mockFn = mockFn || this.options.mockFn;
|
|
1254
|
+
this._mockFn = _mockFn;
|
|
1255
|
+
if (typeof _mockFn !== "function") {
|
|
1256
|
+
return;
|
|
1257
|
+
}
|
|
1258
|
+
for (const type in this.options.types) {
|
|
1259
|
+
this[type] = _mockFn(type, this.options.types[type]) || this[type];
|
|
1260
|
+
this[type].raw = this[type];
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
_wrapLogFn(defaults, isRaw) {
|
|
1264
|
+
return (...args) => {
|
|
1265
|
+
if (paused) {
|
|
1266
|
+
queue.push([this, defaults, args, isRaw]);
|
|
1267
|
+
return;
|
|
1268
|
+
}
|
|
1269
|
+
return this._logFn(defaults, args, isRaw);
|
|
1270
|
+
};
|
|
1271
|
+
}
|
|
1272
|
+
_logFn(defaults, args, isRaw) {
|
|
1273
|
+
if ((defaults.level || 0) > this.level) {
|
|
1274
|
+
return false;
|
|
1275
|
+
}
|
|
1276
|
+
const logObj = {
|
|
1277
|
+
date: /* @__PURE__ */ new Date(),
|
|
1278
|
+
args: [],
|
|
1279
|
+
...defaults,
|
|
1280
|
+
level: _normalizeLogLevel(defaults.level, this.options.types)
|
|
1281
|
+
};
|
|
1282
|
+
if (!isRaw && args.length === 1 && isLogObj(args[0])) {
|
|
1283
|
+
Object.assign(logObj, args[0]);
|
|
1284
|
+
} else {
|
|
1285
|
+
logObj.args = [...args];
|
|
1286
|
+
}
|
|
1287
|
+
if (logObj.message) {
|
|
1288
|
+
logObj.args.unshift(logObj.message);
|
|
1289
|
+
delete logObj.message;
|
|
1290
|
+
}
|
|
1291
|
+
if (logObj.additional) {
|
|
1292
|
+
if (!Array.isArray(logObj.additional)) {
|
|
1293
|
+
logObj.additional = logObj.additional.split("\n");
|
|
1294
|
+
}
|
|
1295
|
+
logObj.args.push("\n" + logObj.additional.join("\n"));
|
|
1296
|
+
delete logObj.additional;
|
|
1297
|
+
}
|
|
1298
|
+
logObj.type = typeof logObj.type === "string" ? logObj.type.toLowerCase() : "log";
|
|
1299
|
+
logObj.tag = typeof logObj.tag === "string" ? logObj.tag : "";
|
|
1300
|
+
const resolveLog = (newLog = false) => {
|
|
1301
|
+
const repeated = (this._lastLog.count || 0) - this.options.throttleMin;
|
|
1302
|
+
if (this._lastLog.object && repeated > 0) {
|
|
1303
|
+
const args2 = [...this._lastLog.object.args];
|
|
1304
|
+
if (repeated > 1) {
|
|
1305
|
+
args2.push(`(repeated ${repeated} times)`);
|
|
1306
|
+
}
|
|
1307
|
+
this._log({ ...this._lastLog.object, args: args2 });
|
|
1308
|
+
this._lastLog.count = 1;
|
|
1309
|
+
}
|
|
1310
|
+
if (newLog) {
|
|
1311
|
+
this._lastLog.object = logObj;
|
|
1312
|
+
this._log(logObj);
|
|
1313
|
+
}
|
|
1314
|
+
};
|
|
1315
|
+
clearTimeout(this._lastLog.timeout);
|
|
1316
|
+
const diffTime = this._lastLog.time && logObj.date ? logObj.date.getTime() - this._lastLog.time.getTime() : 0;
|
|
1317
|
+
this._lastLog.time = logObj.date;
|
|
1318
|
+
if (diffTime < this.options.throttle) {
|
|
1319
|
+
try {
|
|
1320
|
+
const serializedLog = JSON.stringify([
|
|
1321
|
+
logObj.type,
|
|
1322
|
+
logObj.tag,
|
|
1323
|
+
logObj.args
|
|
1324
|
+
]);
|
|
1325
|
+
const isSameLog = this._lastLog.serialized === serializedLog;
|
|
1326
|
+
this._lastLog.serialized = serializedLog;
|
|
1327
|
+
if (isSameLog) {
|
|
1328
|
+
this._lastLog.count = (this._lastLog.count || 0) + 1;
|
|
1329
|
+
if (this._lastLog.count > this.options.throttleMin) {
|
|
1330
|
+
this._lastLog.timeout = setTimeout(
|
|
1331
|
+
resolveLog,
|
|
1332
|
+
this.options.throttle
|
|
1333
|
+
);
|
|
1334
|
+
return;
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
} catch {
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
resolveLog(true);
|
|
1341
|
+
}
|
|
1342
|
+
_log(logObj) {
|
|
1343
|
+
for (const reporter of this.options.reporters) {
|
|
1344
|
+
reporter.log(logObj, {
|
|
1345
|
+
options: this.options
|
|
1346
|
+
});
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
};
|
|
1350
|
+
function _normalizeLogLevel(input, types = {}, defaultLevel = 3) {
|
|
1351
|
+
if (input === void 0) {
|
|
1352
|
+
return defaultLevel;
|
|
1353
|
+
}
|
|
1354
|
+
if (typeof input === "number") {
|
|
1355
|
+
return input;
|
|
1356
|
+
}
|
|
1357
|
+
if (types[input] && types[input].level !== void 0) {
|
|
1358
|
+
return types[input].level;
|
|
1359
|
+
}
|
|
1360
|
+
return defaultLevel;
|
|
1361
|
+
}
|
|
1362
|
+
Consola.prototype.add = Consola.prototype.addReporter;
|
|
1363
|
+
Consola.prototype.remove = Consola.prototype.removeReporter;
|
|
1364
|
+
Consola.prototype.clear = Consola.prototype.removeReporter;
|
|
1365
|
+
Consola.prototype.withScope = Consola.prototype.withTag;
|
|
1366
|
+
Consola.prototype.mock = Consola.prototype.mockTypes;
|
|
1367
|
+
Consola.prototype.pause = Consola.prototype.pauseLogs;
|
|
1368
|
+
Consola.prototype.resume = Consola.prototype.resumeLogs;
|
|
1369
|
+
function createConsola(options = {}) {
|
|
1370
|
+
return new Consola(options);
|
|
1371
|
+
}
|
|
1372
|
+
function parseStack(stack, message) {
|
|
1373
|
+
const cwd = process.cwd() + sep;
|
|
1374
|
+
const lines = stack.split("\n").splice(message.split("\n").length).map((l3) => l3.trim().replace("file://", "").replace(cwd, ""));
|
|
1375
|
+
return lines;
|
|
1376
|
+
}
|
|
1377
|
+
function writeStream(data, stream) {
|
|
1378
|
+
const write = stream.__write || stream.write;
|
|
1379
|
+
return write.call(stream, data);
|
|
1380
|
+
}
|
|
1381
|
+
var bracket = (x3) => x3 ? `[${x3}]` : "";
|
|
1382
|
+
var BasicReporter = class {
|
|
1383
|
+
formatStack(stack, message, opts) {
|
|
1384
|
+
const indent = " ".repeat((opts?.errorLevel || 0) + 1);
|
|
1385
|
+
return indent + parseStack(stack, message).join(`
|
|
1386
|
+
${indent}`);
|
|
1387
|
+
}
|
|
1388
|
+
formatError(err, opts) {
|
|
1389
|
+
const message = err.message ?? formatWithOptions(opts, err);
|
|
1390
|
+
const stack = err.stack ? this.formatStack(err.stack, message, opts) : "";
|
|
1391
|
+
const level = opts?.errorLevel || 0;
|
|
1392
|
+
const causedPrefix = level > 0 ? `${" ".repeat(level)}[cause]: ` : "";
|
|
1393
|
+
const causedError = err.cause ? "\n\n" + this.formatError(err.cause, { ...opts, errorLevel: level + 1 }) : "";
|
|
1394
|
+
return causedPrefix + message + "\n" + stack + causedError;
|
|
1395
|
+
}
|
|
1396
|
+
formatArgs(args, opts) {
|
|
1397
|
+
const _args = args.map((arg) => {
|
|
1398
|
+
if (arg && typeof arg.stack === "string") {
|
|
1399
|
+
return this.formatError(arg, opts);
|
|
1400
|
+
}
|
|
1401
|
+
return arg;
|
|
1402
|
+
});
|
|
1403
|
+
return formatWithOptions(opts, ..._args);
|
|
1404
|
+
}
|
|
1405
|
+
formatDate(date, opts) {
|
|
1406
|
+
return opts.date ? date.toLocaleTimeString() : "";
|
|
1407
|
+
}
|
|
1408
|
+
filterAndJoin(arr) {
|
|
1409
|
+
return arr.filter(Boolean).join(" ");
|
|
1410
|
+
}
|
|
1411
|
+
formatLogObj(logObj, opts) {
|
|
1412
|
+
const message = this.formatArgs(logObj.args, opts);
|
|
1413
|
+
if (logObj.type === "box") {
|
|
1414
|
+
return "\n" + [
|
|
1415
|
+
bracket(logObj.tag),
|
|
1416
|
+
logObj.title && logObj.title,
|
|
1417
|
+
...message.split("\n")
|
|
1418
|
+
].filter(Boolean).map((l3) => " > " + l3).join("\n") + "\n";
|
|
1419
|
+
}
|
|
1420
|
+
return this.filterAndJoin([
|
|
1421
|
+
bracket(logObj.type),
|
|
1422
|
+
bracket(logObj.tag),
|
|
1423
|
+
message
|
|
1424
|
+
]);
|
|
1425
|
+
}
|
|
1426
|
+
log(logObj, ctx) {
|
|
1427
|
+
const line = this.formatLogObj(logObj, {
|
|
1428
|
+
columns: ctx.options.stdout.columns || 0,
|
|
1429
|
+
...ctx.options.formatOptions
|
|
1430
|
+
});
|
|
1431
|
+
return writeStream(
|
|
1432
|
+
line + "\n",
|
|
1433
|
+
logObj.level < 2 ? ctx.options.stderr || process.stderr : ctx.options.stdout || process.stdout
|
|
1434
|
+
);
|
|
1435
|
+
}
|
|
1436
|
+
};
|
|
1437
|
+
var {
|
|
1438
|
+
env = {},
|
|
1439
|
+
argv = [],
|
|
1440
|
+
platform = ""
|
|
1441
|
+
} = typeof process === "undefined" ? {} : process;
|
|
1442
|
+
var isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
|
|
1443
|
+
var isForced = "FORCE_COLOR" in env || argv.includes("--color");
|
|
1444
|
+
var isWindows = platform === "win32";
|
|
1445
|
+
var isDumbTerminal = env.TERM === "dumb";
|
|
1446
|
+
var isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env.TERM && !isDumbTerminal;
|
|
1447
|
+
var isCI = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
|
|
1448
|
+
var isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
|
|
1449
|
+
function replaceClose(index, string, close, replace, head = string.slice(0, Math.max(0, index)) + replace, tail = string.slice(Math.max(0, index + close.length)), next = tail.indexOf(close)) {
|
|
1450
|
+
return head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
|
|
1451
|
+
}
|
|
1452
|
+
function clearBleed(index, string, open, close, replace) {
|
|
1453
|
+
return index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
|
|
1454
|
+
}
|
|
1455
|
+
function filterEmpty(open, close, replace = open, at = open.length + 1) {
|
|
1456
|
+
return (string) => string || !(string === "" || string === void 0) ? clearBleed(
|
|
1457
|
+
("" + string).indexOf(close, at),
|
|
1458
|
+
string,
|
|
1459
|
+
open,
|
|
1460
|
+
close,
|
|
1461
|
+
replace
|
|
1462
|
+
) : "";
|
|
1463
|
+
}
|
|
1464
|
+
function init(open, close, replace) {
|
|
1465
|
+
return filterEmpty(`\x1B[${open}m`, `\x1B[${close}m`, replace);
|
|
1466
|
+
}
|
|
1467
|
+
var colorDefs = {
|
|
1468
|
+
reset: init(0, 0),
|
|
1469
|
+
bold: init(1, 22, "\x1B[22m\x1B[1m"),
|
|
1470
|
+
dim: init(2, 22, "\x1B[22m\x1B[2m"),
|
|
1471
|
+
italic: init(3, 23),
|
|
1472
|
+
underline: init(4, 24),
|
|
1473
|
+
inverse: init(7, 27),
|
|
1474
|
+
hidden: init(8, 28),
|
|
1475
|
+
strikethrough: init(9, 29),
|
|
1476
|
+
black: init(30, 39),
|
|
1477
|
+
red: init(31, 39),
|
|
1478
|
+
green: init(32, 39),
|
|
1479
|
+
yellow: init(33, 39),
|
|
1480
|
+
blue: init(34, 39),
|
|
1481
|
+
magenta: init(35, 39),
|
|
1482
|
+
cyan: init(36, 39),
|
|
1483
|
+
white: init(37, 39),
|
|
1484
|
+
gray: init(90, 39),
|
|
1485
|
+
bgBlack: init(40, 49),
|
|
1486
|
+
bgRed: init(41, 49),
|
|
1487
|
+
bgGreen: init(42, 49),
|
|
1488
|
+
bgYellow: init(43, 49),
|
|
1489
|
+
bgBlue: init(44, 49),
|
|
1490
|
+
bgMagenta: init(45, 49),
|
|
1491
|
+
bgCyan: init(46, 49),
|
|
1492
|
+
bgWhite: init(47, 49),
|
|
1493
|
+
blackBright: init(90, 39),
|
|
1494
|
+
redBright: init(91, 39),
|
|
1495
|
+
greenBright: init(92, 39),
|
|
1496
|
+
yellowBright: init(93, 39),
|
|
1497
|
+
blueBright: init(94, 39),
|
|
1498
|
+
magentaBright: init(95, 39),
|
|
1499
|
+
cyanBright: init(96, 39),
|
|
1500
|
+
whiteBright: init(97, 39),
|
|
1501
|
+
bgBlackBright: init(100, 49),
|
|
1502
|
+
bgRedBright: init(101, 49),
|
|
1503
|
+
bgGreenBright: init(102, 49),
|
|
1504
|
+
bgYellowBright: init(103, 49),
|
|
1505
|
+
bgBlueBright: init(104, 49),
|
|
1506
|
+
bgMagentaBright: init(105, 49),
|
|
1507
|
+
bgCyanBright: init(106, 49),
|
|
1508
|
+
bgWhiteBright: init(107, 49)
|
|
1509
|
+
};
|
|
1510
|
+
function createColors(useColor = isColorSupported) {
|
|
1511
|
+
return useColor ? colorDefs : Object.fromEntries(Object.keys(colorDefs).map((key) => [key, String]));
|
|
1512
|
+
}
|
|
1513
|
+
var colors = createColors();
|
|
1514
|
+
function getColor(color, fallback = "reset") {
|
|
1515
|
+
return colors[color] || colors[fallback];
|
|
1516
|
+
}
|
|
1517
|
+
var ansiRegex = [
|
|
1518
|
+
String.raw`[\u001B\u009B][[\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\d\/#&.:=?%@~_]+)*|[a-zA-Z\d]+(?:;[-a-zA-Z\d\/#&.:=?%@~_]*)*)?\u0007)`,
|
|
1519
|
+
String.raw`(?:(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PR-TZcf-nq-uy=><~]))`
|
|
1520
|
+
].join("|");
|
|
1521
|
+
function stripAnsi(text) {
|
|
1522
|
+
return text.replace(new RegExp(ansiRegex, "g"), "");
|
|
1523
|
+
}
|
|
1524
|
+
var boxStylePresets = {
|
|
1525
|
+
solid: {
|
|
1526
|
+
tl: "\u250C",
|
|
1527
|
+
tr: "\u2510",
|
|
1528
|
+
bl: "\u2514",
|
|
1529
|
+
br: "\u2518",
|
|
1530
|
+
h: "\u2500",
|
|
1531
|
+
v: "\u2502"
|
|
1532
|
+
},
|
|
1533
|
+
double: {
|
|
1534
|
+
tl: "\u2554",
|
|
1535
|
+
tr: "\u2557",
|
|
1536
|
+
bl: "\u255A",
|
|
1537
|
+
br: "\u255D",
|
|
1538
|
+
h: "\u2550",
|
|
1539
|
+
v: "\u2551"
|
|
1540
|
+
},
|
|
1541
|
+
doubleSingle: {
|
|
1542
|
+
tl: "\u2553",
|
|
1543
|
+
tr: "\u2556",
|
|
1544
|
+
bl: "\u2559",
|
|
1545
|
+
br: "\u255C",
|
|
1546
|
+
h: "\u2500",
|
|
1547
|
+
v: "\u2551"
|
|
1548
|
+
},
|
|
1549
|
+
doubleSingleRounded: {
|
|
1550
|
+
tl: "\u256D",
|
|
1551
|
+
tr: "\u256E",
|
|
1552
|
+
bl: "\u2570",
|
|
1553
|
+
br: "\u256F",
|
|
1554
|
+
h: "\u2500",
|
|
1555
|
+
v: "\u2551"
|
|
1556
|
+
},
|
|
1557
|
+
singleThick: {
|
|
1558
|
+
tl: "\u250F",
|
|
1559
|
+
tr: "\u2513",
|
|
1560
|
+
bl: "\u2517",
|
|
1561
|
+
br: "\u251B",
|
|
1562
|
+
h: "\u2501",
|
|
1563
|
+
v: "\u2503"
|
|
1564
|
+
},
|
|
1565
|
+
singleDouble: {
|
|
1566
|
+
tl: "\u2552",
|
|
1567
|
+
tr: "\u2555",
|
|
1568
|
+
bl: "\u2558",
|
|
1569
|
+
br: "\u255B",
|
|
1570
|
+
h: "\u2550",
|
|
1571
|
+
v: "\u2502"
|
|
1572
|
+
},
|
|
1573
|
+
singleDoubleRounded: {
|
|
1574
|
+
tl: "\u256D",
|
|
1575
|
+
tr: "\u256E",
|
|
1576
|
+
bl: "\u2570",
|
|
1577
|
+
br: "\u256F",
|
|
1578
|
+
h: "\u2550",
|
|
1579
|
+
v: "\u2502"
|
|
1580
|
+
},
|
|
1581
|
+
rounded: {
|
|
1582
|
+
tl: "\u256D",
|
|
1583
|
+
tr: "\u256E",
|
|
1584
|
+
bl: "\u2570",
|
|
1585
|
+
br: "\u256F",
|
|
1586
|
+
h: "\u2500",
|
|
1587
|
+
v: "\u2502"
|
|
1588
|
+
}
|
|
1589
|
+
};
|
|
1590
|
+
var defaultStyle = {
|
|
1591
|
+
borderColor: "white",
|
|
1592
|
+
borderStyle: "rounded",
|
|
1593
|
+
valign: "center",
|
|
1594
|
+
padding: 2,
|
|
1595
|
+
marginLeft: 1,
|
|
1596
|
+
marginTop: 1,
|
|
1597
|
+
marginBottom: 1
|
|
1598
|
+
};
|
|
1599
|
+
function box(text, _opts = {}) {
|
|
1600
|
+
const opts = {
|
|
1601
|
+
..._opts,
|
|
1602
|
+
style: {
|
|
1603
|
+
...defaultStyle,
|
|
1604
|
+
..._opts.style
|
|
1605
|
+
}
|
|
1606
|
+
};
|
|
1607
|
+
const textLines = text.split("\n");
|
|
1608
|
+
const boxLines = [];
|
|
1609
|
+
const _color = getColor(opts.style.borderColor);
|
|
1610
|
+
const borderStyle = {
|
|
1611
|
+
...typeof opts.style.borderStyle === "string" ? boxStylePresets[opts.style.borderStyle] || boxStylePresets.solid : opts.style.borderStyle
|
|
1612
|
+
};
|
|
1613
|
+
if (_color) {
|
|
1614
|
+
for (const key in borderStyle) {
|
|
1615
|
+
borderStyle[key] = _color(
|
|
1616
|
+
borderStyle[key]
|
|
1617
|
+
);
|
|
1618
|
+
}
|
|
1619
|
+
}
|
|
1620
|
+
const paddingOffset = opts.style.padding % 2 === 0 ? opts.style.padding : opts.style.padding + 1;
|
|
1621
|
+
const height = textLines.length + paddingOffset;
|
|
1622
|
+
const width = Math.max(
|
|
1623
|
+
...textLines.map((line) => stripAnsi(line).length),
|
|
1624
|
+
opts.title ? stripAnsi(opts.title).length : 0
|
|
1625
|
+
) + paddingOffset;
|
|
1626
|
+
const widthOffset = width + paddingOffset;
|
|
1627
|
+
const leftSpace = opts.style.marginLeft > 0 ? " ".repeat(opts.style.marginLeft) : "";
|
|
1628
|
+
if (opts.style.marginTop > 0) {
|
|
1629
|
+
boxLines.push("".repeat(opts.style.marginTop));
|
|
1630
|
+
}
|
|
1631
|
+
if (opts.title) {
|
|
1632
|
+
const title = _color ? _color(opts.title) : opts.title;
|
|
1633
|
+
const left = borderStyle.h.repeat(
|
|
1634
|
+
Math.floor((width - stripAnsi(opts.title).length) / 2)
|
|
1635
|
+
);
|
|
1636
|
+
const right = borderStyle.h.repeat(
|
|
1637
|
+
width - stripAnsi(opts.title).length - stripAnsi(left).length + paddingOffset
|
|
1638
|
+
);
|
|
1639
|
+
boxLines.push(
|
|
1640
|
+
`${leftSpace}${borderStyle.tl}${left}${title}${right}${borderStyle.tr}`
|
|
1641
|
+
);
|
|
1642
|
+
} else {
|
|
1643
|
+
boxLines.push(
|
|
1644
|
+
`${leftSpace}${borderStyle.tl}${borderStyle.h.repeat(widthOffset)}${borderStyle.tr}`
|
|
1645
|
+
);
|
|
1646
|
+
}
|
|
1647
|
+
const valignOffset = opts.style.valign === "center" ? Math.floor((height - textLines.length) / 2) : opts.style.valign === "top" ? height - textLines.length - paddingOffset : height - textLines.length;
|
|
1648
|
+
for (let i3 = 0; i3 < height; i3++) {
|
|
1649
|
+
if (i3 < valignOffset || i3 >= valignOffset + textLines.length) {
|
|
1650
|
+
boxLines.push(
|
|
1651
|
+
`${leftSpace}${borderStyle.v}${" ".repeat(widthOffset)}${borderStyle.v}`
|
|
1652
|
+
);
|
|
1653
|
+
} else {
|
|
1654
|
+
const line = textLines[i3 - valignOffset];
|
|
1655
|
+
const left = " ".repeat(paddingOffset);
|
|
1656
|
+
const right = " ".repeat(width - stripAnsi(line).length);
|
|
1657
|
+
boxLines.push(
|
|
1658
|
+
`${leftSpace}${borderStyle.v}${left}${line}${right}${borderStyle.v}`
|
|
1659
|
+
);
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
boxLines.push(
|
|
1663
|
+
`${leftSpace}${borderStyle.bl}${borderStyle.h.repeat(widthOffset)}${borderStyle.br}`
|
|
1664
|
+
);
|
|
1665
|
+
if (opts.style.marginBottom > 0) {
|
|
1666
|
+
boxLines.push("".repeat(opts.style.marginBottom));
|
|
1667
|
+
}
|
|
1668
|
+
return boxLines.join("\n");
|
|
1669
|
+
}
|
|
1670
|
+
var r2 = /* @__PURE__ */ Object.create(null);
|
|
1671
|
+
var i = (e3) => globalThis.process?.env || import.meta.env || globalThis.Deno?.env.toObject() || globalThis.__env__ || (e3 ? r2 : globalThis);
|
|
1672
|
+
var o2 = new Proxy(r2, { get(e3, s3) {
|
|
1673
|
+
return i()[s3] ?? r2[s3];
|
|
1674
|
+
}, has(e3, s3) {
|
|
1675
|
+
const E2 = i();
|
|
1676
|
+
return s3 in E2 || s3 in r2;
|
|
1677
|
+
}, set(e3, s3, E2) {
|
|
1678
|
+
const B3 = i(true);
|
|
1679
|
+
return B3[s3] = E2, true;
|
|
1680
|
+
}, deleteProperty(e3, s3) {
|
|
1681
|
+
if (!s3) return false;
|
|
1682
|
+
const E2 = i(true);
|
|
1683
|
+
return delete E2[s3], true;
|
|
1684
|
+
}, ownKeys() {
|
|
1685
|
+
const e3 = i(true);
|
|
1686
|
+
return Object.keys(e3);
|
|
1687
|
+
} });
|
|
1688
|
+
var t = typeof process < "u" && process.env && process.env.NODE_ENV || "";
|
|
1689
|
+
var f2 = [["APPVEYOR"], ["AWS_AMPLIFY", "AWS_APP_ID", { ci: true }], ["AZURE_PIPELINES", "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"], ["AZURE_STATIC", "INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"], ["APPCIRCLE", "AC_APPCIRCLE"], ["BAMBOO", "bamboo_planKey"], ["BITBUCKET", "BITBUCKET_COMMIT"], ["BITRISE", "BITRISE_IO"], ["BUDDY", "BUDDY_WORKSPACE_ID"], ["BUILDKITE"], ["CIRCLE", "CIRCLECI"], ["CIRRUS", "CIRRUS_CI"], ["CLOUDFLARE_PAGES", "CF_PAGES", { ci: true }], ["CODEBUILD", "CODEBUILD_BUILD_ARN"], ["CODEFRESH", "CF_BUILD_ID"], ["DRONE"], ["DRONE", "DRONE_BUILD_EVENT"], ["DSARI"], ["GITHUB_ACTIONS"], ["GITLAB", "GITLAB_CI"], ["GITLAB", "CI_MERGE_REQUEST_ID"], ["GOCD", "GO_PIPELINE_LABEL"], ["LAYERCI"], ["HUDSON", "HUDSON_URL"], ["JENKINS", "JENKINS_URL"], ["MAGNUM"], ["NETLIFY"], ["NETLIFY", "NETLIFY_LOCAL", { ci: false }], ["NEVERCODE"], ["RENDER"], ["SAIL", "SAILCI"], ["SEMAPHORE"], ["SCREWDRIVER"], ["SHIPPABLE"], ["SOLANO", "TDDIUM"], ["STRIDER"], ["TEAMCITY", "TEAMCITY_VERSION"], ["TRAVIS"], ["VERCEL", "NOW_BUILDER"], ["VERCEL", "VERCEL", { ci: false }], ["VERCEL", "VERCEL_ENV", { ci: false }], ["APPCENTER", "APPCENTER_BUILD_ID"], ["CODESANDBOX", "CODESANDBOX_SSE", { ci: false }], ["CODESANDBOX", "CODESANDBOX_HOST", { ci: false }], ["STACKBLITZ"], ["STORMKIT"], ["CLEAVR"], ["ZEABUR"], ["CODESPHERE", "CODESPHERE_APP_ID", { ci: true }], ["RAILWAY", "RAILWAY_PROJECT_ID"], ["RAILWAY", "RAILWAY_SERVICE_ID"], ["DENO-DEPLOY", "DENO_DEPLOYMENT_ID"], ["FIREBASE_APP_HOSTING", "FIREBASE_APP_HOSTING", { ci: true }]];
|
|
1690
|
+
function b() {
|
|
1691
|
+
if (globalThis.process?.env) for (const e3 of f2) {
|
|
1692
|
+
const s3 = e3[1] || e3[0];
|
|
1693
|
+
if (globalThis.process?.env[s3]) return { name: e3[0].toLowerCase(), ...e3[2] };
|
|
1694
|
+
}
|
|
1695
|
+
return globalThis.process?.env?.SHELL === "/bin/jsh" && globalThis.process?.versions?.webcontainer ? { name: "stackblitz", ci: false } : { name: "", ci: false };
|
|
1696
|
+
}
|
|
1697
|
+
var l = b();
|
|
1698
|
+
l.name;
|
|
1699
|
+
function n(e3) {
|
|
1700
|
+
return e3 ? e3 !== "false" : false;
|
|
1701
|
+
}
|
|
1702
|
+
var I2 = globalThis.process?.platform || "";
|
|
1703
|
+
var T2 = n(o2.CI) || l.ci !== false;
|
|
1704
|
+
var a = n(globalThis.process?.stdout && globalThis.process?.stdout.isTTY);
|
|
1705
|
+
var g2 = n(o2.DEBUG);
|
|
1706
|
+
var R2 = t === "test" || n(o2.TEST);
|
|
1707
|
+
n(o2.MINIMAL) || T2 || R2 || !a;
|
|
1708
|
+
var A2 = /^win/i.test(I2);
|
|
1709
|
+
!n(o2.NO_COLOR) && (n(o2.FORCE_COLOR) || (a || A2) && o2.TERM !== "dumb" || T2);
|
|
1710
|
+
var C2 = (globalThis.process?.versions?.node || "").replace(/^v/, "") || null;
|
|
1711
|
+
Number(C2?.split(".")[0]) || null;
|
|
1712
|
+
var y2 = globalThis.process || /* @__PURE__ */ Object.create(null);
|
|
1713
|
+
var _2 = { versions: {} };
|
|
1714
|
+
new Proxy(y2, { get(e3, s3) {
|
|
1715
|
+
if (s3 === "env") return o2;
|
|
1716
|
+
if (s3 in e3) return e3[s3];
|
|
1717
|
+
if (s3 in _2) return _2[s3];
|
|
1718
|
+
} });
|
|
1719
|
+
var c2 = globalThis.process?.release?.name === "node";
|
|
1720
|
+
var O2 = !!globalThis.Bun || !!globalThis.process?.versions?.bun;
|
|
1721
|
+
var D = !!globalThis.Deno;
|
|
1722
|
+
var L2 = !!globalThis.fastly;
|
|
1723
|
+
var S2 = !!globalThis.Netlify;
|
|
1724
|
+
var u2 = !!globalThis.EdgeRuntime;
|
|
1725
|
+
var N2 = globalThis.navigator?.userAgent === "Cloudflare-Workers";
|
|
1726
|
+
var F2 = [[S2, "netlify"], [u2, "edge-light"], [N2, "workerd"], [L2, "fastly"], [D, "deno"], [O2, "bun"], [c2, "node"]];
|
|
1727
|
+
function G2() {
|
|
1728
|
+
const e3 = F2.find((s3) => s3[0]);
|
|
1729
|
+
if (e3) return { name: e3[1] };
|
|
1730
|
+
}
|
|
1731
|
+
var P2 = G2();
|
|
1732
|
+
P2?.name || "";
|
|
1733
|
+
function ansiRegex2({ onlyFirst = false } = {}) {
|
|
1734
|
+
const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
|
|
1735
|
+
const pattern = [
|
|
1736
|
+
`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`,
|
|
1737
|
+
"(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"
|
|
1738
|
+
].join("|");
|
|
1739
|
+
return new RegExp(pattern, onlyFirst ? void 0 : "g");
|
|
1740
|
+
}
|
|
1741
|
+
var regex = ansiRegex2();
|
|
1742
|
+
function stripAnsi2(string) {
|
|
1743
|
+
if (typeof string !== "string") {
|
|
1744
|
+
throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
|
1745
|
+
}
|
|
1746
|
+
return string.replace(regex, "");
|
|
1747
|
+
}
|
|
1748
|
+
function isAmbiguous(x3) {
|
|
1749
|
+
return x3 === 161 || x3 === 164 || x3 === 167 || x3 === 168 || x3 === 170 || x3 === 173 || x3 === 174 || x3 >= 176 && x3 <= 180 || x3 >= 182 && x3 <= 186 || x3 >= 188 && x3 <= 191 || x3 === 198 || x3 === 208 || x3 === 215 || x3 === 216 || x3 >= 222 && x3 <= 225 || x3 === 230 || x3 >= 232 && x3 <= 234 || x3 === 236 || x3 === 237 || x3 === 240 || x3 === 242 || x3 === 243 || x3 >= 247 && x3 <= 250 || x3 === 252 || x3 === 254 || x3 === 257 || x3 === 273 || x3 === 275 || x3 === 283 || x3 === 294 || x3 === 295 || x3 === 299 || x3 >= 305 && x3 <= 307 || x3 === 312 || x3 >= 319 && x3 <= 322 || x3 === 324 || x3 >= 328 && x3 <= 331 || x3 === 333 || x3 === 338 || x3 === 339 || x3 === 358 || x3 === 359 || x3 === 363 || x3 === 462 || x3 === 464 || x3 === 466 || x3 === 468 || x3 === 470 || x3 === 472 || x3 === 474 || x3 === 476 || x3 === 593 || x3 === 609 || x3 === 708 || x3 === 711 || x3 >= 713 && x3 <= 715 || x3 === 717 || x3 === 720 || x3 >= 728 && x3 <= 731 || x3 === 733 || x3 === 735 || x3 >= 768 && x3 <= 879 || x3 >= 913 && x3 <= 929 || x3 >= 931 && x3 <= 937 || x3 >= 945 && x3 <= 961 || x3 >= 963 && x3 <= 969 || x3 === 1025 || x3 >= 1040 && x3 <= 1103 || x3 === 1105 || x3 === 8208 || x3 >= 8211 && x3 <= 8214 || x3 === 8216 || x3 === 8217 || x3 === 8220 || x3 === 8221 || x3 >= 8224 && x3 <= 8226 || x3 >= 8228 && x3 <= 8231 || x3 === 8240 || x3 === 8242 || x3 === 8243 || x3 === 8245 || x3 === 8251 || x3 === 8254 || x3 === 8308 || x3 === 8319 || x3 >= 8321 && x3 <= 8324 || x3 === 8364 || x3 === 8451 || x3 === 8453 || x3 === 8457 || x3 === 8467 || x3 === 8470 || x3 === 8481 || x3 === 8482 || x3 === 8486 || x3 === 8491 || x3 === 8531 || x3 === 8532 || x3 >= 8539 && x3 <= 8542 || x3 >= 8544 && x3 <= 8555 || x3 >= 8560 && x3 <= 8569 || x3 === 8585 || x3 >= 8592 && x3 <= 8601 || x3 === 8632 || x3 === 8633 || x3 === 8658 || x3 === 8660 || x3 === 8679 || x3 === 8704 || x3 === 8706 || x3 === 8707 || x3 === 8711 || x3 === 8712 || x3 === 8715 || x3 === 8719 || x3 === 8721 || x3 === 8725 || x3 === 8730 || x3 >= 8733 && x3 <= 8736 || x3 === 8739 || x3 === 8741 || x3 >= 8743 && x3 <= 8748 || x3 === 8750 || x3 >= 8756 && x3 <= 8759 || x3 === 8764 || x3 === 8765 || x3 === 8776 || x3 === 8780 || x3 === 8786 || x3 === 8800 || x3 === 8801 || x3 >= 8804 && x3 <= 8807 || x3 === 8810 || x3 === 8811 || x3 === 8814 || x3 === 8815 || x3 === 8834 || x3 === 8835 || x3 === 8838 || x3 === 8839 || x3 === 8853 || x3 === 8857 || x3 === 8869 || x3 === 8895 || x3 === 8978 || x3 >= 9312 && x3 <= 9449 || x3 >= 9451 && x3 <= 9547 || x3 >= 9552 && x3 <= 9587 || x3 >= 9600 && x3 <= 9615 || x3 >= 9618 && x3 <= 9621 || x3 === 9632 || x3 === 9633 || x3 >= 9635 && x3 <= 9641 || x3 === 9650 || x3 === 9651 || x3 === 9654 || x3 === 9655 || x3 === 9660 || x3 === 9661 || x3 === 9664 || x3 === 9665 || x3 >= 9670 && x3 <= 9672 || x3 === 9675 || x3 >= 9678 && x3 <= 9681 || x3 >= 9698 && x3 <= 9701 || x3 === 9711 || x3 === 9733 || x3 === 9734 || x3 === 9737 || x3 === 9742 || x3 === 9743 || x3 === 9756 || x3 === 9758 || x3 === 9792 || x3 === 9794 || x3 === 9824 || x3 === 9825 || x3 >= 9827 && x3 <= 9829 || x3 >= 9831 && x3 <= 9834 || x3 === 9836 || x3 === 9837 || x3 === 9839 || x3 === 9886 || x3 === 9887 || x3 === 9919 || x3 >= 9926 && x3 <= 9933 || x3 >= 9935 && x3 <= 9939 || x3 >= 9941 && x3 <= 9953 || x3 === 9955 || x3 === 9960 || x3 === 9961 || x3 >= 9963 && x3 <= 9969 || x3 === 9972 || x3 >= 9974 && x3 <= 9977 || x3 === 9979 || x3 === 9980 || x3 === 9982 || x3 === 9983 || x3 === 10045 || x3 >= 10102 && x3 <= 10111 || x3 >= 11094 && x3 <= 11097 || x3 >= 12872 && x3 <= 12879 || x3 >= 57344 && x3 <= 63743 || x3 >= 65024 && x3 <= 65039 || x3 === 65533 || x3 >= 127232 && x3 <= 127242 || x3 >= 127248 && x3 <= 127277 || x3 >= 127280 && x3 <= 127337 || x3 >= 127344 && x3 <= 127373 || x3 === 127375 || x3 === 127376 || x3 >= 127387 && x3 <= 127404 || x3 >= 917760 && x3 <= 917999 || x3 >= 983040 && x3 <= 1048573 || x3 >= 1048576 && x3 <= 1114109;
|
|
1750
|
+
}
|
|
1751
|
+
function isFullWidth(x3) {
|
|
1752
|
+
return x3 === 12288 || x3 >= 65281 && x3 <= 65376 || x3 >= 65504 && x3 <= 65510;
|
|
1753
|
+
}
|
|
1754
|
+
function isWide(x3) {
|
|
1755
|
+
return x3 >= 4352 && x3 <= 4447 || x3 === 8986 || x3 === 8987 || x3 === 9001 || x3 === 9002 || x3 >= 9193 && x3 <= 9196 || x3 === 9200 || x3 === 9203 || x3 === 9725 || x3 === 9726 || x3 === 9748 || x3 === 9749 || x3 >= 9776 && x3 <= 9783 || x3 >= 9800 && x3 <= 9811 || x3 === 9855 || x3 >= 9866 && x3 <= 9871 || x3 === 9875 || x3 === 9889 || x3 === 9898 || x3 === 9899 || x3 === 9917 || x3 === 9918 || x3 === 9924 || x3 === 9925 || x3 === 9934 || x3 === 9940 || x3 === 9962 || x3 === 9970 || x3 === 9971 || x3 === 9973 || x3 === 9978 || x3 === 9981 || x3 === 9989 || x3 === 9994 || x3 === 9995 || x3 === 10024 || x3 === 10060 || x3 === 10062 || x3 >= 10067 && x3 <= 10069 || x3 === 10071 || x3 >= 10133 && x3 <= 10135 || x3 === 10160 || x3 === 10175 || x3 === 11035 || x3 === 11036 || x3 === 11088 || x3 === 11093 || x3 >= 11904 && x3 <= 11929 || x3 >= 11931 && x3 <= 12019 || x3 >= 12032 && x3 <= 12245 || x3 >= 12272 && x3 <= 12287 || x3 >= 12289 && x3 <= 12350 || x3 >= 12353 && x3 <= 12438 || x3 >= 12441 && x3 <= 12543 || x3 >= 12549 && x3 <= 12591 || x3 >= 12593 && x3 <= 12686 || x3 >= 12688 && x3 <= 12773 || x3 >= 12783 && x3 <= 12830 || x3 >= 12832 && x3 <= 12871 || x3 >= 12880 && x3 <= 42124 || x3 >= 42128 && x3 <= 42182 || x3 >= 43360 && x3 <= 43388 || x3 >= 44032 && x3 <= 55203 || x3 >= 63744 && x3 <= 64255 || x3 >= 65040 && x3 <= 65049 || x3 >= 65072 && x3 <= 65106 || x3 >= 65108 && x3 <= 65126 || x3 >= 65128 && x3 <= 65131 || x3 >= 94176 && x3 <= 94180 || x3 === 94192 || x3 === 94193 || x3 >= 94208 && x3 <= 100343 || x3 >= 100352 && x3 <= 101589 || x3 >= 101631 && x3 <= 101640 || x3 >= 110576 && x3 <= 110579 || x3 >= 110581 && x3 <= 110587 || x3 === 110589 || x3 === 110590 || x3 >= 110592 && x3 <= 110882 || x3 === 110898 || x3 >= 110928 && x3 <= 110930 || x3 === 110933 || x3 >= 110948 && x3 <= 110951 || x3 >= 110960 && x3 <= 111355 || x3 >= 119552 && x3 <= 119638 || x3 >= 119648 && x3 <= 119670 || x3 === 126980 || x3 === 127183 || x3 === 127374 || x3 >= 127377 && x3 <= 127386 || x3 >= 127488 && x3 <= 127490 || x3 >= 127504 && x3 <= 127547 || x3 >= 127552 && x3 <= 127560 || x3 === 127568 || x3 === 127569 || x3 >= 127584 && x3 <= 127589 || x3 >= 127744 && x3 <= 127776 || x3 >= 127789 && x3 <= 127797 || x3 >= 127799 && x3 <= 127868 || x3 >= 127870 && x3 <= 127891 || x3 >= 127904 && x3 <= 127946 || x3 >= 127951 && x3 <= 127955 || x3 >= 127968 && x3 <= 127984 || x3 === 127988 || x3 >= 127992 && x3 <= 128062 || x3 === 128064 || x3 >= 128066 && x3 <= 128252 || x3 >= 128255 && x3 <= 128317 || x3 >= 128331 && x3 <= 128334 || x3 >= 128336 && x3 <= 128359 || x3 === 128378 || x3 === 128405 || x3 === 128406 || x3 === 128420 || x3 >= 128507 && x3 <= 128591 || x3 >= 128640 && x3 <= 128709 || x3 === 128716 || x3 >= 128720 && x3 <= 128722 || x3 >= 128725 && x3 <= 128727 || x3 >= 128732 && x3 <= 128735 || x3 === 128747 || x3 === 128748 || x3 >= 128756 && x3 <= 128764 || x3 >= 128992 && x3 <= 129003 || x3 === 129008 || x3 >= 129292 && x3 <= 129338 || x3 >= 129340 && x3 <= 129349 || x3 >= 129351 && x3 <= 129535 || x3 >= 129648 && x3 <= 129660 || x3 >= 129664 && x3 <= 129673 || x3 >= 129679 && x3 <= 129734 || x3 >= 129742 && x3 <= 129756 || x3 >= 129759 && x3 <= 129769 || x3 >= 129776 && x3 <= 129784 || x3 >= 131072 && x3 <= 196605 || x3 >= 196608 && x3 <= 262141;
|
|
1756
|
+
}
|
|
1757
|
+
function validate(codePoint) {
|
|
1758
|
+
if (!Number.isSafeInteger(codePoint)) {
|
|
1759
|
+
throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
|
|
1760
|
+
}
|
|
1761
|
+
}
|
|
1762
|
+
function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
|
|
1763
|
+
validate(codePoint);
|
|
1764
|
+
if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) {
|
|
1765
|
+
return 2;
|
|
1766
|
+
}
|
|
1767
|
+
return 1;
|
|
1768
|
+
}
|
|
1769
|
+
var emojiRegex = () => {
|
|
1770
|
+
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;
|
|
1771
|
+
};
|
|
1772
|
+
var segmenter = globalThis.Intl?.Segmenter ? new Intl.Segmenter() : { segment: (str) => str.split("") };
|
|
1773
|
+
var defaultIgnorableCodePointRegex = new RegExp("^\\p{Default_Ignorable_Code_Point}$", "u");
|
|
1774
|
+
function stringWidth$1(string, options = {}) {
|
|
1775
|
+
if (typeof string !== "string" || string.length === 0) {
|
|
1776
|
+
return 0;
|
|
1777
|
+
}
|
|
1778
|
+
const {
|
|
1779
|
+
ambiguousIsNarrow = true,
|
|
1780
|
+
countAnsiEscapeCodes = false
|
|
1781
|
+
} = options;
|
|
1782
|
+
if (!countAnsiEscapeCodes) {
|
|
1783
|
+
string = stripAnsi2(string);
|
|
1784
|
+
}
|
|
1785
|
+
if (string.length === 0) {
|
|
1786
|
+
return 0;
|
|
1787
|
+
}
|
|
1788
|
+
let width = 0;
|
|
1789
|
+
const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
|
|
1790
|
+
for (const { segment: character } of segmenter.segment(string)) {
|
|
1791
|
+
const codePoint = character.codePointAt(0);
|
|
1792
|
+
if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
|
|
1793
|
+
continue;
|
|
1794
|
+
}
|
|
1795
|
+
if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) {
|
|
1796
|
+
continue;
|
|
1797
|
+
}
|
|
1798
|
+
if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) {
|
|
1799
|
+
continue;
|
|
1800
|
+
}
|
|
1801
|
+
if (codePoint >= 55296 && codePoint <= 57343) {
|
|
1802
|
+
continue;
|
|
1803
|
+
}
|
|
1804
|
+
if (codePoint >= 65024 && codePoint <= 65039) {
|
|
1805
|
+
continue;
|
|
1806
|
+
}
|
|
1807
|
+
if (defaultIgnorableCodePointRegex.test(character)) {
|
|
1808
|
+
continue;
|
|
1809
|
+
}
|
|
1810
|
+
if (emojiRegex().test(character)) {
|
|
1811
|
+
width += 2;
|
|
1812
|
+
continue;
|
|
1813
|
+
}
|
|
1814
|
+
width += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
|
1815
|
+
}
|
|
1816
|
+
return width;
|
|
1817
|
+
}
|
|
1818
|
+
function isUnicodeSupported() {
|
|
1819
|
+
const { env: env2 } = g;
|
|
1820
|
+
const { TERM, TERM_PROGRAM } = env2;
|
|
1821
|
+
if (g.platform !== "win32") {
|
|
1822
|
+
return TERM !== "linux";
|
|
1823
|
+
}
|
|
1824
|
+
return Boolean(env2.WT_SESSION) || Boolean(env2.TERMINUS_SUBLIME) || env2.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env2.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
1825
|
+
}
|
|
1826
|
+
var TYPE_COLOR_MAP = {
|
|
1827
|
+
info: "cyan",
|
|
1828
|
+
fail: "red",
|
|
1829
|
+
success: "green",
|
|
1830
|
+
ready: "green",
|
|
1831
|
+
start: "magenta"
|
|
1832
|
+
};
|
|
1833
|
+
var LEVEL_COLOR_MAP = {
|
|
1834
|
+
0: "red",
|
|
1835
|
+
1: "yellow"
|
|
1836
|
+
};
|
|
1837
|
+
var unicode = isUnicodeSupported();
|
|
1838
|
+
var s = (c4, fallback) => unicode ? c4 : fallback;
|
|
1839
|
+
var TYPE_ICONS = {
|
|
1840
|
+
error: s("\u2716", "\xD7"),
|
|
1841
|
+
fatal: s("\u2716", "\xD7"),
|
|
1842
|
+
ready: s("\u2714", "\u221A"),
|
|
1843
|
+
warn: s("\u26A0", "\u203C"),
|
|
1844
|
+
info: s("\u2139", "i"),
|
|
1845
|
+
success: s("\u2714", "\u221A"),
|
|
1846
|
+
debug: s("\u2699", "D"),
|
|
1847
|
+
trace: s("\u2192", "\u2192"),
|
|
1848
|
+
fail: s("\u2716", "\xD7"),
|
|
1849
|
+
start: s("\u25D0", "o"),
|
|
1850
|
+
log: ""
|
|
1851
|
+
};
|
|
1852
|
+
function stringWidth(str) {
|
|
1853
|
+
const hasICU = typeof Intl === "object";
|
|
1854
|
+
if (!hasICU || !Intl.Segmenter) {
|
|
1855
|
+
return stripAnsi(str).length;
|
|
1856
|
+
}
|
|
1857
|
+
return stringWidth$1(str);
|
|
1858
|
+
}
|
|
1859
|
+
var FancyReporter = class extends BasicReporter {
|
|
1860
|
+
formatStack(stack, message, opts) {
|
|
1861
|
+
const indent = " ".repeat((opts?.errorLevel || 0) + 1);
|
|
1862
|
+
return `
|
|
1863
|
+
${indent}` + parseStack(stack, message).map(
|
|
1864
|
+
(line) => " " + line.replace(/^at +/, (m3) => colors.gray(m3)).replace(/\((.+)\)/, (_4, m3) => `(${colors.cyan(m3)})`)
|
|
1865
|
+
).join(`
|
|
1866
|
+
${indent}`);
|
|
1867
|
+
}
|
|
1868
|
+
formatType(logObj, isBadge, opts) {
|
|
1869
|
+
const typeColor = TYPE_COLOR_MAP[logObj.type] || LEVEL_COLOR_MAP[logObj.level] || "gray";
|
|
1870
|
+
if (isBadge) {
|
|
1871
|
+
return getBgColor(typeColor)(
|
|
1872
|
+
colors.black(` ${logObj.type.toUpperCase()} `)
|
|
1873
|
+
);
|
|
1874
|
+
}
|
|
1875
|
+
const _type = typeof TYPE_ICONS[logObj.type] === "string" ? TYPE_ICONS[logObj.type] : logObj.icon || logObj.type;
|
|
1876
|
+
return _type ? getColor2(typeColor)(_type) : "";
|
|
1877
|
+
}
|
|
1878
|
+
formatLogObj(logObj, opts) {
|
|
1879
|
+
const [message, ...additional] = this.formatArgs(logObj.args, opts).split(
|
|
1880
|
+
"\n"
|
|
1881
|
+
);
|
|
1882
|
+
if (logObj.type === "box") {
|
|
1883
|
+
return box(
|
|
1884
|
+
characterFormat(
|
|
1885
|
+
message + (additional.length > 0 ? "\n" + additional.join("\n") : "")
|
|
1886
|
+
),
|
|
1887
|
+
{
|
|
1888
|
+
title: logObj.title ? characterFormat(logObj.title) : void 0,
|
|
1889
|
+
style: logObj.style
|
|
1890
|
+
}
|
|
1891
|
+
);
|
|
1892
|
+
}
|
|
1893
|
+
const date = this.formatDate(logObj.date, opts);
|
|
1894
|
+
const coloredDate = date && colors.gray(date);
|
|
1895
|
+
const isBadge = logObj.badge ?? logObj.level < 2;
|
|
1896
|
+
const type = this.formatType(logObj, isBadge, opts);
|
|
1897
|
+
const tag = logObj.tag ? colors.gray(logObj.tag) : "";
|
|
1898
|
+
let line;
|
|
1899
|
+
const left = this.filterAndJoin([type, characterFormat(message)]);
|
|
1900
|
+
const right = this.filterAndJoin(opts.columns ? [tag, coloredDate] : [tag]);
|
|
1901
|
+
const space = (opts.columns || 0) - stringWidth(left) - stringWidth(right) - 2;
|
|
1902
|
+
line = space > 0 && (opts.columns || 0) >= 80 ? left + " ".repeat(space) + right : (right ? `${colors.gray(`[${right}]`)} ` : "") + left;
|
|
1903
|
+
line += characterFormat(
|
|
1904
|
+
additional.length > 0 ? "\n" + additional.join("\n") : ""
|
|
1905
|
+
);
|
|
1906
|
+
if (logObj.type === "trace") {
|
|
1907
|
+
const _err = new Error("Trace: " + logObj.message);
|
|
1908
|
+
line += this.formatStack(_err.stack || "", _err.message);
|
|
1909
|
+
}
|
|
1910
|
+
return isBadge ? "\n" + line + "\n" : line;
|
|
1911
|
+
}
|
|
1912
|
+
};
|
|
1913
|
+
function characterFormat(str) {
|
|
1914
|
+
return str.replace(/`([^`]+)`/gm, (_4, m3) => colors.cyan(m3)).replace(/\s+_([^_]+)_\s+/gm, (_4, m3) => ` ${colors.underline(m3)} `);
|
|
1915
|
+
}
|
|
1916
|
+
function getColor2(color = "white") {
|
|
1917
|
+
return colors[color] || colors.white;
|
|
1918
|
+
}
|
|
1919
|
+
function getBgColor(color = "bgWhite") {
|
|
1920
|
+
return colors[`bg${color[0].toUpperCase()}${color.slice(1)}`] || colors.bgWhite;
|
|
1921
|
+
}
|
|
1922
|
+
function createConsola2(options = {}) {
|
|
1923
|
+
let level = _getDefaultLogLevel();
|
|
1924
|
+
if (process.env.CONSOLA_LEVEL) {
|
|
1925
|
+
level = Number.parseInt(process.env.CONSOLA_LEVEL) ?? level;
|
|
1926
|
+
}
|
|
1927
|
+
const consola2 = createConsola({
|
|
1928
|
+
level,
|
|
1929
|
+
defaults: { level },
|
|
1930
|
+
stdout: process.stdout,
|
|
1931
|
+
stderr: process.stderr,
|
|
1932
|
+
prompt: (...args) => Promise.resolve().then(() => (init_prompt(), prompt_exports)).then((m3) => m3.prompt(...args)),
|
|
1933
|
+
reporters: options.reporters || [
|
|
1934
|
+
options.fancy ?? !(T2 || R2) ? new FancyReporter() : new BasicReporter()
|
|
1935
|
+
],
|
|
1936
|
+
...options
|
|
1937
|
+
});
|
|
1938
|
+
return consola2;
|
|
1939
|
+
}
|
|
1940
|
+
function _getDefaultLogLevel() {
|
|
1941
|
+
if (g2) {
|
|
1942
|
+
return LogLevels.debug;
|
|
1943
|
+
}
|
|
1944
|
+
if (R2) {
|
|
1945
|
+
return LogLevels.warn;
|
|
1946
|
+
}
|
|
1947
|
+
return LogLevels.info;
|
|
1948
|
+
}
|
|
1949
|
+
var consola = createConsola2();
|
|
1950
|
+
|
|
1951
|
+
// node_modules/citty/dist/index.mjs
|
|
1952
|
+
function toArray(val) {
|
|
1953
|
+
if (Array.isArray(val)) {
|
|
1954
|
+
return val;
|
|
1955
|
+
}
|
|
1956
|
+
return val === void 0 ? [] : [val];
|
|
1957
|
+
}
|
|
1958
|
+
function formatLineColumns(lines, linePrefix = "") {
|
|
1959
|
+
const maxLengh = [];
|
|
1960
|
+
for (const line of lines) {
|
|
1961
|
+
for (const [i3, element] of line.entries()) {
|
|
1962
|
+
maxLengh[i3] = Math.max(maxLengh[i3] || 0, element.length);
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
return lines.map(
|
|
1966
|
+
(l3) => l3.map(
|
|
1967
|
+
(c4, i3) => linePrefix + c4[i3 === 0 ? "padStart" : "padEnd"](maxLengh[i3])
|
|
1968
|
+
).join(" ")
|
|
1969
|
+
).join("\n");
|
|
1970
|
+
}
|
|
1971
|
+
function resolveValue(input) {
|
|
1972
|
+
return typeof input === "function" ? input() : input;
|
|
1973
|
+
}
|
|
1974
|
+
var CLIError = class extends Error {
|
|
1975
|
+
constructor(message, code) {
|
|
1976
|
+
super(message);
|
|
1977
|
+
this.code = code;
|
|
1978
|
+
this.name = "CLIError";
|
|
1979
|
+
}
|
|
1980
|
+
};
|
|
1981
|
+
var NUMBER_CHAR_RE = /\d/;
|
|
1982
|
+
var STR_SPLITTERS = ["-", "_", "/", "."];
|
|
1983
|
+
function isUppercase(char = "") {
|
|
1984
|
+
if (NUMBER_CHAR_RE.test(char)) {
|
|
1985
|
+
return void 0;
|
|
1986
|
+
}
|
|
1987
|
+
return char !== char.toLowerCase();
|
|
1988
|
+
}
|
|
1989
|
+
function splitByCase(str, separators) {
|
|
1990
|
+
const splitters = STR_SPLITTERS;
|
|
1991
|
+
const parts = [];
|
|
1992
|
+
if (!str || typeof str !== "string") {
|
|
1993
|
+
return parts;
|
|
1994
|
+
}
|
|
1995
|
+
let buff = "";
|
|
1996
|
+
let previousUpper;
|
|
1997
|
+
let previousSplitter;
|
|
1998
|
+
for (const char of str) {
|
|
1999
|
+
const isSplitter = splitters.includes(char);
|
|
2000
|
+
if (isSplitter === true) {
|
|
2001
|
+
parts.push(buff);
|
|
2002
|
+
buff = "";
|
|
2003
|
+
previousUpper = void 0;
|
|
2004
|
+
continue;
|
|
2005
|
+
}
|
|
2006
|
+
const isUpper = isUppercase(char);
|
|
2007
|
+
if (previousSplitter === false) {
|
|
2008
|
+
if (previousUpper === false && isUpper === true) {
|
|
2009
|
+
parts.push(buff);
|
|
2010
|
+
buff = char;
|
|
2011
|
+
previousUpper = isUpper;
|
|
2012
|
+
continue;
|
|
2013
|
+
}
|
|
2014
|
+
if (previousUpper === true && isUpper === false && buff.length > 1) {
|
|
2015
|
+
const lastChar = buff.at(-1);
|
|
2016
|
+
parts.push(buff.slice(0, Math.max(0, buff.length - 1)));
|
|
2017
|
+
buff = lastChar + char;
|
|
2018
|
+
previousUpper = isUpper;
|
|
2019
|
+
continue;
|
|
2020
|
+
}
|
|
2021
|
+
}
|
|
2022
|
+
buff += char;
|
|
2023
|
+
previousUpper = isUpper;
|
|
2024
|
+
previousSplitter = isSplitter;
|
|
2025
|
+
}
|
|
2026
|
+
parts.push(buff);
|
|
2027
|
+
return parts;
|
|
2028
|
+
}
|
|
2029
|
+
function upperFirst(str) {
|
|
2030
|
+
return str ? str[0].toUpperCase() + str.slice(1) : "";
|
|
2031
|
+
}
|
|
2032
|
+
function lowerFirst(str) {
|
|
2033
|
+
return str ? str[0].toLowerCase() + str.slice(1) : "";
|
|
2034
|
+
}
|
|
2035
|
+
function pascalCase(str, opts) {
|
|
2036
|
+
return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p2) => upperFirst(p2)).join("") : "";
|
|
2037
|
+
}
|
|
2038
|
+
function camelCase(str, opts) {
|
|
2039
|
+
return lowerFirst(pascalCase(str || ""));
|
|
2040
|
+
}
|
|
2041
|
+
function kebabCase(str, joiner) {
|
|
2042
|
+
return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p2) => p2.toLowerCase()).join("-") : "";
|
|
2043
|
+
}
|
|
2044
|
+
function toArr(any) {
|
|
2045
|
+
return any == void 0 ? [] : Array.isArray(any) ? any : [any];
|
|
2046
|
+
}
|
|
2047
|
+
function toVal(out, key, val, opts) {
|
|
2048
|
+
let x3;
|
|
2049
|
+
const old = out[key];
|
|
2050
|
+
const nxt = ~opts.string.indexOf(key) ? val == void 0 || val === true ? "" : String(val) : typeof val === "boolean" ? val : ~opts.boolean.indexOf(key) ? val === "false" ? false : val === "true" || (out._.push((x3 = +val, x3 * 0 === 0) ? x3 : val), !!val) : (x3 = +val, x3 * 0 === 0) ? x3 : val;
|
|
2051
|
+
out[key] = old == void 0 ? nxt : Array.isArray(old) ? old.concat(nxt) : [old, nxt];
|
|
2052
|
+
}
|
|
2053
|
+
function parseRawArgs(args = [], opts = {}) {
|
|
2054
|
+
let k3;
|
|
2055
|
+
let arr;
|
|
2056
|
+
let arg;
|
|
2057
|
+
let name;
|
|
2058
|
+
let val;
|
|
2059
|
+
const out = { _: [] };
|
|
2060
|
+
let i3 = 0;
|
|
2061
|
+
let j2 = 0;
|
|
2062
|
+
let idx = 0;
|
|
2063
|
+
const len = args.length;
|
|
2064
|
+
const alibi = opts.alias !== void 0;
|
|
2065
|
+
const strict = opts.unknown !== void 0;
|
|
2066
|
+
const defaults = opts.default !== void 0;
|
|
2067
|
+
opts.alias = opts.alias || {};
|
|
2068
|
+
opts.string = toArr(opts.string);
|
|
2069
|
+
opts.boolean = toArr(opts.boolean);
|
|
2070
|
+
if (alibi) {
|
|
2071
|
+
for (k3 in opts.alias) {
|
|
2072
|
+
arr = opts.alias[k3] = toArr(opts.alias[k3]);
|
|
2073
|
+
for (i3 = 0; i3 < arr.length; i3++) {
|
|
2074
|
+
(opts.alias[arr[i3]] = arr.concat(k3)).splice(i3, 1);
|
|
2075
|
+
}
|
|
2076
|
+
}
|
|
2077
|
+
}
|
|
2078
|
+
for (i3 = opts.boolean.length; i3-- > 0; ) {
|
|
2079
|
+
arr = opts.alias[opts.boolean[i3]] || [];
|
|
2080
|
+
for (j2 = arr.length; j2-- > 0; ) {
|
|
2081
|
+
opts.boolean.push(arr[j2]);
|
|
2082
|
+
}
|
|
2083
|
+
}
|
|
2084
|
+
for (i3 = opts.string.length; i3-- > 0; ) {
|
|
2085
|
+
arr = opts.alias[opts.string[i3]] || [];
|
|
2086
|
+
for (j2 = arr.length; j2-- > 0; ) {
|
|
2087
|
+
opts.string.push(arr[j2]);
|
|
2088
|
+
}
|
|
2089
|
+
}
|
|
2090
|
+
if (defaults) {
|
|
2091
|
+
for (k3 in opts.default) {
|
|
2092
|
+
name = typeof opts.default[k3];
|
|
2093
|
+
arr = opts.alias[k3] = opts.alias[k3] || [];
|
|
2094
|
+
if (opts[name] !== void 0) {
|
|
2095
|
+
opts[name].push(k3);
|
|
2096
|
+
for (i3 = 0; i3 < arr.length; i3++) {
|
|
2097
|
+
opts[name].push(arr[i3]);
|
|
2098
|
+
}
|
|
2099
|
+
}
|
|
2100
|
+
}
|
|
2101
|
+
}
|
|
2102
|
+
const keys = strict ? Object.keys(opts.alias) : [];
|
|
2103
|
+
for (i3 = 0; i3 < len; i3++) {
|
|
2104
|
+
arg = args[i3];
|
|
2105
|
+
if (arg === "--") {
|
|
2106
|
+
out._ = out._.concat(args.slice(++i3));
|
|
2107
|
+
break;
|
|
2108
|
+
}
|
|
2109
|
+
for (j2 = 0; j2 < arg.length; j2++) {
|
|
2110
|
+
if (arg.charCodeAt(j2) !== 45) {
|
|
2111
|
+
break;
|
|
2112
|
+
}
|
|
2113
|
+
}
|
|
2114
|
+
if (j2 === 0) {
|
|
2115
|
+
out._.push(arg);
|
|
2116
|
+
} else if (arg.substring(j2, j2 + 3) === "no-") {
|
|
2117
|
+
name = arg.slice(Math.max(0, j2 + 3));
|
|
2118
|
+
if (strict && !~keys.indexOf(name)) {
|
|
2119
|
+
return opts.unknown(arg);
|
|
2120
|
+
}
|
|
2121
|
+
out[name] = false;
|
|
2122
|
+
} else {
|
|
2123
|
+
for (idx = j2 + 1; idx < arg.length; idx++) {
|
|
2124
|
+
if (arg.charCodeAt(idx) === 61) {
|
|
2125
|
+
break;
|
|
2126
|
+
}
|
|
2127
|
+
}
|
|
2128
|
+
name = arg.substring(j2, idx);
|
|
2129
|
+
val = arg.slice(Math.max(0, ++idx)) || i3 + 1 === len || ("" + args[i3 + 1]).charCodeAt(0) === 45 || args[++i3];
|
|
2130
|
+
arr = j2 === 2 ? [name] : name;
|
|
2131
|
+
for (idx = 0; idx < arr.length; idx++) {
|
|
2132
|
+
name = arr[idx];
|
|
2133
|
+
if (strict && !~keys.indexOf(name)) {
|
|
2134
|
+
return opts.unknown("-".repeat(j2) + name);
|
|
2135
|
+
}
|
|
2136
|
+
toVal(out, name, idx + 1 < arr.length || val, opts);
|
|
2137
|
+
}
|
|
2138
|
+
}
|
|
2139
|
+
}
|
|
2140
|
+
if (defaults) {
|
|
2141
|
+
for (k3 in opts.default) {
|
|
2142
|
+
if (out[k3] === void 0) {
|
|
2143
|
+
out[k3] = opts.default[k3];
|
|
2144
|
+
}
|
|
2145
|
+
}
|
|
2146
|
+
}
|
|
2147
|
+
if (alibi) {
|
|
2148
|
+
for (k3 in out) {
|
|
2149
|
+
arr = opts.alias[k3] || [];
|
|
2150
|
+
while (arr.length > 0) {
|
|
2151
|
+
out[arr.shift()] = out[k3];
|
|
2152
|
+
}
|
|
2153
|
+
}
|
|
2154
|
+
}
|
|
2155
|
+
return out;
|
|
2156
|
+
}
|
|
2157
|
+
function parseArgs(rawArgs, argsDef) {
|
|
2158
|
+
const parseOptions = {
|
|
2159
|
+
boolean: [],
|
|
2160
|
+
string: [],
|
|
2161
|
+
mixed: [],
|
|
2162
|
+
alias: {},
|
|
2163
|
+
default: {}
|
|
2164
|
+
};
|
|
2165
|
+
const args = resolveArgs(argsDef);
|
|
2166
|
+
for (const arg of args) {
|
|
2167
|
+
if (arg.type === "positional") {
|
|
2168
|
+
continue;
|
|
2169
|
+
}
|
|
2170
|
+
if (arg.type === "string") {
|
|
2171
|
+
parseOptions.string.push(arg.name);
|
|
2172
|
+
} else if (arg.type === "boolean") {
|
|
2173
|
+
parseOptions.boolean.push(arg.name);
|
|
2174
|
+
}
|
|
2175
|
+
if (arg.default !== void 0) {
|
|
2176
|
+
parseOptions.default[arg.name] = arg.default;
|
|
2177
|
+
}
|
|
2178
|
+
if (arg.alias) {
|
|
2179
|
+
parseOptions.alias[arg.name] = arg.alias;
|
|
2180
|
+
}
|
|
2181
|
+
}
|
|
2182
|
+
const parsed = parseRawArgs(rawArgs, parseOptions);
|
|
2183
|
+
const [...positionalArguments] = parsed._;
|
|
2184
|
+
const parsedArgsProxy = new Proxy(parsed, {
|
|
2185
|
+
get(target, prop) {
|
|
2186
|
+
return target[prop] ?? target[camelCase(prop)] ?? target[kebabCase(prop)];
|
|
2187
|
+
}
|
|
2188
|
+
});
|
|
2189
|
+
for (const [, arg] of args.entries()) {
|
|
2190
|
+
if (arg.type === "positional") {
|
|
2191
|
+
const nextPositionalArgument = positionalArguments.shift();
|
|
2192
|
+
if (nextPositionalArgument !== void 0) {
|
|
2193
|
+
parsedArgsProxy[arg.name] = nextPositionalArgument;
|
|
2194
|
+
} else if (arg.default === void 0 && arg.required !== false) {
|
|
2195
|
+
throw new CLIError(
|
|
2196
|
+
`Missing required positional argument: ${arg.name.toUpperCase()}`,
|
|
2197
|
+
"EARG"
|
|
2198
|
+
);
|
|
2199
|
+
} else {
|
|
2200
|
+
parsedArgsProxy[arg.name] = arg.default;
|
|
2201
|
+
}
|
|
2202
|
+
} else if (arg.required && parsedArgsProxy[arg.name] === void 0) {
|
|
2203
|
+
throw new CLIError(`Missing required argument: --${arg.name}`, "EARG");
|
|
2204
|
+
}
|
|
2205
|
+
}
|
|
2206
|
+
return parsedArgsProxy;
|
|
2207
|
+
}
|
|
2208
|
+
function resolveArgs(argsDef) {
|
|
2209
|
+
const args = [];
|
|
2210
|
+
for (const [name, argDef] of Object.entries(argsDef || {})) {
|
|
2211
|
+
args.push({
|
|
2212
|
+
...argDef,
|
|
2213
|
+
name,
|
|
2214
|
+
alias: toArray(argDef.alias)
|
|
2215
|
+
});
|
|
2216
|
+
}
|
|
2217
|
+
return args;
|
|
2218
|
+
}
|
|
2219
|
+
function defineCommand(def) {
|
|
2220
|
+
return def;
|
|
2221
|
+
}
|
|
2222
|
+
async function runCommand(cmd, opts) {
|
|
2223
|
+
const cmdArgs = await resolveValue(cmd.args || {});
|
|
2224
|
+
const parsedArgs = parseArgs(opts.rawArgs, cmdArgs);
|
|
2225
|
+
const context = {
|
|
2226
|
+
rawArgs: opts.rawArgs,
|
|
2227
|
+
args: parsedArgs,
|
|
2228
|
+
data: opts.data,
|
|
2229
|
+
cmd
|
|
2230
|
+
};
|
|
2231
|
+
if (typeof cmd.setup === "function") {
|
|
2232
|
+
await cmd.setup(context);
|
|
2233
|
+
}
|
|
2234
|
+
let result;
|
|
2235
|
+
try {
|
|
2236
|
+
const subCommands = await resolveValue(cmd.subCommands);
|
|
2237
|
+
if (subCommands && Object.keys(subCommands).length > 0) {
|
|
2238
|
+
const subCommandArgIndex = opts.rawArgs.findIndex(
|
|
2239
|
+
(arg) => !arg.startsWith("-")
|
|
2240
|
+
);
|
|
2241
|
+
const subCommandName = opts.rawArgs[subCommandArgIndex];
|
|
2242
|
+
if (subCommandName) {
|
|
2243
|
+
if (!subCommands[subCommandName]) {
|
|
2244
|
+
throw new CLIError(
|
|
2245
|
+
`Unknown command \`${subCommandName}\``,
|
|
2246
|
+
"E_UNKNOWN_COMMAND"
|
|
2247
|
+
);
|
|
2248
|
+
}
|
|
2249
|
+
const subCommand = await resolveValue(subCommands[subCommandName]);
|
|
2250
|
+
if (subCommand) {
|
|
2251
|
+
await runCommand(subCommand, {
|
|
2252
|
+
rawArgs: opts.rawArgs.slice(subCommandArgIndex + 1)
|
|
2253
|
+
});
|
|
2254
|
+
}
|
|
2255
|
+
} else if (!cmd.run) {
|
|
2256
|
+
throw new CLIError(`No command specified.`, "E_NO_COMMAND");
|
|
2257
|
+
}
|
|
2258
|
+
}
|
|
2259
|
+
if (typeof cmd.run === "function") {
|
|
2260
|
+
result = await cmd.run(context);
|
|
2261
|
+
}
|
|
2262
|
+
} finally {
|
|
2263
|
+
if (typeof cmd.cleanup === "function") {
|
|
2264
|
+
await cmd.cleanup(context);
|
|
2265
|
+
}
|
|
2266
|
+
}
|
|
2267
|
+
return { result };
|
|
2268
|
+
}
|
|
2269
|
+
async function resolveSubCommand(cmd, rawArgs, parent) {
|
|
2270
|
+
const subCommands = await resolveValue(cmd.subCommands);
|
|
2271
|
+
if (subCommands && Object.keys(subCommands).length > 0) {
|
|
2272
|
+
const subCommandArgIndex = rawArgs.findIndex((arg) => !arg.startsWith("-"));
|
|
2273
|
+
const subCommandName = rawArgs[subCommandArgIndex];
|
|
2274
|
+
const subCommand = await resolveValue(subCommands[subCommandName]);
|
|
2275
|
+
if (subCommand) {
|
|
2276
|
+
return resolveSubCommand(
|
|
2277
|
+
subCommand,
|
|
2278
|
+
rawArgs.slice(subCommandArgIndex + 1),
|
|
2279
|
+
cmd
|
|
2280
|
+
);
|
|
2281
|
+
}
|
|
2282
|
+
}
|
|
2283
|
+
return [cmd, parent];
|
|
2284
|
+
}
|
|
2285
|
+
async function showUsage(cmd, parent) {
|
|
2286
|
+
try {
|
|
2287
|
+
consola.log(await renderUsage(cmd, parent) + "\n");
|
|
2288
|
+
} catch (error) {
|
|
2289
|
+
consola.error(error);
|
|
2290
|
+
}
|
|
2291
|
+
}
|
|
2292
|
+
async function renderUsage(cmd, parent) {
|
|
2293
|
+
const cmdMeta = await resolveValue(cmd.meta || {});
|
|
2294
|
+
const cmdArgs = resolveArgs(await resolveValue(cmd.args || {}));
|
|
2295
|
+
const parentMeta = await resolveValue(parent?.meta || {});
|
|
2296
|
+
const commandName = `${parentMeta.name ? `${parentMeta.name} ` : ""}` + (cmdMeta.name || process.argv[1]);
|
|
2297
|
+
const argLines = [];
|
|
2298
|
+
const posLines = [];
|
|
2299
|
+
const commandsLines = [];
|
|
2300
|
+
const usageLine = [];
|
|
2301
|
+
for (const arg of cmdArgs) {
|
|
2302
|
+
if (arg.type === "positional") {
|
|
2303
|
+
const name = arg.name.toUpperCase();
|
|
2304
|
+
const isRequired = arg.required !== false && arg.default === void 0;
|
|
2305
|
+
const defaultHint = arg.default ? `="${arg.default}"` : "";
|
|
2306
|
+
posLines.push([
|
|
2307
|
+
"`" + name + defaultHint + "`",
|
|
2308
|
+
arg.description || "",
|
|
2309
|
+
arg.valueHint ? `<${arg.valueHint}>` : ""
|
|
2310
|
+
]);
|
|
2311
|
+
usageLine.push(isRequired ? `<${name}>` : `[${name}]`);
|
|
2312
|
+
} else {
|
|
2313
|
+
const isRequired = arg.required === true && arg.default === void 0;
|
|
2314
|
+
const argStr = (arg.type === "boolean" && arg.default === true ? [
|
|
2315
|
+
...(arg.alias || []).map((a3) => `--no-${a3}`),
|
|
2316
|
+
`--no-${arg.name}`
|
|
2317
|
+
].join(", ") : [...(arg.alias || []).map((a3) => `-${a3}`), `--${arg.name}`].join(
|
|
2318
|
+
", "
|
|
2319
|
+
)) + (arg.type === "string" && (arg.valueHint || arg.default) ? `=${arg.valueHint ? `<${arg.valueHint}>` : `"${arg.default || ""}"`}` : "");
|
|
2320
|
+
argLines.push([
|
|
2321
|
+
"`" + argStr + (isRequired ? " (required)" : "") + "`",
|
|
2322
|
+
arg.description || ""
|
|
2323
|
+
]);
|
|
2324
|
+
if (isRequired) {
|
|
2325
|
+
usageLine.push(argStr);
|
|
2326
|
+
}
|
|
2327
|
+
}
|
|
2328
|
+
}
|
|
2329
|
+
if (cmd.subCommands) {
|
|
2330
|
+
const commandNames = [];
|
|
2331
|
+
const subCommands = await resolveValue(cmd.subCommands);
|
|
2332
|
+
for (const [name, sub] of Object.entries(subCommands)) {
|
|
2333
|
+
const subCmd = await resolveValue(sub);
|
|
2334
|
+
const meta = await resolveValue(subCmd?.meta);
|
|
2335
|
+
commandsLines.push([`\`${name}\``, meta?.description || ""]);
|
|
2336
|
+
commandNames.push(name);
|
|
2337
|
+
}
|
|
2338
|
+
usageLine.push(commandNames.join("|"));
|
|
2339
|
+
}
|
|
2340
|
+
const usageLines = [];
|
|
2341
|
+
const version = cmdMeta.version || parentMeta.version;
|
|
2342
|
+
usageLines.push(
|
|
2343
|
+
colors.gray(
|
|
2344
|
+
`${cmdMeta.description} (${commandName + (version ? ` v${version}` : "")})`
|
|
2345
|
+
),
|
|
2346
|
+
""
|
|
2347
|
+
);
|
|
2348
|
+
const hasOptions = argLines.length > 0 || posLines.length > 0;
|
|
2349
|
+
usageLines.push(
|
|
2350
|
+
`${colors.underline(colors.bold("USAGE"))} \`${commandName}${hasOptions ? " [OPTIONS]" : ""} ${usageLine.join(" ")}\``,
|
|
2351
|
+
""
|
|
2352
|
+
);
|
|
2353
|
+
if (posLines.length > 0) {
|
|
2354
|
+
usageLines.push(colors.underline(colors.bold("ARGUMENTS")), "");
|
|
2355
|
+
usageLines.push(formatLineColumns(posLines, " "));
|
|
2356
|
+
usageLines.push("");
|
|
2357
|
+
}
|
|
2358
|
+
if (argLines.length > 0) {
|
|
2359
|
+
usageLines.push(colors.underline(colors.bold("OPTIONS")), "");
|
|
2360
|
+
usageLines.push(formatLineColumns(argLines, " "));
|
|
2361
|
+
usageLines.push("");
|
|
2362
|
+
}
|
|
2363
|
+
if (commandsLines.length > 0) {
|
|
2364
|
+
usageLines.push(colors.underline(colors.bold("COMMANDS")), "");
|
|
2365
|
+
usageLines.push(formatLineColumns(commandsLines, " "));
|
|
2366
|
+
usageLines.push(
|
|
2367
|
+
"",
|
|
2368
|
+
`Use \`${commandName} <command> --help\` for more information about a command.`
|
|
2369
|
+
);
|
|
2370
|
+
}
|
|
2371
|
+
return usageLines.filter((l3) => typeof l3 === "string").join("\n");
|
|
2372
|
+
}
|
|
2373
|
+
async function runMain(cmd, opts = {}) {
|
|
2374
|
+
const rawArgs = opts.rawArgs || process.argv.slice(2);
|
|
2375
|
+
const showUsage$1 = opts.showUsage || showUsage;
|
|
2376
|
+
try {
|
|
2377
|
+
if (rawArgs.includes("--help") || rawArgs.includes("-h")) {
|
|
2378
|
+
await showUsage$1(...await resolveSubCommand(cmd, rawArgs));
|
|
2379
|
+
process.exit(0);
|
|
2380
|
+
} else if (rawArgs.length === 1 && rawArgs[0] === "--version") {
|
|
2381
|
+
const meta = typeof cmd.meta === "function" ? await cmd.meta() : await cmd.meta;
|
|
2382
|
+
if (!meta?.version) {
|
|
2383
|
+
throw new CLIError("No version specified", "E_NO_VERSION");
|
|
2384
|
+
}
|
|
2385
|
+
consola.log(meta.version);
|
|
2386
|
+
} else {
|
|
2387
|
+
await runCommand(cmd, { rawArgs });
|
|
2388
|
+
}
|
|
2389
|
+
} catch (error) {
|
|
2390
|
+
const isCLIError = error instanceof CLIError;
|
|
2391
|
+
if (!isCLIError) {
|
|
2392
|
+
consola.error(error, "\n");
|
|
2393
|
+
}
|
|
2394
|
+
if (isCLIError) {
|
|
2395
|
+
await showUsage$1(...await resolveSubCommand(cmd, rawArgs));
|
|
2396
|
+
}
|
|
2397
|
+
consola.error(error.message);
|
|
2398
|
+
process.exit(1);
|
|
2399
|
+
}
|
|
2400
|
+
}
|
|
15
2401
|
var WORKFLOW = `name: FrontGuard
|
|
16
2402
|
|
|
17
2403
|
on:
|
|
@@ -134,11 +2520,11 @@ async function initFrontGuard(cwd) {
|
|
|
134
2520
|
// src/ci/parse-ai-disclosure.ts
|
|
135
2521
|
function extractAiSection(body) {
|
|
136
2522
|
const lines = body.split(/\r?\n/);
|
|
137
|
-
const idx = lines.findIndex((
|
|
2523
|
+
const idx = lines.findIndex((l3) => /^#{1,6}\s+.*\bAI\b/i.test(l3.trim()));
|
|
138
2524
|
if (idx < 0) return null;
|
|
139
2525
|
const out = [];
|
|
140
|
-
for (let
|
|
141
|
-
const line = lines[
|
|
2526
|
+
for (let j2 = idx + 1; j2 < lines.length; j2++) {
|
|
2527
|
+
const line = lines[j2] ?? "";
|
|
142
2528
|
if (/^##\s+/.test(line)) break;
|
|
143
2529
|
out.push(line);
|
|
144
2530
|
}
|
|
@@ -182,14 +2568,14 @@ function parseAiDisclosure(body) {
|
|
|
182
2568
|
|
|
183
2569
|
// src/ci/github.ts
|
|
184
2570
|
async function readGithubEvent() {
|
|
185
|
-
const
|
|
186
|
-
if (!
|
|
2571
|
+
const p2 = process.env.GITHUB_EVENT_PATH;
|
|
2572
|
+
if (!p2) return null;
|
|
187
2573
|
try {
|
|
188
|
-
const raw = await fs.readFile(
|
|
2574
|
+
const raw = await fs.readFile(p2, "utf8");
|
|
189
2575
|
const payload = JSON.parse(raw);
|
|
190
2576
|
const pr = payload.pull_request;
|
|
191
2577
|
if (!pr) return null;
|
|
192
|
-
const files = (pr.files ?? []).map((
|
|
2578
|
+
const files = (pr.files ?? []).map((f4) => f4.filename ?? "").filter(Boolean);
|
|
193
2579
|
const body = pr.body ?? "";
|
|
194
2580
|
const ai = parseAiDisclosure(body);
|
|
195
2581
|
return {
|
|
@@ -210,11 +2596,24 @@ async function readGithubEvent() {
|
|
|
210
2596
|
return null;
|
|
211
2597
|
}
|
|
212
2598
|
}
|
|
2599
|
+
|
|
2600
|
+
// src/lib/http-fetch.ts
|
|
2601
|
+
function getFetch() {
|
|
2602
|
+
const f4 = globalThis.fetch;
|
|
2603
|
+
if (typeof f4 !== "function") {
|
|
2604
|
+
throw new Error(
|
|
2605
|
+
"FrontGuard needs Node.js 18+ (global fetch). Use NODE_VERSION / image >= 18 in CI."
|
|
2606
|
+
);
|
|
2607
|
+
}
|
|
2608
|
+
return f4;
|
|
2609
|
+
}
|
|
2610
|
+
|
|
2611
|
+
// src/ci/pr-comment.ts
|
|
213
2612
|
var MARKER = "<!-- frontguard:brief -->";
|
|
214
2613
|
async function resolvePrNumber() {
|
|
215
2614
|
const raw = process.env.FRONTGUARD_PR_NUMBER ?? process.env.PR_NUMBER;
|
|
216
|
-
const
|
|
217
|
-
if (Number.isFinite(
|
|
2615
|
+
const n3 = Number(raw);
|
|
2616
|
+
if (Number.isFinite(n3) && n3 > 0) return n3;
|
|
218
2617
|
const path14 = process.env.GITHUB_EVENT_PATH;
|
|
219
2618
|
if (!path14) return null;
|
|
220
2619
|
try {
|
|
@@ -247,13 +2646,14 @@ async function upsertBriefComment(body) {
|
|
|
247
2646
|
const prefixed = `${MARKER}
|
|
248
2647
|
${body}`;
|
|
249
2648
|
const listUrl = `${apiBase}/repos/${owner}/${name}/issues/${prNumber}/comments?per_page=100`;
|
|
2649
|
+
const fetch = getFetch();
|
|
250
2650
|
const listRes = await fetch(listUrl, { headers });
|
|
251
2651
|
if (!listRes.ok) {
|
|
252
2652
|
return;
|
|
253
2653
|
}
|
|
254
2654
|
const comments = await listRes.json();
|
|
255
2655
|
const existing = comments.find(
|
|
256
|
-
(
|
|
2656
|
+
(c4) => typeof c4.body === "string" && c4.body.includes(MARKER)
|
|
257
2657
|
);
|
|
258
2658
|
if (existing) {
|
|
259
2659
|
const patchUrl = `${apiBase}/repos/${owner}/${name}/issues/comments/${existing.id}`;
|
|
@@ -272,6 +2672,62 @@ ${body}`;
|
|
|
272
2672
|
});
|
|
273
2673
|
}
|
|
274
2674
|
|
|
2675
|
+
// node_modules/defu/dist/defu.mjs
|
|
2676
|
+
function isPlainObject2(value) {
|
|
2677
|
+
if (value === null || typeof value !== "object") {
|
|
2678
|
+
return false;
|
|
2679
|
+
}
|
|
2680
|
+
const prototype = Object.getPrototypeOf(value);
|
|
2681
|
+
if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
|
|
2682
|
+
return false;
|
|
2683
|
+
}
|
|
2684
|
+
if (Symbol.iterator in value) {
|
|
2685
|
+
return false;
|
|
2686
|
+
}
|
|
2687
|
+
if (Symbol.toStringTag in value) {
|
|
2688
|
+
return Object.prototype.toString.call(value) === "[object Module]";
|
|
2689
|
+
}
|
|
2690
|
+
return true;
|
|
2691
|
+
}
|
|
2692
|
+
function _defu2(baseObject, defaults, namespace = ".", merger) {
|
|
2693
|
+
if (!isPlainObject2(defaults)) {
|
|
2694
|
+
return _defu2(baseObject, {}, namespace, merger);
|
|
2695
|
+
}
|
|
2696
|
+
const object = { ...defaults };
|
|
2697
|
+
for (const key of Object.keys(baseObject)) {
|
|
2698
|
+
if (key === "__proto__" || key === "constructor") {
|
|
2699
|
+
continue;
|
|
2700
|
+
}
|
|
2701
|
+
const value = baseObject[key];
|
|
2702
|
+
if (value === null || value === void 0) {
|
|
2703
|
+
continue;
|
|
2704
|
+
}
|
|
2705
|
+
if (merger && merger(object, key, value, namespace)) {
|
|
2706
|
+
continue;
|
|
2707
|
+
}
|
|
2708
|
+
if (Array.isArray(value) && Array.isArray(object[key])) {
|
|
2709
|
+
object[key] = [...value, ...object[key]];
|
|
2710
|
+
} else if (isPlainObject2(value) && isPlainObject2(object[key])) {
|
|
2711
|
+
object[key] = _defu2(
|
|
2712
|
+
value,
|
|
2713
|
+
object[key],
|
|
2714
|
+
(namespace ? `${namespace}.` : "") + key.toString(),
|
|
2715
|
+
merger
|
|
2716
|
+
);
|
|
2717
|
+
} else {
|
|
2718
|
+
object[key] = value;
|
|
2719
|
+
}
|
|
2720
|
+
}
|
|
2721
|
+
return object;
|
|
2722
|
+
}
|
|
2723
|
+
function createDefu2(merger) {
|
|
2724
|
+
return (...arguments_) => (
|
|
2725
|
+
// eslint-disable-next-line unicorn/no-array-reduce
|
|
2726
|
+
arguments_.reduce((p2, c4) => _defu2(p2, c4, "", merger), {})
|
|
2727
|
+
);
|
|
2728
|
+
}
|
|
2729
|
+
var defu2 = createDefu2();
|
|
2730
|
+
|
|
275
2731
|
// src/config/defaults.ts
|
|
276
2732
|
var defaultConfig = {
|
|
277
2733
|
mode: "warn",
|
|
@@ -362,8 +2818,8 @@ function normalizeExport(mod) {
|
|
|
362
2818
|
}
|
|
363
2819
|
return mod;
|
|
364
2820
|
}
|
|
365
|
-
function stripExtends(
|
|
366
|
-
const { extends: _e, ...rest } =
|
|
2821
|
+
function stripExtends(c4) {
|
|
2822
|
+
const { extends: _e, ...rest } = c4;
|
|
367
2823
|
return rest;
|
|
368
2824
|
}
|
|
369
2825
|
async function loadExtendsLayer(cwd, spec) {
|
|
@@ -371,14 +2827,14 @@ async function loadExtendsLayer(cwd, spec) {
|
|
|
371
2827
|
const req = createRequire(path.join(cwd, "package.json"));
|
|
372
2828
|
const specs = Array.isArray(spec) ? spec : [spec];
|
|
373
2829
|
let merged = {};
|
|
374
|
-
for (const
|
|
2830
|
+
for (const s3 of specs) {
|
|
375
2831
|
try {
|
|
376
|
-
const resolved = req.resolve(
|
|
2832
|
+
const resolved = req.resolve(s3);
|
|
377
2833
|
const mod = await import(pathToFileURL(resolved).href);
|
|
378
2834
|
const layer = normalizeExport(
|
|
379
2835
|
mod
|
|
380
2836
|
);
|
|
381
|
-
merged =
|
|
2837
|
+
merged = defu2(stripExtends(layer), merged);
|
|
382
2838
|
} catch {
|
|
383
2839
|
}
|
|
384
2840
|
}
|
|
@@ -401,8 +2857,8 @@ async function loadConfig(cwd) {
|
|
|
401
2857
|
const orgLayer = await loadExtendsLayer(cwd, extendsSpec);
|
|
402
2858
|
const user = userFile ? stripExtends(userFile) : {};
|
|
403
2859
|
const base = structuredClone(defaultConfig);
|
|
404
|
-
const withOrg =
|
|
405
|
-
return
|
|
2860
|
+
const withOrg = defu2(orgLayer, base);
|
|
2861
|
+
return defu2(user, withOrg);
|
|
406
2862
|
}
|
|
407
2863
|
function allDeps(pkg) {
|
|
408
2864
|
return {
|
|
@@ -475,6 +2931,612 @@ async function detectStack(cwd) {
|
|
|
475
2931
|
tsStrict
|
|
476
2932
|
};
|
|
477
2933
|
}
|
|
2934
|
+
var d2 = (e3, t3) => () => (t3 || e3((t3 = { exports: {} }).exports, t3), t3.exports);
|
|
2935
|
+
var f3 = /* @__PURE__ */ createRequire(import.meta.url);
|
|
2936
|
+
var p = /^path$/i;
|
|
2937
|
+
var m2 = {
|
|
2938
|
+
key: "PATH",
|
|
2939
|
+
value: ""
|
|
2940
|
+
};
|
|
2941
|
+
function h2(e3) {
|
|
2942
|
+
for (const t3 in e3) {
|
|
2943
|
+
if (!Object.prototype.hasOwnProperty.call(e3, t3) || !p.test(t3)) continue;
|
|
2944
|
+
const n3 = e3[t3];
|
|
2945
|
+
if (!n3) return m2;
|
|
2946
|
+
return {
|
|
2947
|
+
key: t3,
|
|
2948
|
+
value: n3
|
|
2949
|
+
};
|
|
2950
|
+
}
|
|
2951
|
+
return m2;
|
|
2952
|
+
}
|
|
2953
|
+
function g3(e3, t3) {
|
|
2954
|
+
const n3 = t3.value.split(delimiter);
|
|
2955
|
+
const a3 = [];
|
|
2956
|
+
let s3 = e3;
|
|
2957
|
+
let c4;
|
|
2958
|
+
do {
|
|
2959
|
+
a3.push(resolve(s3, "node_modules", ".bin"));
|
|
2960
|
+
c4 = s3;
|
|
2961
|
+
s3 = dirname(s3);
|
|
2962
|
+
} while (s3 !== c4);
|
|
2963
|
+
a3.push(dirname(process.execPath));
|
|
2964
|
+
const l3 = a3.concat(n3).join(delimiter);
|
|
2965
|
+
return {
|
|
2966
|
+
key: t3.key,
|
|
2967
|
+
value: l3
|
|
2968
|
+
};
|
|
2969
|
+
}
|
|
2970
|
+
function _3(e3, t3) {
|
|
2971
|
+
const n3 = {
|
|
2972
|
+
...process.env,
|
|
2973
|
+
...t3
|
|
2974
|
+
};
|
|
2975
|
+
const r4 = g3(e3, h2(n3));
|
|
2976
|
+
n3[r4.key] = r4.value;
|
|
2977
|
+
return n3;
|
|
2978
|
+
}
|
|
2979
|
+
var v2 = (e3) => {
|
|
2980
|
+
let t3 = e3.length;
|
|
2981
|
+
const n3 = new PassThrough();
|
|
2982
|
+
const r4 = () => {
|
|
2983
|
+
if (--t3 === 0) n3.end();
|
|
2984
|
+
};
|
|
2985
|
+
for (const t4 of e3) pipeline(t4, n3, { end: false }).then(r4).catch(r4);
|
|
2986
|
+
return n3;
|
|
2987
|
+
};
|
|
2988
|
+
var y3 = /* @__PURE__ */ d2(((e3, t3) => {
|
|
2989
|
+
t3.exports = a3;
|
|
2990
|
+
a3.sync = o4;
|
|
2991
|
+
var n3 = f3("fs");
|
|
2992
|
+
function r4(e4, t4) {
|
|
2993
|
+
var n4 = t4.pathExt !== void 0 ? t4.pathExt : process.env.PATHEXT;
|
|
2994
|
+
if (!n4) return true;
|
|
2995
|
+
n4 = n4.split(";");
|
|
2996
|
+
if (n4.indexOf("") !== -1) return true;
|
|
2997
|
+
for (var r5 = 0; r5 < n4.length; r5++) {
|
|
2998
|
+
var i4 = n4[r5].toLowerCase();
|
|
2999
|
+
if (i4 && e4.substr(-i4.length).toLowerCase() === i4) return true;
|
|
3000
|
+
}
|
|
3001
|
+
return false;
|
|
3002
|
+
}
|
|
3003
|
+
function i3(e4, t4, n4) {
|
|
3004
|
+
if (!e4.isSymbolicLink() && !e4.isFile()) return false;
|
|
3005
|
+
return r4(t4, n4);
|
|
3006
|
+
}
|
|
3007
|
+
function a3(e4, t4, r5) {
|
|
3008
|
+
n3.stat(e4, function(n4, a4) {
|
|
3009
|
+
r5(n4, n4 ? false : i3(a4, e4, t4));
|
|
3010
|
+
});
|
|
3011
|
+
}
|
|
3012
|
+
function o4(e4, t4) {
|
|
3013
|
+
return i3(n3.statSync(e4), e4, t4);
|
|
3014
|
+
}
|
|
3015
|
+
}));
|
|
3016
|
+
var b2 = /* @__PURE__ */ d2(((e3, t3) => {
|
|
3017
|
+
t3.exports = r4;
|
|
3018
|
+
r4.sync = i3;
|
|
3019
|
+
var n3 = f3("fs");
|
|
3020
|
+
function r4(e4, t4, r5) {
|
|
3021
|
+
n3.stat(e4, function(e5, n4) {
|
|
3022
|
+
r5(e5, e5 ? false : a3(n4, t4));
|
|
3023
|
+
});
|
|
3024
|
+
}
|
|
3025
|
+
function i3(e4, t4) {
|
|
3026
|
+
return a3(n3.statSync(e4), t4);
|
|
3027
|
+
}
|
|
3028
|
+
function a3(e4, t4) {
|
|
3029
|
+
return e4.isFile() && o4(e4, t4);
|
|
3030
|
+
}
|
|
3031
|
+
function o4(e4, t4) {
|
|
3032
|
+
var n4 = e4.mode;
|
|
3033
|
+
var r5 = e4.uid;
|
|
3034
|
+
var i4 = e4.gid;
|
|
3035
|
+
var a4 = t4.uid !== void 0 ? t4.uid : process.getuid && process.getuid();
|
|
3036
|
+
var o5 = t4.gid !== void 0 ? t4.gid : process.getgid && process.getgid();
|
|
3037
|
+
var s3 = parseInt("100", 8);
|
|
3038
|
+
var c4 = parseInt("010", 8);
|
|
3039
|
+
var l3 = parseInt("001", 8);
|
|
3040
|
+
var u4 = s3 | c4;
|
|
3041
|
+
return n4 & l3 || n4 & c4 && i4 === o5 || n4 & s3 && r5 === a4 || n4 & u4 && a4 === 0;
|
|
3042
|
+
}
|
|
3043
|
+
}));
|
|
3044
|
+
var x2 = /* @__PURE__ */ d2(((e3, t3) => {
|
|
3045
|
+
f3("fs");
|
|
3046
|
+
var n3;
|
|
3047
|
+
if (process.platform === "win32" || global.TESTING_WINDOWS) n3 = y3();
|
|
3048
|
+
else n3 = b2();
|
|
3049
|
+
t3.exports = r4;
|
|
3050
|
+
r4.sync = i3;
|
|
3051
|
+
function r4(e4, t4, i4) {
|
|
3052
|
+
if (typeof t4 === "function") {
|
|
3053
|
+
i4 = t4;
|
|
3054
|
+
t4 = {};
|
|
3055
|
+
}
|
|
3056
|
+
if (!i4) {
|
|
3057
|
+
if (typeof Promise !== "function") throw new TypeError("callback not provided");
|
|
3058
|
+
return new Promise(function(n4, i5) {
|
|
3059
|
+
r4(e4, t4 || {}, function(e5, t5) {
|
|
3060
|
+
if (e5) i5(e5);
|
|
3061
|
+
else n4(t5);
|
|
3062
|
+
});
|
|
3063
|
+
});
|
|
3064
|
+
}
|
|
3065
|
+
n3(e4, t4 || {}, function(e5, n4) {
|
|
3066
|
+
if (e5) {
|
|
3067
|
+
if (e5.code === "EACCES" || t4 && t4.ignoreErrors) {
|
|
3068
|
+
e5 = null;
|
|
3069
|
+
n4 = false;
|
|
3070
|
+
}
|
|
3071
|
+
}
|
|
3072
|
+
i4(e5, n4);
|
|
3073
|
+
});
|
|
3074
|
+
}
|
|
3075
|
+
function i3(e4, t4) {
|
|
3076
|
+
try {
|
|
3077
|
+
return n3.sync(e4, t4 || {});
|
|
3078
|
+
} catch (e5) {
|
|
3079
|
+
if (t4 && t4.ignoreErrors || e5.code === "EACCES") return false;
|
|
3080
|
+
else throw e5;
|
|
3081
|
+
}
|
|
3082
|
+
}
|
|
3083
|
+
}));
|
|
3084
|
+
var S3 = /* @__PURE__ */ d2(((e3, t3) => {
|
|
3085
|
+
const n3 = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
3086
|
+
const r4 = f3("path");
|
|
3087
|
+
const i3 = n3 ? ";" : ":";
|
|
3088
|
+
const a3 = x2();
|
|
3089
|
+
const o4 = (e4) => Object.assign(/* @__PURE__ */ new Error(`not found: ${e4}`), { code: "ENOENT" });
|
|
3090
|
+
const s3 = (e4, t4) => {
|
|
3091
|
+
const r5 = t4.colon || i3;
|
|
3092
|
+
const a4 = e4.match(/\//) || n3 && e4.match(/\\/) ? [""] : [...n3 ? [process.cwd()] : [], ...(t4.path || process.env.PATH || "").split(r5)];
|
|
3093
|
+
const o5 = n3 ? t4.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
|
|
3094
|
+
const s4 = n3 ? o5.split(r5) : [""];
|
|
3095
|
+
if (n3) {
|
|
3096
|
+
if (e4.indexOf(".") !== -1 && s4[0] !== "") s4.unshift("");
|
|
3097
|
+
}
|
|
3098
|
+
return {
|
|
3099
|
+
pathEnv: a4,
|
|
3100
|
+
pathExt: s4,
|
|
3101
|
+
pathExtExe: o5
|
|
3102
|
+
};
|
|
3103
|
+
};
|
|
3104
|
+
const c4 = (e4, t4, n4) => {
|
|
3105
|
+
if (typeof t4 === "function") {
|
|
3106
|
+
n4 = t4;
|
|
3107
|
+
t4 = {};
|
|
3108
|
+
}
|
|
3109
|
+
if (!t4) t4 = {};
|
|
3110
|
+
const { pathEnv: i4, pathExt: c5, pathExtExe: l4 } = s3(e4, t4);
|
|
3111
|
+
const u4 = [];
|
|
3112
|
+
const d3 = (n5) => new Promise((a4, s4) => {
|
|
3113
|
+
if (n5 === i4.length) return t4.all && u4.length ? a4(u4) : s4(o4(e4));
|
|
3114
|
+
const c6 = i4[n5];
|
|
3115
|
+
const l5 = /^".*"$/.test(c6) ? c6.slice(1, -1) : c6;
|
|
3116
|
+
const d4 = r4.join(l5, e4);
|
|
3117
|
+
a4(f4(!l5 && /^\.[\\\/]/.test(e4) ? e4.slice(0, 2) + d4 : d4, n5, 0));
|
|
3118
|
+
});
|
|
3119
|
+
const f4 = (e5, n5, r5) => new Promise((i5, o5) => {
|
|
3120
|
+
if (r5 === c5.length) return i5(d3(n5 + 1));
|
|
3121
|
+
const s4 = c5[r5];
|
|
3122
|
+
a3(e5 + s4, { pathExt: l4 }, (a4, o6) => {
|
|
3123
|
+
if (!a4 && o6) if (t4.all) u4.push(e5 + s4);
|
|
3124
|
+
else return i5(e5 + s4);
|
|
3125
|
+
return i5(f4(e5, n5, r5 + 1));
|
|
3126
|
+
});
|
|
3127
|
+
});
|
|
3128
|
+
return n4 ? d3(0).then((e5) => n4(null, e5), n4) : d3(0);
|
|
3129
|
+
};
|
|
3130
|
+
const l3 = (e4, t4) => {
|
|
3131
|
+
t4 = t4 || {};
|
|
3132
|
+
const { pathEnv: n4, pathExt: i4, pathExtExe: c5 } = s3(e4, t4);
|
|
3133
|
+
const l4 = [];
|
|
3134
|
+
for (let o5 = 0; o5 < n4.length; o5++) {
|
|
3135
|
+
const s4 = n4[o5];
|
|
3136
|
+
const u4 = /^".*"$/.test(s4) ? s4.slice(1, -1) : s4;
|
|
3137
|
+
const d3 = r4.join(u4, e4);
|
|
3138
|
+
const f4 = !u4 && /^\.[\\\/]/.test(e4) ? e4.slice(0, 2) + d3 : d3;
|
|
3139
|
+
for (let e5 = 0; e5 < i4.length; e5++) {
|
|
3140
|
+
const n5 = f4 + i4[e5];
|
|
3141
|
+
try {
|
|
3142
|
+
if (a3.sync(n5, { pathExt: c5 })) if (t4.all) l4.push(n5);
|
|
3143
|
+
else return n5;
|
|
3144
|
+
} catch (e6) {
|
|
3145
|
+
}
|
|
3146
|
+
}
|
|
3147
|
+
}
|
|
3148
|
+
if (t4.all && l4.length) return l4;
|
|
3149
|
+
if (t4.nothrow) return null;
|
|
3150
|
+
throw o4(e4);
|
|
3151
|
+
};
|
|
3152
|
+
t3.exports = c4;
|
|
3153
|
+
c4.sync = l3;
|
|
3154
|
+
}));
|
|
3155
|
+
var C3 = /* @__PURE__ */ d2(((e3, t3) => {
|
|
3156
|
+
const n3 = (e4 = {}) => {
|
|
3157
|
+
const t4 = e4.env || process.env;
|
|
3158
|
+
if ((e4.platform || process.platform) !== "win32") return "PATH";
|
|
3159
|
+
return Object.keys(t4).reverse().find((e5) => e5.toUpperCase() === "PATH") || "Path";
|
|
3160
|
+
};
|
|
3161
|
+
t3.exports = n3;
|
|
3162
|
+
t3.exports.default = n3;
|
|
3163
|
+
}));
|
|
3164
|
+
var w2 = /* @__PURE__ */ d2(((e3, t3) => {
|
|
3165
|
+
const n3 = f3("path");
|
|
3166
|
+
const r4 = S3();
|
|
3167
|
+
const i3 = C3();
|
|
3168
|
+
function a3(e4, t4) {
|
|
3169
|
+
const a4 = e4.options.env || process.env;
|
|
3170
|
+
const o5 = process.cwd();
|
|
3171
|
+
const s3 = e4.options.cwd != null;
|
|
3172
|
+
const c4 = s3 && process.chdir !== void 0 && !process.chdir.disabled;
|
|
3173
|
+
if (c4) try {
|
|
3174
|
+
process.chdir(e4.options.cwd);
|
|
3175
|
+
} catch (e5) {
|
|
3176
|
+
}
|
|
3177
|
+
let l3;
|
|
3178
|
+
try {
|
|
3179
|
+
l3 = r4.sync(e4.command, {
|
|
3180
|
+
path: a4[i3({ env: a4 })],
|
|
3181
|
+
pathExt: t4 ? n3.delimiter : void 0
|
|
3182
|
+
});
|
|
3183
|
+
} catch (e5) {
|
|
3184
|
+
} finally {
|
|
3185
|
+
if (c4) process.chdir(o5);
|
|
3186
|
+
}
|
|
3187
|
+
if (l3) l3 = n3.resolve(s3 ? e4.options.cwd : "", l3);
|
|
3188
|
+
return l3;
|
|
3189
|
+
}
|
|
3190
|
+
function o4(e4) {
|
|
3191
|
+
return a3(e4) || a3(e4, true);
|
|
3192
|
+
}
|
|
3193
|
+
t3.exports = o4;
|
|
3194
|
+
}));
|
|
3195
|
+
var T3 = /* @__PURE__ */ d2(((e3, t3) => {
|
|
3196
|
+
const n3 = /([()\][%!^"`<>&|;, *?])/g;
|
|
3197
|
+
function r4(e4) {
|
|
3198
|
+
e4 = e4.replace(n3, "^$1");
|
|
3199
|
+
return e4;
|
|
3200
|
+
}
|
|
3201
|
+
function i3(e4, t4) {
|
|
3202
|
+
e4 = `${e4}`;
|
|
3203
|
+
e4 = e4.replace(/(?=(\\+?)?)\1"/g, '$1$1\\"');
|
|
3204
|
+
e4 = e4.replace(/(?=(\\+?)?)\1$/, "$1$1");
|
|
3205
|
+
e4 = `"${e4}"`;
|
|
3206
|
+
e4 = e4.replace(n3, "^$1");
|
|
3207
|
+
if (t4) e4 = e4.replace(n3, "^$1");
|
|
3208
|
+
return e4;
|
|
3209
|
+
}
|
|
3210
|
+
t3.exports.command = r4;
|
|
3211
|
+
t3.exports.argument = i3;
|
|
3212
|
+
}));
|
|
3213
|
+
var E = /* @__PURE__ */ d2(((e3, t3) => {
|
|
3214
|
+
t3.exports = /^#!(.*)/;
|
|
3215
|
+
}));
|
|
3216
|
+
var D2 = /* @__PURE__ */ d2(((e3, t3) => {
|
|
3217
|
+
const n3 = E();
|
|
3218
|
+
t3.exports = (e4 = "") => {
|
|
3219
|
+
const t4 = e4.match(n3);
|
|
3220
|
+
if (!t4) return null;
|
|
3221
|
+
const [r4, i3] = t4[0].replace(/#! ?/, "").split(" ");
|
|
3222
|
+
const a3 = r4.split("/").pop();
|
|
3223
|
+
if (a3 === "env") return i3;
|
|
3224
|
+
return i3 ? `${a3} ${i3}` : a3;
|
|
3225
|
+
};
|
|
3226
|
+
}));
|
|
3227
|
+
var O3 = /* @__PURE__ */ d2(((e3, t3) => {
|
|
3228
|
+
const n3 = f3("fs");
|
|
3229
|
+
const r4 = D2();
|
|
3230
|
+
function i3(e4) {
|
|
3231
|
+
const t4 = 150;
|
|
3232
|
+
const i4 = Buffer.alloc(t4);
|
|
3233
|
+
let a3;
|
|
3234
|
+
try {
|
|
3235
|
+
a3 = n3.openSync(e4, "r");
|
|
3236
|
+
n3.readSync(a3, i4, 0, t4, 0);
|
|
3237
|
+
n3.closeSync(a3);
|
|
3238
|
+
} catch (e5) {
|
|
3239
|
+
}
|
|
3240
|
+
return r4(i4.toString());
|
|
3241
|
+
}
|
|
3242
|
+
t3.exports = i3;
|
|
3243
|
+
}));
|
|
3244
|
+
var k2 = /* @__PURE__ */ d2(((e3, t3) => {
|
|
3245
|
+
const n3 = f3("path");
|
|
3246
|
+
const r4 = w2();
|
|
3247
|
+
const i3 = T3();
|
|
3248
|
+
const a3 = O3();
|
|
3249
|
+
const o4 = process.platform === "win32";
|
|
3250
|
+
const s3 = /\.(?:com|exe)$/i;
|
|
3251
|
+
const c4 = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
|
3252
|
+
function l3(e4) {
|
|
3253
|
+
e4.file = r4(e4);
|
|
3254
|
+
const t4 = e4.file && a3(e4.file);
|
|
3255
|
+
if (t4) {
|
|
3256
|
+
e4.args.unshift(e4.file);
|
|
3257
|
+
e4.command = t4;
|
|
3258
|
+
return r4(e4);
|
|
3259
|
+
}
|
|
3260
|
+
return e4.file;
|
|
3261
|
+
}
|
|
3262
|
+
function u4(e4) {
|
|
3263
|
+
if (!o4) return e4;
|
|
3264
|
+
const t4 = l3(e4);
|
|
3265
|
+
const r5 = !s3.test(t4);
|
|
3266
|
+
if (e4.options.forceShell || r5) {
|
|
3267
|
+
const r6 = c4.test(t4);
|
|
3268
|
+
e4.command = n3.normalize(e4.command);
|
|
3269
|
+
e4.command = i3.command(e4.command);
|
|
3270
|
+
e4.args = e4.args.map((e5) => i3.argument(e5, r6));
|
|
3271
|
+
e4.args = [
|
|
3272
|
+
"/d",
|
|
3273
|
+
"/s",
|
|
3274
|
+
"/c",
|
|
3275
|
+
`"${[e4.command].concat(e4.args).join(" ")}"`
|
|
3276
|
+
];
|
|
3277
|
+
e4.command = process.env.comspec || "cmd.exe";
|
|
3278
|
+
e4.options.windowsVerbatimArguments = true;
|
|
3279
|
+
}
|
|
3280
|
+
return e4;
|
|
3281
|
+
}
|
|
3282
|
+
function d3(e4, t4, n4) {
|
|
3283
|
+
if (t4 && !Array.isArray(t4)) {
|
|
3284
|
+
n4 = t4;
|
|
3285
|
+
t4 = null;
|
|
3286
|
+
}
|
|
3287
|
+
t4 = t4 ? t4.slice(0) : [];
|
|
3288
|
+
n4 = Object.assign({}, n4);
|
|
3289
|
+
const r5 = {
|
|
3290
|
+
command: e4,
|
|
3291
|
+
args: t4,
|
|
3292
|
+
options: n4,
|
|
3293
|
+
file: void 0,
|
|
3294
|
+
original: {
|
|
3295
|
+
command: e4,
|
|
3296
|
+
args: t4
|
|
3297
|
+
}
|
|
3298
|
+
};
|
|
3299
|
+
return n4.shell ? r5 : u4(r5);
|
|
3300
|
+
}
|
|
3301
|
+
t3.exports = d3;
|
|
3302
|
+
}));
|
|
3303
|
+
var A3 = /* @__PURE__ */ d2(((e3, t3) => {
|
|
3304
|
+
const n3 = process.platform === "win32";
|
|
3305
|
+
function r4(e4, t4) {
|
|
3306
|
+
return Object.assign(/* @__PURE__ */ new Error(`${t4} ${e4.command} ENOENT`), {
|
|
3307
|
+
code: "ENOENT",
|
|
3308
|
+
errno: "ENOENT",
|
|
3309
|
+
syscall: `${t4} ${e4.command}`,
|
|
3310
|
+
path: e4.command,
|
|
3311
|
+
spawnargs: e4.args
|
|
3312
|
+
});
|
|
3313
|
+
}
|
|
3314
|
+
function i3(e4, t4) {
|
|
3315
|
+
if (!n3) return;
|
|
3316
|
+
const r5 = e4.emit;
|
|
3317
|
+
e4.emit = function(n4, i4) {
|
|
3318
|
+
if (n4 === "exit") {
|
|
3319
|
+
const n5 = a3(i4, t4);
|
|
3320
|
+
if (n5) return r5.call(e4, "error", n5);
|
|
3321
|
+
}
|
|
3322
|
+
return r5.apply(e4, arguments);
|
|
3323
|
+
};
|
|
3324
|
+
}
|
|
3325
|
+
function a3(e4, t4) {
|
|
3326
|
+
if (n3 && e4 === 1 && !t4.file) return r4(t4.original, "spawn");
|
|
3327
|
+
return null;
|
|
3328
|
+
}
|
|
3329
|
+
function o4(e4, t4) {
|
|
3330
|
+
if (n3 && e4 === 1 && !t4.file) return r4(t4.original, "spawnSync");
|
|
3331
|
+
return null;
|
|
3332
|
+
}
|
|
3333
|
+
t3.exports = {
|
|
3334
|
+
hookChildProcess: i3,
|
|
3335
|
+
verifyENOENT: a3,
|
|
3336
|
+
verifyENOENTSync: o4,
|
|
3337
|
+
notFoundError: r4
|
|
3338
|
+
};
|
|
3339
|
+
}));
|
|
3340
|
+
var j = /* @__PURE__ */ d2(((e3, t3) => {
|
|
3341
|
+
const n3 = f3("child_process");
|
|
3342
|
+
const r4 = k2();
|
|
3343
|
+
const i3 = A3();
|
|
3344
|
+
function a3(e4, t4, a4) {
|
|
3345
|
+
const o5 = r4(e4, t4, a4);
|
|
3346
|
+
const s3 = n3.spawn(o5.command, o5.args, o5.options);
|
|
3347
|
+
i3.hookChildProcess(s3, o5);
|
|
3348
|
+
return s3;
|
|
3349
|
+
}
|
|
3350
|
+
function o4(e4, t4, a4) {
|
|
3351
|
+
const o5 = r4(e4, t4, a4);
|
|
3352
|
+
const s3 = n3.spawnSync(o5.command, o5.args, o5.options);
|
|
3353
|
+
s3.error = s3.error || i3.verifyENOENTSync(s3.status, o5);
|
|
3354
|
+
return s3;
|
|
3355
|
+
}
|
|
3356
|
+
t3.exports = a3;
|
|
3357
|
+
t3.exports.spawn = a3;
|
|
3358
|
+
t3.exports.sync = o4;
|
|
3359
|
+
t3.exports._parse = r4;
|
|
3360
|
+
t3.exports._enoent = i3;
|
|
3361
|
+
}));
|
|
3362
|
+
var M = j();
|
|
3363
|
+
var N3 = class extends Error {
|
|
3364
|
+
get exitCode() {
|
|
3365
|
+
if (this.result.exitCode !== null) return this.result.exitCode;
|
|
3366
|
+
}
|
|
3367
|
+
constructor(e3, t3) {
|
|
3368
|
+
super(`Process exited with non-zero status (${e3.exitCode})`);
|
|
3369
|
+
this.result = e3;
|
|
3370
|
+
this.output = t3;
|
|
3371
|
+
}
|
|
3372
|
+
};
|
|
3373
|
+
var F3 = {
|
|
3374
|
+
timeout: void 0,
|
|
3375
|
+
persist: false
|
|
3376
|
+
};
|
|
3377
|
+
var L3 = { windowsHide: true };
|
|
3378
|
+
function R3(e3, t3) {
|
|
3379
|
+
return {
|
|
3380
|
+
command: normalize(e3),
|
|
3381
|
+
args: t3 ?? []
|
|
3382
|
+
};
|
|
3383
|
+
}
|
|
3384
|
+
function z2(e3) {
|
|
3385
|
+
const t3 = new AbortController();
|
|
3386
|
+
for (const n3 of e3) {
|
|
3387
|
+
if (n3.aborted) {
|
|
3388
|
+
t3.abort();
|
|
3389
|
+
return n3;
|
|
3390
|
+
}
|
|
3391
|
+
const e4 = () => {
|
|
3392
|
+
t3.abort(n3.reason);
|
|
3393
|
+
};
|
|
3394
|
+
n3.addEventListener("abort", e4, { signal: t3.signal });
|
|
3395
|
+
}
|
|
3396
|
+
return t3.signal;
|
|
3397
|
+
}
|
|
3398
|
+
async function B2(e3) {
|
|
3399
|
+
let t3 = "";
|
|
3400
|
+
try {
|
|
3401
|
+
for await (const n3 of e3) t3 += n3.toString();
|
|
3402
|
+
} catch {
|
|
3403
|
+
}
|
|
3404
|
+
return t3;
|
|
3405
|
+
}
|
|
3406
|
+
var V2 = class {
|
|
3407
|
+
_process;
|
|
3408
|
+
_aborted = false;
|
|
3409
|
+
_options;
|
|
3410
|
+
_command;
|
|
3411
|
+
_args;
|
|
3412
|
+
_resolveClose;
|
|
3413
|
+
_processClosed;
|
|
3414
|
+
_thrownError;
|
|
3415
|
+
get process() {
|
|
3416
|
+
return this._process;
|
|
3417
|
+
}
|
|
3418
|
+
get pid() {
|
|
3419
|
+
return this._process?.pid;
|
|
3420
|
+
}
|
|
3421
|
+
get exitCode() {
|
|
3422
|
+
if (this._process && this._process.exitCode !== null) return this._process.exitCode;
|
|
3423
|
+
}
|
|
3424
|
+
constructor(e3, t3, n3) {
|
|
3425
|
+
this._options = {
|
|
3426
|
+
...F3,
|
|
3427
|
+
...n3
|
|
3428
|
+
};
|
|
3429
|
+
this._command = e3;
|
|
3430
|
+
this._args = t3 ?? [];
|
|
3431
|
+
this._processClosed = new Promise((e4) => {
|
|
3432
|
+
this._resolveClose = e4;
|
|
3433
|
+
});
|
|
3434
|
+
}
|
|
3435
|
+
kill(e3) {
|
|
3436
|
+
return this._process?.kill(e3) === true;
|
|
3437
|
+
}
|
|
3438
|
+
get aborted() {
|
|
3439
|
+
return this._aborted;
|
|
3440
|
+
}
|
|
3441
|
+
get killed() {
|
|
3442
|
+
return this._process?.killed === true;
|
|
3443
|
+
}
|
|
3444
|
+
pipe(e3, t3, n3) {
|
|
3445
|
+
return W2(e3, t3, {
|
|
3446
|
+
...n3,
|
|
3447
|
+
stdin: this
|
|
3448
|
+
});
|
|
3449
|
+
}
|
|
3450
|
+
async *[Symbol.asyncIterator]() {
|
|
3451
|
+
const e3 = this._process;
|
|
3452
|
+
if (!e3) return;
|
|
3453
|
+
const t3 = [];
|
|
3454
|
+
if (this._streamErr) t3.push(this._streamErr);
|
|
3455
|
+
if (this._streamOut) t3.push(this._streamOut);
|
|
3456
|
+
const n3 = v2(t3);
|
|
3457
|
+
const r4 = f.createInterface({ input: n3 });
|
|
3458
|
+
for await (const e4 of r4) yield e4.toString();
|
|
3459
|
+
await this._processClosed;
|
|
3460
|
+
e3.removeAllListeners();
|
|
3461
|
+
if (this._thrownError) throw this._thrownError;
|
|
3462
|
+
if (this._options?.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new N3(this);
|
|
3463
|
+
}
|
|
3464
|
+
async _waitForOutput() {
|
|
3465
|
+
const e3 = this._process;
|
|
3466
|
+
if (!e3) throw new Error("No process was started");
|
|
3467
|
+
const [t3, n3] = await Promise.all([this._streamOut ? B2(this._streamOut) : "", this._streamErr ? B2(this._streamErr) : ""]);
|
|
3468
|
+
await this._processClosed;
|
|
3469
|
+
const { stdin: r4 } = this._options;
|
|
3470
|
+
if (r4 && typeof r4 !== "string") await r4;
|
|
3471
|
+
e3.removeAllListeners();
|
|
3472
|
+
if (this._thrownError) throw this._thrownError;
|
|
3473
|
+
const i3 = {
|
|
3474
|
+
stderr: n3,
|
|
3475
|
+
stdout: t3,
|
|
3476
|
+
exitCode: this.exitCode
|
|
3477
|
+
};
|
|
3478
|
+
if (this._options.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new N3(this, i3);
|
|
3479
|
+
return i3;
|
|
3480
|
+
}
|
|
3481
|
+
then(e3, t3) {
|
|
3482
|
+
return this._waitForOutput().then(e3, t3);
|
|
3483
|
+
}
|
|
3484
|
+
_streamOut;
|
|
3485
|
+
_streamErr;
|
|
3486
|
+
spawn() {
|
|
3487
|
+
const e3 = cwd();
|
|
3488
|
+
const n3 = this._options;
|
|
3489
|
+
const r4 = {
|
|
3490
|
+
...L3,
|
|
3491
|
+
...n3.nodeOptions
|
|
3492
|
+
};
|
|
3493
|
+
const i3 = [];
|
|
3494
|
+
this._resetState();
|
|
3495
|
+
if (n3.timeout !== void 0) i3.push(AbortSignal.timeout(n3.timeout));
|
|
3496
|
+
if (n3.signal !== void 0) i3.push(n3.signal);
|
|
3497
|
+
if (n3.persist === true) r4.detached = true;
|
|
3498
|
+
if (i3.length > 0) r4.signal = z2(i3);
|
|
3499
|
+
r4.env = _3(e3, r4.env);
|
|
3500
|
+
const { command: a3, args: o4 } = R3(this._command, this._args);
|
|
3501
|
+
const c4 = (0, M._parse)(a3, o4, r4);
|
|
3502
|
+
const l3 = spawn(c4.command, c4.args, c4.options);
|
|
3503
|
+
if (l3.stderr) this._streamErr = l3.stderr;
|
|
3504
|
+
if (l3.stdout) this._streamOut = l3.stdout;
|
|
3505
|
+
this._process = l3;
|
|
3506
|
+
l3.once("error", this._onError);
|
|
3507
|
+
l3.once("close", this._onClose);
|
|
3508
|
+
if (l3.stdin) {
|
|
3509
|
+
const { stdin: e4 } = n3;
|
|
3510
|
+
if (typeof e4 === "string") l3.stdin.end(e4);
|
|
3511
|
+
else e4?.process?.stdout?.pipe(l3.stdin);
|
|
3512
|
+
}
|
|
3513
|
+
}
|
|
3514
|
+
_resetState() {
|
|
3515
|
+
this._aborted = false;
|
|
3516
|
+
this._processClosed = new Promise((e3) => {
|
|
3517
|
+
this._resolveClose = e3;
|
|
3518
|
+
});
|
|
3519
|
+
this._thrownError = void 0;
|
|
3520
|
+
}
|
|
3521
|
+
_onError = (e3) => {
|
|
3522
|
+
if (e3.name === "AbortError" && (!(e3.cause instanceof Error) || e3.cause.name !== "TimeoutError")) {
|
|
3523
|
+
this._aborted = true;
|
|
3524
|
+
return;
|
|
3525
|
+
}
|
|
3526
|
+
this._thrownError = e3;
|
|
3527
|
+
};
|
|
3528
|
+
_onClose = () => {
|
|
3529
|
+
if (this._resolveClose) this._resolveClose();
|
|
3530
|
+
};
|
|
3531
|
+
};
|
|
3532
|
+
var U = (e3, t3, n3) => {
|
|
3533
|
+
const r4 = new V2(e3, t3, n3);
|
|
3534
|
+
r4.spawn();
|
|
3535
|
+
return r4;
|
|
3536
|
+
};
|
|
3537
|
+
var W2 = U;
|
|
3538
|
+
|
|
3539
|
+
// src/runner/exec-tools.ts
|
|
478
3540
|
async function pathExists(file) {
|
|
479
3541
|
try {
|
|
480
3542
|
await fs.access(file);
|
|
@@ -494,24 +3556,24 @@ async function runNpmBinary(cwd, name, args) {
|
|
|
494
3556
|
try {
|
|
495
3557
|
const bin = await resolveBin(cwd, name);
|
|
496
3558
|
if (bin) {
|
|
497
|
-
const
|
|
3559
|
+
const r5 = await W2(bin, args, { nodeOptions: { cwd } });
|
|
498
3560
|
return {
|
|
499
|
-
exitCode:
|
|
500
|
-
stdout:
|
|
501
|
-
stderr:
|
|
3561
|
+
exitCode: r5.exitCode ?? 0,
|
|
3562
|
+
stdout: r5.stdout ?? "",
|
|
3563
|
+
stderr: r5.stderr ?? ""
|
|
502
3564
|
};
|
|
503
3565
|
}
|
|
504
|
-
let
|
|
505
|
-
if ((
|
|
506
|
-
|
|
3566
|
+
let r4 = await W2("npx", ["--no-install", name, ...args], { nodeOptions: { cwd } });
|
|
3567
|
+
if ((r4.exitCode ?? 0) !== 0) {
|
|
3568
|
+
r4 = await W2("npx", [name, ...args], { nodeOptions: { cwd } });
|
|
507
3569
|
}
|
|
508
3570
|
return {
|
|
509
|
-
exitCode:
|
|
510
|
-
stdout:
|
|
511
|
-
stderr:
|
|
3571
|
+
exitCode: r4.exitCode ?? 0,
|
|
3572
|
+
stdout: r4.stdout ?? "",
|
|
3573
|
+
stderr: r4.stderr ?? ""
|
|
512
3574
|
};
|
|
513
|
-
} catch (
|
|
514
|
-
const msg =
|
|
3575
|
+
} catch (e3) {
|
|
3576
|
+
const msg = e3 instanceof Error ? e3.message : String(e3);
|
|
515
3577
|
return {
|
|
516
3578
|
exitCode: 127,
|
|
517
3579
|
stdout: "",
|
|
@@ -521,14 +3583,14 @@ async function runNpmBinary(cwd, name, args) {
|
|
|
521
3583
|
}
|
|
522
3584
|
async function runNpx(cwd, args) {
|
|
523
3585
|
try {
|
|
524
|
-
const
|
|
3586
|
+
const r4 = await W2("npx", args, { nodeOptions: { cwd } });
|
|
525
3587
|
return {
|
|
526
|
-
exitCode:
|
|
527
|
-
stdout:
|
|
528
|
-
stderr:
|
|
3588
|
+
exitCode: r4.exitCode ?? 0,
|
|
3589
|
+
stdout: r4.stdout ?? "",
|
|
3590
|
+
stderr: r4.stderr ?? ""
|
|
529
3591
|
};
|
|
530
|
-
} catch (
|
|
531
|
-
const msg =
|
|
3592
|
+
} catch (e3) {
|
|
3593
|
+
const msg = e3 instanceof Error ? e3.message : String(e3);
|
|
532
3594
|
return {
|
|
533
3595
|
exitCode: 127,
|
|
534
3596
|
stdout: "",
|
|
@@ -541,8 +3603,8 @@ async function runNpx(cwd, args) {
|
|
|
541
3603
|
async function hasEslintDependency(cwd) {
|
|
542
3604
|
try {
|
|
543
3605
|
const raw = await fs.readFile(path.join(cwd, "package.json"), "utf8");
|
|
544
|
-
const
|
|
545
|
-
return Boolean(
|
|
3606
|
+
const p2 = JSON.parse(raw);
|
|
3607
|
+
return Boolean(p2.devDependencies?.eslint || p2.dependencies?.eslint);
|
|
546
3608
|
} catch {
|
|
547
3609
|
return false;
|
|
548
3610
|
}
|
|
@@ -558,13 +3620,13 @@ async function hasEslintConfig(cwd) {
|
|
|
558
3620
|
".eslintrc.yaml",
|
|
559
3621
|
".eslintrc.yml"
|
|
560
3622
|
];
|
|
561
|
-
for (const
|
|
562
|
-
if (await pathExists(path.join(cwd,
|
|
3623
|
+
for (const c4 of candidates) {
|
|
3624
|
+
if (await pathExists(path.join(cwd, c4))) return true;
|
|
563
3625
|
}
|
|
564
3626
|
return false;
|
|
565
3627
|
}
|
|
566
3628
|
function meaningfulStderr(stderr) {
|
|
567
|
-
return stderr.split("\n").filter((
|
|
3629
|
+
return stderr.split("\n").filter((l3) => l3.trim() && !/^npm warn\b/i.test(l3)).join("\n").trim();
|
|
568
3630
|
}
|
|
569
3631
|
async function runEslint(cwd, config, _stack) {
|
|
570
3632
|
const t0 = performance.now();
|
|
@@ -595,7 +3657,7 @@ async function runEslint(cwd, config, _stack) {
|
|
|
595
3657
|
"-f",
|
|
596
3658
|
"json"
|
|
597
3659
|
];
|
|
598
|
-
const { exitCode, stdout, stderr } = await runNpmBinary(cwd, "eslint", args);
|
|
3660
|
+
const { exitCode, stdout: stdout2, stderr } = await runNpmBinary(cwd, "eslint", args);
|
|
599
3661
|
const errText = meaningfulStderr(stderr);
|
|
600
3662
|
const findings = [];
|
|
601
3663
|
if (exitCode === 0) {
|
|
@@ -614,27 +3676,27 @@ async function runEslint(cwd, config, _stack) {
|
|
|
614
3676
|
};
|
|
615
3677
|
}
|
|
616
3678
|
try {
|
|
617
|
-
const rows = JSON.parse(
|
|
618
|
-
let
|
|
3679
|
+
const rows = JSON.parse(stdout2);
|
|
3680
|
+
let n3 = 0;
|
|
619
3681
|
for (const row of rows) {
|
|
620
|
-
for (const
|
|
621
|
-
if (
|
|
3682
|
+
for (const m3 of row.messages) {
|
|
3683
|
+
if (n3++ >= 40) break;
|
|
622
3684
|
findings.push({
|
|
623
|
-
id: `eslint-${
|
|
3685
|
+
id: `eslint-${m3.ruleId ?? "unknown"}`,
|
|
624
3686
|
severity: "warn",
|
|
625
|
-
message:
|
|
3687
|
+
message: m3.message,
|
|
626
3688
|
file: row.filePath,
|
|
627
|
-
detail:
|
|
3689
|
+
detail: m3.line ? `line ${m3.line}` : void 0
|
|
628
3690
|
});
|
|
629
3691
|
}
|
|
630
3692
|
}
|
|
631
|
-
if (
|
|
3693
|
+
if (n3 === 0) {
|
|
632
3694
|
findings.push({
|
|
633
3695
|
id: "eslint-failed",
|
|
634
3696
|
severity: "warn",
|
|
635
3697
|
message: "ESLint exited with a non-zero status",
|
|
636
3698
|
detail: truncate(
|
|
637
|
-
[
|
|
3699
|
+
[stdout2, errText].filter(Boolean).join("\n") || `exit ${exitCode}`,
|
|
638
3700
|
4e3
|
|
639
3701
|
)
|
|
640
3702
|
});
|
|
@@ -645,7 +3707,7 @@ async function runEslint(cwd, config, _stack) {
|
|
|
645
3707
|
severity: "warn",
|
|
646
3708
|
message: "ESLint exited with errors",
|
|
647
3709
|
detail: truncate(
|
|
648
|
-
[
|
|
3710
|
+
[stdout2, errText].filter(Boolean).join("\n") || `exit ${exitCode}`,
|
|
649
3711
|
4e3
|
|
650
3712
|
)
|
|
651
3713
|
});
|
|
@@ -656,9 +3718,9 @@ async function runEslint(cwd, config, _stack) {
|
|
|
656
3718
|
durationMs: Math.round(performance.now() - t0)
|
|
657
3719
|
};
|
|
658
3720
|
}
|
|
659
|
-
function truncate(
|
|
660
|
-
if (
|
|
661
|
-
return
|
|
3721
|
+
function truncate(s3, max) {
|
|
3722
|
+
if (s3.length <= max) return s3;
|
|
3723
|
+
return s3.slice(0, max) + "\u2026";
|
|
662
3724
|
}
|
|
663
3725
|
|
|
664
3726
|
// src/checks/prettier.ts
|
|
@@ -673,7 +3735,7 @@ async function runPrettier(cwd, config) {
|
|
|
673
3735
|
};
|
|
674
3736
|
}
|
|
675
3737
|
const glob = config.checks.prettier.glob ?? "**/*.{js,cjs,mjs,jsx,ts,tsx,json,md,css,scss,yml,yaml}";
|
|
676
|
-
const { exitCode, stdout, stderr } = await runNpmBinary(cwd, "prettier", [
|
|
3738
|
+
const { exitCode, stdout: stdout2, stderr } = await runNpmBinary(cwd, "prettier", [
|
|
677
3739
|
"--check",
|
|
678
3740
|
glob,
|
|
679
3741
|
"--ignore-unknown"
|
|
@@ -688,7 +3750,7 @@ async function runPrettier(cwd, config) {
|
|
|
688
3750
|
};
|
|
689
3751
|
}
|
|
690
3752
|
if (exitCode !== 0) {
|
|
691
|
-
const blob = [
|
|
3753
|
+
const blob = [stdout2, stderr].filter(Boolean).join("\n").trim();
|
|
692
3754
|
findings.push({
|
|
693
3755
|
id: "prettier-check",
|
|
694
3756
|
severity: "warn",
|
|
@@ -702,9 +3764,9 @@ async function runPrettier(cwd, config) {
|
|
|
702
3764
|
durationMs: Math.round(performance.now() - t0)
|
|
703
3765
|
};
|
|
704
3766
|
}
|
|
705
|
-
function truncate2(
|
|
706
|
-
if (
|
|
707
|
-
return
|
|
3767
|
+
function truncate2(s3, max) {
|
|
3768
|
+
if (s3.length <= max) return s3;
|
|
3769
|
+
return s3.slice(0, max) + "\u2026";
|
|
708
3770
|
}
|
|
709
3771
|
async function runTypeScript(cwd, config, stack) {
|
|
710
3772
|
const t0 = performance.now();
|
|
@@ -726,7 +3788,7 @@ async function runTypeScript(cwd, config, stack) {
|
|
|
726
3788
|
};
|
|
727
3789
|
}
|
|
728
3790
|
const args = ["--noEmit", ...config.checks.typescript.tscArgs ?? []];
|
|
729
|
-
const { exitCode, stdout, stderr } = await runNpmBinary(cwd, "tsc", args);
|
|
3791
|
+
const { exitCode, stdout: stdout2, stderr } = await runNpmBinary(cwd, "tsc", args);
|
|
730
3792
|
const findings = [];
|
|
731
3793
|
if (exitCode === 127 || /command not found|not recognized|ENOENT/i.test(stderr)) {
|
|
732
3794
|
return {
|
|
@@ -737,7 +3799,7 @@ async function runTypeScript(cwd, config, stack) {
|
|
|
737
3799
|
};
|
|
738
3800
|
}
|
|
739
3801
|
if (exitCode !== 0) {
|
|
740
|
-
const out = [
|
|
3802
|
+
const out = [stdout2, stderr].filter(Boolean).join("\n").trim();
|
|
741
3803
|
findings.push({
|
|
742
3804
|
id: "tsc",
|
|
743
3805
|
severity: "warn",
|
|
@@ -751,9 +3813,9 @@ async function runTypeScript(cwd, config, stack) {
|
|
|
751
3813
|
durationMs: Math.round(performance.now() - t0)
|
|
752
3814
|
};
|
|
753
3815
|
}
|
|
754
|
-
function truncate3(
|
|
755
|
-
if (
|
|
756
|
-
return
|
|
3816
|
+
function truncate3(s3, max) {
|
|
3817
|
+
if (s3.length <= max) return s3;
|
|
3818
|
+
return s3.slice(0, max) + "\u2026";
|
|
757
3819
|
}
|
|
758
3820
|
var PATTERNS = [
|
|
759
3821
|
{
|
|
@@ -804,7 +3866,7 @@ async function runSecrets(cwd, config, pr) {
|
|
|
804
3866
|
const findings = [];
|
|
805
3867
|
let globs;
|
|
806
3868
|
if (pr?.files.length) {
|
|
807
|
-
globs = pr.files.filter((
|
|
3869
|
+
globs = pr.files.filter((f4) => isProbablyTextFile(f4));
|
|
808
3870
|
} else {
|
|
809
3871
|
globs = await fg(
|
|
810
3872
|
[
|
|
@@ -891,7 +3953,7 @@ function runPrHygiene(config, pr) {
|
|
|
891
3953
|
}
|
|
892
3954
|
const lower = body.toLowerCase();
|
|
893
3955
|
const hints = config.checks.prHygiene.sectionHints;
|
|
894
|
-
const missing = hints.filter((
|
|
3956
|
+
const missing = hints.filter((h3) => !sectionMentioned(lower, h3));
|
|
895
3957
|
if (missing.length > 0) {
|
|
896
3958
|
findings.push({
|
|
897
3959
|
id: "pr-sections",
|
|
@@ -937,20 +3999,20 @@ function runPrHygiene(config, pr) {
|
|
|
937
3999
|
};
|
|
938
4000
|
}
|
|
939
4001
|
function sectionMentioned(body, hint) {
|
|
940
|
-
const
|
|
941
|
-
if (
|
|
4002
|
+
const h3 = hint.toLowerCase();
|
|
4003
|
+
if (h3 === "what") {
|
|
942
4004
|
return /\bwhat\b/.test(body) || /##\s*summary/.test(body) || /##\s*context/.test(body);
|
|
943
4005
|
}
|
|
944
|
-
if (
|
|
4006
|
+
if (h3 === "why") {
|
|
945
4007
|
return /\bwhy\b/.test(body) || /motivation/.test(body) || /##\s*rationale/.test(body);
|
|
946
4008
|
}
|
|
947
|
-
if (
|
|
4009
|
+
if (h3 === "test" || h3 === "how to test") {
|
|
948
4010
|
return /how to test/.test(body) || /\btesting\b/.test(body) || /##\s*test/.test(body) || /qa\s*steps/.test(body);
|
|
949
4011
|
}
|
|
950
|
-
if (
|
|
4012
|
+
if (h3 === "screenshot") {
|
|
951
4013
|
return /screenshot|screen recording|loom|recording/i.test(body);
|
|
952
4014
|
}
|
|
953
|
-
return body.includes(
|
|
4015
|
+
return body.includes(h3);
|
|
954
4016
|
}
|
|
955
4017
|
|
|
956
4018
|
// src/checks/pr-size.ts
|
|
@@ -987,12 +4049,14 @@ function runPrSize(config, pr) {
|
|
|
987
4049
|
durationMs: Math.round(performance.now() - t0)
|
|
988
4050
|
};
|
|
989
4051
|
}
|
|
4052
|
+
|
|
4053
|
+
// src/runner/git.ts
|
|
990
4054
|
async function gitOk(cwd) {
|
|
991
4055
|
try {
|
|
992
|
-
const
|
|
4056
|
+
const r4 = await W2("git", ["rev-parse", "--is-inside-work-tree"], {
|
|
993
4057
|
nodeOptions: { cwd }
|
|
994
4058
|
});
|
|
995
|
-
return (
|
|
4059
|
+
return (r4.stdout ?? "").trim() === "true";
|
|
996
4060
|
} catch {
|
|
997
4061
|
return false;
|
|
998
4062
|
}
|
|
@@ -1000,30 +4064,30 @@ async function gitOk(cwd) {
|
|
|
1000
4064
|
async function gitDiffPatch(cwd, baseRef, pathspecs) {
|
|
1001
4065
|
if (pathspecs.length === 0) return null;
|
|
1002
4066
|
try {
|
|
1003
|
-
const
|
|
4067
|
+
const r4 = await W2(
|
|
1004
4068
|
"git",
|
|
1005
4069
|
["diff", `${baseRef}...HEAD`, "--unified=1", "--no-color", "--", ...pathspecs],
|
|
1006
4070
|
{ nodeOptions: { cwd } }
|
|
1007
4071
|
);
|
|
1008
|
-
return
|
|
4072
|
+
return r4.stdout ?? "";
|
|
1009
4073
|
} catch {
|
|
1010
4074
|
return null;
|
|
1011
4075
|
}
|
|
1012
4076
|
}
|
|
1013
4077
|
async function gitDiffForReview(cwd, baseRef, maxChars) {
|
|
1014
4078
|
try {
|
|
1015
|
-
const
|
|
4079
|
+
const r4 = await W2(
|
|
1016
4080
|
"git",
|
|
1017
4081
|
["diff", `${baseRef}...HEAD`, "--unified=2", "--no-color"],
|
|
1018
4082
|
{
|
|
1019
4083
|
nodeOptions: { cwd }
|
|
1020
4084
|
}
|
|
1021
4085
|
);
|
|
1022
|
-
let
|
|
1023
|
-
if (
|
|
1024
|
-
|
|
4086
|
+
let s3 = r4.stdout ?? "";
|
|
4087
|
+
if (s3.length > maxChars) {
|
|
4088
|
+
s3 = s3.slice(0, maxChars) + "\n\u2026(truncated)\n";
|
|
1025
4089
|
}
|
|
1026
|
-
return
|
|
4090
|
+
return s3;
|
|
1027
4091
|
} catch {
|
|
1028
4092
|
return "";
|
|
1029
4093
|
}
|
|
@@ -1033,18 +4097,18 @@ async function resolveDiffBaseRef(cwd, fallback) {
|
|
|
1033
4097
|
if (gh) {
|
|
1034
4098
|
const origin = `origin/${gh}`;
|
|
1035
4099
|
try {
|
|
1036
|
-
await
|
|
4100
|
+
await W2("git", ["rev-parse", "--verify", origin], { nodeOptions: { cwd } });
|
|
1037
4101
|
return origin;
|
|
1038
4102
|
} catch {
|
|
1039
4103
|
}
|
|
1040
4104
|
}
|
|
1041
4105
|
try {
|
|
1042
4106
|
const cand = fallback.includes("/") ? fallback : `origin/${fallback}`;
|
|
1043
|
-
await
|
|
4107
|
+
await W2("git", ["rev-parse", "--verify", cand], { nodeOptions: { cwd } });
|
|
1044
4108
|
return cand;
|
|
1045
4109
|
} catch {
|
|
1046
4110
|
try {
|
|
1047
|
-
await
|
|
4111
|
+
await W2("git", ["rev-parse", "--verify", fallback], { nodeOptions: { cwd } });
|
|
1048
4112
|
return fallback;
|
|
1049
4113
|
} catch {
|
|
1050
4114
|
return fallback;
|
|
@@ -1053,11 +4117,11 @@ async function resolveDiffBaseRef(cwd, fallback) {
|
|
|
1053
4117
|
}
|
|
1054
4118
|
|
|
1055
4119
|
// src/checks/ts-any-delta.ts
|
|
1056
|
-
function gateSeverity(
|
|
1057
|
-
return
|
|
4120
|
+
function gateSeverity(g4) {
|
|
4121
|
+
return g4 === "block" ? "block" : g4 === "info" ? "info" : "warn";
|
|
1058
4122
|
}
|
|
1059
4123
|
function countAddedAnyInPatch(patch) {
|
|
1060
|
-
let
|
|
4124
|
+
let n3 = 0;
|
|
1061
4125
|
for (const raw of patch.split("\n")) {
|
|
1062
4126
|
if (!raw.startsWith("+") || raw.startsWith("+++")) continue;
|
|
1063
4127
|
const line = raw.slice(1);
|
|
@@ -1070,12 +4134,12 @@ function countAddedAnyInPatch(patch) {
|
|
|
1070
4134
|
/\bArray\s*<\s*any\s*>/g,
|
|
1071
4135
|
/\bRecord\s*<\s*[^,]+,\s*any\s*>/g
|
|
1072
4136
|
];
|
|
1073
|
-
for (const
|
|
1074
|
-
const
|
|
1075
|
-
if (
|
|
4137
|
+
for (const p2 of patterns) {
|
|
4138
|
+
const m3 = line.match(p2);
|
|
4139
|
+
if (m3) n3 += m3.length;
|
|
1076
4140
|
}
|
|
1077
4141
|
}
|
|
1078
|
-
return
|
|
4142
|
+
return n3;
|
|
1079
4143
|
}
|
|
1080
4144
|
async function runTsAnyDelta(cwd, config, stack) {
|
|
1081
4145
|
const t0 = performance.now();
|
|
@@ -1130,8 +4194,8 @@ async function runTsAnyDelta(cwd, config, stack) {
|
|
|
1130
4194
|
durationMs: Math.round(performance.now() - t0)
|
|
1131
4195
|
};
|
|
1132
4196
|
}
|
|
1133
|
-
function gateSeverity2(
|
|
1134
|
-
return
|
|
4197
|
+
function gateSeverity2(g4) {
|
|
4198
|
+
return g4 === "block" ? "block" : g4 === "info" ? "info" : "warn";
|
|
1135
4199
|
}
|
|
1136
4200
|
async function runCycles(cwd, config, stack) {
|
|
1137
4201
|
const t0 = performance.now();
|
|
@@ -1145,9 +4209,9 @@ async function runCycles(cwd, config, stack) {
|
|
|
1145
4209
|
};
|
|
1146
4210
|
}
|
|
1147
4211
|
let entry = cfg.entries[0] ?? "src";
|
|
1148
|
-
for (const
|
|
1149
|
-
if (await pathExists(path.join(cwd,
|
|
1150
|
-
entry =
|
|
4212
|
+
for (const e3 of cfg.entries) {
|
|
4213
|
+
if (await pathExists(path.join(cwd, e3))) {
|
|
4214
|
+
entry = e3;
|
|
1151
4215
|
break;
|
|
1152
4216
|
}
|
|
1153
4217
|
}
|
|
@@ -1168,8 +4232,8 @@ async function runCycles(cwd, config, stack) {
|
|
|
1168
4232
|
"--circular",
|
|
1169
4233
|
...cfg.extraArgs
|
|
1170
4234
|
];
|
|
1171
|
-
const { exitCode, stdout, stderr } = await runNpx(cwd, args);
|
|
1172
|
-
const out = [
|
|
4235
|
+
const { exitCode, stdout: stdout2, stderr } = await runNpx(cwd, args);
|
|
4236
|
+
const out = [stdout2, stderr].filter(Boolean).join("\n").trim();
|
|
1173
4237
|
if (exitCode === 127 || /command not found|not recognized|ENOENT/i.test(stderr)) {
|
|
1174
4238
|
return {
|
|
1175
4239
|
checkId: "cycles",
|
|
@@ -1201,14 +4265,14 @@ async function runCycles(cwd, config, stack) {
|
|
|
1201
4265
|
durationMs: Math.round(performance.now() - t0)
|
|
1202
4266
|
};
|
|
1203
4267
|
}
|
|
1204
|
-
function truncate4(
|
|
1205
|
-
if (
|
|
1206
|
-
return
|
|
4268
|
+
function truncate4(s3, max) {
|
|
4269
|
+
if (s3.length <= max) return s3;
|
|
4270
|
+
return s3.slice(0, max) + "\u2026";
|
|
1207
4271
|
}
|
|
1208
4272
|
|
|
1209
4273
|
// src/checks/dead-code.ts
|
|
1210
|
-
function gateSeverity3(
|
|
1211
|
-
return
|
|
4274
|
+
function gateSeverity3(g4) {
|
|
4275
|
+
return g4 === "block" ? "block" : g4 === "info" ? "info" : "warn";
|
|
1212
4276
|
}
|
|
1213
4277
|
async function runDeadCode(cwd, config, stack, pr) {
|
|
1214
4278
|
const t0 = performance.now();
|
|
@@ -1222,7 +4286,7 @@ async function runDeadCode(cwd, config, stack, pr) {
|
|
|
1222
4286
|
};
|
|
1223
4287
|
}
|
|
1224
4288
|
const args = ["-y", "ts-prune", ...cfg.extraArgs];
|
|
1225
|
-
const { exitCode, stdout, stderr } = await runNpx(cwd, args);
|
|
4289
|
+
const { exitCode, stdout: stdout2, stderr } = await runNpx(cwd, args);
|
|
1226
4290
|
if (exitCode === 127 || /command not found|not recognized|ENOENT/i.test(stderr)) {
|
|
1227
4291
|
return {
|
|
1228
4292
|
checkId: "dead-code",
|
|
@@ -1231,8 +4295,8 @@ async function runDeadCode(cwd, config, stack, pr) {
|
|
|
1231
4295
|
skipped: "npx/ts-prune not available"
|
|
1232
4296
|
};
|
|
1233
4297
|
}
|
|
1234
|
-
const raw = (
|
|
1235
|
-
const lines = raw.split("\n").map((
|
|
4298
|
+
const raw = (stdout2 || "").trim();
|
|
4299
|
+
const lines = raw.split("\n").map((l3) => l3.trim()).filter((l3) => l3 && /^[\w./\\~-]+[^\s]*\s*-\s*.+/.test(l3));
|
|
1236
4300
|
if (lines.length === 0) {
|
|
1237
4301
|
return {
|
|
1238
4302
|
checkId: "dead-code",
|
|
@@ -1240,11 +4304,11 @@ async function runDeadCode(cwd, config, stack, pr) {
|
|
|
1240
4304
|
durationMs: Math.round(performance.now() - t0)
|
|
1241
4305
|
};
|
|
1242
4306
|
}
|
|
1243
|
-
const prFiles = pr?.files?.length ? new Set(pr.files.map((
|
|
1244
|
-
const relevant = prFiles ? lines.filter((
|
|
1245
|
-
const file =
|
|
4307
|
+
const prFiles = pr?.files?.length ? new Set(pr.files.map((f4) => f4.replace(/\\/g, "/"))) : null;
|
|
4308
|
+
const relevant = prFiles ? lines.filter((l3) => {
|
|
4309
|
+
const file = l3.split(/\s*-\s*/)[0]?.trim();
|
|
1246
4310
|
if (!file) return false;
|
|
1247
|
-
return [...prFiles].some((
|
|
4311
|
+
return [...prFiles].some((p2) => p2 === file || p2.endsWith(file));
|
|
1248
4312
|
}) : lines;
|
|
1249
4313
|
const report = (relevant.length ? relevant : lines).slice(0, cfg.maxReportLines).join("\n");
|
|
1250
4314
|
const findings = [
|
|
@@ -1261,8 +4325,8 @@ async function runDeadCode(cwd, config, stack, pr) {
|
|
|
1261
4325
|
durationMs: Math.round(performance.now() - t0)
|
|
1262
4326
|
};
|
|
1263
4327
|
}
|
|
1264
|
-
function gateSeverity4(
|
|
1265
|
-
return
|
|
4328
|
+
function gateSeverity4(g4) {
|
|
4329
|
+
return g4 === "block" ? "block" : g4 === "info" ? "info" : "warn";
|
|
1266
4330
|
}
|
|
1267
4331
|
async function sumGlobBytes(cwd, patterns) {
|
|
1268
4332
|
let total = 0;
|
|
@@ -1292,27 +4356,27 @@ async function readBaseline(cwd, relPath, baseRef) {
|
|
|
1292
4356
|
}
|
|
1293
4357
|
if (!baseRef) return null;
|
|
1294
4358
|
try {
|
|
1295
|
-
const
|
|
4359
|
+
const r4 = await W2("git", ["show", `${baseRef}:${relPath}`], {
|
|
1296
4360
|
nodeOptions: { cwd }
|
|
1297
4361
|
});
|
|
1298
|
-
if ((
|
|
1299
|
-
return JSON.parse((
|
|
4362
|
+
if ((r4.exitCode ?? 0) !== 0) return null;
|
|
4363
|
+
return JSON.parse((r4.stdout ?? "").trim());
|
|
1300
4364
|
} catch {
|
|
1301
4365
|
return null;
|
|
1302
4366
|
}
|
|
1303
4367
|
}
|
|
1304
4368
|
async function gitOkQuick(cwd) {
|
|
1305
4369
|
try {
|
|
1306
|
-
const
|
|
4370
|
+
const r4 = await W2("git", ["rev-parse", "--is-inside-work-tree"], {
|
|
1307
4371
|
nodeOptions: { cwd }
|
|
1308
4372
|
});
|
|
1309
|
-
return (
|
|
4373
|
+
return (r4.stdout ?? "").trim() === "true";
|
|
1310
4374
|
} catch {
|
|
1311
4375
|
return false;
|
|
1312
4376
|
}
|
|
1313
4377
|
}
|
|
1314
4378
|
function tokenizeCommand(cmd) {
|
|
1315
|
-
return cmd.trim().split(/\s+/).map((
|
|
4379
|
+
return cmd.trim().split(/\s+/).map((t3) => t3.trim()).filter(Boolean);
|
|
1316
4380
|
}
|
|
1317
4381
|
async function runBundle(cwd, config, stack) {
|
|
1318
4382
|
const t0 = performance.now();
|
|
@@ -1349,7 +4413,7 @@ async function runBundle(cwd, config, stack) {
|
|
|
1349
4413
|
};
|
|
1350
4414
|
}
|
|
1351
4415
|
const [bin, ...args] = parts;
|
|
1352
|
-
const res = await
|
|
4416
|
+
const res = await W2(bin, args, { nodeOptions: { cwd } });
|
|
1353
4417
|
if ((res.exitCode ?? 0) !== 0) {
|
|
1354
4418
|
return {
|
|
1355
4419
|
checkId: "bundle",
|
|
@@ -1427,8 +4491,8 @@ async function runBundle(cwd, config, stack) {
|
|
|
1427
4491
|
durationMs: Math.round(performance.now() - t0)
|
|
1428
4492
|
};
|
|
1429
4493
|
}
|
|
1430
|
-
function gateSeverity5(
|
|
1431
|
-
return
|
|
4494
|
+
function gateSeverity5(g4) {
|
|
4495
|
+
return g4 === "block" ? "block" : g4 === "info" ? "info" : "warn";
|
|
1432
4496
|
}
|
|
1433
4497
|
async function runCwv(cwd, config, stack, pr) {
|
|
1434
4498
|
const t0 = performance.now();
|
|
@@ -1449,13 +4513,13 @@ async function runCwv(cwd, config, stack, pr) {
|
|
|
1449
4513
|
skipped: "skipped for React Native"
|
|
1450
4514
|
};
|
|
1451
4515
|
}
|
|
1452
|
-
const prSet = pr?.files?.length ? new Set(pr.files.map((
|
|
4516
|
+
const prSet = pr?.files?.length ? new Set(pr.files.map((f4) => f4.replace(/\\/g, "/"))) : null;
|
|
1453
4517
|
const files = await fg(cfg.scanGlobs, {
|
|
1454
4518
|
cwd,
|
|
1455
4519
|
onlyFiles: true,
|
|
1456
4520
|
ignore: ["**/node_modules/**", "**/*.test.*", "**/*.spec.*"]
|
|
1457
4521
|
});
|
|
1458
|
-
const toScan = prSet ? files.filter((
|
|
4522
|
+
const toScan = prSet ? files.filter((f4) => [...prSet].some((p2) => p2 === f4 || p2.endsWith(f4))) : files;
|
|
1459
4523
|
const findings = [];
|
|
1460
4524
|
const sev2 = gateSeverity5(cfg.gate);
|
|
1461
4525
|
for (const rel of toScan.slice(0, 400)) {
|
|
@@ -1490,14 +4554,14 @@ async function runCwv(cwd, config, stack, pr) {
|
|
|
1490
4554
|
durationMs: Math.round(performance.now() - t0)
|
|
1491
4555
|
};
|
|
1492
4556
|
}
|
|
1493
|
-
function dedupeFindings(
|
|
4557
|
+
function dedupeFindings(f4) {
|
|
1494
4558
|
const seen = /* @__PURE__ */ new Set();
|
|
1495
4559
|
const out = [];
|
|
1496
|
-
for (const
|
|
1497
|
-
const
|
|
1498
|
-
if (seen.has(
|
|
1499
|
-
seen.add(
|
|
1500
|
-
out.push(
|
|
4560
|
+
for (const x3 of f4) {
|
|
4561
|
+
const k3 = `${x3.id}:${x3.file ?? ""}`;
|
|
4562
|
+
if (seen.has(k3)) continue;
|
|
4563
|
+
seen.add(k3);
|
|
4564
|
+
out.push(x3);
|
|
1501
4565
|
}
|
|
1502
4566
|
return out;
|
|
1503
4567
|
}
|
|
@@ -1513,7 +4577,7 @@ async function runCustomRules(cwd, config, restrictToFiles) {
|
|
|
1513
4577
|
skipped: "no rules configured"
|
|
1514
4578
|
};
|
|
1515
4579
|
}
|
|
1516
|
-
const active = Object.entries(rules).filter(([,
|
|
4580
|
+
const active = Object.entries(rules).filter(([, v3]) => v3 !== "off");
|
|
1517
4581
|
if (active.length === 0) {
|
|
1518
4582
|
return {
|
|
1519
4583
|
checkId: "custom-rules",
|
|
@@ -1524,7 +4588,7 @@ async function runCustomRules(cwd, config, restrictToFiles) {
|
|
|
1524
4588
|
}
|
|
1525
4589
|
let files;
|
|
1526
4590
|
if (restrictToFiles?.length) {
|
|
1527
|
-
files = restrictToFiles.filter((
|
|
4591
|
+
files = restrictToFiles.filter((f4) => /\.(tsx?|jsx?|mjs|cjs)$/i.test(f4));
|
|
1528
4592
|
} else {
|
|
1529
4593
|
files = await fg(DEFAULT_GLOB, {
|
|
1530
4594
|
cwd,
|
|
@@ -1534,9 +4598,9 @@ async function runCustomRules(cwd, config, restrictToFiles) {
|
|
|
1534
4598
|
}
|
|
1535
4599
|
const findings = [];
|
|
1536
4600
|
const maxFiles = 300;
|
|
1537
|
-
let
|
|
4601
|
+
let n3 = 0;
|
|
1538
4602
|
for (const rel of files) {
|
|
1539
|
-
if (
|
|
4603
|
+
if (n3++ > maxFiles) {
|
|
1540
4604
|
findings.push({
|
|
1541
4605
|
id: "custom-rules-cap",
|
|
1542
4606
|
severity: "info",
|
|
@@ -1564,12 +4628,12 @@ async function runCustomRules(cwd, config, restrictToFiles) {
|
|
|
1564
4628
|
file: rel
|
|
1565
4629
|
});
|
|
1566
4630
|
}
|
|
1567
|
-
} catch (
|
|
4631
|
+
} catch (e3) {
|
|
1568
4632
|
findings.push({
|
|
1569
4633
|
id: `rule-error:${id}`,
|
|
1570
4634
|
severity: "warn",
|
|
1571
4635
|
message: `Rule \`${id}\` threw`,
|
|
1572
|
-
detail:
|
|
4636
|
+
detail: e3 instanceof Error ? e3.message : String(e3),
|
|
1573
4637
|
file: rel
|
|
1574
4638
|
});
|
|
1575
4639
|
}
|
|
@@ -1671,7 +4735,7 @@ async function runAiAssistedStrict(cwd, config, pr) {
|
|
|
1671
4735
|
skipped: "PR does not indicate AI-assisted code"
|
|
1672
4736
|
};
|
|
1673
4737
|
}
|
|
1674
|
-
const files = (pr.files ?? []).filter((
|
|
4738
|
+
const files = (pr.files ?? []).filter((f4) => CODE_EXT.test(f4)).slice(0, 150);
|
|
1675
4739
|
const gate = cfg.gate;
|
|
1676
4740
|
const findings = [];
|
|
1677
4741
|
for (const rel of files) {
|
|
@@ -1699,14 +4763,14 @@ async function runAiAssistedStrict(cwd, config, pr) {
|
|
|
1699
4763
|
durationMs: Math.round(performance.now() - t0)
|
|
1700
4764
|
};
|
|
1701
4765
|
}
|
|
1702
|
-
function dedupe(
|
|
1703
|
-
const
|
|
4766
|
+
function dedupe(f4) {
|
|
4767
|
+
const s3 = /* @__PURE__ */ new Set();
|
|
1704
4768
|
const out = [];
|
|
1705
|
-
for (const
|
|
1706
|
-
const
|
|
1707
|
-
if (
|
|
1708
|
-
|
|
1709
|
-
out.push(
|
|
4769
|
+
for (const x3 of f4) {
|
|
4770
|
+
const k3 = `${x3.id}:${x3.file ?? ""}`;
|
|
4771
|
+
if (s3.has(k3)) continue;
|
|
4772
|
+
s3.add(k3);
|
|
4773
|
+
out.push(x3);
|
|
1710
4774
|
}
|
|
1711
4775
|
return out;
|
|
1712
4776
|
}
|
|
@@ -1716,28 +4780,31 @@ function applyAiAssistedEscalation(results, pr, config) {
|
|
|
1716
4780
|
const cfg = config.checks.aiAssistedReview;
|
|
1717
4781
|
if (!pr?.aiAssisted || !cfg.enabled) return;
|
|
1718
4782
|
const { escalate } = cfg;
|
|
1719
|
-
for (const
|
|
1720
|
-
if (
|
|
1721
|
-
if (escalate.secretFindingsToBlock &&
|
|
1722
|
-
for (const
|
|
1723
|
-
if (
|
|
4783
|
+
for (const r4 of results) {
|
|
4784
|
+
if (r4.skipped) continue;
|
|
4785
|
+
if (escalate.secretFindingsToBlock && r4.checkId === "secrets") {
|
|
4786
|
+
for (const f4 of r4.findings) {
|
|
4787
|
+
if (f4.severity === "warn" || f4.severity === "info") f4.severity = "block";
|
|
1724
4788
|
}
|
|
1725
4789
|
}
|
|
1726
|
-
if (escalate.tsAnyDeltaToBlock &&
|
|
1727
|
-
for (const
|
|
1728
|
-
if (
|
|
4790
|
+
if (escalate.tsAnyDeltaToBlock && r4.checkId === "ts-any-delta") {
|
|
4791
|
+
for (const f4 of r4.findings) {
|
|
4792
|
+
if (f4.severity === "warn" || f4.severity === "info") f4.severity = "block";
|
|
1729
4793
|
}
|
|
1730
4794
|
}
|
|
1731
4795
|
}
|
|
1732
4796
|
}
|
|
4797
|
+
|
|
4798
|
+
// src/report/builder.ts
|
|
4799
|
+
var import_picocolors = __toESM(require_picocolors());
|
|
1733
4800
|
function buildReport(stack, pr, results, options) {
|
|
1734
4801
|
const mode = options?.mode ?? "warn";
|
|
1735
4802
|
const allFindings = results.flatMap(
|
|
1736
|
-
(
|
|
4803
|
+
(r4) => r4.findings.map((f4) => ({ ...f4, checkId: r4.checkId }))
|
|
1737
4804
|
);
|
|
1738
|
-
const warns = allFindings.filter((
|
|
1739
|
-
const infos = allFindings.filter((
|
|
1740
|
-
const blocks = allFindings.filter((
|
|
4805
|
+
const warns = allFindings.filter((f4) => f4.severity === "warn").length;
|
|
4806
|
+
const infos = allFindings.filter((f4) => f4.severity === "info").length;
|
|
4807
|
+
const blocks = allFindings.filter((f4) => f4.severity === "block").length;
|
|
1741
4808
|
const lines = pr != null ? pr.additions + pr.deletions : null;
|
|
1742
4809
|
const riskScore = scoreRisk(blocks, warns, lines, pr?.changedFiles ?? 0);
|
|
1743
4810
|
const markdown = formatMarkdown({
|
|
@@ -1764,14 +4831,14 @@ function buildReport(stack, pr, results, options) {
|
|
|
1764
4831
|
});
|
|
1765
4832
|
return { riskScore, stack, pr, results, markdown, consoleText };
|
|
1766
4833
|
}
|
|
1767
|
-
function formatStackOneLiner(
|
|
4834
|
+
function formatStackOneLiner(s3) {
|
|
1768
4835
|
const bits = [];
|
|
1769
|
-
if (
|
|
1770
|
-
if (
|
|
1771
|
-
else if (
|
|
1772
|
-
if (
|
|
1773
|
-
if (
|
|
1774
|
-
bits.push(`pkg: ${
|
|
4836
|
+
if (s3.hasNext) bits.push("Next.js");
|
|
4837
|
+
if (s3.hasReactNative) bits.push("React Native");
|
|
4838
|
+
else if (s3.hasReact) bits.push("React");
|
|
4839
|
+
if (s3.hasTypeScript) bits.push("TypeScript");
|
|
4840
|
+
if (s3.tsStrict === true) bits.push("strict TS");
|
|
4841
|
+
bits.push(`pkg: ${s3.packageManager}`);
|
|
1775
4842
|
return bits.join(" \xB7 ") || "unknown";
|
|
1776
4843
|
}
|
|
1777
4844
|
function scoreRisk(blocks, warns, lines, files) {
|
|
@@ -1788,7 +4855,7 @@ function scoreRisk(blocks, warns, lines, files) {
|
|
|
1788
4855
|
if (score >= 2) return "MEDIUM";
|
|
1789
4856
|
return "LOW";
|
|
1790
4857
|
}
|
|
1791
|
-
function formatMarkdown(
|
|
4858
|
+
function formatMarkdown(p2) {
|
|
1792
4859
|
const {
|
|
1793
4860
|
riskScore,
|
|
1794
4861
|
mode,
|
|
@@ -1800,7 +4867,7 @@ function formatMarkdown(p) {
|
|
|
1800
4867
|
blocks,
|
|
1801
4868
|
lines,
|
|
1802
4869
|
llmAppendix
|
|
1803
|
-
} =
|
|
4870
|
+
} = p2;
|
|
1804
4871
|
const sb = [];
|
|
1805
4872
|
sb.push("## FrontGuard review brief");
|
|
1806
4873
|
sb.push("");
|
|
@@ -1827,25 +4894,25 @@ function formatMarkdown(p) {
|
|
|
1827
4894
|
sb.push(`**Warnings:** ${warns} \xB7 **Info:** ${infos}`);
|
|
1828
4895
|
sb.push("");
|
|
1829
4896
|
sb.push("### Check summary");
|
|
1830
|
-
for (const
|
|
1831
|
-
const status =
|
|
1832
|
-
sb.push(`- **${
|
|
4897
|
+
for (const r4 of results) {
|
|
4898
|
+
const status = r4.skipped ? `\u23ED\uFE0F skipped (${r4.skipped})` : r4.findings.length === 0 ? "\u2705 clean" : `\u26A0\uFE0F ${r4.findings.length} finding(s)`;
|
|
4899
|
+
sb.push(`- **${r4.checkId}** \u2014 ${status} (${r4.durationMs}ms)`);
|
|
1833
4900
|
}
|
|
1834
4901
|
sb.push("");
|
|
1835
4902
|
const blockFindings = results.flatMap(
|
|
1836
|
-
(
|
|
4903
|
+
(r4) => r4.findings.filter((f4) => f4.severity === "block").map((f4) => ({ r: r4, f: f4 }))
|
|
1837
4904
|
);
|
|
1838
4905
|
if (blockFindings.length) {
|
|
1839
4906
|
sb.push("### Blocking");
|
|
1840
|
-
for (const { f } of blockFindings.slice(0, 40)) {
|
|
1841
|
-
const loc =
|
|
1842
|
-
sb.push(`- ${
|
|
1843
|
-
if (
|
|
4907
|
+
for (const { f: f4 } of blockFindings.slice(0, 40)) {
|
|
4908
|
+
const loc = f4.file ? ` \`${f4.file}\`` : "";
|
|
4909
|
+
sb.push(`- ${f4.message}${loc}`);
|
|
4910
|
+
if (f4.detail) {
|
|
1844
4911
|
sb.push(
|
|
1845
4912
|
` - <details><summary>detail</summary>
|
|
1846
4913
|
|
|
1847
4914
|
\`\`\`text
|
|
1848
|
-
${
|
|
4915
|
+
${f4.detail}
|
|
1849
4916
|
\`\`\`
|
|
1850
4917
|
|
|
1851
4918
|
</details>`
|
|
@@ -1855,19 +4922,19 @@ ${f.detail}
|
|
|
1855
4922
|
sb.push("");
|
|
1856
4923
|
}
|
|
1857
4924
|
const warnFindings = results.flatMap(
|
|
1858
|
-
(
|
|
4925
|
+
(r4) => r4.findings.filter((f4) => f4.severity === "warn").map((f4) => ({ r: r4, f: f4 }))
|
|
1859
4926
|
);
|
|
1860
4927
|
if (warnFindings.length) {
|
|
1861
4928
|
sb.push("### Warnings");
|
|
1862
|
-
for (const { f } of warnFindings.slice(0, 30)) {
|
|
1863
|
-
const loc =
|
|
1864
|
-
sb.push(`- ${
|
|
1865
|
-
if (
|
|
4929
|
+
for (const { f: f4 } of warnFindings.slice(0, 30)) {
|
|
4930
|
+
const loc = f4.file ? ` \`${f4.file}\`` : "";
|
|
4931
|
+
sb.push(`- ${f4.message}${loc}`);
|
|
4932
|
+
if (f4.detail) {
|
|
1866
4933
|
sb.push(
|
|
1867
4934
|
` - <details><summary>detail</summary>
|
|
1868
4935
|
|
|
1869
4936
|
\`\`\`text
|
|
1870
|
-
${
|
|
4937
|
+
${f4.detail}
|
|
1871
4938
|
\`\`\`
|
|
1872
4939
|
|
|
1873
4940
|
</details>`
|
|
@@ -1880,12 +4947,12 @@ ${f.detail}
|
|
|
1880
4947
|
sb.push("");
|
|
1881
4948
|
}
|
|
1882
4949
|
const infoFindings = results.flatMap(
|
|
1883
|
-
(
|
|
4950
|
+
(r4) => r4.findings.filter((f4) => f4.severity === "info").map((f4) => ({ r: r4, f: f4 }))
|
|
1884
4951
|
);
|
|
1885
4952
|
if (infoFindings.length) {
|
|
1886
4953
|
sb.push("### Notes");
|
|
1887
|
-
for (const { f } of infoFindings.slice(0, 20)) {
|
|
1888
|
-
sb.push(`- ${
|
|
4954
|
+
for (const { f: f4 } of infoFindings.slice(0, 20)) {
|
|
4955
|
+
sb.push(`- ${f4.message}`);
|
|
1889
4956
|
}
|
|
1890
4957
|
sb.push("");
|
|
1891
4958
|
}
|
|
@@ -1897,32 +4964,34 @@ ${f.detail}
|
|
|
1897
4964
|
sb.push("_Generated by FrontGuard \u2014 configure with `frontguard.config.js`_");
|
|
1898
4965
|
return sb.join("\n");
|
|
1899
4966
|
}
|
|
1900
|
-
function formatConsole(
|
|
1901
|
-
const { riskScore, mode, stack, pr, results, warns, infos, blocks } =
|
|
4967
|
+
function formatConsole(p2) {
|
|
4968
|
+
const { riskScore, mode, stack, pr, results, warns, infos, blocks } = p2;
|
|
1902
4969
|
const lines = [];
|
|
1903
|
-
lines.push(
|
|
1904
|
-
lines.push(`\u2502 ${
|
|
1905
|
-
lines.push(`\u2502 ${
|
|
4970
|
+
lines.push(import_picocolors.default.bold("\u250C\u2500 FrontGuard review brief \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510"));
|
|
4971
|
+
lines.push(`\u2502 ${import_picocolors.default.dim("Risk:")} ${riskScore.padEnd(43)} \u2502`);
|
|
4972
|
+
lines.push(`\u2502 ${import_picocolors.default.dim("Mode:")} ${mode.padEnd(42)} \u2502`);
|
|
1906
4973
|
lines.push(
|
|
1907
|
-
`\u2502 ${
|
|
4974
|
+
`\u2502 ${import_picocolors.default.dim("Stack:")} ${(stack.hasNext ? "Next.js " : "") + (stack.hasReactNative ? "RN " : "") + (stack.hasReact ? "React " : "") + (stack.hasTypeScript ? "TS" : "JS")}`.padEnd(56).slice(0, 56) + " \u2502"
|
|
1908
4975
|
);
|
|
1909
4976
|
if (pr) {
|
|
1910
4977
|
const sz = `${pr.additions + pr.deletions} lines (+${pr.additions}/-${pr.deletions}) \xB7 ${pr.changedFiles} files`;
|
|
1911
|
-
lines.push(`\u2502 ${
|
|
4978
|
+
lines.push(`\u2502 ${import_picocolors.default.dim("PR:")} ${sz.slice(0, 49).padEnd(49)} \u2502`);
|
|
1912
4979
|
}
|
|
1913
4980
|
lines.push("\u2502 " + "".padEnd(53) + " \u2502");
|
|
1914
|
-
const statusLine = blocks > 0 ?
|
|
4981
|
+
const statusLine = blocks > 0 ? import_picocolors.default.red(`\u2716 ${blocks} blocking`) : warns === 0 && infos === 0 ? import_picocolors.default.green("\u2713 No findings") : import_picocolors.default.yellow(`\u26A0 ${warns} warnings \xB7 ${infos} info`);
|
|
1915
4982
|
lines.push(`\u2502 ${statusLine}`.padEnd(64).slice(0, 64) + " \u2502");
|
|
1916
|
-
for (const
|
|
1917
|
-
const label =
|
|
4983
|
+
for (const r4 of results) {
|
|
4984
|
+
const label = r4.skipped ? import_picocolors.default.dim(` ${r4.checkId}: skipped`) : ` ${r4.checkId}: ${r4.findings.length} issues`;
|
|
1918
4985
|
lines.push(`\u2502${label.slice(0, 54).padEnd(54)}\u2502`);
|
|
1919
4986
|
}
|
|
1920
|
-
lines.push(
|
|
4987
|
+
lines.push(import_picocolors.default.bold("\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518"));
|
|
1921
4988
|
return lines.join("\n");
|
|
1922
4989
|
}
|
|
4990
|
+
|
|
4991
|
+
// src/llm/review.ts
|
|
1923
4992
|
function safeGetEnv(name) {
|
|
1924
|
-
const
|
|
1925
|
-
return
|
|
4993
|
+
const v3 = process.env[name];
|
|
4994
|
+
return v3 && v3.trim() ? v3 : void 0;
|
|
1926
4995
|
}
|
|
1927
4996
|
async function runLlmReview(opts) {
|
|
1928
4997
|
const { cwd, config, pr, results } = opts;
|
|
@@ -1952,8 +5021,8 @@ async function runLlmReview(opts) {
|
|
|
1952
5021
|
if (!diff.trim()) {
|
|
1953
5022
|
return "_LLM review skipped: empty diff vs base_";
|
|
1954
5023
|
}
|
|
1955
|
-
const summaryLines = results.flatMap((
|
|
1956
|
-
const
|
|
5024
|
+
const summaryLines = results.flatMap((r4) => r4.findings.map((f4) => `- [${f4.severity}] ${r4.checkId}: ${f4.message}`)).slice(0, 40).join("\n");
|
|
5025
|
+
const prompt2 = [
|
|
1957
5026
|
"You are a senior frontend reviewer. Respond in Markdown with short sections:",
|
|
1958
5027
|
"### Summary",
|
|
1959
5028
|
"### Risk hotspots (files / themes)",
|
|
@@ -1977,26 +5046,27 @@ ${pr.body.slice(0, 2e3)}` : "No GitHub PR context (local run).",
|
|
|
1977
5046
|
"```"
|
|
1978
5047
|
].join("\n");
|
|
1979
5048
|
const controller = new AbortController();
|
|
1980
|
-
const
|
|
5049
|
+
const t3 = setTimeout(() => controller.abort(), cfg.timeoutMs);
|
|
1981
5050
|
try {
|
|
1982
5051
|
if (cfg.provider === "anthropic") {
|
|
1983
|
-
const text2 = await callAnthropic(cfg.model, apiKey,
|
|
5052
|
+
const text2 = await callAnthropic(cfg.model, apiKey, prompt2, controller.signal);
|
|
1984
5053
|
return `### AI review (non-binding)
|
|
1985
5054
|
|
|
1986
5055
|
${text2}`;
|
|
1987
5056
|
}
|
|
1988
|
-
const text = await callOpenAI(cfg.model, apiKey,
|
|
5057
|
+
const text = await callOpenAI(cfg.model, apiKey, prompt2, controller.signal);
|
|
1989
5058
|
return `### AI review (non-binding)
|
|
1990
5059
|
|
|
1991
5060
|
${text}`;
|
|
1992
|
-
} catch (
|
|
1993
|
-
const msg =
|
|
5061
|
+
} catch (e3) {
|
|
5062
|
+
const msg = e3 instanceof Error ? e3.message : String(e3);
|
|
1994
5063
|
return `_LLM request failed: ${msg}_`;
|
|
1995
5064
|
} finally {
|
|
1996
|
-
clearTimeout(
|
|
5065
|
+
clearTimeout(t3);
|
|
1997
5066
|
}
|
|
1998
5067
|
}
|
|
1999
|
-
async function callOpenAI(model, apiKey,
|
|
5068
|
+
async function callOpenAI(model, apiKey, prompt2, signal) {
|
|
5069
|
+
const fetch = getFetch();
|
|
2000
5070
|
const res = await fetch("https://api.openai.com/v1/chat/completions", {
|
|
2001
5071
|
method: "POST",
|
|
2002
5072
|
signal,
|
|
@@ -2012,20 +5082,21 @@ async function callOpenAI(model, apiKey, prompt, signal) {
|
|
|
2012
5082
|
role: "system",
|
|
2013
5083
|
content: "You audit frontend pull requests. Output concise Markdown. No preamble about being an AI."
|
|
2014
5084
|
},
|
|
2015
|
-
{ role: "user", content:
|
|
5085
|
+
{ role: "user", content: prompt2 }
|
|
2016
5086
|
]
|
|
2017
5087
|
})
|
|
2018
5088
|
});
|
|
2019
5089
|
if (!res.ok) {
|
|
2020
|
-
const
|
|
2021
|
-
throw new Error(`OpenAI HTTP ${res.status}: ${
|
|
5090
|
+
const t3 = await res.text();
|
|
5091
|
+
throw new Error(`OpenAI HTTP ${res.status}: ${t3.slice(0, 500)}`);
|
|
2022
5092
|
}
|
|
2023
5093
|
const data = await res.json();
|
|
2024
5094
|
const text = data.choices?.[0]?.message?.content?.trim();
|
|
2025
5095
|
if (!text) throw new Error("OpenAI returned empty content");
|
|
2026
5096
|
return text;
|
|
2027
5097
|
}
|
|
2028
|
-
async function callAnthropic(model, apiKey,
|
|
5098
|
+
async function callAnthropic(model, apiKey, prompt2, signal) {
|
|
5099
|
+
const fetch = getFetch();
|
|
2029
5100
|
const res = await fetch("https://api.anthropic.com/v1/messages", {
|
|
2030
5101
|
method: "POST",
|
|
2031
5102
|
signal,
|
|
@@ -2038,15 +5109,15 @@ async function callAnthropic(model, apiKey, prompt, signal) {
|
|
|
2038
5109
|
model,
|
|
2039
5110
|
max_tokens: 4096,
|
|
2040
5111
|
temperature: 0.2,
|
|
2041
|
-
messages: [{ role: "user", content:
|
|
5112
|
+
messages: [{ role: "user", content: prompt2 }]
|
|
2042
5113
|
})
|
|
2043
5114
|
});
|
|
2044
5115
|
if (!res.ok) {
|
|
2045
|
-
const
|
|
2046
|
-
throw new Error(`Anthropic HTTP ${res.status}: ${
|
|
5116
|
+
const t3 = await res.text();
|
|
5117
|
+
throw new Error(`Anthropic HTTP ${res.status}: ${t3.slice(0, 500)}`);
|
|
2047
5118
|
}
|
|
2048
5119
|
const data = await res.json();
|
|
2049
|
-
const text = data.content?.map((
|
|
5120
|
+
const text = data.content?.map((b3) => b3.type === "text" ? b3.text : "").join("").trim();
|
|
2050
5121
|
if (!text) throw new Error("Anthropic returned empty content");
|
|
2051
5122
|
return text;
|
|
2052
5123
|
}
|
|
@@ -2062,13 +5133,13 @@ async function loadManualAppendix(opts) {
|
|
|
2062
5133
|
if (text.length > MAX_CHARS) {
|
|
2063
5134
|
text = text.slice(0, MAX_CHARS) + "\n\n_(truncated)_\n";
|
|
2064
5135
|
}
|
|
2065
|
-
const
|
|
2066
|
-
if (
|
|
5136
|
+
const t3 = text.trim();
|
|
5137
|
+
if (t3) {
|
|
2067
5138
|
return `### Contributed review notes
|
|
2068
5139
|
|
|
2069
5140
|
_Pasted or file-based (no CI API key)._
|
|
2070
5141
|
|
|
2071
|
-
${
|
|
5142
|
+
${t3}`;
|
|
2072
5143
|
}
|
|
2073
5144
|
} catch {
|
|
2074
5145
|
}
|
|
@@ -2148,28 +5219,28 @@ async function runFrontGuard(opts) {
|
|
|
2148
5219
|
const llmAppendix = [manualAppendix, automatedAppendix].filter(Boolean).join("\n\n") || null;
|
|
2149
5220
|
const report = buildReport(stack, pr, results, { mode, llmAppendix });
|
|
2150
5221
|
if (opts.markdown) {
|
|
2151
|
-
|
|
5222
|
+
g.stdout.write(report.markdown + "\n");
|
|
2152
5223
|
} else {
|
|
2153
|
-
|
|
2154
|
-
|
|
5224
|
+
g.stdout.write(report.consoleText + "\n\n");
|
|
5225
|
+
g.stdout.write(report.markdown + "\n");
|
|
2155
5226
|
}
|
|
2156
|
-
if (opts.ci &&
|
|
5227
|
+
if (opts.ci && g.env.GITHUB_TOKEN) {
|
|
2157
5228
|
await upsertBriefComment(report.markdown);
|
|
2158
5229
|
}
|
|
2159
|
-
const hasBlock = results.some((
|
|
2160
|
-
|
|
5230
|
+
const hasBlock = results.some((r4) => r4.findings.some((f4) => f4.severity === "block"));
|
|
5231
|
+
g.exitCode = mode === "enforce" && hasBlock ? 1 : 0;
|
|
2161
5232
|
}
|
|
2162
5233
|
|
|
2163
5234
|
// src/cli.ts
|
|
2164
|
-
var
|
|
5235
|
+
var init2 = defineCommand({
|
|
2165
5236
|
meta: {
|
|
2166
5237
|
name: "init",
|
|
2167
5238
|
description: "Add workflow, PR template, and frontguard.config.js"
|
|
2168
5239
|
},
|
|
2169
5240
|
run: async () => {
|
|
2170
|
-
const cwd =
|
|
5241
|
+
const cwd = g.cwd();
|
|
2171
5242
|
await initFrontGuard(cwd);
|
|
2172
|
-
|
|
5243
|
+
g.stdout.write(
|
|
2173
5244
|
"FrontGuard initialized.\n\nNext: add the package as a devDependency so CI matches local runs:\n npm install -D @cleartrip/frontguard\n yarn add -D @cleartrip/frontguard\n"
|
|
2174
5245
|
);
|
|
2175
5246
|
}
|
|
@@ -2202,7 +5273,7 @@ var run = defineCommand({
|
|
|
2202
5273
|
},
|
|
2203
5274
|
run: async ({ args }) => {
|
|
2204
5275
|
await runFrontGuard({
|
|
2205
|
-
cwd:
|
|
5276
|
+
cwd: g.cwd(),
|
|
2206
5277
|
ci: Boolean(args.ci),
|
|
2207
5278
|
markdown: Boolean(args.markdown),
|
|
2208
5279
|
enforce: Boolean(args.enforce),
|
|
@@ -2212,7 +5283,7 @@ var run = defineCommand({
|
|
|
2212
5283
|
});
|
|
2213
5284
|
var main = defineCommand({
|
|
2214
5285
|
meta: { name: "frontguard", description: "FrontGuard \u2014 frontend PR guardrails" },
|
|
2215
|
-
subCommands: { init, run }
|
|
5286
|
+
subCommands: { init: init2, run }
|
|
2216
5287
|
});
|
|
2217
5288
|
runMain(main);
|
|
2218
5289
|
//# sourceMappingURL=cli.js.map
|