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