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