@kong-ui-public/monaco-editor 0.26.5 → 0.26.6
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/runtime/languages/yaml.cjs.js +75 -77
- package/dist/runtime/languages/yaml.es.js +1061 -1057
- package/package.json +3 -3
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { e as q, c as gs, a as ys, u as bs, b as ws } from "../code-lenses-CMLSv617.js";
|
|
2
2
|
import { getModelContext as tt } from "../singletons.es.js";
|
|
3
|
-
const st = /* @__PURE__ */ Symbol.for("yaml.alias"), He = /* @__PURE__ */ Symbol.for("yaml.document"), J = /* @__PURE__ */ Symbol.for("yaml.map"), vt = /* @__PURE__ */ Symbol.for("yaml.pair"), R = /* @__PURE__ */ Symbol.for("yaml.scalar"), ae = /* @__PURE__ */ Symbol.for("yaml.seq"), K = /* @__PURE__ */ Symbol.for("yaml.node.type"), ce = (
|
|
4
|
-
function C(
|
|
5
|
-
if (
|
|
6
|
-
switch (
|
|
3
|
+
const st = /* @__PURE__ */ Symbol.for("yaml.alias"), He = /* @__PURE__ */ Symbol.for("yaml.document"), J = /* @__PURE__ */ Symbol.for("yaml.map"), vt = /* @__PURE__ */ Symbol.for("yaml.pair"), R = /* @__PURE__ */ Symbol.for("yaml.scalar"), ae = /* @__PURE__ */ Symbol.for("yaml.seq"), K = /* @__PURE__ */ Symbol.for("yaml.node.type"), ce = (s) => !!s && typeof s == "object" && s[K] === st, Me = (s) => !!s && typeof s == "object" && s[K] === He, X = (s) => !!s && typeof s == "object" && s[K] === J, E = (s) => !!s && typeof s == "object" && s[K] === vt, I = (s) => !!s && typeof s == "object" && s[K] === R, z = (s) => !!s && typeof s == "object" && s[K] === ae;
|
|
4
|
+
function C(s) {
|
|
5
|
+
if (s && typeof s == "object")
|
|
6
|
+
switch (s[K]) {
|
|
7
7
|
case J:
|
|
8
8
|
case ae:
|
|
9
9
|
return !0;
|
|
10
10
|
}
|
|
11
11
|
return !1;
|
|
12
12
|
}
|
|
13
|
-
function L(
|
|
14
|
-
if (
|
|
15
|
-
switch (
|
|
13
|
+
function L(s) {
|
|
14
|
+
if (s && typeof s == "object")
|
|
15
|
+
switch (s[K]) {
|
|
16
16
|
case st:
|
|
17
17
|
case J:
|
|
18
18
|
case R:
|
|
@@ -21,23 +21,23 @@ function L(n) {
|
|
|
21
21
|
}
|
|
22
22
|
return !1;
|
|
23
23
|
}
|
|
24
|
-
const _t = (
|
|
25
|
-
function fe(
|
|
24
|
+
const _t = (s) => (I(s) || C(s)) && !!s.anchor, G = /* @__PURE__ */ Symbol("break visit"), ks = /* @__PURE__ */ Symbol("skip children"), ge = /* @__PURE__ */ Symbol("remove node");
|
|
25
|
+
function fe(s, e) {
|
|
26
26
|
const t = Ss(e);
|
|
27
|
-
Me(
|
|
27
|
+
Me(s) ? te(null, s.contents, t, Object.freeze([s])) === ge && (s.contents = null) : te(null, s, t, Object.freeze([]));
|
|
28
28
|
}
|
|
29
29
|
fe.BREAK = G;
|
|
30
30
|
fe.SKIP = ks;
|
|
31
31
|
fe.REMOVE = ge;
|
|
32
|
-
function te(
|
|
33
|
-
const i = Ns(
|
|
32
|
+
function te(s, e, t, n) {
|
|
33
|
+
const i = Ns(s, e, t, n);
|
|
34
34
|
if (L(i) || E(i))
|
|
35
|
-
return Os(
|
|
35
|
+
return Os(s, n, i), te(s, i, t, n);
|
|
36
36
|
if (typeof i != "symbol") {
|
|
37
37
|
if (C(e)) {
|
|
38
|
-
|
|
38
|
+
n = Object.freeze(n.concat(e));
|
|
39
39
|
for (let r = 0; r < e.items.length; ++r) {
|
|
40
|
-
const o = te(r, e.items[r], t,
|
|
40
|
+
const o = te(r, e.items[r], t, n);
|
|
41
41
|
if (typeof o == "number")
|
|
42
42
|
r = o - 1;
|
|
43
43
|
else {
|
|
@@ -47,12 +47,12 @@ function te(n, e, t, s) {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
} else if (E(e)) {
|
|
50
|
-
|
|
51
|
-
const r = te("key", e.key, t,
|
|
50
|
+
n = Object.freeze(n.concat(e));
|
|
51
|
+
const r = te("key", e.key, t, n);
|
|
52
52
|
if (r === G)
|
|
53
53
|
return G;
|
|
54
54
|
r === ge && (e.key = null);
|
|
55
|
-
const o = te("value", e.value, t,
|
|
55
|
+
const o = te("value", e.value, t, n);
|
|
56
56
|
if (o === G)
|
|
57
57
|
return G;
|
|
58
58
|
o === ge && (e.value = null);
|
|
@@ -60,45 +60,45 @@ function te(n, e, t, s) {
|
|
|
60
60
|
}
|
|
61
61
|
return i;
|
|
62
62
|
}
|
|
63
|
-
function Ss(
|
|
64
|
-
return typeof
|
|
65
|
-
Alias:
|
|
66
|
-
Map:
|
|
67
|
-
Scalar:
|
|
68
|
-
Seq:
|
|
69
|
-
},
|
|
70
|
-
Map:
|
|
71
|
-
Scalar:
|
|
72
|
-
Seq:
|
|
73
|
-
},
|
|
74
|
-
Map:
|
|
75
|
-
Seq:
|
|
76
|
-
},
|
|
77
|
-
}
|
|
78
|
-
function Ns(
|
|
63
|
+
function Ss(s) {
|
|
64
|
+
return typeof s == "object" && (s.Collection || s.Node || s.Value) ? Object.assign({
|
|
65
|
+
Alias: s.Node,
|
|
66
|
+
Map: s.Node,
|
|
67
|
+
Scalar: s.Node,
|
|
68
|
+
Seq: s.Node
|
|
69
|
+
}, s.Value && {
|
|
70
|
+
Map: s.Value,
|
|
71
|
+
Scalar: s.Value,
|
|
72
|
+
Seq: s.Value
|
|
73
|
+
}, s.Collection && {
|
|
74
|
+
Map: s.Collection,
|
|
75
|
+
Seq: s.Collection
|
|
76
|
+
}, s) : s;
|
|
77
|
+
}
|
|
78
|
+
function Ns(s, e, t, n) {
|
|
79
79
|
if (typeof t == "function")
|
|
80
|
-
return t(
|
|
80
|
+
return t(s, e, n);
|
|
81
81
|
if (X(e))
|
|
82
|
-
return t.Map?.(
|
|
83
|
-
if (
|
|
84
|
-
return t.Seq?.(
|
|
82
|
+
return t.Map?.(s, e, n);
|
|
83
|
+
if (z(e))
|
|
84
|
+
return t.Seq?.(s, e, n);
|
|
85
85
|
if (E(e))
|
|
86
|
-
return t.Pair?.(
|
|
86
|
+
return t.Pair?.(s, e, n);
|
|
87
87
|
if (I(e))
|
|
88
|
-
return t.Scalar?.(
|
|
88
|
+
return t.Scalar?.(s, e, n);
|
|
89
89
|
if (ce(e))
|
|
90
|
-
return t.Alias?.(
|
|
90
|
+
return t.Alias?.(s, e, n);
|
|
91
91
|
}
|
|
92
|
-
function Os(
|
|
93
|
-
const
|
|
94
|
-
if (C(
|
|
95
|
-
|
|
96
|
-
else if (E(
|
|
97
|
-
|
|
98
|
-
else if (Me(
|
|
99
|
-
|
|
92
|
+
function Os(s, e, t) {
|
|
93
|
+
const n = e[e.length - 1];
|
|
94
|
+
if (C(n))
|
|
95
|
+
n.items[s] = t;
|
|
96
|
+
else if (E(n))
|
|
97
|
+
s === "key" ? n.key = t : n.value = t;
|
|
98
|
+
else if (Me(n))
|
|
99
|
+
n.contents = t;
|
|
100
100
|
else {
|
|
101
|
-
const i = ce(
|
|
101
|
+
const i = ce(n) ? "alias" : "scalar";
|
|
102
102
|
throw new Error(`Cannot replace node with ${i} parent`);
|
|
103
103
|
}
|
|
104
104
|
}
|
|
@@ -109,7 +109,7 @@ const As = {
|
|
|
109
109
|
"]": "%5D",
|
|
110
110
|
"{": "%7B",
|
|
111
111
|
"}": "%7D"
|
|
112
|
-
}, Ls = (
|
|
112
|
+
}, Ls = (s) => s.replace(/[!,[\]{}]/g, (e) => As[e]);
|
|
113
113
|
class _ {
|
|
114
114
|
constructor(e, t) {
|
|
115
115
|
this.docStart = null, this.docEnd = !1, this.yaml = Object.assign({}, _.defaultYaml, e), this.tags = Object.assign({}, _.defaultTags, t);
|
|
@@ -143,18 +143,18 @@ class _ {
|
|
|
143
143
|
*/
|
|
144
144
|
add(e, t) {
|
|
145
145
|
this.atNextDocument && (this.yaml = { explicit: _.defaultYaml.explicit, version: "1.1" }, this.tags = Object.assign({}, _.defaultTags), this.atNextDocument = !1);
|
|
146
|
-
const
|
|
146
|
+
const n = e.trim().split(/[ \t]+/), i = n.shift();
|
|
147
147
|
switch (i) {
|
|
148
148
|
case "%TAG": {
|
|
149
|
-
if (
|
|
149
|
+
if (n.length !== 2 && (t(0, "%TAG directive should contain exactly two parts"), n.length < 2))
|
|
150
150
|
return !1;
|
|
151
|
-
const [r, o] =
|
|
151
|
+
const [r, o] = n;
|
|
152
152
|
return this.tags[r] = o, !0;
|
|
153
153
|
}
|
|
154
154
|
case "%YAML": {
|
|
155
|
-
if (this.yaml.explicit = !0,
|
|
155
|
+
if (this.yaml.explicit = !0, n.length !== 1)
|
|
156
156
|
return t(0, "%YAML directive should contain exactly one part"), !1;
|
|
157
|
-
const [r] =
|
|
157
|
+
const [r] = n;
|
|
158
158
|
if (r === "1.1" || r === "1.2")
|
|
159
159
|
return this.yaml.version = r, !0;
|
|
160
160
|
{
|
|
@@ -181,38 +181,38 @@ class _ {
|
|
|
181
181
|
const o = e.slice(2, -1);
|
|
182
182
|
return o === "!" || o === "!!" ? (t(`Verbatim tags aren't resolved, so ${e} is invalid.`), null) : (e[e.length - 1] !== ">" && t("Verbatim tags must end with a >"), o);
|
|
183
183
|
}
|
|
184
|
-
const [,
|
|
184
|
+
const [, n, i] = e.match(/^(.*!)([^!]*)$/s);
|
|
185
185
|
i || t(`The ${e} tag has no suffix`);
|
|
186
|
-
const r = this.tags[
|
|
186
|
+
const r = this.tags[n];
|
|
187
187
|
if (r)
|
|
188
188
|
try {
|
|
189
189
|
return r + decodeURIComponent(i);
|
|
190
190
|
} catch (o) {
|
|
191
191
|
return t(String(o)), null;
|
|
192
192
|
}
|
|
193
|
-
return
|
|
193
|
+
return n === "!" ? e : (t(`Could not resolve tag: ${e}`), null);
|
|
194
194
|
}
|
|
195
195
|
/**
|
|
196
196
|
* Given a fully resolved tag, returns its printable string form,
|
|
197
197
|
* taking into account current tag prefixes and defaults.
|
|
198
198
|
*/
|
|
199
199
|
tagString(e) {
|
|
200
|
-
for (const [t,
|
|
201
|
-
if (e.startsWith(
|
|
202
|
-
return t + Ls(e.substring(
|
|
200
|
+
for (const [t, n] of Object.entries(this.tags))
|
|
201
|
+
if (e.startsWith(n))
|
|
202
|
+
return t + Ls(e.substring(n.length));
|
|
203
203
|
return e[0] === "!" ? e : `!<${e}>`;
|
|
204
204
|
}
|
|
205
205
|
toString(e) {
|
|
206
|
-
const t = this.yaml.explicit ? [`%YAML ${this.yaml.version || "1.2"}`] : [],
|
|
206
|
+
const t = this.yaml.explicit ? [`%YAML ${this.yaml.version || "1.2"}`] : [], n = Object.entries(this.tags);
|
|
207
207
|
let i;
|
|
208
|
-
if (e &&
|
|
208
|
+
if (e && n.length > 0 && L(e.contents)) {
|
|
209
209
|
const r = {};
|
|
210
210
|
fe(e.contents, (o, l) => {
|
|
211
211
|
L(l) && l.tag && (r[l.tag] = !0);
|
|
212
212
|
}), i = Object.keys(r);
|
|
213
213
|
} else
|
|
214
214
|
i = [];
|
|
215
|
-
for (const [r, o] of
|
|
215
|
+
for (const [r, o] of n)
|
|
216
216
|
r === "!!" && o === "tag:yaml.org,2002:" || (!e || i.some((l) => l.startsWith(o))) && t.push(`%TAG ${r} ${o}`);
|
|
217
217
|
return t.join(`
|
|
218
218
|
`);
|
|
@@ -220,34 +220,34 @@ class _ {
|
|
|
220
220
|
}
|
|
221
221
|
_.defaultYaml = { explicit: !1, version: "1.2" };
|
|
222
222
|
_.defaultTags = { "!!": "tag:yaml.org,2002:" };
|
|
223
|
-
function Mt(
|
|
224
|
-
if (/[\x00-\x19\s,[\]{}]/.test(
|
|
225
|
-
const t = `Anchor must not contain whitespace or control characters: ${JSON.stringify(
|
|
223
|
+
function Mt(s) {
|
|
224
|
+
if (/[\x00-\x19\s,[\]{}]/.test(s)) {
|
|
225
|
+
const t = `Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;
|
|
226
226
|
throw new Error(t);
|
|
227
227
|
}
|
|
228
228
|
return !0;
|
|
229
229
|
}
|
|
230
|
-
function Pt(
|
|
230
|
+
function Pt(s) {
|
|
231
231
|
const e = /* @__PURE__ */ new Set();
|
|
232
|
-
return fe(
|
|
233
|
-
Value(t,
|
|
234
|
-
|
|
232
|
+
return fe(s, {
|
|
233
|
+
Value(t, n) {
|
|
234
|
+
n.anchor && e.add(n.anchor);
|
|
235
235
|
}
|
|
236
236
|
}), e;
|
|
237
237
|
}
|
|
238
|
-
function Bt(
|
|
238
|
+
function Bt(s, e) {
|
|
239
239
|
for (let t = 1; ; ++t) {
|
|
240
|
-
const
|
|
241
|
-
if (!e.has(
|
|
242
|
-
return
|
|
240
|
+
const n = `${s}${t}`;
|
|
241
|
+
if (!e.has(n))
|
|
242
|
+
return n;
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
|
-
function Is(
|
|
246
|
-
const t = [],
|
|
245
|
+
function Is(s, e) {
|
|
246
|
+
const t = [], n = /* @__PURE__ */ new Map();
|
|
247
247
|
let i = null;
|
|
248
248
|
return {
|
|
249
249
|
onAnchor: (r) => {
|
|
250
|
-
t.push(r), i ?? (i = Pt(
|
|
250
|
+
t.push(r), i ?? (i = Pt(s));
|
|
251
251
|
const o = Bt(e, i);
|
|
252
252
|
return i.add(o), o;
|
|
253
253
|
},
|
|
@@ -258,7 +258,7 @@ function Is(n, e) {
|
|
|
258
258
|
*/
|
|
259
259
|
setAnchors: () => {
|
|
260
260
|
for (const r of t) {
|
|
261
|
-
const o =
|
|
261
|
+
const o = n.get(r);
|
|
262
262
|
if (typeof o == "object" && o.anchor && (I(o.node) || C(o.node)))
|
|
263
263
|
o.node.anchor = o.anchor;
|
|
264
264
|
else {
|
|
@@ -267,47 +267,47 @@ function Is(n, e) {
|
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
269
|
},
|
|
270
|
-
sourceObjects:
|
|
270
|
+
sourceObjects: n
|
|
271
271
|
};
|
|
272
272
|
}
|
|
273
|
-
function se(
|
|
274
|
-
if (
|
|
275
|
-
if (Array.isArray(
|
|
276
|
-
for (let i = 0, r =
|
|
277
|
-
const o =
|
|
278
|
-
l === void 0 ? delete
|
|
273
|
+
function se(s, e, t, n) {
|
|
274
|
+
if (n && typeof n == "object")
|
|
275
|
+
if (Array.isArray(n))
|
|
276
|
+
for (let i = 0, r = n.length; i < r; ++i) {
|
|
277
|
+
const o = n[i], l = se(s, n, String(i), o);
|
|
278
|
+
l === void 0 ? delete n[i] : l !== o && (n[i] = l);
|
|
279
279
|
}
|
|
280
|
-
else if (
|
|
281
|
-
for (const i of Array.from(
|
|
282
|
-
const r =
|
|
283
|
-
o === void 0 ?
|
|
280
|
+
else if (n instanceof Map)
|
|
281
|
+
for (const i of Array.from(n.keys())) {
|
|
282
|
+
const r = n.get(i), o = se(s, n, i, r);
|
|
283
|
+
o === void 0 ? n.delete(i) : o !== r && n.set(i, o);
|
|
284
284
|
}
|
|
285
|
-
else if (
|
|
286
|
-
for (const i of Array.from(
|
|
287
|
-
const r = se(
|
|
288
|
-
r === void 0 ?
|
|
285
|
+
else if (n instanceof Set)
|
|
286
|
+
for (const i of Array.from(n)) {
|
|
287
|
+
const r = se(s, n, i, i);
|
|
288
|
+
r === void 0 ? n.delete(i) : r !== i && (n.delete(i), n.add(r));
|
|
289
289
|
}
|
|
290
290
|
else
|
|
291
|
-
for (const [i, r] of Object.entries(
|
|
292
|
-
const o = se(
|
|
293
|
-
o === void 0 ? delete
|
|
291
|
+
for (const [i, r] of Object.entries(n)) {
|
|
292
|
+
const o = se(s, n, i, r);
|
|
293
|
+
o === void 0 ? delete n[i] : o !== r && (n[i] = o);
|
|
294
294
|
}
|
|
295
|
-
return
|
|
296
|
-
}
|
|
297
|
-
function B(
|
|
298
|
-
if (Array.isArray(
|
|
299
|
-
return
|
|
300
|
-
if (
|
|
301
|
-
if (!t || !_t(
|
|
302
|
-
return
|
|
303
|
-
const
|
|
304
|
-
t.anchors.set(
|
|
305
|
-
|
|
295
|
+
return s.call(e, t, n);
|
|
296
|
+
}
|
|
297
|
+
function B(s, e, t) {
|
|
298
|
+
if (Array.isArray(s))
|
|
299
|
+
return s.map((n, i) => B(n, String(i), t));
|
|
300
|
+
if (s && typeof s.toJSON == "function") {
|
|
301
|
+
if (!t || !_t(s))
|
|
302
|
+
return s.toJSON(e, t);
|
|
303
|
+
const n = { aliasCount: 0, count: 1, res: void 0 };
|
|
304
|
+
t.anchors.set(s, n), t.onCreate = (r) => {
|
|
305
|
+
n.res = r, delete t.onCreate;
|
|
306
306
|
};
|
|
307
|
-
const i =
|
|
307
|
+
const i = s.toJSON(e, t);
|
|
308
308
|
return t.onCreate && t.onCreate(i), i;
|
|
309
309
|
}
|
|
310
|
-
return typeof
|
|
310
|
+
return typeof s == "bigint" && !t?.keep ? Number(s) : s;
|
|
311
311
|
}
|
|
312
312
|
class nt {
|
|
313
313
|
constructor(e) {
|
|
@@ -319,7 +319,7 @@ class nt {
|
|
|
319
319
|
return this.range && (e.range = this.range.slice()), e;
|
|
320
320
|
}
|
|
321
321
|
/** A plain JavaScript representation of this node. */
|
|
322
|
-
toJS(e, { mapAsMap: t, maxAliasCount:
|
|
322
|
+
toJS(e, { mapAsMap: t, maxAliasCount: n, onAnchor: i, reviver: r } = {}) {
|
|
323
323
|
if (!Me(e))
|
|
324
324
|
throw new TypeError("A document argument is required");
|
|
325
325
|
const o = {
|
|
@@ -328,7 +328,7 @@ class nt {
|
|
|
328
328
|
keep: !0,
|
|
329
329
|
mapAsMap: t === !0,
|
|
330
330
|
mapKeyWarned: !1,
|
|
331
|
-
maxAliasCount: typeof
|
|
331
|
+
maxAliasCount: typeof n == "number" ? n : 100
|
|
332
332
|
}, l = B(this, "", o);
|
|
333
333
|
if (typeof i == "function")
|
|
334
334
|
for (const { count: a, res: c } of o.anchors.values())
|
|
@@ -351,40 +351,43 @@ class it extends nt {
|
|
|
351
351
|
resolve(e, t) {
|
|
352
352
|
if (t?.maxAliasCount === 0)
|
|
353
353
|
throw new ReferenceError("Alias resolution is disabled");
|
|
354
|
-
let
|
|
355
|
-
t?.aliasResolveCache ?
|
|
354
|
+
let n;
|
|
355
|
+
t?.aliasResolveCache ? n = t.aliasResolveCache : (n = [], fe(e, {
|
|
356
356
|
Node: (r, o) => {
|
|
357
|
-
(ce(o) || _t(o)) &&
|
|
357
|
+
(ce(o) || _t(o)) && n.push(o);
|
|
358
358
|
}
|
|
359
|
-
}), t && (t.aliasResolveCache =
|
|
359
|
+
}), t && (t.aliasResolveCache = n));
|
|
360
360
|
let i;
|
|
361
|
-
for (const r of
|
|
361
|
+
for (const r of n) {
|
|
362
362
|
if (r === this)
|
|
363
363
|
break;
|
|
364
364
|
r.anchor === this.source && (i = r);
|
|
365
365
|
}
|
|
366
|
+
if (i && t) {
|
|
367
|
+
const { anchors: r, doc: o, maxAliasCount: l } = t;
|
|
368
|
+
let a = r.get(i);
|
|
369
|
+
if (a || (B(i, null, t), a = r.get(i)), a?.res === void 0) {
|
|
370
|
+
const c = "This should not happen: Alias anchor was not resolved?";
|
|
371
|
+
throw new ReferenceError(c);
|
|
372
|
+
}
|
|
373
|
+
if (l >= 0 && (a.count += 1, a.aliasCount === 0 && (a.aliasCount = Te(o, i, r)), a.count * a.aliasCount > l)) {
|
|
374
|
+
const c = "Excessive alias count indicates a resource exhaustion attack";
|
|
375
|
+
throw new ReferenceError(c);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
366
378
|
return i;
|
|
367
379
|
}
|
|
368
380
|
toJSON(e, t) {
|
|
369
381
|
if (!t)
|
|
370
382
|
return { source: this.source };
|
|
371
|
-
const
|
|
372
|
-
if (!
|
|
373
|
-
const
|
|
374
|
-
throw new ReferenceError(
|
|
375
|
-
}
|
|
376
|
-
let l = s.get(o);
|
|
377
|
-
if (l || (B(o, null, t), l = s.get(o)), l?.res === void 0) {
|
|
378
|
-
const a = "This should not happen: Alias anchor was not resolved?";
|
|
379
|
-
throw new ReferenceError(a);
|
|
380
|
-
}
|
|
381
|
-
if (r >= 0 && (l.count += 1, l.aliasCount === 0 && (l.aliasCount = Te(i, o, s)), l.count * l.aliasCount > r)) {
|
|
382
|
-
const a = "Excessive alias count indicates a resource exhaustion attack";
|
|
383
|
-
throw new ReferenceError(a);
|
|
383
|
+
const n = this.resolve(t.doc, t);
|
|
384
|
+
if (!n) {
|
|
385
|
+
const i = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
|
|
386
|
+
throw new ReferenceError(i);
|
|
384
387
|
}
|
|
385
|
-
return
|
|
388
|
+
return t.anchors.get(n).res;
|
|
386
389
|
}
|
|
387
|
-
toString(e, t,
|
|
390
|
+
toString(e, t, n) {
|
|
388
391
|
const i = `*${this.source}`;
|
|
389
392
|
if (e) {
|
|
390
393
|
if (Mt(this.source), e.options.verifyAliasOrder && !e.anchors.has(this.source)) {
|
|
@@ -397,24 +400,24 @@ class it extends nt {
|
|
|
397
400
|
return i;
|
|
398
401
|
}
|
|
399
402
|
}
|
|
400
|
-
function Te(
|
|
403
|
+
function Te(s, e, t) {
|
|
401
404
|
if (ce(e)) {
|
|
402
|
-
const
|
|
405
|
+
const n = e.resolve(s), i = t && n && t.get(n);
|
|
403
406
|
return i ? i.count * i.aliasCount : 0;
|
|
404
407
|
} else if (C(e)) {
|
|
405
|
-
let
|
|
408
|
+
let n = 0;
|
|
406
409
|
for (const i of e.items) {
|
|
407
|
-
const r = Te(
|
|
408
|
-
r >
|
|
410
|
+
const r = Te(s, i, t);
|
|
411
|
+
r > n && (n = r);
|
|
409
412
|
}
|
|
410
|
-
return
|
|
413
|
+
return n;
|
|
411
414
|
} else if (E(e)) {
|
|
412
|
-
const
|
|
413
|
-
return Math.max(
|
|
415
|
+
const n = Te(s, e.key, t), i = Te(s, e.value, t);
|
|
416
|
+
return Math.max(n, i);
|
|
414
417
|
}
|
|
415
418
|
return 1;
|
|
416
419
|
}
|
|
417
|
-
const Kt = (
|
|
420
|
+
const Kt = (s) => !s || typeof s != "function" && typeof s != "object";
|
|
418
421
|
class O extends nt {
|
|
419
422
|
constructor(e) {
|
|
420
423
|
super(R), this.value = e;
|
|
@@ -432,64 +435,64 @@ O.PLAIN = "PLAIN";
|
|
|
432
435
|
O.QUOTE_DOUBLE = "QUOTE_DOUBLE";
|
|
433
436
|
O.QUOTE_SINGLE = "QUOTE_SINGLE";
|
|
434
437
|
const Ts = "tag:yaml.org,2002:";
|
|
435
|
-
function Es(
|
|
438
|
+
function Es(s, e, t) {
|
|
436
439
|
if (e) {
|
|
437
|
-
const
|
|
440
|
+
const n = t.filter((r) => r.tag === e), i = n.find((r) => !r.format) ?? n[0];
|
|
438
441
|
if (!i)
|
|
439
442
|
throw new Error(`Tag ${e} not found`);
|
|
440
443
|
return i;
|
|
441
444
|
}
|
|
442
|
-
return t.find((
|
|
445
|
+
return t.find((n) => n.identify?.(s) && !n.format);
|
|
443
446
|
}
|
|
444
|
-
function be(
|
|
445
|
-
if (Me(
|
|
446
|
-
return
|
|
447
|
-
if (E(
|
|
447
|
+
function be(s, e, t) {
|
|
448
|
+
if (Me(s) && (s = s.contents), L(s))
|
|
449
|
+
return s;
|
|
450
|
+
if (E(s)) {
|
|
448
451
|
const f = t.schema[J].createNode?.(t.schema, null, t);
|
|
449
|
-
return f.items.push(
|
|
452
|
+
return f.items.push(s), f;
|
|
450
453
|
}
|
|
451
|
-
(
|
|
452
|
-
const { aliasDuplicateObjects:
|
|
454
|
+
(s instanceof String || s instanceof Number || s instanceof Boolean || typeof BigInt < "u" && s instanceof BigInt) && (s = s.valueOf());
|
|
455
|
+
const { aliasDuplicateObjects: n, onAnchor: i, onTagObj: r, schema: o, sourceObjects: l } = t;
|
|
453
456
|
let a;
|
|
454
|
-
if (
|
|
455
|
-
if (a = l.get(
|
|
456
|
-
return a.anchor ?? (a.anchor = i(
|
|
457
|
-
a = { anchor: null, node: null }, l.set(
|
|
457
|
+
if (n && s && typeof s == "object") {
|
|
458
|
+
if (a = l.get(s), a)
|
|
459
|
+
return a.anchor ?? (a.anchor = i(s)), new it(a.anchor);
|
|
460
|
+
a = { anchor: null, node: null }, l.set(s, a);
|
|
458
461
|
}
|
|
459
462
|
e?.startsWith("!!") && (e = Ts + e.slice(2));
|
|
460
|
-
let c = Es(
|
|
463
|
+
let c = Es(s, e, o.tags);
|
|
461
464
|
if (!c) {
|
|
462
|
-
if (
|
|
463
|
-
const f = new O(
|
|
465
|
+
if (s && typeof s.toJSON == "function" && (s = s.toJSON()), !s || typeof s != "object") {
|
|
466
|
+
const f = new O(s);
|
|
464
467
|
return a && (a.node = f), f;
|
|
465
468
|
}
|
|
466
|
-
c =
|
|
469
|
+
c = s instanceof Map ? o[J] : Symbol.iterator in Object(s) ? o[ae] : o[J];
|
|
467
470
|
}
|
|
468
471
|
r && (r(c), delete t.onTagObj);
|
|
469
|
-
const d = c?.createNode ? c.createNode(t.schema,
|
|
472
|
+
const d = c?.createNode ? c.createNode(t.schema, s, t) : typeof c?.nodeClass?.from == "function" ? c.nodeClass.from(t.schema, s, t) : new O(s);
|
|
470
473
|
return e ? d.tag = e : c.default || (d.tag = c.tag), a && (a.node = d), d;
|
|
471
474
|
}
|
|
472
|
-
function $e(
|
|
473
|
-
let
|
|
475
|
+
function $e(s, e, t) {
|
|
476
|
+
let n = t;
|
|
474
477
|
for (let i = e.length - 1; i >= 0; --i) {
|
|
475
478
|
const r = e[i];
|
|
476
479
|
if (typeof r == "number" && Number.isInteger(r) && r >= 0) {
|
|
477
480
|
const o = [];
|
|
478
|
-
o[r] =
|
|
481
|
+
o[r] = n, n = o;
|
|
479
482
|
} else
|
|
480
|
-
|
|
483
|
+
n = /* @__PURE__ */ new Map([[r, n]]);
|
|
481
484
|
}
|
|
482
|
-
return be(
|
|
485
|
+
return be(n, void 0, {
|
|
483
486
|
aliasDuplicateObjects: !1,
|
|
484
487
|
keepUndefined: !1,
|
|
485
488
|
onAnchor: () => {
|
|
486
489
|
throw new Error("This should not happen, please report a bug.");
|
|
487
490
|
},
|
|
488
|
-
schema:
|
|
491
|
+
schema: s,
|
|
489
492
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
490
493
|
});
|
|
491
494
|
}
|
|
492
|
-
const pe = (
|
|
495
|
+
const pe = (s) => s == null || typeof s == "object" && !!s[Symbol.iterator]().next().done;
|
|
493
496
|
class Dt extends nt {
|
|
494
497
|
constructor(e, t) {
|
|
495
498
|
super(e), Object.defineProperty(this, "schema", {
|
|
@@ -506,7 +509,7 @@ class Dt extends nt {
|
|
|
506
509
|
*/
|
|
507
510
|
clone(e) {
|
|
508
511
|
const t = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
|
|
509
|
-
return e && (t.schema = e), t.items = t.items.map((
|
|
512
|
+
return e && (t.schema = e), t.items = t.items.map((n) => L(n) || E(n) ? n.clone(e) : n), this.range && (t.range = this.range.slice()), t;
|
|
510
513
|
}
|
|
511
514
|
/**
|
|
512
515
|
* Adds a value to the collection. For `!!map` and `!!omap` the value must
|
|
@@ -517,13 +520,13 @@ class Dt extends nt {
|
|
|
517
520
|
if (pe(e))
|
|
518
521
|
this.add(t);
|
|
519
522
|
else {
|
|
520
|
-
const [
|
|
523
|
+
const [n, ...i] = e, r = this.get(n, !0);
|
|
521
524
|
if (C(r))
|
|
522
525
|
r.addIn(i, t);
|
|
523
526
|
else if (r === void 0 && this.schema)
|
|
524
|
-
this.set(
|
|
527
|
+
this.set(n, $e(this.schema, i, t));
|
|
525
528
|
else
|
|
526
|
-
throw new Error(`Expected YAML collection at ${
|
|
529
|
+
throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`);
|
|
527
530
|
}
|
|
528
531
|
}
|
|
529
532
|
/**
|
|
@@ -531,13 +534,13 @@ class Dt extends nt {
|
|
|
531
534
|
* @returns `true` if the item was found and removed.
|
|
532
535
|
*/
|
|
533
536
|
deleteIn(e) {
|
|
534
|
-
const [t, ...
|
|
535
|
-
if (
|
|
537
|
+
const [t, ...n] = e;
|
|
538
|
+
if (n.length === 0)
|
|
536
539
|
return this.delete(t);
|
|
537
540
|
const i = this.get(t, !0);
|
|
538
541
|
if (C(i))
|
|
539
|
-
return i.deleteIn(
|
|
540
|
-
throw new Error(`Expected YAML collection at ${t}. Remaining path: ${
|
|
542
|
+
return i.deleteIn(n);
|
|
543
|
+
throw new Error(`Expected YAML collection at ${t}. Remaining path: ${n}`);
|
|
541
544
|
}
|
|
542
545
|
/**
|
|
543
546
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -545,69 +548,69 @@ class Dt extends nt {
|
|
|
545
548
|
* `true` (collections are always returned intact).
|
|
546
549
|
*/
|
|
547
550
|
getIn(e, t) {
|
|
548
|
-
const [
|
|
551
|
+
const [n, ...i] = e, r = this.get(n, !0);
|
|
549
552
|
return i.length === 0 ? !t && I(r) ? r.value : r : C(r) ? r.getIn(i, t) : void 0;
|
|
550
553
|
}
|
|
551
554
|
hasAllNullValues(e) {
|
|
552
555
|
return this.items.every((t) => {
|
|
553
556
|
if (!E(t))
|
|
554
557
|
return !1;
|
|
555
|
-
const
|
|
556
|
-
return
|
|
558
|
+
const n = t.value;
|
|
559
|
+
return n == null || e && I(n) && n.value == null && !n.commentBefore && !n.comment && !n.tag;
|
|
557
560
|
});
|
|
558
561
|
}
|
|
559
562
|
/**
|
|
560
563
|
* Checks if the collection includes a value with the key `key`.
|
|
561
564
|
*/
|
|
562
565
|
hasIn(e) {
|
|
563
|
-
const [t, ...
|
|
564
|
-
if (
|
|
566
|
+
const [t, ...n] = e;
|
|
567
|
+
if (n.length === 0)
|
|
565
568
|
return this.has(t);
|
|
566
569
|
const i = this.get(t, !0);
|
|
567
|
-
return C(i) ? i.hasIn(
|
|
570
|
+
return C(i) ? i.hasIn(n) : !1;
|
|
568
571
|
}
|
|
569
572
|
/**
|
|
570
573
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
571
574
|
* boolean to add/remove the item from the set.
|
|
572
575
|
*/
|
|
573
576
|
setIn(e, t) {
|
|
574
|
-
const [
|
|
577
|
+
const [n, ...i] = e;
|
|
575
578
|
if (i.length === 0)
|
|
576
|
-
this.set(
|
|
579
|
+
this.set(n, t);
|
|
577
580
|
else {
|
|
578
|
-
const r = this.get(
|
|
581
|
+
const r = this.get(n, !0);
|
|
579
582
|
if (C(r))
|
|
580
583
|
r.setIn(i, t);
|
|
581
584
|
else if (r === void 0 && this.schema)
|
|
582
|
-
this.set(
|
|
585
|
+
this.set(n, $e(this.schema, i, t));
|
|
583
586
|
else
|
|
584
|
-
throw new Error(`Expected YAML collection at ${
|
|
587
|
+
throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`);
|
|
585
588
|
}
|
|
586
589
|
}
|
|
587
590
|
}
|
|
588
|
-
const Cs = (
|
|
589
|
-
function U(
|
|
590
|
-
return /^\n+$/.test(
|
|
591
|
+
const Cs = (s) => s.replace(/^(?!$)(?: $)?/gm, "#");
|
|
592
|
+
function U(s, e) {
|
|
593
|
+
return /^\n+$/.test(s) ? s.substring(1) : e ? s.replace(/^(?! *$)/gm, e) : s;
|
|
591
594
|
}
|
|
592
|
-
const Q = (
|
|
595
|
+
const Q = (s, e, t) => s.endsWith(`
|
|
593
596
|
`) ? U(t, e) : t.includes(`
|
|
594
597
|
`) ? `
|
|
595
|
-
` + U(t, e) : (
|
|
596
|
-
function Pe(
|
|
598
|
+
` + U(t, e) : (s.endsWith(" ") ? "" : " ") + t, jt = "flow", Xe = "block", Ee = "quoted";
|
|
599
|
+
function Pe(s, e, t = "flow", { indentAtStart: n, lineWidth: i = 80, minContentWidth: r = 20, onFold: o, onOverflow: l } = {}) {
|
|
597
600
|
if (!i || i < 0)
|
|
598
|
-
return
|
|
601
|
+
return s;
|
|
599
602
|
i < r && (r = 0);
|
|
600
603
|
const a = Math.max(1 + r, 1 + i - e.length);
|
|
601
|
-
if (
|
|
602
|
-
return
|
|
604
|
+
if (s.length <= a)
|
|
605
|
+
return s;
|
|
603
606
|
const c = [], d = {};
|
|
604
607
|
let f = i - e.length;
|
|
605
|
-
typeof
|
|
608
|
+
typeof n == "number" && (n > i - Math.max(2, r) ? c.push(0) : f = i - n);
|
|
606
609
|
let u, m, g = !1, h = -1, p = -1, b = -1;
|
|
607
|
-
t === Xe && (h = wt(
|
|
608
|
-
for (let k; k =
|
|
610
|
+
t === Xe && (h = wt(s, h, e.length), h !== -1 && (f = h + a));
|
|
611
|
+
for (let k; k = s[h += 1]; ) {
|
|
609
612
|
if (t === Ee && k === "\\") {
|
|
610
|
-
switch (p = h,
|
|
613
|
+
switch (p = h, s[h + 1]) {
|
|
611
614
|
case "x":
|
|
612
615
|
h += 3;
|
|
613
616
|
break;
|
|
@@ -624,11 +627,11 @@ function Pe(n, e, t = "flow", { indentAtStart: s, lineWidth: i = 80, minContentW
|
|
|
624
627
|
}
|
|
625
628
|
if (k === `
|
|
626
629
|
`)
|
|
627
|
-
t === Xe && (h = wt(
|
|
630
|
+
t === Xe && (h = wt(s, h, e.length)), f = h + e.length + a, u = void 0;
|
|
628
631
|
else {
|
|
629
632
|
if (k === " " && m && m !== " " && m !== `
|
|
630
633
|
` && m !== " ") {
|
|
631
|
-
const S =
|
|
634
|
+
const S = s[h + 1];
|
|
632
635
|
S && S !== " " && S !== `
|
|
633
636
|
` && S !== " " && (u = h);
|
|
634
637
|
}
|
|
@@ -637,10 +640,10 @@ function Pe(n, e, t = "flow", { indentAtStart: s, lineWidth: i = 80, minContentW
|
|
|
637
640
|
c.push(u), f = u + a, u = void 0;
|
|
638
641
|
else if (t === Ee) {
|
|
639
642
|
for (; m === " " || m === " "; )
|
|
640
|
-
m = k, k =
|
|
643
|
+
m = k, k = s[h += 1], g = !0;
|
|
641
644
|
const S = h > b + 1 ? h - 2 : p - 1;
|
|
642
645
|
if (d[S])
|
|
643
|
-
return
|
|
646
|
+
return s;
|
|
644
647
|
c.push(S), d[S] = !0, f = S + a, u = void 0;
|
|
645
648
|
} else
|
|
646
649
|
g = !0;
|
|
@@ -648,57 +651,57 @@ function Pe(n, e, t = "flow", { indentAtStart: s, lineWidth: i = 80, minContentW
|
|
|
648
651
|
m = k;
|
|
649
652
|
}
|
|
650
653
|
if (g && l && l(), c.length === 0)
|
|
651
|
-
return
|
|
654
|
+
return s;
|
|
652
655
|
o && o();
|
|
653
|
-
let w =
|
|
656
|
+
let w = s.slice(0, c[0]);
|
|
654
657
|
for (let k = 0; k < c.length; ++k) {
|
|
655
|
-
const S = c[k], N = c[k + 1] ||
|
|
658
|
+
const S = c[k], N = c[k + 1] || s.length;
|
|
656
659
|
S === 0 ? w = `
|
|
657
|
-
${e}${
|
|
658
|
-
${e}${
|
|
660
|
+
${e}${s.slice(0, N)}` : (t === Ee && d[S] && (w += `${s[S]}\\`), w += `
|
|
661
|
+
${e}${s.slice(S + 1, N)}`);
|
|
659
662
|
}
|
|
660
663
|
return w;
|
|
661
664
|
}
|
|
662
|
-
function wt(
|
|
663
|
-
let
|
|
665
|
+
function wt(s, e, t) {
|
|
666
|
+
let n = e, i = e + 1, r = s[i];
|
|
664
667
|
for (; r === " " || r === " "; )
|
|
665
668
|
if (e < i + t)
|
|
666
|
-
r =
|
|
669
|
+
r = s[++e];
|
|
667
670
|
else {
|
|
668
671
|
do
|
|
669
|
-
r =
|
|
672
|
+
r = s[++e];
|
|
670
673
|
while (r && r !== `
|
|
671
674
|
`);
|
|
672
|
-
|
|
675
|
+
n = e, i = e + 1, r = s[i];
|
|
673
676
|
}
|
|
674
|
-
return
|
|
677
|
+
return n;
|
|
675
678
|
}
|
|
676
|
-
const Be = (
|
|
677
|
-
indentAtStart: e ?
|
|
678
|
-
lineWidth:
|
|
679
|
-
minContentWidth:
|
|
680
|
-
}), Ke = (
|
|
681
|
-
function $s(
|
|
679
|
+
const Be = (s, e) => ({
|
|
680
|
+
indentAtStart: e ? s.indent.length : s.indentAtStart,
|
|
681
|
+
lineWidth: s.options.lineWidth,
|
|
682
|
+
minContentWidth: s.options.minContentWidth
|
|
683
|
+
}), Ke = (s) => /^(%|---|\.\.\.)/m.test(s);
|
|
684
|
+
function $s(s, e, t) {
|
|
682
685
|
if (!e || e < 0)
|
|
683
686
|
return !1;
|
|
684
|
-
const
|
|
685
|
-
if (i <=
|
|
687
|
+
const n = e - t, i = s.length;
|
|
688
|
+
if (i <= n)
|
|
686
689
|
return !1;
|
|
687
690
|
for (let r = 0, o = 0; r < i; ++r)
|
|
688
|
-
if (
|
|
691
|
+
if (s[r] === `
|
|
689
692
|
`) {
|
|
690
|
-
if (r - o >
|
|
693
|
+
if (r - o > n)
|
|
691
694
|
return !0;
|
|
692
|
-
if (o = r + 1, i - o <=
|
|
695
|
+
if (o = r + 1, i - o <= n)
|
|
693
696
|
return !1;
|
|
694
697
|
}
|
|
695
698
|
return !0;
|
|
696
699
|
}
|
|
697
|
-
function ye(
|
|
698
|
-
const t = JSON.stringify(
|
|
700
|
+
function ye(s, e) {
|
|
701
|
+
const t = JSON.stringify(s);
|
|
699
702
|
if (e.options.doubleQuotedAsJSON)
|
|
700
703
|
return t;
|
|
701
|
-
const { implicitKey:
|
|
704
|
+
const { implicitKey: n } = e, i = e.options.doubleQuotedMinMultiLineLength, r = e.indent || (Ke(s) ? " " : "");
|
|
702
705
|
let o = "", l = 0;
|
|
703
706
|
for (let a = 0, c = t[a]; c; c = t[++a])
|
|
704
707
|
if (c === " " && t[a + 1] === "\\" && t[a + 2] === "n" && (o += t.slice(l, a) + "\\ ", a += 1, l = a, c = "\\"), c === "\\")
|
|
@@ -739,7 +742,7 @@ function ye(n, e) {
|
|
|
739
742
|
}
|
|
740
743
|
break;
|
|
741
744
|
case "n":
|
|
742
|
-
if (
|
|
745
|
+
if (n || t[a + 2] === '"' || t.length < i)
|
|
743
746
|
a += 1;
|
|
744
747
|
else {
|
|
745
748
|
for (o += t.slice(l, a) + `
|
|
@@ -753,41 +756,41 @@ function ye(n, e) {
|
|
|
753
756
|
default:
|
|
754
757
|
a += 1;
|
|
755
758
|
}
|
|
756
|
-
return o = l ? o + t.slice(l) : t,
|
|
759
|
+
return o = l ? o + t.slice(l) : t, n ? o : Pe(o, r, Ee, Be(e, !1));
|
|
757
760
|
}
|
|
758
|
-
function
|
|
759
|
-
if (e.options.singleQuote === !1 || e.implicitKey &&
|
|
760
|
-
`) || /[ \t]\n|\n[ \t]/.test(
|
|
761
|
-
return ye(
|
|
762
|
-
const t = e.indent || (Ke(
|
|
761
|
+
function ze(s, e) {
|
|
762
|
+
if (e.options.singleQuote === !1 || e.implicitKey && s.includes(`
|
|
763
|
+
`) || /[ \t]\n|\n[ \t]/.test(s))
|
|
764
|
+
return ye(s, e);
|
|
765
|
+
const t = e.indent || (Ke(s) ? " " : ""), n = "'" + s.replace(/'/g, "''").replace(/\n+/g, `$&
|
|
763
766
|
${t}`) + "'";
|
|
764
|
-
return e.implicitKey ?
|
|
767
|
+
return e.implicitKey ? n : Pe(n, t, jt, Be(e, !1));
|
|
765
768
|
}
|
|
766
|
-
function ne(
|
|
769
|
+
function ne(s, e) {
|
|
767
770
|
const { singleQuote: t } = e.options;
|
|
768
|
-
let
|
|
771
|
+
let n;
|
|
769
772
|
if (t === !1)
|
|
770
|
-
|
|
773
|
+
n = ye;
|
|
771
774
|
else {
|
|
772
|
-
const i =
|
|
773
|
-
i && !r ?
|
|
775
|
+
const i = s.includes('"'), r = s.includes("'");
|
|
776
|
+
i && !r ? n = ze : r && !i ? n = ye : n = t ? ze : ye;
|
|
774
777
|
}
|
|
775
|
-
return s
|
|
778
|
+
return n(s, e);
|
|
776
779
|
}
|
|
777
|
-
let
|
|
780
|
+
let xe;
|
|
778
781
|
try {
|
|
779
|
-
|
|
782
|
+
xe = new RegExp(`(^|(?<!
|
|
780
783
|
))
|
|
781
784
|
+(?!
|
|
782
785
|
|$)`, "g");
|
|
783
786
|
} catch {
|
|
784
|
-
|
|
787
|
+
xe = /\n+(?!\n|$)/g;
|
|
785
788
|
}
|
|
786
|
-
function Ce({ comment:
|
|
787
|
-
const { blockQuote: o, commentString: l, lineWidth: a } =
|
|
789
|
+
function Ce({ comment: s, type: e, value: t }, n, i, r) {
|
|
790
|
+
const { blockQuote: o, commentString: l, lineWidth: a } = n.options;
|
|
788
791
|
if (!o || /\n[\t ]+$/.test(t))
|
|
789
|
-
return ne(t,
|
|
790
|
-
const c =
|
|
792
|
+
return ne(t, n);
|
|
793
|
+
const c = n.indent || (n.forceBlockIndent || Ke(t) ? " " : ""), d = o === "literal" ? !0 : o === "folded" || e === O.BLOCK_FOLDED ? !1 : e === O.BLOCK_LITERAL ? !0 : !$s(t, a, c.length);
|
|
791
794
|
if (!t)
|
|
792
795
|
return d ? `|
|
|
793
796
|
` : `>
|
|
@@ -803,7 +806,7 @@ function Ce({ comment: n, type: e, value: t }, s, i, r) {
|
|
|
803
806
|
const g = m.indexOf(`
|
|
804
807
|
`);
|
|
805
808
|
g === -1 ? f = "-" : t === m || g !== m.length - 1 ? (f = "+", r && r()) : f = "", m && (t = t.slice(0, -m.length), m[m.length - 1] === `
|
|
806
|
-
` && (m = m.slice(0, -1)), m = m.replace(
|
|
809
|
+
` && (m = m.slice(0, -1)), m = m.replace(xe, `$&${c}`));
|
|
807
810
|
let h = !1, p, b = -1;
|
|
808
811
|
for (p = 0; p < t.length; ++p) {
|
|
809
812
|
const N = t[p];
|
|
@@ -818,11 +821,11 @@ function Ce({ comment: n, type: e, value: t }, s, i, r) {
|
|
|
818
821
|
let w = t.substring(0, b < p ? b + 1 : p);
|
|
819
822
|
w && (t = t.substring(w.length), w = w.replace(/\n+/g, `$&${c}`));
|
|
820
823
|
let S = (h ? c ? "2" : "1" : "") + f;
|
|
821
|
-
if (
|
|
824
|
+
if (s && (S += " " + l(s.replace(/ ?[\r\n]+/g, " ")), i && i()), !d) {
|
|
822
825
|
const N = t.replace(/\n+/g, `
|
|
823
826
|
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, "$1$2").replace(/\n+/g, `$&${c}`);
|
|
824
827
|
let A = !1;
|
|
825
|
-
const T = Be(
|
|
828
|
+
const T = Be(n, !0);
|
|
826
829
|
o !== "folded" && e !== O.BLOCK_FOLDED && (T.onOverflow = () => {
|
|
827
830
|
A = !0;
|
|
828
831
|
});
|
|
@@ -834,20 +837,20 @@ ${c}${y}`;
|
|
|
834
837
|
return t = t.replace(/\n+/g, `$&${c}`), `|${S}
|
|
835
838
|
${c}${w}${t}${m}`;
|
|
836
839
|
}
|
|
837
|
-
function vs(
|
|
838
|
-
const { type: i, value: r } =
|
|
840
|
+
function vs(s, e, t, n) {
|
|
841
|
+
const { type: i, value: r } = s, { actualString: o, implicitKey: l, indent: a, indentStep: c, inFlow: d } = e;
|
|
839
842
|
if (l && r.includes(`
|
|
840
843
|
`) || d && /[[\]{},]/.test(r))
|
|
841
844
|
return ne(r, e);
|
|
842
845
|
if (/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))
|
|
843
846
|
return l || d || !r.includes(`
|
|
844
|
-
`) ? ne(r, e) : Ce(
|
|
847
|
+
`) ? ne(r, e) : Ce(s, e, t, n);
|
|
845
848
|
if (!l && !d && i !== O.PLAIN && r.includes(`
|
|
846
849
|
`))
|
|
847
|
-
return Ce(
|
|
850
|
+
return Ce(s, e, t, n);
|
|
848
851
|
if (Ke(r)) {
|
|
849
852
|
if (a === "")
|
|
850
|
-
return e.forceBlockIndent = !0, Ce(
|
|
853
|
+
return e.forceBlockIndent = !0, Ce(s, e, t, n);
|
|
851
854
|
if (l && a === c)
|
|
852
855
|
return ne(r, e);
|
|
853
856
|
}
|
|
@@ -860,21 +863,21 @@ ${a}`);
|
|
|
860
863
|
}
|
|
861
864
|
return l ? f : Pe(f, a, jt, Be(e, !1));
|
|
862
865
|
}
|
|
863
|
-
function rt(
|
|
864
|
-
const { implicitKey: i, inFlow: r } = e, o = typeof
|
|
865
|
-
let { type: l } =
|
|
866
|
+
function rt(s, e, t, n) {
|
|
867
|
+
const { implicitKey: i, inFlow: r } = e, o = typeof s.value == "string" ? s : Object.assign({}, s, { value: String(s.value) });
|
|
868
|
+
let { type: l } = s;
|
|
866
869
|
l !== O.QUOTE_DOUBLE && /[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value) && (l = O.QUOTE_DOUBLE);
|
|
867
870
|
const a = (d) => {
|
|
868
871
|
switch (d) {
|
|
869
872
|
case O.BLOCK_FOLDED:
|
|
870
873
|
case O.BLOCK_LITERAL:
|
|
871
|
-
return i || r ? ne(o.value, e) : Ce(o, e, t,
|
|
874
|
+
return i || r ? ne(o.value, e) : Ce(o, e, t, n);
|
|
872
875
|
case O.QUOTE_DOUBLE:
|
|
873
876
|
return ye(o.value, e);
|
|
874
877
|
case O.QUOTE_SINGLE:
|
|
875
|
-
return
|
|
878
|
+
return ze(o.value, e);
|
|
876
879
|
case O.PLAIN:
|
|
877
|
-
return vs(o, e, t,
|
|
880
|
+
return vs(o, e, t, n);
|
|
878
881
|
default:
|
|
879
882
|
return null;
|
|
880
883
|
}
|
|
@@ -887,7 +890,7 @@ function rt(n, e, t, s) {
|
|
|
887
890
|
}
|
|
888
891
|
return c;
|
|
889
892
|
}
|
|
890
|
-
function qt(
|
|
893
|
+
function qt(s, e) {
|
|
891
894
|
const t = Object.assign({
|
|
892
895
|
blockQuote: !0,
|
|
893
896
|
commentString: Cs,
|
|
@@ -907,96 +910,96 @@ function qt(n, e) {
|
|
|
907
910
|
trailingComma: !1,
|
|
908
911
|
trueStr: "true",
|
|
909
912
|
verifyAliasOrder: !0
|
|
910
|
-
},
|
|
911
|
-
let
|
|
913
|
+
}, s.schema.toStringOptions, e);
|
|
914
|
+
let n;
|
|
912
915
|
switch (t.collectionStyle) {
|
|
913
916
|
case "block":
|
|
914
|
-
|
|
917
|
+
n = !1;
|
|
915
918
|
break;
|
|
916
919
|
case "flow":
|
|
917
|
-
|
|
920
|
+
n = !0;
|
|
918
921
|
break;
|
|
919
922
|
default:
|
|
920
|
-
|
|
923
|
+
n = null;
|
|
921
924
|
}
|
|
922
925
|
return {
|
|
923
926
|
anchors: /* @__PURE__ */ new Set(),
|
|
924
|
-
doc:
|
|
927
|
+
doc: s,
|
|
925
928
|
flowCollectionPadding: t.flowCollectionPadding ? " " : "",
|
|
926
929
|
indent: "",
|
|
927
930
|
indentStep: typeof t.indent == "number" ? " ".repeat(t.indent) : " ",
|
|
928
|
-
inFlow:
|
|
931
|
+
inFlow: n,
|
|
929
932
|
options: t
|
|
930
933
|
};
|
|
931
934
|
}
|
|
932
|
-
function _s(
|
|
935
|
+
function _s(s, e) {
|
|
933
936
|
if (e.tag) {
|
|
934
|
-
const i =
|
|
937
|
+
const i = s.filter((r) => r.tag === e.tag);
|
|
935
938
|
if (i.length > 0)
|
|
936
939
|
return i.find((r) => r.format === e.format) ?? i[0];
|
|
937
940
|
}
|
|
938
|
-
let t,
|
|
941
|
+
let t, n;
|
|
939
942
|
if (I(e)) {
|
|
940
|
-
|
|
941
|
-
let i =
|
|
943
|
+
n = e.value;
|
|
944
|
+
let i = s.filter((r) => r.identify?.(n));
|
|
942
945
|
if (i.length > 1) {
|
|
943
946
|
const r = i.filter((o) => o.test);
|
|
944
947
|
r.length > 0 && (i = r);
|
|
945
948
|
}
|
|
946
949
|
t = i.find((r) => r.format === e.format) ?? i.find((r) => !r.format);
|
|
947
950
|
} else
|
|
948
|
-
|
|
951
|
+
n = e, t = s.find((i) => i.nodeClass && n instanceof i.nodeClass);
|
|
949
952
|
if (!t) {
|
|
950
|
-
const i =
|
|
953
|
+
const i = n?.constructor?.name ?? (n === null ? "null" : typeof n);
|
|
951
954
|
throw new Error(`Tag not resolved for ${i} value`);
|
|
952
955
|
}
|
|
953
956
|
return t;
|
|
954
957
|
}
|
|
955
|
-
function Ms(
|
|
956
|
-
if (!
|
|
958
|
+
function Ms(s, e, { anchors: t, doc: n }) {
|
|
959
|
+
if (!n.directives)
|
|
957
960
|
return "";
|
|
958
|
-
const i = [], r = (I(
|
|
961
|
+
const i = [], r = (I(s) || C(s)) && s.anchor;
|
|
959
962
|
r && Mt(r) && (t.add(r), i.push(`&${r}`));
|
|
960
|
-
const o =
|
|
961
|
-
return o && i.push(
|
|
963
|
+
const o = s.tag ?? (e.default ? null : e.tag);
|
|
964
|
+
return o && i.push(n.directives.tagString(o)), i.join(" ");
|
|
962
965
|
}
|
|
963
|
-
function oe(
|
|
964
|
-
if (E(
|
|
965
|
-
return
|
|
966
|
-
if (ce(
|
|
966
|
+
function oe(s, e, t, n) {
|
|
967
|
+
if (E(s))
|
|
968
|
+
return s.toString(e, t, n);
|
|
969
|
+
if (ce(s)) {
|
|
967
970
|
if (e.doc.directives)
|
|
968
|
-
return
|
|
969
|
-
if (e.resolvedAliases?.has(
|
|
971
|
+
return s.toString(e);
|
|
972
|
+
if (e.resolvedAliases?.has(s))
|
|
970
973
|
throw new TypeError("Cannot stringify circular structure without alias nodes");
|
|
971
|
-
e.resolvedAliases ? e.resolvedAliases.add(
|
|
974
|
+
e.resolvedAliases ? e.resolvedAliases.add(s) : e.resolvedAliases = /* @__PURE__ */ new Set([s]), s = s.resolve(e.doc);
|
|
972
975
|
}
|
|
973
976
|
let i;
|
|
974
|
-
const r = L(
|
|
977
|
+
const r = L(s) ? s : e.doc.createNode(s, { onTagObj: (a) => i = a });
|
|
975
978
|
i ?? (i = _s(e.doc.schema.tags, r));
|
|
976
979
|
const o = Ms(r, i, e);
|
|
977
980
|
o.length > 0 && (e.indentAtStart = (e.indentAtStart ?? 0) + o.length + 1);
|
|
978
|
-
const l = typeof i.stringify == "function" ? i.stringify(r, e, t,
|
|
981
|
+
const l = typeof i.stringify == "function" ? i.stringify(r, e, t, n) : I(r) ? rt(r, e, t, n) : r.toString(e, t, n);
|
|
979
982
|
return o ? I(r) || l[0] === "{" || l[0] === "[" ? `${o} ${l}` : `${o}
|
|
980
983
|
${e.indent}${l}` : l;
|
|
981
984
|
}
|
|
982
|
-
function Ps({ key:
|
|
985
|
+
function Ps({ key: s, value: e }, t, n, i) {
|
|
983
986
|
const { allNullValues: r, doc: o, indent: l, indentStep: a, options: { commentString: c, indentSeq: d, simpleKeys: f } } = t;
|
|
984
|
-
let u = L(
|
|
987
|
+
let u = L(s) && s.comment || null;
|
|
985
988
|
if (f) {
|
|
986
989
|
if (u)
|
|
987
990
|
throw new Error("With simple keys, key nodes cannot have comments");
|
|
988
|
-
if (C(
|
|
991
|
+
if (C(s) || !L(s) && typeof s == "object") {
|
|
989
992
|
const T = "With simple keys, collection cannot be used as a key value";
|
|
990
993
|
throw new Error(T);
|
|
991
994
|
}
|
|
992
995
|
}
|
|
993
|
-
let m = !f && (!
|
|
996
|
+
let m = !f && (!s || u && e == null && !t.inFlow || C(s) || (I(s) ? s.type === O.BLOCK_FOLDED || s.type === O.BLOCK_LITERAL : typeof s == "object"));
|
|
994
997
|
t = Object.assign({}, t, {
|
|
995
998
|
allNullValues: !1,
|
|
996
999
|
implicitKey: !m && (f || !r),
|
|
997
1000
|
indent: l + a
|
|
998
1001
|
});
|
|
999
|
-
let g = !1, h = !1, p = oe(
|
|
1002
|
+
let g = !1, h = !1, p = oe(s, t, () => g = !0, () => h = !0);
|
|
1000
1003
|
if (!m && !t.inFlow && p.length > 1024) {
|
|
1001
1004
|
if (f)
|
|
1002
1005
|
throw new Error("With simple keys, single line scalar must not span more than 1024 characters");
|
|
@@ -1004,13 +1007,13 @@ function Ps({ key: n, value: e }, t, s, i) {
|
|
|
1004
1007
|
}
|
|
1005
1008
|
if (t.inFlow) {
|
|
1006
1009
|
if (r || e == null)
|
|
1007
|
-
return g &&
|
|
1010
|
+
return g && n && n(), p === "" ? "?" : m ? `? ${p}` : p;
|
|
1008
1011
|
} else if (r && !f || e == null && m)
|
|
1009
1012
|
return p = `? ${p}`, u && !g ? p += Q(p, t.indent, c(u)) : h && i && i(), p;
|
|
1010
1013
|
g && (u = null), m ? (u && (p += Q(p, t.indent, c(u))), p = `? ${p}
|
|
1011
1014
|
${l}:`) : (p = `${p}:`, u && (p += Q(p, t.indent, c(u))));
|
|
1012
1015
|
let b, w, k;
|
|
1013
|
-
L(e) ? (b = !!e.spaceBefore, w = e.commentBefore, k = e.comment) : (b = !1, w = null, k = null, e && typeof e == "object" && (e = o.createNode(e))), t.implicitKey = !1, !m && !u && I(e) && (t.indentAtStart = p.length + 1), h = !1, !d && a.length >= 2 && !t.inFlow && !m &&
|
|
1016
|
+
L(e) ? (b = !!e.spaceBefore, w = e.commentBefore, k = e.comment) : (b = !1, w = null, k = null, e && typeof e == "object" && (e = o.createNode(e))), t.implicitKey = !1, !m && !u && I(e) && (t.indentAtStart = p.length + 1), h = !1, !d && a.length >= 2 && !t.inFlow && !m && z(e) && !e.flow && !e.tag && !e.anchor && (t.indent = t.indent.substring(2));
|
|
1014
1017
|
let S = !1;
|
|
1015
1018
|
const N = oe(e, t, () => S = !0, () => h = !0);
|
|
1016
1019
|
let A = " ";
|
|
@@ -1030,23 +1033,23 @@ ${t.indent}`;
|
|
|
1030
1033
|
const T = N[0], y = N.indexOf(`
|
|
1031
1034
|
`), $ = y !== -1, V = t.inFlow ?? e.flow ?? e.items.length === 0;
|
|
1032
1035
|
if ($ || !V) {
|
|
1033
|
-
let
|
|
1036
|
+
let x = !1;
|
|
1034
1037
|
if ($ && (T === "&" || T === "!")) {
|
|
1035
1038
|
let v = N.indexOf(" ");
|
|
1036
|
-
T === "&" && v !== -1 && v < y && N[v + 1] === "!" && (v = N.indexOf(" ", v + 1)), (v === -1 || y < v) && (
|
|
1039
|
+
T === "&" && v !== -1 && v < y && N[v + 1] === "!" && (v = N.indexOf(" ", v + 1)), (v === -1 || y < v) && (x = !0);
|
|
1037
1040
|
}
|
|
1038
|
-
|
|
1041
|
+
x || (A = `
|
|
1039
1042
|
${t.indent}`);
|
|
1040
1043
|
}
|
|
1041
1044
|
} else (N === "" || N[0] === `
|
|
1042
1045
|
`) && (A = "");
|
|
1043
|
-
return p += A + N, t.inFlow ? S &&
|
|
1046
|
+
return p += A + N, t.inFlow ? S && n && n() : k && !S ? p += Q(p, t.indent, c(k)) : h && i && i(), p;
|
|
1044
1047
|
}
|
|
1045
|
-
function Bs(
|
|
1046
|
-
(
|
|
1048
|
+
function Bs(s, e) {
|
|
1049
|
+
(s === "debug" || s === "warn") && console.warn(e);
|
|
1047
1050
|
}
|
|
1048
1051
|
const Ne = "<<", F = {
|
|
1049
|
-
identify: (
|
|
1052
|
+
identify: (s) => s === Ne || typeof s == "symbol" && s.description === Ne,
|
|
1050
1053
|
default: "key",
|
|
1051
1054
|
tag: "tag:yaml.org,2002:merge",
|
|
1052
1055
|
test: /^<<$/,
|
|
@@ -1054,23 +1057,23 @@ const Ne = "<<", F = {
|
|
|
1054
1057
|
addToJSMap: Rt
|
|
1055
1058
|
}),
|
|
1056
1059
|
stringify: () => Ne
|
|
1057
|
-
}, Ks = (
|
|
1058
|
-
function Rt(
|
|
1059
|
-
const
|
|
1060
|
-
if (
|
|
1061
|
-
for (const i of
|
|
1062
|
-
Ve(
|
|
1063
|
-
else if (Array.isArray(
|
|
1064
|
-
for (const i of
|
|
1065
|
-
Ve(
|
|
1060
|
+
}, Ks = (s, e) => (F.identify(e) || I(e) && (!e.type || e.type === O.PLAIN) && F.identify(e.value)) && s?.doc.schema.tags.some((t) => t.tag === F.tag && t.default);
|
|
1061
|
+
function Rt(s, e, t) {
|
|
1062
|
+
const n = Ut(s, t);
|
|
1063
|
+
if (z(n))
|
|
1064
|
+
for (const i of n.items)
|
|
1065
|
+
Ve(s, e, i);
|
|
1066
|
+
else if (Array.isArray(n))
|
|
1067
|
+
for (const i of n)
|
|
1068
|
+
Ve(s, e, i);
|
|
1066
1069
|
else
|
|
1067
|
-
Ve(
|
|
1070
|
+
Ve(s, e, n);
|
|
1068
1071
|
}
|
|
1069
|
-
function Ve(
|
|
1070
|
-
const
|
|
1071
|
-
if (!X(
|
|
1072
|
+
function Ve(s, e, t) {
|
|
1073
|
+
const n = Ut(s, t);
|
|
1074
|
+
if (!X(n))
|
|
1072
1075
|
throw new Error("Merge sources must be maps or map aliases");
|
|
1073
|
-
const i =
|
|
1076
|
+
const i = n.toJSON(null, s, Map);
|
|
1074
1077
|
for (const [r, o] of i)
|
|
1075
1078
|
e instanceof Map ? e.has(r) || e.set(r, o) : e instanceof Set ? e.add(r) : Object.prototype.hasOwnProperty.call(e, r) || Object.defineProperty(e, r, {
|
|
1076
1079
|
value: o,
|
|
@@ -1080,22 +1083,22 @@ function Ve(n, e, t) {
|
|
|
1080
1083
|
});
|
|
1081
1084
|
return e;
|
|
1082
1085
|
}
|
|
1083
|
-
function Ut(
|
|
1084
|
-
return
|
|
1086
|
+
function Ut(s, e) {
|
|
1087
|
+
return s && ce(e) ? e.resolve(s.doc, s) : e;
|
|
1085
1088
|
}
|
|
1086
|
-
function Ft(
|
|
1089
|
+
function Ft(s, e, { key: t, value: n }) {
|
|
1087
1090
|
if (L(t) && t.addToJSMap)
|
|
1088
|
-
t.addToJSMap(
|
|
1089
|
-
else if (Ks(
|
|
1090
|
-
Rt(
|
|
1091
|
+
t.addToJSMap(s, e, n);
|
|
1092
|
+
else if (Ks(s, t))
|
|
1093
|
+
Rt(s, e, n);
|
|
1091
1094
|
else {
|
|
1092
|
-
const i = B(t, "",
|
|
1095
|
+
const i = B(t, "", s);
|
|
1093
1096
|
if (e instanceof Map)
|
|
1094
|
-
e.set(i, B(
|
|
1097
|
+
e.set(i, B(n, i, s));
|
|
1095
1098
|
else if (e instanceof Set)
|
|
1096
1099
|
e.add(i);
|
|
1097
1100
|
else {
|
|
1098
|
-
const r = Ds(t, i,
|
|
1101
|
+
const r = Ds(t, i, s), o = B(n, r, s);
|
|
1099
1102
|
r in e ? Object.defineProperty(e, r, {
|
|
1100
1103
|
value: o,
|
|
1101
1104
|
writable: !0,
|
|
@@ -1106,18 +1109,18 @@ function Ft(n, e, { key: t, value: s }) {
|
|
|
1106
1109
|
}
|
|
1107
1110
|
return e;
|
|
1108
1111
|
}
|
|
1109
|
-
function Ds(
|
|
1112
|
+
function Ds(s, e, t) {
|
|
1110
1113
|
if (e === null)
|
|
1111
1114
|
return "";
|
|
1112
1115
|
if (typeof e != "object")
|
|
1113
1116
|
return String(e);
|
|
1114
|
-
if (L(
|
|
1115
|
-
const
|
|
1116
|
-
|
|
1117
|
+
if (L(s) && t?.doc) {
|
|
1118
|
+
const n = qt(t.doc, {});
|
|
1119
|
+
n.anchors = /* @__PURE__ */ new Set();
|
|
1117
1120
|
for (const r of t.anchors.keys())
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
const i =
|
|
1121
|
+
n.anchors.add(r.anchor);
|
|
1122
|
+
n.inFlow = !0, n.inStringifyKey = !0;
|
|
1123
|
+
const i = s.toString(n);
|
|
1121
1124
|
if (!t.mapKeyWarned) {
|
|
1122
1125
|
let r = JSON.stringify(i);
|
|
1123
1126
|
r.length > 40 && (r = r.substring(0, 36) + '..."'), Bs(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;
|
|
@@ -1126,30 +1129,30 @@ function Ds(n, e, t) {
|
|
|
1126
1129
|
}
|
|
1127
1130
|
return JSON.stringify(e);
|
|
1128
1131
|
}
|
|
1129
|
-
function ot(
|
|
1130
|
-
const
|
|
1131
|
-
return new M(
|
|
1132
|
+
function ot(s, e, t) {
|
|
1133
|
+
const n = be(s, void 0, t), i = be(e, void 0, t);
|
|
1134
|
+
return new M(n, i);
|
|
1132
1135
|
}
|
|
1133
1136
|
class M {
|
|
1134
1137
|
constructor(e, t = null) {
|
|
1135
1138
|
Object.defineProperty(this, K, { value: vt }), this.key = e, this.value = t;
|
|
1136
1139
|
}
|
|
1137
1140
|
clone(e) {
|
|
1138
|
-
let { key: t, value:
|
|
1139
|
-
return L(t) && (t = t.clone(e)), L(
|
|
1141
|
+
let { key: t, value: n } = this;
|
|
1142
|
+
return L(t) && (t = t.clone(e)), L(n) && (n = n.clone(e)), new M(t, n);
|
|
1140
1143
|
}
|
|
1141
1144
|
toJSON(e, t) {
|
|
1142
|
-
const
|
|
1143
|
-
return Ft(t,
|
|
1145
|
+
const n = t?.mapAsMap ? /* @__PURE__ */ new Map() : {};
|
|
1146
|
+
return Ft(t, n, this);
|
|
1144
1147
|
}
|
|
1145
|
-
toString(e, t,
|
|
1146
|
-
return e?.doc ? Ps(this, e, t,
|
|
1148
|
+
toString(e, t, n) {
|
|
1149
|
+
return e?.doc ? Ps(this, e, t, n) : JSON.stringify(this);
|
|
1147
1150
|
}
|
|
1148
1151
|
}
|
|
1149
|
-
function Vt(
|
|
1150
|
-
return (e.inFlow ??
|
|
1152
|
+
function Vt(s, e, t) {
|
|
1153
|
+
return (e.inFlow ?? s.flow ? qs : js)(s, e, t);
|
|
1151
1154
|
}
|
|
1152
|
-
function js({ comment:
|
|
1155
|
+
function js({ comment: s, items: e }, t, { blockItemPrefix: n, flowChars: i, itemIndent: r, onChompKeep: o, onComment: l }) {
|
|
1153
1156
|
const { indent: a, options: { commentString: c } } = t, d = Object.assign({}, t, { indent: r, type: null });
|
|
1154
1157
|
let f = !1;
|
|
1155
1158
|
const u = [];
|
|
@@ -1164,7 +1167,7 @@ function js({ comment: n, items: e }, t, { blockItemPrefix: s, flowChars: i, ite
|
|
|
1164
1167
|
}
|
|
1165
1168
|
f = !1;
|
|
1166
1169
|
let b = oe(h, d, () => p = null, () => f = !0);
|
|
1167
|
-
p && (b += Q(b, r, c(p))), f && p && (f = !1), u.push(
|
|
1170
|
+
p && (b += Q(b, r, c(p))), f && p && (f = !1), u.push(n + b);
|
|
1168
1171
|
}
|
|
1169
1172
|
let m;
|
|
1170
1173
|
if (u.length === 0)
|
|
@@ -1178,21 +1181,21 @@ ${a}${h}` : `
|
|
|
1178
1181
|
`;
|
|
1179
1182
|
}
|
|
1180
1183
|
}
|
|
1181
|
-
return
|
|
1182
|
-
` + U(c(
|
|
1184
|
+
return s ? (m += `
|
|
1185
|
+
` + U(c(s), a), l && l()) : f && o && o(), m;
|
|
1183
1186
|
}
|
|
1184
|
-
function qs({ items:
|
|
1187
|
+
function qs({ items: s }, e, { flowChars: t, itemIndent: n }) {
|
|
1185
1188
|
const { indent: i, indentStep: r, flowCollectionPadding: o, options: { commentString: l } } = e;
|
|
1186
|
-
|
|
1189
|
+
n += r;
|
|
1187
1190
|
const a = Object.assign({}, e, {
|
|
1188
|
-
indent:
|
|
1191
|
+
indent: n,
|
|
1189
1192
|
inFlow: !0,
|
|
1190
1193
|
type: null
|
|
1191
1194
|
});
|
|
1192
1195
|
let c = !1, d = 0;
|
|
1193
1196
|
const f = [];
|
|
1194
|
-
for (let g = 0; g <
|
|
1195
|
-
const h =
|
|
1197
|
+
for (let g = 0; g < s.length; ++g) {
|
|
1198
|
+
const h = s[g];
|
|
1196
1199
|
let p = null;
|
|
1197
1200
|
if (L(h))
|
|
1198
1201
|
h.spaceBefore && f.push(""), ve(e, f, h.commentBefore, !1), h.comment && (p = h.comment);
|
|
@@ -1205,7 +1208,7 @@ function qs({ items: n }, e, { flowChars: t, itemIndent: s }) {
|
|
|
1205
1208
|
p && (c = !0);
|
|
1206
1209
|
let b = oe(h, a, () => p = null);
|
|
1207
1210
|
c || (c = f.length > d || b.includes(`
|
|
1208
|
-
`)), g <
|
|
1211
|
+
`)), g < s.length - 1 ? b += "," : e.options.trailingComma && (e.options.lineWidth > 0 && (c || (c = f.reduce((w, k) => w + k.length + 2, 2) + (b.length + 2) > e.options.lineWidth)), c && (b += ",")), p && (b += Q(b, n, l(p))), f.push(b), d = f.length;
|
|
1209
1212
|
}
|
|
1210
1213
|
const { start: u, end: m } = t;
|
|
1211
1214
|
if (f.length === 0)
|
|
@@ -1225,17 +1228,17 @@ ${i}${m}`;
|
|
|
1225
1228
|
} else
|
|
1226
1229
|
return `${u}${o}${f.join(" ")}${o}${m}`;
|
|
1227
1230
|
}
|
|
1228
|
-
function ve({ indent:
|
|
1229
|
-
if (
|
|
1230
|
-
const r = U(e(
|
|
1231
|
+
function ve({ indent: s, options: { commentString: e } }, t, n, i) {
|
|
1232
|
+
if (n && i && (n = n.replace(/^\n+/, "")), n) {
|
|
1233
|
+
const r = U(e(n), s);
|
|
1231
1234
|
t.push(r.trimStart());
|
|
1232
1235
|
}
|
|
1233
1236
|
}
|
|
1234
|
-
function W(
|
|
1237
|
+
function W(s, e) {
|
|
1235
1238
|
const t = I(e) ? e.value : e;
|
|
1236
|
-
for (const
|
|
1237
|
-
if (E(
|
|
1238
|
-
return
|
|
1239
|
+
for (const n of s)
|
|
1240
|
+
if (E(n) && (n.key === e || n.key === t || I(n.key) && n.key.value === t))
|
|
1241
|
+
return n;
|
|
1239
1242
|
}
|
|
1240
1243
|
class P extends Dt {
|
|
1241
1244
|
static get tagName() {
|
|
@@ -1248,13 +1251,13 @@ class P extends Dt {
|
|
|
1248
1251
|
* A generic collection parsing method that can be extended
|
|
1249
1252
|
* to other node classes that inherit from YAMLMap
|
|
1250
1253
|
*/
|
|
1251
|
-
static from(e, t,
|
|
1252
|
-
const { keepUndefined: i, replacer: r } =
|
|
1254
|
+
static from(e, t, n) {
|
|
1255
|
+
const { keepUndefined: i, replacer: r } = n, o = new this(e), l = (a, c) => {
|
|
1253
1256
|
if (typeof r == "function")
|
|
1254
1257
|
c = r.call(t, a, c);
|
|
1255
1258
|
else if (Array.isArray(r) && !r.includes(a))
|
|
1256
1259
|
return;
|
|
1257
|
-
(c !== void 0 || i) && o.items.push(ot(a, c,
|
|
1260
|
+
(c !== void 0 || i) && o.items.push(ot(a, c, n));
|
|
1258
1261
|
};
|
|
1259
1262
|
if (t instanceof Map)
|
|
1260
1263
|
for (const [a, c] of t)
|
|
@@ -1271,18 +1274,18 @@ class P extends Dt {
|
|
|
1271
1274
|
* collection will throw. Otherwise, overwrites the previous value.
|
|
1272
1275
|
*/
|
|
1273
1276
|
add(e, t) {
|
|
1274
|
-
let
|
|
1275
|
-
E(e) ?
|
|
1276
|
-
const i = W(this.items,
|
|
1277
|
+
let n;
|
|
1278
|
+
E(e) ? n = e : !e || typeof e != "object" || !("key" in e) ? n = new M(e, e?.value) : n = new M(e.key, e.value);
|
|
1279
|
+
const i = W(this.items, n.key), r = this.schema?.sortMapEntries;
|
|
1277
1280
|
if (i) {
|
|
1278
1281
|
if (!t)
|
|
1279
|
-
throw new Error(`Key ${
|
|
1280
|
-
I(i.value) && Kt(
|
|
1282
|
+
throw new Error(`Key ${n.key} already set`);
|
|
1283
|
+
I(i.value) && Kt(n.value) ? i.value.value = n.value : i.value = n.value;
|
|
1281
1284
|
} else if (r) {
|
|
1282
|
-
const o = this.items.findIndex((l) => r(
|
|
1283
|
-
o === -1 ? this.items.push(
|
|
1285
|
+
const o = this.items.findIndex((l) => r(n, l) < 0);
|
|
1286
|
+
o === -1 ? this.items.push(n) : this.items.splice(o, 0, n);
|
|
1284
1287
|
} else
|
|
1285
|
-
this.items.push(
|
|
1288
|
+
this.items.push(n);
|
|
1286
1289
|
}
|
|
1287
1290
|
delete(e) {
|
|
1288
1291
|
const t = W(this.items, e);
|
|
@@ -1303,14 +1306,14 @@ class P extends Dt {
|
|
|
1303
1306
|
* @param {Class} Type - If set, forces the returned collection type
|
|
1304
1307
|
* @returns Instance of Type, Map, or Object
|
|
1305
1308
|
*/
|
|
1306
|
-
toJSON(e, t,
|
|
1307
|
-
const i =
|
|
1309
|
+
toJSON(e, t, n) {
|
|
1310
|
+
const i = n ? new n() : t?.mapAsMap ? /* @__PURE__ */ new Map() : {};
|
|
1308
1311
|
t?.onCreate && t.onCreate(i);
|
|
1309
1312
|
for (const r of this.items)
|
|
1310
1313
|
Ft(t, i, r);
|
|
1311
1314
|
return i;
|
|
1312
1315
|
}
|
|
1313
|
-
toString(e, t,
|
|
1316
|
+
toString(e, t, n) {
|
|
1314
1317
|
if (!e)
|
|
1315
1318
|
return JSON.stringify(this);
|
|
1316
1319
|
for (const i of this.items)
|
|
@@ -1320,7 +1323,7 @@ class P extends Dt {
|
|
|
1320
1323
|
blockItemPrefix: "",
|
|
1321
1324
|
flowChars: { start: "{", end: "}" },
|
|
1322
1325
|
itemIndent: e.indent || "",
|
|
1323
|
-
onChompKeep:
|
|
1326
|
+
onChompKeep: n,
|
|
1324
1327
|
onComment: t
|
|
1325
1328
|
});
|
|
1326
1329
|
}
|
|
@@ -1330,10 +1333,10 @@ const ue = {
|
|
|
1330
1333
|
default: !0,
|
|
1331
1334
|
nodeClass: P,
|
|
1332
1335
|
tag: "tag:yaml.org,2002:map",
|
|
1333
|
-
resolve(
|
|
1334
|
-
return X(
|
|
1336
|
+
resolve(s, e) {
|
|
1337
|
+
return X(s) || e("Expected a mapping for this tag"), s;
|
|
1335
1338
|
},
|
|
1336
|
-
createNode: (
|
|
1339
|
+
createNode: (s, e, t) => P.from(s, e, t)
|
|
1337
1340
|
};
|
|
1338
1341
|
class H extends Dt {
|
|
1339
1342
|
static get tagName() {
|
|
@@ -1358,10 +1361,10 @@ class H extends Dt {
|
|
|
1358
1361
|
return typeof t != "number" ? !1 : this.items.splice(t, 1).length > 0;
|
|
1359
1362
|
}
|
|
1360
1363
|
get(e, t) {
|
|
1361
|
-
const
|
|
1362
|
-
if (typeof
|
|
1364
|
+
const n = Oe(e);
|
|
1365
|
+
if (typeof n != "number")
|
|
1363
1366
|
return;
|
|
1364
|
-
const i = this.items[
|
|
1367
|
+
const i = this.items[n];
|
|
1365
1368
|
return !t && I(i) ? i.value : i;
|
|
1366
1369
|
}
|
|
1367
1370
|
/**
|
|
@@ -1382,31 +1385,31 @@ class H extends Dt {
|
|
|
1382
1385
|
* It may be wrapped in a `Scalar`.
|
|
1383
1386
|
*/
|
|
1384
1387
|
set(e, t) {
|
|
1385
|
-
const
|
|
1386
|
-
if (typeof
|
|
1388
|
+
const n = Oe(e);
|
|
1389
|
+
if (typeof n != "number")
|
|
1387
1390
|
throw new Error(`Expected a valid index, not ${e}.`);
|
|
1388
|
-
const i = this.items[
|
|
1389
|
-
I(i) && Kt(t) ? i.value = t : this.items[
|
|
1391
|
+
const i = this.items[n];
|
|
1392
|
+
I(i) && Kt(t) ? i.value = t : this.items[n] = t;
|
|
1390
1393
|
}
|
|
1391
1394
|
toJSON(e, t) {
|
|
1392
|
-
const
|
|
1393
|
-
t?.onCreate && t.onCreate(
|
|
1395
|
+
const n = [];
|
|
1396
|
+
t?.onCreate && t.onCreate(n);
|
|
1394
1397
|
let i = 0;
|
|
1395
1398
|
for (const r of this.items)
|
|
1396
|
-
|
|
1397
|
-
return
|
|
1399
|
+
n.push(B(r, String(i++), t));
|
|
1400
|
+
return n;
|
|
1398
1401
|
}
|
|
1399
|
-
toString(e, t,
|
|
1402
|
+
toString(e, t, n) {
|
|
1400
1403
|
return e ? Vt(this, e, {
|
|
1401
1404
|
blockItemPrefix: "- ",
|
|
1402
1405
|
flowChars: { start: "[", end: "]" },
|
|
1403
1406
|
itemIndent: (e.indent || "") + " ",
|
|
1404
|
-
onChompKeep:
|
|
1407
|
+
onChompKeep: n,
|
|
1405
1408
|
onComment: t
|
|
1406
1409
|
}) : JSON.stringify(this);
|
|
1407
1410
|
}
|
|
1408
|
-
static from(e, t,
|
|
1409
|
-
const { replacer: i } =
|
|
1411
|
+
static from(e, t, n) {
|
|
1412
|
+
const { replacer: i } = n, r = new this(e);
|
|
1410
1413
|
if (t && Symbol.iterator in Object(t)) {
|
|
1411
1414
|
let o = 0;
|
|
1412
1415
|
for (let l of t) {
|
|
@@ -1414,14 +1417,14 @@ class H extends Dt {
|
|
|
1414
1417
|
const a = t instanceof Set ? l : String(o++);
|
|
1415
1418
|
l = i.call(t, a, l);
|
|
1416
1419
|
}
|
|
1417
|
-
r.items.push(be(l, void 0,
|
|
1420
|
+
r.items.push(be(l, void 0, n));
|
|
1418
1421
|
}
|
|
1419
1422
|
}
|
|
1420
1423
|
return r;
|
|
1421
1424
|
}
|
|
1422
1425
|
}
|
|
1423
|
-
function Oe(
|
|
1424
|
-
let e = I(
|
|
1426
|
+
function Oe(s) {
|
|
1427
|
+
let e = I(s) ? s.value : s;
|
|
1425
1428
|
return e && typeof e == "string" && (e = Number(e)), typeof e == "number" && Number.isInteger(e) && e >= 0 ? e : null;
|
|
1426
1429
|
}
|
|
1427
1430
|
const he = {
|
|
@@ -1429,49 +1432,49 @@ const he = {
|
|
|
1429
1432
|
default: !0,
|
|
1430
1433
|
nodeClass: H,
|
|
1431
1434
|
tag: "tag:yaml.org,2002:seq",
|
|
1432
|
-
resolve(
|
|
1433
|
-
return
|
|
1435
|
+
resolve(s, e) {
|
|
1436
|
+
return z(s) || e("Expected a sequence for this tag"), s;
|
|
1434
1437
|
},
|
|
1435
|
-
createNode: (
|
|
1438
|
+
createNode: (s, e, t) => H.from(s, e, t)
|
|
1436
1439
|
}, De = {
|
|
1437
|
-
identify: (
|
|
1440
|
+
identify: (s) => typeof s == "string",
|
|
1438
1441
|
default: !0,
|
|
1439
1442
|
tag: "tag:yaml.org,2002:str",
|
|
1440
|
-
resolve: (
|
|
1441
|
-
stringify(
|
|
1442
|
-
return e = Object.assign({ actualString: !0 }, e), rt(
|
|
1443
|
+
resolve: (s) => s,
|
|
1444
|
+
stringify(s, e, t, n) {
|
|
1445
|
+
return e = Object.assign({ actualString: !0 }, e), rt(s, e, t, n);
|
|
1443
1446
|
}
|
|
1444
1447
|
}, je = {
|
|
1445
|
-
identify: (
|
|
1448
|
+
identify: (s) => s == null,
|
|
1446
1449
|
createNode: () => new O(null),
|
|
1447
1450
|
default: !0,
|
|
1448
1451
|
tag: "tag:yaml.org,2002:null",
|
|
1449
1452
|
test: /^(?:~|[Nn]ull|NULL)?$/,
|
|
1450
1453
|
resolve: () => new O(null),
|
|
1451
|
-
stringify: ({ source:
|
|
1454
|
+
stringify: ({ source: s }, e) => typeof s == "string" && je.test.test(s) ? s : e.options.nullStr
|
|
1452
1455
|
}, lt = {
|
|
1453
|
-
identify: (
|
|
1456
|
+
identify: (s) => typeof s == "boolean",
|
|
1454
1457
|
default: !0,
|
|
1455
1458
|
tag: "tag:yaml.org,2002:bool",
|
|
1456
1459
|
test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
|
|
1457
|
-
resolve: (
|
|
1458
|
-
stringify({ source:
|
|
1459
|
-
if (
|
|
1460
|
-
const
|
|
1461
|
-
if (e ===
|
|
1462
|
-
return
|
|
1460
|
+
resolve: (s) => new O(s[0] === "t" || s[0] === "T"),
|
|
1461
|
+
stringify({ source: s, value: e }, t) {
|
|
1462
|
+
if (s && lt.test.test(s)) {
|
|
1463
|
+
const n = s[0] === "t" || s[0] === "T";
|
|
1464
|
+
if (e === n)
|
|
1465
|
+
return s;
|
|
1463
1466
|
}
|
|
1464
1467
|
return e ? t.options.trueStr : t.options.falseStr;
|
|
1465
1468
|
}
|
|
1466
1469
|
};
|
|
1467
|
-
function j({ format:
|
|
1468
|
-
if (typeof
|
|
1469
|
-
return String(
|
|
1470
|
-
const i = typeof
|
|
1470
|
+
function j({ format: s, minFractionDigits: e, tag: t, value: n }) {
|
|
1471
|
+
if (typeof n == "bigint")
|
|
1472
|
+
return String(n);
|
|
1473
|
+
const i = typeof n == "number" ? n : Number(n);
|
|
1471
1474
|
if (!isFinite(i))
|
|
1472
1475
|
return isNaN(i) ? ".nan" : i < 0 ? "-.inf" : ".inf";
|
|
1473
|
-
let r = Object.is(
|
|
1474
|
-
if (!
|
|
1476
|
+
let r = Object.is(n, -0) ? "-0" : JSON.stringify(n);
|
|
1477
|
+
if (!s && e && (!t || t === "tag:yaml.org,2002:float") && /^-?\d/.test(r) && !r.includes("e")) {
|
|
1475
1478
|
let o = r.indexOf(".");
|
|
1476
1479
|
o < 0 && (o = r.length, r += ".");
|
|
1477
1480
|
let l = e - (r.length - o - 1);
|
|
@@ -1481,61 +1484,61 @@ function j({ format: n, minFractionDigits: e, tag: t, value: s }) {
|
|
|
1481
1484
|
return r;
|
|
1482
1485
|
}
|
|
1483
1486
|
const Yt = {
|
|
1484
|
-
identify: (
|
|
1487
|
+
identify: (s) => typeof s == "number",
|
|
1485
1488
|
default: !0,
|
|
1486
1489
|
tag: "tag:yaml.org,2002:float",
|
|
1487
1490
|
test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
|
|
1488
|
-
resolve: (
|
|
1491
|
+
resolve: (s) => s.slice(-3).toLowerCase() === "nan" ? NaN : s[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
|
|
1489
1492
|
stringify: j
|
|
1490
1493
|
}, Jt = {
|
|
1491
|
-
identify: (
|
|
1494
|
+
identify: (s) => typeof s == "number",
|
|
1492
1495
|
default: !0,
|
|
1493
1496
|
tag: "tag:yaml.org,2002:float",
|
|
1494
1497
|
format: "EXP",
|
|
1495
1498
|
test: /^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,
|
|
1496
|
-
resolve: (
|
|
1497
|
-
stringify(
|
|
1498
|
-
const e = Number(
|
|
1499
|
-
return isFinite(e) ? e.toExponential() : j(
|
|
1499
|
+
resolve: (s) => parseFloat(s),
|
|
1500
|
+
stringify(s) {
|
|
1501
|
+
const e = Number(s.value);
|
|
1502
|
+
return isFinite(e) ? e.toExponential() : j(s);
|
|
1500
1503
|
}
|
|
1501
1504
|
}, Gt = {
|
|
1502
|
-
identify: (
|
|
1505
|
+
identify: (s) => typeof s == "number",
|
|
1503
1506
|
default: !0,
|
|
1504
1507
|
tag: "tag:yaml.org,2002:float",
|
|
1505
1508
|
test: /^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,
|
|
1506
|
-
resolve(
|
|
1507
|
-
const e = new O(parseFloat(
|
|
1508
|
-
return t !== -1 &&
|
|
1509
|
+
resolve(s) {
|
|
1510
|
+
const e = new O(parseFloat(s)), t = s.indexOf(".");
|
|
1511
|
+
return t !== -1 && s[s.length - 1] === "0" && (e.minFractionDigits = s.length - t - 1), e;
|
|
1509
1512
|
},
|
|
1510
1513
|
stringify: j
|
|
1511
|
-
}, qe = (
|
|
1512
|
-
function Qt(
|
|
1513
|
-
const { value:
|
|
1514
|
-
return qe(
|
|
1514
|
+
}, qe = (s) => typeof s == "bigint" || Number.isInteger(s), at = (s, e, t, { intAsBigInt: n }) => n ? BigInt(s) : parseInt(s.substring(e), t);
|
|
1515
|
+
function Qt(s, e, t) {
|
|
1516
|
+
const { value: n } = s;
|
|
1517
|
+
return qe(n) && n >= 0 ? t + n.toString(e) : j(s);
|
|
1515
1518
|
}
|
|
1516
1519
|
const Wt = {
|
|
1517
|
-
identify: (
|
|
1520
|
+
identify: (s) => qe(s) && s >= 0,
|
|
1518
1521
|
default: !0,
|
|
1519
1522
|
tag: "tag:yaml.org,2002:int",
|
|
1520
1523
|
format: "OCT",
|
|
1521
1524
|
test: /^0o[0-7]+$/,
|
|
1522
|
-
resolve: (
|
|
1523
|
-
stringify: (
|
|
1525
|
+
resolve: (s, e, t) => at(s, 2, 8, t),
|
|
1526
|
+
stringify: (s) => Qt(s, 8, "0o")
|
|
1524
1527
|
}, Ht = {
|
|
1525
1528
|
identify: qe,
|
|
1526
1529
|
default: !0,
|
|
1527
1530
|
tag: "tag:yaml.org,2002:int",
|
|
1528
1531
|
test: /^[-+]?[0-9]+$/,
|
|
1529
|
-
resolve: (
|
|
1532
|
+
resolve: (s, e, t) => at(s, 0, 10, t),
|
|
1530
1533
|
stringify: j
|
|
1531
1534
|
}, Xt = {
|
|
1532
|
-
identify: (
|
|
1535
|
+
identify: (s) => qe(s) && s >= 0,
|
|
1533
1536
|
default: !0,
|
|
1534
1537
|
tag: "tag:yaml.org,2002:int",
|
|
1535
1538
|
format: "HEX",
|
|
1536
1539
|
test: /^0x[0-9a-fA-F]+$/,
|
|
1537
|
-
resolve: (
|
|
1538
|
-
stringify: (
|
|
1540
|
+
resolve: (s, e, t) => at(s, 2, 16, t),
|
|
1541
|
+
stringify: (s) => Qt(s, 16, "0x")
|
|
1539
1542
|
}, Rs = [
|
|
1540
1543
|
ue,
|
|
1541
1544
|
he,
|
|
@@ -1549,19 +1552,19 @@ const Wt = {
|
|
|
1549
1552
|
Jt,
|
|
1550
1553
|
Gt
|
|
1551
1554
|
];
|
|
1552
|
-
function kt(
|
|
1553
|
-
return typeof
|
|
1555
|
+
function kt(s) {
|
|
1556
|
+
return typeof s == "bigint" || Number.isInteger(s);
|
|
1554
1557
|
}
|
|
1555
|
-
const Ae = ({ value:
|
|
1558
|
+
const Ae = ({ value: s }) => JSON.stringify(s), Us = [
|
|
1556
1559
|
{
|
|
1557
|
-
identify: (
|
|
1560
|
+
identify: (s) => typeof s == "string",
|
|
1558
1561
|
default: !0,
|
|
1559
1562
|
tag: "tag:yaml.org,2002:str",
|
|
1560
|
-
resolve: (
|
|
1563
|
+
resolve: (s) => s,
|
|
1561
1564
|
stringify: Ae
|
|
1562
1565
|
},
|
|
1563
1566
|
{
|
|
1564
|
-
identify: (
|
|
1567
|
+
identify: (s) => s == null,
|
|
1565
1568
|
createNode: () => new O(null),
|
|
1566
1569
|
default: !0,
|
|
1567
1570
|
tag: "tag:yaml.org,2002:null",
|
|
@@ -1570,11 +1573,11 @@ const Ae = ({ value: n }) => JSON.stringify(n), Us = [
|
|
|
1570
1573
|
stringify: Ae
|
|
1571
1574
|
},
|
|
1572
1575
|
{
|
|
1573
|
-
identify: (
|
|
1576
|
+
identify: (s) => typeof s == "boolean",
|
|
1574
1577
|
default: !0,
|
|
1575
1578
|
tag: "tag:yaml.org,2002:bool",
|
|
1576
1579
|
test: /^true$|^false$/,
|
|
1577
|
-
resolve: (
|
|
1580
|
+
resolve: (s) => s === "true",
|
|
1578
1581
|
stringify: Ae
|
|
1579
1582
|
},
|
|
1580
1583
|
{
|
|
@@ -1582,26 +1585,26 @@ const Ae = ({ value: n }) => JSON.stringify(n), Us = [
|
|
|
1582
1585
|
default: !0,
|
|
1583
1586
|
tag: "tag:yaml.org,2002:int",
|
|
1584
1587
|
test: /^-?(?:0|[1-9][0-9]*)$/,
|
|
1585
|
-
resolve: (
|
|
1586
|
-
stringify: ({ value:
|
|
1588
|
+
resolve: (s, e, { intAsBigInt: t }) => t ? BigInt(s) : parseInt(s, 10),
|
|
1589
|
+
stringify: ({ value: s }) => kt(s) ? s.toString() : JSON.stringify(s)
|
|
1587
1590
|
},
|
|
1588
1591
|
{
|
|
1589
|
-
identify: (
|
|
1592
|
+
identify: (s) => typeof s == "number",
|
|
1590
1593
|
default: !0,
|
|
1591
1594
|
tag: "tag:yaml.org,2002:float",
|
|
1592
1595
|
test: /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,
|
|
1593
|
-
resolve: (
|
|
1596
|
+
resolve: (s) => parseFloat(s),
|
|
1594
1597
|
stringify: Ae
|
|
1595
1598
|
}
|
|
1596
1599
|
], Fs = {
|
|
1597
1600
|
default: !0,
|
|
1598
1601
|
tag: "",
|
|
1599
1602
|
test: /^/,
|
|
1600
|
-
resolve(
|
|
1601
|
-
return e(`Unresolved plain scalar ${JSON.stringify(
|
|
1603
|
+
resolve(s, e) {
|
|
1604
|
+
return e(`Unresolved plain scalar ${JSON.stringify(s)}`), s;
|
|
1602
1605
|
}
|
|
1603
1606
|
}, Vs = [ue, he].concat(Us, Fs), ct = {
|
|
1604
|
-
identify: (
|
|
1607
|
+
identify: (s) => s instanceof Uint8Array,
|
|
1605
1608
|
// Buffer inherits from Uint8Array
|
|
1606
1609
|
default: !1,
|
|
1607
1610
|
tag: "tag:yaml.org,2002:binary",
|
|
@@ -1613,16 +1616,16 @@ const Ae = ({ value: n }) => JSON.stringify(n), Us = [
|
|
|
1613
1616
|
* const blob = new Blob([buffer], { type: 'image/jpeg' })
|
|
1614
1617
|
* document.querySelector('#photo').src = URL.createObjectURL(blob)
|
|
1615
1618
|
*/
|
|
1616
|
-
resolve(
|
|
1619
|
+
resolve(s, e) {
|
|
1617
1620
|
if (typeof atob == "function") {
|
|
1618
|
-
const t = atob(
|
|
1621
|
+
const t = atob(s.replace(/[\n\r]/g, "")), n = new Uint8Array(t.length);
|
|
1619
1622
|
for (let i = 0; i < t.length; ++i)
|
|
1620
|
-
|
|
1621
|
-
return
|
|
1623
|
+
n[i] = t.charCodeAt(i);
|
|
1624
|
+
return n;
|
|
1622
1625
|
} else
|
|
1623
|
-
return e("This environment does not support reading binary tags; either Buffer or atob is required"),
|
|
1626
|
+
return e("This environment does not support reading binary tags; either Buffer or atob is required"), s;
|
|
1624
1627
|
},
|
|
1625
|
-
stringify({ comment:
|
|
1628
|
+
stringify({ comment: s, type: e, value: t }, n, i, r) {
|
|
1626
1629
|
if (!t)
|
|
1627
1630
|
return "";
|
|
1628
1631
|
const o = t;
|
|
@@ -1635,45 +1638,45 @@ const Ae = ({ value: n }) => JSON.stringify(n), Us = [
|
|
|
1635
1638
|
} else
|
|
1636
1639
|
throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");
|
|
1637
1640
|
if (e ?? (e = O.BLOCK_LITERAL), e !== O.QUOTE_DOUBLE) {
|
|
1638
|
-
const a = Math.max(
|
|
1641
|
+
const a = Math.max(n.options.lineWidth - n.indent.length, n.options.minContentWidth), c = Math.ceil(l.length / a), d = new Array(c);
|
|
1639
1642
|
for (let f = 0, u = 0; f < c; ++f, u += a)
|
|
1640
1643
|
d[f] = l.substr(u, a);
|
|
1641
1644
|
l = d.join(e === O.BLOCK_LITERAL ? `
|
|
1642
1645
|
` : " ");
|
|
1643
1646
|
}
|
|
1644
|
-
return rt({ comment:
|
|
1647
|
+
return rt({ comment: s, type: e, value: l }, n, i, r);
|
|
1645
1648
|
}
|
|
1646
1649
|
};
|
|
1647
|
-
function
|
|
1648
|
-
if (
|
|
1649
|
-
for (let t = 0; t <
|
|
1650
|
-
let
|
|
1651
|
-
if (!E(
|
|
1652
|
-
if (X(
|
|
1653
|
-
|
|
1654
|
-
const i =
|
|
1655
|
-
if (
|
|
1656
|
-
${i.key.commentBefore}` :
|
|
1650
|
+
function zt(s, e) {
|
|
1651
|
+
if (z(s))
|
|
1652
|
+
for (let t = 0; t < s.items.length; ++t) {
|
|
1653
|
+
let n = s.items[t];
|
|
1654
|
+
if (!E(n)) {
|
|
1655
|
+
if (X(n)) {
|
|
1656
|
+
n.items.length > 1 && e("Each pair must have its own sequence indicator");
|
|
1657
|
+
const i = n.items[0] || new M(new O(null));
|
|
1658
|
+
if (n.commentBefore && (i.key.commentBefore = i.key.commentBefore ? `${n.commentBefore}
|
|
1659
|
+
${i.key.commentBefore}` : n.commentBefore), n.comment) {
|
|
1657
1660
|
const r = i.value ?? i.key;
|
|
1658
|
-
r.comment = r.comment ? `${
|
|
1659
|
-
${r.comment}` :
|
|
1661
|
+
r.comment = r.comment ? `${n.comment}
|
|
1662
|
+
${r.comment}` : n.comment;
|
|
1660
1663
|
}
|
|
1661
|
-
|
|
1664
|
+
n = i;
|
|
1662
1665
|
}
|
|
1663
|
-
|
|
1666
|
+
s.items[t] = E(n) ? n : new M(n);
|
|
1664
1667
|
}
|
|
1665
1668
|
}
|
|
1666
1669
|
else
|
|
1667
1670
|
e("Expected a sequence for this tag");
|
|
1668
|
-
return
|
|
1671
|
+
return s;
|
|
1669
1672
|
}
|
|
1670
|
-
function
|
|
1671
|
-
const { replacer:
|
|
1673
|
+
function xt(s, e, t) {
|
|
1674
|
+
const { replacer: n } = t, i = new H(s);
|
|
1672
1675
|
i.tag = "tag:yaml.org,2002:pairs";
|
|
1673
1676
|
let r = 0;
|
|
1674
1677
|
if (e && Symbol.iterator in Object(e))
|
|
1675
1678
|
for (let o of e) {
|
|
1676
|
-
typeof
|
|
1679
|
+
typeof n == "function" && (o = n.call(e, String(r++), o));
|
|
1677
1680
|
let l, a;
|
|
1678
1681
|
if (Array.isArray(o))
|
|
1679
1682
|
if (o.length === 2)
|
|
@@ -1696,8 +1699,8 @@ const ft = {
|
|
|
1696
1699
|
collection: "seq",
|
|
1697
1700
|
default: !1,
|
|
1698
1701
|
tag: "tag:yaml.org,2002:pairs",
|
|
1699
|
-
resolve:
|
|
1700
|
-
createNode:
|
|
1702
|
+
resolve: zt,
|
|
1703
|
+
createNode: xt
|
|
1701
1704
|
};
|
|
1702
1705
|
class ie extends H {
|
|
1703
1706
|
constructor() {
|
|
@@ -1710,113 +1713,113 @@ class ie extends H {
|
|
|
1710
1713
|
toJSON(e, t) {
|
|
1711
1714
|
if (!t)
|
|
1712
1715
|
return super.toJSON(e);
|
|
1713
|
-
const
|
|
1714
|
-
t?.onCreate && t.onCreate(
|
|
1716
|
+
const n = /* @__PURE__ */ new Map();
|
|
1717
|
+
t?.onCreate && t.onCreate(n);
|
|
1715
1718
|
for (const i of this.items) {
|
|
1716
1719
|
let r, o;
|
|
1717
|
-
if (E(i) ? (r = B(i.key, "", t), o = B(i.value, r, t)) : r = B(i, "", t),
|
|
1720
|
+
if (E(i) ? (r = B(i.key, "", t), o = B(i.value, r, t)) : r = B(i, "", t), n.has(r))
|
|
1718
1721
|
throw new Error("Ordered maps must not include duplicate keys");
|
|
1719
|
-
|
|
1722
|
+
n.set(r, o);
|
|
1720
1723
|
}
|
|
1721
|
-
return
|
|
1724
|
+
return n;
|
|
1722
1725
|
}
|
|
1723
|
-
static from(e, t,
|
|
1724
|
-
const i =
|
|
1726
|
+
static from(e, t, n) {
|
|
1727
|
+
const i = xt(e, t, n), r = new this();
|
|
1725
1728
|
return r.items = i.items, r;
|
|
1726
1729
|
}
|
|
1727
1730
|
}
|
|
1728
1731
|
ie.tag = "tag:yaml.org,2002:omap";
|
|
1729
1732
|
const ut = {
|
|
1730
1733
|
collection: "seq",
|
|
1731
|
-
identify: (
|
|
1734
|
+
identify: (s) => s instanceof Map,
|
|
1732
1735
|
nodeClass: ie,
|
|
1733
1736
|
default: !1,
|
|
1734
1737
|
tag: "tag:yaml.org,2002:omap",
|
|
1735
|
-
resolve(
|
|
1736
|
-
const t =
|
|
1738
|
+
resolve(s, e) {
|
|
1739
|
+
const t = zt(s, e), n = [];
|
|
1737
1740
|
for (const { key: i } of t.items)
|
|
1738
|
-
I(i) && (
|
|
1741
|
+
I(i) && (n.includes(i.value) ? e(`Ordered maps must not include duplicate keys: ${i.value}`) : n.push(i.value));
|
|
1739
1742
|
return Object.assign(new ie(), t);
|
|
1740
1743
|
},
|
|
1741
|
-
createNode: (
|
|
1744
|
+
createNode: (s, e, t) => ie.from(s, e, t)
|
|
1742
1745
|
};
|
|
1743
|
-
function Zt({ value:
|
|
1744
|
-
return e && (
|
|
1746
|
+
function Zt({ value: s, source: e }, t) {
|
|
1747
|
+
return e && (s ? es : ts).test.test(e) ? e : s ? t.options.trueStr : t.options.falseStr;
|
|
1745
1748
|
}
|
|
1746
1749
|
const es = {
|
|
1747
|
-
identify: (
|
|
1750
|
+
identify: (s) => s === !0,
|
|
1748
1751
|
default: !0,
|
|
1749
1752
|
tag: "tag:yaml.org,2002:bool",
|
|
1750
1753
|
test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,
|
|
1751
1754
|
resolve: () => new O(!0),
|
|
1752
1755
|
stringify: Zt
|
|
1753
1756
|
}, ts = {
|
|
1754
|
-
identify: (
|
|
1757
|
+
identify: (s) => s === !1,
|
|
1755
1758
|
default: !0,
|
|
1756
1759
|
tag: "tag:yaml.org,2002:bool",
|
|
1757
1760
|
test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,
|
|
1758
1761
|
resolve: () => new O(!1),
|
|
1759
1762
|
stringify: Zt
|
|
1760
1763
|
}, Ys = {
|
|
1761
|
-
identify: (
|
|
1764
|
+
identify: (s) => typeof s == "number",
|
|
1762
1765
|
default: !0,
|
|
1763
1766
|
tag: "tag:yaml.org,2002:float",
|
|
1764
1767
|
test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
|
|
1765
|
-
resolve: (
|
|
1768
|
+
resolve: (s) => s.slice(-3).toLowerCase() === "nan" ? NaN : s[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
|
|
1766
1769
|
stringify: j
|
|
1767
1770
|
}, Js = {
|
|
1768
|
-
identify: (
|
|
1771
|
+
identify: (s) => typeof s == "number",
|
|
1769
1772
|
default: !0,
|
|
1770
1773
|
tag: "tag:yaml.org,2002:float",
|
|
1771
1774
|
format: "EXP",
|
|
1772
1775
|
test: /^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,
|
|
1773
|
-
resolve: (
|
|
1774
|
-
stringify(
|
|
1775
|
-
const e = Number(
|
|
1776
|
-
return isFinite(e) ? e.toExponential() : j(
|
|
1776
|
+
resolve: (s) => parseFloat(s.replace(/_/g, "")),
|
|
1777
|
+
stringify(s) {
|
|
1778
|
+
const e = Number(s.value);
|
|
1779
|
+
return isFinite(e) ? e.toExponential() : j(s);
|
|
1777
1780
|
}
|
|
1778
1781
|
}, Gs = {
|
|
1779
|
-
identify: (
|
|
1782
|
+
identify: (s) => typeof s == "number",
|
|
1780
1783
|
default: !0,
|
|
1781
1784
|
tag: "tag:yaml.org,2002:float",
|
|
1782
1785
|
test: /^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,
|
|
1783
|
-
resolve(
|
|
1784
|
-
const e = new O(parseFloat(
|
|
1786
|
+
resolve(s) {
|
|
1787
|
+
const e = new O(parseFloat(s.replace(/_/g, ""))), t = s.indexOf(".");
|
|
1785
1788
|
if (t !== -1) {
|
|
1786
|
-
const
|
|
1787
|
-
|
|
1789
|
+
const n = s.substring(t + 1).replace(/_/g, "");
|
|
1790
|
+
n[n.length - 1] === "0" && (e.minFractionDigits = n.length);
|
|
1788
1791
|
}
|
|
1789
1792
|
return e;
|
|
1790
1793
|
},
|
|
1791
1794
|
stringify: j
|
|
1792
|
-
}, ke = (
|
|
1793
|
-
function Re(
|
|
1794
|
-
const i =
|
|
1795
|
-
if ((i === "-" || i === "+") && (e += 1),
|
|
1795
|
+
}, ke = (s) => typeof s == "bigint" || Number.isInteger(s);
|
|
1796
|
+
function Re(s, e, t, { intAsBigInt: n }) {
|
|
1797
|
+
const i = s[0];
|
|
1798
|
+
if ((i === "-" || i === "+") && (e += 1), s = s.substring(e).replace(/_/g, ""), n) {
|
|
1796
1799
|
switch (t) {
|
|
1797
1800
|
case 2:
|
|
1798
|
-
|
|
1801
|
+
s = `0b${s}`;
|
|
1799
1802
|
break;
|
|
1800
1803
|
case 8:
|
|
1801
|
-
|
|
1804
|
+
s = `0o${s}`;
|
|
1802
1805
|
break;
|
|
1803
1806
|
case 16:
|
|
1804
|
-
|
|
1807
|
+
s = `0x${s}`;
|
|
1805
1808
|
break;
|
|
1806
1809
|
}
|
|
1807
|
-
const o = BigInt(
|
|
1810
|
+
const o = BigInt(s);
|
|
1808
1811
|
return i === "-" ? BigInt(-1) * o : o;
|
|
1809
1812
|
}
|
|
1810
|
-
const r = parseInt(
|
|
1813
|
+
const r = parseInt(s, t);
|
|
1811
1814
|
return i === "-" ? -1 * r : r;
|
|
1812
1815
|
}
|
|
1813
|
-
function ht(
|
|
1814
|
-
const { value:
|
|
1815
|
-
if (ke(
|
|
1816
|
-
const i =
|
|
1817
|
-
return
|
|
1816
|
+
function ht(s, e, t) {
|
|
1817
|
+
const { value: n } = s;
|
|
1818
|
+
if (ke(n)) {
|
|
1819
|
+
const i = n.toString(e);
|
|
1820
|
+
return n < 0 ? "-" + t + i.substr(1) : t + i;
|
|
1818
1821
|
}
|
|
1819
|
-
return j(
|
|
1822
|
+
return j(s);
|
|
1820
1823
|
}
|
|
1821
1824
|
const Qs = {
|
|
1822
1825
|
identify: ke,
|
|
@@ -1824,22 +1827,22 @@ const Qs = {
|
|
|
1824
1827
|
tag: "tag:yaml.org,2002:int",
|
|
1825
1828
|
format: "BIN",
|
|
1826
1829
|
test: /^[-+]?0b[0-1_]+$/,
|
|
1827
|
-
resolve: (
|
|
1828
|
-
stringify: (
|
|
1830
|
+
resolve: (s, e, t) => Re(s, 2, 2, t),
|
|
1831
|
+
stringify: (s) => ht(s, 2, "0b")
|
|
1829
1832
|
}, Ws = {
|
|
1830
1833
|
identify: ke,
|
|
1831
1834
|
default: !0,
|
|
1832
1835
|
tag: "tag:yaml.org,2002:int",
|
|
1833
1836
|
format: "OCT",
|
|
1834
1837
|
test: /^[-+]?0[0-7_]+$/,
|
|
1835
|
-
resolve: (
|
|
1836
|
-
stringify: (
|
|
1838
|
+
resolve: (s, e, t) => Re(s, 1, 8, t),
|
|
1839
|
+
stringify: (s) => ht(s, 8, "0")
|
|
1837
1840
|
}, Hs = {
|
|
1838
1841
|
identify: ke,
|
|
1839
1842
|
default: !0,
|
|
1840
1843
|
tag: "tag:yaml.org,2002:int",
|
|
1841
1844
|
test: /^[-+]?[0-9][0-9_]*$/,
|
|
1842
|
-
resolve: (
|
|
1845
|
+
resolve: (s, e, t) => Re(s, 0, 10, t),
|
|
1843
1846
|
stringify: j
|
|
1844
1847
|
}, Xs = {
|
|
1845
1848
|
identify: ke,
|
|
@@ -1847,8 +1850,8 @@ const Qs = {
|
|
|
1847
1850
|
tag: "tag:yaml.org,2002:int",
|
|
1848
1851
|
format: "HEX",
|
|
1849
1852
|
test: /^[-+]?0x[0-9a-fA-F_]+$/,
|
|
1850
|
-
resolve: (
|
|
1851
|
-
stringify: (
|
|
1853
|
+
resolve: (s, e, t) => Re(s, 2, 16, t),
|
|
1854
|
+
stringify: (s) => ht(s, 16, "0x")
|
|
1852
1855
|
};
|
|
1853
1856
|
class re extends P {
|
|
1854
1857
|
constructor(e) {
|
|
@@ -1863,96 +1866,96 @@ class re extends P {
|
|
|
1863
1866
|
* Otherwise, returns the value of that Pair's key.
|
|
1864
1867
|
*/
|
|
1865
1868
|
get(e, t) {
|
|
1866
|
-
const
|
|
1867
|
-
return !t && E(
|
|
1869
|
+
const n = W(this.items, e);
|
|
1870
|
+
return !t && E(n) ? I(n.key) ? n.key.value : n.key : n;
|
|
1868
1871
|
}
|
|
1869
1872
|
set(e, t) {
|
|
1870
1873
|
if (typeof t != "boolean")
|
|
1871
1874
|
throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);
|
|
1872
|
-
const
|
|
1873
|
-
|
|
1875
|
+
const n = W(this.items, e);
|
|
1876
|
+
n && !t ? this.items.splice(this.items.indexOf(n), 1) : !n && t && this.items.push(new M(e));
|
|
1874
1877
|
}
|
|
1875
1878
|
toJSON(e, t) {
|
|
1876
1879
|
return super.toJSON(e, t, Set);
|
|
1877
1880
|
}
|
|
1878
|
-
toString(e, t,
|
|
1881
|
+
toString(e, t, n) {
|
|
1879
1882
|
if (!e)
|
|
1880
1883
|
return JSON.stringify(this);
|
|
1881
1884
|
if (this.hasAllNullValues(!0))
|
|
1882
|
-
return super.toString(Object.assign({}, e, { allNullValues: !0 }), t,
|
|
1885
|
+
return super.toString(Object.assign({}, e, { allNullValues: !0 }), t, n);
|
|
1883
1886
|
throw new Error("Set items must all have null values");
|
|
1884
1887
|
}
|
|
1885
|
-
static from(e, t,
|
|
1886
|
-
const { replacer: i } =
|
|
1888
|
+
static from(e, t, n) {
|
|
1889
|
+
const { replacer: i } = n, r = new this(e);
|
|
1887
1890
|
if (t && Symbol.iterator in Object(t))
|
|
1888
1891
|
for (let o of t)
|
|
1889
|
-
typeof i == "function" && (o = i.call(t, o, o)), r.items.push(ot(o, null,
|
|
1892
|
+
typeof i == "function" && (o = i.call(t, o, o)), r.items.push(ot(o, null, n));
|
|
1890
1893
|
return r;
|
|
1891
1894
|
}
|
|
1892
1895
|
}
|
|
1893
1896
|
re.tag = "tag:yaml.org,2002:set";
|
|
1894
1897
|
const dt = {
|
|
1895
1898
|
collection: "map",
|
|
1896
|
-
identify: (
|
|
1899
|
+
identify: (s) => s instanceof Set,
|
|
1897
1900
|
nodeClass: re,
|
|
1898
1901
|
default: !1,
|
|
1899
1902
|
tag: "tag:yaml.org,2002:set",
|
|
1900
|
-
createNode: (
|
|
1901
|
-
resolve(
|
|
1902
|
-
if (X(
|
|
1903
|
-
if (
|
|
1904
|
-
return Object.assign(new re(),
|
|
1903
|
+
createNode: (s, e, t) => re.from(s, e, t),
|
|
1904
|
+
resolve(s, e) {
|
|
1905
|
+
if (X(s)) {
|
|
1906
|
+
if (s.hasAllNullValues(!0))
|
|
1907
|
+
return Object.assign(new re(), s);
|
|
1905
1908
|
e("Set items must all have null values");
|
|
1906
1909
|
} else
|
|
1907
1910
|
e("Expected a mapping for this tag");
|
|
1908
|
-
return
|
|
1911
|
+
return s;
|
|
1909
1912
|
}
|
|
1910
1913
|
};
|
|
1911
|
-
function pt(
|
|
1912
|
-
const t =
|
|
1914
|
+
function pt(s, e) {
|
|
1915
|
+
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));
|
|
1913
1916
|
return t === "-" ? i(-1) * r : r;
|
|
1914
1917
|
}
|
|
1915
|
-
function ss(
|
|
1916
|
-
let { value: e } =
|
|
1918
|
+
function ss(s) {
|
|
1919
|
+
let { value: e } = s, t = (o) => o;
|
|
1917
1920
|
if (typeof e == "bigint")
|
|
1918
1921
|
t = (o) => BigInt(o);
|
|
1919
1922
|
else if (isNaN(e) || !isFinite(e))
|
|
1920
|
-
return j(
|
|
1921
|
-
let
|
|
1922
|
-
e < 0 && (
|
|
1923
|
+
return j(s);
|
|
1924
|
+
let n = "";
|
|
1925
|
+
e < 0 && (n = "-", e *= t(-1));
|
|
1923
1926
|
const i = t(60), r = [e % i];
|
|
1924
|
-
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))),
|
|
1927
|
+
return e < 60 ? r.unshift(0) : (e = (e - r[0]) / i, r.unshift(e % i), e >= 60 && (e = (e - r[0]) / i, r.unshift(e))), n + r.map((o) => String(o).padStart(2, "0")).join(":").replace(/000000\d*$/, "");
|
|
1925
1928
|
}
|
|
1926
1929
|
const ns = {
|
|
1927
|
-
identify: (
|
|
1930
|
+
identify: (s) => typeof s == "bigint" || Number.isInteger(s),
|
|
1928
1931
|
default: !0,
|
|
1929
1932
|
tag: "tag:yaml.org,2002:int",
|
|
1930
1933
|
format: "TIME",
|
|
1931
1934
|
test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,
|
|
1932
|
-
resolve: (
|
|
1935
|
+
resolve: (s, e, { intAsBigInt: t }) => pt(s, t),
|
|
1933
1936
|
stringify: ss
|
|
1934
1937
|
}, is = {
|
|
1935
|
-
identify: (
|
|
1938
|
+
identify: (s) => typeof s == "number",
|
|
1936
1939
|
default: !0,
|
|
1937
1940
|
tag: "tag:yaml.org,2002:float",
|
|
1938
1941
|
format: "TIME",
|
|
1939
1942
|
test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,
|
|
1940
|
-
resolve: (
|
|
1943
|
+
resolve: (s) => pt(s, !1),
|
|
1941
1944
|
stringify: ss
|
|
1942
1945
|
}, Ue = {
|
|
1943
|
-
identify: (
|
|
1946
|
+
identify: (s) => s instanceof Date,
|
|
1944
1947
|
default: !0,
|
|
1945
1948
|
tag: "tag:yaml.org,2002:timestamp",
|
|
1946
1949
|
// If the time zone is omitted, the timestamp is assumed to be specified in UTC. The time part
|
|
1947
1950
|
// may be omitted altogether, resulting in a date format. In such a case, the time part is
|
|
1948
1951
|
// assumed to be 00:00:00Z (start of day, UTC).
|
|
1949
1952
|
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})?))?)?$"),
|
|
1950
|
-
resolve(
|
|
1951
|
-
const e =
|
|
1953
|
+
resolve(s) {
|
|
1954
|
+
const e = s.match(Ue.test);
|
|
1952
1955
|
if (!e)
|
|
1953
1956
|
throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");
|
|
1954
|
-
const [, t,
|
|
1955
|
-
let c = Date.UTC(t,
|
|
1957
|
+
const [, t, n, i, r, o, l] = e.map(Number), a = e[7] ? Number((e[7] + "00").substr(1, 3)) : 0;
|
|
1958
|
+
let c = Date.UTC(t, n - 1, i, r || 0, o || 0, l || 0, a);
|
|
1956
1959
|
const d = e[8];
|
|
1957
1960
|
if (d && d !== "Z") {
|
|
1958
1961
|
let f = pt(d, !1);
|
|
@@ -1960,7 +1963,7 @@ const ns = {
|
|
|
1960
1963
|
}
|
|
1961
1964
|
return new Date(c);
|
|
1962
1965
|
},
|
|
1963
|
-
stringify: ({ value:
|
|
1966
|
+
stringify: ({ value: s }) => s?.toISOString().replace(/(T00:00:00)?\.000Z$/, "") ?? ""
|
|
1964
1967
|
}, St = [
|
|
1965
1968
|
ue,
|
|
1966
1969
|
he,
|
|
@@ -2008,7 +2011,7 @@ const ns = {
|
|
|
2008
2011
|
seq: he,
|
|
2009
2012
|
set: dt,
|
|
2010
2013
|
timestamp: Ue
|
|
2011
|
-
},
|
|
2014
|
+
}, zs = {
|
|
2012
2015
|
"tag:yaml.org,2002:binary": ct,
|
|
2013
2016
|
"tag:yaml.org,2002:merge": F,
|
|
2014
2017
|
"tag:yaml.org,2002:omap": ut,
|
|
@@ -2016,22 +2019,22 @@ const ns = {
|
|
|
2016
2019
|
"tag:yaml.org,2002:set": dt,
|
|
2017
2020
|
"tag:yaml.org,2002:timestamp": Ue
|
|
2018
2021
|
};
|
|
2019
|
-
function Ye(
|
|
2020
|
-
const
|
|
2021
|
-
if (
|
|
2022
|
-
return t && !
|
|
2023
|
-
let i =
|
|
2022
|
+
function Ye(s, e, t) {
|
|
2023
|
+
const n = Nt.get(e);
|
|
2024
|
+
if (n && !s)
|
|
2025
|
+
return t && !n.includes(F) ? n.concat(F) : n.slice();
|
|
2026
|
+
let i = n;
|
|
2024
2027
|
if (!i)
|
|
2025
|
-
if (Array.isArray(
|
|
2028
|
+
if (Array.isArray(s))
|
|
2026
2029
|
i = [];
|
|
2027
2030
|
else {
|
|
2028
2031
|
const r = Array.from(Nt.keys()).filter((o) => o !== "yaml11").map((o) => JSON.stringify(o)).join(", ");
|
|
2029
2032
|
throw new Error(`Unknown schema "${e}"; use one of ${r} or define customTags array`);
|
|
2030
2033
|
}
|
|
2031
|
-
if (Array.isArray(
|
|
2032
|
-
for (const r of
|
|
2034
|
+
if (Array.isArray(s))
|
|
2035
|
+
for (const r of s)
|
|
2033
2036
|
i = i.concat(r);
|
|
2034
|
-
else typeof
|
|
2037
|
+
else typeof s == "function" && (i = s(i.slice()));
|
|
2035
2038
|
return t && (i = i.concat(F)), i.reduce((r, o) => {
|
|
2036
2039
|
const l = typeof o == "string" ? Ot[o] : o;
|
|
2037
2040
|
if (!l) {
|
|
@@ -2041,53 +2044,53 @@ function Ye(n, e, t) {
|
|
|
2041
2044
|
return r.includes(l) || r.push(l), r;
|
|
2042
2045
|
}, []);
|
|
2043
2046
|
}
|
|
2044
|
-
const
|
|
2047
|
+
const xs = (s, e) => s.key < e.key ? -1 : s.key > e.key ? 1 : 0;
|
|
2045
2048
|
class mt {
|
|
2046
|
-
constructor({ compat: e, customTags: t, merge:
|
|
2047
|
-
this.compat = Array.isArray(e) ? Ye(e, "compat") : e ? Ye(null, e) : null, this.name = typeof r == "string" && r || "core", this.knownTags = i ?
|
|
2049
|
+
constructor({ compat: e, customTags: t, merge: n, resolveKnownTags: i, schema: r, sortMapEntries: o, toStringDefaults: l }) {
|
|
2050
|
+
this.compat = Array.isArray(e) ? Ye(e, "compat") : e ? Ye(null, e) : null, this.name = typeof r == "string" && r || "core", this.knownTags = i ? zs : {}, this.tags = Ye(t, this.name, n), this.toStringOptions = l ?? null, Object.defineProperty(this, J, { value: ue }), Object.defineProperty(this, R, { value: De }), Object.defineProperty(this, ae, { value: he }), this.sortMapEntries = typeof o == "function" ? o : o === !0 ? xs : null;
|
|
2048
2051
|
}
|
|
2049
2052
|
clone() {
|
|
2050
2053
|
const e = Object.create(mt.prototype, Object.getOwnPropertyDescriptors(this));
|
|
2051
2054
|
return e.tags = this.tags.slice(), e;
|
|
2052
2055
|
}
|
|
2053
2056
|
}
|
|
2054
|
-
function Zs(
|
|
2057
|
+
function Zs(s, e) {
|
|
2055
2058
|
const t = [];
|
|
2056
|
-
let
|
|
2057
|
-
if (e.directives !== !1 &&
|
|
2058
|
-
const a =
|
|
2059
|
-
a ? (t.push(a),
|
|
2060
|
-
}
|
|
2061
|
-
|
|
2062
|
-
const i = qt(
|
|
2063
|
-
if (
|
|
2059
|
+
let n = e.directives === !0;
|
|
2060
|
+
if (e.directives !== !1 && s.directives) {
|
|
2061
|
+
const a = s.directives.toString(s);
|
|
2062
|
+
a ? (t.push(a), n = !0) : s.directives.docStart && (n = !0);
|
|
2063
|
+
}
|
|
2064
|
+
n && t.push("---");
|
|
2065
|
+
const i = qt(s, e), { commentString: r } = i.options;
|
|
2066
|
+
if (s.commentBefore) {
|
|
2064
2067
|
t.length !== 1 && t.unshift("");
|
|
2065
|
-
const a = r(
|
|
2068
|
+
const a = r(s.commentBefore);
|
|
2066
2069
|
t.unshift(U(a, ""));
|
|
2067
2070
|
}
|
|
2068
2071
|
let o = !1, l = null;
|
|
2069
|
-
if (
|
|
2070
|
-
if (L(
|
|
2071
|
-
if (
|
|
2072
|
-
const d = r(
|
|
2072
|
+
if (s.contents) {
|
|
2073
|
+
if (L(s.contents)) {
|
|
2074
|
+
if (s.contents.spaceBefore && n && t.push(""), s.contents.commentBefore) {
|
|
2075
|
+
const d = r(s.contents.commentBefore);
|
|
2073
2076
|
t.push(U(d, ""));
|
|
2074
2077
|
}
|
|
2075
|
-
i.forceBlockIndent = !!
|
|
2078
|
+
i.forceBlockIndent = !!s.comment, l = s.contents.comment;
|
|
2076
2079
|
}
|
|
2077
2080
|
const a = l ? void 0 : () => o = !0;
|
|
2078
|
-
let c = oe(
|
|
2081
|
+
let c = oe(s.contents, i, () => l = null, a);
|
|
2079
2082
|
l && (c += Q(c, "", r(l))), (c[0] === "|" || c[0] === ">") && t[t.length - 1] === "---" ? t[t.length - 1] = `--- ${c}` : t.push(c);
|
|
2080
2083
|
} else
|
|
2081
|
-
t.push(oe(
|
|
2082
|
-
if (
|
|
2083
|
-
if (
|
|
2084
|
-
const a = r(
|
|
2084
|
+
t.push(oe(s.contents, i));
|
|
2085
|
+
if (s.directives?.docEnd)
|
|
2086
|
+
if (s.comment) {
|
|
2087
|
+
const a = r(s.comment);
|
|
2085
2088
|
a.includes(`
|
|
2086
2089
|
`) ? (t.push("..."), t.push(U(a, ""))) : t.push(`... ${a}`);
|
|
2087
2090
|
} else
|
|
2088
2091
|
t.push("...");
|
|
2089
2092
|
else {
|
|
2090
|
-
let a =
|
|
2093
|
+
let a = s.comment;
|
|
2091
2094
|
a && o && (a = a.replace(/^\n+/, "")), a && ((!o || l) && t[t.length - 1] !== "" && t.push(""), t.push(U(r(a), "")));
|
|
2092
2095
|
}
|
|
2093
2096
|
return t.join(`
|
|
@@ -2095,10 +2098,10 @@ function Zs(n, e) {
|
|
|
2095
2098
|
`;
|
|
2096
2099
|
}
|
|
2097
2100
|
class Fe {
|
|
2098
|
-
constructor(e, t,
|
|
2101
|
+
constructor(e, t, n) {
|
|
2099
2102
|
this.commentBefore = null, this.comment = null, this.errors = [], this.warnings = [], Object.defineProperty(this, K, { value: He });
|
|
2100
2103
|
let i = null;
|
|
2101
|
-
typeof t == "function" || Array.isArray(t) ? i = t :
|
|
2104
|
+
typeof t == "function" || Array.isArray(t) ? i = t : n === void 0 && t && (n = t, t = void 0);
|
|
2102
2105
|
const r = Object.assign({
|
|
2103
2106
|
intAsBigInt: !1,
|
|
2104
2107
|
keepSourceTokens: !1,
|
|
@@ -2108,10 +2111,10 @@ class Fe {
|
|
|
2108
2111
|
stringKeys: !1,
|
|
2109
2112
|
uniqueKeys: !0,
|
|
2110
2113
|
version: "1.2"
|
|
2111
|
-
},
|
|
2114
|
+
}, n);
|
|
2112
2115
|
this.options = r;
|
|
2113
2116
|
let { version: o } = r;
|
|
2114
|
-
|
|
2117
|
+
n?._directives ? (this.directives = n._directives.atDocument(), this.directives.yaml.explicit && (o = this.directives.yaml.version)) : this.directives = new _({ version: o }), this.setSchema(o, n), this.contents = e === void 0 ? null : this.createNode(e, i, n);
|
|
2115
2118
|
}
|
|
2116
2119
|
/**
|
|
2117
2120
|
* Create a deep copy of this Document and its contents.
|
|
@@ -2143,21 +2146,21 @@ class Fe {
|
|
|
2143
2146
|
*/
|
|
2144
2147
|
createAlias(e, t) {
|
|
2145
2148
|
if (!e.anchor) {
|
|
2146
|
-
const
|
|
2149
|
+
const n = Pt(this);
|
|
2147
2150
|
e.anchor = // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
2148
|
-
!t ||
|
|
2151
|
+
!t || n.has(t) ? Bt(t || "a", n) : t;
|
|
2149
2152
|
}
|
|
2150
2153
|
return new it(e.anchor);
|
|
2151
2154
|
}
|
|
2152
|
-
createNode(e, t,
|
|
2155
|
+
createNode(e, t, n) {
|
|
2153
2156
|
let i;
|
|
2154
2157
|
if (typeof t == "function")
|
|
2155
2158
|
e = t.call({ "": e }, "", e), i = t;
|
|
2156
2159
|
else if (Array.isArray(t)) {
|
|
2157
2160
|
const p = (w) => typeof w == "number" || w instanceof String || w instanceof Number, b = t.filter(p).map(String);
|
|
2158
2161
|
b.length > 0 && (t = t.concat(b)), i = t;
|
|
2159
|
-
} else
|
|
2160
|
-
const { aliasDuplicateObjects: r, anchorPrefix: o, flow: l, keepUndefined: a, onTagObj: c, tag: d } =
|
|
2162
|
+
} else n === void 0 && t && (n = t, t = void 0);
|
|
2163
|
+
const { aliasDuplicateObjects: r, anchorPrefix: o, flow: l, keepUndefined: a, onTagObj: c, tag: d } = n ?? {}, { onAnchor: f, setAnchors: u, sourceObjects: m } = Is(
|
|
2161
2164
|
this,
|
|
2162
2165
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
2163
2166
|
o || "a"
|
|
@@ -2176,8 +2179,8 @@ class Fe {
|
|
|
2176
2179
|
* Convert a key and a value into a `Pair` using the current schema,
|
|
2177
2180
|
* recursively wrapping all values as `Scalar` or `Collection` nodes.
|
|
2178
2181
|
*/
|
|
2179
|
-
createPair(e, t,
|
|
2180
|
-
const i = this.createNode(e, null,
|
|
2182
|
+
createPair(e, t, n = {}) {
|
|
2183
|
+
const i = this.createNode(e, null, n), r = this.createNode(t, null, n);
|
|
2181
2184
|
return new M(i, r);
|
|
2182
2185
|
}
|
|
2183
2186
|
/**
|
|
@@ -2245,17 +2248,17 @@ class Fe {
|
|
|
2245
2248
|
*/
|
|
2246
2249
|
setSchema(e, t = {}) {
|
|
2247
2250
|
typeof e == "number" && (e = String(e));
|
|
2248
|
-
let
|
|
2251
|
+
let n;
|
|
2249
2252
|
switch (e) {
|
|
2250
2253
|
case "1.1":
|
|
2251
|
-
this.directives ? this.directives.yaml.version = "1.1" : this.directives = new _({ version: "1.1" }),
|
|
2254
|
+
this.directives ? this.directives.yaml.version = "1.1" : this.directives = new _({ version: "1.1" }), n = { resolveKnownTags: !1, schema: "yaml-1.1" };
|
|
2252
2255
|
break;
|
|
2253
2256
|
case "1.2":
|
|
2254
2257
|
case "next":
|
|
2255
|
-
this.directives ? this.directives.yaml.version = e : this.directives = new _({ version: e }),
|
|
2258
|
+
this.directives ? this.directives.yaml.version = e : this.directives = new _({ version: e }), n = { resolveKnownTags: !0, schema: "core" };
|
|
2256
2259
|
break;
|
|
2257
2260
|
case null:
|
|
2258
|
-
this.directives && delete this.directives,
|
|
2261
|
+
this.directives && delete this.directives, n = null;
|
|
2259
2262
|
break;
|
|
2260
2263
|
default: {
|
|
2261
2264
|
const i = JSON.stringify(e);
|
|
@@ -2264,18 +2267,18 @@ class Fe {
|
|
|
2264
2267
|
}
|
|
2265
2268
|
if (t.schema instanceof Object)
|
|
2266
2269
|
this.schema = t.schema;
|
|
2267
|
-
else if (
|
|
2268
|
-
this.schema = new mt(Object.assign(
|
|
2270
|
+
else if (n)
|
|
2271
|
+
this.schema = new mt(Object.assign(n, t));
|
|
2269
2272
|
else
|
|
2270
2273
|
throw new Error("With a null YAML version, the { schema: Schema } option is required");
|
|
2271
2274
|
}
|
|
2272
2275
|
// json & jsonArg are only used from toJSON()
|
|
2273
|
-
toJS({ json: e, jsonArg: t, mapAsMap:
|
|
2276
|
+
toJS({ json: e, jsonArg: t, mapAsMap: n, maxAliasCount: i, onAnchor: r, reviver: o } = {}) {
|
|
2274
2277
|
const l = {
|
|
2275
2278
|
anchors: /* @__PURE__ */ new Map(),
|
|
2276
2279
|
doc: this,
|
|
2277
2280
|
keep: !e,
|
|
2278
|
-
mapAsMap:
|
|
2281
|
+
mapAsMap: n === !0,
|
|
2279
2282
|
mapKeyWarned: !1,
|
|
2280
2283
|
maxAliasCount: typeof i == "number" ? i : 100
|
|
2281
2284
|
}, a = B(this.contents, t ?? "", l);
|
|
@@ -2304,46 +2307,46 @@ class Fe {
|
|
|
2304
2307
|
return Zs(this, e);
|
|
2305
2308
|
}
|
|
2306
2309
|
}
|
|
2307
|
-
function Z(
|
|
2308
|
-
if (C(
|
|
2310
|
+
function Z(s) {
|
|
2311
|
+
if (C(s))
|
|
2309
2312
|
return !0;
|
|
2310
2313
|
throw new Error("Expected a YAML collection as document contents");
|
|
2311
2314
|
}
|
|
2312
2315
|
class rs extends Error {
|
|
2313
|
-
constructor(e, t,
|
|
2314
|
-
super(), this.name = e, this.code =
|
|
2316
|
+
constructor(e, t, n, i) {
|
|
2317
|
+
super(), this.name = e, this.code = n, this.message = i, this.pos = t;
|
|
2315
2318
|
}
|
|
2316
2319
|
}
|
|
2317
2320
|
class me extends rs {
|
|
2318
|
-
constructor(e, t,
|
|
2319
|
-
super("YAMLParseError", e, t,
|
|
2321
|
+
constructor(e, t, n) {
|
|
2322
|
+
super("YAMLParseError", e, t, n);
|
|
2320
2323
|
}
|
|
2321
2324
|
}
|
|
2322
2325
|
class en extends rs {
|
|
2323
|
-
constructor(e, t,
|
|
2324
|
-
super("YAMLWarning", e, t,
|
|
2326
|
+
constructor(e, t, n) {
|
|
2327
|
+
super("YAMLWarning", e, t, n);
|
|
2325
2328
|
}
|
|
2326
2329
|
}
|
|
2327
|
-
const At = (
|
|
2330
|
+
const At = (s, e) => (t) => {
|
|
2328
2331
|
if (t.pos[0] === -1)
|
|
2329
2332
|
return;
|
|
2330
2333
|
t.linePos = t.pos.map((l) => e.linePos(l));
|
|
2331
|
-
const { line:
|
|
2332
|
-
t.message += ` at line ${
|
|
2333
|
-
let r = i - 1, o =
|
|
2334
|
+
const { line: n, col: i } = t.linePos[0];
|
|
2335
|
+
t.message += ` at line ${n}, column ${i}`;
|
|
2336
|
+
let r = i - 1, o = s.substring(e.lineStarts[n - 1], e.lineStarts[n]).replace(/[\n\r]+$/, "");
|
|
2334
2337
|
if (r >= 60 && o.length > 80) {
|
|
2335
2338
|
const l = Math.min(r - 39, o.length - 79);
|
|
2336
2339
|
o = "…" + o.substring(l), r -= l - 1;
|
|
2337
2340
|
}
|
|
2338
|
-
if (o.length > 80 && (o = o.substring(0, 79) + "…"),
|
|
2339
|
-
let l =
|
|
2341
|
+
if (o.length > 80 && (o = o.substring(0, 79) + "…"), n > 1 && /^ *$/.test(o.substring(0, r))) {
|
|
2342
|
+
let l = s.substring(e.lineStarts[n - 2], e.lineStarts[n - 1]);
|
|
2340
2343
|
l.length > 80 && (l = l.substring(0, 79) + `…
|
|
2341
2344
|
`), o = l + o;
|
|
2342
2345
|
}
|
|
2343
2346
|
if (/[^ ]/.test(o)) {
|
|
2344
2347
|
let l = 1;
|
|
2345
2348
|
const a = t.linePos[1];
|
|
2346
|
-
a?.line ===
|
|
2349
|
+
a?.line === n && a.col > i && (l = Math.max(1, Math.min(a.col - i, 80 - r)));
|
|
2347
2350
|
const c = " ".repeat(r) + "^".repeat(l);
|
|
2348
2351
|
t.message += `:
|
|
2349
2352
|
|
|
@@ -2352,12 +2355,12 @@ ${c}
|
|
|
2352
2355
|
`;
|
|
2353
2356
|
}
|
|
2354
2357
|
};
|
|
2355
|
-
function le(
|
|
2358
|
+
function le(s, { flow: e, indicator: t, next: n, offset: i, onError: r, parentIndent: o, startOnNewline: l }) {
|
|
2356
2359
|
let a = !1, c = l, d = l, f = "", u = "", m = !1, g = !1, h = null, p = null, b = null, w = null, k = null, S = null, N = null;
|
|
2357
|
-
for (const y of
|
|
2360
|
+
for (const y of s)
|
|
2358
2361
|
switch (g && (y.type !== "space" && y.type !== "newline" && y.type !== "comma" && r(y.offset, "MISSING_CHAR", "Tags and anchors must be separated from the next token by white space"), g = !1), h && (c && y.type !== "comment" && y.type !== "newline" && r(h, "TAB_AS_INDENT", "Tabs are not allowed as indentation"), h = null), y.type) {
|
|
2359
2362
|
case "space":
|
|
2360
|
-
!e && (t !== "doc-start" ||
|
|
2363
|
+
!e && (t !== "doc-start" || n?.type !== "flow-collection") && y.source.includes(" ") && (h = y), d = !0;
|
|
2361
2364
|
break;
|
|
2362
2365
|
case "comment": {
|
|
2363
2366
|
d || r(y, "MISSING_CHAR", "Comments must be separated from other tokens by white space characters");
|
|
@@ -2387,8 +2390,8 @@ function le(n, { flow: e, indicator: t, next: s, offset: i, onError: r, parentIn
|
|
|
2387
2390
|
default:
|
|
2388
2391
|
r(y, "UNEXPECTED_TOKEN", `Unexpected ${y.type} token`), c = !1, d = !1;
|
|
2389
2392
|
}
|
|
2390
|
-
const A =
|
|
2391
|
-
return g &&
|
|
2393
|
+
const A = s[s.length - 1], T = A ? A.offset + A.source.length : i;
|
|
2394
|
+
return g && n && n.type !== "space" && n.type !== "newline" && n.type !== "comma" && (n.type !== "scalar" || n.source !== "") && r(n.offset, "MISSING_CHAR", "Tags and anchors must be separated from the next token by white space"), h && (c && h.indent <= o || n?.type === "block-map" || n?.type === "block-seq") && r(h, "TAB_AS_INDENT", "Tabs are not allowed as indentation"), {
|
|
2392
2395
|
comma: k,
|
|
2393
2396
|
found: S,
|
|
2394
2397
|
spaceBefore: a,
|
|
@@ -2401,25 +2404,25 @@ function le(n, { flow: e, indicator: t, next: s, offset: i, onError: r, parentIn
|
|
|
2401
2404
|
start: N ?? T
|
|
2402
2405
|
};
|
|
2403
2406
|
}
|
|
2404
|
-
function we(
|
|
2405
|
-
if (!
|
|
2407
|
+
function we(s) {
|
|
2408
|
+
if (!s)
|
|
2406
2409
|
return null;
|
|
2407
|
-
switch (
|
|
2410
|
+
switch (s.type) {
|
|
2408
2411
|
case "alias":
|
|
2409
2412
|
case "scalar":
|
|
2410
2413
|
case "double-quoted-scalar":
|
|
2411
2414
|
case "single-quoted-scalar":
|
|
2412
|
-
if (
|
|
2415
|
+
if (s.source.includes(`
|
|
2413
2416
|
`))
|
|
2414
2417
|
return !0;
|
|
2415
|
-
if (
|
|
2416
|
-
for (const e of
|
|
2418
|
+
if (s.end) {
|
|
2419
|
+
for (const e of s.end)
|
|
2417
2420
|
if (e.type === "newline")
|
|
2418
2421
|
return !0;
|
|
2419
2422
|
}
|
|
2420
2423
|
return !1;
|
|
2421
2424
|
case "flow-collection":
|
|
2422
|
-
for (const e of
|
|
2425
|
+
for (const e of s.items) {
|
|
2423
2426
|
for (const t of e.start)
|
|
2424
2427
|
if (t.type === "newline")
|
|
2425
2428
|
return !0;
|
|
@@ -2436,56 +2439,56 @@ function we(n) {
|
|
|
2436
2439
|
return !0;
|
|
2437
2440
|
}
|
|
2438
2441
|
}
|
|
2439
|
-
function Ze(
|
|
2442
|
+
function Ze(s, e, t) {
|
|
2440
2443
|
if (e?.type === "flow-collection") {
|
|
2441
|
-
const
|
|
2442
|
-
|
|
2444
|
+
const n = e.end[0];
|
|
2445
|
+
n.indent === s && (n.source === "]" || n.source === "}") && we(e) && t(n, "BAD_INDENT", "Flow end indicator should be more indented than parent", !0);
|
|
2443
2446
|
}
|
|
2444
2447
|
}
|
|
2445
|
-
function os(
|
|
2446
|
-
const { uniqueKeys:
|
|
2447
|
-
if (
|
|
2448
|
+
function os(s, e, t) {
|
|
2449
|
+
const { uniqueKeys: n } = s.options;
|
|
2450
|
+
if (n === !1)
|
|
2448
2451
|
return !1;
|
|
2449
|
-
const i = typeof
|
|
2452
|
+
const i = typeof n == "function" ? n : (r, o) => r === o || I(r) && I(o) && r.value === o.value;
|
|
2450
2453
|
return e.some((r) => i(r.key, t));
|
|
2451
2454
|
}
|
|
2452
2455
|
const Lt = "All mapping items must start at the same column";
|
|
2453
|
-
function tn({ composeNode:
|
|
2456
|
+
function tn({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
2454
2457
|
const o = r?.nodeClass ?? P, l = new o(t.schema);
|
|
2455
2458
|
t.atRoot && (t.atRoot = !1);
|
|
2456
|
-
let a =
|
|
2457
|
-
for (const d of
|
|
2459
|
+
let a = n.offset, c = null;
|
|
2460
|
+
for (const d of n.items) {
|
|
2458
2461
|
const { start: f, key: u, sep: m, value: g } = d, h = le(f, {
|
|
2459
2462
|
indicator: "explicit-key-ind",
|
|
2460
2463
|
next: u ?? m?.[0],
|
|
2461
2464
|
offset: a,
|
|
2462
2465
|
onError: i,
|
|
2463
|
-
parentIndent:
|
|
2466
|
+
parentIndent: n.indent,
|
|
2464
2467
|
startOnNewline: !0
|
|
2465
2468
|
}), p = !h.found;
|
|
2466
2469
|
if (p) {
|
|
2467
|
-
if (u && (u.type === "block-seq" ? i(a, "BLOCK_AS_IMPLICIT_KEY", "A block sequence may not be used as an implicit map key") : "indent" in u && u.indent !==
|
|
2470
|
+
if (u && (u.type === "block-seq" ? i(a, "BLOCK_AS_IMPLICIT_KEY", "A block sequence may not be used as an implicit map key") : "indent" in u && u.indent !== n.indent && i(a, "BAD_INDENT", Lt)), !h.anchor && !h.tag && !m) {
|
|
2468
2471
|
c = h.end, h.comment && (l.comment ? l.comment += `
|
|
2469
2472
|
` + h.comment : l.comment = h.comment);
|
|
2470
2473
|
continue;
|
|
2471
2474
|
}
|
|
2472
2475
|
(h.newlineAfterProp || we(u)) && i(u ?? f[f.length - 1], "MULTILINE_IMPLICIT_KEY", "Implicit keys need to be on a single line");
|
|
2473
|
-
} else h.found?.indent !==
|
|
2476
|
+
} else h.found?.indent !== n.indent && i(a, "BAD_INDENT", Lt);
|
|
2474
2477
|
t.atKey = !0;
|
|
2475
|
-
const b = h.end, w = u ?
|
|
2476
|
-
t.schema.compat && Ze(
|
|
2478
|
+
const b = h.end, w = u ? s(t, u, h, i) : e(t, b, f, null, h, i);
|
|
2479
|
+
t.schema.compat && Ze(n.indent, u, i), t.atKey = !1, os(t, l.items, w) && i(b, "DUPLICATE_KEY", "Map keys must be unique");
|
|
2477
2480
|
const k = le(m ?? [], {
|
|
2478
2481
|
indicator: "map-value-ind",
|
|
2479
2482
|
next: g,
|
|
2480
2483
|
offset: w.range[2],
|
|
2481
2484
|
onError: i,
|
|
2482
|
-
parentIndent:
|
|
2485
|
+
parentIndent: n.indent,
|
|
2483
2486
|
startOnNewline: !u || u.type === "block-scalar"
|
|
2484
2487
|
});
|
|
2485
2488
|
if (a = k.end, k.found) {
|
|
2486
2489
|
p && (g?.type === "block-map" && !k.hasNewline && i(a, "BLOCK_AS_IMPLICIT_KEY", "Nested mappings are not allowed in compact mappings"), t.options.strict && h.start < k.found.offset - 1024 && i(w.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));
|
|
2487
|
-
const S = g ?
|
|
2488
|
-
t.schema.compat && Ze(
|
|
2490
|
+
const S = g ? s(t, g, k, i) : e(t, a, m, null, k, i);
|
|
2491
|
+
t.schema.compat && Ze(n.indent, g, i), a = S.range[2];
|
|
2489
2492
|
const N = new M(w, S);
|
|
2490
2493
|
t.options.keepSourceTokens && (N.srcToken = d), l.items.push(N);
|
|
2491
2494
|
} else {
|
|
@@ -2495,19 +2498,19 @@ function tn({ composeNode: n, composeEmptyNode: e }, t, s, i, r) {
|
|
|
2495
2498
|
t.options.keepSourceTokens && (S.srcToken = d), l.items.push(S);
|
|
2496
2499
|
}
|
|
2497
2500
|
}
|
|
2498
|
-
return c && c < a && i(c, "IMPOSSIBLE", "Map comment with trailing content"), l.range = [
|
|
2501
|
+
return c && c < a && i(c, "IMPOSSIBLE", "Map comment with trailing content"), l.range = [n.offset, a, c ?? a], l;
|
|
2499
2502
|
}
|
|
2500
|
-
function sn({ composeNode:
|
|
2503
|
+
function sn({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
2501
2504
|
const o = r?.nodeClass ?? H, l = new o(t.schema);
|
|
2502
2505
|
t.atRoot && (t.atRoot = !1), t.atKey && (t.atKey = !1);
|
|
2503
|
-
let a =
|
|
2504
|
-
for (const { start: d, value: f } of
|
|
2506
|
+
let a = n.offset, c = null;
|
|
2507
|
+
for (const { start: d, value: f } of n.items) {
|
|
2505
2508
|
const u = le(d, {
|
|
2506
2509
|
indicator: "seq-item-ind",
|
|
2507
2510
|
next: f,
|
|
2508
2511
|
offset: a,
|
|
2509
2512
|
onError: i,
|
|
2510
|
-
parentIndent:
|
|
2513
|
+
parentIndent: n.indent,
|
|
2511
2514
|
startOnNewline: !0
|
|
2512
2515
|
});
|
|
2513
2516
|
if (!u.found)
|
|
@@ -2517,23 +2520,23 @@ function sn({ composeNode: n, composeEmptyNode: e }, t, s, i, r) {
|
|
|
2517
2520
|
c = u.end, u.comment && (l.comment = u.comment);
|
|
2518
2521
|
continue;
|
|
2519
2522
|
}
|
|
2520
|
-
const m = f ?
|
|
2521
|
-
t.schema.compat && Ze(
|
|
2523
|
+
const m = f ? s(t, f, u, i) : e(t, u.end, d, null, u, i);
|
|
2524
|
+
t.schema.compat && Ze(n.indent, f, i), a = m.range[2], l.items.push(m);
|
|
2522
2525
|
}
|
|
2523
|
-
return l.range = [
|
|
2526
|
+
return l.range = [n.offset, a, c ?? a], l;
|
|
2524
2527
|
}
|
|
2525
|
-
function Se(
|
|
2528
|
+
function Se(s, e, t, n) {
|
|
2526
2529
|
let i = "";
|
|
2527
|
-
if (
|
|
2530
|
+
if (s) {
|
|
2528
2531
|
let r = !1, o = "";
|
|
2529
|
-
for (const l of
|
|
2532
|
+
for (const l of s) {
|
|
2530
2533
|
const { source: a, type: c } = l;
|
|
2531
2534
|
switch (c) {
|
|
2532
2535
|
case "space":
|
|
2533
2536
|
r = !0;
|
|
2534
2537
|
break;
|
|
2535
2538
|
case "comment": {
|
|
2536
|
-
t && !r &&
|
|
2539
|
+
t && !r && n(l, "MISSING_CHAR", "Comments must be separated from other tokens by white space characters");
|
|
2537
2540
|
const d = a.substring(1) || " ";
|
|
2538
2541
|
i ? i += o + d : i = d, o = "";
|
|
2539
2542
|
break;
|
|
@@ -2542,33 +2545,33 @@ function Se(n, e, t, s) {
|
|
|
2542
2545
|
i && (o += a), r = !0;
|
|
2543
2546
|
break;
|
|
2544
2547
|
default:
|
|
2545
|
-
|
|
2548
|
+
n(l, "UNEXPECTED_TOKEN", `Unexpected ${c} at node end`);
|
|
2546
2549
|
}
|
|
2547
2550
|
e += a.length;
|
|
2548
2551
|
}
|
|
2549
2552
|
}
|
|
2550
2553
|
return { comment: i, offset: e };
|
|
2551
2554
|
}
|
|
2552
|
-
const Je = "Block collections are not allowed within flow collections", Ge = (
|
|
2553
|
-
function nn({ composeNode:
|
|
2554
|
-
const o =
|
|
2555
|
+
const Je = "Block collections are not allowed within flow collections", Ge = (s) => s && (s.type === "block-map" || s.type === "block-seq");
|
|
2556
|
+
function nn({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
2557
|
+
const o = n.start.source === "{", l = o ? "flow map" : "flow sequence", a = r?.nodeClass ?? (o ? P : H), c = new a(t.schema);
|
|
2555
2558
|
c.flow = !0;
|
|
2556
2559
|
const d = t.atRoot;
|
|
2557
2560
|
d && (t.atRoot = !1), t.atKey && (t.atKey = !1);
|
|
2558
|
-
let f =
|
|
2559
|
-
for (let p = 0; p <
|
|
2560
|
-
const b =
|
|
2561
|
+
let f = n.offset + n.start.source.length;
|
|
2562
|
+
for (let p = 0; p < n.items.length; ++p) {
|
|
2563
|
+
const b = n.items[p], { start: w, key: k, sep: S, value: N } = b, A = le(w, {
|
|
2561
2564
|
flow: l,
|
|
2562
2565
|
indicator: "explicit-key-ind",
|
|
2563
2566
|
next: k ?? S?.[0],
|
|
2564
2567
|
offset: f,
|
|
2565
2568
|
onError: i,
|
|
2566
|
-
parentIndent:
|
|
2569
|
+
parentIndent: n.indent,
|
|
2567
2570
|
startOnNewline: !1
|
|
2568
2571
|
});
|
|
2569
2572
|
if (!A.found) {
|
|
2570
2573
|
if (!A.anchor && !A.tag && !S && !N) {
|
|
2571
|
-
p === 0 && A.comma ? i(A.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${l}`) : p <
|
|
2574
|
+
p === 0 && A.comma ? i(A.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${l}`) : p < n.items.length - 1 && i(A.start, "UNEXPECTED_TOKEN", `Unexpected empty item in ${l}`), A.comment && (c.comment ? c.comment += `
|
|
2572
2575
|
` + A.comment : c.comment = A.comment), f = A.end;
|
|
2573
2576
|
continue;
|
|
2574
2577
|
}
|
|
@@ -2601,11 +2604,11 @@ function nn({ composeNode: n, composeEmptyNode: e }, t, s, i, r) {
|
|
|
2601
2604
|
}
|
|
2602
2605
|
}
|
|
2603
2606
|
if (!o && !S && !A.found) {
|
|
2604
|
-
const T = N ?
|
|
2607
|
+
const T = N ? s(t, N, A, i) : e(t, A.end, S, null, A, i);
|
|
2605
2608
|
c.items.push(T), f = T.range[2], Ge(N) && i(T.range, "BLOCK_IN_FLOW", Je);
|
|
2606
2609
|
} else {
|
|
2607
2610
|
t.atKey = !0;
|
|
2608
|
-
const T = A.end, y = k ?
|
|
2611
|
+
const T = A.end, y = k ? s(t, k, A, i) : e(t, T, w, null, A, i);
|
|
2609
2612
|
Ge(k) && i(y.range, "BLOCK_IN_FLOW", Je), t.atKey = !1;
|
|
2610
2613
|
const $ = le(S ?? [], {
|
|
2611
2614
|
flow: l,
|
|
@@ -2613,7 +2616,7 @@ function nn({ composeNode: n, composeEmptyNode: e }, t, s, i, r) {
|
|
|
2613
2616
|
next: N,
|
|
2614
2617
|
offset: y.range[2],
|
|
2615
2618
|
onError: i,
|
|
2616
|
-
parentIndent:
|
|
2619
|
+
parentIndent: n.indent,
|
|
2617
2620
|
startOnNewline: !1
|
|
2618
2621
|
});
|
|
2619
2622
|
if ($.found) {
|
|
@@ -2630,23 +2633,23 @@ function nn({ composeNode: n, composeEmptyNode: e }, t, s, i, r) {
|
|
|
2630
2633
|
A.start < $.found.offset - 1024 && i($.found, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit flow sequence key");
|
|
2631
2634
|
}
|
|
2632
2635
|
} else N && ("source" in N && N.source?.[0] === ":" ? i(N, "MISSING_CHAR", `Missing space after : in ${l}`) : i($.start, "MISSING_CHAR", `Missing , or : between ${l} items`));
|
|
2633
|
-
const V = N ?
|
|
2636
|
+
const V = N ? s(t, N, $, i) : $.found ? e(t, $.end, S, null, $, i) : null;
|
|
2634
2637
|
V ? Ge(N) && i(V.range, "BLOCK_IN_FLOW", Je) : $.comment && (y.comment ? y.comment += `
|
|
2635
2638
|
` + $.comment : y.comment = $.comment);
|
|
2636
|
-
const
|
|
2637
|
-
if (t.options.keepSourceTokens && (
|
|
2639
|
+
const x = new M(y, V);
|
|
2640
|
+
if (t.options.keepSourceTokens && (x.srcToken = b), o) {
|
|
2638
2641
|
const v = c;
|
|
2639
|
-
os(t, v.items, y) && i(T, "DUPLICATE_KEY", "Map keys must be unique"), v.items.push(
|
|
2642
|
+
os(t, v.items, y) && i(T, "DUPLICATE_KEY", "Map keys must be unique"), v.items.push(x);
|
|
2640
2643
|
} else {
|
|
2641
2644
|
const v = new P(t.schema);
|
|
2642
|
-
v.flow = !0, v.items.push(
|
|
2645
|
+
v.flow = !0, v.items.push(x);
|
|
2643
2646
|
const bt = (V ?? y).range;
|
|
2644
2647
|
v.range = [y.range[0], bt[1], bt[2]], c.items.push(v);
|
|
2645
2648
|
}
|
|
2646
2649
|
f = V ? V.range[2] : $.end;
|
|
2647
2650
|
}
|
|
2648
2651
|
}
|
|
2649
|
-
const u = o ? "}" : "]", [m, ...g] =
|
|
2652
|
+
const u = o ? "}" : "]", [m, ...g] = n.end;
|
|
2650
2653
|
let h = f;
|
|
2651
2654
|
if (m?.source === u)
|
|
2652
2655
|
h = m.offset + m.source.length;
|
|
@@ -2657,39 +2660,39 @@ function nn({ composeNode: n, composeEmptyNode: e }, t, s, i, r) {
|
|
|
2657
2660
|
if (g.length > 0) {
|
|
2658
2661
|
const p = Se(g, h, t.options.strict, i);
|
|
2659
2662
|
p.comment && (c.comment ? c.comment += `
|
|
2660
|
-
` + p.comment : c.comment = p.comment), c.range = [
|
|
2663
|
+
` + p.comment : c.comment = p.comment), c.range = [n.offset, h, p.offset];
|
|
2661
2664
|
} else
|
|
2662
|
-
c.range = [
|
|
2665
|
+
c.range = [n.offset, h, h];
|
|
2663
2666
|
return c;
|
|
2664
2667
|
}
|
|
2665
|
-
function Qe(
|
|
2666
|
-
const o = t.type === "block-map" ? tn(
|
|
2668
|
+
function Qe(s, e, t, n, i, r) {
|
|
2669
|
+
const o = t.type === "block-map" ? tn(s, e, t, n, r) : t.type === "block-seq" ? sn(s, e, t, n, r) : nn(s, e, t, n, r), l = o.constructor;
|
|
2667
2670
|
return i === "!" || i === l.tagName ? (o.tag = l.tagName, o) : (i && (o.tag = i), o);
|
|
2668
2671
|
}
|
|
2669
|
-
function rn(
|
|
2670
|
-
const r =
|
|
2672
|
+
function rn(s, e, t, n, i) {
|
|
2673
|
+
const r = n.tag, o = r ? e.directives.tagName(r.source, (u) => i(r, "TAG_RESOLVE_FAILED", u)) : null;
|
|
2671
2674
|
if (t.type === "block-seq") {
|
|
2672
|
-
const { anchor: u, newlineAfterProp: m } =
|
|
2675
|
+
const { anchor: u, newlineAfterProp: m } = n, g = u && r ? u.offset > r.offset ? u : r : u ?? r;
|
|
2673
2676
|
g && (!m || m.offset < g.offset) && i(g, "MISSING_CHAR", "Missing newline after block sequence props");
|
|
2674
2677
|
}
|
|
2675
2678
|
const l = t.type === "block-map" ? "map" : t.type === "block-seq" ? "seq" : t.start.source === "{" ? "map" : "seq";
|
|
2676
2679
|
if (!r || !o || o === "!" || o === P.tagName && l === "map" || o === H.tagName && l === "seq")
|
|
2677
|
-
return Qe(
|
|
2680
|
+
return Qe(s, e, t, i, o);
|
|
2678
2681
|
let a = e.schema.tags.find((u) => u.tag === o && u.collection === l);
|
|
2679
2682
|
if (!a) {
|
|
2680
2683
|
const u = e.schema.knownTags[o];
|
|
2681
2684
|
if (u?.collection === l)
|
|
2682
2685
|
e.schema.tags.push(Object.assign({}, u, { default: !1 })), a = u;
|
|
2683
2686
|
else
|
|
2684
|
-
return u ? i(r, "BAD_COLLECTION_TYPE", `${u.tag} used for ${l} collection, but expects ${u.collection ?? "scalar"}`, !0) : i(r, "TAG_RESOLVE_FAILED", `Unresolved tag: ${o}`, !0), Qe(
|
|
2687
|
+
return u ? i(r, "BAD_COLLECTION_TYPE", `${u.tag} used for ${l} collection, but expects ${u.collection ?? "scalar"}`, !0) : i(r, "TAG_RESOLVE_FAILED", `Unresolved tag: ${o}`, !0), Qe(s, e, t, i, o);
|
|
2685
2688
|
}
|
|
2686
|
-
const c = Qe(
|
|
2689
|
+
const c = Qe(s, e, t, i, o, a), d = a.resolve?.(c, (u) => i(r, "TAG_RESOLVE_FAILED", u), e.options) ?? c, f = L(d) ? d : new O(d);
|
|
2687
2690
|
return f.range = c.range, f.tag = o, a?.format && (f.format = a.format), f;
|
|
2688
2691
|
}
|
|
2689
|
-
function on(
|
|
2690
|
-
const
|
|
2692
|
+
function on(s, e, t) {
|
|
2693
|
+
const n = e.offset, i = ln(e, s.options.strict, t);
|
|
2691
2694
|
if (!i)
|
|
2692
|
-
return { value: "", type: null, comment: "", range: [
|
|
2695
|
+
return { value: "", type: null, comment: "", range: [n, n, n] };
|
|
2693
2696
|
const r = i.mode === ">" ? O.BLOCK_FOLDED : O.BLOCK_LITERAL, o = e.source ? an(e.source) : [];
|
|
2694
2697
|
let l = o.length;
|
|
2695
2698
|
for (let h = o.length - 1; h >= 0; --h) {
|
|
@@ -2702,8 +2705,8 @@ function on(n, e, t) {
|
|
|
2702
2705
|
if (l === 0) {
|
|
2703
2706
|
const h = i.chomp === "+" && o.length > 0 ? `
|
|
2704
2707
|
`.repeat(Math.max(1, o.length - 1)) : "";
|
|
2705
|
-
let p =
|
|
2706
|
-
return e.source && (p += e.source.length), { value: h, type: r, comment: i.comment, range: [
|
|
2708
|
+
let p = n + i.length;
|
|
2709
|
+
return e.source && (p += e.source.length), { value: h, type: r, comment: i.comment, range: [n, p, p] };
|
|
2707
2710
|
}
|
|
2708
2711
|
let a = e.indent + i.indent, c = e.offset + i.length, d = 0;
|
|
2709
2712
|
for (let h = 0; h < l; ++h) {
|
|
@@ -2711,7 +2714,7 @@ function on(n, e, t) {
|
|
|
2711
2714
|
if (b === "" || b === "\r")
|
|
2712
2715
|
i.indent === 0 && p.length > a && (a = p.length);
|
|
2713
2716
|
else {
|
|
2714
|
-
p.length < a && t(c + p.length, "MISSING_CHAR", "Block scalars with more-indented leading empty lines must use an explicit indentation indicator"), i.indent === 0 && (a = p.length), d = h, a === 0 && !
|
|
2717
|
+
p.length < a && t(c + p.length, "MISSING_CHAR", "Block scalars with more-indented leading empty lines must use an explicit indentation indicator"), i.indent === 0 && (a = p.length), d = h, a === 0 && !s.atRoot && t(c, "BAD_INDENT", "Block scalar values in collections must be indented");
|
|
2715
2718
|
break;
|
|
2716
2719
|
}
|
|
2717
2720
|
c += p.length + b.length + 1;
|
|
@@ -2756,12 +2759,12 @@ function on(n, e, t) {
|
|
|
2756
2759
|
f += `
|
|
2757
2760
|
`;
|
|
2758
2761
|
}
|
|
2759
|
-
const g =
|
|
2760
|
-
return { value: f, type: r, comment: i.comment, range: [
|
|
2762
|
+
const g = n + i.length + e.source.length;
|
|
2763
|
+
return { value: f, type: r, comment: i.comment, range: [n, g, g] };
|
|
2761
2764
|
}
|
|
2762
|
-
function ln({ offset:
|
|
2765
|
+
function ln({ offset: s, props: e }, t, n) {
|
|
2763
2766
|
if (e[0].type !== "block-scalar-header")
|
|
2764
|
-
return
|
|
2767
|
+
return n(e[0], "IMPOSSIBLE", "Block scalar header not found"), null;
|
|
2765
2768
|
const { source: i } = e[0], r = i[0];
|
|
2766
2769
|
let o = 0, l = "", a = -1;
|
|
2767
2770
|
for (let u = 1; u < i.length; ++u) {
|
|
@@ -2770,10 +2773,10 @@ function ln({ offset: n, props: e }, t, s) {
|
|
|
2770
2773
|
l = m;
|
|
2771
2774
|
else {
|
|
2772
2775
|
const g = Number(m);
|
|
2773
|
-
!o && g ? o = g : a === -1 && (a =
|
|
2776
|
+
!o && g ? o = g : a === -1 && (a = s + u);
|
|
2774
2777
|
}
|
|
2775
2778
|
}
|
|
2776
|
-
a !== -1 &&
|
|
2779
|
+
a !== -1 && n(a, "UNEXPECTED_TOKEN", `Block scalar header includes extra characters: ${i}`);
|
|
2777
2780
|
let c = !1, d = "", f = i.length;
|
|
2778
2781
|
for (let u = 1; u < e.length; ++u) {
|
|
2779
2782
|
const m = e[u];
|
|
@@ -2785,15 +2788,15 @@ function ln({ offset: n, props: e }, t, s) {
|
|
|
2785
2788
|
f += m.source.length;
|
|
2786
2789
|
break;
|
|
2787
2790
|
case "comment":
|
|
2788
|
-
t && !c &&
|
|
2791
|
+
t && !c && n(m, "MISSING_CHAR", "Comments must be separated from other tokens by white space characters"), f += m.source.length, d = m.source.substring(1);
|
|
2789
2792
|
break;
|
|
2790
2793
|
case "error":
|
|
2791
|
-
|
|
2794
|
+
n(m, "UNEXPECTED_TOKEN", m.message), f += m.source.length;
|
|
2792
2795
|
break;
|
|
2793
2796
|
/* istanbul ignore next should not happen */
|
|
2794
2797
|
default: {
|
|
2795
2798
|
const g = `Unexpected token in block scalar header: ${m.type}`;
|
|
2796
|
-
|
|
2799
|
+
n(m, "UNEXPECTED_TOKEN", g);
|
|
2797
2800
|
const h = m.source;
|
|
2798
2801
|
h && typeof h == "string" && (f += h.length);
|
|
2799
2802
|
}
|
|
@@ -2801,16 +2804,16 @@ function ln({ offset: n, props: e }, t, s) {
|
|
|
2801
2804
|
}
|
|
2802
2805
|
return { mode: r, indent: o, chomp: l, comment: d, length: f };
|
|
2803
2806
|
}
|
|
2804
|
-
function an(
|
|
2805
|
-
const e =
|
|
2807
|
+
function an(s) {
|
|
2808
|
+
const e = s.split(/\n( *)/), t = e[0], n = t.match(/^( *)/), r = [n?.[1] ? [n[1], t.slice(n[1].length)] : ["", t]];
|
|
2806
2809
|
for (let o = 1; o < e.length; o += 2)
|
|
2807
2810
|
r.push([e[o], e[o + 1]]);
|
|
2808
2811
|
return r;
|
|
2809
2812
|
}
|
|
2810
|
-
function cn(
|
|
2811
|
-
const { offset:
|
|
2813
|
+
function cn(s, e, t) {
|
|
2814
|
+
const { offset: n, type: i, source: r, end: o } = s;
|
|
2812
2815
|
let l, a;
|
|
2813
|
-
const c = (u, m, g) => t(
|
|
2816
|
+
const c = (u, m, g) => t(n + u, m, g);
|
|
2814
2817
|
switch (i) {
|
|
2815
2818
|
case "scalar":
|
|
2816
2819
|
l = O.PLAIN, a = fn(r, c);
|
|
@@ -2823,24 +2826,24 @@ function cn(n, e, t) {
|
|
|
2823
2826
|
break;
|
|
2824
2827
|
/* istanbul ignore next should not happen */
|
|
2825
2828
|
default:
|
|
2826
|
-
return t(
|
|
2829
|
+
return t(s, "UNEXPECTED_TOKEN", `Expected a flow scalar value, but found: ${i}`), {
|
|
2827
2830
|
value: "",
|
|
2828
2831
|
type: null,
|
|
2829
2832
|
comment: "",
|
|
2830
|
-
range: [
|
|
2833
|
+
range: [n, n + r.length, n + r.length]
|
|
2831
2834
|
};
|
|
2832
2835
|
}
|
|
2833
|
-
const d =
|
|
2836
|
+
const d = n + r.length, f = Se(o, d, e, t);
|
|
2834
2837
|
return {
|
|
2835
2838
|
value: a,
|
|
2836
2839
|
type: l,
|
|
2837
2840
|
comment: f.comment,
|
|
2838
|
-
range: [
|
|
2841
|
+
range: [n, d, f.offset]
|
|
2839
2842
|
};
|
|
2840
2843
|
}
|
|
2841
|
-
function fn(
|
|
2844
|
+
function fn(s, e) {
|
|
2842
2845
|
let t = "";
|
|
2843
|
-
switch (
|
|
2846
|
+
switch (s[0]) {
|
|
2844
2847
|
/* istanbul ignore next should not happen */
|
|
2845
2848
|
case " ":
|
|
2846
2849
|
t = "a tab character";
|
|
@@ -2853,91 +2856,92 @@ function fn(n, e) {
|
|
|
2853
2856
|
break;
|
|
2854
2857
|
case "|":
|
|
2855
2858
|
case ">": {
|
|
2856
|
-
t = `block scalar indicator ${
|
|
2859
|
+
t = `block scalar indicator ${s[0]}`;
|
|
2857
2860
|
break;
|
|
2858
2861
|
}
|
|
2859
2862
|
case "@":
|
|
2860
2863
|
case "`": {
|
|
2861
|
-
t = `reserved character ${
|
|
2864
|
+
t = `reserved character ${s[0]}`;
|
|
2862
2865
|
break;
|
|
2863
2866
|
}
|
|
2864
2867
|
}
|
|
2865
|
-
return t && e(0, "BAD_SCALAR_START", `Plain value cannot start with ${t}`), ls(
|
|
2868
|
+
return t && e(0, "BAD_SCALAR_START", `Plain value cannot start with ${t}`), ls(s);
|
|
2866
2869
|
}
|
|
2867
|
-
function un(
|
|
2868
|
-
return (
|
|
2870
|
+
function un(s, e) {
|
|
2871
|
+
return (s[s.length - 1] !== "'" || s.length === 1) && e(s.length, "MISSING_CHAR", "Missing closing 'quote"), ls(s.slice(1, -1)).replace(/''/g, "'");
|
|
2869
2872
|
}
|
|
2870
|
-
function ls(
|
|
2871
|
-
|
|
2873
|
+
function ls(s) {
|
|
2874
|
+
const e = /(.*?)\r?\n/sy;
|
|
2875
|
+
let t = e.exec(s);
|
|
2876
|
+
if (!t)
|
|
2877
|
+
return s;
|
|
2878
|
+
let n, i;
|
|
2872
2879
|
try {
|
|
2873
|
-
|
|
2874
|
-
`, "sy"), t = new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
2875
|
-
`, "sy");
|
|
2880
|
+
n = new RegExp("(?<![ ])[ ]+$"), i = new RegExp("^[ ]+|(?<![ ])[ ]+$", "g");
|
|
2876
2881
|
} catch {
|
|
2877
|
-
|
|
2882
|
+
n = /[ \t]+$/, i = /^[ \t]+|[ \t]+$/g;
|
|
2878
2883
|
}
|
|
2879
|
-
let
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
function hn(n, e) {
|
|
2884
|
+
let r = t[1].replace(n, ""), o = " ", l = e.lastIndex;
|
|
2885
|
+
for (; t = e.exec(s); ) {
|
|
2886
|
+
const c = t[1].replace(i, "");
|
|
2887
|
+
c === "" ? o === `
|
|
2888
|
+
` ? r += o : o = `
|
|
2889
|
+
` : (r += o + c, o = " "), l = e.lastIndex;
|
|
2890
|
+
}
|
|
2891
|
+
const a = /[ \t]*(.*)/sy;
|
|
2892
|
+
return a.lastIndex = l, t = a.exec(s), r + o + (t?.[1] ?? "");
|
|
2893
|
+
}
|
|
2894
|
+
function hn(s, e) {
|
|
2891
2895
|
let t = "";
|
|
2892
|
-
for (let
|
|
2893
|
-
const i = n
|
|
2894
|
-
if (!(i === "\r" && n
|
|
2896
|
+
for (let n = 1; n < s.length - 1; ++n) {
|
|
2897
|
+
const i = s[n];
|
|
2898
|
+
if (!(i === "\r" && s[n + 1] === `
|
|
2895
2899
|
`))
|
|
2896
2900
|
if (i === `
|
|
2897
2901
|
`) {
|
|
2898
|
-
const { fold: r, offset: o } = dn(
|
|
2899
|
-
t += r,
|
|
2902
|
+
const { fold: r, offset: o } = dn(s, n);
|
|
2903
|
+
t += r, n = o;
|
|
2900
2904
|
} else if (i === "\\") {
|
|
2901
|
-
let r =
|
|
2905
|
+
let r = s[++n];
|
|
2902
2906
|
const o = pn[r];
|
|
2903
2907
|
if (o)
|
|
2904
2908
|
t += o;
|
|
2905
2909
|
else if (r === `
|
|
2906
2910
|
`)
|
|
2907
|
-
for (r = n
|
|
2908
|
-
r =
|
|
2909
|
-
else if (r === "\r" && n
|
|
2911
|
+
for (r = s[n + 1]; r === " " || r === " "; )
|
|
2912
|
+
r = s[++n + 1];
|
|
2913
|
+
else if (r === "\r" && s[n + 1] === `
|
|
2910
2914
|
`)
|
|
2911
|
-
for (r =
|
|
2912
|
-
r =
|
|
2915
|
+
for (r = s[++n + 1]; r === " " || r === " "; )
|
|
2916
|
+
r = s[++n + 1];
|
|
2913
2917
|
else if (r === "x" || r === "u" || r === "U") {
|
|
2914
2918
|
const l = r === "x" ? 2 : r === "u" ? 4 : 8;
|
|
2915
|
-
t += mn(
|
|
2919
|
+
t += mn(s, n + 1, l, e), n += l;
|
|
2916
2920
|
} else {
|
|
2917
|
-
const l =
|
|
2918
|
-
e(
|
|
2921
|
+
const l = s.substr(n - 1, 2);
|
|
2922
|
+
e(n - 1, "BAD_DQ_ESCAPE", `Invalid escape sequence ${l}`), t += l;
|
|
2919
2923
|
}
|
|
2920
2924
|
} else if (i === " " || i === " ") {
|
|
2921
|
-
const r =
|
|
2922
|
-
let o = n
|
|
2925
|
+
const r = n;
|
|
2926
|
+
let o = s[n + 1];
|
|
2923
2927
|
for (; o === " " || o === " "; )
|
|
2924
|
-
o =
|
|
2928
|
+
o = s[++n + 1];
|
|
2925
2929
|
o !== `
|
|
2926
|
-
` && !(o === "\r" && n
|
|
2927
|
-
`) && (t +=
|
|
2930
|
+
` && !(o === "\r" && s[n + 2] === `
|
|
2931
|
+
`) && (t += n > r ? s.slice(r, n + 1) : i);
|
|
2928
2932
|
} else
|
|
2929
2933
|
t += i;
|
|
2930
2934
|
}
|
|
2931
|
-
return (
|
|
2935
|
+
return (s[s.length - 1] !== '"' || s.length === 1) && e(s.length, "MISSING_CHAR", 'Missing closing "quote'), t;
|
|
2932
2936
|
}
|
|
2933
|
-
function dn(
|
|
2934
|
-
let t = "",
|
|
2935
|
-
for (; (
|
|
2936
|
-
` ||
|
|
2937
|
+
function dn(s, e) {
|
|
2938
|
+
let t = "", n = s[e + 1];
|
|
2939
|
+
for (; (n === " " || n === " " || n === `
|
|
2940
|
+
` || n === "\r") && !(n === "\r" && s[e + 2] !== `
|
|
2937
2941
|
`); )
|
|
2938
|
-
|
|
2942
|
+
n === `
|
|
2939
2943
|
` && (t += `
|
|
2940
|
-
`), e += 1,
|
|
2944
|
+
`), e += 1, n = s[e + 1];
|
|
2941
2945
|
return t || (t = " "), { fold: t, offset: e };
|
|
2942
2946
|
}
|
|
2943
2947
|
const pn = {
|
|
@@ -2974,34 +2978,34 @@ const pn = {
|
|
|
2974
2978
|
"\\": "\\",
|
|
2975
2979
|
" ": " "
|
|
2976
2980
|
};
|
|
2977
|
-
function mn(
|
|
2978
|
-
const i =
|
|
2981
|
+
function mn(s, e, t, n) {
|
|
2982
|
+
const i = s.substr(e, t), o = i.length === t && /^[0-9a-fA-F]+$/.test(i) ? parseInt(i, 16) : NaN;
|
|
2979
2983
|
try {
|
|
2980
2984
|
return String.fromCodePoint(o);
|
|
2981
2985
|
} catch {
|
|
2982
|
-
const l =
|
|
2983
|
-
return
|
|
2986
|
+
const l = s.substr(e - 2, t + 2);
|
|
2987
|
+
return n(e - 2, "BAD_DQ_ESCAPE", `Invalid escape sequence ${l}`), l;
|
|
2984
2988
|
}
|
|
2985
2989
|
}
|
|
2986
|
-
function as(
|
|
2987
|
-
const { value: i, type: r, comment: o, range: l } = e.type === "block-scalar" ? on(
|
|
2990
|
+
function as(s, e, t, n) {
|
|
2991
|
+
const { value: i, type: r, comment: o, range: l } = e.type === "block-scalar" ? on(s, e, n) : cn(e, s.options.strict, n), a = t ? s.directives.tagName(t.source, (f) => n(t, "TAG_RESOLVE_FAILED", f)) : null;
|
|
2988
2992
|
let c;
|
|
2989
|
-
|
|
2993
|
+
s.options.stringKeys && s.atKey ? c = s.schema[R] : a ? c = gn(s.schema, i, a, t, n) : e.type === "scalar" ? c = yn(s, i, e, n) : c = s.schema[R];
|
|
2990
2994
|
let d;
|
|
2991
2995
|
try {
|
|
2992
|
-
const f = c.resolve(i, (u) =>
|
|
2996
|
+
const f = c.resolve(i, (u) => n(t ?? e, "TAG_RESOLVE_FAILED", u), s.options);
|
|
2993
2997
|
d = I(f) ? f : new O(f);
|
|
2994
2998
|
} catch (f) {
|
|
2995
2999
|
const u = f instanceof Error ? f.message : String(f);
|
|
2996
|
-
|
|
3000
|
+
n(t ?? e, "TAG_RESOLVE_FAILED", u), d = new O(i);
|
|
2997
3001
|
}
|
|
2998
3002
|
return d.range = l, d.source = i, r && (d.type = r), a && (d.tag = a), c.format && (d.format = c.format), o && (d.comment = o), d;
|
|
2999
3003
|
}
|
|
3000
|
-
function gn(
|
|
3004
|
+
function gn(s, e, t, n, i) {
|
|
3001
3005
|
if (t === "!")
|
|
3002
|
-
return
|
|
3006
|
+
return s[R];
|
|
3003
3007
|
const r = [];
|
|
3004
|
-
for (const l of
|
|
3008
|
+
for (const l of s.tags)
|
|
3005
3009
|
if (!l.collection && l.tag === t)
|
|
3006
3010
|
if (l.default && l.test)
|
|
3007
3011
|
r.push(l);
|
|
@@ -3010,13 +3014,13 @@ function gn(n, e, t, s, i) {
|
|
|
3010
3014
|
for (const l of r)
|
|
3011
3015
|
if (l.test?.test(e))
|
|
3012
3016
|
return l;
|
|
3013
|
-
const o =
|
|
3014
|
-
return o && !o.collection ? (
|
|
3017
|
+
const o = s.knownTags[t];
|
|
3018
|
+
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]);
|
|
3015
3019
|
}
|
|
3016
|
-
function yn({ atKey:
|
|
3017
|
-
const o = t.tags.find((l) => (l.default === !0 ||
|
|
3020
|
+
function yn({ atKey: s, directives: e, schema: t }, n, i, r) {
|
|
3021
|
+
const o = t.tags.find((l) => (l.default === !0 || s && l.default === "key") && l.test?.test(n)) || t[R];
|
|
3018
3022
|
if (t.compat) {
|
|
3019
|
-
const l = t.compat.find((a) => a.default && a.test?.test(
|
|
3023
|
+
const l = t.compat.find((a) => a.default && a.test?.test(n)) ?? t[R];
|
|
3020
3024
|
if (o.tag !== l.tag) {
|
|
3021
3025
|
const a = e.tagString(o.tag), c = e.tagString(l.tag), d = `Value may be parsed as either ${a} or ${c}`;
|
|
3022
3026
|
r(i, "TAG_RESOLVE_FAILED", d, !0);
|
|
@@ -3024,79 +3028,79 @@ function yn({ atKey: n, directives: e, schema: t }, s, i, r) {
|
|
|
3024
3028
|
}
|
|
3025
3029
|
return o;
|
|
3026
3030
|
}
|
|
3027
|
-
function bn(
|
|
3031
|
+
function bn(s, e, t) {
|
|
3028
3032
|
if (e) {
|
|
3029
3033
|
t ?? (t = e.length);
|
|
3030
|
-
for (let
|
|
3031
|
-
let i = e[
|
|
3034
|
+
for (let n = t - 1; n >= 0; --n) {
|
|
3035
|
+
let i = e[n];
|
|
3032
3036
|
switch (i.type) {
|
|
3033
3037
|
case "space":
|
|
3034
3038
|
case "comment":
|
|
3035
3039
|
case "newline":
|
|
3036
|
-
|
|
3040
|
+
s -= i.source.length;
|
|
3037
3041
|
continue;
|
|
3038
3042
|
}
|
|
3039
|
-
for (i = e[++
|
|
3040
|
-
|
|
3043
|
+
for (i = e[++n]; i?.type === "space"; )
|
|
3044
|
+
s += i.source.length, i = e[++n];
|
|
3041
3045
|
break;
|
|
3042
3046
|
}
|
|
3043
3047
|
}
|
|
3044
|
-
return
|
|
3048
|
+
return s;
|
|
3045
3049
|
}
|
|
3046
3050
|
const wn = { composeNode: cs, composeEmptyNode: gt };
|
|
3047
|
-
function cs(
|
|
3048
|
-
const i =
|
|
3051
|
+
function cs(s, e, t, n) {
|
|
3052
|
+
const i = s.atKey, { spaceBefore: r, comment: o, anchor: l, tag: a } = t;
|
|
3049
3053
|
let c, d = !0;
|
|
3050
3054
|
switch (e.type) {
|
|
3051
3055
|
case "alias":
|
|
3052
|
-
c = kn(
|
|
3056
|
+
c = kn(s, e, n), (l || a) && n(e, "ALIAS_PROPS", "An alias node must not specify any properties");
|
|
3053
3057
|
break;
|
|
3054
3058
|
case "scalar":
|
|
3055
3059
|
case "single-quoted-scalar":
|
|
3056
3060
|
case "double-quoted-scalar":
|
|
3057
3061
|
case "block-scalar":
|
|
3058
|
-
c = as(
|
|
3062
|
+
c = as(s, e, a, n), l && (c.anchor = l.source.substring(1));
|
|
3059
3063
|
break;
|
|
3060
3064
|
case "block-map":
|
|
3061
3065
|
case "block-seq":
|
|
3062
3066
|
case "flow-collection":
|
|
3063
3067
|
try {
|
|
3064
|
-
c = rn(wn,
|
|
3068
|
+
c = rn(wn, s, e, t, n), l && (c.anchor = l.source.substring(1));
|
|
3065
3069
|
} catch (f) {
|
|
3066
3070
|
const u = f instanceof Error ? f.message : String(f);
|
|
3067
|
-
|
|
3071
|
+
n(e, "RESOURCE_EXHAUSTION", u);
|
|
3068
3072
|
}
|
|
3069
3073
|
break;
|
|
3070
3074
|
default: {
|
|
3071
3075
|
const f = e.type === "error" ? e.message : `Unsupported token (type: ${e.type})`;
|
|
3072
|
-
|
|
3076
|
+
n(e, "UNEXPECTED_TOKEN", f), d = !1;
|
|
3073
3077
|
}
|
|
3074
3078
|
}
|
|
3075
|
-
return c ?? (c = gt(
|
|
3079
|
+
return c ?? (c = gt(s, e.offset, void 0, null, t, n)), l && c.anchor === "" && n(l, "BAD_ALIAS", "Anchor cannot be an empty string"), i && s.options.stringKeys && (!I(c) || typeof c.value != "string" || c.tag && c.tag !== "tag:yaml.org,2002:str") && n(a ?? e, "NON_STRING_KEY", "With stringKeys, all keys must be strings"), r && (c.spaceBefore = !0), o && (e.type === "scalar" && e.source === "" ? c.comment = o : c.commentBefore = o), s.options.keepSourceTokens && d && (c.srcToken = e), c;
|
|
3076
3080
|
}
|
|
3077
|
-
function gt(
|
|
3081
|
+
function gt(s, e, t, n, { spaceBefore: i, comment: r, anchor: o, tag: l, end: a }, c) {
|
|
3078
3082
|
const d = {
|
|
3079
3083
|
type: "scalar",
|
|
3080
|
-
offset: bn(e, t,
|
|
3084
|
+
offset: bn(e, t, n),
|
|
3081
3085
|
indent: -1,
|
|
3082
3086
|
source: ""
|
|
3083
|
-
}, f = as(
|
|
3087
|
+
}, f = as(s, d, l, c);
|
|
3084
3088
|
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;
|
|
3085
3089
|
}
|
|
3086
|
-
function kn({ options:
|
|
3090
|
+
function kn({ options: s }, { offset: e, source: t, end: n }, i) {
|
|
3087
3091
|
const r = new it(t.substring(1));
|
|
3088
3092
|
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);
|
|
3089
|
-
const o = e + t.length, l = Se(
|
|
3093
|
+
const o = e + t.length, l = Se(n, o, s.strict, i);
|
|
3090
3094
|
return r.range = [e, o, l.offset], l.comment && (r.comment = l.comment), r;
|
|
3091
3095
|
}
|
|
3092
|
-
function Sn(
|
|
3093
|
-
const l = Object.assign({ _directives: e },
|
|
3096
|
+
function Sn(s, e, { offset: t, start: n, value: i, end: r }, o) {
|
|
3097
|
+
const l = Object.assign({ _directives: e }, s), a = new Fe(void 0, l), c = {
|
|
3094
3098
|
atKey: !1,
|
|
3095
3099
|
atRoot: !0,
|
|
3096
3100
|
directives: a.directives,
|
|
3097
3101
|
options: a.options,
|
|
3098
3102
|
schema: a.schema
|
|
3099
|
-
}, d = le(
|
|
3103
|
+
}, d = le(n, {
|
|
3100
3104
|
indicator: "doc-start",
|
|
3101
3105
|
next: i ?? r?.[0],
|
|
3102
3106
|
offset: t,
|
|
@@ -3104,64 +3108,64 @@ function Sn(n, e, { offset: t, start: s, value: i, end: r }, o) {
|
|
|
3104
3108
|
parentIndent: 0,
|
|
3105
3109
|
startOnNewline: !0
|
|
3106
3110
|
});
|
|
3107
|
-
d.found && (a.directives.docStart = !0, i && (i.type === "block-map" || i.type === "block-seq") && !d.hasNewline && o(d.end, "MISSING_CHAR", "Block collection cannot start on same line with directives-end marker")), a.contents = i ? cs(c, i, d, o) : gt(c, d.end,
|
|
3111
|
+
d.found && (a.directives.docStart = !0, i && (i.type === "block-map" || i.type === "block-seq") && !d.hasNewline && o(d.end, "MISSING_CHAR", "Block collection cannot start on same line with directives-end marker")), a.contents = i ? cs(c, i, d, o) : gt(c, d.end, n, null, d, o);
|
|
3108
3112
|
const f = a.contents.range[2], u = Se(r, f, !1, o);
|
|
3109
3113
|
return u.comment && (a.comment = u.comment), a.range = [t, f, u.offset], a;
|
|
3110
3114
|
}
|
|
3111
|
-
function de(
|
|
3112
|
-
if (typeof
|
|
3113
|
-
return [
|
|
3114
|
-
if (Array.isArray(
|
|
3115
|
-
return
|
|
3116
|
-
const { offset: e, source: t } =
|
|
3115
|
+
function de(s) {
|
|
3116
|
+
if (typeof s == "number")
|
|
3117
|
+
return [s, s + 1];
|
|
3118
|
+
if (Array.isArray(s))
|
|
3119
|
+
return s.length === 2 ? s : [s[0], s[1]];
|
|
3120
|
+
const { offset: e, source: t } = s;
|
|
3117
3121
|
return [e, e + (typeof t == "string" ? t.length : 1)];
|
|
3118
3122
|
}
|
|
3119
|
-
function It(
|
|
3120
|
-
let e = "", t = !1,
|
|
3121
|
-
for (let i = 0; i <
|
|
3122
|
-
const r =
|
|
3123
|
+
function It(s) {
|
|
3124
|
+
let e = "", t = !1, n = !1;
|
|
3125
|
+
for (let i = 0; i < s.length; ++i) {
|
|
3126
|
+
const r = s[i];
|
|
3123
3127
|
switch (r[0]) {
|
|
3124
3128
|
case "#":
|
|
3125
|
-
e += (e === "" ? "" :
|
|
3129
|
+
e += (e === "" ? "" : n ? `
|
|
3126
3130
|
|
|
3127
3131
|
` : `
|
|
3128
|
-
`) + (r.substring(1) || " "), t = !0,
|
|
3132
|
+
`) + (r.substring(1) || " "), t = !0, n = !1;
|
|
3129
3133
|
break;
|
|
3130
3134
|
case "%":
|
|
3131
|
-
|
|
3135
|
+
s[i + 1]?.[0] !== "#" && (i += 1), t = !1;
|
|
3132
3136
|
break;
|
|
3133
3137
|
default:
|
|
3134
|
-
t || (
|
|
3138
|
+
t || (n = !0), t = !1;
|
|
3135
3139
|
}
|
|
3136
3140
|
}
|
|
3137
|
-
return { comment: e, afterEmptyLine:
|
|
3141
|
+
return { comment: e, afterEmptyLine: n };
|
|
3138
3142
|
}
|
|
3139
3143
|
class Nn {
|
|
3140
3144
|
constructor(e = {}) {
|
|
3141
|
-
this.doc = null, this.atDirectives = !1, this.prelude = [], this.errors = [], this.warnings = [], this.onError = (t,
|
|
3145
|
+
this.doc = null, this.atDirectives = !1, this.prelude = [], this.errors = [], this.warnings = [], this.onError = (t, n, i, r) => {
|
|
3142
3146
|
const o = de(t);
|
|
3143
|
-
r ? this.warnings.push(new en(o,
|
|
3147
|
+
r ? this.warnings.push(new en(o, n, i)) : this.errors.push(new me(o, n, i));
|
|
3144
3148
|
}, this.directives = new _({ version: e.version || "1.2" }), this.options = e;
|
|
3145
3149
|
}
|
|
3146
3150
|
decorate(e, t) {
|
|
3147
|
-
const { comment:
|
|
3148
|
-
if (
|
|
3151
|
+
const { comment: n, afterEmptyLine: i } = It(this.prelude);
|
|
3152
|
+
if (n) {
|
|
3149
3153
|
const r = e.contents;
|
|
3150
3154
|
if (t)
|
|
3151
3155
|
e.comment = e.comment ? `${e.comment}
|
|
3152
|
-
${
|
|
3156
|
+
${n}` : n;
|
|
3153
3157
|
else if (i || e.directives.docStart || !r)
|
|
3154
|
-
e.commentBefore =
|
|
3158
|
+
e.commentBefore = n;
|
|
3155
3159
|
else if (C(r) && !r.flow && r.items.length > 0) {
|
|
3156
3160
|
let o = r.items[0];
|
|
3157
3161
|
E(o) && (o = o.key);
|
|
3158
3162
|
const l = o.commentBefore;
|
|
3159
|
-
o.commentBefore = l ? `${
|
|
3160
|
-
${l}` :
|
|
3163
|
+
o.commentBefore = l ? `${n}
|
|
3164
|
+
${l}` : n;
|
|
3161
3165
|
} else {
|
|
3162
3166
|
const o = r.commentBefore;
|
|
3163
|
-
r.commentBefore = o ? `${
|
|
3164
|
-
${o}` :
|
|
3167
|
+
r.commentBefore = o ? `${n}
|
|
3168
|
+
${o}` : n;
|
|
3165
3169
|
}
|
|
3166
3170
|
}
|
|
3167
3171
|
if (t) {
|
|
@@ -3192,18 +3196,18 @@ ${o}` : s;
|
|
|
3192
3196
|
* @param forceDoc - If the stream contains no document, still emit a final document including any comments and directives that would be applied to a subsequent document.
|
|
3193
3197
|
* @param endOffset - Should be set if `forceDoc` is also set, to set the document range end and to indicate errors correctly.
|
|
3194
3198
|
*/
|
|
3195
|
-
*compose(e, t = !1,
|
|
3199
|
+
*compose(e, t = !1, n = -1) {
|
|
3196
3200
|
for (const i of e)
|
|
3197
3201
|
yield* this.next(i);
|
|
3198
|
-
yield* this.end(t,
|
|
3202
|
+
yield* this.end(t, n);
|
|
3199
3203
|
}
|
|
3200
3204
|
/** Advance the composer by one CST token. */
|
|
3201
3205
|
*next(e) {
|
|
3202
3206
|
switch (e.type) {
|
|
3203
3207
|
case "directive":
|
|
3204
|
-
this.directives.add(e.source, (t,
|
|
3208
|
+
this.directives.add(e.source, (t, n, i) => {
|
|
3205
3209
|
const r = de(e);
|
|
3206
|
-
r[0] += t, this.onError(r, "BAD_DIRECTIVE",
|
|
3210
|
+
r[0] += t, this.onError(r, "BAD_DIRECTIVE", n, i);
|
|
3207
3211
|
}), this.prelude.push(e.source), this.atDirectives = !0;
|
|
3208
3212
|
break;
|
|
3209
3213
|
case "document": {
|
|
@@ -3219,21 +3223,21 @@ ${o}` : s;
|
|
|
3219
3223
|
this.prelude.push(e.source);
|
|
3220
3224
|
break;
|
|
3221
3225
|
case "error": {
|
|
3222
|
-
const t = e.source ? `${e.message}: ${JSON.stringify(e.source)}` : e.message,
|
|
3223
|
-
this.atDirectives || !this.doc ? this.errors.push(
|
|
3226
|
+
const t = e.source ? `${e.message}: ${JSON.stringify(e.source)}` : e.message, n = new me(de(e), "UNEXPECTED_TOKEN", t);
|
|
3227
|
+
this.atDirectives || !this.doc ? this.errors.push(n) : this.doc.errors.push(n);
|
|
3224
3228
|
break;
|
|
3225
3229
|
}
|
|
3226
3230
|
case "doc-end": {
|
|
3227
3231
|
if (!this.doc) {
|
|
3228
|
-
const
|
|
3229
|
-
this.errors.push(new me(de(e), "UNEXPECTED_TOKEN",
|
|
3232
|
+
const n = "Unexpected doc-end without preceding document";
|
|
3233
|
+
this.errors.push(new me(de(e), "UNEXPECTED_TOKEN", n));
|
|
3230
3234
|
break;
|
|
3231
3235
|
}
|
|
3232
3236
|
this.doc.directives.docEnd = !0;
|
|
3233
3237
|
const t = Se(e.end, e.offset + e.source.length, this.doc.options.strict, this.onError);
|
|
3234
3238
|
if (this.decorate(this.doc, !0), t.comment) {
|
|
3235
|
-
const
|
|
3236
|
-
this.doc.comment =
|
|
3239
|
+
const n = this.doc.comment;
|
|
3240
|
+
this.doc.comment = n ? `${n}
|
|
3237
3241
|
${t.comment}` : t.comment;
|
|
3238
3242
|
}
|
|
3239
3243
|
this.doc.range[2] = t.offset;
|
|
@@ -3253,14 +3257,14 @@ ${t.comment}` : t.comment;
|
|
|
3253
3257
|
if (this.doc)
|
|
3254
3258
|
this.decorate(this.doc, !0), yield this.doc, this.doc = null;
|
|
3255
3259
|
else if (e) {
|
|
3256
|
-
const
|
|
3260
|
+
const n = Object.assign({ _directives: this.directives }, this.options), i = new Fe(void 0, n);
|
|
3257
3261
|
this.atDirectives && this.onError(t, "MISSING_CHAR", "Missing directives-end indicator line"), i.range = [0, t, t], this.decorate(i, !1), yield i;
|
|
3258
3262
|
}
|
|
3259
3263
|
}
|
|
3260
3264
|
}
|
|
3261
3265
|
const fs = "\uFEFF", us = "", hs = "", et = "";
|
|
3262
|
-
function On(
|
|
3263
|
-
switch (
|
|
3266
|
+
function On(s) {
|
|
3267
|
+
switch (s) {
|
|
3264
3268
|
case fs:
|
|
3265
3269
|
return "byte-order-mark";
|
|
3266
3270
|
case us:
|
|
@@ -3296,7 +3300,7 @@ function On(n) {
|
|
|
3296
3300
|
case ",":
|
|
3297
3301
|
return "comma";
|
|
3298
3302
|
}
|
|
3299
|
-
switch (
|
|
3303
|
+
switch (s[0]) {
|
|
3300
3304
|
case " ":
|
|
3301
3305
|
case " ":
|
|
3302
3306
|
return "space";
|
|
@@ -3320,8 +3324,8 @@ function On(n) {
|
|
|
3320
3324
|
}
|
|
3321
3325
|
return null;
|
|
3322
3326
|
}
|
|
3323
|
-
function D(
|
|
3324
|
-
switch (
|
|
3327
|
+
function D(s) {
|
|
3328
|
+
switch (s) {
|
|
3325
3329
|
case void 0:
|
|
3326
3330
|
case " ":
|
|
3327
3331
|
case `
|
|
@@ -3334,7 +3338,7 @@ function D(n) {
|
|
|
3334
3338
|
}
|
|
3335
3339
|
}
|
|
3336
3340
|
const Tt = new Set("0123456789ABCDEFabcdef"), An = new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"), Le = new Set(",[]{}"), Ln = new Set(` ,[]{}
|
|
3337
|
-
\r `), We = (
|
|
3341
|
+
\r `), We = (s) => !s || Ln.has(s);
|
|
3338
3342
|
class In {
|
|
3339
3343
|
constructor() {
|
|
3340
3344
|
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;
|
|
@@ -3352,9 +3356,9 @@ class In {
|
|
|
3352
3356
|
this.buffer = this.buffer ? this.buffer + e : e, this.lineEndPos = null;
|
|
3353
3357
|
}
|
|
3354
3358
|
this.atEnd = !t;
|
|
3355
|
-
let
|
|
3356
|
-
for (;
|
|
3357
|
-
|
|
3359
|
+
let n = this.next ?? "stream";
|
|
3360
|
+
for (; n && (t || this.hasChars(1)); )
|
|
3361
|
+
n = yield* this.parseNext(n);
|
|
3358
3362
|
}
|
|
3359
3363
|
atLineEnd() {
|
|
3360
3364
|
let e = this.pos, t = this.buffer[e];
|
|
@@ -3370,21 +3374,21 @@ class In {
|
|
|
3370
3374
|
continueScalar(e) {
|
|
3371
3375
|
let t = this.buffer[e];
|
|
3372
3376
|
if (this.indentNext > 0) {
|
|
3373
|
-
let
|
|
3377
|
+
let n = 0;
|
|
3374
3378
|
for (; t === " "; )
|
|
3375
|
-
t = this.buffer[++
|
|
3379
|
+
t = this.buffer[++n + e];
|
|
3376
3380
|
if (t === "\r") {
|
|
3377
|
-
const i = this.buffer[
|
|
3381
|
+
const i = this.buffer[n + e + 1];
|
|
3378
3382
|
if (i === `
|
|
3379
3383
|
` || !i && !this.atEnd)
|
|
3380
|
-
return e +
|
|
3384
|
+
return e + n + 1;
|
|
3381
3385
|
}
|
|
3382
3386
|
return t === `
|
|
3383
|
-
` ||
|
|
3387
|
+
` || n >= this.indentNext || !t && !this.atEnd ? e + n : -1;
|
|
3384
3388
|
}
|
|
3385
3389
|
if (t === "-" || t === ".") {
|
|
3386
|
-
const
|
|
3387
|
-
if ((
|
|
3390
|
+
const n = this.buffer.substr(e, 3);
|
|
3391
|
+
if ((n === "---" || n === "...") && D(this.buffer[e + 3]))
|
|
3388
3392
|
return -1;
|
|
3389
3393
|
}
|
|
3390
3394
|
return e;
|
|
@@ -3428,14 +3432,14 @@ class In {
|
|
|
3428
3432
|
if (e === null)
|
|
3429
3433
|
return this.setNext("stream");
|
|
3430
3434
|
if (e[0] === fs && (yield* this.pushCount(1), e = e.substring(1)), e[0] === "%") {
|
|
3431
|
-
let t = e.length,
|
|
3432
|
-
for (;
|
|
3433
|
-
const r = e[
|
|
3435
|
+
let t = e.length, n = e.indexOf("#");
|
|
3436
|
+
for (; n !== -1; ) {
|
|
3437
|
+
const r = e[n - 1];
|
|
3434
3438
|
if (r === " " || r === " ") {
|
|
3435
|
-
t =
|
|
3439
|
+
t = n - 1;
|
|
3436
3440
|
break;
|
|
3437
3441
|
} else
|
|
3438
|
-
|
|
3442
|
+
n = e.indexOf("#", n + 1);
|
|
3439
3443
|
}
|
|
3440
3444
|
for (; ; ) {
|
|
3441
3445
|
const r = e[t - 1];
|
|
@@ -3471,8 +3475,8 @@ class In {
|
|
|
3471
3475
|
if (!t && !this.atEnd)
|
|
3472
3476
|
return this.setNext("block-start");
|
|
3473
3477
|
if ((e === "-" || e === "?" || e === ":") && D(t)) {
|
|
3474
|
-
const
|
|
3475
|
-
return this.indentNext = this.indentValue + 1, this.indentValue +=
|
|
3478
|
+
const n = (yield* this.pushCount(1)) + (yield* this.pushSpaces(!0));
|
|
3479
|
+
return this.indentNext = this.indentValue + 1, this.indentValue += n, "block-start";
|
|
3476
3480
|
}
|
|
3477
3481
|
return "doc";
|
|
3478
3482
|
}
|
|
@@ -3507,14 +3511,14 @@ class In {
|
|
|
3507
3511
|
}
|
|
3508
3512
|
}
|
|
3509
3513
|
*parseFlowCollection() {
|
|
3510
|
-
let e, t,
|
|
3514
|
+
let e, t, n = -1;
|
|
3511
3515
|
do
|
|
3512
|
-
e = yield* this.pushNewline(), e > 0 ? (t = yield* this.pushSpaces(!1), this.indentValue =
|
|
3516
|
+
e = yield* this.pushNewline(), e > 0 ? (t = yield* this.pushSpaces(!1), this.indentValue = n = t) : t = 0, t += yield* this.pushSpaces(!0);
|
|
3513
3517
|
while (e + t > 0);
|
|
3514
3518
|
const i = this.getLine();
|
|
3515
3519
|
if (i === null)
|
|
3516
3520
|
return this.setNext("flow");
|
|
3517
|
-
if ((
|
|
3521
|
+
if ((n !== -1 && n < this.indentNext && i[0] !== "#" || n === 0 && (i.startsWith("---") || i.startsWith("...")) && D(i[3])) && !(n === this.indentNext - 1 && this.flowLevel === 1 && (i[0] === "]" || i[0] === "}")))
|
|
3518
3522
|
return this.flowLevel = 0, yield hs, yield* this.parseLineStart();
|
|
3519
3523
|
let r = 0;
|
|
3520
3524
|
for (; i[r] === ","; )
|
|
@@ -3560,18 +3564,18 @@ class In {
|
|
|
3560
3564
|
break;
|
|
3561
3565
|
t = this.buffer.indexOf('"', t + 1);
|
|
3562
3566
|
}
|
|
3563
|
-
const
|
|
3564
|
-
let i =
|
|
3567
|
+
const n = this.buffer.substring(0, t);
|
|
3568
|
+
let i = n.indexOf(`
|
|
3565
3569
|
`, this.pos);
|
|
3566
3570
|
if (i !== -1) {
|
|
3567
3571
|
for (; i !== -1; ) {
|
|
3568
3572
|
const r = this.continueScalar(i + 1);
|
|
3569
3573
|
if (r === -1)
|
|
3570
3574
|
break;
|
|
3571
|
-
i =
|
|
3575
|
+
i = n.indexOf(`
|
|
3572
3576
|
`, r);
|
|
3573
3577
|
}
|
|
3574
|
-
i !== -1 && (t = i - (
|
|
3578
|
+
i !== -1 && (t = i - (n[i - 1] === "\r" ? 2 : 1));
|
|
3575
3579
|
}
|
|
3576
3580
|
if (t === -1) {
|
|
3577
3581
|
if (!this.atEnd)
|
|
@@ -3595,9 +3599,9 @@ class In {
|
|
|
3595
3599
|
return yield* this.pushUntil((t) => D(t) || t === "#");
|
|
3596
3600
|
}
|
|
3597
3601
|
*parseBlockScalar() {
|
|
3598
|
-
let e = this.pos - 1, t = 0,
|
|
3599
|
-
e: for (let r = this.pos;
|
|
3600
|
-
switch (
|
|
3602
|
+
let e = this.pos - 1, t = 0, n;
|
|
3603
|
+
e: for (let r = this.pos; n = this.buffer[r]; ++r)
|
|
3604
|
+
switch (n) {
|
|
3601
3605
|
case " ":
|
|
3602
3606
|
t += 1;
|
|
3603
3607
|
break;
|
|
@@ -3617,7 +3621,7 @@ class In {
|
|
|
3617
3621
|
default:
|
|
3618
3622
|
break e;
|
|
3619
3623
|
}
|
|
3620
|
-
if (!
|
|
3624
|
+
if (!n && !this.atEnd)
|
|
3621
3625
|
return this.setNext("block-scalar");
|
|
3622
3626
|
if (t >= this.indentNext) {
|
|
3623
3627
|
this.blockScalarIndent === -1 ? this.indentNext = t : this.indentNext = this.blockScalarIndent + (this.indentNext === 0 ? 1 : this.indentNext);
|
|
@@ -3635,12 +3639,12 @@ class In {
|
|
|
3635
3639
|
}
|
|
3636
3640
|
}
|
|
3637
3641
|
let i = e + 1;
|
|
3638
|
-
for (
|
|
3639
|
-
|
|
3640
|
-
if (
|
|
3641
|
-
for (;
|
|
3642
|
+
for (n = this.buffer[i]; n === " "; )
|
|
3643
|
+
n = this.buffer[++i];
|
|
3644
|
+
if (n === " ") {
|
|
3645
|
+
for (; n === " " || n === " " || n === "\r" || n === `
|
|
3642
3646
|
`; )
|
|
3643
|
-
|
|
3647
|
+
n = this.buffer[++i];
|
|
3644
3648
|
e = i - 1;
|
|
3645
3649
|
} else if (!this.blockScalarKeep)
|
|
3646
3650
|
do {
|
|
@@ -3659,30 +3663,30 @@ class In {
|
|
|
3659
3663
|
}
|
|
3660
3664
|
*parsePlainScalar() {
|
|
3661
3665
|
const e = this.flowLevel > 0;
|
|
3662
|
-
let t = this.pos - 1,
|
|
3663
|
-
for (; i = this.buffer[++
|
|
3666
|
+
let t = this.pos - 1, n = this.pos - 1, i;
|
|
3667
|
+
for (; i = this.buffer[++n]; )
|
|
3664
3668
|
if (i === ":") {
|
|
3665
|
-
const r = this.buffer[
|
|
3669
|
+
const r = this.buffer[n + 1];
|
|
3666
3670
|
if (D(r) || e && Le.has(r))
|
|
3667
3671
|
break;
|
|
3668
|
-
t =
|
|
3672
|
+
t = n;
|
|
3669
3673
|
} else if (D(i)) {
|
|
3670
|
-
let r = this.buffer[
|
|
3674
|
+
let r = this.buffer[n + 1];
|
|
3671
3675
|
if (i === "\r" && (r === `
|
|
3672
|
-
` ? (
|
|
3673
|
-
`, r = this.buffer[
|
|
3676
|
+
` ? (n += 1, i = `
|
|
3677
|
+
`, r = this.buffer[n + 1]) : t = n), r === "#" || e && Le.has(r))
|
|
3674
3678
|
break;
|
|
3675
3679
|
if (i === `
|
|
3676
3680
|
`) {
|
|
3677
|
-
const o = this.continueScalar(
|
|
3681
|
+
const o = this.continueScalar(n + 1);
|
|
3678
3682
|
if (o === -1)
|
|
3679
3683
|
break;
|
|
3680
|
-
|
|
3684
|
+
n = Math.max(n, o - 2);
|
|
3681
3685
|
}
|
|
3682
3686
|
} else {
|
|
3683
3687
|
if (e && Le.has(i))
|
|
3684
3688
|
break;
|
|
3685
|
-
t =
|
|
3689
|
+
t = n;
|
|
3686
3690
|
}
|
|
3687
3691
|
return !i && !this.atEnd ? this.setNext("plain-scalar") : (yield et, yield* this.pushToIndex(t + 1, !0), e ? "flow" : "doc");
|
|
3688
3692
|
}
|
|
@@ -3690,8 +3694,8 @@ class In {
|
|
|
3690
3694
|
return e > 0 ? (yield this.buffer.substr(this.pos, e), this.pos += e, e) : 0;
|
|
3691
3695
|
}
|
|
3692
3696
|
*pushToIndex(e, t) {
|
|
3693
|
-
const
|
|
3694
|
-
return
|
|
3697
|
+
const n = this.buffer.slice(this.pos, e);
|
|
3698
|
+
return n ? (yield n, this.pos += n.length, n.length) : (t && (yield ""), 0);
|
|
3695
3699
|
}
|
|
3696
3700
|
*pushIndicators() {
|
|
3697
3701
|
let e = 0;
|
|
@@ -3708,8 +3712,8 @@ class In {
|
|
|
3708
3712
|
case "?":
|
|
3709
3713
|
// this is an error outside flow collections
|
|
3710
3714
|
case ":": {
|
|
3711
|
-
const t = this.flowLevel > 0,
|
|
3712
|
-
if (D(
|
|
3715
|
+
const t = this.flowLevel > 0, n = this.charAt(1);
|
|
3716
|
+
if (D(n) || t && Le.has(n)) {
|
|
3713
3717
|
t ? this.flowKey && (this.flowKey = !1) : this.indentNext = this.indentValue + 1, e += yield* this.pushCount(1), e += yield* this.pushSpaces(!0);
|
|
3714
3718
|
continue e;
|
|
3715
3719
|
}
|
|
@@ -3744,27 +3748,27 @@ class In {
|
|
|
3744
3748
|
` ? yield* this.pushCount(2) : 0;
|
|
3745
3749
|
}
|
|
3746
3750
|
*pushSpaces(e) {
|
|
3747
|
-
let t = this.pos - 1,
|
|
3751
|
+
let t = this.pos - 1, n;
|
|
3748
3752
|
do
|
|
3749
|
-
|
|
3750
|
-
while (
|
|
3753
|
+
n = this.buffer[++t];
|
|
3754
|
+
while (n === " " || e && n === " ");
|
|
3751
3755
|
const i = t - this.pos;
|
|
3752
3756
|
return i > 0 && (yield this.buffer.substr(this.pos, i), this.pos = t), i;
|
|
3753
3757
|
}
|
|
3754
3758
|
*pushUntil(e) {
|
|
3755
|
-
let t = this.pos,
|
|
3756
|
-
for (; !e(
|
|
3757
|
-
|
|
3759
|
+
let t = this.pos, n = this.buffer[t];
|
|
3760
|
+
for (; !e(n); )
|
|
3761
|
+
n = this.buffer[++t];
|
|
3758
3762
|
return yield* this.pushToIndex(t, !1);
|
|
3759
3763
|
}
|
|
3760
3764
|
}
|
|
3761
3765
|
class Tn {
|
|
3762
3766
|
constructor() {
|
|
3763
3767
|
this.lineStarts = [], this.addNewLine = (e) => this.lineStarts.push(e), this.linePos = (e) => {
|
|
3764
|
-
let t = 0,
|
|
3765
|
-
for (; t <
|
|
3766
|
-
const r = t +
|
|
3767
|
-
this.lineStarts[r] < e ? t = r + 1 :
|
|
3768
|
+
let t = 0, n = this.lineStarts.length;
|
|
3769
|
+
for (; t < n; ) {
|
|
3770
|
+
const r = t + n >> 1;
|
|
3771
|
+
this.lineStarts[r] < e ? t = r + 1 : n = r;
|
|
3768
3772
|
}
|
|
3769
3773
|
if (this.lineStarts[t] === e)
|
|
3770
3774
|
return { line: t + 1, col: 1 };
|
|
@@ -3775,15 +3779,15 @@ class Tn {
|
|
|
3775
3779
|
};
|
|
3776
3780
|
}
|
|
3777
3781
|
}
|
|
3778
|
-
function Y(
|
|
3779
|
-
for (let t = 0; t <
|
|
3780
|
-
if (
|
|
3782
|
+
function Y(s, e) {
|
|
3783
|
+
for (let t = 0; t < s.length; ++t)
|
|
3784
|
+
if (s[t].type === e)
|
|
3781
3785
|
return !0;
|
|
3782
3786
|
return !1;
|
|
3783
3787
|
}
|
|
3784
|
-
function Et(
|
|
3785
|
-
for (let e = 0; e <
|
|
3786
|
-
switch (
|
|
3788
|
+
function Et(s) {
|
|
3789
|
+
for (let e = 0; e < s.length; ++e)
|
|
3790
|
+
switch (s[e].type) {
|
|
3787
3791
|
case "space":
|
|
3788
3792
|
case "comment":
|
|
3789
3793
|
case "newline":
|
|
@@ -3793,8 +3797,8 @@ function Et(n) {
|
|
|
3793
3797
|
}
|
|
3794
3798
|
return -1;
|
|
3795
3799
|
}
|
|
3796
|
-
function ds(
|
|
3797
|
-
switch (
|
|
3800
|
+
function ds(s) {
|
|
3801
|
+
switch (s?.type) {
|
|
3798
3802
|
case "alias":
|
|
3799
3803
|
case "scalar":
|
|
3800
3804
|
case "single-quoted-scalar":
|
|
@@ -3805,27 +3809,27 @@ function ds(n) {
|
|
|
3805
3809
|
return !1;
|
|
3806
3810
|
}
|
|
3807
3811
|
}
|
|
3808
|
-
function Ie(
|
|
3809
|
-
switch (
|
|
3812
|
+
function Ie(s) {
|
|
3813
|
+
switch (s.type) {
|
|
3810
3814
|
case "document":
|
|
3811
|
-
return
|
|
3815
|
+
return s.start;
|
|
3812
3816
|
case "block-map": {
|
|
3813
|
-
const e =
|
|
3817
|
+
const e = s.items[s.items.length - 1];
|
|
3814
3818
|
return e.sep ?? e.start;
|
|
3815
3819
|
}
|
|
3816
3820
|
case "block-seq":
|
|
3817
|
-
return
|
|
3821
|
+
return s.items[s.items.length - 1].start;
|
|
3818
3822
|
/* istanbul ignore next should not happen */
|
|
3819
3823
|
default:
|
|
3820
3824
|
return [];
|
|
3821
3825
|
}
|
|
3822
3826
|
}
|
|
3823
|
-
function ee(
|
|
3824
|
-
if (
|
|
3827
|
+
function ee(s) {
|
|
3828
|
+
if (s.length === 0)
|
|
3825
3829
|
return [];
|
|
3826
|
-
let e =
|
|
3830
|
+
let e = s.length;
|
|
3827
3831
|
e: for (; --e >= 0; )
|
|
3828
|
-
switch (
|
|
3832
|
+
switch (s[e].type) {
|
|
3829
3833
|
case "doc-start":
|
|
3830
3834
|
case "explicit-key-ind":
|
|
3831
3835
|
case "map-value-ind":
|
|
@@ -3833,20 +3837,20 @@ function ee(n) {
|
|
|
3833
3837
|
case "newline":
|
|
3834
3838
|
break e;
|
|
3835
3839
|
}
|
|
3836
|
-
for (;
|
|
3840
|
+
for (; s[++e]?.type === "space"; )
|
|
3837
3841
|
;
|
|
3838
|
-
return
|
|
3842
|
+
return s.splice(e, s.length);
|
|
3839
3843
|
}
|
|
3840
|
-
function _e(
|
|
3844
|
+
function _e(s, e) {
|
|
3841
3845
|
if (e.length < 1e5)
|
|
3842
|
-
Array.prototype.push.apply(
|
|
3846
|
+
Array.prototype.push.apply(s, e);
|
|
3843
3847
|
else
|
|
3844
3848
|
for (let t = 0; t < e.length; ++t)
|
|
3845
|
-
|
|
3849
|
+
s.push(e[t]);
|
|
3846
3850
|
}
|
|
3847
|
-
function Ct(
|
|
3848
|
-
if (
|
|
3849
|
-
for (const e of
|
|
3851
|
+
function Ct(s) {
|
|
3852
|
+
if (s.start.type === "flow-seq-start")
|
|
3853
|
+
for (const e of s.items)
|
|
3850
3854
|
e.sep && !e.value && !Y(e.start, "explicit-key-ind") && !Y(e.sep, "map-value-ind") && (e.key && (e.value = e.key), delete e.key, ds(e.value) ? e.value.end ? _e(e.value.end, e.sep) : e.value.end = e.sep : _e(e.start, e.sep), delete e.sep);
|
|
3851
3855
|
}
|
|
3852
3856
|
class En {
|
|
@@ -3867,8 +3871,8 @@ class En {
|
|
|
3867
3871
|
*/
|
|
3868
3872
|
*parse(e, t = !1) {
|
|
3869
3873
|
this.onNewLine && this.offset === 0 && this.onNewLine(0);
|
|
3870
|
-
for (const
|
|
3871
|
-
yield* this.next(
|
|
3874
|
+
for (const n of this.lexer.lex(e, t))
|
|
3875
|
+
yield* this.next(n);
|
|
3872
3876
|
t || (yield* this.end());
|
|
3873
3877
|
}
|
|
3874
3878
|
/**
|
|
@@ -3905,8 +3909,8 @@ class En {
|
|
|
3905
3909
|
this.offset += e.length;
|
|
3906
3910
|
}
|
|
3907
3911
|
else {
|
|
3908
|
-
const
|
|
3909
|
-
yield* this.pop({ type: "error", offset: this.offset, message:
|
|
3912
|
+
const n = `Not a YAML token: ${e}`;
|
|
3913
|
+
yield* this.pop({ type: "error", offset: this.offset, message: n, source: e }), this.offset += e.length;
|
|
3910
3914
|
}
|
|
3911
3915
|
}
|
|
3912
3916
|
/** Call at end of input to push out any remaining constructions */
|
|
@@ -3967,18 +3971,18 @@ class En {
|
|
|
3967
3971
|
else if (this.stack.length === 0)
|
|
3968
3972
|
yield t;
|
|
3969
3973
|
else {
|
|
3970
|
-
const
|
|
3971
|
-
switch (t.type === "block-scalar" ? t.indent = "indent" in
|
|
3974
|
+
const n = this.peek(1);
|
|
3975
|
+
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" && Ct(t), n.type) {
|
|
3972
3976
|
case "document":
|
|
3973
|
-
|
|
3977
|
+
n.value = t;
|
|
3974
3978
|
break;
|
|
3975
3979
|
case "block-scalar":
|
|
3976
|
-
|
|
3980
|
+
n.props.push(t);
|
|
3977
3981
|
break;
|
|
3978
3982
|
case "block-map": {
|
|
3979
|
-
const i =
|
|
3983
|
+
const i = n.items[n.items.length - 1];
|
|
3980
3984
|
if (i.value) {
|
|
3981
|
-
|
|
3985
|
+
n.items.push({ start: [], key: t, sep: [] }), this.onKeyLine = !0;
|
|
3982
3986
|
return;
|
|
3983
3987
|
} else if (i.sep)
|
|
3984
3988
|
i.value = t;
|
|
@@ -3989,22 +3993,22 @@ class En {
|
|
|
3989
3993
|
break;
|
|
3990
3994
|
}
|
|
3991
3995
|
case "block-seq": {
|
|
3992
|
-
const i =
|
|
3993
|
-
i.value ?
|
|
3996
|
+
const i = n.items[n.items.length - 1];
|
|
3997
|
+
i.value ? n.items.push({ start: [], value: t }) : i.value = t;
|
|
3994
3998
|
break;
|
|
3995
3999
|
}
|
|
3996
4000
|
case "flow-collection": {
|
|
3997
|
-
const i =
|
|
3998
|
-
!i || i.value ?
|
|
4001
|
+
const i = n.items[n.items.length - 1];
|
|
4002
|
+
!i || i.value ? n.items.push({ start: [], key: t, sep: [] }) : i.sep ? i.value = t : Object.assign(i, { key: t, sep: [] });
|
|
3999
4003
|
return;
|
|
4000
4004
|
}
|
|
4001
4005
|
/* istanbul ignore next should not happen */
|
|
4002
4006
|
default:
|
|
4003
4007
|
yield* this.pop(), yield* this.pop(t);
|
|
4004
4008
|
}
|
|
4005
|
-
if ((
|
|
4009
|
+
if ((n.type === "document" || n.type === "block-map" || n.type === "block-seq") && (t.type === "block-map" || t.type === "block-seq")) {
|
|
4006
4010
|
const i = t.items[t.items.length - 1];
|
|
4007
|
-
i && !i.sep && !i.value && i.start.length > 0 && Et(i.start) === -1 && (t.indent === 0 || i.start.every((r) => r.type !== "comment" || r.indent < t.indent)) && (
|
|
4011
|
+
i && !i.sep && !i.value && i.start.length > 0 && Et(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));
|
|
4008
4012
|
}
|
|
4009
4013
|
}
|
|
4010
4014
|
}
|
|
@@ -4063,14 +4067,14 @@ class En {
|
|
|
4063
4067
|
}
|
|
4064
4068
|
*scalar(e) {
|
|
4065
4069
|
if (this.type === "map-value-ind") {
|
|
4066
|
-
const t = Ie(this.peek(2)),
|
|
4070
|
+
const t = Ie(this.peek(2)), n = ee(t);
|
|
4067
4071
|
let i;
|
|
4068
4072
|
e.end ? (i = e.end, i.push(this.sourceToken), delete e.end) : i = [this.sourceToken];
|
|
4069
4073
|
const r = {
|
|
4070
4074
|
type: "block-map",
|
|
4071
4075
|
offset: e.offset,
|
|
4072
4076
|
indent: e.indent,
|
|
4073
|
-
items: [{ start:
|
|
4077
|
+
items: [{ start: n, key: e, sep: i }]
|
|
4074
4078
|
};
|
|
4075
4079
|
this.onKeyLine = !0, this.stack[this.stack.length - 1] = r;
|
|
4076
4080
|
} else
|
|
@@ -4103,8 +4107,8 @@ class En {
|
|
|
4103
4107
|
switch (this.type) {
|
|
4104
4108
|
case "newline":
|
|
4105
4109
|
if (this.onKeyLine = !1, t.value) {
|
|
4106
|
-
const
|
|
4107
|
-
(Array.isArray(
|
|
4110
|
+
const n = "end" in t.value ? t.value.end : void 0;
|
|
4111
|
+
(Array.isArray(n) ? n[n.length - 1] : void 0)?.type === "comment" ? n?.push(this.sourceToken) : e.items.push({ start: [this.sourceToken] });
|
|
4108
4112
|
} else t.sep ? t.sep.push(this.sourceToken) : t.start.push(this.sourceToken);
|
|
4109
4113
|
return;
|
|
4110
4114
|
case "space":
|
|
@@ -4126,7 +4130,7 @@ class En {
|
|
|
4126
4130
|
return;
|
|
4127
4131
|
}
|
|
4128
4132
|
if (this.indent >= e.indent) {
|
|
4129
|
-
const
|
|
4133
|
+
const n = !this.onKeyLine && this.indent === e.indent, i = n && (t.sep || t.explicitKey) && this.type !== "seq-item-ind";
|
|
4130
4134
|
let r = [];
|
|
4131
4135
|
if (i && t.sep && !t.value) {
|
|
4132
4136
|
const o = [];
|
|
@@ -4222,7 +4226,7 @@ class En {
|
|
|
4222
4226
|
});
|
|
4223
4227
|
return;
|
|
4224
4228
|
}
|
|
4225
|
-
} else
|
|
4229
|
+
} else n && e.items.push({ start: r });
|
|
4226
4230
|
this.stack.push(o);
|
|
4227
4231
|
return;
|
|
4228
4232
|
}
|
|
@@ -4236,8 +4240,8 @@ class En {
|
|
|
4236
4240
|
switch (this.type) {
|
|
4237
4241
|
case "newline":
|
|
4238
4242
|
if (t.value) {
|
|
4239
|
-
const
|
|
4240
|
-
(Array.isArray(
|
|
4243
|
+
const n = "end" in t.value ? t.value.end : void 0;
|
|
4244
|
+
(Array.isArray(n) ? n[n.length - 1] : void 0)?.type === "comment" ? n?.push(this.sourceToken) : e.items.push({ start: [this.sourceToken] });
|
|
4241
4245
|
} else
|
|
4242
4246
|
t.start.push(this.sourceToken);
|
|
4243
4247
|
return;
|
|
@@ -4269,9 +4273,9 @@ class En {
|
|
|
4269
4273
|
return;
|
|
4270
4274
|
}
|
|
4271
4275
|
if (this.indent > e.indent) {
|
|
4272
|
-
const
|
|
4273
|
-
if (
|
|
4274
|
-
this.stack.push(
|
|
4276
|
+
const n = this.startBlockValue(e);
|
|
4277
|
+
if (n) {
|
|
4278
|
+
this.stack.push(n);
|
|
4275
4279
|
return;
|
|
4276
4280
|
}
|
|
4277
4281
|
}
|
|
@@ -4280,10 +4284,10 @@ class En {
|
|
|
4280
4284
|
*flowCollection(e) {
|
|
4281
4285
|
const t = e.items[e.items.length - 1];
|
|
4282
4286
|
if (this.type === "flow-error-end") {
|
|
4283
|
-
let
|
|
4287
|
+
let n;
|
|
4284
4288
|
do
|
|
4285
|
-
yield* this.pop(),
|
|
4286
|
-
while (
|
|
4289
|
+
yield* this.pop(), n = this.peek(1);
|
|
4290
|
+
while (n?.type === "flow-collection");
|
|
4287
4291
|
} else if (e.end.length === 0) {
|
|
4288
4292
|
switch (this.type) {
|
|
4289
4293
|
case "comma":
|
|
@@ -4313,14 +4317,14 @@ class En {
|
|
|
4313
4317
|
e.end.push(this.sourceToken);
|
|
4314
4318
|
return;
|
|
4315
4319
|
}
|
|
4316
|
-
const
|
|
4317
|
-
|
|
4320
|
+
const n = this.startBlockValue(e);
|
|
4321
|
+
n ? this.stack.push(n) : (yield* this.pop(), yield* this.step());
|
|
4318
4322
|
} else {
|
|
4319
|
-
const
|
|
4320
|
-
if (
|
|
4323
|
+
const n = this.peek(2);
|
|
4324
|
+
if (n.type === "block-map" && (this.type === "map-value-ind" && n.indent === e.indent || this.type === "newline" && !n.items[n.items.length - 1].sep))
|
|
4321
4325
|
yield* this.pop(), yield* this.step();
|
|
4322
|
-
else if (this.type === "map-value-ind" &&
|
|
4323
|
-
const i = Ie(
|
|
4326
|
+
else if (this.type === "map-value-ind" && n.type !== "flow-collection") {
|
|
4327
|
+
const i = Ie(n), r = ee(i);
|
|
4324
4328
|
Ct(e);
|
|
4325
4329
|
const o = e.end.splice(1, e.end.length);
|
|
4326
4330
|
o.push(this.sourceToken);
|
|
@@ -4384,29 +4388,29 @@ class En {
|
|
|
4384
4388
|
};
|
|
4385
4389
|
case "explicit-key-ind": {
|
|
4386
4390
|
this.onKeyLine = !0;
|
|
4387
|
-
const t = Ie(e),
|
|
4388
|
-
return
|
|
4391
|
+
const t = Ie(e), n = ee(t);
|
|
4392
|
+
return n.push(this.sourceToken), {
|
|
4389
4393
|
type: "block-map",
|
|
4390
4394
|
offset: this.offset,
|
|
4391
4395
|
indent: this.indent,
|
|
4392
|
-
items: [{ start:
|
|
4396
|
+
items: [{ start: n, explicitKey: !0 }]
|
|
4393
4397
|
};
|
|
4394
4398
|
}
|
|
4395
4399
|
case "map-value-ind": {
|
|
4396
4400
|
this.onKeyLine = !0;
|
|
4397
|
-
const t = Ie(e),
|
|
4401
|
+
const t = Ie(e), n = ee(t);
|
|
4398
4402
|
return {
|
|
4399
4403
|
type: "block-map",
|
|
4400
4404
|
offset: this.offset,
|
|
4401
4405
|
indent: this.indent,
|
|
4402
|
-
items: [{ start:
|
|
4406
|
+
items: [{ start: n, key: null, sep: [this.sourceToken] }]
|
|
4403
4407
|
};
|
|
4404
4408
|
}
|
|
4405
4409
|
}
|
|
4406
4410
|
return null;
|
|
4407
4411
|
}
|
|
4408
4412
|
atIndentedComment(e, t) {
|
|
4409
|
-
return this.type !== "comment" || this.indent <= t ? !1 : e.every((
|
|
4413
|
+
return this.type !== "comment" || this.indent <= t ? !1 : e.every((n) => n.type === "newline" || n.type === "space");
|
|
4410
4414
|
}
|
|
4411
4415
|
*documentEnd(e) {
|
|
4412
4416
|
this.type !== "doc-mode" && (e.end ? e.end.push(this.sourceToken) : e.end = [this.sourceToken], this.type === "newline" && (yield* this.pop()));
|
|
@@ -4428,27 +4432,27 @@ class En {
|
|
|
4428
4432
|
}
|
|
4429
4433
|
}
|
|
4430
4434
|
}
|
|
4431
|
-
function Cn(
|
|
4432
|
-
const e =
|
|
4433
|
-
return { lineCounter:
|
|
4435
|
+
function Cn(s) {
|
|
4436
|
+
const e = s.prettyErrors !== !1;
|
|
4437
|
+
return { lineCounter: s.lineCounter || e && new Tn() || null, prettyErrors: e };
|
|
4434
4438
|
}
|
|
4435
|
-
function $n(
|
|
4436
|
-
const { lineCounter: t, prettyErrors:
|
|
4439
|
+
function $n(s, e = {}) {
|
|
4440
|
+
const { lineCounter: t, prettyErrors: n } = Cn(e), i = new En(t?.addNewLine), r = new Nn(e);
|
|
4437
4441
|
let o = null;
|
|
4438
|
-
for (const l of r.compose(i.parse(
|
|
4442
|
+
for (const l of r.compose(i.parse(s), !0, s.length))
|
|
4439
4443
|
if (!o)
|
|
4440
4444
|
o = l;
|
|
4441
4445
|
else if (o.options.logLevel !== "silent") {
|
|
4442
4446
|
o.errors.push(new me(l.range.slice(0, 2), "MULTIPLE_DOCS", "Source contains multiple documents; please use YAML.parseAllDocuments()"));
|
|
4443
4447
|
break;
|
|
4444
4448
|
}
|
|
4445
|
-
return
|
|
4449
|
+
return n && t && (o.errors.forEach(At(s, t)), o.warnings.forEach(At(s, t))), o;
|
|
4446
4450
|
}
|
|
4447
|
-
function yt(
|
|
4448
|
-
const t =
|
|
4451
|
+
function yt(s, e) {
|
|
4452
|
+
const t = s.range;
|
|
4449
4453
|
if (!t)
|
|
4450
4454
|
return;
|
|
4451
|
-
const
|
|
4455
|
+
const n = Math.max(0, t[0]), i = typeof t[1] == "number" ? t[1] : typeof t[2] == "number" ? t[2] : t[0], r = Math.max(n, i), o = e.getPositionAt(n), l = e.getPositionAt(r);
|
|
4452
4456
|
return {
|
|
4453
4457
|
startLineNumber: o.lineNumber,
|
|
4454
4458
|
startColumn: o.column,
|
|
@@ -4456,28 +4460,28 @@ function yt(n, e) {
|
|
|
4456
4460
|
endColumn: l.column
|
|
4457
4461
|
};
|
|
4458
4462
|
}
|
|
4459
|
-
function vn(
|
|
4460
|
-
return I(
|
|
4463
|
+
function vn(s) {
|
|
4464
|
+
return I(s) ? s.value : s.toJSON();
|
|
4461
4465
|
}
|
|
4462
|
-
function _n(
|
|
4463
|
-
if (!I(
|
|
4466
|
+
function _n(s) {
|
|
4467
|
+
if (!I(s))
|
|
4464
4468
|
return;
|
|
4465
|
-
const { value: e } =
|
|
4469
|
+
const { value: e } = s;
|
|
4466
4470
|
return typeof e == "string" || typeof e == "number" ? e : void 0;
|
|
4467
4471
|
}
|
|
4468
|
-
function $t(
|
|
4472
|
+
function $t(s, e) {
|
|
4469
4473
|
const t = _n(e);
|
|
4470
|
-
return t === void 0 ?
|
|
4474
|
+
return t === void 0 ? s : [...s, t];
|
|
4471
4475
|
}
|
|
4472
|
-
function Mn(
|
|
4476
|
+
function Mn(s) {
|
|
4473
4477
|
const e = [];
|
|
4474
|
-
if (X(
|
|
4475
|
-
for (const t of
|
|
4478
|
+
if (X(s)) {
|
|
4479
|
+
for (const t of s.items)
|
|
4476
4480
|
L(t.key) && e.push(t.key), L(t.value) && e.push(t.value);
|
|
4477
4481
|
return e;
|
|
4478
4482
|
}
|
|
4479
|
-
if (
|
|
4480
|
-
for (const t of
|
|
4483
|
+
if (z(s))
|
|
4484
|
+
for (const t of s.items) {
|
|
4481
4485
|
if (E(t)) {
|
|
4482
4486
|
L(t.key) && e.push(t.key), L(t.value) && e.push(t.value);
|
|
4483
4487
|
continue;
|
|
@@ -4486,13 +4490,13 @@ function Mn(n) {
|
|
|
4486
4490
|
}
|
|
4487
4491
|
return e;
|
|
4488
4492
|
}
|
|
4489
|
-
function Pn(
|
|
4490
|
-
const t = [{ node:
|
|
4493
|
+
function Pn(s, e) {
|
|
4494
|
+
const t = [{ node: s, keyPath: [] }];
|
|
4491
4495
|
for (; t.length > 0; ) {
|
|
4492
|
-
const
|
|
4493
|
-
if (!
|
|
4496
|
+
const n = t.pop();
|
|
4497
|
+
if (!n)
|
|
4494
4498
|
continue;
|
|
4495
|
-
const { node: i, keyPath: r } =
|
|
4499
|
+
const { node: i, keyPath: r } = n;
|
|
4496
4500
|
if (e(i, r), X(i)) {
|
|
4497
4501
|
for (let o = i.items.length - 1; o >= 0; o--) {
|
|
4498
4502
|
const l = i.items[o];
|
|
@@ -4503,7 +4507,7 @@ function Pn(n, e) {
|
|
|
4503
4507
|
}
|
|
4504
4508
|
continue;
|
|
4505
4509
|
}
|
|
4506
|
-
if (
|
|
4510
|
+
if (z(i))
|
|
4507
4511
|
for (let o = i.items.length - 1; o >= 0; o--) {
|
|
4508
4512
|
const l = i.items[o], a = [...r, o];
|
|
4509
4513
|
if (E(l)) {
|
|
@@ -4517,25 +4521,25 @@ function Pn(n, e) {
|
|
|
4517
4521
|
}
|
|
4518
4522
|
}
|
|
4519
4523
|
}
|
|
4520
|
-
function ps(
|
|
4521
|
-
const t =
|
|
4524
|
+
function ps(s, e) {
|
|
4525
|
+
const t = s.getIn(e, !0);
|
|
4522
4526
|
return L(t) ? t : void 0;
|
|
4523
4527
|
}
|
|
4524
|
-
function ms(
|
|
4528
|
+
function ms(s, e) {
|
|
4525
4529
|
return {
|
|
4526
|
-
provideCodeLenses: async (t,
|
|
4530
|
+
provideCodeLenses: async (t, n) => {
|
|
4527
4531
|
if (t.getLanguageId() !== "yaml")
|
|
4528
4532
|
return q();
|
|
4529
4533
|
const i = await (e ?? tt)(t);
|
|
4530
4534
|
if (i.isDefault || i.language !== "yaml")
|
|
4531
4535
|
return q();
|
|
4532
4536
|
const r = i.document, o = r?.contents;
|
|
4533
|
-
return !r || !o ? q() :
|
|
4537
|
+
return !r || !o ? q() : s(o, t, n);
|
|
4534
4538
|
}
|
|
4535
4539
|
};
|
|
4536
4540
|
}
|
|
4537
|
-
function Rn(
|
|
4538
|
-
return ms(async (t,
|
|
4541
|
+
function Rn(s, e) {
|
|
4542
|
+
return ms(async (t, n, i) => {
|
|
4539
4543
|
let r = !1;
|
|
4540
4544
|
const o = [], l = [], a = [t];
|
|
4541
4545
|
for (; a.length > 0 && !r; ) {
|
|
@@ -4544,9 +4548,9 @@ function Rn(n, e) {
|
|
|
4544
4548
|
const c = a.pop();
|
|
4545
4549
|
if (!c)
|
|
4546
4550
|
continue;
|
|
4547
|
-
const d = await
|
|
4551
|
+
const d = await s(c, () => {
|
|
4548
4552
|
r = !0;
|
|
4549
|
-
},
|
|
4553
|
+
}, n, i);
|
|
4550
4554
|
d && (o.push(...d.lenses), d.dispose && l.push(d.dispose));
|
|
4551
4555
|
const f = Mn(c);
|
|
4552
4556
|
for (let u = f.length - 1; u >= 0; u--)
|
|
@@ -4555,56 +4559,56 @@ function Rn(n, e) {
|
|
|
4555
4559
|
return ys(o, l);
|
|
4556
4560
|
}, e);
|
|
4557
4561
|
}
|
|
4558
|
-
function Un(
|
|
4559
|
-
return ms((t,
|
|
4562
|
+
function Un(s, e) {
|
|
4563
|
+
return ms((t, n, i) => {
|
|
4560
4564
|
const r = [];
|
|
4561
4565
|
return Pn(t, (o, l) => {
|
|
4562
4566
|
if (i.isCancellationRequested || !I(o) || typeof o.value != "string" || !bs.test(o.value))
|
|
4563
4567
|
return;
|
|
4564
|
-
const a = yt(o,
|
|
4568
|
+
const a = yt(o, n);
|
|
4565
4569
|
a && r.push({
|
|
4566
4570
|
value: o.value,
|
|
4567
4571
|
range: a,
|
|
4568
4572
|
context: { keyPath: l, node: o }
|
|
4569
4573
|
});
|
|
4570
|
-
}), i.isCancellationRequested ? q() : typeof
|
|
4571
|
-
lenses: r.map(({ value: o, range: l }) => gs(o, l,
|
|
4574
|
+
}), i.isCancellationRequested ? q() : typeof s == "function" ? s(r) : {
|
|
4575
|
+
lenses: r.map(({ value: o, range: l }) => gs(o, l, s)),
|
|
4572
4576
|
dispose: () => {
|
|
4573
4577
|
}
|
|
4574
4578
|
};
|
|
4575
4579
|
}, e);
|
|
4576
4580
|
}
|
|
4577
|
-
function Bn(
|
|
4581
|
+
function Bn(s, e, t) {
|
|
4578
4582
|
return {
|
|
4579
|
-
provideCodeLenses: async (
|
|
4580
|
-
if (
|
|
4583
|
+
provideCodeLenses: async (n, i) => {
|
|
4584
|
+
if (n.getLanguageId() !== "yaml")
|
|
4581
4585
|
return q();
|
|
4582
|
-
const r = await (t ?? tt)(
|
|
4586
|
+
const r = await (t ?? tt)(n);
|
|
4583
4587
|
if (r.isDefault || r.language !== "yaml" || i.isCancellationRequested)
|
|
4584
4588
|
return q();
|
|
4585
4589
|
const o = r.document, l = o?.contents;
|
|
4586
4590
|
if (!o || !l)
|
|
4587
4591
|
return q();
|
|
4588
|
-
const a = ps(o,
|
|
4592
|
+
const a = ps(o, s);
|
|
4589
4593
|
if (!a)
|
|
4590
4594
|
return q();
|
|
4591
|
-
const c = yt(a,
|
|
4592
|
-
return c ? e(vn(a), c, { keyPath:
|
|
4595
|
+
const c = yt(a, n);
|
|
4596
|
+
return c ? e(vn(a), c, { keyPath: s, node: a }) : q();
|
|
4593
4597
|
}
|
|
4594
4598
|
};
|
|
4595
4599
|
}
|
|
4596
|
-
function Fn(
|
|
4597
|
-
return Bn(
|
|
4600
|
+
function Fn(s, e, t) {
|
|
4601
|
+
return Bn(s, (n, i, r) => {
|
|
4598
4602
|
if (typeof e == "function")
|
|
4599
|
-
return e(
|
|
4603
|
+
return e(n, i, r);
|
|
4600
4604
|
const { node: o } = r;
|
|
4601
4605
|
return {
|
|
4602
|
-
lenses: [ws(
|
|
4606
|
+
lenses: [ws(s, n, o, i, e)]
|
|
4603
4607
|
};
|
|
4604
4608
|
}, t);
|
|
4605
4609
|
}
|
|
4606
|
-
function Vn(
|
|
4607
|
-
const t = $n(
|
|
4610
|
+
function Vn(s, e) {
|
|
4611
|
+
const t = $n(s);
|
|
4608
4612
|
return {
|
|
4609
4613
|
language: "yaml",
|
|
4610
4614
|
altVersionId: e,
|
|
@@ -4614,25 +4618,25 @@ function Vn(n, e) {
|
|
|
4614
4618
|
function Kn() {
|
|
4615
4619
|
return { startLineNumber: 1, startColumn: 1, endLineNumber: 1, endColumn: 2 };
|
|
4616
4620
|
}
|
|
4617
|
-
function Dn(
|
|
4618
|
-
for (let
|
|
4619
|
-
const i = t.slice(0,
|
|
4621
|
+
function Dn(s, e, t) {
|
|
4622
|
+
for (let n = t.length; n >= 0; n--) {
|
|
4623
|
+
const i = t.slice(0, n);
|
|
4620
4624
|
if (i.some((o) => typeof o != "string" && typeof o != "number"))
|
|
4621
4625
|
continue;
|
|
4622
|
-
const r = ps(
|
|
4626
|
+
const r = ps(s, i);
|
|
4623
4627
|
if (r) {
|
|
4624
4628
|
const o = yt(r, e);
|
|
4625
4629
|
if (o)
|
|
4626
|
-
return { range: o, rangeKind:
|
|
4630
|
+
return { range: o, rangeKind: n === t.length ? "exact" : "ancestor" };
|
|
4627
4631
|
}
|
|
4628
4632
|
}
|
|
4629
4633
|
return { range: Kn(), rangeKind: "document" };
|
|
4630
4634
|
}
|
|
4631
|
-
async function Yn(
|
|
4632
|
-
const
|
|
4633
|
-
if (
|
|
4635
|
+
async function Yn(s, e, t) {
|
|
4636
|
+
const n = await (t?.contextGetter ?? tt)(s);
|
|
4637
|
+
if (n.isDefault || n.language !== "yaml" || !n.document)
|
|
4634
4638
|
return [];
|
|
4635
|
-
const i =
|
|
4639
|
+
const i = n.document;
|
|
4636
4640
|
if (i.errors.length > 0)
|
|
4637
4641
|
return [];
|
|
4638
4642
|
let r;
|
|
@@ -4642,7 +4646,7 @@ async function Yn(n, e, t) {
|
|
|
4642
4646
|
return [];
|
|
4643
4647
|
}
|
|
4644
4648
|
return (await e(r)).map((l) => {
|
|
4645
|
-
const { range: a, rangeKind: c } = Dn(i,
|
|
4649
|
+
const { range: a, rangeKind: c } = Dn(i, s, l.path);
|
|
4646
4650
|
return { ...l, range: a, rangeKind: c };
|
|
4647
4651
|
});
|
|
4648
4652
|
}
|