agent-skills-ts-sdk 2.2.0 → 2.3.1
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/README.md +44 -42
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +403 -390
- package/dist/index.js.map +1 -1
- package/package.json +19 -19
package/dist/index.js
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
//#region
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var
|
|
3
|
+
var __exportAll = (all, no_symbols) => {
|
|
4
4
|
let target = {};
|
|
5
|
-
for (var name in all)
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
for (var name in all) {
|
|
6
|
+
__defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
if (!no_symbols) {
|
|
12
|
+
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
13
|
+
}
|
|
9
14
|
return target;
|
|
10
15
|
};
|
|
11
16
|
|
|
@@ -226,9 +231,9 @@ const isAlias = (node) => !!node && typeof node === "object" && node[NODE_TYPE]
|
|
|
226
231
|
const isDocument = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === DOC;
|
|
227
232
|
const isMap = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === MAP;
|
|
228
233
|
const isPair = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === PAIR;
|
|
229
|
-
const isScalar = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === SCALAR$1;
|
|
234
|
+
const isScalar$1 = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === SCALAR$1;
|
|
230
235
|
const isSeq = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === SEQ;
|
|
231
|
-
function isCollection(node) {
|
|
236
|
+
function isCollection$1(node) {
|
|
232
237
|
if (node && typeof node === "object") switch (node[NODE_TYPE]) {
|
|
233
238
|
case MAP:
|
|
234
239
|
case SEQ: return true;
|
|
@@ -244,7 +249,7 @@ function isNode(node) {
|
|
|
244
249
|
}
|
|
245
250
|
return false;
|
|
246
251
|
}
|
|
247
|
-
const hasAnchor = (node) => (isScalar(node) || isCollection(node)) && !!node.anchor;
|
|
252
|
+
const hasAnchor = (node) => (isScalar$1(node) || isCollection$1(node)) && !!node.anchor;
|
|
248
253
|
|
|
249
254
|
//#endregion
|
|
250
255
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/visit.js
|
|
@@ -281,18 +286,18 @@ const REMOVE$1 = Symbol("remove node");
|
|
|
281
286
|
* and `Node` (alias, map, seq & scalar) targets. Of all these, only the most
|
|
282
287
|
* specific defined one will be used for each node.
|
|
283
288
|
*/
|
|
284
|
-
function visit(node, visitor) {
|
|
289
|
+
function visit$1(node, visitor) {
|
|
285
290
|
const visitor_ = initVisitor(visitor);
|
|
286
291
|
if (isDocument(node)) {
|
|
287
292
|
if (visit_(null, node.contents, visitor_, Object.freeze([node])) === REMOVE$1) node.contents = null;
|
|
288
293
|
} else visit_(null, node, visitor_, Object.freeze([]));
|
|
289
294
|
}
|
|
290
295
|
/** Terminate visit traversal completely */
|
|
291
|
-
visit.BREAK = BREAK$1;
|
|
296
|
+
visit$1.BREAK = BREAK$1;
|
|
292
297
|
/** Do not visit the children of the current node */
|
|
293
|
-
visit.SKIP = SKIP$1;
|
|
298
|
+
visit$1.SKIP = SKIP$1;
|
|
294
299
|
/** Remove the current node */
|
|
295
|
-
visit.REMOVE = REMOVE$1;
|
|
300
|
+
visit$1.REMOVE = REMOVE$1;
|
|
296
301
|
function visit_(key, node, visitor, path) {
|
|
297
302
|
const ctrl = callVisitor(key, node, visitor, path);
|
|
298
303
|
if (isNode(ctrl) || isPair(ctrl)) {
|
|
@@ -300,7 +305,7 @@ function visit_(key, node, visitor, path) {
|
|
|
300
305
|
return visit_(key, ctrl, visitor, path);
|
|
301
306
|
}
|
|
302
307
|
if (typeof ctrl !== "symbol") {
|
|
303
|
-
if (isCollection(node)) {
|
|
308
|
+
if (isCollection$1(node)) {
|
|
304
309
|
path = Object.freeze(path.concat(node));
|
|
305
310
|
for (let i = 0; i < node.items.length; ++i) {
|
|
306
311
|
const ci = visit_(i, node.items[i], visitor, path);
|
|
@@ -373,7 +378,7 @@ async function visitAsync_(key, node, visitor, path) {
|
|
|
373
378
|
return visitAsync_(key, ctrl, visitor, path);
|
|
374
379
|
}
|
|
375
380
|
if (typeof ctrl !== "symbol") {
|
|
376
|
-
if (isCollection(node)) {
|
|
381
|
+
if (isCollection$1(node)) {
|
|
377
382
|
path = Object.freeze(path.concat(node));
|
|
378
383
|
for (let i = 0; i < node.items.length; ++i) {
|
|
379
384
|
const ci = await visitAsync_(i, node.items[i], visitor, path);
|
|
@@ -417,12 +422,12 @@ function callVisitor(key, node, visitor, path) {
|
|
|
417
422
|
if (isMap(node)) return visitor.Map?.(key, node, path);
|
|
418
423
|
if (isSeq(node)) return visitor.Seq?.(key, node, path);
|
|
419
424
|
if (isPair(node)) return visitor.Pair?.(key, node, path);
|
|
420
|
-
if (isScalar(node)) return visitor.Scalar?.(key, node, path);
|
|
425
|
+
if (isScalar$1(node)) return visitor.Scalar?.(key, node, path);
|
|
421
426
|
if (isAlias(node)) return visitor.Alias?.(key, node, path);
|
|
422
427
|
}
|
|
423
428
|
function replaceNode(key, path, node) {
|
|
424
429
|
const parent = path[path.length - 1];
|
|
425
|
-
if (isCollection(parent)) parent.items[key] = node;
|
|
430
|
+
if (isCollection$1(parent)) parent.items[key] = node;
|
|
426
431
|
else if (isPair(parent)) if (key === "key") parent.key = node;
|
|
427
432
|
else parent.value = node;
|
|
428
433
|
else if (isDocument(parent)) parent.contents = node;
|
|
@@ -575,7 +580,7 @@ var Directives = class Directives {
|
|
|
575
580
|
let tagNames;
|
|
576
581
|
if (doc && tagEntries.length > 0 && isNode(doc.contents)) {
|
|
577
582
|
const tags = {};
|
|
578
|
-
visit(doc.contents, (_key, node) => {
|
|
583
|
+
visit$1(doc.contents, (_key, node) => {
|
|
579
584
|
if (isNode(node) && node.tag) tags[node.tag] = true;
|
|
580
585
|
});
|
|
581
586
|
tagNames = Object.keys(tags);
|
|
@@ -609,7 +614,7 @@ function anchorIsValid(anchor) {
|
|
|
609
614
|
}
|
|
610
615
|
function anchorNames(root) {
|
|
611
616
|
const anchors = /* @__PURE__ */ new Set();
|
|
612
|
-
visit(root, { Value(_key, node) {
|
|
617
|
+
visit$1(root, { Value(_key, node) {
|
|
613
618
|
if (node.anchor) anchors.add(node.anchor);
|
|
614
619
|
} });
|
|
615
620
|
return anchors;
|
|
@@ -636,7 +641,7 @@ function createNodeAnchors(doc, prefix) {
|
|
|
636
641
|
setAnchors: () => {
|
|
637
642
|
for (const source of aliasObjects) {
|
|
638
643
|
const ref = sourceObjects.get(source);
|
|
639
|
-
if (typeof ref === "object" && ref.anchor && (isScalar(ref.node) || isCollection(ref.node))) ref.node.anchor = ref.anchor;
|
|
644
|
+
if (typeof ref === "object" && ref.anchor && (isScalar$1(ref.node) || isCollection$1(ref.node))) ref.node.anchor = ref.anchor;
|
|
640
645
|
else {
|
|
641
646
|
const error = /* @__PURE__ */ new Error("Failed to resolve repeated object (this should not happen)");
|
|
642
647
|
error.source = source;
|
|
@@ -708,8 +713,8 @@ function toJS(value, arg, ctx) {
|
|
|
708
713
|
res: void 0
|
|
709
714
|
};
|
|
710
715
|
ctx.anchors.set(value, data);
|
|
711
|
-
ctx.onCreate = (res
|
|
712
|
-
data.res = res
|
|
716
|
+
ctx.onCreate = (res) => {
|
|
717
|
+
data.res = res;
|
|
713
718
|
delete ctx.onCreate;
|
|
714
719
|
};
|
|
715
720
|
const res = value.toJSON(arg, ctx);
|
|
@@ -744,7 +749,7 @@ var NodeBase = class {
|
|
|
744
749
|
maxAliasCount: typeof maxAliasCount === "number" ? maxAliasCount : 100
|
|
745
750
|
};
|
|
746
751
|
const res = toJS(this, "", ctx);
|
|
747
|
-
if (typeof onAnchor === "function") for (const { count, res
|
|
752
|
+
if (typeof onAnchor === "function") for (const { count, res } of ctx.anchors.values()) onAnchor(res, count);
|
|
748
753
|
return typeof reviver === "function" ? applyReviver(reviver, { "": res }, "", res) : res;
|
|
749
754
|
}
|
|
750
755
|
};
|
|
@@ -768,7 +773,7 @@ var Alias = class extends NodeBase {
|
|
|
768
773
|
if (ctx?.aliasResolveCache) nodes = ctx.aliasResolveCache;
|
|
769
774
|
else {
|
|
770
775
|
nodes = [];
|
|
771
|
-
visit(doc, { Node: (_key, node) => {
|
|
776
|
+
visit$1(doc, { Node: (_key, node) => {
|
|
772
777
|
if (isAlias(node) || hasAnchor(node)) nodes.push(node);
|
|
773
778
|
} });
|
|
774
779
|
if (ctx) ctx.aliasResolveCache = nodes;
|
|
@@ -820,7 +825,7 @@ function getAliasCount(doc, node, anchors) {
|
|
|
820
825
|
const source = node.resolve(doc);
|
|
821
826
|
const anchor = anchors && source && anchors.get(source);
|
|
822
827
|
return anchor ? anchor.count * anchor.aliasCount : 0;
|
|
823
|
-
} else if (isCollection(node)) {
|
|
828
|
+
} else if (isCollection$1(node)) {
|
|
824
829
|
let count = 0;
|
|
825
830
|
for (const item of node.items) {
|
|
826
831
|
const c = getAliasCount(doc, item, anchors);
|
|
@@ -872,12 +877,12 @@ function createNode(value, tagName, ctx) {
|
|
|
872
877
|
if (isDocument(value)) value = value.contents;
|
|
873
878
|
if (isNode(value)) return value;
|
|
874
879
|
if (isPair(value)) {
|
|
875
|
-
const map
|
|
876
|
-
map
|
|
877
|
-
return map
|
|
880
|
+
const map = ctx.schema[MAP].createNode?.(ctx.schema, null, ctx);
|
|
881
|
+
map.items.push(value);
|
|
882
|
+
return map;
|
|
878
883
|
}
|
|
879
884
|
if (value instanceof String || value instanceof Number || value instanceof Boolean || typeof BigInt !== "undefined" && value instanceof BigInt) value = value.valueOf();
|
|
880
|
-
const { aliasDuplicateObjects, onAnchor, onTagObj, schema
|
|
885
|
+
const { aliasDuplicateObjects, onAnchor, onTagObj, schema, sourceObjects } = ctx;
|
|
881
886
|
let ref = void 0;
|
|
882
887
|
if (aliasDuplicateObjects && value && typeof value === "object") {
|
|
883
888
|
ref = sourceObjects.get(value);
|
|
@@ -893,15 +898,15 @@ function createNode(value, tagName, ctx) {
|
|
|
893
898
|
}
|
|
894
899
|
}
|
|
895
900
|
if (tagName?.startsWith("!!")) tagName = defaultTagPrefix + tagName.slice(2);
|
|
896
|
-
let tagObj = findTagObject(value, tagName, schema
|
|
901
|
+
let tagObj = findTagObject(value, tagName, schema.tags);
|
|
897
902
|
if (!tagObj) {
|
|
898
903
|
if (value && typeof value.toJSON === "function") value = value.toJSON();
|
|
899
904
|
if (!value || typeof value !== "object") {
|
|
900
|
-
const node
|
|
901
|
-
if (ref) ref.node = node
|
|
902
|
-
return node
|
|
905
|
+
const node = new Scalar(value);
|
|
906
|
+
if (ref) ref.node = node;
|
|
907
|
+
return node;
|
|
903
908
|
}
|
|
904
|
-
tagObj = value instanceof Map ? schema
|
|
909
|
+
tagObj = value instanceof Map ? schema[MAP] : Symbol.iterator in Object(value) ? schema[SEQ] : schema[MAP];
|
|
905
910
|
}
|
|
906
911
|
if (onTagObj) {
|
|
907
912
|
onTagObj(tagObj);
|
|
@@ -916,7 +921,7 @@ function createNode(value, tagName, ctx) {
|
|
|
916
921
|
|
|
917
922
|
//#endregion
|
|
918
923
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/nodes/Collection.js
|
|
919
|
-
function collectionFromPath(schema
|
|
924
|
+
function collectionFromPath(schema, path, value) {
|
|
920
925
|
let v = value;
|
|
921
926
|
for (let i = path.length - 1; i >= 0; --i) {
|
|
922
927
|
const k = path[i];
|
|
@@ -932,16 +937,16 @@ function collectionFromPath(schema$3, path, value) {
|
|
|
932
937
|
onAnchor: () => {
|
|
933
938
|
throw new Error("This should not happen, please report a bug.");
|
|
934
939
|
},
|
|
935
|
-
schema
|
|
940
|
+
schema,
|
|
936
941
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
937
942
|
});
|
|
938
943
|
}
|
|
939
944
|
const isEmptyPath = (path) => path == null || typeof path === "object" && !!path[Symbol.iterator]().next().done;
|
|
940
945
|
var Collection = class extends NodeBase {
|
|
941
|
-
constructor(type, schema
|
|
946
|
+
constructor(type, schema) {
|
|
942
947
|
super(type);
|
|
943
948
|
Object.defineProperty(this, "schema", {
|
|
944
|
-
value: schema
|
|
949
|
+
value: schema,
|
|
945
950
|
configurable: true,
|
|
946
951
|
enumerable: false,
|
|
947
952
|
writable: true
|
|
@@ -952,10 +957,10 @@ var Collection = class extends NodeBase {
|
|
|
952
957
|
*
|
|
953
958
|
* @param schema - If defined, overwrites the original's schema
|
|
954
959
|
*/
|
|
955
|
-
clone(schema
|
|
960
|
+
clone(schema) {
|
|
956
961
|
const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
|
|
957
|
-
if (schema
|
|
958
|
-
copy.items = copy.items.map((it) => isNode(it) || isPair(it) ? it.clone(schema
|
|
962
|
+
if (schema) copy.schema = schema;
|
|
963
|
+
copy.items = copy.items.map((it) => isNode(it) || isPair(it) ? it.clone(schema) : it);
|
|
959
964
|
if (this.range) copy.range = this.range.slice();
|
|
960
965
|
return copy;
|
|
961
966
|
}
|
|
@@ -969,7 +974,7 @@ var Collection = class extends NodeBase {
|
|
|
969
974
|
else {
|
|
970
975
|
const [key, ...rest] = path;
|
|
971
976
|
const node = this.get(key, true);
|
|
972
|
-
if (isCollection(node)) node.addIn(rest, value);
|
|
977
|
+
if (isCollection$1(node)) node.addIn(rest, value);
|
|
973
978
|
else if (node === void 0 && this.schema) this.set(key, collectionFromPath(this.schema, rest, value));
|
|
974
979
|
else throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
|
|
975
980
|
}
|
|
@@ -982,7 +987,7 @@ var Collection = class extends NodeBase {
|
|
|
982
987
|
const [key, ...rest] = path;
|
|
983
988
|
if (rest.length === 0) return this.delete(key);
|
|
984
989
|
const node = this.get(key, true);
|
|
985
|
-
if (isCollection(node)) return node.deleteIn(rest);
|
|
990
|
+
if (isCollection$1(node)) return node.deleteIn(rest);
|
|
986
991
|
else throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
|
|
987
992
|
}
|
|
988
993
|
/**
|
|
@@ -993,14 +998,14 @@ var Collection = class extends NodeBase {
|
|
|
993
998
|
getIn(path, keepScalar) {
|
|
994
999
|
const [key, ...rest] = path;
|
|
995
1000
|
const node = this.get(key, true);
|
|
996
|
-
if (rest.length === 0) return !keepScalar && isScalar(node) ? node.value : node;
|
|
997
|
-
else return isCollection(node) ? node.getIn(rest, keepScalar) : void 0;
|
|
1001
|
+
if (rest.length === 0) return !keepScalar && isScalar$1(node) ? node.value : node;
|
|
1002
|
+
else return isCollection$1(node) ? node.getIn(rest, keepScalar) : void 0;
|
|
998
1003
|
}
|
|
999
1004
|
hasAllNullValues(allowScalar) {
|
|
1000
1005
|
return this.items.every((node) => {
|
|
1001
1006
|
if (!isPair(node)) return false;
|
|
1002
1007
|
const n = node.value;
|
|
1003
|
-
return n == null || allowScalar && isScalar(n) && n.value == null && !n.commentBefore && !n.comment && !n.tag;
|
|
1008
|
+
return n == null || allowScalar && isScalar$1(n) && n.value == null && !n.commentBefore && !n.comment && !n.tag;
|
|
1004
1009
|
});
|
|
1005
1010
|
}
|
|
1006
1011
|
/**
|
|
@@ -1010,7 +1015,7 @@ var Collection = class extends NodeBase {
|
|
|
1010
1015
|
const [key, ...rest] = path;
|
|
1011
1016
|
if (rest.length === 0) return this.has(key);
|
|
1012
1017
|
const node = this.get(key, true);
|
|
1013
|
-
return isCollection(node) ? node.hasIn(rest) : false;
|
|
1018
|
+
return isCollection$1(node) ? node.hasIn(rest) : false;
|
|
1014
1019
|
}
|
|
1015
1020
|
/**
|
|
1016
1021
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
@@ -1021,7 +1026,7 @@ var Collection = class extends NodeBase {
|
|
|
1021
1026
|
if (rest.length === 0) this.set(key, value);
|
|
1022
1027
|
else {
|
|
1023
1028
|
const node = this.get(key, true);
|
|
1024
|
-
if (isCollection(node)) node.setIn(rest, value);
|
|
1029
|
+
if (isCollection$1(node)) node.setIn(rest, value);
|
|
1025
1030
|
else if (node === void 0 && this.schema) this.set(key, collectionFromPath(this.schema, rest, value));
|
|
1026
1031
|
else throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
|
|
1027
1032
|
}
|
|
@@ -1070,12 +1075,12 @@ function foldFlowLines(text, indent, mode = "flow", { indentAtStart, lineWidth =
|
|
|
1070
1075
|
let i = -1;
|
|
1071
1076
|
let escStart = -1;
|
|
1072
1077
|
let escEnd = -1;
|
|
1073
|
-
if (mode ===
|
|
1078
|
+
if (mode === "block") {
|
|
1074
1079
|
i = consumeMoreIndentedLines(text, i, indent.length);
|
|
1075
1080
|
if (i !== -1) end = i + endStep;
|
|
1076
1081
|
}
|
|
1077
1082
|
for (let ch; ch = text[i += 1];) {
|
|
1078
|
-
if (mode ===
|
|
1083
|
+
if (mode === "quoted" && ch === "\\") {
|
|
1079
1084
|
escStart = i;
|
|
1080
1085
|
switch (text[i + 1]) {
|
|
1081
1086
|
case "x":
|
|
@@ -1092,7 +1097,7 @@ function foldFlowLines(text, indent, mode = "flow", { indentAtStart, lineWidth =
|
|
|
1092
1097
|
escEnd = i;
|
|
1093
1098
|
}
|
|
1094
1099
|
if (ch === "\n") {
|
|
1095
|
-
if (mode ===
|
|
1100
|
+
if (mode === "block") i = consumeMoreIndentedLines(text, i, indent.length);
|
|
1096
1101
|
end = i + indent.length + endStep;
|
|
1097
1102
|
split = void 0;
|
|
1098
1103
|
} else {
|
|
@@ -1104,7 +1109,7 @@ function foldFlowLines(text, indent, mode = "flow", { indentAtStart, lineWidth =
|
|
|
1104
1109
|
folds.push(split);
|
|
1105
1110
|
end = split + endStep;
|
|
1106
1111
|
split = void 0;
|
|
1107
|
-
} else if (mode ===
|
|
1112
|
+
} else if (mode === "quoted") {
|
|
1108
1113
|
while (prev === " " || prev === " ") {
|
|
1109
1114
|
prev = ch;
|
|
1110
1115
|
ch = text[i += 1];
|
|
@@ -1124,13 +1129,13 @@ function foldFlowLines(text, indent, mode = "flow", { indentAtStart, lineWidth =
|
|
|
1124
1129
|
if (folds.length === 0) return text;
|
|
1125
1130
|
if (onFold) onFold();
|
|
1126
1131
|
let res = text.slice(0, folds[0]);
|
|
1127
|
-
for (let i
|
|
1128
|
-
const fold = folds[i
|
|
1129
|
-
const end
|
|
1130
|
-
if (fold === 0) res = `\n${indent}${text.slice(0, end
|
|
1132
|
+
for (let i = 0; i < folds.length; ++i) {
|
|
1133
|
+
const fold = folds[i];
|
|
1134
|
+
const end = folds[i + 1] || text.length;
|
|
1135
|
+
if (fold === 0) res = `\n${indent}${text.slice(0, end)}`;
|
|
1131
1136
|
else {
|
|
1132
|
-
if (mode ===
|
|
1133
|
-
res += `\n${indent}${text.slice(fold + 1, end
|
|
1137
|
+
if (mode === "quoted" && escapedFolds[fold]) res += `${text[fold]}\\`;
|
|
1138
|
+
res += `\n${indent}${text.slice(fold + 1, end)}`;
|
|
1134
1139
|
}
|
|
1135
1140
|
}
|
|
1136
1141
|
return res;
|
|
@@ -1157,8 +1162,8 @@ function consumeMoreIndentedLines(text, i, indent) {
|
|
|
1157
1162
|
|
|
1158
1163
|
//#endregion
|
|
1159
1164
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/stringify/stringifyString.js
|
|
1160
|
-
const getFoldOptions = (ctx, isBlock
|
|
1161
|
-
indentAtStart: isBlock
|
|
1165
|
+
const getFoldOptions = (ctx, isBlock) => ({
|
|
1166
|
+
indentAtStart: isBlock ? ctx.indent.length : ctx.indentAtStart,
|
|
1162
1167
|
lineWidth: ctx.options.lineWidth,
|
|
1163
1168
|
minContentWidth: ctx.options.minContentWidth
|
|
1164
1169
|
});
|
|
@@ -1268,7 +1273,7 @@ function quotedString(value, ctx) {
|
|
|
1268
1273
|
}
|
|
1269
1274
|
let blockEndNewlines;
|
|
1270
1275
|
try {
|
|
1271
|
-
blockEndNewlines = new RegExp("(^|(?<!\n))\n+(?!\n|$)", "g");
|
|
1276
|
+
blockEndNewlines = /* @__PURE__ */ new RegExp("(^|(?<!\n))\n+(?!\n|$)", "g");
|
|
1272
1277
|
} catch {
|
|
1273
1278
|
blockEndNewlines = /\n+(?!\n|$)/g;
|
|
1274
1279
|
}
|
|
@@ -1424,7 +1429,7 @@ function getTagObject(tags, item) {
|
|
|
1424
1429
|
}
|
|
1425
1430
|
let tagObj = void 0;
|
|
1426
1431
|
let obj;
|
|
1427
|
-
if (isScalar(item)) {
|
|
1432
|
+
if (isScalar$1(item)) {
|
|
1428
1433
|
obj = item.value;
|
|
1429
1434
|
let match = tags.filter((t) => t.identify?.(obj));
|
|
1430
1435
|
if (match.length > 1) {
|
|
@@ -1445,7 +1450,7 @@ function getTagObject(tags, item) {
|
|
|
1445
1450
|
function stringifyProps(node, tagObj, { anchors, doc }) {
|
|
1446
1451
|
if (!doc.directives) return "";
|
|
1447
1452
|
const props = [];
|
|
1448
|
-
const anchor = (isScalar(node) || isCollection(node)) && node.anchor;
|
|
1453
|
+
const anchor = (isScalar$1(node) || isCollection$1(node)) && node.anchor;
|
|
1449
1454
|
if (anchor && anchorIsValid(anchor)) {
|
|
1450
1455
|
anchors.add(anchor);
|
|
1451
1456
|
props.push(`&${anchor}`);
|
|
@@ -1470,9 +1475,9 @@ function stringify$2(item, ctx, onComment, onChompKeep) {
|
|
|
1470
1475
|
tagObj ?? (tagObj = getTagObject(ctx.doc.schema.tags, node));
|
|
1471
1476
|
const props = stringifyProps(node, tagObj, ctx);
|
|
1472
1477
|
if (props.length > 0) ctx.indentAtStart = (ctx.indentAtStart ?? 0) + props.length + 1;
|
|
1473
|
-
const str = typeof tagObj.stringify === "function" ? tagObj.stringify(node, ctx, onComment, onChompKeep) : isScalar(node) ? stringifyString(node, ctx, onComment, onChompKeep) : node.toString(ctx, onComment, onChompKeep);
|
|
1478
|
+
const str = typeof tagObj.stringify === "function" ? tagObj.stringify(node, ctx, onComment, onChompKeep) : isScalar$1(node) ? stringifyString(node, ctx, onComment, onChompKeep) : node.toString(ctx, onComment, onChompKeep);
|
|
1474
1479
|
if (!props) return str;
|
|
1475
|
-
return isScalar(node) || str[0] === "{" || str[0] === "[" ? `${props} ${str}` : `${props}\n${ctx.indent}${str}`;
|
|
1480
|
+
return isScalar$1(node) || str[0] === "{" || str[0] === "[" ? `${props} ${str}` : `${props}\n${ctx.indent}${str}`;
|
|
1476
1481
|
}
|
|
1477
1482
|
|
|
1478
1483
|
//#endregion
|
|
@@ -1482,9 +1487,9 @@ function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
|
|
|
1482
1487
|
let keyComment = isNode(key) && key.comment || null;
|
|
1483
1488
|
if (simpleKeys) {
|
|
1484
1489
|
if (keyComment) throw new Error("With simple keys, key nodes cannot have comments");
|
|
1485
|
-
if (isCollection(key) || !isNode(key) && typeof key === "object") throw new Error("With simple keys, collection cannot be used as a key value");
|
|
1490
|
+
if (isCollection$1(key) || !isNode(key) && typeof key === "object") throw new Error("With simple keys, collection cannot be used as a key value");
|
|
1486
1491
|
}
|
|
1487
|
-
let explicitKey = !simpleKeys && (!key || keyComment && value == null && !ctx.inFlow || isCollection(key) || (isScalar(key) ? key.type === Scalar.BLOCK_FOLDED || key.type === Scalar.BLOCK_LITERAL : typeof key === "object"));
|
|
1492
|
+
let explicitKey = !simpleKeys && (!key || keyComment && value == null && !ctx.inFlow || isCollection$1(key) || (isScalar$1(key) ? key.type === Scalar.BLOCK_FOLDED || key.type === Scalar.BLOCK_LITERAL : typeof key === "object"));
|
|
1488
1493
|
ctx = Object.assign({}, ctx, {
|
|
1489
1494
|
allNullValues: false,
|
|
1490
1495
|
implicitKey: !explicitKey && (simpleKeys || !allNullValues),
|
|
@@ -1528,7 +1533,7 @@ function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
|
|
|
1528
1533
|
if (value && typeof value === "object") value = doc.createNode(value);
|
|
1529
1534
|
}
|
|
1530
1535
|
ctx.implicitKey = false;
|
|
1531
|
-
if (!explicitKey && !keyComment && isScalar(value)) ctx.indentAtStart = str.length + 1;
|
|
1536
|
+
if (!explicitKey && !keyComment && isScalar$1(value)) ctx.indentAtStart = str.length + 1;
|
|
1532
1537
|
chompKeep = false;
|
|
1533
1538
|
if (!indentSeq && indentStep.length >= 2 && !ctx.inFlow && !explicitKey && isSeq(value) && !value.flow && !value.tag && !value.anchor) ctx.indent = ctx.indent.substring(2);
|
|
1534
1539
|
let valueCommentDone = false;
|
|
@@ -1543,7 +1548,7 @@ function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
|
|
|
1543
1548
|
if (valueStr === "" && !ctx.inFlow) {
|
|
1544
1549
|
if (ws === "\n" && valueComment) ws = "\n\n";
|
|
1545
1550
|
} else ws += `\n${ctx.indent}`;
|
|
1546
|
-
} else if (!explicitKey && isCollection(value)) {
|
|
1551
|
+
} else if (!explicitKey && isCollection$1(value)) {
|
|
1547
1552
|
const vs0 = valueStr[0];
|
|
1548
1553
|
const nl0 = valueStr.indexOf("\n");
|
|
1549
1554
|
const hasNewline = nl0 !== -1;
|
|
@@ -1583,51 +1588,51 @@ const merge = {
|
|
|
1583
1588
|
resolve: () => Object.assign(new Scalar(Symbol(MERGE_KEY)), { addToJSMap: addMergeToJSMap }),
|
|
1584
1589
|
stringify: () => MERGE_KEY
|
|
1585
1590
|
};
|
|
1586
|
-
const isMergeKey = (ctx, key) => (merge.identify(key) || isScalar(key) && (!key.type || key.type === Scalar.PLAIN) && merge.identify(key.value)) && ctx?.doc.schema.tags.some((tag) => tag.tag === merge.tag && tag.default);
|
|
1587
|
-
function addMergeToJSMap(ctx, map
|
|
1591
|
+
const isMergeKey = (ctx, key) => (merge.identify(key) || isScalar$1(key) && (!key.type || key.type === Scalar.PLAIN) && merge.identify(key.value)) && ctx?.doc.schema.tags.some((tag) => tag.tag === merge.tag && tag.default);
|
|
1592
|
+
function addMergeToJSMap(ctx, map, value) {
|
|
1588
1593
|
value = ctx && isAlias(value) ? value.resolve(ctx.doc) : value;
|
|
1589
|
-
if (isSeq(value)) for (const it of value.items) mergeValue(ctx, map
|
|
1590
|
-
else if (Array.isArray(value)) for (const it of value) mergeValue(ctx, map
|
|
1591
|
-
else mergeValue(ctx, map
|
|
1594
|
+
if (isSeq(value)) for (const it of value.items) mergeValue(ctx, map, it);
|
|
1595
|
+
else if (Array.isArray(value)) for (const it of value) mergeValue(ctx, map, it);
|
|
1596
|
+
else mergeValue(ctx, map, value);
|
|
1592
1597
|
}
|
|
1593
|
-
function mergeValue(ctx, map
|
|
1598
|
+
function mergeValue(ctx, map, value) {
|
|
1594
1599
|
const source = ctx && isAlias(value) ? value.resolve(ctx.doc) : value;
|
|
1595
1600
|
if (!isMap(source)) throw new Error("Merge sources must be maps or map aliases");
|
|
1596
1601
|
const srcMap = source.toJSON(null, ctx, Map);
|
|
1597
|
-
for (const [key, value
|
|
1598
|
-
if (!map
|
|
1599
|
-
} else if (map
|
|
1600
|
-
else if (!Object.prototype.hasOwnProperty.call(map
|
|
1601
|
-
value
|
|
1602
|
+
for (const [key, value] of srcMap) if (map instanceof Map) {
|
|
1603
|
+
if (!map.has(key)) map.set(key, value);
|
|
1604
|
+
} else if (map instanceof Set) map.add(key);
|
|
1605
|
+
else if (!Object.prototype.hasOwnProperty.call(map, key)) Object.defineProperty(map, key, {
|
|
1606
|
+
value,
|
|
1602
1607
|
writable: true,
|
|
1603
1608
|
enumerable: true,
|
|
1604
1609
|
configurable: true
|
|
1605
1610
|
});
|
|
1606
|
-
return map
|
|
1611
|
+
return map;
|
|
1607
1612
|
}
|
|
1608
1613
|
|
|
1609
1614
|
//#endregion
|
|
1610
1615
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js
|
|
1611
|
-
function addPairToJSMap(ctx, map
|
|
1612
|
-
if (isNode(key) && key.addToJSMap) key.addToJSMap(ctx, map
|
|
1613
|
-
else if (isMergeKey(ctx, key)) addMergeToJSMap(ctx, map
|
|
1616
|
+
function addPairToJSMap(ctx, map, { key, value }) {
|
|
1617
|
+
if (isNode(key) && key.addToJSMap) key.addToJSMap(ctx, map, value);
|
|
1618
|
+
else if (isMergeKey(ctx, key)) addMergeToJSMap(ctx, map, value);
|
|
1614
1619
|
else {
|
|
1615
1620
|
const jsKey = toJS(key, "", ctx);
|
|
1616
|
-
if (map
|
|
1617
|
-
else if (map
|
|
1621
|
+
if (map instanceof Map) map.set(jsKey, toJS(value, jsKey, ctx));
|
|
1622
|
+
else if (map instanceof Set) map.add(jsKey);
|
|
1618
1623
|
else {
|
|
1619
1624
|
const stringKey = stringifyKey(key, jsKey, ctx);
|
|
1620
1625
|
const jsValue = toJS(value, stringKey, ctx);
|
|
1621
|
-
if (stringKey in map
|
|
1626
|
+
if (stringKey in map) Object.defineProperty(map, stringKey, {
|
|
1622
1627
|
value: jsValue,
|
|
1623
1628
|
writable: true,
|
|
1624
1629
|
enumerable: true,
|
|
1625
1630
|
configurable: true
|
|
1626
1631
|
});
|
|
1627
|
-
else map
|
|
1632
|
+
else map[stringKey] = jsValue;
|
|
1628
1633
|
}
|
|
1629
1634
|
}
|
|
1630
|
-
return map
|
|
1635
|
+
return map;
|
|
1631
1636
|
}
|
|
1632
1637
|
function stringifyKey(key, jsKey, ctx) {
|
|
1633
1638
|
if (jsKey === null) return "";
|
|
@@ -1661,10 +1666,10 @@ var Pair = class Pair {
|
|
|
1661
1666
|
this.key = key;
|
|
1662
1667
|
this.value = value;
|
|
1663
1668
|
}
|
|
1664
|
-
clone(schema
|
|
1669
|
+
clone(schema) {
|
|
1665
1670
|
let { key, value } = this;
|
|
1666
|
-
if (isNode(key)) key = key.clone(schema
|
|
1667
|
-
if (isNode(value)) value = value.clone(schema
|
|
1671
|
+
if (isNode(key)) key = key.clone(schema);
|
|
1672
|
+
if (isNode(value)) value = value.clone(schema);
|
|
1668
1673
|
return new Pair(key, value);
|
|
1669
1674
|
}
|
|
1670
1675
|
toJSON(_, ctx) {
|
|
@@ -1690,11 +1695,11 @@ function stringifyBlockCollection({ comment, items }, ctx, { blockItemPrefix, fl
|
|
|
1690
1695
|
const lines = [];
|
|
1691
1696
|
for (let i = 0; i < items.length; ++i) {
|
|
1692
1697
|
const item = items[i];
|
|
1693
|
-
let comment
|
|
1698
|
+
let comment = null;
|
|
1694
1699
|
if (isNode(item)) {
|
|
1695
1700
|
if (!chompKeep && item.spaceBefore) lines.push("");
|
|
1696
1701
|
addCommentBefore(ctx, lines, item.commentBefore, chompKeep);
|
|
1697
|
-
if (item.comment) comment
|
|
1702
|
+
if (item.comment) comment = item.comment;
|
|
1698
1703
|
} else if (isPair(item)) {
|
|
1699
1704
|
const ik = isNode(item.key) ? item.key : null;
|
|
1700
1705
|
if (ik) {
|
|
@@ -1703,10 +1708,10 @@ function stringifyBlockCollection({ comment, items }, ctx, { blockItemPrefix, fl
|
|
|
1703
1708
|
}
|
|
1704
1709
|
}
|
|
1705
1710
|
chompKeep = false;
|
|
1706
|
-
let str
|
|
1707
|
-
if (comment
|
|
1708
|
-
if (chompKeep && comment
|
|
1709
|
-
lines.push(blockItemPrefix + str
|
|
1711
|
+
let str = stringify$2(item, itemCtx, () => comment = null, () => chompKeep = true);
|
|
1712
|
+
if (comment) str += lineComment(str, itemIndent, commentString(comment));
|
|
1713
|
+
if (chompKeep && comment) chompKeep = false;
|
|
1714
|
+
lines.push(blockItemPrefix + str);
|
|
1710
1715
|
}
|
|
1711
1716
|
let str;
|
|
1712
1717
|
if (lines.length === 0) str = flowChars.start + flowChars.end;
|
|
@@ -1787,36 +1792,36 @@ function addCommentBefore({ indent, options: { commentString } }, lines, comment
|
|
|
1787
1792
|
//#endregion
|
|
1788
1793
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/nodes/YAMLMap.js
|
|
1789
1794
|
function findPair(items, key) {
|
|
1790
|
-
const k = isScalar(key) ? key.value : key;
|
|
1795
|
+
const k = isScalar$1(key) ? key.value : key;
|
|
1791
1796
|
for (const it of items) if (isPair(it)) {
|
|
1792
1797
|
if (it.key === key || it.key === k) return it;
|
|
1793
|
-
if (isScalar(it.key) && it.key.value === k) return it;
|
|
1798
|
+
if (isScalar$1(it.key) && it.key.value === k) return it;
|
|
1794
1799
|
}
|
|
1795
1800
|
}
|
|
1796
1801
|
var YAMLMap = class extends Collection {
|
|
1797
1802
|
static get tagName() {
|
|
1798
1803
|
return "tag:yaml.org,2002:map";
|
|
1799
1804
|
}
|
|
1800
|
-
constructor(schema
|
|
1801
|
-
super(MAP, schema
|
|
1805
|
+
constructor(schema) {
|
|
1806
|
+
super(MAP, schema);
|
|
1802
1807
|
this.items = [];
|
|
1803
1808
|
}
|
|
1804
1809
|
/**
|
|
1805
1810
|
* A generic collection parsing method that can be extended
|
|
1806
1811
|
* to other node classes that inherit from YAMLMap
|
|
1807
1812
|
*/
|
|
1808
|
-
static from(schema
|
|
1813
|
+
static from(schema, obj, ctx) {
|
|
1809
1814
|
const { keepUndefined, replacer } = ctx;
|
|
1810
|
-
const map
|
|
1815
|
+
const map = new this(schema);
|
|
1811
1816
|
const add = (key, value) => {
|
|
1812
1817
|
if (typeof replacer === "function") value = replacer.call(obj, key, value);
|
|
1813
1818
|
else if (Array.isArray(replacer) && !replacer.includes(key)) return;
|
|
1814
|
-
if (value !== void 0 || keepUndefined) map
|
|
1819
|
+
if (value !== void 0 || keepUndefined) map.items.push(createPair(key, value, ctx));
|
|
1815
1820
|
};
|
|
1816
1821
|
if (obj instanceof Map) for (const [key, value] of obj) add(key, value);
|
|
1817
1822
|
else if (obj && typeof obj === "object") for (const key of Object.keys(obj)) add(key, obj[key]);
|
|
1818
|
-
if (typeof schema
|
|
1819
|
-
return map
|
|
1823
|
+
if (typeof schema.sortMapEntries === "function") map.items.sort(schema.sortMapEntries);
|
|
1824
|
+
return map;
|
|
1820
1825
|
}
|
|
1821
1826
|
/**
|
|
1822
1827
|
* Adds a value to the collection.
|
|
@@ -1833,7 +1838,7 @@ var YAMLMap = class extends Collection {
|
|
|
1833
1838
|
const sortEntries = this.schema?.sortMapEntries;
|
|
1834
1839
|
if (prev) {
|
|
1835
1840
|
if (!overwrite) throw new Error(`Key ${_pair.key} already set`);
|
|
1836
|
-
if (isScalar(prev.value) && isScalarValue(_pair.value)) prev.value.value = _pair.value;
|
|
1841
|
+
if (isScalar$1(prev.value) && isScalarValue(_pair.value)) prev.value.value = _pair.value;
|
|
1837
1842
|
else prev.value = _pair.value;
|
|
1838
1843
|
} else if (sortEntries) {
|
|
1839
1844
|
const i = this.items.findIndex((item) => sortEntries(_pair, item) < 0);
|
|
@@ -1848,7 +1853,7 @@ var YAMLMap = class extends Collection {
|
|
|
1848
1853
|
}
|
|
1849
1854
|
get(key, keepScalar) {
|
|
1850
1855
|
const node = findPair(this.items, key)?.value;
|
|
1851
|
-
return (!keepScalar && isScalar(node) ? node.value : node) ?? void 0;
|
|
1856
|
+
return (!keepScalar && isScalar$1(node) ? node.value : node) ?? void 0;
|
|
1852
1857
|
}
|
|
1853
1858
|
has(key) {
|
|
1854
1859
|
return !!findPair(this.items, key);
|
|
@@ -1862,10 +1867,10 @@ var YAMLMap = class extends Collection {
|
|
|
1862
1867
|
* @returns Instance of Type, Map, or Object
|
|
1863
1868
|
*/
|
|
1864
1869
|
toJSON(_, ctx, Type) {
|
|
1865
|
-
const map
|
|
1866
|
-
if (ctx?.onCreate) ctx.onCreate(map
|
|
1867
|
-
for (const item of this.items) addPairToJSMap(ctx, map
|
|
1868
|
-
return map
|
|
1870
|
+
const map = Type ? new Type() : ctx?.mapAsMap ? /* @__PURE__ */ new Map() : {};
|
|
1871
|
+
if (ctx?.onCreate) ctx.onCreate(map);
|
|
1872
|
+
for (const item of this.items) addPairToJSMap(ctx, map, item);
|
|
1873
|
+
return map;
|
|
1869
1874
|
}
|
|
1870
1875
|
toString(ctx, onComment, onChompKeep) {
|
|
1871
1876
|
if (!ctx) return JSON.stringify(this);
|
|
@@ -1891,11 +1896,11 @@ const map = {
|
|
|
1891
1896
|
default: true,
|
|
1892
1897
|
nodeClass: YAMLMap,
|
|
1893
1898
|
tag: "tag:yaml.org,2002:map",
|
|
1894
|
-
resolve(map
|
|
1895
|
-
if (!isMap(map
|
|
1896
|
-
return map
|
|
1899
|
+
resolve(map, onError) {
|
|
1900
|
+
if (!isMap(map)) onError("Expected a mapping for this tag");
|
|
1901
|
+
return map;
|
|
1897
1902
|
},
|
|
1898
|
-
createNode: (schema
|
|
1903
|
+
createNode: (schema, obj, ctx) => YAMLMap.from(schema, obj, ctx)
|
|
1899
1904
|
};
|
|
1900
1905
|
|
|
1901
1906
|
//#endregion
|
|
@@ -1904,8 +1909,8 @@ var YAMLSeq = class extends Collection {
|
|
|
1904
1909
|
static get tagName() {
|
|
1905
1910
|
return "tag:yaml.org,2002:seq";
|
|
1906
1911
|
}
|
|
1907
|
-
constructor(schema
|
|
1908
|
-
super(SEQ, schema
|
|
1912
|
+
constructor(schema) {
|
|
1913
|
+
super(SEQ, schema);
|
|
1909
1914
|
this.items = [];
|
|
1910
1915
|
}
|
|
1911
1916
|
add(value) {
|
|
@@ -1928,7 +1933,7 @@ var YAMLSeq = class extends Collection {
|
|
|
1928
1933
|
const idx = asItemIndex(key);
|
|
1929
1934
|
if (typeof idx !== "number") return void 0;
|
|
1930
1935
|
const it = this.items[idx];
|
|
1931
|
-
return !keepScalar && isScalar(it) ? it.value : it;
|
|
1936
|
+
return !keepScalar && isScalar$1(it) ? it.value : it;
|
|
1932
1937
|
}
|
|
1933
1938
|
/**
|
|
1934
1939
|
* Checks if the collection includes a value with the key `key`.
|
|
@@ -1951,15 +1956,15 @@ var YAMLSeq = class extends Collection {
|
|
|
1951
1956
|
const idx = asItemIndex(key);
|
|
1952
1957
|
if (typeof idx !== "number") throw new Error(`Expected a valid index, not ${key}.`);
|
|
1953
1958
|
const prev = this.items[idx];
|
|
1954
|
-
if (isScalar(prev) && isScalarValue(value)) prev.value = value;
|
|
1959
|
+
if (isScalar$1(prev) && isScalarValue(value)) prev.value = value;
|
|
1955
1960
|
else this.items[idx] = value;
|
|
1956
1961
|
}
|
|
1957
1962
|
toJSON(_, ctx) {
|
|
1958
|
-
const seq
|
|
1959
|
-
if (ctx?.onCreate) ctx.onCreate(seq
|
|
1963
|
+
const seq = [];
|
|
1964
|
+
if (ctx?.onCreate) ctx.onCreate(seq);
|
|
1960
1965
|
let i = 0;
|
|
1961
|
-
for (const item of this.items) seq
|
|
1962
|
-
return seq
|
|
1966
|
+
for (const item of this.items) seq.push(toJS(item, String(i++), ctx));
|
|
1967
|
+
return seq;
|
|
1963
1968
|
}
|
|
1964
1969
|
toString(ctx, onComment, onChompKeep) {
|
|
1965
1970
|
if (!ctx) return JSON.stringify(this);
|
|
@@ -1974,9 +1979,9 @@ var YAMLSeq = class extends Collection {
|
|
|
1974
1979
|
onComment
|
|
1975
1980
|
});
|
|
1976
1981
|
}
|
|
1977
|
-
static from(schema
|
|
1982
|
+
static from(schema, obj, ctx) {
|
|
1978
1983
|
const { replacer } = ctx;
|
|
1979
|
-
const seq
|
|
1984
|
+
const seq = new this(schema);
|
|
1980
1985
|
if (obj && Symbol.iterator in Object(obj)) {
|
|
1981
1986
|
let i = 0;
|
|
1982
1987
|
for (let it of obj) {
|
|
@@ -1984,14 +1989,14 @@ var YAMLSeq = class extends Collection {
|
|
|
1984
1989
|
const key = obj instanceof Set ? it : String(i++);
|
|
1985
1990
|
it = replacer.call(obj, key, it);
|
|
1986
1991
|
}
|
|
1987
|
-
seq
|
|
1992
|
+
seq.items.push(createNode(it, void 0, ctx));
|
|
1988
1993
|
}
|
|
1989
1994
|
}
|
|
1990
|
-
return seq
|
|
1995
|
+
return seq;
|
|
1991
1996
|
}
|
|
1992
1997
|
};
|
|
1993
1998
|
function asItemIndex(key) {
|
|
1994
|
-
let idx = isScalar(key) ? key.value : key;
|
|
1999
|
+
let idx = isScalar$1(key) ? key.value : key;
|
|
1995
2000
|
if (idx && typeof idx === "string") idx = Number(idx);
|
|
1996
2001
|
return typeof idx === "number" && Number.isInteger(idx) && idx >= 0 ? idx : null;
|
|
1997
2002
|
}
|
|
@@ -2003,11 +2008,11 @@ const seq = {
|
|
|
2003
2008
|
default: true,
|
|
2004
2009
|
nodeClass: YAMLSeq,
|
|
2005
2010
|
tag: "tag:yaml.org,2002:seq",
|
|
2006
|
-
resolve(seq
|
|
2007
|
-
if (!isSeq(seq
|
|
2008
|
-
return seq
|
|
2011
|
+
resolve(seq, onError) {
|
|
2012
|
+
if (!isSeq(seq)) onError("Expected a sequence for this tag");
|
|
2013
|
+
return seq;
|
|
2009
2014
|
},
|
|
2010
|
-
createNode: (schema
|
|
2015
|
+
createNode: (schema, obj, ctx) => YAMLSeq.from(schema, obj, ctx)
|
|
2011
2016
|
};
|
|
2012
2017
|
|
|
2013
2018
|
//#endregion
|
|
@@ -2072,7 +2077,7 @@ function stringifyNumber({ format, minFractionDigits, tag, value }) {
|
|
|
2072
2077
|
|
|
2073
2078
|
//#endregion
|
|
2074
2079
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/core/float.js
|
|
2075
|
-
const floatNaN = {
|
|
2080
|
+
const floatNaN$1 = {
|
|
2076
2081
|
identify: (value) => typeof value === "number",
|
|
2077
2082
|
default: true,
|
|
2078
2083
|
tag: "tag:yaml.org,2002:float",
|
|
@@ -2080,7 +2085,7 @@ const floatNaN = {
|
|
|
2080
2085
|
resolve: (str) => str.slice(-3).toLowerCase() === "nan" ? NaN : str[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
|
|
2081
2086
|
stringify: stringifyNumber
|
|
2082
2087
|
};
|
|
2083
|
-
const floatExp = {
|
|
2088
|
+
const floatExp$1 = {
|
|
2084
2089
|
identify: (value) => typeof value === "number",
|
|
2085
2090
|
default: true,
|
|
2086
2091
|
tag: "tag:yaml.org,2002:float",
|
|
@@ -2092,7 +2097,7 @@ const floatExp = {
|
|
|
2092
2097
|
return isFinite(num) ? num.toExponential() : stringifyNumber(node);
|
|
2093
2098
|
}
|
|
2094
2099
|
};
|
|
2095
|
-
const float = {
|
|
2100
|
+
const float$1 = {
|
|
2096
2101
|
identify: (value) => typeof value === "number",
|
|
2097
2102
|
default: true,
|
|
2098
2103
|
tag: "tag:yaml.org,2002:float",
|
|
@@ -2115,7 +2120,7 @@ function intStringify$1(node, radix, prefix) {
|
|
|
2115
2120
|
if (intIdentify$2(value) && value >= 0) return prefix + value.toString(radix);
|
|
2116
2121
|
return stringifyNumber(node);
|
|
2117
2122
|
}
|
|
2118
|
-
const intOct = {
|
|
2123
|
+
const intOct$1 = {
|
|
2119
2124
|
identify: (value) => intIdentify$2(value) && value >= 0,
|
|
2120
2125
|
default: true,
|
|
2121
2126
|
tag: "tag:yaml.org,2002:int",
|
|
@@ -2124,7 +2129,7 @@ const intOct = {
|
|
|
2124
2129
|
resolve: (str, _onError, opt) => intResolve$1(str, 2, 8, opt),
|
|
2125
2130
|
stringify: (node) => intStringify$1(node, 8, "0o")
|
|
2126
2131
|
};
|
|
2127
|
-
const int = {
|
|
2132
|
+
const int$1 = {
|
|
2128
2133
|
identify: intIdentify$2,
|
|
2129
2134
|
default: true,
|
|
2130
2135
|
tag: "tag:yaml.org,2002:int",
|
|
@@ -2132,7 +2137,7 @@ const int = {
|
|
|
2132
2137
|
resolve: (str, _onError, opt) => intResolve$1(str, 0, 10, opt),
|
|
2133
2138
|
stringify: stringifyNumber
|
|
2134
2139
|
};
|
|
2135
|
-
const intHex = {
|
|
2140
|
+
const intHex$1 = {
|
|
2136
2141
|
identify: (value) => intIdentify$2(value) && value >= 0,
|
|
2137
2142
|
default: true,
|
|
2138
2143
|
tag: "tag:yaml.org,2002:int",
|
|
@@ -2144,18 +2149,18 @@ const intHex = {
|
|
|
2144
2149
|
|
|
2145
2150
|
//#endregion
|
|
2146
2151
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/core/schema.js
|
|
2147
|
-
const schema = [
|
|
2152
|
+
const schema$2 = [
|
|
2148
2153
|
map,
|
|
2149
2154
|
seq,
|
|
2150
2155
|
string,
|
|
2151
2156
|
nullTag,
|
|
2152
2157
|
boolTag,
|
|
2153
|
-
intOct,
|
|
2154
|
-
int,
|
|
2155
|
-
intHex,
|
|
2156
|
-
floatNaN,
|
|
2157
|
-
floatExp,
|
|
2158
|
-
float
|
|
2158
|
+
intOct$1,
|
|
2159
|
+
int$1,
|
|
2160
|
+
intHex$1,
|
|
2161
|
+
floatNaN$1,
|
|
2162
|
+
floatExp$1,
|
|
2163
|
+
float$1
|
|
2159
2164
|
];
|
|
2160
2165
|
|
|
2161
2166
|
//#endregion
|
|
@@ -2260,9 +2265,9 @@ const binary = {
|
|
|
2260
2265
|
|
|
2261
2266
|
//#endregion
|
|
2262
2267
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js
|
|
2263
|
-
function resolvePairs(seq
|
|
2264
|
-
if (isSeq(seq
|
|
2265
|
-
let item = seq
|
|
2268
|
+
function resolvePairs(seq, onError) {
|
|
2269
|
+
if (isSeq(seq)) for (let i = 0; i < seq.items.length; ++i) {
|
|
2270
|
+
let item = seq.items[i];
|
|
2266
2271
|
if (isPair(item)) continue;
|
|
2267
2272
|
else if (isMap(item)) {
|
|
2268
2273
|
if (item.items.length > 1) onError("Each pair must have its own sequence indicator");
|
|
@@ -2274,15 +2279,15 @@ function resolvePairs(seq$1, onError) {
|
|
|
2274
2279
|
}
|
|
2275
2280
|
item = pair;
|
|
2276
2281
|
}
|
|
2277
|
-
seq
|
|
2282
|
+
seq.items[i] = isPair(item) ? item : new Pair(item);
|
|
2278
2283
|
}
|
|
2279
2284
|
else onError("Expected a sequence for this tag");
|
|
2280
|
-
return seq
|
|
2285
|
+
return seq;
|
|
2281
2286
|
}
|
|
2282
|
-
function createPairs(schema
|
|
2287
|
+
function createPairs(schema, iterable, ctx) {
|
|
2283
2288
|
const { replacer } = ctx;
|
|
2284
|
-
const pairs
|
|
2285
|
-
pairs
|
|
2289
|
+
const pairs = new YAMLSeq(schema);
|
|
2290
|
+
pairs.tag = "tag:yaml.org,2002:pairs";
|
|
2286
2291
|
let i = 0;
|
|
2287
2292
|
if (iterable && Symbol.iterator in Object(iterable)) for (let it of iterable) {
|
|
2288
2293
|
if (typeof replacer === "function") it = replacer.call(iterable, String(i++), it);
|
|
@@ -2298,9 +2303,9 @@ function createPairs(schema$3, iterable, ctx) {
|
|
|
2298
2303
|
value = it[key];
|
|
2299
2304
|
} else throw new TypeError(`Expected tuple with one key, not ${keys.length} keys`);
|
|
2300
2305
|
} else key = it;
|
|
2301
|
-
pairs
|
|
2306
|
+
pairs.items.push(createPair(key, value, ctx));
|
|
2302
2307
|
}
|
|
2303
|
-
return pairs
|
|
2308
|
+
return pairs;
|
|
2304
2309
|
}
|
|
2305
2310
|
const pairs = {
|
|
2306
2311
|
collection: "seq",
|
|
@@ -2328,24 +2333,24 @@ var YAMLOMap = class YAMLOMap extends YAMLSeq {
|
|
|
2328
2333
|
*/
|
|
2329
2334
|
toJSON(_, ctx) {
|
|
2330
2335
|
if (!ctx) return super.toJSON(_);
|
|
2331
|
-
const map
|
|
2332
|
-
if (ctx?.onCreate) ctx.onCreate(map
|
|
2336
|
+
const map = /* @__PURE__ */ new Map();
|
|
2337
|
+
if (ctx?.onCreate) ctx.onCreate(map);
|
|
2333
2338
|
for (const pair of this.items) {
|
|
2334
2339
|
let key, value;
|
|
2335
2340
|
if (isPair(pair)) {
|
|
2336
2341
|
key = toJS(pair.key, "", ctx);
|
|
2337
2342
|
value = toJS(pair.value, key, ctx);
|
|
2338
2343
|
} else key = toJS(pair, "", ctx);
|
|
2339
|
-
if (map
|
|
2340
|
-
map
|
|
2344
|
+
if (map.has(key)) throw new Error("Ordered maps must not include duplicate keys");
|
|
2345
|
+
map.set(key, value);
|
|
2341
2346
|
}
|
|
2342
|
-
return map
|
|
2347
|
+
return map;
|
|
2343
2348
|
}
|
|
2344
|
-
static from(schema
|
|
2345
|
-
const pairs
|
|
2346
|
-
const omap
|
|
2347
|
-
omap
|
|
2348
|
-
return omap
|
|
2349
|
+
static from(schema, iterable, ctx) {
|
|
2350
|
+
const pairs = createPairs(schema, iterable, ctx);
|
|
2351
|
+
const omap = new this();
|
|
2352
|
+
omap.items = pairs.items;
|
|
2353
|
+
return omap;
|
|
2349
2354
|
}
|
|
2350
2355
|
};
|
|
2351
2356
|
YAMLOMap.tag = "tag:yaml.org,2002:omap";
|
|
@@ -2355,14 +2360,14 @@ const omap = {
|
|
|
2355
2360
|
nodeClass: YAMLOMap,
|
|
2356
2361
|
default: false,
|
|
2357
2362
|
tag: "tag:yaml.org,2002:omap",
|
|
2358
|
-
resolve(seq
|
|
2359
|
-
const pairs
|
|
2363
|
+
resolve(seq, onError) {
|
|
2364
|
+
const pairs = resolvePairs(seq, onError);
|
|
2360
2365
|
const seenKeys = [];
|
|
2361
|
-
for (const { key } of pairs
|
|
2366
|
+
for (const { key } of pairs.items) if (isScalar$1(key)) if (seenKeys.includes(key.value)) onError(`Ordered maps must not include duplicate keys: ${key.value}`);
|
|
2362
2367
|
else seenKeys.push(key.value);
|
|
2363
|
-
return Object.assign(new YAMLOMap(), pairs
|
|
2368
|
+
return Object.assign(new YAMLOMap(), pairs);
|
|
2364
2369
|
},
|
|
2365
|
-
createNode: (schema
|
|
2370
|
+
createNode: (schema, iterable, ctx) => YAMLOMap.from(schema, iterable, ctx)
|
|
2366
2371
|
};
|
|
2367
2372
|
|
|
2368
2373
|
//#endregion
|
|
@@ -2390,7 +2395,7 @@ const falseTag = {
|
|
|
2390
2395
|
|
|
2391
2396
|
//#endregion
|
|
2392
2397
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/yaml-1.1/float.js
|
|
2393
|
-
const floatNaN
|
|
2398
|
+
const floatNaN = {
|
|
2394
2399
|
identify: (value) => typeof value === "number",
|
|
2395
2400
|
default: true,
|
|
2396
2401
|
tag: "tag:yaml.org,2002:float",
|
|
@@ -2398,7 +2403,7 @@ const floatNaN$1 = {
|
|
|
2398
2403
|
resolve: (str) => str.slice(-3).toLowerCase() === "nan" ? NaN : str[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
|
|
2399
2404
|
stringify: stringifyNumber
|
|
2400
2405
|
};
|
|
2401
|
-
const floatExp
|
|
2406
|
+
const floatExp = {
|
|
2402
2407
|
identify: (value) => typeof value === "number",
|
|
2403
2408
|
default: true,
|
|
2404
2409
|
tag: "tag:yaml.org,2002:float",
|
|
@@ -2410,7 +2415,7 @@ const floatExp$1 = {
|
|
|
2410
2415
|
return isFinite(num) ? num.toExponential() : stringifyNumber(node);
|
|
2411
2416
|
}
|
|
2412
2417
|
};
|
|
2413
|
-
const float
|
|
2418
|
+
const float = {
|
|
2414
2419
|
identify: (value) => typeof value === "number",
|
|
2415
2420
|
default: true,
|
|
2416
2421
|
tag: "tag:yaml.org,2002:float",
|
|
@@ -2446,8 +2451,8 @@ function intResolve(str, offset, radix, { intAsBigInt }) {
|
|
|
2446
2451
|
str = `0x${str}`;
|
|
2447
2452
|
break;
|
|
2448
2453
|
}
|
|
2449
|
-
const n
|
|
2450
|
-
return sign === "-" ? BigInt(-1) * n
|
|
2454
|
+
const n = BigInt(str);
|
|
2455
|
+
return sign === "-" ? BigInt(-1) * n : n;
|
|
2451
2456
|
}
|
|
2452
2457
|
const n = parseInt(str, radix);
|
|
2453
2458
|
return sign === "-" ? -1 * n : n;
|
|
@@ -2469,7 +2474,7 @@ const intBin = {
|
|
|
2469
2474
|
resolve: (str, _onError, opt) => intResolve(str, 2, 2, opt),
|
|
2470
2475
|
stringify: (node) => intStringify(node, 2, "0b")
|
|
2471
2476
|
};
|
|
2472
|
-
const intOct
|
|
2477
|
+
const intOct = {
|
|
2473
2478
|
identify: intIdentify,
|
|
2474
2479
|
default: true,
|
|
2475
2480
|
tag: "tag:yaml.org,2002:int",
|
|
@@ -2478,7 +2483,7 @@ const intOct$1 = {
|
|
|
2478
2483
|
resolve: (str, _onError, opt) => intResolve(str, 1, 8, opt),
|
|
2479
2484
|
stringify: (node) => intStringify(node, 8, "0")
|
|
2480
2485
|
};
|
|
2481
|
-
const int
|
|
2486
|
+
const int = {
|
|
2482
2487
|
identify: intIdentify,
|
|
2483
2488
|
default: true,
|
|
2484
2489
|
tag: "tag:yaml.org,2002:int",
|
|
@@ -2486,7 +2491,7 @@ const int$1 = {
|
|
|
2486
2491
|
resolve: (str, _onError, opt) => intResolve(str, 0, 10, opt),
|
|
2487
2492
|
stringify: stringifyNumber
|
|
2488
2493
|
};
|
|
2489
|
-
const intHex
|
|
2494
|
+
const intHex = {
|
|
2490
2495
|
identify: intIdentify,
|
|
2491
2496
|
default: true,
|
|
2492
2497
|
tag: "tag:yaml.org,2002:int",
|
|
@@ -2499,8 +2504,8 @@ const intHex$1 = {
|
|
|
2499
2504
|
//#endregion
|
|
2500
2505
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/yaml-1.1/set.js
|
|
2501
2506
|
var YAMLSet = class YAMLSet extends YAMLMap {
|
|
2502
|
-
constructor(schema
|
|
2503
|
-
super(schema
|
|
2507
|
+
constructor(schema) {
|
|
2508
|
+
super(schema);
|
|
2504
2509
|
this.tag = YAMLSet.tag;
|
|
2505
2510
|
}
|
|
2506
2511
|
add(key) {
|
|
@@ -2516,7 +2521,7 @@ var YAMLSet = class YAMLSet extends YAMLMap {
|
|
|
2516
2521
|
*/
|
|
2517
2522
|
get(key, keepPair) {
|
|
2518
2523
|
const pair = findPair(this.items, key);
|
|
2519
|
-
return !keepPair && isPair(pair) ? isScalar(pair.key) ? pair.key.value : pair.key : pair;
|
|
2524
|
+
return !keepPair && isPair(pair) ? isScalar$1(pair.key) ? pair.key.value : pair.key : pair;
|
|
2520
2525
|
}
|
|
2521
2526
|
set(key, value) {
|
|
2522
2527
|
if (typeof value !== "boolean") throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof value}`);
|
|
@@ -2532,14 +2537,14 @@ var YAMLSet = class YAMLSet extends YAMLMap {
|
|
|
2532
2537
|
if (this.hasAllNullValues(true)) return super.toString(Object.assign({}, ctx, { allNullValues: true }), onComment, onChompKeep);
|
|
2533
2538
|
else throw new Error("Set items must all have null values");
|
|
2534
2539
|
}
|
|
2535
|
-
static from(schema
|
|
2540
|
+
static from(schema, iterable, ctx) {
|
|
2536
2541
|
const { replacer } = ctx;
|
|
2537
|
-
const set
|
|
2542
|
+
const set = new this(schema);
|
|
2538
2543
|
if (iterable && Symbol.iterator in Object(iterable)) for (let value of iterable) {
|
|
2539
2544
|
if (typeof replacer === "function") value = replacer.call(iterable, value, value);
|
|
2540
|
-
set
|
|
2545
|
+
set.items.push(createPair(value, null, ctx));
|
|
2541
2546
|
}
|
|
2542
|
-
return set
|
|
2547
|
+
return set;
|
|
2543
2548
|
}
|
|
2544
2549
|
};
|
|
2545
2550
|
YAMLSet.tag = "tag:yaml.org,2002:set";
|
|
@@ -2549,12 +2554,12 @@ const set = {
|
|
|
2549
2554
|
nodeClass: YAMLSet,
|
|
2550
2555
|
default: false,
|
|
2551
2556
|
tag: "tag:yaml.org,2002:set",
|
|
2552
|
-
createNode: (schema
|
|
2553
|
-
resolve(map
|
|
2554
|
-
if (isMap(map
|
|
2557
|
+
createNode: (schema, iterable, ctx) => YAMLSet.from(schema, iterable, ctx),
|
|
2558
|
+
resolve(map, onError) {
|
|
2559
|
+
if (isMap(map)) if (map.hasAllNullValues(true)) return Object.assign(new YAMLSet(), map);
|
|
2555
2560
|
else onError("Set items must all have null values");
|
|
2556
2561
|
else onError("Expected a mapping for this tag");
|
|
2557
|
-
return map
|
|
2562
|
+
return map;
|
|
2558
2563
|
}
|
|
2559
2564
|
};
|
|
2560
2565
|
|
|
@@ -2565,7 +2570,7 @@ function parseSexagesimal(str, asBigInt) {
|
|
|
2565
2570
|
const sign = str[0];
|
|
2566
2571
|
const parts = sign === "-" || sign === "+" ? str.substring(1) : str;
|
|
2567
2572
|
const num = (n) => asBigInt ? BigInt(n) : Number(n);
|
|
2568
|
-
const res = parts.replace(/_/g, "").split(":").reduce((res
|
|
2573
|
+
const res = parts.replace(/_/g, "").split(":").reduce((res, p) => res * num(60) + num(p), num(0));
|
|
2569
2574
|
return sign === "-" ? num(-1) * res : res;
|
|
2570
2575
|
}
|
|
2571
2576
|
/**
|
|
@@ -2638,7 +2643,7 @@ const timestamp = {
|
|
|
2638
2643
|
|
|
2639
2644
|
//#endregion
|
|
2640
2645
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js
|
|
2641
|
-
const schema
|
|
2646
|
+
const schema = [
|
|
2642
2647
|
map,
|
|
2643
2648
|
seq,
|
|
2644
2649
|
string,
|
|
@@ -2646,12 +2651,12 @@ const schema$2 = [
|
|
|
2646
2651
|
trueTag,
|
|
2647
2652
|
falseTag,
|
|
2648
2653
|
intBin,
|
|
2649
|
-
intOct
|
|
2650
|
-
int
|
|
2651
|
-
intHex
|
|
2652
|
-
floatNaN
|
|
2653
|
-
floatExp
|
|
2654
|
-
float
|
|
2654
|
+
intOct,
|
|
2655
|
+
int,
|
|
2656
|
+
intHex,
|
|
2657
|
+
floatNaN,
|
|
2658
|
+
floatExp,
|
|
2659
|
+
float,
|
|
2655
2660
|
binary,
|
|
2656
2661
|
merge,
|
|
2657
2662
|
omap,
|
|
@@ -2665,26 +2670,26 @@ const schema$2 = [
|
|
|
2665
2670
|
//#endregion
|
|
2666
2671
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/tags.js
|
|
2667
2672
|
const schemas = new Map([
|
|
2668
|
-
["core", schema],
|
|
2673
|
+
["core", schema$2],
|
|
2669
2674
|
["failsafe", [
|
|
2670
2675
|
map,
|
|
2671
2676
|
seq,
|
|
2672
2677
|
string
|
|
2673
2678
|
]],
|
|
2674
2679
|
["json", schema$1],
|
|
2675
|
-
["yaml11", schema
|
|
2676
|
-
["yaml-1.1", schema
|
|
2680
|
+
["yaml11", schema],
|
|
2681
|
+
["yaml-1.1", schema]
|
|
2677
2682
|
]);
|
|
2678
2683
|
const tagsByName = {
|
|
2679
2684
|
binary,
|
|
2680
2685
|
bool: boolTag,
|
|
2681
|
-
float,
|
|
2682
|
-
floatExp,
|
|
2683
|
-
floatNaN,
|
|
2686
|
+
float: float$1,
|
|
2687
|
+
floatExp: floatExp$1,
|
|
2688
|
+
floatNaN: floatNaN$1,
|
|
2684
2689
|
floatTime,
|
|
2685
|
-
int,
|
|
2686
|
-
intHex,
|
|
2687
|
-
intOct,
|
|
2690
|
+
int: int$1,
|
|
2691
|
+
intHex: intHex$1,
|
|
2692
|
+
intOct: intOct$1,
|
|
2688
2693
|
intTime,
|
|
2689
2694
|
map,
|
|
2690
2695
|
merge,
|
|
@@ -2715,15 +2720,15 @@ function getTags(customTags, schemaName, addMergeTag) {
|
|
|
2715
2720
|
if (Array.isArray(customTags)) for (const tag of customTags) tags = tags.concat(tag);
|
|
2716
2721
|
else if (typeof customTags === "function") tags = customTags(tags.slice());
|
|
2717
2722
|
if (addMergeTag) tags = tags.concat(merge);
|
|
2718
|
-
return tags.reduce((tags
|
|
2723
|
+
return tags.reduce((tags, tag) => {
|
|
2719
2724
|
const tagObj = typeof tag === "string" ? tagsByName[tag] : tag;
|
|
2720
2725
|
if (!tagObj) {
|
|
2721
2726
|
const tagName = JSON.stringify(tag);
|
|
2722
2727
|
const keys = Object.keys(tagsByName).map((key) => JSON.stringify(key)).join(", ");
|
|
2723
2728
|
throw new Error(`Unknown custom tag ${tagName}; use one of ${keys}`);
|
|
2724
2729
|
}
|
|
2725
|
-
if (!tags
|
|
2726
|
-
return tags
|
|
2730
|
+
if (!tags.includes(tagObj)) tags.push(tagObj);
|
|
2731
|
+
return tags;
|
|
2727
2732
|
}, []);
|
|
2728
2733
|
}
|
|
2729
2734
|
|
|
@@ -2731,11 +2736,11 @@ function getTags(customTags, schemaName, addMergeTag) {
|
|
|
2731
2736
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/Schema.js
|
|
2732
2737
|
const sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
|
|
2733
2738
|
var Schema = class Schema {
|
|
2734
|
-
constructor({ compat, customTags, merge
|
|
2739
|
+
constructor({ compat, customTags, merge, resolveKnownTags, schema, sortMapEntries, toStringDefaults }) {
|
|
2735
2740
|
this.compat = Array.isArray(compat) ? getTags(compat, "compat") : compat ? getTags(null, compat) : null;
|
|
2736
|
-
this.name = typeof schema
|
|
2741
|
+
this.name = typeof schema === "string" && schema || "core";
|
|
2737
2742
|
this.knownTags = resolveKnownTags ? coreKnownTags : {};
|
|
2738
|
-
this.tags = getTags(customTags, this.name, merge
|
|
2743
|
+
this.tags = getTags(customTags, this.name, merge);
|
|
2739
2744
|
this.toStringOptions = toStringDefaults ?? null;
|
|
2740
2745
|
Object.defineProperty(this, MAP, { value: map });
|
|
2741
2746
|
Object.defineProperty(this, SCALAR$1, { value: string });
|
|
@@ -2911,7 +2916,7 @@ var Document = class Document {
|
|
|
2911
2916
|
sourceObjects
|
|
2912
2917
|
};
|
|
2913
2918
|
const node = createNode(value, tag, ctx);
|
|
2914
|
-
if (flow && isCollection(node)) node.flow = true;
|
|
2919
|
+
if (flow && isCollection$1(node)) node.flow = true;
|
|
2915
2920
|
setAnchors();
|
|
2916
2921
|
return node;
|
|
2917
2922
|
}
|
|
@@ -2947,7 +2952,7 @@ var Document = class Document {
|
|
|
2947
2952
|
* `true` (collections are always returned intact).
|
|
2948
2953
|
*/
|
|
2949
2954
|
get(key, keepScalar) {
|
|
2950
|
-
return isCollection(this.contents) ? this.contents.get(key, keepScalar) : void 0;
|
|
2955
|
+
return isCollection$1(this.contents) ? this.contents.get(key, keepScalar) : void 0;
|
|
2951
2956
|
}
|
|
2952
2957
|
/**
|
|
2953
2958
|
* Returns item at `path`, or `undefined` if not found. By default unwraps
|
|
@@ -2955,21 +2960,21 @@ var Document = class Document {
|
|
|
2955
2960
|
* `true` (collections are always returned intact).
|
|
2956
2961
|
*/
|
|
2957
2962
|
getIn(path, keepScalar) {
|
|
2958
|
-
if (isEmptyPath(path)) return !keepScalar && isScalar(this.contents) ? this.contents.value : this.contents;
|
|
2959
|
-
return isCollection(this.contents) ? this.contents.getIn(path, keepScalar) : void 0;
|
|
2963
|
+
if (isEmptyPath(path)) return !keepScalar && isScalar$1(this.contents) ? this.contents.value : this.contents;
|
|
2964
|
+
return isCollection$1(this.contents) ? this.contents.getIn(path, keepScalar) : void 0;
|
|
2960
2965
|
}
|
|
2961
2966
|
/**
|
|
2962
2967
|
* Checks if the document includes a value with the key `key`.
|
|
2963
2968
|
*/
|
|
2964
2969
|
has(key) {
|
|
2965
|
-
return isCollection(this.contents) ? this.contents.has(key) : false;
|
|
2970
|
+
return isCollection$1(this.contents) ? this.contents.has(key) : false;
|
|
2966
2971
|
}
|
|
2967
2972
|
/**
|
|
2968
2973
|
* Checks if the document includes a value at `path`.
|
|
2969
2974
|
*/
|
|
2970
2975
|
hasIn(path) {
|
|
2971
2976
|
if (isEmptyPath(path)) return this.contents !== void 0;
|
|
2972
|
-
return isCollection(this.contents) ? this.contents.hasIn(path) : false;
|
|
2977
|
+
return isCollection$1(this.contents) ? this.contents.hasIn(path) : false;
|
|
2973
2978
|
}
|
|
2974
2979
|
/**
|
|
2975
2980
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -3039,7 +3044,7 @@ var Document = class Document {
|
|
|
3039
3044
|
maxAliasCount: typeof maxAliasCount === "number" ? maxAliasCount : 100
|
|
3040
3045
|
};
|
|
3041
3046
|
const res = toJS(this.contents, jsonArg ?? "", ctx);
|
|
3042
|
-
if (typeof onAnchor === "function") for (const { count, res
|
|
3047
|
+
if (typeof onAnchor === "function") for (const { count, res } of ctx.anchors.values()) onAnchor(res, count);
|
|
3043
3048
|
return typeof reviver === "function" ? applyReviver(reviver, { "": res }, "", res) : res;
|
|
3044
3049
|
}
|
|
3045
3050
|
/**
|
|
@@ -3067,7 +3072,7 @@ var Document = class Document {
|
|
|
3067
3072
|
}
|
|
3068
3073
|
};
|
|
3069
3074
|
function assertCollection(contents) {
|
|
3070
|
-
if (isCollection(contents)) return true;
|
|
3075
|
+
if (isCollection$1(contents)) return true;
|
|
3071
3076
|
throw new Error("Expected a YAML collection as document contents");
|
|
3072
3077
|
}
|
|
3073
3078
|
|
|
@@ -3265,15 +3270,15 @@ function flowIndentCheck(indent, fc, onError) {
|
|
|
3265
3270
|
function mapIncludes(ctx, items, search) {
|
|
3266
3271
|
const { uniqueKeys } = ctx.options;
|
|
3267
3272
|
if (uniqueKeys === false) return false;
|
|
3268
|
-
const isEqual = typeof uniqueKeys === "function" ? uniqueKeys : (a, b) => a === b || isScalar(a) && isScalar(b) && a.value === b.value;
|
|
3273
|
+
const isEqual = typeof uniqueKeys === "function" ? uniqueKeys : (a, b) => a === b || isScalar$1(a) && isScalar$1(b) && a.value === b.value;
|
|
3269
3274
|
return items.some((pair) => isEqual(pair.key, search));
|
|
3270
3275
|
}
|
|
3271
3276
|
|
|
3272
3277
|
//#endregion
|
|
3273
3278
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/resolve-block-map.js
|
|
3274
3279
|
const startColMsg = "All mapping items must start at the same column";
|
|
3275
|
-
function resolveBlockMap({ composeNode
|
|
3276
|
-
const map
|
|
3280
|
+
function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError, tag) {
|
|
3281
|
+
const map = new (tag?.nodeClass ?? YAMLMap)(ctx.schema);
|
|
3277
3282
|
if (ctx.atRoot) ctx.atRoot = false;
|
|
3278
3283
|
let offset = bm.offset;
|
|
3279
3284
|
let commentEnd = null;
|
|
@@ -3295,18 +3300,18 @@ function resolveBlockMap({ composeNode: composeNode$1, composeEmptyNode: compose
|
|
|
3295
3300
|
}
|
|
3296
3301
|
if (!keyProps.anchor && !keyProps.tag && !sep) {
|
|
3297
3302
|
commentEnd = keyProps.end;
|
|
3298
|
-
if (keyProps.comment) if (map
|
|
3299
|
-
else map
|
|
3303
|
+
if (keyProps.comment) if (map.comment) map.comment += "\n" + keyProps.comment;
|
|
3304
|
+
else map.comment = keyProps.comment;
|
|
3300
3305
|
continue;
|
|
3301
3306
|
}
|
|
3302
3307
|
if (keyProps.newlineAfterProp || containsNewline(key)) onError(key ?? start[start.length - 1], "MULTILINE_IMPLICIT_KEY", "Implicit keys need to be on a single line");
|
|
3303
3308
|
} else if (keyProps.found?.indent !== bm.indent) onError(offset, "BAD_INDENT", startColMsg);
|
|
3304
3309
|
ctx.atKey = true;
|
|
3305
3310
|
const keyStart = keyProps.end;
|
|
3306
|
-
const keyNode = key ? composeNode
|
|
3311
|
+
const keyNode = key ? composeNode(ctx, key, keyProps, onError) : composeEmptyNode(ctx, keyStart, start, null, keyProps, onError);
|
|
3307
3312
|
if (ctx.schema.compat) flowIndentCheck(bm.indent, key, onError);
|
|
3308
3313
|
ctx.atKey = false;
|
|
3309
|
-
if (mapIncludes(ctx, map
|
|
3314
|
+
if (mapIncludes(ctx, map.items, keyNode)) onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
|
|
3310
3315
|
const valueProps = resolveProps(sep ?? [], {
|
|
3311
3316
|
indicator: "map-value-ind",
|
|
3312
3317
|
next: value,
|
|
@@ -3321,34 +3326,34 @@ function resolveBlockMap({ composeNode: composeNode$1, composeEmptyNode: compose
|
|
|
3321
3326
|
if (value?.type === "block-map" && !valueProps.hasNewline) onError(offset, "BLOCK_AS_IMPLICIT_KEY", "Nested mappings are not allowed in compact mappings");
|
|
3322
3327
|
if (ctx.options.strict && keyProps.start < valueProps.found.offset - 1024) onError(keyNode.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key");
|
|
3323
3328
|
}
|
|
3324
|
-
const valueNode = value ? composeNode
|
|
3329
|
+
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset, sep, null, valueProps, onError);
|
|
3325
3330
|
if (ctx.schema.compat) flowIndentCheck(bm.indent, value, onError);
|
|
3326
3331
|
offset = valueNode.range[2];
|
|
3327
3332
|
const pair = new Pair(keyNode, valueNode);
|
|
3328
3333
|
if (ctx.options.keepSourceTokens) pair.srcToken = collItem;
|
|
3329
|
-
map
|
|
3334
|
+
map.items.push(pair);
|
|
3330
3335
|
} else {
|
|
3331
3336
|
if (implicitKey) onError(keyNode.range, "MISSING_CHAR", "Implicit map keys need to be followed by map values");
|
|
3332
3337
|
if (valueProps.comment) if (keyNode.comment) keyNode.comment += "\n" + valueProps.comment;
|
|
3333
3338
|
else keyNode.comment = valueProps.comment;
|
|
3334
3339
|
const pair = new Pair(keyNode);
|
|
3335
3340
|
if (ctx.options.keepSourceTokens) pair.srcToken = collItem;
|
|
3336
|
-
map
|
|
3341
|
+
map.items.push(pair);
|
|
3337
3342
|
}
|
|
3338
3343
|
}
|
|
3339
3344
|
if (commentEnd && commentEnd < offset) onError(commentEnd, "IMPOSSIBLE", "Map comment with trailing content");
|
|
3340
|
-
map
|
|
3345
|
+
map.range = [
|
|
3341
3346
|
bm.offset,
|
|
3342
3347
|
offset,
|
|
3343
3348
|
commentEnd ?? offset
|
|
3344
3349
|
];
|
|
3345
|
-
return map
|
|
3350
|
+
return map;
|
|
3346
3351
|
}
|
|
3347
3352
|
|
|
3348
3353
|
//#endregion
|
|
3349
3354
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/resolve-block-seq.js
|
|
3350
|
-
function resolveBlockSeq({ composeNode
|
|
3351
|
-
const seq
|
|
3355
|
+
function resolveBlockSeq({ composeNode, composeEmptyNode }, ctx, bs, onError, tag) {
|
|
3356
|
+
const seq = new (tag?.nodeClass ?? YAMLSeq)(ctx.schema);
|
|
3352
3357
|
if (ctx.atRoot) ctx.atRoot = false;
|
|
3353
3358
|
if (ctx.atKey) ctx.atKey = false;
|
|
3354
3359
|
let offset = bs.offset;
|
|
@@ -3366,20 +3371,20 @@ function resolveBlockSeq({ composeNode: composeNode$1, composeEmptyNode: compose
|
|
|
3366
3371
|
else onError(offset, "MISSING_CHAR", "Sequence item without - indicator");
|
|
3367
3372
|
else {
|
|
3368
3373
|
commentEnd = props.end;
|
|
3369
|
-
if (props.comment) seq
|
|
3374
|
+
if (props.comment) seq.comment = props.comment;
|
|
3370
3375
|
continue;
|
|
3371
3376
|
}
|
|
3372
|
-
const node = value ? composeNode
|
|
3377
|
+
const node = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, start, null, props, onError);
|
|
3373
3378
|
if (ctx.schema.compat) flowIndentCheck(bs.indent, value, onError);
|
|
3374
3379
|
offset = node.range[2];
|
|
3375
|
-
seq
|
|
3380
|
+
seq.items.push(node);
|
|
3376
3381
|
}
|
|
3377
|
-
seq
|
|
3382
|
+
seq.range = [
|
|
3378
3383
|
bs.offset,
|
|
3379
3384
|
offset,
|
|
3380
3385
|
commentEnd ?? offset
|
|
3381
3386
|
];
|
|
3382
|
-
return seq
|
|
3387
|
+
return seq;
|
|
3383
3388
|
}
|
|
3384
3389
|
|
|
3385
3390
|
//#endregion
|
|
@@ -3422,10 +3427,10 @@ function resolveEnd(end, offset, reqSpace, onError) {
|
|
|
3422
3427
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/resolve-flow-collection.js
|
|
3423
3428
|
const blockMsg = "Block collections are not allowed within flow collections";
|
|
3424
3429
|
const isBlock = (token) => token && (token.type === "block-map" || token.type === "block-seq");
|
|
3425
|
-
function resolveFlowCollection({ composeNode
|
|
3426
|
-
const isMap
|
|
3427
|
-
const fcName = isMap
|
|
3428
|
-
const coll = new (tag?.nodeClass ?? (isMap
|
|
3430
|
+
function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onError, tag) {
|
|
3431
|
+
const isMap = fc.start.source === "{";
|
|
3432
|
+
const fcName = isMap ? "flow map" : "flow sequence";
|
|
3433
|
+
const coll = new (tag?.nodeClass ?? (isMap ? YAMLMap : YAMLSeq))(ctx.schema);
|
|
3429
3434
|
coll.flow = true;
|
|
3430
3435
|
const atRoot = ctx.atRoot;
|
|
3431
3436
|
if (atRoot) ctx.atRoot = false;
|
|
@@ -3452,7 +3457,7 @@ function resolveFlowCollection({ composeNode: composeNode$1, composeEmptyNode: c
|
|
|
3452
3457
|
offset = props.end;
|
|
3453
3458
|
continue;
|
|
3454
3459
|
}
|
|
3455
|
-
if (!isMap
|
|
3460
|
+
if (!isMap && ctx.options.strict && containsNewline(key)) onError(key, "MULTILINE_IMPLICIT_KEY", "Implicit keys of flow sequence pairs need to be on a single line");
|
|
3456
3461
|
}
|
|
3457
3462
|
if (i === 0) {
|
|
3458
3463
|
if (props.comma) onError(props.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${fcName}`);
|
|
@@ -3477,15 +3482,15 @@ function resolveFlowCollection({ composeNode: composeNode$1, composeEmptyNode: c
|
|
|
3477
3482
|
}
|
|
3478
3483
|
}
|
|
3479
3484
|
}
|
|
3480
|
-
if (!isMap
|
|
3481
|
-
const valueNode = value ? composeNode
|
|
3485
|
+
if (!isMap && !sep && !props.found) {
|
|
3486
|
+
const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep, null, props, onError);
|
|
3482
3487
|
coll.items.push(valueNode);
|
|
3483
3488
|
offset = valueNode.range[2];
|
|
3484
3489
|
if (isBlock(value)) onError(valueNode.range, "BLOCK_IN_FLOW", blockMsg);
|
|
3485
3490
|
} else {
|
|
3486
3491
|
ctx.atKey = true;
|
|
3487
3492
|
const keyStart = props.end;
|
|
3488
|
-
const keyNode = key ? composeNode
|
|
3493
|
+
const keyNode = key ? composeNode(ctx, key, props, onError) : composeEmptyNode(ctx, keyStart, start, null, props, onError);
|
|
3489
3494
|
if (isBlock(key)) onError(keyNode.range, "BLOCK_IN_FLOW", blockMsg);
|
|
3490
3495
|
ctx.atKey = false;
|
|
3491
3496
|
const valueProps = resolveProps(sep ?? [], {
|
|
@@ -3498,7 +3503,7 @@ function resolveFlowCollection({ composeNode: composeNode$1, composeEmptyNode: c
|
|
|
3498
3503
|
startOnNewline: false
|
|
3499
3504
|
});
|
|
3500
3505
|
if (valueProps.found) {
|
|
3501
|
-
if (!isMap
|
|
3506
|
+
if (!isMap && !props.found && ctx.options.strict) {
|
|
3502
3507
|
if (sep) for (const st of sep) {
|
|
3503
3508
|
if (st === valueProps.found) break;
|
|
3504
3509
|
if (st.type === "newline") {
|
|
@@ -3510,33 +3515,33 @@ function resolveFlowCollection({ composeNode: composeNode$1, composeEmptyNode: c
|
|
|
3510
3515
|
}
|
|
3511
3516
|
} else if (value) if ("source" in value && value.source?.[0] === ":") onError(value, "MISSING_CHAR", `Missing space after : in ${fcName}`);
|
|
3512
3517
|
else onError(valueProps.start, "MISSING_CHAR", `Missing , or : between ${fcName} items`);
|
|
3513
|
-
const valueNode = value ? composeNode
|
|
3518
|
+
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep, null, valueProps, onError) : null;
|
|
3514
3519
|
if (valueNode) {
|
|
3515
3520
|
if (isBlock(value)) onError(valueNode.range, "BLOCK_IN_FLOW", blockMsg);
|
|
3516
3521
|
} else if (valueProps.comment) if (keyNode.comment) keyNode.comment += "\n" + valueProps.comment;
|
|
3517
3522
|
else keyNode.comment = valueProps.comment;
|
|
3518
3523
|
const pair = new Pair(keyNode, valueNode);
|
|
3519
3524
|
if (ctx.options.keepSourceTokens) pair.srcToken = collItem;
|
|
3520
|
-
if (isMap
|
|
3521
|
-
const map
|
|
3522
|
-
if (mapIncludes(ctx, map
|
|
3523
|
-
map
|
|
3525
|
+
if (isMap) {
|
|
3526
|
+
const map = coll;
|
|
3527
|
+
if (mapIncludes(ctx, map.items, keyNode)) onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
|
|
3528
|
+
map.items.push(pair);
|
|
3524
3529
|
} else {
|
|
3525
|
-
const map
|
|
3526
|
-
map
|
|
3527
|
-
map
|
|
3530
|
+
const map = new YAMLMap(ctx.schema);
|
|
3531
|
+
map.flow = true;
|
|
3532
|
+
map.items.push(pair);
|
|
3528
3533
|
const endRange = (valueNode ?? keyNode).range;
|
|
3529
|
-
map
|
|
3534
|
+
map.range = [
|
|
3530
3535
|
keyNode.range[0],
|
|
3531
3536
|
endRange[1],
|
|
3532
3537
|
endRange[2]
|
|
3533
3538
|
];
|
|
3534
|
-
coll.items.push(map
|
|
3539
|
+
coll.items.push(map);
|
|
3535
3540
|
}
|
|
3536
3541
|
offset = valueNode ? valueNode.range[2] : valueProps.end;
|
|
3537
3542
|
}
|
|
3538
3543
|
}
|
|
3539
|
-
const expectedEnd = isMap
|
|
3544
|
+
const expectedEnd = isMap ? "}" : "]";
|
|
3540
3545
|
const [ce, ...ee] = fc.end;
|
|
3541
3546
|
let cePos = offset;
|
|
3542
3547
|
if (ce?.source === expectedEnd) cePos = ce.offset + ce.source.length;
|
|
@@ -3565,8 +3570,8 @@ function resolveFlowCollection({ composeNode: composeNode$1, composeEmptyNode: c
|
|
|
3565
3570
|
|
|
3566
3571
|
//#endregion
|
|
3567
3572
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/compose-collection.js
|
|
3568
|
-
function resolveCollection(CN
|
|
3569
|
-
const coll = token.type === "block-map" ? resolveBlockMap(CN
|
|
3573
|
+
function resolveCollection(CN, ctx, token, onError, tagName, tag) {
|
|
3574
|
+
const coll = token.type === "block-map" ? resolveBlockMap(CN, ctx, token, onError, tag) : token.type === "block-seq" ? resolveBlockSeq(CN, ctx, token, onError, tag) : resolveFlowCollection(CN, ctx, token, onError, tag);
|
|
3570
3575
|
const Coll = coll.constructor;
|
|
3571
3576
|
if (tagName === "!" || tagName === Coll.tagName) {
|
|
3572
3577
|
coll.tag = Coll.tagName;
|
|
@@ -3575,7 +3580,7 @@ function resolveCollection(CN$1, ctx, token, onError, tagName, tag) {
|
|
|
3575
3580
|
if (tagName) coll.tag = tagName;
|
|
3576
3581
|
return coll;
|
|
3577
3582
|
}
|
|
3578
|
-
function composeCollection(CN
|
|
3583
|
+
function composeCollection(CN, ctx, token, props, onError) {
|
|
3579
3584
|
const tagToken = props.tag;
|
|
3580
3585
|
const tagName = !tagToken ? null : ctx.directives.tagName(tagToken.source, (msg) => onError(tagToken, "TAG_RESOLVE_FAILED", msg));
|
|
3581
3586
|
if (token.type === "block-seq") {
|
|
@@ -3584,7 +3589,7 @@ function composeCollection(CN$1, ctx, token, props, onError) {
|
|
|
3584
3589
|
if (lastProp && (!nl || nl.offset < lastProp.offset)) onError(lastProp, "MISSING_CHAR", "Missing newline after block sequence props");
|
|
3585
3590
|
}
|
|
3586
3591
|
const expType = token.type === "block-map" ? "map" : token.type === "block-seq" ? "seq" : token.start.source === "{" ? "map" : "seq";
|
|
3587
|
-
if (!tagToken || !tagName || tagName === "!" || tagName === YAMLMap.tagName && expType === "map" || tagName === YAMLSeq.tagName && expType === "seq") return resolveCollection(CN
|
|
3592
|
+
if (!tagToken || !tagName || tagName === "!" || tagName === YAMLMap.tagName && expType === "map" || tagName === YAMLSeq.tagName && expType === "seq") return resolveCollection(CN, ctx, token, onError, tagName);
|
|
3588
3593
|
let tag = ctx.schema.tags.find((t) => t.tag === tagName && t.collection === expType);
|
|
3589
3594
|
if (!tag) {
|
|
3590
3595
|
const kt = ctx.schema.knownTags[tagName];
|
|
@@ -3594,10 +3599,10 @@ function composeCollection(CN$1, ctx, token, props, onError) {
|
|
|
3594
3599
|
} else {
|
|
3595
3600
|
if (kt) onError(tagToken, "BAD_COLLECTION_TYPE", `${kt.tag} used for ${expType} collection, but expects ${kt.collection ?? "scalar"}`, true);
|
|
3596
3601
|
else onError(tagToken, "TAG_RESOLVE_FAILED", `Unresolved tag: ${tagName}`, true);
|
|
3597
|
-
return resolveCollection(CN
|
|
3602
|
+
return resolveCollection(CN, ctx, token, onError, tagName);
|
|
3598
3603
|
}
|
|
3599
3604
|
}
|
|
3600
|
-
const coll = resolveCollection(CN
|
|
3605
|
+
const coll = resolveCollection(CN, ctx, token, onError, tagName, tag);
|
|
3601
3606
|
const res = tag.resolve?.(coll, (msg) => onError(tagToken, "TAG_RESOLVE_FAILED", msg), ctx.options) ?? coll;
|
|
3602
3607
|
const node = isNode(res) ? res : new Scalar(res);
|
|
3603
3608
|
node.range = coll.range;
|
|
@@ -3630,17 +3635,17 @@ function resolveBlockScalar(ctx, scalar, onError) {
|
|
|
3630
3635
|
else break;
|
|
3631
3636
|
}
|
|
3632
3637
|
if (chompStart === 0) {
|
|
3633
|
-
const value
|
|
3634
|
-
let end
|
|
3635
|
-
if (scalar.source) end
|
|
3638
|
+
const value = header.chomp === "+" && lines.length > 0 ? "\n".repeat(Math.max(1, lines.length - 1)) : "";
|
|
3639
|
+
let end = start + header.length;
|
|
3640
|
+
if (scalar.source) end += scalar.source.length;
|
|
3636
3641
|
return {
|
|
3637
|
-
value
|
|
3642
|
+
value,
|
|
3638
3643
|
type,
|
|
3639
3644
|
comment: header.comment,
|
|
3640
3645
|
range: [
|
|
3641
3646
|
start,
|
|
3642
|
-
end
|
|
3643
|
-
end
|
|
3647
|
+
end,
|
|
3648
|
+
end
|
|
3644
3649
|
]
|
|
3645
3650
|
};
|
|
3646
3651
|
}
|
|
@@ -3862,8 +3867,8 @@ function foldLines(source) {
|
|
|
3862
3867
|
*/
|
|
3863
3868
|
let first, line;
|
|
3864
3869
|
try {
|
|
3865
|
-
first = new RegExp("(.*?)(?<![ ])[ ]*\r?\n", "sy");
|
|
3866
|
-
line = new RegExp("[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?\n", "sy");
|
|
3870
|
+
first = /* @__PURE__ */ new RegExp("(.*?)(?<![ ])[ ]*\r?\n", "sy");
|
|
3871
|
+
line = /* @__PURE__ */ new RegExp("[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?\n", "sy");
|
|
3867
3872
|
} catch {
|
|
3868
3873
|
first = /(.*?)[ \t]*\r?\n/sy;
|
|
3869
3874
|
line = /[ \t]*(.*?)[ \t]*\r?\n/sy;
|
|
@@ -3993,7 +3998,7 @@ function composeScalar(ctx, token, tagToken, onError) {
|
|
|
3993
3998
|
let scalar;
|
|
3994
3999
|
try {
|
|
3995
4000
|
const res = tag.resolve(value, (msg) => onError(tagToken ?? token, "TAG_RESOLVE_FAILED", msg), ctx.options);
|
|
3996
|
-
scalar = isScalar(res) ? res : new Scalar(res);
|
|
4001
|
+
scalar = isScalar$1(res) ? res : new Scalar(res);
|
|
3997
4002
|
} catch (error) {
|
|
3998
4003
|
const msg = error instanceof Error ? error.message : String(error);
|
|
3999
4004
|
onError(tagToken ?? token, "TAG_RESOLVE_FAILED", msg);
|
|
@@ -4007,27 +4012,27 @@ function composeScalar(ctx, token, tagToken, onError) {
|
|
|
4007
4012
|
if (comment) scalar.comment = comment;
|
|
4008
4013
|
return scalar;
|
|
4009
4014
|
}
|
|
4010
|
-
function findScalarTagByName(schema
|
|
4011
|
-
if (tagName === "!") return schema
|
|
4015
|
+
function findScalarTagByName(schema, value, tagName, tagToken, onError) {
|
|
4016
|
+
if (tagName === "!") return schema[SCALAR$1];
|
|
4012
4017
|
const matchWithTest = [];
|
|
4013
|
-
for (const tag of schema
|
|
4018
|
+
for (const tag of schema.tags) if (!tag.collection && tag.tag === tagName) if (tag.default && tag.test) matchWithTest.push(tag);
|
|
4014
4019
|
else return tag;
|
|
4015
4020
|
for (const tag of matchWithTest) if (tag.test?.test(value)) return tag;
|
|
4016
|
-
const kt = schema
|
|
4021
|
+
const kt = schema.knownTags[tagName];
|
|
4017
4022
|
if (kt && !kt.collection) {
|
|
4018
|
-
schema
|
|
4023
|
+
schema.tags.push(Object.assign({}, kt, {
|
|
4019
4024
|
default: false,
|
|
4020
4025
|
test: void 0
|
|
4021
4026
|
}));
|
|
4022
4027
|
return kt;
|
|
4023
4028
|
}
|
|
4024
4029
|
onError(tagToken, "TAG_RESOLVE_FAILED", `Unresolved tag: ${tagName}`, tagName !== "tag:yaml.org,2002:str");
|
|
4025
|
-
return schema
|
|
4030
|
+
return schema[SCALAR$1];
|
|
4026
4031
|
}
|
|
4027
|
-
function findScalarTagByTest({ atKey, directives, schema
|
|
4028
|
-
const tag = schema
|
|
4029
|
-
if (schema
|
|
4030
|
-
const compat = schema
|
|
4032
|
+
function findScalarTagByTest({ atKey, directives, schema }, value, token, onError) {
|
|
4033
|
+
const tag = schema.tags.find((tag) => (tag.default === true || atKey && tag.default === "key") && tag.test?.test(value)) || schema[SCALAR$1];
|
|
4034
|
+
if (schema.compat) {
|
|
4035
|
+
const compat = schema.compat.find((tag) => tag.default && tag.test?.test(value)) ?? schema[SCALAR$1];
|
|
4031
4036
|
if (tag.tag !== compat.tag) onError(token, "TAG_RESOLVE_FAILED", `Value may be parsed as either ${directives.tagString(tag.tag)} or ${directives.tagString(compat.tag)}`, true);
|
|
4032
4037
|
}
|
|
4033
4038
|
return tag;
|
|
@@ -4093,7 +4098,7 @@ function composeNode(ctx, token, props, onError) {
|
|
|
4093
4098
|
isSrcToken = false;
|
|
4094
4099
|
}
|
|
4095
4100
|
if (anchor && node.anchor === "") onError(anchor, "BAD_ALIAS", "Anchor cannot be an empty string");
|
|
4096
|
-
if (atKey && ctx.options.stringKeys && (!isScalar(node) || typeof node.value !== "string" || node.tag && node.tag !== "tag:yaml.org,2002:str")) onError(tag ?? token, "NON_STRING_KEY", "With stringKeys, all keys must be strings");
|
|
4101
|
+
if (atKey && ctx.options.stringKeys && (!isScalar$1(node) || typeof node.value !== "string" || node.tag && node.tag !== "tag:yaml.org,2002:str")) onError(tag ?? token, "NON_STRING_KEY", "With stringKeys, all keys must be strings");
|
|
4097
4102
|
if (spaceBefore) node.spaceBefore = true;
|
|
4098
4103
|
if (comment) if (token.type === "scalar" && token.source === "") node.comment = comment;
|
|
4099
4104
|
else node.commentBefore = comment;
|
|
@@ -4234,7 +4239,7 @@ var Composer = class {
|
|
|
4234
4239
|
const dc = doc.contents;
|
|
4235
4240
|
if (afterDoc) doc.comment = doc.comment ? `${doc.comment}\n${comment}` : comment;
|
|
4236
4241
|
else if (afterEmptyLine || doc.directives.docStart || !dc) doc.commentBefore = comment;
|
|
4237
|
-
else if (isCollection(dc) && !dc.flow && dc.items.length > 0) {
|
|
4242
|
+
else if (isCollection$1(dc) && !dc.flow && dc.items.length > 0) {
|
|
4238
4243
|
let it = dc.items[0];
|
|
4239
4244
|
if (isPair(it)) it = it.key;
|
|
4240
4245
|
const cb = it.commentBefore;
|
|
@@ -4696,7 +4701,7 @@ const REMOVE = Symbol("remove item");
|
|
|
4696
4701
|
* visitor is called on item entry, next visitors are called after handling
|
|
4697
4702
|
* a non-empty `key` and when exiting the item.
|
|
4698
4703
|
*/
|
|
4699
|
-
function visit
|
|
4704
|
+
function visit(cst, visitor) {
|
|
4700
4705
|
if ("type" in cst && cst.type === "document") cst = {
|
|
4701
4706
|
start: cst.start,
|
|
4702
4707
|
value: cst.value
|
|
@@ -4704,13 +4709,13 @@ function visit$1(cst, visitor) {
|
|
|
4704
4709
|
_visit(Object.freeze([]), cst, visitor);
|
|
4705
4710
|
}
|
|
4706
4711
|
/** Terminate visit traversal completely */
|
|
4707
|
-
visit
|
|
4712
|
+
visit.BREAK = BREAK;
|
|
4708
4713
|
/** Do not visit the children of the current item */
|
|
4709
|
-
visit
|
|
4714
|
+
visit.SKIP = SKIP;
|
|
4710
4715
|
/** Remove the current item */
|
|
4711
|
-
visit
|
|
4716
|
+
visit.REMOVE = REMOVE;
|
|
4712
4717
|
/** Find the item at `path` from `cst` as the root */
|
|
4713
|
-
visit
|
|
4718
|
+
visit.itemAtPath = (cst, path) => {
|
|
4714
4719
|
let item = cst;
|
|
4715
4720
|
for (const [field, index] of path) {
|
|
4716
4721
|
const tok = item?.[field];
|
|
@@ -4724,8 +4729,8 @@ visit$1.itemAtPath = (cst, path) => {
|
|
|
4724
4729
|
*
|
|
4725
4730
|
* Throws an error if the collection is not found, which should never happen if the item itself exists.
|
|
4726
4731
|
*/
|
|
4727
|
-
visit
|
|
4728
|
-
const parent = visit
|
|
4732
|
+
visit.parentCollection = (cst, path) => {
|
|
4733
|
+
const parent = visit.itemAtPath(cst, path.slice(0, -1));
|
|
4729
4734
|
const field = path[path.length - 1][0];
|
|
4730
4735
|
const coll = parent?.[field];
|
|
4731
4736
|
if (coll && "items" in coll) return coll;
|
|
@@ -4754,20 +4759,20 @@ function _visit(path, item, visitor) {
|
|
|
4754
4759
|
|
|
4755
4760
|
//#endregion
|
|
4756
4761
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/parse/cst.js
|
|
4757
|
-
var cst_exports = /* @__PURE__ */
|
|
4758
|
-
BOM: () =>
|
|
4759
|
-
DOCUMENT: () =>
|
|
4760
|
-
FLOW_END: () =>
|
|
4761
|
-
SCALAR: () =>
|
|
4762
|
+
var cst_exports = /* @__PURE__ */ __exportAll({
|
|
4763
|
+
BOM: () => "",
|
|
4764
|
+
DOCUMENT: () => "",
|
|
4765
|
+
FLOW_END: () => "",
|
|
4766
|
+
SCALAR: () => "",
|
|
4762
4767
|
createScalarToken: () => createScalarToken,
|
|
4763
|
-
isCollection: () => isCollection
|
|
4764
|
-
isScalar: () => isScalar
|
|
4768
|
+
isCollection: () => isCollection,
|
|
4769
|
+
isScalar: () => isScalar,
|
|
4765
4770
|
prettyToken: () => prettyToken,
|
|
4766
4771
|
resolveAsScalar: () => resolveAsScalar,
|
|
4767
4772
|
setScalarValue: () => setScalarValue,
|
|
4768
4773
|
stringify: () => stringify$1,
|
|
4769
4774
|
tokenType: () => tokenType,
|
|
4770
|
-
visit: () => visit
|
|
4775
|
+
visit: () => visit
|
|
4771
4776
|
});
|
|
4772
4777
|
/** The byte order mark */
|
|
4773
4778
|
const BOM = "";
|
|
@@ -4778,27 +4783,27 @@ const FLOW_END = "";
|
|
|
4778
4783
|
/** Next token is a scalar value */
|
|
4779
4784
|
const SCALAR = "";
|
|
4780
4785
|
/** @returns `true` if `token` is a flow or block collection */
|
|
4781
|
-
const isCollection
|
|
4786
|
+
const isCollection = (token) => !!token && "items" in token;
|
|
4782
4787
|
/** @returns `true` if `token` is a flow or block scalar; not an alias */
|
|
4783
|
-
const isScalar
|
|
4788
|
+
const isScalar = (token) => !!token && (token.type === "scalar" || token.type === "single-quoted-scalar" || token.type === "double-quoted-scalar" || token.type === "block-scalar");
|
|
4784
4789
|
/* istanbul ignore next */
|
|
4785
4790
|
/** Get a printable representation of a lexer token */
|
|
4786
4791
|
function prettyToken(token) {
|
|
4787
4792
|
switch (token) {
|
|
4788
|
-
case
|
|
4789
|
-
case
|
|
4790
|
-
case
|
|
4791
|
-
case
|
|
4793
|
+
case "": return "<BOM>";
|
|
4794
|
+
case "": return "<DOC>";
|
|
4795
|
+
case "": return "<FLOW_END>";
|
|
4796
|
+
case "": return "<SCALAR>";
|
|
4792
4797
|
default: return JSON.stringify(token);
|
|
4793
4798
|
}
|
|
4794
4799
|
}
|
|
4795
4800
|
/** Identify the type of a lexer token. May return `null` for unknown tokens. */
|
|
4796
4801
|
function tokenType(source) {
|
|
4797
4802
|
switch (source) {
|
|
4798
|
-
case
|
|
4799
|
-
case
|
|
4800
|
-
case
|
|
4801
|
-
case
|
|
4803
|
+
case "": return "byte-order-mark";
|
|
4804
|
+
case "": return "doc-mode";
|
|
4805
|
+
case "": return "flow-error-end";
|
|
4806
|
+
case "": return "scalar";
|
|
4802
4807
|
case "---": return "doc-start";
|
|
4803
4808
|
case "...": return "doc-end";
|
|
4804
4809
|
case "":
|
|
@@ -4985,7 +4990,7 @@ var Lexer = class {
|
|
|
4985
4990
|
*parseStream() {
|
|
4986
4991
|
let line = this.getLine();
|
|
4987
4992
|
if (line === null) return this.setNext("stream");
|
|
4988
|
-
if (line[0] ===
|
|
4993
|
+
if (line[0] === "") {
|
|
4989
4994
|
yield* this.pushCount(1);
|
|
4990
4995
|
line = line.substring(1);
|
|
4991
4996
|
}
|
|
@@ -5015,7 +5020,7 @@ var Lexer = class {
|
|
|
5015
5020
|
yield* this.pushNewline();
|
|
5016
5021
|
return "stream";
|
|
5017
5022
|
}
|
|
5018
|
-
yield
|
|
5023
|
+
yield "";
|
|
5019
5024
|
return yield* this.parseLineStart();
|
|
5020
5025
|
}
|
|
5021
5026
|
*parseLineStart() {
|
|
@@ -5097,7 +5102,7 @@ var Lexer = class {
|
|
|
5097
5102
|
if (indent !== -1 && indent < this.indentNext && line[0] !== "#" || indent === 0 && (line.startsWith("---") || line.startsWith("...")) && isEmpty(line[3])) {
|
|
5098
5103
|
if (!(indent === this.indentNext - 1 && this.flowLevel === 1 && (line[0] === "]" || line[0] === "}"))) {
|
|
5099
5104
|
this.flowLevel = 0;
|
|
5100
|
-
yield
|
|
5105
|
+
yield "";
|
|
5101
5106
|
return yield* this.parseLineStart();
|
|
5102
5107
|
}
|
|
5103
5108
|
}
|
|
@@ -5189,16 +5194,16 @@ var Lexer = class {
|
|
|
5189
5194
|
let nl = this.pos - 1;
|
|
5190
5195
|
let indent = 0;
|
|
5191
5196
|
let ch;
|
|
5192
|
-
loop: for (let i
|
|
5197
|
+
loop: for (let i = this.pos; ch = this.buffer[i]; ++i) switch (ch) {
|
|
5193
5198
|
case " ":
|
|
5194
5199
|
indent += 1;
|
|
5195
5200
|
break;
|
|
5196
5201
|
case "\n":
|
|
5197
|
-
nl = i
|
|
5202
|
+
nl = i;
|
|
5198
5203
|
indent = 0;
|
|
5199
5204
|
break;
|
|
5200
5205
|
case "\r": {
|
|
5201
|
-
const next = this.buffer[i
|
|
5206
|
+
const next = this.buffer[i + 1];
|
|
5202
5207
|
if (!next && !this.atEnd) return this.setNext("block-scalar");
|
|
5203
5208
|
if (next === "\n") break;
|
|
5204
5209
|
}
|
|
@@ -5225,15 +5230,15 @@ var Lexer = class {
|
|
|
5225
5230
|
while (ch === " " || ch === " " || ch === "\r" || ch === "\n") ch = this.buffer[++i];
|
|
5226
5231
|
nl = i - 1;
|
|
5227
5232
|
} else if (!this.blockScalarKeep) do {
|
|
5228
|
-
let i
|
|
5229
|
-
let ch
|
|
5230
|
-
if (ch
|
|
5231
|
-
const lastChar = i
|
|
5232
|
-
while (ch
|
|
5233
|
-
if (ch
|
|
5233
|
+
let i = nl - 1;
|
|
5234
|
+
let ch = this.buffer[i];
|
|
5235
|
+
if (ch === "\r") ch = this.buffer[--i];
|
|
5236
|
+
const lastChar = i;
|
|
5237
|
+
while (ch === " ") ch = this.buffer[--i];
|
|
5238
|
+
if (ch === "\n" && i >= this.pos && i + 1 + indent > lastChar) nl = i;
|
|
5234
5239
|
else break;
|
|
5235
5240
|
} while (true);
|
|
5236
|
-
yield
|
|
5241
|
+
yield "";
|
|
5237
5242
|
yield* this.pushToIndex(nl + 1, true);
|
|
5238
5243
|
return yield* this.parseLineStart();
|
|
5239
5244
|
}
|
|
@@ -5264,7 +5269,7 @@ var Lexer = class {
|
|
|
5264
5269
|
end = i;
|
|
5265
5270
|
}
|
|
5266
5271
|
if (!ch && !this.atEnd) return this.setNext("plain-scalar");
|
|
5267
|
-
yield
|
|
5272
|
+
yield "";
|
|
5268
5273
|
yield* this.pushToIndex(end + 1, true);
|
|
5269
5274
|
return inFlow ? "flow" : "doc";
|
|
5270
5275
|
}
|
|
@@ -5757,7 +5762,7 @@ var Parser = class {
|
|
|
5757
5762
|
sep.push(this.sourceToken);
|
|
5758
5763
|
delete scalar.end;
|
|
5759
5764
|
} else sep = [this.sourceToken];
|
|
5760
|
-
const map
|
|
5765
|
+
const map = {
|
|
5761
5766
|
type: "block-map",
|
|
5762
5767
|
offset: scalar.offset,
|
|
5763
5768
|
indent: scalar.indent,
|
|
@@ -5768,7 +5773,7 @@ var Parser = class {
|
|
|
5768
5773
|
}]
|
|
5769
5774
|
};
|
|
5770
5775
|
this.onKeyLine = true;
|
|
5771
|
-
this.stack[this.stack.length - 1] = map
|
|
5776
|
+
this.stack[this.stack.length - 1] = map;
|
|
5772
5777
|
} else yield* this.lineEnd(scalar);
|
|
5773
5778
|
}
|
|
5774
5779
|
*blockScalar(scalar) {
|
|
@@ -5796,29 +5801,29 @@ var Parser = class {
|
|
|
5796
5801
|
yield* this.step();
|
|
5797
5802
|
}
|
|
5798
5803
|
}
|
|
5799
|
-
*blockMap(map
|
|
5800
|
-
const it = map
|
|
5804
|
+
*blockMap(map) {
|
|
5805
|
+
const it = map.items[map.items.length - 1];
|
|
5801
5806
|
switch (this.type) {
|
|
5802
5807
|
case "newline":
|
|
5803
5808
|
this.onKeyLine = false;
|
|
5804
5809
|
if (it.value) {
|
|
5805
5810
|
const end = "end" in it.value ? it.value.end : void 0;
|
|
5806
5811
|
if ((Array.isArray(end) ? end[end.length - 1] : void 0)?.type === "comment") end?.push(this.sourceToken);
|
|
5807
|
-
else map
|
|
5812
|
+
else map.items.push({ start: [this.sourceToken] });
|
|
5808
5813
|
} else if (it.sep) it.sep.push(this.sourceToken);
|
|
5809
5814
|
else it.start.push(this.sourceToken);
|
|
5810
5815
|
return;
|
|
5811
5816
|
case "space":
|
|
5812
5817
|
case "comment":
|
|
5813
|
-
if (it.value) map
|
|
5818
|
+
if (it.value) map.items.push({ start: [this.sourceToken] });
|
|
5814
5819
|
else if (it.sep) it.sep.push(this.sourceToken);
|
|
5815
5820
|
else {
|
|
5816
|
-
if (this.atIndentedComment(it.start, map
|
|
5817
|
-
const end = map
|
|
5821
|
+
if (this.atIndentedComment(it.start, map.indent)) {
|
|
5822
|
+
const end = map.items[map.items.length - 2]?.value?.end;
|
|
5818
5823
|
if (Array.isArray(end)) {
|
|
5819
5824
|
Array.prototype.push.apply(end, it.start);
|
|
5820
5825
|
end.push(this.sourceToken);
|
|
5821
|
-
map
|
|
5826
|
+
map.items.pop();
|
|
5822
5827
|
return;
|
|
5823
5828
|
}
|
|
5824
5829
|
}
|
|
@@ -5826,8 +5831,8 @@ var Parser = class {
|
|
|
5826
5831
|
}
|
|
5827
5832
|
return;
|
|
5828
5833
|
}
|
|
5829
|
-
if (this.indent >= map
|
|
5830
|
-
const atMapIndent = !this.onKeyLine && this.indent === map
|
|
5834
|
+
if (this.indent >= map.indent) {
|
|
5835
|
+
const atMapIndent = !this.onKeyLine && this.indent === map.indent;
|
|
5831
5836
|
const atNextItem = atMapIndent && (it.sep || it.explicitKey) && this.type !== "seq-item-ind";
|
|
5832
5837
|
let start = [];
|
|
5833
5838
|
if (atNextItem && it.sep && !it.value) {
|
|
@@ -5840,7 +5845,7 @@ var Parser = class {
|
|
|
5840
5845
|
break;
|
|
5841
5846
|
case "space": break;
|
|
5842
5847
|
case "comment":
|
|
5843
|
-
if (st.indent > map
|
|
5848
|
+
if (st.indent > map.indent) nl.length = 0;
|
|
5844
5849
|
break;
|
|
5845
5850
|
default: nl.length = 0;
|
|
5846
5851
|
}
|
|
@@ -5852,7 +5857,7 @@ var Parser = class {
|
|
|
5852
5857
|
case "tag":
|
|
5853
5858
|
if (atNextItem || it.value) {
|
|
5854
5859
|
start.push(this.sourceToken);
|
|
5855
|
-
map
|
|
5860
|
+
map.items.push({ start });
|
|
5856
5861
|
this.onKeyLine = true;
|
|
5857
5862
|
} else if (it.sep) it.sep.push(this.sourceToken);
|
|
5858
5863
|
else it.start.push(this.sourceToken);
|
|
@@ -5863,7 +5868,7 @@ var Parser = class {
|
|
|
5863
5868
|
it.explicitKey = true;
|
|
5864
5869
|
} else if (atNextItem || it.value) {
|
|
5865
5870
|
start.push(this.sourceToken);
|
|
5866
|
-
map
|
|
5871
|
+
map.items.push({
|
|
5867
5872
|
start,
|
|
5868
5873
|
explicitKey: true
|
|
5869
5874
|
});
|
|
@@ -5884,19 +5889,19 @@ var Parser = class {
|
|
|
5884
5889
|
sep: [this.sourceToken]
|
|
5885
5890
|
});
|
|
5886
5891
|
else {
|
|
5887
|
-
const start
|
|
5892
|
+
const start = getFirstKeyStartProps(it.start);
|
|
5888
5893
|
this.stack.push({
|
|
5889
5894
|
type: "block-map",
|
|
5890
5895
|
offset: this.offset,
|
|
5891
5896
|
indent: this.indent,
|
|
5892
5897
|
items: [{
|
|
5893
|
-
start
|
|
5898
|
+
start,
|
|
5894
5899
|
key: null,
|
|
5895
5900
|
sep: [this.sourceToken]
|
|
5896
5901
|
}]
|
|
5897
5902
|
});
|
|
5898
5903
|
}
|
|
5899
|
-
else if (it.value) map
|
|
5904
|
+
else if (it.value) map.items.push({
|
|
5900
5905
|
start: [],
|
|
5901
5906
|
key: null,
|
|
5902
5907
|
sep: [this.sourceToken]
|
|
@@ -5912,7 +5917,7 @@ var Parser = class {
|
|
|
5912
5917
|
}]
|
|
5913
5918
|
});
|
|
5914
5919
|
else if (isFlowToken(it.key) && !includesToken(it.sep, "newline")) {
|
|
5915
|
-
const start
|
|
5920
|
+
const start = getFirstKeyStartProps(it.start);
|
|
5916
5921
|
const key = it.key;
|
|
5917
5922
|
const sep = it.sep;
|
|
5918
5923
|
sep.push(this.sourceToken);
|
|
@@ -5923,7 +5928,7 @@ var Parser = class {
|
|
|
5923
5928
|
offset: this.offset,
|
|
5924
5929
|
indent: this.indent,
|
|
5925
5930
|
items: [{
|
|
5926
|
-
start
|
|
5931
|
+
start,
|
|
5927
5932
|
key,
|
|
5928
5933
|
sep
|
|
5929
5934
|
}]
|
|
@@ -5934,7 +5939,7 @@ var Parser = class {
|
|
|
5934
5939
|
key: null,
|
|
5935
5940
|
sep: [this.sourceToken]
|
|
5936
5941
|
});
|
|
5937
|
-
else if (it.value || atNextItem) map
|
|
5942
|
+
else if (it.value || atNextItem) map.items.push({
|
|
5938
5943
|
start,
|
|
5939
5944
|
key: null,
|
|
5940
5945
|
sep: [this.sourceToken]
|
|
@@ -5958,7 +5963,7 @@ var Parser = class {
|
|
|
5958
5963
|
case "double-quoted-scalar": {
|
|
5959
5964
|
const fs = this.flowScalar(this.type);
|
|
5960
5965
|
if (atNextItem || it.value) {
|
|
5961
|
-
map
|
|
5966
|
+
map.items.push({
|
|
5962
5967
|
start,
|
|
5963
5968
|
key: fs,
|
|
5964
5969
|
sep: []
|
|
@@ -5975,7 +5980,7 @@ var Parser = class {
|
|
|
5975
5980
|
return;
|
|
5976
5981
|
}
|
|
5977
5982
|
default: {
|
|
5978
|
-
const bv = this.startBlockValue(map
|
|
5983
|
+
const bv = this.startBlockValue(map);
|
|
5979
5984
|
if (bv) {
|
|
5980
5985
|
if (bv.type === "block-seq") {
|
|
5981
5986
|
if (!it.explicitKey && it.sep && !includesToken(it.sep, "newline")) {
|
|
@@ -5987,7 +5992,7 @@ var Parser = class {
|
|
|
5987
5992
|
});
|
|
5988
5993
|
return;
|
|
5989
5994
|
}
|
|
5990
|
-
} else if (atMapIndent) map
|
|
5995
|
+
} else if (atMapIndent) map.items.push({ start });
|
|
5991
5996
|
this.stack.push(bv);
|
|
5992
5997
|
return;
|
|
5993
5998
|
}
|
|
@@ -5997,26 +6002,26 @@ var Parser = class {
|
|
|
5997
6002
|
yield* this.pop();
|
|
5998
6003
|
yield* this.step();
|
|
5999
6004
|
}
|
|
6000
|
-
*blockSequence(seq
|
|
6001
|
-
const it = seq
|
|
6005
|
+
*blockSequence(seq) {
|
|
6006
|
+
const it = seq.items[seq.items.length - 1];
|
|
6002
6007
|
switch (this.type) {
|
|
6003
6008
|
case "newline":
|
|
6004
6009
|
if (it.value) {
|
|
6005
6010
|
const end = "end" in it.value ? it.value.end : void 0;
|
|
6006
6011
|
if ((Array.isArray(end) ? end[end.length - 1] : void 0)?.type === "comment") end?.push(this.sourceToken);
|
|
6007
|
-
else seq
|
|
6012
|
+
else seq.items.push({ start: [this.sourceToken] });
|
|
6008
6013
|
} else it.start.push(this.sourceToken);
|
|
6009
6014
|
return;
|
|
6010
6015
|
case "space":
|
|
6011
6016
|
case "comment":
|
|
6012
|
-
if (it.value) seq
|
|
6017
|
+
if (it.value) seq.items.push({ start: [this.sourceToken] });
|
|
6013
6018
|
else {
|
|
6014
|
-
if (this.atIndentedComment(it.start, seq
|
|
6015
|
-
const end = seq
|
|
6019
|
+
if (this.atIndentedComment(it.start, seq.indent)) {
|
|
6020
|
+
const end = seq.items[seq.items.length - 2]?.value?.end;
|
|
6016
6021
|
if (Array.isArray(end)) {
|
|
6017
6022
|
Array.prototype.push.apply(end, it.start);
|
|
6018
6023
|
end.push(this.sourceToken);
|
|
6019
|
-
seq
|
|
6024
|
+
seq.items.pop();
|
|
6020
6025
|
return;
|
|
6021
6026
|
}
|
|
6022
6027
|
}
|
|
@@ -6025,17 +6030,17 @@ var Parser = class {
|
|
|
6025
6030
|
return;
|
|
6026
6031
|
case "anchor":
|
|
6027
6032
|
case "tag":
|
|
6028
|
-
if (it.value || this.indent <= seq
|
|
6033
|
+
if (it.value || this.indent <= seq.indent) break;
|
|
6029
6034
|
it.start.push(this.sourceToken);
|
|
6030
6035
|
return;
|
|
6031
6036
|
case "seq-item-ind":
|
|
6032
|
-
if (this.indent !== seq
|
|
6033
|
-
if (it.value || includesToken(it.start, "seq-item-ind")) seq
|
|
6037
|
+
if (this.indent !== seq.indent) break;
|
|
6038
|
+
if (it.value || includesToken(it.start, "seq-item-ind")) seq.items.push({ start: [this.sourceToken] });
|
|
6034
6039
|
else it.start.push(this.sourceToken);
|
|
6035
6040
|
return;
|
|
6036
6041
|
}
|
|
6037
|
-
if (this.indent > seq
|
|
6038
|
-
const bv = this.startBlockValue(seq
|
|
6042
|
+
if (this.indent > seq.indent) {
|
|
6043
|
+
const bv = this.startBlockValue(seq);
|
|
6039
6044
|
if (bv) {
|
|
6040
6045
|
this.stack.push(bv);
|
|
6041
6046
|
return;
|
|
@@ -6119,7 +6124,7 @@ var Parser = class {
|
|
|
6119
6124
|
fixFlowSeqItems(fc);
|
|
6120
6125
|
const sep = fc.end.splice(1, fc.end.length);
|
|
6121
6126
|
sep.push(this.sourceToken);
|
|
6122
|
-
const map
|
|
6127
|
+
const map = {
|
|
6123
6128
|
type: "block-map",
|
|
6124
6129
|
offset: fc.offset,
|
|
6125
6130
|
indent: fc.indent,
|
|
@@ -6130,7 +6135,7 @@ var Parser = class {
|
|
|
6130
6135
|
}]
|
|
6131
6136
|
};
|
|
6132
6137
|
this.onKeyLine = true;
|
|
6133
|
-
this.stack[this.stack.length - 1] = map
|
|
6138
|
+
this.stack[this.stack.length - 1] = map;
|
|
6134
6139
|
} else yield* this.lineEnd(fc);
|
|
6135
6140
|
}
|
|
6136
6141
|
}
|
|
@@ -6232,8 +6237,6 @@ var Parser = class {
|
|
|
6232
6237
|
yield* this.step();
|
|
6233
6238
|
break;
|
|
6234
6239
|
case "newline": this.onKeyLine = false;
|
|
6235
|
-
case "space":
|
|
6236
|
-
case "comment":
|
|
6237
6240
|
default:
|
|
6238
6241
|
if (token.end) token.end.push(this.sourceToken);
|
|
6239
6242
|
else token.end = [this.sourceToken];
|
|
@@ -6319,7 +6322,7 @@ function stringify(value, replacer, options) {
|
|
|
6319
6322
|
|
|
6320
6323
|
//#endregion
|
|
6321
6324
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/index.js
|
|
6322
|
-
var dist_exports = /* @__PURE__ */
|
|
6325
|
+
var dist_exports = /* @__PURE__ */ __exportAll({
|
|
6323
6326
|
Alias: () => Alias,
|
|
6324
6327
|
CST: () => cst_exports,
|
|
6325
6328
|
Composer: () => Composer,
|
|
@@ -6336,18 +6339,18 @@ var dist_exports = /* @__PURE__ */ __export({
|
|
|
6336
6339
|
YAMLSeq: () => YAMLSeq,
|
|
6337
6340
|
YAMLWarning: () => YAMLWarning,
|
|
6338
6341
|
isAlias: () => isAlias,
|
|
6339
|
-
isCollection: () => isCollection,
|
|
6342
|
+
isCollection: () => isCollection$1,
|
|
6340
6343
|
isDocument: () => isDocument,
|
|
6341
6344
|
isMap: () => isMap,
|
|
6342
6345
|
isNode: () => isNode,
|
|
6343
6346
|
isPair: () => isPair,
|
|
6344
|
-
isScalar: () => isScalar,
|
|
6347
|
+
isScalar: () => isScalar$1,
|
|
6345
6348
|
isSeq: () => isSeq,
|
|
6346
6349
|
parse: () => parse,
|
|
6347
6350
|
parseAllDocuments: () => parseAllDocuments,
|
|
6348
6351
|
parseDocument: () => parseDocument,
|
|
6349
6352
|
stringify: () => stringify,
|
|
6350
|
-
visit: () => visit,
|
|
6353
|
+
visit: () => visit$1,
|
|
6351
6354
|
visitAsync: () => visitAsync
|
|
6352
6355
|
});
|
|
6353
6356
|
|
|
@@ -6844,6 +6847,12 @@ function normalizeNFKC(str) {
|
|
|
6844
6847
|
//#endregion
|
|
6845
6848
|
//#region src/validator.ts
|
|
6846
6849
|
/**
|
|
6850
|
+
* Skill validation logic
|
|
6851
|
+
*
|
|
6852
|
+
* Reference: https://agentskills.io/specification
|
|
6853
|
+
* Reference Implementation: https://github.com/agentskills/agentskills/blob/main/skills-ref/src/skills_ref/validator.py
|
|
6854
|
+
*/
|
|
6855
|
+
/**
|
|
6847
6856
|
* Maximum allowed skill name length.
|
|
6848
6857
|
*
|
|
6849
6858
|
* @see https://agentskills.io/specification
|
|
@@ -6937,7 +6946,7 @@ function validateName(name) {
|
|
|
6937
6946
|
return errors;
|
|
6938
6947
|
}
|
|
6939
6948
|
const normalized = normalizeNFKC(name.trim());
|
|
6940
|
-
if (normalized.length >
|
|
6949
|
+
if (normalized.length > 64) errors.push(`Skill name '${normalized}' exceeds ${64} character limit (${normalized.length} chars)`);
|
|
6941
6950
|
if (normalized !== normalized.toLowerCase()) errors.push(`Skill name '${normalized}' must be lowercase`);
|
|
6942
6951
|
if (normalized.startsWith("-") || normalized.endsWith("-")) errors.push("Skill name cannot start or end with a hyphen");
|
|
6943
6952
|
if (normalized.includes("--")) errors.push("Skill name cannot contain consecutive hyphens");
|
|
@@ -6957,7 +6966,7 @@ function validateDescription(description) {
|
|
|
6957
6966
|
errors.push("Field 'description' must be a non-empty string");
|
|
6958
6967
|
return errors;
|
|
6959
6968
|
}
|
|
6960
|
-
if (description.length >
|
|
6969
|
+
if (description.length > 1024) errors.push(`Description exceeds ${MAX_DESCRIPTION_LENGTH} character limit (${description.length} chars)`);
|
|
6961
6970
|
return errors;
|
|
6962
6971
|
}
|
|
6963
6972
|
/**
|
|
@@ -6973,7 +6982,7 @@ function validateCompatibility(compatibility) {
|
|
|
6973
6982
|
errors.push("Field 'compatibility' must be a string");
|
|
6974
6983
|
return errors;
|
|
6975
6984
|
}
|
|
6976
|
-
if (compatibility.length >
|
|
6985
|
+
if (compatibility.length > 500) errors.push(`Compatibility exceeds ${500} character limit (${compatibility.length} chars)`);
|
|
6977
6986
|
return errors;
|
|
6978
6987
|
}
|
|
6979
6988
|
const normalizeSkillName = (name) => normalizeNFKC(name.trim());
|
|
@@ -7080,7 +7089,7 @@ function validateSkillEntries(entries, options = {}) {
|
|
|
7080
7089
|
const { metadata } = parseFrontmatter(skillFile.content);
|
|
7081
7090
|
const errors = validateFrontmatterFields(metadata);
|
|
7082
7091
|
const properties = frontmatterToProperties(metadata);
|
|
7083
|
-
errors.push(...validateSkillProperties(properties, { expectedName: options.expectedName }));
|
|
7092
|
+
errors.push(...validateSkillProperties(properties, { ...options.expectedName !== void 0 && { expectedName: options.expectedName } }));
|
|
7084
7093
|
return errors;
|
|
7085
7094
|
} catch (error) {
|
|
7086
7095
|
if (error instanceof ParseError || error instanceof ValidationError) return [error.message];
|
|
@@ -7256,11 +7265,12 @@ function validateSkillPatch(patch) {
|
|
|
7256
7265
|
}));
|
|
7257
7266
|
return;
|
|
7258
7267
|
}
|
|
7268
|
+
const expectedMatches = toExpectedMatches(operation.expectedMatches);
|
|
7259
7269
|
normalizedOperations.push({
|
|
7260
7270
|
type: "replace",
|
|
7261
7271
|
before: operation.before,
|
|
7262
7272
|
after: operation.after,
|
|
7263
|
-
expectedMatches
|
|
7273
|
+
...expectedMatches !== void 0 && { expectedMatches }
|
|
7264
7274
|
});
|
|
7265
7275
|
return;
|
|
7266
7276
|
}
|
|
@@ -7295,12 +7305,14 @@ function validateSkillPatch(patch) {
|
|
|
7295
7305
|
}));
|
|
7296
7306
|
return;
|
|
7297
7307
|
}
|
|
7308
|
+
const insertPosition = isInsertPosition(operation.position) ? operation.position : void 0;
|
|
7309
|
+
const insertExpectedMatches = toExpectedMatches(operation.expectedMatches);
|
|
7298
7310
|
normalizedOperations.push({
|
|
7299
7311
|
type: "insert",
|
|
7300
7312
|
anchor: operation.anchor,
|
|
7301
7313
|
text: operation.text,
|
|
7302
|
-
|
|
7303
|
-
expectedMatches:
|
|
7314
|
+
...insertPosition !== void 0 && { position: insertPosition },
|
|
7315
|
+
...insertExpectedMatches !== void 0 && { expectedMatches: insertExpectedMatches }
|
|
7304
7316
|
});
|
|
7305
7317
|
return;
|
|
7306
7318
|
}
|
|
@@ -7314,10 +7326,11 @@ function validateSkillPatch(patch) {
|
|
|
7314
7326
|
}));
|
|
7315
7327
|
return;
|
|
7316
7328
|
}
|
|
7329
|
+
const deleteExpectedMatches = toExpectedMatches(operation.expectedMatches);
|
|
7317
7330
|
normalizedOperations.push({
|
|
7318
7331
|
type: "delete",
|
|
7319
7332
|
before: operation.before,
|
|
7320
|
-
expectedMatches:
|
|
7333
|
+
...deleteExpectedMatches !== void 0 && { expectedMatches: deleteExpectedMatches }
|
|
7321
7334
|
});
|
|
7322
7335
|
});
|
|
7323
7336
|
if (errors.length > 0) return {
|
|
@@ -7495,9 +7508,9 @@ function applySkillPatch(content, patch, options = {}) {
|
|
|
7495
7508
|
};
|
|
7496
7509
|
const operations = validation.patch.operations;
|
|
7497
7510
|
if (operations.length === 0) {
|
|
7498
|
-
const validateOption
|
|
7499
|
-
if (validateOption
|
|
7500
|
-
const issues = collectSkillValidationIssues(content, typeof validateOption
|
|
7511
|
+
const validateOption = options.validate ?? true;
|
|
7512
|
+
if (validateOption) {
|
|
7513
|
+
const issues = collectSkillValidationIssues(content, typeof validateOption === "object" ? validateOption.expectedName : void 0);
|
|
7501
7514
|
if (issues.length > 0) return {
|
|
7502
7515
|
ok: false,
|
|
7503
7516
|
errors: issues,
|
|
@@ -7516,24 +7529,24 @@ function applySkillPatch(content, patch, options = {}) {
|
|
|
7516
7529
|
const expectedProvided = operation.expectedMatches !== void 0 || options.expectedMatches !== void 0;
|
|
7517
7530
|
const expectedMatches = normalizeExpectedMatches(operation.expectedMatches, options.expectedMatches);
|
|
7518
7531
|
if (operation.type === "replace") {
|
|
7519
|
-
const result
|
|
7520
|
-
if ("code" in result
|
|
7532
|
+
const result = applyReplace(nextContent, operation.before, operation.after, index, expectedMatches, expectedProvided);
|
|
7533
|
+
if ("code" in result) return {
|
|
7521
7534
|
ok: false,
|
|
7522
|
-
errors: [result
|
|
7535
|
+
errors: [result],
|
|
7523
7536
|
appliedOperations
|
|
7524
7537
|
};
|
|
7525
|
-
nextContent = result
|
|
7538
|
+
nextContent = result.content;
|
|
7526
7539
|
appliedOperations += 1;
|
|
7527
7540
|
continue;
|
|
7528
7541
|
}
|
|
7529
7542
|
if (operation.type === "delete") {
|
|
7530
|
-
const result
|
|
7531
|
-
if ("code" in result
|
|
7543
|
+
const result = applyDelete(nextContent, operation.before, index, expectedMatches, expectedProvided);
|
|
7544
|
+
if ("code" in result) return {
|
|
7532
7545
|
ok: false,
|
|
7533
|
-
errors: [result
|
|
7546
|
+
errors: [result],
|
|
7534
7547
|
appliedOperations
|
|
7535
7548
|
};
|
|
7536
|
-
nextContent = result
|
|
7549
|
+
nextContent = result.content;
|
|
7537
7550
|
appliedOperations += 1;
|
|
7538
7551
|
continue;
|
|
7539
7552
|
}
|
|
@@ -7764,7 +7777,7 @@ const toPromptEntry = (entry) => {
|
|
|
7764
7777
|
return {
|
|
7765
7778
|
name: properties.name,
|
|
7766
7779
|
description: properties.description,
|
|
7767
|
-
location: entry.location
|
|
7780
|
+
...entry.location !== void 0 && { location: entry.location }
|
|
7768
7781
|
};
|
|
7769
7782
|
};
|
|
7770
7783
|
function toPrompt(entries) {
|