@cloud-cli/on 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/on.js +1416 -1017
- package/package.json +2 -1
package/dist/on.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { parseArgs as
|
|
3
|
-
import { createServer as
|
|
4
|
-
import { readFile as
|
|
5
|
-
import
|
|
6
|
-
import { spawn as
|
|
7
|
-
import { existsSync as
|
|
8
|
-
import { tmpdir as
|
|
9
|
-
import { join as
|
|
10
|
-
import { randomUUID as
|
|
11
|
-
function
|
|
2
|
+
import { parseArgs as As } from "node:util";
|
|
3
|
+
import { createServer as vs } from "node:http";
|
|
4
|
+
import { readFile as nt, writeFile as $s, mkdtemp as Ls, rm as Cs } from "node:fs/promises";
|
|
5
|
+
import _t, { join as it } from "node:path";
|
|
6
|
+
import { spawn as Rt } from "node:child_process";
|
|
7
|
+
import { existsSync as js } from "node:fs";
|
|
8
|
+
import { tmpdir as Ut } from "node:os";
|
|
9
|
+
import { join as Bs } from "node:path/posix";
|
|
10
|
+
import { randomUUID as Ms } from "node:crypto";
|
|
11
|
+
function _e(s, e, t) {
|
|
12
12
|
s.writeHead(e, { "content-type": "application/json" }).end(JSON.stringify(t));
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function Ps(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,69 +19,69 @@ function $s(s) {
|
|
|
19
19
|
);
|
|
20
20
|
return e;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function rt(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 Ft(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 ? Ft(n) : t === "toString" ? () => "'" + JSON.stringify(e) + "'" : n;
|
|
32
32
|
}
|
|
33
33
|
}) : s ?? "";
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function je(s, e) {
|
|
36
36
|
const t = Function(
|
|
37
37
|
"context",
|
|
38
38
|
"const { secrets = {}, inputs = {}, step = {}, env } = context;return `" + s + "`;"
|
|
39
39
|
);
|
|
40
40
|
return String(t(e) || "");
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function Ds(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] = je(`\${${i}}`, t);
|
|
48
48
|
return t.inputs;
|
|
49
49
|
}
|
|
50
|
-
const
|
|
51
|
-
function
|
|
50
|
+
const ot = /* @__PURE__ */ Symbol.for("yaml.alias"), Xe = /* @__PURE__ */ Symbol.for("yaml.document"), J = /* @__PURE__ */ Symbol.for("yaml.map"), qt = /* @__PURE__ */ Symbol.for("yaml.pair"), R = /* @__PURE__ */ Symbol.for("yaml.scalar"), le = /* @__PURE__ */ Symbol.for("yaml.seq"), D = /* @__PURE__ */ Symbol.for("yaml.node.type"), Q = (s) => !!s && typeof s == "object" && s[D] === ot, Be = (s) => !!s && typeof s == "object" && s[D] === Xe, be = (s) => !!s && typeof s == "object" && s[D] === J, $ = (s) => !!s && typeof s == "object" && s[D] === qt, I = (s) => !!s && typeof s == "object" && s[D] === R, we = (s) => !!s && typeof s == "object" && s[D] === le;
|
|
51
|
+
function A(s) {
|
|
52
52
|
if (s && typeof s == "object")
|
|
53
|
-
switch (s[
|
|
53
|
+
switch (s[D]) {
|
|
54
54
|
case J:
|
|
55
|
-
case
|
|
55
|
+
case le:
|
|
56
56
|
return !0;
|
|
57
57
|
}
|
|
58
58
|
return !1;
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function v(s) {
|
|
61
61
|
if (s && typeof s == "object")
|
|
62
|
-
switch (s[
|
|
63
|
-
case
|
|
62
|
+
switch (s[D]) {
|
|
63
|
+
case ot:
|
|
64
64
|
case J:
|
|
65
|
-
case
|
|
66
|
-
case
|
|
65
|
+
case R:
|
|
66
|
+
case le:
|
|
67
67
|
return !0;
|
|
68
68
|
}
|
|
69
69
|
return !1;
|
|
70
70
|
}
|
|
71
|
-
const
|
|
72
|
-
function
|
|
73
|
-
const t =
|
|
74
|
-
|
|
71
|
+
const Vt = (s) => (I(s) || A(s)) && !!s.anchor, Y = /* @__PURE__ */ Symbol("break visit"), xs = /* @__PURE__ */ Symbol("skip children"), pe = /* @__PURE__ */ Symbol("remove node");
|
|
72
|
+
function ae(s, e) {
|
|
73
|
+
const t = Ks(e);
|
|
74
|
+
Be(s) ? ee(null, s.contents, t, Object.freeze([s])) === pe && (s.contents = null) : ee(null, s, t, Object.freeze([]));
|
|
75
75
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
ae.BREAK = Y;
|
|
77
|
+
ae.SKIP = xs;
|
|
78
|
+
ae.REMOVE = pe;
|
|
79
79
|
function ee(s, e, t, n) {
|
|
80
|
-
const i =
|
|
81
|
-
if (
|
|
82
|
-
return
|
|
80
|
+
const i = Rs(s, e, t, n);
|
|
81
|
+
if (v(i) || $(i))
|
|
82
|
+
return Us(s, n, i), ee(s, i, t, n);
|
|
83
83
|
if (typeof i != "symbol") {
|
|
84
|
-
if (
|
|
84
|
+
if (A(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);
|
|
@@ -93,7 +93,7 @@ function ee(s, e, t, n) {
|
|
|
93
93
|
o === pe && (e.items.splice(r, 1), r -= 1);
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
-
} else if (
|
|
96
|
+
} else if ($(e)) {
|
|
97
97
|
n = Object.freeze(n.concat(e));
|
|
98
98
|
const r = ee("key", e.key, t, n);
|
|
99
99
|
if (r === Y)
|
|
@@ -107,7 +107,7 @@ function ee(s, e, t, n) {
|
|
|
107
107
|
}
|
|
108
108
|
return i;
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function Ks(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,47 +122,47 @@ function Cs(s) {
|
|
|
122
122
|
Seq: s.Collection
|
|
123
123
|
}, s) : s;
|
|
124
124
|
}
|
|
125
|
-
function
|
|
125
|
+
function Rs(s, e, t, n) {
|
|
126
126
|
if (typeof t == "function")
|
|
127
127
|
return t(s, e, n);
|
|
128
128
|
if (be(e))
|
|
129
129
|
return t.Map?.(s, e, n);
|
|
130
130
|
if (we(e))
|
|
131
131
|
return t.Seq?.(s, e, n);
|
|
132
|
-
if (
|
|
132
|
+
if ($(e))
|
|
133
133
|
return t.Pair?.(s, e, n);
|
|
134
|
-
if (
|
|
134
|
+
if (I(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 Us(s, e, t) {
|
|
140
140
|
const n = e[e.length - 1];
|
|
141
|
-
if (
|
|
141
|
+
if (A(n))
|
|
142
142
|
n.items[s] = t;
|
|
143
|
-
else if (
|
|
143
|
+
else if ($(n))
|
|
144
144
|
s === "key" ? n.key = t : n.value = t;
|
|
145
|
-
else if (
|
|
145
|
+
else if (Be(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 Fs = {
|
|
153
153
|
"!": "%21",
|
|
154
154
|
",": "%2C",
|
|
155
155
|
"[": "%5B",
|
|
156
156
|
"]": "%5D",
|
|
157
157
|
"{": "%7B",
|
|
158
158
|
"}": "%7D"
|
|
159
|
-
},
|
|
160
|
-
class
|
|
159
|
+
}, qs = (s) => s.replace(/[!,[\]{}]/g, (e) => Fs[e]);
|
|
160
|
+
class j {
|
|
161
161
|
constructor(e, t) {
|
|
162
|
-
this.docStart = null, this.docEnd = !1, this.yaml = Object.assign({},
|
|
162
|
+
this.docStart = null, this.docEnd = !1, this.yaml = Object.assign({}, j.defaultYaml, e), this.tags = Object.assign({}, j.defaultTags, t);
|
|
163
163
|
}
|
|
164
164
|
clone() {
|
|
165
|
-
const e = new
|
|
165
|
+
const e = new j(this.yaml, this.tags);
|
|
166
166
|
return e.docStart = this.docStart, e;
|
|
167
167
|
}
|
|
168
168
|
/**
|
|
@@ -170,16 +170,16 @@ class _ {
|
|
|
170
170
|
* update the stream state according to the current version's spec.
|
|
171
171
|
*/
|
|
172
172
|
atDocument() {
|
|
173
|
-
const e = new
|
|
173
|
+
const e = new j(this.yaml, this.tags);
|
|
174
174
|
switch (this.yaml.version) {
|
|
175
175
|
case "1.1":
|
|
176
176
|
this.atNextDocument = !0;
|
|
177
177
|
break;
|
|
178
178
|
case "1.2":
|
|
179
179
|
this.atNextDocument = !1, this.yaml = {
|
|
180
|
-
explicit:
|
|
180
|
+
explicit: j.defaultYaml.explicit,
|
|
181
181
|
version: "1.2"
|
|
182
|
-
}, this.tags = Object.assign({},
|
|
182
|
+
}, this.tags = Object.assign({}, j.defaultTags);
|
|
183
183
|
break;
|
|
184
184
|
}
|
|
185
185
|
return e;
|
|
@@ -189,7 +189,7 @@ class _ {
|
|
|
189
189
|
* @returns `true` on success
|
|
190
190
|
*/
|
|
191
191
|
add(e, t) {
|
|
192
|
-
this.atNextDocument && (this.yaml = { explicit:
|
|
192
|
+
this.atNextDocument && (this.yaml = { explicit: j.defaultYaml.explicit, version: "1.1" }, this.tags = Object.assign({}, j.defaultTags), this.atNextDocument = !1);
|
|
193
193
|
const n = e.trim().split(/[ \t]+/), i = n.shift();
|
|
194
194
|
switch (i) {
|
|
195
195
|
case "%TAG": {
|
|
@@ -246,56 +246,56 @@ class _ {
|
|
|
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 + qs(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 && v(e.contents)) {
|
|
256
256
|
const r = {};
|
|
257
|
-
|
|
258
|
-
|
|
257
|
+
ae(e.contents, (o, l) => {
|
|
258
|
+
v(l) && l.tag && (r[l.tag] = !0);
|
|
259
259
|
}), i = Object.keys(r);
|
|
260
260
|
} else
|
|
261
261
|
i = [];
|
|
262
262
|
for (const [r, o] of n)
|
|
263
|
-
r === "!!" && o === "tag:yaml.org,2002:" || (!e || i.some((
|
|
263
|
+
r === "!!" && o === "tag:yaml.org,2002:" || (!e || i.some((l) => l.startsWith(o))) && t.push(`%TAG ${r} ${o}`);
|
|
264
264
|
return t.join(`
|
|
265
265
|
`);
|
|
266
266
|
}
|
|
267
267
|
}
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
function
|
|
268
|
+
j.defaultYaml = { explicit: !1, version: "1.2" };
|
|
269
|
+
j.defaultTags = { "!!": "tag:yaml.org,2002:" };
|
|
270
|
+
function Jt(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 Yt(s) {
|
|
278
278
|
const e = /* @__PURE__ */ new Set();
|
|
279
|
-
return
|
|
279
|
+
return ae(s, {
|
|
280
280
|
Value(t, n) {
|
|
281
281
|
n.anchor && e.add(n.anchor);
|
|
282
282
|
}
|
|
283
283
|
}), e;
|
|
284
284
|
}
|
|
285
|
-
function
|
|
285
|
+
function Gt(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 Vs(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 = Yt(s));
|
|
298
|
+
const o = Gt(e, i);
|
|
299
299
|
return i.add(o), o;
|
|
300
300
|
},
|
|
301
301
|
/**
|
|
@@ -306,11 +306,11 @@ function Ps(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 && (I(o.node) || A(o.node)))
|
|
310
310
|
o.node.anchor = o.anchor;
|
|
311
311
|
else {
|
|
312
|
-
const
|
|
313
|
-
throw
|
|
312
|
+
const l = new Error("Failed to resolve repeated object (this should not happen)");
|
|
313
|
+
throw l.source = r, l;
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
316
|
},
|
|
@@ -321,8 +321,8 @@ function te(s, e, t, n) {
|
|
|
321
321
|
if (n && typeof n == "object")
|
|
322
322
|
if (Array.isArray(n))
|
|
323
323
|
for (let i = 0, r = n.length; i < r; ++i) {
|
|
324
|
-
const o = n[i],
|
|
325
|
-
|
|
324
|
+
const o = n[i], l = te(s, n, String(i), o);
|
|
325
|
+
l === void 0 ? delete n[i] : l !== o && (n[i] = l);
|
|
326
326
|
}
|
|
327
327
|
else if (n instanceof Map)
|
|
328
328
|
for (const i of Array.from(n.keys())) {
|
|
@@ -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 P(s, e, t) {
|
|
345
345
|
if (Array.isArray(s))
|
|
346
|
-
return s.map((n, i) =>
|
|
346
|
+
return s.map((n, i) => P(n, String(i), t));
|
|
347
347
|
if (s && typeof s.toJSON == "function") {
|
|
348
|
-
if (!t || !
|
|
348
|
+
if (!t || !Vt(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 M(s, e, t) {
|
|
|
356
356
|
}
|
|
357
357
|
return typeof s == "bigint" && !t?.keep ? Number(s) : s;
|
|
358
358
|
}
|
|
359
|
-
class
|
|
359
|
+
class lt {
|
|
360
360
|
constructor(e) {
|
|
361
|
-
Object.defineProperty(this,
|
|
361
|
+
Object.defineProperty(this, D, { value: e });
|
|
362
362
|
}
|
|
363
363
|
/** Create a copy of this node. */
|
|
364
364
|
clone() {
|
|
@@ -367,7 +367,7 @@ class rt {
|
|
|
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 (!Be(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 rt {
|
|
|
376
376
|
mapAsMap: t === !0,
|
|
377
377
|
mapKeyWarned: !1,
|
|
378
378
|
maxAliasCount: typeof n == "number" ? n : 100
|
|
379
|
-
},
|
|
379
|
+
}, l = P(this, "", o);
|
|
380
380
|
if (typeof i == "function")
|
|
381
|
-
for (const { count:
|
|
382
|
-
i(c,
|
|
383
|
-
return typeof r == "function" ? te(r, { "":
|
|
381
|
+
for (const { count: a, res: c } of o.anchors.values())
|
|
382
|
+
i(c, a);
|
|
383
|
+
return typeof r == "function" ? te(r, { "": l }, "", l) : l;
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
|
-
class
|
|
386
|
+
class at extends lt {
|
|
387
387
|
constructor(e) {
|
|
388
|
-
super(
|
|
388
|
+
super(ot), this.source = e, Object.defineProperty(this, "tag", {
|
|
389
389
|
set() {
|
|
390
390
|
throw new Error("Alias nodes cannot have tags");
|
|
391
391
|
}
|
|
@@ -397,9 +397,9 @@ class ot extends rt {
|
|
|
397
397
|
*/
|
|
398
398
|
resolve(e, t) {
|
|
399
399
|
let n;
|
|
400
|
-
t?.aliasResolveCache ? n = t.aliasResolveCache : (n = [],
|
|
400
|
+
t?.aliasResolveCache ? n = t.aliasResolveCache : (n = [], ae(e, {
|
|
401
401
|
Node: (r, o) => {
|
|
402
|
-
(Q(o) ||
|
|
402
|
+
(Q(o) || Vt(o)) && n.push(o);
|
|
403
403
|
}
|
|
404
404
|
}), t && (t.aliasResolveCache = n));
|
|
405
405
|
let i;
|
|
@@ -415,24 +415,24 @@ class ot extends rt {
|
|
|
415
415
|
return { source: this.source };
|
|
416
416
|
const { anchors: n, doc: i, maxAliasCount: r } = t, o = this.resolve(i, t);
|
|
417
417
|
if (!o) {
|
|
418
|
-
const
|
|
419
|
-
throw new ReferenceError(
|
|
418
|
+
const a = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
|
|
419
|
+
throw new ReferenceError(a);
|
|
420
420
|
}
|
|
421
|
-
let
|
|
422
|
-
if (
|
|
423
|
-
const
|
|
424
|
-
throw new ReferenceError(
|
|
421
|
+
let l = n.get(o);
|
|
422
|
+
if (l || (P(o, null, t), l = n.get(o)), l?.res === void 0) {
|
|
423
|
+
const a = "This should not happen: Alias anchor was not resolved?";
|
|
424
|
+
throw new ReferenceError(a);
|
|
425
425
|
}
|
|
426
|
-
if (r >= 0 && (
|
|
427
|
-
const
|
|
428
|
-
throw new ReferenceError(
|
|
426
|
+
if (r >= 0 && (l.count += 1, l.aliasCount === 0 && (l.aliasCount = Ae(i, o, n)), l.count * l.aliasCount > r)) {
|
|
427
|
+
const a = "Excessive alias count indicates a resource exhaustion attack";
|
|
428
|
+
throw new ReferenceError(a);
|
|
429
429
|
}
|
|
430
|
-
return
|
|
430
|
+
return l.res;
|
|
431
431
|
}
|
|
432
432
|
toString(e, t, n) {
|
|
433
433
|
const i = `*${this.source}`;
|
|
434
434
|
if (e) {
|
|
435
|
-
if (
|
|
435
|
+
if (Jt(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
|
}
|
|
@@ -442,42 +442,42 @@ class ot extends rt {
|
|
|
442
442
|
return i;
|
|
443
443
|
}
|
|
444
444
|
}
|
|
445
|
-
function
|
|
445
|
+
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 (A(e)) {
|
|
450
450
|
let n = 0;
|
|
451
451
|
for (const i of e.items) {
|
|
452
|
-
const r =
|
|
452
|
+
const r = Ae(s, i, t);
|
|
453
453
|
r > n && (n = r);
|
|
454
454
|
}
|
|
455
455
|
return n;
|
|
456
|
-
} else if (
|
|
457
|
-
const n =
|
|
456
|
+
} else if ($(e)) {
|
|
457
|
+
const n = Ae(s, e.key, t), i = Ae(s, e.value, t);
|
|
458
458
|
return Math.max(n, i);
|
|
459
459
|
}
|
|
460
460
|
return 1;
|
|
461
461
|
}
|
|
462
|
-
const
|
|
463
|
-
class
|
|
462
|
+
const Ht = (s) => !s || typeof s != "function" && typeof s != "object";
|
|
463
|
+
class N extends lt {
|
|
464
464
|
constructor(e) {
|
|
465
|
-
super(
|
|
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 : P(this.value, e, t);
|
|
469
469
|
}
|
|
470
470
|
toString() {
|
|
471
471
|
return String(this.value);
|
|
472
472
|
}
|
|
473
473
|
}
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
const
|
|
480
|
-
function
|
|
474
|
+
N.BLOCK_FOLDED = "BLOCK_FOLDED";
|
|
475
|
+
N.BLOCK_LITERAL = "BLOCK_LITERAL";
|
|
476
|
+
N.PLAIN = "PLAIN";
|
|
477
|
+
N.QUOTE_DOUBLE = "QUOTE_DOUBLE";
|
|
478
|
+
N.QUOTE_SINGLE = "QUOTE_SINGLE";
|
|
479
|
+
const Js = "tag:yaml.org,2002:";
|
|
480
|
+
function Ys(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,34 +487,34 @@ function Ds(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 (Be(s) && (s = s.contents), v(s))
|
|
491
491
|
return s;
|
|
492
|
-
if (
|
|
492
|
+
if ($(s)) {
|
|
493
493
|
const u = t.schema[J].createNode?.(t.schema, null, t);
|
|
494
494
|
return u.items.push(s), u;
|
|
495
495
|
}
|
|
496
496
|
(s instanceof String || s instanceof Number || s instanceof Boolean || typeof BigInt < "u" && s instanceof BigInt) && (s = s.valueOf());
|
|
497
|
-
const { aliasDuplicateObjects: n, onAnchor: i, onTagObj: r, schema: o, sourceObjects:
|
|
498
|
-
let
|
|
497
|
+
const { aliasDuplicateObjects: n, onAnchor: i, onTagObj: r, schema: o, sourceObjects: l } = t;
|
|
498
|
+
let a;
|
|
499
499
|
if (n && s && typeof s == "object") {
|
|
500
|
-
if (
|
|
501
|
-
return
|
|
502
|
-
|
|
500
|
+
if (a = l.get(s), a)
|
|
501
|
+
return a.anchor ?? (a.anchor = i(s)), new at(a.anchor);
|
|
502
|
+
a = { anchor: null, node: null }, l.set(s, a);
|
|
503
503
|
}
|
|
504
|
-
e?.startsWith("!!") && (e =
|
|
505
|
-
let c =
|
|
504
|
+
e?.startsWith("!!") && (e = Js + e.slice(2));
|
|
505
|
+
let c = Ys(s, e, o.tags);
|
|
506
506
|
if (!c) {
|
|
507
507
|
if (s && typeof s.toJSON == "function" && (s = s.toJSON()), !s || typeof s != "object") {
|
|
508
|
-
const u = new
|
|
509
|
-
return
|
|
508
|
+
const u = new N(s);
|
|
509
|
+
return a && (a.node = u), u;
|
|
510
510
|
}
|
|
511
|
-
c = s instanceof Map ? o[J] : Symbol.iterator in Object(s) ? o[
|
|
511
|
+
c = s instanceof Map ? o[J] : Symbol.iterator in Object(s) ? o[le] : o[J];
|
|
512
512
|
}
|
|
513
513
|
r && (r(c), delete t.onTagObj);
|
|
514
|
-
const d = c?.createNode ? c.createNode(t.schema, s, t) : typeof c?.nodeClass?.from == "function" ? c.nodeClass.from(t.schema, s, t) : new
|
|
515
|
-
return e ? d.tag = e : c.default || (d.tag = c.tag),
|
|
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
|
+
return e ? d.tag = e : c.default || (d.tag = c.tag), a && (a.node = d), d;
|
|
516
516
|
}
|
|
517
|
-
function
|
|
517
|
+
function Le(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 ve(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 Wt extends lt {
|
|
539
539
|
constructor(e, t) {
|
|
540
540
|
super(e), Object.defineProperty(this, "schema", {
|
|
541
541
|
value: t,
|
|
@@ -551,7 +551,7 @@ class qt extends rt {
|
|
|
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) => v(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 rt {
|
|
|
563
563
|
this.add(t);
|
|
564
564
|
else {
|
|
565
565
|
const [n, ...i] = e, r = this.get(n, !0);
|
|
566
|
-
if (
|
|
566
|
+
if (A(r))
|
|
567
567
|
r.addIn(i, t);
|
|
568
568
|
else if (r === void 0 && this.schema)
|
|
569
|
-
this.set(n,
|
|
569
|
+
this.set(n, Le(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 rt {
|
|
|
580
580
|
if (n.length === 0)
|
|
581
581
|
return this.delete(t);
|
|
582
582
|
const i = this.get(t, !0);
|
|
583
|
-
if (
|
|
583
|
+
if (A(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 rt {
|
|
|
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 && I(r) ? r.value : r : A(r) ? r.getIn(i, t) : void 0;
|
|
595
595
|
}
|
|
596
596
|
hasAllNullValues(e) {
|
|
597
597
|
return this.items.every((t) => {
|
|
598
|
-
if (
|
|
598
|
+
if (!$(t))
|
|
599
599
|
return !1;
|
|
600
600
|
const n = t.value;
|
|
601
|
-
return n == null || e &&
|
|
601
|
+
return n == null || e && I(n) && n.value == null && !n.commentBefore && !n.comment && !n.tag;
|
|
602
602
|
});
|
|
603
603
|
}
|
|
604
604
|
/**
|
|
@@ -609,7 +609,7 @@ class qt extends rt {
|
|
|
609
609
|
if (n.length === 0)
|
|
610
610
|
return this.has(t);
|
|
611
611
|
const i = this.get(t, !0);
|
|
612
|
-
return
|
|
612
|
+
return A(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,37 +621,37 @@ class qt extends rt {
|
|
|
621
621
|
this.set(n, t);
|
|
622
622
|
else {
|
|
623
623
|
const r = this.get(n, !0);
|
|
624
|
-
if (
|
|
624
|
+
if (A(r))
|
|
625
625
|
r.setIn(i, t);
|
|
626
626
|
else if (r === void 0 && this.schema)
|
|
627
|
-
this.set(n,
|
|
627
|
+
this.set(n, Le(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
|
|
634
|
-
function
|
|
633
|
+
const Gs = (s) => s.replace(/^(?!$)(?: $)?/gm, "#");
|
|
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
|
-
` +
|
|
641
|
-
function
|
|
640
|
+
` + U(t, e) : (s.endsWith(" ") ? "" : " ") + t, Qt = "flow", ze = "block", ve = "quoted";
|
|
641
|
+
function Me(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);
|
|
645
|
-
const
|
|
646
|
-
if (s.length <=
|
|
645
|
+
const a = Math.max(1 + r, 1 + i - e.length);
|
|
646
|
+
if (s.length <= a)
|
|
647
647
|
return s;
|
|
648
648
|
const c = [], d = {};
|
|
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 ===
|
|
653
|
-
for (let
|
|
654
|
-
if (t ===
|
|
652
|
+
t === ze && (h = Nt(s, h, e.length), h !== -1 && (u = h + a));
|
|
653
|
+
for (let S; S = s[h += 1]; ) {
|
|
654
|
+
if (t === ve && S === "\\") {
|
|
655
655
|
switch (m = h, s[h + 1]) {
|
|
656
656
|
case "x":
|
|
657
657
|
h += 3;
|
|
@@ -667,44 +667,44 @@ function Be(s, e, t = "flow", { indentAtStart: n, lineWidth: i = 80, minContentW
|
|
|
667
667
|
}
|
|
668
668
|
b = h;
|
|
669
669
|
}
|
|
670
|
-
if (
|
|
670
|
+
if (S === `
|
|
671
671
|
`)
|
|
672
|
-
t ===
|
|
672
|
+
t === ze && (h = Nt(s, h, e.length)), u = h + e.length + a, f = void 0;
|
|
673
673
|
else {
|
|
674
|
-
if (
|
|
674
|
+
if (S === " " && p && p !== " " && p !== `
|
|
675
675
|
` && p !== " ") {
|
|
676
|
-
const
|
|
677
|
-
|
|
678
|
-
` &&
|
|
676
|
+
const k = s[h + 1];
|
|
677
|
+
k && k !== " " && k !== `
|
|
678
|
+
` && k !== " " && (f = h);
|
|
679
679
|
}
|
|
680
680
|
if (h >= u)
|
|
681
681
|
if (f)
|
|
682
|
-
c.push(f), u = f +
|
|
683
|
-
else if (t ===
|
|
682
|
+
c.push(f), u = f + a, f = void 0;
|
|
683
|
+
else if (t === ve) {
|
|
684
684
|
for (; p === " " || p === " "; )
|
|
685
|
-
p =
|
|
686
|
-
const
|
|
687
|
-
if (d[
|
|
685
|
+
p = S, S = s[h += 1], g = !0;
|
|
686
|
+
const k = h > b + 1 ? h - 2 : m - 1;
|
|
687
|
+
if (d[k])
|
|
688
688
|
return s;
|
|
689
|
-
c.push(
|
|
689
|
+
c.push(k), d[k] = !0, u = k + a, f = void 0;
|
|
690
690
|
} else
|
|
691
691
|
g = !0;
|
|
692
692
|
}
|
|
693
|
-
p =
|
|
693
|
+
p = S;
|
|
694
694
|
}
|
|
695
|
-
if (g &&
|
|
695
|
+
if (g && l && l(), c.length === 0)
|
|
696
696
|
return s;
|
|
697
697
|
o && o();
|
|
698
698
|
let w = s.slice(0, c[0]);
|
|
699
|
-
for (let
|
|
700
|
-
const
|
|
701
|
-
|
|
702
|
-
${e}${s.slice(0,
|
|
703
|
-
${e}${s.slice(
|
|
699
|
+
for (let S = 0; S < c.length; ++S) {
|
|
700
|
+
const k = c[S], _ = c[S + 1] || s.length;
|
|
701
|
+
k === 0 ? w = `
|
|
702
|
+
${e}${s.slice(0, _)}` : (t === ve && d[k] && (w += `${s[k]}\\`), w += `
|
|
703
|
+
${e}${s.slice(k + 1, _)}`);
|
|
704
704
|
}
|
|
705
705
|
return w;
|
|
706
706
|
}
|
|
707
|
-
function
|
|
707
|
+
function Nt(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)
|
|
@@ -718,12 +718,12 @@ function St(s, e, t) {
|
|
|
718
718
|
}
|
|
719
719
|
return n;
|
|
720
720
|
}
|
|
721
|
-
const
|
|
721
|
+
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
|
+
}), De = (s) => /^(%|---|\.\.\.)/m.test(s);
|
|
726
|
+
function Hs(s, e, t) {
|
|
727
727
|
if (!e || e < 0)
|
|
728
728
|
return !1;
|
|
729
729
|
const n = e - t, i = s.length;
|
|
@@ -743,15 +743,15 @@ 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 || (
|
|
747
|
-
let o = "",
|
|
748
|
-
for (let
|
|
749
|
-
if (c === " " && t[
|
|
750
|
-
switch (t[
|
|
746
|
+
const { implicitKey: n } = e, i = e.options.doubleQuotedMinMultiLineLength, r = e.indent || (De(s) ? " " : "");
|
|
747
|
+
let o = "", l = 0;
|
|
748
|
+
for (let a = 0, c = t[a]; c; c = t[++a])
|
|
749
|
+
if (c === " " && t[a + 1] === "\\" && t[a + 2] === "n" && (o += t.slice(l, a) + "\\ ", a += 1, l = a, c = "\\"), c === "\\")
|
|
750
|
+
switch (t[a + 1]) {
|
|
751
751
|
case "u":
|
|
752
752
|
{
|
|
753
|
-
o += t.slice(
|
|
754
|
-
const d = t.substr(
|
|
753
|
+
o += t.slice(l, a);
|
|
754
|
+
const d = t.substr(a + 2, 4);
|
|
755
755
|
switch (d) {
|
|
756
756
|
case "0000":
|
|
757
757
|
o += "\\0";
|
|
@@ -778,35 +778,35 @@ function me(s, e) {
|
|
|
778
778
|
o += "\\P";
|
|
779
779
|
break;
|
|
780
780
|
default:
|
|
781
|
-
d.substr(0, 2) === "00" ? o += "\\x" + d.substr(2) : o += t.substr(
|
|
781
|
+
d.substr(0, 2) === "00" ? o += "\\x" + d.substr(2) : o += t.substr(a, 6);
|
|
782
782
|
}
|
|
783
|
-
|
|
783
|
+
a += 5, l = a + 1;
|
|
784
784
|
}
|
|
785
785
|
break;
|
|
786
786
|
case "n":
|
|
787
|
-
if (n || t[
|
|
788
|
-
|
|
787
|
+
if (n || t[a + 2] === '"' || t.length < i)
|
|
788
|
+
a += 1;
|
|
789
789
|
else {
|
|
790
|
-
for (o += t.slice(
|
|
790
|
+
for (o += t.slice(l, a) + `
|
|
791
791
|
|
|
792
|
-
`; t[
|
|
792
|
+
`; t[a + 2] === "\\" && t[a + 3] === "n" && t[a + 4] !== '"'; )
|
|
793
793
|
o += `
|
|
794
|
-
`,
|
|
795
|
-
o += r, t[
|
|
794
|
+
`, a += 2;
|
|
795
|
+
o += r, t[a + 2] === " " && (o += "\\"), a += 1, l = a + 1;
|
|
796
796
|
}
|
|
797
797
|
break;
|
|
798
798
|
default:
|
|
799
|
-
|
|
799
|
+
a += 1;
|
|
800
800
|
}
|
|
801
|
-
return o =
|
|
801
|
+
return o = l ? o + t.slice(l) : t, n ? o : Me(o, r, ve, Pe(e, !1));
|
|
802
802
|
}
|
|
803
|
-
function
|
|
803
|
+
function Ze(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 || (De(s) ? " " : ""), n = "'" + s.replace(/'/g, "''").replace(/\n+/g, `$&
|
|
808
808
|
${t}`) + "'";
|
|
809
|
-
return e.implicitKey ? n :
|
|
809
|
+
return e.implicitKey ? n : Me(n, t, Qt, Pe(e, !1));
|
|
810
810
|
}
|
|
811
811
|
function se(s, e) {
|
|
812
812
|
const { singleQuote: t } = e.options;
|
|
@@ -815,46 +815,46 @@ 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 = Ze : r && !i ? n = me : n = t ? Ze : me;
|
|
819
819
|
}
|
|
820
820
|
return n(s, e);
|
|
821
821
|
}
|
|
822
|
-
let
|
|
822
|
+
let et;
|
|
823
823
|
try {
|
|
824
|
-
|
|
824
|
+
et = new RegExp(`(^|(?<!
|
|
825
825
|
))
|
|
826
826
|
+(?!
|
|
827
827
|
|$)`, "g");
|
|
828
828
|
} catch {
|
|
829
|
-
|
|
829
|
+
et = /\n+(?!\n|$)/g;
|
|
830
830
|
}
|
|
831
|
-
function
|
|
832
|
-
const { blockQuote: o, commentString:
|
|
831
|
+
function $e({ comment: s, type: e, value: t }, n, i, r) {
|
|
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 || De(t) ? " " : ""), d = o === "literal" ? !0 : o === "folded" || e === N.BLOCK_FOLDED ? !1 : e === N.BLOCK_LITERAL ? !0 : !Hs(t, a, c.length);
|
|
836
836
|
if (!t)
|
|
837
837
|
return d ? `|
|
|
838
838
|
` : `>
|
|
839
839
|
`;
|
|
840
840
|
let u, f;
|
|
841
841
|
for (f = t.length; f > 0; --f) {
|
|
842
|
-
const
|
|
843
|
-
if (
|
|
844
|
-
` &&
|
|
842
|
+
const _ = t[f - 1];
|
|
843
|
+
if (_ !== `
|
|
844
|
+
` && _ !== " " && _ !== " ")
|
|
845
845
|
break;
|
|
846
846
|
}
|
|
847
847
|
let p = t.substring(f);
|
|
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(et, `$&${c}`));
|
|
852
852
|
let h = !1, m, b = -1;
|
|
853
853
|
for (m = 0; m < t.length; ++m) {
|
|
854
|
-
const
|
|
855
|
-
if (
|
|
854
|
+
const _ = t[m];
|
|
855
|
+
if (_ === " ")
|
|
856
856
|
h = !0;
|
|
857
|
-
else if (
|
|
857
|
+
else if (_ === `
|
|
858
858
|
`)
|
|
859
859
|
b = m;
|
|
860
860
|
else
|
|
@@ -862,80 +862,80 @@ function Le({ comment: s, type: e, value: t }, n, i, r) {
|
|
|
862
862
|
}
|
|
863
863
|
let w = t.substring(0, b < m ? b + 1 : m);
|
|
864
864
|
w && (t = t.substring(w.length), w = w.replace(/\n+/g, `$&${c}`));
|
|
865
|
-
let
|
|
866
|
-
if (s && (
|
|
867
|
-
const
|
|
865
|
+
let k = (h ? c ? "2" : "1" : "") + u;
|
|
866
|
+
if (s && (k += " " + l(s.replace(/ ?[\r\n]+/g, " ")), i && i()), !d) {
|
|
867
|
+
const _ = t.replace(/\n+/g, `
|
|
868
868
|
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, "$1$2").replace(/\n+/g, `$&${c}`);
|
|
869
|
-
let
|
|
870
|
-
const
|
|
871
|
-
o !== "folded" && e !==
|
|
872
|
-
|
|
869
|
+
let O = !1;
|
|
870
|
+
const T = Pe(n, !0);
|
|
871
|
+
o !== "folded" && e !== N.BLOCK_FOLDED && (T.onOverflow = () => {
|
|
872
|
+
O = !0;
|
|
873
873
|
});
|
|
874
|
-
const y =
|
|
875
|
-
if (!
|
|
876
|
-
return `>${
|
|
874
|
+
const y = Me(`${w}${_}${p}`, c, ze, T);
|
|
875
|
+
if (!O)
|
|
876
|
+
return `>${k}
|
|
877
877
|
${c}${y}`;
|
|
878
878
|
}
|
|
879
|
-
return t = t.replace(/\n+/g, `$&${c}`), `|${
|
|
879
|
+
return t = t.replace(/\n+/g, `$&${c}`), `|${k}
|
|
880
880
|
${c}${w}${t}${p}`;
|
|
881
881
|
}
|
|
882
|
-
function
|
|
883
|
-
const { type: i, value: r } = s, { actualString: o, implicitKey:
|
|
884
|
-
if (
|
|
882
|
+
function Ws(s, e, t, n) {
|
|
883
|
+
const { type: i, value: r } = s, { actualString: o, implicitKey: l, indent: a, indentStep: c, inFlow: d } = e;
|
|
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
|
-
return
|
|
889
|
-
`) ? se(r, e) :
|
|
890
|
-
if (!
|
|
888
|
+
return l || d || !r.includes(`
|
|
889
|
+
`) ? se(r, e) : $e(s, e, t, n);
|
|
890
|
+
if (!l && !d && i !== N.PLAIN && r.includes(`
|
|
891
891
|
`))
|
|
892
|
-
return
|
|
893
|
-
if (
|
|
894
|
-
if (
|
|
895
|
-
return e.forceBlockIndent = !0,
|
|
896
|
-
if (
|
|
892
|
+
return $e(s, e, t, n);
|
|
893
|
+
if (De(r)) {
|
|
894
|
+
if (a === "")
|
|
895
|
+
return e.forceBlockIndent = !0, $e(s, e, t, n);
|
|
896
|
+
if (l && a === c)
|
|
897
897
|
return se(r, e);
|
|
898
898
|
}
|
|
899
899
|
const u = r.replace(/\n+/g, `$&
|
|
900
|
-
${
|
|
900
|
+
${a}`);
|
|
901
901
|
if (o) {
|
|
902
902
|
const f = (h) => h.default && h.tag !== "tag:yaml.org,2002:str" && h.test?.test(u), { compat: p, tags: g } = e.doc.schema;
|
|
903
903
|
if (g.some(f) || p?.some(f))
|
|
904
904
|
return se(r, e);
|
|
905
905
|
}
|
|
906
|
-
return
|
|
906
|
+
return l ? u : Me(u, a, Qt, Pe(e, !1));
|
|
907
907
|
}
|
|
908
|
-
function
|
|
908
|
+
function ct(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
|
-
let { type:
|
|
911
|
-
|
|
912
|
-
const
|
|
910
|
+
let { type: l } = s;
|
|
911
|
+
l !== N.QUOTE_DOUBLE && /[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value) && (l = N.QUOTE_DOUBLE);
|
|
912
|
+
const a = (d) => {
|
|
913
913
|
switch (d) {
|
|
914
|
-
case
|
|
915
|
-
case
|
|
916
|
-
return i || r ? se(o.value, e) :
|
|
917
|
-
case
|
|
914
|
+
case N.BLOCK_FOLDED:
|
|
915
|
+
case N.BLOCK_LITERAL:
|
|
916
|
+
return i || r ? se(o.value, e) : $e(o, e, t, n);
|
|
917
|
+
case N.QUOTE_DOUBLE:
|
|
918
918
|
return me(o.value, e);
|
|
919
|
-
case
|
|
920
|
-
return
|
|
921
|
-
case
|
|
922
|
-
return
|
|
919
|
+
case N.QUOTE_SINGLE:
|
|
920
|
+
return Ze(o.value, e);
|
|
921
|
+
case N.PLAIN:
|
|
922
|
+
return Ws(o, e, t, n);
|
|
923
923
|
default:
|
|
924
924
|
return null;
|
|
925
925
|
}
|
|
926
926
|
};
|
|
927
|
-
let c = l
|
|
927
|
+
let c = a(l);
|
|
928
928
|
if (c === null) {
|
|
929
929
|
const { defaultKeyType: d, defaultStringType: u } = e.options, f = i && d || u;
|
|
930
|
-
if (c =
|
|
930
|
+
if (c = a(f), c === null)
|
|
931
931
|
throw new Error(`Unsupported default string type ${f}`);
|
|
932
932
|
}
|
|
933
933
|
return c;
|
|
934
934
|
}
|
|
935
|
-
function
|
|
935
|
+
function Xt(s, e) {
|
|
936
936
|
const t = Object.assign({
|
|
937
937
|
blockQuote: !0,
|
|
938
|
-
commentString:
|
|
938
|
+
commentString: Gs,
|
|
939
939
|
defaultKeyType: null,
|
|
940
940
|
defaultStringType: "PLAIN",
|
|
941
941
|
directives: null,
|
|
@@ -973,14 +973,14 @@ function Jt(s, e) {
|
|
|
973
973
|
options: t
|
|
974
974
|
};
|
|
975
975
|
}
|
|
976
|
-
function
|
|
976
|
+
function Qs(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 (I(e)) {
|
|
984
984
|
n = e.value;
|
|
985
985
|
let i = s.filter((r) => r.identify?.(n));
|
|
986
986
|
if (i.length > 1) {
|
|
@@ -996,16 +996,16 @@ function qs(s, e) {
|
|
|
996
996
|
}
|
|
997
997
|
return t;
|
|
998
998
|
}
|
|
999
|
-
function
|
|
999
|
+
function Xs(s, e, { anchors: t, doc: n }) {
|
|
1000
1000
|
if (!n.directives)
|
|
1001
1001
|
return "";
|
|
1002
|
-
const i = [], r = (
|
|
1003
|
-
r &&
|
|
1002
|
+
const i = [], r = (I(s) || A(s)) && s.anchor;
|
|
1003
|
+
r && Jt(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
|
}
|
|
1007
1007
|
function re(s, e, t, n) {
|
|
1008
|
-
if (
|
|
1008
|
+
if ($(s))
|
|
1009
1009
|
return s.toString(e, t, n);
|
|
1010
1010
|
if (Q(s)) {
|
|
1011
1011
|
if (e.doc.directives)
|
|
@@ -1015,30 +1015,30 @@ 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 = v(s) ? s : e.doc.createNode(s, { onTagObj: (a) => i = a });
|
|
1019
|
+
i ?? (i = Qs(e.doc.schema.tags, r));
|
|
1020
|
+
const o = Xs(r, i, e);
|
|
1021
1021
|
o.length > 0 && (e.indentAtStart = (e.indentAtStart ?? 0) + o.length + 1);
|
|
1022
|
-
const
|
|
1023
|
-
return o ?
|
|
1024
|
-
${e.indent}${
|
|
1022
|
+
const l = typeof i.stringify == "function" ? i.stringify(r, e, t, n) : I(r) ? ct(r, e, t, n) : r.toString(e, t, n);
|
|
1023
|
+
return o ? I(r) || l[0] === "{" || l[0] === "[" ? `${o} ${l}` : `${o}
|
|
1024
|
+
${e.indent}${l}` : l;
|
|
1025
1025
|
}
|
|
1026
|
-
function
|
|
1027
|
-
const { allNullValues: r, doc: o, indent:
|
|
1028
|
-
let f =
|
|
1026
|
+
function zs({ key: s, value: e }, t, n, i) {
|
|
1027
|
+
const { allNullValues: r, doc: o, indent: l, indentStep: a, options: { commentString: c, indentSeq: d, simpleKeys: u } } = t;
|
|
1028
|
+
let f = v(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 (
|
|
1033
|
-
const
|
|
1034
|
-
throw new Error(
|
|
1032
|
+
if (A(s) || !v(s) && typeof s == "object") {
|
|
1033
|
+
const T = "With simple keys, collection cannot be used as a key value";
|
|
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 || A(s) || (I(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),
|
|
1041
|
-
indent:
|
|
1041
|
+
indent: l + a
|
|
1042
1042
|
});
|
|
1043
1043
|
let g = !1, h = !1, m = re(s, t, () => g = !0, () => h = !0);
|
|
1044
1044
|
if (!p && !t.inFlow && m.length > 1024) {
|
|
@@ -1052,54 +1052,54 @@ function Js({ key: s, value: e }, t, n, i) {
|
|
|
1052
1052
|
} else if (r && !u || e == null && p)
|
|
1053
1053
|
return m = `? ${m}`, f && !g ? m += G(m, t.indent, c(f)) : h && i && i(), m;
|
|
1054
1054
|
g && (f = null), p ? (f && (m += G(m, t.indent, c(f))), m = `? ${m}
|
|
1055
|
-
${
|
|
1056
|
-
let b, w,
|
|
1057
|
-
|
|
1058
|
-
let
|
|
1059
|
-
const
|
|
1060
|
-
let
|
|
1055
|
+
${l}:`) : (m = `${m}:`, f && (m += G(m, t.indent, c(f))));
|
|
1056
|
+
let b, w, S;
|
|
1057
|
+
v(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 && I(e) && (t.indentAtStart = m.length + 1), h = !1, !d && a.length >= 2 && !t.inFlow && !p && we(e) && !e.flow && !e.tag && !e.anchor && (t.indent = t.indent.substring(2));
|
|
1058
|
+
let k = !1;
|
|
1059
|
+
const _ = re(e, t, () => k = !0, () => h = !0);
|
|
1060
|
+
let O = " ";
|
|
1061
1061
|
if (f || b || w) {
|
|
1062
|
-
if (
|
|
1062
|
+
if (O = b ? `
|
|
1063
1063
|
` : "", w) {
|
|
1064
|
-
const
|
|
1065
|
-
|
|
1066
|
-
${
|
|
1064
|
+
const T = c(w);
|
|
1065
|
+
O += `
|
|
1066
|
+
${U(T, t.indent)}`;
|
|
1067
1067
|
}
|
|
1068
|
-
|
|
1069
|
-
` &&
|
|
1068
|
+
_ === "" && !t.inFlow ? O === `
|
|
1069
|
+
` && S && (O = `
|
|
1070
1070
|
|
|
1071
|
-
`) :
|
|
1071
|
+
`) : O += `
|
|
1072
1072
|
${t.indent}`;
|
|
1073
|
-
} else if (!p &&
|
|
1074
|
-
const
|
|
1075
|
-
`),
|
|
1076
|
-
if (
|
|
1073
|
+
} else if (!p && A(e)) {
|
|
1074
|
+
const T = _[0], y = _.indexOf(`
|
|
1075
|
+
`), L = y !== -1, q = t.inFlow ?? e.flow ?? e.items.length === 0;
|
|
1076
|
+
if (L || !q) {
|
|
1077
1077
|
let X = !1;
|
|
1078
|
-
if (
|
|
1079
|
-
let C =
|
|
1080
|
-
|
|
1078
|
+
if (L && (T === "&" || T === "!")) {
|
|
1079
|
+
let C = _.indexOf(" ");
|
|
1080
|
+
T === "&" && C !== -1 && C < y && _[C + 1] === "!" && (C = _.indexOf(" ", C + 1)), (C === -1 || y < C) && (X = !0);
|
|
1081
1081
|
}
|
|
1082
|
-
X || (
|
|
1082
|
+
X || (O = `
|
|
1083
1083
|
${t.indent}`);
|
|
1084
1084
|
}
|
|
1085
|
-
} else (
|
|
1086
|
-
`) && (
|
|
1087
|
-
return m +=
|
|
1085
|
+
} else (_ === "" || _[0] === `
|
|
1086
|
+
`) && (O = "");
|
|
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 zt(s, e) {
|
|
1090
1090
|
(s === "debug" || s === "warn") && console.warn(e);
|
|
1091
1091
|
}
|
|
1092
|
-
const Ne = "<<",
|
|
1092
|
+
const Ne = "<<", F = {
|
|
1093
1093
|
identify: (s) => s === Ne || typeof s == "symbol" && s.description === Ne,
|
|
1094
1094
|
default: "key",
|
|
1095
1095
|
tag: "tag:yaml.org,2002:merge",
|
|
1096
1096
|
test: /^<<$/,
|
|
1097
|
-
resolve: () => Object.assign(new
|
|
1098
|
-
addToJSMap:
|
|
1097
|
+
resolve: () => Object.assign(new N(Symbol(Ne)), {
|
|
1098
|
+
addToJSMap: Zt
|
|
1099
1099
|
}),
|
|
1100
1100
|
stringify: () => Ne
|
|
1101
|
-
},
|
|
1102
|
-
function
|
|
1101
|
+
}, Zs = (s, e) => (F.identify(e) || I(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 Zt(s, e, t) {
|
|
1103
1103
|
if (t = s && Q(t) ? t.resolve(s.doc) : t, we(t))
|
|
1104
1104
|
for (const n of t.items)
|
|
1105
1105
|
Ve(s, e, n);
|
|
@@ -1123,19 +1123,19 @@ function Ve(s, e, t) {
|
|
|
1123
1123
|
});
|
|
1124
1124
|
return e;
|
|
1125
1125
|
}
|
|
1126
|
-
function
|
|
1127
|
-
if (
|
|
1126
|
+
function es(s, e, { key: t, value: n }) {
|
|
1127
|
+
if (v(t) && t.addToJSMap)
|
|
1128
1128
|
t.addToJSMap(s, e, n);
|
|
1129
|
-
else if (
|
|
1130
|
-
|
|
1129
|
+
else if (Zs(s, t))
|
|
1130
|
+
Zt(s, e, n);
|
|
1131
1131
|
else {
|
|
1132
|
-
const i =
|
|
1132
|
+
const i = P(t, "", s);
|
|
1133
1133
|
if (e instanceof Map)
|
|
1134
|
-
e.set(i,
|
|
1134
|
+
e.set(i, P(n, i, s));
|
|
1135
1135
|
else if (e instanceof Set)
|
|
1136
1136
|
e.add(i);
|
|
1137
1137
|
else {
|
|
1138
|
-
const r =
|
|
1138
|
+
const r = en(t, i, s), o = P(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 Wt(s, e, { key: t, value: n }) {
|
|
|
1146
1146
|
}
|
|
1147
1147
|
return e;
|
|
1148
1148
|
}
|
|
1149
|
-
function
|
|
1149
|
+
function en(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 (v(s) && t?.doc) {
|
|
1155
|
+
const n = Xt(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,46 +1160,46 @@ function Gs(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) + '..."'), zt(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 ft(s, e, t) {
|
|
1170
1170
|
const n = ge(s, void 0, t), i = ge(e, void 0, t);
|
|
1171
|
-
return new
|
|
1171
|
+
return new B(n, i);
|
|
1172
1172
|
}
|
|
1173
|
-
class
|
|
1173
|
+
class B {
|
|
1174
1174
|
constructor(e, t = null) {
|
|
1175
|
-
Object.defineProperty(this,
|
|
1175
|
+
Object.defineProperty(this, D, { value: qt }), this.key = e, this.value = t;
|
|
1176
1176
|
}
|
|
1177
1177
|
clone(e) {
|
|
1178
1178
|
let { key: t, value: n } = this;
|
|
1179
|
-
return
|
|
1179
|
+
return v(t) && (t = t.clone(e)), v(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 es(t, n, this);
|
|
1184
1184
|
}
|
|
1185
1185
|
toString(e, t, n) {
|
|
1186
|
-
return e?.doc ?
|
|
1186
|
+
return e?.doc ? zs(this, e, t, n) : JSON.stringify(this);
|
|
1187
1187
|
}
|
|
1188
1188
|
}
|
|
1189
|
-
function
|
|
1190
|
-
return (e.inFlow ?? s.flow ?
|
|
1189
|
+
function ts(s, e, t) {
|
|
1190
|
+
return (e.inFlow ?? s.flow ? sn : tn)(s, e, t);
|
|
1191
1191
|
}
|
|
1192
|
-
function
|
|
1193
|
-
const { indent:
|
|
1192
|
+
function tn({ comment: s, items: e }, t, { blockItemPrefix: n, flowChars: i, itemIndent: r, onChompKeep: o, onComment: l }) {
|
|
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 (
|
|
1199
|
+
if (v(h))
|
|
1200
1200
|
!u && h.spaceBefore && f.push(""), Ce(t, f, h.commentBefore, u), h.comment && (m = h.comment);
|
|
1201
|
-
else if (
|
|
1202
|
-
const w =
|
|
1201
|
+
else if ($(h)) {
|
|
1202
|
+
const w = v(h.key) ? h.key : null;
|
|
1203
1203
|
w && (!u && w.spaceBefore && f.push(""), Ce(t, f, w.commentBefore, u));
|
|
1204
1204
|
}
|
|
1205
1205
|
u = !1;
|
|
@@ -1214,17 +1214,17 @@ function Ws({ comment: s, items: e }, t, { blockItemPrefix: n, flowChars: i, ite
|
|
|
1214
1214
|
for (let g = 1; g < f.length; ++g) {
|
|
1215
1215
|
const h = f[g];
|
|
1216
1216
|
p += h ? `
|
|
1217
|
-
${
|
|
1217
|
+
${a}${h}` : `
|
|
1218
1218
|
`;
|
|
1219
1219
|
}
|
|
1220
1220
|
}
|
|
1221
1221
|
return s ? (p += `
|
|
1222
|
-
` +
|
|
1222
|
+
` + U(c(s), a), l && l()) : u && o && o(), p;
|
|
1223
1223
|
}
|
|
1224
|
-
function
|
|
1225
|
-
const { indent: i, indentStep: r, flowCollectionPadding: o, options: { commentString:
|
|
1224
|
+
function sn({ items: s }, e, { flowChars: t, itemIndent: n }) {
|
|
1225
|
+
const { indent: i, indentStep: r, flowCollectionPadding: o, options: { commentString: l } } = e;
|
|
1226
1226
|
n += r;
|
|
1227
|
-
const
|
|
1227
|
+
const a = Object.assign({}, e, {
|
|
1228
1228
|
indent: n,
|
|
1229
1229
|
inFlow: !0,
|
|
1230
1230
|
type: null
|
|
@@ -1234,17 +1234,17 @@ function Hs({ 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 (
|
|
1237
|
+
if (v(h))
|
|
1238
1238
|
h.spaceBefore && u.push(""), Ce(e, u, h.commentBefore, !1), h.comment && (m = h.comment);
|
|
1239
|
-
else if (
|
|
1240
|
-
const w =
|
|
1239
|
+
else if ($(h)) {
|
|
1240
|
+
const w = v(h.key) ? h.key : null;
|
|
1241
1241
|
w && (w.spaceBefore && u.push(""), Ce(e, u, w.commentBefore, !1), w.comment && (c = !0));
|
|
1242
|
-
const
|
|
1243
|
-
|
|
1242
|
+
const S = v(h.value) ? h.value : null;
|
|
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);
|
|
1246
|
-
let b = re(h,
|
|
1247
|
-
g < s.length - 1 && (b += ","), m && (b += G(b, n,
|
|
1246
|
+
let b = re(h, a, () => m = null);
|
|
1247
|
+
g < s.length - 1 && (b += ","), m && (b += G(b, n, l(m))), !c && (u.length > d || b.includes(`
|
|
1248
1248
|
`)) && (c = !0), u.push(b), d = u.length;
|
|
1249
1249
|
}
|
|
1250
1250
|
const { start: f, end: p } = t;
|
|
@@ -1267,17 +1267,17 @@ ${i}${p}`;
|
|
|
1267
1267
|
}
|
|
1268
1268
|
function Ce({ indent: s, options: { commentString: e } }, t, n, i) {
|
|
1269
1269
|
if (n && i && (n = n.replace(/^\n+/, "")), n) {
|
|
1270
|
-
const r =
|
|
1270
|
+
const r = U(e(n), s);
|
|
1271
1271
|
t.push(r.trimStart());
|
|
1272
1272
|
}
|
|
1273
1273
|
}
|
|
1274
|
-
function
|
|
1275
|
-
const t =
|
|
1274
|
+
function H(s, e) {
|
|
1275
|
+
const t = I(e) ? e.value : e;
|
|
1276
1276
|
for (const n of s)
|
|
1277
|
-
if (
|
|
1277
|
+
if ($(n) && (n.key === e || n.key === t || I(n.key) && n.key.value === t))
|
|
1278
1278
|
return n;
|
|
1279
1279
|
}
|
|
1280
|
-
class
|
|
1280
|
+
class M extends Wt {
|
|
1281
1281
|
static get tagName() {
|
|
1282
1282
|
return "tag:yaml.org,2002:map";
|
|
1283
1283
|
}
|
|
@@ -1289,19 +1289,19 @@ class B extends qt {
|
|
|
1289
1289
|
* to other node classes that inherit from YAMLMap
|
|
1290
1290
|
*/
|
|
1291
1291
|
static from(e, t, n) {
|
|
1292
|
-
const { keepUndefined: i, replacer: r } = n, o = new this(e),
|
|
1292
|
+
const { keepUndefined: i, replacer: r } = n, o = new this(e), l = (a, c) => {
|
|
1293
1293
|
if (typeof r == "function")
|
|
1294
|
-
c = r.call(t,
|
|
1295
|
-
else if (Array.isArray(r) && !r.includes(
|
|
1294
|
+
c = r.call(t, a, c);
|
|
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(ft(a, c, n));
|
|
1298
1298
|
};
|
|
1299
1299
|
if (t instanceof Map)
|
|
1300
|
-
for (const [
|
|
1301
|
-
a
|
|
1300
|
+
for (const [a, c] of t)
|
|
1301
|
+
l(a, c);
|
|
1302
1302
|
else if (t && typeof t == "object")
|
|
1303
|
-
for (const
|
|
1304
|
-
a
|
|
1303
|
+
for (const a of Object.keys(t))
|
|
1304
|
+
l(a, t[a]);
|
|
1305
1305
|
return typeof e.sortMapEntries == "function" && o.items.sort(e.sortMapEntries), o;
|
|
1306
1306
|
}
|
|
1307
1307
|
/**
|
|
@@ -1312,31 +1312,31 @@ class B extends qt {
|
|
|
1312
1312
|
*/
|
|
1313
1313
|
add(e, t) {
|
|
1314
1314
|
let n;
|
|
1315
|
-
|
|
1316
|
-
const i =
|
|
1315
|
+
$(e) ? n = e : !e || typeof e != "object" || !("key" in e) ? n = new B(e, e?.value) : n = new B(e.key, e.value);
|
|
1316
|
+
const i = H(this.items, n.key), r = this.schema?.sortMapEntries;
|
|
1317
1317
|
if (i) {
|
|
1318
1318
|
if (!t)
|
|
1319
1319
|
throw new Error(`Key ${n.key} already set`);
|
|
1320
|
-
|
|
1320
|
+
I(i.value) && Ht(n.value) ? i.value.value = n.value : i.value = n.value;
|
|
1321
1321
|
} else if (r) {
|
|
1322
|
-
const o = this.items.findIndex((
|
|
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);
|
|
1324
1324
|
} else
|
|
1325
1325
|
this.items.push(n);
|
|
1326
1326
|
}
|
|
1327
1327
|
delete(e) {
|
|
1328
|
-
const t =
|
|
1328
|
+
const t = H(this.items, e);
|
|
1329
1329
|
return t ? this.items.splice(this.items.indexOf(t), 1).length > 0 : !1;
|
|
1330
1330
|
}
|
|
1331
1331
|
get(e, t) {
|
|
1332
|
-
const i =
|
|
1333
|
-
return (!t &&
|
|
1332
|
+
const i = H(this.items, e)?.value;
|
|
1333
|
+
return (!t && I(i) ? i.value : i) ?? void 0;
|
|
1334
1334
|
}
|
|
1335
1335
|
has(e) {
|
|
1336
|
-
return !!
|
|
1336
|
+
return !!H(this.items, e);
|
|
1337
1337
|
}
|
|
1338
1338
|
set(e, t) {
|
|
1339
|
-
this.add(new
|
|
1339
|
+
this.add(new B(e, t), !0);
|
|
1340
1340
|
}
|
|
1341
1341
|
/**
|
|
1342
1342
|
* @param ctx - Conversion context, originally set in Document#toJS()
|
|
@@ -1347,16 +1347,16 @@ class B 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
|
+
es(t, i, r);
|
|
1351
1351
|
return i;
|
|
1352
1352
|
}
|
|
1353
1353
|
toString(e, t, n) {
|
|
1354
1354
|
if (!e)
|
|
1355
1355
|
return JSON.stringify(this);
|
|
1356
1356
|
for (const i of this.items)
|
|
1357
|
-
if (
|
|
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 })), ts(this, e, {
|
|
1360
1360
|
blockItemPrefix: "",
|
|
1361
1361
|
flowChars: { start: "{", end: "}" },
|
|
1362
1362
|
itemIndent: e.indent || "",
|
|
@@ -1368,19 +1368,19 @@ class B extends qt {
|
|
|
1368
1368
|
const ce = {
|
|
1369
1369
|
collection: "map",
|
|
1370
1370
|
default: !0,
|
|
1371
|
-
nodeClass:
|
|
1371
|
+
nodeClass: M,
|
|
1372
1372
|
tag: "tag:yaml.org,2002:map",
|
|
1373
1373
|
resolve(s, e) {
|
|
1374
1374
|
return be(s) || e("Expected a mapping for this tag"), s;
|
|
1375
1375
|
},
|
|
1376
|
-
createNode: (s, e, t) =>
|
|
1376
|
+
createNode: (s, e, t) => M.from(s, e, t)
|
|
1377
1377
|
};
|
|
1378
|
-
class
|
|
1378
|
+
class W extends Wt {
|
|
1379
1379
|
static get tagName() {
|
|
1380
1380
|
return "tag:yaml.org,2002:seq";
|
|
1381
1381
|
}
|
|
1382
1382
|
constructor(e) {
|
|
1383
|
-
super(
|
|
1383
|
+
super(le, e), this.items = [];
|
|
1384
1384
|
}
|
|
1385
1385
|
add(e) {
|
|
1386
1386
|
this.items.push(e);
|
|
@@ -1402,7 +1402,7 @@ class H extends qt {
|
|
|
1402
1402
|
if (typeof n != "number")
|
|
1403
1403
|
return;
|
|
1404
1404
|
const i = this.items[n];
|
|
1405
|
-
return !t &&
|
|
1405
|
+
return !t && I(i) ? i.value : i;
|
|
1406
1406
|
}
|
|
1407
1407
|
/**
|
|
1408
1408
|
* Checks if the collection includes a value with the key `key`.
|
|
@@ -1426,18 +1426,18 @@ class H extends qt {
|
|
|
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
|
+
I(i) && Ht(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(P(r, String(i++), t));
|
|
1437
1437
|
return n;
|
|
1438
1438
|
}
|
|
1439
1439
|
toString(e, t, n) {
|
|
1440
|
-
return e ?
|
|
1440
|
+
return e ? ts(this, e, {
|
|
1441
1441
|
blockItemPrefix: "- ",
|
|
1442
1442
|
flowChars: { start: "[", end: "]" },
|
|
1443
1443
|
itemIndent: (e.indent || "") + " ",
|
|
@@ -1449,54 +1449,54 @@ class H extends qt {
|
|
|
1449
1449
|
const { replacer: i } = n, r = new this(e);
|
|
1450
1450
|
if (t && Symbol.iterator in Object(t)) {
|
|
1451
1451
|
let o = 0;
|
|
1452
|
-
for (let
|
|
1452
|
+
for (let l of t) {
|
|
1453
1453
|
if (typeof i == "function") {
|
|
1454
|
-
const
|
|
1455
|
-
|
|
1454
|
+
const a = t instanceof Set ? l : String(o++);
|
|
1455
|
+
l = i.call(t, a, l);
|
|
1456
1456
|
}
|
|
1457
|
-
r.items.push(ge(
|
|
1457
|
+
r.items.push(ge(l, void 0, n));
|
|
1458
1458
|
}
|
|
1459
1459
|
}
|
|
1460
1460
|
return r;
|
|
1461
1461
|
}
|
|
1462
1462
|
}
|
|
1463
1463
|
function Oe(s) {
|
|
1464
|
-
let e =
|
|
1464
|
+
let e = I(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 = {
|
|
1468
1468
|
collection: "seq",
|
|
1469
1469
|
default: !0,
|
|
1470
|
-
nodeClass:
|
|
1470
|
+
nodeClass: W,
|
|
1471
1471
|
tag: "tag:yaml.org,2002:seq",
|
|
1472
1472
|
resolve(s, e) {
|
|
1473
1473
|
return we(s) || e("Expected a sequence for this tag"), s;
|
|
1474
1474
|
},
|
|
1475
|
-
createNode: (s, e, t) =>
|
|
1476
|
-
},
|
|
1475
|
+
createNode: (s, e, t) => W.from(s, e, t)
|
|
1476
|
+
}, xe = {
|
|
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), ct(s, e, t, n);
|
|
1483
1483
|
}
|
|
1484
|
-
},
|
|
1484
|
+
}, Ke = {
|
|
1485
1485
|
identify: (s) => s == null,
|
|
1486
|
-
createNode: () => new
|
|
1486
|
+
createNode: () => new N(null),
|
|
1487
1487
|
default: !0,
|
|
1488
1488
|
tag: "tag:yaml.org,2002:null",
|
|
1489
1489
|
test: /^(?:~|[Nn]ull|NULL)?$/,
|
|
1490
|
-
resolve: () => new
|
|
1491
|
-
stringify: ({ source: s }, e) => typeof s == "string" &&
|
|
1492
|
-
},
|
|
1490
|
+
resolve: () => new N(null),
|
|
1491
|
+
stringify: ({ source: s }, e) => typeof s == "string" && Ke.test.test(s) ? s : e.options.nullStr
|
|
1492
|
+
}, ut = {
|
|
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
|
-
resolve: (s) => new
|
|
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 && ut.test.test(s)) {
|
|
1500
1500
|
const n = s[0] === "t" || s[0] === "T";
|
|
1501
1501
|
if (e === n)
|
|
1502
1502
|
return s;
|
|
@@ -1504,7 +1504,7 @@ const fe = {
|
|
|
1504
1504
|
return e ? t.options.trueStr : t.options.falseStr;
|
|
1505
1505
|
}
|
|
1506
1506
|
};
|
|
1507
|
-
function
|
|
1507
|
+
function K({ format: s, minFractionDigits: e, tag: t, value: n }) {
|
|
1508
1508
|
if (typeof n == "bigint")
|
|
1509
1509
|
return String(n);
|
|
1510
1510
|
const i = typeof n == "number" ? n : Number(n);
|
|
@@ -1514,20 +1514,20 @@ function D({ format: s, minFractionDigits: e, tag: t, value: n }) {
|
|
|
1514
1514
|
if (!s && e && (!t || t === "tag:yaml.org,2002:float") && /^\d/.test(r)) {
|
|
1515
1515
|
let o = r.indexOf(".");
|
|
1516
1516
|
o < 0 && (o = r.length, r += ".");
|
|
1517
|
-
let
|
|
1518
|
-
for (;
|
|
1517
|
+
let l = e - (r.length - o - 1);
|
|
1518
|
+
for (; l-- > 0; )
|
|
1519
1519
|
r += "0";
|
|
1520
1520
|
}
|
|
1521
1521
|
return r;
|
|
1522
1522
|
}
|
|
1523
|
-
const
|
|
1523
|
+
const ss = {
|
|
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
|
-
stringify:
|
|
1530
|
-
},
|
|
1529
|
+
stringify: K
|
|
1530
|
+
}, ns = {
|
|
1531
1531
|
identify: (s) => typeof s == "number",
|
|
1532
1532
|
default: !0,
|
|
1533
1533
|
tag: "tag:yaml.org,2002:float",
|
|
@@ -1536,78 +1536,78 @@ const Qt = {
|
|
|
1536
1536
|
resolve: (s) => parseFloat(s),
|
|
1537
1537
|
stringify(s) {
|
|
1538
1538
|
const e = Number(s.value);
|
|
1539
|
-
return isFinite(e) ? e.toExponential() :
|
|
1539
|
+
return isFinite(e) ? e.toExponential() : K(s);
|
|
1540
1540
|
}
|
|
1541
|
-
},
|
|
1541
|
+
}, is = {
|
|
1542
1542
|
identify: (s) => typeof s == "number",
|
|
1543
1543
|
default: !0,
|
|
1544
1544
|
tag: "tag:yaml.org,2002:float",
|
|
1545
1545
|
test: /^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,
|
|
1546
1546
|
resolve(s) {
|
|
1547
|
-
const e = new
|
|
1547
|
+
const e = new N(parseFloat(s)), t = s.indexOf(".");
|
|
1548
1548
|
return t !== -1 && s[s.length - 1] === "0" && (e.minFractionDigits = s.length - t - 1), e;
|
|
1549
1549
|
},
|
|
1550
|
-
stringify:
|
|
1551
|
-
},
|
|
1552
|
-
function
|
|
1550
|
+
stringify: K
|
|
1551
|
+
}, Re = (s) => typeof s == "bigint" || Number.isInteger(s), ht = (s, e, t, { intAsBigInt: n }) => n ? BigInt(s) : parseInt(s.substring(e), t);
|
|
1552
|
+
function rs(s, e, t) {
|
|
1553
1553
|
const { value: n } = s;
|
|
1554
|
-
return
|
|
1554
|
+
return Re(n) && n >= 0 ? t + n.toString(e) : K(s);
|
|
1555
1555
|
}
|
|
1556
|
-
const
|
|
1557
|
-
identify: (s) =>
|
|
1556
|
+
const os = {
|
|
1557
|
+
identify: (s) => Re(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) => ht(s, 2, 8, t),
|
|
1563
|
+
stringify: (s) => rs(s, 8, "0o")
|
|
1564
|
+
}, ls = {
|
|
1565
|
+
identify: Re,
|
|
1566
1566
|
default: !0,
|
|
1567
1567
|
tag: "tag:yaml.org,2002:int",
|
|
1568
1568
|
test: /^[-+]?[0-9]+$/,
|
|
1569
|
-
resolve: (s, e, t) =>
|
|
1570
|
-
stringify:
|
|
1571
|
-
},
|
|
1572
|
-
identify: (s) =>
|
|
1569
|
+
resolve: (s, e, t) => ht(s, 0, 10, t),
|
|
1570
|
+
stringify: K
|
|
1571
|
+
}, as = {
|
|
1572
|
+
identify: (s) => Re(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) => ht(s, 2, 16, t),
|
|
1578
|
+
stringify: (s) => rs(s, 16, "0x")
|
|
1579
|
+
}, nn = [
|
|
1580
1580
|
ce,
|
|
1581
1581
|
fe,
|
|
1582
|
+
xe,
|
|
1582
1583
|
Ke,
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
xt
|
|
1584
|
+
ut,
|
|
1585
|
+
os,
|
|
1586
|
+
ls,
|
|
1587
|
+
as,
|
|
1588
|
+
ss,
|
|
1589
|
+
ns,
|
|
1590
|
+
is
|
|
1591
1591
|
];
|
|
1592
|
-
function
|
|
1592
|
+
function Ot(s) {
|
|
1593
1593
|
return typeof s == "bigint" || Number.isInteger(s);
|
|
1594
1594
|
}
|
|
1595
|
-
const
|
|
1595
|
+
const Ee = ({ value: s }) => JSON.stringify(s), rn = [
|
|
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: Ee
|
|
1602
1602
|
},
|
|
1603
1603
|
{
|
|
1604
1604
|
identify: (s) => s == null,
|
|
1605
|
-
createNode: () => new
|
|
1605
|
+
createNode: () => new N(null),
|
|
1606
1606
|
default: !0,
|
|
1607
1607
|
tag: "tag:yaml.org,2002:null",
|
|
1608
1608
|
test: /^null$/,
|
|
1609
1609
|
resolve: () => null,
|
|
1610
|
-
stringify:
|
|
1610
|
+
stringify: Ee
|
|
1611
1611
|
},
|
|
1612
1612
|
{
|
|
1613
1613
|
identify: (s) => typeof s == "boolean",
|
|
@@ -1615,15 +1615,15 @@ const Ae = ({ value: s }) => JSON.stringify(s), Xs = [
|
|
|
1615
1615
|
tag: "tag:yaml.org,2002:bool",
|
|
1616
1616
|
test: /^true$|^false$/,
|
|
1617
1617
|
resolve: (s) => s === "true",
|
|
1618
|
-
stringify:
|
|
1618
|
+
stringify: Ee
|
|
1619
1619
|
},
|
|
1620
1620
|
{
|
|
1621
|
-
identify:
|
|
1621
|
+
identify: Ot,
|
|
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 }) => Ot(s) ? s.toString() : JSON.stringify(s)
|
|
1627
1627
|
},
|
|
1628
1628
|
{
|
|
1629
1629
|
identify: (s) => typeof s == "number",
|
|
@@ -1631,16 +1631,16 @@ const Ae = ({ value: s }) => JSON.stringify(s), Xs = [
|
|
|
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: Ee
|
|
1635
1635
|
}
|
|
1636
|
-
],
|
|
1636
|
+
], on = {
|
|
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
|
+
}, ln = [ce, fe].concat(rn, on), dt = {
|
|
1644
1644
|
identify: (s) => s instanceof Uint8Array,
|
|
1645
1645
|
// Buffer inherits from Uint8Array
|
|
1646
1646
|
default: !1,
|
|
@@ -1666,32 +1666,32 @@ const Ae = ({ value: s }) => JSON.stringify(s), Xs = [
|
|
|
1666
1666
|
if (!t)
|
|
1667
1667
|
return "";
|
|
1668
1668
|
const o = t;
|
|
1669
|
-
let
|
|
1669
|
+
let l;
|
|
1670
1670
|
if (typeof btoa == "function") {
|
|
1671
|
-
let
|
|
1671
|
+
let a = "";
|
|
1672
1672
|
for (let c = 0; c < o.length; ++c)
|
|
1673
|
-
|
|
1674
|
-
|
|
1673
|
+
a += String.fromCharCode(o[c]);
|
|
1674
|
+
l = btoa(a);
|
|
1675
1675
|
} else
|
|
1676
1676
|
throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");
|
|
1677
|
-
if (e ?? (e =
|
|
1678
|
-
const
|
|
1679
|
-
for (let u = 0, f = 0; u < c; ++u, f +=
|
|
1680
|
-
d[u] =
|
|
1681
|
-
|
|
1677
|
+
if (e ?? (e = N.BLOCK_LITERAL), e !== N.QUOTE_DOUBLE) {
|
|
1678
|
+
const a = Math.max(n.options.lineWidth - n.indent.length, n.options.minContentWidth), c = Math.ceil(l.length / a), d = new Array(c);
|
|
1679
|
+
for (let u = 0, f = 0; u < c; ++u, f += a)
|
|
1680
|
+
d[u] = l.substr(f, a);
|
|
1681
|
+
l = d.join(e === N.BLOCK_LITERAL ? `
|
|
1682
1682
|
` : " ");
|
|
1683
1683
|
}
|
|
1684
|
-
return
|
|
1684
|
+
return ct({ comment: s, type: e, value: l }, n, i, r);
|
|
1685
1685
|
}
|
|
1686
1686
|
};
|
|
1687
|
-
function
|
|
1687
|
+
function cs(s, e) {
|
|
1688
1688
|
if (we(s))
|
|
1689
1689
|
for (let t = 0; t < s.items.length; ++t) {
|
|
1690
1690
|
let n = s.items[t];
|
|
1691
|
-
if (
|
|
1691
|
+
if (!$(n)) {
|
|
1692
1692
|
if (be(n)) {
|
|
1693
1693
|
n.items.length > 1 && e("Each pair must have its own sequence indicator");
|
|
1694
|
-
const i = n.items[0] || new
|
|
1694
|
+
const i = n.items[0] || new B(new N(null));
|
|
1695
1695
|
if (n.commentBefore && (i.key.commentBefore = i.key.commentBefore ? `${n.commentBefore}
|
|
1696
1696
|
${i.key.commentBefore}` : n.commentBefore), n.comment) {
|
|
1697
1697
|
const r = i.value ?? i.key;
|
|
@@ -1700,48 +1700,48 @@ ${r.comment}` : n.comment;
|
|
|
1700
1700
|
}
|
|
1701
1701
|
n = i;
|
|
1702
1702
|
}
|
|
1703
|
-
s.items[t] =
|
|
1703
|
+
s.items[t] = $(n) ? n : new B(n);
|
|
1704
1704
|
}
|
|
1705
1705
|
}
|
|
1706
1706
|
else
|
|
1707
1707
|
e("Expected a sequence for this tag");
|
|
1708
1708
|
return s;
|
|
1709
1709
|
}
|
|
1710
|
-
function
|
|
1711
|
-
const { replacer: n } = t, i = new
|
|
1710
|
+
function fs(s, e, t) {
|
|
1711
|
+
const { replacer: n } = t, i = new W(s);
|
|
1712
1712
|
i.tag = "tag:yaml.org,2002:pairs";
|
|
1713
1713
|
let r = 0;
|
|
1714
1714
|
if (e && Symbol.iterator in Object(e))
|
|
1715
1715
|
for (let o of e) {
|
|
1716
1716
|
typeof n == "function" && (o = n.call(e, String(r++), o));
|
|
1717
|
-
let
|
|
1717
|
+
let l, a;
|
|
1718
1718
|
if (Array.isArray(o))
|
|
1719
1719
|
if (o.length === 2)
|
|
1720
|
-
|
|
1720
|
+
l = o[0], a = o[1];
|
|
1721
1721
|
else
|
|
1722
1722
|
throw new TypeError(`Expected [key, value] tuple: ${o}`);
|
|
1723
1723
|
else if (o && o instanceof Object) {
|
|
1724
1724
|
const c = Object.keys(o);
|
|
1725
1725
|
if (c.length === 1)
|
|
1726
|
-
|
|
1726
|
+
l = c[0], a = o[l];
|
|
1727
1727
|
else
|
|
1728
1728
|
throw new TypeError(`Expected tuple with one key, not ${c.length} keys`);
|
|
1729
1729
|
} else
|
|
1730
|
-
|
|
1731
|
-
i.items.push(
|
|
1730
|
+
l = o;
|
|
1731
|
+
i.items.push(ft(l, a, t));
|
|
1732
1732
|
}
|
|
1733
1733
|
return i;
|
|
1734
1734
|
}
|
|
1735
|
-
const
|
|
1735
|
+
const pt = {
|
|
1736
1736
|
collection: "seq",
|
|
1737
1737
|
default: !1,
|
|
1738
1738
|
tag: "tag:yaml.org,2002:pairs",
|
|
1739
|
-
resolve:
|
|
1740
|
-
createNode:
|
|
1739
|
+
resolve: cs,
|
|
1740
|
+
createNode: fs
|
|
1741
1741
|
};
|
|
1742
|
-
class ne extends
|
|
1742
|
+
class ne extends W {
|
|
1743
1743
|
constructor() {
|
|
1744
|
-
super(), this.add =
|
|
1744
|
+
super(), this.add = M.prototype.add.bind(this), this.delete = M.prototype.delete.bind(this), this.get = M.prototype.get.bind(this), this.has = M.prototype.has.bind(this), this.set = M.prototype.set.bind(this), this.tag = ne.tag;
|
|
1745
1745
|
}
|
|
1746
1746
|
/**
|
|
1747
1747
|
* If `ctx` is given, the return type is actually `Map<unknown, unknown>`,
|
|
@@ -1754,57 +1754,57 @@ class ne extends H {
|
|
|
1754
1754
|
t?.onCreate && t.onCreate(n);
|
|
1755
1755
|
for (const i of this.items) {
|
|
1756
1756
|
let r, o;
|
|
1757
|
-
if (
|
|
1757
|
+
if ($(i) ? (r = P(i.key, "", t), o = P(i.value, r, t)) : r = P(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 = fs(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 mt = {
|
|
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 = cs(s, e), n = [];
|
|
1777
1777
|
for (const { key: i } of t.items)
|
|
1778
|
-
|
|
1778
|
+
I(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 us({ value: s, source: e }, t) {
|
|
1784
|
+
return e && (s ? hs : ds).test.test(e) ? e : s ? t.options.trueStr : t.options.falseStr;
|
|
1785
1785
|
}
|
|
1786
|
-
const
|
|
1786
|
+
const hs = {
|
|
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
|
-
resolve: () => new
|
|
1792
|
-
stringify:
|
|
1793
|
-
},
|
|
1791
|
+
resolve: () => new N(!0),
|
|
1792
|
+
stringify: us
|
|
1793
|
+
}, ds = {
|
|
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
|
-
resolve: () => new
|
|
1799
|
-
stringify:
|
|
1800
|
-
},
|
|
1798
|
+
resolve: () => new N(!1),
|
|
1799
|
+
stringify: us
|
|
1800
|
+
}, an = {
|
|
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
|
-
stringify:
|
|
1807
|
-
},
|
|
1806
|
+
stringify: K
|
|
1807
|
+
}, cn = {
|
|
1808
1808
|
identify: (s) => typeof s == "number",
|
|
1809
1809
|
default: !0,
|
|
1810
1810
|
tag: "tag:yaml.org,2002:float",
|
|
@@ -1813,24 +1813,24 @@ const rs = {
|
|
|
1813
1813
|
resolve: (s) => parseFloat(s.replace(/_/g, "")),
|
|
1814
1814
|
stringify(s) {
|
|
1815
1815
|
const e = Number(s.value);
|
|
1816
|
-
return isFinite(e) ? e.toExponential() :
|
|
1816
|
+
return isFinite(e) ? e.toExponential() : K(s);
|
|
1817
1817
|
}
|
|
1818
|
-
},
|
|
1818
|
+
}, fn = {
|
|
1819
1819
|
identify: (s) => typeof s == "number",
|
|
1820
1820
|
default: !0,
|
|
1821
1821
|
tag: "tag:yaml.org,2002:float",
|
|
1822
1822
|
test: /^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,
|
|
1823
1823
|
resolve(s) {
|
|
1824
|
-
const e = new
|
|
1824
|
+
const e = new N(parseFloat(s.replace(/_/g, ""))), t = s.indexOf(".");
|
|
1825
1825
|
if (t !== -1) {
|
|
1826
1826
|
const n = s.substring(t + 1).replace(/_/g, "");
|
|
1827
1827
|
n[n.length - 1] === "0" && (e.minFractionDigits = n.length);
|
|
1828
1828
|
}
|
|
1829
1829
|
return e;
|
|
1830
1830
|
},
|
|
1831
|
-
stringify:
|
|
1832
|
-
},
|
|
1833
|
-
function
|
|
1831
|
+
stringify: K
|
|
1832
|
+
}, Se = (s) => typeof s == "bigint" || Number.isInteger(s);
|
|
1833
|
+
function Ue(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,67 +1850,67 @@ function Fe(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 gt(s, e, t) {
|
|
1854
1854
|
const { value: n } = s;
|
|
1855
|
-
if (
|
|
1855
|
+
if (Se(n)) {
|
|
1856
1856
|
const i = n.toString(e);
|
|
1857
1857
|
return n < 0 ? "-" + t + i.substr(1) : t + i;
|
|
1858
1858
|
}
|
|
1859
|
-
return
|
|
1859
|
+
return K(s);
|
|
1860
1860
|
}
|
|
1861
|
-
const
|
|
1862
|
-
identify:
|
|
1861
|
+
const un = {
|
|
1862
|
+
identify: Se,
|
|
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) => Ue(s, 2, 2, t),
|
|
1868
|
+
stringify: (s) => gt(s, 2, "0b")
|
|
1869
|
+
}, hn = {
|
|
1870
|
+
identify: Se,
|
|
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) => Ue(s, 1, 8, t),
|
|
1876
|
+
stringify: (s) => gt(s, 8, "0")
|
|
1877
|
+
}, dn = {
|
|
1878
|
+
identify: Se,
|
|
1879
1879
|
default: !0,
|
|
1880
1880
|
tag: "tag:yaml.org,2002:int",
|
|
1881
1881
|
test: /^[-+]?[0-9][0-9_]*$/,
|
|
1882
|
-
resolve: (s, e, t) =>
|
|
1883
|
-
stringify:
|
|
1884
|
-
},
|
|
1885
|
-
identify:
|
|
1882
|
+
resolve: (s, e, t) => Ue(s, 0, 10, t),
|
|
1883
|
+
stringify: K
|
|
1884
|
+
}, pn = {
|
|
1885
|
+
identify: Se,
|
|
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) => Ue(s, 2, 16, t),
|
|
1891
|
+
stringify: (s) => gt(s, 16, "0x")
|
|
1892
1892
|
};
|
|
1893
|
-
class ie extends
|
|
1893
|
+
class ie extends M {
|
|
1894
1894
|
constructor(e) {
|
|
1895
1895
|
super(e), this.tag = ie.tag;
|
|
1896
1896
|
}
|
|
1897
1897
|
add(e) {
|
|
1898
1898
|
let t;
|
|
1899
|
-
|
|
1899
|
+
$(e) ? t = e : e && typeof e == "object" && "key" in e && "value" in e && e.value === null ? t = new B(e.key, null) : t = new B(e, null), H(this.items, t.key) || this.items.push(t);
|
|
1900
1900
|
}
|
|
1901
1901
|
/**
|
|
1902
1902
|
* If `keepPair` is `true`, returns the Pair matching `key`.
|
|
1903
1903
|
* Otherwise, returns the value of that Pair's key.
|
|
1904
1904
|
*/
|
|
1905
1905
|
get(e, t) {
|
|
1906
|
-
const n =
|
|
1907
|
-
return !t &&
|
|
1906
|
+
const n = H(this.items, e);
|
|
1907
|
+
return !t && $(n) ? I(n.key) ? n.key.value : n.key : n;
|
|
1908
1908
|
}
|
|
1909
1909
|
set(e, t) {
|
|
1910
1910
|
if (typeof t != "boolean")
|
|
1911
1911
|
throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);
|
|
1912
|
-
const n =
|
|
1913
|
-
n && !t ? this.items.splice(this.items.indexOf(n), 1) : !n && t && this.items.push(new
|
|
1912
|
+
const n = H(this.items, e);
|
|
1913
|
+
n && !t ? this.items.splice(this.items.indexOf(n), 1) : !n && t && this.items.push(new B(e));
|
|
1914
1914
|
}
|
|
1915
1915
|
toJSON(e, t) {
|
|
1916
1916
|
return super.toJSON(e, t, Set);
|
|
@@ -1926,12 +1926,12 @@ class ie extends B {
|
|
|
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(ft(o, null, n));
|
|
1930
1930
|
return r;
|
|
1931
1931
|
}
|
|
1932
1932
|
}
|
|
1933
1933
|
ie.tag = "tag:yaml.org,2002:set";
|
|
1934
|
-
const
|
|
1934
|
+
const yt = {
|
|
1935
1935
|
collection: "map",
|
|
1936
1936
|
identify: (s) => s instanceof Set,
|
|
1937
1937
|
nodeClass: ie,
|
|
@@ -1948,38 +1948,38 @@ const mt = {
|
|
|
1948
1948
|
return s;
|
|
1949
1949
|
}
|
|
1950
1950
|
};
|
|
1951
|
-
function
|
|
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,
|
|
1951
|
+
function bt(s, e) {
|
|
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 ps(s) {
|
|
1956
1956
|
let { value: e } = s, t = (o) => o;
|
|
1957
1957
|
if (typeof e == "bigint")
|
|
1958
1958
|
t = (o) => BigInt(o);
|
|
1959
1959
|
else if (isNaN(e) || !isFinite(e))
|
|
1960
|
-
return
|
|
1960
|
+
return K(s);
|
|
1961
1961
|
let n = "";
|
|
1962
1962
|
e < 0 && (n = "-", e *= t(-1));
|
|
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 ms = {
|
|
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 }) => bt(s, t),
|
|
1973
|
+
stringify: ps
|
|
1974
|
+
}, gs = {
|
|
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) => bt(s, !1),
|
|
1981
|
+
stringify: ps
|
|
1982
|
+
}, Fe = {
|
|
1983
1983
|
identify: (s) => s instanceof Date,
|
|
1984
1984
|
default: !0,
|
|
1985
1985
|
tag: "tag:yaml.org,2002:timestamp",
|
|
@@ -1988,147 +1988,147 @@ const ls = {
|
|
|
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(Fe.test);
|
|
1992
1992
|
if (!e)
|
|
1993
1993
|
throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");
|
|
1994
|
-
const [, t, n, i, r, o,
|
|
1995
|
-
let c = Date.UTC(t, n - 1, i, r || 0, o || 0,
|
|
1994
|
+
const [, t, n, i, r, o, l] = e.map(Number), a = e[7] ? Number((e[7] + "00").substr(1, 3)) : 0;
|
|
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 = bt(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
|
+
}, Et = [
|
|
2005
2005
|
ce,
|
|
2006
2006
|
fe,
|
|
2007
|
+
xe,
|
|
2007
2008
|
Ke,
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
tn,
|
|
2018
|
-
ut,
|
|
2019
|
-
R,
|
|
2009
|
+
hs,
|
|
2010
|
+
ds,
|
|
2011
|
+
un,
|
|
2012
|
+
hn,
|
|
2013
|
+
dn,
|
|
2014
|
+
pn,
|
|
2015
|
+
an,
|
|
2016
|
+
cn,
|
|
2017
|
+
fn,
|
|
2020
2018
|
dt,
|
|
2021
|
-
|
|
2019
|
+
F,
|
|
2022
2020
|
mt,
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
["
|
|
2030
|
-
["
|
|
2031
|
-
["
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2021
|
+
pt,
|
|
2022
|
+
yt,
|
|
2023
|
+
ms,
|
|
2024
|
+
gs,
|
|
2025
|
+
Fe
|
|
2026
|
+
], Tt = /* @__PURE__ */ new Map([
|
|
2027
|
+
["core", nn],
|
|
2028
|
+
["failsafe", [ce, fe, xe]],
|
|
2029
|
+
["json", ln],
|
|
2030
|
+
["yaml11", Et],
|
|
2031
|
+
["yaml-1.1", Et]
|
|
2032
|
+
]), It = {
|
|
2033
|
+
binary: dt,
|
|
2034
|
+
bool: ut,
|
|
2035
|
+
float: is,
|
|
2036
|
+
floatExp: ns,
|
|
2037
|
+
floatNaN: ss,
|
|
2038
|
+
floatTime: gs,
|
|
2039
|
+
int: ls,
|
|
2040
|
+
intHex: as,
|
|
2041
|
+
intOct: os,
|
|
2042
|
+
intTime: ms,
|
|
2043
2043
|
map: ce,
|
|
2044
|
-
merge:
|
|
2045
|
-
null:
|
|
2046
|
-
omap:
|
|
2047
|
-
pairs:
|
|
2044
|
+
merge: F,
|
|
2045
|
+
null: Ke,
|
|
2046
|
+
omap: mt,
|
|
2047
|
+
pairs: pt,
|
|
2048
2048
|
seq: fe,
|
|
2049
|
-
set:
|
|
2050
|
-
timestamp:
|
|
2051
|
-
},
|
|
2052
|
-
"tag:yaml.org,2002:binary":
|
|
2053
|
-
"tag:yaml.org,2002:merge":
|
|
2054
|
-
"tag:yaml.org,2002:omap":
|
|
2055
|
-
"tag:yaml.org,2002:pairs":
|
|
2056
|
-
"tag:yaml.org,2002:set":
|
|
2057
|
-
"tag:yaml.org,2002:timestamp":
|
|
2049
|
+
set: yt,
|
|
2050
|
+
timestamp: Fe
|
|
2051
|
+
}, mn = {
|
|
2052
|
+
"tag:yaml.org,2002:binary": dt,
|
|
2053
|
+
"tag:yaml.org,2002:merge": F,
|
|
2054
|
+
"tag:yaml.org,2002:omap": mt,
|
|
2055
|
+
"tag:yaml.org,2002:pairs": pt,
|
|
2056
|
+
"tag:yaml.org,2002:set": yt,
|
|
2057
|
+
"tag:yaml.org,2002:timestamp": Fe
|
|
2058
2058
|
};
|
|
2059
2059
|
function Je(s, e, t) {
|
|
2060
|
-
const n =
|
|
2060
|
+
const n = Tt.get(e);
|
|
2061
2061
|
if (n && !s)
|
|
2062
|
-
return t && !n.includes(
|
|
2062
|
+
return t && !n.includes(F) ? n.concat(F) : n.slice();
|
|
2063
2063
|
let i = n;
|
|
2064
2064
|
if (!i)
|
|
2065
2065
|
if (Array.isArray(s))
|
|
2066
2066
|
i = [];
|
|
2067
2067
|
else {
|
|
2068
|
-
const r = Array.from(
|
|
2068
|
+
const r = Array.from(Tt.keys()).filter((o) => o !== "yaml11").map((o) => JSON.stringify(o)).join(", ");
|
|
2069
2069
|
throw new Error(`Unknown schema "${e}"; use one of ${r} or define customTags array`);
|
|
2070
2070
|
}
|
|
2071
2071
|
if (Array.isArray(s))
|
|
2072
2072
|
for (const r of s)
|
|
2073
2073
|
i = i.concat(r);
|
|
2074
2074
|
else typeof s == "function" && (i = s(i.slice()));
|
|
2075
|
-
return t && (i = i.concat(
|
|
2076
|
-
const
|
|
2077
|
-
if (!
|
|
2078
|
-
const
|
|
2079
|
-
throw new Error(`Unknown custom tag ${
|
|
2075
|
+
return t && (i = i.concat(F)), i.reduce((r, o) => {
|
|
2076
|
+
const l = typeof o == "string" ? It[o] : o;
|
|
2077
|
+
if (!l) {
|
|
2078
|
+
const a = JSON.stringify(o), c = Object.keys(It).map((d) => JSON.stringify(d)).join(", ");
|
|
2079
|
+
throw new Error(`Unknown custom tag ${a}; use one of ${c}`);
|
|
2080
2080
|
}
|
|
2081
|
-
return r.includes(
|
|
2081
|
+
return r.includes(l) || r.push(l), r;
|
|
2082
2082
|
}, []);
|
|
2083
2083
|
}
|
|
2084
|
-
const
|
|
2085
|
-
class
|
|
2086
|
-
constructor({ compat: e, customTags: t, merge: n, resolveKnownTags: i, schema: r, sortMapEntries: o, toStringDefaults:
|
|
2087
|
-
this.compat = Array.isArray(e) ? Je(e, "compat") : e ? Je(null, e) : null, this.name = typeof r == "string" && r || "core", this.knownTags = i ?
|
|
2084
|
+
const gn = (s, e) => s.key < e.key ? -1 : s.key > e.key ? 1 : 0;
|
|
2085
|
+
class wt {
|
|
2086
|
+
constructor({ compat: e, customTags: t, merge: n, resolveKnownTags: i, schema: r, sortMapEntries: o, toStringDefaults: l }) {
|
|
2087
|
+
this.compat = Array.isArray(e) ? Je(e, "compat") : e ? Je(null, e) : null, this.name = typeof r == "string" && r || "core", this.knownTags = i ? mn : {}, this.tags = Je(t, this.name, n), this.toStringOptions = l ?? null, Object.defineProperty(this, J, { value: ce }), Object.defineProperty(this, R, { value: xe }), Object.defineProperty(this, le, { value: fe }), this.sortMapEntries = typeof o == "function" ? o : o === !0 ? gn : null;
|
|
2088
2088
|
}
|
|
2089
2089
|
clone() {
|
|
2090
|
-
const e = Object.create(
|
|
2090
|
+
const e = Object.create(wt.prototype, Object.getOwnPropertyDescriptors(this));
|
|
2091
2091
|
return e.tags = this.tags.slice(), e;
|
|
2092
2092
|
}
|
|
2093
2093
|
}
|
|
2094
|
-
function
|
|
2094
|
+
function yn(s, e) {
|
|
2095
2095
|
const t = [];
|
|
2096
2096
|
let n = e.directives === !0;
|
|
2097
2097
|
if (e.directives !== !1 && s.directives) {
|
|
2098
|
-
const
|
|
2099
|
-
|
|
2098
|
+
const a = s.directives.toString(s);
|
|
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 = Xt(s, e), { commentString: r } = i.options;
|
|
2103
2103
|
if (s.commentBefore) {
|
|
2104
2104
|
t.length !== 1 && t.unshift("");
|
|
2105
|
-
const
|
|
2106
|
-
t.unshift(
|
|
2105
|
+
const a = r(s.commentBefore);
|
|
2106
|
+
t.unshift(U(a, ""));
|
|
2107
2107
|
}
|
|
2108
|
-
let o = !1,
|
|
2108
|
+
let o = !1, l = null;
|
|
2109
2109
|
if (s.contents) {
|
|
2110
|
-
if (
|
|
2110
|
+
if (v(s.contents)) {
|
|
2111
2111
|
if (s.contents.spaceBefore && n && t.push(""), s.contents.commentBefore) {
|
|
2112
2112
|
const d = r(s.contents.commentBefore);
|
|
2113
|
-
t.push(
|
|
2113
|
+
t.push(U(d, ""));
|
|
2114
2114
|
}
|
|
2115
|
-
i.forceBlockIndent = !!s.comment,
|
|
2115
|
+
i.forceBlockIndent = !!s.comment, l = s.contents.comment;
|
|
2116
2116
|
}
|
|
2117
|
-
const
|
|
2118
|
-
let c = re(s.contents, i, () =>
|
|
2119
|
-
|
|
2117
|
+
const a = l ? void 0 : () => o = !0;
|
|
2118
|
+
let c = re(s.contents, i, () => l = null, a);
|
|
2119
|
+
l && (c += G(c, "", r(l))), (c[0] === "|" || c[0] === ">") && t[t.length - 1] === "---" ? t[t.length - 1] = `--- ${c}` : t.push(c);
|
|
2120
2120
|
} else
|
|
2121
2121
|
t.push(re(s.contents, i));
|
|
2122
2122
|
if (s.directives?.docEnd)
|
|
2123
2123
|
if (s.comment) {
|
|
2124
|
-
const
|
|
2125
|
-
|
|
2126
|
-
`) ? (t.push("..."), t.push(
|
|
2124
|
+
const a = r(s.comment);
|
|
2125
|
+
a.includes(`
|
|
2126
|
+
`) ? (t.push("..."), t.push(U(a, ""))) : t.push(`... ${a}`);
|
|
2127
2127
|
} else
|
|
2128
2128
|
t.push("...");
|
|
2129
2129
|
else {
|
|
2130
|
-
let
|
|
2131
|
-
|
|
2130
|
+
let a = s.comment;
|
|
2131
|
+
a && o && (a = a.replace(/^\n+/, "")), a && ((!o || l) && t[t.length - 1] !== "" && t.push(""), t.push(U(r(a), "")));
|
|
2132
2132
|
}
|
|
2133
2133
|
return t.join(`
|
|
2134
2134
|
`) + `
|
|
@@ -2136,7 +2136,7 @@ function cn(s, e) {
|
|
|
2136
2136
|
}
|
|
2137
2137
|
class qe {
|
|
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, D, { value: Xe });
|
|
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({
|
|
@@ -2151,7 +2151,7 @@ class qe {
|
|
|
2151
2151
|
}, n);
|
|
2152
2152
|
this.options = r;
|
|
2153
2153
|
let { version: o } = r;
|
|
2154
|
-
n?._directives ? (this.directives = n._directives.atDocument(), this.directives.yaml.explicit && (o = this.directives.yaml.version)) : this.directives = new
|
|
2154
|
+
n?._directives ? (this.directives = n._directives.atDocument(), this.directives.yaml.explicit && (o = this.directives.yaml.version)) : this.directives = new j({ version: o }), this.setSchema(o, n), this.contents = e === void 0 ? null : this.createNode(e, i, n);
|
|
2155
2155
|
}
|
|
2156
2156
|
/**
|
|
2157
2157
|
* Create a deep copy of this Document and its contents.
|
|
@@ -2160,9 +2160,9 @@ class qe {
|
|
|
2160
2160
|
*/
|
|
2161
2161
|
clone() {
|
|
2162
2162
|
const e = Object.create(qe.prototype, {
|
|
2163
|
-
[
|
|
2163
|
+
[D]: { value: Xe }
|
|
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 = v(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 = Yt(this);
|
|
2187
2187
|
e.anchor = // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
2188
|
-
!t || n.has(t) ?
|
|
2188
|
+
!t || n.has(t) ? Gt(t || "a", n) : t;
|
|
2189
2189
|
}
|
|
2190
|
-
return new
|
|
2190
|
+
return new at(e.anchor);
|
|
2191
2191
|
}
|
|
2192
2192
|
createNode(e, t, n) {
|
|
2193
2193
|
let i;
|
|
@@ -2197,20 +2197,20 @@ 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:
|
|
2200
|
+
const { aliasDuplicateObjects: r, anchorPrefix: o, flow: l, keepUndefined: a, onTagObj: c, tag: d } = n ?? {}, { onAnchor: u, setAnchors: f, sourceObjects: p } = Vs(
|
|
2201
2201
|
this,
|
|
2202
2202
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
2203
2203
|
o || "a"
|
|
2204
2204
|
), g = {
|
|
2205
2205
|
aliasDuplicateObjects: r ?? !0,
|
|
2206
|
-
keepUndefined:
|
|
2206
|
+
keepUndefined: a ?? !1,
|
|
2207
2207
|
onAnchor: u,
|
|
2208
2208
|
onTagObj: c,
|
|
2209
2209
|
replacer: i,
|
|
2210
2210
|
schema: this.schema,
|
|
2211
2211
|
sourceObjects: p
|
|
2212
2212
|
}, h = ge(e, d, g);
|
|
2213
|
-
return
|
|
2213
|
+
return l && A(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,
|
|
@@ -2218,7 +2218,7 @@ class qe {
|
|
|
2218
2218
|
*/
|
|
2219
2219
|
createPair(e, t, n = {}) {
|
|
2220
2220
|
const i = this.createNode(e, null, n), r = this.createNode(t, null, n);
|
|
2221
|
-
return new
|
|
2221
|
+
return new B(i, r);
|
|
2222
2222
|
}
|
|
2223
2223
|
/**
|
|
2224
2224
|
* Removes a value from the document.
|
|
@@ -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 A(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 && I(this.contents) ? this.contents.value : this.contents : A(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 A(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 : A(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 = Le(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 = Le(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.
|
|
@@ -2288,11 +2288,11 @@ class qe {
|
|
|
2288
2288
|
let n;
|
|
2289
2289
|
switch (e) {
|
|
2290
2290
|
case "1.1":
|
|
2291
|
-
this.directives ? this.directives.yaml.version = "1.1" : this.directives = new
|
|
2291
|
+
this.directives ? this.directives.yaml.version = "1.1" : this.directives = new j({ version: "1.1" }), n = { resolveKnownTags: !1, schema: "yaml-1.1" };
|
|
2292
2292
|
break;
|
|
2293
2293
|
case "1.2":
|
|
2294
2294
|
case "next":
|
|
2295
|
-
this.directives ? this.directives.yaml.version = e : this.directives = new
|
|
2295
|
+
this.directives ? this.directives.yaml.version = e : this.directives = new j({ version: e }), n = { resolveKnownTags: !0, schema: "core" };
|
|
2296
2296
|
break;
|
|
2297
2297
|
case null:
|
|
2298
2298
|
this.directives && delete this.directives, n = null;
|
|
@@ -2305,24 +2305,24 @@ 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 wt(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
|
}
|
|
2312
2312
|
// json & jsonArg are only used from toJSON()
|
|
2313
2313
|
toJS({ json: e, jsonArg: t, mapAsMap: n, maxAliasCount: i, onAnchor: r, reviver: o } = {}) {
|
|
2314
|
-
const
|
|
2314
|
+
const l = {
|
|
2315
2315
|
anchors: /* @__PURE__ */ new Map(),
|
|
2316
2316
|
doc: this,
|
|
2317
2317
|
keep: !e,
|
|
2318
2318
|
mapAsMap: n === !0,
|
|
2319
2319
|
mapKeyWarned: !1,
|
|
2320
2320
|
maxAliasCount: typeof i == "number" ? i : 100
|
|
2321
|
-
},
|
|
2321
|
+
}, a = P(this.contents, t ?? "", l);
|
|
2322
2322
|
if (typeof r == "function")
|
|
2323
|
-
for (const { count: c, res: d } of
|
|
2323
|
+
for (const { count: c, res: d } of l.anchors.values())
|
|
2324
2324
|
r(d, c);
|
|
2325
|
-
return typeof o == "function" ? te(o, { "":
|
|
2325
|
+
return typeof o == "function" ? te(o, { "": a }, "", a) : a;
|
|
2326
2326
|
}
|
|
2327
2327
|
/**
|
|
2328
2328
|
* A JSON representation of the document `contents`.
|
|
@@ -2341,50 +2341,50 @@ 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 yn(this, e);
|
|
2345
2345
|
}
|
|
2346
2346
|
}
|
|
2347
2347
|
function z(s) {
|
|
2348
|
-
if (
|
|
2348
|
+
if (A(s))
|
|
2349
2349
|
return !0;
|
|
2350
2350
|
throw new Error("Expected a YAML collection as document contents");
|
|
2351
2351
|
}
|
|
2352
|
-
class
|
|
2352
|
+
class ys 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 ys {
|
|
2358
2358
|
constructor(e, t, n) {
|
|
2359
2359
|
super("YAMLParseError", e, t, n);
|
|
2360
2360
|
}
|
|
2361
2361
|
}
|
|
2362
|
-
class
|
|
2362
|
+
class bn extends ys {
|
|
2363
2363
|
constructor(e, t, n) {
|
|
2364
2364
|
super("YAMLWarning", e, t, n);
|
|
2365
2365
|
}
|
|
2366
2366
|
}
|
|
2367
|
-
const
|
|
2367
|
+
const At = (s, e) => (t) => {
|
|
2368
2368
|
if (t.pos[0] === -1)
|
|
2369
2369
|
return;
|
|
2370
|
-
t.linePos = t.pos.map((
|
|
2370
|
+
t.linePos = t.pos.map((l) => e.linePos(l));
|
|
2371
2371
|
const { line: n, col: i } = t.linePos[0];
|
|
2372
2372
|
t.message += ` at line ${n}, column ${i}`;
|
|
2373
2373
|
let r = i - 1, o = s.substring(e.lineStarts[n - 1], e.lineStarts[n]).replace(/[\n\r]+$/, "");
|
|
2374
2374
|
if (r >= 60 && o.length > 80) {
|
|
2375
|
-
const
|
|
2376
|
-
o = "…" + o.substring(
|
|
2375
|
+
const l = Math.min(r - 39, o.length - 79);
|
|
2376
|
+
o = "…" + o.substring(l), r -= l - 1;
|
|
2377
2377
|
}
|
|
2378
2378
|
if (o.length > 80 && (o = o.substring(0, 79) + "…"), n > 1 && /^ *$/.test(o.substring(0, r))) {
|
|
2379
|
-
let
|
|
2380
|
-
|
|
2381
|
-
`), o =
|
|
2379
|
+
let l = s.substring(e.lineStarts[n - 2], e.lineStarts[n - 1]);
|
|
2380
|
+
l.length > 80 && (l = l.substring(0, 79) + `…
|
|
2381
|
+
`), o = l + o;
|
|
2382
2382
|
}
|
|
2383
2383
|
if (/[^ ]/.test(o)) {
|
|
2384
|
-
let
|
|
2385
|
-
const
|
|
2386
|
-
|
|
2387
|
-
const c = " ".repeat(r) + "^".repeat(
|
|
2384
|
+
let l = 1;
|
|
2385
|
+
const a = t.linePos[1];
|
|
2386
|
+
a?.line === n && a.col > i && (l = Math.max(1, Math.min(a.col - i, 80 - r)));
|
|
2387
|
+
const c = " ".repeat(r) + "^".repeat(l);
|
|
2388
2388
|
t.message += `:
|
|
2389
2389
|
|
|
2390
2390
|
${o}
|
|
@@ -2392,8 +2392,8 @@ ${c}
|
|
|
2392
2392
|
`;
|
|
2393
2393
|
}
|
|
2394
2394
|
};
|
|
2395
|
-
function oe(s, { flow: e, indicator: t, next: n, offset: i, onError: r, parentIndent: o, startOnNewline:
|
|
2396
|
-
let
|
|
2395
|
+
function oe(s, { flow: e, indicator: t, next: n, offset: i, onError: r, parentIndent: o, startOnNewline: l }) {
|
|
2396
|
+
let a = !1, c = l, d = l, u = "", f = "", p = !1, g = !1, h = null, m = null, b = null, w = null, S = null, k = null, _ = null;
|
|
2397
2397
|
for (const y of s)
|
|
2398
2398
|
switch (g && (y.type !== "space" && y.type !== "newline" && y.type !== "comma" && r(y.offset, "MISSING_CHAR", "Tags and anchors must be separated from the next token by white space"), g = !1), h && (c && y.type !== "comment" && y.type !== "newline" && r(h, "TAB_AS_INDENT", "Tabs are not allowed as indentation"), h = null), y.type) {
|
|
2399
2399
|
case "space":
|
|
@@ -2401,44 +2401,44 @@ function oe(s, { flow: e, indicator: t, next: n, offset: i, onError: r, parentIn
|
|
|
2401
2401
|
break;
|
|
2402
2402
|
case "comment": {
|
|
2403
2403
|
d || r(y, "MISSING_CHAR", "Comments must be separated from other tokens by white space characters");
|
|
2404
|
-
const
|
|
2405
|
-
u ? u += f +
|
|
2404
|
+
const L = y.source.substring(1) || " ";
|
|
2405
|
+
u ? u += f + L : u = L, f = "", c = !1;
|
|
2406
2406
|
break;
|
|
2407
2407
|
}
|
|
2408
2408
|
case "newline":
|
|
2409
|
-
c ? u ? u += y.source : (!
|
|
2409
|
+
c ? u ? u += y.source : (!k || t !== "seq-item-ind") && (a = !0) : f += y.source, c = !0, p = !0, (m || b) && (w = y), d = !0;
|
|
2410
2410
|
break;
|
|
2411
2411
|
case "anchor":
|
|
2412
|
-
m && r(y, "MULTIPLE_ANCHORS", "A node can have at most one anchor"), y.source.endsWith(":") && r(y.offset + y.source.length - 1, "BAD_ALIAS", "Anchor ending in : is ambiguous", !0), m = y,
|
|
2412
|
+
m && r(y, "MULTIPLE_ANCHORS", "A node can have at most one anchor"), y.source.endsWith(":") && r(y.offset + y.source.length - 1, "BAD_ALIAS", "Anchor ending in : is ambiguous", !0), m = y, _ ?? (_ = y.offset), c = !1, d = !1, g = !0;
|
|
2413
2413
|
break;
|
|
2414
2414
|
case "tag": {
|
|
2415
|
-
b && r(y, "MULTIPLE_TAGS", "A node can have at most one tag"), b = y,
|
|
2415
|
+
b && r(y, "MULTIPLE_TAGS", "A node can have at most one tag"), b = y, _ ?? (_ = y.offset), c = !1, d = !1, g = !0;
|
|
2416
2416
|
break;
|
|
2417
2417
|
}
|
|
2418
2418
|
case t:
|
|
2419
|
-
(m || b) && r(y, "BAD_PROP_ORDER", `Anchors and tags must be after the ${y.source} indicator`),
|
|
2419
|
+
(m || b) && r(y, "BAD_PROP_ORDER", `Anchors and tags must be after the ${y.source} indicator`), k && r(y, "UNEXPECTED_TOKEN", `Unexpected ${y.source} in ${e ?? "collection"}`), k = y, c = t === "seq-item-ind" || t === "explicit-key-ind", d = !1;
|
|
2420
2420
|
break;
|
|
2421
2421
|
case "comma":
|
|
2422
2422
|
if (e) {
|
|
2423
|
-
|
|
2423
|
+
S && r(y, "UNEXPECTED_TOKEN", `Unexpected , in ${e}`), S = y, c = !1, d = !1;
|
|
2424
2424
|
break;
|
|
2425
2425
|
}
|
|
2426
2426
|
// else fallthrough
|
|
2427
2427
|
default:
|
|
2428
2428
|
r(y, "UNEXPECTED_TOKEN", `Unexpected ${y.type} token`), c = !1, d = !1;
|
|
2429
2429
|
}
|
|
2430
|
-
const
|
|
2430
|
+
const O = s[s.length - 1], T = O ? O.offset + O.source.length : i;
|
|
2431
2431
|
return g && n && n.type !== "space" && n.type !== "newline" && n.type !== "comma" && (n.type !== "scalar" || n.source !== "") && r(n.offset, "MISSING_CHAR", "Tags and anchors must be separated from the next token by white space"), h && (c && h.indent <= o || n?.type === "block-map" || n?.type === "block-seq") && r(h, "TAB_AS_INDENT", "Tabs are not allowed as indentation"), {
|
|
2432
|
-
comma:
|
|
2433
|
-
found:
|
|
2434
|
-
spaceBefore:
|
|
2432
|
+
comma: S,
|
|
2433
|
+
found: k,
|
|
2434
|
+
spaceBefore: a,
|
|
2435
2435
|
comment: u,
|
|
2436
2436
|
hasNewline: p,
|
|
2437
2437
|
anchor: m,
|
|
2438
2438
|
tag: b,
|
|
2439
2439
|
newlineAfterProp: w,
|
|
2440
|
-
end:
|
|
2441
|
-
start:
|
|
2440
|
+
end: T,
|
|
2441
|
+
start: _ ?? T
|
|
2442
2442
|
};
|
|
2443
2443
|
}
|
|
2444
2444
|
function ye(s) {
|
|
@@ -2476,45 +2476,45 @@ function ye(s) {
|
|
|
2476
2476
|
return !0;
|
|
2477
2477
|
}
|
|
2478
2478
|
}
|
|
2479
|
-
function
|
|
2479
|
+
function tt(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 bs(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 || I(r) && I(o) && r.value === o.value;
|
|
2490
2490
|
return e.some((r) => i(r.key, t));
|
|
2491
2491
|
}
|
|
2492
|
-
const
|
|
2493
|
-
function
|
|
2494
|
-
const o = r?.nodeClass ??
|
|
2492
|
+
const vt = "All mapping items must start at the same column";
|
|
2493
|
+
function wn({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
2494
|
+
const o = r?.nodeClass ?? M, l = new o(t.schema);
|
|
2495
2495
|
t.atRoot && (t.atRoot = !1);
|
|
2496
|
-
let
|
|
2496
|
+
let a = n.offset, c = null;
|
|
2497
2497
|
for (const d of n.items) {
|
|
2498
2498
|
const { start: u, key: f, sep: p, value: g } = d, h = oe(u, {
|
|
2499
2499
|
indicator: "explicit-key-ind",
|
|
2500
2500
|
next: f ?? p?.[0],
|
|
2501
|
-
offset:
|
|
2501
|
+
offset: a,
|
|
2502
2502
|
onError: i,
|
|
2503
2503
|
parentIndent: n.indent,
|
|
2504
2504
|
startOnNewline: !0
|
|
2505
2505
|
}), m = !h.found;
|
|
2506
2506
|
if (m) {
|
|
2507
|
-
if (f && (f.type === "block-seq" ? i(
|
|
2508
|
-
c = h.end, h.comment && (
|
|
2509
|
-
` + h.comment :
|
|
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", vt)), !h.anchor && !h.tag && !p) {
|
|
2508
|
+
c = h.end, h.comment && (l.comment ? l.comment += `
|
|
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(
|
|
2513
|
+
} else h.found?.indent !== n.indent && i(a, "BAD_INDENT", vt);
|
|
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 &&
|
|
2517
|
-
const
|
|
2516
|
+
t.schema.compat && tt(n.indent, f, i), t.atKey = !1, bs(t, l.items, w) && i(b, "DUPLICATE_KEY", "Map keys must be unique");
|
|
2517
|
+
const S = oe(p ?? [], {
|
|
2518
2518
|
indicator: "map-value-ind",
|
|
2519
2519
|
next: g,
|
|
2520
2520
|
offset: w.range[2],
|
|
@@ -2522,168 +2522,168 @@ function un({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
2522
2522
|
parentIndent: n.indent,
|
|
2523
2523
|
startOnNewline: !f || f.type === "block-scalar"
|
|
2524
2524
|
});
|
|
2525
|
-
if (
|
|
2526
|
-
m && (g?.type === "block-map" && !
|
|
2527
|
-
const
|
|
2528
|
-
t.schema.compat &&
|
|
2529
|
-
const
|
|
2530
|
-
t.options.keepSourceTokens && (
|
|
2525
|
+
if (a = S.end, S.found) {
|
|
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
|
+
const k = g ? s(t, g, S, i) : e(t, a, p, null, S, i);
|
|
2528
|
+
t.schema.compat && tt(n.indent, g, i), a = k.range[2];
|
|
2529
|
+
const _ = new B(w, k);
|
|
2530
|
+
t.options.keepSourceTokens && (_.srcToken = d), l.items.push(_);
|
|
2531
2531
|
} else {
|
|
2532
|
-
m && i(w.range, "MISSING_CHAR", "Implicit map keys need to be followed by map values"),
|
|
2533
|
-
` +
|
|
2534
|
-
const
|
|
2535
|
-
t.options.keepSourceTokens && (
|
|
2532
|
+
m && i(w.range, "MISSING_CHAR", "Implicit map keys need to be followed by map values"), S.comment && (w.comment ? w.comment += `
|
|
2533
|
+
` + S.comment : w.comment = S.comment);
|
|
2534
|
+
const k = new B(w);
|
|
2535
|
+
t.options.keepSourceTokens && (k.srcToken = d), l.items.push(k);
|
|
2536
2536
|
}
|
|
2537
2537
|
}
|
|
2538
|
-
return c && c <
|
|
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
|
|
2541
|
-
const o = r?.nodeClass ??
|
|
2540
|
+
function Sn({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
2541
|
+
const o = r?.nodeClass ?? W, l = new o(t.schema);
|
|
2542
2542
|
t.atRoot && (t.atRoot = !1), t.atKey && (t.atKey = !1);
|
|
2543
|
-
let
|
|
2543
|
+
let a = n.offset, c = null;
|
|
2544
2544
|
for (const { start: d, value: u } of n.items) {
|
|
2545
2545
|
const f = oe(d, {
|
|
2546
2546
|
indicator: "seq-item-ind",
|
|
2547
2547
|
next: u,
|
|
2548
|
-
offset:
|
|
2548
|
+
offset: a,
|
|
2549
2549
|
onError: i,
|
|
2550
2550
|
parentIndent: n.indent,
|
|
2551
2551
|
startOnNewline: !0
|
|
2552
2552
|
});
|
|
2553
2553
|
if (!f.found)
|
|
2554
2554
|
if (f.anchor || f.tag || u)
|
|
2555
|
-
u?.type === "block-seq" ? i(f.end, "BAD_INDENT", "All sequence items must start at the same column") : i(
|
|
2555
|
+
u?.type === "block-seq" ? i(f.end, "BAD_INDENT", "All sequence items must start at the same column") : i(a, "MISSING_CHAR", "Sequence item without - indicator");
|
|
2556
2556
|
else {
|
|
2557
|
-
c = f.end, f.comment && (
|
|
2557
|
+
c = f.end, f.comment && (l.comment = f.comment);
|
|
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 && tt(n.indent, u, i), a = p.range[2], l.items.push(p);
|
|
2562
2562
|
}
|
|
2563
|
-
return
|
|
2563
|
+
return l.range = [n.offset, a, c ?? a], l;
|
|
2564
2564
|
}
|
|
2565
|
-
function
|
|
2565
|
+
function ke(s, e, t, n) {
|
|
2566
2566
|
let i = "";
|
|
2567
2567
|
if (s) {
|
|
2568
2568
|
let r = !1, o = "";
|
|
2569
|
-
for (const
|
|
2570
|
-
const { source:
|
|
2569
|
+
for (const l of s) {
|
|
2570
|
+
const { source: a, type: c } = l;
|
|
2571
2571
|
switch (c) {
|
|
2572
2572
|
case "space":
|
|
2573
2573
|
r = !0;
|
|
2574
2574
|
break;
|
|
2575
2575
|
case "comment": {
|
|
2576
|
-
t && !r && n(
|
|
2577
|
-
const d =
|
|
2576
|
+
t && !r && n(l, "MISSING_CHAR", "Comments must be separated from other tokens by white space characters");
|
|
2577
|
+
const d = a.substring(1) || " ";
|
|
2578
2578
|
i ? i += o + d : i = d, o = "";
|
|
2579
2579
|
break;
|
|
2580
2580
|
}
|
|
2581
2581
|
case "newline":
|
|
2582
|
-
i && (o +=
|
|
2582
|
+
i && (o += a), r = !0;
|
|
2583
2583
|
break;
|
|
2584
2584
|
default:
|
|
2585
|
-
n(
|
|
2585
|
+
n(l, "UNEXPECTED_TOKEN", `Unexpected ${c} at node end`);
|
|
2586
2586
|
}
|
|
2587
|
-
e +=
|
|
2587
|
+
e += a.length;
|
|
2588
2588
|
}
|
|
2589
2589
|
}
|
|
2590
2590
|
return { comment: i, offset: e };
|
|
2591
2591
|
}
|
|
2592
2592
|
const Ye = "Block collections are not allowed within flow collections", Ge = (s) => s && (s.type === "block-map" || s.type === "block-seq");
|
|
2593
|
-
function
|
|
2594
|
-
const o = n.start.source === "{",
|
|
2593
|
+
function kn({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
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;
|
|
2597
2597
|
d && (t.atRoot = !1), t.atKey && (t.atKey = !1);
|
|
2598
2598
|
let u = n.offset + n.start.source.length;
|
|
2599
2599
|
for (let m = 0; m < n.items.length; ++m) {
|
|
2600
|
-
const b = n.items[m], { start: w, key:
|
|
2601
|
-
flow:
|
|
2600
|
+
const b = n.items[m], { start: w, key: S, sep: k, value: _ } = b, O = oe(w, {
|
|
2601
|
+
flow: l,
|
|
2602
2602
|
indicator: "explicit-key-ind",
|
|
2603
|
-
next:
|
|
2603
|
+
next: S ?? k?.[0],
|
|
2604
2604
|
offset: u,
|
|
2605
2605
|
onError: i,
|
|
2606
2606
|
parentIndent: n.indent,
|
|
2607
2607
|
startOnNewline: !1
|
|
2608
2608
|
});
|
|
2609
|
-
if (!
|
|
2610
|
-
if (!
|
|
2611
|
-
m === 0 &&
|
|
2612
|
-
` +
|
|
2609
|
+
if (!O.found) {
|
|
2610
|
+
if (!O.anchor && !O.tag && !k && !_) {
|
|
2611
|
+
m === 0 && O.comma ? i(O.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${l}`) : m < n.items.length - 1 && i(O.start, "UNEXPECTED_TOKEN", `Unexpected empty item in ${l}`), O.comment && (c.comment ? c.comment += `
|
|
2612
|
+
` + O.comment : c.comment = O.comment), u = O.end;
|
|
2613
2613
|
continue;
|
|
2614
2614
|
}
|
|
2615
|
-
!o && t.options.strict && ye(
|
|
2616
|
-
|
|
2615
|
+
!o && t.options.strict && ye(S) && i(
|
|
2616
|
+
S,
|
|
2617
2617
|
// checked by containsNewline()
|
|
2618
2618
|
"MULTILINE_IMPLICIT_KEY",
|
|
2619
2619
|
"Implicit keys of flow sequence pairs need to be on a single line"
|
|
2620
2620
|
);
|
|
2621
2621
|
}
|
|
2622
2622
|
if (m === 0)
|
|
2623
|
-
|
|
2624
|
-
else if (
|
|
2625
|
-
let
|
|
2623
|
+
O.comma && i(O.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${l}`);
|
|
2624
|
+
else if (O.comma || i(O.start, "MISSING_CHAR", `Missing , between ${l} items`), O.comment) {
|
|
2625
|
+
let T = "";
|
|
2626
2626
|
e: for (const y of w)
|
|
2627
2627
|
switch (y.type) {
|
|
2628
2628
|
case "comma":
|
|
2629
2629
|
case "space":
|
|
2630
2630
|
break;
|
|
2631
2631
|
case "comment":
|
|
2632
|
-
|
|
2632
|
+
T = y.source.substring(1);
|
|
2633
2633
|
break e;
|
|
2634
2634
|
default:
|
|
2635
2635
|
break e;
|
|
2636
2636
|
}
|
|
2637
|
-
if (
|
|
2637
|
+
if (T) {
|
|
2638
2638
|
let y = c.items[c.items.length - 1];
|
|
2639
|
-
|
|
2640
|
-
` +
|
|
2639
|
+
$(y) && (y = y.value ?? y.key), y.comment ? y.comment += `
|
|
2640
|
+
` + T : y.comment = T, O.comment = O.comment.substring(T.length + 1);
|
|
2641
2641
|
}
|
|
2642
2642
|
}
|
|
2643
|
-
if (!o && !
|
|
2644
|
-
const
|
|
2645
|
-
c.items.push(
|
|
2643
|
+
if (!o && !k && !O.found) {
|
|
2644
|
+
const T = _ ? s(t, _, O, i) : e(t, O.end, k, null, O, i);
|
|
2645
|
+
c.items.push(T), u = T.range[2], Ge(_) && i(T.range, "BLOCK_IN_FLOW", Ye);
|
|
2646
2646
|
} else {
|
|
2647
2647
|
t.atKey = !0;
|
|
2648
|
-
const
|
|
2649
|
-
Ge(
|
|
2650
|
-
const
|
|
2651
|
-
flow:
|
|
2648
|
+
const T = O.end, y = S ? s(t, S, O, i) : e(t, T, w, null, O, i);
|
|
2649
|
+
Ge(S) && i(y.range, "BLOCK_IN_FLOW", Ye), t.atKey = !1;
|
|
2650
|
+
const L = oe(k ?? [], {
|
|
2651
|
+
flow: l,
|
|
2652
2652
|
indicator: "map-value-ind",
|
|
2653
|
-
next:
|
|
2653
|
+
next: _,
|
|
2654
2654
|
offset: y.range[2],
|
|
2655
2655
|
onError: i,
|
|
2656
2656
|
parentIndent: n.indent,
|
|
2657
2657
|
startOnNewline: !1
|
|
2658
2658
|
});
|
|
2659
|
-
if (
|
|
2660
|
-
if (!o && !
|
|
2661
|
-
if (
|
|
2662
|
-
for (const C of
|
|
2663
|
-
if (C ===
|
|
2659
|
+
if (L.found) {
|
|
2660
|
+
if (!o && !O.found && t.options.strict) {
|
|
2661
|
+
if (k)
|
|
2662
|
+
for (const C of k) {
|
|
2663
|
+
if (C === L.found)
|
|
2664
2664
|
break;
|
|
2665
2665
|
if (C.type === "newline") {
|
|
2666
2666
|
i(C, "MULTILINE_IMPLICIT_KEY", "Implicit keys of flow sequence pairs need to be on a single line");
|
|
2667
2667
|
break;
|
|
2668
2668
|
}
|
|
2669
2669
|
}
|
|
2670
|
-
|
|
2670
|
+
O.start < L.found.offset - 1024 && i(L.found, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit flow sequence key");
|
|
2671
2671
|
}
|
|
2672
|
-
} else
|
|
2673
|
-
const q =
|
|
2674
|
-
q ? Ge(
|
|
2675
|
-
` +
|
|
2676
|
-
const X = new
|
|
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
|
+
const q = _ ? s(t, _, L, i) : L.found ? e(t, L.end, k, null, L, i) : null;
|
|
2674
|
+
q ? Ge(_) && i(q.range, "BLOCK_IN_FLOW", Ye) : L.comment && (y.comment ? y.comment += `
|
|
2675
|
+
` + L.comment : y.comment = L.comment);
|
|
2676
|
+
const X = new B(y, q);
|
|
2677
2677
|
if (t.options.keepSourceTokens && (X.srcToken = b), o) {
|
|
2678
2678
|
const C = c;
|
|
2679
|
-
|
|
2679
|
+
bs(t, C.items, y) && i(T, "DUPLICATE_KEY", "Map keys must be unique"), C.items.push(X);
|
|
2680
2680
|
} else {
|
|
2681
|
-
const C = new
|
|
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 kt = (q ?? y).range;
|
|
2684
|
+
C.range = [y.range[0], kt[1], kt[2]], c.items.push(C);
|
|
2685
2685
|
}
|
|
2686
|
-
u = q ? q.range[2] :
|
|
2686
|
+
u = q ? q.range[2] : L.end;
|
|
2687
2687
|
}
|
|
2688
2688
|
}
|
|
2689
2689
|
const f = o ? "}" : "]", [p, ...g] = n.end;
|
|
@@ -2691,91 +2691,91 @@ function dn({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
2691
2691
|
if (p?.source === f)
|
|
2692
2692
|
h = p.offset + p.source.length;
|
|
2693
2693
|
else {
|
|
2694
|
-
const m =
|
|
2694
|
+
const m = l[0].toUpperCase() + l.substring(1), b = d ? `${m} must end with a ${f}` : `${m} in block collection must be sufficiently indented and end with a ${f}`;
|
|
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 = ke(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" ?
|
|
2707
|
-
return i === "!" || i ===
|
|
2705
|
+
function He(s, e, t, n, i, r) {
|
|
2706
|
+
const o = t.type === "block-map" ? wn(s, e, t, n, r) : t.type === "block-seq" ? Sn(s, e, t, n, r) : kn(s, e, t, n, r), l = o.constructor;
|
|
2707
|
+
return i === "!" || i === l.tagName ? (o.tag = l.tagName, o) : (i && (o.tag = i), o);
|
|
2708
2708
|
}
|
|
2709
|
-
function
|
|
2709
|
+
function _n(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;
|
|
2713
2713
|
g && (!p || p.offset < g.offset) && i(g, "MISSING_CHAR", "Missing newline after block sequence props");
|
|
2714
2714
|
}
|
|
2715
|
-
const
|
|
2716
|
-
if (!r || !o || o === "!" || o ===
|
|
2717
|
-
return
|
|
2718
|
-
let
|
|
2719
|
-
if (!
|
|
2715
|
+
const l = t.type === "block-map" ? "map" : t.type === "block-seq" ? "seq" : t.start.source === "{" ? "map" : "seq";
|
|
2716
|
+
if (!r || !o || o === "!" || o === M.tagName && l === "map" || o === W.tagName && l === "seq")
|
|
2717
|
+
return He(s, e, t, i, o);
|
|
2718
|
+
let a = e.schema.tags.find((f) => f.tag === o && f.collection === l);
|
|
2719
|
+
if (!a) {
|
|
2720
2720
|
const f = e.schema.knownTags[o];
|
|
2721
|
-
if (f?.collection ===
|
|
2722
|
-
e.schema.tags.push(Object.assign({}, f, { default: !1 })),
|
|
2721
|
+
if (f?.collection === l)
|
|
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 ${
|
|
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), He(s, e, t, i, o);
|
|
2725
2725
|
}
|
|
2726
|
-
const c =
|
|
2727
|
-
return u.range = c.range, u.tag = o,
|
|
2726
|
+
const c = He(s, e, t, i, o, a), d = a.resolve?.(c, (f) => i(r, "TAG_RESOLVE_FAILED", f), e.options) ?? c, u = v(d) ? d : new N(d);
|
|
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 Nn(s, e, t) {
|
|
2730
|
+
const n = e.offset, i = On(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 === ">" ?
|
|
2734
|
-
let
|
|
2733
|
+
const r = i.mode === ">" ? N.BLOCK_FOLDED : N.BLOCK_LITERAL, o = e.source ? En(e.source) : [];
|
|
2734
|
+
let l = o.length;
|
|
2735
2735
|
for (let h = o.length - 1; h >= 0; --h) {
|
|
2736
2736
|
const m = o[h][1];
|
|
2737
2737
|
if (m === "" || m === "\r")
|
|
2738
|
-
|
|
2738
|
+
l = h;
|
|
2739
2739
|
else
|
|
2740
2740
|
break;
|
|
2741
2741
|
}
|
|
2742
|
-
if (
|
|
2742
|
+
if (l === 0) {
|
|
2743
2743
|
const h = i.chomp === "+" && o.length > 0 ? `
|
|
2744
2744
|
`.repeat(Math.max(1, o.length - 1)) : "";
|
|
2745
2745
|
let m = n + i.length;
|
|
2746
2746
|
return e.source && (m += e.source.length), { value: h, type: r, comment: i.comment, range: [n, m, m] };
|
|
2747
2747
|
}
|
|
2748
|
-
let
|
|
2749
|
-
for (let h = 0; h <
|
|
2748
|
+
let a = e.indent + i.indent, c = e.offset + i.length, d = 0;
|
|
2749
|
+
for (let h = 0; h < l; ++h) {
|
|
2750
2750
|
const [m, b] = o[h];
|
|
2751
2751
|
if (b === "" || b === "\r")
|
|
2752
|
-
i.indent === 0 && m.length >
|
|
2752
|
+
i.indent === 0 && m.length > a && (a = m.length);
|
|
2753
2753
|
else {
|
|
2754
|
-
m.length <
|
|
2754
|
+
m.length < a && t(c + m.length, "MISSING_CHAR", "Block scalars with more-indented leading empty lines must use an explicit indentation indicator"), i.indent === 0 && (a = m.length), d = h, a === 0 && !s.atRoot && t(c, "BAD_INDENT", "Block scalar values in collections must be indented");
|
|
2755
2755
|
break;
|
|
2756
2756
|
}
|
|
2757
2757
|
c += m.length + b.length + 1;
|
|
2758
2758
|
}
|
|
2759
|
-
for (let h = o.length - 1; h >=
|
|
2760
|
-
o[h][0].length >
|
|
2759
|
+
for (let h = o.length - 1; h >= l; --h)
|
|
2760
|
+
o[h][0].length > a && (l = h + 1);
|
|
2761
2761
|
let u = "", f = "", p = !1;
|
|
2762
2762
|
for (let h = 0; h < d; ++h)
|
|
2763
|
-
u += o[h][0].slice(
|
|
2763
|
+
u += o[h][0].slice(a) + `
|
|
2764
2764
|
`;
|
|
2765
|
-
for (let h = d; h <
|
|
2765
|
+
for (let h = d; h < l; ++h) {
|
|
2766
2766
|
let [m, b] = o[h];
|
|
2767
2767
|
c += m.length + b.length + 1;
|
|
2768
2768
|
const w = b[b.length - 1] === "\r";
|
|
2769
|
-
if (w && (b = b.slice(0, -1)), b && m.length <
|
|
2770
|
-
const
|
|
2771
|
-
t(c - b.length - (w ? 2 : 1), "BAD_INDENT",
|
|
2769
|
+
if (w && (b = b.slice(0, -1)), b && m.length < a) {
|
|
2770
|
+
const k = `Block scalar lines must not be less indented than their ${i.indent ? "explicit indentation indicator" : "first line"}`;
|
|
2771
|
+
t(c - b.length - (w ? 2 : 1), "BAD_INDENT", k), m = "";
|
|
2772
2772
|
}
|
|
2773
|
-
r ===
|
|
2774
|
-
`) : m.length >
|
|
2773
|
+
r === N.BLOCK_LITERAL ? (u += f + m.slice(a) + b, f = `
|
|
2774
|
+
`) : m.length > a || b[0] === " " ? (f === " " ? f = `
|
|
2775
2775
|
` : !p && f === `
|
|
2776
2776
|
` && (f = `
|
|
2777
2777
|
|
|
2778
|
-
`), u += f + m.slice(
|
|
2778
|
+
`), u += f + m.slice(a) + b, f = `
|
|
2779
2779
|
`, p = !0) : b === "" ? f === `
|
|
2780
2780
|
` ? u += `
|
|
2781
2781
|
` : f = `
|
|
@@ -2785,9 +2785,9 @@ function mn(s, e, t) {
|
|
|
2785
2785
|
case "-":
|
|
2786
2786
|
break;
|
|
2787
2787
|
case "+":
|
|
2788
|
-
for (let h =
|
|
2788
|
+
for (let h = l; h < o.length; ++h)
|
|
2789
2789
|
u += `
|
|
2790
|
-
` + o[h][0].slice(
|
|
2790
|
+
` + o[h][0].slice(a);
|
|
2791
2791
|
u[u.length - 1] !== `
|
|
2792
2792
|
` && (u += `
|
|
2793
2793
|
`);
|
|
@@ -2799,21 +2799,21 @@ function mn(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 On({ 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];
|
|
2806
|
-
let o = 0,
|
|
2806
|
+
let o = 0, l = "", a = -1;
|
|
2807
2807
|
for (let f = 1; f < i.length; ++f) {
|
|
2808
2808
|
const p = i[f];
|
|
2809
|
-
if (!
|
|
2810
|
-
|
|
2809
|
+
if (!l && (p === "-" || p === "+"))
|
|
2810
|
+
l = p;
|
|
2811
2811
|
else {
|
|
2812
2812
|
const g = Number(p);
|
|
2813
|
-
!o && g ? o = g :
|
|
2813
|
+
!o && g ? o = g : a === -1 && (a = s + f);
|
|
2814
2814
|
}
|
|
2815
2815
|
}
|
|
2816
|
-
|
|
2816
|
+
a !== -1 && n(a, "UNEXPECTED_TOKEN", `Block scalar header includes extra characters: ${i}`);
|
|
2817
2817
|
let c = !1, d = "", u = i.length;
|
|
2818
2818
|
for (let f = 1; f < e.length; ++f) {
|
|
2819
2819
|
const p = e[f];
|
|
@@ -2839,27 +2839,27 @@ function gn({ offset: s, props: e }, t, n) {
|
|
|
2839
2839
|
}
|
|
2840
2840
|
}
|
|
2841
2841
|
}
|
|
2842
|
-
return { mode: r, indent: o, chomp:
|
|
2842
|
+
return { mode: r, indent: o, chomp: l, comment: d, length: u };
|
|
2843
2843
|
}
|
|
2844
|
-
function
|
|
2844
|
+
function En(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 Tn(s, e, t) {
|
|
2851
2851
|
const { offset: n, type: i, source: r, end: o } = s;
|
|
2852
|
-
let
|
|
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
|
-
|
|
2856
|
+
l = N.PLAIN, a = In(r, c);
|
|
2857
2857
|
break;
|
|
2858
2858
|
case "single-quoted-scalar":
|
|
2859
|
-
|
|
2859
|
+
l = N.QUOTE_SINGLE, a = An(r, c);
|
|
2860
2860
|
break;
|
|
2861
2861
|
case "double-quoted-scalar":
|
|
2862
|
-
|
|
2862
|
+
l = N.QUOTE_DOUBLE, a = vn(r, c);
|
|
2863
2863
|
break;
|
|
2864
2864
|
/* istanbul ignore next should not happen */
|
|
2865
2865
|
default:
|
|
@@ -2870,15 +2870,15 @@ function bn(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 = ke(o, d, e, t);
|
|
2874
2874
|
return {
|
|
2875
|
-
value:
|
|
2876
|
-
type:
|
|
2875
|
+
value: a,
|
|
2876
|
+
type: l,
|
|
2877
2877
|
comment: u.comment,
|
|
2878
2878
|
range: [n, d, u.offset]
|
|
2879
2879
|
};
|
|
2880
2880
|
}
|
|
2881
|
-
function
|
|
2881
|
+
function In(s, e) {
|
|
2882
2882
|
let t = "";
|
|
2883
2883
|
switch (s[0]) {
|
|
2884
2884
|
/* istanbul ignore next should not happen */
|
|
@@ -2902,12 +2902,12 @@ function wn(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}`), ws(s);
|
|
2906
2906
|
}
|
|
2907
|
-
function
|
|
2908
|
-
return (s[s.length - 1] !== "'" || s.length === 1) && e(s.length, "MISSING_CHAR", "Missing closing 'quote"),
|
|
2907
|
+
function An(s, e) {
|
|
2908
|
+
return (s[s.length - 1] !== "'" || s.length === 1) && e(s.length, "MISSING_CHAR", "Missing closing 'quote"), ws(s.slice(1, -1)).replace(/''/g, "'");
|
|
2909
2909
|
}
|
|
2910
|
-
function
|
|
2910
|
+
function ws(s) {
|
|
2911
2911
|
let e, t;
|
|
2912
2912
|
try {
|
|
2913
2913
|
e = new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
@@ -2924,10 +2924,10 @@ function hs(s) {
|
|
|
2924
2924
|
n[1] === "" ? r === `
|
|
2925
2925
|
` ? i += r : r = `
|
|
2926
2926
|
` : (i += r + n[1], r = " "), o = t.lastIndex;
|
|
2927
|
-
const
|
|
2928
|
-
return
|
|
2927
|
+
const l = /[ \t]*(.*)/sy;
|
|
2928
|
+
return l.lastIndex = o, n = l.exec(s), i + r + (n?.[1] ?? "");
|
|
2929
2929
|
}
|
|
2930
|
-
function
|
|
2930
|
+
function vn(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 Sn(s, e) {
|
|
|
2935
2935
|
`))
|
|
2936
2936
|
if (i === `
|
|
2937
2937
|
`) {
|
|
2938
|
-
const { fold: r, offset: o } =
|
|
2938
|
+
const { fold: r, offset: o } = $n(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 = Ln[r];
|
|
2943
2943
|
if (o)
|
|
2944
2944
|
t += o;
|
|
2945
2945
|
else if (r === `
|
|
@@ -2951,11 +2951,11 @@ function Sn(s, e) {
|
|
|
2951
2951
|
for (r = s[++n + 1]; r === " " || r === " "; )
|
|
2952
2952
|
r = s[++n + 1];
|
|
2953
2953
|
else if (r === "x" || r === "u" || r === "U") {
|
|
2954
|
-
const
|
|
2955
|
-
t +=
|
|
2954
|
+
const l = { x: 2, u: 4, U: 8 }[r];
|
|
2955
|
+
t += Cn(s, n + 1, l, e), n += l;
|
|
2956
2956
|
} else {
|
|
2957
|
-
const
|
|
2958
|
-
e(n - 1, "BAD_DQ_ESCAPE", `Invalid escape sequence ${
|
|
2957
|
+
const l = s.substr(n - 1, 2);
|
|
2958
|
+
e(n - 1, "BAD_DQ_ESCAPE", `Invalid escape sequence ${l}`), t += l;
|
|
2959
2959
|
}
|
|
2960
2960
|
} else if (i === " " || i === " ") {
|
|
2961
2961
|
const r = n;
|
|
@@ -2970,7 +2970,7 @@ function Sn(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 $n(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 Nn(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 Ln = {
|
|
2984
2984
|
0: "\0",
|
|
2985
2985
|
// null character
|
|
2986
2986
|
a: "\x07",
|
|
@@ -3014,56 +3014,56 @@ const On = {
|
|
|
3014
3014
|
"\\": "\\",
|
|
3015
3015
|
" ": " "
|
|
3016
3016
|
};
|
|
3017
|
-
function
|
|
3017
|
+
function Cn(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
|
-
const
|
|
3021
|
-
return n(e - 2, "BAD_DQ_ESCAPE", `Invalid escape sequence ${
|
|
3020
|
+
const l = s.substr(e - 2, t + 2);
|
|
3021
|
+
return n(e - 2, "BAD_DQ_ESCAPE", `Invalid escape sequence ${l}`), l;
|
|
3022
3022
|
}
|
|
3023
3023
|
return String.fromCodePoint(o);
|
|
3024
3024
|
}
|
|
3025
|
-
function
|
|
3026
|
-
const { value: i, type: r, comment: o, range:
|
|
3025
|
+
function Ss(s, e, t, n) {
|
|
3026
|
+
const { value: i, type: r, comment: o, range: l } = e.type === "block-scalar" ? Nn(s, e, n) : Tn(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[
|
|
3028
|
+
s.options.stringKeys && s.atKey ? c = s.schema[R] : a ? c = jn(s.schema, i, a, t, n) : e.type === "scalar" ? c = Bn(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 = I(u) ? u : new N(u);
|
|
3033
3033
|
} catch (u) {
|
|
3034
3034
|
const f = u instanceof Error ? u.message : String(u);
|
|
3035
|
-
n(t ?? e, "TAG_RESOLVE_FAILED", f), d = new
|
|
3035
|
+
n(t ?? e, "TAG_RESOLVE_FAILED", f), d = new N(i);
|
|
3036
3036
|
}
|
|
3037
|
-
return d.range =
|
|
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 jn(s, e, t, n, i) {
|
|
3040
3040
|
if (t === "!")
|
|
3041
|
-
return s[
|
|
3041
|
+
return s[R];
|
|
3042
3042
|
const r = [];
|
|
3043
|
-
for (const
|
|
3044
|
-
if (!
|
|
3045
|
-
if (
|
|
3046
|
-
r.push(
|
|
3043
|
+
for (const l of s.tags)
|
|
3044
|
+
if (!l.collection && l.tag === t)
|
|
3045
|
+
if (l.default && l.test)
|
|
3046
|
+
r.push(l);
|
|
3047
3047
|
else
|
|
3048
|
-
return
|
|
3049
|
-
for (const
|
|
3050
|
-
if (
|
|
3051
|
-
return
|
|
3048
|
+
return l;
|
|
3049
|
+
for (const l of r)
|
|
3050
|
+
if (l.test?.test(e))
|
|
3051
|
+
return l;
|
|
3052
3052
|
const o = s.knownTags[t];
|
|
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[
|
|
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
|
|
3056
|
-
const o = t.tags.find((
|
|
3055
|
+
function Bn({ atKey: s, directives: e, schema: t }, n, i, r) {
|
|
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
|
-
const
|
|
3059
|
-
if (o.tag !==
|
|
3060
|
-
const
|
|
3058
|
+
const l = t.compat.find((a) => a.default && a.test?.test(n)) ?? t[R];
|
|
3059
|
+
if (o.tag !== l.tag) {
|
|
3060
|
+
const a = e.tagString(o.tag), c = e.tagString(l.tag), d = `Value may be parsed as either ${a} or ${c}`;
|
|
3061
3061
|
r(i, "TAG_RESOLVE_FAILED", d, !0);
|
|
3062
3062
|
}
|
|
3063
3063
|
}
|
|
3064
3064
|
return o;
|
|
3065
3065
|
}
|
|
3066
|
-
function
|
|
3066
|
+
function Mn(s, e, t) {
|
|
3067
3067
|
if (e) {
|
|
3068
3068
|
t ?? (t = e.length);
|
|
3069
3069
|
for (let n = t - 1; n >= 0; --n) {
|
|
@@ -3082,54 +3082,54 @@ function In(s, e, t) {
|
|
|
3082
3082
|
}
|
|
3083
3083
|
return s;
|
|
3084
3084
|
}
|
|
3085
|
-
const
|
|
3086
|
-
function
|
|
3087
|
-
const i = s.atKey, { spaceBefore: r, comment: o, anchor:
|
|
3085
|
+
const Pn = { composeNode: ks, composeEmptyNode: St };
|
|
3086
|
+
function ks(s, e, t, n) {
|
|
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 = Dn(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 = Ss(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 = _n(Pn, 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 = St(s, e.offset, void 0, null, t, n), d = !1;
|
|
3107
3107
|
}
|
|
3108
3108
|
}
|
|
3109
|
-
return
|
|
3109
|
+
return l && c.anchor === "" && n(l, "BAD_ALIAS", "Anchor cannot be an empty string"), i && s.options.stringKeys && (!I(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 St(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: Mn(e, t, n),
|
|
3115
3115
|
indent: -1,
|
|
3116
3116
|
source: ""
|
|
3117
|
-
}, u =
|
|
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] =
|
|
3117
|
+
}, u = Ss(s, d, l, c);
|
|
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 Dn({ options: s }, { offset: e, source: t, end: n }, i) {
|
|
3121
|
+
const r = new at(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,
|
|
3124
|
-
return r.range = [e, o,
|
|
3123
|
+
const o = e + t.length, l = ke(n, o, s.strict, i);
|
|
3124
|
+
return r.range = [e, o, l.offset], l.comment && (r.comment = l.comment), r;
|
|
3125
3125
|
}
|
|
3126
|
-
function
|
|
3127
|
-
const
|
|
3126
|
+
function xn(s, e, { offset: t, start: n, value: i, end: r }, o) {
|
|
3127
|
+
const l = Object.assign({ _directives: e }, s), a = new qe(void 0, l), c = {
|
|
3128
3128
|
atKey: !1,
|
|
3129
3129
|
atRoot: !0,
|
|
3130
|
-
directives:
|
|
3131
|
-
options:
|
|
3132
|
-
schema:
|
|
3130
|
+
directives: a.directives,
|
|
3131
|
+
options: a.options,
|
|
3132
|
+
schema: a.schema
|
|
3133
3133
|
}, d = oe(n, {
|
|
3134
3134
|
indicator: "doc-start",
|
|
3135
3135
|
next: i ?? r?.[0],
|
|
@@ -3138,9 +3138,9 @@ function vn(s, e, { offset: t, start: n, value: i, end: r }, o) {
|
|
|
3138
3138
|
parentIndent: 0,
|
|
3139
3139
|
startOnNewline: !0
|
|
3140
3140
|
});
|
|
3141
|
-
d.found && (
|
|
3142
|
-
const u =
|
|
3143
|
-
return f.comment && (
|
|
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 ? ks(c, i, d, o) : St(c, d.end, n, null, d, o);
|
|
3142
|
+
const u = a.contents.range[2], f = ke(r, u, !1, o);
|
|
3143
|
+
return f.comment && (a.comment = f.comment), a.range = [t, u, f.offset], a;
|
|
3144
3144
|
}
|
|
3145
3145
|
function ue(s) {
|
|
3146
3146
|
if (typeof s == "number")
|
|
@@ -3170,12 +3170,12 @@ function $t(s) {
|
|
|
3170
3170
|
}
|
|
3171
3171
|
return { comment: e, afterEmptyLine: n };
|
|
3172
3172
|
}
|
|
3173
|
-
class
|
|
3173
|
+
class Kn {
|
|
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
|
|
3178
|
-
}, this.directives = new
|
|
3177
|
+
r ? this.warnings.push(new bn(o, n, i)) : this.errors.push(new de(o, n, i));
|
|
3178
|
+
}, this.directives = new j({ version: e.version || "1.2" }), this.options = e;
|
|
3179
3179
|
}
|
|
3180
3180
|
decorate(e, t) {
|
|
3181
3181
|
const { comment: n, afterEmptyLine: i } = $t(this.prelude);
|
|
@@ -3186,12 +3186,12 @@ class Cn {
|
|
|
3186
3186
|
${n}` : n;
|
|
3187
3187
|
else if (i || e.directives.docStart || !r)
|
|
3188
3188
|
e.commentBefore = n;
|
|
3189
|
-
else if (
|
|
3189
|
+
else if (A(r) && !r.flow && r.items.length > 0) {
|
|
3190
3190
|
let o = r.items[0];
|
|
3191
|
-
|
|
3192
|
-
const
|
|
3193
|
-
o.commentBefore =
|
|
3194
|
-
${
|
|
3191
|
+
$(o) && (o = o.key);
|
|
3192
|
+
const l = o.commentBefore;
|
|
3193
|
+
o.commentBefore = l ? `${n}
|
|
3194
|
+
${l}` : n;
|
|
3195
3195
|
} else {
|
|
3196
3196
|
const o = r.commentBefore;
|
|
3197
3197
|
r.commentBefore = o ? `${n}
|
|
@@ -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 = xn(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 = ke(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}
|
|
@@ -3285,16 +3285,16 @@ ${t.comment}` : t.comment;
|
|
|
3285
3285
|
}
|
|
3286
3286
|
}
|
|
3287
3287
|
}
|
|
3288
|
-
const
|
|
3289
|
-
function
|
|
3288
|
+
const _s = "\uFEFF", Ns = "", Os = "", st = "";
|
|
3289
|
+
function Rn(s) {
|
|
3290
3290
|
switch (s) {
|
|
3291
|
-
case
|
|
3291
|
+
case _s:
|
|
3292
3292
|
return "byte-order-mark";
|
|
3293
|
-
case
|
|
3293
|
+
case Ns:
|
|
3294
3294
|
return "doc-mode";
|
|
3295
|
-
case
|
|
3295
|
+
case Os:
|
|
3296
3296
|
return "flow-error-end";
|
|
3297
|
-
case
|
|
3297
|
+
case st:
|
|
3298
3298
|
return "scalar";
|
|
3299
3299
|
case "---":
|
|
3300
3300
|
return "doc-start";
|
|
@@ -3347,7 +3347,7 @@ function _n(s) {
|
|
|
3347
3347
|
}
|
|
3348
3348
|
return null;
|
|
3349
3349
|
}
|
|
3350
|
-
function
|
|
3350
|
+
function x(s) {
|
|
3351
3351
|
switch (s) {
|
|
3352
3352
|
case void 0:
|
|
3353
3353
|
case " ":
|
|
@@ -3360,9 +3360,9 @@ function K(s) {
|
|
|
3360
3360
|
return !1;
|
|
3361
3361
|
}
|
|
3362
3362
|
}
|
|
3363
|
-
const Lt = new Set("0123456789ABCDEFabcdef"),
|
|
3364
|
-
\r `),
|
|
3365
|
-
class
|
|
3363
|
+
const Lt = new Set("0123456789ABCDEFabcdef"), Un = new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"), Te = new Set(",[]{}"), Fn = new Set(` ,[]{}
|
|
3364
|
+
\r `), We = (s) => !s || Fn.has(s);
|
|
3365
|
+
class qn {
|
|
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
|
}
|
|
@@ -3411,7 +3411,7 @@ class Mn {
|
|
|
3411
3411
|
}
|
|
3412
3412
|
if (t === "-" || t === ".") {
|
|
3413
3413
|
const n = this.buffer.substr(e, 3);
|
|
3414
|
-
if ((n === "---" || n === "...") &&
|
|
3414
|
+
if ((n === "---" || n === "...") && x(this.buffer[e + 3]))
|
|
3415
3415
|
return -1;
|
|
3416
3416
|
}
|
|
3417
3417
|
return e;
|
|
@@ -3454,7 +3454,7 @@ class Mn {
|
|
|
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] === _s && (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 Mn {
|
|
|
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 Ns, yield* this.parseLineStart();
|
|
3482
3482
|
}
|
|
3483
3483
|
*parseLineStart() {
|
|
3484
3484
|
const e = this.charAt(0);
|
|
@@ -3488,16 +3488,16 @@ class Mn {
|
|
|
3488
3488
|
if (!this.atEnd && !this.hasChars(4))
|
|
3489
3489
|
return this.setNext("line-start");
|
|
3490
3490
|
const t = this.peek(3);
|
|
3491
|
-
if ((t === "---" || t === "...") &&
|
|
3491
|
+
if ((t === "---" || t === "...") && x(this.charAt(3)))
|
|
3492
3492
|
return yield* this.pushCount(3), this.indentValue = 0, this.indentNext = 0, t === "---" ? "doc" : "stream";
|
|
3493
3493
|
}
|
|
3494
|
-
return this.indentValue = yield* this.pushSpaces(!1), this.indentNext > this.indentValue && !
|
|
3494
|
+
return this.indentValue = yield* this.pushSpaces(!1), this.indentNext > this.indentValue && !x(this.charAt(1)) && (this.indentNext = this.indentValue), yield* this.parseBlockStart();
|
|
3495
3495
|
}
|
|
3496
3496
|
*parseBlockStart() {
|
|
3497
3497
|
const [e, t] = this.peek(2);
|
|
3498
3498
|
if (!t && !this.atEnd)
|
|
3499
3499
|
return this.setNext("block-start");
|
|
3500
|
-
if ((e === "-" || e === "?" || e === ":") &&
|
|
3500
|
+
if ((e === "-" || e === "?" || e === ":") && x(t)) {
|
|
3501
3501
|
const n = (yield* this.pushCount(1)) + (yield* this.pushSpaces(!0));
|
|
3502
3502
|
return this.indentNext = this.indentValue + 1, this.indentValue += n, yield* this.parseBlockStart();
|
|
3503
3503
|
}
|
|
@@ -3522,7 +3522,7 @@ class Mn {
|
|
|
3522
3522
|
case "]":
|
|
3523
3523
|
return yield* this.pushCount(1), "doc";
|
|
3524
3524
|
case "*":
|
|
3525
|
-
return yield* this.pushUntil(
|
|
3525
|
+
return yield* this.pushUntil(We), "doc";
|
|
3526
3526
|
case '"':
|
|
3527
3527
|
case "'":
|
|
3528
3528
|
return yield* this.parseQuotedScalar();
|
|
@@ -3541,8 +3541,8 @@ class Mn {
|
|
|
3541
3541
|
const i = this.getLine();
|
|
3542
3542
|
if (i === null)
|
|
3543
3543
|
return this.setNext("flow");
|
|
3544
|
-
if ((n !== -1 && n < this.indentNext && i[0] !== "#" || n === 0 && (i.startsWith("---") || i.startsWith("...")) &&
|
|
3545
|
-
return this.flowLevel = 0, yield
|
|
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 Os, 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,13 +3558,13 @@ class Mn {
|
|
|
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(We), "flow";
|
|
3562
3562
|
case '"':
|
|
3563
3563
|
case "'":
|
|
3564
3564
|
return this.flowKey = !0, yield* this.parseQuotedScalar();
|
|
3565
3565
|
case ":": {
|
|
3566
3566
|
const o = this.charAt(1);
|
|
3567
|
-
if (this.flowKey ||
|
|
3567
|
+
if (this.flowKey || x(o) || o === ",")
|
|
3568
3568
|
return this.flowKey = !1, yield* this.pushCount(1), yield* this.pushSpaces(!0), "flow";
|
|
3569
3569
|
}
|
|
3570
3570
|
// fallthrough
|
|
@@ -3619,7 +3619,7 @@ class Mn {
|
|
|
3619
3619
|
else if (t !== "-")
|
|
3620
3620
|
break;
|
|
3621
3621
|
}
|
|
3622
|
-
return yield* this.pushUntil((t) =>
|
|
3622
|
+
return yield* this.pushUntil((t) => x(t) || t === "#");
|
|
3623
3623
|
}
|
|
3624
3624
|
*parseBlockScalar() {
|
|
3625
3625
|
let e = this.pos - 1, t = 0, n;
|
|
@@ -3673,16 +3673,16 @@ class Mn {
|
|
|
3673
3673
|
do {
|
|
3674
3674
|
let r = e - 1, o = this.buffer[r];
|
|
3675
3675
|
o === "\r" && (o = this.buffer[--r]);
|
|
3676
|
-
const
|
|
3676
|
+
const l = r;
|
|
3677
3677
|
for (; o === " "; )
|
|
3678
3678
|
o = this.buffer[--r];
|
|
3679
3679
|
if (o === `
|
|
3680
|
-
` && r >= this.pos && r + 1 + t >
|
|
3680
|
+
` && r >= this.pos && r + 1 + t > l)
|
|
3681
3681
|
e = r;
|
|
3682
3682
|
else
|
|
3683
3683
|
break;
|
|
3684
3684
|
} while (!0);
|
|
3685
|
-
return yield
|
|
3685
|
+
return yield st, 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 Mn {
|
|
|
3690
3690
|
for (; i = this.buffer[++n]; )
|
|
3691
3691
|
if (i === ":") {
|
|
3692
3692
|
const r = this.buffer[n + 1];
|
|
3693
|
-
if (
|
|
3693
|
+
if (x(r) || e && Te.has(r))
|
|
3694
3694
|
break;
|
|
3695
3695
|
t = n;
|
|
3696
|
-
} else if (
|
|
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 && Te.has(r))
|
|
3701
3701
|
break;
|
|
3702
3702
|
if (i === `
|
|
3703
3703
|
`) {
|
|
@@ -3707,11 +3707,11 @@ class Mn {
|
|
|
3707
3707
|
n = Math.max(n, o - 2);
|
|
3708
3708
|
}
|
|
3709
3709
|
} else {
|
|
3710
|
-
if (e &&
|
|
3710
|
+
if (e && Te.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 st, 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 Mn {
|
|
|
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(We)) + (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 (
|
|
3735
|
+
if (x(t) || e && Te.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
|
}
|
|
@@ -3741,13 +3741,13 @@ class Mn {
|
|
|
3741
3741
|
*pushTag() {
|
|
3742
3742
|
if (this.charAt(1) === "<") {
|
|
3743
3743
|
let e = this.pos + 2, t = this.buffer[e];
|
|
3744
|
-
for (; !
|
|
3744
|
+
for (; !x(t) && t !== ">"; )
|
|
3745
3745
|
t = this.buffer[++e];
|
|
3746
3746
|
return yield* this.pushToIndex(t === ">" ? e + 1 : e, !1);
|
|
3747
3747
|
} else {
|
|
3748
3748
|
let e = this.pos + 1, t = this.buffer[e];
|
|
3749
3749
|
for (; t; )
|
|
3750
|
-
if (
|
|
3750
|
+
if (Un.has(t))
|
|
3751
3751
|
t = this.buffer[++e];
|
|
3752
3752
|
else if (t === "%" && Lt.has(this.buffer[e + 1]) && Lt.has(this.buffer[e + 2]))
|
|
3753
3753
|
t = this.buffer[e += 3];
|
|
@@ -3777,7 +3777,7 @@ class Mn {
|
|
|
3777
3777
|
return yield* this.pushToIndex(t, !1);
|
|
3778
3778
|
}
|
|
3779
3779
|
}
|
|
3780
|
-
class
|
|
3780
|
+
class Vn {
|
|
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 Ct(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 vt(s) {
|
|
|
3812
3812
|
}
|
|
3813
3813
|
return -1;
|
|
3814
3814
|
}
|
|
3815
|
-
function
|
|
3815
|
+
function Es(s) {
|
|
3816
3816
|
switch (s?.type) {
|
|
3817
3817
|
case "alias":
|
|
3818
3818
|
case "scalar":
|
|
@@ -3824,7 +3824,7 @@ function bs(s) {
|
|
|
3824
3824
|
return !1;
|
|
3825
3825
|
}
|
|
3826
3826
|
}
|
|
3827
|
-
function
|
|
3827
|
+
function Ie(s) {
|
|
3828
3828
|
switch (s.type) {
|
|
3829
3829
|
case "document":
|
|
3830
3830
|
return s.start;
|
|
@@ -3856,18 +3856,18 @@ function Z(s) {
|
|
|
3856
3856
|
;
|
|
3857
3857
|
return s.splice(e, s.length);
|
|
3858
3858
|
}
|
|
3859
|
-
function
|
|
3859
|
+
function jt(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, Es(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 Jn {
|
|
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 qn(), this.onNewLine = e;
|
|
3871
3871
|
}
|
|
3872
3872
|
/**
|
|
3873
3873
|
* Parse `source` as a YAML stream.
|
|
@@ -3891,7 +3891,7 @@ class Kn {
|
|
|
3891
3891
|
this.atScalar = !1, yield* this.step(), this.offset += e.length;
|
|
3892
3892
|
return;
|
|
3893
3893
|
}
|
|
3894
|
-
const t =
|
|
3894
|
+
const t = Rn(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 Kn {
|
|
|
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" && jt(t), n.type) {
|
|
3984
3984
|
case "document":
|
|
3985
3985
|
n.value = t;
|
|
3986
3986
|
break;
|
|
@@ -4016,7 +4016,7 @@ class Kn {
|
|
|
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 && Ct(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 Kn {
|
|
|
4054
4054
|
return yield* this.lineEnd(e);
|
|
4055
4055
|
switch (this.type) {
|
|
4056
4056
|
case "doc-start": {
|
|
4057
|
-
|
|
4057
|
+
Ct(e.start) !== -1 ? (yield* this.pop(), yield* this.step()) : e.start.push(this.sourceToken);
|
|
4058
4058
|
return;
|
|
4059
4059
|
}
|
|
4060
4060
|
case "anchor":
|
|
@@ -4075,7 +4075,7 @@ class Kn {
|
|
|
4075
4075
|
}
|
|
4076
4076
|
*scalar(e) {
|
|
4077
4077
|
if (this.type === "map-value-ind") {
|
|
4078
|
-
const t =
|
|
4078
|
+
const t = Ie(this.peek(2)), n = Z(t);
|
|
4079
4079
|
let i;
|
|
4080
4080
|
e.end ? (i = e.end, i.push(this.sourceToken), delete e.end) : i = [this.sourceToken];
|
|
4081
4081
|
const r = {
|
|
@@ -4142,16 +4142,16 @@ class Kn {
|
|
|
4142
4142
|
let r = [];
|
|
4143
4143
|
if (i && t.sep && !t.value) {
|
|
4144
4144
|
const o = [];
|
|
4145
|
-
for (let
|
|
4146
|
-
const
|
|
4147
|
-
switch (
|
|
4145
|
+
for (let l = 0; l < t.sep.length; ++l) {
|
|
4146
|
+
const a = t.sep[l];
|
|
4147
|
+
switch (a.type) {
|
|
4148
4148
|
case "newline":
|
|
4149
|
-
o.push(
|
|
4149
|
+
o.push(l);
|
|
4150
4150
|
break;
|
|
4151
4151
|
case "space":
|
|
4152
4152
|
break;
|
|
4153
4153
|
case "comment":
|
|
4154
|
-
|
|
4154
|
+
a.indent > e.indent && (o.length = 0);
|
|
4155
4155
|
break;
|
|
4156
4156
|
default:
|
|
4157
4157
|
o.length = 0;
|
|
@@ -4184,13 +4184,13 @@ class Kn {
|
|
|
4184
4184
|
indent: this.indent,
|
|
4185
4185
|
items: [{ start: r, key: null, sep: [this.sourceToken] }]
|
|
4186
4186
|
});
|
|
4187
|
-
else if (
|
|
4188
|
-
const o = Z(t.start),
|
|
4189
|
-
|
|
4187
|
+
else if (Es(t.key) && !V(t.sep, "newline")) {
|
|
4188
|
+
const o = Z(t.start), l = t.key, a = t.sep;
|
|
4189
|
+
a.push(this.sourceToken), delete t.key, delete t.sep, this.stack.push({
|
|
4190
4190
|
type: "block-map",
|
|
4191
4191
|
offset: this.offset,
|
|
4192
4192
|
indent: this.indent,
|
|
4193
|
-
items: [{ start: o, key:
|
|
4193
|
+
items: [{ start: o, key: l, sep: a }]
|
|
4194
4194
|
});
|
|
4195
4195
|
} else r.length > 0 ? t.sep = t.sep.concat(r, this.sourceToken) : t.sep.push(this.sourceToken);
|
|
4196
4196
|
else if (V(t.start, "newline"))
|
|
@@ -4332,17 +4332,17 @@ class Kn {
|
|
|
4332
4332
|
if (n.type === "block-map" && (this.type === "map-value-ind" && n.indent === e.indent || this.type === "newline" && !n.items[n.items.length - 1].sep))
|
|
4333
4333
|
yield* this.pop(), yield* this.step();
|
|
4334
4334
|
else if (this.type === "map-value-ind" && n.type !== "flow-collection") {
|
|
4335
|
-
const i =
|
|
4336
|
-
|
|
4335
|
+
const i = Ie(n), r = Z(i);
|
|
4336
|
+
jt(e);
|
|
4337
4337
|
const o = e.end.splice(1, e.end.length);
|
|
4338
4338
|
o.push(this.sourceToken);
|
|
4339
|
-
const
|
|
4339
|
+
const l = {
|
|
4340
4340
|
type: "block-map",
|
|
4341
4341
|
offset: e.offset,
|
|
4342
4342
|
indent: e.indent,
|
|
4343
4343
|
items: [{ start: r, key: e, sep: o }]
|
|
4344
4344
|
};
|
|
4345
|
-
this.onKeyLine = !0, this.stack[this.stack.length - 1] =
|
|
4345
|
+
this.onKeyLine = !0, this.stack[this.stack.length - 1] = l;
|
|
4346
4346
|
} else
|
|
4347
4347
|
yield* this.lineEnd(e);
|
|
4348
4348
|
}
|
|
@@ -4396,7 +4396,7 @@ class Kn {
|
|
|
4396
4396
|
};
|
|
4397
4397
|
case "explicit-key-ind": {
|
|
4398
4398
|
this.onKeyLine = !0;
|
|
4399
|
-
const t =
|
|
4399
|
+
const t = Ie(e), n = Z(t);
|
|
4400
4400
|
return n.push(this.sourceToken), {
|
|
4401
4401
|
type: "block-map",
|
|
4402
4402
|
offset: this.offset,
|
|
@@ -4406,7 +4406,7 @@ class Kn {
|
|
|
4406
4406
|
}
|
|
4407
4407
|
case "map-value-ind": {
|
|
4408
4408
|
this.onKeyLine = !0;
|
|
4409
|
-
const t =
|
|
4409
|
+
const t = Ie(e), n = Z(t);
|
|
4410
4410
|
return {
|
|
4411
4411
|
type: "block-map",
|
|
4412
4412
|
offset: this.offset,
|
|
@@ -4440,44 +4440,44 @@ class Kn {
|
|
|
4440
4440
|
}
|
|
4441
4441
|
}
|
|
4442
4442
|
}
|
|
4443
|
-
function
|
|
4443
|
+
function Yn(s) {
|
|
4444
4444
|
const e = s.prettyErrors !== !1;
|
|
4445
|
-
return { lineCounter: s.lineCounter || e && new
|
|
4445
|
+
return { lineCounter: s.lineCounter || e && new Vn() || null, prettyErrors: e };
|
|
4446
4446
|
}
|
|
4447
|
-
function
|
|
4448
|
-
const { lineCounter: t, prettyErrors: n } =
|
|
4447
|
+
function Gn(s, e = {}) {
|
|
4448
|
+
const { lineCounter: t, prettyErrors: n } = Yn(e), i = new Jn(t?.addNewLine), r = new Kn(e);
|
|
4449
4449
|
let o = null;
|
|
4450
|
-
for (const
|
|
4450
|
+
for (const l of r.compose(i.parse(s), !0, s.length))
|
|
4451
4451
|
if (!o)
|
|
4452
|
-
o =
|
|
4452
|
+
o = l;
|
|
4453
4453
|
else if (o.options.logLevel !== "silent") {
|
|
4454
|
-
o.errors.push(new de(
|
|
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(At(s, t)), o.warnings.forEach(At(s, t))), o;
|
|
4458
4458
|
}
|
|
4459
|
-
function
|
|
4459
|
+
function Hn(s, e, t) {
|
|
4460
4460
|
let n;
|
|
4461
|
-
const i =
|
|
4461
|
+
const i = Gn(s, t);
|
|
4462
4462
|
if (!i)
|
|
4463
4463
|
return null;
|
|
4464
|
-
if (i.warnings.forEach((r) =>
|
|
4464
|
+
if (i.warnings.forEach((r) => zt(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 Wn(s) {
|
|
4472
|
+
return _t.isAbsolute(s) ? s : _t.resolve(process.cwd(), s);
|
|
4473
4473
|
}
|
|
4474
|
-
async function
|
|
4474
|
+
async function Qn(s) {
|
|
4475
4475
|
if (!s)
|
|
4476
4476
|
return { on: {} };
|
|
4477
|
-
const e =
|
|
4478
|
-
return e.endsWith(".yaml") || e.endsWith(".yml") ?
|
|
4477
|
+
const e = Wn(s), t = await nt(e, "utf8");
|
|
4478
|
+
return e.endsWith(".yaml") || e.endsWith(".yml") ? Hn(t) ?? { on: {} } : JSON.parse(t);
|
|
4479
4479
|
}
|
|
4480
|
-
function
|
|
4480
|
+
function Xn(s) {
|
|
4481
4481
|
return s.split(/\r?\n/u).map((e) => e.trim()).filter((e) => e.length > 0 && !e.startsWith("#")).reduce((e, t) => {
|
|
4482
4482
|
const n = t.indexOf("=");
|
|
4483
4483
|
if (n <= 0)
|
|
@@ -4486,27 +4486,380 @@ function Vn(s) {
|
|
|
4486
4486
|
return e[i] = r, e;
|
|
4487
4487
|
}, {});
|
|
4488
4488
|
}
|
|
4489
|
-
async function
|
|
4489
|
+
async function zn(s) {
|
|
4490
4490
|
const e = {};
|
|
4491
4491
|
for (const [t, n] of Object.entries(process.env))
|
|
4492
4492
|
typeof n == "string" && (e[t] = n);
|
|
4493
4493
|
for (const t of s ?? []) {
|
|
4494
|
-
const n = await
|
|
4494
|
+
const n = await nt(t, "utf8");
|
|
4495
4495
|
if (t.endsWith(".json")) {
|
|
4496
|
-
const i =
|
|
4496
|
+
const i = rt(JSON.parse(n));
|
|
4497
4497
|
for (const [r, o] of Object.entries(i))
|
|
4498
4498
|
o != null && (e[r] = String(o));
|
|
4499
4499
|
continue;
|
|
4500
4500
|
}
|
|
4501
|
-
Object.assign(e,
|
|
4501
|
+
Object.assign(e, Xn(n));
|
|
4502
4502
|
}
|
|
4503
4503
|
return e;
|
|
4504
4504
|
}
|
|
4505
|
-
|
|
4506
|
-
|
|
4505
|
+
var Qe = function(s, e) {
|
|
4506
|
+
return Object.defineProperty ? Object.defineProperty(s, "raw", { value: e }) : s.raw = e, s;
|
|
4507
|
+
}, E;
|
|
4508
|
+
(function(s) {
|
|
4509
|
+
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
|
+
})(E || (E = {}));
|
|
4511
|
+
class Zn {
|
|
4512
|
+
constructor() {
|
|
4513
|
+
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
|
+
}
|
|
4515
|
+
set use_classes(e) {
|
|
4516
|
+
this._use_classes = e;
|
|
4517
|
+
}
|
|
4518
|
+
get use_classes() {
|
|
4519
|
+
return this._use_classes;
|
|
4520
|
+
}
|
|
4521
|
+
set url_allowlist(e) {
|
|
4522
|
+
this._url_allowlist = e;
|
|
4523
|
+
}
|
|
4524
|
+
get url_allowlist() {
|
|
4525
|
+
return this._url_allowlist;
|
|
4526
|
+
}
|
|
4527
|
+
set escape_html(e) {
|
|
4528
|
+
this._escape_html = e;
|
|
4529
|
+
}
|
|
4530
|
+
get escape_html() {
|
|
4531
|
+
return this._escape_html;
|
|
4532
|
+
}
|
|
4533
|
+
set boldStyle(e) {
|
|
4534
|
+
this._boldStyle = e;
|
|
4535
|
+
}
|
|
4536
|
+
get boldStyle() {
|
|
4537
|
+
return this._boldStyle;
|
|
4538
|
+
}
|
|
4539
|
+
set faintStyle(e) {
|
|
4540
|
+
this._faintStyle = e;
|
|
4541
|
+
}
|
|
4542
|
+
get faintStyle() {
|
|
4543
|
+
return this._faintStyle;
|
|
4544
|
+
}
|
|
4545
|
+
set italicStyle(e) {
|
|
4546
|
+
this._italicStyle = e;
|
|
4547
|
+
}
|
|
4548
|
+
get italicStyle() {
|
|
4549
|
+
return this._italicStyle;
|
|
4550
|
+
}
|
|
4551
|
+
set underlineStyle(e) {
|
|
4552
|
+
this._underlineStyle = e;
|
|
4553
|
+
}
|
|
4554
|
+
get underlineStyle() {
|
|
4555
|
+
return this._underlineStyle;
|
|
4556
|
+
}
|
|
4557
|
+
setup_palettes() {
|
|
4558
|
+
this.ansi_colors = [
|
|
4559
|
+
[
|
|
4560
|
+
{ rgb: [0, 0, 0], class_name: "ansi-black" },
|
|
4561
|
+
{ rgb: [187, 0, 0], class_name: "ansi-red" },
|
|
4562
|
+
{ rgb: [0, 187, 0], class_name: "ansi-green" },
|
|
4563
|
+
{ rgb: [187, 187, 0], class_name: "ansi-yellow" },
|
|
4564
|
+
{ rgb: [0, 0, 187], class_name: "ansi-blue" },
|
|
4565
|
+
{ rgb: [187, 0, 187], class_name: "ansi-magenta" },
|
|
4566
|
+
{ rgb: [0, 187, 187], class_name: "ansi-cyan" },
|
|
4567
|
+
{ rgb: [255, 255, 255], class_name: "ansi-white" }
|
|
4568
|
+
],
|
|
4569
|
+
[
|
|
4570
|
+
{ rgb: [85, 85, 85], class_name: "ansi-bright-black" },
|
|
4571
|
+
{ rgb: [255, 85, 85], class_name: "ansi-bright-red" },
|
|
4572
|
+
{ rgb: [0, 255, 0], class_name: "ansi-bright-green" },
|
|
4573
|
+
{ rgb: [255, 255, 85], class_name: "ansi-bright-yellow" },
|
|
4574
|
+
{ rgb: [85, 85, 255], class_name: "ansi-bright-blue" },
|
|
4575
|
+
{ rgb: [255, 85, 255], class_name: "ansi-bright-magenta" },
|
|
4576
|
+
{ rgb: [85, 255, 255], class_name: "ansi-bright-cyan" },
|
|
4577
|
+
{ rgb: [255, 255, 255], class_name: "ansi-bright-white" }
|
|
4578
|
+
]
|
|
4579
|
+
], this.palette_256 = [], this.ansi_colors.forEach((n) => {
|
|
4580
|
+
n.forEach((i) => {
|
|
4581
|
+
this.palette_256.push(i);
|
|
4582
|
+
});
|
|
4583
|
+
});
|
|
4584
|
+
let e = [0, 95, 135, 175, 215, 255];
|
|
4585
|
+
for (let n = 0; n < 6; ++n)
|
|
4586
|
+
for (let i = 0; i < 6; ++i)
|
|
4587
|
+
for (let r = 0; r < 6; ++r) {
|
|
4588
|
+
let o = { rgb: [e[n], e[i], e[r]], class_name: "truecolor" };
|
|
4589
|
+
this.palette_256.push(o);
|
|
4590
|
+
}
|
|
4591
|
+
let t = 8;
|
|
4592
|
+
for (let n = 0; n < 24; ++n, t += 10) {
|
|
4593
|
+
let i = { rgb: [t, t, t], class_name: "truecolor" };
|
|
4594
|
+
this.palette_256.push(i);
|
|
4595
|
+
}
|
|
4596
|
+
}
|
|
4597
|
+
escape_txt_for_html(e) {
|
|
4598
|
+
return this._escape_html ? e.replace(/[&<>"']/gm, (t) => {
|
|
4599
|
+
if (t === "&")
|
|
4600
|
+
return "&";
|
|
4601
|
+
if (t === "<")
|
|
4602
|
+
return "<";
|
|
4603
|
+
if (t === ">")
|
|
4604
|
+
return ">";
|
|
4605
|
+
if (t === '"')
|
|
4606
|
+
return """;
|
|
4607
|
+
if (t === "'")
|
|
4608
|
+
return "'";
|
|
4609
|
+
}) : e;
|
|
4610
|
+
}
|
|
4611
|
+
append_buffer(e) {
|
|
4612
|
+
var t = this._buffer + e;
|
|
4613
|
+
this._buffer = t;
|
|
4614
|
+
}
|
|
4615
|
+
get_next_packet() {
|
|
4616
|
+
var e = {
|
|
4617
|
+
kind: E.EOS,
|
|
4618
|
+
text: "",
|
|
4619
|
+
url: ""
|
|
4620
|
+
}, t = this._buffer.length;
|
|
4621
|
+
if (t == 0)
|
|
4622
|
+
return e;
|
|
4623
|
+
var n = this._buffer.indexOf("\x1B");
|
|
4624
|
+
if (n == -1)
|
|
4625
|
+
return e.kind = E.Text, e.text = this._buffer, this._buffer = "", e;
|
|
4626
|
+
if (n > 0)
|
|
4627
|
+
return e.kind = E.Text, e.text = this._buffer.slice(0, n), this._buffer = this._buffer.slice(n), e;
|
|
4628
|
+
if (n == 0) {
|
|
4629
|
+
if (t < 3)
|
|
4630
|
+
return e.kind = E.Incomplete, e;
|
|
4631
|
+
var i = this._buffer.charAt(1);
|
|
4632
|
+
if (i != "[" && i != "]" && i != "(")
|
|
4633
|
+
return e.kind = E.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
4634
|
+
if (i == "[") {
|
|
4635
|
+
this._csi_regex || (this._csi_regex = Bt(Mt || (Mt = Qe([`
|
|
4636
|
+
^ # beginning of line
|
|
4637
|
+
#
|
|
4638
|
+
# First attempt
|
|
4639
|
+
(?: # legal sequence
|
|
4640
|
+
\x1B[ # CSI
|
|
4641
|
+
([<-?]?) # private-mode char
|
|
4642
|
+
([d;]*) # any digits or semicolons
|
|
4643
|
+
([ -/]? # an intermediate modifier
|
|
4644
|
+
[@-~]) # the command
|
|
4645
|
+
)
|
|
4646
|
+
| # alternate (second attempt)
|
|
4647
|
+
(?: # illegal sequence
|
|
4648
|
+
\x1B[ # CSI
|
|
4649
|
+
[ -~]* # anything legal
|
|
4650
|
+
([\0-:]) # anything illegal
|
|
4651
|
+
)
|
|
4652
|
+
`], [`
|
|
4653
|
+
^ # beginning of line
|
|
4654
|
+
#
|
|
4655
|
+
# First attempt
|
|
4656
|
+
(?: # legal sequence
|
|
4657
|
+
\\x1b\\[ # CSI
|
|
4658
|
+
([\\x3c-\\x3f]?) # private-mode char
|
|
4659
|
+
([\\d;]*) # any digits or semicolons
|
|
4660
|
+
([\\x20-\\x2f]? # an intermediate modifier
|
|
4661
|
+
[\\x40-\\x7e]) # the command
|
|
4662
|
+
)
|
|
4663
|
+
| # alternate (second attempt)
|
|
4664
|
+
(?: # illegal sequence
|
|
4665
|
+
\\x1b\\[ # CSI
|
|
4666
|
+
[\\x20-\\x7e]* # anything legal
|
|
4667
|
+
([\\x00-\\x1f:]) # anything illegal
|
|
4668
|
+
)
|
|
4669
|
+
`]))));
|
|
4670
|
+
let o = this._buffer.match(this._csi_regex);
|
|
4671
|
+
if (o === null)
|
|
4672
|
+
return e.kind = E.Incomplete, e;
|
|
4673
|
+
if (o[4])
|
|
4674
|
+
return e.kind = E.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
4675
|
+
o[1] != "" || o[3] != "m" ? e.kind = E.Unknown : e.kind = E.SGR, e.text = o[2];
|
|
4676
|
+
var r = o[0].length;
|
|
4677
|
+
return this._buffer = this._buffer.slice(r), e;
|
|
4678
|
+
} else if (i == "]") {
|
|
4679
|
+
if (t < 4)
|
|
4680
|
+
return e.kind = E.Incomplete, e;
|
|
4681
|
+
if (this._buffer.charAt(2) != "8" || this._buffer.charAt(3) != ";")
|
|
4682
|
+
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 = ei(Pt || (Pt = Qe([`
|
|
4684
|
+
(?: # legal sequence
|
|
4685
|
+
(\x1B\\) # ESC | # alternate
|
|
4686
|
+
(\x07) # BEL (what xterm did)
|
|
4687
|
+
)
|
|
4688
|
+
| # alternate (second attempt)
|
|
4689
|
+
( # illegal sequence
|
|
4690
|
+
[\0-] # anything illegal
|
|
4691
|
+
| # alternate
|
|
4692
|
+
[\b-] # anything illegal
|
|
4693
|
+
| # alternate
|
|
4694
|
+
[-] # anything illegal
|
|
4695
|
+
)
|
|
4696
|
+
`], [`
|
|
4697
|
+
(?: # legal sequence
|
|
4698
|
+
(\\x1b\\\\) # ESC \\
|
|
4699
|
+
| # alternate
|
|
4700
|
+
(\\x07) # BEL (what xterm did)
|
|
4701
|
+
)
|
|
4702
|
+
| # alternate (second attempt)
|
|
4703
|
+
( # illegal sequence
|
|
4704
|
+
[\\x00-\\x06] # anything illegal
|
|
4705
|
+
| # alternate
|
|
4706
|
+
[\\x08-\\x1a] # anything illegal
|
|
4707
|
+
| # alternate
|
|
4708
|
+
[\\x1c-\\x1f] # anything illegal
|
|
4709
|
+
)
|
|
4710
|
+
`])))), this._osc_st.lastIndex = 0;
|
|
4711
|
+
{
|
|
4712
|
+
let a = this._osc_st.exec(this._buffer);
|
|
4713
|
+
if (a === null)
|
|
4714
|
+
return e.kind = E.Incomplete, e;
|
|
4715
|
+
if (a[3])
|
|
4716
|
+
return e.kind = E.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
4717
|
+
}
|
|
4718
|
+
{
|
|
4719
|
+
let a = this._osc_st.exec(this._buffer);
|
|
4720
|
+
if (a === null)
|
|
4721
|
+
return e.kind = E.Incomplete, e;
|
|
4722
|
+
if (a[3])
|
|
4723
|
+
return e.kind = E.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
4724
|
+
}
|
|
4725
|
+
this._osc_regex || (this._osc_regex = Bt(Dt || (Dt = Qe([`
|
|
4726
|
+
^ # beginning of line
|
|
4727
|
+
#
|
|
4728
|
+
\x1B]8; # OSC Hyperlink
|
|
4729
|
+
[ -:<-~]* # params (excluding ;)
|
|
4730
|
+
; # end of params
|
|
4731
|
+
([!-~]{0,512}) # URL capture
|
|
4732
|
+
(?: # ST
|
|
4733
|
+
(?:\x1B\\) # ESC | # alternate
|
|
4734
|
+
(?:\x07) # BEL (what xterm did)
|
|
4735
|
+
)
|
|
4736
|
+
([ -~]+) # TEXT capture
|
|
4737
|
+
\x1B]8;; # OSC Hyperlink End
|
|
4738
|
+
(?: # ST
|
|
4739
|
+
(?:\x1B\\) # ESC | # alternate
|
|
4740
|
+
(?:\x07) # BEL (what xterm did)
|
|
4741
|
+
)
|
|
4742
|
+
`], [`
|
|
4743
|
+
^ # beginning of line
|
|
4744
|
+
#
|
|
4745
|
+
\\x1b\\]8; # OSC Hyperlink
|
|
4746
|
+
[\\x20-\\x3a\\x3c-\\x7e]* # params (excluding ;)
|
|
4747
|
+
; # end of params
|
|
4748
|
+
([\\x21-\\x7e]{0,512}) # URL capture
|
|
4749
|
+
(?: # ST
|
|
4750
|
+
(?:\\x1b\\\\) # ESC \\
|
|
4751
|
+
| # alternate
|
|
4752
|
+
(?:\\x07) # BEL (what xterm did)
|
|
4753
|
+
)
|
|
4754
|
+
([\\x20-\\x7e]+) # TEXT capture
|
|
4755
|
+
\\x1b\\]8;; # OSC Hyperlink End
|
|
4756
|
+
(?: # ST
|
|
4757
|
+
(?:\\x1b\\\\) # ESC \\
|
|
4758
|
+
| # alternate
|
|
4759
|
+
(?:\\x07) # BEL (what xterm did)
|
|
4760
|
+
)
|
|
4761
|
+
`]))));
|
|
4762
|
+
let o = this._buffer.match(this._osc_regex);
|
|
4763
|
+
if (o === null)
|
|
4764
|
+
return e.kind = E.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
4765
|
+
e.kind = E.OSCURL, e.url = o[1], e.text = o[2];
|
|
4766
|
+
var r = o[0].length;
|
|
4767
|
+
return this._buffer = this._buffer.slice(r), e;
|
|
4768
|
+
} else if (i == "(")
|
|
4769
|
+
return e.kind = E.Unknown, this._buffer = this._buffer.slice(3), e;
|
|
4770
|
+
}
|
|
4771
|
+
}
|
|
4772
|
+
ansi_to_html(e) {
|
|
4773
|
+
this.append_buffer(e);
|
|
4774
|
+
for (var t = []; ; ) {
|
|
4775
|
+
var n = this.get_next_packet();
|
|
4776
|
+
if (n.kind == E.EOS || n.kind == E.Incomplete)
|
|
4777
|
+
break;
|
|
4778
|
+
n.kind == E.ESC || n.kind == E.Unknown || (n.kind == E.Text ? t.push(this.transform_to_html(this.with_state(n))) : n.kind == E.SGR ? this.process_ansi(n) : n.kind == E.OSCURL && t.push(this.process_hyperlink(n)));
|
|
4779
|
+
}
|
|
4780
|
+
return t.join("");
|
|
4781
|
+
}
|
|
4782
|
+
with_state(e) {
|
|
4783
|
+
return { bold: this.bold, faint: this.faint, italic: this.italic, underline: this.underline, fg: this.fg, bg: this.bg, text: e.text };
|
|
4784
|
+
}
|
|
4785
|
+
process_ansi(e) {
|
|
4786
|
+
let t = e.text.split(";");
|
|
4787
|
+
for (; t.length > 0; ) {
|
|
4788
|
+
let n = t.shift(), i = parseInt(n, 10);
|
|
4789
|
+
if (isNaN(i) || i === 0)
|
|
4790
|
+
this.fg = null, this.bg = null, this.bold = !1, this.faint = !1, this.italic = !1, this.underline = !1;
|
|
4791
|
+
else if (i === 1)
|
|
4792
|
+
this.bold = !0;
|
|
4793
|
+
else if (i === 2)
|
|
4794
|
+
this.faint = !0;
|
|
4795
|
+
else if (i === 3)
|
|
4796
|
+
this.italic = !0;
|
|
4797
|
+
else if (i === 4)
|
|
4798
|
+
this.underline = !0;
|
|
4799
|
+
else if (i === 21)
|
|
4800
|
+
this.bold = !1;
|
|
4801
|
+
else if (i === 22)
|
|
4802
|
+
this.faint = !1, this.bold = !1;
|
|
4803
|
+
else if (i === 23)
|
|
4804
|
+
this.italic = !1;
|
|
4805
|
+
else if (i === 24)
|
|
4806
|
+
this.underline = !1;
|
|
4807
|
+
else if (i === 39)
|
|
4808
|
+
this.fg = null;
|
|
4809
|
+
else if (i === 49)
|
|
4810
|
+
this.bg = null;
|
|
4811
|
+
else if (i >= 30 && i < 38)
|
|
4812
|
+
this.fg = this.ansi_colors[0][i - 30];
|
|
4813
|
+
else if (i >= 40 && i < 48)
|
|
4814
|
+
this.bg = this.ansi_colors[0][i - 40];
|
|
4815
|
+
else if (i >= 90 && i < 98)
|
|
4816
|
+
this.fg = this.ansi_colors[1][i - 90];
|
|
4817
|
+
else if (i >= 100 && i < 108)
|
|
4818
|
+
this.bg = this.ansi_colors[1][i - 100];
|
|
4819
|
+
else if ((i === 38 || i === 48) && t.length > 0) {
|
|
4820
|
+
let r = i === 38, o = t.shift();
|
|
4821
|
+
if (o === "5" && t.length > 0) {
|
|
4822
|
+
let l = parseInt(t.shift(), 10);
|
|
4823
|
+
l >= 0 && l <= 255 && (r ? this.fg = this.palette_256[l] : this.bg = this.palette_256[l]);
|
|
4824
|
+
}
|
|
4825
|
+
if (o === "2" && t.length > 2) {
|
|
4826
|
+
let l = parseInt(t.shift(), 10), a = parseInt(t.shift(), 10), c = parseInt(t.shift(), 10);
|
|
4827
|
+
if (l >= 0 && l <= 255 && a >= 0 && a <= 255 && c >= 0 && c <= 255) {
|
|
4828
|
+
let d = { rgb: [l, a, c], class_name: "truecolor" };
|
|
4829
|
+
r ? this.fg = d : this.bg = d;
|
|
4830
|
+
}
|
|
4831
|
+
}
|
|
4832
|
+
}
|
|
4833
|
+
}
|
|
4834
|
+
}
|
|
4835
|
+
transform_to_html(e) {
|
|
4836
|
+
let t = e.text;
|
|
4837
|
+
if (t.length === 0 || (t = this.escape_txt_for_html(t), !e.bold && !e.italic && !e.faint && !e.underline && e.fg === null && e.bg === null))
|
|
4838
|
+
return t;
|
|
4839
|
+
let n = [], i = [], r = e.fg, o = e.bg;
|
|
4840
|
+
e.bold && n.push(this._boldStyle), e.faint && n.push(this._faintStyle), e.italic && n.push(this._italicStyle), e.underline && n.push(this._underlineStyle), this._use_classes ? (r && (r.class_name !== "truecolor" ? i.push(`${r.class_name}-fg`) : n.push(`color:rgb(${r.rgb.join(",")})`)), o && (o.class_name !== "truecolor" ? i.push(`${o.class_name}-bg`) : n.push(`background-color:rgb(${o.rgb.join(",")})`))) : (r && n.push(`color:rgb(${r.rgb.join(",")})`), o && n.push(`background-color:rgb(${o.rgb})`));
|
|
4841
|
+
let l = "", a = "";
|
|
4842
|
+
return i.length && (l = ` class="${i.join(" ")}"`), n.length && (a = ` style="${n.join(";")}"`), `<span${a}${l}>${t}</span>`;
|
|
4843
|
+
}
|
|
4844
|
+
process_hyperlink(e) {
|
|
4845
|
+
let t = e.url.split(":");
|
|
4846
|
+
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
|
+
}
|
|
4848
|
+
}
|
|
4849
|
+
function Bt(s, ...e) {
|
|
4850
|
+
let t = s.raw[0], n = /^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm, i = t.replace(n, "");
|
|
4851
|
+
return new RegExp(i);
|
|
4852
|
+
}
|
|
4853
|
+
function ei(s, ...e) {
|
|
4854
|
+
let t = s.raw[0], n = /^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm, i = t.replace(n, "");
|
|
4855
|
+
return new RegExp(i, "g");
|
|
4856
|
+
}
|
|
4857
|
+
var Mt, Pt, Dt;
|
|
4858
|
+
const xt = new Zn(), Ts = it(Ut(), "workflow-reports");
|
|
4859
|
+
async function ti(s, e) {
|
|
4507
4860
|
try {
|
|
4508
|
-
const t =
|
|
4509
|
-
await
|
|
4861
|
+
const t = it(Ts, `${s.id}.json`);
|
|
4862
|
+
await $s(
|
|
4510
4863
|
t,
|
|
4511
4864
|
JSON.stringify({ ...s, outputs: e }, null, 2),
|
|
4512
4865
|
"utf8"
|
|
@@ -4516,36 +4869,86 @@ async function Yn(s, e) {
|
|
|
4516
4869
|
console.error("Error writing report:", n);
|
|
4517
4870
|
}
|
|
4518
4871
|
}
|
|
4519
|
-
async function
|
|
4872
|
+
async function si(s) {
|
|
4520
4873
|
try {
|
|
4521
|
-
return await import(
|
|
4874
|
+
return await import(it(Ts, `${s}.json`), { assert: { type: "json" } });
|
|
4522
4875
|
} catch (e) {
|
|
4523
4876
|
const t = e instanceof Error ? e.message : String(e);
|
|
4524
4877
|
return console.error("Error reading report:", t), null;
|
|
4525
4878
|
}
|
|
4526
4879
|
}
|
|
4527
|
-
const
|
|
4528
|
-
|
|
4880
|
+
const ni = `<!DOCTYPE html>
|
|
4881
|
+
<html lang="en">
|
|
4882
|
+
<head>
|
|
4883
|
+
<meta charset="UTF-8">
|
|
4884
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
4885
|
+
<title>Workflow Report</title>
|
|
4886
|
+
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
|
|
4887
|
+
</head>
|
|
4888
|
+
<body class="bg-gray-100 p-4">
|
|
4889
|
+
<div class="max-w-4xl mx-auto bg-white shadow-md rounded-lg p-6">
|
|
4890
|
+
<h1 class="text-2xl font-bold mb-4">Workflow Report</h1>
|
|
4891
|
+
<p class="text-red-500">Report not found.</p>
|
|
4892
|
+
</div>
|
|
4893
|
+
</body>
|
|
4894
|
+
</html>`;
|
|
4895
|
+
async function Kt(s) {
|
|
4896
|
+
return s ? `<!DOCTYPE html>
|
|
4897
|
+
<html lang="en">
|
|
4898
|
+
<head>
|
|
4899
|
+
<meta charset="UTF-8">
|
|
4900
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
4901
|
+
<title>Workflow Report - ${s.id}</title>
|
|
4902
|
+
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
|
|
4903
|
+
</head>
|
|
4904
|
+
<body class="bg-gray-100 p-4">
|
|
4905
|
+
<div class="max-w-4xl mx-auto bg-white shadow-md rounded-lg p-6">
|
|
4906
|
+
<h1 class="text-2xl font-bold mb-4">Workflow Report - ${s.id}</h1>
|
|
4907
|
+
${s.outputs.map(
|
|
4908
|
+
(t, n) => `
|
|
4909
|
+
<div class="mb-6">
|
|
4910
|
+
<h2 class="text-xl font-semibold mb-2">Step ${n + 1}: ${t.cmd} (${t.code})</h2>
|
|
4911
|
+
<div class="bg-gray-800 text-green-400 p-4 rounded mb-2 overflow-x-auto">
|
|
4912
|
+
<pre>${xt.ansi_to_html(t.stdout)}</pre>
|
|
4913
|
+
</div>
|
|
4914
|
+
<div class="bg-gray-800 text-red-400 p-4 rounded overflow-x-auto">
|
|
4915
|
+
<pre>${xt.ansi_to_html(t.stderr)}</pre>
|
|
4916
|
+
</div>
|
|
4917
|
+
</div>
|
|
4918
|
+
`
|
|
4919
|
+
).join("")}
|
|
4920
|
+
<div class="mt-4">
|
|
4921
|
+
${s.parentId ? `<a href="/reports/${s.parentId}" class="text-blue-500 hover:underline">View Parent Report</a>` : ""}
|
|
4922
|
+
${s.children && s.children.length > 0 ? `<div class="mt-2">Child Reports:<ul>${s.children.map(
|
|
4923
|
+
(t) => `<li><a href="/reports/${t}" class="text-blue-500 hover:underline">${t}</a></li>`
|
|
4924
|
+
).join("")}</ul></div>` : ""}
|
|
4925
|
+
|
|
4926
|
+
</div>
|
|
4927
|
+
</body>
|
|
4928
|
+
</html>` : ni;
|
|
4929
|
+
}
|
|
4930
|
+
const ii = "/workspace", ri = "dhi.io/alpine-base:3.23-alpine3.23-dev";
|
|
4931
|
+
function oi(s, e) {
|
|
4529
4932
|
if (typeof s.run != "string")
|
|
4530
4933
|
throw new Error("Each workflow step must have a 'run' command string.");
|
|
4531
4934
|
const t = e.workflow.defaults || {};
|
|
4532
|
-
return s.image ||= t.image ||
|
|
4935
|
+
return s.image ||= t.image || ri, s.volumes ||= t.volumes || {}, s.args ||= t.args || [], s.run = je(s.run, { ...e, step: s }), s;
|
|
4533
4936
|
}
|
|
4534
|
-
function
|
|
4937
|
+
function li(s, e) {
|
|
4535
4938
|
return (s || []).flatMap(
|
|
4536
4939
|
(t) => Object.entries(t).flatMap(([n, i]) => [
|
|
4537
4940
|
`--${n}`,
|
|
4538
|
-
|
|
4941
|
+
je(String(i), e)
|
|
4539
4942
|
])
|
|
4540
4943
|
);
|
|
4541
4944
|
}
|
|
4542
|
-
function
|
|
4543
|
-
return s["."] ||=
|
|
4945
|
+
function ai(s, e) {
|
|
4946
|
+
return s["."] ||= ii, Object.entries(s).flatMap(([t, n]) => [
|
|
4544
4947
|
"-v",
|
|
4545
4948
|
`${t === "." ? e.workingDir : t}:${n}`
|
|
4546
4949
|
]);
|
|
4547
4950
|
}
|
|
4548
|
-
function
|
|
4951
|
+
function ci(s) {
|
|
4549
4952
|
const { workflow: e, secrets: t } = s, n = {
|
|
4550
4953
|
...process.env,
|
|
4551
4954
|
...Object.fromEntries(
|
|
@@ -4557,12 +4960,12 @@ function zn(s) {
|
|
|
4557
4960
|
if (typeof e.env != "object")
|
|
4558
4961
|
throw new Error("Workflow env field must be an object.");
|
|
4559
4962
|
for (const [i, r] of Object.entries(e.env))
|
|
4560
|
-
n[i] =
|
|
4963
|
+
n[i] = je(r, s);
|
|
4561
4964
|
}
|
|
4562
4965
|
Object.assign(s.env, n);
|
|
4563
4966
|
}
|
|
4564
|
-
function
|
|
4565
|
-
const t = Object.keys(s), n = Object.keys(e.on), i = n.find((
|
|
4967
|
+
function fi(s, e) {
|
|
4968
|
+
const t = Object.keys(s), n = Object.keys(e.on), i = n.find((l) => s[l]), r = i ? e.on[i] : null;
|
|
4566
4969
|
if (!r)
|
|
4567
4970
|
return console.log(
|
|
4568
4971
|
`No workflow defined for event keys: ${t.join(", ")}, only accepting ${n.join(", ")}.`
|
|
@@ -4577,22 +4980,22 @@ function Zn(s, e) {
|
|
|
4577
4980
|
event: o
|
|
4578
4981
|
};
|
|
4579
4982
|
}
|
|
4580
|
-
async function
|
|
4983
|
+
async function ui(s, e) {
|
|
4581
4984
|
typeof s == "string" && (s = { run: s });
|
|
4582
|
-
const t =
|
|
4985
|
+
const t = oi(s, e), { args: n, image: i, volumes: r } = t, o = ai(r, e), l = li(n, e), a = r["."], c = [
|
|
4583
4986
|
"run",
|
|
4584
4987
|
"-i",
|
|
4585
4988
|
"--rm",
|
|
4586
4989
|
...o,
|
|
4587
|
-
...
|
|
4990
|
+
...l,
|
|
4588
4991
|
"-w",
|
|
4589
|
-
|
|
4992
|
+
a,
|
|
4590
4993
|
"--entrypoint",
|
|
4591
4994
|
"sh",
|
|
4592
4995
|
i
|
|
4593
4996
|
];
|
|
4594
4997
|
return new Promise((d, u) => {
|
|
4595
|
-
const f =
|
|
4998
|
+
const f = Rt("docker", c, {
|
|
4596
4999
|
env: e.env
|
|
4597
5000
|
}), p = [], g = [];
|
|
4598
5001
|
f.stdout?.on("data", (h) => {
|
|
@@ -4612,23 +5015,23 @@ exit $?;
|
|
|
4612
5015
|
`), f.stdin?.end();
|
|
4613
5016
|
});
|
|
4614
5017
|
}
|
|
4615
|
-
async function
|
|
4616
|
-
const n =
|
|
5018
|
+
async function Is(s, e, t) {
|
|
5019
|
+
const n = Ms(), i = fi(s, e);
|
|
4617
5020
|
if (!i)
|
|
4618
5021
|
return { id: n, parentId: t, outputs: [] };
|
|
4619
|
-
const { workflow: r, event: o } = i,
|
|
4620
|
-
inputs:
|
|
4621
|
-
secrets:
|
|
5022
|
+
const { workflow: r, event: o } = i, l = Ds(o, r.mappings), a = await zn(r.secrets), c = await Ls(Bs(Ut(), "workflow")), d = Ft({
|
|
5023
|
+
inputs: l,
|
|
5024
|
+
secrets: a,
|
|
4622
5025
|
workflow: r,
|
|
4623
5026
|
env: {},
|
|
4624
5027
|
outputs: [],
|
|
4625
5028
|
workingDir: c
|
|
4626
5029
|
});
|
|
4627
|
-
|
|
5030
|
+
ci(d);
|
|
4628
5031
|
const u = [];
|
|
4629
5032
|
try {
|
|
4630
5033
|
for (const f of r.steps ?? []) {
|
|
4631
|
-
const p = await
|
|
5034
|
+
const p = await ui(f, d);
|
|
4632
5035
|
if (p.code !== 0)
|
|
4633
5036
|
throw new Error(
|
|
4634
5037
|
`Step failed with code ${p.code}.
|
|
@@ -4638,68 +5041,64 @@ stderr: ${p.stderr}`
|
|
|
4638
5041
|
d.outputs.push(p);
|
|
4639
5042
|
}
|
|
4640
5043
|
for (const f of r.triggers ?? []) {
|
|
4641
|
-
const p = await
|
|
5044
|
+
const p = await hi(f, e, t);
|
|
4642
5045
|
p && u.push(p.id);
|
|
4643
5046
|
}
|
|
4644
5047
|
} catch (f) {
|
|
4645
5048
|
const p = f instanceof Error ? f.message : String(f);
|
|
4646
5049
|
console.error(`Error processing event: ${p}`), console.debug(JSON.stringify(o));
|
|
4647
5050
|
} finally {
|
|
4648
|
-
await
|
|
5051
|
+
await Cs(d.workingDir, { recursive: !0, force: !0 });
|
|
4649
5052
|
}
|
|
4650
|
-
return await
|
|
5053
|
+
return await ti({ id: n, parentId: t, children: u }, d.outputs), { id: n, parentId: t, children: u, outputs: d.outputs };
|
|
4651
5054
|
}
|
|
4652
|
-
async function
|
|
4653
|
-
if (!
|
|
5055
|
+
async function hi(s, e, t) {
|
|
5056
|
+
if (!js(s)) {
|
|
4654
5057
|
console.warn(`Trigger file does not exist: ${s}`);
|
|
4655
5058
|
return;
|
|
4656
5059
|
}
|
|
4657
|
-
const n = await
|
|
4658
|
-
return await
|
|
5060
|
+
const n = await nt(s, "utf8"), i = rt(JSON.parse(n));
|
|
5061
|
+
return await Is(i, e, t);
|
|
4659
5062
|
}
|
|
4660
|
-
async function
|
|
5063
|
+
async function di(s) {
|
|
4661
5064
|
if (s.daemon) {
|
|
4662
|
-
const i = process.argv.slice(1).filter((
|
|
5065
|
+
const i = process.argv.slice(1).filter((l) => l !== "--daemon" && l !== "-d"), r = process.execArgv.concat(i), o = Rt(process.execPath, r, {
|
|
4663
5066
|
detached: !0,
|
|
4664
5067
|
stdio: "ignore"
|
|
4665
5068
|
});
|
|
4666
5069
|
return console.log(o.pid), o.unref(), null;
|
|
4667
5070
|
}
|
|
4668
|
-
const e = await
|
|
5071
|
+
const e = await Qn(s.configPath), t = vs(async (i, r) => {
|
|
4669
5072
|
if (i.method === "GET" && i.url === "/health") {
|
|
4670
|
-
|
|
5073
|
+
_e(r, 200, { status: "OK" });
|
|
4671
5074
|
return;
|
|
4672
5075
|
}
|
|
4673
5076
|
if (i.method === "GET" && i.url?.startsWith("/logs/")) {
|
|
4674
|
-
const o = i.url.split("/logs/")[1],
|
|
4675
|
-
|
|
4676
|
-
exitCode: a.outputs.slice(-1)[0]?.code ?? null,
|
|
4677
|
-
stdout: a.outputs.map((l) => l.stdout),
|
|
4678
|
-
stderr: a.outputs.map((l) => l.stderr)
|
|
4679
|
-
}) : x(r, 404, { error: "Report not found." });
|
|
5077
|
+
const o = i.url.split("/logs/")[1], l = await si(o), a = await Kt(l);
|
|
5078
|
+
l ? (r.writeHead(200, { "Content-Type": "text/html" }), r.end(a)) : (r.writeHead(404, { "Content-Type": "text/html" }), r.end(Kt(null)));
|
|
4680
5079
|
return;
|
|
4681
5080
|
}
|
|
4682
5081
|
if (i.method !== "POST") {
|
|
4683
|
-
|
|
5082
|
+
_e(r, 405, { error: "Only POST webhooks are supported." });
|
|
4684
5083
|
return;
|
|
4685
5084
|
}
|
|
4686
5085
|
try {
|
|
4687
|
-
const o = Buffer.concat(await i.toArray()).toString(),
|
|
4688
|
-
|
|
4689
|
-
id:
|
|
4690
|
-
logUrl: c(
|
|
4691
|
-
parent:
|
|
4692
|
-
id:
|
|
4693
|
-
logUrl:
|
|
5086
|
+
const o = Buffer.concat(await i.toArray()).toString(), l = rt(JSON.parse(o || "{}")), a = await Is(l, e), c = (d) => new URL("/logs/" + d, `http://${i.headers.host}`);
|
|
5087
|
+
_e(r, 202, {
|
|
5088
|
+
id: a.id,
|
|
5089
|
+
logUrl: c(a.id).href,
|
|
5090
|
+
parent: a.parentId ? {
|
|
5091
|
+
id: a.parentId,
|
|
5092
|
+
logUrl: a.parentId ? c(a.parentId).href : void 0
|
|
4694
5093
|
} : null,
|
|
4695
|
-
children:
|
|
5094
|
+
children: a.children?.map((d) => ({
|
|
4696
5095
|
id: d,
|
|
4697
5096
|
logUrl: c(d).href
|
|
4698
5097
|
})) || []
|
|
4699
5098
|
});
|
|
4700
5099
|
} catch (o) {
|
|
4701
|
-
const
|
|
4702
|
-
console.error("Error processing webhook:", o),
|
|
5100
|
+
const l = o instanceof Error ? o.message : "Unknown error";
|
|
5101
|
+
console.error("Error processing webhook:", o), _e(r, 400, { error: l });
|
|
4703
5102
|
}
|
|
4704
5103
|
});
|
|
4705
5104
|
await new Promise((i, r) => {
|
|
@@ -4708,7 +5107,7 @@ async function si(s) {
|
|
|
4708
5107
|
const n = t.address();
|
|
4709
5108
|
return n && typeof n == "object" && console.log(`Started on http://${n.address}:${n.port}`), t;
|
|
4710
5109
|
}
|
|
4711
|
-
const
|
|
5110
|
+
const pi = `on - daemonized webhook runner
|
|
4712
5111
|
|
|
4713
5112
|
Usage:
|
|
4714
5113
|
on --port <port> [--host <host>] [--config <path>]
|
|
@@ -4720,8 +5119,8 @@ Options:
|
|
|
4720
5119
|
--config, -c Path to a YAML/JSON config file
|
|
4721
5120
|
--help, -h Show this help message
|
|
4722
5121
|
`;
|
|
4723
|
-
function
|
|
4724
|
-
const { values: e } =
|
|
5122
|
+
function mi(s) {
|
|
5123
|
+
const { values: e } = As({
|
|
4725
5124
|
args: s,
|
|
4726
5125
|
options: {
|
|
4727
5126
|
port: { type: "string", short: "p" },
|
|
@@ -4733,31 +5132,31 @@ function ii(s) {
|
|
|
4733
5132
|
allowPositionals: !1
|
|
4734
5133
|
});
|
|
4735
5134
|
if (e.help)
|
|
4736
|
-
return console.log(
|
|
5135
|
+
return console.log(pi), null;
|
|
4737
5136
|
if (!e.port)
|
|
4738
5137
|
throw new Error("Missing required option --port.");
|
|
4739
5138
|
return {
|
|
4740
|
-
port:
|
|
5139
|
+
port: Ps(e.port),
|
|
4741
5140
|
host: e.host,
|
|
4742
5141
|
configPath: e.config,
|
|
4743
5142
|
daemon: e.daemon
|
|
4744
5143
|
};
|
|
4745
5144
|
}
|
|
4746
|
-
async function
|
|
5145
|
+
async function gi() {
|
|
4747
5146
|
try {
|
|
4748
|
-
const s =
|
|
5147
|
+
const s = mi(process.argv.slice(2));
|
|
4749
5148
|
if (!s) {
|
|
4750
5149
|
process.exitCode = 0;
|
|
4751
5150
|
return;
|
|
4752
5151
|
}
|
|
4753
|
-
await
|
|
5152
|
+
await di(s);
|
|
4754
5153
|
} catch (s) {
|
|
4755
5154
|
const e = s instanceof Error ? s.message : String(s);
|
|
4756
5155
|
console.error(`on: ${e}`), process.exitCode = 1;
|
|
4757
5156
|
}
|
|
4758
5157
|
}
|
|
4759
|
-
|
|
5158
|
+
gi();
|
|
4760
5159
|
export {
|
|
4761
|
-
|
|
4762
|
-
|
|
5160
|
+
gi as main,
|
|
5161
|
+
mi as parseCliOptions
|
|
4763
5162
|
};
|