@ivotoby/openapi-mcp-server 1.1.0 → 1.2.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/dist/bundle.js +3156 -310
- package/package.json +2 -1
package/dist/bundle.js
CHANGED
|
@@ -8844,11 +8844,11 @@ var require_mime_types = __commonJS({
|
|
|
8844
8844
|
exports.lookup = lookup;
|
|
8845
8845
|
exports.types = /* @__PURE__ */ Object.create(null);
|
|
8846
8846
|
populateMaps(exports.extensions, exports.types);
|
|
8847
|
-
function charset(
|
|
8848
|
-
if (!
|
|
8847
|
+
function charset(type2) {
|
|
8848
|
+
if (!type2 || typeof type2 !== "string") {
|
|
8849
8849
|
return false;
|
|
8850
8850
|
}
|
|
8851
|
-
var match = EXTRACT_TYPE_REGEXP.exec(
|
|
8851
|
+
var match = EXTRACT_TYPE_REGEXP.exec(type2);
|
|
8852
8852
|
var mime = match && db[match[1].toLowerCase()];
|
|
8853
8853
|
if (mime && mime.charset) {
|
|
8854
8854
|
return mime.charset;
|
|
@@ -8858,11 +8858,11 @@ var require_mime_types = __commonJS({
|
|
|
8858
8858
|
}
|
|
8859
8859
|
return false;
|
|
8860
8860
|
}
|
|
8861
|
-
function contentType(
|
|
8862
|
-
if (!
|
|
8861
|
+
function contentType(str2) {
|
|
8862
|
+
if (!str2 || typeof str2 !== "string") {
|
|
8863
8863
|
return false;
|
|
8864
8864
|
}
|
|
8865
|
-
var mime =
|
|
8865
|
+
var mime = str2.indexOf("/") === -1 ? exports.lookup(str2) : str2;
|
|
8866
8866
|
if (!mime) {
|
|
8867
8867
|
return false;
|
|
8868
8868
|
}
|
|
@@ -8872,11 +8872,11 @@ var require_mime_types = __commonJS({
|
|
|
8872
8872
|
}
|
|
8873
8873
|
return mime;
|
|
8874
8874
|
}
|
|
8875
|
-
function extension(
|
|
8876
|
-
if (!
|
|
8875
|
+
function extension(type2) {
|
|
8876
|
+
if (!type2 || typeof type2 !== "string") {
|
|
8877
8877
|
return false;
|
|
8878
8878
|
}
|
|
8879
|
-
var match = EXTRACT_TYPE_REGEXP.exec(
|
|
8879
|
+
var match = EXTRACT_TYPE_REGEXP.exec(type2);
|
|
8880
8880
|
var exts = match && exports.extensions[match[1].toLowerCase()];
|
|
8881
8881
|
if (!exts || !exts.length) {
|
|
8882
8882
|
return false;
|
|
@@ -8893,25 +8893,25 @@ var require_mime_types = __commonJS({
|
|
|
8893
8893
|
}
|
|
8894
8894
|
return exports.types[extension2] || false;
|
|
8895
8895
|
}
|
|
8896
|
-
function populateMaps(extensions,
|
|
8896
|
+
function populateMaps(extensions, types2) {
|
|
8897
8897
|
var preference = ["nginx", "apache", void 0, "iana"];
|
|
8898
|
-
Object.keys(db).forEach(function forEachMimeType(
|
|
8899
|
-
var mime = db[
|
|
8898
|
+
Object.keys(db).forEach(function forEachMimeType(type2) {
|
|
8899
|
+
var mime = db[type2];
|
|
8900
8900
|
var exts = mime.extensions;
|
|
8901
8901
|
if (!exts || !exts.length) {
|
|
8902
8902
|
return;
|
|
8903
8903
|
}
|
|
8904
|
-
extensions[
|
|
8904
|
+
extensions[type2] = exts;
|
|
8905
8905
|
for (var i = 0; i < exts.length; i++) {
|
|
8906
8906
|
var extension2 = exts[i];
|
|
8907
|
-
if (
|
|
8908
|
-
var from = preference.indexOf(db[
|
|
8907
|
+
if (types2[extension2]) {
|
|
8908
|
+
var from = preference.indexOf(db[types2[extension2]].source);
|
|
8909
8909
|
var to = preference.indexOf(mime.source);
|
|
8910
|
-
if (
|
|
8910
|
+
if (types2[extension2] !== "application/octet-stream" && (from > to || from === to && types2[extension2].substr(0, 12) === "application/")) {
|
|
8911
8911
|
continue;
|
|
8912
8912
|
}
|
|
8913
8913
|
}
|
|
8914
|
-
|
|
8914
|
+
types2[extension2] = type2;
|
|
8915
8915
|
}
|
|
8916
8916
|
});
|
|
8917
8917
|
}
|
|
@@ -9425,14 +9425,14 @@ var require_implementation = __commonJS({
|
|
|
9425
9425
|
return arr;
|
|
9426
9426
|
};
|
|
9427
9427
|
var joiny = function(arr, joiner) {
|
|
9428
|
-
var
|
|
9428
|
+
var str2 = "";
|
|
9429
9429
|
for (var i = 0; i < arr.length; i += 1) {
|
|
9430
|
-
|
|
9430
|
+
str2 += arr[i];
|
|
9431
9431
|
if (i + 1 < arr.length) {
|
|
9432
|
-
|
|
9432
|
+
str2 += joiner;
|
|
9433
9433
|
}
|
|
9434
9434
|
}
|
|
9435
|
-
return
|
|
9435
|
+
return str2;
|
|
9436
9436
|
};
|
|
9437
9437
|
module.exports = function bind2(that) {
|
|
9438
9438
|
var target = this;
|
|
@@ -10383,30 +10383,30 @@ var require_ms = __commonJS({
|
|
|
10383
10383
|
var y = d * 365.25;
|
|
10384
10384
|
module.exports = function(val, options) {
|
|
10385
10385
|
options = options || {};
|
|
10386
|
-
var
|
|
10387
|
-
if (
|
|
10386
|
+
var type2 = typeof val;
|
|
10387
|
+
if (type2 === "string" && val.length > 0) {
|
|
10388
10388
|
return parse(val);
|
|
10389
|
-
} else if (
|
|
10389
|
+
} else if (type2 === "number" && isFinite(val)) {
|
|
10390
10390
|
return options.long ? fmtLong(val) : fmtShort(val);
|
|
10391
10391
|
}
|
|
10392
10392
|
throw new Error(
|
|
10393
10393
|
"val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
|
|
10394
10394
|
);
|
|
10395
10395
|
};
|
|
10396
|
-
function parse(
|
|
10397
|
-
|
|
10398
|
-
if (
|
|
10396
|
+
function parse(str2) {
|
|
10397
|
+
str2 = String(str2);
|
|
10398
|
+
if (str2.length > 100) {
|
|
10399
10399
|
return;
|
|
10400
10400
|
}
|
|
10401
10401
|
var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
|
|
10402
|
-
|
|
10402
|
+
str2
|
|
10403
10403
|
);
|
|
10404
10404
|
if (!match) {
|
|
10405
10405
|
return;
|
|
10406
10406
|
}
|
|
10407
10407
|
var n = parseFloat(match[1]);
|
|
10408
|
-
var
|
|
10409
|
-
switch (
|
|
10408
|
+
var type2 = (match[2] || "ms").toLowerCase();
|
|
10409
|
+
switch (type2) {
|
|
10410
10410
|
case "years":
|
|
10411
10411
|
case "year":
|
|
10412
10412
|
case "yrs":
|
|
@@ -10557,7 +10557,7 @@ var require_common = __commonJS({
|
|
|
10557
10557
|
debug.namespace = namespace;
|
|
10558
10558
|
debug.useColors = createDebug.useColors();
|
|
10559
10559
|
debug.color = createDebug.selectColor(namespace);
|
|
10560
|
-
debug.extend =
|
|
10560
|
+
debug.extend = extend4;
|
|
10561
10561
|
debug.destroy = createDebug.destroy;
|
|
10562
10562
|
Object.defineProperty(debug, "enabled", {
|
|
10563
10563
|
enumerable: true,
|
|
@@ -10581,7 +10581,7 @@ var require_common = __commonJS({
|
|
|
10581
10581
|
}
|
|
10582
10582
|
return debug;
|
|
10583
10583
|
}
|
|
10584
|
-
function
|
|
10584
|
+
function extend4(namespace, delimiter) {
|
|
10585
10585
|
const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
|
|
10586
10586
|
newDebug.log = this.log;
|
|
10587
10587
|
return newDebug;
|
|
@@ -10670,7 +10670,7 @@ var require_browser = __commonJS({
|
|
|
10670
10670
|
"node_modules/debug/src/browser.js"(exports, module) {
|
|
10671
10671
|
exports.formatArgs = formatArgs;
|
|
10672
10672
|
exports.save = save;
|
|
10673
|
-
exports.load =
|
|
10673
|
+
exports.load = load2;
|
|
10674
10674
|
exports.useColors = useColors;
|
|
10675
10675
|
exports.storage = localstorage();
|
|
10676
10676
|
exports.destroy = /* @__PURE__ */ (() => {
|
|
@@ -10806,7 +10806,7 @@ var require_browser = __commonJS({
|
|
|
10806
10806
|
} catch (error) {
|
|
10807
10807
|
}
|
|
10808
10808
|
}
|
|
10809
|
-
function
|
|
10809
|
+
function load2() {
|
|
10810
10810
|
let r;
|
|
10811
10811
|
try {
|
|
10812
10812
|
r = exports.storage.getItem("debug") || exports.storage.getItem("DEBUG");
|
|
@@ -10959,7 +10959,7 @@ var require_node = __commonJS({
|
|
|
10959
10959
|
exports.log = log;
|
|
10960
10960
|
exports.formatArgs = formatArgs;
|
|
10961
10961
|
exports.save = save;
|
|
10962
|
-
exports.load =
|
|
10962
|
+
exports.load = load2;
|
|
10963
10963
|
exports.useColors = useColors;
|
|
10964
10964
|
exports.destroy = util3.deprecate(
|
|
10965
10965
|
() => {
|
|
@@ -11101,7 +11101,7 @@ var require_node = __commonJS({
|
|
|
11101
11101
|
delete process.env.DEBUG;
|
|
11102
11102
|
}
|
|
11103
11103
|
}
|
|
11104
|
-
function
|
|
11104
|
+
function load2() {
|
|
11105
11105
|
return process.env.DEBUG;
|
|
11106
11106
|
}
|
|
11107
11107
|
function init(debug) {
|
|
@@ -11115,7 +11115,7 @@ var require_node = __commonJS({
|
|
|
11115
11115
|
var { formatters } = module.exports;
|
|
11116
11116
|
formatters.o = function(v) {
|
|
11117
11117
|
this.inspectOpts.colors = this.useColors;
|
|
11118
|
-
return util3.inspect(v, this.inspectOpts).split("\n").map((
|
|
11118
|
+
return util3.inspect(v, this.inspectOpts).split("\n").map((str2) => str2.trim()).join(" ");
|
|
11119
11119
|
};
|
|
11120
11120
|
formatters.O = function(v) {
|
|
11121
11121
|
this.inspectOpts.colors = this.useColors;
|
|
@@ -11658,6 +11658,2963 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
|
|
|
11658
11658
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
11659
11659
|
import { ListToolsRequestSchema, CallToolRequestSchema } from "@modelcontextprotocol/sdk/types.js";
|
|
11660
11660
|
|
|
11661
|
+
// src/openapi-loader.ts
|
|
11662
|
+
import { readFile } from "fs/promises";
|
|
11663
|
+
|
|
11664
|
+
// node_modules/js-yaml/dist/js-yaml.mjs
|
|
11665
|
+
function isNothing(subject) {
|
|
11666
|
+
return typeof subject === "undefined" || subject === null;
|
|
11667
|
+
}
|
|
11668
|
+
function isObject(subject) {
|
|
11669
|
+
return typeof subject === "object" && subject !== null;
|
|
11670
|
+
}
|
|
11671
|
+
function toArray(sequence) {
|
|
11672
|
+
if (Array.isArray(sequence)) return sequence;
|
|
11673
|
+
else if (isNothing(sequence)) return [];
|
|
11674
|
+
return [sequence];
|
|
11675
|
+
}
|
|
11676
|
+
function extend(target, source) {
|
|
11677
|
+
var index, length, key, sourceKeys;
|
|
11678
|
+
if (source) {
|
|
11679
|
+
sourceKeys = Object.keys(source);
|
|
11680
|
+
for (index = 0, length = sourceKeys.length; index < length; index += 1) {
|
|
11681
|
+
key = sourceKeys[index];
|
|
11682
|
+
target[key] = source[key];
|
|
11683
|
+
}
|
|
11684
|
+
}
|
|
11685
|
+
return target;
|
|
11686
|
+
}
|
|
11687
|
+
function repeat(string, count) {
|
|
11688
|
+
var result = "", cycle;
|
|
11689
|
+
for (cycle = 0; cycle < count; cycle += 1) {
|
|
11690
|
+
result += string;
|
|
11691
|
+
}
|
|
11692
|
+
return result;
|
|
11693
|
+
}
|
|
11694
|
+
function isNegativeZero(number) {
|
|
11695
|
+
return number === 0 && Number.NEGATIVE_INFINITY === 1 / number;
|
|
11696
|
+
}
|
|
11697
|
+
var isNothing_1 = isNothing;
|
|
11698
|
+
var isObject_1 = isObject;
|
|
11699
|
+
var toArray_1 = toArray;
|
|
11700
|
+
var repeat_1 = repeat;
|
|
11701
|
+
var isNegativeZero_1 = isNegativeZero;
|
|
11702
|
+
var extend_1 = extend;
|
|
11703
|
+
var common = {
|
|
11704
|
+
isNothing: isNothing_1,
|
|
11705
|
+
isObject: isObject_1,
|
|
11706
|
+
toArray: toArray_1,
|
|
11707
|
+
repeat: repeat_1,
|
|
11708
|
+
isNegativeZero: isNegativeZero_1,
|
|
11709
|
+
extend: extend_1
|
|
11710
|
+
};
|
|
11711
|
+
function formatError(exception2, compact) {
|
|
11712
|
+
var where = "", message = exception2.reason || "(unknown reason)";
|
|
11713
|
+
if (!exception2.mark) return message;
|
|
11714
|
+
if (exception2.mark.name) {
|
|
11715
|
+
where += 'in "' + exception2.mark.name + '" ';
|
|
11716
|
+
}
|
|
11717
|
+
where += "(" + (exception2.mark.line + 1) + ":" + (exception2.mark.column + 1) + ")";
|
|
11718
|
+
if (!compact && exception2.mark.snippet) {
|
|
11719
|
+
where += "\n\n" + exception2.mark.snippet;
|
|
11720
|
+
}
|
|
11721
|
+
return message + " " + where;
|
|
11722
|
+
}
|
|
11723
|
+
function YAMLException$1(reason, mark) {
|
|
11724
|
+
Error.call(this);
|
|
11725
|
+
this.name = "YAMLException";
|
|
11726
|
+
this.reason = reason;
|
|
11727
|
+
this.mark = mark;
|
|
11728
|
+
this.message = formatError(this, false);
|
|
11729
|
+
if (Error.captureStackTrace) {
|
|
11730
|
+
Error.captureStackTrace(this, this.constructor);
|
|
11731
|
+
} else {
|
|
11732
|
+
this.stack = new Error().stack || "";
|
|
11733
|
+
}
|
|
11734
|
+
}
|
|
11735
|
+
YAMLException$1.prototype = Object.create(Error.prototype);
|
|
11736
|
+
YAMLException$1.prototype.constructor = YAMLException$1;
|
|
11737
|
+
YAMLException$1.prototype.toString = function toString(compact) {
|
|
11738
|
+
return this.name + ": " + formatError(this, compact);
|
|
11739
|
+
};
|
|
11740
|
+
var exception = YAMLException$1;
|
|
11741
|
+
function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
|
|
11742
|
+
var head = "";
|
|
11743
|
+
var tail = "";
|
|
11744
|
+
var maxHalfLength = Math.floor(maxLineLength / 2) - 1;
|
|
11745
|
+
if (position - lineStart > maxHalfLength) {
|
|
11746
|
+
head = " ... ";
|
|
11747
|
+
lineStart = position - maxHalfLength + head.length;
|
|
11748
|
+
}
|
|
11749
|
+
if (lineEnd - position > maxHalfLength) {
|
|
11750
|
+
tail = " ...";
|
|
11751
|
+
lineEnd = position + maxHalfLength - tail.length;
|
|
11752
|
+
}
|
|
11753
|
+
return {
|
|
11754
|
+
str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, "\u2192") + tail,
|
|
11755
|
+
pos: position - lineStart + head.length
|
|
11756
|
+
// relative position
|
|
11757
|
+
};
|
|
11758
|
+
}
|
|
11759
|
+
function padStart(string, max) {
|
|
11760
|
+
return common.repeat(" ", max - string.length) + string;
|
|
11761
|
+
}
|
|
11762
|
+
function makeSnippet(mark, options) {
|
|
11763
|
+
options = Object.create(options || null);
|
|
11764
|
+
if (!mark.buffer) return null;
|
|
11765
|
+
if (!options.maxLength) options.maxLength = 79;
|
|
11766
|
+
if (typeof options.indent !== "number") options.indent = 1;
|
|
11767
|
+
if (typeof options.linesBefore !== "number") options.linesBefore = 3;
|
|
11768
|
+
if (typeof options.linesAfter !== "number") options.linesAfter = 2;
|
|
11769
|
+
var re = /\r?\n|\r|\0/g;
|
|
11770
|
+
var lineStarts = [0];
|
|
11771
|
+
var lineEnds = [];
|
|
11772
|
+
var match;
|
|
11773
|
+
var foundLineNo = -1;
|
|
11774
|
+
while (match = re.exec(mark.buffer)) {
|
|
11775
|
+
lineEnds.push(match.index);
|
|
11776
|
+
lineStarts.push(match.index + match[0].length);
|
|
11777
|
+
if (mark.position <= match.index && foundLineNo < 0) {
|
|
11778
|
+
foundLineNo = lineStarts.length - 2;
|
|
11779
|
+
}
|
|
11780
|
+
}
|
|
11781
|
+
if (foundLineNo < 0) foundLineNo = lineStarts.length - 1;
|
|
11782
|
+
var result = "", i, line;
|
|
11783
|
+
var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length;
|
|
11784
|
+
var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3);
|
|
11785
|
+
for (i = 1; i <= options.linesBefore; i++) {
|
|
11786
|
+
if (foundLineNo - i < 0) break;
|
|
11787
|
+
line = getLine(
|
|
11788
|
+
mark.buffer,
|
|
11789
|
+
lineStarts[foundLineNo - i],
|
|
11790
|
+
lineEnds[foundLineNo - i],
|
|
11791
|
+
mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]),
|
|
11792
|
+
maxLineLength
|
|
11793
|
+
);
|
|
11794
|
+
result = common.repeat(" ", options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + " | " + line.str + "\n" + result;
|
|
11795
|
+
}
|
|
11796
|
+
line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
|
|
11797
|
+
result += common.repeat(" ", options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + " | " + line.str + "\n";
|
|
11798
|
+
result += common.repeat("-", options.indent + lineNoLength + 3 + line.pos) + "^\n";
|
|
11799
|
+
for (i = 1; i <= options.linesAfter; i++) {
|
|
11800
|
+
if (foundLineNo + i >= lineEnds.length) break;
|
|
11801
|
+
line = getLine(
|
|
11802
|
+
mark.buffer,
|
|
11803
|
+
lineStarts[foundLineNo + i],
|
|
11804
|
+
lineEnds[foundLineNo + i],
|
|
11805
|
+
mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]),
|
|
11806
|
+
maxLineLength
|
|
11807
|
+
);
|
|
11808
|
+
result += common.repeat(" ", options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + " | " + line.str + "\n";
|
|
11809
|
+
}
|
|
11810
|
+
return result.replace(/\n$/, "");
|
|
11811
|
+
}
|
|
11812
|
+
var snippet = makeSnippet;
|
|
11813
|
+
var TYPE_CONSTRUCTOR_OPTIONS = [
|
|
11814
|
+
"kind",
|
|
11815
|
+
"multi",
|
|
11816
|
+
"resolve",
|
|
11817
|
+
"construct",
|
|
11818
|
+
"instanceOf",
|
|
11819
|
+
"predicate",
|
|
11820
|
+
"represent",
|
|
11821
|
+
"representName",
|
|
11822
|
+
"defaultStyle",
|
|
11823
|
+
"styleAliases"
|
|
11824
|
+
];
|
|
11825
|
+
var YAML_NODE_KINDS = [
|
|
11826
|
+
"scalar",
|
|
11827
|
+
"sequence",
|
|
11828
|
+
"mapping"
|
|
11829
|
+
];
|
|
11830
|
+
function compileStyleAliases(map2) {
|
|
11831
|
+
var result = {};
|
|
11832
|
+
if (map2 !== null) {
|
|
11833
|
+
Object.keys(map2).forEach(function(style) {
|
|
11834
|
+
map2[style].forEach(function(alias) {
|
|
11835
|
+
result[String(alias)] = style;
|
|
11836
|
+
});
|
|
11837
|
+
});
|
|
11838
|
+
}
|
|
11839
|
+
return result;
|
|
11840
|
+
}
|
|
11841
|
+
function Type$1(tag, options) {
|
|
11842
|
+
options = options || {};
|
|
11843
|
+
Object.keys(options).forEach(function(name) {
|
|
11844
|
+
if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
|
|
11845
|
+
throw new exception('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
|
|
11846
|
+
}
|
|
11847
|
+
});
|
|
11848
|
+
this.options = options;
|
|
11849
|
+
this.tag = tag;
|
|
11850
|
+
this.kind = options["kind"] || null;
|
|
11851
|
+
this.resolve = options["resolve"] || function() {
|
|
11852
|
+
return true;
|
|
11853
|
+
};
|
|
11854
|
+
this.construct = options["construct"] || function(data) {
|
|
11855
|
+
return data;
|
|
11856
|
+
};
|
|
11857
|
+
this.instanceOf = options["instanceOf"] || null;
|
|
11858
|
+
this.predicate = options["predicate"] || null;
|
|
11859
|
+
this.represent = options["represent"] || null;
|
|
11860
|
+
this.representName = options["representName"] || null;
|
|
11861
|
+
this.defaultStyle = options["defaultStyle"] || null;
|
|
11862
|
+
this.multi = options["multi"] || false;
|
|
11863
|
+
this.styleAliases = compileStyleAliases(options["styleAliases"] || null);
|
|
11864
|
+
if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
|
|
11865
|
+
throw new exception('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
|
|
11866
|
+
}
|
|
11867
|
+
}
|
|
11868
|
+
var type = Type$1;
|
|
11869
|
+
function compileList(schema2, name) {
|
|
11870
|
+
var result = [];
|
|
11871
|
+
schema2[name].forEach(function(currentType) {
|
|
11872
|
+
var newIndex = result.length;
|
|
11873
|
+
result.forEach(function(previousType, previousIndex) {
|
|
11874
|
+
if (previousType.tag === currentType.tag && previousType.kind === currentType.kind && previousType.multi === currentType.multi) {
|
|
11875
|
+
newIndex = previousIndex;
|
|
11876
|
+
}
|
|
11877
|
+
});
|
|
11878
|
+
result[newIndex] = currentType;
|
|
11879
|
+
});
|
|
11880
|
+
return result;
|
|
11881
|
+
}
|
|
11882
|
+
function compileMap() {
|
|
11883
|
+
var result = {
|
|
11884
|
+
scalar: {},
|
|
11885
|
+
sequence: {},
|
|
11886
|
+
mapping: {},
|
|
11887
|
+
fallback: {},
|
|
11888
|
+
multi: {
|
|
11889
|
+
scalar: [],
|
|
11890
|
+
sequence: [],
|
|
11891
|
+
mapping: [],
|
|
11892
|
+
fallback: []
|
|
11893
|
+
}
|
|
11894
|
+
}, index, length;
|
|
11895
|
+
function collectType(type2) {
|
|
11896
|
+
if (type2.multi) {
|
|
11897
|
+
result.multi[type2.kind].push(type2);
|
|
11898
|
+
result.multi["fallback"].push(type2);
|
|
11899
|
+
} else {
|
|
11900
|
+
result[type2.kind][type2.tag] = result["fallback"][type2.tag] = type2;
|
|
11901
|
+
}
|
|
11902
|
+
}
|
|
11903
|
+
for (index = 0, length = arguments.length; index < length; index += 1) {
|
|
11904
|
+
arguments[index].forEach(collectType);
|
|
11905
|
+
}
|
|
11906
|
+
return result;
|
|
11907
|
+
}
|
|
11908
|
+
function Schema$1(definition) {
|
|
11909
|
+
return this.extend(definition);
|
|
11910
|
+
}
|
|
11911
|
+
Schema$1.prototype.extend = function extend2(definition) {
|
|
11912
|
+
var implicit = [];
|
|
11913
|
+
var explicit = [];
|
|
11914
|
+
if (definition instanceof type) {
|
|
11915
|
+
explicit.push(definition);
|
|
11916
|
+
} else if (Array.isArray(definition)) {
|
|
11917
|
+
explicit = explicit.concat(definition);
|
|
11918
|
+
} else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {
|
|
11919
|
+
if (definition.implicit) implicit = implicit.concat(definition.implicit);
|
|
11920
|
+
if (definition.explicit) explicit = explicit.concat(definition.explicit);
|
|
11921
|
+
} else {
|
|
11922
|
+
throw new exception("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");
|
|
11923
|
+
}
|
|
11924
|
+
implicit.forEach(function(type$1) {
|
|
11925
|
+
if (!(type$1 instanceof type)) {
|
|
11926
|
+
throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
|
11927
|
+
}
|
|
11928
|
+
if (type$1.loadKind && type$1.loadKind !== "scalar") {
|
|
11929
|
+
throw new exception("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
|
|
11930
|
+
}
|
|
11931
|
+
if (type$1.multi) {
|
|
11932
|
+
throw new exception("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.");
|
|
11933
|
+
}
|
|
11934
|
+
});
|
|
11935
|
+
explicit.forEach(function(type$1) {
|
|
11936
|
+
if (!(type$1 instanceof type)) {
|
|
11937
|
+
throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
|
11938
|
+
}
|
|
11939
|
+
});
|
|
11940
|
+
var result = Object.create(Schema$1.prototype);
|
|
11941
|
+
result.implicit = (this.implicit || []).concat(implicit);
|
|
11942
|
+
result.explicit = (this.explicit || []).concat(explicit);
|
|
11943
|
+
result.compiledImplicit = compileList(result, "implicit");
|
|
11944
|
+
result.compiledExplicit = compileList(result, "explicit");
|
|
11945
|
+
result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit);
|
|
11946
|
+
return result;
|
|
11947
|
+
};
|
|
11948
|
+
var schema = Schema$1;
|
|
11949
|
+
var str = new type("tag:yaml.org,2002:str", {
|
|
11950
|
+
kind: "scalar",
|
|
11951
|
+
construct: function(data) {
|
|
11952
|
+
return data !== null ? data : "";
|
|
11953
|
+
}
|
|
11954
|
+
});
|
|
11955
|
+
var seq = new type("tag:yaml.org,2002:seq", {
|
|
11956
|
+
kind: "sequence",
|
|
11957
|
+
construct: function(data) {
|
|
11958
|
+
return data !== null ? data : [];
|
|
11959
|
+
}
|
|
11960
|
+
});
|
|
11961
|
+
var map = new type("tag:yaml.org,2002:map", {
|
|
11962
|
+
kind: "mapping",
|
|
11963
|
+
construct: function(data) {
|
|
11964
|
+
return data !== null ? data : {};
|
|
11965
|
+
}
|
|
11966
|
+
});
|
|
11967
|
+
var failsafe = new schema({
|
|
11968
|
+
explicit: [
|
|
11969
|
+
str,
|
|
11970
|
+
seq,
|
|
11971
|
+
map
|
|
11972
|
+
]
|
|
11973
|
+
});
|
|
11974
|
+
function resolveYamlNull(data) {
|
|
11975
|
+
if (data === null) return true;
|
|
11976
|
+
var max = data.length;
|
|
11977
|
+
return max === 1 && data === "~" || max === 4 && (data === "null" || data === "Null" || data === "NULL");
|
|
11978
|
+
}
|
|
11979
|
+
function constructYamlNull() {
|
|
11980
|
+
return null;
|
|
11981
|
+
}
|
|
11982
|
+
function isNull(object) {
|
|
11983
|
+
return object === null;
|
|
11984
|
+
}
|
|
11985
|
+
var _null = new type("tag:yaml.org,2002:null", {
|
|
11986
|
+
kind: "scalar",
|
|
11987
|
+
resolve: resolveYamlNull,
|
|
11988
|
+
construct: constructYamlNull,
|
|
11989
|
+
predicate: isNull,
|
|
11990
|
+
represent: {
|
|
11991
|
+
canonical: function() {
|
|
11992
|
+
return "~";
|
|
11993
|
+
},
|
|
11994
|
+
lowercase: function() {
|
|
11995
|
+
return "null";
|
|
11996
|
+
},
|
|
11997
|
+
uppercase: function() {
|
|
11998
|
+
return "NULL";
|
|
11999
|
+
},
|
|
12000
|
+
camelcase: function() {
|
|
12001
|
+
return "Null";
|
|
12002
|
+
},
|
|
12003
|
+
empty: function() {
|
|
12004
|
+
return "";
|
|
12005
|
+
}
|
|
12006
|
+
},
|
|
12007
|
+
defaultStyle: "lowercase"
|
|
12008
|
+
});
|
|
12009
|
+
function resolveYamlBoolean(data) {
|
|
12010
|
+
if (data === null) return false;
|
|
12011
|
+
var max = data.length;
|
|
12012
|
+
return max === 4 && (data === "true" || data === "True" || data === "TRUE") || max === 5 && (data === "false" || data === "False" || data === "FALSE");
|
|
12013
|
+
}
|
|
12014
|
+
function constructYamlBoolean(data) {
|
|
12015
|
+
return data === "true" || data === "True" || data === "TRUE";
|
|
12016
|
+
}
|
|
12017
|
+
function isBoolean(object) {
|
|
12018
|
+
return Object.prototype.toString.call(object) === "[object Boolean]";
|
|
12019
|
+
}
|
|
12020
|
+
var bool = new type("tag:yaml.org,2002:bool", {
|
|
12021
|
+
kind: "scalar",
|
|
12022
|
+
resolve: resolveYamlBoolean,
|
|
12023
|
+
construct: constructYamlBoolean,
|
|
12024
|
+
predicate: isBoolean,
|
|
12025
|
+
represent: {
|
|
12026
|
+
lowercase: function(object) {
|
|
12027
|
+
return object ? "true" : "false";
|
|
12028
|
+
},
|
|
12029
|
+
uppercase: function(object) {
|
|
12030
|
+
return object ? "TRUE" : "FALSE";
|
|
12031
|
+
},
|
|
12032
|
+
camelcase: function(object) {
|
|
12033
|
+
return object ? "True" : "False";
|
|
12034
|
+
}
|
|
12035
|
+
},
|
|
12036
|
+
defaultStyle: "lowercase"
|
|
12037
|
+
});
|
|
12038
|
+
function isHexCode(c) {
|
|
12039
|
+
return 48 <= c && c <= 57 || 65 <= c && c <= 70 || 97 <= c && c <= 102;
|
|
12040
|
+
}
|
|
12041
|
+
function isOctCode(c) {
|
|
12042
|
+
return 48 <= c && c <= 55;
|
|
12043
|
+
}
|
|
12044
|
+
function isDecCode(c) {
|
|
12045
|
+
return 48 <= c && c <= 57;
|
|
12046
|
+
}
|
|
12047
|
+
function resolveYamlInteger(data) {
|
|
12048
|
+
if (data === null) return false;
|
|
12049
|
+
var max = data.length, index = 0, hasDigits = false, ch;
|
|
12050
|
+
if (!max) return false;
|
|
12051
|
+
ch = data[index];
|
|
12052
|
+
if (ch === "-" || ch === "+") {
|
|
12053
|
+
ch = data[++index];
|
|
12054
|
+
}
|
|
12055
|
+
if (ch === "0") {
|
|
12056
|
+
if (index + 1 === max) return true;
|
|
12057
|
+
ch = data[++index];
|
|
12058
|
+
if (ch === "b") {
|
|
12059
|
+
index++;
|
|
12060
|
+
for (; index < max; index++) {
|
|
12061
|
+
ch = data[index];
|
|
12062
|
+
if (ch === "_") continue;
|
|
12063
|
+
if (ch !== "0" && ch !== "1") return false;
|
|
12064
|
+
hasDigits = true;
|
|
12065
|
+
}
|
|
12066
|
+
return hasDigits && ch !== "_";
|
|
12067
|
+
}
|
|
12068
|
+
if (ch === "x") {
|
|
12069
|
+
index++;
|
|
12070
|
+
for (; index < max; index++) {
|
|
12071
|
+
ch = data[index];
|
|
12072
|
+
if (ch === "_") continue;
|
|
12073
|
+
if (!isHexCode(data.charCodeAt(index))) return false;
|
|
12074
|
+
hasDigits = true;
|
|
12075
|
+
}
|
|
12076
|
+
return hasDigits && ch !== "_";
|
|
12077
|
+
}
|
|
12078
|
+
if (ch === "o") {
|
|
12079
|
+
index++;
|
|
12080
|
+
for (; index < max; index++) {
|
|
12081
|
+
ch = data[index];
|
|
12082
|
+
if (ch === "_") continue;
|
|
12083
|
+
if (!isOctCode(data.charCodeAt(index))) return false;
|
|
12084
|
+
hasDigits = true;
|
|
12085
|
+
}
|
|
12086
|
+
return hasDigits && ch !== "_";
|
|
12087
|
+
}
|
|
12088
|
+
}
|
|
12089
|
+
if (ch === "_") return false;
|
|
12090
|
+
for (; index < max; index++) {
|
|
12091
|
+
ch = data[index];
|
|
12092
|
+
if (ch === "_") continue;
|
|
12093
|
+
if (!isDecCode(data.charCodeAt(index))) {
|
|
12094
|
+
return false;
|
|
12095
|
+
}
|
|
12096
|
+
hasDigits = true;
|
|
12097
|
+
}
|
|
12098
|
+
if (!hasDigits || ch === "_") return false;
|
|
12099
|
+
return true;
|
|
12100
|
+
}
|
|
12101
|
+
function constructYamlInteger(data) {
|
|
12102
|
+
var value = data, sign = 1, ch;
|
|
12103
|
+
if (value.indexOf("_") !== -1) {
|
|
12104
|
+
value = value.replace(/_/g, "");
|
|
12105
|
+
}
|
|
12106
|
+
ch = value[0];
|
|
12107
|
+
if (ch === "-" || ch === "+") {
|
|
12108
|
+
if (ch === "-") sign = -1;
|
|
12109
|
+
value = value.slice(1);
|
|
12110
|
+
ch = value[0];
|
|
12111
|
+
}
|
|
12112
|
+
if (value === "0") return 0;
|
|
12113
|
+
if (ch === "0") {
|
|
12114
|
+
if (value[1] === "b") return sign * parseInt(value.slice(2), 2);
|
|
12115
|
+
if (value[1] === "x") return sign * parseInt(value.slice(2), 16);
|
|
12116
|
+
if (value[1] === "o") return sign * parseInt(value.slice(2), 8);
|
|
12117
|
+
}
|
|
12118
|
+
return sign * parseInt(value, 10);
|
|
12119
|
+
}
|
|
12120
|
+
function isInteger(object) {
|
|
12121
|
+
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 === 0 && !common.isNegativeZero(object));
|
|
12122
|
+
}
|
|
12123
|
+
var int = new type("tag:yaml.org,2002:int", {
|
|
12124
|
+
kind: "scalar",
|
|
12125
|
+
resolve: resolveYamlInteger,
|
|
12126
|
+
construct: constructYamlInteger,
|
|
12127
|
+
predicate: isInteger,
|
|
12128
|
+
represent: {
|
|
12129
|
+
binary: function(obj) {
|
|
12130
|
+
return obj >= 0 ? "0b" + obj.toString(2) : "-0b" + obj.toString(2).slice(1);
|
|
12131
|
+
},
|
|
12132
|
+
octal: function(obj) {
|
|
12133
|
+
return obj >= 0 ? "0o" + obj.toString(8) : "-0o" + obj.toString(8).slice(1);
|
|
12134
|
+
},
|
|
12135
|
+
decimal: function(obj) {
|
|
12136
|
+
return obj.toString(10);
|
|
12137
|
+
},
|
|
12138
|
+
/* eslint-disable max-len */
|
|
12139
|
+
hexadecimal: function(obj) {
|
|
12140
|
+
return obj >= 0 ? "0x" + obj.toString(16).toUpperCase() : "-0x" + obj.toString(16).toUpperCase().slice(1);
|
|
12141
|
+
}
|
|
12142
|
+
},
|
|
12143
|
+
defaultStyle: "decimal",
|
|
12144
|
+
styleAliases: {
|
|
12145
|
+
binary: [2, "bin"],
|
|
12146
|
+
octal: [8, "oct"],
|
|
12147
|
+
decimal: [10, "dec"],
|
|
12148
|
+
hexadecimal: [16, "hex"]
|
|
12149
|
+
}
|
|
12150
|
+
});
|
|
12151
|
+
var YAML_FLOAT_PATTERN = new RegExp(
|
|
12152
|
+
// 2.5e4, 2.5 and integers
|
|
12153
|
+
"^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"
|
|
12154
|
+
);
|
|
12155
|
+
function resolveYamlFloat(data) {
|
|
12156
|
+
if (data === null) return false;
|
|
12157
|
+
if (!YAML_FLOAT_PATTERN.test(data) || // Quick hack to not allow integers end with `_`
|
|
12158
|
+
// Probably should update regexp & check speed
|
|
12159
|
+
data[data.length - 1] === "_") {
|
|
12160
|
+
return false;
|
|
12161
|
+
}
|
|
12162
|
+
return true;
|
|
12163
|
+
}
|
|
12164
|
+
function constructYamlFloat(data) {
|
|
12165
|
+
var value, sign;
|
|
12166
|
+
value = data.replace(/_/g, "").toLowerCase();
|
|
12167
|
+
sign = value[0] === "-" ? -1 : 1;
|
|
12168
|
+
if ("+-".indexOf(value[0]) >= 0) {
|
|
12169
|
+
value = value.slice(1);
|
|
12170
|
+
}
|
|
12171
|
+
if (value === ".inf") {
|
|
12172
|
+
return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
|
|
12173
|
+
} else if (value === ".nan") {
|
|
12174
|
+
return NaN;
|
|
12175
|
+
}
|
|
12176
|
+
return sign * parseFloat(value, 10);
|
|
12177
|
+
}
|
|
12178
|
+
var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
|
|
12179
|
+
function representYamlFloat(object, style) {
|
|
12180
|
+
var res;
|
|
12181
|
+
if (isNaN(object)) {
|
|
12182
|
+
switch (style) {
|
|
12183
|
+
case "lowercase":
|
|
12184
|
+
return ".nan";
|
|
12185
|
+
case "uppercase":
|
|
12186
|
+
return ".NAN";
|
|
12187
|
+
case "camelcase":
|
|
12188
|
+
return ".NaN";
|
|
12189
|
+
}
|
|
12190
|
+
} else if (Number.POSITIVE_INFINITY === object) {
|
|
12191
|
+
switch (style) {
|
|
12192
|
+
case "lowercase":
|
|
12193
|
+
return ".inf";
|
|
12194
|
+
case "uppercase":
|
|
12195
|
+
return ".INF";
|
|
12196
|
+
case "camelcase":
|
|
12197
|
+
return ".Inf";
|
|
12198
|
+
}
|
|
12199
|
+
} else if (Number.NEGATIVE_INFINITY === object) {
|
|
12200
|
+
switch (style) {
|
|
12201
|
+
case "lowercase":
|
|
12202
|
+
return "-.inf";
|
|
12203
|
+
case "uppercase":
|
|
12204
|
+
return "-.INF";
|
|
12205
|
+
case "camelcase":
|
|
12206
|
+
return "-.Inf";
|
|
12207
|
+
}
|
|
12208
|
+
} else if (common.isNegativeZero(object)) {
|
|
12209
|
+
return "-0.0";
|
|
12210
|
+
}
|
|
12211
|
+
res = object.toString(10);
|
|
12212
|
+
return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res;
|
|
12213
|
+
}
|
|
12214
|
+
function isFloat(object) {
|
|
12215
|
+
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || common.isNegativeZero(object));
|
|
12216
|
+
}
|
|
12217
|
+
var float = new type("tag:yaml.org,2002:float", {
|
|
12218
|
+
kind: "scalar",
|
|
12219
|
+
resolve: resolveYamlFloat,
|
|
12220
|
+
construct: constructYamlFloat,
|
|
12221
|
+
predicate: isFloat,
|
|
12222
|
+
represent: representYamlFloat,
|
|
12223
|
+
defaultStyle: "lowercase"
|
|
12224
|
+
});
|
|
12225
|
+
var json = failsafe.extend({
|
|
12226
|
+
implicit: [
|
|
12227
|
+
_null,
|
|
12228
|
+
bool,
|
|
12229
|
+
int,
|
|
12230
|
+
float
|
|
12231
|
+
]
|
|
12232
|
+
});
|
|
12233
|
+
var core = json;
|
|
12234
|
+
var YAML_DATE_REGEXP = new RegExp(
|
|
12235
|
+
"^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"
|
|
12236
|
+
);
|
|
12237
|
+
var YAML_TIMESTAMP_REGEXP = new RegExp(
|
|
12238
|
+
"^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$"
|
|
12239
|
+
);
|
|
12240
|
+
function resolveYamlTimestamp(data) {
|
|
12241
|
+
if (data === null) return false;
|
|
12242
|
+
if (YAML_DATE_REGEXP.exec(data) !== null) return true;
|
|
12243
|
+
if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true;
|
|
12244
|
+
return false;
|
|
12245
|
+
}
|
|
12246
|
+
function constructYamlTimestamp(data) {
|
|
12247
|
+
var match, year, month, day, hour, minute, second, fraction = 0, delta = null, tz_hour, tz_minute, date;
|
|
12248
|
+
match = YAML_DATE_REGEXP.exec(data);
|
|
12249
|
+
if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data);
|
|
12250
|
+
if (match === null) throw new Error("Date resolve error");
|
|
12251
|
+
year = +match[1];
|
|
12252
|
+
month = +match[2] - 1;
|
|
12253
|
+
day = +match[3];
|
|
12254
|
+
if (!match[4]) {
|
|
12255
|
+
return new Date(Date.UTC(year, month, day));
|
|
12256
|
+
}
|
|
12257
|
+
hour = +match[4];
|
|
12258
|
+
minute = +match[5];
|
|
12259
|
+
second = +match[6];
|
|
12260
|
+
if (match[7]) {
|
|
12261
|
+
fraction = match[7].slice(0, 3);
|
|
12262
|
+
while (fraction.length < 3) {
|
|
12263
|
+
fraction += "0";
|
|
12264
|
+
}
|
|
12265
|
+
fraction = +fraction;
|
|
12266
|
+
}
|
|
12267
|
+
if (match[9]) {
|
|
12268
|
+
tz_hour = +match[10];
|
|
12269
|
+
tz_minute = +(match[11] || 0);
|
|
12270
|
+
delta = (tz_hour * 60 + tz_minute) * 6e4;
|
|
12271
|
+
if (match[9] === "-") delta = -delta;
|
|
12272
|
+
}
|
|
12273
|
+
date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
|
|
12274
|
+
if (delta) date.setTime(date.getTime() - delta);
|
|
12275
|
+
return date;
|
|
12276
|
+
}
|
|
12277
|
+
function representYamlTimestamp(object) {
|
|
12278
|
+
return object.toISOString();
|
|
12279
|
+
}
|
|
12280
|
+
var timestamp = new type("tag:yaml.org,2002:timestamp", {
|
|
12281
|
+
kind: "scalar",
|
|
12282
|
+
resolve: resolveYamlTimestamp,
|
|
12283
|
+
construct: constructYamlTimestamp,
|
|
12284
|
+
instanceOf: Date,
|
|
12285
|
+
represent: representYamlTimestamp
|
|
12286
|
+
});
|
|
12287
|
+
function resolveYamlMerge(data) {
|
|
12288
|
+
return data === "<<" || data === null;
|
|
12289
|
+
}
|
|
12290
|
+
var merge = new type("tag:yaml.org,2002:merge", {
|
|
12291
|
+
kind: "scalar",
|
|
12292
|
+
resolve: resolveYamlMerge
|
|
12293
|
+
});
|
|
12294
|
+
var BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";
|
|
12295
|
+
function resolveYamlBinary(data) {
|
|
12296
|
+
if (data === null) return false;
|
|
12297
|
+
var code, idx, bitlen = 0, max = data.length, map2 = BASE64_MAP;
|
|
12298
|
+
for (idx = 0; idx < max; idx++) {
|
|
12299
|
+
code = map2.indexOf(data.charAt(idx));
|
|
12300
|
+
if (code > 64) continue;
|
|
12301
|
+
if (code < 0) return false;
|
|
12302
|
+
bitlen += 6;
|
|
12303
|
+
}
|
|
12304
|
+
return bitlen % 8 === 0;
|
|
12305
|
+
}
|
|
12306
|
+
function constructYamlBinary(data) {
|
|
12307
|
+
var idx, tailbits, input = data.replace(/[\r\n=]/g, ""), max = input.length, map2 = BASE64_MAP, bits = 0, result = [];
|
|
12308
|
+
for (idx = 0; idx < max; idx++) {
|
|
12309
|
+
if (idx % 4 === 0 && idx) {
|
|
12310
|
+
result.push(bits >> 16 & 255);
|
|
12311
|
+
result.push(bits >> 8 & 255);
|
|
12312
|
+
result.push(bits & 255);
|
|
12313
|
+
}
|
|
12314
|
+
bits = bits << 6 | map2.indexOf(input.charAt(idx));
|
|
12315
|
+
}
|
|
12316
|
+
tailbits = max % 4 * 6;
|
|
12317
|
+
if (tailbits === 0) {
|
|
12318
|
+
result.push(bits >> 16 & 255);
|
|
12319
|
+
result.push(bits >> 8 & 255);
|
|
12320
|
+
result.push(bits & 255);
|
|
12321
|
+
} else if (tailbits === 18) {
|
|
12322
|
+
result.push(bits >> 10 & 255);
|
|
12323
|
+
result.push(bits >> 2 & 255);
|
|
12324
|
+
} else if (tailbits === 12) {
|
|
12325
|
+
result.push(bits >> 4 & 255);
|
|
12326
|
+
}
|
|
12327
|
+
return new Uint8Array(result);
|
|
12328
|
+
}
|
|
12329
|
+
function representYamlBinary(object) {
|
|
12330
|
+
var result = "", bits = 0, idx, tail, max = object.length, map2 = BASE64_MAP;
|
|
12331
|
+
for (idx = 0; idx < max; idx++) {
|
|
12332
|
+
if (idx % 3 === 0 && idx) {
|
|
12333
|
+
result += map2[bits >> 18 & 63];
|
|
12334
|
+
result += map2[bits >> 12 & 63];
|
|
12335
|
+
result += map2[bits >> 6 & 63];
|
|
12336
|
+
result += map2[bits & 63];
|
|
12337
|
+
}
|
|
12338
|
+
bits = (bits << 8) + object[idx];
|
|
12339
|
+
}
|
|
12340
|
+
tail = max % 3;
|
|
12341
|
+
if (tail === 0) {
|
|
12342
|
+
result += map2[bits >> 18 & 63];
|
|
12343
|
+
result += map2[bits >> 12 & 63];
|
|
12344
|
+
result += map2[bits >> 6 & 63];
|
|
12345
|
+
result += map2[bits & 63];
|
|
12346
|
+
} else if (tail === 2) {
|
|
12347
|
+
result += map2[bits >> 10 & 63];
|
|
12348
|
+
result += map2[bits >> 4 & 63];
|
|
12349
|
+
result += map2[bits << 2 & 63];
|
|
12350
|
+
result += map2[64];
|
|
12351
|
+
} else if (tail === 1) {
|
|
12352
|
+
result += map2[bits >> 2 & 63];
|
|
12353
|
+
result += map2[bits << 4 & 63];
|
|
12354
|
+
result += map2[64];
|
|
12355
|
+
result += map2[64];
|
|
12356
|
+
}
|
|
12357
|
+
return result;
|
|
12358
|
+
}
|
|
12359
|
+
function isBinary(obj) {
|
|
12360
|
+
return Object.prototype.toString.call(obj) === "[object Uint8Array]";
|
|
12361
|
+
}
|
|
12362
|
+
var binary = new type("tag:yaml.org,2002:binary", {
|
|
12363
|
+
kind: "scalar",
|
|
12364
|
+
resolve: resolveYamlBinary,
|
|
12365
|
+
construct: constructYamlBinary,
|
|
12366
|
+
predicate: isBinary,
|
|
12367
|
+
represent: representYamlBinary
|
|
12368
|
+
});
|
|
12369
|
+
var _hasOwnProperty$3 = Object.prototype.hasOwnProperty;
|
|
12370
|
+
var _toString$2 = Object.prototype.toString;
|
|
12371
|
+
function resolveYamlOmap(data) {
|
|
12372
|
+
if (data === null) return true;
|
|
12373
|
+
var objectKeys2 = [], index, length, pair, pairKey, pairHasKey, object = data;
|
|
12374
|
+
for (index = 0, length = object.length; index < length; index += 1) {
|
|
12375
|
+
pair = object[index];
|
|
12376
|
+
pairHasKey = false;
|
|
12377
|
+
if (_toString$2.call(pair) !== "[object Object]") return false;
|
|
12378
|
+
for (pairKey in pair) {
|
|
12379
|
+
if (_hasOwnProperty$3.call(pair, pairKey)) {
|
|
12380
|
+
if (!pairHasKey) pairHasKey = true;
|
|
12381
|
+
else return false;
|
|
12382
|
+
}
|
|
12383
|
+
}
|
|
12384
|
+
if (!pairHasKey) return false;
|
|
12385
|
+
if (objectKeys2.indexOf(pairKey) === -1) objectKeys2.push(pairKey);
|
|
12386
|
+
else return false;
|
|
12387
|
+
}
|
|
12388
|
+
return true;
|
|
12389
|
+
}
|
|
12390
|
+
function constructYamlOmap(data) {
|
|
12391
|
+
return data !== null ? data : [];
|
|
12392
|
+
}
|
|
12393
|
+
var omap = new type("tag:yaml.org,2002:omap", {
|
|
12394
|
+
kind: "sequence",
|
|
12395
|
+
resolve: resolveYamlOmap,
|
|
12396
|
+
construct: constructYamlOmap
|
|
12397
|
+
});
|
|
12398
|
+
var _toString$1 = Object.prototype.toString;
|
|
12399
|
+
function resolveYamlPairs(data) {
|
|
12400
|
+
if (data === null) return true;
|
|
12401
|
+
var index, length, pair, keys, result, object = data;
|
|
12402
|
+
result = new Array(object.length);
|
|
12403
|
+
for (index = 0, length = object.length; index < length; index += 1) {
|
|
12404
|
+
pair = object[index];
|
|
12405
|
+
if (_toString$1.call(pair) !== "[object Object]") return false;
|
|
12406
|
+
keys = Object.keys(pair);
|
|
12407
|
+
if (keys.length !== 1) return false;
|
|
12408
|
+
result[index] = [keys[0], pair[keys[0]]];
|
|
12409
|
+
}
|
|
12410
|
+
return true;
|
|
12411
|
+
}
|
|
12412
|
+
function constructYamlPairs(data) {
|
|
12413
|
+
if (data === null) return [];
|
|
12414
|
+
var index, length, pair, keys, result, object = data;
|
|
12415
|
+
result = new Array(object.length);
|
|
12416
|
+
for (index = 0, length = object.length; index < length; index += 1) {
|
|
12417
|
+
pair = object[index];
|
|
12418
|
+
keys = Object.keys(pair);
|
|
12419
|
+
result[index] = [keys[0], pair[keys[0]]];
|
|
12420
|
+
}
|
|
12421
|
+
return result;
|
|
12422
|
+
}
|
|
12423
|
+
var pairs = new type("tag:yaml.org,2002:pairs", {
|
|
12424
|
+
kind: "sequence",
|
|
12425
|
+
resolve: resolveYamlPairs,
|
|
12426
|
+
construct: constructYamlPairs
|
|
12427
|
+
});
|
|
12428
|
+
var _hasOwnProperty$2 = Object.prototype.hasOwnProperty;
|
|
12429
|
+
function resolveYamlSet(data) {
|
|
12430
|
+
if (data === null) return true;
|
|
12431
|
+
var key, object = data;
|
|
12432
|
+
for (key in object) {
|
|
12433
|
+
if (_hasOwnProperty$2.call(object, key)) {
|
|
12434
|
+
if (object[key] !== null) return false;
|
|
12435
|
+
}
|
|
12436
|
+
}
|
|
12437
|
+
return true;
|
|
12438
|
+
}
|
|
12439
|
+
function constructYamlSet(data) {
|
|
12440
|
+
return data !== null ? data : {};
|
|
12441
|
+
}
|
|
12442
|
+
var set = new type("tag:yaml.org,2002:set", {
|
|
12443
|
+
kind: "mapping",
|
|
12444
|
+
resolve: resolveYamlSet,
|
|
12445
|
+
construct: constructYamlSet
|
|
12446
|
+
});
|
|
12447
|
+
var _default = core.extend({
|
|
12448
|
+
implicit: [
|
|
12449
|
+
timestamp,
|
|
12450
|
+
merge
|
|
12451
|
+
],
|
|
12452
|
+
explicit: [
|
|
12453
|
+
binary,
|
|
12454
|
+
omap,
|
|
12455
|
+
pairs,
|
|
12456
|
+
set
|
|
12457
|
+
]
|
|
12458
|
+
});
|
|
12459
|
+
var _hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
12460
|
+
var CONTEXT_FLOW_IN = 1;
|
|
12461
|
+
var CONTEXT_FLOW_OUT = 2;
|
|
12462
|
+
var CONTEXT_BLOCK_IN = 3;
|
|
12463
|
+
var CONTEXT_BLOCK_OUT = 4;
|
|
12464
|
+
var CHOMPING_CLIP = 1;
|
|
12465
|
+
var CHOMPING_STRIP = 2;
|
|
12466
|
+
var CHOMPING_KEEP = 3;
|
|
12467
|
+
var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
|
|
12468
|
+
var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
|
|
12469
|
+
var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
|
|
12470
|
+
var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
|
|
12471
|
+
var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
|
|
12472
|
+
function _class(obj) {
|
|
12473
|
+
return Object.prototype.toString.call(obj);
|
|
12474
|
+
}
|
|
12475
|
+
function is_EOL(c) {
|
|
12476
|
+
return c === 10 || c === 13;
|
|
12477
|
+
}
|
|
12478
|
+
function is_WHITE_SPACE(c) {
|
|
12479
|
+
return c === 9 || c === 32;
|
|
12480
|
+
}
|
|
12481
|
+
function is_WS_OR_EOL(c) {
|
|
12482
|
+
return c === 9 || c === 32 || c === 10 || c === 13;
|
|
12483
|
+
}
|
|
12484
|
+
function is_FLOW_INDICATOR(c) {
|
|
12485
|
+
return c === 44 || c === 91 || c === 93 || c === 123 || c === 125;
|
|
12486
|
+
}
|
|
12487
|
+
function fromHexCode(c) {
|
|
12488
|
+
var lc;
|
|
12489
|
+
if (48 <= c && c <= 57) {
|
|
12490
|
+
return c - 48;
|
|
12491
|
+
}
|
|
12492
|
+
lc = c | 32;
|
|
12493
|
+
if (97 <= lc && lc <= 102) {
|
|
12494
|
+
return lc - 97 + 10;
|
|
12495
|
+
}
|
|
12496
|
+
return -1;
|
|
12497
|
+
}
|
|
12498
|
+
function escapedHexLen(c) {
|
|
12499
|
+
if (c === 120) {
|
|
12500
|
+
return 2;
|
|
12501
|
+
}
|
|
12502
|
+
if (c === 117) {
|
|
12503
|
+
return 4;
|
|
12504
|
+
}
|
|
12505
|
+
if (c === 85) {
|
|
12506
|
+
return 8;
|
|
12507
|
+
}
|
|
12508
|
+
return 0;
|
|
12509
|
+
}
|
|
12510
|
+
function fromDecimalCode(c) {
|
|
12511
|
+
if (48 <= c && c <= 57) {
|
|
12512
|
+
return c - 48;
|
|
12513
|
+
}
|
|
12514
|
+
return -1;
|
|
12515
|
+
}
|
|
12516
|
+
function simpleEscapeSequence(c) {
|
|
12517
|
+
return c === 48 ? "\0" : c === 97 ? "\x07" : c === 98 ? "\b" : c === 116 ? " " : c === 9 ? " " : c === 110 ? "\n" : c === 118 ? "\v" : c === 102 ? "\f" : c === 114 ? "\r" : c === 101 ? "\x1B" : c === 32 ? " " : c === 34 ? '"' : c === 47 ? "/" : c === 92 ? "\\" : c === 78 ? "\x85" : c === 95 ? "\xA0" : c === 76 ? "\u2028" : c === 80 ? "\u2029" : "";
|
|
12518
|
+
}
|
|
12519
|
+
function charFromCodepoint(c) {
|
|
12520
|
+
if (c <= 65535) {
|
|
12521
|
+
return String.fromCharCode(c);
|
|
12522
|
+
}
|
|
12523
|
+
return String.fromCharCode(
|
|
12524
|
+
(c - 65536 >> 10) + 55296,
|
|
12525
|
+
(c - 65536 & 1023) + 56320
|
|
12526
|
+
);
|
|
12527
|
+
}
|
|
12528
|
+
var simpleEscapeCheck = new Array(256);
|
|
12529
|
+
var simpleEscapeMap = new Array(256);
|
|
12530
|
+
for (i = 0; i < 256; i++) {
|
|
12531
|
+
simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
|
|
12532
|
+
simpleEscapeMap[i] = simpleEscapeSequence(i);
|
|
12533
|
+
}
|
|
12534
|
+
var i;
|
|
12535
|
+
function State$1(input, options) {
|
|
12536
|
+
this.input = input;
|
|
12537
|
+
this.filename = options["filename"] || null;
|
|
12538
|
+
this.schema = options["schema"] || _default;
|
|
12539
|
+
this.onWarning = options["onWarning"] || null;
|
|
12540
|
+
this.legacy = options["legacy"] || false;
|
|
12541
|
+
this.json = options["json"] || false;
|
|
12542
|
+
this.listener = options["listener"] || null;
|
|
12543
|
+
this.implicitTypes = this.schema.compiledImplicit;
|
|
12544
|
+
this.typeMap = this.schema.compiledTypeMap;
|
|
12545
|
+
this.length = input.length;
|
|
12546
|
+
this.position = 0;
|
|
12547
|
+
this.line = 0;
|
|
12548
|
+
this.lineStart = 0;
|
|
12549
|
+
this.lineIndent = 0;
|
|
12550
|
+
this.firstTabInLine = -1;
|
|
12551
|
+
this.documents = [];
|
|
12552
|
+
}
|
|
12553
|
+
function generateError(state, message) {
|
|
12554
|
+
var mark = {
|
|
12555
|
+
name: state.filename,
|
|
12556
|
+
buffer: state.input.slice(0, -1),
|
|
12557
|
+
// omit trailing \0
|
|
12558
|
+
position: state.position,
|
|
12559
|
+
line: state.line,
|
|
12560
|
+
column: state.position - state.lineStart
|
|
12561
|
+
};
|
|
12562
|
+
mark.snippet = snippet(mark);
|
|
12563
|
+
return new exception(message, mark);
|
|
12564
|
+
}
|
|
12565
|
+
function throwError(state, message) {
|
|
12566
|
+
throw generateError(state, message);
|
|
12567
|
+
}
|
|
12568
|
+
function throwWarning(state, message) {
|
|
12569
|
+
if (state.onWarning) {
|
|
12570
|
+
state.onWarning.call(null, generateError(state, message));
|
|
12571
|
+
}
|
|
12572
|
+
}
|
|
12573
|
+
var directiveHandlers = {
|
|
12574
|
+
YAML: function handleYamlDirective(state, name, args) {
|
|
12575
|
+
var match, major, minor;
|
|
12576
|
+
if (state.version !== null) {
|
|
12577
|
+
throwError(state, "duplication of %YAML directive");
|
|
12578
|
+
}
|
|
12579
|
+
if (args.length !== 1) {
|
|
12580
|
+
throwError(state, "YAML directive accepts exactly one argument");
|
|
12581
|
+
}
|
|
12582
|
+
match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
|
|
12583
|
+
if (match === null) {
|
|
12584
|
+
throwError(state, "ill-formed argument of the YAML directive");
|
|
12585
|
+
}
|
|
12586
|
+
major = parseInt(match[1], 10);
|
|
12587
|
+
minor = parseInt(match[2], 10);
|
|
12588
|
+
if (major !== 1) {
|
|
12589
|
+
throwError(state, "unacceptable YAML version of the document");
|
|
12590
|
+
}
|
|
12591
|
+
state.version = args[0];
|
|
12592
|
+
state.checkLineBreaks = minor < 2;
|
|
12593
|
+
if (minor !== 1 && minor !== 2) {
|
|
12594
|
+
throwWarning(state, "unsupported YAML version of the document");
|
|
12595
|
+
}
|
|
12596
|
+
},
|
|
12597
|
+
TAG: function handleTagDirective(state, name, args) {
|
|
12598
|
+
var handle, prefix;
|
|
12599
|
+
if (args.length !== 2) {
|
|
12600
|
+
throwError(state, "TAG directive accepts exactly two arguments");
|
|
12601
|
+
}
|
|
12602
|
+
handle = args[0];
|
|
12603
|
+
prefix = args[1];
|
|
12604
|
+
if (!PATTERN_TAG_HANDLE.test(handle)) {
|
|
12605
|
+
throwError(state, "ill-formed tag handle (first argument) of the TAG directive");
|
|
12606
|
+
}
|
|
12607
|
+
if (_hasOwnProperty$1.call(state.tagMap, handle)) {
|
|
12608
|
+
throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
|
|
12609
|
+
}
|
|
12610
|
+
if (!PATTERN_TAG_URI.test(prefix)) {
|
|
12611
|
+
throwError(state, "ill-formed tag prefix (second argument) of the TAG directive");
|
|
12612
|
+
}
|
|
12613
|
+
try {
|
|
12614
|
+
prefix = decodeURIComponent(prefix);
|
|
12615
|
+
} catch (err) {
|
|
12616
|
+
throwError(state, "tag prefix is malformed: " + prefix);
|
|
12617
|
+
}
|
|
12618
|
+
state.tagMap[handle] = prefix;
|
|
12619
|
+
}
|
|
12620
|
+
};
|
|
12621
|
+
function captureSegment(state, start, end, checkJson) {
|
|
12622
|
+
var _position, _length, _character, _result;
|
|
12623
|
+
if (start < end) {
|
|
12624
|
+
_result = state.input.slice(start, end);
|
|
12625
|
+
if (checkJson) {
|
|
12626
|
+
for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
|
|
12627
|
+
_character = _result.charCodeAt(_position);
|
|
12628
|
+
if (!(_character === 9 || 32 <= _character && _character <= 1114111)) {
|
|
12629
|
+
throwError(state, "expected valid JSON character");
|
|
12630
|
+
}
|
|
12631
|
+
}
|
|
12632
|
+
} else if (PATTERN_NON_PRINTABLE.test(_result)) {
|
|
12633
|
+
throwError(state, "the stream contains non-printable characters");
|
|
12634
|
+
}
|
|
12635
|
+
state.result += _result;
|
|
12636
|
+
}
|
|
12637
|
+
}
|
|
12638
|
+
function mergeMappings(state, destination, source, overridableKeys) {
|
|
12639
|
+
var sourceKeys, key, index, quantity;
|
|
12640
|
+
if (!common.isObject(source)) {
|
|
12641
|
+
throwError(state, "cannot merge mappings; the provided source object is unacceptable");
|
|
12642
|
+
}
|
|
12643
|
+
sourceKeys = Object.keys(source);
|
|
12644
|
+
for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
|
|
12645
|
+
key = sourceKeys[index];
|
|
12646
|
+
if (!_hasOwnProperty$1.call(destination, key)) {
|
|
12647
|
+
destination[key] = source[key];
|
|
12648
|
+
overridableKeys[key] = true;
|
|
12649
|
+
}
|
|
12650
|
+
}
|
|
12651
|
+
}
|
|
12652
|
+
function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startLineStart, startPos) {
|
|
12653
|
+
var index, quantity;
|
|
12654
|
+
if (Array.isArray(keyNode)) {
|
|
12655
|
+
keyNode = Array.prototype.slice.call(keyNode);
|
|
12656
|
+
for (index = 0, quantity = keyNode.length; index < quantity; index += 1) {
|
|
12657
|
+
if (Array.isArray(keyNode[index])) {
|
|
12658
|
+
throwError(state, "nested arrays are not supported inside keys");
|
|
12659
|
+
}
|
|
12660
|
+
if (typeof keyNode === "object" && _class(keyNode[index]) === "[object Object]") {
|
|
12661
|
+
keyNode[index] = "[object Object]";
|
|
12662
|
+
}
|
|
12663
|
+
}
|
|
12664
|
+
}
|
|
12665
|
+
if (typeof keyNode === "object" && _class(keyNode) === "[object Object]") {
|
|
12666
|
+
keyNode = "[object Object]";
|
|
12667
|
+
}
|
|
12668
|
+
keyNode = String(keyNode);
|
|
12669
|
+
if (_result === null) {
|
|
12670
|
+
_result = {};
|
|
12671
|
+
}
|
|
12672
|
+
if (keyTag === "tag:yaml.org,2002:merge") {
|
|
12673
|
+
if (Array.isArray(valueNode)) {
|
|
12674
|
+
for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
|
|
12675
|
+
mergeMappings(state, _result, valueNode[index], overridableKeys);
|
|
12676
|
+
}
|
|
12677
|
+
} else {
|
|
12678
|
+
mergeMappings(state, _result, valueNode, overridableKeys);
|
|
12679
|
+
}
|
|
12680
|
+
} else {
|
|
12681
|
+
if (!state.json && !_hasOwnProperty$1.call(overridableKeys, keyNode) && _hasOwnProperty$1.call(_result, keyNode)) {
|
|
12682
|
+
state.line = startLine || state.line;
|
|
12683
|
+
state.lineStart = startLineStart || state.lineStart;
|
|
12684
|
+
state.position = startPos || state.position;
|
|
12685
|
+
throwError(state, "duplicated mapping key");
|
|
12686
|
+
}
|
|
12687
|
+
if (keyNode === "__proto__") {
|
|
12688
|
+
Object.defineProperty(_result, keyNode, {
|
|
12689
|
+
configurable: true,
|
|
12690
|
+
enumerable: true,
|
|
12691
|
+
writable: true,
|
|
12692
|
+
value: valueNode
|
|
12693
|
+
});
|
|
12694
|
+
} else {
|
|
12695
|
+
_result[keyNode] = valueNode;
|
|
12696
|
+
}
|
|
12697
|
+
delete overridableKeys[keyNode];
|
|
12698
|
+
}
|
|
12699
|
+
return _result;
|
|
12700
|
+
}
|
|
12701
|
+
function readLineBreak(state) {
|
|
12702
|
+
var ch;
|
|
12703
|
+
ch = state.input.charCodeAt(state.position);
|
|
12704
|
+
if (ch === 10) {
|
|
12705
|
+
state.position++;
|
|
12706
|
+
} else if (ch === 13) {
|
|
12707
|
+
state.position++;
|
|
12708
|
+
if (state.input.charCodeAt(state.position) === 10) {
|
|
12709
|
+
state.position++;
|
|
12710
|
+
}
|
|
12711
|
+
} else {
|
|
12712
|
+
throwError(state, "a line break is expected");
|
|
12713
|
+
}
|
|
12714
|
+
state.line += 1;
|
|
12715
|
+
state.lineStart = state.position;
|
|
12716
|
+
state.firstTabInLine = -1;
|
|
12717
|
+
}
|
|
12718
|
+
function skipSeparationSpace(state, allowComments, checkIndent) {
|
|
12719
|
+
var lineBreaks = 0, ch = state.input.charCodeAt(state.position);
|
|
12720
|
+
while (ch !== 0) {
|
|
12721
|
+
while (is_WHITE_SPACE(ch)) {
|
|
12722
|
+
if (ch === 9 && state.firstTabInLine === -1) {
|
|
12723
|
+
state.firstTabInLine = state.position;
|
|
12724
|
+
}
|
|
12725
|
+
ch = state.input.charCodeAt(++state.position);
|
|
12726
|
+
}
|
|
12727
|
+
if (allowComments && ch === 35) {
|
|
12728
|
+
do {
|
|
12729
|
+
ch = state.input.charCodeAt(++state.position);
|
|
12730
|
+
} while (ch !== 10 && ch !== 13 && ch !== 0);
|
|
12731
|
+
}
|
|
12732
|
+
if (is_EOL(ch)) {
|
|
12733
|
+
readLineBreak(state);
|
|
12734
|
+
ch = state.input.charCodeAt(state.position);
|
|
12735
|
+
lineBreaks++;
|
|
12736
|
+
state.lineIndent = 0;
|
|
12737
|
+
while (ch === 32) {
|
|
12738
|
+
state.lineIndent++;
|
|
12739
|
+
ch = state.input.charCodeAt(++state.position);
|
|
12740
|
+
}
|
|
12741
|
+
} else {
|
|
12742
|
+
break;
|
|
12743
|
+
}
|
|
12744
|
+
}
|
|
12745
|
+
if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {
|
|
12746
|
+
throwWarning(state, "deficient indentation");
|
|
12747
|
+
}
|
|
12748
|
+
return lineBreaks;
|
|
12749
|
+
}
|
|
12750
|
+
function testDocumentSeparator(state) {
|
|
12751
|
+
var _position = state.position, ch;
|
|
12752
|
+
ch = state.input.charCodeAt(_position);
|
|
12753
|
+
if ((ch === 45 || ch === 46) && ch === state.input.charCodeAt(_position + 1) && ch === state.input.charCodeAt(_position + 2)) {
|
|
12754
|
+
_position += 3;
|
|
12755
|
+
ch = state.input.charCodeAt(_position);
|
|
12756
|
+
if (ch === 0 || is_WS_OR_EOL(ch)) {
|
|
12757
|
+
return true;
|
|
12758
|
+
}
|
|
12759
|
+
}
|
|
12760
|
+
return false;
|
|
12761
|
+
}
|
|
12762
|
+
function writeFoldedLines(state, count) {
|
|
12763
|
+
if (count === 1) {
|
|
12764
|
+
state.result += " ";
|
|
12765
|
+
} else if (count > 1) {
|
|
12766
|
+
state.result += common.repeat("\n", count - 1);
|
|
12767
|
+
}
|
|
12768
|
+
}
|
|
12769
|
+
function readPlainScalar(state, nodeIndent, withinFlowCollection) {
|
|
12770
|
+
var preceding, following, captureStart, captureEnd, hasPendingContent, _line, _lineStart, _lineIndent, _kind = state.kind, _result = state.result, ch;
|
|
12771
|
+
ch = state.input.charCodeAt(state.position);
|
|
12772
|
+
if (is_WS_OR_EOL(ch) || is_FLOW_INDICATOR(ch) || ch === 35 || ch === 38 || ch === 42 || ch === 33 || ch === 124 || ch === 62 || ch === 39 || ch === 34 || ch === 37 || ch === 64 || ch === 96) {
|
|
12773
|
+
return false;
|
|
12774
|
+
}
|
|
12775
|
+
if (ch === 63 || ch === 45) {
|
|
12776
|
+
following = state.input.charCodeAt(state.position + 1);
|
|
12777
|
+
if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
|
|
12778
|
+
return false;
|
|
12779
|
+
}
|
|
12780
|
+
}
|
|
12781
|
+
state.kind = "scalar";
|
|
12782
|
+
state.result = "";
|
|
12783
|
+
captureStart = captureEnd = state.position;
|
|
12784
|
+
hasPendingContent = false;
|
|
12785
|
+
while (ch !== 0) {
|
|
12786
|
+
if (ch === 58) {
|
|
12787
|
+
following = state.input.charCodeAt(state.position + 1);
|
|
12788
|
+
if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
|
|
12789
|
+
break;
|
|
12790
|
+
}
|
|
12791
|
+
} else if (ch === 35) {
|
|
12792
|
+
preceding = state.input.charCodeAt(state.position - 1);
|
|
12793
|
+
if (is_WS_OR_EOL(preceding)) {
|
|
12794
|
+
break;
|
|
12795
|
+
}
|
|
12796
|
+
} else if (state.position === state.lineStart && testDocumentSeparator(state) || withinFlowCollection && is_FLOW_INDICATOR(ch)) {
|
|
12797
|
+
break;
|
|
12798
|
+
} else if (is_EOL(ch)) {
|
|
12799
|
+
_line = state.line;
|
|
12800
|
+
_lineStart = state.lineStart;
|
|
12801
|
+
_lineIndent = state.lineIndent;
|
|
12802
|
+
skipSeparationSpace(state, false, -1);
|
|
12803
|
+
if (state.lineIndent >= nodeIndent) {
|
|
12804
|
+
hasPendingContent = true;
|
|
12805
|
+
ch = state.input.charCodeAt(state.position);
|
|
12806
|
+
continue;
|
|
12807
|
+
} else {
|
|
12808
|
+
state.position = captureEnd;
|
|
12809
|
+
state.line = _line;
|
|
12810
|
+
state.lineStart = _lineStart;
|
|
12811
|
+
state.lineIndent = _lineIndent;
|
|
12812
|
+
break;
|
|
12813
|
+
}
|
|
12814
|
+
}
|
|
12815
|
+
if (hasPendingContent) {
|
|
12816
|
+
captureSegment(state, captureStart, captureEnd, false);
|
|
12817
|
+
writeFoldedLines(state, state.line - _line);
|
|
12818
|
+
captureStart = captureEnd = state.position;
|
|
12819
|
+
hasPendingContent = false;
|
|
12820
|
+
}
|
|
12821
|
+
if (!is_WHITE_SPACE(ch)) {
|
|
12822
|
+
captureEnd = state.position + 1;
|
|
12823
|
+
}
|
|
12824
|
+
ch = state.input.charCodeAt(++state.position);
|
|
12825
|
+
}
|
|
12826
|
+
captureSegment(state, captureStart, captureEnd, false);
|
|
12827
|
+
if (state.result) {
|
|
12828
|
+
return true;
|
|
12829
|
+
}
|
|
12830
|
+
state.kind = _kind;
|
|
12831
|
+
state.result = _result;
|
|
12832
|
+
return false;
|
|
12833
|
+
}
|
|
12834
|
+
function readSingleQuotedScalar(state, nodeIndent) {
|
|
12835
|
+
var ch, captureStart, captureEnd;
|
|
12836
|
+
ch = state.input.charCodeAt(state.position);
|
|
12837
|
+
if (ch !== 39) {
|
|
12838
|
+
return false;
|
|
12839
|
+
}
|
|
12840
|
+
state.kind = "scalar";
|
|
12841
|
+
state.result = "";
|
|
12842
|
+
state.position++;
|
|
12843
|
+
captureStart = captureEnd = state.position;
|
|
12844
|
+
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
12845
|
+
if (ch === 39) {
|
|
12846
|
+
captureSegment(state, captureStart, state.position, true);
|
|
12847
|
+
ch = state.input.charCodeAt(++state.position);
|
|
12848
|
+
if (ch === 39) {
|
|
12849
|
+
captureStart = state.position;
|
|
12850
|
+
state.position++;
|
|
12851
|
+
captureEnd = state.position;
|
|
12852
|
+
} else {
|
|
12853
|
+
return true;
|
|
12854
|
+
}
|
|
12855
|
+
} else if (is_EOL(ch)) {
|
|
12856
|
+
captureSegment(state, captureStart, captureEnd, true);
|
|
12857
|
+
writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
|
|
12858
|
+
captureStart = captureEnd = state.position;
|
|
12859
|
+
} else if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
12860
|
+
throwError(state, "unexpected end of the document within a single quoted scalar");
|
|
12861
|
+
} else {
|
|
12862
|
+
state.position++;
|
|
12863
|
+
captureEnd = state.position;
|
|
12864
|
+
}
|
|
12865
|
+
}
|
|
12866
|
+
throwError(state, "unexpected end of the stream within a single quoted scalar");
|
|
12867
|
+
}
|
|
12868
|
+
function readDoubleQuotedScalar(state, nodeIndent) {
|
|
12869
|
+
var captureStart, captureEnd, hexLength, hexResult, tmp, ch;
|
|
12870
|
+
ch = state.input.charCodeAt(state.position);
|
|
12871
|
+
if (ch !== 34) {
|
|
12872
|
+
return false;
|
|
12873
|
+
}
|
|
12874
|
+
state.kind = "scalar";
|
|
12875
|
+
state.result = "";
|
|
12876
|
+
state.position++;
|
|
12877
|
+
captureStart = captureEnd = state.position;
|
|
12878
|
+
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
12879
|
+
if (ch === 34) {
|
|
12880
|
+
captureSegment(state, captureStart, state.position, true);
|
|
12881
|
+
state.position++;
|
|
12882
|
+
return true;
|
|
12883
|
+
} else if (ch === 92) {
|
|
12884
|
+
captureSegment(state, captureStart, state.position, true);
|
|
12885
|
+
ch = state.input.charCodeAt(++state.position);
|
|
12886
|
+
if (is_EOL(ch)) {
|
|
12887
|
+
skipSeparationSpace(state, false, nodeIndent);
|
|
12888
|
+
} else if (ch < 256 && simpleEscapeCheck[ch]) {
|
|
12889
|
+
state.result += simpleEscapeMap[ch];
|
|
12890
|
+
state.position++;
|
|
12891
|
+
} else if ((tmp = escapedHexLen(ch)) > 0) {
|
|
12892
|
+
hexLength = tmp;
|
|
12893
|
+
hexResult = 0;
|
|
12894
|
+
for (; hexLength > 0; hexLength--) {
|
|
12895
|
+
ch = state.input.charCodeAt(++state.position);
|
|
12896
|
+
if ((tmp = fromHexCode(ch)) >= 0) {
|
|
12897
|
+
hexResult = (hexResult << 4) + tmp;
|
|
12898
|
+
} else {
|
|
12899
|
+
throwError(state, "expected hexadecimal character");
|
|
12900
|
+
}
|
|
12901
|
+
}
|
|
12902
|
+
state.result += charFromCodepoint(hexResult);
|
|
12903
|
+
state.position++;
|
|
12904
|
+
} else {
|
|
12905
|
+
throwError(state, "unknown escape sequence");
|
|
12906
|
+
}
|
|
12907
|
+
captureStart = captureEnd = state.position;
|
|
12908
|
+
} else if (is_EOL(ch)) {
|
|
12909
|
+
captureSegment(state, captureStart, captureEnd, true);
|
|
12910
|
+
writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
|
|
12911
|
+
captureStart = captureEnd = state.position;
|
|
12912
|
+
} else if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
12913
|
+
throwError(state, "unexpected end of the document within a double quoted scalar");
|
|
12914
|
+
} else {
|
|
12915
|
+
state.position++;
|
|
12916
|
+
captureEnd = state.position;
|
|
12917
|
+
}
|
|
12918
|
+
}
|
|
12919
|
+
throwError(state, "unexpected end of the stream within a double quoted scalar");
|
|
12920
|
+
}
|
|
12921
|
+
function readFlowCollection(state, nodeIndent) {
|
|
12922
|
+
var readNext = true, _line, _lineStart, _pos, _tag = state.tag, _result, _anchor = state.anchor, following, terminator, isPair, isExplicitPair, isMapping, overridableKeys = /* @__PURE__ */ Object.create(null), keyNode, keyTag, valueNode, ch;
|
|
12923
|
+
ch = state.input.charCodeAt(state.position);
|
|
12924
|
+
if (ch === 91) {
|
|
12925
|
+
terminator = 93;
|
|
12926
|
+
isMapping = false;
|
|
12927
|
+
_result = [];
|
|
12928
|
+
} else if (ch === 123) {
|
|
12929
|
+
terminator = 125;
|
|
12930
|
+
isMapping = true;
|
|
12931
|
+
_result = {};
|
|
12932
|
+
} else {
|
|
12933
|
+
return false;
|
|
12934
|
+
}
|
|
12935
|
+
if (state.anchor !== null) {
|
|
12936
|
+
state.anchorMap[state.anchor] = _result;
|
|
12937
|
+
}
|
|
12938
|
+
ch = state.input.charCodeAt(++state.position);
|
|
12939
|
+
while (ch !== 0) {
|
|
12940
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
12941
|
+
ch = state.input.charCodeAt(state.position);
|
|
12942
|
+
if (ch === terminator) {
|
|
12943
|
+
state.position++;
|
|
12944
|
+
state.tag = _tag;
|
|
12945
|
+
state.anchor = _anchor;
|
|
12946
|
+
state.kind = isMapping ? "mapping" : "sequence";
|
|
12947
|
+
state.result = _result;
|
|
12948
|
+
return true;
|
|
12949
|
+
} else if (!readNext) {
|
|
12950
|
+
throwError(state, "missed comma between flow collection entries");
|
|
12951
|
+
} else if (ch === 44) {
|
|
12952
|
+
throwError(state, "expected the node content, but found ','");
|
|
12953
|
+
}
|
|
12954
|
+
keyTag = keyNode = valueNode = null;
|
|
12955
|
+
isPair = isExplicitPair = false;
|
|
12956
|
+
if (ch === 63) {
|
|
12957
|
+
following = state.input.charCodeAt(state.position + 1);
|
|
12958
|
+
if (is_WS_OR_EOL(following)) {
|
|
12959
|
+
isPair = isExplicitPair = true;
|
|
12960
|
+
state.position++;
|
|
12961
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
12962
|
+
}
|
|
12963
|
+
}
|
|
12964
|
+
_line = state.line;
|
|
12965
|
+
_lineStart = state.lineStart;
|
|
12966
|
+
_pos = state.position;
|
|
12967
|
+
composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
|
12968
|
+
keyTag = state.tag;
|
|
12969
|
+
keyNode = state.result;
|
|
12970
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
12971
|
+
ch = state.input.charCodeAt(state.position);
|
|
12972
|
+
if ((isExplicitPair || state.line === _line) && ch === 58) {
|
|
12973
|
+
isPair = true;
|
|
12974
|
+
ch = state.input.charCodeAt(++state.position);
|
|
12975
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
12976
|
+
composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
|
12977
|
+
valueNode = state.result;
|
|
12978
|
+
}
|
|
12979
|
+
if (isMapping) {
|
|
12980
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos);
|
|
12981
|
+
} else if (isPair) {
|
|
12982
|
+
_result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos));
|
|
12983
|
+
} else {
|
|
12984
|
+
_result.push(keyNode);
|
|
12985
|
+
}
|
|
12986
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
12987
|
+
ch = state.input.charCodeAt(state.position);
|
|
12988
|
+
if (ch === 44) {
|
|
12989
|
+
readNext = true;
|
|
12990
|
+
ch = state.input.charCodeAt(++state.position);
|
|
12991
|
+
} else {
|
|
12992
|
+
readNext = false;
|
|
12993
|
+
}
|
|
12994
|
+
}
|
|
12995
|
+
throwError(state, "unexpected end of the stream within a flow collection");
|
|
12996
|
+
}
|
|
12997
|
+
function readBlockScalar(state, nodeIndent) {
|
|
12998
|
+
var captureStart, folding, chomping = CHOMPING_CLIP, didReadContent = false, detectedIndent = false, textIndent = nodeIndent, emptyLines = 0, atMoreIndented = false, tmp, ch;
|
|
12999
|
+
ch = state.input.charCodeAt(state.position);
|
|
13000
|
+
if (ch === 124) {
|
|
13001
|
+
folding = false;
|
|
13002
|
+
} else if (ch === 62) {
|
|
13003
|
+
folding = true;
|
|
13004
|
+
} else {
|
|
13005
|
+
return false;
|
|
13006
|
+
}
|
|
13007
|
+
state.kind = "scalar";
|
|
13008
|
+
state.result = "";
|
|
13009
|
+
while (ch !== 0) {
|
|
13010
|
+
ch = state.input.charCodeAt(++state.position);
|
|
13011
|
+
if (ch === 43 || ch === 45) {
|
|
13012
|
+
if (CHOMPING_CLIP === chomping) {
|
|
13013
|
+
chomping = ch === 43 ? CHOMPING_KEEP : CHOMPING_STRIP;
|
|
13014
|
+
} else {
|
|
13015
|
+
throwError(state, "repeat of a chomping mode identifier");
|
|
13016
|
+
}
|
|
13017
|
+
} else if ((tmp = fromDecimalCode(ch)) >= 0) {
|
|
13018
|
+
if (tmp === 0) {
|
|
13019
|
+
throwError(state, "bad explicit indentation width of a block scalar; it cannot be less than one");
|
|
13020
|
+
} else if (!detectedIndent) {
|
|
13021
|
+
textIndent = nodeIndent + tmp - 1;
|
|
13022
|
+
detectedIndent = true;
|
|
13023
|
+
} else {
|
|
13024
|
+
throwError(state, "repeat of an indentation width identifier");
|
|
13025
|
+
}
|
|
13026
|
+
} else {
|
|
13027
|
+
break;
|
|
13028
|
+
}
|
|
13029
|
+
}
|
|
13030
|
+
if (is_WHITE_SPACE(ch)) {
|
|
13031
|
+
do {
|
|
13032
|
+
ch = state.input.charCodeAt(++state.position);
|
|
13033
|
+
} while (is_WHITE_SPACE(ch));
|
|
13034
|
+
if (ch === 35) {
|
|
13035
|
+
do {
|
|
13036
|
+
ch = state.input.charCodeAt(++state.position);
|
|
13037
|
+
} while (!is_EOL(ch) && ch !== 0);
|
|
13038
|
+
}
|
|
13039
|
+
}
|
|
13040
|
+
while (ch !== 0) {
|
|
13041
|
+
readLineBreak(state);
|
|
13042
|
+
state.lineIndent = 0;
|
|
13043
|
+
ch = state.input.charCodeAt(state.position);
|
|
13044
|
+
while ((!detectedIndent || state.lineIndent < textIndent) && ch === 32) {
|
|
13045
|
+
state.lineIndent++;
|
|
13046
|
+
ch = state.input.charCodeAt(++state.position);
|
|
13047
|
+
}
|
|
13048
|
+
if (!detectedIndent && state.lineIndent > textIndent) {
|
|
13049
|
+
textIndent = state.lineIndent;
|
|
13050
|
+
}
|
|
13051
|
+
if (is_EOL(ch)) {
|
|
13052
|
+
emptyLines++;
|
|
13053
|
+
continue;
|
|
13054
|
+
}
|
|
13055
|
+
if (state.lineIndent < textIndent) {
|
|
13056
|
+
if (chomping === CHOMPING_KEEP) {
|
|
13057
|
+
state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
|
13058
|
+
} else if (chomping === CHOMPING_CLIP) {
|
|
13059
|
+
if (didReadContent) {
|
|
13060
|
+
state.result += "\n";
|
|
13061
|
+
}
|
|
13062
|
+
}
|
|
13063
|
+
break;
|
|
13064
|
+
}
|
|
13065
|
+
if (folding) {
|
|
13066
|
+
if (is_WHITE_SPACE(ch)) {
|
|
13067
|
+
atMoreIndented = true;
|
|
13068
|
+
state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
|
13069
|
+
} else if (atMoreIndented) {
|
|
13070
|
+
atMoreIndented = false;
|
|
13071
|
+
state.result += common.repeat("\n", emptyLines + 1);
|
|
13072
|
+
} else if (emptyLines === 0) {
|
|
13073
|
+
if (didReadContent) {
|
|
13074
|
+
state.result += " ";
|
|
13075
|
+
}
|
|
13076
|
+
} else {
|
|
13077
|
+
state.result += common.repeat("\n", emptyLines);
|
|
13078
|
+
}
|
|
13079
|
+
} else {
|
|
13080
|
+
state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
|
13081
|
+
}
|
|
13082
|
+
didReadContent = true;
|
|
13083
|
+
detectedIndent = true;
|
|
13084
|
+
emptyLines = 0;
|
|
13085
|
+
captureStart = state.position;
|
|
13086
|
+
while (!is_EOL(ch) && ch !== 0) {
|
|
13087
|
+
ch = state.input.charCodeAt(++state.position);
|
|
13088
|
+
}
|
|
13089
|
+
captureSegment(state, captureStart, state.position, false);
|
|
13090
|
+
}
|
|
13091
|
+
return true;
|
|
13092
|
+
}
|
|
13093
|
+
function readBlockSequence(state, nodeIndent) {
|
|
13094
|
+
var _line, _tag = state.tag, _anchor = state.anchor, _result = [], following, detected = false, ch;
|
|
13095
|
+
if (state.firstTabInLine !== -1) return false;
|
|
13096
|
+
if (state.anchor !== null) {
|
|
13097
|
+
state.anchorMap[state.anchor] = _result;
|
|
13098
|
+
}
|
|
13099
|
+
ch = state.input.charCodeAt(state.position);
|
|
13100
|
+
while (ch !== 0) {
|
|
13101
|
+
if (state.firstTabInLine !== -1) {
|
|
13102
|
+
state.position = state.firstTabInLine;
|
|
13103
|
+
throwError(state, "tab characters must not be used in indentation");
|
|
13104
|
+
}
|
|
13105
|
+
if (ch !== 45) {
|
|
13106
|
+
break;
|
|
13107
|
+
}
|
|
13108
|
+
following = state.input.charCodeAt(state.position + 1);
|
|
13109
|
+
if (!is_WS_OR_EOL(following)) {
|
|
13110
|
+
break;
|
|
13111
|
+
}
|
|
13112
|
+
detected = true;
|
|
13113
|
+
state.position++;
|
|
13114
|
+
if (skipSeparationSpace(state, true, -1)) {
|
|
13115
|
+
if (state.lineIndent <= nodeIndent) {
|
|
13116
|
+
_result.push(null);
|
|
13117
|
+
ch = state.input.charCodeAt(state.position);
|
|
13118
|
+
continue;
|
|
13119
|
+
}
|
|
13120
|
+
}
|
|
13121
|
+
_line = state.line;
|
|
13122
|
+
composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
|
|
13123
|
+
_result.push(state.result);
|
|
13124
|
+
skipSeparationSpace(state, true, -1);
|
|
13125
|
+
ch = state.input.charCodeAt(state.position);
|
|
13126
|
+
if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
|
|
13127
|
+
throwError(state, "bad indentation of a sequence entry");
|
|
13128
|
+
} else if (state.lineIndent < nodeIndent) {
|
|
13129
|
+
break;
|
|
13130
|
+
}
|
|
13131
|
+
}
|
|
13132
|
+
if (detected) {
|
|
13133
|
+
state.tag = _tag;
|
|
13134
|
+
state.anchor = _anchor;
|
|
13135
|
+
state.kind = "sequence";
|
|
13136
|
+
state.result = _result;
|
|
13137
|
+
return true;
|
|
13138
|
+
}
|
|
13139
|
+
return false;
|
|
13140
|
+
}
|
|
13141
|
+
function readBlockMapping(state, nodeIndent, flowIndent) {
|
|
13142
|
+
var following, allowCompact, _line, _keyLine, _keyLineStart, _keyPos, _tag = state.tag, _anchor = state.anchor, _result = {}, overridableKeys = /* @__PURE__ */ Object.create(null), keyTag = null, keyNode = null, valueNode = null, atExplicitKey = false, detected = false, ch;
|
|
13143
|
+
if (state.firstTabInLine !== -1) return false;
|
|
13144
|
+
if (state.anchor !== null) {
|
|
13145
|
+
state.anchorMap[state.anchor] = _result;
|
|
13146
|
+
}
|
|
13147
|
+
ch = state.input.charCodeAt(state.position);
|
|
13148
|
+
while (ch !== 0) {
|
|
13149
|
+
if (!atExplicitKey && state.firstTabInLine !== -1) {
|
|
13150
|
+
state.position = state.firstTabInLine;
|
|
13151
|
+
throwError(state, "tab characters must not be used in indentation");
|
|
13152
|
+
}
|
|
13153
|
+
following = state.input.charCodeAt(state.position + 1);
|
|
13154
|
+
_line = state.line;
|
|
13155
|
+
if ((ch === 63 || ch === 58) && is_WS_OR_EOL(following)) {
|
|
13156
|
+
if (ch === 63) {
|
|
13157
|
+
if (atExplicitKey) {
|
|
13158
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
|
13159
|
+
keyTag = keyNode = valueNode = null;
|
|
13160
|
+
}
|
|
13161
|
+
detected = true;
|
|
13162
|
+
atExplicitKey = true;
|
|
13163
|
+
allowCompact = true;
|
|
13164
|
+
} else if (atExplicitKey) {
|
|
13165
|
+
atExplicitKey = false;
|
|
13166
|
+
allowCompact = true;
|
|
13167
|
+
} else {
|
|
13168
|
+
throwError(state, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");
|
|
13169
|
+
}
|
|
13170
|
+
state.position += 1;
|
|
13171
|
+
ch = following;
|
|
13172
|
+
} else {
|
|
13173
|
+
_keyLine = state.line;
|
|
13174
|
+
_keyLineStart = state.lineStart;
|
|
13175
|
+
_keyPos = state.position;
|
|
13176
|
+
if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
|
|
13177
|
+
break;
|
|
13178
|
+
}
|
|
13179
|
+
if (state.line === _line) {
|
|
13180
|
+
ch = state.input.charCodeAt(state.position);
|
|
13181
|
+
while (is_WHITE_SPACE(ch)) {
|
|
13182
|
+
ch = state.input.charCodeAt(++state.position);
|
|
13183
|
+
}
|
|
13184
|
+
if (ch === 58) {
|
|
13185
|
+
ch = state.input.charCodeAt(++state.position);
|
|
13186
|
+
if (!is_WS_OR_EOL(ch)) {
|
|
13187
|
+
throwError(state, "a whitespace character is expected after the key-value separator within a block mapping");
|
|
13188
|
+
}
|
|
13189
|
+
if (atExplicitKey) {
|
|
13190
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
|
13191
|
+
keyTag = keyNode = valueNode = null;
|
|
13192
|
+
}
|
|
13193
|
+
detected = true;
|
|
13194
|
+
atExplicitKey = false;
|
|
13195
|
+
allowCompact = false;
|
|
13196
|
+
keyTag = state.tag;
|
|
13197
|
+
keyNode = state.result;
|
|
13198
|
+
} else if (detected) {
|
|
13199
|
+
throwError(state, "can not read an implicit mapping pair; a colon is missed");
|
|
13200
|
+
} else {
|
|
13201
|
+
state.tag = _tag;
|
|
13202
|
+
state.anchor = _anchor;
|
|
13203
|
+
return true;
|
|
13204
|
+
}
|
|
13205
|
+
} else if (detected) {
|
|
13206
|
+
throwError(state, "can not read a block mapping entry; a multiline key may not be an implicit key");
|
|
13207
|
+
} else {
|
|
13208
|
+
state.tag = _tag;
|
|
13209
|
+
state.anchor = _anchor;
|
|
13210
|
+
return true;
|
|
13211
|
+
}
|
|
13212
|
+
}
|
|
13213
|
+
if (state.line === _line || state.lineIndent > nodeIndent) {
|
|
13214
|
+
if (atExplicitKey) {
|
|
13215
|
+
_keyLine = state.line;
|
|
13216
|
+
_keyLineStart = state.lineStart;
|
|
13217
|
+
_keyPos = state.position;
|
|
13218
|
+
}
|
|
13219
|
+
if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
|
|
13220
|
+
if (atExplicitKey) {
|
|
13221
|
+
keyNode = state.result;
|
|
13222
|
+
} else {
|
|
13223
|
+
valueNode = state.result;
|
|
13224
|
+
}
|
|
13225
|
+
}
|
|
13226
|
+
if (!atExplicitKey) {
|
|
13227
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos);
|
|
13228
|
+
keyTag = keyNode = valueNode = null;
|
|
13229
|
+
}
|
|
13230
|
+
skipSeparationSpace(state, true, -1);
|
|
13231
|
+
ch = state.input.charCodeAt(state.position);
|
|
13232
|
+
}
|
|
13233
|
+
if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
|
|
13234
|
+
throwError(state, "bad indentation of a mapping entry");
|
|
13235
|
+
} else if (state.lineIndent < nodeIndent) {
|
|
13236
|
+
break;
|
|
13237
|
+
}
|
|
13238
|
+
}
|
|
13239
|
+
if (atExplicitKey) {
|
|
13240
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
|
13241
|
+
}
|
|
13242
|
+
if (detected) {
|
|
13243
|
+
state.tag = _tag;
|
|
13244
|
+
state.anchor = _anchor;
|
|
13245
|
+
state.kind = "mapping";
|
|
13246
|
+
state.result = _result;
|
|
13247
|
+
}
|
|
13248
|
+
return detected;
|
|
13249
|
+
}
|
|
13250
|
+
function readTagProperty(state) {
|
|
13251
|
+
var _position, isVerbatim = false, isNamed = false, tagHandle, tagName, ch;
|
|
13252
|
+
ch = state.input.charCodeAt(state.position);
|
|
13253
|
+
if (ch !== 33) return false;
|
|
13254
|
+
if (state.tag !== null) {
|
|
13255
|
+
throwError(state, "duplication of a tag property");
|
|
13256
|
+
}
|
|
13257
|
+
ch = state.input.charCodeAt(++state.position);
|
|
13258
|
+
if (ch === 60) {
|
|
13259
|
+
isVerbatim = true;
|
|
13260
|
+
ch = state.input.charCodeAt(++state.position);
|
|
13261
|
+
} else if (ch === 33) {
|
|
13262
|
+
isNamed = true;
|
|
13263
|
+
tagHandle = "!!";
|
|
13264
|
+
ch = state.input.charCodeAt(++state.position);
|
|
13265
|
+
} else {
|
|
13266
|
+
tagHandle = "!";
|
|
13267
|
+
}
|
|
13268
|
+
_position = state.position;
|
|
13269
|
+
if (isVerbatim) {
|
|
13270
|
+
do {
|
|
13271
|
+
ch = state.input.charCodeAt(++state.position);
|
|
13272
|
+
} while (ch !== 0 && ch !== 62);
|
|
13273
|
+
if (state.position < state.length) {
|
|
13274
|
+
tagName = state.input.slice(_position, state.position);
|
|
13275
|
+
ch = state.input.charCodeAt(++state.position);
|
|
13276
|
+
} else {
|
|
13277
|
+
throwError(state, "unexpected end of the stream within a verbatim tag");
|
|
13278
|
+
}
|
|
13279
|
+
} else {
|
|
13280
|
+
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
|
13281
|
+
if (ch === 33) {
|
|
13282
|
+
if (!isNamed) {
|
|
13283
|
+
tagHandle = state.input.slice(_position - 1, state.position + 1);
|
|
13284
|
+
if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
|
|
13285
|
+
throwError(state, "named tag handle cannot contain such characters");
|
|
13286
|
+
}
|
|
13287
|
+
isNamed = true;
|
|
13288
|
+
_position = state.position + 1;
|
|
13289
|
+
} else {
|
|
13290
|
+
throwError(state, "tag suffix cannot contain exclamation marks");
|
|
13291
|
+
}
|
|
13292
|
+
}
|
|
13293
|
+
ch = state.input.charCodeAt(++state.position);
|
|
13294
|
+
}
|
|
13295
|
+
tagName = state.input.slice(_position, state.position);
|
|
13296
|
+
if (PATTERN_FLOW_INDICATORS.test(tagName)) {
|
|
13297
|
+
throwError(state, "tag suffix cannot contain flow indicator characters");
|
|
13298
|
+
}
|
|
13299
|
+
}
|
|
13300
|
+
if (tagName && !PATTERN_TAG_URI.test(tagName)) {
|
|
13301
|
+
throwError(state, "tag name cannot contain such characters: " + tagName);
|
|
13302
|
+
}
|
|
13303
|
+
try {
|
|
13304
|
+
tagName = decodeURIComponent(tagName);
|
|
13305
|
+
} catch (err) {
|
|
13306
|
+
throwError(state, "tag name is malformed: " + tagName);
|
|
13307
|
+
}
|
|
13308
|
+
if (isVerbatim) {
|
|
13309
|
+
state.tag = tagName;
|
|
13310
|
+
} else if (_hasOwnProperty$1.call(state.tagMap, tagHandle)) {
|
|
13311
|
+
state.tag = state.tagMap[tagHandle] + tagName;
|
|
13312
|
+
} else if (tagHandle === "!") {
|
|
13313
|
+
state.tag = "!" + tagName;
|
|
13314
|
+
} else if (tagHandle === "!!") {
|
|
13315
|
+
state.tag = "tag:yaml.org,2002:" + tagName;
|
|
13316
|
+
} else {
|
|
13317
|
+
throwError(state, 'undeclared tag handle "' + tagHandle + '"');
|
|
13318
|
+
}
|
|
13319
|
+
return true;
|
|
13320
|
+
}
|
|
13321
|
+
function readAnchorProperty(state) {
|
|
13322
|
+
var _position, ch;
|
|
13323
|
+
ch = state.input.charCodeAt(state.position);
|
|
13324
|
+
if (ch !== 38) return false;
|
|
13325
|
+
if (state.anchor !== null) {
|
|
13326
|
+
throwError(state, "duplication of an anchor property");
|
|
13327
|
+
}
|
|
13328
|
+
ch = state.input.charCodeAt(++state.position);
|
|
13329
|
+
_position = state.position;
|
|
13330
|
+
while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
|
|
13331
|
+
ch = state.input.charCodeAt(++state.position);
|
|
13332
|
+
}
|
|
13333
|
+
if (state.position === _position) {
|
|
13334
|
+
throwError(state, "name of an anchor node must contain at least one character");
|
|
13335
|
+
}
|
|
13336
|
+
state.anchor = state.input.slice(_position, state.position);
|
|
13337
|
+
return true;
|
|
13338
|
+
}
|
|
13339
|
+
function readAlias(state) {
|
|
13340
|
+
var _position, alias, ch;
|
|
13341
|
+
ch = state.input.charCodeAt(state.position);
|
|
13342
|
+
if (ch !== 42) return false;
|
|
13343
|
+
ch = state.input.charCodeAt(++state.position);
|
|
13344
|
+
_position = state.position;
|
|
13345
|
+
while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
|
|
13346
|
+
ch = state.input.charCodeAt(++state.position);
|
|
13347
|
+
}
|
|
13348
|
+
if (state.position === _position) {
|
|
13349
|
+
throwError(state, "name of an alias node must contain at least one character");
|
|
13350
|
+
}
|
|
13351
|
+
alias = state.input.slice(_position, state.position);
|
|
13352
|
+
if (!_hasOwnProperty$1.call(state.anchorMap, alias)) {
|
|
13353
|
+
throwError(state, 'unidentified alias "' + alias + '"');
|
|
13354
|
+
}
|
|
13355
|
+
state.result = state.anchorMap[alias];
|
|
13356
|
+
skipSeparationSpace(state, true, -1);
|
|
13357
|
+
return true;
|
|
13358
|
+
}
|
|
13359
|
+
function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
|
|
13360
|
+
var allowBlockStyles, allowBlockScalars, allowBlockCollections, indentStatus = 1, atNewLine = false, hasContent = false, typeIndex, typeQuantity, typeList, type2, flowIndent, blockIndent;
|
|
13361
|
+
if (state.listener !== null) {
|
|
13362
|
+
state.listener("open", state);
|
|
13363
|
+
}
|
|
13364
|
+
state.tag = null;
|
|
13365
|
+
state.anchor = null;
|
|
13366
|
+
state.kind = null;
|
|
13367
|
+
state.result = null;
|
|
13368
|
+
allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext;
|
|
13369
|
+
if (allowToSeek) {
|
|
13370
|
+
if (skipSeparationSpace(state, true, -1)) {
|
|
13371
|
+
atNewLine = true;
|
|
13372
|
+
if (state.lineIndent > parentIndent) {
|
|
13373
|
+
indentStatus = 1;
|
|
13374
|
+
} else if (state.lineIndent === parentIndent) {
|
|
13375
|
+
indentStatus = 0;
|
|
13376
|
+
} else if (state.lineIndent < parentIndent) {
|
|
13377
|
+
indentStatus = -1;
|
|
13378
|
+
}
|
|
13379
|
+
}
|
|
13380
|
+
}
|
|
13381
|
+
if (indentStatus === 1) {
|
|
13382
|
+
while (readTagProperty(state) || readAnchorProperty(state)) {
|
|
13383
|
+
if (skipSeparationSpace(state, true, -1)) {
|
|
13384
|
+
atNewLine = true;
|
|
13385
|
+
allowBlockCollections = allowBlockStyles;
|
|
13386
|
+
if (state.lineIndent > parentIndent) {
|
|
13387
|
+
indentStatus = 1;
|
|
13388
|
+
} else if (state.lineIndent === parentIndent) {
|
|
13389
|
+
indentStatus = 0;
|
|
13390
|
+
} else if (state.lineIndent < parentIndent) {
|
|
13391
|
+
indentStatus = -1;
|
|
13392
|
+
}
|
|
13393
|
+
} else {
|
|
13394
|
+
allowBlockCollections = false;
|
|
13395
|
+
}
|
|
13396
|
+
}
|
|
13397
|
+
}
|
|
13398
|
+
if (allowBlockCollections) {
|
|
13399
|
+
allowBlockCollections = atNewLine || allowCompact;
|
|
13400
|
+
}
|
|
13401
|
+
if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
|
|
13402
|
+
if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
|
|
13403
|
+
flowIndent = parentIndent;
|
|
13404
|
+
} else {
|
|
13405
|
+
flowIndent = parentIndent + 1;
|
|
13406
|
+
}
|
|
13407
|
+
blockIndent = state.position - state.lineStart;
|
|
13408
|
+
if (indentStatus === 1) {
|
|
13409
|
+
if (allowBlockCollections && (readBlockSequence(state, blockIndent) || readBlockMapping(state, blockIndent, flowIndent)) || readFlowCollection(state, flowIndent)) {
|
|
13410
|
+
hasContent = true;
|
|
13411
|
+
} else {
|
|
13412
|
+
if (allowBlockScalars && readBlockScalar(state, flowIndent) || readSingleQuotedScalar(state, flowIndent) || readDoubleQuotedScalar(state, flowIndent)) {
|
|
13413
|
+
hasContent = true;
|
|
13414
|
+
} else if (readAlias(state)) {
|
|
13415
|
+
hasContent = true;
|
|
13416
|
+
if (state.tag !== null || state.anchor !== null) {
|
|
13417
|
+
throwError(state, "alias node should not have any properties");
|
|
13418
|
+
}
|
|
13419
|
+
} else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
|
|
13420
|
+
hasContent = true;
|
|
13421
|
+
if (state.tag === null) {
|
|
13422
|
+
state.tag = "?";
|
|
13423
|
+
}
|
|
13424
|
+
}
|
|
13425
|
+
if (state.anchor !== null) {
|
|
13426
|
+
state.anchorMap[state.anchor] = state.result;
|
|
13427
|
+
}
|
|
13428
|
+
}
|
|
13429
|
+
} else if (indentStatus === 0) {
|
|
13430
|
+
hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
|
|
13431
|
+
}
|
|
13432
|
+
}
|
|
13433
|
+
if (state.tag === null) {
|
|
13434
|
+
if (state.anchor !== null) {
|
|
13435
|
+
state.anchorMap[state.anchor] = state.result;
|
|
13436
|
+
}
|
|
13437
|
+
} else if (state.tag === "?") {
|
|
13438
|
+
if (state.result !== null && state.kind !== "scalar") {
|
|
13439
|
+
throwError(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"');
|
|
13440
|
+
}
|
|
13441
|
+
for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
|
|
13442
|
+
type2 = state.implicitTypes[typeIndex];
|
|
13443
|
+
if (type2.resolve(state.result)) {
|
|
13444
|
+
state.result = type2.construct(state.result);
|
|
13445
|
+
state.tag = type2.tag;
|
|
13446
|
+
if (state.anchor !== null) {
|
|
13447
|
+
state.anchorMap[state.anchor] = state.result;
|
|
13448
|
+
}
|
|
13449
|
+
break;
|
|
13450
|
+
}
|
|
13451
|
+
}
|
|
13452
|
+
} else if (state.tag !== "!") {
|
|
13453
|
+
if (_hasOwnProperty$1.call(state.typeMap[state.kind || "fallback"], state.tag)) {
|
|
13454
|
+
type2 = state.typeMap[state.kind || "fallback"][state.tag];
|
|
13455
|
+
} else {
|
|
13456
|
+
type2 = null;
|
|
13457
|
+
typeList = state.typeMap.multi[state.kind || "fallback"];
|
|
13458
|
+
for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) {
|
|
13459
|
+
if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) {
|
|
13460
|
+
type2 = typeList[typeIndex];
|
|
13461
|
+
break;
|
|
13462
|
+
}
|
|
13463
|
+
}
|
|
13464
|
+
}
|
|
13465
|
+
if (!type2) {
|
|
13466
|
+
throwError(state, "unknown tag !<" + state.tag + ">");
|
|
13467
|
+
}
|
|
13468
|
+
if (state.result !== null && type2.kind !== state.kind) {
|
|
13469
|
+
throwError(state, "unacceptable node kind for !<" + state.tag + '> tag; it should be "' + type2.kind + '", not "' + state.kind + '"');
|
|
13470
|
+
}
|
|
13471
|
+
if (!type2.resolve(state.result, state.tag)) {
|
|
13472
|
+
throwError(state, "cannot resolve a node with !<" + state.tag + "> explicit tag");
|
|
13473
|
+
} else {
|
|
13474
|
+
state.result = type2.construct(state.result, state.tag);
|
|
13475
|
+
if (state.anchor !== null) {
|
|
13476
|
+
state.anchorMap[state.anchor] = state.result;
|
|
13477
|
+
}
|
|
13478
|
+
}
|
|
13479
|
+
}
|
|
13480
|
+
if (state.listener !== null) {
|
|
13481
|
+
state.listener("close", state);
|
|
13482
|
+
}
|
|
13483
|
+
return state.tag !== null || state.anchor !== null || hasContent;
|
|
13484
|
+
}
|
|
13485
|
+
function readDocument(state) {
|
|
13486
|
+
var documentStart = state.position, _position, directiveName, directiveArgs, hasDirectives = false, ch;
|
|
13487
|
+
state.version = null;
|
|
13488
|
+
state.checkLineBreaks = state.legacy;
|
|
13489
|
+
state.tagMap = /* @__PURE__ */ Object.create(null);
|
|
13490
|
+
state.anchorMap = /* @__PURE__ */ Object.create(null);
|
|
13491
|
+
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
13492
|
+
skipSeparationSpace(state, true, -1);
|
|
13493
|
+
ch = state.input.charCodeAt(state.position);
|
|
13494
|
+
if (state.lineIndent > 0 || ch !== 37) {
|
|
13495
|
+
break;
|
|
13496
|
+
}
|
|
13497
|
+
hasDirectives = true;
|
|
13498
|
+
ch = state.input.charCodeAt(++state.position);
|
|
13499
|
+
_position = state.position;
|
|
13500
|
+
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
|
13501
|
+
ch = state.input.charCodeAt(++state.position);
|
|
13502
|
+
}
|
|
13503
|
+
directiveName = state.input.slice(_position, state.position);
|
|
13504
|
+
directiveArgs = [];
|
|
13505
|
+
if (directiveName.length < 1) {
|
|
13506
|
+
throwError(state, "directive name must not be less than one character in length");
|
|
13507
|
+
}
|
|
13508
|
+
while (ch !== 0) {
|
|
13509
|
+
while (is_WHITE_SPACE(ch)) {
|
|
13510
|
+
ch = state.input.charCodeAt(++state.position);
|
|
13511
|
+
}
|
|
13512
|
+
if (ch === 35) {
|
|
13513
|
+
do {
|
|
13514
|
+
ch = state.input.charCodeAt(++state.position);
|
|
13515
|
+
} while (ch !== 0 && !is_EOL(ch));
|
|
13516
|
+
break;
|
|
13517
|
+
}
|
|
13518
|
+
if (is_EOL(ch)) break;
|
|
13519
|
+
_position = state.position;
|
|
13520
|
+
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
|
13521
|
+
ch = state.input.charCodeAt(++state.position);
|
|
13522
|
+
}
|
|
13523
|
+
directiveArgs.push(state.input.slice(_position, state.position));
|
|
13524
|
+
}
|
|
13525
|
+
if (ch !== 0) readLineBreak(state);
|
|
13526
|
+
if (_hasOwnProperty$1.call(directiveHandlers, directiveName)) {
|
|
13527
|
+
directiveHandlers[directiveName](state, directiveName, directiveArgs);
|
|
13528
|
+
} else {
|
|
13529
|
+
throwWarning(state, 'unknown document directive "' + directiveName + '"');
|
|
13530
|
+
}
|
|
13531
|
+
}
|
|
13532
|
+
skipSeparationSpace(state, true, -1);
|
|
13533
|
+
if (state.lineIndent === 0 && state.input.charCodeAt(state.position) === 45 && state.input.charCodeAt(state.position + 1) === 45 && state.input.charCodeAt(state.position + 2) === 45) {
|
|
13534
|
+
state.position += 3;
|
|
13535
|
+
skipSeparationSpace(state, true, -1);
|
|
13536
|
+
} else if (hasDirectives) {
|
|
13537
|
+
throwError(state, "directives end mark is expected");
|
|
13538
|
+
}
|
|
13539
|
+
composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
|
|
13540
|
+
skipSeparationSpace(state, true, -1);
|
|
13541
|
+
if (state.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
|
|
13542
|
+
throwWarning(state, "non-ASCII line breaks are interpreted as content");
|
|
13543
|
+
}
|
|
13544
|
+
state.documents.push(state.result);
|
|
13545
|
+
if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
13546
|
+
if (state.input.charCodeAt(state.position) === 46) {
|
|
13547
|
+
state.position += 3;
|
|
13548
|
+
skipSeparationSpace(state, true, -1);
|
|
13549
|
+
}
|
|
13550
|
+
return;
|
|
13551
|
+
}
|
|
13552
|
+
if (state.position < state.length - 1) {
|
|
13553
|
+
throwError(state, "end of the stream or a document separator is expected");
|
|
13554
|
+
} else {
|
|
13555
|
+
return;
|
|
13556
|
+
}
|
|
13557
|
+
}
|
|
13558
|
+
function loadDocuments(input, options) {
|
|
13559
|
+
input = String(input);
|
|
13560
|
+
options = options || {};
|
|
13561
|
+
if (input.length !== 0) {
|
|
13562
|
+
if (input.charCodeAt(input.length - 1) !== 10 && input.charCodeAt(input.length - 1) !== 13) {
|
|
13563
|
+
input += "\n";
|
|
13564
|
+
}
|
|
13565
|
+
if (input.charCodeAt(0) === 65279) {
|
|
13566
|
+
input = input.slice(1);
|
|
13567
|
+
}
|
|
13568
|
+
}
|
|
13569
|
+
var state = new State$1(input, options);
|
|
13570
|
+
var nullpos = input.indexOf("\0");
|
|
13571
|
+
if (nullpos !== -1) {
|
|
13572
|
+
state.position = nullpos;
|
|
13573
|
+
throwError(state, "null byte is not allowed in input");
|
|
13574
|
+
}
|
|
13575
|
+
state.input += "\0";
|
|
13576
|
+
while (state.input.charCodeAt(state.position) === 32) {
|
|
13577
|
+
state.lineIndent += 1;
|
|
13578
|
+
state.position += 1;
|
|
13579
|
+
}
|
|
13580
|
+
while (state.position < state.length - 1) {
|
|
13581
|
+
readDocument(state);
|
|
13582
|
+
}
|
|
13583
|
+
return state.documents;
|
|
13584
|
+
}
|
|
13585
|
+
function loadAll$1(input, iterator2, options) {
|
|
13586
|
+
if (iterator2 !== null && typeof iterator2 === "object" && typeof options === "undefined") {
|
|
13587
|
+
options = iterator2;
|
|
13588
|
+
iterator2 = null;
|
|
13589
|
+
}
|
|
13590
|
+
var documents = loadDocuments(input, options);
|
|
13591
|
+
if (typeof iterator2 !== "function") {
|
|
13592
|
+
return documents;
|
|
13593
|
+
}
|
|
13594
|
+
for (var index = 0, length = documents.length; index < length; index += 1) {
|
|
13595
|
+
iterator2(documents[index]);
|
|
13596
|
+
}
|
|
13597
|
+
}
|
|
13598
|
+
function load$1(input, options) {
|
|
13599
|
+
var documents = loadDocuments(input, options);
|
|
13600
|
+
if (documents.length === 0) {
|
|
13601
|
+
return void 0;
|
|
13602
|
+
} else if (documents.length === 1) {
|
|
13603
|
+
return documents[0];
|
|
13604
|
+
}
|
|
13605
|
+
throw new exception("expected a single document in the stream, but found more");
|
|
13606
|
+
}
|
|
13607
|
+
var loadAll_1 = loadAll$1;
|
|
13608
|
+
var load_1 = load$1;
|
|
13609
|
+
var loader = {
|
|
13610
|
+
loadAll: loadAll_1,
|
|
13611
|
+
load: load_1
|
|
13612
|
+
};
|
|
13613
|
+
var _toString = Object.prototype.toString;
|
|
13614
|
+
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
13615
|
+
var CHAR_BOM = 65279;
|
|
13616
|
+
var CHAR_TAB = 9;
|
|
13617
|
+
var CHAR_LINE_FEED = 10;
|
|
13618
|
+
var CHAR_CARRIAGE_RETURN = 13;
|
|
13619
|
+
var CHAR_SPACE = 32;
|
|
13620
|
+
var CHAR_EXCLAMATION = 33;
|
|
13621
|
+
var CHAR_DOUBLE_QUOTE = 34;
|
|
13622
|
+
var CHAR_SHARP = 35;
|
|
13623
|
+
var CHAR_PERCENT = 37;
|
|
13624
|
+
var CHAR_AMPERSAND = 38;
|
|
13625
|
+
var CHAR_SINGLE_QUOTE = 39;
|
|
13626
|
+
var CHAR_ASTERISK = 42;
|
|
13627
|
+
var CHAR_COMMA = 44;
|
|
13628
|
+
var CHAR_MINUS = 45;
|
|
13629
|
+
var CHAR_COLON = 58;
|
|
13630
|
+
var CHAR_EQUALS = 61;
|
|
13631
|
+
var CHAR_GREATER_THAN = 62;
|
|
13632
|
+
var CHAR_QUESTION = 63;
|
|
13633
|
+
var CHAR_COMMERCIAL_AT = 64;
|
|
13634
|
+
var CHAR_LEFT_SQUARE_BRACKET = 91;
|
|
13635
|
+
var CHAR_RIGHT_SQUARE_BRACKET = 93;
|
|
13636
|
+
var CHAR_GRAVE_ACCENT = 96;
|
|
13637
|
+
var CHAR_LEFT_CURLY_BRACKET = 123;
|
|
13638
|
+
var CHAR_VERTICAL_LINE = 124;
|
|
13639
|
+
var CHAR_RIGHT_CURLY_BRACKET = 125;
|
|
13640
|
+
var ESCAPE_SEQUENCES = {};
|
|
13641
|
+
ESCAPE_SEQUENCES[0] = "\\0";
|
|
13642
|
+
ESCAPE_SEQUENCES[7] = "\\a";
|
|
13643
|
+
ESCAPE_SEQUENCES[8] = "\\b";
|
|
13644
|
+
ESCAPE_SEQUENCES[9] = "\\t";
|
|
13645
|
+
ESCAPE_SEQUENCES[10] = "\\n";
|
|
13646
|
+
ESCAPE_SEQUENCES[11] = "\\v";
|
|
13647
|
+
ESCAPE_SEQUENCES[12] = "\\f";
|
|
13648
|
+
ESCAPE_SEQUENCES[13] = "\\r";
|
|
13649
|
+
ESCAPE_SEQUENCES[27] = "\\e";
|
|
13650
|
+
ESCAPE_SEQUENCES[34] = '\\"';
|
|
13651
|
+
ESCAPE_SEQUENCES[92] = "\\\\";
|
|
13652
|
+
ESCAPE_SEQUENCES[133] = "\\N";
|
|
13653
|
+
ESCAPE_SEQUENCES[160] = "\\_";
|
|
13654
|
+
ESCAPE_SEQUENCES[8232] = "\\L";
|
|
13655
|
+
ESCAPE_SEQUENCES[8233] = "\\P";
|
|
13656
|
+
var DEPRECATED_BOOLEANS_SYNTAX = [
|
|
13657
|
+
"y",
|
|
13658
|
+
"Y",
|
|
13659
|
+
"yes",
|
|
13660
|
+
"Yes",
|
|
13661
|
+
"YES",
|
|
13662
|
+
"on",
|
|
13663
|
+
"On",
|
|
13664
|
+
"ON",
|
|
13665
|
+
"n",
|
|
13666
|
+
"N",
|
|
13667
|
+
"no",
|
|
13668
|
+
"No",
|
|
13669
|
+
"NO",
|
|
13670
|
+
"off",
|
|
13671
|
+
"Off",
|
|
13672
|
+
"OFF"
|
|
13673
|
+
];
|
|
13674
|
+
var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
|
|
13675
|
+
function compileStyleMap(schema2, map2) {
|
|
13676
|
+
var result, keys, index, length, tag, style, type2;
|
|
13677
|
+
if (map2 === null) return {};
|
|
13678
|
+
result = {};
|
|
13679
|
+
keys = Object.keys(map2);
|
|
13680
|
+
for (index = 0, length = keys.length; index < length; index += 1) {
|
|
13681
|
+
tag = keys[index];
|
|
13682
|
+
style = String(map2[tag]);
|
|
13683
|
+
if (tag.slice(0, 2) === "!!") {
|
|
13684
|
+
tag = "tag:yaml.org,2002:" + tag.slice(2);
|
|
13685
|
+
}
|
|
13686
|
+
type2 = schema2.compiledTypeMap["fallback"][tag];
|
|
13687
|
+
if (type2 && _hasOwnProperty.call(type2.styleAliases, style)) {
|
|
13688
|
+
style = type2.styleAliases[style];
|
|
13689
|
+
}
|
|
13690
|
+
result[tag] = style;
|
|
13691
|
+
}
|
|
13692
|
+
return result;
|
|
13693
|
+
}
|
|
13694
|
+
function encodeHex(character) {
|
|
13695
|
+
var string, handle, length;
|
|
13696
|
+
string = character.toString(16).toUpperCase();
|
|
13697
|
+
if (character <= 255) {
|
|
13698
|
+
handle = "x";
|
|
13699
|
+
length = 2;
|
|
13700
|
+
} else if (character <= 65535) {
|
|
13701
|
+
handle = "u";
|
|
13702
|
+
length = 4;
|
|
13703
|
+
} else if (character <= 4294967295) {
|
|
13704
|
+
handle = "U";
|
|
13705
|
+
length = 8;
|
|
13706
|
+
} else {
|
|
13707
|
+
throw new exception("code point within a string may not be greater than 0xFFFFFFFF");
|
|
13708
|
+
}
|
|
13709
|
+
return "\\" + handle + common.repeat("0", length - string.length) + string;
|
|
13710
|
+
}
|
|
13711
|
+
var QUOTING_TYPE_SINGLE = 1;
|
|
13712
|
+
var QUOTING_TYPE_DOUBLE = 2;
|
|
13713
|
+
function State(options) {
|
|
13714
|
+
this.schema = options["schema"] || _default;
|
|
13715
|
+
this.indent = Math.max(1, options["indent"] || 2);
|
|
13716
|
+
this.noArrayIndent = options["noArrayIndent"] || false;
|
|
13717
|
+
this.skipInvalid = options["skipInvalid"] || false;
|
|
13718
|
+
this.flowLevel = common.isNothing(options["flowLevel"]) ? -1 : options["flowLevel"];
|
|
13719
|
+
this.styleMap = compileStyleMap(this.schema, options["styles"] || null);
|
|
13720
|
+
this.sortKeys = options["sortKeys"] || false;
|
|
13721
|
+
this.lineWidth = options["lineWidth"] || 80;
|
|
13722
|
+
this.noRefs = options["noRefs"] || false;
|
|
13723
|
+
this.noCompatMode = options["noCompatMode"] || false;
|
|
13724
|
+
this.condenseFlow = options["condenseFlow"] || false;
|
|
13725
|
+
this.quotingType = options["quotingType"] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE;
|
|
13726
|
+
this.forceQuotes = options["forceQuotes"] || false;
|
|
13727
|
+
this.replacer = typeof options["replacer"] === "function" ? options["replacer"] : null;
|
|
13728
|
+
this.implicitTypes = this.schema.compiledImplicit;
|
|
13729
|
+
this.explicitTypes = this.schema.compiledExplicit;
|
|
13730
|
+
this.tag = null;
|
|
13731
|
+
this.result = "";
|
|
13732
|
+
this.duplicates = [];
|
|
13733
|
+
this.usedDuplicates = null;
|
|
13734
|
+
}
|
|
13735
|
+
function indentString(string, spaces) {
|
|
13736
|
+
var ind = common.repeat(" ", spaces), position = 0, next = -1, result = "", line, length = string.length;
|
|
13737
|
+
while (position < length) {
|
|
13738
|
+
next = string.indexOf("\n", position);
|
|
13739
|
+
if (next === -1) {
|
|
13740
|
+
line = string.slice(position);
|
|
13741
|
+
position = length;
|
|
13742
|
+
} else {
|
|
13743
|
+
line = string.slice(position, next + 1);
|
|
13744
|
+
position = next + 1;
|
|
13745
|
+
}
|
|
13746
|
+
if (line.length && line !== "\n") result += ind;
|
|
13747
|
+
result += line;
|
|
13748
|
+
}
|
|
13749
|
+
return result;
|
|
13750
|
+
}
|
|
13751
|
+
function generateNextLine(state, level) {
|
|
13752
|
+
return "\n" + common.repeat(" ", state.indent * level);
|
|
13753
|
+
}
|
|
13754
|
+
function testImplicitResolving(state, str2) {
|
|
13755
|
+
var index, length, type2;
|
|
13756
|
+
for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {
|
|
13757
|
+
type2 = state.implicitTypes[index];
|
|
13758
|
+
if (type2.resolve(str2)) {
|
|
13759
|
+
return true;
|
|
13760
|
+
}
|
|
13761
|
+
}
|
|
13762
|
+
return false;
|
|
13763
|
+
}
|
|
13764
|
+
function isWhitespace(c) {
|
|
13765
|
+
return c === CHAR_SPACE || c === CHAR_TAB;
|
|
13766
|
+
}
|
|
13767
|
+
function isPrintable(c) {
|
|
13768
|
+
return 32 <= c && c <= 126 || 161 <= c && c <= 55295 && c !== 8232 && c !== 8233 || 57344 <= c && c <= 65533 && c !== CHAR_BOM || 65536 <= c && c <= 1114111;
|
|
13769
|
+
}
|
|
13770
|
+
function isNsCharOrWhitespace(c) {
|
|
13771
|
+
return isPrintable(c) && c !== CHAR_BOM && c !== CHAR_CARRIAGE_RETURN && c !== CHAR_LINE_FEED;
|
|
13772
|
+
}
|
|
13773
|
+
function isPlainSafe(c, prev, inblock) {
|
|
13774
|
+
var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c);
|
|
13775
|
+
var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c);
|
|
13776
|
+
return (
|
|
13777
|
+
// ns-plain-safe
|
|
13778
|
+
(inblock ? (
|
|
13779
|
+
// c = flow-in
|
|
13780
|
+
cIsNsCharOrWhitespace
|
|
13781
|
+
) : cIsNsCharOrWhitespace && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET) && c !== CHAR_SHARP && !(prev === CHAR_COLON && !cIsNsChar) || isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP || prev === CHAR_COLON && cIsNsChar
|
|
13782
|
+
);
|
|
13783
|
+
}
|
|
13784
|
+
function isPlainSafeFirst(c) {
|
|
13785
|
+
return isPrintable(c) && c !== CHAR_BOM && !isWhitespace(c) && c !== CHAR_MINUS && c !== CHAR_QUESTION && c !== CHAR_COLON && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET && c !== CHAR_SHARP && c !== CHAR_AMPERSAND && c !== CHAR_ASTERISK && c !== CHAR_EXCLAMATION && c !== CHAR_VERTICAL_LINE && c !== CHAR_EQUALS && c !== CHAR_GREATER_THAN && c !== CHAR_SINGLE_QUOTE && c !== CHAR_DOUBLE_QUOTE && c !== CHAR_PERCENT && c !== CHAR_COMMERCIAL_AT && c !== CHAR_GRAVE_ACCENT;
|
|
13786
|
+
}
|
|
13787
|
+
function isPlainSafeLast(c) {
|
|
13788
|
+
return !isWhitespace(c) && c !== CHAR_COLON;
|
|
13789
|
+
}
|
|
13790
|
+
function codePointAt(string, pos) {
|
|
13791
|
+
var first = string.charCodeAt(pos), second;
|
|
13792
|
+
if (first >= 55296 && first <= 56319 && pos + 1 < string.length) {
|
|
13793
|
+
second = string.charCodeAt(pos + 1);
|
|
13794
|
+
if (second >= 56320 && second <= 57343) {
|
|
13795
|
+
return (first - 55296) * 1024 + second - 56320 + 65536;
|
|
13796
|
+
}
|
|
13797
|
+
}
|
|
13798
|
+
return first;
|
|
13799
|
+
}
|
|
13800
|
+
function needIndentIndicator(string) {
|
|
13801
|
+
var leadingSpaceRe = /^\n* /;
|
|
13802
|
+
return leadingSpaceRe.test(string);
|
|
13803
|
+
}
|
|
13804
|
+
var STYLE_PLAIN = 1;
|
|
13805
|
+
var STYLE_SINGLE = 2;
|
|
13806
|
+
var STYLE_LITERAL = 3;
|
|
13807
|
+
var STYLE_FOLDED = 4;
|
|
13808
|
+
var STYLE_DOUBLE = 5;
|
|
13809
|
+
function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType, quotingType, forceQuotes, inblock) {
|
|
13810
|
+
var i;
|
|
13811
|
+
var char = 0;
|
|
13812
|
+
var prevChar = null;
|
|
13813
|
+
var hasLineBreak = false;
|
|
13814
|
+
var hasFoldableLine = false;
|
|
13815
|
+
var shouldTrackWidth = lineWidth !== -1;
|
|
13816
|
+
var previousLineBreak = -1;
|
|
13817
|
+
var plain = isPlainSafeFirst(codePointAt(string, 0)) && isPlainSafeLast(codePointAt(string, string.length - 1));
|
|
13818
|
+
if (singleLineOnly || forceQuotes) {
|
|
13819
|
+
for (i = 0; i < string.length; char >= 65536 ? i += 2 : i++) {
|
|
13820
|
+
char = codePointAt(string, i);
|
|
13821
|
+
if (!isPrintable(char)) {
|
|
13822
|
+
return STYLE_DOUBLE;
|
|
13823
|
+
}
|
|
13824
|
+
plain = plain && isPlainSafe(char, prevChar, inblock);
|
|
13825
|
+
prevChar = char;
|
|
13826
|
+
}
|
|
13827
|
+
} else {
|
|
13828
|
+
for (i = 0; i < string.length; char >= 65536 ? i += 2 : i++) {
|
|
13829
|
+
char = codePointAt(string, i);
|
|
13830
|
+
if (char === CHAR_LINE_FEED) {
|
|
13831
|
+
hasLineBreak = true;
|
|
13832
|
+
if (shouldTrackWidth) {
|
|
13833
|
+
hasFoldableLine = hasFoldableLine || // Foldable line = too long, and not more-indented.
|
|
13834
|
+
i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ";
|
|
13835
|
+
previousLineBreak = i;
|
|
13836
|
+
}
|
|
13837
|
+
} else if (!isPrintable(char)) {
|
|
13838
|
+
return STYLE_DOUBLE;
|
|
13839
|
+
}
|
|
13840
|
+
plain = plain && isPlainSafe(char, prevChar, inblock);
|
|
13841
|
+
prevChar = char;
|
|
13842
|
+
}
|
|
13843
|
+
hasFoldableLine = hasFoldableLine || shouldTrackWidth && (i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ");
|
|
13844
|
+
}
|
|
13845
|
+
if (!hasLineBreak && !hasFoldableLine) {
|
|
13846
|
+
if (plain && !forceQuotes && !testAmbiguousType(string)) {
|
|
13847
|
+
return STYLE_PLAIN;
|
|
13848
|
+
}
|
|
13849
|
+
return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
|
|
13850
|
+
}
|
|
13851
|
+
if (indentPerLevel > 9 && needIndentIndicator(string)) {
|
|
13852
|
+
return STYLE_DOUBLE;
|
|
13853
|
+
}
|
|
13854
|
+
if (!forceQuotes) {
|
|
13855
|
+
return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
|
|
13856
|
+
}
|
|
13857
|
+
return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
|
|
13858
|
+
}
|
|
13859
|
+
function writeScalar(state, string, level, iskey, inblock) {
|
|
13860
|
+
state.dump = function() {
|
|
13861
|
+
if (string.length === 0) {
|
|
13862
|
+
return state.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''";
|
|
13863
|
+
}
|
|
13864
|
+
if (!state.noCompatMode) {
|
|
13865
|
+
if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) {
|
|
13866
|
+
return state.quotingType === QUOTING_TYPE_DOUBLE ? '"' + string + '"' : "'" + string + "'";
|
|
13867
|
+
}
|
|
13868
|
+
}
|
|
13869
|
+
var indent = state.indent * Math.max(1, level);
|
|
13870
|
+
var lineWidth = state.lineWidth === -1 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
|
|
13871
|
+
var singleLineOnly = iskey || state.flowLevel > -1 && level >= state.flowLevel;
|
|
13872
|
+
function testAmbiguity(string2) {
|
|
13873
|
+
return testImplicitResolving(state, string2);
|
|
13874
|
+
}
|
|
13875
|
+
switch (chooseScalarStyle(
|
|
13876
|
+
string,
|
|
13877
|
+
singleLineOnly,
|
|
13878
|
+
state.indent,
|
|
13879
|
+
lineWidth,
|
|
13880
|
+
testAmbiguity,
|
|
13881
|
+
state.quotingType,
|
|
13882
|
+
state.forceQuotes && !iskey,
|
|
13883
|
+
inblock
|
|
13884
|
+
)) {
|
|
13885
|
+
case STYLE_PLAIN:
|
|
13886
|
+
return string;
|
|
13887
|
+
case STYLE_SINGLE:
|
|
13888
|
+
return "'" + string.replace(/'/g, "''") + "'";
|
|
13889
|
+
case STYLE_LITERAL:
|
|
13890
|
+
return "|" + blockHeader(string, state.indent) + dropEndingNewline(indentString(string, indent));
|
|
13891
|
+
case STYLE_FOLDED:
|
|
13892
|
+
return ">" + blockHeader(string, state.indent) + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
|
|
13893
|
+
case STYLE_DOUBLE:
|
|
13894
|
+
return '"' + escapeString(string) + '"';
|
|
13895
|
+
default:
|
|
13896
|
+
throw new exception("impossible error: invalid scalar style");
|
|
13897
|
+
}
|
|
13898
|
+
}();
|
|
13899
|
+
}
|
|
13900
|
+
function blockHeader(string, indentPerLevel) {
|
|
13901
|
+
var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : "";
|
|
13902
|
+
var clip = string[string.length - 1] === "\n";
|
|
13903
|
+
var keep = clip && (string[string.length - 2] === "\n" || string === "\n");
|
|
13904
|
+
var chomp = keep ? "+" : clip ? "" : "-";
|
|
13905
|
+
return indentIndicator + chomp + "\n";
|
|
13906
|
+
}
|
|
13907
|
+
function dropEndingNewline(string) {
|
|
13908
|
+
return string[string.length - 1] === "\n" ? string.slice(0, -1) : string;
|
|
13909
|
+
}
|
|
13910
|
+
function foldString(string, width) {
|
|
13911
|
+
var lineRe = /(\n+)([^\n]*)/g;
|
|
13912
|
+
var result = function() {
|
|
13913
|
+
var nextLF = string.indexOf("\n");
|
|
13914
|
+
nextLF = nextLF !== -1 ? nextLF : string.length;
|
|
13915
|
+
lineRe.lastIndex = nextLF;
|
|
13916
|
+
return foldLine(string.slice(0, nextLF), width);
|
|
13917
|
+
}();
|
|
13918
|
+
var prevMoreIndented = string[0] === "\n" || string[0] === " ";
|
|
13919
|
+
var moreIndented;
|
|
13920
|
+
var match;
|
|
13921
|
+
while (match = lineRe.exec(string)) {
|
|
13922
|
+
var prefix = match[1], line = match[2];
|
|
13923
|
+
moreIndented = line[0] === " ";
|
|
13924
|
+
result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? "\n" : "") + foldLine(line, width);
|
|
13925
|
+
prevMoreIndented = moreIndented;
|
|
13926
|
+
}
|
|
13927
|
+
return result;
|
|
13928
|
+
}
|
|
13929
|
+
function foldLine(line, width) {
|
|
13930
|
+
if (line === "" || line[0] === " ") return line;
|
|
13931
|
+
var breakRe = / [^ ]/g;
|
|
13932
|
+
var match;
|
|
13933
|
+
var start = 0, end, curr = 0, next = 0;
|
|
13934
|
+
var result = "";
|
|
13935
|
+
while (match = breakRe.exec(line)) {
|
|
13936
|
+
next = match.index;
|
|
13937
|
+
if (next - start > width) {
|
|
13938
|
+
end = curr > start ? curr : next;
|
|
13939
|
+
result += "\n" + line.slice(start, end);
|
|
13940
|
+
start = end + 1;
|
|
13941
|
+
}
|
|
13942
|
+
curr = next;
|
|
13943
|
+
}
|
|
13944
|
+
result += "\n";
|
|
13945
|
+
if (line.length - start > width && curr > start) {
|
|
13946
|
+
result += line.slice(start, curr) + "\n" + line.slice(curr + 1);
|
|
13947
|
+
} else {
|
|
13948
|
+
result += line.slice(start);
|
|
13949
|
+
}
|
|
13950
|
+
return result.slice(1);
|
|
13951
|
+
}
|
|
13952
|
+
function escapeString(string) {
|
|
13953
|
+
var result = "";
|
|
13954
|
+
var char = 0;
|
|
13955
|
+
var escapeSeq;
|
|
13956
|
+
for (var i = 0; i < string.length; char >= 65536 ? i += 2 : i++) {
|
|
13957
|
+
char = codePointAt(string, i);
|
|
13958
|
+
escapeSeq = ESCAPE_SEQUENCES[char];
|
|
13959
|
+
if (!escapeSeq && isPrintable(char)) {
|
|
13960
|
+
result += string[i];
|
|
13961
|
+
if (char >= 65536) result += string[i + 1];
|
|
13962
|
+
} else {
|
|
13963
|
+
result += escapeSeq || encodeHex(char);
|
|
13964
|
+
}
|
|
13965
|
+
}
|
|
13966
|
+
return result;
|
|
13967
|
+
}
|
|
13968
|
+
function writeFlowSequence(state, level, object) {
|
|
13969
|
+
var _result = "", _tag = state.tag, index, length, value;
|
|
13970
|
+
for (index = 0, length = object.length; index < length; index += 1) {
|
|
13971
|
+
value = object[index];
|
|
13972
|
+
if (state.replacer) {
|
|
13973
|
+
value = state.replacer.call(object, String(index), value);
|
|
13974
|
+
}
|
|
13975
|
+
if (writeNode(state, level, value, false, false) || typeof value === "undefined" && writeNode(state, level, null, false, false)) {
|
|
13976
|
+
if (_result !== "") _result += "," + (!state.condenseFlow ? " " : "");
|
|
13977
|
+
_result += state.dump;
|
|
13978
|
+
}
|
|
13979
|
+
}
|
|
13980
|
+
state.tag = _tag;
|
|
13981
|
+
state.dump = "[" + _result + "]";
|
|
13982
|
+
}
|
|
13983
|
+
function writeBlockSequence(state, level, object, compact) {
|
|
13984
|
+
var _result = "", _tag = state.tag, index, length, value;
|
|
13985
|
+
for (index = 0, length = object.length; index < length; index += 1) {
|
|
13986
|
+
value = object[index];
|
|
13987
|
+
if (state.replacer) {
|
|
13988
|
+
value = state.replacer.call(object, String(index), value);
|
|
13989
|
+
}
|
|
13990
|
+
if (writeNode(state, level + 1, value, true, true, false, true) || typeof value === "undefined" && writeNode(state, level + 1, null, true, true, false, true)) {
|
|
13991
|
+
if (!compact || _result !== "") {
|
|
13992
|
+
_result += generateNextLine(state, level);
|
|
13993
|
+
}
|
|
13994
|
+
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
13995
|
+
_result += "-";
|
|
13996
|
+
} else {
|
|
13997
|
+
_result += "- ";
|
|
13998
|
+
}
|
|
13999
|
+
_result += state.dump;
|
|
14000
|
+
}
|
|
14001
|
+
}
|
|
14002
|
+
state.tag = _tag;
|
|
14003
|
+
state.dump = _result || "[]";
|
|
14004
|
+
}
|
|
14005
|
+
function writeFlowMapping(state, level, object) {
|
|
14006
|
+
var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, pairBuffer;
|
|
14007
|
+
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
|
14008
|
+
pairBuffer = "";
|
|
14009
|
+
if (_result !== "") pairBuffer += ", ";
|
|
14010
|
+
if (state.condenseFlow) pairBuffer += '"';
|
|
14011
|
+
objectKey = objectKeyList[index];
|
|
14012
|
+
objectValue = object[objectKey];
|
|
14013
|
+
if (state.replacer) {
|
|
14014
|
+
objectValue = state.replacer.call(object, objectKey, objectValue);
|
|
14015
|
+
}
|
|
14016
|
+
if (!writeNode(state, level, objectKey, false, false)) {
|
|
14017
|
+
continue;
|
|
14018
|
+
}
|
|
14019
|
+
if (state.dump.length > 1024) pairBuffer += "? ";
|
|
14020
|
+
pairBuffer += state.dump + (state.condenseFlow ? '"' : "") + ":" + (state.condenseFlow ? "" : " ");
|
|
14021
|
+
if (!writeNode(state, level, objectValue, false, false)) {
|
|
14022
|
+
continue;
|
|
14023
|
+
}
|
|
14024
|
+
pairBuffer += state.dump;
|
|
14025
|
+
_result += pairBuffer;
|
|
14026
|
+
}
|
|
14027
|
+
state.tag = _tag;
|
|
14028
|
+
state.dump = "{" + _result + "}";
|
|
14029
|
+
}
|
|
14030
|
+
function writeBlockMapping(state, level, object, compact) {
|
|
14031
|
+
var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, explicitPair, pairBuffer;
|
|
14032
|
+
if (state.sortKeys === true) {
|
|
14033
|
+
objectKeyList.sort();
|
|
14034
|
+
} else if (typeof state.sortKeys === "function") {
|
|
14035
|
+
objectKeyList.sort(state.sortKeys);
|
|
14036
|
+
} else if (state.sortKeys) {
|
|
14037
|
+
throw new exception("sortKeys must be a boolean or a function");
|
|
14038
|
+
}
|
|
14039
|
+
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
|
14040
|
+
pairBuffer = "";
|
|
14041
|
+
if (!compact || _result !== "") {
|
|
14042
|
+
pairBuffer += generateNextLine(state, level);
|
|
14043
|
+
}
|
|
14044
|
+
objectKey = objectKeyList[index];
|
|
14045
|
+
objectValue = object[objectKey];
|
|
14046
|
+
if (state.replacer) {
|
|
14047
|
+
objectValue = state.replacer.call(object, objectKey, objectValue);
|
|
14048
|
+
}
|
|
14049
|
+
if (!writeNode(state, level + 1, objectKey, true, true, true)) {
|
|
14050
|
+
continue;
|
|
14051
|
+
}
|
|
14052
|
+
explicitPair = state.tag !== null && state.tag !== "?" || state.dump && state.dump.length > 1024;
|
|
14053
|
+
if (explicitPair) {
|
|
14054
|
+
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
14055
|
+
pairBuffer += "?";
|
|
14056
|
+
} else {
|
|
14057
|
+
pairBuffer += "? ";
|
|
14058
|
+
}
|
|
14059
|
+
}
|
|
14060
|
+
pairBuffer += state.dump;
|
|
14061
|
+
if (explicitPair) {
|
|
14062
|
+
pairBuffer += generateNextLine(state, level);
|
|
14063
|
+
}
|
|
14064
|
+
if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
|
|
14065
|
+
continue;
|
|
14066
|
+
}
|
|
14067
|
+
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
14068
|
+
pairBuffer += ":";
|
|
14069
|
+
} else {
|
|
14070
|
+
pairBuffer += ": ";
|
|
14071
|
+
}
|
|
14072
|
+
pairBuffer += state.dump;
|
|
14073
|
+
_result += pairBuffer;
|
|
14074
|
+
}
|
|
14075
|
+
state.tag = _tag;
|
|
14076
|
+
state.dump = _result || "{}";
|
|
14077
|
+
}
|
|
14078
|
+
function detectType(state, object, explicit) {
|
|
14079
|
+
var _result, typeList, index, length, type2, style;
|
|
14080
|
+
typeList = explicit ? state.explicitTypes : state.implicitTypes;
|
|
14081
|
+
for (index = 0, length = typeList.length; index < length; index += 1) {
|
|
14082
|
+
type2 = typeList[index];
|
|
14083
|
+
if ((type2.instanceOf || type2.predicate) && (!type2.instanceOf || typeof object === "object" && object instanceof type2.instanceOf) && (!type2.predicate || type2.predicate(object))) {
|
|
14084
|
+
if (explicit) {
|
|
14085
|
+
if (type2.multi && type2.representName) {
|
|
14086
|
+
state.tag = type2.representName(object);
|
|
14087
|
+
} else {
|
|
14088
|
+
state.tag = type2.tag;
|
|
14089
|
+
}
|
|
14090
|
+
} else {
|
|
14091
|
+
state.tag = "?";
|
|
14092
|
+
}
|
|
14093
|
+
if (type2.represent) {
|
|
14094
|
+
style = state.styleMap[type2.tag] || type2.defaultStyle;
|
|
14095
|
+
if (_toString.call(type2.represent) === "[object Function]") {
|
|
14096
|
+
_result = type2.represent(object, style);
|
|
14097
|
+
} else if (_hasOwnProperty.call(type2.represent, style)) {
|
|
14098
|
+
_result = type2.represent[style](object, style);
|
|
14099
|
+
} else {
|
|
14100
|
+
throw new exception("!<" + type2.tag + '> tag resolver accepts not "' + style + '" style');
|
|
14101
|
+
}
|
|
14102
|
+
state.dump = _result;
|
|
14103
|
+
}
|
|
14104
|
+
return true;
|
|
14105
|
+
}
|
|
14106
|
+
}
|
|
14107
|
+
return false;
|
|
14108
|
+
}
|
|
14109
|
+
function writeNode(state, level, object, block, compact, iskey, isblockseq) {
|
|
14110
|
+
state.tag = null;
|
|
14111
|
+
state.dump = object;
|
|
14112
|
+
if (!detectType(state, object, false)) {
|
|
14113
|
+
detectType(state, object, true);
|
|
14114
|
+
}
|
|
14115
|
+
var type2 = _toString.call(state.dump);
|
|
14116
|
+
var inblock = block;
|
|
14117
|
+
var tagStr;
|
|
14118
|
+
if (block) {
|
|
14119
|
+
block = state.flowLevel < 0 || state.flowLevel > level;
|
|
14120
|
+
}
|
|
14121
|
+
var objectOrArray = type2 === "[object Object]" || type2 === "[object Array]", duplicateIndex, duplicate;
|
|
14122
|
+
if (objectOrArray) {
|
|
14123
|
+
duplicateIndex = state.duplicates.indexOf(object);
|
|
14124
|
+
duplicate = duplicateIndex !== -1;
|
|
14125
|
+
}
|
|
14126
|
+
if (state.tag !== null && state.tag !== "?" || duplicate || state.indent !== 2 && level > 0) {
|
|
14127
|
+
compact = false;
|
|
14128
|
+
}
|
|
14129
|
+
if (duplicate && state.usedDuplicates[duplicateIndex]) {
|
|
14130
|
+
state.dump = "*ref_" + duplicateIndex;
|
|
14131
|
+
} else {
|
|
14132
|
+
if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
|
|
14133
|
+
state.usedDuplicates[duplicateIndex] = true;
|
|
14134
|
+
}
|
|
14135
|
+
if (type2 === "[object Object]") {
|
|
14136
|
+
if (block && Object.keys(state.dump).length !== 0) {
|
|
14137
|
+
writeBlockMapping(state, level, state.dump, compact);
|
|
14138
|
+
if (duplicate) {
|
|
14139
|
+
state.dump = "&ref_" + duplicateIndex + state.dump;
|
|
14140
|
+
}
|
|
14141
|
+
} else {
|
|
14142
|
+
writeFlowMapping(state, level, state.dump);
|
|
14143
|
+
if (duplicate) {
|
|
14144
|
+
state.dump = "&ref_" + duplicateIndex + " " + state.dump;
|
|
14145
|
+
}
|
|
14146
|
+
}
|
|
14147
|
+
} else if (type2 === "[object Array]") {
|
|
14148
|
+
if (block && state.dump.length !== 0) {
|
|
14149
|
+
if (state.noArrayIndent && !isblockseq && level > 0) {
|
|
14150
|
+
writeBlockSequence(state, level - 1, state.dump, compact);
|
|
14151
|
+
} else {
|
|
14152
|
+
writeBlockSequence(state, level, state.dump, compact);
|
|
14153
|
+
}
|
|
14154
|
+
if (duplicate) {
|
|
14155
|
+
state.dump = "&ref_" + duplicateIndex + state.dump;
|
|
14156
|
+
}
|
|
14157
|
+
} else {
|
|
14158
|
+
writeFlowSequence(state, level, state.dump);
|
|
14159
|
+
if (duplicate) {
|
|
14160
|
+
state.dump = "&ref_" + duplicateIndex + " " + state.dump;
|
|
14161
|
+
}
|
|
14162
|
+
}
|
|
14163
|
+
} else if (type2 === "[object String]") {
|
|
14164
|
+
if (state.tag !== "?") {
|
|
14165
|
+
writeScalar(state, state.dump, level, iskey, inblock);
|
|
14166
|
+
}
|
|
14167
|
+
} else if (type2 === "[object Undefined]") {
|
|
14168
|
+
return false;
|
|
14169
|
+
} else {
|
|
14170
|
+
if (state.skipInvalid) return false;
|
|
14171
|
+
throw new exception("unacceptable kind of an object to dump " + type2);
|
|
14172
|
+
}
|
|
14173
|
+
if (state.tag !== null && state.tag !== "?") {
|
|
14174
|
+
tagStr = encodeURI(
|
|
14175
|
+
state.tag[0] === "!" ? state.tag.slice(1) : state.tag
|
|
14176
|
+
).replace(/!/g, "%21");
|
|
14177
|
+
if (state.tag[0] === "!") {
|
|
14178
|
+
tagStr = "!" + tagStr;
|
|
14179
|
+
} else if (tagStr.slice(0, 18) === "tag:yaml.org,2002:") {
|
|
14180
|
+
tagStr = "!!" + tagStr.slice(18);
|
|
14181
|
+
} else {
|
|
14182
|
+
tagStr = "!<" + tagStr + ">";
|
|
14183
|
+
}
|
|
14184
|
+
state.dump = tagStr + " " + state.dump;
|
|
14185
|
+
}
|
|
14186
|
+
}
|
|
14187
|
+
return true;
|
|
14188
|
+
}
|
|
14189
|
+
function getDuplicateReferences(object, state) {
|
|
14190
|
+
var objects = [], duplicatesIndexes = [], index, length;
|
|
14191
|
+
inspectNode(object, objects, duplicatesIndexes);
|
|
14192
|
+
for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {
|
|
14193
|
+
state.duplicates.push(objects[duplicatesIndexes[index]]);
|
|
14194
|
+
}
|
|
14195
|
+
state.usedDuplicates = new Array(length);
|
|
14196
|
+
}
|
|
14197
|
+
function inspectNode(object, objects, duplicatesIndexes) {
|
|
14198
|
+
var objectKeyList, index, length;
|
|
14199
|
+
if (object !== null && typeof object === "object") {
|
|
14200
|
+
index = objects.indexOf(object);
|
|
14201
|
+
if (index !== -1) {
|
|
14202
|
+
if (duplicatesIndexes.indexOf(index) === -1) {
|
|
14203
|
+
duplicatesIndexes.push(index);
|
|
14204
|
+
}
|
|
14205
|
+
} else {
|
|
14206
|
+
objects.push(object);
|
|
14207
|
+
if (Array.isArray(object)) {
|
|
14208
|
+
for (index = 0, length = object.length; index < length; index += 1) {
|
|
14209
|
+
inspectNode(object[index], objects, duplicatesIndexes);
|
|
14210
|
+
}
|
|
14211
|
+
} else {
|
|
14212
|
+
objectKeyList = Object.keys(object);
|
|
14213
|
+
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
|
14214
|
+
inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);
|
|
14215
|
+
}
|
|
14216
|
+
}
|
|
14217
|
+
}
|
|
14218
|
+
}
|
|
14219
|
+
}
|
|
14220
|
+
function dump$1(input, options) {
|
|
14221
|
+
options = options || {};
|
|
14222
|
+
var state = new State(options);
|
|
14223
|
+
if (!state.noRefs) getDuplicateReferences(input, state);
|
|
14224
|
+
var value = input;
|
|
14225
|
+
if (state.replacer) {
|
|
14226
|
+
value = state.replacer.call({ "": value }, "", value);
|
|
14227
|
+
}
|
|
14228
|
+
if (writeNode(state, 0, value, true, true)) return state.dump + "\n";
|
|
14229
|
+
return "";
|
|
14230
|
+
}
|
|
14231
|
+
var dump_1 = dump$1;
|
|
14232
|
+
var dumper = {
|
|
14233
|
+
dump: dump_1
|
|
14234
|
+
};
|
|
14235
|
+
function renamed(from, to) {
|
|
14236
|
+
return function() {
|
|
14237
|
+
throw new Error("Function yaml." + from + " is removed in js-yaml 4. Use yaml." + to + " instead, which is now safe by default.");
|
|
14238
|
+
};
|
|
14239
|
+
}
|
|
14240
|
+
var Type = type;
|
|
14241
|
+
var Schema = schema;
|
|
14242
|
+
var FAILSAFE_SCHEMA = failsafe;
|
|
14243
|
+
var JSON_SCHEMA = json;
|
|
14244
|
+
var CORE_SCHEMA = core;
|
|
14245
|
+
var DEFAULT_SCHEMA = _default;
|
|
14246
|
+
var load = loader.load;
|
|
14247
|
+
var loadAll = loader.loadAll;
|
|
14248
|
+
var dump = dumper.dump;
|
|
14249
|
+
var YAMLException = exception;
|
|
14250
|
+
var types = {
|
|
14251
|
+
binary,
|
|
14252
|
+
float,
|
|
14253
|
+
map,
|
|
14254
|
+
null: _null,
|
|
14255
|
+
pairs,
|
|
14256
|
+
set,
|
|
14257
|
+
timestamp,
|
|
14258
|
+
bool,
|
|
14259
|
+
int,
|
|
14260
|
+
merge,
|
|
14261
|
+
omap,
|
|
14262
|
+
seq,
|
|
14263
|
+
str
|
|
14264
|
+
};
|
|
14265
|
+
var safeLoad = renamed("safeLoad", "load");
|
|
14266
|
+
var safeLoadAll = renamed("safeLoadAll", "loadAll");
|
|
14267
|
+
var safeDump = renamed("safeDump", "dump");
|
|
14268
|
+
var jsYaml = {
|
|
14269
|
+
Type,
|
|
14270
|
+
Schema,
|
|
14271
|
+
FAILSAFE_SCHEMA,
|
|
14272
|
+
JSON_SCHEMA,
|
|
14273
|
+
CORE_SCHEMA,
|
|
14274
|
+
DEFAULT_SCHEMA,
|
|
14275
|
+
load,
|
|
14276
|
+
loadAll,
|
|
14277
|
+
dump,
|
|
14278
|
+
YAMLException,
|
|
14279
|
+
types,
|
|
14280
|
+
safeLoad,
|
|
14281
|
+
safeLoadAll,
|
|
14282
|
+
safeDump
|
|
14283
|
+
};
|
|
14284
|
+
var js_yaml_default = jsYaml;
|
|
14285
|
+
|
|
14286
|
+
// src/openapi-loader.ts
|
|
14287
|
+
import crypto from "crypto";
|
|
14288
|
+
|
|
14289
|
+
// src/abbreviations.ts
|
|
14290
|
+
var REVISED_COMMON_WORDS_TO_REMOVE = [
|
|
14291
|
+
"controller",
|
|
14292
|
+
"api",
|
|
14293
|
+
"operation",
|
|
14294
|
+
"handler",
|
|
14295
|
+
"endpoint",
|
|
14296
|
+
"action",
|
|
14297
|
+
"perform",
|
|
14298
|
+
"execute",
|
|
14299
|
+
"retrieve",
|
|
14300
|
+
"specify",
|
|
14301
|
+
// generic verbs
|
|
14302
|
+
"for",
|
|
14303
|
+
"and",
|
|
14304
|
+
"the",
|
|
14305
|
+
"with",
|
|
14306
|
+
"from",
|
|
14307
|
+
"into",
|
|
14308
|
+
"onto",
|
|
14309
|
+
"out"
|
|
14310
|
+
// prepositions/articles
|
|
14311
|
+
];
|
|
14312
|
+
var WORD_ABBREVIATIONS = {
|
|
14313
|
+
service: "Svc",
|
|
14314
|
+
services: "Svcs",
|
|
14315
|
+
user: "Usr",
|
|
14316
|
+
users: "Usrs",
|
|
14317
|
+
management: "Mgmt",
|
|
14318
|
+
manager: "Mgr",
|
|
14319
|
+
manage: "Mng",
|
|
14320
|
+
authority: "Auth",
|
|
14321
|
+
authorities: "Auths",
|
|
14322
|
+
group: "Grp",
|
|
14323
|
+
groups: "Grps",
|
|
14324
|
+
update: "Upd",
|
|
14325
|
+
updating: "Upd",
|
|
14326
|
+
updated: "Upd",
|
|
14327
|
+
delete: "Del",
|
|
14328
|
+
deleting: "Del",
|
|
14329
|
+
deleted: "Del",
|
|
14330
|
+
create: "Crt",
|
|
14331
|
+
creating: "Crt",
|
|
14332
|
+
created: "Crt",
|
|
14333
|
+
get: "Get",
|
|
14334
|
+
getting: "Get",
|
|
14335
|
+
list: "Lst",
|
|
14336
|
+
listing: "Lst",
|
|
14337
|
+
post: "Pst",
|
|
14338
|
+
put: "Put",
|
|
14339
|
+
patch: "Ptch",
|
|
14340
|
+
request: "Req",
|
|
14341
|
+
response: "Resp",
|
|
14342
|
+
parameter: "Param",
|
|
14343
|
+
parameters: "Params",
|
|
14344
|
+
config: "Cfg",
|
|
14345
|
+
configuration: "Config",
|
|
14346
|
+
configure: "Cfg",
|
|
14347
|
+
resource: "Res",
|
|
14348
|
+
resources: "Resrcs",
|
|
14349
|
+
identity: "Id",
|
|
14350
|
+
identifier: "Id",
|
|
14351
|
+
identification: "Id",
|
|
14352
|
+
identifiers: "Ids",
|
|
14353
|
+
application: "App",
|
|
14354
|
+
account: "Acct",
|
|
14355
|
+
information: "Info",
|
|
14356
|
+
notification: "Notif",
|
|
14357
|
+
description: "Desc",
|
|
14358
|
+
summary: "Summ",
|
|
14359
|
+
version: "Ver",
|
|
14360
|
+
value: "Val",
|
|
14361
|
+
values: "Vals",
|
|
14362
|
+
authentication: "Authn",
|
|
14363
|
+
authorization: "Authz",
|
|
14364
|
+
specification: "Spec",
|
|
14365
|
+
document: "Doc",
|
|
14366
|
+
documents: "Docs",
|
|
14367
|
+
repository: "Repo",
|
|
14368
|
+
repositories: "Repos",
|
|
14369
|
+
experimental: "Exp",
|
|
14370
|
+
deprecated: "Depr",
|
|
14371
|
+
query: "Qry"
|
|
14372
|
+
};
|
|
14373
|
+
|
|
14374
|
+
// src/openapi-loader.ts
|
|
14375
|
+
var OpenAPISpecLoader = class {
|
|
14376
|
+
/**
|
|
14377
|
+
* Load an OpenAPI specification from a file path or URL
|
|
14378
|
+
*/
|
|
14379
|
+
async loadOpenAPISpec(specPathOrUrl) {
|
|
14380
|
+
let specContent;
|
|
14381
|
+
if (specPathOrUrl.startsWith("http://") || specPathOrUrl.startsWith("https://")) {
|
|
14382
|
+
const response = await fetch(specPathOrUrl);
|
|
14383
|
+
if (!response.ok) {
|
|
14384
|
+
throw new Error(`Failed to fetch OpenAPI spec from URL: ${specPathOrUrl}`);
|
|
14385
|
+
}
|
|
14386
|
+
specContent = await response.text();
|
|
14387
|
+
} else {
|
|
14388
|
+
specContent = await readFile(specPathOrUrl, "utf-8");
|
|
14389
|
+
}
|
|
14390
|
+
try {
|
|
14391
|
+
return JSON.parse(specContent);
|
|
14392
|
+
} catch (jsonError) {
|
|
14393
|
+
try {
|
|
14394
|
+
return js_yaml_default.load(specContent);
|
|
14395
|
+
} catch (yamlError) {
|
|
14396
|
+
throw new Error(
|
|
14397
|
+
`Failed to parse OpenAPI spec as JSON or YAML: ${jsonError.message} | ${yamlError.message}`
|
|
14398
|
+
);
|
|
14399
|
+
}
|
|
14400
|
+
}
|
|
14401
|
+
}
|
|
14402
|
+
/**
|
|
14403
|
+
* Parse an OpenAPI specification into a map of tools
|
|
14404
|
+
*/
|
|
14405
|
+
parseOpenAPISpec(spec) {
|
|
14406
|
+
const tools = /* @__PURE__ */ new Map();
|
|
14407
|
+
for (const [path, pathItem] of Object.entries(spec.paths)) {
|
|
14408
|
+
if (!pathItem) continue;
|
|
14409
|
+
for (const [method, operation] of Object.entries(pathItem)) {
|
|
14410
|
+
if (method === "parameters" || !operation) continue;
|
|
14411
|
+
if (!["get", "post", "put", "patch", "delete", "options", "head"].includes(method.toLowerCase())) {
|
|
14412
|
+
console.log(`Skipping non-HTTP method "${method}" for path ${path}`);
|
|
14413
|
+
continue;
|
|
14414
|
+
}
|
|
14415
|
+
const op = operation;
|
|
14416
|
+
const cleanPath = path.replace(/^\//, "").replace(/\{([^}]+)\}/g, "$1");
|
|
14417
|
+
const toolId = `${method.toUpperCase()}-${cleanPath}`.replace(/[^a-zA-Z0-9-]/g, "-");
|
|
14418
|
+
let nameSource = op.operationId || op.summary || `${method.toUpperCase()} ${path}`;
|
|
14419
|
+
const name = this.abbreviateOperationId(nameSource);
|
|
14420
|
+
const tool = {
|
|
14421
|
+
name,
|
|
14422
|
+
description: op.description || `Make a ${method.toUpperCase()} request to ${path}`,
|
|
14423
|
+
inputSchema: {
|
|
14424
|
+
type: "object",
|
|
14425
|
+
properties: {}
|
|
14426
|
+
}
|
|
14427
|
+
};
|
|
14428
|
+
if (op.parameters) {
|
|
14429
|
+
const requiredParams = [];
|
|
14430
|
+
for (const param of op.parameters) {
|
|
14431
|
+
if ("name" in param && "in" in param) {
|
|
14432
|
+
const paramSchema = param.schema;
|
|
14433
|
+
if (tool.inputSchema && tool.inputSchema.properties) {
|
|
14434
|
+
tool.inputSchema.properties[param.name] = {
|
|
14435
|
+
type: paramSchema.type || "string",
|
|
14436
|
+
description: param.description || `${param.name} parameter`
|
|
14437
|
+
};
|
|
14438
|
+
}
|
|
14439
|
+
if (param.required === true) {
|
|
14440
|
+
requiredParams.push(param.name);
|
|
14441
|
+
}
|
|
14442
|
+
}
|
|
14443
|
+
}
|
|
14444
|
+
if (requiredParams.length > 0 && tool.inputSchema) {
|
|
14445
|
+
tool.inputSchema.required = requiredParams;
|
|
14446
|
+
}
|
|
14447
|
+
}
|
|
14448
|
+
tools.set(toolId, tool);
|
|
14449
|
+
}
|
|
14450
|
+
}
|
|
14451
|
+
return tools;
|
|
14452
|
+
}
|
|
14453
|
+
// Helper function to generate a simple hash
|
|
14454
|
+
generateShortHash(input, length = 4) {
|
|
14455
|
+
return crypto.createHash("sha256").update(input).digest("hex").substring(0, length);
|
|
14456
|
+
}
|
|
14457
|
+
// Helper to split by underscore, camelCase, and numbers, then filter out empty strings
|
|
14458
|
+
splitCombined(input) {
|
|
14459
|
+
const underscoreParts = input.split("_");
|
|
14460
|
+
let combinedParts = [];
|
|
14461
|
+
underscoreParts.forEach((part) => {
|
|
14462
|
+
const spacedPart = part.replace(/([A-Z]+)/g, " $1").replace(/([A-Z][a-z])/g, " $1").replace(/([a-z])([0-9])/g, "$1 $2").replace(/([0-9])([A-Za-z])/g, "$1 $2");
|
|
14463
|
+
const splitParts = spacedPart.split(" ").filter((p) => p.length > 0);
|
|
14464
|
+
combinedParts = combinedParts.concat(splitParts);
|
|
14465
|
+
});
|
|
14466
|
+
return combinedParts.map((p) => p.trim()).filter((p) => p.length > 0);
|
|
14467
|
+
}
|
|
14468
|
+
_initialSanitizeAndValidate(originalId, maxLength) {
|
|
14469
|
+
if (!originalId || originalId.trim().length === 0)
|
|
14470
|
+
return { currentName: "", originalWasLong: false, errorName: "unnamed-tool" };
|
|
14471
|
+
const originalWasLong = originalId.length > maxLength;
|
|
14472
|
+
let currentName = originalId.replace(/[^a-zA-Z0-9_]/g, "-");
|
|
14473
|
+
currentName = currentName.replace(/-+/g, "-").replace(/^-+|-+$/g, "");
|
|
14474
|
+
if (currentName.length === 0)
|
|
14475
|
+
return {
|
|
14476
|
+
currentName: "",
|
|
14477
|
+
originalWasLong,
|
|
14478
|
+
errorName: "tool-" + this.generateShortHash(originalId, 8)
|
|
14479
|
+
};
|
|
14480
|
+
return { currentName, originalWasLong };
|
|
14481
|
+
}
|
|
14482
|
+
_performSemanticAbbreviation(name) {
|
|
14483
|
+
let parts = this.splitCombined(name);
|
|
14484
|
+
parts = parts.filter((part) => {
|
|
14485
|
+
const cleanPartForCheck = part.toLowerCase().replace(/-+$/, "");
|
|
14486
|
+
return !REVISED_COMMON_WORDS_TO_REMOVE.includes(cleanPartForCheck);
|
|
14487
|
+
});
|
|
14488
|
+
parts = parts.map((part) => {
|
|
14489
|
+
const lowerPart = part.toLowerCase();
|
|
14490
|
+
if (WORD_ABBREVIATIONS[lowerPart]) {
|
|
14491
|
+
const abbr = WORD_ABBREVIATIONS[lowerPart];
|
|
14492
|
+
if (part.length > 0 && part[0] === part[0].toUpperCase() && part.slice(1) === part.slice(1).toLowerCase()) {
|
|
14493
|
+
return abbr[0].toUpperCase() + abbr.substring(1).toLowerCase();
|
|
14494
|
+
} else if (part === part.toUpperCase() && part.length > 1 && abbr.length > 1) {
|
|
14495
|
+
return abbr.toUpperCase();
|
|
14496
|
+
} else if (part.length > 0 && part[0] === part[0].toUpperCase()) {
|
|
14497
|
+
return abbr[0].toUpperCase() + abbr.substring(1).toLowerCase();
|
|
14498
|
+
}
|
|
14499
|
+
return abbr.toLowerCase();
|
|
14500
|
+
}
|
|
14501
|
+
return part;
|
|
14502
|
+
});
|
|
14503
|
+
return parts.join("-");
|
|
14504
|
+
}
|
|
14505
|
+
_applyVowelRemovalIfOverLength(name, maxLength) {
|
|
14506
|
+
let currentName = name;
|
|
14507
|
+
if (currentName.length > maxLength) {
|
|
14508
|
+
const currentParts = currentName.split("-");
|
|
14509
|
+
const newParts = currentParts.map((part) => {
|
|
14510
|
+
const isAbbreviation = Object.values(WORD_ABBREVIATIONS).some(
|
|
14511
|
+
(abbr) => abbr.toLowerCase() === part.toLowerCase()
|
|
14512
|
+
);
|
|
14513
|
+
if (part.length > 5 && !isAbbreviation) {
|
|
14514
|
+
const newPart = part[0] + part.substring(1).replace(/[aeiouAEIOU]/g, "");
|
|
14515
|
+
if (newPart.length < part.length && newPart.length > 1) return newPart;
|
|
14516
|
+
}
|
|
14517
|
+
return part;
|
|
14518
|
+
});
|
|
14519
|
+
currentName = newParts.join("-");
|
|
14520
|
+
}
|
|
14521
|
+
return currentName;
|
|
14522
|
+
}
|
|
14523
|
+
_truncateAndApplyHashIfNeeded(name, originalId, originalWasLong, maxLength) {
|
|
14524
|
+
let currentName = name;
|
|
14525
|
+
currentName = currentName.replace(/-+/g, "-").replace(/^-+|-+$/g, "");
|
|
14526
|
+
const needsHash = originalWasLong || currentName.length > maxLength;
|
|
14527
|
+
if (needsHash) {
|
|
14528
|
+
const hash = this.generateShortHash(originalId, 4);
|
|
14529
|
+
const maxLengthForBase = maxLength - hash.length - 1;
|
|
14530
|
+
if (currentName.length > maxLengthForBase) {
|
|
14531
|
+
currentName = currentName.substring(0, maxLengthForBase);
|
|
14532
|
+
currentName = currentName.replace(/-+$/, "");
|
|
14533
|
+
}
|
|
14534
|
+
currentName = currentName + "-" + hash;
|
|
14535
|
+
}
|
|
14536
|
+
return currentName;
|
|
14537
|
+
}
|
|
14538
|
+
_finalizeNameFormatting(name, originalId, maxLength) {
|
|
14539
|
+
let finalName = name.toLowerCase();
|
|
14540
|
+
finalName = finalName.replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-").replace(/^-+|-+$/g, "");
|
|
14541
|
+
if (finalName.length > maxLength) {
|
|
14542
|
+
finalName = finalName.substring(0, maxLength);
|
|
14543
|
+
finalName = finalName.replace(/-+$/, "");
|
|
14544
|
+
}
|
|
14545
|
+
if (finalName.length === 0) {
|
|
14546
|
+
return "tool-" + this.generateShortHash(originalId, 8);
|
|
14547
|
+
}
|
|
14548
|
+
return finalName;
|
|
14549
|
+
}
|
|
14550
|
+
abbreviateOperationId(originalId, maxLength = 64) {
|
|
14551
|
+
const {
|
|
14552
|
+
currentName: sanitizedName,
|
|
14553
|
+
originalWasLong,
|
|
14554
|
+
errorName
|
|
14555
|
+
} = this._initialSanitizeAndValidate(originalId, maxLength);
|
|
14556
|
+
if (errorName) return errorName;
|
|
14557
|
+
let processedName = this._performSemanticAbbreviation(sanitizedName);
|
|
14558
|
+
processedName = this._applyVowelRemovalIfOverLength(processedName, maxLength);
|
|
14559
|
+
processedName = this._truncateAndApplyHashIfNeeded(
|
|
14560
|
+
processedName,
|
|
14561
|
+
originalId,
|
|
14562
|
+
originalWasLong,
|
|
14563
|
+
maxLength
|
|
14564
|
+
);
|
|
14565
|
+
processedName = this._finalizeNameFormatting(processedName, originalId, maxLength);
|
|
14566
|
+
return processedName;
|
|
14567
|
+
}
|
|
14568
|
+
};
|
|
14569
|
+
|
|
14570
|
+
// src/tools-manager.ts
|
|
14571
|
+
var ToolsManager = class {
|
|
14572
|
+
constructor(config) {
|
|
14573
|
+
this.config = config;
|
|
14574
|
+
this.specLoader = new OpenAPISpecLoader();
|
|
14575
|
+
}
|
|
14576
|
+
tools = /* @__PURE__ */ new Map();
|
|
14577
|
+
specLoader;
|
|
14578
|
+
/**
|
|
14579
|
+
* Initialize tools from the OpenAPI specification
|
|
14580
|
+
*/
|
|
14581
|
+
async initialize() {
|
|
14582
|
+
const spec = await this.specLoader.loadOpenAPISpec(this.config.openApiSpec);
|
|
14583
|
+
this.tools = this.specLoader.parseOpenAPISpec(spec);
|
|
14584
|
+
for (const [toolId, tool] of this.tools.entries()) {
|
|
14585
|
+
console.error(`Registered tool: ${toolId} (${tool.name})`);
|
|
14586
|
+
}
|
|
14587
|
+
}
|
|
14588
|
+
/**
|
|
14589
|
+
* Get all available tools
|
|
14590
|
+
*/
|
|
14591
|
+
getAllTools() {
|
|
14592
|
+
return Array.from(this.tools.values());
|
|
14593
|
+
}
|
|
14594
|
+
/**
|
|
14595
|
+
* Find a tool by ID or name
|
|
14596
|
+
*/
|
|
14597
|
+
findTool(idOrName) {
|
|
14598
|
+
if (this.tools.has(idOrName)) {
|
|
14599
|
+
return { toolId: idOrName, tool: this.tools.get(idOrName) };
|
|
14600
|
+
}
|
|
14601
|
+
for (const [toolId, tool] of this.tools.entries()) {
|
|
14602
|
+
if (tool.name === idOrName) {
|
|
14603
|
+
return { toolId, tool };
|
|
14604
|
+
}
|
|
14605
|
+
}
|
|
14606
|
+
return void 0;
|
|
14607
|
+
}
|
|
14608
|
+
/**
|
|
14609
|
+
* Get the path and method from a tool ID
|
|
14610
|
+
*/
|
|
14611
|
+
parseToolId(toolId) {
|
|
14612
|
+
const [method, ...pathParts] = toolId.split("-");
|
|
14613
|
+
const path = "/" + pathParts.join("/").replace(/-/g, "/");
|
|
14614
|
+
return { method, path };
|
|
14615
|
+
}
|
|
14616
|
+
};
|
|
14617
|
+
|
|
11661
14618
|
// node_modules/axios/lib/helpers/bind.js
|
|
11662
14619
|
function bind(fn, thisArg) {
|
|
11663
14620
|
return function wrap2() {
|
|
@@ -11666,18 +14623,18 @@ function bind(fn, thisArg) {
|
|
|
11666
14623
|
}
|
|
11667
14624
|
|
|
11668
14625
|
// node_modules/axios/lib/utils.js
|
|
11669
|
-
var { toString } = Object.prototype;
|
|
14626
|
+
var { toString: toString2 } = Object.prototype;
|
|
11670
14627
|
var { getPrototypeOf } = Object;
|
|
11671
14628
|
var { iterator, toStringTag } = Symbol;
|
|
11672
14629
|
var kindOf = /* @__PURE__ */ ((cache) => (thing) => {
|
|
11673
|
-
const
|
|
11674
|
-
return cache[
|
|
14630
|
+
const str2 = toString2.call(thing);
|
|
14631
|
+
return cache[str2] || (cache[str2] = str2.slice(8, -1).toLowerCase());
|
|
11675
14632
|
})(/* @__PURE__ */ Object.create(null));
|
|
11676
|
-
var kindOfTest = (
|
|
11677
|
-
|
|
11678
|
-
return (thing) => kindOf(thing) ===
|
|
14633
|
+
var kindOfTest = (type2) => {
|
|
14634
|
+
type2 = type2.toLowerCase();
|
|
14635
|
+
return (thing) => kindOf(thing) === type2;
|
|
11679
14636
|
};
|
|
11680
|
-
var typeOfTest = (
|
|
14637
|
+
var typeOfTest = (type2) => (thing) => typeof thing === type2;
|
|
11681
14638
|
var { isArray } = Array;
|
|
11682
14639
|
var isUndefined = typeOfTest("undefined");
|
|
11683
14640
|
function isBuffer(val) {
|
|
@@ -11696,8 +14653,8 @@ function isArrayBufferView(val) {
|
|
|
11696
14653
|
var isString = typeOfTest("string");
|
|
11697
14654
|
var isFunction = typeOfTest("function");
|
|
11698
14655
|
var isNumber = typeOfTest("number");
|
|
11699
|
-
var
|
|
11700
|
-
var
|
|
14656
|
+
var isObject2 = (thing) => thing !== null && typeof thing === "object";
|
|
14657
|
+
var isBoolean2 = (thing) => thing === true || thing === false;
|
|
11701
14658
|
var isPlainObject = (val) => {
|
|
11702
14659
|
if (kindOf(val) !== "object") {
|
|
11703
14660
|
return false;
|
|
@@ -11709,7 +14666,7 @@ var isDate = kindOfTest("Date");
|
|
|
11709
14666
|
var isFile = kindOfTest("File");
|
|
11710
14667
|
var isBlob = kindOfTest("Blob");
|
|
11711
14668
|
var isFileList = kindOfTest("FileList");
|
|
11712
|
-
var isStream = (val) =>
|
|
14669
|
+
var isStream = (val) => isObject2(val) && isFunction(val.pipe);
|
|
11713
14670
|
var isFormData = (thing) => {
|
|
11714
14671
|
let kind;
|
|
11715
14672
|
return thing && (typeof FormData === "function" && thing instanceof FormData || isFunction(thing.append) && ((kind = kindOf(thing)) === "formdata" || // detect form-data instance
|
|
@@ -11717,7 +14674,7 @@ var isFormData = (thing) => {
|
|
|
11717
14674
|
};
|
|
11718
14675
|
var isURLSearchParams = kindOfTest("URLSearchParams");
|
|
11719
14676
|
var [isReadableStream, isRequest, isResponse, isHeaders] = ["ReadableStream", "Request", "Response", "Headers"].map(kindOfTest);
|
|
11720
|
-
var trim = (
|
|
14677
|
+
var trim = (str2) => str2.trim ? str2.trim() : str2.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
11721
14678
|
function forEach(obj, fn, { allOwnKeys = false } = {}) {
|
|
11722
14679
|
if (obj === null || typeof obj === "undefined") {
|
|
11723
14680
|
return;
|
|
@@ -11759,15 +14716,15 @@ var _global = (() => {
|
|
|
11759
14716
|
return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : global;
|
|
11760
14717
|
})();
|
|
11761
14718
|
var isContextDefined = (context) => !isUndefined(context) && context !== _global;
|
|
11762
|
-
function
|
|
14719
|
+
function merge2() {
|
|
11763
14720
|
const { caseless } = isContextDefined(this) && this || {};
|
|
11764
14721
|
const result = {};
|
|
11765
14722
|
const assignValue = (val, key) => {
|
|
11766
14723
|
const targetKey = caseless && findKey(result, key) || key;
|
|
11767
14724
|
if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
|
|
11768
|
-
result[targetKey] =
|
|
14725
|
+
result[targetKey] = merge2(result[targetKey], val);
|
|
11769
14726
|
} else if (isPlainObject(val)) {
|
|
11770
|
-
result[targetKey] =
|
|
14727
|
+
result[targetKey] = merge2({}, val);
|
|
11771
14728
|
} else if (isArray(val)) {
|
|
11772
14729
|
result[targetKey] = val.slice();
|
|
11773
14730
|
} else {
|
|
@@ -11779,7 +14736,7 @@ function merge() {
|
|
|
11779
14736
|
}
|
|
11780
14737
|
return result;
|
|
11781
14738
|
}
|
|
11782
|
-
var
|
|
14739
|
+
var extend3 = (a, b, thisArg, { allOwnKeys } = {}) => {
|
|
11783
14740
|
forEach(b, (val, key) => {
|
|
11784
14741
|
if (thisArg && isFunction(val)) {
|
|
11785
14742
|
a[key] = bind(val, thisArg);
|
|
@@ -11824,16 +14781,16 @@ var toFlatObject = (sourceObj, destObj, filter2, propFilter) => {
|
|
|
11824
14781
|
} while (sourceObj && (!filter2 || filter2(sourceObj, destObj)) && sourceObj !== Object.prototype);
|
|
11825
14782
|
return destObj;
|
|
11826
14783
|
};
|
|
11827
|
-
var endsWith = (
|
|
11828
|
-
|
|
11829
|
-
if (position === void 0 || position >
|
|
11830
|
-
position =
|
|
14784
|
+
var endsWith = (str2, searchString, position) => {
|
|
14785
|
+
str2 = String(str2);
|
|
14786
|
+
if (position === void 0 || position > str2.length) {
|
|
14787
|
+
position = str2.length;
|
|
11831
14788
|
}
|
|
11832
14789
|
position -= searchString.length;
|
|
11833
|
-
const lastIndex =
|
|
14790
|
+
const lastIndex = str2.indexOf(searchString, position);
|
|
11834
14791
|
return lastIndex !== -1 && lastIndex === position;
|
|
11835
14792
|
};
|
|
11836
|
-
var
|
|
14793
|
+
var toArray2 = (thing) => {
|
|
11837
14794
|
if (!thing) return null;
|
|
11838
14795
|
if (isArray(thing)) return thing;
|
|
11839
14796
|
let i = thing.length;
|
|
@@ -11858,17 +14815,17 @@ var forEachEntry = (obj, fn) => {
|
|
|
11858
14815
|
fn.call(obj, pair[0], pair[1]);
|
|
11859
14816
|
}
|
|
11860
14817
|
};
|
|
11861
|
-
var matchAll = (regExp,
|
|
14818
|
+
var matchAll = (regExp, str2) => {
|
|
11862
14819
|
let matches;
|
|
11863
14820
|
const arr = [];
|
|
11864
|
-
while ((matches = regExp.exec(
|
|
14821
|
+
while ((matches = regExp.exec(str2)) !== null) {
|
|
11865
14822
|
arr.push(matches);
|
|
11866
14823
|
}
|
|
11867
14824
|
return arr;
|
|
11868
14825
|
};
|
|
11869
14826
|
var isHTMLForm = kindOfTest("HTMLFormElement");
|
|
11870
|
-
var toCamelCase = (
|
|
11871
|
-
return
|
|
14827
|
+
var toCamelCase = (str2) => {
|
|
14828
|
+
return str2.toLowerCase().replace(
|
|
11872
14829
|
/[-_\s]([a-z\d])(\w*)/g,
|
|
11873
14830
|
function replacer(m, p1, p2) {
|
|
11874
14831
|
return p1.toUpperCase() + p2;
|
|
@@ -11928,7 +14885,7 @@ function isSpecCompliantForm(thing) {
|
|
|
11928
14885
|
var toJSONObject = (obj) => {
|
|
11929
14886
|
const stack = new Array(10);
|
|
11930
14887
|
const visit = (source, i) => {
|
|
11931
|
-
if (
|
|
14888
|
+
if (isObject2(source)) {
|
|
11932
14889
|
if (stack.indexOf(source) >= 0) {
|
|
11933
14890
|
return;
|
|
11934
14891
|
}
|
|
@@ -11948,7 +14905,7 @@ var toJSONObject = (obj) => {
|
|
|
11948
14905
|
return visit(obj, 0);
|
|
11949
14906
|
};
|
|
11950
14907
|
var isAsyncFn = kindOfTest("AsyncFunction");
|
|
11951
|
-
var isThenable = (thing) => thing && (
|
|
14908
|
+
var isThenable = (thing) => thing && (isObject2(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
|
|
11952
14909
|
var _setImmediate = ((setImmediateSupported, postMessageSupported) => {
|
|
11953
14910
|
if (setImmediateSupported) {
|
|
11954
14911
|
return setImmediate;
|
|
@@ -11978,8 +14935,8 @@ var utils_default = {
|
|
|
11978
14935
|
isArrayBufferView,
|
|
11979
14936
|
isString,
|
|
11980
14937
|
isNumber,
|
|
11981
|
-
isBoolean,
|
|
11982
|
-
isObject,
|
|
14938
|
+
isBoolean: isBoolean2,
|
|
14939
|
+
isObject: isObject2,
|
|
11983
14940
|
isPlainObject,
|
|
11984
14941
|
isReadableStream,
|
|
11985
14942
|
isRequest,
|
|
@@ -11996,8 +14953,8 @@ var utils_default = {
|
|
|
11996
14953
|
isTypedArray,
|
|
11997
14954
|
isFileList,
|
|
11998
14955
|
forEach,
|
|
11999
|
-
merge,
|
|
12000
|
-
extend,
|
|
14956
|
+
merge: merge2,
|
|
14957
|
+
extend: extend3,
|
|
12001
14958
|
trim,
|
|
12002
14959
|
stripBOM,
|
|
12003
14960
|
inherits,
|
|
@@ -12005,7 +14962,7 @@ var utils_default = {
|
|
|
12005
14962
|
kindOf,
|
|
12006
14963
|
kindOfTest,
|
|
12007
14964
|
endsWith,
|
|
12008
|
-
toArray,
|
|
14965
|
+
toArray: toArray2,
|
|
12009
14966
|
forEachEntry,
|
|
12010
14967
|
matchAll,
|
|
12011
14968
|
isHTMLForm,
|
|
@@ -12222,7 +15179,7 @@ function toFormData(obj, formData, options) {
|
|
|
12222
15179
|
var toFormData_default = toFormData;
|
|
12223
15180
|
|
|
12224
15181
|
// node_modules/axios/lib/helpers/AxiosURLSearchParams.js
|
|
12225
|
-
function encode(
|
|
15182
|
+
function encode(str2) {
|
|
12226
15183
|
const charMap = {
|
|
12227
15184
|
"!": "%21",
|
|
12228
15185
|
"'": "%27",
|
|
@@ -12232,7 +15189,7 @@ function encode(str) {
|
|
|
12232
15189
|
"%20": "+",
|
|
12233
15190
|
"%00": "\0"
|
|
12234
15191
|
};
|
|
12235
|
-
return encodeURIComponent(
|
|
15192
|
+
return encodeURIComponent(str2).replace(/[!'()~]|%20|%00/g, function replacer(match) {
|
|
12236
15193
|
return charMap[match];
|
|
12237
15194
|
});
|
|
12238
15195
|
}
|
|
@@ -12244,7 +15201,7 @@ var prototype2 = AxiosURLSearchParams.prototype;
|
|
|
12244
15201
|
prototype2.append = function append(name, value) {
|
|
12245
15202
|
this._pairs.push([name, value]);
|
|
12246
15203
|
};
|
|
12247
|
-
prototype2.toString = function
|
|
15204
|
+
prototype2.toString = function toString3(encoder) {
|
|
12248
15205
|
const _encode = encoder ? function(value) {
|
|
12249
15206
|
return encoder.call(this, value, encode);
|
|
12250
15207
|
} : encode;
|
|
@@ -12357,7 +15314,7 @@ var transitional_default = {
|
|
|
12357
15314
|
};
|
|
12358
15315
|
|
|
12359
15316
|
// node_modules/axios/lib/platform/node/index.js
|
|
12360
|
-
import
|
|
15317
|
+
import crypto2 from "crypto";
|
|
12361
15318
|
|
|
12362
15319
|
// node_modules/axios/lib/platform/node/classes/URLSearchParams.js
|
|
12363
15320
|
import url from "url";
|
|
@@ -12372,14 +15329,14 @@ var ALPHABET = {
|
|
|
12372
15329
|
ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
|
|
12373
15330
|
};
|
|
12374
15331
|
var generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
|
|
12375
|
-
let
|
|
15332
|
+
let str2 = "";
|
|
12376
15333
|
const { length } = alphabet;
|
|
12377
15334
|
const randomValues = new Uint32Array(size);
|
|
12378
|
-
|
|
15335
|
+
crypto2.randomFillSync(randomValues);
|
|
12379
15336
|
for (let i = 0; i < size; i++) {
|
|
12380
|
-
|
|
15337
|
+
str2 += alphabet[randomValues[i] % length];
|
|
12381
15338
|
}
|
|
12382
|
-
return
|
|
15339
|
+
return str2;
|
|
12383
15340
|
};
|
|
12384
15341
|
var node_default = {
|
|
12385
15342
|
isNode: true,
|
|
@@ -12648,16 +15605,16 @@ function normalizeValue(value) {
|
|
|
12648
15605
|
}
|
|
12649
15606
|
return utils_default.isArray(value) ? value.map(normalizeValue) : String(value);
|
|
12650
15607
|
}
|
|
12651
|
-
function parseTokens(
|
|
15608
|
+
function parseTokens(str2) {
|
|
12652
15609
|
const tokens = /* @__PURE__ */ Object.create(null);
|
|
12653
15610
|
const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
12654
15611
|
let match;
|
|
12655
|
-
while (match = tokensRE.exec(
|
|
15612
|
+
while (match = tokensRE.exec(str2)) {
|
|
12656
15613
|
tokens[match[1]] = match[2];
|
|
12657
15614
|
}
|
|
12658
15615
|
return tokens;
|
|
12659
15616
|
}
|
|
12660
|
-
var isValidHeaderName = (
|
|
15617
|
+
var isValidHeaderName = (str2) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str2.trim());
|
|
12661
15618
|
function matchHeaderValue(context, value, header, filter2, isHeaderNameFilter) {
|
|
12662
15619
|
if (utils_default.isFunction(filter2)) {
|
|
12663
15620
|
return filter2.call(this, value, header);
|
|
@@ -12674,8 +15631,8 @@ function matchHeaderValue(context, value, header, filter2, isHeaderNameFilter) {
|
|
|
12674
15631
|
}
|
|
12675
15632
|
}
|
|
12676
15633
|
function formatHeader(header) {
|
|
12677
|
-
return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char,
|
|
12678
|
-
return char.toUpperCase() +
|
|
15634
|
+
return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str2) => {
|
|
15635
|
+
return char.toUpperCase() + str2;
|
|
12679
15636
|
});
|
|
12680
15637
|
}
|
|
12681
15638
|
function buildAccessors(obj, header) {
|
|
@@ -13269,12 +16226,12 @@ var speedometer_default = speedometer;
|
|
|
13269
16226
|
|
|
13270
16227
|
// node_modules/axios/lib/helpers/throttle.js
|
|
13271
16228
|
function throttle(fn, freq) {
|
|
13272
|
-
let
|
|
16229
|
+
let timestamp2 = 0;
|
|
13273
16230
|
let threshold = 1e3 / freq;
|
|
13274
16231
|
let lastArgs;
|
|
13275
16232
|
let timer;
|
|
13276
16233
|
const invoke = (args, now = Date.now()) => {
|
|
13277
|
-
|
|
16234
|
+
timestamp2 = now;
|
|
13278
16235
|
lastArgs = null;
|
|
13279
16236
|
if (timer) {
|
|
13280
16237
|
clearTimeout(timer);
|
|
@@ -13284,7 +16241,7 @@ function throttle(fn, freq) {
|
|
|
13284
16241
|
};
|
|
13285
16242
|
const throttled = (...args) => {
|
|
13286
16243
|
const now = Date.now();
|
|
13287
|
-
const passed = now -
|
|
16244
|
+
const passed = now - timestamp2;
|
|
13288
16245
|
if (passed >= threshold) {
|
|
13289
16246
|
invoke(args, now);
|
|
13290
16247
|
} else {
|
|
@@ -13953,9 +16910,9 @@ function mergeConfig(config1, config2) {
|
|
|
13953
16910
|
headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
|
|
13954
16911
|
};
|
|
13955
16912
|
utils_default.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
|
13956
|
-
const
|
|
13957
|
-
const configValue =
|
|
13958
|
-
utils_default.isUndefined(configValue) &&
|
|
16913
|
+
const merge3 = mergeMap[prop] || mergeDeepProperties;
|
|
16914
|
+
const configValue = merge3(config1[prop], config2[prop], prop);
|
|
16915
|
+
utils_default.isUndefined(configValue) && merge3 !== mergeDirectKeys || (config[prop] = configValue);
|
|
13959
16916
|
});
|
|
13960
16917
|
return config;
|
|
13961
16918
|
}
|
|
@@ -13977,8 +16934,8 @@ var resolveConfig_default = (config) => {
|
|
|
13977
16934
|
if (platform_default.hasStandardBrowserEnv || platform_default.hasStandardBrowserWebWorkerEnv) {
|
|
13978
16935
|
headers.setContentType(void 0);
|
|
13979
16936
|
} else if ((contentType = headers.getContentType()) !== false) {
|
|
13980
|
-
const [
|
|
13981
|
-
headers.setContentType([
|
|
16937
|
+
const [type2, ...tokens] = contentType ? contentType.split(";").map((token) => token.trim()).filter(Boolean) : [];
|
|
16938
|
+
headers.setContentType([type2 || "multipart/form-data", ...tokens].join("; "));
|
|
13982
16939
|
}
|
|
13983
16940
|
}
|
|
13984
16941
|
if (platform_default.hasStandardBrowserEnv) {
|
|
@@ -14236,7 +17193,7 @@ var trackStream = (stream4, chunkSize, onProgress, onFinish) => {
|
|
|
14236
17193
|
// node_modules/axios/lib/adapters/fetch.js
|
|
14237
17194
|
var isFetchSupported = typeof fetch === "function" && typeof Request === "function" && typeof Response === "function";
|
|
14238
17195
|
var isReadableStreamSupported = isFetchSupported && typeof ReadableStream === "function";
|
|
14239
|
-
var encodeText = isFetchSupported && (typeof TextEncoder === "function" ? /* @__PURE__ */ ((encoder) => (
|
|
17196
|
+
var encodeText = isFetchSupported && (typeof TextEncoder === "function" ? /* @__PURE__ */ ((encoder) => (str2) => encoder.encode(str2))(new TextEncoder()) : async (str2) => new Uint8Array(await new Response(str2).arrayBuffer()));
|
|
14240
17197
|
var test = (fn, ...args) => {
|
|
14241
17198
|
try {
|
|
14242
17199
|
return !!fn(...args);
|
|
@@ -14262,9 +17219,9 @@ var resolvers = {
|
|
|
14262
17219
|
stream: supportsResponseStream && ((res) => res.body)
|
|
14263
17220
|
};
|
|
14264
17221
|
isFetchSupported && ((res) => {
|
|
14265
|
-
["text", "arrayBuffer", "blob", "formData", "stream"].forEach((
|
|
14266
|
-
!resolvers[
|
|
14267
|
-
throw new AxiosError_default(`Response type '${
|
|
17222
|
+
["text", "arrayBuffer", "blob", "formData", "stream"].forEach((type2) => {
|
|
17223
|
+
!resolvers[type2] && (resolvers[type2] = utils_default.isFunction(res[type2]) ? (res2) => res2[type2]() : (_, config) => {
|
|
17224
|
+
throw new AxiosError_default(`Response type '${type2}' is not supported`, AxiosError_default.ERR_NOT_SUPPORT, config);
|
|
14268
17225
|
});
|
|
14269
17226
|
});
|
|
14270
17227
|
})(new Response());
|
|
@@ -14498,9 +17455,9 @@ function dispatchRequest(config) {
|
|
|
14498
17455
|
|
|
14499
17456
|
// node_modules/axios/lib/helpers/validator.js
|
|
14500
17457
|
var validators = {};
|
|
14501
|
-
["object", "boolean", "number", "function", "string", "symbol"].forEach((
|
|
14502
|
-
validators[
|
|
14503
|
-
return typeof thing ===
|
|
17458
|
+
["object", "boolean", "number", "function", "string", "symbol"].forEach((type2, i) => {
|
|
17459
|
+
validators[type2] = function validator(thing) {
|
|
17460
|
+
return typeof thing === type2 || "a" + (i < 1 ? "n " : " ") + type2;
|
|
14504
17461
|
};
|
|
14505
17462
|
});
|
|
14506
17463
|
var deprecatedWarnings = {};
|
|
@@ -14533,7 +17490,7 @@ validators.spelling = function spelling(correctSpelling) {
|
|
|
14533
17490
|
return true;
|
|
14534
17491
|
};
|
|
14535
17492
|
};
|
|
14536
|
-
function assertOptions(options,
|
|
17493
|
+
function assertOptions(options, schema2, allowUnknown) {
|
|
14537
17494
|
if (typeof options !== "object") {
|
|
14538
17495
|
throw new AxiosError_default("options must be an object", AxiosError_default.ERR_BAD_OPTION_VALUE);
|
|
14539
17496
|
}
|
|
@@ -14541,7 +17498,7 @@ function assertOptions(options, schema, allowUnknown) {
|
|
|
14541
17498
|
let i = keys.length;
|
|
14542
17499
|
while (i-- > 0) {
|
|
14543
17500
|
const opt = keys[i];
|
|
14544
|
-
const validator =
|
|
17501
|
+
const validator = schema2[opt];
|
|
14545
17502
|
if (validator) {
|
|
14546
17503
|
const value = options[opt];
|
|
14547
17504
|
const result = value === void 0 || validator(value, opt, options);
|
|
@@ -14967,120 +17924,6 @@ var {
|
|
|
14967
17924
|
mergeConfig: mergeConfig2
|
|
14968
17925
|
} = axios_default;
|
|
14969
17926
|
|
|
14970
|
-
// src/openapi-loader.ts
|
|
14971
|
-
import { readFile } from "fs/promises";
|
|
14972
|
-
var OpenAPISpecLoader = class {
|
|
14973
|
-
/**
|
|
14974
|
-
* Load an OpenAPI specification from a file or URL
|
|
14975
|
-
*/
|
|
14976
|
-
async loadOpenAPISpec(specPath) {
|
|
14977
|
-
if (specPath.startsWith("http")) {
|
|
14978
|
-
const response = await axios_default.get(specPath);
|
|
14979
|
-
return response.data;
|
|
14980
|
-
} else {
|
|
14981
|
-
const content = await readFile(specPath, "utf-8");
|
|
14982
|
-
return JSON.parse(content);
|
|
14983
|
-
}
|
|
14984
|
-
}
|
|
14985
|
-
/**
|
|
14986
|
-
* Parse an OpenAPI specification into a map of tools
|
|
14987
|
-
*/
|
|
14988
|
-
parseOpenAPISpec(spec) {
|
|
14989
|
-
const tools = /* @__PURE__ */ new Map();
|
|
14990
|
-
for (const [path, pathItem] of Object.entries(spec.paths)) {
|
|
14991
|
-
if (!pathItem) continue;
|
|
14992
|
-
for (const [method, operation] of Object.entries(pathItem)) {
|
|
14993
|
-
if (method === "parameters" || !operation) continue;
|
|
14994
|
-
const op = operation;
|
|
14995
|
-
const cleanPath = path.replace(/^\//, "").replace(/\{([^}]+)\}/g, "$1");
|
|
14996
|
-
const toolId = `${method.toUpperCase()}-${cleanPath}`.replace(/[^a-zA-Z0-9-]/g, "-");
|
|
14997
|
-
const name = (op.operationId || op.summary || `${method.toUpperCase()} ${path}`).replace(
|
|
14998
|
-
/[^a-zA-Z0-9-]/g,
|
|
14999
|
-
"-"
|
|
15000
|
-
);
|
|
15001
|
-
const tool = {
|
|
15002
|
-
name,
|
|
15003
|
-
description: op.description || `Make a ${method.toUpperCase()} request to ${path}`,
|
|
15004
|
-
inputSchema: {
|
|
15005
|
-
type: "object",
|
|
15006
|
-
properties: {}
|
|
15007
|
-
}
|
|
15008
|
-
};
|
|
15009
|
-
if (op.parameters) {
|
|
15010
|
-
const requiredParams = [];
|
|
15011
|
-
for (const param of op.parameters) {
|
|
15012
|
-
if ("name" in param && "in" in param) {
|
|
15013
|
-
const paramSchema = param.schema;
|
|
15014
|
-
if (tool.inputSchema && tool.inputSchema.properties) {
|
|
15015
|
-
tool.inputSchema.properties[param.name] = {
|
|
15016
|
-
type: paramSchema.type || "string",
|
|
15017
|
-
description: param.description || `${param.name} parameter`
|
|
15018
|
-
};
|
|
15019
|
-
}
|
|
15020
|
-
if (param.required === true) {
|
|
15021
|
-
requiredParams.push(param.name);
|
|
15022
|
-
}
|
|
15023
|
-
}
|
|
15024
|
-
}
|
|
15025
|
-
if (requiredParams.length > 0 && tool.inputSchema) {
|
|
15026
|
-
tool.inputSchema.required = requiredParams;
|
|
15027
|
-
}
|
|
15028
|
-
}
|
|
15029
|
-
tools.set(toolId, tool);
|
|
15030
|
-
}
|
|
15031
|
-
}
|
|
15032
|
-
return tools;
|
|
15033
|
-
}
|
|
15034
|
-
};
|
|
15035
|
-
|
|
15036
|
-
// src/tools-manager.ts
|
|
15037
|
-
var ToolsManager = class {
|
|
15038
|
-
constructor(config) {
|
|
15039
|
-
this.config = config;
|
|
15040
|
-
this.specLoader = new OpenAPISpecLoader();
|
|
15041
|
-
}
|
|
15042
|
-
tools = /* @__PURE__ */ new Map();
|
|
15043
|
-
specLoader;
|
|
15044
|
-
/**
|
|
15045
|
-
* Initialize tools from the OpenAPI specification
|
|
15046
|
-
*/
|
|
15047
|
-
async initialize() {
|
|
15048
|
-
const spec = await this.specLoader.loadOpenAPISpec(this.config.openApiSpec);
|
|
15049
|
-
this.tools = this.specLoader.parseOpenAPISpec(spec);
|
|
15050
|
-
for (const [toolId, tool] of this.tools.entries()) {
|
|
15051
|
-
console.error(`Registered tool: ${toolId} (${tool.name})`);
|
|
15052
|
-
}
|
|
15053
|
-
}
|
|
15054
|
-
/**
|
|
15055
|
-
* Get all available tools
|
|
15056
|
-
*/
|
|
15057
|
-
getAllTools() {
|
|
15058
|
-
return Array.from(this.tools.values());
|
|
15059
|
-
}
|
|
15060
|
-
/**
|
|
15061
|
-
* Find a tool by ID or name
|
|
15062
|
-
*/
|
|
15063
|
-
findTool(idOrName) {
|
|
15064
|
-
if (this.tools.has(idOrName)) {
|
|
15065
|
-
return { toolId: idOrName, tool: this.tools.get(idOrName) };
|
|
15066
|
-
}
|
|
15067
|
-
for (const [toolId, tool] of this.tools.entries()) {
|
|
15068
|
-
if (tool.name === idOrName) {
|
|
15069
|
-
return { toolId, tool };
|
|
15070
|
-
}
|
|
15071
|
-
}
|
|
15072
|
-
return void 0;
|
|
15073
|
-
}
|
|
15074
|
-
/**
|
|
15075
|
-
* Get the path and method from a tool ID
|
|
15076
|
-
*/
|
|
15077
|
-
parseToolId(toolId) {
|
|
15078
|
-
const [method, ...pathParts] = toolId.split("-");
|
|
15079
|
-
const path = "/" + pathParts.join("/").replace(/-/g, "/");
|
|
15080
|
-
return { method, path };
|
|
15081
|
-
}
|
|
15082
|
-
};
|
|
15083
|
-
|
|
15084
17927
|
// src/api-client.ts
|
|
15085
17928
|
var ApiClient = class {
|
|
15086
17929
|
/**
|
|
@@ -15286,8 +18129,8 @@ var UI = class {
|
|
|
15286
18129
|
shouldApplyLayoutDSL(...args) {
|
|
15287
18130
|
return args.length === 1 && typeof args[0] === "string" && /[\t\n]/.test(args[0]);
|
|
15288
18131
|
}
|
|
15289
|
-
applyLayoutDSL(
|
|
15290
|
-
const rows =
|
|
18132
|
+
applyLayoutDSL(str2) {
|
|
18133
|
+
const rows = str2.split("\n").map((row) => row.split(" "));
|
|
15291
18134
|
let leftColumnWidth = 0;
|
|
15292
18135
|
rows.forEach((columns) => {
|
|
15293
18136
|
if (columns.length > 1 && mixin.stringWidth(columns[0]) > leftColumnWidth) {
|
|
@@ -15311,8 +18154,8 @@ var UI = class {
|
|
|
15311
18154
|
padding: this.measurePadding(text)
|
|
15312
18155
|
};
|
|
15313
18156
|
}
|
|
15314
|
-
measurePadding(
|
|
15315
|
-
const noAnsi = mixin.stripAnsi(
|
|
18157
|
+
measurePadding(str2) {
|
|
18158
|
+
const noAnsi = mixin.stripAnsi(str2);
|
|
15316
18159
|
return [0, noAnsi.match(/\s*$/)[0].length, 0, noAnsi.match(/^\s*/)[0].length];
|
|
15317
18160
|
}
|
|
15318
18161
|
toString() {
|
|
@@ -15324,7 +18167,7 @@ var UI = class {
|
|
|
15324
18167
|
}
|
|
15325
18168
|
rowToString(row, lines) {
|
|
15326
18169
|
this.rasterize(row).forEach((rrow, r) => {
|
|
15327
|
-
let
|
|
18170
|
+
let str2 = "";
|
|
15328
18171
|
rrow.forEach((col, c) => {
|
|
15329
18172
|
const { width } = row[c];
|
|
15330
18173
|
const wrapWidth = this.negatePadding(row[c]);
|
|
@@ -15341,20 +18184,20 @@ var UI = class {
|
|
|
15341
18184
|
}
|
|
15342
18185
|
const padding = row[c].padding || [0, 0, 0, 0];
|
|
15343
18186
|
if (padding[left]) {
|
|
15344
|
-
|
|
18187
|
+
str2 += " ".repeat(padding[left]);
|
|
15345
18188
|
}
|
|
15346
|
-
|
|
15347
|
-
|
|
15348
|
-
|
|
18189
|
+
str2 += addBorder(row[c], ts, "| ");
|
|
18190
|
+
str2 += ts;
|
|
18191
|
+
str2 += addBorder(row[c], ts, " |");
|
|
15349
18192
|
if (padding[right]) {
|
|
15350
|
-
|
|
18193
|
+
str2 += " ".repeat(padding[right]);
|
|
15351
18194
|
}
|
|
15352
18195
|
if (r === 0 && lines.length > 0) {
|
|
15353
|
-
|
|
18196
|
+
str2 = this.renderInline(str2, lines[lines.length - 1]);
|
|
15354
18197
|
}
|
|
15355
18198
|
});
|
|
15356
18199
|
lines.push({
|
|
15357
|
-
text:
|
|
18200
|
+
text: str2.replace(/ +$/, ""),
|
|
15358
18201
|
span: row.span
|
|
15359
18202
|
});
|
|
15360
18203
|
});
|
|
@@ -15399,7 +18242,7 @@ var UI = class {
|
|
|
15399
18242
|
wrapped.unshift(...new Array(col.padding[top] || 0).fill(""));
|
|
15400
18243
|
wrapped.push(...new Array(col.padding[bottom] || 0).fill(""));
|
|
15401
18244
|
}
|
|
15402
|
-
wrapped.forEach((
|
|
18245
|
+
wrapped.forEach((str2, r) => {
|
|
15403
18246
|
if (!rrows[r]) {
|
|
15404
18247
|
rrows.push([]);
|
|
15405
18248
|
}
|
|
@@ -15409,7 +18252,7 @@ var UI = class {
|
|
|
15409
18252
|
rrow.push("");
|
|
15410
18253
|
}
|
|
15411
18254
|
}
|
|
15412
|
-
rrow.push(
|
|
18255
|
+
rrow.push(str2);
|
|
15413
18256
|
});
|
|
15414
18257
|
});
|
|
15415
18258
|
return rrows;
|
|
@@ -15475,21 +18318,21 @@ function getWindowWidth() {
|
|
|
15475
18318
|
}
|
|
15476
18319
|
return 80;
|
|
15477
18320
|
}
|
|
15478
|
-
function alignRight(
|
|
15479
|
-
|
|
15480
|
-
const strWidth = mixin.stringWidth(
|
|
18321
|
+
function alignRight(str2, width) {
|
|
18322
|
+
str2 = str2.trim();
|
|
18323
|
+
const strWidth = mixin.stringWidth(str2);
|
|
15481
18324
|
if (strWidth < width) {
|
|
15482
|
-
return " ".repeat(width - strWidth) +
|
|
18325
|
+
return " ".repeat(width - strWidth) + str2;
|
|
15483
18326
|
}
|
|
15484
|
-
return
|
|
18327
|
+
return str2;
|
|
15485
18328
|
}
|
|
15486
|
-
function alignCenter(
|
|
15487
|
-
|
|
15488
|
-
const strWidth = mixin.stringWidth(
|
|
18329
|
+
function alignCenter(str2, width) {
|
|
18330
|
+
str2 = str2.trim();
|
|
18331
|
+
const strWidth = mixin.stringWidth(str2);
|
|
15489
18332
|
if (strWidth >= width) {
|
|
15490
|
-
return
|
|
18333
|
+
return str2;
|
|
15491
18334
|
}
|
|
15492
|
-
return " ".repeat(width - strWidth >> 1) +
|
|
18335
|
+
return " ".repeat(width - strWidth >> 1) + str2;
|
|
15493
18336
|
}
|
|
15494
18337
|
var mixin;
|
|
15495
18338
|
function cliui(opts, _mixin) {
|
|
@@ -15502,18 +18345,18 @@ function cliui(opts, _mixin) {
|
|
|
15502
18345
|
|
|
15503
18346
|
// node_modules/cliui/build/lib/string-utils.js
|
|
15504
18347
|
var ansi = new RegExp("\x1B(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)", "g");
|
|
15505
|
-
function stripAnsi(
|
|
15506
|
-
return
|
|
18348
|
+
function stripAnsi(str2) {
|
|
18349
|
+
return str2.replace(ansi, "");
|
|
15507
18350
|
}
|
|
15508
|
-
function wrap(
|
|
15509
|
-
const [start, end] =
|
|
15510
|
-
|
|
18351
|
+
function wrap(str2, width) {
|
|
18352
|
+
const [start, end] = str2.match(ansi) || ["", ""];
|
|
18353
|
+
str2 = stripAnsi(str2);
|
|
15511
18354
|
let wrapped = "";
|
|
15512
|
-
for (let i = 0; i <
|
|
18355
|
+
for (let i = 0; i < str2.length; i++) {
|
|
15513
18356
|
if (i !== 0 && i % width === 0) {
|
|
15514
18357
|
wrapped += "\n";
|
|
15515
18358
|
}
|
|
15516
|
-
wrapped +=
|
|
18359
|
+
wrapped += str2.charAt(i);
|
|
15517
18360
|
}
|
|
15518
18361
|
if (start && end) {
|
|
15519
18362
|
wrapped = `${start}${wrapped}${end}`;
|
|
@@ -15524,8 +18367,8 @@ function wrap(str, width) {
|
|
|
15524
18367
|
// node_modules/cliui/index.mjs
|
|
15525
18368
|
function ui(opts) {
|
|
15526
18369
|
return cliui(opts, {
|
|
15527
|
-
stringWidth: (
|
|
15528
|
-
return [...
|
|
18370
|
+
stringWidth: (str2) => {
|
|
18371
|
+
return [...str2].length;
|
|
15529
18372
|
},
|
|
15530
18373
|
stripAnsi,
|
|
15531
18374
|
wrap
|
|
@@ -15559,19 +18402,19 @@ import { format } from "util";
|
|
|
15559
18402
|
import { normalize, resolve as resolve2 } from "path";
|
|
15560
18403
|
|
|
15561
18404
|
// node_modules/yargs-parser/build/lib/string-utils.js
|
|
15562
|
-
function camelCase(
|
|
15563
|
-
const isCamelCase =
|
|
18405
|
+
function camelCase(str2) {
|
|
18406
|
+
const isCamelCase = str2 !== str2.toLowerCase() && str2 !== str2.toUpperCase();
|
|
15564
18407
|
if (!isCamelCase) {
|
|
15565
|
-
|
|
18408
|
+
str2 = str2.toLowerCase();
|
|
15566
18409
|
}
|
|
15567
|
-
if (
|
|
15568
|
-
return
|
|
18410
|
+
if (str2.indexOf("-") === -1 && str2.indexOf("_") === -1) {
|
|
18411
|
+
return str2;
|
|
15569
18412
|
} else {
|
|
15570
18413
|
let camelcase = "";
|
|
15571
18414
|
let nextChrUpper = false;
|
|
15572
|
-
const leadingHyphens =
|
|
15573
|
-
for (let i = leadingHyphens ? leadingHyphens[0].length : 0; i <
|
|
15574
|
-
let chr =
|
|
18415
|
+
const leadingHyphens = str2.match(/^-+/);
|
|
18416
|
+
for (let i = leadingHyphens ? leadingHyphens[0].length : 0; i < str2.length; i++) {
|
|
18417
|
+
let chr = str2.charAt(i);
|
|
15575
18418
|
if (nextChrUpper) {
|
|
15576
18419
|
nextChrUpper = false;
|
|
15577
18420
|
chr = chr.toUpperCase();
|
|
@@ -15585,13 +18428,13 @@ function camelCase(str) {
|
|
|
15585
18428
|
return camelcase;
|
|
15586
18429
|
}
|
|
15587
18430
|
}
|
|
15588
|
-
function decamelize(
|
|
15589
|
-
const lowercase =
|
|
18431
|
+
function decamelize(str2, joinString) {
|
|
18432
|
+
const lowercase = str2.toLowerCase();
|
|
15590
18433
|
joinString = joinString || "-";
|
|
15591
18434
|
let notCamelcase = "";
|
|
15592
|
-
for (let i = 0; i <
|
|
18435
|
+
for (let i = 0; i < str2.length; i++) {
|
|
15593
18436
|
const chrLower = lowercase.charAt(i);
|
|
15594
|
-
const chrString =
|
|
18437
|
+
const chrString = str2.charAt(i);
|
|
15595
18438
|
if (chrLower !== chrString && i > 0) {
|
|
15596
18439
|
notCamelcase += `${joinString}${lowercase.charAt(i)}`;
|
|
15597
18440
|
} else {
|
|
@@ -16401,26 +19244,26 @@ var YargsParser = class {
|
|
|
16401
19244
|
return defaultForType(guessType2(key));
|
|
16402
19245
|
}
|
|
16403
19246
|
}
|
|
16404
|
-
function defaultForType(
|
|
19247
|
+
function defaultForType(type2) {
|
|
16405
19248
|
const def = {
|
|
16406
19249
|
[DefaultValuesForTypeKey.BOOLEAN]: true,
|
|
16407
19250
|
[DefaultValuesForTypeKey.STRING]: "",
|
|
16408
19251
|
[DefaultValuesForTypeKey.NUMBER]: void 0,
|
|
16409
19252
|
[DefaultValuesForTypeKey.ARRAY]: []
|
|
16410
19253
|
};
|
|
16411
|
-
return def[
|
|
19254
|
+
return def[type2];
|
|
16412
19255
|
}
|
|
16413
19256
|
function guessType2(key) {
|
|
16414
|
-
let
|
|
19257
|
+
let type2 = DefaultValuesForTypeKey.BOOLEAN;
|
|
16415
19258
|
if (checkAllAliases(key, flags.strings))
|
|
16416
|
-
|
|
19259
|
+
type2 = DefaultValuesForTypeKey.STRING;
|
|
16417
19260
|
else if (checkAllAliases(key, flags.numbers))
|
|
16418
|
-
|
|
19261
|
+
type2 = DefaultValuesForTypeKey.NUMBER;
|
|
16419
19262
|
else if (checkAllAliases(key, flags.bools))
|
|
16420
|
-
|
|
19263
|
+
type2 = DefaultValuesForTypeKey.BOOLEAN;
|
|
16421
19264
|
else if (checkAllAliases(key, flags.arrays))
|
|
16422
|
-
|
|
16423
|
-
return
|
|
19265
|
+
type2 = DefaultValuesForTypeKey.ARRAY;
|
|
19266
|
+
return type2;
|
|
16424
19267
|
}
|
|
16425
19268
|
function isUndefined2(num) {
|
|
16426
19269
|
return num === void 0;
|
|
@@ -16608,7 +19451,7 @@ var Y18N = class {
|
|
|
16608
19451
|
if (typeof arguments[0] !== "string") {
|
|
16609
19452
|
return this._taggedLiteral(arguments[0], ...arguments);
|
|
16610
19453
|
}
|
|
16611
|
-
const
|
|
19454
|
+
const str2 = args.shift();
|
|
16612
19455
|
let cb = function() {
|
|
16613
19456
|
};
|
|
16614
19457
|
if (typeof args[args.length - 1] === "function")
|
|
@@ -16617,8 +19460,8 @@ var Y18N = class {
|
|
|
16617
19460
|
};
|
|
16618
19461
|
if (!this.cache[this.locale])
|
|
16619
19462
|
this._readLocaleFile();
|
|
16620
|
-
if (!this.cache[this.locale][
|
|
16621
|
-
this.cache[this.locale][
|
|
19463
|
+
if (!this.cache[this.locale][str2] && this.updateFiles) {
|
|
19464
|
+
this.cache[this.locale][str2] = str2;
|
|
16622
19465
|
this._enqueueWrite({
|
|
16623
19466
|
directory: this.directory,
|
|
16624
19467
|
locale: this.locale,
|
|
@@ -16627,7 +19470,7 @@ var Y18N = class {
|
|
|
16627
19470
|
} else {
|
|
16628
19471
|
cb();
|
|
16629
19472
|
}
|
|
16630
|
-
return shim.format.apply(shim.format, [this.cache[this.locale][
|
|
19473
|
+
return shim.format.apply(shim.format, [this.cache[this.locale][str2] || str2].concat(args));
|
|
16631
19474
|
}
|
|
16632
19475
|
__n() {
|
|
16633
19476
|
const args = Array.prototype.slice.call(arguments);
|
|
@@ -16640,10 +19483,10 @@ var Y18N = class {
|
|
|
16640
19483
|
cb = args.pop();
|
|
16641
19484
|
if (!this.cache[this.locale])
|
|
16642
19485
|
this._readLocaleFile();
|
|
16643
|
-
let
|
|
19486
|
+
let str2 = quantity === 1 ? singular : plural;
|
|
16644
19487
|
if (this.cache[this.locale][singular]) {
|
|
16645
19488
|
const entry = this.cache[this.locale][singular];
|
|
16646
|
-
|
|
19489
|
+
str2 = entry[quantity === 1 ? "one" : "other"];
|
|
16647
19490
|
}
|
|
16648
19491
|
if (!this.cache[this.locale][singular] && this.updateFiles) {
|
|
16649
19492
|
this.cache[this.locale][singular] = {
|
|
@@ -16658,8 +19501,8 @@ var Y18N = class {
|
|
|
16658
19501
|
} else {
|
|
16659
19502
|
cb();
|
|
16660
19503
|
}
|
|
16661
|
-
const values = [
|
|
16662
|
-
if (~
|
|
19504
|
+
const values = [str2];
|
|
19505
|
+
if (~str2.indexOf("%d"))
|
|
16663
19506
|
values.push(quantity);
|
|
16664
19507
|
return shim.format.apply(shim.format, values.concat(args));
|
|
16665
19508
|
}
|
|
@@ -16679,15 +19522,15 @@ var Y18N = class {
|
|
|
16679
19522
|
}
|
|
16680
19523
|
}
|
|
16681
19524
|
_taggedLiteral(parts, ...args) {
|
|
16682
|
-
let
|
|
19525
|
+
let str2 = "";
|
|
16683
19526
|
parts.forEach(function(part, i) {
|
|
16684
19527
|
const arg = args[i + 1];
|
|
16685
|
-
|
|
19528
|
+
str2 += part;
|
|
16686
19529
|
if (typeof arg !== "undefined") {
|
|
16687
|
-
|
|
19530
|
+
str2 += "%s";
|
|
16688
19531
|
}
|
|
16689
19532
|
});
|
|
16690
|
-
return this.__.apply(this, [
|
|
19533
|
+
return this.__.apply(this, [str2].concat([].slice.call(args, 1)));
|
|
16691
19534
|
}
|
|
16692
19535
|
_enqueueWrite(work) {
|
|
16693
19536
|
this.writeQueue.push(work);
|
|
@@ -16796,7 +19639,7 @@ var esm_default = {
|
|
|
16796
19639
|
process: {
|
|
16797
19640
|
argv: () => process.argv,
|
|
16798
19641
|
cwd: process.cwd,
|
|
16799
|
-
emitWarning: (warning,
|
|
19642
|
+
emitWarning: (warning, type2) => process.emitWarning(warning, type2),
|
|
16800
19643
|
execPath: () => process.execPath,
|
|
16801
19644
|
exit: process.exit,
|
|
16802
19645
|
nextTick: process.nextTick,
|
|
@@ -16809,8 +19652,8 @@ var esm_default = {
|
|
|
16809
19652
|
requireDirectory: () => {
|
|
16810
19653
|
throw new YError(REQUIRE_DIRECTORY_ERROR);
|
|
16811
19654
|
},
|
|
16812
|
-
stringWidth: (
|
|
16813
|
-
return [...
|
|
19655
|
+
stringWidth: (str2) => {
|
|
19656
|
+
return [...str2].length;
|
|
16814
19657
|
},
|
|
16815
19658
|
y18n: y18n_default({
|
|
16816
19659
|
directory: resolve4(__dirname, "../../../locales"),
|
|
@@ -16894,7 +19737,7 @@ function argsert(arg1, arg2, arg3) {
|
|
|
16894
19737
|
parsed.demanded.forEach((demanded) => {
|
|
16895
19738
|
const arg = args.shift();
|
|
16896
19739
|
const observedType = guessType(arg);
|
|
16897
|
-
const matchingTypes = demanded.cmd.filter((
|
|
19740
|
+
const matchingTypes = demanded.cmd.filter((type2) => type2 === observedType || type2 === "*");
|
|
16898
19741
|
if (matchingTypes.length === 0)
|
|
16899
19742
|
argumentTypeError(observedType, demanded.cmd, position);
|
|
16900
19743
|
position += 1;
|
|
@@ -16904,7 +19747,7 @@ function argsert(arg1, arg2, arg3) {
|
|
|
16904
19747
|
return;
|
|
16905
19748
|
const arg = args.shift();
|
|
16906
19749
|
const observedType = guessType(arg);
|
|
16907
|
-
const matchingTypes = optional.cmd.filter((
|
|
19750
|
+
const matchingTypes = optional.cmd.filter((type2) => type2 === observedType || type2 === "*");
|
|
16908
19751
|
if (matchingTypes.length === 0)
|
|
16909
19752
|
argumentTypeError(observedType, optional.cmd, position);
|
|
16910
19753
|
position += 1;
|
|
@@ -17450,7 +20293,7 @@ function setBlocking(blocking) {
|
|
|
17450
20293
|
}
|
|
17451
20294
|
|
|
17452
20295
|
// node_modules/yargs/build/lib/usage.js
|
|
17453
|
-
function
|
|
20296
|
+
function isBoolean3(fail) {
|
|
17454
20297
|
return typeof fail === "boolean";
|
|
17455
20298
|
}
|
|
17456
20299
|
function usage(yargs, shim3) {
|
|
@@ -17478,7 +20321,7 @@ function usage(yargs, shim3) {
|
|
|
17478
20321
|
if (fails.length) {
|
|
17479
20322
|
for (let i = fails.length - 1; i >= 0; --i) {
|
|
17480
20323
|
const fail2 = fails[i];
|
|
17481
|
-
if (
|
|
20324
|
+
if (isBoolean3(fail2)) {
|
|
17482
20325
|
if (err)
|
|
17483
20326
|
throw err;
|
|
17484
20327
|
else if (msg)
|
|
@@ -17587,7 +20430,7 @@ function usage(yargs, shim3) {
|
|
|
17587
20430
|
return wrap2;
|
|
17588
20431
|
};
|
|
17589
20432
|
const deferY18nLookupPrefix = "__yargsString__:";
|
|
17590
|
-
self2.deferY18nLookup = (
|
|
20433
|
+
self2.deferY18nLookup = (str2) => deferY18nLookupPrefix + str2;
|
|
17591
20434
|
self2.help = function help() {
|
|
17592
20435
|
if (cachedHelpMessage)
|
|
17593
20436
|
return cachedHelpMessage;
|
|
@@ -17721,25 +20564,25 @@ function usage(yargs, shim3) {
|
|
|
17721
20564
|
normalizedKeys.forEach((key) => {
|
|
17722
20565
|
const kswitch = switches[key];
|
|
17723
20566
|
let desc = descriptions[key] || "";
|
|
17724
|
-
let
|
|
20567
|
+
let type2 = null;
|
|
17725
20568
|
if (desc.includes(deferY18nLookupPrefix))
|
|
17726
20569
|
desc = __(desc.substring(deferY18nLookupPrefix.length));
|
|
17727
20570
|
if (options.boolean.includes(key))
|
|
17728
|
-
|
|
20571
|
+
type2 = `[${__("boolean")}]`;
|
|
17729
20572
|
if (options.count.includes(key))
|
|
17730
|
-
|
|
20573
|
+
type2 = `[${__("count")}]`;
|
|
17731
20574
|
if (options.string.includes(key))
|
|
17732
|
-
|
|
20575
|
+
type2 = `[${__("string")}]`;
|
|
17733
20576
|
if (options.normalize.includes(key))
|
|
17734
|
-
|
|
20577
|
+
type2 = `[${__("string")}]`;
|
|
17735
20578
|
if (options.array.includes(key))
|
|
17736
|
-
|
|
20579
|
+
type2 = `[${__("array")}]`;
|
|
17737
20580
|
if (options.number.includes(key))
|
|
17738
|
-
|
|
20581
|
+
type2 = `[${__("number")}]`;
|
|
17739
20582
|
const deprecatedExtra = (deprecated) => typeof deprecated === "string" ? `[${__("deprecated: %s", deprecated)}]` : `[${__("deprecated")}]`;
|
|
17740
20583
|
const extra = [
|
|
17741
20584
|
key in deprecatedOptions ? deprecatedExtra(deprecatedOptions[key]) : null,
|
|
17742
|
-
|
|
20585
|
+
type2,
|
|
17743
20586
|
key in demandedOptions ? `[${__("required")}]` : null,
|
|
17744
20587
|
options.choices && options.choices[key] ? `[${__("choices:")} ${self2.stringifiedValues(options.choices[key])}]` : null,
|
|
17745
20588
|
defaultString(options.default[key], options.defaultDescription[key])
|
|
@@ -18578,12 +21421,12 @@ function getPathToDefaultConfig(cwd, pathToExtend) {
|
|
|
18578
21421
|
}
|
|
18579
21422
|
function mergeDeep(config1, config2) {
|
|
18580
21423
|
const target = {};
|
|
18581
|
-
function
|
|
21424
|
+
function isObject3(obj) {
|
|
18582
21425
|
return obj && typeof obj === "object" && !Array.isArray(obj);
|
|
18583
21426
|
}
|
|
18584
21427
|
Object.assign(target, config1);
|
|
18585
21428
|
for (const key of Object.keys(config2)) {
|
|
18586
|
-
if (
|
|
21429
|
+
if (isObject3(config2[key]) && isObject3(target[key])) {
|
|
18587
21430
|
target[key] = mergeDeep(config1[key], config2[key]);
|
|
18588
21431
|
} else {
|
|
18589
21432
|
target[key] = config2[key];
|
|
@@ -19598,9 +22441,9 @@ var YargsInstance = class {
|
|
|
19598
22441
|
});
|
|
19599
22442
|
delete __classPrivateFieldGet(this, _YargsInstance_usage, "f").getDescriptions()[optionKey];
|
|
19600
22443
|
}
|
|
19601
|
-
[kEmitWarning](warning,
|
|
22444
|
+
[kEmitWarning](warning, type2, deduplicationId) {
|
|
19602
22445
|
if (!__classPrivateFieldGet(this, _YargsInstance_emittedWarnings, "f")[deduplicationId]) {
|
|
19603
|
-
__classPrivateFieldGet(this, _YargsInstance_shim, "f").process.emitWarning(warning,
|
|
22446
|
+
__classPrivateFieldGet(this, _YargsInstance_shim, "f").process.emitWarning(warning, type2);
|
|
19604
22447
|
__classPrivateFieldGet(this, _YargsInstance_emittedWarnings, "f")[deduplicationId] = true;
|
|
19605
22448
|
}
|
|
19606
22449
|
}
|
|
@@ -19692,24 +22535,24 @@ var YargsInstance = class {
|
|
|
19692
22535
|
__classPrivateFieldGet(this, _YargsInstance_pkgs, "f")[npath] = obj || {};
|
|
19693
22536
|
return __classPrivateFieldGet(this, _YargsInstance_pkgs, "f")[npath];
|
|
19694
22537
|
}
|
|
19695
|
-
[kPopulateParserHintArray](
|
|
22538
|
+
[kPopulateParserHintArray](type2, keys) {
|
|
19696
22539
|
keys = [].concat(keys);
|
|
19697
22540
|
keys.forEach((key) => {
|
|
19698
22541
|
key = this[kSanitizeKey](key);
|
|
19699
|
-
__classPrivateFieldGet(this, _YargsInstance_options, "f")[
|
|
22542
|
+
__classPrivateFieldGet(this, _YargsInstance_options, "f")[type2].push(key);
|
|
19700
22543
|
});
|
|
19701
22544
|
}
|
|
19702
|
-
[kPopulateParserHintSingleValueDictionary](builder,
|
|
19703
|
-
this[kPopulateParserHintDictionary](builder,
|
|
19704
|
-
__classPrivateFieldGet(this, _YargsInstance_options, "f")[
|
|
22545
|
+
[kPopulateParserHintSingleValueDictionary](builder, type2, key, value) {
|
|
22546
|
+
this[kPopulateParserHintDictionary](builder, type2, key, value, (type3, key2, value2) => {
|
|
22547
|
+
__classPrivateFieldGet(this, _YargsInstance_options, "f")[type3][key2] = value2;
|
|
19705
22548
|
});
|
|
19706
22549
|
}
|
|
19707
|
-
[kPopulateParserHintArrayDictionary](builder,
|
|
19708
|
-
this[kPopulateParserHintDictionary](builder,
|
|
19709
|
-
__classPrivateFieldGet(this, _YargsInstance_options, "f")[
|
|
22550
|
+
[kPopulateParserHintArrayDictionary](builder, type2, key, value) {
|
|
22551
|
+
this[kPopulateParserHintDictionary](builder, type2, key, value, (type3, key2, value2) => {
|
|
22552
|
+
__classPrivateFieldGet(this, _YargsInstance_options, "f")[type3][key2] = (__classPrivateFieldGet(this, _YargsInstance_options, "f")[type3][key2] || []).concat(value2);
|
|
19710
22553
|
});
|
|
19711
22554
|
}
|
|
19712
|
-
[kPopulateParserHintDictionary](builder,
|
|
22555
|
+
[kPopulateParserHintDictionary](builder, type2, key, value, singleKeyHandler) {
|
|
19713
22556
|
if (Array.isArray(key)) {
|
|
19714
22557
|
key.forEach((k) => {
|
|
19715
22558
|
builder(k, value);
|
|
@@ -19719,7 +22562,7 @@ var YargsInstance = class {
|
|
|
19719
22562
|
builder(k, key[k]);
|
|
19720
22563
|
}
|
|
19721
22564
|
} else {
|
|
19722
|
-
singleKeyHandler(
|
|
22565
|
+
singleKeyHandler(type2, this[kSanitizeKey](key), value);
|
|
19723
22566
|
}
|
|
19724
22567
|
}
|
|
19725
22568
|
[kSanitizeKey](key) {
|
|
@@ -19727,8 +22570,8 @@ var YargsInstance = class {
|
|
|
19727
22570
|
return "___proto___";
|
|
19728
22571
|
return key;
|
|
19729
22572
|
}
|
|
19730
|
-
[kSetKey](key,
|
|
19731
|
-
this[kPopulateParserHintSingleValueDictionary](this[kSetKey].bind(this), "key", key,
|
|
22573
|
+
[kSetKey](key, set2) {
|
|
22574
|
+
this[kPopulateParserHintSingleValueDictionary](this[kSetKey].bind(this), "key", key, set2);
|
|
19732
22575
|
return this;
|
|
19733
22576
|
}
|
|
19734
22577
|
[kUnfreeze]() {
|
|
@@ -20770,6 +23613,9 @@ mime-types/index.js:
|
|
|
20770
23613
|
* MIT Licensed
|
|
20771
23614
|
*)
|
|
20772
23615
|
|
|
23616
|
+
js-yaml/dist/js-yaml.mjs:
|
|
23617
|
+
(*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT *)
|
|
23618
|
+
|
|
20773
23619
|
yargs-parser/build/lib/string-utils.js:
|
|
20774
23620
|
yargs-parser/build/lib/tokenize-arg-string.js:
|
|
20775
23621
|
yargs-parser/build/lib/yargs-parser-types.js:
|