@tscircuit/cli 0.1.92 → 0.1.93
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/main.js +498 -2
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -433425,7 +433425,7 @@ import readline from "node:readline";
|
|
|
433425
433425
|
import { execSync as execSync2 } from "node:child_process";
|
|
433426
433426
|
var import_semver = __toESM2(require_semver2(), 1);
|
|
433427
433427
|
// package.json
|
|
433428
|
-
var version = "0.1.
|
|
433428
|
+
var version = "0.1.92";
|
|
433429
433429
|
var package_default = {
|
|
433430
433430
|
name: "@tscircuit/cli",
|
|
433431
433431
|
version,
|
|
@@ -433495,7 +433495,7 @@ var package_default = {
|
|
|
433495
433495
|
|
|
433496
433496
|
// lib/shared/check-for-cli-update.ts
|
|
433497
433497
|
var checkForTsciUpdates = async () => {
|
|
433498
|
-
if (process.env.TSCI_SKIP_CLI_UPDATE
|
|
433498
|
+
if (process.env.TSCI_SKIP_CLI_UPDATE === "true")
|
|
433499
433499
|
return;
|
|
433500
433500
|
const currentCliVersion = program2.version() ?? import_semver.default.inc(version, "patch") ?? version;
|
|
433501
433501
|
const { version: latestCliVersion } = await distribution_default.get("https://registry.npmjs.org/@tscircuit/cli/latest", { throwHttpErrors: false }).json();
|
|
@@ -433514,6 +433514,8 @@ Would you like to update now?`);
|
|
|
433514
433514
|
console.warn(` ${installCommand}`);
|
|
433515
433515
|
}
|
|
433516
433516
|
}
|
|
433517
|
+
} else {
|
|
433518
|
+
return false;
|
|
433517
433519
|
}
|
|
433518
433520
|
};
|
|
433519
433521
|
var askConfirmation = (question) => {
|
|
@@ -464290,6 +464292,499 @@ var registerAdd = (program3) => {
|
|
|
464290
464292
|
});
|
|
464291
464293
|
};
|
|
464292
464294
|
|
|
464295
|
+
// node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
464296
|
+
var ANSI_BACKGROUND_OFFSET = 10;
|
|
464297
|
+
var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
464298
|
+
var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
464299
|
+
var wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
|
|
464300
|
+
var styles = {
|
|
464301
|
+
modifier: {
|
|
464302
|
+
reset: [0, 0],
|
|
464303
|
+
bold: [1, 22],
|
|
464304
|
+
dim: [2, 22],
|
|
464305
|
+
italic: [3, 23],
|
|
464306
|
+
underline: [4, 24],
|
|
464307
|
+
overline: [53, 55],
|
|
464308
|
+
inverse: [7, 27],
|
|
464309
|
+
hidden: [8, 28],
|
|
464310
|
+
strikethrough: [9, 29]
|
|
464311
|
+
},
|
|
464312
|
+
color: {
|
|
464313
|
+
black: [30, 39],
|
|
464314
|
+
red: [31, 39],
|
|
464315
|
+
green: [32, 39],
|
|
464316
|
+
yellow: [33, 39],
|
|
464317
|
+
blue: [34, 39],
|
|
464318
|
+
magenta: [35, 39],
|
|
464319
|
+
cyan: [36, 39],
|
|
464320
|
+
white: [37, 39],
|
|
464321
|
+
blackBright: [90, 39],
|
|
464322
|
+
gray: [90, 39],
|
|
464323
|
+
grey: [90, 39],
|
|
464324
|
+
redBright: [91, 39],
|
|
464325
|
+
greenBright: [92, 39],
|
|
464326
|
+
yellowBright: [93, 39],
|
|
464327
|
+
blueBright: [94, 39],
|
|
464328
|
+
magentaBright: [95, 39],
|
|
464329
|
+
cyanBright: [96, 39],
|
|
464330
|
+
whiteBright: [97, 39]
|
|
464331
|
+
},
|
|
464332
|
+
bgColor: {
|
|
464333
|
+
bgBlack: [40, 49],
|
|
464334
|
+
bgRed: [41, 49],
|
|
464335
|
+
bgGreen: [42, 49],
|
|
464336
|
+
bgYellow: [43, 49],
|
|
464337
|
+
bgBlue: [44, 49],
|
|
464338
|
+
bgMagenta: [45, 49],
|
|
464339
|
+
bgCyan: [46, 49],
|
|
464340
|
+
bgWhite: [47, 49],
|
|
464341
|
+
bgBlackBright: [100, 49],
|
|
464342
|
+
bgGray: [100, 49],
|
|
464343
|
+
bgGrey: [100, 49],
|
|
464344
|
+
bgRedBright: [101, 49],
|
|
464345
|
+
bgGreenBright: [102, 49],
|
|
464346
|
+
bgYellowBright: [103, 49],
|
|
464347
|
+
bgBlueBright: [104, 49],
|
|
464348
|
+
bgMagentaBright: [105, 49],
|
|
464349
|
+
bgCyanBright: [106, 49],
|
|
464350
|
+
bgWhiteBright: [107, 49]
|
|
464351
|
+
}
|
|
464352
|
+
};
|
|
464353
|
+
var modifierNames = Object.keys(styles.modifier);
|
|
464354
|
+
var foregroundColorNames = Object.keys(styles.color);
|
|
464355
|
+
var backgroundColorNames = Object.keys(styles.bgColor);
|
|
464356
|
+
var colorNames = [...foregroundColorNames, ...backgroundColorNames];
|
|
464357
|
+
function assembleStyles() {
|
|
464358
|
+
const codes = new Map;
|
|
464359
|
+
for (const [groupName, group] of Object.entries(styles)) {
|
|
464360
|
+
for (const [styleName, style] of Object.entries(group)) {
|
|
464361
|
+
styles[styleName] = {
|
|
464362
|
+
open: `\x1B[${style[0]}m`,
|
|
464363
|
+
close: `\x1B[${style[1]}m`
|
|
464364
|
+
};
|
|
464365
|
+
group[styleName] = styles[styleName];
|
|
464366
|
+
codes.set(style[0], style[1]);
|
|
464367
|
+
}
|
|
464368
|
+
Object.defineProperty(styles, groupName, {
|
|
464369
|
+
value: group,
|
|
464370
|
+
enumerable: false
|
|
464371
|
+
});
|
|
464372
|
+
}
|
|
464373
|
+
Object.defineProperty(styles, "codes", {
|
|
464374
|
+
value: codes,
|
|
464375
|
+
enumerable: false
|
|
464376
|
+
});
|
|
464377
|
+
styles.color.close = "\x1B[39m";
|
|
464378
|
+
styles.bgColor.close = "\x1B[49m";
|
|
464379
|
+
styles.color.ansi = wrapAnsi16();
|
|
464380
|
+
styles.color.ansi256 = wrapAnsi256();
|
|
464381
|
+
styles.color.ansi16m = wrapAnsi16m();
|
|
464382
|
+
styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
|
464383
|
+
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
|
464384
|
+
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
|
464385
|
+
Object.defineProperties(styles, {
|
|
464386
|
+
rgbToAnsi256: {
|
|
464387
|
+
value(red, green, blue) {
|
|
464388
|
+
if (red === green && green === blue) {
|
|
464389
|
+
if (red < 8) {
|
|
464390
|
+
return 16;
|
|
464391
|
+
}
|
|
464392
|
+
if (red > 248) {
|
|
464393
|
+
return 231;
|
|
464394
|
+
}
|
|
464395
|
+
return Math.round((red - 8) / 247 * 24) + 232;
|
|
464396
|
+
}
|
|
464397
|
+
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
|
464398
|
+
},
|
|
464399
|
+
enumerable: false
|
|
464400
|
+
},
|
|
464401
|
+
hexToRgb: {
|
|
464402
|
+
value(hex) {
|
|
464403
|
+
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
|
464404
|
+
if (!matches) {
|
|
464405
|
+
return [0, 0, 0];
|
|
464406
|
+
}
|
|
464407
|
+
let [colorString] = matches;
|
|
464408
|
+
if (colorString.length === 3) {
|
|
464409
|
+
colorString = [...colorString].map((character) => character + character).join("");
|
|
464410
|
+
}
|
|
464411
|
+
const integer = Number.parseInt(colorString, 16);
|
|
464412
|
+
return [
|
|
464413
|
+
integer >> 16 & 255,
|
|
464414
|
+
integer >> 8 & 255,
|
|
464415
|
+
integer & 255
|
|
464416
|
+
];
|
|
464417
|
+
},
|
|
464418
|
+
enumerable: false
|
|
464419
|
+
},
|
|
464420
|
+
hexToAnsi256: {
|
|
464421
|
+
value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
|
|
464422
|
+
enumerable: false
|
|
464423
|
+
},
|
|
464424
|
+
ansi256ToAnsi: {
|
|
464425
|
+
value(code) {
|
|
464426
|
+
if (code < 8) {
|
|
464427
|
+
return 30 + code;
|
|
464428
|
+
}
|
|
464429
|
+
if (code < 16) {
|
|
464430
|
+
return 90 + (code - 8);
|
|
464431
|
+
}
|
|
464432
|
+
let red;
|
|
464433
|
+
let green;
|
|
464434
|
+
let blue;
|
|
464435
|
+
if (code >= 232) {
|
|
464436
|
+
red = ((code - 232) * 10 + 8) / 255;
|
|
464437
|
+
green = red;
|
|
464438
|
+
blue = red;
|
|
464439
|
+
} else {
|
|
464440
|
+
code -= 16;
|
|
464441
|
+
const remainder = code % 36;
|
|
464442
|
+
red = Math.floor(code / 36) / 5;
|
|
464443
|
+
green = Math.floor(remainder / 6) / 5;
|
|
464444
|
+
blue = remainder % 6 / 5;
|
|
464445
|
+
}
|
|
464446
|
+
const value2 = Math.max(red, green, blue) * 2;
|
|
464447
|
+
if (value2 === 0) {
|
|
464448
|
+
return 30;
|
|
464449
|
+
}
|
|
464450
|
+
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
|
464451
|
+
if (value2 === 2) {
|
|
464452
|
+
result += 60;
|
|
464453
|
+
}
|
|
464454
|
+
return result;
|
|
464455
|
+
},
|
|
464456
|
+
enumerable: false
|
|
464457
|
+
},
|
|
464458
|
+
rgbToAnsi: {
|
|
464459
|
+
value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
|
|
464460
|
+
enumerable: false
|
|
464461
|
+
},
|
|
464462
|
+
hexToAnsi: {
|
|
464463
|
+
value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
|
|
464464
|
+
enumerable: false
|
|
464465
|
+
}
|
|
464466
|
+
});
|
|
464467
|
+
return styles;
|
|
464468
|
+
}
|
|
464469
|
+
var ansiStyles = assembleStyles();
|
|
464470
|
+
var ansi_styles_default = ansiStyles;
|
|
464471
|
+
|
|
464472
|
+
// node_modules/chalk/source/vendor/supports-color/index.js
|
|
464473
|
+
import process10 from "node:process";
|
|
464474
|
+
import os3 from "node:os";
|
|
464475
|
+
import tty from "node:tty";
|
|
464476
|
+
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process10.argv) {
|
|
464477
|
+
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
464478
|
+
const position2 = argv.indexOf(prefix + flag);
|
|
464479
|
+
const terminatorPosition = argv.indexOf("--");
|
|
464480
|
+
return position2 !== -1 && (terminatorPosition === -1 || position2 < terminatorPosition);
|
|
464481
|
+
}
|
|
464482
|
+
var { env: env2 } = process10;
|
|
464483
|
+
var flagForceColor;
|
|
464484
|
+
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
|
464485
|
+
flagForceColor = 0;
|
|
464486
|
+
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
464487
|
+
flagForceColor = 1;
|
|
464488
|
+
}
|
|
464489
|
+
function envForceColor() {
|
|
464490
|
+
if ("FORCE_COLOR" in env2) {
|
|
464491
|
+
if (env2.FORCE_COLOR === "true") {
|
|
464492
|
+
return 1;
|
|
464493
|
+
}
|
|
464494
|
+
if (env2.FORCE_COLOR === "false") {
|
|
464495
|
+
return 0;
|
|
464496
|
+
}
|
|
464497
|
+
return env2.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env2.FORCE_COLOR, 10), 3);
|
|
464498
|
+
}
|
|
464499
|
+
}
|
|
464500
|
+
function translateLevel(level) {
|
|
464501
|
+
if (level === 0) {
|
|
464502
|
+
return false;
|
|
464503
|
+
}
|
|
464504
|
+
return {
|
|
464505
|
+
level,
|
|
464506
|
+
hasBasic: true,
|
|
464507
|
+
has256: level >= 2,
|
|
464508
|
+
has16m: level >= 3
|
|
464509
|
+
};
|
|
464510
|
+
}
|
|
464511
|
+
function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
464512
|
+
const noFlagForceColor = envForceColor();
|
|
464513
|
+
if (noFlagForceColor !== undefined) {
|
|
464514
|
+
flagForceColor = noFlagForceColor;
|
|
464515
|
+
}
|
|
464516
|
+
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
464517
|
+
if (forceColor === 0) {
|
|
464518
|
+
return 0;
|
|
464519
|
+
}
|
|
464520
|
+
if (sniffFlags) {
|
|
464521
|
+
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
464522
|
+
return 3;
|
|
464523
|
+
}
|
|
464524
|
+
if (hasFlag("color=256")) {
|
|
464525
|
+
return 2;
|
|
464526
|
+
}
|
|
464527
|
+
}
|
|
464528
|
+
if ("TF_BUILD" in env2 && "AGENT_NAME" in env2) {
|
|
464529
|
+
return 1;
|
|
464530
|
+
}
|
|
464531
|
+
if (haveStream && !streamIsTTY && forceColor === undefined) {
|
|
464532
|
+
return 0;
|
|
464533
|
+
}
|
|
464534
|
+
const min = forceColor || 0;
|
|
464535
|
+
if (env2.TERM === "dumb") {
|
|
464536
|
+
return min;
|
|
464537
|
+
}
|
|
464538
|
+
if (process10.platform === "win32") {
|
|
464539
|
+
const osRelease = os3.release().split(".");
|
|
464540
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
464541
|
+
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
464542
|
+
}
|
|
464543
|
+
return 1;
|
|
464544
|
+
}
|
|
464545
|
+
if ("CI" in env2) {
|
|
464546
|
+
if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => (key in env2))) {
|
|
464547
|
+
return 3;
|
|
464548
|
+
}
|
|
464549
|
+
if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => (sign in env2)) || env2.CI_NAME === "codeship") {
|
|
464550
|
+
return 1;
|
|
464551
|
+
}
|
|
464552
|
+
return min;
|
|
464553
|
+
}
|
|
464554
|
+
if ("TEAMCITY_VERSION" in env2) {
|
|
464555
|
+
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env2.TEAMCITY_VERSION) ? 1 : 0;
|
|
464556
|
+
}
|
|
464557
|
+
if (env2.COLORTERM === "truecolor") {
|
|
464558
|
+
return 3;
|
|
464559
|
+
}
|
|
464560
|
+
if (env2.TERM === "xterm-kitty") {
|
|
464561
|
+
return 3;
|
|
464562
|
+
}
|
|
464563
|
+
if ("TERM_PROGRAM" in env2) {
|
|
464564
|
+
const version2 = Number.parseInt((env2.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
464565
|
+
switch (env2.TERM_PROGRAM) {
|
|
464566
|
+
case "iTerm.app": {
|
|
464567
|
+
return version2 >= 3 ? 3 : 2;
|
|
464568
|
+
}
|
|
464569
|
+
case "Apple_Terminal": {
|
|
464570
|
+
return 2;
|
|
464571
|
+
}
|
|
464572
|
+
}
|
|
464573
|
+
}
|
|
464574
|
+
if (/-256(color)?$/i.test(env2.TERM)) {
|
|
464575
|
+
return 2;
|
|
464576
|
+
}
|
|
464577
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env2.TERM)) {
|
|
464578
|
+
return 1;
|
|
464579
|
+
}
|
|
464580
|
+
if ("COLORTERM" in env2) {
|
|
464581
|
+
return 1;
|
|
464582
|
+
}
|
|
464583
|
+
return min;
|
|
464584
|
+
}
|
|
464585
|
+
function createSupportsColor(stream, options = {}) {
|
|
464586
|
+
const level = _supportsColor(stream, {
|
|
464587
|
+
streamIsTTY: stream && stream.isTTY,
|
|
464588
|
+
...options
|
|
464589
|
+
});
|
|
464590
|
+
return translateLevel(level);
|
|
464591
|
+
}
|
|
464592
|
+
var supportsColor = {
|
|
464593
|
+
stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
|
|
464594
|
+
stderr: createSupportsColor({ isTTY: tty.isatty(2) })
|
|
464595
|
+
};
|
|
464596
|
+
var supports_color_default = supportsColor;
|
|
464597
|
+
|
|
464598
|
+
// node_modules/chalk/source/utilities.js
|
|
464599
|
+
function stringReplaceAll(string2, substring, replacer) {
|
|
464600
|
+
let index = string2.indexOf(substring);
|
|
464601
|
+
if (index === -1) {
|
|
464602
|
+
return string2;
|
|
464603
|
+
}
|
|
464604
|
+
const substringLength = substring.length;
|
|
464605
|
+
let endIndex = 0;
|
|
464606
|
+
let returnValue = "";
|
|
464607
|
+
do {
|
|
464608
|
+
returnValue += string2.slice(endIndex, index) + substring + replacer;
|
|
464609
|
+
endIndex = index + substringLength;
|
|
464610
|
+
index = string2.indexOf(substring, endIndex);
|
|
464611
|
+
} while (index !== -1);
|
|
464612
|
+
returnValue += string2.slice(endIndex);
|
|
464613
|
+
return returnValue;
|
|
464614
|
+
}
|
|
464615
|
+
function stringEncaseCRLFWithFirstIndex(string2, prefix, postfix, index) {
|
|
464616
|
+
let endIndex = 0;
|
|
464617
|
+
let returnValue = "";
|
|
464618
|
+
do {
|
|
464619
|
+
const gotCR = string2[index - 1] === "\r";
|
|
464620
|
+
returnValue += string2.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? `\r
|
|
464621
|
+
` : `
|
|
464622
|
+
`) + postfix;
|
|
464623
|
+
endIndex = index + 1;
|
|
464624
|
+
index = string2.indexOf(`
|
|
464625
|
+
`, endIndex);
|
|
464626
|
+
} while (index !== -1);
|
|
464627
|
+
returnValue += string2.slice(endIndex);
|
|
464628
|
+
return returnValue;
|
|
464629
|
+
}
|
|
464630
|
+
|
|
464631
|
+
// node_modules/chalk/source/index.js
|
|
464632
|
+
var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
|
|
464633
|
+
var GENERATOR = Symbol("GENERATOR");
|
|
464634
|
+
var STYLER = Symbol("STYLER");
|
|
464635
|
+
var IS_EMPTY = Symbol("IS_EMPTY");
|
|
464636
|
+
var levelMapping = [
|
|
464637
|
+
"ansi",
|
|
464638
|
+
"ansi",
|
|
464639
|
+
"ansi256",
|
|
464640
|
+
"ansi16m"
|
|
464641
|
+
];
|
|
464642
|
+
var styles2 = Object.create(null);
|
|
464643
|
+
var applyOptions = (object, options = {}) => {
|
|
464644
|
+
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
|
464645
|
+
throw new Error("The `level` option should be an integer from 0 to 3");
|
|
464646
|
+
}
|
|
464647
|
+
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
464648
|
+
object.level = options.level === undefined ? colorLevel : options.level;
|
|
464649
|
+
};
|
|
464650
|
+
var chalkFactory = (options) => {
|
|
464651
|
+
const chalk = (...strings) => strings.join(" ");
|
|
464652
|
+
applyOptions(chalk, options);
|
|
464653
|
+
Object.setPrototypeOf(chalk, createChalk.prototype);
|
|
464654
|
+
return chalk;
|
|
464655
|
+
};
|
|
464656
|
+
function createChalk(options) {
|
|
464657
|
+
return chalkFactory(options);
|
|
464658
|
+
}
|
|
464659
|
+
Object.setPrototypeOf(createChalk.prototype, Function.prototype);
|
|
464660
|
+
for (const [styleName, style] of Object.entries(ansi_styles_default)) {
|
|
464661
|
+
styles2[styleName] = {
|
|
464662
|
+
get() {
|
|
464663
|
+
const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
|
|
464664
|
+
Object.defineProperty(this, styleName, { value: builder });
|
|
464665
|
+
return builder;
|
|
464666
|
+
}
|
|
464667
|
+
};
|
|
464668
|
+
}
|
|
464669
|
+
styles2.visible = {
|
|
464670
|
+
get() {
|
|
464671
|
+
const builder = createBuilder(this, this[STYLER], true);
|
|
464672
|
+
Object.defineProperty(this, "visible", { value: builder });
|
|
464673
|
+
return builder;
|
|
464674
|
+
}
|
|
464675
|
+
};
|
|
464676
|
+
var getModelAnsi = (model, level, type, ...arguments_) => {
|
|
464677
|
+
if (model === "rgb") {
|
|
464678
|
+
if (level === "ansi16m") {
|
|
464679
|
+
return ansi_styles_default[type].ansi16m(...arguments_);
|
|
464680
|
+
}
|
|
464681
|
+
if (level === "ansi256") {
|
|
464682
|
+
return ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_));
|
|
464683
|
+
}
|
|
464684
|
+
return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
|
|
464685
|
+
}
|
|
464686
|
+
if (model === "hex") {
|
|
464687
|
+
return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_));
|
|
464688
|
+
}
|
|
464689
|
+
return ansi_styles_default[type][model](...arguments_);
|
|
464690
|
+
};
|
|
464691
|
+
var usedModels = ["rgb", "hex", "ansi256"];
|
|
464692
|
+
for (const model of usedModels) {
|
|
464693
|
+
styles2[model] = {
|
|
464694
|
+
get() {
|
|
464695
|
+
const { level } = this;
|
|
464696
|
+
return function(...arguments_) {
|
|
464697
|
+
const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]);
|
|
464698
|
+
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
464699
|
+
};
|
|
464700
|
+
}
|
|
464701
|
+
};
|
|
464702
|
+
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
|
464703
|
+
styles2[bgModel] = {
|
|
464704
|
+
get() {
|
|
464705
|
+
const { level } = this;
|
|
464706
|
+
return function(...arguments_) {
|
|
464707
|
+
const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]);
|
|
464708
|
+
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
464709
|
+
};
|
|
464710
|
+
}
|
|
464711
|
+
};
|
|
464712
|
+
}
|
|
464713
|
+
var proto = Object.defineProperties(() => {}, {
|
|
464714
|
+
...styles2,
|
|
464715
|
+
level: {
|
|
464716
|
+
enumerable: true,
|
|
464717
|
+
get() {
|
|
464718
|
+
return this[GENERATOR].level;
|
|
464719
|
+
},
|
|
464720
|
+
set(level) {
|
|
464721
|
+
this[GENERATOR].level = level;
|
|
464722
|
+
}
|
|
464723
|
+
}
|
|
464724
|
+
});
|
|
464725
|
+
var createStyler = (open2, close, parent) => {
|
|
464726
|
+
let openAll;
|
|
464727
|
+
let closeAll;
|
|
464728
|
+
if (parent === undefined) {
|
|
464729
|
+
openAll = open2;
|
|
464730
|
+
closeAll = close;
|
|
464731
|
+
} else {
|
|
464732
|
+
openAll = parent.openAll + open2;
|
|
464733
|
+
closeAll = close + parent.closeAll;
|
|
464734
|
+
}
|
|
464735
|
+
return {
|
|
464736
|
+
open: open2,
|
|
464737
|
+
close,
|
|
464738
|
+
openAll,
|
|
464739
|
+
closeAll,
|
|
464740
|
+
parent
|
|
464741
|
+
};
|
|
464742
|
+
};
|
|
464743
|
+
var createBuilder = (self2, _styler, _isEmpty) => {
|
|
464744
|
+
const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
|
464745
|
+
Object.setPrototypeOf(builder, proto);
|
|
464746
|
+
builder[GENERATOR] = self2;
|
|
464747
|
+
builder[STYLER] = _styler;
|
|
464748
|
+
builder[IS_EMPTY] = _isEmpty;
|
|
464749
|
+
return builder;
|
|
464750
|
+
};
|
|
464751
|
+
var applyStyle = (self2, string2) => {
|
|
464752
|
+
if (self2.level <= 0 || !string2) {
|
|
464753
|
+
return self2[IS_EMPTY] ? "" : string2;
|
|
464754
|
+
}
|
|
464755
|
+
let styler = self2[STYLER];
|
|
464756
|
+
if (styler === undefined) {
|
|
464757
|
+
return string2;
|
|
464758
|
+
}
|
|
464759
|
+
const { openAll, closeAll } = styler;
|
|
464760
|
+
if (string2.includes("\x1B")) {
|
|
464761
|
+
while (styler !== undefined) {
|
|
464762
|
+
string2 = stringReplaceAll(string2, styler.close, styler.open);
|
|
464763
|
+
styler = styler.parent;
|
|
464764
|
+
}
|
|
464765
|
+
}
|
|
464766
|
+
const lfIndex = string2.indexOf(`
|
|
464767
|
+
`);
|
|
464768
|
+
if (lfIndex !== -1) {
|
|
464769
|
+
string2 = stringEncaseCRLFWithFirstIndex(string2, closeAll, openAll, lfIndex);
|
|
464770
|
+
}
|
|
464771
|
+
return openAll + string2 + closeAll;
|
|
464772
|
+
};
|
|
464773
|
+
Object.defineProperties(createChalk.prototype, styles2);
|
|
464774
|
+
var chalk = createChalk();
|
|
464775
|
+
var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
464776
|
+
var source_default = chalk;
|
|
464777
|
+
|
|
464778
|
+
// cli/upgrade/register.ts
|
|
464779
|
+
function registerUpgradeCommand(program3) {
|
|
464780
|
+
program3.command("upgrade").description("Upgrade CLI to the latest version").action(async () => {
|
|
464781
|
+
const isUpdated = await checkForTsciUpdates();
|
|
464782
|
+
if (!isUpdated) {
|
|
464783
|
+
console.log(source_default.green("You are already using the latest version of tsci."));
|
|
464784
|
+
}
|
|
464785
|
+
});
|
|
464786
|
+
}
|
|
464787
|
+
|
|
464293
464788
|
// cli/main.ts
|
|
464294
464789
|
var program2 = new Command;
|
|
464295
464790
|
program2.name("tsci").description("CLI for developing tscircuit snippets").version(getVersion());
|
|
@@ -464306,6 +464801,7 @@ registerConfig(program2);
|
|
|
464306
464801
|
registerConfigPrint(program2);
|
|
464307
464802
|
registerExport(program2);
|
|
464308
464803
|
registerAdd(program2);
|
|
464804
|
+
registerUpgradeCommand(program2);
|
|
464309
464805
|
if (process.argv.length === 2) {
|
|
464310
464806
|
import_perfect_cli.perfectCli(program2, process.argv);
|
|
464311
464807
|
} else {
|