@cloud-cli/on 0.1.6 → 0.1.9
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/README.md +180 -0
- package/dist/on.js +667 -635
- package/package.json +1 -1
package/dist/on.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { parseArgs as As } from "node:util";
|
|
3
|
-
import { createServer as
|
|
4
|
-
import { readFile as
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { tmpdir as
|
|
9
|
-
import { join as
|
|
10
|
-
import { randomUUID as
|
|
11
|
-
function
|
|
3
|
+
import { createServer as $s } from "node:http";
|
|
4
|
+
import { stat as Ls, readdir as Cs, readFile as Be, writeFile as js, mkdtemp as Bs, rm as Ms } from "node:fs/promises";
|
|
5
|
+
import ze, { join as rt } from "node:path";
|
|
6
|
+
import { existsSync as Ft, mkdirSync as Ds } from "node:fs";
|
|
7
|
+
import { spawn as ot } from "node:child_process";
|
|
8
|
+
import { tmpdir as qt } from "node:os";
|
|
9
|
+
import { join as Ps } from "node:path/posix";
|
|
10
|
+
import { randomUUID as xs } from "node:crypto";
|
|
11
|
+
function Ne(s, e, t) {
|
|
12
12
|
s.writeHead(e, { "content-type": "application/json" }).end(JSON.stringify(t));
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function Ks(s) {
|
|
15
15
|
const e = Number.parseInt(s, 10);
|
|
16
16
|
if (!Number.isInteger(e) || e < 0 || e > 65535)
|
|
17
17
|
throw new Error(
|
|
@@ -19,48 +19,48 @@ function Ds(s) {
|
|
|
19
19
|
);
|
|
20
20
|
return e;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function lt(s) {
|
|
23
23
|
if (!s || typeof s != "object" || Array.isArray(s))
|
|
24
24
|
throw new Error("Incoming webhook payload must be a JSON object.");
|
|
25
25
|
return s;
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function Vt(s) {
|
|
28
28
|
return typeof s == "object" && s !== null ? new Proxy(s, {
|
|
29
29
|
get(e, t) {
|
|
30
30
|
const n = Reflect.get(e, t);
|
|
31
|
-
return typeof n == "object" && n !== null ?
|
|
31
|
+
return typeof n == "object" && n !== null ? Vt(n) : t === "toString" ? () => "'" + JSON.stringify(e) + "'" : n;
|
|
32
32
|
}
|
|
33
33
|
}) : s ?? "";
|
|
34
34
|
}
|
|
35
|
-
function
|
|
36
|
-
const t = Function(
|
|
35
|
+
function be(s, e) {
|
|
36
|
+
const t = Object.keys(e), n = Function(
|
|
37
37
|
"context",
|
|
38
|
-
"const {
|
|
38
|
+
"const { " + t.join(", ") + " } = context;return `" + s + "`;"
|
|
39
39
|
);
|
|
40
|
-
return String(
|
|
40
|
+
return String(n(e) || "");
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function Rs(s, e) {
|
|
43
43
|
if (!e)
|
|
44
44
|
return { ...s };
|
|
45
45
|
const t = { inputs: s };
|
|
46
46
|
for (const [n, i] of Object.entries(e))
|
|
47
|
-
t.inputs[n] =
|
|
47
|
+
t.inputs[n] = be(`\${${i}}`, t);
|
|
48
48
|
return t.inputs;
|
|
49
49
|
}
|
|
50
|
-
const
|
|
51
|
-
function
|
|
50
|
+
const at = /* @__PURE__ */ Symbol.for("yaml.alias"), Ze = /* @__PURE__ */ Symbol.for("yaml.document"), J = /* @__PURE__ */ Symbol.for("yaml.map"), Jt = /* @__PURE__ */ Symbol.for("yaml.pair"), R = /* @__PURE__ */ Symbol.for("yaml.scalar"), le = /* @__PURE__ */ Symbol.for("yaml.seq"), P = /* @__PURE__ */ Symbol.for("yaml.node.type"), Q = (s) => !!s && typeof s == "object" && s[P] === at, Me = (s) => !!s && typeof s == "object" && s[P] === Ze, we = (s) => !!s && typeof s == "object" && s[P] === J, $ = (s) => !!s && typeof s == "object" && s[P] === Jt, v = (s) => !!s && typeof s == "object" && s[P] === R, Se = (s) => !!s && typeof s == "object" && s[P] === le;
|
|
51
|
+
function I(s) {
|
|
52
52
|
if (s && typeof s == "object")
|
|
53
|
-
switch (s[
|
|
53
|
+
switch (s[P]) {
|
|
54
54
|
case J:
|
|
55
55
|
case le:
|
|
56
56
|
return !0;
|
|
57
57
|
}
|
|
58
58
|
return !1;
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function A(s) {
|
|
61
61
|
if (s && typeof s == "object")
|
|
62
|
-
switch (s[
|
|
63
|
-
case
|
|
62
|
+
switch (s[P]) {
|
|
63
|
+
case at:
|
|
64
64
|
case J:
|
|
65
65
|
case R:
|
|
66
66
|
case le:
|
|
@@ -68,20 +68,20 @@ function v(s) {
|
|
|
68
68
|
}
|
|
69
69
|
return !1;
|
|
70
70
|
}
|
|
71
|
-
const
|
|
71
|
+
const Yt = (s) => (v(s) || I(s)) && !!s.anchor, Y = /* @__PURE__ */ Symbol("break visit"), Us = /* @__PURE__ */ Symbol("skip children"), pe = /* @__PURE__ */ Symbol("remove node");
|
|
72
72
|
function ae(s, e) {
|
|
73
|
-
const t =
|
|
74
|
-
|
|
73
|
+
const t = Fs(e);
|
|
74
|
+
Me(s) ? ee(null, s.contents, t, Object.freeze([s])) === pe && (s.contents = null) : ee(null, s, t, Object.freeze([]));
|
|
75
75
|
}
|
|
76
76
|
ae.BREAK = Y;
|
|
77
|
-
ae.SKIP =
|
|
77
|
+
ae.SKIP = Us;
|
|
78
78
|
ae.REMOVE = pe;
|
|
79
79
|
function ee(s, e, t, n) {
|
|
80
|
-
const i =
|
|
81
|
-
if (
|
|
82
|
-
return
|
|
80
|
+
const i = qs(s, e, t, n);
|
|
81
|
+
if (A(i) || $(i))
|
|
82
|
+
return Vs(s, n, i), ee(s, i, t, n);
|
|
83
83
|
if (typeof i != "symbol") {
|
|
84
|
-
if (
|
|
84
|
+
if (I(e)) {
|
|
85
85
|
n = Object.freeze(n.concat(e));
|
|
86
86
|
for (let r = 0; r < e.items.length; ++r) {
|
|
87
87
|
const o = ee(r, e.items[r], t, n);
|
|
@@ -107,7 +107,7 @@ function ee(s, e, t, n) {
|
|
|
107
107
|
}
|
|
108
108
|
return i;
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function Fs(s) {
|
|
111
111
|
return typeof s == "object" && (s.Collection || s.Node || s.Value) ? Object.assign({
|
|
112
112
|
Alias: s.Node,
|
|
113
113
|
Map: s.Node,
|
|
@@ -122,41 +122,41 @@ function Rs(s) {
|
|
|
122
122
|
Seq: s.Collection
|
|
123
123
|
}, s) : s;
|
|
124
124
|
}
|
|
125
|
-
function
|
|
125
|
+
function qs(s, e, t, n) {
|
|
126
126
|
if (typeof t == "function")
|
|
127
127
|
return t(s, e, n);
|
|
128
|
-
if (be(e))
|
|
129
|
-
return t.Map?.(s, e, n);
|
|
130
128
|
if (we(e))
|
|
129
|
+
return t.Map?.(s, e, n);
|
|
130
|
+
if (Se(e))
|
|
131
131
|
return t.Seq?.(s, e, n);
|
|
132
132
|
if ($(e))
|
|
133
133
|
return t.Pair?.(s, e, n);
|
|
134
|
-
if (
|
|
134
|
+
if (v(e))
|
|
135
135
|
return t.Scalar?.(s, e, n);
|
|
136
136
|
if (Q(e))
|
|
137
137
|
return t.Alias?.(s, e, n);
|
|
138
138
|
}
|
|
139
|
-
function
|
|
139
|
+
function Vs(s, e, t) {
|
|
140
140
|
const n = e[e.length - 1];
|
|
141
|
-
if (
|
|
141
|
+
if (I(n))
|
|
142
142
|
n.items[s] = t;
|
|
143
143
|
else if ($(n))
|
|
144
144
|
s === "key" ? n.key = t : n.value = t;
|
|
145
|
-
else if (
|
|
145
|
+
else if (Me(n))
|
|
146
146
|
n.contents = t;
|
|
147
147
|
else {
|
|
148
148
|
const i = Q(n) ? "alias" : "scalar";
|
|
149
149
|
throw new Error(`Cannot replace node with ${i} parent`);
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
|
-
const
|
|
152
|
+
const Js = {
|
|
153
153
|
"!": "%21",
|
|
154
154
|
",": "%2C",
|
|
155
155
|
"[": "%5B",
|
|
156
156
|
"]": "%5D",
|
|
157
157
|
"{": "%7B",
|
|
158
158
|
"}": "%7D"
|
|
159
|
-
},
|
|
159
|
+
}, Ys = (s) => s.replace(/[!,[\]{}]/g, (e) => Js[e]);
|
|
160
160
|
class j {
|
|
161
161
|
constructor(e, t) {
|
|
162
162
|
this.docStart = null, this.docEnd = !1, this.yaml = Object.assign({}, j.defaultYaml, e), this.tags = Object.assign({}, j.defaultTags, t);
|
|
@@ -246,16 +246,16 @@ class j {
|
|
|
246
246
|
tagString(e) {
|
|
247
247
|
for (const [t, n] of Object.entries(this.tags))
|
|
248
248
|
if (e.startsWith(n))
|
|
249
|
-
return t +
|
|
249
|
+
return t + Ys(e.substring(n.length));
|
|
250
250
|
return e[0] === "!" ? e : `!<${e}>`;
|
|
251
251
|
}
|
|
252
252
|
toString(e) {
|
|
253
253
|
const t = this.yaml.explicit ? [`%YAML ${this.yaml.version || "1.2"}`] : [], n = Object.entries(this.tags);
|
|
254
254
|
let i;
|
|
255
|
-
if (e && n.length > 0 &&
|
|
255
|
+
if (e && n.length > 0 && A(e.contents)) {
|
|
256
256
|
const r = {};
|
|
257
257
|
ae(e.contents, (o, l) => {
|
|
258
|
-
|
|
258
|
+
A(l) && l.tag && (r[l.tag] = !0);
|
|
259
259
|
}), i = Object.keys(r);
|
|
260
260
|
} else
|
|
261
261
|
i = [];
|
|
@@ -267,14 +267,14 @@ class j {
|
|
|
267
267
|
}
|
|
268
268
|
j.defaultYaml = { explicit: !1, version: "1.2" };
|
|
269
269
|
j.defaultTags = { "!!": "tag:yaml.org,2002:" };
|
|
270
|
-
function
|
|
270
|
+
function Gt(s) {
|
|
271
271
|
if (/[\x00-\x19\s,[\]{}]/.test(s)) {
|
|
272
272
|
const t = `Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;
|
|
273
273
|
throw new Error(t);
|
|
274
274
|
}
|
|
275
275
|
return !0;
|
|
276
276
|
}
|
|
277
|
-
function
|
|
277
|
+
function Ht(s) {
|
|
278
278
|
const e = /* @__PURE__ */ new Set();
|
|
279
279
|
return ae(s, {
|
|
280
280
|
Value(t, n) {
|
|
@@ -282,20 +282,20 @@ function Gt(s) {
|
|
|
282
282
|
}
|
|
283
283
|
}), e;
|
|
284
284
|
}
|
|
285
|
-
function
|
|
285
|
+
function Wt(s, e) {
|
|
286
286
|
for (let t = 1; ; ++t) {
|
|
287
287
|
const n = `${s}${t}`;
|
|
288
288
|
if (!e.has(n))
|
|
289
289
|
return n;
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
|
-
function
|
|
292
|
+
function Gs(s, e) {
|
|
293
293
|
const t = [], n = /* @__PURE__ */ new Map();
|
|
294
294
|
let i = null;
|
|
295
295
|
return {
|
|
296
296
|
onAnchor: (r) => {
|
|
297
|
-
t.push(r), i ?? (i =
|
|
298
|
-
const o =
|
|
297
|
+
t.push(r), i ?? (i = Ht(s));
|
|
298
|
+
const o = Wt(e, i);
|
|
299
299
|
return i.add(o), o;
|
|
300
300
|
},
|
|
301
301
|
/**
|
|
@@ -306,7 +306,7 @@ function Js(s, e) {
|
|
|
306
306
|
setAnchors: () => {
|
|
307
307
|
for (const r of t) {
|
|
308
308
|
const o = n.get(r);
|
|
309
|
-
if (typeof o == "object" && o.anchor && (
|
|
309
|
+
if (typeof o == "object" && o.anchor && (v(o.node) || I(o.node)))
|
|
310
310
|
o.node.anchor = o.anchor;
|
|
311
311
|
else {
|
|
312
312
|
const l = new Error("Failed to resolve repeated object (this should not happen)");
|
|
@@ -341,11 +341,11 @@ function te(s, e, t, n) {
|
|
|
341
341
|
}
|
|
342
342
|
return s.call(e, t, n);
|
|
343
343
|
}
|
|
344
|
-
function
|
|
344
|
+
function D(s, e, t) {
|
|
345
345
|
if (Array.isArray(s))
|
|
346
|
-
return s.map((n, i) =>
|
|
346
|
+
return s.map((n, i) => D(n, String(i), t));
|
|
347
347
|
if (s && typeof s.toJSON == "function") {
|
|
348
|
-
if (!t || !
|
|
348
|
+
if (!t || !Yt(s))
|
|
349
349
|
return s.toJSON(e, t);
|
|
350
350
|
const n = { aliasCount: 0, count: 1, res: void 0 };
|
|
351
351
|
t.anchors.set(s, n), t.onCreate = (r) => {
|
|
@@ -356,9 +356,9 @@ function P(s, e, t) {
|
|
|
356
356
|
}
|
|
357
357
|
return typeof s == "bigint" && !t?.keep ? Number(s) : s;
|
|
358
358
|
}
|
|
359
|
-
class
|
|
359
|
+
class ct {
|
|
360
360
|
constructor(e) {
|
|
361
|
-
Object.defineProperty(this,
|
|
361
|
+
Object.defineProperty(this, P, { value: e });
|
|
362
362
|
}
|
|
363
363
|
/** Create a copy of this node. */
|
|
364
364
|
clone() {
|
|
@@ -367,7 +367,7 @@ class lt {
|
|
|
367
367
|
}
|
|
368
368
|
/** A plain JavaScript representation of this node. */
|
|
369
369
|
toJS(e, { mapAsMap: t, maxAliasCount: n, onAnchor: i, reviver: r } = {}) {
|
|
370
|
-
if (!
|
|
370
|
+
if (!Me(e))
|
|
371
371
|
throw new TypeError("A document argument is required");
|
|
372
372
|
const o = {
|
|
373
373
|
anchors: /* @__PURE__ */ new Map(),
|
|
@@ -376,16 +376,16 @@ class lt {
|
|
|
376
376
|
mapAsMap: t === !0,
|
|
377
377
|
mapKeyWarned: !1,
|
|
378
378
|
maxAliasCount: typeof n == "number" ? n : 100
|
|
379
|
-
}, l =
|
|
379
|
+
}, l = D(this, "", o);
|
|
380
380
|
if (typeof i == "function")
|
|
381
381
|
for (const { count: a, res: c } of o.anchors.values())
|
|
382
382
|
i(c, a);
|
|
383
383
|
return typeof r == "function" ? te(r, { "": l }, "", l) : l;
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
|
-
class
|
|
386
|
+
class ft extends ct {
|
|
387
387
|
constructor(e) {
|
|
388
|
-
super(
|
|
388
|
+
super(at), this.source = e, Object.defineProperty(this, "tag", {
|
|
389
389
|
set() {
|
|
390
390
|
throw new Error("Alias nodes cannot have tags");
|
|
391
391
|
}
|
|
@@ -399,7 +399,7 @@ class at extends lt {
|
|
|
399
399
|
let n;
|
|
400
400
|
t?.aliasResolveCache ? n = t.aliasResolveCache : (n = [], ae(e, {
|
|
401
401
|
Node: (r, o) => {
|
|
402
|
-
(Q(o) ||
|
|
402
|
+
(Q(o) || Yt(o)) && n.push(o);
|
|
403
403
|
}
|
|
404
404
|
}), t && (t.aliasResolveCache = n));
|
|
405
405
|
let i;
|
|
@@ -419,7 +419,7 @@ class at extends lt {
|
|
|
419
419
|
throw new ReferenceError(a);
|
|
420
420
|
}
|
|
421
421
|
let l = n.get(o);
|
|
422
|
-
if (l || (
|
|
422
|
+
if (l || (D(o, null, t), l = n.get(o)), l?.res === void 0) {
|
|
423
423
|
const a = "This should not happen: Alias anchor was not resolved?";
|
|
424
424
|
throw new ReferenceError(a);
|
|
425
425
|
}
|
|
@@ -432,7 +432,7 @@ class at extends lt {
|
|
|
432
432
|
toString(e, t, n) {
|
|
433
433
|
const i = `*${this.source}`;
|
|
434
434
|
if (e) {
|
|
435
|
-
if (
|
|
435
|
+
if (Gt(this.source), e.options.verifyAliasOrder && !e.anchors.has(this.source)) {
|
|
436
436
|
const r = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
|
|
437
437
|
throw new Error(r);
|
|
438
438
|
}
|
|
@@ -446,7 +446,7 @@ function Ae(s, e, t) {
|
|
|
446
446
|
if (Q(e)) {
|
|
447
447
|
const n = e.resolve(s), i = t && n && t.get(n);
|
|
448
448
|
return i ? i.count * i.aliasCount : 0;
|
|
449
|
-
} else if (
|
|
449
|
+
} else if (I(e)) {
|
|
450
450
|
let n = 0;
|
|
451
451
|
for (const i of e.items) {
|
|
452
452
|
const r = Ae(s, i, t);
|
|
@@ -459,13 +459,13 @@ function Ae(s, e, t) {
|
|
|
459
459
|
}
|
|
460
460
|
return 1;
|
|
461
461
|
}
|
|
462
|
-
const
|
|
463
|
-
class N extends
|
|
462
|
+
const Qt = (s) => !s || typeof s != "function" && typeof s != "object";
|
|
463
|
+
class N extends ct {
|
|
464
464
|
constructor(e) {
|
|
465
465
|
super(R), this.value = e;
|
|
466
466
|
}
|
|
467
467
|
toJSON(e, t) {
|
|
468
|
-
return t?.keep ? this.value :
|
|
468
|
+
return t?.keep ? this.value : D(this.value, e, t);
|
|
469
469
|
}
|
|
470
470
|
toString() {
|
|
471
471
|
return String(this.value);
|
|
@@ -476,8 +476,8 @@ N.BLOCK_LITERAL = "BLOCK_LITERAL";
|
|
|
476
476
|
N.PLAIN = "PLAIN";
|
|
477
477
|
N.QUOTE_DOUBLE = "QUOTE_DOUBLE";
|
|
478
478
|
N.QUOTE_SINGLE = "QUOTE_SINGLE";
|
|
479
|
-
const
|
|
480
|
-
function
|
|
479
|
+
const Hs = "tag:yaml.org,2002:";
|
|
480
|
+
function Ws(s, e, t) {
|
|
481
481
|
if (e) {
|
|
482
482
|
const n = t.filter((r) => r.tag === e), i = n.find((r) => !r.format) ?? n[0];
|
|
483
483
|
if (!i)
|
|
@@ -487,7 +487,7 @@ function Gs(s, e, t) {
|
|
|
487
487
|
return t.find((n) => n.identify?.(s) && !n.format);
|
|
488
488
|
}
|
|
489
489
|
function ge(s, e, t) {
|
|
490
|
-
if (
|
|
490
|
+
if (Me(s) && (s = s.contents), A(s))
|
|
491
491
|
return s;
|
|
492
492
|
if ($(s)) {
|
|
493
493
|
const u = t.schema[J].createNode?.(t.schema, null, t);
|
|
@@ -498,11 +498,11 @@ function ge(s, e, t) {
|
|
|
498
498
|
let a;
|
|
499
499
|
if (n && s && typeof s == "object") {
|
|
500
500
|
if (a = l.get(s), a)
|
|
501
|
-
return a.anchor ?? (a.anchor = i(s)), new
|
|
501
|
+
return a.anchor ?? (a.anchor = i(s)), new ft(a.anchor);
|
|
502
502
|
a = { anchor: null, node: null }, l.set(s, a);
|
|
503
503
|
}
|
|
504
|
-
e?.startsWith("!!") && (e =
|
|
505
|
-
let c =
|
|
504
|
+
e?.startsWith("!!") && (e = Hs + e.slice(2));
|
|
505
|
+
let c = Ws(s, e, o.tags);
|
|
506
506
|
if (!c) {
|
|
507
507
|
if (s && typeof s.toJSON == "function" && (s = s.toJSON()), !s || typeof s != "object") {
|
|
508
508
|
const u = new N(s);
|
|
@@ -514,7 +514,7 @@ function ge(s, e, t) {
|
|
|
514
514
|
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);
|
|
515
515
|
return e ? d.tag = e : c.default || (d.tag = c.tag), a && (a.node = d), d;
|
|
516
516
|
}
|
|
517
|
-
function
|
|
517
|
+
function Ce(s, e, t) {
|
|
518
518
|
let n = t;
|
|
519
519
|
for (let i = e.length - 1; i >= 0; --i) {
|
|
520
520
|
const r = e[i];
|
|
@@ -535,7 +535,7 @@ function Le(s, e, t) {
|
|
|
535
535
|
});
|
|
536
536
|
}
|
|
537
537
|
const he = (s) => s == null || typeof s == "object" && !!s[Symbol.iterator]().next().done;
|
|
538
|
-
class
|
|
538
|
+
class Xt extends ct {
|
|
539
539
|
constructor(e, t) {
|
|
540
540
|
super(e), Object.defineProperty(this, "schema", {
|
|
541
541
|
value: t,
|
|
@@ -551,7 +551,7 @@ class Qt extends lt {
|
|
|
551
551
|
*/
|
|
552
552
|
clone(e) {
|
|
553
553
|
const t = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
|
|
554
|
-
return e && (t.schema = e), t.items = t.items.map((n) =>
|
|
554
|
+
return e && (t.schema = e), t.items = t.items.map((n) => A(n) || $(n) ? n.clone(e) : n), this.range && (t.range = this.range.slice()), t;
|
|
555
555
|
}
|
|
556
556
|
/**
|
|
557
557
|
* Adds a value to the collection. For `!!map` and `!!omap` the value must
|
|
@@ -563,10 +563,10 @@ class Qt extends lt {
|
|
|
563
563
|
this.add(t);
|
|
564
564
|
else {
|
|
565
565
|
const [n, ...i] = e, r = this.get(n, !0);
|
|
566
|
-
if (
|
|
566
|
+
if (I(r))
|
|
567
567
|
r.addIn(i, t);
|
|
568
568
|
else if (r === void 0 && this.schema)
|
|
569
|
-
this.set(n,
|
|
569
|
+
this.set(n, Ce(this.schema, i, t));
|
|
570
570
|
else
|
|
571
571
|
throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`);
|
|
572
572
|
}
|
|
@@ -580,7 +580,7 @@ class Qt extends lt {
|
|
|
580
580
|
if (n.length === 0)
|
|
581
581
|
return this.delete(t);
|
|
582
582
|
const i = this.get(t, !0);
|
|
583
|
-
if (
|
|
583
|
+
if (I(i))
|
|
584
584
|
return i.deleteIn(n);
|
|
585
585
|
throw new Error(`Expected YAML collection at ${t}. Remaining path: ${n}`);
|
|
586
586
|
}
|
|
@@ -591,14 +591,14 @@ class Qt extends lt {
|
|
|
591
591
|
*/
|
|
592
592
|
getIn(e, t) {
|
|
593
593
|
const [n, ...i] = e, r = this.get(n, !0);
|
|
594
|
-
return i.length === 0 ? !t &&
|
|
594
|
+
return i.length === 0 ? !t && v(r) ? r.value : r : I(r) ? r.getIn(i, t) : void 0;
|
|
595
595
|
}
|
|
596
596
|
hasAllNullValues(e) {
|
|
597
597
|
return this.items.every((t) => {
|
|
598
598
|
if (!$(t))
|
|
599
599
|
return !1;
|
|
600
600
|
const n = t.value;
|
|
601
|
-
return n == null || e &&
|
|
601
|
+
return n == null || e && v(n) && n.value == null && !n.commentBefore && !n.comment && !n.tag;
|
|
602
602
|
});
|
|
603
603
|
}
|
|
604
604
|
/**
|
|
@@ -609,7 +609,7 @@ class Qt extends lt {
|
|
|
609
609
|
if (n.length === 0)
|
|
610
610
|
return this.has(t);
|
|
611
611
|
const i = this.get(t, !0);
|
|
612
|
-
return
|
|
612
|
+
return I(i) ? i.hasIn(n) : !1;
|
|
613
613
|
}
|
|
614
614
|
/**
|
|
615
615
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
@@ -621,24 +621,24 @@ class Qt extends lt {
|
|
|
621
621
|
this.set(n, t);
|
|
622
622
|
else {
|
|
623
623
|
const r = this.get(n, !0);
|
|
624
|
-
if (
|
|
624
|
+
if (I(r))
|
|
625
625
|
r.setIn(i, t);
|
|
626
626
|
else if (r === void 0 && this.schema)
|
|
627
|
-
this.set(n,
|
|
627
|
+
this.set(n, Ce(this.schema, i, t));
|
|
628
628
|
else
|
|
629
629
|
throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`);
|
|
630
630
|
}
|
|
631
631
|
}
|
|
632
632
|
}
|
|
633
|
-
const
|
|
633
|
+
const Qs = (s) => s.replace(/^(?!$)(?: $)?/gm, "#");
|
|
634
634
|
function U(s, e) {
|
|
635
635
|
return /^\n+$/.test(s) ? s.substring(1) : e ? s.replace(/^(?! *$)/gm, e) : s;
|
|
636
636
|
}
|
|
637
637
|
const G = (s, e, t) => s.endsWith(`
|
|
638
638
|
`) ? U(t, e) : t.includes(`
|
|
639
639
|
`) ? `
|
|
640
|
-
` + U(t, e) : (s.endsWith(" ") ? "" : " ") + t,
|
|
641
|
-
function
|
|
640
|
+
` + U(t, e) : (s.endsWith(" ") ? "" : " ") + t, zt = "flow", et = "block", $e = "quoted";
|
|
641
|
+
function De(s, e, t = "flow", { indentAtStart: n, lineWidth: i = 80, minContentWidth: r = 20, onFold: o, onOverflow: l } = {}) {
|
|
642
642
|
if (!i || i < 0)
|
|
643
643
|
return s;
|
|
644
644
|
i < r && (r = 0);
|
|
@@ -649,9 +649,9 @@ function Me(s, e, t = "flow", { indentAtStart: n, lineWidth: i = 80, minContentW
|
|
|
649
649
|
let u = i - e.length;
|
|
650
650
|
typeof n == "number" && (n > i - Math.max(2, r) ? c.push(0) : u = i - n);
|
|
651
651
|
let f, p, g = !1, h = -1, m = -1, b = -1;
|
|
652
|
-
t ===
|
|
652
|
+
t === et && (h = Et(s, h, e.length), h !== -1 && (u = h + a));
|
|
653
653
|
for (let S; S = s[h += 1]; ) {
|
|
654
|
-
if (t ===
|
|
654
|
+
if (t === $e && S === "\\") {
|
|
655
655
|
switch (m = h, s[h + 1]) {
|
|
656
656
|
case "x":
|
|
657
657
|
h += 3;
|
|
@@ -669,7 +669,7 @@ function Me(s, e, t = "flow", { indentAtStart: n, lineWidth: i = 80, minContentW
|
|
|
669
669
|
}
|
|
670
670
|
if (S === `
|
|
671
671
|
`)
|
|
672
|
-
t ===
|
|
672
|
+
t === et && (h = Et(s, h, e.length)), u = h + e.length + a, f = void 0;
|
|
673
673
|
else {
|
|
674
674
|
if (S === " " && p && p !== " " && p !== `
|
|
675
675
|
` && p !== " ") {
|
|
@@ -680,7 +680,7 @@ function Me(s, e, t = "flow", { indentAtStart: n, lineWidth: i = 80, minContentW
|
|
|
680
680
|
if (h >= u)
|
|
681
681
|
if (f)
|
|
682
682
|
c.push(f), u = f + a, f = void 0;
|
|
683
|
-
else if (t ===
|
|
683
|
+
else if (t === $e) {
|
|
684
684
|
for (; p === " " || p === " "; )
|
|
685
685
|
p = S, S = s[h += 1], g = !0;
|
|
686
686
|
const k = h > b + 1 ? h - 2 : m - 1;
|
|
@@ -699,12 +699,12 @@ function Me(s, e, t = "flow", { indentAtStart: n, lineWidth: i = 80, minContentW
|
|
|
699
699
|
for (let S = 0; S < c.length; ++S) {
|
|
700
700
|
const k = c[S], _ = c[S + 1] || s.length;
|
|
701
701
|
k === 0 ? w = `
|
|
702
|
-
${e}${s.slice(0, _)}` : (t ===
|
|
702
|
+
${e}${s.slice(0, _)}` : (t === $e && d[k] && (w += `${s[k]}\\`), w += `
|
|
703
703
|
${e}${s.slice(k + 1, _)}`);
|
|
704
704
|
}
|
|
705
705
|
return w;
|
|
706
706
|
}
|
|
707
|
-
function
|
|
707
|
+
function Et(s, e, t) {
|
|
708
708
|
let n = e, i = e + 1, r = s[i];
|
|
709
709
|
for (; r === " " || r === " "; )
|
|
710
710
|
if (e < i + t)
|
|
@@ -722,8 +722,8 @@ const Pe = (s, e) => ({
|
|
|
722
722
|
indentAtStart: e ? s.indent.length : s.indentAtStart,
|
|
723
723
|
lineWidth: s.options.lineWidth,
|
|
724
724
|
minContentWidth: s.options.minContentWidth
|
|
725
|
-
}),
|
|
726
|
-
function
|
|
725
|
+
}), xe = (s) => /^(%|---|\.\.\.)/m.test(s);
|
|
726
|
+
function Xs(s, e, t) {
|
|
727
727
|
if (!e || e < 0)
|
|
728
728
|
return !1;
|
|
729
729
|
const n = e - t, i = s.length;
|
|
@@ -743,7 +743,7 @@ function me(s, e) {
|
|
|
743
743
|
const t = JSON.stringify(s);
|
|
744
744
|
if (e.options.doubleQuotedAsJSON)
|
|
745
745
|
return t;
|
|
746
|
-
const { implicitKey: n } = e, i = e.options.doubleQuotedMinMultiLineLength, r = e.indent || (
|
|
746
|
+
const { implicitKey: n } = e, i = e.options.doubleQuotedMinMultiLineLength, r = e.indent || (xe(s) ? " " : "");
|
|
747
747
|
let o = "", l = 0;
|
|
748
748
|
for (let a = 0, c = t[a]; c; c = t[++a])
|
|
749
749
|
if (c === " " && t[a + 1] === "\\" && t[a + 2] === "n" && (o += t.slice(l, a) + "\\ ", a += 1, l = a, c = "\\"), c === "\\")
|
|
@@ -798,15 +798,15 @@ function me(s, e) {
|
|
|
798
798
|
default:
|
|
799
799
|
a += 1;
|
|
800
800
|
}
|
|
801
|
-
return o = l ? o + t.slice(l) : t, n ? o :
|
|
801
|
+
return o = l ? o + t.slice(l) : t, n ? o : De(o, r, $e, Pe(e, !1));
|
|
802
802
|
}
|
|
803
|
-
function
|
|
803
|
+
function tt(s, e) {
|
|
804
804
|
if (e.options.singleQuote === !1 || e.implicitKey && s.includes(`
|
|
805
805
|
`) || /[ \t]\n|\n[ \t]/.test(s))
|
|
806
806
|
return me(s, e);
|
|
807
|
-
const t = e.indent || (
|
|
807
|
+
const t = e.indent || (xe(s) ? " " : ""), n = "'" + s.replace(/'/g, "''").replace(/\n+/g, `$&
|
|
808
808
|
${t}`) + "'";
|
|
809
|
-
return e.implicitKey ? n :
|
|
809
|
+
return e.implicitKey ? n : De(n, t, zt, Pe(e, !1));
|
|
810
810
|
}
|
|
811
811
|
function se(s, e) {
|
|
812
812
|
const { singleQuote: t } = e.options;
|
|
@@ -815,24 +815,24 @@ function se(s, e) {
|
|
|
815
815
|
n = me;
|
|
816
816
|
else {
|
|
817
817
|
const i = s.includes('"'), r = s.includes("'");
|
|
818
|
-
i && !r ? n =
|
|
818
|
+
i && !r ? n = tt : r && !i ? n = me : n = t ? tt : me;
|
|
819
819
|
}
|
|
820
820
|
return n(s, e);
|
|
821
821
|
}
|
|
822
|
-
let
|
|
822
|
+
let st;
|
|
823
823
|
try {
|
|
824
|
-
|
|
824
|
+
st = new RegExp(`(^|(?<!
|
|
825
825
|
))
|
|
826
826
|
+(?!
|
|
827
827
|
|$)`, "g");
|
|
828
828
|
} catch {
|
|
829
|
-
|
|
829
|
+
st = /\n+(?!\n|$)/g;
|
|
830
830
|
}
|
|
831
|
-
function
|
|
831
|
+
function Le({ comment: s, type: e, value: t }, n, i, r) {
|
|
832
832
|
const { blockQuote: o, commentString: l, lineWidth: a } = n.options;
|
|
833
833
|
if (!o || /\n[\t ]+$/.test(t))
|
|
834
834
|
return se(t, n);
|
|
835
|
-
const c = n.indent || (n.forceBlockIndent ||
|
|
835
|
+
const c = n.indent || (n.forceBlockIndent || xe(t) ? " " : ""), d = o === "literal" ? !0 : o === "folded" || e === N.BLOCK_FOLDED ? !1 : e === N.BLOCK_LITERAL ? !0 : !Xs(t, a, c.length);
|
|
836
836
|
if (!t)
|
|
837
837
|
return d ? `|
|
|
838
838
|
` : `>
|
|
@@ -848,7 +848,7 @@ function $e({ comment: s, type: e, value: t }, n, i, r) {
|
|
|
848
848
|
const g = p.indexOf(`
|
|
849
849
|
`);
|
|
850
850
|
g === -1 ? u = "-" : t === p || g !== p.length - 1 ? (u = "+", r && r()) : u = "", p && (t = t.slice(0, -p.length), p[p.length - 1] === `
|
|
851
|
-
` && (p = p.slice(0, -1)), p = p.replace(
|
|
851
|
+
` && (p = p.slice(0, -1)), p = p.replace(st, `$&${c}`));
|
|
852
852
|
let h = !1, m, b = -1;
|
|
853
853
|
for (m = 0; m < t.length; ++m) {
|
|
854
854
|
const _ = t[m];
|
|
@@ -871,7 +871,7 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, "$1$2").replace(/
|
|
|
871
871
|
o !== "folded" && e !== N.BLOCK_FOLDED && (T.onOverflow = () => {
|
|
872
872
|
O = !0;
|
|
873
873
|
});
|
|
874
|
-
const y =
|
|
874
|
+
const y = De(`${w}${_}${p}`, c, et, T);
|
|
875
875
|
if (!O)
|
|
876
876
|
return `>${k}
|
|
877
877
|
${c}${y}`;
|
|
@@ -879,20 +879,20 @@ ${c}${y}`;
|
|
|
879
879
|
return t = t.replace(/\n+/g, `$&${c}`), `|${k}
|
|
880
880
|
${c}${w}${t}${p}`;
|
|
881
881
|
}
|
|
882
|
-
function
|
|
882
|
+
function zs(s, e, t, n) {
|
|
883
883
|
const { type: i, value: r } = s, { actualString: o, implicitKey: l, indent: a, indentStep: c, inFlow: d } = e;
|
|
884
884
|
if (l && r.includes(`
|
|
885
885
|
`) || d && /[[\]{},]/.test(r))
|
|
886
886
|
return se(r, e);
|
|
887
887
|
if (/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))
|
|
888
888
|
return l || d || !r.includes(`
|
|
889
|
-
`) ? se(r, e) :
|
|
889
|
+
`) ? se(r, e) : Le(s, e, t, n);
|
|
890
890
|
if (!l && !d && i !== N.PLAIN && r.includes(`
|
|
891
891
|
`))
|
|
892
|
-
return
|
|
893
|
-
if (
|
|
892
|
+
return Le(s, e, t, n);
|
|
893
|
+
if (xe(r)) {
|
|
894
894
|
if (a === "")
|
|
895
|
-
return e.forceBlockIndent = !0,
|
|
895
|
+
return e.forceBlockIndent = !0, Le(s, e, t, n);
|
|
896
896
|
if (l && a === c)
|
|
897
897
|
return se(r, e);
|
|
898
898
|
}
|
|
@@ -903,9 +903,9 @@ ${a}`);
|
|
|
903
903
|
if (g.some(f) || p?.some(f))
|
|
904
904
|
return se(r, e);
|
|
905
905
|
}
|
|
906
|
-
return l ? u :
|
|
906
|
+
return l ? u : De(u, a, zt, Pe(e, !1));
|
|
907
907
|
}
|
|
908
|
-
function
|
|
908
|
+
function ut(s, e, t, n) {
|
|
909
909
|
const { implicitKey: i, inFlow: r } = e, o = typeof s.value == "string" ? s : Object.assign({}, s, { value: String(s.value) });
|
|
910
910
|
let { type: l } = s;
|
|
911
911
|
l !== N.QUOTE_DOUBLE && /[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value) && (l = N.QUOTE_DOUBLE);
|
|
@@ -913,13 +913,13 @@ function ct(s, e, t, n) {
|
|
|
913
913
|
switch (d) {
|
|
914
914
|
case N.BLOCK_FOLDED:
|
|
915
915
|
case N.BLOCK_LITERAL:
|
|
916
|
-
return i || r ? se(o.value, e) :
|
|
916
|
+
return i || r ? se(o.value, e) : Le(o, e, t, n);
|
|
917
917
|
case N.QUOTE_DOUBLE:
|
|
918
918
|
return me(o.value, e);
|
|
919
919
|
case N.QUOTE_SINGLE:
|
|
920
|
-
return
|
|
920
|
+
return tt(o.value, e);
|
|
921
921
|
case N.PLAIN:
|
|
922
|
-
return
|
|
922
|
+
return zs(o, e, t, n);
|
|
923
923
|
default:
|
|
924
924
|
return null;
|
|
925
925
|
}
|
|
@@ -932,10 +932,10 @@ function ct(s, e, t, n) {
|
|
|
932
932
|
}
|
|
933
933
|
return c;
|
|
934
934
|
}
|
|
935
|
-
function
|
|
935
|
+
function Zt(s, e) {
|
|
936
936
|
const t = Object.assign({
|
|
937
937
|
blockQuote: !0,
|
|
938
|
-
commentString:
|
|
938
|
+
commentString: Qs,
|
|
939
939
|
defaultKeyType: null,
|
|
940
940
|
defaultStringType: "PLAIN",
|
|
941
941
|
directives: null,
|
|
@@ -973,14 +973,14 @@ function zt(s, e) {
|
|
|
973
973
|
options: t
|
|
974
974
|
};
|
|
975
975
|
}
|
|
976
|
-
function
|
|
976
|
+
function Zs(s, e) {
|
|
977
977
|
if (e.tag) {
|
|
978
978
|
const i = s.filter((r) => r.tag === e.tag);
|
|
979
979
|
if (i.length > 0)
|
|
980
980
|
return i.find((r) => r.format === e.format) ?? i[0];
|
|
981
981
|
}
|
|
982
982
|
let t, n;
|
|
983
|
-
if (
|
|
983
|
+
if (v(e)) {
|
|
984
984
|
n = e.value;
|
|
985
985
|
let i = s.filter((r) => r.identify?.(n));
|
|
986
986
|
if (i.length > 1) {
|
|
@@ -996,11 +996,11 @@ function Xs(s, e) {
|
|
|
996
996
|
}
|
|
997
997
|
return t;
|
|
998
998
|
}
|
|
999
|
-
function
|
|
999
|
+
function en(s, e, { anchors: t, doc: n }) {
|
|
1000
1000
|
if (!n.directives)
|
|
1001
1001
|
return "";
|
|
1002
|
-
const i = [], r = (
|
|
1003
|
-
r &&
|
|
1002
|
+
const i = [], r = (v(s) || I(s)) && s.anchor;
|
|
1003
|
+
r && Gt(r) && (t.add(r), i.push(`&${r}`));
|
|
1004
1004
|
const o = s.tag ?? (e.default ? null : e.tag);
|
|
1005
1005
|
return o && i.push(n.directives.tagString(o)), i.join(" ");
|
|
1006
1006
|
}
|
|
@@ -1015,26 +1015,26 @@ function re(s, e, t, n) {
|
|
|
1015
1015
|
e.resolvedAliases ? e.resolvedAliases.add(s) : e.resolvedAliases = /* @__PURE__ */ new Set([s]), s = s.resolve(e.doc);
|
|
1016
1016
|
}
|
|
1017
1017
|
let i;
|
|
1018
|
-
const r =
|
|
1019
|
-
i ?? (i =
|
|
1020
|
-
const o =
|
|
1018
|
+
const r = A(s) ? s : e.doc.createNode(s, { onTagObj: (a) => i = a });
|
|
1019
|
+
i ?? (i = Zs(e.doc.schema.tags, r));
|
|
1020
|
+
const o = en(r, i, e);
|
|
1021
1021
|
o.length > 0 && (e.indentAtStart = (e.indentAtStart ?? 0) + o.length + 1);
|
|
1022
|
-
const l = typeof i.stringify == "function" ? i.stringify(r, e, t, n) :
|
|
1023
|
-
return o ?
|
|
1022
|
+
const l = typeof i.stringify == "function" ? i.stringify(r, e, t, n) : v(r) ? ut(r, e, t, n) : r.toString(e, t, n);
|
|
1023
|
+
return o ? v(r) || l[0] === "{" || l[0] === "[" ? `${o} ${l}` : `${o}
|
|
1024
1024
|
${e.indent}${l}` : l;
|
|
1025
1025
|
}
|
|
1026
|
-
function
|
|
1026
|
+
function tn({ key: s, value: e }, t, n, i) {
|
|
1027
1027
|
const { allNullValues: r, doc: o, indent: l, indentStep: a, options: { commentString: c, indentSeq: d, simpleKeys: u } } = t;
|
|
1028
|
-
let f =
|
|
1028
|
+
let f = A(s) && s.comment || null;
|
|
1029
1029
|
if (u) {
|
|
1030
1030
|
if (f)
|
|
1031
1031
|
throw new Error("With simple keys, key nodes cannot have comments");
|
|
1032
|
-
if (
|
|
1032
|
+
if (I(s) || !A(s) && typeof s == "object") {
|
|
1033
1033
|
const T = "With simple keys, collection cannot be used as a key value";
|
|
1034
1034
|
throw new Error(T);
|
|
1035
1035
|
}
|
|
1036
1036
|
}
|
|
1037
|
-
let p = !u && (!s || f && e == null && !t.inFlow ||
|
|
1037
|
+
let p = !u && (!s || f && e == null && !t.inFlow || I(s) || (v(s) ? s.type === N.BLOCK_FOLDED || s.type === N.BLOCK_LITERAL : typeof s == "object"));
|
|
1038
1038
|
t = Object.assign({}, t, {
|
|
1039
1039
|
allNullValues: !1,
|
|
1040
1040
|
implicitKey: !p && (u || !r),
|
|
@@ -1054,7 +1054,7 @@ function Zs({ key: s, value: e }, t, n, i) {
|
|
|
1054
1054
|
g && (f = null), p ? (f && (m += G(m, t.indent, c(f))), m = `? ${m}
|
|
1055
1055
|
${l}:`) : (m = `${m}:`, f && (m += G(m, t.indent, c(f))));
|
|
1056
1056
|
let b, w, S;
|
|
1057
|
-
|
|
1057
|
+
A(e) ? (b = !!e.spaceBefore, w = e.commentBefore, S = e.comment) : (b = !1, w = null, S = null, e && typeof e == "object" && (e = o.createNode(e))), t.implicitKey = !1, !p && !f && v(e) && (t.indentAtStart = m.length + 1), h = !1, !d && a.length >= 2 && !t.inFlow && !p && Se(e) && !e.flow && !e.tag && !e.anchor && (t.indent = t.indent.substring(2));
|
|
1058
1058
|
let k = !1;
|
|
1059
1059
|
const _ = re(e, t, () => k = !0, () => h = !0);
|
|
1060
1060
|
let O = " ";
|
|
@@ -1070,7 +1070,7 @@ ${U(T, t.indent)}`;
|
|
|
1070
1070
|
|
|
1071
1071
|
`) : O += `
|
|
1072
1072
|
${t.indent}`;
|
|
1073
|
-
} else if (!p &&
|
|
1073
|
+
} else if (!p && I(e)) {
|
|
1074
1074
|
const T = _[0], y = _.indexOf(`
|
|
1075
1075
|
`), L = y !== -1, q = t.inFlow ?? e.flow ?? e.items.length === 0;
|
|
1076
1076
|
if (L || !q) {
|
|
@@ -1086,32 +1086,32 @@ ${t.indent}`);
|
|
|
1086
1086
|
`) && (O = "");
|
|
1087
1087
|
return m += O + _, t.inFlow ? k && n && n() : S && !k ? m += G(m, t.indent, c(S)) : h && i && i(), m;
|
|
1088
1088
|
}
|
|
1089
|
-
function
|
|
1089
|
+
function es(s, e) {
|
|
1090
1090
|
(s === "debug" || s === "warn") && console.warn(e);
|
|
1091
1091
|
}
|
|
1092
|
-
const
|
|
1093
|
-
identify: (s) => s ===
|
|
1092
|
+
const Oe = "<<", F = {
|
|
1093
|
+
identify: (s) => s === Oe || typeof s == "symbol" && s.description === Oe,
|
|
1094
1094
|
default: "key",
|
|
1095
1095
|
tag: "tag:yaml.org,2002:merge",
|
|
1096
1096
|
test: /^<<$/,
|
|
1097
|
-
resolve: () => Object.assign(new N(Symbol(
|
|
1098
|
-
addToJSMap:
|
|
1097
|
+
resolve: () => Object.assign(new N(Symbol(Oe)), {
|
|
1098
|
+
addToJSMap: ts
|
|
1099
1099
|
}),
|
|
1100
|
-
stringify: () =>
|
|
1101
|
-
},
|
|
1102
|
-
function
|
|
1103
|
-
if (t = s && Q(t) ? t.resolve(s.doc) : t,
|
|
1100
|
+
stringify: () => Oe
|
|
1101
|
+
}, sn = (s, e) => (F.identify(e) || v(e) && (!e.type || e.type === N.PLAIN) && F.identify(e.value)) && s?.doc.schema.tags.some((t) => t.tag === F.tag && t.default);
|
|
1102
|
+
function ts(s, e, t) {
|
|
1103
|
+
if (t = s && Q(t) ? t.resolve(s.doc) : t, Se(t))
|
|
1104
1104
|
for (const n of t.items)
|
|
1105
|
-
|
|
1105
|
+
Je(s, e, n);
|
|
1106
1106
|
else if (Array.isArray(t))
|
|
1107
1107
|
for (const n of t)
|
|
1108
|
-
|
|
1108
|
+
Je(s, e, n);
|
|
1109
1109
|
else
|
|
1110
|
-
|
|
1110
|
+
Je(s, e, t);
|
|
1111
1111
|
}
|
|
1112
|
-
function
|
|
1112
|
+
function Je(s, e, t) {
|
|
1113
1113
|
const n = s && Q(t) ? t.resolve(s.doc) : t;
|
|
1114
|
-
if (!
|
|
1114
|
+
if (!we(n))
|
|
1115
1115
|
throw new Error("Merge sources must be maps or map aliases");
|
|
1116
1116
|
const i = n.toJSON(null, s, Map);
|
|
1117
1117
|
for (const [r, o] of i)
|
|
@@ -1123,19 +1123,19 @@ function Ve(s, e, t) {
|
|
|
1123
1123
|
});
|
|
1124
1124
|
return e;
|
|
1125
1125
|
}
|
|
1126
|
-
function
|
|
1127
|
-
if (
|
|
1126
|
+
function ss(s, e, { key: t, value: n }) {
|
|
1127
|
+
if (A(t) && t.addToJSMap)
|
|
1128
1128
|
t.addToJSMap(s, e, n);
|
|
1129
|
-
else if (
|
|
1130
|
-
|
|
1129
|
+
else if (sn(s, t))
|
|
1130
|
+
ts(s, e, n);
|
|
1131
1131
|
else {
|
|
1132
|
-
const i =
|
|
1132
|
+
const i = D(t, "", s);
|
|
1133
1133
|
if (e instanceof Map)
|
|
1134
|
-
e.set(i,
|
|
1134
|
+
e.set(i, D(n, i, s));
|
|
1135
1135
|
else if (e instanceof Set)
|
|
1136
1136
|
e.add(i);
|
|
1137
1137
|
else {
|
|
1138
|
-
const r =
|
|
1138
|
+
const r = nn(t, i, s), o = D(n, r, s);
|
|
1139
1139
|
r in e ? Object.defineProperty(e, r, {
|
|
1140
1140
|
value: o,
|
|
1141
1141
|
writable: !0,
|
|
@@ -1146,13 +1146,13 @@ function ts(s, e, { key: t, value: n }) {
|
|
|
1146
1146
|
}
|
|
1147
1147
|
return e;
|
|
1148
1148
|
}
|
|
1149
|
-
function
|
|
1149
|
+
function nn(s, e, t) {
|
|
1150
1150
|
if (e === null)
|
|
1151
1151
|
return "";
|
|
1152
1152
|
if (typeof e != "object")
|
|
1153
1153
|
return String(e);
|
|
1154
|
-
if (
|
|
1155
|
-
const n =
|
|
1154
|
+
if (A(s) && t?.doc) {
|
|
1155
|
+
const n = Zt(t.doc, {});
|
|
1156
1156
|
n.anchors = /* @__PURE__ */ new Set();
|
|
1157
1157
|
for (const r of t.anchors.keys())
|
|
1158
1158
|
n.anchors.add(r.anchor);
|
|
@@ -1160,47 +1160,47 @@ function tn(s, e, t) {
|
|
|
1160
1160
|
const i = s.toString(n);
|
|
1161
1161
|
if (!t.mapKeyWarned) {
|
|
1162
1162
|
let r = JSON.stringify(i);
|
|
1163
|
-
r.length > 40 && (r = r.substring(0, 36) + '..."'),
|
|
1163
|
+
r.length > 40 && (r = r.substring(0, 36) + '..."'), es(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;
|
|
1164
1164
|
}
|
|
1165
1165
|
return i;
|
|
1166
1166
|
}
|
|
1167
1167
|
return JSON.stringify(e);
|
|
1168
1168
|
}
|
|
1169
|
-
function
|
|
1169
|
+
function ht(s, e, t) {
|
|
1170
1170
|
const n = ge(s, void 0, t), i = ge(e, void 0, t);
|
|
1171
1171
|
return new B(n, i);
|
|
1172
1172
|
}
|
|
1173
1173
|
class B {
|
|
1174
1174
|
constructor(e, t = null) {
|
|
1175
|
-
Object.defineProperty(this,
|
|
1175
|
+
Object.defineProperty(this, P, { value: Jt }), this.key = e, this.value = t;
|
|
1176
1176
|
}
|
|
1177
1177
|
clone(e) {
|
|
1178
1178
|
let { key: t, value: n } = this;
|
|
1179
|
-
return
|
|
1179
|
+
return A(t) && (t = t.clone(e)), A(n) && (n = n.clone(e)), new B(t, n);
|
|
1180
1180
|
}
|
|
1181
1181
|
toJSON(e, t) {
|
|
1182
1182
|
const n = t?.mapAsMap ? /* @__PURE__ */ new Map() : {};
|
|
1183
|
-
return
|
|
1183
|
+
return ss(t, n, this);
|
|
1184
1184
|
}
|
|
1185
1185
|
toString(e, t, n) {
|
|
1186
|
-
return e?.doc ?
|
|
1186
|
+
return e?.doc ? tn(this, e, t, n) : JSON.stringify(this);
|
|
1187
1187
|
}
|
|
1188
1188
|
}
|
|
1189
|
-
function
|
|
1190
|
-
return (e.inFlow ?? s.flow ?
|
|
1189
|
+
function ns(s, e, t) {
|
|
1190
|
+
return (e.inFlow ?? s.flow ? on : rn)(s, e, t);
|
|
1191
1191
|
}
|
|
1192
|
-
function
|
|
1192
|
+
function rn({ comment: s, items: e }, t, { blockItemPrefix: n, flowChars: i, itemIndent: r, onChompKeep: o, onComment: l }) {
|
|
1193
1193
|
const { indent: a, options: { commentString: c } } = t, d = Object.assign({}, t, { indent: r, type: null });
|
|
1194
1194
|
let u = !1;
|
|
1195
1195
|
const f = [];
|
|
1196
1196
|
for (let g = 0; g < e.length; ++g) {
|
|
1197
1197
|
const h = e[g];
|
|
1198
1198
|
let m = null;
|
|
1199
|
-
if (
|
|
1200
|
-
!u && h.spaceBefore && f.push(""),
|
|
1199
|
+
if (A(h))
|
|
1200
|
+
!u && h.spaceBefore && f.push(""), je(t, f, h.commentBefore, u), h.comment && (m = h.comment);
|
|
1201
1201
|
else if ($(h)) {
|
|
1202
|
-
const w =
|
|
1203
|
-
w && (!u && w.spaceBefore && f.push(""),
|
|
1202
|
+
const w = A(h.key) ? h.key : null;
|
|
1203
|
+
w && (!u && w.spaceBefore && f.push(""), je(t, f, w.commentBefore, u));
|
|
1204
1204
|
}
|
|
1205
1205
|
u = !1;
|
|
1206
1206
|
let b = re(h, d, () => m = null, () => u = !0);
|
|
@@ -1221,7 +1221,7 @@ ${a}${h}` : `
|
|
|
1221
1221
|
return s ? (p += `
|
|
1222
1222
|
` + U(c(s), a), l && l()) : u && o && o(), p;
|
|
1223
1223
|
}
|
|
1224
|
-
function
|
|
1224
|
+
function on({ items: s }, e, { flowChars: t, itemIndent: n }) {
|
|
1225
1225
|
const { indent: i, indentStep: r, flowCollectionPadding: o, options: { commentString: l } } = e;
|
|
1226
1226
|
n += r;
|
|
1227
1227
|
const a = Object.assign({}, e, {
|
|
@@ -1234,12 +1234,12 @@ function nn({ items: s }, e, { flowChars: t, itemIndent: n }) {
|
|
|
1234
1234
|
for (let g = 0; g < s.length; ++g) {
|
|
1235
1235
|
const h = s[g];
|
|
1236
1236
|
let m = null;
|
|
1237
|
-
if (
|
|
1238
|
-
h.spaceBefore && u.push(""),
|
|
1237
|
+
if (A(h))
|
|
1238
|
+
h.spaceBefore && u.push(""), je(e, u, h.commentBefore, !1), h.comment && (m = h.comment);
|
|
1239
1239
|
else if ($(h)) {
|
|
1240
|
-
const w =
|
|
1241
|
-
w && (w.spaceBefore && u.push(""),
|
|
1242
|
-
const S =
|
|
1240
|
+
const w = A(h.key) ? h.key : null;
|
|
1241
|
+
w && (w.spaceBefore && u.push(""), je(e, u, w.commentBefore, !1), w.comment && (c = !0));
|
|
1242
|
+
const S = A(h.value) ? h.value : null;
|
|
1243
1243
|
S ? (S.comment && (m = S.comment), S.commentBefore && (c = !0)) : h.value == null && w?.comment && (m = w.comment);
|
|
1244
1244
|
}
|
|
1245
1245
|
m && (c = !0);
|
|
@@ -1265,19 +1265,19 @@ ${i}${p}`;
|
|
|
1265
1265
|
} else
|
|
1266
1266
|
return `${f}${o}${u.join(" ")}${o}${p}`;
|
|
1267
1267
|
}
|
|
1268
|
-
function
|
|
1268
|
+
function je({ indent: s, options: { commentString: e } }, t, n, i) {
|
|
1269
1269
|
if (n && i && (n = n.replace(/^\n+/, "")), n) {
|
|
1270
1270
|
const r = U(e(n), s);
|
|
1271
1271
|
t.push(r.trimStart());
|
|
1272
1272
|
}
|
|
1273
1273
|
}
|
|
1274
1274
|
function H(s, e) {
|
|
1275
|
-
const t =
|
|
1275
|
+
const t = v(e) ? e.value : e;
|
|
1276
1276
|
for (const n of s)
|
|
1277
|
-
if ($(n) && (n.key === e || n.key === t ||
|
|
1277
|
+
if ($(n) && (n.key === e || n.key === t || v(n.key) && n.key.value === t))
|
|
1278
1278
|
return n;
|
|
1279
1279
|
}
|
|
1280
|
-
class M extends
|
|
1280
|
+
class M extends Xt {
|
|
1281
1281
|
static get tagName() {
|
|
1282
1282
|
return "tag:yaml.org,2002:map";
|
|
1283
1283
|
}
|
|
@@ -1294,7 +1294,7 @@ class M extends Qt {
|
|
|
1294
1294
|
c = r.call(t, a, c);
|
|
1295
1295
|
else if (Array.isArray(r) && !r.includes(a))
|
|
1296
1296
|
return;
|
|
1297
|
-
(c !== void 0 || i) && o.items.push(
|
|
1297
|
+
(c !== void 0 || i) && o.items.push(ht(a, c, n));
|
|
1298
1298
|
};
|
|
1299
1299
|
if (t instanceof Map)
|
|
1300
1300
|
for (const [a, c] of t)
|
|
@@ -1317,7 +1317,7 @@ class M extends Qt {
|
|
|
1317
1317
|
if (i) {
|
|
1318
1318
|
if (!t)
|
|
1319
1319
|
throw new Error(`Key ${n.key} already set`);
|
|
1320
|
-
|
|
1320
|
+
v(i.value) && Qt(n.value) ? i.value.value = n.value : i.value = n.value;
|
|
1321
1321
|
} else if (r) {
|
|
1322
1322
|
const o = this.items.findIndex((l) => r(n, l) < 0);
|
|
1323
1323
|
o === -1 ? this.items.push(n) : this.items.splice(o, 0, n);
|
|
@@ -1330,7 +1330,7 @@ class M extends Qt {
|
|
|
1330
1330
|
}
|
|
1331
1331
|
get(e, t) {
|
|
1332
1332
|
const i = H(this.items, e)?.value;
|
|
1333
|
-
return (!t &&
|
|
1333
|
+
return (!t && v(i) ? i.value : i) ?? void 0;
|
|
1334
1334
|
}
|
|
1335
1335
|
has(e) {
|
|
1336
1336
|
return !!H(this.items, e);
|
|
@@ -1347,7 +1347,7 @@ class M extends Qt {
|
|
|
1347
1347
|
const i = n ? new n() : t?.mapAsMap ? /* @__PURE__ */ new Map() : {};
|
|
1348
1348
|
t?.onCreate && t.onCreate(i);
|
|
1349
1349
|
for (const r of this.items)
|
|
1350
|
-
|
|
1350
|
+
ss(t, i, r);
|
|
1351
1351
|
return i;
|
|
1352
1352
|
}
|
|
1353
1353
|
toString(e, t, n) {
|
|
@@ -1356,7 +1356,7 @@ class M extends Qt {
|
|
|
1356
1356
|
for (const i of this.items)
|
|
1357
1357
|
if (!$(i))
|
|
1358
1358
|
throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);
|
|
1359
|
-
return !e.allNullValues && this.hasAllNullValues(!1) && (e = Object.assign({}, e, { allNullValues: !0 })),
|
|
1359
|
+
return !e.allNullValues && this.hasAllNullValues(!1) && (e = Object.assign({}, e, { allNullValues: !0 })), ns(this, e, {
|
|
1360
1360
|
blockItemPrefix: "",
|
|
1361
1361
|
flowChars: { start: "{", end: "}" },
|
|
1362
1362
|
itemIndent: e.indent || "",
|
|
@@ -1371,11 +1371,11 @@ const ce = {
|
|
|
1371
1371
|
nodeClass: M,
|
|
1372
1372
|
tag: "tag:yaml.org,2002:map",
|
|
1373
1373
|
resolve(s, e) {
|
|
1374
|
-
return
|
|
1374
|
+
return we(s) || e("Expected a mapping for this tag"), s;
|
|
1375
1375
|
},
|
|
1376
1376
|
createNode: (s, e, t) => M.from(s, e, t)
|
|
1377
1377
|
};
|
|
1378
|
-
class W extends
|
|
1378
|
+
class W extends Xt {
|
|
1379
1379
|
static get tagName() {
|
|
1380
1380
|
return "tag:yaml.org,2002:seq";
|
|
1381
1381
|
}
|
|
@@ -1394,15 +1394,15 @@ class W extends Qt {
|
|
|
1394
1394
|
* @returns `true` if the item was found and removed.
|
|
1395
1395
|
*/
|
|
1396
1396
|
delete(e) {
|
|
1397
|
-
const t =
|
|
1397
|
+
const t = Ee(e);
|
|
1398
1398
|
return typeof t != "number" ? !1 : this.items.splice(t, 1).length > 0;
|
|
1399
1399
|
}
|
|
1400
1400
|
get(e, t) {
|
|
1401
|
-
const n =
|
|
1401
|
+
const n = Ee(e);
|
|
1402
1402
|
if (typeof n != "number")
|
|
1403
1403
|
return;
|
|
1404
1404
|
const i = this.items[n];
|
|
1405
|
-
return !t &&
|
|
1405
|
+
return !t && v(i) ? i.value : i;
|
|
1406
1406
|
}
|
|
1407
1407
|
/**
|
|
1408
1408
|
* Checks if the collection includes a value with the key `key`.
|
|
@@ -1411,7 +1411,7 @@ class W extends Qt {
|
|
|
1411
1411
|
* It may be wrapped in a `Scalar`.
|
|
1412
1412
|
*/
|
|
1413
1413
|
has(e) {
|
|
1414
|
-
const t =
|
|
1414
|
+
const t = Ee(e);
|
|
1415
1415
|
return typeof t == "number" && t < this.items.length;
|
|
1416
1416
|
}
|
|
1417
1417
|
/**
|
|
@@ -1422,22 +1422,22 @@ class W extends Qt {
|
|
|
1422
1422
|
* It may be wrapped in a `Scalar`.
|
|
1423
1423
|
*/
|
|
1424
1424
|
set(e, t) {
|
|
1425
|
-
const n =
|
|
1425
|
+
const n = Ee(e);
|
|
1426
1426
|
if (typeof n != "number")
|
|
1427
1427
|
throw new Error(`Expected a valid index, not ${e}.`);
|
|
1428
1428
|
const i = this.items[n];
|
|
1429
|
-
|
|
1429
|
+
v(i) && Qt(t) ? i.value = t : this.items[n] = t;
|
|
1430
1430
|
}
|
|
1431
1431
|
toJSON(e, t) {
|
|
1432
1432
|
const n = [];
|
|
1433
1433
|
t?.onCreate && t.onCreate(n);
|
|
1434
1434
|
let i = 0;
|
|
1435
1435
|
for (const r of this.items)
|
|
1436
|
-
n.push(
|
|
1436
|
+
n.push(D(r, String(i++), t));
|
|
1437
1437
|
return n;
|
|
1438
1438
|
}
|
|
1439
1439
|
toString(e, t, n) {
|
|
1440
|
-
return e ?
|
|
1440
|
+
return e ? ns(this, e, {
|
|
1441
1441
|
blockItemPrefix: "- ",
|
|
1442
1442
|
flowChars: { start: "[", end: "]" },
|
|
1443
1443
|
itemIndent: (e.indent || "") + " ",
|
|
@@ -1460,8 +1460,8 @@ class W extends Qt {
|
|
|
1460
1460
|
return r;
|
|
1461
1461
|
}
|
|
1462
1462
|
}
|
|
1463
|
-
function
|
|
1464
|
-
let e =
|
|
1463
|
+
function Ee(s) {
|
|
1464
|
+
let e = v(s) ? s.value : s;
|
|
1465
1465
|
return e && typeof e == "string" && (e = Number(e)), typeof e == "number" && Number.isInteger(e) && e >= 0 ? e : null;
|
|
1466
1466
|
}
|
|
1467
1467
|
const fe = {
|
|
@@ -1470,33 +1470,33 @@ const fe = {
|
|
|
1470
1470
|
nodeClass: W,
|
|
1471
1471
|
tag: "tag:yaml.org,2002:seq",
|
|
1472
1472
|
resolve(s, e) {
|
|
1473
|
-
return
|
|
1473
|
+
return Se(s) || e("Expected a sequence for this tag"), s;
|
|
1474
1474
|
},
|
|
1475
1475
|
createNode: (s, e, t) => W.from(s, e, t)
|
|
1476
|
-
},
|
|
1476
|
+
}, Ke = {
|
|
1477
1477
|
identify: (s) => typeof s == "string",
|
|
1478
1478
|
default: !0,
|
|
1479
1479
|
tag: "tag:yaml.org,2002:str",
|
|
1480
1480
|
resolve: (s) => s,
|
|
1481
1481
|
stringify(s, e, t, n) {
|
|
1482
|
-
return e = Object.assign({ actualString: !0 }, e),
|
|
1482
|
+
return e = Object.assign({ actualString: !0 }, e), ut(s, e, t, n);
|
|
1483
1483
|
}
|
|
1484
|
-
},
|
|
1484
|
+
}, Re = {
|
|
1485
1485
|
identify: (s) => s == null,
|
|
1486
1486
|
createNode: () => new N(null),
|
|
1487
1487
|
default: !0,
|
|
1488
1488
|
tag: "tag:yaml.org,2002:null",
|
|
1489
1489
|
test: /^(?:~|[Nn]ull|NULL)?$/,
|
|
1490
1490
|
resolve: () => new N(null),
|
|
1491
|
-
stringify: ({ source: s }, e) => typeof s == "string" &&
|
|
1492
|
-
},
|
|
1491
|
+
stringify: ({ source: s }, e) => typeof s == "string" && Re.test.test(s) ? s : e.options.nullStr
|
|
1492
|
+
}, dt = {
|
|
1493
1493
|
identify: (s) => typeof s == "boolean",
|
|
1494
1494
|
default: !0,
|
|
1495
1495
|
tag: "tag:yaml.org,2002:bool",
|
|
1496
1496
|
test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
|
|
1497
1497
|
resolve: (s) => new N(s[0] === "t" || s[0] === "T"),
|
|
1498
1498
|
stringify({ source: s, value: e }, t) {
|
|
1499
|
-
if (s &&
|
|
1499
|
+
if (s && dt.test.test(s)) {
|
|
1500
1500
|
const n = s[0] === "t" || s[0] === "T";
|
|
1501
1501
|
if (e === n)
|
|
1502
1502
|
return s;
|
|
@@ -1520,14 +1520,14 @@ function K({ format: s, minFractionDigits: e, tag: t, value: n }) {
|
|
|
1520
1520
|
}
|
|
1521
1521
|
return r;
|
|
1522
1522
|
}
|
|
1523
|
-
const
|
|
1523
|
+
const is = {
|
|
1524
1524
|
identify: (s) => typeof s == "number",
|
|
1525
1525
|
default: !0,
|
|
1526
1526
|
tag: "tag:yaml.org,2002:float",
|
|
1527
1527
|
test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
|
|
1528
1528
|
resolve: (s) => s.slice(-3).toLowerCase() === "nan" ? NaN : s[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
|
|
1529
1529
|
stringify: K
|
|
1530
|
-
},
|
|
1530
|
+
}, rs = {
|
|
1531
1531
|
identify: (s) => typeof s == "number",
|
|
1532
1532
|
default: !0,
|
|
1533
1533
|
tag: "tag:yaml.org,2002:float",
|
|
@@ -1538,7 +1538,7 @@ const ns = {
|
|
|
1538
1538
|
const e = Number(s.value);
|
|
1539
1539
|
return isFinite(e) ? e.toExponential() : K(s);
|
|
1540
1540
|
}
|
|
1541
|
-
},
|
|
1541
|
+
}, os = {
|
|
1542
1542
|
identify: (s) => typeof s == "number",
|
|
1543
1543
|
default: !0,
|
|
1544
1544
|
tag: "tag:yaml.org,2002:float",
|
|
@@ -1548,57 +1548,57 @@ const ns = {
|
|
|
1548
1548
|
return t !== -1 && s[s.length - 1] === "0" && (e.minFractionDigits = s.length - t - 1), e;
|
|
1549
1549
|
},
|
|
1550
1550
|
stringify: K
|
|
1551
|
-
},
|
|
1552
|
-
function
|
|
1551
|
+
}, Ue = (s) => typeof s == "bigint" || Number.isInteger(s), pt = (s, e, t, { intAsBigInt: n }) => n ? BigInt(s) : parseInt(s.substring(e), t);
|
|
1552
|
+
function ls(s, e, t) {
|
|
1553
1553
|
const { value: n } = s;
|
|
1554
|
-
return
|
|
1554
|
+
return Ue(n) && n >= 0 ? t + n.toString(e) : K(s);
|
|
1555
1555
|
}
|
|
1556
|
-
const
|
|
1557
|
-
identify: (s) =>
|
|
1556
|
+
const as = {
|
|
1557
|
+
identify: (s) => Ue(s) && s >= 0,
|
|
1558
1558
|
default: !0,
|
|
1559
1559
|
tag: "tag:yaml.org,2002:int",
|
|
1560
1560
|
format: "OCT",
|
|
1561
1561
|
test: /^0o[0-7]+$/,
|
|
1562
|
-
resolve: (s, e, t) =>
|
|
1563
|
-
stringify: (s) =>
|
|
1564
|
-
},
|
|
1565
|
-
identify:
|
|
1562
|
+
resolve: (s, e, t) => pt(s, 2, 8, t),
|
|
1563
|
+
stringify: (s) => ls(s, 8, "0o")
|
|
1564
|
+
}, cs = {
|
|
1565
|
+
identify: Ue,
|
|
1566
1566
|
default: !0,
|
|
1567
1567
|
tag: "tag:yaml.org,2002:int",
|
|
1568
1568
|
test: /^[-+]?[0-9]+$/,
|
|
1569
|
-
resolve: (s, e, t) =>
|
|
1569
|
+
resolve: (s, e, t) => pt(s, 0, 10, t),
|
|
1570
1570
|
stringify: K
|
|
1571
|
-
},
|
|
1572
|
-
identify: (s) =>
|
|
1571
|
+
}, fs = {
|
|
1572
|
+
identify: (s) => Ue(s) && s >= 0,
|
|
1573
1573
|
default: !0,
|
|
1574
1574
|
tag: "tag:yaml.org,2002:int",
|
|
1575
1575
|
format: "HEX",
|
|
1576
1576
|
test: /^0x[0-9a-fA-F]+$/,
|
|
1577
|
-
resolve: (s, e, t) =>
|
|
1578
|
-
stringify: (s) =>
|
|
1579
|
-
},
|
|
1577
|
+
resolve: (s, e, t) => pt(s, 2, 16, t),
|
|
1578
|
+
stringify: (s) => ls(s, 16, "0x")
|
|
1579
|
+
}, ln = [
|
|
1580
1580
|
ce,
|
|
1581
1581
|
fe,
|
|
1582
|
-
xe,
|
|
1583
1582
|
Ke,
|
|
1584
|
-
|
|
1585
|
-
|
|
1583
|
+
Re,
|
|
1584
|
+
dt,
|
|
1586
1585
|
as,
|
|
1587
1586
|
cs,
|
|
1588
|
-
|
|
1587
|
+
fs,
|
|
1589
1588
|
is,
|
|
1590
|
-
rs
|
|
1589
|
+
rs,
|
|
1590
|
+
os
|
|
1591
1591
|
];
|
|
1592
|
-
function
|
|
1592
|
+
function Tt(s) {
|
|
1593
1593
|
return typeof s == "bigint" || Number.isInteger(s);
|
|
1594
1594
|
}
|
|
1595
|
-
const
|
|
1595
|
+
const Te = ({ value: s }) => JSON.stringify(s), an = [
|
|
1596
1596
|
{
|
|
1597
1597
|
identify: (s) => typeof s == "string",
|
|
1598
1598
|
default: !0,
|
|
1599
1599
|
tag: "tag:yaml.org,2002:str",
|
|
1600
1600
|
resolve: (s) => s,
|
|
1601
|
-
stringify:
|
|
1601
|
+
stringify: Te
|
|
1602
1602
|
},
|
|
1603
1603
|
{
|
|
1604
1604
|
identify: (s) => s == null,
|
|
@@ -1607,7 +1607,7 @@ const Ee = ({ value: s }) => JSON.stringify(s), on = [
|
|
|
1607
1607
|
tag: "tag:yaml.org,2002:null",
|
|
1608
1608
|
test: /^null$/,
|
|
1609
1609
|
resolve: () => null,
|
|
1610
|
-
stringify:
|
|
1610
|
+
stringify: Te
|
|
1611
1611
|
},
|
|
1612
1612
|
{
|
|
1613
1613
|
identify: (s) => typeof s == "boolean",
|
|
@@ -1615,15 +1615,15 @@ const Ee = ({ value: s }) => JSON.stringify(s), on = [
|
|
|
1615
1615
|
tag: "tag:yaml.org,2002:bool",
|
|
1616
1616
|
test: /^true$|^false$/,
|
|
1617
1617
|
resolve: (s) => s === "true",
|
|
1618
|
-
stringify:
|
|
1618
|
+
stringify: Te
|
|
1619
1619
|
},
|
|
1620
1620
|
{
|
|
1621
|
-
identify:
|
|
1621
|
+
identify: Tt,
|
|
1622
1622
|
default: !0,
|
|
1623
1623
|
tag: "tag:yaml.org,2002:int",
|
|
1624
1624
|
test: /^-?(?:0|[1-9][0-9]*)$/,
|
|
1625
1625
|
resolve: (s, e, { intAsBigInt: t }) => t ? BigInt(s) : parseInt(s, 10),
|
|
1626
|
-
stringify: ({ value: s }) =>
|
|
1626
|
+
stringify: ({ value: s }) => Tt(s) ? s.toString() : JSON.stringify(s)
|
|
1627
1627
|
},
|
|
1628
1628
|
{
|
|
1629
1629
|
identify: (s) => typeof s == "number",
|
|
@@ -1631,16 +1631,16 @@ const Ee = ({ value: s }) => JSON.stringify(s), on = [
|
|
|
1631
1631
|
tag: "tag:yaml.org,2002:float",
|
|
1632
1632
|
test: /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,
|
|
1633
1633
|
resolve: (s) => parseFloat(s),
|
|
1634
|
-
stringify:
|
|
1634
|
+
stringify: Te
|
|
1635
1635
|
}
|
|
1636
|
-
],
|
|
1636
|
+
], cn = {
|
|
1637
1637
|
default: !0,
|
|
1638
1638
|
tag: "",
|
|
1639
1639
|
test: /^/,
|
|
1640
1640
|
resolve(s, e) {
|
|
1641
1641
|
return e(`Unresolved plain scalar ${JSON.stringify(s)}`), s;
|
|
1642
1642
|
}
|
|
1643
|
-
},
|
|
1643
|
+
}, fn = [ce, fe].concat(an, cn), mt = {
|
|
1644
1644
|
identify: (s) => s instanceof Uint8Array,
|
|
1645
1645
|
// Buffer inherits from Uint8Array
|
|
1646
1646
|
default: !1,
|
|
@@ -1681,15 +1681,15 @@ const Ee = ({ value: s }) => JSON.stringify(s), on = [
|
|
|
1681
1681
|
l = d.join(e === N.BLOCK_LITERAL ? `
|
|
1682
1682
|
` : " ");
|
|
1683
1683
|
}
|
|
1684
|
-
return
|
|
1684
|
+
return ut({ comment: s, type: e, value: l }, n, i, r);
|
|
1685
1685
|
}
|
|
1686
1686
|
};
|
|
1687
|
-
function
|
|
1688
|
-
if (
|
|
1687
|
+
function us(s, e) {
|
|
1688
|
+
if (Se(s))
|
|
1689
1689
|
for (let t = 0; t < s.items.length; ++t) {
|
|
1690
1690
|
let n = s.items[t];
|
|
1691
1691
|
if (!$(n)) {
|
|
1692
|
-
if (
|
|
1692
|
+
if (we(n)) {
|
|
1693
1693
|
n.items.length > 1 && e("Each pair must have its own sequence indicator");
|
|
1694
1694
|
const i = n.items[0] || new B(new N(null));
|
|
1695
1695
|
if (n.commentBefore && (i.key.commentBefore = i.key.commentBefore ? `${n.commentBefore}
|
|
@@ -1707,7 +1707,7 @@ ${r.comment}` : n.comment;
|
|
|
1707
1707
|
e("Expected a sequence for this tag");
|
|
1708
1708
|
return s;
|
|
1709
1709
|
}
|
|
1710
|
-
function
|
|
1710
|
+
function hs(s, e, t) {
|
|
1711
1711
|
const { replacer: n } = t, i = new W(s);
|
|
1712
1712
|
i.tag = "tag:yaml.org,2002:pairs";
|
|
1713
1713
|
let r = 0;
|
|
@@ -1728,16 +1728,16 @@ function us(s, e, t) {
|
|
|
1728
1728
|
throw new TypeError(`Expected tuple with one key, not ${c.length} keys`);
|
|
1729
1729
|
} else
|
|
1730
1730
|
l = o;
|
|
1731
|
-
i.items.push(
|
|
1731
|
+
i.items.push(ht(l, a, t));
|
|
1732
1732
|
}
|
|
1733
1733
|
return i;
|
|
1734
1734
|
}
|
|
1735
|
-
const
|
|
1735
|
+
const gt = {
|
|
1736
1736
|
collection: "seq",
|
|
1737
1737
|
default: !1,
|
|
1738
1738
|
tag: "tag:yaml.org,2002:pairs",
|
|
1739
|
-
resolve:
|
|
1740
|
-
createNode:
|
|
1739
|
+
resolve: us,
|
|
1740
|
+
createNode: hs
|
|
1741
1741
|
};
|
|
1742
1742
|
class ne extends W {
|
|
1743
1743
|
constructor() {
|
|
@@ -1754,57 +1754,57 @@ class ne extends W {
|
|
|
1754
1754
|
t?.onCreate && t.onCreate(n);
|
|
1755
1755
|
for (const i of this.items) {
|
|
1756
1756
|
let r, o;
|
|
1757
|
-
if ($(i) ? (r =
|
|
1757
|
+
if ($(i) ? (r = D(i.key, "", t), o = D(i.value, r, t)) : r = D(i, "", t), n.has(r))
|
|
1758
1758
|
throw new Error("Ordered maps must not include duplicate keys");
|
|
1759
1759
|
n.set(r, o);
|
|
1760
1760
|
}
|
|
1761
1761
|
return n;
|
|
1762
1762
|
}
|
|
1763
1763
|
static from(e, t, n) {
|
|
1764
|
-
const i =
|
|
1764
|
+
const i = hs(e, t, n), r = new this();
|
|
1765
1765
|
return r.items = i.items, r;
|
|
1766
1766
|
}
|
|
1767
1767
|
}
|
|
1768
1768
|
ne.tag = "tag:yaml.org,2002:omap";
|
|
1769
|
-
const
|
|
1769
|
+
const yt = {
|
|
1770
1770
|
collection: "seq",
|
|
1771
1771
|
identify: (s) => s instanceof Map,
|
|
1772
1772
|
nodeClass: ne,
|
|
1773
1773
|
default: !1,
|
|
1774
1774
|
tag: "tag:yaml.org,2002:omap",
|
|
1775
1775
|
resolve(s, e) {
|
|
1776
|
-
const t =
|
|
1776
|
+
const t = us(s, e), n = [];
|
|
1777
1777
|
for (const { key: i } of t.items)
|
|
1778
|
-
|
|
1778
|
+
v(i) && (n.includes(i.value) ? e(`Ordered maps must not include duplicate keys: ${i.value}`) : n.push(i.value));
|
|
1779
1779
|
return Object.assign(new ne(), t);
|
|
1780
1780
|
},
|
|
1781
1781
|
createNode: (s, e, t) => ne.from(s, e, t)
|
|
1782
1782
|
};
|
|
1783
|
-
function
|
|
1784
|
-
return e && (s ?
|
|
1783
|
+
function ds({ value: s, source: e }, t) {
|
|
1784
|
+
return e && (s ? ps : ms).test.test(e) ? e : s ? t.options.trueStr : t.options.falseStr;
|
|
1785
1785
|
}
|
|
1786
|
-
const
|
|
1786
|
+
const ps = {
|
|
1787
1787
|
identify: (s) => s === !0,
|
|
1788
1788
|
default: !0,
|
|
1789
1789
|
tag: "tag:yaml.org,2002:bool",
|
|
1790
1790
|
test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,
|
|
1791
1791
|
resolve: () => new N(!0),
|
|
1792
|
-
stringify:
|
|
1793
|
-
},
|
|
1792
|
+
stringify: ds
|
|
1793
|
+
}, ms = {
|
|
1794
1794
|
identify: (s) => s === !1,
|
|
1795
1795
|
default: !0,
|
|
1796
1796
|
tag: "tag:yaml.org,2002:bool",
|
|
1797
1797
|
test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,
|
|
1798
1798
|
resolve: () => new N(!1),
|
|
1799
|
-
stringify:
|
|
1800
|
-
},
|
|
1799
|
+
stringify: ds
|
|
1800
|
+
}, un = {
|
|
1801
1801
|
identify: (s) => typeof s == "number",
|
|
1802
1802
|
default: !0,
|
|
1803
1803
|
tag: "tag:yaml.org,2002:float",
|
|
1804
1804
|
test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
|
|
1805
1805
|
resolve: (s) => s.slice(-3).toLowerCase() === "nan" ? NaN : s[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
|
|
1806
1806
|
stringify: K
|
|
1807
|
-
},
|
|
1807
|
+
}, hn = {
|
|
1808
1808
|
identify: (s) => typeof s == "number",
|
|
1809
1809
|
default: !0,
|
|
1810
1810
|
tag: "tag:yaml.org,2002:float",
|
|
@@ -1815,7 +1815,7 @@ const ds = {
|
|
|
1815
1815
|
const e = Number(s.value);
|
|
1816
1816
|
return isFinite(e) ? e.toExponential() : K(s);
|
|
1817
1817
|
}
|
|
1818
|
-
},
|
|
1818
|
+
}, dn = {
|
|
1819
1819
|
identify: (s) => typeof s == "number",
|
|
1820
1820
|
default: !0,
|
|
1821
1821
|
tag: "tag:yaml.org,2002:float",
|
|
@@ -1829,8 +1829,8 @@ const ds = {
|
|
|
1829
1829
|
return e;
|
|
1830
1830
|
},
|
|
1831
1831
|
stringify: K
|
|
1832
|
-
},
|
|
1833
|
-
function
|
|
1832
|
+
}, ke = (s) => typeof s == "bigint" || Number.isInteger(s);
|
|
1833
|
+
function Fe(s, e, t, { intAsBigInt: n }) {
|
|
1834
1834
|
const i = s[0];
|
|
1835
1835
|
if ((i === "-" || i === "+") && (e += 1), s = s.substring(e).replace(/_/g, ""), n) {
|
|
1836
1836
|
switch (t) {
|
|
@@ -1850,45 +1850,45 @@ function Ue(s, e, t, { intAsBigInt: n }) {
|
|
|
1850
1850
|
const r = parseInt(s, t);
|
|
1851
1851
|
return i === "-" ? -1 * r : r;
|
|
1852
1852
|
}
|
|
1853
|
-
function
|
|
1853
|
+
function bt(s, e, t) {
|
|
1854
1854
|
const { value: n } = s;
|
|
1855
|
-
if (
|
|
1855
|
+
if (ke(n)) {
|
|
1856
1856
|
const i = n.toString(e);
|
|
1857
1857
|
return n < 0 ? "-" + t + i.substr(1) : t + i;
|
|
1858
1858
|
}
|
|
1859
1859
|
return K(s);
|
|
1860
1860
|
}
|
|
1861
|
-
const
|
|
1862
|
-
identify:
|
|
1861
|
+
const pn = {
|
|
1862
|
+
identify: ke,
|
|
1863
1863
|
default: !0,
|
|
1864
1864
|
tag: "tag:yaml.org,2002:int",
|
|
1865
1865
|
format: "BIN",
|
|
1866
1866
|
test: /^[-+]?0b[0-1_]+$/,
|
|
1867
|
-
resolve: (s, e, t) =>
|
|
1868
|
-
stringify: (s) =>
|
|
1869
|
-
},
|
|
1870
|
-
identify:
|
|
1867
|
+
resolve: (s, e, t) => Fe(s, 2, 2, t),
|
|
1868
|
+
stringify: (s) => bt(s, 2, "0b")
|
|
1869
|
+
}, mn = {
|
|
1870
|
+
identify: ke,
|
|
1871
1871
|
default: !0,
|
|
1872
1872
|
tag: "tag:yaml.org,2002:int",
|
|
1873
1873
|
format: "OCT",
|
|
1874
1874
|
test: /^[-+]?0[0-7_]+$/,
|
|
1875
|
-
resolve: (s, e, t) =>
|
|
1876
|
-
stringify: (s) =>
|
|
1877
|
-
},
|
|
1878
|
-
identify:
|
|
1875
|
+
resolve: (s, e, t) => Fe(s, 1, 8, t),
|
|
1876
|
+
stringify: (s) => bt(s, 8, "0")
|
|
1877
|
+
}, gn = {
|
|
1878
|
+
identify: ke,
|
|
1879
1879
|
default: !0,
|
|
1880
1880
|
tag: "tag:yaml.org,2002:int",
|
|
1881
1881
|
test: /^[-+]?[0-9][0-9_]*$/,
|
|
1882
|
-
resolve: (s, e, t) =>
|
|
1882
|
+
resolve: (s, e, t) => Fe(s, 0, 10, t),
|
|
1883
1883
|
stringify: K
|
|
1884
|
-
},
|
|
1885
|
-
identify:
|
|
1884
|
+
}, yn = {
|
|
1885
|
+
identify: ke,
|
|
1886
1886
|
default: !0,
|
|
1887
1887
|
tag: "tag:yaml.org,2002:int",
|
|
1888
1888
|
format: "HEX",
|
|
1889
1889
|
test: /^[-+]?0x[0-9a-fA-F_]+$/,
|
|
1890
|
-
resolve: (s, e, t) =>
|
|
1891
|
-
stringify: (s) =>
|
|
1890
|
+
resolve: (s, e, t) => Fe(s, 2, 16, t),
|
|
1891
|
+
stringify: (s) => bt(s, 16, "0x")
|
|
1892
1892
|
};
|
|
1893
1893
|
class ie extends M {
|
|
1894
1894
|
constructor(e) {
|
|
@@ -1904,7 +1904,7 @@ class ie extends M {
|
|
|
1904
1904
|
*/
|
|
1905
1905
|
get(e, t) {
|
|
1906
1906
|
const n = H(this.items, e);
|
|
1907
|
-
return !t && $(n) ?
|
|
1907
|
+
return !t && $(n) ? v(n.key) ? n.key.value : n.key : n;
|
|
1908
1908
|
}
|
|
1909
1909
|
set(e, t) {
|
|
1910
1910
|
if (typeof t != "boolean")
|
|
@@ -1926,12 +1926,12 @@ class ie extends M {
|
|
|
1926
1926
|
const { replacer: i } = n, r = new this(e);
|
|
1927
1927
|
if (t && Symbol.iterator in Object(t))
|
|
1928
1928
|
for (let o of t)
|
|
1929
|
-
typeof i == "function" && (o = i.call(t, o, o)), r.items.push(
|
|
1929
|
+
typeof i == "function" && (o = i.call(t, o, o)), r.items.push(ht(o, null, n));
|
|
1930
1930
|
return r;
|
|
1931
1931
|
}
|
|
1932
1932
|
}
|
|
1933
1933
|
ie.tag = "tag:yaml.org,2002:set";
|
|
1934
|
-
const
|
|
1934
|
+
const wt = {
|
|
1935
1935
|
collection: "map",
|
|
1936
1936
|
identify: (s) => s instanceof Set,
|
|
1937
1937
|
nodeClass: ie,
|
|
@@ -1939,7 +1939,7 @@ const yt = {
|
|
|
1939
1939
|
tag: "tag:yaml.org,2002:set",
|
|
1940
1940
|
createNode: (s, e, t) => ie.from(s, e, t),
|
|
1941
1941
|
resolve(s, e) {
|
|
1942
|
-
if (
|
|
1942
|
+
if (we(s)) {
|
|
1943
1943
|
if (s.hasAllNullValues(!0))
|
|
1944
1944
|
return Object.assign(new ie(), s);
|
|
1945
1945
|
e("Set items must all have null values");
|
|
@@ -1948,11 +1948,11 @@ const yt = {
|
|
|
1948
1948
|
return s;
|
|
1949
1949
|
}
|
|
1950
1950
|
};
|
|
1951
|
-
function
|
|
1951
|
+
function St(s, e) {
|
|
1952
1952
|
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));
|
|
1953
1953
|
return t === "-" ? i(-1) * r : r;
|
|
1954
1954
|
}
|
|
1955
|
-
function
|
|
1955
|
+
function gs(s) {
|
|
1956
1956
|
let { value: e } = s, t = (o) => o;
|
|
1957
1957
|
if (typeof e == "bigint")
|
|
1958
1958
|
t = (o) => BigInt(o);
|
|
@@ -1963,23 +1963,23 @@ function ms(s) {
|
|
|
1963
1963
|
const i = t(60), r = [e % i];
|
|
1964
1964
|
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*$/, "");
|
|
1965
1965
|
}
|
|
1966
|
-
const
|
|
1966
|
+
const ys = {
|
|
1967
1967
|
identify: (s) => typeof s == "bigint" || Number.isInteger(s),
|
|
1968
1968
|
default: !0,
|
|
1969
1969
|
tag: "tag:yaml.org,2002:int",
|
|
1970
1970
|
format: "TIME",
|
|
1971
1971
|
test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,
|
|
1972
|
-
resolve: (s, e, { intAsBigInt: t }) =>
|
|
1973
|
-
stringify:
|
|
1974
|
-
},
|
|
1972
|
+
resolve: (s, e, { intAsBigInt: t }) => St(s, t),
|
|
1973
|
+
stringify: gs
|
|
1974
|
+
}, bs = {
|
|
1975
1975
|
identify: (s) => typeof s == "number",
|
|
1976
1976
|
default: !0,
|
|
1977
1977
|
tag: "tag:yaml.org,2002:float",
|
|
1978
1978
|
format: "TIME",
|
|
1979
1979
|
test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,
|
|
1980
|
-
resolve: (s) =>
|
|
1981
|
-
stringify:
|
|
1982
|
-
},
|
|
1980
|
+
resolve: (s) => St(s, !1),
|
|
1981
|
+
stringify: gs
|
|
1982
|
+
}, qe = {
|
|
1983
1983
|
identify: (s) => s instanceof Date,
|
|
1984
1984
|
default: !0,
|
|
1985
1985
|
tag: "tag:yaml.org,2002:timestamp",
|
|
@@ -1988,75 +1988,75 @@ const gs = {
|
|
|
1988
1988
|
// assumed to be 00:00:00Z (start of day, UTC).
|
|
1989
1989
|
test: RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),
|
|
1990
1990
|
resolve(s) {
|
|
1991
|
-
const e = s.match(
|
|
1991
|
+
const e = s.match(qe.test);
|
|
1992
1992
|
if (!e)
|
|
1993
1993
|
throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");
|
|
1994
1994
|
const [, t, n, i, r, o, l] = e.map(Number), a = e[7] ? Number((e[7] + "00").substr(1, 3)) : 0;
|
|
1995
1995
|
let c = Date.UTC(t, n - 1, i, r || 0, o || 0, l || 0, a);
|
|
1996
1996
|
const d = e[8];
|
|
1997
1997
|
if (d && d !== "Z") {
|
|
1998
|
-
let u =
|
|
1998
|
+
let u = St(d, !1);
|
|
1999
1999
|
Math.abs(u) < 30 && (u *= 60), c -= 6e4 * u;
|
|
2000
2000
|
}
|
|
2001
2001
|
return new Date(c);
|
|
2002
2002
|
},
|
|
2003
2003
|
stringify: ({ value: s }) => s?.toISOString().replace(/(T00:00:00)?\.000Z$/, "") ?? ""
|
|
2004
|
-
},
|
|
2004
|
+
}, vt = [
|
|
2005
2005
|
ce,
|
|
2006
2006
|
fe,
|
|
2007
|
-
xe,
|
|
2008
2007
|
Ke,
|
|
2009
|
-
|
|
2008
|
+
Re,
|
|
2010
2009
|
ps,
|
|
2011
|
-
|
|
2012
|
-
dn,
|
|
2010
|
+
ms,
|
|
2013
2011
|
pn,
|
|
2014
2012
|
mn,
|
|
2015
|
-
|
|
2016
|
-
|
|
2013
|
+
gn,
|
|
2014
|
+
yn,
|
|
2017
2015
|
un,
|
|
2018
|
-
|
|
2019
|
-
|
|
2016
|
+
hn,
|
|
2017
|
+
dn,
|
|
2020
2018
|
mt,
|
|
2021
|
-
|
|
2019
|
+
F,
|
|
2022
2020
|
yt,
|
|
2023
|
-
|
|
2021
|
+
gt,
|
|
2022
|
+
wt,
|
|
2024
2023
|
ys,
|
|
2025
|
-
|
|
2024
|
+
bs,
|
|
2025
|
+
qe
|
|
2026
2026
|
], It = /* @__PURE__ */ new Map([
|
|
2027
|
-
["core",
|
|
2028
|
-
["failsafe", [ce, fe,
|
|
2029
|
-
["json",
|
|
2030
|
-
["yaml11",
|
|
2031
|
-
["yaml-1.1",
|
|
2027
|
+
["core", ln],
|
|
2028
|
+
["failsafe", [ce, fe, Ke]],
|
|
2029
|
+
["json", fn],
|
|
2030
|
+
["yaml11", vt],
|
|
2031
|
+
["yaml-1.1", vt]
|
|
2032
2032
|
]), At = {
|
|
2033
|
-
binary:
|
|
2034
|
-
bool:
|
|
2035
|
-
float:
|
|
2036
|
-
floatExp:
|
|
2037
|
-
floatNaN:
|
|
2038
|
-
floatTime:
|
|
2039
|
-
int:
|
|
2040
|
-
intHex:
|
|
2041
|
-
intOct:
|
|
2042
|
-
intTime:
|
|
2033
|
+
binary: mt,
|
|
2034
|
+
bool: dt,
|
|
2035
|
+
float: os,
|
|
2036
|
+
floatExp: rs,
|
|
2037
|
+
floatNaN: is,
|
|
2038
|
+
floatTime: bs,
|
|
2039
|
+
int: cs,
|
|
2040
|
+
intHex: fs,
|
|
2041
|
+
intOct: as,
|
|
2042
|
+
intTime: ys,
|
|
2043
2043
|
map: ce,
|
|
2044
2044
|
merge: F,
|
|
2045
|
-
null:
|
|
2046
|
-
omap:
|
|
2047
|
-
pairs:
|
|
2045
|
+
null: Re,
|
|
2046
|
+
omap: yt,
|
|
2047
|
+
pairs: gt,
|
|
2048
2048
|
seq: fe,
|
|
2049
|
-
set:
|
|
2050
|
-
timestamp:
|
|
2051
|
-
},
|
|
2052
|
-
"tag:yaml.org,2002:binary":
|
|
2049
|
+
set: wt,
|
|
2050
|
+
timestamp: qe
|
|
2051
|
+
}, bn = {
|
|
2052
|
+
"tag:yaml.org,2002:binary": mt,
|
|
2053
2053
|
"tag:yaml.org,2002:merge": F,
|
|
2054
|
-
"tag:yaml.org,2002:omap":
|
|
2055
|
-
"tag:yaml.org,2002:pairs":
|
|
2056
|
-
"tag:yaml.org,2002:set":
|
|
2057
|
-
"tag:yaml.org,2002:timestamp":
|
|
2054
|
+
"tag:yaml.org,2002:omap": yt,
|
|
2055
|
+
"tag:yaml.org,2002:pairs": gt,
|
|
2056
|
+
"tag:yaml.org,2002:set": wt,
|
|
2057
|
+
"tag:yaml.org,2002:timestamp": qe
|
|
2058
2058
|
};
|
|
2059
|
-
function
|
|
2059
|
+
function Ye(s, e, t) {
|
|
2060
2060
|
const n = It.get(e);
|
|
2061
2061
|
if (n && !s)
|
|
2062
2062
|
return t && !n.includes(F) ? n.concat(F) : n.slice();
|
|
@@ -2081,17 +2081,17 @@ function Je(s, e, t) {
|
|
|
2081
2081
|
return r.includes(l) || r.push(l), r;
|
|
2082
2082
|
}, []);
|
|
2083
2083
|
}
|
|
2084
|
-
const
|
|
2085
|
-
class
|
|
2084
|
+
const wn = (s, e) => s.key < e.key ? -1 : s.key > e.key ? 1 : 0;
|
|
2085
|
+
class kt {
|
|
2086
2086
|
constructor({ compat: e, customTags: t, merge: n, resolveKnownTags: i, schema: r, sortMapEntries: o, toStringDefaults: l }) {
|
|
2087
|
-
this.compat = Array.isArray(e) ?
|
|
2087
|
+
this.compat = Array.isArray(e) ? Ye(e, "compat") : e ? Ye(null, e) : null, this.name = typeof r == "string" && r || "core", this.knownTags = i ? bn : {}, this.tags = Ye(t, this.name, n), this.toStringOptions = l ?? null, Object.defineProperty(this, J, { value: ce }), Object.defineProperty(this, R, { value: Ke }), Object.defineProperty(this, le, { value: fe }), this.sortMapEntries = typeof o == "function" ? o : o === !0 ? wn : null;
|
|
2088
2088
|
}
|
|
2089
2089
|
clone() {
|
|
2090
|
-
const e = Object.create(
|
|
2090
|
+
const e = Object.create(kt.prototype, Object.getOwnPropertyDescriptors(this));
|
|
2091
2091
|
return e.tags = this.tags.slice(), e;
|
|
2092
2092
|
}
|
|
2093
2093
|
}
|
|
2094
|
-
function
|
|
2094
|
+
function Sn(s, e) {
|
|
2095
2095
|
const t = [];
|
|
2096
2096
|
let n = e.directives === !0;
|
|
2097
2097
|
if (e.directives !== !1 && s.directives) {
|
|
@@ -2099,7 +2099,7 @@ function bn(s, e) {
|
|
|
2099
2099
|
a ? (t.push(a), n = !0) : s.directives.docStart && (n = !0);
|
|
2100
2100
|
}
|
|
2101
2101
|
n && t.push("---");
|
|
2102
|
-
const i =
|
|
2102
|
+
const i = Zt(s, e), { commentString: r } = i.options;
|
|
2103
2103
|
if (s.commentBefore) {
|
|
2104
2104
|
t.length !== 1 && t.unshift("");
|
|
2105
2105
|
const a = r(s.commentBefore);
|
|
@@ -2107,7 +2107,7 @@ function bn(s, e) {
|
|
|
2107
2107
|
}
|
|
2108
2108
|
let o = !1, l = null;
|
|
2109
2109
|
if (s.contents) {
|
|
2110
|
-
if (
|
|
2110
|
+
if (A(s.contents)) {
|
|
2111
2111
|
if (s.contents.spaceBefore && n && t.push(""), s.contents.commentBefore) {
|
|
2112
2112
|
const d = r(s.contents.commentBefore);
|
|
2113
2113
|
t.push(U(d, ""));
|
|
@@ -2134,9 +2134,9 @@ function bn(s, e) {
|
|
|
2134
2134
|
`) + `
|
|
2135
2135
|
`;
|
|
2136
2136
|
}
|
|
2137
|
-
class
|
|
2137
|
+
class Ve {
|
|
2138
2138
|
constructor(e, t, n) {
|
|
2139
|
-
this.commentBefore = null, this.comment = null, this.errors = [], this.warnings = [], Object.defineProperty(this,
|
|
2139
|
+
this.commentBefore = null, this.comment = null, this.errors = [], this.warnings = [], Object.defineProperty(this, P, { value: Ze });
|
|
2140
2140
|
let i = null;
|
|
2141
2141
|
typeof t == "function" || Array.isArray(t) ? i = t : n === void 0 && t && (n = t, t = void 0);
|
|
2142
2142
|
const r = Object.assign({
|
|
@@ -2159,10 +2159,10 @@ class qe {
|
|
|
2159
2159
|
* Custom Node values that inherit from `Object` still refer to their original instances.
|
|
2160
2160
|
*/
|
|
2161
2161
|
clone() {
|
|
2162
|
-
const e = Object.create(
|
|
2163
|
-
[
|
|
2162
|
+
const e = Object.create(Ve.prototype, {
|
|
2163
|
+
[P]: { value: Ze }
|
|
2164
2164
|
});
|
|
2165
|
-
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 =
|
|
2165
|
+
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;
|
|
2166
2166
|
}
|
|
2167
2167
|
/** Adds a value to the document. */
|
|
2168
2168
|
add(e) {
|
|
@@ -2183,11 +2183,11 @@ class qe {
|
|
|
2183
2183
|
*/
|
|
2184
2184
|
createAlias(e, t) {
|
|
2185
2185
|
if (!e.anchor) {
|
|
2186
|
-
const n =
|
|
2186
|
+
const n = Ht(this);
|
|
2187
2187
|
e.anchor = // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
2188
|
-
!t || n.has(t) ?
|
|
2188
|
+
!t || n.has(t) ? Wt(t || "a", n) : t;
|
|
2189
2189
|
}
|
|
2190
|
-
return new
|
|
2190
|
+
return new ft(e.anchor);
|
|
2191
2191
|
}
|
|
2192
2192
|
createNode(e, t, n) {
|
|
2193
2193
|
let i;
|
|
@@ -2197,7 +2197,7 @@ class qe {
|
|
|
2197
2197
|
const m = (w) => typeof w == "number" || w instanceof String || w instanceof Number, b = t.filter(m).map(String);
|
|
2198
2198
|
b.length > 0 && (t = t.concat(b)), i = t;
|
|
2199
2199
|
} else n === void 0 && t && (n = t, t = void 0);
|
|
2200
|
-
const { aliasDuplicateObjects: r, anchorPrefix: o, flow: l, keepUndefined: a, onTagObj: c, tag: d } = n ?? {}, { onAnchor: u, setAnchors: f, sourceObjects: p } =
|
|
2200
|
+
const { aliasDuplicateObjects: r, anchorPrefix: o, flow: l, keepUndefined: a, onTagObj: c, tag: d } = n ?? {}, { onAnchor: u, setAnchors: f, sourceObjects: p } = Gs(
|
|
2201
2201
|
this,
|
|
2202
2202
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
2203
2203
|
o || "a"
|
|
@@ -2210,7 +2210,7 @@ class qe {
|
|
|
2210
2210
|
schema: this.schema,
|
|
2211
2211
|
sourceObjects: p
|
|
2212
2212
|
}, h = ge(e, d, g);
|
|
2213
|
-
return l &&
|
|
2213
|
+
return l && I(h) && (h.flow = !0), f(), h;
|
|
2214
2214
|
}
|
|
2215
2215
|
/**
|
|
2216
2216
|
* Convert a key and a value into a `Pair` using the current schema,
|
|
@@ -2240,7 +2240,7 @@ class qe {
|
|
|
2240
2240
|
* `true` (collections are always returned intact).
|
|
2241
2241
|
*/
|
|
2242
2242
|
get(e, t) {
|
|
2243
|
-
return
|
|
2243
|
+
return I(this.contents) ? this.contents.get(e, t) : void 0;
|
|
2244
2244
|
}
|
|
2245
2245
|
/**
|
|
2246
2246
|
* Returns item at `path`, or `undefined` if not found. By default unwraps
|
|
@@ -2248,33 +2248,33 @@ class qe {
|
|
|
2248
2248
|
* `true` (collections are always returned intact).
|
|
2249
2249
|
*/
|
|
2250
2250
|
getIn(e, t) {
|
|
2251
|
-
return he(e) ? !t &&
|
|
2251
|
+
return he(e) ? !t && v(this.contents) ? this.contents.value : this.contents : I(this.contents) ? this.contents.getIn(e, t) : void 0;
|
|
2252
2252
|
}
|
|
2253
2253
|
/**
|
|
2254
2254
|
* Checks if the document includes a value with the key `key`.
|
|
2255
2255
|
*/
|
|
2256
2256
|
has(e) {
|
|
2257
|
-
return
|
|
2257
|
+
return I(this.contents) ? this.contents.has(e) : !1;
|
|
2258
2258
|
}
|
|
2259
2259
|
/**
|
|
2260
2260
|
* Checks if the document includes a value at `path`.
|
|
2261
2261
|
*/
|
|
2262
2262
|
hasIn(e) {
|
|
2263
|
-
return he(e) ? this.contents !== void 0 :
|
|
2263
|
+
return he(e) ? this.contents !== void 0 : I(this.contents) ? this.contents.hasIn(e) : !1;
|
|
2264
2264
|
}
|
|
2265
2265
|
/**
|
|
2266
2266
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
2267
2267
|
* boolean to add/remove the item from the set.
|
|
2268
2268
|
*/
|
|
2269
2269
|
set(e, t) {
|
|
2270
|
-
this.contents == null ? this.contents =
|
|
2270
|
+
this.contents == null ? this.contents = Ce(this.schema, [e], t) : z(this.contents) && this.contents.set(e, t);
|
|
2271
2271
|
}
|
|
2272
2272
|
/**
|
|
2273
2273
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
2274
2274
|
* boolean to add/remove the item from the set.
|
|
2275
2275
|
*/
|
|
2276
2276
|
setIn(e, t) {
|
|
2277
|
-
he(e) ? this.contents = t : this.contents == null ? this.contents =
|
|
2277
|
+
he(e) ? this.contents = t : this.contents == null ? this.contents = Ce(this.schema, Array.from(e), t) : z(this.contents) && this.contents.setIn(e, t);
|
|
2278
2278
|
}
|
|
2279
2279
|
/**
|
|
2280
2280
|
* Change the YAML version and schema used by the document.
|
|
@@ -2305,7 +2305,7 @@ class qe {
|
|
|
2305
2305
|
if (t.schema instanceof Object)
|
|
2306
2306
|
this.schema = t.schema;
|
|
2307
2307
|
else if (n)
|
|
2308
|
-
this.schema = new
|
|
2308
|
+
this.schema = new kt(Object.assign(n, t));
|
|
2309
2309
|
else
|
|
2310
2310
|
throw new Error("With a null YAML version, the { schema: Schema } option is required");
|
|
2311
2311
|
}
|
|
@@ -2318,7 +2318,7 @@ class qe {
|
|
|
2318
2318
|
mapAsMap: n === !0,
|
|
2319
2319
|
mapKeyWarned: !1,
|
|
2320
2320
|
maxAliasCount: typeof i == "number" ? i : 100
|
|
2321
|
-
}, a =
|
|
2321
|
+
}, a = D(this.contents, t ?? "", l);
|
|
2322
2322
|
if (typeof r == "function")
|
|
2323
2323
|
for (const { count: c, res: d } of l.anchors.values())
|
|
2324
2324
|
r(d, c);
|
|
@@ -2341,30 +2341,30 @@ class qe {
|
|
|
2341
2341
|
const t = JSON.stringify(e.indent);
|
|
2342
2342
|
throw new Error(`"indent" option must be a positive integer, not ${t}`);
|
|
2343
2343
|
}
|
|
2344
|
-
return
|
|
2344
|
+
return Sn(this, e);
|
|
2345
2345
|
}
|
|
2346
2346
|
}
|
|
2347
2347
|
function z(s) {
|
|
2348
|
-
if (
|
|
2348
|
+
if (I(s))
|
|
2349
2349
|
return !0;
|
|
2350
2350
|
throw new Error("Expected a YAML collection as document contents");
|
|
2351
2351
|
}
|
|
2352
|
-
class
|
|
2352
|
+
class ws extends Error {
|
|
2353
2353
|
constructor(e, t, n, i) {
|
|
2354
2354
|
super(), this.name = e, this.code = n, this.message = i, this.pos = t;
|
|
2355
2355
|
}
|
|
2356
2356
|
}
|
|
2357
|
-
class de extends
|
|
2357
|
+
class de extends ws {
|
|
2358
2358
|
constructor(e, t, n) {
|
|
2359
2359
|
super("YAMLParseError", e, t, n);
|
|
2360
2360
|
}
|
|
2361
2361
|
}
|
|
2362
|
-
class
|
|
2362
|
+
class kn extends ws {
|
|
2363
2363
|
constructor(e, t, n) {
|
|
2364
2364
|
super("YAMLWarning", e, t, n);
|
|
2365
2365
|
}
|
|
2366
2366
|
}
|
|
2367
|
-
const
|
|
2367
|
+
const $t = (s, e) => (t) => {
|
|
2368
2368
|
if (t.pos[0] === -1)
|
|
2369
2369
|
return;
|
|
2370
2370
|
t.linePos = t.pos.map((l) => e.linePos(l));
|
|
@@ -2476,21 +2476,21 @@ function ye(s) {
|
|
|
2476
2476
|
return !0;
|
|
2477
2477
|
}
|
|
2478
2478
|
}
|
|
2479
|
-
function
|
|
2479
|
+
function nt(s, e, t) {
|
|
2480
2480
|
if (e?.type === "flow-collection") {
|
|
2481
2481
|
const n = e.end[0];
|
|
2482
2482
|
n.indent === s && (n.source === "]" || n.source === "}") && ye(e) && t(n, "BAD_INDENT", "Flow end indicator should be more indented than parent", !0);
|
|
2483
2483
|
}
|
|
2484
2484
|
}
|
|
2485
|
-
function
|
|
2485
|
+
function Ss(s, e, t) {
|
|
2486
2486
|
const { uniqueKeys: n } = s.options;
|
|
2487
2487
|
if (n === !1)
|
|
2488
2488
|
return !1;
|
|
2489
|
-
const i = typeof n == "function" ? n : (r, o) => r === o ||
|
|
2489
|
+
const i = typeof n == "function" ? n : (r, o) => r === o || v(r) && v(o) && r.value === o.value;
|
|
2490
2490
|
return e.some((r) => i(r.key, t));
|
|
2491
2491
|
}
|
|
2492
|
-
const
|
|
2493
|
-
function
|
|
2492
|
+
const Lt = "All mapping items must start at the same column";
|
|
2493
|
+
function _n({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
2494
2494
|
const o = r?.nodeClass ?? M, l = new o(t.schema);
|
|
2495
2495
|
t.atRoot && (t.atRoot = !1);
|
|
2496
2496
|
let a = n.offset, c = null;
|
|
@@ -2504,16 +2504,16 @@ function Sn({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
2504
2504
|
startOnNewline: !0
|
|
2505
2505
|
}), m = !h.found;
|
|
2506
2506
|
if (m) {
|
|
2507
|
-
if (f && (f.type === "block-seq" ? i(a, "BLOCK_AS_IMPLICIT_KEY", "A block sequence may not be used as an implicit map key") : "indent" in f && f.indent !== n.indent && i(a, "BAD_INDENT",
|
|
2507
|
+
if (f && (f.type === "block-seq" ? i(a, "BLOCK_AS_IMPLICIT_KEY", "A block sequence may not be used as an implicit map key") : "indent" in f && f.indent !== n.indent && i(a, "BAD_INDENT", Lt)), !h.anchor && !h.tag && !p) {
|
|
2508
2508
|
c = h.end, h.comment && (l.comment ? l.comment += `
|
|
2509
2509
|
` + h.comment : l.comment = h.comment);
|
|
2510
2510
|
continue;
|
|
2511
2511
|
}
|
|
2512
2512
|
(h.newlineAfterProp || ye(f)) && i(f ?? u[u.length - 1], "MULTILINE_IMPLICIT_KEY", "Implicit keys need to be on a single line");
|
|
2513
|
-
} else h.found?.indent !== n.indent && i(a, "BAD_INDENT",
|
|
2513
|
+
} else h.found?.indent !== n.indent && i(a, "BAD_INDENT", Lt);
|
|
2514
2514
|
t.atKey = !0;
|
|
2515
2515
|
const b = h.end, w = f ? s(t, f, h, i) : e(t, b, u, null, h, i);
|
|
2516
|
-
t.schema.compat &&
|
|
2516
|
+
t.schema.compat && nt(n.indent, f, i), t.atKey = !1, Ss(t, l.items, w) && i(b, "DUPLICATE_KEY", "Map keys must be unique");
|
|
2517
2517
|
const S = oe(p ?? [], {
|
|
2518
2518
|
indicator: "map-value-ind",
|
|
2519
2519
|
next: g,
|
|
@@ -2525,7 +2525,7 @@ function Sn({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
2525
2525
|
if (a = S.end, S.found) {
|
|
2526
2526
|
m && (g?.type === "block-map" && !S.hasNewline && i(a, "BLOCK_AS_IMPLICIT_KEY", "Nested mappings are not allowed in compact mappings"), t.options.strict && h.start < S.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"));
|
|
2527
2527
|
const k = g ? s(t, g, S, i) : e(t, a, p, null, S, i);
|
|
2528
|
-
t.schema.compat &&
|
|
2528
|
+
t.schema.compat && nt(n.indent, g, i), a = k.range[2];
|
|
2529
2529
|
const _ = new B(w, k);
|
|
2530
2530
|
t.options.keepSourceTokens && (_.srcToken = d), l.items.push(_);
|
|
2531
2531
|
} else {
|
|
@@ -2537,7 +2537,7 @@ function Sn({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
2537
2537
|
}
|
|
2538
2538
|
return c && c < a && i(c, "IMPOSSIBLE", "Map comment with trailing content"), l.range = [n.offset, a, c ?? a], l;
|
|
2539
2539
|
}
|
|
2540
|
-
function
|
|
2540
|
+
function Nn({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
2541
2541
|
const o = r?.nodeClass ?? W, l = new o(t.schema);
|
|
2542
2542
|
t.atRoot && (t.atRoot = !1), t.atKey && (t.atKey = !1);
|
|
2543
2543
|
let a = n.offset, c = null;
|
|
@@ -2558,11 +2558,11 @@ function kn({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
2558
2558
|
continue;
|
|
2559
2559
|
}
|
|
2560
2560
|
const p = u ? s(t, u, f, i) : e(t, f.end, d, null, f, i);
|
|
2561
|
-
t.schema.compat &&
|
|
2561
|
+
t.schema.compat && nt(n.indent, u, i), a = p.range[2], l.items.push(p);
|
|
2562
2562
|
}
|
|
2563
2563
|
return l.range = [n.offset, a, c ?? a], l;
|
|
2564
2564
|
}
|
|
2565
|
-
function
|
|
2565
|
+
function _e(s, e, t, n) {
|
|
2566
2566
|
let i = "";
|
|
2567
2567
|
if (s) {
|
|
2568
2568
|
let r = !1, o = "";
|
|
@@ -2589,8 +2589,8 @@ function ke(s, e, t, n) {
|
|
|
2589
2589
|
}
|
|
2590
2590
|
return { comment: i, offset: e };
|
|
2591
2591
|
}
|
|
2592
|
-
const
|
|
2593
|
-
function
|
|
2592
|
+
const Ge = "Block collections are not allowed within flow collections", He = (s) => s && (s.type === "block-map" || s.type === "block-seq");
|
|
2593
|
+
function On({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
2594
2594
|
const o = n.start.source === "{", l = o ? "flow map" : "flow sequence", a = r?.nodeClass ?? (o ? M : W), c = new a(t.schema);
|
|
2595
2595
|
c.flow = !0;
|
|
2596
2596
|
const d = t.atRoot;
|
|
@@ -2642,11 +2642,11 @@ function _n({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
2642
2642
|
}
|
|
2643
2643
|
if (!o && !k && !O.found) {
|
|
2644
2644
|
const T = _ ? s(t, _, O, i) : e(t, O.end, k, null, O, i);
|
|
2645
|
-
c.items.push(T), u = T.range[2],
|
|
2645
|
+
c.items.push(T), u = T.range[2], He(_) && i(T.range, "BLOCK_IN_FLOW", Ge);
|
|
2646
2646
|
} else {
|
|
2647
2647
|
t.atKey = !0;
|
|
2648
2648
|
const T = O.end, y = S ? s(t, S, O, i) : e(t, T, w, null, O, i);
|
|
2649
|
-
|
|
2649
|
+
He(S) && i(y.range, "BLOCK_IN_FLOW", Ge), t.atKey = !1;
|
|
2650
2650
|
const L = oe(k ?? [], {
|
|
2651
2651
|
flow: l,
|
|
2652
2652
|
indicator: "map-value-ind",
|
|
@@ -2671,17 +2671,17 @@ function _n({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
2671
2671
|
}
|
|
2672
2672
|
} else _ && ("source" in _ && _.source?.[0] === ":" ? i(_, "MISSING_CHAR", `Missing space after : in ${l}`) : i(L.start, "MISSING_CHAR", `Missing , or : between ${l} items`));
|
|
2673
2673
|
const q = _ ? s(t, _, L, i) : L.found ? e(t, L.end, k, null, L, i) : null;
|
|
2674
|
-
q ?
|
|
2674
|
+
q ? He(_) && i(q.range, "BLOCK_IN_FLOW", Ge) : L.comment && (y.comment ? y.comment += `
|
|
2675
2675
|
` + L.comment : y.comment = L.comment);
|
|
2676
2676
|
const X = new B(y, q);
|
|
2677
2677
|
if (t.options.keepSourceTokens && (X.srcToken = b), o) {
|
|
2678
2678
|
const C = c;
|
|
2679
|
-
|
|
2679
|
+
Ss(t, C.items, y) && i(T, "DUPLICATE_KEY", "Map keys must be unique"), C.items.push(X);
|
|
2680
2680
|
} else {
|
|
2681
2681
|
const C = new M(t.schema);
|
|
2682
2682
|
C.flow = !0, C.items.push(X);
|
|
2683
|
-
const
|
|
2684
|
-
C.range = [y.range[0],
|
|
2683
|
+
const Ot = (q ?? y).range;
|
|
2684
|
+
C.range = [y.range[0], Ot[1], Ot[2]], c.items.push(C);
|
|
2685
2685
|
}
|
|
2686
2686
|
u = q ? q.range[2] : L.end;
|
|
2687
2687
|
}
|
|
@@ -2695,18 +2695,18 @@ function _n({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
2695
2695
|
i(u, d ? "MISSING_CHAR" : "BAD_INDENT", b), p && p.source.length !== 1 && g.unshift(p);
|
|
2696
2696
|
}
|
|
2697
2697
|
if (g.length > 0) {
|
|
2698
|
-
const m =
|
|
2698
|
+
const m = _e(g, h, t.options.strict, i);
|
|
2699
2699
|
m.comment && (c.comment ? c.comment += `
|
|
2700
2700
|
` + m.comment : c.comment = m.comment), c.range = [n.offset, h, m.offset];
|
|
2701
2701
|
} else
|
|
2702
2702
|
c.range = [n.offset, h, h];
|
|
2703
2703
|
return c;
|
|
2704
2704
|
}
|
|
2705
|
-
function
|
|
2706
|
-
const o = t.type === "block-map" ?
|
|
2705
|
+
function We(s, e, t, n, i, r) {
|
|
2706
|
+
const o = t.type === "block-map" ? _n(s, e, t, n, r) : t.type === "block-seq" ? Nn(s, e, t, n, r) : On(s, e, t, n, r), l = o.constructor;
|
|
2707
2707
|
return i === "!" || i === l.tagName ? (o.tag = l.tagName, o) : (i && (o.tag = i), o);
|
|
2708
2708
|
}
|
|
2709
|
-
function
|
|
2709
|
+
function En(s, e, t, n, i) {
|
|
2710
2710
|
const r = n.tag, o = r ? e.directives.tagName(r.source, (f) => i(r, "TAG_RESOLVE_FAILED", f)) : null;
|
|
2711
2711
|
if (t.type === "block-seq") {
|
|
2712
2712
|
const { anchor: f, newlineAfterProp: p } = n, g = f && r ? f.offset > r.offset ? f : r : f ?? r;
|
|
@@ -2714,23 +2714,23 @@ function Nn(s, e, t, n, i) {
|
|
|
2714
2714
|
}
|
|
2715
2715
|
const l = t.type === "block-map" ? "map" : t.type === "block-seq" ? "seq" : t.start.source === "{" ? "map" : "seq";
|
|
2716
2716
|
if (!r || !o || o === "!" || o === M.tagName && l === "map" || o === W.tagName && l === "seq")
|
|
2717
|
-
return
|
|
2717
|
+
return We(s, e, t, i, o);
|
|
2718
2718
|
let a = e.schema.tags.find((f) => f.tag === o && f.collection === l);
|
|
2719
2719
|
if (!a) {
|
|
2720
2720
|
const f = e.schema.knownTags[o];
|
|
2721
2721
|
if (f?.collection === l)
|
|
2722
2722
|
e.schema.tags.push(Object.assign({}, f, { default: !1 })), a = f;
|
|
2723
2723
|
else
|
|
2724
|
-
return f ? i(r, "BAD_COLLECTION_TYPE", `${f.tag} used for ${l} collection, but expects ${f.collection ?? "scalar"}`, !0) : i(r, "TAG_RESOLVE_FAILED", `Unresolved tag: ${o}`, !0),
|
|
2724
|
+
return f ? i(r, "BAD_COLLECTION_TYPE", `${f.tag} used for ${l} collection, but expects ${f.collection ?? "scalar"}`, !0) : i(r, "TAG_RESOLVE_FAILED", `Unresolved tag: ${o}`, !0), We(s, e, t, i, o);
|
|
2725
2725
|
}
|
|
2726
|
-
const c =
|
|
2726
|
+
const c = We(s, e, t, i, o, a), d = a.resolve?.(c, (f) => i(r, "TAG_RESOLVE_FAILED", f), e.options) ?? c, u = A(d) ? d : new N(d);
|
|
2727
2727
|
return u.range = c.range, u.tag = o, a?.format && (u.format = a.format), u;
|
|
2728
2728
|
}
|
|
2729
|
-
function
|
|
2730
|
-
const n = e.offset, i =
|
|
2729
|
+
function Tn(s, e, t) {
|
|
2730
|
+
const n = e.offset, i = vn(e, s.options.strict, t);
|
|
2731
2731
|
if (!i)
|
|
2732
2732
|
return { value: "", type: null, comment: "", range: [n, n, n] };
|
|
2733
|
-
const r = i.mode === ">" ? N.BLOCK_FOLDED : N.BLOCK_LITERAL, o = e.source ?
|
|
2733
|
+
const r = i.mode === ">" ? N.BLOCK_FOLDED : N.BLOCK_LITERAL, o = e.source ? In(e.source) : [];
|
|
2734
2734
|
let l = o.length;
|
|
2735
2735
|
for (let h = o.length - 1; h >= 0; --h) {
|
|
2736
2736
|
const m = o[h][1];
|
|
@@ -2799,7 +2799,7 @@ function On(s, e, t) {
|
|
|
2799
2799
|
const g = n + i.length + e.source.length;
|
|
2800
2800
|
return { value: u, type: r, comment: i.comment, range: [n, g, g] };
|
|
2801
2801
|
}
|
|
2802
|
-
function
|
|
2802
|
+
function vn({ offset: s, props: e }, t, n) {
|
|
2803
2803
|
if (e[0].type !== "block-scalar-header")
|
|
2804
2804
|
return n(e[0], "IMPOSSIBLE", "Block scalar header not found"), null;
|
|
2805
2805
|
const { source: i } = e[0], r = i[0];
|
|
@@ -2841,25 +2841,25 @@ function En({ offset: s, props: e }, t, n) {
|
|
|
2841
2841
|
}
|
|
2842
2842
|
return { mode: r, indent: o, chomp: l, comment: d, length: u };
|
|
2843
2843
|
}
|
|
2844
|
-
function
|
|
2844
|
+
function In(s) {
|
|
2845
2845
|
const e = s.split(/\n( *)/), t = e[0], n = t.match(/^( *)/), r = [n?.[1] ? [n[1], t.slice(n[1].length)] : ["", t]];
|
|
2846
2846
|
for (let o = 1; o < e.length; o += 2)
|
|
2847
2847
|
r.push([e[o], e[o + 1]]);
|
|
2848
2848
|
return r;
|
|
2849
2849
|
}
|
|
2850
|
-
function
|
|
2850
|
+
function An(s, e, t) {
|
|
2851
2851
|
const { offset: n, type: i, source: r, end: o } = s;
|
|
2852
2852
|
let l, a;
|
|
2853
2853
|
const c = (f, p, g) => t(n + f, p, g);
|
|
2854
2854
|
switch (i) {
|
|
2855
2855
|
case "scalar":
|
|
2856
|
-
l = N.PLAIN, a =
|
|
2856
|
+
l = N.PLAIN, a = $n(r, c);
|
|
2857
2857
|
break;
|
|
2858
2858
|
case "single-quoted-scalar":
|
|
2859
|
-
l = N.QUOTE_SINGLE, a =
|
|
2859
|
+
l = N.QUOTE_SINGLE, a = Ln(r, c);
|
|
2860
2860
|
break;
|
|
2861
2861
|
case "double-quoted-scalar":
|
|
2862
|
-
l = N.QUOTE_DOUBLE, a =
|
|
2862
|
+
l = N.QUOTE_DOUBLE, a = Cn(r, c);
|
|
2863
2863
|
break;
|
|
2864
2864
|
/* istanbul ignore next should not happen */
|
|
2865
2865
|
default:
|
|
@@ -2870,7 +2870,7 @@ function In(s, e, t) {
|
|
|
2870
2870
|
range: [n, n + r.length, n + r.length]
|
|
2871
2871
|
};
|
|
2872
2872
|
}
|
|
2873
|
-
const d = n + r.length, u =
|
|
2873
|
+
const d = n + r.length, u = _e(o, d, e, t);
|
|
2874
2874
|
return {
|
|
2875
2875
|
value: a,
|
|
2876
2876
|
type: l,
|
|
@@ -2878,7 +2878,7 @@ function In(s, e, t) {
|
|
|
2878
2878
|
range: [n, d, u.offset]
|
|
2879
2879
|
};
|
|
2880
2880
|
}
|
|
2881
|
-
function
|
|
2881
|
+
function $n(s, e) {
|
|
2882
2882
|
let t = "";
|
|
2883
2883
|
switch (s[0]) {
|
|
2884
2884
|
/* istanbul ignore next should not happen */
|
|
@@ -2902,12 +2902,12 @@ function An(s, e) {
|
|
|
2902
2902
|
break;
|
|
2903
2903
|
}
|
|
2904
2904
|
}
|
|
2905
|
-
return t && e(0, "BAD_SCALAR_START", `Plain value cannot start with ${t}`),
|
|
2905
|
+
return t && e(0, "BAD_SCALAR_START", `Plain value cannot start with ${t}`), ks(s);
|
|
2906
2906
|
}
|
|
2907
|
-
function
|
|
2908
|
-
return (s[s.length - 1] !== "'" || s.length === 1) && e(s.length, "MISSING_CHAR", "Missing closing 'quote"),
|
|
2907
|
+
function Ln(s, e) {
|
|
2908
|
+
return (s[s.length - 1] !== "'" || s.length === 1) && e(s.length, "MISSING_CHAR", "Missing closing 'quote"), ks(s.slice(1, -1)).replace(/''/g, "'");
|
|
2909
2909
|
}
|
|
2910
|
-
function
|
|
2910
|
+
function ks(s) {
|
|
2911
2911
|
let e, t;
|
|
2912
2912
|
try {
|
|
2913
2913
|
e = new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
@@ -2927,7 +2927,7 @@ function Ss(s) {
|
|
|
2927
2927
|
const l = /[ \t]*(.*)/sy;
|
|
2928
2928
|
return l.lastIndex = o, n = l.exec(s), i + r + (n?.[1] ?? "");
|
|
2929
2929
|
}
|
|
2930
|
-
function
|
|
2930
|
+
function Cn(s, e) {
|
|
2931
2931
|
let t = "";
|
|
2932
2932
|
for (let n = 1; n < s.length - 1; ++n) {
|
|
2933
2933
|
const i = s[n];
|
|
@@ -2935,11 +2935,11 @@ function $n(s, e) {
|
|
|
2935
2935
|
`))
|
|
2936
2936
|
if (i === `
|
|
2937
2937
|
`) {
|
|
2938
|
-
const { fold: r, offset: o } =
|
|
2938
|
+
const { fold: r, offset: o } = jn(s, n);
|
|
2939
2939
|
t += r, n = o;
|
|
2940
2940
|
} else if (i === "\\") {
|
|
2941
2941
|
let r = s[++n];
|
|
2942
|
-
const o =
|
|
2942
|
+
const o = Bn[r];
|
|
2943
2943
|
if (o)
|
|
2944
2944
|
t += o;
|
|
2945
2945
|
else if (r === `
|
|
@@ -2952,7 +2952,7 @@ function $n(s, e) {
|
|
|
2952
2952
|
r = s[++n + 1];
|
|
2953
2953
|
else if (r === "x" || r === "u" || r === "U") {
|
|
2954
2954
|
const l = { x: 2, u: 4, U: 8 }[r];
|
|
2955
|
-
t +=
|
|
2955
|
+
t += Mn(s, n + 1, l, e), n += l;
|
|
2956
2956
|
} else {
|
|
2957
2957
|
const l = s.substr(n - 1, 2);
|
|
2958
2958
|
e(n - 1, "BAD_DQ_ESCAPE", `Invalid escape sequence ${l}`), t += l;
|
|
@@ -2970,7 +2970,7 @@ function $n(s, e) {
|
|
|
2970
2970
|
}
|
|
2971
2971
|
return (s[s.length - 1] !== '"' || s.length === 1) && e(s.length, "MISSING_CHAR", 'Missing closing "quote'), t;
|
|
2972
2972
|
}
|
|
2973
|
-
function
|
|
2973
|
+
function jn(s, e) {
|
|
2974
2974
|
let t = "", n = s[e + 1];
|
|
2975
2975
|
for (; (n === " " || n === " " || n === `
|
|
2976
2976
|
` || n === "\r") && !(n === "\r" && s[e + 2] !== `
|
|
@@ -2980,7 +2980,7 @@ function Ln(s, e) {
|
|
|
2980
2980
|
`), e += 1, n = s[e + 1];
|
|
2981
2981
|
return t || (t = " "), { fold: t, offset: e };
|
|
2982
2982
|
}
|
|
2983
|
-
const
|
|
2983
|
+
const Bn = {
|
|
2984
2984
|
0: "\0",
|
|
2985
2985
|
// null character
|
|
2986
2986
|
a: "\x07",
|
|
@@ -3014,7 +3014,7 @@ const Cn = {
|
|
|
3014
3014
|
"\\": "\\",
|
|
3015
3015
|
" ": " "
|
|
3016
3016
|
};
|
|
3017
|
-
function
|
|
3017
|
+
function Mn(s, e, t, n) {
|
|
3018
3018
|
const i = s.substr(e, t), o = i.length === t && /^[0-9a-fA-F]+$/.test(i) ? parseInt(i, 16) : NaN;
|
|
3019
3019
|
if (isNaN(o)) {
|
|
3020
3020
|
const l = s.substr(e - 2, t + 2);
|
|
@@ -3022,21 +3022,21 @@ function jn(s, e, t, n) {
|
|
|
3022
3022
|
}
|
|
3023
3023
|
return String.fromCodePoint(o);
|
|
3024
3024
|
}
|
|
3025
|
-
function
|
|
3026
|
-
const { value: i, type: r, comment: o, range: l } = e.type === "block-scalar" ?
|
|
3025
|
+
function _s(s, e, t, n) {
|
|
3026
|
+
const { value: i, type: r, comment: o, range: l } = e.type === "block-scalar" ? Tn(s, e, n) : An(e, s.options.strict, n), a = t ? s.directives.tagName(t.source, (u) => n(t, "TAG_RESOLVE_FAILED", u)) : null;
|
|
3027
3027
|
let c;
|
|
3028
|
-
s.options.stringKeys && s.atKey ? c = s.schema[R] : a ? c =
|
|
3028
|
+
s.options.stringKeys && s.atKey ? c = s.schema[R] : a ? c = Dn(s.schema, i, a, t, n) : e.type === "scalar" ? c = Pn(s, i, e, n) : c = s.schema[R];
|
|
3029
3029
|
let d;
|
|
3030
3030
|
try {
|
|
3031
3031
|
const u = c.resolve(i, (f) => n(t ?? e, "TAG_RESOLVE_FAILED", f), s.options);
|
|
3032
|
-
d =
|
|
3032
|
+
d = v(u) ? u : new N(u);
|
|
3033
3033
|
} catch (u) {
|
|
3034
3034
|
const f = u instanceof Error ? u.message : String(u);
|
|
3035
3035
|
n(t ?? e, "TAG_RESOLVE_FAILED", f), d = new N(i);
|
|
3036
3036
|
}
|
|
3037
3037
|
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;
|
|
3038
3038
|
}
|
|
3039
|
-
function
|
|
3039
|
+
function Dn(s, e, t, n, i) {
|
|
3040
3040
|
if (t === "!")
|
|
3041
3041
|
return s[R];
|
|
3042
3042
|
const r = [];
|
|
@@ -3052,7 +3052,7 @@ function Bn(s, e, t, n, i) {
|
|
|
3052
3052
|
const o = s.knownTags[t];
|
|
3053
3053
|
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[R]);
|
|
3054
3054
|
}
|
|
3055
|
-
function
|
|
3055
|
+
function Pn({ atKey: s, directives: e, schema: t }, n, i, r) {
|
|
3056
3056
|
const o = t.tags.find((l) => (l.default === !0 || s && l.default === "key") && l.test?.test(n)) || t[R];
|
|
3057
3057
|
if (t.compat) {
|
|
3058
3058
|
const l = t.compat.find((a) => a.default && a.test?.test(n)) ?? t[R];
|
|
@@ -3063,7 +3063,7 @@ function Mn({ atKey: s, directives: e, schema: t }, n, i, r) {
|
|
|
3063
3063
|
}
|
|
3064
3064
|
return o;
|
|
3065
3065
|
}
|
|
3066
|
-
function
|
|
3066
|
+
function xn(s, e, t) {
|
|
3067
3067
|
if (e) {
|
|
3068
3068
|
t ?? (t = e.length);
|
|
3069
3069
|
for (let n = t - 1; n >= 0; --n) {
|
|
@@ -3082,49 +3082,49 @@ function Pn(s, e, t) {
|
|
|
3082
3082
|
}
|
|
3083
3083
|
return s;
|
|
3084
3084
|
}
|
|
3085
|
-
const
|
|
3086
|
-
function
|
|
3085
|
+
const Kn = { composeNode: Ns, composeEmptyNode: _t };
|
|
3086
|
+
function Ns(s, e, t, n) {
|
|
3087
3087
|
const i = s.atKey, { spaceBefore: r, comment: o, anchor: l, tag: a } = t;
|
|
3088
3088
|
let c, d = !0;
|
|
3089
3089
|
switch (e.type) {
|
|
3090
3090
|
case "alias":
|
|
3091
|
-
c =
|
|
3091
|
+
c = Rn(s, e, n), (l || a) && n(e, "ALIAS_PROPS", "An alias node must not specify any properties");
|
|
3092
3092
|
break;
|
|
3093
3093
|
case "scalar":
|
|
3094
3094
|
case "single-quoted-scalar":
|
|
3095
3095
|
case "double-quoted-scalar":
|
|
3096
3096
|
case "block-scalar":
|
|
3097
|
-
c =
|
|
3097
|
+
c = _s(s, e, a, n), l && (c.anchor = l.source.substring(1));
|
|
3098
3098
|
break;
|
|
3099
3099
|
case "block-map":
|
|
3100
3100
|
case "block-seq":
|
|
3101
3101
|
case "flow-collection":
|
|
3102
|
-
c =
|
|
3102
|
+
c = En(Kn, s, e, t, n), l && (c.anchor = l.source.substring(1));
|
|
3103
3103
|
break;
|
|
3104
3104
|
default: {
|
|
3105
3105
|
const u = e.type === "error" ? e.message : `Unsupported token (type: ${e.type})`;
|
|
3106
|
-
n(e, "UNEXPECTED_TOKEN", u), c =
|
|
3106
|
+
n(e, "UNEXPECTED_TOKEN", u), c = _t(s, e.offset, void 0, null, t, n), d = !1;
|
|
3107
3107
|
}
|
|
3108
3108
|
}
|
|
3109
|
-
return l && c.anchor === "" && n(l, "BAD_ALIAS", "Anchor cannot be an empty string"), i && s.options.stringKeys && (!
|
|
3109
|
+
return l && c.anchor === "" && n(l, "BAD_ALIAS", "Anchor cannot be an empty string"), i && s.options.stringKeys && (!v(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;
|
|
3110
3110
|
}
|
|
3111
|
-
function
|
|
3111
|
+
function _t(s, e, t, n, { spaceBefore: i, comment: r, anchor: o, tag: l, end: a }, c) {
|
|
3112
3112
|
const d = {
|
|
3113
3113
|
type: "scalar",
|
|
3114
|
-
offset:
|
|
3114
|
+
offset: xn(e, t, n),
|
|
3115
3115
|
indent: -1,
|
|
3116
3116
|
source: ""
|
|
3117
|
-
}, u =
|
|
3117
|
+
}, u = _s(s, d, l, c);
|
|
3118
3118
|
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] = a), u;
|
|
3119
3119
|
}
|
|
3120
|
-
function
|
|
3121
|
-
const r = new
|
|
3120
|
+
function Rn({ options: s }, { offset: e, source: t, end: n }, i) {
|
|
3121
|
+
const r = new ft(t.substring(1));
|
|
3122
3122
|
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);
|
|
3123
|
-
const o = e + t.length, l =
|
|
3123
|
+
const o = e + t.length, l = _e(n, o, s.strict, i);
|
|
3124
3124
|
return r.range = [e, o, l.offset], l.comment && (r.comment = l.comment), r;
|
|
3125
3125
|
}
|
|
3126
|
-
function
|
|
3127
|
-
const l = Object.assign({ _directives: e }, s), a = new
|
|
3126
|
+
function Un(s, e, { offset: t, start: n, value: i, end: r }, o) {
|
|
3127
|
+
const l = Object.assign({ _directives: e }, s), a = new Ve(void 0, l), c = {
|
|
3128
3128
|
atKey: !1,
|
|
3129
3129
|
atRoot: !0,
|
|
3130
3130
|
directives: a.directives,
|
|
@@ -3138,8 +3138,8 @@ function Kn(s, e, { offset: t, start: n, value: i, end: r }, o) {
|
|
|
3138
3138
|
parentIndent: 0,
|
|
3139
3139
|
startOnNewline: !0
|
|
3140
3140
|
});
|
|
3141
|
-
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 ?
|
|
3142
|
-
const u = a.contents.range[2], f =
|
|
3141
|
+
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 ? Ns(c, i, d, o) : _t(c, d.end, n, null, d, o);
|
|
3142
|
+
const u = a.contents.range[2], f = _e(r, u, !1, o);
|
|
3143
3143
|
return f.comment && (a.comment = f.comment), a.range = [t, u, f.offset], a;
|
|
3144
3144
|
}
|
|
3145
3145
|
function ue(s) {
|
|
@@ -3150,7 +3150,7 @@ function ue(s) {
|
|
|
3150
3150
|
const { offset: e, source: t } = s;
|
|
3151
3151
|
return [e, e + (typeof t == "string" ? t.length : 1)];
|
|
3152
3152
|
}
|
|
3153
|
-
function
|
|
3153
|
+
function Ct(s) {
|
|
3154
3154
|
let e = "", t = !1, n = !1;
|
|
3155
3155
|
for (let i = 0; i < s.length; ++i) {
|
|
3156
3156
|
const r = s[i];
|
|
@@ -3170,15 +3170,15 @@ function Lt(s) {
|
|
|
3170
3170
|
}
|
|
3171
3171
|
return { comment: e, afterEmptyLine: n };
|
|
3172
3172
|
}
|
|
3173
|
-
class
|
|
3173
|
+
class Fn {
|
|
3174
3174
|
constructor(e = {}) {
|
|
3175
3175
|
this.doc = null, this.atDirectives = !1, this.prelude = [], this.errors = [], this.warnings = [], this.onError = (t, n, i, r) => {
|
|
3176
3176
|
const o = ue(t);
|
|
3177
|
-
r ? this.warnings.push(new
|
|
3177
|
+
r ? this.warnings.push(new kn(o, n, i)) : this.errors.push(new de(o, n, i));
|
|
3178
3178
|
}, this.directives = new j({ version: e.version || "1.2" }), this.options = e;
|
|
3179
3179
|
}
|
|
3180
3180
|
decorate(e, t) {
|
|
3181
|
-
const { comment: n, afterEmptyLine: i } =
|
|
3181
|
+
const { comment: n, afterEmptyLine: i } = Ct(this.prelude);
|
|
3182
3182
|
if (n) {
|
|
3183
3183
|
const r = e.contents;
|
|
3184
3184
|
if (t)
|
|
@@ -3186,7 +3186,7 @@ class Rn {
|
|
|
3186
3186
|
${n}` : n;
|
|
3187
3187
|
else if (i || e.directives.docStart || !r)
|
|
3188
3188
|
e.commentBefore = n;
|
|
3189
|
-
else if (
|
|
3189
|
+
else if (I(r) && !r.flow && r.items.length > 0) {
|
|
3190
3190
|
let o = r.items[0];
|
|
3191
3191
|
$(o) && (o = o.key);
|
|
3192
3192
|
const l = o.commentBefore;
|
|
@@ -3207,7 +3207,7 @@ ${o}` : n;
|
|
|
3207
3207
|
*/
|
|
3208
3208
|
streamInfo() {
|
|
3209
3209
|
return {
|
|
3210
|
-
comment:
|
|
3210
|
+
comment: Ct(this.prelude).comment,
|
|
3211
3211
|
directives: this.directives,
|
|
3212
3212
|
errors: this.errors,
|
|
3213
3213
|
warnings: this.warnings
|
|
@@ -3234,7 +3234,7 @@ ${o}` : n;
|
|
|
3234
3234
|
}), this.prelude.push(e.source), this.atDirectives = !0;
|
|
3235
3235
|
break;
|
|
3236
3236
|
case "document": {
|
|
3237
|
-
const t =
|
|
3237
|
+
const t = Un(this.options, this.directives, e, this.onError);
|
|
3238
3238
|
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;
|
|
3239
3239
|
break;
|
|
3240
3240
|
}
|
|
@@ -3257,7 +3257,7 @@ ${o}` : n;
|
|
|
3257
3257
|
break;
|
|
3258
3258
|
}
|
|
3259
3259
|
this.doc.directives.docEnd = !0;
|
|
3260
|
-
const t =
|
|
3260
|
+
const t = _e(e.end, e.offset + e.source.length, this.doc.options.strict, this.onError);
|
|
3261
3261
|
if (this.decorate(this.doc, !0), t.comment) {
|
|
3262
3262
|
const n = this.doc.comment;
|
|
3263
3263
|
this.doc.comment = n ? `${n}
|
|
@@ -3280,21 +3280,21 @@ ${t.comment}` : t.comment;
|
|
|
3280
3280
|
if (this.doc)
|
|
3281
3281
|
this.decorate(this.doc, !0), yield this.doc, this.doc = null;
|
|
3282
3282
|
else if (e) {
|
|
3283
|
-
const n = Object.assign({ _directives: this.directives }, this.options), i = new
|
|
3283
|
+
const n = Object.assign({ _directives: this.directives }, this.options), i = new Ve(void 0, n);
|
|
3284
3284
|
this.atDirectives && this.onError(t, "MISSING_CHAR", "Missing directives-end indicator line"), i.range = [0, t, t], this.decorate(i, !1), yield i;
|
|
3285
3285
|
}
|
|
3286
3286
|
}
|
|
3287
3287
|
}
|
|
3288
|
-
const
|
|
3289
|
-
function
|
|
3288
|
+
const Os = "\uFEFF", Es = "", Ts = "", it = "";
|
|
3289
|
+
function qn(s) {
|
|
3290
3290
|
switch (s) {
|
|
3291
|
-
case Ns:
|
|
3292
|
-
return "byte-order-mark";
|
|
3293
3291
|
case Os:
|
|
3294
|
-
return "
|
|
3292
|
+
return "byte-order-mark";
|
|
3295
3293
|
case Es:
|
|
3294
|
+
return "doc-mode";
|
|
3295
|
+
case Ts:
|
|
3296
3296
|
return "flow-error-end";
|
|
3297
|
-
case
|
|
3297
|
+
case it:
|
|
3298
3298
|
return "scalar";
|
|
3299
3299
|
case "---":
|
|
3300
3300
|
return "doc-start";
|
|
@@ -3360,9 +3360,9 @@ function x(s) {
|
|
|
3360
3360
|
return !1;
|
|
3361
3361
|
}
|
|
3362
3362
|
}
|
|
3363
|
-
const
|
|
3364
|
-
\r `),
|
|
3365
|
-
class
|
|
3363
|
+
const jt = new Set("0123456789ABCDEFabcdef"), Vn = new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"), ve = new Set(",[]{}"), Jn = new Set(` ,[]{}
|
|
3364
|
+
\r `), Qe = (s) => !s || Jn.has(s);
|
|
3365
|
+
class Yn {
|
|
3366
3366
|
constructor() {
|
|
3367
3367
|
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;
|
|
3368
3368
|
}
|
|
@@ -3454,7 +3454,7 @@ class Vn {
|
|
|
3454
3454
|
let e = this.getLine();
|
|
3455
3455
|
if (e === null)
|
|
3456
3456
|
return this.setNext("stream");
|
|
3457
|
-
if (e[0] ===
|
|
3457
|
+
if (e[0] === Os && (yield* this.pushCount(1), e = e.substring(1)), e[0] === "%") {
|
|
3458
3458
|
let t = e.length, n = e.indexOf("#");
|
|
3459
3459
|
for (; n !== -1; ) {
|
|
3460
3460
|
const r = e[n - 1];
|
|
@@ -3478,7 +3478,7 @@ class Vn {
|
|
|
3478
3478
|
const t = yield* this.pushSpaces(!0);
|
|
3479
3479
|
return yield* this.pushCount(e.length - t), yield* this.pushNewline(), "stream";
|
|
3480
3480
|
}
|
|
3481
|
-
return yield
|
|
3481
|
+
return yield Es, yield* this.parseLineStart();
|
|
3482
3482
|
}
|
|
3483
3483
|
*parseLineStart() {
|
|
3484
3484
|
const e = this.charAt(0);
|
|
@@ -3522,7 +3522,7 @@ class Vn {
|
|
|
3522
3522
|
case "]":
|
|
3523
3523
|
return yield* this.pushCount(1), "doc";
|
|
3524
3524
|
case "*":
|
|
3525
|
-
return yield* this.pushUntil(
|
|
3525
|
+
return yield* this.pushUntil(Qe), "doc";
|
|
3526
3526
|
case '"':
|
|
3527
3527
|
case "'":
|
|
3528
3528
|
return yield* this.parseQuotedScalar();
|
|
@@ -3542,7 +3542,7 @@ class Vn {
|
|
|
3542
3542
|
if (i === null)
|
|
3543
3543
|
return this.setNext("flow");
|
|
3544
3544
|
if ((n !== -1 && n < this.indentNext && i[0] !== "#" || n === 0 && (i.startsWith("---") || i.startsWith("...")) && x(i[3])) && !(n === this.indentNext - 1 && this.flowLevel === 1 && (i[0] === "]" || i[0] === "}")))
|
|
3545
|
-
return this.flowLevel = 0, yield
|
|
3545
|
+
return this.flowLevel = 0, yield Ts, yield* this.parseLineStart();
|
|
3546
3546
|
let r = 0;
|
|
3547
3547
|
for (; i[r] === ","; )
|
|
3548
3548
|
r += yield* this.pushCount(1), r += yield* this.pushSpaces(!0), this.flowKey = !1;
|
|
@@ -3558,7 +3558,7 @@ class Vn {
|
|
|
3558
3558
|
case "]":
|
|
3559
3559
|
return yield* this.pushCount(1), this.flowKey = !0, this.flowLevel -= 1, this.flowLevel ? "flow" : "doc";
|
|
3560
3560
|
case "*":
|
|
3561
|
-
return yield* this.pushUntil(
|
|
3561
|
+
return yield* this.pushUntil(Qe), "flow";
|
|
3562
3562
|
case '"':
|
|
3563
3563
|
case "'":
|
|
3564
3564
|
return this.flowKey = !0, yield* this.parseQuotedScalar();
|
|
@@ -3682,7 +3682,7 @@ class Vn {
|
|
|
3682
3682
|
else
|
|
3683
3683
|
break;
|
|
3684
3684
|
} while (!0);
|
|
3685
|
-
return yield
|
|
3685
|
+
return yield it, yield* this.pushToIndex(e + 1, !0), yield* this.parseLineStart();
|
|
3686
3686
|
}
|
|
3687
3687
|
*parsePlainScalar() {
|
|
3688
3688
|
const e = this.flowLevel > 0;
|
|
@@ -3690,14 +3690,14 @@ class Vn {
|
|
|
3690
3690
|
for (; i = this.buffer[++n]; )
|
|
3691
3691
|
if (i === ":") {
|
|
3692
3692
|
const r = this.buffer[n + 1];
|
|
3693
|
-
if (x(r) || e &&
|
|
3693
|
+
if (x(r) || e && ve.has(r))
|
|
3694
3694
|
break;
|
|
3695
3695
|
t = n;
|
|
3696
3696
|
} else if (x(i)) {
|
|
3697
3697
|
let r = this.buffer[n + 1];
|
|
3698
3698
|
if (i === "\r" && (r === `
|
|
3699
3699
|
` ? (n += 1, i = `
|
|
3700
|
-
`, r = this.buffer[n + 1]) : t = n), r === "#" || e &&
|
|
3700
|
+
`, r = this.buffer[n + 1]) : t = n), r === "#" || e && ve.has(r))
|
|
3701
3701
|
break;
|
|
3702
3702
|
if (i === `
|
|
3703
3703
|
`) {
|
|
@@ -3707,11 +3707,11 @@ class Vn {
|
|
|
3707
3707
|
n = Math.max(n, o - 2);
|
|
3708
3708
|
}
|
|
3709
3709
|
} else {
|
|
3710
|
-
if (e &&
|
|
3710
|
+
if (e && ve.has(i))
|
|
3711
3711
|
break;
|
|
3712
3712
|
t = n;
|
|
3713
3713
|
}
|
|
3714
|
-
return !i && !this.atEnd ? this.setNext("plain-scalar") : (yield
|
|
3714
|
+
return !i && !this.atEnd ? this.setNext("plain-scalar") : (yield it, yield* this.pushToIndex(t + 1, !0), e ? "flow" : "doc");
|
|
3715
3715
|
}
|
|
3716
3716
|
*pushCount(e) {
|
|
3717
3717
|
return e > 0 ? (yield this.buffer.substr(this.pos, e), this.pos += e, e) : 0;
|
|
@@ -3725,14 +3725,14 @@ class Vn {
|
|
|
3725
3725
|
case "!":
|
|
3726
3726
|
return (yield* this.pushTag()) + (yield* this.pushSpaces(!0)) + (yield* this.pushIndicators());
|
|
3727
3727
|
case "&":
|
|
3728
|
-
return (yield* this.pushUntil(
|
|
3728
|
+
return (yield* this.pushUntil(Qe)) + (yield* this.pushSpaces(!0)) + (yield* this.pushIndicators());
|
|
3729
3729
|
case "-":
|
|
3730
3730
|
// this is an error
|
|
3731
3731
|
case "?":
|
|
3732
3732
|
// this is an error outside flow collections
|
|
3733
3733
|
case ":": {
|
|
3734
3734
|
const e = this.flowLevel > 0, t = this.charAt(1);
|
|
3735
|
-
if (x(t) || e &&
|
|
3735
|
+
if (x(t) || e && ve.has(t))
|
|
3736
3736
|
return e ? this.flowKey && (this.flowKey = !1) : this.indentNext = this.indentValue + 1, (yield* this.pushCount(1)) + (yield* this.pushSpaces(!0)) + (yield* this.pushIndicators());
|
|
3737
3737
|
}
|
|
3738
3738
|
}
|
|
@@ -3747,9 +3747,9 @@ class Vn {
|
|
|
3747
3747
|
} else {
|
|
3748
3748
|
let e = this.pos + 1, t = this.buffer[e];
|
|
3749
3749
|
for (; t; )
|
|
3750
|
-
if (
|
|
3750
|
+
if (Vn.has(t))
|
|
3751
3751
|
t = this.buffer[++e];
|
|
3752
|
-
else if (t === "%" &&
|
|
3752
|
+
else if (t === "%" && jt.has(this.buffer[e + 1]) && jt.has(this.buffer[e + 2]))
|
|
3753
3753
|
t = this.buffer[e += 3];
|
|
3754
3754
|
else
|
|
3755
3755
|
break;
|
|
@@ -3777,7 +3777,7 @@ class Vn {
|
|
|
3777
3777
|
return yield* this.pushToIndex(t, !1);
|
|
3778
3778
|
}
|
|
3779
3779
|
}
|
|
3780
|
-
class
|
|
3780
|
+
class Gn {
|
|
3781
3781
|
constructor() {
|
|
3782
3782
|
this.lineStarts = [], this.addNewLine = (e) => this.lineStarts.push(e), this.linePos = (e) => {
|
|
3783
3783
|
let t = 0, n = this.lineStarts.length;
|
|
@@ -3800,7 +3800,7 @@ function V(s, e) {
|
|
|
3800
3800
|
return !0;
|
|
3801
3801
|
return !1;
|
|
3802
3802
|
}
|
|
3803
|
-
function
|
|
3803
|
+
function Bt(s) {
|
|
3804
3804
|
for (let e = 0; e < s.length; ++e)
|
|
3805
3805
|
switch (s[e].type) {
|
|
3806
3806
|
case "space":
|
|
@@ -3812,7 +3812,7 @@ function jt(s) {
|
|
|
3812
3812
|
}
|
|
3813
3813
|
return -1;
|
|
3814
3814
|
}
|
|
3815
|
-
function
|
|
3815
|
+
function vs(s) {
|
|
3816
3816
|
switch (s?.type) {
|
|
3817
3817
|
case "alias":
|
|
3818
3818
|
case "scalar":
|
|
@@ -3856,18 +3856,18 @@ function Z(s) {
|
|
|
3856
3856
|
;
|
|
3857
3857
|
return s.splice(e, s.length);
|
|
3858
3858
|
}
|
|
3859
|
-
function
|
|
3859
|
+
function Mt(s) {
|
|
3860
3860
|
if (s.start.type === "flow-seq-start")
|
|
3861
3861
|
for (const e of s.items)
|
|
3862
|
-
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,
|
|
3862
|
+
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, vs(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);
|
|
3863
3863
|
}
|
|
3864
|
-
class
|
|
3864
|
+
class Hn {
|
|
3865
3865
|
/**
|
|
3866
3866
|
* @param onNewLine - If defined, called separately with the start position of
|
|
3867
3867
|
* each new line (in `parse()`, including the start of input).
|
|
3868
3868
|
*/
|
|
3869
3869
|
constructor(e) {
|
|
3870
|
-
this.atNewLine = !0, this.atScalar = !1, this.indent = 0, this.offset = 0, this.onKeyLine = !1, this.stack = [], this.source = "", this.type = "", this.lexer = new
|
|
3870
|
+
this.atNewLine = !0, this.atScalar = !1, this.indent = 0, this.offset = 0, this.onKeyLine = !1, this.stack = [], this.source = "", this.type = "", this.lexer = new Yn(), this.onNewLine = e;
|
|
3871
3871
|
}
|
|
3872
3872
|
/**
|
|
3873
3873
|
* Parse `source` as a YAML stream.
|
|
@@ -3891,7 +3891,7 @@ class Yn {
|
|
|
3891
3891
|
this.atScalar = !1, yield* this.step(), this.offset += e.length;
|
|
3892
3892
|
return;
|
|
3893
3893
|
}
|
|
3894
|
-
const t =
|
|
3894
|
+
const t = qn(e);
|
|
3895
3895
|
if (t)
|
|
3896
3896
|
if (t === "scalar")
|
|
3897
3897
|
this.atNewLine = !1, this.atScalar = !0, this.type = "scalar";
|
|
@@ -3980,7 +3980,7 @@ class Yn {
|
|
|
3980
3980
|
yield t;
|
|
3981
3981
|
else {
|
|
3982
3982
|
const n = this.peek(1);
|
|
3983
|
-
switch (t.type === "block-scalar" ? t.indent = "indent" in n ? n.indent : 0 : t.type === "flow-collection" && n.type === "document" && (t.indent = 0), t.type === "flow-collection" &&
|
|
3983
|
+
switch (t.type === "block-scalar" ? t.indent = "indent" in n ? n.indent : 0 : t.type === "flow-collection" && n.type === "document" && (t.indent = 0), t.type === "flow-collection" && Mt(t), n.type) {
|
|
3984
3984
|
case "document":
|
|
3985
3985
|
n.value = t;
|
|
3986
3986
|
break;
|
|
@@ -4016,7 +4016,7 @@ class Yn {
|
|
|
4016
4016
|
}
|
|
4017
4017
|
if ((n.type === "document" || n.type === "block-map" || n.type === "block-seq") && (t.type === "block-map" || t.type === "block-seq")) {
|
|
4018
4018
|
const i = t.items[t.items.length - 1];
|
|
4019
|
-
i && !i.sep && !i.value && i.start.length > 0 &&
|
|
4019
|
+
i && !i.sep && !i.value && i.start.length > 0 && Bt(i.start) === -1 && (t.indent === 0 || i.start.every((r) => r.type !== "comment" || r.indent < t.indent)) && (n.type === "document" ? n.end = i.start : n.items.push({ start: i.start }), t.items.splice(-1, 1));
|
|
4020
4020
|
}
|
|
4021
4021
|
}
|
|
4022
4022
|
}
|
|
@@ -4054,7 +4054,7 @@ class Yn {
|
|
|
4054
4054
|
return yield* this.lineEnd(e);
|
|
4055
4055
|
switch (this.type) {
|
|
4056
4056
|
case "doc-start": {
|
|
4057
|
-
|
|
4057
|
+
Bt(e.start) !== -1 ? (yield* this.pop(), yield* this.step()) : e.start.push(this.sourceToken);
|
|
4058
4058
|
return;
|
|
4059
4059
|
}
|
|
4060
4060
|
case "anchor":
|
|
@@ -4184,7 +4184,7 @@ class Yn {
|
|
|
4184
4184
|
indent: this.indent,
|
|
4185
4185
|
items: [{ start: r, key: null, sep: [this.sourceToken] }]
|
|
4186
4186
|
});
|
|
4187
|
-
else if (
|
|
4187
|
+
else if (vs(t.key) && !V(t.sep, "newline")) {
|
|
4188
4188
|
const o = Z(t.start), l = t.key, a = t.sep;
|
|
4189
4189
|
a.push(this.sourceToken), delete t.key, delete t.sep, this.stack.push({
|
|
4190
4190
|
type: "block-map",
|
|
@@ -4333,7 +4333,7 @@ class Yn {
|
|
|
4333
4333
|
yield* this.pop(), yield* this.step();
|
|
4334
4334
|
else if (this.type === "map-value-ind" && n.type !== "flow-collection") {
|
|
4335
4335
|
const i = Ie(n), r = Z(i);
|
|
4336
|
-
|
|
4336
|
+
Mt(e);
|
|
4337
4337
|
const o = e.end.splice(1, e.end.length);
|
|
4338
4338
|
o.push(this.sourceToken);
|
|
4339
4339
|
const l = {
|
|
@@ -4440,12 +4440,12 @@ class Yn {
|
|
|
4440
4440
|
}
|
|
4441
4441
|
}
|
|
4442
4442
|
}
|
|
4443
|
-
function
|
|
4443
|
+
function Wn(s) {
|
|
4444
4444
|
const e = s.prettyErrors !== !1;
|
|
4445
|
-
return { lineCounter: s.lineCounter || e && new
|
|
4445
|
+
return { lineCounter: s.lineCounter || e && new Gn() || null, prettyErrors: e };
|
|
4446
4446
|
}
|
|
4447
|
-
function
|
|
4448
|
-
const { lineCounter: t, prettyErrors: n } =
|
|
4447
|
+
function Qn(s, e = {}) {
|
|
4448
|
+
const { lineCounter: t, prettyErrors: n } = Wn(e), i = new Hn(t?.addNewLine), r = new Fn(e);
|
|
4449
4449
|
let o = null;
|
|
4450
4450
|
for (const l of r.compose(i.parse(s), !0, s.length))
|
|
4451
4451
|
if (!o)
|
|
@@ -4454,30 +4454,42 @@ function Hn(s, e = {}) {
|
|
|
4454
4454
|
o.errors.push(new de(l.range.slice(0, 2), "MULTIPLE_DOCS", "Source contains multiple documents; please use YAML.parseAllDocuments()"));
|
|
4455
4455
|
break;
|
|
4456
4456
|
}
|
|
4457
|
-
return n && t && (o.errors.forEach(
|
|
4457
|
+
return n && t && (o.errors.forEach($t(s, t)), o.warnings.forEach($t(s, t))), o;
|
|
4458
4458
|
}
|
|
4459
|
-
function
|
|
4459
|
+
function Xn(s, e, t) {
|
|
4460
4460
|
let n;
|
|
4461
|
-
const i =
|
|
4461
|
+
const i = Qn(s, t);
|
|
4462
4462
|
if (!i)
|
|
4463
4463
|
return null;
|
|
4464
|
-
if (i.warnings.forEach((r) =>
|
|
4464
|
+
if (i.warnings.forEach((r) => es(i.options.logLevel, r)), i.errors.length > 0) {
|
|
4465
4465
|
if (i.options.logLevel !== "silent")
|
|
4466
4466
|
throw i.errors[0];
|
|
4467
4467
|
i.errors = [];
|
|
4468
4468
|
}
|
|
4469
4469
|
return i.toJS(Object.assign({ reviver: n }, t));
|
|
4470
4470
|
}
|
|
4471
|
-
function
|
|
4472
|
-
return
|
|
4471
|
+
function zn(s) {
|
|
4472
|
+
return ze.isAbsolute(s) ? s : ze.resolve(process.cwd(), s);
|
|
4473
4473
|
}
|
|
4474
|
-
async function
|
|
4475
|
-
|
|
4474
|
+
async function Zn(s) {
|
|
4475
|
+
const e = zn(s);
|
|
4476
|
+
if (!Ft(e))
|
|
4476
4477
|
return { on: {} };
|
|
4477
|
-
const
|
|
4478
|
-
return
|
|
4478
|
+
const t = [];
|
|
4479
|
+
return (await Ls(e)).isDirectory() ? t.push(
|
|
4480
|
+
...(await Cs(e)).filter(
|
|
4481
|
+
(r) => r.endsWith(".yaml") || r.endsWith(".yml") || r.endsWith(".json")
|
|
4482
|
+
).map((r) => ze.join(e, r))
|
|
4483
|
+
) : t.push(e), (await Promise.all(t.map(ei))).reduce(
|
|
4484
|
+
(r, o) => (r.on = { ...r.on, ...o.on }, r),
|
|
4485
|
+
{ on: {} }
|
|
4486
|
+
);
|
|
4479
4487
|
}
|
|
4480
|
-
function
|
|
4488
|
+
async function ei(s) {
|
|
4489
|
+
const e = await Be(s, "utf-8");
|
|
4490
|
+
return s.endsWith(".yaml") || s.endsWith(".yml") ? Xn(e) ?? { on: {} } : JSON.parse(e);
|
|
4491
|
+
}
|
|
4492
|
+
function ti(s) {
|
|
4481
4493
|
return s.split(/\r?\n/u).map((e) => e.trim()).filter((e) => e.length > 0 && !e.startsWith("#")).reduce((e, t) => {
|
|
4482
4494
|
const n = t.indexOf("=");
|
|
4483
4495
|
if (n <= 0)
|
|
@@ -4486,29 +4498,29 @@ function zn(s) {
|
|
|
4486
4498
|
return e[i] = r, e;
|
|
4487
4499
|
}, {});
|
|
4488
4500
|
}
|
|
4489
|
-
async function
|
|
4501
|
+
async function si(s) {
|
|
4490
4502
|
const e = {};
|
|
4491
4503
|
for (const [t, n] of Object.entries(process.env))
|
|
4492
4504
|
typeof n == "string" && (e[t] = n);
|
|
4493
4505
|
for (const t of s ?? []) {
|
|
4494
|
-
const n = await
|
|
4506
|
+
const n = await Be(t, "utf8");
|
|
4495
4507
|
if (t.endsWith(".json")) {
|
|
4496
|
-
const i =
|
|
4508
|
+
const i = lt(JSON.parse(n));
|
|
4497
4509
|
for (const [r, o] of Object.entries(i))
|
|
4498
4510
|
o != null && (e[r] = String(o));
|
|
4499
4511
|
continue;
|
|
4500
4512
|
}
|
|
4501
|
-
Object.assign(e,
|
|
4513
|
+
Object.assign(e, ti(n));
|
|
4502
4514
|
}
|
|
4503
4515
|
return e;
|
|
4504
4516
|
}
|
|
4505
|
-
var
|
|
4517
|
+
var Xe = function(s, e) {
|
|
4506
4518
|
return Object.defineProperty ? Object.defineProperty(s, "raw", { value: e }) : s.raw = e, s;
|
|
4507
4519
|
}, E;
|
|
4508
4520
|
(function(s) {
|
|
4509
4521
|
s[s.EOS = 0] = "EOS", s[s.Text = 1] = "Text", s[s.Incomplete = 2] = "Incomplete", s[s.ESC = 3] = "ESC", s[s.Unknown = 4] = "Unknown", s[s.SGR = 5] = "SGR", s[s.OSCURL = 6] = "OSCURL";
|
|
4510
4522
|
})(E || (E = {}));
|
|
4511
|
-
class
|
|
4523
|
+
class ni {
|
|
4512
4524
|
constructor() {
|
|
4513
4525
|
this.VERSION = "6.0.6", this.setup_palettes(), this._use_classes = !1, this.bold = !1, this.faint = !1, this.italic = !1, this.underline = !1, this.fg = this.bg = null, this._buffer = "", this._url_allowlist = { http: 1, https: 1 }, this._escape_html = !0, this.boldStyle = "font-weight:bold", this.faintStyle = "opacity:0.7", this.italicStyle = "font-style:italic", this.underlineStyle = "text-decoration:underline";
|
|
4514
4526
|
}
|
|
@@ -4632,7 +4644,7 @@ class ei {
|
|
|
4632
4644
|
if (i != "[" && i != "]" && i != "(")
|
|
4633
4645
|
return e.kind = E.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
4634
4646
|
if (i == "[") {
|
|
4635
|
-
this._csi_regex || (this._csi_regex =
|
|
4647
|
+
this._csi_regex || (this._csi_regex = Dt(Pt || (Pt = Xe([`
|
|
4636
4648
|
^ # beginning of line
|
|
4637
4649
|
#
|
|
4638
4650
|
# First attempt
|
|
@@ -4680,7 +4692,7 @@ class ei {
|
|
|
4680
4692
|
return e.kind = E.Incomplete, e;
|
|
4681
4693
|
if (this._buffer.charAt(2) != "8" || this._buffer.charAt(3) != ";")
|
|
4682
4694
|
return e.kind = E.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
4683
|
-
this._osc_st || (this._osc_st =
|
|
4695
|
+
this._osc_st || (this._osc_st = ii(xt || (xt = Xe([`
|
|
4684
4696
|
(?: # legal sequence
|
|
4685
4697
|
(\x1B\\) # ESC | # alternate
|
|
4686
4698
|
(\x07) # BEL (what xterm did)
|
|
@@ -4722,7 +4734,7 @@ class ei {
|
|
|
4722
4734
|
if (a[3])
|
|
4723
4735
|
return e.kind = E.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
4724
4736
|
}
|
|
4725
|
-
this._osc_regex || (this._osc_regex =
|
|
4737
|
+
this._osc_regex || (this._osc_regex = Dt(Kt || (Kt = Xe([`
|
|
4726
4738
|
^ # beginning of line
|
|
4727
4739
|
#
|
|
4728
4740
|
\x1B]8; # OSC Hyperlink
|
|
@@ -4846,39 +4858,41 @@ class ei {
|
|
|
4846
4858
|
return t.length < 1 || !this._url_allowlist[t[0]] ? "" : `<a href="${this.escape_txt_for_html(e.url)}">${this.escape_txt_for_html(e.text)}</a>`;
|
|
4847
4859
|
}
|
|
4848
4860
|
}
|
|
4849
|
-
function
|
|
4861
|
+
function Dt(s, ...e) {
|
|
4850
4862
|
let t = s.raw[0], n = /^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm, i = t.replace(n, "");
|
|
4851
4863
|
return new RegExp(i);
|
|
4852
4864
|
}
|
|
4853
|
-
function
|
|
4865
|
+
function ii(s, ...e) {
|
|
4854
4866
|
let t = s.raw[0], n = /^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm, i = t.replace(n, "");
|
|
4855
4867
|
return new RegExp(i, "g");
|
|
4856
4868
|
}
|
|
4857
|
-
var Pt,
|
|
4858
|
-
const
|
|
4859
|
-
|
|
4860
|
-
async function
|
|
4869
|
+
var Pt, xt, Kt;
|
|
4870
|
+
const Rt = new ni(), Nt = rt(qt(), "workflow-reports");
|
|
4871
|
+
Ds(Nt, { recursive: !0 });
|
|
4872
|
+
async function ri(s, e) {
|
|
4873
|
+
const { outputs: t, ...n } = e;
|
|
4861
4874
|
try {
|
|
4862
|
-
const
|
|
4863
|
-
await
|
|
4864
|
-
|
|
4865
|
-
JSON.stringify({ ...s, outputs:
|
|
4875
|
+
const i = rt(Nt, `${s.id}.json`);
|
|
4876
|
+
await js(
|
|
4877
|
+
i,
|
|
4878
|
+
JSON.stringify({ ...s, outputs: t, context: n }, null, 2),
|
|
4866
4879
|
"utf8"
|
|
4867
4880
|
);
|
|
4868
|
-
} catch (
|
|
4869
|
-
const
|
|
4870
|
-
console.error("Error writing report:",
|
|
4881
|
+
} catch (i) {
|
|
4882
|
+
const r = i instanceof Error ? i.message : String(i);
|
|
4883
|
+
console.error("Error writing report:", r);
|
|
4871
4884
|
}
|
|
4872
4885
|
}
|
|
4873
|
-
async function
|
|
4886
|
+
async function oi(s) {
|
|
4874
4887
|
try {
|
|
4875
|
-
|
|
4888
|
+
const e = rt(Nt, `${s}.json`), t = await Be(e, "utf8");
|
|
4889
|
+
return JSON.parse(t);
|
|
4876
4890
|
} catch (e) {
|
|
4877
4891
|
const t = e instanceof Error ? e.message : String(e);
|
|
4878
4892
|
return console.error("Error reading report:", t), null;
|
|
4879
4893
|
}
|
|
4880
4894
|
}
|
|
4881
|
-
const
|
|
4895
|
+
const li = `<!DOCTYPE html>
|
|
4882
4896
|
<html lang="en">
|
|
4883
4897
|
<head>
|
|
4884
4898
|
<meta charset="UTF-8">
|
|
@@ -4893,7 +4907,7 @@ const ii = `<!DOCTYPE html>
|
|
|
4893
4907
|
</div>
|
|
4894
4908
|
</body>
|
|
4895
4909
|
</html>`;
|
|
4896
|
-
async function
|
|
4910
|
+
async function Ut(s) {
|
|
4897
4911
|
return s ? `<!DOCTYPE html>
|
|
4898
4912
|
<html lang="en">
|
|
4899
4913
|
<head>
|
|
@@ -4910,10 +4924,10 @@ ${s.outputs.map(
|
|
|
4910
4924
|
<div class="mb-6">
|
|
4911
4925
|
<h2 class="text-xl font-semibold mb-2">Step ${n + 1}: ${t.cmd} (${t.code})</h2>
|
|
4912
4926
|
<div class="bg-gray-800 text-green-400 p-4 rounded mb-2 overflow-x-auto">
|
|
4913
|
-
<pre>${
|
|
4927
|
+
<pre>${Rt.ansi_to_html(t.stdout)}</pre>
|
|
4914
4928
|
</div>
|
|
4915
4929
|
<div class="bg-gray-800 text-red-400 p-4 rounded overflow-x-auto">
|
|
4916
|
-
<pre>${
|
|
4930
|
+
<pre>${Rt.ansi_to_html(t.stderr)}</pre>
|
|
4917
4931
|
</div>
|
|
4918
4932
|
</div>
|
|
4919
4933
|
`
|
|
@@ -4926,30 +4940,46 @@ ${s.children && s.children.length > 0 ? `<div class="mt-2">Child Reports:<ul>${s
|
|
|
4926
4940
|
|
|
4927
4941
|
</div>
|
|
4928
4942
|
</body>
|
|
4929
|
-
</html>` :
|
|
4943
|
+
</html>` : li;
|
|
4930
4944
|
}
|
|
4931
|
-
const
|
|
4932
|
-
function
|
|
4933
|
-
if (typeof s.run != "string")
|
|
4934
|
-
throw new Error("Each workflow step must have a 'run' command string.");
|
|
4945
|
+
const ai = "/workspace", ci = "dhi.io/alpine-base:3.23-alpine3.23-dev";
|
|
4946
|
+
function fi(s, e) {
|
|
4935
4947
|
const t = e.workflow.defaults || {};
|
|
4936
|
-
return s.image ||= t.image ||
|
|
4948
|
+
return s.image ||= t.image || ci, s.volumes ||= t.volumes || {}, s.args ||= t.args || [], s;
|
|
4937
4949
|
}
|
|
4938
|
-
function
|
|
4950
|
+
function ui(s, e) {
|
|
4939
4951
|
return (s || []).flatMap(
|
|
4940
4952
|
(t) => Object.entries(t).flatMap(([n, i]) => [
|
|
4941
4953
|
`--${n}`,
|
|
4942
|
-
|
|
4954
|
+
be(String(i), e)
|
|
4943
4955
|
])
|
|
4944
4956
|
);
|
|
4945
4957
|
}
|
|
4946
|
-
function
|
|
4947
|
-
return s["."] ||=
|
|
4958
|
+
function hi(s, e) {
|
|
4959
|
+
return s["."] ||= ai, Object.entries(s).flatMap(([t, n]) => [
|
|
4948
4960
|
"-v",
|
|
4949
4961
|
`${t === "." ? e.workingDir : t}:${n}`
|
|
4950
4962
|
]);
|
|
4951
4963
|
}
|
|
4952
|
-
function
|
|
4964
|
+
function di(s, e) {
|
|
4965
|
+
const t = fi(s, e), { args: n, image: i, volumes: r } = t, o = hi(r, e), l = ui(n, e), a = r["."], c = [
|
|
4966
|
+
"run",
|
|
4967
|
+
"-i",
|
|
4968
|
+
"--rm",
|
|
4969
|
+
...o,
|
|
4970
|
+
...l,
|
|
4971
|
+
"-w",
|
|
4972
|
+
a,
|
|
4973
|
+
"--entrypoint",
|
|
4974
|
+
"sh",
|
|
4975
|
+
i
|
|
4976
|
+
];
|
|
4977
|
+
return ot("docker", c, {
|
|
4978
|
+
env: e.env
|
|
4979
|
+
});
|
|
4980
|
+
}
|
|
4981
|
+
const pi = process.env.SHELL || "sh";
|
|
4982
|
+
function mi(s) {
|
|
4953
4983
|
const { workflow: e, secrets: t } = s, n = {
|
|
4954
4984
|
...process.env,
|
|
4955
4985
|
...Object.fromEntries(
|
|
@@ -4961,145 +4991,147 @@ function fi(s) {
|
|
|
4961
4991
|
if (typeof e.env != "object")
|
|
4962
4992
|
throw new Error("Workflow env field must be an object.");
|
|
4963
4993
|
for (const [i, r] of Object.entries(e.env))
|
|
4964
|
-
n[i] =
|
|
4994
|
+
n[i] = be(r, s);
|
|
4965
4995
|
}
|
|
4966
4996
|
Object.assign(s.env, n);
|
|
4967
4997
|
}
|
|
4968
|
-
function
|
|
4969
|
-
const t = Object.keys(
|
|
4970
|
-
if (!
|
|
4998
|
+
function gi(s, e) {
|
|
4999
|
+
const { event: t, source: n } = s, i = Object.keys(t), r = Object.keys(e.on), o = r.find((c) => t[c]), l = o ? e.on[o] : null;
|
|
5000
|
+
if (!l)
|
|
4971
5001
|
return console.log(
|
|
4972
|
-
`No workflow defined for event keys: ${
|
|
5002
|
+
`No workflow defined for event keys: ${i.join(", ")}, only accepting ${r.join(", ")}.`
|
|
4973
5003
|
), null;
|
|
4974
|
-
if (!
|
|
5004
|
+
if (!l.steps?.length)
|
|
4975
5005
|
return console.warn(
|
|
4976
|
-
`Workflow for event ${
|
|
5006
|
+
`Workflow for event ${t.source}:${t.event} has no steps defined, skipping.`
|
|
4977
5007
|
), null;
|
|
4978
|
-
const
|
|
5008
|
+
const a = t[o];
|
|
4979
5009
|
return {
|
|
4980
|
-
|
|
4981
|
-
|
|
5010
|
+
source: n,
|
|
5011
|
+
workflow: l,
|
|
5012
|
+
event: a
|
|
4982
5013
|
};
|
|
4983
5014
|
}
|
|
4984
|
-
async function
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
];
|
|
4998
|
-
return new Promise((d, u) => {
|
|
4999
|
-
const f = Ut("docker", c, {
|
|
5000
|
-
env: e.env
|
|
5001
|
-
}), p = [], g = [];
|
|
5002
|
-
f.stdout?.on("data", (h) => {
|
|
5003
|
-
p.push(h);
|
|
5004
|
-
}), f.stderr?.on("data", (h) => {
|
|
5005
|
-
g.push(h);
|
|
5006
|
-
}), f.once("error", u), f.once("exit", (h) => {
|
|
5007
|
-
const m = {
|
|
5008
|
-
code: h ?? 0,
|
|
5009
|
-
cmd: t.run,
|
|
5010
|
-
stdout: Buffer.concat(p).toString("utf-8"),
|
|
5011
|
-
stderr: Buffer.concat(g).toString("utf-8")
|
|
5015
|
+
async function yi(s, e) {
|
|
5016
|
+
const t = [], n = [], i = be(s.run, e), r = e.runner === "docker" ? di(s, e) : ot(pi, {
|
|
5017
|
+
shell: !0,
|
|
5018
|
+
env: e.env,
|
|
5019
|
+
cwd: s.workingDir || e.workingDir
|
|
5020
|
+
});
|
|
5021
|
+
return r.stdout?.on("data", (o) => t.push(o)), r.stderr?.on("data", (o) => n.push(o)), new Promise((o, l) => {
|
|
5022
|
+
r.once("error", l), r.once("exit", (a) => {
|
|
5023
|
+
const c = {
|
|
5024
|
+
code: a ?? 0,
|
|
5025
|
+
cmd: s.run,
|
|
5026
|
+
stdout: Buffer.concat(t).toString("utf-8"),
|
|
5027
|
+
stderr: Buffer.concat(n).toString("utf-8")
|
|
5012
5028
|
};
|
|
5013
|
-
|
|
5014
|
-
}),
|
|
5029
|
+
o(c);
|
|
5030
|
+
}), r.stdin?.write(i), r.stdin?.write(`
|
|
5015
5031
|
exit $?;
|
|
5016
|
-
`),
|
|
5032
|
+
`), r.stdin?.end();
|
|
5033
|
+
});
|
|
5034
|
+
}
|
|
5035
|
+
function bi(s, e) {
|
|
5036
|
+
return s.map((t) => {
|
|
5037
|
+
if (typeof t == "string" && (t = { run: t }), typeof t.run != "string")
|
|
5038
|
+
throw new Error("Each workflow step must have a 'run' command string.");
|
|
5039
|
+
return t;
|
|
5017
5040
|
});
|
|
5018
5041
|
}
|
|
5019
5042
|
async function Is(s, e, t) {
|
|
5020
|
-
const n =
|
|
5043
|
+
const n = xs(), i = gi(s, e);
|
|
5021
5044
|
if (!i)
|
|
5022
|
-
return { id: n, parentId: t,
|
|
5023
|
-
const { workflow: r, event: o } = i, l =
|
|
5045
|
+
return { id: n, parentId: t, children: [], context: null };
|
|
5046
|
+
const { workflow: r, event: o } = i, l = r.mappings ? Rs(o, r.mappings) : o, a = await si(r.secrets), c = await Bs(Ps(qt(), "workflow")), d = Vt({
|
|
5024
5047
|
inputs: l,
|
|
5025
5048
|
secrets: a,
|
|
5026
5049
|
workflow: r,
|
|
5027
5050
|
env: {},
|
|
5028
5051
|
outputs: [],
|
|
5029
|
-
workingDir: c
|
|
5052
|
+
workingDir: c,
|
|
5053
|
+
runner: r.runner || "docker"
|
|
5030
5054
|
});
|
|
5031
|
-
|
|
5055
|
+
if (r.if && !r.if.map((g) => be(g, d)).some((g) => Function("return " + g)()))
|
|
5056
|
+
return console.log(
|
|
5057
|
+
`Workflow for event ${o.source}:${o.event} skipped due to no matching conditions.`
|
|
5058
|
+
), { id: n, parentId: t, children: [], context: null };
|
|
5032
5059
|
const u = [];
|
|
5033
5060
|
try {
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5061
|
+
mi(d);
|
|
5062
|
+
const f = bi(r.steps || [], d);
|
|
5063
|
+
for (const p of f) {
|
|
5064
|
+
const g = await yi(p, d);
|
|
5065
|
+
if (g.code !== 0)
|
|
5037
5066
|
throw new Error(
|
|
5038
|
-
`Step failed with code ${
|
|
5039
|
-
stdout: ${
|
|
5040
|
-
stderr: ${
|
|
5067
|
+
`Step failed with code ${g.code}.
|
|
5068
|
+
stdout: ${g.stdout}
|
|
5069
|
+
stderr: ${g.stderr}`
|
|
5041
5070
|
);
|
|
5042
|
-
d.outputs.push(
|
|
5071
|
+
d.outputs.push(g);
|
|
5043
5072
|
}
|
|
5044
|
-
for (const
|
|
5045
|
-
const
|
|
5046
|
-
|
|
5073
|
+
for (const p of r.triggers ?? []) {
|
|
5074
|
+
const g = await wi(p, e, t);
|
|
5075
|
+
g && u.push(g.id);
|
|
5047
5076
|
}
|
|
5048
5077
|
} catch (f) {
|
|
5049
5078
|
const p = f instanceof Error ? f.message : String(f);
|
|
5050
5079
|
console.error(`Error processing event: ${p}`), console.debug(JSON.stringify(o));
|
|
5051
5080
|
} finally {
|
|
5052
|
-
await
|
|
5081
|
+
await Ms(d.workingDir, { recursive: !0, force: !0 });
|
|
5053
5082
|
}
|
|
5054
|
-
return await
|
|
5083
|
+
return await ri({ id: n, parentId: t, children: u }, d), { id: n, parentId: t, children: u, context: d };
|
|
5055
5084
|
}
|
|
5056
|
-
async function
|
|
5057
|
-
if (!
|
|
5085
|
+
async function wi(s, e, t) {
|
|
5086
|
+
if (!Ft(s)) {
|
|
5058
5087
|
console.warn(`Trigger file does not exist: ${s}`);
|
|
5059
5088
|
return;
|
|
5060
5089
|
}
|
|
5061
|
-
const n = await
|
|
5090
|
+
const n = await Be(s, "utf8"), i = {
|
|
5091
|
+
event: lt(JSON.parse(n)),
|
|
5092
|
+
source: "file"
|
|
5093
|
+
};
|
|
5062
5094
|
return await Is(i, e, t);
|
|
5063
5095
|
}
|
|
5064
|
-
async function
|
|
5096
|
+
async function Si(s) {
|
|
5065
5097
|
if (s.daemon) {
|
|
5066
|
-
const i = process.argv.slice(1).filter((l) => l !== "--daemon" && l !== "-d"), r = process.execArgv.concat(i), o =
|
|
5098
|
+
const i = process.argv.slice(1).filter((l) => l !== "--daemon" && l !== "-d"), r = process.execArgv.concat(i), o = ot(process.execPath, r, {
|
|
5067
5099
|
detached: !0,
|
|
5068
5100
|
stdio: "ignore"
|
|
5069
5101
|
});
|
|
5070
5102
|
return console.log(o.pid), o.unref(), null;
|
|
5071
5103
|
}
|
|
5072
|
-
const e = await
|
|
5104
|
+
const e = await Zn(s.configPath), t = $s(async (i, r) => {
|
|
5073
5105
|
if (i.method === "GET" && i.url === "/health") {
|
|
5074
|
-
|
|
5106
|
+
Ne(r, 200, { status: "OK" });
|
|
5075
5107
|
return;
|
|
5076
5108
|
}
|
|
5077
|
-
if (i.method === "GET" && i.url?.startsWith("/
|
|
5078
|
-
const o = i.url.split("/
|
|
5079
|
-
l ? (r.writeHead(200, { "Content-Type": "text/html" }), r.end(
|
|
5109
|
+
if (i.method === "GET" && i.url?.startsWith("/reports/")) {
|
|
5110
|
+
const o = i.url.split("/reports/")[1], l = await oi(o);
|
|
5111
|
+
l ? (r.writeHead(200, { "Content-Type": "text/html" }), r.end(await Ut(l))) : (r.writeHead(404, { "Content-Type": "text/html" }), r.end(await Ut(null)));
|
|
5080
5112
|
return;
|
|
5081
5113
|
}
|
|
5082
5114
|
if (i.method !== "POST") {
|
|
5083
|
-
|
|
5115
|
+
Ne(r, 405, { error: "Only POST webhooks are supported." });
|
|
5084
5116
|
return;
|
|
5085
5117
|
}
|
|
5086
5118
|
try {
|
|
5087
|
-
const o = Buffer.concat(await i.toArray()).toString(),
|
|
5088
|
-
|
|
5089
|
-
id:
|
|
5090
|
-
logUrl:
|
|
5091
|
-
parent:
|
|
5092
|
-
id:
|
|
5093
|
-
logUrl:
|
|
5119
|
+
const o = i.url?.slice(1) || "", l = Buffer.concat(await i.toArray()).toString(), a = lt(JSON.parse(l || "{}")), d = await Is({ source: o, event: a }, e), u = (f) => new URL("/reports/" + f, `http://${i.headers.host}`);
|
|
5120
|
+
Ne(r, 202, {
|
|
5121
|
+
id: d.id,
|
|
5122
|
+
logUrl: u(d.id).href,
|
|
5123
|
+
parent: d.parentId ? {
|
|
5124
|
+
id: d.parentId,
|
|
5125
|
+
logUrl: d.parentId ? u(d.parentId).href : void 0
|
|
5094
5126
|
} : null,
|
|
5095
|
-
children:
|
|
5096
|
-
id:
|
|
5097
|
-
logUrl:
|
|
5127
|
+
children: d.children?.map((f) => ({
|
|
5128
|
+
id: f,
|
|
5129
|
+
logUrl: u(f).href
|
|
5098
5130
|
})) || []
|
|
5099
5131
|
});
|
|
5100
5132
|
} catch (o) {
|
|
5101
5133
|
const l = o instanceof Error ? o.message : "Unknown error";
|
|
5102
|
-
console.error("Error processing webhook:", o),
|
|
5134
|
+
console.error("Error processing webhook:", o), Ne(r, 400, { error: l });
|
|
5103
5135
|
}
|
|
5104
5136
|
});
|
|
5105
5137
|
await new Promise((i, r) => {
|
|
@@ -5108,56 +5140,56 @@ async function pi(s) {
|
|
|
5108
5140
|
const n = t.address();
|
|
5109
5141
|
return n && typeof n == "object" && console.log(`Started on http://${n.address}:${n.port}`), t;
|
|
5110
5142
|
}
|
|
5111
|
-
const
|
|
5143
|
+
const ki = `on - daemonized webhook runner
|
|
5112
5144
|
|
|
5113
5145
|
Usage:
|
|
5114
5146
|
on --port <port> [--host <host>] [--config <path>]
|
|
5115
5147
|
|
|
5116
5148
|
Options:
|
|
5117
5149
|
--daemon Run as a background service
|
|
5118
|
-
--port, -p HTTP port for incoming webhooks (
|
|
5150
|
+
--port, -p HTTP port for incoming webhooks (default: 11235)
|
|
5119
5151
|
--host, -H Host binding for the HTTP server (default: 127.0.0.1)
|
|
5120
|
-
--config, -c Path to a YAML/JSON config file
|
|
5152
|
+
--config, -c Path to a YAML/JSON config file or a folder with multiple files. (default: workflows.yaml)
|
|
5121
5153
|
--help, -h Show this help message
|
|
5122
5154
|
`;
|
|
5123
|
-
function
|
|
5155
|
+
function _i(s) {
|
|
5124
5156
|
const { values: e } = As({
|
|
5125
5157
|
args: s,
|
|
5126
5158
|
options: {
|
|
5127
|
-
port: { type: "string", short: "p" },
|
|
5159
|
+
port: { type: "string", short: "p", default: "11235" },
|
|
5128
5160
|
host: { type: "string", short: "H", default: "127.0.0.1" },
|
|
5129
|
-
config: { type: "string", short: "c" },
|
|
5161
|
+
config: { type: "string", short: "c", default: "workflows.yaml" },
|
|
5130
5162
|
help: { type: "boolean", short: "h", default: !1 },
|
|
5131
5163
|
daemon: { type: "boolean", short: "d", default: !1 }
|
|
5132
5164
|
},
|
|
5133
5165
|
allowPositionals: !1
|
|
5134
5166
|
});
|
|
5135
5167
|
if (e.help)
|
|
5136
|
-
return console.log(
|
|
5168
|
+
return console.log(ki), null;
|
|
5137
5169
|
if (!e.port)
|
|
5138
5170
|
throw new Error("Missing required option --port.");
|
|
5139
5171
|
return {
|
|
5140
|
-
port:
|
|
5172
|
+
port: Ks(e.port),
|
|
5141
5173
|
host: e.host,
|
|
5142
5174
|
configPath: e.config,
|
|
5143
5175
|
daemon: e.daemon
|
|
5144
5176
|
};
|
|
5145
5177
|
}
|
|
5146
|
-
async function
|
|
5178
|
+
async function Ni() {
|
|
5147
5179
|
try {
|
|
5148
|
-
const s =
|
|
5180
|
+
const s = _i(process.argv.slice(2));
|
|
5149
5181
|
if (!s) {
|
|
5150
5182
|
process.exitCode = 0;
|
|
5151
5183
|
return;
|
|
5152
5184
|
}
|
|
5153
|
-
await
|
|
5185
|
+
await Si(s);
|
|
5154
5186
|
} catch (s) {
|
|
5155
5187
|
const e = s instanceof Error ? s.message : String(s);
|
|
5156
5188
|
console.error(`on: ${e}`), process.exitCode = 1;
|
|
5157
5189
|
}
|
|
5158
5190
|
}
|
|
5159
|
-
|
|
5191
|
+
Ni();
|
|
5160
5192
|
export {
|
|
5161
|
-
|
|
5162
|
-
|
|
5193
|
+
Ni as main,
|
|
5194
|
+
_i as parseCliOptions
|
|
5163
5195
|
};
|