sim 2.1.18-dev.132.1 → 2.1.18-dev.133.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/dist/index.js +2171 -2168
- package/dist/runtime.js +4 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3331,551 +3331,6 @@ var require_commander = __commonJS(function(exports, module) {
|
|
|
3331
3331
|
exports.InvalidOptionArgumentError = InvalidArgumentError;
|
|
3332
3332
|
});
|
|
3333
3333
|
|
|
3334
|
-
// ../../node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
3335
|
-
var ANSI_BACKGROUND_OFFSET = 10;
|
|
3336
|
-
var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
3337
|
-
var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
3338
|
-
var wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
|
|
3339
|
-
var styles = {
|
|
3340
|
-
modifier: {
|
|
3341
|
-
reset: [0, 0],
|
|
3342
|
-
bold: [1, 22],
|
|
3343
|
-
dim: [2, 22],
|
|
3344
|
-
italic: [3, 23],
|
|
3345
|
-
underline: [4, 24],
|
|
3346
|
-
overline: [53, 55],
|
|
3347
|
-
inverse: [7, 27],
|
|
3348
|
-
hidden: [8, 28],
|
|
3349
|
-
strikethrough: [9, 29]
|
|
3350
|
-
},
|
|
3351
|
-
color: {
|
|
3352
|
-
black: [30, 39],
|
|
3353
|
-
red: [31, 39],
|
|
3354
|
-
green: [32, 39],
|
|
3355
|
-
yellow: [33, 39],
|
|
3356
|
-
blue: [34, 39],
|
|
3357
|
-
magenta: [35, 39],
|
|
3358
|
-
cyan: [36, 39],
|
|
3359
|
-
white: [37, 39],
|
|
3360
|
-
blackBright: [90, 39],
|
|
3361
|
-
gray: [90, 39],
|
|
3362
|
-
grey: [90, 39],
|
|
3363
|
-
redBright: [91, 39],
|
|
3364
|
-
greenBright: [92, 39],
|
|
3365
|
-
yellowBright: [93, 39],
|
|
3366
|
-
blueBright: [94, 39],
|
|
3367
|
-
magentaBright: [95, 39],
|
|
3368
|
-
cyanBright: [96, 39],
|
|
3369
|
-
whiteBright: [97, 39]
|
|
3370
|
-
},
|
|
3371
|
-
bgColor: {
|
|
3372
|
-
bgBlack: [40, 49],
|
|
3373
|
-
bgRed: [41, 49],
|
|
3374
|
-
bgGreen: [42, 49],
|
|
3375
|
-
bgYellow: [43, 49],
|
|
3376
|
-
bgBlue: [44, 49],
|
|
3377
|
-
bgMagenta: [45, 49],
|
|
3378
|
-
bgCyan: [46, 49],
|
|
3379
|
-
bgWhite: [47, 49],
|
|
3380
|
-
bgBlackBright: [100, 49],
|
|
3381
|
-
bgGray: [100, 49],
|
|
3382
|
-
bgGrey: [100, 49],
|
|
3383
|
-
bgRedBright: [101, 49],
|
|
3384
|
-
bgGreenBright: [102, 49],
|
|
3385
|
-
bgYellowBright: [103, 49],
|
|
3386
|
-
bgBlueBright: [104, 49],
|
|
3387
|
-
bgMagentaBright: [105, 49],
|
|
3388
|
-
bgCyanBright: [106, 49],
|
|
3389
|
-
bgWhiteBright: [107, 49]
|
|
3390
|
-
}
|
|
3391
|
-
};
|
|
3392
|
-
var modifierNames = Object.keys(styles.modifier);
|
|
3393
|
-
var foregroundColorNames = Object.keys(styles.color);
|
|
3394
|
-
var backgroundColorNames = Object.keys(styles.bgColor);
|
|
3395
|
-
var colorNames = [...foregroundColorNames, ...backgroundColorNames];
|
|
3396
|
-
function assembleStyles() {
|
|
3397
|
-
const codes = new Map;
|
|
3398
|
-
for (const [groupName, group] of Object.entries(styles)) {
|
|
3399
|
-
for (const [styleName, style] of Object.entries(group)) {
|
|
3400
|
-
styles[styleName] = {
|
|
3401
|
-
open: `\x1B[${style[0]}m`,
|
|
3402
|
-
close: `\x1B[${style[1]}m`
|
|
3403
|
-
};
|
|
3404
|
-
group[styleName] = styles[styleName];
|
|
3405
|
-
codes.set(style[0], style[1]);
|
|
3406
|
-
}
|
|
3407
|
-
Object.defineProperty(styles, groupName, {
|
|
3408
|
-
value: group,
|
|
3409
|
-
enumerable: false
|
|
3410
|
-
});
|
|
3411
|
-
}
|
|
3412
|
-
Object.defineProperty(styles, "codes", {
|
|
3413
|
-
value: codes,
|
|
3414
|
-
enumerable: false
|
|
3415
|
-
});
|
|
3416
|
-
styles.color.close = "\x1B[39m";
|
|
3417
|
-
styles.bgColor.close = "\x1B[49m";
|
|
3418
|
-
styles.color.ansi = wrapAnsi16();
|
|
3419
|
-
styles.color.ansi256 = wrapAnsi256();
|
|
3420
|
-
styles.color.ansi16m = wrapAnsi16m();
|
|
3421
|
-
styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
|
3422
|
-
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
|
3423
|
-
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
|
3424
|
-
Object.defineProperties(styles, {
|
|
3425
|
-
rgbToAnsi256: {
|
|
3426
|
-
value(red, green, blue) {
|
|
3427
|
-
if (red === green && green === blue) {
|
|
3428
|
-
if (red < 8) {
|
|
3429
|
-
return 16;
|
|
3430
|
-
}
|
|
3431
|
-
if (red > 248) {
|
|
3432
|
-
return 231;
|
|
3433
|
-
}
|
|
3434
|
-
return Math.round((red - 8) / 247 * 24) + 232;
|
|
3435
|
-
}
|
|
3436
|
-
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
|
3437
|
-
},
|
|
3438
|
-
enumerable: false
|
|
3439
|
-
},
|
|
3440
|
-
hexToRgb: {
|
|
3441
|
-
value(hex) {
|
|
3442
|
-
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
|
3443
|
-
if (!matches) {
|
|
3444
|
-
return [0, 0, 0];
|
|
3445
|
-
}
|
|
3446
|
-
let [colorString] = matches;
|
|
3447
|
-
if (colorString.length === 3) {
|
|
3448
|
-
colorString = [...colorString].map((character) => character + character).join("");
|
|
3449
|
-
}
|
|
3450
|
-
const integer = Number.parseInt(colorString, 16);
|
|
3451
|
-
return [
|
|
3452
|
-
integer >> 16 & 255,
|
|
3453
|
-
integer >> 8 & 255,
|
|
3454
|
-
integer & 255
|
|
3455
|
-
];
|
|
3456
|
-
},
|
|
3457
|
-
enumerable: false
|
|
3458
|
-
},
|
|
3459
|
-
hexToAnsi256: {
|
|
3460
|
-
value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
|
|
3461
|
-
enumerable: false
|
|
3462
|
-
},
|
|
3463
|
-
ansi256ToAnsi: {
|
|
3464
|
-
value(code) {
|
|
3465
|
-
if (code < 8) {
|
|
3466
|
-
return 30 + code;
|
|
3467
|
-
}
|
|
3468
|
-
if (code < 16) {
|
|
3469
|
-
return 90 + (code - 8);
|
|
3470
|
-
}
|
|
3471
|
-
let red;
|
|
3472
|
-
let green;
|
|
3473
|
-
let blue;
|
|
3474
|
-
if (code >= 232) {
|
|
3475
|
-
red = ((code - 232) * 10 + 8) / 255;
|
|
3476
|
-
green = red;
|
|
3477
|
-
blue = red;
|
|
3478
|
-
} else {
|
|
3479
|
-
code -= 16;
|
|
3480
|
-
const remainder = code % 36;
|
|
3481
|
-
red = Math.floor(code / 36) / 5;
|
|
3482
|
-
green = Math.floor(remainder / 6) / 5;
|
|
3483
|
-
blue = remainder % 6 / 5;
|
|
3484
|
-
}
|
|
3485
|
-
const value = Math.max(red, green, blue) * 2;
|
|
3486
|
-
if (value === 0) {
|
|
3487
|
-
return 30;
|
|
3488
|
-
}
|
|
3489
|
-
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
|
3490
|
-
if (value === 2) {
|
|
3491
|
-
result += 60;
|
|
3492
|
-
}
|
|
3493
|
-
return result;
|
|
3494
|
-
},
|
|
3495
|
-
enumerable: false
|
|
3496
|
-
},
|
|
3497
|
-
rgbToAnsi: {
|
|
3498
|
-
value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
|
|
3499
|
-
enumerable: false
|
|
3500
|
-
},
|
|
3501
|
-
hexToAnsi: {
|
|
3502
|
-
value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
|
|
3503
|
-
enumerable: false
|
|
3504
|
-
}
|
|
3505
|
-
});
|
|
3506
|
-
return styles;
|
|
3507
|
-
}
|
|
3508
|
-
var ansiStyles = assembleStyles();
|
|
3509
|
-
var ansi_styles_default = ansiStyles;
|
|
3510
|
-
|
|
3511
|
-
// ../../node_modules/chalk/source/vendor/supports-color/index.js
|
|
3512
|
-
import process2 from "node:process";
|
|
3513
|
-
import os from "node:os";
|
|
3514
|
-
import tty from "node:tty";
|
|
3515
|
-
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process2.argv) {
|
|
3516
|
-
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
3517
|
-
const position = argv.indexOf(prefix + flag);
|
|
3518
|
-
const terminatorPosition = argv.indexOf("--");
|
|
3519
|
-
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
3520
|
-
}
|
|
3521
|
-
var { env } = process2;
|
|
3522
|
-
var flagForceColor;
|
|
3523
|
-
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
|
3524
|
-
flagForceColor = 0;
|
|
3525
|
-
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
3526
|
-
flagForceColor = 1;
|
|
3527
|
-
}
|
|
3528
|
-
function envForceColor() {
|
|
3529
|
-
if ("FORCE_COLOR" in env) {
|
|
3530
|
-
if (env.FORCE_COLOR === "true") {
|
|
3531
|
-
return 1;
|
|
3532
|
-
}
|
|
3533
|
-
if (env.FORCE_COLOR === "false") {
|
|
3534
|
-
return 0;
|
|
3535
|
-
}
|
|
3536
|
-
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
3537
|
-
}
|
|
3538
|
-
}
|
|
3539
|
-
function translateLevel(level) {
|
|
3540
|
-
if (level === 0) {
|
|
3541
|
-
return false;
|
|
3542
|
-
}
|
|
3543
|
-
return {
|
|
3544
|
-
level,
|
|
3545
|
-
hasBasic: true,
|
|
3546
|
-
has256: level >= 2,
|
|
3547
|
-
has16m: level >= 3
|
|
3548
|
-
};
|
|
3549
|
-
}
|
|
3550
|
-
function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
3551
|
-
const noFlagForceColor = envForceColor();
|
|
3552
|
-
if (noFlagForceColor !== undefined) {
|
|
3553
|
-
flagForceColor = noFlagForceColor;
|
|
3554
|
-
}
|
|
3555
|
-
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
3556
|
-
if (forceColor === 0) {
|
|
3557
|
-
return 0;
|
|
3558
|
-
}
|
|
3559
|
-
if (sniffFlags) {
|
|
3560
|
-
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
3561
|
-
return 3;
|
|
3562
|
-
}
|
|
3563
|
-
if (hasFlag("color=256")) {
|
|
3564
|
-
return 2;
|
|
3565
|
-
}
|
|
3566
|
-
}
|
|
3567
|
-
if ("TF_BUILD" in env && "AGENT_NAME" in env) {
|
|
3568
|
-
return 1;
|
|
3569
|
-
}
|
|
3570
|
-
if (haveStream && !streamIsTTY && forceColor === undefined) {
|
|
3571
|
-
return 0;
|
|
3572
|
-
}
|
|
3573
|
-
const min = forceColor || 0;
|
|
3574
|
-
if (env.TERM === "dumb") {
|
|
3575
|
-
return min;
|
|
3576
|
-
}
|
|
3577
|
-
if (process2.platform === "win32") {
|
|
3578
|
-
const osRelease = os.release().split(".");
|
|
3579
|
-
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
3580
|
-
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
3581
|
-
}
|
|
3582
|
-
return 1;
|
|
3583
|
-
}
|
|
3584
|
-
if ("CI" in env) {
|
|
3585
|
-
if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => (key in env))) {
|
|
3586
|
-
return 3;
|
|
3587
|
-
}
|
|
3588
|
-
if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => (sign in env)) || env.CI_NAME === "codeship") {
|
|
3589
|
-
return 1;
|
|
3590
|
-
}
|
|
3591
|
-
return min;
|
|
3592
|
-
}
|
|
3593
|
-
if ("TEAMCITY_VERSION" in env) {
|
|
3594
|
-
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
3595
|
-
}
|
|
3596
|
-
if (env.COLORTERM === "truecolor") {
|
|
3597
|
-
return 3;
|
|
3598
|
-
}
|
|
3599
|
-
if (env.TERM === "xterm-kitty") {
|
|
3600
|
-
return 3;
|
|
3601
|
-
}
|
|
3602
|
-
if (env.TERM === "xterm-ghostty") {
|
|
3603
|
-
return 3;
|
|
3604
|
-
}
|
|
3605
|
-
if (env.TERM === "wezterm") {
|
|
3606
|
-
return 3;
|
|
3607
|
-
}
|
|
3608
|
-
if ("TERM_PROGRAM" in env) {
|
|
3609
|
-
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
3610
|
-
switch (env.TERM_PROGRAM) {
|
|
3611
|
-
case "iTerm.app": {
|
|
3612
|
-
return version >= 3 ? 3 : 2;
|
|
3613
|
-
}
|
|
3614
|
-
case "Apple_Terminal": {
|
|
3615
|
-
return 2;
|
|
3616
|
-
}
|
|
3617
|
-
}
|
|
3618
|
-
}
|
|
3619
|
-
if (/-256(color)?$/i.test(env.TERM)) {
|
|
3620
|
-
return 2;
|
|
3621
|
-
}
|
|
3622
|
-
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
3623
|
-
return 1;
|
|
3624
|
-
}
|
|
3625
|
-
if ("COLORTERM" in env) {
|
|
3626
|
-
return 1;
|
|
3627
|
-
}
|
|
3628
|
-
return min;
|
|
3629
|
-
}
|
|
3630
|
-
function createSupportsColor(stream, options = {}) {
|
|
3631
|
-
const level = _supportsColor(stream, {
|
|
3632
|
-
streamIsTTY: stream && stream.isTTY,
|
|
3633
|
-
...options
|
|
3634
|
-
});
|
|
3635
|
-
return translateLevel(level);
|
|
3636
|
-
}
|
|
3637
|
-
var supportsColor = {
|
|
3638
|
-
stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
|
|
3639
|
-
stderr: createSupportsColor({ isTTY: tty.isatty(2) })
|
|
3640
|
-
};
|
|
3641
|
-
var supports_color_default = supportsColor;
|
|
3642
|
-
|
|
3643
|
-
// ../../node_modules/chalk/source/utilities.js
|
|
3644
|
-
function stringReplaceAll(string, substring, replacer) {
|
|
3645
|
-
let index = string.indexOf(substring);
|
|
3646
|
-
if (index === -1) {
|
|
3647
|
-
return string;
|
|
3648
|
-
}
|
|
3649
|
-
const substringLength = substring.length;
|
|
3650
|
-
let endIndex = 0;
|
|
3651
|
-
let returnValue = "";
|
|
3652
|
-
do {
|
|
3653
|
-
returnValue += string.slice(endIndex, index) + substring + replacer;
|
|
3654
|
-
endIndex = index + substringLength;
|
|
3655
|
-
index = string.indexOf(substring, endIndex);
|
|
3656
|
-
} while (index !== -1);
|
|
3657
|
-
returnValue += string.slice(endIndex);
|
|
3658
|
-
return returnValue;
|
|
3659
|
-
}
|
|
3660
|
-
function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
|
|
3661
|
-
let endIndex = 0;
|
|
3662
|
-
let returnValue = "";
|
|
3663
|
-
do {
|
|
3664
|
-
const gotCR = string[index - 1] === "\r";
|
|
3665
|
-
returnValue += string.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? `\r
|
|
3666
|
-
` : `
|
|
3667
|
-
`) + postfix;
|
|
3668
|
-
endIndex = index + 1;
|
|
3669
|
-
index = string.indexOf(`
|
|
3670
|
-
`, endIndex);
|
|
3671
|
-
} while (index !== -1);
|
|
3672
|
-
returnValue += string.slice(endIndex);
|
|
3673
|
-
return returnValue;
|
|
3674
|
-
}
|
|
3675
|
-
|
|
3676
|
-
// ../../node_modules/chalk/source/index.js
|
|
3677
|
-
var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
|
|
3678
|
-
var GENERATOR = Symbol("GENERATOR");
|
|
3679
|
-
var STYLER = Symbol("STYLER");
|
|
3680
|
-
var IS_EMPTY = Symbol("IS_EMPTY");
|
|
3681
|
-
var levelMapping = [
|
|
3682
|
-
"ansi",
|
|
3683
|
-
"ansi",
|
|
3684
|
-
"ansi256",
|
|
3685
|
-
"ansi16m"
|
|
3686
|
-
];
|
|
3687
|
-
var styles2 = Object.create(null);
|
|
3688
|
-
var applyOptions = (object, options = {}) => {
|
|
3689
|
-
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
|
3690
|
-
throw new Error("The `level` option should be an integer from 0 to 3");
|
|
3691
|
-
}
|
|
3692
|
-
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
3693
|
-
object.level = options.level === undefined ? colorLevel : options.level;
|
|
3694
|
-
};
|
|
3695
|
-
|
|
3696
|
-
class Chalk {
|
|
3697
|
-
constructor(options) {
|
|
3698
|
-
return chalkFactory(options);
|
|
3699
|
-
}
|
|
3700
|
-
}
|
|
3701
|
-
var chalkFactory = (options) => {
|
|
3702
|
-
const chalk = (...strings) => strings.join(" ");
|
|
3703
|
-
applyOptions(chalk, options);
|
|
3704
|
-
Object.setPrototypeOf(chalk, createChalk.prototype);
|
|
3705
|
-
return chalk;
|
|
3706
|
-
};
|
|
3707
|
-
function createChalk(options) {
|
|
3708
|
-
return chalkFactory(options);
|
|
3709
|
-
}
|
|
3710
|
-
Object.setPrototypeOf(createChalk.prototype, Function.prototype);
|
|
3711
|
-
for (const [styleName, style] of Object.entries(ansi_styles_default)) {
|
|
3712
|
-
styles2[styleName] = {
|
|
3713
|
-
get() {
|
|
3714
|
-
const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
|
|
3715
|
-
Object.defineProperty(this, styleName, { value: builder });
|
|
3716
|
-
return builder;
|
|
3717
|
-
}
|
|
3718
|
-
};
|
|
3719
|
-
}
|
|
3720
|
-
styles2.visible = {
|
|
3721
|
-
get() {
|
|
3722
|
-
const builder = createBuilder(this, this[STYLER], true);
|
|
3723
|
-
Object.defineProperty(this, "visible", { value: builder });
|
|
3724
|
-
return builder;
|
|
3725
|
-
}
|
|
3726
|
-
};
|
|
3727
|
-
var getModelAnsi = (model, level, type, ...arguments_) => {
|
|
3728
|
-
if (model === "rgb") {
|
|
3729
|
-
if (level === "ansi16m") {
|
|
3730
|
-
return ansi_styles_default[type].ansi16m(...arguments_);
|
|
3731
|
-
}
|
|
3732
|
-
if (level === "ansi256") {
|
|
3733
|
-
return ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_));
|
|
3734
|
-
}
|
|
3735
|
-
return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
|
|
3736
|
-
}
|
|
3737
|
-
if (model === "hex") {
|
|
3738
|
-
return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_));
|
|
3739
|
-
}
|
|
3740
|
-
return ansi_styles_default[type][model](...arguments_);
|
|
3741
|
-
};
|
|
3742
|
-
var usedModels = ["rgb", "hex", "ansi256"];
|
|
3743
|
-
for (const model of usedModels) {
|
|
3744
|
-
styles2[model] = {
|
|
3745
|
-
get() {
|
|
3746
|
-
const { level } = this;
|
|
3747
|
-
return function(...arguments_) {
|
|
3748
|
-
const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]);
|
|
3749
|
-
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
3750
|
-
};
|
|
3751
|
-
}
|
|
3752
|
-
};
|
|
3753
|
-
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
|
3754
|
-
styles2[bgModel] = {
|
|
3755
|
-
get() {
|
|
3756
|
-
const { level } = this;
|
|
3757
|
-
return function(...arguments_) {
|
|
3758
|
-
const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]);
|
|
3759
|
-
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
3760
|
-
};
|
|
3761
|
-
}
|
|
3762
|
-
};
|
|
3763
|
-
}
|
|
3764
|
-
var proto = Object.defineProperties(() => {}, {
|
|
3765
|
-
...styles2,
|
|
3766
|
-
level: {
|
|
3767
|
-
enumerable: true,
|
|
3768
|
-
get() {
|
|
3769
|
-
return this[GENERATOR].level;
|
|
3770
|
-
},
|
|
3771
|
-
set(level) {
|
|
3772
|
-
this[GENERATOR].level = level;
|
|
3773
|
-
}
|
|
3774
|
-
}
|
|
3775
|
-
});
|
|
3776
|
-
var createStyler = (open, close, parent) => {
|
|
3777
|
-
let openAll;
|
|
3778
|
-
let closeAll;
|
|
3779
|
-
if (parent === undefined) {
|
|
3780
|
-
openAll = open;
|
|
3781
|
-
closeAll = close;
|
|
3782
|
-
} else {
|
|
3783
|
-
openAll = parent.openAll + open;
|
|
3784
|
-
closeAll = close + parent.closeAll;
|
|
3785
|
-
}
|
|
3786
|
-
return {
|
|
3787
|
-
open,
|
|
3788
|
-
close,
|
|
3789
|
-
openAll,
|
|
3790
|
-
closeAll,
|
|
3791
|
-
parent
|
|
3792
|
-
};
|
|
3793
|
-
};
|
|
3794
|
-
var createBuilder = (self, _styler, _isEmpty) => {
|
|
3795
|
-
const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
|
3796
|
-
Object.setPrototypeOf(builder, proto);
|
|
3797
|
-
builder[GENERATOR] = self;
|
|
3798
|
-
builder[STYLER] = _styler;
|
|
3799
|
-
builder[IS_EMPTY] = _isEmpty;
|
|
3800
|
-
return builder;
|
|
3801
|
-
};
|
|
3802
|
-
var applyStyle = (self, string) => {
|
|
3803
|
-
if (self.level <= 0 || !string) {
|
|
3804
|
-
return self[IS_EMPTY] ? "" : string;
|
|
3805
|
-
}
|
|
3806
|
-
let styler = self[STYLER];
|
|
3807
|
-
if (styler === undefined) {
|
|
3808
|
-
return string;
|
|
3809
|
-
}
|
|
3810
|
-
const { openAll, closeAll } = styler;
|
|
3811
|
-
if (string.includes("\x1B")) {
|
|
3812
|
-
while (styler !== undefined) {
|
|
3813
|
-
string = stringReplaceAll(string, styler.close, styler.open);
|
|
3814
|
-
styler = styler.parent;
|
|
3815
|
-
}
|
|
3816
|
-
}
|
|
3817
|
-
const lfIndex = string.indexOf(`
|
|
3818
|
-
`);
|
|
3819
|
-
if (lfIndex !== -1) {
|
|
3820
|
-
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
|
3821
|
-
}
|
|
3822
|
-
return openAll + string + closeAll;
|
|
3823
|
-
};
|
|
3824
|
-
Object.defineProperties(createChalk.prototype, styles2);
|
|
3825
|
-
var chalk = createChalk();
|
|
3826
|
-
var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
3827
|
-
var source_default = chalk;
|
|
3828
|
-
|
|
3829
|
-
// src/embed-context.ts
|
|
3830
|
-
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3831
|
-
function setSoftExitCode(code) {
|
|
3832
|
-
const ctx = embedStore.getStore();
|
|
3833
|
-
if (ctx)
|
|
3834
|
-
ctx.softExitCode = code;
|
|
3835
|
-
else
|
|
3836
|
-
process.exitCode = code;
|
|
3837
|
-
}
|
|
3838
|
-
var embedStore = new AsyncLocalStorage;
|
|
3839
|
-
|
|
3840
|
-
class EmbeddedExit extends Error {
|
|
3841
|
-
code;
|
|
3842
|
-
constructor(code) {
|
|
3843
|
-
super(`CLI exited with code ${code}`);
|
|
3844
|
-
this.code = code;
|
|
3845
|
-
}
|
|
3846
|
-
}
|
|
3847
|
-
function embeddedProfile() {
|
|
3848
|
-
const ctx = embedStore.getStore();
|
|
3849
|
-
if (!ctx)
|
|
3850
|
-
return null;
|
|
3851
|
-
return {
|
|
3852
|
-
name: "embedded",
|
|
3853
|
-
authProfile: "embedded",
|
|
3854
|
-
oauth: null,
|
|
3855
|
-
endpoint: ctx.identity.endpoint,
|
|
3856
|
-
apiKey: ctx.identity.apiKey,
|
|
3857
|
-
workspaceId: ctx.identity.workspaceId ?? null,
|
|
3858
|
-
output: "json",
|
|
3859
|
-
...ctx.identity.transport ? { transport: ctx.identity.transport } : {},
|
|
3860
|
-
...ctx.identity.signal ? { signal: ctx.identity.signal } : {},
|
|
3861
|
-
sources: { endpoint: "flag", credential: "flag", workspaceId: "flag", output: "flag" }
|
|
3862
|
-
};
|
|
3863
|
-
}
|
|
3864
|
-
function exitCli(code) {
|
|
3865
|
-
if (embedStore.getStore())
|
|
3866
|
-
throw new EmbeddedExit(code);
|
|
3867
|
-
return process.exit(code);
|
|
3868
|
-
}
|
|
3869
|
-
|
|
3870
|
-
// src/output/presentation.ts
|
|
3871
|
-
var plain = new Chalk({ level: 0 });
|
|
3872
|
-
function styles3() {
|
|
3873
|
-
return embedStore.getStore() ? plain : source_default;
|
|
3874
|
-
}
|
|
3875
|
-
function hasProgressTerminal() {
|
|
3876
|
-
return !embedStore.getStore() && Boolean(process.stderr.isTTY);
|
|
3877
|
-
}
|
|
3878
|
-
|
|
3879
3334
|
// node_modules/js-yaml/dist/js-yaml.mjs
|
|
3880
3335
|
function getDefaultExportFromCjs(x) {
|
|
3881
3336
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
@@ -5181,1826 +4636,2371 @@ function requireLoader() {
|
|
|
5181
4636
|
if (!PATTERN_TAG_HANDLE.test(handle)) {
|
|
5182
4637
|
throwError(state, "ill-formed tag handle (first argument) of the TAG directive");
|
|
5183
4638
|
}
|
|
5184
|
-
if (_hasOwnProperty.call(state.tagMap, handle)) {
|
|
5185
|
-
throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
|
|
4639
|
+
if (_hasOwnProperty.call(state.tagMap, handle)) {
|
|
4640
|
+
throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
|
|
4641
|
+
}
|
|
4642
|
+
if (!PATTERN_TAG_URI.test(prefix)) {
|
|
4643
|
+
throwError(state, "ill-formed tag prefix (second argument) of the TAG directive");
|
|
4644
|
+
}
|
|
4645
|
+
try {
|
|
4646
|
+
prefix = decodeURIComponent(prefix);
|
|
4647
|
+
} catch (err) {
|
|
4648
|
+
throwError(state, "tag prefix is malformed: " + prefix);
|
|
4649
|
+
}
|
|
4650
|
+
state.tagMap[handle] = prefix;
|
|
4651
|
+
}
|
|
4652
|
+
};
|
|
4653
|
+
function captureSegment(state, start, end, checkJson) {
|
|
4654
|
+
if (start < end) {
|
|
4655
|
+
const _result = state.input.slice(start, end);
|
|
4656
|
+
if (checkJson) {
|
|
4657
|
+
for (let _position = 0, _length = _result.length;_position < _length; _position += 1) {
|
|
4658
|
+
const _character = _result.charCodeAt(_position);
|
|
4659
|
+
if (!(_character === 9 || _character >= 32 && _character <= 1114111)) {
|
|
4660
|
+
throwError(state, "expected valid JSON character");
|
|
4661
|
+
}
|
|
4662
|
+
}
|
|
4663
|
+
} else if (PATTERN_NON_PRINTABLE.test(_result)) {
|
|
4664
|
+
throwError(state, "the stream contains non-printable characters");
|
|
4665
|
+
}
|
|
4666
|
+
state.result += _result;
|
|
4667
|
+
}
|
|
4668
|
+
}
|
|
4669
|
+
function mergeMappings(state, destination, source, overridableKeys) {
|
|
4670
|
+
if (!common2.isObject(source)) {
|
|
4671
|
+
throwError(state, "cannot merge mappings; the provided source object is unacceptable");
|
|
4672
|
+
}
|
|
4673
|
+
const sourceKeys = Object.keys(source);
|
|
4674
|
+
for (let index = 0, quantity = sourceKeys.length;index < quantity; index += 1) {
|
|
4675
|
+
const key = sourceKeys[index];
|
|
4676
|
+
if (state.maxTotalMergeKeys !== -1 && ++state.totalMergeKeys > state.maxTotalMergeKeys) {
|
|
4677
|
+
throwError(state, "merge keys exceeded maxTotalMergeKeys (" + state.maxTotalMergeKeys + ")");
|
|
4678
|
+
}
|
|
4679
|
+
if (!_hasOwnProperty.call(destination, key)) {
|
|
4680
|
+
setProperty(destination, key, source[key]);
|
|
4681
|
+
overridableKeys[key] = true;
|
|
4682
|
+
}
|
|
4683
|
+
}
|
|
4684
|
+
}
|
|
4685
|
+
function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startLineStart, startPos) {
|
|
4686
|
+
if (Array.isArray(keyNode)) {
|
|
4687
|
+
keyNode = Array.prototype.slice.call(keyNode);
|
|
4688
|
+
for (let index = 0, quantity = keyNode.length;index < quantity; index += 1) {
|
|
4689
|
+
if (Array.isArray(keyNode[index])) {
|
|
4690
|
+
throwError(state, "nested arrays are not supported inside keys");
|
|
4691
|
+
}
|
|
4692
|
+
if (typeof keyNode === "object" && _class(keyNode[index]) === "[object Object]") {
|
|
4693
|
+
keyNode[index] = "[object Object]";
|
|
4694
|
+
}
|
|
4695
|
+
}
|
|
4696
|
+
}
|
|
4697
|
+
if (typeof keyNode === "object" && _class(keyNode) === "[object Object]") {
|
|
4698
|
+
keyNode = "[object Object]";
|
|
4699
|
+
}
|
|
4700
|
+
keyNode = String(keyNode);
|
|
4701
|
+
if (_result === null) {
|
|
4702
|
+
_result = {};
|
|
4703
|
+
}
|
|
4704
|
+
if (keyTag === "tag:yaml.org,2002:merge") {
|
|
4705
|
+
if (Array.isArray(valueNode)) {
|
|
4706
|
+
for (let index = 0, quantity = valueNode.length;index < quantity; index += 1) {
|
|
4707
|
+
mergeMappings(state, _result, valueNode[index], overridableKeys);
|
|
4708
|
+
}
|
|
4709
|
+
} else {
|
|
4710
|
+
mergeMappings(state, _result, valueNode, overridableKeys);
|
|
4711
|
+
}
|
|
4712
|
+
} else {
|
|
4713
|
+
if (!state.json && !_hasOwnProperty.call(overridableKeys, keyNode) && _hasOwnProperty.call(_result, keyNode)) {
|
|
4714
|
+
state.line = startLine || state.line;
|
|
4715
|
+
state.lineStart = startLineStart || state.lineStart;
|
|
4716
|
+
state.position = startPos || state.position;
|
|
4717
|
+
throwError(state, "duplicated mapping key");
|
|
4718
|
+
}
|
|
4719
|
+
setProperty(_result, keyNode, valueNode);
|
|
4720
|
+
delete overridableKeys[keyNode];
|
|
4721
|
+
}
|
|
4722
|
+
return _result;
|
|
4723
|
+
}
|
|
4724
|
+
function readLineBreak(state) {
|
|
4725
|
+
const ch = state.input.charCodeAt(state.position);
|
|
4726
|
+
if (ch === 10) {
|
|
4727
|
+
state.position++;
|
|
4728
|
+
} else if (ch === 13) {
|
|
4729
|
+
state.position++;
|
|
4730
|
+
if (state.input.charCodeAt(state.position) === 10) {
|
|
4731
|
+
state.position++;
|
|
4732
|
+
}
|
|
4733
|
+
} else {
|
|
4734
|
+
throwError(state, "a line break is expected");
|
|
4735
|
+
}
|
|
4736
|
+
state.line += 1;
|
|
4737
|
+
state.lineStart = state.position;
|
|
4738
|
+
state.firstTabInLine = -1;
|
|
4739
|
+
}
|
|
4740
|
+
function skipSeparationSpace(state, allowComments, checkIndent) {
|
|
4741
|
+
let lineBreaks = 0;
|
|
4742
|
+
let ch = state.input.charCodeAt(state.position);
|
|
4743
|
+
while (ch !== 0) {
|
|
4744
|
+
while (isWhiteSpace(ch)) {
|
|
4745
|
+
if (ch === 9 && state.firstTabInLine === -1) {
|
|
4746
|
+
state.firstTabInLine = state.position;
|
|
4747
|
+
}
|
|
4748
|
+
ch = state.input.charCodeAt(++state.position);
|
|
4749
|
+
}
|
|
4750
|
+
if (allowComments && ch === 35) {
|
|
4751
|
+
do {
|
|
4752
|
+
ch = state.input.charCodeAt(++state.position);
|
|
4753
|
+
} while (ch !== 10 && ch !== 13 && ch !== 0);
|
|
4754
|
+
}
|
|
4755
|
+
if (isEol(ch)) {
|
|
4756
|
+
readLineBreak(state);
|
|
4757
|
+
ch = state.input.charCodeAt(state.position);
|
|
4758
|
+
lineBreaks++;
|
|
4759
|
+
state.lineIndent = 0;
|
|
4760
|
+
while (ch === 32) {
|
|
4761
|
+
state.lineIndent++;
|
|
4762
|
+
ch = state.input.charCodeAt(++state.position);
|
|
4763
|
+
}
|
|
4764
|
+
} else {
|
|
4765
|
+
break;
|
|
4766
|
+
}
|
|
4767
|
+
}
|
|
4768
|
+
if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {
|
|
4769
|
+
throwWarning(state, "deficient indentation");
|
|
4770
|
+
}
|
|
4771
|
+
return lineBreaks;
|
|
4772
|
+
}
|
|
4773
|
+
function testDocumentSeparator(state) {
|
|
4774
|
+
let _position = state.position;
|
|
4775
|
+
let ch = state.input.charCodeAt(_position);
|
|
4776
|
+
if ((ch === 45 || ch === 46) && ch === state.input.charCodeAt(_position + 1) && ch === state.input.charCodeAt(_position + 2)) {
|
|
4777
|
+
_position += 3;
|
|
4778
|
+
ch = state.input.charCodeAt(_position);
|
|
4779
|
+
if (ch === 0 || isWsOrEol(ch)) {
|
|
4780
|
+
return true;
|
|
4781
|
+
}
|
|
4782
|
+
}
|
|
4783
|
+
return false;
|
|
4784
|
+
}
|
|
4785
|
+
function writeFoldedLines(state, count) {
|
|
4786
|
+
if (count === 1) {
|
|
4787
|
+
state.result += " ";
|
|
4788
|
+
} else if (count > 1) {
|
|
4789
|
+
state.result += common2.repeat(`
|
|
4790
|
+
`, count - 1);
|
|
4791
|
+
}
|
|
4792
|
+
}
|
|
4793
|
+
function readPlainScalar(state, nodeIndent, withinFlowCollection) {
|
|
4794
|
+
let captureStart;
|
|
4795
|
+
let captureEnd;
|
|
4796
|
+
let hasPendingContent;
|
|
4797
|
+
let _line;
|
|
4798
|
+
let _lineStart;
|
|
4799
|
+
let _lineIndent;
|
|
4800
|
+
const _kind = state.kind;
|
|
4801
|
+
const _result = state.result;
|
|
4802
|
+
let ch = state.input.charCodeAt(state.position);
|
|
4803
|
+
if (isWsOrEol(ch) || isFlowIndicator(ch) || ch === 35 || ch === 38 || ch === 42 || ch === 33 || ch === 124 || ch === 62 || ch === 39 || ch === 34 || ch === 37 || ch === 64 || ch === 96) {
|
|
4804
|
+
return false;
|
|
4805
|
+
}
|
|
4806
|
+
if (ch === 63 || ch === 45) {
|
|
4807
|
+
const following = state.input.charCodeAt(state.position + 1);
|
|
4808
|
+
if (isWsOrEol(following) || withinFlowCollection && isFlowIndicator(following)) {
|
|
4809
|
+
return false;
|
|
4810
|
+
}
|
|
4811
|
+
}
|
|
4812
|
+
state.kind = "scalar";
|
|
4813
|
+
state.result = "";
|
|
4814
|
+
captureStart = captureEnd = state.position;
|
|
4815
|
+
hasPendingContent = false;
|
|
4816
|
+
while (ch !== 0) {
|
|
4817
|
+
if (ch === 58) {
|
|
4818
|
+
const following = state.input.charCodeAt(state.position + 1);
|
|
4819
|
+
if (isWsOrEol(following) || withinFlowCollection && isFlowIndicator(following)) {
|
|
4820
|
+
break;
|
|
4821
|
+
}
|
|
4822
|
+
} else if (ch === 35) {
|
|
4823
|
+
const preceding = state.input.charCodeAt(state.position - 1);
|
|
4824
|
+
if (isWsOrEol(preceding)) {
|
|
4825
|
+
break;
|
|
4826
|
+
}
|
|
4827
|
+
} else if (state.position === state.lineStart && testDocumentSeparator(state) || withinFlowCollection && isFlowIndicator(ch)) {
|
|
4828
|
+
break;
|
|
4829
|
+
} else if (isEol(ch)) {
|
|
4830
|
+
_line = state.line;
|
|
4831
|
+
_lineStart = state.lineStart;
|
|
4832
|
+
_lineIndent = state.lineIndent;
|
|
4833
|
+
skipSeparationSpace(state, false, -1);
|
|
4834
|
+
if (state.lineIndent >= nodeIndent) {
|
|
4835
|
+
hasPendingContent = true;
|
|
4836
|
+
ch = state.input.charCodeAt(state.position);
|
|
4837
|
+
continue;
|
|
4838
|
+
} else {
|
|
4839
|
+
state.position = captureEnd;
|
|
4840
|
+
state.line = _line;
|
|
4841
|
+
state.lineStart = _lineStart;
|
|
4842
|
+
state.lineIndent = _lineIndent;
|
|
4843
|
+
break;
|
|
4844
|
+
}
|
|
4845
|
+
}
|
|
4846
|
+
if (hasPendingContent) {
|
|
4847
|
+
captureSegment(state, captureStart, captureEnd, false);
|
|
4848
|
+
writeFoldedLines(state, state.line - _line);
|
|
4849
|
+
captureStart = captureEnd = state.position;
|
|
4850
|
+
hasPendingContent = false;
|
|
5186
4851
|
}
|
|
5187
|
-
if (!
|
|
5188
|
-
|
|
4852
|
+
if (!isWhiteSpace(ch)) {
|
|
4853
|
+
captureEnd = state.position + 1;
|
|
5189
4854
|
}
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
4855
|
+
ch = state.input.charCodeAt(++state.position);
|
|
4856
|
+
}
|
|
4857
|
+
captureSegment(state, captureStart, captureEnd, false);
|
|
4858
|
+
if (state.result) {
|
|
4859
|
+
return true;
|
|
4860
|
+
}
|
|
4861
|
+
state.kind = _kind;
|
|
4862
|
+
state.result = _result;
|
|
4863
|
+
return false;
|
|
4864
|
+
}
|
|
4865
|
+
function readSingleQuotedScalar(state, nodeIndent) {
|
|
4866
|
+
let captureStart;
|
|
4867
|
+
let captureEnd;
|
|
4868
|
+
let ch = state.input.charCodeAt(state.position);
|
|
4869
|
+
if (ch !== 39) {
|
|
4870
|
+
return false;
|
|
4871
|
+
}
|
|
4872
|
+
state.kind = "scalar";
|
|
4873
|
+
state.result = "";
|
|
4874
|
+
state.position++;
|
|
4875
|
+
captureStart = captureEnd = state.position;
|
|
4876
|
+
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
4877
|
+
if (ch === 39) {
|
|
4878
|
+
captureSegment(state, captureStart, state.position, true);
|
|
4879
|
+
ch = state.input.charCodeAt(++state.position);
|
|
4880
|
+
if (ch === 39) {
|
|
4881
|
+
captureStart = state.position;
|
|
4882
|
+
state.position++;
|
|
4883
|
+
captureEnd = state.position;
|
|
4884
|
+
} else {
|
|
4885
|
+
return true;
|
|
4886
|
+
}
|
|
4887
|
+
} else if (isEol(ch)) {
|
|
4888
|
+
captureSegment(state, captureStart, captureEnd, true);
|
|
4889
|
+
writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
|
|
4890
|
+
captureStart = captureEnd = state.position;
|
|
4891
|
+
} else if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
4892
|
+
throwError(state, "unexpected end of the document within a single quoted scalar");
|
|
4893
|
+
} else {
|
|
4894
|
+
state.position++;
|
|
4895
|
+
if (!isWhiteSpace(ch)) {
|
|
4896
|
+
captureEnd = state.position;
|
|
4897
|
+
}
|
|
5194
4898
|
}
|
|
5195
|
-
state.tagMap[handle] = prefix;
|
|
5196
4899
|
}
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
4900
|
+
throwError(state, "unexpected end of the stream within a single quoted scalar");
|
|
4901
|
+
}
|
|
4902
|
+
function readDoubleQuotedScalar(state, nodeIndent) {
|
|
4903
|
+
let captureStart;
|
|
4904
|
+
let captureEnd;
|
|
4905
|
+
let tmp;
|
|
4906
|
+
let ch = state.input.charCodeAt(state.position);
|
|
4907
|
+
if (ch !== 34) {
|
|
4908
|
+
return false;
|
|
4909
|
+
}
|
|
4910
|
+
state.kind = "scalar";
|
|
4911
|
+
state.result = "";
|
|
4912
|
+
state.position++;
|
|
4913
|
+
captureStart = captureEnd = state.position;
|
|
4914
|
+
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
4915
|
+
if (ch === 34) {
|
|
4916
|
+
captureSegment(state, captureStart, state.position, true);
|
|
4917
|
+
state.position++;
|
|
4918
|
+
return true;
|
|
4919
|
+
} else if (ch === 92) {
|
|
4920
|
+
captureSegment(state, captureStart, state.position, true);
|
|
4921
|
+
ch = state.input.charCodeAt(++state.position);
|
|
4922
|
+
if (isEol(ch)) {
|
|
4923
|
+
skipSeparationSpace(state, false, nodeIndent);
|
|
4924
|
+
} else if (ch < 256 && simpleEscapeCheck[ch]) {
|
|
4925
|
+
state.result += simpleEscapeMap[ch];
|
|
4926
|
+
state.position++;
|
|
4927
|
+
} else if ((tmp = escapedHexLen(ch)) > 0) {
|
|
4928
|
+
let hexLength = tmp;
|
|
4929
|
+
let hexResult = 0;
|
|
4930
|
+
for (;hexLength > 0; hexLength--) {
|
|
4931
|
+
ch = state.input.charCodeAt(++state.position);
|
|
4932
|
+
if ((tmp = fromHexCode(ch)) >= 0) {
|
|
4933
|
+
hexResult = (hexResult << 4) + tmp;
|
|
4934
|
+
} else {
|
|
4935
|
+
throwError(state, "expected hexadecimal character");
|
|
4936
|
+
}
|
|
5206
4937
|
}
|
|
4938
|
+
state.result += charFromCodepoint(hexResult);
|
|
4939
|
+
state.position++;
|
|
4940
|
+
} else {
|
|
4941
|
+
throwError(state, "unknown escape sequence");
|
|
4942
|
+
}
|
|
4943
|
+
captureStart = captureEnd = state.position;
|
|
4944
|
+
} else if (isEol(ch)) {
|
|
4945
|
+
captureSegment(state, captureStart, captureEnd, true);
|
|
4946
|
+
writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
|
|
4947
|
+
captureStart = captureEnd = state.position;
|
|
4948
|
+
} else if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
4949
|
+
throwError(state, "unexpected end of the document within a double quoted scalar");
|
|
4950
|
+
} else {
|
|
4951
|
+
state.position++;
|
|
4952
|
+
if (!isWhiteSpace(ch)) {
|
|
4953
|
+
captureEnd = state.position;
|
|
5207
4954
|
}
|
|
5208
|
-
} else if (PATTERN_NON_PRINTABLE.test(_result)) {
|
|
5209
|
-
throwError(state, "the stream contains non-printable characters");
|
|
5210
4955
|
}
|
|
5211
|
-
state.result += _result;
|
|
5212
4956
|
}
|
|
4957
|
+
throwError(state, "unexpected end of the stream within a double quoted scalar");
|
|
5213
4958
|
}
|
|
5214
|
-
function
|
|
5215
|
-
|
|
5216
|
-
|
|
4959
|
+
function readFlowCollection(state, nodeIndent) {
|
|
4960
|
+
let readNext = true;
|
|
4961
|
+
let _line;
|
|
4962
|
+
let _lineStart;
|
|
4963
|
+
let _pos;
|
|
4964
|
+
const _tag = state.tag;
|
|
4965
|
+
let _result;
|
|
4966
|
+
const _anchor = state.anchor;
|
|
4967
|
+
let terminator;
|
|
4968
|
+
let isPair;
|
|
4969
|
+
let isExplicitPair;
|
|
4970
|
+
let isMapping;
|
|
4971
|
+
const overridableKeys = /* @__PURE__ */ Object.create(null);
|
|
4972
|
+
let keyNode;
|
|
4973
|
+
let keyTag;
|
|
4974
|
+
let valueNode;
|
|
4975
|
+
let ch = state.input.charCodeAt(state.position);
|
|
4976
|
+
if (ch === 91) {
|
|
4977
|
+
terminator = 93;
|
|
4978
|
+
isMapping = false;
|
|
4979
|
+
_result = [];
|
|
4980
|
+
} else if (ch === 123) {
|
|
4981
|
+
terminator = 125;
|
|
4982
|
+
isMapping = true;
|
|
4983
|
+
_result = {};
|
|
4984
|
+
} else {
|
|
4985
|
+
return false;
|
|
5217
4986
|
}
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
4987
|
+
if (state.anchor !== null) {
|
|
4988
|
+
storeAnchor(state, state.anchor, _result);
|
|
4989
|
+
}
|
|
4990
|
+
ch = state.input.charCodeAt(++state.position);
|
|
4991
|
+
while (ch !== 0) {
|
|
4992
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
4993
|
+
ch = state.input.charCodeAt(state.position);
|
|
4994
|
+
if (ch === terminator) {
|
|
4995
|
+
state.position++;
|
|
4996
|
+
state.tag = _tag;
|
|
4997
|
+
state.anchor = _anchor;
|
|
4998
|
+
state.kind = isMapping ? "mapping" : "sequence";
|
|
4999
|
+
state.result = _result;
|
|
5000
|
+
return true;
|
|
5001
|
+
} else if (!readNext) {
|
|
5002
|
+
throwError(state, "missed comma between flow collection entries");
|
|
5003
|
+
} else if (ch === 44) {
|
|
5004
|
+
throwError(state, "expected the node content, but found ','");
|
|
5223
5005
|
}
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5006
|
+
keyTag = keyNode = valueNode = null;
|
|
5007
|
+
isPair = isExplicitPair = false;
|
|
5008
|
+
if (ch === 63) {
|
|
5009
|
+
const following = state.input.charCodeAt(state.position + 1);
|
|
5010
|
+
if (isWsOrEol(following)) {
|
|
5011
|
+
isPair = isExplicitPair = true;
|
|
5012
|
+
state.position++;
|
|
5013
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
5014
|
+
}
|
|
5015
|
+
}
|
|
5016
|
+
_line = state.line;
|
|
5017
|
+
_lineStart = state.lineStart;
|
|
5018
|
+
_pos = state.position;
|
|
5019
|
+
composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
|
5020
|
+
keyTag = state.tag;
|
|
5021
|
+
keyNode = state.result;
|
|
5022
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
5023
|
+
ch = state.input.charCodeAt(state.position);
|
|
5024
|
+
if ((isExplicitPair || state.line === _line) && ch === 58) {
|
|
5025
|
+
isPair = true;
|
|
5026
|
+
ch = state.input.charCodeAt(++state.position);
|
|
5027
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
5028
|
+
composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
|
5029
|
+
valueNode = state.result;
|
|
5030
|
+
}
|
|
5031
|
+
if (isMapping) {
|
|
5032
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos);
|
|
5033
|
+
} else if (isPair) {
|
|
5034
|
+
_result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos));
|
|
5035
|
+
} else {
|
|
5036
|
+
_result.push(keyNode);
|
|
5037
|
+
}
|
|
5038
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
5039
|
+
ch = state.input.charCodeAt(state.position);
|
|
5040
|
+
if (ch === 44) {
|
|
5041
|
+
readNext = true;
|
|
5042
|
+
ch = state.input.charCodeAt(++state.position);
|
|
5043
|
+
} else {
|
|
5044
|
+
readNext = false;
|
|
5227
5045
|
}
|
|
5228
5046
|
}
|
|
5047
|
+
throwError(state, "unexpected end of the stream within a flow collection");
|
|
5229
5048
|
}
|
|
5230
|
-
function
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
|
|
5237
|
-
|
|
5238
|
-
|
|
5049
|
+
function readBlockScalar(state, nodeIndent) {
|
|
5050
|
+
let folding;
|
|
5051
|
+
let chomping = CHOMPING_CLIP;
|
|
5052
|
+
let didReadContent = false;
|
|
5053
|
+
let detectedIndent = false;
|
|
5054
|
+
let textIndent = nodeIndent;
|
|
5055
|
+
let emptyLines = 0;
|
|
5056
|
+
let atMoreIndented = false;
|
|
5057
|
+
let tmp;
|
|
5058
|
+
let ch = state.input.charCodeAt(state.position);
|
|
5059
|
+
if (ch === 124) {
|
|
5060
|
+
folding = false;
|
|
5061
|
+
} else if (ch === 62) {
|
|
5062
|
+
folding = true;
|
|
5063
|
+
} else {
|
|
5064
|
+
return false;
|
|
5065
|
+
}
|
|
5066
|
+
state.kind = "scalar";
|
|
5067
|
+
state.result = "";
|
|
5068
|
+
while (ch !== 0) {
|
|
5069
|
+
ch = state.input.charCodeAt(++state.position);
|
|
5070
|
+
if (ch === 43 || ch === 45) {
|
|
5071
|
+
if (CHOMPING_CLIP === chomping) {
|
|
5072
|
+
chomping = ch === 43 ? CHOMPING_KEEP : CHOMPING_STRIP;
|
|
5073
|
+
} else {
|
|
5074
|
+
throwError(state, "repeat of a chomping mode identifier");
|
|
5239
5075
|
}
|
|
5240
|
-
}
|
|
5241
|
-
|
|
5242
|
-
|
|
5243
|
-
|
|
5244
|
-
|
|
5245
|
-
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
}
|
|
5249
|
-
if (keyTag === "tag:yaml.org,2002:merge") {
|
|
5250
|
-
if (Array.isArray(valueNode)) {
|
|
5251
|
-
for (let index = 0, quantity = valueNode.length;index < quantity; index += 1) {
|
|
5252
|
-
mergeMappings(state, _result, valueNode[index], overridableKeys);
|
|
5076
|
+
} else if ((tmp = fromDecimalCode(ch)) >= 0) {
|
|
5077
|
+
if (tmp === 0) {
|
|
5078
|
+
throwError(state, "bad explicit indentation width of a block scalar; it cannot be less than one");
|
|
5079
|
+
} else if (!detectedIndent) {
|
|
5080
|
+
textIndent = nodeIndent + tmp - 1;
|
|
5081
|
+
detectedIndent = true;
|
|
5082
|
+
} else {
|
|
5083
|
+
throwError(state, "repeat of an indentation width identifier");
|
|
5253
5084
|
}
|
|
5254
5085
|
} else {
|
|
5255
|
-
|
|
5256
|
-
}
|
|
5257
|
-
} else {
|
|
5258
|
-
if (!state.json && !_hasOwnProperty.call(overridableKeys, keyNode) && _hasOwnProperty.call(_result, keyNode)) {
|
|
5259
|
-
state.line = startLine || state.line;
|
|
5260
|
-
state.lineStart = startLineStart || state.lineStart;
|
|
5261
|
-
state.position = startPos || state.position;
|
|
5262
|
-
throwError(state, "duplicated mapping key");
|
|
5086
|
+
break;
|
|
5263
5087
|
}
|
|
5264
|
-
setProperty(_result, keyNode, valueNode);
|
|
5265
|
-
delete overridableKeys[keyNode];
|
|
5266
5088
|
}
|
|
5267
|
-
|
|
5268
|
-
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
if (state.input.charCodeAt(state.position) === 10) {
|
|
5276
|
-
state.position++;
|
|
5089
|
+
if (isWhiteSpace(ch)) {
|
|
5090
|
+
do {
|
|
5091
|
+
ch = state.input.charCodeAt(++state.position);
|
|
5092
|
+
} while (isWhiteSpace(ch));
|
|
5093
|
+
if (ch === 35) {
|
|
5094
|
+
do {
|
|
5095
|
+
ch = state.input.charCodeAt(++state.position);
|
|
5096
|
+
} while (!isEol(ch) && ch !== 0);
|
|
5277
5097
|
}
|
|
5278
|
-
} else {
|
|
5279
|
-
throwError(state, "a line break is expected");
|
|
5280
5098
|
}
|
|
5281
|
-
state.line += 1;
|
|
5282
|
-
state.lineStart = state.position;
|
|
5283
|
-
state.firstTabInLine = -1;
|
|
5284
|
-
}
|
|
5285
|
-
function skipSeparationSpace(state, allowComments, checkIndent) {
|
|
5286
|
-
let lineBreaks = 0;
|
|
5287
|
-
let ch = state.input.charCodeAt(state.position);
|
|
5288
5099
|
while (ch !== 0) {
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
|
|
5100
|
+
readLineBreak(state);
|
|
5101
|
+
state.lineIndent = 0;
|
|
5102
|
+
ch = state.input.charCodeAt(state.position);
|
|
5103
|
+
while ((!detectedIndent || state.lineIndent < textIndent) && ch === 32) {
|
|
5104
|
+
state.lineIndent++;
|
|
5293
5105
|
ch = state.input.charCodeAt(++state.position);
|
|
5294
5106
|
}
|
|
5295
|
-
if (
|
|
5296
|
-
|
|
5297
|
-
ch = state.input.charCodeAt(++state.position);
|
|
5298
|
-
} while (ch !== 10 && ch !== 13 && ch !== 0);
|
|
5107
|
+
if (!detectedIndent && state.lineIndent > textIndent) {
|
|
5108
|
+
textIndent = state.lineIndent;
|
|
5299
5109
|
}
|
|
5300
5110
|
if (isEol(ch)) {
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5111
|
+
emptyLines++;
|
|
5112
|
+
continue;
|
|
5113
|
+
}
|
|
5114
|
+
if (!detectedIndent && textIndent === 0) {
|
|
5115
|
+
throwError(state, "missing indentation for block scalar");
|
|
5116
|
+
}
|
|
5117
|
+
if (state.lineIndent < textIndent) {
|
|
5118
|
+
if (chomping === CHOMPING_KEEP) {
|
|
5119
|
+
state.result += common2.repeat(`
|
|
5120
|
+
`, didReadContent ? 1 + emptyLines : emptyLines);
|
|
5121
|
+
} else if (chomping === CHOMPING_CLIP) {
|
|
5122
|
+
if (didReadContent) {
|
|
5123
|
+
state.result += `
|
|
5124
|
+
`;
|
|
5125
|
+
}
|
|
5308
5126
|
}
|
|
5309
|
-
} else {
|
|
5310
5127
|
break;
|
|
5311
5128
|
}
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
|
|
5129
|
+
if (folding) {
|
|
5130
|
+
if (isWhiteSpace(ch)) {
|
|
5131
|
+
atMoreIndented = true;
|
|
5132
|
+
state.result += common2.repeat(`
|
|
5133
|
+
`, didReadContent ? 1 + emptyLines : emptyLines);
|
|
5134
|
+
} else if (atMoreIndented) {
|
|
5135
|
+
atMoreIndented = false;
|
|
5136
|
+
state.result += common2.repeat(`
|
|
5137
|
+
`, emptyLines + 1);
|
|
5138
|
+
} else if (emptyLines === 0) {
|
|
5139
|
+
if (didReadContent) {
|
|
5140
|
+
state.result += " ";
|
|
5141
|
+
}
|
|
5142
|
+
} else {
|
|
5143
|
+
state.result += common2.repeat(`
|
|
5144
|
+
`, emptyLines);
|
|
5145
|
+
}
|
|
5146
|
+
} else {
|
|
5147
|
+
state.result += common2.repeat(`
|
|
5148
|
+
`, didReadContent ? 1 + emptyLines : emptyLines);
|
|
5326
5149
|
}
|
|
5150
|
+
didReadContent = true;
|
|
5151
|
+
detectedIndent = true;
|
|
5152
|
+
emptyLines = 0;
|
|
5153
|
+
const captureStart = state.position;
|
|
5154
|
+
while (!isEol(ch) && ch !== 0) {
|
|
5155
|
+
ch = state.input.charCodeAt(++state.position);
|
|
5156
|
+
}
|
|
5157
|
+
captureSegment(state, captureStart, state.position, false);
|
|
5327
5158
|
}
|
|
5328
|
-
return
|
|
5329
|
-
}
|
|
5330
|
-
function writeFoldedLines(state, count) {
|
|
5331
|
-
if (count === 1) {
|
|
5332
|
-
state.result += " ";
|
|
5333
|
-
} else if (count > 1) {
|
|
5334
|
-
state.result += common2.repeat(`
|
|
5335
|
-
`, count - 1);
|
|
5336
|
-
}
|
|
5159
|
+
return true;
|
|
5337
5160
|
}
|
|
5338
|
-
function
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
let
|
|
5343
|
-
|
|
5344
|
-
let _lineIndent;
|
|
5345
|
-
const _kind = state.kind;
|
|
5346
|
-
const _result = state.result;
|
|
5347
|
-
let ch = state.input.charCodeAt(state.position);
|
|
5348
|
-
if (isWsOrEol(ch) || isFlowIndicator(ch) || ch === 35 || ch === 38 || ch === 42 || ch === 33 || ch === 124 || ch === 62 || ch === 39 || ch === 34 || ch === 37 || ch === 64 || ch === 96) {
|
|
5161
|
+
function readBlockSequence(state, nodeIndent) {
|
|
5162
|
+
const _tag = state.tag;
|
|
5163
|
+
const _anchor = state.anchor;
|
|
5164
|
+
const _result = [];
|
|
5165
|
+
let detected = false;
|
|
5166
|
+
if (state.firstTabInLine !== -1)
|
|
5349
5167
|
return false;
|
|
5168
|
+
if (state.anchor !== null) {
|
|
5169
|
+
storeAnchor(state, state.anchor, _result);
|
|
5350
5170
|
}
|
|
5351
|
-
|
|
5352
|
-
const following = state.input.charCodeAt(state.position + 1);
|
|
5353
|
-
if (isWsOrEol(following) || withinFlowCollection && isFlowIndicator(following)) {
|
|
5354
|
-
return false;
|
|
5355
|
-
}
|
|
5356
|
-
}
|
|
5357
|
-
state.kind = "scalar";
|
|
5358
|
-
state.result = "";
|
|
5359
|
-
captureStart = captureEnd = state.position;
|
|
5360
|
-
hasPendingContent = false;
|
|
5171
|
+
let ch = state.input.charCodeAt(state.position);
|
|
5361
5172
|
while (ch !== 0) {
|
|
5362
|
-
if (
|
|
5363
|
-
|
|
5364
|
-
|
|
5365
|
-
|
|
5366
|
-
|
|
5367
|
-
} else if (ch === 35) {
|
|
5368
|
-
const preceding = state.input.charCodeAt(state.position - 1);
|
|
5369
|
-
if (isWsOrEol(preceding)) {
|
|
5370
|
-
break;
|
|
5371
|
-
}
|
|
5372
|
-
} else if (state.position === state.lineStart && testDocumentSeparator(state) || withinFlowCollection && isFlowIndicator(ch)) {
|
|
5173
|
+
if (state.firstTabInLine !== -1) {
|
|
5174
|
+
state.position = state.firstTabInLine;
|
|
5175
|
+
throwError(state, "tab characters must not be used in indentation");
|
|
5176
|
+
}
|
|
5177
|
+
if (ch !== 45) {
|
|
5373
5178
|
break;
|
|
5374
|
-
}
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
|
|
5378
|
-
|
|
5379
|
-
|
|
5380
|
-
|
|
5179
|
+
}
|
|
5180
|
+
const following = state.input.charCodeAt(state.position + 1);
|
|
5181
|
+
if (!isWsOrEol(following)) {
|
|
5182
|
+
break;
|
|
5183
|
+
}
|
|
5184
|
+
detected = true;
|
|
5185
|
+
state.position++;
|
|
5186
|
+
if (skipSeparationSpace(state, true, -1)) {
|
|
5187
|
+
if (state.lineIndent <= nodeIndent) {
|
|
5188
|
+
_result.push(null);
|
|
5381
5189
|
ch = state.input.charCodeAt(state.position);
|
|
5382
5190
|
continue;
|
|
5383
|
-
} else {
|
|
5384
|
-
state.position = captureEnd;
|
|
5385
|
-
state.line = _line;
|
|
5386
|
-
state.lineStart = _lineStart;
|
|
5387
|
-
state.lineIndent = _lineIndent;
|
|
5388
|
-
break;
|
|
5389
5191
|
}
|
|
5390
5192
|
}
|
|
5391
|
-
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
|
|
5395
|
-
|
|
5396
|
-
|
|
5397
|
-
|
|
5398
|
-
|
|
5193
|
+
const _line = state.line;
|
|
5194
|
+
composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
|
|
5195
|
+
_result.push(state.result);
|
|
5196
|
+
skipSeparationSpace(state, true, -1);
|
|
5197
|
+
ch = state.input.charCodeAt(state.position);
|
|
5198
|
+
if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
|
|
5199
|
+
throwError(state, "bad indentation of a sequence entry");
|
|
5200
|
+
} else if (state.lineIndent < nodeIndent) {
|
|
5201
|
+
break;
|
|
5399
5202
|
}
|
|
5400
|
-
ch = state.input.charCodeAt(++state.position);
|
|
5401
5203
|
}
|
|
5402
|
-
|
|
5403
|
-
|
|
5204
|
+
if (detected) {
|
|
5205
|
+
state.tag = _tag;
|
|
5206
|
+
state.anchor = _anchor;
|
|
5207
|
+
state.kind = "sequence";
|
|
5208
|
+
state.result = _result;
|
|
5404
5209
|
return true;
|
|
5405
5210
|
}
|
|
5406
|
-
state.kind = _kind;
|
|
5407
|
-
state.result = _result;
|
|
5408
5211
|
return false;
|
|
5409
5212
|
}
|
|
5410
|
-
function
|
|
5411
|
-
let
|
|
5412
|
-
let
|
|
5413
|
-
let
|
|
5414
|
-
|
|
5213
|
+
function readBlockMapping(state, nodeIndent, flowIndent) {
|
|
5214
|
+
let allowCompact;
|
|
5215
|
+
let _keyLine;
|
|
5216
|
+
let _keyLineStart;
|
|
5217
|
+
let _keyPos;
|
|
5218
|
+
const _tag = state.tag;
|
|
5219
|
+
const _anchor = state.anchor;
|
|
5220
|
+
const _result = {};
|
|
5221
|
+
const overridableKeys = /* @__PURE__ */ Object.create(null);
|
|
5222
|
+
let keyTag = null;
|
|
5223
|
+
let keyNode = null;
|
|
5224
|
+
let valueNode = null;
|
|
5225
|
+
let atExplicitKey = false;
|
|
5226
|
+
let detected = false;
|
|
5227
|
+
if (state.firstTabInLine !== -1)
|
|
5415
5228
|
return false;
|
|
5229
|
+
if (state.anchor !== null) {
|
|
5230
|
+
storeAnchor(state, state.anchor, _result);
|
|
5416
5231
|
}
|
|
5417
|
-
|
|
5418
|
-
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5424
|
-
|
|
5425
|
-
|
|
5426
|
-
|
|
5427
|
-
|
|
5428
|
-
|
|
5232
|
+
let ch = state.input.charCodeAt(state.position);
|
|
5233
|
+
while (ch !== 0) {
|
|
5234
|
+
if (!atExplicitKey && state.firstTabInLine !== -1) {
|
|
5235
|
+
state.position = state.firstTabInLine;
|
|
5236
|
+
throwError(state, "tab characters must not be used in indentation");
|
|
5237
|
+
}
|
|
5238
|
+
const following = state.input.charCodeAt(state.position + 1);
|
|
5239
|
+
const _line = state.line;
|
|
5240
|
+
if ((ch === 63 || ch === 58) && isWsOrEol(following)) {
|
|
5241
|
+
if (ch === 63) {
|
|
5242
|
+
if (atExplicitKey) {
|
|
5243
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
|
5244
|
+
keyTag = keyNode = valueNode = null;
|
|
5245
|
+
}
|
|
5246
|
+
detected = true;
|
|
5247
|
+
atExplicitKey = true;
|
|
5248
|
+
allowCompact = true;
|
|
5249
|
+
} else if (atExplicitKey) {
|
|
5250
|
+
atExplicitKey = false;
|
|
5251
|
+
allowCompact = true;
|
|
5429
5252
|
} else {
|
|
5430
|
-
|
|
5253
|
+
throwError(state, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");
|
|
5431
5254
|
}
|
|
5432
|
-
|
|
5433
|
-
|
|
5434
|
-
writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
|
|
5435
|
-
captureStart = captureEnd = state.position;
|
|
5436
|
-
} else if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
5437
|
-
throwError(state, "unexpected end of the document within a single quoted scalar");
|
|
5255
|
+
state.position += 1;
|
|
5256
|
+
ch = following;
|
|
5438
5257
|
} else {
|
|
5439
|
-
state.
|
|
5440
|
-
|
|
5441
|
-
|
|
5258
|
+
_keyLine = state.line;
|
|
5259
|
+
_keyLineStart = state.lineStart;
|
|
5260
|
+
_keyPos = state.position;
|
|
5261
|
+
if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
|
|
5262
|
+
break;
|
|
5442
5263
|
}
|
|
5443
|
-
|
|
5444
|
-
|
|
5445
|
-
|
|
5446
|
-
}
|
|
5447
|
-
function readDoubleQuotedScalar(state, nodeIndent) {
|
|
5448
|
-
let captureStart;
|
|
5449
|
-
let captureEnd;
|
|
5450
|
-
let tmp;
|
|
5451
|
-
let ch = state.input.charCodeAt(state.position);
|
|
5452
|
-
if (ch !== 34) {
|
|
5453
|
-
return false;
|
|
5454
|
-
}
|
|
5455
|
-
state.kind = "scalar";
|
|
5456
|
-
state.result = "";
|
|
5457
|
-
state.position++;
|
|
5458
|
-
captureStart = captureEnd = state.position;
|
|
5459
|
-
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
5460
|
-
if (ch === 34) {
|
|
5461
|
-
captureSegment(state, captureStart, state.position, true);
|
|
5462
|
-
state.position++;
|
|
5463
|
-
return true;
|
|
5464
|
-
} else if (ch === 92) {
|
|
5465
|
-
captureSegment(state, captureStart, state.position, true);
|
|
5466
|
-
ch = state.input.charCodeAt(++state.position);
|
|
5467
|
-
if (isEol(ch)) {
|
|
5468
|
-
skipSeparationSpace(state, false, nodeIndent);
|
|
5469
|
-
} else if (ch < 256 && simpleEscapeCheck[ch]) {
|
|
5470
|
-
state.result += simpleEscapeMap[ch];
|
|
5471
|
-
state.position++;
|
|
5472
|
-
} else if ((tmp = escapedHexLen(ch)) > 0) {
|
|
5473
|
-
let hexLength = tmp;
|
|
5474
|
-
let hexResult = 0;
|
|
5475
|
-
for (;hexLength > 0; hexLength--) {
|
|
5264
|
+
if (state.line === _line) {
|
|
5265
|
+
ch = state.input.charCodeAt(state.position);
|
|
5266
|
+
while (isWhiteSpace(ch)) {
|
|
5476
5267
|
ch = state.input.charCodeAt(++state.position);
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5268
|
+
}
|
|
5269
|
+
if (ch === 58) {
|
|
5270
|
+
ch = state.input.charCodeAt(++state.position);
|
|
5271
|
+
if (!isWsOrEol(ch)) {
|
|
5272
|
+
throwError(state, "a whitespace character is expected after the key-value separator within a block mapping");
|
|
5273
|
+
}
|
|
5274
|
+
if (atExplicitKey) {
|
|
5275
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
|
5276
|
+
keyTag = keyNode = valueNode = null;
|
|
5481
5277
|
}
|
|
5278
|
+
detected = true;
|
|
5279
|
+
atExplicitKey = false;
|
|
5280
|
+
allowCompact = false;
|
|
5281
|
+
keyTag = state.tag;
|
|
5282
|
+
keyNode = state.result;
|
|
5283
|
+
} else if (detected) {
|
|
5284
|
+
throwError(state, "can not read an implicit mapping pair; a colon is missed");
|
|
5285
|
+
} else {
|
|
5286
|
+
state.tag = _tag;
|
|
5287
|
+
state.anchor = _anchor;
|
|
5288
|
+
return true;
|
|
5482
5289
|
}
|
|
5483
|
-
|
|
5484
|
-
state
|
|
5290
|
+
} else if (detected) {
|
|
5291
|
+
throwError(state, "can not read a block mapping entry; a multiline key may not be an implicit key");
|
|
5485
5292
|
} else {
|
|
5486
|
-
|
|
5293
|
+
state.tag = _tag;
|
|
5294
|
+
state.anchor = _anchor;
|
|
5295
|
+
return true;
|
|
5487
5296
|
}
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
5297
|
+
}
|
|
5298
|
+
if (state.line === _line || state.lineIndent > nodeIndent) {
|
|
5299
|
+
if (atExplicitKey) {
|
|
5300
|
+
_keyLine = state.line;
|
|
5301
|
+
_keyLineStart = state.lineStart;
|
|
5302
|
+
_keyPos = state.position;
|
|
5303
|
+
}
|
|
5304
|
+
if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
|
|
5305
|
+
if (atExplicitKey) {
|
|
5306
|
+
keyNode = state.result;
|
|
5307
|
+
} else {
|
|
5308
|
+
valueNode = state.result;
|
|
5309
|
+
}
|
|
5310
|
+
}
|
|
5311
|
+
if (!atExplicitKey) {
|
|
5312
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos);
|
|
5313
|
+
keyTag = keyNode = valueNode = null;
|
|
5499
5314
|
}
|
|
5315
|
+
skipSeparationSpace(state, true, -1);
|
|
5316
|
+
ch = state.input.charCodeAt(state.position);
|
|
5317
|
+
}
|
|
5318
|
+
if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
|
|
5319
|
+
throwError(state, "bad indentation of a mapping entry");
|
|
5320
|
+
} else if (state.lineIndent < nodeIndent) {
|
|
5321
|
+
break;
|
|
5500
5322
|
}
|
|
5501
5323
|
}
|
|
5502
|
-
|
|
5324
|
+
if (atExplicitKey) {
|
|
5325
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
|
5326
|
+
}
|
|
5327
|
+
if (detected) {
|
|
5328
|
+
state.tag = _tag;
|
|
5329
|
+
state.anchor = _anchor;
|
|
5330
|
+
state.kind = "mapping";
|
|
5331
|
+
state.result = _result;
|
|
5332
|
+
}
|
|
5333
|
+
return detected;
|
|
5503
5334
|
}
|
|
5504
|
-
function
|
|
5505
|
-
let
|
|
5506
|
-
let
|
|
5507
|
-
let
|
|
5508
|
-
let
|
|
5509
|
-
const _tag = state.tag;
|
|
5510
|
-
let _result;
|
|
5511
|
-
const _anchor = state.anchor;
|
|
5512
|
-
let terminator;
|
|
5513
|
-
let isPair;
|
|
5514
|
-
let isExplicitPair;
|
|
5515
|
-
let isMapping;
|
|
5516
|
-
const overridableKeys = /* @__PURE__ */ Object.create(null);
|
|
5517
|
-
let keyNode;
|
|
5518
|
-
let keyTag;
|
|
5519
|
-
let valueNode;
|
|
5335
|
+
function readTagProperty(state) {
|
|
5336
|
+
let isVerbatim = false;
|
|
5337
|
+
let isNamed = false;
|
|
5338
|
+
let tagHandle;
|
|
5339
|
+
let tagName;
|
|
5520
5340
|
let ch = state.input.charCodeAt(state.position);
|
|
5521
|
-
if (ch
|
|
5522
|
-
terminator = 93;
|
|
5523
|
-
isMapping = false;
|
|
5524
|
-
_result = [];
|
|
5525
|
-
} else if (ch === 123) {
|
|
5526
|
-
terminator = 125;
|
|
5527
|
-
isMapping = true;
|
|
5528
|
-
_result = {};
|
|
5529
|
-
} else {
|
|
5341
|
+
if (ch !== 33)
|
|
5530
5342
|
return false;
|
|
5531
|
-
|
|
5532
|
-
|
|
5533
|
-
storeAnchor(state, state.anchor, _result);
|
|
5343
|
+
if (state.tag !== null) {
|
|
5344
|
+
throwError(state, "duplication of a tag property");
|
|
5534
5345
|
}
|
|
5535
5346
|
ch = state.input.charCodeAt(++state.position);
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
ch = state.input.charCodeAt(state.position);
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
}
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
if (ch === 63) {
|
|
5554
|
-
const following = state.input.charCodeAt(state.position + 1);
|
|
5555
|
-
if (isWsOrEol(following)) {
|
|
5556
|
-
isPair = isExplicitPair = true;
|
|
5557
|
-
state.position++;
|
|
5558
|
-
skipSeparationSpace(state, true, nodeIndent);
|
|
5559
|
-
}
|
|
5560
|
-
}
|
|
5561
|
-
_line = state.line;
|
|
5562
|
-
_lineStart = state.lineStart;
|
|
5563
|
-
_pos = state.position;
|
|
5564
|
-
composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
|
5565
|
-
keyTag = state.tag;
|
|
5566
|
-
keyNode = state.result;
|
|
5567
|
-
skipSeparationSpace(state, true, nodeIndent);
|
|
5568
|
-
ch = state.input.charCodeAt(state.position);
|
|
5569
|
-
if ((isExplicitPair || state.line === _line) && ch === 58) {
|
|
5570
|
-
isPair = true;
|
|
5347
|
+
if (ch === 60) {
|
|
5348
|
+
isVerbatim = true;
|
|
5349
|
+
ch = state.input.charCodeAt(++state.position);
|
|
5350
|
+
} else if (ch === 33) {
|
|
5351
|
+
isNamed = true;
|
|
5352
|
+
tagHandle = "!!";
|
|
5353
|
+
ch = state.input.charCodeAt(++state.position);
|
|
5354
|
+
} else {
|
|
5355
|
+
tagHandle = "!";
|
|
5356
|
+
}
|
|
5357
|
+
let _position = state.position;
|
|
5358
|
+
if (isVerbatim) {
|
|
5359
|
+
do {
|
|
5360
|
+
ch = state.input.charCodeAt(++state.position);
|
|
5361
|
+
} while (ch !== 0 && ch !== 62);
|
|
5362
|
+
if (state.position < state.length) {
|
|
5363
|
+
tagName = state.input.slice(_position, state.position);
|
|
5571
5364
|
ch = state.input.charCodeAt(++state.position);
|
|
5572
|
-
skipSeparationSpace(state, true, nodeIndent);
|
|
5573
|
-
composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
|
5574
|
-
valueNode = state.result;
|
|
5575
|
-
}
|
|
5576
|
-
if (isMapping) {
|
|
5577
|
-
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos);
|
|
5578
|
-
} else if (isPair) {
|
|
5579
|
-
_result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos));
|
|
5580
5365
|
} else {
|
|
5581
|
-
|
|
5366
|
+
throwError(state, "unexpected end of the stream within a verbatim tag");
|
|
5582
5367
|
}
|
|
5583
|
-
|
|
5584
|
-
ch
|
|
5585
|
-
|
|
5586
|
-
|
|
5368
|
+
} else {
|
|
5369
|
+
while (ch !== 0 && !isWsOrEol(ch)) {
|
|
5370
|
+
if (ch === 33) {
|
|
5371
|
+
if (!isNamed) {
|
|
5372
|
+
tagHandle = state.input.slice(_position - 1, state.position + 1);
|
|
5373
|
+
if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
|
|
5374
|
+
throwError(state, "named tag handle cannot contain such characters");
|
|
5375
|
+
}
|
|
5376
|
+
isNamed = true;
|
|
5377
|
+
_position = state.position + 1;
|
|
5378
|
+
} else {
|
|
5379
|
+
throwError(state, "tag suffix cannot contain exclamation marks");
|
|
5380
|
+
}
|
|
5381
|
+
}
|
|
5587
5382
|
ch = state.input.charCodeAt(++state.position);
|
|
5588
|
-
}
|
|
5589
|
-
|
|
5383
|
+
}
|
|
5384
|
+
tagName = state.input.slice(_position, state.position);
|
|
5385
|
+
if (PATTERN_FLOW_INDICATORS.test(tagName)) {
|
|
5386
|
+
throwError(state, "tag suffix cannot contain flow indicator characters");
|
|
5590
5387
|
}
|
|
5591
5388
|
}
|
|
5592
|
-
|
|
5389
|
+
if (tagName && !PATTERN_TAG_URI.test(tagName)) {
|
|
5390
|
+
throwError(state, "tag name cannot contain such characters: " + tagName);
|
|
5391
|
+
}
|
|
5392
|
+
try {
|
|
5393
|
+
tagName = decodeURIComponent(tagName);
|
|
5394
|
+
} catch (err) {
|
|
5395
|
+
throwError(state, "tag name is malformed: " + tagName);
|
|
5396
|
+
}
|
|
5397
|
+
if (isVerbatim) {
|
|
5398
|
+
state.tag = tagName;
|
|
5399
|
+
} else if (_hasOwnProperty.call(state.tagMap, tagHandle)) {
|
|
5400
|
+
state.tag = state.tagMap[tagHandle] + tagName;
|
|
5401
|
+
} else if (tagHandle === "!") {
|
|
5402
|
+
state.tag = "!" + tagName;
|
|
5403
|
+
} else if (tagHandle === "!!") {
|
|
5404
|
+
state.tag = "tag:yaml.org,2002:" + tagName;
|
|
5405
|
+
} else {
|
|
5406
|
+
throwError(state, 'undeclared tag handle "' + tagHandle + '"');
|
|
5407
|
+
}
|
|
5408
|
+
return true;
|
|
5593
5409
|
}
|
|
5594
|
-
function
|
|
5595
|
-
let folding;
|
|
5596
|
-
let chomping = CHOMPING_CLIP;
|
|
5597
|
-
let didReadContent = false;
|
|
5598
|
-
let detectedIndent = false;
|
|
5599
|
-
let textIndent = nodeIndent;
|
|
5600
|
-
let emptyLines = 0;
|
|
5601
|
-
let atMoreIndented = false;
|
|
5602
|
-
let tmp;
|
|
5410
|
+
function readAnchorProperty(state) {
|
|
5603
5411
|
let ch = state.input.charCodeAt(state.position);
|
|
5604
|
-
if (ch
|
|
5605
|
-
folding = false;
|
|
5606
|
-
} else if (ch === 62) {
|
|
5607
|
-
folding = true;
|
|
5608
|
-
} else {
|
|
5412
|
+
if (ch !== 38)
|
|
5609
5413
|
return false;
|
|
5414
|
+
if (state.anchor !== null) {
|
|
5415
|
+
throwError(state, "duplication of an anchor property");
|
|
5610
5416
|
}
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
while (ch !== 0) {
|
|
5417
|
+
ch = state.input.charCodeAt(++state.position);
|
|
5418
|
+
const _position = state.position;
|
|
5419
|
+
while (ch !== 0 && !isWsOrEol(ch) && !isFlowIndicator(ch)) {
|
|
5614
5420
|
ch = state.input.charCodeAt(++state.position);
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
|
|
5618
|
-
|
|
5619
|
-
|
|
5421
|
+
}
|
|
5422
|
+
if (state.position === _position) {
|
|
5423
|
+
throwError(state, "name of an anchor node must contain at least one character");
|
|
5424
|
+
}
|
|
5425
|
+
state.anchor = state.input.slice(_position, state.position);
|
|
5426
|
+
return true;
|
|
5427
|
+
}
|
|
5428
|
+
function readAlias(state) {
|
|
5429
|
+
let ch = state.input.charCodeAt(state.position);
|
|
5430
|
+
if (ch !== 42)
|
|
5431
|
+
return false;
|
|
5432
|
+
ch = state.input.charCodeAt(++state.position);
|
|
5433
|
+
const _position = state.position;
|
|
5434
|
+
while (ch !== 0 && !isWsOrEol(ch) && !isFlowIndicator(ch)) {
|
|
5435
|
+
ch = state.input.charCodeAt(++state.position);
|
|
5436
|
+
}
|
|
5437
|
+
if (state.position === _position) {
|
|
5438
|
+
throwError(state, "name of an alias node must contain at least one character");
|
|
5439
|
+
}
|
|
5440
|
+
const alias = state.input.slice(_position, state.position);
|
|
5441
|
+
if (!_hasOwnProperty.call(state.anchorMap, alias)) {
|
|
5442
|
+
throwError(state, 'unidentified alias "' + alias + '"');
|
|
5443
|
+
}
|
|
5444
|
+
state.result = state.anchorMap[alias];
|
|
5445
|
+
skipSeparationSpace(state, true, -1);
|
|
5446
|
+
return true;
|
|
5447
|
+
}
|
|
5448
|
+
function tryReadBlockMappingFromProperty(state, propertyStart, nodeIndent, flowIndent) {
|
|
5449
|
+
const fallbackState = snapshotState(state);
|
|
5450
|
+
beginAnchorTransaction(state);
|
|
5451
|
+
restoreState(state, propertyStart);
|
|
5452
|
+
state.tag = null;
|
|
5453
|
+
state.anchor = null;
|
|
5454
|
+
state.kind = null;
|
|
5455
|
+
state.result = null;
|
|
5456
|
+
if (readBlockMapping(state, nodeIndent, flowIndent) && state.kind === "mapping") {
|
|
5457
|
+
commitAnchorTransaction(state);
|
|
5458
|
+
return true;
|
|
5459
|
+
}
|
|
5460
|
+
rollbackAnchorTransaction(state);
|
|
5461
|
+
restoreState(state, fallbackState);
|
|
5462
|
+
return false;
|
|
5463
|
+
}
|
|
5464
|
+
function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
|
|
5465
|
+
let allowBlockScalars;
|
|
5466
|
+
let allowBlockCollections;
|
|
5467
|
+
let indentStatus = 1;
|
|
5468
|
+
let atNewLine = false;
|
|
5469
|
+
let hasContent = false;
|
|
5470
|
+
let propertyStart = null;
|
|
5471
|
+
let type2;
|
|
5472
|
+
let flowIndent;
|
|
5473
|
+
let blockIndent;
|
|
5474
|
+
if (state.depth >= state.maxDepth) {
|
|
5475
|
+
throwError(state, "nesting exceeded maxDepth (" + state.maxDepth + ")");
|
|
5476
|
+
}
|
|
5477
|
+
state.depth += 1;
|
|
5478
|
+
if (state.listener !== null) {
|
|
5479
|
+
state.listener("open", state);
|
|
5480
|
+
}
|
|
5481
|
+
state.tag = null;
|
|
5482
|
+
state.anchor = null;
|
|
5483
|
+
state.kind = null;
|
|
5484
|
+
state.result = null;
|
|
5485
|
+
const allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext;
|
|
5486
|
+
if (allowToSeek) {
|
|
5487
|
+
if (skipSeparationSpace(state, true, -1)) {
|
|
5488
|
+
atNewLine = true;
|
|
5489
|
+
if (state.lineIndent > parentIndent) {
|
|
5490
|
+
indentStatus = 1;
|
|
5491
|
+
} else if (state.lineIndent === parentIndent) {
|
|
5492
|
+
indentStatus = 0;
|
|
5493
|
+
} else if (state.lineIndent < parentIndent) {
|
|
5494
|
+
indentStatus = -1;
|
|
5620
5495
|
}
|
|
5621
|
-
}
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
|
|
5626
|
-
|
|
5496
|
+
}
|
|
5497
|
+
}
|
|
5498
|
+
if (indentStatus === 1) {
|
|
5499
|
+
while (true) {
|
|
5500
|
+
const ch = state.input.charCodeAt(state.position);
|
|
5501
|
+
const propertyState = snapshotState(state);
|
|
5502
|
+
if (atNewLine && (ch === 33 && state.tag !== null || ch === 38 && state.anchor !== null)) {
|
|
5503
|
+
break;
|
|
5504
|
+
}
|
|
5505
|
+
if (!readTagProperty(state) && !readAnchorProperty(state)) {
|
|
5506
|
+
break;
|
|
5507
|
+
}
|
|
5508
|
+
if (propertyStart === null) {
|
|
5509
|
+
propertyStart = propertyState;
|
|
5510
|
+
}
|
|
5511
|
+
if (skipSeparationSpace(state, true, -1)) {
|
|
5512
|
+
atNewLine = true;
|
|
5513
|
+
allowBlockCollections = allowBlockStyles;
|
|
5514
|
+
if (state.lineIndent > parentIndent) {
|
|
5515
|
+
indentStatus = 1;
|
|
5516
|
+
} else if (state.lineIndent === parentIndent) {
|
|
5517
|
+
indentStatus = 0;
|
|
5518
|
+
} else if (state.lineIndent < parentIndent) {
|
|
5519
|
+
indentStatus = -1;
|
|
5520
|
+
}
|
|
5627
5521
|
} else {
|
|
5628
|
-
|
|
5522
|
+
allowBlockCollections = false;
|
|
5629
5523
|
}
|
|
5630
|
-
} else {
|
|
5631
|
-
break;
|
|
5632
5524
|
}
|
|
5633
5525
|
}
|
|
5634
|
-
if (
|
|
5635
|
-
|
|
5636
|
-
ch = state.input.charCodeAt(++state.position);
|
|
5637
|
-
} while (isWhiteSpace(ch));
|
|
5638
|
-
if (ch === 35) {
|
|
5639
|
-
do {
|
|
5640
|
-
ch = state.input.charCodeAt(++state.position);
|
|
5641
|
-
} while (!isEol(ch) && ch !== 0);
|
|
5642
|
-
}
|
|
5526
|
+
if (allowBlockCollections) {
|
|
5527
|
+
allowBlockCollections = atNewLine || allowCompact;
|
|
5643
5528
|
}
|
|
5644
|
-
|
|
5645
|
-
|
|
5646
|
-
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
state.lineIndent++;
|
|
5650
|
-
ch = state.input.charCodeAt(++state.position);
|
|
5529
|
+
if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
|
|
5530
|
+
if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
|
|
5531
|
+
flowIndent = parentIndent;
|
|
5532
|
+
} else {
|
|
5533
|
+
flowIndent = parentIndent + 1;
|
|
5651
5534
|
}
|
|
5652
|
-
|
|
5653
|
-
|
|
5535
|
+
blockIndent = state.position - state.lineStart;
|
|
5536
|
+
if (indentStatus === 1) {
|
|
5537
|
+
if (allowBlockCollections && (readBlockSequence(state, blockIndent) || readBlockMapping(state, blockIndent, flowIndent)) || readFlowCollection(state, flowIndent)) {
|
|
5538
|
+
hasContent = true;
|
|
5539
|
+
} else {
|
|
5540
|
+
const ch = state.input.charCodeAt(state.position);
|
|
5541
|
+
if (propertyStart !== null && allowBlockStyles && !allowBlockCollections && ch !== 124 && ch !== 62 && tryReadBlockMappingFromProperty(state, propertyStart, propertyStart.position - propertyStart.lineStart, flowIndent)) {
|
|
5542
|
+
hasContent = true;
|
|
5543
|
+
} else if (allowBlockScalars && readBlockScalar(state, flowIndent) || readSingleQuotedScalar(state, flowIndent) || readDoubleQuotedScalar(state, flowIndent)) {
|
|
5544
|
+
hasContent = true;
|
|
5545
|
+
} else if (readAlias(state)) {
|
|
5546
|
+
hasContent = true;
|
|
5547
|
+
if (state.tag !== null || state.anchor !== null) {
|
|
5548
|
+
throwError(state, "alias node should not have any properties");
|
|
5549
|
+
}
|
|
5550
|
+
} else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
|
|
5551
|
+
hasContent = true;
|
|
5552
|
+
if (state.tag === null) {
|
|
5553
|
+
state.tag = "?";
|
|
5554
|
+
}
|
|
5555
|
+
}
|
|
5556
|
+
if (state.anchor !== null) {
|
|
5557
|
+
storeAnchor(state, state.anchor, state.result);
|
|
5558
|
+
}
|
|
5559
|
+
}
|
|
5560
|
+
} else if (indentStatus === 0) {
|
|
5561
|
+
hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
|
|
5654
5562
|
}
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5563
|
+
}
|
|
5564
|
+
if (state.tag === null) {
|
|
5565
|
+
if (state.anchor !== null) {
|
|
5566
|
+
storeAnchor(state, state.anchor, state.result);
|
|
5658
5567
|
}
|
|
5659
|
-
|
|
5660
|
-
|
|
5568
|
+
} else if (state.tag === "?") {
|
|
5569
|
+
if (state.result !== null && state.kind !== "scalar") {
|
|
5570
|
+
throwError(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"');
|
|
5661
5571
|
}
|
|
5662
|
-
|
|
5663
|
-
|
|
5664
|
-
|
|
5665
|
-
|
|
5666
|
-
|
|
5667
|
-
if (
|
|
5668
|
-
state.result
|
|
5669
|
-
`;
|
|
5572
|
+
for (let typeIndex = 0, typeQuantity = state.implicitTypes.length;typeIndex < typeQuantity; typeIndex += 1) {
|
|
5573
|
+
type2 = state.implicitTypes[typeIndex];
|
|
5574
|
+
if (type2.resolve(state.result)) {
|
|
5575
|
+
state.result = type2.construct(state.result);
|
|
5576
|
+
state.tag = type2.tag;
|
|
5577
|
+
if (state.anchor !== null) {
|
|
5578
|
+
storeAnchor(state, state.anchor, state.result);
|
|
5670
5579
|
}
|
|
5580
|
+
break;
|
|
5671
5581
|
}
|
|
5672
|
-
break;
|
|
5673
5582
|
}
|
|
5674
|
-
|
|
5675
|
-
|
|
5676
|
-
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
|
|
5680
|
-
|
|
5681
|
-
state.
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
if (didReadContent) {
|
|
5685
|
-
state.result += " ";
|
|
5583
|
+
} else if (state.tag !== "!") {
|
|
5584
|
+
if (_hasOwnProperty.call(state.typeMap[state.kind || "fallback"], state.tag)) {
|
|
5585
|
+
type2 = state.typeMap[state.kind || "fallback"][state.tag];
|
|
5586
|
+
} else {
|
|
5587
|
+
type2 = null;
|
|
5588
|
+
const typeList = state.typeMap.multi[state.kind || "fallback"];
|
|
5589
|
+
for (let typeIndex = 0, typeQuantity = typeList.length;typeIndex < typeQuantity; typeIndex += 1) {
|
|
5590
|
+
if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) {
|
|
5591
|
+
type2 = typeList[typeIndex];
|
|
5592
|
+
break;
|
|
5686
5593
|
}
|
|
5687
|
-
} else {
|
|
5688
|
-
state.result += common2.repeat(`
|
|
5689
|
-
`, emptyLines);
|
|
5690
5594
|
}
|
|
5691
|
-
} else {
|
|
5692
|
-
state.result += common2.repeat(`
|
|
5693
|
-
`, didReadContent ? 1 + emptyLines : emptyLines);
|
|
5694
|
-
}
|
|
5695
|
-
didReadContent = true;
|
|
5696
|
-
detectedIndent = true;
|
|
5697
|
-
emptyLines = 0;
|
|
5698
|
-
const captureStart = state.position;
|
|
5699
|
-
while (!isEol(ch) && ch !== 0) {
|
|
5700
|
-
ch = state.input.charCodeAt(++state.position);
|
|
5701
|
-
}
|
|
5702
|
-
captureSegment(state, captureStart, state.position, false);
|
|
5703
|
-
}
|
|
5704
|
-
return true;
|
|
5705
|
-
}
|
|
5706
|
-
function readBlockSequence(state, nodeIndent) {
|
|
5707
|
-
const _tag = state.tag;
|
|
5708
|
-
const _anchor = state.anchor;
|
|
5709
|
-
const _result = [];
|
|
5710
|
-
let detected = false;
|
|
5711
|
-
if (state.firstTabInLine !== -1)
|
|
5712
|
-
return false;
|
|
5713
|
-
if (state.anchor !== null) {
|
|
5714
|
-
storeAnchor(state, state.anchor, _result);
|
|
5715
|
-
}
|
|
5716
|
-
let ch = state.input.charCodeAt(state.position);
|
|
5717
|
-
while (ch !== 0) {
|
|
5718
|
-
if (state.firstTabInLine !== -1) {
|
|
5719
|
-
state.position = state.firstTabInLine;
|
|
5720
|
-
throwError(state, "tab characters must not be used in indentation");
|
|
5721
5595
|
}
|
|
5722
|
-
if (
|
|
5723
|
-
|
|
5596
|
+
if (!type2) {
|
|
5597
|
+
throwError(state, "unknown tag !<" + state.tag + ">");
|
|
5724
5598
|
}
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
break;
|
|
5599
|
+
if (state.result !== null && type2.kind !== state.kind) {
|
|
5600
|
+
throwError(state, "unacceptable node kind for !<" + state.tag + '> tag; it should be "' + type2.kind + '", not "' + state.kind + '"');
|
|
5728
5601
|
}
|
|
5729
|
-
|
|
5730
|
-
|
|
5731
|
-
|
|
5732
|
-
|
|
5733
|
-
|
|
5734
|
-
|
|
5735
|
-
continue;
|
|
5602
|
+
if (!type2.resolve(state.result, state.tag)) {
|
|
5603
|
+
throwError(state, "cannot resolve a node with !<" + state.tag + "> explicit tag");
|
|
5604
|
+
} else {
|
|
5605
|
+
state.result = type2.construct(state.result, state.tag);
|
|
5606
|
+
if (state.anchor !== null) {
|
|
5607
|
+
storeAnchor(state, state.anchor, state.result);
|
|
5736
5608
|
}
|
|
5737
5609
|
}
|
|
5738
|
-
|
|
5739
|
-
|
|
5740
|
-
|
|
5610
|
+
}
|
|
5611
|
+
if (state.listener !== null) {
|
|
5612
|
+
state.listener("close", state);
|
|
5613
|
+
}
|
|
5614
|
+
state.depth -= 1;
|
|
5615
|
+
return state.tag !== null || state.anchor !== null || hasContent;
|
|
5616
|
+
}
|
|
5617
|
+
function readDocument(state) {
|
|
5618
|
+
const documentStart = state.position;
|
|
5619
|
+
let hasDirectives = false;
|
|
5620
|
+
let ch;
|
|
5621
|
+
state.version = null;
|
|
5622
|
+
state.checkLineBreaks = state.legacy;
|
|
5623
|
+
state.tagMap = /* @__PURE__ */ Object.create(null);
|
|
5624
|
+
state.anchorMap = /* @__PURE__ */ Object.create(null);
|
|
5625
|
+
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
5741
5626
|
skipSeparationSpace(state, true, -1);
|
|
5742
5627
|
ch = state.input.charCodeAt(state.position);
|
|
5743
|
-
if (
|
|
5744
|
-
throwError(state, "bad indentation of a sequence entry");
|
|
5745
|
-
} else if (state.lineIndent < nodeIndent) {
|
|
5628
|
+
if (state.lineIndent > 0 || ch !== 37) {
|
|
5746
5629
|
break;
|
|
5747
5630
|
}
|
|
5748
|
-
|
|
5749
|
-
|
|
5750
|
-
|
|
5751
|
-
|
|
5752
|
-
|
|
5753
|
-
state.result = _result;
|
|
5754
|
-
return true;
|
|
5755
|
-
}
|
|
5756
|
-
return false;
|
|
5757
|
-
}
|
|
5758
|
-
function readBlockMapping(state, nodeIndent, flowIndent) {
|
|
5759
|
-
let allowCompact;
|
|
5760
|
-
let _keyLine;
|
|
5761
|
-
let _keyLineStart;
|
|
5762
|
-
let _keyPos;
|
|
5763
|
-
const _tag = state.tag;
|
|
5764
|
-
const _anchor = state.anchor;
|
|
5765
|
-
const _result = {};
|
|
5766
|
-
const overridableKeys = /* @__PURE__ */ Object.create(null);
|
|
5767
|
-
let keyTag = null;
|
|
5768
|
-
let keyNode = null;
|
|
5769
|
-
let valueNode = null;
|
|
5770
|
-
let atExplicitKey = false;
|
|
5771
|
-
let detected = false;
|
|
5772
|
-
if (state.firstTabInLine !== -1)
|
|
5773
|
-
return false;
|
|
5774
|
-
if (state.anchor !== null) {
|
|
5775
|
-
storeAnchor(state, state.anchor, _result);
|
|
5776
|
-
}
|
|
5777
|
-
let ch = state.input.charCodeAt(state.position);
|
|
5778
|
-
while (ch !== 0) {
|
|
5779
|
-
if (!atExplicitKey && state.firstTabInLine !== -1) {
|
|
5780
|
-
state.position = state.firstTabInLine;
|
|
5781
|
-
throwError(state, "tab characters must not be used in indentation");
|
|
5631
|
+
hasDirectives = true;
|
|
5632
|
+
ch = state.input.charCodeAt(++state.position);
|
|
5633
|
+
let _position = state.position;
|
|
5634
|
+
while (ch !== 0 && !isWsOrEol(ch)) {
|
|
5635
|
+
ch = state.input.charCodeAt(++state.position);
|
|
5782
5636
|
}
|
|
5783
|
-
const
|
|
5784
|
-
const
|
|
5785
|
-
if (
|
|
5786
|
-
|
|
5787
|
-
if (atExplicitKey) {
|
|
5788
|
-
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
|
5789
|
-
keyTag = keyNode = valueNode = null;
|
|
5790
|
-
}
|
|
5791
|
-
detected = true;
|
|
5792
|
-
atExplicitKey = true;
|
|
5793
|
-
allowCompact = true;
|
|
5794
|
-
} else if (atExplicitKey) {
|
|
5795
|
-
atExplicitKey = false;
|
|
5796
|
-
allowCompact = true;
|
|
5797
|
-
} else {
|
|
5798
|
-
throwError(state, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");
|
|
5799
|
-
}
|
|
5800
|
-
state.position += 1;
|
|
5801
|
-
ch = following;
|
|
5802
|
-
} else {
|
|
5803
|
-
_keyLine = state.line;
|
|
5804
|
-
_keyLineStart = state.lineStart;
|
|
5805
|
-
_keyPos = state.position;
|
|
5806
|
-
if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
|
|
5807
|
-
break;
|
|
5808
|
-
}
|
|
5809
|
-
if (state.line === _line) {
|
|
5810
|
-
ch = state.input.charCodeAt(state.position);
|
|
5811
|
-
while (isWhiteSpace(ch)) {
|
|
5812
|
-
ch = state.input.charCodeAt(++state.position);
|
|
5813
|
-
}
|
|
5814
|
-
if (ch === 58) {
|
|
5815
|
-
ch = state.input.charCodeAt(++state.position);
|
|
5816
|
-
if (!isWsOrEol(ch)) {
|
|
5817
|
-
throwError(state, "a whitespace character is expected after the key-value separator within a block mapping");
|
|
5818
|
-
}
|
|
5819
|
-
if (atExplicitKey) {
|
|
5820
|
-
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
|
5821
|
-
keyTag = keyNode = valueNode = null;
|
|
5822
|
-
}
|
|
5823
|
-
detected = true;
|
|
5824
|
-
atExplicitKey = false;
|
|
5825
|
-
allowCompact = false;
|
|
5826
|
-
keyTag = state.tag;
|
|
5827
|
-
keyNode = state.result;
|
|
5828
|
-
} else if (detected) {
|
|
5829
|
-
throwError(state, "can not read an implicit mapping pair; a colon is missed");
|
|
5830
|
-
} else {
|
|
5831
|
-
state.tag = _tag;
|
|
5832
|
-
state.anchor = _anchor;
|
|
5833
|
-
return true;
|
|
5834
|
-
}
|
|
5835
|
-
} else if (detected) {
|
|
5836
|
-
throwError(state, "can not read a block mapping entry; a multiline key may not be an implicit key");
|
|
5837
|
-
} else {
|
|
5838
|
-
state.tag = _tag;
|
|
5839
|
-
state.anchor = _anchor;
|
|
5840
|
-
return true;
|
|
5841
|
-
}
|
|
5637
|
+
const directiveName = state.input.slice(_position, state.position);
|
|
5638
|
+
const directiveArgs = [];
|
|
5639
|
+
if (directiveName.length < 1) {
|
|
5640
|
+
throwError(state, "directive name must not be less than one character in length");
|
|
5842
5641
|
}
|
|
5843
|
-
|
|
5844
|
-
|
|
5845
|
-
|
|
5846
|
-
_keyLineStart = state.lineStart;
|
|
5847
|
-
_keyPos = state.position;
|
|
5642
|
+
while (ch !== 0) {
|
|
5643
|
+
while (isWhiteSpace(ch)) {
|
|
5644
|
+
ch = state.input.charCodeAt(++state.position);
|
|
5848
5645
|
}
|
|
5849
|
-
if (
|
|
5850
|
-
|
|
5851
|
-
|
|
5852
|
-
}
|
|
5853
|
-
|
|
5854
|
-
}
|
|
5646
|
+
if (ch === 35) {
|
|
5647
|
+
do {
|
|
5648
|
+
ch = state.input.charCodeAt(++state.position);
|
|
5649
|
+
} while (ch !== 0 && !isEol(ch));
|
|
5650
|
+
break;
|
|
5855
5651
|
}
|
|
5856
|
-
if (
|
|
5857
|
-
|
|
5858
|
-
|
|
5652
|
+
if (isEol(ch))
|
|
5653
|
+
break;
|
|
5654
|
+
_position = state.position;
|
|
5655
|
+
while (ch !== 0 && !isWsOrEol(ch)) {
|
|
5656
|
+
ch = state.input.charCodeAt(++state.position);
|
|
5859
5657
|
}
|
|
5860
|
-
|
|
5861
|
-
ch = state.input.charCodeAt(state.position);
|
|
5658
|
+
directiveArgs.push(state.input.slice(_position, state.position));
|
|
5862
5659
|
}
|
|
5863
|
-
if (
|
|
5864
|
-
|
|
5865
|
-
|
|
5866
|
-
|
|
5660
|
+
if (ch !== 0)
|
|
5661
|
+
readLineBreak(state);
|
|
5662
|
+
if (_hasOwnProperty.call(directiveHandlers, directiveName)) {
|
|
5663
|
+
directiveHandlers[directiveName](state, directiveName, directiveArgs);
|
|
5664
|
+
} else {
|
|
5665
|
+
throwWarning(state, 'unknown document directive "' + directiveName + '"');
|
|
5867
5666
|
}
|
|
5868
5667
|
}
|
|
5869
|
-
|
|
5870
|
-
|
|
5668
|
+
skipSeparationSpace(state, true, -1);
|
|
5669
|
+
if (state.lineIndent === 0 && state.input.charCodeAt(state.position) === 45 && state.input.charCodeAt(state.position + 1) === 45 && state.input.charCodeAt(state.position + 2) === 45) {
|
|
5670
|
+
state.position += 3;
|
|
5671
|
+
skipSeparationSpace(state, true, -1);
|
|
5672
|
+
} else if (hasDirectives) {
|
|
5673
|
+
throwError(state, "directives end mark is expected");
|
|
5871
5674
|
}
|
|
5872
|
-
|
|
5873
|
-
|
|
5874
|
-
|
|
5875
|
-
state
|
|
5876
|
-
state.result = _result;
|
|
5675
|
+
composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
|
|
5676
|
+
skipSeparationSpace(state, true, -1);
|
|
5677
|
+
if (state.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
|
|
5678
|
+
throwWarning(state, "non-ASCII line breaks are interpreted as content");
|
|
5877
5679
|
}
|
|
5878
|
-
|
|
5879
|
-
|
|
5880
|
-
|
|
5881
|
-
|
|
5882
|
-
|
|
5883
|
-
|
|
5884
|
-
|
|
5885
|
-
let ch = state.input.charCodeAt(state.position);
|
|
5886
|
-
if (ch !== 33)
|
|
5887
|
-
return false;
|
|
5888
|
-
if (state.tag !== null) {
|
|
5889
|
-
throwError(state, "duplication of a tag property");
|
|
5680
|
+
state.documents.push(state.result);
|
|
5681
|
+
if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
5682
|
+
if (state.input.charCodeAt(state.position) === 46) {
|
|
5683
|
+
state.position += 3;
|
|
5684
|
+
skipSeparationSpace(state, true, -1);
|
|
5685
|
+
}
|
|
5686
|
+
return;
|
|
5890
5687
|
}
|
|
5891
|
-
|
|
5892
|
-
|
|
5893
|
-
isVerbatim = true;
|
|
5894
|
-
ch = state.input.charCodeAt(++state.position);
|
|
5895
|
-
} else if (ch === 33) {
|
|
5896
|
-
isNamed = true;
|
|
5897
|
-
tagHandle = "!!";
|
|
5898
|
-
ch = state.input.charCodeAt(++state.position);
|
|
5899
|
-
} else {
|
|
5900
|
-
tagHandle = "!";
|
|
5688
|
+
if (state.position < state.length - 1) {
|
|
5689
|
+
throwError(state, "end of the stream or a document separator is expected");
|
|
5901
5690
|
}
|
|
5902
|
-
|
|
5903
|
-
|
|
5904
|
-
|
|
5905
|
-
|
|
5906
|
-
|
|
5907
|
-
if (
|
|
5908
|
-
|
|
5909
|
-
|
|
5910
|
-
} else {
|
|
5911
|
-
throwError(state, "unexpected end of the stream within a verbatim tag");
|
|
5912
|
-
}
|
|
5913
|
-
} else {
|
|
5914
|
-
while (ch !== 0 && !isWsOrEol(ch)) {
|
|
5915
|
-
if (ch === 33) {
|
|
5916
|
-
if (!isNamed) {
|
|
5917
|
-
tagHandle = state.input.slice(_position - 1, state.position + 1);
|
|
5918
|
-
if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
|
|
5919
|
-
throwError(state, "named tag handle cannot contain such characters");
|
|
5920
|
-
}
|
|
5921
|
-
isNamed = true;
|
|
5922
|
-
_position = state.position + 1;
|
|
5923
|
-
} else {
|
|
5924
|
-
throwError(state, "tag suffix cannot contain exclamation marks");
|
|
5925
|
-
}
|
|
5926
|
-
}
|
|
5927
|
-
ch = state.input.charCodeAt(++state.position);
|
|
5691
|
+
}
|
|
5692
|
+
function loadDocuments(input, options) {
|
|
5693
|
+
input = String(input);
|
|
5694
|
+
options = options || {};
|
|
5695
|
+
if (input.length !== 0) {
|
|
5696
|
+
if (input.charCodeAt(input.length - 1) !== 10 && input.charCodeAt(input.length - 1) !== 13) {
|
|
5697
|
+
input += `
|
|
5698
|
+
`;
|
|
5928
5699
|
}
|
|
5929
|
-
|
|
5930
|
-
|
|
5931
|
-
throwError(state, "tag suffix cannot contain flow indicator characters");
|
|
5700
|
+
if (input.charCodeAt(0) === 65279) {
|
|
5701
|
+
input = input.slice(1);
|
|
5932
5702
|
}
|
|
5933
5703
|
}
|
|
5934
|
-
|
|
5935
|
-
|
|
5704
|
+
const state = new State(input, options);
|
|
5705
|
+
const nullpos = input.indexOf("\x00");
|
|
5706
|
+
if (nullpos !== -1) {
|
|
5707
|
+
state.position = nullpos;
|
|
5708
|
+
throwError(state, "null byte is not allowed in input");
|
|
5936
5709
|
}
|
|
5937
|
-
|
|
5938
|
-
|
|
5939
|
-
|
|
5940
|
-
|
|
5710
|
+
state.input += "\x00";
|
|
5711
|
+
while (state.input.charCodeAt(state.position) === 32) {
|
|
5712
|
+
state.lineIndent += 1;
|
|
5713
|
+
state.position += 1;
|
|
5941
5714
|
}
|
|
5942
|
-
|
|
5943
|
-
state
|
|
5944
|
-
} else if (_hasOwnProperty.call(state.tagMap, tagHandle)) {
|
|
5945
|
-
state.tag = state.tagMap[tagHandle] + tagName;
|
|
5946
|
-
} else if (tagHandle === "!") {
|
|
5947
|
-
state.tag = "!" + tagName;
|
|
5948
|
-
} else if (tagHandle === "!!") {
|
|
5949
|
-
state.tag = "tag:yaml.org,2002:" + tagName;
|
|
5950
|
-
} else {
|
|
5951
|
-
throwError(state, 'undeclared tag handle "' + tagHandle + '"');
|
|
5715
|
+
while (state.position < state.length - 1) {
|
|
5716
|
+
readDocument(state);
|
|
5952
5717
|
}
|
|
5953
|
-
return
|
|
5718
|
+
return state.documents;
|
|
5954
5719
|
}
|
|
5955
|
-
function
|
|
5956
|
-
|
|
5957
|
-
|
|
5958
|
-
|
|
5959
|
-
if (state.anchor !== null) {
|
|
5960
|
-
throwError(state, "duplication of an anchor property");
|
|
5720
|
+
function loadAll2(input, iterator, options) {
|
|
5721
|
+
if (iterator !== null && typeof iterator === "object" && typeof options === "undefined") {
|
|
5722
|
+
options = iterator;
|
|
5723
|
+
iterator = null;
|
|
5961
5724
|
}
|
|
5962
|
-
|
|
5963
|
-
|
|
5964
|
-
|
|
5965
|
-
ch = state.input.charCodeAt(++state.position);
|
|
5725
|
+
const documents = loadDocuments(input, options);
|
|
5726
|
+
if (typeof iterator !== "function") {
|
|
5727
|
+
return documents;
|
|
5966
5728
|
}
|
|
5967
|
-
|
|
5968
|
-
|
|
5729
|
+
for (let index = 0, length = documents.length;index < length; index += 1) {
|
|
5730
|
+
iterator(documents[index]);
|
|
5969
5731
|
}
|
|
5970
|
-
state.anchor = state.input.slice(_position, state.position);
|
|
5971
|
-
return true;
|
|
5972
5732
|
}
|
|
5973
|
-
function
|
|
5974
|
-
|
|
5975
|
-
if (
|
|
5976
|
-
return
|
|
5977
|
-
|
|
5978
|
-
|
|
5979
|
-
while (ch !== 0 && !isWsOrEol(ch) && !isFlowIndicator(ch)) {
|
|
5980
|
-
ch = state.input.charCodeAt(++state.position);
|
|
5981
|
-
}
|
|
5982
|
-
if (state.position === _position) {
|
|
5983
|
-
throwError(state, "name of an alias node must contain at least one character");
|
|
5733
|
+
function load2(input, options) {
|
|
5734
|
+
const documents = loadDocuments(input, options);
|
|
5735
|
+
if (documents.length === 0) {
|
|
5736
|
+
return;
|
|
5737
|
+
} else if (documents.length === 1) {
|
|
5738
|
+
return documents[0];
|
|
5984
5739
|
}
|
|
5985
|
-
|
|
5986
|
-
|
|
5987
|
-
|
|
5740
|
+
throw new YAMLException2("expected a single document in the stream, but found more");
|
|
5741
|
+
}
|
|
5742
|
+
loader.loadAll = loadAll2;
|
|
5743
|
+
loader.load = load2;
|
|
5744
|
+
return loader;
|
|
5745
|
+
}
|
|
5746
|
+
var dumper = {};
|
|
5747
|
+
var hasRequiredDumper;
|
|
5748
|
+
function requireDumper() {
|
|
5749
|
+
if (hasRequiredDumper)
|
|
5750
|
+
return dumper;
|
|
5751
|
+
hasRequiredDumper = 1;
|
|
5752
|
+
const common2 = requireCommon();
|
|
5753
|
+
const YAMLException2 = requireException();
|
|
5754
|
+
const DEFAULT_SCHEMA2 = require_default();
|
|
5755
|
+
const _toString = Object.prototype.toString;
|
|
5756
|
+
const _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
5757
|
+
const CHAR_BOM = 65279;
|
|
5758
|
+
const CHAR_TAB = 9;
|
|
5759
|
+
const CHAR_LINE_FEED = 10;
|
|
5760
|
+
const CHAR_CARRIAGE_RETURN = 13;
|
|
5761
|
+
const CHAR_SPACE = 32;
|
|
5762
|
+
const CHAR_EXCLAMATION = 33;
|
|
5763
|
+
const CHAR_DOUBLE_QUOTE = 34;
|
|
5764
|
+
const CHAR_SHARP = 35;
|
|
5765
|
+
const CHAR_PERCENT = 37;
|
|
5766
|
+
const CHAR_AMPERSAND = 38;
|
|
5767
|
+
const CHAR_SINGLE_QUOTE = 39;
|
|
5768
|
+
const CHAR_ASTERISK = 42;
|
|
5769
|
+
const CHAR_COMMA = 44;
|
|
5770
|
+
const CHAR_MINUS = 45;
|
|
5771
|
+
const CHAR_COLON = 58;
|
|
5772
|
+
const CHAR_EQUALS = 61;
|
|
5773
|
+
const CHAR_GREATER_THAN = 62;
|
|
5774
|
+
const CHAR_QUESTION = 63;
|
|
5775
|
+
const CHAR_COMMERCIAL_AT = 64;
|
|
5776
|
+
const CHAR_LEFT_SQUARE_BRACKET = 91;
|
|
5777
|
+
const CHAR_RIGHT_SQUARE_BRACKET = 93;
|
|
5778
|
+
const CHAR_GRAVE_ACCENT = 96;
|
|
5779
|
+
const CHAR_LEFT_CURLY_BRACKET = 123;
|
|
5780
|
+
const CHAR_VERTICAL_LINE = 124;
|
|
5781
|
+
const CHAR_RIGHT_CURLY_BRACKET = 125;
|
|
5782
|
+
const ESCAPE_SEQUENCES = {};
|
|
5783
|
+
ESCAPE_SEQUENCES[0] = "\\0";
|
|
5784
|
+
ESCAPE_SEQUENCES[7] = "\\a";
|
|
5785
|
+
ESCAPE_SEQUENCES[8] = "\\b";
|
|
5786
|
+
ESCAPE_SEQUENCES[9] = "\\t";
|
|
5787
|
+
ESCAPE_SEQUENCES[10] = "\\n";
|
|
5788
|
+
ESCAPE_SEQUENCES[11] = "\\v";
|
|
5789
|
+
ESCAPE_SEQUENCES[12] = "\\f";
|
|
5790
|
+
ESCAPE_SEQUENCES[13] = "\\r";
|
|
5791
|
+
ESCAPE_SEQUENCES[27] = "\\e";
|
|
5792
|
+
ESCAPE_SEQUENCES[34] = "\\\"";
|
|
5793
|
+
ESCAPE_SEQUENCES[92] = "\\\\";
|
|
5794
|
+
ESCAPE_SEQUENCES[133] = "\\N";
|
|
5795
|
+
ESCAPE_SEQUENCES[160] = "\\_";
|
|
5796
|
+
ESCAPE_SEQUENCES[8232] = "\\L";
|
|
5797
|
+
ESCAPE_SEQUENCES[8233] = "\\P";
|
|
5798
|
+
const DEPRECATED_BOOLEANS_SYNTAX = [
|
|
5799
|
+
"y",
|
|
5800
|
+
"Y",
|
|
5801
|
+
"yes",
|
|
5802
|
+
"Yes",
|
|
5803
|
+
"YES",
|
|
5804
|
+
"on",
|
|
5805
|
+
"On",
|
|
5806
|
+
"ON",
|
|
5807
|
+
"n",
|
|
5808
|
+
"N",
|
|
5809
|
+
"no",
|
|
5810
|
+
"No",
|
|
5811
|
+
"NO",
|
|
5812
|
+
"off",
|
|
5813
|
+
"Off",
|
|
5814
|
+
"OFF"
|
|
5815
|
+
];
|
|
5816
|
+
const DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
|
|
5817
|
+
function compileStyleMap(schema2, map2) {
|
|
5818
|
+
if (map2 === null)
|
|
5819
|
+
return {};
|
|
5820
|
+
const result = {};
|
|
5821
|
+
const keys = Object.keys(map2);
|
|
5822
|
+
for (let index = 0, length = keys.length;index < length; index += 1) {
|
|
5823
|
+
let tag = keys[index];
|
|
5824
|
+
let style = String(map2[tag]);
|
|
5825
|
+
if (tag.slice(0, 2) === "!!") {
|
|
5826
|
+
tag = "tag:yaml.org,2002:" + tag.slice(2);
|
|
5827
|
+
}
|
|
5828
|
+
const type2 = schema2.compiledTypeMap["fallback"][tag];
|
|
5829
|
+
if (type2 && _hasOwnProperty.call(type2.styleAliases, style)) {
|
|
5830
|
+
style = type2.styleAliases[style];
|
|
5831
|
+
}
|
|
5832
|
+
result[tag] = style;
|
|
5988
5833
|
}
|
|
5989
|
-
|
|
5990
|
-
skipSeparationSpace(state, true, -1);
|
|
5991
|
-
return true;
|
|
5834
|
+
return result;
|
|
5992
5835
|
}
|
|
5993
|
-
function
|
|
5994
|
-
|
|
5995
|
-
|
|
5996
|
-
|
|
5997
|
-
|
|
5998
|
-
|
|
5999
|
-
|
|
6000
|
-
|
|
6001
|
-
|
|
6002
|
-
|
|
6003
|
-
|
|
5836
|
+
function encodeHex(character) {
|
|
5837
|
+
let handle;
|
|
5838
|
+
let length;
|
|
5839
|
+
const string = character.toString(16).toUpperCase();
|
|
5840
|
+
if (character <= 255) {
|
|
5841
|
+
handle = "x";
|
|
5842
|
+
length = 2;
|
|
5843
|
+
} else if (character <= 65535) {
|
|
5844
|
+
handle = "u";
|
|
5845
|
+
length = 4;
|
|
5846
|
+
} else if (character <= 4294967295) {
|
|
5847
|
+
handle = "U";
|
|
5848
|
+
length = 8;
|
|
5849
|
+
} else {
|
|
5850
|
+
throw new YAMLException2("code point within a string may not be greater than 0xFFFFFFFF");
|
|
6004
5851
|
}
|
|
6005
|
-
|
|
6006
|
-
restoreState(state, fallbackState);
|
|
6007
|
-
return false;
|
|
5852
|
+
return "\\" + handle + common2.repeat("0", length - string.length) + string;
|
|
6008
5853
|
}
|
|
6009
|
-
|
|
6010
|
-
|
|
6011
|
-
|
|
6012
|
-
|
|
6013
|
-
|
|
6014
|
-
|
|
6015
|
-
|
|
6016
|
-
|
|
6017
|
-
|
|
6018
|
-
|
|
6019
|
-
|
|
6020
|
-
|
|
6021
|
-
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
|
|
6025
|
-
|
|
6026
|
-
|
|
6027
|
-
|
|
6028
|
-
|
|
6029
|
-
|
|
6030
|
-
|
|
6031
|
-
|
|
6032
|
-
|
|
6033
|
-
|
|
6034
|
-
|
|
6035
|
-
|
|
6036
|
-
|
|
6037
|
-
|
|
6038
|
-
|
|
6039
|
-
|
|
6040
|
-
|
|
5854
|
+
const QUOTING_TYPE_SINGLE = 1;
|
|
5855
|
+
const QUOTING_TYPE_DOUBLE = 2;
|
|
5856
|
+
function State(options) {
|
|
5857
|
+
this.schema = options["schema"] || DEFAULT_SCHEMA2;
|
|
5858
|
+
this.indent = Math.max(1, options["indent"] || 2);
|
|
5859
|
+
this.noArrayIndent = options["noArrayIndent"] || false;
|
|
5860
|
+
this.skipInvalid = options["skipInvalid"] || false;
|
|
5861
|
+
this.flowLevel = common2.isNothing(options["flowLevel"]) ? -1 : options["flowLevel"];
|
|
5862
|
+
this.styleMap = compileStyleMap(this.schema, options["styles"] || null);
|
|
5863
|
+
this.sortKeys = options["sortKeys"] || false;
|
|
5864
|
+
this.lineWidth = options["lineWidth"] || 80;
|
|
5865
|
+
this.noRefs = options["noRefs"] || false;
|
|
5866
|
+
this.noCompatMode = options["noCompatMode"] || false;
|
|
5867
|
+
this.condenseFlow = options["condenseFlow"] || false;
|
|
5868
|
+
this.quotingType = options["quotingType"] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE;
|
|
5869
|
+
this.forceQuotes = options["forceQuotes"] || false;
|
|
5870
|
+
this.replacer = typeof options["replacer"] === "function" ? options["replacer"] : null;
|
|
5871
|
+
this.implicitTypes = this.schema.compiledImplicit;
|
|
5872
|
+
this.explicitTypes = this.schema.compiledExplicit;
|
|
5873
|
+
this.tag = null;
|
|
5874
|
+
this.result = "";
|
|
5875
|
+
this.duplicates = [];
|
|
5876
|
+
this.usedDuplicates = null;
|
|
5877
|
+
}
|
|
5878
|
+
function indentString(string, spaces) {
|
|
5879
|
+
const ind = common2.repeat(" ", spaces);
|
|
5880
|
+
let position = 0;
|
|
5881
|
+
let result = "";
|
|
5882
|
+
const length = string.length;
|
|
5883
|
+
while (position < length) {
|
|
5884
|
+
let line;
|
|
5885
|
+
const next = string.indexOf(`
|
|
5886
|
+
`, position);
|
|
5887
|
+
if (next === -1) {
|
|
5888
|
+
line = string.slice(position);
|
|
5889
|
+
position = length;
|
|
5890
|
+
} else {
|
|
5891
|
+
line = string.slice(position, next + 1);
|
|
5892
|
+
position = next + 1;
|
|
6041
5893
|
}
|
|
5894
|
+
if (line.length && line !== `
|
|
5895
|
+
`)
|
|
5896
|
+
result += ind;
|
|
5897
|
+
result += line;
|
|
6042
5898
|
}
|
|
6043
|
-
|
|
6044
|
-
|
|
6045
|
-
|
|
6046
|
-
|
|
6047
|
-
|
|
6048
|
-
|
|
6049
|
-
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
|
-
|
|
6053
|
-
|
|
6054
|
-
propertyStart = propertyState;
|
|
6055
|
-
}
|
|
6056
|
-
if (skipSeparationSpace(state, true, -1)) {
|
|
6057
|
-
atNewLine = true;
|
|
6058
|
-
allowBlockCollections = allowBlockStyles;
|
|
6059
|
-
if (state.lineIndent > parentIndent) {
|
|
6060
|
-
indentStatus = 1;
|
|
6061
|
-
} else if (state.lineIndent === parentIndent) {
|
|
6062
|
-
indentStatus = 0;
|
|
6063
|
-
} else if (state.lineIndent < parentIndent) {
|
|
6064
|
-
indentStatus = -1;
|
|
6065
|
-
}
|
|
6066
|
-
} else {
|
|
6067
|
-
allowBlockCollections = false;
|
|
6068
|
-
}
|
|
5899
|
+
return result;
|
|
5900
|
+
}
|
|
5901
|
+
function generateNextLine(state, level) {
|
|
5902
|
+
return `
|
|
5903
|
+
` + common2.repeat(" ", state.indent * level);
|
|
5904
|
+
}
|
|
5905
|
+
function testImplicitResolving(state, str2) {
|
|
5906
|
+
for (let index = 0, length = state.implicitTypes.length;index < length; index += 1) {
|
|
5907
|
+
const type2 = state.implicitTypes[index];
|
|
5908
|
+
if (type2.resolve(str2)) {
|
|
5909
|
+
return true;
|
|
6069
5910
|
}
|
|
6070
5911
|
}
|
|
6071
|
-
|
|
6072
|
-
|
|
6073
|
-
|
|
6074
|
-
|
|
6075
|
-
|
|
6076
|
-
|
|
6077
|
-
|
|
6078
|
-
|
|
6079
|
-
|
|
6080
|
-
|
|
6081
|
-
|
|
6082
|
-
|
|
6083
|
-
|
|
6084
|
-
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
-
|
|
6088
|
-
|
|
6089
|
-
|
|
6090
|
-
|
|
6091
|
-
|
|
6092
|
-
|
|
6093
|
-
|
|
6094
|
-
|
|
6095
|
-
|
|
6096
|
-
|
|
6097
|
-
|
|
6098
|
-
|
|
6099
|
-
|
|
6100
|
-
}
|
|
6101
|
-
if (state.anchor !== null) {
|
|
6102
|
-
storeAnchor(state, state.anchor, state.result);
|
|
6103
|
-
}
|
|
6104
|
-
}
|
|
6105
|
-
} else if (indentStatus === 0) {
|
|
6106
|
-
hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
|
|
5912
|
+
return false;
|
|
5913
|
+
}
|
|
5914
|
+
function isWhitespace(c) {
|
|
5915
|
+
return c === CHAR_SPACE || c === CHAR_TAB;
|
|
5916
|
+
}
|
|
5917
|
+
function isPrintable(c) {
|
|
5918
|
+
return c >= 32 && c <= 126 || c >= 161 && c <= 55295 && c !== 8232 && c !== 8233 || c >= 57344 && c <= 65533 && c !== CHAR_BOM || c >= 65536 && c <= 1114111;
|
|
5919
|
+
}
|
|
5920
|
+
function isNsCharOrWhitespace(c) {
|
|
5921
|
+
return isPrintable(c) && c !== CHAR_BOM && c !== CHAR_CARRIAGE_RETURN && c !== CHAR_LINE_FEED;
|
|
5922
|
+
}
|
|
5923
|
+
function isPlainSafe(c, prev, inblock) {
|
|
5924
|
+
const cIsNsCharOrWhitespace = isNsCharOrWhitespace(c);
|
|
5925
|
+
const cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c);
|
|
5926
|
+
return (inblock ? cIsNsCharOrWhitespace : cIsNsCharOrWhitespace && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET) && c !== CHAR_SHARP && !(prev === CHAR_COLON && !cIsNsChar) || isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP || prev === CHAR_COLON && cIsNsChar;
|
|
5927
|
+
}
|
|
5928
|
+
function isPlainSafeFirst(c) {
|
|
5929
|
+
return isPrintable(c) && c !== CHAR_BOM && !isWhitespace(c) && c !== CHAR_MINUS && c !== CHAR_QUESTION && c !== CHAR_COLON && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET && c !== CHAR_SHARP && c !== CHAR_AMPERSAND && c !== CHAR_ASTERISK && c !== CHAR_EXCLAMATION && c !== CHAR_VERTICAL_LINE && c !== CHAR_EQUALS && c !== CHAR_GREATER_THAN && c !== CHAR_SINGLE_QUOTE && c !== CHAR_DOUBLE_QUOTE && c !== CHAR_PERCENT && c !== CHAR_COMMERCIAL_AT && c !== CHAR_GRAVE_ACCENT;
|
|
5930
|
+
}
|
|
5931
|
+
function isPlainSafeLast(c) {
|
|
5932
|
+
return !isWhitespace(c) && c !== CHAR_COLON;
|
|
5933
|
+
}
|
|
5934
|
+
function codePointAt(string, pos) {
|
|
5935
|
+
const first = string.charCodeAt(pos);
|
|
5936
|
+
let second;
|
|
5937
|
+
if (first >= 55296 && first <= 56319 && pos + 1 < string.length) {
|
|
5938
|
+
second = string.charCodeAt(pos + 1);
|
|
5939
|
+
if (second >= 56320 && second <= 57343) {
|
|
5940
|
+
return (first - 55296) * 1024 + second - 56320 + 65536;
|
|
6107
5941
|
}
|
|
6108
5942
|
}
|
|
6109
|
-
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
|
|
6120
|
-
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
|
|
5943
|
+
return first;
|
|
5944
|
+
}
|
|
5945
|
+
function needIndentIndicator(string) {
|
|
5946
|
+
const leadingSpaceRe = /^\n* /;
|
|
5947
|
+
return leadingSpaceRe.test(string);
|
|
5948
|
+
}
|
|
5949
|
+
const STYLE_PLAIN = 1;
|
|
5950
|
+
const STYLE_SINGLE = 2;
|
|
5951
|
+
const STYLE_LITERAL = 3;
|
|
5952
|
+
const STYLE_FOLDED = 4;
|
|
5953
|
+
const STYLE_DOUBLE = 5;
|
|
5954
|
+
function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType, quotingType, forceQuotes, inblock) {
|
|
5955
|
+
let i;
|
|
5956
|
+
let char = 0;
|
|
5957
|
+
let prevChar = null;
|
|
5958
|
+
let hasLineBreak = false;
|
|
5959
|
+
let hasFoldableLine = false;
|
|
5960
|
+
const shouldTrackWidth = lineWidth !== -1;
|
|
5961
|
+
let previousLineBreak = -1;
|
|
5962
|
+
let plain = isPlainSafeFirst(codePointAt(string, 0)) && isPlainSafeLast(codePointAt(string, string.length - 1));
|
|
5963
|
+
if (singleLineOnly || forceQuotes) {
|
|
5964
|
+
for (i = 0;i < string.length; char >= 65536 ? i += 2 : i++) {
|
|
5965
|
+
char = codePointAt(string, i);
|
|
5966
|
+
if (!isPrintable(char)) {
|
|
5967
|
+
return STYLE_DOUBLE;
|
|
6126
5968
|
}
|
|
5969
|
+
plain = plain && isPlainSafe(char, prevChar, inblock);
|
|
5970
|
+
prevChar = char;
|
|
6127
5971
|
}
|
|
6128
|
-
} else
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
type2 = typeList[typeIndex];
|
|
6137
|
-
break;
|
|
5972
|
+
} else {
|
|
5973
|
+
for (i = 0;i < string.length; char >= 65536 ? i += 2 : i++) {
|
|
5974
|
+
char = codePointAt(string, i);
|
|
5975
|
+
if (char === CHAR_LINE_FEED) {
|
|
5976
|
+
hasLineBreak = true;
|
|
5977
|
+
if (shouldTrackWidth) {
|
|
5978
|
+
hasFoldableLine = hasFoldableLine || i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ";
|
|
5979
|
+
previousLineBreak = i;
|
|
6138
5980
|
}
|
|
5981
|
+
} else if (!isPrintable(char)) {
|
|
5982
|
+
return STYLE_DOUBLE;
|
|
6139
5983
|
}
|
|
5984
|
+
plain = plain && isPlainSafe(char, prevChar, inblock);
|
|
5985
|
+
prevChar = char;
|
|
6140
5986
|
}
|
|
6141
|
-
|
|
6142
|
-
|
|
6143
|
-
|
|
6144
|
-
if (
|
|
6145
|
-
|
|
6146
|
-
}
|
|
6147
|
-
if (!type2.resolve(state.result, state.tag)) {
|
|
6148
|
-
throwError(state, "cannot resolve a node with !<" + state.tag + "> explicit tag");
|
|
6149
|
-
} else {
|
|
6150
|
-
state.result = type2.construct(state.result, state.tag);
|
|
6151
|
-
if (state.anchor !== null) {
|
|
6152
|
-
storeAnchor(state, state.anchor, state.result);
|
|
6153
|
-
}
|
|
5987
|
+
hasFoldableLine = hasFoldableLine || shouldTrackWidth && (i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ");
|
|
5988
|
+
}
|
|
5989
|
+
if (!hasLineBreak && !hasFoldableLine) {
|
|
5990
|
+
if (plain && !forceQuotes && !testAmbiguousType(string)) {
|
|
5991
|
+
return STYLE_PLAIN;
|
|
6154
5992
|
}
|
|
5993
|
+
return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
|
|
6155
5994
|
}
|
|
6156
|
-
if (
|
|
6157
|
-
|
|
5995
|
+
if (indentPerLevel > 9 && needIndentIndicator(string)) {
|
|
5996
|
+
return STYLE_DOUBLE;
|
|
6158
5997
|
}
|
|
6159
|
-
|
|
6160
|
-
|
|
5998
|
+
if (!forceQuotes) {
|
|
5999
|
+
return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
|
|
6000
|
+
}
|
|
6001
|
+
return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
|
|
6161
6002
|
}
|
|
6162
|
-
function
|
|
6163
|
-
|
|
6164
|
-
|
|
6165
|
-
|
|
6166
|
-
state.version = null;
|
|
6167
|
-
state.checkLineBreaks = state.legacy;
|
|
6168
|
-
state.tagMap = /* @__PURE__ */ Object.create(null);
|
|
6169
|
-
state.anchorMap = /* @__PURE__ */ Object.create(null);
|
|
6170
|
-
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
6171
|
-
skipSeparationSpace(state, true, -1);
|
|
6172
|
-
ch = state.input.charCodeAt(state.position);
|
|
6173
|
-
if (state.lineIndent > 0 || ch !== 37) {
|
|
6174
|
-
break;
|
|
6175
|
-
}
|
|
6176
|
-
hasDirectives = true;
|
|
6177
|
-
ch = state.input.charCodeAt(++state.position);
|
|
6178
|
-
let _position = state.position;
|
|
6179
|
-
while (ch !== 0 && !isWsOrEol(ch)) {
|
|
6180
|
-
ch = state.input.charCodeAt(++state.position);
|
|
6181
|
-
}
|
|
6182
|
-
const directiveName = state.input.slice(_position, state.position);
|
|
6183
|
-
const directiveArgs = [];
|
|
6184
|
-
if (directiveName.length < 1) {
|
|
6185
|
-
throwError(state, "directive name must not be less than one character in length");
|
|
6003
|
+
function writeScalar(state, string, level, iskey, inblock) {
|
|
6004
|
+
state.dump = function() {
|
|
6005
|
+
if (string.length === 0) {
|
|
6006
|
+
return state.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''";
|
|
6186
6007
|
}
|
|
6187
|
-
|
|
6188
|
-
|
|
6189
|
-
|
|
6190
|
-
}
|
|
6191
|
-
if (ch === 35) {
|
|
6192
|
-
do {
|
|
6193
|
-
ch = state.input.charCodeAt(++state.position);
|
|
6194
|
-
} while (ch !== 0 && !isEol(ch));
|
|
6195
|
-
break;
|
|
6196
|
-
}
|
|
6197
|
-
if (isEol(ch))
|
|
6198
|
-
break;
|
|
6199
|
-
_position = state.position;
|
|
6200
|
-
while (ch !== 0 && !isWsOrEol(ch)) {
|
|
6201
|
-
ch = state.input.charCodeAt(++state.position);
|
|
6008
|
+
if (!state.noCompatMode) {
|
|
6009
|
+
if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) {
|
|
6010
|
+
return state.quotingType === QUOTING_TYPE_DOUBLE ? '"' + string + '"' : "'" + string + "'";
|
|
6202
6011
|
}
|
|
6203
|
-
directiveArgs.push(state.input.slice(_position, state.position));
|
|
6204
6012
|
}
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
|
|
6209
|
-
|
|
6210
|
-
throwWarning(state, 'unknown document directive "' + directiveName + '"');
|
|
6013
|
+
const indent = state.indent * Math.max(1, level);
|
|
6014
|
+
const lineWidth = state.lineWidth === -1 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
|
|
6015
|
+
const singleLineOnly = iskey || state.flowLevel > -1 && level >= state.flowLevel;
|
|
6016
|
+
function testAmbiguity(string2) {
|
|
6017
|
+
return testImplicitResolving(state, string2);
|
|
6211
6018
|
}
|
|
6212
|
-
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
|
|
6223
|
-
|
|
6224
|
-
|
|
6225
|
-
state.documents.push(state.result);
|
|
6226
|
-
if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
6227
|
-
if (state.input.charCodeAt(state.position) === 46) {
|
|
6228
|
-
state.position += 3;
|
|
6229
|
-
skipSeparationSpace(state, true, -1);
|
|
6019
|
+
switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity, state.quotingType, state.forceQuotes && !iskey, inblock)) {
|
|
6020
|
+
case STYLE_PLAIN:
|
|
6021
|
+
return string;
|
|
6022
|
+
case STYLE_SINGLE:
|
|
6023
|
+
return "'" + string.replace(/'/g, "''") + "'";
|
|
6024
|
+
case STYLE_LITERAL:
|
|
6025
|
+
return "|" + blockHeader(string, state.indent) + dropEndingNewline(indentString(string, indent));
|
|
6026
|
+
case STYLE_FOLDED:
|
|
6027
|
+
return ">" + blockHeader(string, state.indent) + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
|
|
6028
|
+
case STYLE_DOUBLE:
|
|
6029
|
+
return '"' + escapeString(string) + '"';
|
|
6030
|
+
default:
|
|
6031
|
+
throw new YAMLException2("impossible error: invalid scalar style");
|
|
6230
6032
|
}
|
|
6231
|
-
|
|
6232
|
-
}
|
|
6233
|
-
if (state.position < state.length - 1) {
|
|
6234
|
-
throwError(state, "end of the stream or a document separator is expected");
|
|
6235
|
-
}
|
|
6033
|
+
}();
|
|
6236
6034
|
}
|
|
6237
|
-
function
|
|
6238
|
-
|
|
6239
|
-
|
|
6240
|
-
if (input.length !== 0) {
|
|
6241
|
-
if (input.charCodeAt(input.length - 1) !== 10 && input.charCodeAt(input.length - 1) !== 13) {
|
|
6242
|
-
input += `
|
|
6035
|
+
function blockHeader(string, indentPerLevel) {
|
|
6036
|
+
const indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : "";
|
|
6037
|
+
const clip = string[string.length - 1] === `
|
|
6243
6038
|
`;
|
|
6244
|
-
|
|
6245
|
-
|
|
6246
|
-
|
|
6247
|
-
|
|
6248
|
-
|
|
6249
|
-
|
|
6250
|
-
|
|
6251
|
-
|
|
6252
|
-
|
|
6253
|
-
|
|
6254
|
-
|
|
6255
|
-
|
|
6256
|
-
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
|
|
6260
|
-
|
|
6261
|
-
|
|
6039
|
+
const keep = clip && (string[string.length - 2] === `
|
|
6040
|
+
` || string === `
|
|
6041
|
+
`);
|
|
6042
|
+
const chomp = keep ? "+" : clip ? "" : "-";
|
|
6043
|
+
return indentIndicator + chomp + `
|
|
6044
|
+
`;
|
|
6045
|
+
}
|
|
6046
|
+
function dropEndingNewline(string) {
|
|
6047
|
+
return string[string.length - 1] === `
|
|
6048
|
+
` ? string.slice(0, -1) : string;
|
|
6049
|
+
}
|
|
6050
|
+
function foldString(string, width) {
|
|
6051
|
+
const lineRe = /(\n+)([^\n]*)/g;
|
|
6052
|
+
let result = function() {
|
|
6053
|
+
let nextLF = string.indexOf(`
|
|
6054
|
+
`);
|
|
6055
|
+
nextLF = nextLF !== -1 ? nextLF : string.length;
|
|
6056
|
+
lineRe.lastIndex = nextLF;
|
|
6057
|
+
return foldLine(string.slice(0, nextLF), width);
|
|
6058
|
+
}();
|
|
6059
|
+
let prevMoreIndented = string[0] === `
|
|
6060
|
+
` || string[0] === " ";
|
|
6061
|
+
let moreIndented;
|
|
6062
|
+
let match;
|
|
6063
|
+
while (match = lineRe.exec(string)) {
|
|
6064
|
+
const prefix = match[1];
|
|
6065
|
+
const line = match[2];
|
|
6066
|
+
moreIndented = line[0] === " ";
|
|
6067
|
+
result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? `
|
|
6068
|
+
` : "") + foldLine(line, width);
|
|
6069
|
+
prevMoreIndented = moreIndented;
|
|
6262
6070
|
}
|
|
6263
|
-
return
|
|
6071
|
+
return result;
|
|
6264
6072
|
}
|
|
6265
|
-
function
|
|
6266
|
-
if (
|
|
6267
|
-
|
|
6268
|
-
|
|
6073
|
+
function foldLine(line, width) {
|
|
6074
|
+
if (line === "" || line[0] === " ")
|
|
6075
|
+
return line;
|
|
6076
|
+
const breakRe = / [^ ]/g;
|
|
6077
|
+
let match;
|
|
6078
|
+
let start = 0;
|
|
6079
|
+
let end;
|
|
6080
|
+
let curr = 0;
|
|
6081
|
+
let next = 0;
|
|
6082
|
+
let result = "";
|
|
6083
|
+
while (match = breakRe.exec(line)) {
|
|
6084
|
+
next = match.index;
|
|
6085
|
+
if (next - start > width) {
|
|
6086
|
+
end = curr > start ? curr : next;
|
|
6087
|
+
result += `
|
|
6088
|
+
` + line.slice(start, end);
|
|
6089
|
+
start = end + 1;
|
|
6090
|
+
}
|
|
6091
|
+
curr = next;
|
|
6269
6092
|
}
|
|
6270
|
-
|
|
6271
|
-
|
|
6272
|
-
|
|
6093
|
+
result += `
|
|
6094
|
+
`;
|
|
6095
|
+
if (line.length - start > width && curr > start) {
|
|
6096
|
+
result += line.slice(start, curr) + `
|
|
6097
|
+
` + line.slice(curr + 1);
|
|
6098
|
+
} else {
|
|
6099
|
+
result += line.slice(start);
|
|
6273
6100
|
}
|
|
6274
|
-
|
|
6275
|
-
|
|
6101
|
+
return result.slice(1);
|
|
6102
|
+
}
|
|
6103
|
+
function escapeString(string) {
|
|
6104
|
+
let result = "";
|
|
6105
|
+
let char = 0;
|
|
6106
|
+
for (let i = 0;i < string.length; char >= 65536 ? i += 2 : i++) {
|
|
6107
|
+
char = codePointAt(string, i);
|
|
6108
|
+
const escapeSeq = ESCAPE_SEQUENCES[char];
|
|
6109
|
+
if (!escapeSeq && isPrintable(char)) {
|
|
6110
|
+
result += string[i];
|
|
6111
|
+
if (char >= 65536)
|
|
6112
|
+
result += string[i + 1];
|
|
6113
|
+
} else {
|
|
6114
|
+
result += escapeSeq || encodeHex(char);
|
|
6115
|
+
}
|
|
6276
6116
|
}
|
|
6117
|
+
return result;
|
|
6277
6118
|
}
|
|
6278
|
-
function
|
|
6279
|
-
|
|
6280
|
-
|
|
6281
|
-
|
|
6282
|
-
|
|
6283
|
-
|
|
6119
|
+
function writeFlowSequence(state, level, object) {
|
|
6120
|
+
let _result = "";
|
|
6121
|
+
const _tag = state.tag;
|
|
6122
|
+
for (let index = 0, length = object.length;index < length; index += 1) {
|
|
6123
|
+
let value = object[index];
|
|
6124
|
+
if (state.replacer) {
|
|
6125
|
+
value = state.replacer.call(object, String(index), value);
|
|
6126
|
+
}
|
|
6127
|
+
if (writeNode(state, level, value, false, false) || typeof value === "undefined" && writeNode(state, level, null, false, false)) {
|
|
6128
|
+
if (_result !== "")
|
|
6129
|
+
_result += "," + (!state.condenseFlow ? " " : "");
|
|
6130
|
+
_result += state.dump;
|
|
6131
|
+
}
|
|
6284
6132
|
}
|
|
6285
|
-
|
|
6133
|
+
state.tag = _tag;
|
|
6134
|
+
state.dump = "[" + _result + "]";
|
|
6286
6135
|
}
|
|
6287
|
-
|
|
6288
|
-
|
|
6289
|
-
|
|
6290
|
-
|
|
6291
|
-
|
|
6292
|
-
|
|
6293
|
-
|
|
6294
|
-
if (hasRequiredDumper)
|
|
6295
|
-
return dumper;
|
|
6296
|
-
hasRequiredDumper = 1;
|
|
6297
|
-
const common2 = requireCommon();
|
|
6298
|
-
const YAMLException2 = requireException();
|
|
6299
|
-
const DEFAULT_SCHEMA2 = require_default();
|
|
6300
|
-
const _toString = Object.prototype.toString;
|
|
6301
|
-
const _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
6302
|
-
const CHAR_BOM = 65279;
|
|
6303
|
-
const CHAR_TAB = 9;
|
|
6304
|
-
const CHAR_LINE_FEED = 10;
|
|
6305
|
-
const CHAR_CARRIAGE_RETURN = 13;
|
|
6306
|
-
const CHAR_SPACE = 32;
|
|
6307
|
-
const CHAR_EXCLAMATION = 33;
|
|
6308
|
-
const CHAR_DOUBLE_QUOTE = 34;
|
|
6309
|
-
const CHAR_SHARP = 35;
|
|
6310
|
-
const CHAR_PERCENT = 37;
|
|
6311
|
-
const CHAR_AMPERSAND = 38;
|
|
6312
|
-
const CHAR_SINGLE_QUOTE = 39;
|
|
6313
|
-
const CHAR_ASTERISK = 42;
|
|
6314
|
-
const CHAR_COMMA = 44;
|
|
6315
|
-
const CHAR_MINUS = 45;
|
|
6316
|
-
const CHAR_COLON = 58;
|
|
6317
|
-
const CHAR_EQUALS = 61;
|
|
6318
|
-
const CHAR_GREATER_THAN = 62;
|
|
6319
|
-
const CHAR_QUESTION = 63;
|
|
6320
|
-
const CHAR_COMMERCIAL_AT = 64;
|
|
6321
|
-
const CHAR_LEFT_SQUARE_BRACKET = 91;
|
|
6322
|
-
const CHAR_RIGHT_SQUARE_BRACKET = 93;
|
|
6323
|
-
const CHAR_GRAVE_ACCENT = 96;
|
|
6324
|
-
const CHAR_LEFT_CURLY_BRACKET = 123;
|
|
6325
|
-
const CHAR_VERTICAL_LINE = 124;
|
|
6326
|
-
const CHAR_RIGHT_CURLY_BRACKET = 125;
|
|
6327
|
-
const ESCAPE_SEQUENCES = {};
|
|
6328
|
-
ESCAPE_SEQUENCES[0] = "\\0";
|
|
6329
|
-
ESCAPE_SEQUENCES[7] = "\\a";
|
|
6330
|
-
ESCAPE_SEQUENCES[8] = "\\b";
|
|
6331
|
-
ESCAPE_SEQUENCES[9] = "\\t";
|
|
6332
|
-
ESCAPE_SEQUENCES[10] = "\\n";
|
|
6333
|
-
ESCAPE_SEQUENCES[11] = "\\v";
|
|
6334
|
-
ESCAPE_SEQUENCES[12] = "\\f";
|
|
6335
|
-
ESCAPE_SEQUENCES[13] = "\\r";
|
|
6336
|
-
ESCAPE_SEQUENCES[27] = "\\e";
|
|
6337
|
-
ESCAPE_SEQUENCES[34] = "\\\"";
|
|
6338
|
-
ESCAPE_SEQUENCES[92] = "\\\\";
|
|
6339
|
-
ESCAPE_SEQUENCES[133] = "\\N";
|
|
6340
|
-
ESCAPE_SEQUENCES[160] = "\\_";
|
|
6341
|
-
ESCAPE_SEQUENCES[8232] = "\\L";
|
|
6342
|
-
ESCAPE_SEQUENCES[8233] = "\\P";
|
|
6343
|
-
const DEPRECATED_BOOLEANS_SYNTAX = [
|
|
6344
|
-
"y",
|
|
6345
|
-
"Y",
|
|
6346
|
-
"yes",
|
|
6347
|
-
"Yes",
|
|
6348
|
-
"YES",
|
|
6349
|
-
"on",
|
|
6350
|
-
"On",
|
|
6351
|
-
"ON",
|
|
6352
|
-
"n",
|
|
6353
|
-
"N",
|
|
6354
|
-
"no",
|
|
6355
|
-
"No",
|
|
6356
|
-
"NO",
|
|
6357
|
-
"off",
|
|
6358
|
-
"Off",
|
|
6359
|
-
"OFF"
|
|
6360
|
-
];
|
|
6361
|
-
const DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
|
|
6362
|
-
function compileStyleMap(schema2, map2) {
|
|
6363
|
-
if (map2 === null)
|
|
6364
|
-
return {};
|
|
6365
|
-
const result = {};
|
|
6366
|
-
const keys = Object.keys(map2);
|
|
6367
|
-
for (let index = 0, length = keys.length;index < length; index += 1) {
|
|
6368
|
-
let tag = keys[index];
|
|
6369
|
-
let style = String(map2[tag]);
|
|
6370
|
-
if (tag.slice(0, 2) === "!!") {
|
|
6371
|
-
tag = "tag:yaml.org,2002:" + tag.slice(2);
|
|
6136
|
+
function writeBlockSequence(state, level, object, compact) {
|
|
6137
|
+
let _result = "";
|
|
6138
|
+
const _tag = state.tag;
|
|
6139
|
+
for (let index = 0, length = object.length;index < length; index += 1) {
|
|
6140
|
+
let value = object[index];
|
|
6141
|
+
if (state.replacer) {
|
|
6142
|
+
value = state.replacer.call(object, String(index), value);
|
|
6372
6143
|
}
|
|
6373
|
-
|
|
6374
|
-
|
|
6375
|
-
|
|
6144
|
+
if (writeNode(state, level + 1, value, true, true, false, true) || typeof value === "undefined" && writeNode(state, level + 1, null, true, true, false, true)) {
|
|
6145
|
+
if (!compact || _result !== "") {
|
|
6146
|
+
_result += generateNextLine(state, level);
|
|
6147
|
+
}
|
|
6148
|
+
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
6149
|
+
_result += "-";
|
|
6150
|
+
} else {
|
|
6151
|
+
_result += "- ";
|
|
6152
|
+
}
|
|
6153
|
+
_result += state.dump;
|
|
6376
6154
|
}
|
|
6377
|
-
result[tag] = style;
|
|
6378
6155
|
}
|
|
6379
|
-
|
|
6156
|
+
state.tag = _tag;
|
|
6157
|
+
state.dump = _result || "[]";
|
|
6380
6158
|
}
|
|
6381
|
-
function
|
|
6382
|
-
let
|
|
6383
|
-
|
|
6384
|
-
const
|
|
6385
|
-
|
|
6386
|
-
|
|
6387
|
-
|
|
6388
|
-
|
|
6389
|
-
|
|
6390
|
-
|
|
6391
|
-
|
|
6392
|
-
|
|
6393
|
-
|
|
6394
|
-
|
|
6395
|
-
|
|
6159
|
+
function writeFlowMapping(state, level, object) {
|
|
6160
|
+
let _result = "";
|
|
6161
|
+
const _tag = state.tag;
|
|
6162
|
+
const objectKeyList = Object.keys(object);
|
|
6163
|
+
for (let index = 0, length = objectKeyList.length;index < length; index += 1) {
|
|
6164
|
+
let pairBuffer = "";
|
|
6165
|
+
if (_result !== "")
|
|
6166
|
+
pairBuffer += ", ";
|
|
6167
|
+
if (state.condenseFlow)
|
|
6168
|
+
pairBuffer += '"';
|
|
6169
|
+
const objectKey = objectKeyList[index];
|
|
6170
|
+
let objectValue = object[objectKey];
|
|
6171
|
+
if (state.replacer) {
|
|
6172
|
+
objectValue = state.replacer.call(object, objectKey, objectValue);
|
|
6173
|
+
}
|
|
6174
|
+
if (!writeNode(state, level, objectKey, false, false)) {
|
|
6175
|
+
continue;
|
|
6176
|
+
}
|
|
6177
|
+
if (state.dump.length > 1024)
|
|
6178
|
+
pairBuffer += "? ";
|
|
6179
|
+
pairBuffer += state.dump + (state.condenseFlow ? '"' : "") + ":" + (state.condenseFlow ? "" : " ");
|
|
6180
|
+
if (!writeNode(state, level, objectValue, false, false)) {
|
|
6181
|
+
continue;
|
|
6182
|
+
}
|
|
6183
|
+
pairBuffer += state.dump;
|
|
6184
|
+
_result += pairBuffer;
|
|
6396
6185
|
}
|
|
6397
|
-
|
|
6398
|
-
|
|
6399
|
-
const QUOTING_TYPE_SINGLE = 1;
|
|
6400
|
-
const QUOTING_TYPE_DOUBLE = 2;
|
|
6401
|
-
function State(options) {
|
|
6402
|
-
this.schema = options["schema"] || DEFAULT_SCHEMA2;
|
|
6403
|
-
this.indent = Math.max(1, options["indent"] || 2);
|
|
6404
|
-
this.noArrayIndent = options["noArrayIndent"] || false;
|
|
6405
|
-
this.skipInvalid = options["skipInvalid"] || false;
|
|
6406
|
-
this.flowLevel = common2.isNothing(options["flowLevel"]) ? -1 : options["flowLevel"];
|
|
6407
|
-
this.styleMap = compileStyleMap(this.schema, options["styles"] || null);
|
|
6408
|
-
this.sortKeys = options["sortKeys"] || false;
|
|
6409
|
-
this.lineWidth = options["lineWidth"] || 80;
|
|
6410
|
-
this.noRefs = options["noRefs"] || false;
|
|
6411
|
-
this.noCompatMode = options["noCompatMode"] || false;
|
|
6412
|
-
this.condenseFlow = options["condenseFlow"] || false;
|
|
6413
|
-
this.quotingType = options["quotingType"] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE;
|
|
6414
|
-
this.forceQuotes = options["forceQuotes"] || false;
|
|
6415
|
-
this.replacer = typeof options["replacer"] === "function" ? options["replacer"] : null;
|
|
6416
|
-
this.implicitTypes = this.schema.compiledImplicit;
|
|
6417
|
-
this.explicitTypes = this.schema.compiledExplicit;
|
|
6418
|
-
this.tag = null;
|
|
6419
|
-
this.result = "";
|
|
6420
|
-
this.duplicates = [];
|
|
6421
|
-
this.usedDuplicates = null;
|
|
6186
|
+
state.tag = _tag;
|
|
6187
|
+
state.dump = "{" + _result + "}";
|
|
6422
6188
|
}
|
|
6423
|
-
function
|
|
6424
|
-
|
|
6425
|
-
|
|
6426
|
-
|
|
6427
|
-
|
|
6428
|
-
|
|
6429
|
-
|
|
6430
|
-
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
|
|
6189
|
+
function writeBlockMapping(state, level, object, compact) {
|
|
6190
|
+
let _result = "";
|
|
6191
|
+
const _tag = state.tag;
|
|
6192
|
+
const objectKeyList = Object.keys(object);
|
|
6193
|
+
if (state.sortKeys === true) {
|
|
6194
|
+
objectKeyList.sort();
|
|
6195
|
+
} else if (typeof state.sortKeys === "function") {
|
|
6196
|
+
objectKeyList.sort(state.sortKeys);
|
|
6197
|
+
} else if (state.sortKeys) {
|
|
6198
|
+
throw new YAMLException2("sortKeys must be a boolean or a function");
|
|
6199
|
+
}
|
|
6200
|
+
for (let index = 0, length = objectKeyList.length;index < length; index += 1) {
|
|
6201
|
+
let pairBuffer = "";
|
|
6202
|
+
if (!compact || _result !== "") {
|
|
6203
|
+
pairBuffer += generateNextLine(state, level);
|
|
6204
|
+
}
|
|
6205
|
+
const objectKey = objectKeyList[index];
|
|
6206
|
+
let objectValue = object[objectKey];
|
|
6207
|
+
if (state.replacer) {
|
|
6208
|
+
objectValue = state.replacer.call(object, objectKey, objectValue);
|
|
6209
|
+
}
|
|
6210
|
+
if (!writeNode(state, level + 1, objectKey, true, true, true)) {
|
|
6211
|
+
continue;
|
|
6212
|
+
}
|
|
6213
|
+
const explicitPair = state.tag !== null && state.tag !== "?" || state.dump && state.dump.length > 1024;
|
|
6214
|
+
if (explicitPair) {
|
|
6215
|
+
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
6216
|
+
pairBuffer += "?";
|
|
6217
|
+
} else {
|
|
6218
|
+
pairBuffer += "? ";
|
|
6219
|
+
}
|
|
6220
|
+
}
|
|
6221
|
+
pairBuffer += state.dump;
|
|
6222
|
+
if (explicitPair) {
|
|
6223
|
+
pairBuffer += generateNextLine(state, level);
|
|
6224
|
+
}
|
|
6225
|
+
if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
|
|
6226
|
+
continue;
|
|
6227
|
+
}
|
|
6228
|
+
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
6229
|
+
pairBuffer += ":";
|
|
6435
6230
|
} else {
|
|
6436
|
-
|
|
6437
|
-
position = next + 1;
|
|
6231
|
+
pairBuffer += ": ";
|
|
6438
6232
|
}
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
result += ind;
|
|
6442
|
-
result += line;
|
|
6233
|
+
pairBuffer += state.dump;
|
|
6234
|
+
_result += pairBuffer;
|
|
6443
6235
|
}
|
|
6444
|
-
|
|
6445
|
-
|
|
6446
|
-
function generateNextLine(state, level) {
|
|
6447
|
-
return `
|
|
6448
|
-
` + common2.repeat(" ", state.indent * level);
|
|
6236
|
+
state.tag = _tag;
|
|
6237
|
+
state.dump = _result || "{}";
|
|
6449
6238
|
}
|
|
6450
|
-
function
|
|
6451
|
-
|
|
6452
|
-
|
|
6453
|
-
|
|
6239
|
+
function detectType(state, object, explicit) {
|
|
6240
|
+
const typeList = explicit ? state.explicitTypes : state.implicitTypes;
|
|
6241
|
+
for (let index = 0, length = typeList.length;index < length; index += 1) {
|
|
6242
|
+
const type2 = typeList[index];
|
|
6243
|
+
if ((type2.instanceOf || type2.predicate) && (!type2.instanceOf || typeof object === "object" && object instanceof type2.instanceOf) && (!type2.predicate || type2.predicate(object))) {
|
|
6244
|
+
if (explicit) {
|
|
6245
|
+
if (type2.multi && type2.representName) {
|
|
6246
|
+
state.tag = type2.representName(object);
|
|
6247
|
+
} else {
|
|
6248
|
+
state.tag = type2.tag;
|
|
6249
|
+
}
|
|
6250
|
+
} else {
|
|
6251
|
+
state.tag = "?";
|
|
6252
|
+
}
|
|
6253
|
+
if (type2.represent) {
|
|
6254
|
+
const style = state.styleMap[type2.tag] || type2.defaultStyle;
|
|
6255
|
+
let _result;
|
|
6256
|
+
if (_toString.call(type2.represent) === "[object Function]") {
|
|
6257
|
+
_result = type2.represent(object, style);
|
|
6258
|
+
} else if (_hasOwnProperty.call(type2.represent, style)) {
|
|
6259
|
+
_result = type2.represent[style](object, style);
|
|
6260
|
+
} else {
|
|
6261
|
+
throw new YAMLException2("!<" + type2.tag + '> tag resolver accepts not "' + style + '" style');
|
|
6262
|
+
}
|
|
6263
|
+
state.dump = _result;
|
|
6264
|
+
}
|
|
6454
6265
|
return true;
|
|
6455
6266
|
}
|
|
6456
6267
|
}
|
|
6457
6268
|
return false;
|
|
6458
6269
|
}
|
|
6459
|
-
function
|
|
6460
|
-
|
|
6270
|
+
function writeNode(state, level, object, block, compact, iskey, isblockseq) {
|
|
6271
|
+
state.tag = null;
|
|
6272
|
+
state.dump = object;
|
|
6273
|
+
if (!detectType(state, object, false)) {
|
|
6274
|
+
detectType(state, object, true);
|
|
6275
|
+
}
|
|
6276
|
+
const type2 = _toString.call(state.dump);
|
|
6277
|
+
const inblock = block;
|
|
6278
|
+
if (block) {
|
|
6279
|
+
block = state.flowLevel < 0 || state.flowLevel > level;
|
|
6280
|
+
}
|
|
6281
|
+
const objectOrArray = type2 === "[object Object]" || type2 === "[object Array]";
|
|
6282
|
+
let duplicateIndex;
|
|
6283
|
+
let duplicate;
|
|
6284
|
+
if (objectOrArray) {
|
|
6285
|
+
duplicateIndex = state.duplicates.indexOf(object);
|
|
6286
|
+
duplicate = duplicateIndex !== -1;
|
|
6287
|
+
}
|
|
6288
|
+
if (state.tag !== null && state.tag !== "?" || duplicate || state.indent !== 2 && level > 0) {
|
|
6289
|
+
compact = false;
|
|
6290
|
+
}
|
|
6291
|
+
if (duplicate && state.usedDuplicates[duplicateIndex]) {
|
|
6292
|
+
state.dump = "*ref_" + duplicateIndex;
|
|
6293
|
+
} else {
|
|
6294
|
+
if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
|
|
6295
|
+
state.usedDuplicates[duplicateIndex] = true;
|
|
6296
|
+
}
|
|
6297
|
+
if (type2 === "[object Object]") {
|
|
6298
|
+
if (block && Object.keys(state.dump).length !== 0) {
|
|
6299
|
+
writeBlockMapping(state, level, state.dump, compact);
|
|
6300
|
+
if (duplicate) {
|
|
6301
|
+
state.dump = "&ref_" + duplicateIndex + state.dump;
|
|
6302
|
+
}
|
|
6303
|
+
} else {
|
|
6304
|
+
writeFlowMapping(state, level, state.dump);
|
|
6305
|
+
if (duplicate) {
|
|
6306
|
+
state.dump = "&ref_" + duplicateIndex + " " + state.dump;
|
|
6307
|
+
}
|
|
6308
|
+
}
|
|
6309
|
+
} else if (type2 === "[object Array]") {
|
|
6310
|
+
if (block && state.dump.length !== 0) {
|
|
6311
|
+
if (state.noArrayIndent && !isblockseq && level > 0) {
|
|
6312
|
+
writeBlockSequence(state, level - 1, state.dump, compact);
|
|
6313
|
+
} else {
|
|
6314
|
+
writeBlockSequence(state, level, state.dump, compact);
|
|
6315
|
+
}
|
|
6316
|
+
if (duplicate) {
|
|
6317
|
+
state.dump = "&ref_" + duplicateIndex + state.dump;
|
|
6318
|
+
}
|
|
6319
|
+
} else {
|
|
6320
|
+
writeFlowSequence(state, level, state.dump);
|
|
6321
|
+
if (duplicate) {
|
|
6322
|
+
state.dump = "&ref_" + duplicateIndex + " " + state.dump;
|
|
6323
|
+
}
|
|
6324
|
+
}
|
|
6325
|
+
} else if (type2 === "[object String]") {
|
|
6326
|
+
if (state.tag !== "?") {
|
|
6327
|
+
writeScalar(state, state.dump, level, iskey, inblock);
|
|
6328
|
+
}
|
|
6329
|
+
} else if (type2 === "[object Undefined]") {
|
|
6330
|
+
return false;
|
|
6331
|
+
} else {
|
|
6332
|
+
if (state.skipInvalid)
|
|
6333
|
+
return false;
|
|
6334
|
+
throw new YAMLException2("unacceptable kind of an object to dump " + type2);
|
|
6335
|
+
}
|
|
6336
|
+
if (state.tag !== null && state.tag !== "?") {
|
|
6337
|
+
let tagStr = encodeURI(state.tag[0] === "!" ? state.tag.slice(1) : state.tag).replace(/!/g, "%21");
|
|
6338
|
+
if (state.tag[0] === "!") {
|
|
6339
|
+
tagStr = "!" + tagStr;
|
|
6340
|
+
} else if (tagStr.slice(0, 18) === "tag:yaml.org,2002:") {
|
|
6341
|
+
tagStr = "!!" + tagStr.slice(18);
|
|
6342
|
+
} else {
|
|
6343
|
+
tagStr = "!<" + tagStr + ">";
|
|
6344
|
+
}
|
|
6345
|
+
state.dump = tagStr + " " + state.dump;
|
|
6346
|
+
}
|
|
6347
|
+
}
|
|
6348
|
+
return true;
|
|
6461
6349
|
}
|
|
6462
|
-
function
|
|
6463
|
-
|
|
6350
|
+
function getDuplicateReferences(object, state) {
|
|
6351
|
+
const objects = [];
|
|
6352
|
+
const duplicatesIndexes = [];
|
|
6353
|
+
inspectNode(object, objects, duplicatesIndexes);
|
|
6354
|
+
const length = duplicatesIndexes.length;
|
|
6355
|
+
for (let index = 0;index < length; index += 1) {
|
|
6356
|
+
state.duplicates.push(objects[duplicatesIndexes[index]]);
|
|
6357
|
+
}
|
|
6358
|
+
state.usedDuplicates = new Array(length);
|
|
6464
6359
|
}
|
|
6465
|
-
function
|
|
6466
|
-
|
|
6360
|
+
function inspectNode(object, objects, duplicatesIndexes) {
|
|
6361
|
+
if (object !== null && typeof object === "object") {
|
|
6362
|
+
const index = objects.indexOf(object);
|
|
6363
|
+
if (index !== -1) {
|
|
6364
|
+
if (duplicatesIndexes.indexOf(index) === -1) {
|
|
6365
|
+
duplicatesIndexes.push(index);
|
|
6366
|
+
}
|
|
6367
|
+
} else {
|
|
6368
|
+
objects.push(object);
|
|
6369
|
+
if (Array.isArray(object)) {
|
|
6370
|
+
for (let i = 0, length = object.length;i < length; i += 1) {
|
|
6371
|
+
inspectNode(object[i], objects, duplicatesIndexes);
|
|
6372
|
+
}
|
|
6373
|
+
} else {
|
|
6374
|
+
const objectKeyList = Object.keys(object);
|
|
6375
|
+
for (let i = 0, length = objectKeyList.length;i < length; i += 1) {
|
|
6376
|
+
inspectNode(object[objectKeyList[i]], objects, duplicatesIndexes);
|
|
6377
|
+
}
|
|
6378
|
+
}
|
|
6379
|
+
}
|
|
6380
|
+
}
|
|
6467
6381
|
}
|
|
6468
|
-
function
|
|
6469
|
-
|
|
6470
|
-
const
|
|
6471
|
-
|
|
6382
|
+
function dump2(input, options) {
|
|
6383
|
+
options = options || {};
|
|
6384
|
+
const state = new State(options);
|
|
6385
|
+
if (!state.noRefs)
|
|
6386
|
+
getDuplicateReferences(input, state);
|
|
6387
|
+
let value = input;
|
|
6388
|
+
if (state.replacer) {
|
|
6389
|
+
value = state.replacer.call({ "": value }, "", value);
|
|
6390
|
+
}
|
|
6391
|
+
if (writeNode(state, 0, value, true, true))
|
|
6392
|
+
return state.dump + `
|
|
6393
|
+
`;
|
|
6394
|
+
return "";
|
|
6472
6395
|
}
|
|
6473
|
-
|
|
6474
|
-
|
|
6396
|
+
dumper.dump = dump2;
|
|
6397
|
+
return dumper;
|
|
6398
|
+
}
|
|
6399
|
+
var hasRequiredJsYaml;
|
|
6400
|
+
function requireJsYaml() {
|
|
6401
|
+
if (hasRequiredJsYaml)
|
|
6402
|
+
return jsYaml;
|
|
6403
|
+
hasRequiredJsYaml = 1;
|
|
6404
|
+
const loader2 = requireLoader();
|
|
6405
|
+
const dumper2 = requireDumper();
|
|
6406
|
+
function renamed(from, to) {
|
|
6407
|
+
return function() {
|
|
6408
|
+
throw new Error("Function yaml." + from + " is removed in js-yaml 4. Use yaml." + to + " instead, which is now safe by default.");
|
|
6409
|
+
};
|
|
6475
6410
|
}
|
|
6476
|
-
|
|
6477
|
-
|
|
6411
|
+
jsYaml.Type = requireType();
|
|
6412
|
+
jsYaml.Schema = requireSchema();
|
|
6413
|
+
jsYaml.FAILSAFE_SCHEMA = requireFailsafe();
|
|
6414
|
+
jsYaml.JSON_SCHEMA = requireJson();
|
|
6415
|
+
jsYaml.CORE_SCHEMA = requireCore();
|
|
6416
|
+
jsYaml.DEFAULT_SCHEMA = require_default();
|
|
6417
|
+
jsYaml.load = loader2.load;
|
|
6418
|
+
jsYaml.loadAll = loader2.loadAll;
|
|
6419
|
+
jsYaml.dump = dumper2.dump;
|
|
6420
|
+
jsYaml.YAMLException = requireException();
|
|
6421
|
+
jsYaml.types = {
|
|
6422
|
+
binary: requireBinary(),
|
|
6423
|
+
float: requireFloat(),
|
|
6424
|
+
map: requireMap(),
|
|
6425
|
+
null: require_null(),
|
|
6426
|
+
pairs: requirePairs(),
|
|
6427
|
+
set: requireSet(),
|
|
6428
|
+
timestamp: requireTimestamp(),
|
|
6429
|
+
bool: requireBool(),
|
|
6430
|
+
int: requireInt(),
|
|
6431
|
+
merge: requireMerge(),
|
|
6432
|
+
omap: requireOmap(),
|
|
6433
|
+
seq: requireSeq(),
|
|
6434
|
+
str: requireStr()
|
|
6435
|
+
};
|
|
6436
|
+
jsYaml.safeLoad = renamed("safeLoad", "load");
|
|
6437
|
+
jsYaml.safeLoadAll = renamed("safeLoadAll", "loadAll");
|
|
6438
|
+
jsYaml.safeDump = renamed("safeDump", "dump");
|
|
6439
|
+
return jsYaml;
|
|
6440
|
+
}
|
|
6441
|
+
var jsYamlExports = requireJsYaml();
|
|
6442
|
+
var yaml = /* @__PURE__ */ getDefaultExportFromCjs(jsYamlExports);
|
|
6443
|
+
var {
|
|
6444
|
+
Type,
|
|
6445
|
+
Schema,
|
|
6446
|
+
FAILSAFE_SCHEMA,
|
|
6447
|
+
JSON_SCHEMA,
|
|
6448
|
+
CORE_SCHEMA,
|
|
6449
|
+
DEFAULT_SCHEMA,
|
|
6450
|
+
load,
|
|
6451
|
+
loadAll,
|
|
6452
|
+
dump,
|
|
6453
|
+
YAMLException,
|
|
6454
|
+
types,
|
|
6455
|
+
safeLoad,
|
|
6456
|
+
safeLoadAll,
|
|
6457
|
+
safeDump
|
|
6458
|
+
} = yaml;
|
|
6459
|
+
|
|
6460
|
+
// ../../node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
6461
|
+
var ANSI_BACKGROUND_OFFSET = 10;
|
|
6462
|
+
var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
6463
|
+
var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
6464
|
+
var wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
|
|
6465
|
+
var styles = {
|
|
6466
|
+
modifier: {
|
|
6467
|
+
reset: [0, 0],
|
|
6468
|
+
bold: [1, 22],
|
|
6469
|
+
dim: [2, 22],
|
|
6470
|
+
italic: [3, 23],
|
|
6471
|
+
underline: [4, 24],
|
|
6472
|
+
overline: [53, 55],
|
|
6473
|
+
inverse: [7, 27],
|
|
6474
|
+
hidden: [8, 28],
|
|
6475
|
+
strikethrough: [9, 29]
|
|
6476
|
+
},
|
|
6477
|
+
color: {
|
|
6478
|
+
black: [30, 39],
|
|
6479
|
+
red: [31, 39],
|
|
6480
|
+
green: [32, 39],
|
|
6481
|
+
yellow: [33, 39],
|
|
6482
|
+
blue: [34, 39],
|
|
6483
|
+
magenta: [35, 39],
|
|
6484
|
+
cyan: [36, 39],
|
|
6485
|
+
white: [37, 39],
|
|
6486
|
+
blackBright: [90, 39],
|
|
6487
|
+
gray: [90, 39],
|
|
6488
|
+
grey: [90, 39],
|
|
6489
|
+
redBright: [91, 39],
|
|
6490
|
+
greenBright: [92, 39],
|
|
6491
|
+
yellowBright: [93, 39],
|
|
6492
|
+
blueBright: [94, 39],
|
|
6493
|
+
magentaBright: [95, 39],
|
|
6494
|
+
cyanBright: [96, 39],
|
|
6495
|
+
whiteBright: [97, 39]
|
|
6496
|
+
},
|
|
6497
|
+
bgColor: {
|
|
6498
|
+
bgBlack: [40, 49],
|
|
6499
|
+
bgRed: [41, 49],
|
|
6500
|
+
bgGreen: [42, 49],
|
|
6501
|
+
bgYellow: [43, 49],
|
|
6502
|
+
bgBlue: [44, 49],
|
|
6503
|
+
bgMagenta: [45, 49],
|
|
6504
|
+
bgCyan: [46, 49],
|
|
6505
|
+
bgWhite: [47, 49],
|
|
6506
|
+
bgBlackBright: [100, 49],
|
|
6507
|
+
bgGray: [100, 49],
|
|
6508
|
+
bgGrey: [100, 49],
|
|
6509
|
+
bgRedBright: [101, 49],
|
|
6510
|
+
bgGreenBright: [102, 49],
|
|
6511
|
+
bgYellowBright: [103, 49],
|
|
6512
|
+
bgBlueBright: [104, 49],
|
|
6513
|
+
bgMagentaBright: [105, 49],
|
|
6514
|
+
bgCyanBright: [106, 49],
|
|
6515
|
+
bgWhiteBright: [107, 49]
|
|
6478
6516
|
}
|
|
6479
|
-
|
|
6480
|
-
|
|
6481
|
-
|
|
6482
|
-
|
|
6483
|
-
|
|
6484
|
-
|
|
6485
|
-
|
|
6486
|
-
|
|
6517
|
+
};
|
|
6518
|
+
var modifierNames = Object.keys(styles.modifier);
|
|
6519
|
+
var foregroundColorNames = Object.keys(styles.color);
|
|
6520
|
+
var backgroundColorNames = Object.keys(styles.bgColor);
|
|
6521
|
+
var colorNames = [...foregroundColorNames, ...backgroundColorNames];
|
|
6522
|
+
function assembleStyles() {
|
|
6523
|
+
const codes = new Map;
|
|
6524
|
+
for (const [groupName, group] of Object.entries(styles)) {
|
|
6525
|
+
for (const [styleName, style] of Object.entries(group)) {
|
|
6526
|
+
styles[styleName] = {
|
|
6527
|
+
open: `\x1B[${style[0]}m`,
|
|
6528
|
+
close: `\x1B[${style[1]}m`
|
|
6529
|
+
};
|
|
6530
|
+
group[styleName] = styles[styleName];
|
|
6531
|
+
codes.set(style[0], style[1]);
|
|
6487
6532
|
}
|
|
6488
|
-
|
|
6489
|
-
|
|
6490
|
-
|
|
6491
|
-
|
|
6492
|
-
return leadingSpaceRe.test(string);
|
|
6533
|
+
Object.defineProperty(styles, groupName, {
|
|
6534
|
+
value: group,
|
|
6535
|
+
enumerable: false
|
|
6536
|
+
});
|
|
6493
6537
|
}
|
|
6494
|
-
|
|
6495
|
-
|
|
6496
|
-
|
|
6497
|
-
|
|
6498
|
-
|
|
6499
|
-
|
|
6500
|
-
|
|
6501
|
-
|
|
6502
|
-
|
|
6503
|
-
|
|
6504
|
-
|
|
6505
|
-
|
|
6506
|
-
|
|
6507
|
-
|
|
6508
|
-
|
|
6509
|
-
|
|
6510
|
-
|
|
6511
|
-
|
|
6512
|
-
return STYLE_DOUBLE;
|
|
6513
|
-
}
|
|
6514
|
-
plain = plain && isPlainSafe(char, prevChar, inblock);
|
|
6515
|
-
prevChar = char;
|
|
6516
|
-
}
|
|
6517
|
-
} else {
|
|
6518
|
-
for (i = 0;i < string.length; char >= 65536 ? i += 2 : i++) {
|
|
6519
|
-
char = codePointAt(string, i);
|
|
6520
|
-
if (char === CHAR_LINE_FEED) {
|
|
6521
|
-
hasLineBreak = true;
|
|
6522
|
-
if (shouldTrackWidth) {
|
|
6523
|
-
hasFoldableLine = hasFoldableLine || i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ";
|
|
6524
|
-
previousLineBreak = i;
|
|
6538
|
+
Object.defineProperty(styles, "codes", {
|
|
6539
|
+
value: codes,
|
|
6540
|
+
enumerable: false
|
|
6541
|
+
});
|
|
6542
|
+
styles.color.close = "\x1B[39m";
|
|
6543
|
+
styles.bgColor.close = "\x1B[49m";
|
|
6544
|
+
styles.color.ansi = wrapAnsi16();
|
|
6545
|
+
styles.color.ansi256 = wrapAnsi256();
|
|
6546
|
+
styles.color.ansi16m = wrapAnsi16m();
|
|
6547
|
+
styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
|
6548
|
+
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
|
6549
|
+
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
|
6550
|
+
Object.defineProperties(styles, {
|
|
6551
|
+
rgbToAnsi256: {
|
|
6552
|
+
value(red, green, blue) {
|
|
6553
|
+
if (red === green && green === blue) {
|
|
6554
|
+
if (red < 8) {
|
|
6555
|
+
return 16;
|
|
6525
6556
|
}
|
|
6526
|
-
|
|
6527
|
-
|
|
6557
|
+
if (red > 248) {
|
|
6558
|
+
return 231;
|
|
6559
|
+
}
|
|
6560
|
+
return Math.round((red - 8) / 247 * 24) + 232;
|
|
6528
6561
|
}
|
|
6529
|
-
|
|
6530
|
-
|
|
6531
|
-
|
|
6532
|
-
|
|
6562
|
+
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
|
6563
|
+
},
|
|
6564
|
+
enumerable: false
|
|
6565
|
+
},
|
|
6566
|
+
hexToRgb: {
|
|
6567
|
+
value(hex) {
|
|
6568
|
+
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
|
6569
|
+
if (!matches) {
|
|
6570
|
+
return [0, 0, 0];
|
|
6571
|
+
}
|
|
6572
|
+
let [colorString] = matches;
|
|
6573
|
+
if (colorString.length === 3) {
|
|
6574
|
+
colorString = [...colorString].map((character) => character + character).join("");
|
|
6575
|
+
}
|
|
6576
|
+
const integer = Number.parseInt(colorString, 16);
|
|
6577
|
+
return [
|
|
6578
|
+
integer >> 16 & 255,
|
|
6579
|
+
integer >> 8 & 255,
|
|
6580
|
+
integer & 255
|
|
6581
|
+
];
|
|
6582
|
+
},
|
|
6583
|
+
enumerable: false
|
|
6584
|
+
},
|
|
6585
|
+
hexToAnsi256: {
|
|
6586
|
+
value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
|
|
6587
|
+
enumerable: false
|
|
6588
|
+
},
|
|
6589
|
+
ansi256ToAnsi: {
|
|
6590
|
+
value(code) {
|
|
6591
|
+
if (code < 8) {
|
|
6592
|
+
return 30 + code;
|
|
6593
|
+
}
|
|
6594
|
+
if (code < 16) {
|
|
6595
|
+
return 90 + (code - 8);
|
|
6596
|
+
}
|
|
6597
|
+
let red;
|
|
6598
|
+
let green;
|
|
6599
|
+
let blue;
|
|
6600
|
+
if (code >= 232) {
|
|
6601
|
+
red = ((code - 232) * 10 + 8) / 255;
|
|
6602
|
+
green = red;
|
|
6603
|
+
blue = red;
|
|
6604
|
+
} else {
|
|
6605
|
+
code -= 16;
|
|
6606
|
+
const remainder = code % 36;
|
|
6607
|
+
red = Math.floor(code / 36) / 5;
|
|
6608
|
+
green = Math.floor(remainder / 6) / 5;
|
|
6609
|
+
blue = remainder % 6 / 5;
|
|
6610
|
+
}
|
|
6611
|
+
const value = Math.max(red, green, blue) * 2;
|
|
6612
|
+
if (value === 0) {
|
|
6613
|
+
return 30;
|
|
6614
|
+
}
|
|
6615
|
+
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
|
6616
|
+
if (value === 2) {
|
|
6617
|
+
result += 60;
|
|
6618
|
+
}
|
|
6619
|
+
return result;
|
|
6620
|
+
},
|
|
6621
|
+
enumerable: false
|
|
6622
|
+
},
|
|
6623
|
+
rgbToAnsi: {
|
|
6624
|
+
value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
|
|
6625
|
+
enumerable: false
|
|
6626
|
+
},
|
|
6627
|
+
hexToAnsi: {
|
|
6628
|
+
value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
|
|
6629
|
+
enumerable: false
|
|
6533
6630
|
}
|
|
6534
|
-
|
|
6535
|
-
|
|
6536
|
-
|
|
6537
|
-
|
|
6538
|
-
|
|
6631
|
+
});
|
|
6632
|
+
return styles;
|
|
6633
|
+
}
|
|
6634
|
+
var ansiStyles = assembleStyles();
|
|
6635
|
+
var ansi_styles_default = ansiStyles;
|
|
6636
|
+
|
|
6637
|
+
// ../../node_modules/chalk/source/vendor/supports-color/index.js
|
|
6638
|
+
import process2 from "node:process";
|
|
6639
|
+
import os from "node:os";
|
|
6640
|
+
import tty from "node:tty";
|
|
6641
|
+
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process2.argv) {
|
|
6642
|
+
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
6643
|
+
const position = argv.indexOf(prefix + flag);
|
|
6644
|
+
const terminatorPosition = argv.indexOf("--");
|
|
6645
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
6646
|
+
}
|
|
6647
|
+
var { env } = process2;
|
|
6648
|
+
var flagForceColor;
|
|
6649
|
+
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
|
6650
|
+
flagForceColor = 0;
|
|
6651
|
+
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
6652
|
+
flagForceColor = 1;
|
|
6653
|
+
}
|
|
6654
|
+
function envForceColor() {
|
|
6655
|
+
if ("FORCE_COLOR" in env) {
|
|
6656
|
+
if (env.FORCE_COLOR === "true") {
|
|
6657
|
+
return 1;
|
|
6539
6658
|
}
|
|
6540
|
-
if (
|
|
6541
|
-
return
|
|
6659
|
+
if (env.FORCE_COLOR === "false") {
|
|
6660
|
+
return 0;
|
|
6661
|
+
}
|
|
6662
|
+
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
6663
|
+
}
|
|
6664
|
+
}
|
|
6665
|
+
function translateLevel(level) {
|
|
6666
|
+
if (level === 0) {
|
|
6667
|
+
return false;
|
|
6668
|
+
}
|
|
6669
|
+
return {
|
|
6670
|
+
level,
|
|
6671
|
+
hasBasic: true,
|
|
6672
|
+
has256: level >= 2,
|
|
6673
|
+
has16m: level >= 3
|
|
6674
|
+
};
|
|
6675
|
+
}
|
|
6676
|
+
function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
6677
|
+
const noFlagForceColor = envForceColor();
|
|
6678
|
+
if (noFlagForceColor !== undefined) {
|
|
6679
|
+
flagForceColor = noFlagForceColor;
|
|
6680
|
+
}
|
|
6681
|
+
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
6682
|
+
if (forceColor === 0) {
|
|
6683
|
+
return 0;
|
|
6684
|
+
}
|
|
6685
|
+
if (sniffFlags) {
|
|
6686
|
+
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
6687
|
+
return 3;
|
|
6542
6688
|
}
|
|
6543
|
-
if (
|
|
6544
|
-
return
|
|
6689
|
+
if (hasFlag("color=256")) {
|
|
6690
|
+
return 2;
|
|
6545
6691
|
}
|
|
6546
|
-
return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
|
|
6547
6692
|
}
|
|
6548
|
-
|
|
6549
|
-
|
|
6550
|
-
if (string.length === 0) {
|
|
6551
|
-
return state.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''";
|
|
6552
|
-
}
|
|
6553
|
-
if (!state.noCompatMode) {
|
|
6554
|
-
if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) {
|
|
6555
|
-
return state.quotingType === QUOTING_TYPE_DOUBLE ? '"' + string + '"' : "'" + string + "'";
|
|
6556
|
-
}
|
|
6557
|
-
}
|
|
6558
|
-
const indent = state.indent * Math.max(1, level);
|
|
6559
|
-
const lineWidth = state.lineWidth === -1 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
|
|
6560
|
-
const singleLineOnly = iskey || state.flowLevel > -1 && level >= state.flowLevel;
|
|
6561
|
-
function testAmbiguity(string2) {
|
|
6562
|
-
return testImplicitResolving(state, string2);
|
|
6563
|
-
}
|
|
6564
|
-
switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity, state.quotingType, state.forceQuotes && !iskey, inblock)) {
|
|
6565
|
-
case STYLE_PLAIN:
|
|
6566
|
-
return string;
|
|
6567
|
-
case STYLE_SINGLE:
|
|
6568
|
-
return "'" + string.replace(/'/g, "''") + "'";
|
|
6569
|
-
case STYLE_LITERAL:
|
|
6570
|
-
return "|" + blockHeader(string, state.indent) + dropEndingNewline(indentString(string, indent));
|
|
6571
|
-
case STYLE_FOLDED:
|
|
6572
|
-
return ">" + blockHeader(string, state.indent) + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
|
|
6573
|
-
case STYLE_DOUBLE:
|
|
6574
|
-
return '"' + escapeString(string) + '"';
|
|
6575
|
-
default:
|
|
6576
|
-
throw new YAMLException2("impossible error: invalid scalar style");
|
|
6577
|
-
}
|
|
6578
|
-
}();
|
|
6693
|
+
if ("TF_BUILD" in env && "AGENT_NAME" in env) {
|
|
6694
|
+
return 1;
|
|
6579
6695
|
}
|
|
6580
|
-
|
|
6581
|
-
|
|
6582
|
-
const clip = string[string.length - 1] === `
|
|
6583
|
-
`;
|
|
6584
|
-
const keep = clip && (string[string.length - 2] === `
|
|
6585
|
-
` || string === `
|
|
6586
|
-
`);
|
|
6587
|
-
const chomp = keep ? "+" : clip ? "" : "-";
|
|
6588
|
-
return indentIndicator + chomp + `
|
|
6589
|
-
`;
|
|
6696
|
+
if (haveStream && !streamIsTTY && forceColor === undefined) {
|
|
6697
|
+
return 0;
|
|
6590
6698
|
}
|
|
6591
|
-
|
|
6592
|
-
|
|
6593
|
-
|
|
6699
|
+
const min = forceColor || 0;
|
|
6700
|
+
if (env.TERM === "dumb") {
|
|
6701
|
+
return min;
|
|
6594
6702
|
}
|
|
6595
|
-
|
|
6596
|
-
const
|
|
6597
|
-
|
|
6598
|
-
|
|
6599
|
-
`);
|
|
6600
|
-
nextLF = nextLF !== -1 ? nextLF : string.length;
|
|
6601
|
-
lineRe.lastIndex = nextLF;
|
|
6602
|
-
return foldLine(string.slice(0, nextLF), width);
|
|
6603
|
-
}();
|
|
6604
|
-
let prevMoreIndented = string[0] === `
|
|
6605
|
-
` || string[0] === " ";
|
|
6606
|
-
let moreIndented;
|
|
6607
|
-
let match;
|
|
6608
|
-
while (match = lineRe.exec(string)) {
|
|
6609
|
-
const prefix = match[1];
|
|
6610
|
-
const line = match[2];
|
|
6611
|
-
moreIndented = line[0] === " ";
|
|
6612
|
-
result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? `
|
|
6613
|
-
` : "") + foldLine(line, width);
|
|
6614
|
-
prevMoreIndented = moreIndented;
|
|
6703
|
+
if (process2.platform === "win32") {
|
|
6704
|
+
const osRelease = os.release().split(".");
|
|
6705
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
6706
|
+
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
6615
6707
|
}
|
|
6616
|
-
return
|
|
6708
|
+
return 1;
|
|
6617
6709
|
}
|
|
6618
|
-
|
|
6619
|
-
if (
|
|
6620
|
-
return
|
|
6621
|
-
const breakRe = / [^ ]/g;
|
|
6622
|
-
let match;
|
|
6623
|
-
let start = 0;
|
|
6624
|
-
let end;
|
|
6625
|
-
let curr = 0;
|
|
6626
|
-
let next = 0;
|
|
6627
|
-
let result = "";
|
|
6628
|
-
while (match = breakRe.exec(line)) {
|
|
6629
|
-
next = match.index;
|
|
6630
|
-
if (next - start > width) {
|
|
6631
|
-
end = curr > start ? curr : next;
|
|
6632
|
-
result += `
|
|
6633
|
-
` + line.slice(start, end);
|
|
6634
|
-
start = end + 1;
|
|
6635
|
-
}
|
|
6636
|
-
curr = next;
|
|
6637
|
-
}
|
|
6638
|
-
result += `
|
|
6639
|
-
`;
|
|
6640
|
-
if (line.length - start > width && curr > start) {
|
|
6641
|
-
result += line.slice(start, curr) + `
|
|
6642
|
-
` + line.slice(curr + 1);
|
|
6643
|
-
} else {
|
|
6644
|
-
result += line.slice(start);
|
|
6710
|
+
if ("CI" in env) {
|
|
6711
|
+
if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => (key in env))) {
|
|
6712
|
+
return 3;
|
|
6645
6713
|
}
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
function escapeString(string) {
|
|
6649
|
-
let result = "";
|
|
6650
|
-
let char = 0;
|
|
6651
|
-
for (let i = 0;i < string.length; char >= 65536 ? i += 2 : i++) {
|
|
6652
|
-
char = codePointAt(string, i);
|
|
6653
|
-
const escapeSeq = ESCAPE_SEQUENCES[char];
|
|
6654
|
-
if (!escapeSeq && isPrintable(char)) {
|
|
6655
|
-
result += string[i];
|
|
6656
|
-
if (char >= 65536)
|
|
6657
|
-
result += string[i + 1];
|
|
6658
|
-
} else {
|
|
6659
|
-
result += escapeSeq || encodeHex(char);
|
|
6660
|
-
}
|
|
6714
|
+
if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => (sign in env)) || env.CI_NAME === "codeship") {
|
|
6715
|
+
return 1;
|
|
6661
6716
|
}
|
|
6662
|
-
return
|
|
6717
|
+
return min;
|
|
6663
6718
|
}
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
const _tag = state.tag;
|
|
6667
|
-
for (let index = 0, length = object.length;index < length; index += 1) {
|
|
6668
|
-
let value = object[index];
|
|
6669
|
-
if (state.replacer) {
|
|
6670
|
-
value = state.replacer.call(object, String(index), value);
|
|
6671
|
-
}
|
|
6672
|
-
if (writeNode(state, level, value, false, false) || typeof value === "undefined" && writeNode(state, level, null, false, false)) {
|
|
6673
|
-
if (_result !== "")
|
|
6674
|
-
_result += "," + (!state.condenseFlow ? " " : "");
|
|
6675
|
-
_result += state.dump;
|
|
6676
|
-
}
|
|
6677
|
-
}
|
|
6678
|
-
state.tag = _tag;
|
|
6679
|
-
state.dump = "[" + _result + "]";
|
|
6719
|
+
if ("TEAMCITY_VERSION" in env) {
|
|
6720
|
+
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
6680
6721
|
}
|
|
6681
|
-
|
|
6682
|
-
|
|
6683
|
-
const _tag = state.tag;
|
|
6684
|
-
for (let index = 0, length = object.length;index < length; index += 1) {
|
|
6685
|
-
let value = object[index];
|
|
6686
|
-
if (state.replacer) {
|
|
6687
|
-
value = state.replacer.call(object, String(index), value);
|
|
6688
|
-
}
|
|
6689
|
-
if (writeNode(state, level + 1, value, true, true, false, true) || typeof value === "undefined" && writeNode(state, level + 1, null, true, true, false, true)) {
|
|
6690
|
-
if (!compact || _result !== "") {
|
|
6691
|
-
_result += generateNextLine(state, level);
|
|
6692
|
-
}
|
|
6693
|
-
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
6694
|
-
_result += "-";
|
|
6695
|
-
} else {
|
|
6696
|
-
_result += "- ";
|
|
6697
|
-
}
|
|
6698
|
-
_result += state.dump;
|
|
6699
|
-
}
|
|
6700
|
-
}
|
|
6701
|
-
state.tag = _tag;
|
|
6702
|
-
state.dump = _result || "[]";
|
|
6722
|
+
if (env.COLORTERM === "truecolor") {
|
|
6723
|
+
return 3;
|
|
6703
6724
|
}
|
|
6704
|
-
|
|
6705
|
-
|
|
6706
|
-
const _tag = state.tag;
|
|
6707
|
-
const objectKeyList = Object.keys(object);
|
|
6708
|
-
for (let index = 0, length = objectKeyList.length;index < length; index += 1) {
|
|
6709
|
-
let pairBuffer = "";
|
|
6710
|
-
if (_result !== "")
|
|
6711
|
-
pairBuffer += ", ";
|
|
6712
|
-
if (state.condenseFlow)
|
|
6713
|
-
pairBuffer += '"';
|
|
6714
|
-
const objectKey = objectKeyList[index];
|
|
6715
|
-
let objectValue = object[objectKey];
|
|
6716
|
-
if (state.replacer) {
|
|
6717
|
-
objectValue = state.replacer.call(object, objectKey, objectValue);
|
|
6718
|
-
}
|
|
6719
|
-
if (!writeNode(state, level, objectKey, false, false)) {
|
|
6720
|
-
continue;
|
|
6721
|
-
}
|
|
6722
|
-
if (state.dump.length > 1024)
|
|
6723
|
-
pairBuffer += "? ";
|
|
6724
|
-
pairBuffer += state.dump + (state.condenseFlow ? '"' : "") + ":" + (state.condenseFlow ? "" : " ");
|
|
6725
|
-
if (!writeNode(state, level, objectValue, false, false)) {
|
|
6726
|
-
continue;
|
|
6727
|
-
}
|
|
6728
|
-
pairBuffer += state.dump;
|
|
6729
|
-
_result += pairBuffer;
|
|
6730
|
-
}
|
|
6731
|
-
state.tag = _tag;
|
|
6732
|
-
state.dump = "{" + _result + "}";
|
|
6725
|
+
if (env.TERM === "xterm-kitty") {
|
|
6726
|
+
return 3;
|
|
6733
6727
|
}
|
|
6734
|
-
|
|
6735
|
-
|
|
6736
|
-
|
|
6737
|
-
|
|
6738
|
-
|
|
6739
|
-
|
|
6740
|
-
|
|
6741
|
-
|
|
6742
|
-
|
|
6743
|
-
|
|
6744
|
-
|
|
6745
|
-
for (let index = 0, length = objectKeyList.length;index < length; index += 1) {
|
|
6746
|
-
let pairBuffer = "";
|
|
6747
|
-
if (!compact || _result !== "") {
|
|
6748
|
-
pairBuffer += generateNextLine(state, level);
|
|
6749
|
-
}
|
|
6750
|
-
const objectKey = objectKeyList[index];
|
|
6751
|
-
let objectValue = object[objectKey];
|
|
6752
|
-
if (state.replacer) {
|
|
6753
|
-
objectValue = state.replacer.call(object, objectKey, objectValue);
|
|
6754
|
-
}
|
|
6755
|
-
if (!writeNode(state, level + 1, objectKey, true, true, true)) {
|
|
6756
|
-
continue;
|
|
6757
|
-
}
|
|
6758
|
-
const explicitPair = state.tag !== null && state.tag !== "?" || state.dump && state.dump.length > 1024;
|
|
6759
|
-
if (explicitPair) {
|
|
6760
|
-
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
6761
|
-
pairBuffer += "?";
|
|
6762
|
-
} else {
|
|
6763
|
-
pairBuffer += "? ";
|
|
6764
|
-
}
|
|
6765
|
-
}
|
|
6766
|
-
pairBuffer += state.dump;
|
|
6767
|
-
if (explicitPair) {
|
|
6768
|
-
pairBuffer += generateNextLine(state, level);
|
|
6769
|
-
}
|
|
6770
|
-
if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
|
|
6771
|
-
continue;
|
|
6728
|
+
if (env.TERM === "xterm-ghostty") {
|
|
6729
|
+
return 3;
|
|
6730
|
+
}
|
|
6731
|
+
if (env.TERM === "wezterm") {
|
|
6732
|
+
return 3;
|
|
6733
|
+
}
|
|
6734
|
+
if ("TERM_PROGRAM" in env) {
|
|
6735
|
+
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
6736
|
+
switch (env.TERM_PROGRAM) {
|
|
6737
|
+
case "iTerm.app": {
|
|
6738
|
+
return version >= 3 ? 3 : 2;
|
|
6772
6739
|
}
|
|
6773
|
-
|
|
6774
|
-
|
|
6775
|
-
} else {
|
|
6776
|
-
pairBuffer += ": ";
|
|
6740
|
+
case "Apple_Terminal": {
|
|
6741
|
+
return 2;
|
|
6777
6742
|
}
|
|
6778
|
-
pairBuffer += state.dump;
|
|
6779
|
-
_result += pairBuffer;
|
|
6780
6743
|
}
|
|
6781
|
-
state.tag = _tag;
|
|
6782
|
-
state.dump = _result || "{}";
|
|
6783
6744
|
}
|
|
6784
|
-
|
|
6785
|
-
|
|
6786
|
-
for (let index = 0, length = typeList.length;index < length; index += 1) {
|
|
6787
|
-
const type2 = typeList[index];
|
|
6788
|
-
if ((type2.instanceOf || type2.predicate) && (!type2.instanceOf || typeof object === "object" && object instanceof type2.instanceOf) && (!type2.predicate || type2.predicate(object))) {
|
|
6789
|
-
if (explicit) {
|
|
6790
|
-
if (type2.multi && type2.representName) {
|
|
6791
|
-
state.tag = type2.representName(object);
|
|
6792
|
-
} else {
|
|
6793
|
-
state.tag = type2.tag;
|
|
6794
|
-
}
|
|
6795
|
-
} else {
|
|
6796
|
-
state.tag = "?";
|
|
6797
|
-
}
|
|
6798
|
-
if (type2.represent) {
|
|
6799
|
-
const style = state.styleMap[type2.tag] || type2.defaultStyle;
|
|
6800
|
-
let _result;
|
|
6801
|
-
if (_toString.call(type2.represent) === "[object Function]") {
|
|
6802
|
-
_result = type2.represent(object, style);
|
|
6803
|
-
} else if (_hasOwnProperty.call(type2.represent, style)) {
|
|
6804
|
-
_result = type2.represent[style](object, style);
|
|
6805
|
-
} else {
|
|
6806
|
-
throw new YAMLException2("!<" + type2.tag + '> tag resolver accepts not "' + style + '" style');
|
|
6807
|
-
}
|
|
6808
|
-
state.dump = _result;
|
|
6809
|
-
}
|
|
6810
|
-
return true;
|
|
6811
|
-
}
|
|
6812
|
-
}
|
|
6813
|
-
return false;
|
|
6745
|
+
if (/-256(color)?$/i.test(env.TERM)) {
|
|
6746
|
+
return 2;
|
|
6814
6747
|
}
|
|
6815
|
-
|
|
6816
|
-
|
|
6817
|
-
|
|
6818
|
-
|
|
6819
|
-
|
|
6748
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
6749
|
+
return 1;
|
|
6750
|
+
}
|
|
6751
|
+
if ("COLORTERM" in env) {
|
|
6752
|
+
return 1;
|
|
6753
|
+
}
|
|
6754
|
+
return min;
|
|
6755
|
+
}
|
|
6756
|
+
function createSupportsColor(stream, options = {}) {
|
|
6757
|
+
const level = _supportsColor(stream, {
|
|
6758
|
+
streamIsTTY: stream && stream.isTTY,
|
|
6759
|
+
...options
|
|
6760
|
+
});
|
|
6761
|
+
return translateLevel(level);
|
|
6762
|
+
}
|
|
6763
|
+
var supportsColor = {
|
|
6764
|
+
stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
|
|
6765
|
+
stderr: createSupportsColor({ isTTY: tty.isatty(2) })
|
|
6766
|
+
};
|
|
6767
|
+
var supports_color_default = supportsColor;
|
|
6768
|
+
|
|
6769
|
+
// ../../node_modules/chalk/source/utilities.js
|
|
6770
|
+
function stringReplaceAll(string, substring, replacer) {
|
|
6771
|
+
let index = string.indexOf(substring);
|
|
6772
|
+
if (index === -1) {
|
|
6773
|
+
return string;
|
|
6774
|
+
}
|
|
6775
|
+
const substringLength = substring.length;
|
|
6776
|
+
let endIndex = 0;
|
|
6777
|
+
let returnValue = "";
|
|
6778
|
+
do {
|
|
6779
|
+
returnValue += string.slice(endIndex, index) + substring + replacer;
|
|
6780
|
+
endIndex = index + substringLength;
|
|
6781
|
+
index = string.indexOf(substring, endIndex);
|
|
6782
|
+
} while (index !== -1);
|
|
6783
|
+
returnValue += string.slice(endIndex);
|
|
6784
|
+
return returnValue;
|
|
6785
|
+
}
|
|
6786
|
+
function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
|
|
6787
|
+
let endIndex = 0;
|
|
6788
|
+
let returnValue = "";
|
|
6789
|
+
do {
|
|
6790
|
+
const gotCR = string[index - 1] === "\r";
|
|
6791
|
+
returnValue += string.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? `\r
|
|
6792
|
+
` : `
|
|
6793
|
+
`) + postfix;
|
|
6794
|
+
endIndex = index + 1;
|
|
6795
|
+
index = string.indexOf(`
|
|
6796
|
+
`, endIndex);
|
|
6797
|
+
} while (index !== -1);
|
|
6798
|
+
returnValue += string.slice(endIndex);
|
|
6799
|
+
return returnValue;
|
|
6800
|
+
}
|
|
6801
|
+
|
|
6802
|
+
// ../../node_modules/chalk/source/index.js
|
|
6803
|
+
var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
|
|
6804
|
+
var GENERATOR = Symbol("GENERATOR");
|
|
6805
|
+
var STYLER = Symbol("STYLER");
|
|
6806
|
+
var IS_EMPTY = Symbol("IS_EMPTY");
|
|
6807
|
+
var levelMapping = [
|
|
6808
|
+
"ansi",
|
|
6809
|
+
"ansi",
|
|
6810
|
+
"ansi256",
|
|
6811
|
+
"ansi16m"
|
|
6812
|
+
];
|
|
6813
|
+
var styles2 = Object.create(null);
|
|
6814
|
+
var applyOptions = (object, options = {}) => {
|
|
6815
|
+
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
|
6816
|
+
throw new Error("The `level` option should be an integer from 0 to 3");
|
|
6817
|
+
}
|
|
6818
|
+
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
6819
|
+
object.level = options.level === undefined ? colorLevel : options.level;
|
|
6820
|
+
};
|
|
6821
|
+
|
|
6822
|
+
class Chalk {
|
|
6823
|
+
constructor(options) {
|
|
6824
|
+
return chalkFactory(options);
|
|
6825
|
+
}
|
|
6826
|
+
}
|
|
6827
|
+
var chalkFactory = (options) => {
|
|
6828
|
+
const chalk = (...strings) => strings.join(" ");
|
|
6829
|
+
applyOptions(chalk, options);
|
|
6830
|
+
Object.setPrototypeOf(chalk, createChalk.prototype);
|
|
6831
|
+
return chalk;
|
|
6832
|
+
};
|
|
6833
|
+
function createChalk(options) {
|
|
6834
|
+
return chalkFactory(options);
|
|
6835
|
+
}
|
|
6836
|
+
Object.setPrototypeOf(createChalk.prototype, Function.prototype);
|
|
6837
|
+
for (const [styleName, style] of Object.entries(ansi_styles_default)) {
|
|
6838
|
+
styles2[styleName] = {
|
|
6839
|
+
get() {
|
|
6840
|
+
const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
|
|
6841
|
+
Object.defineProperty(this, styleName, { value: builder });
|
|
6842
|
+
return builder;
|
|
6820
6843
|
}
|
|
6821
|
-
|
|
6822
|
-
|
|
6823
|
-
|
|
6824
|
-
|
|
6844
|
+
};
|
|
6845
|
+
}
|
|
6846
|
+
styles2.visible = {
|
|
6847
|
+
get() {
|
|
6848
|
+
const builder = createBuilder(this, this[STYLER], true);
|
|
6849
|
+
Object.defineProperty(this, "visible", { value: builder });
|
|
6850
|
+
return builder;
|
|
6851
|
+
}
|
|
6852
|
+
};
|
|
6853
|
+
var getModelAnsi = (model, level, type, ...arguments_) => {
|
|
6854
|
+
if (model === "rgb") {
|
|
6855
|
+
if (level === "ansi16m") {
|
|
6856
|
+
return ansi_styles_default[type].ansi16m(...arguments_);
|
|
6825
6857
|
}
|
|
6826
|
-
|
|
6827
|
-
|
|
6828
|
-
let duplicate;
|
|
6829
|
-
if (objectOrArray) {
|
|
6830
|
-
duplicateIndex = state.duplicates.indexOf(object);
|
|
6831
|
-
duplicate = duplicateIndex !== -1;
|
|
6858
|
+
if (level === "ansi256") {
|
|
6859
|
+
return ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_));
|
|
6832
6860
|
}
|
|
6833
|
-
|
|
6834
|
-
|
|
6861
|
+
return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
|
|
6862
|
+
}
|
|
6863
|
+
if (model === "hex") {
|
|
6864
|
+
return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_));
|
|
6865
|
+
}
|
|
6866
|
+
return ansi_styles_default[type][model](...arguments_);
|
|
6867
|
+
};
|
|
6868
|
+
var usedModels = ["rgb", "hex", "ansi256"];
|
|
6869
|
+
for (const model of usedModels) {
|
|
6870
|
+
styles2[model] = {
|
|
6871
|
+
get() {
|
|
6872
|
+
const { level } = this;
|
|
6873
|
+
return function(...arguments_) {
|
|
6874
|
+
const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]);
|
|
6875
|
+
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
6876
|
+
};
|
|
6835
6877
|
}
|
|
6836
|
-
|
|
6837
|
-
|
|
6838
|
-
|
|
6839
|
-
|
|
6840
|
-
|
|
6841
|
-
|
|
6842
|
-
|
|
6843
|
-
|
|
6844
|
-
|
|
6845
|
-
if (duplicate) {
|
|
6846
|
-
state.dump = "&ref_" + duplicateIndex + state.dump;
|
|
6847
|
-
}
|
|
6848
|
-
} else {
|
|
6849
|
-
writeFlowMapping(state, level, state.dump);
|
|
6850
|
-
if (duplicate) {
|
|
6851
|
-
state.dump = "&ref_" + duplicateIndex + " " + state.dump;
|
|
6852
|
-
}
|
|
6853
|
-
}
|
|
6854
|
-
} else if (type2 === "[object Array]") {
|
|
6855
|
-
if (block && state.dump.length !== 0) {
|
|
6856
|
-
if (state.noArrayIndent && !isblockseq && level > 0) {
|
|
6857
|
-
writeBlockSequence(state, level - 1, state.dump, compact);
|
|
6858
|
-
} else {
|
|
6859
|
-
writeBlockSequence(state, level, state.dump, compact);
|
|
6860
|
-
}
|
|
6861
|
-
if (duplicate) {
|
|
6862
|
-
state.dump = "&ref_" + duplicateIndex + state.dump;
|
|
6863
|
-
}
|
|
6864
|
-
} else {
|
|
6865
|
-
writeFlowSequence(state, level, state.dump);
|
|
6866
|
-
if (duplicate) {
|
|
6867
|
-
state.dump = "&ref_" + duplicateIndex + " " + state.dump;
|
|
6868
|
-
}
|
|
6869
|
-
}
|
|
6870
|
-
} else if (type2 === "[object String]") {
|
|
6871
|
-
if (state.tag !== "?") {
|
|
6872
|
-
writeScalar(state, state.dump, level, iskey, inblock);
|
|
6873
|
-
}
|
|
6874
|
-
} else if (type2 === "[object Undefined]") {
|
|
6875
|
-
return false;
|
|
6876
|
-
} else {
|
|
6877
|
-
if (state.skipInvalid)
|
|
6878
|
-
return false;
|
|
6879
|
-
throw new YAMLException2("unacceptable kind of an object to dump " + type2);
|
|
6880
|
-
}
|
|
6881
|
-
if (state.tag !== null && state.tag !== "?") {
|
|
6882
|
-
let tagStr = encodeURI(state.tag[0] === "!" ? state.tag.slice(1) : state.tag).replace(/!/g, "%21");
|
|
6883
|
-
if (state.tag[0] === "!") {
|
|
6884
|
-
tagStr = "!" + tagStr;
|
|
6885
|
-
} else if (tagStr.slice(0, 18) === "tag:yaml.org,2002:") {
|
|
6886
|
-
tagStr = "!!" + tagStr.slice(18);
|
|
6887
|
-
} else {
|
|
6888
|
-
tagStr = "!<" + tagStr + ">";
|
|
6889
|
-
}
|
|
6890
|
-
state.dump = tagStr + " " + state.dump;
|
|
6891
|
-
}
|
|
6878
|
+
};
|
|
6879
|
+
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
|
6880
|
+
styles2[bgModel] = {
|
|
6881
|
+
get() {
|
|
6882
|
+
const { level } = this;
|
|
6883
|
+
return function(...arguments_) {
|
|
6884
|
+
const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]);
|
|
6885
|
+
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
6886
|
+
};
|
|
6892
6887
|
}
|
|
6893
|
-
|
|
6894
|
-
|
|
6895
|
-
|
|
6896
|
-
|
|
6897
|
-
|
|
6898
|
-
|
|
6899
|
-
|
|
6900
|
-
|
|
6901
|
-
|
|
6888
|
+
};
|
|
6889
|
+
}
|
|
6890
|
+
var proto = Object.defineProperties(() => {}, {
|
|
6891
|
+
...styles2,
|
|
6892
|
+
level: {
|
|
6893
|
+
enumerable: true,
|
|
6894
|
+
get() {
|
|
6895
|
+
return this[GENERATOR].level;
|
|
6896
|
+
},
|
|
6897
|
+
set(level) {
|
|
6898
|
+
this[GENERATOR].level = level;
|
|
6902
6899
|
}
|
|
6903
|
-
state.usedDuplicates = new Array(length);
|
|
6904
6900
|
}
|
|
6905
|
-
|
|
6906
|
-
|
|
6907
|
-
|
|
6908
|
-
|
|
6909
|
-
|
|
6910
|
-
|
|
6911
|
-
|
|
6912
|
-
|
|
6913
|
-
|
|
6914
|
-
|
|
6915
|
-
for (let i = 0, length = object.length;i < length; i += 1) {
|
|
6916
|
-
inspectNode(object[i], objects, duplicatesIndexes);
|
|
6917
|
-
}
|
|
6918
|
-
} else {
|
|
6919
|
-
const objectKeyList = Object.keys(object);
|
|
6920
|
-
for (let i = 0, length = objectKeyList.length;i < length; i += 1) {
|
|
6921
|
-
inspectNode(object[objectKeyList[i]], objects, duplicatesIndexes);
|
|
6922
|
-
}
|
|
6923
|
-
}
|
|
6924
|
-
}
|
|
6925
|
-
}
|
|
6901
|
+
});
|
|
6902
|
+
var createStyler = (open, close, parent) => {
|
|
6903
|
+
let openAll;
|
|
6904
|
+
let closeAll;
|
|
6905
|
+
if (parent === undefined) {
|
|
6906
|
+
openAll = open;
|
|
6907
|
+
closeAll = close;
|
|
6908
|
+
} else {
|
|
6909
|
+
openAll = parent.openAll + open;
|
|
6910
|
+
closeAll = close + parent.closeAll;
|
|
6926
6911
|
}
|
|
6927
|
-
|
|
6928
|
-
|
|
6929
|
-
|
|
6930
|
-
|
|
6931
|
-
|
|
6932
|
-
|
|
6933
|
-
|
|
6934
|
-
|
|
6912
|
+
return {
|
|
6913
|
+
open,
|
|
6914
|
+
close,
|
|
6915
|
+
openAll,
|
|
6916
|
+
closeAll,
|
|
6917
|
+
parent
|
|
6918
|
+
};
|
|
6919
|
+
};
|
|
6920
|
+
var createBuilder = (self, _styler, _isEmpty) => {
|
|
6921
|
+
const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
|
6922
|
+
Object.setPrototypeOf(builder, proto);
|
|
6923
|
+
builder[GENERATOR] = self;
|
|
6924
|
+
builder[STYLER] = _styler;
|
|
6925
|
+
builder[IS_EMPTY] = _isEmpty;
|
|
6926
|
+
return builder;
|
|
6927
|
+
};
|
|
6928
|
+
var applyStyle = (self, string) => {
|
|
6929
|
+
if (self.level <= 0 || !string) {
|
|
6930
|
+
return self[IS_EMPTY] ? "" : string;
|
|
6931
|
+
}
|
|
6932
|
+
let styler = self[STYLER];
|
|
6933
|
+
if (styler === undefined) {
|
|
6934
|
+
return string;
|
|
6935
|
+
}
|
|
6936
|
+
const { openAll, closeAll } = styler;
|
|
6937
|
+
if (string.includes("\x1B")) {
|
|
6938
|
+
while (styler !== undefined) {
|
|
6939
|
+
string = stringReplaceAll(string, styler.close, styler.open);
|
|
6940
|
+
styler = styler.parent;
|
|
6935
6941
|
}
|
|
6936
|
-
if (writeNode(state, 0, value, true, true))
|
|
6937
|
-
return state.dump + `
|
|
6938
|
-
`;
|
|
6939
|
-
return "";
|
|
6940
6942
|
}
|
|
6941
|
-
|
|
6942
|
-
|
|
6943
|
+
const lfIndex = string.indexOf(`
|
|
6944
|
+
`);
|
|
6945
|
+
if (lfIndex !== -1) {
|
|
6946
|
+
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
|
6947
|
+
}
|
|
6948
|
+
return openAll + string + closeAll;
|
|
6949
|
+
};
|
|
6950
|
+
Object.defineProperties(createChalk.prototype, styles2);
|
|
6951
|
+
var chalk = createChalk();
|
|
6952
|
+
var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
6953
|
+
var source_default = chalk;
|
|
6954
|
+
|
|
6955
|
+
// src/embed-context.ts
|
|
6956
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
6957
|
+
function setSoftExitCode(code) {
|
|
6958
|
+
const ctx = embedStore.getStore();
|
|
6959
|
+
if (ctx)
|
|
6960
|
+
ctx.softExitCode = code;
|
|
6961
|
+
else
|
|
6962
|
+
process.exitCode = code;
|
|
6943
6963
|
}
|
|
6944
|
-
var
|
|
6945
|
-
|
|
6946
|
-
|
|
6947
|
-
|
|
6948
|
-
|
|
6949
|
-
|
|
6950
|
-
|
|
6951
|
-
function renamed(from, to) {
|
|
6952
|
-
return function() {
|
|
6953
|
-
throw new Error("Function yaml." + from + " is removed in js-yaml 4. Use yaml." + to + " instead, which is now safe by default.");
|
|
6954
|
-
};
|
|
6964
|
+
var embedStore = new AsyncLocalStorage;
|
|
6965
|
+
|
|
6966
|
+
class EmbeddedExit extends Error {
|
|
6967
|
+
code;
|
|
6968
|
+
constructor(code) {
|
|
6969
|
+
super(`CLI exited with code ${code}`);
|
|
6970
|
+
this.code = code;
|
|
6955
6971
|
}
|
|
6956
|
-
|
|
6957
|
-
|
|
6958
|
-
|
|
6959
|
-
|
|
6960
|
-
|
|
6961
|
-
|
|
6962
|
-
|
|
6963
|
-
|
|
6964
|
-
|
|
6965
|
-
|
|
6966
|
-
|
|
6967
|
-
|
|
6968
|
-
|
|
6969
|
-
|
|
6970
|
-
|
|
6971
|
-
|
|
6972
|
-
set: requireSet(),
|
|
6973
|
-
timestamp: requireTimestamp(),
|
|
6974
|
-
bool: requireBool(),
|
|
6975
|
-
int: requireInt(),
|
|
6976
|
-
merge: requireMerge(),
|
|
6977
|
-
omap: requireOmap(),
|
|
6978
|
-
seq: requireSeq(),
|
|
6979
|
-
str: requireStr()
|
|
6972
|
+
}
|
|
6973
|
+
function embeddedProfile() {
|
|
6974
|
+
const ctx = embedStore.getStore();
|
|
6975
|
+
if (!ctx)
|
|
6976
|
+
return null;
|
|
6977
|
+
return {
|
|
6978
|
+
name: "embedded",
|
|
6979
|
+
authProfile: "embedded",
|
|
6980
|
+
oauth: null,
|
|
6981
|
+
endpoint: ctx.identity.endpoint,
|
|
6982
|
+
apiKey: ctx.identity.apiKey,
|
|
6983
|
+
workspaceId: ctx.identity.workspaceId ?? null,
|
|
6984
|
+
output: "json",
|
|
6985
|
+
...ctx.identity.transport ? { transport: ctx.identity.transport } : {},
|
|
6986
|
+
...ctx.identity.signal ? { signal: ctx.identity.signal } : {},
|
|
6987
|
+
sources: { endpoint: "flag", credential: "flag", workspaceId: "flag", output: "flag" }
|
|
6980
6988
|
};
|
|
6981
|
-
jsYaml.safeLoad = renamed("safeLoad", "load");
|
|
6982
|
-
jsYaml.safeLoadAll = renamed("safeLoadAll", "loadAll");
|
|
6983
|
-
jsYaml.safeDump = renamed("safeDump", "dump");
|
|
6984
|
-
return jsYaml;
|
|
6985
6989
|
}
|
|
6986
|
-
|
|
6987
|
-
|
|
6988
|
-
|
|
6989
|
-
|
|
6990
|
-
|
|
6991
|
-
|
|
6992
|
-
|
|
6993
|
-
|
|
6994
|
-
|
|
6995
|
-
|
|
6996
|
-
|
|
6997
|
-
|
|
6998
|
-
|
|
6999
|
-
|
|
7000
|
-
safeLoad,
|
|
7001
|
-
safeLoadAll,
|
|
7002
|
-
safeDump
|
|
7003
|
-
} = yaml;
|
|
6990
|
+
function exitCli(code) {
|
|
6991
|
+
if (embedStore.getStore())
|
|
6992
|
+
throw new EmbeddedExit(code);
|
|
6993
|
+
return process.exit(code);
|
|
6994
|
+
}
|
|
6995
|
+
|
|
6996
|
+
// src/output/presentation.ts
|
|
6997
|
+
var plain = new Chalk({ level: 0 });
|
|
6998
|
+
function styles3() {
|
|
6999
|
+
return embedStore.getStore() ? plain : source_default;
|
|
7000
|
+
}
|
|
7001
|
+
function hasProgressTerminal() {
|
|
7002
|
+
return !embedStore.getStore() && Boolean(process.stderr.isTTY);
|
|
7003
|
+
}
|
|
7004
7004
|
|
|
7005
7005
|
// src/update/install.ts
|
|
7006
7006
|
import { spawn as spawn2 } from "node:child_process";
|
|
@@ -7025,6 +7025,26 @@ var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
|
|
|
7025
7025
|
import { spawn } from "node:child_process";
|
|
7026
7026
|
import { fileURLToPath } from "node:url";
|
|
7027
7027
|
|
|
7028
|
+
// src/version.ts
|
|
7029
|
+
import { readFileSync } from "node:fs";
|
|
7030
|
+
function readPackageVersion() {
|
|
7031
|
+
try {
|
|
7032
|
+
const metadata = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
|
|
7033
|
+
if (typeof metadata === "object" && metadata !== null && "version" in metadata && typeof metadata.version === "string") {
|
|
7034
|
+
return metadata.version;
|
|
7035
|
+
}
|
|
7036
|
+
} catch {}
|
|
7037
|
+
return "0.0.0-embedded";
|
|
7038
|
+
}
|
|
7039
|
+
var cachedVersion = null;
|
|
7040
|
+
function cliVersion() {
|
|
7041
|
+
cachedVersion ??= readPackageVersion();
|
|
7042
|
+
return cachedVersion;
|
|
7043
|
+
}
|
|
7044
|
+
function userAgent() {
|
|
7045
|
+
return `sim-cli/${cliVersion()} node/${process.versions.node} (${process.platform}; ${process.arch})`;
|
|
7046
|
+
}
|
|
7047
|
+
|
|
7028
7048
|
// src/config/json-file.ts
|
|
7029
7049
|
import {
|
|
7030
7050
|
closeSync,
|
|
@@ -7147,26 +7167,6 @@ function childProcessEnv(strip, extra = {}) {
|
|
|
7147
7167
|
return { ...env, ...extra };
|
|
7148
7168
|
}
|
|
7149
7169
|
|
|
7150
|
-
// src/version.ts
|
|
7151
|
-
import { readFileSync } from "node:fs";
|
|
7152
|
-
function readPackageVersion() {
|
|
7153
|
-
try {
|
|
7154
|
-
const metadata = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
|
|
7155
|
-
if (typeof metadata === "object" && metadata !== null && "version" in metadata && typeof metadata.version === "string") {
|
|
7156
|
-
return metadata.version;
|
|
7157
|
-
}
|
|
7158
|
-
} catch {}
|
|
7159
|
-
return "0.0.0-embedded";
|
|
7160
|
-
}
|
|
7161
|
-
var cachedVersion = null;
|
|
7162
|
-
function cliVersion() {
|
|
7163
|
-
cachedVersion ??= readPackageVersion();
|
|
7164
|
-
return cachedVersion;
|
|
7165
|
-
}
|
|
7166
|
-
function userAgent() {
|
|
7167
|
-
return `sim-cli/${cliVersion()} node/${process.versions.node} (${process.platform}; ${process.arch})`;
|
|
7168
|
-
}
|
|
7169
|
-
|
|
7170
7170
|
// src/update/check.ts
|
|
7171
7171
|
var CHECK_INTERVAL_MS = 24 * 60 * 60 * 1000;
|
|
7172
7172
|
var REGISTRY_TIMEOUT_MS = 1000;
|
|
@@ -16050,7 +16050,10 @@ var PROFILE_COLUMNS = [
|
|
|
16050
16050
|
{ header: "profile", value: (row) => safeOneLine(row.name) },
|
|
16051
16051
|
{ header: "key", value: (row) => row.error ? text(null) : row.hasKey ? "yes" : "no" },
|
|
16052
16052
|
{ header: "auth", value: (row) => row.authProfile ? safeOneLine(row.authProfile) : text(null) },
|
|
16053
|
-
{
|
|
16053
|
+
{
|
|
16054
|
+
header: "error",
|
|
16055
|
+
value: (row) => row.error ? styles3().red(safeOneLine(row.error)) : text(null)
|
|
16056
|
+
}
|
|
16054
16057
|
];
|
|
16055
16058
|
function buildProfileRow(name, active) {
|
|
16056
16059
|
try {
|