@taskless/cli 0.1.0 → 0.1.2
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 +269 -293
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -440,19 +440,19 @@ function vn(s = {}) {
|
|
|
440
440
|
...s
|
|
441
441
|
});
|
|
442
442
|
}
|
|
443
|
-
const
|
|
443
|
+
const Ie = vn(), {
|
|
444
444
|
env: Q = {},
|
|
445
445
|
argv: hs = [],
|
|
446
|
-
platform:
|
|
447
|
-
} = typeof process > "u" ? {} : process,
|
|
446
|
+
platform: Nn = ""
|
|
447
|
+
} = typeof process > "u" ? {} : process, In = "NO_COLOR" in Q || hs.includes("--no-color"), Tn = "FORCE_COLOR" in Q || hs.includes("--color"), On = Nn === "win32", ps = Q.TERM === "dumb", _n = it && it.isatty && it.isatty(1) && Q.TERM && !ps, Cn = "CI" in Q && ("GITHUB_ACTIONS" in Q || "GITLAB_CI" in Q || "CIRCLECI" in Q), Ln = !In && (Tn || On && !ps || _n || Cn);
|
|
448
448
|
function ms(s, e, t, n, i = e.slice(0, Math.max(0, s)) + n, r = e.slice(Math.max(0, s + t.length)), o = r.indexOf(t)) {
|
|
449
449
|
return i + (o < 0 ? r : ms(o, r, t, n));
|
|
450
450
|
}
|
|
451
|
-
function
|
|
451
|
+
function An(s, e, t, n, i) {
|
|
452
452
|
return s < 0 ? t + e + n : t + ms(s, e, n, i) + n;
|
|
453
453
|
}
|
|
454
454
|
function En(s, e, t = s, n = s.length + 1) {
|
|
455
|
-
return (i) => i || !(i === "" || i === void 0) ?
|
|
455
|
+
return (i) => i || !(i === "" || i === void 0) ? An(
|
|
456
456
|
("" + i).indexOf(e, n),
|
|
457
457
|
i,
|
|
458
458
|
s,
|
|
@@ -460,53 +460,53 @@ function En(s, e, t = s, n = s.length + 1) {
|
|
|
460
460
|
t
|
|
461
461
|
) : "";
|
|
462
462
|
}
|
|
463
|
-
function
|
|
463
|
+
function T(s, e, t) {
|
|
464
464
|
return En(`\x1B[${s}m`, `\x1B[${e}m`, t);
|
|
465
465
|
}
|
|
466
466
|
const Vt = {
|
|
467
|
-
reset:
|
|
468
|
-
bold:
|
|
469
|
-
dim:
|
|
470
|
-
italic:
|
|
471
|
-
underline:
|
|
472
|
-
inverse:
|
|
473
|
-
hidden:
|
|
474
|
-
strikethrough:
|
|
475
|
-
black:
|
|
476
|
-
red:
|
|
477
|
-
green:
|
|
478
|
-
yellow:
|
|
479
|
-
blue:
|
|
480
|
-
magenta:
|
|
481
|
-
cyan:
|
|
482
|
-
white:
|
|
483
|
-
gray:
|
|
484
|
-
bgBlack:
|
|
485
|
-
bgRed:
|
|
486
|
-
bgGreen:
|
|
487
|
-
bgYellow:
|
|
488
|
-
bgBlue:
|
|
489
|
-
bgMagenta:
|
|
490
|
-
bgCyan:
|
|
491
|
-
bgWhite:
|
|
492
|
-
blackBright:
|
|
493
|
-
redBright:
|
|
494
|
-
greenBright:
|
|
495
|
-
yellowBright:
|
|
496
|
-
blueBright:
|
|
497
|
-
magentaBright:
|
|
498
|
-
cyanBright:
|
|
499
|
-
whiteBright:
|
|
500
|
-
bgBlackBright:
|
|
501
|
-
bgRedBright:
|
|
502
|
-
bgGreenBright:
|
|
503
|
-
bgYellowBright:
|
|
504
|
-
bgBlueBright:
|
|
505
|
-
bgMagentaBright:
|
|
506
|
-
bgCyanBright:
|
|
507
|
-
bgWhiteBright:
|
|
467
|
+
reset: T(0, 0),
|
|
468
|
+
bold: T(1, 22, "\x1B[22m\x1B[1m"),
|
|
469
|
+
dim: T(2, 22, "\x1B[22m\x1B[2m"),
|
|
470
|
+
italic: T(3, 23),
|
|
471
|
+
underline: T(4, 24),
|
|
472
|
+
inverse: T(7, 27),
|
|
473
|
+
hidden: T(8, 28),
|
|
474
|
+
strikethrough: T(9, 29),
|
|
475
|
+
black: T(30, 39),
|
|
476
|
+
red: T(31, 39),
|
|
477
|
+
green: T(32, 39),
|
|
478
|
+
yellow: T(33, 39),
|
|
479
|
+
blue: T(34, 39),
|
|
480
|
+
magenta: T(35, 39),
|
|
481
|
+
cyan: T(36, 39),
|
|
482
|
+
white: T(37, 39),
|
|
483
|
+
gray: T(90, 39),
|
|
484
|
+
bgBlack: T(40, 49),
|
|
485
|
+
bgRed: T(41, 49),
|
|
486
|
+
bgGreen: T(42, 49),
|
|
487
|
+
bgYellow: T(43, 49),
|
|
488
|
+
bgBlue: T(44, 49),
|
|
489
|
+
bgMagenta: T(45, 49),
|
|
490
|
+
bgCyan: T(46, 49),
|
|
491
|
+
bgWhite: T(47, 49),
|
|
492
|
+
blackBright: T(90, 39),
|
|
493
|
+
redBright: T(91, 39),
|
|
494
|
+
greenBright: T(92, 39),
|
|
495
|
+
yellowBright: T(93, 39),
|
|
496
|
+
blueBright: T(94, 39),
|
|
497
|
+
magentaBright: T(95, 39),
|
|
498
|
+
cyanBright: T(96, 39),
|
|
499
|
+
whiteBright: T(97, 39),
|
|
500
|
+
bgBlackBright: T(100, 49),
|
|
501
|
+
bgRedBright: T(101, 49),
|
|
502
|
+
bgGreenBright: T(102, 49),
|
|
503
|
+
bgYellowBright: T(103, 49),
|
|
504
|
+
bgBlueBright: T(104, 49),
|
|
505
|
+
bgMagentaBright: T(105, 49),
|
|
506
|
+
bgCyanBright: T(106, 49),
|
|
507
|
+
bgWhiteBright: T(107, 49)
|
|
508
508
|
};
|
|
509
|
-
function $n(s =
|
|
509
|
+
function $n(s = Ln) {
|
|
510
510
|
return s ? Vt : Object.fromEntries(Object.keys(Vt).map((e) => [e, String]));
|
|
511
511
|
}
|
|
512
512
|
const V = $n();
|
|
@@ -733,10 +733,10 @@ async function kt(s, e, t) {
|
|
|
733
733
|
}
|
|
734
734
|
async function ws(s, e) {
|
|
735
735
|
try {
|
|
736
|
-
|
|
736
|
+
Ie.log(await Vn(s, e) + `
|
|
737
737
|
`);
|
|
738
738
|
} catch (t) {
|
|
739
|
-
|
|
739
|
+
Ie.error(t);
|
|
740
740
|
}
|
|
741
741
|
}
|
|
742
742
|
async function Vn(s, e) {
|
|
@@ -795,16 +795,16 @@ async function Wn(s, e = {}) {
|
|
|
795
795
|
const i = typeof s.meta == "function" ? await s.meta() : await s.meta;
|
|
796
796
|
if (!i?.version)
|
|
797
797
|
throw new pe("No version specified", "E_NO_VERSION");
|
|
798
|
-
|
|
798
|
+
Ie.log(i.version);
|
|
799
799
|
} else
|
|
800
800
|
await ks(s, { rawArgs: t });
|
|
801
801
|
} catch (i) {
|
|
802
802
|
const r = i instanceof pe;
|
|
803
|
-
r ||
|
|
804
|
-
`), r && await n(...await kt(s, t)),
|
|
803
|
+
r || Ie.error(i, `
|
|
804
|
+
`), r && await n(...await kt(s, t)), Ie.error(i.message), process.exit(1);
|
|
805
805
|
}
|
|
806
806
|
}
|
|
807
|
-
const
|
|
807
|
+
const Tt = "auth.json";
|
|
808
808
|
function He() {
|
|
809
809
|
const s = process.env.XDG_CONFIG_HOME ?? C(dn(), ".config");
|
|
810
810
|
return C(s, "taskless");
|
|
@@ -813,7 +813,7 @@ async function Ge() {
|
|
|
813
813
|
const s = process.env.TASKLESS_TOKEN;
|
|
814
814
|
if (s) return s;
|
|
815
815
|
try {
|
|
816
|
-
const e = C(He(),
|
|
816
|
+
const e = C(He(), Tt), t = await Ee(e, "utf8");
|
|
817
817
|
return JSON.parse(t).access_token;
|
|
818
818
|
} catch {
|
|
819
819
|
return;
|
|
@@ -822,7 +822,7 @@ async function Ge() {
|
|
|
822
822
|
async function Yn(s) {
|
|
823
823
|
const e = He();
|
|
824
824
|
await _e(e, { recursive: !0 });
|
|
825
|
-
const t = C(e,
|
|
825
|
+
const t = C(e, Tt);
|
|
826
826
|
await Ce(t, JSON.stringify(s, null, 2) + `
|
|
827
827
|
`, {
|
|
828
828
|
mode: 384
|
|
@@ -830,7 +830,7 @@ async function Yn(s) {
|
|
|
830
830
|
}
|
|
831
831
|
async function Hn() {
|
|
832
832
|
try {
|
|
833
|
-
const s = C(He(),
|
|
833
|
+
const s = C(He(), Tt);
|
|
834
834
|
return await gt(s), !0;
|
|
835
835
|
} catch {
|
|
836
836
|
return !1;
|
|
@@ -1079,7 +1079,7 @@ function bs(s) {
|
|
|
1079
1079
|
return t >= 1 && t <= 12 && n >= 1 && n <= 31;
|
|
1080
1080
|
}
|
|
1081
1081
|
const Ot = {
|
|
1082
|
-
"rules create": "2026-03-
|
|
1082
|
+
"rules create": "2026-03-02",
|
|
1083
1083
|
check: "2026-02-18"
|
|
1084
1084
|
};
|
|
1085
1085
|
function Ss(s, e) {
|
|
@@ -1158,7 +1158,7 @@ name: taskless-check
|
|
|
1158
1158
|
description: Checks a repository using the Taskless rules via the CLI. Use when the user wants to run a check, test rules, or validate code against taskless rules. Trigger on "check my code", "run taskless check", "test my rules", or "validate with taskless".
|
|
1159
1159
|
metadata:
|
|
1160
1160
|
author: taskless
|
|
1161
|
-
version: 0.1.
|
|
1161
|
+
version: 0.1.2
|
|
1162
1162
|
commandName: taskless:check
|
|
1163
1163
|
compatibility: Designed for Agents implementing the Agent Skills specification.
|
|
1164
1164
|
---
|
|
@@ -1181,7 +1181,7 @@ name: taskless-info
|
|
|
1181
1181
|
description: Confirms that the Taskless skills plugin is installed and working. Use when the user wants to verify their Taskless setup, check plugin status, test the connection, or run a health check. Trigger on "is taskless working", "check taskless", "taskless status", or "taskless info".
|
|
1182
1182
|
metadata:
|
|
1183
1183
|
author: taskless
|
|
1184
|
-
version: 0.1.
|
|
1184
|
+
version: 0.1.2
|
|
1185
1185
|
commandName: taskless:info
|
|
1186
1186
|
compatibility: Designed for Agents implementing the Agent Skills specification.
|
|
1187
1187
|
---
|
|
@@ -1231,7 +1231,7 @@ name: taskless-login
|
|
|
1231
1231
|
description: Explains how to authenticate with Taskless. Use when the user wants to log in, authenticate, connect their account, or set up credentials. Trigger on "taskless login", "authenticate taskless", "taskless auth", or "connect to taskless".
|
|
1232
1232
|
metadata:
|
|
1233
1233
|
author: taskless
|
|
1234
|
-
version: 0.1.
|
|
1234
|
+
version: 0.1.2
|
|
1235
1235
|
commandName: taskless:login
|
|
1236
1236
|
compatibility: Designed for Agents implementing the Agent Skills specification.
|
|
1237
1237
|
---
|
|
@@ -1252,7 +1252,7 @@ name: taskless-logout
|
|
|
1252
1252
|
description: Explains how to remove saved Taskless authentication. Use when the user wants to log out, disconnect, remove credentials, or clear their Taskless session. Trigger on "taskless logout", "disconnect taskless", or "remove taskless auth".
|
|
1253
1253
|
metadata:
|
|
1254
1254
|
author: taskless
|
|
1255
|
-
version: 0.1.
|
|
1255
|
+
version: 0.1.2
|
|
1256
1256
|
commandName: taskless:logout
|
|
1257
1257
|
compatibility: Designed for Agents implementing the Agent Skills specification.
|
|
1258
1258
|
---
|
|
@@ -1273,7 +1273,7 @@ name: taskless-rule-create
|
|
|
1273
1273
|
description: Creates a new Taskless rule from a description. Use when the user wants to create a rule, add a lint rule, define a code pattern to detect, or generate an ast-grep rule. Trigger on "create a rule", "add a taskless rule", "new rule for", or "detect this pattern".
|
|
1274
1274
|
metadata:
|
|
1275
1275
|
author: taskless
|
|
1276
|
-
version: 0.1.
|
|
1276
|
+
version: 0.1.2
|
|
1277
1277
|
commandName: taskless:rule
|
|
1278
1278
|
compatibility: Designed for Agents implementing the Agent Skills specification.
|
|
1279
1279
|
---
|
|
@@ -1310,7 +1310,7 @@ name: taskless-rule-delete
|
|
|
1310
1310
|
description: Deletes a Taskless rule and its test files. Use when the user wants to remove a rule, delete a lint rule, or clean up an unwanted rule. Trigger on "delete rule", "remove taskless rule", "delete this rule", or "remove rule".
|
|
1311
1311
|
metadata:
|
|
1312
1312
|
author: taskless
|
|
1313
|
-
version: 0.1.
|
|
1313
|
+
version: 0.1.2
|
|
1314
1314
|
commandName: "-"
|
|
1315
1315
|
compatibility: Designed for Agents implementing the Agent Skills specification.
|
|
1316
1316
|
---
|
|
@@ -1345,7 +1345,7 @@ name: taskless-update-engine
|
|
|
1345
1345
|
description: Requests a scaffold upgrade for the .taskless/ engine directory. Use when the user needs to update their Taskless scaffold, upgrade their engine version, or when the CLI reports a stale scaffold version. Trigger on "update engine", "upgrade taskless", "taskless update-engine", or "scaffold is out of date".
|
|
1346
1346
|
metadata:
|
|
1347
1347
|
author: taskless
|
|
1348
|
-
version: 0.1.
|
|
1348
|
+
version: 0.1.2
|
|
1349
1349
|
commandName: taskless:update-engine
|
|
1350
1350
|
compatibility: Designed for Agents implementing the Agent Skills specification.
|
|
1351
1351
|
---
|
|
@@ -1385,7 +1385,7 @@ tags:
|
|
|
1385
1385
|
- taskless
|
|
1386
1386
|
metadata:
|
|
1387
1387
|
author: taskless
|
|
1388
|
-
version: 0.1.
|
|
1388
|
+
version: 0.1.2
|
|
1389
1389
|
commandName: taskless:check
|
|
1390
1390
|
---
|
|
1391
1391
|
|
|
@@ -1410,7 +1410,7 @@ tags:
|
|
|
1410
1410
|
- taskless
|
|
1411
1411
|
metadata:
|
|
1412
1412
|
author: taskless
|
|
1413
|
-
version: 0.1.
|
|
1413
|
+
version: 0.1.2
|
|
1414
1414
|
commandName: taskless:info
|
|
1415
1415
|
---
|
|
1416
1416
|
|
|
@@ -1462,7 +1462,7 @@ tags:
|
|
|
1462
1462
|
- taskless
|
|
1463
1463
|
metadata:
|
|
1464
1464
|
author: taskless
|
|
1465
|
-
version: 0.1.
|
|
1465
|
+
version: 0.1.2
|
|
1466
1466
|
commandName: taskless:login
|
|
1467
1467
|
---
|
|
1468
1468
|
|
|
@@ -1485,7 +1485,7 @@ tags:
|
|
|
1485
1485
|
- taskless
|
|
1486
1486
|
metadata:
|
|
1487
1487
|
author: taskless
|
|
1488
|
-
version: 0.1.
|
|
1488
|
+
version: 0.1.2
|
|
1489
1489
|
commandName: taskless:logout
|
|
1490
1490
|
---
|
|
1491
1491
|
|
|
@@ -1508,7 +1508,7 @@ tags:
|
|
|
1508
1508
|
- taskless
|
|
1509
1509
|
metadata:
|
|
1510
1510
|
author: taskless
|
|
1511
|
-
version: 0.1.
|
|
1511
|
+
version: 0.1.2
|
|
1512
1512
|
commandName: taskless:rule
|
|
1513
1513
|
---
|
|
1514
1514
|
|
|
@@ -1547,7 +1547,7 @@ tags:
|
|
|
1547
1547
|
- taskless
|
|
1548
1548
|
metadata:
|
|
1549
1549
|
author: taskless
|
|
1550
|
-
version: 0.1.
|
|
1550
|
+
version: 0.1.2
|
|
1551
1551
|
commandName: taskless:update-engine
|
|
1552
1552
|
---
|
|
1553
1553
|
|
|
@@ -1579,7 +1579,7 @@ When this skill is invoked, run the update-engine CLI command to request a scaff
|
|
|
1579
1579
|
- **Missing config**: Suggest running \`taskless init\` to set up the project.
|
|
1580
1580
|
- **API errors**: Report the error message and suggest trying again.
|
|
1581
1581
|
`, _t = /* @__PURE__ */ Symbol.for("yaml.alias"), wt = /* @__PURE__ */ Symbol.for("yaml.document"), X = /* @__PURE__ */ Symbol.for("yaml.map"), vs = /* @__PURE__ */ Symbol.for("yaml.pair"), J = /* @__PURE__ */ Symbol.for("yaml.scalar"), ye = /* @__PURE__ */ Symbol.for("yaml.seq"), B = /* @__PURE__ */ Symbol.for("yaml.node.type"), re = (s) => !!s && typeof s == "object" && s[B] === _t, $e = (s) => !!s && typeof s == "object" && s[B] === wt, je = (s) => !!s && typeof s == "object" && s[B] === X, E = (s) => !!s && typeof s == "object" && s[B] === vs, _ = (s) => !!s && typeof s == "object" && s[B] === J, Re = (s) => !!s && typeof s == "object" && s[B] === ye;
|
|
1582
|
-
function
|
|
1582
|
+
function L(s) {
|
|
1583
1583
|
if (s && typeof s == "object")
|
|
1584
1584
|
switch (s[B]) {
|
|
1585
1585
|
case X:
|
|
@@ -1588,7 +1588,7 @@ function A(s) {
|
|
|
1588
1588
|
}
|
|
1589
1589
|
return !1;
|
|
1590
1590
|
}
|
|
1591
|
-
function
|
|
1591
|
+
function A(s) {
|
|
1592
1592
|
if (s && typeof s == "object")
|
|
1593
1593
|
switch (s[B]) {
|
|
1594
1594
|
case _t:
|
|
@@ -1599,20 +1599,20 @@ function L(s) {
|
|
|
1599
1599
|
}
|
|
1600
1600
|
return !1;
|
|
1601
1601
|
}
|
|
1602
|
-
const
|
|
1602
|
+
const Ns = (s) => (_(s) || L(s)) && !!s.anchor, ee = /* @__PURE__ */ Symbol("break visit"), bi = /* @__PURE__ */ Symbol("skip children"), Te = /* @__PURE__ */ Symbol("remove node");
|
|
1603
1603
|
function ke(s, e) {
|
|
1604
1604
|
const t = Si(e);
|
|
1605
|
-
$e(s) ? ce(null, s.contents, t, Object.freeze([s])) ===
|
|
1605
|
+
$e(s) ? ce(null, s.contents, t, Object.freeze([s])) === Te && (s.contents = null) : ce(null, s, t, Object.freeze([]));
|
|
1606
1606
|
}
|
|
1607
1607
|
ke.BREAK = ee;
|
|
1608
1608
|
ke.SKIP = bi;
|
|
1609
|
-
ke.REMOVE =
|
|
1609
|
+
ke.REMOVE = Te;
|
|
1610
1610
|
function ce(s, e, t, n) {
|
|
1611
1611
|
const i = vi(s, e, t, n);
|
|
1612
|
-
if (
|
|
1613
|
-
return
|
|
1612
|
+
if (A(i) || E(i))
|
|
1613
|
+
return Ni(s, n, i), ce(s, i, t, n);
|
|
1614
1614
|
if (typeof i != "symbol") {
|
|
1615
|
-
if (
|
|
1615
|
+
if (L(e)) {
|
|
1616
1616
|
n = Object.freeze(n.concat(e));
|
|
1617
1617
|
for (let r = 0; r < e.items.length; ++r) {
|
|
1618
1618
|
const o = ce(r, e.items[r], t, n);
|
|
@@ -1621,7 +1621,7 @@ function ce(s, e, t, n) {
|
|
|
1621
1621
|
else {
|
|
1622
1622
|
if (o === ee)
|
|
1623
1623
|
return ee;
|
|
1624
|
-
o ===
|
|
1624
|
+
o === Te && (e.items.splice(r, 1), r -= 1);
|
|
1625
1625
|
}
|
|
1626
1626
|
}
|
|
1627
1627
|
} else if (E(e)) {
|
|
@@ -1629,11 +1629,11 @@ function ce(s, e, t, n) {
|
|
|
1629
1629
|
const r = ce("key", e.key, t, n);
|
|
1630
1630
|
if (r === ee)
|
|
1631
1631
|
return ee;
|
|
1632
|
-
r ===
|
|
1632
|
+
r === Te && (e.key = null);
|
|
1633
1633
|
const o = ce("value", e.value, t, n);
|
|
1634
1634
|
if (o === ee)
|
|
1635
1635
|
return ee;
|
|
1636
|
-
o ===
|
|
1636
|
+
o === Te && (e.value = null);
|
|
1637
1637
|
}
|
|
1638
1638
|
}
|
|
1639
1639
|
return i;
|
|
@@ -1667,9 +1667,9 @@ function vi(s, e, t, n) {
|
|
|
1667
1667
|
if (re(e))
|
|
1668
1668
|
return t.Alias?.(s, e, n);
|
|
1669
1669
|
}
|
|
1670
|
-
function
|
|
1670
|
+
function Ni(s, e, t) {
|
|
1671
1671
|
const n = e[e.length - 1];
|
|
1672
|
-
if (
|
|
1672
|
+
if (L(n))
|
|
1673
1673
|
n.items[s] = t;
|
|
1674
1674
|
else if (E(n))
|
|
1675
1675
|
s === "key" ? n.key = t : n.value = t;
|
|
@@ -1680,14 +1680,14 @@ function Ii(s, e, t) {
|
|
|
1680
1680
|
throw new Error(`Cannot replace node with ${i} parent`);
|
|
1681
1681
|
}
|
|
1682
1682
|
}
|
|
1683
|
-
const
|
|
1683
|
+
const Ii = {
|
|
1684
1684
|
"!": "%21",
|
|
1685
1685
|
",": "%2C",
|
|
1686
1686
|
"[": "%5B",
|
|
1687
1687
|
"]": "%5D",
|
|
1688
1688
|
"{": "%7B",
|
|
1689
1689
|
"}": "%7D"
|
|
1690
|
-
},
|
|
1690
|
+
}, Ti = (s) => s.replace(/[!,[\]{}]/g, (e) => Ii[e]);
|
|
1691
1691
|
class P {
|
|
1692
1692
|
constructor(e, t) {
|
|
1693
1693
|
this.docStart = null, this.docEnd = !1, this.yaml = Object.assign({}, P.defaultYaml, e), this.tags = Object.assign({}, P.defaultTags, t);
|
|
@@ -1777,16 +1777,16 @@ class P {
|
|
|
1777
1777
|
tagString(e) {
|
|
1778
1778
|
for (const [t, n] of Object.entries(this.tags))
|
|
1779
1779
|
if (e.startsWith(n))
|
|
1780
|
-
return t +
|
|
1780
|
+
return t + Ti(e.substring(n.length));
|
|
1781
1781
|
return e[0] === "!" ? e : `!<${e}>`;
|
|
1782
1782
|
}
|
|
1783
1783
|
toString(e) {
|
|
1784
1784
|
const t = this.yaml.explicit ? [`%YAML ${this.yaml.version || "1.2"}`] : [], n = Object.entries(this.tags);
|
|
1785
1785
|
let i;
|
|
1786
|
-
if (e && n.length > 0 &&
|
|
1786
|
+
if (e && n.length > 0 && A(e.contents)) {
|
|
1787
1787
|
const r = {};
|
|
1788
1788
|
ke(e.contents, (o, a) => {
|
|
1789
|
-
|
|
1789
|
+
A(a) && a.tag && (r[a.tag] = !0);
|
|
1790
1790
|
}), i = Object.keys(r);
|
|
1791
1791
|
} else
|
|
1792
1792
|
i = [];
|
|
@@ -1798,14 +1798,14 @@ class P {
|
|
|
1798
1798
|
}
|
|
1799
1799
|
P.defaultYaml = { explicit: !1, version: "1.2" };
|
|
1800
1800
|
P.defaultTags = { "!!": "tag:yaml.org,2002:" };
|
|
1801
|
-
function
|
|
1801
|
+
function Is(s) {
|
|
1802
1802
|
if (/[\x00-\x19\s,[\]{}]/.test(s)) {
|
|
1803
1803
|
const t = `Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;
|
|
1804
1804
|
throw new Error(t);
|
|
1805
1805
|
}
|
|
1806
1806
|
return !0;
|
|
1807
1807
|
}
|
|
1808
|
-
function
|
|
1808
|
+
function Ts(s) {
|
|
1809
1809
|
const e = /* @__PURE__ */ new Set();
|
|
1810
1810
|
return ke(s, {
|
|
1811
1811
|
Value(t, n) {
|
|
@@ -1825,7 +1825,7 @@ function Oi(s, e) {
|
|
|
1825
1825
|
let i = null;
|
|
1826
1826
|
return {
|
|
1827
1827
|
onAnchor: (r) => {
|
|
1828
|
-
t.push(r), i ?? (i =
|
|
1828
|
+
t.push(r), i ?? (i = Ts(s));
|
|
1829
1829
|
const o = Os(e, i);
|
|
1830
1830
|
return i.add(o), o;
|
|
1831
1831
|
},
|
|
@@ -1837,7 +1837,7 @@ function Oi(s, e) {
|
|
|
1837
1837
|
setAnchors: () => {
|
|
1838
1838
|
for (const r of t) {
|
|
1839
1839
|
const o = n.get(r);
|
|
1840
|
-
if (typeof o == "object" && o.anchor && (_(o.node) ||
|
|
1840
|
+
if (typeof o == "object" && o.anchor && (_(o.node) || L(o.node)))
|
|
1841
1841
|
o.node.anchor = o.anchor;
|
|
1842
1842
|
else {
|
|
1843
1843
|
const a = new Error("Failed to resolve repeated object (this should not happen)");
|
|
@@ -1876,7 +1876,7 @@ function D(s, e, t) {
|
|
|
1876
1876
|
if (Array.isArray(s))
|
|
1877
1877
|
return s.map((n, i) => D(n, String(i), t));
|
|
1878
1878
|
if (s && typeof s.toJSON == "function") {
|
|
1879
|
-
if (!t || !
|
|
1879
|
+
if (!t || !Ns(s))
|
|
1880
1880
|
return s.toJSON(e, t);
|
|
1881
1881
|
const n = { aliasCount: 0, count: 1, res: void 0 };
|
|
1882
1882
|
t.anchors.set(s, n), t.onCreate = (r) => {
|
|
@@ -1914,7 +1914,7 @@ class Ct {
|
|
|
1914
1914
|
return typeof r == "function" ? ue(r, { "": a }, "", a) : a;
|
|
1915
1915
|
}
|
|
1916
1916
|
}
|
|
1917
|
-
class
|
|
1917
|
+
class Lt extends Ct {
|
|
1918
1918
|
constructor(e) {
|
|
1919
1919
|
super(_t), this.source = e, Object.defineProperty(this, "tag", {
|
|
1920
1920
|
set() {
|
|
@@ -1930,7 +1930,7 @@ class At extends Ct {
|
|
|
1930
1930
|
let n;
|
|
1931
1931
|
t?.aliasResolveCache ? n = t.aliasResolveCache : (n = [], ke(e, {
|
|
1932
1932
|
Node: (r, o) => {
|
|
1933
|
-
(re(o) ||
|
|
1933
|
+
(re(o) || Ns(o)) && n.push(o);
|
|
1934
1934
|
}
|
|
1935
1935
|
}), t && (t.aliasResolveCache = n));
|
|
1936
1936
|
let i;
|
|
@@ -1963,7 +1963,7 @@ class At extends Ct {
|
|
|
1963
1963
|
toString(e, t, n) {
|
|
1964
1964
|
const i = `*${this.source}`;
|
|
1965
1965
|
if (e) {
|
|
1966
|
-
if (
|
|
1966
|
+
if (Is(this.source), e.options.verifyAliasOrder && !e.anchors.has(this.source)) {
|
|
1967
1967
|
const r = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
|
|
1968
1968
|
throw new Error(r);
|
|
1969
1969
|
}
|
|
@@ -1977,7 +1977,7 @@ function Fe(s, e, t) {
|
|
|
1977
1977
|
if (re(e)) {
|
|
1978
1978
|
const n = e.resolve(s), i = t && n && t.get(n);
|
|
1979
1979
|
return i ? i.count * i.aliasCount : 0;
|
|
1980
|
-
} else if (
|
|
1980
|
+
} else if (L(e)) {
|
|
1981
1981
|
let n = 0;
|
|
1982
1982
|
for (const i of e.items) {
|
|
1983
1983
|
const r = Fe(s, i, t);
|
|
@@ -1991,7 +1991,7 @@ function Fe(s, e, t) {
|
|
|
1991
1991
|
return 1;
|
|
1992
1992
|
}
|
|
1993
1993
|
const _s = (s) => !s || typeof s != "function" && typeof s != "object";
|
|
1994
|
-
class
|
|
1994
|
+
class N extends Ct {
|
|
1995
1995
|
constructor(e) {
|
|
1996
1996
|
super(J), this.value = e;
|
|
1997
1997
|
}
|
|
@@ -2002,11 +2002,11 @@ class I extends Ct {
|
|
|
2002
2002
|
return String(this.value);
|
|
2003
2003
|
}
|
|
2004
2004
|
}
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2005
|
+
N.BLOCK_FOLDED = "BLOCK_FOLDED";
|
|
2006
|
+
N.BLOCK_LITERAL = "BLOCK_LITERAL";
|
|
2007
|
+
N.PLAIN = "PLAIN";
|
|
2008
|
+
N.QUOTE_DOUBLE = "QUOTE_DOUBLE";
|
|
2009
|
+
N.QUOTE_SINGLE = "QUOTE_SINGLE";
|
|
2010
2010
|
const _i = "tag:yaml.org,2002:";
|
|
2011
2011
|
function Ci(s, e, t) {
|
|
2012
2012
|
if (e) {
|
|
@@ -2017,8 +2017,8 @@ function Ci(s, e, t) {
|
|
|
2017
2017
|
}
|
|
2018
2018
|
return t.find((n) => n.identify?.(s) && !n.format);
|
|
2019
2019
|
}
|
|
2020
|
-
function
|
|
2021
|
-
if ($e(s) && (s = s.contents),
|
|
2020
|
+
function Le(s, e, t) {
|
|
2021
|
+
if ($e(s) && (s = s.contents), A(s))
|
|
2022
2022
|
return s;
|
|
2023
2023
|
if (E(s)) {
|
|
2024
2024
|
const u = t.schema[X].createNode?.(t.schema, null, t);
|
|
@@ -2029,20 +2029,20 @@ function Ae(s, e, t) {
|
|
|
2029
2029
|
let l;
|
|
2030
2030
|
if (n && s && typeof s == "object") {
|
|
2031
2031
|
if (l = a.get(s), l)
|
|
2032
|
-
return l.anchor ?? (l.anchor = i(s)), new
|
|
2032
|
+
return l.anchor ?? (l.anchor = i(s)), new Lt(l.anchor);
|
|
2033
2033
|
l = { anchor: null, node: null }, a.set(s, l);
|
|
2034
2034
|
}
|
|
2035
2035
|
e?.startsWith("!!") && (e = _i + e.slice(2));
|
|
2036
2036
|
let c = Ci(s, e, o.tags);
|
|
2037
2037
|
if (!c) {
|
|
2038
2038
|
if (s && typeof s.toJSON == "function" && (s = s.toJSON()), !s || typeof s != "object") {
|
|
2039
|
-
const u = new
|
|
2039
|
+
const u = new N(s);
|
|
2040
2040
|
return l && (l.node = u), u;
|
|
2041
2041
|
}
|
|
2042
2042
|
c = s instanceof Map ? o[X] : Symbol.iterator in Object(s) ? o[ye] : o[X];
|
|
2043
2043
|
}
|
|
2044
2044
|
r && (r(c), delete t.onTagObj);
|
|
2045
|
-
const d = c?.createNode ? c.createNode(t.schema, s, t) : typeof c?.nodeClass?.from == "function" ? c.nodeClass.from(t.schema, s, t) : new
|
|
2045
|
+
const d = c?.createNode ? c.createNode(t.schema, s, t) : typeof c?.nodeClass?.from == "function" ? c.nodeClass.from(t.schema, s, t) : new N(s);
|
|
2046
2046
|
return e ? d.tag = e : c.default || (d.tag = c.tag), l && (l.node = d), d;
|
|
2047
2047
|
}
|
|
2048
2048
|
function We(s, e, t) {
|
|
@@ -2055,7 +2055,7 @@ function We(s, e, t) {
|
|
|
2055
2055
|
} else
|
|
2056
2056
|
n = /* @__PURE__ */ new Map([[r, n]]);
|
|
2057
2057
|
}
|
|
2058
|
-
return
|
|
2058
|
+
return Le(n, void 0, {
|
|
2059
2059
|
aliasDuplicateObjects: !1,
|
|
2060
2060
|
keepUndefined: !1,
|
|
2061
2061
|
onAnchor: () => {
|
|
@@ -2082,7 +2082,7 @@ class Cs extends Ct {
|
|
|
2082
2082
|
*/
|
|
2083
2083
|
clone(e) {
|
|
2084
2084
|
const t = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
|
|
2085
|
-
return e && (t.schema = e), t.items = t.items.map((n) =>
|
|
2085
|
+
return e && (t.schema = e), t.items = t.items.map((n) => A(n) || E(n) ? n.clone(e) : n), this.range && (t.range = this.range.slice()), t;
|
|
2086
2086
|
}
|
|
2087
2087
|
/**
|
|
2088
2088
|
* Adds a value to the collection. For `!!map` and `!!omap` the value must
|
|
@@ -2094,7 +2094,7 @@ class Cs extends Ct {
|
|
|
2094
2094
|
this.add(t);
|
|
2095
2095
|
else {
|
|
2096
2096
|
const [n, ...i] = e, r = this.get(n, !0);
|
|
2097
|
-
if (
|
|
2097
|
+
if (L(r))
|
|
2098
2098
|
r.addIn(i, t);
|
|
2099
2099
|
else if (r === void 0 && this.schema)
|
|
2100
2100
|
this.set(n, We(this.schema, i, t));
|
|
@@ -2111,7 +2111,7 @@ class Cs extends Ct {
|
|
|
2111
2111
|
if (n.length === 0)
|
|
2112
2112
|
return this.delete(t);
|
|
2113
2113
|
const i = this.get(t, !0);
|
|
2114
|
-
if (
|
|
2114
|
+
if (L(i))
|
|
2115
2115
|
return i.deleteIn(n);
|
|
2116
2116
|
throw new Error(`Expected YAML collection at ${t}. Remaining path: ${n}`);
|
|
2117
2117
|
}
|
|
@@ -2122,7 +2122,7 @@ class Cs extends Ct {
|
|
|
2122
2122
|
*/
|
|
2123
2123
|
getIn(e, t) {
|
|
2124
2124
|
const [n, ...i] = e, r = this.get(n, !0);
|
|
2125
|
-
return i.length === 0 ? !t && _(r) ? r.value : r :
|
|
2125
|
+
return i.length === 0 ? !t && _(r) ? r.value : r : L(r) ? r.getIn(i, t) : void 0;
|
|
2126
2126
|
}
|
|
2127
2127
|
hasAllNullValues(e) {
|
|
2128
2128
|
return this.items.every((t) => {
|
|
@@ -2140,7 +2140,7 @@ class Cs extends Ct {
|
|
|
2140
2140
|
if (n.length === 0)
|
|
2141
2141
|
return this.has(t);
|
|
2142
2142
|
const i = this.get(t, !0);
|
|
2143
|
-
return
|
|
2143
|
+
return L(i) ? i.hasIn(n) : !1;
|
|
2144
2144
|
}
|
|
2145
2145
|
/**
|
|
2146
2146
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
@@ -2152,7 +2152,7 @@ class Cs extends Ct {
|
|
|
2152
2152
|
this.set(n, t);
|
|
2153
2153
|
else {
|
|
2154
2154
|
const r = this.get(n, !0);
|
|
2155
|
-
if (
|
|
2155
|
+
if (L(r))
|
|
2156
2156
|
r.setIn(i, t);
|
|
2157
2157
|
else if (r === void 0 && this.schema)
|
|
2158
2158
|
this.set(n, We(this.schema, i, t));
|
|
@@ -2161,14 +2161,14 @@ class Cs extends Ct {
|
|
|
2161
2161
|
}
|
|
2162
2162
|
}
|
|
2163
2163
|
}
|
|
2164
|
-
const
|
|
2164
|
+
const Li = (s) => s.replace(/^(?!$)(?: $)?/gm, "#");
|
|
2165
2165
|
function W(s, e) {
|
|
2166
2166
|
return /^\n+$/.test(s) ? s.substring(1) : e ? s.replace(/^(?! *$)/gm, e) : s;
|
|
2167
2167
|
}
|
|
2168
2168
|
const te = (s, e, t) => s.endsWith(`
|
|
2169
2169
|
`) ? W(t, e) : t.includes(`
|
|
2170
2170
|
`) ? `
|
|
2171
|
-
` + W(t, e) : (s.endsWith(" ") ? "" : " ") + t,
|
|
2171
|
+
` + W(t, e) : (s.endsWith(" ") ? "" : " ") + t, Ls = "flow", bt = "block", Je = "quoted";
|
|
2172
2172
|
function ze(s, e, t = "flow", { indentAtStart: n, lineWidth: i = 80, minContentWidth: r = 20, onFold: o, onOverflow: a } = {}) {
|
|
2173
2173
|
if (!i || i < 0)
|
|
2174
2174
|
return s;
|
|
@@ -2254,7 +2254,7 @@ const Qe = (s, e) => ({
|
|
|
2254
2254
|
lineWidth: s.options.lineWidth,
|
|
2255
2255
|
minContentWidth: s.options.minContentWidth
|
|
2256
2256
|
}), Xe = (s) => /^(%|---|\.\.\.)/m.test(s);
|
|
2257
|
-
function
|
|
2257
|
+
function Ai(s, e, t) {
|
|
2258
2258
|
if (!e || e < 0)
|
|
2259
2259
|
return !1;
|
|
2260
2260
|
const n = e - t, i = s.length;
|
|
@@ -2337,7 +2337,7 @@ function St(s, e) {
|
|
|
2337
2337
|
return Oe(s, e);
|
|
2338
2338
|
const t = e.indent || (Xe(s) ? " " : ""), n = "'" + s.replace(/'/g, "''").replace(/\n+/g, `$&
|
|
2339
2339
|
${t}`) + "'";
|
|
2340
|
-
return e.implicitKey ? n : ze(n, t,
|
|
2340
|
+
return e.implicitKey ? n : ze(n, t, Ls, Qe(e, !1));
|
|
2341
2341
|
}
|
|
2342
2342
|
function fe(s, e) {
|
|
2343
2343
|
const { singleQuote: t } = e.options;
|
|
@@ -2363,7 +2363,7 @@ function Ve({ comment: s, type: e, value: t }, n, i, r) {
|
|
|
2363
2363
|
const { blockQuote: o, commentString: a, lineWidth: l } = n.options;
|
|
2364
2364
|
if (!o || /\n[\t ]+$/.test(t))
|
|
2365
2365
|
return fe(t, n);
|
|
2366
|
-
const c = n.indent || (n.forceBlockIndent || Xe(t) ? " " : ""), d = o === "literal" ? !0 : o === "folded" || e ===
|
|
2366
|
+
const c = n.indent || (n.forceBlockIndent || Xe(t) ? " " : ""), d = o === "literal" ? !0 : o === "folded" || e === N.BLOCK_FOLDED ? !1 : e === N.BLOCK_LITERAL ? !0 : !Ai(t, l, c.length);
|
|
2367
2367
|
if (!t)
|
|
2368
2368
|
return d ? `|
|
|
2369
2369
|
` : `>
|
|
@@ -2397,13 +2397,13 @@ function Ve({ comment: s, type: e, value: t }, n, i, r) {
|
|
|
2397
2397
|
if (s && (S += " " + a(s.replace(/ ?[\r\n]+/g, " ")), i && i()), !d) {
|
|
2398
2398
|
const v = t.replace(/\n+/g, `
|
|
2399
2399
|
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, "$1$2").replace(/\n+/g, `$&${c}`);
|
|
2400
|
-
let
|
|
2400
|
+
let I = !1;
|
|
2401
2401
|
const O = Qe(n, !0);
|
|
2402
|
-
o !== "folded" && e !==
|
|
2403
|
-
|
|
2402
|
+
o !== "folded" && e !== N.BLOCK_FOLDED && (O.onOverflow = () => {
|
|
2403
|
+
I = !0;
|
|
2404
2404
|
});
|
|
2405
2405
|
const y = ze(`${w}${v}${p}`, c, bt, O);
|
|
2406
|
-
if (!
|
|
2406
|
+
if (!I)
|
|
2407
2407
|
return `>${S}
|
|
2408
2408
|
${c}${y}`;
|
|
2409
2409
|
}
|
|
@@ -2418,7 +2418,7 @@ function Ei(s, e, t, n) {
|
|
|
2418
2418
|
if (/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))
|
|
2419
2419
|
return a || d || !r.includes(`
|
|
2420
2420
|
`) ? fe(r, e) : Ve(s, e, t, n);
|
|
2421
|
-
if (!a && !d && i !==
|
|
2421
|
+
if (!a && !d && i !== N.PLAIN && r.includes(`
|
|
2422
2422
|
`))
|
|
2423
2423
|
return Ve(s, e, t, n);
|
|
2424
2424
|
if (Xe(r)) {
|
|
@@ -2434,22 +2434,22 @@ ${l}`);
|
|
|
2434
2434
|
if (g.some(f) || p?.some(f))
|
|
2435
2435
|
return fe(r, e);
|
|
2436
2436
|
}
|
|
2437
|
-
return a ? u : ze(u, l,
|
|
2437
|
+
return a ? u : ze(u, l, Ls, Qe(e, !1));
|
|
2438
2438
|
}
|
|
2439
|
-
function
|
|
2439
|
+
function At(s, e, t, n) {
|
|
2440
2440
|
const { implicitKey: i, inFlow: r } = e, o = typeof s.value == "string" ? s : Object.assign({}, s, { value: String(s.value) });
|
|
2441
2441
|
let { type: a } = s;
|
|
2442
|
-
a !==
|
|
2442
|
+
a !== N.QUOTE_DOUBLE && /[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value) && (a = N.QUOTE_DOUBLE);
|
|
2443
2443
|
const l = (d) => {
|
|
2444
2444
|
switch (d) {
|
|
2445
|
-
case
|
|
2446
|
-
case
|
|
2445
|
+
case N.BLOCK_FOLDED:
|
|
2446
|
+
case N.BLOCK_LITERAL:
|
|
2447
2447
|
return i || r ? fe(o.value, e) : Ve(o, e, t, n);
|
|
2448
|
-
case
|
|
2448
|
+
case N.QUOTE_DOUBLE:
|
|
2449
2449
|
return Oe(o.value, e);
|
|
2450
|
-
case
|
|
2450
|
+
case N.QUOTE_SINGLE:
|
|
2451
2451
|
return St(o.value, e);
|
|
2452
|
-
case
|
|
2452
|
+
case N.PLAIN:
|
|
2453
2453
|
return Ei(o, e, t, n);
|
|
2454
2454
|
default:
|
|
2455
2455
|
return null;
|
|
@@ -2463,10 +2463,10 @@ function Lt(s, e, t, n) {
|
|
|
2463
2463
|
}
|
|
2464
2464
|
return c;
|
|
2465
2465
|
}
|
|
2466
|
-
function
|
|
2466
|
+
function As(s, e) {
|
|
2467
2467
|
const t = Object.assign({
|
|
2468
2468
|
blockQuote: !0,
|
|
2469
|
-
commentString:
|
|
2469
|
+
commentString: Li,
|
|
2470
2470
|
defaultKeyType: null,
|
|
2471
2471
|
defaultStringType: "PLAIN",
|
|
2472
2472
|
directives: null,
|
|
@@ -2530,8 +2530,8 @@ function $i(s, e) {
|
|
|
2530
2530
|
function ji(s, e, { anchors: t, doc: n }) {
|
|
2531
2531
|
if (!n.directives)
|
|
2532
2532
|
return "";
|
|
2533
|
-
const i = [], r = (_(s) ||
|
|
2534
|
-
r &&
|
|
2533
|
+
const i = [], r = (_(s) || L(s)) && s.anchor;
|
|
2534
|
+
r && Is(r) && (t.add(r), i.push(`&${r}`));
|
|
2535
2535
|
const o = s.tag ?? (e.default ? null : e.tag);
|
|
2536
2536
|
return o && i.push(n.directives.tagString(o)), i.join(" ");
|
|
2537
2537
|
}
|
|
@@ -2546,26 +2546,26 @@ function me(s, e, t, n) {
|
|
|
2546
2546
|
e.resolvedAliases ? e.resolvedAliases.add(s) : e.resolvedAliases = /* @__PURE__ */ new Set([s]), s = s.resolve(e.doc);
|
|
2547
2547
|
}
|
|
2548
2548
|
let i;
|
|
2549
|
-
const r =
|
|
2549
|
+
const r = A(s) ? s : e.doc.createNode(s, { onTagObj: (l) => i = l });
|
|
2550
2550
|
i ?? (i = $i(e.doc.schema.tags, r));
|
|
2551
2551
|
const o = ji(r, i, e);
|
|
2552
2552
|
o.length > 0 && (e.indentAtStart = (e.indentAtStart ?? 0) + o.length + 1);
|
|
2553
|
-
const a = typeof i.stringify == "function" ? i.stringify(r, e, t, n) : _(r) ?
|
|
2553
|
+
const a = typeof i.stringify == "function" ? i.stringify(r, e, t, n) : _(r) ? At(r, e, t, n) : r.toString(e, t, n);
|
|
2554
2554
|
return o ? _(r) || a[0] === "{" || a[0] === "[" ? `${o} ${a}` : `${o}
|
|
2555
2555
|
${e.indent}${a}` : a;
|
|
2556
2556
|
}
|
|
2557
2557
|
function Ri({ key: s, value: e }, t, n, i) {
|
|
2558
2558
|
const { allNullValues: r, doc: o, indent: a, indentStep: l, options: { commentString: c, indentSeq: d, simpleKeys: u } } = t;
|
|
2559
|
-
let f =
|
|
2559
|
+
let f = A(s) && s.comment || null;
|
|
2560
2560
|
if (u) {
|
|
2561
2561
|
if (f)
|
|
2562
2562
|
throw new Error("With simple keys, key nodes cannot have comments");
|
|
2563
|
-
if (
|
|
2563
|
+
if (L(s) || !A(s) && typeof s == "object") {
|
|
2564
2564
|
const O = "With simple keys, collection cannot be used as a key value";
|
|
2565
2565
|
throw new Error(O);
|
|
2566
2566
|
}
|
|
2567
2567
|
}
|
|
2568
|
-
let p = !u && (!s || f && e == null && !t.inFlow ||
|
|
2568
|
+
let p = !u && (!s || f && e == null && !t.inFlow || L(s) || (_(s) ? s.type === N.BLOCK_FOLDED || s.type === N.BLOCK_LITERAL : typeof s == "object"));
|
|
2569
2569
|
t = Object.assign({}, t, {
|
|
2570
2570
|
allNullValues: !1,
|
|
2571
2571
|
implicitKey: !p && (u || !r),
|
|
@@ -2585,23 +2585,23 @@ function Ri({ key: s, value: e }, t, n, i) {
|
|
|
2585
2585
|
g && (f = null), p ? (f && (m += te(m, t.indent, c(f))), m = `? ${m}
|
|
2586
2586
|
${a}:`) : (m = `${m}:`, f && (m += te(m, t.indent, c(f))));
|
|
2587
2587
|
let k, w, b;
|
|
2588
|
-
|
|
2588
|
+
A(e) ? (k = !!e.spaceBefore, w = e.commentBefore, b = e.comment) : (k = !1, w = null, b = null, e && typeof e == "object" && (e = o.createNode(e))), t.implicitKey = !1, !p && !f && _(e) && (t.indentAtStart = m.length + 1), h = !1, !d && l.length >= 2 && !t.inFlow && !p && Re(e) && !e.flow && !e.tag && !e.anchor && (t.indent = t.indent.substring(2));
|
|
2589
2589
|
let S = !1;
|
|
2590
2590
|
const v = me(e, t, () => S = !0, () => h = !0);
|
|
2591
|
-
let
|
|
2591
|
+
let I = " ";
|
|
2592
2592
|
if (f || k || w) {
|
|
2593
|
-
if (
|
|
2593
|
+
if (I = k ? `
|
|
2594
2594
|
` : "", w) {
|
|
2595
2595
|
const O = c(w);
|
|
2596
|
-
|
|
2596
|
+
I += `
|
|
2597
2597
|
${W(O, t.indent)}`;
|
|
2598
2598
|
}
|
|
2599
|
-
v === "" && !t.inFlow ?
|
|
2600
|
-
` && b && (
|
|
2599
|
+
v === "" && !t.inFlow ? I === `
|
|
2600
|
+
` && b && (I = `
|
|
2601
2601
|
|
|
2602
|
-
`) :
|
|
2602
|
+
`) : I += `
|
|
2603
2603
|
${t.indent}`;
|
|
2604
|
-
} else if (!p &&
|
|
2604
|
+
} else if (!p && L(e)) {
|
|
2605
2605
|
const O = v[0], y = v.indexOf(`
|
|
2606
2606
|
`), $ = y !== -1, H = t.inFlow ?? e.flow ?? e.items.length === 0;
|
|
2607
2607
|
if ($ || !H) {
|
|
@@ -2610,12 +2610,12 @@ ${t.indent}`;
|
|
|
2610
2610
|
let j = v.indexOf(" ");
|
|
2611
2611
|
O === "&" && j !== -1 && j < y && v[j + 1] === "!" && (j = v.indexOf(" ", j + 1)), (j === -1 || y < j) && (oe = !0);
|
|
2612
2612
|
}
|
|
2613
|
-
oe || (
|
|
2613
|
+
oe || (I = `
|
|
2614
2614
|
${t.indent}`);
|
|
2615
2615
|
}
|
|
2616
2616
|
} else (v === "" || v[0] === `
|
|
2617
|
-
`) && (
|
|
2618
|
-
return m +=
|
|
2617
|
+
`) && (I = "");
|
|
2618
|
+
return m += I + v, t.inFlow ? S && n && n() : b && !S ? m += te(m, t.indent, c(b)) : h && i && i(), m;
|
|
2619
2619
|
}
|
|
2620
2620
|
function Es(s, e) {
|
|
2621
2621
|
(s === "debug" || s === "warn") && console.warn(e);
|
|
@@ -2625,11 +2625,11 @@ const Me = "<<", Y = {
|
|
|
2625
2625
|
default: "key",
|
|
2626
2626
|
tag: "tag:yaml.org,2002:merge",
|
|
2627
2627
|
test: /^<<$/,
|
|
2628
|
-
resolve: () => Object.assign(new
|
|
2628
|
+
resolve: () => Object.assign(new N(Symbol(Me)), {
|
|
2629
2629
|
addToJSMap: $s
|
|
2630
2630
|
}),
|
|
2631
2631
|
stringify: () => Me
|
|
2632
|
-
}, Pi = (s, e) => (Y.identify(e) || _(e) && (!e.type || e.type ===
|
|
2632
|
+
}, Pi = (s, e) => (Y.identify(e) || _(e) && (!e.type || e.type === N.PLAIN) && Y.identify(e.value)) && s?.doc.schema.tags.some((t) => t.tag === Y.tag && t.default);
|
|
2633
2633
|
function $s(s, e, t) {
|
|
2634
2634
|
if (t = s && re(t) ? t.resolve(s.doc) : t, Re(t))
|
|
2635
2635
|
for (const n of t.items)
|
|
@@ -2655,7 +2655,7 @@ function ut(s, e, t) {
|
|
|
2655
2655
|
return e;
|
|
2656
2656
|
}
|
|
2657
2657
|
function js(s, e, { key: t, value: n }) {
|
|
2658
|
-
if (
|
|
2658
|
+
if (A(t) && t.addToJSMap)
|
|
2659
2659
|
t.addToJSMap(s, e, n);
|
|
2660
2660
|
else if (Pi(s, t))
|
|
2661
2661
|
$s(s, e, n);
|
|
@@ -2682,8 +2682,8 @@ function Ui(s, e, t) {
|
|
|
2682
2682
|
return "";
|
|
2683
2683
|
if (typeof e != "object")
|
|
2684
2684
|
return String(e);
|
|
2685
|
-
if (
|
|
2686
|
-
const n =
|
|
2685
|
+
if (A(s) && t?.doc) {
|
|
2686
|
+
const n = As(t.doc, {});
|
|
2687
2687
|
n.anchors = /* @__PURE__ */ new Set();
|
|
2688
2688
|
for (const r of t.anchors.keys())
|
|
2689
2689
|
n.anchors.add(r.anchor);
|
|
@@ -2698,7 +2698,7 @@ function Ui(s, e, t) {
|
|
|
2698
2698
|
return JSON.stringify(e);
|
|
2699
2699
|
}
|
|
2700
2700
|
function Et(s, e, t) {
|
|
2701
|
-
const n =
|
|
2701
|
+
const n = Le(s, void 0, t), i = Le(e, void 0, t);
|
|
2702
2702
|
return new U(n, i);
|
|
2703
2703
|
}
|
|
2704
2704
|
class U {
|
|
@@ -2707,7 +2707,7 @@ class U {
|
|
|
2707
2707
|
}
|
|
2708
2708
|
clone(e) {
|
|
2709
2709
|
let { key: t, value: n } = this;
|
|
2710
|
-
return
|
|
2710
|
+
return A(t) && (t = t.clone(e)), A(n) && (n = n.clone(e)), new U(t, n);
|
|
2711
2711
|
}
|
|
2712
2712
|
toJSON(e, t) {
|
|
2713
2713
|
const n = t?.mapAsMap ? /* @__PURE__ */ new Map() : {};
|
|
@@ -2727,10 +2727,10 @@ function xi({ comment: s, items: e }, t, { blockItemPrefix: n, flowChars: i, ite
|
|
|
2727
2727
|
for (let g = 0; g < e.length; ++g) {
|
|
2728
2728
|
const h = e[g];
|
|
2729
2729
|
let m = null;
|
|
2730
|
-
if (
|
|
2730
|
+
if (A(h))
|
|
2731
2731
|
!u && h.spaceBefore && f.push(""), Ye(t, f, h.commentBefore, u), h.comment && (m = h.comment);
|
|
2732
2732
|
else if (E(h)) {
|
|
2733
|
-
const w =
|
|
2733
|
+
const w = A(h.key) ? h.key : null;
|
|
2734
2734
|
w && (!u && w.spaceBefore && f.push(""), Ye(t, f, w.commentBefore, u));
|
|
2735
2735
|
}
|
|
2736
2736
|
u = !1;
|
|
@@ -2765,12 +2765,12 @@ function Mi({ items: s }, e, { flowChars: t, itemIndent: n }) {
|
|
|
2765
2765
|
for (let g = 0; g < s.length; ++g) {
|
|
2766
2766
|
const h = s[g];
|
|
2767
2767
|
let m = null;
|
|
2768
|
-
if (
|
|
2768
|
+
if (A(h))
|
|
2769
2769
|
h.spaceBefore && u.push(""), Ye(e, u, h.commentBefore, !1), h.comment && (m = h.comment);
|
|
2770
2770
|
else if (E(h)) {
|
|
2771
|
-
const w =
|
|
2771
|
+
const w = A(h.key) ? h.key : null;
|
|
2772
2772
|
w && (w.spaceBefore && u.push(""), Ye(e, u, w.commentBefore, !1), w.comment && (c = !0));
|
|
2773
|
-
const b =
|
|
2773
|
+
const b = A(h.value) ? h.value : null;
|
|
2774
2774
|
b ? (b.comment && (m = b.comment), b.commentBefore && (c = !0)) : h.value == null && w?.comment && (m = w.comment);
|
|
2775
2775
|
}
|
|
2776
2776
|
m && (c = !0);
|
|
@@ -2985,7 +2985,7 @@ class ie extends Cs {
|
|
|
2985
2985
|
const l = t instanceof Set ? a : String(o++);
|
|
2986
2986
|
a = i.call(t, l, a);
|
|
2987
2987
|
}
|
|
2988
|
-
r.items.push(
|
|
2988
|
+
r.items.push(Le(a, void 0, n));
|
|
2989
2989
|
}
|
|
2990
2990
|
}
|
|
2991
2991
|
return r;
|
|
@@ -3010,22 +3010,22 @@ const be = {
|
|
|
3010
3010
|
tag: "tag:yaml.org,2002:str",
|
|
3011
3011
|
resolve: (s) => s,
|
|
3012
3012
|
stringify(s, e, t, n) {
|
|
3013
|
-
return e = Object.assign({ actualString: !0 }, e),
|
|
3013
|
+
return e = Object.assign({ actualString: !0 }, e), At(s, e, t, n);
|
|
3014
3014
|
}
|
|
3015
3015
|
}, et = {
|
|
3016
3016
|
identify: (s) => s == null,
|
|
3017
|
-
createNode: () => new
|
|
3017
|
+
createNode: () => new N(null),
|
|
3018
3018
|
default: !0,
|
|
3019
3019
|
tag: "tag:yaml.org,2002:null",
|
|
3020
3020
|
test: /^(?:~|[Nn]ull|NULL)?$/,
|
|
3021
|
-
resolve: () => new
|
|
3021
|
+
resolve: () => new N(null),
|
|
3022
3022
|
stringify: ({ source: s }, e) => typeof s == "string" && et.test.test(s) ? s : e.options.nullStr
|
|
3023
3023
|
}, $t = {
|
|
3024
3024
|
identify: (s) => typeof s == "boolean",
|
|
3025
3025
|
default: !0,
|
|
3026
3026
|
tag: "tag:yaml.org,2002:bool",
|
|
3027
3027
|
test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
|
|
3028
|
-
resolve: (s) => new
|
|
3028
|
+
resolve: (s) => new N(s[0] === "t" || s[0] === "T"),
|
|
3029
3029
|
stringify({ source: s, value: e }, t) {
|
|
3030
3030
|
if (s && $t.test.test(s)) {
|
|
3031
3031
|
const n = s[0] === "t" || s[0] === "T";
|
|
@@ -3075,7 +3075,7 @@ const Ps = {
|
|
|
3075
3075
|
tag: "tag:yaml.org,2002:float",
|
|
3076
3076
|
test: /^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,
|
|
3077
3077
|
resolve(s) {
|
|
3078
|
-
const e = new
|
|
3078
|
+
const e = new N(parseFloat(s)), t = s.indexOf(".");
|
|
3079
3079
|
return t !== -1 && s[s.length - 1] === "0" && (e.minFractionDigits = s.length - t - 1), e;
|
|
3080
3080
|
},
|
|
3081
3081
|
stringify: F
|
|
@@ -3133,7 +3133,7 @@ const Be = ({ value: s }) => JSON.stringify(s), Bi = [
|
|
|
3133
3133
|
},
|
|
3134
3134
|
{
|
|
3135
3135
|
identify: (s) => s == null,
|
|
3136
|
-
createNode: () => new
|
|
3136
|
+
createNode: () => new N(null),
|
|
3137
3137
|
default: !0,
|
|
3138
3138
|
tag: "tag:yaml.org,2002:null",
|
|
3139
3139
|
test: /^null$/,
|
|
@@ -3205,14 +3205,14 @@ const Be = ({ value: s }) => JSON.stringify(s), Bi = [
|
|
|
3205
3205
|
a = btoa(l);
|
|
3206
3206
|
} else
|
|
3207
3207
|
throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");
|
|
3208
|
-
if (e ?? (e =
|
|
3208
|
+
if (e ?? (e = N.BLOCK_LITERAL), e !== N.QUOTE_DOUBLE) {
|
|
3209
3209
|
const l = Math.max(n.options.lineWidth - n.indent.length, n.options.minContentWidth), c = Math.ceil(a.length / l), d = new Array(c);
|
|
3210
3210
|
for (let u = 0, f = 0; u < c; ++u, f += l)
|
|
3211
3211
|
d[u] = a.substr(f, l);
|
|
3212
|
-
a = d.join(e ===
|
|
3212
|
+
a = d.join(e === N.BLOCK_LITERAL ? `
|
|
3213
3213
|
` : " ");
|
|
3214
3214
|
}
|
|
3215
|
-
return
|
|
3215
|
+
return At({ comment: s, type: e, value: a }, n, i, r);
|
|
3216
3216
|
}
|
|
3217
3217
|
};
|
|
3218
3218
|
function Ks(s, e) {
|
|
@@ -3222,7 +3222,7 @@ function Ks(s, e) {
|
|
|
3222
3222
|
if (!E(n)) {
|
|
3223
3223
|
if (je(n)) {
|
|
3224
3224
|
n.items.length > 1 && e("Each pair must have its own sequence indicator");
|
|
3225
|
-
const i = n.items[0] || new U(new
|
|
3225
|
+
const i = n.items[0] || new U(new N(null));
|
|
3226
3226
|
if (n.commentBefore && (i.key.commentBefore = i.key.commentBefore ? `${n.commentBefore}
|
|
3227
3227
|
${i.key.commentBefore}` : n.commentBefore), n.comment) {
|
|
3228
3228
|
const r = i.value ?? i.key;
|
|
@@ -3319,14 +3319,14 @@ const Vs = {
|
|
|
3319
3319
|
default: !0,
|
|
3320
3320
|
tag: "tag:yaml.org,2002:bool",
|
|
3321
3321
|
test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,
|
|
3322
|
-
resolve: () => new
|
|
3322
|
+
resolve: () => new N(!0),
|
|
3323
3323
|
stringify: Js
|
|
3324
3324
|
}, Ws = {
|
|
3325
3325
|
identify: (s) => s === !1,
|
|
3326
3326
|
default: !0,
|
|
3327
3327
|
tag: "tag:yaml.org,2002:bool",
|
|
3328
3328
|
test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,
|
|
3329
|
-
resolve: () => new
|
|
3329
|
+
resolve: () => new N(!1),
|
|
3330
3330
|
stringify: Js
|
|
3331
3331
|
}, Fi = {
|
|
3332
3332
|
identify: (s) => typeof s == "number",
|
|
@@ -3352,7 +3352,7 @@ const Vs = {
|
|
|
3352
3352
|
tag: "tag:yaml.org,2002:float",
|
|
3353
3353
|
test: /^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,
|
|
3354
3354
|
resolve(s) {
|
|
3355
|
-
const e = new
|
|
3355
|
+
const e = new N(parseFloat(s.replace(/_/g, ""))), t = s.indexOf(".");
|
|
3356
3356
|
if (t !== -1) {
|
|
3357
3357
|
const n = s.substring(t + 1).replace(/_/g, "");
|
|
3358
3358
|
n[n.length - 1] === "0" && (e.minFractionDigits = n.length);
|
|
@@ -3630,7 +3630,7 @@ function Xi(s, e) {
|
|
|
3630
3630
|
l ? (t.push(l), n = !0) : s.directives.docStart && (n = !0);
|
|
3631
3631
|
}
|
|
3632
3632
|
n && t.push("---");
|
|
3633
|
-
const i =
|
|
3633
|
+
const i = As(s, e), { commentString: r } = i.options;
|
|
3634
3634
|
if (s.commentBefore) {
|
|
3635
3635
|
t.length !== 1 && t.unshift("");
|
|
3636
3636
|
const l = r(s.commentBefore);
|
|
@@ -3638,7 +3638,7 @@ function Xi(s, e) {
|
|
|
3638
3638
|
}
|
|
3639
3639
|
let o = !1, a = null;
|
|
3640
3640
|
if (s.contents) {
|
|
3641
|
-
if (
|
|
3641
|
+
if (A(s.contents)) {
|
|
3642
3642
|
if (s.contents.spaceBefore && n && t.push(""), s.contents.commentBefore) {
|
|
3643
3643
|
const d = r(s.contents.commentBefore);
|
|
3644
3644
|
t.push(W(d, ""));
|
|
@@ -3693,7 +3693,7 @@ class Ue {
|
|
|
3693
3693
|
const e = Object.create(Ue.prototype, {
|
|
3694
3694
|
[B]: { value: wt }
|
|
3695
3695
|
});
|
|
3696
|
-
return e.commentBefore = this.commentBefore, e.comment = this.comment, e.errors = this.errors.slice(), e.warnings = this.warnings.slice(), e.options = Object.assign({}, this.options), this.directives && (e.directives = this.directives.clone()), e.schema = this.schema.clone(), e.contents =
|
|
3696
|
+
return e.commentBefore = this.commentBefore, e.comment = this.comment, e.errors = this.errors.slice(), e.warnings = this.warnings.slice(), e.options = Object.assign({}, this.options), this.directives && (e.directives = this.directives.clone()), e.schema = this.schema.clone(), e.contents = A(this.contents) ? this.contents.clone(e.schema) : this.contents, this.range && (e.range = this.range.slice()), e;
|
|
3697
3697
|
}
|
|
3698
3698
|
/** Adds a value to the document. */
|
|
3699
3699
|
add(e) {
|
|
@@ -3714,11 +3714,11 @@ class Ue {
|
|
|
3714
3714
|
*/
|
|
3715
3715
|
createAlias(e, t) {
|
|
3716
3716
|
if (!e.anchor) {
|
|
3717
|
-
const n =
|
|
3717
|
+
const n = Ts(this);
|
|
3718
3718
|
e.anchor = // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
3719
3719
|
!t || n.has(t) ? Os(t || "a", n) : t;
|
|
3720
3720
|
}
|
|
3721
|
-
return new
|
|
3721
|
+
return new Lt(e.anchor);
|
|
3722
3722
|
}
|
|
3723
3723
|
createNode(e, t, n) {
|
|
3724
3724
|
let i;
|
|
@@ -3740,8 +3740,8 @@ class Ue {
|
|
|
3740
3740
|
replacer: i,
|
|
3741
3741
|
schema: this.schema,
|
|
3742
3742
|
sourceObjects: p
|
|
3743
|
-
}, h =
|
|
3744
|
-
return a &&
|
|
3743
|
+
}, h = Le(e, d, g);
|
|
3744
|
+
return a && L(h) && (h.flow = !0), f(), h;
|
|
3745
3745
|
}
|
|
3746
3746
|
/**
|
|
3747
3747
|
* Convert a key and a value into a `Pair` using the current schema,
|
|
@@ -3771,7 +3771,7 @@ class Ue {
|
|
|
3771
3771
|
* `true` (collections are always returned intact).
|
|
3772
3772
|
*/
|
|
3773
3773
|
get(e, t) {
|
|
3774
|
-
return
|
|
3774
|
+
return L(this.contents) ? this.contents.get(e, t) : void 0;
|
|
3775
3775
|
}
|
|
3776
3776
|
/**
|
|
3777
3777
|
* Returns item at `path`, or `undefined` if not found. By default unwraps
|
|
@@ -3779,19 +3779,19 @@ class Ue {
|
|
|
3779
3779
|
* `true` (collections are always returned intact).
|
|
3780
3780
|
*/
|
|
3781
3781
|
getIn(e, t) {
|
|
3782
|
-
return ve(e) ? !t && _(this.contents) ? this.contents.value : this.contents :
|
|
3782
|
+
return ve(e) ? !t && _(this.contents) ? this.contents.value : this.contents : L(this.contents) ? this.contents.getIn(e, t) : void 0;
|
|
3783
3783
|
}
|
|
3784
3784
|
/**
|
|
3785
3785
|
* Checks if the document includes a value with the key `key`.
|
|
3786
3786
|
*/
|
|
3787
3787
|
has(e) {
|
|
3788
|
-
return
|
|
3788
|
+
return L(this.contents) ? this.contents.has(e) : !1;
|
|
3789
3789
|
}
|
|
3790
3790
|
/**
|
|
3791
3791
|
* Checks if the document includes a value at `path`.
|
|
3792
3792
|
*/
|
|
3793
3793
|
hasIn(e) {
|
|
3794
|
-
return ve(e) ? this.contents !== void 0 :
|
|
3794
|
+
return ve(e) ? this.contents !== void 0 : L(this.contents) ? this.contents.hasIn(e) : !1;
|
|
3795
3795
|
}
|
|
3796
3796
|
/**
|
|
3797
3797
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -3876,7 +3876,7 @@ class Ue {
|
|
|
3876
3876
|
}
|
|
3877
3877
|
}
|
|
3878
3878
|
function ae(s) {
|
|
3879
|
-
if (
|
|
3879
|
+
if (L(s))
|
|
3880
3880
|
return !0;
|
|
3881
3881
|
throw new Error("Expected a YAML collection as document contents");
|
|
3882
3882
|
}
|
|
@@ -3885,7 +3885,7 @@ class zs extends Error {
|
|
|
3885
3885
|
super(), this.name = e, this.code = n, this.message = i, this.pos = t;
|
|
3886
3886
|
}
|
|
3887
3887
|
}
|
|
3888
|
-
class
|
|
3888
|
+
class Ne extends zs {
|
|
3889
3889
|
constructor(e, t, n) {
|
|
3890
3890
|
super("YAMLParseError", e, t, n);
|
|
3891
3891
|
}
|
|
@@ -3958,7 +3958,7 @@ function ge(s, { flow: e, indicator: t, next: n, offset: i, onError: r, parentIn
|
|
|
3958
3958
|
default:
|
|
3959
3959
|
r(y, "UNEXPECTED_TOKEN", `Unexpected ${y.type} token`), c = !1, d = !1;
|
|
3960
3960
|
}
|
|
3961
|
-
const
|
|
3961
|
+
const I = s[s.length - 1], O = I ? I.offset + I.source.length : i;
|
|
3962
3962
|
return g && n && n.type !== "space" && n.type !== "newline" && n.type !== "comma" && (n.type !== "scalar" || n.source !== "") && r(n.offset, "MISSING_CHAR", "Tags and anchors must be separated from the next token by white space"), h && (c && h.indent <= o || n?.type === "block-map" || n?.type === "block-seq") && r(h, "TAB_AS_INDENT", "Tabs are not allowed as indentation"), {
|
|
3963
3963
|
comma: b,
|
|
3964
3964
|
found: S,
|
|
@@ -3972,7 +3972,7 @@ function ge(s, { flow: e, indicator: t, next: n, offset: i, onError: r, parentIn
|
|
|
3972
3972
|
start: v ?? O
|
|
3973
3973
|
};
|
|
3974
3974
|
}
|
|
3975
|
-
function
|
|
3975
|
+
function Ae(s) {
|
|
3976
3976
|
if (!s)
|
|
3977
3977
|
return null;
|
|
3978
3978
|
switch (s.type) {
|
|
@@ -3999,7 +3999,7 @@ function Le(s) {
|
|
|
3999
3999
|
if (t.type === "newline")
|
|
4000
4000
|
return !0;
|
|
4001
4001
|
}
|
|
4002
|
-
if (
|
|
4002
|
+
if (Ae(e.key) || Ae(e.value))
|
|
4003
4003
|
return !0;
|
|
4004
4004
|
}
|
|
4005
4005
|
return !1;
|
|
@@ -4007,10 +4007,10 @@ function Le(s) {
|
|
|
4007
4007
|
return !0;
|
|
4008
4008
|
}
|
|
4009
4009
|
}
|
|
4010
|
-
function
|
|
4010
|
+
function Nt(s, e, t) {
|
|
4011
4011
|
if (e?.type === "flow-collection") {
|
|
4012
4012
|
const n = e.end[0];
|
|
4013
|
-
n.indent === s && (n.source === "]" || n.source === "}") &&
|
|
4013
|
+
n.indent === s && (n.source === "]" || n.source === "}") && Ae(e) && t(n, "BAD_INDENT", "Flow end indicator should be more indented than parent", !0);
|
|
4014
4014
|
}
|
|
4015
4015
|
}
|
|
4016
4016
|
function Qs(s, e, t) {
|
|
@@ -4040,11 +4040,11 @@ function er({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
4040
4040
|
` + h.comment : a.comment = h.comment);
|
|
4041
4041
|
continue;
|
|
4042
4042
|
}
|
|
4043
|
-
(h.newlineAfterProp ||
|
|
4043
|
+
(h.newlineAfterProp || Ae(f)) && i(f ?? u[u.length - 1], "MULTILINE_IMPLICIT_KEY", "Implicit keys need to be on a single line");
|
|
4044
4044
|
} else h.found?.indent !== n.indent && i(l, "BAD_INDENT", es);
|
|
4045
4045
|
t.atKey = !0;
|
|
4046
4046
|
const k = h.end, w = f ? s(t, f, h, i) : e(t, k, u, null, h, i);
|
|
4047
|
-
t.schema.compat &&
|
|
4047
|
+
t.schema.compat && Nt(n.indent, f, i), t.atKey = !1, Qs(t, a.items, w) && i(k, "DUPLICATE_KEY", "Map keys must be unique");
|
|
4048
4048
|
const b = ge(p ?? [], {
|
|
4049
4049
|
indicator: "map-value-ind",
|
|
4050
4050
|
next: g,
|
|
@@ -4056,7 +4056,7 @@ function er({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
4056
4056
|
if (l = b.end, b.found) {
|
|
4057
4057
|
m && (g?.type === "block-map" && !b.hasNewline && i(l, "BLOCK_AS_IMPLICIT_KEY", "Nested mappings are not allowed in compact mappings"), t.options.strict && h.start < b.found.offset - 1024 && i(w.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));
|
|
4058
4058
|
const S = g ? s(t, g, b, i) : e(t, l, p, null, b, i);
|
|
4059
|
-
t.schema.compat &&
|
|
4059
|
+
t.schema.compat && Nt(n.indent, g, i), l = S.range[2];
|
|
4060
4060
|
const v = new U(w, S);
|
|
4061
4061
|
t.options.keepSourceTokens && (v.srcToken = d), a.items.push(v);
|
|
4062
4062
|
} else {
|
|
@@ -4089,7 +4089,7 @@ function tr({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
4089
4089
|
continue;
|
|
4090
4090
|
}
|
|
4091
4091
|
const p = u ? s(t, u, f, i) : e(t, f.end, d, null, f, i);
|
|
4092
|
-
t.schema.compat &&
|
|
4092
|
+
t.schema.compat && Nt(n.indent, u, i), l = p.range[2], a.items.push(p);
|
|
4093
4093
|
}
|
|
4094
4094
|
return a.range = [n.offset, l, c ?? l], a;
|
|
4095
4095
|
}
|
|
@@ -4128,7 +4128,7 @@ function sr({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
4128
4128
|
d && (t.atRoot = !1), t.atKey && (t.atKey = !1);
|
|
4129
4129
|
let u = n.offset + n.start.source.length;
|
|
4130
4130
|
for (let m = 0; m < n.items.length; ++m) {
|
|
4131
|
-
const k = n.items[m], { start: w, key: b, sep: S, value: v } = k,
|
|
4131
|
+
const k = n.items[m], { start: w, key: b, sep: S, value: v } = k, I = ge(w, {
|
|
4132
4132
|
flow: a,
|
|
4133
4133
|
indicator: "explicit-key-ind",
|
|
4134
4134
|
next: b ?? S?.[0],
|
|
@@ -4137,13 +4137,13 @@ function sr({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
4137
4137
|
parentIndent: n.indent,
|
|
4138
4138
|
startOnNewline: !1
|
|
4139
4139
|
});
|
|
4140
|
-
if (!
|
|
4141
|
-
if (!
|
|
4142
|
-
m === 0 &&
|
|
4143
|
-
` +
|
|
4140
|
+
if (!I.found) {
|
|
4141
|
+
if (!I.anchor && !I.tag && !S && !v) {
|
|
4142
|
+
m === 0 && I.comma ? i(I.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${a}`) : m < n.items.length - 1 && i(I.start, "UNEXPECTED_TOKEN", `Unexpected empty item in ${a}`), I.comment && (c.comment ? c.comment += `
|
|
4143
|
+
` + I.comment : c.comment = I.comment), u = I.end;
|
|
4144
4144
|
continue;
|
|
4145
4145
|
}
|
|
4146
|
-
!o && t.options.strict &&
|
|
4146
|
+
!o && t.options.strict && Ae(b) && i(
|
|
4147
4147
|
b,
|
|
4148
4148
|
// checked by containsNewline()
|
|
4149
4149
|
"MULTILINE_IMPLICIT_KEY",
|
|
@@ -4151,8 +4151,8 @@ function sr({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
4151
4151
|
);
|
|
4152
4152
|
}
|
|
4153
4153
|
if (m === 0)
|
|
4154
|
-
|
|
4155
|
-
else if (
|
|
4154
|
+
I.comma && i(I.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${a}`);
|
|
4155
|
+
else if (I.comma || i(I.start, "MISSING_CHAR", `Missing , between ${a} items`), I.comment) {
|
|
4156
4156
|
let O = "";
|
|
4157
4157
|
e: for (const y of w)
|
|
4158
4158
|
switch (y.type) {
|
|
@@ -4168,15 +4168,15 @@ function sr({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
4168
4168
|
if (O) {
|
|
4169
4169
|
let y = c.items[c.items.length - 1];
|
|
4170
4170
|
E(y) && (y = y.value ?? y.key), y.comment ? y.comment += `
|
|
4171
|
-
` + O : y.comment = O,
|
|
4171
|
+
` + O : y.comment = O, I.comment = I.comment.substring(O.length + 1);
|
|
4172
4172
|
}
|
|
4173
4173
|
}
|
|
4174
|
-
if (!o && !S && !
|
|
4175
|
-
const O = v ? s(t, v,
|
|
4174
|
+
if (!o && !S && !I.found) {
|
|
4175
|
+
const O = v ? s(t, v, I, i) : e(t, I.end, S, null, I, i);
|
|
4176
4176
|
c.items.push(O), u = O.range[2], ht(v) && i(O.range, "BLOCK_IN_FLOW", dt);
|
|
4177
4177
|
} else {
|
|
4178
4178
|
t.atKey = !0;
|
|
4179
|
-
const O =
|
|
4179
|
+
const O = I.end, y = b ? s(t, b, I, i) : e(t, O, w, null, I, i);
|
|
4180
4180
|
ht(b) && i(y.range, "BLOCK_IN_FLOW", dt), t.atKey = !1;
|
|
4181
4181
|
const $ = ge(S ?? [], {
|
|
4182
4182
|
flow: a,
|
|
@@ -4188,7 +4188,7 @@ function sr({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
4188
4188
|
startOnNewline: !1
|
|
4189
4189
|
});
|
|
4190
4190
|
if ($.found) {
|
|
4191
|
-
if (!o && !
|
|
4191
|
+
if (!o && !I.found && t.options.strict) {
|
|
4192
4192
|
if (S)
|
|
4193
4193
|
for (const j of S) {
|
|
4194
4194
|
if (j === $.found)
|
|
@@ -4198,7 +4198,7 @@ function sr({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
4198
4198
|
break;
|
|
4199
4199
|
}
|
|
4200
4200
|
}
|
|
4201
|
-
|
|
4201
|
+
I.start < $.found.offset - 1024 && i($.found, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit flow sequence key");
|
|
4202
4202
|
}
|
|
4203
4203
|
} else v && ("source" in v && v.source?.[0] === ":" ? i(v, "MISSING_CHAR", `Missing space after : in ${a}`) : i($.start, "MISSING_CHAR", `Missing , or : between ${a} items`));
|
|
4204
4204
|
const H = v ? s(t, v, $, i) : $.found ? e(t, $.end, S, null, $, i) : null;
|
|
@@ -4254,14 +4254,14 @@ function nr(s, e, t, n, i) {
|
|
|
4254
4254
|
else
|
|
4255
4255
|
return f ? i(r, "BAD_COLLECTION_TYPE", `${f.tag} used for ${a} collection, but expects ${f.collection ?? "scalar"}`, !0) : i(r, "TAG_RESOLVE_FAILED", `Unresolved tag: ${o}`, !0), pt(s, e, t, i, o);
|
|
4256
4256
|
}
|
|
4257
|
-
const c = pt(s, e, t, i, o, l), d = l.resolve?.(c, (f) => i(r, "TAG_RESOLVE_FAILED", f), e.options) ?? c, u =
|
|
4257
|
+
const c = pt(s, e, t, i, o, l), d = l.resolve?.(c, (f) => i(r, "TAG_RESOLVE_FAILED", f), e.options) ?? c, u = A(d) ? d : new N(d);
|
|
4258
4258
|
return u.range = c.range, u.tag = o, l?.format && (u.format = l.format), u;
|
|
4259
4259
|
}
|
|
4260
4260
|
function ir(s, e, t) {
|
|
4261
4261
|
const n = e.offset, i = rr(e, s.options.strict, t);
|
|
4262
4262
|
if (!i)
|
|
4263
4263
|
return { value: "", type: null, comment: "", range: [n, n, n] };
|
|
4264
|
-
const r = i.mode === ">" ?
|
|
4264
|
+
const r = i.mode === ">" ? N.BLOCK_FOLDED : N.BLOCK_LITERAL, o = e.source ? or(e.source) : [];
|
|
4265
4265
|
let a = o.length;
|
|
4266
4266
|
for (let h = o.length - 1; h >= 0; --h) {
|
|
4267
4267
|
const m = o[h][1];
|
|
@@ -4301,7 +4301,7 @@ function ir(s, e, t) {
|
|
|
4301
4301
|
const S = `Block scalar lines must not be less indented than their ${i.indent ? "explicit indentation indicator" : "first line"}`;
|
|
4302
4302
|
t(c - k.length - (w ? 2 : 1), "BAD_INDENT", S), m = "";
|
|
4303
4303
|
}
|
|
4304
|
-
r ===
|
|
4304
|
+
r === N.BLOCK_LITERAL ? (u += f + m.slice(l) + k, f = `
|
|
4305
4305
|
`) : m.length > l || k[0] === " " ? (f === " " ? f = `
|
|
4306
4306
|
` : !p && f === `
|
|
4307
4307
|
` && (f = `
|
|
@@ -4384,13 +4384,13 @@ function ar(s, e, t) {
|
|
|
4384
4384
|
const c = (f, p, g) => t(n + f, p, g);
|
|
4385
4385
|
switch (i) {
|
|
4386
4386
|
case "scalar":
|
|
4387
|
-
a =
|
|
4387
|
+
a = N.PLAIN, l = lr(r, c);
|
|
4388
4388
|
break;
|
|
4389
4389
|
case "single-quoted-scalar":
|
|
4390
|
-
a =
|
|
4390
|
+
a = N.QUOTE_SINGLE, l = cr(r, c);
|
|
4391
4391
|
break;
|
|
4392
4392
|
case "double-quoted-scalar":
|
|
4393
|
-
a =
|
|
4393
|
+
a = N.QUOTE_DOUBLE, l = ur(r, c);
|
|
4394
4394
|
break;
|
|
4395
4395
|
/* istanbul ignore next should not happen */
|
|
4396
4396
|
default:
|
|
@@ -4560,10 +4560,10 @@ function Zs(s, e, t, n) {
|
|
|
4560
4560
|
let d;
|
|
4561
4561
|
try {
|
|
4562
4562
|
const u = c.resolve(i, (f) => n(t ?? e, "TAG_RESOLVE_FAILED", f), s.options);
|
|
4563
|
-
d = _(u) ? u : new
|
|
4563
|
+
d = _(u) ? u : new N(u);
|
|
4564
4564
|
} catch (u) {
|
|
4565
4565
|
const f = u instanceof Error ? u.message : String(u);
|
|
4566
|
-
n(t ?? e, "TAG_RESOLVE_FAILED", f), d = new
|
|
4566
|
+
n(t ?? e, "TAG_RESOLVE_FAILED", f), d = new N(i);
|
|
4567
4567
|
}
|
|
4568
4568
|
return d.range = a, d.source = i, r && (d.type = r), l && (d.tag = l), c.format && (d.format = c.format), o && (d.comment = o), d;
|
|
4569
4569
|
}
|
|
@@ -4649,7 +4649,7 @@ function qt(s, e, t, n, { spaceBefore: i, comment: r, anchor: o, tag: a, end: l
|
|
|
4649
4649
|
return o && (u.anchor = o.source.substring(1), u.anchor === "" && c(o, "BAD_ALIAS", "Anchor cannot be an empty string")), i && (u.spaceBefore = !0), r && (u.comment = r, u.range[2] = l), u;
|
|
4650
4650
|
}
|
|
4651
4651
|
function kr({ options: s }, { offset: e, source: t, end: n }, i) {
|
|
4652
|
-
const r = new
|
|
4652
|
+
const r = new Lt(t.substring(1));
|
|
4653
4653
|
r.source === "" && i(e, "BAD_ALIAS", "Alias cannot be an empty string"), r.source.endsWith(":") && i(e + t.length - 1, "BAD_ALIAS", "Alias ending in : is ambiguous", !0);
|
|
4654
4654
|
const o = e + t.length, a = xe(n, o, s.strict, i);
|
|
4655
4655
|
return r.range = [e, o, a.offset], a.comment && (r.comment = a.comment), r;
|
|
@@ -4705,7 +4705,7 @@ class br {
|
|
|
4705
4705
|
constructor(e = {}) {
|
|
4706
4706
|
this.doc = null, this.atDirectives = !1, this.prelude = [], this.errors = [], this.warnings = [], this.onError = (t, n, i, r) => {
|
|
4707
4707
|
const o = Se(t);
|
|
4708
|
-
r ? this.warnings.push(new Zi(o, n, i)) : this.errors.push(new
|
|
4708
|
+
r ? this.warnings.push(new Zi(o, n, i)) : this.errors.push(new Ne(o, n, i));
|
|
4709
4709
|
}, this.directives = new P({ version: e.version || "1.2" }), this.options = e;
|
|
4710
4710
|
}
|
|
4711
4711
|
decorate(e, t) {
|
|
@@ -4717,7 +4717,7 @@ class br {
|
|
|
4717
4717
|
${n}` : n;
|
|
4718
4718
|
else if (i || e.directives.docStart || !r)
|
|
4719
4719
|
e.commentBefore = n;
|
|
4720
|
-
else if (
|
|
4720
|
+
else if (L(r) && !r.flow && r.items.length > 0) {
|
|
4721
4721
|
let o = r.items[0];
|
|
4722
4722
|
E(o) && (o = o.key);
|
|
4723
4723
|
const a = o.commentBefore;
|
|
@@ -4777,14 +4777,14 @@ ${o}` : n;
|
|
|
4777
4777
|
this.prelude.push(e.source);
|
|
4778
4778
|
break;
|
|
4779
4779
|
case "error": {
|
|
4780
|
-
const t = e.source ? `${e.message}: ${JSON.stringify(e.source)}` : e.message, n = new
|
|
4780
|
+
const t = e.source ? `${e.message}: ${JSON.stringify(e.source)}` : e.message, n = new Ne(Se(e), "UNEXPECTED_TOKEN", t);
|
|
4781
4781
|
this.atDirectives || !this.doc ? this.errors.push(n) : this.doc.errors.push(n);
|
|
4782
4782
|
break;
|
|
4783
4783
|
}
|
|
4784
4784
|
case "doc-end": {
|
|
4785
4785
|
if (!this.doc) {
|
|
4786
4786
|
const n = "Unexpected doc-end without preceding document";
|
|
4787
|
-
this.errors.push(new
|
|
4787
|
+
this.errors.push(new Ne(Se(e), "UNEXPECTED_TOKEN", n));
|
|
4788
4788
|
break;
|
|
4789
4789
|
}
|
|
4790
4790
|
this.doc.directives.docEnd = !0;
|
|
@@ -4798,7 +4798,7 @@ ${t.comment}` : t.comment;
|
|
|
4798
4798
|
break;
|
|
4799
4799
|
}
|
|
4800
4800
|
default:
|
|
4801
|
-
this.errors.push(new
|
|
4801
|
+
this.errors.push(new Ne(Se(e), "UNEXPECTED_TOKEN", `Unsupported token ${e.type}`));
|
|
4802
4802
|
}
|
|
4803
4803
|
}
|
|
4804
4804
|
/**
|
|
@@ -4816,7 +4816,7 @@ ${t.comment}` : t.comment;
|
|
|
4816
4816
|
}
|
|
4817
4817
|
}
|
|
4818
4818
|
}
|
|
4819
|
-
const tn = "\uFEFF", sn = "", nn = "",
|
|
4819
|
+
const tn = "\uFEFF", sn = "", nn = "", It = "";
|
|
4820
4820
|
function Sr(s) {
|
|
4821
4821
|
switch (s) {
|
|
4822
4822
|
case tn:
|
|
@@ -4825,7 +4825,7 @@ function Sr(s) {
|
|
|
4825
4825
|
return "doc-mode";
|
|
4826
4826
|
case nn:
|
|
4827
4827
|
return "flow-error-end";
|
|
4828
|
-
case
|
|
4828
|
+
case It:
|
|
4829
4829
|
return "scalar";
|
|
4830
4830
|
case "---":
|
|
4831
4831
|
return "doc-start";
|
|
@@ -4891,9 +4891,9 @@ function q(s) {
|
|
|
4891
4891
|
return !1;
|
|
4892
4892
|
}
|
|
4893
4893
|
}
|
|
4894
|
-
const ss = new Set("0123456789ABCDEFabcdef"), vr = new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"), qe = new Set(",[]{}"),
|
|
4895
|
-
\r `), mt = (s) => !s ||
|
|
4896
|
-
class
|
|
4894
|
+
const ss = new Set("0123456789ABCDEFabcdef"), vr = new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"), qe = new Set(",[]{}"), Nr = new Set(` ,[]{}
|
|
4895
|
+
\r `), mt = (s) => !s || Nr.has(s);
|
|
4896
|
+
class Ir {
|
|
4897
4897
|
constructor() {
|
|
4898
4898
|
this.atEnd = !1, this.blockScalarIndent = -1, this.blockScalarKeep = !1, this.buffer = "", this.flowKey = !1, this.flowLevel = 0, this.indentNext = 0, this.indentValue = 0, this.lineEndPos = null, this.next = null, this.pos = 0;
|
|
4899
4899
|
}
|
|
@@ -5213,7 +5213,7 @@ class Tr {
|
|
|
5213
5213
|
else
|
|
5214
5214
|
break;
|
|
5215
5215
|
} while (!0);
|
|
5216
|
-
return yield
|
|
5216
|
+
return yield It, yield* this.pushToIndex(e + 1, !0), yield* this.parseLineStart();
|
|
5217
5217
|
}
|
|
5218
5218
|
*parsePlainScalar() {
|
|
5219
5219
|
const e = this.flowLevel > 0;
|
|
@@ -5242,7 +5242,7 @@ class Tr {
|
|
|
5242
5242
|
break;
|
|
5243
5243
|
t = n;
|
|
5244
5244
|
}
|
|
5245
|
-
return !i && !this.atEnd ? this.setNext("plain-scalar") : (yield
|
|
5245
|
+
return !i && !this.atEnd ? this.setNext("plain-scalar") : (yield It, yield* this.pushToIndex(t + 1, !0), e ? "flow" : "doc");
|
|
5246
5246
|
}
|
|
5247
5247
|
*pushCount(e) {
|
|
5248
5248
|
return e > 0 ? (yield this.buffer.substr(this.pos, e), this.pos += e, e) : 0;
|
|
@@ -5308,7 +5308,7 @@ class Tr {
|
|
|
5308
5308
|
return yield* this.pushToIndex(t, !1);
|
|
5309
5309
|
}
|
|
5310
5310
|
}
|
|
5311
|
-
class
|
|
5311
|
+
class Tr {
|
|
5312
5312
|
constructor() {
|
|
5313
5313
|
this.lineStarts = [], this.addNewLine = (e) => this.lineStarts.push(e), this.linePos = (e) => {
|
|
5314
5314
|
let t = 0, n = this.lineStarts.length;
|
|
@@ -5398,7 +5398,7 @@ class Or {
|
|
|
5398
5398
|
* each new line (in `parse()`, including the start of input).
|
|
5399
5399
|
*/
|
|
5400
5400
|
constructor(e) {
|
|
5401
|
-
this.atNewLine = !0, this.atScalar = !1, this.indent = 0, this.offset = 0, this.onKeyLine = !1, this.stack = [], this.source = "", this.type = "", this.lexer = new
|
|
5401
|
+
this.atNewLine = !0, this.atScalar = !1, this.indent = 0, this.offset = 0, this.onKeyLine = !1, this.stack = [], this.source = "", this.type = "", this.lexer = new Ir(), this.onNewLine = e;
|
|
5402
5402
|
}
|
|
5403
5403
|
/**
|
|
5404
5404
|
* Parse `source` as a YAML stream.
|
|
@@ -5973,7 +5973,7 @@ class Or {
|
|
|
5973
5973
|
}
|
|
5974
5974
|
function _r(s) {
|
|
5975
5975
|
const e = s.prettyErrors !== !1;
|
|
5976
|
-
return { lineCounter: s.lineCounter || e && new
|
|
5976
|
+
return { lineCounter: s.lineCounter || e && new Tr() || null, prettyErrors: e };
|
|
5977
5977
|
}
|
|
5978
5978
|
function Cr(s, e = {}) {
|
|
5979
5979
|
const { lineCounter: t, prettyErrors: n } = _r(e), i = new Or(t?.addNewLine), r = new br(e);
|
|
@@ -5982,12 +5982,12 @@ function Cr(s, e = {}) {
|
|
|
5982
5982
|
if (!o)
|
|
5983
5983
|
o = a;
|
|
5984
5984
|
else if (o.options.logLevel !== "silent") {
|
|
5985
|
-
o.errors.push(new
|
|
5985
|
+
o.errors.push(new Ne(a.range.slice(0, 2), "MULTIPLE_DOCS", "Source contains multiple documents; please use YAML.parseAllDocuments()"));
|
|
5986
5986
|
break;
|
|
5987
5987
|
}
|
|
5988
5988
|
return n && t && (o.errors.forEach(Zt(s, t)), o.warnings.forEach(Zt(s, t))), o;
|
|
5989
5989
|
}
|
|
5990
|
-
function
|
|
5990
|
+
function Lr(s, e, t) {
|
|
5991
5991
|
let n;
|
|
5992
5992
|
const i = Cr(s, t);
|
|
5993
5993
|
if (!i)
|
|
@@ -6012,11 +6012,11 @@ function on(s, e, t) {
|
|
|
6012
6012
|
}
|
|
6013
6013
|
return $e(s) && !n ? s.toString(t) : new Ue(s, n, t).toString(t);
|
|
6014
6014
|
}
|
|
6015
|
-
const
|
|
6015
|
+
const Ar = /^---\n([\s\S]*?)\n---\n([\s\S]*)$/;
|
|
6016
6016
|
function an(s) {
|
|
6017
|
-
const e =
|
|
6017
|
+
const e = Ar.exec(s);
|
|
6018
6018
|
return e ? {
|
|
6019
|
-
data:
|
|
6019
|
+
data: Lr(e[1] ?? "") ?? {},
|
|
6020
6020
|
content: e[2] ?? ""
|
|
6021
6021
|
} : { data: {}, content: s };
|
|
6022
6022
|
}
|
|
@@ -6192,7 +6192,7 @@ const Br = {
|
|
|
6192
6192
|
console.log(
|
|
6193
6193
|
JSON.stringify({
|
|
6194
6194
|
success: !0,
|
|
6195
|
-
version: "0.1.
|
|
6195
|
+
version: "0.1.2",
|
|
6196
6196
|
tools: t,
|
|
6197
6197
|
loggedIn: n !== void 0,
|
|
6198
6198
|
auth: i
|
|
@@ -6550,26 +6550,14 @@ class no {
|
|
|
6550
6550
|
return await i.json();
|
|
6551
6551
|
}
|
|
6552
6552
|
}
|
|
6553
|
-
|
|
6554
|
-
|
|
6555
|
-
throw new Error(
|
|
6556
|
-
"Rule generation is not yet available. The API is under development."
|
|
6557
|
-
);
|
|
6558
|
-
}
|
|
6559
|
-
pollRuleStatus() {
|
|
6560
|
-
throw new Error(
|
|
6561
|
-
"Rule generation is not yet available. The API is under development."
|
|
6562
|
-
);
|
|
6563
|
-
}
|
|
6564
|
-
}
|
|
6565
|
-
const os = process.env.TASKLESS_API_URL ? new no() : new io();
|
|
6566
|
-
async function ro(s, e) {
|
|
6553
|
+
const os = new no();
|
|
6554
|
+
async function io(s, e) {
|
|
6567
6555
|
const t = C(s, ".taskless", "rules");
|
|
6568
6556
|
await _e(t, { recursive: !0 });
|
|
6569
6557
|
const n = C(t, `${e.id}.yml`);
|
|
6570
6558
|
return await Ce(n, on(e.content, { lineWidth: 0 }), "utf8"), n;
|
|
6571
6559
|
}
|
|
6572
|
-
async function
|
|
6560
|
+
async function ro(s, e, t) {
|
|
6573
6561
|
const n = C(s, ".taskless", "rule-tests");
|
|
6574
6562
|
await _e(n, { recursive: !0 });
|
|
6575
6563
|
const i = C(n, `${e.id}-${t}-test.yml`), r = {
|
|
@@ -6579,7 +6567,7 @@ async function oo(s, e, t) {
|
|
|
6579
6567
|
};
|
|
6580
6568
|
return await Ce(i, on(r, { lineWidth: 0 }), "utf8"), i;
|
|
6581
6569
|
}
|
|
6582
|
-
async function
|
|
6570
|
+
async function oo(s, e) {
|
|
6583
6571
|
const t = C(s, ".taskless", "rules"), n = C(t, `${e}.yml`);
|
|
6584
6572
|
let i = !1;
|
|
6585
6573
|
try {
|
|
@@ -6600,11 +6588,11 @@ async function ao(s, e) {
|
|
|
6600
6588
|
}
|
|
6601
6589
|
return i;
|
|
6602
6590
|
}
|
|
6603
|
-
function
|
|
6591
|
+
function ao() {
|
|
6604
6592
|
const s = /* @__PURE__ */ new Date(), e = String(s.getFullYear()), t = String(s.getMonth() + 1).padStart(2, "0"), n = String(s.getDate()).padStart(2, "0");
|
|
6605
6593
|
return `${e}${t}${n}`;
|
|
6606
6594
|
}
|
|
6607
|
-
const
|
|
6595
|
+
const lo = 15e3, co = {
|
|
6608
6596
|
meta: {
|
|
6609
6597
|
name: "create",
|
|
6610
6598
|
description: "Create a new rule from a JSON file (use --from to specify the input file)"
|
|
@@ -6678,7 +6666,7 @@ const co = 15e3, uo = {
|
|
|
6678
6666
|
), process.exit(1);
|
|
6679
6667
|
}
|
|
6680
6668
|
for (console.error(`Rule submitted (${l}). Waiting for generation...`); ; ) {
|
|
6681
|
-
await new Promise((d) => setTimeout(d,
|
|
6669
|
+
await new Promise((d) => setTimeout(d, lo));
|
|
6682
6670
|
let c;
|
|
6683
6671
|
try {
|
|
6684
6672
|
c = await os.pollRuleStatus(a, l);
|
|
@@ -6701,11 +6689,11 @@ const co = 15e3, uo = {
|
|
|
6701
6689
|
break;
|
|
6702
6690
|
}
|
|
6703
6691
|
case "generated": {
|
|
6704
|
-
const d =
|
|
6692
|
+
const d = ao(), u = [];
|
|
6705
6693
|
for (const f of c.rules) {
|
|
6706
|
-
const p = await
|
|
6694
|
+
const p = await io(e, f);
|
|
6707
6695
|
if (u.push(p), f.tests) {
|
|
6708
|
-
const g = await
|
|
6696
|
+
const g = await ro(e, f, d);
|
|
6709
6697
|
u.push(g);
|
|
6710
6698
|
}
|
|
6711
6699
|
}
|
|
@@ -6735,7 +6723,7 @@ const co = 15e3, uo = {
|
|
|
6735
6723
|
}
|
|
6736
6724
|
}
|
|
6737
6725
|
}
|
|
6738
|
-
},
|
|
6726
|
+
}, uo = {
|
|
6739
6727
|
meta: {
|
|
6740
6728
|
name: "delete",
|
|
6741
6729
|
description: "Delete a rule and its test files"
|
|
@@ -6754,21 +6742,21 @@ const co = 15e3, uo = {
|
|
|
6754
6742
|
},
|
|
6755
6743
|
async run({ args: s }) {
|
|
6756
6744
|
const e = Z(s.dir ?? process.cwd()), t = s.id;
|
|
6757
|
-
await
|
|
6745
|
+
await oo(e, t) ? console.log(`Deleted rule "${t}" and associated test files.`) : (console.error(
|
|
6758
6746
|
`Error: Rule "${t}" not found in .taskless/rules/${t}.yml`
|
|
6759
6747
|
), process.exit(1));
|
|
6760
6748
|
}
|
|
6761
|
-
},
|
|
6749
|
+
}, fo = {
|
|
6762
6750
|
meta: {
|
|
6763
6751
|
name: "rules",
|
|
6764
6752
|
description: "Manage Taskless rules"
|
|
6765
6753
|
},
|
|
6766
6754
|
subCommands: {
|
|
6767
|
-
create:
|
|
6768
|
-
delete:
|
|
6755
|
+
create: co,
|
|
6756
|
+
delete: uo
|
|
6769
6757
|
}
|
|
6770
6758
|
};
|
|
6771
|
-
class
|
|
6759
|
+
class ho {
|
|
6772
6760
|
async submitUpdate(e, t) {
|
|
6773
6761
|
const n = ne(), i = await fetch(`${n}/api/update-engine`, {
|
|
6774
6762
|
method: "POST",
|
|
@@ -6816,19 +6804,7 @@ class po {
|
|
|
6816
6804
|
return await i.json();
|
|
6817
6805
|
}
|
|
6818
6806
|
}
|
|
6819
|
-
|
|
6820
|
-
submitUpdate() {
|
|
6821
|
-
throw new Error(
|
|
6822
|
-
"Update engine is not yet available. The API is under development."
|
|
6823
|
-
);
|
|
6824
|
-
}
|
|
6825
|
-
pollStatus() {
|
|
6826
|
-
throw new Error(
|
|
6827
|
-
"Update engine is not yet available. The API is under development."
|
|
6828
|
-
);
|
|
6829
|
-
}
|
|
6830
|
-
}
|
|
6831
|
-
const as = process.env.TASKLESS_API_URL ? new po() : new mo(), go = 5e3, yo = {
|
|
6807
|
+
const as = new ho(), po = 5e3, mo = {
|
|
6832
6808
|
meta: {
|
|
6833
6809
|
name: "update-engine",
|
|
6834
6810
|
description: "Request a scaffold upgrade PR to update the .taskless/ engine directory"
|
|
@@ -6898,7 +6874,7 @@ Review and merge it to complete the upgrade.`
|
|
|
6898
6874
|
}
|
|
6899
6875
|
const { requestId: r } = i;
|
|
6900
6876
|
for (console.error("Update request accepted. Waiting for PR creation..."); ; ) {
|
|
6901
|
-
await new Promise((a) => setTimeout(a,
|
|
6877
|
+
await new Promise((a) => setTimeout(a, po));
|
|
6902
6878
|
let o;
|
|
6903
6879
|
try {
|
|
6904
6880
|
o = await as.pollStatus(n, r);
|
|
@@ -6946,12 +6922,12 @@ Re-run \`taskless update-engine\` to create a new one.`
|
|
|
6946
6922
|
info: Br,
|
|
6947
6923
|
check: oi,
|
|
6948
6924
|
auth: ti,
|
|
6949
|
-
rules:
|
|
6950
|
-
"update-engine":
|
|
6951
|
-
},
|
|
6925
|
+
rules: fo,
|
|
6926
|
+
"update-engine": mo
|
|
6927
|
+
}, go = {
|
|
6952
6928
|
meta: {
|
|
6953
6929
|
name: "taskless",
|
|
6954
|
-
version: "0.1.
|
|
6930
|
+
version: "0.1.2",
|
|
6955
6931
|
description: "Taskless CLI"
|
|
6956
6932
|
},
|
|
6957
6933
|
args: {
|
|
@@ -6974,4 +6950,4 @@ Re-run \`taskless update-engine\` to create a new one.`
|
|
|
6974
6950
|
s.some((t) => !t.startsWith("-")) || await ws(e);
|
|
6975
6951
|
}
|
|
6976
6952
|
};
|
|
6977
|
-
Wn(
|
|
6953
|
+
Wn(go);
|