@quilted/create 0.1.21 → 0.1.22
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/CHANGELOG.md +6 -0
- package/build/cjs/app.cjs +244 -525
- package/build/cjs/index.cjs +255 -996
- package/build/cjs/index3.cjs +1205 -577
- package/build/cjs/package-manager.cjs +207 -799
- package/build/cjs/package.cjs +326 -701
- package/build/cjs/parser-babel.cjs +3 -3
- package/build/cjs/parser-yaml.cjs +2 -2
- package/build/cjs/standalone.cjs +3 -3
- package/build/esm/app.mjs +249 -530
- package/build/esm/index.mjs +239 -978
- package/build/esm/index3.mjs +1205 -548
- package/build/esm/package-manager.mjs +208 -799
- package/build/esm/package.mjs +326 -701
- package/build/esm/parser-babel.mjs +1 -1
- package/build/esm/parser-yaml.mjs +1 -1
- package/build/esm/standalone.mjs +1 -1
- package/package.json +1 -1
- package/build/cjs/_commonjsHelpers.cjs +0 -10
- package/build/esm/_commonjsHelpers.mjs +0 -7
package/build/esm/index3.mjs
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
function _mergeNamespaces(n, m) {
|
|
2
|
+
m.forEach(function (e) {
|
|
3
|
+
e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
|
|
4
|
+
if (k !== 'default' && !(k in n)) {
|
|
5
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
6
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () { return e[k]; }
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
return Object.freeze(n);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
var dist = {};
|
|
17
|
+
|
|
18
|
+
var composer$2 = {};
|
|
19
|
+
|
|
20
|
+
var directives$2 = {};
|
|
21
|
+
|
|
22
|
+
var Node$t = {};
|
|
23
|
+
|
|
1
24
|
const ALIAS = Symbol.for('yaml.alias');
|
|
2
25
|
const DOC = Symbol.for('yaml.document');
|
|
3
26
|
const MAP = Symbol.for('yaml.map');
|
|
@@ -5,13 +28,13 @@ const PAIR = Symbol.for('yaml.pair');
|
|
|
5
28
|
const SCALAR$1 = Symbol.for('yaml.scalar');
|
|
6
29
|
const SEQ = Symbol.for('yaml.seq');
|
|
7
30
|
const NODE_TYPE = Symbol.for('yaml.node.type');
|
|
8
|
-
const isAlias = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === ALIAS;
|
|
9
|
-
const isDocument = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === DOC;
|
|
10
|
-
const isMap = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === MAP;
|
|
11
|
-
const isPair = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === PAIR;
|
|
12
|
-
const isScalar$
|
|
13
|
-
const isSeq = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === SEQ;
|
|
14
|
-
function isCollection$
|
|
31
|
+
const isAlias$1 = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === ALIAS;
|
|
32
|
+
const isDocument$1 = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === DOC;
|
|
33
|
+
const isMap$1 = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === MAP;
|
|
34
|
+
const isPair$1 = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === PAIR;
|
|
35
|
+
const isScalar$2 = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === SCALAR$1;
|
|
36
|
+
const isSeq$1 = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === SEQ;
|
|
37
|
+
function isCollection$2(node) {
|
|
15
38
|
if (node && typeof node === 'object')
|
|
16
39
|
switch (node[NODE_TYPE]) {
|
|
17
40
|
case MAP:
|
|
@@ -20,7 +43,7 @@ function isCollection$1(node) {
|
|
|
20
43
|
}
|
|
21
44
|
return false;
|
|
22
45
|
}
|
|
23
|
-
function isNode(node) {
|
|
46
|
+
function isNode$1(node) {
|
|
24
47
|
if (node && typeof node === 'object')
|
|
25
48
|
switch (node[NODE_TYPE]) {
|
|
26
49
|
case ALIAS:
|
|
@@ -31,7 +54,7 @@ function isNode(node) {
|
|
|
31
54
|
}
|
|
32
55
|
return false;
|
|
33
56
|
}
|
|
34
|
-
const hasAnchor = (node) => (isScalar$
|
|
57
|
+
const hasAnchor = (node) => (isScalar$2(node) || isCollection$2(node)) && !!node.anchor;
|
|
35
58
|
class NodeBase {
|
|
36
59
|
constructor(type) {
|
|
37
60
|
Object.defineProperty(this, NODE_TYPE, { value: type });
|
|
@@ -45,6 +68,28 @@ class NodeBase {
|
|
|
45
68
|
}
|
|
46
69
|
}
|
|
47
70
|
|
|
71
|
+
Node$t.ALIAS = ALIAS;
|
|
72
|
+
Node$t.DOC = DOC;
|
|
73
|
+
Node$t.MAP = MAP;
|
|
74
|
+
Node$t.NODE_TYPE = NODE_TYPE;
|
|
75
|
+
Node$t.NodeBase = NodeBase;
|
|
76
|
+
Node$t.PAIR = PAIR;
|
|
77
|
+
Node$t.SCALAR = SCALAR$1;
|
|
78
|
+
Node$t.SEQ = SEQ;
|
|
79
|
+
Node$t.hasAnchor = hasAnchor;
|
|
80
|
+
Node$t.isAlias = isAlias$1;
|
|
81
|
+
Node$t.isCollection = isCollection$2;
|
|
82
|
+
Node$t.isDocument = isDocument$1;
|
|
83
|
+
Node$t.isMap = isMap$1;
|
|
84
|
+
Node$t.isNode = isNode$1;
|
|
85
|
+
Node$t.isPair = isPair$1;
|
|
86
|
+
Node$t.isScalar = isScalar$2;
|
|
87
|
+
Node$t.isSeq = isSeq$1;
|
|
88
|
+
|
|
89
|
+
var visit$6 = {};
|
|
90
|
+
|
|
91
|
+
var Node$s = Node$t;
|
|
92
|
+
|
|
48
93
|
const BREAK$1 = Symbol('break visit');
|
|
49
94
|
const SKIP$1 = Symbol('skip children');
|
|
50
95
|
const REMOVE$1 = Symbol('remove node');
|
|
@@ -78,9 +123,9 @@ const REMOVE$1 = Symbol('remove node');
|
|
|
78
123
|
* and `Node` (alias, map, seq & scalar) targets. Of all these, only the most
|
|
79
124
|
* specific defined one will be used for each node.
|
|
80
125
|
*/
|
|
81
|
-
function visit$
|
|
126
|
+
function visit$5(node, visitor) {
|
|
82
127
|
const visitor_ = initVisitor(visitor);
|
|
83
|
-
if (isDocument(node)) {
|
|
128
|
+
if (Node$s.isDocument(node)) {
|
|
84
129
|
const cd = visit_(null, node.contents, visitor_, Object.freeze([node]));
|
|
85
130
|
if (cd === REMOVE$1)
|
|
86
131
|
node.contents = null;
|
|
@@ -92,19 +137,19 @@ function visit$1(node, visitor) {
|
|
|
92
137
|
// namespace using `var`, but then complains about that because
|
|
93
138
|
// `unique symbol` must be `const`.
|
|
94
139
|
/** Terminate visit traversal completely */
|
|
95
|
-
visit$
|
|
140
|
+
visit$5.BREAK = BREAK$1;
|
|
96
141
|
/** Do not visit the children of the current node */
|
|
97
|
-
visit$
|
|
142
|
+
visit$5.SKIP = SKIP$1;
|
|
98
143
|
/** Remove the current node */
|
|
99
|
-
visit$
|
|
144
|
+
visit$5.REMOVE = REMOVE$1;
|
|
100
145
|
function visit_(key, node, visitor, path) {
|
|
101
146
|
const ctrl = callVisitor(key, node, visitor, path);
|
|
102
|
-
if (isNode(ctrl) || isPair(ctrl)) {
|
|
147
|
+
if (Node$s.isNode(ctrl) || Node$s.isPair(ctrl)) {
|
|
103
148
|
replaceNode(key, path, ctrl);
|
|
104
149
|
return visit_(key, ctrl, visitor, path);
|
|
105
150
|
}
|
|
106
151
|
if (typeof ctrl !== 'symbol') {
|
|
107
|
-
if (isCollection
|
|
152
|
+
if (Node$s.isCollection(node)) {
|
|
108
153
|
path = Object.freeze(path.concat(node));
|
|
109
154
|
for (let i = 0; i < node.items.length; ++i) {
|
|
110
155
|
const ci = visit_(i, node.items[i], visitor, path);
|
|
@@ -118,7 +163,7 @@ function visit_(key, node, visitor, path) {
|
|
|
118
163
|
}
|
|
119
164
|
}
|
|
120
165
|
}
|
|
121
|
-
else if (isPair(node)) {
|
|
166
|
+
else if (Node$s.isPair(node)) {
|
|
122
167
|
path = Object.freeze(path.concat(node));
|
|
123
168
|
const ck = visit_('key', node.key, visitor, path);
|
|
124
169
|
if (ck === BREAK$1)
|
|
@@ -165,9 +210,9 @@ function visit_(key, node, visitor, path) {
|
|
|
165
210
|
* and `Node` (alias, map, seq & scalar) targets. Of all these, only the most
|
|
166
211
|
* specific defined one will be used for each node.
|
|
167
212
|
*/
|
|
168
|
-
async function visitAsync(node, visitor) {
|
|
213
|
+
async function visitAsync$1(node, visitor) {
|
|
169
214
|
const visitor_ = initVisitor(visitor);
|
|
170
|
-
if (isDocument(node)) {
|
|
215
|
+
if (Node$s.isDocument(node)) {
|
|
171
216
|
const cd = await visitAsync_(null, node.contents, visitor_, Object.freeze([node]));
|
|
172
217
|
if (cd === REMOVE$1)
|
|
173
218
|
node.contents = null;
|
|
@@ -179,19 +224,19 @@ async function visitAsync(node, visitor) {
|
|
|
179
224
|
// namespace using `var`, but then complains about that because
|
|
180
225
|
// `unique symbol` must be `const`.
|
|
181
226
|
/** Terminate visit traversal completely */
|
|
182
|
-
visitAsync.BREAK = BREAK$1;
|
|
227
|
+
visitAsync$1.BREAK = BREAK$1;
|
|
183
228
|
/** Do not visit the children of the current node */
|
|
184
|
-
visitAsync.SKIP = SKIP$1;
|
|
229
|
+
visitAsync$1.SKIP = SKIP$1;
|
|
185
230
|
/** Remove the current node */
|
|
186
|
-
visitAsync.REMOVE = REMOVE$1;
|
|
231
|
+
visitAsync$1.REMOVE = REMOVE$1;
|
|
187
232
|
async function visitAsync_(key, node, visitor, path) {
|
|
188
233
|
const ctrl = await callVisitor(key, node, visitor, path);
|
|
189
|
-
if (isNode(ctrl) || isPair(ctrl)) {
|
|
234
|
+
if (Node$s.isNode(ctrl) || Node$s.isPair(ctrl)) {
|
|
190
235
|
replaceNode(key, path, ctrl);
|
|
191
236
|
return visitAsync_(key, ctrl, visitor, path);
|
|
192
237
|
}
|
|
193
238
|
if (typeof ctrl !== 'symbol') {
|
|
194
|
-
if (isCollection
|
|
239
|
+
if (Node$s.isCollection(node)) {
|
|
195
240
|
path = Object.freeze(path.concat(node));
|
|
196
241
|
for (let i = 0; i < node.items.length; ++i) {
|
|
197
242
|
const ci = await visitAsync_(i, node.items[i], visitor, path);
|
|
@@ -205,7 +250,7 @@ async function visitAsync_(key, node, visitor, path) {
|
|
|
205
250
|
}
|
|
206
251
|
}
|
|
207
252
|
}
|
|
208
|
-
else if (isPair(node)) {
|
|
253
|
+
else if (Node$s.isPair(node)) {
|
|
209
254
|
path = Object.freeze(path.concat(node));
|
|
210
255
|
const ck = await visitAsync_('key', node.key, visitor, path);
|
|
211
256
|
if (ck === BREAK$1)
|
|
@@ -243,38 +288,44 @@ function initVisitor(visitor) {
|
|
|
243
288
|
function callVisitor(key, node, visitor, path) {
|
|
244
289
|
if (typeof visitor === 'function')
|
|
245
290
|
return visitor(key, node, path);
|
|
246
|
-
if (isMap(node))
|
|
291
|
+
if (Node$s.isMap(node))
|
|
247
292
|
return visitor.Map?.(key, node, path);
|
|
248
|
-
if (isSeq(node))
|
|
293
|
+
if (Node$s.isSeq(node))
|
|
249
294
|
return visitor.Seq?.(key, node, path);
|
|
250
|
-
if (isPair(node))
|
|
295
|
+
if (Node$s.isPair(node))
|
|
251
296
|
return visitor.Pair?.(key, node, path);
|
|
252
|
-
if (isScalar
|
|
297
|
+
if (Node$s.isScalar(node))
|
|
253
298
|
return visitor.Scalar?.(key, node, path);
|
|
254
|
-
if (isAlias(node))
|
|
299
|
+
if (Node$s.isAlias(node))
|
|
255
300
|
return visitor.Alias?.(key, node, path);
|
|
256
301
|
return undefined;
|
|
257
302
|
}
|
|
258
303
|
function replaceNode(key, path, node) {
|
|
259
304
|
const parent = path[path.length - 1];
|
|
260
|
-
if (isCollection
|
|
305
|
+
if (Node$s.isCollection(parent)) {
|
|
261
306
|
parent.items[key] = node;
|
|
262
307
|
}
|
|
263
|
-
else if (isPair(parent)) {
|
|
308
|
+
else if (Node$s.isPair(parent)) {
|
|
264
309
|
if (key === 'key')
|
|
265
310
|
parent.key = node;
|
|
266
311
|
else
|
|
267
312
|
parent.value = node;
|
|
268
313
|
}
|
|
269
|
-
else if (isDocument(parent)) {
|
|
314
|
+
else if (Node$s.isDocument(parent)) {
|
|
270
315
|
parent.contents = node;
|
|
271
316
|
}
|
|
272
317
|
else {
|
|
273
|
-
const pt = isAlias(parent) ? 'alias' : 'scalar';
|
|
318
|
+
const pt = Node$s.isAlias(parent) ? 'alias' : 'scalar';
|
|
274
319
|
throw new Error(`Cannot replace node with ${pt} parent`);
|
|
275
320
|
}
|
|
276
321
|
}
|
|
277
322
|
|
|
323
|
+
visit$6.visit = visit$5;
|
|
324
|
+
visit$6.visitAsync = visitAsync$1;
|
|
325
|
+
|
|
326
|
+
var Node$r = Node$t;
|
|
327
|
+
var visit$4 = visit$6;
|
|
328
|
+
|
|
278
329
|
const escapeChars = {
|
|
279
330
|
'!': '%21',
|
|
280
331
|
',': '%2C',
|
|
@@ -418,10 +469,10 @@ class Directives {
|
|
|
418
469
|
: [];
|
|
419
470
|
const tagEntries = Object.entries(this.tags);
|
|
420
471
|
let tagNames;
|
|
421
|
-
if (doc && tagEntries.length > 0 && isNode(doc.contents)) {
|
|
472
|
+
if (doc && tagEntries.length > 0 && Node$r.isNode(doc.contents)) {
|
|
422
473
|
const tags = {};
|
|
423
|
-
visit$
|
|
424
|
-
if (isNode(node) && node.tag)
|
|
474
|
+
visit$4.visit(doc.contents, (_key, node) => {
|
|
475
|
+
if (Node$r.isNode(node) && node.tag)
|
|
425
476
|
tags[node.tag] = true;
|
|
426
477
|
});
|
|
427
478
|
tagNames = Object.keys(tags);
|
|
@@ -440,6 +491,17 @@ class Directives {
|
|
|
440
491
|
Directives.defaultYaml = { explicit: false, version: '1.2' };
|
|
441
492
|
Directives.defaultTags = { '!!': 'tag:yaml.org,2002:' };
|
|
442
493
|
|
|
494
|
+
directives$2.Directives = Directives;
|
|
495
|
+
|
|
496
|
+
var Document$5 = {};
|
|
497
|
+
|
|
498
|
+
var Alias$5 = {};
|
|
499
|
+
|
|
500
|
+
var anchors$3 = {};
|
|
501
|
+
|
|
502
|
+
var Node$q = Node$t;
|
|
503
|
+
var visit$3 = visit$6;
|
|
504
|
+
|
|
443
505
|
/**
|
|
444
506
|
* Verify that the input string is a valid anchor.
|
|
445
507
|
*
|
|
@@ -455,7 +517,7 @@ function anchorIsValid(anchor) {
|
|
|
455
517
|
}
|
|
456
518
|
function anchorNames(root) {
|
|
457
519
|
const anchors = new Set();
|
|
458
|
-
visit$
|
|
520
|
+
visit$3.visit(root, {
|
|
459
521
|
Value(_key, node) {
|
|
460
522
|
if (node.anchor)
|
|
461
523
|
anchors.add(node.anchor);
|
|
@@ -494,7 +556,7 @@ function createNodeAnchors(doc, prefix) {
|
|
|
494
556
|
const ref = sourceObjects.get(source);
|
|
495
557
|
if (typeof ref === 'object' &&
|
|
496
558
|
ref.anchor &&
|
|
497
|
-
(isScalar
|
|
559
|
+
(Node$q.isScalar(ref.node) || Node$q.isCollection(ref.node))) {
|
|
498
560
|
ref.node.anchor = ref.anchor;
|
|
499
561
|
}
|
|
500
562
|
else {
|
|
@@ -508,9 +570,18 @@ function createNodeAnchors(doc, prefix) {
|
|
|
508
570
|
};
|
|
509
571
|
}
|
|
510
572
|
|
|
511
|
-
|
|
573
|
+
anchors$3.anchorIsValid = anchorIsValid;
|
|
574
|
+
anchors$3.anchorNames = anchorNames;
|
|
575
|
+
anchors$3.createNodeAnchors = createNodeAnchors;
|
|
576
|
+
anchors$3.findNewAnchor = findNewAnchor;
|
|
577
|
+
|
|
578
|
+
var anchors$2 = anchors$3;
|
|
579
|
+
var visit$2 = visit$6;
|
|
580
|
+
var Node$p = Node$t;
|
|
581
|
+
|
|
582
|
+
class Alias$4 extends Node$p.NodeBase {
|
|
512
583
|
constructor(source) {
|
|
513
|
-
super(ALIAS);
|
|
584
|
+
super(Node$p.ALIAS);
|
|
514
585
|
this.source = source;
|
|
515
586
|
Object.defineProperty(this, 'tag', {
|
|
516
587
|
set() {
|
|
@@ -524,10 +595,10 @@ class Alias extends NodeBase {
|
|
|
524
595
|
*/
|
|
525
596
|
resolve(doc) {
|
|
526
597
|
let found = undefined;
|
|
527
|
-
visit$
|
|
598
|
+
visit$2.visit(doc, {
|
|
528
599
|
Node: (_key, node) => {
|
|
529
600
|
if (node === this)
|
|
530
|
-
return visit$
|
|
601
|
+
return visit$2.visit.BREAK;
|
|
531
602
|
if (node.anchor === this.source)
|
|
532
603
|
found = node;
|
|
533
604
|
}
|
|
@@ -563,7 +634,7 @@ class Alias extends NodeBase {
|
|
|
563
634
|
toString(ctx, _onComment, _onChompKeep) {
|
|
564
635
|
const src = `*${this.source}`;
|
|
565
636
|
if (ctx) {
|
|
566
|
-
anchorIsValid(this.source);
|
|
637
|
+
anchors$2.anchorIsValid(this.source);
|
|
567
638
|
if (ctx.options.verifyAliasOrder && !ctx.anchors.has(this.source)) {
|
|
568
639
|
const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
|
|
569
640
|
throw new Error(msg);
|
|
@@ -575,12 +646,12 @@ class Alias extends NodeBase {
|
|
|
575
646
|
}
|
|
576
647
|
}
|
|
577
648
|
function getAliasCount(doc, node, anchors) {
|
|
578
|
-
if (isAlias(node)) {
|
|
649
|
+
if (Node$p.isAlias(node)) {
|
|
579
650
|
const source = node.resolve(doc);
|
|
580
651
|
const anchor = anchors && source && anchors.get(source);
|
|
581
652
|
return anchor ? anchor.count * anchor.aliasCount : 0;
|
|
582
653
|
}
|
|
583
|
-
else if (isCollection
|
|
654
|
+
else if (Node$p.isCollection(node)) {
|
|
584
655
|
let count = 0;
|
|
585
656
|
for (const item of node.items) {
|
|
586
657
|
const c = getAliasCount(doc, item, anchors);
|
|
@@ -589,7 +660,7 @@ function getAliasCount(doc, node, anchors) {
|
|
|
589
660
|
}
|
|
590
661
|
return count;
|
|
591
662
|
}
|
|
592
|
-
else if (isPair(node)) {
|
|
663
|
+
else if (Node$p.isPair(node)) {
|
|
593
664
|
const kc = getAliasCount(doc, node.key, anchors);
|
|
594
665
|
const vc = getAliasCount(doc, node.value, anchors);
|
|
595
666
|
return Math.max(kc, vc);
|
|
@@ -597,6 +668,18 @@ function getAliasCount(doc, node, anchors) {
|
|
|
597
668
|
return 1;
|
|
598
669
|
}
|
|
599
670
|
|
|
671
|
+
Alias$5.Alias = Alias$4;
|
|
672
|
+
|
|
673
|
+
var Collection$5 = {};
|
|
674
|
+
|
|
675
|
+
var createNode$5 = {};
|
|
676
|
+
|
|
677
|
+
var Scalar$k = {};
|
|
678
|
+
|
|
679
|
+
var toJS$6 = {};
|
|
680
|
+
|
|
681
|
+
var Node$o = Node$t;
|
|
682
|
+
|
|
600
683
|
/**
|
|
601
684
|
* Recursively convert any node or its contents to native JavaScript
|
|
602
685
|
*
|
|
@@ -607,13 +690,13 @@ function getAliasCount(doc, node, anchors) {
|
|
|
607
690
|
* `{ keep: true }` is not set, output should be suitable for JSON
|
|
608
691
|
* stringification.
|
|
609
692
|
*/
|
|
610
|
-
function toJS(value, arg, ctx) {
|
|
693
|
+
function toJS$5(value, arg, ctx) {
|
|
611
694
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
612
695
|
if (Array.isArray(value))
|
|
613
|
-
return value.map((v, i) => toJS(v, String(i), ctx));
|
|
696
|
+
return value.map((v, i) => toJS$5(v, String(i), ctx));
|
|
614
697
|
if (value && typeof value.toJSON === 'function') {
|
|
615
698
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
616
|
-
if (!ctx || !hasAnchor(value))
|
|
699
|
+
if (!ctx || !Node$o.hasAnchor(value))
|
|
617
700
|
return value.toJSON(arg, ctx);
|
|
618
701
|
const data = { aliasCount: 0, count: 1, res: undefined };
|
|
619
702
|
ctx.anchors.set(value, data);
|
|
@@ -631,24 +714,36 @@ function toJS(value, arg, ctx) {
|
|
|
631
714
|
return value;
|
|
632
715
|
}
|
|
633
716
|
|
|
717
|
+
toJS$6.toJS = toJS$5;
|
|
718
|
+
|
|
719
|
+
var Node$n = Node$t;
|
|
720
|
+
var toJS$4 = toJS$6;
|
|
721
|
+
|
|
634
722
|
const isScalarValue = (value) => !value || (typeof value !== 'function' && typeof value !== 'object');
|
|
635
|
-
class Scalar extends NodeBase {
|
|
723
|
+
class Scalar$j extends Node$n.NodeBase {
|
|
636
724
|
constructor(value) {
|
|
637
|
-
super(SCALAR
|
|
725
|
+
super(Node$n.SCALAR);
|
|
638
726
|
this.value = value;
|
|
639
727
|
}
|
|
640
728
|
toJSON(arg, ctx) {
|
|
641
|
-
return ctx?.keep ? this.value : toJS(this.value, arg, ctx);
|
|
729
|
+
return ctx?.keep ? this.value : toJS$4.toJS(this.value, arg, ctx);
|
|
642
730
|
}
|
|
643
731
|
toString() {
|
|
644
732
|
return String(this.value);
|
|
645
733
|
}
|
|
646
734
|
}
|
|
647
|
-
Scalar.BLOCK_FOLDED = 'BLOCK_FOLDED';
|
|
648
|
-
Scalar.BLOCK_LITERAL = 'BLOCK_LITERAL';
|
|
649
|
-
Scalar.PLAIN = 'PLAIN';
|
|
650
|
-
Scalar.QUOTE_DOUBLE = 'QUOTE_DOUBLE';
|
|
651
|
-
Scalar.QUOTE_SINGLE = 'QUOTE_SINGLE';
|
|
735
|
+
Scalar$j.BLOCK_FOLDED = 'BLOCK_FOLDED';
|
|
736
|
+
Scalar$j.BLOCK_LITERAL = 'BLOCK_LITERAL';
|
|
737
|
+
Scalar$j.PLAIN = 'PLAIN';
|
|
738
|
+
Scalar$j.QUOTE_DOUBLE = 'QUOTE_DOUBLE';
|
|
739
|
+
Scalar$j.QUOTE_SINGLE = 'QUOTE_SINGLE';
|
|
740
|
+
|
|
741
|
+
Scalar$k.Scalar = Scalar$j;
|
|
742
|
+
Scalar$k.isScalarValue = isScalarValue;
|
|
743
|
+
|
|
744
|
+
var Alias$3 = Alias$5;
|
|
745
|
+
var Node$m = Node$t;
|
|
746
|
+
var Scalar$i = Scalar$k;
|
|
652
747
|
|
|
653
748
|
const defaultTagPrefix = 'tag:yaml.org,2002:';
|
|
654
749
|
function findTagObject(value, tagName, tags) {
|
|
@@ -661,13 +756,13 @@ function findTagObject(value, tagName, tags) {
|
|
|
661
756
|
}
|
|
662
757
|
return tags.find(t => t.identify?.(value) && !t.format);
|
|
663
758
|
}
|
|
664
|
-
function createNode(value, tagName, ctx) {
|
|
665
|
-
if (isDocument(value))
|
|
759
|
+
function createNode$4(value, tagName, ctx) {
|
|
760
|
+
if (Node$m.isDocument(value))
|
|
666
761
|
value = value.contents;
|
|
667
|
-
if (isNode(value))
|
|
762
|
+
if (Node$m.isNode(value))
|
|
668
763
|
return value;
|
|
669
|
-
if (isPair(value)) {
|
|
670
|
-
const map = ctx.schema[MAP].createNode?.(ctx.schema, null, ctx);
|
|
764
|
+
if (Node$m.isPair(value)) {
|
|
765
|
+
const map = ctx.schema[Node$m.MAP].createNode?.(ctx.schema, null, ctx);
|
|
671
766
|
map.items.push(value);
|
|
672
767
|
return map;
|
|
673
768
|
}
|
|
@@ -688,7 +783,7 @@ function createNode(value, tagName, ctx) {
|
|
|
688
783
|
if (ref) {
|
|
689
784
|
if (!ref.anchor)
|
|
690
785
|
ref.anchor = onAnchor(value);
|
|
691
|
-
return new Alias(ref.anchor);
|
|
786
|
+
return new Alias$3.Alias(ref.anchor);
|
|
692
787
|
}
|
|
693
788
|
else {
|
|
694
789
|
ref = { anchor: null, node: null };
|
|
@@ -704,17 +799,17 @@ function createNode(value, tagName, ctx) {
|
|
|
704
799
|
value = value.toJSON();
|
|
705
800
|
}
|
|
706
801
|
if (!value || typeof value !== 'object') {
|
|
707
|
-
const node = new Scalar(value);
|
|
802
|
+
const node = new Scalar$i.Scalar(value);
|
|
708
803
|
if (ref)
|
|
709
804
|
ref.node = node;
|
|
710
805
|
return node;
|
|
711
806
|
}
|
|
712
807
|
tagObj =
|
|
713
808
|
value instanceof Map
|
|
714
|
-
? schema[MAP]
|
|
809
|
+
? schema[Node$m.MAP]
|
|
715
810
|
: Symbol.iterator in Object(value)
|
|
716
|
-
? schema[SEQ]
|
|
717
|
-
: schema[MAP];
|
|
811
|
+
? schema[Node$m.SEQ]
|
|
812
|
+
: schema[Node$m.MAP];
|
|
718
813
|
}
|
|
719
814
|
if (onTagObj) {
|
|
720
815
|
onTagObj(tagObj);
|
|
@@ -722,7 +817,7 @@ function createNode(value, tagName, ctx) {
|
|
|
722
817
|
}
|
|
723
818
|
const node = tagObj?.createNode
|
|
724
819
|
? tagObj.createNode(ctx.schema, value, ctx)
|
|
725
|
-
: new Scalar(value);
|
|
820
|
+
: new Scalar$i.Scalar(value);
|
|
726
821
|
if (tagName)
|
|
727
822
|
node.tag = tagName;
|
|
728
823
|
if (ref)
|
|
@@ -730,6 +825,11 @@ function createNode(value, tagName, ctx) {
|
|
|
730
825
|
return node;
|
|
731
826
|
}
|
|
732
827
|
|
|
828
|
+
createNode$5.createNode = createNode$4;
|
|
829
|
+
|
|
830
|
+
var createNode$3 = createNode$5;
|
|
831
|
+
var Node$l = Node$t;
|
|
832
|
+
|
|
733
833
|
function collectionFromPath(schema, path, value) {
|
|
734
834
|
let v = value;
|
|
735
835
|
for (let i = path.length - 1; i >= 0; --i) {
|
|
@@ -743,7 +843,7 @@ function collectionFromPath(schema, path, value) {
|
|
|
743
843
|
v = new Map([[k, v]]);
|
|
744
844
|
}
|
|
745
845
|
}
|
|
746
|
-
return createNode(v, undefined, {
|
|
846
|
+
return createNode$3.createNode(v, undefined, {
|
|
747
847
|
aliasDuplicateObjects: false,
|
|
748
848
|
keepUndefined: false,
|
|
749
849
|
onAnchor: () => {
|
|
@@ -757,7 +857,7 @@ function collectionFromPath(schema, path, value) {
|
|
|
757
857
|
// as it does not cover untypable empty non-string iterables (e.g. []).
|
|
758
858
|
const isEmptyPath = (path) => path == null ||
|
|
759
859
|
(typeof path === 'object' && !!path[Symbol.iterator]().next().done);
|
|
760
|
-
class Collection extends NodeBase {
|
|
860
|
+
class Collection$4 extends Node$l.NodeBase {
|
|
761
861
|
constructor(type, schema) {
|
|
762
862
|
super(type);
|
|
763
863
|
Object.defineProperty(this, 'schema', {
|
|
@@ -776,7 +876,7 @@ class Collection extends NodeBase {
|
|
|
776
876
|
const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
|
|
777
877
|
if (schema)
|
|
778
878
|
copy.schema = schema;
|
|
779
|
-
copy.items = copy.items.map(it => isNode(it) || isPair(it) ? it.clone(schema) : it);
|
|
879
|
+
copy.items = copy.items.map(it => Node$l.isNode(it) || Node$l.isPair(it) ? it.clone(schema) : it);
|
|
780
880
|
if (this.range)
|
|
781
881
|
copy.range = this.range.slice();
|
|
782
882
|
return copy;
|
|
@@ -792,7 +892,7 @@ class Collection extends NodeBase {
|
|
|
792
892
|
else {
|
|
793
893
|
const [key, ...rest] = path;
|
|
794
894
|
const node = this.get(key, true);
|
|
795
|
-
if (isCollection
|
|
895
|
+
if (Node$l.isCollection(node))
|
|
796
896
|
node.addIn(rest, value);
|
|
797
897
|
else if (node === undefined && this.schema)
|
|
798
898
|
this.set(key, collectionFromPath(this.schema, rest, value));
|
|
@@ -809,7 +909,7 @@ class Collection extends NodeBase {
|
|
|
809
909
|
if (rest.length === 0)
|
|
810
910
|
return this.delete(key);
|
|
811
911
|
const node = this.get(key, true);
|
|
812
|
-
if (isCollection
|
|
912
|
+
if (Node$l.isCollection(node))
|
|
813
913
|
return node.deleteIn(rest);
|
|
814
914
|
else
|
|
815
915
|
throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
|
|
@@ -823,18 +923,18 @@ class Collection extends NodeBase {
|
|
|
823
923
|
const [key, ...rest] = path;
|
|
824
924
|
const node = this.get(key, true);
|
|
825
925
|
if (rest.length === 0)
|
|
826
|
-
return !keepScalar && isScalar
|
|
926
|
+
return !keepScalar && Node$l.isScalar(node) ? node.value : node;
|
|
827
927
|
else
|
|
828
|
-
return isCollection
|
|
928
|
+
return Node$l.isCollection(node) ? node.getIn(rest, keepScalar) : undefined;
|
|
829
929
|
}
|
|
830
930
|
hasAllNullValues(allowScalar) {
|
|
831
931
|
return this.items.every(node => {
|
|
832
|
-
if (!isPair(node))
|
|
932
|
+
if (!Node$l.isPair(node))
|
|
833
933
|
return false;
|
|
834
934
|
const n = node.value;
|
|
835
935
|
return (n == null ||
|
|
836
936
|
(allowScalar &&
|
|
837
|
-
isScalar
|
|
937
|
+
Node$l.isScalar(n) &&
|
|
838
938
|
n.value == null &&
|
|
839
939
|
!n.commentBefore &&
|
|
840
940
|
!n.comment &&
|
|
@@ -849,7 +949,7 @@ class Collection extends NodeBase {
|
|
|
849
949
|
if (rest.length === 0)
|
|
850
950
|
return this.has(key);
|
|
851
951
|
const node = this.get(key, true);
|
|
852
|
-
return isCollection
|
|
952
|
+
return Node$l.isCollection(node) ? node.hasIn(rest) : false;
|
|
853
953
|
}
|
|
854
954
|
/**
|
|
855
955
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
@@ -862,7 +962,7 @@ class Collection extends NodeBase {
|
|
|
862
962
|
}
|
|
863
963
|
else {
|
|
864
964
|
const node = this.get(key, true);
|
|
865
|
-
if (isCollection
|
|
965
|
+
if (Node$l.isCollection(node))
|
|
866
966
|
node.setIn(rest, value);
|
|
867
967
|
else if (node === undefined && this.schema)
|
|
868
968
|
this.set(key, collectionFromPath(this.schema, rest, value));
|
|
@@ -871,7 +971,19 @@ class Collection extends NodeBase {
|
|
|
871
971
|
}
|
|
872
972
|
}
|
|
873
973
|
}
|
|
874
|
-
Collection.maxFlowStringSingleLineLength = 60;
|
|
974
|
+
Collection$4.maxFlowStringSingleLineLength = 60;
|
|
975
|
+
|
|
976
|
+
Collection$5.Collection = Collection$4;
|
|
977
|
+
Collection$5.collectionFromPath = collectionFromPath;
|
|
978
|
+
Collection$5.isEmptyPath = isEmptyPath;
|
|
979
|
+
|
|
980
|
+
var Pair$9 = {};
|
|
981
|
+
|
|
982
|
+
var stringifyPair$2 = {};
|
|
983
|
+
|
|
984
|
+
var stringify$9 = {};
|
|
985
|
+
|
|
986
|
+
var stringifyComment$5 = {};
|
|
875
987
|
|
|
876
988
|
/**
|
|
877
989
|
* Stringifies a comment.
|
|
@@ -880,7 +992,7 @@ Collection.maxFlowStringSingleLineLength = 60;
|
|
|
880
992
|
* lines consisting of a single space are replaced by `#`,
|
|
881
993
|
* and all other lines are prefixed with a `#`.
|
|
882
994
|
*/
|
|
883
|
-
const stringifyComment = (str) => str.replace(/^(?!$)(?: $)?/gm, '#');
|
|
995
|
+
const stringifyComment$4 = (str) => str.replace(/^(?!$)(?: $)?/gm, '#');
|
|
884
996
|
function indentComment(comment, indent) {
|
|
885
997
|
if (/^\n+$/.test(comment))
|
|
886
998
|
return comment.substring(1);
|
|
@@ -892,6 +1004,14 @@ const lineComment = (str, indent, comment) => str.endsWith('\n')
|
|
|
892
1004
|
? '\n' + indentComment(comment, indent)
|
|
893
1005
|
: (str.endsWith(' ') ? '' : ' ') + comment;
|
|
894
1006
|
|
|
1007
|
+
stringifyComment$5.indentComment = indentComment;
|
|
1008
|
+
stringifyComment$5.lineComment = lineComment;
|
|
1009
|
+
stringifyComment$5.stringifyComment = stringifyComment$4;
|
|
1010
|
+
|
|
1011
|
+
var stringifyString$5 = {};
|
|
1012
|
+
|
|
1013
|
+
var foldFlowLines$2 = {};
|
|
1014
|
+
|
|
895
1015
|
const FOLD_FLOW = 'flow';
|
|
896
1016
|
const FOLD_BLOCK = 'block';
|
|
897
1017
|
const FOLD_QUOTED = 'quoted';
|
|
@@ -900,7 +1020,7 @@ const FOLD_QUOTED = 'quoted';
|
|
|
900
1020
|
* not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are
|
|
901
1021
|
* terminated with `\n` and started with `indent`.
|
|
902
1022
|
*/
|
|
903
|
-
function foldFlowLines(text, indent, mode, { indentAtStart, lineWidth = 80, minContentWidth = 20, onFold, onOverflow }) {
|
|
1023
|
+
function foldFlowLines$1(text, indent, mode = 'flow', { indentAtStart, lineWidth = 80, minContentWidth = 20, onFold, onOverflow } = {}) {
|
|
904
1024
|
if (!lineWidth || lineWidth < 0)
|
|
905
1025
|
return text;
|
|
906
1026
|
const endStep = Math.max(1 + minContentWidth, 1 + lineWidth - indent.length);
|
|
@@ -1026,6 +1146,14 @@ function consumeMoreIndentedLines(text, i) {
|
|
|
1026
1146
|
return i;
|
|
1027
1147
|
}
|
|
1028
1148
|
|
|
1149
|
+
foldFlowLines$2.FOLD_BLOCK = FOLD_BLOCK;
|
|
1150
|
+
foldFlowLines$2.FOLD_FLOW = FOLD_FLOW;
|
|
1151
|
+
foldFlowLines$2.FOLD_QUOTED = FOLD_QUOTED;
|
|
1152
|
+
foldFlowLines$2.foldFlowLines = foldFlowLines$1;
|
|
1153
|
+
|
|
1154
|
+
var Scalar$h = Scalar$k;
|
|
1155
|
+
var foldFlowLines = foldFlowLines$2;
|
|
1156
|
+
|
|
1029
1157
|
const getFoldOptions = (ctx) => ({
|
|
1030
1158
|
indentAtStart: ctx.indentAtStart,
|
|
1031
1159
|
lineWidth: ctx.options.lineWidth,
|
|
@@ -1140,7 +1268,7 @@ function doubleQuotedString(value, ctx) {
|
|
|
1140
1268
|
str = start ? str + json.slice(start) : json;
|
|
1141
1269
|
return implicitKey
|
|
1142
1270
|
? str
|
|
1143
|
-
: foldFlowLines(str, indent, FOLD_QUOTED, getFoldOptions(ctx));
|
|
1271
|
+
: foldFlowLines.foldFlowLines(str, indent, foldFlowLines.FOLD_QUOTED, getFoldOptions(ctx));
|
|
1144
1272
|
}
|
|
1145
1273
|
function singleQuotedString(value, ctx) {
|
|
1146
1274
|
if (ctx.options.singleQuote === false ||
|
|
@@ -1152,7 +1280,7 @@ function singleQuotedString(value, ctx) {
|
|
|
1152
1280
|
const res = "'" + value.replace(/'/g, "''").replace(/\n+/g, `$&\n${indent}`) + "'";
|
|
1153
1281
|
return ctx.implicitKey
|
|
1154
1282
|
? res
|
|
1155
|
-
: foldFlowLines(res, indent, FOLD_FLOW, getFoldOptions(ctx));
|
|
1283
|
+
: foldFlowLines.foldFlowLines(res, indent, foldFlowLines.FOLD_FLOW, getFoldOptions(ctx));
|
|
1156
1284
|
}
|
|
1157
1285
|
function quotedString(value, ctx) {
|
|
1158
1286
|
const { singleQuote } = ctx.options;
|
|
@@ -1182,9 +1310,9 @@ function blockString({ comment, type, value }, ctx, onComment, onChompKeep) {
|
|
|
1182
1310
|
(ctx.forceBlockIndent || containsDocumentMarker(value) ? ' ' : '');
|
|
1183
1311
|
const literal = blockQuote === 'literal'
|
|
1184
1312
|
? true
|
|
1185
|
-
: blockQuote === 'folded' || type === Scalar.BLOCK_FOLDED
|
|
1313
|
+
: blockQuote === 'folded' || type === Scalar$h.Scalar.BLOCK_FOLDED
|
|
1186
1314
|
? false
|
|
1187
|
-
: type === Scalar.BLOCK_LITERAL
|
|
1315
|
+
: type === Scalar$h.Scalar.BLOCK_LITERAL
|
|
1188
1316
|
? true
|
|
1189
1317
|
: !lineLengthOverLimit(value, lineWidth, indent.length);
|
|
1190
1318
|
if (!value)
|
|
@@ -1250,7 +1378,7 @@ function blockString({ comment, type, value }, ctx, onComment, onChompKeep) {
|
|
|
1250
1378
|
.replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, '$1$2') // more-indented lines aren't folded
|
|
1251
1379
|
// ^ more-ind. ^ empty ^ capture next empty lines only at end of indent
|
|
1252
1380
|
.replace(/\n+/g, `$&${indent}`);
|
|
1253
|
-
const body = foldFlowLines(`${start}${value}${end}`, indent, FOLD_BLOCK, getFoldOptions(ctx));
|
|
1381
|
+
const body = foldFlowLines.foldFlowLines(`${start}${value}${end}`, indent, foldFlowLines.FOLD_BLOCK, getFoldOptions(ctx));
|
|
1254
1382
|
return `${header}\n${indent}${body}`;
|
|
1255
1383
|
}
|
|
1256
1384
|
function plainString(item, ctx, onComment, onChompKeep) {
|
|
@@ -1274,7 +1402,7 @@ function plainString(item, ctx, onComment, onChompKeep) {
|
|
|
1274
1402
|
}
|
|
1275
1403
|
if (!implicitKey &&
|
|
1276
1404
|
!inFlow &&
|
|
1277
|
-
type !== Scalar.PLAIN &&
|
|
1405
|
+
type !== Scalar$h.Scalar.PLAIN &&
|
|
1278
1406
|
value.includes('\n')) {
|
|
1279
1407
|
// Where allowed & type not set explicitly, prefer block style for multiline strings
|
|
1280
1408
|
return blockString(item, ctx, onComment, onChompKeep);
|
|
@@ -1295,31 +1423,31 @@ function plainString(item, ctx, onComment, onChompKeep) {
|
|
|
1295
1423
|
}
|
|
1296
1424
|
return implicitKey
|
|
1297
1425
|
? str
|
|
1298
|
-
: foldFlowLines(str, indent, FOLD_FLOW, getFoldOptions(ctx));
|
|
1426
|
+
: foldFlowLines.foldFlowLines(str, indent, foldFlowLines.FOLD_FLOW, getFoldOptions(ctx));
|
|
1299
1427
|
}
|
|
1300
|
-
function stringifyString(item, ctx, onComment, onChompKeep) {
|
|
1428
|
+
function stringifyString$4(item, ctx, onComment, onChompKeep) {
|
|
1301
1429
|
const { implicitKey, inFlow } = ctx;
|
|
1302
1430
|
const ss = typeof item.value === 'string'
|
|
1303
1431
|
? item
|
|
1304
1432
|
: Object.assign({}, item, { value: String(item.value) });
|
|
1305
1433
|
let { type } = item;
|
|
1306
|
-
if (type !== Scalar.QUOTE_DOUBLE) {
|
|
1434
|
+
if (type !== Scalar$h.Scalar.QUOTE_DOUBLE) {
|
|
1307
1435
|
// force double quotes on control characters & unpaired surrogates
|
|
1308
1436
|
if (/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(ss.value))
|
|
1309
|
-
type = Scalar.QUOTE_DOUBLE;
|
|
1437
|
+
type = Scalar$h.Scalar.QUOTE_DOUBLE;
|
|
1310
1438
|
}
|
|
1311
1439
|
const _stringify = (_type) => {
|
|
1312
1440
|
switch (_type) {
|
|
1313
|
-
case Scalar.BLOCK_FOLDED:
|
|
1314
|
-
case Scalar.BLOCK_LITERAL:
|
|
1441
|
+
case Scalar$h.Scalar.BLOCK_FOLDED:
|
|
1442
|
+
case Scalar$h.Scalar.BLOCK_LITERAL:
|
|
1315
1443
|
return implicitKey || inFlow
|
|
1316
1444
|
? quotedString(ss.value, ctx) // blocks are not valid inside flow containers
|
|
1317
1445
|
: blockString(ss, ctx, onComment, onChompKeep);
|
|
1318
|
-
case Scalar.QUOTE_DOUBLE:
|
|
1446
|
+
case Scalar$h.Scalar.QUOTE_DOUBLE:
|
|
1319
1447
|
return doubleQuotedString(ss.value, ctx);
|
|
1320
|
-
case Scalar.QUOTE_SINGLE:
|
|
1448
|
+
case Scalar$h.Scalar.QUOTE_SINGLE:
|
|
1321
1449
|
return singleQuotedString(ss.value, ctx);
|
|
1322
|
-
case Scalar.PLAIN:
|
|
1450
|
+
case Scalar$h.Scalar.PLAIN:
|
|
1323
1451
|
return plainString(ss, ctx, onComment, onChompKeep);
|
|
1324
1452
|
default:
|
|
1325
1453
|
return null;
|
|
@@ -1336,10 +1464,17 @@ function stringifyString(item, ctx, onComment, onChompKeep) {
|
|
|
1336
1464
|
return res;
|
|
1337
1465
|
}
|
|
1338
1466
|
|
|
1467
|
+
stringifyString$5.stringifyString = stringifyString$4;
|
|
1468
|
+
|
|
1469
|
+
var anchors$1 = anchors$3;
|
|
1470
|
+
var Node$k = Node$t;
|
|
1471
|
+
var stringifyComment$3 = stringifyComment$5;
|
|
1472
|
+
var stringifyString$3 = stringifyString$5;
|
|
1473
|
+
|
|
1339
1474
|
function createStringifyContext(doc, options) {
|
|
1340
1475
|
const opt = Object.assign({
|
|
1341
1476
|
blockQuote: true,
|
|
1342
|
-
commentString: stringifyComment,
|
|
1477
|
+
commentString: stringifyComment$3.stringifyComment,
|
|
1343
1478
|
defaultKeyType: null,
|
|
1344
1479
|
defaultStringType: 'PLAIN',
|
|
1345
1480
|
directives: null,
|
|
@@ -1383,7 +1518,7 @@ function getTagObject(tags, item) {
|
|
|
1383
1518
|
}
|
|
1384
1519
|
let tagObj = undefined;
|
|
1385
1520
|
let obj;
|
|
1386
|
-
if (isScalar
|
|
1521
|
+
if (Node$k.isScalar(item)) {
|
|
1387
1522
|
obj = item.value;
|
|
1388
1523
|
const match = tags.filter(t => t.identify?.(obj));
|
|
1389
1524
|
tagObj =
|
|
@@ -1400,13 +1535,13 @@ function getTagObject(tags, item) {
|
|
|
1400
1535
|
return tagObj;
|
|
1401
1536
|
}
|
|
1402
1537
|
// needs to be called before value stringifier to allow for circular anchor refs
|
|
1403
|
-
function stringifyProps(node, tagObj, { anchors, doc }) {
|
|
1538
|
+
function stringifyProps(node, tagObj, { anchors: anchors$1$1, doc }) {
|
|
1404
1539
|
if (!doc.directives)
|
|
1405
1540
|
return '';
|
|
1406
1541
|
const props = [];
|
|
1407
|
-
const anchor = (isScalar
|
|
1408
|
-
if (anchor && anchorIsValid(anchor)) {
|
|
1409
|
-
anchors.add(anchor);
|
|
1542
|
+
const anchor = (Node$k.isScalar(node) || Node$k.isCollection(node)) && node.anchor;
|
|
1543
|
+
if (anchor && anchors$1.anchorIsValid(anchor)) {
|
|
1544
|
+
anchors$1$1.add(anchor);
|
|
1410
1545
|
props.push(`&${anchor}`);
|
|
1411
1546
|
}
|
|
1412
1547
|
const tag = node.tag ? node.tag : tagObj.default ? null : tagObj.tag;
|
|
@@ -1414,10 +1549,10 @@ function stringifyProps(node, tagObj, { anchors, doc }) {
|
|
|
1414
1549
|
props.push(doc.directives.tagString(tag));
|
|
1415
1550
|
return props.join(' ');
|
|
1416
1551
|
}
|
|
1417
|
-
function stringify$
|
|
1418
|
-
if (isPair(item))
|
|
1552
|
+
function stringify$8(item, ctx, onComment, onChompKeep) {
|
|
1553
|
+
if (Node$k.isPair(item))
|
|
1419
1554
|
return item.toString(ctx, onComment, onChompKeep);
|
|
1420
|
-
if (isAlias(item)) {
|
|
1555
|
+
if (Node$k.isAlias(item)) {
|
|
1421
1556
|
if (ctx.doc.directives)
|
|
1422
1557
|
return item.toString(ctx);
|
|
1423
1558
|
if (ctx.resolvedAliases?.has(item)) {
|
|
@@ -1432,7 +1567,7 @@ function stringify$2(item, ctx, onComment, onChompKeep) {
|
|
|
1432
1567
|
}
|
|
1433
1568
|
}
|
|
1434
1569
|
let tagObj = undefined;
|
|
1435
|
-
const node = isNode(item)
|
|
1570
|
+
const node = Node$k.isNode(item)
|
|
1436
1571
|
? item
|
|
1437
1572
|
: ctx.doc.createNode(item, { onTagObj: o => (tagObj = o) });
|
|
1438
1573
|
if (!tagObj)
|
|
@@ -1442,24 +1577,32 @@ function stringify$2(item, ctx, onComment, onChompKeep) {
|
|
|
1442
1577
|
ctx.indentAtStart = (ctx.indentAtStart ?? 0) + props.length + 1;
|
|
1443
1578
|
const str = typeof tagObj.stringify === 'function'
|
|
1444
1579
|
? tagObj.stringify(node, ctx, onComment, onChompKeep)
|
|
1445
|
-
: isScalar
|
|
1446
|
-
? stringifyString(node, ctx, onComment, onChompKeep)
|
|
1580
|
+
: Node$k.isScalar(node)
|
|
1581
|
+
? stringifyString$3.stringifyString(node, ctx, onComment, onChompKeep)
|
|
1447
1582
|
: node.toString(ctx, onComment, onChompKeep);
|
|
1448
1583
|
if (!props)
|
|
1449
1584
|
return str;
|
|
1450
|
-
return isScalar
|
|
1585
|
+
return Node$k.isScalar(node) || str[0] === '{' || str[0] === '['
|
|
1451
1586
|
? `${props} ${str}`
|
|
1452
1587
|
: `${props}\n${ctx.indent}${str}`;
|
|
1453
1588
|
}
|
|
1454
1589
|
|
|
1455
|
-
|
|
1590
|
+
stringify$9.createStringifyContext = createStringifyContext;
|
|
1591
|
+
stringify$9.stringify = stringify$8;
|
|
1592
|
+
|
|
1593
|
+
var Node$j = Node$t;
|
|
1594
|
+
var Scalar$g = Scalar$k;
|
|
1595
|
+
var stringify$7 = stringify$9;
|
|
1596
|
+
var stringifyComment$2 = stringifyComment$5;
|
|
1597
|
+
|
|
1598
|
+
function stringifyPair$1({ key, value }, ctx, onComment, onChompKeep) {
|
|
1456
1599
|
const { allNullValues, doc, indent, indentStep, options: { commentString, indentSeq, simpleKeys } } = ctx;
|
|
1457
|
-
let keyComment = (isNode(key) && key.comment) || null;
|
|
1600
|
+
let keyComment = (Node$j.isNode(key) && key.comment) || null;
|
|
1458
1601
|
if (simpleKeys) {
|
|
1459
1602
|
if (keyComment) {
|
|
1460
1603
|
throw new Error('With simple keys, key nodes cannot have comments');
|
|
1461
1604
|
}
|
|
1462
|
-
if (isCollection
|
|
1605
|
+
if (Node$j.isCollection(key)) {
|
|
1463
1606
|
const msg = 'With simple keys, collection cannot be used as a key value';
|
|
1464
1607
|
throw new Error(msg);
|
|
1465
1608
|
}
|
|
@@ -1467,9 +1610,9 @@ function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
|
|
|
1467
1610
|
let explicitKey = !simpleKeys &&
|
|
1468
1611
|
(!key ||
|
|
1469
1612
|
(keyComment && value == null && !ctx.inFlow) ||
|
|
1470
|
-
isCollection
|
|
1471
|
-
(isScalar
|
|
1472
|
-
? key.type === Scalar.BLOCK_FOLDED || key.type === Scalar.BLOCK_LITERAL
|
|
1613
|
+
Node$j.isCollection(key) ||
|
|
1614
|
+
(Node$j.isScalar(key)
|
|
1615
|
+
? key.type === Scalar$g.Scalar.BLOCK_FOLDED || key.type === Scalar$g.Scalar.BLOCK_LITERAL
|
|
1473
1616
|
: typeof key === 'object'));
|
|
1474
1617
|
ctx = Object.assign({}, ctx, {
|
|
1475
1618
|
allNullValues: false,
|
|
@@ -1478,7 +1621,7 @@ function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
|
|
|
1478
1621
|
});
|
|
1479
1622
|
let keyCommentDone = false;
|
|
1480
1623
|
let chompKeep = false;
|
|
1481
|
-
let str = stringify$
|
|
1624
|
+
let str = stringify$7.stringify(key, ctx, () => (keyCommentDone = true), () => (chompKeep = true));
|
|
1482
1625
|
if (!explicitKey && !ctx.inFlow && str.length > 1024) {
|
|
1483
1626
|
if (simpleKeys)
|
|
1484
1627
|
throw new Error('With simple keys, single line scalar must not span more than 1024 characters');
|
|
@@ -1494,7 +1637,7 @@ function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
|
|
|
1494
1637
|
else if ((allNullValues && !simpleKeys) || (value == null && explicitKey)) {
|
|
1495
1638
|
str = `? ${str}`;
|
|
1496
1639
|
if (keyComment && !keyCommentDone) {
|
|
1497
|
-
str += lineComment(str, ctx.indent, commentString(keyComment));
|
|
1640
|
+
str += stringifyComment$2.lineComment(str, ctx.indent, commentString(keyComment));
|
|
1498
1641
|
}
|
|
1499
1642
|
else if (chompKeep && onChompKeep)
|
|
1500
1643
|
onChompKeep();
|
|
@@ -1504,22 +1647,22 @@ function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
|
|
|
1504
1647
|
keyComment = null;
|
|
1505
1648
|
if (explicitKey) {
|
|
1506
1649
|
if (keyComment)
|
|
1507
|
-
str += lineComment(str, ctx.indent, commentString(keyComment));
|
|
1650
|
+
str += stringifyComment$2.lineComment(str, ctx.indent, commentString(keyComment));
|
|
1508
1651
|
str = `? ${str}\n${indent}:`;
|
|
1509
1652
|
}
|
|
1510
1653
|
else {
|
|
1511
1654
|
str = `${str}:`;
|
|
1512
1655
|
if (keyComment)
|
|
1513
|
-
str += lineComment(str, ctx.indent, commentString(keyComment));
|
|
1656
|
+
str += stringifyComment$2.lineComment(str, ctx.indent, commentString(keyComment));
|
|
1514
1657
|
}
|
|
1515
1658
|
let vcb = '';
|
|
1516
1659
|
let valueComment = null;
|
|
1517
|
-
if (isNode(value)) {
|
|
1660
|
+
if (Node$j.isNode(value)) {
|
|
1518
1661
|
if (value.spaceBefore)
|
|
1519
1662
|
vcb = '\n';
|
|
1520
1663
|
if (value.commentBefore) {
|
|
1521
1664
|
const cs = commentString(value.commentBefore);
|
|
1522
|
-
vcb += `\n${indentComment(cs, ctx.indent)}`;
|
|
1665
|
+
vcb += `\n${stringifyComment$2.indentComment(cs, ctx.indent)}`;
|
|
1523
1666
|
}
|
|
1524
1667
|
valueComment = value.comment;
|
|
1525
1668
|
}
|
|
@@ -1527,14 +1670,14 @@ function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
|
|
|
1527
1670
|
value = doc.createNode(value);
|
|
1528
1671
|
}
|
|
1529
1672
|
ctx.implicitKey = false;
|
|
1530
|
-
if (!explicitKey && !keyComment && isScalar
|
|
1673
|
+
if (!explicitKey && !keyComment && Node$j.isScalar(value))
|
|
1531
1674
|
ctx.indentAtStart = str.length + 1;
|
|
1532
1675
|
chompKeep = false;
|
|
1533
1676
|
if (!indentSeq &&
|
|
1534
1677
|
indentStep.length >= 2 &&
|
|
1535
1678
|
!ctx.inFlow &&
|
|
1536
1679
|
!explicitKey &&
|
|
1537
|
-
isSeq(value) &&
|
|
1680
|
+
Node$j.isSeq(value) &&
|
|
1538
1681
|
!value.flow &&
|
|
1539
1682
|
!value.tag &&
|
|
1540
1683
|
!value.anchor) {
|
|
@@ -1542,7 +1685,7 @@ function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
|
|
|
1542
1685
|
ctx.indent = ctx.indent.substr(2);
|
|
1543
1686
|
}
|
|
1544
1687
|
let valueCommentDone = false;
|
|
1545
|
-
const valueStr = stringify$
|
|
1688
|
+
const valueStr = stringify$7.stringify(value, ctx, () => (valueCommentDone = true), () => (chompKeep = true));
|
|
1546
1689
|
let ws = ' ';
|
|
1547
1690
|
if (vcb || keyComment) {
|
|
1548
1691
|
if (valueStr === '' && !ctx.inFlow)
|
|
@@ -1550,7 +1693,7 @@ function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
|
|
|
1550
1693
|
else
|
|
1551
1694
|
ws = `${vcb}\n${ctx.indent}`;
|
|
1552
1695
|
}
|
|
1553
|
-
else if (!explicitKey && isCollection
|
|
1696
|
+
else if (!explicitKey && Node$j.isCollection(value)) {
|
|
1554
1697
|
const flow = valueStr[0] === '[' || valueStr[0] === '{';
|
|
1555
1698
|
if (!flow || valueStr.includes('\n'))
|
|
1556
1699
|
ws = `\n${ctx.indent}`;
|
|
@@ -1563,7 +1706,7 @@ function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
|
|
|
1563
1706
|
onComment();
|
|
1564
1707
|
}
|
|
1565
1708
|
else if (valueComment && !valueCommentDone) {
|
|
1566
|
-
str += lineComment(str, ctx.indent, commentString(valueComment));
|
|
1709
|
+
str += stringifyComment$2.lineComment(str, ctx.indent, commentString(valueComment));
|
|
1567
1710
|
}
|
|
1568
1711
|
else if (chompKeep && onChompKeep) {
|
|
1569
1712
|
onChompKeep();
|
|
@@ -1571,6 +1714,16 @@ function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
|
|
|
1571
1714
|
return str;
|
|
1572
1715
|
}
|
|
1573
1716
|
|
|
1717
|
+
stringifyPair$2.stringifyPair = stringifyPair$1;
|
|
1718
|
+
|
|
1719
|
+
var addPairToJSMap$3 = {};
|
|
1720
|
+
|
|
1721
|
+
var log$2 = {};
|
|
1722
|
+
|
|
1723
|
+
function debug(logLevel, ...messages) {
|
|
1724
|
+
if (logLevel === 'debug')
|
|
1725
|
+
console.log(...messages);
|
|
1726
|
+
}
|
|
1574
1727
|
function warn(logLevel, warning) {
|
|
1575
1728
|
if (logLevel === 'debug' || logLevel === 'warn') {
|
|
1576
1729
|
if (typeof process !== 'undefined' && process.emitWarning)
|
|
@@ -1580,11 +1733,20 @@ function warn(logLevel, warning) {
|
|
|
1580
1733
|
}
|
|
1581
1734
|
}
|
|
1582
1735
|
|
|
1736
|
+
log$2.debug = debug;
|
|
1737
|
+
log$2.warn = warn;
|
|
1738
|
+
|
|
1739
|
+
var log$1 = log$2;
|
|
1740
|
+
var stringify$6 = stringify$9;
|
|
1741
|
+
var Node$i = Node$t;
|
|
1742
|
+
var Scalar$f = Scalar$k;
|
|
1743
|
+
var toJS$3 = toJS$6;
|
|
1744
|
+
|
|
1583
1745
|
const MERGE_KEY = '<<';
|
|
1584
|
-
function addPairToJSMap(ctx, map, { key, value }) {
|
|
1746
|
+
function addPairToJSMap$2(ctx, map, { key, value }) {
|
|
1585
1747
|
if (ctx?.doc.schema.merge && isMergeKey(key)) {
|
|
1586
|
-
value = isAlias(value) ? value.resolve(ctx.doc) : value;
|
|
1587
|
-
if (isSeq(value))
|
|
1748
|
+
value = Node$i.isAlias(value) ? value.resolve(ctx.doc) : value;
|
|
1749
|
+
if (Node$i.isSeq(value))
|
|
1588
1750
|
for (const it of value.items)
|
|
1589
1751
|
mergeToJSMap(ctx, map, it);
|
|
1590
1752
|
else if (Array.isArray(value))
|
|
@@ -1594,16 +1756,16 @@ function addPairToJSMap(ctx, map, { key, value }) {
|
|
|
1594
1756
|
mergeToJSMap(ctx, map, value);
|
|
1595
1757
|
}
|
|
1596
1758
|
else {
|
|
1597
|
-
const jsKey = toJS(key, '', ctx);
|
|
1759
|
+
const jsKey = toJS$3.toJS(key, '', ctx);
|
|
1598
1760
|
if (map instanceof Map) {
|
|
1599
|
-
map.set(jsKey, toJS(value, jsKey, ctx));
|
|
1761
|
+
map.set(jsKey, toJS$3.toJS(value, jsKey, ctx));
|
|
1600
1762
|
}
|
|
1601
1763
|
else if (map instanceof Set) {
|
|
1602
1764
|
map.add(jsKey);
|
|
1603
1765
|
}
|
|
1604
1766
|
else {
|
|
1605
1767
|
const stringKey = stringifyKey(key, jsKey, ctx);
|
|
1606
|
-
const jsValue = toJS(value, stringKey, ctx);
|
|
1768
|
+
const jsValue = toJS$3.toJS(value, stringKey, ctx);
|
|
1607
1769
|
if (stringKey in map)
|
|
1608
1770
|
Object.defineProperty(map, stringKey, {
|
|
1609
1771
|
value: jsValue,
|
|
@@ -1618,9 +1780,9 @@ function addPairToJSMap(ctx, map, { key, value }) {
|
|
|
1618
1780
|
return map;
|
|
1619
1781
|
}
|
|
1620
1782
|
const isMergeKey = (key) => key === MERGE_KEY ||
|
|
1621
|
-
(isScalar
|
|
1783
|
+
(Node$i.isScalar(key) &&
|
|
1622
1784
|
key.value === MERGE_KEY &&
|
|
1623
|
-
(!key.type || key.type === Scalar.PLAIN));
|
|
1785
|
+
(!key.type || key.type === Scalar$f.Scalar.PLAIN));
|
|
1624
1786
|
// If the value associated with a merge key is a single mapping node, each of
|
|
1625
1787
|
// its key/value pairs is inserted into the current mapping, unless the key
|
|
1626
1788
|
// already exists in it. If the value associated with the merge key is a
|
|
@@ -1629,8 +1791,8 @@ const isMergeKey = (key) => key === MERGE_KEY ||
|
|
|
1629
1791
|
// Keys in mapping nodes earlier in the sequence override keys specified in
|
|
1630
1792
|
// later mapping nodes. -- http://yaml.org/type/merge.html
|
|
1631
1793
|
function mergeToJSMap(ctx, map, value) {
|
|
1632
|
-
const source = ctx && isAlias(value) ? value.resolve(ctx.doc) : value;
|
|
1633
|
-
if (!isMap(source))
|
|
1794
|
+
const source = ctx && Node$i.isAlias(value) ? value.resolve(ctx.doc) : value;
|
|
1795
|
+
if (!Node$i.isMap(source))
|
|
1634
1796
|
throw new Error('Merge sources must be maps or map aliases');
|
|
1635
1797
|
const srcMap = source.toJSON(null, ctx, Map);
|
|
1636
1798
|
for (const [key, value] of srcMap) {
|
|
@@ -1657,8 +1819,8 @@ function stringifyKey(key, jsKey, ctx) {
|
|
|
1657
1819
|
return '';
|
|
1658
1820
|
if (typeof jsKey !== 'object')
|
|
1659
1821
|
return String(jsKey);
|
|
1660
|
-
if (isNode(key) && ctx && ctx.doc) {
|
|
1661
|
-
const strCtx = createStringifyContext(ctx.doc, {});
|
|
1822
|
+
if (Node$i.isNode(key) && ctx && ctx.doc) {
|
|
1823
|
+
const strCtx = stringify$6.createStringifyContext(ctx.doc, {});
|
|
1662
1824
|
strCtx.anchors = new Set();
|
|
1663
1825
|
for (const node of ctx.anchors.keys())
|
|
1664
1826
|
strCtx.anchors.add(node.anchor);
|
|
@@ -1669,7 +1831,7 @@ function stringifyKey(key, jsKey, ctx) {
|
|
|
1669
1831
|
let jsonStr = JSON.stringify(strKey);
|
|
1670
1832
|
if (jsonStr.length > 40)
|
|
1671
1833
|
jsonStr = jsonStr.substring(0, 36) + '..."';
|
|
1672
|
-
warn(ctx.doc.options.logLevel, `Keys with collection values will be stringified due to JS Object restrictions: ${jsonStr}. Set mapAsMap: true to use object keys.`);
|
|
1834
|
+
log$1.warn(ctx.doc.options.logLevel, `Keys with collection values will be stringified due to JS Object restrictions: ${jsonStr}. Set mapAsMap: true to use object keys.`);
|
|
1673
1835
|
ctx.mapKeyWarned = true;
|
|
1674
1836
|
}
|
|
1675
1837
|
return strKey;
|
|
@@ -1677,37 +1839,60 @@ function stringifyKey(key, jsKey, ctx) {
|
|
|
1677
1839
|
return JSON.stringify(jsKey);
|
|
1678
1840
|
}
|
|
1679
1841
|
|
|
1842
|
+
addPairToJSMap$3.addPairToJSMap = addPairToJSMap$2;
|
|
1843
|
+
|
|
1844
|
+
var createNode$2 = createNode$5;
|
|
1845
|
+
var stringifyPair = stringifyPair$2;
|
|
1846
|
+
var addPairToJSMap$1 = addPairToJSMap$3;
|
|
1847
|
+
var Node$h = Node$t;
|
|
1848
|
+
|
|
1680
1849
|
function createPair(key, value, ctx) {
|
|
1681
|
-
const k = createNode(key, undefined, ctx);
|
|
1682
|
-
const v = createNode(value, undefined, ctx);
|
|
1683
|
-
return new Pair(k, v);
|
|
1850
|
+
const k = createNode$2.createNode(key, undefined, ctx);
|
|
1851
|
+
const v = createNode$2.createNode(value, undefined, ctx);
|
|
1852
|
+
return new Pair$8(k, v);
|
|
1684
1853
|
}
|
|
1685
|
-
class Pair {
|
|
1854
|
+
class Pair$8 {
|
|
1686
1855
|
constructor(key, value = null) {
|
|
1687
|
-
Object.defineProperty(this, NODE_TYPE, { value: PAIR });
|
|
1856
|
+
Object.defineProperty(this, Node$h.NODE_TYPE, { value: Node$h.PAIR });
|
|
1688
1857
|
this.key = key;
|
|
1689
1858
|
this.value = value;
|
|
1690
1859
|
}
|
|
1691
1860
|
clone(schema) {
|
|
1692
1861
|
let { key, value } = this;
|
|
1693
|
-
if (isNode(key))
|
|
1862
|
+
if (Node$h.isNode(key))
|
|
1694
1863
|
key = key.clone(schema);
|
|
1695
|
-
if (isNode(value))
|
|
1864
|
+
if (Node$h.isNode(value))
|
|
1696
1865
|
value = value.clone(schema);
|
|
1697
|
-
return new Pair(key, value);
|
|
1866
|
+
return new Pair$8(key, value);
|
|
1698
1867
|
}
|
|
1699
1868
|
toJSON(_, ctx) {
|
|
1700
1869
|
const pair = ctx?.mapAsMap ? new Map() : {};
|
|
1701
|
-
return addPairToJSMap(ctx, pair, this);
|
|
1870
|
+
return addPairToJSMap$1.addPairToJSMap(ctx, pair, this);
|
|
1702
1871
|
}
|
|
1703
1872
|
toString(ctx, onComment, onChompKeep) {
|
|
1704
1873
|
return ctx?.doc
|
|
1705
|
-
? stringifyPair(this, ctx, onComment, onChompKeep)
|
|
1874
|
+
? stringifyPair.stringifyPair(this, ctx, onComment, onChompKeep)
|
|
1706
1875
|
: JSON.stringify(this);
|
|
1707
1876
|
}
|
|
1708
1877
|
}
|
|
1709
1878
|
|
|
1710
|
-
|
|
1879
|
+
Pair$9.Pair = Pair$8;
|
|
1880
|
+
Pair$9.createPair = createPair;
|
|
1881
|
+
|
|
1882
|
+
var Schema$3 = {};
|
|
1883
|
+
|
|
1884
|
+
var map$6 = {};
|
|
1885
|
+
|
|
1886
|
+
var YAMLMap$7 = {};
|
|
1887
|
+
|
|
1888
|
+
var stringifyCollection$3 = {};
|
|
1889
|
+
|
|
1890
|
+
var Collection$3 = Collection$5;
|
|
1891
|
+
var Node$g = Node$t;
|
|
1892
|
+
var stringify$5 = stringify$9;
|
|
1893
|
+
var stringifyComment$1 = stringifyComment$5;
|
|
1894
|
+
|
|
1895
|
+
function stringifyCollection$2(collection, ctx, options) {
|
|
1711
1896
|
const flow = ctx.inFlow ?? collection.flow;
|
|
1712
1897
|
const stringify = flow ? stringifyFlowCollection : stringifyBlockCollection;
|
|
1713
1898
|
return stringify(collection, ctx, options);
|
|
@@ -1720,15 +1905,15 @@ function stringifyBlockCollection({ comment, items }, ctx, { blockItemPrefix, fl
|
|
|
1720
1905
|
for (let i = 0; i < items.length; ++i) {
|
|
1721
1906
|
const item = items[i];
|
|
1722
1907
|
let comment = null;
|
|
1723
|
-
if (isNode(item)) {
|
|
1908
|
+
if (Node$g.isNode(item)) {
|
|
1724
1909
|
if (!chompKeep && item.spaceBefore)
|
|
1725
1910
|
lines.push('');
|
|
1726
1911
|
addCommentBefore(ctx, lines, item.commentBefore, chompKeep);
|
|
1727
1912
|
if (item.comment)
|
|
1728
1913
|
comment = item.comment;
|
|
1729
1914
|
}
|
|
1730
|
-
else if (isPair(item)) {
|
|
1731
|
-
const ik = isNode(item.key) ? item.key : null;
|
|
1915
|
+
else if (Node$g.isPair(item)) {
|
|
1916
|
+
const ik = Node$g.isNode(item.key) ? item.key : null;
|
|
1732
1917
|
if (ik) {
|
|
1733
1918
|
if (!chompKeep && ik.spaceBefore)
|
|
1734
1919
|
lines.push('');
|
|
@@ -1736,9 +1921,9 @@ function stringifyBlockCollection({ comment, items }, ctx, { blockItemPrefix, fl
|
|
|
1736
1921
|
}
|
|
1737
1922
|
}
|
|
1738
1923
|
chompKeep = false;
|
|
1739
|
-
let str = stringify$
|
|
1924
|
+
let str = stringify$5.stringify(item, itemCtx, () => (comment = null), () => (chompKeep = true));
|
|
1740
1925
|
if (comment)
|
|
1741
|
-
str += lineComment(str, itemIndent, commentString(comment));
|
|
1926
|
+
str += stringifyComment$1.lineComment(str, itemIndent, commentString(comment));
|
|
1742
1927
|
if (chompKeep && comment)
|
|
1743
1928
|
chompKeep = false;
|
|
1744
1929
|
lines.push(blockItemPrefix + str);
|
|
@@ -1755,7 +1940,7 @@ function stringifyBlockCollection({ comment, items }, ctx, { blockItemPrefix, fl
|
|
|
1755
1940
|
}
|
|
1756
1941
|
}
|
|
1757
1942
|
if (comment) {
|
|
1758
|
-
str += '\n' + indentComment(commentString(comment), indent);
|
|
1943
|
+
str += '\n' + stringifyComment$1.indentComment(commentString(comment), indent);
|
|
1759
1944
|
if (onComment)
|
|
1760
1945
|
onComment();
|
|
1761
1946
|
}
|
|
@@ -1777,15 +1962,15 @@ function stringifyFlowCollection({ comment, items }, ctx, { flowChars, itemInden
|
|
|
1777
1962
|
for (let i = 0; i < items.length; ++i) {
|
|
1778
1963
|
const item = items[i];
|
|
1779
1964
|
let comment = null;
|
|
1780
|
-
if (isNode(item)) {
|
|
1965
|
+
if (Node$g.isNode(item)) {
|
|
1781
1966
|
if (item.spaceBefore)
|
|
1782
1967
|
lines.push('');
|
|
1783
1968
|
addCommentBefore(ctx, lines, item.commentBefore, false);
|
|
1784
1969
|
if (item.comment)
|
|
1785
1970
|
comment = item.comment;
|
|
1786
1971
|
}
|
|
1787
|
-
else if (isPair(item)) {
|
|
1788
|
-
const ik = isNode(item.key) ? item.key : null;
|
|
1972
|
+
else if (Node$g.isPair(item)) {
|
|
1973
|
+
const ik = Node$g.isNode(item.key) ? item.key : null;
|
|
1789
1974
|
if (ik) {
|
|
1790
1975
|
if (ik.spaceBefore)
|
|
1791
1976
|
lines.push('');
|
|
@@ -1793,7 +1978,7 @@ function stringifyFlowCollection({ comment, items }, ctx, { flowChars, itemInden
|
|
|
1793
1978
|
if (ik.comment)
|
|
1794
1979
|
reqNewline = true;
|
|
1795
1980
|
}
|
|
1796
|
-
const iv = isNode(item.value) ? item.value : null;
|
|
1981
|
+
const iv = Node$g.isNode(item.value) ? item.value : null;
|
|
1797
1982
|
if (iv) {
|
|
1798
1983
|
if (iv.comment)
|
|
1799
1984
|
comment = iv.comment;
|
|
@@ -1806,11 +1991,11 @@ function stringifyFlowCollection({ comment, items }, ctx, { flowChars, itemInden
|
|
|
1806
1991
|
}
|
|
1807
1992
|
if (comment)
|
|
1808
1993
|
reqNewline = true;
|
|
1809
|
-
let str = stringify$
|
|
1994
|
+
let str = stringify$5.stringify(item, itemCtx, () => (comment = null));
|
|
1810
1995
|
if (i < items.length - 1)
|
|
1811
1996
|
str += ',';
|
|
1812
1997
|
if (comment)
|
|
1813
|
-
str += lineComment(str, itemIndent, commentString(comment));
|
|
1998
|
+
str += stringifyComment$1.lineComment(str, itemIndent, commentString(comment));
|
|
1814
1999
|
if (!reqNewline && (lines.length > linesAtValue || str.includes('\n')))
|
|
1815
2000
|
reqNewline = true;
|
|
1816
2001
|
lines.push(str);
|
|
@@ -1824,7 +2009,7 @@ function stringifyFlowCollection({ comment, items }, ctx, { flowChars, itemInden
|
|
|
1824
2009
|
else {
|
|
1825
2010
|
if (!reqNewline) {
|
|
1826
2011
|
const len = lines.reduce((sum, line) => sum + line.length + 2, 2);
|
|
1827
|
-
reqNewline = len > Collection.maxFlowStringSingleLineLength;
|
|
2012
|
+
reqNewline = len > Collection$3.Collection.maxFlowStringSingleLineLength;
|
|
1828
2013
|
}
|
|
1829
2014
|
if (reqNewline) {
|
|
1830
2015
|
str = start;
|
|
@@ -1837,7 +2022,7 @@ function stringifyFlowCollection({ comment, items }, ctx, { flowChars, itemInden
|
|
|
1837
2022
|
}
|
|
1838
2023
|
}
|
|
1839
2024
|
if (comment) {
|
|
1840
|
-
str += lineComment(str, commentString(comment), indent);
|
|
2025
|
+
str += stringifyComment$1.lineComment(str, commentString(comment), indent);
|
|
1841
2026
|
if (onComment)
|
|
1842
2027
|
onComment();
|
|
1843
2028
|
}
|
|
@@ -1847,26 +2032,35 @@ function addCommentBefore({ indent, options: { commentString } }, lines, comment
|
|
|
1847
2032
|
if (comment && chompKeep)
|
|
1848
2033
|
comment = comment.replace(/^\n+/, '');
|
|
1849
2034
|
if (comment) {
|
|
1850
|
-
const ic = indentComment(commentString(comment), indent);
|
|
2035
|
+
const ic = stringifyComment$1.indentComment(commentString(comment), indent);
|
|
1851
2036
|
lines.push(ic.trimStart()); // Avoid double indent on first line
|
|
1852
2037
|
}
|
|
1853
2038
|
}
|
|
1854
2039
|
|
|
2040
|
+
stringifyCollection$3.stringifyCollection = stringifyCollection$2;
|
|
2041
|
+
|
|
2042
|
+
var stringifyCollection$1 = stringifyCollection$3;
|
|
2043
|
+
var addPairToJSMap = addPairToJSMap$3;
|
|
2044
|
+
var Collection$2 = Collection$5;
|
|
2045
|
+
var Node$f = Node$t;
|
|
2046
|
+
var Pair$7 = Pair$9;
|
|
2047
|
+
var Scalar$e = Scalar$k;
|
|
2048
|
+
|
|
1855
2049
|
function findPair(items, key) {
|
|
1856
|
-
const k = isScalar
|
|
2050
|
+
const k = Node$f.isScalar(key) ? key.value : key;
|
|
1857
2051
|
for (const it of items) {
|
|
1858
|
-
if (isPair(it)) {
|
|
2052
|
+
if (Node$f.isPair(it)) {
|
|
1859
2053
|
if (it.key === key || it.key === k)
|
|
1860
2054
|
return it;
|
|
1861
|
-
if (isScalar
|
|
2055
|
+
if (Node$f.isScalar(it.key) && it.key.value === k)
|
|
1862
2056
|
return it;
|
|
1863
2057
|
}
|
|
1864
2058
|
}
|
|
1865
2059
|
return undefined;
|
|
1866
2060
|
}
|
|
1867
|
-
class YAMLMap extends Collection {
|
|
2061
|
+
class YAMLMap$6 extends Collection$2.Collection {
|
|
1868
2062
|
constructor(schema) {
|
|
1869
|
-
super(MAP, schema);
|
|
2063
|
+
super(Node$f.MAP, schema);
|
|
1870
2064
|
this.items = [];
|
|
1871
2065
|
}
|
|
1872
2066
|
static get tagName() {
|
|
@@ -1880,21 +2074,21 @@ class YAMLMap extends Collection {
|
|
|
1880
2074
|
*/
|
|
1881
2075
|
add(pair, overwrite) {
|
|
1882
2076
|
let _pair;
|
|
1883
|
-
if (isPair(pair))
|
|
2077
|
+
if (Node$f.isPair(pair))
|
|
1884
2078
|
_pair = pair;
|
|
1885
2079
|
else if (!pair || typeof pair !== 'object' || !('key' in pair)) {
|
|
1886
2080
|
// In TypeScript, this never happens.
|
|
1887
|
-
_pair = new Pair(pair, pair?.value);
|
|
2081
|
+
_pair = new Pair$7.Pair(pair, pair?.value);
|
|
1888
2082
|
}
|
|
1889
2083
|
else
|
|
1890
|
-
_pair = new Pair(pair.key, pair.value);
|
|
2084
|
+
_pair = new Pair$7.Pair(pair.key, pair.value);
|
|
1891
2085
|
const prev = findPair(this.items, _pair.key);
|
|
1892
2086
|
const sortEntries = this.schema?.sortMapEntries;
|
|
1893
2087
|
if (prev) {
|
|
1894
2088
|
if (!overwrite)
|
|
1895
2089
|
throw new Error(`Key ${_pair.key} already set`);
|
|
1896
2090
|
// For scalars, keep the old node & its comments and anchors
|
|
1897
|
-
if (isScalar
|
|
2091
|
+
if (Node$f.isScalar(prev.value) && Scalar$e.isScalarValue(_pair.value))
|
|
1898
2092
|
prev.value.value = _pair.value;
|
|
1899
2093
|
else
|
|
1900
2094
|
prev.value = _pair.value;
|
|
@@ -1920,13 +2114,13 @@ class YAMLMap extends Collection {
|
|
|
1920
2114
|
get(key, keepScalar) {
|
|
1921
2115
|
const it = findPair(this.items, key);
|
|
1922
2116
|
const node = it?.value;
|
|
1923
|
-
return (!keepScalar && isScalar
|
|
2117
|
+
return (!keepScalar && Node$f.isScalar(node) ? node.value : node) ?? undefined;
|
|
1924
2118
|
}
|
|
1925
2119
|
has(key) {
|
|
1926
2120
|
return !!findPair(this.items, key);
|
|
1927
2121
|
}
|
|
1928
2122
|
set(key, value) {
|
|
1929
|
-
this.add(new Pair(key, value), true);
|
|
2123
|
+
this.add(new Pair$7.Pair(key, value), true);
|
|
1930
2124
|
}
|
|
1931
2125
|
/**
|
|
1932
2126
|
* @param ctx - Conversion context, originally set in Document#toJS()
|
|
@@ -1938,19 +2132,19 @@ class YAMLMap extends Collection {
|
|
|
1938
2132
|
if (ctx?.onCreate)
|
|
1939
2133
|
ctx.onCreate(map);
|
|
1940
2134
|
for (const item of this.items)
|
|
1941
|
-
addPairToJSMap(ctx, map, item);
|
|
2135
|
+
addPairToJSMap.addPairToJSMap(ctx, map, item);
|
|
1942
2136
|
return map;
|
|
1943
2137
|
}
|
|
1944
2138
|
toString(ctx, onComment, onChompKeep) {
|
|
1945
2139
|
if (!ctx)
|
|
1946
2140
|
return JSON.stringify(this);
|
|
1947
2141
|
for (const item of this.items) {
|
|
1948
|
-
if (!isPair(item))
|
|
2142
|
+
if (!Node$f.isPair(item))
|
|
1949
2143
|
throw new Error(`Map items must all be pairs; found ${JSON.stringify(item)} instead`);
|
|
1950
2144
|
}
|
|
1951
2145
|
if (!ctx.allNullValues && this.hasAllNullValues(false))
|
|
1952
2146
|
ctx = Object.assign({}, ctx, { allNullValues: true });
|
|
1953
|
-
return stringifyCollection(this, ctx, {
|
|
2147
|
+
return stringifyCollection$1.stringifyCollection(this, ctx, {
|
|
1954
2148
|
blockItemPrefix: '',
|
|
1955
2149
|
flowChars: { start: '{', end: '}' },
|
|
1956
2150
|
itemIndent: ctx.indent || '',
|
|
@@ -1960,16 +2154,23 @@ class YAMLMap extends Collection {
|
|
|
1960
2154
|
}
|
|
1961
2155
|
}
|
|
1962
2156
|
|
|
2157
|
+
YAMLMap$7.YAMLMap = YAMLMap$6;
|
|
2158
|
+
YAMLMap$7.findPair = findPair;
|
|
2159
|
+
|
|
2160
|
+
var Node$e = Node$t;
|
|
2161
|
+
var Pair$6 = Pair$9;
|
|
2162
|
+
var YAMLMap$5 = YAMLMap$7;
|
|
2163
|
+
|
|
1963
2164
|
function createMap(schema, obj, ctx) {
|
|
1964
2165
|
const { keepUndefined, replacer } = ctx;
|
|
1965
|
-
const map = new YAMLMap(schema);
|
|
2166
|
+
const map = new YAMLMap$5.YAMLMap(schema);
|
|
1966
2167
|
const add = (key, value) => {
|
|
1967
2168
|
if (typeof replacer === 'function')
|
|
1968
2169
|
value = replacer.call(obj, key, value);
|
|
1969
2170
|
else if (Array.isArray(replacer) && !replacer.includes(key))
|
|
1970
2171
|
return;
|
|
1971
2172
|
if (value !== undefined || keepUndefined)
|
|
1972
|
-
map.items.push(createPair(key, value, ctx));
|
|
2173
|
+
map.items.push(Pair$6.createPair(key, value, ctx));
|
|
1973
2174
|
};
|
|
1974
2175
|
if (obj instanceof Map) {
|
|
1975
2176
|
for (const [key, value] of obj)
|
|
@@ -1984,22 +2185,34 @@ function createMap(schema, obj, ctx) {
|
|
|
1984
2185
|
}
|
|
1985
2186
|
return map;
|
|
1986
2187
|
}
|
|
1987
|
-
const map = {
|
|
2188
|
+
const map$5 = {
|
|
1988
2189
|
collection: 'map',
|
|
1989
2190
|
createNode: createMap,
|
|
1990
2191
|
default: true,
|
|
1991
|
-
nodeClass: YAMLMap,
|
|
2192
|
+
nodeClass: YAMLMap$5.YAMLMap,
|
|
1992
2193
|
tag: 'tag:yaml.org,2002:map',
|
|
1993
2194
|
resolve(map, onError) {
|
|
1994
|
-
if (!isMap(map))
|
|
2195
|
+
if (!Node$e.isMap(map))
|
|
1995
2196
|
onError('Expected a mapping for this tag');
|
|
1996
2197
|
return map;
|
|
1997
2198
|
}
|
|
1998
2199
|
};
|
|
1999
2200
|
|
|
2000
|
-
|
|
2201
|
+
map$6.map = map$5;
|
|
2202
|
+
|
|
2203
|
+
var seq$6 = {};
|
|
2204
|
+
|
|
2205
|
+
var YAMLSeq$7 = {};
|
|
2206
|
+
|
|
2207
|
+
var stringifyCollection = stringifyCollection$3;
|
|
2208
|
+
var Collection$1 = Collection$5;
|
|
2209
|
+
var Node$d = Node$t;
|
|
2210
|
+
var Scalar$d = Scalar$k;
|
|
2211
|
+
var toJS$2 = toJS$6;
|
|
2212
|
+
|
|
2213
|
+
class YAMLSeq$6 extends Collection$1.Collection {
|
|
2001
2214
|
constructor(schema) {
|
|
2002
|
-
super(SEQ, schema);
|
|
2215
|
+
super(Node$d.SEQ, schema);
|
|
2003
2216
|
this.items = [];
|
|
2004
2217
|
}
|
|
2005
2218
|
static get tagName() {
|
|
@@ -2028,7 +2241,7 @@ class YAMLSeq extends Collection {
|
|
|
2028
2241
|
if (typeof idx !== 'number')
|
|
2029
2242
|
return undefined;
|
|
2030
2243
|
const it = this.items[idx];
|
|
2031
|
-
return !keepScalar && isScalar
|
|
2244
|
+
return !keepScalar && Node$d.isScalar(it) ? it.value : it;
|
|
2032
2245
|
}
|
|
2033
2246
|
/**
|
|
2034
2247
|
* Checks if the collection includes a value with the key `key`.
|
|
@@ -2052,7 +2265,7 @@ class YAMLSeq extends Collection {
|
|
|
2052
2265
|
if (typeof idx !== 'number')
|
|
2053
2266
|
throw new Error(`Expected a valid index, not ${key}.`);
|
|
2054
2267
|
const prev = this.items[idx];
|
|
2055
|
-
if (isScalar
|
|
2268
|
+
if (Node$d.isScalar(prev) && Scalar$d.isScalarValue(value))
|
|
2056
2269
|
prev.value = value;
|
|
2057
2270
|
else
|
|
2058
2271
|
this.items[idx] = value;
|
|
@@ -2063,13 +2276,13 @@ class YAMLSeq extends Collection {
|
|
|
2063
2276
|
ctx.onCreate(seq);
|
|
2064
2277
|
let i = 0;
|
|
2065
2278
|
for (const item of this.items)
|
|
2066
|
-
seq.push(toJS(item, String(i++), ctx));
|
|
2279
|
+
seq.push(toJS$2.toJS(item, String(i++), ctx));
|
|
2067
2280
|
return seq;
|
|
2068
2281
|
}
|
|
2069
2282
|
toString(ctx, onComment, onChompKeep) {
|
|
2070
2283
|
if (!ctx)
|
|
2071
2284
|
return JSON.stringify(this);
|
|
2072
|
-
return stringifyCollection(this, ctx, {
|
|
2285
|
+
return stringifyCollection.stringifyCollection(this, ctx, {
|
|
2073
2286
|
blockItemPrefix: '- ',
|
|
2074
2287
|
flowChars: { start: '[', end: ']' },
|
|
2075
2288
|
itemIndent: (ctx.indent || '') + ' ',
|
|
@@ -2079,7 +2292,7 @@ class YAMLSeq extends Collection {
|
|
|
2079
2292
|
}
|
|
2080
2293
|
}
|
|
2081
2294
|
function asItemIndex(key) {
|
|
2082
|
-
let idx = isScalar
|
|
2295
|
+
let idx = Node$d.isScalar(key) ? key.value : key;
|
|
2083
2296
|
if (idx && typeof idx === 'string')
|
|
2084
2297
|
idx = Number(idx);
|
|
2085
2298
|
return typeof idx === 'number' && Number.isInteger(idx) && idx >= 0
|
|
@@ -2087,9 +2300,15 @@ function asItemIndex(key) {
|
|
|
2087
2300
|
: null;
|
|
2088
2301
|
}
|
|
2089
2302
|
|
|
2303
|
+
YAMLSeq$7.YAMLSeq = YAMLSeq$6;
|
|
2304
|
+
|
|
2305
|
+
var createNode$1 = createNode$5;
|
|
2306
|
+
var Node$c = Node$t;
|
|
2307
|
+
var YAMLSeq$5 = YAMLSeq$7;
|
|
2308
|
+
|
|
2090
2309
|
function createSeq(schema, obj, ctx) {
|
|
2091
2310
|
const { replacer } = ctx;
|
|
2092
|
-
const seq = new YAMLSeq(schema);
|
|
2311
|
+
const seq = new YAMLSeq$5.YAMLSeq(schema);
|
|
2093
2312
|
if (obj && Symbol.iterator in Object(obj)) {
|
|
2094
2313
|
let i = 0;
|
|
2095
2314
|
for (let it of obj) {
|
|
@@ -2097,53 +2316,73 @@ function createSeq(schema, obj, ctx) {
|
|
|
2097
2316
|
const key = obj instanceof Set ? it : String(i++);
|
|
2098
2317
|
it = replacer.call(obj, key, it);
|
|
2099
2318
|
}
|
|
2100
|
-
seq.items.push(createNode(it, undefined, ctx));
|
|
2319
|
+
seq.items.push(createNode$1.createNode(it, undefined, ctx));
|
|
2101
2320
|
}
|
|
2102
2321
|
}
|
|
2103
2322
|
return seq;
|
|
2104
2323
|
}
|
|
2105
|
-
const seq = {
|
|
2324
|
+
const seq$5 = {
|
|
2106
2325
|
collection: 'seq',
|
|
2107
2326
|
createNode: createSeq,
|
|
2108
2327
|
default: true,
|
|
2109
|
-
nodeClass: YAMLSeq,
|
|
2328
|
+
nodeClass: YAMLSeq$5.YAMLSeq,
|
|
2110
2329
|
tag: 'tag:yaml.org,2002:seq',
|
|
2111
2330
|
resolve(seq, onError) {
|
|
2112
|
-
if (!isSeq(seq))
|
|
2331
|
+
if (!Node$c.isSeq(seq))
|
|
2113
2332
|
onError('Expected a sequence for this tag');
|
|
2114
2333
|
return seq;
|
|
2115
2334
|
}
|
|
2116
2335
|
};
|
|
2117
2336
|
|
|
2118
|
-
|
|
2337
|
+
seq$6.seq = seq$5;
|
|
2338
|
+
|
|
2339
|
+
var string$5 = {};
|
|
2340
|
+
|
|
2341
|
+
var stringifyString$2 = stringifyString$5;
|
|
2342
|
+
|
|
2343
|
+
const string$4 = {
|
|
2119
2344
|
identify: value => typeof value === 'string',
|
|
2120
2345
|
default: true,
|
|
2121
2346
|
tag: 'tag:yaml.org,2002:str',
|
|
2122
2347
|
resolve: str => str,
|
|
2123
2348
|
stringify(item, ctx, onComment, onChompKeep) {
|
|
2124
2349
|
ctx = Object.assign({ actualString: true }, ctx);
|
|
2125
|
-
return stringifyString(item, ctx, onComment, onChompKeep);
|
|
2350
|
+
return stringifyString$2.stringifyString(item, ctx, onComment, onChompKeep);
|
|
2126
2351
|
}
|
|
2127
2352
|
};
|
|
2128
2353
|
|
|
2354
|
+
string$5.string = string$4;
|
|
2355
|
+
|
|
2356
|
+
var tags$1 = {};
|
|
2357
|
+
|
|
2358
|
+
var _null$3 = {};
|
|
2359
|
+
|
|
2360
|
+
var Scalar$c = Scalar$k;
|
|
2361
|
+
|
|
2129
2362
|
const nullTag = {
|
|
2130
2363
|
identify: value => value == null,
|
|
2131
|
-
createNode: () => new Scalar(null),
|
|
2364
|
+
createNode: () => new Scalar$c.Scalar(null),
|
|
2132
2365
|
default: true,
|
|
2133
2366
|
tag: 'tag:yaml.org,2002:null',
|
|
2134
2367
|
test: /^(?:~|[Nn]ull|NULL)?$/,
|
|
2135
|
-
resolve: () => new Scalar(null),
|
|
2368
|
+
resolve: () => new Scalar$c.Scalar(null),
|
|
2136
2369
|
stringify: ({ source }, ctx) => typeof source === 'string' && nullTag.test.test(source)
|
|
2137
2370
|
? source
|
|
2138
2371
|
: ctx.options.nullStr
|
|
2139
2372
|
};
|
|
2140
2373
|
|
|
2374
|
+
_null$3.nullTag = nullTag;
|
|
2375
|
+
|
|
2376
|
+
var bool$4 = {};
|
|
2377
|
+
|
|
2378
|
+
var Scalar$b = Scalar$k;
|
|
2379
|
+
|
|
2141
2380
|
const boolTag = {
|
|
2142
2381
|
identify: value => typeof value === 'boolean',
|
|
2143
2382
|
default: true,
|
|
2144
2383
|
tag: 'tag:yaml.org,2002:bool',
|
|
2145
2384
|
test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
|
|
2146
|
-
resolve: str => new Scalar(str[0] === 't' || str[0] === 'T'),
|
|
2385
|
+
resolve: str => new Scalar$b.Scalar(str[0] === 't' || str[0] === 'T'),
|
|
2147
2386
|
stringify({ source, value }, ctx) {
|
|
2148
2387
|
if (source && boolTag.test.test(source)) {
|
|
2149
2388
|
const sv = source[0] === 't' || source[0] === 'T';
|
|
@@ -2154,7 +2393,13 @@ const boolTag = {
|
|
|
2154
2393
|
}
|
|
2155
2394
|
};
|
|
2156
2395
|
|
|
2157
|
-
|
|
2396
|
+
bool$4.boolTag = boolTag;
|
|
2397
|
+
|
|
2398
|
+
var float$6 = {};
|
|
2399
|
+
|
|
2400
|
+
var stringifyNumber$6 = {};
|
|
2401
|
+
|
|
2402
|
+
function stringifyNumber$5({ format, minFractionDigits, tag, value }) {
|
|
2158
2403
|
if (typeof value === 'bigint')
|
|
2159
2404
|
return String(value);
|
|
2160
2405
|
const num = typeof value === 'number' ? value : Number(value);
|
|
@@ -2177,6 +2422,11 @@ function stringifyNumber({ format, minFractionDigits, tag, value }) {
|
|
|
2177
2422
|
return n;
|
|
2178
2423
|
}
|
|
2179
2424
|
|
|
2425
|
+
stringifyNumber$6.stringifyNumber = stringifyNumber$5;
|
|
2426
|
+
|
|
2427
|
+
var Scalar$a = Scalar$k;
|
|
2428
|
+
var stringifyNumber$4 = stringifyNumber$6;
|
|
2429
|
+
|
|
2180
2430
|
const floatNaN$1 = {
|
|
2181
2431
|
identify: value => typeof value === 'number',
|
|
2182
2432
|
default: true,
|
|
@@ -2187,7 +2437,7 @@ const floatNaN$1 = {
|
|
|
2187
2437
|
: str[0] === '-'
|
|
2188
2438
|
? Number.NEGATIVE_INFINITY
|
|
2189
2439
|
: Number.POSITIVE_INFINITY,
|
|
2190
|
-
stringify: stringifyNumber
|
|
2440
|
+
stringify: stringifyNumber$4.stringifyNumber
|
|
2191
2441
|
};
|
|
2192
2442
|
const floatExp$1 = {
|
|
2193
2443
|
identify: value => typeof value === 'number',
|
|
@@ -2198,31 +2448,39 @@ const floatExp$1 = {
|
|
|
2198
2448
|
resolve: str => parseFloat(str),
|
|
2199
2449
|
stringify(node) {
|
|
2200
2450
|
const num = Number(node.value);
|
|
2201
|
-
return isFinite(num) ? num.toExponential() : stringifyNumber(node);
|
|
2451
|
+
return isFinite(num) ? num.toExponential() : stringifyNumber$4.stringifyNumber(node);
|
|
2202
2452
|
}
|
|
2203
2453
|
};
|
|
2204
|
-
const float$
|
|
2454
|
+
const float$5 = {
|
|
2205
2455
|
identify: value => typeof value === 'number',
|
|
2206
2456
|
default: true,
|
|
2207
2457
|
tag: 'tag:yaml.org,2002:float',
|
|
2208
2458
|
test: /^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,
|
|
2209
2459
|
resolve(str) {
|
|
2210
|
-
const node = new Scalar(parseFloat(str));
|
|
2460
|
+
const node = new Scalar$a.Scalar(parseFloat(str));
|
|
2211
2461
|
const dot = str.indexOf('.');
|
|
2212
2462
|
if (dot !== -1 && str[str.length - 1] === '0')
|
|
2213
2463
|
node.minFractionDigits = str.length - dot - 1;
|
|
2214
2464
|
return node;
|
|
2215
2465
|
},
|
|
2216
|
-
stringify: stringifyNumber
|
|
2466
|
+
stringify: stringifyNumber$4.stringifyNumber
|
|
2217
2467
|
};
|
|
2218
2468
|
|
|
2469
|
+
float$6.float = float$5;
|
|
2470
|
+
float$6.floatExp = floatExp$1;
|
|
2471
|
+
float$6.floatNaN = floatNaN$1;
|
|
2472
|
+
|
|
2473
|
+
var int$6 = {};
|
|
2474
|
+
|
|
2475
|
+
var stringifyNumber$3 = stringifyNumber$6;
|
|
2476
|
+
|
|
2219
2477
|
const intIdentify$2 = (value) => typeof value === 'bigint' || Number.isInteger(value);
|
|
2220
2478
|
const intResolve$1 = (str, offset, radix, { intAsBigInt }) => (intAsBigInt ? BigInt(str) : parseInt(str.substring(offset), radix));
|
|
2221
2479
|
function intStringify$1(node, radix, prefix) {
|
|
2222
2480
|
const { value } = node;
|
|
2223
2481
|
if (intIdentify$2(value) && value >= 0)
|
|
2224
2482
|
return prefix + value.toString(radix);
|
|
2225
|
-
return stringifyNumber(node);
|
|
2483
|
+
return stringifyNumber$3.stringifyNumber(node);
|
|
2226
2484
|
}
|
|
2227
2485
|
const intOct$1 = {
|
|
2228
2486
|
identify: value => intIdentify$2(value) && value >= 0,
|
|
@@ -2233,13 +2491,13 @@ const intOct$1 = {
|
|
|
2233
2491
|
resolve: (str, _onError, opt) => intResolve$1(str, 2, 8, opt),
|
|
2234
2492
|
stringify: node => intStringify$1(node, 8, '0o')
|
|
2235
2493
|
};
|
|
2236
|
-
const int$
|
|
2494
|
+
const int$5 = {
|
|
2237
2495
|
identify: intIdentify$2,
|
|
2238
2496
|
default: true,
|
|
2239
2497
|
tag: 'tag:yaml.org,2002:int',
|
|
2240
2498
|
test: /^[-+]?[0-9]+$/,
|
|
2241
2499
|
resolve: (str, _onError, opt) => intResolve$1(str, 0, 10, opt),
|
|
2242
|
-
stringify: stringifyNumber
|
|
2500
|
+
stringify: stringifyNumber$3.stringifyNumber
|
|
2243
2501
|
};
|
|
2244
2502
|
const intHex$1 = {
|
|
2245
2503
|
identify: value => intIdentify$2(value) && value >= 0,
|
|
@@ -2251,20 +2509,42 @@ const intHex$1 = {
|
|
|
2251
2509
|
stringify: node => intStringify$1(node, 16, '0x')
|
|
2252
2510
|
};
|
|
2253
2511
|
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2512
|
+
int$6.int = int$5;
|
|
2513
|
+
int$6.intHex = intHex$1;
|
|
2514
|
+
int$6.intOct = intOct$1;
|
|
2515
|
+
|
|
2516
|
+
var schema$8 = {};
|
|
2517
|
+
|
|
2518
|
+
var map$4 = map$6;
|
|
2519
|
+
var _null$2 = _null$3;
|
|
2520
|
+
var seq$4 = seq$6;
|
|
2521
|
+
var string$3 = string$5;
|
|
2522
|
+
var bool$3 = bool$4;
|
|
2523
|
+
var float$4 = float$6;
|
|
2524
|
+
var int$4 = int$6;
|
|
2525
|
+
|
|
2526
|
+
const schema$7 = [
|
|
2527
|
+
map$4.map,
|
|
2528
|
+
seq$4.seq,
|
|
2529
|
+
string$3.string,
|
|
2530
|
+
_null$2.nullTag,
|
|
2531
|
+
bool$3.boolTag,
|
|
2532
|
+
int$4.intOct,
|
|
2533
|
+
int$4.int,
|
|
2534
|
+
int$4.intHex,
|
|
2535
|
+
float$4.floatNaN,
|
|
2536
|
+
float$4.floatExp,
|
|
2537
|
+
float$4.float
|
|
2266
2538
|
];
|
|
2267
2539
|
|
|
2540
|
+
schema$8.schema = schema$7;
|
|
2541
|
+
|
|
2542
|
+
var schema$6 = {};
|
|
2543
|
+
|
|
2544
|
+
var Scalar$9 = Scalar$k;
|
|
2545
|
+
var map$3 = map$6;
|
|
2546
|
+
var seq$3 = seq$6;
|
|
2547
|
+
|
|
2268
2548
|
function intIdentify$1(value) {
|
|
2269
2549
|
return typeof value === 'bigint' || Number.isInteger(value);
|
|
2270
2550
|
}
|
|
@@ -2279,7 +2559,7 @@ const jsonScalars = [
|
|
|
2279
2559
|
},
|
|
2280
2560
|
{
|
|
2281
2561
|
identify: value => value == null,
|
|
2282
|
-
createNode: () => new Scalar(null),
|
|
2562
|
+
createNode: () => new Scalar$9.Scalar(null),
|
|
2283
2563
|
default: true,
|
|
2284
2564
|
tag: 'tag:yaml.org,2002:null',
|
|
2285
2565
|
test: /^null$/,
|
|
@@ -2320,9 +2600,16 @@ const jsonError = {
|
|
|
2320
2600
|
return str;
|
|
2321
2601
|
}
|
|
2322
2602
|
};
|
|
2323
|
-
const schema$
|
|
2603
|
+
const schema$5 = [map$3.map, seq$3.seq].concat(jsonScalars, jsonError);
|
|
2604
|
+
|
|
2605
|
+
schema$6.schema = schema$5;
|
|
2606
|
+
|
|
2607
|
+
var binary$3 = {};
|
|
2324
2608
|
|
|
2325
|
-
|
|
2609
|
+
var Scalar$8 = Scalar$k;
|
|
2610
|
+
var stringifyString$1 = stringifyString$5;
|
|
2611
|
+
|
|
2612
|
+
const binary$2 = {
|
|
2326
2613
|
identify: value => value instanceof Uint8Array,
|
|
2327
2614
|
default: false,
|
|
2328
2615
|
tag: 'tag:yaml.org,2002:binary',
|
|
@@ -2370,30 +2657,41 @@ const binary = {
|
|
|
2370
2657
|
throw new Error('This environment does not support writing binary tags; either Buffer or btoa is required');
|
|
2371
2658
|
}
|
|
2372
2659
|
if (!type)
|
|
2373
|
-
type = Scalar.BLOCK_LITERAL;
|
|
2374
|
-
if (type !== Scalar.QUOTE_DOUBLE) {
|
|
2660
|
+
type = Scalar$8.Scalar.BLOCK_LITERAL;
|
|
2661
|
+
if (type !== Scalar$8.Scalar.QUOTE_DOUBLE) {
|
|
2375
2662
|
const lineWidth = Math.max(ctx.options.lineWidth - ctx.indent.length, ctx.options.minContentWidth);
|
|
2376
2663
|
const n = Math.ceil(str.length / lineWidth);
|
|
2377
2664
|
const lines = new Array(n);
|
|
2378
2665
|
for (let i = 0, o = 0; i < n; ++i, o += lineWidth) {
|
|
2379
2666
|
lines[i] = str.substr(o, lineWidth);
|
|
2380
2667
|
}
|
|
2381
|
-
str = lines.join(type === Scalar.BLOCK_LITERAL ? '\n' : ' ');
|
|
2668
|
+
str = lines.join(type === Scalar$8.Scalar.BLOCK_LITERAL ? '\n' : ' ');
|
|
2382
2669
|
}
|
|
2383
|
-
return stringifyString({ comment, type, value: str }, ctx, onComment, onChompKeep);
|
|
2670
|
+
return stringifyString$1.stringifyString({ comment, type, value: str }, ctx, onComment, onChompKeep);
|
|
2384
2671
|
}
|
|
2385
2672
|
};
|
|
2386
2673
|
|
|
2674
|
+
binary$3.binary = binary$2;
|
|
2675
|
+
|
|
2676
|
+
var omap$3 = {};
|
|
2677
|
+
|
|
2678
|
+
var pairs$4 = {};
|
|
2679
|
+
|
|
2680
|
+
var Node$b = Node$t;
|
|
2681
|
+
var Pair$5 = Pair$9;
|
|
2682
|
+
var Scalar$7 = Scalar$k;
|
|
2683
|
+
var YAMLSeq$4 = YAMLSeq$7;
|
|
2684
|
+
|
|
2387
2685
|
function resolvePairs(seq, onError) {
|
|
2388
|
-
if (isSeq(seq)) {
|
|
2686
|
+
if (Node$b.isSeq(seq)) {
|
|
2389
2687
|
for (let i = 0; i < seq.items.length; ++i) {
|
|
2390
2688
|
let item = seq.items[i];
|
|
2391
|
-
if (isPair(item))
|
|
2689
|
+
if (Node$b.isPair(item))
|
|
2392
2690
|
continue;
|
|
2393
|
-
else if (isMap(item)) {
|
|
2691
|
+
else if (Node$b.isMap(item)) {
|
|
2394
2692
|
if (item.items.length > 1)
|
|
2395
2693
|
onError('Each pair must have its own sequence indicator');
|
|
2396
|
-
const pair = item.items[0] || new Pair(new Scalar(null));
|
|
2694
|
+
const pair = item.items[0] || new Pair$5.Pair(new Scalar$7.Scalar(null));
|
|
2397
2695
|
if (item.commentBefore)
|
|
2398
2696
|
pair.key.commentBefore = pair.key.commentBefore
|
|
2399
2697
|
? `${item.commentBefore}\n${pair.key.commentBefore}`
|
|
@@ -2406,7 +2704,7 @@ function resolvePairs(seq, onError) {
|
|
|
2406
2704
|
}
|
|
2407
2705
|
item = pair;
|
|
2408
2706
|
}
|
|
2409
|
-
seq.items[i] = isPair(item) ? item : new Pair(item);
|
|
2707
|
+
seq.items[i] = Node$b.isPair(item) ? item : new Pair$5.Pair(item);
|
|
2410
2708
|
}
|
|
2411
2709
|
}
|
|
2412
2710
|
else
|
|
@@ -2415,7 +2713,7 @@ function resolvePairs(seq, onError) {
|
|
|
2415
2713
|
}
|
|
2416
2714
|
function createPairs(schema, iterable, ctx) {
|
|
2417
2715
|
const { replacer } = ctx;
|
|
2418
|
-
const pairs = new YAMLSeq(schema);
|
|
2716
|
+
const pairs = new YAMLSeq$4.YAMLSeq(schema);
|
|
2419
2717
|
pairs.tag = 'tag:yaml.org,2002:pairs';
|
|
2420
2718
|
let i = 0;
|
|
2421
2719
|
if (iterable && Symbol.iterator in Object(iterable))
|
|
@@ -2443,11 +2741,11 @@ function createPairs(schema, iterable, ctx) {
|
|
|
2443
2741
|
else {
|
|
2444
2742
|
key = it;
|
|
2445
2743
|
}
|
|
2446
|
-
pairs.items.push(createPair(key, value, ctx));
|
|
2744
|
+
pairs.items.push(Pair$5.createPair(key, value, ctx));
|
|
2447
2745
|
}
|
|
2448
2746
|
return pairs;
|
|
2449
2747
|
}
|
|
2450
|
-
const pairs = {
|
|
2748
|
+
const pairs$3 = {
|
|
2451
2749
|
collection: 'seq',
|
|
2452
2750
|
default: false,
|
|
2453
2751
|
tag: 'tag:yaml.org,2002:pairs',
|
|
@@ -2455,14 +2753,24 @@ const pairs = {
|
|
|
2455
2753
|
createNode: createPairs
|
|
2456
2754
|
};
|
|
2457
2755
|
|
|
2458
|
-
|
|
2756
|
+
pairs$4.createPairs = createPairs;
|
|
2757
|
+
pairs$4.pairs = pairs$3;
|
|
2758
|
+
pairs$4.resolvePairs = resolvePairs;
|
|
2759
|
+
|
|
2760
|
+
var YAMLSeq$3 = YAMLSeq$7;
|
|
2761
|
+
var toJS$1 = toJS$6;
|
|
2762
|
+
var Node$a = Node$t;
|
|
2763
|
+
var YAMLMap$4 = YAMLMap$7;
|
|
2764
|
+
var pairs$2 = pairs$4;
|
|
2765
|
+
|
|
2766
|
+
class YAMLOMap extends YAMLSeq$3.YAMLSeq {
|
|
2459
2767
|
constructor() {
|
|
2460
2768
|
super();
|
|
2461
|
-
this.add = YAMLMap.prototype.add.bind(this);
|
|
2462
|
-
this.delete = YAMLMap.prototype.delete.bind(this);
|
|
2463
|
-
this.get = YAMLMap.prototype.get.bind(this);
|
|
2464
|
-
this.has = YAMLMap.prototype.has.bind(this);
|
|
2465
|
-
this.set = YAMLMap.prototype.set.bind(this);
|
|
2769
|
+
this.add = YAMLMap$4.YAMLMap.prototype.add.bind(this);
|
|
2770
|
+
this.delete = YAMLMap$4.YAMLMap.prototype.delete.bind(this);
|
|
2771
|
+
this.get = YAMLMap$4.YAMLMap.prototype.get.bind(this);
|
|
2772
|
+
this.has = YAMLMap$4.YAMLMap.prototype.has.bind(this);
|
|
2773
|
+
this.set = YAMLMap$4.YAMLMap.prototype.set.bind(this);
|
|
2466
2774
|
this.tag = YAMLOMap.tag;
|
|
2467
2775
|
}
|
|
2468
2776
|
/**
|
|
@@ -2477,12 +2785,12 @@ class YAMLOMap extends YAMLSeq {
|
|
|
2477
2785
|
ctx.onCreate(map);
|
|
2478
2786
|
for (const pair of this.items) {
|
|
2479
2787
|
let key, value;
|
|
2480
|
-
if (isPair(pair)) {
|
|
2481
|
-
key = toJS(pair.key, '', ctx);
|
|
2482
|
-
value = toJS(pair.value, key, ctx);
|
|
2788
|
+
if (Node$a.isPair(pair)) {
|
|
2789
|
+
key = toJS$1.toJS(pair.key, '', ctx);
|
|
2790
|
+
value = toJS$1.toJS(pair.value, key, ctx);
|
|
2483
2791
|
}
|
|
2484
2792
|
else {
|
|
2485
|
-
key = toJS(pair, '', ctx);
|
|
2793
|
+
key = toJS$1.toJS(pair, '', ctx);
|
|
2486
2794
|
}
|
|
2487
2795
|
if (map.has(key))
|
|
2488
2796
|
throw new Error('Ordered maps must not include duplicate keys');
|
|
@@ -2492,17 +2800,17 @@ class YAMLOMap extends YAMLSeq {
|
|
|
2492
2800
|
}
|
|
2493
2801
|
}
|
|
2494
2802
|
YAMLOMap.tag = 'tag:yaml.org,2002:omap';
|
|
2495
|
-
const omap = {
|
|
2803
|
+
const omap$2 = {
|
|
2496
2804
|
collection: 'seq',
|
|
2497
2805
|
identify: value => value instanceof Map,
|
|
2498
2806
|
nodeClass: YAMLOMap,
|
|
2499
2807
|
default: false,
|
|
2500
2808
|
tag: 'tag:yaml.org,2002:omap',
|
|
2501
2809
|
resolve(seq, onError) {
|
|
2502
|
-
const pairs = resolvePairs(seq, onError);
|
|
2810
|
+
const pairs$1 = pairs$2.resolvePairs(seq, onError);
|
|
2503
2811
|
const seenKeys = [];
|
|
2504
|
-
for (const { key } of pairs.items) {
|
|
2505
|
-
if (isScalar
|
|
2812
|
+
for (const { key } of pairs$1.items) {
|
|
2813
|
+
if (Node$a.isScalar(key)) {
|
|
2506
2814
|
if (seenKeys.includes(key.value)) {
|
|
2507
2815
|
onError(`Ordered maps must not include duplicate keys: ${key.value}`);
|
|
2508
2816
|
}
|
|
@@ -2511,16 +2819,25 @@ const omap = {
|
|
|
2511
2819
|
}
|
|
2512
2820
|
}
|
|
2513
2821
|
}
|
|
2514
|
-
return Object.assign(new YAMLOMap(), pairs);
|
|
2822
|
+
return Object.assign(new YAMLOMap(), pairs$1);
|
|
2515
2823
|
},
|
|
2516
2824
|
createNode(schema, iterable, ctx) {
|
|
2517
|
-
const pairs = createPairs(schema, iterable, ctx);
|
|
2825
|
+
const pairs$1 = pairs$2.createPairs(schema, iterable, ctx);
|
|
2518
2826
|
const omap = new YAMLOMap();
|
|
2519
|
-
omap.items = pairs.items;
|
|
2827
|
+
omap.items = pairs$1.items;
|
|
2520
2828
|
return omap;
|
|
2521
2829
|
}
|
|
2522
2830
|
};
|
|
2523
2831
|
|
|
2832
|
+
omap$3.YAMLOMap = YAMLOMap;
|
|
2833
|
+
omap$3.omap = omap$2;
|
|
2834
|
+
|
|
2835
|
+
var schema$4 = {};
|
|
2836
|
+
|
|
2837
|
+
var bool$2 = {};
|
|
2838
|
+
|
|
2839
|
+
var Scalar$6 = Scalar$k;
|
|
2840
|
+
|
|
2524
2841
|
function boolStringify({ value, source }, ctx) {
|
|
2525
2842
|
const boolObj = value ? trueTag : falseTag;
|
|
2526
2843
|
if (source && boolObj.test.test(source))
|
|
@@ -2532,7 +2849,7 @@ const trueTag = {
|
|
|
2532
2849
|
default: true,
|
|
2533
2850
|
tag: 'tag:yaml.org,2002:bool',
|
|
2534
2851
|
test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,
|
|
2535
|
-
resolve: () => new Scalar(true),
|
|
2852
|
+
resolve: () => new Scalar$6.Scalar(true),
|
|
2536
2853
|
stringify: boolStringify
|
|
2537
2854
|
};
|
|
2538
2855
|
const falseTag = {
|
|
@@ -2540,10 +2857,18 @@ const falseTag = {
|
|
|
2540
2857
|
default: true,
|
|
2541
2858
|
tag: 'tag:yaml.org,2002:bool',
|
|
2542
2859
|
test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/i,
|
|
2543
|
-
resolve: () => new Scalar(false),
|
|
2860
|
+
resolve: () => new Scalar$6.Scalar(false),
|
|
2544
2861
|
stringify: boolStringify
|
|
2545
2862
|
};
|
|
2546
2863
|
|
|
2864
|
+
bool$2.falseTag = falseTag;
|
|
2865
|
+
bool$2.trueTag = trueTag;
|
|
2866
|
+
|
|
2867
|
+
var float$3 = {};
|
|
2868
|
+
|
|
2869
|
+
var Scalar$5 = Scalar$k;
|
|
2870
|
+
var stringifyNumber$2 = stringifyNumber$6;
|
|
2871
|
+
|
|
2547
2872
|
const floatNaN = {
|
|
2548
2873
|
identify: value => typeof value === 'number',
|
|
2549
2874
|
default: true,
|
|
@@ -2554,7 +2879,7 @@ const floatNaN = {
|
|
|
2554
2879
|
: str[0] === '-'
|
|
2555
2880
|
? Number.NEGATIVE_INFINITY
|
|
2556
2881
|
: Number.POSITIVE_INFINITY,
|
|
2557
|
-
stringify: stringifyNumber
|
|
2882
|
+
stringify: stringifyNumber$2.stringifyNumber
|
|
2558
2883
|
};
|
|
2559
2884
|
const floatExp = {
|
|
2560
2885
|
identify: value => typeof value === 'number',
|
|
@@ -2565,16 +2890,16 @@ const floatExp = {
|
|
|
2565
2890
|
resolve: (str) => parseFloat(str.replace(/_/g, '')),
|
|
2566
2891
|
stringify(node) {
|
|
2567
2892
|
const num = Number(node.value);
|
|
2568
|
-
return isFinite(num) ? num.toExponential() : stringifyNumber(node);
|
|
2893
|
+
return isFinite(num) ? num.toExponential() : stringifyNumber$2.stringifyNumber(node);
|
|
2569
2894
|
}
|
|
2570
2895
|
};
|
|
2571
|
-
const float = {
|
|
2896
|
+
const float$2 = {
|
|
2572
2897
|
identify: value => typeof value === 'number',
|
|
2573
2898
|
default: true,
|
|
2574
2899
|
tag: 'tag:yaml.org,2002:float',
|
|
2575
2900
|
test: /^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,
|
|
2576
2901
|
resolve(str) {
|
|
2577
|
-
const node = new Scalar(parseFloat(str.replace(/_/g, '')));
|
|
2902
|
+
const node = new Scalar$5.Scalar(parseFloat(str.replace(/_/g, '')));
|
|
2578
2903
|
const dot = str.indexOf('.');
|
|
2579
2904
|
if (dot !== -1) {
|
|
2580
2905
|
const f = str.substring(dot + 1).replace(/_/g, '');
|
|
@@ -2583,9 +2908,17 @@ const float = {
|
|
|
2583
2908
|
}
|
|
2584
2909
|
return node;
|
|
2585
2910
|
},
|
|
2586
|
-
stringify: stringifyNumber
|
|
2911
|
+
stringify: stringifyNumber$2.stringifyNumber
|
|
2587
2912
|
};
|
|
2588
2913
|
|
|
2914
|
+
float$3.float = float$2;
|
|
2915
|
+
float$3.floatExp = floatExp;
|
|
2916
|
+
float$3.floatNaN = floatNaN;
|
|
2917
|
+
|
|
2918
|
+
var int$3 = {};
|
|
2919
|
+
|
|
2920
|
+
var stringifyNumber$1 = stringifyNumber$6;
|
|
2921
|
+
|
|
2589
2922
|
const intIdentify = (value) => typeof value === 'bigint' || Number.isInteger(value);
|
|
2590
2923
|
function intResolve(str, offset, radix, { intAsBigInt }) {
|
|
2591
2924
|
const sign = str[0];
|
|
@@ -2616,7 +2949,7 @@ function intStringify(node, radix, prefix) {
|
|
|
2616
2949
|
const str = value.toString(radix);
|
|
2617
2950
|
return value < 0 ? '-' + prefix + str.substr(1) : prefix + str;
|
|
2618
2951
|
}
|
|
2619
|
-
return stringifyNumber(node);
|
|
2952
|
+
return stringifyNumber$1.stringifyNumber(node);
|
|
2620
2953
|
}
|
|
2621
2954
|
const intBin = {
|
|
2622
2955
|
identify: intIdentify,
|
|
@@ -2636,13 +2969,13 @@ const intOct = {
|
|
|
2636
2969
|
resolve: (str, _onError, opt) => intResolve(str, 1, 8, opt),
|
|
2637
2970
|
stringify: node => intStringify(node, 8, '0')
|
|
2638
2971
|
};
|
|
2639
|
-
const int = {
|
|
2972
|
+
const int$2 = {
|
|
2640
2973
|
identify: intIdentify,
|
|
2641
2974
|
default: true,
|
|
2642
2975
|
tag: 'tag:yaml.org,2002:int',
|
|
2643
2976
|
test: /^[-+]?[0-9][0-9_]*$/,
|
|
2644
2977
|
resolve: (str, _onError, opt) => intResolve(str, 0, 10, opt),
|
|
2645
|
-
stringify: stringifyNumber
|
|
2978
|
+
stringify: stringifyNumber$1.stringifyNumber
|
|
2646
2979
|
};
|
|
2647
2980
|
const intHex = {
|
|
2648
2981
|
identify: intIdentify,
|
|
@@ -2654,23 +2987,34 @@ const intHex = {
|
|
|
2654
2987
|
stringify: node => intStringify(node, 16, '0x')
|
|
2655
2988
|
};
|
|
2656
2989
|
|
|
2657
|
-
|
|
2990
|
+
int$3.int = int$2;
|
|
2991
|
+
int$3.intBin = intBin;
|
|
2992
|
+
int$3.intHex = intHex;
|
|
2993
|
+
int$3.intOct = intOct;
|
|
2994
|
+
|
|
2995
|
+
var set$3 = {};
|
|
2996
|
+
|
|
2997
|
+
var Node$9 = Node$t;
|
|
2998
|
+
var Pair$4 = Pair$9;
|
|
2999
|
+
var YAMLMap$3 = YAMLMap$7;
|
|
3000
|
+
|
|
3001
|
+
class YAMLSet extends YAMLMap$3.YAMLMap {
|
|
2658
3002
|
constructor(schema) {
|
|
2659
3003
|
super(schema);
|
|
2660
3004
|
this.tag = YAMLSet.tag;
|
|
2661
3005
|
}
|
|
2662
3006
|
add(key) {
|
|
2663
3007
|
let pair;
|
|
2664
|
-
if (isPair(key))
|
|
3008
|
+
if (Node$9.isPair(key))
|
|
2665
3009
|
pair = key;
|
|
2666
3010
|
else if (typeof key === 'object' &&
|
|
2667
3011
|
'key' in key &&
|
|
2668
3012
|
'value' in key &&
|
|
2669
3013
|
key.value === null)
|
|
2670
|
-
pair = new Pair(key.key, null);
|
|
3014
|
+
pair = new Pair$4.Pair(key.key, null);
|
|
2671
3015
|
else
|
|
2672
|
-
pair = new Pair(key, null);
|
|
2673
|
-
const prev = findPair(this.items, pair.key);
|
|
3016
|
+
pair = new Pair$4.Pair(key, null);
|
|
3017
|
+
const prev = YAMLMap$3.findPair(this.items, pair.key);
|
|
2674
3018
|
if (!prev)
|
|
2675
3019
|
this.items.push(pair);
|
|
2676
3020
|
}
|
|
@@ -2679,9 +3023,9 @@ class YAMLSet extends YAMLMap {
|
|
|
2679
3023
|
* Otherwise, returns the value of that Pair's key.
|
|
2680
3024
|
*/
|
|
2681
3025
|
get(key, keepPair) {
|
|
2682
|
-
const pair = findPair(this.items, key);
|
|
2683
|
-
return !keepPair && isPair(pair)
|
|
2684
|
-
? isScalar
|
|
3026
|
+
const pair = YAMLMap$3.findPair(this.items, key);
|
|
3027
|
+
return !keepPair && Node$9.isPair(pair)
|
|
3028
|
+
? Node$9.isScalar(pair.key)
|
|
2685
3029
|
? pair.key.value
|
|
2686
3030
|
: pair.key
|
|
2687
3031
|
: pair;
|
|
@@ -2689,12 +3033,12 @@ class YAMLSet extends YAMLMap {
|
|
|
2689
3033
|
set(key, value) {
|
|
2690
3034
|
if (typeof value !== 'boolean')
|
|
2691
3035
|
throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof value}`);
|
|
2692
|
-
const prev = findPair(this.items, key);
|
|
3036
|
+
const prev = YAMLMap$3.findPair(this.items, key);
|
|
2693
3037
|
if (prev && !value) {
|
|
2694
3038
|
this.items.splice(this.items.indexOf(prev), 1);
|
|
2695
3039
|
}
|
|
2696
3040
|
else if (!prev && value) {
|
|
2697
|
-
this.items.push(new Pair(key));
|
|
3041
|
+
this.items.push(new Pair$4.Pair(key));
|
|
2698
3042
|
}
|
|
2699
3043
|
}
|
|
2700
3044
|
toJSON(_, ctx) {
|
|
@@ -2710,14 +3054,14 @@ class YAMLSet extends YAMLMap {
|
|
|
2710
3054
|
}
|
|
2711
3055
|
}
|
|
2712
3056
|
YAMLSet.tag = 'tag:yaml.org,2002:set';
|
|
2713
|
-
const set = {
|
|
3057
|
+
const set$2 = {
|
|
2714
3058
|
collection: 'map',
|
|
2715
3059
|
identify: value => value instanceof Set,
|
|
2716
3060
|
nodeClass: YAMLSet,
|
|
2717
3061
|
default: false,
|
|
2718
3062
|
tag: 'tag:yaml.org,2002:set',
|
|
2719
3063
|
resolve(map, onError) {
|
|
2720
|
-
if (isMap(map)) {
|
|
3064
|
+
if (Node$9.isMap(map)) {
|
|
2721
3065
|
if (map.hasAllNullValues(true))
|
|
2722
3066
|
return Object.assign(new YAMLSet(), map);
|
|
2723
3067
|
else
|
|
@@ -2734,12 +3078,19 @@ const set = {
|
|
|
2734
3078
|
for (let value of iterable) {
|
|
2735
3079
|
if (typeof replacer === 'function')
|
|
2736
3080
|
value = replacer.call(iterable, value, value);
|
|
2737
|
-
set.items.push(createPair(value, null, ctx));
|
|
3081
|
+
set.items.push(Pair$4.createPair(value, null, ctx));
|
|
2738
3082
|
}
|
|
2739
3083
|
return set;
|
|
2740
3084
|
}
|
|
2741
3085
|
};
|
|
2742
3086
|
|
|
3087
|
+
set$3.YAMLSet = YAMLSet;
|
|
3088
|
+
set$3.set = set$2;
|
|
3089
|
+
|
|
3090
|
+
var timestamp$3 = {};
|
|
3091
|
+
|
|
3092
|
+
var stringifyNumber = stringifyNumber$6;
|
|
3093
|
+
|
|
2743
3094
|
/** Internal types handle bigint as number, because TS can't figure it out. */
|
|
2744
3095
|
function parseSexagesimal(str, asBigInt) {
|
|
2745
3096
|
const sign = str[0];
|
|
@@ -2762,7 +3113,7 @@ function stringifySexagesimal(node) {
|
|
|
2762
3113
|
if (typeof value === 'bigint')
|
|
2763
3114
|
num = n => BigInt(n);
|
|
2764
3115
|
else if (isNaN(value) || !isFinite(value))
|
|
2765
|
-
return stringifyNumber(node);
|
|
3116
|
+
return stringifyNumber.stringifyNumber(node);
|
|
2766
3117
|
let sign = '';
|
|
2767
3118
|
if (value < 0) {
|
|
2768
3119
|
sign = '-';
|
|
@@ -2806,7 +3157,7 @@ const floatTime = {
|
|
|
2806
3157
|
resolve: str => parseSexagesimal(str, false),
|
|
2807
3158
|
stringify: stringifySexagesimal
|
|
2808
3159
|
};
|
|
2809
|
-
const timestamp = {
|
|
3160
|
+
const timestamp$2 = {
|
|
2810
3161
|
identify: value => value instanceof Date,
|
|
2811
3162
|
default: true,
|
|
2812
3163
|
tag: 'tag:yaml.org,2002:timestamp',
|
|
@@ -2820,7 +3171,7 @@ const timestamp = {
|
|
|
2820
3171
|
'(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?' + // Z | +5 | -03:30
|
|
2821
3172
|
')?$'),
|
|
2822
3173
|
resolve(str) {
|
|
2823
|
-
const match = str.match(timestamp.test);
|
|
3174
|
+
const match = str.match(timestamp$2.test);
|
|
2824
3175
|
if (!match)
|
|
2825
3176
|
throw new Error('!!timestamp expects a date, starting with yyyy-mm-dd');
|
|
2826
3177
|
const [, year, month, day, hour, minute, second] = match.map(Number);
|
|
@@ -2838,61 +3189,96 @@ const timestamp = {
|
|
|
2838
3189
|
stringify: ({ value }) => value.toISOString().replace(/((T00:00)?:00)?\.000Z$/, '')
|
|
2839
3190
|
};
|
|
2840
3191
|
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
3192
|
+
timestamp$3.floatTime = floatTime;
|
|
3193
|
+
timestamp$3.intTime = intTime;
|
|
3194
|
+
timestamp$3.timestamp = timestamp$2;
|
|
3195
|
+
|
|
3196
|
+
var map$2 = map$6;
|
|
3197
|
+
var _null$1 = _null$3;
|
|
3198
|
+
var seq$2 = seq$6;
|
|
3199
|
+
var string$2 = string$5;
|
|
3200
|
+
var binary$1 = binary$3;
|
|
3201
|
+
var bool$1 = bool$2;
|
|
3202
|
+
var float$1 = float$3;
|
|
3203
|
+
var int$1 = int$3;
|
|
3204
|
+
var omap$1 = omap$3;
|
|
3205
|
+
var pairs$1 = pairs$4;
|
|
3206
|
+
var set$1 = set$3;
|
|
3207
|
+
var timestamp$1 = timestamp$3;
|
|
3208
|
+
|
|
3209
|
+
const schema$3 = [
|
|
3210
|
+
map$2.map,
|
|
3211
|
+
seq$2.seq,
|
|
3212
|
+
string$2.string,
|
|
3213
|
+
_null$1.nullTag,
|
|
3214
|
+
bool$1.trueTag,
|
|
3215
|
+
bool$1.falseTag,
|
|
3216
|
+
int$1.intBin,
|
|
3217
|
+
int$1.intOct,
|
|
3218
|
+
int$1.int,
|
|
3219
|
+
int$1.intHex,
|
|
3220
|
+
float$1.floatNaN,
|
|
3221
|
+
float$1.floatExp,
|
|
3222
|
+
float$1.float,
|
|
3223
|
+
binary$1.binary,
|
|
3224
|
+
omap$1.omap,
|
|
3225
|
+
pairs$1.pairs,
|
|
3226
|
+
set$1.set,
|
|
3227
|
+
timestamp$1.intTime,
|
|
3228
|
+
timestamp$1.floatTime,
|
|
3229
|
+
timestamp$1.timestamp
|
|
2862
3230
|
];
|
|
2863
3231
|
|
|
3232
|
+
schema$4.schema = schema$3;
|
|
3233
|
+
|
|
3234
|
+
var map$1 = map$6;
|
|
3235
|
+
var _null = _null$3;
|
|
3236
|
+
var seq$1 = seq$6;
|
|
3237
|
+
var string$1 = string$5;
|
|
3238
|
+
var bool = bool$4;
|
|
3239
|
+
var float = float$6;
|
|
3240
|
+
var int = int$6;
|
|
3241
|
+
var schema = schema$8;
|
|
3242
|
+
var schema$1 = schema$6;
|
|
3243
|
+
var binary = binary$3;
|
|
3244
|
+
var omap = omap$3;
|
|
3245
|
+
var pairs = pairs$4;
|
|
3246
|
+
var schema$2 = schema$4;
|
|
3247
|
+
var set = set$3;
|
|
3248
|
+
var timestamp = timestamp$3;
|
|
3249
|
+
|
|
2864
3250
|
const schemas = new Map([
|
|
2865
|
-
['core', schema
|
|
2866
|
-
['failsafe', [map, seq, string]],
|
|
2867
|
-
['json', schema$1],
|
|
2868
|
-
['yaml11', schema],
|
|
2869
|
-
['yaml-1.1', schema]
|
|
3251
|
+
['core', schema.schema],
|
|
3252
|
+
['failsafe', [map$1.map, seq$1.seq, string$1.string]],
|
|
3253
|
+
['json', schema$1.schema],
|
|
3254
|
+
['yaml11', schema$2.schema],
|
|
3255
|
+
['yaml-1.1', schema$2.schema]
|
|
2870
3256
|
]);
|
|
2871
3257
|
const tagsByName = {
|
|
2872
|
-
binary,
|
|
2873
|
-
bool: boolTag,
|
|
2874
|
-
float: float
|
|
2875
|
-
floatExp: floatExp
|
|
2876
|
-
floatNaN: floatNaN
|
|
2877
|
-
floatTime,
|
|
2878
|
-
int: int
|
|
2879
|
-
intHex: intHex
|
|
2880
|
-
intOct: intOct
|
|
2881
|
-
intTime,
|
|
2882
|
-
map,
|
|
2883
|
-
null: nullTag,
|
|
2884
|
-
omap,
|
|
2885
|
-
pairs,
|
|
2886
|
-
seq,
|
|
2887
|
-
set,
|
|
2888
|
-
timestamp
|
|
3258
|
+
binary: binary.binary,
|
|
3259
|
+
bool: bool.boolTag,
|
|
3260
|
+
float: float.float,
|
|
3261
|
+
floatExp: float.floatExp,
|
|
3262
|
+
floatNaN: float.floatNaN,
|
|
3263
|
+
floatTime: timestamp.floatTime,
|
|
3264
|
+
int: int.int,
|
|
3265
|
+
intHex: int.intHex,
|
|
3266
|
+
intOct: int.intOct,
|
|
3267
|
+
intTime: timestamp.intTime,
|
|
3268
|
+
map: map$1.map,
|
|
3269
|
+
null: _null.nullTag,
|
|
3270
|
+
omap: omap.omap,
|
|
3271
|
+
pairs: pairs.pairs,
|
|
3272
|
+
seq: seq$1.seq,
|
|
3273
|
+
set: set.set,
|
|
3274
|
+
timestamp: timestamp.timestamp
|
|
2889
3275
|
};
|
|
2890
3276
|
const coreKnownTags = {
|
|
2891
|
-
'tag:yaml.org,2002:binary': binary,
|
|
2892
|
-
'tag:yaml.org,2002:omap': omap,
|
|
2893
|
-
'tag:yaml.org,2002:pairs': pairs,
|
|
2894
|
-
'tag:yaml.org,2002:set': set,
|
|
2895
|
-
'tag:yaml.org,2002:timestamp': timestamp
|
|
3277
|
+
'tag:yaml.org,2002:binary': binary.binary,
|
|
3278
|
+
'tag:yaml.org,2002:omap': omap.omap,
|
|
3279
|
+
'tag:yaml.org,2002:pairs': pairs.pairs,
|
|
3280
|
+
'tag:yaml.org,2002:set': set.set,
|
|
3281
|
+
'tag:yaml.org,2002:timestamp': timestamp.timestamp
|
|
2896
3282
|
};
|
|
2897
3283
|
function getTags(customTags, schemaName) {
|
|
2898
3284
|
let tags = schemas.get(schemaName);
|
|
@@ -2927,22 +3313,31 @@ function getTags(customTags, schemaName) {
|
|
|
2927
3313
|
});
|
|
2928
3314
|
}
|
|
2929
3315
|
|
|
3316
|
+
tags$1.coreKnownTags = coreKnownTags;
|
|
3317
|
+
tags$1.getTags = getTags;
|
|
3318
|
+
|
|
3319
|
+
var Node$8 = Node$t;
|
|
3320
|
+
var map = map$6;
|
|
3321
|
+
var seq = seq$6;
|
|
3322
|
+
var string = string$5;
|
|
3323
|
+
var tags = tags$1;
|
|
3324
|
+
|
|
2930
3325
|
const sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
|
|
2931
|
-
class Schema {
|
|
3326
|
+
class Schema$2 {
|
|
2932
3327
|
constructor({ compat, customTags, merge, resolveKnownTags, schema, sortMapEntries, toStringDefaults }) {
|
|
2933
3328
|
this.compat = Array.isArray(compat)
|
|
2934
|
-
? getTags(compat, 'compat')
|
|
3329
|
+
? tags.getTags(compat, 'compat')
|
|
2935
3330
|
: compat
|
|
2936
|
-
? getTags(null, compat)
|
|
3331
|
+
? tags.getTags(null, compat)
|
|
2937
3332
|
: null;
|
|
2938
3333
|
this.merge = !!merge;
|
|
2939
3334
|
this.name = (typeof schema === 'string' && schema) || 'core';
|
|
2940
|
-
this.knownTags = resolveKnownTags ? coreKnownTags : {};
|
|
2941
|
-
this.tags = getTags(customTags, this.name);
|
|
3335
|
+
this.knownTags = resolveKnownTags ? tags.coreKnownTags : {};
|
|
3336
|
+
this.tags = tags.getTags(customTags, this.name);
|
|
2942
3337
|
this.toStringOptions = toStringDefaults ?? null;
|
|
2943
|
-
Object.defineProperty(this, MAP, { value: map });
|
|
2944
|
-
Object.defineProperty(this, SCALAR
|
|
2945
|
-
Object.defineProperty(this, SEQ, { value: seq });
|
|
3338
|
+
Object.defineProperty(this, Node$8.MAP, { value: map.map });
|
|
3339
|
+
Object.defineProperty(this, Node$8.SCALAR, { value: string.string });
|
|
3340
|
+
Object.defineProperty(this, Node$8.SEQ, { value: seq.seq });
|
|
2946
3341
|
// Used by createMap()
|
|
2947
3342
|
this.sortMapEntries =
|
|
2948
3343
|
typeof sortMapEntries === 'function'
|
|
@@ -2952,13 +3347,21 @@ class Schema {
|
|
|
2952
3347
|
: null;
|
|
2953
3348
|
}
|
|
2954
3349
|
clone() {
|
|
2955
|
-
const copy = Object.create(Schema.prototype, Object.getOwnPropertyDescriptors(this));
|
|
3350
|
+
const copy = Object.create(Schema$2.prototype, Object.getOwnPropertyDescriptors(this));
|
|
2956
3351
|
copy.tags = this.tags.slice();
|
|
2957
3352
|
return copy;
|
|
2958
3353
|
}
|
|
2959
3354
|
}
|
|
2960
3355
|
|
|
2961
|
-
|
|
3356
|
+
Schema$3.Schema = Schema$2;
|
|
3357
|
+
|
|
3358
|
+
var stringifyDocument$2 = {};
|
|
3359
|
+
|
|
3360
|
+
var Node$7 = Node$t;
|
|
3361
|
+
var stringify$4 = stringify$9;
|
|
3362
|
+
var stringifyComment = stringifyComment$5;
|
|
3363
|
+
|
|
3364
|
+
function stringifyDocument$1(doc, options) {
|
|
2962
3365
|
const lines = [];
|
|
2963
3366
|
let hasDirectives = options.directives === true;
|
|
2964
3367
|
if (options.directives !== false && doc.directives) {
|
|
@@ -2972,32 +3375,32 @@ function stringifyDocument(doc, options) {
|
|
|
2972
3375
|
}
|
|
2973
3376
|
if (hasDirectives)
|
|
2974
3377
|
lines.push('---');
|
|
2975
|
-
const ctx = createStringifyContext(doc, options);
|
|
3378
|
+
const ctx = stringify$4.createStringifyContext(doc, options);
|
|
2976
3379
|
const { commentString } = ctx.options;
|
|
2977
3380
|
if (doc.commentBefore) {
|
|
2978
3381
|
if (lines.length !== 1)
|
|
2979
3382
|
lines.unshift('');
|
|
2980
3383
|
const cs = commentString(doc.commentBefore);
|
|
2981
|
-
lines.unshift(indentComment(cs, ''));
|
|
3384
|
+
lines.unshift(stringifyComment.indentComment(cs, ''));
|
|
2982
3385
|
}
|
|
2983
3386
|
let chompKeep = false;
|
|
2984
3387
|
let contentComment = null;
|
|
2985
3388
|
if (doc.contents) {
|
|
2986
|
-
if (isNode(doc.contents)) {
|
|
3389
|
+
if (Node$7.isNode(doc.contents)) {
|
|
2987
3390
|
if (doc.contents.spaceBefore && hasDirectives)
|
|
2988
3391
|
lines.push('');
|
|
2989
3392
|
if (doc.contents.commentBefore) {
|
|
2990
3393
|
const cs = commentString(doc.contents.commentBefore);
|
|
2991
|
-
lines.push(indentComment(cs, ''));
|
|
3394
|
+
lines.push(stringifyComment.indentComment(cs, ''));
|
|
2992
3395
|
}
|
|
2993
3396
|
// top-level block scalars need to be indented if followed by a comment
|
|
2994
3397
|
ctx.forceBlockIndent = !!doc.comment;
|
|
2995
3398
|
contentComment = doc.contents.comment;
|
|
2996
3399
|
}
|
|
2997
3400
|
const onChompKeep = contentComment ? undefined : () => (chompKeep = true);
|
|
2998
|
-
let body = stringify$
|
|
3401
|
+
let body = stringify$4.stringify(doc.contents, ctx, () => (contentComment = null), onChompKeep);
|
|
2999
3402
|
if (contentComment)
|
|
3000
|
-
body += lineComment(body, '', commentString(contentComment));
|
|
3403
|
+
body += stringifyComment.lineComment(body, '', commentString(contentComment));
|
|
3001
3404
|
if ((body[0] === '|' || body[0] === '>') &&
|
|
3002
3405
|
lines[lines.length - 1] === '---') {
|
|
3003
3406
|
// Top-level block scalars with a preceding doc marker ought to use the
|
|
@@ -3008,14 +3411,14 @@ function stringifyDocument(doc, options) {
|
|
|
3008
3411
|
lines.push(body);
|
|
3009
3412
|
}
|
|
3010
3413
|
else {
|
|
3011
|
-
lines.push(stringify$
|
|
3414
|
+
lines.push(stringify$4.stringify(doc.contents, ctx));
|
|
3012
3415
|
}
|
|
3013
3416
|
if (doc.directives?.docEnd) {
|
|
3014
3417
|
if (doc.comment) {
|
|
3015
3418
|
const cs = commentString(doc.comment);
|
|
3016
3419
|
if (cs.includes('\n')) {
|
|
3017
3420
|
lines.push('...');
|
|
3018
|
-
lines.push(indentComment(cs, ''));
|
|
3421
|
+
lines.push(stringifyComment.indentComment(cs, ''));
|
|
3019
3422
|
}
|
|
3020
3423
|
else {
|
|
3021
3424
|
lines.push(`... ${cs}`);
|
|
@@ -3032,12 +3435,16 @@ function stringifyDocument(doc, options) {
|
|
|
3032
3435
|
if (dc) {
|
|
3033
3436
|
if ((!chompKeep || contentComment) && lines[lines.length - 1] !== '')
|
|
3034
3437
|
lines.push('');
|
|
3035
|
-
lines.push(indentComment(commentString(dc), ''));
|
|
3438
|
+
lines.push(stringifyComment.indentComment(commentString(dc), ''));
|
|
3036
3439
|
}
|
|
3037
3440
|
}
|
|
3038
3441
|
return lines.join('\n') + '\n';
|
|
3039
3442
|
}
|
|
3040
3443
|
|
|
3444
|
+
stringifyDocument$2.stringifyDocument = stringifyDocument$1;
|
|
3445
|
+
|
|
3446
|
+
var applyReviver$2 = {};
|
|
3447
|
+
|
|
3041
3448
|
/**
|
|
3042
3449
|
* Applies the JSON.parse reviver algorithm as defined in the ECMA-262 spec,
|
|
3043
3450
|
* in section 24.5.1.1 "Runtime Semantics: InternalizeJSONProperty" of the
|
|
@@ -3045,12 +3452,12 @@ function stringifyDocument(doc, options) {
|
|
|
3045
3452
|
*
|
|
3046
3453
|
* Includes extensions for handling Map and Set objects.
|
|
3047
3454
|
*/
|
|
3048
|
-
function applyReviver(reviver, obj, key, val) {
|
|
3455
|
+
function applyReviver$1(reviver, obj, key, val) {
|
|
3049
3456
|
if (val && typeof val === 'object') {
|
|
3050
3457
|
if (Array.isArray(val)) {
|
|
3051
3458
|
for (let i = 0, len = val.length; i < len; ++i) {
|
|
3052
3459
|
const v0 = val[i];
|
|
3053
|
-
const v1 = applyReviver(reviver, val, String(i), v0);
|
|
3460
|
+
const v1 = applyReviver$1(reviver, val, String(i), v0);
|
|
3054
3461
|
if (v1 === undefined)
|
|
3055
3462
|
delete val[i];
|
|
3056
3463
|
else if (v1 !== v0)
|
|
@@ -3060,7 +3467,7 @@ function applyReviver(reviver, obj, key, val) {
|
|
|
3060
3467
|
else if (val instanceof Map) {
|
|
3061
3468
|
for (const k of Array.from(val.keys())) {
|
|
3062
3469
|
const v0 = val.get(k);
|
|
3063
|
-
const v1 = applyReviver(reviver, val, k, v0);
|
|
3470
|
+
const v1 = applyReviver$1(reviver, val, k, v0);
|
|
3064
3471
|
if (v1 === undefined)
|
|
3065
3472
|
val.delete(k);
|
|
3066
3473
|
else if (v1 !== v0)
|
|
@@ -3069,7 +3476,7 @@ function applyReviver(reviver, obj, key, val) {
|
|
|
3069
3476
|
}
|
|
3070
3477
|
else if (val instanceof Set) {
|
|
3071
3478
|
for (const v0 of Array.from(val)) {
|
|
3072
|
-
const v1 = applyReviver(reviver, val, v0, v0);
|
|
3479
|
+
const v1 = applyReviver$1(reviver, val, v0, v0);
|
|
3073
3480
|
if (v1 === undefined)
|
|
3074
3481
|
val.delete(v0);
|
|
3075
3482
|
else if (v1 !== v0) {
|
|
@@ -3080,7 +3487,7 @@ function applyReviver(reviver, obj, key, val) {
|
|
|
3080
3487
|
}
|
|
3081
3488
|
else {
|
|
3082
3489
|
for (const [k, v0] of Object.entries(val)) {
|
|
3083
|
-
const v1 = applyReviver(reviver, val, k, v0);
|
|
3490
|
+
const v1 = applyReviver$1(reviver, val, k, v0);
|
|
3084
3491
|
if (v1 === undefined)
|
|
3085
3492
|
delete val[k];
|
|
3086
3493
|
else if (v1 !== v0)
|
|
@@ -3091,7 +3498,22 @@ function applyReviver(reviver, obj, key, val) {
|
|
|
3091
3498
|
return reviver.call(obj, key, val);
|
|
3092
3499
|
}
|
|
3093
3500
|
|
|
3094
|
-
|
|
3501
|
+
applyReviver$2.applyReviver = applyReviver$1;
|
|
3502
|
+
|
|
3503
|
+
var Alias$2 = Alias$5;
|
|
3504
|
+
var Collection = Collection$5;
|
|
3505
|
+
var Node$6 = Node$t;
|
|
3506
|
+
var Pair$3 = Pair$9;
|
|
3507
|
+
var toJS = toJS$6;
|
|
3508
|
+
var Schema$1 = Schema$3;
|
|
3509
|
+
var stringify$3 = stringify$9;
|
|
3510
|
+
var stringifyDocument = stringifyDocument$2;
|
|
3511
|
+
var anchors = anchors$3;
|
|
3512
|
+
var applyReviver = applyReviver$2;
|
|
3513
|
+
var createNode = createNode$5;
|
|
3514
|
+
var directives$1 = directives$2;
|
|
3515
|
+
|
|
3516
|
+
class Document$4 {
|
|
3095
3517
|
constructor(value, replacer, options) {
|
|
3096
3518
|
/** A comment before this Document */
|
|
3097
3519
|
this.commentBefore = null;
|
|
@@ -3101,7 +3523,7 @@ class Document {
|
|
|
3101
3523
|
this.errors = [];
|
|
3102
3524
|
/** Warnings encountered during parsing. */
|
|
3103
3525
|
this.warnings = [];
|
|
3104
|
-
Object.defineProperty(this, NODE_TYPE, { value: DOC });
|
|
3526
|
+
Object.defineProperty(this, Node$6.NODE_TYPE, { value: Node$6.DOC });
|
|
3105
3527
|
let _replacer = null;
|
|
3106
3528
|
if (typeof replacer === 'function' || Array.isArray(replacer)) {
|
|
3107
3529
|
_replacer = replacer;
|
|
@@ -3127,7 +3549,7 @@ class Document {
|
|
|
3127
3549
|
version = this.directives.yaml.version;
|
|
3128
3550
|
}
|
|
3129
3551
|
else
|
|
3130
|
-
this.directives = new Directives({ version });
|
|
3552
|
+
this.directives = new directives$1.Directives({ version });
|
|
3131
3553
|
this.setSchema(version, options);
|
|
3132
3554
|
if (value === undefined)
|
|
3133
3555
|
this.contents = null;
|
|
@@ -3141,8 +3563,8 @@ class Document {
|
|
|
3141
3563
|
* Custom Node values that inherit from `Object` still refer to their original instances.
|
|
3142
3564
|
*/
|
|
3143
3565
|
clone() {
|
|
3144
|
-
const copy = Object.create(Document.prototype, {
|
|
3145
|
-
[NODE_TYPE]: { value: DOC }
|
|
3566
|
+
const copy = Object.create(Document$4.prototype, {
|
|
3567
|
+
[Node$6.NODE_TYPE]: { value: Node$6.DOC }
|
|
3146
3568
|
});
|
|
3147
3569
|
copy.commentBefore = this.commentBefore;
|
|
3148
3570
|
copy.comment = this.comment;
|
|
@@ -3152,7 +3574,7 @@ class Document {
|
|
|
3152
3574
|
if (this.directives)
|
|
3153
3575
|
copy.directives = this.directives.clone();
|
|
3154
3576
|
copy.schema = this.schema.clone();
|
|
3155
|
-
copy.contents = isNode(this.contents)
|
|
3577
|
+
copy.contents = Node$6.isNode(this.contents)
|
|
3156
3578
|
? this.contents.clone(copy.schema)
|
|
3157
3579
|
: this.contents;
|
|
3158
3580
|
if (this.range)
|
|
@@ -3180,12 +3602,12 @@ class Document {
|
|
|
3180
3602
|
*/
|
|
3181
3603
|
createAlias(node, name) {
|
|
3182
3604
|
if (!node.anchor) {
|
|
3183
|
-
const prev = anchorNames(this);
|
|
3605
|
+
const prev = anchors.anchorNames(this);
|
|
3184
3606
|
node.anchor =
|
|
3185
3607
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
3186
|
-
!name || prev.has(name) ? findNewAnchor(name || 'a', prev) : name;
|
|
3608
|
+
!name || prev.has(name) ? anchors.findNewAnchor(name || 'a', prev) : name;
|
|
3187
3609
|
}
|
|
3188
|
-
return new Alias(node.anchor);
|
|
3610
|
+
return new Alias$2.Alias(node.anchor);
|
|
3189
3611
|
}
|
|
3190
3612
|
createNode(value, replacer, options) {
|
|
3191
3613
|
let _replacer = undefined;
|
|
@@ -3205,7 +3627,7 @@ class Document {
|
|
|
3205
3627
|
replacer = undefined;
|
|
3206
3628
|
}
|
|
3207
3629
|
const { aliasDuplicateObjects, anchorPrefix, flow, keepUndefined, onTagObj, tag } = options ?? {};
|
|
3208
|
-
const { onAnchor, setAnchors, sourceObjects } = createNodeAnchors(this,
|
|
3630
|
+
const { onAnchor, setAnchors, sourceObjects } = anchors.createNodeAnchors(this,
|
|
3209
3631
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
3210
3632
|
anchorPrefix || 'a');
|
|
3211
3633
|
const ctx = {
|
|
@@ -3217,8 +3639,8 @@ class Document {
|
|
|
3217
3639
|
schema: this.schema,
|
|
3218
3640
|
sourceObjects
|
|
3219
3641
|
};
|
|
3220
|
-
const node = createNode(value, tag, ctx);
|
|
3221
|
-
if (flow && isCollection
|
|
3642
|
+
const node = createNode.createNode(value, tag, ctx);
|
|
3643
|
+
if (flow && Node$6.isCollection(node))
|
|
3222
3644
|
node.flow = true;
|
|
3223
3645
|
setAnchors();
|
|
3224
3646
|
return node;
|
|
@@ -3230,7 +3652,7 @@ class Document {
|
|
|
3230
3652
|
createPair(key, value, options = {}) {
|
|
3231
3653
|
const k = this.createNode(key, null, options);
|
|
3232
3654
|
const v = this.createNode(value, null, options);
|
|
3233
|
-
return new Pair(k, v);
|
|
3655
|
+
return new Pair$3.Pair(k, v);
|
|
3234
3656
|
}
|
|
3235
3657
|
/**
|
|
3236
3658
|
* Removes a value from the document.
|
|
@@ -3244,7 +3666,7 @@ class Document {
|
|
|
3244
3666
|
* @returns `true` if the item was found and removed.
|
|
3245
3667
|
*/
|
|
3246
3668
|
deleteIn(path) {
|
|
3247
|
-
if (isEmptyPath(path)) {
|
|
3669
|
+
if (Collection.isEmptyPath(path)) {
|
|
3248
3670
|
if (this.contents == null)
|
|
3249
3671
|
return false;
|
|
3250
3672
|
this.contents = null;
|
|
@@ -3260,7 +3682,7 @@ class Document {
|
|
|
3260
3682
|
* `true` (collections are always returned intact).
|
|
3261
3683
|
*/
|
|
3262
3684
|
get(key, keepScalar) {
|
|
3263
|
-
return isCollection
|
|
3685
|
+
return Node$6.isCollection(this.contents)
|
|
3264
3686
|
? this.contents.get(key, keepScalar)
|
|
3265
3687
|
: undefined;
|
|
3266
3688
|
}
|
|
@@ -3270,11 +3692,11 @@ class Document {
|
|
|
3270
3692
|
* `true` (collections are always returned intact).
|
|
3271
3693
|
*/
|
|
3272
3694
|
getIn(path, keepScalar) {
|
|
3273
|
-
if (isEmptyPath(path))
|
|
3274
|
-
return !keepScalar && isScalar
|
|
3695
|
+
if (Collection.isEmptyPath(path))
|
|
3696
|
+
return !keepScalar && Node$6.isScalar(this.contents)
|
|
3275
3697
|
? this.contents.value
|
|
3276
3698
|
: this.contents;
|
|
3277
|
-
return isCollection
|
|
3699
|
+
return Node$6.isCollection(this.contents)
|
|
3278
3700
|
? this.contents.getIn(path, keepScalar)
|
|
3279
3701
|
: undefined;
|
|
3280
3702
|
}
|
|
@@ -3282,15 +3704,15 @@ class Document {
|
|
|
3282
3704
|
* Checks if the document includes a value with the key `key`.
|
|
3283
3705
|
*/
|
|
3284
3706
|
has(key) {
|
|
3285
|
-
return isCollection
|
|
3707
|
+
return Node$6.isCollection(this.contents) ? this.contents.has(key) : false;
|
|
3286
3708
|
}
|
|
3287
3709
|
/**
|
|
3288
3710
|
* Checks if the document includes a value at `path`.
|
|
3289
3711
|
*/
|
|
3290
3712
|
hasIn(path) {
|
|
3291
|
-
if (isEmptyPath(path))
|
|
3713
|
+
if (Collection.isEmptyPath(path))
|
|
3292
3714
|
return this.contents !== undefined;
|
|
3293
|
-
return isCollection
|
|
3715
|
+
return Node$6.isCollection(this.contents) ? this.contents.hasIn(path) : false;
|
|
3294
3716
|
}
|
|
3295
3717
|
/**
|
|
3296
3718
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -3298,7 +3720,7 @@ class Document {
|
|
|
3298
3720
|
*/
|
|
3299
3721
|
set(key, value) {
|
|
3300
3722
|
if (this.contents == null) {
|
|
3301
|
-
this.contents = collectionFromPath(this.schema, [key], value);
|
|
3723
|
+
this.contents = Collection.collectionFromPath(this.schema, [key], value);
|
|
3302
3724
|
}
|
|
3303
3725
|
else if (assertCollection(this.contents)) {
|
|
3304
3726
|
this.contents.set(key, value);
|
|
@@ -3309,10 +3731,10 @@ class Document {
|
|
|
3309
3731
|
* boolean to add/remove the item from the set.
|
|
3310
3732
|
*/
|
|
3311
3733
|
setIn(path, value) {
|
|
3312
|
-
if (isEmptyPath(path))
|
|
3734
|
+
if (Collection.isEmptyPath(path))
|
|
3313
3735
|
this.contents = value;
|
|
3314
3736
|
else if (this.contents == null) {
|
|
3315
|
-
this.contents = collectionFromPath(this.schema, Array.from(path), value);
|
|
3737
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path), value);
|
|
3316
3738
|
}
|
|
3317
3739
|
else if (assertCollection(this.contents)) {
|
|
3318
3740
|
this.contents.setIn(path, value);
|
|
@@ -3334,7 +3756,7 @@ class Document {
|
|
|
3334
3756
|
if (this.directives)
|
|
3335
3757
|
this.directives.yaml.version = '1.1';
|
|
3336
3758
|
else
|
|
3337
|
-
this.directives = new Directives({ version: '1.1' });
|
|
3759
|
+
this.directives = new directives$1.Directives({ version: '1.1' });
|
|
3338
3760
|
opt = { merge: true, resolveKnownTags: false, schema: 'yaml-1.1' };
|
|
3339
3761
|
break;
|
|
3340
3762
|
case '1.2':
|
|
@@ -3342,7 +3764,7 @@ class Document {
|
|
|
3342
3764
|
if (this.directives)
|
|
3343
3765
|
this.directives.yaml.version = version;
|
|
3344
3766
|
else
|
|
3345
|
-
this.directives = new Directives({ version });
|
|
3767
|
+
this.directives = new directives$1.Directives({ version });
|
|
3346
3768
|
opt = { merge: false, resolveKnownTags: true, schema: 'core' };
|
|
3347
3769
|
break;
|
|
3348
3770
|
case null:
|
|
@@ -3359,7 +3781,7 @@ class Document {
|
|
|
3359
3781
|
if (options.schema instanceof Object)
|
|
3360
3782
|
this.schema = options.schema;
|
|
3361
3783
|
else if (opt)
|
|
3362
|
-
this.schema = new Schema(Object.assign(opt, options));
|
|
3784
|
+
this.schema = new Schema$1.Schema(Object.assign(opt, options));
|
|
3363
3785
|
else
|
|
3364
3786
|
throw new Error(`With a null YAML version, the { schema: Schema } option is required`);
|
|
3365
3787
|
}
|
|
@@ -3372,14 +3794,14 @@ class Document {
|
|
|
3372
3794
|
mapAsMap: mapAsMap === true,
|
|
3373
3795
|
mapKeyWarned: false,
|
|
3374
3796
|
maxAliasCount: typeof maxAliasCount === 'number' ? maxAliasCount : 100,
|
|
3375
|
-
stringify: stringify$
|
|
3797
|
+
stringify: stringify$3.stringify
|
|
3376
3798
|
};
|
|
3377
|
-
const res = toJS(this.contents, jsonArg ?? '', ctx);
|
|
3799
|
+
const res = toJS.toJS(this.contents, jsonArg ?? '', ctx);
|
|
3378
3800
|
if (typeof onAnchor === 'function')
|
|
3379
3801
|
for (const { count, res } of ctx.anchors.values())
|
|
3380
3802
|
onAnchor(res, count);
|
|
3381
3803
|
return typeof reviver === 'function'
|
|
3382
|
-
? applyReviver(reviver, { '': res }, '', res)
|
|
3804
|
+
? applyReviver.applyReviver(reviver, { '': res }, '', res)
|
|
3383
3805
|
: res;
|
|
3384
3806
|
}
|
|
3385
3807
|
/**
|
|
@@ -3400,16 +3822,20 @@ class Document {
|
|
|
3400
3822
|
const s = JSON.stringify(options.indent);
|
|
3401
3823
|
throw new Error(`"indent" option must be a positive integer, not ${s}`);
|
|
3402
3824
|
}
|
|
3403
|
-
return stringifyDocument(this, options);
|
|
3825
|
+
return stringifyDocument.stringifyDocument(this, options);
|
|
3404
3826
|
}
|
|
3405
3827
|
}
|
|
3406
3828
|
function assertCollection(contents) {
|
|
3407
|
-
if (isCollection
|
|
3829
|
+
if (Node$6.isCollection(contents))
|
|
3408
3830
|
return true;
|
|
3409
3831
|
throw new Error('Expected a YAML collection as document contents');
|
|
3410
3832
|
}
|
|
3411
3833
|
|
|
3412
|
-
|
|
3834
|
+
Document$5.Document = Document$4;
|
|
3835
|
+
|
|
3836
|
+
var errors$4 = {};
|
|
3837
|
+
|
|
3838
|
+
class YAMLError$1 extends Error {
|
|
3413
3839
|
constructor(name, pos, code, message) {
|
|
3414
3840
|
super();
|
|
3415
3841
|
this.name = name;
|
|
@@ -3418,12 +3844,12 @@ class YAMLError extends Error {
|
|
|
3418
3844
|
this.pos = pos;
|
|
3419
3845
|
}
|
|
3420
3846
|
}
|
|
3421
|
-
class YAMLParseError extends YAMLError {
|
|
3847
|
+
class YAMLParseError$1 extends YAMLError$1 {
|
|
3422
3848
|
constructor(pos, code, message) {
|
|
3423
3849
|
super('YAMLParseError', pos, code, message);
|
|
3424
3850
|
}
|
|
3425
3851
|
}
|
|
3426
|
-
class YAMLWarning extends YAMLError {
|
|
3852
|
+
class YAMLWarning$1 extends YAMLError$1 {
|
|
3427
3853
|
constructor(pos, code, message) {
|
|
3428
3854
|
super('YAMLWarning', pos, code, message);
|
|
3429
3855
|
}
|
|
@@ -3465,7 +3891,22 @@ const prettifyError = (src, lc) => (error) => {
|
|
|
3465
3891
|
}
|
|
3466
3892
|
};
|
|
3467
3893
|
|
|
3468
|
-
|
|
3894
|
+
errors$4.YAMLError = YAMLError$1;
|
|
3895
|
+
errors$4.YAMLParseError = YAMLParseError$1;
|
|
3896
|
+
errors$4.YAMLWarning = YAMLWarning$1;
|
|
3897
|
+
errors$4.prettifyError = prettifyError;
|
|
3898
|
+
|
|
3899
|
+
var composeDoc$2 = {};
|
|
3900
|
+
|
|
3901
|
+
var composeNode$2 = {};
|
|
3902
|
+
|
|
3903
|
+
var composeCollection$2 = {};
|
|
3904
|
+
|
|
3905
|
+
var resolveBlockMap$2 = {};
|
|
3906
|
+
|
|
3907
|
+
var resolveProps$5 = {};
|
|
3908
|
+
|
|
3909
|
+
function resolveProps$4(tokens, { flow, indicator, next, offset, onError, startOnNewline }) {
|
|
3469
3910
|
let spaceBefore = false;
|
|
3470
3911
|
let atNewline = startOnNewline;
|
|
3471
3912
|
let hasSpace = startOnNewline;
|
|
@@ -3598,6 +4039,10 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, startOnN
|
|
|
3598
4039
|
};
|
|
3599
4040
|
}
|
|
3600
4041
|
|
|
4042
|
+
resolveProps$5.resolveProps = resolveProps$4;
|
|
4043
|
+
|
|
4044
|
+
var utilContainsNewline$3 = {};
|
|
4045
|
+
|
|
3601
4046
|
function containsNewline(key) {
|
|
3602
4047
|
if (!key)
|
|
3603
4048
|
return null;
|
|
@@ -3631,18 +4076,30 @@ function containsNewline(key) {
|
|
|
3631
4076
|
}
|
|
3632
4077
|
}
|
|
3633
4078
|
|
|
4079
|
+
utilContainsNewline$3.containsNewline = containsNewline;
|
|
4080
|
+
|
|
4081
|
+
var utilFlowIndentCheck$2 = {};
|
|
4082
|
+
|
|
4083
|
+
var utilContainsNewline$2 = utilContainsNewline$3;
|
|
4084
|
+
|
|
3634
4085
|
function flowIndentCheck(indent, fc, onError) {
|
|
3635
4086
|
if (fc?.type === 'flow-collection') {
|
|
3636
4087
|
const end = fc.end[0];
|
|
3637
4088
|
if (end.indent === indent &&
|
|
3638
4089
|
(end.source === ']' || end.source === '}') &&
|
|
3639
|
-
containsNewline(fc)) {
|
|
4090
|
+
utilContainsNewline$2.containsNewline(fc)) {
|
|
3640
4091
|
const msg = 'Flow end indicator should be more indented than parent';
|
|
3641
4092
|
onError(end, 'BAD_INDENT', msg, true);
|
|
3642
4093
|
}
|
|
3643
4094
|
}
|
|
3644
4095
|
}
|
|
3645
4096
|
|
|
4097
|
+
utilFlowIndentCheck$2.flowIndentCheck = flowIndentCheck;
|
|
4098
|
+
|
|
4099
|
+
var utilMapIncludes$2 = {};
|
|
4100
|
+
|
|
4101
|
+
var Node$5 = Node$t;
|
|
4102
|
+
|
|
3646
4103
|
function mapIncludes(ctx, items, search) {
|
|
3647
4104
|
const { uniqueKeys } = ctx.options;
|
|
3648
4105
|
if (uniqueKeys === false)
|
|
@@ -3650,23 +4107,32 @@ function mapIncludes(ctx, items, search) {
|
|
|
3650
4107
|
const isEqual = typeof uniqueKeys === 'function'
|
|
3651
4108
|
? uniqueKeys
|
|
3652
4109
|
: (a, b) => a === b ||
|
|
3653
|
-
(isScalar
|
|
3654
|
-
isScalar
|
|
4110
|
+
(Node$5.isScalar(a) &&
|
|
4111
|
+
Node$5.isScalar(b) &&
|
|
3655
4112
|
a.value === b.value &&
|
|
3656
4113
|
!(a.value === '<<' && ctx.schema.merge));
|
|
3657
4114
|
return items.some(pair => isEqual(pair.key, search));
|
|
3658
4115
|
}
|
|
3659
4116
|
|
|
4117
|
+
utilMapIncludes$2.mapIncludes = mapIncludes;
|
|
4118
|
+
|
|
4119
|
+
var Pair$2 = Pair$9;
|
|
4120
|
+
var YAMLMap$2 = YAMLMap$7;
|
|
4121
|
+
var resolveProps$3 = resolveProps$5;
|
|
4122
|
+
var utilContainsNewline$1 = utilContainsNewline$3;
|
|
4123
|
+
var utilFlowIndentCheck$1 = utilFlowIndentCheck$2;
|
|
4124
|
+
var utilMapIncludes$1 = utilMapIncludes$2;
|
|
4125
|
+
|
|
3660
4126
|
const startColMsg = 'All mapping items must start at the same column';
|
|
3661
|
-
function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError) {
|
|
3662
|
-
const map = new YAMLMap(ctx.schema);
|
|
4127
|
+
function resolveBlockMap$1({ composeNode, composeEmptyNode }, ctx, bm, onError) {
|
|
4128
|
+
const map = new YAMLMap$2.YAMLMap(ctx.schema);
|
|
3663
4129
|
if (ctx.atRoot)
|
|
3664
4130
|
ctx.atRoot = false;
|
|
3665
4131
|
let offset = bm.offset;
|
|
3666
4132
|
for (const collItem of bm.items) {
|
|
3667
4133
|
const { start, key, sep, value } = collItem;
|
|
3668
4134
|
// key properties
|
|
3669
|
-
const keyProps = resolveProps(start, {
|
|
4135
|
+
const keyProps = resolveProps$3.resolveProps(start, {
|
|
3670
4136
|
indicator: 'explicit-key-ind',
|
|
3671
4137
|
next: key ?? sep?.[0],
|
|
3672
4138
|
offset,
|
|
@@ -3691,7 +4157,7 @@ function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError) {
|
|
|
3691
4157
|
}
|
|
3692
4158
|
continue;
|
|
3693
4159
|
}
|
|
3694
|
-
if (keyProps.hasNewlineAfterProp || containsNewline(key)) {
|
|
4160
|
+
if (keyProps.hasNewlineAfterProp || utilContainsNewline$1.containsNewline(key)) {
|
|
3695
4161
|
onError(key ?? start[start.length - 1], 'MULTILINE_IMPLICIT_KEY', 'Implicit keys need to be on a single line');
|
|
3696
4162
|
}
|
|
3697
4163
|
}
|
|
@@ -3704,11 +4170,11 @@ function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError) {
|
|
|
3704
4170
|
? composeNode(ctx, key, keyProps, onError)
|
|
3705
4171
|
: composeEmptyNode(ctx, keyStart, start, null, keyProps, onError);
|
|
3706
4172
|
if (ctx.schema.compat)
|
|
3707
|
-
flowIndentCheck(bm.indent, key, onError);
|
|
3708
|
-
if (mapIncludes(ctx, map.items, keyNode))
|
|
4173
|
+
utilFlowIndentCheck$1.flowIndentCheck(bm.indent, key, onError);
|
|
4174
|
+
if (utilMapIncludes$1.mapIncludes(ctx, map.items, keyNode))
|
|
3709
4175
|
onError(keyStart, 'DUPLICATE_KEY', 'Map keys must be unique');
|
|
3710
4176
|
// value properties
|
|
3711
|
-
const valueProps = resolveProps(sep ?? [], {
|
|
4177
|
+
const valueProps = resolveProps$3.resolveProps(sep ?? [], {
|
|
3712
4178
|
indicator: 'map-value-ind',
|
|
3713
4179
|
next: value,
|
|
3714
4180
|
offset: keyNode.range[2],
|
|
@@ -3729,9 +4195,9 @@ function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError) {
|
|
|
3729
4195
|
? composeNode(ctx, value, valueProps, onError)
|
|
3730
4196
|
: composeEmptyNode(ctx, offset, sep, null, valueProps, onError);
|
|
3731
4197
|
if (ctx.schema.compat)
|
|
3732
|
-
flowIndentCheck(bm.indent, value, onError);
|
|
4198
|
+
utilFlowIndentCheck$1.flowIndentCheck(bm.indent, value, onError);
|
|
3733
4199
|
offset = valueNode.range[2];
|
|
3734
|
-
const pair = new Pair(keyNode, valueNode);
|
|
4200
|
+
const pair = new Pair$2.Pair(keyNode, valueNode);
|
|
3735
4201
|
if (ctx.options.keepSourceTokens)
|
|
3736
4202
|
pair.srcToken = collItem;
|
|
3737
4203
|
map.items.push(pair);
|
|
@@ -3746,7 +4212,7 @@ function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError) {
|
|
|
3746
4212
|
else
|
|
3747
4213
|
keyNode.comment = valueProps.comment;
|
|
3748
4214
|
}
|
|
3749
|
-
const pair = new Pair(keyNode);
|
|
4215
|
+
const pair = new Pair$2.Pair(keyNode);
|
|
3750
4216
|
if (ctx.options.keepSourceTokens)
|
|
3751
4217
|
pair.srcToken = collItem;
|
|
3752
4218
|
map.items.push(pair);
|
|
@@ -3756,13 +4222,21 @@ function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError) {
|
|
|
3756
4222
|
return map;
|
|
3757
4223
|
}
|
|
3758
4224
|
|
|
3759
|
-
|
|
3760
|
-
|
|
4225
|
+
resolveBlockMap$2.resolveBlockMap = resolveBlockMap$1;
|
|
4226
|
+
|
|
4227
|
+
var resolveBlockSeq$2 = {};
|
|
4228
|
+
|
|
4229
|
+
var YAMLSeq$2 = YAMLSeq$7;
|
|
4230
|
+
var resolveProps$2 = resolveProps$5;
|
|
4231
|
+
var utilFlowIndentCheck = utilFlowIndentCheck$2;
|
|
4232
|
+
|
|
4233
|
+
function resolveBlockSeq$1({ composeNode, composeEmptyNode }, ctx, bs, onError) {
|
|
4234
|
+
const seq = new YAMLSeq$2.YAMLSeq(ctx.schema);
|
|
3761
4235
|
if (ctx.atRoot)
|
|
3762
4236
|
ctx.atRoot = false;
|
|
3763
4237
|
let offset = bs.offset;
|
|
3764
4238
|
for (const { start, value } of bs.items) {
|
|
3765
|
-
const props = resolveProps(start, {
|
|
4239
|
+
const props = resolveProps$2.resolveProps(start, {
|
|
3766
4240
|
indicator: 'seq-item-ind',
|
|
3767
4241
|
next: value,
|
|
3768
4242
|
offset,
|
|
@@ -3788,7 +4262,7 @@ function resolveBlockSeq({ composeNode, composeEmptyNode }, ctx, bs, onError) {
|
|
|
3788
4262
|
? composeNode(ctx, value, props, onError)
|
|
3789
4263
|
: composeEmptyNode(ctx, offset, start, null, props, onError);
|
|
3790
4264
|
if (ctx.schema.compat)
|
|
3791
|
-
flowIndentCheck(bs.indent, value, onError);
|
|
4265
|
+
utilFlowIndentCheck.flowIndentCheck(bs.indent, value, onError);
|
|
3792
4266
|
offset = node.range[2];
|
|
3793
4267
|
seq.items.push(node);
|
|
3794
4268
|
}
|
|
@@ -3796,7 +4270,13 @@ function resolveBlockSeq({ composeNode, composeEmptyNode }, ctx, bs, onError) {
|
|
|
3796
4270
|
return seq;
|
|
3797
4271
|
}
|
|
3798
4272
|
|
|
3799
|
-
|
|
4273
|
+
resolveBlockSeq$2.resolveBlockSeq = resolveBlockSeq$1;
|
|
4274
|
+
|
|
4275
|
+
var resolveFlowCollection$2 = {};
|
|
4276
|
+
|
|
4277
|
+
var resolveEnd$6 = {};
|
|
4278
|
+
|
|
4279
|
+
function resolveEnd$5(end, offset, reqSpace, onError) {
|
|
3800
4280
|
let comment = '';
|
|
3801
4281
|
if (end) {
|
|
3802
4282
|
let hasSpace = false;
|
|
@@ -3832,14 +4312,25 @@ function resolveEnd(end, offset, reqSpace, onError) {
|
|
|
3832
4312
|
return { comment, offset };
|
|
3833
4313
|
}
|
|
3834
4314
|
|
|
4315
|
+
resolveEnd$6.resolveEnd = resolveEnd$5;
|
|
4316
|
+
|
|
4317
|
+
var Node$4 = Node$t;
|
|
4318
|
+
var Pair$1 = Pair$9;
|
|
4319
|
+
var YAMLMap$1 = YAMLMap$7;
|
|
4320
|
+
var YAMLSeq$1 = YAMLSeq$7;
|
|
4321
|
+
var resolveEnd$4 = resolveEnd$6;
|
|
4322
|
+
var resolveProps$1 = resolveProps$5;
|
|
4323
|
+
var utilContainsNewline = utilContainsNewline$3;
|
|
4324
|
+
var utilMapIncludes = utilMapIncludes$2;
|
|
4325
|
+
|
|
3835
4326
|
const blockMsg = 'Block collections are not allowed within flow collections';
|
|
3836
4327
|
const isBlock = (token) => token && (token.type === 'block-map' || token.type === 'block-seq');
|
|
3837
|
-
function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onError) {
|
|
4328
|
+
function resolveFlowCollection$1({ composeNode, composeEmptyNode }, ctx, fc, onError) {
|
|
3838
4329
|
const isMap = fc.start.source === '{';
|
|
3839
4330
|
const fcName = isMap ? 'flow map' : 'flow sequence';
|
|
3840
4331
|
const coll = isMap
|
|
3841
|
-
? new YAMLMap(ctx.schema)
|
|
3842
|
-
: new YAMLSeq(ctx.schema);
|
|
4332
|
+
? new YAMLMap$1.YAMLMap(ctx.schema)
|
|
4333
|
+
: new YAMLSeq$1.YAMLSeq(ctx.schema);
|
|
3843
4334
|
coll.flow = true;
|
|
3844
4335
|
const atRoot = ctx.atRoot;
|
|
3845
4336
|
if (atRoot)
|
|
@@ -3848,7 +4339,7 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
|
|
|
3848
4339
|
for (let i = 0; i < fc.items.length; ++i) {
|
|
3849
4340
|
const collItem = fc.items[i];
|
|
3850
4341
|
const { start, key, sep, value } = collItem;
|
|
3851
|
-
const props = resolveProps(start, {
|
|
4342
|
+
const props = resolveProps$1.resolveProps(start, {
|
|
3852
4343
|
flow: fcName,
|
|
3853
4344
|
indicator: 'explicit-key-ind',
|
|
3854
4345
|
next: key ?? sep?.[0],
|
|
@@ -3871,7 +4362,7 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
|
|
|
3871
4362
|
offset = props.end;
|
|
3872
4363
|
continue;
|
|
3873
4364
|
}
|
|
3874
|
-
if (!isMap && ctx.options.strict && containsNewline(key))
|
|
4365
|
+
if (!isMap && ctx.options.strict && utilContainsNewline.containsNewline(key))
|
|
3875
4366
|
onError(key, // checked by containsNewline()
|
|
3876
4367
|
'MULTILINE_IMPLICIT_KEY', 'Implicit keys of flow sequence pairs need to be on a single line');
|
|
3877
4368
|
}
|
|
@@ -3898,7 +4389,7 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
|
|
|
3898
4389
|
}
|
|
3899
4390
|
if (prevItemComment) {
|
|
3900
4391
|
let prev = coll.items[coll.items.length - 1];
|
|
3901
|
-
if (isPair(prev))
|
|
4392
|
+
if (Node$4.isPair(prev))
|
|
3902
4393
|
prev = prev.value ?? prev.key;
|
|
3903
4394
|
if (prev.comment)
|
|
3904
4395
|
prev.comment += '\n' + prevItemComment;
|
|
@@ -3929,7 +4420,7 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
|
|
|
3929
4420
|
if (isBlock(key))
|
|
3930
4421
|
onError(keyNode.range, 'BLOCK_IN_FLOW', blockMsg);
|
|
3931
4422
|
// value properties
|
|
3932
|
-
const valueProps = resolveProps(sep ?? [], {
|
|
4423
|
+
const valueProps = resolveProps$1.resolveProps(sep ?? [], {
|
|
3933
4424
|
flow: fcName,
|
|
3934
4425
|
indicator: 'map-value-ind',
|
|
3935
4426
|
next: value,
|
|
@@ -3974,17 +4465,17 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
|
|
|
3974
4465
|
else
|
|
3975
4466
|
keyNode.comment = valueProps.comment;
|
|
3976
4467
|
}
|
|
3977
|
-
const pair = new Pair(keyNode, valueNode);
|
|
4468
|
+
const pair = new Pair$1.Pair(keyNode, valueNode);
|
|
3978
4469
|
if (ctx.options.keepSourceTokens)
|
|
3979
4470
|
pair.srcToken = collItem;
|
|
3980
4471
|
if (isMap) {
|
|
3981
4472
|
const map = coll;
|
|
3982
|
-
if (mapIncludes(ctx, map.items, keyNode))
|
|
4473
|
+
if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))
|
|
3983
4474
|
onError(keyStart, 'DUPLICATE_KEY', 'Map keys must be unique');
|
|
3984
4475
|
map.items.push(pair);
|
|
3985
4476
|
}
|
|
3986
4477
|
else {
|
|
3987
|
-
const map = new YAMLMap(ctx.schema);
|
|
4478
|
+
const map = new YAMLMap$1.YAMLMap(ctx.schema);
|
|
3988
4479
|
map.flow = true;
|
|
3989
4480
|
map.items.push(pair);
|
|
3990
4481
|
coll.items.push(map);
|
|
@@ -4007,7 +4498,7 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
|
|
|
4007
4498
|
ee.unshift(ce);
|
|
4008
4499
|
}
|
|
4009
4500
|
if (ee.length > 0) {
|
|
4010
|
-
const end = resolveEnd(ee, cePos, ctx.options.strict, onError);
|
|
4501
|
+
const end = resolveEnd$4.resolveEnd(ee, cePos, ctx.options.strict, onError);
|
|
4011
4502
|
if (end.comment) {
|
|
4012
4503
|
if (coll.comment)
|
|
4013
4504
|
coll.comment += '\n' + end.comment;
|
|
@@ -4022,19 +4513,27 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
|
|
|
4022
4513
|
return coll;
|
|
4023
4514
|
}
|
|
4024
4515
|
|
|
4025
|
-
|
|
4516
|
+
resolveFlowCollection$2.resolveFlowCollection = resolveFlowCollection$1;
|
|
4517
|
+
|
|
4518
|
+
var Node$3 = Node$t;
|
|
4519
|
+
var Scalar$4 = Scalar$k;
|
|
4520
|
+
var resolveBlockMap = resolveBlockMap$2;
|
|
4521
|
+
var resolveBlockSeq = resolveBlockSeq$2;
|
|
4522
|
+
var resolveFlowCollection = resolveFlowCollection$2;
|
|
4523
|
+
|
|
4524
|
+
function composeCollection$1(CN, ctx, token, tagToken, onError) {
|
|
4026
4525
|
let coll;
|
|
4027
4526
|
switch (token.type) {
|
|
4028
4527
|
case 'block-map': {
|
|
4029
|
-
coll = resolveBlockMap(CN, ctx, token, onError);
|
|
4528
|
+
coll = resolveBlockMap.resolveBlockMap(CN, ctx, token, onError);
|
|
4030
4529
|
break;
|
|
4031
4530
|
}
|
|
4032
4531
|
case 'block-seq': {
|
|
4033
|
-
coll = resolveBlockSeq(CN, ctx, token, onError);
|
|
4532
|
+
coll = resolveBlockSeq.resolveBlockSeq(CN, ctx, token, onError);
|
|
4034
4533
|
break;
|
|
4035
4534
|
}
|
|
4036
4535
|
case 'flow-collection': {
|
|
4037
|
-
coll = resolveFlowCollection(CN, ctx, token, onError);
|
|
4536
|
+
coll = resolveFlowCollection.resolveFlowCollection(CN, ctx, token, onError);
|
|
4038
4537
|
break;
|
|
4039
4538
|
}
|
|
4040
4539
|
}
|
|
@@ -4049,7 +4548,7 @@ function composeCollection(CN, ctx, token, tagToken, onError) {
|
|
|
4049
4548
|
coll.tag = Coll.tagName;
|
|
4050
4549
|
return coll;
|
|
4051
4550
|
}
|
|
4052
|
-
const expType = isMap(coll) ? 'map' : 'seq';
|
|
4551
|
+
const expType = Node$3.isMap(coll) ? 'map' : 'seq';
|
|
4053
4552
|
let tag = ctx.schema.tags.find(t => t.collection === expType && t.tag === tagName);
|
|
4054
4553
|
if (!tag) {
|
|
4055
4554
|
const kt = ctx.schema.knownTags[tagName];
|
|
@@ -4064,9 +4563,9 @@ function composeCollection(CN, ctx, token, tagToken, onError) {
|
|
|
4064
4563
|
}
|
|
4065
4564
|
}
|
|
4066
4565
|
const res = tag.resolve(coll, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg), ctx.options);
|
|
4067
|
-
const node = isNode(res)
|
|
4566
|
+
const node = Node$3.isNode(res)
|
|
4068
4567
|
? res
|
|
4069
|
-
: new Scalar(res);
|
|
4568
|
+
: new Scalar$4.Scalar(res);
|
|
4070
4569
|
node.range = coll.range;
|
|
4071
4570
|
node.tag = tagName;
|
|
4072
4571
|
if (tag?.format)
|
|
@@ -4074,12 +4573,20 @@ function composeCollection(CN, ctx, token, tagToken, onError) {
|
|
|
4074
4573
|
return node;
|
|
4075
4574
|
}
|
|
4076
4575
|
|
|
4077
|
-
|
|
4576
|
+
composeCollection$2.composeCollection = composeCollection$1;
|
|
4577
|
+
|
|
4578
|
+
var composeScalar$2 = {};
|
|
4579
|
+
|
|
4580
|
+
var resolveBlockScalar$3 = {};
|
|
4581
|
+
|
|
4582
|
+
var Scalar$3 = Scalar$k;
|
|
4583
|
+
|
|
4584
|
+
function resolveBlockScalar$2(scalar, strict, onError) {
|
|
4078
4585
|
const start = scalar.offset;
|
|
4079
4586
|
const header = parseBlockScalarHeader(scalar, strict, onError);
|
|
4080
4587
|
if (!header)
|
|
4081
4588
|
return { value: '', type: null, comment: '', range: [start, start, start] };
|
|
4082
|
-
const type = header.mode === '>' ? Scalar.BLOCK_FOLDED : Scalar.BLOCK_LITERAL;
|
|
4589
|
+
const type = header.mode === '>' ? Scalar$3.Scalar.BLOCK_FOLDED : Scalar$3.Scalar.BLOCK_LITERAL;
|
|
4083
4590
|
const lines = scalar.source ? splitLines(scalar.source) : [];
|
|
4084
4591
|
// determine the end of content & start of chomping
|
|
4085
4592
|
let chompStart = lines.length;
|
|
@@ -4148,7 +4655,7 @@ function resolveBlockScalar(scalar, strict, onError) {
|
|
|
4148
4655
|
onError(offset - content.length - (crlf ? 2 : 1), 'BAD_INDENT', message);
|
|
4149
4656
|
indent = '';
|
|
4150
4657
|
}
|
|
4151
|
-
if (type === Scalar.BLOCK_LITERAL) {
|
|
4658
|
+
if (type === Scalar$3.Scalar.BLOCK_LITERAL) {
|
|
4152
4659
|
value += sep + indent.slice(trimIndent) + content;
|
|
4153
4660
|
sep = '\n';
|
|
4154
4661
|
}
|
|
@@ -4265,22 +4772,29 @@ function splitLines(source) {
|
|
|
4265
4772
|
return lines;
|
|
4266
4773
|
}
|
|
4267
4774
|
|
|
4268
|
-
|
|
4775
|
+
resolveBlockScalar$3.resolveBlockScalar = resolveBlockScalar$2;
|
|
4776
|
+
|
|
4777
|
+
var resolveFlowScalar$3 = {};
|
|
4778
|
+
|
|
4779
|
+
var Scalar$2 = Scalar$k;
|
|
4780
|
+
var resolveEnd$3 = resolveEnd$6;
|
|
4781
|
+
|
|
4782
|
+
function resolveFlowScalar$2(scalar, strict, onError) {
|
|
4269
4783
|
const { offset, type, source, end } = scalar;
|
|
4270
4784
|
let _type;
|
|
4271
4785
|
let value;
|
|
4272
4786
|
const _onError = (rel, code, msg) => onError(offset + rel, code, msg);
|
|
4273
4787
|
switch (type) {
|
|
4274
4788
|
case 'scalar':
|
|
4275
|
-
_type = Scalar.PLAIN;
|
|
4789
|
+
_type = Scalar$2.Scalar.PLAIN;
|
|
4276
4790
|
value = plainValue(source, _onError);
|
|
4277
4791
|
break;
|
|
4278
4792
|
case 'single-quoted-scalar':
|
|
4279
|
-
_type = Scalar.QUOTE_SINGLE;
|
|
4793
|
+
_type = Scalar$2.Scalar.QUOTE_SINGLE;
|
|
4280
4794
|
value = singleQuotedValue(source, _onError);
|
|
4281
4795
|
break;
|
|
4282
4796
|
case 'double-quoted-scalar':
|
|
4283
|
-
_type = Scalar.QUOTE_DOUBLE;
|
|
4797
|
+
_type = Scalar$2.Scalar.QUOTE_DOUBLE;
|
|
4284
4798
|
value = doubleQuotedValue(source, _onError);
|
|
4285
4799
|
break;
|
|
4286
4800
|
/* istanbul ignore next should not happen */
|
|
@@ -4294,7 +4808,7 @@ function resolveFlowScalar(scalar, strict, onError) {
|
|
|
4294
4808
|
};
|
|
4295
4809
|
}
|
|
4296
4810
|
const valueEnd = offset + source.length;
|
|
4297
|
-
const re = resolveEnd(end, valueEnd, strict, onError);
|
|
4811
|
+
const re = resolveEnd$3.resolveEnd(end, valueEnd, strict, onError);
|
|
4298
4812
|
return {
|
|
4299
4813
|
value,
|
|
4300
4814
|
type: _type,
|
|
@@ -4484,10 +4998,17 @@ function parseCharCode(source, offset, length, onError) {
|
|
|
4484
4998
|
return String.fromCodePoint(code);
|
|
4485
4999
|
}
|
|
4486
5000
|
|
|
4487
|
-
|
|
5001
|
+
resolveFlowScalar$3.resolveFlowScalar = resolveFlowScalar$2;
|
|
5002
|
+
|
|
5003
|
+
var Node$2 = Node$t;
|
|
5004
|
+
var Scalar$1 = Scalar$k;
|
|
5005
|
+
var resolveBlockScalar$1 = resolveBlockScalar$3;
|
|
5006
|
+
var resolveFlowScalar$1 = resolveFlowScalar$3;
|
|
5007
|
+
|
|
5008
|
+
function composeScalar$1(ctx, token, tagToken, onError) {
|
|
4488
5009
|
const { value, type, comment, range } = token.type === 'block-scalar'
|
|
4489
|
-
? resolveBlockScalar(token, ctx.options.strict, onError)
|
|
4490
|
-
: resolveFlowScalar(token, ctx.options.strict, onError);
|
|
5010
|
+
? resolveBlockScalar$1.resolveBlockScalar(token, ctx.options.strict, onError)
|
|
5011
|
+
: resolveFlowScalar$1.resolveFlowScalar(token, ctx.options.strict, onError);
|
|
4491
5012
|
const tagName = tagToken
|
|
4492
5013
|
? ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg))
|
|
4493
5014
|
: null;
|
|
@@ -4495,16 +5016,16 @@ function composeScalar(ctx, token, tagToken, onError) {
|
|
|
4495
5016
|
? findScalarTagByName(ctx.schema, value, tagName, tagToken, onError)
|
|
4496
5017
|
: token.type === 'scalar'
|
|
4497
5018
|
? findScalarTagByTest(ctx, value, token, onError)
|
|
4498
|
-
: ctx.schema[SCALAR
|
|
5019
|
+
: ctx.schema[Node$2.SCALAR];
|
|
4499
5020
|
let scalar;
|
|
4500
5021
|
try {
|
|
4501
5022
|
const res = tag.resolve(value, msg => onError(tagToken ?? token, 'TAG_RESOLVE_FAILED', msg), ctx.options);
|
|
4502
|
-
scalar = isScalar
|
|
5023
|
+
scalar = Node$2.isScalar(res) ? res : new Scalar$1.Scalar(res);
|
|
4503
5024
|
}
|
|
4504
5025
|
catch (error) {
|
|
4505
5026
|
const msg = error instanceof Error ? error.message : String(error);
|
|
4506
5027
|
onError(tagToken ?? token, 'TAG_RESOLVE_FAILED', msg);
|
|
4507
|
-
scalar = new Scalar(value);
|
|
5028
|
+
scalar = new Scalar$1.Scalar(value);
|
|
4508
5029
|
}
|
|
4509
5030
|
scalar.range = range;
|
|
4510
5031
|
scalar.source = value;
|
|
@@ -4520,7 +5041,7 @@ function composeScalar(ctx, token, tagToken, onError) {
|
|
|
4520
5041
|
}
|
|
4521
5042
|
function findScalarTagByName(schema, value, tagName, tagToken, onError) {
|
|
4522
5043
|
if (tagName === '!')
|
|
4523
|
-
return schema[SCALAR
|
|
5044
|
+
return schema[Node$2.SCALAR]; // non-specific tag
|
|
4524
5045
|
const matchWithTest = [];
|
|
4525
5046
|
for (const tag of schema.tags) {
|
|
4526
5047
|
if (!tag.collection && tag.tag === tagName) {
|
|
@@ -4541,13 +5062,13 @@ function findScalarTagByName(schema, value, tagName, tagToken, onError) {
|
|
|
4541
5062
|
return kt;
|
|
4542
5063
|
}
|
|
4543
5064
|
onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, tagName !== 'tag:yaml.org,2002:str');
|
|
4544
|
-
return schema[SCALAR
|
|
5065
|
+
return schema[Node$2.SCALAR];
|
|
4545
5066
|
}
|
|
4546
5067
|
function findScalarTagByTest({ directives, schema }, value, token, onError) {
|
|
4547
|
-
const tag = schema.tags.find(tag => tag.default && tag.test?.test(value)) || schema[SCALAR
|
|
5068
|
+
const tag = schema.tags.find(tag => tag.default && tag.test?.test(value)) || schema[Node$2.SCALAR];
|
|
4548
5069
|
if (schema.compat) {
|
|
4549
5070
|
const compat = schema.compat.find(tag => tag.default && tag.test?.test(value)) ??
|
|
4550
|
-
schema[SCALAR
|
|
5071
|
+
schema[Node$2.SCALAR];
|
|
4551
5072
|
if (tag.tag !== compat.tag) {
|
|
4552
5073
|
const ts = directives.tagString(tag.tag);
|
|
4553
5074
|
const cs = directives.tagString(compat.tag);
|
|
@@ -4558,6 +5079,10 @@ function findScalarTagByTest({ directives, schema }, value, token, onError) {
|
|
|
4558
5079
|
return tag;
|
|
4559
5080
|
}
|
|
4560
5081
|
|
|
5082
|
+
composeScalar$2.composeScalar = composeScalar$1;
|
|
5083
|
+
|
|
5084
|
+
var utilEmptyScalarPosition$1 = {};
|
|
5085
|
+
|
|
4561
5086
|
function emptyScalarPosition(offset, before, pos) {
|
|
4562
5087
|
if (before) {
|
|
4563
5088
|
if (pos === null)
|
|
@@ -4584,8 +5109,16 @@ function emptyScalarPosition(offset, before, pos) {
|
|
|
4584
5109
|
return offset;
|
|
4585
5110
|
}
|
|
4586
5111
|
|
|
4587
|
-
|
|
4588
|
-
|
|
5112
|
+
utilEmptyScalarPosition$1.emptyScalarPosition = emptyScalarPosition;
|
|
5113
|
+
|
|
5114
|
+
var Alias$1 = Alias$5;
|
|
5115
|
+
var composeCollection = composeCollection$2;
|
|
5116
|
+
var composeScalar = composeScalar$2;
|
|
5117
|
+
var resolveEnd$2 = resolveEnd$6;
|
|
5118
|
+
var utilEmptyScalarPosition = utilEmptyScalarPosition$1;
|
|
5119
|
+
|
|
5120
|
+
const CN = { composeNode: composeNode$1, composeEmptyNode };
|
|
5121
|
+
function composeNode$1(ctx, token, props, onError) {
|
|
4589
5122
|
const { spaceBefore, comment, anchor, tag } = props;
|
|
4590
5123
|
let node;
|
|
4591
5124
|
let isSrcToken = true;
|
|
@@ -4599,14 +5132,14 @@ function composeNode(ctx, token, props, onError) {
|
|
|
4599
5132
|
case 'single-quoted-scalar':
|
|
4600
5133
|
case 'double-quoted-scalar':
|
|
4601
5134
|
case 'block-scalar':
|
|
4602
|
-
node = composeScalar(ctx, token, tag, onError);
|
|
5135
|
+
node = composeScalar.composeScalar(ctx, token, tag, onError);
|
|
4603
5136
|
if (anchor)
|
|
4604
5137
|
node.anchor = anchor.source.substring(1);
|
|
4605
5138
|
break;
|
|
4606
5139
|
case 'block-map':
|
|
4607
5140
|
case 'block-seq':
|
|
4608
5141
|
case 'flow-collection':
|
|
4609
|
-
node = composeCollection(CN, ctx, token, tag, onError);
|
|
5142
|
+
node = composeCollection.composeCollection(CN, ctx, token, tag, onError);
|
|
4610
5143
|
if (anchor)
|
|
4611
5144
|
node.anchor = anchor.source.substring(1);
|
|
4612
5145
|
break;
|
|
@@ -4637,11 +5170,11 @@ function composeNode(ctx, token, props, onError) {
|
|
|
4637
5170
|
function composeEmptyNode(ctx, offset, before, pos, { spaceBefore, comment, anchor, tag }, onError) {
|
|
4638
5171
|
const token = {
|
|
4639
5172
|
type: 'scalar',
|
|
4640
|
-
offset: emptyScalarPosition(offset, before, pos),
|
|
5173
|
+
offset: utilEmptyScalarPosition.emptyScalarPosition(offset, before, pos),
|
|
4641
5174
|
indent: -1,
|
|
4642
5175
|
source: ''
|
|
4643
5176
|
};
|
|
4644
|
-
const node = composeScalar(ctx, token, tag, onError);
|
|
5177
|
+
const node = composeScalar.composeScalar(ctx, token, tag, onError);
|
|
4645
5178
|
if (anchor) {
|
|
4646
5179
|
node.anchor = anchor.source.substring(1);
|
|
4647
5180
|
if (node.anchor === '')
|
|
@@ -4654,29 +5187,37 @@ function composeEmptyNode(ctx, offset, before, pos, { spaceBefore, comment, anch
|
|
|
4654
5187
|
return node;
|
|
4655
5188
|
}
|
|
4656
5189
|
function composeAlias({ options }, { offset, source, end }, onError) {
|
|
4657
|
-
const alias = new Alias(source.substring(1));
|
|
5190
|
+
const alias = new Alias$1.Alias(source.substring(1));
|
|
4658
5191
|
if (alias.source === '')
|
|
4659
5192
|
onError(offset, 'BAD_ALIAS', 'Alias cannot be an empty string');
|
|
4660
5193
|
if (alias.source.endsWith(':'))
|
|
4661
5194
|
onError(offset + source.length - 1, 'BAD_ALIAS', 'Alias ending in : is ambiguous', true);
|
|
4662
5195
|
const valueEnd = offset + source.length;
|
|
4663
|
-
const re = resolveEnd(end, valueEnd, options.strict, onError);
|
|
5196
|
+
const re = resolveEnd$2.resolveEnd(end, valueEnd, options.strict, onError);
|
|
4664
5197
|
alias.range = [offset, valueEnd, re.offset];
|
|
4665
5198
|
if (re.comment)
|
|
4666
5199
|
alias.comment = re.comment;
|
|
4667
5200
|
return alias;
|
|
4668
5201
|
}
|
|
4669
5202
|
|
|
4670
|
-
|
|
5203
|
+
composeNode$2.composeEmptyNode = composeEmptyNode;
|
|
5204
|
+
composeNode$2.composeNode = composeNode$1;
|
|
5205
|
+
|
|
5206
|
+
var Document$3 = Document$5;
|
|
5207
|
+
var composeNode = composeNode$2;
|
|
5208
|
+
var resolveEnd$1 = resolveEnd$6;
|
|
5209
|
+
var resolveProps = resolveProps$5;
|
|
5210
|
+
|
|
5211
|
+
function composeDoc$1(options, directives, { offset, start, value, end }, onError) {
|
|
4671
5212
|
const opts = Object.assign({ _directives: directives }, options);
|
|
4672
|
-
const doc = new Document(undefined, opts);
|
|
5213
|
+
const doc = new Document$3.Document(undefined, opts);
|
|
4673
5214
|
const ctx = {
|
|
4674
5215
|
atRoot: true,
|
|
4675
5216
|
directives: doc.directives,
|
|
4676
5217
|
options: doc.options,
|
|
4677
5218
|
schema: doc.schema
|
|
4678
5219
|
};
|
|
4679
|
-
const props = resolveProps(start, {
|
|
5220
|
+
const props = resolveProps.resolveProps(start, {
|
|
4680
5221
|
indicator: 'doc-start',
|
|
4681
5222
|
next: value ?? end?.[0],
|
|
4682
5223
|
offset,
|
|
@@ -4691,16 +5232,25 @@ function composeDoc(options, directives, { offset, start, value, end }, onError)
|
|
|
4691
5232
|
onError(props.end, 'MISSING_CHAR', 'Block collection cannot start on same line with directives-end marker');
|
|
4692
5233
|
}
|
|
4693
5234
|
doc.contents = value
|
|
4694
|
-
? composeNode(ctx, value, props, onError)
|
|
4695
|
-
: composeEmptyNode(ctx, props.end, start, null, props, onError);
|
|
5235
|
+
? composeNode.composeNode(ctx, value, props, onError)
|
|
5236
|
+
: composeNode.composeEmptyNode(ctx, props.end, start, null, props, onError);
|
|
4696
5237
|
const contentEnd = doc.contents.range[2];
|
|
4697
|
-
const re = resolveEnd(end, contentEnd, false, onError);
|
|
5238
|
+
const re = resolveEnd$1.resolveEnd(end, contentEnd, false, onError);
|
|
4698
5239
|
if (re.comment)
|
|
4699
5240
|
doc.comment = re.comment;
|
|
4700
5241
|
doc.range = [offset, contentEnd, re.offset];
|
|
4701
5242
|
return doc;
|
|
4702
5243
|
}
|
|
4703
5244
|
|
|
5245
|
+
composeDoc$2.composeDoc = composeDoc$1;
|
|
5246
|
+
|
|
5247
|
+
var directives = directives$2;
|
|
5248
|
+
var Document$2 = Document$5;
|
|
5249
|
+
var errors$3 = errors$4;
|
|
5250
|
+
var Node$1 = Node$t;
|
|
5251
|
+
var composeDoc = composeDoc$2;
|
|
5252
|
+
var resolveEnd = resolveEnd$6;
|
|
5253
|
+
|
|
4704
5254
|
function getErrorPos(src) {
|
|
4705
5255
|
if (typeof src === 'number')
|
|
4706
5256
|
return [src, src + 1];
|
|
@@ -4748,7 +5298,7 @@ function parsePrelude(prelude) {
|
|
|
4748
5298
|
* const docs = new Composer().compose(tokens)
|
|
4749
5299
|
* ```
|
|
4750
5300
|
*/
|
|
4751
|
-
class Composer {
|
|
5301
|
+
class Composer$1 {
|
|
4752
5302
|
constructor(options = {}) {
|
|
4753
5303
|
this.doc = null;
|
|
4754
5304
|
this.atDirectives = false;
|
|
@@ -4758,12 +5308,12 @@ class Composer {
|
|
|
4758
5308
|
this.onError = (source, code, message, warning) => {
|
|
4759
5309
|
const pos = getErrorPos(source);
|
|
4760
5310
|
if (warning)
|
|
4761
|
-
this.warnings.push(new YAMLWarning(pos, code, message));
|
|
5311
|
+
this.warnings.push(new errors$3.YAMLWarning(pos, code, message));
|
|
4762
5312
|
else
|
|
4763
|
-
this.errors.push(new YAMLParseError(pos, code, message));
|
|
5313
|
+
this.errors.push(new errors$3.YAMLParseError(pos, code, message));
|
|
4764
5314
|
};
|
|
4765
5315
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
4766
|
-
this.directives = new Directives({ version: options.version || '1.2' });
|
|
5316
|
+
this.directives = new directives.Directives({ version: options.version || '1.2' });
|
|
4767
5317
|
this.options = options;
|
|
4768
5318
|
}
|
|
4769
5319
|
decorate(doc, afterDoc) {
|
|
@@ -4777,9 +5327,9 @@ class Composer {
|
|
|
4777
5327
|
else if (afterEmptyLine || doc.directives.docStart || !dc) {
|
|
4778
5328
|
doc.commentBefore = comment;
|
|
4779
5329
|
}
|
|
4780
|
-
else if (
|
|
5330
|
+
else if (Node$1.isCollection(dc) && !dc.flow && dc.items.length > 0) {
|
|
4781
5331
|
let it = dc.items[0];
|
|
4782
|
-
if (isPair(it))
|
|
5332
|
+
if (Node$1.isPair(it))
|
|
4783
5333
|
it = it.key;
|
|
4784
5334
|
const cb = it.commentBefore;
|
|
4785
5335
|
it.commentBefore = cb ? `${comment}\n${cb}` : comment;
|
|
@@ -4827,6 +5377,8 @@ class Composer {
|
|
|
4827
5377
|
}
|
|
4828
5378
|
/** Advance the composer by one CST token. */
|
|
4829
5379
|
*next(token) {
|
|
5380
|
+
if (process.env.LOG_STREAM)
|
|
5381
|
+
console.dir(token, { depth: null });
|
|
4830
5382
|
switch (token.type) {
|
|
4831
5383
|
case 'directive':
|
|
4832
5384
|
this.directives.add(token.source, (offset, message, warning) => {
|
|
@@ -4838,7 +5390,7 @@ class Composer {
|
|
|
4838
5390
|
this.atDirectives = true;
|
|
4839
5391
|
break;
|
|
4840
5392
|
case 'document': {
|
|
4841
|
-
const doc = composeDoc(this.options, this.directives, token, this.onError);
|
|
5393
|
+
const doc = composeDoc.composeDoc(this.options, this.directives, token, this.onError);
|
|
4842
5394
|
if (this.atDirectives && !doc.directives.docStart)
|
|
4843
5395
|
this.onError(token, 'MISSING_CHAR', 'Missing directives-end/doc-start indicator line');
|
|
4844
5396
|
this.decorate(doc, false);
|
|
@@ -4859,7 +5411,7 @@ class Composer {
|
|
|
4859
5411
|
const msg = token.source
|
|
4860
5412
|
? `${token.message}: ${JSON.stringify(token.source)}`
|
|
4861
5413
|
: token.message;
|
|
4862
|
-
const error = new YAMLParseError(getErrorPos(token), 'UNEXPECTED_TOKEN', msg);
|
|
5414
|
+
const error = new errors$3.YAMLParseError(getErrorPos(token), 'UNEXPECTED_TOKEN', msg);
|
|
4863
5415
|
if (this.atDirectives || !this.doc)
|
|
4864
5416
|
this.errors.push(error);
|
|
4865
5417
|
else
|
|
@@ -4869,11 +5421,11 @@ class Composer {
|
|
|
4869
5421
|
case 'doc-end': {
|
|
4870
5422
|
if (!this.doc) {
|
|
4871
5423
|
const msg = 'Unexpected doc-end without preceding document';
|
|
4872
|
-
this.errors.push(new YAMLParseError(getErrorPos(token), 'UNEXPECTED_TOKEN', msg));
|
|
5424
|
+
this.errors.push(new errors$3.YAMLParseError(getErrorPos(token), 'UNEXPECTED_TOKEN', msg));
|
|
4873
5425
|
break;
|
|
4874
5426
|
}
|
|
4875
5427
|
this.doc.directives.docEnd = true;
|
|
4876
|
-
const end = resolveEnd(token.end, token.offset + token.source.length, this.doc.options.strict, this.onError);
|
|
5428
|
+
const end = resolveEnd.resolveEnd(token.end, token.offset + token.source.length, this.doc.options.strict, this.onError);
|
|
4877
5429
|
this.decorate(this.doc, true);
|
|
4878
5430
|
if (end.comment) {
|
|
4879
5431
|
const dc = this.doc.comment;
|
|
@@ -4883,7 +5435,7 @@ class Composer {
|
|
|
4883
5435
|
break;
|
|
4884
5436
|
}
|
|
4885
5437
|
default:
|
|
4886
|
-
this.errors.push(new YAMLParseError(getErrorPos(token), 'UNEXPECTED_TOKEN', `Unsupported token ${token.type}`));
|
|
5438
|
+
this.errors.push(new errors$3.YAMLParseError(getErrorPos(token), 'UNEXPECTED_TOKEN', `Unsupported token ${token.type}`));
|
|
4887
5439
|
}
|
|
4888
5440
|
}
|
|
4889
5441
|
/**
|
|
@@ -4900,7 +5452,7 @@ class Composer {
|
|
|
4900
5452
|
}
|
|
4901
5453
|
else if (forceDoc) {
|
|
4902
5454
|
const opts = Object.assign({ _directives: this.directives }, this.options);
|
|
4903
|
-
const doc = new Document(undefined, opts);
|
|
5455
|
+
const doc = new Document$2.Document(undefined, opts);
|
|
4904
5456
|
if (this.atDirectives)
|
|
4905
5457
|
this.onError(endOffset, 'MISSING_CHAR', 'Missing directives-end indicator line');
|
|
4906
5458
|
doc.range = [0, endOffset, endOffset];
|
|
@@ -4910,6 +5462,17 @@ class Composer {
|
|
|
4910
5462
|
}
|
|
4911
5463
|
}
|
|
4912
5464
|
|
|
5465
|
+
composer$2.Composer = Composer$1;
|
|
5466
|
+
|
|
5467
|
+
var cst$3 = {};
|
|
5468
|
+
|
|
5469
|
+
var cstScalar$1 = {};
|
|
5470
|
+
|
|
5471
|
+
var resolveBlockScalar = resolveBlockScalar$3;
|
|
5472
|
+
var resolveFlowScalar = resolveFlowScalar$3;
|
|
5473
|
+
var errors$2 = errors$4;
|
|
5474
|
+
var stringifyString = stringifyString$5;
|
|
5475
|
+
|
|
4913
5476
|
function resolveAsScalar(token, strict = true, onError) {
|
|
4914
5477
|
if (token) {
|
|
4915
5478
|
const _onError = (pos, code, message) => {
|
|
@@ -4917,15 +5480,15 @@ function resolveAsScalar(token, strict = true, onError) {
|
|
|
4917
5480
|
if (onError)
|
|
4918
5481
|
onError(offset, code, message);
|
|
4919
5482
|
else
|
|
4920
|
-
throw new YAMLParseError([offset, offset + 1], code, message);
|
|
5483
|
+
throw new errors$2.YAMLParseError([offset, offset + 1], code, message);
|
|
4921
5484
|
};
|
|
4922
5485
|
switch (token.type) {
|
|
4923
5486
|
case 'scalar':
|
|
4924
5487
|
case 'single-quoted-scalar':
|
|
4925
5488
|
case 'double-quoted-scalar':
|
|
4926
|
-
return resolveFlowScalar(token, strict, _onError);
|
|
5489
|
+
return resolveFlowScalar.resolveFlowScalar(token, strict, _onError);
|
|
4927
5490
|
case 'block-scalar':
|
|
4928
|
-
return resolveBlockScalar(token, strict, _onError);
|
|
5491
|
+
return resolveBlockScalar.resolveBlockScalar(token, strict, _onError);
|
|
4929
5492
|
}
|
|
4930
5493
|
}
|
|
4931
5494
|
return null;
|
|
@@ -4946,7 +5509,7 @@ function resolveAsScalar(token, strict = true, onError) {
|
|
|
4946
5509
|
*/
|
|
4947
5510
|
function createScalarToken(value, context) {
|
|
4948
5511
|
const { implicitKey = false, indent, inFlow = false, offset = -1, type = 'PLAIN' } = context;
|
|
4949
|
-
const source = stringifyString({ type, value }, {
|
|
5512
|
+
const source = stringifyString.stringifyString({ type, value }, {
|
|
4950
5513
|
implicitKey,
|
|
4951
5514
|
indent: indent > 0 ? ' '.repeat(indent) : '',
|
|
4952
5515
|
inFlow,
|
|
@@ -5015,7 +5578,7 @@ function setScalarValue(token, value, context = {}) {
|
|
|
5015
5578
|
default:
|
|
5016
5579
|
type = 'PLAIN';
|
|
5017
5580
|
}
|
|
5018
|
-
const source = stringifyString({ type, value }, {
|
|
5581
|
+
const source = stringifyString.stringifyString({ type, value }, {
|
|
5019
5582
|
implicitKey: implicitKey || indent === null,
|
|
5020
5583
|
indent: indent !== null && indent > 0 ? ' '.repeat(indent) : '',
|
|
5021
5584
|
inFlow,
|
|
@@ -5118,13 +5681,19 @@ function setFlowScalarValue(token, source, type) {
|
|
|
5118
5681
|
}
|
|
5119
5682
|
}
|
|
5120
5683
|
|
|
5684
|
+
cstScalar$1.createScalarToken = createScalarToken;
|
|
5685
|
+
cstScalar$1.resolveAsScalar = resolveAsScalar;
|
|
5686
|
+
cstScalar$1.setScalarValue = setScalarValue;
|
|
5687
|
+
|
|
5688
|
+
var cstStringify$1 = {};
|
|
5689
|
+
|
|
5121
5690
|
/**
|
|
5122
5691
|
* Stringify a CST document, token, or collection item
|
|
5123
5692
|
*
|
|
5124
5693
|
* Fair warning: This applies no validation whatsoever, and
|
|
5125
5694
|
* simply concatenates the sources in their logical order.
|
|
5126
5695
|
*/
|
|
5127
|
-
const stringify$
|
|
5696
|
+
const stringify$2 = (cst) => 'type' in cst ? stringifyToken(cst) : stringifyItem(cst);
|
|
5128
5697
|
function stringifyToken(token) {
|
|
5129
5698
|
switch (token.type) {
|
|
5130
5699
|
case 'block-scalar': {
|
|
@@ -5178,6 +5747,10 @@ function stringifyItem({ start, key, sep, value }) {
|
|
|
5178
5747
|
return res;
|
|
5179
5748
|
}
|
|
5180
5749
|
|
|
5750
|
+
cstStringify$1.stringify = stringify$2;
|
|
5751
|
+
|
|
5752
|
+
var cstVisit$1 = {};
|
|
5753
|
+
|
|
5181
5754
|
const BREAK = Symbol('break visit');
|
|
5182
5755
|
const SKIP = Symbol('skip children');
|
|
5183
5756
|
const REMOVE = Symbol('remove item');
|
|
@@ -5209,7 +5782,7 @@ const REMOVE = Symbol('remove item');
|
|
|
5209
5782
|
* visitor is called on item entry, next visitors are called after handling
|
|
5210
5783
|
* a non-empty `key` and when exiting the item.
|
|
5211
5784
|
*/
|
|
5212
|
-
function visit(cst, visitor) {
|
|
5785
|
+
function visit$1(cst, visitor) {
|
|
5213
5786
|
if ('type' in cst && cst.type === 'document')
|
|
5214
5787
|
cst = { start: cst.start, value: cst.value };
|
|
5215
5788
|
_visit(Object.freeze([]), cst, visitor);
|
|
@@ -5218,13 +5791,13 @@ function visit(cst, visitor) {
|
|
|
5218
5791
|
// namespace using `var`, but then complains about that because
|
|
5219
5792
|
// `unique symbol` must be `const`.
|
|
5220
5793
|
/** Terminate visit traversal completely */
|
|
5221
|
-
visit.BREAK = BREAK;
|
|
5794
|
+
visit$1.BREAK = BREAK;
|
|
5222
5795
|
/** Do not visit the children of the current item */
|
|
5223
|
-
visit.SKIP = SKIP;
|
|
5796
|
+
visit$1.SKIP = SKIP;
|
|
5224
5797
|
/** Remove the current item */
|
|
5225
|
-
visit.REMOVE = REMOVE;
|
|
5798
|
+
visit$1.REMOVE = REMOVE;
|
|
5226
5799
|
/** Find the item at `path` from `cst` as the root */
|
|
5227
|
-
visit.itemAtPath = (cst, path) => {
|
|
5800
|
+
visit$1.itemAtPath = (cst, path) => {
|
|
5228
5801
|
let item = cst;
|
|
5229
5802
|
for (const [field, index] of path) {
|
|
5230
5803
|
const tok = item?.[field];
|
|
@@ -5241,8 +5814,8 @@ visit.itemAtPath = (cst, path) => {
|
|
|
5241
5814
|
*
|
|
5242
5815
|
* Throws an error if the collection is not found, which should never happen if the item itself exists.
|
|
5243
5816
|
*/
|
|
5244
|
-
visit.parentCollection = (cst, path) => {
|
|
5245
|
-
const parent = visit.itemAtPath(cst, path.slice(0, -1));
|
|
5817
|
+
visit$1.parentCollection = (cst, path) => {
|
|
5818
|
+
const parent = visit$1.itemAtPath(cst, path.slice(0, -1));
|
|
5246
5819
|
const field = path[path.length - 1][0];
|
|
5247
5820
|
const coll = parent?.[field];
|
|
5248
5821
|
if (coll && 'items' in coll)
|
|
@@ -5274,6 +5847,12 @@ function _visit(path, item, visitor) {
|
|
|
5274
5847
|
return typeof ctrl === 'function' ? ctrl(item, path) : ctrl;
|
|
5275
5848
|
}
|
|
5276
5849
|
|
|
5850
|
+
cstVisit$1.visit = visit$1;
|
|
5851
|
+
|
|
5852
|
+
var cstScalar = cstScalar$1;
|
|
5853
|
+
var cstStringify = cstStringify$1;
|
|
5854
|
+
var cstVisit = cstVisit$1;
|
|
5855
|
+
|
|
5277
5856
|
/** The byte order mark */
|
|
5278
5857
|
const BOM = '\u{FEFF}';
|
|
5279
5858
|
/** Start of doc-mode */
|
|
@@ -5283,9 +5862,9 @@ const FLOW_END = '\x18'; // C0: Cancel
|
|
|
5283
5862
|
/** Next token is a scalar value */
|
|
5284
5863
|
const SCALAR = '\x1f'; // C0: Unit Separator
|
|
5285
5864
|
/** @returns `true` if `token` is a flow or block collection */
|
|
5286
|
-
const isCollection = (token) => !!token && 'items' in token;
|
|
5865
|
+
const isCollection$1 = (token) => !!token && 'items' in token;
|
|
5287
5866
|
/** @returns `true` if `token` is a flow or block scalar; not an alias */
|
|
5288
|
-
const isScalar = (token) => !!token &&
|
|
5867
|
+
const isScalar$1 = (token) => !!token &&
|
|
5289
5868
|
(token.type === 'scalar' ||
|
|
5290
5869
|
token.type === 'single-quoted-scalar' ||
|
|
5291
5870
|
token.type === 'double-quoted-scalar' ||
|
|
@@ -5367,22 +5946,23 @@ function tokenType(source) {
|
|
|
5367
5946
|
return null;
|
|
5368
5947
|
}
|
|
5369
5948
|
|
|
5370
|
-
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
|
|
5378
|
-
|
|
5379
|
-
|
|
5380
|
-
|
|
5381
|
-
|
|
5382
|
-
|
|
5383
|
-
|
|
5384
|
-
|
|
5385
|
-
|
|
5949
|
+
cst$3.createScalarToken = cstScalar.createScalarToken;
|
|
5950
|
+
cst$3.resolveAsScalar = cstScalar.resolveAsScalar;
|
|
5951
|
+
cst$3.setScalarValue = cstScalar.setScalarValue;
|
|
5952
|
+
cst$3.stringify = cstStringify.stringify;
|
|
5953
|
+
cst$3.visit = cstVisit.visit;
|
|
5954
|
+
cst$3.BOM = BOM;
|
|
5955
|
+
cst$3.DOCUMENT = DOCUMENT;
|
|
5956
|
+
cst$3.FLOW_END = FLOW_END;
|
|
5957
|
+
cst$3.SCALAR = SCALAR;
|
|
5958
|
+
cst$3.isCollection = isCollection$1;
|
|
5959
|
+
cst$3.isScalar = isScalar$1;
|
|
5960
|
+
cst$3.prettyToken = prettyToken;
|
|
5961
|
+
cst$3.tokenType = tokenType;
|
|
5962
|
+
|
|
5963
|
+
var lexer$2 = {};
|
|
5964
|
+
|
|
5965
|
+
var cst$2 = cst$3;
|
|
5386
5966
|
|
|
5387
5967
|
/*
|
|
5388
5968
|
START -> stream
|
|
@@ -5483,7 +6063,7 @@ const isNotAnchorChar = (ch) => !ch || invalidAnchorChars.includes(ch);
|
|
|
5483
6063
|
* - `\x1f` (Unit Separator): Next token is a scalar value
|
|
5484
6064
|
* - `\u{FEFF}` (Byte order mark): Emitted separately outside documents
|
|
5485
6065
|
*/
|
|
5486
|
-
class Lexer {
|
|
6066
|
+
class Lexer$1 {
|
|
5487
6067
|
constructor() {
|
|
5488
6068
|
/**
|
|
5489
6069
|
* Flag indicating whether the end of the current buffer marks the end of
|
|
@@ -5626,7 +6206,7 @@ class Lexer {
|
|
|
5626
6206
|
let line = this.getLine();
|
|
5627
6207
|
if (line === null)
|
|
5628
6208
|
return this.setNext('stream');
|
|
5629
|
-
if (line[0] === BOM) {
|
|
6209
|
+
if (line[0] === cst$2.BOM) {
|
|
5630
6210
|
yield* this.pushCount(1);
|
|
5631
6211
|
line = line.substring(1);
|
|
5632
6212
|
}
|
|
@@ -5656,7 +6236,7 @@ class Lexer {
|
|
|
5656
6236
|
yield* this.pushNewline();
|
|
5657
6237
|
return 'stream';
|
|
5658
6238
|
}
|
|
5659
|
-
yield DOCUMENT;
|
|
6239
|
+
yield cst$2.DOCUMENT;
|
|
5660
6240
|
return yield* this.parseLineStart();
|
|
5661
6241
|
}
|
|
5662
6242
|
*parseLineStart() {
|
|
@@ -5766,7 +6346,7 @@ class Lexer {
|
|
|
5766
6346
|
if (!atFlowEndMarker) {
|
|
5767
6347
|
// this is an error
|
|
5768
6348
|
this.flowLevel = 0;
|
|
5769
|
-
yield FLOW_END;
|
|
6349
|
+
yield cst$2.FLOW_END;
|
|
5770
6350
|
return yield* this.parseLineStart();
|
|
5771
6351
|
}
|
|
5772
6352
|
}
|
|
@@ -5931,7 +6511,7 @@ class Lexer {
|
|
|
5931
6511
|
break;
|
|
5932
6512
|
} while (true);
|
|
5933
6513
|
}
|
|
5934
|
-
yield SCALAR;
|
|
6514
|
+
yield cst$2.SCALAR;
|
|
5935
6515
|
yield* this.pushToIndex(nl + 1, true);
|
|
5936
6516
|
return yield* this.parseLineStart();
|
|
5937
6517
|
}
|
|
@@ -5975,7 +6555,7 @@ class Lexer {
|
|
|
5975
6555
|
}
|
|
5976
6556
|
if (!ch && !this.atEnd)
|
|
5977
6557
|
return this.setNext('plain-scalar');
|
|
5978
|
-
yield SCALAR;
|
|
6558
|
+
yield cst$2.SCALAR;
|
|
5979
6559
|
yield* this.pushToIndex(end + 1, true);
|
|
5980
6560
|
return inFlow ? 'flow' : 'doc';
|
|
5981
6561
|
}
|
|
@@ -6082,12 +6662,16 @@ class Lexer {
|
|
|
6082
6662
|
}
|
|
6083
6663
|
}
|
|
6084
6664
|
|
|
6665
|
+
lexer$2.Lexer = Lexer$1;
|
|
6666
|
+
|
|
6667
|
+
var lineCounter$2 = {};
|
|
6668
|
+
|
|
6085
6669
|
/**
|
|
6086
6670
|
* Tracks newlines during parsing in order to provide an efficient API for
|
|
6087
6671
|
* determining the one-indexed `{ line, col }` position for any offset
|
|
6088
6672
|
* within the input.
|
|
6089
6673
|
*/
|
|
6090
|
-
class LineCounter {
|
|
6674
|
+
class LineCounter$1 {
|
|
6091
6675
|
constructor() {
|
|
6092
6676
|
this.lineStarts = [];
|
|
6093
6677
|
/**
|
|
@@ -6120,6 +6704,13 @@ class LineCounter {
|
|
|
6120
6704
|
}
|
|
6121
6705
|
}
|
|
6122
6706
|
|
|
6707
|
+
lineCounter$2.LineCounter = LineCounter$1;
|
|
6708
|
+
|
|
6709
|
+
var parser$2 = {};
|
|
6710
|
+
|
|
6711
|
+
var cst$1 = cst$3;
|
|
6712
|
+
var lexer$1 = lexer$2;
|
|
6713
|
+
|
|
6123
6714
|
function includesToken(list, type) {
|
|
6124
6715
|
for (let i = 0; i < list.length; ++i)
|
|
6125
6716
|
if (list[i].type === type)
|
|
@@ -6236,7 +6827,7 @@ function fixFlowSeqItems(fc) {
|
|
|
6236
6827
|
* }
|
|
6237
6828
|
* ```
|
|
6238
6829
|
*/
|
|
6239
|
-
class Parser {
|
|
6830
|
+
class Parser$1 {
|
|
6240
6831
|
/**
|
|
6241
6832
|
* @param onNewLine - If defined, called separately with the start position of
|
|
6242
6833
|
* each new line (in `parse()`, including the start of input).
|
|
@@ -6259,7 +6850,7 @@ class Parser {
|
|
|
6259
6850
|
/** The type of the current token, set in parse() */
|
|
6260
6851
|
this.type = '';
|
|
6261
6852
|
// Must be defined after `next()`
|
|
6262
|
-
this.lexer = new Lexer();
|
|
6853
|
+
this.lexer = new lexer$1.Lexer();
|
|
6263
6854
|
this.onNewLine = onNewLine;
|
|
6264
6855
|
}
|
|
6265
6856
|
/**
|
|
@@ -6283,13 +6874,15 @@ class Parser {
|
|
|
6283
6874
|
*/
|
|
6284
6875
|
*next(source) {
|
|
6285
6876
|
this.source = source;
|
|
6877
|
+
if (process.env.LOG_TOKENS)
|
|
6878
|
+
console.log('|', cst$1.prettyToken(source));
|
|
6286
6879
|
if (this.atScalar) {
|
|
6287
6880
|
this.atScalar = false;
|
|
6288
6881
|
yield* this.step();
|
|
6289
6882
|
this.offset += source.length;
|
|
6290
6883
|
return;
|
|
6291
6884
|
}
|
|
6292
|
-
const type = tokenType(source);
|
|
6885
|
+
const type = cst$1.tokenType(source);
|
|
6293
6886
|
if (!type) {
|
|
6294
6887
|
const message = `Not a YAML token: ${source}`;
|
|
6295
6888
|
yield* this.pop({ type: 'error', offset: this.offset, message, source });
|
|
@@ -7066,10 +7659,21 @@ class Parser {
|
|
|
7066
7659
|
}
|
|
7067
7660
|
}
|
|
7068
7661
|
|
|
7662
|
+
parser$2.Parser = Parser$1;
|
|
7663
|
+
|
|
7664
|
+
var publicApi$1 = {};
|
|
7665
|
+
|
|
7666
|
+
var composer$1 = composer$2;
|
|
7667
|
+
var Document$1 = Document$5;
|
|
7668
|
+
var errors$1 = errors$4;
|
|
7669
|
+
var log = log$2;
|
|
7670
|
+
var lineCounter$1 = lineCounter$2;
|
|
7671
|
+
var parser$1 = parser$2;
|
|
7672
|
+
|
|
7069
7673
|
function parseOptions(options) {
|
|
7070
7674
|
const prettyErrors = options.prettyErrors !== false;
|
|
7071
|
-
const lineCounter = options.lineCounter || (prettyErrors && new LineCounter()) || null;
|
|
7072
|
-
return { lineCounter, prettyErrors };
|
|
7675
|
+
const lineCounter$1$1 = options.lineCounter || (prettyErrors && new lineCounter$1.LineCounter()) || null;
|
|
7676
|
+
return { lineCounter: lineCounter$1$1, prettyErrors };
|
|
7073
7677
|
}
|
|
7074
7678
|
/**
|
|
7075
7679
|
* Parse the input as a stream of YAML documents.
|
|
@@ -7080,42 +7684,42 @@ function parseOptions(options) {
|
|
|
7080
7684
|
* EmptyStream and contain additional stream information. In
|
|
7081
7685
|
* TypeScript, you should use `'empty' in docs` as a type guard for it.
|
|
7082
7686
|
*/
|
|
7083
|
-
function parseAllDocuments(source, options = {}) {
|
|
7687
|
+
function parseAllDocuments$1(source, options = {}) {
|
|
7084
7688
|
const { lineCounter, prettyErrors } = parseOptions(options);
|
|
7085
|
-
const parser = new Parser(lineCounter?.addNewLine);
|
|
7086
|
-
const composer = new Composer(options);
|
|
7087
|
-
const docs = Array.from(composer.compose(parser.parse(source)));
|
|
7689
|
+
const parser$1$1 = new parser$1.Parser(lineCounter?.addNewLine);
|
|
7690
|
+
const composer$1$1 = new composer$1.Composer(options);
|
|
7691
|
+
const docs = Array.from(composer$1$1.compose(parser$1$1.parse(source)));
|
|
7088
7692
|
if (prettyErrors && lineCounter)
|
|
7089
7693
|
for (const doc of docs) {
|
|
7090
|
-
doc.errors.forEach(prettifyError(source, lineCounter));
|
|
7091
|
-
doc.warnings.forEach(prettifyError(source, lineCounter));
|
|
7694
|
+
doc.errors.forEach(errors$1.prettifyError(source, lineCounter));
|
|
7695
|
+
doc.warnings.forEach(errors$1.prettifyError(source, lineCounter));
|
|
7092
7696
|
}
|
|
7093
7697
|
if (docs.length > 0)
|
|
7094
7698
|
return docs;
|
|
7095
|
-
return Object.assign([], { empty: true }, composer.streamInfo());
|
|
7699
|
+
return Object.assign([], { empty: true }, composer$1$1.streamInfo());
|
|
7096
7700
|
}
|
|
7097
7701
|
/** Parse an input string into a single YAML.Document */
|
|
7098
|
-
function parseDocument(source, options = {}) {
|
|
7702
|
+
function parseDocument$1(source, options = {}) {
|
|
7099
7703
|
const { lineCounter, prettyErrors } = parseOptions(options);
|
|
7100
|
-
const parser = new Parser(lineCounter?.addNewLine);
|
|
7101
|
-
const composer = new Composer(options);
|
|
7704
|
+
const parser$1$1 = new parser$1.Parser(lineCounter?.addNewLine);
|
|
7705
|
+
const composer$1$1 = new composer$1.Composer(options);
|
|
7102
7706
|
// `doc` is always set by compose.end(true) at the very latest
|
|
7103
7707
|
let doc = null;
|
|
7104
|
-
for (const _doc of composer.compose(parser.parse(source), true, source.length)) {
|
|
7708
|
+
for (const _doc of composer$1$1.compose(parser$1$1.parse(source), true, source.length)) {
|
|
7105
7709
|
if (!doc)
|
|
7106
7710
|
doc = _doc;
|
|
7107
7711
|
else if (doc.options.logLevel !== 'silent') {
|
|
7108
|
-
doc.errors.push(new YAMLParseError(_doc.range.slice(0, 2), 'MULTIPLE_DOCS', 'Source contains multiple documents; please use YAML.parseAllDocuments()'));
|
|
7712
|
+
doc.errors.push(new errors$1.YAMLParseError(_doc.range.slice(0, 2), 'MULTIPLE_DOCS', 'Source contains multiple documents; please use YAML.parseAllDocuments()'));
|
|
7109
7713
|
break;
|
|
7110
7714
|
}
|
|
7111
7715
|
}
|
|
7112
7716
|
if (prettyErrors && lineCounter) {
|
|
7113
|
-
doc.errors.forEach(prettifyError(source, lineCounter));
|
|
7114
|
-
doc.warnings.forEach(prettifyError(source, lineCounter));
|
|
7717
|
+
doc.errors.forEach(errors$1.prettifyError(source, lineCounter));
|
|
7718
|
+
doc.warnings.forEach(errors$1.prettifyError(source, lineCounter));
|
|
7115
7719
|
}
|
|
7116
7720
|
return doc;
|
|
7117
7721
|
}
|
|
7118
|
-
function parse(src, reviver, options) {
|
|
7722
|
+
function parse$1(src, reviver, options) {
|
|
7119
7723
|
let _reviver = undefined;
|
|
7120
7724
|
if (typeof reviver === 'function') {
|
|
7121
7725
|
_reviver = reviver;
|
|
@@ -7123,10 +7727,10 @@ function parse(src, reviver, options) {
|
|
|
7123
7727
|
else if (options === undefined && reviver && typeof reviver === 'object') {
|
|
7124
7728
|
options = reviver;
|
|
7125
7729
|
}
|
|
7126
|
-
const doc = parseDocument(src, options);
|
|
7730
|
+
const doc = parseDocument$1(src, options);
|
|
7127
7731
|
if (!doc)
|
|
7128
7732
|
return null;
|
|
7129
|
-
doc.warnings.forEach(warning => warn(doc.options.logLevel, warning));
|
|
7733
|
+
doc.warnings.forEach(warning => log.warn(doc.options.logLevel, warning));
|
|
7130
7734
|
if (doc.errors.length > 0) {
|
|
7131
7735
|
if (doc.options.logLevel !== 'silent')
|
|
7132
7736
|
throw doc.errors[0];
|
|
@@ -7135,7 +7739,7 @@ function parse(src, reviver, options) {
|
|
|
7135
7739
|
}
|
|
7136
7740
|
return doc.toJS(Object.assign({ reviver: _reviver }, options));
|
|
7137
7741
|
}
|
|
7138
|
-
function stringify(value, replacer, options) {
|
|
7742
|
+
function stringify$1(value, replacer, options) {
|
|
7139
7743
|
let _replacer = null;
|
|
7140
7744
|
if (typeof replacer === 'function' || Array.isArray(replacer)) {
|
|
7141
7745
|
_replacer = replacer;
|
|
@@ -7154,31 +7758,86 @@ function stringify(value, replacer, options) {
|
|
|
7154
7758
|
if (!keepUndefined)
|
|
7155
7759
|
return undefined;
|
|
7156
7760
|
}
|
|
7157
|
-
return new Document(value, _replacer, options).toString(options);
|
|
7761
|
+
return new Document$1.Document(value, _replacer, options).toString(options);
|
|
7158
7762
|
}
|
|
7159
7763
|
|
|
7160
|
-
|
|
7764
|
+
publicApi$1.parse = parse$1;
|
|
7765
|
+
publicApi$1.parseAllDocuments = parseAllDocuments$1;
|
|
7766
|
+
publicApi$1.parseDocument = parseDocument$1;
|
|
7767
|
+
publicApi$1.stringify = stringify$1;
|
|
7768
|
+
|
|
7769
|
+
var composer = composer$2;
|
|
7770
|
+
var Document = Document$5;
|
|
7771
|
+
var Schema = Schema$3;
|
|
7772
|
+
var errors = errors$4;
|
|
7773
|
+
var Alias = Alias$5;
|
|
7774
|
+
var Node = Node$t;
|
|
7775
|
+
var Pair = Pair$9;
|
|
7776
|
+
var Scalar = Scalar$k;
|
|
7777
|
+
var YAMLMap = YAMLMap$7;
|
|
7778
|
+
var YAMLSeq = YAMLSeq$7;
|
|
7779
|
+
var cst = cst$3;
|
|
7780
|
+
var lexer = lexer$2;
|
|
7781
|
+
var lineCounter = lineCounter$2;
|
|
7782
|
+
var parser = parser$2;
|
|
7783
|
+
var publicApi = publicApi$1;
|
|
7784
|
+
var visit = visit$6;
|
|
7785
|
+
|
|
7786
|
+
|
|
7787
|
+
|
|
7788
|
+
var Composer = dist.Composer = composer.Composer;
|
|
7789
|
+
var Document_1 = dist.Document = Document.Document;
|
|
7790
|
+
var Schema_1 = dist.Schema = Schema.Schema;
|
|
7791
|
+
var YAMLError = dist.YAMLError = errors.YAMLError;
|
|
7792
|
+
var YAMLParseError = dist.YAMLParseError = errors.YAMLParseError;
|
|
7793
|
+
var YAMLWarning = dist.YAMLWarning = errors.YAMLWarning;
|
|
7794
|
+
var Alias_1 = dist.Alias = Alias.Alias;
|
|
7795
|
+
var isAlias = dist.isAlias = Node.isAlias;
|
|
7796
|
+
var isCollection = dist.isCollection = Node.isCollection;
|
|
7797
|
+
var isDocument = dist.isDocument = Node.isDocument;
|
|
7798
|
+
var isMap = dist.isMap = Node.isMap;
|
|
7799
|
+
var isNode = dist.isNode = Node.isNode;
|
|
7800
|
+
var isPair = dist.isPair = Node.isPair;
|
|
7801
|
+
var isScalar = dist.isScalar = Node.isScalar;
|
|
7802
|
+
var isSeq = dist.isSeq = Node.isSeq;
|
|
7803
|
+
var Pair_1 = dist.Pair = Pair.Pair;
|
|
7804
|
+
var Scalar_1 = dist.Scalar = Scalar.Scalar;
|
|
7805
|
+
var YAMLMap_1 = dist.YAMLMap = YAMLMap.YAMLMap;
|
|
7806
|
+
var YAMLSeq_1 = dist.YAMLSeq = YAMLSeq.YAMLSeq;
|
|
7807
|
+
var CST = dist.CST = cst;
|
|
7808
|
+
var Lexer = dist.Lexer = lexer.Lexer;
|
|
7809
|
+
var LineCounter = dist.LineCounter = lineCounter.LineCounter;
|
|
7810
|
+
var Parser = dist.Parser = parser.Parser;
|
|
7811
|
+
var parse = dist.parse = publicApi.parse;
|
|
7812
|
+
var parseAllDocuments = dist.parseAllDocuments = publicApi.parseAllDocuments;
|
|
7813
|
+
var parseDocument = dist.parseDocument = publicApi.parseDocument;
|
|
7814
|
+
var stringify = dist.stringify = publicApi.stringify;
|
|
7815
|
+
var visit_1 = dist.visit = visit.visit;
|
|
7816
|
+
var visitAsync = dist.visitAsync = visit.visitAsync;
|
|
7817
|
+
|
|
7818
|
+
var index = /*#__PURE__*/_mergeNamespaces({
|
|
7161
7819
|
__proto__: null,
|
|
7162
|
-
|
|
7820
|
+
'default': dist,
|
|
7163
7821
|
Composer: Composer,
|
|
7164
|
-
Document:
|
|
7165
|
-
Schema:
|
|
7822
|
+
Document: Document_1,
|
|
7823
|
+
Schema: Schema_1,
|
|
7166
7824
|
YAMLError: YAMLError,
|
|
7167
7825
|
YAMLParseError: YAMLParseError,
|
|
7168
7826
|
YAMLWarning: YAMLWarning,
|
|
7169
|
-
Alias:
|
|
7827
|
+
Alias: Alias_1,
|
|
7170
7828
|
isAlias: isAlias,
|
|
7171
|
-
isCollection: isCollection
|
|
7829
|
+
isCollection: isCollection,
|
|
7172
7830
|
isDocument: isDocument,
|
|
7173
7831
|
isMap: isMap,
|
|
7174
7832
|
isNode: isNode,
|
|
7175
7833
|
isPair: isPair,
|
|
7176
|
-
isScalar: isScalar
|
|
7834
|
+
isScalar: isScalar,
|
|
7177
7835
|
isSeq: isSeq,
|
|
7178
|
-
Pair:
|
|
7179
|
-
Scalar:
|
|
7180
|
-
YAMLMap:
|
|
7181
|
-
YAMLSeq:
|
|
7836
|
+
Pair: Pair_1,
|
|
7837
|
+
Scalar: Scalar_1,
|
|
7838
|
+
YAMLMap: YAMLMap_1,
|
|
7839
|
+
YAMLSeq: YAMLSeq_1,
|
|
7840
|
+
CST: CST,
|
|
7182
7841
|
Lexer: Lexer,
|
|
7183
7842
|
LineCounter: LineCounter,
|
|
7184
7843
|
Parser: Parser,
|
|
@@ -7186,10 +7845,8 @@ var YAML = /*#__PURE__*/Object.freeze({
|
|
|
7186
7845
|
parseAllDocuments: parseAllDocuments,
|
|
7187
7846
|
parseDocument: parseDocument,
|
|
7188
7847
|
stringify: stringify,
|
|
7189
|
-
visit:
|
|
7848
|
+
visit: visit_1,
|
|
7190
7849
|
visitAsync: visitAsync
|
|
7191
|
-
});
|
|
7192
|
-
|
|
7193
|
-
// `export * as default from ...` fails on Webpack v4
|
|
7850
|
+
}, [dist]);
|
|
7194
7851
|
|
|
7195
|
-
export {
|
|
7852
|
+
export { index as i };
|