@caiquecamargo/vite-plugin-netlify-cms 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +58 -57
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.es.js +495 -491
- package/dist/index.es.js.map +1 -0
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { readdir as
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
const ut = Symbol.for("yaml.alias"), ot = Symbol.for("yaml.document"), W = Symbol.for("yaml.map"), Ft = Symbol.for("yaml.pair"), R = Symbol.for("yaml.scalar"), ce = Symbol.for("yaml.seq"), M = Symbol.for("yaml.node.type"), X = (s) => !!s && typeof s == "object" && s[M] === ut, ke = (s) => !!s && typeof s == "object" && s[M] === ot, z = (s) => !!s && typeof s == "object" && s[M] === W, I = (s) => !!s && typeof s == "object" && s[M] === Ft, A = (s) => !!s && typeof s == "object" && s[M] === R, fe = (s) => !!s && typeof s == "object" && s[M] === ce;
|
|
1
|
+
import { readdir as $s, mkdir as Cs, writeFile as vs, readFile as _s } from "fs/promises";
|
|
2
|
+
import Xe from "path";
|
|
3
|
+
const ft = Symbol.for("yaml.alias"), rt = Symbol.for("yaml.document"), W = Symbol.for("yaml.map"), Kt = Symbol.for("yaml.pair"), R = Symbol.for("yaml.scalar"), ce = Symbol.for("yaml.seq"), M = Symbol.for("yaml.node.type"), X = (s) => !!s && typeof s == "object" && s[M] === ft, ke = (s) => !!s && typeof s == "object" && s[M] === rt, z = (s) => !!s && typeof s == "object" && s[M] === W, I = (s) => !!s && typeof s == "object" && s[M] === Kt, A = (s) => !!s && typeof s == "object" && s[M] === R, fe = (s) => !!s && typeof s == "object" && s[M] === ce;
|
|
5
4
|
function L(s) {
|
|
6
5
|
if (s && typeof s == "object")
|
|
7
6
|
switch (s[M]) {
|
|
@@ -14,7 +13,7 @@ function L(s) {
|
|
|
14
13
|
function T(s) {
|
|
15
14
|
if (s && typeof s == "object")
|
|
16
15
|
switch (s[M]) {
|
|
17
|
-
case
|
|
16
|
+
case ft:
|
|
18
17
|
case W:
|
|
19
18
|
case R:
|
|
20
19
|
case ce:
|
|
@@ -22,8 +21,8 @@ function T(s) {
|
|
|
22
21
|
}
|
|
23
22
|
return !1;
|
|
24
23
|
}
|
|
25
|
-
const
|
|
26
|
-
class
|
|
24
|
+
const Bs = (s) => (A(s) || L(s)) && !!s.anchor;
|
|
25
|
+
class ut {
|
|
27
26
|
constructor(e) {
|
|
28
27
|
Object.defineProperty(this, M, { value: e });
|
|
29
28
|
}
|
|
@@ -33,18 +32,18 @@ class ht {
|
|
|
33
32
|
return this.range && (e.range = this.range.slice()), e;
|
|
34
33
|
}
|
|
35
34
|
}
|
|
36
|
-
const
|
|
35
|
+
const v = Symbol("break visit"), Ft = Symbol("skip children"), K = Symbol("remove node");
|
|
37
36
|
function J(s, e) {
|
|
38
|
-
const t =
|
|
37
|
+
const t = qt(e);
|
|
39
38
|
ke(s) ? ne(null, s.contents, t, Object.freeze([s])) === K && (s.contents = null) : ne(null, s, t, Object.freeze([]));
|
|
40
39
|
}
|
|
41
|
-
J.BREAK =
|
|
42
|
-
J.SKIP =
|
|
40
|
+
J.BREAK = v;
|
|
41
|
+
J.SKIP = Ft;
|
|
43
42
|
J.REMOVE = K;
|
|
44
43
|
function ne(s, e, t, n) {
|
|
45
|
-
const i =
|
|
44
|
+
const i = Ut(s, e, t, n);
|
|
46
45
|
if (T(i) || I(i))
|
|
47
|
-
return
|
|
46
|
+
return Rt(s, n, i), ne(s, i, t, n);
|
|
48
47
|
if (typeof i != "symbol") {
|
|
49
48
|
if (L(e)) {
|
|
50
49
|
n = Object.freeze(n.concat(e));
|
|
@@ -53,36 +52,36 @@ function ne(s, e, t, n) {
|
|
|
53
52
|
if (typeof o == "number")
|
|
54
53
|
r = o - 1;
|
|
55
54
|
else {
|
|
56
|
-
if (o ===
|
|
57
|
-
return
|
|
55
|
+
if (o === v)
|
|
56
|
+
return v;
|
|
58
57
|
o === K && (e.items.splice(r, 1), r -= 1);
|
|
59
58
|
}
|
|
60
59
|
}
|
|
61
60
|
} else if (I(e)) {
|
|
62
61
|
n = Object.freeze(n.concat(e));
|
|
63
62
|
const r = ne("key", e.key, t, n);
|
|
64
|
-
if (r ===
|
|
65
|
-
return
|
|
63
|
+
if (r === v)
|
|
64
|
+
return v;
|
|
66
65
|
r === K && (e.key = null);
|
|
67
66
|
const o = ne("value", e.value, t, n);
|
|
68
|
-
if (o ===
|
|
69
|
-
return
|
|
67
|
+
if (o === v)
|
|
68
|
+
return v;
|
|
70
69
|
o === K && (e.value = null);
|
|
71
70
|
}
|
|
72
71
|
}
|
|
73
72
|
return i;
|
|
74
73
|
}
|
|
75
|
-
async function
|
|
76
|
-
const t =
|
|
74
|
+
async function Pe(s, e) {
|
|
75
|
+
const t = qt(e);
|
|
77
76
|
ke(s) ? await ie(null, s.contents, t, Object.freeze([s])) === K && (s.contents = null) : await ie(null, s, t, Object.freeze([]));
|
|
78
77
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
Pe.BREAK = v;
|
|
79
|
+
Pe.SKIP = Ft;
|
|
80
|
+
Pe.REMOVE = K;
|
|
82
81
|
async function ie(s, e, t, n) {
|
|
83
|
-
const i = await
|
|
82
|
+
const i = await Ut(s, e, t, n);
|
|
84
83
|
if (T(i) || I(i))
|
|
85
|
-
return
|
|
84
|
+
return Rt(s, n, i), ie(s, i, t, n);
|
|
86
85
|
if (typeof i != "symbol") {
|
|
87
86
|
if (L(e)) {
|
|
88
87
|
n = Object.freeze(n.concat(e));
|
|
@@ -91,26 +90,26 @@ async function ie(s, e, t, n) {
|
|
|
91
90
|
if (typeof o == "number")
|
|
92
91
|
r = o - 1;
|
|
93
92
|
else {
|
|
94
|
-
if (o ===
|
|
95
|
-
return
|
|
93
|
+
if (o === v)
|
|
94
|
+
return v;
|
|
96
95
|
o === K && (e.items.splice(r, 1), r -= 1);
|
|
97
96
|
}
|
|
98
97
|
}
|
|
99
98
|
} else if (I(e)) {
|
|
100
99
|
n = Object.freeze(n.concat(e));
|
|
101
100
|
const r = await ie("key", e.key, t, n);
|
|
102
|
-
if (r ===
|
|
103
|
-
return
|
|
101
|
+
if (r === v)
|
|
102
|
+
return v;
|
|
104
103
|
r === K && (e.key = null);
|
|
105
104
|
const o = await ie("value", e.value, t, n);
|
|
106
|
-
if (o ===
|
|
107
|
-
return
|
|
105
|
+
if (o === v)
|
|
106
|
+
return v;
|
|
108
107
|
o === K && (e.value = null);
|
|
109
108
|
}
|
|
110
109
|
}
|
|
111
110
|
return i;
|
|
112
111
|
}
|
|
113
|
-
function
|
|
112
|
+
function qt(s) {
|
|
114
113
|
return typeof s == "object" && (s.Collection || s.Node || s.Value) ? Object.assign({
|
|
115
114
|
Alias: s.Node,
|
|
116
115
|
Map: s.Node,
|
|
@@ -125,7 +124,7 @@ function Ut(s) {
|
|
|
125
124
|
Seq: s.Collection
|
|
126
125
|
}, s) : s;
|
|
127
126
|
}
|
|
128
|
-
function
|
|
127
|
+
function Ut(s, e, t, n) {
|
|
129
128
|
if (typeof t == "function")
|
|
130
129
|
return t(s, e, n);
|
|
131
130
|
if (z(e))
|
|
@@ -139,7 +138,7 @@ function Rt(s, e, t, n) {
|
|
|
139
138
|
if (X(e))
|
|
140
139
|
return t.Alias?.(s, e, n);
|
|
141
140
|
}
|
|
142
|
-
function
|
|
141
|
+
function Rt(s, e, t) {
|
|
143
142
|
const n = e[e.length - 1];
|
|
144
143
|
if (L(n))
|
|
145
144
|
n.items[s] = t;
|
|
@@ -152,14 +151,14 @@ function Vt(s, e, t) {
|
|
|
152
151
|
throw new Error(`Cannot replace node with ${i} parent`);
|
|
153
152
|
}
|
|
154
153
|
}
|
|
155
|
-
const
|
|
154
|
+
const js = {
|
|
156
155
|
"!": "%21",
|
|
157
156
|
",": "%2C",
|
|
158
157
|
"[": "%5B",
|
|
159
158
|
"]": "%5D",
|
|
160
159
|
"{": "%7B",
|
|
161
160
|
"}": "%7D"
|
|
162
|
-
},
|
|
161
|
+
}, Ms = (s) => s.replace(/[!,[\]{}]/g, (e) => js[e]);
|
|
163
162
|
class C {
|
|
164
163
|
constructor(e, t) {
|
|
165
164
|
this.docStart = null, this.docEnd = !1, this.yaml = Object.assign({}, C.defaultYaml, e), this.tags = Object.assign({}, C.defaultTags, t);
|
|
@@ -243,7 +242,7 @@ class C {
|
|
|
243
242
|
tagString(e) {
|
|
244
243
|
for (const [t, n] of Object.entries(this.tags))
|
|
245
244
|
if (e.startsWith(n))
|
|
246
|
-
return t +
|
|
245
|
+
return t + Ms(e.substring(n.length));
|
|
247
246
|
return e[0] === "!" ? e : `!<${e}>`;
|
|
248
247
|
}
|
|
249
248
|
toString(e) {
|
|
@@ -264,14 +263,14 @@ class C {
|
|
|
264
263
|
}
|
|
265
264
|
C.defaultYaml = { explicit: !1, version: "1.2" };
|
|
266
265
|
C.defaultTags = { "!!": "tag:yaml.org,2002:" };
|
|
267
|
-
function
|
|
266
|
+
function Vt(s) {
|
|
268
267
|
if (/[\x00-\x19\s,[\]{}]/.test(s)) {
|
|
269
268
|
const t = `Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;
|
|
270
269
|
throw new Error(t);
|
|
271
270
|
}
|
|
272
271
|
return !0;
|
|
273
272
|
}
|
|
274
|
-
function
|
|
273
|
+
function Wt(s) {
|
|
275
274
|
const e = /* @__PURE__ */ new Set();
|
|
276
275
|
return J(s, {
|
|
277
276
|
Value(t, n) {
|
|
@@ -279,20 +278,20 @@ function Jt(s) {
|
|
|
279
278
|
}
|
|
280
279
|
}), e;
|
|
281
280
|
}
|
|
282
|
-
function
|
|
281
|
+
function Jt(s, e) {
|
|
283
282
|
for (let t = 1; ; ++t) {
|
|
284
283
|
const n = `${s}${t}`;
|
|
285
284
|
if (!e.has(n))
|
|
286
285
|
return n;
|
|
287
286
|
}
|
|
288
287
|
}
|
|
289
|
-
function
|
|
288
|
+
function Ps(s, e) {
|
|
290
289
|
const t = [], n = /* @__PURE__ */ new Map();
|
|
291
290
|
let i = null;
|
|
292
291
|
return {
|
|
293
292
|
onAnchor: (r) => {
|
|
294
|
-
t.push(r), i || (i =
|
|
295
|
-
const o =
|
|
293
|
+
t.push(r), i || (i = Wt(s));
|
|
294
|
+
const o = Jt(e, i);
|
|
296
295
|
return i.add(o), o;
|
|
297
296
|
},
|
|
298
297
|
/**
|
|
@@ -314,9 +313,9 @@ function Ks(s, e) {
|
|
|
314
313
|
sourceObjects: n
|
|
315
314
|
};
|
|
316
315
|
}
|
|
317
|
-
class
|
|
316
|
+
class De extends ut {
|
|
318
317
|
constructor(e) {
|
|
319
|
-
super(
|
|
318
|
+
super(ft), this.source = e, Object.defineProperty(this, "tag", {
|
|
320
319
|
set() {
|
|
321
320
|
throw new Error("Alias nodes cannot have tags");
|
|
322
321
|
}
|
|
@@ -349,7 +348,7 @@ class Ke extends ht {
|
|
|
349
348
|
const a = "This should not happen: Alias anchor was not resolved?";
|
|
350
349
|
throw new ReferenceError(a);
|
|
351
350
|
}
|
|
352
|
-
if (r >= 0 && (l.count += 1, l.aliasCount === 0 && (l.aliasCount =
|
|
351
|
+
if (r >= 0 && (l.count += 1, l.aliasCount === 0 && (l.aliasCount = Te(i, o, n)), l.count * l.aliasCount > r)) {
|
|
353
352
|
const a = "Excessive alias count indicates a resource exhaustion attack";
|
|
354
353
|
throw new ReferenceError(a);
|
|
355
354
|
}
|
|
@@ -358,7 +357,7 @@ class Ke extends ht {
|
|
|
358
357
|
toString(e, t, n) {
|
|
359
358
|
const i = `*${this.source}`;
|
|
360
359
|
if (e) {
|
|
361
|
-
if (
|
|
360
|
+
if (Vt(this.source), e.options.verifyAliasOrder && !e.anchors.has(this.source)) {
|
|
362
361
|
const r = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
|
|
363
362
|
throw new Error(r);
|
|
364
363
|
}
|
|
@@ -368,19 +367,19 @@ class Ke extends ht {
|
|
|
368
367
|
return i;
|
|
369
368
|
}
|
|
370
369
|
}
|
|
371
|
-
function
|
|
370
|
+
function Te(s, e, t) {
|
|
372
371
|
if (X(e)) {
|
|
373
372
|
const n = e.resolve(s), i = t && n && t.get(n);
|
|
374
373
|
return i ? i.count * i.aliasCount : 0;
|
|
375
374
|
} else if (L(e)) {
|
|
376
375
|
let n = 0;
|
|
377
376
|
for (const i of e.items) {
|
|
378
|
-
const r =
|
|
377
|
+
const r = Te(s, i, t);
|
|
379
378
|
r > n && (n = r);
|
|
380
379
|
}
|
|
381
380
|
return n;
|
|
382
381
|
} else if (I(e)) {
|
|
383
|
-
const n =
|
|
382
|
+
const n = Te(s, e.key, t), i = Te(s, e.value, t);
|
|
384
383
|
return Math.max(n, i);
|
|
385
384
|
}
|
|
386
385
|
return 1;
|
|
@@ -389,7 +388,7 @@ function F(s, e, t) {
|
|
|
389
388
|
if (Array.isArray(s))
|
|
390
389
|
return s.map((n, i) => F(n, String(i), t));
|
|
391
390
|
if (s && typeof s.toJSON == "function") {
|
|
392
|
-
if (!t || !
|
|
391
|
+
if (!t || !Bs(s))
|
|
393
392
|
return s.toJSON(e, t);
|
|
394
393
|
const n = { aliasCount: 0, count: 1, res: void 0 };
|
|
395
394
|
t.anchors.set(s, n), t.onCreate = (r) => {
|
|
@@ -400,8 +399,8 @@ function F(s, e, t) {
|
|
|
400
399
|
}
|
|
401
400
|
return typeof s == "bigint" && !t?.keep ? Number(s) : s;
|
|
402
401
|
}
|
|
403
|
-
const
|
|
404
|
-
class N extends
|
|
402
|
+
const Yt = (s) => !s || typeof s != "function" && typeof s != "object";
|
|
403
|
+
class N extends ut {
|
|
405
404
|
constructor(e) {
|
|
406
405
|
super(R), this.value = e;
|
|
407
406
|
}
|
|
@@ -417,8 +416,8 @@ N.BLOCK_LITERAL = "BLOCK_LITERAL";
|
|
|
417
416
|
N.PLAIN = "PLAIN";
|
|
418
417
|
N.QUOTE_DOUBLE = "QUOTE_DOUBLE";
|
|
419
418
|
N.QUOTE_SINGLE = "QUOTE_SINGLE";
|
|
420
|
-
const
|
|
421
|
-
function
|
|
419
|
+
const Ds = "tag:yaml.org,2002:";
|
|
420
|
+
function Ks(s, e, t) {
|
|
422
421
|
if (e) {
|
|
423
422
|
const n = t.filter((r) => r.tag === e), i = n.find((r) => !r.format) ?? n[0];
|
|
424
423
|
if (!i)
|
|
@@ -439,11 +438,11 @@ function be(s, e, t) {
|
|
|
439
438
|
let a;
|
|
440
439
|
if (n && s && typeof s == "object") {
|
|
441
440
|
if (a = l.get(s), a)
|
|
442
|
-
return a.anchor || (a.anchor = i(s)), new
|
|
441
|
+
return a.anchor || (a.anchor = i(s)), new De(a.anchor);
|
|
443
442
|
a = { anchor: null, node: null }, l.set(s, a);
|
|
444
443
|
}
|
|
445
|
-
e?.startsWith("!!") && (e =
|
|
446
|
-
let c =
|
|
444
|
+
e?.startsWith("!!") && (e = Ds + e.slice(2));
|
|
445
|
+
let c = Ks(s, e, o.tags);
|
|
447
446
|
if (!c) {
|
|
448
447
|
if (s && typeof s.toJSON == "function" && (s = s.toJSON()), !s || typeof s != "object") {
|
|
449
448
|
const f = new N(s);
|
|
@@ -455,7 +454,7 @@ function be(s, e, t) {
|
|
|
455
454
|
const u = c?.createNode ? c.createNode(t.schema, s, t) : new N(s);
|
|
456
455
|
return e && (u.tag = e), a && (a.node = u), u;
|
|
457
456
|
}
|
|
458
|
-
function
|
|
457
|
+
function _e(s, e, t) {
|
|
459
458
|
let n = t;
|
|
460
459
|
for (let i = e.length - 1; i >= 0; --i) {
|
|
461
460
|
const r = e[i];
|
|
@@ -476,7 +475,7 @@ function Be(s, e, t) {
|
|
|
476
475
|
});
|
|
477
476
|
}
|
|
478
477
|
const me = (s) => s == null || typeof s == "object" && !!s[Symbol.iterator]().next().done;
|
|
479
|
-
class
|
|
478
|
+
class Ke extends ut {
|
|
480
479
|
constructor(e, t) {
|
|
481
480
|
super(e), Object.defineProperty(this, "schema", {
|
|
482
481
|
value: t,
|
|
@@ -507,7 +506,7 @@ class Fe extends ht {
|
|
|
507
506
|
if (L(r))
|
|
508
507
|
r.addIn(i, t);
|
|
509
508
|
else if (r === void 0 && this.schema)
|
|
510
|
-
this.set(n,
|
|
509
|
+
this.set(n, _e(this.schema, i, t));
|
|
511
510
|
else
|
|
512
511
|
throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`);
|
|
513
512
|
}
|
|
@@ -565,22 +564,22 @@ class Fe extends ht {
|
|
|
565
564
|
if (L(r))
|
|
566
565
|
r.setIn(i, t);
|
|
567
566
|
else if (r === void 0 && this.schema)
|
|
568
|
-
this.set(n,
|
|
567
|
+
this.set(n, _e(this.schema, i, t));
|
|
569
568
|
else
|
|
570
569
|
throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`);
|
|
571
570
|
}
|
|
572
571
|
}
|
|
573
572
|
}
|
|
574
|
-
|
|
575
|
-
const
|
|
573
|
+
Ke.maxFlowStringSingleLineLength = 60;
|
|
574
|
+
const Fs = (s) => s.replace(/^(?!$)(?: $)?/gm, "#");
|
|
576
575
|
function U(s, e) {
|
|
577
576
|
return /^\n+$/.test(s) ? s.substring(1) : e ? s.replace(/^(?! *$)/gm, e) : s;
|
|
578
577
|
}
|
|
579
578
|
const V = (s, e, t) => s.endsWith(`
|
|
580
579
|
`) ? U(t, e) : t.includes(`
|
|
581
580
|
`) ? `
|
|
582
|
-
` + U(t, e) : (s.endsWith(" ") ? "" : " ") + t,
|
|
583
|
-
function
|
|
581
|
+
` + U(t, e) : (s.endsWith(" ") ? "" : " ") + t, Gt = "flow", ot = "block", $e = "quoted";
|
|
582
|
+
function Fe(s, e, t = "flow", { indentAtStart: n, lineWidth: i = 80, minContentWidth: r = 20, onFold: o, onOverflow: l } = {}) {
|
|
584
583
|
if (!i || i < 0)
|
|
585
584
|
return s;
|
|
586
585
|
const a = Math.max(1 + r, 1 + i - e.length);
|
|
@@ -590,9 +589,9 @@ function qe(s, e, t = "flow", { indentAtStart: n, lineWidth: i = 80, minContentW
|
|
|
590
589
|
let f = i - e.length;
|
|
591
590
|
typeof n == "number" && (n > i - Math.max(2, r) ? c.push(0) : f = i - n);
|
|
592
591
|
let h, p, y = !1, d = -1, m = -1, b = -1;
|
|
593
|
-
t ===
|
|
592
|
+
t === ot && (d = It(s, d), d !== -1 && (f = d + a));
|
|
594
593
|
for (let k; k = s[d += 1]; ) {
|
|
595
|
-
if (t ===
|
|
594
|
+
if (t === $e && k === "\\") {
|
|
596
595
|
switch (m = d, s[d + 1]) {
|
|
597
596
|
case "x":
|
|
598
597
|
d += 3;
|
|
@@ -610,7 +609,7 @@ function qe(s, e, t = "flow", { indentAtStart: n, lineWidth: i = 80, minContentW
|
|
|
610
609
|
}
|
|
611
610
|
if (k === `
|
|
612
611
|
`)
|
|
613
|
-
t ===
|
|
612
|
+
t === ot && (d = It(s, d)), f = d + a, h = void 0;
|
|
614
613
|
else {
|
|
615
614
|
if (k === " " && p && p !== " " && p !== `
|
|
616
615
|
` && p !== " ") {
|
|
@@ -621,7 +620,7 @@ function qe(s, e, t = "flow", { indentAtStart: n, lineWidth: i = 80, minContentW
|
|
|
621
620
|
if (d >= f)
|
|
622
621
|
if (h)
|
|
623
622
|
c.push(h), f = h + a, h = void 0;
|
|
624
|
-
else if (t ===
|
|
623
|
+
else if (t === $e) {
|
|
625
624
|
for (; p === " " || p === " "; )
|
|
626
625
|
p = k, k = s[d += 1], y = !0;
|
|
627
626
|
const S = d > b + 1 ? d - 2 : m - 1;
|
|
@@ -640,12 +639,12 @@ function qe(s, e, t = "flow", { indentAtStart: n, lineWidth: i = 80, minContentW
|
|
|
640
639
|
for (let k = 0; k < c.length; ++k) {
|
|
641
640
|
const S = c[k], O = c[k + 1] || s.length;
|
|
642
641
|
S === 0 ? w = `
|
|
643
|
-
${e}${s.slice(0, O)}` : (t ===
|
|
642
|
+
${e}${s.slice(0, O)}` : (t === $e && u[S] && (w += `${s[S]}\\`), w += `
|
|
644
643
|
${e}${s.slice(S + 1, O)}`);
|
|
645
644
|
}
|
|
646
645
|
return w;
|
|
647
646
|
}
|
|
648
|
-
function
|
|
647
|
+
function It(s, e) {
|
|
649
648
|
let t = s[e + 1];
|
|
650
649
|
for (; t === " " || t === " "; ) {
|
|
651
650
|
do
|
|
@@ -656,12 +655,12 @@ function Lt(s, e) {
|
|
|
656
655
|
}
|
|
657
656
|
return e;
|
|
658
657
|
}
|
|
659
|
-
const
|
|
658
|
+
const qe = (s) => ({
|
|
660
659
|
indentAtStart: s.indentAtStart,
|
|
661
660
|
lineWidth: s.options.lineWidth,
|
|
662
661
|
minContentWidth: s.options.minContentWidth
|
|
663
|
-
}),
|
|
664
|
-
function
|
|
662
|
+
}), Ue = (s) => /^(%|---|\.\.\.)/m.test(s);
|
|
663
|
+
function qs(s, e, t) {
|
|
665
664
|
if (!e || e < 0)
|
|
666
665
|
return !1;
|
|
667
666
|
const n = e - t, i = s.length;
|
|
@@ -681,7 +680,7 @@ function ye(s, e) {
|
|
|
681
680
|
const t = JSON.stringify(s);
|
|
682
681
|
if (e.options.doubleQuotedAsJSON)
|
|
683
682
|
return t;
|
|
684
|
-
const { implicitKey: n } = e, i = e.options.doubleQuotedMinMultiLineLength, r = e.indent || (
|
|
683
|
+
const { implicitKey: n } = e, i = e.options.doubleQuotedMinMultiLineLength, r = e.indent || (Ue(s) ? " " : "");
|
|
685
684
|
let o = "", l = 0;
|
|
686
685
|
for (let a = 0, c = t[a]; c; c = t[++a])
|
|
687
686
|
if (c === " " && t[a + 1] === "\\" && t[a + 2] === "n" && (o += t.slice(l, a) + "\\ ", a += 1, l = a, c = "\\"), c === "\\")
|
|
@@ -736,15 +735,15 @@ function ye(s, e) {
|
|
|
736
735
|
default:
|
|
737
736
|
a += 1;
|
|
738
737
|
}
|
|
739
|
-
return o = l ? o + t.slice(l) : t, n ? o :
|
|
738
|
+
return o = l ? o + t.slice(l) : t, n ? o : Fe(o, r, $e, qe(e));
|
|
740
739
|
}
|
|
741
|
-
function
|
|
740
|
+
function lt(s, e) {
|
|
742
741
|
if (e.options.singleQuote === !1 || e.implicitKey && s.includes(`
|
|
743
742
|
`) || /[ \t]\n|\n[ \t]/.test(s))
|
|
744
743
|
return ye(s, e);
|
|
745
|
-
const t = e.indent || (
|
|
744
|
+
const t = e.indent || (Ue(s) ? " " : ""), n = "'" + s.replace(/'/g, "''").replace(/\n+/g, `$&
|
|
746
745
|
${t}`) + "'";
|
|
747
|
-
return e.implicitKey ? n :
|
|
746
|
+
return e.implicitKey ? n : Fe(n, t, Gt, qe(e));
|
|
748
747
|
}
|
|
749
748
|
function re(s, e) {
|
|
750
749
|
const { singleQuote: t } = e.options;
|
|
@@ -753,15 +752,15 @@ function re(s, e) {
|
|
|
753
752
|
n = ye;
|
|
754
753
|
else {
|
|
755
754
|
const i = s.includes('"'), r = s.includes("'");
|
|
756
|
-
i && !r ? n =
|
|
755
|
+
i && !r ? n = lt : r && !i ? n = ye : n = t ? lt : ye;
|
|
757
756
|
}
|
|
758
757
|
return n(s, e);
|
|
759
758
|
}
|
|
760
|
-
function
|
|
759
|
+
function Ce({ comment: s, type: e, value: t }, n, i, r) {
|
|
761
760
|
const { blockQuote: o, commentString: l, lineWidth: a } = n.options;
|
|
762
761
|
if (!o || /\n[\t ]+$/.test(t) || /^\s*$/.test(t))
|
|
763
762
|
return re(t, n);
|
|
764
|
-
const c = n.indent || (n.forceBlockIndent ||
|
|
763
|
+
const c = n.indent || (n.forceBlockIndent || Ue(t) ? " " : ""), u = o === "literal" ? !0 : o === "folded" || e === N.BLOCK_FOLDED ? !1 : e === N.BLOCK_LITERAL ? !0 : !qs(t, a, c.length);
|
|
765
764
|
if (!t)
|
|
766
765
|
return u ? `|
|
|
767
766
|
` : `>
|
|
@@ -797,23 +796,23 @@ function _e({ comment: s, type: e, value: t }, n, i, r) {
|
|
|
797
796
|
${c}${w}${t}${p}`;
|
|
798
797
|
t = t.replace(/\n+/g, `
|
|
799
798
|
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, "$1$2").replace(/\n+/g, `$&${c}`);
|
|
800
|
-
const O =
|
|
799
|
+
const O = Fe(`${w}${t}${p}`, c, ot, qe(n));
|
|
801
800
|
return `${S}
|
|
802
801
|
${c}${O}`;
|
|
803
802
|
}
|
|
804
|
-
function
|
|
803
|
+
function Us(s, e, t, n) {
|
|
805
804
|
const { type: i, value: r } = s, { actualString: o, implicitKey: l, indent: a, indentStep: c, inFlow: u } = e;
|
|
806
805
|
if (l && /[\n[\]{},]/.test(r) || u && /[[\]{},]/.test(r))
|
|
807
806
|
return re(r, e);
|
|
808
807
|
if (!r || /^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))
|
|
809
808
|
return l || u || !r.includes(`
|
|
810
|
-
`) ? re(r, e) :
|
|
809
|
+
`) ? re(r, e) : Ce(s, e, t, n);
|
|
811
810
|
if (!l && !u && i !== N.PLAIN && r.includes(`
|
|
812
811
|
`))
|
|
813
|
-
return
|
|
814
|
-
if (
|
|
812
|
+
return Ce(s, e, t, n);
|
|
813
|
+
if (Ue(r)) {
|
|
815
814
|
if (a === "")
|
|
816
|
-
return e.forceBlockIndent = !0,
|
|
815
|
+
return e.forceBlockIndent = !0, Ce(s, e, t, n);
|
|
817
816
|
if (l && a === c)
|
|
818
817
|
return re(r, e);
|
|
819
818
|
}
|
|
@@ -824,7 +823,7 @@ ${a}`);
|
|
|
824
823
|
if (y.some(h) || p?.some(h))
|
|
825
824
|
return re(r, e);
|
|
826
825
|
}
|
|
827
|
-
return l ? f :
|
|
826
|
+
return l ? f : Fe(f, a, Gt, qe(e));
|
|
828
827
|
}
|
|
829
828
|
function Ne(s, e, t, n) {
|
|
830
829
|
const { implicitKey: i, inFlow: r } = e, o = typeof s.value == "string" ? s : Object.assign({}, s, { value: String(s.value) });
|
|
@@ -834,13 +833,13 @@ function Ne(s, e, t, n) {
|
|
|
834
833
|
switch (u) {
|
|
835
834
|
case N.BLOCK_FOLDED:
|
|
836
835
|
case N.BLOCK_LITERAL:
|
|
837
|
-
return i || r ? re(o.value, e) :
|
|
836
|
+
return i || r ? re(o.value, e) : Ce(o, e, t, n);
|
|
838
837
|
case N.QUOTE_DOUBLE:
|
|
839
838
|
return ye(o.value, e);
|
|
840
839
|
case N.QUOTE_SINGLE:
|
|
841
|
-
return
|
|
840
|
+
return lt(o.value, e);
|
|
842
841
|
case N.PLAIN:
|
|
843
|
-
return
|
|
842
|
+
return Us(o, e, t, n);
|
|
844
843
|
default:
|
|
845
844
|
return null;
|
|
846
845
|
}
|
|
@@ -853,10 +852,10 @@ function Ne(s, e, t, n) {
|
|
|
853
852
|
}
|
|
854
853
|
return c;
|
|
855
854
|
}
|
|
856
|
-
function
|
|
855
|
+
function Qt(s, e) {
|
|
857
856
|
const t = Object.assign({
|
|
858
857
|
blockQuote: !0,
|
|
859
|
-
commentString:
|
|
858
|
+
commentString: Fs,
|
|
860
859
|
defaultKeyType: null,
|
|
861
860
|
defaultStringType: "PLAIN",
|
|
862
861
|
directives: null,
|
|
@@ -894,7 +893,7 @@ function Ht(s, e) {
|
|
|
894
893
|
options: t
|
|
895
894
|
};
|
|
896
895
|
}
|
|
897
|
-
function
|
|
896
|
+
function Rs(s, e) {
|
|
898
897
|
if (e.tag) {
|
|
899
898
|
const i = s.filter((r) => r.tag === e.tag);
|
|
900
899
|
if (i.length > 0)
|
|
@@ -913,11 +912,11 @@ function Ws(s, e) {
|
|
|
913
912
|
}
|
|
914
913
|
return t;
|
|
915
914
|
}
|
|
916
|
-
function
|
|
915
|
+
function Vs(s, e, { anchors: t, doc: n }) {
|
|
917
916
|
if (!n.directives)
|
|
918
917
|
return "";
|
|
919
918
|
const i = [], r = (A(s) || L(s)) && s.anchor;
|
|
920
|
-
r &&
|
|
919
|
+
r && Vt(r) && (t.add(r), i.push(`&${r}`));
|
|
921
920
|
const o = s.tag ? s.tag : e.default ? null : e.tag;
|
|
922
921
|
return o && i.push(n.directives.tagString(o)), i.join(" ");
|
|
923
922
|
}
|
|
@@ -933,14 +932,14 @@ function H(s, e, t, n) {
|
|
|
933
932
|
}
|
|
934
933
|
let i;
|
|
935
934
|
const r = T(s) ? s : e.doc.createNode(s, { onTagObj: (a) => i = a });
|
|
936
|
-
i || (i =
|
|
937
|
-
const o =
|
|
935
|
+
i || (i = Rs(e.doc.schema.tags, r));
|
|
936
|
+
const o = Vs(r, i, e);
|
|
938
937
|
o.length > 0 && (e.indentAtStart = (e.indentAtStart ?? 0) + o.length + 1);
|
|
939
938
|
const l = typeof i.stringify == "function" ? i.stringify(r, e, t, n) : A(r) ? Ne(r, e, t, n) : r.toString(e, t, n);
|
|
940
939
|
return o ? A(r) || l[0] === "{" || l[0] === "[" ? `${o} ${l}` : `${o}
|
|
941
940
|
${e.indent}${l}` : l;
|
|
942
941
|
}
|
|
943
|
-
function
|
|
942
|
+
function Ws({ key: s, value: e }, t, n, i) {
|
|
944
943
|
const { allNullValues: r, doc: o, indent: l, indentStep: a, options: { commentString: c, indentSeq: u, simpleKeys: f } } = t;
|
|
945
944
|
let h = T(s) && s.comment || null;
|
|
946
945
|
if (f) {
|
|
@@ -989,14 +988,14 @@ ${U(E, t.indent)}`;
|
|
|
989
988
|
${t.indent}`;
|
|
990
989
|
} else if (!p && L(e)) {
|
|
991
990
|
const E = O[0], q = O.indexOf(`
|
|
992
|
-
`), ee = q !== -1,
|
|
993
|
-
if (ee || !
|
|
994
|
-
let
|
|
991
|
+
`), ee = q !== -1, _ = t.inFlow ?? e.flow ?? e.items.length === 0;
|
|
992
|
+
if (ee || !_) {
|
|
993
|
+
let Et = !1;
|
|
995
994
|
if (ee && (E === "&" || E === "!")) {
|
|
996
995
|
let Y = O.indexOf(" ");
|
|
997
|
-
E === "&" && Y !== -1 && Y < q && O[Y + 1] === "!" && (Y = O.indexOf(" ", Y + 1)), (Y === -1 || q < Y) && (
|
|
996
|
+
E === "&" && Y !== -1 && Y < q && O[Y + 1] === "!" && (Y = O.indexOf(" ", Y + 1)), (Y === -1 || q < Y) && (Et = !0);
|
|
998
997
|
}
|
|
999
|
-
|
|
998
|
+
Et || (g = `
|
|
1000
999
|
${t.indent}`);
|
|
1001
1000
|
}
|
|
1002
1001
|
} else
|
|
@@ -1004,12 +1003,12 @@ ${t.indent}`);
|
|
|
1004
1003
|
`) && (g = "");
|
|
1005
1004
|
return m += g + O, t.inFlow ? S && n && n() : k && !S ? m += V(m, t.indent, c(k)) : d && i && i(), m;
|
|
1006
1005
|
}
|
|
1007
|
-
function
|
|
1006
|
+
function Ht(s, e) {
|
|
1008
1007
|
(s === "debug" || s === "warn") && (typeof process < "u" && process.emitWarning ? process.emitWarning(e) : console.warn(e));
|
|
1009
1008
|
}
|
|
1010
|
-
const
|
|
1011
|
-
function
|
|
1012
|
-
if (s?.doc.schema.merge &&
|
|
1009
|
+
const Lt = "<<";
|
|
1010
|
+
function xt(s, e, { key: t, value: n }) {
|
|
1011
|
+
if (s?.doc.schema.merge && Js(t))
|
|
1013
1012
|
if (n = X(n) ? n.resolve(s.doc) : n, fe(n))
|
|
1014
1013
|
for (const i of n.items)
|
|
1015
1014
|
ze(s, e, i);
|
|
@@ -1025,7 +1024,7 @@ function Xt(s, e, { key: t, value: n }) {
|
|
|
1025
1024
|
else if (e instanceof Set)
|
|
1026
1025
|
e.add(i);
|
|
1027
1026
|
else {
|
|
1028
|
-
const r =
|
|
1027
|
+
const r = Ys(t, i, s), o = F(n, r, s);
|
|
1029
1028
|
r in e ? Object.defineProperty(e, r, {
|
|
1030
1029
|
value: o,
|
|
1031
1030
|
writable: !0,
|
|
@@ -1036,7 +1035,7 @@ function Xt(s, e, { key: t, value: n }) {
|
|
|
1036
1035
|
}
|
|
1037
1036
|
return e;
|
|
1038
1037
|
}
|
|
1039
|
-
const
|
|
1038
|
+
const Js = (s) => s === Lt || A(s) && s.value === Lt && (!s.type || s.type === N.PLAIN);
|
|
1040
1039
|
function ze(s, e, t) {
|
|
1041
1040
|
const n = s && X(t) ? t.resolve(s.doc) : t;
|
|
1042
1041
|
if (!z(n))
|
|
@@ -1051,13 +1050,13 @@ function ze(s, e, t) {
|
|
|
1051
1050
|
});
|
|
1052
1051
|
return e;
|
|
1053
1052
|
}
|
|
1054
|
-
function
|
|
1053
|
+
function Ys(s, e, t) {
|
|
1055
1054
|
if (e === null)
|
|
1056
1055
|
return "";
|
|
1057
1056
|
if (typeof e != "object")
|
|
1058
1057
|
return String(e);
|
|
1059
1058
|
if (T(s) && t && t.doc) {
|
|
1060
|
-
const n =
|
|
1059
|
+
const n = Qt(t.doc, {});
|
|
1061
1060
|
n.anchors = /* @__PURE__ */ new Set();
|
|
1062
1061
|
for (const r of t.anchors.keys())
|
|
1063
1062
|
n.anchors.add(r.anchor);
|
|
@@ -1065,19 +1064,19 @@ function Qs(s, e, t) {
|
|
|
1065
1064
|
const i = s.toString(n);
|
|
1066
1065
|
if (!t.mapKeyWarned) {
|
|
1067
1066
|
let r = JSON.stringify(i);
|
|
1068
|
-
r.length > 40 && (r = r.substring(0, 36) + '..."'),
|
|
1067
|
+
r.length > 40 && (r = r.substring(0, 36) + '..."'), Ht(t.doc.options.logLevel, `Keys with collection values will be stringified due to JS Object restrictions: ${r}. Set mapAsMap: true to use object keys.`), t.mapKeyWarned = !0;
|
|
1069
1068
|
}
|
|
1070
1069
|
return i;
|
|
1071
1070
|
}
|
|
1072
1071
|
return JSON.stringify(e);
|
|
1073
1072
|
}
|
|
1074
|
-
function
|
|
1073
|
+
function ht(s, e, t) {
|
|
1075
1074
|
const n = be(s, void 0, t), i = be(e, void 0, t);
|
|
1076
1075
|
return new $(n, i);
|
|
1077
1076
|
}
|
|
1078
1077
|
class $ {
|
|
1079
1078
|
constructor(e, t = null) {
|
|
1080
|
-
Object.defineProperty(this, M, { value:
|
|
1079
|
+
Object.defineProperty(this, M, { value: Kt }), this.key = e, this.value = t;
|
|
1081
1080
|
}
|
|
1082
1081
|
clone(e) {
|
|
1083
1082
|
let { key: t, value: n } = this;
|
|
@@ -1085,16 +1084,16 @@ class $ {
|
|
|
1085
1084
|
}
|
|
1086
1085
|
toJSON(e, t) {
|
|
1087
1086
|
const n = t?.mapAsMap ? /* @__PURE__ */ new Map() : {};
|
|
1088
|
-
return
|
|
1087
|
+
return xt(t, n, this);
|
|
1089
1088
|
}
|
|
1090
1089
|
toString(e, t, n) {
|
|
1091
|
-
return e?.doc ?
|
|
1090
|
+
return e?.doc ? Ws(this, e, t, n) : JSON.stringify(this);
|
|
1092
1091
|
}
|
|
1093
1092
|
}
|
|
1094
|
-
function
|
|
1095
|
-
return (e.inFlow ?? s.flow ?
|
|
1093
|
+
function Xt(s, e, t) {
|
|
1094
|
+
return (e.inFlow ?? s.flow ? Qs : Gs)(s, e, t);
|
|
1096
1095
|
}
|
|
1097
|
-
function
|
|
1096
|
+
function Gs({ comment: s, items: e }, t, { blockItemPrefix: n, flowChars: i, itemIndent: r, onChompKeep: o, onComment: l }) {
|
|
1098
1097
|
const { indent: a, options: { commentString: c } } = t, u = Object.assign({}, t, { indent: r, type: null });
|
|
1099
1098
|
let f = !1;
|
|
1100
1099
|
const h = [];
|
|
@@ -1102,10 +1101,10 @@ function Hs({ comment: s, items: e }, t, { blockItemPrefix: n, flowChars: i, ite
|
|
|
1102
1101
|
const d = e[y];
|
|
1103
1102
|
let m = null;
|
|
1104
1103
|
if (T(d))
|
|
1105
|
-
!f && d.spaceBefore && h.push(""),
|
|
1104
|
+
!f && d.spaceBefore && h.push(""), Be(t, h, d.commentBefore, f), d.comment && (m = d.comment);
|
|
1106
1105
|
else if (I(d)) {
|
|
1107
1106
|
const w = T(d.key) ? d.key : null;
|
|
1108
|
-
w && (!f && w.spaceBefore && h.push(""),
|
|
1107
|
+
w && (!f && w.spaceBefore && h.push(""), Be(t, h, w.commentBefore, f));
|
|
1109
1108
|
}
|
|
1110
1109
|
f = !1;
|
|
1111
1110
|
let b = H(d, u, () => m = null, () => f = !0);
|
|
@@ -1126,7 +1125,7 @@ ${a}${d}` : `
|
|
|
1126
1125
|
return s ? (p += `
|
|
1127
1126
|
` + U(c(s), a), l && l()) : f && o && o(), p;
|
|
1128
1127
|
}
|
|
1129
|
-
function
|
|
1128
|
+
function Qs({ comment: s, items: e }, t, { flowChars: n, itemIndent: i, onComment: r }) {
|
|
1130
1129
|
const { indent: o, indentStep: l, flowCollectionPadding: a, options: { commentString: c } } = t;
|
|
1131
1130
|
i += l;
|
|
1132
1131
|
const u = Object.assign({}, t, {
|
|
@@ -1140,10 +1139,10 @@ function xs({ comment: s, items: e }, t, { flowChars: n, itemIndent: i, onCommen
|
|
|
1140
1139
|
const w = e[b];
|
|
1141
1140
|
let k = null;
|
|
1142
1141
|
if (T(w))
|
|
1143
|
-
w.spaceBefore && p.push(""),
|
|
1142
|
+
w.spaceBefore && p.push(""), Be(t, p, w.commentBefore, !1), w.comment && (k = w.comment);
|
|
1144
1143
|
else if (I(w)) {
|
|
1145
1144
|
const O = T(w.key) ? w.key : null;
|
|
1146
|
-
O && (O.spaceBefore && p.push(""),
|
|
1145
|
+
O && (O.spaceBefore && p.push(""), Be(t, p, O.commentBefore, !1), O.comment && (f = !0));
|
|
1147
1146
|
const g = T(w.value) ? w.value : null;
|
|
1148
1147
|
g ? (g.comment && (k = g.comment), g.commentBefore && (f = !0)) : w.value == null && O && O.comment && (k = O.comment);
|
|
1149
1148
|
}
|
|
@@ -1156,7 +1155,7 @@ function xs({ comment: s, items: e }, t, { flowChars: n, itemIndent: i, onCommen
|
|
|
1156
1155
|
const { start: d, end: m } = n;
|
|
1157
1156
|
if (p.length === 0)
|
|
1158
1157
|
y = d + m;
|
|
1159
|
-
else if (f || (f = p.reduce((w, k) => w + k.length + 2, 2) >
|
|
1158
|
+
else if (f || (f = p.reduce((w, k) => w + k.length + 2, 2) > Ke.maxFlowStringSingleLineLength), f) {
|
|
1160
1159
|
y = d;
|
|
1161
1160
|
for (const b of p)
|
|
1162
1161
|
y += b ? `
|
|
@@ -1168,7 +1167,7 @@ ${o}${m}`;
|
|
|
1168
1167
|
y = `${d}${a}${p.join(" ")}${a}${m}`;
|
|
1169
1168
|
return s && (y += V(y, c(s), o), r && r()), y;
|
|
1170
1169
|
}
|
|
1171
|
-
function
|
|
1170
|
+
function Be({ indent: s, options: { commentString: e } }, t, n, i) {
|
|
1172
1171
|
if (n && i && (n = n.replace(/^\n+/, "")), n) {
|
|
1173
1172
|
const r = U(e(n), s);
|
|
1174
1173
|
t.push(r.trimStart());
|
|
@@ -1180,7 +1179,7 @@ function G(s, e) {
|
|
|
1180
1179
|
if (I(n) && (n.key === e || n.key === t || A(n.key) && n.key.value === t))
|
|
1181
1180
|
return n;
|
|
1182
1181
|
}
|
|
1183
|
-
class j extends
|
|
1182
|
+
class j extends Ke {
|
|
1184
1183
|
static get tagName() {
|
|
1185
1184
|
return "tag:yaml.org,2002:map";
|
|
1186
1185
|
}
|
|
@@ -1200,7 +1199,7 @@ class j extends Fe {
|
|
|
1200
1199
|
if (i) {
|
|
1201
1200
|
if (!t)
|
|
1202
1201
|
throw new Error(`Key ${n.key} already set`);
|
|
1203
|
-
A(i.value) &&
|
|
1202
|
+
A(i.value) && Yt(n.value) ? i.value.value = n.value : i.value = n.value;
|
|
1204
1203
|
} else if (r) {
|
|
1205
1204
|
const o = this.items.findIndex((l) => r(n, l) < 0);
|
|
1206
1205
|
o === -1 ? this.items.push(n) : this.items.splice(o, 0, n);
|
|
@@ -1230,7 +1229,7 @@ class j extends Fe {
|
|
|
1230
1229
|
const i = n ? new n() : t?.mapAsMap ? /* @__PURE__ */ new Map() : {};
|
|
1231
1230
|
t?.onCreate && t.onCreate(i);
|
|
1232
1231
|
for (const r of this.items)
|
|
1233
|
-
|
|
1232
|
+
xt(t, i, r);
|
|
1234
1233
|
return i;
|
|
1235
1234
|
}
|
|
1236
1235
|
toString(e, t, n) {
|
|
@@ -1239,7 +1238,7 @@ class j extends Fe {
|
|
|
1239
1238
|
for (const i of this.items)
|
|
1240
1239
|
if (!I(i))
|
|
1241
1240
|
throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);
|
|
1242
|
-
return !e.allNullValues && this.hasAllNullValues(!1) && (e = Object.assign({}, e, { allNullValues: !0 })),
|
|
1241
|
+
return !e.allNullValues && this.hasAllNullValues(!1) && (e = Object.assign({}, e, { allNullValues: !0 })), Xt(this, e, {
|
|
1243
1242
|
blockItemPrefix: "",
|
|
1244
1243
|
flowChars: { start: "{", end: "}" },
|
|
1245
1244
|
itemIndent: e.indent || "",
|
|
@@ -1248,13 +1247,13 @@ class j extends Fe {
|
|
|
1248
1247
|
});
|
|
1249
1248
|
}
|
|
1250
1249
|
}
|
|
1251
|
-
function
|
|
1250
|
+
function Hs(s, e, t) {
|
|
1252
1251
|
const { keepUndefined: n, replacer: i } = t, r = new j(s), o = (l, a) => {
|
|
1253
1252
|
if (typeof i == "function")
|
|
1254
1253
|
a = i.call(e, l, a);
|
|
1255
1254
|
else if (Array.isArray(i) && !i.includes(l))
|
|
1256
1255
|
return;
|
|
1257
|
-
(a !== void 0 || n) && r.items.push(
|
|
1256
|
+
(a !== void 0 || n) && r.items.push(ht(l, a, t));
|
|
1258
1257
|
};
|
|
1259
1258
|
if (e instanceof Map)
|
|
1260
1259
|
for (const [l, a] of e)
|
|
@@ -1266,7 +1265,7 @@ function Xs(s, e, t) {
|
|
|
1266
1265
|
}
|
|
1267
1266
|
const ue = {
|
|
1268
1267
|
collection: "map",
|
|
1269
|
-
createNode:
|
|
1268
|
+
createNode: Hs,
|
|
1270
1269
|
default: !0,
|
|
1271
1270
|
nodeClass: j,
|
|
1272
1271
|
tag: "tag:yaml.org,2002:map",
|
|
@@ -1274,7 +1273,7 @@ const ue = {
|
|
|
1274
1273
|
return z(s) || e("Expected a mapping for this tag"), s;
|
|
1275
1274
|
}
|
|
1276
1275
|
};
|
|
1277
|
-
class Z extends
|
|
1276
|
+
class Z extends Ke {
|
|
1278
1277
|
static get tagName() {
|
|
1279
1278
|
return "tag:yaml.org,2002:seq";
|
|
1280
1279
|
}
|
|
@@ -1325,7 +1324,7 @@ class Z extends Fe {
|
|
|
1325
1324
|
if (typeof n != "number")
|
|
1326
1325
|
throw new Error(`Expected a valid index, not ${e}.`);
|
|
1327
1326
|
const i = this.items[n];
|
|
1328
|
-
A(i) &&
|
|
1327
|
+
A(i) && Yt(t) ? i.value = t : this.items[n] = t;
|
|
1329
1328
|
}
|
|
1330
1329
|
toJSON(e, t) {
|
|
1331
1330
|
const n = [];
|
|
@@ -1336,7 +1335,7 @@ class Z extends Fe {
|
|
|
1336
1335
|
return n;
|
|
1337
1336
|
}
|
|
1338
1337
|
toString(e, t, n) {
|
|
1339
|
-
return e ?
|
|
1338
|
+
return e ? Xt(this, e, {
|
|
1340
1339
|
blockItemPrefix: "- ",
|
|
1341
1340
|
flowChars: { start: "[", end: "]" },
|
|
1342
1341
|
itemIndent: (e.indent || "") + " ",
|
|
@@ -1349,7 +1348,7 @@ function Ee(s) {
|
|
|
1349
1348
|
let e = A(s) ? s.value : s;
|
|
1350
1349
|
return e && typeof e == "string" && (e = Number(e)), typeof e == "number" && Number.isInteger(e) && e >= 0 ? e : null;
|
|
1351
1350
|
}
|
|
1352
|
-
function
|
|
1351
|
+
function xs(s, e, t) {
|
|
1353
1352
|
const { replacer: n } = t, i = new Z(s);
|
|
1354
1353
|
if (e && Symbol.iterator in Object(e)) {
|
|
1355
1354
|
let r = 0;
|
|
@@ -1365,14 +1364,14 @@ function zs(s, e, t) {
|
|
|
1365
1364
|
}
|
|
1366
1365
|
const he = {
|
|
1367
1366
|
collection: "seq",
|
|
1368
|
-
createNode:
|
|
1367
|
+
createNode: xs,
|
|
1369
1368
|
default: !0,
|
|
1370
1369
|
nodeClass: Z,
|
|
1371
1370
|
tag: "tag:yaml.org,2002:seq",
|
|
1372
1371
|
resolve(s, e) {
|
|
1373
1372
|
return fe(s) || e("Expected a sequence for this tag"), s;
|
|
1374
1373
|
}
|
|
1375
|
-
},
|
|
1374
|
+
}, Re = {
|
|
1376
1375
|
identify: (s) => typeof s == "string",
|
|
1377
1376
|
default: !0,
|
|
1378
1377
|
tag: "tag:yaml.org,2002:str",
|
|
@@ -1380,22 +1379,22 @@ const he = {
|
|
|
1380
1379
|
stringify(s, e, t, n) {
|
|
1381
1380
|
return e = Object.assign({ actualString: !0 }, e), Ne(s, e, t, n);
|
|
1382
1381
|
}
|
|
1383
|
-
},
|
|
1382
|
+
}, Ve = {
|
|
1384
1383
|
identify: (s) => s == null,
|
|
1385
1384
|
createNode: () => new N(null),
|
|
1386
1385
|
default: !0,
|
|
1387
1386
|
tag: "tag:yaml.org,2002:null",
|
|
1388
1387
|
test: /^(?:~|[Nn]ull|NULL)?$/,
|
|
1389
1388
|
resolve: () => new N(null),
|
|
1390
|
-
stringify: ({ source: s }, e) => typeof s == "string" &&
|
|
1391
|
-
},
|
|
1389
|
+
stringify: ({ source: s }, e) => typeof s == "string" && Ve.test.test(s) ? s : e.options.nullStr
|
|
1390
|
+
}, dt = {
|
|
1392
1391
|
identify: (s) => typeof s == "boolean",
|
|
1393
1392
|
default: !0,
|
|
1394
1393
|
tag: "tag:yaml.org,2002:bool",
|
|
1395
1394
|
test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
|
|
1396
1395
|
resolve: (s) => new N(s[0] === "t" || s[0] === "T"),
|
|
1397
1396
|
stringify({ source: s, value: e }, t) {
|
|
1398
|
-
if (s &&
|
|
1397
|
+
if (s && dt.test.test(s)) {
|
|
1399
1398
|
const n = s[0] === "t" || s[0] === "T";
|
|
1400
1399
|
if (e === n)
|
|
1401
1400
|
return s;
|
|
@@ -1419,14 +1418,14 @@ function D({ format: s, minFractionDigits: e, tag: t, value: n }) {
|
|
|
1419
1418
|
}
|
|
1420
1419
|
return r;
|
|
1421
1420
|
}
|
|
1422
|
-
const
|
|
1421
|
+
const zt = {
|
|
1423
1422
|
identify: (s) => typeof s == "number",
|
|
1424
1423
|
default: !0,
|
|
1425
1424
|
tag: "tag:yaml.org,2002:float",
|
|
1426
1425
|
test: /^(?:[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN))$/,
|
|
1427
1426
|
resolve: (s) => s.slice(-3).toLowerCase() === "nan" ? NaN : s[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
|
|
1428
1427
|
stringify: D
|
|
1429
|
-
},
|
|
1428
|
+
}, Zt = {
|
|
1430
1429
|
identify: (s) => typeof s == "number",
|
|
1431
1430
|
default: !0,
|
|
1432
1431
|
tag: "tag:yaml.org,2002:float",
|
|
@@ -1437,7 +1436,7 @@ const Zt = {
|
|
|
1437
1436
|
const e = Number(s.value);
|
|
1438
1437
|
return isFinite(e) ? e.toExponential() : D(s);
|
|
1439
1438
|
}
|
|
1440
|
-
},
|
|
1439
|
+
}, es = {
|
|
1441
1440
|
identify: (s) => typeof s == "number",
|
|
1442
1441
|
default: !0,
|
|
1443
1442
|
tag: "tag:yaml.org,2002:float",
|
|
@@ -1447,51 +1446,51 @@ const Zt = {
|
|
|
1447
1446
|
return t !== -1 && s[s.length - 1] === "0" && (e.minFractionDigits = s.length - t - 1), e;
|
|
1448
1447
|
},
|
|
1449
1448
|
stringify: D
|
|
1450
|
-
},
|
|
1451
|
-
function
|
|
1449
|
+
}, We = (s) => typeof s == "bigint" || Number.isInteger(s), pt = (s, e, t, { intAsBigInt: n }) => n ? BigInt(s) : parseInt(s.substring(e), t);
|
|
1450
|
+
function ts(s, e, t) {
|
|
1452
1451
|
const { value: n } = s;
|
|
1453
|
-
return
|
|
1452
|
+
return We(n) && n >= 0 ? t + n.toString(e) : D(s);
|
|
1454
1453
|
}
|
|
1455
|
-
const
|
|
1456
|
-
identify: (s) =>
|
|
1454
|
+
const ss = {
|
|
1455
|
+
identify: (s) => We(s) && s >= 0,
|
|
1457
1456
|
default: !0,
|
|
1458
1457
|
tag: "tag:yaml.org,2002:int",
|
|
1459
1458
|
format: "OCT",
|
|
1460
1459
|
test: /^0o[0-7]+$/,
|
|
1461
|
-
resolve: (s, e, t) =>
|
|
1462
|
-
stringify: (s) =>
|
|
1463
|
-
},
|
|
1464
|
-
identify:
|
|
1460
|
+
resolve: (s, e, t) => pt(s, 2, 8, t),
|
|
1461
|
+
stringify: (s) => ts(s, 8, "0o")
|
|
1462
|
+
}, ns = {
|
|
1463
|
+
identify: We,
|
|
1465
1464
|
default: !0,
|
|
1466
1465
|
tag: "tag:yaml.org,2002:int",
|
|
1467
1466
|
test: /^[-+]?[0-9]+$/,
|
|
1468
|
-
resolve: (s, e, t) =>
|
|
1467
|
+
resolve: (s, e, t) => pt(s, 0, 10, t),
|
|
1469
1468
|
stringify: D
|
|
1470
|
-
},
|
|
1471
|
-
identify: (s) =>
|
|
1469
|
+
}, is = {
|
|
1470
|
+
identify: (s) => We(s) && s >= 0,
|
|
1472
1471
|
default: !0,
|
|
1473
1472
|
tag: "tag:yaml.org,2002:int",
|
|
1474
1473
|
format: "HEX",
|
|
1475
1474
|
test: /^0x[0-9a-fA-F]+$/,
|
|
1476
|
-
resolve: (s, e, t) =>
|
|
1477
|
-
stringify: (s) =>
|
|
1478
|
-
},
|
|
1475
|
+
resolve: (s, e, t) => pt(s, 2, 16, t),
|
|
1476
|
+
stringify: (s) => ts(s, 16, "0x")
|
|
1477
|
+
}, Xs = [
|
|
1479
1478
|
ue,
|
|
1480
1479
|
he,
|
|
1480
|
+
Re,
|
|
1481
1481
|
Ve,
|
|
1482
|
-
|
|
1483
|
-
|
|
1482
|
+
dt,
|
|
1483
|
+
ss,
|
|
1484
1484
|
ns,
|
|
1485
1485
|
is,
|
|
1486
|
-
|
|
1486
|
+
zt,
|
|
1487
1487
|
Zt,
|
|
1488
|
-
es
|
|
1489
|
-
ts
|
|
1488
|
+
es
|
|
1490
1489
|
];
|
|
1491
|
-
function
|
|
1490
|
+
function Tt(s) {
|
|
1492
1491
|
return typeof s == "bigint" || Number.isInteger(s);
|
|
1493
1492
|
}
|
|
1494
|
-
const Ie = ({ value: s }) => JSON.stringify(s),
|
|
1493
|
+
const Ie = ({ value: s }) => JSON.stringify(s), zs = [
|
|
1495
1494
|
{
|
|
1496
1495
|
identify: (s) => typeof s == "string",
|
|
1497
1496
|
default: !0,
|
|
@@ -1517,12 +1516,12 @@ const Ie = ({ value: s }) => JSON.stringify(s), en = [
|
|
|
1517
1516
|
stringify: Ie
|
|
1518
1517
|
},
|
|
1519
1518
|
{
|
|
1520
|
-
identify:
|
|
1519
|
+
identify: Tt,
|
|
1521
1520
|
default: !0,
|
|
1522
1521
|
tag: "tag:yaml.org,2002:int",
|
|
1523
1522
|
test: /^-?(?:0|[1-9][0-9]*)$/,
|
|
1524
1523
|
resolve: (s, e, { intAsBigInt: t }) => t ? BigInt(s) : parseInt(s, 10),
|
|
1525
|
-
stringify: ({ value: s }) =>
|
|
1524
|
+
stringify: ({ value: s }) => Tt(s) ? s.toString() : JSON.stringify(s)
|
|
1526
1525
|
},
|
|
1527
1526
|
{
|
|
1528
1527
|
identify: (s) => typeof s == "number",
|
|
@@ -1532,14 +1531,14 @@ const Ie = ({ value: s }) => JSON.stringify(s), en = [
|
|
|
1532
1531
|
resolve: (s) => parseFloat(s),
|
|
1533
1532
|
stringify: Ie
|
|
1534
1533
|
}
|
|
1535
|
-
],
|
|
1534
|
+
], Zs = {
|
|
1536
1535
|
default: !0,
|
|
1537
1536
|
tag: "",
|
|
1538
1537
|
test: /^/,
|
|
1539
1538
|
resolve(s, e) {
|
|
1540
1539
|
return e(`Unresolved plain scalar ${JSON.stringify(s)}`), s;
|
|
1541
1540
|
}
|
|
1542
|
-
},
|
|
1541
|
+
}, en = [ue, he].concat(zs, Zs), mt = {
|
|
1543
1542
|
identify: (s) => s instanceof Uint8Array,
|
|
1544
1543
|
default: !1,
|
|
1545
1544
|
tag: "tag:yaml.org,2002:binary",
|
|
@@ -1584,7 +1583,7 @@ const Ie = ({ value: s }) => JSON.stringify(s), en = [
|
|
|
1584
1583
|
return Ne({ comment: s, type: e, value: l }, n, i, r);
|
|
1585
1584
|
}
|
|
1586
1585
|
};
|
|
1587
|
-
function
|
|
1586
|
+
function rs(s, e) {
|
|
1588
1587
|
if (fe(s))
|
|
1589
1588
|
for (let t = 0; t < s.items.length; ++t) {
|
|
1590
1589
|
let n = s.items[t];
|
|
@@ -1607,7 +1606,7 @@ ${r.comment}` : n.comment;
|
|
|
1607
1606
|
e("Expected a sequence for this tag");
|
|
1608
1607
|
return s;
|
|
1609
1608
|
}
|
|
1610
|
-
function
|
|
1609
|
+
function os(s, e, t) {
|
|
1611
1610
|
const { replacer: n } = t, i = new Z(s);
|
|
1612
1611
|
i.tag = "tag:yaml.org,2002:pairs";
|
|
1613
1612
|
let r = 0;
|
|
@@ -1628,16 +1627,16 @@ function ls(s, e, t) {
|
|
|
1628
1627
|
throw new TypeError(`Expected { key: value } tuple: ${o}`);
|
|
1629
1628
|
} else
|
|
1630
1629
|
l = o;
|
|
1631
|
-
i.items.push(
|
|
1630
|
+
i.items.push(ht(l, a, t));
|
|
1632
1631
|
}
|
|
1633
1632
|
return i;
|
|
1634
1633
|
}
|
|
1635
|
-
const
|
|
1634
|
+
const gt = {
|
|
1636
1635
|
collection: "seq",
|
|
1637
1636
|
default: !1,
|
|
1638
1637
|
tag: "tag:yaml.org,2002:pairs",
|
|
1639
|
-
resolve:
|
|
1640
|
-
createNode:
|
|
1638
|
+
resolve: rs,
|
|
1639
|
+
createNode: os
|
|
1641
1640
|
};
|
|
1642
1641
|
class oe extends Z {
|
|
1643
1642
|
constructor() {
|
|
@@ -1662,48 +1661,48 @@ class oe extends Z {
|
|
|
1662
1661
|
}
|
|
1663
1662
|
}
|
|
1664
1663
|
oe.tag = "tag:yaml.org,2002:omap";
|
|
1665
|
-
const
|
|
1664
|
+
const yt = {
|
|
1666
1665
|
collection: "seq",
|
|
1667
1666
|
identify: (s) => s instanceof Map,
|
|
1668
1667
|
nodeClass: oe,
|
|
1669
1668
|
default: !1,
|
|
1670
1669
|
tag: "tag:yaml.org,2002:omap",
|
|
1671
1670
|
resolve(s, e) {
|
|
1672
|
-
const t =
|
|
1671
|
+
const t = rs(s, e), n = [];
|
|
1673
1672
|
for (const { key: i } of t.items)
|
|
1674
1673
|
A(i) && (n.includes(i.value) ? e(`Ordered maps must not include duplicate keys: ${i.value}`) : n.push(i.value));
|
|
1675
1674
|
return Object.assign(new oe(), t);
|
|
1676
1675
|
},
|
|
1677
1676
|
createNode(s, e, t) {
|
|
1678
|
-
const n =
|
|
1677
|
+
const n = os(s, e, t), i = new oe();
|
|
1679
1678
|
return i.items = n.items, i;
|
|
1680
1679
|
}
|
|
1681
1680
|
};
|
|
1682
|
-
function
|
|
1683
|
-
return e && (s ?
|
|
1681
|
+
function ls({ value: s, source: e }, t) {
|
|
1682
|
+
return e && (s ? as : cs).test.test(e) ? e : s ? t.options.trueStr : t.options.falseStr;
|
|
1684
1683
|
}
|
|
1685
|
-
const
|
|
1684
|
+
const as = {
|
|
1686
1685
|
identify: (s) => s === !0,
|
|
1687
1686
|
default: !0,
|
|
1688
1687
|
tag: "tag:yaml.org,2002:bool",
|
|
1689
1688
|
test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,
|
|
1690
1689
|
resolve: () => new N(!0),
|
|
1691
|
-
stringify:
|
|
1692
|
-
},
|
|
1690
|
+
stringify: ls
|
|
1691
|
+
}, cs = {
|
|
1693
1692
|
identify: (s) => s === !1,
|
|
1694
1693
|
default: !0,
|
|
1695
1694
|
tag: "tag:yaml.org,2002:bool",
|
|
1696
1695
|
test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/i,
|
|
1697
1696
|
resolve: () => new N(!1),
|
|
1698
|
-
stringify:
|
|
1699
|
-
},
|
|
1697
|
+
stringify: ls
|
|
1698
|
+
}, tn = {
|
|
1700
1699
|
identify: (s) => typeof s == "number",
|
|
1701
1700
|
default: !0,
|
|
1702
1701
|
tag: "tag:yaml.org,2002:float",
|
|
1703
1702
|
test: /^[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN)$/,
|
|
1704
1703
|
resolve: (s) => s.slice(-3).toLowerCase() === "nan" ? NaN : s[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
|
|
1705
1704
|
stringify: D
|
|
1706
|
-
},
|
|
1705
|
+
}, sn = {
|
|
1707
1706
|
identify: (s) => typeof s == "number",
|
|
1708
1707
|
default: !0,
|
|
1709
1708
|
tag: "tag:yaml.org,2002:float",
|
|
@@ -1714,7 +1713,7 @@ const cs = {
|
|
|
1714
1713
|
const e = Number(s.value);
|
|
1715
1714
|
return isFinite(e) ? e.toExponential() : D(s);
|
|
1716
1715
|
}
|
|
1717
|
-
},
|
|
1716
|
+
}, nn = {
|
|
1718
1717
|
identify: (s) => typeof s == "number",
|
|
1719
1718
|
default: !0,
|
|
1720
1719
|
tag: "tag:yaml.org,2002:float",
|
|
@@ -1729,7 +1728,7 @@ const cs = {
|
|
|
1729
1728
|
},
|
|
1730
1729
|
stringify: D
|
|
1731
1730
|
}, Oe = (s) => typeof s == "bigint" || Number.isInteger(s);
|
|
1732
|
-
function
|
|
1731
|
+
function Je(s, e, t, { intAsBigInt: n }) {
|
|
1733
1732
|
const i = s[0];
|
|
1734
1733
|
if ((i === "-" || i === "+") && (e += 1), s = s.substring(e).replace(/_/g, ""), n) {
|
|
1735
1734
|
switch (t) {
|
|
@@ -1749,7 +1748,7 @@ function Ye(s, e, t, { intAsBigInt: n }) {
|
|
|
1749
1748
|
const r = parseInt(s, t);
|
|
1750
1749
|
return i === "-" ? -1 * r : r;
|
|
1751
1750
|
}
|
|
1752
|
-
function
|
|
1751
|
+
function bt(s, e, t) {
|
|
1753
1752
|
const { value: n } = s;
|
|
1754
1753
|
if (Oe(n)) {
|
|
1755
1754
|
const i = n.toString(e);
|
|
@@ -1757,37 +1756,37 @@ function wt(s, e, t) {
|
|
|
1757
1756
|
}
|
|
1758
1757
|
return D(s);
|
|
1759
1758
|
}
|
|
1760
|
-
const
|
|
1759
|
+
const rn = {
|
|
1761
1760
|
identify: Oe,
|
|
1762
1761
|
default: !0,
|
|
1763
1762
|
tag: "tag:yaml.org,2002:int",
|
|
1764
1763
|
format: "BIN",
|
|
1765
1764
|
test: /^[-+]?0b[0-1_]+$/,
|
|
1766
|
-
resolve: (s, e, t) =>
|
|
1767
|
-
stringify: (s) =>
|
|
1768
|
-
},
|
|
1765
|
+
resolve: (s, e, t) => Je(s, 2, 2, t),
|
|
1766
|
+
stringify: (s) => bt(s, 2, "0b")
|
|
1767
|
+
}, on = {
|
|
1769
1768
|
identify: Oe,
|
|
1770
1769
|
default: !0,
|
|
1771
1770
|
tag: "tag:yaml.org,2002:int",
|
|
1772
1771
|
format: "OCT",
|
|
1773
1772
|
test: /^[-+]?0[0-7_]+$/,
|
|
1774
|
-
resolve: (s, e, t) =>
|
|
1775
|
-
stringify: (s) =>
|
|
1776
|
-
},
|
|
1773
|
+
resolve: (s, e, t) => Je(s, 1, 8, t),
|
|
1774
|
+
stringify: (s) => bt(s, 8, "0")
|
|
1775
|
+
}, ln = {
|
|
1777
1776
|
identify: Oe,
|
|
1778
1777
|
default: !0,
|
|
1779
1778
|
tag: "tag:yaml.org,2002:int",
|
|
1780
1779
|
test: /^[-+]?[0-9][0-9_]*$/,
|
|
1781
|
-
resolve: (s, e, t) =>
|
|
1780
|
+
resolve: (s, e, t) => Je(s, 0, 10, t),
|
|
1782
1781
|
stringify: D
|
|
1783
|
-
},
|
|
1782
|
+
}, an = {
|
|
1784
1783
|
identify: Oe,
|
|
1785
1784
|
default: !0,
|
|
1786
1785
|
tag: "tag:yaml.org,2002:int",
|
|
1787
1786
|
format: "HEX",
|
|
1788
1787
|
test: /^[-+]?0x[0-9a-fA-F_]+$/,
|
|
1789
|
-
resolve: (s, e, t) =>
|
|
1790
|
-
stringify: (s) =>
|
|
1788
|
+
resolve: (s, e, t) => Je(s, 2, 16, t),
|
|
1789
|
+
stringify: (s) => bt(s, 16, "0x")
|
|
1791
1790
|
};
|
|
1792
1791
|
class le extends j {
|
|
1793
1792
|
constructor(e) {
|
|
@@ -1823,7 +1822,7 @@ class le extends j {
|
|
|
1823
1822
|
}
|
|
1824
1823
|
}
|
|
1825
1824
|
le.tag = "tag:yaml.org,2002:set";
|
|
1826
|
-
const
|
|
1825
|
+
const wt = {
|
|
1827
1826
|
collection: "map",
|
|
1828
1827
|
identify: (s) => s instanceof Set,
|
|
1829
1828
|
nodeClass: le,
|
|
@@ -1842,15 +1841,15 @@ const St = {
|
|
|
1842
1841
|
const { replacer: n } = t, i = new le(s);
|
|
1843
1842
|
if (e && Symbol.iterator in Object(e))
|
|
1844
1843
|
for (let r of e)
|
|
1845
|
-
typeof n == "function" && (r = n.call(e, r, r)), i.items.push(
|
|
1844
|
+
typeof n == "function" && (r = n.call(e, r, r)), i.items.push(ht(r, null, t));
|
|
1846
1845
|
return i;
|
|
1847
1846
|
}
|
|
1848
1847
|
};
|
|
1849
|
-
function
|
|
1848
|
+
function St(s, e) {
|
|
1850
1849
|
const t = s[0], n = t === "-" || t === "+" ? s.substring(1) : s, i = (o) => e ? BigInt(o) : Number(o), r = n.replace(/_/g, "").split(":").reduce((o, l) => o * i(60) + i(l), i(0));
|
|
1851
1850
|
return t === "-" ? i(-1) * r : r;
|
|
1852
1851
|
}
|
|
1853
|
-
function
|
|
1852
|
+
function fs(s) {
|
|
1854
1853
|
let { value: e } = s, t = (o) => o;
|
|
1855
1854
|
if (typeof e == "bigint")
|
|
1856
1855
|
t = (o) => BigInt(o);
|
|
@@ -1861,23 +1860,23 @@ function us(s) {
|
|
|
1861
1860
|
const i = t(60), r = [e % i];
|
|
1862
1861
|
return e < 60 ? r.unshift(0) : (e = (e - r[0]) / i, r.unshift(e % i), e >= 60 && (e = (e - r[0]) / i, r.unshift(e))), n + r.map((o) => o < 10 ? "0" + String(o) : String(o)).join(":").replace(/000000\d*$/, "");
|
|
1863
1862
|
}
|
|
1864
|
-
const
|
|
1863
|
+
const us = {
|
|
1865
1864
|
identify: (s) => typeof s == "bigint" || Number.isInteger(s),
|
|
1866
1865
|
default: !0,
|
|
1867
1866
|
tag: "tag:yaml.org,2002:int",
|
|
1868
1867
|
format: "TIME",
|
|
1869
1868
|
test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,
|
|
1870
|
-
resolve: (s, e, { intAsBigInt: t }) =>
|
|
1871
|
-
stringify:
|
|
1872
|
-
},
|
|
1869
|
+
resolve: (s, e, { intAsBigInt: t }) => St(s, t),
|
|
1870
|
+
stringify: fs
|
|
1871
|
+
}, hs = {
|
|
1873
1872
|
identify: (s) => typeof s == "number",
|
|
1874
1873
|
default: !0,
|
|
1875
1874
|
tag: "tag:yaml.org,2002:float",
|
|
1876
1875
|
format: "TIME",
|
|
1877
1876
|
test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,
|
|
1878
|
-
resolve: (s) =>
|
|
1879
|
-
stringify:
|
|
1880
|
-
},
|
|
1877
|
+
resolve: (s) => St(s, !1),
|
|
1878
|
+
stringify: fs
|
|
1879
|
+
}, Ye = {
|
|
1881
1880
|
identify: (s) => s instanceof Date,
|
|
1882
1881
|
default: !0,
|
|
1883
1882
|
tag: "tag:yaml.org,2002:timestamp",
|
|
@@ -1886,78 +1885,78 @@ const hs = {
|
|
|
1886
1885
|
// assumed to be 00:00:00Z (start of day, UTC).
|
|
1887
1886
|
test: RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),
|
|
1888
1887
|
resolve(s) {
|
|
1889
|
-
const e = s.match(
|
|
1888
|
+
const e = s.match(Ye.test);
|
|
1890
1889
|
if (!e)
|
|
1891
1890
|
throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");
|
|
1892
1891
|
const [, t, n, i, r, o, l] = e.map(Number), a = e[7] ? Number((e[7] + "00").substr(1, 3)) : 0;
|
|
1893
1892
|
let c = Date.UTC(t, n - 1, i, r || 0, o || 0, l || 0, a);
|
|
1894
1893
|
const u = e[8];
|
|
1895
1894
|
if (u && u !== "Z") {
|
|
1896
|
-
let f =
|
|
1895
|
+
let f = St(u, !1);
|
|
1897
1896
|
Math.abs(f) < 30 && (f *= 60), c -= 6e4 * f;
|
|
1898
1897
|
}
|
|
1899
1898
|
return new Date(c);
|
|
1900
1899
|
},
|
|
1901
1900
|
stringify: ({ value: s }) => s.toISOString().replace(/((T00:00)?:00)?\.000Z$/, "")
|
|
1902
|
-
},
|
|
1901
|
+
}, $t = [
|
|
1903
1902
|
ue,
|
|
1904
1903
|
he,
|
|
1904
|
+
Re,
|
|
1905
1905
|
Ve,
|
|
1906
|
-
|
|
1906
|
+
as,
|
|
1907
1907
|
cs,
|
|
1908
|
-
|
|
1908
|
+
rn,
|
|
1909
|
+
on,
|
|
1909
1910
|
ln,
|
|
1910
1911
|
an,
|
|
1911
|
-
|
|
1912
|
-
|
|
1912
|
+
tn,
|
|
1913
|
+
sn,
|
|
1913
1914
|
nn,
|
|
1914
|
-
|
|
1915
|
-
on,
|
|
1916
|
-
gt,
|
|
1917
|
-
bt,
|
|
1915
|
+
mt,
|
|
1918
1916
|
yt,
|
|
1919
|
-
|
|
1917
|
+
gt,
|
|
1918
|
+
wt,
|
|
1919
|
+
us,
|
|
1920
1920
|
hs,
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
],
|
|
1924
|
-
["
|
|
1925
|
-
["
|
|
1926
|
-
["
|
|
1927
|
-
["
|
|
1928
|
-
["yaml-1.1", Ct]
|
|
1921
|
+
Ye
|
|
1922
|
+
], Ct = /* @__PURE__ */ new Map([
|
|
1923
|
+
["core", Xs],
|
|
1924
|
+
["failsafe", [ue, he, Re]],
|
|
1925
|
+
["json", en],
|
|
1926
|
+
["yaml11", $t],
|
|
1927
|
+
["yaml-1.1", $t]
|
|
1929
1928
|
]), vt = {
|
|
1930
|
-
binary:
|
|
1931
|
-
bool:
|
|
1932
|
-
float:
|
|
1933
|
-
floatExp:
|
|
1934
|
-
floatNaN:
|
|
1935
|
-
floatTime:
|
|
1936
|
-
int:
|
|
1937
|
-
intHex:
|
|
1938
|
-
intOct:
|
|
1939
|
-
intTime:
|
|
1929
|
+
binary: mt,
|
|
1930
|
+
bool: dt,
|
|
1931
|
+
float: es,
|
|
1932
|
+
floatExp: Zt,
|
|
1933
|
+
floatNaN: zt,
|
|
1934
|
+
floatTime: hs,
|
|
1935
|
+
int: ns,
|
|
1936
|
+
intHex: is,
|
|
1937
|
+
intOct: ss,
|
|
1938
|
+
intTime: us,
|
|
1940
1939
|
map: ue,
|
|
1941
|
-
null:
|
|
1942
|
-
omap:
|
|
1943
|
-
pairs:
|
|
1940
|
+
null: Ve,
|
|
1941
|
+
omap: yt,
|
|
1942
|
+
pairs: gt,
|
|
1944
1943
|
seq: he,
|
|
1945
|
-
set:
|
|
1946
|
-
timestamp:
|
|
1947
|
-
},
|
|
1948
|
-
"tag:yaml.org,2002:binary":
|
|
1949
|
-
"tag:yaml.org,2002:omap":
|
|
1950
|
-
"tag:yaml.org,2002:pairs":
|
|
1951
|
-
"tag:yaml.org,2002:set":
|
|
1952
|
-
"tag:yaml.org,2002:timestamp":
|
|
1944
|
+
set: wt,
|
|
1945
|
+
timestamp: Ye
|
|
1946
|
+
}, cn = {
|
|
1947
|
+
"tag:yaml.org,2002:binary": mt,
|
|
1948
|
+
"tag:yaml.org,2002:omap": yt,
|
|
1949
|
+
"tag:yaml.org,2002:pairs": gt,
|
|
1950
|
+
"tag:yaml.org,2002:set": wt,
|
|
1951
|
+
"tag:yaml.org,2002:timestamp": Ye
|
|
1953
1952
|
};
|
|
1954
1953
|
function Ze(s, e) {
|
|
1955
|
-
let t =
|
|
1954
|
+
let t = Ct.get(e);
|
|
1956
1955
|
if (!t)
|
|
1957
1956
|
if (Array.isArray(s))
|
|
1958
1957
|
t = [];
|
|
1959
1958
|
else {
|
|
1960
|
-
const n = Array.from(
|
|
1959
|
+
const n = Array.from(Ct.keys()).filter((i) => i !== "yaml11").map((i) => JSON.stringify(i)).join(", ");
|
|
1961
1960
|
throw new Error(`Unknown schema "${e}"; use one of ${n} or define customTags array`);
|
|
1962
1961
|
}
|
|
1963
1962
|
if (Array.isArray(s))
|
|
@@ -1975,17 +1974,17 @@ function Ze(s, e) {
|
|
|
1975
1974
|
throw new Error(`Unknown custom tag "${n}"; use one of ${r}`);
|
|
1976
1975
|
});
|
|
1977
1976
|
}
|
|
1978
|
-
const
|
|
1979
|
-
class
|
|
1977
|
+
const fn = (s, e) => s.key < e.key ? -1 : s.key > e.key ? 1 : 0;
|
|
1978
|
+
class Ge {
|
|
1980
1979
|
constructor({ compat: e, customTags: t, merge: n, resolveKnownTags: i, schema: r, sortMapEntries: o, toStringDefaults: l }) {
|
|
1981
|
-
this.compat = Array.isArray(e) ? Ze(e, "compat") : e ? Ze(null, e) : null, this.merge = !!n, this.name = typeof r == "string" && r || "core", this.knownTags = i ?
|
|
1980
|
+
this.compat = Array.isArray(e) ? Ze(e, "compat") : e ? Ze(null, e) : null, this.merge = !!n, this.name = typeof r == "string" && r || "core", this.knownTags = i ? cn : {}, this.tags = Ze(t, this.name), this.toStringOptions = l ?? null, Object.defineProperty(this, W, { value: ue }), Object.defineProperty(this, R, { value: Re }), Object.defineProperty(this, ce, { value: he }), this.sortMapEntries = typeof o == "function" ? o : o === !0 ? fn : null;
|
|
1982
1981
|
}
|
|
1983
1982
|
clone() {
|
|
1984
|
-
const e = Object.create(
|
|
1983
|
+
const e = Object.create(Ge.prototype, Object.getOwnPropertyDescriptors(this));
|
|
1985
1984
|
return e.tags = this.tags.slice(), e;
|
|
1986
1985
|
}
|
|
1987
1986
|
}
|
|
1988
|
-
function
|
|
1987
|
+
function un(s, e) {
|
|
1989
1988
|
const t = [];
|
|
1990
1989
|
let n = e.directives === !0;
|
|
1991
1990
|
if (e.directives !== !1 && s.directives) {
|
|
@@ -1993,7 +1992,7 @@ function dn(s, e) {
|
|
|
1993
1992
|
a ? (t.push(a), n = !0) : s.directives.docStart && (n = !0);
|
|
1994
1993
|
}
|
|
1995
1994
|
n && t.push("---");
|
|
1996
|
-
const i =
|
|
1995
|
+
const i = Qt(s, e), { commentString: r } = i.options;
|
|
1997
1996
|
if (s.commentBefore) {
|
|
1998
1997
|
t.length !== 1 && t.unshift("");
|
|
1999
1998
|
const a = r(s.commentBefore);
|
|
@@ -2054,7 +2053,7 @@ function ge(s, e, t, n) {
|
|
|
2054
2053
|
}
|
|
2055
2054
|
class de {
|
|
2056
2055
|
constructor(e, t, n) {
|
|
2057
|
-
this.commentBefore = null, this.comment = null, this.errors = [], this.warnings = [], Object.defineProperty(this, M, { value:
|
|
2056
|
+
this.commentBefore = null, this.comment = null, this.errors = [], this.warnings = [], Object.defineProperty(this, M, { value: rt });
|
|
2058
2057
|
let i = null;
|
|
2059
2058
|
typeof t == "function" || Array.isArray(t) ? i = t : n === void 0 && t && (n = t, t = void 0);
|
|
2060
2059
|
const r = Object.assign({
|
|
@@ -2077,7 +2076,7 @@ class de {
|
|
|
2077
2076
|
*/
|
|
2078
2077
|
clone() {
|
|
2079
2078
|
const e = Object.create(de.prototype, {
|
|
2080
|
-
[M]: { value:
|
|
2079
|
+
[M]: { value: rt }
|
|
2081
2080
|
});
|
|
2082
2081
|
return e.commentBefore = this.commentBefore, e.comment = this.comment, e.errors = this.errors.slice(), e.warnings = this.warnings.slice(), e.options = Object.assign({}, this.options), this.directives && (e.directives = this.directives.clone()), e.schema = this.schema.clone(), e.contents = T(this.contents) ? this.contents.clone(e.schema) : this.contents, this.range && (e.range = this.range.slice()), e;
|
|
2083
2082
|
}
|
|
@@ -2100,11 +2099,11 @@ class de {
|
|
|
2100
2099
|
*/
|
|
2101
2100
|
createAlias(e, t) {
|
|
2102
2101
|
if (!e.anchor) {
|
|
2103
|
-
const n =
|
|
2102
|
+
const n = Wt(this);
|
|
2104
2103
|
e.anchor = // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
2105
|
-
!t || n.has(t) ?
|
|
2104
|
+
!t || n.has(t) ? Jt(t || "a", n) : t;
|
|
2106
2105
|
}
|
|
2107
|
-
return new
|
|
2106
|
+
return new De(e.anchor);
|
|
2108
2107
|
}
|
|
2109
2108
|
createNode(e, t, n) {
|
|
2110
2109
|
let i;
|
|
@@ -2115,7 +2114,7 @@ class de {
|
|
|
2115
2114
|
b.length > 0 && (t = t.concat(b)), i = t;
|
|
2116
2115
|
} else
|
|
2117
2116
|
n === void 0 && t && (n = t, t = void 0);
|
|
2118
|
-
const { aliasDuplicateObjects: r, anchorPrefix: o, flow: l, keepUndefined: a, onTagObj: c, tag: u } = n ?? {}, { onAnchor: f, setAnchors: h, sourceObjects: p } =
|
|
2117
|
+
const { aliasDuplicateObjects: r, anchorPrefix: o, flow: l, keepUndefined: a, onTagObj: c, tag: u } = n ?? {}, { onAnchor: f, setAnchors: h, sourceObjects: p } = Ps(
|
|
2119
2118
|
this,
|
|
2120
2119
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
2121
2120
|
o || "a"
|
|
@@ -2185,14 +2184,14 @@ class de {
|
|
|
2185
2184
|
* boolean to add/remove the item from the set.
|
|
2186
2185
|
*/
|
|
2187
2186
|
set(e, t) {
|
|
2188
|
-
this.contents == null ? this.contents =
|
|
2187
|
+
this.contents == null ? this.contents = _e(this.schema, [e], t) : te(this.contents) && this.contents.set(e, t);
|
|
2189
2188
|
}
|
|
2190
2189
|
/**
|
|
2191
2190
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
2192
2191
|
* boolean to add/remove the item from the set.
|
|
2193
2192
|
*/
|
|
2194
2193
|
setIn(e, t) {
|
|
2195
|
-
me(e) ? this.contents = t : this.contents == null ? this.contents =
|
|
2194
|
+
me(e) ? this.contents = t : this.contents == null ? this.contents = _e(this.schema, Array.from(e), t) : te(this.contents) && this.contents.setIn(e, t);
|
|
2196
2195
|
}
|
|
2197
2196
|
/**
|
|
2198
2197
|
* Change the YAML version and schema used by the document.
|
|
@@ -2223,7 +2222,7 @@ class de {
|
|
|
2223
2222
|
if (t.schema instanceof Object)
|
|
2224
2223
|
this.schema = t.schema;
|
|
2225
2224
|
else if (n)
|
|
2226
|
-
this.schema = new
|
|
2225
|
+
this.schema = new Ge(Object.assign(n, t));
|
|
2227
2226
|
else
|
|
2228
2227
|
throw new Error("With a null YAML version, the { schema: Schema } option is required");
|
|
2229
2228
|
}
|
|
@@ -2260,7 +2259,7 @@ class de {
|
|
|
2260
2259
|
const t = JSON.stringify(e.indent);
|
|
2261
2260
|
throw new Error(`"indent" option must be a positive integer, not ${t}`);
|
|
2262
2261
|
}
|
|
2263
|
-
return
|
|
2262
|
+
return un(this, e);
|
|
2264
2263
|
}
|
|
2265
2264
|
}
|
|
2266
2265
|
function te(s) {
|
|
@@ -2268,22 +2267,22 @@ function te(s) {
|
|
|
2268
2267
|
return !0;
|
|
2269
2268
|
throw new Error("Expected a YAML collection as document contents");
|
|
2270
2269
|
}
|
|
2271
|
-
class
|
|
2270
|
+
class kt extends Error {
|
|
2272
2271
|
constructor(e, t, n, i) {
|
|
2273
2272
|
super(), this.name = e, this.code = n, this.message = i, this.pos = t;
|
|
2274
2273
|
}
|
|
2275
2274
|
}
|
|
2276
|
-
class Q extends
|
|
2275
|
+
class Q extends kt {
|
|
2277
2276
|
constructor(e, t, n) {
|
|
2278
2277
|
super("YAMLParseError", e, t, n);
|
|
2279
2278
|
}
|
|
2280
2279
|
}
|
|
2281
|
-
class
|
|
2280
|
+
class ds extends kt {
|
|
2282
2281
|
constructor(e, t, n) {
|
|
2283
2282
|
super("YAMLWarning", e, t, n);
|
|
2284
2283
|
}
|
|
2285
2284
|
}
|
|
2286
|
-
const
|
|
2285
|
+
const je = (s, e) => (t) => {
|
|
2287
2286
|
if (t.pos[0] === -1)
|
|
2288
2287
|
return;
|
|
2289
2288
|
t.linePos = t.pos.map((l) => e.linePos(l));
|
|
@@ -2394,21 +2393,21 @@ function we(s) {
|
|
|
2394
2393
|
return !0;
|
|
2395
2394
|
}
|
|
2396
2395
|
}
|
|
2397
|
-
function
|
|
2396
|
+
function at(s, e, t) {
|
|
2398
2397
|
if (e?.type === "flow-collection") {
|
|
2399
2398
|
const n = e.end[0];
|
|
2400
2399
|
n.indent === s && (n.source === "]" || n.source === "}") && we(e) && t(n, "BAD_INDENT", "Flow end indicator should be more indented than parent", !0);
|
|
2401
2400
|
}
|
|
2402
2401
|
}
|
|
2403
|
-
function
|
|
2402
|
+
function ps(s, e, t) {
|
|
2404
2403
|
const { uniqueKeys: n } = s.options;
|
|
2405
2404
|
if (n === !1)
|
|
2406
2405
|
return !1;
|
|
2407
2406
|
const i = typeof n == "function" ? n : (r, o) => r === o || A(r) && A(o) && r.value === o.value && !(r.value === "<<" && s.schema.merge);
|
|
2408
2407
|
return e.some((r) => i(r.key, t));
|
|
2409
2408
|
}
|
|
2410
|
-
const
|
|
2411
|
-
function
|
|
2409
|
+
const _t = "All mapping items must start at the same column";
|
|
2410
|
+
function hn({ composeNode: s, composeEmptyNode: e }, t, n, i) {
|
|
2412
2411
|
const r = new j(t.schema);
|
|
2413
2412
|
t.atRoot && (t.atRoot = !1);
|
|
2414
2413
|
let o = n.offset, l = null;
|
|
@@ -2421,16 +2420,16 @@ function pn({ composeNode: s, composeEmptyNode: e }, t, n, i) {
|
|
|
2421
2420
|
startOnNewline: !0
|
|
2422
2421
|
}), y = !p.found;
|
|
2423
2422
|
if (y) {
|
|
2424
|
-
if (u && (u.type === "block-seq" ? i(o, "BLOCK_AS_IMPLICIT_KEY", "A block sequence may not be used as an implicit map key") : "indent" in u && u.indent !== n.indent && i(o, "BAD_INDENT",
|
|
2423
|
+
if (u && (u.type === "block-seq" ? i(o, "BLOCK_AS_IMPLICIT_KEY", "A block sequence may not be used as an implicit map key") : "indent" in u && u.indent !== n.indent && i(o, "BAD_INDENT", _t)), !p.anchor && !p.tag && !f) {
|
|
2425
2424
|
l = p.end, p.comment && (r.comment ? r.comment += `
|
|
2426
2425
|
` + p.comment : r.comment = p.comment);
|
|
2427
2426
|
continue;
|
|
2428
2427
|
}
|
|
2429
2428
|
(p.hasNewlineAfterProp || we(u)) && i(u ?? c[c.length - 1], "MULTILINE_IMPLICIT_KEY", "Implicit keys need to be on a single line");
|
|
2430
2429
|
} else
|
|
2431
|
-
p.found?.indent !== n.indent && i(o, "BAD_INDENT",
|
|
2430
|
+
p.found?.indent !== n.indent && i(o, "BAD_INDENT", _t);
|
|
2432
2431
|
const d = p.end, m = u ? s(t, u, p, i) : e(t, d, c, null, p, i);
|
|
2433
|
-
t.schema.compat &&
|
|
2432
|
+
t.schema.compat && at(n.indent, u, i), ps(t, r.items, m) && i(d, "DUPLICATE_KEY", "Map keys must be unique");
|
|
2434
2433
|
const b = ae(f ?? [], {
|
|
2435
2434
|
indicator: "map-value-ind",
|
|
2436
2435
|
next: h,
|
|
@@ -2441,7 +2440,7 @@ function pn({ composeNode: s, composeEmptyNode: e }, t, n, i) {
|
|
|
2441
2440
|
if (o = b.end, b.found) {
|
|
2442
2441
|
y && (h?.type === "block-map" && !b.hasNewline && i(o, "BLOCK_AS_IMPLICIT_KEY", "Nested mappings are not allowed in compact mappings"), t.options.strict && p.start < b.found.offset - 1024 && i(m.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));
|
|
2443
2442
|
const w = h ? s(t, h, b, i) : e(t, o, f, null, b, i);
|
|
2444
|
-
t.schema.compat &&
|
|
2443
|
+
t.schema.compat && at(n.indent, h, i), o = w.range[2];
|
|
2445
2444
|
const k = new $(m, w);
|
|
2446
2445
|
t.options.keepSourceTokens && (k.srcToken = a), r.items.push(k);
|
|
2447
2446
|
} else {
|
|
@@ -2453,7 +2452,7 @@ function pn({ composeNode: s, composeEmptyNode: e }, t, n, i) {
|
|
|
2453
2452
|
}
|
|
2454
2453
|
return l && l < o && i(l, "IMPOSSIBLE", "Map comment with trailing content"), r.range = [n.offset, o, l ?? o], r;
|
|
2455
2454
|
}
|
|
2456
|
-
function
|
|
2455
|
+
function dn({ composeNode: s, composeEmptyNode: e }, t, n, i) {
|
|
2457
2456
|
const r = new Z(t.schema);
|
|
2458
2457
|
t.atRoot && (t.atRoot = !1);
|
|
2459
2458
|
let o = n.offset, l = null;
|
|
@@ -2473,7 +2472,7 @@ function mn({ composeNode: s, composeEmptyNode: e }, t, n, i) {
|
|
|
2473
2472
|
continue;
|
|
2474
2473
|
}
|
|
2475
2474
|
const f = c ? s(t, c, u, i) : e(t, u.end, a, null, u, i);
|
|
2476
|
-
t.schema.compat &&
|
|
2475
|
+
t.schema.compat && at(n.indent, c, i), o = f.range[2], r.items.push(f);
|
|
2477
2476
|
}
|
|
2478
2477
|
return r.range = [n.offset, o, l ?? o], r;
|
|
2479
2478
|
}
|
|
@@ -2505,7 +2504,7 @@ function Ae(s, e, t, n) {
|
|
|
2505
2504
|
return { comment: i, offset: e };
|
|
2506
2505
|
}
|
|
2507
2506
|
const et = "Block collections are not allowed within flow collections", tt = (s) => s && (s.type === "block-map" || s.type === "block-seq");
|
|
2508
|
-
function
|
|
2507
|
+
function pn({ composeNode: s, composeEmptyNode: e }, t, n, i) {
|
|
2509
2508
|
const r = n.start.source === "{", o = r ? "flow map" : "flow sequence", l = r ? new j(t.schema) : new Z(t.schema);
|
|
2510
2509
|
l.flow = !0;
|
|
2511
2510
|
const a = t.atRoot;
|
|
@@ -2572,11 +2571,11 @@ function gn({ composeNode: s, composeEmptyNode: e }, t, n, i) {
|
|
|
2572
2571
|
if (E.found) {
|
|
2573
2572
|
if (!r && !S.found && t.options.strict) {
|
|
2574
2573
|
if (w)
|
|
2575
|
-
for (const
|
|
2576
|
-
if (
|
|
2574
|
+
for (const _ of w) {
|
|
2575
|
+
if (_ === E.found)
|
|
2577
2576
|
break;
|
|
2578
|
-
if (
|
|
2579
|
-
i(
|
|
2577
|
+
if (_.type === "newline") {
|
|
2578
|
+
i(_, "MULTILINE_IMPLICIT_KEY", "Implicit keys of flow sequence pairs need to be on a single line");
|
|
2580
2579
|
break;
|
|
2581
2580
|
}
|
|
2582
2581
|
}
|
|
@@ -2589,11 +2588,11 @@ function gn({ composeNode: s, composeEmptyNode: e }, t, n, i) {
|
|
|
2589
2588
|
` + E.comment : g.comment = E.comment);
|
|
2590
2589
|
const ee = new $(g, q);
|
|
2591
2590
|
if (t.options.keepSourceTokens && (ee.srcToken = d), r) {
|
|
2592
|
-
const
|
|
2593
|
-
|
|
2591
|
+
const _ = l;
|
|
2592
|
+
ps(t, _.items, g) && i(O, "DUPLICATE_KEY", "Map keys must be unique"), _.items.push(ee);
|
|
2594
2593
|
} else {
|
|
2595
|
-
const
|
|
2596
|
-
|
|
2594
|
+
const _ = new j(t.schema);
|
|
2595
|
+
_.flow = !0, _.items.push(ee), l.items.push(_);
|
|
2597
2596
|
}
|
|
2598
2597
|
c = q ? q.range[2] : E.end;
|
|
2599
2598
|
}
|
|
@@ -2614,19 +2613,19 @@ function gn({ composeNode: s, composeEmptyNode: e }, t, n, i) {
|
|
|
2614
2613
|
l.range = [n.offset, p, p];
|
|
2615
2614
|
return l;
|
|
2616
2615
|
}
|
|
2617
|
-
function
|
|
2616
|
+
function mn(s, e, t, n, i) {
|
|
2618
2617
|
let r;
|
|
2619
2618
|
switch (t.type) {
|
|
2620
2619
|
case "block-map": {
|
|
2621
|
-
r =
|
|
2620
|
+
r = hn(s, e, t, i);
|
|
2622
2621
|
break;
|
|
2623
2622
|
}
|
|
2624
2623
|
case "block-seq": {
|
|
2625
|
-
r =
|
|
2624
|
+
r = dn(s, e, t, i);
|
|
2626
2625
|
break;
|
|
2627
2626
|
}
|
|
2628
2627
|
case "flow-collection": {
|
|
2629
|
-
r =
|
|
2628
|
+
r = pn(s, e, t, i);
|
|
2630
2629
|
break;
|
|
2631
2630
|
}
|
|
2632
2631
|
}
|
|
@@ -2650,11 +2649,11 @@ function yn(s, e, t, n, i) {
|
|
|
2650
2649
|
const u = c.resolve(r, (h) => i(n, "TAG_RESOLVE_FAILED", h), e.options), f = T(u) ? u : new N(u);
|
|
2651
2650
|
return f.range = r.range, f.tag = o, c?.format && (f.format = c.format), f;
|
|
2652
2651
|
}
|
|
2653
|
-
function
|
|
2654
|
-
const n = s.offset, i =
|
|
2652
|
+
function ms(s, e, t) {
|
|
2653
|
+
const n = s.offset, i = gn(s, e, t);
|
|
2655
2654
|
if (!i)
|
|
2656
2655
|
return { value: "", type: null, comment: "", range: [n, n, n] };
|
|
2657
|
-
const r = i.mode === ">" ? N.BLOCK_FOLDED : N.BLOCK_LITERAL, o = s.source ?
|
|
2656
|
+
const r = i.mode === ">" ? N.BLOCK_FOLDED : N.BLOCK_LITERAL, o = s.source ? yn(s.source) : [];
|
|
2658
2657
|
let l = o.length;
|
|
2659
2658
|
for (let d = o.length - 1; d >= 0; --d) {
|
|
2660
2659
|
const m = o[d][1];
|
|
@@ -2727,7 +2726,7 @@ function gs(s, e, t) {
|
|
|
2727
2726
|
const y = n + i.length + s.source.length;
|
|
2728
2727
|
return { value: f, type: r, comment: i.comment, range: [n, y, y] };
|
|
2729
2728
|
}
|
|
2730
|
-
function
|
|
2729
|
+
function gn({ offset: s, props: e }, t, n) {
|
|
2731
2730
|
if (e[0].type !== "block-scalar-header")
|
|
2732
2731
|
return n(e[0], "IMPOSSIBLE", "Block scalar header not found"), null;
|
|
2733
2732
|
const { source: i } = e[0], r = i[0];
|
|
@@ -2767,25 +2766,25 @@ function bn({ offset: s, props: e }, t, n) {
|
|
|
2767
2766
|
}
|
|
2768
2767
|
return { mode: r, indent: o, chomp: l, comment: u, length: f };
|
|
2769
2768
|
}
|
|
2770
|
-
function
|
|
2769
|
+
function yn(s) {
|
|
2771
2770
|
const e = s.split(/\n( *)/), t = e[0], n = t.match(/^( *)/), r = [n?.[1] ? [n[1], t.slice(n[1].length)] : ["", t]];
|
|
2772
2771
|
for (let o = 1; o < e.length; o += 2)
|
|
2773
2772
|
r.push([e[o], e[o + 1]]);
|
|
2774
2773
|
return r;
|
|
2775
2774
|
}
|
|
2776
|
-
function
|
|
2775
|
+
function gs(s, e, t) {
|
|
2777
2776
|
const { offset: n, type: i, source: r, end: o } = s;
|
|
2778
2777
|
let l, a;
|
|
2779
2778
|
const c = (h, p, y) => t(n + h, p, y);
|
|
2780
2779
|
switch (i) {
|
|
2781
2780
|
case "scalar":
|
|
2782
|
-
l = N.PLAIN, a =
|
|
2781
|
+
l = N.PLAIN, a = bn(r, c);
|
|
2783
2782
|
break;
|
|
2784
2783
|
case "single-quoted-scalar":
|
|
2785
|
-
l = N.QUOTE_SINGLE, a =
|
|
2784
|
+
l = N.QUOTE_SINGLE, a = wn(r, c);
|
|
2786
2785
|
break;
|
|
2787
2786
|
case "double-quoted-scalar":
|
|
2788
|
-
l = N.QUOTE_DOUBLE, a =
|
|
2787
|
+
l = N.QUOTE_DOUBLE, a = Sn(r, c);
|
|
2789
2788
|
break;
|
|
2790
2789
|
default:
|
|
2791
2790
|
return t(s, "UNEXPECTED_TOKEN", `Expected a flow scalar value, but found: ${i}`), {
|
|
@@ -2803,7 +2802,7 @@ function ys(s, e, t) {
|
|
|
2803
2802
|
range: [n, u, f.offset]
|
|
2804
2803
|
};
|
|
2805
2804
|
}
|
|
2806
|
-
function
|
|
2805
|
+
function bn(s, e) {
|
|
2807
2806
|
let t = "";
|
|
2808
2807
|
switch (s[0]) {
|
|
2809
2808
|
case " ":
|
|
@@ -2826,12 +2825,12 @@ function Sn(s, e) {
|
|
|
2826
2825
|
break;
|
|
2827
2826
|
}
|
|
2828
2827
|
}
|
|
2829
|
-
return t && e(0, "BAD_SCALAR_START", `Plain value cannot start with ${t}`),
|
|
2828
|
+
return t && e(0, "BAD_SCALAR_START", `Plain value cannot start with ${t}`), ys(s);
|
|
2830
2829
|
}
|
|
2831
|
-
function
|
|
2832
|
-
return (s[s.length - 1] !== "'" || s.length === 1) && e(s.length, "MISSING_CHAR", "Missing closing 'quote"),
|
|
2830
|
+
function wn(s, e) {
|
|
2831
|
+
return (s[s.length - 1] !== "'" || s.length === 1) && e(s.length, "MISSING_CHAR", "Missing closing 'quote"), ys(s.slice(1, -1)).replace(/''/g, "'");
|
|
2833
2832
|
}
|
|
2834
|
-
function
|
|
2833
|
+
function ys(s) {
|
|
2835
2834
|
let e, t;
|
|
2836
2835
|
try {
|
|
2837
2836
|
e = new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
@@ -2851,7 +2850,7 @@ function bs(s) {
|
|
|
2851
2850
|
const l = /[ \t]*(.*)/sy;
|
|
2852
2851
|
return l.lastIndex = o, n = l.exec(s), i + r + (n?.[1] ?? "");
|
|
2853
2852
|
}
|
|
2854
|
-
function
|
|
2853
|
+
function Sn(s, e) {
|
|
2855
2854
|
let t = "";
|
|
2856
2855
|
for (let n = 1; n < s.length - 1; ++n) {
|
|
2857
2856
|
const i = s[n];
|
|
@@ -2859,11 +2858,11 @@ function Nn(s, e) {
|
|
|
2859
2858
|
`))
|
|
2860
2859
|
if (i === `
|
|
2861
2860
|
`) {
|
|
2862
|
-
const { fold: r, offset: o } =
|
|
2861
|
+
const { fold: r, offset: o } = kn(s, n);
|
|
2863
2862
|
t += r, n = o;
|
|
2864
2863
|
} else if (i === "\\") {
|
|
2865
2864
|
let r = s[++n];
|
|
2866
|
-
const o =
|
|
2865
|
+
const o = Nn[r];
|
|
2867
2866
|
if (o)
|
|
2868
2867
|
t += o;
|
|
2869
2868
|
else if (r === `
|
|
@@ -2876,7 +2875,7 @@ function Nn(s, e) {
|
|
|
2876
2875
|
r = s[++n + 1];
|
|
2877
2876
|
else if (r === "x" || r === "u" || r === "U") {
|
|
2878
2877
|
const l = { x: 2, u: 4, U: 8 }[r];
|
|
2879
|
-
t +=
|
|
2878
|
+
t += On(s, n + 1, l, e), n += l;
|
|
2880
2879
|
} else {
|
|
2881
2880
|
const l = s.substr(n - 1, 2);
|
|
2882
2881
|
e(n - 1, "BAD_DQ_ESCAPE", `Invalid escape sequence ${l}`), t += l;
|
|
@@ -2894,7 +2893,7 @@ function Nn(s, e) {
|
|
|
2894
2893
|
}
|
|
2895
2894
|
return (s[s.length - 1] !== '"' || s.length === 1) && e(s.length, "MISSING_CHAR", 'Missing closing "quote'), t;
|
|
2896
2895
|
}
|
|
2897
|
-
function
|
|
2896
|
+
function kn(s, e) {
|
|
2898
2897
|
let t = "", n = s[e + 1];
|
|
2899
2898
|
for (; (n === " " || n === " " || n === `
|
|
2900
2899
|
` || n === "\r") && !(n === "\r" && s[e + 2] !== `
|
|
@@ -2904,7 +2903,7 @@ function On(s, e) {
|
|
|
2904
2903
|
`), e += 1, n = s[e + 1];
|
|
2905
2904
|
return t || (t = " "), { fold: t, offset: e };
|
|
2906
2905
|
}
|
|
2907
|
-
const
|
|
2906
|
+
const Nn = {
|
|
2908
2907
|
0: "\0",
|
|
2909
2908
|
a: "\x07",
|
|
2910
2909
|
b: "\b",
|
|
@@ -2925,7 +2924,7 @@ const An = {
|
|
|
2925
2924
|
"\\": "\\",
|
|
2926
2925
|
" ": " "
|
|
2927
2926
|
};
|
|
2928
|
-
function
|
|
2927
|
+
function On(s, e, t, n) {
|
|
2929
2928
|
const i = s.substr(e, t), o = i.length === t && /^[0-9a-fA-F]+$/.test(i) ? parseInt(i, 16) : NaN;
|
|
2930
2929
|
if (isNaN(o)) {
|
|
2931
2930
|
const l = s.substr(e - 2, t + 2);
|
|
@@ -2933,8 +2932,8 @@ function En(s, e, t, n) {
|
|
|
2933
2932
|
}
|
|
2934
2933
|
return String.fromCodePoint(o);
|
|
2935
2934
|
}
|
|
2936
|
-
function
|
|
2937
|
-
const { value: i, type: r, comment: o, range: l } = e.type === "block-scalar" ?
|
|
2935
|
+
function bs(s, e, t, n) {
|
|
2936
|
+
const { value: i, type: r, comment: o, range: l } = e.type === "block-scalar" ? ms(e, s.options.strict, n) : gs(e, s.options.strict, n), a = t ? s.directives.tagName(t.source, (f) => n(t, "TAG_RESOLVE_FAILED", f)) : null, c = t && a ? An(s.schema, i, a, t, n) : e.type === "scalar" ? En(s, i, e, n) : s.schema[R];
|
|
2938
2937
|
let u;
|
|
2939
2938
|
try {
|
|
2940
2939
|
const f = c.resolve(i, (h) => n(t ?? e, "TAG_RESOLVE_FAILED", h), s.options);
|
|
@@ -2945,7 +2944,7 @@ function ws(s, e, t, n) {
|
|
|
2945
2944
|
}
|
|
2946
2945
|
return u.range = l, u.source = i, r && (u.type = r), a && (u.tag = a), c.format && (u.format = c.format), o && (u.comment = o), u;
|
|
2947
2946
|
}
|
|
2948
|
-
function
|
|
2947
|
+
function An(s, e, t, n, i) {
|
|
2949
2948
|
if (t === "!")
|
|
2950
2949
|
return s[R];
|
|
2951
2950
|
const r = [];
|
|
@@ -2961,7 +2960,7 @@ function In(s, e, t, n, i) {
|
|
|
2961
2960
|
const o = s.knownTags[t];
|
|
2962
2961
|
return o && !o.collection ? (s.tags.push(Object.assign({}, o, { default: !1, test: void 0 })), o) : (i(n, "TAG_RESOLVE_FAILED", `Unresolved tag: ${t}`, t !== "tag:yaml.org,2002:str"), s[R]);
|
|
2963
2962
|
}
|
|
2964
|
-
function
|
|
2963
|
+
function En({ directives: s, schema: e }, t, n, i) {
|
|
2965
2964
|
const r = e.tags.find((o) => o.default && o.test?.test(t)) || e[R];
|
|
2966
2965
|
if (e.compat) {
|
|
2967
2966
|
const o = e.compat.find((l) => l.default && l.test?.test(t)) ?? e[R];
|
|
@@ -2972,7 +2971,7 @@ function Ln({ directives: s, schema: e }, t, n, i) {
|
|
|
2972
2971
|
}
|
|
2973
2972
|
return r;
|
|
2974
2973
|
}
|
|
2975
|
-
function
|
|
2974
|
+
function In(s, e, t) {
|
|
2976
2975
|
if (e) {
|
|
2977
2976
|
t === null && (t = e.length);
|
|
2978
2977
|
for (let n = t - 1; n >= 0; --n) {
|
|
@@ -2991,48 +2990,48 @@ function Tn(s, e, t) {
|
|
|
2991
2990
|
}
|
|
2992
2991
|
return s;
|
|
2993
2992
|
}
|
|
2994
|
-
const
|
|
2995
|
-
function
|
|
2993
|
+
const Ln = { composeNode: ws, composeEmptyNode: Nt };
|
|
2994
|
+
function ws(s, e, t, n) {
|
|
2996
2995
|
const { spaceBefore: i, comment: r, anchor: o, tag: l } = t;
|
|
2997
2996
|
let a, c = !0;
|
|
2998
2997
|
switch (e.type) {
|
|
2999
2998
|
case "alias":
|
|
3000
|
-
a =
|
|
2999
|
+
a = Tn(s, e, n), (o || l) && n(e, "ALIAS_PROPS", "An alias node must not specify any properties");
|
|
3001
3000
|
break;
|
|
3002
3001
|
case "scalar":
|
|
3003
3002
|
case "single-quoted-scalar":
|
|
3004
3003
|
case "double-quoted-scalar":
|
|
3005
3004
|
case "block-scalar":
|
|
3006
|
-
a =
|
|
3005
|
+
a = bs(s, e, l, n), o && (a.anchor = o.source.substring(1));
|
|
3007
3006
|
break;
|
|
3008
3007
|
case "block-map":
|
|
3009
3008
|
case "block-seq":
|
|
3010
3009
|
case "flow-collection":
|
|
3011
|
-
a =
|
|
3010
|
+
a = mn(Ln, s, e, l, n), o && (a.anchor = o.source.substring(1));
|
|
3012
3011
|
break;
|
|
3013
3012
|
default: {
|
|
3014
3013
|
const u = e.type === "error" ? e.message : `Unsupported token (type: ${e.type})`;
|
|
3015
|
-
n(e, "UNEXPECTED_TOKEN", u), a =
|
|
3014
|
+
n(e, "UNEXPECTED_TOKEN", u), a = Nt(s, e.offset, void 0, null, t, n), c = !1;
|
|
3016
3015
|
}
|
|
3017
3016
|
}
|
|
3018
3017
|
return o && a.anchor === "" && n(o, "BAD_ALIAS", "Anchor cannot be an empty string"), i && (a.spaceBefore = !0), r && (e.type === "scalar" && e.source === "" ? a.comment = r : a.commentBefore = r), s.options.keepSourceTokens && c && (a.srcToken = e), a;
|
|
3019
3018
|
}
|
|
3020
|
-
function
|
|
3019
|
+
function Nt(s, e, t, n, { spaceBefore: i, comment: r, anchor: o, tag: l, end: a }, c) {
|
|
3021
3020
|
const u = {
|
|
3022
3021
|
type: "scalar",
|
|
3023
|
-
offset:
|
|
3022
|
+
offset: In(e, t, n),
|
|
3024
3023
|
indent: -1,
|
|
3025
3024
|
source: ""
|
|
3026
|
-
}, f =
|
|
3025
|
+
}, f = bs(s, u, l, c);
|
|
3027
3026
|
return o && (f.anchor = o.source.substring(1), f.anchor === "" && c(o, "BAD_ALIAS", "Anchor cannot be an empty string")), i && (f.spaceBefore = !0), r && (f.comment = r, f.range[2] = a), f;
|
|
3028
3027
|
}
|
|
3029
|
-
function
|
|
3030
|
-
const r = new
|
|
3028
|
+
function Tn({ options: s }, { offset: e, source: t, end: n }, i) {
|
|
3029
|
+
const r = new De(t.substring(1));
|
|
3031
3030
|
r.source === "" && i(e, "BAD_ALIAS", "Alias cannot be an empty string"), r.source.endsWith(":") && i(e + t.length - 1, "BAD_ALIAS", "Alias ending in : is ambiguous", !0);
|
|
3032
3031
|
const o = e + t.length, l = Ae(n, o, s.strict, i);
|
|
3033
3032
|
return r.range = [e, o, l.offset], l.comment && (r.comment = l.comment), r;
|
|
3034
3033
|
}
|
|
3035
|
-
function
|
|
3034
|
+
function $n(s, e, { offset: t, start: n, value: i, end: r }, o) {
|
|
3036
3035
|
const l = Object.assign({ _directives: e }, s), a = new de(void 0, l), c = {
|
|
3037
3036
|
atRoot: !0,
|
|
3038
3037
|
directives: a.directives,
|
|
@@ -3045,7 +3044,7 @@ function _n(s, e, { offset: t, start: n, value: i, end: r }, o) {
|
|
|
3045
3044
|
onError: o,
|
|
3046
3045
|
startOnNewline: !0
|
|
3047
3046
|
});
|
|
3048
|
-
u.found && (a.directives.docStart = !0, i && (i.type === "block-map" || i.type === "block-seq") && !u.hasNewline && o(u.end, "MISSING_CHAR", "Block collection cannot start on same line with directives-end marker")), a.contents = i ?
|
|
3047
|
+
u.found && (a.directives.docStart = !0, i && (i.type === "block-map" || i.type === "block-seq") && !u.hasNewline && o(u.end, "MISSING_CHAR", "Block collection cannot start on same line with directives-end marker")), a.contents = i ? ws(c, i, u, o) : Nt(c, u.end, n, null, u, o);
|
|
3049
3048
|
const f = a.contents.range[2], h = Ae(r, f, !1, o);
|
|
3050
3049
|
return h.comment && (a.comment = h.comment), a.range = [t, f, h.offset], a;
|
|
3051
3050
|
}
|
|
@@ -3057,7 +3056,7 @@ function pe(s) {
|
|
|
3057
3056
|
const { offset: e, source: t } = s;
|
|
3058
3057
|
return [e, e + (typeof t == "string" ? t.length : 1)];
|
|
3059
3058
|
}
|
|
3060
|
-
function
|
|
3059
|
+
function Bt(s) {
|
|
3061
3060
|
let e = "", t = !1, n = !1;
|
|
3062
3061
|
for (let i = 0; i < s.length; ++i) {
|
|
3063
3062
|
const r = s[i];
|
|
@@ -3077,15 +3076,15 @@ function jt(s) {
|
|
|
3077
3076
|
}
|
|
3078
3077
|
return { comment: e, afterEmptyLine: n };
|
|
3079
3078
|
}
|
|
3080
|
-
class
|
|
3079
|
+
class Ot {
|
|
3081
3080
|
constructor(e = {}) {
|
|
3082
3081
|
this.doc = null, this.atDirectives = !1, this.prelude = [], this.errors = [], this.warnings = [], this.onError = (t, n, i, r) => {
|
|
3083
3082
|
const o = pe(t);
|
|
3084
|
-
r ? this.warnings.push(new
|
|
3083
|
+
r ? this.warnings.push(new ds(o, n, i)) : this.errors.push(new Q(o, n, i));
|
|
3085
3084
|
}, this.directives = new C({ version: e.version || "1.2" }), this.options = e;
|
|
3086
3085
|
}
|
|
3087
3086
|
decorate(e, t) {
|
|
3088
|
-
const { comment: n, afterEmptyLine: i } =
|
|
3087
|
+
const { comment: n, afterEmptyLine: i } = Bt(this.prelude);
|
|
3089
3088
|
if (n) {
|
|
3090
3089
|
const r = e.contents;
|
|
3091
3090
|
if (t)
|
|
@@ -3114,7 +3113,7 @@ ${o}` : n;
|
|
|
3114
3113
|
*/
|
|
3115
3114
|
streamInfo() {
|
|
3116
3115
|
return {
|
|
3117
|
-
comment:
|
|
3116
|
+
comment: Bt(this.prelude).comment,
|
|
3118
3117
|
directives: this.directives,
|
|
3119
3118
|
errors: this.errors,
|
|
3120
3119
|
warnings: this.warnings
|
|
@@ -3141,7 +3140,7 @@ ${o}` : n;
|
|
|
3141
3140
|
}), this.prelude.push(e.source), this.atDirectives = !0;
|
|
3142
3141
|
break;
|
|
3143
3142
|
case "document": {
|
|
3144
|
-
const t =
|
|
3143
|
+
const t = $n(this.options, this.directives, e, this.onError);
|
|
3145
3144
|
this.atDirectives && !t.directives.docStart && this.onError(e, "MISSING_CHAR", "Missing directives-end/doc-start indicator line"), this.decorate(t, !1), this.doc && (yield this.doc), this.doc = t, this.atDirectives = !1;
|
|
3146
3145
|
break;
|
|
3147
3146
|
}
|
|
@@ -3192,7 +3191,7 @@ ${t.comment}` : t.comment;
|
|
|
3192
3191
|
}
|
|
3193
3192
|
}
|
|
3194
3193
|
}
|
|
3195
|
-
function
|
|
3194
|
+
function Cn(s, e = !0, t) {
|
|
3196
3195
|
if (s) {
|
|
3197
3196
|
const n = (i, r, o) => {
|
|
3198
3197
|
const l = typeof i == "number" ? i : Array.isArray(i) ? i[0] : i.offset;
|
|
@@ -3205,14 +3204,14 @@ function vn(s, e = !0, t) {
|
|
|
3205
3204
|
case "scalar":
|
|
3206
3205
|
case "single-quoted-scalar":
|
|
3207
3206
|
case "double-quoted-scalar":
|
|
3208
|
-
return ys(s, e, n);
|
|
3209
|
-
case "block-scalar":
|
|
3210
3207
|
return gs(s, e, n);
|
|
3208
|
+
case "block-scalar":
|
|
3209
|
+
return ms(s, e, n);
|
|
3211
3210
|
}
|
|
3212
3211
|
}
|
|
3213
3212
|
return null;
|
|
3214
3213
|
}
|
|
3215
|
-
function
|
|
3214
|
+
function vn(s, e) {
|
|
3216
3215
|
const { implicitKey: t = !1, indent: n, inFlow: i = !1, offset: r = -1, type: o = "PLAIN" } = e, l = Ne({ type: o, value: s }, {
|
|
3217
3216
|
implicitKey: t,
|
|
3218
3217
|
indent: n > 0 ? " ".repeat(n) : "",
|
|
@@ -3230,7 +3229,7 @@ function Bn(s, e) {
|
|
|
3230
3229
|
`, h = [
|
|
3231
3230
|
{ type: "block-scalar-header", offset: r, indent: n, source: u }
|
|
3232
3231
|
];
|
|
3233
|
-
return
|
|
3232
|
+
return Ss(h, a) || h.push({ type: "newline", offset: -1, indent: n, source: `
|
|
3234
3233
|
` }), { type: "block-scalar", offset: r, indent: n, props: h, source: f };
|
|
3235
3234
|
}
|
|
3236
3235
|
case '"':
|
|
@@ -3241,7 +3240,7 @@ function Bn(s, e) {
|
|
|
3241
3240
|
return { type: "scalar", offset: r, indent: n, source: l, end: a };
|
|
3242
3241
|
}
|
|
3243
3242
|
}
|
|
3244
|
-
function
|
|
3243
|
+
function _n(s, e, t = {}) {
|
|
3245
3244
|
let { afterKey: n = !1, implicitKey: i = !1, inFlow: r = !1, type: o } = t, l = "indent" in s ? s.indent : null;
|
|
3246
3245
|
if (n && typeof l == "number" && (l += 2), !o)
|
|
3247
3246
|
switch (s.type) {
|
|
@@ -3270,7 +3269,7 @@ function jn(s, e, t = {}) {
|
|
|
3270
3269
|
switch (a[0]) {
|
|
3271
3270
|
case "|":
|
|
3272
3271
|
case ">":
|
|
3273
|
-
|
|
3272
|
+
Bn(s, a);
|
|
3274
3273
|
break;
|
|
3275
3274
|
case '"':
|
|
3276
3275
|
st(s, a, "double-quoted-scalar");
|
|
@@ -3282,7 +3281,7 @@ function jn(s, e, t = {}) {
|
|
|
3282
3281
|
st(s, a, "scalar");
|
|
3283
3282
|
}
|
|
3284
3283
|
}
|
|
3285
|
-
function
|
|
3284
|
+
function Bn(s, e) {
|
|
3286
3285
|
const t = e.indexOf(`
|
|
3287
3286
|
`), n = e.substring(0, t), i = e.substring(t + 1) + `
|
|
3288
3287
|
`;
|
|
@@ -3295,14 +3294,14 @@ function Mn(s, e) {
|
|
|
3295
3294
|
const { offset: r } = s, o = "indent" in s ? s.indent : -1, l = [
|
|
3296
3295
|
{ type: "block-scalar-header", offset: r, indent: o, source: n }
|
|
3297
3296
|
];
|
|
3298
|
-
|
|
3297
|
+
Ss(l, "end" in s ? s.end : void 0) || l.push({ type: "newline", offset: -1, indent: o, source: `
|
|
3299
3298
|
` });
|
|
3300
3299
|
for (const a of Object.keys(s))
|
|
3301
3300
|
a !== "type" && a !== "offset" && delete s[a];
|
|
3302
3301
|
Object.assign(s, { type: "block-scalar", indent: o, props: l, source: i });
|
|
3303
3302
|
}
|
|
3304
3303
|
}
|
|
3305
|
-
function
|
|
3304
|
+
function Ss(s, e) {
|
|
3306
3305
|
if (e)
|
|
3307
3306
|
for (const t of e)
|
|
3308
3307
|
switch (t.type) {
|
|
@@ -3346,13 +3345,13 @@ function st(s, e, t) {
|
|
|
3346
3345
|
}
|
|
3347
3346
|
}
|
|
3348
3347
|
}
|
|
3349
|
-
const
|
|
3350
|
-
function
|
|
3348
|
+
const jn = (s) => "type" in s ? Me(s) : ve(s);
|
|
3349
|
+
function Me(s) {
|
|
3351
3350
|
switch (s.type) {
|
|
3352
3351
|
case "block-scalar": {
|
|
3353
3352
|
let e = "";
|
|
3354
3353
|
for (const t of s.props)
|
|
3355
|
-
e +=
|
|
3354
|
+
e += Me(t);
|
|
3356
3355
|
return e + s.source;
|
|
3357
3356
|
}
|
|
3358
3357
|
case "block-map":
|
|
@@ -3390,18 +3389,18 @@ function ve({ start: s, key: e, sep: t, value: n }) {
|
|
|
3390
3389
|
let i = "";
|
|
3391
3390
|
for (const r of s)
|
|
3392
3391
|
i += r.source;
|
|
3393
|
-
if (e && (i +=
|
|
3392
|
+
if (e && (i += Me(e)), t)
|
|
3394
3393
|
for (const r of t)
|
|
3395
3394
|
i += r.source;
|
|
3396
|
-
return n && (i +=
|
|
3395
|
+
return n && (i += Me(n)), i;
|
|
3397
3396
|
}
|
|
3398
|
-
const
|
|
3397
|
+
const ct = Symbol("break visit"), Mn = Symbol("skip children"), ks = Symbol("remove item");
|
|
3399
3398
|
function x(s, e) {
|
|
3400
|
-
"type" in s && s.type === "document" && (s = { start: s.start, value: s.value }),
|
|
3399
|
+
"type" in s && s.type === "document" && (s = { start: s.start, value: s.value }), Ns(Object.freeze([]), s, e);
|
|
3401
3400
|
}
|
|
3402
|
-
x.BREAK =
|
|
3403
|
-
x.SKIP =
|
|
3404
|
-
x.REMOVE =
|
|
3401
|
+
x.BREAK = ct;
|
|
3402
|
+
x.SKIP = Mn;
|
|
3403
|
+
x.REMOVE = ks;
|
|
3405
3404
|
x.itemAtPath = (s, e) => {
|
|
3406
3405
|
let t = s;
|
|
3407
3406
|
for (const [n, i] of e) {
|
|
@@ -3419,7 +3418,7 @@ x.parentCollection = (s, e) => {
|
|
|
3419
3418
|
return i;
|
|
3420
3419
|
throw new Error("Parent collection not found");
|
|
3421
3420
|
};
|
|
3422
|
-
function
|
|
3421
|
+
function Ns(s, e, t) {
|
|
3423
3422
|
let n = t(e, s);
|
|
3424
3423
|
if (typeof n == "symbol")
|
|
3425
3424
|
return n;
|
|
@@ -3427,13 +3426,13 @@ function Os(s, e, t) {
|
|
|
3427
3426
|
const r = e[i];
|
|
3428
3427
|
if (r && "items" in r) {
|
|
3429
3428
|
for (let o = 0; o < r.items.length; ++o) {
|
|
3430
|
-
const l =
|
|
3429
|
+
const l = Ns(Object.freeze(s.concat([[i, o]])), r.items[o], t);
|
|
3431
3430
|
if (typeof l == "number")
|
|
3432
3431
|
o = l - 1;
|
|
3433
3432
|
else {
|
|
3434
|
-
if (l ===
|
|
3435
|
-
return
|
|
3436
|
-
l ===
|
|
3433
|
+
if (l === ct)
|
|
3434
|
+
return ct;
|
|
3435
|
+
l === ks && (r.items.splice(o, 1), o -= 1);
|
|
3437
3436
|
}
|
|
3438
3437
|
}
|
|
3439
3438
|
typeof n == "function" && i === "key" && (n = n(e, s));
|
|
@@ -3441,14 +3440,14 @@ function Os(s, e, t) {
|
|
|
3441
3440
|
}
|
|
3442
3441
|
return typeof n == "function" ? n(e, s) : n;
|
|
3443
3442
|
}
|
|
3444
|
-
const
|
|
3445
|
-
function
|
|
3443
|
+
const Qe = "\uFEFF", He = "", xe = "", Se = "", Pn = (s) => !!s && "items" in s, Dn = (s) => !!s && (s.type === "scalar" || s.type === "single-quoted-scalar" || s.type === "double-quoted-scalar" || s.type === "block-scalar");
|
|
3444
|
+
function Kn(s) {
|
|
3446
3445
|
switch (s) {
|
|
3447
|
-
case
|
|
3446
|
+
case Qe:
|
|
3448
3447
|
return "<BOM>";
|
|
3449
|
-
case
|
|
3448
|
+
case He:
|
|
3450
3449
|
return "<DOC>";
|
|
3451
|
-
case
|
|
3450
|
+
case xe:
|
|
3452
3451
|
return "<FLOW_END>";
|
|
3453
3452
|
case Se:
|
|
3454
3453
|
return "<SCALAR>";
|
|
@@ -3456,13 +3455,13 @@ function qn(s) {
|
|
|
3456
3455
|
return JSON.stringify(s);
|
|
3457
3456
|
}
|
|
3458
3457
|
}
|
|
3459
|
-
function
|
|
3458
|
+
function Os(s) {
|
|
3460
3459
|
switch (s) {
|
|
3461
|
-
case
|
|
3460
|
+
case Qe:
|
|
3462
3461
|
return "byte-order-mark";
|
|
3463
|
-
case
|
|
3462
|
+
case He:
|
|
3464
3463
|
return "doc-mode";
|
|
3465
|
-
case
|
|
3464
|
+
case xe:
|
|
3466
3465
|
return "flow-error-end";
|
|
3467
3466
|
case Se:
|
|
3468
3467
|
return "scalar";
|
|
@@ -3517,20 +3516,20 @@ function As(s) {
|
|
|
3517
3516
|
}
|
|
3518
3517
|
return null;
|
|
3519
3518
|
}
|
|
3520
|
-
const
|
|
3519
|
+
const Fn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3521
3520
|
__proto__: null,
|
|
3522
|
-
BOM:
|
|
3523
|
-
DOCUMENT:
|
|
3524
|
-
FLOW_END:
|
|
3521
|
+
BOM: Qe,
|
|
3522
|
+
DOCUMENT: He,
|
|
3523
|
+
FLOW_END: xe,
|
|
3525
3524
|
SCALAR: Se,
|
|
3526
|
-
createScalarToken:
|
|
3527
|
-
isCollection:
|
|
3528
|
-
isScalar:
|
|
3529
|
-
prettyToken:
|
|
3530
|
-
resolveAsScalar:
|
|
3531
|
-
setScalarValue:
|
|
3532
|
-
stringify:
|
|
3533
|
-
tokenType:
|
|
3525
|
+
createScalarToken: vn,
|
|
3526
|
+
isCollection: Pn,
|
|
3527
|
+
isScalar: Dn,
|
|
3528
|
+
prettyToken: Kn,
|
|
3529
|
+
resolveAsScalar: Cn,
|
|
3530
|
+
setScalarValue: _n,
|
|
3531
|
+
stringify: jn,
|
|
3532
|
+
tokenType: Os,
|
|
3534
3533
|
visit: x
|
|
3535
3534
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3536
3535
|
function B(s) {
|
|
@@ -3546,9 +3545,9 @@ function B(s) {
|
|
|
3546
3545
|
return !1;
|
|
3547
3546
|
}
|
|
3548
3547
|
}
|
|
3549
|
-
const
|
|
3550
|
-
\r `.split(""), it = (s) => !s ||
|
|
3551
|
-
class
|
|
3548
|
+
const jt = "0123456789ABCDEFabcdef".split(""), qn = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()".split(""), nt = ",[]{}".split(""), Un = ` ,[]{}
|
|
3549
|
+
\r `.split(""), it = (s) => !s || Un.includes(s);
|
|
3550
|
+
class As {
|
|
3552
3551
|
constructor() {
|
|
3553
3552
|
this.atEnd = !1, this.blockScalarIndent = -1, this.blockScalarKeep = !1, this.buffer = "", this.flowKey = !1, this.flowLevel = 0, this.indentNext = 0, this.indentValue = 0, this.lineEndPos = null, this.next = null, this.pos = 0;
|
|
3554
3553
|
}
|
|
@@ -3635,7 +3634,7 @@ class Es {
|
|
|
3635
3634
|
let e = this.getLine();
|
|
3636
3635
|
if (e === null)
|
|
3637
3636
|
return this.setNext("stream");
|
|
3638
|
-
if (e[0] ===
|
|
3637
|
+
if (e[0] === Qe && (yield* this.pushCount(1), e = e.substring(1)), e[0] === "%") {
|
|
3639
3638
|
let t = e.length;
|
|
3640
3639
|
const n = e.indexOf("#");
|
|
3641
3640
|
if (n !== -1) {
|
|
@@ -3656,7 +3655,7 @@ class Es {
|
|
|
3656
3655
|
const t = yield* this.pushSpaces(!0);
|
|
3657
3656
|
return yield* this.pushCount(e.length - t), yield* this.pushNewline(), "stream";
|
|
3658
3657
|
}
|
|
3659
|
-
return yield
|
|
3658
|
+
return yield He, yield* this.parseLineStart();
|
|
3660
3659
|
}
|
|
3661
3660
|
*parseLineStart() {
|
|
3662
3661
|
const e = this.charAt(0);
|
|
@@ -3721,7 +3720,7 @@ class Es {
|
|
|
3721
3720
|
if (i === null)
|
|
3722
3721
|
return this.setNext("flow");
|
|
3723
3722
|
if ((n !== -1 && n < this.indentNext && i[0] !== "#" || n === 0 && (i.startsWith("---") || i.startsWith("...")) && B(i[3])) && !(n === this.indentNext - 1 && this.flowLevel === 1 && (i[0] === "]" || i[0] === "}")))
|
|
3724
|
-
return this.flowLevel = 0, yield
|
|
3723
|
+
return this.flowLevel = 0, yield xe, yield* this.parseLineStart();
|
|
3725
3724
|
let r = 0;
|
|
3726
3725
|
for (; i[r] === ","; )
|
|
3727
3726
|
r += yield* this.pushCount(1), r += yield* this.pushSpaces(!0), this.flowKey = !1;
|
|
@@ -3915,9 +3914,9 @@ class Es {
|
|
|
3915
3914
|
} else {
|
|
3916
3915
|
let e = this.pos + 1, t = this.buffer[e];
|
|
3917
3916
|
for (; t; )
|
|
3918
|
-
if (
|
|
3917
|
+
if (qn.includes(t))
|
|
3919
3918
|
t = this.buffer[++e];
|
|
3920
|
-
else if (t === "%" &&
|
|
3919
|
+
else if (t === "%" && jt.includes(this.buffer[e + 1]) && jt.includes(this.buffer[e + 2]))
|
|
3921
3920
|
t = this.buffer[e += 3];
|
|
3922
3921
|
else
|
|
3923
3922
|
break;
|
|
@@ -3945,7 +3944,7 @@ class Es {
|
|
|
3945
3944
|
return yield* this.pushToIndex(t, !1);
|
|
3946
3945
|
}
|
|
3947
3946
|
}
|
|
3948
|
-
class
|
|
3947
|
+
class Es {
|
|
3949
3948
|
constructor() {
|
|
3950
3949
|
this.lineStarts = [], this.addNewLine = (e) => this.lineStarts.push(e), this.linePos = (e) => {
|
|
3951
3950
|
let t = 0, n = this.lineStarts.length;
|
|
@@ -3968,7 +3967,7 @@ function P(s, e) {
|
|
|
3968
3967
|
return !0;
|
|
3969
3968
|
return !1;
|
|
3970
3969
|
}
|
|
3971
|
-
function
|
|
3970
|
+
function Mt(s) {
|
|
3972
3971
|
for (let e = 0; e < s.length; ++e)
|
|
3973
3972
|
switch (s[e].type) {
|
|
3974
3973
|
case "space":
|
|
@@ -3980,7 +3979,7 @@ function Pt(s) {
|
|
|
3980
3979
|
}
|
|
3981
3980
|
return -1;
|
|
3982
3981
|
}
|
|
3983
|
-
function
|
|
3982
|
+
function Is(s) {
|
|
3984
3983
|
switch (s?.type) {
|
|
3985
3984
|
case "alias":
|
|
3986
3985
|
case "scalar":
|
|
@@ -4024,18 +4023,18 @@ function se(s) {
|
|
|
4024
4023
|
;
|
|
4025
4024
|
return s.splice(e, s.length);
|
|
4026
4025
|
}
|
|
4027
|
-
function
|
|
4026
|
+
function Pt(s) {
|
|
4028
4027
|
if (s.start.type === "flow-seq-start")
|
|
4029
4028
|
for (const e of s.items)
|
|
4030
|
-
e.sep && !e.value && !P(e.start, "explicit-key-ind") && !P(e.sep, "map-value-ind") && (e.key && (e.value = e.key), delete e.key,
|
|
4029
|
+
e.sep && !e.value && !P(e.start, "explicit-key-ind") && !P(e.sep, "map-value-ind") && (e.key && (e.value = e.key), delete e.key, Is(e.value) ? e.value.end ? Array.prototype.push.apply(e.value.end, e.sep) : e.value.end = e.sep : Array.prototype.push.apply(e.start, e.sep), delete e.sep);
|
|
4031
4030
|
}
|
|
4032
|
-
class
|
|
4031
|
+
class At {
|
|
4033
4032
|
/**
|
|
4034
4033
|
* @param onNewLine - If defined, called separately with the start position of
|
|
4035
4034
|
* each new line (in `parse()`, including the start of input).
|
|
4036
4035
|
*/
|
|
4037
4036
|
constructor(e) {
|
|
4038
|
-
this.atNewLine = !0, this.atScalar = !1, this.indent = 0, this.offset = 0, this.onKeyLine = !1, this.stack = [], this.source = "", this.type = "", this.lexer = new
|
|
4037
|
+
this.atNewLine = !0, this.atScalar = !1, this.indent = 0, this.offset = 0, this.onKeyLine = !1, this.stack = [], this.source = "", this.type = "", this.lexer = new As(), this.onNewLine = e;
|
|
4039
4038
|
}
|
|
4040
4039
|
/**
|
|
4041
4040
|
* Parse `source` as a YAML stream.
|
|
@@ -4059,7 +4058,7 @@ class Et {
|
|
|
4059
4058
|
this.atScalar = !1, yield* this.step(), this.offset += e.length;
|
|
4060
4059
|
return;
|
|
4061
4060
|
}
|
|
4062
|
-
const t =
|
|
4061
|
+
const t = Os(e);
|
|
4063
4062
|
if (t)
|
|
4064
4063
|
if (t === "scalar")
|
|
4065
4064
|
this.atNewLine = !1, this.atScalar = !0, this.type = "scalar";
|
|
@@ -4147,7 +4146,7 @@ class Et {
|
|
|
4147
4146
|
yield t;
|
|
4148
4147
|
else {
|
|
4149
4148
|
const n = this.peek(1);
|
|
4150
|
-
switch (t.type === "block-scalar" ? t.indent = "indent" in n ? n.indent : 0 : t.type === "flow-collection" && n.type === "document" && (t.indent = 0), t.type === "flow-collection" &&
|
|
4149
|
+
switch (t.type === "block-scalar" ? t.indent = "indent" in n ? n.indent : 0 : t.type === "flow-collection" && n.type === "document" && (t.indent = 0), t.type === "flow-collection" && Pt(t), n.type) {
|
|
4151
4150
|
case "document":
|
|
4152
4151
|
n.value = t;
|
|
4153
4152
|
break;
|
|
@@ -4182,7 +4181,7 @@ class Et {
|
|
|
4182
4181
|
}
|
|
4183
4182
|
if ((n.type === "document" || n.type === "block-map" || n.type === "block-seq") && (t.type === "block-map" || t.type === "block-seq")) {
|
|
4184
4183
|
const i = t.items[t.items.length - 1];
|
|
4185
|
-
i && !i.sep && !i.value && i.start.length > 0 &&
|
|
4184
|
+
i && !i.sep && !i.value && i.start.length > 0 && Mt(i.start) === -1 && (t.indent === 0 || i.start.every((r) => r.type !== "comment" || r.indent < t.indent)) && (n.type === "document" ? n.end = i.start : n.items.push({ start: i.start }), t.items.splice(-1, 1));
|
|
4186
4185
|
}
|
|
4187
4186
|
}
|
|
4188
4187
|
else {
|
|
@@ -4224,7 +4223,7 @@ class Et {
|
|
|
4224
4223
|
return yield* this.lineEnd(e);
|
|
4225
4224
|
switch (this.type) {
|
|
4226
4225
|
case "doc-start": {
|
|
4227
|
-
|
|
4226
|
+
Mt(e.start) !== -1 ? (yield* this.pop(), yield* this.step()) : e.start.push(this.sourceToken);
|
|
4228
4227
|
return;
|
|
4229
4228
|
}
|
|
4230
4229
|
case "anchor":
|
|
@@ -4354,7 +4353,7 @@ class Et {
|
|
|
4354
4353
|
indent: this.indent,
|
|
4355
4354
|
items: [{ start: i, key: null, sep: [this.sourceToken] }]
|
|
4356
4355
|
});
|
|
4357
|
-
else if (
|
|
4356
|
+
else if (Is(t.key) && !P(t.sep, "newline")) {
|
|
4358
4357
|
const r = se(t.start), o = t.key, l = t.sep;
|
|
4359
4358
|
l.push(this.sourceToken), delete t.key, delete t.sep, this.stack.push({
|
|
4360
4359
|
type: "block-map",
|
|
@@ -4493,7 +4492,7 @@ class Et {
|
|
|
4493
4492
|
yield* this.pop(), yield* this.step();
|
|
4494
4493
|
else if (this.type === "map-value-ind" && n.type !== "flow-collection") {
|
|
4495
4494
|
const i = Le(n), r = se(i);
|
|
4496
|
-
|
|
4495
|
+
Pt(e);
|
|
4497
4496
|
const o = e.end.splice(1, e.end.length);
|
|
4498
4497
|
o.push(this.sourceToken);
|
|
4499
4498
|
const l = {
|
|
@@ -4602,19 +4601,19 @@ class Et {
|
|
|
4602
4601
|
}
|
|
4603
4602
|
}
|
|
4604
4603
|
}
|
|
4605
|
-
function
|
|
4604
|
+
function Ls(s) {
|
|
4606
4605
|
const e = s.prettyErrors !== !1;
|
|
4607
|
-
return { lineCounter: s.lineCounter || e && new
|
|
4606
|
+
return { lineCounter: s.lineCounter || e && new Es() || null, prettyErrors: e };
|
|
4608
4607
|
}
|
|
4609
|
-
function
|
|
4610
|
-
const { lineCounter: t, prettyErrors: n } =
|
|
4608
|
+
function Rn(s, e = {}) {
|
|
4609
|
+
const { lineCounter: t, prettyErrors: n } = Ls(e), i = new At(t?.addNewLine), r = new Ot(e), o = Array.from(r.compose(i.parse(s)));
|
|
4611
4610
|
if (n && t)
|
|
4612
4611
|
for (const l of o)
|
|
4613
|
-
l.errors.forEach(
|
|
4612
|
+
l.errors.forEach(je(s, t)), l.warnings.forEach(je(s, t));
|
|
4614
4613
|
return o.length > 0 ? o : Object.assign([], { empty: !0 }, r.streamInfo());
|
|
4615
4614
|
}
|
|
4616
|
-
function
|
|
4617
|
-
const { lineCounter: t, prettyErrors: n } =
|
|
4615
|
+
function Ts(s, e = {}) {
|
|
4616
|
+
const { lineCounter: t, prettyErrors: n } = Ls(e), i = new At(t?.addNewLine), r = new Ot(e);
|
|
4618
4617
|
let o = null;
|
|
4619
4618
|
for (const l of r.compose(i.parse(s), !0, s.length))
|
|
4620
4619
|
if (!o)
|
|
@@ -4623,22 +4622,22 @@ function $s(s, e = {}) {
|
|
|
4623
4622
|
o.errors.push(new Q(l.range.slice(0, 2), "MULTIPLE_DOCS", "Source contains multiple documents; please use YAML.parseAllDocuments()"));
|
|
4624
4623
|
break;
|
|
4625
4624
|
}
|
|
4626
|
-
return n && t && (o.errors.forEach(
|
|
4625
|
+
return n && t && (o.errors.forEach(je(s, t)), o.warnings.forEach(je(s, t))), o;
|
|
4627
4626
|
}
|
|
4628
|
-
function
|
|
4627
|
+
function Vn(s, e, t) {
|
|
4629
4628
|
let n;
|
|
4630
4629
|
typeof e == "function" ? n = e : t === void 0 && e && typeof e == "object" && (t = e);
|
|
4631
|
-
const i =
|
|
4630
|
+
const i = Ts(s, t);
|
|
4632
4631
|
if (!i)
|
|
4633
4632
|
return null;
|
|
4634
|
-
if (i.warnings.forEach((r) =>
|
|
4633
|
+
if (i.warnings.forEach((r) => Ht(i.options.logLevel, r)), i.errors.length > 0) {
|
|
4635
4634
|
if (i.options.logLevel !== "silent")
|
|
4636
4635
|
throw i.errors[0];
|
|
4637
4636
|
i.errors = [];
|
|
4638
4637
|
}
|
|
4639
4638
|
return i.toJS(Object.assign({ reviver: n }, t));
|
|
4640
4639
|
}
|
|
4641
|
-
function
|
|
4640
|
+
function Wn(s, e, t) {
|
|
4642
4641
|
let n = null;
|
|
4643
4642
|
if (typeof e == "function" || Array.isArray(e) ? n = e : t === void 0 && e && (t = e), typeof t == "string" && (t = t.length), typeof t == "number") {
|
|
4644
4643
|
const i = Math.round(t);
|
|
@@ -4651,23 +4650,23 @@ function Yn(s, e, t) {
|
|
|
4651
4650
|
}
|
|
4652
4651
|
return new de(s, n, t).toString(t);
|
|
4653
4652
|
}
|
|
4654
|
-
const
|
|
4653
|
+
const Jn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4655
4654
|
__proto__: null,
|
|
4656
|
-
Alias:
|
|
4657
|
-
CST:
|
|
4658
|
-
Composer:
|
|
4655
|
+
Alias: De,
|
|
4656
|
+
CST: Fn,
|
|
4657
|
+
Composer: Ot,
|
|
4659
4658
|
Document: de,
|
|
4660
|
-
Lexer:
|
|
4661
|
-
LineCounter:
|
|
4659
|
+
Lexer: As,
|
|
4660
|
+
LineCounter: Es,
|
|
4662
4661
|
Pair: $,
|
|
4663
|
-
Parser:
|
|
4662
|
+
Parser: At,
|
|
4664
4663
|
Scalar: N,
|
|
4665
|
-
Schema:
|
|
4666
|
-
YAMLError:
|
|
4664
|
+
Schema: Ge,
|
|
4665
|
+
YAMLError: kt,
|
|
4667
4666
|
YAMLMap: j,
|
|
4668
4667
|
YAMLParseError: Q,
|
|
4669
4668
|
YAMLSeq: Z,
|
|
4670
|
-
YAMLWarning:
|
|
4669
|
+
YAMLWarning: ds,
|
|
4671
4670
|
isAlias: X,
|
|
4672
4671
|
isCollection: L,
|
|
4673
4672
|
isDocument: ke,
|
|
@@ -4676,105 +4675,110 @@ const Gn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
4676
4675
|
isPair: I,
|
|
4677
4676
|
isScalar: A,
|
|
4678
4677
|
isSeq: fe,
|
|
4679
|
-
parse:
|
|
4680
|
-
parseAllDocuments:
|
|
4681
|
-
parseDocument:
|
|
4682
|
-
stringify:
|
|
4678
|
+
parse: Vn,
|
|
4679
|
+
parseAllDocuments: Rn,
|
|
4680
|
+
parseDocument: Ts,
|
|
4681
|
+
stringify: Wn,
|
|
4683
4682
|
visit: J,
|
|
4684
|
-
visitAsync:
|
|
4685
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
4683
|
+
visitAsync: Pe
|
|
4684
|
+
}, Symbol.toStringTag, { value: "Module" })), Xn = (s) => s, zn = (s) => s, Zn = (s) => s, ei = (s) => ({
|
|
4686
4685
|
widget: "boolean",
|
|
4687
4686
|
...s
|
|
4688
|
-
}),
|
|
4687
|
+
}), ti = (s) => ({
|
|
4689
4688
|
widget: "code",
|
|
4690
4689
|
...s
|
|
4691
|
-
}),
|
|
4690
|
+
}), si = (s) => ({
|
|
4692
4691
|
widget: "color",
|
|
4693
4692
|
...s
|
|
4694
|
-
}),
|
|
4693
|
+
}), ni = (s) => ({ widget: "datetime", ...s }), ii = (s) => ({
|
|
4695
4694
|
widget: "hidden",
|
|
4696
4695
|
...s
|
|
4697
|
-
}),
|
|
4696
|
+
}), ri = (s) => ({
|
|
4698
4697
|
widget: "file",
|
|
4699
4698
|
...s
|
|
4700
|
-
}),
|
|
4699
|
+
}), oi = (s) => ({
|
|
4701
4700
|
widget: "image",
|
|
4702
4701
|
...s
|
|
4703
|
-
}),
|
|
4702
|
+
}), li = (s) => ({
|
|
4704
4703
|
widget: "list",
|
|
4705
4704
|
...s
|
|
4706
|
-
}),
|
|
4705
|
+
}), ai = (s) => ({
|
|
4707
4706
|
widget: "map",
|
|
4708
4707
|
...s
|
|
4709
|
-
}),
|
|
4708
|
+
}), ci = (s) => ({
|
|
4710
4709
|
widget: "number",
|
|
4711
4710
|
...s
|
|
4712
|
-
}),
|
|
4711
|
+
}), fi = (s) => ({
|
|
4713
4712
|
widget: "object",
|
|
4714
4713
|
...s
|
|
4715
|
-
}),
|
|
4714
|
+
}), ui = (s) => ({ widget: "relation", ...s }), hi = (s) => ({
|
|
4716
4715
|
widget: "select",
|
|
4717
4716
|
...s
|
|
4718
|
-
}),
|
|
4717
|
+
}), di = (s) => ({
|
|
4719
4718
|
widget: "string",
|
|
4720
4719
|
...s
|
|
4721
|
-
}),
|
|
4720
|
+
}), pi = (s) => ({
|
|
4722
4721
|
widget: "text",
|
|
4723
4722
|
...s
|
|
4724
|
-
}),
|
|
4723
|
+
}), Yn = async (s) => {
|
|
4725
4724
|
try {
|
|
4726
|
-
await
|
|
4725
|
+
await $s(s);
|
|
4727
4726
|
} catch {
|
|
4728
|
-
await
|
|
4727
|
+
await Cs(s, { recursive: !0 });
|
|
4729
4728
|
}
|
|
4730
|
-
},
|
|
4729
|
+
}, Gn = async (s, e) => {
|
|
4731
4730
|
await vs(e, s);
|
|
4732
|
-
},
|
|
4731
|
+
}, Qn = async (s) => {
|
|
4733
4732
|
try {
|
|
4734
|
-
await
|
|
4733
|
+
await _s(s);
|
|
4735
4734
|
const { default: e } = await import(
|
|
4736
4735
|
/* @vite-ignore */
|
|
4737
4736
|
s
|
|
4738
4737
|
);
|
|
4739
4738
|
return e;
|
|
4740
4739
|
} catch {
|
|
4741
|
-
throw new Error(
|
|
4740
|
+
throw new Error(`Config file not found on ${s}`);
|
|
4742
4741
|
}
|
|
4743
|
-
},
|
|
4744
|
-
const { configFile:
|
|
4745
|
-
await
|
|
4746
|
-
const
|
|
4747
|
-
await
|
|
4742
|
+
}, Dt = async (s, e) => {
|
|
4743
|
+
const { configFile: t = "./netlify.config.ts", config: n, saveFolder: i = "./public/admin" } = e ?? {};
|
|
4744
|
+
await Yn(Xe.join(s, i));
|
|
4745
|
+
const r = n ?? await Qn(Xe.join(s, t)), o = Jn.stringify(r);
|
|
4746
|
+
await Gn(o, Xe.join(s, i, "config.yml"));
|
|
4748
4747
|
};
|
|
4749
|
-
async function
|
|
4748
|
+
async function mi(s) {
|
|
4749
|
+
let e = "";
|
|
4750
4750
|
return {
|
|
4751
4751
|
name: "vite-plugin-netlify-cms",
|
|
4752
|
+
configResolved: (t) => {
|
|
4753
|
+
e = t.root;
|
|
4754
|
+
},
|
|
4752
4755
|
buildStart: async () => {
|
|
4753
|
-
await
|
|
4756
|
+
await Dt(e, s);
|
|
4754
4757
|
},
|
|
4755
|
-
handleHotUpdate: async ({ file:
|
|
4756
|
-
|
|
4758
|
+
handleHotUpdate: async ({ file: t }) => {
|
|
4759
|
+
t.endsWith("netlify.config.ts") && await Dt(e, s);
|
|
4757
4760
|
}
|
|
4758
4761
|
};
|
|
4759
4762
|
}
|
|
4760
4763
|
export {
|
|
4761
|
-
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4764
|
+
mi as default,
|
|
4765
|
+
ei as defineBooleanWidget,
|
|
4766
|
+
ti as defineCodeWidget,
|
|
4767
|
+
si as defineColorWidget,
|
|
4768
|
+
Xn as defineConfig,
|
|
4769
|
+
ni as defineDateTimeWidget,
|
|
4770
|
+
Zn as defineFileCollection,
|
|
4771
|
+
ri as defineFileWidget,
|
|
4772
|
+
zn as defineFolderCollection,
|
|
4773
|
+
ii as defineHiddenWidget,
|
|
4774
|
+
oi as defineImageWidget,
|
|
4775
|
+
li as defineListWidget,
|
|
4776
|
+
ai as defineMapWidget,
|
|
4777
|
+
ci as defineNumberWidget,
|
|
4778
|
+
fi as defineObjectWidget,
|
|
4779
|
+
ui as defineRelationWidget,
|
|
4780
|
+
hi as defineSelectWidget,
|
|
4781
|
+
di as defineStringWidget,
|
|
4782
|
+
pi as defineTextWidget
|
|
4780
4783
|
};
|
|
4784
|
+
//# sourceMappingURL=index.es.js.map
|