@vertaaux/cli 0.5.0 → 0.5.1
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/CHANGELOG.md +19 -0
- package/README.md +28 -1
- package/dist/app/interactive-app.d.ts +2 -0
- package/dist/app/interactive-app.d.ts.map +1 -1
- package/dist/app/interactive-app.js +26 -7
- package/dist/app/menu/categories.d.ts +2 -2
- package/dist/app/menu/categories.d.ts.map +1 -1
- package/dist/app/menu/categories.js +3 -18
- package/dist/app/views/command-runner.d.ts.map +1 -1
- package/dist/app/views/command-runner.js +52 -9
- package/dist/app/views/help-overlay.d.ts +1 -1
- package/dist/app/views/help-overlay.d.ts.map +1 -1
- package/dist/app/views/help-overlay.js +5 -4
- package/dist/commands/a11y.d.ts +4 -2
- package/dist/commands/a11y.d.ts.map +1 -1
- package/dist/commands/a11y.js +82 -9
- package/dist/commands/audit/index.d.ts.map +1 -1
- package/dist/commands/audit/index.js +33 -8
- package/dist/commands/audit/output.d.ts.map +1 -1
- package/dist/commands/audit/output.js +3 -4
- package/dist/commands/audit/policy.d.ts +10 -2
- package/dist/commands/audit/policy.d.ts.map +1 -1
- package/dist/commands/audit/policy.js +47 -2
- package/dist/commands/audit/types.d.ts +1 -0
- package/dist/commands/audit/types.d.ts.map +1 -1
- package/dist/commands/baseline.d.ts +1 -0
- package/dist/commands/baseline.d.ts.map +1 -1
- package/dist/commands/baseline.js +26 -12
- package/dist/commands/comment.d.ts.map +1 -1
- package/dist/commands/comment.js +8 -7
- package/dist/commands/compare.js +3 -3
- package/dist/commands/diff.d.ts +2 -0
- package/dist/commands/diff.d.ts.map +1 -1
- package/dist/commands/diff.js +23 -12
- package/dist/commands/doc.js +2 -2
- package/dist/commands/doctor.js +2 -2
- package/dist/commands/explain.js +3 -3
- package/dist/commands/fix-all.js +2 -2
- package/dist/commands/fix-plan.d.ts.map +1 -1
- package/dist/commands/fix-plan.js +4 -3
- package/dist/commands/fix.js +5 -5
- package/dist/commands/patch-review.js +2 -2
- package/dist/commands/policy.js +2 -2
- package/dist/commands/release-notes.js +3 -3
- package/dist/commands/suggest.d.ts.map +1 -1
- package/dist/commands/suggest.js +28 -2
- package/dist/commands/triage.js +3 -3
- package/dist/commands/verify.js +3 -3
- package/dist/config/schema.d.ts +4 -0
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/output/envelope.d.ts +8 -1
- package/dist/output/envelope.d.ts.map +1 -1
- package/dist/output/envelope.js +24 -6
- package/dist/policy/schema.d.ts +137 -0
- package/dist/policy/schema.d.ts.map +1 -1
- package/dist/policy/schema.js +107 -0
- package/dist/prompts/command-catalog.js +9 -9
- package/dist/utils/client.d.ts.map +1 -1
- package/dist/utils/client.js +30 -28
- package/dist/utils/root-args.d.ts +12 -0
- package/dist/utils/root-args.d.ts.map +1 -0
- package/dist/utils/root-args.js +44 -0
- package/dist/utils/stdin.d.ts +7 -0
- package/dist/utils/stdin.d.ts.map +1 -1
- package/dist/utils/stdin.js +32 -2
- package/node_modules/@vertaaux/tui/dist/index.cjs +505 -9
- package/node_modules/@vertaaux/tui/dist/index.cjs.map +1 -1
- package/node_modules/@vertaaux/tui/dist/index.js +502 -8
- package/node_modules/@vertaaux/tui/dist/index.js.map +1 -1
- package/node_modules/@vertaaux/tui/package.json +2 -3
- package/node_modules/chalk/license +9 -0
- package/node_modules/chalk/package.json +83 -0
- package/node_modules/chalk/readme.md +297 -0
- package/node_modules/chalk/source/index.d.ts +325 -0
- package/node_modules/chalk/source/index.js +225 -0
- package/node_modules/chalk/source/utilities.js +33 -0
- package/node_modules/chalk/source/vendor/ansi-styles/index.d.ts +236 -0
- package/node_modules/chalk/source/vendor/ansi-styles/index.js +223 -0
- package/node_modules/chalk/source/vendor/supports-color/browser.d.ts +1 -0
- package/node_modules/chalk/source/vendor/supports-color/browser.js +34 -0
- package/node_modules/chalk/source/vendor/supports-color/index.d.ts +55 -0
- package/node_modules/chalk/source/vendor/supports-color/index.js +190 -0
- package/package.json +9 -2
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import process2 from 'process';
|
|
2
|
+
import os from 'os';
|
|
3
|
+
import tty from 'tty';
|
|
2
4
|
import { EventEmitter } from 'events';
|
|
3
5
|
|
|
4
6
|
var __defProp = Object.defineProperty;
|
|
@@ -136,6 +138,498 @@ function truncate(str, maxWidth) {
|
|
|
136
138
|
if (maxWidth <= 3) return stripped.slice(0, maxWidth);
|
|
137
139
|
return stripped.slice(0, maxWidth - 1) + "\u2026";
|
|
138
140
|
}
|
|
141
|
+
|
|
142
|
+
// node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
143
|
+
var ANSI_BACKGROUND_OFFSET = 10;
|
|
144
|
+
var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
145
|
+
var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
146
|
+
var wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
|
|
147
|
+
var styles = {
|
|
148
|
+
modifier: {
|
|
149
|
+
reset: [0, 0],
|
|
150
|
+
// 21 isn't widely supported and 22 does the same thing
|
|
151
|
+
bold: [1, 22],
|
|
152
|
+
dim: [2, 22],
|
|
153
|
+
italic: [3, 23],
|
|
154
|
+
underline: [4, 24],
|
|
155
|
+
overline: [53, 55],
|
|
156
|
+
inverse: [7, 27],
|
|
157
|
+
hidden: [8, 28],
|
|
158
|
+
strikethrough: [9, 29]
|
|
159
|
+
},
|
|
160
|
+
color: {
|
|
161
|
+
black: [30, 39],
|
|
162
|
+
red: [31, 39],
|
|
163
|
+
green: [32, 39],
|
|
164
|
+
yellow: [33, 39],
|
|
165
|
+
blue: [34, 39],
|
|
166
|
+
magenta: [35, 39],
|
|
167
|
+
cyan: [36, 39],
|
|
168
|
+
white: [37, 39],
|
|
169
|
+
// Bright color
|
|
170
|
+
blackBright: [90, 39],
|
|
171
|
+
gray: [90, 39],
|
|
172
|
+
// Alias of `blackBright`
|
|
173
|
+
grey: [90, 39],
|
|
174
|
+
// Alias of `blackBright`
|
|
175
|
+
redBright: [91, 39],
|
|
176
|
+
greenBright: [92, 39],
|
|
177
|
+
yellowBright: [93, 39],
|
|
178
|
+
blueBright: [94, 39],
|
|
179
|
+
magentaBright: [95, 39],
|
|
180
|
+
cyanBright: [96, 39],
|
|
181
|
+
whiteBright: [97, 39]
|
|
182
|
+
},
|
|
183
|
+
bgColor: {
|
|
184
|
+
bgBlack: [40, 49],
|
|
185
|
+
bgRed: [41, 49],
|
|
186
|
+
bgGreen: [42, 49],
|
|
187
|
+
bgYellow: [43, 49],
|
|
188
|
+
bgBlue: [44, 49],
|
|
189
|
+
bgMagenta: [45, 49],
|
|
190
|
+
bgCyan: [46, 49],
|
|
191
|
+
bgWhite: [47, 49],
|
|
192
|
+
// Bright color
|
|
193
|
+
bgBlackBright: [100, 49],
|
|
194
|
+
bgGray: [100, 49],
|
|
195
|
+
// Alias of `bgBlackBright`
|
|
196
|
+
bgGrey: [100, 49],
|
|
197
|
+
// Alias of `bgBlackBright`
|
|
198
|
+
bgRedBright: [101, 49],
|
|
199
|
+
bgGreenBright: [102, 49],
|
|
200
|
+
bgYellowBright: [103, 49],
|
|
201
|
+
bgBlueBright: [104, 49],
|
|
202
|
+
bgMagentaBright: [105, 49],
|
|
203
|
+
bgCyanBright: [106, 49],
|
|
204
|
+
bgWhiteBright: [107, 49]
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
Object.keys(styles.modifier);
|
|
208
|
+
var foregroundColorNames = Object.keys(styles.color);
|
|
209
|
+
var backgroundColorNames = Object.keys(styles.bgColor);
|
|
210
|
+
[...foregroundColorNames, ...backgroundColorNames];
|
|
211
|
+
function assembleStyles() {
|
|
212
|
+
const codes = /* @__PURE__ */ new Map();
|
|
213
|
+
for (const [groupName, group] of Object.entries(styles)) {
|
|
214
|
+
for (const [styleName, style2] of Object.entries(group)) {
|
|
215
|
+
styles[styleName] = {
|
|
216
|
+
open: `\x1B[${style2[0]}m`,
|
|
217
|
+
close: `\x1B[${style2[1]}m`
|
|
218
|
+
};
|
|
219
|
+
group[styleName] = styles[styleName];
|
|
220
|
+
codes.set(style2[0], style2[1]);
|
|
221
|
+
}
|
|
222
|
+
Object.defineProperty(styles, groupName, {
|
|
223
|
+
value: group,
|
|
224
|
+
enumerable: false
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
Object.defineProperty(styles, "codes", {
|
|
228
|
+
value: codes,
|
|
229
|
+
enumerable: false
|
|
230
|
+
});
|
|
231
|
+
styles.color.close = "\x1B[39m";
|
|
232
|
+
styles.bgColor.close = "\x1B[49m";
|
|
233
|
+
styles.color.ansi = wrapAnsi16();
|
|
234
|
+
styles.color.ansi256 = wrapAnsi256();
|
|
235
|
+
styles.color.ansi16m = wrapAnsi16m();
|
|
236
|
+
styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
|
237
|
+
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
|
238
|
+
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
|
239
|
+
Object.defineProperties(styles, {
|
|
240
|
+
rgbToAnsi256: {
|
|
241
|
+
value(red, green, blue) {
|
|
242
|
+
if (red === green && green === blue) {
|
|
243
|
+
if (red < 8) {
|
|
244
|
+
return 16;
|
|
245
|
+
}
|
|
246
|
+
if (red > 248) {
|
|
247
|
+
return 231;
|
|
248
|
+
}
|
|
249
|
+
return Math.round((red - 8) / 247 * 24) + 232;
|
|
250
|
+
}
|
|
251
|
+
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
|
252
|
+
},
|
|
253
|
+
enumerable: false
|
|
254
|
+
},
|
|
255
|
+
hexToRgb: {
|
|
256
|
+
value(hex) {
|
|
257
|
+
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
|
258
|
+
if (!matches) {
|
|
259
|
+
return [0, 0, 0];
|
|
260
|
+
}
|
|
261
|
+
let [colorString] = matches;
|
|
262
|
+
if (colorString.length === 3) {
|
|
263
|
+
colorString = [...colorString].map((character) => character + character).join("");
|
|
264
|
+
}
|
|
265
|
+
const integer = Number.parseInt(colorString, 16);
|
|
266
|
+
return [
|
|
267
|
+
/* eslint-disable no-bitwise */
|
|
268
|
+
integer >> 16 & 255,
|
|
269
|
+
integer >> 8 & 255,
|
|
270
|
+
integer & 255
|
|
271
|
+
/* eslint-enable no-bitwise */
|
|
272
|
+
];
|
|
273
|
+
},
|
|
274
|
+
enumerable: false
|
|
275
|
+
},
|
|
276
|
+
hexToAnsi256: {
|
|
277
|
+
value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
|
|
278
|
+
enumerable: false
|
|
279
|
+
},
|
|
280
|
+
ansi256ToAnsi: {
|
|
281
|
+
value(code) {
|
|
282
|
+
if (code < 8) {
|
|
283
|
+
return 30 + code;
|
|
284
|
+
}
|
|
285
|
+
if (code < 16) {
|
|
286
|
+
return 90 + (code - 8);
|
|
287
|
+
}
|
|
288
|
+
let red;
|
|
289
|
+
let green;
|
|
290
|
+
let blue;
|
|
291
|
+
if (code >= 232) {
|
|
292
|
+
red = ((code - 232) * 10 + 8) / 255;
|
|
293
|
+
green = red;
|
|
294
|
+
blue = red;
|
|
295
|
+
} else {
|
|
296
|
+
code -= 16;
|
|
297
|
+
const remainder = code % 36;
|
|
298
|
+
red = Math.floor(code / 36) / 5;
|
|
299
|
+
green = Math.floor(remainder / 6) / 5;
|
|
300
|
+
blue = remainder % 6 / 5;
|
|
301
|
+
}
|
|
302
|
+
const value = Math.max(red, green, blue) * 2;
|
|
303
|
+
if (value === 0) {
|
|
304
|
+
return 30;
|
|
305
|
+
}
|
|
306
|
+
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
|
307
|
+
if (value === 2) {
|
|
308
|
+
result += 60;
|
|
309
|
+
}
|
|
310
|
+
return result;
|
|
311
|
+
},
|
|
312
|
+
enumerable: false
|
|
313
|
+
},
|
|
314
|
+
rgbToAnsi: {
|
|
315
|
+
value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
|
|
316
|
+
enumerable: false
|
|
317
|
+
},
|
|
318
|
+
hexToAnsi: {
|
|
319
|
+
value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
|
|
320
|
+
enumerable: false
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
return styles;
|
|
324
|
+
}
|
|
325
|
+
var ansiStyles = assembleStyles();
|
|
326
|
+
var ansi_styles_default = ansiStyles;
|
|
327
|
+
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process2.argv) {
|
|
328
|
+
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
329
|
+
const position = argv.indexOf(prefix + flag);
|
|
330
|
+
const terminatorPosition = argv.indexOf("--");
|
|
331
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
332
|
+
}
|
|
333
|
+
var { env } = process2;
|
|
334
|
+
var flagForceColor;
|
|
335
|
+
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
|
336
|
+
flagForceColor = 0;
|
|
337
|
+
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
338
|
+
flagForceColor = 1;
|
|
339
|
+
}
|
|
340
|
+
function envForceColor() {
|
|
341
|
+
if ("FORCE_COLOR" in env) {
|
|
342
|
+
if (env.FORCE_COLOR === "true") {
|
|
343
|
+
return 1;
|
|
344
|
+
}
|
|
345
|
+
if (env.FORCE_COLOR === "false") {
|
|
346
|
+
return 0;
|
|
347
|
+
}
|
|
348
|
+
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
function translateLevel(level) {
|
|
352
|
+
if (level === 0) {
|
|
353
|
+
return false;
|
|
354
|
+
}
|
|
355
|
+
return {
|
|
356
|
+
level,
|
|
357
|
+
hasBasic: true,
|
|
358
|
+
has256: level >= 2,
|
|
359
|
+
has16m: level >= 3
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
363
|
+
const noFlagForceColor = envForceColor();
|
|
364
|
+
if (noFlagForceColor !== void 0) {
|
|
365
|
+
flagForceColor = noFlagForceColor;
|
|
366
|
+
}
|
|
367
|
+
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
368
|
+
if (forceColor === 0) {
|
|
369
|
+
return 0;
|
|
370
|
+
}
|
|
371
|
+
if (sniffFlags) {
|
|
372
|
+
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
373
|
+
return 3;
|
|
374
|
+
}
|
|
375
|
+
if (hasFlag("color=256")) {
|
|
376
|
+
return 2;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
if ("TF_BUILD" in env && "AGENT_NAME" in env) {
|
|
380
|
+
return 1;
|
|
381
|
+
}
|
|
382
|
+
if (haveStream && !streamIsTTY && forceColor === void 0) {
|
|
383
|
+
return 0;
|
|
384
|
+
}
|
|
385
|
+
const min = forceColor || 0;
|
|
386
|
+
if (env.TERM === "dumb") {
|
|
387
|
+
return min;
|
|
388
|
+
}
|
|
389
|
+
if (process2.platform === "win32") {
|
|
390
|
+
const osRelease = os.release().split(".");
|
|
391
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
392
|
+
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
393
|
+
}
|
|
394
|
+
return 1;
|
|
395
|
+
}
|
|
396
|
+
if ("CI" in env) {
|
|
397
|
+
if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => key in env)) {
|
|
398
|
+
return 3;
|
|
399
|
+
}
|
|
400
|
+
if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
|
401
|
+
return 1;
|
|
402
|
+
}
|
|
403
|
+
return min;
|
|
404
|
+
}
|
|
405
|
+
if ("TEAMCITY_VERSION" in env) {
|
|
406
|
+
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
407
|
+
}
|
|
408
|
+
if (env.COLORTERM === "truecolor") {
|
|
409
|
+
return 3;
|
|
410
|
+
}
|
|
411
|
+
if (env.TERM === "xterm-kitty") {
|
|
412
|
+
return 3;
|
|
413
|
+
}
|
|
414
|
+
if (env.TERM === "xterm-ghostty") {
|
|
415
|
+
return 3;
|
|
416
|
+
}
|
|
417
|
+
if (env.TERM === "wezterm") {
|
|
418
|
+
return 3;
|
|
419
|
+
}
|
|
420
|
+
if ("TERM_PROGRAM" in env) {
|
|
421
|
+
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
422
|
+
switch (env.TERM_PROGRAM) {
|
|
423
|
+
case "iTerm.app": {
|
|
424
|
+
return version >= 3 ? 3 : 2;
|
|
425
|
+
}
|
|
426
|
+
case "Apple_Terminal": {
|
|
427
|
+
return 2;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
if (/-256(color)?$/i.test(env.TERM)) {
|
|
432
|
+
return 2;
|
|
433
|
+
}
|
|
434
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
435
|
+
return 1;
|
|
436
|
+
}
|
|
437
|
+
if ("COLORTERM" in env) {
|
|
438
|
+
return 1;
|
|
439
|
+
}
|
|
440
|
+
return min;
|
|
441
|
+
}
|
|
442
|
+
function createSupportsColor(stream, options = {}) {
|
|
443
|
+
const level = _supportsColor(stream, {
|
|
444
|
+
streamIsTTY: stream && stream.isTTY,
|
|
445
|
+
...options
|
|
446
|
+
});
|
|
447
|
+
return translateLevel(level);
|
|
448
|
+
}
|
|
449
|
+
var supportsColor = {
|
|
450
|
+
stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
|
|
451
|
+
stderr: createSupportsColor({ isTTY: tty.isatty(2) })
|
|
452
|
+
};
|
|
453
|
+
var supports_color_default = supportsColor;
|
|
454
|
+
|
|
455
|
+
// node_modules/chalk/source/utilities.js
|
|
456
|
+
function stringReplaceAll(string, substring, replacer) {
|
|
457
|
+
let index = string.indexOf(substring);
|
|
458
|
+
if (index === -1) {
|
|
459
|
+
return string;
|
|
460
|
+
}
|
|
461
|
+
const substringLength = substring.length;
|
|
462
|
+
let endIndex = 0;
|
|
463
|
+
let returnValue = "";
|
|
464
|
+
do {
|
|
465
|
+
returnValue += string.slice(endIndex, index) + substring + replacer;
|
|
466
|
+
endIndex = index + substringLength;
|
|
467
|
+
index = string.indexOf(substring, endIndex);
|
|
468
|
+
} while (index !== -1);
|
|
469
|
+
returnValue += string.slice(endIndex);
|
|
470
|
+
return returnValue;
|
|
471
|
+
}
|
|
472
|
+
function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
|
|
473
|
+
let endIndex = 0;
|
|
474
|
+
let returnValue = "";
|
|
475
|
+
do {
|
|
476
|
+
const gotCR = string[index - 1] === "\r";
|
|
477
|
+
returnValue += string.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
|
|
478
|
+
endIndex = index + 1;
|
|
479
|
+
index = string.indexOf("\n", endIndex);
|
|
480
|
+
} while (index !== -1);
|
|
481
|
+
returnValue += string.slice(endIndex);
|
|
482
|
+
return returnValue;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
// node_modules/chalk/source/index.js
|
|
486
|
+
var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
|
|
487
|
+
var GENERATOR = /* @__PURE__ */ Symbol("GENERATOR");
|
|
488
|
+
var STYLER = /* @__PURE__ */ Symbol("STYLER");
|
|
489
|
+
var IS_EMPTY = /* @__PURE__ */ Symbol("IS_EMPTY");
|
|
490
|
+
var levelMapping = [
|
|
491
|
+
"ansi",
|
|
492
|
+
"ansi",
|
|
493
|
+
"ansi256",
|
|
494
|
+
"ansi16m"
|
|
495
|
+
];
|
|
496
|
+
var styles2 = /* @__PURE__ */ Object.create(null);
|
|
497
|
+
var applyOptions = (object, options = {}) => {
|
|
498
|
+
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
|
499
|
+
throw new Error("The `level` option should be an integer from 0 to 3");
|
|
500
|
+
}
|
|
501
|
+
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
502
|
+
object.level = options.level === void 0 ? colorLevel : options.level;
|
|
503
|
+
};
|
|
504
|
+
var chalkFactory = (options) => {
|
|
505
|
+
const chalk2 = (...strings) => strings.join(" ");
|
|
506
|
+
applyOptions(chalk2, options);
|
|
507
|
+
Object.setPrototypeOf(chalk2, createChalk.prototype);
|
|
508
|
+
return chalk2;
|
|
509
|
+
};
|
|
510
|
+
function createChalk(options) {
|
|
511
|
+
return chalkFactory(options);
|
|
512
|
+
}
|
|
513
|
+
Object.setPrototypeOf(createChalk.prototype, Function.prototype);
|
|
514
|
+
for (const [styleName, style2] of Object.entries(ansi_styles_default)) {
|
|
515
|
+
styles2[styleName] = {
|
|
516
|
+
get() {
|
|
517
|
+
const builder = createBuilder(this, createStyler(style2.open, style2.close, this[STYLER]), this[IS_EMPTY]);
|
|
518
|
+
Object.defineProperty(this, styleName, { value: builder });
|
|
519
|
+
return builder;
|
|
520
|
+
}
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
styles2.visible = {
|
|
524
|
+
get() {
|
|
525
|
+
const builder = createBuilder(this, this[STYLER], true);
|
|
526
|
+
Object.defineProperty(this, "visible", { value: builder });
|
|
527
|
+
return builder;
|
|
528
|
+
}
|
|
529
|
+
};
|
|
530
|
+
var getModelAnsi = (model, level, type, ...arguments_) => {
|
|
531
|
+
if (model === "rgb") {
|
|
532
|
+
if (level === "ansi16m") {
|
|
533
|
+
return ansi_styles_default[type].ansi16m(...arguments_);
|
|
534
|
+
}
|
|
535
|
+
if (level === "ansi256") {
|
|
536
|
+
return ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_));
|
|
537
|
+
}
|
|
538
|
+
return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
|
|
539
|
+
}
|
|
540
|
+
if (model === "hex") {
|
|
541
|
+
return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_));
|
|
542
|
+
}
|
|
543
|
+
return ansi_styles_default[type][model](...arguments_);
|
|
544
|
+
};
|
|
545
|
+
var usedModels = ["rgb", "hex", "ansi256"];
|
|
546
|
+
for (const model of usedModels) {
|
|
547
|
+
styles2[model] = {
|
|
548
|
+
get() {
|
|
549
|
+
const { level } = this;
|
|
550
|
+
return function(...arguments_) {
|
|
551
|
+
const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]);
|
|
552
|
+
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
};
|
|
556
|
+
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
|
557
|
+
styles2[bgModel] = {
|
|
558
|
+
get() {
|
|
559
|
+
const { level } = this;
|
|
560
|
+
return function(...arguments_) {
|
|
561
|
+
const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]);
|
|
562
|
+
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
563
|
+
};
|
|
564
|
+
}
|
|
565
|
+
};
|
|
566
|
+
}
|
|
567
|
+
var proto = Object.defineProperties(() => {
|
|
568
|
+
}, {
|
|
569
|
+
...styles2,
|
|
570
|
+
level: {
|
|
571
|
+
enumerable: true,
|
|
572
|
+
get() {
|
|
573
|
+
return this[GENERATOR].level;
|
|
574
|
+
},
|
|
575
|
+
set(level) {
|
|
576
|
+
this[GENERATOR].level = level;
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
});
|
|
580
|
+
var createStyler = (open, close, parent) => {
|
|
581
|
+
let openAll;
|
|
582
|
+
let closeAll;
|
|
583
|
+
if (parent === void 0) {
|
|
584
|
+
openAll = open;
|
|
585
|
+
closeAll = close;
|
|
586
|
+
} else {
|
|
587
|
+
openAll = parent.openAll + open;
|
|
588
|
+
closeAll = close + parent.closeAll;
|
|
589
|
+
}
|
|
590
|
+
return {
|
|
591
|
+
open,
|
|
592
|
+
close,
|
|
593
|
+
openAll,
|
|
594
|
+
closeAll,
|
|
595
|
+
parent
|
|
596
|
+
};
|
|
597
|
+
};
|
|
598
|
+
var createBuilder = (self, _styler, _isEmpty) => {
|
|
599
|
+
const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
|
600
|
+
Object.setPrototypeOf(builder, proto);
|
|
601
|
+
builder[GENERATOR] = self;
|
|
602
|
+
builder[STYLER] = _styler;
|
|
603
|
+
builder[IS_EMPTY] = _isEmpty;
|
|
604
|
+
return builder;
|
|
605
|
+
};
|
|
606
|
+
var applyStyle = (self, string) => {
|
|
607
|
+
if (self.level <= 0 || !string) {
|
|
608
|
+
return self[IS_EMPTY] ? "" : string;
|
|
609
|
+
}
|
|
610
|
+
let styler = self[STYLER];
|
|
611
|
+
if (styler === void 0) {
|
|
612
|
+
return string;
|
|
613
|
+
}
|
|
614
|
+
const { openAll, closeAll } = styler;
|
|
615
|
+
if (string.includes("\x1B")) {
|
|
616
|
+
while (styler !== void 0) {
|
|
617
|
+
string = stringReplaceAll(string, styler.close, styler.open);
|
|
618
|
+
styler = styler.parent;
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
const lfIndex = string.indexOf("\n");
|
|
622
|
+
if (lfIndex !== -1) {
|
|
623
|
+
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
|
624
|
+
}
|
|
625
|
+
return openAll + string + closeAll;
|
|
626
|
+
};
|
|
627
|
+
Object.defineProperties(createChalk.prototype, styles2);
|
|
628
|
+
var chalk = createChalk();
|
|
629
|
+
createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
630
|
+
var source_default = chalk;
|
|
631
|
+
|
|
632
|
+
// src/theme.ts
|
|
139
633
|
var brand = {
|
|
140
634
|
lime: "#78FFB4",
|
|
141
635
|
tealLight: "#6BEEBD",
|
|
@@ -196,26 +690,26 @@ var tokens = {
|
|
|
196
690
|
var _colorEnabled = true;
|
|
197
691
|
function setColorEnabled(enabled) {
|
|
198
692
|
_colorEnabled = enabled;
|
|
199
|
-
|
|
693
|
+
source_default.level = enabled ? 3 : 0;
|
|
200
694
|
}
|
|
201
695
|
function isColorEnabled() {
|
|
202
696
|
return _colorEnabled;
|
|
203
697
|
}
|
|
204
698
|
function colorize(text, hex) {
|
|
205
699
|
if (!_colorEnabled) return text;
|
|
206
|
-
return
|
|
700
|
+
return source_default.hex(hex)(text);
|
|
207
701
|
}
|
|
208
702
|
function boldColor(text, hex) {
|
|
209
703
|
if (!_colorEnabled) return text;
|
|
210
|
-
return
|
|
704
|
+
return source_default.hex(hex).bold(text);
|
|
211
705
|
}
|
|
212
706
|
function dim(text) {
|
|
213
707
|
if (!_colorEnabled) return text;
|
|
214
|
-
return
|
|
708
|
+
return source_default.dim(text);
|
|
215
709
|
}
|
|
216
710
|
function bold(text) {
|
|
217
711
|
if (!_colorEnabled) return text;
|
|
218
|
-
return
|
|
712
|
+
return source_default.bold(text);
|
|
219
713
|
}
|
|
220
714
|
function severityColor(level) {
|
|
221
715
|
const normalized = (level || "info").toLowerCase();
|
|
@@ -226,7 +720,7 @@ function severityColor(level) {
|
|
|
226
720
|
}
|
|
227
721
|
function bgColor(text, hex) {
|
|
228
722
|
if (!_colorEnabled) return text;
|
|
229
|
-
return
|
|
723
|
+
return source_default.bgHex(hex)(text);
|
|
230
724
|
}
|
|
231
725
|
function applyGradient(text, colors = gradient) {
|
|
232
726
|
if (!_colorEnabled) return text;
|
|
@@ -235,7 +729,7 @@ function applyGradient(text, colors = gradient) {
|
|
|
235
729
|
let idx = 0;
|
|
236
730
|
for (const char of text) {
|
|
237
731
|
if (char !== " " && char !== "\n") {
|
|
238
|
-
result +=
|
|
732
|
+
result += source_default.hex(colors[idx % colorCount])(char);
|
|
239
733
|
idx++;
|
|
240
734
|
} else {
|
|
241
735
|
result += char;
|