@cloud-cli/on 0.1.1 → 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/on.js +366 -354
- package/package.json +2 -1
- package/dist/package.json +0 -26
package/dist/on.js
CHANGED
|
@@ -4,7 +4,55 @@ import { parseArgs as gs } from "node:util";
|
|
|
4
4
|
import { spawn as ys } from "node:child_process";
|
|
5
5
|
import { readFile as et } from "node:fs/promises";
|
|
6
6
|
import bt from "node:path";
|
|
7
|
-
|
|
7
|
+
async function bs(s) {
|
|
8
|
+
const e = [];
|
|
9
|
+
for await (const t of s)
|
|
10
|
+
e.push(Buffer.isBuffer(t) ? t : Buffer.from(t));
|
|
11
|
+
return Buffer.concat(e).toString("utf8");
|
|
12
|
+
}
|
|
13
|
+
function Fe(s, e, t) {
|
|
14
|
+
s.writeHead(e, { "content-type": "application/json" }).end(JSON.stringify(t));
|
|
15
|
+
}
|
|
16
|
+
function ws(s) {
|
|
17
|
+
const e = Number.parseInt(s, 10);
|
|
18
|
+
if (!Number.isInteger(e) || e < 0 || e > 65535)
|
|
19
|
+
throw new Error(
|
|
20
|
+
`Invalid --port value '${s}'. Expected an integer from 0 to 65535.`
|
|
21
|
+
);
|
|
22
|
+
return e;
|
|
23
|
+
}
|
|
24
|
+
function tt(s) {
|
|
25
|
+
if (!s || typeof s != "object" || Array.isArray(s))
|
|
26
|
+
throw new Error("Incoming webhook payload must be a JSON object.");
|
|
27
|
+
return s;
|
|
28
|
+
}
|
|
29
|
+
function vt(s, e) {
|
|
30
|
+
const n = e.trim().replace(/^\$\{/, "").replace(/}$/, "").split(".").filter(Boolean);
|
|
31
|
+
let i = s;
|
|
32
|
+
for (const r of n) {
|
|
33
|
+
if (typeof i != "object" || i === null || !(r in i))
|
|
34
|
+
return;
|
|
35
|
+
i = i[r];
|
|
36
|
+
}
|
|
37
|
+
return i;
|
|
38
|
+
}
|
|
39
|
+
function ks(s, e) {
|
|
40
|
+
return s.replace(/\$\{([^}]+)}/g, (t, n) => {
|
|
41
|
+
const i = vt(e, n);
|
|
42
|
+
return i == null ? "" : String(i);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function Ss(s, e) {
|
|
46
|
+
if (!e)
|
|
47
|
+
return { ...s };
|
|
48
|
+
const t = { ...s };
|
|
49
|
+
for (const [n, i] of Object.entries(e)) {
|
|
50
|
+
const r = i.startsWith("${") ? i : `\${${i}}`;
|
|
51
|
+
t[n] = vt({ inputs: t }, r);
|
|
52
|
+
}
|
|
53
|
+
return t;
|
|
54
|
+
}
|
|
55
|
+
const st = /* @__PURE__ */ Symbol.for("yaml.alias"), We = /* @__PURE__ */ Symbol.for("yaml.document"), J = /* @__PURE__ */ Symbol.for("yaml.map"), Ct = /* @__PURE__ */ Symbol.for("yaml.pair"), q = /* @__PURE__ */ Symbol.for("yaml.scalar"), oe = /* @__PURE__ */ Symbol.for("yaml.seq"), j = /* @__PURE__ */ Symbol.for("yaml.node.type"), Q = (s) => !!s && typeof s == "object" && s[j] === st, Ce = (s) => !!s && typeof s == "object" && s[j] === We, ye = (s) => !!s && typeof s == "object" && s[j] === J, $ = (s) => !!s && typeof s == "object" && s[j] === Ct, E = (s) => !!s && typeof s == "object" && s[j] === q, be = (s) => !!s && typeof s == "object" && s[j] === oe;
|
|
8
56
|
function I(s) {
|
|
9
57
|
if (s && typeof s == "object")
|
|
10
58
|
switch (s[j]) {
|
|
@@ -17,7 +65,7 @@ function I(s) {
|
|
|
17
65
|
function L(s) {
|
|
18
66
|
if (s && typeof s == "object")
|
|
19
67
|
switch (s[j]) {
|
|
20
|
-
case
|
|
68
|
+
case st:
|
|
21
69
|
case J:
|
|
22
70
|
case q:
|
|
23
71
|
case oe:
|
|
@@ -25,18 +73,18 @@ function L(s) {
|
|
|
25
73
|
}
|
|
26
74
|
return !1;
|
|
27
75
|
}
|
|
28
|
-
const
|
|
76
|
+
const _t = (s) => (E(s) || I(s)) && !!s.anchor, Y = /* @__PURE__ */ Symbol("break visit"), Ns = /* @__PURE__ */ Symbol("skip children"), de = /* @__PURE__ */ Symbol("remove node");
|
|
29
77
|
function le(s, e) {
|
|
30
|
-
const t =
|
|
78
|
+
const t = Os(e);
|
|
31
79
|
Ce(s) ? Z(null, s.contents, t, Object.freeze([s])) === de && (s.contents = null) : Z(null, s, t, Object.freeze([]));
|
|
32
80
|
}
|
|
33
81
|
le.BREAK = Y;
|
|
34
|
-
le.SKIP =
|
|
82
|
+
le.SKIP = Ns;
|
|
35
83
|
le.REMOVE = de;
|
|
36
84
|
function Z(s, e, t, n) {
|
|
37
|
-
const i =
|
|
85
|
+
const i = As(s, e, t, n);
|
|
38
86
|
if (L(i) || $(i))
|
|
39
|
-
return
|
|
87
|
+
return Ts(s, n, i), Z(s, i, t, n);
|
|
40
88
|
if (typeof i != "symbol") {
|
|
41
89
|
if (I(e)) {
|
|
42
90
|
n = Object.freeze(n.concat(e));
|
|
@@ -64,7 +112,7 @@ function Z(s, e, t, n) {
|
|
|
64
112
|
}
|
|
65
113
|
return i;
|
|
66
114
|
}
|
|
67
|
-
function
|
|
115
|
+
function Os(s) {
|
|
68
116
|
return typeof s == "object" && (s.Collection || s.Node || s.Value) ? Object.assign({
|
|
69
117
|
Alias: s.Node,
|
|
70
118
|
Map: s.Node,
|
|
@@ -79,7 +127,7 @@ function ws(s) {
|
|
|
79
127
|
Seq: s.Collection
|
|
80
128
|
}, s) : s;
|
|
81
129
|
}
|
|
82
|
-
function
|
|
130
|
+
function As(s, e, t, n) {
|
|
83
131
|
if (typeof t == "function")
|
|
84
132
|
return t(s, e, n);
|
|
85
133
|
if (ye(e))
|
|
@@ -93,7 +141,7 @@ function ks(s, e, t, n) {
|
|
|
93
141
|
if (Q(e))
|
|
94
142
|
return t.Alias?.(s, e, n);
|
|
95
143
|
}
|
|
96
|
-
function
|
|
144
|
+
function Ts(s, e, t) {
|
|
97
145
|
const n = e[e.length - 1];
|
|
98
146
|
if (I(n))
|
|
99
147
|
n.items[s] = t;
|
|
@@ -106,14 +154,14 @@ function Ss(s, e, t) {
|
|
|
106
154
|
throw new Error(`Cannot replace node with ${i} parent`);
|
|
107
155
|
}
|
|
108
156
|
}
|
|
109
|
-
const
|
|
157
|
+
const Es = {
|
|
110
158
|
"!": "%21",
|
|
111
159
|
",": "%2C",
|
|
112
160
|
"[": "%5B",
|
|
113
161
|
"]": "%5D",
|
|
114
162
|
"{": "%7B",
|
|
115
163
|
"}": "%7D"
|
|
116
|
-
},
|
|
164
|
+
}, Is = (s) => s.replace(/[!,[\]{}]/g, (e) => Es[e]);
|
|
117
165
|
class _ {
|
|
118
166
|
constructor(e, t) {
|
|
119
167
|
this.docStart = null, this.docEnd = !1, this.yaml = Object.assign({}, _.defaultYaml, e), this.tags = Object.assign({}, _.defaultTags, t);
|
|
@@ -203,7 +251,7 @@ class _ {
|
|
|
203
251
|
tagString(e) {
|
|
204
252
|
for (const [t, n] of Object.entries(this.tags))
|
|
205
253
|
if (e.startsWith(n))
|
|
206
|
-
return t +
|
|
254
|
+
return t + Is(e.substring(n.length));
|
|
207
255
|
return e[0] === "!" ? e : `!<${e}>`;
|
|
208
256
|
}
|
|
209
257
|
toString(e) {
|
|
@@ -224,14 +272,14 @@ class _ {
|
|
|
224
272
|
}
|
|
225
273
|
_.defaultYaml = { explicit: !1, version: "1.2" };
|
|
226
274
|
_.defaultTags = { "!!": "tag:yaml.org,2002:" };
|
|
227
|
-
function
|
|
275
|
+
function Bt(s) {
|
|
228
276
|
if (/[\x00-\x19\s,[\]{}]/.test(s)) {
|
|
229
277
|
const t = `Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;
|
|
230
278
|
throw new Error(t);
|
|
231
279
|
}
|
|
232
280
|
return !0;
|
|
233
281
|
}
|
|
234
|
-
function
|
|
282
|
+
function Mt(s) {
|
|
235
283
|
const e = /* @__PURE__ */ new Set();
|
|
236
284
|
return le(s, {
|
|
237
285
|
Value(t, n) {
|
|
@@ -239,20 +287,20 @@ function Bt(s) {
|
|
|
239
287
|
}
|
|
240
288
|
}), e;
|
|
241
289
|
}
|
|
242
|
-
function
|
|
290
|
+
function Pt(s, e) {
|
|
243
291
|
for (let t = 1; ; ++t) {
|
|
244
292
|
const n = `${s}${t}`;
|
|
245
293
|
if (!e.has(n))
|
|
246
294
|
return n;
|
|
247
295
|
}
|
|
248
296
|
}
|
|
249
|
-
function
|
|
297
|
+
function Ls(s, e) {
|
|
250
298
|
const t = [], n = /* @__PURE__ */ new Map();
|
|
251
299
|
let i = null;
|
|
252
300
|
return {
|
|
253
301
|
onAnchor: (r) => {
|
|
254
|
-
t.push(r), i ?? (i =
|
|
255
|
-
const o =
|
|
302
|
+
t.push(r), i ?? (i = Mt(s));
|
|
303
|
+
const o = Pt(e, i);
|
|
256
304
|
return i.add(o), o;
|
|
257
305
|
},
|
|
258
306
|
/**
|
|
@@ -302,7 +350,7 @@ function P(s, e, t) {
|
|
|
302
350
|
if (Array.isArray(s))
|
|
303
351
|
return s.map((n, i) => P(n, String(i), t));
|
|
304
352
|
if (s && typeof s.toJSON == "function") {
|
|
305
|
-
if (!t || !
|
|
353
|
+
if (!t || !_t(s))
|
|
306
354
|
return s.toJSON(e, t);
|
|
307
355
|
const n = { aliasCount: 0, count: 1, res: void 0 };
|
|
308
356
|
t.anchors.set(s, n), t.onCreate = (r) => {
|
|
@@ -313,7 +361,7 @@ function P(s, e, t) {
|
|
|
313
361
|
}
|
|
314
362
|
return typeof s == "bigint" && !t?.keep ? Number(s) : s;
|
|
315
363
|
}
|
|
316
|
-
class
|
|
364
|
+
class nt {
|
|
317
365
|
constructor(e) {
|
|
318
366
|
Object.defineProperty(this, j, { value: e });
|
|
319
367
|
}
|
|
@@ -340,9 +388,9 @@ class st {
|
|
|
340
388
|
return typeof r == "function" ? ee(r, { "": l }, "", l) : l;
|
|
341
389
|
}
|
|
342
390
|
}
|
|
343
|
-
class
|
|
391
|
+
class it extends nt {
|
|
344
392
|
constructor(e) {
|
|
345
|
-
super(
|
|
393
|
+
super(st), this.source = e, Object.defineProperty(this, "tag", {
|
|
346
394
|
set() {
|
|
347
395
|
throw new Error("Alias nodes cannot have tags");
|
|
348
396
|
}
|
|
@@ -356,7 +404,7 @@ class nt extends st {
|
|
|
356
404
|
let n;
|
|
357
405
|
t?.aliasResolveCache ? n = t.aliasResolveCache : (n = [], le(e, {
|
|
358
406
|
Node: (r, o) => {
|
|
359
|
-
(Q(o) ||
|
|
407
|
+
(Q(o) || _t(o)) && n.push(o);
|
|
360
408
|
}
|
|
361
409
|
}), t && (t.aliasResolveCache = n));
|
|
362
410
|
let i;
|
|
@@ -389,7 +437,7 @@ class nt extends st {
|
|
|
389
437
|
toString(e, t, n) {
|
|
390
438
|
const i = `*${this.source}`;
|
|
391
439
|
if (e) {
|
|
392
|
-
if (
|
|
440
|
+
if (Bt(this.source), e.options.verifyAliasOrder && !e.anchors.has(this.source)) {
|
|
393
441
|
const r = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
|
|
394
442
|
throw new Error(r);
|
|
395
443
|
}
|
|
@@ -416,8 +464,8 @@ function Ee(s, e, t) {
|
|
|
416
464
|
}
|
|
417
465
|
return 1;
|
|
418
466
|
}
|
|
419
|
-
const
|
|
420
|
-
class O extends
|
|
467
|
+
const jt = (s) => !s || typeof s != "function" && typeof s != "object";
|
|
468
|
+
class O extends nt {
|
|
421
469
|
constructor(e) {
|
|
422
470
|
super(q), this.value = e;
|
|
423
471
|
}
|
|
@@ -433,8 +481,8 @@ O.BLOCK_LITERAL = "BLOCK_LITERAL";
|
|
|
433
481
|
O.PLAIN = "PLAIN";
|
|
434
482
|
O.QUOTE_DOUBLE = "QUOTE_DOUBLE";
|
|
435
483
|
O.QUOTE_SINGLE = "QUOTE_SINGLE";
|
|
436
|
-
const
|
|
437
|
-
function
|
|
484
|
+
const $s = "tag:yaml.org,2002:";
|
|
485
|
+
function vs(s, e, t) {
|
|
438
486
|
if (e) {
|
|
439
487
|
const n = t.filter((r) => r.tag === e), i = n.find((r) => !r.format) ?? n[0];
|
|
440
488
|
if (!i)
|
|
@@ -455,11 +503,11 @@ function me(s, e, t) {
|
|
|
455
503
|
let a;
|
|
456
504
|
if (n && s && typeof s == "object") {
|
|
457
505
|
if (a = l.get(s), a)
|
|
458
|
-
return a.anchor ?? (a.anchor = i(s)), new
|
|
506
|
+
return a.anchor ?? (a.anchor = i(s)), new it(a.anchor);
|
|
459
507
|
a = { anchor: null, node: null }, l.set(s, a);
|
|
460
508
|
}
|
|
461
|
-
e?.startsWith("!!") && (e =
|
|
462
|
-
let c =
|
|
509
|
+
e?.startsWith("!!") && (e = $s + e.slice(2));
|
|
510
|
+
let c = vs(s, e, o.tags);
|
|
463
511
|
if (!c) {
|
|
464
512
|
if (s && typeof s.toJSON == "function" && (s = s.toJSON()), !s || typeof s != "object") {
|
|
465
513
|
const f = new O(s);
|
|
@@ -492,7 +540,7 @@ function $e(s, e, t) {
|
|
|
492
540
|
});
|
|
493
541
|
}
|
|
494
542
|
const ue = (s) => s == null || typeof s == "object" && !!s[Symbol.iterator]().next().done;
|
|
495
|
-
class
|
|
543
|
+
class Kt extends nt {
|
|
496
544
|
constructor(e, t) {
|
|
497
545
|
super(e), Object.defineProperty(this, "schema", {
|
|
498
546
|
value: t,
|
|
@@ -587,14 +635,14 @@ class jt extends st {
|
|
|
587
635
|
}
|
|
588
636
|
}
|
|
589
637
|
}
|
|
590
|
-
const
|
|
638
|
+
const Cs = (s) => s.replace(/^(?!$)(?: $)?/gm, "#");
|
|
591
639
|
function U(s, e) {
|
|
592
640
|
return /^\n+$/.test(s) ? s.substring(1) : e ? s.replace(/^(?! *$)/gm, e) : s;
|
|
593
641
|
}
|
|
594
642
|
const G = (s, e, t) => s.endsWith(`
|
|
595
643
|
`) ? U(t, e) : t.includes(`
|
|
596
644
|
`) ? `
|
|
597
|
-
` + U(t, e) : (s.endsWith(" ") ? "" : " ") + t,
|
|
645
|
+
` + U(t, e) : (s.endsWith(" ") ? "" : " ") + t, Dt = "flow", Qe = "block", Ie = "quoted";
|
|
598
646
|
function _e(s, e, t = "flow", { indentAtStart: n, lineWidth: i = 80, minContentWidth: r = 20, onFold: o, onOverflow: l } = {}) {
|
|
599
647
|
if (!i || i < 0)
|
|
600
648
|
return s;
|
|
@@ -680,7 +728,7 @@ const Be = (s, e) => ({
|
|
|
680
728
|
lineWidth: s.options.lineWidth,
|
|
681
729
|
minContentWidth: s.options.minContentWidth
|
|
682
730
|
}), Me = (s) => /^(%|---|\.\.\.)/m.test(s);
|
|
683
|
-
function
|
|
731
|
+
function _s(s, e, t) {
|
|
684
732
|
if (!e || e < 0)
|
|
685
733
|
return !1;
|
|
686
734
|
const n = e - t, i = s.length;
|
|
@@ -763,7 +811,7 @@ function Xe(s, e) {
|
|
|
763
811
|
return pe(s, e);
|
|
764
812
|
const t = e.indent || (Me(s) ? " " : ""), n = "'" + s.replace(/'/g, "''").replace(/\n+/g, `$&
|
|
765
813
|
${t}`) + "'";
|
|
766
|
-
return e.implicitKey ? n : _e(n, t,
|
|
814
|
+
return e.implicitKey ? n : _e(n, t, Dt, Be(e, !1));
|
|
767
815
|
}
|
|
768
816
|
function te(s, e) {
|
|
769
817
|
const { singleQuote: t } = e.options;
|
|
@@ -789,7 +837,7 @@ function Le({ comment: s, type: e, value: t }, n, i, r) {
|
|
|
789
837
|
const { blockQuote: o, commentString: l, lineWidth: a } = n.options;
|
|
790
838
|
if (!o || /\n[\t ]+$/.test(t))
|
|
791
839
|
return te(t, n);
|
|
792
|
-
const c = n.indent || (n.forceBlockIndent || Me(t) ? " " : ""), d = o === "literal" ? !0 : o === "folded" || e === O.BLOCK_FOLDED ? !1 : e === O.BLOCK_LITERAL ? !0 : !
|
|
840
|
+
const c = n.indent || (n.forceBlockIndent || Me(t) ? " " : ""), d = o === "literal" ? !0 : o === "folded" || e === O.BLOCK_FOLDED ? !1 : e === O.BLOCK_LITERAL ? !0 : !_s(t, a, c.length);
|
|
793
841
|
if (!t)
|
|
794
842
|
return d ? `|
|
|
795
843
|
` : `>
|
|
@@ -836,7 +884,7 @@ ${c}${y}`;
|
|
|
836
884
|
return t = t.replace(/\n+/g, `$&${c}`), `|${S}
|
|
837
885
|
${c}${w}${t}${m}`;
|
|
838
886
|
}
|
|
839
|
-
function
|
|
887
|
+
function Bs(s, e, t, n) {
|
|
840
888
|
const { type: i, value: r } = s, { actualString: o, implicitKey: l, indent: a, indentStep: c, inFlow: d } = e;
|
|
841
889
|
if (l && r.includes(`
|
|
842
890
|
`) || d && /[[\]{},]/.test(r))
|
|
@@ -860,9 +908,9 @@ ${a}`);
|
|
|
860
908
|
if (g.some(u) || m?.some(u))
|
|
861
909
|
return te(r, e);
|
|
862
910
|
}
|
|
863
|
-
return l ? f : _e(f, a,
|
|
911
|
+
return l ? f : _e(f, a, Dt, Be(e, !1));
|
|
864
912
|
}
|
|
865
|
-
function
|
|
913
|
+
function rt(s, e, t, n) {
|
|
866
914
|
const { implicitKey: i, inFlow: r } = e, o = typeof s.value == "string" ? s : Object.assign({}, s, { value: String(s.value) });
|
|
867
915
|
let { type: l } = s;
|
|
868
916
|
l !== O.QUOTE_DOUBLE && /[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value) && (l = O.QUOTE_DOUBLE);
|
|
@@ -876,7 +924,7 @@ function it(s, e, t, n) {
|
|
|
876
924
|
case O.QUOTE_SINGLE:
|
|
877
925
|
return Xe(o.value, e);
|
|
878
926
|
case O.PLAIN:
|
|
879
|
-
return
|
|
927
|
+
return Bs(o, e, t, n);
|
|
880
928
|
default:
|
|
881
929
|
return null;
|
|
882
930
|
}
|
|
@@ -889,10 +937,10 @@ function it(s, e, t, n) {
|
|
|
889
937
|
}
|
|
890
938
|
return c;
|
|
891
939
|
}
|
|
892
|
-
function
|
|
940
|
+
function qt(s, e) {
|
|
893
941
|
const t = Object.assign({
|
|
894
942
|
blockQuote: !0,
|
|
895
|
-
commentString:
|
|
943
|
+
commentString: Cs,
|
|
896
944
|
defaultKeyType: null,
|
|
897
945
|
defaultStringType: "PLAIN",
|
|
898
946
|
directives: null,
|
|
@@ -930,7 +978,7 @@ function Dt(s, e) {
|
|
|
930
978
|
options: t
|
|
931
979
|
};
|
|
932
980
|
}
|
|
933
|
-
function
|
|
981
|
+
function Ms(s, e) {
|
|
934
982
|
if (e.tag) {
|
|
935
983
|
const i = s.filter((r) => r.tag === e.tag);
|
|
936
984
|
if (i.length > 0)
|
|
@@ -953,11 +1001,11 @@ function vs(s, e) {
|
|
|
953
1001
|
}
|
|
954
1002
|
return t;
|
|
955
1003
|
}
|
|
956
|
-
function
|
|
1004
|
+
function Ps(s, e, { anchors: t, doc: n }) {
|
|
957
1005
|
if (!n.directives)
|
|
958
1006
|
return "";
|
|
959
1007
|
const i = [], r = (E(s) || I(s)) && s.anchor;
|
|
960
|
-
r &&
|
|
1008
|
+
r && Bt(r) && (t.add(r), i.push(`&${r}`));
|
|
961
1009
|
const o = s.tag ?? (e.default ? null : e.tag);
|
|
962
1010
|
return o && i.push(n.directives.tagString(o)), i.join(" ");
|
|
963
1011
|
}
|
|
@@ -973,14 +1021,14 @@ function ie(s, e, t, n) {
|
|
|
973
1021
|
}
|
|
974
1022
|
let i;
|
|
975
1023
|
const r = L(s) ? s : e.doc.createNode(s, { onTagObj: (a) => i = a });
|
|
976
|
-
i ?? (i =
|
|
977
|
-
const o =
|
|
1024
|
+
i ?? (i = Ms(e.doc.schema.tags, r));
|
|
1025
|
+
const o = Ps(r, i, e);
|
|
978
1026
|
o.length > 0 && (e.indentAtStart = (e.indentAtStart ?? 0) + o.length + 1);
|
|
979
|
-
const l = typeof i.stringify == "function" ? i.stringify(r, e, t, n) : E(r) ?
|
|
1027
|
+
const l = typeof i.stringify == "function" ? i.stringify(r, e, t, n) : E(r) ? rt(r, e, t, n) : r.toString(e, t, n);
|
|
980
1028
|
return o ? E(r) || l[0] === "{" || l[0] === "[" ? `${o} ${l}` : `${o}
|
|
981
1029
|
${e.indent}${l}` : l;
|
|
982
1030
|
}
|
|
983
|
-
function
|
|
1031
|
+
function js({ key: s, value: e }, t, n, i) {
|
|
984
1032
|
const { allNullValues: r, doc: o, indent: l, indentStep: a, options: { commentString: c, indentSeq: d, simpleKeys: f } } = t;
|
|
985
1033
|
let u = L(s) && s.comment || null;
|
|
986
1034
|
if (f) {
|
|
@@ -1043,7 +1091,7 @@ ${t.indent}`);
|
|
|
1043
1091
|
`) && (A = "");
|
|
1044
1092
|
return p += A + N, t.inFlow ? S && n && n() : k && !S ? p += G(p, t.indent, c(k)) : h && i && i(), p;
|
|
1045
1093
|
}
|
|
1046
|
-
function
|
|
1094
|
+
function Ut(s, e) {
|
|
1047
1095
|
(s === "debug" || s === "warn") && console.warn(e);
|
|
1048
1096
|
}
|
|
1049
1097
|
const Se = "<<", F = {
|
|
@@ -1052,21 +1100,21 @@ const Se = "<<", F = {
|
|
|
1052
1100
|
tag: "tag:yaml.org,2002:merge",
|
|
1053
1101
|
test: /^<<$/,
|
|
1054
1102
|
resolve: () => Object.assign(new O(Symbol(Se)), {
|
|
1055
|
-
addToJSMap:
|
|
1103
|
+
addToJSMap: Ft
|
|
1056
1104
|
}),
|
|
1057
1105
|
stringify: () => Se
|
|
1058
|
-
},
|
|
1059
|
-
function
|
|
1106
|
+
}, Ks = (s, e) => (F.identify(e) || E(e) && (!e.type || e.type === O.PLAIN) && F.identify(e.value)) && s?.doc.schema.tags.some((t) => t.tag === F.tag && t.default);
|
|
1107
|
+
function Ft(s, e, t) {
|
|
1060
1108
|
if (t = s && Q(t) ? t.resolve(s.doc) : t, be(t))
|
|
1061
1109
|
for (const n of t.items)
|
|
1062
|
-
|
|
1110
|
+
Re(s, e, n);
|
|
1063
1111
|
else if (Array.isArray(t))
|
|
1064
1112
|
for (const n of t)
|
|
1065
|
-
|
|
1113
|
+
Re(s, e, n);
|
|
1066
1114
|
else
|
|
1067
|
-
|
|
1115
|
+
Re(s, e, t);
|
|
1068
1116
|
}
|
|
1069
|
-
function
|
|
1117
|
+
function Re(s, e, t) {
|
|
1070
1118
|
const n = s && Q(t) ? t.resolve(s.doc) : t;
|
|
1071
1119
|
if (!ye(n))
|
|
1072
1120
|
throw new Error("Merge sources must be maps or map aliases");
|
|
@@ -1080,11 +1128,11 @@ function Fe(s, e, t) {
|
|
|
1080
1128
|
});
|
|
1081
1129
|
return e;
|
|
1082
1130
|
}
|
|
1083
|
-
function
|
|
1131
|
+
function Rt(s, e, { key: t, value: n }) {
|
|
1084
1132
|
if (L(t) && t.addToJSMap)
|
|
1085
1133
|
t.addToJSMap(s, e, n);
|
|
1086
|
-
else if (
|
|
1087
|
-
|
|
1134
|
+
else if (Ks(s, t))
|
|
1135
|
+
Ft(s, e, n);
|
|
1088
1136
|
else {
|
|
1089
1137
|
const i = P(t, "", s);
|
|
1090
1138
|
if (e instanceof Map)
|
|
@@ -1092,7 +1140,7 @@ function Ft(s, e, { key: t, value: n }) {
|
|
|
1092
1140
|
else if (e instanceof Set)
|
|
1093
1141
|
e.add(i);
|
|
1094
1142
|
else {
|
|
1095
|
-
const r =
|
|
1143
|
+
const r = Ds(t, i, s), o = P(n, r, s);
|
|
1096
1144
|
r in e ? Object.defineProperty(e, r, {
|
|
1097
1145
|
value: o,
|
|
1098
1146
|
writable: !0,
|
|
@@ -1103,13 +1151,13 @@ function Ft(s, e, { key: t, value: n }) {
|
|
|
1103
1151
|
}
|
|
1104
1152
|
return e;
|
|
1105
1153
|
}
|
|
1106
|
-
function
|
|
1154
|
+
function Ds(s, e, t) {
|
|
1107
1155
|
if (e === null)
|
|
1108
1156
|
return "";
|
|
1109
1157
|
if (typeof e != "object")
|
|
1110
1158
|
return String(e);
|
|
1111
1159
|
if (L(s) && t?.doc) {
|
|
1112
|
-
const n =
|
|
1160
|
+
const n = qt(t.doc, {});
|
|
1113
1161
|
n.anchors = /* @__PURE__ */ new Set();
|
|
1114
1162
|
for (const r of t.anchors.keys())
|
|
1115
1163
|
n.anchors.add(r.anchor);
|
|
@@ -1117,19 +1165,19 @@ function Ms(s, e, t) {
|
|
|
1117
1165
|
const i = s.toString(n);
|
|
1118
1166
|
if (!t.mapKeyWarned) {
|
|
1119
1167
|
let r = JSON.stringify(i);
|
|
1120
|
-
r.length > 40 && (r = r.substring(0, 36) + '..."'),
|
|
1168
|
+
r.length > 40 && (r = r.substring(0, 36) + '..."'), Ut(t.doc.options.logLevel, `Keys with collection values will be stringified due to JS Object restrictions: ${r}. Set mapAsMap: true to use object keys.`), t.mapKeyWarned = !0;
|
|
1121
1169
|
}
|
|
1122
1170
|
return i;
|
|
1123
1171
|
}
|
|
1124
1172
|
return JSON.stringify(e);
|
|
1125
1173
|
}
|
|
1126
|
-
function
|
|
1174
|
+
function ot(s, e, t) {
|
|
1127
1175
|
const n = me(s, void 0, t), i = me(e, void 0, t);
|
|
1128
1176
|
return new B(n, i);
|
|
1129
1177
|
}
|
|
1130
1178
|
class B {
|
|
1131
1179
|
constructor(e, t = null) {
|
|
1132
|
-
Object.defineProperty(this, j, { value:
|
|
1180
|
+
Object.defineProperty(this, j, { value: Ct }), this.key = e, this.value = t;
|
|
1133
1181
|
}
|
|
1134
1182
|
clone(e) {
|
|
1135
1183
|
let { key: t, value: n } = this;
|
|
@@ -1137,16 +1185,16 @@ class B {
|
|
|
1137
1185
|
}
|
|
1138
1186
|
toJSON(e, t) {
|
|
1139
1187
|
const n = t?.mapAsMap ? /* @__PURE__ */ new Map() : {};
|
|
1140
|
-
return
|
|
1188
|
+
return Rt(t, n, this);
|
|
1141
1189
|
}
|
|
1142
1190
|
toString(e, t, n) {
|
|
1143
|
-
return e?.doc ?
|
|
1191
|
+
return e?.doc ? js(this, e, t, n) : JSON.stringify(this);
|
|
1144
1192
|
}
|
|
1145
1193
|
}
|
|
1146
|
-
function
|
|
1147
|
-
return (e.inFlow ?? s.flow ?
|
|
1194
|
+
function Vt(s, e, t) {
|
|
1195
|
+
return (e.inFlow ?? s.flow ? Us : qs)(s, e, t);
|
|
1148
1196
|
}
|
|
1149
|
-
function
|
|
1197
|
+
function qs({ comment: s, items: e }, t, { blockItemPrefix: n, flowChars: i, itemIndent: r, onChompKeep: o, onComment: l }) {
|
|
1150
1198
|
const { indent: a, options: { commentString: c } } = t, d = Object.assign({}, t, { indent: r, type: null });
|
|
1151
1199
|
let f = !1;
|
|
1152
1200
|
const u = [];
|
|
@@ -1178,7 +1226,7 @@ ${a}${h}` : `
|
|
|
1178
1226
|
return s ? (m += `
|
|
1179
1227
|
` + U(c(s), a), l && l()) : f && o && o(), m;
|
|
1180
1228
|
}
|
|
1181
|
-
function
|
|
1229
|
+
function Us({ items: s }, e, { flowChars: t, itemIndent: n }) {
|
|
1182
1230
|
const { indent: i, indentStep: r, flowCollectionPadding: o, options: { commentString: l } } = e;
|
|
1183
1231
|
n += r;
|
|
1184
1232
|
const a = Object.assign({}, e, {
|
|
@@ -1234,7 +1282,7 @@ function H(s, e) {
|
|
|
1234
1282
|
if ($(n) && (n.key === e || n.key === t || E(n.key) && n.key.value === t))
|
|
1235
1283
|
return n;
|
|
1236
1284
|
}
|
|
1237
|
-
class M extends
|
|
1285
|
+
class M extends Kt {
|
|
1238
1286
|
static get tagName() {
|
|
1239
1287
|
return "tag:yaml.org,2002:map";
|
|
1240
1288
|
}
|
|
@@ -1251,7 +1299,7 @@ class M extends jt {
|
|
|
1251
1299
|
c = r.call(t, a, c);
|
|
1252
1300
|
else if (Array.isArray(r) && !r.includes(a))
|
|
1253
1301
|
return;
|
|
1254
|
-
(c !== void 0 || i) && o.items.push(
|
|
1302
|
+
(c !== void 0 || i) && o.items.push(ot(a, c, n));
|
|
1255
1303
|
};
|
|
1256
1304
|
if (t instanceof Map)
|
|
1257
1305
|
for (const [a, c] of t)
|
|
@@ -1274,7 +1322,7 @@ class M extends jt {
|
|
|
1274
1322
|
if (i) {
|
|
1275
1323
|
if (!t)
|
|
1276
1324
|
throw new Error(`Key ${n.key} already set`);
|
|
1277
|
-
E(i.value) &&
|
|
1325
|
+
E(i.value) && jt(n.value) ? i.value.value = n.value : i.value = n.value;
|
|
1278
1326
|
} else if (r) {
|
|
1279
1327
|
const o = this.items.findIndex((l) => r(n, l) < 0);
|
|
1280
1328
|
o === -1 ? this.items.push(n) : this.items.splice(o, 0, n);
|
|
@@ -1304,7 +1352,7 @@ class M extends jt {
|
|
|
1304
1352
|
const i = n ? new n() : t?.mapAsMap ? /* @__PURE__ */ new Map() : {};
|
|
1305
1353
|
t?.onCreate && t.onCreate(i);
|
|
1306
1354
|
for (const r of this.items)
|
|
1307
|
-
|
|
1355
|
+
Rt(t, i, r);
|
|
1308
1356
|
return i;
|
|
1309
1357
|
}
|
|
1310
1358
|
toString(e, t, n) {
|
|
@@ -1313,7 +1361,7 @@ class M extends jt {
|
|
|
1313
1361
|
for (const i of this.items)
|
|
1314
1362
|
if (!$(i))
|
|
1315
1363
|
throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);
|
|
1316
|
-
return !e.allNullValues && this.hasAllNullValues(!1) && (e = Object.assign({}, e, { allNullValues: !0 })),
|
|
1364
|
+
return !e.allNullValues && this.hasAllNullValues(!1) && (e = Object.assign({}, e, { allNullValues: !0 })), Vt(this, e, {
|
|
1317
1365
|
blockItemPrefix: "",
|
|
1318
1366
|
flowChars: { start: "{", end: "}" },
|
|
1319
1367
|
itemIndent: e.indent || "",
|
|
@@ -1332,7 +1380,7 @@ const ae = {
|
|
|
1332
1380
|
},
|
|
1333
1381
|
createNode: (s, e, t) => M.from(s, e, t)
|
|
1334
1382
|
};
|
|
1335
|
-
class W extends
|
|
1383
|
+
class W extends Kt {
|
|
1336
1384
|
static get tagName() {
|
|
1337
1385
|
return "tag:yaml.org,2002:seq";
|
|
1338
1386
|
}
|
|
@@ -1383,7 +1431,7 @@ class W extends jt {
|
|
|
1383
1431
|
if (typeof n != "number")
|
|
1384
1432
|
throw new Error(`Expected a valid index, not ${e}.`);
|
|
1385
1433
|
const i = this.items[n];
|
|
1386
|
-
E(i) &&
|
|
1434
|
+
E(i) && jt(t) ? i.value = t : this.items[n] = t;
|
|
1387
1435
|
}
|
|
1388
1436
|
toJSON(e, t) {
|
|
1389
1437
|
const n = [];
|
|
@@ -1394,7 +1442,7 @@ class W extends jt {
|
|
|
1394
1442
|
return n;
|
|
1395
1443
|
}
|
|
1396
1444
|
toString(e, t, n) {
|
|
1397
|
-
return e ?
|
|
1445
|
+
return e ? Vt(this, e, {
|
|
1398
1446
|
blockItemPrefix: "- ",
|
|
1399
1447
|
flowChars: { start: "[", end: "]" },
|
|
1400
1448
|
itemIndent: (e.indent || "") + " ",
|
|
@@ -1436,7 +1484,7 @@ const ce = {
|
|
|
1436
1484
|
tag: "tag:yaml.org,2002:str",
|
|
1437
1485
|
resolve: (s) => s,
|
|
1438
1486
|
stringify(s, e, t, n) {
|
|
1439
|
-
return e = Object.assign({ actualString: !0 }, e),
|
|
1487
|
+
return e = Object.assign({ actualString: !0 }, e), rt(s, e, t, n);
|
|
1440
1488
|
}
|
|
1441
1489
|
}, je = {
|
|
1442
1490
|
identify: (s) => s == null,
|
|
@@ -1446,14 +1494,14 @@ const ce = {
|
|
|
1446
1494
|
test: /^(?:~|[Nn]ull|NULL)?$/,
|
|
1447
1495
|
resolve: () => new O(null),
|
|
1448
1496
|
stringify: ({ source: s }, e) => typeof s == "string" && je.test.test(s) ? s : e.options.nullStr
|
|
1449
|
-
},
|
|
1497
|
+
}, lt = {
|
|
1450
1498
|
identify: (s) => typeof s == "boolean",
|
|
1451
1499
|
default: !0,
|
|
1452
1500
|
tag: "tag:yaml.org,2002:bool",
|
|
1453
1501
|
test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
|
|
1454
1502
|
resolve: (s) => new O(s[0] === "t" || s[0] === "T"),
|
|
1455
1503
|
stringify({ source: s, value: e }, t) {
|
|
1456
|
-
if (s &&
|
|
1504
|
+
if (s && lt.test.test(s)) {
|
|
1457
1505
|
const n = s[0] === "t" || s[0] === "T";
|
|
1458
1506
|
if (e === n)
|
|
1459
1507
|
return s;
|
|
@@ -1477,14 +1525,14 @@ function D({ format: s, minFractionDigits: e, tag: t, value: n }) {
|
|
|
1477
1525
|
}
|
|
1478
1526
|
return r;
|
|
1479
1527
|
}
|
|
1480
|
-
const
|
|
1528
|
+
const Jt = {
|
|
1481
1529
|
identify: (s) => typeof s == "number",
|
|
1482
1530
|
default: !0,
|
|
1483
1531
|
tag: "tag:yaml.org,2002:float",
|
|
1484
1532
|
test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
|
|
1485
1533
|
resolve: (s) => s.slice(-3).toLowerCase() === "nan" ? NaN : s[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
|
|
1486
1534
|
stringify: D
|
|
1487
|
-
},
|
|
1535
|
+
}, Yt = {
|
|
1488
1536
|
identify: (s) => typeof s == "number",
|
|
1489
1537
|
default: !0,
|
|
1490
1538
|
tag: "tag:yaml.org,2002:float",
|
|
@@ -1495,7 +1543,7 @@ const Vt = {
|
|
|
1495
1543
|
const e = Number(s.value);
|
|
1496
1544
|
return isFinite(e) ? e.toExponential() : D(s);
|
|
1497
1545
|
}
|
|
1498
|
-
},
|
|
1546
|
+
}, Gt = {
|
|
1499
1547
|
identify: (s) => typeof s == "number",
|
|
1500
1548
|
default: !0,
|
|
1501
1549
|
tag: "tag:yaml.org,2002:float",
|
|
@@ -1505,51 +1553,51 @@ const Vt = {
|
|
|
1505
1553
|
return t !== -1 && s[s.length - 1] === "0" && (e.minFractionDigits = s.length - t - 1), e;
|
|
1506
1554
|
},
|
|
1507
1555
|
stringify: D
|
|
1508
|
-
}, Ke = (s) => typeof s == "bigint" || Number.isInteger(s),
|
|
1509
|
-
function
|
|
1556
|
+
}, Ke = (s) => typeof s == "bigint" || Number.isInteger(s), at = (s, e, t, { intAsBigInt: n }) => n ? BigInt(s) : parseInt(s.substring(e), t);
|
|
1557
|
+
function Ht(s, e, t) {
|
|
1510
1558
|
const { value: n } = s;
|
|
1511
1559
|
return Ke(n) && n >= 0 ? t + n.toString(e) : D(s);
|
|
1512
1560
|
}
|
|
1513
|
-
const
|
|
1561
|
+
const Wt = {
|
|
1514
1562
|
identify: (s) => Ke(s) && s >= 0,
|
|
1515
1563
|
default: !0,
|
|
1516
1564
|
tag: "tag:yaml.org,2002:int",
|
|
1517
1565
|
format: "OCT",
|
|
1518
1566
|
test: /^0o[0-7]+$/,
|
|
1519
|
-
resolve: (s, e, t) =>
|
|
1520
|
-
stringify: (s) =>
|
|
1521
|
-
},
|
|
1567
|
+
resolve: (s, e, t) => at(s, 2, 8, t),
|
|
1568
|
+
stringify: (s) => Ht(s, 8, "0o")
|
|
1569
|
+
}, Qt = {
|
|
1522
1570
|
identify: Ke,
|
|
1523
1571
|
default: !0,
|
|
1524
1572
|
tag: "tag:yaml.org,2002:int",
|
|
1525
1573
|
test: /^[-+]?[0-9]+$/,
|
|
1526
|
-
resolve: (s, e, t) =>
|
|
1574
|
+
resolve: (s, e, t) => at(s, 0, 10, t),
|
|
1527
1575
|
stringify: D
|
|
1528
|
-
},
|
|
1576
|
+
}, Xt = {
|
|
1529
1577
|
identify: (s) => Ke(s) && s >= 0,
|
|
1530
1578
|
default: !0,
|
|
1531
1579
|
tag: "tag:yaml.org,2002:int",
|
|
1532
1580
|
format: "HEX",
|
|
1533
1581
|
test: /^0x[0-9a-fA-F]+$/,
|
|
1534
|
-
resolve: (s, e, t) =>
|
|
1535
|
-
stringify: (s) =>
|
|
1536
|
-
},
|
|
1582
|
+
resolve: (s, e, t) => at(s, 2, 16, t),
|
|
1583
|
+
stringify: (s) => Ht(s, 16, "0x")
|
|
1584
|
+
}, Fs = [
|
|
1537
1585
|
ae,
|
|
1538
1586
|
ce,
|
|
1539
1587
|
Pe,
|
|
1540
1588
|
je,
|
|
1541
|
-
|
|
1542
|
-
Ht,
|
|
1589
|
+
lt,
|
|
1543
1590
|
Wt,
|
|
1544
1591
|
Qt,
|
|
1545
|
-
|
|
1592
|
+
Xt,
|
|
1546
1593
|
Jt,
|
|
1547
|
-
Yt
|
|
1594
|
+
Yt,
|
|
1595
|
+
Gt
|
|
1548
1596
|
];
|
|
1549
1597
|
function kt(s) {
|
|
1550
1598
|
return typeof s == "bigint" || Number.isInteger(s);
|
|
1551
1599
|
}
|
|
1552
|
-
const Oe = ({ value: s }) => JSON.stringify(s),
|
|
1600
|
+
const Oe = ({ value: s }) => JSON.stringify(s), Rs = [
|
|
1553
1601
|
{
|
|
1554
1602
|
identify: (s) => typeof s == "string",
|
|
1555
1603
|
default: !0,
|
|
@@ -1590,14 +1638,14 @@ const Oe = ({ value: s }) => JSON.stringify(s), Ds = [
|
|
|
1590
1638
|
resolve: (s) => parseFloat(s),
|
|
1591
1639
|
stringify: Oe
|
|
1592
1640
|
}
|
|
1593
|
-
],
|
|
1641
|
+
], Vs = {
|
|
1594
1642
|
default: !0,
|
|
1595
1643
|
tag: "",
|
|
1596
1644
|
test: /^/,
|
|
1597
1645
|
resolve(s, e) {
|
|
1598
1646
|
return e(`Unresolved plain scalar ${JSON.stringify(s)}`), s;
|
|
1599
1647
|
}
|
|
1600
|
-
},
|
|
1648
|
+
}, Js = [ae, ce].concat(Rs, Vs), ct = {
|
|
1601
1649
|
identify: (s) => s instanceof Uint8Array,
|
|
1602
1650
|
// Buffer inherits from Uint8Array
|
|
1603
1651
|
default: !1,
|
|
@@ -1638,10 +1686,10 @@ const Oe = ({ value: s }) => JSON.stringify(s), Ds = [
|
|
|
1638
1686
|
l = d.join(e === O.BLOCK_LITERAL ? `
|
|
1639
1687
|
` : " ");
|
|
1640
1688
|
}
|
|
1641
|
-
return
|
|
1689
|
+
return rt({ comment: s, type: e, value: l }, n, i, r);
|
|
1642
1690
|
}
|
|
1643
1691
|
};
|
|
1644
|
-
function
|
|
1692
|
+
function xt(s, e) {
|
|
1645
1693
|
if (be(s))
|
|
1646
1694
|
for (let t = 0; t < s.items.length; ++t) {
|
|
1647
1695
|
let n = s.items[t];
|
|
@@ -1664,7 +1712,7 @@ ${r.comment}` : n.comment;
|
|
|
1664
1712
|
e("Expected a sequence for this tag");
|
|
1665
1713
|
return s;
|
|
1666
1714
|
}
|
|
1667
|
-
function
|
|
1715
|
+
function zt(s, e, t) {
|
|
1668
1716
|
const { replacer: n } = t, i = new W(s);
|
|
1669
1717
|
i.tag = "tag:yaml.org,2002:pairs";
|
|
1670
1718
|
let r = 0;
|
|
@@ -1685,16 +1733,16 @@ function xt(s, e, t) {
|
|
|
1685
1733
|
throw new TypeError(`Expected tuple with one key, not ${c.length} keys`);
|
|
1686
1734
|
} else
|
|
1687
1735
|
l = o;
|
|
1688
|
-
i.items.push(
|
|
1736
|
+
i.items.push(ot(l, a, t));
|
|
1689
1737
|
}
|
|
1690
1738
|
return i;
|
|
1691
1739
|
}
|
|
1692
|
-
const
|
|
1740
|
+
const ft = {
|
|
1693
1741
|
collection: "seq",
|
|
1694
1742
|
default: !1,
|
|
1695
1743
|
tag: "tag:yaml.org,2002:pairs",
|
|
1696
|
-
resolve:
|
|
1697
|
-
createNode:
|
|
1744
|
+
resolve: xt,
|
|
1745
|
+
createNode: zt
|
|
1698
1746
|
};
|
|
1699
1747
|
class se extends W {
|
|
1700
1748
|
constructor() {
|
|
@@ -1718,50 +1766,50 @@ class se extends W {
|
|
|
1718
1766
|
return n;
|
|
1719
1767
|
}
|
|
1720
1768
|
static from(e, t, n) {
|
|
1721
|
-
const i =
|
|
1769
|
+
const i = zt(e, t, n), r = new this();
|
|
1722
1770
|
return r.items = i.items, r;
|
|
1723
1771
|
}
|
|
1724
1772
|
}
|
|
1725
1773
|
se.tag = "tag:yaml.org,2002:omap";
|
|
1726
|
-
const
|
|
1774
|
+
const ut = {
|
|
1727
1775
|
collection: "seq",
|
|
1728
1776
|
identify: (s) => s instanceof Map,
|
|
1729
1777
|
nodeClass: se,
|
|
1730
1778
|
default: !1,
|
|
1731
1779
|
tag: "tag:yaml.org,2002:omap",
|
|
1732
1780
|
resolve(s, e) {
|
|
1733
|
-
const t =
|
|
1781
|
+
const t = xt(s, e), n = [];
|
|
1734
1782
|
for (const { key: i } of t.items)
|
|
1735
1783
|
E(i) && (n.includes(i.value) ? e(`Ordered maps must not include duplicate keys: ${i.value}`) : n.push(i.value));
|
|
1736
1784
|
return Object.assign(new se(), t);
|
|
1737
1785
|
},
|
|
1738
1786
|
createNode: (s, e, t) => se.from(s, e, t)
|
|
1739
1787
|
};
|
|
1740
|
-
function
|
|
1741
|
-
return e && (s ?
|
|
1788
|
+
function Zt({ value: s, source: e }, t) {
|
|
1789
|
+
return e && (s ? es : ts).test.test(e) ? e : s ? t.options.trueStr : t.options.falseStr;
|
|
1742
1790
|
}
|
|
1743
|
-
const
|
|
1791
|
+
const es = {
|
|
1744
1792
|
identify: (s) => s === !0,
|
|
1745
1793
|
default: !0,
|
|
1746
1794
|
tag: "tag:yaml.org,2002:bool",
|
|
1747
1795
|
test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,
|
|
1748
1796
|
resolve: () => new O(!0),
|
|
1749
|
-
stringify:
|
|
1750
|
-
},
|
|
1797
|
+
stringify: Zt
|
|
1798
|
+
}, ts = {
|
|
1751
1799
|
identify: (s) => s === !1,
|
|
1752
1800
|
default: !0,
|
|
1753
1801
|
tag: "tag:yaml.org,2002:bool",
|
|
1754
1802
|
test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,
|
|
1755
1803
|
resolve: () => new O(!1),
|
|
1756
|
-
stringify:
|
|
1757
|
-
},
|
|
1804
|
+
stringify: Zt
|
|
1805
|
+
}, Ys = {
|
|
1758
1806
|
identify: (s) => typeof s == "number",
|
|
1759
1807
|
default: !0,
|
|
1760
1808
|
tag: "tag:yaml.org,2002:float",
|
|
1761
1809
|
test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
|
|
1762
1810
|
resolve: (s) => s.slice(-3).toLowerCase() === "nan" ? NaN : s[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
|
|
1763
1811
|
stringify: D
|
|
1764
|
-
},
|
|
1812
|
+
}, Gs = {
|
|
1765
1813
|
identify: (s) => typeof s == "number",
|
|
1766
1814
|
default: !0,
|
|
1767
1815
|
tag: "tag:yaml.org,2002:float",
|
|
@@ -1772,7 +1820,7 @@ const Zt = {
|
|
|
1772
1820
|
const e = Number(s.value);
|
|
1773
1821
|
return isFinite(e) ? e.toExponential() : D(s);
|
|
1774
1822
|
}
|
|
1775
|
-
},
|
|
1823
|
+
}, Hs = {
|
|
1776
1824
|
identify: (s) => typeof s == "number",
|
|
1777
1825
|
default: !0,
|
|
1778
1826
|
tag: "tag:yaml.org,2002:float",
|
|
@@ -1807,7 +1855,7 @@ function De(s, e, t, { intAsBigInt: n }) {
|
|
|
1807
1855
|
const r = parseInt(s, t);
|
|
1808
1856
|
return i === "-" ? -1 * r : r;
|
|
1809
1857
|
}
|
|
1810
|
-
function
|
|
1858
|
+
function ht(s, e, t) {
|
|
1811
1859
|
const { value: n } = s;
|
|
1812
1860
|
if (we(n)) {
|
|
1813
1861
|
const i = n.toString(e);
|
|
@@ -1815,37 +1863,37 @@ function ut(s, e, t) {
|
|
|
1815
1863
|
}
|
|
1816
1864
|
return D(s);
|
|
1817
1865
|
}
|
|
1818
|
-
const
|
|
1866
|
+
const Ws = {
|
|
1819
1867
|
identify: we,
|
|
1820
1868
|
default: !0,
|
|
1821
1869
|
tag: "tag:yaml.org,2002:int",
|
|
1822
1870
|
format: "BIN",
|
|
1823
1871
|
test: /^[-+]?0b[0-1_]+$/,
|
|
1824
1872
|
resolve: (s, e, t) => De(s, 2, 2, t),
|
|
1825
|
-
stringify: (s) =>
|
|
1826
|
-
},
|
|
1873
|
+
stringify: (s) => ht(s, 2, "0b")
|
|
1874
|
+
}, Qs = {
|
|
1827
1875
|
identify: we,
|
|
1828
1876
|
default: !0,
|
|
1829
1877
|
tag: "tag:yaml.org,2002:int",
|
|
1830
1878
|
format: "OCT",
|
|
1831
1879
|
test: /^[-+]?0[0-7_]+$/,
|
|
1832
1880
|
resolve: (s, e, t) => De(s, 1, 8, t),
|
|
1833
|
-
stringify: (s) =>
|
|
1834
|
-
},
|
|
1881
|
+
stringify: (s) => ht(s, 8, "0")
|
|
1882
|
+
}, Xs = {
|
|
1835
1883
|
identify: we,
|
|
1836
1884
|
default: !0,
|
|
1837
1885
|
tag: "tag:yaml.org,2002:int",
|
|
1838
1886
|
test: /^[-+]?[0-9][0-9_]*$/,
|
|
1839
1887
|
resolve: (s, e, t) => De(s, 0, 10, t),
|
|
1840
1888
|
stringify: D
|
|
1841
|
-
},
|
|
1889
|
+
}, xs = {
|
|
1842
1890
|
identify: we,
|
|
1843
1891
|
default: !0,
|
|
1844
1892
|
tag: "tag:yaml.org,2002:int",
|
|
1845
1893
|
format: "HEX",
|
|
1846
1894
|
test: /^[-+]?0x[0-9a-fA-F_]+$/,
|
|
1847
1895
|
resolve: (s, e, t) => De(s, 2, 16, t),
|
|
1848
|
-
stringify: (s) =>
|
|
1896
|
+
stringify: (s) => ht(s, 16, "0x")
|
|
1849
1897
|
};
|
|
1850
1898
|
class ne extends M {
|
|
1851
1899
|
constructor(e) {
|
|
@@ -1883,12 +1931,12 @@ class ne extends M {
|
|
|
1883
1931
|
const { replacer: i } = n, r = new this(e);
|
|
1884
1932
|
if (t && Symbol.iterator in Object(t))
|
|
1885
1933
|
for (let o of t)
|
|
1886
|
-
typeof i == "function" && (o = i.call(t, o, o)), r.items.push(
|
|
1934
|
+
typeof i == "function" && (o = i.call(t, o, o)), r.items.push(ot(o, null, n));
|
|
1887
1935
|
return r;
|
|
1888
1936
|
}
|
|
1889
1937
|
}
|
|
1890
1938
|
ne.tag = "tag:yaml.org,2002:set";
|
|
1891
|
-
const
|
|
1939
|
+
const dt = {
|
|
1892
1940
|
collection: "map",
|
|
1893
1941
|
identify: (s) => s instanceof Set,
|
|
1894
1942
|
nodeClass: ne,
|
|
@@ -1905,11 +1953,11 @@ const ht = {
|
|
|
1905
1953
|
return s;
|
|
1906
1954
|
}
|
|
1907
1955
|
};
|
|
1908
|
-
function
|
|
1956
|
+
function pt(s, e) {
|
|
1909
1957
|
const t = s[0], n = t === "-" || t === "+" ? s.substring(1) : s, i = (o) => e ? BigInt(o) : Number(o), r = n.replace(/_/g, "").split(":").reduce((o, l) => o * i(60) + i(l), i(0));
|
|
1910
1958
|
return t === "-" ? i(-1) * r : r;
|
|
1911
1959
|
}
|
|
1912
|
-
function
|
|
1960
|
+
function ss(s) {
|
|
1913
1961
|
let { value: e } = s, t = (o) => o;
|
|
1914
1962
|
if (typeof e == "bigint")
|
|
1915
1963
|
t = (o) => BigInt(o);
|
|
@@ -1920,22 +1968,22 @@ function ts(s) {
|
|
|
1920
1968
|
const i = t(60), r = [e % i];
|
|
1921
1969
|
return e < 60 ? r.unshift(0) : (e = (e - r[0]) / i, r.unshift(e % i), e >= 60 && (e = (e - r[0]) / i, r.unshift(e))), n + r.map((o) => String(o).padStart(2, "0")).join(":").replace(/000000\d*$/, "");
|
|
1922
1970
|
}
|
|
1923
|
-
const
|
|
1971
|
+
const ns = {
|
|
1924
1972
|
identify: (s) => typeof s == "bigint" || Number.isInteger(s),
|
|
1925
1973
|
default: !0,
|
|
1926
1974
|
tag: "tag:yaml.org,2002:int",
|
|
1927
1975
|
format: "TIME",
|
|
1928
1976
|
test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,
|
|
1929
|
-
resolve: (s, e, { intAsBigInt: t }) =>
|
|
1930
|
-
stringify:
|
|
1931
|
-
},
|
|
1977
|
+
resolve: (s, e, { intAsBigInt: t }) => pt(s, t),
|
|
1978
|
+
stringify: ss
|
|
1979
|
+
}, is = {
|
|
1932
1980
|
identify: (s) => typeof s == "number",
|
|
1933
1981
|
default: !0,
|
|
1934
1982
|
tag: "tag:yaml.org,2002:float",
|
|
1935
1983
|
format: "TIME",
|
|
1936
1984
|
test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,
|
|
1937
|
-
resolve: (s) =>
|
|
1938
|
-
stringify:
|
|
1985
|
+
resolve: (s) => pt(s, !1),
|
|
1986
|
+
stringify: ss
|
|
1939
1987
|
}, qe = {
|
|
1940
1988
|
identify: (s) => s instanceof Date,
|
|
1941
1989
|
default: !0,
|
|
@@ -1952,7 +2000,7 @@ const ss = {
|
|
|
1952
2000
|
let c = Date.UTC(t, n - 1, i, r || 0, o || 0, l || 0, a);
|
|
1953
2001
|
const d = e[8];
|
|
1954
2002
|
if (d && d !== "Z") {
|
|
1955
|
-
let f =
|
|
2003
|
+
let f = pt(d, !1);
|
|
1956
2004
|
Math.abs(f) < 30 && (f *= 60), c -= 6e4 * f;
|
|
1957
2005
|
}
|
|
1958
2006
|
return new Date(c);
|
|
@@ -1963,57 +2011,57 @@ const ss = {
|
|
|
1963
2011
|
ce,
|
|
1964
2012
|
Pe,
|
|
1965
2013
|
je,
|
|
1966
|
-
Zt,
|
|
1967
2014
|
es,
|
|
1968
|
-
|
|
2015
|
+
ts,
|
|
2016
|
+
Ws,
|
|
2017
|
+
Qs,
|
|
2018
|
+
Xs,
|
|
2019
|
+
xs,
|
|
1969
2020
|
Ys,
|
|
1970
2021
|
Gs,
|
|
1971
2022
|
Hs,
|
|
1972
|
-
|
|
1973
|
-
Rs,
|
|
1974
|
-
Vs,
|
|
1975
|
-
at,
|
|
2023
|
+
ct,
|
|
1976
2024
|
F,
|
|
2025
|
+
ut,
|
|
1977
2026
|
ft,
|
|
1978
|
-
|
|
1979
|
-
ht,
|
|
1980
|
-
ss,
|
|
2027
|
+
dt,
|
|
1981
2028
|
ns,
|
|
2029
|
+
is,
|
|
1982
2030
|
qe
|
|
1983
2031
|
], Nt = /* @__PURE__ */ new Map([
|
|
1984
|
-
["core",
|
|
2032
|
+
["core", Fs],
|
|
1985
2033
|
["failsafe", [ae, ce, Pe]],
|
|
1986
|
-
["json",
|
|
2034
|
+
["json", Js],
|
|
1987
2035
|
["yaml11", St],
|
|
1988
2036
|
["yaml-1.1", St]
|
|
1989
2037
|
]), Ot = {
|
|
1990
|
-
binary:
|
|
1991
|
-
bool:
|
|
1992
|
-
float:
|
|
1993
|
-
floatExp:
|
|
1994
|
-
floatNaN:
|
|
1995
|
-
floatTime:
|
|
1996
|
-
int:
|
|
1997
|
-
intHex:
|
|
1998
|
-
intOct:
|
|
1999
|
-
intTime:
|
|
2038
|
+
binary: ct,
|
|
2039
|
+
bool: lt,
|
|
2040
|
+
float: Gt,
|
|
2041
|
+
floatExp: Yt,
|
|
2042
|
+
floatNaN: Jt,
|
|
2043
|
+
floatTime: is,
|
|
2044
|
+
int: Qt,
|
|
2045
|
+
intHex: Xt,
|
|
2046
|
+
intOct: Wt,
|
|
2047
|
+
intTime: ns,
|
|
2000
2048
|
map: ae,
|
|
2001
2049
|
merge: F,
|
|
2002
2050
|
null: je,
|
|
2003
|
-
omap:
|
|
2004
|
-
pairs:
|
|
2051
|
+
omap: ut,
|
|
2052
|
+
pairs: ft,
|
|
2005
2053
|
seq: ce,
|
|
2006
|
-
set:
|
|
2054
|
+
set: dt,
|
|
2007
2055
|
timestamp: qe
|
|
2008
|
-
},
|
|
2009
|
-
"tag:yaml.org,2002:binary":
|
|
2056
|
+
}, zs = {
|
|
2057
|
+
"tag:yaml.org,2002:binary": ct,
|
|
2010
2058
|
"tag:yaml.org,2002:merge": F,
|
|
2011
|
-
"tag:yaml.org,2002:omap":
|
|
2012
|
-
"tag:yaml.org,2002:pairs":
|
|
2013
|
-
"tag:yaml.org,2002:set":
|
|
2059
|
+
"tag:yaml.org,2002:omap": ut,
|
|
2060
|
+
"tag:yaml.org,2002:pairs": ft,
|
|
2061
|
+
"tag:yaml.org,2002:set": dt,
|
|
2014
2062
|
"tag:yaml.org,2002:timestamp": qe
|
|
2015
2063
|
};
|
|
2016
|
-
function
|
|
2064
|
+
function Ve(s, e, t) {
|
|
2017
2065
|
const n = Nt.get(e);
|
|
2018
2066
|
if (n && !s)
|
|
2019
2067
|
return t && !n.includes(F) ? n.concat(F) : n.slice();
|
|
@@ -2038,17 +2086,17 @@ function Re(s, e, t) {
|
|
|
2038
2086
|
return r.includes(l) || r.push(l), r;
|
|
2039
2087
|
}, []);
|
|
2040
2088
|
}
|
|
2041
|
-
const
|
|
2042
|
-
class
|
|
2089
|
+
const Zs = (s, e) => s.key < e.key ? -1 : s.key > e.key ? 1 : 0;
|
|
2090
|
+
class mt {
|
|
2043
2091
|
constructor({ compat: e, customTags: t, merge: n, resolveKnownTags: i, schema: r, sortMapEntries: o, toStringDefaults: l }) {
|
|
2044
|
-
this.compat = Array.isArray(e) ?
|
|
2092
|
+
this.compat = Array.isArray(e) ? Ve(e, "compat") : e ? Ve(null, e) : null, this.name = typeof r == "string" && r || "core", this.knownTags = i ? zs : {}, this.tags = Ve(t, this.name, n), this.toStringOptions = l ?? null, Object.defineProperty(this, J, { value: ae }), Object.defineProperty(this, q, { value: Pe }), Object.defineProperty(this, oe, { value: ce }), this.sortMapEntries = typeof o == "function" ? o : o === !0 ? Zs : null;
|
|
2045
2093
|
}
|
|
2046
2094
|
clone() {
|
|
2047
|
-
const e = Object.create(
|
|
2095
|
+
const e = Object.create(mt.prototype, Object.getOwnPropertyDescriptors(this));
|
|
2048
2096
|
return e.tags = this.tags.slice(), e;
|
|
2049
2097
|
}
|
|
2050
2098
|
}
|
|
2051
|
-
function
|
|
2099
|
+
function en(s, e) {
|
|
2052
2100
|
const t = [];
|
|
2053
2101
|
let n = e.directives === !0;
|
|
2054
2102
|
if (e.directives !== !1 && s.directives) {
|
|
@@ -2056,7 +2104,7 @@ function Xs(s, e) {
|
|
|
2056
2104
|
a ? (t.push(a), n = !0) : s.directives.docStart && (n = !0);
|
|
2057
2105
|
}
|
|
2058
2106
|
n && t.push("---");
|
|
2059
|
-
const i =
|
|
2107
|
+
const i = qt(s, e), { commentString: r } = i.options;
|
|
2060
2108
|
if (s.commentBefore) {
|
|
2061
2109
|
t.length !== 1 && t.unshift("");
|
|
2062
2110
|
const a = r(s.commentBefore);
|
|
@@ -2140,11 +2188,11 @@ class Ue {
|
|
|
2140
2188
|
*/
|
|
2141
2189
|
createAlias(e, t) {
|
|
2142
2190
|
if (!e.anchor) {
|
|
2143
|
-
const n =
|
|
2191
|
+
const n = Mt(this);
|
|
2144
2192
|
e.anchor = // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
2145
|
-
!t || n.has(t) ?
|
|
2193
|
+
!t || n.has(t) ? Pt(t || "a", n) : t;
|
|
2146
2194
|
}
|
|
2147
|
-
return new
|
|
2195
|
+
return new it(e.anchor);
|
|
2148
2196
|
}
|
|
2149
2197
|
createNode(e, t, n) {
|
|
2150
2198
|
let i;
|
|
@@ -2154,7 +2202,7 @@ class Ue {
|
|
|
2154
2202
|
const p = (w) => typeof w == "number" || w instanceof String || w instanceof Number, b = t.filter(p).map(String);
|
|
2155
2203
|
b.length > 0 && (t = t.concat(b)), i = t;
|
|
2156
2204
|
} else n === void 0 && t && (n = t, t = void 0);
|
|
2157
|
-
const { aliasDuplicateObjects: r, anchorPrefix: o, flow: l, keepUndefined: a, onTagObj: c, tag: d } = n ?? {}, { onAnchor: f, setAnchors: u, sourceObjects: m } =
|
|
2205
|
+
const { aliasDuplicateObjects: r, anchorPrefix: o, flow: l, keepUndefined: a, onTagObj: c, tag: d } = n ?? {}, { onAnchor: f, setAnchors: u, sourceObjects: m } = Ls(
|
|
2158
2206
|
this,
|
|
2159
2207
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
2160
2208
|
o || "a"
|
|
@@ -2262,7 +2310,7 @@ class Ue {
|
|
|
2262
2310
|
if (t.schema instanceof Object)
|
|
2263
2311
|
this.schema = t.schema;
|
|
2264
2312
|
else if (n)
|
|
2265
|
-
this.schema = new
|
|
2313
|
+
this.schema = new mt(Object.assign(n, t));
|
|
2266
2314
|
else
|
|
2267
2315
|
throw new Error("With a null YAML version, the { schema: Schema } option is required");
|
|
2268
2316
|
}
|
|
@@ -2298,7 +2346,7 @@ class Ue {
|
|
|
2298
2346
|
const t = JSON.stringify(e.indent);
|
|
2299
2347
|
throw new Error(`"indent" option must be a positive integer, not ${t}`);
|
|
2300
2348
|
}
|
|
2301
|
-
return
|
|
2349
|
+
return en(this, e);
|
|
2302
2350
|
}
|
|
2303
2351
|
}
|
|
2304
2352
|
function x(s) {
|
|
@@ -2306,17 +2354,17 @@ function x(s) {
|
|
|
2306
2354
|
return !0;
|
|
2307
2355
|
throw new Error("Expected a YAML collection as document contents");
|
|
2308
2356
|
}
|
|
2309
|
-
class
|
|
2357
|
+
class rs extends Error {
|
|
2310
2358
|
constructor(e, t, n, i) {
|
|
2311
2359
|
super(), this.name = e, this.code = n, this.message = i, this.pos = t;
|
|
2312
2360
|
}
|
|
2313
2361
|
}
|
|
2314
|
-
class he extends
|
|
2362
|
+
class he extends rs {
|
|
2315
2363
|
constructor(e, t, n) {
|
|
2316
2364
|
super("YAMLParseError", e, t, n);
|
|
2317
2365
|
}
|
|
2318
2366
|
}
|
|
2319
|
-
class
|
|
2367
|
+
class tn extends rs {
|
|
2320
2368
|
constructor(e, t, n) {
|
|
2321
2369
|
super("YAMLWarning", e, t, n);
|
|
2322
2370
|
}
|
|
@@ -2439,7 +2487,7 @@ function ze(s, e, t) {
|
|
|
2439
2487
|
n.indent === s && (n.source === "]" || n.source === "}") && ge(e) && t(n, "BAD_INDENT", "Flow end indicator should be more indented than parent", !0);
|
|
2440
2488
|
}
|
|
2441
2489
|
}
|
|
2442
|
-
function
|
|
2490
|
+
function os(s, e, t) {
|
|
2443
2491
|
const { uniqueKeys: n } = s.options;
|
|
2444
2492
|
if (n === !1)
|
|
2445
2493
|
return !1;
|
|
@@ -2447,7 +2495,7 @@ function rs(s, e, t) {
|
|
|
2447
2495
|
return e.some((r) => i(r.key, t));
|
|
2448
2496
|
}
|
|
2449
2497
|
const Tt = "All mapping items must start at the same column";
|
|
2450
|
-
function
|
|
2498
|
+
function sn({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
2451
2499
|
const o = r?.nodeClass ?? M, l = new o(t.schema);
|
|
2452
2500
|
t.atRoot && (t.atRoot = !1);
|
|
2453
2501
|
let a = n.offset, c = null;
|
|
@@ -2470,7 +2518,7 @@ function zs({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
2470
2518
|
} else h.found?.indent !== n.indent && i(a, "BAD_INDENT", Tt);
|
|
2471
2519
|
t.atKey = !0;
|
|
2472
2520
|
const b = h.end, w = u ? s(t, u, h, i) : e(t, b, f, null, h, i);
|
|
2473
|
-
t.schema.compat && ze(n.indent, u, i), t.atKey = !1,
|
|
2521
|
+
t.schema.compat && ze(n.indent, u, i), t.atKey = !1, os(t, l.items, w) && i(b, "DUPLICATE_KEY", "Map keys must be unique");
|
|
2474
2522
|
const k = re(m ?? [], {
|
|
2475
2523
|
indicator: "map-value-ind",
|
|
2476
2524
|
next: g,
|
|
@@ -2494,7 +2542,7 @@ function zs({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
2494
2542
|
}
|
|
2495
2543
|
return c && c < a && i(c, "IMPOSSIBLE", "Map comment with trailing content"), l.range = [n.offset, a, c ?? a], l;
|
|
2496
2544
|
}
|
|
2497
|
-
function
|
|
2545
|
+
function nn({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
2498
2546
|
const o = r?.nodeClass ?? W, l = new o(t.schema);
|
|
2499
2547
|
t.atRoot && (t.atRoot = !1), t.atKey && (t.atKey = !1);
|
|
2500
2548
|
let a = n.offset, c = null;
|
|
@@ -2546,8 +2594,8 @@ function ke(s, e, t, n) {
|
|
|
2546
2594
|
}
|
|
2547
2595
|
return { comment: i, offset: e };
|
|
2548
2596
|
}
|
|
2549
|
-
const
|
|
2550
|
-
function
|
|
2597
|
+
const Je = "Block collections are not allowed within flow collections", Ye = (s) => s && (s.type === "block-map" || s.type === "block-seq");
|
|
2598
|
+
function rn({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
2551
2599
|
const o = n.start.source === "{", l = o ? "flow map" : "flow sequence", a = r?.nodeClass ?? (o ? M : W), c = new a(t.schema);
|
|
2552
2600
|
c.flow = !0;
|
|
2553
2601
|
const d = t.atRoot;
|
|
@@ -2599,11 +2647,11 @@ function en({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
2599
2647
|
}
|
|
2600
2648
|
if (!o && !S && !A.found) {
|
|
2601
2649
|
const T = N ? s(t, N, A, i) : e(t, A.end, S, null, A, i);
|
|
2602
|
-
c.items.push(T), f = T.range[2],
|
|
2650
|
+
c.items.push(T), f = T.range[2], Ye(N) && i(T.range, "BLOCK_IN_FLOW", Je);
|
|
2603
2651
|
} else {
|
|
2604
2652
|
t.atKey = !0;
|
|
2605
2653
|
const T = A.end, y = k ? s(t, k, A, i) : e(t, T, w, null, A, i);
|
|
2606
|
-
|
|
2654
|
+
Ye(k) && i(y.range, "BLOCK_IN_FLOW", Je), t.atKey = !1;
|
|
2607
2655
|
const v = re(S ?? [], {
|
|
2608
2656
|
flow: l,
|
|
2609
2657
|
indicator: "map-value-ind",
|
|
@@ -2628,12 +2676,12 @@ function en({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
2628
2676
|
}
|
|
2629
2677
|
} else N && ("source" in N && N.source?.[0] === ":" ? i(N, "MISSING_CHAR", `Missing space after : in ${l}`) : i(v.start, "MISSING_CHAR", `Missing , or : between ${l} items`));
|
|
2630
2678
|
const R = N ? s(t, N, v, i) : v.found ? e(t, v.end, S, null, v, i) : null;
|
|
2631
|
-
R ?
|
|
2679
|
+
R ? Ye(N) && i(R.range, "BLOCK_IN_FLOW", Je) : v.comment && (y.comment ? y.comment += `
|
|
2632
2680
|
` + v.comment : y.comment = v.comment);
|
|
2633
2681
|
const X = new B(y, R);
|
|
2634
2682
|
if (t.options.keepSourceTokens && (X.srcToken = b), o) {
|
|
2635
2683
|
const C = c;
|
|
2636
|
-
|
|
2684
|
+
os(t, C.items, y) && i(T, "DUPLICATE_KEY", "Map keys must be unique"), C.items.push(X);
|
|
2637
2685
|
} else {
|
|
2638
2686
|
const C = new M(t.schema);
|
|
2639
2687
|
C.flow = !0, C.items.push(X);
|
|
@@ -2659,11 +2707,11 @@ function en({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
2659
2707
|
c.range = [n.offset, h, h];
|
|
2660
2708
|
return c;
|
|
2661
2709
|
}
|
|
2662
|
-
function
|
|
2663
|
-
const o = t.type === "block-map" ?
|
|
2710
|
+
function Ge(s, e, t, n, i, r) {
|
|
2711
|
+
const o = t.type === "block-map" ? sn(s, e, t, n, r) : t.type === "block-seq" ? nn(s, e, t, n, r) : rn(s, e, t, n, r), l = o.constructor;
|
|
2664
2712
|
return i === "!" || i === l.tagName ? (o.tag = l.tagName, o) : (i && (o.tag = i), o);
|
|
2665
2713
|
}
|
|
2666
|
-
function
|
|
2714
|
+
function on(s, e, t, n, i) {
|
|
2667
2715
|
const r = n.tag, o = r ? e.directives.tagName(r.source, (u) => i(r, "TAG_RESOLVE_FAILED", u)) : null;
|
|
2668
2716
|
if (t.type === "block-seq") {
|
|
2669
2717
|
const { anchor: u, newlineAfterProp: m } = n, g = u && r ? u.offset > r.offset ? u : r : u ?? r;
|
|
@@ -2671,23 +2719,23 @@ function tn(s, e, t, n, i) {
|
|
|
2671
2719
|
}
|
|
2672
2720
|
const l = t.type === "block-map" ? "map" : t.type === "block-seq" ? "seq" : t.start.source === "{" ? "map" : "seq";
|
|
2673
2721
|
if (!r || !o || o === "!" || o === M.tagName && l === "map" || o === W.tagName && l === "seq")
|
|
2674
|
-
return
|
|
2722
|
+
return Ge(s, e, t, i, o);
|
|
2675
2723
|
let a = e.schema.tags.find((u) => u.tag === o && u.collection === l);
|
|
2676
2724
|
if (!a) {
|
|
2677
2725
|
const u = e.schema.knownTags[o];
|
|
2678
2726
|
if (u?.collection === l)
|
|
2679
2727
|
e.schema.tags.push(Object.assign({}, u, { default: !1 })), a = u;
|
|
2680
2728
|
else
|
|
2681
|
-
return u ? i(r, "BAD_COLLECTION_TYPE", `${u.tag} used for ${l} collection, but expects ${u.collection ?? "scalar"}`, !0) : i(r, "TAG_RESOLVE_FAILED", `Unresolved tag: ${o}`, !0),
|
|
2729
|
+
return u ? i(r, "BAD_COLLECTION_TYPE", `${u.tag} used for ${l} collection, but expects ${u.collection ?? "scalar"}`, !0) : i(r, "TAG_RESOLVE_FAILED", `Unresolved tag: ${o}`, !0), Ge(s, e, t, i, o);
|
|
2682
2730
|
}
|
|
2683
|
-
const c =
|
|
2731
|
+
const c = Ge(s, e, t, i, o, a), d = a.resolve?.(c, (u) => i(r, "TAG_RESOLVE_FAILED", u), e.options) ?? c, f = L(d) ? d : new O(d);
|
|
2684
2732
|
return f.range = c.range, f.tag = o, a?.format && (f.format = a.format), f;
|
|
2685
2733
|
}
|
|
2686
|
-
function
|
|
2687
|
-
const n = e.offset, i =
|
|
2734
|
+
function ln(s, e, t) {
|
|
2735
|
+
const n = e.offset, i = an(e, s.options.strict, t);
|
|
2688
2736
|
if (!i)
|
|
2689
2737
|
return { value: "", type: null, comment: "", range: [n, n, n] };
|
|
2690
|
-
const r = i.mode === ">" ? O.BLOCK_FOLDED : O.BLOCK_LITERAL, o = e.source ?
|
|
2738
|
+
const r = i.mode === ">" ? O.BLOCK_FOLDED : O.BLOCK_LITERAL, o = e.source ? cn(e.source) : [];
|
|
2691
2739
|
let l = o.length;
|
|
2692
2740
|
for (let h = o.length - 1; h >= 0; --h) {
|
|
2693
2741
|
const p = o[h][1];
|
|
@@ -2756,7 +2804,7 @@ function sn(s, e, t) {
|
|
|
2756
2804
|
const g = n + i.length + e.source.length;
|
|
2757
2805
|
return { value: f, type: r, comment: i.comment, range: [n, g, g] };
|
|
2758
2806
|
}
|
|
2759
|
-
function
|
|
2807
|
+
function an({ offset: s, props: e }, t, n) {
|
|
2760
2808
|
if (e[0].type !== "block-scalar-header")
|
|
2761
2809
|
return n(e[0], "IMPOSSIBLE", "Block scalar header not found"), null;
|
|
2762
2810
|
const { source: i } = e[0], r = i[0];
|
|
@@ -2798,25 +2846,25 @@ function nn({ offset: s, props: e }, t, n) {
|
|
|
2798
2846
|
}
|
|
2799
2847
|
return { mode: r, indent: o, chomp: l, comment: d, length: f };
|
|
2800
2848
|
}
|
|
2801
|
-
function
|
|
2849
|
+
function cn(s) {
|
|
2802
2850
|
const e = s.split(/\n( *)/), t = e[0], n = t.match(/^( *)/), r = [n?.[1] ? [n[1], t.slice(n[1].length)] : ["", t]];
|
|
2803
2851
|
for (let o = 1; o < e.length; o += 2)
|
|
2804
2852
|
r.push([e[o], e[o + 1]]);
|
|
2805
2853
|
return r;
|
|
2806
2854
|
}
|
|
2807
|
-
function
|
|
2855
|
+
function fn(s, e, t) {
|
|
2808
2856
|
const { offset: n, type: i, source: r, end: o } = s;
|
|
2809
2857
|
let l, a;
|
|
2810
2858
|
const c = (u, m, g) => t(n + u, m, g);
|
|
2811
2859
|
switch (i) {
|
|
2812
2860
|
case "scalar":
|
|
2813
|
-
l = O.PLAIN, a =
|
|
2861
|
+
l = O.PLAIN, a = un(r, c);
|
|
2814
2862
|
break;
|
|
2815
2863
|
case "single-quoted-scalar":
|
|
2816
|
-
l = O.QUOTE_SINGLE, a =
|
|
2864
|
+
l = O.QUOTE_SINGLE, a = hn(r, c);
|
|
2817
2865
|
break;
|
|
2818
2866
|
case "double-quoted-scalar":
|
|
2819
|
-
l = O.QUOTE_DOUBLE, a =
|
|
2867
|
+
l = O.QUOTE_DOUBLE, a = dn(r, c);
|
|
2820
2868
|
break;
|
|
2821
2869
|
/* istanbul ignore next should not happen */
|
|
2822
2870
|
default:
|
|
@@ -2835,7 +2883,7 @@ function on(s, e, t) {
|
|
|
2835
2883
|
range: [n, d, f.offset]
|
|
2836
2884
|
};
|
|
2837
2885
|
}
|
|
2838
|
-
function
|
|
2886
|
+
function un(s, e) {
|
|
2839
2887
|
let t = "";
|
|
2840
2888
|
switch (s[0]) {
|
|
2841
2889
|
/* istanbul ignore next should not happen */
|
|
@@ -2859,12 +2907,12 @@ function ln(s, e) {
|
|
|
2859
2907
|
break;
|
|
2860
2908
|
}
|
|
2861
2909
|
}
|
|
2862
|
-
return t && e(0, "BAD_SCALAR_START", `Plain value cannot start with ${t}`),
|
|
2910
|
+
return t && e(0, "BAD_SCALAR_START", `Plain value cannot start with ${t}`), ls(s);
|
|
2863
2911
|
}
|
|
2864
|
-
function
|
|
2865
|
-
return (s[s.length - 1] !== "'" || s.length === 1) && e(s.length, "MISSING_CHAR", "Missing closing 'quote"),
|
|
2912
|
+
function hn(s, e) {
|
|
2913
|
+
return (s[s.length - 1] !== "'" || s.length === 1) && e(s.length, "MISSING_CHAR", "Missing closing 'quote"), ls(s.slice(1, -1)).replace(/''/g, "'");
|
|
2866
2914
|
}
|
|
2867
|
-
function
|
|
2915
|
+
function ls(s) {
|
|
2868
2916
|
let e, t;
|
|
2869
2917
|
try {
|
|
2870
2918
|
e = new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
@@ -2884,7 +2932,7 @@ function os(s) {
|
|
|
2884
2932
|
const l = /[ \t]*(.*)/sy;
|
|
2885
2933
|
return l.lastIndex = o, n = l.exec(s), i + r + (n?.[1] ?? "");
|
|
2886
2934
|
}
|
|
2887
|
-
function
|
|
2935
|
+
function dn(s, e) {
|
|
2888
2936
|
let t = "";
|
|
2889
2937
|
for (let n = 1; n < s.length - 1; ++n) {
|
|
2890
2938
|
const i = s[n];
|
|
@@ -2892,11 +2940,11 @@ function cn(s, e) {
|
|
|
2892
2940
|
`))
|
|
2893
2941
|
if (i === `
|
|
2894
2942
|
`) {
|
|
2895
|
-
const { fold: r, offset: o } =
|
|
2943
|
+
const { fold: r, offset: o } = pn(s, n);
|
|
2896
2944
|
t += r, n = o;
|
|
2897
2945
|
} else if (i === "\\") {
|
|
2898
2946
|
let r = s[++n];
|
|
2899
|
-
const o =
|
|
2947
|
+
const o = mn[r];
|
|
2900
2948
|
if (o)
|
|
2901
2949
|
t += o;
|
|
2902
2950
|
else if (r === `
|
|
@@ -2909,7 +2957,7 @@ function cn(s, e) {
|
|
|
2909
2957
|
r = s[++n + 1];
|
|
2910
2958
|
else if (r === "x" || r === "u" || r === "U") {
|
|
2911
2959
|
const l = { x: 2, u: 4, U: 8 }[r];
|
|
2912
|
-
t +=
|
|
2960
|
+
t += gn(s, n + 1, l, e), n += l;
|
|
2913
2961
|
} else {
|
|
2914
2962
|
const l = s.substr(n - 1, 2);
|
|
2915
2963
|
e(n - 1, "BAD_DQ_ESCAPE", `Invalid escape sequence ${l}`), t += l;
|
|
@@ -2927,7 +2975,7 @@ function cn(s, e) {
|
|
|
2927
2975
|
}
|
|
2928
2976
|
return (s[s.length - 1] !== '"' || s.length === 1) && e(s.length, "MISSING_CHAR", 'Missing closing "quote'), t;
|
|
2929
2977
|
}
|
|
2930
|
-
function
|
|
2978
|
+
function pn(s, e) {
|
|
2931
2979
|
let t = "", n = s[e + 1];
|
|
2932
2980
|
for (; (n === " " || n === " " || n === `
|
|
2933
2981
|
` || n === "\r") && !(n === "\r" && s[e + 2] !== `
|
|
@@ -2937,7 +2985,7 @@ function fn(s, e) {
|
|
|
2937
2985
|
`), e += 1, n = s[e + 1];
|
|
2938
2986
|
return t || (t = " "), { fold: t, offset: e };
|
|
2939
2987
|
}
|
|
2940
|
-
const
|
|
2988
|
+
const mn = {
|
|
2941
2989
|
0: "\0",
|
|
2942
2990
|
// null character
|
|
2943
2991
|
a: "\x07",
|
|
@@ -2971,7 +3019,7 @@ const un = {
|
|
|
2971
3019
|
"\\": "\\",
|
|
2972
3020
|
" ": " "
|
|
2973
3021
|
};
|
|
2974
|
-
function
|
|
3022
|
+
function gn(s, e, t, n) {
|
|
2975
3023
|
const i = s.substr(e, t), o = i.length === t && /^[0-9a-fA-F]+$/.test(i) ? parseInt(i, 16) : NaN;
|
|
2976
3024
|
if (isNaN(o)) {
|
|
2977
3025
|
const l = s.substr(e - 2, t + 2);
|
|
@@ -2979,10 +3027,10 @@ function hn(s, e, t, n) {
|
|
|
2979
3027
|
}
|
|
2980
3028
|
return String.fromCodePoint(o);
|
|
2981
3029
|
}
|
|
2982
|
-
function
|
|
2983
|
-
const { value: i, type: r, comment: o, range: l } = e.type === "block-scalar" ?
|
|
3030
|
+
function as(s, e, t, n) {
|
|
3031
|
+
const { value: i, type: r, comment: o, range: l } = e.type === "block-scalar" ? ln(s, e, n) : fn(e, s.options.strict, n), a = t ? s.directives.tagName(t.source, (f) => n(t, "TAG_RESOLVE_FAILED", f)) : null;
|
|
2984
3032
|
let c;
|
|
2985
|
-
s.options.stringKeys && s.atKey ? c = s.schema[q] : a ? c =
|
|
3033
|
+
s.options.stringKeys && s.atKey ? c = s.schema[q] : a ? c = yn(s.schema, i, a, t, n) : e.type === "scalar" ? c = bn(s, i, e, n) : c = s.schema[q];
|
|
2986
3034
|
let d;
|
|
2987
3035
|
try {
|
|
2988
3036
|
const f = c.resolve(i, (u) => n(t ?? e, "TAG_RESOLVE_FAILED", u), s.options);
|
|
@@ -2993,7 +3041,7 @@ function ls(s, e, t, n) {
|
|
|
2993
3041
|
}
|
|
2994
3042
|
return d.range = l, d.source = i, r && (d.type = r), a && (d.tag = a), c.format && (d.format = c.format), o && (d.comment = o), d;
|
|
2995
3043
|
}
|
|
2996
|
-
function
|
|
3044
|
+
function yn(s, e, t, n, i) {
|
|
2997
3045
|
if (t === "!")
|
|
2998
3046
|
return s[q];
|
|
2999
3047
|
const r = [];
|
|
@@ -3009,7 +3057,7 @@ function dn(s, e, t, n, i) {
|
|
|
3009
3057
|
const o = s.knownTags[t];
|
|
3010
3058
|
return o && !o.collection ? (s.tags.push(Object.assign({}, o, { default: !1, test: void 0 })), o) : (i(n, "TAG_RESOLVE_FAILED", `Unresolved tag: ${t}`, t !== "tag:yaml.org,2002:str"), s[q]);
|
|
3011
3059
|
}
|
|
3012
|
-
function
|
|
3060
|
+
function bn({ atKey: s, directives: e, schema: t }, n, i, r) {
|
|
3013
3061
|
const o = t.tags.find((l) => (l.default === !0 || s && l.default === "key") && l.test?.test(n)) || t[q];
|
|
3014
3062
|
if (t.compat) {
|
|
3015
3063
|
const l = t.compat.find((a) => a.default && a.test?.test(n)) ?? t[q];
|
|
@@ -3020,7 +3068,7 @@ function pn({ atKey: s, directives: e, schema: t }, n, i, r) {
|
|
|
3020
3068
|
}
|
|
3021
3069
|
return o;
|
|
3022
3070
|
}
|
|
3023
|
-
function
|
|
3071
|
+
function wn(s, e, t) {
|
|
3024
3072
|
if (e) {
|
|
3025
3073
|
t ?? (t = e.length);
|
|
3026
3074
|
for (let n = t - 1; n >= 0; --n) {
|
|
@@ -3039,48 +3087,48 @@ function mn(s, e, t) {
|
|
|
3039
3087
|
}
|
|
3040
3088
|
return s;
|
|
3041
3089
|
}
|
|
3042
|
-
const
|
|
3043
|
-
function
|
|
3090
|
+
const kn = { composeNode: cs, composeEmptyNode: gt };
|
|
3091
|
+
function cs(s, e, t, n) {
|
|
3044
3092
|
const i = s.atKey, { spaceBefore: r, comment: o, anchor: l, tag: a } = t;
|
|
3045
3093
|
let c, d = !0;
|
|
3046
3094
|
switch (e.type) {
|
|
3047
3095
|
case "alias":
|
|
3048
|
-
c =
|
|
3096
|
+
c = Sn(s, e, n), (l || a) && n(e, "ALIAS_PROPS", "An alias node must not specify any properties");
|
|
3049
3097
|
break;
|
|
3050
3098
|
case "scalar":
|
|
3051
3099
|
case "single-quoted-scalar":
|
|
3052
3100
|
case "double-quoted-scalar":
|
|
3053
3101
|
case "block-scalar":
|
|
3054
|
-
c =
|
|
3102
|
+
c = as(s, e, a, n), l && (c.anchor = l.source.substring(1));
|
|
3055
3103
|
break;
|
|
3056
3104
|
case "block-map":
|
|
3057
3105
|
case "block-seq":
|
|
3058
3106
|
case "flow-collection":
|
|
3059
|
-
c =
|
|
3107
|
+
c = on(kn, s, e, t, n), l && (c.anchor = l.source.substring(1));
|
|
3060
3108
|
break;
|
|
3061
3109
|
default: {
|
|
3062
3110
|
const f = e.type === "error" ? e.message : `Unsupported token (type: ${e.type})`;
|
|
3063
|
-
n(e, "UNEXPECTED_TOKEN", f), c =
|
|
3111
|
+
n(e, "UNEXPECTED_TOKEN", f), c = gt(s, e.offset, void 0, null, t, n), d = !1;
|
|
3064
3112
|
}
|
|
3065
3113
|
}
|
|
3066
3114
|
return l && c.anchor === "" && n(l, "BAD_ALIAS", "Anchor cannot be an empty string"), i && s.options.stringKeys && (!E(c) || typeof c.value != "string" || c.tag && c.tag !== "tag:yaml.org,2002:str") && n(a ?? e, "NON_STRING_KEY", "With stringKeys, all keys must be strings"), r && (c.spaceBefore = !0), o && (e.type === "scalar" && e.source === "" ? c.comment = o : c.commentBefore = o), s.options.keepSourceTokens && d && (c.srcToken = e), c;
|
|
3067
3115
|
}
|
|
3068
|
-
function
|
|
3116
|
+
function gt(s, e, t, n, { spaceBefore: i, comment: r, anchor: o, tag: l, end: a }, c) {
|
|
3069
3117
|
const d = {
|
|
3070
3118
|
type: "scalar",
|
|
3071
|
-
offset:
|
|
3119
|
+
offset: wn(e, t, n),
|
|
3072
3120
|
indent: -1,
|
|
3073
3121
|
source: ""
|
|
3074
|
-
}, f =
|
|
3122
|
+
}, f = as(s, d, l, c);
|
|
3075
3123
|
return o && (f.anchor = o.source.substring(1), f.anchor === "" && c(o, "BAD_ALIAS", "Anchor cannot be an empty string")), i && (f.spaceBefore = !0), r && (f.comment = r, f.range[2] = a), f;
|
|
3076
3124
|
}
|
|
3077
|
-
function
|
|
3078
|
-
const r = new
|
|
3125
|
+
function Sn({ options: s }, { offset: e, source: t, end: n }, i) {
|
|
3126
|
+
const r = new it(t.substring(1));
|
|
3079
3127
|
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);
|
|
3080
3128
|
const o = e + t.length, l = ke(n, o, s.strict, i);
|
|
3081
3129
|
return r.range = [e, o, l.offset], l.comment && (r.comment = l.comment), r;
|
|
3082
3130
|
}
|
|
3083
|
-
function
|
|
3131
|
+
function Nn(s, e, { offset: t, start: n, value: i, end: r }, o) {
|
|
3084
3132
|
const l = Object.assign({ _directives: e }, s), a = new Ue(void 0, l), c = {
|
|
3085
3133
|
atKey: !1,
|
|
3086
3134
|
atRoot: !0,
|
|
@@ -3095,7 +3143,7 @@ function bn(s, e, { offset: t, start: n, value: i, end: r }, o) {
|
|
|
3095
3143
|
parentIndent: 0,
|
|
3096
3144
|
startOnNewline: !0
|
|
3097
3145
|
});
|
|
3098
|
-
d.found && (a.directives.docStart = !0, i && (i.type === "block-map" || i.type === "block-seq") && !d.hasNewline && o(d.end, "MISSING_CHAR", "Block collection cannot start on same line with directives-end marker")), a.contents = i ?
|
|
3146
|
+
d.found && (a.directives.docStart = !0, i && (i.type === "block-map" || i.type === "block-seq") && !d.hasNewline && o(d.end, "MISSING_CHAR", "Block collection cannot start on same line with directives-end marker")), a.contents = i ? cs(c, i, d, o) : gt(c, d.end, n, null, d, o);
|
|
3099
3147
|
const f = a.contents.range[2], u = ke(r, f, !1, o);
|
|
3100
3148
|
return u.comment && (a.comment = u.comment), a.range = [t, f, u.offset], a;
|
|
3101
3149
|
}
|
|
@@ -3127,11 +3175,11 @@ function Et(s) {
|
|
|
3127
3175
|
}
|
|
3128
3176
|
return { comment: e, afterEmptyLine: n };
|
|
3129
3177
|
}
|
|
3130
|
-
class
|
|
3178
|
+
class On {
|
|
3131
3179
|
constructor(e = {}) {
|
|
3132
3180
|
this.doc = null, this.atDirectives = !1, this.prelude = [], this.errors = [], this.warnings = [], this.onError = (t, n, i, r) => {
|
|
3133
3181
|
const o = fe(t);
|
|
3134
|
-
r ? this.warnings.push(new
|
|
3182
|
+
r ? this.warnings.push(new tn(o, n, i)) : this.errors.push(new he(o, n, i));
|
|
3135
3183
|
}, this.directives = new _({ version: e.version || "1.2" }), this.options = e;
|
|
3136
3184
|
}
|
|
3137
3185
|
decorate(e, t) {
|
|
@@ -3191,7 +3239,7 @@ ${o}` : n;
|
|
|
3191
3239
|
}), this.prelude.push(e.source), this.atDirectives = !0;
|
|
3192
3240
|
break;
|
|
3193
3241
|
case "document": {
|
|
3194
|
-
const t =
|
|
3242
|
+
const t = Nn(this.options, this.directives, e, this.onError);
|
|
3195
3243
|
this.atDirectives && !t.directives.docStart && this.onError(e, "MISSING_CHAR", "Missing directives-end/doc-start indicator line"), this.decorate(t, !1), this.doc && (yield this.doc), this.doc = t, this.atDirectives = !1;
|
|
3196
3244
|
break;
|
|
3197
3245
|
}
|
|
@@ -3242,14 +3290,14 @@ ${t.comment}` : t.comment;
|
|
|
3242
3290
|
}
|
|
3243
3291
|
}
|
|
3244
3292
|
}
|
|
3245
|
-
const
|
|
3246
|
-
function
|
|
3293
|
+
const fs = "\uFEFF", us = "", hs = "", Ze = "";
|
|
3294
|
+
function An(s) {
|
|
3247
3295
|
switch (s) {
|
|
3248
|
-
case cs:
|
|
3249
|
-
return "byte-order-mark";
|
|
3250
3296
|
case fs:
|
|
3251
|
-
return "
|
|
3297
|
+
return "byte-order-mark";
|
|
3252
3298
|
case us:
|
|
3299
|
+
return "doc-mode";
|
|
3300
|
+
case hs:
|
|
3253
3301
|
return "flow-error-end";
|
|
3254
3302
|
case Ze:
|
|
3255
3303
|
return "scalar";
|
|
@@ -3317,9 +3365,9 @@ function K(s) {
|
|
|
3317
3365
|
return !1;
|
|
3318
3366
|
}
|
|
3319
3367
|
}
|
|
3320
|
-
const It = new Set("0123456789ABCDEFabcdef"),
|
|
3321
|
-
\r `),
|
|
3322
|
-
class
|
|
3368
|
+
const It = new Set("0123456789ABCDEFabcdef"), Tn = new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"), Ae = new Set(",[]{}"), En = new Set(` ,[]{}
|
|
3369
|
+
\r `), He = (s) => !s || En.has(s);
|
|
3370
|
+
class In {
|
|
3323
3371
|
constructor() {
|
|
3324
3372
|
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;
|
|
3325
3373
|
}
|
|
@@ -3411,7 +3459,7 @@ class On {
|
|
|
3411
3459
|
let e = this.getLine();
|
|
3412
3460
|
if (e === null)
|
|
3413
3461
|
return this.setNext("stream");
|
|
3414
|
-
if (e[0] ===
|
|
3462
|
+
if (e[0] === fs && (yield* this.pushCount(1), e = e.substring(1)), e[0] === "%") {
|
|
3415
3463
|
let t = e.length, n = e.indexOf("#");
|
|
3416
3464
|
for (; n !== -1; ) {
|
|
3417
3465
|
const r = e[n - 1];
|
|
@@ -3435,7 +3483,7 @@ class On {
|
|
|
3435
3483
|
const t = yield* this.pushSpaces(!0);
|
|
3436
3484
|
return yield* this.pushCount(e.length - t), yield* this.pushNewline(), "stream";
|
|
3437
3485
|
}
|
|
3438
|
-
return yield
|
|
3486
|
+
return yield us, yield* this.parseLineStart();
|
|
3439
3487
|
}
|
|
3440
3488
|
*parseLineStart() {
|
|
3441
3489
|
const e = this.charAt(0);
|
|
@@ -3479,7 +3527,7 @@ class On {
|
|
|
3479
3527
|
case "]":
|
|
3480
3528
|
return yield* this.pushCount(1), "doc";
|
|
3481
3529
|
case "*":
|
|
3482
|
-
return yield* this.pushUntil(
|
|
3530
|
+
return yield* this.pushUntil(He), "doc";
|
|
3483
3531
|
case '"':
|
|
3484
3532
|
case "'":
|
|
3485
3533
|
return yield* this.parseQuotedScalar();
|
|
@@ -3499,7 +3547,7 @@ class On {
|
|
|
3499
3547
|
if (i === null)
|
|
3500
3548
|
return this.setNext("flow");
|
|
3501
3549
|
if ((n !== -1 && n < this.indentNext && i[0] !== "#" || n === 0 && (i.startsWith("---") || i.startsWith("...")) && K(i[3])) && !(n === this.indentNext - 1 && this.flowLevel === 1 && (i[0] === "]" || i[0] === "}")))
|
|
3502
|
-
return this.flowLevel = 0, yield
|
|
3550
|
+
return this.flowLevel = 0, yield hs, yield* this.parseLineStart();
|
|
3503
3551
|
let r = 0;
|
|
3504
3552
|
for (; i[r] === ","; )
|
|
3505
3553
|
r += yield* this.pushCount(1), r += yield* this.pushSpaces(!0), this.flowKey = !1;
|
|
@@ -3515,7 +3563,7 @@ class On {
|
|
|
3515
3563
|
case "]":
|
|
3516
3564
|
return yield* this.pushCount(1), this.flowKey = !0, this.flowLevel -= 1, this.flowLevel ? "flow" : "doc";
|
|
3517
3565
|
case "*":
|
|
3518
|
-
return yield* this.pushUntil(
|
|
3566
|
+
return yield* this.pushUntil(He), "flow";
|
|
3519
3567
|
case '"':
|
|
3520
3568
|
case "'":
|
|
3521
3569
|
return this.flowKey = !0, yield* this.parseQuotedScalar();
|
|
@@ -3682,7 +3730,7 @@ class On {
|
|
|
3682
3730
|
case "!":
|
|
3683
3731
|
return (yield* this.pushTag()) + (yield* this.pushSpaces(!0)) + (yield* this.pushIndicators());
|
|
3684
3732
|
case "&":
|
|
3685
|
-
return (yield* this.pushUntil(
|
|
3733
|
+
return (yield* this.pushUntil(He)) + (yield* this.pushSpaces(!0)) + (yield* this.pushIndicators());
|
|
3686
3734
|
case "-":
|
|
3687
3735
|
// this is an error
|
|
3688
3736
|
case "?":
|
|
@@ -3704,7 +3752,7 @@ class On {
|
|
|
3704
3752
|
} else {
|
|
3705
3753
|
let e = this.pos + 1, t = this.buffer[e];
|
|
3706
3754
|
for (; t; )
|
|
3707
|
-
if (
|
|
3755
|
+
if (Tn.has(t))
|
|
3708
3756
|
t = this.buffer[++e];
|
|
3709
3757
|
else if (t === "%" && It.has(this.buffer[e + 1]) && It.has(this.buffer[e + 2]))
|
|
3710
3758
|
t = this.buffer[e += 3];
|
|
@@ -3734,7 +3782,7 @@ class On {
|
|
|
3734
3782
|
return yield* this.pushToIndex(t, !1);
|
|
3735
3783
|
}
|
|
3736
3784
|
}
|
|
3737
|
-
class
|
|
3785
|
+
class Ln {
|
|
3738
3786
|
constructor() {
|
|
3739
3787
|
this.lineStarts = [], this.addNewLine = (e) => this.lineStarts.push(e), this.linePos = (e) => {
|
|
3740
3788
|
let t = 0, n = this.lineStarts.length;
|
|
@@ -3769,7 +3817,7 @@ function Lt(s) {
|
|
|
3769
3817
|
}
|
|
3770
3818
|
return -1;
|
|
3771
3819
|
}
|
|
3772
|
-
function
|
|
3820
|
+
function ds(s) {
|
|
3773
3821
|
switch (s?.type) {
|
|
3774
3822
|
case "alias":
|
|
3775
3823
|
case "scalar":
|
|
@@ -3816,15 +3864,15 @@ function z(s) {
|
|
|
3816
3864
|
function $t(s) {
|
|
3817
3865
|
if (s.start.type === "flow-seq-start")
|
|
3818
3866
|
for (const e of s.items)
|
|
3819
|
-
e.sep && !e.value && !V(e.start, "explicit-key-ind") && !V(e.sep, "map-value-ind") && (e.key && (e.value = e.key), delete e.key,
|
|
3867
|
+
e.sep && !e.value && !V(e.start, "explicit-key-ind") && !V(e.sep, "map-value-ind") && (e.key && (e.value = e.key), delete e.key, ds(e.value) ? e.value.end ? Array.prototype.push.apply(e.value.end, e.sep) : e.value.end = e.sep : Array.prototype.push.apply(e.start, e.sep), delete e.sep);
|
|
3820
3868
|
}
|
|
3821
|
-
class
|
|
3869
|
+
class $n {
|
|
3822
3870
|
/**
|
|
3823
3871
|
* @param onNewLine - If defined, called separately with the start position of
|
|
3824
3872
|
* each new line (in `parse()`, including the start of input).
|
|
3825
3873
|
*/
|
|
3826
3874
|
constructor(e) {
|
|
3827
|
-
this.atNewLine = !0, this.atScalar = !1, this.indent = 0, this.offset = 0, this.onKeyLine = !1, this.stack = [], this.source = "", this.type = "", this.lexer = new
|
|
3875
|
+
this.atNewLine = !0, this.atScalar = !1, this.indent = 0, this.offset = 0, this.onKeyLine = !1, this.stack = [], this.source = "", this.type = "", this.lexer = new In(), this.onNewLine = e;
|
|
3828
3876
|
}
|
|
3829
3877
|
/**
|
|
3830
3878
|
* Parse `source` as a YAML stream.
|
|
@@ -3848,7 +3896,7 @@ class Tn {
|
|
|
3848
3896
|
this.atScalar = !1, yield* this.step(), this.offset += e.length;
|
|
3849
3897
|
return;
|
|
3850
3898
|
}
|
|
3851
|
-
const t =
|
|
3899
|
+
const t = An(e);
|
|
3852
3900
|
if (t)
|
|
3853
3901
|
if (t === "scalar")
|
|
3854
3902
|
this.atNewLine = !1, this.atScalar = !0, this.type = "scalar";
|
|
@@ -4141,7 +4189,7 @@ class Tn {
|
|
|
4141
4189
|
indent: this.indent,
|
|
4142
4190
|
items: [{ start: r, key: null, sep: [this.sourceToken] }]
|
|
4143
4191
|
});
|
|
4144
|
-
else if (
|
|
4192
|
+
else if (ds(t.key) && !V(t.sep, "newline")) {
|
|
4145
4193
|
const o = z(t.start), l = t.key, a = t.sep;
|
|
4146
4194
|
a.push(this.sourceToken), delete t.key, delete t.sep, this.stack.push({
|
|
4147
4195
|
type: "block-map",
|
|
@@ -4397,12 +4445,12 @@ class Tn {
|
|
|
4397
4445
|
}
|
|
4398
4446
|
}
|
|
4399
4447
|
}
|
|
4400
|
-
function
|
|
4448
|
+
function vn(s) {
|
|
4401
4449
|
const e = s.prettyErrors !== !1;
|
|
4402
|
-
return { lineCounter: s.lineCounter || e && new
|
|
4450
|
+
return { lineCounter: s.lineCounter || e && new Ln() || null, prettyErrors: e };
|
|
4403
4451
|
}
|
|
4404
|
-
function
|
|
4405
|
-
const { lineCounter: t, prettyErrors: n } =
|
|
4452
|
+
function Cn(s, e = {}) {
|
|
4453
|
+
const { lineCounter: t, prettyErrors: n } = vn(e), i = new $n(t?.addNewLine), r = new On(e);
|
|
4406
4454
|
let o = null;
|
|
4407
4455
|
for (const l of r.compose(i.parse(s), !0, s.length))
|
|
4408
4456
|
if (!o)
|
|
@@ -4413,73 +4461,26 @@ function In(s, e = {}) {
|
|
|
4413
4461
|
}
|
|
4414
4462
|
return n && t && (o.errors.forEach(At(s, t)), o.warnings.forEach(At(s, t))), o;
|
|
4415
4463
|
}
|
|
4416
|
-
function
|
|
4464
|
+
function _n(s, e, t) {
|
|
4417
4465
|
let n;
|
|
4418
|
-
const i =
|
|
4466
|
+
const i = Cn(s, t);
|
|
4419
4467
|
if (!i)
|
|
4420
4468
|
return null;
|
|
4421
|
-
if (i.warnings.forEach((r) =>
|
|
4469
|
+
if (i.warnings.forEach((r) => Ut(i.options.logLevel, r)), i.errors.length > 0) {
|
|
4422
4470
|
if (i.options.logLevel !== "silent")
|
|
4423
4471
|
throw i.errors[0];
|
|
4424
4472
|
i.errors = [];
|
|
4425
4473
|
}
|
|
4426
4474
|
return i.toJS(Object.assign({ reviver: n }, t));
|
|
4427
4475
|
}
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
Usage:
|
|
4431
|
-
on --port <port> [--host <host>] [--config <path>]
|
|
4432
|
-
|
|
4433
|
-
Options:
|
|
4434
|
-
--port, -p HTTP port for incoming webhooks (required)
|
|
4435
|
-
--host, -H Host binding for the HTTP server (default: 127.0.0.1)
|
|
4436
|
-
--config, -c Path to a YAML/JSON config file
|
|
4437
|
-
--help, -h Show this help message
|
|
4438
|
-
`;
|
|
4439
|
-
async function vn(s) {
|
|
4440
|
-
const e = [];
|
|
4441
|
-
for await (const t of s)
|
|
4442
|
-
e.push(Buffer.isBuffer(t) ? t : Buffer.from(t));
|
|
4443
|
-
return Buffer.concat(e).toString("utf8");
|
|
4444
|
-
}
|
|
4445
|
-
function He(s, e, t) {
|
|
4446
|
-
s.statusCode = e, s.setHeader("content-type", "application/json"), s.end(JSON.stringify(t));
|
|
4447
|
-
}
|
|
4448
|
-
function Cn(s) {
|
|
4476
|
+
function Bn(s) {
|
|
4449
4477
|
return bt.isAbsolute(s) ? s : bt.resolve(process.cwd(), s);
|
|
4450
4478
|
}
|
|
4451
|
-
async function
|
|
4479
|
+
async function Mn(s) {
|
|
4452
4480
|
if (!s)
|
|
4453
4481
|
return {};
|
|
4454
|
-
const e =
|
|
4455
|
-
return e.endsWith(".yaml") || e.endsWith(".yml") ?
|
|
4456
|
-
}
|
|
4457
|
-
function Bn(s) {
|
|
4458
|
-
const e = Number.parseInt(s, 10);
|
|
4459
|
-
if (!Number.isInteger(e) || e < 0 || e > 65535)
|
|
4460
|
-
throw new Error(`Invalid --port value '${s}'. Expected an integer from 0 to 65535.`);
|
|
4461
|
-
return e;
|
|
4462
|
-
}
|
|
4463
|
-
function gt(s) {
|
|
4464
|
-
if (!s || typeof s != "object" || Array.isArray(s))
|
|
4465
|
-
throw new Error("Incoming webhook payload must be a JSON object.");
|
|
4466
|
-
return s;
|
|
4467
|
-
}
|
|
4468
|
-
function ds(s, e) {
|
|
4469
|
-
const n = e.trim().replace(/^\$\{/, "").replace(/}$/, "").split(".").filter(Boolean);
|
|
4470
|
-
let i = s;
|
|
4471
|
-
for (const r of n) {
|
|
4472
|
-
if (typeof i != "object" || i === null || !(r in i))
|
|
4473
|
-
return;
|
|
4474
|
-
i = i[r];
|
|
4475
|
-
}
|
|
4476
|
-
return i;
|
|
4477
|
-
}
|
|
4478
|
-
function Mn(s, e) {
|
|
4479
|
-
return s.replace(/\$\{([^}]+)}/g, (t, n) => {
|
|
4480
|
-
const i = ds(e, n);
|
|
4481
|
-
return i == null ? "" : String(i);
|
|
4482
|
-
});
|
|
4482
|
+
const e = Bn(s), t = await et(e, "utf8");
|
|
4483
|
+
return e.endsWith(".yaml") || e.endsWith(".yml") ? _n(t) ?? {} : JSON.parse(t);
|
|
4483
4484
|
}
|
|
4484
4485
|
function Pn(s) {
|
|
4485
4486
|
return s.split(/\r?\n/u).map((e) => e.trim()).filter((e) => e.length > 0 && !e.startsWith("#")).reduce((e, t) => {
|
|
@@ -4497,7 +4498,7 @@ async function jn(s) {
|
|
|
4497
4498
|
for (const t of s ?? []) {
|
|
4498
4499
|
const n = await et(t, "utf8");
|
|
4499
4500
|
if (t.endsWith(".json")) {
|
|
4500
|
-
const i =
|
|
4501
|
+
const i = tt(JSON.parse(n));
|
|
4501
4502
|
for (const [r, o] of Object.entries(i))
|
|
4502
4503
|
o != null && (e[r] = String(o));
|
|
4503
4504
|
continue;
|
|
@@ -4506,16 +4507,17 @@ async function jn(s) {
|
|
|
4506
4507
|
}
|
|
4507
4508
|
return e;
|
|
4508
4509
|
}
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
|
|
4510
|
+
const Kn = `on - daemonized webhook runner
|
|
4511
|
+
|
|
4512
|
+
Usage:
|
|
4513
|
+
on --port <port> [--host <host>] [--config <path>]
|
|
4514
|
+
|
|
4515
|
+
Options:
|
|
4516
|
+
--port, -p HTTP port for incoming webhooks (required)
|
|
4517
|
+
--host, -H Host binding for the HTTP server (default: 127.0.0.1)
|
|
4518
|
+
--config, -c Path to a YAML/JSON config file
|
|
4519
|
+
--help, -h Show this help message
|
|
4520
|
+
`;
|
|
4519
4521
|
async function Dn(s, e) {
|
|
4520
4522
|
await new Promise((t, n) => {
|
|
4521
4523
|
const i = ys(s, {
|
|
@@ -4534,24 +4536,30 @@ async function Dn(s, e) {
|
|
|
4534
4536
|
}
|
|
4535
4537
|
async function ps(s, e) {
|
|
4536
4538
|
if (typeof s.source != "string" || typeof s.event != "string")
|
|
4537
|
-
throw new Error(
|
|
4539
|
+
throw new Error(
|
|
4540
|
+
"Incoming payload must include string fields 'source' and 'event'."
|
|
4541
|
+
);
|
|
4538
4542
|
const t = e.on?.[s.source]?.[s.event];
|
|
4539
4543
|
if (!t)
|
|
4540
|
-
throw new Error(
|
|
4541
|
-
|
|
4544
|
+
throw new Error(
|
|
4545
|
+
`No workflow configured for source '${s.source}' and event '${s.event}'.`
|
|
4546
|
+
);
|
|
4547
|
+
const n = Ss({ ...s }, t.mappings), i = await jn(t.secrets), r = {
|
|
4542
4548
|
...process.env,
|
|
4543
|
-
...Object.fromEntries(
|
|
4549
|
+
...Object.fromEntries(
|
|
4550
|
+
Object.entries(i).map(([l, a]) => [l, String(a)])
|
|
4551
|
+
)
|
|
4544
4552
|
}, o = {
|
|
4545
4553
|
inputs: n,
|
|
4546
4554
|
secrets: i
|
|
4547
4555
|
};
|
|
4548
4556
|
for (const [l, a] of Object.entries(t.env ?? {}))
|
|
4549
|
-
r[l] =
|
|
4557
|
+
r[l] = ks(a, o);
|
|
4550
4558
|
t.defaults?.image && (r.ON_DEFAULT_IMAGE = t.defaults.image), t.defaults?.volumes && (r.ON_DEFAULT_VOLUMES = JSON.stringify(t.defaults.volumes)), t.defaults?.args && (r.ON_DEFAULT_ARGS = JSON.stringify(t.defaults.args));
|
|
4551
4559
|
for (const l of t.steps ?? [])
|
|
4552
4560
|
await Dn(l, r);
|
|
4553
4561
|
for (const l of t.dispatch ?? []) {
|
|
4554
|
-
const a = await et(l, "utf8"), c =
|
|
4562
|
+
const a = await et(l, "utf8"), c = tt(JSON.parse(a));
|
|
4555
4563
|
await ps(c, e);
|
|
4556
4564
|
}
|
|
4557
4565
|
}
|
|
@@ -4567,38 +4575,42 @@ function qn(s) {
|
|
|
4567
4575
|
allowPositionals: !1
|
|
4568
4576
|
});
|
|
4569
4577
|
if (e.help)
|
|
4570
|
-
return console.log(
|
|
4578
|
+
return console.log(Kn), null;
|
|
4571
4579
|
if (!e.port)
|
|
4572
4580
|
throw new Error("Missing required option --port.");
|
|
4573
4581
|
return {
|
|
4574
|
-
port:
|
|
4582
|
+
port: ws(e.port),
|
|
4575
4583
|
host: e.host,
|
|
4576
4584
|
configPath: e.config
|
|
4577
4585
|
};
|
|
4578
4586
|
}
|
|
4579
4587
|
async function Un(s) {
|
|
4580
|
-
const e = await
|
|
4588
|
+
const e = await Mn(s.configPath), t = ms(async (i, r) => {
|
|
4581
4589
|
if (i.method !== "POST") {
|
|
4582
|
-
|
|
4590
|
+
Fe(r, 405, { error: "Only POST webhooks are supported." });
|
|
4583
4591
|
return;
|
|
4584
4592
|
}
|
|
4585
4593
|
try {
|
|
4586
|
-
const o = await
|
|
4587
|
-
|
|
4594
|
+
const o = await bs(i), l = tt(
|
|
4595
|
+
o.length > 0 ? JSON.parse(o) : {}
|
|
4596
|
+
);
|
|
4597
|
+
await ps(l, e), Fe(r, 202, {
|
|
4588
4598
|
status: "accepted",
|
|
4589
4599
|
source: l.source,
|
|
4590
4600
|
event: l.event
|
|
4591
4601
|
});
|
|
4592
4602
|
} catch (o) {
|
|
4593
4603
|
const l = o instanceof Error ? o.message : "Unknown error";
|
|
4594
|
-
|
|
4604
|
+
Fe(r, 400, { error: l });
|
|
4595
4605
|
}
|
|
4596
4606
|
});
|
|
4597
4607
|
await new Promise((i, r) => {
|
|
4598
4608
|
t.once("error", r), t.listen(s.port, s.host, () => i());
|
|
4599
4609
|
});
|
|
4600
4610
|
const n = t.address();
|
|
4601
|
-
return n && typeof n == "object" && console.log(
|
|
4611
|
+
return n && typeof n == "object" && console.log(
|
|
4612
|
+
`on daemon listening on http://${n.address}:${n.port}`
|
|
4613
|
+
), t;
|
|
4602
4614
|
}
|
|
4603
4615
|
async function Fn() {
|
|
4604
4616
|
try {
|
|
@@ -4613,7 +4625,7 @@ async function Fn() {
|
|
|
4613
4625
|
console.error(`on: ${e}`), process.exitCode = 1;
|
|
4614
4626
|
}
|
|
4615
4627
|
}
|
|
4616
|
-
|
|
4628
|
+
Fn();
|
|
4617
4629
|
export {
|
|
4618
4630
|
Fn as main,
|
|
4619
4631
|
qn as parseCliOptions,
|