@dendelion/paper-camp 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/assets/main-CDaKqAAm.js +200 -0
- package/dist/app/assets/main-CDaKqAAm.js.map +1 -0
- package/dist/app/assets/main-DVU0frJi.css +1 -0
- package/dist/app/index.html +2 -2
- package/dist/chunks/{serializer._5uZJ4OM.js → serializer.DbnJzwVr.js} +1038 -948
- package/dist/chunks/{serializer._5uZJ4OM.js.map → serializer.DbnJzwVr.js.map} +1 -1
- package/dist/cli/index.js +4170 -4109
- package/dist/cli/index.js.map +1 -1
- package/dist/core/entity.test.d.ts +2 -0
- package/dist/core/entity.test.d.ts.map +1 -0
- package/dist/core/index.js +54 -50
- package/dist/core/parser.d.ts +9 -1
- package/dist/core/parser.d.ts.map +1 -1
- package/dist/core/readers.d.ts +14 -20
- package/dist/core/readers.d.ts.map +1 -1
- package/dist/core/scaffold.d.ts.map +1 -1
- package/dist/core/schemas.d.ts +44 -5
- package/dist/core/schemas.d.ts.map +1 -1
- package/dist/core/serializer.d.ts +37 -6
- package/dist/core/serializer.d.ts.map +1 -1
- package/dist/core/templates.d.ts +1 -1
- package/dist/core/templates.d.ts.map +1 -1
- package/dist/types/index.d.ts +40 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/app/assets/main-BN5y2u1i.js +0 -216
- package/dist/app/assets/main-BN5y2u1i.js.map +0 -1
- package/dist/app/assets/main-DvILXiwx.css +0 -1
- package/dist/core/idea-status.d.ts +0 -7
- package/dist/core/idea-status.d.ts.map +0 -1
- package/dist/core/idea-status.test.d.ts +0 -2
- package/dist/core/idea-status.test.d.ts.map +0 -1
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { readdir as
|
|
2
|
-
import { join as
|
|
3
|
-
import { z as
|
|
4
|
-
import { AGENT_IDS as
|
|
5
|
-
const
|
|
6
|
-
function
|
|
1
|
+
import { readdir as Rs, readFile as Ye, mkdir as X, writeFile as G, access as Fs, rename as qs } from "node:fs/promises";
|
|
2
|
+
import { join as _, dirname as Qt } from "node:path";
|
|
3
|
+
import { z as b } from "zod";
|
|
4
|
+
import { AGENT_IDS as $e } from "../types/index.js";
|
|
5
|
+
const Us = /^([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)$/;
|
|
6
|
+
function Ys(s) {
|
|
7
7
|
return s.length >= 2 && (s.startsWith('"') && s.endsWith('"') || s.startsWith("'") && s.endsWith("'")) ? s.slice(1, -1) : s;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function _t(s) {
|
|
10
10
|
return s === "" || /[\s#"]/.test(s) ? `"${s.replace(/"/g, '\\"')}"` : s;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function Xt(s) {
|
|
13
13
|
const e = s.trim();
|
|
14
14
|
if (!e || e.startsWith("#")) return null;
|
|
15
|
-
const t = e.match(
|
|
16
|
-
return t ? { key: t[1], value:
|
|
15
|
+
const t = e.match(Us);
|
|
16
|
+
return t ? { key: t[1], value: Ys(t[2]) } : null;
|
|
17
17
|
}
|
|
18
18
|
function Fi(s) {
|
|
19
19
|
const e = [];
|
|
20
20
|
for (const t of s.split(`
|
|
21
21
|
`)) {
|
|
22
|
-
const n =
|
|
22
|
+
const n = Xt(t);
|
|
23
23
|
n && e.push(n);
|
|
24
24
|
}
|
|
25
25
|
return e;
|
|
@@ -28,26 +28,26 @@ function qi(s, e) {
|
|
|
28
28
|
const t = new Map(e.map((r) => [r.key, r.value])), n = s.length > 0 ? s.split(`
|
|
29
29
|
`) : [], i = [];
|
|
30
30
|
for (const r of n) {
|
|
31
|
-
const o =
|
|
31
|
+
const o = Xt(r);
|
|
32
32
|
if (!o) {
|
|
33
33
|
i.push(r);
|
|
34
34
|
continue;
|
|
35
35
|
}
|
|
36
|
-
t.has(o.key) && (i.push(`${o.key}=${
|
|
36
|
+
t.has(o.key) && (i.push(`${o.key}=${_t(t.get(o.key) ?? "")}`), t.delete(o.key));
|
|
37
37
|
}
|
|
38
38
|
for (const [r, o] of t)
|
|
39
|
-
i.push(`${r}=${
|
|
39
|
+
i.push(`${r}=${_t(o)}`);
|
|
40
40
|
for (; i.length > 0 && i[i.length - 1] === ""; ) i.pop();
|
|
41
41
|
return i.length > 0 ? `${i.join(`
|
|
42
42
|
`)}
|
|
43
43
|
` : "";
|
|
44
44
|
}
|
|
45
|
-
const ut = Symbol.for("yaml.alias"), rt = Symbol.for("yaml.document"),
|
|
45
|
+
const ut = Symbol.for("yaml.alias"), rt = Symbol.for("yaml.document"), z = Symbol.for("yaml.map"), zt = Symbol.for("yaml.pair"), V = Symbol.for("yaml.scalar"), ue = Symbol.for("yaml.seq"), K = Symbol.for("yaml.node.type"), he = (s) => !!s && typeof s == "object" && s[K] === ut, Ie = (s) => !!s && typeof s == "object" && s[K] === rt, Ae = (s) => !!s && typeof s == "object" && s[K] === z, v = (s) => !!s && typeof s == "object" && s[K] === zt, T = (s) => !!s && typeof s == "object" && s[K] === V, Oe = (s) => !!s && typeof s == "object" && s[K] === ue;
|
|
46
46
|
function L(s) {
|
|
47
47
|
if (s && typeof s == "object")
|
|
48
48
|
switch (s[K]) {
|
|
49
|
-
case
|
|
50
|
-
case
|
|
49
|
+
case z:
|
|
50
|
+
case ue:
|
|
51
51
|
return !0;
|
|
52
52
|
}
|
|
53
53
|
return !1;
|
|
@@ -56,25 +56,25 @@ function C(s) {
|
|
|
56
56
|
if (s && typeof s == "object")
|
|
57
57
|
switch (s[K]) {
|
|
58
58
|
case ut:
|
|
59
|
-
case
|
|
59
|
+
case z:
|
|
60
60
|
case V:
|
|
61
|
-
case
|
|
61
|
+
case ue:
|
|
62
62
|
return !0;
|
|
63
63
|
}
|
|
64
64
|
return !1;
|
|
65
65
|
}
|
|
66
|
-
const
|
|
67
|
-
function
|
|
68
|
-
const t =
|
|
69
|
-
Ie(s) ? ie(null, s.contents, t, Object.freeze([s])) ===
|
|
66
|
+
const xt = (s) => (T(s) || L(s)) && !!s.anchor, x = Symbol("break visit"), Vs = Symbol("skip children"), we = Symbol("remove node");
|
|
67
|
+
function de(s, e) {
|
|
68
|
+
const t = Js(e);
|
|
69
|
+
Ie(s) ? ie(null, s.contents, t, Object.freeze([s])) === we && (s.contents = null) : ie(null, s, t, Object.freeze([]));
|
|
70
70
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
de.BREAK = x;
|
|
72
|
+
de.SKIP = Vs;
|
|
73
|
+
de.REMOVE = we;
|
|
74
74
|
function ie(s, e, t, n) {
|
|
75
|
-
const i =
|
|
76
|
-
if (C(i) ||
|
|
77
|
-
return
|
|
75
|
+
const i = Hs(s, e, t, n);
|
|
76
|
+
if (C(i) || v(i))
|
|
77
|
+
return Gs(s, n, i), ie(s, i, t, n);
|
|
78
78
|
if (typeof i != "symbol") {
|
|
79
79
|
if (L(e)) {
|
|
80
80
|
n = Object.freeze(n.concat(e));
|
|
@@ -83,26 +83,26 @@ function ie(s, e, t, n) {
|
|
|
83
83
|
if (typeof o == "number")
|
|
84
84
|
r = o - 1;
|
|
85
85
|
else {
|
|
86
|
-
if (o ===
|
|
87
|
-
return
|
|
88
|
-
o ===
|
|
86
|
+
if (o === x)
|
|
87
|
+
return x;
|
|
88
|
+
o === we && (e.items.splice(r, 1), r -= 1);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
} else if (
|
|
91
|
+
} else if (v(e)) {
|
|
92
92
|
n = Object.freeze(n.concat(e));
|
|
93
93
|
const r = ie("key", e.key, t, n);
|
|
94
|
-
if (r ===
|
|
95
|
-
return
|
|
96
|
-
r ===
|
|
94
|
+
if (r === x)
|
|
95
|
+
return x;
|
|
96
|
+
r === we && (e.key = null);
|
|
97
97
|
const o = ie("value", e.value, t, n);
|
|
98
|
-
if (o ===
|
|
99
|
-
return
|
|
100
|
-
o ===
|
|
98
|
+
if (o === x)
|
|
99
|
+
return x;
|
|
100
|
+
o === we && (e.value = null);
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
return i;
|
|
104
104
|
}
|
|
105
|
-
function
|
|
105
|
+
function Js(s) {
|
|
106
106
|
return typeof s == "object" && (s.Collection || s.Node || s.Value) ? Object.assign({
|
|
107
107
|
Alias: s.Node,
|
|
108
108
|
Map: s.Node,
|
|
@@ -117,42 +117,42 @@ function Hs(s) {
|
|
|
117
117
|
Seq: s.Collection
|
|
118
118
|
}, s) : s;
|
|
119
119
|
}
|
|
120
|
-
function
|
|
120
|
+
function Hs(s, e, t, n) {
|
|
121
121
|
var i, r, o, a, l;
|
|
122
122
|
if (typeof t == "function")
|
|
123
123
|
return t(s, e, n);
|
|
124
|
-
if ($e(e))
|
|
125
|
-
return (i = t.Map) == null ? void 0 : i.call(t, s, e, n);
|
|
126
124
|
if (Ae(e))
|
|
125
|
+
return (i = t.Map) == null ? void 0 : i.call(t, s, e, n);
|
|
126
|
+
if (Oe(e))
|
|
127
127
|
return (r = t.Seq) == null ? void 0 : r.call(t, s, e, n);
|
|
128
|
-
if (
|
|
128
|
+
if (v(e))
|
|
129
129
|
return (o = t.Pair) == null ? void 0 : o.call(t, s, e, n);
|
|
130
130
|
if (T(e))
|
|
131
131
|
return (a = t.Scalar) == null ? void 0 : a.call(t, s, e, n);
|
|
132
|
-
if (
|
|
132
|
+
if (he(e))
|
|
133
133
|
return (l = t.Alias) == null ? void 0 : l.call(t, s, e, n);
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function Gs(s, e, t) {
|
|
136
136
|
const n = e[e.length - 1];
|
|
137
137
|
if (L(n))
|
|
138
138
|
n.items[s] = t;
|
|
139
|
-
else if (
|
|
139
|
+
else if (v(n))
|
|
140
140
|
s === "key" ? n.key = t : n.value = t;
|
|
141
141
|
else if (Ie(n))
|
|
142
142
|
n.contents = t;
|
|
143
143
|
else {
|
|
144
|
-
const i =
|
|
144
|
+
const i = he(n) ? "alias" : "scalar";
|
|
145
145
|
throw new Error(`Cannot replace node with ${i} parent`);
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
|
-
const
|
|
148
|
+
const Ws = {
|
|
149
149
|
"!": "%21",
|
|
150
150
|
",": "%2C",
|
|
151
151
|
"[": "%5B",
|
|
152
152
|
"]": "%5D",
|
|
153
153
|
"{": "%7B",
|
|
154
154
|
"}": "%7D"
|
|
155
|
-
},
|
|
155
|
+
}, Qs = (s) => s.replace(/[!,[\]{}]/g, (e) => Ws[e]);
|
|
156
156
|
class D {
|
|
157
157
|
constructor(e, t) {
|
|
158
158
|
this.docStart = null, this.docEnd = !1, this.yaml = Object.assign({}, D.defaultYaml, e), this.tags = Object.assign({}, D.defaultTags, t);
|
|
@@ -242,7 +242,7 @@ class D {
|
|
|
242
242
|
tagString(e) {
|
|
243
243
|
for (const [t, n] of Object.entries(this.tags))
|
|
244
244
|
if (e.startsWith(n))
|
|
245
|
-
return t +
|
|
245
|
+
return t + Qs(e.substring(n.length));
|
|
246
246
|
return e[0] === "!" ? e : `!<${e}>`;
|
|
247
247
|
}
|
|
248
248
|
toString(e) {
|
|
@@ -250,7 +250,7 @@ class D {
|
|
|
250
250
|
let i;
|
|
251
251
|
if (e && n.length > 0 && C(e.contents)) {
|
|
252
252
|
const r = {};
|
|
253
|
-
|
|
253
|
+
de(e.contents, (o, a) => {
|
|
254
254
|
C(a) && a.tag && (r[a.tag] = !0);
|
|
255
255
|
}), i = Object.keys(r);
|
|
256
256
|
} else
|
|
@@ -263,35 +263,35 @@ class D {
|
|
|
263
263
|
}
|
|
264
264
|
D.defaultYaml = { explicit: !1, version: "1.2" };
|
|
265
265
|
D.defaultTags = { "!!": "tag:yaml.org,2002:" };
|
|
266
|
-
function
|
|
266
|
+
function Zt(s) {
|
|
267
267
|
if (/[\x00-\x19\s,[\]{}]/.test(s)) {
|
|
268
268
|
const t = `Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;
|
|
269
269
|
throw new Error(t);
|
|
270
270
|
}
|
|
271
271
|
return !0;
|
|
272
272
|
}
|
|
273
|
-
function
|
|
273
|
+
function es(s) {
|
|
274
274
|
const e = /* @__PURE__ */ new Set();
|
|
275
|
-
return
|
|
275
|
+
return de(s, {
|
|
276
276
|
Value(t, n) {
|
|
277
277
|
n.anchor && e.add(n.anchor);
|
|
278
278
|
}
|
|
279
279
|
}), e;
|
|
280
280
|
}
|
|
281
|
-
function
|
|
281
|
+
function ts(s, e) {
|
|
282
282
|
for (let t = 1; ; ++t) {
|
|
283
283
|
const n = `${s}${t}`;
|
|
284
284
|
if (!e.has(n))
|
|
285
285
|
return n;
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
|
-
function
|
|
288
|
+
function Xs(s, e) {
|
|
289
289
|
const t = [], n = /* @__PURE__ */ new Map();
|
|
290
290
|
let i = null;
|
|
291
291
|
return {
|
|
292
292
|
onAnchor: (r) => {
|
|
293
|
-
t.push(r), i ?? (i =
|
|
294
|
-
const o =
|
|
293
|
+
t.push(r), i ?? (i = es(s));
|
|
294
|
+
const o = ts(e, i);
|
|
295
295
|
return i.add(o), o;
|
|
296
296
|
},
|
|
297
297
|
/**
|
|
@@ -337,11 +337,11 @@ function re(s, e, t, n) {
|
|
|
337
337
|
}
|
|
338
338
|
return s.call(e, t, n);
|
|
339
339
|
}
|
|
340
|
-
function
|
|
340
|
+
function B(s, e, t) {
|
|
341
341
|
if (Array.isArray(s))
|
|
342
|
-
return s.map((n, i) =>
|
|
342
|
+
return s.map((n, i) => B(n, String(i), t));
|
|
343
343
|
if (s && typeof s.toJSON == "function") {
|
|
344
|
-
if (!t || !
|
|
344
|
+
if (!t || !xt(s))
|
|
345
345
|
return s.toJSON(e, t);
|
|
346
346
|
const n = { aliasCount: 0, count: 1, res: void 0 };
|
|
347
347
|
t.anchors.set(s, n), t.onCreate = (r) => {
|
|
@@ -372,7 +372,7 @@ class ht {
|
|
|
372
372
|
mapAsMap: t === !0,
|
|
373
373
|
mapKeyWarned: !1,
|
|
374
374
|
maxAliasCount: typeof n == "number" ? n : 100
|
|
375
|
-
}, a =
|
|
375
|
+
}, a = B(this, "", o);
|
|
376
376
|
if (typeof i == "function")
|
|
377
377
|
for (const { count: l, res: c } of o.anchors.values())
|
|
378
378
|
i(c, l);
|
|
@@ -395,9 +395,9 @@ class dt extends ht {
|
|
|
395
395
|
if ((t == null ? void 0 : t.maxAliasCount) === 0)
|
|
396
396
|
throw new ReferenceError("Alias resolution is disabled");
|
|
397
397
|
let n;
|
|
398
|
-
t != null && t.aliasResolveCache ? n = t.aliasResolveCache : (n = [],
|
|
398
|
+
t != null && t.aliasResolveCache ? n = t.aliasResolveCache : (n = [], de(e, {
|
|
399
399
|
Node: (r, o) => {
|
|
400
|
-
(
|
|
400
|
+
(he(o) || xt(o)) && n.push(o);
|
|
401
401
|
}
|
|
402
402
|
}), t && (t.aliasResolveCache = n));
|
|
403
403
|
let i;
|
|
@@ -417,11 +417,11 @@ class dt extends ht {
|
|
|
417
417
|
throw new ReferenceError(l);
|
|
418
418
|
}
|
|
419
419
|
let a = n.get(o);
|
|
420
|
-
if (a || (
|
|
420
|
+
if (a || (B(o, null, t), a = n.get(o)), (a == null ? void 0 : a.res) === void 0) {
|
|
421
421
|
const l = "This should not happen: Alias anchor was not resolved?";
|
|
422
422
|
throw new ReferenceError(l);
|
|
423
423
|
}
|
|
424
|
-
if (r >= 0 && (a.count += 1, a.aliasCount === 0 && (a.aliasCount =
|
|
424
|
+
if (r >= 0 && (a.count += 1, a.aliasCount === 0 && (a.aliasCount = Be(i, o, n)), a.count * a.aliasCount > r)) {
|
|
425
425
|
const l = "Excessive alias count indicates a resource exhaustion attack";
|
|
426
426
|
throw new ReferenceError(l);
|
|
427
427
|
}
|
|
@@ -430,7 +430,7 @@ class dt extends ht {
|
|
|
430
430
|
toString(e, t, n) {
|
|
431
431
|
const i = `*${this.source}`;
|
|
432
432
|
if (e) {
|
|
433
|
-
if (
|
|
433
|
+
if (Zt(this.source), e.options.verifyAliasOrder && !e.anchors.has(this.source)) {
|
|
434
434
|
const r = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
|
|
435
435
|
throw new Error(r);
|
|
436
436
|
}
|
|
@@ -440,42 +440,42 @@ class dt extends ht {
|
|
|
440
440
|
return i;
|
|
441
441
|
}
|
|
442
442
|
}
|
|
443
|
-
function
|
|
444
|
-
if (
|
|
443
|
+
function Be(s, e, t) {
|
|
444
|
+
if (he(e)) {
|
|
445
445
|
const n = e.resolve(s), i = t && n && t.get(n);
|
|
446
446
|
return i ? i.count * i.aliasCount : 0;
|
|
447
447
|
} else if (L(e)) {
|
|
448
448
|
let n = 0;
|
|
449
449
|
for (const i of e.items) {
|
|
450
|
-
const r =
|
|
450
|
+
const r = Be(s, i, t);
|
|
451
451
|
r > n && (n = r);
|
|
452
452
|
}
|
|
453
453
|
return n;
|
|
454
|
-
} else if (
|
|
455
|
-
const n =
|
|
454
|
+
} else if (v(e)) {
|
|
455
|
+
const n = Be(s, e.key, t), i = Be(s, e.value, t);
|
|
456
456
|
return Math.max(n, i);
|
|
457
457
|
}
|
|
458
458
|
return 1;
|
|
459
459
|
}
|
|
460
|
-
const
|
|
461
|
-
class
|
|
460
|
+
const ss = (s) => !s || typeof s != "function" && typeof s != "object";
|
|
461
|
+
class $ extends ht {
|
|
462
462
|
constructor(e) {
|
|
463
463
|
super(V), this.value = e;
|
|
464
464
|
}
|
|
465
465
|
toJSON(e, t) {
|
|
466
|
-
return t != null && t.keep ? this.value :
|
|
466
|
+
return t != null && t.keep ? this.value : B(this.value, e, t);
|
|
467
467
|
}
|
|
468
468
|
toString() {
|
|
469
469
|
return String(this.value);
|
|
470
470
|
}
|
|
471
471
|
}
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
const
|
|
478
|
-
function
|
|
472
|
+
$.BLOCK_FOLDED = "BLOCK_FOLDED";
|
|
473
|
+
$.BLOCK_LITERAL = "BLOCK_LITERAL";
|
|
474
|
+
$.PLAIN = "PLAIN";
|
|
475
|
+
$.QUOTE_DOUBLE = "QUOTE_DOUBLE";
|
|
476
|
+
$.QUOTE_SINGLE = "QUOTE_SINGLE";
|
|
477
|
+
const zs = "tag:yaml.org,2002:";
|
|
478
|
+
function xs(s, e, t) {
|
|
479
479
|
if (e) {
|
|
480
480
|
const n = t.filter((r) => r.tag === e), i = n.find((r) => !r.format) ?? n[0];
|
|
481
481
|
if (!i)
|
|
@@ -491,8 +491,8 @@ function Ne(s, e, t) {
|
|
|
491
491
|
var f, h, d;
|
|
492
492
|
if (Ie(s) && (s = s.contents), C(s))
|
|
493
493
|
return s;
|
|
494
|
-
if (
|
|
495
|
-
const g = (h = (f = t.schema[
|
|
494
|
+
if (v(s)) {
|
|
495
|
+
const g = (h = (f = t.schema[z]).createNode) == null ? void 0 : h.call(f, t.schema, null, t);
|
|
496
496
|
return g.items.push(s), g;
|
|
497
497
|
}
|
|
498
498
|
(s instanceof String || s instanceof Number || s instanceof Boolean || typeof BigInt < "u" && s instanceof BigInt) && (s = s.valueOf());
|
|
@@ -503,20 +503,20 @@ function Ne(s, e, t) {
|
|
|
503
503
|
return l.anchor ?? (l.anchor = i(s)), new dt(l.anchor);
|
|
504
504
|
l = { anchor: null, node: null }, a.set(s, l);
|
|
505
505
|
}
|
|
506
|
-
e != null && e.startsWith("!!") && (e =
|
|
507
|
-
let c =
|
|
506
|
+
e != null && e.startsWith("!!") && (e = zs + e.slice(2));
|
|
507
|
+
let c = xs(s, e, o.tags);
|
|
508
508
|
if (!c) {
|
|
509
509
|
if (s && typeof s.toJSON == "function" && (s = s.toJSON()), !s || typeof s != "object") {
|
|
510
|
-
const g = new
|
|
510
|
+
const g = new $(s);
|
|
511
511
|
return l && (l.node = g), g;
|
|
512
512
|
}
|
|
513
|
-
c = s instanceof Map ? o[
|
|
513
|
+
c = s instanceof Map ? o[z] : Symbol.iterator in Object(s) ? o[ue] : o[z];
|
|
514
514
|
}
|
|
515
515
|
r && (r(c), delete t.onTagObj);
|
|
516
|
-
const p = c != null && c.createNode ? c.createNode(t.schema, s, t) : typeof ((d = c == null ? void 0 : c.nodeClass) == null ? void 0 : d.from) == "function" ? c.nodeClass.from(t.schema, s, t) : new
|
|
516
|
+
const p = c != null && c.createNode ? c.createNode(t.schema, s, t) : typeof ((d = c == null ? void 0 : c.nodeClass) == null ? void 0 : d.from) == "function" ? c.nodeClass.from(t.schema, s, t) : new $(s);
|
|
517
517
|
return e ? p.tag = e : c.default || (p.tag = c.tag), l && (l.node = p), p;
|
|
518
518
|
}
|
|
519
|
-
function
|
|
519
|
+
function Fe(s, e, t) {
|
|
520
520
|
let n = t;
|
|
521
521
|
for (let i = e.length - 1; i >= 0; --i) {
|
|
522
522
|
const r = e[i];
|
|
@@ -536,8 +536,8 @@ function Re(s, e, t) {
|
|
|
536
536
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
537
537
|
});
|
|
538
538
|
}
|
|
539
|
-
const
|
|
540
|
-
class
|
|
539
|
+
const ye = (s) => s == null || typeof s == "object" && !!s[Symbol.iterator]().next().done;
|
|
540
|
+
class ns extends ht {
|
|
541
541
|
constructor(e, t) {
|
|
542
542
|
super(e), Object.defineProperty(this, "schema", {
|
|
543
543
|
value: t,
|
|
@@ -553,7 +553,7 @@ class ts extends ht {
|
|
|
553
553
|
*/
|
|
554
554
|
clone(e) {
|
|
555
555
|
const t = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
|
|
556
|
-
return e && (t.schema = e), t.items = t.items.map((n) => C(n) ||
|
|
556
|
+
return e && (t.schema = e), t.items = t.items.map((n) => C(n) || v(n) ? n.clone(e) : n), this.range && (t.range = this.range.slice()), t;
|
|
557
557
|
}
|
|
558
558
|
/**
|
|
559
559
|
* Adds a value to the collection. For `!!map` and `!!omap` the value must
|
|
@@ -561,14 +561,14 @@ class ts extends ht {
|
|
|
561
561
|
* that already exists in the map.
|
|
562
562
|
*/
|
|
563
563
|
addIn(e, t) {
|
|
564
|
-
if (
|
|
564
|
+
if (ye(e))
|
|
565
565
|
this.add(t);
|
|
566
566
|
else {
|
|
567
567
|
const [n, ...i] = e, r = this.get(n, !0);
|
|
568
568
|
if (L(r))
|
|
569
569
|
r.addIn(i, t);
|
|
570
570
|
else if (r === void 0 && this.schema)
|
|
571
|
-
this.set(n,
|
|
571
|
+
this.set(n, Fe(this.schema, i, t));
|
|
572
572
|
else
|
|
573
573
|
throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`);
|
|
574
574
|
}
|
|
@@ -597,7 +597,7 @@ class ts extends ht {
|
|
|
597
597
|
}
|
|
598
598
|
hasAllNullValues(e) {
|
|
599
599
|
return this.items.every((t) => {
|
|
600
|
-
if (!
|
|
600
|
+
if (!v(t))
|
|
601
601
|
return !1;
|
|
602
602
|
const n = t.value;
|
|
603
603
|
return n == null || e && T(n) && n.value == null && !n.commentBefore && !n.comment && !n.tag;
|
|
@@ -626,20 +626,20 @@ class ts extends ht {
|
|
|
626
626
|
if (L(r))
|
|
627
627
|
r.setIn(i, t);
|
|
628
628
|
else if (r === void 0 && this.schema)
|
|
629
|
-
this.set(n,
|
|
629
|
+
this.set(n, Fe(this.schema, i, t));
|
|
630
630
|
else
|
|
631
631
|
throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`);
|
|
632
632
|
}
|
|
633
633
|
}
|
|
634
634
|
}
|
|
635
|
-
const
|
|
636
|
-
function
|
|
635
|
+
const Zs = (s) => s.replace(/^(?!$)(?: $)?/gm, "#");
|
|
636
|
+
function H(s, e) {
|
|
637
637
|
return /^\n+$/.test(s) ? s.substring(1) : e ? s.replace(/^(?! *$)/gm, e) : s;
|
|
638
638
|
}
|
|
639
639
|
const Z = (s, e, t) => s.endsWith(`
|
|
640
|
-
`) ?
|
|
640
|
+
`) ? H(t, e) : t.includes(`
|
|
641
641
|
`) ? `
|
|
642
|
-
` +
|
|
642
|
+
` + H(t, e) : (s.endsWith(" ") ? "" : " ") + t, is = "flow", ot = "block", Ke = "quoted";
|
|
643
643
|
function Ve(s, e, t = "flow", { indentAtStart: n, lineWidth: i = 80, minContentWidth: r = 20, onFold: o, onOverflow: a } = {}) {
|
|
644
644
|
if (!i || i < 0)
|
|
645
645
|
return s;
|
|
@@ -651,9 +651,9 @@ function Ve(s, e, t = "flow", { indentAtStart: n, lineWidth: i = 80, minContentW
|
|
|
651
651
|
let f = i - e.length;
|
|
652
652
|
typeof n == "number" && (n > i - Math.max(2, r) ? c.push(0) : f = i - n);
|
|
653
653
|
let h, d, g = !1, u = -1, m = -1, y = -1;
|
|
654
|
-
t === ot && (u =
|
|
654
|
+
t === ot && (u = Pt(s, u, e.length), u !== -1 && (f = u + l));
|
|
655
655
|
for (let N; N = s[u += 1]; ) {
|
|
656
|
-
if (t ===
|
|
656
|
+
if (t === Ke && N === "\\") {
|
|
657
657
|
switch (m = u, s[u + 1]) {
|
|
658
658
|
case "x":
|
|
659
659
|
u += 3;
|
|
@@ -671,24 +671,24 @@ function Ve(s, e, t = "flow", { indentAtStart: n, lineWidth: i = 80, minContentW
|
|
|
671
671
|
}
|
|
672
672
|
if (N === `
|
|
673
673
|
`)
|
|
674
|
-
t === ot && (u =
|
|
674
|
+
t === ot && (u = Pt(s, u, e.length)), f = u + e.length + l, h = void 0;
|
|
675
675
|
else {
|
|
676
676
|
if (N === " " && d && d !== " " && d !== `
|
|
677
677
|
` && d !== " ") {
|
|
678
|
-
const
|
|
679
|
-
|
|
680
|
-
` &&
|
|
678
|
+
const S = s[u + 1];
|
|
679
|
+
S && S !== " " && S !== `
|
|
680
|
+
` && S !== " " && (h = u);
|
|
681
681
|
}
|
|
682
682
|
if (u >= f)
|
|
683
683
|
if (h)
|
|
684
684
|
c.push(h), f = h + l, h = void 0;
|
|
685
|
-
else if (t ===
|
|
685
|
+
else if (t === Ke) {
|
|
686
686
|
for (; d === " " || d === " "; )
|
|
687
687
|
d = N, N = s[u += 1], g = !0;
|
|
688
|
-
const
|
|
689
|
-
if (p[
|
|
688
|
+
const S = u > y + 1 ? u - 2 : m - 1;
|
|
689
|
+
if (p[S])
|
|
690
690
|
return s;
|
|
691
|
-
c.push(
|
|
691
|
+
c.push(S), p[S] = !0, f = S + l, h = void 0;
|
|
692
692
|
} else
|
|
693
693
|
g = !0;
|
|
694
694
|
}
|
|
@@ -697,16 +697,16 @@ function Ve(s, e, t = "flow", { indentAtStart: n, lineWidth: i = 80, minContentW
|
|
|
697
697
|
if (g && a && a(), c.length === 0)
|
|
698
698
|
return s;
|
|
699
699
|
o && o();
|
|
700
|
-
let
|
|
700
|
+
let w = s.slice(0, c[0]);
|
|
701
701
|
for (let N = 0; N < c.length; ++N) {
|
|
702
|
-
const
|
|
703
|
-
|
|
704
|
-
${e}${s.slice(0, E)}` : (t ===
|
|
705
|
-
${e}${s.slice(
|
|
702
|
+
const S = c[N], E = c[N + 1] || s.length;
|
|
703
|
+
S === 0 ? w = `
|
|
704
|
+
${e}${s.slice(0, E)}` : (t === Ke && p[S] && (w += `${s[S]}\\`), w += `
|
|
705
|
+
${e}${s.slice(S + 1, E)}`);
|
|
706
706
|
}
|
|
707
|
-
return
|
|
707
|
+
return w;
|
|
708
708
|
}
|
|
709
|
-
function
|
|
709
|
+
function Pt(s, e, t) {
|
|
710
710
|
let n = e, i = e + 1, r = s[i];
|
|
711
711
|
for (; r === " " || r === " "; )
|
|
712
712
|
if (e < i + t)
|
|
@@ -724,8 +724,8 @@ const Je = (s, e) => ({
|
|
|
724
724
|
indentAtStart: e ? s.indent.length : s.indentAtStart,
|
|
725
725
|
lineWidth: s.options.lineWidth,
|
|
726
726
|
minContentWidth: s.options.minContentWidth
|
|
727
|
-
}),
|
|
728
|
-
function
|
|
727
|
+
}), He = (s) => /^(%|---|\.\.\.)/m.test(s);
|
|
728
|
+
function en(s, e, t) {
|
|
729
729
|
if (!e || e < 0)
|
|
730
730
|
return !1;
|
|
731
731
|
const n = e - t, i = s.length;
|
|
@@ -741,11 +741,11 @@ function nn(s, e, t) {
|
|
|
741
741
|
}
|
|
742
742
|
return !0;
|
|
743
743
|
}
|
|
744
|
-
function
|
|
744
|
+
function ke(s, e) {
|
|
745
745
|
const t = JSON.stringify(s);
|
|
746
746
|
if (e.options.doubleQuotedAsJSON)
|
|
747
747
|
return t;
|
|
748
|
-
const { implicitKey: n } = e, i = e.options.doubleQuotedMinMultiLineLength, r = e.indent || (
|
|
748
|
+
const { implicitKey: n } = e, i = e.options.doubleQuotedMinMultiLineLength, r = e.indent || (He(s) ? " " : "");
|
|
749
749
|
let o = "", a = 0;
|
|
750
750
|
for (let l = 0, c = t[l]; c; c = t[++l])
|
|
751
751
|
if (c === " " && t[l + 1] === "\\" && t[l + 2] === "n" && (o += t.slice(a, l) + "\\ ", l += 1, a = l, c = "\\"), c === "\\")
|
|
@@ -800,24 +800,24 @@ function Se(s, e) {
|
|
|
800
800
|
default:
|
|
801
801
|
l += 1;
|
|
802
802
|
}
|
|
803
|
-
return o = a ? o + t.slice(a) : t, n ? o : Ve(o, r,
|
|
803
|
+
return o = a ? o + t.slice(a) : t, n ? o : Ve(o, r, Ke, Je(e, !1));
|
|
804
804
|
}
|
|
805
805
|
function at(s, e) {
|
|
806
806
|
if (e.options.singleQuote === !1 || e.implicitKey && s.includes(`
|
|
807
807
|
`) || /[ \t]\n|\n[ \t]/.test(s))
|
|
808
|
-
return
|
|
809
|
-
const t = e.indent || (
|
|
808
|
+
return ke(s, e);
|
|
809
|
+
const t = e.indent || (He(s) ? " " : ""), n = "'" + s.replace(/'/g, "''").replace(/\n+/g, `$&
|
|
810
810
|
${t}`) + "'";
|
|
811
|
-
return e.implicitKey ? n : Ve(n, t,
|
|
811
|
+
return e.implicitKey ? n : Ve(n, t, is, Je(e, !1));
|
|
812
812
|
}
|
|
813
813
|
function oe(s, e) {
|
|
814
814
|
const { singleQuote: t } = e.options;
|
|
815
815
|
let n;
|
|
816
816
|
if (t === !1)
|
|
817
|
-
n =
|
|
817
|
+
n = ke;
|
|
818
818
|
else {
|
|
819
819
|
const i = s.includes('"'), r = s.includes("'");
|
|
820
|
-
i && !r ? n = at : r && !i ? n =
|
|
820
|
+
i && !r ? n = at : r && !i ? n = ke : n = t ? at : ke;
|
|
821
821
|
}
|
|
822
822
|
return n(s, e);
|
|
823
823
|
}
|
|
@@ -830,11 +830,11 @@ try {
|
|
|
830
830
|
} catch {
|
|
831
831
|
lt = /\n+(?!\n|$)/g;
|
|
832
832
|
}
|
|
833
|
-
function
|
|
833
|
+
function Re({ comment: s, type: e, value: t }, n, i, r) {
|
|
834
834
|
const { blockQuote: o, commentString: a, lineWidth: l } = n.options;
|
|
835
835
|
if (!o || /\n[\t ]+$/.test(t))
|
|
836
836
|
return oe(t, n);
|
|
837
|
-
const c = n.indent || (n.forceBlockIndent ||
|
|
837
|
+
const c = n.indent || (n.forceBlockIndent || He(t) ? " " : ""), p = o === "literal" ? !0 : o === "folded" || e === $.BLOCK_FOLDED ? !1 : e === $.BLOCK_LITERAL ? !0 : !en(t, l, c.length);
|
|
838
838
|
if (!t)
|
|
839
839
|
return p ? `|
|
|
840
840
|
` : `>
|
|
@@ -862,39 +862,39 @@ function Ke({ comment: s, type: e, value: t }, n, i, r) {
|
|
|
862
862
|
else
|
|
863
863
|
break;
|
|
864
864
|
}
|
|
865
|
-
let
|
|
866
|
-
|
|
867
|
-
let
|
|
868
|
-
if (s && (
|
|
865
|
+
let w = t.substring(0, y < m ? y + 1 : m);
|
|
866
|
+
w && (t = t.substring(w.length), w = w.replace(/\n+/g, `$&${c}`));
|
|
867
|
+
let S = (u ? c ? "2" : "1" : "") + f;
|
|
868
|
+
if (s && (S += " " + a(s.replace(/ ?[\r\n]+/g, " ")), i && i()), !p) {
|
|
869
869
|
const E = t.replace(/\n+/g, `
|
|
870
870
|
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, "$1$2").replace(/\n+/g, `$&${c}`);
|
|
871
871
|
let A = !1;
|
|
872
|
-
const
|
|
873
|
-
o !== "folded" && e !==
|
|
872
|
+
const I = Je(n, !0);
|
|
873
|
+
o !== "folded" && e !== $.BLOCK_FOLDED && (I.onOverflow = () => {
|
|
874
874
|
A = !0;
|
|
875
875
|
});
|
|
876
|
-
const
|
|
876
|
+
const k = Ve(`${w}${E}${d}`, c, ot, I);
|
|
877
877
|
if (!A)
|
|
878
|
-
return `>${
|
|
879
|
-
${c}${
|
|
878
|
+
return `>${S}
|
|
879
|
+
${c}${k}`;
|
|
880
880
|
}
|
|
881
|
-
return t = t.replace(/\n+/g, `$&${c}`), `|${
|
|
882
|
-
${c}${
|
|
881
|
+
return t = t.replace(/\n+/g, `$&${c}`), `|${S}
|
|
882
|
+
${c}${w}${t}${d}`;
|
|
883
883
|
}
|
|
884
|
-
function
|
|
884
|
+
function tn(s, e, t, n) {
|
|
885
885
|
const { type: i, value: r } = s, { actualString: o, implicitKey: a, indent: l, indentStep: c, inFlow: p } = e;
|
|
886
886
|
if (a && r.includes(`
|
|
887
887
|
`) || p && /[[\]{},]/.test(r))
|
|
888
888
|
return oe(r, e);
|
|
889
889
|
if (/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))
|
|
890
890
|
return a || p || !r.includes(`
|
|
891
|
-
`) ? oe(r, e) :
|
|
892
|
-
if (!a && !p && i !==
|
|
891
|
+
`) ? oe(r, e) : Re(s, e, t, n);
|
|
892
|
+
if (!a && !p && i !== $.PLAIN && r.includes(`
|
|
893
893
|
`))
|
|
894
|
-
return
|
|
895
|
-
if (
|
|
894
|
+
return Re(s, e, t, n);
|
|
895
|
+
if (He(r)) {
|
|
896
896
|
if (l === "")
|
|
897
|
-
return e.forceBlockIndent = !0,
|
|
897
|
+
return e.forceBlockIndent = !0, Re(s, e, t, n);
|
|
898
898
|
if (a && l === c)
|
|
899
899
|
return oe(r, e);
|
|
900
900
|
}
|
|
@@ -908,23 +908,23 @@ ${l}`);
|
|
|
908
908
|
if (g.some(h) || d != null && d.some(h))
|
|
909
909
|
return oe(r, e);
|
|
910
910
|
}
|
|
911
|
-
return a ? f : Ve(f, l,
|
|
911
|
+
return a ? f : Ve(f, l, is, Je(e, !1));
|
|
912
912
|
}
|
|
913
913
|
function pt(s, e, t, n) {
|
|
914
914
|
const { implicitKey: i, inFlow: r } = e, o = typeof s.value == "string" ? s : Object.assign({}, s, { value: String(s.value) });
|
|
915
915
|
let { type: a } = s;
|
|
916
|
-
a !==
|
|
916
|
+
a !== $.QUOTE_DOUBLE && /[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value) && (a = $.QUOTE_DOUBLE);
|
|
917
917
|
const l = (p) => {
|
|
918
918
|
switch (p) {
|
|
919
|
-
case
|
|
920
|
-
case
|
|
921
|
-
return i || r ? oe(o.value, e) :
|
|
922
|
-
case
|
|
923
|
-
return
|
|
924
|
-
case
|
|
919
|
+
case $.BLOCK_FOLDED:
|
|
920
|
+
case $.BLOCK_LITERAL:
|
|
921
|
+
return i || r ? oe(o.value, e) : Re(o, e, t, n);
|
|
922
|
+
case $.QUOTE_DOUBLE:
|
|
923
|
+
return ke(o.value, e);
|
|
924
|
+
case $.QUOTE_SINGLE:
|
|
925
925
|
return at(o.value, e);
|
|
926
|
-
case
|
|
927
|
-
return
|
|
926
|
+
case $.PLAIN:
|
|
927
|
+
return tn(o, e, t, n);
|
|
928
928
|
default:
|
|
929
929
|
return null;
|
|
930
930
|
}
|
|
@@ -937,10 +937,10 @@ function pt(s, e, t, n) {
|
|
|
937
937
|
}
|
|
938
938
|
return c;
|
|
939
939
|
}
|
|
940
|
-
function
|
|
940
|
+
function rs(s, e) {
|
|
941
941
|
const t = Object.assign({
|
|
942
942
|
blockQuote: !0,
|
|
943
|
-
commentString:
|
|
943
|
+
commentString: Zs,
|
|
944
944
|
defaultKeyType: null,
|
|
945
945
|
defaultStringType: "PLAIN",
|
|
946
946
|
directives: null,
|
|
@@ -979,7 +979,7 @@ function ns(s, e) {
|
|
|
979
979
|
options: t
|
|
980
980
|
};
|
|
981
981
|
}
|
|
982
|
-
function
|
|
982
|
+
function sn(s, e) {
|
|
983
983
|
var i;
|
|
984
984
|
if (e.tag) {
|
|
985
985
|
const r = s.filter((o) => o.tag === e.tag);
|
|
@@ -1006,19 +1006,19 @@ function on(s, e) {
|
|
|
1006
1006
|
}
|
|
1007
1007
|
return t;
|
|
1008
1008
|
}
|
|
1009
|
-
function
|
|
1009
|
+
function nn(s, e, { anchors: t, doc: n }) {
|
|
1010
1010
|
if (!n.directives)
|
|
1011
1011
|
return "";
|
|
1012
1012
|
const i = [], r = (T(s) || L(s)) && s.anchor;
|
|
1013
|
-
r &&
|
|
1013
|
+
r && Zt(r) && (t.add(r), i.push(`&${r}`));
|
|
1014
1014
|
const o = s.tag ?? (e.default ? null : e.tag);
|
|
1015
1015
|
return o && i.push(n.directives.tagString(o)), i.join(" ");
|
|
1016
1016
|
}
|
|
1017
|
-
function
|
|
1017
|
+
function ce(s, e, t, n) {
|
|
1018
1018
|
var l;
|
|
1019
|
-
if (
|
|
1019
|
+
if (v(s))
|
|
1020
1020
|
return s.toString(e, t, n);
|
|
1021
|
-
if (
|
|
1021
|
+
if (he(s)) {
|
|
1022
1022
|
if (e.doc.directives)
|
|
1023
1023
|
return s.toString(e);
|
|
1024
1024
|
if ((l = e.resolvedAliases) != null && l.has(s))
|
|
@@ -1027,31 +1027,31 @@ function fe(s, e, t, n) {
|
|
|
1027
1027
|
}
|
|
1028
1028
|
let i;
|
|
1029
1029
|
const r = C(s) ? s : e.doc.createNode(s, { onTagObj: (c) => i = c });
|
|
1030
|
-
i ?? (i =
|
|
1031
|
-
const o =
|
|
1030
|
+
i ?? (i = sn(e.doc.schema.tags, r));
|
|
1031
|
+
const o = nn(r, i, e);
|
|
1032
1032
|
o.length > 0 && (e.indentAtStart = (e.indentAtStart ?? 0) + o.length + 1);
|
|
1033
1033
|
const a = typeof i.stringify == "function" ? i.stringify(r, e, t, n) : T(r) ? pt(r, e, t, n) : r.toString(e, t, n);
|
|
1034
1034
|
return o ? T(r) || a[0] === "{" || a[0] === "[" ? `${o} ${a}` : `${o}
|
|
1035
1035
|
${e.indent}${a}` : a;
|
|
1036
1036
|
}
|
|
1037
|
-
function
|
|
1037
|
+
function rn({ key: s, value: e }, t, n, i) {
|
|
1038
1038
|
const { allNullValues: r, doc: o, indent: a, indentStep: l, options: { commentString: c, indentSeq: p, simpleKeys: f } } = t;
|
|
1039
1039
|
let h = C(s) && s.comment || null;
|
|
1040
1040
|
if (f) {
|
|
1041
1041
|
if (h)
|
|
1042
1042
|
throw new Error("With simple keys, key nodes cannot have comments");
|
|
1043
1043
|
if (L(s) || !C(s) && typeof s == "object") {
|
|
1044
|
-
const
|
|
1045
|
-
throw new Error(
|
|
1044
|
+
const I = "With simple keys, collection cannot be used as a key value";
|
|
1045
|
+
throw new Error(I);
|
|
1046
1046
|
}
|
|
1047
1047
|
}
|
|
1048
|
-
let d = !f && (!s || h && e == null && !t.inFlow || L(s) || (T(s) ? s.type ===
|
|
1048
|
+
let d = !f && (!s || h && e == null && !t.inFlow || L(s) || (T(s) ? s.type === $.BLOCK_FOLDED || s.type === $.BLOCK_LITERAL : typeof s == "object"));
|
|
1049
1049
|
t = Object.assign({}, t, {
|
|
1050
1050
|
allNullValues: !1,
|
|
1051
1051
|
implicitKey: !d && (f || !r),
|
|
1052
1052
|
indent: a + l
|
|
1053
1053
|
});
|
|
1054
|
-
let g = !1, u = !1, m =
|
|
1054
|
+
let g = !1, u = !1, m = ce(s, t, () => g = !0, () => u = !0);
|
|
1055
1055
|
if (!d && !t.inFlow && m.length > 1024) {
|
|
1056
1056
|
if (f)
|
|
1057
1057
|
throw new Error("With simple keys, single line scalar must not span more than 1024 characters");
|
|
@@ -1064,17 +1064,17 @@ function ln({ key: s, value: e }, t, n, i) {
|
|
|
1064
1064
|
return m = `? ${m}`, h && !g ? m += Z(m, t.indent, c(h)) : u && i && i(), m;
|
|
1065
1065
|
g && (h = null), d ? (h && (m += Z(m, t.indent, c(h))), m = `? ${m}
|
|
1066
1066
|
${a}:`) : (m = `${m}:`, h && (m += Z(m, t.indent, c(h))));
|
|
1067
|
-
let y,
|
|
1068
|
-
C(e) ? (y = !!e.spaceBefore,
|
|
1069
|
-
let
|
|
1070
|
-
const E =
|
|
1067
|
+
let y, w, N;
|
|
1068
|
+
C(e) ? (y = !!e.spaceBefore, w = e.commentBefore, N = e.comment) : (y = !1, w = null, N = null, e && typeof e == "object" && (e = o.createNode(e))), t.implicitKey = !1, !d && !h && T(e) && (t.indentAtStart = m.length + 1), u = !1, !p && l.length >= 2 && !t.inFlow && !d && Oe(e) && !e.flow && !e.tag && !e.anchor && (t.indent = t.indent.substring(2));
|
|
1069
|
+
let S = !1;
|
|
1070
|
+
const E = ce(e, t, () => S = !0, () => u = !0);
|
|
1071
1071
|
let A = " ";
|
|
1072
|
-
if (h || y ||
|
|
1072
|
+
if (h || y || w) {
|
|
1073
1073
|
if (A = y ? `
|
|
1074
|
-
` : "",
|
|
1075
|
-
const
|
|
1074
|
+
` : "", w) {
|
|
1075
|
+
const I = c(w);
|
|
1076
1076
|
A += `
|
|
1077
|
-
${
|
|
1077
|
+
${H(I, t.indent)}`;
|
|
1078
1078
|
}
|
|
1079
1079
|
E === "" && !t.inFlow ? A === `
|
|
1080
1080
|
` && N && (A = `
|
|
@@ -1082,48 +1082,48 @@ ${W($, t.indent)}`;
|
|
|
1082
1082
|
`) : A += `
|
|
1083
1083
|
${t.indent}`;
|
|
1084
1084
|
} else if (!d && L(e)) {
|
|
1085
|
-
const
|
|
1086
|
-
`), O =
|
|
1085
|
+
const I = E[0], k = E.indexOf(`
|
|
1086
|
+
`), O = k !== -1, P = t.inFlow ?? e.flow ?? e.items.length === 0;
|
|
1087
1087
|
if (O || !P) {
|
|
1088
1088
|
let J = !1;
|
|
1089
|
-
if (O && (
|
|
1089
|
+
if (O && (I === "&" || I === "!")) {
|
|
1090
1090
|
let R = E.indexOf(" ");
|
|
1091
|
-
|
|
1091
|
+
I === "&" && R !== -1 && R < k && E[R + 1] === "!" && (R = E.indexOf(" ", R + 1)), (R === -1 || k < R) && (J = !0);
|
|
1092
1092
|
}
|
|
1093
1093
|
J || (A = `
|
|
1094
1094
|
${t.indent}`);
|
|
1095
1095
|
}
|
|
1096
1096
|
} else (E === "" || E[0] === `
|
|
1097
1097
|
`) && (A = "");
|
|
1098
|
-
return m += A + E, t.inFlow ?
|
|
1098
|
+
return m += A + E, t.inFlow ? S && n && n() : N && !S ? m += Z(m, t.indent, c(N)) : u && i && i(), m;
|
|
1099
1099
|
}
|
|
1100
|
-
function
|
|
1100
|
+
function os(s, e) {
|
|
1101
1101
|
(s === "debug" || s === "warn") && console.warn(e);
|
|
1102
1102
|
}
|
|
1103
|
-
const
|
|
1104
|
-
identify: (s) => s ===
|
|
1103
|
+
const ve = "<<", W = {
|
|
1104
|
+
identify: (s) => s === ve || typeof s == "symbol" && s.description === ve,
|
|
1105
1105
|
default: "key",
|
|
1106
1106
|
tag: "tag:yaml.org,2002:merge",
|
|
1107
1107
|
test: /^<<$/,
|
|
1108
|
-
resolve: () => Object.assign(new
|
|
1109
|
-
addToJSMap:
|
|
1108
|
+
resolve: () => Object.assign(new $(Symbol(ve)), {
|
|
1109
|
+
addToJSMap: as
|
|
1110
1110
|
}),
|
|
1111
|
-
stringify: () =>
|
|
1112
|
-
},
|
|
1113
|
-
function
|
|
1114
|
-
const n =
|
|
1115
|
-
if (
|
|
1111
|
+
stringify: () => ve
|
|
1112
|
+
}, on = (s, e) => (W.identify(e) || T(e) && (!e.type || e.type === $.PLAIN) && W.identify(e.value)) && (s == null ? void 0 : s.doc.schema.tags.some((t) => t.tag === W.tag && t.default));
|
|
1113
|
+
function as(s, e, t) {
|
|
1114
|
+
const n = ls(s, t);
|
|
1115
|
+
if (Oe(n))
|
|
1116
1116
|
for (const i of n.items)
|
|
1117
|
-
|
|
1117
|
+
Ze(s, e, i);
|
|
1118
1118
|
else if (Array.isArray(n))
|
|
1119
1119
|
for (const i of n)
|
|
1120
|
-
|
|
1120
|
+
Ze(s, e, i);
|
|
1121
1121
|
else
|
|
1122
|
-
|
|
1122
|
+
Ze(s, e, n);
|
|
1123
1123
|
}
|
|
1124
|
-
function
|
|
1125
|
-
const n =
|
|
1126
|
-
if (
|
|
1124
|
+
function Ze(s, e, t) {
|
|
1125
|
+
const n = ls(s, t);
|
|
1126
|
+
if (!Ae(n))
|
|
1127
1127
|
throw new Error("Merge sources must be maps or map aliases");
|
|
1128
1128
|
const i = n.toJSON(null, s, Map);
|
|
1129
1129
|
for (const [r, o] of i)
|
|
@@ -1135,22 +1135,22 @@ function xe(s, e, t) {
|
|
|
1135
1135
|
});
|
|
1136
1136
|
return e;
|
|
1137
1137
|
}
|
|
1138
|
-
function
|
|
1139
|
-
return s &&
|
|
1138
|
+
function ls(s, e) {
|
|
1139
|
+
return s && he(e) ? e.resolve(s.doc, s) : e;
|
|
1140
1140
|
}
|
|
1141
|
-
function
|
|
1141
|
+
function cs(s, e, { key: t, value: n }) {
|
|
1142
1142
|
if (C(t) && t.addToJSMap)
|
|
1143
1143
|
t.addToJSMap(s, e, n);
|
|
1144
|
-
else if (
|
|
1145
|
-
|
|
1144
|
+
else if (on(s, t))
|
|
1145
|
+
as(s, e, n);
|
|
1146
1146
|
else {
|
|
1147
|
-
const i =
|
|
1147
|
+
const i = B(t, "", s);
|
|
1148
1148
|
if (e instanceof Map)
|
|
1149
|
-
e.set(i,
|
|
1149
|
+
e.set(i, B(n, i, s));
|
|
1150
1150
|
else if (e instanceof Set)
|
|
1151
1151
|
e.add(i);
|
|
1152
1152
|
else {
|
|
1153
|
-
const r =
|
|
1153
|
+
const r = an(t, i, s), o = B(n, r, s);
|
|
1154
1154
|
r in e ? Object.defineProperty(e, r, {
|
|
1155
1155
|
value: o,
|
|
1156
1156
|
writable: !0,
|
|
@@ -1161,13 +1161,13 @@ function as(s, e, { key: t, value: n }) {
|
|
|
1161
1161
|
}
|
|
1162
1162
|
return e;
|
|
1163
1163
|
}
|
|
1164
|
-
function
|
|
1164
|
+
function an(s, e, t) {
|
|
1165
1165
|
if (e === null)
|
|
1166
1166
|
return "";
|
|
1167
1167
|
if (typeof e != "object")
|
|
1168
1168
|
return String(e);
|
|
1169
1169
|
if (C(s) && (t != null && t.doc)) {
|
|
1170
|
-
const n =
|
|
1170
|
+
const n = rs(t.doc, {});
|
|
1171
1171
|
n.anchors = /* @__PURE__ */ new Set();
|
|
1172
1172
|
for (const r of t.anchors.keys())
|
|
1173
1173
|
n.anchors.add(r.anchor);
|
|
@@ -1175,7 +1175,7 @@ function fn(s, e, t) {
|
|
|
1175
1175
|
const i = s.toString(n);
|
|
1176
1176
|
if (!t.mapKeyWarned) {
|
|
1177
1177
|
let r = JSON.stringify(i);
|
|
1178
|
-
r.length > 40 && (r = r.substring(0, 36) + '..."'),
|
|
1178
|
+
r.length > 40 && (r = r.substring(0, 36) + '..."'), os(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;
|
|
1179
1179
|
}
|
|
1180
1180
|
return i;
|
|
1181
1181
|
}
|
|
@@ -1183,28 +1183,28 @@ function fn(s, e, t) {
|
|
|
1183
1183
|
}
|
|
1184
1184
|
function mt(s, e, t) {
|
|
1185
1185
|
const n = Ne(s, void 0, t), i = Ne(e, void 0, t);
|
|
1186
|
-
return new
|
|
1186
|
+
return new M(n, i);
|
|
1187
1187
|
}
|
|
1188
|
-
class
|
|
1188
|
+
class M {
|
|
1189
1189
|
constructor(e, t = null) {
|
|
1190
|
-
Object.defineProperty(this, K, { value:
|
|
1190
|
+
Object.defineProperty(this, K, { value: zt }), this.key = e, this.value = t;
|
|
1191
1191
|
}
|
|
1192
1192
|
clone(e) {
|
|
1193
1193
|
let { key: t, value: n } = this;
|
|
1194
|
-
return C(t) && (t = t.clone(e)), C(n) && (n = n.clone(e)), new
|
|
1194
|
+
return C(t) && (t = t.clone(e)), C(n) && (n = n.clone(e)), new M(t, n);
|
|
1195
1195
|
}
|
|
1196
1196
|
toJSON(e, t) {
|
|
1197
1197
|
const n = t != null && t.mapAsMap ? /* @__PURE__ */ new Map() : {};
|
|
1198
|
-
return
|
|
1198
|
+
return cs(t, n, this);
|
|
1199
1199
|
}
|
|
1200
1200
|
toString(e, t, n) {
|
|
1201
|
-
return e != null && e.doc ?
|
|
1201
|
+
return e != null && e.doc ? rn(this, e, t, n) : JSON.stringify(this);
|
|
1202
1202
|
}
|
|
1203
1203
|
}
|
|
1204
|
-
function
|
|
1205
|
-
return (e.inFlow ?? s.flow ?
|
|
1204
|
+
function fs(s, e, t) {
|
|
1205
|
+
return (e.inFlow ?? s.flow ? cn : ln)(s, e, t);
|
|
1206
1206
|
}
|
|
1207
|
-
function
|
|
1207
|
+
function ln({ comment: s, items: e }, t, { blockItemPrefix: n, flowChars: i, itemIndent: r, onChompKeep: o, onComment: a }) {
|
|
1208
1208
|
const { indent: l, options: { commentString: c } } = t, p = Object.assign({}, t, { indent: r, type: null });
|
|
1209
1209
|
let f = !1;
|
|
1210
1210
|
const h = [];
|
|
@@ -1212,13 +1212,13 @@ function un({ comment: s, items: e }, t, { blockItemPrefix: n, flowChars: i, ite
|
|
|
1212
1212
|
const u = e[g];
|
|
1213
1213
|
let m = null;
|
|
1214
1214
|
if (C(u))
|
|
1215
|
-
!f && u.spaceBefore && h.push(""),
|
|
1216
|
-
else if (
|
|
1217
|
-
const
|
|
1218
|
-
|
|
1215
|
+
!f && u.spaceBefore && h.push(""), qe(t, h, u.commentBefore, f), u.comment && (m = u.comment);
|
|
1216
|
+
else if (v(u)) {
|
|
1217
|
+
const w = C(u.key) ? u.key : null;
|
|
1218
|
+
w && (!f && w.spaceBefore && h.push(""), qe(t, h, w.commentBefore, f));
|
|
1219
1219
|
}
|
|
1220
1220
|
f = !1;
|
|
1221
|
-
let y =
|
|
1221
|
+
let y = ce(u, p, () => m = null, () => f = !0);
|
|
1222
1222
|
m && (y += Z(y, r, c(m))), f && m && (f = !1), h.push(n + y);
|
|
1223
1223
|
}
|
|
1224
1224
|
let d;
|
|
@@ -1234,9 +1234,9 @@ ${l}${u}` : `
|
|
|
1234
1234
|
}
|
|
1235
1235
|
}
|
|
1236
1236
|
return s ? (d += `
|
|
1237
|
-
` +
|
|
1237
|
+
` + H(c(s), l), a && a()) : f && o && o(), d;
|
|
1238
1238
|
}
|
|
1239
|
-
function
|
|
1239
|
+
function cn({ items: s }, e, { flowChars: t, itemIndent: n }) {
|
|
1240
1240
|
const { indent: i, indentStep: r, flowCollectionPadding: o, options: { commentString: a } } = e;
|
|
1241
1241
|
n += r;
|
|
1242
1242
|
const l = Object.assign({}, e, {
|
|
@@ -1250,17 +1250,17 @@ function hn({ items: s }, e, { flowChars: t, itemIndent: n }) {
|
|
|
1250
1250
|
const u = s[g];
|
|
1251
1251
|
let m = null;
|
|
1252
1252
|
if (C(u))
|
|
1253
|
-
u.spaceBefore && f.push(""),
|
|
1254
|
-
else if (
|
|
1255
|
-
const
|
|
1256
|
-
|
|
1253
|
+
u.spaceBefore && f.push(""), qe(e, f, u.commentBefore, !1), u.comment && (m = u.comment);
|
|
1254
|
+
else if (v(u)) {
|
|
1255
|
+
const w = C(u.key) ? u.key : null;
|
|
1256
|
+
w && (w.spaceBefore && f.push(""), qe(e, f, w.commentBefore, !1), w.comment && (c = !0));
|
|
1257
1257
|
const N = C(u.value) ? u.value : null;
|
|
1258
|
-
N ? (N.comment && (m = N.comment), N.commentBefore && (c = !0)) : u.value == null && (
|
|
1258
|
+
N ? (N.comment && (m = N.comment), N.commentBefore && (c = !0)) : u.value == null && (w != null && w.comment) && (m = w.comment);
|
|
1259
1259
|
}
|
|
1260
1260
|
m && (c = !0);
|
|
1261
|
-
let y =
|
|
1261
|
+
let y = ce(u, l, () => m = null);
|
|
1262
1262
|
c || (c = f.length > p || y.includes(`
|
|
1263
|
-
`)), g < s.length - 1 ? y += "," : e.options.trailingComma && (e.options.lineWidth > 0 && (c || (c = f.reduce((
|
|
1263
|
+
`)), g < s.length - 1 ? y += "," : e.options.trailingComma && (e.options.lineWidth > 0 && (c || (c = f.reduce((w, N) => w + N.length + 2, 2) + (y.length + 2) > e.options.lineWidth)), c && (y += ",")), m && (y += Z(y, n, a(m))), f.push(y), p = f.length;
|
|
1264
1264
|
}
|
|
1265
1265
|
const { start: h, end: d } = t;
|
|
1266
1266
|
if (f.length === 0)
|
|
@@ -1280,24 +1280,24 @@ ${i}${d}`;
|
|
|
1280
1280
|
} else
|
|
1281
1281
|
return `${h}${o}${f.join(" ")}${o}${d}`;
|
|
1282
1282
|
}
|
|
1283
|
-
function
|
|
1283
|
+
function qe({ indent: s, options: { commentString: e } }, t, n, i) {
|
|
1284
1284
|
if (n && i && (n = n.replace(/^\n+/, "")), n) {
|
|
1285
|
-
const r =
|
|
1285
|
+
const r = H(e(n), s);
|
|
1286
1286
|
t.push(r.trimStart());
|
|
1287
1287
|
}
|
|
1288
1288
|
}
|
|
1289
|
-
function
|
|
1289
|
+
function ee(s, e) {
|
|
1290
1290
|
const t = T(e) ? e.value : e;
|
|
1291
1291
|
for (const n of s)
|
|
1292
|
-
if (
|
|
1292
|
+
if (v(n) && (n.key === e || n.key === t || T(n.key) && n.key.value === t))
|
|
1293
1293
|
return n;
|
|
1294
1294
|
}
|
|
1295
|
-
class
|
|
1295
|
+
class j extends ns {
|
|
1296
1296
|
static get tagName() {
|
|
1297
1297
|
return "tag:yaml.org,2002:map";
|
|
1298
1298
|
}
|
|
1299
1299
|
constructor(e) {
|
|
1300
|
-
super(
|
|
1300
|
+
super(z, e), this.items = [];
|
|
1301
1301
|
}
|
|
1302
1302
|
/**
|
|
1303
1303
|
* A generic collection parsing method that can be extended
|
|
@@ -1328,12 +1328,12 @@ class M extends ts {
|
|
|
1328
1328
|
add(e, t) {
|
|
1329
1329
|
var o;
|
|
1330
1330
|
let n;
|
|
1331
|
-
|
|
1332
|
-
const i =
|
|
1331
|
+
v(e) ? n = e : !e || typeof e != "object" || !("key" in e) ? n = new M(e, e == null ? void 0 : e.value) : n = new M(e.key, e.value);
|
|
1332
|
+
const i = ee(this.items, n.key), r = (o = this.schema) == null ? void 0 : o.sortMapEntries;
|
|
1333
1333
|
if (i) {
|
|
1334
1334
|
if (!t)
|
|
1335
1335
|
throw new Error(`Key ${n.key} already set`);
|
|
1336
|
-
T(i.value) &&
|
|
1336
|
+
T(i.value) && ss(n.value) ? i.value.value = n.value : i.value = n.value;
|
|
1337
1337
|
} else if (r) {
|
|
1338
1338
|
const a = this.items.findIndex((l) => r(n, l) < 0);
|
|
1339
1339
|
a === -1 ? this.items.push(n) : this.items.splice(a, 0, n);
|
|
@@ -1341,18 +1341,18 @@ class M extends ts {
|
|
|
1341
1341
|
this.items.push(n);
|
|
1342
1342
|
}
|
|
1343
1343
|
delete(e) {
|
|
1344
|
-
const t =
|
|
1344
|
+
const t = ee(this.items, e);
|
|
1345
1345
|
return t ? this.items.splice(this.items.indexOf(t), 1).length > 0 : !1;
|
|
1346
1346
|
}
|
|
1347
1347
|
get(e, t) {
|
|
1348
|
-
const n =
|
|
1348
|
+
const n = ee(this.items, e), i = n == null ? void 0 : n.value;
|
|
1349
1349
|
return (!t && T(i) ? i.value : i) ?? void 0;
|
|
1350
1350
|
}
|
|
1351
1351
|
has(e) {
|
|
1352
|
-
return !!
|
|
1352
|
+
return !!ee(this.items, e);
|
|
1353
1353
|
}
|
|
1354
1354
|
set(e, t) {
|
|
1355
|
-
this.add(new
|
|
1355
|
+
this.add(new M(e, t), !0);
|
|
1356
1356
|
}
|
|
1357
1357
|
/**
|
|
1358
1358
|
* @param ctx - Conversion context, originally set in Document#toJS()
|
|
@@ -1363,16 +1363,16 @@ class M extends ts {
|
|
|
1363
1363
|
const i = n ? new n() : t != null && t.mapAsMap ? /* @__PURE__ */ new Map() : {};
|
|
1364
1364
|
t != null && t.onCreate && t.onCreate(i);
|
|
1365
1365
|
for (const r of this.items)
|
|
1366
|
-
|
|
1366
|
+
cs(t, i, r);
|
|
1367
1367
|
return i;
|
|
1368
1368
|
}
|
|
1369
1369
|
toString(e, t, n) {
|
|
1370
1370
|
if (!e)
|
|
1371
1371
|
return JSON.stringify(this);
|
|
1372
1372
|
for (const i of this.items)
|
|
1373
|
-
if (!
|
|
1373
|
+
if (!v(i))
|
|
1374
1374
|
throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);
|
|
1375
|
-
return !e.allNullValues && this.hasAllNullValues(!1) && (e = Object.assign({}, e, { allNullValues: !0 })),
|
|
1375
|
+
return !e.allNullValues && this.hasAllNullValues(!1) && (e = Object.assign({}, e, { allNullValues: !0 })), fs(this, e, {
|
|
1376
1376
|
blockItemPrefix: "",
|
|
1377
1377
|
flowChars: { start: "{", end: "}" },
|
|
1378
1378
|
itemIndent: e.indent || "",
|
|
@@ -1381,22 +1381,22 @@ class M extends ts {
|
|
|
1381
1381
|
});
|
|
1382
1382
|
}
|
|
1383
1383
|
}
|
|
1384
|
-
const
|
|
1384
|
+
const pe = {
|
|
1385
1385
|
collection: "map",
|
|
1386
1386
|
default: !0,
|
|
1387
|
-
nodeClass:
|
|
1387
|
+
nodeClass: j,
|
|
1388
1388
|
tag: "tag:yaml.org,2002:map",
|
|
1389
1389
|
resolve(s, e) {
|
|
1390
|
-
return
|
|
1390
|
+
return Ae(s) || e("Expected a mapping for this tag"), s;
|
|
1391
1391
|
},
|
|
1392
|
-
createNode: (s, e, t) =>
|
|
1392
|
+
createNode: (s, e, t) => j.from(s, e, t)
|
|
1393
1393
|
};
|
|
1394
|
-
class te extends
|
|
1394
|
+
class te extends ns {
|
|
1395
1395
|
static get tagName() {
|
|
1396
1396
|
return "tag:yaml.org,2002:seq";
|
|
1397
1397
|
}
|
|
1398
1398
|
constructor(e) {
|
|
1399
|
-
super(
|
|
1399
|
+
super(ue, e), this.items = [];
|
|
1400
1400
|
}
|
|
1401
1401
|
add(e) {
|
|
1402
1402
|
this.items.push(e);
|
|
@@ -1442,18 +1442,18 @@ class te extends ts {
|
|
|
1442
1442
|
if (typeof n != "number")
|
|
1443
1443
|
throw new Error(`Expected a valid index, not ${e}.`);
|
|
1444
1444
|
const i = this.items[n];
|
|
1445
|
-
T(i) &&
|
|
1445
|
+
T(i) && ss(t) ? i.value = t : this.items[n] = t;
|
|
1446
1446
|
}
|
|
1447
1447
|
toJSON(e, t) {
|
|
1448
1448
|
const n = [];
|
|
1449
1449
|
t != null && t.onCreate && t.onCreate(n);
|
|
1450
1450
|
let i = 0;
|
|
1451
1451
|
for (const r of this.items)
|
|
1452
|
-
n.push(
|
|
1452
|
+
n.push(B(r, String(i++), t));
|
|
1453
1453
|
return n;
|
|
1454
1454
|
}
|
|
1455
1455
|
toString(e, t, n) {
|
|
1456
|
-
return e ?
|
|
1456
|
+
return e ? fs(this, e, {
|
|
1457
1457
|
blockItemPrefix: "- ",
|
|
1458
1458
|
flowChars: { start: "[", end: "]" },
|
|
1459
1459
|
itemIndent: (e.indent || "") + " ",
|
|
@@ -1480,16 +1480,16 @@ function _e(s) {
|
|
|
1480
1480
|
let e = T(s) ? s.value : s;
|
|
1481
1481
|
return e && typeof e == "string" && (e = Number(e)), typeof e == "number" && Number.isInteger(e) && e >= 0 ? e : null;
|
|
1482
1482
|
}
|
|
1483
|
-
const
|
|
1483
|
+
const me = {
|
|
1484
1484
|
collection: "seq",
|
|
1485
1485
|
default: !0,
|
|
1486
1486
|
nodeClass: te,
|
|
1487
1487
|
tag: "tag:yaml.org,2002:seq",
|
|
1488
1488
|
resolve(s, e) {
|
|
1489
|
-
return
|
|
1489
|
+
return Oe(s) || e("Expected a sequence for this tag"), s;
|
|
1490
1490
|
},
|
|
1491
1491
|
createNode: (s, e, t) => te.from(s, e, t)
|
|
1492
|
-
},
|
|
1492
|
+
}, Ge = {
|
|
1493
1493
|
identify: (s) => typeof s == "string",
|
|
1494
1494
|
default: !0,
|
|
1495
1495
|
tag: "tag:yaml.org,2002:str",
|
|
@@ -1497,20 +1497,20 @@ const ge = {
|
|
|
1497
1497
|
stringify(s, e, t, n) {
|
|
1498
1498
|
return e = Object.assign({ actualString: !0 }, e), pt(s, e, t, n);
|
|
1499
1499
|
}
|
|
1500
|
-
},
|
|
1500
|
+
}, We = {
|
|
1501
1501
|
identify: (s) => s == null,
|
|
1502
|
-
createNode: () => new
|
|
1502
|
+
createNode: () => new $(null),
|
|
1503
1503
|
default: !0,
|
|
1504
1504
|
tag: "tag:yaml.org,2002:null",
|
|
1505
1505
|
test: /^(?:~|[Nn]ull|NULL)?$/,
|
|
1506
|
-
resolve: () => new
|
|
1507
|
-
stringify: ({ source: s }, e) => typeof s == "string" &&
|
|
1506
|
+
resolve: () => new $(null),
|
|
1507
|
+
stringify: ({ source: s }, e) => typeof s == "string" && We.test.test(s) ? s : e.options.nullStr
|
|
1508
1508
|
}, gt = {
|
|
1509
1509
|
identify: (s) => typeof s == "boolean",
|
|
1510
1510
|
default: !0,
|
|
1511
1511
|
tag: "tag:yaml.org,2002:bool",
|
|
1512
1512
|
test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
|
|
1513
|
-
resolve: (s) => new
|
|
1513
|
+
resolve: (s) => new $(s[0] === "t" || s[0] === "T"),
|
|
1514
1514
|
stringify({ source: s, value: e }, t) {
|
|
1515
1515
|
if (s && gt.test.test(s)) {
|
|
1516
1516
|
const n = s[0] === "t" || s[0] === "T";
|
|
@@ -1536,14 +1536,14 @@ function U({ format: s, minFractionDigits: e, tag: t, value: n }) {
|
|
|
1536
1536
|
}
|
|
1537
1537
|
return r;
|
|
1538
1538
|
}
|
|
1539
|
-
const
|
|
1539
|
+
const us = {
|
|
1540
1540
|
identify: (s) => typeof s == "number",
|
|
1541
1541
|
default: !0,
|
|
1542
1542
|
tag: "tag:yaml.org,2002:float",
|
|
1543
1543
|
test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
|
|
1544
1544
|
resolve: (s) => s.slice(-3).toLowerCase() === "nan" ? NaN : s[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
|
|
1545
1545
|
stringify: U
|
|
1546
|
-
},
|
|
1546
|
+
}, hs = {
|
|
1547
1547
|
identify: (s) => typeof s == "number",
|
|
1548
1548
|
default: !0,
|
|
1549
1549
|
tag: "tag:yaml.org,2002:float",
|
|
@@ -1554,76 +1554,76 @@ const cs = {
|
|
|
1554
1554
|
const e = Number(s.value);
|
|
1555
1555
|
return isFinite(e) ? e.toExponential() : U(s);
|
|
1556
1556
|
}
|
|
1557
|
-
},
|
|
1557
|
+
}, ds = {
|
|
1558
1558
|
identify: (s) => typeof s == "number",
|
|
1559
1559
|
default: !0,
|
|
1560
1560
|
tag: "tag:yaml.org,2002:float",
|
|
1561
1561
|
test: /^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,
|
|
1562
1562
|
resolve(s) {
|
|
1563
|
-
const e = new
|
|
1563
|
+
const e = new $(parseFloat(s)), t = s.indexOf(".");
|
|
1564
1564
|
return t !== -1 && s[s.length - 1] === "0" && (e.minFractionDigits = s.length - t - 1), e;
|
|
1565
1565
|
},
|
|
1566
1566
|
stringify: U
|
|
1567
1567
|
}, Qe = (s) => typeof s == "bigint" || Number.isInteger(s), yt = (s, e, t, { intAsBigInt: n }) => n ? BigInt(s) : parseInt(s.substring(e), t);
|
|
1568
|
-
function
|
|
1568
|
+
function ps(s, e, t) {
|
|
1569
1569
|
const { value: n } = s;
|
|
1570
1570
|
return Qe(n) && n >= 0 ? t + n.toString(e) : U(s);
|
|
1571
1571
|
}
|
|
1572
|
-
const
|
|
1572
|
+
const ms = {
|
|
1573
1573
|
identify: (s) => Qe(s) && s >= 0,
|
|
1574
1574
|
default: !0,
|
|
1575
1575
|
tag: "tag:yaml.org,2002:int",
|
|
1576
1576
|
format: "OCT",
|
|
1577
1577
|
test: /^0o[0-7]+$/,
|
|
1578
1578
|
resolve: (s, e, t) => yt(s, 2, 8, t),
|
|
1579
|
-
stringify: (s) =>
|
|
1580
|
-
},
|
|
1579
|
+
stringify: (s) => ps(s, 8, "0o")
|
|
1580
|
+
}, gs = {
|
|
1581
1581
|
identify: Qe,
|
|
1582
1582
|
default: !0,
|
|
1583
1583
|
tag: "tag:yaml.org,2002:int",
|
|
1584
1584
|
test: /^[-+]?[0-9]+$/,
|
|
1585
1585
|
resolve: (s, e, t) => yt(s, 0, 10, t),
|
|
1586
1586
|
stringify: U
|
|
1587
|
-
},
|
|
1587
|
+
}, ys = {
|
|
1588
1588
|
identify: (s) => Qe(s) && s >= 0,
|
|
1589
1589
|
default: !0,
|
|
1590
1590
|
tag: "tag:yaml.org,2002:int",
|
|
1591
1591
|
format: "HEX",
|
|
1592
1592
|
test: /^0x[0-9a-fA-F]+$/,
|
|
1593
1593
|
resolve: (s, e, t) => yt(s, 2, 16, t),
|
|
1594
|
-
stringify: (s) =>
|
|
1595
|
-
},
|
|
1594
|
+
stringify: (s) => ps(s, 16, "0x")
|
|
1595
|
+
}, fn = [
|
|
1596
|
+
pe,
|
|
1596
1597
|
me,
|
|
1597
|
-
|
|
1598
|
+
Ge,
|
|
1598
1599
|
We,
|
|
1599
|
-
He,
|
|
1600
1600
|
gt,
|
|
1601
|
-
ds,
|
|
1602
|
-
ps,
|
|
1603
1601
|
ms,
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
us
|
|
1602
|
+
gs,
|
|
1603
|
+
ys,
|
|
1604
|
+
us,
|
|
1605
|
+
hs,
|
|
1606
|
+
ds
|
|
1607
1607
|
];
|
|
1608
|
-
function
|
|
1608
|
+
function Dt(s) {
|
|
1609
1609
|
return typeof s == "bigint" || Number.isInteger(s);
|
|
1610
1610
|
}
|
|
1611
|
-
const
|
|
1611
|
+
const Pe = ({ value: s }) => JSON.stringify(s), un = [
|
|
1612
1612
|
{
|
|
1613
1613
|
identify: (s) => typeof s == "string",
|
|
1614
1614
|
default: !0,
|
|
1615
1615
|
tag: "tag:yaml.org,2002:str",
|
|
1616
1616
|
resolve: (s) => s,
|
|
1617
|
-
stringify:
|
|
1617
|
+
stringify: Pe
|
|
1618
1618
|
},
|
|
1619
1619
|
{
|
|
1620
1620
|
identify: (s) => s == null,
|
|
1621
|
-
createNode: () => new
|
|
1621
|
+
createNode: () => new $(null),
|
|
1622
1622
|
default: !0,
|
|
1623
1623
|
tag: "tag:yaml.org,2002:null",
|
|
1624
1624
|
test: /^null$/,
|
|
1625
1625
|
resolve: () => null,
|
|
1626
|
-
stringify:
|
|
1626
|
+
stringify: Pe
|
|
1627
1627
|
},
|
|
1628
1628
|
{
|
|
1629
1629
|
identify: (s) => typeof s == "boolean",
|
|
@@ -1631,15 +1631,15 @@ const ve = ({ value: s }) => JSON.stringify(s), pn = [
|
|
|
1631
1631
|
tag: "tag:yaml.org,2002:bool",
|
|
1632
1632
|
test: /^true$|^false$/,
|
|
1633
1633
|
resolve: (s) => s === "true",
|
|
1634
|
-
stringify:
|
|
1634
|
+
stringify: Pe
|
|
1635
1635
|
},
|
|
1636
1636
|
{
|
|
1637
|
-
identify:
|
|
1637
|
+
identify: Dt,
|
|
1638
1638
|
default: !0,
|
|
1639
1639
|
tag: "tag:yaml.org,2002:int",
|
|
1640
1640
|
test: /^-?(?:0|[1-9][0-9]*)$/,
|
|
1641
1641
|
resolve: (s, e, { intAsBigInt: t }) => t ? BigInt(s) : parseInt(s, 10),
|
|
1642
|
-
stringify: ({ value: s }) =>
|
|
1642
|
+
stringify: ({ value: s }) => Dt(s) ? s.toString() : JSON.stringify(s)
|
|
1643
1643
|
},
|
|
1644
1644
|
{
|
|
1645
1645
|
identify: (s) => typeof s == "number",
|
|
@@ -1647,16 +1647,16 @@ const ve = ({ value: s }) => JSON.stringify(s), pn = [
|
|
|
1647
1647
|
tag: "tag:yaml.org,2002:float",
|
|
1648
1648
|
test: /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,
|
|
1649
1649
|
resolve: (s) => parseFloat(s),
|
|
1650
|
-
stringify:
|
|
1650
|
+
stringify: Pe
|
|
1651
1651
|
}
|
|
1652
|
-
],
|
|
1652
|
+
], hn = {
|
|
1653
1653
|
default: !0,
|
|
1654
1654
|
tag: "",
|
|
1655
1655
|
test: /^/,
|
|
1656
1656
|
resolve(s, e) {
|
|
1657
1657
|
return e(`Unresolved plain scalar ${JSON.stringify(s)}`), s;
|
|
1658
1658
|
}
|
|
1659
|
-
},
|
|
1659
|
+
}, dn = [pe, me].concat(un, hn), bt = {
|
|
1660
1660
|
identify: (s) => s instanceof Uint8Array,
|
|
1661
1661
|
// Buffer inherits from Uint8Array
|
|
1662
1662
|
default: !1,
|
|
@@ -1690,24 +1690,24 @@ const ve = ({ value: s }) => JSON.stringify(s), pn = [
|
|
|
1690
1690
|
a = btoa(l);
|
|
1691
1691
|
} else
|
|
1692
1692
|
throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");
|
|
1693
|
-
if (e ?? (e =
|
|
1693
|
+
if (e ?? (e = $.BLOCK_LITERAL), e !== $.QUOTE_DOUBLE) {
|
|
1694
1694
|
const l = Math.max(n.options.lineWidth - n.indent.length, n.options.minContentWidth), c = Math.ceil(a.length / l), p = new Array(c);
|
|
1695
1695
|
for (let f = 0, h = 0; f < c; ++f, h += l)
|
|
1696
1696
|
p[f] = a.substr(h, l);
|
|
1697
|
-
a = p.join(e ===
|
|
1697
|
+
a = p.join(e === $.BLOCK_LITERAL ? `
|
|
1698
1698
|
` : " ");
|
|
1699
1699
|
}
|
|
1700
1700
|
return pt({ comment: s, type: e, value: a }, n, i, r);
|
|
1701
1701
|
}
|
|
1702
1702
|
};
|
|
1703
|
-
function
|
|
1704
|
-
if (
|
|
1703
|
+
function bs(s, e) {
|
|
1704
|
+
if (Oe(s))
|
|
1705
1705
|
for (let t = 0; t < s.items.length; ++t) {
|
|
1706
1706
|
let n = s.items[t];
|
|
1707
|
-
if (!
|
|
1708
|
-
if (
|
|
1707
|
+
if (!v(n)) {
|
|
1708
|
+
if (Ae(n)) {
|
|
1709
1709
|
n.items.length > 1 && e("Each pair must have its own sequence indicator");
|
|
1710
|
-
const i = n.items[0] || new
|
|
1710
|
+
const i = n.items[0] || new M(new $(null));
|
|
1711
1711
|
if (n.commentBefore && (i.key.commentBefore = i.key.commentBefore ? `${n.commentBefore}
|
|
1712
1712
|
${i.key.commentBefore}` : n.commentBefore), n.comment) {
|
|
1713
1713
|
const r = i.value ?? i.key;
|
|
@@ -1716,14 +1716,14 @@ ${r.comment}` : n.comment;
|
|
|
1716
1716
|
}
|
|
1717
1717
|
n = i;
|
|
1718
1718
|
}
|
|
1719
|
-
s.items[t] =
|
|
1719
|
+
s.items[t] = v(n) ? n : new M(n);
|
|
1720
1720
|
}
|
|
1721
1721
|
}
|
|
1722
1722
|
else
|
|
1723
1723
|
e("Expected a sequence for this tag");
|
|
1724
1724
|
return s;
|
|
1725
1725
|
}
|
|
1726
|
-
function
|
|
1726
|
+
function ws(s, e, t) {
|
|
1727
1727
|
const { replacer: n } = t, i = new te(s);
|
|
1728
1728
|
i.tag = "tag:yaml.org,2002:pairs";
|
|
1729
1729
|
let r = 0;
|
|
@@ -1752,12 +1752,12 @@ const wt = {
|
|
|
1752
1752
|
collection: "seq",
|
|
1753
1753
|
default: !1,
|
|
1754
1754
|
tag: "tag:yaml.org,2002:pairs",
|
|
1755
|
-
resolve:
|
|
1756
|
-
createNode:
|
|
1755
|
+
resolve: bs,
|
|
1756
|
+
createNode: ws
|
|
1757
1757
|
};
|
|
1758
|
-
class
|
|
1758
|
+
class ae extends te {
|
|
1759
1759
|
constructor() {
|
|
1760
|
-
super(), this.add =
|
|
1760
|
+
super(), this.add = j.prototype.add.bind(this), this.delete = j.prototype.delete.bind(this), this.get = j.prototype.get.bind(this), this.has = j.prototype.has.bind(this), this.set = j.prototype.set.bind(this), this.tag = ae.tag;
|
|
1761
1761
|
}
|
|
1762
1762
|
/**
|
|
1763
1763
|
* If `ctx` is given, the return type is actually `Map<unknown, unknown>`,
|
|
@@ -1770,57 +1770,57 @@ class le extends te {
|
|
|
1770
1770
|
t != null && t.onCreate && t.onCreate(n);
|
|
1771
1771
|
for (const i of this.items) {
|
|
1772
1772
|
let r, o;
|
|
1773
|
-
if (
|
|
1773
|
+
if (v(i) ? (r = B(i.key, "", t), o = B(i.value, r, t)) : r = B(i, "", t), n.has(r))
|
|
1774
1774
|
throw new Error("Ordered maps must not include duplicate keys");
|
|
1775
1775
|
n.set(r, o);
|
|
1776
1776
|
}
|
|
1777
1777
|
return n;
|
|
1778
1778
|
}
|
|
1779
1779
|
static from(e, t, n) {
|
|
1780
|
-
const i =
|
|
1780
|
+
const i = ws(e, t, n), r = new this();
|
|
1781
1781
|
return r.items = i.items, r;
|
|
1782
1782
|
}
|
|
1783
1783
|
}
|
|
1784
|
-
|
|
1784
|
+
ae.tag = "tag:yaml.org,2002:omap";
|
|
1785
1785
|
const kt = {
|
|
1786
1786
|
collection: "seq",
|
|
1787
1787
|
identify: (s) => s instanceof Map,
|
|
1788
|
-
nodeClass:
|
|
1788
|
+
nodeClass: ae,
|
|
1789
1789
|
default: !1,
|
|
1790
1790
|
tag: "tag:yaml.org,2002:omap",
|
|
1791
1791
|
resolve(s, e) {
|
|
1792
|
-
const t =
|
|
1792
|
+
const t = bs(s, e), n = [];
|
|
1793
1793
|
for (const { key: i } of t.items)
|
|
1794
1794
|
T(i) && (n.includes(i.value) ? e(`Ordered maps must not include duplicate keys: ${i.value}`) : n.push(i.value));
|
|
1795
|
-
return Object.assign(new
|
|
1795
|
+
return Object.assign(new ae(), t);
|
|
1796
1796
|
},
|
|
1797
|
-
createNode: (s, e, t) =>
|
|
1797
|
+
createNode: (s, e, t) => ae.from(s, e, t)
|
|
1798
1798
|
};
|
|
1799
|
-
function
|
|
1800
|
-
return e && (s ?
|
|
1799
|
+
function ks({ value: s, source: e }, t) {
|
|
1800
|
+
return e && (s ? Ss : Ns).test.test(e) ? e : s ? t.options.trueStr : t.options.falseStr;
|
|
1801
1801
|
}
|
|
1802
|
-
const
|
|
1802
|
+
const Ss = {
|
|
1803
1803
|
identify: (s) => s === !0,
|
|
1804
1804
|
default: !0,
|
|
1805
1805
|
tag: "tag:yaml.org,2002:bool",
|
|
1806
1806
|
test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,
|
|
1807
|
-
resolve: () => new
|
|
1808
|
-
stringify:
|
|
1809
|
-
},
|
|
1807
|
+
resolve: () => new $(!0),
|
|
1808
|
+
stringify: ks
|
|
1809
|
+
}, Ns = {
|
|
1810
1810
|
identify: (s) => s === !1,
|
|
1811
1811
|
default: !0,
|
|
1812
1812
|
tag: "tag:yaml.org,2002:bool",
|
|
1813
1813
|
test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,
|
|
1814
|
-
resolve: () => new
|
|
1815
|
-
stringify:
|
|
1816
|
-
},
|
|
1814
|
+
resolve: () => new $(!1),
|
|
1815
|
+
stringify: ks
|
|
1816
|
+
}, pn = {
|
|
1817
1817
|
identify: (s) => typeof s == "number",
|
|
1818
1818
|
default: !0,
|
|
1819
1819
|
tag: "tag:yaml.org,2002:float",
|
|
1820
1820
|
test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
|
|
1821
1821
|
resolve: (s) => s.slice(-3).toLowerCase() === "nan" ? NaN : s[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
|
|
1822
1822
|
stringify: U
|
|
1823
|
-
},
|
|
1823
|
+
}, mn = {
|
|
1824
1824
|
identify: (s) => typeof s == "number",
|
|
1825
1825
|
default: !0,
|
|
1826
1826
|
tag: "tag:yaml.org,2002:float",
|
|
@@ -1831,13 +1831,13 @@ const ws = {
|
|
|
1831
1831
|
const e = Number(s.value);
|
|
1832
1832
|
return isFinite(e) ? e.toExponential() : U(s);
|
|
1833
1833
|
}
|
|
1834
|
-
},
|
|
1834
|
+
}, gn = {
|
|
1835
1835
|
identify: (s) => typeof s == "number",
|
|
1836
1836
|
default: !0,
|
|
1837
1837
|
tag: "tag:yaml.org,2002:float",
|
|
1838
1838
|
test: /^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,
|
|
1839
1839
|
resolve(s) {
|
|
1840
|
-
const e = new
|
|
1840
|
+
const e = new $(parseFloat(s.replace(/_/g, ""))), t = s.indexOf(".");
|
|
1841
1841
|
if (t !== -1) {
|
|
1842
1842
|
const n = s.substring(t + 1).replace(/_/g, "");
|
|
1843
1843
|
n[n.length - 1] === "0" && (e.minFractionDigits = n.length);
|
|
@@ -1845,7 +1845,7 @@ const ws = {
|
|
|
1845
1845
|
return e;
|
|
1846
1846
|
},
|
|
1847
1847
|
stringify: U
|
|
1848
|
-
},
|
|
1848
|
+
}, Te = (s) => typeof s == "bigint" || Number.isInteger(s);
|
|
1849
1849
|
function Xe(s, e, t, { intAsBigInt: n }) {
|
|
1850
1850
|
const i = s[0];
|
|
1851
1851
|
if ((i === "-" || i === "+") && (e += 1), s = s.substring(e).replace(/_/g, ""), n) {
|
|
@@ -1868,37 +1868,37 @@ function Xe(s, e, t, { intAsBigInt: n }) {
|
|
|
1868
1868
|
}
|
|
1869
1869
|
function St(s, e, t) {
|
|
1870
1870
|
const { value: n } = s;
|
|
1871
|
-
if (
|
|
1871
|
+
if (Te(n)) {
|
|
1872
1872
|
const i = n.toString(e);
|
|
1873
1873
|
return n < 0 ? "-" + t + i.substr(1) : t + i;
|
|
1874
1874
|
}
|
|
1875
1875
|
return U(s);
|
|
1876
1876
|
}
|
|
1877
|
-
const
|
|
1878
|
-
identify:
|
|
1877
|
+
const yn = {
|
|
1878
|
+
identify: Te,
|
|
1879
1879
|
default: !0,
|
|
1880
1880
|
tag: "tag:yaml.org,2002:int",
|
|
1881
1881
|
format: "BIN",
|
|
1882
1882
|
test: /^[-+]?0b[0-1_]+$/,
|
|
1883
1883
|
resolve: (s, e, t) => Xe(s, 2, 2, t),
|
|
1884
1884
|
stringify: (s) => St(s, 2, "0b")
|
|
1885
|
-
},
|
|
1886
|
-
identify:
|
|
1885
|
+
}, bn = {
|
|
1886
|
+
identify: Te,
|
|
1887
1887
|
default: !0,
|
|
1888
1888
|
tag: "tag:yaml.org,2002:int",
|
|
1889
1889
|
format: "OCT",
|
|
1890
1890
|
test: /^[-+]?0[0-7_]+$/,
|
|
1891
1891
|
resolve: (s, e, t) => Xe(s, 1, 8, t),
|
|
1892
1892
|
stringify: (s) => St(s, 8, "0")
|
|
1893
|
-
},
|
|
1894
|
-
identify:
|
|
1893
|
+
}, wn = {
|
|
1894
|
+
identify: Te,
|
|
1895
1895
|
default: !0,
|
|
1896
1896
|
tag: "tag:yaml.org,2002:int",
|
|
1897
1897
|
test: /^[-+]?[0-9][0-9_]*$/,
|
|
1898
1898
|
resolve: (s, e, t) => Xe(s, 0, 10, t),
|
|
1899
1899
|
stringify: U
|
|
1900
|
-
},
|
|
1901
|
-
identify:
|
|
1900
|
+
}, kn = {
|
|
1901
|
+
identify: Te,
|
|
1902
1902
|
default: !0,
|
|
1903
1903
|
tag: "tag:yaml.org,2002:int",
|
|
1904
1904
|
format: "HEX",
|
|
@@ -1906,27 +1906,27 @@ const kn = {
|
|
|
1906
1906
|
resolve: (s, e, t) => Xe(s, 2, 16, t),
|
|
1907
1907
|
stringify: (s) => St(s, 16, "0x")
|
|
1908
1908
|
};
|
|
1909
|
-
class
|
|
1909
|
+
class le extends j {
|
|
1910
1910
|
constructor(e) {
|
|
1911
|
-
super(e), this.tag =
|
|
1911
|
+
super(e), this.tag = le.tag;
|
|
1912
1912
|
}
|
|
1913
1913
|
add(e) {
|
|
1914
1914
|
let t;
|
|
1915
|
-
|
|
1915
|
+
v(e) ? t = e : e && typeof e == "object" && "key" in e && "value" in e && e.value === null ? t = new M(e.key, null) : t = new M(e, null), ee(this.items, t.key) || this.items.push(t);
|
|
1916
1916
|
}
|
|
1917
1917
|
/**
|
|
1918
1918
|
* If `keepPair` is `true`, returns the Pair matching `key`.
|
|
1919
1919
|
* Otherwise, returns the value of that Pair's key.
|
|
1920
1920
|
*/
|
|
1921
1921
|
get(e, t) {
|
|
1922
|
-
const n =
|
|
1923
|
-
return !t &&
|
|
1922
|
+
const n = ee(this.items, e);
|
|
1923
|
+
return !t && v(n) ? T(n.key) ? n.key.value : n.key : n;
|
|
1924
1924
|
}
|
|
1925
1925
|
set(e, t) {
|
|
1926
1926
|
if (typeof t != "boolean")
|
|
1927
1927
|
throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);
|
|
1928
|
-
const n =
|
|
1929
|
-
n && !t ? this.items.splice(this.items.indexOf(n), 1) : !n && t && this.items.push(new
|
|
1928
|
+
const n = ee(this.items, e);
|
|
1929
|
+
n && !t ? this.items.splice(this.items.indexOf(n), 1) : !n && t && this.items.push(new M(e));
|
|
1930
1930
|
}
|
|
1931
1931
|
toJSON(e, t) {
|
|
1932
1932
|
return super.toJSON(e, t, Set);
|
|
@@ -1946,18 +1946,18 @@ class ce extends M {
|
|
|
1946
1946
|
return r;
|
|
1947
1947
|
}
|
|
1948
1948
|
}
|
|
1949
|
-
|
|
1949
|
+
le.tag = "tag:yaml.org,2002:set";
|
|
1950
1950
|
const Nt = {
|
|
1951
1951
|
collection: "map",
|
|
1952
1952
|
identify: (s) => s instanceof Set,
|
|
1953
|
-
nodeClass:
|
|
1953
|
+
nodeClass: le,
|
|
1954
1954
|
default: !1,
|
|
1955
1955
|
tag: "tag:yaml.org,2002:set",
|
|
1956
|
-
createNode: (s, e, t) =>
|
|
1956
|
+
createNode: (s, e, t) => le.from(s, e, t),
|
|
1957
1957
|
resolve(s, e) {
|
|
1958
|
-
if (
|
|
1958
|
+
if (Ae(s)) {
|
|
1959
1959
|
if (s.hasAllNullValues(!0))
|
|
1960
|
-
return Object.assign(new
|
|
1960
|
+
return Object.assign(new le(), s);
|
|
1961
1961
|
e("Set items must all have null values");
|
|
1962
1962
|
} else
|
|
1963
1963
|
e("Expected a mapping for this tag");
|
|
@@ -1968,7 +1968,7 @@ function Et(s, e) {
|
|
|
1968
1968
|
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, a) => o * i(60) + i(a), i(0));
|
|
1969
1969
|
return t === "-" ? i(-1) * r : r;
|
|
1970
1970
|
}
|
|
1971
|
-
function
|
|
1971
|
+
function Es(s) {
|
|
1972
1972
|
let { value: e } = s, t = (o) => o;
|
|
1973
1973
|
if (typeof e == "bigint")
|
|
1974
1974
|
t = (o) => BigInt(o);
|
|
@@ -1979,22 +1979,22 @@ function Ss(s) {
|
|
|
1979
1979
|
const i = t(60), r = [e % i];
|
|
1980
1980
|
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*$/, "");
|
|
1981
1981
|
}
|
|
1982
|
-
const
|
|
1982
|
+
const $s = {
|
|
1983
1983
|
identify: (s) => typeof s == "bigint" || Number.isInteger(s),
|
|
1984
1984
|
default: !0,
|
|
1985
1985
|
tag: "tag:yaml.org,2002:int",
|
|
1986
1986
|
format: "TIME",
|
|
1987
1987
|
test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,
|
|
1988
1988
|
resolve: (s, e, { intAsBigInt: t }) => Et(s, t),
|
|
1989
|
-
stringify:
|
|
1990
|
-
},
|
|
1989
|
+
stringify: Es
|
|
1990
|
+
}, Is = {
|
|
1991
1991
|
identify: (s) => typeof s == "number",
|
|
1992
1992
|
default: !0,
|
|
1993
1993
|
tag: "tag:yaml.org,2002:float",
|
|
1994
1994
|
format: "TIME",
|
|
1995
1995
|
test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,
|
|
1996
1996
|
resolve: (s) => Et(s, !1),
|
|
1997
|
-
stringify:
|
|
1997
|
+
stringify: Es
|
|
1998
1998
|
}, ze = {
|
|
1999
1999
|
identify: (s) => s instanceof Date,
|
|
2000
2000
|
default: !0,
|
|
@@ -2017,97 +2017,97 @@ const Ns = {
|
|
|
2017
2017
|
return new Date(c);
|
|
2018
2018
|
},
|
|
2019
2019
|
stringify: ({ value: s }) => (s == null ? void 0 : s.toISOString().replace(/(T00:00:00)?\.000Z$/, "")) ?? ""
|
|
2020
|
-
},
|
|
2020
|
+
}, Mt = [
|
|
2021
|
+
pe,
|
|
2021
2022
|
me,
|
|
2022
|
-
|
|
2023
|
+
Ge,
|
|
2023
2024
|
We,
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
ks,
|
|
2027
|
-
kn,
|
|
2028
|
-
Sn,
|
|
2029
|
-
Nn,
|
|
2030
|
-
En,
|
|
2025
|
+
Ss,
|
|
2026
|
+
Ns,
|
|
2031
2027
|
yn,
|
|
2032
2028
|
bn,
|
|
2033
2029
|
wn,
|
|
2030
|
+
kn,
|
|
2031
|
+
pn,
|
|
2032
|
+
mn,
|
|
2033
|
+
gn,
|
|
2034
2034
|
bt,
|
|
2035
|
-
|
|
2035
|
+
W,
|
|
2036
2036
|
kt,
|
|
2037
2037
|
wt,
|
|
2038
2038
|
Nt,
|
|
2039
|
-
|
|
2040
|
-
|
|
2039
|
+
$s,
|
|
2040
|
+
Is,
|
|
2041
2041
|
ze
|
|
2042
|
-
],
|
|
2043
|
-
["core",
|
|
2044
|
-
["failsafe", [
|
|
2045
|
-
["json",
|
|
2046
|
-
["yaml11",
|
|
2047
|
-
["yaml-1.1",
|
|
2048
|
-
]),
|
|
2042
|
+
], jt = /* @__PURE__ */ new Map([
|
|
2043
|
+
["core", fn],
|
|
2044
|
+
["failsafe", [pe, me, Ge]],
|
|
2045
|
+
["json", dn],
|
|
2046
|
+
["yaml11", Mt],
|
|
2047
|
+
["yaml-1.1", Mt]
|
|
2048
|
+
]), Bt = {
|
|
2049
2049
|
binary: bt,
|
|
2050
2050
|
bool: gt,
|
|
2051
|
-
float:
|
|
2052
|
-
floatExp:
|
|
2053
|
-
floatNaN:
|
|
2054
|
-
floatTime:
|
|
2055
|
-
int:
|
|
2056
|
-
intHex:
|
|
2057
|
-
intOct:
|
|
2058
|
-
intTime:
|
|
2059
|
-
map:
|
|
2060
|
-
merge:
|
|
2061
|
-
null:
|
|
2051
|
+
float: ds,
|
|
2052
|
+
floatExp: hs,
|
|
2053
|
+
floatNaN: us,
|
|
2054
|
+
floatTime: Is,
|
|
2055
|
+
int: gs,
|
|
2056
|
+
intHex: ys,
|
|
2057
|
+
intOct: ms,
|
|
2058
|
+
intTime: $s,
|
|
2059
|
+
map: pe,
|
|
2060
|
+
merge: W,
|
|
2061
|
+
null: We,
|
|
2062
2062
|
omap: kt,
|
|
2063
2063
|
pairs: wt,
|
|
2064
|
-
seq:
|
|
2064
|
+
seq: me,
|
|
2065
2065
|
set: Nt,
|
|
2066
2066
|
timestamp: ze
|
|
2067
|
-
},
|
|
2067
|
+
}, Sn = {
|
|
2068
2068
|
"tag:yaml.org,2002:binary": bt,
|
|
2069
|
-
"tag:yaml.org,2002:merge":
|
|
2069
|
+
"tag:yaml.org,2002:merge": W,
|
|
2070
2070
|
"tag:yaml.org,2002:omap": kt,
|
|
2071
2071
|
"tag:yaml.org,2002:pairs": wt,
|
|
2072
2072
|
"tag:yaml.org,2002:set": Nt,
|
|
2073
2073
|
"tag:yaml.org,2002:timestamp": ze
|
|
2074
2074
|
};
|
|
2075
2075
|
function et(s, e, t) {
|
|
2076
|
-
const n =
|
|
2076
|
+
const n = jt.get(e);
|
|
2077
2077
|
if (n && !s)
|
|
2078
|
-
return t && !n.includes(
|
|
2078
|
+
return t && !n.includes(W) ? n.concat(W) : n.slice();
|
|
2079
2079
|
let i = n;
|
|
2080
2080
|
if (!i)
|
|
2081
2081
|
if (Array.isArray(s))
|
|
2082
2082
|
i = [];
|
|
2083
2083
|
else {
|
|
2084
|
-
const r = Array.from(
|
|
2084
|
+
const r = Array.from(jt.keys()).filter((o) => o !== "yaml11").map((o) => JSON.stringify(o)).join(", ");
|
|
2085
2085
|
throw new Error(`Unknown schema "${e}"; use one of ${r} or define customTags array`);
|
|
2086
2086
|
}
|
|
2087
2087
|
if (Array.isArray(s))
|
|
2088
2088
|
for (const r of s)
|
|
2089
2089
|
i = i.concat(r);
|
|
2090
2090
|
else typeof s == "function" && (i = s(i.slice()));
|
|
2091
|
-
return t && (i = i.concat(
|
|
2092
|
-
const a = typeof o == "string" ?
|
|
2091
|
+
return t && (i = i.concat(W)), i.reduce((r, o) => {
|
|
2092
|
+
const a = typeof o == "string" ? Bt[o] : o;
|
|
2093
2093
|
if (!a) {
|
|
2094
|
-
const l = JSON.stringify(o), c = Object.keys(
|
|
2094
|
+
const l = JSON.stringify(o), c = Object.keys(Bt).map((p) => JSON.stringify(p)).join(", ");
|
|
2095
2095
|
throw new Error(`Unknown custom tag ${l}; use one of ${c}`);
|
|
2096
2096
|
}
|
|
2097
2097
|
return r.includes(a) || r.push(a), r;
|
|
2098
2098
|
}, []);
|
|
2099
2099
|
}
|
|
2100
|
-
const
|
|
2101
|
-
class
|
|
2100
|
+
const Nn = (s, e) => s.key < e.key ? -1 : s.key > e.key ? 1 : 0;
|
|
2101
|
+
class $t {
|
|
2102
2102
|
constructor({ compat: e, customTags: t, merge: n, resolveKnownTags: i, schema: r, sortMapEntries: o, toStringDefaults: a }) {
|
|
2103
|
-
this.compat = Array.isArray(e) ? et(e, "compat") : e ? et(null, e) : null, this.name = typeof r == "string" && r || "core", this.knownTags = i ?
|
|
2103
|
+
this.compat = Array.isArray(e) ? et(e, "compat") : e ? et(null, e) : null, this.name = typeof r == "string" && r || "core", this.knownTags = i ? Sn : {}, this.tags = et(t, this.name, n), this.toStringOptions = a ?? null, Object.defineProperty(this, z, { value: pe }), Object.defineProperty(this, V, { value: Ge }), Object.defineProperty(this, ue, { value: me }), this.sortMapEntries = typeof o == "function" ? o : o === !0 ? Nn : null;
|
|
2104
2104
|
}
|
|
2105
2105
|
clone() {
|
|
2106
|
-
const e = Object.create(
|
|
2106
|
+
const e = Object.create($t.prototype, Object.getOwnPropertyDescriptors(this));
|
|
2107
2107
|
return e.tags = this.tags.slice(), e;
|
|
2108
2108
|
}
|
|
2109
2109
|
}
|
|
2110
|
-
function
|
|
2110
|
+
function En(s, e) {
|
|
2111
2111
|
var l;
|
|
2112
2112
|
const t = [];
|
|
2113
2113
|
let n = e.directives === !0;
|
|
@@ -2116,42 +2116,42 @@ function An(s, e) {
|
|
|
2116
2116
|
c ? (t.push(c), n = !0) : s.directives.docStart && (n = !0);
|
|
2117
2117
|
}
|
|
2118
2118
|
n && t.push("---");
|
|
2119
|
-
const i =
|
|
2119
|
+
const i = rs(s, e), { commentString: r } = i.options;
|
|
2120
2120
|
if (s.commentBefore) {
|
|
2121
2121
|
t.length !== 1 && t.unshift("");
|
|
2122
2122
|
const c = r(s.commentBefore);
|
|
2123
|
-
t.unshift(
|
|
2123
|
+
t.unshift(H(c, ""));
|
|
2124
2124
|
}
|
|
2125
2125
|
let o = !1, a = null;
|
|
2126
2126
|
if (s.contents) {
|
|
2127
2127
|
if (C(s.contents)) {
|
|
2128
2128
|
if (s.contents.spaceBefore && n && t.push(""), s.contents.commentBefore) {
|
|
2129
2129
|
const f = r(s.contents.commentBefore);
|
|
2130
|
-
t.push(
|
|
2130
|
+
t.push(H(f, ""));
|
|
2131
2131
|
}
|
|
2132
2132
|
i.forceBlockIndent = !!s.comment, a = s.contents.comment;
|
|
2133
2133
|
}
|
|
2134
2134
|
const c = a ? void 0 : () => o = !0;
|
|
2135
|
-
let p =
|
|
2135
|
+
let p = ce(s.contents, i, () => a = null, c);
|
|
2136
2136
|
a && (p += Z(p, "", r(a))), (p[0] === "|" || p[0] === ">") && t[t.length - 1] === "---" ? t[t.length - 1] = `--- ${p}` : t.push(p);
|
|
2137
2137
|
} else
|
|
2138
|
-
t.push(
|
|
2138
|
+
t.push(ce(s.contents, i));
|
|
2139
2139
|
if ((l = s.directives) != null && l.docEnd)
|
|
2140
2140
|
if (s.comment) {
|
|
2141
2141
|
const c = r(s.comment);
|
|
2142
2142
|
c.includes(`
|
|
2143
|
-
`) ? (t.push("..."), t.push(
|
|
2143
|
+
`) ? (t.push("..."), t.push(H(c, ""))) : t.push(`... ${c}`);
|
|
2144
2144
|
} else
|
|
2145
2145
|
t.push("...");
|
|
2146
2146
|
else {
|
|
2147
2147
|
let c = s.comment;
|
|
2148
|
-
c && o && (c = c.replace(/^\n+/, "")), c && ((!o || a) && t[t.length - 1] !== "" && t.push(""), t.push(
|
|
2148
|
+
c && o && (c = c.replace(/^\n+/, "")), c && ((!o || a) && t[t.length - 1] !== "" && t.push(""), t.push(H(r(c), "")));
|
|
2149
2149
|
}
|
|
2150
2150
|
return t.join(`
|
|
2151
2151
|
`) + `
|
|
2152
2152
|
`;
|
|
2153
2153
|
}
|
|
2154
|
-
class
|
|
2154
|
+
class Le {
|
|
2155
2155
|
constructor(e, t, n) {
|
|
2156
2156
|
this.commentBefore = null, this.comment = null, this.errors = [], this.warnings = [], Object.defineProperty(this, K, { value: rt });
|
|
2157
2157
|
let i = null;
|
|
@@ -2176,7 +2176,7 @@ class Te {
|
|
|
2176
2176
|
* Custom Node values that inherit from `Object` still refer to their original instances.
|
|
2177
2177
|
*/
|
|
2178
2178
|
clone() {
|
|
2179
|
-
const e = Object.create(
|
|
2179
|
+
const e = Object.create(Le.prototype, {
|
|
2180
2180
|
[K]: { value: rt }
|
|
2181
2181
|
});
|
|
2182
2182
|
return e.commentBefore = this.commentBefore, e.comment = this.comment, e.errors = this.errors.slice(), e.warnings = this.warnings.slice(), e.options = Object.assign({}, this.options), this.directives && (e.directives = this.directives.clone()), e.schema = this.schema.clone(), e.contents = C(this.contents) ? this.contents.clone(e.schema) : this.contents, this.range && (e.range = this.range.slice()), e;
|
|
@@ -2200,9 +2200,9 @@ class Te {
|
|
|
2200
2200
|
*/
|
|
2201
2201
|
createAlias(e, t) {
|
|
2202
2202
|
if (!e.anchor) {
|
|
2203
|
-
const n =
|
|
2203
|
+
const n = es(this);
|
|
2204
2204
|
e.anchor = // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
2205
|
-
!t || n.has(t) ?
|
|
2205
|
+
!t || n.has(t) ? ts(t || "a", n) : t;
|
|
2206
2206
|
}
|
|
2207
2207
|
return new dt(e.anchor);
|
|
2208
2208
|
}
|
|
@@ -2211,10 +2211,10 @@ class Te {
|
|
|
2211
2211
|
if (typeof t == "function")
|
|
2212
2212
|
e = t.call({ "": e }, "", e), i = t;
|
|
2213
2213
|
else if (Array.isArray(t)) {
|
|
2214
|
-
const m = (
|
|
2214
|
+
const m = (w) => typeof w == "number" || w instanceof String || w instanceof Number, y = t.filter(m).map(String);
|
|
2215
2215
|
y.length > 0 && (t = t.concat(y)), i = t;
|
|
2216
2216
|
} else n === void 0 && t && (n = t, t = void 0);
|
|
2217
|
-
const { aliasDuplicateObjects: r, anchorPrefix: o, flow: a, keepUndefined: l, onTagObj: c, tag: p } = n ?? {}, { onAnchor: f, setAnchors: h, sourceObjects: d } =
|
|
2217
|
+
const { aliasDuplicateObjects: r, anchorPrefix: o, flow: a, keepUndefined: l, onTagObj: c, tag: p } = n ?? {}, { onAnchor: f, setAnchors: h, sourceObjects: d } = Xs(
|
|
2218
2218
|
this,
|
|
2219
2219
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
2220
2220
|
o || "a"
|
|
@@ -2235,7 +2235,7 @@ class Te {
|
|
|
2235
2235
|
*/
|
|
2236
2236
|
createPair(e, t, n = {}) {
|
|
2237
2237
|
const i = this.createNode(e, null, n), r = this.createNode(t, null, n);
|
|
2238
|
-
return new
|
|
2238
|
+
return new M(i, r);
|
|
2239
2239
|
}
|
|
2240
2240
|
/**
|
|
2241
2241
|
* Removes a value from the document.
|
|
@@ -2249,7 +2249,7 @@ class Te {
|
|
|
2249
2249
|
* @returns `true` if the item was found and removed.
|
|
2250
2250
|
*/
|
|
2251
2251
|
deleteIn(e) {
|
|
2252
|
-
return
|
|
2252
|
+
return ye(e) ? this.contents == null ? !1 : (this.contents = null, !0) : se(this.contents) ? this.contents.deleteIn(e) : !1;
|
|
2253
2253
|
}
|
|
2254
2254
|
/**
|
|
2255
2255
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -2265,7 +2265,7 @@ class Te {
|
|
|
2265
2265
|
* `true` (collections are always returned intact).
|
|
2266
2266
|
*/
|
|
2267
2267
|
getIn(e, t) {
|
|
2268
|
-
return
|
|
2268
|
+
return ye(e) ? !t && T(this.contents) ? this.contents.value : this.contents : L(this.contents) ? this.contents.getIn(e, t) : void 0;
|
|
2269
2269
|
}
|
|
2270
2270
|
/**
|
|
2271
2271
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -2277,21 +2277,21 @@ class Te {
|
|
|
2277
2277
|
* Checks if the document includes a value at `path`.
|
|
2278
2278
|
*/
|
|
2279
2279
|
hasIn(e) {
|
|
2280
|
-
return
|
|
2280
|
+
return ye(e) ? this.contents !== void 0 : L(this.contents) ? this.contents.hasIn(e) : !1;
|
|
2281
2281
|
}
|
|
2282
2282
|
/**
|
|
2283
2283
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
2284
2284
|
* boolean to add/remove the item from the set.
|
|
2285
2285
|
*/
|
|
2286
2286
|
set(e, t) {
|
|
2287
|
-
this.contents == null ? this.contents =
|
|
2287
|
+
this.contents == null ? this.contents = Fe(this.schema, [e], t) : se(this.contents) && this.contents.set(e, t);
|
|
2288
2288
|
}
|
|
2289
2289
|
/**
|
|
2290
2290
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
2291
2291
|
* boolean to add/remove the item from the set.
|
|
2292
2292
|
*/
|
|
2293
2293
|
setIn(e, t) {
|
|
2294
|
-
|
|
2294
|
+
ye(e) ? this.contents = t : this.contents == null ? this.contents = Fe(this.schema, Array.from(e), t) : se(this.contents) && this.contents.setIn(e, t);
|
|
2295
2295
|
}
|
|
2296
2296
|
/**
|
|
2297
2297
|
* Change the YAML version and schema used by the document.
|
|
@@ -2322,7 +2322,7 @@ class Te {
|
|
|
2322
2322
|
if (t.schema instanceof Object)
|
|
2323
2323
|
this.schema = t.schema;
|
|
2324
2324
|
else if (n)
|
|
2325
|
-
this.schema = new
|
|
2325
|
+
this.schema = new $t(Object.assign(n, t));
|
|
2326
2326
|
else
|
|
2327
2327
|
throw new Error("With a null YAML version, the { schema: Schema } option is required");
|
|
2328
2328
|
}
|
|
@@ -2335,7 +2335,7 @@ class Te {
|
|
|
2335
2335
|
mapAsMap: n === !0,
|
|
2336
2336
|
mapKeyWarned: !1,
|
|
2337
2337
|
maxAliasCount: typeof i == "number" ? i : 100
|
|
2338
|
-
}, l =
|
|
2338
|
+
}, l = B(this.contents, t ?? "", a);
|
|
2339
2339
|
if (typeof r == "function")
|
|
2340
2340
|
for (const { count: c, res: p } of a.anchors.values())
|
|
2341
2341
|
r(p, c);
|
|
@@ -2358,7 +2358,7 @@ class Te {
|
|
|
2358
2358
|
const t = JSON.stringify(e.indent);
|
|
2359
2359
|
throw new Error(`"indent" option must be a positive integer, not ${t}`);
|
|
2360
2360
|
}
|
|
2361
|
-
return
|
|
2361
|
+
return En(this, e);
|
|
2362
2362
|
}
|
|
2363
2363
|
}
|
|
2364
2364
|
function se(s) {
|
|
@@ -2366,22 +2366,22 @@ function se(s) {
|
|
|
2366
2366
|
return !0;
|
|
2367
2367
|
throw new Error("Expected a YAML collection as document contents");
|
|
2368
2368
|
}
|
|
2369
|
-
class
|
|
2369
|
+
class As extends Error {
|
|
2370
2370
|
constructor(e, t, n, i) {
|
|
2371
2371
|
super(), this.name = e, this.code = n, this.message = i, this.pos = t;
|
|
2372
2372
|
}
|
|
2373
2373
|
}
|
|
2374
|
-
class
|
|
2374
|
+
class be extends As {
|
|
2375
2375
|
constructor(e, t, n) {
|
|
2376
2376
|
super("YAMLParseError", e, t, n);
|
|
2377
2377
|
}
|
|
2378
2378
|
}
|
|
2379
|
-
class
|
|
2379
|
+
class $n extends As {
|
|
2380
2380
|
constructor(e, t, n) {
|
|
2381
2381
|
super("YAMLWarning", e, t, n);
|
|
2382
2382
|
}
|
|
2383
2383
|
}
|
|
2384
|
-
const
|
|
2384
|
+
const Kt = (s, e) => (t) => {
|
|
2385
2385
|
if (t.pos[0] === -1)
|
|
2386
2386
|
return;
|
|
2387
2387
|
t.linePos = t.pos.map((a) => e.linePos(a));
|
|
@@ -2409,52 +2409,52 @@ ${c}
|
|
|
2409
2409
|
`;
|
|
2410
2410
|
}
|
|
2411
2411
|
};
|
|
2412
|
-
function
|
|
2413
|
-
let l = !1, c = a, p = a, f = "", h = "", d = !1, g = !1, u = null, m = null, y = null,
|
|
2414
|
-
for (const
|
|
2415
|
-
switch (g && (
|
|
2412
|
+
function fe(s, { flow: e, indicator: t, next: n, offset: i, onError: r, parentIndent: o, startOnNewline: a }) {
|
|
2413
|
+
let l = !1, c = a, p = a, f = "", h = "", d = !1, g = !1, u = null, m = null, y = null, w = null, N = null, S = null, E = null;
|
|
2414
|
+
for (const k of s)
|
|
2415
|
+
switch (g && (k.type !== "space" && k.type !== "newline" && k.type !== "comma" && r(k.offset, "MISSING_CHAR", "Tags and anchors must be separated from the next token by white space"), g = !1), u && (c && k.type !== "comment" && k.type !== "newline" && r(u, "TAB_AS_INDENT", "Tabs are not allowed as indentation"), u = null), k.type) {
|
|
2416
2416
|
case "space":
|
|
2417
|
-
!e && (t !== "doc-start" || (n == null ? void 0 : n.type) !== "flow-collection") &&
|
|
2417
|
+
!e && (t !== "doc-start" || (n == null ? void 0 : n.type) !== "flow-collection") && k.source.includes(" ") && (u = k), p = !0;
|
|
2418
2418
|
break;
|
|
2419
2419
|
case "comment": {
|
|
2420
|
-
p || r(
|
|
2421
|
-
const O =
|
|
2420
|
+
p || r(k, "MISSING_CHAR", "Comments must be separated from other tokens by white space characters");
|
|
2421
|
+
const O = k.source.substring(1) || " ";
|
|
2422
2422
|
f ? f += h + O : f = O, h = "", c = !1;
|
|
2423
2423
|
break;
|
|
2424
2424
|
}
|
|
2425
2425
|
case "newline":
|
|
2426
|
-
c ? f ? f +=
|
|
2426
|
+
c ? f ? f += k.source : (!S || t !== "seq-item-ind") && (l = !0) : h += k.source, c = !0, d = !0, (m || y) && (w = k), p = !0;
|
|
2427
2427
|
break;
|
|
2428
2428
|
case "anchor":
|
|
2429
|
-
m && r(
|
|
2429
|
+
m && r(k, "MULTIPLE_ANCHORS", "A node can have at most one anchor"), k.source.endsWith(":") && r(k.offset + k.source.length - 1, "BAD_ALIAS", "Anchor ending in : is ambiguous", !0), m = k, E ?? (E = k.offset), c = !1, p = !1, g = !0;
|
|
2430
2430
|
break;
|
|
2431
2431
|
case "tag": {
|
|
2432
|
-
y && r(
|
|
2432
|
+
y && r(k, "MULTIPLE_TAGS", "A node can have at most one tag"), y = k, E ?? (E = k.offset), c = !1, p = !1, g = !0;
|
|
2433
2433
|
break;
|
|
2434
2434
|
}
|
|
2435
2435
|
case t:
|
|
2436
|
-
(m || y) && r(
|
|
2436
|
+
(m || y) && r(k, "BAD_PROP_ORDER", `Anchors and tags must be after the ${k.source} indicator`), S && r(k, "UNEXPECTED_TOKEN", `Unexpected ${k.source} in ${e ?? "collection"}`), S = k, c = t === "seq-item-ind" || t === "explicit-key-ind", p = !1;
|
|
2437
2437
|
break;
|
|
2438
2438
|
case "comma":
|
|
2439
2439
|
if (e) {
|
|
2440
|
-
N && r(
|
|
2440
|
+
N && r(k, "UNEXPECTED_TOKEN", `Unexpected , in ${e}`), N = k, c = !1, p = !1;
|
|
2441
2441
|
break;
|
|
2442
2442
|
}
|
|
2443
2443
|
default:
|
|
2444
|
-
r(
|
|
2444
|
+
r(k, "UNEXPECTED_TOKEN", `Unexpected ${k.type} token`), c = !1, p = !1;
|
|
2445
2445
|
}
|
|
2446
|
-
const A = s[s.length - 1],
|
|
2446
|
+
const A = s[s.length - 1], I = A ? A.offset + A.source.length : i;
|
|
2447
2447
|
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"), u && (c && u.indent <= o || (n == null ? void 0 : n.type) === "block-map" || (n == null ? void 0 : n.type) === "block-seq") && r(u, "TAB_AS_INDENT", "Tabs are not allowed as indentation"), {
|
|
2448
2448
|
comma: N,
|
|
2449
|
-
found:
|
|
2449
|
+
found: S,
|
|
2450
2450
|
spaceBefore: l,
|
|
2451
2451
|
comment: f,
|
|
2452
2452
|
hasNewline: d,
|
|
2453
2453
|
anchor: m,
|
|
2454
2454
|
tag: y,
|
|
2455
|
-
newlineAfterProp:
|
|
2456
|
-
end:
|
|
2457
|
-
start: E ??
|
|
2455
|
+
newlineAfterProp: w,
|
|
2456
|
+
end: I,
|
|
2457
|
+
start: E ?? I
|
|
2458
2458
|
};
|
|
2459
2459
|
}
|
|
2460
2460
|
function Ee(s) {
|
|
@@ -2498,21 +2498,21 @@ function ct(s, e, t) {
|
|
|
2498
2498
|
n.indent === s && (n.source === "]" || n.source === "}") && Ee(e) && t(n, "BAD_INDENT", "Flow end indicator should be more indented than parent", !0);
|
|
2499
2499
|
}
|
|
2500
2500
|
}
|
|
2501
|
-
function
|
|
2501
|
+
function Os(s, e, t) {
|
|
2502
2502
|
const { uniqueKeys: n } = s.options;
|
|
2503
2503
|
if (n === !1)
|
|
2504
2504
|
return !1;
|
|
2505
2505
|
const i = typeof n == "function" ? n : (r, o) => r === o || T(r) && T(o) && r.value === o.value;
|
|
2506
2506
|
return e.some((r) => i(r.key, t));
|
|
2507
2507
|
}
|
|
2508
|
-
const
|
|
2509
|
-
function
|
|
2508
|
+
const Rt = "All mapping items must start at the same column";
|
|
2509
|
+
function In({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
2510
2510
|
var p;
|
|
2511
|
-
const o = (r == null ? void 0 : r.nodeClass) ??
|
|
2511
|
+
const o = (r == null ? void 0 : r.nodeClass) ?? j, a = new o(t.schema);
|
|
2512
2512
|
t.atRoot && (t.atRoot = !1);
|
|
2513
2513
|
let l = n.offset, c = null;
|
|
2514
2514
|
for (const f of n.items) {
|
|
2515
|
-
const { start: h, key: d, sep: g, value: u } = f, m =
|
|
2515
|
+
const { start: h, key: d, sep: g, value: u } = f, m = fe(h, {
|
|
2516
2516
|
indicator: "explicit-key-ind",
|
|
2517
2517
|
next: d ?? (g == null ? void 0 : g[0]),
|
|
2518
2518
|
offset: l,
|
|
@@ -2521,17 +2521,17 @@ function Tn({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
2521
2521
|
startOnNewline: !0
|
|
2522
2522
|
}), y = !m.found;
|
|
2523
2523
|
if (y) {
|
|
2524
|
-
if (d && (d.type === "block-seq" ? i(l, "BLOCK_AS_IMPLICIT_KEY", "A block sequence may not be used as an implicit map key") : "indent" in d && d.indent !== n.indent && i(l, "BAD_INDENT",
|
|
2524
|
+
if (d && (d.type === "block-seq" ? i(l, "BLOCK_AS_IMPLICIT_KEY", "A block sequence may not be used as an implicit map key") : "indent" in d && d.indent !== n.indent && i(l, "BAD_INDENT", Rt)), !m.anchor && !m.tag && !g) {
|
|
2525
2525
|
c = m.end, m.comment && (a.comment ? a.comment += `
|
|
2526
2526
|
` + m.comment : a.comment = m.comment);
|
|
2527
2527
|
continue;
|
|
2528
2528
|
}
|
|
2529
2529
|
(m.newlineAfterProp || Ee(d)) && i(d ?? h[h.length - 1], "MULTILINE_IMPLICIT_KEY", "Implicit keys need to be on a single line");
|
|
2530
|
-
} else ((p = m.found) == null ? void 0 : p.indent) !== n.indent && i(l, "BAD_INDENT",
|
|
2530
|
+
} else ((p = m.found) == null ? void 0 : p.indent) !== n.indent && i(l, "BAD_INDENT", Rt);
|
|
2531
2531
|
t.atKey = !0;
|
|
2532
|
-
const
|
|
2533
|
-
t.schema.compat && ct(n.indent, d, i), t.atKey = !1,
|
|
2534
|
-
const
|
|
2532
|
+
const w = m.end, N = d ? s(t, d, m, i) : e(t, w, h, null, m, i);
|
|
2533
|
+
t.schema.compat && ct(n.indent, d, i), t.atKey = !1, Os(t, a.items, N) && i(w, "DUPLICATE_KEY", "Map keys must be unique");
|
|
2534
|
+
const S = fe(g ?? [], {
|
|
2535
2535
|
indicator: "map-value-ind",
|
|
2536
2536
|
next: u,
|
|
2537
2537
|
offset: N.range[2],
|
|
@@ -2539,27 +2539,27 @@ function Tn({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
2539
2539
|
parentIndent: n.indent,
|
|
2540
2540
|
startOnNewline: !d || d.type === "block-scalar"
|
|
2541
2541
|
});
|
|
2542
|
-
if (l =
|
|
2543
|
-
y && ((u == null ? void 0 : u.type) === "block-map" && !
|
|
2544
|
-
const E = u ? s(t, u,
|
|
2542
|
+
if (l = S.end, S.found) {
|
|
2543
|
+
y && ((u == null ? void 0 : u.type) === "block-map" && !S.hasNewline && i(l, "BLOCK_AS_IMPLICIT_KEY", "Nested mappings are not allowed in compact mappings"), t.options.strict && m.start < S.found.offset - 1024 && i(N.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));
|
|
2544
|
+
const E = u ? s(t, u, S, i) : e(t, l, g, null, S, i);
|
|
2545
2545
|
t.schema.compat && ct(n.indent, u, i), l = E.range[2];
|
|
2546
|
-
const A = new
|
|
2546
|
+
const A = new M(N, E);
|
|
2547
2547
|
t.options.keepSourceTokens && (A.srcToken = f), a.items.push(A);
|
|
2548
2548
|
} else {
|
|
2549
|
-
y && i(N.range, "MISSING_CHAR", "Implicit map keys need to be followed by map values"),
|
|
2550
|
-
` +
|
|
2551
|
-
const E = new
|
|
2549
|
+
y && i(N.range, "MISSING_CHAR", "Implicit map keys need to be followed by map values"), S.comment && (N.comment ? N.comment += `
|
|
2550
|
+
` + S.comment : N.comment = S.comment);
|
|
2551
|
+
const E = new M(N);
|
|
2552
2552
|
t.options.keepSourceTokens && (E.srcToken = f), a.items.push(E);
|
|
2553
2553
|
}
|
|
2554
2554
|
}
|
|
2555
2555
|
return c && c < l && i(c, "IMPOSSIBLE", "Map comment with trailing content"), a.range = [n.offset, l, c ?? l], a;
|
|
2556
2556
|
}
|
|
2557
|
-
function
|
|
2557
|
+
function An({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
2558
2558
|
const o = (r == null ? void 0 : r.nodeClass) ?? te, a = new o(t.schema);
|
|
2559
2559
|
t.atRoot && (t.atRoot = !1), t.atKey && (t.atKey = !1);
|
|
2560
2560
|
let l = n.offset, c = null;
|
|
2561
2561
|
for (const { start: p, value: f } of n.items) {
|
|
2562
|
-
const h =
|
|
2562
|
+
const h = fe(p, {
|
|
2563
2563
|
indicator: "seq-item-ind",
|
|
2564
2564
|
next: f,
|
|
2565
2565
|
offset: l,
|
|
@@ -2579,7 +2579,7 @@ function Ln({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
2579
2579
|
}
|
|
2580
2580
|
return a.range = [n.offset, l, c ?? l], a;
|
|
2581
2581
|
}
|
|
2582
|
-
function
|
|
2582
|
+
function Ce(s, e, t, n) {
|
|
2583
2583
|
let i = "";
|
|
2584
2584
|
if (s) {
|
|
2585
2585
|
let r = !1, o = "";
|
|
@@ -2607,65 +2607,65 @@ function Le(s, e, t, n) {
|
|
|
2607
2607
|
return { comment: i, offset: e };
|
|
2608
2608
|
}
|
|
2609
2609
|
const tt = "Block collections are not allowed within flow collections", st = (s) => s && (s.type === "block-map" || s.type === "block-seq");
|
|
2610
|
-
function
|
|
2610
|
+
function On({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
2611
2611
|
var m;
|
|
2612
|
-
const o = n.start.source === "{", a = o ? "flow map" : "flow sequence", l = (r == null ? void 0 : r.nodeClass) ?? (o ?
|
|
2612
|
+
const o = n.start.source === "{", a = o ? "flow map" : "flow sequence", l = (r == null ? void 0 : r.nodeClass) ?? (o ? j : te), c = new l(t.schema);
|
|
2613
2613
|
c.flow = !0;
|
|
2614
2614
|
const p = t.atRoot;
|
|
2615
2615
|
p && (t.atRoot = !1), t.atKey && (t.atKey = !1);
|
|
2616
2616
|
let f = n.offset + n.start.source.length;
|
|
2617
2617
|
for (let y = 0; y < n.items.length; ++y) {
|
|
2618
|
-
const
|
|
2618
|
+
const w = n.items[y], { start: N, key: S, sep: E, value: A } = w, I = fe(N, {
|
|
2619
2619
|
flow: a,
|
|
2620
2620
|
indicator: "explicit-key-ind",
|
|
2621
|
-
next:
|
|
2621
|
+
next: S ?? (E == null ? void 0 : E[0]),
|
|
2622
2622
|
offset: f,
|
|
2623
2623
|
onError: i,
|
|
2624
2624
|
parentIndent: n.indent,
|
|
2625
2625
|
startOnNewline: !1
|
|
2626
2626
|
});
|
|
2627
|
-
if (
|
|
2628
|
-
if (
|
|
2629
|
-
y === 0 &&
|
|
2630
|
-
` +
|
|
2627
|
+
if (!I.found) {
|
|
2628
|
+
if (!I.anchor && !I.tag && !E && !A) {
|
|
2629
|
+
y === 0 && I.comma ? i(I.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${a}`) : y < n.items.length - 1 && i(I.start, "UNEXPECTED_TOKEN", `Unexpected empty item in ${a}`), I.comment && (c.comment ? c.comment += `
|
|
2630
|
+
` + I.comment : c.comment = I.comment), f = I.end;
|
|
2631
2631
|
continue;
|
|
2632
2632
|
}
|
|
2633
|
-
!o && t.options.strict && Ee(
|
|
2634
|
-
|
|
2633
|
+
!o && t.options.strict && Ee(S) && i(
|
|
2634
|
+
S,
|
|
2635
2635
|
// checked by containsNewline()
|
|
2636
2636
|
"MULTILINE_IMPLICIT_KEY",
|
|
2637
2637
|
"Implicit keys of flow sequence pairs need to be on a single line"
|
|
2638
2638
|
);
|
|
2639
2639
|
}
|
|
2640
2640
|
if (y === 0)
|
|
2641
|
-
|
|
2642
|
-
else if (
|
|
2643
|
-
let
|
|
2641
|
+
I.comma && i(I.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${a}`);
|
|
2642
|
+
else if (I.comma || i(I.start, "MISSING_CHAR", `Missing , between ${a} items`), I.comment) {
|
|
2643
|
+
let k = "";
|
|
2644
2644
|
e: for (const O of N)
|
|
2645
2645
|
switch (O.type) {
|
|
2646
2646
|
case "comma":
|
|
2647
2647
|
case "space":
|
|
2648
2648
|
break;
|
|
2649
2649
|
case "comment":
|
|
2650
|
-
|
|
2650
|
+
k = O.source.substring(1);
|
|
2651
2651
|
break e;
|
|
2652
2652
|
default:
|
|
2653
2653
|
break e;
|
|
2654
2654
|
}
|
|
2655
|
-
if (
|
|
2655
|
+
if (k) {
|
|
2656
2656
|
let O = c.items[c.items.length - 1];
|
|
2657
|
-
|
|
2658
|
-
` +
|
|
2657
|
+
v(O) && (O = O.value ?? O.key), O.comment ? O.comment += `
|
|
2658
|
+
` + k : O.comment = k, I.comment = I.comment.substring(k.length + 1);
|
|
2659
2659
|
}
|
|
2660
2660
|
}
|
|
2661
|
-
if (!o && !E &&
|
|
2662
|
-
const
|
|
2663
|
-
c.items.push(
|
|
2661
|
+
if (!o && !E && !I.found) {
|
|
2662
|
+
const k = A ? s(t, A, I, i) : e(t, I.end, E, null, I, i);
|
|
2663
|
+
c.items.push(k), f = k.range[2], st(A) && i(k.range, "BLOCK_IN_FLOW", tt);
|
|
2664
2664
|
} else {
|
|
2665
2665
|
t.atKey = !0;
|
|
2666
|
-
const
|
|
2667
|
-
st(
|
|
2668
|
-
const P =
|
|
2666
|
+
const k = I.end, O = S ? s(t, S, I, i) : e(t, k, N, null, I, i);
|
|
2667
|
+
st(S) && i(O.range, "BLOCK_IN_FLOW", tt), t.atKey = !1;
|
|
2668
|
+
const P = fe(E ?? [], {
|
|
2669
2669
|
flow: a,
|
|
2670
2670
|
indicator: "map-value-ind",
|
|
2671
2671
|
next: A,
|
|
@@ -2675,7 +2675,7 @@ function Cn({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
2675
2675
|
startOnNewline: !1
|
|
2676
2676
|
});
|
|
2677
2677
|
if (P.found) {
|
|
2678
|
-
if (!o &&
|
|
2678
|
+
if (!o && !I.found && t.options.strict) {
|
|
2679
2679
|
if (E)
|
|
2680
2680
|
for (const F of E) {
|
|
2681
2681
|
if (F === P.found)
|
|
@@ -2685,21 +2685,21 @@ function Cn({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
2685
2685
|
break;
|
|
2686
2686
|
}
|
|
2687
2687
|
}
|
|
2688
|
-
|
|
2688
|
+
I.start < P.found.offset - 1024 && i(P.found, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit flow sequence key");
|
|
2689
2689
|
}
|
|
2690
2690
|
} else A && ("source" in A && ((m = A.source) == null ? void 0 : m[0]) === ":" ? i(A, "MISSING_CHAR", `Missing space after : in ${a}`) : i(P.start, "MISSING_CHAR", `Missing , or : between ${a} items`));
|
|
2691
2691
|
const J = A ? s(t, A, P, i) : P.found ? e(t, P.end, E, null, P, i) : null;
|
|
2692
2692
|
J ? st(A) && i(J.range, "BLOCK_IN_FLOW", tt) : P.comment && (O.comment ? O.comment += `
|
|
2693
2693
|
` + P.comment : O.comment = P.comment);
|
|
2694
|
-
const R = new
|
|
2695
|
-
if (t.options.keepSourceTokens && (R.srcToken =
|
|
2694
|
+
const R = new M(O, J);
|
|
2695
|
+
if (t.options.keepSourceTokens && (R.srcToken = w), o) {
|
|
2696
2696
|
const F = c;
|
|
2697
|
-
|
|
2697
|
+
Os(t, F.items, O) && i(k, "DUPLICATE_KEY", "Map keys must be unique"), F.items.push(R);
|
|
2698
2698
|
} else {
|
|
2699
|
-
const F = new
|
|
2699
|
+
const F = new j(t.schema);
|
|
2700
2700
|
F.flow = !0, F.items.push(R);
|
|
2701
|
-
const
|
|
2702
|
-
F.range = [O.range[0],
|
|
2701
|
+
const vt = (J ?? O).range;
|
|
2702
|
+
F.range = [O.range[0], vt[1], vt[2]], c.items.push(F);
|
|
2703
2703
|
}
|
|
2704
2704
|
f = J ? J.range[2] : P.end;
|
|
2705
2705
|
}
|
|
@@ -2709,11 +2709,11 @@ function Cn({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
2709
2709
|
if ((d == null ? void 0 : d.source) === h)
|
|
2710
2710
|
u = d.offset + d.source.length;
|
|
2711
2711
|
else {
|
|
2712
|
-
const y = a[0].toUpperCase() + a.substring(1),
|
|
2713
|
-
i(f, p ? "MISSING_CHAR" : "BAD_INDENT",
|
|
2712
|
+
const y = a[0].toUpperCase() + a.substring(1), w = p ? `${y} must end with a ${h}` : `${y} in block collection must be sufficiently indented and end with a ${h}`;
|
|
2713
|
+
i(f, p ? "MISSING_CHAR" : "BAD_INDENT", w), d && d.source.length !== 1 && g.unshift(d);
|
|
2714
2714
|
}
|
|
2715
2715
|
if (g.length > 0) {
|
|
2716
|
-
const y =
|
|
2716
|
+
const y = Ce(g, u, t.options.strict, i);
|
|
2717
2717
|
y.comment && (c.comment ? c.comment += `
|
|
2718
2718
|
` + y.comment : c.comment = y.comment), c.range = [n.offset, u, y.offset];
|
|
2719
2719
|
} else
|
|
@@ -2721,10 +2721,10 @@ function Cn({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
2721
2721
|
return c;
|
|
2722
2722
|
}
|
|
2723
2723
|
function nt(s, e, t, n, i, r) {
|
|
2724
|
-
const o = t.type === "block-map" ?
|
|
2724
|
+
const o = t.type === "block-map" ? In(s, e, t, n, r) : t.type === "block-seq" ? An(s, e, t, n, r) : On(s, e, t, n, r), a = o.constructor;
|
|
2725
2725
|
return i === "!" || i === a.tagName ? (o.tag = a.tagName, o) : (i && (o.tag = i), o);
|
|
2726
2726
|
}
|
|
2727
|
-
function
|
|
2727
|
+
function Tn(s, e, t, n, i) {
|
|
2728
2728
|
var h;
|
|
2729
2729
|
const r = n.tag, o = r ? e.directives.tagName(r.source, (d) => i(r, "TAG_RESOLVE_FAILED", d)) : null;
|
|
2730
2730
|
if (t.type === "block-seq") {
|
|
@@ -2732,7 +2732,7 @@ function _n(s, e, t, n, i) {
|
|
|
2732
2732
|
u && (!g || g.offset < u.offset) && i(u, "MISSING_CHAR", "Missing newline after block sequence props");
|
|
2733
2733
|
}
|
|
2734
2734
|
const a = t.type === "block-map" ? "map" : t.type === "block-seq" ? "seq" : t.start.source === "{" ? "map" : "seq";
|
|
2735
|
-
if (!r || !o || o === "!" || o ===
|
|
2735
|
+
if (!r || !o || o === "!" || o === j.tagName && a === "map" || o === te.tagName && a === "seq")
|
|
2736
2736
|
return nt(s, e, t, i, o);
|
|
2737
2737
|
let l = e.schema.tags.find((d) => d.tag === o && d.collection === a);
|
|
2738
2738
|
if (!l) {
|
|
@@ -2742,14 +2742,14 @@ function _n(s, e, t, n, i) {
|
|
|
2742
2742
|
else
|
|
2743
2743
|
return d ? i(r, "BAD_COLLECTION_TYPE", `${d.tag} used for ${a} collection, but expects ${d.collection ?? "scalar"}`, !0) : i(r, "TAG_RESOLVE_FAILED", `Unresolved tag: ${o}`, !0), nt(s, e, t, i, o);
|
|
2744
2744
|
}
|
|
2745
|
-
const c = nt(s, e, t, i, o, l), p = ((h = l.resolve) == null ? void 0 : h.call(l, c, (d) => i(r, "TAG_RESOLVE_FAILED", d), e.options)) ?? c, f = C(p) ? p : new
|
|
2745
|
+
const c = nt(s, e, t, i, o, l), p = ((h = l.resolve) == null ? void 0 : h.call(l, c, (d) => i(r, "TAG_RESOLVE_FAILED", d), e.options)) ?? c, f = C(p) ? p : new $(p);
|
|
2746
2746
|
return f.range = c.range, f.tag = o, l != null && l.format && (f.format = l.format), f;
|
|
2747
2747
|
}
|
|
2748
|
-
function
|
|
2749
|
-
const n = e.offset, i =
|
|
2748
|
+
function Ln(s, e, t) {
|
|
2749
|
+
const n = e.offset, i = Cn(e, s.options.strict, t);
|
|
2750
2750
|
if (!i)
|
|
2751
2751
|
return { value: "", type: null, comment: "", range: [n, n, n] };
|
|
2752
|
-
const r = i.mode === ">" ?
|
|
2752
|
+
const r = i.mode === ">" ? $.BLOCK_FOLDED : $.BLOCK_LITERAL, o = e.source ? vn(e.source) : [];
|
|
2753
2753
|
let a = o.length;
|
|
2754
2754
|
for (let u = o.length - 1; u >= 0; --u) {
|
|
2755
2755
|
const m = o[u][1];
|
|
@@ -2784,12 +2784,12 @@ function vn(s, e, t) {
|
|
|
2784
2784
|
for (let u = p; u < a; ++u) {
|
|
2785
2785
|
let [m, y] = o[u];
|
|
2786
2786
|
c += m.length + y.length + 1;
|
|
2787
|
-
const
|
|
2788
|
-
if (
|
|
2789
|
-
const
|
|
2790
|
-
t(c - y.length - (
|
|
2787
|
+
const w = y[y.length - 1] === "\r";
|
|
2788
|
+
if (w && (y = y.slice(0, -1)), y && m.length < l) {
|
|
2789
|
+
const S = `Block scalar lines must not be less indented than their ${i.indent ? "explicit indentation indicator" : "first line"}`;
|
|
2790
|
+
t(c - y.length - (w ? 2 : 1), "BAD_INDENT", S), m = "";
|
|
2791
2791
|
}
|
|
2792
|
-
r ===
|
|
2792
|
+
r === $.BLOCK_LITERAL ? (f += h + m.slice(l) + y, h = `
|
|
2793
2793
|
`) : m.length > l || y[0] === " " ? (h === " " ? h = `
|
|
2794
2794
|
` : !d && h === `
|
|
2795
2795
|
` && (h = `
|
|
@@ -2818,7 +2818,7 @@ function vn(s, e, t) {
|
|
|
2818
2818
|
const g = n + i.length + e.source.length;
|
|
2819
2819
|
return { value: f, type: r, comment: i.comment, range: [n, g, g] };
|
|
2820
2820
|
}
|
|
2821
|
-
function
|
|
2821
|
+
function Cn({ offset: s, props: e }, t, n) {
|
|
2822
2822
|
if (e[0].type !== "block-scalar-header")
|
|
2823
2823
|
return n(e[0], "IMPOSSIBLE", "Block scalar header not found"), null;
|
|
2824
2824
|
const { source: i } = e[0], r = i[0];
|
|
@@ -2858,25 +2858,25 @@ function Pn({ offset: s, props: e }, t, n) {
|
|
|
2858
2858
|
}
|
|
2859
2859
|
return { mode: r, indent: o, chomp: a, comment: p, length: f };
|
|
2860
2860
|
}
|
|
2861
|
-
function
|
|
2861
|
+
function vn(s) {
|
|
2862
2862
|
const e = s.split(/\n( *)/), t = e[0], n = t.match(/^( *)/), r = [n != null && n[1] ? [n[1], t.slice(n[1].length)] : ["", t]];
|
|
2863
2863
|
for (let o = 1; o < e.length; o += 2)
|
|
2864
2864
|
r.push([e[o], e[o + 1]]);
|
|
2865
2865
|
return r;
|
|
2866
2866
|
}
|
|
2867
|
-
function
|
|
2867
|
+
function _n(s, e, t) {
|
|
2868
2868
|
const { offset: n, type: i, source: r, end: o } = s;
|
|
2869
2869
|
let a, l;
|
|
2870
2870
|
const c = (h, d, g) => t(n + h, d, g);
|
|
2871
2871
|
switch (i) {
|
|
2872
2872
|
case "scalar":
|
|
2873
|
-
a =
|
|
2873
|
+
a = $.PLAIN, l = Pn(r, c);
|
|
2874
2874
|
break;
|
|
2875
2875
|
case "single-quoted-scalar":
|
|
2876
|
-
a =
|
|
2876
|
+
a = $.QUOTE_SINGLE, l = Dn(r, c);
|
|
2877
2877
|
break;
|
|
2878
2878
|
case "double-quoted-scalar":
|
|
2879
|
-
a =
|
|
2879
|
+
a = $.QUOTE_DOUBLE, l = Mn(r, c);
|
|
2880
2880
|
break;
|
|
2881
2881
|
default:
|
|
2882
2882
|
return t(s, "UNEXPECTED_TOKEN", `Expected a flow scalar value, but found: ${i}`), {
|
|
@@ -2886,7 +2886,7 @@ function Bn(s, e, t) {
|
|
|
2886
2886
|
range: [n, n + r.length, n + r.length]
|
|
2887
2887
|
};
|
|
2888
2888
|
}
|
|
2889
|
-
const p = n + r.length, f =
|
|
2889
|
+
const p = n + r.length, f = Ce(o, p, e, t);
|
|
2890
2890
|
return {
|
|
2891
2891
|
value: l,
|
|
2892
2892
|
type: a,
|
|
@@ -2894,7 +2894,7 @@ function Bn(s, e, t) {
|
|
|
2894
2894
|
range: [n, p, f.offset]
|
|
2895
2895
|
};
|
|
2896
2896
|
}
|
|
2897
|
-
function
|
|
2897
|
+
function Pn(s, e) {
|
|
2898
2898
|
let t = "";
|
|
2899
2899
|
switch (s[0]) {
|
|
2900
2900
|
case " ":
|
|
@@ -2917,12 +2917,12 @@ function Mn(s, e) {
|
|
|
2917
2917
|
break;
|
|
2918
2918
|
}
|
|
2919
2919
|
}
|
|
2920
|
-
return t && e(0, "BAD_SCALAR_START", `Plain value cannot start with ${t}`),
|
|
2920
|
+
return t && e(0, "BAD_SCALAR_START", `Plain value cannot start with ${t}`), Ts(s);
|
|
2921
2921
|
}
|
|
2922
|
-
function
|
|
2923
|
-
return (s[s.length - 1] !== "'" || s.length === 1) && e(s.length, "MISSING_CHAR", "Missing closing 'quote"),
|
|
2922
|
+
function Dn(s, e) {
|
|
2923
|
+
return (s[s.length - 1] !== "'" || s.length === 1) && e(s.length, "MISSING_CHAR", "Missing closing 'quote"), Ts(s.slice(1, -1)).replace(/''/g, "'");
|
|
2924
2924
|
}
|
|
2925
|
-
function
|
|
2925
|
+
function Ts(s) {
|
|
2926
2926
|
let e, t;
|
|
2927
2927
|
try {
|
|
2928
2928
|
e = new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
@@ -2942,7 +2942,7 @@ function As(s) {
|
|
|
2942
2942
|
const a = /[ \t]*(.*)/sy;
|
|
2943
2943
|
return a.lastIndex = o, n = a.exec(s), i + r + ((n == null ? void 0 : n[1]) ?? "");
|
|
2944
2944
|
}
|
|
2945
|
-
function
|
|
2945
|
+
function Mn(s, e) {
|
|
2946
2946
|
let t = "";
|
|
2947
2947
|
for (let n = 1; n < s.length - 1; ++n) {
|
|
2948
2948
|
const i = s[n];
|
|
@@ -2950,11 +2950,11 @@ function Kn(s, e) {
|
|
|
2950
2950
|
`))
|
|
2951
2951
|
if (i === `
|
|
2952
2952
|
`) {
|
|
2953
|
-
const { fold: r, offset: o } =
|
|
2953
|
+
const { fold: r, offset: o } = jn(s, n);
|
|
2954
2954
|
t += r, n = o;
|
|
2955
2955
|
} else if (i === "\\") {
|
|
2956
2956
|
let r = s[++n];
|
|
2957
|
-
const o =
|
|
2957
|
+
const o = Bn[r];
|
|
2958
2958
|
if (o)
|
|
2959
2959
|
t += o;
|
|
2960
2960
|
else if (r === `
|
|
@@ -2967,7 +2967,7 @@ function Kn(s, e) {
|
|
|
2967
2967
|
r = s[++n + 1];
|
|
2968
2968
|
else if (r === "x" || r === "u" || r === "U") {
|
|
2969
2969
|
const a = r === "x" ? 2 : r === "u" ? 4 : 8;
|
|
2970
|
-
t +=
|
|
2970
|
+
t += Kn(s, n + 1, a, e), n += a;
|
|
2971
2971
|
} else {
|
|
2972
2972
|
const a = s.substr(n - 1, 2);
|
|
2973
2973
|
e(n - 1, "BAD_DQ_ESCAPE", `Invalid escape sequence ${a}`), t += a;
|
|
@@ -2985,7 +2985,7 @@ function Kn(s, e) {
|
|
|
2985
2985
|
}
|
|
2986
2986
|
return (s[s.length - 1] !== '"' || s.length === 1) && e(s.length, "MISSING_CHAR", 'Missing closing "quote'), t;
|
|
2987
2987
|
}
|
|
2988
|
-
function
|
|
2988
|
+
function jn(s, e) {
|
|
2989
2989
|
let t = "", n = s[e + 1];
|
|
2990
2990
|
for (; (n === " " || n === " " || n === `
|
|
2991
2991
|
` || n === "\r") && !(n === "\r" && s[e + 2] !== `
|
|
@@ -2995,7 +2995,7 @@ function Rn(s, e) {
|
|
|
2995
2995
|
`), e += 1, n = s[e + 1];
|
|
2996
2996
|
return t || (t = " "), { fold: t, offset: e };
|
|
2997
2997
|
}
|
|
2998
|
-
const
|
|
2998
|
+
const Bn = {
|
|
2999
2999
|
0: "\0",
|
|
3000
3000
|
// null character
|
|
3001
3001
|
a: "\x07",
|
|
@@ -3029,7 +3029,7 @@ const Fn = {
|
|
|
3029
3029
|
"\\": "\\",
|
|
3030
3030
|
" ": " "
|
|
3031
3031
|
};
|
|
3032
|
-
function
|
|
3032
|
+
function Kn(s, e, t, n) {
|
|
3033
3033
|
const i = s.substr(e, t), o = i.length === t && /^[0-9a-fA-F]+$/.test(i) ? parseInt(i, 16) : NaN;
|
|
3034
3034
|
try {
|
|
3035
3035
|
return String.fromCodePoint(o);
|
|
@@ -3038,21 +3038,21 @@ function qn(s, e, t, n) {
|
|
|
3038
3038
|
return n(e - 2, "BAD_DQ_ESCAPE", `Invalid escape sequence ${a}`), a;
|
|
3039
3039
|
}
|
|
3040
3040
|
}
|
|
3041
|
-
function
|
|
3042
|
-
const { value: i, type: r, comment: o, range: a } = e.type === "block-scalar" ?
|
|
3041
|
+
function Ls(s, e, t, n) {
|
|
3042
|
+
const { value: i, type: r, comment: o, range: a } = e.type === "block-scalar" ? Ln(s, e, n) : _n(e, s.options.strict, n), l = t ? s.directives.tagName(t.source, (f) => n(t, "TAG_RESOLVE_FAILED", f)) : null;
|
|
3043
3043
|
let c;
|
|
3044
|
-
s.options.stringKeys && s.atKey ? c = s.schema[V] : l ? c =
|
|
3044
|
+
s.options.stringKeys && s.atKey ? c = s.schema[V] : l ? c = Rn(s.schema, i, l, t, n) : e.type === "scalar" ? c = Fn(s, i, e, n) : c = s.schema[V];
|
|
3045
3045
|
let p;
|
|
3046
3046
|
try {
|
|
3047
3047
|
const f = c.resolve(i, (h) => n(t ?? e, "TAG_RESOLVE_FAILED", h), s.options);
|
|
3048
|
-
p = T(f) ? f : new
|
|
3048
|
+
p = T(f) ? f : new $(f);
|
|
3049
3049
|
} catch (f) {
|
|
3050
3050
|
const h = f instanceof Error ? f.message : String(f);
|
|
3051
|
-
n(t ?? e, "TAG_RESOLVE_FAILED", h), p = new
|
|
3051
|
+
n(t ?? e, "TAG_RESOLVE_FAILED", h), p = new $(i);
|
|
3052
3052
|
}
|
|
3053
3053
|
return p.range = a, p.source = i, r && (p.type = r), l && (p.tag = l), c.format && (p.format = c.format), o && (p.comment = o), p;
|
|
3054
3054
|
}
|
|
3055
|
-
function
|
|
3055
|
+
function Rn(s, e, t, n, i) {
|
|
3056
3056
|
var a;
|
|
3057
3057
|
if (t === "!")
|
|
3058
3058
|
return s[V];
|
|
@@ -3069,7 +3069,7 @@ function Un(s, e, t, n, i) {
|
|
|
3069
3069
|
const o = s.knownTags[t];
|
|
3070
3070
|
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[V]);
|
|
3071
3071
|
}
|
|
3072
|
-
function
|
|
3072
|
+
function Fn({ atKey: s, directives: e, schema: t }, n, i, r) {
|
|
3073
3073
|
const o = t.tags.find((a) => {
|
|
3074
3074
|
var l;
|
|
3075
3075
|
return (a.default === !0 || s && a.default === "key") && ((l = a.test) == null ? void 0 : l.test(n));
|
|
@@ -3086,7 +3086,7 @@ function Yn({ atKey: s, directives: e, schema: t }, n, i, r) {
|
|
|
3086
3086
|
}
|
|
3087
3087
|
return o;
|
|
3088
3088
|
}
|
|
3089
|
-
function
|
|
3089
|
+
function qn(s, e, t) {
|
|
3090
3090
|
if (e) {
|
|
3091
3091
|
t ?? (t = e.length);
|
|
3092
3092
|
for (let n = t - 1; n >= 0; --n) {
|
|
@@ -3105,25 +3105,25 @@ function Vn(s, e, t) {
|
|
|
3105
3105
|
}
|
|
3106
3106
|
return s;
|
|
3107
3107
|
}
|
|
3108
|
-
const
|
|
3109
|
-
function
|
|
3108
|
+
const Un = { composeNode: Cs, composeEmptyNode: It };
|
|
3109
|
+
function Cs(s, e, t, n) {
|
|
3110
3110
|
const i = s.atKey, { spaceBefore: r, comment: o, anchor: a, tag: l } = t;
|
|
3111
3111
|
let c, p = !0;
|
|
3112
3112
|
switch (e.type) {
|
|
3113
3113
|
case "alias":
|
|
3114
|
-
c =
|
|
3114
|
+
c = Yn(s, e, n), (a || l) && n(e, "ALIAS_PROPS", "An alias node must not specify any properties");
|
|
3115
3115
|
break;
|
|
3116
3116
|
case "scalar":
|
|
3117
3117
|
case "single-quoted-scalar":
|
|
3118
3118
|
case "double-quoted-scalar":
|
|
3119
3119
|
case "block-scalar":
|
|
3120
|
-
c =
|
|
3120
|
+
c = Ls(s, e, l, n), a && (c.anchor = a.source.substring(1));
|
|
3121
3121
|
break;
|
|
3122
3122
|
case "block-map":
|
|
3123
3123
|
case "block-seq":
|
|
3124
3124
|
case "flow-collection":
|
|
3125
3125
|
try {
|
|
3126
|
-
c =
|
|
3126
|
+
c = Tn(Un, s, e, t, n), a && (c.anchor = a.source.substring(1));
|
|
3127
3127
|
} catch (f) {
|
|
3128
3128
|
const h = f instanceof Error ? f.message : String(f);
|
|
3129
3129
|
n(e, "RESOURCE_EXHAUSTION", h);
|
|
@@ -3134,31 +3134,31 @@ function Ts(s, e, t, n) {
|
|
|
3134
3134
|
n(e, "UNEXPECTED_TOKEN", f), p = !1;
|
|
3135
3135
|
}
|
|
3136
3136
|
}
|
|
3137
|
-
return c ?? (c =
|
|
3137
|
+
return c ?? (c = It(s, e.offset, void 0, null, t, n)), a && c.anchor === "" && n(a, "BAD_ALIAS", "Anchor cannot be an empty string"), i && s.options.stringKeys && (!T(c) || typeof c.value != "string" || c.tag && c.tag !== "tag:yaml.org,2002:str") && n(l ?? e, "NON_STRING_KEY", "With stringKeys, all keys must be strings"), r && (c.spaceBefore = !0), o && (e.type === "scalar" && e.source === "" ? c.comment = o : c.commentBefore = o), s.options.keepSourceTokens && p && (c.srcToken = e), c;
|
|
3138
3138
|
}
|
|
3139
|
-
function
|
|
3139
|
+
function It(s, e, t, n, { spaceBefore: i, comment: r, anchor: o, tag: a, end: l }, c) {
|
|
3140
3140
|
const p = {
|
|
3141
3141
|
type: "scalar",
|
|
3142
|
-
offset:
|
|
3142
|
+
offset: qn(e, t, n),
|
|
3143
3143
|
indent: -1,
|
|
3144
3144
|
source: ""
|
|
3145
|
-
}, f =
|
|
3145
|
+
}, f = Ls(s, p, a, c);
|
|
3146
3146
|
return o && (f.anchor = o.source.substring(1), f.anchor === "" && c(o, "BAD_ALIAS", "Anchor cannot be an empty string")), i && (f.spaceBefore = !0), r && (f.comment = r, f.range[2] = l), f;
|
|
3147
3147
|
}
|
|
3148
|
-
function
|
|
3148
|
+
function Yn({ options: s }, { offset: e, source: t, end: n }, i) {
|
|
3149
3149
|
const r = new dt(t.substring(1));
|
|
3150
3150
|
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);
|
|
3151
|
-
const o = e + t.length, a =
|
|
3151
|
+
const o = e + t.length, a = Ce(n, o, s.strict, i);
|
|
3152
3152
|
return r.range = [e, o, a.offset], a.comment && (r.comment = a.comment), r;
|
|
3153
3153
|
}
|
|
3154
|
-
function
|
|
3155
|
-
const a = Object.assign({ _directives: e }, s), l = new
|
|
3154
|
+
function Vn(s, e, { offset: t, start: n, value: i, end: r }, o) {
|
|
3155
|
+
const a = Object.assign({ _directives: e }, s), l = new Le(void 0, a), c = {
|
|
3156
3156
|
atKey: !1,
|
|
3157
3157
|
atRoot: !0,
|
|
3158
3158
|
directives: l.directives,
|
|
3159
3159
|
options: l.options,
|
|
3160
3160
|
schema: l.schema
|
|
3161
|
-
}, p =
|
|
3161
|
+
}, p = fe(n, {
|
|
3162
3162
|
indicator: "doc-start",
|
|
3163
3163
|
next: i ?? (r == null ? void 0 : r[0]),
|
|
3164
3164
|
offset: t,
|
|
@@ -3166,11 +3166,11 @@ function Wn(s, e, { offset: t, start: n, value: i, end: r }, o) {
|
|
|
3166
3166
|
parentIndent: 0,
|
|
3167
3167
|
startOnNewline: !0
|
|
3168
3168
|
});
|
|
3169
|
-
p.found && (l.directives.docStart = !0, i && (i.type === "block-map" || i.type === "block-seq") && !p.hasNewline && o(p.end, "MISSING_CHAR", "Block collection cannot start on same line with directives-end marker")), l.contents = i ?
|
|
3170
|
-
const f = l.contents.range[2], h =
|
|
3169
|
+
p.found && (l.directives.docStart = !0, i && (i.type === "block-map" || i.type === "block-seq") && !p.hasNewline && o(p.end, "MISSING_CHAR", "Block collection cannot start on same line with directives-end marker")), l.contents = i ? Cs(c, i, p, o) : It(c, p.end, n, null, p, o);
|
|
3170
|
+
const f = l.contents.range[2], h = Ce(r, f, !1, o);
|
|
3171
3171
|
return h.comment && (l.comment = h.comment), l.range = [t, f, h.offset], l;
|
|
3172
3172
|
}
|
|
3173
|
-
function
|
|
3173
|
+
function ge(s) {
|
|
3174
3174
|
if (typeof s == "number")
|
|
3175
3175
|
return [s, s + 1];
|
|
3176
3176
|
if (Array.isArray(s))
|
|
@@ -3178,7 +3178,7 @@ function ye(s) {
|
|
|
3178
3178
|
const { offset: e, source: t } = s;
|
|
3179
3179
|
return [e, e + (typeof t == "string" ? t.length : 1)];
|
|
3180
3180
|
}
|
|
3181
|
-
function
|
|
3181
|
+
function Ft(s) {
|
|
3182
3182
|
var i;
|
|
3183
3183
|
let e = "", t = !1, n = !1;
|
|
3184
3184
|
for (let r = 0; r < s.length; ++r) {
|
|
@@ -3199,15 +3199,15 @@ function Mt(s) {
|
|
|
3199
3199
|
}
|
|
3200
3200
|
return { comment: e, afterEmptyLine: n };
|
|
3201
3201
|
}
|
|
3202
|
-
class
|
|
3202
|
+
class Jn {
|
|
3203
3203
|
constructor(e = {}) {
|
|
3204
3204
|
this.doc = null, this.atDirectives = !1, this.prelude = [], this.errors = [], this.warnings = [], this.onError = (t, n, i, r) => {
|
|
3205
|
-
const o =
|
|
3206
|
-
r ? this.warnings.push(new
|
|
3205
|
+
const o = ge(t);
|
|
3206
|
+
r ? this.warnings.push(new $n(o, n, i)) : this.errors.push(new be(o, n, i));
|
|
3207
3207
|
}, this.directives = new D({ version: e.version || "1.2" }), this.options = e;
|
|
3208
3208
|
}
|
|
3209
3209
|
decorate(e, t) {
|
|
3210
|
-
const { comment: n, afterEmptyLine: i } =
|
|
3210
|
+
const { comment: n, afterEmptyLine: i } = Ft(this.prelude);
|
|
3211
3211
|
if (n) {
|
|
3212
3212
|
const r = e.contents;
|
|
3213
3213
|
if (t)
|
|
@@ -3217,7 +3217,7 @@ ${n}` : n;
|
|
|
3217
3217
|
e.commentBefore = n;
|
|
3218
3218
|
else if (L(r) && !r.flow && r.items.length > 0) {
|
|
3219
3219
|
let o = r.items[0];
|
|
3220
|
-
|
|
3220
|
+
v(o) && (o = o.key);
|
|
3221
3221
|
const a = o.commentBefore;
|
|
3222
3222
|
o.commentBefore = a ? `${n}
|
|
3223
3223
|
${a}` : n;
|
|
@@ -3243,7 +3243,7 @@ ${o}` : n;
|
|
|
3243
3243
|
*/
|
|
3244
3244
|
streamInfo() {
|
|
3245
3245
|
return {
|
|
3246
|
-
comment:
|
|
3246
|
+
comment: Ft(this.prelude).comment,
|
|
3247
3247
|
directives: this.directives,
|
|
3248
3248
|
errors: this.errors,
|
|
3249
3249
|
warnings: this.warnings
|
|
@@ -3265,12 +3265,12 @@ ${o}` : n;
|
|
|
3265
3265
|
switch (e.type) {
|
|
3266
3266
|
case "directive":
|
|
3267
3267
|
this.directives.add(e.source, (t, n, i) => {
|
|
3268
|
-
const r =
|
|
3268
|
+
const r = ge(e);
|
|
3269
3269
|
r[0] += t, this.onError(r, "BAD_DIRECTIVE", n, i);
|
|
3270
3270
|
}), this.prelude.push(e.source), this.atDirectives = !0;
|
|
3271
3271
|
break;
|
|
3272
3272
|
case "document": {
|
|
3273
|
-
const t =
|
|
3273
|
+
const t = Vn(this.options, this.directives, e, this.onError);
|
|
3274
3274
|
this.atDirectives && !t.directives.docStart && this.onError(e, "MISSING_CHAR", "Missing directives-end/doc-start indicator line"), this.decorate(t, !1), this.doc && (yield this.doc), this.doc = t, this.atDirectives = !1;
|
|
3275
3275
|
break;
|
|
3276
3276
|
}
|
|
@@ -3282,18 +3282,18 @@ ${o}` : n;
|
|
|
3282
3282
|
this.prelude.push(e.source);
|
|
3283
3283
|
break;
|
|
3284
3284
|
case "error": {
|
|
3285
|
-
const t = e.source ? `${e.message}: ${JSON.stringify(e.source)}` : e.message, n = new
|
|
3285
|
+
const t = e.source ? `${e.message}: ${JSON.stringify(e.source)}` : e.message, n = new be(ge(e), "UNEXPECTED_TOKEN", t);
|
|
3286
3286
|
this.atDirectives || !this.doc ? this.errors.push(n) : this.doc.errors.push(n);
|
|
3287
3287
|
break;
|
|
3288
3288
|
}
|
|
3289
3289
|
case "doc-end": {
|
|
3290
3290
|
if (!this.doc) {
|
|
3291
3291
|
const n = "Unexpected doc-end without preceding document";
|
|
3292
|
-
this.errors.push(new
|
|
3292
|
+
this.errors.push(new be(ge(e), "UNEXPECTED_TOKEN", n));
|
|
3293
3293
|
break;
|
|
3294
3294
|
}
|
|
3295
3295
|
this.doc.directives.docEnd = !0;
|
|
3296
|
-
const t =
|
|
3296
|
+
const t = Ce(e.end, e.offset + e.source.length, this.doc.options.strict, this.onError);
|
|
3297
3297
|
if (this.decorate(this.doc, !0), t.comment) {
|
|
3298
3298
|
const n = this.doc.comment;
|
|
3299
3299
|
this.doc.comment = n ? `${n}
|
|
@@ -3303,7 +3303,7 @@ ${t.comment}` : t.comment;
|
|
|
3303
3303
|
break;
|
|
3304
3304
|
}
|
|
3305
3305
|
default:
|
|
3306
|
-
this.errors.push(new
|
|
3306
|
+
this.errors.push(new be(ge(e), "UNEXPECTED_TOKEN", `Unsupported token ${e.type}`));
|
|
3307
3307
|
}
|
|
3308
3308
|
}
|
|
3309
3309
|
/**
|
|
@@ -3316,19 +3316,19 @@ ${t.comment}` : t.comment;
|
|
|
3316
3316
|
if (this.doc)
|
|
3317
3317
|
this.decorate(this.doc, !0), yield this.doc, this.doc = null;
|
|
3318
3318
|
else if (e) {
|
|
3319
|
-
const n = Object.assign({ _directives: this.directives }, this.options), i = new
|
|
3319
|
+
const n = Object.assign({ _directives: this.directives }, this.options), i = new Le(void 0, n);
|
|
3320
3320
|
this.atDirectives && this.onError(t, "MISSING_CHAR", "Missing directives-end indicator line"), i.range = [0, t, t], this.decorate(i, !1), yield i;
|
|
3321
3321
|
}
|
|
3322
3322
|
}
|
|
3323
3323
|
}
|
|
3324
|
-
const
|
|
3325
|
-
function
|
|
3324
|
+
const vs = "\uFEFF", _s = "", Ps = "", ft = "";
|
|
3325
|
+
function Hn(s) {
|
|
3326
3326
|
switch (s) {
|
|
3327
|
-
case
|
|
3327
|
+
case vs:
|
|
3328
3328
|
return "byte-order-mark";
|
|
3329
|
-
case Cs:
|
|
3330
|
-
return "doc-mode";
|
|
3331
3329
|
case _s:
|
|
3330
|
+
return "doc-mode";
|
|
3331
|
+
case Ps:
|
|
3332
3332
|
return "flow-error-end";
|
|
3333
3333
|
case ft:
|
|
3334
3334
|
return "scalar";
|
|
@@ -3396,9 +3396,9 @@ function q(s) {
|
|
|
3396
3396
|
return !1;
|
|
3397
3397
|
}
|
|
3398
3398
|
}
|
|
3399
|
-
const
|
|
3400
|
-
\r `), it = (s) => !s ||
|
|
3401
|
-
class
|
|
3399
|
+
const qt = new Set("0123456789ABCDEFabcdef"), Gn = new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"), De = new Set(",[]{}"), Wn = new Set(` ,[]{}
|
|
3400
|
+
\r `), it = (s) => !s || Wn.has(s);
|
|
3401
|
+
class Qn {
|
|
3402
3402
|
constructor() {
|
|
3403
3403
|
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;
|
|
3404
3404
|
}
|
|
@@ -3490,7 +3490,7 @@ class Zn {
|
|
|
3490
3490
|
let e = this.getLine();
|
|
3491
3491
|
if (e === null)
|
|
3492
3492
|
return this.setNext("stream");
|
|
3493
|
-
if (e[0] ===
|
|
3493
|
+
if (e[0] === vs && (yield* this.pushCount(1), e = e.substring(1)), e[0] === "%") {
|
|
3494
3494
|
let t = e.length, n = e.indexOf("#");
|
|
3495
3495
|
for (; n !== -1; ) {
|
|
3496
3496
|
const r = e[n - 1];
|
|
@@ -3514,7 +3514,7 @@ class Zn {
|
|
|
3514
3514
|
const t = yield* this.pushSpaces(!0);
|
|
3515
3515
|
return yield* this.pushCount(e.length - t), yield* this.pushNewline(), "stream";
|
|
3516
3516
|
}
|
|
3517
|
-
return yield
|
|
3517
|
+
return yield _s, yield* this.parseLineStart();
|
|
3518
3518
|
}
|
|
3519
3519
|
*parseLineStart() {
|
|
3520
3520
|
const e = this.charAt(0);
|
|
@@ -3577,7 +3577,7 @@ class Zn {
|
|
|
3577
3577
|
if (i === null)
|
|
3578
3578
|
return this.setNext("flow");
|
|
3579
3579
|
if ((n !== -1 && n < this.indentNext && i[0] !== "#" || n === 0 && (i.startsWith("---") || i.startsWith("...")) && q(i[3])) && !(n === this.indentNext - 1 && this.flowLevel === 1 && (i[0] === "]" || i[0] === "}")))
|
|
3580
|
-
return this.flowLevel = 0, yield
|
|
3580
|
+
return this.flowLevel = 0, yield Ps, yield* this.parseLineStart();
|
|
3581
3581
|
let r = 0;
|
|
3582
3582
|
for (; i[r] === ","; )
|
|
3583
3583
|
r += yield* this.pushCount(1), r += yield* this.pushSpaces(!0), this.flowKey = !1;
|
|
@@ -3723,14 +3723,14 @@ class Zn {
|
|
|
3723
3723
|
for (; i = this.buffer[++n]; )
|
|
3724
3724
|
if (i === ":") {
|
|
3725
3725
|
const r = this.buffer[n + 1];
|
|
3726
|
-
if (q(r) || e &&
|
|
3726
|
+
if (q(r) || e && De.has(r))
|
|
3727
3727
|
break;
|
|
3728
3728
|
t = n;
|
|
3729
3729
|
} else if (q(i)) {
|
|
3730
3730
|
let r = this.buffer[n + 1];
|
|
3731
3731
|
if (i === "\r" && (r === `
|
|
3732
3732
|
` ? (n += 1, i = `
|
|
3733
|
-
`, r = this.buffer[n + 1]) : t = n), r === "#" || e &&
|
|
3733
|
+
`, r = this.buffer[n + 1]) : t = n), r === "#" || e && De.has(r))
|
|
3734
3734
|
break;
|
|
3735
3735
|
if (i === `
|
|
3736
3736
|
`) {
|
|
@@ -3740,7 +3740,7 @@ class Zn {
|
|
|
3740
3740
|
n = Math.max(n, o - 2);
|
|
3741
3741
|
}
|
|
3742
3742
|
} else {
|
|
3743
|
-
if (e &&
|
|
3743
|
+
if (e && De.has(i))
|
|
3744
3744
|
break;
|
|
3745
3745
|
t = n;
|
|
3746
3746
|
}
|
|
@@ -3767,7 +3767,7 @@ class Zn {
|
|
|
3767
3767
|
case "?":
|
|
3768
3768
|
case ":": {
|
|
3769
3769
|
const t = this.flowLevel > 0, n = this.charAt(1);
|
|
3770
|
-
if (q(n) || t &&
|
|
3770
|
+
if (q(n) || t && De.has(n)) {
|
|
3771
3771
|
t ? this.flowKey && (this.flowKey = !1) : this.indentNext = this.indentValue + 1, e += yield* this.pushCount(1), e += yield* this.pushSpaces(!0);
|
|
3772
3772
|
continue e;
|
|
3773
3773
|
}
|
|
@@ -3786,9 +3786,9 @@ class Zn {
|
|
|
3786
3786
|
} else {
|
|
3787
3787
|
let e = this.pos + 1, t = this.buffer[e];
|
|
3788
3788
|
for (; t; )
|
|
3789
|
-
if (
|
|
3789
|
+
if (Gn.has(t))
|
|
3790
3790
|
t = this.buffer[++e];
|
|
3791
|
-
else if (t === "%" &&
|
|
3791
|
+
else if (t === "%" && qt.has(this.buffer[e + 1]) && qt.has(this.buffer[e + 2]))
|
|
3792
3792
|
t = this.buffer[e += 3];
|
|
3793
3793
|
else
|
|
3794
3794
|
break;
|
|
@@ -3816,7 +3816,7 @@ class Zn {
|
|
|
3816
3816
|
return yield* this.pushToIndex(t, !1);
|
|
3817
3817
|
}
|
|
3818
3818
|
}
|
|
3819
|
-
class
|
|
3819
|
+
class Xn {
|
|
3820
3820
|
constructor() {
|
|
3821
3821
|
this.lineStarts = [], this.addNewLine = (e) => this.lineStarts.push(e), this.linePos = (e) => {
|
|
3822
3822
|
let t = 0, n = this.lineStarts.length;
|
|
@@ -3839,7 +3839,7 @@ function Q(s, e) {
|
|
|
3839
3839
|
return !0;
|
|
3840
3840
|
return !1;
|
|
3841
3841
|
}
|
|
3842
|
-
function
|
|
3842
|
+
function Ut(s) {
|
|
3843
3843
|
for (let e = 0; e < s.length; ++e)
|
|
3844
3844
|
switch (s[e].type) {
|
|
3845
3845
|
case "space":
|
|
@@ -3851,7 +3851,7 @@ function Kt(s) {
|
|
|
3851
3851
|
}
|
|
3852
3852
|
return -1;
|
|
3853
3853
|
}
|
|
3854
|
-
function
|
|
3854
|
+
function Ds(s) {
|
|
3855
3855
|
switch (s == null ? void 0 : s.type) {
|
|
3856
3856
|
case "alias":
|
|
3857
3857
|
case "scalar":
|
|
@@ -3863,7 +3863,7 @@ function vs(s) {
|
|
|
3863
3863
|
return !1;
|
|
3864
3864
|
}
|
|
3865
3865
|
}
|
|
3866
|
-
function
|
|
3866
|
+
function Me(s) {
|
|
3867
3867
|
switch (s.type) {
|
|
3868
3868
|
case "document":
|
|
3869
3869
|
return s.start;
|
|
@@ -3895,25 +3895,25 @@ function ne(s) {
|
|
|
3895
3895
|
;
|
|
3896
3896
|
return s.splice(e, s.length);
|
|
3897
3897
|
}
|
|
3898
|
-
function
|
|
3898
|
+
function Ue(s, e) {
|
|
3899
3899
|
if (e.length < 1e5)
|
|
3900
3900
|
Array.prototype.push.apply(s, e);
|
|
3901
3901
|
else
|
|
3902
3902
|
for (let t = 0; t < e.length; ++t)
|
|
3903
3903
|
s.push(e[t]);
|
|
3904
3904
|
}
|
|
3905
|
-
function
|
|
3905
|
+
function Yt(s) {
|
|
3906
3906
|
if (s.start.type === "flow-seq-start")
|
|
3907
3907
|
for (const e of s.items)
|
|
3908
|
-
e.sep && !e.value && !Q(e.start, "explicit-key-ind") && !Q(e.sep, "map-value-ind") && (e.key && (e.value = e.key), delete e.key,
|
|
3908
|
+
e.sep && !e.value && !Q(e.start, "explicit-key-ind") && !Q(e.sep, "map-value-ind") && (e.key && (e.value = e.key), delete e.key, Ds(e.value) ? e.value.end ? Ue(e.value.end, e.sep) : e.value.end = e.sep : Ue(e.start, e.sep), delete e.sep);
|
|
3909
3909
|
}
|
|
3910
|
-
class
|
|
3910
|
+
class zn {
|
|
3911
3911
|
/**
|
|
3912
3912
|
* @param onNewLine - If defined, called separately with the start position of
|
|
3913
3913
|
* each new line (in `parse()`, including the start of input).
|
|
3914
3914
|
*/
|
|
3915
3915
|
constructor(e) {
|
|
3916
|
-
this.atNewLine = !0, this.atScalar = !1, this.indent = 0, this.offset = 0, this.onKeyLine = !1, this.stack = [], this.source = "", this.type = "", this.lexer = new
|
|
3916
|
+
this.atNewLine = !0, this.atScalar = !1, this.indent = 0, this.offset = 0, this.onKeyLine = !1, this.stack = [], this.source = "", this.type = "", this.lexer = new Qn(), this.onNewLine = e;
|
|
3917
3917
|
}
|
|
3918
3918
|
/**
|
|
3919
3919
|
* Parse `source` as a YAML stream.
|
|
@@ -3937,7 +3937,7 @@ class ei {
|
|
|
3937
3937
|
this.atScalar = !1, yield* this.step(), this.offset += e.length;
|
|
3938
3938
|
return;
|
|
3939
3939
|
}
|
|
3940
|
-
const t =
|
|
3940
|
+
const t = Hn(e);
|
|
3941
3941
|
if (t)
|
|
3942
3942
|
if (t === "scalar")
|
|
3943
3943
|
this.atNewLine = !1, this.atScalar = !0, this.type = "scalar";
|
|
@@ -4026,7 +4026,7 @@ class ei {
|
|
|
4026
4026
|
yield t;
|
|
4027
4027
|
else {
|
|
4028
4028
|
const n = this.peek(1);
|
|
4029
|
-
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" &&
|
|
4029
|
+
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" && Yt(t), n.type) {
|
|
4030
4030
|
case "document":
|
|
4031
4031
|
n.value = t;
|
|
4032
4032
|
break;
|
|
@@ -4061,7 +4061,7 @@ class ei {
|
|
|
4061
4061
|
}
|
|
4062
4062
|
if ((n.type === "document" || n.type === "block-map" || n.type === "block-seq") && (t.type === "block-map" || t.type === "block-seq")) {
|
|
4063
4063
|
const i = t.items[t.items.length - 1];
|
|
4064
|
-
i && !i.sep && !i.value && i.start.length > 0 &&
|
|
4064
|
+
i && !i.sep && !i.value && i.start.length > 0 && Ut(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));
|
|
4065
4065
|
}
|
|
4066
4066
|
}
|
|
4067
4067
|
}
|
|
@@ -4099,7 +4099,7 @@ class ei {
|
|
|
4099
4099
|
return yield* this.lineEnd(e);
|
|
4100
4100
|
switch (this.type) {
|
|
4101
4101
|
case "doc-start": {
|
|
4102
|
-
|
|
4102
|
+
Ut(e.start) !== -1 ? (yield* this.pop(), yield* this.step()) : e.start.push(this.sourceToken);
|
|
4103
4103
|
return;
|
|
4104
4104
|
}
|
|
4105
4105
|
case "anchor":
|
|
@@ -4120,7 +4120,7 @@ class ei {
|
|
|
4120
4120
|
}
|
|
4121
4121
|
*scalar(e) {
|
|
4122
4122
|
if (this.type === "map-value-ind") {
|
|
4123
|
-
const t =
|
|
4123
|
+
const t = Me(this.peek(2)), n = ne(t);
|
|
4124
4124
|
let i;
|
|
4125
4125
|
e.end ? (i = e.end, i.push(this.sourceToken), delete e.end) : i = [this.sourceToken];
|
|
4126
4126
|
const r = {
|
|
@@ -4174,7 +4174,7 @@ class ei {
|
|
|
4174
4174
|
if (this.atIndentedComment(t.start, e.indent)) {
|
|
4175
4175
|
const i = e.items[e.items.length - 2], r = (n = i == null ? void 0 : i.value) == null ? void 0 : n.end;
|
|
4176
4176
|
if (Array.isArray(r)) {
|
|
4177
|
-
|
|
4177
|
+
Ue(r, t.start), r.push(this.sourceToken), e.items.pop();
|
|
4178
4178
|
return;
|
|
4179
4179
|
}
|
|
4180
4180
|
}
|
|
@@ -4229,7 +4229,7 @@ class ei {
|
|
|
4229
4229
|
indent: this.indent,
|
|
4230
4230
|
items: [{ start: o, key: null, sep: [this.sourceToken] }]
|
|
4231
4231
|
});
|
|
4232
|
-
else if (
|
|
4232
|
+
else if (Ds(t.key) && !Q(t.sep, "newline")) {
|
|
4233
4233
|
const a = ne(t.start), l = t.key, c = t.sep;
|
|
4234
4234
|
c.push(this.sourceToken), delete t.key, delete t.sep, this.stack.push({
|
|
4235
4235
|
type: "block-map",
|
|
@@ -4307,7 +4307,7 @@ class ei {
|
|
|
4307
4307
|
if (this.atIndentedComment(t.start, e.indent)) {
|
|
4308
4308
|
const i = e.items[e.items.length - 2], r = (n = i == null ? void 0 : i.value) == null ? void 0 : n.end;
|
|
4309
4309
|
if (Array.isArray(r)) {
|
|
4310
|
-
|
|
4310
|
+
Ue(r, t.start), r.push(this.sourceToken), e.items.pop();
|
|
4311
4311
|
return;
|
|
4312
4312
|
}
|
|
4313
4313
|
}
|
|
@@ -4378,8 +4378,8 @@ class ei {
|
|
|
4378
4378
|
if (n.type === "block-map" && (this.type === "map-value-ind" && n.indent === e.indent || this.type === "newline" && !n.items[n.items.length - 1].sep))
|
|
4379
4379
|
yield* this.pop(), yield* this.step();
|
|
4380
4380
|
else if (this.type === "map-value-ind" && n.type !== "flow-collection") {
|
|
4381
|
-
const i =
|
|
4382
|
-
|
|
4381
|
+
const i = Me(n), r = ne(i);
|
|
4382
|
+
Yt(e);
|
|
4383
4383
|
const o = e.end.splice(1, e.end.length);
|
|
4384
4384
|
o.push(this.sourceToken);
|
|
4385
4385
|
const a = {
|
|
@@ -4442,7 +4442,7 @@ class ei {
|
|
|
4442
4442
|
};
|
|
4443
4443
|
case "explicit-key-ind": {
|
|
4444
4444
|
this.onKeyLine = !0;
|
|
4445
|
-
const t =
|
|
4445
|
+
const t = Me(e), n = ne(t);
|
|
4446
4446
|
return n.push(this.sourceToken), {
|
|
4447
4447
|
type: "block-map",
|
|
4448
4448
|
offset: this.offset,
|
|
@@ -4452,7 +4452,7 @@ class ei {
|
|
|
4452
4452
|
}
|
|
4453
4453
|
case "map-value-ind": {
|
|
4454
4454
|
this.onKeyLine = !0;
|
|
4455
|
-
const t =
|
|
4455
|
+
const t = Me(e), n = ne(t);
|
|
4456
4456
|
return {
|
|
4457
4457
|
type: "block-map",
|
|
4458
4458
|
offset: this.offset,
|
|
@@ -4488,112 +4488,142 @@ class ei {
|
|
|
4488
4488
|
}
|
|
4489
4489
|
}
|
|
4490
4490
|
}
|
|
4491
|
-
function
|
|
4491
|
+
function xn(s) {
|
|
4492
4492
|
const e = s.prettyErrors !== !1;
|
|
4493
|
-
return { lineCounter: s.lineCounter || e && new
|
|
4493
|
+
return { lineCounter: s.lineCounter || e && new Xn() || null, prettyErrors: e };
|
|
4494
4494
|
}
|
|
4495
|
-
function
|
|
4496
|
-
const { lineCounter: t, prettyErrors: n } =
|
|
4495
|
+
function Zn(s, e = {}) {
|
|
4496
|
+
const { lineCounter: t, prettyErrors: n } = xn(e), i = new zn(t == null ? void 0 : t.addNewLine), r = new Jn(e);
|
|
4497
4497
|
let o = null;
|
|
4498
4498
|
for (const a of r.compose(i.parse(s), !0, s.length))
|
|
4499
4499
|
if (!o)
|
|
4500
4500
|
o = a;
|
|
4501
4501
|
else if (o.options.logLevel !== "silent") {
|
|
4502
|
-
o.errors.push(new
|
|
4502
|
+
o.errors.push(new be(a.range.slice(0, 2), "MULTIPLE_DOCS", "Source contains multiple documents; please use YAML.parseAllDocuments()"));
|
|
4503
4503
|
break;
|
|
4504
4504
|
}
|
|
4505
|
-
return n && t && (o.errors.forEach(
|
|
4505
|
+
return n && t && (o.errors.forEach(Kt(s, t)), o.warnings.forEach(Kt(s, t))), o;
|
|
4506
4506
|
}
|
|
4507
|
-
function
|
|
4507
|
+
function ei(s, e, t) {
|
|
4508
4508
|
let n;
|
|
4509
|
-
const i =
|
|
4509
|
+
const i = Zn(s, t);
|
|
4510
4510
|
if (!i)
|
|
4511
4511
|
return null;
|
|
4512
|
-
if (i.warnings.forEach((r) =>
|
|
4512
|
+
if (i.warnings.forEach((r) => os(i.options.logLevel, r)), i.errors.length > 0) {
|
|
4513
4513
|
if (i.options.logLevel !== "silent")
|
|
4514
4514
|
throw i.errors[0];
|
|
4515
4515
|
i.errors = [];
|
|
4516
4516
|
}
|
|
4517
4517
|
return i.toJS(Object.assign({ reviver: n }, t));
|
|
4518
4518
|
}
|
|
4519
|
-
function
|
|
4519
|
+
function ti(s, e, t) {
|
|
4520
4520
|
let n = null;
|
|
4521
4521
|
if (Array.isArray(e) && (n = e), s === void 0) {
|
|
4522
4522
|
const { keepUndefined: i } = {};
|
|
4523
4523
|
if (!i)
|
|
4524
4524
|
return;
|
|
4525
4525
|
}
|
|
4526
|
-
return Ie(s) && !n ? s.toString(t) : new
|
|
4526
|
+
return Ie(s) && !n ? s.toString(t) : new Le(s, n, t).toString(t);
|
|
4527
4527
|
}
|
|
4528
|
-
const
|
|
4528
|
+
const je = b.preprocess(
|
|
4529
4529
|
(s) => typeof s == "string" ? { agent: s } : s,
|
|
4530
|
-
|
|
4531
|
-
agent:
|
|
4532
|
-
model:
|
|
4533
|
-
effort:
|
|
4530
|
+
b.object({
|
|
4531
|
+
agent: b.enum($e),
|
|
4532
|
+
model: b.string().optional(),
|
|
4533
|
+
effort: b.string().optional()
|
|
4534
4534
|
})
|
|
4535
|
-
),
|
|
4536
|
-
status:
|
|
4537
|
-
kind:
|
|
4538
|
-
id:
|
|
4539
|
-
idea:
|
|
4540
|
-
agent:
|
|
4541
|
-
created:
|
|
4542
|
-
updated:
|
|
4543
|
-
tags:
|
|
4544
|
-
}),
|
|
4545
|
-
date:
|
|
4546
|
-
status:
|
|
4547
|
-
"superseded-by":
|
|
4548
|
-
}),
|
|
4549
|
-
status:
|
|
4550
|
-
raised:
|
|
4551
|
-
"resolved-by":
|
|
4552
|
-
blocks:
|
|
4553
|
-
}),
|
|
4554
|
-
id:
|
|
4555
|
-
title:
|
|
4556
|
-
kind:
|
|
4557
|
-
status:
|
|
4558
|
-
idea:
|
|
4559
|
-
agent:
|
|
4560
|
-
created:
|
|
4561
|
-
updated:
|
|
4562
|
-
audited:
|
|
4563
|
-
"audited-hash":
|
|
4564
|
-
tags:
|
|
4565
|
-
}),
|
|
4566
|
-
id:
|
|
4567
|
-
title:
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
4535
|
+
), Y = b.string().regex(/^\d{4}-\d{2}-\d{2}$/, "expected YYYY-MM-DD"), si = b.object({
|
|
4536
|
+
status: b.enum(["idea", "planned", "in-progress", "review", "done", "dropped"]),
|
|
4537
|
+
kind: b.enum(["feat", "fix", "chore", "docs", "refactor"]).optional(),
|
|
4538
|
+
id: b.string().optional(),
|
|
4539
|
+
idea: b.string().optional(),
|
|
4540
|
+
agent: b.enum($e).optional(),
|
|
4541
|
+
created: Y,
|
|
4542
|
+
updated: Y.optional(),
|
|
4543
|
+
tags: b.string().optional()
|
|
4544
|
+
}), ni = b.object({
|
|
4545
|
+
date: Y,
|
|
4546
|
+
status: b.enum(["decided", "superseded"]),
|
|
4547
|
+
"superseded-by": b.string().optional()
|
|
4548
|
+
}), ii = b.object({
|
|
4549
|
+
status: b.enum(["open", "resolved"]),
|
|
4550
|
+
raised: Y,
|
|
4551
|
+
"resolved-by": b.string().optional(),
|
|
4552
|
+
blocks: b.string().optional()
|
|
4553
|
+
}), ri = b.object({
|
|
4554
|
+
id: b.string().describe("Permanent plan ID, e.g. FEAT-24"),
|
|
4555
|
+
title: b.string().describe('Human-readable plan name, e.g. "Plan storage architecture"'),
|
|
4556
|
+
kind: b.enum(["feat", "fix", "chore", "docs", "refactor"]).describe("Plan kind matching Conventional Commits types"),
|
|
4557
|
+
status: b.enum(["idea", "planned", "in-progress", "review", "done", "dropped"]).describe("Current lifecycle status"),
|
|
4558
|
+
idea: b.string().optional().describe("IDEA-N backlink if this plan grew out of an idea"),
|
|
4559
|
+
agent: b.enum($e).optional().describe("Per-plan agent override"),
|
|
4560
|
+
created: Y.describe("Creation date (YYYY-MM-DD)"),
|
|
4561
|
+
updated: Y.optional().describe("Last significant update date (YYYY-MM-DD)"),
|
|
4562
|
+
audited: Y.optional().describe("Date of last successful convergence audit (YYYY-MM-DD)"),
|
|
4563
|
+
"audited-hash": b.string().optional().describe("Content hash of the plan at last audit, used to detect edits regardless of mtime"),
|
|
4564
|
+
tags: b.array(b.string()).optional().describe("Tagging categories")
|
|
4565
|
+
}), oi = b.object({
|
|
4566
|
+
id: b.string().describe("Permanent idea ID, e.g. IDEA-20"),
|
|
4567
|
+
title: b.string().describe("Short idea headline (3-6 words)"),
|
|
4568
|
+
kind: b.enum(["idea", "note"]).optional().describe('"note" for ideas that never need a plan; omitted means a plan-bearing idea'),
|
|
4569
|
+
status: b.enum(["open", "done", "dropped"]).optional().describe("Manual lifecycle, valid only on notes — plan-bearing ideas carry no status")
|
|
4570
|
+
}).refine((s) => s.status === void 0 || s.kind === "note", {
|
|
4571
|
+
message: "status is only valid on ideas with kind: note",
|
|
4572
|
+
path: ["status"]
|
|
4573
|
+
}), ai = b.object({
|
|
4574
|
+
id: b.string().describe("Permanent lifetime entity ID, e.g. IDEA-45 — never changes"),
|
|
4575
|
+
title: b.string().describe("Human-readable entity name"),
|
|
4576
|
+
type: b.enum(["feat", "fix", "chore", "docs", "refactor"]).optional().describe(
|
|
4577
|
+
"Work classification (Conventional Commits values) driving commit types and branch prefixes; usually set once a plan is drafted"
|
|
4578
|
+
),
|
|
4579
|
+
kind: b.enum(["note"]).optional().describe('"note" marks an entity that never grows phases; omitted for normal ideas'),
|
|
4580
|
+
status: b.enum(["idea", "planned", "in-progress", "review", "done", "dropped", "open"]).describe(
|
|
4581
|
+
"Lifecycle status: idea → planned → in-progress → review → done/dropped; notes use open → done/dropped"
|
|
4582
|
+
),
|
|
4583
|
+
agent: b.enum($e).optional().describe("Per-entity agent override"),
|
|
4584
|
+
created: Y.describe("Creation date (YYYY-MM-DD)"),
|
|
4585
|
+
updated: Y.optional().describe("Last significant update date (YYYY-MM-DD)"),
|
|
4586
|
+
audited: Y.optional().describe("Date of last successful convergence audit (YYYY-MM-DD)"),
|
|
4587
|
+
"audited-hash": b.string().optional().describe(
|
|
4588
|
+
"Content hash of the entity at last audit, used to detect edits regardless of mtime"
|
|
4589
|
+
),
|
|
4590
|
+
tags: b.array(b.string()).optional().describe("Tagging categories")
|
|
4591
|
+
}).refine((s) => s.kind !== "note" || ["open", "done", "dropped"].includes(s.status), {
|
|
4592
|
+
message: "a note entity must use status open, done, or dropped",
|
|
4593
|
+
path: ["status"]
|
|
4594
|
+
}).refine((s) => s.kind === "note" || s.status !== "open", {
|
|
4595
|
+
message: "status open is only valid on entities with kind: note",
|
|
4596
|
+
path: ["status"]
|
|
4597
|
+
}), li = b.object({
|
|
4598
|
+
version: b.string(),
|
|
4599
|
+
projectName: b.string(),
|
|
4600
|
+
initializedAt: b.string(),
|
|
4601
|
+
nextId: b.object({
|
|
4602
|
+
// The unified-entity counter: all new entities mint lifetime IDEA-N ids
|
|
4603
|
+
// from here. The per-kind counters are legacy, still present in
|
|
4604
|
+
// pre-migration configs.
|
|
4605
|
+
idea: b.number().optional(),
|
|
4606
|
+
feat: b.number().optional(),
|
|
4607
|
+
fix: b.number().optional(),
|
|
4608
|
+
chore: b.number().optional(),
|
|
4609
|
+
docs: b.number().optional(),
|
|
4610
|
+
refactor: b.number().optional()
|
|
4581
4611
|
}).optional(),
|
|
4582
|
-
defaultAgent:
|
|
4583
|
-
defaultAgents:
|
|
4584
|
-
phase:
|
|
4585
|
-
planDraft:
|
|
4586
|
-
ideaExtend:
|
|
4587
|
-
commitSuggest:
|
|
4612
|
+
defaultAgent: b.enum($e).optional(),
|
|
4613
|
+
defaultAgents: b.object({
|
|
4614
|
+
phase: je,
|
|
4615
|
+
planDraft: je,
|
|
4616
|
+
ideaExtend: je,
|
|
4617
|
+
commitSuggest: je
|
|
4588
4618
|
}).optional()
|
|
4589
|
-
}),
|
|
4590
|
-
function
|
|
4619
|
+
}), Vt = /^##\s+(.+?)\s*$/, ci = /^\*\*([A-Za-z][A-Za-z-]*):\*\*\s*(.*)$/, fi = /^###\s+Phases\s*$/i, ui = /^###\s+Log\s*$/i, hi = /^###\s+Clarifications\s*$/i, Ms = /^#{2,3}\s+/, Jt = /^[-*]\s+\[([ xX])\]\s+(.*)$/, di = /^\[review\]\s+(.*)$/, pi = /^-\s+(\d{4}-\d{2}-\d{2}):\s*(.*)$/;
|
|
4620
|
+
function js(s, e, t) {
|
|
4591
4621
|
const n = s.split(`
|
|
4592
4622
|
`), i = n.findIndex((l) => e.test(l));
|
|
4593
4623
|
if (i === -1) return { body: s, entries: [] };
|
|
4594
4624
|
let r = n.length;
|
|
4595
4625
|
for (let l = i + 1; l < n.length; l++)
|
|
4596
|
-
if (
|
|
4626
|
+
if (Ms.test(n[l])) {
|
|
4597
4627
|
r = l;
|
|
4598
4628
|
break;
|
|
4599
4629
|
}
|
|
@@ -4601,16 +4631,16 @@ function Ds(s, e, t) {
|
|
|
4601
4631
|
return { body: [...n.slice(0, i), ...n.slice(r)].join(`
|
|
4602
4632
|
`).trim(), entries: o };
|
|
4603
4633
|
}
|
|
4604
|
-
function
|
|
4634
|
+
function mi(s, e, t) {
|
|
4605
4635
|
const n = [];
|
|
4606
4636
|
let i = e;
|
|
4607
4637
|
for (; i < t; ) {
|
|
4608
|
-
const r = s[i].match(
|
|
4638
|
+
const r = s[i].match(Jt);
|
|
4609
4639
|
if (r) {
|
|
4610
|
-
const o = r[1].toLowerCase() === "x", a = r[2].trim(), l = a.match(
|
|
4640
|
+
const o = r[1].toLowerCase() === "x", a = r[2].trim(), l = a.match(di), c = l ? l[1].trim() : a, p = l ? "review" : void 0, f = [];
|
|
4611
4641
|
for (i++; i < t; ) {
|
|
4612
4642
|
const h = s[i];
|
|
4613
|
-
if (h.trim() === "" ||
|
|
4643
|
+
if (h.trim() === "" || Jt.test(h) || Ms.test(h)) break;
|
|
4614
4644
|
if (/^\s/.test(h))
|
|
4615
4645
|
f.push(h.trimStart()), i++;
|
|
4616
4646
|
else
|
|
@@ -4628,60 +4658,60 @@ function yi(s, e, t) {
|
|
|
4628
4658
|
}
|
|
4629
4659
|
return n;
|
|
4630
4660
|
}
|
|
4631
|
-
function
|
|
4632
|
-
const e =
|
|
4661
|
+
function At(s) {
|
|
4662
|
+
const e = js(s, fi, mi);
|
|
4633
4663
|
return { body: e.body, phases: e.entries };
|
|
4634
4664
|
}
|
|
4635
|
-
function
|
|
4665
|
+
function gi(s, e, t) {
|
|
4636
4666
|
const n = [];
|
|
4637
4667
|
for (let i = e; i < t; i++) {
|
|
4638
|
-
const r = s[i].match(
|
|
4668
|
+
const r = s[i].match(pi);
|
|
4639
4669
|
r && n.push({ date: r[1], text: r[2].trim() });
|
|
4640
4670
|
}
|
|
4641
4671
|
return n;
|
|
4642
4672
|
}
|
|
4643
|
-
function
|
|
4644
|
-
return
|
|
4673
|
+
function Bs(s, e) {
|
|
4674
|
+
return js(s, e, gi);
|
|
4645
4675
|
}
|
|
4646
|
-
function
|
|
4647
|
-
const { body: e, entries: t } =
|
|
4676
|
+
function xe(s) {
|
|
4677
|
+
const { body: e, entries: t } = Bs(s, ui);
|
|
4648
4678
|
return { body: e, log: t };
|
|
4649
4679
|
}
|
|
4650
|
-
function
|
|
4651
|
-
const { body: e, entries: t } =
|
|
4680
|
+
function Ot(s) {
|
|
4681
|
+
const { body: e, entries: t } = Bs(s, hi);
|
|
4652
4682
|
return { body: e, clarifications: t };
|
|
4653
4683
|
}
|
|
4654
|
-
function
|
|
4684
|
+
function Tt(s) {
|
|
4655
4685
|
const e = s.split(`
|
|
4656
4686
|
`), t = [];
|
|
4657
4687
|
for (let i = 0; i < e.length; i++)
|
|
4658
|
-
|
|
4688
|
+
Vt.test(e[i]) && t.push(i);
|
|
4659
4689
|
const n = [];
|
|
4660
4690
|
for (let i = 0; i < t.length; i++) {
|
|
4661
|
-
const r = t[i], o = i + 1 < t.length ? t[i + 1] : e.length, a = e[r].match(
|
|
4691
|
+
const r = t[i], o = i + 1 < t.length ? t[i + 1] : e.length, a = e[r].match(Vt)[1], l = e.slice(r + 1, o);
|
|
4662
4692
|
let c = 0;
|
|
4663
4693
|
for (; c < l.length && l[c].trim() === ""; ) c++;
|
|
4664
4694
|
const p = {};
|
|
4665
4695
|
for (; c < l.length; ) {
|
|
4666
|
-
const
|
|
4667
|
-
if (!
|
|
4668
|
-
p[
|
|
4696
|
+
const w = l[c].match(ci);
|
|
4697
|
+
if (!w) break;
|
|
4698
|
+
p[w[1].toLowerCase()] = w[2].trim(), c++;
|
|
4669
4699
|
}
|
|
4670
4700
|
for (; c < l.length && l[c].trim() === ""; ) c++;
|
|
4671
4701
|
const f = l.slice(c).join(`
|
|
4672
4702
|
`).trim();
|
|
4673
|
-
let { body: h, phases: d } =
|
|
4674
|
-
const { body: g, log: u } =
|
|
4703
|
+
let { body: h, phases: d } = At(f);
|
|
4704
|
+
const { body: g, log: u } = xe(h);
|
|
4675
4705
|
h = g;
|
|
4676
|
-
const { body: m, clarifications: y } =
|
|
4706
|
+
const { body: m, clarifications: y } = Ot(h);
|
|
4677
4707
|
h = m, n.push({ title: a, fields: p, body: h, phases: d, log: u, clarifications: y });
|
|
4678
4708
|
}
|
|
4679
4709
|
return n;
|
|
4680
4710
|
}
|
|
4681
|
-
function
|
|
4711
|
+
function Ui(s) {
|
|
4682
4712
|
const e = [], t = [];
|
|
4683
|
-
for (const n of
|
|
4684
|
-
const i =
|
|
4713
|
+
for (const n of Tt(s)) {
|
|
4714
|
+
const i = si.safeParse(n.fields);
|
|
4685
4715
|
if (!i.success) {
|
|
4686
4716
|
t.push({
|
|
4687
4717
|
title: n.title,
|
|
@@ -4708,10 +4738,10 @@ function Ut(s) {
|
|
|
4708
4738
|
}
|
|
4709
4739
|
return { entries: e, warnings: t };
|
|
4710
4740
|
}
|
|
4711
|
-
function
|
|
4741
|
+
function Yi(s) {
|
|
4712
4742
|
const e = [], t = [];
|
|
4713
|
-
for (const n of
|
|
4714
|
-
const i =
|
|
4743
|
+
for (const n of Tt(s)) {
|
|
4744
|
+
const i = ni.safeParse(n.fields);
|
|
4715
4745
|
if (!i.success) {
|
|
4716
4746
|
t.push({
|
|
4717
4747
|
title: n.title,
|
|
@@ -4730,10 +4760,10 @@ function Ui(s) {
|
|
|
4730
4760
|
}
|
|
4731
4761
|
return { entries: e, warnings: t };
|
|
4732
4762
|
}
|
|
4733
|
-
function
|
|
4763
|
+
function Vi(s) {
|
|
4734
4764
|
const e = [], t = [];
|
|
4735
|
-
for (const n of
|
|
4736
|
-
const i =
|
|
4765
|
+
for (const n of Tt(s)) {
|
|
4766
|
+
const i = ii.safeParse(n.fields);
|
|
4737
4767
|
if (!i.success) {
|
|
4738
4768
|
t.push({
|
|
4739
4769
|
title: n.title,
|
|
@@ -4753,15 +4783,15 @@ function Yi(s) {
|
|
|
4753
4783
|
}
|
|
4754
4784
|
return { entries: e, warnings: t };
|
|
4755
4785
|
}
|
|
4756
|
-
const
|
|
4757
|
-
function
|
|
4758
|
-
const t = [], n = s.match(
|
|
4786
|
+
const yi = /^---\s*\r?\n([\s\S]*?)\r?\n---\s*(?:\r?\n)?/;
|
|
4787
|
+
function Lt(s, e) {
|
|
4788
|
+
const t = [], n = s.match(yi);
|
|
4759
4789
|
if (!n)
|
|
4760
4790
|
return { data: null, body: s.trim(), warnings: t };
|
|
4761
4791
|
const i = n[1], r = s.slice(n[0].length).trim();
|
|
4762
4792
|
let o;
|
|
4763
4793
|
try {
|
|
4764
|
-
o =
|
|
4794
|
+
o = ei(i);
|
|
4765
4795
|
} catch (l) {
|
|
4766
4796
|
return t.push({
|
|
4767
4797
|
title: "(frontmatter)",
|
|
@@ -4783,20 +4813,55 @@ function Rs(s, e) {
|
|
|
4783
4813
|
}
|
|
4784
4814
|
return { data: a.data, body: r, warnings: t };
|
|
4785
4815
|
}
|
|
4786
|
-
function
|
|
4816
|
+
function bi(s) {
|
|
4787
4817
|
const e = [], {
|
|
4788
4818
|
data: t,
|
|
4789
4819
|
body: n,
|
|
4790
4820
|
warnings: i
|
|
4791
|
-
} =
|
|
4821
|
+
} = Lt(s, ai);
|
|
4792
4822
|
if (e.push(...i), !t)
|
|
4793
4823
|
return { entries: [], warnings: e };
|
|
4794
4824
|
let r = n;
|
|
4795
|
-
const { body: o, phases: a } =
|
|
4825
|
+
const { body: o, phases: a } = At(r);
|
|
4796
4826
|
r = o;
|
|
4797
|
-
const { body: l, log: c } =
|
|
4827
|
+
const { body: l, log: c } = xe(r);
|
|
4798
4828
|
r = l;
|
|
4799
|
-
const { body: p, clarifications: f } =
|
|
4829
|
+
const { body: p, clarifications: f } = Ot(r);
|
|
4830
|
+
return r = p, t.kind === "note" && a.length > 0 && e.push({
|
|
4831
|
+
title: t.title,
|
|
4832
|
+
message: "note entities must not carry a Phases section — kept, but fix the file"
|
|
4833
|
+
}), { entries: [{
|
|
4834
|
+
id: t.id,
|
|
4835
|
+
title: t.title,
|
|
4836
|
+
type: t.type,
|
|
4837
|
+
kind: t.kind,
|
|
4838
|
+
status: t.status,
|
|
4839
|
+
agent: t.agent,
|
|
4840
|
+
created: t.created,
|
|
4841
|
+
updated: t.updated,
|
|
4842
|
+
audited: t.audited,
|
|
4843
|
+
auditedHash: t["audited-hash"],
|
|
4844
|
+
tags: t.tags ?? [],
|
|
4845
|
+
body: r,
|
|
4846
|
+
phases: a,
|
|
4847
|
+
log: c,
|
|
4848
|
+
clarifications: f
|
|
4849
|
+
}], warnings: e };
|
|
4850
|
+
}
|
|
4851
|
+
function Ji(s) {
|
|
4852
|
+
const e = [], {
|
|
4853
|
+
data: t,
|
|
4854
|
+
body: n,
|
|
4855
|
+
warnings: i
|
|
4856
|
+
} = Lt(s, ri);
|
|
4857
|
+
if (e.push(...i), !t)
|
|
4858
|
+
return { entries: [], warnings: e };
|
|
4859
|
+
let r = n;
|
|
4860
|
+
const { body: o, phases: a } = At(r);
|
|
4861
|
+
r = o;
|
|
4862
|
+
const { body: l, log: c } = xe(r);
|
|
4863
|
+
r = l;
|
|
4864
|
+
const { body: p, clarifications: f } = Ot(r);
|
|
4800
4865
|
return r = p, { entries: [{
|
|
4801
4866
|
title: t.title,
|
|
4802
4867
|
status: t.status,
|
|
@@ -4815,29 +4880,34 @@ function ki(s) {
|
|
|
4815
4880
|
clarifications: f
|
|
4816
4881
|
}], warnings: e };
|
|
4817
4882
|
}
|
|
4818
|
-
function
|
|
4883
|
+
function Hi(s) {
|
|
4819
4884
|
const {
|
|
4820
4885
|
data: e,
|
|
4821
4886
|
body: t,
|
|
4822
4887
|
warnings: n
|
|
4823
|
-
} =
|
|
4824
|
-
|
|
4888
|
+
} = Lt(s, oi);
|
|
4889
|
+
if (!e)
|
|
4890
|
+
return { entries: [], warnings: n };
|
|
4891
|
+
const { body: i, log: r } = xe(t);
|
|
4892
|
+
return { entries: [{
|
|
4825
4893
|
id: e.id,
|
|
4826
4894
|
title: e.title,
|
|
4827
|
-
body:
|
|
4828
|
-
...e.
|
|
4829
|
-
|
|
4830
|
-
}
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4895
|
+
body: i || "",
|
|
4896
|
+
...e.kind && { kind: e.kind },
|
|
4897
|
+
...e.status && { status: e.status },
|
|
4898
|
+
...r.length > 0 && { log: r }
|
|
4899
|
+
}], warnings: n };
|
|
4900
|
+
}
|
|
4901
|
+
const wi = /^(IDEA-\d+):\s*/, ki = /\n---+\n/;
|
|
4902
|
+
function Gi(s) {
|
|
4903
|
+
return s.split(ki).filter(Boolean).map((t) => {
|
|
4834
4904
|
var l;
|
|
4835
4905
|
const n = t.match(/^#{1,3}\s+(.+)/m), i = n ? n[1].trim() : ((l = t.trim().split(`
|
|
4836
|
-
`)[0]) == null ? void 0 : l.trim()) ?? "Untitled", r = i.match(
|
|
4906
|
+
`)[0]) == null ? void 0 : l.trim()) ?? "Untitled", r = i.match(wi), o = (r == null ? void 0 : r[1]) ?? null, a = o ? i.slice(r[0].length) : i;
|
|
4837
4907
|
return { id: o, title: a, body: t.trim() };
|
|
4838
4908
|
});
|
|
4839
4909
|
}
|
|
4840
|
-
function
|
|
4910
|
+
function Wi(s, e, t) {
|
|
4841
4911
|
const n = new Set(s.map((r) => r.title)), i = [];
|
|
4842
4912
|
for (const r of s)
|
|
4843
4913
|
r.supersededBy && !n.has(r.supersededBy) && i.push({
|
|
@@ -4864,106 +4934,97 @@ function Vi(s, e, t) {
|
|
|
4864
4934
|
}
|
|
4865
4935
|
return i;
|
|
4866
4936
|
}
|
|
4867
|
-
const
|
|
4868
|
-
function
|
|
4937
|
+
const Ht = /^##\s+(\d{4}-\d{2}-\d{2})\s*$/, Si = /^[-*]\s+(.*)$/;
|
|
4938
|
+
function Qi(s) {
|
|
4869
4939
|
const e = s.split(`
|
|
4870
4940
|
`), t = [];
|
|
4871
4941
|
for (let i = 0; i < e.length; i++)
|
|
4872
|
-
|
|
4942
|
+
Ht.test(e[i]) && t.push(i);
|
|
4873
4943
|
const n = [];
|
|
4874
4944
|
for (let i = 0; i < t.length; i++) {
|
|
4875
|
-
const r = t[i], o = i + 1 < t.length ? t[i + 1] : e.length, a = e[r].match(
|
|
4945
|
+
const r = t[i], o = i + 1 < t.length ? t[i + 1] : e.length, a = e[r].match(Ht)[1], l = e.slice(r + 1, o).map((c) => c.match(Si)).filter((c) => c !== null).map((c) => c[1].trim());
|
|
4876
4946
|
n.push({ date: a, items: l });
|
|
4877
4947
|
}
|
|
4878
4948
|
return n;
|
|
4879
4949
|
}
|
|
4880
|
-
async function
|
|
4950
|
+
async function Ni(s) {
|
|
4881
4951
|
try {
|
|
4882
|
-
return await
|
|
4952
|
+
return await Rs(s);
|
|
4883
4953
|
} catch {
|
|
4884
4954
|
return [];
|
|
4885
4955
|
}
|
|
4886
4956
|
}
|
|
4887
|
-
async function
|
|
4957
|
+
async function Ei(s) {
|
|
4888
4958
|
try {
|
|
4889
|
-
return await
|
|
4959
|
+
return await Ye(s, "utf-8");
|
|
4890
4960
|
} catch {
|
|
4891
4961
|
return "";
|
|
4892
4962
|
}
|
|
4893
4963
|
}
|
|
4894
|
-
async function
|
|
4964
|
+
async function Ks(s) {
|
|
4895
4965
|
const e = [], t = [];
|
|
4896
4966
|
let n = 0;
|
|
4897
|
-
for (const i of [s,
|
|
4898
|
-
const r = (await
|
|
4967
|
+
for (const i of [s, _(s, "archive")]) {
|
|
4968
|
+
const r = (await Ni(i)).filter((o) => o.endsWith(".md") && o !== "index.md");
|
|
4899
4969
|
n += r.length;
|
|
4900
4970
|
for (const o of r) {
|
|
4901
|
-
const a = await
|
|
4971
|
+
const a = await Ei(_(i, o));
|
|
4902
4972
|
if (!a) {
|
|
4903
|
-
t.push({ title: o, message: "Could not read
|
|
4973
|
+
t.push({ title: o, message: "Could not read entity file" });
|
|
4904
4974
|
continue;
|
|
4905
4975
|
}
|
|
4906
|
-
const l =
|
|
4976
|
+
const l = bi(a);
|
|
4907
4977
|
e.push(...l.entries), t.push(...l.warnings);
|
|
4908
4978
|
}
|
|
4909
4979
|
}
|
|
4910
4980
|
return { entries: e, warnings: t, fileCount: n };
|
|
4911
4981
|
}
|
|
4912
|
-
|
|
4913
|
-
const e = [], t = [], n = (await Fs(s)).filter((i) => i.endsWith(".md") && i !== "index.md");
|
|
4914
|
-
for (const i of n) {
|
|
4915
|
-
const r = await Ze(v(s, i));
|
|
4916
|
-
if (!r) {
|
|
4917
|
-
t.push({ title: i, message: "Could not read idea file" });
|
|
4918
|
-
continue;
|
|
4919
|
-
}
|
|
4920
|
-
const o = Si(r);
|
|
4921
|
-
e.push(...o.entries), t.push(...o.warnings);
|
|
4922
|
-
}
|
|
4923
|
-
return { entries: e, warnings: t, fileCount: n.length };
|
|
4924
|
-
}
|
|
4925
|
-
async function Gi(s, e) {
|
|
4926
|
-
const [t, n] = await Promise.all([
|
|
4927
|
-
$i(s),
|
|
4928
|
-
Ze(e)
|
|
4929
|
-
]);
|
|
4930
|
-
if (t.fileCount === 0)
|
|
4931
|
-
return Ut(n);
|
|
4932
|
-
const i = Ut(n), r = /* @__PURE__ */ new Set();
|
|
4933
|
-
for (const a of t.entries)
|
|
4934
|
-
r.add(a.id ?? a.title);
|
|
4935
|
-
const o = i.entries.filter((a) => {
|
|
4936
|
-
const l = a.id ?? a.title;
|
|
4937
|
-
return r.has(l) ? !1 : (r.add(l), !0);
|
|
4938
|
-
});
|
|
4982
|
+
function $i(s) {
|
|
4939
4983
|
return {
|
|
4940
|
-
|
|
4941
|
-
|
|
4984
|
+
title: s.title,
|
|
4985
|
+
// Non-note entities can't carry the note-only 'open' (schema-enforced).
|
|
4986
|
+
status: s.status,
|
|
4987
|
+
kind: s.type,
|
|
4988
|
+
id: s.id,
|
|
4989
|
+
agent: s.agent,
|
|
4990
|
+
created: s.created,
|
|
4991
|
+
updated: s.updated,
|
|
4992
|
+
audited: s.audited,
|
|
4993
|
+
auditedHash: s.auditedHash,
|
|
4994
|
+
tags: s.tags,
|
|
4995
|
+
body: s.body,
|
|
4996
|
+
phases: s.phases,
|
|
4997
|
+
log: s.log,
|
|
4998
|
+
clarifications: s.clarifications
|
|
4942
4999
|
};
|
|
4943
5000
|
}
|
|
4944
|
-
|
|
4945
|
-
const [t, n] = await Promise.all([
|
|
4946
|
-
Ai(s),
|
|
4947
|
-
Ze(e)
|
|
4948
|
-
]);
|
|
4949
|
-
if (t.fileCount === 0 && !n)
|
|
4950
|
-
return { entries: [], warnings: t.warnings };
|
|
4951
|
-
if (t.fileCount === 0)
|
|
4952
|
-
return { entries: Yt(n), warnings: t.warnings };
|
|
4953
|
-
if (!n)
|
|
4954
|
-
return t;
|
|
4955
|
-
const i = Yt(n), r = /* @__PURE__ */ new Set();
|
|
4956
|
-
for (const a of t.entries)
|
|
4957
|
-
a.id && r.add(a.id);
|
|
4958
|
-
const o = i.filter((a) => a.id ? r.has(a.id) ? !1 : (r.add(a.id), !0) : !0);
|
|
5001
|
+
function Ii(s) {
|
|
4959
5002
|
return {
|
|
4960
|
-
|
|
4961
|
-
|
|
5003
|
+
id: s.id,
|
|
5004
|
+
title: s.title,
|
|
5005
|
+
body: s.body,
|
|
5006
|
+
kind: "note",
|
|
5007
|
+
status: s.status,
|
|
5008
|
+
log: s.log
|
|
4962
5009
|
};
|
|
4963
5010
|
}
|
|
4964
|
-
|
|
5011
|
+
async function Xi(s) {
|
|
5012
|
+
const { entries: e, warnings: t } = await Ks(s);
|
|
5013
|
+
return {
|
|
5014
|
+
entries: e.filter((n) => n.kind !== "note").map($i),
|
|
5015
|
+
warnings: t
|
|
5016
|
+
};
|
|
5017
|
+
}
|
|
5018
|
+
async function zi(s) {
|
|
5019
|
+
const { entries: e, warnings: t } = await Ks(s);
|
|
5020
|
+
return {
|
|
5021
|
+
entries: e.filter((n) => n.kind === "note").map(Ii),
|
|
5022
|
+
warnings: t
|
|
5023
|
+
};
|
|
5024
|
+
}
|
|
5025
|
+
const Ai = `---
|
|
4965
5026
|
name: paper-camp
|
|
4966
|
-
description: Work inside a project that has a papercamp/ folder — its
|
|
5027
|
+
description: Work inside a project that has a papercamp/ folder — its unified idea entities (each holding its plan as a section), decisions log, open questions, and progress log. Use this whenever the working directory contains papercamp/ (papercamp/ideas/, papercamp/decisions.md, papercamp/open-questions.md, papercamp/progress.md), and especially before starting, continuing, or completing any plan phase, drafting an idea, logging a decision, or answering "what are we working on / what's next".
|
|
4967
5028
|
---
|
|
4968
5029
|
|
|
4969
5030
|
# Paper Camp
|
|
@@ -4983,18 +5044,20 @@ only the mechanism changes.
|
|
|
4983
5044
|
|
|
4984
5045
|
Read, in this order, whatever exists:
|
|
4985
5046
|
|
|
4986
|
-
1. \`papercamp/
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
5047
|
+
1. \`papercamp/ideas/index.md\` — every entity's id/title/type/status/tags, at
|
|
5048
|
+
a glance. Ideas and plans are one thing: an entity is an *idea* for its
|
|
5049
|
+
whole life, and its plan is a \`### Phases\` section inside the same file.
|
|
5050
|
+
2. The specific entity file at \`papercamp/ideas/<ID>.md\` (e.g. \`IDEA-43.md\`)
|
|
5051
|
+
for the work you're about to do — YAML frontmatter (\`id\`, \`title\`,
|
|
5052
|
+
\`type\`, \`status\`, \`tags\`, ...) plus prose rationale, then optionally a
|
|
5053
|
+
\`### Phases\` list of \`- [ ]\`/\`- [x]\` checkboxes with an indented
|
|
5054
|
+
description under each. Done/dropped entities live in
|
|
5055
|
+
\`papercamp/ideas/archive/\`.
|
|
5056
|
+
3. \`papercamp/decisions.md\` — settled calls that constrain your approach.
|
|
4994
5057
|
Don't re-litigate a logged decision without flagging it to the user first.
|
|
4995
|
-
|
|
5058
|
+
4. \`papercamp/open-questions.md\` — unresolved questions that might block or
|
|
4996
5059
|
redirect the work you're about to start.
|
|
4997
|
-
|
|
5060
|
+
5. The last handful of entries in \`papercamp/progress.md\` for recent context
|
|
4998
5061
|
on what just happened.
|
|
4999
5062
|
|
|
5000
5063
|
Skip files that don't exist yet (a fresh project may have empty logs).
|
|
@@ -5034,19 +5097,19 @@ session start from live plan/progress data, not hand-maintained here. It does
|
|
|
5034
5097
|
not define the file formats in full; treat the existing files under
|
|
5035
5098
|
\`papercamp/\` as the grammar reference (mirror their structure exactly rather
|
|
5036
5099
|
than inventing a new shape).
|
|
5037
|
-
`,
|
|
5100
|
+
`, Gt = "$CLAUDE_PROJECT_DIR/node_modules/.bin/paper-camp", Oi = `${JSON.stringify(
|
|
5038
5101
|
{
|
|
5039
5102
|
hooks: {
|
|
5040
5103
|
SessionStart: [
|
|
5041
5104
|
{
|
|
5042
5105
|
matcher: "*",
|
|
5043
|
-
hooks: [{ type: "command", command: `"${
|
|
5106
|
+
hooks: [{ type: "command", command: `"${Gt}" session-focus` }]
|
|
5044
5107
|
}
|
|
5045
5108
|
],
|
|
5046
5109
|
PostToolUse: [
|
|
5047
5110
|
{
|
|
5048
5111
|
matcher: "Write",
|
|
5049
|
-
hooks: [{ type: "command", command: `"${
|
|
5112
|
+
hooks: [{ type: "command", command: `"${Gt}" post-tool-use-log` }]
|
|
5050
5113
|
}
|
|
5051
5114
|
]
|
|
5052
5115
|
}
|
|
@@ -5054,88 +5117,81 @@ than inventing a new shape).
|
|
|
5054
5117
|
null,
|
|
5055
5118
|
2
|
|
5056
5119
|
)}
|
|
5057
|
-
`,
|
|
5058
|
-
class
|
|
5120
|
+
`, Ti = "0.1.0";
|
|
5121
|
+
class Li extends Error {
|
|
5059
5122
|
constructor(e) {
|
|
5060
5123
|
super(`Paper Camp is already initialized in ${e} (papercamp/config.json exists).`);
|
|
5061
5124
|
}
|
|
5062
5125
|
}
|
|
5063
|
-
async function
|
|
5126
|
+
async function Se(s) {
|
|
5064
5127
|
try {
|
|
5065
|
-
return await
|
|
5128
|
+
return await Fs(s), !0;
|
|
5066
5129
|
} catch {
|
|
5067
5130
|
return !1;
|
|
5068
5131
|
}
|
|
5069
5132
|
}
|
|
5070
|
-
const
|
|
5071
|
-
async function
|
|
5072
|
-
const t =
|
|
5073
|
-
if (await
|
|
5074
|
-
throw new
|
|
5133
|
+
const Ci = ["progress.md", "decisions.md", "open-questions.md"];
|
|
5134
|
+
async function xi(s, e) {
|
|
5135
|
+
const t = _(s, "papercamp"), n = _(t, "config.json");
|
|
5136
|
+
if (await Se(n))
|
|
5137
|
+
throw new Li(s);
|
|
5075
5138
|
const i = {
|
|
5076
|
-
version:
|
|
5139
|
+
version: Ti,
|
|
5077
5140
|
projectName: e.projectName,
|
|
5078
5141
|
initializedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5079
|
-
nextId: {
|
|
5142
|
+
nextId: { idea: 1 }
|
|
5080
5143
|
};
|
|
5081
|
-
|
|
5082
|
-
const r =
|
|
5083
|
-
await
|
|
5084
|
-
const o =
|
|
5085
|
-
await
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
const a = v(r, "archive");
|
|
5090
|
-
await G(a, { recursive: !0 });
|
|
5091
|
-
const l = v(t, "ideas");
|
|
5092
|
-
await G(l, { recursive: !0 });
|
|
5093
|
-
const c = v(l, "index.md");
|
|
5094
|
-
if (!await ae(c)) {
|
|
5095
|
-
const p = e.intent ? `# ${e.projectName}
|
|
5144
|
+
li.parse(i), await X(t, { recursive: !0 });
|
|
5145
|
+
const r = _(t, "ideas");
|
|
5146
|
+
await X(r, { recursive: !0 });
|
|
5147
|
+
const o = _(r, "archive");
|
|
5148
|
+
await X(o, { recursive: !0 });
|
|
5149
|
+
const a = _(r, "index.md");
|
|
5150
|
+
if (!await Se(a)) {
|
|
5151
|
+
const l = e.intent ? `# ${e.projectName}
|
|
5096
5152
|
|
|
5097
5153
|
${e.intent}
|
|
5098
5154
|
` : `# ${e.projectName}
|
|
5099
5155
|
|
|
5100
5156
|
What are you building, and why?
|
|
5101
5157
|
`;
|
|
5102
|
-
await
|
|
5158
|
+
await G(a, l, "utf-8");
|
|
5103
5159
|
}
|
|
5104
|
-
for (const
|
|
5105
|
-
const
|
|
5106
|
-
await
|
|
5160
|
+
for (const l of Ci) {
|
|
5161
|
+
const c = _(t, l);
|
|
5162
|
+
await Se(c) || await G(c, "", "utf-8");
|
|
5107
5163
|
}
|
|
5108
|
-
await
|
|
5164
|
+
await G(n, `${JSON.stringify(i, null, 2)}
|
|
5109
5165
|
`, "utf-8"), await vi(s);
|
|
5110
5166
|
}
|
|
5111
5167
|
async function vi(s) {
|
|
5112
|
-
const e =
|
|
5113
|
-
await
|
|
5114
|
-
const t =
|
|
5115
|
-
await
|
|
5116
|
-
const n =
|
|
5117
|
-
await
|
|
5118
|
-
const i =
|
|
5119
|
-
await
|
|
5120
|
-
}
|
|
5121
|
-
function
|
|
5168
|
+
const e = _(s, ".claude", "skills", "paper-camp");
|
|
5169
|
+
await X(e, { recursive: !0 });
|
|
5170
|
+
const t = _(e, "SKILL.md");
|
|
5171
|
+
await Se(t) || await G(t, Ai, "utf-8");
|
|
5172
|
+
const n = _(s, ".claude");
|
|
5173
|
+
await X(n, { recursive: !0 });
|
|
5174
|
+
const i = _(n, "settings.json");
|
|
5175
|
+
await Se(i) || await G(i, Oi, "utf-8");
|
|
5176
|
+
}
|
|
5177
|
+
function _i() {
|
|
5122
5178
|
return (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
5123
5179
|
}
|
|
5124
|
-
let
|
|
5125
|
-
async function
|
|
5126
|
-
const t =
|
|
5180
|
+
let Wt = Promise.resolve();
|
|
5181
|
+
async function Pi(s, e) {
|
|
5182
|
+
const t = Wt.then(async () => {
|
|
5127
5183
|
let n = null;
|
|
5128
5184
|
try {
|
|
5129
|
-
n = JSON.parse(await
|
|
5185
|
+
n = JSON.parse(await Ye(s, "utf-8"));
|
|
5130
5186
|
} catch {
|
|
5131
5187
|
return;
|
|
5132
5188
|
}
|
|
5133
5189
|
if (!(n != null && n.nextId)) return;
|
|
5134
5190
|
const i = n.nextId[e] ?? 1, r = `${e.toUpperCase()}-${i}`;
|
|
5135
|
-
return n.nextId[e] = i + 1, await
|
|
5191
|
+
return n.nextId[e] = i + 1, await G(s, `${JSON.stringify(n, null, 2)}
|
|
5136
5192
|
`), r;
|
|
5137
5193
|
});
|
|
5138
|
-
return
|
|
5194
|
+
return Wt = t.catch(() => {
|
|
5139
5195
|
}), t;
|
|
5140
5196
|
}
|
|
5141
5197
|
function Di(s) {
|
|
@@ -5164,12 +5220,12 @@ function Di(s) {
|
|
|
5164
5220
|
return e.join(`
|
|
5165
5221
|
`).trimEnd();
|
|
5166
5222
|
}
|
|
5167
|
-
function
|
|
5223
|
+
function Zi(s) {
|
|
5168
5224
|
const e = [`## ${s.title}`, "", `**Date:** ${s.date}`, `**Status:** ${s.status}`];
|
|
5169
5225
|
return s.supersededBy && e.push(`**Superseded-by:** ${s.supersededBy}`), e.push(""), s.body && e.push(s.body), e.join(`
|
|
5170
5226
|
`).trimEnd();
|
|
5171
5227
|
}
|
|
5172
|
-
function
|
|
5228
|
+
function Mi(s) {
|
|
5173
5229
|
const e = [
|
|
5174
5230
|
`## ${s.title}`,
|
|
5175
5231
|
"",
|
|
@@ -5179,21 +5235,21 @@ function Bi(s) {
|
|
|
5179
5235
|
return s.resolvedBy && e.push(`**Resolved-by:** ${s.resolvedBy}`), s.blocks && e.push(`**Blocks:** ${s.blocks}`), e.push(""), s.body && e.push(s.body), e.join(`
|
|
5180
5236
|
`).trimEnd();
|
|
5181
5237
|
}
|
|
5182
|
-
function
|
|
5238
|
+
function er(s, e) {
|
|
5183
5239
|
return [`## ${s}`, ...e.map((t) => `- ${t}`)].join(`
|
|
5184
5240
|
`);
|
|
5185
5241
|
}
|
|
5186
|
-
async function
|
|
5187
|
-
const t = `## ${
|
|
5242
|
+
async function tr(s, e) {
|
|
5243
|
+
const t = `## ${_i()}`;
|
|
5188
5244
|
let n = "";
|
|
5189
5245
|
try {
|
|
5190
|
-
n = await
|
|
5246
|
+
n = await Ye(s, "utf-8");
|
|
5191
5247
|
} catch (i) {
|
|
5192
5248
|
if (i.code !== "ENOENT") throw i;
|
|
5193
5249
|
}
|
|
5194
|
-
if (await
|
|
5250
|
+
if (await X(Qt(s), { recursive: !0 }), n.startsWith(`${t}
|
|
5195
5251
|
`))
|
|
5196
|
-
await
|
|
5252
|
+
await G(
|
|
5197
5253
|
s,
|
|
5198
5254
|
`${t}
|
|
5199
5255
|
- ${e}
|
|
@@ -5208,26 +5264,26 @@ ${i}
|
|
|
5208
5264
|
` : `${t}
|
|
5209
5265
|
- ${e}
|
|
5210
5266
|
`;
|
|
5211
|
-
await
|
|
5267
|
+
await G(s, r, "utf-8");
|
|
5212
5268
|
}
|
|
5213
5269
|
}
|
|
5214
|
-
function
|
|
5270
|
+
function sr(s) {
|
|
5215
5271
|
return s.length === 0 ? "" : `${s.map((e) => Di(e)).join(`
|
|
5216
5272
|
|
|
5217
5273
|
`)}
|
|
5218
5274
|
`;
|
|
5219
5275
|
}
|
|
5220
|
-
function
|
|
5221
|
-
return s.length === 0 ? "" : `${s.map((e) =>
|
|
5276
|
+
function nr(s) {
|
|
5277
|
+
return s.length === 0 ? "" : `${s.map((e) => Mi(e)).join(`
|
|
5222
5278
|
|
|
5223
5279
|
`)}
|
|
5224
5280
|
`;
|
|
5225
5281
|
}
|
|
5226
|
-
async function
|
|
5227
|
-
await
|
|
5282
|
+
async function ir(s, e) {
|
|
5283
|
+
await X(Qt(s), { recursive: !0 });
|
|
5228
5284
|
let t = "";
|
|
5229
5285
|
try {
|
|
5230
|
-
t = await
|
|
5286
|
+
t = await Ye(s, "utf-8");
|
|
5231
5287
|
} catch (r) {
|
|
5232
5288
|
if (r.code !== "ENOENT") throw r;
|
|
5233
5289
|
}
|
|
@@ -5236,15 +5292,15 @@ async function tr(s, e) {
|
|
|
5236
5292
|
${e}
|
|
5237
5293
|
` : `${e}
|
|
5238
5294
|
`;
|
|
5239
|
-
await
|
|
5295
|
+
await G(s, i, "utf-8");
|
|
5240
5296
|
}
|
|
5241
|
-
function
|
|
5242
|
-
let e =
|
|
5297
|
+
function Ct(s) {
|
|
5298
|
+
let e = ti(s);
|
|
5243
5299
|
return e = e.trimEnd(), `---
|
|
5244
5300
|
${e}
|
|
5245
5301
|
---`;
|
|
5246
5302
|
}
|
|
5247
|
-
function
|
|
5303
|
+
function rr(s) {
|
|
5248
5304
|
const e = {
|
|
5249
5305
|
id: s.id,
|
|
5250
5306
|
title: s.title,
|
|
@@ -5253,7 +5309,7 @@ function sr(s) {
|
|
|
5253
5309
|
created: s.created
|
|
5254
5310
|
};
|
|
5255
5311
|
s.idea && (e.idea = s.idea), s.agent && (e.agent = s.agent), s.updated && (e.updated = s.updated), s.audited && (e.audited = s.audited), s.auditedHash && (e["audited-hash"] = s.auditedHash), s.tags && s.tags.length > 0 && (e.tags = s.tags);
|
|
5256
|
-
const t = [
|
|
5312
|
+
const t = [Ct(e)];
|
|
5257
5313
|
if (s.body && t.push(s.body), s.clarifications && s.clarifications.length > 0) {
|
|
5258
5314
|
const n = ["### Clarifications"];
|
|
5259
5315
|
for (const i of s.clarifications)
|
|
@@ -5284,106 +5340,140 @@ function sr(s) {
|
|
|
5284
5340
|
|
|
5285
5341
|
`).trimEnd();
|
|
5286
5342
|
}
|
|
5287
|
-
function
|
|
5343
|
+
function or(s) {
|
|
5344
|
+
const e = {
|
|
5345
|
+
id: s.id,
|
|
5346
|
+
title: s.title
|
|
5347
|
+
};
|
|
5348
|
+
s.type && (e.type = s.type), s.kind && (e.kind = s.kind), e.status = s.status, e.created = s.created, s.agent && (e.agent = s.agent), s.updated && (e.updated = s.updated), s.audited && (e.audited = s.audited), s.auditedHash && (e["audited-hash"] = s.auditedHash), s.tags && s.tags.length > 0 && (e.tags = s.tags);
|
|
5349
|
+
const t = [Ct(e)];
|
|
5350
|
+
if (s.body && t.push(s.body), s.clarifications && s.clarifications.length > 0) {
|
|
5351
|
+
const n = ["### Clarifications"];
|
|
5352
|
+
for (const i of s.clarifications)
|
|
5353
|
+
n.push(`- ${i.date}: ${i.text}`);
|
|
5354
|
+
t.push(n.join(`
|
|
5355
|
+
`));
|
|
5356
|
+
}
|
|
5357
|
+
if (s.phases && s.phases.length > 0) {
|
|
5358
|
+
const n = ["### Phases"];
|
|
5359
|
+
for (const i of s.phases) {
|
|
5360
|
+
const r = i.source === "review" ? `[review] ${i.text}` : i.text;
|
|
5361
|
+
if (n.push(`- [${i.done ? "x" : " "}] ${r}`), i.description)
|
|
5362
|
+
for (const o of i.description.split(`
|
|
5363
|
+
`))
|
|
5364
|
+
n.push(` ${o}`);
|
|
5365
|
+
}
|
|
5366
|
+
t.push(n.join(`
|
|
5367
|
+
`));
|
|
5368
|
+
}
|
|
5369
|
+
if (s.log && s.log.length > 0) {
|
|
5370
|
+
const n = ["### Log"];
|
|
5371
|
+
for (const i of s.log)
|
|
5372
|
+
n.push(`- ${i.date}: ${i.text}`);
|
|
5373
|
+
t.push(n.join(`
|
|
5374
|
+
`));
|
|
5375
|
+
}
|
|
5376
|
+
return t.join(`
|
|
5377
|
+
|
|
5378
|
+
`).trimEnd();
|
|
5379
|
+
}
|
|
5380
|
+
async function ar(s) {
|
|
5381
|
+
return Pi(s, "idea");
|
|
5382
|
+
}
|
|
5383
|
+
function lr(s) {
|
|
5288
5384
|
const e = {
|
|
5289
5385
|
id: s.id,
|
|
5290
5386
|
title: s.title
|
|
5291
5387
|
};
|
|
5292
|
-
s.status && (e.status = s.status);
|
|
5293
|
-
const t = [
|
|
5294
|
-
|
|
5388
|
+
s.kind && (e.kind = s.kind), s.status && (e.status = s.status);
|
|
5389
|
+
const t = [Ct(e)], n = `## ${s.id}: ${s.title}`;
|
|
5390
|
+
if (t.push(s.body ? `${n}
|
|
5295
5391
|
|
|
5296
|
-
${s.body}` : n),
|
|
5392
|
+
${s.body}` : n), s.log && s.log.length > 0) {
|
|
5393
|
+
const i = ["### Log"];
|
|
5394
|
+
for (const r of s.log)
|
|
5395
|
+
i.push(`- ${r.date}: ${r.text}`);
|
|
5396
|
+
t.push(i.join(`
|
|
5397
|
+
`));
|
|
5398
|
+
}
|
|
5399
|
+
return t.join(`
|
|
5297
5400
|
|
|
5298
5401
|
`).trimEnd();
|
|
5299
5402
|
}
|
|
5300
|
-
async function
|
|
5301
|
-
const t =
|
|
5302
|
-
await
|
|
5403
|
+
async function cr(s, e) {
|
|
5404
|
+
const t = _(s, "papercamp", "ideas"), n = _(t, "archive"), i = _(t, `${e}.md`), r = _(n, `${e}.md`);
|
|
5405
|
+
await X(n, { recursive: !0 });
|
|
5303
5406
|
try {
|
|
5304
|
-
return await
|
|
5407
|
+
return await qs(i, r), !0;
|
|
5305
5408
|
} catch (o) {
|
|
5306
5409
|
if (o.code === "ENOENT") return !1;
|
|
5307
5410
|
throw o;
|
|
5308
5411
|
}
|
|
5309
5412
|
}
|
|
5310
|
-
function
|
|
5311
|
-
return s.length === 0 ? `# Plans
|
|
5312
|
-
|
|
5313
|
-
No plans yet.
|
|
5314
|
-
` : `# Plans
|
|
5315
|
-
|
|
5316
|
-
| Id | Title | Status | Tags |
|
|
5317
|
-
|----|-------|--------|------|
|
|
5318
|
-
${[...s].sort((n, i) => {
|
|
5319
|
-
const r = n.id ? Number.parseInt(n.id.replace(/^[A-Z]+-/, ""), 10) : Number.NaN, o = i.id ? Number.parseInt(i.id.replace(/^[A-Z]+-/, ""), 10) : Number.NaN;
|
|
5320
|
-
return !Number.isNaN(r) && !Number.isNaN(o) ? r - o : (n.title || "").localeCompare(i.title || "");
|
|
5321
|
-
}).map(
|
|
5322
|
-
(n) => `| ${n.id || ""} | ${(n.title || "").replace(/\|/g, "\\|")} | ${n.status} | ${(n.tags || []).join(", ")} |`
|
|
5323
|
-
).join(`
|
|
5324
|
-
`)}
|
|
5325
|
-
`;
|
|
5326
|
-
}
|
|
5327
|
-
function or(s) {
|
|
5413
|
+
function fr(s) {
|
|
5328
5414
|
return s.length === 0 ? `# Ideas
|
|
5329
5415
|
|
|
5330
5416
|
No ideas yet.
|
|
5331
5417
|
` : `# Ideas
|
|
5332
5418
|
|
|
5333
|
-
| Id | Title | Status |
|
|
5334
|
-
|
|
5419
|
+
| Id | Title | Type | Status | Tags |
|
|
5420
|
+
|----|-------|------|--------|------|
|
|
5335
5421
|
${[...s].sort((n, i) => {
|
|
5336
|
-
const r =
|
|
5337
|
-
return !Number.isNaN(r) && !Number.isNaN(o) ? r - o :
|
|
5422
|
+
const r = Number.parseInt(n.id.replace(/^[A-Z]+-/, ""), 10), o = Number.parseInt(i.id.replace(/^[A-Z]+-/, ""), 10);
|
|
5423
|
+
return !Number.isNaN(r) && !Number.isNaN(o) ? r - o : n.title.localeCompare(i.title);
|
|
5338
5424
|
}).map(
|
|
5339
|
-
(n) => `| ${n.id
|
|
5425
|
+
(n) => `| ${n.id} | ${n.title.replace(/\|/g, "\\|")} | ${n.type ?? (n.kind === "note" ? "note" : "—")} | ${n.status} | ${(n.tags ?? []).join(", ")} |`
|
|
5340
5426
|
).join(`
|
|
5341
5427
|
`)}
|
|
5342
5428
|
`;
|
|
5343
5429
|
}
|
|
5344
5430
|
export {
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5354
|
-
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
|
|
5358
|
-
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
|
|
5362
|
-
|
|
5363
|
-
|
|
5431
|
+
Li as A,
|
|
5432
|
+
Yi as B,
|
|
5433
|
+
bi as C,
|
|
5434
|
+
Fi as D,
|
|
5435
|
+
Lt as E,
|
|
5436
|
+
Hi as F,
|
|
5437
|
+
Gi as G,
|
|
5438
|
+
Vi as H,
|
|
5439
|
+
Ji as I,
|
|
5440
|
+
Ui as J,
|
|
5441
|
+
Qi as K,
|
|
5442
|
+
Tt as L,
|
|
5443
|
+
si as M,
|
|
5444
|
+
ri as N,
|
|
5445
|
+
tr as O,
|
|
5446
|
+
Ti as P,
|
|
5447
|
+
Ks as Q,
|
|
5448
|
+
zi as R,
|
|
5449
|
+
Xi as S,
|
|
5450
|
+
Ct as T,
|
|
5451
|
+
_i as U,
|
|
5452
|
+
je as a,
|
|
5453
|
+
ir as b,
|
|
5364
5454
|
qi as c,
|
|
5365
|
-
|
|
5366
|
-
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
|
|
5378
|
-
|
|
5379
|
-
|
|
5380
|
-
|
|
5381
|
-
|
|
5382
|
-
|
|
5383
|
-
|
|
5384
|
-
|
|
5385
|
-
|
|
5386
|
-
|
|
5387
|
-
|
|
5455
|
+
cr as d,
|
|
5456
|
+
ar as e,
|
|
5457
|
+
Pi as f,
|
|
5458
|
+
Y as g,
|
|
5459
|
+
ni as h,
|
|
5460
|
+
ai as i,
|
|
5461
|
+
Ii as j,
|
|
5462
|
+
$i as k,
|
|
5463
|
+
Wi as l,
|
|
5464
|
+
Zi as m,
|
|
5465
|
+
fr as n,
|
|
5466
|
+
or as o,
|
|
5467
|
+
lr as p,
|
|
5468
|
+
Mi as q,
|
|
5469
|
+
nr as r,
|
|
5470
|
+
Di as s,
|
|
5471
|
+
rr as t,
|
|
5472
|
+
sr as u,
|
|
5473
|
+
er as v,
|
|
5474
|
+
oi as w,
|
|
5475
|
+
xi as x,
|
|
5476
|
+
ii as y,
|
|
5477
|
+
li as z
|
|
5388
5478
|
};
|
|
5389
|
-
//# sourceMappingURL=serializer.
|
|
5479
|
+
//# sourceMappingURL=serializer.DbnJzwVr.js.map
|