sniff-qa 0.9.0 → 0.9.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/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +39 -0
- package/NOTICE +7 -4
- package/README.md +35 -7
- package/THIRD-PARTY-NOTICES.md +1800 -0
- package/dist/{accessibility-JXRMWF5Y.js → accessibility-42JOUOGH.js} +8 -2
- package/dist/{anthropic-api-7PHYF6PN.js → anthropic-api-VSG2X6FS.js} +7 -5
- package/dist/assert-budget-WG4BRCLX.js +10 -0
- package/dist/{caps-G3ZGJI7B.js → caps-YZPFNPIN.js} +3 -2
- package/dist/{chunk-VEI2O6AK.js → chunk-33JL2AB5.js} +14 -6
- package/dist/{chunk-64FUDSRY.js → chunk-3E4W4H6S.js} +8 -5
- package/dist/{chunk-T72SLMTY.js → chunk-3NR2K5B3.js} +2 -1
- package/dist/chunk-3ROWRVZE.js +422 -0
- package/dist/{chunk-MYWWSM3V.js → chunk-3YFE3H23.js} +2 -1
- package/dist/{chunk-MMISGY2Q.js → chunk-4F6ZXOPE.js} +2 -1
- package/dist/chunk-A4TTASVS.js +27862 -0
- package/dist/{chunk-IXDUD2UG.js → chunk-AA744N7E.js} +2 -1
- package/dist/chunk-DZMX3VT2.js +267 -0
- package/dist/{chunk-NG2IGCAK.js → chunk-FR5QCJLH.js} +2 -1
- package/dist/{chunk-GV27IOMC.js → chunk-GC47B6MM.js} +2 -1
- package/dist/chunk-HP4TY3UY.js +80 -0
- package/dist/chunk-LZAPYYNR.js +4595 -0
- package/dist/{chunk-ZM6MGWO4.js → chunk-NBJLMLDA.js} +2 -1
- package/dist/chunk-RAGYZ54R.js +15480 -0
- package/dist/{chunk-GX36BPK7.js → chunk-RSGFFRXQ.js} +2 -2
- package/dist/chunk-SOBWDC35.js +38 -0
- package/dist/{chunk-7BLJCICM.js → chunk-US4HFUCH.js} +3 -2
- package/dist/chunk-YM22FEIA.js +5807 -0
- package/dist/{ci-ISCWZJD3.js → ci-F6FUXT3O.js} +5 -3
- package/dist/{classifier-MWQMQ727.js → classifier-5FQ2FBTO.js} +3 -1
- package/dist/{claude-code-GJPWO6DN.js → claude-code-J43C22IR.js} +7 -5
- package/dist/{claude-exploration-provider-XOVJPJ23.js → claude-exploration-provider-EWQNNE7D.js} +3 -2
- package/dist/cli/index.js +69 -31
- package/dist/compiler-sfc.cjs-JX56AWNS.js +48568 -0
- package/dist/crawl-KN7SW753.js +26 -0
- package/dist/{crawl-command-JHZN4GK7.js → crawl-command-Y45FIXNK.js} +7 -6
- package/dist/{cross-reference-MHNPSLEN.js → cross-reference-XOOBW6UZ.js} +3 -1
- package/dist/{dev-server-detector-XQ5AYPDT.js → dev-server-detector-FMFVKDJR.js} +3 -1
- package/dist/{discover-QKGMYPHK.js → discover-HA63UA4K.js} +20 -18
- package/dist/dist-3CYER35S.js +8 -0
- package/dist/{domain-UQ34YE4B.js → domain-FU3WIW64.js} +45 -30
- package/dist/{edge-cases-ZADKDZHL.js → edge-cases-B6IV3IKK.js} +3 -1
- package/dist/{element-extractor-OZTFBVKZ.js → element-extractor-QAG4MRUO.js} +18 -6
- package/dist/engine-AXB5O4ZH.js +39 -0
- package/dist/{ensure-browsers-5NAQQMEC.js → ensure-browsers-TNMHMLRS.js} +59 -12
- package/dist/errors-NWB25P4K.js +8 -0
- package/dist/esm-IMWPYLSN.js +3469 -0
- package/dist/{fix-R33D34NP.js → fix-IXOEHAOS.js} +12 -5
- package/dist/{flakiness-OLJAY7CS.js → flakiness-7SSSM4SW.js} +3 -2
- package/dist/flakiness-CBKV4U54.js +12 -0
- package/dist/{formatter-4VI3ZX5Y.js → formatter-N4CC7SCM.js} +29 -22
- package/dist/{framework-detector-ISSM2Q2I.js → framework-detector-4ZVHNT7N.js} +3 -1
- package/dist/generator-GGJYWYI2.js +8 -0
- package/dist/index.js +9 -6
- package/dist/{init-IQKT4ANC.js → init-POX5ZJ6V.js} +4 -2
- package/dist/json-4VOVHDQG.js +10 -0
- package/dist/{junit-GL44ATRR.js → junit-V24COOSR.js} +3 -1
- package/dist/{llm-VJAI6H6G.js → llm-TZ2WZGRZ.js} +3 -1
- package/dist/{loader-Z2DUGG5Z.js → loader-AMM63AOJ.js} +12 -3
- package/dist/mcp/server.js +13035 -72
- package/dist/{model-SP6HJN6J.js → model-BL2AID5Q.js} +6 -5
- package/dist/page-hooks-SECSGZR6.js +14 -0
- package/dist/{page-state-extractor-GYYLYRFR.js → page-state-extractor-AP4FQVLY.js} +3 -1
- package/dist/{performance-7HWKY5O2.js → performance-JVEYVBTV.js} +9 -3
- package/dist/{persistence-XLFJ5EY4.js → persistence-SHKJVSIS.js} +5 -4
- package/dist/{persistence-KTCRIGHU.js → persistence-SQ6QT3HP.js} +3 -1
- package/dist/picocolors-3W2AX5TJ.js +6 -0
- package/dist/pixelmatch-GATIVDQX.js +188 -0
- package/dist/png-HTC2G4ZG.js +2093 -0
- package/dist/{prompt-builder-JT3GQBYP.js → prompt-builder-EI2BFKLZ.js} +3 -1
- package/dist/{provider-MMQ6EIBV.js → provider-O3UOALQH.js} +14 -12
- package/dist/{quality-run-KJMBBAQT.js → quality-run-CTLX5YA5.js} +12 -10
- package/dist/{redaction-CHAIVPCF.js → redaction-QNBV5QZ3.js} +4 -3
- package/dist/{registry-5XCXUAYJ.js → registry-JBBTSD7I.js} +3 -1
- package/dist/{repo-analyzer-4OURSITY.js → repo-analyzer-4XITIIAF.js} +6 -4
- package/dist/{report-SDZWX25B.js → report-4UVJL7QV.js} +3 -1
- package/dist/{report-XK2MCX2N.js → report-BOVSPRCR.js} +8 -6
- package/dist/{response-parser-PUGNWF7S.js → response-parser-GHVJSYXQ.js} +3 -2
- package/dist/{route-discoverer-QBZCRQLJ.js → route-discoverer-ZXYJQIYE.js} +15 -8
- package/dist/{runner-RDVVIGBU.js → runner-DOLCFA3S.js} +10 -5
- package/dist/{runner-QHSYX7J2.js → runner-MCSDHFLN.js} +12 -7
- package/dist/{runner-AXZXNWYH.js → runner-MUBXHOIG.js} +10 -4
- package/dist/{scenarios-I7YYVTD2.js → scenarios-T2U6ZDRL.js} +3 -1
- package/dist/sdk-FQKA5HSQ.js +7184 -0
- package/dist/{source-5LS2B7TN.js → source-T5MHBY5G.js} +14 -7
- package/dist/{tiebreak-L5UFNKU2.js → tiebreak-SXBXPT7B.js} +3 -1
- package/dist/{unified-OEGLPOGE.js → unified-NUR2X5JV.js} +23 -21
- package/dist/{update-baselines-JYKUUIZG.js → update-baselines-TMERPIDV.js} +4 -2
- package/dist/version-FEHABGAH.js +10 -0
- package/dist/{visual-EUZG2STF.js → visual-XHFPFQFX.js} +5 -3
- package/dist/{workflow-template-6DADGPHA.js → workflow-template-7C5CCK67.js} +13 -7
- package/dist/{write-report-Y4UPVXUO.js → write-report-6Q4MXBYD.js} +5 -4
- package/package.json +18 -9
- package/dist/accessibility-JXRMWF5Y.js.map +0 -1
- package/dist/anthropic-api-7PHYF6PN.js.map +0 -1
- package/dist/assert-budget-NBF3JYM7.js +0 -9
- package/dist/assert-budget-NBF3JYM7.js.map +0 -1
- package/dist/caps-G3ZGJI7B.js.map +0 -1
- package/dist/chunk-64FUDSRY.js.map +0 -1
- package/dist/chunk-7BLJCICM.js.map +0 -1
- package/dist/chunk-GV27IOMC.js.map +0 -1
- package/dist/chunk-GX36BPK7.js.map +0 -1
- package/dist/chunk-IXDUD2UG.js.map +0 -1
- package/dist/chunk-MMISGY2Q.js.map +0 -1
- package/dist/chunk-MYWWSM3V.js.map +0 -1
- package/dist/chunk-NG2IGCAK.js.map +0 -1
- package/dist/chunk-T72SLMTY.js.map +0 -1
- package/dist/chunk-VEI2O6AK.js.map +0 -1
- package/dist/chunk-ZM6MGWO4.js.map +0 -1
- package/dist/ci-ISCWZJD3.js.map +0 -1
- package/dist/classifier-MWQMQ727.js.map +0 -1
- package/dist/claude-code-GJPWO6DN.js.map +0 -1
- package/dist/claude-exploration-provider-XOVJPJ23.js.map +0 -1
- package/dist/cli/index.js.map +0 -1
- package/dist/crawl-XPHT3KIZ.js +0 -23
- package/dist/crawl-XPHT3KIZ.js.map +0 -1
- package/dist/crawl-command-JHZN4GK7.js.map +0 -1
- package/dist/cross-reference-MHNPSLEN.js.map +0 -1
- package/dist/dev-server-detector-XQ5AYPDT.js.map +0 -1
- package/dist/discover-QKGMYPHK.js.map +0 -1
- package/dist/domain-UQ34YE4B.js.map +0 -1
- package/dist/edge-cases-ZADKDZHL.js.map +0 -1
- package/dist/element-extractor-OZTFBVKZ.js.map +0 -1
- package/dist/ensure-browsers-5NAQQMEC.js.map +0 -1
- package/dist/errors-RFEOR527.js +0 -7
- package/dist/errors-RFEOR527.js.map +0 -1
- package/dist/fix-R33D34NP.js.map +0 -1
- package/dist/flakiness-OLJAY7CS.js.map +0 -1
- package/dist/flakiness-OVC7KGN2.js +0 -11
- package/dist/flakiness-OVC7KGN2.js.map +0 -1
- package/dist/formatter-4VI3ZX5Y.js.map +0 -1
- package/dist/framework-detector-ISSM2Q2I.js.map +0 -1
- package/dist/generator-AFHVMWC3.js +0 -7
- package/dist/generator-AFHVMWC3.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/init-IQKT4ANC.js.map +0 -1
- package/dist/json-YDWEB33Q.js +0 -8
- package/dist/json-YDWEB33Q.js.map +0 -1
- package/dist/junit-GL44ATRR.js.map +0 -1
- package/dist/llm-VJAI6H6G.js.map +0 -1
- package/dist/loader-Z2DUGG5Z.js.map +0 -1
- package/dist/mcp/server.js.map +0 -1
- package/dist/model-SP6HJN6J.js.map +0 -1
- package/dist/page-hooks-6RALVZB5.js +0 -13
- package/dist/page-hooks-6RALVZB5.js.map +0 -1
- package/dist/page-state-extractor-GYYLYRFR.js.map +0 -1
- package/dist/performance-7HWKY5O2.js.map +0 -1
- package/dist/persistence-KTCRIGHU.js.map +0 -1
- package/dist/persistence-XLFJ5EY4.js.map +0 -1
- package/dist/prompt-builder-JT3GQBYP.js.map +0 -1
- package/dist/provider-MMQ6EIBV.js.map +0 -1
- package/dist/quality-run-KJMBBAQT.js.map +0 -1
- package/dist/redaction-CHAIVPCF.js.map +0 -1
- package/dist/registry-5XCXUAYJ.js.map +0 -1
- package/dist/repo-analyzer-4OURSITY.js.map +0 -1
- package/dist/report-SDZWX25B.js.map +0 -1
- package/dist/report-XK2MCX2N.js.map +0 -1
- package/dist/response-parser-PUGNWF7S.js.map +0 -1
- package/dist/route-discoverer-QBZCRQLJ.js.map +0 -1
- package/dist/runner-AXZXNWYH.js.map +0 -1
- package/dist/runner-QHSYX7J2.js.map +0 -1
- package/dist/runner-RDVVIGBU.js.map +0 -1
- package/dist/scenarios-I7YYVTD2.js.map +0 -1
- package/dist/source-5LS2B7TN.js.map +0 -1
- package/dist/tiebreak-L5UFNKU2.js.map +0 -1
- package/dist/unified-OEGLPOGE.js.map +0 -1
- package/dist/update-baselines-JYKUUIZG.js.map +0 -1
- package/dist/version-FLE7ZHDX.js +0 -7
- package/dist/version-FLE7ZHDX.js.map +0 -1
- package/dist/visual-EUZG2STF.js.map +0 -1
- package/dist/workflow-template-6DADGPHA.js.map +0 -1
- package/dist/write-report-Y4UPVXUO.js.map +0 -1
|
@@ -0,0 +1,4595 @@
|
|
|
1
|
+
import { createRequire as __sniffCreateRequire } from 'node:module'; const require = __sniffCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
require_lib2 as require_lib
|
|
4
|
+
} from "./chunk-3ROWRVZE.js";
|
|
5
|
+
import {
|
|
6
|
+
__commonJS,
|
|
7
|
+
__require
|
|
8
|
+
} from "./chunk-SOBWDC35.js";
|
|
9
|
+
|
|
10
|
+
// node_modules/resolve-from/index.js
|
|
11
|
+
var require_resolve_from = __commonJS({
|
|
12
|
+
"node_modules/resolve-from/index.js"(exports, module) {
|
|
13
|
+
"use strict";
|
|
14
|
+
var path = __require("path");
|
|
15
|
+
var Module = __require("module");
|
|
16
|
+
var fs = __require("fs");
|
|
17
|
+
var resolveFrom = (fromDir, moduleId, silent) => {
|
|
18
|
+
if (typeof fromDir !== "string") {
|
|
19
|
+
throw new TypeError(`Expected \`fromDir\` to be of type \`string\`, got \`${typeof fromDir}\``);
|
|
20
|
+
}
|
|
21
|
+
if (typeof moduleId !== "string") {
|
|
22
|
+
throw new TypeError(`Expected \`moduleId\` to be of type \`string\`, got \`${typeof moduleId}\``);
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
fromDir = fs.realpathSync(fromDir);
|
|
26
|
+
} catch (err) {
|
|
27
|
+
if (err.code === "ENOENT") {
|
|
28
|
+
fromDir = path.resolve(fromDir);
|
|
29
|
+
} else if (silent) {
|
|
30
|
+
return null;
|
|
31
|
+
} else {
|
|
32
|
+
throw err;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const fromFile = path.join(fromDir, "noop.js");
|
|
36
|
+
const resolveFileName = () => Module._resolveFilename(moduleId, {
|
|
37
|
+
id: fromFile,
|
|
38
|
+
filename: fromFile,
|
|
39
|
+
paths: Module._nodeModulePaths(fromDir)
|
|
40
|
+
});
|
|
41
|
+
if (silent) {
|
|
42
|
+
try {
|
|
43
|
+
return resolveFileName();
|
|
44
|
+
} catch (err) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return resolveFileName();
|
|
49
|
+
};
|
|
50
|
+
module.exports = (fromDir, moduleId) => resolveFrom(fromDir, moduleId);
|
|
51
|
+
module.exports.silent = (fromDir, moduleId) => resolveFrom(fromDir, moduleId, true);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// node_modules/callsites/index.js
|
|
56
|
+
var require_callsites = __commonJS({
|
|
57
|
+
"node_modules/callsites/index.js"(exports, module) {
|
|
58
|
+
"use strict";
|
|
59
|
+
var callsites = () => {
|
|
60
|
+
const _prepareStackTrace = Error.prepareStackTrace;
|
|
61
|
+
Error.prepareStackTrace = (_, stack2) => stack2;
|
|
62
|
+
const stack = new Error().stack.slice(1);
|
|
63
|
+
Error.prepareStackTrace = _prepareStackTrace;
|
|
64
|
+
return stack;
|
|
65
|
+
};
|
|
66
|
+
module.exports = callsites;
|
|
67
|
+
module.exports.default = callsites;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
// node_modules/parent-module/index.js
|
|
72
|
+
var require_parent_module = __commonJS({
|
|
73
|
+
"node_modules/parent-module/index.js"(exports, module) {
|
|
74
|
+
"use strict";
|
|
75
|
+
var callsites = require_callsites();
|
|
76
|
+
module.exports = (filepath) => {
|
|
77
|
+
const stacks = callsites();
|
|
78
|
+
if (!filepath) {
|
|
79
|
+
return stacks[2].getFileName();
|
|
80
|
+
}
|
|
81
|
+
let seenVal = false;
|
|
82
|
+
stacks.shift();
|
|
83
|
+
for (const stack of stacks) {
|
|
84
|
+
const parentFilepath = stack.getFileName();
|
|
85
|
+
if (typeof parentFilepath !== "string") {
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
if (parentFilepath === filepath) {
|
|
89
|
+
seenVal = true;
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
if (parentFilepath === "module.js") {
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
if (seenVal && parentFilepath !== filepath) {
|
|
96
|
+
return parentFilepath;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
// node_modules/import-fresh/index.js
|
|
104
|
+
var require_import_fresh = __commonJS({
|
|
105
|
+
"node_modules/import-fresh/index.js"(exports, module) {
|
|
106
|
+
"use strict";
|
|
107
|
+
var path = __require("path");
|
|
108
|
+
var resolveFrom = require_resolve_from();
|
|
109
|
+
var parentModule = require_parent_module();
|
|
110
|
+
module.exports = (moduleId) => {
|
|
111
|
+
if (typeof moduleId !== "string") {
|
|
112
|
+
throw new TypeError("Expected a string");
|
|
113
|
+
}
|
|
114
|
+
const parentPath = parentModule(__filename);
|
|
115
|
+
const cwd = parentPath ? path.dirname(parentPath) : __dirname;
|
|
116
|
+
const filePath = resolveFrom(cwd, moduleId);
|
|
117
|
+
const oldModule = __require.cache[filePath];
|
|
118
|
+
if (oldModule && oldModule.parent) {
|
|
119
|
+
let i = oldModule.parent.children.length;
|
|
120
|
+
while (i--) {
|
|
121
|
+
if (oldModule.parent.children[i].id === filePath) {
|
|
122
|
+
oldModule.parent.children.splice(i, 1);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
delete __require.cache[filePath];
|
|
127
|
+
const parent = __require.cache[parentPath];
|
|
128
|
+
return parent === void 0 || parent.require === void 0 ? __require(filePath) : parent.require(filePath);
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
// node_modules/is-arrayish/index.js
|
|
134
|
+
var require_is_arrayish = __commonJS({
|
|
135
|
+
"node_modules/is-arrayish/index.js"(exports, module) {
|
|
136
|
+
"use strict";
|
|
137
|
+
module.exports = function isArrayish(obj) {
|
|
138
|
+
if (!obj) {
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
return obj instanceof Array || Array.isArray(obj) || obj.length >= 0 && obj.splice instanceof Function;
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
// node_modules/error-ex/index.js
|
|
147
|
+
var require_error_ex = __commonJS({
|
|
148
|
+
"node_modules/error-ex/index.js"(exports, module) {
|
|
149
|
+
"use strict";
|
|
150
|
+
var util = __require("util");
|
|
151
|
+
var isArrayish = require_is_arrayish();
|
|
152
|
+
var errorEx = function errorEx2(name, properties) {
|
|
153
|
+
if (!name || name.constructor !== String) {
|
|
154
|
+
properties = name || {};
|
|
155
|
+
name = Error.name;
|
|
156
|
+
}
|
|
157
|
+
var errorExError = function ErrorEXError(message) {
|
|
158
|
+
if (!this) {
|
|
159
|
+
return new ErrorEXError(message);
|
|
160
|
+
}
|
|
161
|
+
message = message instanceof Error ? message.message : message || this.message;
|
|
162
|
+
Error.call(this, message);
|
|
163
|
+
Error.captureStackTrace(this, errorExError);
|
|
164
|
+
this.name = name;
|
|
165
|
+
Object.defineProperty(this, "message", {
|
|
166
|
+
configurable: true,
|
|
167
|
+
enumerable: false,
|
|
168
|
+
get: function() {
|
|
169
|
+
var newMessage = message.split(/\r?\n/g);
|
|
170
|
+
for (var key in properties) {
|
|
171
|
+
if (!properties.hasOwnProperty(key)) {
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
var modifier = properties[key];
|
|
175
|
+
if ("message" in modifier) {
|
|
176
|
+
newMessage = modifier.message(this[key], newMessage) || newMessage;
|
|
177
|
+
if (!isArrayish(newMessage)) {
|
|
178
|
+
newMessage = [newMessage];
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
return newMessage.join("\n");
|
|
183
|
+
},
|
|
184
|
+
set: function(v) {
|
|
185
|
+
message = v;
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
var overwrittenStack = null;
|
|
189
|
+
var stackDescriptor = Object.getOwnPropertyDescriptor(this, "stack");
|
|
190
|
+
var stackGetter = stackDescriptor.get;
|
|
191
|
+
var stackValue = stackDescriptor.value;
|
|
192
|
+
delete stackDescriptor.value;
|
|
193
|
+
delete stackDescriptor.writable;
|
|
194
|
+
stackDescriptor.set = function(newstack) {
|
|
195
|
+
overwrittenStack = newstack;
|
|
196
|
+
};
|
|
197
|
+
stackDescriptor.get = function() {
|
|
198
|
+
var stack = (overwrittenStack || (stackGetter ? stackGetter.call(this) : stackValue)).split(/\r?\n+/g);
|
|
199
|
+
if (!overwrittenStack) {
|
|
200
|
+
stack[0] = this.name + ": " + this.message;
|
|
201
|
+
}
|
|
202
|
+
var lineCount = 1;
|
|
203
|
+
for (var key in properties) {
|
|
204
|
+
if (!properties.hasOwnProperty(key)) {
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
var modifier = properties[key];
|
|
208
|
+
if ("line" in modifier) {
|
|
209
|
+
var line = modifier.line(this[key]);
|
|
210
|
+
if (line) {
|
|
211
|
+
stack.splice(lineCount++, 0, " " + line);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
if ("stack" in modifier) {
|
|
215
|
+
modifier.stack(this[key], stack);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return stack.join("\n");
|
|
219
|
+
};
|
|
220
|
+
Object.defineProperty(this, "stack", stackDescriptor);
|
|
221
|
+
};
|
|
222
|
+
if (Object.setPrototypeOf) {
|
|
223
|
+
Object.setPrototypeOf(errorExError.prototype, Error.prototype);
|
|
224
|
+
Object.setPrototypeOf(errorExError, Error);
|
|
225
|
+
} else {
|
|
226
|
+
util.inherits(errorExError, Error);
|
|
227
|
+
}
|
|
228
|
+
return errorExError;
|
|
229
|
+
};
|
|
230
|
+
errorEx.append = function(str, def) {
|
|
231
|
+
return {
|
|
232
|
+
message: function(v, message) {
|
|
233
|
+
v = v || def;
|
|
234
|
+
if (v) {
|
|
235
|
+
message[0] += " " + str.replace("%s", v.toString());
|
|
236
|
+
}
|
|
237
|
+
return message;
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
};
|
|
241
|
+
errorEx.line = function(str, def) {
|
|
242
|
+
return {
|
|
243
|
+
line: function(v) {
|
|
244
|
+
v = v || def;
|
|
245
|
+
if (v) {
|
|
246
|
+
return str.replace("%s", v.toString());
|
|
247
|
+
}
|
|
248
|
+
return null;
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
};
|
|
252
|
+
module.exports = errorEx;
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
// node_modules/json-parse-even-better-errors/index.js
|
|
257
|
+
var require_json_parse_even_better_errors = __commonJS({
|
|
258
|
+
"node_modules/json-parse-even-better-errors/index.js"(exports, module) {
|
|
259
|
+
"use strict";
|
|
260
|
+
var hexify = (char) => {
|
|
261
|
+
const h = char.charCodeAt(0).toString(16).toUpperCase();
|
|
262
|
+
return "0x" + (h.length % 2 ? "0" : "") + h;
|
|
263
|
+
};
|
|
264
|
+
var parseError = (e, txt, context) => {
|
|
265
|
+
if (!txt) {
|
|
266
|
+
return {
|
|
267
|
+
message: e.message + " while parsing empty string",
|
|
268
|
+
position: 0
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
const badToken = e.message.match(/^Unexpected token (.) .*position\s+(\d+)/i);
|
|
272
|
+
const errIdx = badToken ? +badToken[2] : e.message.match(/^Unexpected end of JSON.*/i) ? txt.length - 1 : null;
|
|
273
|
+
const msg = badToken ? e.message.replace(/^Unexpected token ./, `Unexpected token ${JSON.stringify(badToken[1])} (${hexify(badToken[1])})`) : e.message;
|
|
274
|
+
if (errIdx !== null && errIdx !== void 0) {
|
|
275
|
+
const start = errIdx <= context ? 0 : errIdx - context;
|
|
276
|
+
const end = errIdx + context >= txt.length ? txt.length : errIdx + context;
|
|
277
|
+
const slice = (start === 0 ? "" : "...") + txt.slice(start, end) + (end === txt.length ? "" : "...");
|
|
278
|
+
const near = txt === slice ? "" : "near ";
|
|
279
|
+
return {
|
|
280
|
+
message: msg + ` while parsing ${near}${JSON.stringify(slice)}`,
|
|
281
|
+
position: errIdx
|
|
282
|
+
};
|
|
283
|
+
} else {
|
|
284
|
+
return {
|
|
285
|
+
message: msg + ` while parsing '${txt.slice(0, context * 2)}'`,
|
|
286
|
+
position: 0
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
var JSONParseError = class extends SyntaxError {
|
|
291
|
+
constructor(er, txt, context, caller) {
|
|
292
|
+
context = context || 20;
|
|
293
|
+
const metadata = parseError(er, txt, context);
|
|
294
|
+
super(metadata.message);
|
|
295
|
+
Object.assign(this, metadata);
|
|
296
|
+
this.code = "EJSONPARSE";
|
|
297
|
+
this.systemError = er;
|
|
298
|
+
Error.captureStackTrace(this, caller || this.constructor);
|
|
299
|
+
}
|
|
300
|
+
get name() {
|
|
301
|
+
return this.constructor.name;
|
|
302
|
+
}
|
|
303
|
+
set name(n) {
|
|
304
|
+
}
|
|
305
|
+
get [Symbol.toStringTag]() {
|
|
306
|
+
return this.constructor.name;
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
var kIndent = /* @__PURE__ */ Symbol.for("indent");
|
|
310
|
+
var kNewline = /* @__PURE__ */ Symbol.for("newline");
|
|
311
|
+
var formatRE = /^\s*[{\[]((?:\r?\n)+)([\s\t]*)/;
|
|
312
|
+
var emptyRE = /^(?:\{\}|\[\])((?:\r?\n)+)?$/;
|
|
313
|
+
var parseJson = (txt, reviver, context) => {
|
|
314
|
+
const parseText = stripBOM(txt);
|
|
315
|
+
context = context || 20;
|
|
316
|
+
try {
|
|
317
|
+
const [, newline = "\n", indent = " "] = parseText.match(emptyRE) || parseText.match(formatRE) || [, "", ""];
|
|
318
|
+
const result = JSON.parse(parseText, reviver);
|
|
319
|
+
if (result && typeof result === "object") {
|
|
320
|
+
result[kNewline] = newline;
|
|
321
|
+
result[kIndent] = indent;
|
|
322
|
+
}
|
|
323
|
+
return result;
|
|
324
|
+
} catch (e) {
|
|
325
|
+
if (typeof txt !== "string" && !Buffer.isBuffer(txt)) {
|
|
326
|
+
const isEmptyArray = Array.isArray(txt) && txt.length === 0;
|
|
327
|
+
throw Object.assign(new TypeError(
|
|
328
|
+
`Cannot parse ${isEmptyArray ? "an empty array" : String(txt)}`
|
|
329
|
+
), {
|
|
330
|
+
code: "EJSONPARSE",
|
|
331
|
+
systemError: e
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
throw new JSONParseError(e, parseText, context, parseJson);
|
|
335
|
+
}
|
|
336
|
+
};
|
|
337
|
+
var stripBOM = (txt) => String(txt).replace(/^\uFEFF/, "");
|
|
338
|
+
module.exports = parseJson;
|
|
339
|
+
parseJson.JSONParseError = JSONParseError;
|
|
340
|
+
parseJson.noExceptions = (txt, reviver) => {
|
|
341
|
+
try {
|
|
342
|
+
return JSON.parse(stripBOM(txt), reviver);
|
|
343
|
+
} catch (e) {
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
|
|
349
|
+
// node_modules/lines-and-columns/build/index.js
|
|
350
|
+
var require_build = __commonJS({
|
|
351
|
+
"node_modules/lines-and-columns/build/index.js"(exports) {
|
|
352
|
+
"use strict";
|
|
353
|
+
exports.__esModule = true;
|
|
354
|
+
exports.LinesAndColumns = void 0;
|
|
355
|
+
var LF = "\n";
|
|
356
|
+
var CR = "\r";
|
|
357
|
+
var LinesAndColumns = (
|
|
358
|
+
/** @class */
|
|
359
|
+
(function() {
|
|
360
|
+
function LinesAndColumns2(string) {
|
|
361
|
+
this.string = string;
|
|
362
|
+
var offsets = [0];
|
|
363
|
+
for (var offset = 0; offset < string.length; ) {
|
|
364
|
+
switch (string[offset]) {
|
|
365
|
+
case LF:
|
|
366
|
+
offset += LF.length;
|
|
367
|
+
offsets.push(offset);
|
|
368
|
+
break;
|
|
369
|
+
case CR:
|
|
370
|
+
offset += CR.length;
|
|
371
|
+
if (string[offset] === LF) {
|
|
372
|
+
offset += LF.length;
|
|
373
|
+
}
|
|
374
|
+
offsets.push(offset);
|
|
375
|
+
break;
|
|
376
|
+
default:
|
|
377
|
+
offset++;
|
|
378
|
+
break;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
this.offsets = offsets;
|
|
382
|
+
}
|
|
383
|
+
LinesAndColumns2.prototype.locationForIndex = function(index) {
|
|
384
|
+
if (index < 0 || index > this.string.length) {
|
|
385
|
+
return null;
|
|
386
|
+
}
|
|
387
|
+
var line = 0;
|
|
388
|
+
var offsets = this.offsets;
|
|
389
|
+
while (offsets[line + 1] <= index) {
|
|
390
|
+
line++;
|
|
391
|
+
}
|
|
392
|
+
var column = index - offsets[line];
|
|
393
|
+
return { line, column };
|
|
394
|
+
};
|
|
395
|
+
LinesAndColumns2.prototype.indexForLocation = function(location) {
|
|
396
|
+
var line = location.line, column = location.column;
|
|
397
|
+
if (line < 0 || line >= this.offsets.length) {
|
|
398
|
+
return null;
|
|
399
|
+
}
|
|
400
|
+
if (column < 0 || column > this.lengthOfLine(line)) {
|
|
401
|
+
return null;
|
|
402
|
+
}
|
|
403
|
+
return this.offsets[line] + column;
|
|
404
|
+
};
|
|
405
|
+
LinesAndColumns2.prototype.lengthOfLine = function(line) {
|
|
406
|
+
var offset = this.offsets[line];
|
|
407
|
+
var nextOffset = line === this.offsets.length - 1 ? this.string.length : this.offsets[line + 1];
|
|
408
|
+
return nextOffset - offset;
|
|
409
|
+
};
|
|
410
|
+
return LinesAndColumns2;
|
|
411
|
+
})()
|
|
412
|
+
);
|
|
413
|
+
exports.LinesAndColumns = LinesAndColumns;
|
|
414
|
+
exports["default"] = LinesAndColumns;
|
|
415
|
+
}
|
|
416
|
+
});
|
|
417
|
+
|
|
418
|
+
// node_modules/parse-json/index.js
|
|
419
|
+
var require_parse_json = __commonJS({
|
|
420
|
+
"node_modules/parse-json/index.js"(exports, module) {
|
|
421
|
+
"use strict";
|
|
422
|
+
var errorEx = require_error_ex();
|
|
423
|
+
var fallback = require_json_parse_even_better_errors();
|
|
424
|
+
var { default: LinesAndColumns } = require_build();
|
|
425
|
+
var { codeFrameColumns } = require_lib();
|
|
426
|
+
var JSONError = errorEx("JSONError", {
|
|
427
|
+
fileName: errorEx.append("in %s"),
|
|
428
|
+
codeFrame: errorEx.append("\n\n%s\n")
|
|
429
|
+
});
|
|
430
|
+
var parseJson = (string, reviver, filename) => {
|
|
431
|
+
if (typeof reviver === "string") {
|
|
432
|
+
filename = reviver;
|
|
433
|
+
reviver = null;
|
|
434
|
+
}
|
|
435
|
+
try {
|
|
436
|
+
try {
|
|
437
|
+
return JSON.parse(string, reviver);
|
|
438
|
+
} catch (error) {
|
|
439
|
+
fallback(string, reviver);
|
|
440
|
+
throw error;
|
|
441
|
+
}
|
|
442
|
+
} catch (error) {
|
|
443
|
+
error.message = error.message.replace(/\n/g, "");
|
|
444
|
+
const indexMatch = error.message.match(/in JSON at position (\d+) while parsing/);
|
|
445
|
+
const jsonError = new JSONError(error);
|
|
446
|
+
if (filename) {
|
|
447
|
+
jsonError.fileName = filename;
|
|
448
|
+
}
|
|
449
|
+
if (indexMatch && indexMatch.length > 0) {
|
|
450
|
+
const lines = new LinesAndColumns(string);
|
|
451
|
+
const index = Number(indexMatch[1]);
|
|
452
|
+
const location = lines.locationForIndex(index);
|
|
453
|
+
const codeFrame = codeFrameColumns(
|
|
454
|
+
string,
|
|
455
|
+
{ start: { line: location.line + 1, column: location.column + 1 } },
|
|
456
|
+
{ highlightCode: true }
|
|
457
|
+
);
|
|
458
|
+
jsonError.codeFrame = codeFrame;
|
|
459
|
+
}
|
|
460
|
+
throw jsonError;
|
|
461
|
+
}
|
|
462
|
+
};
|
|
463
|
+
parseJson.JSONError = JSONError;
|
|
464
|
+
module.exports = parseJson;
|
|
465
|
+
}
|
|
466
|
+
});
|
|
467
|
+
|
|
468
|
+
// node_modules/js-yaml/lib/common.js
|
|
469
|
+
var require_common = __commonJS({
|
|
470
|
+
"node_modules/js-yaml/lib/common.js"(exports, module) {
|
|
471
|
+
"use strict";
|
|
472
|
+
function isNothing(subject) {
|
|
473
|
+
return typeof subject === "undefined" || subject === null;
|
|
474
|
+
}
|
|
475
|
+
function isObject(subject) {
|
|
476
|
+
return typeof subject === "object" && subject !== null;
|
|
477
|
+
}
|
|
478
|
+
function toArray(sequence) {
|
|
479
|
+
if (Array.isArray(sequence)) return sequence;
|
|
480
|
+
else if (isNothing(sequence)) return [];
|
|
481
|
+
return [sequence];
|
|
482
|
+
}
|
|
483
|
+
function extend(target, source) {
|
|
484
|
+
if (source) {
|
|
485
|
+
const sourceKeys = Object.keys(source);
|
|
486
|
+
for (let index = 0, length = sourceKeys.length; index < length; index += 1) {
|
|
487
|
+
const key = sourceKeys[index];
|
|
488
|
+
target[key] = source[key];
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
return target;
|
|
492
|
+
}
|
|
493
|
+
function repeat(string, count) {
|
|
494
|
+
let result = "";
|
|
495
|
+
for (let cycle = 0; cycle < count; cycle += 1) {
|
|
496
|
+
result += string;
|
|
497
|
+
}
|
|
498
|
+
return result;
|
|
499
|
+
}
|
|
500
|
+
function isNegativeZero(number) {
|
|
501
|
+
return number === 0 && Number.NEGATIVE_INFINITY === 1 / number;
|
|
502
|
+
}
|
|
503
|
+
module.exports.isNothing = isNothing;
|
|
504
|
+
module.exports.isObject = isObject;
|
|
505
|
+
module.exports.toArray = toArray;
|
|
506
|
+
module.exports.repeat = repeat;
|
|
507
|
+
module.exports.isNegativeZero = isNegativeZero;
|
|
508
|
+
module.exports.extend = extend;
|
|
509
|
+
}
|
|
510
|
+
});
|
|
511
|
+
|
|
512
|
+
// node_modules/js-yaml/lib/exception.js
|
|
513
|
+
var require_exception = __commonJS({
|
|
514
|
+
"node_modules/js-yaml/lib/exception.js"(exports, module) {
|
|
515
|
+
"use strict";
|
|
516
|
+
function formatError(exception, compact) {
|
|
517
|
+
let where = "";
|
|
518
|
+
const message = exception.reason || "(unknown reason)";
|
|
519
|
+
if (!exception.mark) return message;
|
|
520
|
+
if (exception.mark.name) {
|
|
521
|
+
where += 'in "' + exception.mark.name + '" ';
|
|
522
|
+
}
|
|
523
|
+
where += "(" + (exception.mark.line + 1) + ":" + (exception.mark.column + 1) + ")";
|
|
524
|
+
if (!compact && exception.mark.snippet) {
|
|
525
|
+
where += "\n\n" + exception.mark.snippet;
|
|
526
|
+
}
|
|
527
|
+
return message + " " + where;
|
|
528
|
+
}
|
|
529
|
+
function YAMLException(reason, mark) {
|
|
530
|
+
Error.call(this);
|
|
531
|
+
this.name = "YAMLException";
|
|
532
|
+
this.reason = reason;
|
|
533
|
+
this.mark = mark;
|
|
534
|
+
this.message = formatError(this, false);
|
|
535
|
+
if (Error.captureStackTrace) {
|
|
536
|
+
Error.captureStackTrace(this, this.constructor);
|
|
537
|
+
} else {
|
|
538
|
+
this.stack = new Error().stack || "";
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
YAMLException.prototype = Object.create(Error.prototype);
|
|
542
|
+
YAMLException.prototype.constructor = YAMLException;
|
|
543
|
+
YAMLException.prototype.toString = function toString(compact) {
|
|
544
|
+
return this.name + ": " + formatError(this, compact);
|
|
545
|
+
};
|
|
546
|
+
module.exports = YAMLException;
|
|
547
|
+
}
|
|
548
|
+
});
|
|
549
|
+
|
|
550
|
+
// node_modules/js-yaml/lib/snippet.js
|
|
551
|
+
var require_snippet = __commonJS({
|
|
552
|
+
"node_modules/js-yaml/lib/snippet.js"(exports, module) {
|
|
553
|
+
"use strict";
|
|
554
|
+
var common = require_common();
|
|
555
|
+
function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
|
|
556
|
+
let head = "";
|
|
557
|
+
let tail = "";
|
|
558
|
+
const maxHalfLength = Math.floor(maxLineLength / 2) - 1;
|
|
559
|
+
if (position - lineStart > maxHalfLength) {
|
|
560
|
+
head = " ... ";
|
|
561
|
+
lineStart = position - maxHalfLength + head.length;
|
|
562
|
+
}
|
|
563
|
+
if (lineEnd - position > maxHalfLength) {
|
|
564
|
+
tail = " ...";
|
|
565
|
+
lineEnd = position + maxHalfLength - tail.length;
|
|
566
|
+
}
|
|
567
|
+
return {
|
|
568
|
+
str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, "\u2192") + tail,
|
|
569
|
+
pos: position - lineStart + head.length
|
|
570
|
+
// relative position
|
|
571
|
+
};
|
|
572
|
+
}
|
|
573
|
+
function padStart(string, max) {
|
|
574
|
+
return common.repeat(" ", max - string.length) + string;
|
|
575
|
+
}
|
|
576
|
+
function makeSnippet(mark, options) {
|
|
577
|
+
options = Object.create(options || null);
|
|
578
|
+
if (!mark.buffer) return null;
|
|
579
|
+
if (!options.maxLength) options.maxLength = 79;
|
|
580
|
+
if (typeof options.indent !== "number") options.indent = 1;
|
|
581
|
+
if (typeof options.linesBefore !== "number") options.linesBefore = 3;
|
|
582
|
+
if (typeof options.linesAfter !== "number") options.linesAfter = 2;
|
|
583
|
+
const re = /\r?\n|\r|\0/g;
|
|
584
|
+
const lineStarts = [0];
|
|
585
|
+
const lineEnds = [];
|
|
586
|
+
let match;
|
|
587
|
+
let foundLineNo = -1;
|
|
588
|
+
while (match = re.exec(mark.buffer)) {
|
|
589
|
+
lineEnds.push(match.index);
|
|
590
|
+
lineStarts.push(match.index + match[0].length);
|
|
591
|
+
if (mark.position <= match.index && foundLineNo < 0) {
|
|
592
|
+
foundLineNo = lineStarts.length - 2;
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
if (foundLineNo < 0) foundLineNo = lineStarts.length - 1;
|
|
596
|
+
let result = "";
|
|
597
|
+
const lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length;
|
|
598
|
+
const maxLineLength = options.maxLength - (options.indent + lineNoLength + 3);
|
|
599
|
+
for (let i = 1; i <= options.linesBefore; i++) {
|
|
600
|
+
if (foundLineNo - i < 0) break;
|
|
601
|
+
const line2 = getLine(
|
|
602
|
+
mark.buffer,
|
|
603
|
+
lineStarts[foundLineNo - i],
|
|
604
|
+
lineEnds[foundLineNo - i],
|
|
605
|
+
mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]),
|
|
606
|
+
maxLineLength
|
|
607
|
+
);
|
|
608
|
+
result = common.repeat(" ", options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + " | " + line2.str + "\n" + result;
|
|
609
|
+
}
|
|
610
|
+
const line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
|
|
611
|
+
result += common.repeat(" ", options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + " | " + line.str + "\n";
|
|
612
|
+
result += common.repeat("-", options.indent + lineNoLength + 3 + line.pos) + "^\n";
|
|
613
|
+
for (let i = 1; i <= options.linesAfter; i++) {
|
|
614
|
+
if (foundLineNo + i >= lineEnds.length) break;
|
|
615
|
+
const line2 = getLine(
|
|
616
|
+
mark.buffer,
|
|
617
|
+
lineStarts[foundLineNo + i],
|
|
618
|
+
lineEnds[foundLineNo + i],
|
|
619
|
+
mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]),
|
|
620
|
+
maxLineLength
|
|
621
|
+
);
|
|
622
|
+
result += common.repeat(" ", options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + " | " + line2.str + "\n";
|
|
623
|
+
}
|
|
624
|
+
return result.replace(/\n$/, "");
|
|
625
|
+
}
|
|
626
|
+
module.exports = makeSnippet;
|
|
627
|
+
}
|
|
628
|
+
});
|
|
629
|
+
|
|
630
|
+
// node_modules/js-yaml/lib/type.js
|
|
631
|
+
var require_type = __commonJS({
|
|
632
|
+
"node_modules/js-yaml/lib/type.js"(exports, module) {
|
|
633
|
+
"use strict";
|
|
634
|
+
var YAMLException = require_exception();
|
|
635
|
+
var TYPE_CONSTRUCTOR_OPTIONS = [
|
|
636
|
+
"kind",
|
|
637
|
+
"multi",
|
|
638
|
+
"resolve",
|
|
639
|
+
"construct",
|
|
640
|
+
"instanceOf",
|
|
641
|
+
"predicate",
|
|
642
|
+
"represent",
|
|
643
|
+
"representName",
|
|
644
|
+
"defaultStyle",
|
|
645
|
+
"styleAliases"
|
|
646
|
+
];
|
|
647
|
+
var YAML_NODE_KINDS = [
|
|
648
|
+
"scalar",
|
|
649
|
+
"sequence",
|
|
650
|
+
"mapping"
|
|
651
|
+
];
|
|
652
|
+
function compileStyleAliases(map) {
|
|
653
|
+
const result = {};
|
|
654
|
+
if (map !== null) {
|
|
655
|
+
Object.keys(map).forEach(function(style) {
|
|
656
|
+
map[style].forEach(function(alias) {
|
|
657
|
+
result[String(alias)] = style;
|
|
658
|
+
});
|
|
659
|
+
});
|
|
660
|
+
}
|
|
661
|
+
return result;
|
|
662
|
+
}
|
|
663
|
+
function Type(tag, options) {
|
|
664
|
+
options = options || {};
|
|
665
|
+
Object.keys(options).forEach(function(name) {
|
|
666
|
+
if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
|
|
667
|
+
throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
|
|
668
|
+
}
|
|
669
|
+
});
|
|
670
|
+
this.options = options;
|
|
671
|
+
this.tag = tag;
|
|
672
|
+
this.kind = options["kind"] || null;
|
|
673
|
+
this.resolve = options["resolve"] || function() {
|
|
674
|
+
return true;
|
|
675
|
+
};
|
|
676
|
+
this.construct = options["construct"] || function(data) {
|
|
677
|
+
return data;
|
|
678
|
+
};
|
|
679
|
+
this.instanceOf = options["instanceOf"] || null;
|
|
680
|
+
this.predicate = options["predicate"] || null;
|
|
681
|
+
this.represent = options["represent"] || null;
|
|
682
|
+
this.representName = options["representName"] || null;
|
|
683
|
+
this.defaultStyle = options["defaultStyle"] || null;
|
|
684
|
+
this.multi = options["multi"] || false;
|
|
685
|
+
this.styleAliases = compileStyleAliases(options["styleAliases"] || null);
|
|
686
|
+
if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
|
|
687
|
+
throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
module.exports = Type;
|
|
691
|
+
}
|
|
692
|
+
});
|
|
693
|
+
|
|
694
|
+
// node_modules/js-yaml/lib/schema.js
|
|
695
|
+
var require_schema = __commonJS({
|
|
696
|
+
"node_modules/js-yaml/lib/schema.js"(exports, module) {
|
|
697
|
+
"use strict";
|
|
698
|
+
var YAMLException = require_exception();
|
|
699
|
+
var Type = require_type();
|
|
700
|
+
function compileList(schema, name) {
|
|
701
|
+
const result = [];
|
|
702
|
+
schema[name].forEach(function(currentType) {
|
|
703
|
+
let newIndex = result.length;
|
|
704
|
+
result.forEach(function(previousType, previousIndex) {
|
|
705
|
+
if (previousType.tag === currentType.tag && previousType.kind === currentType.kind && previousType.multi === currentType.multi) {
|
|
706
|
+
newIndex = previousIndex;
|
|
707
|
+
}
|
|
708
|
+
});
|
|
709
|
+
result[newIndex] = currentType;
|
|
710
|
+
});
|
|
711
|
+
return result;
|
|
712
|
+
}
|
|
713
|
+
function compileMap() {
|
|
714
|
+
const result = {
|
|
715
|
+
scalar: {},
|
|
716
|
+
sequence: {},
|
|
717
|
+
mapping: {},
|
|
718
|
+
fallback: {},
|
|
719
|
+
multi: {
|
|
720
|
+
scalar: [],
|
|
721
|
+
sequence: [],
|
|
722
|
+
mapping: [],
|
|
723
|
+
fallback: []
|
|
724
|
+
}
|
|
725
|
+
};
|
|
726
|
+
function collectType(type) {
|
|
727
|
+
if (type.multi) {
|
|
728
|
+
result.multi[type.kind].push(type);
|
|
729
|
+
result.multi["fallback"].push(type);
|
|
730
|
+
} else {
|
|
731
|
+
result[type.kind][type.tag] = result["fallback"][type.tag] = type;
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
for (let index = 0, length = arguments.length; index < length; index += 1) {
|
|
735
|
+
arguments[index].forEach(collectType);
|
|
736
|
+
}
|
|
737
|
+
return result;
|
|
738
|
+
}
|
|
739
|
+
function Schema(definition) {
|
|
740
|
+
return this.extend(definition);
|
|
741
|
+
}
|
|
742
|
+
Schema.prototype.extend = function extend(definition) {
|
|
743
|
+
let implicit = [];
|
|
744
|
+
let explicit = [];
|
|
745
|
+
if (definition instanceof Type) {
|
|
746
|
+
explicit.push(definition);
|
|
747
|
+
} else if (Array.isArray(definition)) {
|
|
748
|
+
explicit = explicit.concat(definition);
|
|
749
|
+
} else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {
|
|
750
|
+
if (definition.implicit) implicit = implicit.concat(definition.implicit);
|
|
751
|
+
if (definition.explicit) explicit = explicit.concat(definition.explicit);
|
|
752
|
+
} else {
|
|
753
|
+
throw new YAMLException("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");
|
|
754
|
+
}
|
|
755
|
+
implicit.forEach(function(type) {
|
|
756
|
+
if (!(type instanceof Type)) {
|
|
757
|
+
throw new YAMLException("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
|
758
|
+
}
|
|
759
|
+
if (type.loadKind && type.loadKind !== "scalar") {
|
|
760
|
+
throw new YAMLException("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
|
|
761
|
+
}
|
|
762
|
+
if (type.multi) {
|
|
763
|
+
throw new YAMLException("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.");
|
|
764
|
+
}
|
|
765
|
+
});
|
|
766
|
+
explicit.forEach(function(type) {
|
|
767
|
+
if (!(type instanceof Type)) {
|
|
768
|
+
throw new YAMLException("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
|
769
|
+
}
|
|
770
|
+
});
|
|
771
|
+
const result = Object.create(Schema.prototype);
|
|
772
|
+
result.implicit = (this.implicit || []).concat(implicit);
|
|
773
|
+
result.explicit = (this.explicit || []).concat(explicit);
|
|
774
|
+
result.compiledImplicit = compileList(result, "implicit");
|
|
775
|
+
result.compiledExplicit = compileList(result, "explicit");
|
|
776
|
+
result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit);
|
|
777
|
+
return result;
|
|
778
|
+
};
|
|
779
|
+
module.exports = Schema;
|
|
780
|
+
}
|
|
781
|
+
});
|
|
782
|
+
|
|
783
|
+
// node_modules/js-yaml/lib/type/str.js
|
|
784
|
+
var require_str = __commonJS({
|
|
785
|
+
"node_modules/js-yaml/lib/type/str.js"(exports, module) {
|
|
786
|
+
"use strict";
|
|
787
|
+
var Type = require_type();
|
|
788
|
+
module.exports = new Type("tag:yaml.org,2002:str", {
|
|
789
|
+
kind: "scalar",
|
|
790
|
+
construct: function(data) {
|
|
791
|
+
return data !== null ? data : "";
|
|
792
|
+
}
|
|
793
|
+
});
|
|
794
|
+
}
|
|
795
|
+
});
|
|
796
|
+
|
|
797
|
+
// node_modules/js-yaml/lib/type/seq.js
|
|
798
|
+
var require_seq = __commonJS({
|
|
799
|
+
"node_modules/js-yaml/lib/type/seq.js"(exports, module) {
|
|
800
|
+
"use strict";
|
|
801
|
+
var Type = require_type();
|
|
802
|
+
module.exports = new Type("tag:yaml.org,2002:seq", {
|
|
803
|
+
kind: "sequence",
|
|
804
|
+
construct: function(data) {
|
|
805
|
+
return data !== null ? data : [];
|
|
806
|
+
}
|
|
807
|
+
});
|
|
808
|
+
}
|
|
809
|
+
});
|
|
810
|
+
|
|
811
|
+
// node_modules/js-yaml/lib/type/map.js
|
|
812
|
+
var require_map = __commonJS({
|
|
813
|
+
"node_modules/js-yaml/lib/type/map.js"(exports, module) {
|
|
814
|
+
"use strict";
|
|
815
|
+
var Type = require_type();
|
|
816
|
+
module.exports = new Type("tag:yaml.org,2002:map", {
|
|
817
|
+
kind: "mapping",
|
|
818
|
+
construct: function(data) {
|
|
819
|
+
return data !== null ? data : {};
|
|
820
|
+
}
|
|
821
|
+
});
|
|
822
|
+
}
|
|
823
|
+
});
|
|
824
|
+
|
|
825
|
+
// node_modules/js-yaml/lib/schema/failsafe.js
|
|
826
|
+
var require_failsafe = __commonJS({
|
|
827
|
+
"node_modules/js-yaml/lib/schema/failsafe.js"(exports, module) {
|
|
828
|
+
"use strict";
|
|
829
|
+
var Schema = require_schema();
|
|
830
|
+
module.exports = new Schema({
|
|
831
|
+
explicit: [
|
|
832
|
+
require_str(),
|
|
833
|
+
require_seq(),
|
|
834
|
+
require_map()
|
|
835
|
+
]
|
|
836
|
+
});
|
|
837
|
+
}
|
|
838
|
+
});
|
|
839
|
+
|
|
840
|
+
// node_modules/js-yaml/lib/type/null.js
|
|
841
|
+
var require_null = __commonJS({
|
|
842
|
+
"node_modules/js-yaml/lib/type/null.js"(exports, module) {
|
|
843
|
+
"use strict";
|
|
844
|
+
var Type = require_type();
|
|
845
|
+
function resolveYamlNull(data) {
|
|
846
|
+
if (data === null) return true;
|
|
847
|
+
const max = data.length;
|
|
848
|
+
return max === 1 && data === "~" || max === 4 && (data === "null" || data === "Null" || data === "NULL");
|
|
849
|
+
}
|
|
850
|
+
function constructYamlNull() {
|
|
851
|
+
return null;
|
|
852
|
+
}
|
|
853
|
+
function isNull(object) {
|
|
854
|
+
return object === null;
|
|
855
|
+
}
|
|
856
|
+
module.exports = new Type("tag:yaml.org,2002:null", {
|
|
857
|
+
kind: "scalar",
|
|
858
|
+
resolve: resolveYamlNull,
|
|
859
|
+
construct: constructYamlNull,
|
|
860
|
+
predicate: isNull,
|
|
861
|
+
represent: {
|
|
862
|
+
canonical: function() {
|
|
863
|
+
return "~";
|
|
864
|
+
},
|
|
865
|
+
lowercase: function() {
|
|
866
|
+
return "null";
|
|
867
|
+
},
|
|
868
|
+
uppercase: function() {
|
|
869
|
+
return "NULL";
|
|
870
|
+
},
|
|
871
|
+
camelcase: function() {
|
|
872
|
+
return "Null";
|
|
873
|
+
},
|
|
874
|
+
empty: function() {
|
|
875
|
+
return "";
|
|
876
|
+
}
|
|
877
|
+
},
|
|
878
|
+
defaultStyle: "lowercase"
|
|
879
|
+
});
|
|
880
|
+
}
|
|
881
|
+
});
|
|
882
|
+
|
|
883
|
+
// node_modules/js-yaml/lib/type/bool.js
|
|
884
|
+
var require_bool = __commonJS({
|
|
885
|
+
"node_modules/js-yaml/lib/type/bool.js"(exports, module) {
|
|
886
|
+
"use strict";
|
|
887
|
+
var Type = require_type();
|
|
888
|
+
function resolveYamlBoolean(data) {
|
|
889
|
+
if (data === null) return false;
|
|
890
|
+
const max = data.length;
|
|
891
|
+
return max === 4 && (data === "true" || data === "True" || data === "TRUE") || max === 5 && (data === "false" || data === "False" || data === "FALSE");
|
|
892
|
+
}
|
|
893
|
+
function constructYamlBoolean(data) {
|
|
894
|
+
return data === "true" || data === "True" || data === "TRUE";
|
|
895
|
+
}
|
|
896
|
+
function isBoolean(object) {
|
|
897
|
+
return Object.prototype.toString.call(object) === "[object Boolean]";
|
|
898
|
+
}
|
|
899
|
+
module.exports = new Type("tag:yaml.org,2002:bool", {
|
|
900
|
+
kind: "scalar",
|
|
901
|
+
resolve: resolveYamlBoolean,
|
|
902
|
+
construct: constructYamlBoolean,
|
|
903
|
+
predicate: isBoolean,
|
|
904
|
+
represent: {
|
|
905
|
+
lowercase: function(object) {
|
|
906
|
+
return object ? "true" : "false";
|
|
907
|
+
},
|
|
908
|
+
uppercase: function(object) {
|
|
909
|
+
return object ? "TRUE" : "FALSE";
|
|
910
|
+
},
|
|
911
|
+
camelcase: function(object) {
|
|
912
|
+
return object ? "True" : "False";
|
|
913
|
+
}
|
|
914
|
+
},
|
|
915
|
+
defaultStyle: "lowercase"
|
|
916
|
+
});
|
|
917
|
+
}
|
|
918
|
+
});
|
|
919
|
+
|
|
920
|
+
// node_modules/js-yaml/lib/type/int.js
|
|
921
|
+
var require_int = __commonJS({
|
|
922
|
+
"node_modules/js-yaml/lib/type/int.js"(exports, module) {
|
|
923
|
+
"use strict";
|
|
924
|
+
var common = require_common();
|
|
925
|
+
var Type = require_type();
|
|
926
|
+
function isHexCode(c) {
|
|
927
|
+
return c >= 48 && c <= 57 || c >= 65 && c <= 70 || c >= 97 && c <= 102;
|
|
928
|
+
}
|
|
929
|
+
function isOctCode(c) {
|
|
930
|
+
return c >= 48 && c <= 55;
|
|
931
|
+
}
|
|
932
|
+
function isDecCode(c) {
|
|
933
|
+
return c >= 48 && c <= 57;
|
|
934
|
+
}
|
|
935
|
+
function resolveYamlInteger(data) {
|
|
936
|
+
if (data === null) return false;
|
|
937
|
+
const max = data.length;
|
|
938
|
+
let index = 0;
|
|
939
|
+
let hasDigits = false;
|
|
940
|
+
if (!max) return false;
|
|
941
|
+
let ch = data[index];
|
|
942
|
+
if (ch === "-" || ch === "+") {
|
|
943
|
+
ch = data[++index];
|
|
944
|
+
}
|
|
945
|
+
if (ch === "0") {
|
|
946
|
+
if (index + 1 === max) return true;
|
|
947
|
+
ch = data[++index];
|
|
948
|
+
if (ch === "b") {
|
|
949
|
+
index++;
|
|
950
|
+
for (; index < max; index++) {
|
|
951
|
+
ch = data[index];
|
|
952
|
+
if (ch !== "0" && ch !== "1") return false;
|
|
953
|
+
hasDigits = true;
|
|
954
|
+
}
|
|
955
|
+
return hasDigits && isFinite(parseYamlInteger(data));
|
|
956
|
+
}
|
|
957
|
+
if (ch === "x") {
|
|
958
|
+
index++;
|
|
959
|
+
for (; index < max; index++) {
|
|
960
|
+
if (!isHexCode(data.charCodeAt(index))) return false;
|
|
961
|
+
hasDigits = true;
|
|
962
|
+
}
|
|
963
|
+
return hasDigits && isFinite(parseYamlInteger(data));
|
|
964
|
+
}
|
|
965
|
+
if (ch === "o") {
|
|
966
|
+
index++;
|
|
967
|
+
for (; index < max; index++) {
|
|
968
|
+
if (!isOctCode(data.charCodeAt(index))) return false;
|
|
969
|
+
hasDigits = true;
|
|
970
|
+
}
|
|
971
|
+
return hasDigits && isFinite(parseYamlInteger(data));
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
for (; index < max; index++) {
|
|
975
|
+
if (!isDecCode(data.charCodeAt(index))) {
|
|
976
|
+
return false;
|
|
977
|
+
}
|
|
978
|
+
hasDigits = true;
|
|
979
|
+
}
|
|
980
|
+
if (!hasDigits) return false;
|
|
981
|
+
return isFinite(parseYamlInteger(data));
|
|
982
|
+
}
|
|
983
|
+
function parseYamlInteger(data) {
|
|
984
|
+
let value = data;
|
|
985
|
+
let sign = 1;
|
|
986
|
+
let ch = value[0];
|
|
987
|
+
if (ch === "-" || ch === "+") {
|
|
988
|
+
if (ch === "-") sign = -1;
|
|
989
|
+
value = value.slice(1);
|
|
990
|
+
ch = value[0];
|
|
991
|
+
}
|
|
992
|
+
if (value === "0") return 0;
|
|
993
|
+
if (ch === "0") {
|
|
994
|
+
if (value[1] === "b") return sign * parseInt(value.slice(2), 2);
|
|
995
|
+
if (value[1] === "x") return sign * parseInt(value.slice(2), 16);
|
|
996
|
+
if (value[1] === "o") return sign * parseInt(value.slice(2), 8);
|
|
997
|
+
}
|
|
998
|
+
return sign * parseInt(value, 10);
|
|
999
|
+
}
|
|
1000
|
+
function constructYamlInteger(data) {
|
|
1001
|
+
return parseYamlInteger(data);
|
|
1002
|
+
}
|
|
1003
|
+
function isInteger(object) {
|
|
1004
|
+
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 === 0 && !common.isNegativeZero(object));
|
|
1005
|
+
}
|
|
1006
|
+
module.exports = new Type("tag:yaml.org,2002:int", {
|
|
1007
|
+
kind: "scalar",
|
|
1008
|
+
resolve: resolveYamlInteger,
|
|
1009
|
+
construct: constructYamlInteger,
|
|
1010
|
+
predicate: isInteger,
|
|
1011
|
+
represent: {
|
|
1012
|
+
binary: function(obj) {
|
|
1013
|
+
return obj >= 0 ? "0b" + obj.toString(2) : "-0b" + obj.toString(2).slice(1);
|
|
1014
|
+
},
|
|
1015
|
+
octal: function(obj) {
|
|
1016
|
+
return obj >= 0 ? "0o" + obj.toString(8) : "-0o" + obj.toString(8).slice(1);
|
|
1017
|
+
},
|
|
1018
|
+
decimal: function(obj) {
|
|
1019
|
+
return obj.toString(10);
|
|
1020
|
+
},
|
|
1021
|
+
hexadecimal: function(obj) {
|
|
1022
|
+
return obj >= 0 ? "0x" + obj.toString(16).toUpperCase() : "-0x" + obj.toString(16).toUpperCase().slice(1);
|
|
1023
|
+
}
|
|
1024
|
+
},
|
|
1025
|
+
defaultStyle: "decimal",
|
|
1026
|
+
styleAliases: {
|
|
1027
|
+
binary: [2, "bin"],
|
|
1028
|
+
octal: [8, "oct"],
|
|
1029
|
+
decimal: [10, "dec"],
|
|
1030
|
+
hexadecimal: [16, "hex"]
|
|
1031
|
+
}
|
|
1032
|
+
});
|
|
1033
|
+
}
|
|
1034
|
+
});
|
|
1035
|
+
|
|
1036
|
+
// node_modules/js-yaml/lib/type/float.js
|
|
1037
|
+
var require_float = __commonJS({
|
|
1038
|
+
"node_modules/js-yaml/lib/type/float.js"(exports, module) {
|
|
1039
|
+
"use strict";
|
|
1040
|
+
var common = require_common();
|
|
1041
|
+
var Type = require_type();
|
|
1042
|
+
var YAML_FLOAT_PATTERN = new RegExp(
|
|
1043
|
+
// 2.5e4, 2.5 and integers
|
|
1044
|
+
"^(?:[-+]?(?:[0-9]+)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"
|
|
1045
|
+
);
|
|
1046
|
+
var YAML_FLOAT_SPECIAL_PATTERN = new RegExp(
|
|
1047
|
+
"^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"
|
|
1048
|
+
);
|
|
1049
|
+
function resolveYamlFloat(data) {
|
|
1050
|
+
if (data === null) return false;
|
|
1051
|
+
if (!YAML_FLOAT_PATTERN.test(data)) {
|
|
1052
|
+
return false;
|
|
1053
|
+
}
|
|
1054
|
+
if (isFinite(parseFloat(data, 10))) {
|
|
1055
|
+
return true;
|
|
1056
|
+
}
|
|
1057
|
+
return YAML_FLOAT_SPECIAL_PATTERN.test(data);
|
|
1058
|
+
}
|
|
1059
|
+
function constructYamlFloat(data) {
|
|
1060
|
+
let value = data.toLowerCase();
|
|
1061
|
+
const sign = value[0] === "-" ? -1 : 1;
|
|
1062
|
+
if ("+-".indexOf(value[0]) >= 0) {
|
|
1063
|
+
value = value.slice(1);
|
|
1064
|
+
}
|
|
1065
|
+
if (value === ".inf") {
|
|
1066
|
+
return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
|
|
1067
|
+
} else if (value === ".nan") {
|
|
1068
|
+
return NaN;
|
|
1069
|
+
}
|
|
1070
|
+
return sign * parseFloat(value, 10);
|
|
1071
|
+
}
|
|
1072
|
+
var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
|
|
1073
|
+
function representYamlFloat(object, style) {
|
|
1074
|
+
if (isNaN(object)) {
|
|
1075
|
+
switch (style) {
|
|
1076
|
+
case "lowercase":
|
|
1077
|
+
return ".nan";
|
|
1078
|
+
case "uppercase":
|
|
1079
|
+
return ".NAN";
|
|
1080
|
+
case "camelcase":
|
|
1081
|
+
return ".NaN";
|
|
1082
|
+
}
|
|
1083
|
+
} else if (Number.POSITIVE_INFINITY === object) {
|
|
1084
|
+
switch (style) {
|
|
1085
|
+
case "lowercase":
|
|
1086
|
+
return ".inf";
|
|
1087
|
+
case "uppercase":
|
|
1088
|
+
return ".INF";
|
|
1089
|
+
case "camelcase":
|
|
1090
|
+
return ".Inf";
|
|
1091
|
+
}
|
|
1092
|
+
} else if (Number.NEGATIVE_INFINITY === object) {
|
|
1093
|
+
switch (style) {
|
|
1094
|
+
case "lowercase":
|
|
1095
|
+
return "-.inf";
|
|
1096
|
+
case "uppercase":
|
|
1097
|
+
return "-.INF";
|
|
1098
|
+
case "camelcase":
|
|
1099
|
+
return "-.Inf";
|
|
1100
|
+
}
|
|
1101
|
+
} else if (common.isNegativeZero(object)) {
|
|
1102
|
+
return "-0.0";
|
|
1103
|
+
}
|
|
1104
|
+
const res = object.toString(10);
|
|
1105
|
+
return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res;
|
|
1106
|
+
}
|
|
1107
|
+
function isFloat(object) {
|
|
1108
|
+
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || common.isNegativeZero(object));
|
|
1109
|
+
}
|
|
1110
|
+
module.exports = new Type("tag:yaml.org,2002:float", {
|
|
1111
|
+
kind: "scalar",
|
|
1112
|
+
resolve: resolveYamlFloat,
|
|
1113
|
+
construct: constructYamlFloat,
|
|
1114
|
+
predicate: isFloat,
|
|
1115
|
+
represent: representYamlFloat,
|
|
1116
|
+
defaultStyle: "lowercase"
|
|
1117
|
+
});
|
|
1118
|
+
}
|
|
1119
|
+
});
|
|
1120
|
+
|
|
1121
|
+
// node_modules/js-yaml/lib/schema/json.js
|
|
1122
|
+
var require_json = __commonJS({
|
|
1123
|
+
"node_modules/js-yaml/lib/schema/json.js"(exports, module) {
|
|
1124
|
+
"use strict";
|
|
1125
|
+
module.exports = require_failsafe().extend({
|
|
1126
|
+
implicit: [
|
|
1127
|
+
require_null(),
|
|
1128
|
+
require_bool(),
|
|
1129
|
+
require_int(),
|
|
1130
|
+
require_float()
|
|
1131
|
+
]
|
|
1132
|
+
});
|
|
1133
|
+
}
|
|
1134
|
+
});
|
|
1135
|
+
|
|
1136
|
+
// node_modules/js-yaml/lib/schema/core.js
|
|
1137
|
+
var require_core = __commonJS({
|
|
1138
|
+
"node_modules/js-yaml/lib/schema/core.js"(exports, module) {
|
|
1139
|
+
"use strict";
|
|
1140
|
+
module.exports = require_json();
|
|
1141
|
+
}
|
|
1142
|
+
});
|
|
1143
|
+
|
|
1144
|
+
// node_modules/js-yaml/lib/type/timestamp.js
|
|
1145
|
+
var require_timestamp = __commonJS({
|
|
1146
|
+
"node_modules/js-yaml/lib/type/timestamp.js"(exports, module) {
|
|
1147
|
+
"use strict";
|
|
1148
|
+
var Type = require_type();
|
|
1149
|
+
var YAML_DATE_REGEXP = new RegExp(
|
|
1150
|
+
"^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"
|
|
1151
|
+
);
|
|
1152
|
+
var YAML_TIMESTAMP_REGEXP = new RegExp(
|
|
1153
|
+
"^([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]))?))?$"
|
|
1154
|
+
);
|
|
1155
|
+
function resolveYamlTimestamp(data) {
|
|
1156
|
+
if (data === null) return false;
|
|
1157
|
+
if (YAML_DATE_REGEXP.exec(data) !== null) return true;
|
|
1158
|
+
if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true;
|
|
1159
|
+
return false;
|
|
1160
|
+
}
|
|
1161
|
+
function constructYamlTimestamp(data) {
|
|
1162
|
+
let fraction = 0;
|
|
1163
|
+
let delta = null;
|
|
1164
|
+
let match = YAML_DATE_REGEXP.exec(data);
|
|
1165
|
+
if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data);
|
|
1166
|
+
if (match === null) throw new Error("Date resolve error");
|
|
1167
|
+
const year = +match[1];
|
|
1168
|
+
const month = +match[2] - 1;
|
|
1169
|
+
const day = +match[3];
|
|
1170
|
+
if (!match[4]) {
|
|
1171
|
+
return new Date(Date.UTC(year, month, day));
|
|
1172
|
+
}
|
|
1173
|
+
const hour = +match[4];
|
|
1174
|
+
const minute = +match[5];
|
|
1175
|
+
const second = +match[6];
|
|
1176
|
+
if (match[7]) {
|
|
1177
|
+
fraction = match[7].slice(0, 3);
|
|
1178
|
+
while (fraction.length < 3) {
|
|
1179
|
+
fraction += "0";
|
|
1180
|
+
}
|
|
1181
|
+
fraction = +fraction;
|
|
1182
|
+
}
|
|
1183
|
+
if (match[9]) {
|
|
1184
|
+
const tzHour = +match[10];
|
|
1185
|
+
const tzMinute = +(match[11] || 0);
|
|
1186
|
+
delta = (tzHour * 60 + tzMinute) * 6e4;
|
|
1187
|
+
if (match[9] === "-") delta = -delta;
|
|
1188
|
+
}
|
|
1189
|
+
const date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
|
|
1190
|
+
if (delta) date.setTime(date.getTime() - delta);
|
|
1191
|
+
return date;
|
|
1192
|
+
}
|
|
1193
|
+
function representYamlTimestamp(object) {
|
|
1194
|
+
return object.toISOString();
|
|
1195
|
+
}
|
|
1196
|
+
module.exports = new Type("tag:yaml.org,2002:timestamp", {
|
|
1197
|
+
kind: "scalar",
|
|
1198
|
+
resolve: resolveYamlTimestamp,
|
|
1199
|
+
construct: constructYamlTimestamp,
|
|
1200
|
+
instanceOf: Date,
|
|
1201
|
+
represent: representYamlTimestamp
|
|
1202
|
+
});
|
|
1203
|
+
}
|
|
1204
|
+
});
|
|
1205
|
+
|
|
1206
|
+
// node_modules/js-yaml/lib/type/merge.js
|
|
1207
|
+
var require_merge = __commonJS({
|
|
1208
|
+
"node_modules/js-yaml/lib/type/merge.js"(exports, module) {
|
|
1209
|
+
"use strict";
|
|
1210
|
+
var Type = require_type();
|
|
1211
|
+
function resolveYamlMerge(data) {
|
|
1212
|
+
return data === "<<" || data === null;
|
|
1213
|
+
}
|
|
1214
|
+
module.exports = new Type("tag:yaml.org,2002:merge", {
|
|
1215
|
+
kind: "scalar",
|
|
1216
|
+
resolve: resolveYamlMerge
|
|
1217
|
+
});
|
|
1218
|
+
}
|
|
1219
|
+
});
|
|
1220
|
+
|
|
1221
|
+
// node_modules/js-yaml/lib/type/binary.js
|
|
1222
|
+
var require_binary = __commonJS({
|
|
1223
|
+
"node_modules/js-yaml/lib/type/binary.js"(exports, module) {
|
|
1224
|
+
"use strict";
|
|
1225
|
+
var Type = require_type();
|
|
1226
|
+
var BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";
|
|
1227
|
+
function resolveYamlBinary(data) {
|
|
1228
|
+
if (data === null) return false;
|
|
1229
|
+
let bitlen = 0;
|
|
1230
|
+
const max = data.length;
|
|
1231
|
+
const map = BASE64_MAP;
|
|
1232
|
+
for (let idx = 0; idx < max; idx++) {
|
|
1233
|
+
const code = map.indexOf(data.charAt(idx));
|
|
1234
|
+
if (code > 64) continue;
|
|
1235
|
+
if (code < 0) return false;
|
|
1236
|
+
bitlen += 6;
|
|
1237
|
+
}
|
|
1238
|
+
return bitlen % 8 === 0;
|
|
1239
|
+
}
|
|
1240
|
+
function constructYamlBinary(data) {
|
|
1241
|
+
const input = data.replace(/[\r\n=]/g, "");
|
|
1242
|
+
const max = input.length;
|
|
1243
|
+
const map = BASE64_MAP;
|
|
1244
|
+
let bits = 0;
|
|
1245
|
+
const result = [];
|
|
1246
|
+
for (let idx = 0; idx < max; idx++) {
|
|
1247
|
+
if (idx % 4 === 0 && idx) {
|
|
1248
|
+
result.push(bits >> 16 & 255);
|
|
1249
|
+
result.push(bits >> 8 & 255);
|
|
1250
|
+
result.push(bits & 255);
|
|
1251
|
+
}
|
|
1252
|
+
bits = bits << 6 | map.indexOf(input.charAt(idx));
|
|
1253
|
+
}
|
|
1254
|
+
const tailbits = max % 4 * 6;
|
|
1255
|
+
if (tailbits === 0) {
|
|
1256
|
+
result.push(bits >> 16 & 255);
|
|
1257
|
+
result.push(bits >> 8 & 255);
|
|
1258
|
+
result.push(bits & 255);
|
|
1259
|
+
} else if (tailbits === 18) {
|
|
1260
|
+
result.push(bits >> 10 & 255);
|
|
1261
|
+
result.push(bits >> 2 & 255);
|
|
1262
|
+
} else if (tailbits === 12) {
|
|
1263
|
+
result.push(bits >> 4 & 255);
|
|
1264
|
+
}
|
|
1265
|
+
return new Uint8Array(result);
|
|
1266
|
+
}
|
|
1267
|
+
function representYamlBinary(object) {
|
|
1268
|
+
let result = "";
|
|
1269
|
+
let bits = 0;
|
|
1270
|
+
const max = object.length;
|
|
1271
|
+
const map = BASE64_MAP;
|
|
1272
|
+
for (let idx = 0; idx < max; idx++) {
|
|
1273
|
+
if (idx % 3 === 0 && idx) {
|
|
1274
|
+
result += map[bits >> 18 & 63];
|
|
1275
|
+
result += map[bits >> 12 & 63];
|
|
1276
|
+
result += map[bits >> 6 & 63];
|
|
1277
|
+
result += map[bits & 63];
|
|
1278
|
+
}
|
|
1279
|
+
bits = (bits << 8) + object[idx];
|
|
1280
|
+
}
|
|
1281
|
+
const tail = max % 3;
|
|
1282
|
+
if (tail === 0) {
|
|
1283
|
+
result += map[bits >> 18 & 63];
|
|
1284
|
+
result += map[bits >> 12 & 63];
|
|
1285
|
+
result += map[bits >> 6 & 63];
|
|
1286
|
+
result += map[bits & 63];
|
|
1287
|
+
} else if (tail === 2) {
|
|
1288
|
+
result += map[bits >> 10 & 63];
|
|
1289
|
+
result += map[bits >> 4 & 63];
|
|
1290
|
+
result += map[bits << 2 & 63];
|
|
1291
|
+
result += map[64];
|
|
1292
|
+
} else if (tail === 1) {
|
|
1293
|
+
result += map[bits >> 2 & 63];
|
|
1294
|
+
result += map[bits << 4 & 63];
|
|
1295
|
+
result += map[64];
|
|
1296
|
+
result += map[64];
|
|
1297
|
+
}
|
|
1298
|
+
return result;
|
|
1299
|
+
}
|
|
1300
|
+
function isBinary(obj) {
|
|
1301
|
+
return Object.prototype.toString.call(obj) === "[object Uint8Array]";
|
|
1302
|
+
}
|
|
1303
|
+
module.exports = new Type("tag:yaml.org,2002:binary", {
|
|
1304
|
+
kind: "scalar",
|
|
1305
|
+
resolve: resolveYamlBinary,
|
|
1306
|
+
construct: constructYamlBinary,
|
|
1307
|
+
predicate: isBinary,
|
|
1308
|
+
represent: representYamlBinary
|
|
1309
|
+
});
|
|
1310
|
+
}
|
|
1311
|
+
});
|
|
1312
|
+
|
|
1313
|
+
// node_modules/js-yaml/lib/type/omap.js
|
|
1314
|
+
var require_omap = __commonJS({
|
|
1315
|
+
"node_modules/js-yaml/lib/type/omap.js"(exports, module) {
|
|
1316
|
+
"use strict";
|
|
1317
|
+
var Type = require_type();
|
|
1318
|
+
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
1319
|
+
var _toString = Object.prototype.toString;
|
|
1320
|
+
function resolveYamlOmap(data) {
|
|
1321
|
+
if (data === null) return true;
|
|
1322
|
+
const objectKeys = {};
|
|
1323
|
+
const object = data;
|
|
1324
|
+
for (let index = 0, length = object.length; index < length; index += 1) {
|
|
1325
|
+
const pair = object[index];
|
|
1326
|
+
let pairHasKey = false;
|
|
1327
|
+
if (_toString.call(pair) !== "[object Object]") return false;
|
|
1328
|
+
let pairKey;
|
|
1329
|
+
for (pairKey in pair) {
|
|
1330
|
+
if (_hasOwnProperty.call(pair, pairKey)) {
|
|
1331
|
+
if (!pairHasKey) pairHasKey = true;
|
|
1332
|
+
else return false;
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
if (!pairHasKey) return false;
|
|
1336
|
+
if (_hasOwnProperty.call(objectKeys, pairKey)) return false;
|
|
1337
|
+
Object.defineProperty(objectKeys, pairKey, { value: true });
|
|
1338
|
+
}
|
|
1339
|
+
return true;
|
|
1340
|
+
}
|
|
1341
|
+
function constructYamlOmap(data) {
|
|
1342
|
+
return data !== null ? data : [];
|
|
1343
|
+
}
|
|
1344
|
+
module.exports = new Type("tag:yaml.org,2002:omap", {
|
|
1345
|
+
kind: "sequence",
|
|
1346
|
+
resolve: resolveYamlOmap,
|
|
1347
|
+
construct: constructYamlOmap
|
|
1348
|
+
});
|
|
1349
|
+
}
|
|
1350
|
+
});
|
|
1351
|
+
|
|
1352
|
+
// node_modules/js-yaml/lib/type/pairs.js
|
|
1353
|
+
var require_pairs = __commonJS({
|
|
1354
|
+
"node_modules/js-yaml/lib/type/pairs.js"(exports, module) {
|
|
1355
|
+
"use strict";
|
|
1356
|
+
var Type = require_type();
|
|
1357
|
+
var _toString = Object.prototype.toString;
|
|
1358
|
+
function resolveYamlPairs(data) {
|
|
1359
|
+
if (data === null) return true;
|
|
1360
|
+
const object = data;
|
|
1361
|
+
const result = new Array(object.length);
|
|
1362
|
+
for (let index = 0, length = object.length; index < length; index += 1) {
|
|
1363
|
+
const pair = object[index];
|
|
1364
|
+
if (_toString.call(pair) !== "[object Object]") return false;
|
|
1365
|
+
const keys = Object.keys(pair);
|
|
1366
|
+
if (keys.length !== 1) return false;
|
|
1367
|
+
result[index] = [keys[0], pair[keys[0]]];
|
|
1368
|
+
}
|
|
1369
|
+
return true;
|
|
1370
|
+
}
|
|
1371
|
+
function constructYamlPairs(data) {
|
|
1372
|
+
if (data === null) return [];
|
|
1373
|
+
const object = data;
|
|
1374
|
+
const result = new Array(object.length);
|
|
1375
|
+
for (let index = 0, length = object.length; index < length; index += 1) {
|
|
1376
|
+
const pair = object[index];
|
|
1377
|
+
const keys = Object.keys(pair);
|
|
1378
|
+
result[index] = [keys[0], pair[keys[0]]];
|
|
1379
|
+
}
|
|
1380
|
+
return result;
|
|
1381
|
+
}
|
|
1382
|
+
module.exports = new Type("tag:yaml.org,2002:pairs", {
|
|
1383
|
+
kind: "sequence",
|
|
1384
|
+
resolve: resolveYamlPairs,
|
|
1385
|
+
construct: constructYamlPairs
|
|
1386
|
+
});
|
|
1387
|
+
}
|
|
1388
|
+
});
|
|
1389
|
+
|
|
1390
|
+
// node_modules/js-yaml/lib/type/set.js
|
|
1391
|
+
var require_set = __commonJS({
|
|
1392
|
+
"node_modules/js-yaml/lib/type/set.js"(exports, module) {
|
|
1393
|
+
"use strict";
|
|
1394
|
+
var Type = require_type();
|
|
1395
|
+
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
1396
|
+
function resolveYamlSet(data) {
|
|
1397
|
+
if (data === null) return true;
|
|
1398
|
+
const object = data;
|
|
1399
|
+
for (const key in object) {
|
|
1400
|
+
if (_hasOwnProperty.call(object, key)) {
|
|
1401
|
+
if (object[key] !== null) return false;
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
return true;
|
|
1405
|
+
}
|
|
1406
|
+
function constructYamlSet(data) {
|
|
1407
|
+
return data !== null ? data : {};
|
|
1408
|
+
}
|
|
1409
|
+
module.exports = new Type("tag:yaml.org,2002:set", {
|
|
1410
|
+
kind: "mapping",
|
|
1411
|
+
resolve: resolveYamlSet,
|
|
1412
|
+
construct: constructYamlSet
|
|
1413
|
+
});
|
|
1414
|
+
}
|
|
1415
|
+
});
|
|
1416
|
+
|
|
1417
|
+
// node_modules/js-yaml/lib/schema/default.js
|
|
1418
|
+
var require_default = __commonJS({
|
|
1419
|
+
"node_modules/js-yaml/lib/schema/default.js"(exports, module) {
|
|
1420
|
+
"use strict";
|
|
1421
|
+
module.exports = require_core().extend({
|
|
1422
|
+
implicit: [
|
|
1423
|
+
require_timestamp(),
|
|
1424
|
+
require_merge()
|
|
1425
|
+
],
|
|
1426
|
+
explicit: [
|
|
1427
|
+
require_binary(),
|
|
1428
|
+
require_omap(),
|
|
1429
|
+
require_pairs(),
|
|
1430
|
+
require_set()
|
|
1431
|
+
]
|
|
1432
|
+
});
|
|
1433
|
+
}
|
|
1434
|
+
});
|
|
1435
|
+
|
|
1436
|
+
// node_modules/js-yaml/lib/loader.js
|
|
1437
|
+
var require_loader = __commonJS({
|
|
1438
|
+
"node_modules/js-yaml/lib/loader.js"(exports, module) {
|
|
1439
|
+
"use strict";
|
|
1440
|
+
var common = require_common();
|
|
1441
|
+
var YAMLException = require_exception();
|
|
1442
|
+
var makeSnippet = require_snippet();
|
|
1443
|
+
var DEFAULT_SCHEMA = require_default();
|
|
1444
|
+
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
1445
|
+
var CONTEXT_FLOW_IN = 1;
|
|
1446
|
+
var CONTEXT_FLOW_OUT = 2;
|
|
1447
|
+
var CONTEXT_BLOCK_IN = 3;
|
|
1448
|
+
var CONTEXT_BLOCK_OUT = 4;
|
|
1449
|
+
var CHOMPING_CLIP = 1;
|
|
1450
|
+
var CHOMPING_STRIP = 2;
|
|
1451
|
+
var CHOMPING_KEEP = 3;
|
|
1452
|
+
var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
|
|
1453
|
+
var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
|
|
1454
|
+
var PATTERN_FLOW_INDICATORS = /[,\[\]{}]/;
|
|
1455
|
+
var PATTERN_TAG_HANDLE = /^(?:!|!!|![0-9A-Za-z-]+!)$/;
|
|
1456
|
+
var PATTERN_TAG_URI = /^(?:!|[^,\[\]{}])(?:%[0-9a-f]{2}|[0-9a-z\-#;/?:@&=+$,_.!~*'()\[\]])*$/i;
|
|
1457
|
+
function _class(obj) {
|
|
1458
|
+
return Object.prototype.toString.call(obj);
|
|
1459
|
+
}
|
|
1460
|
+
function isEol(c) {
|
|
1461
|
+
return c === 10 || c === 13;
|
|
1462
|
+
}
|
|
1463
|
+
function isWhiteSpace(c) {
|
|
1464
|
+
return c === 9 || c === 32;
|
|
1465
|
+
}
|
|
1466
|
+
function isWsOrEol(c) {
|
|
1467
|
+
return c === 9 || c === 32 || c === 10 || c === 13;
|
|
1468
|
+
}
|
|
1469
|
+
function isFlowIndicator(c) {
|
|
1470
|
+
return c === 44 || c === 91 || c === 93 || c === 123 || c === 125;
|
|
1471
|
+
}
|
|
1472
|
+
function fromHexCode(c) {
|
|
1473
|
+
if (c >= 48 && c <= 57) {
|
|
1474
|
+
return c - 48;
|
|
1475
|
+
}
|
|
1476
|
+
const lc = c | 32;
|
|
1477
|
+
if (lc >= 97 && lc <= 102) {
|
|
1478
|
+
return lc - 97 + 10;
|
|
1479
|
+
}
|
|
1480
|
+
return -1;
|
|
1481
|
+
}
|
|
1482
|
+
function escapedHexLen(c) {
|
|
1483
|
+
if (c === 120) {
|
|
1484
|
+
return 2;
|
|
1485
|
+
}
|
|
1486
|
+
if (c === 117) {
|
|
1487
|
+
return 4;
|
|
1488
|
+
}
|
|
1489
|
+
if (c === 85) {
|
|
1490
|
+
return 8;
|
|
1491
|
+
}
|
|
1492
|
+
return 0;
|
|
1493
|
+
}
|
|
1494
|
+
function fromDecimalCode(c) {
|
|
1495
|
+
if (c >= 48 && c <= 57) {
|
|
1496
|
+
return c - 48;
|
|
1497
|
+
}
|
|
1498
|
+
return -1;
|
|
1499
|
+
}
|
|
1500
|
+
function simpleEscapeSequence(c) {
|
|
1501
|
+
switch (c) {
|
|
1502
|
+
case 48:
|
|
1503
|
+
return "\0";
|
|
1504
|
+
case 97:
|
|
1505
|
+
return "\x07";
|
|
1506
|
+
case 98:
|
|
1507
|
+
return "\b";
|
|
1508
|
+
case 116:
|
|
1509
|
+
return " ";
|
|
1510
|
+
case 9:
|
|
1511
|
+
return " ";
|
|
1512
|
+
case 110:
|
|
1513
|
+
return "\n";
|
|
1514
|
+
case 118:
|
|
1515
|
+
return "\v";
|
|
1516
|
+
case 102:
|
|
1517
|
+
return "\f";
|
|
1518
|
+
case 114:
|
|
1519
|
+
return "\r";
|
|
1520
|
+
case 101:
|
|
1521
|
+
return "\x1B";
|
|
1522
|
+
case 32:
|
|
1523
|
+
return " ";
|
|
1524
|
+
case 34:
|
|
1525
|
+
return '"';
|
|
1526
|
+
case 47:
|
|
1527
|
+
return "/";
|
|
1528
|
+
case 92:
|
|
1529
|
+
return "\\";
|
|
1530
|
+
case 78:
|
|
1531
|
+
return "\x85";
|
|
1532
|
+
case 95:
|
|
1533
|
+
return "\xA0";
|
|
1534
|
+
case 76:
|
|
1535
|
+
return "\u2028";
|
|
1536
|
+
case 80:
|
|
1537
|
+
return "\u2029";
|
|
1538
|
+
default:
|
|
1539
|
+
return "";
|
|
1540
|
+
}
|
|
1541
|
+
}
|
|
1542
|
+
function charFromCodepoint(c) {
|
|
1543
|
+
if (c <= 65535) {
|
|
1544
|
+
return String.fromCharCode(c);
|
|
1545
|
+
}
|
|
1546
|
+
return String.fromCharCode(
|
|
1547
|
+
(c - 65536 >> 10) + 55296,
|
|
1548
|
+
(c - 65536 & 1023) + 56320
|
|
1549
|
+
);
|
|
1550
|
+
}
|
|
1551
|
+
function setProperty(object, key, value) {
|
|
1552
|
+
if (key === "__proto__") {
|
|
1553
|
+
Object.defineProperty(object, key, {
|
|
1554
|
+
configurable: true,
|
|
1555
|
+
enumerable: true,
|
|
1556
|
+
writable: true,
|
|
1557
|
+
value
|
|
1558
|
+
});
|
|
1559
|
+
} else {
|
|
1560
|
+
object[key] = value;
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
var simpleEscapeCheck = new Array(256);
|
|
1564
|
+
var simpleEscapeMap = new Array(256);
|
|
1565
|
+
for (let i = 0; i < 256; i++) {
|
|
1566
|
+
simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
|
|
1567
|
+
simpleEscapeMap[i] = simpleEscapeSequence(i);
|
|
1568
|
+
}
|
|
1569
|
+
function State(input, options) {
|
|
1570
|
+
this.input = input;
|
|
1571
|
+
this.filename = options["filename"] || null;
|
|
1572
|
+
this.schema = options["schema"] || DEFAULT_SCHEMA;
|
|
1573
|
+
this.onWarning = options["onWarning"] || null;
|
|
1574
|
+
this.legacy = options["legacy"] || false;
|
|
1575
|
+
this.json = options["json"] || false;
|
|
1576
|
+
this.listener = options["listener"] || null;
|
|
1577
|
+
this.maxDepth = typeof options["maxDepth"] === "number" ? options["maxDepth"] : 100;
|
|
1578
|
+
this.maxTotalMergeKeys = typeof options["maxTotalMergeKeys"] === "number" ? options["maxTotalMergeKeys"] : 1e4;
|
|
1579
|
+
this.implicitTypes = this.schema.compiledImplicit;
|
|
1580
|
+
this.typeMap = this.schema.compiledTypeMap;
|
|
1581
|
+
this.length = input.length;
|
|
1582
|
+
this.position = 0;
|
|
1583
|
+
this.line = 0;
|
|
1584
|
+
this.lineStart = 0;
|
|
1585
|
+
this.lineIndent = 0;
|
|
1586
|
+
this.depth = 0;
|
|
1587
|
+
this.totalMergeKeys = 0;
|
|
1588
|
+
this.firstTabInLine = -1;
|
|
1589
|
+
this.documents = [];
|
|
1590
|
+
this.anchorMapTransactions = [];
|
|
1591
|
+
}
|
|
1592
|
+
function generateError(state, message) {
|
|
1593
|
+
const mark = {
|
|
1594
|
+
name: state.filename,
|
|
1595
|
+
buffer: state.input.slice(0, -1),
|
|
1596
|
+
// omit trailing \0
|
|
1597
|
+
position: state.position,
|
|
1598
|
+
line: state.line,
|
|
1599
|
+
column: state.position - state.lineStart
|
|
1600
|
+
};
|
|
1601
|
+
mark.snippet = makeSnippet(mark);
|
|
1602
|
+
return new YAMLException(message, mark);
|
|
1603
|
+
}
|
|
1604
|
+
function throwError(state, message) {
|
|
1605
|
+
throw generateError(state, message);
|
|
1606
|
+
}
|
|
1607
|
+
function throwWarning(state, message) {
|
|
1608
|
+
if (state.onWarning) {
|
|
1609
|
+
state.onWarning.call(null, generateError(state, message));
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
function storeAnchor(state, name, value) {
|
|
1613
|
+
const transactions = state.anchorMapTransactions;
|
|
1614
|
+
if (transactions.length !== 0) {
|
|
1615
|
+
const transaction = transactions[transactions.length - 1];
|
|
1616
|
+
if (!_hasOwnProperty.call(transaction, name)) {
|
|
1617
|
+
transaction[name] = {
|
|
1618
|
+
existed: _hasOwnProperty.call(state.anchorMap, name),
|
|
1619
|
+
value: state.anchorMap[name]
|
|
1620
|
+
};
|
|
1621
|
+
}
|
|
1622
|
+
}
|
|
1623
|
+
state.anchorMap[name] = value;
|
|
1624
|
+
}
|
|
1625
|
+
function beginAnchorTransaction(state) {
|
|
1626
|
+
state.anchorMapTransactions.push(/* @__PURE__ */ Object.create(null));
|
|
1627
|
+
}
|
|
1628
|
+
function commitAnchorTransaction(state) {
|
|
1629
|
+
const transaction = state.anchorMapTransactions.pop();
|
|
1630
|
+
const transactions = state.anchorMapTransactions;
|
|
1631
|
+
if (transactions.length === 0) return;
|
|
1632
|
+
const parent = transactions[transactions.length - 1];
|
|
1633
|
+
const names = Object.keys(transaction);
|
|
1634
|
+
for (let index = 0, length = names.length; index < length; index += 1) {
|
|
1635
|
+
const name = names[index];
|
|
1636
|
+
if (!_hasOwnProperty.call(parent, name)) {
|
|
1637
|
+
parent[name] = transaction[name];
|
|
1638
|
+
}
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
function rollbackAnchorTransaction(state) {
|
|
1642
|
+
const transaction = state.anchorMapTransactions.pop();
|
|
1643
|
+
const names = Object.keys(transaction);
|
|
1644
|
+
for (let index = names.length - 1; index >= 0; index -= 1) {
|
|
1645
|
+
const entry = transaction[names[index]];
|
|
1646
|
+
if (entry.existed) {
|
|
1647
|
+
state.anchorMap[names[index]] = entry.value;
|
|
1648
|
+
} else {
|
|
1649
|
+
delete state.anchorMap[names[index]];
|
|
1650
|
+
}
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1653
|
+
function snapshotState(state) {
|
|
1654
|
+
return {
|
|
1655
|
+
position: state.position,
|
|
1656
|
+
line: state.line,
|
|
1657
|
+
lineStart: state.lineStart,
|
|
1658
|
+
lineIndent: state.lineIndent,
|
|
1659
|
+
firstTabInLine: state.firstTabInLine,
|
|
1660
|
+
tag: state.tag,
|
|
1661
|
+
anchor: state.anchor,
|
|
1662
|
+
kind: state.kind,
|
|
1663
|
+
result: state.result
|
|
1664
|
+
};
|
|
1665
|
+
}
|
|
1666
|
+
function restoreState(state, snapshot) {
|
|
1667
|
+
state.position = snapshot.position;
|
|
1668
|
+
state.line = snapshot.line;
|
|
1669
|
+
state.lineStart = snapshot.lineStart;
|
|
1670
|
+
state.lineIndent = snapshot.lineIndent;
|
|
1671
|
+
state.firstTabInLine = snapshot.firstTabInLine;
|
|
1672
|
+
state.tag = snapshot.tag;
|
|
1673
|
+
state.anchor = snapshot.anchor;
|
|
1674
|
+
state.kind = snapshot.kind;
|
|
1675
|
+
state.result = snapshot.result;
|
|
1676
|
+
}
|
|
1677
|
+
var directiveHandlers = {
|
|
1678
|
+
YAML: function handleYamlDirective(state, name, args) {
|
|
1679
|
+
if (state.version !== null) {
|
|
1680
|
+
throwError(state, "duplication of %YAML directive");
|
|
1681
|
+
}
|
|
1682
|
+
if (args.length !== 1) {
|
|
1683
|
+
throwError(state, "YAML directive accepts exactly one argument");
|
|
1684
|
+
}
|
|
1685
|
+
const match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
|
|
1686
|
+
if (match === null) {
|
|
1687
|
+
throwError(state, "ill-formed argument of the YAML directive");
|
|
1688
|
+
}
|
|
1689
|
+
const major = parseInt(match[1], 10);
|
|
1690
|
+
const minor = parseInt(match[2], 10);
|
|
1691
|
+
if (major !== 1) {
|
|
1692
|
+
throwError(state, "unacceptable YAML version of the document");
|
|
1693
|
+
}
|
|
1694
|
+
state.version = args[0];
|
|
1695
|
+
state.checkLineBreaks = minor < 2;
|
|
1696
|
+
if (minor !== 1 && minor !== 2) {
|
|
1697
|
+
throwWarning(state, "unsupported YAML version of the document");
|
|
1698
|
+
}
|
|
1699
|
+
},
|
|
1700
|
+
TAG: function handleTagDirective(state, name, args) {
|
|
1701
|
+
let prefix;
|
|
1702
|
+
if (args.length !== 2) {
|
|
1703
|
+
throwError(state, "TAG directive accepts exactly two arguments");
|
|
1704
|
+
}
|
|
1705
|
+
const handle = args[0];
|
|
1706
|
+
prefix = args[1];
|
|
1707
|
+
if (!PATTERN_TAG_HANDLE.test(handle)) {
|
|
1708
|
+
throwError(state, "ill-formed tag handle (first argument) of the TAG directive");
|
|
1709
|
+
}
|
|
1710
|
+
if (_hasOwnProperty.call(state.tagMap, handle)) {
|
|
1711
|
+
throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
|
|
1712
|
+
}
|
|
1713
|
+
if (!PATTERN_TAG_URI.test(prefix)) {
|
|
1714
|
+
throwError(state, "ill-formed tag prefix (second argument) of the TAG directive");
|
|
1715
|
+
}
|
|
1716
|
+
try {
|
|
1717
|
+
prefix = decodeURIComponent(prefix);
|
|
1718
|
+
} catch (err) {
|
|
1719
|
+
throwError(state, "tag prefix is malformed: " + prefix);
|
|
1720
|
+
}
|
|
1721
|
+
state.tagMap[handle] = prefix;
|
|
1722
|
+
}
|
|
1723
|
+
};
|
|
1724
|
+
function captureSegment(state, start, end, checkJson) {
|
|
1725
|
+
if (start < end) {
|
|
1726
|
+
const _result = state.input.slice(start, end);
|
|
1727
|
+
if (checkJson) {
|
|
1728
|
+
for (let _position = 0, _length = _result.length; _position < _length; _position += 1) {
|
|
1729
|
+
const _character = _result.charCodeAt(_position);
|
|
1730
|
+
if (!(_character === 9 || _character >= 32 && _character <= 1114111)) {
|
|
1731
|
+
throwError(state, "expected valid JSON character");
|
|
1732
|
+
}
|
|
1733
|
+
}
|
|
1734
|
+
} else if (PATTERN_NON_PRINTABLE.test(_result)) {
|
|
1735
|
+
throwError(state, "the stream contains non-printable characters");
|
|
1736
|
+
}
|
|
1737
|
+
state.result += _result;
|
|
1738
|
+
}
|
|
1739
|
+
}
|
|
1740
|
+
function chargeMergeWork(state) {
|
|
1741
|
+
state.totalMergeKeys++;
|
|
1742
|
+
if (state.maxTotalMergeKeys !== -1 && state.totalMergeKeys > state.maxTotalMergeKeys) {
|
|
1743
|
+
throwError(state, "merge keys exceeded maxTotalMergeKeys (" + state.maxTotalMergeKeys + ")");
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1746
|
+
function mergeMappings(state, destination, source, overridableKeys) {
|
|
1747
|
+
if (!common.isObject(source)) {
|
|
1748
|
+
throwError(state, "cannot merge mappings; the provided source object is unacceptable");
|
|
1749
|
+
}
|
|
1750
|
+
chargeMergeWork(state);
|
|
1751
|
+
const sourceKeys = Object.keys(source);
|
|
1752
|
+
for (let index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
|
|
1753
|
+
const key = sourceKeys[index];
|
|
1754
|
+
chargeMergeWork(state);
|
|
1755
|
+
if (!_hasOwnProperty.call(destination, key)) {
|
|
1756
|
+
setProperty(destination, key, source[key]);
|
|
1757
|
+
overridableKeys[key] = true;
|
|
1758
|
+
}
|
|
1759
|
+
}
|
|
1760
|
+
}
|
|
1761
|
+
function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startLineStart, startPos) {
|
|
1762
|
+
if (Array.isArray(keyNode)) {
|
|
1763
|
+
keyNode = Array.prototype.slice.call(keyNode);
|
|
1764
|
+
for (let index = 0, quantity = keyNode.length; index < quantity; index += 1) {
|
|
1765
|
+
if (Array.isArray(keyNode[index])) {
|
|
1766
|
+
throwError(state, "nested arrays are not supported inside keys");
|
|
1767
|
+
}
|
|
1768
|
+
if (typeof keyNode === "object" && _class(keyNode[index]) === "[object Object]") {
|
|
1769
|
+
keyNode[index] = "[object Object]";
|
|
1770
|
+
}
|
|
1771
|
+
}
|
|
1772
|
+
}
|
|
1773
|
+
if (typeof keyNode === "object" && _class(keyNode) === "[object Object]") {
|
|
1774
|
+
keyNode = "[object Object]";
|
|
1775
|
+
}
|
|
1776
|
+
keyNode = String(keyNode);
|
|
1777
|
+
if (_result === null) {
|
|
1778
|
+
_result = {};
|
|
1779
|
+
}
|
|
1780
|
+
if (keyTag === "tag:yaml.org,2002:merge") {
|
|
1781
|
+
if (Array.isArray(valueNode)) {
|
|
1782
|
+
if (valueNode.length > 100) {
|
|
1783
|
+
throwError(state, "abnormal merge sequence size");
|
|
1784
|
+
}
|
|
1785
|
+
for (let index = 0, quantity = valueNode.length; index < quantity; index += 1) {
|
|
1786
|
+
mergeMappings(state, _result, valueNode[index], overridableKeys);
|
|
1787
|
+
}
|
|
1788
|
+
} else {
|
|
1789
|
+
mergeMappings(state, _result, valueNode, overridableKeys);
|
|
1790
|
+
}
|
|
1791
|
+
} else {
|
|
1792
|
+
if (!state.json && !_hasOwnProperty.call(overridableKeys, keyNode) && _hasOwnProperty.call(_result, keyNode)) {
|
|
1793
|
+
state.line = startLine || state.line;
|
|
1794
|
+
state.lineStart = startLineStart || state.lineStart;
|
|
1795
|
+
state.position = startPos || state.position;
|
|
1796
|
+
throwError(state, "duplicated mapping key");
|
|
1797
|
+
}
|
|
1798
|
+
setProperty(_result, keyNode, valueNode);
|
|
1799
|
+
delete overridableKeys[keyNode];
|
|
1800
|
+
}
|
|
1801
|
+
return _result;
|
|
1802
|
+
}
|
|
1803
|
+
function readLineBreak(state) {
|
|
1804
|
+
const ch = state.input.charCodeAt(state.position);
|
|
1805
|
+
if (ch === 10) {
|
|
1806
|
+
state.position++;
|
|
1807
|
+
} else if (ch === 13) {
|
|
1808
|
+
state.position++;
|
|
1809
|
+
if (state.input.charCodeAt(state.position) === 10) {
|
|
1810
|
+
state.position++;
|
|
1811
|
+
}
|
|
1812
|
+
} else {
|
|
1813
|
+
throwError(state, "a line break is expected");
|
|
1814
|
+
}
|
|
1815
|
+
state.line += 1;
|
|
1816
|
+
state.lineStart = state.position;
|
|
1817
|
+
state.firstTabInLine = -1;
|
|
1818
|
+
}
|
|
1819
|
+
function skipSeparationSpace(state, allowComments, checkIndent) {
|
|
1820
|
+
let lineBreaks = 0;
|
|
1821
|
+
let ch = state.input.charCodeAt(state.position);
|
|
1822
|
+
while (ch !== 0) {
|
|
1823
|
+
while (isWhiteSpace(ch)) {
|
|
1824
|
+
if (ch === 9 && state.firstTabInLine === -1) {
|
|
1825
|
+
state.firstTabInLine = state.position;
|
|
1826
|
+
}
|
|
1827
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1828
|
+
}
|
|
1829
|
+
if (allowComments && ch === 35) {
|
|
1830
|
+
do {
|
|
1831
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1832
|
+
} while (ch !== 10 && ch !== 13 && ch !== 0);
|
|
1833
|
+
}
|
|
1834
|
+
if (isEol(ch)) {
|
|
1835
|
+
readLineBreak(state);
|
|
1836
|
+
ch = state.input.charCodeAt(state.position);
|
|
1837
|
+
lineBreaks++;
|
|
1838
|
+
state.lineIndent = 0;
|
|
1839
|
+
while (ch === 32) {
|
|
1840
|
+
state.lineIndent++;
|
|
1841
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1842
|
+
}
|
|
1843
|
+
} else {
|
|
1844
|
+
break;
|
|
1845
|
+
}
|
|
1846
|
+
}
|
|
1847
|
+
if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {
|
|
1848
|
+
throwWarning(state, "deficient indentation");
|
|
1849
|
+
}
|
|
1850
|
+
return lineBreaks;
|
|
1851
|
+
}
|
|
1852
|
+
function testDocumentSeparator(state) {
|
|
1853
|
+
let _position = state.position;
|
|
1854
|
+
let ch = state.input.charCodeAt(_position);
|
|
1855
|
+
if ((ch === 45 || ch === 46) && ch === state.input.charCodeAt(_position + 1) && ch === state.input.charCodeAt(_position + 2)) {
|
|
1856
|
+
_position += 3;
|
|
1857
|
+
ch = state.input.charCodeAt(_position);
|
|
1858
|
+
if (ch === 0 || isWsOrEol(ch)) {
|
|
1859
|
+
return true;
|
|
1860
|
+
}
|
|
1861
|
+
}
|
|
1862
|
+
return false;
|
|
1863
|
+
}
|
|
1864
|
+
function writeFoldedLines(state, count) {
|
|
1865
|
+
if (count === 1) {
|
|
1866
|
+
state.result += " ";
|
|
1867
|
+
} else if (count > 1) {
|
|
1868
|
+
state.result += common.repeat("\n", count - 1);
|
|
1869
|
+
}
|
|
1870
|
+
}
|
|
1871
|
+
function readPlainScalar(state, nodeIndent, withinFlowCollection) {
|
|
1872
|
+
let captureStart;
|
|
1873
|
+
let captureEnd;
|
|
1874
|
+
let hasPendingContent;
|
|
1875
|
+
let _line;
|
|
1876
|
+
let _lineStart;
|
|
1877
|
+
let _lineIndent;
|
|
1878
|
+
const _kind = state.kind;
|
|
1879
|
+
const _result = state.result;
|
|
1880
|
+
let ch = state.input.charCodeAt(state.position);
|
|
1881
|
+
if (isWsOrEol(ch) || isFlowIndicator(ch) || ch === 35 || ch === 38 || ch === 42 || ch === 33 || ch === 124 || ch === 62 || ch === 39 || ch === 34 || ch === 37 || ch === 64 || ch === 96) {
|
|
1882
|
+
return false;
|
|
1883
|
+
}
|
|
1884
|
+
if (ch === 63 || ch === 45) {
|
|
1885
|
+
const following = state.input.charCodeAt(state.position + 1);
|
|
1886
|
+
if (isWsOrEol(following) || withinFlowCollection && isFlowIndicator(following)) {
|
|
1887
|
+
return false;
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
state.kind = "scalar";
|
|
1891
|
+
state.result = "";
|
|
1892
|
+
captureStart = captureEnd = state.position;
|
|
1893
|
+
hasPendingContent = false;
|
|
1894
|
+
while (ch !== 0) {
|
|
1895
|
+
if (ch === 58) {
|
|
1896
|
+
const following = state.input.charCodeAt(state.position + 1);
|
|
1897
|
+
if (isWsOrEol(following) || withinFlowCollection && isFlowIndicator(following)) {
|
|
1898
|
+
break;
|
|
1899
|
+
}
|
|
1900
|
+
} else if (ch === 35) {
|
|
1901
|
+
const preceding = state.input.charCodeAt(state.position - 1);
|
|
1902
|
+
if (isWsOrEol(preceding)) {
|
|
1903
|
+
break;
|
|
1904
|
+
}
|
|
1905
|
+
} else if (state.position === state.lineStart && testDocumentSeparator(state) || withinFlowCollection && isFlowIndicator(ch)) {
|
|
1906
|
+
break;
|
|
1907
|
+
} else if (isEol(ch)) {
|
|
1908
|
+
_line = state.line;
|
|
1909
|
+
_lineStart = state.lineStart;
|
|
1910
|
+
_lineIndent = state.lineIndent;
|
|
1911
|
+
skipSeparationSpace(state, false, -1);
|
|
1912
|
+
if (state.lineIndent >= nodeIndent) {
|
|
1913
|
+
hasPendingContent = true;
|
|
1914
|
+
ch = state.input.charCodeAt(state.position);
|
|
1915
|
+
continue;
|
|
1916
|
+
} else {
|
|
1917
|
+
state.position = captureEnd;
|
|
1918
|
+
state.line = _line;
|
|
1919
|
+
state.lineStart = _lineStart;
|
|
1920
|
+
state.lineIndent = _lineIndent;
|
|
1921
|
+
break;
|
|
1922
|
+
}
|
|
1923
|
+
}
|
|
1924
|
+
if (hasPendingContent) {
|
|
1925
|
+
captureSegment(state, captureStart, captureEnd, false);
|
|
1926
|
+
writeFoldedLines(state, state.line - _line);
|
|
1927
|
+
captureStart = captureEnd = state.position;
|
|
1928
|
+
hasPendingContent = false;
|
|
1929
|
+
}
|
|
1930
|
+
if (!isWhiteSpace(ch)) {
|
|
1931
|
+
captureEnd = state.position + 1;
|
|
1932
|
+
}
|
|
1933
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1934
|
+
}
|
|
1935
|
+
captureSegment(state, captureStart, captureEnd, false);
|
|
1936
|
+
if (state.result) {
|
|
1937
|
+
return true;
|
|
1938
|
+
}
|
|
1939
|
+
state.kind = _kind;
|
|
1940
|
+
state.result = _result;
|
|
1941
|
+
return false;
|
|
1942
|
+
}
|
|
1943
|
+
function readSingleQuotedScalar(state, nodeIndent) {
|
|
1944
|
+
let captureStart;
|
|
1945
|
+
let captureEnd;
|
|
1946
|
+
let ch = state.input.charCodeAt(state.position);
|
|
1947
|
+
if (ch !== 39) {
|
|
1948
|
+
return false;
|
|
1949
|
+
}
|
|
1950
|
+
state.kind = "scalar";
|
|
1951
|
+
state.result = "";
|
|
1952
|
+
state.position++;
|
|
1953
|
+
captureStart = captureEnd = state.position;
|
|
1954
|
+
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
1955
|
+
if (ch === 39) {
|
|
1956
|
+
captureSegment(state, captureStart, state.position, true);
|
|
1957
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1958
|
+
if (ch === 39) {
|
|
1959
|
+
captureStart = state.position;
|
|
1960
|
+
state.position++;
|
|
1961
|
+
captureEnd = state.position;
|
|
1962
|
+
} else {
|
|
1963
|
+
return true;
|
|
1964
|
+
}
|
|
1965
|
+
} else if (isEol(ch)) {
|
|
1966
|
+
captureSegment(state, captureStart, captureEnd, true);
|
|
1967
|
+
writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
|
|
1968
|
+
captureStart = captureEnd = state.position;
|
|
1969
|
+
} else if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
1970
|
+
throwError(state, "unexpected end of the document within a single quoted scalar");
|
|
1971
|
+
} else {
|
|
1972
|
+
state.position++;
|
|
1973
|
+
if (!isWhiteSpace(ch)) {
|
|
1974
|
+
captureEnd = state.position;
|
|
1975
|
+
}
|
|
1976
|
+
}
|
|
1977
|
+
}
|
|
1978
|
+
throwError(state, "unexpected end of the stream within a single quoted scalar");
|
|
1979
|
+
}
|
|
1980
|
+
function readDoubleQuotedScalar(state, nodeIndent) {
|
|
1981
|
+
let captureStart;
|
|
1982
|
+
let captureEnd;
|
|
1983
|
+
let tmp;
|
|
1984
|
+
let ch = state.input.charCodeAt(state.position);
|
|
1985
|
+
if (ch !== 34) {
|
|
1986
|
+
return false;
|
|
1987
|
+
}
|
|
1988
|
+
state.kind = "scalar";
|
|
1989
|
+
state.result = "";
|
|
1990
|
+
state.position++;
|
|
1991
|
+
captureStart = captureEnd = state.position;
|
|
1992
|
+
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
1993
|
+
if (ch === 34) {
|
|
1994
|
+
captureSegment(state, captureStart, state.position, true);
|
|
1995
|
+
state.position++;
|
|
1996
|
+
return true;
|
|
1997
|
+
} else if (ch === 92) {
|
|
1998
|
+
captureSegment(state, captureStart, state.position, true);
|
|
1999
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2000
|
+
if (isEol(ch)) {
|
|
2001
|
+
skipSeparationSpace(state, false, nodeIndent);
|
|
2002
|
+
} else if (ch < 256 && simpleEscapeCheck[ch]) {
|
|
2003
|
+
state.result += simpleEscapeMap[ch];
|
|
2004
|
+
state.position++;
|
|
2005
|
+
} else if ((tmp = escapedHexLen(ch)) > 0) {
|
|
2006
|
+
let hexLength = tmp;
|
|
2007
|
+
let hexResult = 0;
|
|
2008
|
+
for (; hexLength > 0; hexLength--) {
|
|
2009
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2010
|
+
if ((tmp = fromHexCode(ch)) >= 0) {
|
|
2011
|
+
hexResult = (hexResult << 4) + tmp;
|
|
2012
|
+
} else {
|
|
2013
|
+
throwError(state, "expected hexadecimal character");
|
|
2014
|
+
}
|
|
2015
|
+
}
|
|
2016
|
+
state.result += charFromCodepoint(hexResult);
|
|
2017
|
+
state.position++;
|
|
2018
|
+
} else {
|
|
2019
|
+
throwError(state, "unknown escape sequence");
|
|
2020
|
+
}
|
|
2021
|
+
captureStart = captureEnd = state.position;
|
|
2022
|
+
} else if (isEol(ch)) {
|
|
2023
|
+
captureSegment(state, captureStart, captureEnd, true);
|
|
2024
|
+
writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
|
|
2025
|
+
captureStart = captureEnd = state.position;
|
|
2026
|
+
} else if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
2027
|
+
throwError(state, "unexpected end of the document within a double quoted scalar");
|
|
2028
|
+
} else {
|
|
2029
|
+
state.position++;
|
|
2030
|
+
if (!isWhiteSpace(ch)) {
|
|
2031
|
+
captureEnd = state.position;
|
|
2032
|
+
}
|
|
2033
|
+
}
|
|
2034
|
+
}
|
|
2035
|
+
throwError(state, "unexpected end of the stream within a double quoted scalar");
|
|
2036
|
+
}
|
|
2037
|
+
function readFlowCollection(state, nodeIndent) {
|
|
2038
|
+
let readNext = true;
|
|
2039
|
+
let _line;
|
|
2040
|
+
let _lineStart;
|
|
2041
|
+
let _pos;
|
|
2042
|
+
const _tag = state.tag;
|
|
2043
|
+
let _result;
|
|
2044
|
+
const _anchor = state.anchor;
|
|
2045
|
+
let terminator;
|
|
2046
|
+
let isPair;
|
|
2047
|
+
let isExplicitPair;
|
|
2048
|
+
let isMapping;
|
|
2049
|
+
const overridableKeys = /* @__PURE__ */ Object.create(null);
|
|
2050
|
+
let keyNode;
|
|
2051
|
+
let keyTag;
|
|
2052
|
+
let valueNode;
|
|
2053
|
+
let ch = state.input.charCodeAt(state.position);
|
|
2054
|
+
if (ch === 91) {
|
|
2055
|
+
terminator = 93;
|
|
2056
|
+
isMapping = false;
|
|
2057
|
+
_result = [];
|
|
2058
|
+
} else if (ch === 123) {
|
|
2059
|
+
terminator = 125;
|
|
2060
|
+
isMapping = true;
|
|
2061
|
+
_result = {};
|
|
2062
|
+
} else {
|
|
2063
|
+
return false;
|
|
2064
|
+
}
|
|
2065
|
+
if (state.anchor !== null) {
|
|
2066
|
+
storeAnchor(state, state.anchor, _result);
|
|
2067
|
+
}
|
|
2068
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2069
|
+
while (ch !== 0) {
|
|
2070
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
2071
|
+
ch = state.input.charCodeAt(state.position);
|
|
2072
|
+
if (ch === terminator) {
|
|
2073
|
+
state.position++;
|
|
2074
|
+
state.tag = _tag;
|
|
2075
|
+
state.anchor = _anchor;
|
|
2076
|
+
state.kind = isMapping ? "mapping" : "sequence";
|
|
2077
|
+
state.result = _result;
|
|
2078
|
+
return true;
|
|
2079
|
+
} else if (!readNext) {
|
|
2080
|
+
throwError(state, "missed comma between flow collection entries");
|
|
2081
|
+
} else if (ch === 44) {
|
|
2082
|
+
throwError(state, "expected the node content, but found ','");
|
|
2083
|
+
}
|
|
2084
|
+
keyTag = keyNode = valueNode = null;
|
|
2085
|
+
isPair = isExplicitPair = false;
|
|
2086
|
+
if (ch === 63) {
|
|
2087
|
+
const following = state.input.charCodeAt(state.position + 1);
|
|
2088
|
+
if (isWsOrEol(following)) {
|
|
2089
|
+
isPair = isExplicitPair = true;
|
|
2090
|
+
state.position++;
|
|
2091
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
2092
|
+
}
|
|
2093
|
+
}
|
|
2094
|
+
_line = state.line;
|
|
2095
|
+
_lineStart = state.lineStart;
|
|
2096
|
+
_pos = state.position;
|
|
2097
|
+
composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
|
2098
|
+
keyTag = state.tag;
|
|
2099
|
+
keyNode = state.result;
|
|
2100
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
2101
|
+
ch = state.input.charCodeAt(state.position);
|
|
2102
|
+
if ((isExplicitPair || state.line === _line) && ch === 58) {
|
|
2103
|
+
isPair = true;
|
|
2104
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2105
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
2106
|
+
composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
|
2107
|
+
valueNode = state.result;
|
|
2108
|
+
}
|
|
2109
|
+
if (isMapping) {
|
|
2110
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos);
|
|
2111
|
+
} else if (isPair) {
|
|
2112
|
+
_result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos));
|
|
2113
|
+
} else {
|
|
2114
|
+
_result.push(keyNode);
|
|
2115
|
+
}
|
|
2116
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
2117
|
+
ch = state.input.charCodeAt(state.position);
|
|
2118
|
+
if (ch === 44) {
|
|
2119
|
+
readNext = true;
|
|
2120
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2121
|
+
} else {
|
|
2122
|
+
readNext = false;
|
|
2123
|
+
}
|
|
2124
|
+
}
|
|
2125
|
+
throwError(state, "unexpected end of the stream within a flow collection");
|
|
2126
|
+
}
|
|
2127
|
+
function readBlockScalar(state, nodeIndent) {
|
|
2128
|
+
let folding;
|
|
2129
|
+
let chomping = CHOMPING_CLIP;
|
|
2130
|
+
let didReadContent = false;
|
|
2131
|
+
let detectedIndent = false;
|
|
2132
|
+
let textIndent = nodeIndent;
|
|
2133
|
+
let emptyLines = 0;
|
|
2134
|
+
let atMoreIndented = false;
|
|
2135
|
+
let tmp;
|
|
2136
|
+
let ch = state.input.charCodeAt(state.position);
|
|
2137
|
+
if (ch === 124) {
|
|
2138
|
+
folding = false;
|
|
2139
|
+
} else if (ch === 62) {
|
|
2140
|
+
folding = true;
|
|
2141
|
+
} else {
|
|
2142
|
+
return false;
|
|
2143
|
+
}
|
|
2144
|
+
state.kind = "scalar";
|
|
2145
|
+
state.result = "";
|
|
2146
|
+
while (ch !== 0) {
|
|
2147
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2148
|
+
if (ch === 43 || ch === 45) {
|
|
2149
|
+
if (CHOMPING_CLIP === chomping) {
|
|
2150
|
+
chomping = ch === 43 ? CHOMPING_KEEP : CHOMPING_STRIP;
|
|
2151
|
+
} else {
|
|
2152
|
+
throwError(state, "repeat of a chomping mode identifier");
|
|
2153
|
+
}
|
|
2154
|
+
} else if ((tmp = fromDecimalCode(ch)) >= 0) {
|
|
2155
|
+
if (tmp === 0) {
|
|
2156
|
+
throwError(state, "bad explicit indentation width of a block scalar; it cannot be less than one");
|
|
2157
|
+
} else if (!detectedIndent) {
|
|
2158
|
+
textIndent = nodeIndent + tmp - 1;
|
|
2159
|
+
detectedIndent = true;
|
|
2160
|
+
} else {
|
|
2161
|
+
throwError(state, "repeat of an indentation width identifier");
|
|
2162
|
+
}
|
|
2163
|
+
} else {
|
|
2164
|
+
break;
|
|
2165
|
+
}
|
|
2166
|
+
}
|
|
2167
|
+
if (isWhiteSpace(ch)) {
|
|
2168
|
+
do {
|
|
2169
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2170
|
+
} while (isWhiteSpace(ch));
|
|
2171
|
+
if (ch === 35) {
|
|
2172
|
+
do {
|
|
2173
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2174
|
+
} while (!isEol(ch) && ch !== 0);
|
|
2175
|
+
}
|
|
2176
|
+
}
|
|
2177
|
+
while (ch !== 0) {
|
|
2178
|
+
readLineBreak(state);
|
|
2179
|
+
state.lineIndent = 0;
|
|
2180
|
+
ch = state.input.charCodeAt(state.position);
|
|
2181
|
+
while ((!detectedIndent || state.lineIndent < textIndent) && ch === 32) {
|
|
2182
|
+
state.lineIndent++;
|
|
2183
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2184
|
+
}
|
|
2185
|
+
if (!detectedIndent && state.lineIndent > textIndent) {
|
|
2186
|
+
textIndent = state.lineIndent;
|
|
2187
|
+
}
|
|
2188
|
+
if (isEol(ch)) {
|
|
2189
|
+
emptyLines++;
|
|
2190
|
+
continue;
|
|
2191
|
+
}
|
|
2192
|
+
if (!detectedIndent && textIndent === 0) {
|
|
2193
|
+
throwError(state, "missing indentation for block scalar");
|
|
2194
|
+
}
|
|
2195
|
+
if (state.lineIndent < textIndent) {
|
|
2196
|
+
if (chomping === CHOMPING_KEEP) {
|
|
2197
|
+
state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
|
2198
|
+
} else if (chomping === CHOMPING_CLIP) {
|
|
2199
|
+
if (didReadContent) {
|
|
2200
|
+
state.result += "\n";
|
|
2201
|
+
}
|
|
2202
|
+
}
|
|
2203
|
+
break;
|
|
2204
|
+
}
|
|
2205
|
+
if (folding) {
|
|
2206
|
+
if (isWhiteSpace(ch)) {
|
|
2207
|
+
atMoreIndented = true;
|
|
2208
|
+
state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
|
2209
|
+
} else if (atMoreIndented) {
|
|
2210
|
+
atMoreIndented = false;
|
|
2211
|
+
state.result += common.repeat("\n", emptyLines + 1);
|
|
2212
|
+
} else if (emptyLines === 0) {
|
|
2213
|
+
if (didReadContent) {
|
|
2214
|
+
state.result += " ";
|
|
2215
|
+
}
|
|
2216
|
+
} else {
|
|
2217
|
+
state.result += common.repeat("\n", emptyLines);
|
|
2218
|
+
}
|
|
2219
|
+
} else {
|
|
2220
|
+
state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
|
2221
|
+
}
|
|
2222
|
+
didReadContent = true;
|
|
2223
|
+
detectedIndent = true;
|
|
2224
|
+
emptyLines = 0;
|
|
2225
|
+
const captureStart = state.position;
|
|
2226
|
+
while (!isEol(ch) && ch !== 0) {
|
|
2227
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2228
|
+
}
|
|
2229
|
+
captureSegment(state, captureStart, state.position, false);
|
|
2230
|
+
}
|
|
2231
|
+
return true;
|
|
2232
|
+
}
|
|
2233
|
+
function readBlockSequence(state, nodeIndent) {
|
|
2234
|
+
const _tag = state.tag;
|
|
2235
|
+
const _anchor = state.anchor;
|
|
2236
|
+
const _result = [];
|
|
2237
|
+
let detected = false;
|
|
2238
|
+
if (state.firstTabInLine !== -1) return false;
|
|
2239
|
+
if (state.anchor !== null) {
|
|
2240
|
+
storeAnchor(state, state.anchor, _result);
|
|
2241
|
+
}
|
|
2242
|
+
let ch = state.input.charCodeAt(state.position);
|
|
2243
|
+
while (ch !== 0) {
|
|
2244
|
+
if (state.firstTabInLine !== -1) {
|
|
2245
|
+
state.position = state.firstTabInLine;
|
|
2246
|
+
throwError(state, "tab characters must not be used in indentation");
|
|
2247
|
+
}
|
|
2248
|
+
if (ch !== 45) {
|
|
2249
|
+
break;
|
|
2250
|
+
}
|
|
2251
|
+
const following = state.input.charCodeAt(state.position + 1);
|
|
2252
|
+
if (!isWsOrEol(following)) {
|
|
2253
|
+
break;
|
|
2254
|
+
}
|
|
2255
|
+
detected = true;
|
|
2256
|
+
state.position++;
|
|
2257
|
+
if (skipSeparationSpace(state, true, -1)) {
|
|
2258
|
+
if (state.lineIndent <= nodeIndent) {
|
|
2259
|
+
_result.push(null);
|
|
2260
|
+
ch = state.input.charCodeAt(state.position);
|
|
2261
|
+
continue;
|
|
2262
|
+
}
|
|
2263
|
+
}
|
|
2264
|
+
const _line = state.line;
|
|
2265
|
+
composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
|
|
2266
|
+
_result.push(state.result);
|
|
2267
|
+
skipSeparationSpace(state, true, -1);
|
|
2268
|
+
ch = state.input.charCodeAt(state.position);
|
|
2269
|
+
if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
|
|
2270
|
+
throwError(state, "bad indentation of a sequence entry");
|
|
2271
|
+
} else if (state.lineIndent < nodeIndent) {
|
|
2272
|
+
break;
|
|
2273
|
+
}
|
|
2274
|
+
}
|
|
2275
|
+
if (detected) {
|
|
2276
|
+
state.tag = _tag;
|
|
2277
|
+
state.anchor = _anchor;
|
|
2278
|
+
state.kind = "sequence";
|
|
2279
|
+
state.result = _result;
|
|
2280
|
+
return true;
|
|
2281
|
+
}
|
|
2282
|
+
return false;
|
|
2283
|
+
}
|
|
2284
|
+
function readBlockMapping(state, nodeIndent, flowIndent) {
|
|
2285
|
+
let allowCompact;
|
|
2286
|
+
let _keyLine;
|
|
2287
|
+
let _keyLineStart;
|
|
2288
|
+
let _keyPos;
|
|
2289
|
+
const _tag = state.tag;
|
|
2290
|
+
const _anchor = state.anchor;
|
|
2291
|
+
const _result = {};
|
|
2292
|
+
const overridableKeys = /* @__PURE__ */ Object.create(null);
|
|
2293
|
+
let keyTag = null;
|
|
2294
|
+
let keyNode = null;
|
|
2295
|
+
let valueNode = null;
|
|
2296
|
+
let atExplicitKey = false;
|
|
2297
|
+
let detected = false;
|
|
2298
|
+
if (state.firstTabInLine !== -1) return false;
|
|
2299
|
+
if (state.anchor !== null) {
|
|
2300
|
+
storeAnchor(state, state.anchor, _result);
|
|
2301
|
+
}
|
|
2302
|
+
let ch = state.input.charCodeAt(state.position);
|
|
2303
|
+
while (ch !== 0) {
|
|
2304
|
+
if (!atExplicitKey && state.firstTabInLine !== -1) {
|
|
2305
|
+
state.position = state.firstTabInLine;
|
|
2306
|
+
throwError(state, "tab characters must not be used in indentation");
|
|
2307
|
+
}
|
|
2308
|
+
const following = state.input.charCodeAt(state.position + 1);
|
|
2309
|
+
const _line = state.line;
|
|
2310
|
+
if ((ch === 63 || ch === 58) && isWsOrEol(following)) {
|
|
2311
|
+
if (ch === 63) {
|
|
2312
|
+
if (atExplicitKey) {
|
|
2313
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
|
2314
|
+
keyTag = keyNode = valueNode = null;
|
|
2315
|
+
}
|
|
2316
|
+
detected = true;
|
|
2317
|
+
atExplicitKey = true;
|
|
2318
|
+
allowCompact = true;
|
|
2319
|
+
} else if (atExplicitKey) {
|
|
2320
|
+
atExplicitKey = false;
|
|
2321
|
+
allowCompact = true;
|
|
2322
|
+
} else {
|
|
2323
|
+
throwError(state, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");
|
|
2324
|
+
}
|
|
2325
|
+
state.position += 1;
|
|
2326
|
+
ch = following;
|
|
2327
|
+
} else {
|
|
2328
|
+
_keyLine = state.line;
|
|
2329
|
+
_keyLineStart = state.lineStart;
|
|
2330
|
+
_keyPos = state.position;
|
|
2331
|
+
if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
|
|
2332
|
+
break;
|
|
2333
|
+
}
|
|
2334
|
+
if (state.line === _line) {
|
|
2335
|
+
ch = state.input.charCodeAt(state.position);
|
|
2336
|
+
while (isWhiteSpace(ch)) {
|
|
2337
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2338
|
+
}
|
|
2339
|
+
if (ch === 58) {
|
|
2340
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2341
|
+
if (!isWsOrEol(ch)) {
|
|
2342
|
+
throwError(state, "a whitespace character is expected after the key-value separator within a block mapping");
|
|
2343
|
+
}
|
|
2344
|
+
if (atExplicitKey) {
|
|
2345
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
|
2346
|
+
keyTag = keyNode = valueNode = null;
|
|
2347
|
+
}
|
|
2348
|
+
detected = true;
|
|
2349
|
+
atExplicitKey = false;
|
|
2350
|
+
allowCompact = false;
|
|
2351
|
+
keyTag = state.tag;
|
|
2352
|
+
keyNode = state.result;
|
|
2353
|
+
} else if (detected) {
|
|
2354
|
+
throwError(state, "can not read an implicit mapping pair; a colon is missed");
|
|
2355
|
+
} else {
|
|
2356
|
+
state.tag = _tag;
|
|
2357
|
+
state.anchor = _anchor;
|
|
2358
|
+
return true;
|
|
2359
|
+
}
|
|
2360
|
+
} else if (detected) {
|
|
2361
|
+
throwError(state, "can not read a block mapping entry; a multiline key may not be an implicit key");
|
|
2362
|
+
} else {
|
|
2363
|
+
state.tag = _tag;
|
|
2364
|
+
state.anchor = _anchor;
|
|
2365
|
+
return true;
|
|
2366
|
+
}
|
|
2367
|
+
}
|
|
2368
|
+
if (state.line === _line || state.lineIndent > nodeIndent) {
|
|
2369
|
+
if (atExplicitKey) {
|
|
2370
|
+
_keyLine = state.line;
|
|
2371
|
+
_keyLineStart = state.lineStart;
|
|
2372
|
+
_keyPos = state.position;
|
|
2373
|
+
}
|
|
2374
|
+
if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
|
|
2375
|
+
if (atExplicitKey) {
|
|
2376
|
+
keyNode = state.result;
|
|
2377
|
+
} else {
|
|
2378
|
+
valueNode = state.result;
|
|
2379
|
+
}
|
|
2380
|
+
}
|
|
2381
|
+
if (!atExplicitKey) {
|
|
2382
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos);
|
|
2383
|
+
keyTag = keyNode = valueNode = null;
|
|
2384
|
+
}
|
|
2385
|
+
skipSeparationSpace(state, true, -1);
|
|
2386
|
+
ch = state.input.charCodeAt(state.position);
|
|
2387
|
+
}
|
|
2388
|
+
if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
|
|
2389
|
+
throwError(state, "bad indentation of a mapping entry");
|
|
2390
|
+
} else if (state.lineIndent < nodeIndent) {
|
|
2391
|
+
break;
|
|
2392
|
+
}
|
|
2393
|
+
}
|
|
2394
|
+
if (atExplicitKey) {
|
|
2395
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
|
2396
|
+
}
|
|
2397
|
+
if (detected) {
|
|
2398
|
+
state.tag = _tag;
|
|
2399
|
+
state.anchor = _anchor;
|
|
2400
|
+
state.kind = "mapping";
|
|
2401
|
+
state.result = _result;
|
|
2402
|
+
}
|
|
2403
|
+
return detected;
|
|
2404
|
+
}
|
|
2405
|
+
function readTagProperty(state) {
|
|
2406
|
+
let isVerbatim = false;
|
|
2407
|
+
let isNamed = false;
|
|
2408
|
+
let tagHandle;
|
|
2409
|
+
let tagName;
|
|
2410
|
+
let ch = state.input.charCodeAt(state.position);
|
|
2411
|
+
if (ch !== 33) return false;
|
|
2412
|
+
if (state.tag !== null) {
|
|
2413
|
+
throwError(state, "duplication of a tag property");
|
|
2414
|
+
}
|
|
2415
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2416
|
+
if (ch === 60) {
|
|
2417
|
+
isVerbatim = true;
|
|
2418
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2419
|
+
} else if (ch === 33) {
|
|
2420
|
+
isNamed = true;
|
|
2421
|
+
tagHandle = "!!";
|
|
2422
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2423
|
+
} else {
|
|
2424
|
+
tagHandle = "!";
|
|
2425
|
+
}
|
|
2426
|
+
let _position = state.position;
|
|
2427
|
+
if (isVerbatim) {
|
|
2428
|
+
do {
|
|
2429
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2430
|
+
} while (ch !== 0 && ch !== 62);
|
|
2431
|
+
if (state.position < state.length) {
|
|
2432
|
+
tagName = state.input.slice(_position, state.position);
|
|
2433
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2434
|
+
} else {
|
|
2435
|
+
throwError(state, "unexpected end of the stream within a verbatim tag");
|
|
2436
|
+
}
|
|
2437
|
+
} else {
|
|
2438
|
+
while (ch !== 0 && !isWsOrEol(ch)) {
|
|
2439
|
+
if (ch === 33) {
|
|
2440
|
+
if (!isNamed) {
|
|
2441
|
+
tagHandle = state.input.slice(_position - 1, state.position + 1);
|
|
2442
|
+
if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
|
|
2443
|
+
throwError(state, "named tag handle cannot contain such characters");
|
|
2444
|
+
}
|
|
2445
|
+
isNamed = true;
|
|
2446
|
+
_position = state.position + 1;
|
|
2447
|
+
} else {
|
|
2448
|
+
throwError(state, "tag suffix cannot contain exclamation marks");
|
|
2449
|
+
}
|
|
2450
|
+
}
|
|
2451
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2452
|
+
}
|
|
2453
|
+
tagName = state.input.slice(_position, state.position);
|
|
2454
|
+
if (PATTERN_FLOW_INDICATORS.test(tagName)) {
|
|
2455
|
+
throwError(state, "tag suffix cannot contain flow indicator characters");
|
|
2456
|
+
}
|
|
2457
|
+
}
|
|
2458
|
+
if (tagName && !PATTERN_TAG_URI.test(tagName)) {
|
|
2459
|
+
throwError(state, "tag name cannot contain such characters: " + tagName);
|
|
2460
|
+
}
|
|
2461
|
+
try {
|
|
2462
|
+
tagName = decodeURIComponent(tagName);
|
|
2463
|
+
} catch (err) {
|
|
2464
|
+
throwError(state, "tag name is malformed: " + tagName);
|
|
2465
|
+
}
|
|
2466
|
+
if (isVerbatim) {
|
|
2467
|
+
state.tag = tagName;
|
|
2468
|
+
} else if (_hasOwnProperty.call(state.tagMap, tagHandle)) {
|
|
2469
|
+
state.tag = state.tagMap[tagHandle] + tagName;
|
|
2470
|
+
} else if (tagHandle === "!") {
|
|
2471
|
+
state.tag = "!" + tagName;
|
|
2472
|
+
} else if (tagHandle === "!!") {
|
|
2473
|
+
state.tag = "tag:yaml.org,2002:" + tagName;
|
|
2474
|
+
} else {
|
|
2475
|
+
throwError(state, 'undeclared tag handle "' + tagHandle + '"');
|
|
2476
|
+
}
|
|
2477
|
+
return true;
|
|
2478
|
+
}
|
|
2479
|
+
function readAnchorProperty(state) {
|
|
2480
|
+
let ch = state.input.charCodeAt(state.position);
|
|
2481
|
+
if (ch !== 38) return false;
|
|
2482
|
+
if (state.anchor !== null) {
|
|
2483
|
+
throwError(state, "duplication of an anchor property");
|
|
2484
|
+
}
|
|
2485
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2486
|
+
const _position = state.position;
|
|
2487
|
+
while (ch !== 0 && !isWsOrEol(ch) && !isFlowIndicator(ch)) {
|
|
2488
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2489
|
+
}
|
|
2490
|
+
if (state.position === _position) {
|
|
2491
|
+
throwError(state, "name of an anchor node must contain at least one character");
|
|
2492
|
+
}
|
|
2493
|
+
state.anchor = state.input.slice(_position, state.position);
|
|
2494
|
+
return true;
|
|
2495
|
+
}
|
|
2496
|
+
function readAlias(state) {
|
|
2497
|
+
let ch = state.input.charCodeAt(state.position);
|
|
2498
|
+
if (ch !== 42) return false;
|
|
2499
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2500
|
+
const _position = state.position;
|
|
2501
|
+
while (ch !== 0 && !isWsOrEol(ch) && !isFlowIndicator(ch)) {
|
|
2502
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2503
|
+
}
|
|
2504
|
+
if (state.position === _position) {
|
|
2505
|
+
throwError(state, "name of an alias node must contain at least one character");
|
|
2506
|
+
}
|
|
2507
|
+
const alias = state.input.slice(_position, state.position);
|
|
2508
|
+
if (!_hasOwnProperty.call(state.anchorMap, alias)) {
|
|
2509
|
+
throwError(state, 'unidentified alias "' + alias + '"');
|
|
2510
|
+
}
|
|
2511
|
+
state.result = state.anchorMap[alias];
|
|
2512
|
+
skipSeparationSpace(state, true, -1);
|
|
2513
|
+
return true;
|
|
2514
|
+
}
|
|
2515
|
+
function tryReadBlockMappingFromProperty(state, propertyStart, nodeIndent, flowIndent) {
|
|
2516
|
+
const fallbackState = snapshotState(state);
|
|
2517
|
+
beginAnchorTransaction(state);
|
|
2518
|
+
restoreState(state, propertyStart);
|
|
2519
|
+
state.tag = null;
|
|
2520
|
+
state.anchor = null;
|
|
2521
|
+
state.kind = null;
|
|
2522
|
+
state.result = null;
|
|
2523
|
+
if (readBlockMapping(state, nodeIndent, flowIndent) && state.kind === "mapping") {
|
|
2524
|
+
commitAnchorTransaction(state);
|
|
2525
|
+
return true;
|
|
2526
|
+
}
|
|
2527
|
+
rollbackAnchorTransaction(state);
|
|
2528
|
+
restoreState(state, fallbackState);
|
|
2529
|
+
return false;
|
|
2530
|
+
}
|
|
2531
|
+
function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
|
|
2532
|
+
let allowBlockScalars;
|
|
2533
|
+
let allowBlockCollections;
|
|
2534
|
+
let indentStatus = 1;
|
|
2535
|
+
let atNewLine = false;
|
|
2536
|
+
let hasContent = false;
|
|
2537
|
+
let propertyStart = null;
|
|
2538
|
+
let type;
|
|
2539
|
+
let flowIndent;
|
|
2540
|
+
let blockIndent;
|
|
2541
|
+
if (state.depth >= state.maxDepth) {
|
|
2542
|
+
throwError(state, "nesting exceeded maxDepth (" + state.maxDepth + ")");
|
|
2543
|
+
}
|
|
2544
|
+
state.depth += 1;
|
|
2545
|
+
if (state.listener !== null) {
|
|
2546
|
+
state.listener("open", state);
|
|
2547
|
+
}
|
|
2548
|
+
state.tag = null;
|
|
2549
|
+
state.anchor = null;
|
|
2550
|
+
state.kind = null;
|
|
2551
|
+
state.result = null;
|
|
2552
|
+
const allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext;
|
|
2553
|
+
if (allowToSeek) {
|
|
2554
|
+
if (skipSeparationSpace(state, true, -1)) {
|
|
2555
|
+
atNewLine = true;
|
|
2556
|
+
if (state.lineIndent > parentIndent) {
|
|
2557
|
+
indentStatus = 1;
|
|
2558
|
+
} else if (state.lineIndent === parentIndent) {
|
|
2559
|
+
indentStatus = 0;
|
|
2560
|
+
} else if (state.lineIndent < parentIndent) {
|
|
2561
|
+
indentStatus = -1;
|
|
2562
|
+
}
|
|
2563
|
+
}
|
|
2564
|
+
}
|
|
2565
|
+
if (indentStatus === 1) {
|
|
2566
|
+
while (true) {
|
|
2567
|
+
const ch = state.input.charCodeAt(state.position);
|
|
2568
|
+
const propertyState = snapshotState(state);
|
|
2569
|
+
if (atNewLine && (ch === 33 && state.tag !== null || ch === 38 && state.anchor !== null)) {
|
|
2570
|
+
break;
|
|
2571
|
+
}
|
|
2572
|
+
if (!readTagProperty(state) && !readAnchorProperty(state)) {
|
|
2573
|
+
break;
|
|
2574
|
+
}
|
|
2575
|
+
if (propertyStart === null) {
|
|
2576
|
+
propertyStart = propertyState;
|
|
2577
|
+
}
|
|
2578
|
+
if (skipSeparationSpace(state, true, -1)) {
|
|
2579
|
+
atNewLine = true;
|
|
2580
|
+
allowBlockCollections = allowBlockStyles;
|
|
2581
|
+
if (state.lineIndent > parentIndent) {
|
|
2582
|
+
indentStatus = 1;
|
|
2583
|
+
} else if (state.lineIndent === parentIndent) {
|
|
2584
|
+
indentStatus = 0;
|
|
2585
|
+
} else if (state.lineIndent < parentIndent) {
|
|
2586
|
+
indentStatus = -1;
|
|
2587
|
+
}
|
|
2588
|
+
} else {
|
|
2589
|
+
allowBlockCollections = false;
|
|
2590
|
+
}
|
|
2591
|
+
}
|
|
2592
|
+
}
|
|
2593
|
+
if (allowBlockCollections) {
|
|
2594
|
+
allowBlockCollections = atNewLine || allowCompact;
|
|
2595
|
+
}
|
|
2596
|
+
if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
|
|
2597
|
+
if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
|
|
2598
|
+
flowIndent = parentIndent;
|
|
2599
|
+
} else {
|
|
2600
|
+
flowIndent = parentIndent + 1;
|
|
2601
|
+
}
|
|
2602
|
+
blockIndent = state.position - state.lineStart;
|
|
2603
|
+
if (indentStatus === 1) {
|
|
2604
|
+
if (allowBlockCollections && (readBlockSequence(state, blockIndent) || readBlockMapping(state, blockIndent, flowIndent)) || readFlowCollection(state, flowIndent)) {
|
|
2605
|
+
hasContent = true;
|
|
2606
|
+
} else {
|
|
2607
|
+
const ch = state.input.charCodeAt(state.position);
|
|
2608
|
+
if (propertyStart !== null && allowBlockStyles && !allowBlockCollections && ch !== 124 && ch !== 62 && tryReadBlockMappingFromProperty(
|
|
2609
|
+
state,
|
|
2610
|
+
propertyStart,
|
|
2611
|
+
propertyStart.position - propertyStart.lineStart,
|
|
2612
|
+
flowIndent
|
|
2613
|
+
)) {
|
|
2614
|
+
hasContent = true;
|
|
2615
|
+
} else if (allowBlockScalars && readBlockScalar(state, flowIndent) || readSingleQuotedScalar(state, flowIndent) || readDoubleQuotedScalar(state, flowIndent)) {
|
|
2616
|
+
hasContent = true;
|
|
2617
|
+
} else if (readAlias(state)) {
|
|
2618
|
+
hasContent = true;
|
|
2619
|
+
if (state.tag !== null || state.anchor !== null) {
|
|
2620
|
+
throwError(state, "alias node should not have any properties");
|
|
2621
|
+
}
|
|
2622
|
+
} else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
|
|
2623
|
+
hasContent = true;
|
|
2624
|
+
if (state.tag === null) {
|
|
2625
|
+
state.tag = "?";
|
|
2626
|
+
}
|
|
2627
|
+
}
|
|
2628
|
+
if (state.anchor !== null) {
|
|
2629
|
+
storeAnchor(state, state.anchor, state.result);
|
|
2630
|
+
}
|
|
2631
|
+
}
|
|
2632
|
+
} else if (indentStatus === 0) {
|
|
2633
|
+
hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
|
|
2634
|
+
}
|
|
2635
|
+
}
|
|
2636
|
+
if (state.tag === null) {
|
|
2637
|
+
if (state.anchor !== null) {
|
|
2638
|
+
storeAnchor(state, state.anchor, state.result);
|
|
2639
|
+
}
|
|
2640
|
+
} else if (state.tag === "?") {
|
|
2641
|
+
if (state.result !== null && state.kind !== "scalar") {
|
|
2642
|
+
throwError(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"');
|
|
2643
|
+
}
|
|
2644
|
+
for (let typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
|
|
2645
|
+
type = state.implicitTypes[typeIndex];
|
|
2646
|
+
if (type.resolve(state.result)) {
|
|
2647
|
+
state.result = type.construct(state.result);
|
|
2648
|
+
state.tag = type.tag;
|
|
2649
|
+
if (state.anchor !== null) {
|
|
2650
|
+
storeAnchor(state, state.anchor, state.result);
|
|
2651
|
+
}
|
|
2652
|
+
break;
|
|
2653
|
+
}
|
|
2654
|
+
}
|
|
2655
|
+
} else if (state.tag !== "!") {
|
|
2656
|
+
if (_hasOwnProperty.call(state.typeMap[state.kind || "fallback"], state.tag)) {
|
|
2657
|
+
type = state.typeMap[state.kind || "fallback"][state.tag];
|
|
2658
|
+
} else {
|
|
2659
|
+
type = null;
|
|
2660
|
+
const typeList = state.typeMap.multi[state.kind || "fallback"];
|
|
2661
|
+
for (let typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) {
|
|
2662
|
+
if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) {
|
|
2663
|
+
type = typeList[typeIndex];
|
|
2664
|
+
break;
|
|
2665
|
+
}
|
|
2666
|
+
}
|
|
2667
|
+
}
|
|
2668
|
+
if (!type) {
|
|
2669
|
+
throwError(state, "unknown tag !<" + state.tag + ">");
|
|
2670
|
+
}
|
|
2671
|
+
if (state.result !== null && type.kind !== state.kind) {
|
|
2672
|
+
throwError(state, "unacceptable node kind for !<" + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"');
|
|
2673
|
+
}
|
|
2674
|
+
if (!type.resolve(state.result, state.tag)) {
|
|
2675
|
+
throwError(state, "cannot resolve a node with !<" + state.tag + "> explicit tag");
|
|
2676
|
+
} else {
|
|
2677
|
+
state.result = type.construct(state.result, state.tag);
|
|
2678
|
+
if (state.anchor !== null) {
|
|
2679
|
+
storeAnchor(state, state.anchor, state.result);
|
|
2680
|
+
}
|
|
2681
|
+
}
|
|
2682
|
+
}
|
|
2683
|
+
if (state.listener !== null) {
|
|
2684
|
+
state.listener("close", state);
|
|
2685
|
+
}
|
|
2686
|
+
state.depth -= 1;
|
|
2687
|
+
return state.tag !== null || state.anchor !== null || hasContent;
|
|
2688
|
+
}
|
|
2689
|
+
function readDocument(state) {
|
|
2690
|
+
const documentStart = state.position;
|
|
2691
|
+
let hasDirectives = false;
|
|
2692
|
+
let ch;
|
|
2693
|
+
state.version = null;
|
|
2694
|
+
state.checkLineBreaks = state.legacy;
|
|
2695
|
+
state.tagMap = /* @__PURE__ */ Object.create(null);
|
|
2696
|
+
state.anchorMap = /* @__PURE__ */ Object.create(null);
|
|
2697
|
+
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
2698
|
+
skipSeparationSpace(state, true, -1);
|
|
2699
|
+
ch = state.input.charCodeAt(state.position);
|
|
2700
|
+
if (state.lineIndent > 0 || ch !== 37) {
|
|
2701
|
+
break;
|
|
2702
|
+
}
|
|
2703
|
+
hasDirectives = true;
|
|
2704
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2705
|
+
let _position = state.position;
|
|
2706
|
+
while (ch !== 0 && !isWsOrEol(ch)) {
|
|
2707
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2708
|
+
}
|
|
2709
|
+
const directiveName = state.input.slice(_position, state.position);
|
|
2710
|
+
const directiveArgs = [];
|
|
2711
|
+
if (directiveName.length < 1) {
|
|
2712
|
+
throwError(state, "directive name must not be less than one character in length");
|
|
2713
|
+
}
|
|
2714
|
+
while (ch !== 0) {
|
|
2715
|
+
while (isWhiteSpace(ch)) {
|
|
2716
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2717
|
+
}
|
|
2718
|
+
if (ch === 35) {
|
|
2719
|
+
do {
|
|
2720
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2721
|
+
} while (ch !== 0 && !isEol(ch));
|
|
2722
|
+
break;
|
|
2723
|
+
}
|
|
2724
|
+
if (isEol(ch)) break;
|
|
2725
|
+
_position = state.position;
|
|
2726
|
+
while (ch !== 0 && !isWsOrEol(ch)) {
|
|
2727
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2728
|
+
}
|
|
2729
|
+
directiveArgs.push(state.input.slice(_position, state.position));
|
|
2730
|
+
}
|
|
2731
|
+
if (ch !== 0) readLineBreak(state);
|
|
2732
|
+
if (_hasOwnProperty.call(directiveHandlers, directiveName)) {
|
|
2733
|
+
directiveHandlers[directiveName](state, directiveName, directiveArgs);
|
|
2734
|
+
} else {
|
|
2735
|
+
throwWarning(state, 'unknown document directive "' + directiveName + '"');
|
|
2736
|
+
}
|
|
2737
|
+
}
|
|
2738
|
+
skipSeparationSpace(state, true, -1);
|
|
2739
|
+
if (state.lineIndent === 0 && state.input.charCodeAt(state.position) === 45 && state.input.charCodeAt(state.position + 1) === 45 && state.input.charCodeAt(state.position + 2) === 45) {
|
|
2740
|
+
state.position += 3;
|
|
2741
|
+
skipSeparationSpace(state, true, -1);
|
|
2742
|
+
} else if (hasDirectives) {
|
|
2743
|
+
throwError(state, "directives end mark is expected");
|
|
2744
|
+
}
|
|
2745
|
+
composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
|
|
2746
|
+
skipSeparationSpace(state, true, -1);
|
|
2747
|
+
if (state.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
|
|
2748
|
+
throwWarning(state, "non-ASCII line breaks are interpreted as content");
|
|
2749
|
+
}
|
|
2750
|
+
state.documents.push(state.result);
|
|
2751
|
+
if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
2752
|
+
if (state.input.charCodeAt(state.position) === 46) {
|
|
2753
|
+
state.position += 3;
|
|
2754
|
+
skipSeparationSpace(state, true, -1);
|
|
2755
|
+
}
|
|
2756
|
+
return;
|
|
2757
|
+
}
|
|
2758
|
+
if (state.position < state.length - 1) {
|
|
2759
|
+
throwError(state, "end of the stream or a document separator is expected");
|
|
2760
|
+
}
|
|
2761
|
+
}
|
|
2762
|
+
function loadDocuments(input, options) {
|
|
2763
|
+
input = String(input);
|
|
2764
|
+
options = options || {};
|
|
2765
|
+
if (input.length !== 0) {
|
|
2766
|
+
if (input.charCodeAt(input.length - 1) !== 10 && input.charCodeAt(input.length - 1) !== 13) {
|
|
2767
|
+
input += "\n";
|
|
2768
|
+
}
|
|
2769
|
+
if (input.charCodeAt(0) === 65279) {
|
|
2770
|
+
input = input.slice(1);
|
|
2771
|
+
}
|
|
2772
|
+
}
|
|
2773
|
+
const state = new State(input, options);
|
|
2774
|
+
const nullpos = input.indexOf("\0");
|
|
2775
|
+
if (nullpos !== -1) {
|
|
2776
|
+
state.position = nullpos;
|
|
2777
|
+
throwError(state, "null byte is not allowed in input");
|
|
2778
|
+
}
|
|
2779
|
+
state.input += "\0";
|
|
2780
|
+
while (state.input.charCodeAt(state.position) === 32) {
|
|
2781
|
+
state.lineIndent += 1;
|
|
2782
|
+
state.position += 1;
|
|
2783
|
+
}
|
|
2784
|
+
while (state.position < state.length - 1) {
|
|
2785
|
+
readDocument(state);
|
|
2786
|
+
}
|
|
2787
|
+
return state.documents;
|
|
2788
|
+
}
|
|
2789
|
+
function loadAll(input, iterator, options) {
|
|
2790
|
+
if (iterator !== null && typeof iterator === "object" && typeof options === "undefined") {
|
|
2791
|
+
options = iterator;
|
|
2792
|
+
iterator = null;
|
|
2793
|
+
}
|
|
2794
|
+
const documents = loadDocuments(input, options);
|
|
2795
|
+
if (typeof iterator !== "function") {
|
|
2796
|
+
return documents;
|
|
2797
|
+
}
|
|
2798
|
+
for (let index = 0, length = documents.length; index < length; index += 1) {
|
|
2799
|
+
iterator(documents[index]);
|
|
2800
|
+
}
|
|
2801
|
+
}
|
|
2802
|
+
function load(input, options) {
|
|
2803
|
+
const documents = loadDocuments(input, options);
|
|
2804
|
+
if (documents.length === 0) {
|
|
2805
|
+
return void 0;
|
|
2806
|
+
} else if (documents.length === 1) {
|
|
2807
|
+
return documents[0];
|
|
2808
|
+
}
|
|
2809
|
+
throw new YAMLException("expected a single document in the stream, but found more");
|
|
2810
|
+
}
|
|
2811
|
+
module.exports.loadAll = loadAll;
|
|
2812
|
+
module.exports.load = load;
|
|
2813
|
+
}
|
|
2814
|
+
});
|
|
2815
|
+
|
|
2816
|
+
// node_modules/js-yaml/lib/dumper.js
|
|
2817
|
+
var require_dumper = __commonJS({
|
|
2818
|
+
"node_modules/js-yaml/lib/dumper.js"(exports, module) {
|
|
2819
|
+
"use strict";
|
|
2820
|
+
var common = require_common();
|
|
2821
|
+
var YAMLException = require_exception();
|
|
2822
|
+
var DEFAULT_SCHEMA = require_default();
|
|
2823
|
+
var _toString = Object.prototype.toString;
|
|
2824
|
+
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
2825
|
+
var CHAR_BOM = 65279;
|
|
2826
|
+
var CHAR_TAB = 9;
|
|
2827
|
+
var CHAR_LINE_FEED = 10;
|
|
2828
|
+
var CHAR_CARRIAGE_RETURN = 13;
|
|
2829
|
+
var CHAR_SPACE = 32;
|
|
2830
|
+
var CHAR_EXCLAMATION = 33;
|
|
2831
|
+
var CHAR_DOUBLE_QUOTE = 34;
|
|
2832
|
+
var CHAR_SHARP = 35;
|
|
2833
|
+
var CHAR_PERCENT = 37;
|
|
2834
|
+
var CHAR_AMPERSAND = 38;
|
|
2835
|
+
var CHAR_SINGLE_QUOTE = 39;
|
|
2836
|
+
var CHAR_ASTERISK = 42;
|
|
2837
|
+
var CHAR_COMMA = 44;
|
|
2838
|
+
var CHAR_MINUS = 45;
|
|
2839
|
+
var CHAR_COLON = 58;
|
|
2840
|
+
var CHAR_EQUALS = 61;
|
|
2841
|
+
var CHAR_GREATER_THAN = 62;
|
|
2842
|
+
var CHAR_QUESTION = 63;
|
|
2843
|
+
var CHAR_COMMERCIAL_AT = 64;
|
|
2844
|
+
var CHAR_LEFT_SQUARE_BRACKET = 91;
|
|
2845
|
+
var CHAR_RIGHT_SQUARE_BRACKET = 93;
|
|
2846
|
+
var CHAR_GRAVE_ACCENT = 96;
|
|
2847
|
+
var CHAR_LEFT_CURLY_BRACKET = 123;
|
|
2848
|
+
var CHAR_VERTICAL_LINE = 124;
|
|
2849
|
+
var CHAR_RIGHT_CURLY_BRACKET = 125;
|
|
2850
|
+
var ESCAPE_SEQUENCES = {};
|
|
2851
|
+
ESCAPE_SEQUENCES[0] = "\\0";
|
|
2852
|
+
ESCAPE_SEQUENCES[7] = "\\a";
|
|
2853
|
+
ESCAPE_SEQUENCES[8] = "\\b";
|
|
2854
|
+
ESCAPE_SEQUENCES[9] = "\\t";
|
|
2855
|
+
ESCAPE_SEQUENCES[10] = "\\n";
|
|
2856
|
+
ESCAPE_SEQUENCES[11] = "\\v";
|
|
2857
|
+
ESCAPE_SEQUENCES[12] = "\\f";
|
|
2858
|
+
ESCAPE_SEQUENCES[13] = "\\r";
|
|
2859
|
+
ESCAPE_SEQUENCES[27] = "\\e";
|
|
2860
|
+
ESCAPE_SEQUENCES[34] = '\\"';
|
|
2861
|
+
ESCAPE_SEQUENCES[92] = "\\\\";
|
|
2862
|
+
ESCAPE_SEQUENCES[133] = "\\N";
|
|
2863
|
+
ESCAPE_SEQUENCES[160] = "\\_";
|
|
2864
|
+
ESCAPE_SEQUENCES[8232] = "\\L";
|
|
2865
|
+
ESCAPE_SEQUENCES[8233] = "\\P";
|
|
2866
|
+
var DEPRECATED_BOOLEANS_SYNTAX = [
|
|
2867
|
+
"y",
|
|
2868
|
+
"Y",
|
|
2869
|
+
"yes",
|
|
2870
|
+
"Yes",
|
|
2871
|
+
"YES",
|
|
2872
|
+
"on",
|
|
2873
|
+
"On",
|
|
2874
|
+
"ON",
|
|
2875
|
+
"n",
|
|
2876
|
+
"N",
|
|
2877
|
+
"no",
|
|
2878
|
+
"No",
|
|
2879
|
+
"NO",
|
|
2880
|
+
"off",
|
|
2881
|
+
"Off",
|
|
2882
|
+
"OFF"
|
|
2883
|
+
];
|
|
2884
|
+
var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
|
|
2885
|
+
function compileStyleMap(schema, map) {
|
|
2886
|
+
if (map === null) return {};
|
|
2887
|
+
const result = {};
|
|
2888
|
+
const keys = Object.keys(map);
|
|
2889
|
+
for (let index = 0, length = keys.length; index < length; index += 1) {
|
|
2890
|
+
let tag = keys[index];
|
|
2891
|
+
let style = String(map[tag]);
|
|
2892
|
+
if (tag.slice(0, 2) === "!!") {
|
|
2893
|
+
tag = "tag:yaml.org,2002:" + tag.slice(2);
|
|
2894
|
+
}
|
|
2895
|
+
const type = schema.compiledTypeMap["fallback"][tag];
|
|
2896
|
+
if (type && _hasOwnProperty.call(type.styleAliases, style)) {
|
|
2897
|
+
style = type.styleAliases[style];
|
|
2898
|
+
}
|
|
2899
|
+
result[tag] = style;
|
|
2900
|
+
}
|
|
2901
|
+
return result;
|
|
2902
|
+
}
|
|
2903
|
+
function encodeHex(character) {
|
|
2904
|
+
let handle;
|
|
2905
|
+
let length;
|
|
2906
|
+
const string = character.toString(16).toUpperCase();
|
|
2907
|
+
if (character <= 255) {
|
|
2908
|
+
handle = "x";
|
|
2909
|
+
length = 2;
|
|
2910
|
+
} else if (character <= 65535) {
|
|
2911
|
+
handle = "u";
|
|
2912
|
+
length = 4;
|
|
2913
|
+
} else if (character <= 4294967295) {
|
|
2914
|
+
handle = "U";
|
|
2915
|
+
length = 8;
|
|
2916
|
+
} else {
|
|
2917
|
+
throw new YAMLException("code point within a string may not be greater than 0xFFFFFFFF");
|
|
2918
|
+
}
|
|
2919
|
+
return "\\" + handle + common.repeat("0", length - string.length) + string;
|
|
2920
|
+
}
|
|
2921
|
+
var QUOTING_TYPE_SINGLE = 1;
|
|
2922
|
+
var QUOTING_TYPE_DOUBLE = 2;
|
|
2923
|
+
function State(options) {
|
|
2924
|
+
this.schema = options["schema"] || DEFAULT_SCHEMA;
|
|
2925
|
+
this.indent = Math.max(1, options["indent"] || 2);
|
|
2926
|
+
this.noArrayIndent = options["noArrayIndent"] || false;
|
|
2927
|
+
this.skipInvalid = options["skipInvalid"] || false;
|
|
2928
|
+
this.flowLevel = common.isNothing(options["flowLevel"]) ? -1 : options["flowLevel"];
|
|
2929
|
+
this.styleMap = compileStyleMap(this.schema, options["styles"] || null);
|
|
2930
|
+
this.sortKeys = options["sortKeys"] || false;
|
|
2931
|
+
this.lineWidth = options["lineWidth"] || 80;
|
|
2932
|
+
this.noRefs = options["noRefs"] || false;
|
|
2933
|
+
this.noCompatMode = options["noCompatMode"] || false;
|
|
2934
|
+
this.condenseFlow = options["condenseFlow"] || false;
|
|
2935
|
+
this.quotingType = options["quotingType"] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE;
|
|
2936
|
+
this.forceQuotes = options["forceQuotes"] || false;
|
|
2937
|
+
this.replacer = typeof options["replacer"] === "function" ? options["replacer"] : null;
|
|
2938
|
+
this.implicitTypes = this.schema.compiledImplicit;
|
|
2939
|
+
this.explicitTypes = this.schema.compiledExplicit;
|
|
2940
|
+
this.tag = null;
|
|
2941
|
+
this.result = "";
|
|
2942
|
+
this.duplicates = [];
|
|
2943
|
+
this.usedDuplicates = null;
|
|
2944
|
+
}
|
|
2945
|
+
function indentString(string, spaces) {
|
|
2946
|
+
const ind = common.repeat(" ", spaces);
|
|
2947
|
+
let position = 0;
|
|
2948
|
+
let result = "";
|
|
2949
|
+
const length = string.length;
|
|
2950
|
+
while (position < length) {
|
|
2951
|
+
let line;
|
|
2952
|
+
const next = string.indexOf("\n", position);
|
|
2953
|
+
if (next === -1) {
|
|
2954
|
+
line = string.slice(position);
|
|
2955
|
+
position = length;
|
|
2956
|
+
} else {
|
|
2957
|
+
line = string.slice(position, next + 1);
|
|
2958
|
+
position = next + 1;
|
|
2959
|
+
}
|
|
2960
|
+
if (line.length && line !== "\n") result += ind;
|
|
2961
|
+
result += line;
|
|
2962
|
+
}
|
|
2963
|
+
return result;
|
|
2964
|
+
}
|
|
2965
|
+
function generateNextLine(state, level) {
|
|
2966
|
+
return "\n" + common.repeat(" ", state.indent * level);
|
|
2967
|
+
}
|
|
2968
|
+
function testImplicitResolving(state, str) {
|
|
2969
|
+
for (let index = 0, length = state.implicitTypes.length; index < length; index += 1) {
|
|
2970
|
+
const type = state.implicitTypes[index];
|
|
2971
|
+
if (type.resolve(str)) {
|
|
2972
|
+
return true;
|
|
2973
|
+
}
|
|
2974
|
+
}
|
|
2975
|
+
return false;
|
|
2976
|
+
}
|
|
2977
|
+
function isWhitespace(c) {
|
|
2978
|
+
return c === CHAR_SPACE || c === CHAR_TAB;
|
|
2979
|
+
}
|
|
2980
|
+
function isPrintable(c) {
|
|
2981
|
+
return c >= 32 && c <= 126 || c >= 161 && c <= 55295 && c !== 8232 && c !== 8233 || c >= 57344 && c <= 65533 && c !== CHAR_BOM || c >= 65536 && c <= 1114111;
|
|
2982
|
+
}
|
|
2983
|
+
function isNsCharOrWhitespace(c) {
|
|
2984
|
+
return isPrintable(c) && c !== CHAR_BOM && // - b-char
|
|
2985
|
+
c !== CHAR_CARRIAGE_RETURN && c !== CHAR_LINE_FEED;
|
|
2986
|
+
}
|
|
2987
|
+
function isPlainSafe(c, prev, inblock) {
|
|
2988
|
+
const cIsNsCharOrWhitespace = isNsCharOrWhitespace(c);
|
|
2989
|
+
const cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c);
|
|
2990
|
+
return (
|
|
2991
|
+
// ns-plain-safe
|
|
2992
|
+
(inblock ? cIsNsCharOrWhitespace : cIsNsCharOrWhitespace && // - c-flow-indicator
|
|
2993
|
+
c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET) && // ns-plain-char
|
|
2994
|
+
c !== CHAR_SHARP && // false on '#'
|
|
2995
|
+
!(prev === CHAR_COLON && !cIsNsChar) || // false on ': '
|
|
2996
|
+
isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP || // change to true on '[^ ]#'
|
|
2997
|
+
prev === CHAR_COLON && cIsNsChar
|
|
2998
|
+
);
|
|
2999
|
+
}
|
|
3000
|
+
function isPlainSafeFirst(c) {
|
|
3001
|
+
return isPrintable(c) && c !== CHAR_BOM && !isWhitespace(c) && // - s-white
|
|
3002
|
+
// - (c-indicator ::=
|
|
3003
|
+
// “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}”
|
|
3004
|
+
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 && // | “#” | “&” | “*” | “!” | “|” | “=” | “>” | “'” | “"”
|
|
3005
|
+
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 && // | “%” | “@” | “`”)
|
|
3006
|
+
c !== CHAR_PERCENT && c !== CHAR_COMMERCIAL_AT && c !== CHAR_GRAVE_ACCENT;
|
|
3007
|
+
}
|
|
3008
|
+
function isPlainSafeLast(c) {
|
|
3009
|
+
return !isWhitespace(c) && c !== CHAR_COLON;
|
|
3010
|
+
}
|
|
3011
|
+
function codePointAt(string, pos) {
|
|
3012
|
+
const first = string.charCodeAt(pos);
|
|
3013
|
+
let second;
|
|
3014
|
+
if (first >= 55296 && first <= 56319 && pos + 1 < string.length) {
|
|
3015
|
+
second = string.charCodeAt(pos + 1);
|
|
3016
|
+
if (second >= 56320 && second <= 57343) {
|
|
3017
|
+
return (first - 55296) * 1024 + second - 56320 + 65536;
|
|
3018
|
+
}
|
|
3019
|
+
}
|
|
3020
|
+
return first;
|
|
3021
|
+
}
|
|
3022
|
+
function needIndentIndicator(string) {
|
|
3023
|
+
const leadingSpaceRe = /^\n* /;
|
|
3024
|
+
return leadingSpaceRe.test(string);
|
|
3025
|
+
}
|
|
3026
|
+
var STYLE_PLAIN = 1;
|
|
3027
|
+
var STYLE_SINGLE = 2;
|
|
3028
|
+
var STYLE_LITERAL = 3;
|
|
3029
|
+
var STYLE_FOLDED = 4;
|
|
3030
|
+
var STYLE_DOUBLE = 5;
|
|
3031
|
+
function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType, quotingType, forceQuotes, inblock) {
|
|
3032
|
+
let i;
|
|
3033
|
+
let char = 0;
|
|
3034
|
+
let prevChar = null;
|
|
3035
|
+
let hasLineBreak = false;
|
|
3036
|
+
let hasFoldableLine = false;
|
|
3037
|
+
const shouldTrackWidth = lineWidth !== -1;
|
|
3038
|
+
let previousLineBreak = -1;
|
|
3039
|
+
let plain = isPlainSafeFirst(codePointAt(string, 0)) && isPlainSafeLast(codePointAt(string, string.length - 1));
|
|
3040
|
+
if (singleLineOnly || forceQuotes) {
|
|
3041
|
+
for (i = 0; i < string.length; char >= 65536 ? i += 2 : i++) {
|
|
3042
|
+
char = codePointAt(string, i);
|
|
3043
|
+
if (!isPrintable(char)) {
|
|
3044
|
+
return STYLE_DOUBLE;
|
|
3045
|
+
}
|
|
3046
|
+
plain = plain && isPlainSafe(char, prevChar, inblock);
|
|
3047
|
+
prevChar = char;
|
|
3048
|
+
}
|
|
3049
|
+
} else {
|
|
3050
|
+
for (i = 0; i < string.length; char >= 65536 ? i += 2 : i++) {
|
|
3051
|
+
char = codePointAt(string, i);
|
|
3052
|
+
if (char === CHAR_LINE_FEED) {
|
|
3053
|
+
hasLineBreak = true;
|
|
3054
|
+
if (shouldTrackWidth) {
|
|
3055
|
+
hasFoldableLine = hasFoldableLine || // Foldable line = too long, and not more-indented.
|
|
3056
|
+
i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ";
|
|
3057
|
+
previousLineBreak = i;
|
|
3058
|
+
}
|
|
3059
|
+
} else if (!isPrintable(char)) {
|
|
3060
|
+
return STYLE_DOUBLE;
|
|
3061
|
+
}
|
|
3062
|
+
plain = plain && isPlainSafe(char, prevChar, inblock);
|
|
3063
|
+
prevChar = char;
|
|
3064
|
+
}
|
|
3065
|
+
hasFoldableLine = hasFoldableLine || shouldTrackWidth && (i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ");
|
|
3066
|
+
}
|
|
3067
|
+
if (!hasLineBreak && !hasFoldableLine) {
|
|
3068
|
+
if (plain && !forceQuotes && !testAmbiguousType(string)) {
|
|
3069
|
+
return STYLE_PLAIN;
|
|
3070
|
+
}
|
|
3071
|
+
return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
|
|
3072
|
+
}
|
|
3073
|
+
if (indentPerLevel > 9 && needIndentIndicator(string)) {
|
|
3074
|
+
return STYLE_DOUBLE;
|
|
3075
|
+
}
|
|
3076
|
+
if (!forceQuotes) {
|
|
3077
|
+
return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
|
|
3078
|
+
}
|
|
3079
|
+
return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
|
|
3080
|
+
}
|
|
3081
|
+
function writeScalar(state, string, level, iskey, inblock) {
|
|
3082
|
+
state.dump = (function() {
|
|
3083
|
+
if (string.length === 0) {
|
|
3084
|
+
return state.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''";
|
|
3085
|
+
}
|
|
3086
|
+
if (!state.noCompatMode) {
|
|
3087
|
+
if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) {
|
|
3088
|
+
return state.quotingType === QUOTING_TYPE_DOUBLE ? '"' + string + '"' : "'" + string + "'";
|
|
3089
|
+
}
|
|
3090
|
+
}
|
|
3091
|
+
const indent = state.indent * Math.max(1, level);
|
|
3092
|
+
const lineWidth = state.lineWidth === -1 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
|
|
3093
|
+
const singleLineOnly = iskey || // No block styles in flow mode.
|
|
3094
|
+
state.flowLevel > -1 && level >= state.flowLevel;
|
|
3095
|
+
function testAmbiguity(string2) {
|
|
3096
|
+
return testImplicitResolving(state, string2);
|
|
3097
|
+
}
|
|
3098
|
+
switch (chooseScalarStyle(
|
|
3099
|
+
string,
|
|
3100
|
+
singleLineOnly,
|
|
3101
|
+
state.indent,
|
|
3102
|
+
lineWidth,
|
|
3103
|
+
testAmbiguity,
|
|
3104
|
+
state.quotingType,
|
|
3105
|
+
state.forceQuotes && !iskey,
|
|
3106
|
+
inblock
|
|
3107
|
+
)) {
|
|
3108
|
+
case STYLE_PLAIN:
|
|
3109
|
+
return string;
|
|
3110
|
+
case STYLE_SINGLE:
|
|
3111
|
+
return "'" + string.replace(/'/g, "''") + "'";
|
|
3112
|
+
case STYLE_LITERAL:
|
|
3113
|
+
return "|" + blockHeader(string, state.indent) + dropEndingNewline(indentString(string, indent));
|
|
3114
|
+
case STYLE_FOLDED:
|
|
3115
|
+
return ">" + blockHeader(string, state.indent) + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
|
|
3116
|
+
case STYLE_DOUBLE:
|
|
3117
|
+
return '"' + escapeString(string, lineWidth) + '"';
|
|
3118
|
+
default:
|
|
3119
|
+
throw new YAMLException("impossible error: invalid scalar style");
|
|
3120
|
+
}
|
|
3121
|
+
})();
|
|
3122
|
+
}
|
|
3123
|
+
function blockHeader(string, indentPerLevel) {
|
|
3124
|
+
const indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : "";
|
|
3125
|
+
const clip = string[string.length - 1] === "\n";
|
|
3126
|
+
const keep = clip && (string[string.length - 2] === "\n" || string === "\n");
|
|
3127
|
+
const chomp = keep ? "+" : clip ? "" : "-";
|
|
3128
|
+
return indentIndicator + chomp + "\n";
|
|
3129
|
+
}
|
|
3130
|
+
function dropEndingNewline(string) {
|
|
3131
|
+
return string[string.length - 1] === "\n" ? string.slice(0, -1) : string;
|
|
3132
|
+
}
|
|
3133
|
+
function foldString(string, width) {
|
|
3134
|
+
const lineRe = /(\n+)([^\n]*)/g;
|
|
3135
|
+
let result = (function() {
|
|
3136
|
+
let nextLF = string.indexOf("\n");
|
|
3137
|
+
nextLF = nextLF !== -1 ? nextLF : string.length;
|
|
3138
|
+
lineRe.lastIndex = nextLF;
|
|
3139
|
+
return foldLine(string.slice(0, nextLF), width);
|
|
3140
|
+
})();
|
|
3141
|
+
let prevMoreIndented = string[0] === "\n" || string[0] === " ";
|
|
3142
|
+
let moreIndented;
|
|
3143
|
+
let match;
|
|
3144
|
+
while (match = lineRe.exec(string)) {
|
|
3145
|
+
const prefix = match[1];
|
|
3146
|
+
const line = match[2];
|
|
3147
|
+
moreIndented = line[0] === " ";
|
|
3148
|
+
result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? "\n" : "") + foldLine(line, width);
|
|
3149
|
+
prevMoreIndented = moreIndented;
|
|
3150
|
+
}
|
|
3151
|
+
return result;
|
|
3152
|
+
}
|
|
3153
|
+
function foldLine(line, width) {
|
|
3154
|
+
if (line === "" || line[0] === " ") return line;
|
|
3155
|
+
const breakRe = / [^ ]/g;
|
|
3156
|
+
let match;
|
|
3157
|
+
let start = 0;
|
|
3158
|
+
let end;
|
|
3159
|
+
let curr = 0;
|
|
3160
|
+
let next = 0;
|
|
3161
|
+
let result = "";
|
|
3162
|
+
while (match = breakRe.exec(line)) {
|
|
3163
|
+
next = match.index;
|
|
3164
|
+
if (next - start > width) {
|
|
3165
|
+
end = curr > start ? curr : next;
|
|
3166
|
+
result += "\n" + line.slice(start, end);
|
|
3167
|
+
start = end + 1;
|
|
3168
|
+
}
|
|
3169
|
+
curr = next;
|
|
3170
|
+
}
|
|
3171
|
+
result += "\n";
|
|
3172
|
+
if (line.length - start > width && curr > start) {
|
|
3173
|
+
result += line.slice(start, curr) + "\n" + line.slice(curr + 1);
|
|
3174
|
+
} else {
|
|
3175
|
+
result += line.slice(start);
|
|
3176
|
+
}
|
|
3177
|
+
return result.slice(1);
|
|
3178
|
+
}
|
|
3179
|
+
function escapeString(string) {
|
|
3180
|
+
let result = "";
|
|
3181
|
+
let char = 0;
|
|
3182
|
+
for (let i = 0; i < string.length; char >= 65536 ? i += 2 : i++) {
|
|
3183
|
+
char = codePointAt(string, i);
|
|
3184
|
+
const escapeSeq = ESCAPE_SEQUENCES[char];
|
|
3185
|
+
if (!escapeSeq && isPrintable(char)) {
|
|
3186
|
+
result += string[i];
|
|
3187
|
+
if (char >= 65536) result += string[i + 1];
|
|
3188
|
+
} else {
|
|
3189
|
+
result += escapeSeq || encodeHex(char);
|
|
3190
|
+
}
|
|
3191
|
+
}
|
|
3192
|
+
return result;
|
|
3193
|
+
}
|
|
3194
|
+
function writeFlowSequence(state, level, object) {
|
|
3195
|
+
let _result = "";
|
|
3196
|
+
const _tag = state.tag;
|
|
3197
|
+
for (let index = 0, length = object.length; index < length; index += 1) {
|
|
3198
|
+
let value = object[index];
|
|
3199
|
+
if (state.replacer) {
|
|
3200
|
+
value = state.replacer.call(object, String(index), value);
|
|
3201
|
+
}
|
|
3202
|
+
if (writeNode(state, level, value, false, false) || typeof value === "undefined" && writeNode(state, level, null, false, false)) {
|
|
3203
|
+
if (_result !== "") _result += "," + (!state.condenseFlow ? " " : "");
|
|
3204
|
+
_result += state.dump;
|
|
3205
|
+
}
|
|
3206
|
+
}
|
|
3207
|
+
state.tag = _tag;
|
|
3208
|
+
state.dump = "[" + _result + "]";
|
|
3209
|
+
}
|
|
3210
|
+
function writeBlockSequence(state, level, object, compact) {
|
|
3211
|
+
let _result = "";
|
|
3212
|
+
const _tag = state.tag;
|
|
3213
|
+
for (let index = 0, length = object.length; index < length; index += 1) {
|
|
3214
|
+
let value = object[index];
|
|
3215
|
+
if (state.replacer) {
|
|
3216
|
+
value = state.replacer.call(object, String(index), value);
|
|
3217
|
+
}
|
|
3218
|
+
if (writeNode(state, level + 1, value, true, true, false, true) || typeof value === "undefined" && writeNode(state, level + 1, null, true, true, false, true)) {
|
|
3219
|
+
if (!compact || _result !== "") {
|
|
3220
|
+
_result += generateNextLine(state, level);
|
|
3221
|
+
}
|
|
3222
|
+
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
3223
|
+
_result += "-";
|
|
3224
|
+
} else {
|
|
3225
|
+
_result += "- ";
|
|
3226
|
+
}
|
|
3227
|
+
_result += state.dump;
|
|
3228
|
+
}
|
|
3229
|
+
}
|
|
3230
|
+
state.tag = _tag;
|
|
3231
|
+
state.dump = _result || "[]";
|
|
3232
|
+
}
|
|
3233
|
+
function writeFlowMapping(state, level, object) {
|
|
3234
|
+
let _result = "";
|
|
3235
|
+
const _tag = state.tag;
|
|
3236
|
+
const objectKeyList = Object.keys(object);
|
|
3237
|
+
for (let index = 0, length = objectKeyList.length; index < length; index += 1) {
|
|
3238
|
+
let pairBuffer = "";
|
|
3239
|
+
if (_result !== "") pairBuffer += ", ";
|
|
3240
|
+
if (state.condenseFlow) pairBuffer += '"';
|
|
3241
|
+
const objectKey = objectKeyList[index];
|
|
3242
|
+
let objectValue = object[objectKey];
|
|
3243
|
+
if (state.replacer) {
|
|
3244
|
+
objectValue = state.replacer.call(object, objectKey, objectValue);
|
|
3245
|
+
}
|
|
3246
|
+
if (!writeNode(state, level, objectKey, false, false)) {
|
|
3247
|
+
continue;
|
|
3248
|
+
}
|
|
3249
|
+
if (state.dump.length > 1024) pairBuffer += "? ";
|
|
3250
|
+
pairBuffer += state.dump + (state.condenseFlow ? '"' : "") + ":" + (state.condenseFlow ? "" : " ");
|
|
3251
|
+
if (!writeNode(state, level, objectValue, false, false)) {
|
|
3252
|
+
continue;
|
|
3253
|
+
}
|
|
3254
|
+
pairBuffer += state.dump;
|
|
3255
|
+
_result += pairBuffer;
|
|
3256
|
+
}
|
|
3257
|
+
state.tag = _tag;
|
|
3258
|
+
state.dump = "{" + _result + "}";
|
|
3259
|
+
}
|
|
3260
|
+
function writeBlockMapping(state, level, object, compact) {
|
|
3261
|
+
let _result = "";
|
|
3262
|
+
const _tag = state.tag;
|
|
3263
|
+
const objectKeyList = Object.keys(object);
|
|
3264
|
+
if (state.sortKeys === true) {
|
|
3265
|
+
objectKeyList.sort();
|
|
3266
|
+
} else if (typeof state.sortKeys === "function") {
|
|
3267
|
+
objectKeyList.sort(state.sortKeys);
|
|
3268
|
+
} else if (state.sortKeys) {
|
|
3269
|
+
throw new YAMLException("sortKeys must be a boolean or a function");
|
|
3270
|
+
}
|
|
3271
|
+
for (let index = 0, length = objectKeyList.length; index < length; index += 1) {
|
|
3272
|
+
let pairBuffer = "";
|
|
3273
|
+
if (!compact || _result !== "") {
|
|
3274
|
+
pairBuffer += generateNextLine(state, level);
|
|
3275
|
+
}
|
|
3276
|
+
const objectKey = objectKeyList[index];
|
|
3277
|
+
let objectValue = object[objectKey];
|
|
3278
|
+
if (state.replacer) {
|
|
3279
|
+
objectValue = state.replacer.call(object, objectKey, objectValue);
|
|
3280
|
+
}
|
|
3281
|
+
if (!writeNode(state, level + 1, objectKey, true, true, true)) {
|
|
3282
|
+
continue;
|
|
3283
|
+
}
|
|
3284
|
+
const explicitPair = state.tag !== null && state.tag !== "?" || state.dump && state.dump.length > 1024;
|
|
3285
|
+
if (explicitPair) {
|
|
3286
|
+
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
3287
|
+
pairBuffer += "?";
|
|
3288
|
+
} else {
|
|
3289
|
+
pairBuffer += "? ";
|
|
3290
|
+
}
|
|
3291
|
+
}
|
|
3292
|
+
pairBuffer += state.dump;
|
|
3293
|
+
if (explicitPair) {
|
|
3294
|
+
pairBuffer += generateNextLine(state, level);
|
|
3295
|
+
}
|
|
3296
|
+
if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
|
|
3297
|
+
continue;
|
|
3298
|
+
}
|
|
3299
|
+
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
3300
|
+
pairBuffer += ":";
|
|
3301
|
+
} else {
|
|
3302
|
+
pairBuffer += ": ";
|
|
3303
|
+
}
|
|
3304
|
+
pairBuffer += state.dump;
|
|
3305
|
+
_result += pairBuffer;
|
|
3306
|
+
}
|
|
3307
|
+
state.tag = _tag;
|
|
3308
|
+
state.dump = _result || "{}";
|
|
3309
|
+
}
|
|
3310
|
+
function detectType(state, object, explicit) {
|
|
3311
|
+
const typeList = explicit ? state.explicitTypes : state.implicitTypes;
|
|
3312
|
+
for (let index = 0, length = typeList.length; index < length; index += 1) {
|
|
3313
|
+
const type = typeList[index];
|
|
3314
|
+
if ((type.instanceOf || type.predicate) && (!type.instanceOf || typeof object === "object" && object instanceof type.instanceOf) && (!type.predicate || type.predicate(object))) {
|
|
3315
|
+
if (explicit) {
|
|
3316
|
+
if (type.multi && type.representName) {
|
|
3317
|
+
state.tag = type.representName(object);
|
|
3318
|
+
} else {
|
|
3319
|
+
state.tag = type.tag;
|
|
3320
|
+
}
|
|
3321
|
+
} else {
|
|
3322
|
+
state.tag = "?";
|
|
3323
|
+
}
|
|
3324
|
+
if (type.represent) {
|
|
3325
|
+
const style = state.styleMap[type.tag] || type.defaultStyle;
|
|
3326
|
+
let _result;
|
|
3327
|
+
if (_toString.call(type.represent) === "[object Function]") {
|
|
3328
|
+
_result = type.represent(object, style);
|
|
3329
|
+
} else if (_hasOwnProperty.call(type.represent, style)) {
|
|
3330
|
+
_result = type.represent[style](object, style);
|
|
3331
|
+
} else {
|
|
3332
|
+
throw new YAMLException("!<" + type.tag + '> tag resolver accepts not "' + style + '" style');
|
|
3333
|
+
}
|
|
3334
|
+
state.dump = _result;
|
|
3335
|
+
}
|
|
3336
|
+
return true;
|
|
3337
|
+
}
|
|
3338
|
+
}
|
|
3339
|
+
return false;
|
|
3340
|
+
}
|
|
3341
|
+
function writeNode(state, level, object, block, compact, iskey, isblockseq) {
|
|
3342
|
+
state.tag = null;
|
|
3343
|
+
state.dump = object;
|
|
3344
|
+
if (!detectType(state, object, false)) {
|
|
3345
|
+
detectType(state, object, true);
|
|
3346
|
+
}
|
|
3347
|
+
const type = _toString.call(state.dump);
|
|
3348
|
+
const inblock = block;
|
|
3349
|
+
if (block) {
|
|
3350
|
+
block = state.flowLevel < 0 || state.flowLevel > level;
|
|
3351
|
+
}
|
|
3352
|
+
const objectOrArray = type === "[object Object]" || type === "[object Array]";
|
|
3353
|
+
let duplicateIndex;
|
|
3354
|
+
let duplicate;
|
|
3355
|
+
if (objectOrArray) {
|
|
3356
|
+
duplicateIndex = state.duplicates.indexOf(object);
|
|
3357
|
+
duplicate = duplicateIndex !== -1;
|
|
3358
|
+
}
|
|
3359
|
+
if (state.tag !== null && state.tag !== "?" || duplicate || state.indent !== 2 && level > 0) {
|
|
3360
|
+
compact = false;
|
|
3361
|
+
}
|
|
3362
|
+
if (duplicate && state.usedDuplicates[duplicateIndex]) {
|
|
3363
|
+
state.dump = "*ref_" + duplicateIndex;
|
|
3364
|
+
} else {
|
|
3365
|
+
if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
|
|
3366
|
+
state.usedDuplicates[duplicateIndex] = true;
|
|
3367
|
+
}
|
|
3368
|
+
if (type === "[object Object]") {
|
|
3369
|
+
if (block && Object.keys(state.dump).length !== 0) {
|
|
3370
|
+
writeBlockMapping(state, level, state.dump, compact);
|
|
3371
|
+
if (duplicate) {
|
|
3372
|
+
state.dump = "&ref_" + duplicateIndex + state.dump;
|
|
3373
|
+
}
|
|
3374
|
+
} else {
|
|
3375
|
+
writeFlowMapping(state, level, state.dump);
|
|
3376
|
+
if (duplicate) {
|
|
3377
|
+
state.dump = "&ref_" + duplicateIndex + " " + state.dump;
|
|
3378
|
+
}
|
|
3379
|
+
}
|
|
3380
|
+
} else if (type === "[object Array]") {
|
|
3381
|
+
if (block && state.dump.length !== 0) {
|
|
3382
|
+
if (state.noArrayIndent && !isblockseq && level > 0) {
|
|
3383
|
+
writeBlockSequence(state, level - 1, state.dump, compact);
|
|
3384
|
+
} else {
|
|
3385
|
+
writeBlockSequence(state, level, state.dump, compact);
|
|
3386
|
+
}
|
|
3387
|
+
if (duplicate) {
|
|
3388
|
+
state.dump = "&ref_" + duplicateIndex + state.dump;
|
|
3389
|
+
}
|
|
3390
|
+
} else {
|
|
3391
|
+
writeFlowSequence(state, level, state.dump);
|
|
3392
|
+
if (duplicate) {
|
|
3393
|
+
state.dump = "&ref_" + duplicateIndex + " " + state.dump;
|
|
3394
|
+
}
|
|
3395
|
+
}
|
|
3396
|
+
} else if (type === "[object String]") {
|
|
3397
|
+
if (state.tag !== "?") {
|
|
3398
|
+
writeScalar(state, state.dump, level, iskey, inblock);
|
|
3399
|
+
}
|
|
3400
|
+
} else if (type === "[object Undefined]") {
|
|
3401
|
+
return false;
|
|
3402
|
+
} else {
|
|
3403
|
+
if (state.skipInvalid) return false;
|
|
3404
|
+
throw new YAMLException("unacceptable kind of an object to dump " + type);
|
|
3405
|
+
}
|
|
3406
|
+
if (state.tag !== null && state.tag !== "?") {
|
|
3407
|
+
let tagStr = encodeURI(
|
|
3408
|
+
state.tag[0] === "!" ? state.tag.slice(1) : state.tag
|
|
3409
|
+
).replace(/!/g, "%21");
|
|
3410
|
+
if (state.tag[0] === "!") {
|
|
3411
|
+
tagStr = "!" + tagStr;
|
|
3412
|
+
} else if (tagStr.slice(0, 18) === "tag:yaml.org,2002:") {
|
|
3413
|
+
tagStr = "!!" + tagStr.slice(18);
|
|
3414
|
+
} else {
|
|
3415
|
+
tagStr = "!<" + tagStr + ">";
|
|
3416
|
+
}
|
|
3417
|
+
state.dump = tagStr + " " + state.dump;
|
|
3418
|
+
}
|
|
3419
|
+
}
|
|
3420
|
+
return true;
|
|
3421
|
+
}
|
|
3422
|
+
function getDuplicateReferences(object, state) {
|
|
3423
|
+
const objects = [];
|
|
3424
|
+
const duplicatesIndexes = [];
|
|
3425
|
+
inspectNode(object, objects, duplicatesIndexes);
|
|
3426
|
+
const length = duplicatesIndexes.length;
|
|
3427
|
+
for (let index = 0; index < length; index += 1) {
|
|
3428
|
+
state.duplicates.push(objects[duplicatesIndexes[index]]);
|
|
3429
|
+
}
|
|
3430
|
+
state.usedDuplicates = new Array(length);
|
|
3431
|
+
}
|
|
3432
|
+
function inspectNode(object, objects, duplicatesIndexes) {
|
|
3433
|
+
if (object !== null && typeof object === "object") {
|
|
3434
|
+
const index = objects.indexOf(object);
|
|
3435
|
+
if (index !== -1) {
|
|
3436
|
+
if (duplicatesIndexes.indexOf(index) === -1) {
|
|
3437
|
+
duplicatesIndexes.push(index);
|
|
3438
|
+
}
|
|
3439
|
+
} else {
|
|
3440
|
+
objects.push(object);
|
|
3441
|
+
if (Array.isArray(object)) {
|
|
3442
|
+
for (let i = 0, length = object.length; i < length; i += 1) {
|
|
3443
|
+
inspectNode(object[i], objects, duplicatesIndexes);
|
|
3444
|
+
}
|
|
3445
|
+
} else {
|
|
3446
|
+
const objectKeyList = Object.keys(object);
|
|
3447
|
+
for (let i = 0, length = objectKeyList.length; i < length; i += 1) {
|
|
3448
|
+
inspectNode(object[objectKeyList[i]], objects, duplicatesIndexes);
|
|
3449
|
+
}
|
|
3450
|
+
}
|
|
3451
|
+
}
|
|
3452
|
+
}
|
|
3453
|
+
}
|
|
3454
|
+
function dump(input, options) {
|
|
3455
|
+
options = options || {};
|
|
3456
|
+
const state = new State(options);
|
|
3457
|
+
if (!state.noRefs) getDuplicateReferences(input, state);
|
|
3458
|
+
let value = input;
|
|
3459
|
+
if (state.replacer) {
|
|
3460
|
+
value = state.replacer.call({ "": value }, "", value);
|
|
3461
|
+
}
|
|
3462
|
+
if (writeNode(state, 0, value, true, true)) return state.dump + "\n";
|
|
3463
|
+
return "";
|
|
3464
|
+
}
|
|
3465
|
+
module.exports.dump = dump;
|
|
3466
|
+
}
|
|
3467
|
+
});
|
|
3468
|
+
|
|
3469
|
+
// node_modules/js-yaml/index.js
|
|
3470
|
+
var require_js_yaml = __commonJS({
|
|
3471
|
+
"node_modules/js-yaml/index.js"(exports, module) {
|
|
3472
|
+
"use strict";
|
|
3473
|
+
var loader = require_loader();
|
|
3474
|
+
var dumper = require_dumper();
|
|
3475
|
+
function renamed(from, to) {
|
|
3476
|
+
return function() {
|
|
3477
|
+
throw new Error("Function yaml." + from + " is removed in js-yaml 4. Use yaml." + to + " instead, which is now safe by default.");
|
|
3478
|
+
};
|
|
3479
|
+
}
|
|
3480
|
+
module.exports.Type = require_type();
|
|
3481
|
+
module.exports.Schema = require_schema();
|
|
3482
|
+
module.exports.FAILSAFE_SCHEMA = require_failsafe();
|
|
3483
|
+
module.exports.JSON_SCHEMA = require_json();
|
|
3484
|
+
module.exports.CORE_SCHEMA = require_core();
|
|
3485
|
+
module.exports.DEFAULT_SCHEMA = require_default();
|
|
3486
|
+
module.exports.load = loader.load;
|
|
3487
|
+
module.exports.loadAll = loader.loadAll;
|
|
3488
|
+
module.exports.dump = dumper.dump;
|
|
3489
|
+
module.exports.YAMLException = require_exception();
|
|
3490
|
+
module.exports.types = {
|
|
3491
|
+
binary: require_binary(),
|
|
3492
|
+
float: require_float(),
|
|
3493
|
+
map: require_map(),
|
|
3494
|
+
null: require_null(),
|
|
3495
|
+
pairs: require_pairs(),
|
|
3496
|
+
set: require_set(),
|
|
3497
|
+
timestamp: require_timestamp(),
|
|
3498
|
+
bool: require_bool(),
|
|
3499
|
+
int: require_int(),
|
|
3500
|
+
merge: require_merge(),
|
|
3501
|
+
omap: require_omap(),
|
|
3502
|
+
seq: require_seq(),
|
|
3503
|
+
str: require_str()
|
|
3504
|
+
};
|
|
3505
|
+
module.exports.safeLoad = renamed("safeLoad", "load");
|
|
3506
|
+
module.exports.safeLoadAll = renamed("safeLoadAll", "loadAll");
|
|
3507
|
+
module.exports.safeDump = renamed("safeDump", "dump");
|
|
3508
|
+
}
|
|
3509
|
+
});
|
|
3510
|
+
|
|
3511
|
+
// node_modules/cosmiconfig/dist/loaders.js
|
|
3512
|
+
var require_loaders = __commonJS({
|
|
3513
|
+
"node_modules/cosmiconfig/dist/loaders.js"(exports) {
|
|
3514
|
+
"use strict";
|
|
3515
|
+
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
3516
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
3517
|
+
};
|
|
3518
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3519
|
+
exports.loadTs = exports.loadTsSync = exports.loadYaml = exports.loadJson = exports.loadJs = exports.loadJsSync = void 0;
|
|
3520
|
+
var fs_1 = __require("fs");
|
|
3521
|
+
var promises_1 = __require("fs/promises");
|
|
3522
|
+
var path_1 = __importDefault(__require("path"));
|
|
3523
|
+
var url_1 = __require("url");
|
|
3524
|
+
var crypto_1 = __require("crypto");
|
|
3525
|
+
var importFresh;
|
|
3526
|
+
var loadJsSync = function loadJsSync2(filepath) {
|
|
3527
|
+
if (importFresh === void 0) {
|
|
3528
|
+
importFresh = require_import_fresh();
|
|
3529
|
+
}
|
|
3530
|
+
return importFresh(filepath);
|
|
3531
|
+
};
|
|
3532
|
+
exports.loadJsSync = loadJsSync;
|
|
3533
|
+
var loadJs = async function loadJs2(filepath) {
|
|
3534
|
+
try {
|
|
3535
|
+
const { href } = (0, url_1.pathToFileURL)(await (0, promises_1.realpath)(filepath));
|
|
3536
|
+
return (await import(href)).default;
|
|
3537
|
+
} catch (error) {
|
|
3538
|
+
try {
|
|
3539
|
+
return (0, exports.loadJsSync)(filepath, "");
|
|
3540
|
+
} catch (requireError) {
|
|
3541
|
+
if (requireError.code === "ERR_REQUIRE_ESM" || requireError instanceof SyntaxError && requireError.toString().includes("Cannot use import statement outside a module")) {
|
|
3542
|
+
throw error;
|
|
3543
|
+
}
|
|
3544
|
+
throw requireError;
|
|
3545
|
+
}
|
|
3546
|
+
}
|
|
3547
|
+
};
|
|
3548
|
+
exports.loadJs = loadJs;
|
|
3549
|
+
var parseJson;
|
|
3550
|
+
var loadJson = function loadJson2(filepath, content) {
|
|
3551
|
+
if (parseJson === void 0) {
|
|
3552
|
+
parseJson = require_parse_json();
|
|
3553
|
+
}
|
|
3554
|
+
try {
|
|
3555
|
+
return parseJson(content);
|
|
3556
|
+
} catch (error) {
|
|
3557
|
+
error.message = `JSON Error in ${filepath}:
|
|
3558
|
+
${error.message}`;
|
|
3559
|
+
throw error;
|
|
3560
|
+
}
|
|
3561
|
+
};
|
|
3562
|
+
exports.loadJson = loadJson;
|
|
3563
|
+
var yaml;
|
|
3564
|
+
var loadYaml = function loadYaml2(filepath, content) {
|
|
3565
|
+
if (yaml === void 0) {
|
|
3566
|
+
yaml = require_js_yaml();
|
|
3567
|
+
}
|
|
3568
|
+
try {
|
|
3569
|
+
return yaml.load(content);
|
|
3570
|
+
} catch (error) {
|
|
3571
|
+
error.message = `YAML Error in ${filepath}:
|
|
3572
|
+
${error.message}`;
|
|
3573
|
+
throw error;
|
|
3574
|
+
}
|
|
3575
|
+
};
|
|
3576
|
+
exports.loadYaml = loadYaml;
|
|
3577
|
+
var typescript;
|
|
3578
|
+
var loadTsSync = function loadTsSync2(filepath, content) {
|
|
3579
|
+
if (typescript === void 0) {
|
|
3580
|
+
typescript = __require("typescript");
|
|
3581
|
+
}
|
|
3582
|
+
const compiledFilepath = `${filepath}.${(0, crypto_1.randomUUID)()}.cjs`;
|
|
3583
|
+
try {
|
|
3584
|
+
const config = resolveTsConfig(path_1.default.dirname(filepath)) ?? {};
|
|
3585
|
+
config.compilerOptions = {
|
|
3586
|
+
...config.compilerOptions,
|
|
3587
|
+
module: typescript.ModuleKind.NodeNext,
|
|
3588
|
+
moduleResolution: typescript.ModuleResolutionKind.NodeNext,
|
|
3589
|
+
target: typescript.ScriptTarget.ES2022,
|
|
3590
|
+
noEmit: false
|
|
3591
|
+
};
|
|
3592
|
+
content = typescript.transpileModule(content, config).outputText;
|
|
3593
|
+
(0, fs_1.writeFileSync)(compiledFilepath, content);
|
|
3594
|
+
return (0, exports.loadJsSync)(compiledFilepath, content).default;
|
|
3595
|
+
} catch (error) {
|
|
3596
|
+
error.message = `TypeScript Error in ${filepath}:
|
|
3597
|
+
${error.message}`;
|
|
3598
|
+
throw error;
|
|
3599
|
+
} finally {
|
|
3600
|
+
if ((0, fs_1.existsSync)(compiledFilepath)) {
|
|
3601
|
+
(0, fs_1.rmSync)(compiledFilepath);
|
|
3602
|
+
}
|
|
3603
|
+
}
|
|
3604
|
+
};
|
|
3605
|
+
exports.loadTsSync = loadTsSync;
|
|
3606
|
+
var loadTs = async function loadTs2(filepath, content) {
|
|
3607
|
+
if (typescript === void 0) {
|
|
3608
|
+
typescript = (await import("typescript")).default;
|
|
3609
|
+
}
|
|
3610
|
+
const compiledFilepath = `${filepath}.${(0, crypto_1.randomUUID)()}.mjs`;
|
|
3611
|
+
let transpiledContent;
|
|
3612
|
+
try {
|
|
3613
|
+
try {
|
|
3614
|
+
const config = resolveTsConfig(path_1.default.dirname(filepath)) ?? {};
|
|
3615
|
+
config.compilerOptions = {
|
|
3616
|
+
...config.compilerOptions,
|
|
3617
|
+
module: typescript.ModuleKind.ES2022,
|
|
3618
|
+
moduleResolution: typescript.ModuleResolutionKind.Bundler,
|
|
3619
|
+
target: typescript.ScriptTarget.ES2022,
|
|
3620
|
+
noEmit: false
|
|
3621
|
+
};
|
|
3622
|
+
transpiledContent = typescript.transpileModule(content, config).outputText;
|
|
3623
|
+
await (0, promises_1.writeFile)(compiledFilepath, transpiledContent);
|
|
3624
|
+
} catch (error) {
|
|
3625
|
+
error.message = `TypeScript Error in ${filepath}:
|
|
3626
|
+
${error.message}`;
|
|
3627
|
+
throw error;
|
|
3628
|
+
}
|
|
3629
|
+
return await (0, exports.loadJs)(compiledFilepath, transpiledContent);
|
|
3630
|
+
} finally {
|
|
3631
|
+
if ((0, fs_1.existsSync)(compiledFilepath)) {
|
|
3632
|
+
await (0, promises_1.rm)(compiledFilepath);
|
|
3633
|
+
}
|
|
3634
|
+
}
|
|
3635
|
+
};
|
|
3636
|
+
exports.loadTs = loadTs;
|
|
3637
|
+
function resolveTsConfig(directory) {
|
|
3638
|
+
const filePath = typescript.findConfigFile(directory, (fileName) => {
|
|
3639
|
+
return typescript.sys.fileExists(fileName);
|
|
3640
|
+
});
|
|
3641
|
+
if (filePath !== void 0) {
|
|
3642
|
+
const { config, error } = typescript.readConfigFile(filePath, (path) => typescript.sys.readFile(path));
|
|
3643
|
+
if (error) {
|
|
3644
|
+
throw new Error(`Error in ${filePath}: ${error.messageText.toString()}`);
|
|
3645
|
+
}
|
|
3646
|
+
return config;
|
|
3647
|
+
}
|
|
3648
|
+
return;
|
|
3649
|
+
}
|
|
3650
|
+
}
|
|
3651
|
+
});
|
|
3652
|
+
|
|
3653
|
+
// node_modules/cosmiconfig/dist/defaults.js
|
|
3654
|
+
var require_defaults = __commonJS({
|
|
3655
|
+
"node_modules/cosmiconfig/dist/defaults.js"(exports) {
|
|
3656
|
+
"use strict";
|
|
3657
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3658
|
+
exports.defaultLoadersSync = exports.defaultLoaders = exports.metaSearchPlaces = exports.globalConfigSearchPlacesSync = exports.globalConfigSearchPlaces = void 0;
|
|
3659
|
+
exports.getDefaultSearchPlaces = getDefaultSearchPlaces;
|
|
3660
|
+
exports.getDefaultSearchPlacesSync = getDefaultSearchPlacesSync;
|
|
3661
|
+
var loaders_1 = require_loaders();
|
|
3662
|
+
function getDefaultSearchPlaces(moduleName) {
|
|
3663
|
+
return [
|
|
3664
|
+
"package.json",
|
|
3665
|
+
`.${moduleName}rc`,
|
|
3666
|
+
`.${moduleName}rc.json`,
|
|
3667
|
+
`.${moduleName}rc.yaml`,
|
|
3668
|
+
`.${moduleName}rc.yml`,
|
|
3669
|
+
`.${moduleName}rc.js`,
|
|
3670
|
+
`.${moduleName}rc.ts`,
|
|
3671
|
+
`.${moduleName}rc.cjs`,
|
|
3672
|
+
`.${moduleName}rc.mjs`,
|
|
3673
|
+
`.config/${moduleName}rc`,
|
|
3674
|
+
`.config/${moduleName}rc.json`,
|
|
3675
|
+
`.config/${moduleName}rc.yaml`,
|
|
3676
|
+
`.config/${moduleName}rc.yml`,
|
|
3677
|
+
`.config/${moduleName}rc.js`,
|
|
3678
|
+
`.config/${moduleName}rc.ts`,
|
|
3679
|
+
`.config/${moduleName}rc.cjs`,
|
|
3680
|
+
`.config/${moduleName}rc.mjs`,
|
|
3681
|
+
`${moduleName}.config.js`,
|
|
3682
|
+
`${moduleName}.config.ts`,
|
|
3683
|
+
`${moduleName}.config.cjs`,
|
|
3684
|
+
`${moduleName}.config.mjs`
|
|
3685
|
+
];
|
|
3686
|
+
}
|
|
3687
|
+
function getDefaultSearchPlacesSync(moduleName) {
|
|
3688
|
+
return [
|
|
3689
|
+
"package.json",
|
|
3690
|
+
`.${moduleName}rc`,
|
|
3691
|
+
`.${moduleName}rc.json`,
|
|
3692
|
+
`.${moduleName}rc.yaml`,
|
|
3693
|
+
`.${moduleName}rc.yml`,
|
|
3694
|
+
`.${moduleName}rc.js`,
|
|
3695
|
+
`.${moduleName}rc.ts`,
|
|
3696
|
+
`.${moduleName}rc.cjs`,
|
|
3697
|
+
`.config/${moduleName}rc`,
|
|
3698
|
+
`.config/${moduleName}rc.json`,
|
|
3699
|
+
`.config/${moduleName}rc.yaml`,
|
|
3700
|
+
`.config/${moduleName}rc.yml`,
|
|
3701
|
+
`.config/${moduleName}rc.js`,
|
|
3702
|
+
`.config/${moduleName}rc.ts`,
|
|
3703
|
+
`.config/${moduleName}rc.cjs`,
|
|
3704
|
+
`${moduleName}.config.js`,
|
|
3705
|
+
`${moduleName}.config.ts`,
|
|
3706
|
+
`${moduleName}.config.cjs`
|
|
3707
|
+
];
|
|
3708
|
+
}
|
|
3709
|
+
exports.globalConfigSearchPlaces = [
|
|
3710
|
+
"config",
|
|
3711
|
+
"config.json",
|
|
3712
|
+
"config.yaml",
|
|
3713
|
+
"config.yml",
|
|
3714
|
+
"config.js",
|
|
3715
|
+
"config.ts",
|
|
3716
|
+
"config.cjs",
|
|
3717
|
+
"config.mjs"
|
|
3718
|
+
];
|
|
3719
|
+
exports.globalConfigSearchPlacesSync = [
|
|
3720
|
+
"config",
|
|
3721
|
+
"config.json",
|
|
3722
|
+
"config.yaml",
|
|
3723
|
+
"config.yml",
|
|
3724
|
+
"config.js",
|
|
3725
|
+
"config.ts",
|
|
3726
|
+
"config.cjs"
|
|
3727
|
+
];
|
|
3728
|
+
exports.metaSearchPlaces = [
|
|
3729
|
+
"package.json",
|
|
3730
|
+
"package.yaml",
|
|
3731
|
+
".config/config.json",
|
|
3732
|
+
".config/config.yaml",
|
|
3733
|
+
".config/config.yml",
|
|
3734
|
+
".config/config.js",
|
|
3735
|
+
".config/config.ts",
|
|
3736
|
+
".config/config.cjs",
|
|
3737
|
+
".config/config.mjs"
|
|
3738
|
+
];
|
|
3739
|
+
exports.defaultLoaders = Object.freeze({
|
|
3740
|
+
".mjs": loaders_1.loadJs,
|
|
3741
|
+
".cjs": loaders_1.loadJs,
|
|
3742
|
+
".js": loaders_1.loadJs,
|
|
3743
|
+
".ts": loaders_1.loadTs,
|
|
3744
|
+
".json": loaders_1.loadJson,
|
|
3745
|
+
".yaml": loaders_1.loadYaml,
|
|
3746
|
+
".yml": loaders_1.loadYaml,
|
|
3747
|
+
noExt: loaders_1.loadYaml
|
|
3748
|
+
});
|
|
3749
|
+
exports.defaultLoadersSync = Object.freeze({
|
|
3750
|
+
".cjs": loaders_1.loadJsSync,
|
|
3751
|
+
".js": loaders_1.loadJsSync,
|
|
3752
|
+
".ts": loaders_1.loadTsSync,
|
|
3753
|
+
".json": loaders_1.loadJson,
|
|
3754
|
+
".yaml": loaders_1.loadYaml,
|
|
3755
|
+
".yml": loaders_1.loadYaml,
|
|
3756
|
+
noExt: loaders_1.loadYaml
|
|
3757
|
+
});
|
|
3758
|
+
}
|
|
3759
|
+
});
|
|
3760
|
+
|
|
3761
|
+
// node_modules/env-paths/index.js
|
|
3762
|
+
var require_env_paths = __commonJS({
|
|
3763
|
+
"node_modules/env-paths/index.js"(exports, module) {
|
|
3764
|
+
"use strict";
|
|
3765
|
+
var path = __require("path");
|
|
3766
|
+
var os = __require("os");
|
|
3767
|
+
var homedir = os.homedir();
|
|
3768
|
+
var tmpdir = os.tmpdir();
|
|
3769
|
+
var { env } = process;
|
|
3770
|
+
var macos = (name) => {
|
|
3771
|
+
const library = path.join(homedir, "Library");
|
|
3772
|
+
return {
|
|
3773
|
+
data: path.join(library, "Application Support", name),
|
|
3774
|
+
config: path.join(library, "Preferences", name),
|
|
3775
|
+
cache: path.join(library, "Caches", name),
|
|
3776
|
+
log: path.join(library, "Logs", name),
|
|
3777
|
+
temp: path.join(tmpdir, name)
|
|
3778
|
+
};
|
|
3779
|
+
};
|
|
3780
|
+
var windows = (name) => {
|
|
3781
|
+
const appData = env.APPDATA || path.join(homedir, "AppData", "Roaming");
|
|
3782
|
+
const localAppData = env.LOCALAPPDATA || path.join(homedir, "AppData", "Local");
|
|
3783
|
+
return {
|
|
3784
|
+
// Data/config/cache/log are invented by me as Windows isn't opinionated about this
|
|
3785
|
+
data: path.join(localAppData, name, "Data"),
|
|
3786
|
+
config: path.join(appData, name, "Config"),
|
|
3787
|
+
cache: path.join(localAppData, name, "Cache"),
|
|
3788
|
+
log: path.join(localAppData, name, "Log"),
|
|
3789
|
+
temp: path.join(tmpdir, name)
|
|
3790
|
+
};
|
|
3791
|
+
};
|
|
3792
|
+
var linux = (name) => {
|
|
3793
|
+
const username = path.basename(homedir);
|
|
3794
|
+
return {
|
|
3795
|
+
data: path.join(env.XDG_DATA_HOME || path.join(homedir, ".local", "share"), name),
|
|
3796
|
+
config: path.join(env.XDG_CONFIG_HOME || path.join(homedir, ".config"), name),
|
|
3797
|
+
cache: path.join(env.XDG_CACHE_HOME || path.join(homedir, ".cache"), name),
|
|
3798
|
+
// https://wiki.debian.org/XDGBaseDirectorySpecification#state
|
|
3799
|
+
log: path.join(env.XDG_STATE_HOME || path.join(homedir, ".local", "state"), name),
|
|
3800
|
+
temp: path.join(tmpdir, username, name)
|
|
3801
|
+
};
|
|
3802
|
+
};
|
|
3803
|
+
var envPaths = (name, options) => {
|
|
3804
|
+
if (typeof name !== "string") {
|
|
3805
|
+
throw new TypeError(`Expected string, got ${typeof name}`);
|
|
3806
|
+
}
|
|
3807
|
+
options = Object.assign({ suffix: "nodejs" }, options);
|
|
3808
|
+
if (options.suffix) {
|
|
3809
|
+
name += `-${options.suffix}`;
|
|
3810
|
+
}
|
|
3811
|
+
if (process.platform === "darwin") {
|
|
3812
|
+
return macos(name);
|
|
3813
|
+
}
|
|
3814
|
+
if (process.platform === "win32") {
|
|
3815
|
+
return windows(name);
|
|
3816
|
+
}
|
|
3817
|
+
return linux(name);
|
|
3818
|
+
};
|
|
3819
|
+
module.exports = envPaths;
|
|
3820
|
+
module.exports.default = envPaths;
|
|
3821
|
+
}
|
|
3822
|
+
});
|
|
3823
|
+
|
|
3824
|
+
// node_modules/cosmiconfig/dist/util.js
|
|
3825
|
+
var require_util = __commonJS({
|
|
3826
|
+
"node_modules/cosmiconfig/dist/util.js"(exports) {
|
|
3827
|
+
"use strict";
|
|
3828
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
3829
|
+
if (k2 === void 0) k2 = k;
|
|
3830
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
3831
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
3832
|
+
desc = { enumerable: true, get: function() {
|
|
3833
|
+
return m[k];
|
|
3834
|
+
} };
|
|
3835
|
+
}
|
|
3836
|
+
Object.defineProperty(o, k2, desc);
|
|
3837
|
+
}) : (function(o, m, k, k2) {
|
|
3838
|
+
if (k2 === void 0) k2 = k;
|
|
3839
|
+
o[k2] = m[k];
|
|
3840
|
+
}));
|
|
3841
|
+
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
|
|
3842
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
3843
|
+
}) : function(o, v) {
|
|
3844
|
+
o["default"] = v;
|
|
3845
|
+
});
|
|
3846
|
+
var __importStar = exports && exports.__importStar || /* @__PURE__ */ (function() {
|
|
3847
|
+
var ownKeys = function(o) {
|
|
3848
|
+
ownKeys = Object.getOwnPropertyNames || function(o2) {
|
|
3849
|
+
var ar = [];
|
|
3850
|
+
for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
|
|
3851
|
+
return ar;
|
|
3852
|
+
};
|
|
3853
|
+
return ownKeys(o);
|
|
3854
|
+
};
|
|
3855
|
+
return function(mod) {
|
|
3856
|
+
if (mod && mod.__esModule) return mod;
|
|
3857
|
+
var result = {};
|
|
3858
|
+
if (mod != null) {
|
|
3859
|
+
for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
3860
|
+
}
|
|
3861
|
+
__setModuleDefault(result, mod);
|
|
3862
|
+
return result;
|
|
3863
|
+
};
|
|
3864
|
+
})();
|
|
3865
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3866
|
+
exports.emplace = emplace;
|
|
3867
|
+
exports.getPropertyByPath = getPropertyByPath;
|
|
3868
|
+
exports.removeUndefinedValuesFromObject = removeUndefinedValuesFromObject;
|
|
3869
|
+
exports.isDirectory = isDirectory;
|
|
3870
|
+
exports.isDirectorySync = isDirectorySync;
|
|
3871
|
+
var fs_1 = __importStar(__require("fs"));
|
|
3872
|
+
function emplace(map, key, fn) {
|
|
3873
|
+
const cached = map.get(key);
|
|
3874
|
+
if (cached !== void 0) {
|
|
3875
|
+
return cached;
|
|
3876
|
+
}
|
|
3877
|
+
const result = fn();
|
|
3878
|
+
map.set(key, result);
|
|
3879
|
+
return result;
|
|
3880
|
+
}
|
|
3881
|
+
function getPropertyByPath(source, path) {
|
|
3882
|
+
if (typeof path === "string" && Object.prototype.hasOwnProperty.call(source, path)) {
|
|
3883
|
+
return source[path];
|
|
3884
|
+
}
|
|
3885
|
+
const parsedPath = typeof path === "string" ? path.split(".") : path;
|
|
3886
|
+
return parsedPath.reduce((previous, key) => {
|
|
3887
|
+
if (previous === void 0) {
|
|
3888
|
+
return previous;
|
|
3889
|
+
}
|
|
3890
|
+
return previous[key];
|
|
3891
|
+
}, source);
|
|
3892
|
+
}
|
|
3893
|
+
function removeUndefinedValuesFromObject(options) {
|
|
3894
|
+
return Object.fromEntries(Object.entries(options).filter(([, value]) => value !== void 0));
|
|
3895
|
+
}
|
|
3896
|
+
async function isDirectory(path) {
|
|
3897
|
+
try {
|
|
3898
|
+
const stat = await fs_1.promises.stat(path);
|
|
3899
|
+
return stat.isDirectory();
|
|
3900
|
+
} catch (e) {
|
|
3901
|
+
if (e.code === "ENOENT") {
|
|
3902
|
+
return false;
|
|
3903
|
+
}
|
|
3904
|
+
throw e;
|
|
3905
|
+
}
|
|
3906
|
+
}
|
|
3907
|
+
function isDirectorySync(path) {
|
|
3908
|
+
try {
|
|
3909
|
+
const stat = fs_1.default.statSync(path);
|
|
3910
|
+
return stat.isDirectory();
|
|
3911
|
+
} catch (e) {
|
|
3912
|
+
if (e.code === "ENOENT") {
|
|
3913
|
+
return false;
|
|
3914
|
+
}
|
|
3915
|
+
throw e;
|
|
3916
|
+
}
|
|
3917
|
+
}
|
|
3918
|
+
}
|
|
3919
|
+
});
|
|
3920
|
+
|
|
3921
|
+
// node_modules/cosmiconfig/dist/ExplorerBase.js
|
|
3922
|
+
var require_ExplorerBase = __commonJS({
|
|
3923
|
+
"node_modules/cosmiconfig/dist/ExplorerBase.js"(exports) {
|
|
3924
|
+
"use strict";
|
|
3925
|
+
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
3926
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
3927
|
+
};
|
|
3928
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3929
|
+
exports.ExplorerBase = void 0;
|
|
3930
|
+
exports.getExtensionDescription = getExtensionDescription;
|
|
3931
|
+
var env_paths_1 = __importDefault(require_env_paths());
|
|
3932
|
+
var os_1 = __importDefault(__require("os"));
|
|
3933
|
+
var path_1 = __importDefault(__require("path"));
|
|
3934
|
+
var util_js_1 = require_util();
|
|
3935
|
+
var ExplorerBase = class {
|
|
3936
|
+
#loadingMetaConfig = false;
|
|
3937
|
+
config;
|
|
3938
|
+
loadCache;
|
|
3939
|
+
searchCache;
|
|
3940
|
+
constructor(options) {
|
|
3941
|
+
this.config = options;
|
|
3942
|
+
if (options.cache) {
|
|
3943
|
+
this.loadCache = /* @__PURE__ */ new Map();
|
|
3944
|
+
this.searchCache = /* @__PURE__ */ new Map();
|
|
3945
|
+
}
|
|
3946
|
+
this.#validateConfig();
|
|
3947
|
+
}
|
|
3948
|
+
set loadingMetaConfig(value) {
|
|
3949
|
+
this.#loadingMetaConfig = value;
|
|
3950
|
+
}
|
|
3951
|
+
#validateConfig() {
|
|
3952
|
+
const config = this.config;
|
|
3953
|
+
for (const place of config.searchPlaces) {
|
|
3954
|
+
const extension = path_1.default.extname(place);
|
|
3955
|
+
const loader = this.config.loaders[extension || "noExt"] ?? this.config.loaders["default"];
|
|
3956
|
+
if (loader === void 0) {
|
|
3957
|
+
throw new Error(`Missing loader for ${getExtensionDescription(place)}.`);
|
|
3958
|
+
}
|
|
3959
|
+
if (typeof loader !== "function") {
|
|
3960
|
+
throw new Error(`Loader for ${getExtensionDescription(place)} is not a function: Received ${typeof loader}.`);
|
|
3961
|
+
}
|
|
3962
|
+
}
|
|
3963
|
+
}
|
|
3964
|
+
clearLoadCache() {
|
|
3965
|
+
if (this.loadCache) {
|
|
3966
|
+
this.loadCache.clear();
|
|
3967
|
+
}
|
|
3968
|
+
}
|
|
3969
|
+
clearSearchCache() {
|
|
3970
|
+
if (this.searchCache) {
|
|
3971
|
+
this.searchCache.clear();
|
|
3972
|
+
}
|
|
3973
|
+
}
|
|
3974
|
+
clearCaches() {
|
|
3975
|
+
this.clearLoadCache();
|
|
3976
|
+
this.clearSearchCache();
|
|
3977
|
+
}
|
|
3978
|
+
toCosmiconfigResult(filepath, config) {
|
|
3979
|
+
if (config === null) {
|
|
3980
|
+
return null;
|
|
3981
|
+
}
|
|
3982
|
+
if (config === void 0) {
|
|
3983
|
+
return { filepath, config: void 0, isEmpty: true };
|
|
3984
|
+
}
|
|
3985
|
+
if (this.config.applyPackagePropertyPathToConfiguration || this.#loadingMetaConfig) {
|
|
3986
|
+
const packageProp = this.config.packageProp ?? this.config.moduleName;
|
|
3987
|
+
config = (0, util_js_1.getPropertyByPath)(config, packageProp);
|
|
3988
|
+
}
|
|
3989
|
+
if (config === void 0) {
|
|
3990
|
+
return { filepath, config: void 0, isEmpty: true };
|
|
3991
|
+
}
|
|
3992
|
+
return { config, filepath };
|
|
3993
|
+
}
|
|
3994
|
+
validateImports(containingFilePath, imports, importStack) {
|
|
3995
|
+
const fileDirectory = path_1.default.dirname(containingFilePath);
|
|
3996
|
+
for (const importPath of imports) {
|
|
3997
|
+
if (typeof importPath !== "string") {
|
|
3998
|
+
throw new Error(`${containingFilePath}: Key $import must contain a string or a list of strings`);
|
|
3999
|
+
}
|
|
4000
|
+
const fullPath = path_1.default.resolve(fileDirectory, importPath);
|
|
4001
|
+
if (fullPath === containingFilePath) {
|
|
4002
|
+
throw new Error(`Self-import detected in ${containingFilePath}`);
|
|
4003
|
+
}
|
|
4004
|
+
const idx = importStack.indexOf(fullPath);
|
|
4005
|
+
if (idx !== -1) {
|
|
4006
|
+
throw new Error(`Circular import detected:
|
|
4007
|
+
${[...importStack, fullPath].map((path, i) => `${i + 1}. ${path}`).join("\n")} (same as ${idx + 1}.)`);
|
|
4008
|
+
}
|
|
4009
|
+
}
|
|
4010
|
+
}
|
|
4011
|
+
getSearchPlacesForDir(dir, globalConfigPlaces) {
|
|
4012
|
+
return (dir.isGlobalConfig ? globalConfigPlaces : this.config.searchPlaces).map((place) => path_1.default.join(dir.path, place));
|
|
4013
|
+
}
|
|
4014
|
+
getGlobalConfigDir() {
|
|
4015
|
+
return (0, env_paths_1.default)(this.config.moduleName, { suffix: "" }).config;
|
|
4016
|
+
}
|
|
4017
|
+
*getGlobalDirs(startDir) {
|
|
4018
|
+
const stopDir = path_1.default.resolve(this.config.stopDir ?? os_1.default.homedir());
|
|
4019
|
+
yield { path: startDir, isGlobalConfig: false };
|
|
4020
|
+
let currentDir = startDir;
|
|
4021
|
+
while (currentDir !== stopDir) {
|
|
4022
|
+
const parentDir = path_1.default.dirname(currentDir);
|
|
4023
|
+
if (parentDir === currentDir) {
|
|
4024
|
+
break;
|
|
4025
|
+
}
|
|
4026
|
+
yield { path: parentDir, isGlobalConfig: false };
|
|
4027
|
+
currentDir = parentDir;
|
|
4028
|
+
}
|
|
4029
|
+
yield { path: this.getGlobalConfigDir(), isGlobalConfig: true };
|
|
4030
|
+
}
|
|
4031
|
+
};
|
|
4032
|
+
exports.ExplorerBase = ExplorerBase;
|
|
4033
|
+
function getExtensionDescription(extension) {
|
|
4034
|
+
return extension ? `extension "${extension}"` : "files without extensions";
|
|
4035
|
+
}
|
|
4036
|
+
}
|
|
4037
|
+
});
|
|
4038
|
+
|
|
4039
|
+
// node_modules/cosmiconfig/dist/merge.js
|
|
4040
|
+
var require_merge2 = __commonJS({
|
|
4041
|
+
"node_modules/cosmiconfig/dist/merge.js"(exports) {
|
|
4042
|
+
"use strict";
|
|
4043
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4044
|
+
exports.hasOwn = void 0;
|
|
4045
|
+
exports.mergeAll = mergeAll;
|
|
4046
|
+
exports.hasOwn = Function.prototype.call.bind(Object.prototype.hasOwnProperty);
|
|
4047
|
+
var objToString = Function.prototype.call.bind(Object.prototype.toString);
|
|
4048
|
+
function isPlainObject(obj) {
|
|
4049
|
+
return objToString(obj) === "[object Object]";
|
|
4050
|
+
}
|
|
4051
|
+
function merge(target, source, options) {
|
|
4052
|
+
for (const key of Object.keys(source)) {
|
|
4053
|
+
if (key === "__proto__" || key === "constructor") {
|
|
4054
|
+
continue;
|
|
4055
|
+
}
|
|
4056
|
+
const newValue = source[key];
|
|
4057
|
+
if ((0, exports.hasOwn)(target, key)) {
|
|
4058
|
+
if (Array.isArray(target[key]) && Array.isArray(newValue)) {
|
|
4059
|
+
if (options.mergeArrays) {
|
|
4060
|
+
target[key].push(...newValue);
|
|
4061
|
+
continue;
|
|
4062
|
+
}
|
|
4063
|
+
} else if (isPlainObject(target[key]) && isPlainObject(newValue)) {
|
|
4064
|
+
target[key] = merge(target[key], newValue, options);
|
|
4065
|
+
continue;
|
|
4066
|
+
}
|
|
4067
|
+
}
|
|
4068
|
+
target[key] = newValue;
|
|
4069
|
+
}
|
|
4070
|
+
return target;
|
|
4071
|
+
}
|
|
4072
|
+
function mergeAll(objects, options) {
|
|
4073
|
+
return objects.reduce((target, source) => merge(target, source, options), {});
|
|
4074
|
+
}
|
|
4075
|
+
}
|
|
4076
|
+
});
|
|
4077
|
+
|
|
4078
|
+
// node_modules/cosmiconfig/dist/Explorer.js
|
|
4079
|
+
var require_Explorer = __commonJS({
|
|
4080
|
+
"node_modules/cosmiconfig/dist/Explorer.js"(exports) {
|
|
4081
|
+
"use strict";
|
|
4082
|
+
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
4083
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
4084
|
+
};
|
|
4085
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4086
|
+
exports.Explorer = void 0;
|
|
4087
|
+
var promises_1 = __importDefault(__require("fs/promises"));
|
|
4088
|
+
var path_1 = __importDefault(__require("path"));
|
|
4089
|
+
var defaults_1 = require_defaults();
|
|
4090
|
+
var ExplorerBase_js_1 = require_ExplorerBase();
|
|
4091
|
+
var merge_1 = require_merge2();
|
|
4092
|
+
var util_js_1 = require_util();
|
|
4093
|
+
var Explorer = class extends ExplorerBase_js_1.ExplorerBase {
|
|
4094
|
+
async load(filepath) {
|
|
4095
|
+
filepath = path_1.default.resolve(filepath);
|
|
4096
|
+
const load = async () => {
|
|
4097
|
+
return await this.config.transform(await this.#readConfiguration(filepath));
|
|
4098
|
+
};
|
|
4099
|
+
if (this.loadCache) {
|
|
4100
|
+
return await (0, util_js_1.emplace)(this.loadCache, filepath, load);
|
|
4101
|
+
}
|
|
4102
|
+
return await load();
|
|
4103
|
+
}
|
|
4104
|
+
async search(from = "") {
|
|
4105
|
+
if (this.config.metaConfigFilePath) {
|
|
4106
|
+
this.loadingMetaConfig = true;
|
|
4107
|
+
const config = await this.load(this.config.metaConfigFilePath);
|
|
4108
|
+
this.loadingMetaConfig = false;
|
|
4109
|
+
if (config && !config.isEmpty) {
|
|
4110
|
+
return config;
|
|
4111
|
+
}
|
|
4112
|
+
}
|
|
4113
|
+
from = path_1.default.resolve(from);
|
|
4114
|
+
const dirs = this.#getDirs(from);
|
|
4115
|
+
const firstDirIter = await dirs.next();
|
|
4116
|
+
if (firstDirIter.done) {
|
|
4117
|
+
throw new Error(`Could not find any folders to iterate through (start from ${from})`);
|
|
4118
|
+
}
|
|
4119
|
+
let currentDir = firstDirIter.value;
|
|
4120
|
+
const search = async () => {
|
|
4121
|
+
if (await (0, util_js_1.isDirectory)(currentDir.path)) {
|
|
4122
|
+
for (const filepath of this.getSearchPlacesForDir(currentDir, defaults_1.globalConfigSearchPlaces)) {
|
|
4123
|
+
try {
|
|
4124
|
+
const result = await this.#readConfiguration(filepath);
|
|
4125
|
+
if (result !== null && !(result.isEmpty && this.config.ignoreEmptySearchPlaces)) {
|
|
4126
|
+
return await this.config.transform(result);
|
|
4127
|
+
}
|
|
4128
|
+
} catch (error) {
|
|
4129
|
+
if (error.code === "ENOENT" || error.code === "EISDIR" || error.code === "ENOTDIR" || error.code === "EACCES") {
|
|
4130
|
+
continue;
|
|
4131
|
+
}
|
|
4132
|
+
throw error;
|
|
4133
|
+
}
|
|
4134
|
+
}
|
|
4135
|
+
}
|
|
4136
|
+
const nextDirIter = await dirs.next();
|
|
4137
|
+
if (!nextDirIter.done) {
|
|
4138
|
+
currentDir = nextDirIter.value;
|
|
4139
|
+
if (this.searchCache) {
|
|
4140
|
+
return await (0, util_js_1.emplace)(this.searchCache, currentDir.path, search);
|
|
4141
|
+
}
|
|
4142
|
+
return await search();
|
|
4143
|
+
}
|
|
4144
|
+
return await this.config.transform(null);
|
|
4145
|
+
};
|
|
4146
|
+
if (this.searchCache) {
|
|
4147
|
+
return await (0, util_js_1.emplace)(this.searchCache, from, search);
|
|
4148
|
+
}
|
|
4149
|
+
return await search();
|
|
4150
|
+
}
|
|
4151
|
+
async #readConfiguration(filepath, importStack = []) {
|
|
4152
|
+
const contents = await promises_1.default.readFile(filepath, { encoding: "utf-8" });
|
|
4153
|
+
return this.toCosmiconfigResult(filepath, await this.#loadConfigFileWithImports(filepath, contents, importStack));
|
|
4154
|
+
}
|
|
4155
|
+
async #loadConfigFileWithImports(filepath, contents, importStack) {
|
|
4156
|
+
const loadedContent = await this.#loadConfiguration(filepath, contents);
|
|
4157
|
+
if (!loadedContent || !(0, merge_1.hasOwn)(loadedContent, "$import")) {
|
|
4158
|
+
return loadedContent;
|
|
4159
|
+
}
|
|
4160
|
+
const fileDirectory = path_1.default.dirname(filepath);
|
|
4161
|
+
const { $import: imports, ...ownContent } = loadedContent;
|
|
4162
|
+
const importPaths = Array.isArray(imports) ? imports : [imports];
|
|
4163
|
+
const newImportStack = [...importStack, filepath];
|
|
4164
|
+
this.validateImports(filepath, importPaths, newImportStack);
|
|
4165
|
+
const importedConfigs = await Promise.all(importPaths.map(async (importPath) => {
|
|
4166
|
+
const fullPath = path_1.default.resolve(fileDirectory, importPath);
|
|
4167
|
+
const result = await this.#readConfiguration(fullPath, newImportStack);
|
|
4168
|
+
return result?.config;
|
|
4169
|
+
}));
|
|
4170
|
+
return (0, merge_1.mergeAll)([...importedConfigs, ownContent], {
|
|
4171
|
+
mergeArrays: this.config.mergeImportArrays
|
|
4172
|
+
});
|
|
4173
|
+
}
|
|
4174
|
+
async #loadConfiguration(filepath, contents) {
|
|
4175
|
+
if (contents.trim() === "") {
|
|
4176
|
+
return;
|
|
4177
|
+
}
|
|
4178
|
+
const extension = path_1.default.extname(filepath);
|
|
4179
|
+
const loader = this.config.loaders[extension || "noExt"] ?? this.config.loaders["default"];
|
|
4180
|
+
if (!loader) {
|
|
4181
|
+
throw new Error(`No loader specified for ${(0, ExplorerBase_js_1.getExtensionDescription)(extension)}`);
|
|
4182
|
+
}
|
|
4183
|
+
try {
|
|
4184
|
+
const loadedContents = await loader(filepath, contents);
|
|
4185
|
+
if (path_1.default.basename(filepath, extension) !== "package") {
|
|
4186
|
+
return loadedContents;
|
|
4187
|
+
}
|
|
4188
|
+
return (0, util_js_1.getPropertyByPath)(loadedContents, this.config.packageProp ?? this.config.moduleName) ?? null;
|
|
4189
|
+
} catch (error) {
|
|
4190
|
+
error.filepath = filepath;
|
|
4191
|
+
throw error;
|
|
4192
|
+
}
|
|
4193
|
+
}
|
|
4194
|
+
async #fileExists(path) {
|
|
4195
|
+
try {
|
|
4196
|
+
await promises_1.default.stat(path);
|
|
4197
|
+
return true;
|
|
4198
|
+
} catch (e) {
|
|
4199
|
+
return false;
|
|
4200
|
+
}
|
|
4201
|
+
}
|
|
4202
|
+
async *#getDirs(startDir) {
|
|
4203
|
+
switch (this.config.searchStrategy) {
|
|
4204
|
+
case "none": {
|
|
4205
|
+
yield { path: startDir, isGlobalConfig: false };
|
|
4206
|
+
return;
|
|
4207
|
+
}
|
|
4208
|
+
case "project": {
|
|
4209
|
+
let currentDir = startDir;
|
|
4210
|
+
while (true) {
|
|
4211
|
+
yield { path: currentDir, isGlobalConfig: false };
|
|
4212
|
+
let foundPackageFile = false;
|
|
4213
|
+
for (const ext of ["json", "yaml"]) {
|
|
4214
|
+
const packageFile = path_1.default.join(currentDir, `package.${ext}`);
|
|
4215
|
+
if (await this.#fileExists(packageFile)) {
|
|
4216
|
+
foundPackageFile = true;
|
|
4217
|
+
break;
|
|
4218
|
+
}
|
|
4219
|
+
}
|
|
4220
|
+
if (foundPackageFile) {
|
|
4221
|
+
return;
|
|
4222
|
+
}
|
|
4223
|
+
const parentDir = path_1.default.dirname(currentDir);
|
|
4224
|
+
if (parentDir === currentDir) {
|
|
4225
|
+
return;
|
|
4226
|
+
}
|
|
4227
|
+
currentDir = parentDir;
|
|
4228
|
+
}
|
|
4229
|
+
}
|
|
4230
|
+
case "global": {
|
|
4231
|
+
yield* this.getGlobalDirs(startDir);
|
|
4232
|
+
}
|
|
4233
|
+
}
|
|
4234
|
+
}
|
|
4235
|
+
};
|
|
4236
|
+
exports.Explorer = Explorer;
|
|
4237
|
+
}
|
|
4238
|
+
});
|
|
4239
|
+
|
|
4240
|
+
// node_modules/cosmiconfig/dist/ExplorerSync.js
|
|
4241
|
+
var require_ExplorerSync = __commonJS({
|
|
4242
|
+
"node_modules/cosmiconfig/dist/ExplorerSync.js"(exports) {
|
|
4243
|
+
"use strict";
|
|
4244
|
+
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
4245
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
4246
|
+
};
|
|
4247
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4248
|
+
exports.ExplorerSync = void 0;
|
|
4249
|
+
var fs_1 = __importDefault(__require("fs"));
|
|
4250
|
+
var path_1 = __importDefault(__require("path"));
|
|
4251
|
+
var defaults_1 = require_defaults();
|
|
4252
|
+
var ExplorerBase_js_1 = require_ExplorerBase();
|
|
4253
|
+
var merge_1 = require_merge2();
|
|
4254
|
+
var util_js_1 = require_util();
|
|
4255
|
+
var ExplorerSync = class extends ExplorerBase_js_1.ExplorerBase {
|
|
4256
|
+
load(filepath) {
|
|
4257
|
+
filepath = path_1.default.resolve(filepath);
|
|
4258
|
+
const load = () => {
|
|
4259
|
+
return this.config.transform(this.#readConfiguration(filepath));
|
|
4260
|
+
};
|
|
4261
|
+
if (this.loadCache) {
|
|
4262
|
+
return (0, util_js_1.emplace)(this.loadCache, filepath, load);
|
|
4263
|
+
}
|
|
4264
|
+
return load();
|
|
4265
|
+
}
|
|
4266
|
+
search(from = "") {
|
|
4267
|
+
if (this.config.metaConfigFilePath) {
|
|
4268
|
+
this.loadingMetaConfig = true;
|
|
4269
|
+
const config = this.load(this.config.metaConfigFilePath);
|
|
4270
|
+
this.loadingMetaConfig = false;
|
|
4271
|
+
if (config && !config.isEmpty) {
|
|
4272
|
+
return config;
|
|
4273
|
+
}
|
|
4274
|
+
}
|
|
4275
|
+
from = path_1.default.resolve(from);
|
|
4276
|
+
const dirs = this.#getDirs(from);
|
|
4277
|
+
const firstDirIter = dirs.next();
|
|
4278
|
+
if (firstDirIter.done) {
|
|
4279
|
+
throw new Error(`Could not find any folders to iterate through (start from ${from})`);
|
|
4280
|
+
}
|
|
4281
|
+
let currentDir = firstDirIter.value;
|
|
4282
|
+
const search = () => {
|
|
4283
|
+
if ((0, util_js_1.isDirectorySync)(currentDir.path)) {
|
|
4284
|
+
for (const filepath of this.getSearchPlacesForDir(currentDir, defaults_1.globalConfigSearchPlacesSync)) {
|
|
4285
|
+
try {
|
|
4286
|
+
const result = this.#readConfiguration(filepath);
|
|
4287
|
+
if (result !== null && !(result.isEmpty && this.config.ignoreEmptySearchPlaces)) {
|
|
4288
|
+
return this.config.transform(result);
|
|
4289
|
+
}
|
|
4290
|
+
} catch (error) {
|
|
4291
|
+
if (error.code === "ENOENT" || error.code === "EISDIR" || error.code === "ENOTDIR" || error.code === "EACCES") {
|
|
4292
|
+
continue;
|
|
4293
|
+
}
|
|
4294
|
+
throw error;
|
|
4295
|
+
}
|
|
4296
|
+
}
|
|
4297
|
+
}
|
|
4298
|
+
const nextDirIter = dirs.next();
|
|
4299
|
+
if (!nextDirIter.done) {
|
|
4300
|
+
currentDir = nextDirIter.value;
|
|
4301
|
+
if (this.searchCache) {
|
|
4302
|
+
return (0, util_js_1.emplace)(this.searchCache, currentDir.path, search);
|
|
4303
|
+
}
|
|
4304
|
+
return search();
|
|
4305
|
+
}
|
|
4306
|
+
return this.config.transform(null);
|
|
4307
|
+
};
|
|
4308
|
+
if (this.searchCache) {
|
|
4309
|
+
return (0, util_js_1.emplace)(this.searchCache, from, search);
|
|
4310
|
+
}
|
|
4311
|
+
return search();
|
|
4312
|
+
}
|
|
4313
|
+
#readConfiguration(filepath, importStack = []) {
|
|
4314
|
+
const contents = fs_1.default.readFileSync(filepath, "utf8");
|
|
4315
|
+
return this.toCosmiconfigResult(filepath, this.#loadConfigFileWithImports(filepath, contents, importStack));
|
|
4316
|
+
}
|
|
4317
|
+
#loadConfigFileWithImports(filepath, contents, importStack) {
|
|
4318
|
+
const loadedContent = this.#loadConfiguration(filepath, contents);
|
|
4319
|
+
if (!loadedContent || !(0, merge_1.hasOwn)(loadedContent, "$import")) {
|
|
4320
|
+
return loadedContent;
|
|
4321
|
+
}
|
|
4322
|
+
const fileDirectory = path_1.default.dirname(filepath);
|
|
4323
|
+
const { $import: imports, ...ownContent } = loadedContent;
|
|
4324
|
+
const importPaths = Array.isArray(imports) ? imports : [imports];
|
|
4325
|
+
const newImportStack = [...importStack, filepath];
|
|
4326
|
+
this.validateImports(filepath, importPaths, newImportStack);
|
|
4327
|
+
const importedConfigs = importPaths.map((importPath) => {
|
|
4328
|
+
const fullPath = path_1.default.resolve(fileDirectory, importPath);
|
|
4329
|
+
const result = this.#readConfiguration(fullPath, newImportStack);
|
|
4330
|
+
return result?.config;
|
|
4331
|
+
});
|
|
4332
|
+
return (0, merge_1.mergeAll)([...importedConfigs, ownContent], {
|
|
4333
|
+
mergeArrays: this.config.mergeImportArrays
|
|
4334
|
+
});
|
|
4335
|
+
}
|
|
4336
|
+
#loadConfiguration(filepath, contents) {
|
|
4337
|
+
if (contents.trim() === "") {
|
|
4338
|
+
return;
|
|
4339
|
+
}
|
|
4340
|
+
const extension = path_1.default.extname(filepath);
|
|
4341
|
+
const loader = this.config.loaders[extension || "noExt"] ?? this.config.loaders["default"];
|
|
4342
|
+
if (!loader) {
|
|
4343
|
+
throw new Error(`No loader specified for ${(0, ExplorerBase_js_1.getExtensionDescription)(extension)}`);
|
|
4344
|
+
}
|
|
4345
|
+
try {
|
|
4346
|
+
const loadedContents = loader(filepath, contents);
|
|
4347
|
+
if (path_1.default.basename(filepath, extension) !== "package") {
|
|
4348
|
+
return loadedContents;
|
|
4349
|
+
}
|
|
4350
|
+
return (0, util_js_1.getPropertyByPath)(loadedContents, this.config.packageProp ?? this.config.moduleName) ?? null;
|
|
4351
|
+
} catch (error) {
|
|
4352
|
+
error.filepath = filepath;
|
|
4353
|
+
throw error;
|
|
4354
|
+
}
|
|
4355
|
+
}
|
|
4356
|
+
#fileExists(path) {
|
|
4357
|
+
try {
|
|
4358
|
+
fs_1.default.statSync(path);
|
|
4359
|
+
return true;
|
|
4360
|
+
} catch (e) {
|
|
4361
|
+
return false;
|
|
4362
|
+
}
|
|
4363
|
+
}
|
|
4364
|
+
*#getDirs(startDir) {
|
|
4365
|
+
switch (this.config.searchStrategy) {
|
|
4366
|
+
case "none": {
|
|
4367
|
+
yield { path: startDir, isGlobalConfig: false };
|
|
4368
|
+
return;
|
|
4369
|
+
}
|
|
4370
|
+
case "project": {
|
|
4371
|
+
let currentDir = startDir;
|
|
4372
|
+
while (true) {
|
|
4373
|
+
yield { path: currentDir, isGlobalConfig: false };
|
|
4374
|
+
let foundPackageFile = false;
|
|
4375
|
+
for (const ext of ["json", "yaml"]) {
|
|
4376
|
+
const packageFile = path_1.default.join(currentDir, `package.${ext}`);
|
|
4377
|
+
if (this.#fileExists(packageFile)) {
|
|
4378
|
+
foundPackageFile = true;
|
|
4379
|
+
break;
|
|
4380
|
+
}
|
|
4381
|
+
}
|
|
4382
|
+
if (foundPackageFile) {
|
|
4383
|
+
return;
|
|
4384
|
+
}
|
|
4385
|
+
const parentDir = path_1.default.dirname(currentDir);
|
|
4386
|
+
if (parentDir === currentDir) {
|
|
4387
|
+
return;
|
|
4388
|
+
}
|
|
4389
|
+
currentDir = parentDir;
|
|
4390
|
+
}
|
|
4391
|
+
}
|
|
4392
|
+
case "global": {
|
|
4393
|
+
yield* this.getGlobalDirs(startDir);
|
|
4394
|
+
}
|
|
4395
|
+
}
|
|
4396
|
+
}
|
|
4397
|
+
/**
|
|
4398
|
+
* @deprecated Use {@link ExplorerSync.prototype.load}.
|
|
4399
|
+
*/
|
|
4400
|
+
/* istanbul ignore next */
|
|
4401
|
+
loadSync(filepath) {
|
|
4402
|
+
return this.load(filepath);
|
|
4403
|
+
}
|
|
4404
|
+
/**
|
|
4405
|
+
* @deprecated Use {@link ExplorerSync.prototype.search}.
|
|
4406
|
+
*/
|
|
4407
|
+
/* istanbul ignore next */
|
|
4408
|
+
searchSync(from = "") {
|
|
4409
|
+
return this.search(from);
|
|
4410
|
+
}
|
|
4411
|
+
};
|
|
4412
|
+
exports.ExplorerSync = ExplorerSync;
|
|
4413
|
+
}
|
|
4414
|
+
});
|
|
4415
|
+
|
|
4416
|
+
// node_modules/cosmiconfig/dist/index.js
|
|
4417
|
+
var require_dist = __commonJS({
|
|
4418
|
+
"node_modules/cosmiconfig/dist/index.js"(exports) {
|
|
4419
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4420
|
+
exports.defaultLoadersSync = exports.defaultLoaders = exports.globalConfigSearchPlacesSync = exports.globalConfigSearchPlaces = exports.getDefaultSearchPlacesSync = exports.getDefaultSearchPlaces = void 0;
|
|
4421
|
+
exports.cosmiconfig = cosmiconfig;
|
|
4422
|
+
exports.cosmiconfigSync = cosmiconfigSync;
|
|
4423
|
+
var defaults_1 = require_defaults();
|
|
4424
|
+
Object.defineProperty(exports, "defaultLoaders", { enumerable: true, get: function() {
|
|
4425
|
+
return defaults_1.defaultLoaders;
|
|
4426
|
+
} });
|
|
4427
|
+
Object.defineProperty(exports, "defaultLoadersSync", { enumerable: true, get: function() {
|
|
4428
|
+
return defaults_1.defaultLoadersSync;
|
|
4429
|
+
} });
|
|
4430
|
+
Object.defineProperty(exports, "getDefaultSearchPlaces", { enumerable: true, get: function() {
|
|
4431
|
+
return defaults_1.getDefaultSearchPlaces;
|
|
4432
|
+
} });
|
|
4433
|
+
Object.defineProperty(exports, "getDefaultSearchPlacesSync", { enumerable: true, get: function() {
|
|
4434
|
+
return defaults_1.getDefaultSearchPlacesSync;
|
|
4435
|
+
} });
|
|
4436
|
+
Object.defineProperty(exports, "globalConfigSearchPlaces", { enumerable: true, get: function() {
|
|
4437
|
+
return defaults_1.globalConfigSearchPlaces;
|
|
4438
|
+
} });
|
|
4439
|
+
Object.defineProperty(exports, "globalConfigSearchPlacesSync", { enumerable: true, get: function() {
|
|
4440
|
+
return defaults_1.globalConfigSearchPlacesSync;
|
|
4441
|
+
} });
|
|
4442
|
+
var Explorer_js_1 = require_Explorer();
|
|
4443
|
+
var ExplorerSync_js_1 = require_ExplorerSync();
|
|
4444
|
+
var util_1 = require_util();
|
|
4445
|
+
var identity = function identity2(x) {
|
|
4446
|
+
return x;
|
|
4447
|
+
};
|
|
4448
|
+
function getUserDefinedOptionsFromMetaConfig() {
|
|
4449
|
+
const metaExplorer = new ExplorerSync_js_1.ExplorerSync({
|
|
4450
|
+
moduleName: "cosmiconfig",
|
|
4451
|
+
stopDir: process.cwd(),
|
|
4452
|
+
searchPlaces: defaults_1.metaSearchPlaces,
|
|
4453
|
+
ignoreEmptySearchPlaces: false,
|
|
4454
|
+
applyPackagePropertyPathToConfiguration: true,
|
|
4455
|
+
loaders: defaults_1.defaultLoaders,
|
|
4456
|
+
transform: identity,
|
|
4457
|
+
cache: true,
|
|
4458
|
+
metaConfigFilePath: null,
|
|
4459
|
+
mergeImportArrays: true,
|
|
4460
|
+
mergeSearchPlaces: true,
|
|
4461
|
+
searchStrategy: "none"
|
|
4462
|
+
});
|
|
4463
|
+
const metaConfig = metaExplorer.search();
|
|
4464
|
+
if (!metaConfig) {
|
|
4465
|
+
return null;
|
|
4466
|
+
}
|
|
4467
|
+
if (metaConfig.config?.loaders) {
|
|
4468
|
+
throw new Error("Can not specify loaders in meta config file");
|
|
4469
|
+
}
|
|
4470
|
+
if (metaConfig.config?.searchStrategy) {
|
|
4471
|
+
throw new Error("Can not specify searchStrategy in meta config file");
|
|
4472
|
+
}
|
|
4473
|
+
const overrideOptions = {
|
|
4474
|
+
mergeSearchPlaces: true,
|
|
4475
|
+
...metaConfig.config ?? {}
|
|
4476
|
+
};
|
|
4477
|
+
return {
|
|
4478
|
+
config: (0, util_1.removeUndefinedValuesFromObject)(overrideOptions),
|
|
4479
|
+
filepath: metaConfig.filepath
|
|
4480
|
+
};
|
|
4481
|
+
}
|
|
4482
|
+
function getResolvedSearchPlaces(moduleName, toolDefinedSearchPlaces, userConfiguredOptions) {
|
|
4483
|
+
const userConfiguredSearchPlaces = userConfiguredOptions.searchPlaces?.map((path) => path.replace("{name}", moduleName));
|
|
4484
|
+
if (userConfiguredOptions.mergeSearchPlaces) {
|
|
4485
|
+
return [...userConfiguredSearchPlaces ?? [], ...toolDefinedSearchPlaces];
|
|
4486
|
+
}
|
|
4487
|
+
return userConfiguredSearchPlaces ?? /* istanbul ignore next */
|
|
4488
|
+
toolDefinedSearchPlaces;
|
|
4489
|
+
}
|
|
4490
|
+
function mergeOptionsBase(moduleName, defaults, options) {
|
|
4491
|
+
const userDefinedConfig = getUserDefinedOptionsFromMetaConfig();
|
|
4492
|
+
if (!userDefinedConfig) {
|
|
4493
|
+
return {
|
|
4494
|
+
...defaults,
|
|
4495
|
+
...(0, util_1.removeUndefinedValuesFromObject)(options),
|
|
4496
|
+
loaders: {
|
|
4497
|
+
...defaults.loaders,
|
|
4498
|
+
...options.loaders
|
|
4499
|
+
}
|
|
4500
|
+
};
|
|
4501
|
+
}
|
|
4502
|
+
const userConfiguredOptions = userDefinedConfig.config;
|
|
4503
|
+
const toolDefinedSearchPlaces = options.searchPlaces ?? defaults.searchPlaces;
|
|
4504
|
+
return {
|
|
4505
|
+
...defaults,
|
|
4506
|
+
...(0, util_1.removeUndefinedValuesFromObject)(options),
|
|
4507
|
+
metaConfigFilePath: userDefinedConfig.filepath,
|
|
4508
|
+
...userConfiguredOptions,
|
|
4509
|
+
searchPlaces: getResolvedSearchPlaces(moduleName, toolDefinedSearchPlaces, userConfiguredOptions),
|
|
4510
|
+
loaders: {
|
|
4511
|
+
...defaults.loaders,
|
|
4512
|
+
...options.loaders
|
|
4513
|
+
}
|
|
4514
|
+
};
|
|
4515
|
+
}
|
|
4516
|
+
function validateOptions(options) {
|
|
4517
|
+
if (options.searchStrategy != null && options.searchStrategy !== "global" && options.stopDir) {
|
|
4518
|
+
throw new Error('Can not supply `stopDir` option with `searchStrategy` other than "global"');
|
|
4519
|
+
}
|
|
4520
|
+
}
|
|
4521
|
+
function mergeOptions(moduleName, options) {
|
|
4522
|
+
validateOptions(options);
|
|
4523
|
+
const defaults = {
|
|
4524
|
+
moduleName,
|
|
4525
|
+
searchPlaces: (0, defaults_1.getDefaultSearchPlaces)(moduleName),
|
|
4526
|
+
ignoreEmptySearchPlaces: true,
|
|
4527
|
+
cache: true,
|
|
4528
|
+
transform: identity,
|
|
4529
|
+
loaders: defaults_1.defaultLoaders,
|
|
4530
|
+
metaConfigFilePath: null,
|
|
4531
|
+
mergeImportArrays: true,
|
|
4532
|
+
mergeSearchPlaces: true,
|
|
4533
|
+
searchStrategy: options.stopDir ? "global" : "none"
|
|
4534
|
+
};
|
|
4535
|
+
return mergeOptionsBase(moduleName, defaults, options);
|
|
4536
|
+
}
|
|
4537
|
+
function mergeOptionsSync(moduleName, options) {
|
|
4538
|
+
validateOptions(options);
|
|
4539
|
+
const defaults = {
|
|
4540
|
+
moduleName,
|
|
4541
|
+
searchPlaces: (0, defaults_1.getDefaultSearchPlacesSync)(moduleName),
|
|
4542
|
+
ignoreEmptySearchPlaces: true,
|
|
4543
|
+
cache: true,
|
|
4544
|
+
transform: identity,
|
|
4545
|
+
loaders: defaults_1.defaultLoadersSync,
|
|
4546
|
+
metaConfigFilePath: null,
|
|
4547
|
+
mergeImportArrays: true,
|
|
4548
|
+
mergeSearchPlaces: true,
|
|
4549
|
+
searchStrategy: options.stopDir ? "global" : "none"
|
|
4550
|
+
};
|
|
4551
|
+
return mergeOptionsBase(moduleName, defaults, options);
|
|
4552
|
+
}
|
|
4553
|
+
function cosmiconfig(moduleName, options = {}) {
|
|
4554
|
+
const normalizedOptions = mergeOptions(moduleName, options);
|
|
4555
|
+
const explorer = new Explorer_js_1.Explorer(normalizedOptions);
|
|
4556
|
+
return {
|
|
4557
|
+
search: explorer.search.bind(explorer),
|
|
4558
|
+
load: explorer.load.bind(explorer),
|
|
4559
|
+
clearLoadCache: explorer.clearLoadCache.bind(explorer),
|
|
4560
|
+
clearSearchCache: explorer.clearSearchCache.bind(explorer),
|
|
4561
|
+
clearCaches: explorer.clearCaches.bind(explorer)
|
|
4562
|
+
};
|
|
4563
|
+
}
|
|
4564
|
+
function cosmiconfigSync(moduleName, options = {}) {
|
|
4565
|
+
const normalizedOptions = mergeOptionsSync(moduleName, options);
|
|
4566
|
+
const explorerSync = new ExplorerSync_js_1.ExplorerSync(normalizedOptions);
|
|
4567
|
+
return {
|
|
4568
|
+
search: explorerSync.search.bind(explorerSync),
|
|
4569
|
+
load: explorerSync.load.bind(explorerSync),
|
|
4570
|
+
clearLoadCache: explorerSync.clearLoadCache.bind(explorerSync),
|
|
4571
|
+
clearSearchCache: explorerSync.clearSearchCache.bind(explorerSync),
|
|
4572
|
+
clearCaches: explorerSync.clearCaches.bind(explorerSync)
|
|
4573
|
+
};
|
|
4574
|
+
}
|
|
4575
|
+
}
|
|
4576
|
+
});
|
|
4577
|
+
|
|
4578
|
+
export {
|
|
4579
|
+
require_dist
|
|
4580
|
+
};
|
|
4581
|
+
/*! Bundled license information:
|
|
4582
|
+
|
|
4583
|
+
cosmiconfig/dist/loaders.js:
|
|
4584
|
+
cosmiconfig/dist/util.js:
|
|
4585
|
+
cosmiconfig/dist/merge.js:
|
|
4586
|
+
(* istanbul ignore next -- @preserve *)
|
|
4587
|
+
|
|
4588
|
+
cosmiconfig/dist/ExplorerBase.js:
|
|
4589
|
+
(* istanbul ignore if -- @preserve *)
|
|
4590
|
+
(* istanbul ignore next -- @preserve *)
|
|
4591
|
+
|
|
4592
|
+
cosmiconfig/dist/Explorer.js:
|
|
4593
|
+
cosmiconfig/dist/ExplorerSync.js:
|
|
4594
|
+
(* istanbul ignore if -- @preserve *)
|
|
4595
|
+
*/
|