@origints/markdown 0.1.0 → 0.2.0
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/LICENSE +21 -0
- package/README.md +223 -0
- package/dist/index.cjs +65 -65
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.es.js +1003 -836
- package/dist/index.es.js.map +1 -1
- package/dist/markdown-node.d.ts +2 -0
- package/dist/markdown-spec-builder.d.ts +36 -0
- package/dist/markdown-spec-executor.d.ts +6 -0
- package/dist/markdown-spec.d.ts +32 -0
- package/dist/parse.d.ts +9 -5
- package/package.json +19 -5
package/dist/index.es.js
CHANGED
|
@@ -1,40 +1,44 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
1
|
+
import { TYPE_LABEL as Ns, registerSpecExecutor as Ts, globalRegistry as As } from "@origints/core";
|
|
2
|
+
import { select as Os, selectAll as Is } from "unist-util-select";
|
|
3
|
+
import { unified as ot } from "unified";
|
|
4
|
+
import Kt from "remark-parse";
|
|
5
|
+
import at from "remark-gfm";
|
|
6
|
+
import $s from "remark-frontmatter";
|
|
7
|
+
import Dt from "remark-rehype";
|
|
8
|
+
import jt from "rehype-stringify";
|
|
9
|
+
function M(n, e) {
|
|
9
10
|
return { ok: !0, value: n, path: e };
|
|
10
11
|
}
|
|
11
|
-
function
|
|
12
|
+
function $(n, e, t, s) {
|
|
12
13
|
return {
|
|
13
14
|
ok: !1,
|
|
14
15
|
failure: { kind: n, message: e, path: t, position: s }
|
|
15
16
|
};
|
|
16
17
|
}
|
|
17
|
-
function
|
|
18
|
+
function Xn(n) {
|
|
18
19
|
return n.length === 0 ? "$" : "$" + n.map(
|
|
19
20
|
(e) => typeof e == "number" ? `[${e}]` : `.${e}`
|
|
20
21
|
).join("");
|
|
21
22
|
}
|
|
22
|
-
class
|
|
23
|
+
class U {
|
|
23
24
|
constructor(e, t, s) {
|
|
24
25
|
this.node = e, this._path = t, this.root = s;
|
|
25
26
|
}
|
|
27
|
+
get [Ns]() {
|
|
28
|
+
return `MarkdownNode(${this.nodeType})`;
|
|
29
|
+
}
|
|
26
30
|
/**
|
|
27
31
|
* Creates a MarkdownNode from a parsed mdast tree.
|
|
28
32
|
*/
|
|
29
33
|
static fromRoot(e) {
|
|
30
|
-
return new
|
|
34
|
+
return new U(e, [], e);
|
|
31
35
|
}
|
|
32
36
|
/**
|
|
33
37
|
* Creates a MarkdownNode from an mdast node.
|
|
34
38
|
* @internal
|
|
35
39
|
*/
|
|
36
40
|
static fromNode(e, t, s) {
|
|
37
|
-
return new
|
|
41
|
+
return new U(e, t, s);
|
|
38
42
|
}
|
|
39
43
|
/**
|
|
40
44
|
* Returns the current path through the Markdown structure.
|
|
@@ -93,17 +97,17 @@ class F {
|
|
|
93
97
|
* ```
|
|
94
98
|
*/
|
|
95
99
|
select(e) {
|
|
96
|
-
const t =
|
|
100
|
+
const t = Os(e, this.node);
|
|
97
101
|
if (!t)
|
|
98
|
-
return
|
|
102
|
+
return $(
|
|
99
103
|
"selector",
|
|
100
104
|
`No node matches selector: ${e}`,
|
|
101
105
|
this._path,
|
|
102
106
|
this.position
|
|
103
107
|
);
|
|
104
108
|
const s = [...this._path, e];
|
|
105
|
-
return
|
|
106
|
-
new
|
|
109
|
+
return M(
|
|
110
|
+
new U(t, s, this.root),
|
|
107
111
|
s
|
|
108
112
|
);
|
|
109
113
|
}
|
|
@@ -111,11 +115,11 @@ class F {
|
|
|
111
115
|
* Select all nodes matching the CSS-like selector.
|
|
112
116
|
*/
|
|
113
117
|
selectAll(e) {
|
|
114
|
-
const s =
|
|
118
|
+
const s = Is(e, this.node).map((i, r) => {
|
|
115
119
|
const o = [...this._path, `${e}[${r}]`];
|
|
116
|
-
return new
|
|
120
|
+
return new U(i, o, this.root);
|
|
117
121
|
});
|
|
118
|
-
return
|
|
122
|
+
return M(s, this._path);
|
|
119
123
|
}
|
|
120
124
|
// ---------------------------------------------------------------------------
|
|
121
125
|
// TREE TRAVERSAL
|
|
@@ -125,29 +129,29 @@ class F {
|
|
|
125
129
|
*/
|
|
126
130
|
children() {
|
|
127
131
|
if (!("children" in this.node))
|
|
128
|
-
return
|
|
132
|
+
return M([], this._path);
|
|
129
133
|
const t = this.node.children.map((s, i) => {
|
|
130
134
|
const r = [...this._path, i];
|
|
131
|
-
return new
|
|
135
|
+
return new U(s, r, this.root);
|
|
132
136
|
});
|
|
133
|
-
return
|
|
137
|
+
return M(t, this._path);
|
|
134
138
|
}
|
|
135
139
|
/**
|
|
136
140
|
* Get child at specific index.
|
|
137
141
|
*/
|
|
138
142
|
child(e) {
|
|
139
143
|
if (!("children" in this.node))
|
|
140
|
-
return
|
|
144
|
+
return $("type", "Node has no children", this._path, this.position);
|
|
141
145
|
const t = this.node.children;
|
|
142
146
|
if (e < 0 || e >= t.length)
|
|
143
|
-
return
|
|
147
|
+
return $(
|
|
144
148
|
"missing",
|
|
145
149
|
`Index ${e} out of bounds (length: ${t.length})`,
|
|
146
150
|
this._path,
|
|
147
151
|
this.position
|
|
148
152
|
);
|
|
149
153
|
const s = [...this._path, e];
|
|
150
|
-
return
|
|
154
|
+
return M(new U(t[e], s, this.root), s);
|
|
151
155
|
}
|
|
152
156
|
/**
|
|
153
157
|
* Get the first child.
|
|
@@ -160,7 +164,7 @@ class F {
|
|
|
160
164
|
*/
|
|
161
165
|
last() {
|
|
162
166
|
if (!("children" in this.node))
|
|
163
|
-
return
|
|
167
|
+
return $("type", "Node has no children", this._path, this.position);
|
|
164
168
|
const e = this.node.children;
|
|
165
169
|
return this.child(e.length - 1);
|
|
166
170
|
}
|
|
@@ -236,12 +240,12 @@ class F {
|
|
|
236
240
|
}
|
|
237
241
|
i && o.push(a);
|
|
238
242
|
}
|
|
239
|
-
return o.length === 0 ?
|
|
243
|
+
return o.length === 0 ? $(
|
|
240
244
|
"missing",
|
|
241
245
|
`Section "${e}" not found`,
|
|
242
246
|
this._path,
|
|
243
247
|
this.position
|
|
244
|
-
) :
|
|
248
|
+
) : M(o, this._path);
|
|
245
249
|
}
|
|
246
250
|
// ---------------------------------------------------------------------------
|
|
247
251
|
// TYPED EXTRACTORS
|
|
@@ -251,14 +255,14 @@ class F {
|
|
|
251
255
|
*/
|
|
252
256
|
asHeading() {
|
|
253
257
|
if (this.node.type !== "heading")
|
|
254
|
-
return
|
|
258
|
+
return $(
|
|
255
259
|
"type",
|
|
256
260
|
`Expected heading, got ${this.nodeType}`,
|
|
257
261
|
this._path,
|
|
258
262
|
this.position
|
|
259
263
|
);
|
|
260
264
|
const e = this.node;
|
|
261
|
-
return
|
|
265
|
+
return M(
|
|
262
266
|
{
|
|
263
267
|
depth: e.depth,
|
|
264
268
|
text: this.extractText(e),
|
|
@@ -272,14 +276,14 @@ class F {
|
|
|
272
276
|
*/
|
|
273
277
|
asCodeBlock() {
|
|
274
278
|
if (this.node.type !== "code")
|
|
275
|
-
return
|
|
279
|
+
return $(
|
|
276
280
|
"type",
|
|
277
281
|
`Expected code, got ${this.nodeType}`,
|
|
278
282
|
this._path,
|
|
279
283
|
this.position
|
|
280
284
|
);
|
|
281
285
|
const e = this.node;
|
|
282
|
-
return
|
|
286
|
+
return M(
|
|
283
287
|
{
|
|
284
288
|
lang: e.lang ?? void 0,
|
|
285
289
|
meta: e.meta ?? void 0,
|
|
@@ -294,14 +298,14 @@ class F {
|
|
|
294
298
|
*/
|
|
295
299
|
asInlineCode() {
|
|
296
300
|
if (this.node.type !== "inlineCode")
|
|
297
|
-
return
|
|
301
|
+
return $(
|
|
298
302
|
"type",
|
|
299
303
|
`Expected inlineCode, got ${this.nodeType}`,
|
|
300
304
|
this._path,
|
|
301
305
|
this.position
|
|
302
306
|
);
|
|
303
307
|
const e = this.node;
|
|
304
|
-
return
|
|
308
|
+
return M(
|
|
305
309
|
{
|
|
306
310
|
value: e.value,
|
|
307
311
|
position: this.position
|
|
@@ -314,14 +318,14 @@ class F {
|
|
|
314
318
|
*/
|
|
315
319
|
asLink() {
|
|
316
320
|
if (this.node.type !== "link")
|
|
317
|
-
return
|
|
321
|
+
return $(
|
|
318
322
|
"type",
|
|
319
323
|
`Expected link, got ${this.nodeType}`,
|
|
320
324
|
this._path,
|
|
321
325
|
this.position
|
|
322
326
|
);
|
|
323
327
|
const e = this.node;
|
|
324
|
-
return
|
|
328
|
+
return M(
|
|
325
329
|
{
|
|
326
330
|
url: e.url,
|
|
327
331
|
title: e.title ?? void 0,
|
|
@@ -336,14 +340,14 @@ class F {
|
|
|
336
340
|
*/
|
|
337
341
|
asImage() {
|
|
338
342
|
if (this.node.type !== "image")
|
|
339
|
-
return
|
|
343
|
+
return $(
|
|
340
344
|
"type",
|
|
341
345
|
`Expected image, got ${this.nodeType}`,
|
|
342
346
|
this._path,
|
|
343
347
|
this.position
|
|
344
348
|
);
|
|
345
349
|
const e = this.node;
|
|
346
|
-
return
|
|
350
|
+
return M(
|
|
347
351
|
{
|
|
348
352
|
url: e.url,
|
|
349
353
|
alt: e.alt ?? void 0,
|
|
@@ -358,14 +362,14 @@ class F {
|
|
|
358
362
|
*/
|
|
359
363
|
asList() {
|
|
360
364
|
if (this.node.type !== "list")
|
|
361
|
-
return
|
|
365
|
+
return $(
|
|
362
366
|
"type",
|
|
363
367
|
`Expected list, got ${this.nodeType}`,
|
|
364
368
|
this._path,
|
|
365
369
|
this.position
|
|
366
370
|
);
|
|
367
371
|
const e = this.node, t = e.children.map((s) => this.extractListItem(s));
|
|
368
|
-
return
|
|
372
|
+
return M(
|
|
369
373
|
{
|
|
370
374
|
ordered: e.ordered ?? !1,
|
|
371
375
|
start: e.start ?? void 0,
|
|
@@ -380,7 +384,7 @@ class F {
|
|
|
380
384
|
*/
|
|
381
385
|
asTable() {
|
|
382
386
|
if (this.node.type !== "table")
|
|
383
|
-
return
|
|
387
|
+
return $(
|
|
384
388
|
"type",
|
|
385
389
|
`Expected table, got ${this.nodeType}`,
|
|
386
390
|
this._path,
|
|
@@ -390,7 +394,7 @@ class F {
|
|
|
390
394
|
text: this.extractText(l),
|
|
391
395
|
align: t[c] ?? void 0
|
|
392
396
|
})) })), [i, ...r] = s;
|
|
393
|
-
return
|
|
397
|
+
return M(
|
|
394
398
|
{
|
|
395
399
|
headers: i?.cells ?? [],
|
|
396
400
|
rows: r,
|
|
@@ -404,14 +408,14 @@ class F {
|
|
|
404
408
|
*/
|
|
405
409
|
asBlockquote() {
|
|
406
410
|
if (this.node.type !== "blockquote")
|
|
407
|
-
return
|
|
411
|
+
return $(
|
|
408
412
|
"type",
|
|
409
413
|
`Expected blockquote, got ${this.nodeType}`,
|
|
410
414
|
this._path,
|
|
411
415
|
this.position
|
|
412
416
|
);
|
|
413
417
|
const e = this.node;
|
|
414
|
-
return
|
|
418
|
+
return M(
|
|
415
419
|
{
|
|
416
420
|
text: this.extractText(e),
|
|
417
421
|
position: this.position
|
|
@@ -424,14 +428,14 @@ class F {
|
|
|
424
428
|
*/
|
|
425
429
|
asParagraph() {
|
|
426
430
|
if (this.node.type !== "paragraph")
|
|
427
|
-
return
|
|
431
|
+
return $(
|
|
428
432
|
"type",
|
|
429
433
|
`Expected paragraph, got ${this.nodeType}`,
|
|
430
434
|
this._path,
|
|
431
435
|
this.position
|
|
432
436
|
);
|
|
433
437
|
const e = this.node;
|
|
434
|
-
return
|
|
438
|
+
return M(
|
|
435
439
|
{
|
|
436
440
|
text: this.extractText(e),
|
|
437
441
|
position: this.position
|
|
@@ -444,14 +448,14 @@ class F {
|
|
|
444
448
|
*/
|
|
445
449
|
asDefinition() {
|
|
446
450
|
if (this.node.type !== "definition")
|
|
447
|
-
return
|
|
451
|
+
return $(
|
|
448
452
|
"type",
|
|
449
453
|
`Expected definition, got ${this.nodeType}`,
|
|
450
454
|
this._path,
|
|
451
455
|
this.position
|
|
452
456
|
);
|
|
453
457
|
const e = this.node;
|
|
454
|
-
return
|
|
458
|
+
return M(
|
|
455
459
|
{
|
|
456
460
|
identifier: e.identifier,
|
|
457
461
|
url: e.url,
|
|
@@ -533,24 +537,88 @@ class F {
|
|
|
533
537
|
};
|
|
534
538
|
}
|
|
535
539
|
}
|
|
536
|
-
function
|
|
540
|
+
function Ye(n, e) {
|
|
541
|
+
return { kind: "extract", format: "markdown", steps: n, extract: e };
|
|
542
|
+
}
|
|
543
|
+
class V {
|
|
544
|
+
/** @internal */
|
|
545
|
+
constructor(e) {
|
|
546
|
+
this.steps = e;
|
|
547
|
+
}
|
|
548
|
+
/** Select a single node matching a CSS-like selector */
|
|
549
|
+
select(e) {
|
|
550
|
+
return new V([...this.steps, { kind: "select", selector: e }]);
|
|
551
|
+
}
|
|
552
|
+
/** Select the nth node matching a CSS-like selector */
|
|
553
|
+
selectAt(e, t) {
|
|
554
|
+
return new V([
|
|
555
|
+
...this.steps,
|
|
556
|
+
{ kind: "selectAll", selector: e, index: t }
|
|
557
|
+
]);
|
|
558
|
+
}
|
|
559
|
+
/** Navigate to a child by index */
|
|
560
|
+
child(e) {
|
|
561
|
+
return new V([...this.steps, { kind: "child", index: e }]);
|
|
562
|
+
}
|
|
563
|
+
/** Navigate to the first child */
|
|
564
|
+
first() {
|
|
565
|
+
return new V([...this.steps, { kind: "first" }]);
|
|
566
|
+
}
|
|
567
|
+
/** Navigate to the last child */
|
|
568
|
+
last() {
|
|
569
|
+
return new V([...this.steps, { kind: "last" }]);
|
|
570
|
+
}
|
|
571
|
+
/** Extract text content */
|
|
572
|
+
text() {
|
|
573
|
+
return Ye(this.steps, "text");
|
|
574
|
+
}
|
|
575
|
+
/** Select all matching nodes, mapping each to a spec */
|
|
576
|
+
selectAll(e, t) {
|
|
577
|
+
const s = t(new V([]));
|
|
578
|
+
return {
|
|
579
|
+
kind: "array",
|
|
580
|
+
source: Ye(this.steps, { kind: "selectAll", selector: e }),
|
|
581
|
+
items: s
|
|
582
|
+
};
|
|
583
|
+
}
|
|
584
|
+
/** Iterate over direct children, mapping each to a spec */
|
|
585
|
+
children(e) {
|
|
586
|
+
const t = e(new V([]));
|
|
587
|
+
return {
|
|
588
|
+
kind: "array",
|
|
589
|
+
source: Ye(this.steps, { kind: "children" }),
|
|
590
|
+
items: t
|
|
591
|
+
};
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
class lt extends V {
|
|
595
|
+
constructor(e) {
|
|
596
|
+
super(e);
|
|
597
|
+
}
|
|
598
|
+
/** Create a root spec builder */
|
|
599
|
+
static root() {
|
|
600
|
+
return new lt([]);
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
function zn(n) {
|
|
537
604
|
return {
|
|
538
605
|
kind: "transform",
|
|
539
606
|
namespace: "@origints/markdown",
|
|
540
607
|
name: "parseMarkdown",
|
|
541
|
-
args: n
|
|
608
|
+
args: n,
|
|
609
|
+
specBuilderFactory: () => lt.root()
|
|
542
610
|
};
|
|
543
611
|
}
|
|
544
|
-
function
|
|
612
|
+
function qt(n = {}) {
|
|
545
613
|
const {
|
|
546
614
|
gfm: e = !0,
|
|
547
615
|
frontmatter: t = !0,
|
|
548
616
|
frontmatterFormats: s = ["yaml", "toml"]
|
|
549
617
|
} = n;
|
|
550
|
-
let i =
|
|
551
|
-
return e && (i = i.use(
|
|
618
|
+
let i = ot().use(Kt);
|
|
619
|
+
return e && (i = i.use(at)), t && (i = i.use($s, s)), i;
|
|
552
620
|
}
|
|
553
|
-
async function
|
|
621
|
+
async function Es(n) {
|
|
554
622
|
const e = n.getReader(), t = new TextDecoder();
|
|
555
623
|
let s = "";
|
|
556
624
|
for (; ; ) {
|
|
@@ -560,7 +628,7 @@ async function ks(n) {
|
|
|
560
628
|
}
|
|
561
629
|
return s += t.decode(), s;
|
|
562
630
|
}
|
|
563
|
-
const
|
|
631
|
+
const Zn = {
|
|
564
632
|
namespace: "@origints/markdown",
|
|
565
633
|
name: "parseMarkdown",
|
|
566
634
|
execute(n, e) {
|
|
@@ -568,10 +636,10 @@ const Ss = {
|
|
|
568
636
|
throw new TypeError(
|
|
569
637
|
`parseMarkdown expects a string input, got ${typeof n}`
|
|
570
638
|
);
|
|
571
|
-
const s =
|
|
572
|
-
return
|
|
639
|
+
const s = qt(e).parse(n);
|
|
640
|
+
return U.fromRoot(s);
|
|
573
641
|
}
|
|
574
|
-
},
|
|
642
|
+
}, Ls = {
|
|
575
643
|
namespace: "@origints/markdown",
|
|
576
644
|
name: "parseMarkdown",
|
|
577
645
|
async execute(n, e) {
|
|
@@ -579,20 +647,111 @@ const Ss = {
|
|
|
579
647
|
if (typeof n == "string")
|
|
580
648
|
t = n;
|
|
581
649
|
else if (n instanceof ReadableStream)
|
|
582
|
-
t = await
|
|
650
|
+
t = await Es(n);
|
|
651
|
+
else if (n instanceof Uint8Array)
|
|
652
|
+
t = new TextDecoder().decode(n);
|
|
653
|
+
else if (n instanceof ArrayBuffer)
|
|
654
|
+
t = new TextDecoder().decode(n);
|
|
583
655
|
else
|
|
584
656
|
throw new TypeError(
|
|
585
|
-
`parseMarkdown expects a string or
|
|
657
|
+
`parseMarkdown expects a string, stream, Uint8Array, or ArrayBuffer input, got ${typeof n}`
|
|
586
658
|
);
|
|
587
|
-
const i =
|
|
588
|
-
return
|
|
659
|
+
const i = qt(e).parse(t);
|
|
660
|
+
return U.fromRoot(i);
|
|
589
661
|
}
|
|
590
|
-
}
|
|
591
|
-
function
|
|
662
|
+
};
|
|
663
|
+
function Ge(n) {
|
|
664
|
+
return { ok: !0, value: n, path: [] };
|
|
665
|
+
}
|
|
666
|
+
function q(n) {
|
|
667
|
+
return { ok: !1, kind: "format", message: n, path: [] };
|
|
668
|
+
}
|
|
669
|
+
function vs(n, e) {
|
|
670
|
+
if (n.kind !== "extract" || n.format !== "markdown")
|
|
671
|
+
return q(
|
|
672
|
+
`Expected extract spec with format "markdown", got kind="${n.kind}" format="${n.format}"`
|
|
673
|
+
);
|
|
674
|
+
let t = e;
|
|
675
|
+
for (const i of n.steps)
|
|
676
|
+
switch (i.kind) {
|
|
677
|
+
case "select": {
|
|
678
|
+
const r = t.select(i.selector);
|
|
679
|
+
if (!r.ok)
|
|
680
|
+
return q(
|
|
681
|
+
`Markdown navigation failed at select("${i.selector}"): ${r.failure.message}`
|
|
682
|
+
);
|
|
683
|
+
t = r.value;
|
|
684
|
+
break;
|
|
685
|
+
}
|
|
686
|
+
case "selectAll": {
|
|
687
|
+
const r = t.selectAll(i.selector);
|
|
688
|
+
if (!r.ok)
|
|
689
|
+
return q(
|
|
690
|
+
`Markdown navigation failed at selectAll("${i.selector}"): ${r.failure.message}`
|
|
691
|
+
);
|
|
692
|
+
if (i.index < 0 || i.index >= r.value.length)
|
|
693
|
+
return q(
|
|
694
|
+
`Markdown selectAll("${i.selector}") index ${i.index} out of bounds (found ${r.value.length})`
|
|
695
|
+
);
|
|
696
|
+
t = r.value[i.index];
|
|
697
|
+
break;
|
|
698
|
+
}
|
|
699
|
+
case "child": {
|
|
700
|
+
const r = t.child(i.index);
|
|
701
|
+
if (!r.ok)
|
|
702
|
+
return q(
|
|
703
|
+
`Markdown navigation failed at child(${i.index}): ${r.failure.message}`
|
|
704
|
+
);
|
|
705
|
+
t = r.value;
|
|
706
|
+
break;
|
|
707
|
+
}
|
|
708
|
+
case "first": {
|
|
709
|
+
const r = t.first();
|
|
710
|
+
if (!r.ok)
|
|
711
|
+
return q(
|
|
712
|
+
`Markdown navigation failed at first(): ${r.failure.message}`
|
|
713
|
+
);
|
|
714
|
+
t = r.value;
|
|
715
|
+
break;
|
|
716
|
+
}
|
|
717
|
+
case "last": {
|
|
718
|
+
const r = t.last();
|
|
719
|
+
if (!r.ok)
|
|
720
|
+
return q(
|
|
721
|
+
`Markdown navigation failed at last(): ${r.failure.message}`
|
|
722
|
+
);
|
|
723
|
+
t = r.value;
|
|
724
|
+
break;
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
const s = n.extract;
|
|
728
|
+
if (typeof s == "string")
|
|
729
|
+
return s === "text" ? Ge(t.text()) : q(`Unknown Markdown extract type: ${s}`);
|
|
730
|
+
switch (s.kind) {
|
|
731
|
+
case "selectAll": {
|
|
732
|
+
const i = t.selectAll(s.selector);
|
|
733
|
+
return i.ok ? Ge(i.value) : q(
|
|
734
|
+
`Markdown selectAll("${s.selector}") failed: ${i.failure.message}`
|
|
735
|
+
);
|
|
736
|
+
}
|
|
737
|
+
case "children": {
|
|
738
|
+
const i = t.children();
|
|
739
|
+
return i.ok ? Ge(i.value) : q(
|
|
740
|
+
`Markdown children() failed: ${i.failure.message}`
|
|
741
|
+
);
|
|
742
|
+
}
|
|
743
|
+
default:
|
|
744
|
+
return q(
|
|
745
|
+
`Unknown Markdown extract kind: ${s.kind}`
|
|
746
|
+
);
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
const ct = /* @__PURE__ */ Symbol.for("yaml.alias"), et = /* @__PURE__ */ Symbol.for("yaml.document"), Q = /* @__PURE__ */ Symbol.for("yaml.map"), Rt = /* @__PURE__ */ Symbol.for("yaml.pair"), x = /* @__PURE__ */ Symbol.for("yaml.scalar"), ue = /* @__PURE__ */ Symbol.for("yaml.seq"), j = /* @__PURE__ */ Symbol.for("yaml.node.type"), ee = (n) => !!n && typeof n == "object" && n[j] === ct, Ke = (n) => !!n && typeof n == "object" && n[j] === et, Ne = (n) => !!n && typeof n == "object" && n[j] === Q, v = (n) => !!n && typeof n == "object" && n[j] === Rt, I = (n) => !!n && typeof n == "object" && n[j] === x, Te = (n) => !!n && typeof n == "object" && n[j] === ue;
|
|
750
|
+
function E(n) {
|
|
592
751
|
if (n && typeof n == "object")
|
|
593
752
|
switch (n[j]) {
|
|
594
|
-
case
|
|
595
|
-
case
|
|
753
|
+
case Q:
|
|
754
|
+
case ue:
|
|
596
755
|
return !0;
|
|
597
756
|
}
|
|
598
757
|
return !1;
|
|
@@ -600,54 +759,54 @@ function $(n) {
|
|
|
600
759
|
function L(n) {
|
|
601
760
|
if (n && typeof n == "object")
|
|
602
761
|
switch (n[j]) {
|
|
603
|
-
case
|
|
604
|
-
case
|
|
605
|
-
case
|
|
606
|
-
case
|
|
762
|
+
case ct:
|
|
763
|
+
case Q:
|
|
764
|
+
case x:
|
|
765
|
+
case ue:
|
|
607
766
|
return !0;
|
|
608
767
|
}
|
|
609
768
|
return !1;
|
|
610
769
|
}
|
|
611
|
-
const
|
|
612
|
-
function
|
|
613
|
-
const t =
|
|
614
|
-
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
function
|
|
620
|
-
const i =
|
|
621
|
-
if (L(i) ||
|
|
622
|
-
return
|
|
770
|
+
const Ft = (n) => (I(n) || E(n)) && !!n.anchor, W = /* @__PURE__ */ Symbol("break visit"), Cs = /* @__PURE__ */ Symbol("skip children"), be = /* @__PURE__ */ Symbol("remove node");
|
|
771
|
+
function he(n, e) {
|
|
772
|
+
const t = _s(e);
|
|
773
|
+
Ke(n) ? ie(null, n.contents, t, Object.freeze([n])) === be && (n.contents = null) : ie(null, n, t, Object.freeze([]));
|
|
774
|
+
}
|
|
775
|
+
he.BREAK = W;
|
|
776
|
+
he.SKIP = Cs;
|
|
777
|
+
he.REMOVE = be;
|
|
778
|
+
function ie(n, e, t, s) {
|
|
779
|
+
const i = Ms(n, e, t, s);
|
|
780
|
+
if (L(i) || v(i))
|
|
781
|
+
return Bs(n, s, i), ie(n, i, t, s);
|
|
623
782
|
if (typeof i != "symbol") {
|
|
624
|
-
if (
|
|
783
|
+
if (E(e)) {
|
|
625
784
|
s = Object.freeze(s.concat(e));
|
|
626
785
|
for (let r = 0; r < e.items.length; ++r) {
|
|
627
|
-
const o =
|
|
786
|
+
const o = ie(r, e.items[r], t, s);
|
|
628
787
|
if (typeof o == "number")
|
|
629
788
|
r = o - 1;
|
|
630
789
|
else {
|
|
631
|
-
if (o ===
|
|
632
|
-
return
|
|
633
|
-
o ===
|
|
790
|
+
if (o === W)
|
|
791
|
+
return W;
|
|
792
|
+
o === be && (e.items.splice(r, 1), r -= 1);
|
|
634
793
|
}
|
|
635
794
|
}
|
|
636
|
-
} else if (
|
|
795
|
+
} else if (v(e)) {
|
|
637
796
|
s = Object.freeze(s.concat(e));
|
|
638
|
-
const r =
|
|
639
|
-
if (r ===
|
|
640
|
-
return
|
|
641
|
-
r ===
|
|
642
|
-
const o =
|
|
643
|
-
if (o ===
|
|
644
|
-
return
|
|
645
|
-
o ===
|
|
797
|
+
const r = ie("key", e.key, t, s);
|
|
798
|
+
if (r === W)
|
|
799
|
+
return W;
|
|
800
|
+
r === be && (e.key = null);
|
|
801
|
+
const o = ie("value", e.value, t, s);
|
|
802
|
+
if (o === W)
|
|
803
|
+
return W;
|
|
804
|
+
o === be && (e.value = null);
|
|
646
805
|
}
|
|
647
806
|
}
|
|
648
807
|
return i;
|
|
649
808
|
}
|
|
650
|
-
function
|
|
809
|
+
function _s(n) {
|
|
651
810
|
return typeof n == "object" && (n.Collection || n.Node || n.Value) ? Object.assign({
|
|
652
811
|
Alias: n.Node,
|
|
653
812
|
Map: n.Node,
|
|
@@ -662,47 +821,47 @@ function Ts(n) {
|
|
|
662
821
|
Seq: n.Collection
|
|
663
822
|
}, n) : n;
|
|
664
823
|
}
|
|
665
|
-
function
|
|
824
|
+
function Ms(n, e, t, s) {
|
|
666
825
|
if (typeof t == "function")
|
|
667
826
|
return t(n, e, s);
|
|
668
|
-
if (
|
|
827
|
+
if (Ne(e))
|
|
669
828
|
return t.Map?.(n, e, s);
|
|
670
|
-
if (
|
|
829
|
+
if (Te(e))
|
|
671
830
|
return t.Seq?.(n, e, s);
|
|
672
|
-
if (
|
|
831
|
+
if (v(e))
|
|
673
832
|
return t.Pair?.(n, e, s);
|
|
674
833
|
if (I(e))
|
|
675
834
|
return t.Scalar?.(n, e, s);
|
|
676
|
-
if (
|
|
835
|
+
if (ee(e))
|
|
677
836
|
return t.Alias?.(n, e, s);
|
|
678
837
|
}
|
|
679
|
-
function
|
|
838
|
+
function Bs(n, e, t) {
|
|
680
839
|
const s = e[e.length - 1];
|
|
681
|
-
if (
|
|
840
|
+
if (E(s))
|
|
682
841
|
s.items[n] = t;
|
|
683
|
-
else if (
|
|
842
|
+
else if (v(s))
|
|
684
843
|
n === "key" ? s.key = t : s.value = t;
|
|
685
|
-
else if (
|
|
844
|
+
else if (Ke(s))
|
|
686
845
|
s.contents = t;
|
|
687
846
|
else {
|
|
688
|
-
const i =
|
|
847
|
+
const i = ee(s) ? "alias" : "scalar";
|
|
689
848
|
throw new Error(`Cannot replace node with ${i} parent`);
|
|
690
849
|
}
|
|
691
850
|
}
|
|
692
|
-
const
|
|
851
|
+
const Ps = {
|
|
693
852
|
"!": "%21",
|
|
694
853
|
",": "%2C",
|
|
695
854
|
"[": "%5B",
|
|
696
855
|
"]": "%5D",
|
|
697
856
|
"{": "%7B",
|
|
698
857
|
"}": "%7D"
|
|
699
|
-
},
|
|
700
|
-
class
|
|
858
|
+
}, Ks = (n) => n.replace(/[!,[\]{}]/g, (e) => Ps[e]);
|
|
859
|
+
class B {
|
|
701
860
|
constructor(e, t) {
|
|
702
|
-
this.docStart = null, this.docEnd = !1, this.yaml = Object.assign({},
|
|
861
|
+
this.docStart = null, this.docEnd = !1, this.yaml = Object.assign({}, B.defaultYaml, e), this.tags = Object.assign({}, B.defaultTags, t);
|
|
703
862
|
}
|
|
704
863
|
clone() {
|
|
705
|
-
const e = new
|
|
864
|
+
const e = new B(this.yaml, this.tags);
|
|
706
865
|
return e.docStart = this.docStart, e;
|
|
707
866
|
}
|
|
708
867
|
/**
|
|
@@ -710,16 +869,16 @@ class M {
|
|
|
710
869
|
* update the stream state according to the current version's spec.
|
|
711
870
|
*/
|
|
712
871
|
atDocument() {
|
|
713
|
-
const e = new
|
|
872
|
+
const e = new B(this.yaml, this.tags);
|
|
714
873
|
switch (this.yaml.version) {
|
|
715
874
|
case "1.1":
|
|
716
875
|
this.atNextDocument = !0;
|
|
717
876
|
break;
|
|
718
877
|
case "1.2":
|
|
719
878
|
this.atNextDocument = !1, this.yaml = {
|
|
720
|
-
explicit:
|
|
879
|
+
explicit: B.defaultYaml.explicit,
|
|
721
880
|
version: "1.2"
|
|
722
|
-
}, this.tags = Object.assign({},
|
|
881
|
+
}, this.tags = Object.assign({}, B.defaultTags);
|
|
723
882
|
break;
|
|
724
883
|
}
|
|
725
884
|
return e;
|
|
@@ -729,7 +888,7 @@ class M {
|
|
|
729
888
|
* @returns `true` on success
|
|
730
889
|
*/
|
|
731
890
|
add(e, t) {
|
|
732
|
-
this.atNextDocument && (this.yaml = { explicit:
|
|
891
|
+
this.atNextDocument && (this.yaml = { explicit: B.defaultYaml.explicit, version: "1.1" }, this.tags = Object.assign({}, B.defaultTags), this.atNextDocument = !1);
|
|
733
892
|
const s = e.trim().split(/[ \t]+/), i = s.shift();
|
|
734
893
|
switch (i) {
|
|
735
894
|
case "%TAG": {
|
|
@@ -786,7 +945,7 @@ class M {
|
|
|
786
945
|
tagString(e) {
|
|
787
946
|
for (const [t, s] of Object.entries(this.tags))
|
|
788
947
|
if (e.startsWith(s))
|
|
789
|
-
return t +
|
|
948
|
+
return t + Ks(e.substring(s.length));
|
|
790
949
|
return e[0] === "!" ? e : `!<${e}>`;
|
|
791
950
|
}
|
|
792
951
|
toString(e) {
|
|
@@ -794,7 +953,7 @@ class M {
|
|
|
794
953
|
let i;
|
|
795
954
|
if (e && s.length > 0 && L(e.contents)) {
|
|
796
955
|
const r = {};
|
|
797
|
-
|
|
956
|
+
he(e.contents, (o, a) => {
|
|
798
957
|
L(a) && a.tag && (r[a.tag] = !0);
|
|
799
958
|
}), i = Object.keys(r);
|
|
800
959
|
} else
|
|
@@ -805,37 +964,37 @@ class M {
|
|
|
805
964
|
`);
|
|
806
965
|
}
|
|
807
966
|
}
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
function
|
|
967
|
+
B.defaultYaml = { explicit: !1, version: "1.2" };
|
|
968
|
+
B.defaultTags = { "!!": "tag:yaml.org,2002:" };
|
|
969
|
+
function Ut(n) {
|
|
811
970
|
if (/[\x00-\x19\s,[\]{}]/.test(n)) {
|
|
812
971
|
const t = `Anchor must not contain whitespace or control characters: ${JSON.stringify(n)}`;
|
|
813
972
|
throw new Error(t);
|
|
814
973
|
}
|
|
815
974
|
return !0;
|
|
816
975
|
}
|
|
817
|
-
function
|
|
976
|
+
function xt(n) {
|
|
818
977
|
const e = /* @__PURE__ */ new Set();
|
|
819
|
-
return
|
|
978
|
+
return he(n, {
|
|
820
979
|
Value(t, s) {
|
|
821
980
|
s.anchor && e.add(s.anchor);
|
|
822
981
|
}
|
|
823
982
|
}), e;
|
|
824
983
|
}
|
|
825
|
-
function
|
|
984
|
+
function Vt(n, e) {
|
|
826
985
|
for (let t = 1; ; ++t) {
|
|
827
986
|
const s = `${n}${t}`;
|
|
828
987
|
if (!e.has(s))
|
|
829
988
|
return s;
|
|
830
989
|
}
|
|
831
990
|
}
|
|
832
|
-
function
|
|
991
|
+
function Ds(n, e) {
|
|
833
992
|
const t = [], s = /* @__PURE__ */ new Map();
|
|
834
993
|
let i = null;
|
|
835
994
|
return {
|
|
836
995
|
onAnchor: (r) => {
|
|
837
|
-
t.push(r), i ?? (i =
|
|
838
|
-
const o =
|
|
996
|
+
t.push(r), i ?? (i = xt(n));
|
|
997
|
+
const o = Vt(e, i);
|
|
839
998
|
return i.add(o), o;
|
|
840
999
|
},
|
|
841
1000
|
/**
|
|
@@ -846,7 +1005,7 @@ function Ls(n, e) {
|
|
|
846
1005
|
setAnchors: () => {
|
|
847
1006
|
for (const r of t) {
|
|
848
1007
|
const o = s.get(r);
|
|
849
|
-
if (typeof o == "object" && o.anchor && (I(o.node) ||
|
|
1008
|
+
if (typeof o == "object" && o.anchor && (I(o.node) || E(o.node)))
|
|
850
1009
|
o.node.anchor = o.anchor;
|
|
851
1010
|
else {
|
|
852
1011
|
const a = new Error("Failed to resolve repeated object (this should not happen)");
|
|
@@ -857,26 +1016,26 @@ function Ls(n, e) {
|
|
|
857
1016
|
sourceObjects: s
|
|
858
1017
|
};
|
|
859
1018
|
}
|
|
860
|
-
function
|
|
1019
|
+
function re(n, e, t, s) {
|
|
861
1020
|
if (s && typeof s == "object")
|
|
862
1021
|
if (Array.isArray(s))
|
|
863
1022
|
for (let i = 0, r = s.length; i < r; ++i) {
|
|
864
|
-
const o = s[i], a =
|
|
1023
|
+
const o = s[i], a = re(n, s, String(i), o);
|
|
865
1024
|
a === void 0 ? delete s[i] : a !== o && (s[i] = a);
|
|
866
1025
|
}
|
|
867
1026
|
else if (s instanceof Map)
|
|
868
1027
|
for (const i of Array.from(s.keys())) {
|
|
869
|
-
const r = s.get(i), o =
|
|
1028
|
+
const r = s.get(i), o = re(n, s, i, r);
|
|
870
1029
|
o === void 0 ? s.delete(i) : o !== r && s.set(i, o);
|
|
871
1030
|
}
|
|
872
1031
|
else if (s instanceof Set)
|
|
873
1032
|
for (const i of Array.from(s)) {
|
|
874
|
-
const r =
|
|
1033
|
+
const r = re(n, s, i, i);
|
|
875
1034
|
r === void 0 ? s.delete(i) : r !== i && (s.delete(i), s.add(r));
|
|
876
1035
|
}
|
|
877
1036
|
else
|
|
878
1037
|
for (const [i, r] of Object.entries(s)) {
|
|
879
|
-
const o =
|
|
1038
|
+
const o = re(n, s, i, r);
|
|
880
1039
|
o === void 0 ? delete s[i] : o !== r && (s[i] = o);
|
|
881
1040
|
}
|
|
882
1041
|
return n.call(e, t, s);
|
|
@@ -885,7 +1044,7 @@ function D(n, e, t) {
|
|
|
885
1044
|
if (Array.isArray(n))
|
|
886
1045
|
return n.map((s, i) => D(s, String(i), t));
|
|
887
1046
|
if (n && typeof n.toJSON == "function") {
|
|
888
|
-
if (!t || !
|
|
1047
|
+
if (!t || !Ft(n))
|
|
889
1048
|
return n.toJSON(e, t);
|
|
890
1049
|
const s = { aliasCount: 0, count: 1, res: void 0 };
|
|
891
1050
|
t.anchors.set(n, s), t.onCreate = (r) => {
|
|
@@ -896,7 +1055,7 @@ function D(n, e, t) {
|
|
|
896
1055
|
}
|
|
897
1056
|
return typeof n == "bigint" && !t?.keep ? Number(n) : n;
|
|
898
1057
|
}
|
|
899
|
-
class
|
|
1058
|
+
class ft {
|
|
900
1059
|
constructor(e) {
|
|
901
1060
|
Object.defineProperty(this, j, { value: e });
|
|
902
1061
|
}
|
|
@@ -907,7 +1066,7 @@ class rt {
|
|
|
907
1066
|
}
|
|
908
1067
|
/** A plain JavaScript representation of this node. */
|
|
909
1068
|
toJS(e, { mapAsMap: t, maxAliasCount: s, onAnchor: i, reviver: r } = {}) {
|
|
910
|
-
if (!
|
|
1069
|
+
if (!Ke(e))
|
|
911
1070
|
throw new TypeError("A document argument is required");
|
|
912
1071
|
const o = {
|
|
913
1072
|
anchors: /* @__PURE__ */ new Map(),
|
|
@@ -920,12 +1079,12 @@ class rt {
|
|
|
920
1079
|
if (typeof i == "function")
|
|
921
1080
|
for (const { count: l, res: c } of o.anchors.values())
|
|
922
1081
|
i(c, l);
|
|
923
|
-
return typeof r == "function" ?
|
|
1082
|
+
return typeof r == "function" ? re(r, { "": a }, "", a) : a;
|
|
924
1083
|
}
|
|
925
1084
|
}
|
|
926
|
-
class
|
|
1085
|
+
class ut extends ft {
|
|
927
1086
|
constructor(e) {
|
|
928
|
-
super(
|
|
1087
|
+
super(ct), this.source = e, Object.defineProperty(this, "tag", {
|
|
929
1088
|
set() {
|
|
930
1089
|
throw new Error("Alias nodes cannot have tags");
|
|
931
1090
|
}
|
|
@@ -937,9 +1096,9 @@ class ot extends rt {
|
|
|
937
1096
|
*/
|
|
938
1097
|
resolve(e, t) {
|
|
939
1098
|
let s;
|
|
940
|
-
t?.aliasResolveCache ? s = t.aliasResolveCache : (s = [],
|
|
1099
|
+
t?.aliasResolveCache ? s = t.aliasResolveCache : (s = [], he(e, {
|
|
941
1100
|
Node: (r, o) => {
|
|
942
|
-
(
|
|
1101
|
+
(ee(o) || Ft(o)) && s.push(o);
|
|
943
1102
|
}
|
|
944
1103
|
}), t && (t.aliasResolveCache = s));
|
|
945
1104
|
let i;
|
|
@@ -963,7 +1122,7 @@ class ot extends rt {
|
|
|
963
1122
|
const l = "This should not happen: Alias anchor was not resolved?";
|
|
964
1123
|
throw new ReferenceError(l);
|
|
965
1124
|
}
|
|
966
|
-
if (r >= 0 && (a.count += 1, a.aliasCount === 0 && (a.aliasCount =
|
|
1125
|
+
if (r >= 0 && (a.count += 1, a.aliasCount === 0 && (a.aliasCount = Ce(i, o, s)), a.count * a.aliasCount > r)) {
|
|
967
1126
|
const l = "Excessive alias count indicates a resource exhaustion attack";
|
|
968
1127
|
throw new ReferenceError(l);
|
|
969
1128
|
}
|
|
@@ -972,7 +1131,7 @@ class ot extends rt {
|
|
|
972
1131
|
toString(e, t, s) {
|
|
973
1132
|
const i = `*${this.source}`;
|
|
974
1133
|
if (e) {
|
|
975
|
-
if (
|
|
1134
|
+
if (Ut(this.source), e.options.verifyAliasOrder && !e.anchors.has(this.source)) {
|
|
976
1135
|
const r = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
|
|
977
1136
|
throw new Error(r);
|
|
978
1137
|
}
|
|
@@ -982,27 +1141,27 @@ class ot extends rt {
|
|
|
982
1141
|
return i;
|
|
983
1142
|
}
|
|
984
1143
|
}
|
|
985
|
-
function
|
|
986
|
-
if (
|
|
1144
|
+
function Ce(n, e, t) {
|
|
1145
|
+
if (ee(e)) {
|
|
987
1146
|
const s = e.resolve(n), i = t && s && t.get(s);
|
|
988
1147
|
return i ? i.count * i.aliasCount : 0;
|
|
989
|
-
} else if (
|
|
1148
|
+
} else if (E(e)) {
|
|
990
1149
|
let s = 0;
|
|
991
1150
|
for (const i of e.items) {
|
|
992
|
-
const r =
|
|
1151
|
+
const r = Ce(n, i, t);
|
|
993
1152
|
r > s && (s = r);
|
|
994
1153
|
}
|
|
995
1154
|
return s;
|
|
996
|
-
} else if (
|
|
997
|
-
const s =
|
|
1155
|
+
} else if (v(e)) {
|
|
1156
|
+
const s = Ce(n, e.key, t), i = Ce(n, e.value, t);
|
|
998
1157
|
return Math.max(s, i);
|
|
999
1158
|
}
|
|
1000
1159
|
return 1;
|
|
1001
1160
|
}
|
|
1002
|
-
const
|
|
1003
|
-
class
|
|
1161
|
+
const Jt = (n) => !n || typeof n != "function" && typeof n != "object";
|
|
1162
|
+
class T extends ft {
|
|
1004
1163
|
constructor(e) {
|
|
1005
|
-
super(
|
|
1164
|
+
super(x), this.value = e;
|
|
1006
1165
|
}
|
|
1007
1166
|
toJSON(e, t) {
|
|
1008
1167
|
return t?.keep ? this.value : D(this.value, e, t);
|
|
@@ -1011,13 +1170,13 @@ class O extends rt {
|
|
|
1011
1170
|
return String(this.value);
|
|
1012
1171
|
}
|
|
1013
1172
|
}
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
const
|
|
1020
|
-
function
|
|
1173
|
+
T.BLOCK_FOLDED = "BLOCK_FOLDED";
|
|
1174
|
+
T.BLOCK_LITERAL = "BLOCK_LITERAL";
|
|
1175
|
+
T.PLAIN = "PLAIN";
|
|
1176
|
+
T.QUOTE_DOUBLE = "QUOTE_DOUBLE";
|
|
1177
|
+
T.QUOTE_SINGLE = "QUOTE_SINGLE";
|
|
1178
|
+
const js = "tag:yaml.org,2002:";
|
|
1179
|
+
function qs(n, e, t) {
|
|
1021
1180
|
if (e) {
|
|
1022
1181
|
const s = t.filter((r) => r.tag === e), i = s.find((r) => !r.format) ?? s[0];
|
|
1023
1182
|
if (!i)
|
|
@@ -1026,11 +1185,11 @@ function Cs(n, e, t) {
|
|
|
1026
1185
|
}
|
|
1027
1186
|
return t.find((s) => s.identify?.(n) && !s.format);
|
|
1028
1187
|
}
|
|
1029
|
-
function
|
|
1030
|
-
if (
|
|
1188
|
+
function ke(n, e, t) {
|
|
1189
|
+
if (Ke(n) && (n = n.contents), L(n))
|
|
1031
1190
|
return n;
|
|
1032
|
-
if (
|
|
1033
|
-
const f = t.schema[
|
|
1191
|
+
if (v(n)) {
|
|
1192
|
+
const f = t.schema[Q].createNode?.(t.schema, null, t);
|
|
1034
1193
|
return f.items.push(n), f;
|
|
1035
1194
|
}
|
|
1036
1195
|
(n instanceof String || n instanceof Number || n instanceof Boolean || typeof BigInt < "u" && n instanceof BigInt) && (n = n.valueOf());
|
|
@@ -1038,23 +1197,23 @@ function be(n, e, t) {
|
|
|
1038
1197
|
let l;
|
|
1039
1198
|
if (s && n && typeof n == "object") {
|
|
1040
1199
|
if (l = a.get(n), l)
|
|
1041
|
-
return l.anchor ?? (l.anchor = i(n)), new
|
|
1200
|
+
return l.anchor ?? (l.anchor = i(n)), new ut(l.anchor);
|
|
1042
1201
|
l = { anchor: null, node: null }, a.set(n, l);
|
|
1043
1202
|
}
|
|
1044
|
-
e?.startsWith("!!") && (e =
|
|
1045
|
-
let c =
|
|
1203
|
+
e?.startsWith("!!") && (e = js + e.slice(2));
|
|
1204
|
+
let c = qs(n, e, o.tags);
|
|
1046
1205
|
if (!c) {
|
|
1047
1206
|
if (n && typeof n.toJSON == "function" && (n = n.toJSON()), !n || typeof n != "object") {
|
|
1048
|
-
const f = new
|
|
1207
|
+
const f = new T(n);
|
|
1049
1208
|
return l && (l.node = f), f;
|
|
1050
1209
|
}
|
|
1051
|
-
c = n instanceof Map ? o[
|
|
1210
|
+
c = n instanceof Map ? o[Q] : Symbol.iterator in Object(n) ? o[ue] : o[Q];
|
|
1052
1211
|
}
|
|
1053
1212
|
r && (r(c), delete t.onTagObj);
|
|
1054
|
-
const d = c?.createNode ? c.createNode(t.schema, n, t) : typeof c?.nodeClass?.from == "function" ? c.nodeClass.from(t.schema, n, t) : new
|
|
1213
|
+
const d = c?.createNode ? c.createNode(t.schema, n, t) : typeof c?.nodeClass?.from == "function" ? c.nodeClass.from(t.schema, n, t) : new T(n);
|
|
1055
1214
|
return e ? d.tag = e : c.default || (d.tag = c.tag), l && (l.node = d), d;
|
|
1056
1215
|
}
|
|
1057
|
-
function
|
|
1216
|
+
function Be(n, e, t) {
|
|
1058
1217
|
let s = t;
|
|
1059
1218
|
for (let i = e.length - 1; i >= 0; --i) {
|
|
1060
1219
|
const r = e[i];
|
|
@@ -1064,7 +1223,7 @@ function ve(n, e, t) {
|
|
|
1064
1223
|
} else
|
|
1065
1224
|
s = /* @__PURE__ */ new Map([[r, s]]);
|
|
1066
1225
|
}
|
|
1067
|
-
return
|
|
1226
|
+
return ke(s, void 0, {
|
|
1068
1227
|
aliasDuplicateObjects: !1,
|
|
1069
1228
|
keepUndefined: !1,
|
|
1070
1229
|
onAnchor: () => {
|
|
@@ -1074,8 +1233,8 @@ function ve(n, e, t) {
|
|
|
1074
1233
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
1075
1234
|
});
|
|
1076
1235
|
}
|
|
1077
|
-
const
|
|
1078
|
-
class
|
|
1236
|
+
const ge = (n) => n == null || typeof n == "object" && !!n[Symbol.iterator]().next().done;
|
|
1237
|
+
class Yt extends ft {
|
|
1079
1238
|
constructor(e, t) {
|
|
1080
1239
|
super(e), Object.defineProperty(this, "schema", {
|
|
1081
1240
|
value: t,
|
|
@@ -1091,7 +1250,7 @@ class Ft extends rt {
|
|
|
1091
1250
|
*/
|
|
1092
1251
|
clone(e) {
|
|
1093
1252
|
const t = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
|
|
1094
|
-
return e && (t.schema = e), t.items = t.items.map((s) => L(s) ||
|
|
1253
|
+
return e && (t.schema = e), t.items = t.items.map((s) => L(s) || v(s) ? s.clone(e) : s), this.range && (t.range = this.range.slice()), t;
|
|
1095
1254
|
}
|
|
1096
1255
|
/**
|
|
1097
1256
|
* Adds a value to the collection. For `!!map` and `!!omap` the value must
|
|
@@ -1099,14 +1258,14 @@ class Ft extends rt {
|
|
|
1099
1258
|
* that already exists in the map.
|
|
1100
1259
|
*/
|
|
1101
1260
|
addIn(e, t) {
|
|
1102
|
-
if (
|
|
1261
|
+
if (ge(e))
|
|
1103
1262
|
this.add(t);
|
|
1104
1263
|
else {
|
|
1105
1264
|
const [s, ...i] = e, r = this.get(s, !0);
|
|
1106
|
-
if (
|
|
1265
|
+
if (E(r))
|
|
1107
1266
|
r.addIn(i, t);
|
|
1108
1267
|
else if (r === void 0 && this.schema)
|
|
1109
|
-
this.set(s,
|
|
1268
|
+
this.set(s, Be(this.schema, i, t));
|
|
1110
1269
|
else
|
|
1111
1270
|
throw new Error(`Expected YAML collection at ${s}. Remaining path: ${i}`);
|
|
1112
1271
|
}
|
|
@@ -1120,7 +1279,7 @@ class Ft extends rt {
|
|
|
1120
1279
|
if (s.length === 0)
|
|
1121
1280
|
return this.delete(t);
|
|
1122
1281
|
const i = this.get(t, !0);
|
|
1123
|
-
if (
|
|
1282
|
+
if (E(i))
|
|
1124
1283
|
return i.deleteIn(s);
|
|
1125
1284
|
throw new Error(`Expected YAML collection at ${t}. Remaining path: ${s}`);
|
|
1126
1285
|
}
|
|
@@ -1131,11 +1290,11 @@ class Ft extends rt {
|
|
|
1131
1290
|
*/
|
|
1132
1291
|
getIn(e, t) {
|
|
1133
1292
|
const [s, ...i] = e, r = this.get(s, !0);
|
|
1134
|
-
return i.length === 0 ? !t && I(r) ? r.value : r :
|
|
1293
|
+
return i.length === 0 ? !t && I(r) ? r.value : r : E(r) ? r.getIn(i, t) : void 0;
|
|
1135
1294
|
}
|
|
1136
1295
|
hasAllNullValues(e) {
|
|
1137
1296
|
return this.items.every((t) => {
|
|
1138
|
-
if (!
|
|
1297
|
+
if (!v(t))
|
|
1139
1298
|
return !1;
|
|
1140
1299
|
const s = t.value;
|
|
1141
1300
|
return s == null || e && I(s) && s.value == null && !s.commentBefore && !s.comment && !s.tag;
|
|
@@ -1149,7 +1308,7 @@ class Ft extends rt {
|
|
|
1149
1308
|
if (s.length === 0)
|
|
1150
1309
|
return this.has(t);
|
|
1151
1310
|
const i = this.get(t, !0);
|
|
1152
|
-
return
|
|
1311
|
+
return E(i) ? i.hasIn(s) : !1;
|
|
1153
1312
|
}
|
|
1154
1313
|
/**
|
|
1155
1314
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
@@ -1161,24 +1320,24 @@ class Ft extends rt {
|
|
|
1161
1320
|
this.set(s, t);
|
|
1162
1321
|
else {
|
|
1163
1322
|
const r = this.get(s, !0);
|
|
1164
|
-
if (
|
|
1323
|
+
if (E(r))
|
|
1165
1324
|
r.setIn(i, t);
|
|
1166
1325
|
else if (r === void 0 && this.schema)
|
|
1167
|
-
this.set(s,
|
|
1326
|
+
this.set(s, Be(this.schema, i, t));
|
|
1168
1327
|
else
|
|
1169
1328
|
throw new Error(`Expected YAML collection at ${s}. Remaining path: ${i}`);
|
|
1170
1329
|
}
|
|
1171
1330
|
}
|
|
1172
1331
|
}
|
|
1173
|
-
const
|
|
1174
|
-
function
|
|
1332
|
+
const Rs = (n) => n.replace(/^(?!$)(?: $)?/gm, "#");
|
|
1333
|
+
function J(n, e) {
|
|
1175
1334
|
return /^\n+$/.test(n) ? n.substring(1) : e ? n.replace(/^(?! *$)/gm, e) : n;
|
|
1176
1335
|
}
|
|
1177
|
-
const
|
|
1178
|
-
`) ?
|
|
1336
|
+
const X = (n, e, t) => n.endsWith(`
|
|
1337
|
+
`) ? J(t, e) : t.includes(`
|
|
1179
1338
|
`) ? `
|
|
1180
|
-
` +
|
|
1181
|
-
function
|
|
1339
|
+
` + J(t, e) : (n.endsWith(" ") ? "" : " ") + t, Gt = "flow", tt = "block", _e = "quoted";
|
|
1340
|
+
function De(n, e, t = "flow", { indentAtStart: s, lineWidth: i = 80, minContentWidth: r = 20, onFold: o, onOverflow: a } = {}) {
|
|
1182
1341
|
if (!i || i < 0)
|
|
1183
1342
|
return n;
|
|
1184
1343
|
i < r && (r = 0);
|
|
@@ -1189,7 +1348,7 @@ function Pe(n, e, t = "flow", { indentAtStart: s, lineWidth: i = 80, minContentW
|
|
|
1189
1348
|
let f = i - e.length;
|
|
1190
1349
|
typeof s == "number" && (s > i - Math.max(2, r) ? c.push(0) : f = i - s);
|
|
1191
1350
|
let u, m, g = !1, h = -1, p = -1, b = -1;
|
|
1192
|
-
t ===
|
|
1351
|
+
t === tt && (h = Ot(n, h, e.length), h !== -1 && (f = h + l));
|
|
1193
1352
|
for (let k; k = n[h += 1]; ) {
|
|
1194
1353
|
if (t === _e && k === "\\") {
|
|
1195
1354
|
switch (p = h, n[h + 1]) {
|
|
@@ -1209,7 +1368,7 @@ function Pe(n, e, t = "flow", { indentAtStart: s, lineWidth: i = 80, minContentW
|
|
|
1209
1368
|
}
|
|
1210
1369
|
if (k === `
|
|
1211
1370
|
`)
|
|
1212
|
-
t ===
|
|
1371
|
+
t === tt && (h = Ot(n, h, e.length)), f = h + e.length + l, u = void 0;
|
|
1213
1372
|
else {
|
|
1214
1373
|
if (k === " " && m && m !== " " && m !== `
|
|
1215
1374
|
` && m !== " ") {
|
|
@@ -1244,7 +1403,7 @@ ${e}${n.slice(S + 1, N)}`);
|
|
|
1244
1403
|
}
|
|
1245
1404
|
return w;
|
|
1246
1405
|
}
|
|
1247
|
-
function
|
|
1406
|
+
function Ot(n, e, t) {
|
|
1248
1407
|
let s = e, i = e + 1, r = n[i];
|
|
1249
1408
|
for (; r === " " || r === " "; )
|
|
1250
1409
|
if (e < i + t)
|
|
@@ -1258,12 +1417,12 @@ function kt(n, e, t) {
|
|
|
1258
1417
|
}
|
|
1259
1418
|
return s;
|
|
1260
1419
|
}
|
|
1261
|
-
const
|
|
1420
|
+
const je = (n, e) => ({
|
|
1262
1421
|
indentAtStart: e ? n.indent.length : n.indentAtStart,
|
|
1263
1422
|
lineWidth: n.options.lineWidth,
|
|
1264
1423
|
minContentWidth: n.options.minContentWidth
|
|
1265
|
-
}),
|
|
1266
|
-
function
|
|
1424
|
+
}), qe = (n) => /^(%|---|\.\.\.)/m.test(n);
|
|
1425
|
+
function Fs(n, e, t) {
|
|
1267
1426
|
if (!e || e < 0)
|
|
1268
1427
|
return !1;
|
|
1269
1428
|
const s = e - t, i = n.length;
|
|
@@ -1279,11 +1438,11 @@ function Bs(n, e, t) {
|
|
|
1279
1438
|
}
|
|
1280
1439
|
return !0;
|
|
1281
1440
|
}
|
|
1282
|
-
function
|
|
1441
|
+
function we(n, e) {
|
|
1283
1442
|
const t = JSON.stringify(n);
|
|
1284
1443
|
if (e.options.doubleQuotedAsJSON)
|
|
1285
1444
|
return t;
|
|
1286
|
-
const { implicitKey: s } = e, i = e.options.doubleQuotedMinMultiLineLength, r = e.indent || (
|
|
1445
|
+
const { implicitKey: s } = e, i = e.options.doubleQuotedMinMultiLineLength, r = e.indent || (qe(n) ? " " : "");
|
|
1287
1446
|
let o = "", a = 0;
|
|
1288
1447
|
for (let l = 0, c = t[l]; c; c = t[++l])
|
|
1289
1448
|
if (c === " " && t[l + 1] === "\\" && t[l + 2] === "n" && (o += t.slice(a, l) + "\\ ", l += 1, a = l, c = "\\"), c === "\\")
|
|
@@ -1338,41 +1497,41 @@ function ye(n, e) {
|
|
|
1338
1497
|
default:
|
|
1339
1498
|
l += 1;
|
|
1340
1499
|
}
|
|
1341
|
-
return o = a ? o + t.slice(a) : t, s ? o :
|
|
1500
|
+
return o = a ? o + t.slice(a) : t, s ? o : De(o, r, _e, je(e, !1));
|
|
1342
1501
|
}
|
|
1343
|
-
function
|
|
1502
|
+
function st(n, e) {
|
|
1344
1503
|
if (e.options.singleQuote === !1 || e.implicitKey && n.includes(`
|
|
1345
1504
|
`) || /[ \t]\n|\n[ \t]/.test(n))
|
|
1346
|
-
return
|
|
1347
|
-
const t = e.indent || (
|
|
1505
|
+
return we(n, e);
|
|
1506
|
+
const t = e.indent || (qe(n) ? " " : ""), s = "'" + n.replace(/'/g, "''").replace(/\n+/g, `$&
|
|
1348
1507
|
${t}`) + "'";
|
|
1349
|
-
return e.implicitKey ? s :
|
|
1508
|
+
return e.implicitKey ? s : De(s, t, Gt, je(e, !1));
|
|
1350
1509
|
}
|
|
1351
|
-
function
|
|
1510
|
+
function oe(n, e) {
|
|
1352
1511
|
const { singleQuote: t } = e.options;
|
|
1353
1512
|
let s;
|
|
1354
1513
|
if (t === !1)
|
|
1355
|
-
s =
|
|
1514
|
+
s = we;
|
|
1356
1515
|
else {
|
|
1357
1516
|
const i = n.includes('"'), r = n.includes("'");
|
|
1358
|
-
i && !r ? s =
|
|
1517
|
+
i && !r ? s = st : r && !i ? s = we : s = t ? st : we;
|
|
1359
1518
|
}
|
|
1360
1519
|
return s(n, e);
|
|
1361
1520
|
}
|
|
1362
|
-
let
|
|
1521
|
+
let nt;
|
|
1363
1522
|
try {
|
|
1364
|
-
|
|
1523
|
+
nt = new RegExp(`(^|(?<!
|
|
1365
1524
|
))
|
|
1366
1525
|
+(?!
|
|
1367
1526
|
|$)`, "g");
|
|
1368
1527
|
} catch {
|
|
1369
|
-
|
|
1528
|
+
nt = /\n+(?!\n|$)/g;
|
|
1370
1529
|
}
|
|
1371
|
-
function
|
|
1530
|
+
function Me({ comment: n, type: e, value: t }, s, i, r) {
|
|
1372
1531
|
const { blockQuote: o, commentString: a, lineWidth: l } = s.options;
|
|
1373
1532
|
if (!o || /\n[\t ]+$/.test(t))
|
|
1374
|
-
return
|
|
1375
|
-
const c = s.indent || (s.forceBlockIndent ||
|
|
1533
|
+
return oe(t, s);
|
|
1534
|
+
const c = s.indent || (s.forceBlockIndent || qe(t) ? " " : ""), d = o === "literal" ? !0 : o === "folded" || e === T.BLOCK_FOLDED ? !1 : e === T.BLOCK_LITERAL ? !0 : !Fs(t, l, c.length);
|
|
1376
1535
|
if (!t)
|
|
1377
1536
|
return d ? `|
|
|
1378
1537
|
` : `>
|
|
@@ -1388,7 +1547,7 @@ function Ce({ comment: n, type: e, value: t }, s, i, r) {
|
|
|
1388
1547
|
const g = m.indexOf(`
|
|
1389
1548
|
`);
|
|
1390
1549
|
g === -1 ? f = "-" : t === m || g !== m.length - 1 ? (f = "+", r && r()) : f = "", m && (t = t.slice(0, -m.length), m[m.length - 1] === `
|
|
1391
|
-
` && (m = m.slice(0, -1)), m = m.replace(
|
|
1550
|
+
` && (m = m.slice(0, -1)), m = m.replace(nt, `$&${c}`));
|
|
1392
1551
|
let h = !1, p, b = -1;
|
|
1393
1552
|
for (p = 0; p < t.length; ++p) {
|
|
1394
1553
|
const N = t[p];
|
|
@@ -1406,60 +1565,60 @@ function Ce({ comment: n, type: e, value: t }, s, i, r) {
|
|
|
1406
1565
|
if (n && (S += " " + a(n.replace(/ ?[\r\n]+/g, " ")), i && i()), !d) {
|
|
1407
1566
|
const N = t.replace(/\n+/g, `
|
|
1408
1567
|
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, "$1$2").replace(/\n+/g, `$&${c}`);
|
|
1409
|
-
let
|
|
1410
|
-
const
|
|
1411
|
-
o !== "folded" && e !==
|
|
1412
|
-
|
|
1568
|
+
let A = !1;
|
|
1569
|
+
const O = je(s, !0);
|
|
1570
|
+
o !== "folded" && e !== T.BLOCK_FOLDED && (O.onOverflow = () => {
|
|
1571
|
+
A = !0;
|
|
1413
1572
|
});
|
|
1414
|
-
const y =
|
|
1415
|
-
if (!
|
|
1573
|
+
const y = De(`${w}${N}${m}`, c, tt, O);
|
|
1574
|
+
if (!A)
|
|
1416
1575
|
return `>${S}
|
|
1417
1576
|
${c}${y}`;
|
|
1418
1577
|
}
|
|
1419
1578
|
return t = t.replace(/\n+/g, `$&${c}`), `|${S}
|
|
1420
1579
|
${c}${w}${t}${m}`;
|
|
1421
1580
|
}
|
|
1422
|
-
function
|
|
1581
|
+
function Us(n, e, t, s) {
|
|
1423
1582
|
const { type: i, value: r } = n, { actualString: o, implicitKey: a, indent: l, indentStep: c, inFlow: d } = e;
|
|
1424
1583
|
if (a && r.includes(`
|
|
1425
1584
|
`) || d && /[[\]{},]/.test(r))
|
|
1426
|
-
return
|
|
1585
|
+
return oe(r, e);
|
|
1427
1586
|
if (/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))
|
|
1428
1587
|
return a || d || !r.includes(`
|
|
1429
|
-
`) ?
|
|
1430
|
-
if (!a && !d && i !==
|
|
1588
|
+
`) ? oe(r, e) : Me(n, e, t, s);
|
|
1589
|
+
if (!a && !d && i !== T.PLAIN && r.includes(`
|
|
1431
1590
|
`))
|
|
1432
|
-
return
|
|
1433
|
-
if (
|
|
1591
|
+
return Me(n, e, t, s);
|
|
1592
|
+
if (qe(r)) {
|
|
1434
1593
|
if (l === "")
|
|
1435
|
-
return e.forceBlockIndent = !0,
|
|
1594
|
+
return e.forceBlockIndent = !0, Me(n, e, t, s);
|
|
1436
1595
|
if (a && l === c)
|
|
1437
|
-
return
|
|
1596
|
+
return oe(r, e);
|
|
1438
1597
|
}
|
|
1439
1598
|
const f = r.replace(/\n+/g, `$&
|
|
1440
1599
|
${l}`);
|
|
1441
1600
|
if (o) {
|
|
1442
1601
|
const u = (h) => h.default && h.tag !== "tag:yaml.org,2002:str" && h.test?.test(f), { compat: m, tags: g } = e.doc.schema;
|
|
1443
1602
|
if (g.some(u) || m?.some(u))
|
|
1444
|
-
return
|
|
1603
|
+
return oe(r, e);
|
|
1445
1604
|
}
|
|
1446
|
-
return a ? f :
|
|
1605
|
+
return a ? f : De(f, l, Gt, je(e, !1));
|
|
1447
1606
|
}
|
|
1448
|
-
function
|
|
1607
|
+
function ht(n, e, t, s) {
|
|
1449
1608
|
const { implicitKey: i, inFlow: r } = e, o = typeof n.value == "string" ? n : Object.assign({}, n, { value: String(n.value) });
|
|
1450
1609
|
let { type: a } = n;
|
|
1451
|
-
a !==
|
|
1610
|
+
a !== T.QUOTE_DOUBLE && /[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value) && (a = T.QUOTE_DOUBLE);
|
|
1452
1611
|
const l = (d) => {
|
|
1453
1612
|
switch (d) {
|
|
1454
|
-
case
|
|
1455
|
-
case
|
|
1456
|
-
return i || r ?
|
|
1457
|
-
case
|
|
1458
|
-
return
|
|
1459
|
-
case
|
|
1460
|
-
return
|
|
1461
|
-
case
|
|
1462
|
-
return
|
|
1613
|
+
case T.BLOCK_FOLDED:
|
|
1614
|
+
case T.BLOCK_LITERAL:
|
|
1615
|
+
return i || r ? oe(o.value, e) : Me(o, e, t, s);
|
|
1616
|
+
case T.QUOTE_DOUBLE:
|
|
1617
|
+
return we(o.value, e);
|
|
1618
|
+
case T.QUOTE_SINGLE:
|
|
1619
|
+
return st(o.value, e);
|
|
1620
|
+
case T.PLAIN:
|
|
1621
|
+
return Us(o, e, t, s);
|
|
1463
1622
|
default:
|
|
1464
1623
|
return null;
|
|
1465
1624
|
}
|
|
@@ -1472,10 +1631,10 @@ function at(n, e, t, s) {
|
|
|
1472
1631
|
}
|
|
1473
1632
|
return c;
|
|
1474
1633
|
}
|
|
1475
|
-
function
|
|
1634
|
+
function Ht(n, e) {
|
|
1476
1635
|
const t = Object.assign({
|
|
1477
1636
|
blockQuote: !0,
|
|
1478
|
-
commentString:
|
|
1637
|
+
commentString: Rs,
|
|
1479
1638
|
defaultKeyType: null,
|
|
1480
1639
|
defaultStringType: "PLAIN",
|
|
1481
1640
|
directives: null,
|
|
@@ -1513,7 +1672,7 @@ function Vt(n, e) {
|
|
|
1513
1672
|
options: t
|
|
1514
1673
|
};
|
|
1515
1674
|
}
|
|
1516
|
-
function
|
|
1675
|
+
function xs(n, e) {
|
|
1517
1676
|
if (e.tag) {
|
|
1518
1677
|
const i = n.filter((r) => r.tag === e.tag);
|
|
1519
1678
|
if (i.length > 0)
|
|
@@ -1536,18 +1695,18 @@ function Ps(n, e) {
|
|
|
1536
1695
|
}
|
|
1537
1696
|
return t;
|
|
1538
1697
|
}
|
|
1539
|
-
function
|
|
1698
|
+
function Vs(n, e, { anchors: t, doc: s }) {
|
|
1540
1699
|
if (!s.directives)
|
|
1541
1700
|
return "";
|
|
1542
|
-
const i = [], r = (I(n) ||
|
|
1543
|
-
r &&
|
|
1701
|
+
const i = [], r = (I(n) || E(n)) && n.anchor;
|
|
1702
|
+
r && Ut(r) && (t.add(r), i.push(`&${r}`));
|
|
1544
1703
|
const o = n.tag ?? (e.default ? null : e.tag);
|
|
1545
1704
|
return o && i.push(s.directives.tagString(o)), i.join(" ");
|
|
1546
1705
|
}
|
|
1547
|
-
function
|
|
1548
|
-
if (
|
|
1706
|
+
function ce(n, e, t, s) {
|
|
1707
|
+
if (v(n))
|
|
1549
1708
|
return n.toString(e, t, s);
|
|
1550
|
-
if (
|
|
1709
|
+
if (ee(n)) {
|
|
1551
1710
|
if (e.doc.directives)
|
|
1552
1711
|
return n.toString(e);
|
|
1553
1712
|
if (e.resolvedAliases?.has(n))
|
|
@@ -1556,31 +1715,31 @@ function ae(n, e, t, s) {
|
|
|
1556
1715
|
}
|
|
1557
1716
|
let i;
|
|
1558
1717
|
const r = L(n) ? n : e.doc.createNode(n, { onTagObj: (l) => i = l });
|
|
1559
|
-
i ?? (i =
|
|
1560
|
-
const o =
|
|
1718
|
+
i ?? (i = xs(e.doc.schema.tags, r));
|
|
1719
|
+
const o = Vs(r, i, e);
|
|
1561
1720
|
o.length > 0 && (e.indentAtStart = (e.indentAtStart ?? 0) + o.length + 1);
|
|
1562
|
-
const a = typeof i.stringify == "function" ? i.stringify(r, e, t, s) : I(r) ?
|
|
1721
|
+
const a = typeof i.stringify == "function" ? i.stringify(r, e, t, s) : I(r) ? ht(r, e, t, s) : r.toString(e, t, s);
|
|
1563
1722
|
return o ? I(r) || a[0] === "{" || a[0] === "[" ? `${o} ${a}` : `${o}
|
|
1564
1723
|
${e.indent}${a}` : a;
|
|
1565
1724
|
}
|
|
1566
|
-
function
|
|
1725
|
+
function Js({ key: n, value: e }, t, s, i) {
|
|
1567
1726
|
const { allNullValues: r, doc: o, indent: a, indentStep: l, options: { commentString: c, indentSeq: d, simpleKeys: f } } = t;
|
|
1568
1727
|
let u = L(n) && n.comment || null;
|
|
1569
1728
|
if (f) {
|
|
1570
1729
|
if (u)
|
|
1571
1730
|
throw new Error("With simple keys, key nodes cannot have comments");
|
|
1572
|
-
if (
|
|
1573
|
-
const
|
|
1574
|
-
throw new Error(
|
|
1731
|
+
if (E(n) || !L(n) && typeof n == "object") {
|
|
1732
|
+
const O = "With simple keys, collection cannot be used as a key value";
|
|
1733
|
+
throw new Error(O);
|
|
1575
1734
|
}
|
|
1576
1735
|
}
|
|
1577
|
-
let m = !f && (!n || u && e == null && !t.inFlow ||
|
|
1736
|
+
let m = !f && (!n || u && e == null && !t.inFlow || E(n) || (I(n) ? n.type === T.BLOCK_FOLDED || n.type === T.BLOCK_LITERAL : typeof n == "object"));
|
|
1578
1737
|
t = Object.assign({}, t, {
|
|
1579
1738
|
allNullValues: !1,
|
|
1580
1739
|
implicitKey: !m && (f || !r),
|
|
1581
1740
|
indent: a + l
|
|
1582
1741
|
});
|
|
1583
|
-
let g = !1, h = !1, p =
|
|
1742
|
+
let g = !1, h = !1, p = ce(n, t, () => g = !0, () => h = !0);
|
|
1584
1743
|
if (!m && !t.inFlow && p.length > 1024) {
|
|
1585
1744
|
if (f)
|
|
1586
1745
|
throw new Error("With simple keys, single line scalar must not span more than 1024 characters");
|
|
@@ -1590,68 +1749,68 @@ function Ds({ key: n, value: e }, t, s, i) {
|
|
|
1590
1749
|
if (r || e == null)
|
|
1591
1750
|
return g && s && s(), p === "" ? "?" : m ? `? ${p}` : p;
|
|
1592
1751
|
} else if (r && !f || e == null && m)
|
|
1593
|
-
return p = `? ${p}`, u && !g ? p +=
|
|
1594
|
-
g && (u = null), m ? (u && (p +=
|
|
1595
|
-
${a}:`) : (p = `${p}:`, u && (p +=
|
|
1752
|
+
return p = `? ${p}`, u && !g ? p += X(p, t.indent, c(u)) : h && i && i(), p;
|
|
1753
|
+
g && (u = null), m ? (u && (p += X(p, t.indent, c(u))), p = `? ${p}
|
|
1754
|
+
${a}:`) : (p = `${p}:`, u && (p += X(p, t.indent, c(u))));
|
|
1596
1755
|
let b, w, k;
|
|
1597
|
-
L(e) ? (b = !!e.spaceBefore, w = e.commentBefore, k = e.comment) : (b = !1, w = null, k = null, e && typeof e == "object" && (e = o.createNode(e))), t.implicitKey = !1, !m && !u && I(e) && (t.indentAtStart = p.length + 1), h = !1, !d && l.length >= 2 && !t.inFlow && !m &&
|
|
1756
|
+
L(e) ? (b = !!e.spaceBefore, w = e.commentBefore, k = e.comment) : (b = !1, w = null, k = null, e && typeof e == "object" && (e = o.createNode(e))), t.implicitKey = !1, !m && !u && I(e) && (t.indentAtStart = p.length + 1), h = !1, !d && l.length >= 2 && !t.inFlow && !m && Te(e) && !e.flow && !e.tag && !e.anchor && (t.indent = t.indent.substring(2));
|
|
1598
1757
|
let S = !1;
|
|
1599
|
-
const N =
|
|
1600
|
-
let
|
|
1758
|
+
const N = ce(e, t, () => S = !0, () => h = !0);
|
|
1759
|
+
let A = " ";
|
|
1601
1760
|
if (u || b || w) {
|
|
1602
|
-
if (
|
|
1761
|
+
if (A = b ? `
|
|
1603
1762
|
` : "", w) {
|
|
1604
|
-
const
|
|
1605
|
-
|
|
1606
|
-
${
|
|
1763
|
+
const O = c(w);
|
|
1764
|
+
A += `
|
|
1765
|
+
${J(O, t.indent)}`;
|
|
1607
1766
|
}
|
|
1608
|
-
N === "" && !t.inFlow ?
|
|
1609
|
-
` && k && (
|
|
1767
|
+
N === "" && !t.inFlow ? A === `
|
|
1768
|
+
` && k && (A = `
|
|
1610
1769
|
|
|
1611
|
-
`) :
|
|
1770
|
+
`) : A += `
|
|
1612
1771
|
${t.indent}`;
|
|
1613
|
-
} else if (!m &&
|
|
1614
|
-
const
|
|
1615
|
-
`), C = y !== -1,
|
|
1616
|
-
if (C || !
|
|
1617
|
-
let
|
|
1618
|
-
if (C && (
|
|
1619
|
-
let
|
|
1620
|
-
|
|
1772
|
+
} else if (!m && E(e)) {
|
|
1773
|
+
const O = N[0], y = N.indexOf(`
|
|
1774
|
+
`), C = y !== -1, G = t.inFlow ?? e.flow ?? e.items.length === 0;
|
|
1775
|
+
if (C || !G) {
|
|
1776
|
+
let te = !1;
|
|
1777
|
+
if (C && (O === "&" || O === "!")) {
|
|
1778
|
+
let _ = N.indexOf(" ");
|
|
1779
|
+
O === "&" && _ !== -1 && _ < y && N[_ + 1] === "!" && (_ = N.indexOf(" ", _ + 1)), (_ === -1 || y < _) && (te = !0);
|
|
1621
1780
|
}
|
|
1622
|
-
|
|
1781
|
+
te || (A = `
|
|
1623
1782
|
${t.indent}`);
|
|
1624
1783
|
}
|
|
1625
1784
|
} else (N === "" || N[0] === `
|
|
1626
|
-
`) && (
|
|
1627
|
-
return p +=
|
|
1785
|
+
`) && (A = "");
|
|
1786
|
+
return p += A + N, t.inFlow ? S && s && s() : k && !S ? p += X(p, t.indent, c(k)) : h && i && i(), p;
|
|
1628
1787
|
}
|
|
1629
|
-
function
|
|
1788
|
+
function Ys(n, e) {
|
|
1630
1789
|
(n === "debug" || n === "warn") && console.warn(e);
|
|
1631
1790
|
}
|
|
1632
|
-
const
|
|
1633
|
-
identify: (n) => n ===
|
|
1791
|
+
const Ie = "<<", Y = {
|
|
1792
|
+
identify: (n) => n === Ie || typeof n == "symbol" && n.description === Ie,
|
|
1634
1793
|
default: "key",
|
|
1635
1794
|
tag: "tag:yaml.org,2002:merge",
|
|
1636
1795
|
test: /^<<$/,
|
|
1637
|
-
resolve: () => Object.assign(new
|
|
1638
|
-
addToJSMap:
|
|
1796
|
+
resolve: () => Object.assign(new T(Symbol(Ie)), {
|
|
1797
|
+
addToJSMap: Qt
|
|
1639
1798
|
}),
|
|
1640
|
-
stringify: () =>
|
|
1641
|
-
},
|
|
1642
|
-
function
|
|
1643
|
-
if (t = n &&
|
|
1799
|
+
stringify: () => Ie
|
|
1800
|
+
}, Gs = (n, e) => (Y.identify(e) || I(e) && (!e.type || e.type === T.PLAIN) && Y.identify(e.value)) && n?.doc.schema.tags.some((t) => t.tag === Y.tag && t.default);
|
|
1801
|
+
function Qt(n, e, t) {
|
|
1802
|
+
if (t = n && ee(t) ? t.resolve(n.doc) : t, Te(t))
|
|
1644
1803
|
for (const s of t.items)
|
|
1645
|
-
|
|
1804
|
+
He(n, e, s);
|
|
1646
1805
|
else if (Array.isArray(t))
|
|
1647
1806
|
for (const s of t)
|
|
1648
|
-
|
|
1807
|
+
He(n, e, s);
|
|
1649
1808
|
else
|
|
1650
|
-
|
|
1809
|
+
He(n, e, t);
|
|
1651
1810
|
}
|
|
1652
|
-
function
|
|
1653
|
-
const s = n &&
|
|
1654
|
-
if (!
|
|
1811
|
+
function He(n, e, t) {
|
|
1812
|
+
const s = n && ee(t) ? t.resolve(n.doc) : t;
|
|
1813
|
+
if (!Ne(s))
|
|
1655
1814
|
throw new Error("Merge sources must be maps or map aliases");
|
|
1656
1815
|
const i = s.toJSON(null, n, Map);
|
|
1657
1816
|
for (const [r, o] of i)
|
|
@@ -1663,11 +1822,11 @@ function xe(n, e, t) {
|
|
|
1663
1822
|
});
|
|
1664
1823
|
return e;
|
|
1665
1824
|
}
|
|
1666
|
-
function
|
|
1825
|
+
function Wt(n, e, { key: t, value: s }) {
|
|
1667
1826
|
if (L(t) && t.addToJSMap)
|
|
1668
1827
|
t.addToJSMap(n, e, s);
|
|
1669
|
-
else if (
|
|
1670
|
-
|
|
1828
|
+
else if (Gs(n, t))
|
|
1829
|
+
Qt(n, e, s);
|
|
1671
1830
|
else {
|
|
1672
1831
|
const i = D(t, "", n);
|
|
1673
1832
|
if (e instanceof Map)
|
|
@@ -1675,7 +1834,7 @@ function Jt(n, e, { key: t, value: s }) {
|
|
|
1675
1834
|
else if (e instanceof Set)
|
|
1676
1835
|
e.add(i);
|
|
1677
1836
|
else {
|
|
1678
|
-
const r =
|
|
1837
|
+
const r = Hs(t, i, n), o = D(s, r, n);
|
|
1679
1838
|
r in e ? Object.defineProperty(e, r, {
|
|
1680
1839
|
value: o,
|
|
1681
1840
|
writable: !0,
|
|
@@ -1686,13 +1845,13 @@ function Jt(n, e, { key: t, value: s }) {
|
|
|
1686
1845
|
}
|
|
1687
1846
|
return e;
|
|
1688
1847
|
}
|
|
1689
|
-
function
|
|
1848
|
+
function Hs(n, e, t) {
|
|
1690
1849
|
if (e === null)
|
|
1691
1850
|
return "";
|
|
1692
1851
|
if (typeof e != "object")
|
|
1693
1852
|
return String(e);
|
|
1694
1853
|
if (L(n) && t?.doc) {
|
|
1695
|
-
const s =
|
|
1854
|
+
const s = Ht(t.doc, {});
|
|
1696
1855
|
s.anchors = /* @__PURE__ */ new Set();
|
|
1697
1856
|
for (const r of t.anchors.keys())
|
|
1698
1857
|
s.anchors.add(r.anchor);
|
|
@@ -1700,19 +1859,19 @@ function Rs(n, e, t) {
|
|
|
1700
1859
|
const i = n.toString(s);
|
|
1701
1860
|
if (!t.mapKeyWarned) {
|
|
1702
1861
|
let r = JSON.stringify(i);
|
|
1703
|
-
r.length > 40 && (r = r.substring(0, 36) + '..."'),
|
|
1862
|
+
r.length > 40 && (r = r.substring(0, 36) + '..."'), Ys(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;
|
|
1704
1863
|
}
|
|
1705
1864
|
return i;
|
|
1706
1865
|
}
|
|
1707
1866
|
return JSON.stringify(e);
|
|
1708
1867
|
}
|
|
1709
|
-
function
|
|
1710
|
-
const s =
|
|
1868
|
+
function dt(n, e, t) {
|
|
1869
|
+
const s = ke(n, void 0, t), i = ke(e, void 0, t);
|
|
1711
1870
|
return new P(s, i);
|
|
1712
1871
|
}
|
|
1713
1872
|
class P {
|
|
1714
1873
|
constructor(e, t = null) {
|
|
1715
|
-
Object.defineProperty(this, j, { value:
|
|
1874
|
+
Object.defineProperty(this, j, { value: Rt }), this.key = e, this.value = t;
|
|
1716
1875
|
}
|
|
1717
1876
|
clone(e) {
|
|
1718
1877
|
let { key: t, value: s } = this;
|
|
@@ -1720,16 +1879,16 @@ class P {
|
|
|
1720
1879
|
}
|
|
1721
1880
|
toJSON(e, t) {
|
|
1722
1881
|
const s = t?.mapAsMap ? /* @__PURE__ */ new Map() : {};
|
|
1723
|
-
return
|
|
1882
|
+
return Wt(t, s, this);
|
|
1724
1883
|
}
|
|
1725
1884
|
toString(e, t, s) {
|
|
1726
|
-
return e?.doc ?
|
|
1885
|
+
return e?.doc ? Js(this, e, t, s) : JSON.stringify(this);
|
|
1727
1886
|
}
|
|
1728
1887
|
}
|
|
1729
|
-
function
|
|
1730
|
-
return (e.inFlow ?? n.flow ?
|
|
1888
|
+
function Xt(n, e, t) {
|
|
1889
|
+
return (e.inFlow ?? n.flow ? Ws : Qs)(n, e, t);
|
|
1731
1890
|
}
|
|
1732
|
-
function
|
|
1891
|
+
function Qs({ comment: n, items: e }, t, { blockItemPrefix: s, flowChars: i, itemIndent: r, onChompKeep: o, onComment: a }) {
|
|
1733
1892
|
const { indent: l, options: { commentString: c } } = t, d = Object.assign({}, t, { indent: r, type: null });
|
|
1734
1893
|
let f = !1;
|
|
1735
1894
|
const u = [];
|
|
@@ -1737,14 +1896,14 @@ function Fs({ comment: n, items: e }, t, { blockItemPrefix: s, flowChars: i, ite
|
|
|
1737
1896
|
const h = e[g];
|
|
1738
1897
|
let p = null;
|
|
1739
1898
|
if (L(h))
|
|
1740
|
-
!f && h.spaceBefore && u.push(""),
|
|
1741
|
-
else if (
|
|
1899
|
+
!f && h.spaceBefore && u.push(""), Pe(t, u, h.commentBefore, f), h.comment && (p = h.comment);
|
|
1900
|
+
else if (v(h)) {
|
|
1742
1901
|
const w = L(h.key) ? h.key : null;
|
|
1743
|
-
w && (!f && w.spaceBefore && u.push(""),
|
|
1902
|
+
w && (!f && w.spaceBefore && u.push(""), Pe(t, u, w.commentBefore, f));
|
|
1744
1903
|
}
|
|
1745
1904
|
f = !1;
|
|
1746
|
-
let b =
|
|
1747
|
-
p && (b +=
|
|
1905
|
+
let b = ce(h, d, () => p = null, () => f = !0);
|
|
1906
|
+
p && (b += X(b, r, c(p))), f && p && (f = !1), u.push(s + b);
|
|
1748
1907
|
}
|
|
1749
1908
|
let m;
|
|
1750
1909
|
if (u.length === 0)
|
|
@@ -1759,9 +1918,9 @@ ${l}${h}` : `
|
|
|
1759
1918
|
}
|
|
1760
1919
|
}
|
|
1761
1920
|
return n ? (m += `
|
|
1762
|
-
` +
|
|
1921
|
+
` + J(c(n), l), a && a()) : f && o && o(), m;
|
|
1763
1922
|
}
|
|
1764
|
-
function
|
|
1923
|
+
function Ws({ items: n }, e, { flowChars: t, itemIndent: s }) {
|
|
1765
1924
|
const { indent: i, indentStep: r, flowCollectionPadding: o, options: { commentString: a } } = e;
|
|
1766
1925
|
s += r;
|
|
1767
1926
|
const l = Object.assign({}, e, {
|
|
@@ -1775,16 +1934,16 @@ function Us({ items: n }, e, { flowChars: t, itemIndent: s }) {
|
|
|
1775
1934
|
const h = n[g];
|
|
1776
1935
|
let p = null;
|
|
1777
1936
|
if (L(h))
|
|
1778
|
-
h.spaceBefore && f.push(""),
|
|
1779
|
-
else if (
|
|
1937
|
+
h.spaceBefore && f.push(""), Pe(e, f, h.commentBefore, !1), h.comment && (p = h.comment);
|
|
1938
|
+
else if (v(h)) {
|
|
1780
1939
|
const w = L(h.key) ? h.key : null;
|
|
1781
|
-
w && (w.spaceBefore && f.push(""),
|
|
1940
|
+
w && (w.spaceBefore && f.push(""), Pe(e, f, w.commentBefore, !1), w.comment && (c = !0));
|
|
1782
1941
|
const k = L(h.value) ? h.value : null;
|
|
1783
1942
|
k ? (k.comment && (p = k.comment), k.commentBefore && (c = !0)) : h.value == null && w?.comment && (p = w.comment);
|
|
1784
1943
|
}
|
|
1785
1944
|
p && (c = !0);
|
|
1786
|
-
let b =
|
|
1787
|
-
g < n.length - 1 && (b += ","), p && (b +=
|
|
1945
|
+
let b = ce(h, l, () => p = null);
|
|
1946
|
+
g < n.length - 1 && (b += ","), p && (b += X(b, s, a(p))), !c && (f.length > d || b.includes(`
|
|
1788
1947
|
`)) && (c = !0), f.push(b), d = f.length;
|
|
1789
1948
|
}
|
|
1790
1949
|
const { start: u, end: m } = t;
|
|
@@ -1805,24 +1964,24 @@ ${i}${m}`;
|
|
|
1805
1964
|
} else
|
|
1806
1965
|
return `${u}${o}${f.join(" ")}${o}${m}`;
|
|
1807
1966
|
}
|
|
1808
|
-
function
|
|
1967
|
+
function Pe({ indent: n, options: { commentString: e } }, t, s, i) {
|
|
1809
1968
|
if (s && i && (s = s.replace(/^\n+/, "")), s) {
|
|
1810
|
-
const r =
|
|
1969
|
+
const r = J(e(s), n);
|
|
1811
1970
|
t.push(r.trimStart());
|
|
1812
1971
|
}
|
|
1813
1972
|
}
|
|
1814
|
-
function
|
|
1973
|
+
function z(n, e) {
|
|
1815
1974
|
const t = I(e) ? e.value : e;
|
|
1816
1975
|
for (const s of n)
|
|
1817
|
-
if (
|
|
1976
|
+
if (v(s) && (s.key === e || s.key === t || I(s.key) && s.key.value === t))
|
|
1818
1977
|
return s;
|
|
1819
1978
|
}
|
|
1820
|
-
class K extends
|
|
1979
|
+
class K extends Yt {
|
|
1821
1980
|
static get tagName() {
|
|
1822
1981
|
return "tag:yaml.org,2002:map";
|
|
1823
1982
|
}
|
|
1824
1983
|
constructor(e) {
|
|
1825
|
-
super(
|
|
1984
|
+
super(Q, e), this.items = [];
|
|
1826
1985
|
}
|
|
1827
1986
|
/**
|
|
1828
1987
|
* A generic collection parsing method that can be extended
|
|
@@ -1834,7 +1993,7 @@ class K extends Ft {
|
|
|
1834
1993
|
c = r.call(t, l, c);
|
|
1835
1994
|
else if (Array.isArray(r) && !r.includes(l))
|
|
1836
1995
|
return;
|
|
1837
|
-
(c !== void 0 || i) && o.items.push(
|
|
1996
|
+
(c !== void 0 || i) && o.items.push(dt(l, c, s));
|
|
1838
1997
|
};
|
|
1839
1998
|
if (t instanceof Map)
|
|
1840
1999
|
for (const [l, c] of t)
|
|
@@ -1852,12 +2011,12 @@ class K extends Ft {
|
|
|
1852
2011
|
*/
|
|
1853
2012
|
add(e, t) {
|
|
1854
2013
|
let s;
|
|
1855
|
-
|
|
1856
|
-
const i =
|
|
2014
|
+
v(e) ? s = e : !e || typeof e != "object" || !("key" in e) ? s = new P(e, e?.value) : s = new P(e.key, e.value);
|
|
2015
|
+
const i = z(this.items, s.key), r = this.schema?.sortMapEntries;
|
|
1857
2016
|
if (i) {
|
|
1858
2017
|
if (!t)
|
|
1859
2018
|
throw new Error(`Key ${s.key} already set`);
|
|
1860
|
-
I(i.value) &&
|
|
2019
|
+
I(i.value) && Jt(s.value) ? i.value.value = s.value : i.value = s.value;
|
|
1861
2020
|
} else if (r) {
|
|
1862
2021
|
const o = this.items.findIndex((a) => r(s, a) < 0);
|
|
1863
2022
|
o === -1 ? this.items.push(s) : this.items.splice(o, 0, s);
|
|
@@ -1865,15 +2024,15 @@ class K extends Ft {
|
|
|
1865
2024
|
this.items.push(s);
|
|
1866
2025
|
}
|
|
1867
2026
|
delete(e) {
|
|
1868
|
-
const t =
|
|
2027
|
+
const t = z(this.items, e);
|
|
1869
2028
|
return t ? this.items.splice(this.items.indexOf(t), 1).length > 0 : !1;
|
|
1870
2029
|
}
|
|
1871
2030
|
get(e, t) {
|
|
1872
|
-
const i =
|
|
2031
|
+
const i = z(this.items, e)?.value;
|
|
1873
2032
|
return (!t && I(i) ? i.value : i) ?? void 0;
|
|
1874
2033
|
}
|
|
1875
2034
|
has(e) {
|
|
1876
|
-
return !!
|
|
2035
|
+
return !!z(this.items, e);
|
|
1877
2036
|
}
|
|
1878
2037
|
set(e, t) {
|
|
1879
2038
|
this.add(new P(e, t), !0);
|
|
@@ -1887,16 +2046,16 @@ class K extends Ft {
|
|
|
1887
2046
|
const i = s ? new s() : t?.mapAsMap ? /* @__PURE__ */ new Map() : {};
|
|
1888
2047
|
t?.onCreate && t.onCreate(i);
|
|
1889
2048
|
for (const r of this.items)
|
|
1890
|
-
|
|
2049
|
+
Wt(t, i, r);
|
|
1891
2050
|
return i;
|
|
1892
2051
|
}
|
|
1893
2052
|
toString(e, t, s) {
|
|
1894
2053
|
if (!e)
|
|
1895
2054
|
return JSON.stringify(this);
|
|
1896
2055
|
for (const i of this.items)
|
|
1897
|
-
if (!
|
|
2056
|
+
if (!v(i))
|
|
1898
2057
|
throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);
|
|
1899
|
-
return !e.allNullValues && this.hasAllNullValues(!1) && (e = Object.assign({}, e, { allNullValues: !0 })),
|
|
2058
|
+
return !e.allNullValues && this.hasAllNullValues(!1) && (e = Object.assign({}, e, { allNullValues: !0 })), Xt(this, e, {
|
|
1900
2059
|
blockItemPrefix: "",
|
|
1901
2060
|
flowChars: { start: "{", end: "}" },
|
|
1902
2061
|
itemIndent: e.indent || "",
|
|
@@ -1905,22 +2064,22 @@ class K extends Ft {
|
|
|
1905
2064
|
});
|
|
1906
2065
|
}
|
|
1907
2066
|
}
|
|
1908
|
-
const
|
|
2067
|
+
const de = {
|
|
1909
2068
|
collection: "map",
|
|
1910
2069
|
default: !0,
|
|
1911
2070
|
nodeClass: K,
|
|
1912
2071
|
tag: "tag:yaml.org,2002:map",
|
|
1913
2072
|
resolve(n, e) {
|
|
1914
|
-
return
|
|
2073
|
+
return Ne(n) || e("Expected a mapping for this tag"), n;
|
|
1915
2074
|
},
|
|
1916
2075
|
createNode: (n, e, t) => K.from(n, e, t)
|
|
1917
2076
|
};
|
|
1918
|
-
class
|
|
2077
|
+
class Z extends Yt {
|
|
1919
2078
|
static get tagName() {
|
|
1920
2079
|
return "tag:yaml.org,2002:seq";
|
|
1921
2080
|
}
|
|
1922
2081
|
constructor(e) {
|
|
1923
|
-
super(
|
|
2082
|
+
super(ue, e), this.items = [];
|
|
1924
2083
|
}
|
|
1925
2084
|
add(e) {
|
|
1926
2085
|
this.items.push(e);
|
|
@@ -1934,11 +2093,11 @@ class X extends Ft {
|
|
|
1934
2093
|
* @returns `true` if the item was found and removed.
|
|
1935
2094
|
*/
|
|
1936
2095
|
delete(e) {
|
|
1937
|
-
const t =
|
|
2096
|
+
const t = $e(e);
|
|
1938
2097
|
return typeof t != "number" ? !1 : this.items.splice(t, 1).length > 0;
|
|
1939
2098
|
}
|
|
1940
2099
|
get(e, t) {
|
|
1941
|
-
const s =
|
|
2100
|
+
const s = $e(e);
|
|
1942
2101
|
if (typeof s != "number")
|
|
1943
2102
|
return;
|
|
1944
2103
|
const i = this.items[s];
|
|
@@ -1951,7 +2110,7 @@ class X extends Ft {
|
|
|
1951
2110
|
* It may be wrapped in a `Scalar`.
|
|
1952
2111
|
*/
|
|
1953
2112
|
has(e) {
|
|
1954
|
-
const t =
|
|
2113
|
+
const t = $e(e);
|
|
1955
2114
|
return typeof t == "number" && t < this.items.length;
|
|
1956
2115
|
}
|
|
1957
2116
|
/**
|
|
@@ -1962,11 +2121,11 @@ class X extends Ft {
|
|
|
1962
2121
|
* It may be wrapped in a `Scalar`.
|
|
1963
2122
|
*/
|
|
1964
2123
|
set(e, t) {
|
|
1965
|
-
const s =
|
|
2124
|
+
const s = $e(e);
|
|
1966
2125
|
if (typeof s != "number")
|
|
1967
2126
|
throw new Error(`Expected a valid index, not ${e}.`);
|
|
1968
2127
|
const i = this.items[s];
|
|
1969
|
-
I(i) &&
|
|
2128
|
+
I(i) && Jt(t) ? i.value = t : this.items[s] = t;
|
|
1970
2129
|
}
|
|
1971
2130
|
toJSON(e, t) {
|
|
1972
2131
|
const s = [];
|
|
@@ -1977,7 +2136,7 @@ class X extends Ft {
|
|
|
1977
2136
|
return s;
|
|
1978
2137
|
}
|
|
1979
2138
|
toString(e, t, s) {
|
|
1980
|
-
return e ?
|
|
2139
|
+
return e ? Xt(this, e, {
|
|
1981
2140
|
blockItemPrefix: "- ",
|
|
1982
2141
|
flowChars: { start: "[", end: "]" },
|
|
1983
2142
|
itemIndent: (e.indent || "") + " ",
|
|
@@ -1994,49 +2153,49 @@ class X extends Ft {
|
|
|
1994
2153
|
const l = t instanceof Set ? a : String(o++);
|
|
1995
2154
|
a = i.call(t, l, a);
|
|
1996
2155
|
}
|
|
1997
|
-
r.items.push(
|
|
2156
|
+
r.items.push(ke(a, void 0, s));
|
|
1998
2157
|
}
|
|
1999
2158
|
}
|
|
2000
2159
|
return r;
|
|
2001
2160
|
}
|
|
2002
2161
|
}
|
|
2003
|
-
function
|
|
2162
|
+
function $e(n) {
|
|
2004
2163
|
let e = I(n) ? n.value : n;
|
|
2005
2164
|
return e && typeof e == "string" && (e = Number(e)), typeof e == "number" && Number.isInteger(e) && e >= 0 ? e : null;
|
|
2006
2165
|
}
|
|
2007
|
-
const
|
|
2166
|
+
const pe = {
|
|
2008
2167
|
collection: "seq",
|
|
2009
2168
|
default: !0,
|
|
2010
|
-
nodeClass:
|
|
2169
|
+
nodeClass: Z,
|
|
2011
2170
|
tag: "tag:yaml.org,2002:seq",
|
|
2012
2171
|
resolve(n, e) {
|
|
2013
|
-
return
|
|
2172
|
+
return Te(n) || e("Expected a sequence for this tag"), n;
|
|
2014
2173
|
},
|
|
2015
|
-
createNode: (n, e, t) =>
|
|
2016
|
-
},
|
|
2174
|
+
createNode: (n, e, t) => Z.from(n, e, t)
|
|
2175
|
+
}, Re = {
|
|
2017
2176
|
identify: (n) => typeof n == "string",
|
|
2018
2177
|
default: !0,
|
|
2019
2178
|
tag: "tag:yaml.org,2002:str",
|
|
2020
2179
|
resolve: (n) => n,
|
|
2021
2180
|
stringify(n, e, t, s) {
|
|
2022
|
-
return e = Object.assign({ actualString: !0 }, e),
|
|
2181
|
+
return e = Object.assign({ actualString: !0 }, e), ht(n, e, t, s);
|
|
2023
2182
|
}
|
|
2024
|
-
},
|
|
2183
|
+
}, Fe = {
|
|
2025
2184
|
identify: (n) => n == null,
|
|
2026
|
-
createNode: () => new
|
|
2185
|
+
createNode: () => new T(null),
|
|
2027
2186
|
default: !0,
|
|
2028
2187
|
tag: "tag:yaml.org,2002:null",
|
|
2029
2188
|
test: /^(?:~|[Nn]ull|NULL)?$/,
|
|
2030
|
-
resolve: () => new
|
|
2031
|
-
stringify: ({ source: n }, e) => typeof n == "string" &&
|
|
2032
|
-
},
|
|
2189
|
+
resolve: () => new T(null),
|
|
2190
|
+
stringify: ({ source: n }, e) => typeof n == "string" && Fe.test.test(n) ? n : e.options.nullStr
|
|
2191
|
+
}, pt = {
|
|
2033
2192
|
identify: (n) => typeof n == "boolean",
|
|
2034
2193
|
default: !0,
|
|
2035
2194
|
tag: "tag:yaml.org,2002:bool",
|
|
2036
2195
|
test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
|
|
2037
|
-
resolve: (n) => new
|
|
2196
|
+
resolve: (n) => new T(n[0] === "t" || n[0] === "T"),
|
|
2038
2197
|
stringify({ source: n, value: e }, t) {
|
|
2039
|
-
if (n &&
|
|
2198
|
+
if (n && pt.test.test(n)) {
|
|
2040
2199
|
const s = n[0] === "t" || n[0] === "T";
|
|
2041
2200
|
if (e === s)
|
|
2042
2201
|
return n;
|
|
@@ -2044,7 +2203,7 @@ const he = {
|
|
|
2044
2203
|
return e ? t.options.trueStr : t.options.falseStr;
|
|
2045
2204
|
}
|
|
2046
2205
|
};
|
|
2047
|
-
function
|
|
2206
|
+
function F({ format: n, minFractionDigits: e, tag: t, value: s }) {
|
|
2048
2207
|
if (typeof s == "bigint")
|
|
2049
2208
|
return String(s);
|
|
2050
2209
|
const i = typeof s == "number" ? s : Number(s);
|
|
@@ -2060,14 +2219,14 @@ function R({ format: n, minFractionDigits: e, tag: t, value: s }) {
|
|
|
2060
2219
|
}
|
|
2061
2220
|
return r;
|
|
2062
2221
|
}
|
|
2063
|
-
const
|
|
2222
|
+
const zt = {
|
|
2064
2223
|
identify: (n) => typeof n == "number",
|
|
2065
2224
|
default: !0,
|
|
2066
2225
|
tag: "tag:yaml.org,2002:float",
|
|
2067
2226
|
test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
|
|
2068
2227
|
resolve: (n) => n.slice(-3).toLowerCase() === "nan" ? NaN : n[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
|
|
2069
|
-
stringify:
|
|
2070
|
-
},
|
|
2228
|
+
stringify: F
|
|
2229
|
+
}, Zt = {
|
|
2071
2230
|
identify: (n) => typeof n == "number",
|
|
2072
2231
|
default: !0,
|
|
2073
2232
|
tag: "tag:yaml.org,2002:float",
|
|
@@ -2076,78 +2235,78 @@ const Gt = {
|
|
|
2076
2235
|
resolve: (n) => parseFloat(n),
|
|
2077
2236
|
stringify(n) {
|
|
2078
2237
|
const e = Number(n.value);
|
|
2079
|
-
return isFinite(e) ? e.toExponential() :
|
|
2238
|
+
return isFinite(e) ? e.toExponential() : F(n);
|
|
2080
2239
|
}
|
|
2081
|
-
},
|
|
2240
|
+
}, es = {
|
|
2082
2241
|
identify: (n) => typeof n == "number",
|
|
2083
2242
|
default: !0,
|
|
2084
2243
|
tag: "tag:yaml.org,2002:float",
|
|
2085
2244
|
test: /^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,
|
|
2086
2245
|
resolve(n) {
|
|
2087
|
-
const e = new
|
|
2246
|
+
const e = new T(parseFloat(n)), t = n.indexOf(".");
|
|
2088
2247
|
return t !== -1 && n[n.length - 1] === "0" && (e.minFractionDigits = n.length - t - 1), e;
|
|
2089
2248
|
},
|
|
2090
|
-
stringify:
|
|
2091
|
-
},
|
|
2092
|
-
function
|
|
2249
|
+
stringify: F
|
|
2250
|
+
}, Ue = (n) => typeof n == "bigint" || Number.isInteger(n), mt = (n, e, t, { intAsBigInt: s }) => s ? BigInt(n) : parseInt(n.substring(e), t);
|
|
2251
|
+
function ts(n, e, t) {
|
|
2093
2252
|
const { value: s } = n;
|
|
2094
|
-
return
|
|
2253
|
+
return Ue(s) && s >= 0 ? t + s.toString(e) : F(n);
|
|
2095
2254
|
}
|
|
2096
|
-
const
|
|
2097
|
-
identify: (n) =>
|
|
2255
|
+
const ss = {
|
|
2256
|
+
identify: (n) => Ue(n) && n >= 0,
|
|
2098
2257
|
default: !0,
|
|
2099
2258
|
tag: "tag:yaml.org,2002:int",
|
|
2100
2259
|
format: "OCT",
|
|
2101
2260
|
test: /^0o[0-7]+$/,
|
|
2102
|
-
resolve: (n, e, t) =>
|
|
2103
|
-
stringify: (n) =>
|
|
2104
|
-
},
|
|
2105
|
-
identify:
|
|
2261
|
+
resolve: (n, e, t) => mt(n, 2, 8, t),
|
|
2262
|
+
stringify: (n) => ts(n, 8, "0o")
|
|
2263
|
+
}, ns = {
|
|
2264
|
+
identify: Ue,
|
|
2106
2265
|
default: !0,
|
|
2107
2266
|
tag: "tag:yaml.org,2002:int",
|
|
2108
2267
|
test: /^[-+]?[0-9]+$/,
|
|
2109
|
-
resolve: (n, e, t) =>
|
|
2110
|
-
stringify:
|
|
2111
|
-
},
|
|
2112
|
-
identify: (n) =>
|
|
2268
|
+
resolve: (n, e, t) => mt(n, 0, 10, t),
|
|
2269
|
+
stringify: F
|
|
2270
|
+
}, is = {
|
|
2271
|
+
identify: (n) => Ue(n) && n >= 0,
|
|
2113
2272
|
default: !0,
|
|
2114
2273
|
tag: "tag:yaml.org,2002:int",
|
|
2115
2274
|
format: "HEX",
|
|
2116
2275
|
test: /^0x[0-9a-fA-F]+$/,
|
|
2117
|
-
resolve: (n, e, t) =>
|
|
2118
|
-
stringify: (n) =>
|
|
2119
|
-
},
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2276
|
+
resolve: (n, e, t) => mt(n, 2, 16, t),
|
|
2277
|
+
stringify: (n) => ts(n, 16, "0x")
|
|
2278
|
+
}, Xs = [
|
|
2279
|
+
de,
|
|
2280
|
+
pe,
|
|
2281
|
+
Re,
|
|
2282
|
+
Fe,
|
|
2283
|
+
pt,
|
|
2284
|
+
ss,
|
|
2285
|
+
ns,
|
|
2286
|
+
is,
|
|
2126
2287
|
zt,
|
|
2127
2288
|
Zt,
|
|
2128
|
-
|
|
2129
|
-
Ht,
|
|
2130
|
-
Qt
|
|
2289
|
+
es
|
|
2131
2290
|
];
|
|
2132
|
-
function
|
|
2291
|
+
function It(n) {
|
|
2133
2292
|
return typeof n == "bigint" || Number.isInteger(n);
|
|
2134
2293
|
}
|
|
2135
|
-
const
|
|
2294
|
+
const Ee = ({ value: n }) => JSON.stringify(n), zs = [
|
|
2136
2295
|
{
|
|
2137
2296
|
identify: (n) => typeof n == "string",
|
|
2138
2297
|
default: !0,
|
|
2139
2298
|
tag: "tag:yaml.org,2002:str",
|
|
2140
2299
|
resolve: (n) => n,
|
|
2141
|
-
stringify:
|
|
2300
|
+
stringify: Ee
|
|
2142
2301
|
},
|
|
2143
2302
|
{
|
|
2144
2303
|
identify: (n) => n == null,
|
|
2145
|
-
createNode: () => new
|
|
2304
|
+
createNode: () => new T(null),
|
|
2146
2305
|
default: !0,
|
|
2147
2306
|
tag: "tag:yaml.org,2002:null",
|
|
2148
2307
|
test: /^null$/,
|
|
2149
2308
|
resolve: () => null,
|
|
2150
|
-
stringify:
|
|
2309
|
+
stringify: Ee
|
|
2151
2310
|
},
|
|
2152
2311
|
{
|
|
2153
2312
|
identify: (n) => typeof n == "boolean",
|
|
@@ -2155,15 +2314,15 @@ const Ie = ({ value: n }) => JSON.stringify(n), xs = [
|
|
|
2155
2314
|
tag: "tag:yaml.org,2002:bool",
|
|
2156
2315
|
test: /^true$|^false$/,
|
|
2157
2316
|
resolve: (n) => n === "true",
|
|
2158
|
-
stringify:
|
|
2317
|
+
stringify: Ee
|
|
2159
2318
|
},
|
|
2160
2319
|
{
|
|
2161
|
-
identify:
|
|
2320
|
+
identify: It,
|
|
2162
2321
|
default: !0,
|
|
2163
2322
|
tag: "tag:yaml.org,2002:int",
|
|
2164
2323
|
test: /^-?(?:0|[1-9][0-9]*)$/,
|
|
2165
2324
|
resolve: (n, e, { intAsBigInt: t }) => t ? BigInt(n) : parseInt(n, 10),
|
|
2166
|
-
stringify: ({ value: n }) =>
|
|
2325
|
+
stringify: ({ value: n }) => It(n) ? n.toString() : JSON.stringify(n)
|
|
2167
2326
|
},
|
|
2168
2327
|
{
|
|
2169
2328
|
identify: (n) => typeof n == "number",
|
|
@@ -2171,16 +2330,16 @@ const Ie = ({ value: n }) => JSON.stringify(n), xs = [
|
|
|
2171
2330
|
tag: "tag:yaml.org,2002:float",
|
|
2172
2331
|
test: /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,
|
|
2173
2332
|
resolve: (n) => parseFloat(n),
|
|
2174
|
-
stringify:
|
|
2333
|
+
stringify: Ee
|
|
2175
2334
|
}
|
|
2176
|
-
],
|
|
2335
|
+
], Zs = {
|
|
2177
2336
|
default: !0,
|
|
2178
2337
|
tag: "",
|
|
2179
2338
|
test: /^/,
|
|
2180
2339
|
resolve(n, e) {
|
|
2181
2340
|
return e(`Unresolved plain scalar ${JSON.stringify(n)}`), n;
|
|
2182
2341
|
}
|
|
2183
|
-
},
|
|
2342
|
+
}, en = [de, pe].concat(zs, Zs), gt = {
|
|
2184
2343
|
identify: (n) => n instanceof Uint8Array,
|
|
2185
2344
|
// Buffer inherits from Uint8Array
|
|
2186
2345
|
default: !1,
|
|
@@ -2214,24 +2373,24 @@ const Ie = ({ value: n }) => JSON.stringify(n), xs = [
|
|
|
2214
2373
|
a = btoa(l);
|
|
2215
2374
|
} else
|
|
2216
2375
|
throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");
|
|
2217
|
-
if (e ?? (e =
|
|
2376
|
+
if (e ?? (e = T.BLOCK_LITERAL), e !== T.QUOTE_DOUBLE) {
|
|
2218
2377
|
const l = Math.max(s.options.lineWidth - s.indent.length, s.options.minContentWidth), c = Math.ceil(a.length / l), d = new Array(c);
|
|
2219
2378
|
for (let f = 0, u = 0; f < c; ++f, u += l)
|
|
2220
2379
|
d[f] = a.substr(u, l);
|
|
2221
|
-
a = d.join(e ===
|
|
2380
|
+
a = d.join(e === T.BLOCK_LITERAL ? `
|
|
2222
2381
|
` : " ");
|
|
2223
2382
|
}
|
|
2224
|
-
return
|
|
2383
|
+
return ht({ comment: n, type: e, value: a }, s, i, r);
|
|
2225
2384
|
}
|
|
2226
2385
|
};
|
|
2227
|
-
function
|
|
2228
|
-
if (
|
|
2386
|
+
function rs(n, e) {
|
|
2387
|
+
if (Te(n))
|
|
2229
2388
|
for (let t = 0; t < n.items.length; ++t) {
|
|
2230
2389
|
let s = n.items[t];
|
|
2231
|
-
if (!
|
|
2232
|
-
if (
|
|
2390
|
+
if (!v(s)) {
|
|
2391
|
+
if (Ne(s)) {
|
|
2233
2392
|
s.items.length > 1 && e("Each pair must have its own sequence indicator");
|
|
2234
|
-
const i = s.items[0] || new P(new
|
|
2393
|
+
const i = s.items[0] || new P(new T(null));
|
|
2235
2394
|
if (s.commentBefore && (i.key.commentBefore = i.key.commentBefore ? `${s.commentBefore}
|
|
2236
2395
|
${i.key.commentBefore}` : s.commentBefore), s.comment) {
|
|
2237
2396
|
const r = i.value ?? i.key;
|
|
@@ -2240,15 +2399,15 @@ ${r.comment}` : s.comment;
|
|
|
2240
2399
|
}
|
|
2241
2400
|
s = i;
|
|
2242
2401
|
}
|
|
2243
|
-
n.items[t] =
|
|
2402
|
+
n.items[t] = v(s) ? s : new P(s);
|
|
2244
2403
|
}
|
|
2245
2404
|
}
|
|
2246
2405
|
else
|
|
2247
2406
|
e("Expected a sequence for this tag");
|
|
2248
2407
|
return n;
|
|
2249
2408
|
}
|
|
2250
|
-
function
|
|
2251
|
-
const { replacer: s } = t, i = new
|
|
2409
|
+
function os(n, e, t) {
|
|
2410
|
+
const { replacer: s } = t, i = new Z(n);
|
|
2252
2411
|
i.tag = "tag:yaml.org,2002:pairs";
|
|
2253
2412
|
let r = 0;
|
|
2254
2413
|
if (e && Symbol.iterator in Object(e))
|
|
@@ -2268,20 +2427,20 @@ function ts(n, e, t) {
|
|
|
2268
2427
|
throw new TypeError(`Expected tuple with one key, not ${c.length} keys`);
|
|
2269
2428
|
} else
|
|
2270
2429
|
a = o;
|
|
2271
|
-
i.items.push(
|
|
2430
|
+
i.items.push(dt(a, l, t));
|
|
2272
2431
|
}
|
|
2273
2432
|
return i;
|
|
2274
2433
|
}
|
|
2275
|
-
const
|
|
2434
|
+
const yt = {
|
|
2276
2435
|
collection: "seq",
|
|
2277
2436
|
default: !1,
|
|
2278
2437
|
tag: "tag:yaml.org,2002:pairs",
|
|
2279
|
-
resolve:
|
|
2280
|
-
createNode:
|
|
2438
|
+
resolve: rs,
|
|
2439
|
+
createNode: os
|
|
2281
2440
|
};
|
|
2282
|
-
class
|
|
2441
|
+
class ae extends Z {
|
|
2283
2442
|
constructor() {
|
|
2284
|
-
super(), this.add = K.prototype.add.bind(this), this.delete = K.prototype.delete.bind(this), this.get = K.prototype.get.bind(this), this.has = K.prototype.has.bind(this), this.set = K.prototype.set.bind(this), this.tag =
|
|
2443
|
+
super(), this.add = K.prototype.add.bind(this), this.delete = K.prototype.delete.bind(this), this.get = K.prototype.get.bind(this), this.has = K.prototype.has.bind(this), this.set = K.prototype.set.bind(this), this.tag = ae.tag;
|
|
2285
2444
|
}
|
|
2286
2445
|
/**
|
|
2287
2446
|
* If `ctx` is given, the return type is actually `Map<unknown, unknown>`,
|
|
@@ -2294,57 +2453,57 @@ class re extends X {
|
|
|
2294
2453
|
t?.onCreate && t.onCreate(s);
|
|
2295
2454
|
for (const i of this.items) {
|
|
2296
2455
|
let r, o;
|
|
2297
|
-
if (
|
|
2456
|
+
if (v(i) ? (r = D(i.key, "", t), o = D(i.value, r, t)) : r = D(i, "", t), s.has(r))
|
|
2298
2457
|
throw new Error("Ordered maps must not include duplicate keys");
|
|
2299
2458
|
s.set(r, o);
|
|
2300
2459
|
}
|
|
2301
2460
|
return s;
|
|
2302
2461
|
}
|
|
2303
2462
|
static from(e, t, s) {
|
|
2304
|
-
const i =
|
|
2463
|
+
const i = os(e, t, s), r = new this();
|
|
2305
2464
|
return r.items = i.items, r;
|
|
2306
2465
|
}
|
|
2307
2466
|
}
|
|
2308
|
-
|
|
2309
|
-
const
|
|
2467
|
+
ae.tag = "tag:yaml.org,2002:omap";
|
|
2468
|
+
const bt = {
|
|
2310
2469
|
collection: "seq",
|
|
2311
2470
|
identify: (n) => n instanceof Map,
|
|
2312
|
-
nodeClass:
|
|
2471
|
+
nodeClass: ae,
|
|
2313
2472
|
default: !1,
|
|
2314
2473
|
tag: "tag:yaml.org,2002:omap",
|
|
2315
2474
|
resolve(n, e) {
|
|
2316
|
-
const t =
|
|
2475
|
+
const t = rs(n, e), s = [];
|
|
2317
2476
|
for (const { key: i } of t.items)
|
|
2318
2477
|
I(i) && (s.includes(i.value) ? e(`Ordered maps must not include duplicate keys: ${i.value}`) : s.push(i.value));
|
|
2319
|
-
return Object.assign(new
|
|
2478
|
+
return Object.assign(new ae(), t);
|
|
2320
2479
|
},
|
|
2321
|
-
createNode: (n, e, t) =>
|
|
2480
|
+
createNode: (n, e, t) => ae.from(n, e, t)
|
|
2322
2481
|
};
|
|
2323
|
-
function
|
|
2324
|
-
return e && (n ?
|
|
2482
|
+
function as({ value: n, source: e }, t) {
|
|
2483
|
+
return e && (n ? ls : cs).test.test(e) ? e : n ? t.options.trueStr : t.options.falseStr;
|
|
2325
2484
|
}
|
|
2326
|
-
const
|
|
2485
|
+
const ls = {
|
|
2327
2486
|
identify: (n) => n === !0,
|
|
2328
2487
|
default: !0,
|
|
2329
2488
|
tag: "tag:yaml.org,2002:bool",
|
|
2330
2489
|
test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,
|
|
2331
|
-
resolve: () => new
|
|
2332
|
-
stringify:
|
|
2333
|
-
},
|
|
2490
|
+
resolve: () => new T(!0),
|
|
2491
|
+
stringify: as
|
|
2492
|
+
}, cs = {
|
|
2334
2493
|
identify: (n) => n === !1,
|
|
2335
2494
|
default: !0,
|
|
2336
2495
|
tag: "tag:yaml.org,2002:bool",
|
|
2337
2496
|
test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,
|
|
2338
|
-
resolve: () => new
|
|
2339
|
-
stringify:
|
|
2340
|
-
},
|
|
2497
|
+
resolve: () => new T(!1),
|
|
2498
|
+
stringify: as
|
|
2499
|
+
}, tn = {
|
|
2341
2500
|
identify: (n) => typeof n == "number",
|
|
2342
2501
|
default: !0,
|
|
2343
2502
|
tag: "tag:yaml.org,2002:float",
|
|
2344
2503
|
test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
|
|
2345
2504
|
resolve: (n) => n.slice(-3).toLowerCase() === "nan" ? NaN : n[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
|
|
2346
|
-
stringify:
|
|
2347
|
-
},
|
|
2505
|
+
stringify: F
|
|
2506
|
+
}, sn = {
|
|
2348
2507
|
identify: (n) => typeof n == "number",
|
|
2349
2508
|
default: !0,
|
|
2350
2509
|
tag: "tag:yaml.org,2002:float",
|
|
@@ -2353,24 +2512,24 @@ const ns = {
|
|
|
2353
2512
|
resolve: (n) => parseFloat(n.replace(/_/g, "")),
|
|
2354
2513
|
stringify(n) {
|
|
2355
2514
|
const e = Number(n.value);
|
|
2356
|
-
return isFinite(e) ? e.toExponential() :
|
|
2515
|
+
return isFinite(e) ? e.toExponential() : F(n);
|
|
2357
2516
|
}
|
|
2358
|
-
},
|
|
2517
|
+
}, nn = {
|
|
2359
2518
|
identify: (n) => typeof n == "number",
|
|
2360
2519
|
default: !0,
|
|
2361
2520
|
tag: "tag:yaml.org,2002:float",
|
|
2362
2521
|
test: /^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,
|
|
2363
2522
|
resolve(n) {
|
|
2364
|
-
const e = new
|
|
2523
|
+
const e = new T(parseFloat(n.replace(/_/g, ""))), t = n.indexOf(".");
|
|
2365
2524
|
if (t !== -1) {
|
|
2366
2525
|
const s = n.substring(t + 1).replace(/_/g, "");
|
|
2367
2526
|
s[s.length - 1] === "0" && (e.minFractionDigits = s.length);
|
|
2368
2527
|
}
|
|
2369
2528
|
return e;
|
|
2370
2529
|
},
|
|
2371
|
-
stringify:
|
|
2372
|
-
},
|
|
2373
|
-
function
|
|
2530
|
+
stringify: F
|
|
2531
|
+
}, Ae = (n) => typeof n == "bigint" || Number.isInteger(n);
|
|
2532
|
+
function xe(n, e, t, { intAsBigInt: s }) {
|
|
2374
2533
|
const i = n[0];
|
|
2375
2534
|
if ((i === "-" || i === "+") && (e += 1), n = n.substring(e).replace(/_/g, ""), s) {
|
|
2376
2535
|
switch (t) {
|
|
@@ -2390,66 +2549,66 @@ function Fe(n, e, t, { intAsBigInt: s }) {
|
|
|
2390
2549
|
const r = parseInt(n, t);
|
|
2391
2550
|
return i === "-" ? -1 * r : r;
|
|
2392
2551
|
}
|
|
2393
|
-
function
|
|
2552
|
+
function wt(n, e, t) {
|
|
2394
2553
|
const { value: s } = n;
|
|
2395
|
-
if (
|
|
2554
|
+
if (Ae(s)) {
|
|
2396
2555
|
const i = s.toString(e);
|
|
2397
2556
|
return s < 0 ? "-" + t + i.substr(1) : t + i;
|
|
2398
2557
|
}
|
|
2399
|
-
return
|
|
2558
|
+
return F(n);
|
|
2400
2559
|
}
|
|
2401
|
-
const
|
|
2402
|
-
identify:
|
|
2560
|
+
const rn = {
|
|
2561
|
+
identify: Ae,
|
|
2403
2562
|
default: !0,
|
|
2404
2563
|
tag: "tag:yaml.org,2002:int",
|
|
2405
2564
|
format: "BIN",
|
|
2406
2565
|
test: /^[-+]?0b[0-1_]+$/,
|
|
2407
|
-
resolve: (n, e, t) =>
|
|
2408
|
-
stringify: (n) =>
|
|
2409
|
-
},
|
|
2410
|
-
identify:
|
|
2566
|
+
resolve: (n, e, t) => xe(n, 2, 2, t),
|
|
2567
|
+
stringify: (n) => wt(n, 2, "0b")
|
|
2568
|
+
}, on = {
|
|
2569
|
+
identify: Ae,
|
|
2411
2570
|
default: !0,
|
|
2412
2571
|
tag: "tag:yaml.org,2002:int",
|
|
2413
2572
|
format: "OCT",
|
|
2414
2573
|
test: /^[-+]?0[0-7_]+$/,
|
|
2415
|
-
resolve: (n, e, t) =>
|
|
2416
|
-
stringify: (n) =>
|
|
2417
|
-
},
|
|
2418
|
-
identify:
|
|
2574
|
+
resolve: (n, e, t) => xe(n, 1, 8, t),
|
|
2575
|
+
stringify: (n) => wt(n, 8, "0")
|
|
2576
|
+
}, an = {
|
|
2577
|
+
identify: Ae,
|
|
2419
2578
|
default: !0,
|
|
2420
2579
|
tag: "tag:yaml.org,2002:int",
|
|
2421
2580
|
test: /^[-+]?[0-9][0-9_]*$/,
|
|
2422
|
-
resolve: (n, e, t) =>
|
|
2423
|
-
stringify:
|
|
2424
|
-
},
|
|
2425
|
-
identify:
|
|
2581
|
+
resolve: (n, e, t) => xe(n, 0, 10, t),
|
|
2582
|
+
stringify: F
|
|
2583
|
+
}, ln = {
|
|
2584
|
+
identify: Ae,
|
|
2426
2585
|
default: !0,
|
|
2427
2586
|
tag: "tag:yaml.org,2002:int",
|
|
2428
2587
|
format: "HEX",
|
|
2429
2588
|
test: /^[-+]?0x[0-9a-fA-F_]+$/,
|
|
2430
|
-
resolve: (n, e, t) =>
|
|
2431
|
-
stringify: (n) =>
|
|
2589
|
+
resolve: (n, e, t) => xe(n, 2, 16, t),
|
|
2590
|
+
stringify: (n) => wt(n, 16, "0x")
|
|
2432
2591
|
};
|
|
2433
|
-
class
|
|
2592
|
+
class le extends K {
|
|
2434
2593
|
constructor(e) {
|
|
2435
|
-
super(e), this.tag =
|
|
2594
|
+
super(e), this.tag = le.tag;
|
|
2436
2595
|
}
|
|
2437
2596
|
add(e) {
|
|
2438
2597
|
let t;
|
|
2439
|
-
|
|
2598
|
+
v(e) ? t = e : e && typeof e == "object" && "key" in e && "value" in e && e.value === null ? t = new P(e.key, null) : t = new P(e, null), z(this.items, t.key) || this.items.push(t);
|
|
2440
2599
|
}
|
|
2441
2600
|
/**
|
|
2442
2601
|
* If `keepPair` is `true`, returns the Pair matching `key`.
|
|
2443
2602
|
* Otherwise, returns the value of that Pair's key.
|
|
2444
2603
|
*/
|
|
2445
2604
|
get(e, t) {
|
|
2446
|
-
const s =
|
|
2447
|
-
return !t &&
|
|
2605
|
+
const s = z(this.items, e);
|
|
2606
|
+
return !t && v(s) ? I(s.key) ? s.key.value : s.key : s;
|
|
2448
2607
|
}
|
|
2449
2608
|
set(e, t) {
|
|
2450
2609
|
if (typeof t != "boolean")
|
|
2451
2610
|
throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);
|
|
2452
|
-
const s =
|
|
2611
|
+
const s = z(this.items, e);
|
|
2453
2612
|
s && !t ? this.items.splice(this.items.indexOf(s), 1) : !s && t && this.items.push(new P(e));
|
|
2454
2613
|
}
|
|
2455
2614
|
toJSON(e, t) {
|
|
@@ -2466,60 +2625,60 @@ class oe extends K {
|
|
|
2466
2625
|
const { replacer: i } = s, r = new this(e);
|
|
2467
2626
|
if (t && Symbol.iterator in Object(t))
|
|
2468
2627
|
for (let o of t)
|
|
2469
|
-
typeof i == "function" && (o = i.call(t, o, o)), r.items.push(
|
|
2628
|
+
typeof i == "function" && (o = i.call(t, o, o)), r.items.push(dt(o, null, s));
|
|
2470
2629
|
return r;
|
|
2471
2630
|
}
|
|
2472
2631
|
}
|
|
2473
|
-
|
|
2474
|
-
const
|
|
2632
|
+
le.tag = "tag:yaml.org,2002:set";
|
|
2633
|
+
const kt = {
|
|
2475
2634
|
collection: "map",
|
|
2476
2635
|
identify: (n) => n instanceof Set,
|
|
2477
|
-
nodeClass:
|
|
2636
|
+
nodeClass: le,
|
|
2478
2637
|
default: !1,
|
|
2479
2638
|
tag: "tag:yaml.org,2002:set",
|
|
2480
|
-
createNode: (n, e, t) =>
|
|
2639
|
+
createNode: (n, e, t) => le.from(n, e, t),
|
|
2481
2640
|
resolve(n, e) {
|
|
2482
|
-
if (
|
|
2641
|
+
if (Ne(n)) {
|
|
2483
2642
|
if (n.hasAllNullValues(!0))
|
|
2484
|
-
return Object.assign(new
|
|
2643
|
+
return Object.assign(new le(), n);
|
|
2485
2644
|
e("Set items must all have null values");
|
|
2486
2645
|
} else
|
|
2487
2646
|
e("Expected a mapping for this tag");
|
|
2488
2647
|
return n;
|
|
2489
2648
|
}
|
|
2490
2649
|
};
|
|
2491
|
-
function
|
|
2650
|
+
function St(n, e) {
|
|
2492
2651
|
const t = n[0], s = t === "-" || t === "+" ? n.substring(1) : n, i = (o) => e ? BigInt(o) : Number(o), r = s.replace(/_/g, "").split(":").reduce((o, a) => o * i(60) + i(a), i(0));
|
|
2493
2652
|
return t === "-" ? i(-1) * r : r;
|
|
2494
2653
|
}
|
|
2495
|
-
function
|
|
2654
|
+
function fs(n) {
|
|
2496
2655
|
let { value: e } = n, t = (o) => o;
|
|
2497
2656
|
if (typeof e == "bigint")
|
|
2498
2657
|
t = (o) => BigInt(o);
|
|
2499
2658
|
else if (isNaN(e) || !isFinite(e))
|
|
2500
|
-
return
|
|
2659
|
+
return F(n);
|
|
2501
2660
|
let s = "";
|
|
2502
2661
|
e < 0 && (s = "-", e *= t(-1));
|
|
2503
2662
|
const i = t(60), r = [e % i];
|
|
2504
2663
|
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))), s + r.map((o) => String(o).padStart(2, "0")).join(":").replace(/000000\d*$/, "");
|
|
2505
2664
|
}
|
|
2506
|
-
const
|
|
2665
|
+
const us = {
|
|
2507
2666
|
identify: (n) => typeof n == "bigint" || Number.isInteger(n),
|
|
2508
2667
|
default: !0,
|
|
2509
2668
|
tag: "tag:yaml.org,2002:int",
|
|
2510
2669
|
format: "TIME",
|
|
2511
2670
|
test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,
|
|
2512
|
-
resolve: (n, e, { intAsBigInt: t }) =>
|
|
2513
|
-
stringify:
|
|
2514
|
-
},
|
|
2671
|
+
resolve: (n, e, { intAsBigInt: t }) => St(n, t),
|
|
2672
|
+
stringify: fs
|
|
2673
|
+
}, hs = {
|
|
2515
2674
|
identify: (n) => typeof n == "number",
|
|
2516
2675
|
default: !0,
|
|
2517
2676
|
tag: "tag:yaml.org,2002:float",
|
|
2518
2677
|
format: "TIME",
|
|
2519
2678
|
test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,
|
|
2520
|
-
resolve: (n) =>
|
|
2521
|
-
stringify:
|
|
2522
|
-
},
|
|
2679
|
+
resolve: (n) => St(n, !1),
|
|
2680
|
+
stringify: fs
|
|
2681
|
+
}, Ve = {
|
|
2523
2682
|
identify: (n) => n instanceof Date,
|
|
2524
2683
|
default: !0,
|
|
2525
2684
|
tag: "tag:yaml.org,2002:timestamp",
|
|
@@ -2528,110 +2687,110 @@ const os = {
|
|
|
2528
2687
|
// assumed to be 00:00:00Z (start of day, UTC).
|
|
2529
2688
|
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})?))?)?$"),
|
|
2530
2689
|
resolve(n) {
|
|
2531
|
-
const e = n.match(
|
|
2690
|
+
const e = n.match(Ve.test);
|
|
2532
2691
|
if (!e)
|
|
2533
2692
|
throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");
|
|
2534
2693
|
const [, t, s, i, r, o, a] = e.map(Number), l = e[7] ? Number((e[7] + "00").substr(1, 3)) : 0;
|
|
2535
2694
|
let c = Date.UTC(t, s - 1, i, r || 0, o || 0, a || 0, l);
|
|
2536
2695
|
const d = e[8];
|
|
2537
2696
|
if (d && d !== "Z") {
|
|
2538
|
-
let f =
|
|
2697
|
+
let f = St(d, !1);
|
|
2539
2698
|
Math.abs(f) < 30 && (f *= 60), c -= 6e4 * f;
|
|
2540
2699
|
}
|
|
2541
2700
|
return new Date(c);
|
|
2542
2701
|
},
|
|
2543
2702
|
stringify: ({ value: n }) => n?.toISOString().replace(/(T00:00:00)?\.000Z$/, "") ?? ""
|
|
2544
|
-
},
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
],
|
|
2567
|
-
["core",
|
|
2568
|
-
["failsafe", [
|
|
2569
|
-
["json",
|
|
2570
|
-
["yaml11",
|
|
2571
|
-
["yaml-1.1",
|
|
2572
|
-
]),
|
|
2573
|
-
binary:
|
|
2574
|
-
bool:
|
|
2575
|
-
float:
|
|
2576
|
-
floatExp:
|
|
2577
|
-
floatNaN:
|
|
2578
|
-
floatTime:
|
|
2579
|
-
int:
|
|
2580
|
-
intHex:
|
|
2581
|
-
intOct:
|
|
2582
|
-
intTime:
|
|
2583
|
-
map:
|
|
2584
|
-
merge:
|
|
2585
|
-
null:
|
|
2586
|
-
omap:
|
|
2587
|
-
pairs:
|
|
2588
|
-
seq:
|
|
2589
|
-
set:
|
|
2590
|
-
timestamp:
|
|
2591
|
-
},
|
|
2592
|
-
"tag:yaml.org,2002:binary":
|
|
2593
|
-
"tag:yaml.org,2002:merge":
|
|
2594
|
-
"tag:yaml.org,2002:omap":
|
|
2595
|
-
"tag:yaml.org,2002:pairs":
|
|
2596
|
-
"tag:yaml.org,2002:set":
|
|
2597
|
-
"tag:yaml.org,2002:timestamp":
|
|
2703
|
+
}, $t = [
|
|
2704
|
+
de,
|
|
2705
|
+
pe,
|
|
2706
|
+
Re,
|
|
2707
|
+
Fe,
|
|
2708
|
+
ls,
|
|
2709
|
+
cs,
|
|
2710
|
+
rn,
|
|
2711
|
+
on,
|
|
2712
|
+
an,
|
|
2713
|
+
ln,
|
|
2714
|
+
tn,
|
|
2715
|
+
sn,
|
|
2716
|
+
nn,
|
|
2717
|
+
gt,
|
|
2718
|
+
Y,
|
|
2719
|
+
bt,
|
|
2720
|
+
yt,
|
|
2721
|
+
kt,
|
|
2722
|
+
us,
|
|
2723
|
+
hs,
|
|
2724
|
+
Ve
|
|
2725
|
+
], Et = /* @__PURE__ */ new Map([
|
|
2726
|
+
["core", Xs],
|
|
2727
|
+
["failsafe", [de, pe, Re]],
|
|
2728
|
+
["json", en],
|
|
2729
|
+
["yaml11", $t],
|
|
2730
|
+
["yaml-1.1", $t]
|
|
2731
|
+
]), Lt = {
|
|
2732
|
+
binary: gt,
|
|
2733
|
+
bool: pt,
|
|
2734
|
+
float: es,
|
|
2735
|
+
floatExp: Zt,
|
|
2736
|
+
floatNaN: zt,
|
|
2737
|
+
floatTime: hs,
|
|
2738
|
+
int: ns,
|
|
2739
|
+
intHex: is,
|
|
2740
|
+
intOct: ss,
|
|
2741
|
+
intTime: us,
|
|
2742
|
+
map: de,
|
|
2743
|
+
merge: Y,
|
|
2744
|
+
null: Fe,
|
|
2745
|
+
omap: bt,
|
|
2746
|
+
pairs: yt,
|
|
2747
|
+
seq: pe,
|
|
2748
|
+
set: kt,
|
|
2749
|
+
timestamp: Ve
|
|
2750
|
+
}, cn = {
|
|
2751
|
+
"tag:yaml.org,2002:binary": gt,
|
|
2752
|
+
"tag:yaml.org,2002:merge": Y,
|
|
2753
|
+
"tag:yaml.org,2002:omap": bt,
|
|
2754
|
+
"tag:yaml.org,2002:pairs": yt,
|
|
2755
|
+
"tag:yaml.org,2002:set": kt,
|
|
2756
|
+
"tag:yaml.org,2002:timestamp": Ve
|
|
2598
2757
|
};
|
|
2599
|
-
function
|
|
2600
|
-
const s =
|
|
2758
|
+
function Qe(n, e, t) {
|
|
2759
|
+
const s = Et.get(e);
|
|
2601
2760
|
if (s && !n)
|
|
2602
|
-
return t && !s.includes(
|
|
2761
|
+
return t && !s.includes(Y) ? s.concat(Y) : s.slice();
|
|
2603
2762
|
let i = s;
|
|
2604
2763
|
if (!i)
|
|
2605
2764
|
if (Array.isArray(n))
|
|
2606
2765
|
i = [];
|
|
2607
2766
|
else {
|
|
2608
|
-
const r = Array.from(
|
|
2767
|
+
const r = Array.from(Et.keys()).filter((o) => o !== "yaml11").map((o) => JSON.stringify(o)).join(", ");
|
|
2609
2768
|
throw new Error(`Unknown schema "${e}"; use one of ${r} or define customTags array`);
|
|
2610
2769
|
}
|
|
2611
2770
|
if (Array.isArray(n))
|
|
2612
2771
|
for (const r of n)
|
|
2613
2772
|
i = i.concat(r);
|
|
2614
2773
|
else typeof n == "function" && (i = n(i.slice()));
|
|
2615
|
-
return t && (i = i.concat(
|
|
2616
|
-
const a = typeof o == "string" ?
|
|
2774
|
+
return t && (i = i.concat(Y)), i.reduce((r, o) => {
|
|
2775
|
+
const a = typeof o == "string" ? Lt[o] : o;
|
|
2617
2776
|
if (!a) {
|
|
2618
|
-
const l = JSON.stringify(o), c = Object.keys(
|
|
2777
|
+
const l = JSON.stringify(o), c = Object.keys(Lt).map((d) => JSON.stringify(d)).join(", ");
|
|
2619
2778
|
throw new Error(`Unknown custom tag ${l}; use one of ${c}`);
|
|
2620
2779
|
}
|
|
2621
2780
|
return r.includes(a) || r.push(a), r;
|
|
2622
2781
|
}, []);
|
|
2623
2782
|
}
|
|
2624
|
-
const
|
|
2625
|
-
class
|
|
2783
|
+
const fn = (n, e) => n.key < e.key ? -1 : n.key > e.key ? 1 : 0;
|
|
2784
|
+
class Nt {
|
|
2626
2785
|
constructor({ compat: e, customTags: t, merge: s, resolveKnownTags: i, schema: r, sortMapEntries: o, toStringDefaults: a }) {
|
|
2627
|
-
this.compat = Array.isArray(e) ?
|
|
2786
|
+
this.compat = Array.isArray(e) ? Qe(e, "compat") : e ? Qe(null, e) : null, this.name = typeof r == "string" && r || "core", this.knownTags = i ? cn : {}, this.tags = Qe(t, this.name, s), this.toStringOptions = a ?? null, Object.defineProperty(this, Q, { value: de }), Object.defineProperty(this, x, { value: Re }), Object.defineProperty(this, ue, { value: pe }), this.sortMapEntries = typeof o == "function" ? o : o === !0 ? fn : null;
|
|
2628
2787
|
}
|
|
2629
2788
|
clone() {
|
|
2630
|
-
const e = Object.create(
|
|
2789
|
+
const e = Object.create(Nt.prototype, Object.getOwnPropertyDescriptors(this));
|
|
2631
2790
|
return e.tags = this.tags.slice(), e;
|
|
2632
2791
|
}
|
|
2633
2792
|
}
|
|
2634
|
-
function
|
|
2793
|
+
function un(n, e) {
|
|
2635
2794
|
const t = [];
|
|
2636
2795
|
let s = e.directives === !0;
|
|
2637
2796
|
if (e.directives !== !1 && n.directives) {
|
|
@@ -2639,44 +2798,44 @@ function sn(n, e) {
|
|
|
2639
2798
|
l ? (t.push(l), s = !0) : n.directives.docStart && (s = !0);
|
|
2640
2799
|
}
|
|
2641
2800
|
s && t.push("---");
|
|
2642
|
-
const i =
|
|
2801
|
+
const i = Ht(n, e), { commentString: r } = i.options;
|
|
2643
2802
|
if (n.commentBefore) {
|
|
2644
2803
|
t.length !== 1 && t.unshift("");
|
|
2645
2804
|
const l = r(n.commentBefore);
|
|
2646
|
-
t.unshift(
|
|
2805
|
+
t.unshift(J(l, ""));
|
|
2647
2806
|
}
|
|
2648
2807
|
let o = !1, a = null;
|
|
2649
2808
|
if (n.contents) {
|
|
2650
2809
|
if (L(n.contents)) {
|
|
2651
2810
|
if (n.contents.spaceBefore && s && t.push(""), n.contents.commentBefore) {
|
|
2652
2811
|
const d = r(n.contents.commentBefore);
|
|
2653
|
-
t.push(
|
|
2812
|
+
t.push(J(d, ""));
|
|
2654
2813
|
}
|
|
2655
2814
|
i.forceBlockIndent = !!n.comment, a = n.contents.comment;
|
|
2656
2815
|
}
|
|
2657
2816
|
const l = a ? void 0 : () => o = !0;
|
|
2658
|
-
let c =
|
|
2659
|
-
a && (c +=
|
|
2817
|
+
let c = ce(n.contents, i, () => a = null, l);
|
|
2818
|
+
a && (c += X(c, "", r(a))), (c[0] === "|" || c[0] === ">") && t[t.length - 1] === "---" ? t[t.length - 1] = `--- ${c}` : t.push(c);
|
|
2660
2819
|
} else
|
|
2661
|
-
t.push(
|
|
2820
|
+
t.push(ce(n.contents, i));
|
|
2662
2821
|
if (n.directives?.docEnd)
|
|
2663
2822
|
if (n.comment) {
|
|
2664
2823
|
const l = r(n.comment);
|
|
2665
2824
|
l.includes(`
|
|
2666
|
-
`) ? (t.push("..."), t.push(
|
|
2825
|
+
`) ? (t.push("..."), t.push(J(l, ""))) : t.push(`... ${l}`);
|
|
2667
2826
|
} else
|
|
2668
2827
|
t.push("...");
|
|
2669
2828
|
else {
|
|
2670
2829
|
let l = n.comment;
|
|
2671
|
-
l && o && (l = l.replace(/^\n+/, "")), l && ((!o || a) && t[t.length - 1] !== "" && t.push(""), t.push(
|
|
2830
|
+
l && o && (l = l.replace(/^\n+/, "")), l && ((!o || a) && t[t.length - 1] !== "" && t.push(""), t.push(J(r(l), "")));
|
|
2672
2831
|
}
|
|
2673
2832
|
return t.join(`
|
|
2674
2833
|
`) + `
|
|
2675
2834
|
`;
|
|
2676
2835
|
}
|
|
2677
|
-
class
|
|
2836
|
+
class Je {
|
|
2678
2837
|
constructor(e, t, s) {
|
|
2679
|
-
this.commentBefore = null, this.comment = null, this.errors = [], this.warnings = [], Object.defineProperty(this, j, { value:
|
|
2838
|
+
this.commentBefore = null, this.comment = null, this.errors = [], this.warnings = [], Object.defineProperty(this, j, { value: et });
|
|
2680
2839
|
let i = null;
|
|
2681
2840
|
typeof t == "function" || Array.isArray(t) ? i = t : s === void 0 && t && (s = t, t = void 0);
|
|
2682
2841
|
const r = Object.assign({
|
|
@@ -2691,7 +2850,7 @@ class Ve {
|
|
|
2691
2850
|
}, s);
|
|
2692
2851
|
this.options = r;
|
|
2693
2852
|
let { version: o } = r;
|
|
2694
|
-
s?._directives ? (this.directives = s._directives.atDocument(), this.directives.yaml.explicit && (o = this.directives.yaml.version)) : this.directives = new
|
|
2853
|
+
s?._directives ? (this.directives = s._directives.atDocument(), this.directives.yaml.explicit && (o = this.directives.yaml.version)) : this.directives = new B({ version: o }), this.setSchema(o, s), this.contents = e === void 0 ? null : this.createNode(e, i, s);
|
|
2695
2854
|
}
|
|
2696
2855
|
/**
|
|
2697
2856
|
* Create a deep copy of this Document and its contents.
|
|
@@ -2699,18 +2858,18 @@ class Ve {
|
|
|
2699
2858
|
* Custom Node values that inherit from `Object` still refer to their original instances.
|
|
2700
2859
|
*/
|
|
2701
2860
|
clone() {
|
|
2702
|
-
const e = Object.create(
|
|
2703
|
-
[j]: { value:
|
|
2861
|
+
const e = Object.create(Je.prototype, {
|
|
2862
|
+
[j]: { value: et }
|
|
2704
2863
|
});
|
|
2705
2864
|
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 = L(this.contents) ? this.contents.clone(e.schema) : this.contents, this.range && (e.range = this.range.slice()), e;
|
|
2706
2865
|
}
|
|
2707
2866
|
/** Adds a value to the document. */
|
|
2708
2867
|
add(e) {
|
|
2709
|
-
|
|
2868
|
+
se(this.contents) && this.contents.add(e);
|
|
2710
2869
|
}
|
|
2711
2870
|
/** Adds a value to the document. */
|
|
2712
2871
|
addIn(e, t) {
|
|
2713
|
-
|
|
2872
|
+
se(this.contents) && this.contents.addIn(e, t);
|
|
2714
2873
|
}
|
|
2715
2874
|
/**
|
|
2716
2875
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -2723,11 +2882,11 @@ class Ve {
|
|
|
2723
2882
|
*/
|
|
2724
2883
|
createAlias(e, t) {
|
|
2725
2884
|
if (!e.anchor) {
|
|
2726
|
-
const s =
|
|
2885
|
+
const s = xt(this);
|
|
2727
2886
|
e.anchor = // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
2728
|
-
!t || s.has(t) ?
|
|
2887
|
+
!t || s.has(t) ? Vt(t || "a", s) : t;
|
|
2729
2888
|
}
|
|
2730
|
-
return new
|
|
2889
|
+
return new ut(e.anchor);
|
|
2731
2890
|
}
|
|
2732
2891
|
createNode(e, t, s) {
|
|
2733
2892
|
let i;
|
|
@@ -2737,7 +2896,7 @@ class Ve {
|
|
|
2737
2896
|
const p = (w) => typeof w == "number" || w instanceof String || w instanceof Number, b = t.filter(p).map(String);
|
|
2738
2897
|
b.length > 0 && (t = t.concat(b)), i = t;
|
|
2739
2898
|
} else s === void 0 && t && (s = t, t = void 0);
|
|
2740
|
-
const { aliasDuplicateObjects: r, anchorPrefix: o, flow: a, keepUndefined: l, onTagObj: c, tag: d } = s ?? {}, { onAnchor: f, setAnchors: u, sourceObjects: m } =
|
|
2899
|
+
const { aliasDuplicateObjects: r, anchorPrefix: o, flow: a, keepUndefined: l, onTagObj: c, tag: d } = s ?? {}, { onAnchor: f, setAnchors: u, sourceObjects: m } = Ds(
|
|
2741
2900
|
this,
|
|
2742
2901
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
2743
2902
|
o || "a"
|
|
@@ -2749,8 +2908,8 @@ class Ve {
|
|
|
2749
2908
|
replacer: i,
|
|
2750
2909
|
schema: this.schema,
|
|
2751
2910
|
sourceObjects: m
|
|
2752
|
-
}, h =
|
|
2753
|
-
return a &&
|
|
2911
|
+
}, h = ke(e, d, g);
|
|
2912
|
+
return a && E(h) && (h.flow = !0), u(), h;
|
|
2754
2913
|
}
|
|
2755
2914
|
/**
|
|
2756
2915
|
* Convert a key and a value into a `Pair` using the current schema,
|
|
@@ -2765,14 +2924,14 @@ class Ve {
|
|
|
2765
2924
|
* @returns `true` if the item was found and removed.
|
|
2766
2925
|
*/
|
|
2767
2926
|
delete(e) {
|
|
2768
|
-
return
|
|
2927
|
+
return se(this.contents) ? this.contents.delete(e) : !1;
|
|
2769
2928
|
}
|
|
2770
2929
|
/**
|
|
2771
2930
|
* Removes a value from the document.
|
|
2772
2931
|
* @returns `true` if the item was found and removed.
|
|
2773
2932
|
*/
|
|
2774
2933
|
deleteIn(e) {
|
|
2775
|
-
return
|
|
2934
|
+
return ge(e) ? this.contents == null ? !1 : (this.contents = null, !0) : se(this.contents) ? this.contents.deleteIn(e) : !1;
|
|
2776
2935
|
}
|
|
2777
2936
|
/**
|
|
2778
2937
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -2780,7 +2939,7 @@ class Ve {
|
|
|
2780
2939
|
* `true` (collections are always returned intact).
|
|
2781
2940
|
*/
|
|
2782
2941
|
get(e, t) {
|
|
2783
|
-
return
|
|
2942
|
+
return E(this.contents) ? this.contents.get(e, t) : void 0;
|
|
2784
2943
|
}
|
|
2785
2944
|
/**
|
|
2786
2945
|
* Returns item at `path`, or `undefined` if not found. By default unwraps
|
|
@@ -2788,33 +2947,33 @@ class Ve {
|
|
|
2788
2947
|
* `true` (collections are always returned intact).
|
|
2789
2948
|
*/
|
|
2790
2949
|
getIn(e, t) {
|
|
2791
|
-
return
|
|
2950
|
+
return ge(e) ? !t && I(this.contents) ? this.contents.value : this.contents : E(this.contents) ? this.contents.getIn(e, t) : void 0;
|
|
2792
2951
|
}
|
|
2793
2952
|
/**
|
|
2794
2953
|
* Checks if the document includes a value with the key `key`.
|
|
2795
2954
|
*/
|
|
2796
2955
|
has(e) {
|
|
2797
|
-
return
|
|
2956
|
+
return E(this.contents) ? this.contents.has(e) : !1;
|
|
2798
2957
|
}
|
|
2799
2958
|
/**
|
|
2800
2959
|
* Checks if the document includes a value at `path`.
|
|
2801
2960
|
*/
|
|
2802
2961
|
hasIn(e) {
|
|
2803
|
-
return
|
|
2962
|
+
return ge(e) ? this.contents !== void 0 : E(this.contents) ? this.contents.hasIn(e) : !1;
|
|
2804
2963
|
}
|
|
2805
2964
|
/**
|
|
2806
2965
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
2807
2966
|
* boolean to add/remove the item from the set.
|
|
2808
2967
|
*/
|
|
2809
2968
|
set(e, t) {
|
|
2810
|
-
this.contents == null ? this.contents =
|
|
2969
|
+
this.contents == null ? this.contents = Be(this.schema, [e], t) : se(this.contents) && this.contents.set(e, t);
|
|
2811
2970
|
}
|
|
2812
2971
|
/**
|
|
2813
2972
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
2814
2973
|
* boolean to add/remove the item from the set.
|
|
2815
2974
|
*/
|
|
2816
2975
|
setIn(e, t) {
|
|
2817
|
-
|
|
2976
|
+
ge(e) ? this.contents = t : this.contents == null ? this.contents = Be(this.schema, Array.from(e), t) : se(this.contents) && this.contents.setIn(e, t);
|
|
2818
2977
|
}
|
|
2819
2978
|
/**
|
|
2820
2979
|
* Change the YAML version and schema used by the document.
|
|
@@ -2828,11 +2987,11 @@ class Ve {
|
|
|
2828
2987
|
let s;
|
|
2829
2988
|
switch (e) {
|
|
2830
2989
|
case "1.1":
|
|
2831
|
-
this.directives ? this.directives.yaml.version = "1.1" : this.directives = new
|
|
2990
|
+
this.directives ? this.directives.yaml.version = "1.1" : this.directives = new B({ version: "1.1" }), s = { resolveKnownTags: !1, schema: "yaml-1.1" };
|
|
2832
2991
|
break;
|
|
2833
2992
|
case "1.2":
|
|
2834
2993
|
case "next":
|
|
2835
|
-
this.directives ? this.directives.yaml.version = e : this.directives = new
|
|
2994
|
+
this.directives ? this.directives.yaml.version = e : this.directives = new B({ version: e }), s = { resolveKnownTags: !0, schema: "core" };
|
|
2836
2995
|
break;
|
|
2837
2996
|
case null:
|
|
2838
2997
|
this.directives && delete this.directives, s = null;
|
|
@@ -2845,7 +3004,7 @@ class Ve {
|
|
|
2845
3004
|
if (t.schema instanceof Object)
|
|
2846
3005
|
this.schema = t.schema;
|
|
2847
3006
|
else if (s)
|
|
2848
|
-
this.schema = new
|
|
3007
|
+
this.schema = new Nt(Object.assign(s, t));
|
|
2849
3008
|
else
|
|
2850
3009
|
throw new Error("With a null YAML version, the { schema: Schema } option is required");
|
|
2851
3010
|
}
|
|
@@ -2862,7 +3021,7 @@ class Ve {
|
|
|
2862
3021
|
if (typeof r == "function")
|
|
2863
3022
|
for (const { count: c, res: d } of a.anchors.values())
|
|
2864
3023
|
r(d, c);
|
|
2865
|
-
return typeof o == "function" ?
|
|
3024
|
+
return typeof o == "function" ? re(o, { "": l }, "", l) : l;
|
|
2866
3025
|
}
|
|
2867
3026
|
/**
|
|
2868
3027
|
* A JSON representation of the document `contents`.
|
|
@@ -2881,30 +3040,30 @@ class Ve {
|
|
|
2881
3040
|
const t = JSON.stringify(e.indent);
|
|
2882
3041
|
throw new Error(`"indent" option must be a positive integer, not ${t}`);
|
|
2883
3042
|
}
|
|
2884
|
-
return
|
|
3043
|
+
return un(this, e);
|
|
2885
3044
|
}
|
|
2886
3045
|
}
|
|
2887
|
-
function
|
|
2888
|
-
if (
|
|
3046
|
+
function se(n) {
|
|
3047
|
+
if (E(n))
|
|
2889
3048
|
return !0;
|
|
2890
3049
|
throw new Error("Expected a YAML collection as document contents");
|
|
2891
3050
|
}
|
|
2892
|
-
class
|
|
3051
|
+
class ds extends Error {
|
|
2893
3052
|
constructor(e, t, s, i) {
|
|
2894
3053
|
super(), this.name = e, this.code = s, this.message = i, this.pos = t;
|
|
2895
3054
|
}
|
|
2896
3055
|
}
|
|
2897
|
-
class
|
|
3056
|
+
class ye extends ds {
|
|
2898
3057
|
constructor(e, t, s) {
|
|
2899
3058
|
super("YAMLParseError", e, t, s);
|
|
2900
3059
|
}
|
|
2901
3060
|
}
|
|
2902
|
-
class
|
|
3061
|
+
class hn extends ds {
|
|
2903
3062
|
constructor(e, t, s) {
|
|
2904
3063
|
super("YAMLWarning", e, t, s);
|
|
2905
3064
|
}
|
|
2906
3065
|
}
|
|
2907
|
-
const
|
|
3066
|
+
const vt = (n, e) => (t) => {
|
|
2908
3067
|
if (t.pos[0] === -1)
|
|
2909
3068
|
return;
|
|
2910
3069
|
t.linePos = t.pos.map((a) => e.linePos(a));
|
|
@@ -2932,7 +3091,7 @@ ${c}
|
|
|
2932
3091
|
`;
|
|
2933
3092
|
}
|
|
2934
3093
|
};
|
|
2935
|
-
function
|
|
3094
|
+
function fe(n, { flow: e, indicator: t, next: s, offset: i, onError: r, parentIndent: o, startOnNewline: a }) {
|
|
2936
3095
|
let l = !1, c = a, d = a, f = "", u = "", m = !1, g = !1, h = null, p = null, b = null, w = null, k = null, S = null, N = null;
|
|
2937
3096
|
for (const y of n)
|
|
2938
3097
|
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) {
|
|
@@ -2967,7 +3126,7 @@ function le(n, { flow: e, indicator: t, next: s, offset: i, onError: r, parentIn
|
|
|
2967
3126
|
default:
|
|
2968
3127
|
r(y, "UNEXPECTED_TOKEN", `Unexpected ${y.type} token`), c = !1, d = !1;
|
|
2969
3128
|
}
|
|
2970
|
-
const
|
|
3129
|
+
const A = n[n.length - 1], O = A ? A.offset + A.source.length : i;
|
|
2971
3130
|
return g && s && s.type !== "space" && s.type !== "newline" && s.type !== "comma" && (s.type !== "scalar" || s.source !== "") && r(s.offset, "MISSING_CHAR", "Tags and anchors must be separated from the next token by white space"), h && (c && h.indent <= o || s?.type === "block-map" || s?.type === "block-seq") && r(h, "TAB_AS_INDENT", "Tabs are not allowed as indentation"), {
|
|
2972
3131
|
comma: k,
|
|
2973
3132
|
found: S,
|
|
@@ -2977,11 +3136,11 @@ function le(n, { flow: e, indicator: t, next: s, offset: i, onError: r, parentIn
|
|
|
2977
3136
|
anchor: p,
|
|
2978
3137
|
tag: b,
|
|
2979
3138
|
newlineAfterProp: w,
|
|
2980
|
-
end:
|
|
2981
|
-
start: N ??
|
|
3139
|
+
end: O,
|
|
3140
|
+
start: N ?? O
|
|
2982
3141
|
};
|
|
2983
3142
|
}
|
|
2984
|
-
function
|
|
3143
|
+
function Se(n) {
|
|
2985
3144
|
if (!n)
|
|
2986
3145
|
return null;
|
|
2987
3146
|
switch (n.type) {
|
|
@@ -3008,7 +3167,7 @@ function we(n) {
|
|
|
3008
3167
|
if (t.type === "newline")
|
|
3009
3168
|
return !0;
|
|
3010
3169
|
}
|
|
3011
|
-
if (
|
|
3170
|
+
if (Se(e.key) || Se(e.value))
|
|
3012
3171
|
return !0;
|
|
3013
3172
|
}
|
|
3014
3173
|
return !1;
|
|
@@ -3016,26 +3175,26 @@ function we(n) {
|
|
|
3016
3175
|
return !0;
|
|
3017
3176
|
}
|
|
3018
3177
|
}
|
|
3019
|
-
function
|
|
3178
|
+
function it(n, e, t) {
|
|
3020
3179
|
if (e?.type === "flow-collection") {
|
|
3021
3180
|
const s = e.end[0];
|
|
3022
|
-
s.indent === n && (s.source === "]" || s.source === "}") &&
|
|
3181
|
+
s.indent === n && (s.source === "]" || s.source === "}") && Se(e) && t(s, "BAD_INDENT", "Flow end indicator should be more indented than parent", !0);
|
|
3023
3182
|
}
|
|
3024
3183
|
}
|
|
3025
|
-
function
|
|
3184
|
+
function ps(n, e, t) {
|
|
3026
3185
|
const { uniqueKeys: s } = n.options;
|
|
3027
3186
|
if (s === !1)
|
|
3028
3187
|
return !1;
|
|
3029
3188
|
const i = typeof s == "function" ? s : (r, o) => r === o || I(r) && I(o) && r.value === o.value;
|
|
3030
3189
|
return e.some((r) => i(r.key, t));
|
|
3031
3190
|
}
|
|
3032
|
-
const
|
|
3033
|
-
function
|
|
3191
|
+
const Ct = "All mapping items must start at the same column";
|
|
3192
|
+
function dn({ composeNode: n, composeEmptyNode: e }, t, s, i, r) {
|
|
3034
3193
|
const o = r?.nodeClass ?? K, a = new o(t.schema);
|
|
3035
3194
|
t.atRoot && (t.atRoot = !1);
|
|
3036
3195
|
let l = s.offset, c = null;
|
|
3037
3196
|
for (const d of s.items) {
|
|
3038
|
-
const { start: f, key: u, sep: m, value: g } = d, h =
|
|
3197
|
+
const { start: f, key: u, sep: m, value: g } = d, h = fe(f, {
|
|
3039
3198
|
indicator: "explicit-key-ind",
|
|
3040
3199
|
next: u ?? m?.[0],
|
|
3041
3200
|
offset: l,
|
|
@@ -3044,17 +3203,17 @@ function rn({ composeNode: n, composeEmptyNode: e }, t, s, i, r) {
|
|
|
3044
3203
|
startOnNewline: !0
|
|
3045
3204
|
}), p = !h.found;
|
|
3046
3205
|
if (p) {
|
|
3047
|
-
if (u && (u.type === "block-seq" ? i(l, "BLOCK_AS_IMPLICIT_KEY", "A block sequence may not be used as an implicit map key") : "indent" in u && u.indent !== s.indent && i(l, "BAD_INDENT",
|
|
3206
|
+
if (u && (u.type === "block-seq" ? i(l, "BLOCK_AS_IMPLICIT_KEY", "A block sequence may not be used as an implicit map key") : "indent" in u && u.indent !== s.indent && i(l, "BAD_INDENT", Ct)), !h.anchor && !h.tag && !m) {
|
|
3048
3207
|
c = h.end, h.comment && (a.comment ? a.comment += `
|
|
3049
3208
|
` + h.comment : a.comment = h.comment);
|
|
3050
3209
|
continue;
|
|
3051
3210
|
}
|
|
3052
|
-
(h.newlineAfterProp ||
|
|
3053
|
-
} else h.found?.indent !== s.indent && i(l, "BAD_INDENT",
|
|
3211
|
+
(h.newlineAfterProp || Se(u)) && i(u ?? f[f.length - 1], "MULTILINE_IMPLICIT_KEY", "Implicit keys need to be on a single line");
|
|
3212
|
+
} else h.found?.indent !== s.indent && i(l, "BAD_INDENT", Ct);
|
|
3054
3213
|
t.atKey = !0;
|
|
3055
3214
|
const b = h.end, w = u ? n(t, u, h, i) : e(t, b, f, null, h, i);
|
|
3056
|
-
t.schema.compat &&
|
|
3057
|
-
const k =
|
|
3215
|
+
t.schema.compat && it(s.indent, u, i), t.atKey = !1, ps(t, a.items, w) && i(b, "DUPLICATE_KEY", "Map keys must be unique");
|
|
3216
|
+
const k = fe(m ?? [], {
|
|
3058
3217
|
indicator: "map-value-ind",
|
|
3059
3218
|
next: g,
|
|
3060
3219
|
offset: w.range[2],
|
|
@@ -3065,7 +3224,7 @@ function rn({ composeNode: n, composeEmptyNode: e }, t, s, i, r) {
|
|
|
3065
3224
|
if (l = k.end, k.found) {
|
|
3066
3225
|
p && (g?.type === "block-map" && !k.hasNewline && i(l, "BLOCK_AS_IMPLICIT_KEY", "Nested mappings are not allowed in compact mappings"), t.options.strict && h.start < k.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"));
|
|
3067
3226
|
const S = g ? n(t, g, k, i) : e(t, l, m, null, k, i);
|
|
3068
|
-
t.schema.compat &&
|
|
3227
|
+
t.schema.compat && it(s.indent, g, i), l = S.range[2];
|
|
3069
3228
|
const N = new P(w, S);
|
|
3070
3229
|
t.options.keepSourceTokens && (N.srcToken = d), a.items.push(N);
|
|
3071
3230
|
} else {
|
|
@@ -3077,12 +3236,12 @@ function rn({ composeNode: n, composeEmptyNode: e }, t, s, i, r) {
|
|
|
3077
3236
|
}
|
|
3078
3237
|
return c && c < l && i(c, "IMPOSSIBLE", "Map comment with trailing content"), a.range = [s.offset, l, c ?? l], a;
|
|
3079
3238
|
}
|
|
3080
|
-
function
|
|
3081
|
-
const o = r?.nodeClass ??
|
|
3239
|
+
function pn({ composeNode: n, composeEmptyNode: e }, t, s, i, r) {
|
|
3240
|
+
const o = r?.nodeClass ?? Z, a = new o(t.schema);
|
|
3082
3241
|
t.atRoot && (t.atRoot = !1), t.atKey && (t.atKey = !1);
|
|
3083
3242
|
let l = s.offset, c = null;
|
|
3084
3243
|
for (const { start: d, value: f } of s.items) {
|
|
3085
|
-
const u =
|
|
3244
|
+
const u = fe(d, {
|
|
3086
3245
|
indicator: "seq-item-ind",
|
|
3087
3246
|
next: f,
|
|
3088
3247
|
offset: l,
|
|
@@ -3098,7 +3257,7 @@ function on({ composeNode: n, composeEmptyNode: e }, t, s, i, r) {
|
|
|
3098
3257
|
continue;
|
|
3099
3258
|
}
|
|
3100
3259
|
const m = f ? n(t, f, u, i) : e(t, u.end, d, null, u, i);
|
|
3101
|
-
t.schema.compat &&
|
|
3260
|
+
t.schema.compat && it(s.indent, f, i), l = m.range[2], a.items.push(m);
|
|
3102
3261
|
}
|
|
3103
3262
|
return a.range = [s.offset, l, c ?? l], a;
|
|
3104
3263
|
}
|
|
@@ -3129,15 +3288,15 @@ function Oe(n, e, t, s) {
|
|
|
3129
3288
|
}
|
|
3130
3289
|
return { comment: i, offset: e };
|
|
3131
3290
|
}
|
|
3132
|
-
const
|
|
3133
|
-
function
|
|
3134
|
-
const o = s.start.source === "{", a = o ? "flow map" : "flow sequence", l = r?.nodeClass ?? (o ? K :
|
|
3291
|
+
const We = "Block collections are not allowed within flow collections", Xe = (n) => n && (n.type === "block-map" || n.type === "block-seq");
|
|
3292
|
+
function mn({ composeNode: n, composeEmptyNode: e }, t, s, i, r) {
|
|
3293
|
+
const o = s.start.source === "{", a = o ? "flow map" : "flow sequence", l = r?.nodeClass ?? (o ? K : Z), c = new l(t.schema);
|
|
3135
3294
|
c.flow = !0;
|
|
3136
3295
|
const d = t.atRoot;
|
|
3137
3296
|
d && (t.atRoot = !1), t.atKey && (t.atKey = !1);
|
|
3138
3297
|
let f = s.offset + s.start.source.length;
|
|
3139
3298
|
for (let p = 0; p < s.items.length; ++p) {
|
|
3140
|
-
const b = s.items[p], { start: w, key: k, sep: S, value: N } = b,
|
|
3299
|
+
const b = s.items[p], { start: w, key: k, sep: S, value: N } = b, A = fe(w, {
|
|
3141
3300
|
flow: a,
|
|
3142
3301
|
indicator: "explicit-key-ind",
|
|
3143
3302
|
next: k ?? S?.[0],
|
|
@@ -3146,13 +3305,13 @@ function an({ composeNode: n, composeEmptyNode: e }, t, s, i, r) {
|
|
|
3146
3305
|
parentIndent: s.indent,
|
|
3147
3306
|
startOnNewline: !1
|
|
3148
3307
|
});
|
|
3149
|
-
if (!
|
|
3150
|
-
if (!
|
|
3151
|
-
p === 0 &&
|
|
3152
|
-
` +
|
|
3308
|
+
if (!A.found) {
|
|
3309
|
+
if (!A.anchor && !A.tag && !S && !N) {
|
|
3310
|
+
p === 0 && A.comma ? i(A.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${a}`) : p < s.items.length - 1 && i(A.start, "UNEXPECTED_TOKEN", `Unexpected empty item in ${a}`), A.comment && (c.comment ? c.comment += `
|
|
3311
|
+
` + A.comment : c.comment = A.comment), f = A.end;
|
|
3153
3312
|
continue;
|
|
3154
3313
|
}
|
|
3155
|
-
!o && t.options.strict &&
|
|
3314
|
+
!o && t.options.strict && Se(k) && i(
|
|
3156
3315
|
k,
|
|
3157
3316
|
// checked by containsNewline()
|
|
3158
3317
|
"MULTILINE_IMPLICIT_KEY",
|
|
@@ -3160,34 +3319,34 @@ function an({ composeNode: n, composeEmptyNode: e }, t, s, i, r) {
|
|
|
3160
3319
|
);
|
|
3161
3320
|
}
|
|
3162
3321
|
if (p === 0)
|
|
3163
|
-
|
|
3164
|
-
else if (
|
|
3165
|
-
let
|
|
3322
|
+
A.comma && i(A.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${a}`);
|
|
3323
|
+
else if (A.comma || i(A.start, "MISSING_CHAR", `Missing , between ${a} items`), A.comment) {
|
|
3324
|
+
let O = "";
|
|
3166
3325
|
e: for (const y of w)
|
|
3167
3326
|
switch (y.type) {
|
|
3168
3327
|
case "comma":
|
|
3169
3328
|
case "space":
|
|
3170
3329
|
break;
|
|
3171
3330
|
case "comment":
|
|
3172
|
-
|
|
3331
|
+
O = y.source.substring(1);
|
|
3173
3332
|
break e;
|
|
3174
3333
|
default:
|
|
3175
3334
|
break e;
|
|
3176
3335
|
}
|
|
3177
|
-
if (
|
|
3336
|
+
if (O) {
|
|
3178
3337
|
let y = c.items[c.items.length - 1];
|
|
3179
|
-
|
|
3180
|
-
` +
|
|
3338
|
+
v(y) && (y = y.value ?? y.key), y.comment ? y.comment += `
|
|
3339
|
+
` + O : y.comment = O, A.comment = A.comment.substring(O.length + 1);
|
|
3181
3340
|
}
|
|
3182
3341
|
}
|
|
3183
|
-
if (!o && !S && !
|
|
3184
|
-
const
|
|
3185
|
-
c.items.push(
|
|
3342
|
+
if (!o && !S && !A.found) {
|
|
3343
|
+
const O = N ? n(t, N, A, i) : e(t, A.end, S, null, A, i);
|
|
3344
|
+
c.items.push(O), f = O.range[2], Xe(N) && i(O.range, "BLOCK_IN_FLOW", We);
|
|
3186
3345
|
} else {
|
|
3187
3346
|
t.atKey = !0;
|
|
3188
|
-
const
|
|
3189
|
-
|
|
3190
|
-
const C =
|
|
3347
|
+
const O = A.end, y = k ? n(t, k, A, i) : e(t, O, w, null, A, i);
|
|
3348
|
+
Xe(k) && i(y.range, "BLOCK_IN_FLOW", We), t.atKey = !1;
|
|
3349
|
+
const C = fe(S ?? [], {
|
|
3191
3350
|
flow: a,
|
|
3192
3351
|
indicator: "map-value-ind",
|
|
3193
3352
|
next: N,
|
|
@@ -3197,33 +3356,33 @@ function an({ composeNode: n, composeEmptyNode: e }, t, s, i, r) {
|
|
|
3197
3356
|
startOnNewline: !1
|
|
3198
3357
|
});
|
|
3199
3358
|
if (C.found) {
|
|
3200
|
-
if (!o && !
|
|
3359
|
+
if (!o && !A.found && t.options.strict) {
|
|
3201
3360
|
if (S)
|
|
3202
|
-
for (const
|
|
3203
|
-
if (
|
|
3361
|
+
for (const _ of S) {
|
|
3362
|
+
if (_ === C.found)
|
|
3204
3363
|
break;
|
|
3205
|
-
if (
|
|
3206
|
-
i(
|
|
3364
|
+
if (_.type === "newline") {
|
|
3365
|
+
i(_, "MULTILINE_IMPLICIT_KEY", "Implicit keys of flow sequence pairs need to be on a single line");
|
|
3207
3366
|
break;
|
|
3208
3367
|
}
|
|
3209
3368
|
}
|
|
3210
|
-
|
|
3369
|
+
A.start < C.found.offset - 1024 && i(C.found, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit flow sequence key");
|
|
3211
3370
|
}
|
|
3212
3371
|
} else N && ("source" in N && N.source?.[0] === ":" ? i(N, "MISSING_CHAR", `Missing space after : in ${a}`) : i(C.start, "MISSING_CHAR", `Missing , or : between ${a} items`));
|
|
3213
|
-
const
|
|
3214
|
-
|
|
3372
|
+
const G = N ? n(t, N, C, i) : C.found ? e(t, C.end, S, null, C, i) : null;
|
|
3373
|
+
G ? Xe(N) && i(G.range, "BLOCK_IN_FLOW", We) : C.comment && (y.comment ? y.comment += `
|
|
3215
3374
|
` + C.comment : y.comment = C.comment);
|
|
3216
|
-
const
|
|
3217
|
-
if (t.options.keepSourceTokens && (
|
|
3218
|
-
const
|
|
3219
|
-
|
|
3375
|
+
const te = new P(y, G);
|
|
3376
|
+
if (t.options.keepSourceTokens && (te.srcToken = b), o) {
|
|
3377
|
+
const _ = c;
|
|
3378
|
+
ps(t, _.items, y) && i(O, "DUPLICATE_KEY", "Map keys must be unique"), _.items.push(te);
|
|
3220
3379
|
} else {
|
|
3221
|
-
const
|
|
3222
|
-
|
|
3223
|
-
const
|
|
3224
|
-
|
|
3380
|
+
const _ = new K(t.schema);
|
|
3381
|
+
_.flow = !0, _.items.push(te);
|
|
3382
|
+
const At = (G ?? y).range;
|
|
3383
|
+
_.range = [y.range[0], At[1], At[2]], c.items.push(_);
|
|
3225
3384
|
}
|
|
3226
|
-
f =
|
|
3385
|
+
f = G ? G.range[2] : C.end;
|
|
3227
3386
|
}
|
|
3228
3387
|
}
|
|
3229
3388
|
const u = o ? "}" : "]", [m, ...g] = s.end;
|
|
@@ -3242,35 +3401,35 @@ function an({ composeNode: n, composeEmptyNode: e }, t, s, i, r) {
|
|
|
3242
3401
|
c.range = [s.offset, h, h];
|
|
3243
3402
|
return c;
|
|
3244
3403
|
}
|
|
3245
|
-
function
|
|
3246
|
-
const o = t.type === "block-map" ?
|
|
3404
|
+
function ze(n, e, t, s, i, r) {
|
|
3405
|
+
const o = t.type === "block-map" ? dn(n, e, t, s, r) : t.type === "block-seq" ? pn(n, e, t, s, r) : mn(n, e, t, s, r), a = o.constructor;
|
|
3247
3406
|
return i === "!" || i === a.tagName ? (o.tag = a.tagName, o) : (i && (o.tag = i), o);
|
|
3248
3407
|
}
|
|
3249
|
-
function
|
|
3408
|
+
function gn(n, e, t, s, i) {
|
|
3250
3409
|
const r = s.tag, o = r ? e.directives.tagName(r.source, (u) => i(r, "TAG_RESOLVE_FAILED", u)) : null;
|
|
3251
3410
|
if (t.type === "block-seq") {
|
|
3252
3411
|
const { anchor: u, newlineAfterProp: m } = s, g = u && r ? u.offset > r.offset ? u : r : u ?? r;
|
|
3253
3412
|
g && (!m || m.offset < g.offset) && i(g, "MISSING_CHAR", "Missing newline after block sequence props");
|
|
3254
3413
|
}
|
|
3255
3414
|
const a = t.type === "block-map" ? "map" : t.type === "block-seq" ? "seq" : t.start.source === "{" ? "map" : "seq";
|
|
3256
|
-
if (!r || !o || o === "!" || o === K.tagName && a === "map" || o ===
|
|
3257
|
-
return
|
|
3415
|
+
if (!r || !o || o === "!" || o === K.tagName && a === "map" || o === Z.tagName && a === "seq")
|
|
3416
|
+
return ze(n, e, t, i, o);
|
|
3258
3417
|
let l = e.schema.tags.find((u) => u.tag === o && u.collection === a);
|
|
3259
3418
|
if (!l) {
|
|
3260
3419
|
const u = e.schema.knownTags[o];
|
|
3261
3420
|
if (u?.collection === a)
|
|
3262
3421
|
e.schema.tags.push(Object.assign({}, u, { default: !1 })), l = u;
|
|
3263
3422
|
else
|
|
3264
|
-
return u ? i(r, "BAD_COLLECTION_TYPE", `${u.tag} used for ${a} collection, but expects ${u.collection ?? "scalar"}`, !0) : i(r, "TAG_RESOLVE_FAILED", `Unresolved tag: ${o}`, !0),
|
|
3423
|
+
return u ? i(r, "BAD_COLLECTION_TYPE", `${u.tag} used for ${a} collection, but expects ${u.collection ?? "scalar"}`, !0) : i(r, "TAG_RESOLVE_FAILED", `Unresolved tag: ${o}`, !0), ze(n, e, t, i, o);
|
|
3265
3424
|
}
|
|
3266
|
-
const c =
|
|
3425
|
+
const c = ze(n, e, t, i, o, l), d = l.resolve?.(c, (u) => i(r, "TAG_RESOLVE_FAILED", u), e.options) ?? c, f = L(d) ? d : new T(d);
|
|
3267
3426
|
return f.range = c.range, f.tag = o, l?.format && (f.format = l.format), f;
|
|
3268
3427
|
}
|
|
3269
|
-
function
|
|
3270
|
-
const s = e.offset, i =
|
|
3428
|
+
function yn(n, e, t) {
|
|
3429
|
+
const s = e.offset, i = bn(e, n.options.strict, t);
|
|
3271
3430
|
if (!i)
|
|
3272
3431
|
return { value: "", type: null, comment: "", range: [s, s, s] };
|
|
3273
|
-
const r = i.mode === ">" ?
|
|
3432
|
+
const r = i.mode === ">" ? T.BLOCK_FOLDED : T.BLOCK_LITERAL, o = e.source ? wn(e.source) : [];
|
|
3274
3433
|
let a = o.length;
|
|
3275
3434
|
for (let h = o.length - 1; h >= 0; --h) {
|
|
3276
3435
|
const p = o[h][1];
|
|
@@ -3310,7 +3469,7 @@ function cn(n, e, t) {
|
|
|
3310
3469
|
const S = `Block scalar lines must not be less indented than their ${i.indent ? "explicit indentation indicator" : "first line"}`;
|
|
3311
3470
|
t(c - b.length - (w ? 2 : 1), "BAD_INDENT", S), p = "";
|
|
3312
3471
|
}
|
|
3313
|
-
r ===
|
|
3472
|
+
r === T.BLOCK_LITERAL ? (f += u + p.slice(l) + b, u = `
|
|
3314
3473
|
`) : p.length > l || b[0] === " " ? (u === " " ? u = `
|
|
3315
3474
|
` : !m && u === `
|
|
3316
3475
|
` && (u = `
|
|
@@ -3339,7 +3498,7 @@ function cn(n, e, t) {
|
|
|
3339
3498
|
const g = s + i.length + e.source.length;
|
|
3340
3499
|
return { value: f, type: r, comment: i.comment, range: [s, g, g] };
|
|
3341
3500
|
}
|
|
3342
|
-
function
|
|
3501
|
+
function bn({ offset: n, props: e }, t, s) {
|
|
3343
3502
|
if (e[0].type !== "block-scalar-header")
|
|
3344
3503
|
return s(e[0], "IMPOSSIBLE", "Block scalar header not found"), null;
|
|
3345
3504
|
const { source: i } = e[0], r = i[0];
|
|
@@ -3381,25 +3540,25 @@ function fn({ offset: n, props: e }, t, s) {
|
|
|
3381
3540
|
}
|
|
3382
3541
|
return { mode: r, indent: o, chomp: a, comment: d, length: f };
|
|
3383
3542
|
}
|
|
3384
|
-
function
|
|
3543
|
+
function wn(n) {
|
|
3385
3544
|
const e = n.split(/\n( *)/), t = e[0], s = t.match(/^( *)/), r = [s?.[1] ? [s[1], t.slice(s[1].length)] : ["", t]];
|
|
3386
3545
|
for (let o = 1; o < e.length; o += 2)
|
|
3387
3546
|
r.push([e[o], e[o + 1]]);
|
|
3388
3547
|
return r;
|
|
3389
3548
|
}
|
|
3390
|
-
function
|
|
3549
|
+
function kn(n, e, t) {
|
|
3391
3550
|
const { offset: s, type: i, source: r, end: o } = n;
|
|
3392
3551
|
let a, l;
|
|
3393
3552
|
const c = (u, m, g) => t(s + u, m, g);
|
|
3394
3553
|
switch (i) {
|
|
3395
3554
|
case "scalar":
|
|
3396
|
-
a =
|
|
3555
|
+
a = T.PLAIN, l = Sn(r, c);
|
|
3397
3556
|
break;
|
|
3398
3557
|
case "single-quoted-scalar":
|
|
3399
|
-
a =
|
|
3558
|
+
a = T.QUOTE_SINGLE, l = Nn(r, c);
|
|
3400
3559
|
break;
|
|
3401
3560
|
case "double-quoted-scalar":
|
|
3402
|
-
a =
|
|
3561
|
+
a = T.QUOTE_DOUBLE, l = Tn(r, c);
|
|
3403
3562
|
break;
|
|
3404
3563
|
/* istanbul ignore next should not happen */
|
|
3405
3564
|
default:
|
|
@@ -3418,7 +3577,7 @@ function hn(n, e, t) {
|
|
|
3418
3577
|
range: [s, d, f.offset]
|
|
3419
3578
|
};
|
|
3420
3579
|
}
|
|
3421
|
-
function
|
|
3580
|
+
function Sn(n, e) {
|
|
3422
3581
|
let t = "";
|
|
3423
3582
|
switch (n[0]) {
|
|
3424
3583
|
/* istanbul ignore next should not happen */
|
|
@@ -3442,12 +3601,12 @@ function dn(n, e) {
|
|
|
3442
3601
|
break;
|
|
3443
3602
|
}
|
|
3444
3603
|
}
|
|
3445
|
-
return t && e(0, "BAD_SCALAR_START", `Plain value cannot start with ${t}`),
|
|
3604
|
+
return t && e(0, "BAD_SCALAR_START", `Plain value cannot start with ${t}`), ms(n);
|
|
3446
3605
|
}
|
|
3447
|
-
function
|
|
3448
|
-
return (n[n.length - 1] !== "'" || n.length === 1) && e(n.length, "MISSING_CHAR", "Missing closing 'quote"),
|
|
3606
|
+
function Nn(n, e) {
|
|
3607
|
+
return (n[n.length - 1] !== "'" || n.length === 1) && e(n.length, "MISSING_CHAR", "Missing closing 'quote"), ms(n.slice(1, -1)).replace(/''/g, "'");
|
|
3449
3608
|
}
|
|
3450
|
-
function
|
|
3609
|
+
function ms(n) {
|
|
3451
3610
|
let e, t;
|
|
3452
3611
|
try {
|
|
3453
3612
|
e = new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
@@ -3467,7 +3626,7 @@ function fs(n) {
|
|
|
3467
3626
|
const a = /[ \t]*(.*)/sy;
|
|
3468
3627
|
return a.lastIndex = o, s = a.exec(n), i + r + (s?.[1] ?? "");
|
|
3469
3628
|
}
|
|
3470
|
-
function
|
|
3629
|
+
function Tn(n, e) {
|
|
3471
3630
|
let t = "";
|
|
3472
3631
|
for (let s = 1; s < n.length - 1; ++s) {
|
|
3473
3632
|
const i = n[s];
|
|
@@ -3475,11 +3634,11 @@ function mn(n, e) {
|
|
|
3475
3634
|
`))
|
|
3476
3635
|
if (i === `
|
|
3477
3636
|
`) {
|
|
3478
|
-
const { fold: r, offset: o } =
|
|
3637
|
+
const { fold: r, offset: o } = An(n, s);
|
|
3479
3638
|
t += r, s = o;
|
|
3480
3639
|
} else if (i === "\\") {
|
|
3481
3640
|
let r = n[++s];
|
|
3482
|
-
const o =
|
|
3641
|
+
const o = On[r];
|
|
3483
3642
|
if (o)
|
|
3484
3643
|
t += o;
|
|
3485
3644
|
else if (r === `
|
|
@@ -3492,7 +3651,7 @@ function mn(n, e) {
|
|
|
3492
3651
|
r = n[++s + 1];
|
|
3493
3652
|
else if (r === "x" || r === "u" || r === "U") {
|
|
3494
3653
|
const a = { x: 2, u: 4, U: 8 }[r];
|
|
3495
|
-
t +=
|
|
3654
|
+
t += In(n, s + 1, a, e), s += a;
|
|
3496
3655
|
} else {
|
|
3497
3656
|
const a = n.substr(s - 1, 2);
|
|
3498
3657
|
e(s - 1, "BAD_DQ_ESCAPE", `Invalid escape sequence ${a}`), t += a;
|
|
@@ -3510,7 +3669,7 @@ function mn(n, e) {
|
|
|
3510
3669
|
}
|
|
3511
3670
|
return (n[n.length - 1] !== '"' || n.length === 1) && e(n.length, "MISSING_CHAR", 'Missing closing "quote'), t;
|
|
3512
3671
|
}
|
|
3513
|
-
function
|
|
3672
|
+
function An(n, e) {
|
|
3514
3673
|
let t = "", s = n[e + 1];
|
|
3515
3674
|
for (; (s === " " || s === " " || s === `
|
|
3516
3675
|
` || s === "\r") && !(s === "\r" && n[e + 2] !== `
|
|
@@ -3520,7 +3679,7 @@ function gn(n, e) {
|
|
|
3520
3679
|
`), e += 1, s = n[e + 1];
|
|
3521
3680
|
return t || (t = " "), { fold: t, offset: e };
|
|
3522
3681
|
}
|
|
3523
|
-
const
|
|
3682
|
+
const On = {
|
|
3524
3683
|
0: "\0",
|
|
3525
3684
|
// null character
|
|
3526
3685
|
a: "\x07",
|
|
@@ -3554,7 +3713,7 @@ const yn = {
|
|
|
3554
3713
|
"\\": "\\",
|
|
3555
3714
|
" ": " "
|
|
3556
3715
|
};
|
|
3557
|
-
function
|
|
3716
|
+
function In(n, e, t, s) {
|
|
3558
3717
|
const i = n.substr(e, t), o = i.length === t && /^[0-9a-fA-F]+$/.test(i) ? parseInt(i, 16) : NaN;
|
|
3559
3718
|
if (isNaN(o)) {
|
|
3560
3719
|
const a = n.substr(e - 2, t + 2);
|
|
@@ -3562,23 +3721,23 @@ function bn(n, e, t, s) {
|
|
|
3562
3721
|
}
|
|
3563
3722
|
return String.fromCodePoint(o);
|
|
3564
3723
|
}
|
|
3565
|
-
function
|
|
3566
|
-
const { value: i, type: r, comment: o, range: a } = e.type === "block-scalar" ?
|
|
3724
|
+
function gs(n, e, t, s) {
|
|
3725
|
+
const { value: i, type: r, comment: o, range: a } = e.type === "block-scalar" ? yn(n, e, s) : kn(e, n.options.strict, s), l = t ? n.directives.tagName(t.source, (f) => s(t, "TAG_RESOLVE_FAILED", f)) : null;
|
|
3567
3726
|
let c;
|
|
3568
|
-
n.options.stringKeys && n.atKey ? c = n.schema[
|
|
3727
|
+
n.options.stringKeys && n.atKey ? c = n.schema[x] : l ? c = $n(n.schema, i, l, t, s) : e.type === "scalar" ? c = En(n, i, e, s) : c = n.schema[x];
|
|
3569
3728
|
let d;
|
|
3570
3729
|
try {
|
|
3571
3730
|
const f = c.resolve(i, (u) => s(t ?? e, "TAG_RESOLVE_FAILED", u), n.options);
|
|
3572
|
-
d = I(f) ? f : new
|
|
3731
|
+
d = I(f) ? f : new T(f);
|
|
3573
3732
|
} catch (f) {
|
|
3574
3733
|
const u = f instanceof Error ? f.message : String(f);
|
|
3575
|
-
s(t ?? e, "TAG_RESOLVE_FAILED", u), d = new
|
|
3734
|
+
s(t ?? e, "TAG_RESOLVE_FAILED", u), d = new T(i);
|
|
3576
3735
|
}
|
|
3577
3736
|
return d.range = a, d.source = i, r && (d.type = r), l && (d.tag = l), c.format && (d.format = c.format), o && (d.comment = o), d;
|
|
3578
3737
|
}
|
|
3579
|
-
function
|
|
3738
|
+
function $n(n, e, t, s, i) {
|
|
3580
3739
|
if (t === "!")
|
|
3581
|
-
return n[
|
|
3740
|
+
return n[x];
|
|
3582
3741
|
const r = [];
|
|
3583
3742
|
for (const a of n.tags)
|
|
3584
3743
|
if (!a.collection && a.tag === t)
|
|
@@ -3590,12 +3749,12 @@ function wn(n, e, t, s, i) {
|
|
|
3590
3749
|
if (a.test?.test(e))
|
|
3591
3750
|
return a;
|
|
3592
3751
|
const o = n.knownTags[t];
|
|
3593
|
-
return o && !o.collection ? (n.tags.push(Object.assign({}, o, { default: !1, test: void 0 })), o) : (i(s, "TAG_RESOLVE_FAILED", `Unresolved tag: ${t}`, t !== "tag:yaml.org,2002:str"), n[
|
|
3752
|
+
return o && !o.collection ? (n.tags.push(Object.assign({}, o, { default: !1, test: void 0 })), o) : (i(s, "TAG_RESOLVE_FAILED", `Unresolved tag: ${t}`, t !== "tag:yaml.org,2002:str"), n[x]);
|
|
3594
3753
|
}
|
|
3595
|
-
function
|
|
3596
|
-
const o = t.tags.find((a) => (a.default === !0 || n && a.default === "key") && a.test?.test(s)) || t[
|
|
3754
|
+
function En({ atKey: n, directives: e, schema: t }, s, i, r) {
|
|
3755
|
+
const o = t.tags.find((a) => (a.default === !0 || n && a.default === "key") && a.test?.test(s)) || t[x];
|
|
3597
3756
|
if (t.compat) {
|
|
3598
|
-
const a = t.compat.find((l) => l.default && l.test?.test(s)) ?? t[
|
|
3757
|
+
const a = t.compat.find((l) => l.default && l.test?.test(s)) ?? t[x];
|
|
3599
3758
|
if (o.tag !== a.tag) {
|
|
3600
3759
|
const l = e.tagString(o.tag), c = e.tagString(a.tag), d = `Value may be parsed as either ${l} or ${c}`;
|
|
3601
3760
|
r(i, "TAG_RESOLVE_FAILED", d, !0);
|
|
@@ -3603,7 +3762,7 @@ function kn({ atKey: n, directives: e, schema: t }, s, i, r) {
|
|
|
3603
3762
|
}
|
|
3604
3763
|
return o;
|
|
3605
3764
|
}
|
|
3606
|
-
function
|
|
3765
|
+
function Ln(n, e, t) {
|
|
3607
3766
|
if (e) {
|
|
3608
3767
|
t ?? (t = e.length);
|
|
3609
3768
|
for (let s = t - 1; s >= 0; --s) {
|
|
@@ -3622,55 +3781,55 @@ function Sn(n, e, t) {
|
|
|
3622
3781
|
}
|
|
3623
3782
|
return n;
|
|
3624
3783
|
}
|
|
3625
|
-
const
|
|
3626
|
-
function
|
|
3784
|
+
const vn = { composeNode: ys, composeEmptyNode: Tt };
|
|
3785
|
+
function ys(n, e, t, s) {
|
|
3627
3786
|
const i = n.atKey, { spaceBefore: r, comment: o, anchor: a, tag: l } = t;
|
|
3628
3787
|
let c, d = !0;
|
|
3629
3788
|
switch (e.type) {
|
|
3630
3789
|
case "alias":
|
|
3631
|
-
c =
|
|
3790
|
+
c = Cn(n, e, s), (a || l) && s(e, "ALIAS_PROPS", "An alias node must not specify any properties");
|
|
3632
3791
|
break;
|
|
3633
3792
|
case "scalar":
|
|
3634
3793
|
case "single-quoted-scalar":
|
|
3635
3794
|
case "double-quoted-scalar":
|
|
3636
3795
|
case "block-scalar":
|
|
3637
|
-
c =
|
|
3796
|
+
c = gs(n, e, l, s), a && (c.anchor = a.source.substring(1));
|
|
3638
3797
|
break;
|
|
3639
3798
|
case "block-map":
|
|
3640
3799
|
case "block-seq":
|
|
3641
3800
|
case "flow-collection":
|
|
3642
|
-
c =
|
|
3801
|
+
c = gn(vn, n, e, t, s), a && (c.anchor = a.source.substring(1));
|
|
3643
3802
|
break;
|
|
3644
3803
|
default: {
|
|
3645
3804
|
const f = e.type === "error" ? e.message : `Unsupported token (type: ${e.type})`;
|
|
3646
|
-
s(e, "UNEXPECTED_TOKEN", f), c =
|
|
3805
|
+
s(e, "UNEXPECTED_TOKEN", f), c = Tt(n, e.offset, void 0, null, t, s), d = !1;
|
|
3647
3806
|
}
|
|
3648
3807
|
}
|
|
3649
3808
|
return a && c.anchor === "" && s(a, "BAD_ALIAS", "Anchor cannot be an empty string"), i && n.options.stringKeys && (!I(c) || typeof c.value != "string" || c.tag && c.tag !== "tag:yaml.org,2002:str") && s(l ?? 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), n.options.keepSourceTokens && d && (c.srcToken = e), c;
|
|
3650
3809
|
}
|
|
3651
|
-
function
|
|
3810
|
+
function Tt(n, e, t, s, { spaceBefore: i, comment: r, anchor: o, tag: a, end: l }, c) {
|
|
3652
3811
|
const d = {
|
|
3653
3812
|
type: "scalar",
|
|
3654
|
-
offset:
|
|
3813
|
+
offset: Ln(e, t, s),
|
|
3655
3814
|
indent: -1,
|
|
3656
3815
|
source: ""
|
|
3657
|
-
}, f =
|
|
3816
|
+
}, f = gs(n, d, a, c);
|
|
3658
3817
|
return o && (f.anchor = o.source.substring(1), f.anchor === "" && c(o, "BAD_ALIAS", "Anchor cannot be an empty string")), i && (f.spaceBefore = !0), r && (f.comment = r, f.range[2] = l), f;
|
|
3659
3818
|
}
|
|
3660
|
-
function
|
|
3661
|
-
const r = new
|
|
3819
|
+
function Cn({ options: n }, { offset: e, source: t, end: s }, i) {
|
|
3820
|
+
const r = new ut(t.substring(1));
|
|
3662
3821
|
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);
|
|
3663
3822
|
const o = e + t.length, a = Oe(s, o, n.strict, i);
|
|
3664
3823
|
return r.range = [e, o, a.offset], a.comment && (r.comment = a.comment), r;
|
|
3665
3824
|
}
|
|
3666
|
-
function
|
|
3667
|
-
const a = Object.assign({ _directives: e }, n), l = new
|
|
3825
|
+
function _n(n, e, { offset: t, start: s, value: i, end: r }, o) {
|
|
3826
|
+
const a = Object.assign({ _directives: e }, n), l = new Je(void 0, a), c = {
|
|
3668
3827
|
atKey: !1,
|
|
3669
3828
|
atRoot: !0,
|
|
3670
3829
|
directives: l.directives,
|
|
3671
3830
|
options: l.options,
|
|
3672
3831
|
schema: l.schema
|
|
3673
|
-
}, d =
|
|
3832
|
+
}, d = fe(s, {
|
|
3674
3833
|
indicator: "doc-start",
|
|
3675
3834
|
next: i ?? r?.[0],
|
|
3676
3835
|
offset: t,
|
|
@@ -3678,11 +3837,11 @@ function Tn(n, e, { offset: t, start: s, value: i, end: r }, o) {
|
|
|
3678
3837
|
parentIndent: 0,
|
|
3679
3838
|
startOnNewline: !0
|
|
3680
3839
|
});
|
|
3681
|
-
d.found && (l.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")), l.contents = i ?
|
|
3840
|
+
d.found && (l.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")), l.contents = i ? ys(c, i, d, o) : Tt(c, d.end, s, null, d, o);
|
|
3682
3841
|
const f = l.contents.range[2], u = Oe(r, f, !1, o);
|
|
3683
3842
|
return u.comment && (l.comment = u.comment), l.range = [t, f, u.offset], l;
|
|
3684
3843
|
}
|
|
3685
|
-
function
|
|
3844
|
+
function me(n) {
|
|
3686
3845
|
if (typeof n == "number")
|
|
3687
3846
|
return [n, n + 1];
|
|
3688
3847
|
if (Array.isArray(n))
|
|
@@ -3690,7 +3849,7 @@ function de(n) {
|
|
|
3690
3849
|
const { offset: e, source: t } = n;
|
|
3691
3850
|
return [e, e + (typeof t == "string" ? t.length : 1)];
|
|
3692
3851
|
}
|
|
3693
|
-
function
|
|
3852
|
+
function _t(n) {
|
|
3694
3853
|
let e = "", t = !1, s = !1;
|
|
3695
3854
|
for (let i = 0; i < n.length; ++i) {
|
|
3696
3855
|
const r = n[i];
|
|
@@ -3710,15 +3869,15 @@ function Et(n) {
|
|
|
3710
3869
|
}
|
|
3711
3870
|
return { comment: e, afterEmptyLine: s };
|
|
3712
3871
|
}
|
|
3713
|
-
class
|
|
3872
|
+
class Mn {
|
|
3714
3873
|
constructor(e = {}) {
|
|
3715
3874
|
this.doc = null, this.atDirectives = !1, this.prelude = [], this.errors = [], this.warnings = [], this.onError = (t, s, i, r) => {
|
|
3716
|
-
const o =
|
|
3717
|
-
r ? this.warnings.push(new
|
|
3718
|
-
}, this.directives = new
|
|
3875
|
+
const o = me(t);
|
|
3876
|
+
r ? this.warnings.push(new hn(o, s, i)) : this.errors.push(new ye(o, s, i));
|
|
3877
|
+
}, this.directives = new B({ version: e.version || "1.2" }), this.options = e;
|
|
3719
3878
|
}
|
|
3720
3879
|
decorate(e, t) {
|
|
3721
|
-
const { comment: s, afterEmptyLine: i } =
|
|
3880
|
+
const { comment: s, afterEmptyLine: i } = _t(this.prelude);
|
|
3722
3881
|
if (s) {
|
|
3723
3882
|
const r = e.contents;
|
|
3724
3883
|
if (t)
|
|
@@ -3726,9 +3885,9 @@ class An {
|
|
|
3726
3885
|
${s}` : s;
|
|
3727
3886
|
else if (i || e.directives.docStart || !r)
|
|
3728
3887
|
e.commentBefore = s;
|
|
3729
|
-
else if (
|
|
3888
|
+
else if (E(r) && !r.flow && r.items.length > 0) {
|
|
3730
3889
|
let o = r.items[0];
|
|
3731
|
-
|
|
3890
|
+
v(o) && (o = o.key);
|
|
3732
3891
|
const a = o.commentBefore;
|
|
3733
3892
|
o.commentBefore = a ? `${s}
|
|
3734
3893
|
${a}` : s;
|
|
@@ -3747,7 +3906,7 @@ ${o}` : s;
|
|
|
3747
3906
|
*/
|
|
3748
3907
|
streamInfo() {
|
|
3749
3908
|
return {
|
|
3750
|
-
comment:
|
|
3909
|
+
comment: _t(this.prelude).comment,
|
|
3751
3910
|
directives: this.directives,
|
|
3752
3911
|
errors: this.errors,
|
|
3753
3912
|
warnings: this.warnings
|
|
@@ -3769,12 +3928,12 @@ ${o}` : s;
|
|
|
3769
3928
|
switch (e.type) {
|
|
3770
3929
|
case "directive":
|
|
3771
3930
|
this.directives.add(e.source, (t, s, i) => {
|
|
3772
|
-
const r =
|
|
3931
|
+
const r = me(e);
|
|
3773
3932
|
r[0] += t, this.onError(r, "BAD_DIRECTIVE", s, i);
|
|
3774
3933
|
}), this.prelude.push(e.source), this.atDirectives = !0;
|
|
3775
3934
|
break;
|
|
3776
3935
|
case "document": {
|
|
3777
|
-
const t =
|
|
3936
|
+
const t = _n(this.options, this.directives, e, this.onError);
|
|
3778
3937
|
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;
|
|
3779
3938
|
break;
|
|
3780
3939
|
}
|
|
@@ -3786,14 +3945,14 @@ ${o}` : s;
|
|
|
3786
3945
|
this.prelude.push(e.source);
|
|
3787
3946
|
break;
|
|
3788
3947
|
case "error": {
|
|
3789
|
-
const t = e.source ? `${e.message}: ${JSON.stringify(e.source)}` : e.message, s = new me(
|
|
3948
|
+
const t = e.source ? `${e.message}: ${JSON.stringify(e.source)}` : e.message, s = new ye(me(e), "UNEXPECTED_TOKEN", t);
|
|
3790
3949
|
this.atDirectives || !this.doc ? this.errors.push(s) : this.doc.errors.push(s);
|
|
3791
3950
|
break;
|
|
3792
3951
|
}
|
|
3793
3952
|
case "doc-end": {
|
|
3794
3953
|
if (!this.doc) {
|
|
3795
3954
|
const s = "Unexpected doc-end without preceding document";
|
|
3796
|
-
this.errors.push(new me(
|
|
3955
|
+
this.errors.push(new ye(me(e), "UNEXPECTED_TOKEN", s));
|
|
3797
3956
|
break;
|
|
3798
3957
|
}
|
|
3799
3958
|
this.doc.directives.docEnd = !0;
|
|
@@ -3807,7 +3966,7 @@ ${t.comment}` : t.comment;
|
|
|
3807
3966
|
break;
|
|
3808
3967
|
}
|
|
3809
3968
|
default:
|
|
3810
|
-
this.errors.push(new me(
|
|
3969
|
+
this.errors.push(new ye(me(e), "UNEXPECTED_TOKEN", `Unsupported token ${e.type}`));
|
|
3811
3970
|
}
|
|
3812
3971
|
}
|
|
3813
3972
|
/**
|
|
@@ -3820,21 +3979,21 @@ ${t.comment}` : t.comment;
|
|
|
3820
3979
|
if (this.doc)
|
|
3821
3980
|
this.decorate(this.doc, !0), yield this.doc, this.doc = null;
|
|
3822
3981
|
else if (e) {
|
|
3823
|
-
const s = Object.assign({ _directives: this.directives }, this.options), i = new
|
|
3982
|
+
const s = Object.assign({ _directives: this.directives }, this.options), i = new Je(void 0, s);
|
|
3824
3983
|
this.atDirectives && this.onError(t, "MISSING_CHAR", "Missing directives-end indicator line"), i.range = [0, t, t], this.decorate(i, !1), yield i;
|
|
3825
3984
|
}
|
|
3826
3985
|
}
|
|
3827
3986
|
}
|
|
3828
|
-
const
|
|
3829
|
-
function
|
|
3987
|
+
const bs = "\uFEFF", ws = "", ks = "", rt = "";
|
|
3988
|
+
function Bn(n) {
|
|
3830
3989
|
switch (n) {
|
|
3831
|
-
case
|
|
3990
|
+
case bs:
|
|
3832
3991
|
return "byte-order-mark";
|
|
3833
|
-
case
|
|
3992
|
+
case ws:
|
|
3834
3993
|
return "doc-mode";
|
|
3835
|
-
case
|
|
3994
|
+
case ks:
|
|
3836
3995
|
return "flow-error-end";
|
|
3837
|
-
case
|
|
3996
|
+
case rt:
|
|
3838
3997
|
return "scalar";
|
|
3839
3998
|
case "---":
|
|
3840
3999
|
return "doc-start";
|
|
@@ -3887,7 +4046,7 @@ function In(n) {
|
|
|
3887
4046
|
}
|
|
3888
4047
|
return null;
|
|
3889
4048
|
}
|
|
3890
|
-
function
|
|
4049
|
+
function R(n) {
|
|
3891
4050
|
switch (n) {
|
|
3892
4051
|
case void 0:
|
|
3893
4052
|
case " ":
|
|
@@ -3900,9 +4059,9 @@ function q(n) {
|
|
|
3900
4059
|
return !1;
|
|
3901
4060
|
}
|
|
3902
4061
|
}
|
|
3903
|
-
const
|
|
3904
|
-
\r `),
|
|
3905
|
-
class
|
|
4062
|
+
const Mt = new Set("0123456789ABCDEFabcdef"), Pn = new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"), Le = new Set(",[]{}"), Kn = new Set(` ,[]{}
|
|
4063
|
+
\r `), Ze = (n) => !n || Kn.has(n);
|
|
4064
|
+
class Dn {
|
|
3906
4065
|
constructor() {
|
|
3907
4066
|
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;
|
|
3908
4067
|
}
|
|
@@ -3951,7 +4110,7 @@ class Ln {
|
|
|
3951
4110
|
}
|
|
3952
4111
|
if (t === "-" || t === ".") {
|
|
3953
4112
|
const s = this.buffer.substr(e, 3);
|
|
3954
|
-
if ((s === "---" || s === "...") &&
|
|
4113
|
+
if ((s === "---" || s === "...") && R(this.buffer[e + 3]))
|
|
3955
4114
|
return -1;
|
|
3956
4115
|
}
|
|
3957
4116
|
return e;
|
|
@@ -3994,7 +4153,7 @@ class Ln {
|
|
|
3994
4153
|
let e = this.getLine();
|
|
3995
4154
|
if (e === null)
|
|
3996
4155
|
return this.setNext("stream");
|
|
3997
|
-
if (e[0] ===
|
|
4156
|
+
if (e[0] === bs && (yield* this.pushCount(1), e = e.substring(1)), e[0] === "%") {
|
|
3998
4157
|
let t = e.length, s = e.indexOf("#");
|
|
3999
4158
|
for (; s !== -1; ) {
|
|
4000
4159
|
const r = e[s - 1];
|
|
@@ -4018,7 +4177,7 @@ class Ln {
|
|
|
4018
4177
|
const t = yield* this.pushSpaces(!0);
|
|
4019
4178
|
return yield* this.pushCount(e.length - t), yield* this.pushNewline(), "stream";
|
|
4020
4179
|
}
|
|
4021
|
-
return yield
|
|
4180
|
+
return yield ws, yield* this.parseLineStart();
|
|
4022
4181
|
}
|
|
4023
4182
|
*parseLineStart() {
|
|
4024
4183
|
const e = this.charAt(0);
|
|
@@ -4028,16 +4187,16 @@ class Ln {
|
|
|
4028
4187
|
if (!this.atEnd && !this.hasChars(4))
|
|
4029
4188
|
return this.setNext("line-start");
|
|
4030
4189
|
const t = this.peek(3);
|
|
4031
|
-
if ((t === "---" || t === "...") &&
|
|
4190
|
+
if ((t === "---" || t === "...") && R(this.charAt(3)))
|
|
4032
4191
|
return yield* this.pushCount(3), this.indentValue = 0, this.indentNext = 0, t === "---" ? "doc" : "stream";
|
|
4033
4192
|
}
|
|
4034
|
-
return this.indentValue = yield* this.pushSpaces(!1), this.indentNext > this.indentValue && !
|
|
4193
|
+
return this.indentValue = yield* this.pushSpaces(!1), this.indentNext > this.indentValue && !R(this.charAt(1)) && (this.indentNext = this.indentValue), yield* this.parseBlockStart();
|
|
4035
4194
|
}
|
|
4036
4195
|
*parseBlockStart() {
|
|
4037
4196
|
const [e, t] = this.peek(2);
|
|
4038
4197
|
if (!t && !this.atEnd)
|
|
4039
4198
|
return this.setNext("block-start");
|
|
4040
|
-
if ((e === "-" || e === "?" || e === ":") &&
|
|
4199
|
+
if ((e === "-" || e === "?" || e === ":") && R(t)) {
|
|
4041
4200
|
const s = (yield* this.pushCount(1)) + (yield* this.pushSpaces(!0));
|
|
4042
4201
|
return this.indentNext = this.indentValue + 1, this.indentValue += s, yield* this.parseBlockStart();
|
|
4043
4202
|
}
|
|
@@ -4062,7 +4221,7 @@ class Ln {
|
|
|
4062
4221
|
case "]":
|
|
4063
4222
|
return yield* this.pushCount(1), "doc";
|
|
4064
4223
|
case "*":
|
|
4065
|
-
return yield* this.pushUntil(
|
|
4224
|
+
return yield* this.pushUntil(Ze), "doc";
|
|
4066
4225
|
case '"':
|
|
4067
4226
|
case "'":
|
|
4068
4227
|
return yield* this.parseQuotedScalar();
|
|
@@ -4081,8 +4240,8 @@ class Ln {
|
|
|
4081
4240
|
const i = this.getLine();
|
|
4082
4241
|
if (i === null)
|
|
4083
4242
|
return this.setNext("flow");
|
|
4084
|
-
if ((s !== -1 && s < this.indentNext && i[0] !== "#" || s === 0 && (i.startsWith("---") || i.startsWith("...")) &&
|
|
4085
|
-
return this.flowLevel = 0, yield
|
|
4243
|
+
if ((s !== -1 && s < this.indentNext && i[0] !== "#" || s === 0 && (i.startsWith("---") || i.startsWith("...")) && R(i[3])) && !(s === this.indentNext - 1 && this.flowLevel === 1 && (i[0] === "]" || i[0] === "}")))
|
|
4244
|
+
return this.flowLevel = 0, yield ks, yield* this.parseLineStart();
|
|
4086
4245
|
let r = 0;
|
|
4087
4246
|
for (; i[r] === ","; )
|
|
4088
4247
|
r += yield* this.pushCount(1), r += yield* this.pushSpaces(!0), this.flowKey = !1;
|
|
@@ -4098,13 +4257,13 @@ class Ln {
|
|
|
4098
4257
|
case "]":
|
|
4099
4258
|
return yield* this.pushCount(1), this.flowKey = !0, this.flowLevel -= 1, this.flowLevel ? "flow" : "doc";
|
|
4100
4259
|
case "*":
|
|
4101
|
-
return yield* this.pushUntil(
|
|
4260
|
+
return yield* this.pushUntil(Ze), "flow";
|
|
4102
4261
|
case '"':
|
|
4103
4262
|
case "'":
|
|
4104
4263
|
return this.flowKey = !0, yield* this.parseQuotedScalar();
|
|
4105
4264
|
case ":": {
|
|
4106
4265
|
const o = this.charAt(1);
|
|
4107
|
-
if (this.flowKey ||
|
|
4266
|
+
if (this.flowKey || R(o) || o === ",")
|
|
4108
4267
|
return this.flowKey = !1, yield* this.pushCount(1), yield* this.pushSpaces(!0), "flow";
|
|
4109
4268
|
}
|
|
4110
4269
|
// fallthrough
|
|
@@ -4159,7 +4318,7 @@ class Ln {
|
|
|
4159
4318
|
else if (t !== "-")
|
|
4160
4319
|
break;
|
|
4161
4320
|
}
|
|
4162
|
-
return yield* this.pushUntil((t) =>
|
|
4321
|
+
return yield* this.pushUntil((t) => R(t) || t === "#");
|
|
4163
4322
|
}
|
|
4164
4323
|
*parseBlockScalar() {
|
|
4165
4324
|
let e = this.pos - 1, t = 0, s;
|
|
@@ -4222,7 +4381,7 @@ class Ln {
|
|
|
4222
4381
|
else
|
|
4223
4382
|
break;
|
|
4224
4383
|
} while (!0);
|
|
4225
|
-
return yield
|
|
4384
|
+
return yield rt, yield* this.pushToIndex(e + 1, !0), yield* this.parseLineStart();
|
|
4226
4385
|
}
|
|
4227
4386
|
*parsePlainScalar() {
|
|
4228
4387
|
const e = this.flowLevel > 0;
|
|
@@ -4230,14 +4389,14 @@ class Ln {
|
|
|
4230
4389
|
for (; i = this.buffer[++s]; )
|
|
4231
4390
|
if (i === ":") {
|
|
4232
4391
|
const r = this.buffer[s + 1];
|
|
4233
|
-
if (
|
|
4392
|
+
if (R(r) || e && Le.has(r))
|
|
4234
4393
|
break;
|
|
4235
4394
|
t = s;
|
|
4236
|
-
} else if (
|
|
4395
|
+
} else if (R(i)) {
|
|
4237
4396
|
let r = this.buffer[s + 1];
|
|
4238
4397
|
if (i === "\r" && (r === `
|
|
4239
4398
|
` ? (s += 1, i = `
|
|
4240
|
-
`, r = this.buffer[s + 1]) : t = s), r === "#" || e &&
|
|
4399
|
+
`, r = this.buffer[s + 1]) : t = s), r === "#" || e && Le.has(r))
|
|
4241
4400
|
break;
|
|
4242
4401
|
if (i === `
|
|
4243
4402
|
`) {
|
|
@@ -4247,11 +4406,11 @@ class Ln {
|
|
|
4247
4406
|
s = Math.max(s, o - 2);
|
|
4248
4407
|
}
|
|
4249
4408
|
} else {
|
|
4250
|
-
if (e &&
|
|
4409
|
+
if (e && Le.has(i))
|
|
4251
4410
|
break;
|
|
4252
4411
|
t = s;
|
|
4253
4412
|
}
|
|
4254
|
-
return !i && !this.atEnd ? this.setNext("plain-scalar") : (yield
|
|
4413
|
+
return !i && !this.atEnd ? this.setNext("plain-scalar") : (yield rt, yield* this.pushToIndex(t + 1, !0), e ? "flow" : "doc");
|
|
4255
4414
|
}
|
|
4256
4415
|
*pushCount(e) {
|
|
4257
4416
|
return e > 0 ? (yield this.buffer.substr(this.pos, e), this.pos += e, e) : 0;
|
|
@@ -4265,14 +4424,14 @@ class Ln {
|
|
|
4265
4424
|
case "!":
|
|
4266
4425
|
return (yield* this.pushTag()) + (yield* this.pushSpaces(!0)) + (yield* this.pushIndicators());
|
|
4267
4426
|
case "&":
|
|
4268
|
-
return (yield* this.pushUntil(
|
|
4427
|
+
return (yield* this.pushUntil(Ze)) + (yield* this.pushSpaces(!0)) + (yield* this.pushIndicators());
|
|
4269
4428
|
case "-":
|
|
4270
4429
|
// this is an error
|
|
4271
4430
|
case "?":
|
|
4272
4431
|
// this is an error outside flow collections
|
|
4273
4432
|
case ":": {
|
|
4274
4433
|
const e = this.flowLevel > 0, t = this.charAt(1);
|
|
4275
|
-
if (
|
|
4434
|
+
if (R(t) || e && Le.has(t))
|
|
4276
4435
|
return e ? this.flowKey && (this.flowKey = !1) : this.indentNext = this.indentValue + 1, (yield* this.pushCount(1)) + (yield* this.pushSpaces(!0)) + (yield* this.pushIndicators());
|
|
4277
4436
|
}
|
|
4278
4437
|
}
|
|
@@ -4281,15 +4440,15 @@ class Ln {
|
|
|
4281
4440
|
*pushTag() {
|
|
4282
4441
|
if (this.charAt(1) === "<") {
|
|
4283
4442
|
let e = this.pos + 2, t = this.buffer[e];
|
|
4284
|
-
for (; !
|
|
4443
|
+
for (; !R(t) && t !== ">"; )
|
|
4285
4444
|
t = this.buffer[++e];
|
|
4286
4445
|
return yield* this.pushToIndex(t === ">" ? e + 1 : e, !1);
|
|
4287
4446
|
} else {
|
|
4288
4447
|
let e = this.pos + 1, t = this.buffer[e];
|
|
4289
4448
|
for (; t; )
|
|
4290
|
-
if (
|
|
4449
|
+
if (Pn.has(t))
|
|
4291
4450
|
t = this.buffer[++e];
|
|
4292
|
-
else if (t === "%" &&
|
|
4451
|
+
else if (t === "%" && Mt.has(this.buffer[e + 1]) && Mt.has(this.buffer[e + 2]))
|
|
4293
4452
|
t = this.buffer[e += 3];
|
|
4294
4453
|
else
|
|
4295
4454
|
break;
|
|
@@ -4317,7 +4476,7 @@ class Ln {
|
|
|
4317
4476
|
return yield* this.pushToIndex(t, !1);
|
|
4318
4477
|
}
|
|
4319
4478
|
}
|
|
4320
|
-
class
|
|
4479
|
+
class jn {
|
|
4321
4480
|
constructor() {
|
|
4322
4481
|
this.lineStarts = [], this.addNewLine = (e) => this.lineStarts.push(e), this.linePos = (e) => {
|
|
4323
4482
|
let t = 0, s = this.lineStarts.length;
|
|
@@ -4334,13 +4493,13 @@ class _n {
|
|
|
4334
4493
|
};
|
|
4335
4494
|
}
|
|
4336
4495
|
}
|
|
4337
|
-
function
|
|
4496
|
+
function H(n, e) {
|
|
4338
4497
|
for (let t = 0; t < n.length; ++t)
|
|
4339
4498
|
if (n[t].type === e)
|
|
4340
4499
|
return !0;
|
|
4341
4500
|
return !1;
|
|
4342
4501
|
}
|
|
4343
|
-
function
|
|
4502
|
+
function Bt(n) {
|
|
4344
4503
|
for (let e = 0; e < n.length; ++e)
|
|
4345
4504
|
switch (n[e].type) {
|
|
4346
4505
|
case "space":
|
|
@@ -4352,7 +4511,7 @@ function Lt(n) {
|
|
|
4352
4511
|
}
|
|
4353
4512
|
return -1;
|
|
4354
4513
|
}
|
|
4355
|
-
function
|
|
4514
|
+
function Ss(n) {
|
|
4356
4515
|
switch (n?.type) {
|
|
4357
4516
|
case "alias":
|
|
4358
4517
|
case "scalar":
|
|
@@ -4364,7 +4523,7 @@ function gs(n) {
|
|
|
4364
4523
|
return !1;
|
|
4365
4524
|
}
|
|
4366
4525
|
}
|
|
4367
|
-
function
|
|
4526
|
+
function ve(n) {
|
|
4368
4527
|
switch (n.type) {
|
|
4369
4528
|
case "document":
|
|
4370
4529
|
return n.start;
|
|
@@ -4379,7 +4538,7 @@ function $e(n) {
|
|
|
4379
4538
|
return [];
|
|
4380
4539
|
}
|
|
4381
4540
|
}
|
|
4382
|
-
function
|
|
4541
|
+
function ne(n) {
|
|
4383
4542
|
if (n.length === 0)
|
|
4384
4543
|
return [];
|
|
4385
4544
|
let e = n.length;
|
|
@@ -4396,18 +4555,18 @@ function te(n) {
|
|
|
4396
4555
|
;
|
|
4397
4556
|
return n.splice(e, n.length);
|
|
4398
4557
|
}
|
|
4399
|
-
function
|
|
4558
|
+
function Pt(n) {
|
|
4400
4559
|
if (n.start.type === "flow-seq-start")
|
|
4401
4560
|
for (const e of n.items)
|
|
4402
|
-
e.sep && !e.value && !
|
|
4561
|
+
e.sep && !e.value && !H(e.start, "explicit-key-ind") && !H(e.sep, "map-value-ind") && (e.key && (e.value = e.key), delete e.key, Ss(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);
|
|
4403
4562
|
}
|
|
4404
|
-
class
|
|
4563
|
+
class qn {
|
|
4405
4564
|
/**
|
|
4406
4565
|
* @param onNewLine - If defined, called separately with the start position of
|
|
4407
4566
|
* each new line (in `parse()`, including the start of input).
|
|
4408
4567
|
*/
|
|
4409
4568
|
constructor(e) {
|
|
4410
|
-
this.atNewLine = !0, this.atScalar = !1, this.indent = 0, this.offset = 0, this.onKeyLine = !1, this.stack = [], this.source = "", this.type = "", this.lexer = new
|
|
4569
|
+
this.atNewLine = !0, this.atScalar = !1, this.indent = 0, this.offset = 0, this.onKeyLine = !1, this.stack = [], this.source = "", this.type = "", this.lexer = new Dn(), this.onNewLine = e;
|
|
4411
4570
|
}
|
|
4412
4571
|
/**
|
|
4413
4572
|
* Parse `source` as a YAML stream.
|
|
@@ -4431,7 +4590,7 @@ class Cn {
|
|
|
4431
4590
|
this.atScalar = !1, yield* this.step(), this.offset += e.length;
|
|
4432
4591
|
return;
|
|
4433
4592
|
}
|
|
4434
|
-
const t =
|
|
4593
|
+
const t = Bn(e);
|
|
4435
4594
|
if (t)
|
|
4436
4595
|
if (t === "scalar")
|
|
4437
4596
|
this.atNewLine = !1, this.atScalar = !0, this.type = "scalar";
|
|
@@ -4520,7 +4679,7 @@ class Cn {
|
|
|
4520
4679
|
yield t;
|
|
4521
4680
|
else {
|
|
4522
4681
|
const s = this.peek(1);
|
|
4523
|
-
switch (t.type === "block-scalar" ? t.indent = "indent" in s ? s.indent : 0 : t.type === "flow-collection" && s.type === "document" && (t.indent = 0), t.type === "flow-collection" &&
|
|
4682
|
+
switch (t.type === "block-scalar" ? t.indent = "indent" in s ? s.indent : 0 : t.type === "flow-collection" && s.type === "document" && (t.indent = 0), t.type === "flow-collection" && Pt(t), s.type) {
|
|
4524
4683
|
case "document":
|
|
4525
4684
|
s.value = t;
|
|
4526
4685
|
break;
|
|
@@ -4556,7 +4715,7 @@ class Cn {
|
|
|
4556
4715
|
}
|
|
4557
4716
|
if ((s.type === "document" || s.type === "block-map" || s.type === "block-seq") && (t.type === "block-map" || t.type === "block-seq")) {
|
|
4558
4717
|
const i = t.items[t.items.length - 1];
|
|
4559
|
-
i && !i.sep && !i.value && i.start.length > 0 &&
|
|
4718
|
+
i && !i.sep && !i.value && i.start.length > 0 && Bt(i.start) === -1 && (t.indent === 0 || i.start.every((r) => r.type !== "comment" || r.indent < t.indent)) && (s.type === "document" ? s.end = i.start : s.items.push({ start: i.start }), t.items.splice(-1, 1));
|
|
4560
4719
|
}
|
|
4561
4720
|
}
|
|
4562
4721
|
}
|
|
@@ -4594,7 +4753,7 @@ class Cn {
|
|
|
4594
4753
|
return yield* this.lineEnd(e);
|
|
4595
4754
|
switch (this.type) {
|
|
4596
4755
|
case "doc-start": {
|
|
4597
|
-
|
|
4756
|
+
Bt(e.start) !== -1 ? (yield* this.pop(), yield* this.step()) : e.start.push(this.sourceToken);
|
|
4598
4757
|
return;
|
|
4599
4758
|
}
|
|
4600
4759
|
case "anchor":
|
|
@@ -4615,7 +4774,7 @@ class Cn {
|
|
|
4615
4774
|
}
|
|
4616
4775
|
*scalar(e) {
|
|
4617
4776
|
if (this.type === "map-value-ind") {
|
|
4618
|
-
const t =
|
|
4777
|
+
const t = ve(this.peek(2)), s = ne(t);
|
|
4619
4778
|
let i;
|
|
4620
4779
|
e.end ? (i = e.end, i.push(this.sourceToken), delete e.end) : i = [this.sourceToken];
|
|
4621
4780
|
const r = {
|
|
@@ -4717,15 +4876,15 @@ class Cn {
|
|
|
4717
4876
|
if (t.sep)
|
|
4718
4877
|
if (t.value)
|
|
4719
4878
|
e.items.push({ start: [], key: null, sep: [this.sourceToken] });
|
|
4720
|
-
else if (
|
|
4879
|
+
else if (H(t.sep, "map-value-ind"))
|
|
4721
4880
|
this.stack.push({
|
|
4722
4881
|
type: "block-map",
|
|
4723
4882
|
offset: this.offset,
|
|
4724
4883
|
indent: this.indent,
|
|
4725
4884
|
items: [{ start: r, key: null, sep: [this.sourceToken] }]
|
|
4726
4885
|
});
|
|
4727
|
-
else if (
|
|
4728
|
-
const o =
|
|
4886
|
+
else if (Ss(t.key) && !H(t.sep, "newline")) {
|
|
4887
|
+
const o = ne(t.start), a = t.key, l = t.sep;
|
|
4729
4888
|
l.push(this.sourceToken), delete t.key, delete t.sep, this.stack.push({
|
|
4730
4889
|
type: "block-map",
|
|
4731
4890
|
offset: this.offset,
|
|
@@ -4733,10 +4892,10 @@ class Cn {
|
|
|
4733
4892
|
items: [{ start: o, key: a, sep: l }]
|
|
4734
4893
|
});
|
|
4735
4894
|
} else r.length > 0 ? t.sep = t.sep.concat(r, this.sourceToken) : t.sep.push(this.sourceToken);
|
|
4736
|
-
else if (
|
|
4895
|
+
else if (H(t.start, "newline"))
|
|
4737
4896
|
Object.assign(t, { key: null, sep: [this.sourceToken] });
|
|
4738
4897
|
else {
|
|
4739
|
-
const o =
|
|
4898
|
+
const o = ne(t.start);
|
|
4740
4899
|
this.stack.push({
|
|
4741
4900
|
type: "block-map",
|
|
4742
4901
|
offset: this.offset,
|
|
@@ -4745,7 +4904,7 @@ class Cn {
|
|
|
4745
4904
|
});
|
|
4746
4905
|
}
|
|
4747
4906
|
else
|
|
4748
|
-
t.sep ? t.value || i ? e.items.push({ start: r, key: null, sep: [this.sourceToken] }) :
|
|
4907
|
+
t.sep ? t.value || i ? e.items.push({ start: r, key: null, sep: [this.sourceToken] }) : H(t.sep, "map-value-ind") ? this.stack.push({
|
|
4749
4908
|
type: "block-map",
|
|
4750
4909
|
offset: this.offset,
|
|
4751
4910
|
indent: this.indent,
|
|
@@ -4765,7 +4924,7 @@ class Cn {
|
|
|
4765
4924
|
const o = this.startBlockValue(e);
|
|
4766
4925
|
if (o) {
|
|
4767
4926
|
if (o.type === "block-seq") {
|
|
4768
|
-
if (!t.explicitKey && t.sep && !
|
|
4927
|
+
if (!t.explicitKey && t.sep && !H(t.sep, "newline")) {
|
|
4769
4928
|
yield* this.pop({
|
|
4770
4929
|
type: "error",
|
|
4771
4930
|
offset: this.offset,
|
|
@@ -4817,7 +4976,7 @@ class Cn {
|
|
|
4817
4976
|
case "seq-item-ind":
|
|
4818
4977
|
if (this.indent !== e.indent)
|
|
4819
4978
|
break;
|
|
4820
|
-
t.value ||
|
|
4979
|
+
t.value || H(t.start, "seq-item-ind") ? e.items.push({ start: [this.sourceToken] }) : t.start.push(this.sourceToken);
|
|
4821
4980
|
return;
|
|
4822
4981
|
}
|
|
4823
4982
|
if (this.indent > e.indent) {
|
|
@@ -4872,8 +5031,8 @@ class Cn {
|
|
|
4872
5031
|
if (s.type === "block-map" && (this.type === "map-value-ind" && s.indent === e.indent || this.type === "newline" && !s.items[s.items.length - 1].sep))
|
|
4873
5032
|
yield* this.pop(), yield* this.step();
|
|
4874
5033
|
else if (this.type === "map-value-ind" && s.type !== "flow-collection") {
|
|
4875
|
-
const i =
|
|
4876
|
-
|
|
5034
|
+
const i = ve(s), r = ne(i);
|
|
5035
|
+
Pt(e);
|
|
4877
5036
|
const o = e.end.splice(1, e.end.length);
|
|
4878
5037
|
o.push(this.sourceToken);
|
|
4879
5038
|
const a = {
|
|
@@ -4936,7 +5095,7 @@ class Cn {
|
|
|
4936
5095
|
};
|
|
4937
5096
|
case "explicit-key-ind": {
|
|
4938
5097
|
this.onKeyLine = !0;
|
|
4939
|
-
const t =
|
|
5098
|
+
const t = ve(e), s = ne(t);
|
|
4940
5099
|
return s.push(this.sourceToken), {
|
|
4941
5100
|
type: "block-map",
|
|
4942
5101
|
offset: this.offset,
|
|
@@ -4946,7 +5105,7 @@ class Cn {
|
|
|
4946
5105
|
}
|
|
4947
5106
|
case "map-value-ind": {
|
|
4948
5107
|
this.onKeyLine = !0;
|
|
4949
|
-
const t =
|
|
5108
|
+
const t = ve(e), s = ne(t);
|
|
4950
5109
|
return {
|
|
4951
5110
|
type: "block-map",
|
|
4952
5111
|
offset: this.offset,
|
|
@@ -4980,26 +5139,26 @@ class Cn {
|
|
|
4980
5139
|
}
|
|
4981
5140
|
}
|
|
4982
5141
|
}
|
|
4983
|
-
function
|
|
5142
|
+
function Rn(n) {
|
|
4984
5143
|
const e = n.prettyErrors !== !1;
|
|
4985
|
-
return { lineCounter: n.lineCounter || e && new
|
|
5144
|
+
return { lineCounter: n.lineCounter || e && new jn() || null, prettyErrors: e };
|
|
4986
5145
|
}
|
|
4987
|
-
function
|
|
4988
|
-
const { lineCounter: t, prettyErrors: s } =
|
|
5146
|
+
function Fn(n, e = {}) {
|
|
5147
|
+
const { lineCounter: t, prettyErrors: s } = Rn(e), i = new qn(t?.addNewLine), r = new Mn(e);
|
|
4989
5148
|
let o = null;
|
|
4990
5149
|
for (const a of r.compose(i.parse(n), !0, n.length))
|
|
4991
5150
|
if (!o)
|
|
4992
5151
|
o = a;
|
|
4993
5152
|
else if (o.options.logLevel !== "silent") {
|
|
4994
|
-
o.errors.push(new
|
|
5153
|
+
o.errors.push(new ye(a.range.slice(0, 2), "MULTIPLE_DOCS", "Source contains multiple documents; please use YAML.parseAllDocuments()"));
|
|
4995
5154
|
break;
|
|
4996
5155
|
}
|
|
4997
|
-
return s && t && (o.errors.forEach(
|
|
5156
|
+
return s && t && (o.errors.forEach(vt(n, t)), o.warnings.forEach(vt(n, t))), o;
|
|
4998
5157
|
}
|
|
4999
|
-
function
|
|
5158
|
+
function ei(n) {
|
|
5000
5159
|
const t = n.unwrap().children[0];
|
|
5001
5160
|
if (!t)
|
|
5002
|
-
return
|
|
5161
|
+
return $(
|
|
5003
5162
|
"frontmatter",
|
|
5004
5163
|
"Document has no content",
|
|
5005
5164
|
n.path,
|
|
@@ -5008,8 +5167,8 @@ function Vn(n) {
|
|
|
5008
5167
|
if (t.type === "yaml") {
|
|
5009
5168
|
const s = t;
|
|
5010
5169
|
try {
|
|
5011
|
-
const r =
|
|
5012
|
-
return
|
|
5170
|
+
const r = Fn(s.value).toJSON();
|
|
5171
|
+
return M(
|
|
5013
5172
|
{
|
|
5014
5173
|
format: "yaml",
|
|
5015
5174
|
data: r,
|
|
@@ -5018,7 +5177,7 @@ function Vn(n) {
|
|
|
5018
5177
|
n.path
|
|
5019
5178
|
);
|
|
5020
5179
|
} catch (i) {
|
|
5021
|
-
return
|
|
5180
|
+
return $(
|
|
5022
5181
|
"frontmatter",
|
|
5023
5182
|
`Failed to parse YAML frontmatter: ${i instanceof Error ? i.message : String(i)}`,
|
|
5024
5183
|
n.path,
|
|
@@ -5026,43 +5185,43 @@ function Vn(n) {
|
|
|
5026
5185
|
);
|
|
5027
5186
|
}
|
|
5028
5187
|
}
|
|
5029
|
-
return t.type === "toml" ?
|
|
5188
|
+
return t.type === "toml" ? $(
|
|
5030
5189
|
"frontmatter",
|
|
5031
5190
|
"TOML frontmatter parsing requires @origints/toml",
|
|
5032
5191
|
n.path,
|
|
5033
5192
|
n.position
|
|
5034
|
-
) :
|
|
5193
|
+
) : $(
|
|
5035
5194
|
"frontmatter",
|
|
5036
5195
|
"No frontmatter found in document",
|
|
5037
5196
|
n.path,
|
|
5038
5197
|
n.position
|
|
5039
5198
|
);
|
|
5040
5199
|
}
|
|
5041
|
-
function
|
|
5200
|
+
function ti(n) {
|
|
5042
5201
|
const s = n.unwrap().children[0]?.type;
|
|
5043
5202
|
return s === "yaml" || s === "toml";
|
|
5044
5203
|
}
|
|
5045
|
-
function
|
|
5204
|
+
function si(n) {
|
|
5046
5205
|
const e = n.unwrap(), s = e.children[0]?.type;
|
|
5047
5206
|
if (s === "yaml" || s === "toml") {
|
|
5048
5207
|
const i = {
|
|
5049
5208
|
type: "root",
|
|
5050
5209
|
children: e.children.slice(1)
|
|
5051
5210
|
};
|
|
5052
|
-
return
|
|
5211
|
+
return U.fromRoot(i);
|
|
5053
5212
|
}
|
|
5054
5213
|
return n;
|
|
5055
5214
|
}
|
|
5056
|
-
function
|
|
5215
|
+
function ni(n, e = {}) {
|
|
5057
5216
|
const { gfm: t = !0, allowDangerousHtml: s = !1 } = e;
|
|
5058
5217
|
try {
|
|
5059
5218
|
const i = n.unwrap();
|
|
5060
|
-
let r =
|
|
5061
|
-
t && (r = r.use(
|
|
5219
|
+
let r = ot();
|
|
5220
|
+
t && (r = r.use(at)), r = r.use(Dt, { allowDangerousHtml: s }).use(jt, { allowDangerousHtml: s });
|
|
5062
5221
|
const o = r.runSync(i), a = r.stringify(o);
|
|
5063
|
-
return
|
|
5222
|
+
return M(String(a), n.path);
|
|
5064
5223
|
} catch (i) {
|
|
5065
|
-
return
|
|
5224
|
+
return $(
|
|
5066
5225
|
"parse",
|
|
5067
5226
|
`Failed to convert to HTML: ${i instanceof Error ? i.message : String(i)}`,
|
|
5068
5227
|
n.path,
|
|
@@ -5070,15 +5229,15 @@ function Yn(n, e = {}) {
|
|
|
5070
5229
|
);
|
|
5071
5230
|
}
|
|
5072
5231
|
}
|
|
5073
|
-
function
|
|
5232
|
+
function ii(n, e = {}) {
|
|
5074
5233
|
const { gfm: t = !0, allowDangerousHtml: s = !1 } = e;
|
|
5075
5234
|
try {
|
|
5076
|
-
let i =
|
|
5077
|
-
t && (i = i.use(
|
|
5078
|
-
const r = i.use(
|
|
5079
|
-
return
|
|
5235
|
+
let i = ot().use(Kt);
|
|
5236
|
+
t && (i = i.use(at));
|
|
5237
|
+
const r = i.use(Dt, { allowDangerousHtml: s }).use(jt, { allowDangerousHtml: s }).processSync(n);
|
|
5238
|
+
return M(String(r), []);
|
|
5080
5239
|
} catch (i) {
|
|
5081
|
-
return
|
|
5240
|
+
return $(
|
|
5082
5241
|
"parse",
|
|
5083
5242
|
`Failed to convert to HTML: ${i instanceof Error ? i.message : String(i)}`,
|
|
5084
5243
|
[],
|
|
@@ -5086,22 +5245,30 @@ function Gn(n, e = {}) {
|
|
|
5086
5245
|
);
|
|
5087
5246
|
}
|
|
5088
5247
|
}
|
|
5089
|
-
function
|
|
5090
|
-
n.register(
|
|
5248
|
+
function Un(n) {
|
|
5249
|
+
n.register(Ls);
|
|
5091
5250
|
}
|
|
5251
|
+
Un(As);
|
|
5252
|
+
Ts(
|
|
5253
|
+
"markdown",
|
|
5254
|
+
(n, e) => vs(n, e)
|
|
5255
|
+
);
|
|
5092
5256
|
export {
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
|
|
5096
|
-
|
|
5097
|
-
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
|
|
5257
|
+
U as MarkdownNode,
|
|
5258
|
+
V as MarkdownNodeSB,
|
|
5259
|
+
lt as MarkdownSpecBuilder,
|
|
5260
|
+
vs as executeMarkdownSpec,
|
|
5261
|
+
ei as extractFrontmatter,
|
|
5262
|
+
$ as fail,
|
|
5263
|
+
Xn as formatMarkdownPath,
|
|
5264
|
+
ti as hasFrontmatter,
|
|
5265
|
+
ii as markdownToHtml,
|
|
5266
|
+
M as ok,
|
|
5267
|
+
zn as parseMarkdown,
|
|
5268
|
+
Ls as parseMarkdownAsyncImpl,
|
|
5269
|
+
Zn as parseMarkdownImpl,
|
|
5270
|
+
Un as registerMarkdownTransforms,
|
|
5271
|
+
ni as toHtml,
|
|
5272
|
+
si as withoutFrontmatter
|
|
5106
5273
|
};
|
|
5107
5274
|
//# sourceMappingURL=index.es.js.map
|