house-lights 1.0.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -3
- package/cli.mjs +3 -2
- package/package.json +4 -3
- package/skills/back-of-napkin/assets/player.html +1 -1
- package/skills/back-of-napkin/scripts/contract.mjs +1 -1
- package/skills/back-of-napkin/scripts/pptx.mjs +1 -1
- package/skills/cast-list/assets/VERSION +2 -0
- package/skills/cast-list/assets/lesson.html +182 -0
- package/skills/cast-list/assets/map.html +244 -0
- package/skills/cast-list/examples/LICENSE-microsoft-skills-for-copilot-studio +21 -0
- package/skills/cast-list/examples/NOTICE.md +27 -0
- package/skills/cast-list/examples/agents/bodega-cupons/actions/ConsultarCuponsAtivos.mcs.yml +34 -0
- package/skills/cast-list/examples/agents/bodega-cupons/actions/EnviarCupomEmail.mcs.yml +34 -0
- package/skills/cast-list/examples/agents/bodega-cupons/actions/PromocoesMCP.mcs.yml +20 -0
- package/skills/cast-list/examples/agents/bodega-cupons/agent.mcs.yml +27 -0
- package/skills/cast-list/examples/agents/bodega-cupons/connectionreferences.mcs.yml +17 -0
- package/skills/cast-list/examples/agents/bodega-cupons/knowledge/RegulamentoCupons.knowledge.mcs.yml +7 -0
- package/skills/cast-list/examples/agents/bodega-cupons/settings.mcs.yml +13 -0
- package/skills/cast-list/examples/agents/bodega-cupons/topics/ConsultarRegulamentoCupons.topic.mcs.yml +56 -0
- package/skills/cast-list/examples/agents/bodega-cupons/topics/Escalate.topic.mcs.yml +20 -0
- package/skills/cast-list/examples/agents/bodega-cupons/topics/Fallback.topic.mcs.yml +32 -0
- package/skills/cast-list/examples/agents/bodega-cupons/topics/Greeting.topic.mcs.yml +14 -0
- package/skills/cast-list/examples/agents/bodega-cupons/topics/OnError.topic.mcs.yml +48 -0
- package/skills/cast-list/examples/agents/bodega-cupons/topics/RecebimentoOrquestrador.topic.mcs.yml +16 -0
- package/skills/cast-list/examples/agents/bodega-cupons/variables/CategoriaSolicitacao.mcs.yml +10 -0
- package/skills/cast-list/examples/agents/bodega-devolucoes/actions/AbrirSolicitacaoDevolucao.mcs.yml +32 -0
- package/skills/cast-list/examples/agents/bodega-devolucoes/agent.mcs.yml +26 -0
- package/skills/cast-list/examples/agents/bodega-devolucoes/connectionreferences.mcs.yml +6 -0
- package/skills/cast-list/examples/agents/bodega-devolucoes/knowledge/PoliticaTrocasDevolucoes.knowledge.mcs.yml +7 -0
- package/skills/cast-list/examples/agents/bodega-devolucoes/settings.mcs.yml +13 -0
- package/skills/cast-list/examples/agents/bodega-devolucoes/topics/ConsultarPoliticaDevolucoes.topic.mcs.yml +56 -0
- package/skills/cast-list/examples/agents/bodega-devolucoes/topics/Escalate.topic.mcs.yml +20 -0
- package/skills/cast-list/examples/agents/bodega-devolucoes/topics/Fallback.topic.mcs.yml +32 -0
- package/skills/cast-list/examples/agents/bodega-devolucoes/topics/Greeting.topic.mcs.yml +14 -0
- package/skills/cast-list/examples/agents/bodega-devolucoes/topics/OnError.topic.mcs.yml +48 -0
- package/skills/cast-list/examples/agents/bodega-devolucoes/topics/RecebimentoOrquestrador.topic.mcs.yml +16 -0
- package/skills/cast-list/examples/agents/bodega-devolucoes/variables/CategoriaSolicitacao.mcs.yml +10 -0
- package/skills/cast-list/examples/agents/bodega-frete/actions/EnviarOpcoesFrete.mcs.yml +34 -0
- package/skills/cast-list/examples/agents/bodega-frete/agent.mcs.yml +26 -0
- package/skills/cast-list/examples/agents/bodega-frete/connectionreferences.mcs.yml +6 -0
- package/skills/cast-list/examples/agents/bodega-frete/knowledge/TabelaFreteEntregas.knowledge.mcs.yml +7 -0
- package/skills/cast-list/examples/agents/bodega-frete/settings.mcs.yml +13 -0
- package/skills/cast-list/examples/agents/bodega-frete/topics/ConsultarTabelaFrete.topic.mcs.yml +56 -0
- package/skills/cast-list/examples/agents/bodega-frete/topics/Fallback.topic.mcs.yml +31 -0
- package/skills/cast-list/examples/agents/bodega-frete/topics/Greeting.topic.mcs.yml +14 -0
- package/skills/cast-list/examples/agents/bodega-frete/topics/OnError.topic.mcs.yml +48 -0
- package/skills/cast-list/examples/agents/bodega-frete/topics/RecebimentoOrquestrador.topic.mcs.yml +16 -0
- package/skills/cast-list/examples/agents/bodega-frete/variables/CategoriaSolicitacao.mcs.yml +10 -0
- package/skills/cast-list/examples/agents/bodega-loja-fisica/actions/EnviarInstrucoesRetirada.mcs.yml +34 -0
- package/skills/cast-list/examples/agents/bodega-loja-fisica/agent.mcs.yml +27 -0
- package/skills/cast-list/examples/agents/bodega-loja-fisica/connectionreferences.mcs.yml +6 -0
- package/skills/cast-list/examples/agents/bodega-loja-fisica/knowledge/GuiaLojaFisica.knowledge.mcs.yml +8 -0
- package/skills/cast-list/examples/agents/bodega-loja-fisica/settings.mcs.yml +13 -0
- package/skills/cast-list/examples/agents/bodega-loja-fisica/topics/ConsultarGuiaLojaFisica.topic.mcs.yml +56 -0
- package/skills/cast-list/examples/agents/bodega-loja-fisica/topics/Escalate.topic.mcs.yml +20 -0
- package/skills/cast-list/examples/agents/bodega-loja-fisica/topics/Fallback.topic.mcs.yml +32 -0
- package/skills/cast-list/examples/agents/bodega-loja-fisica/topics/Greeting.topic.mcs.yml +14 -0
- package/skills/cast-list/examples/agents/bodega-loja-fisica/topics/OnError.topic.mcs.yml +43 -0
- package/skills/cast-list/examples/agents/bodega-loja-fisica/topics/RecebimentoOrquestrador.topic.mcs.yml +16 -0
- package/skills/cast-list/examples/agents/bodega-loja-fisica/variables/CategoriaSolicitacao.mcs.yml +10 -0
- package/skills/cast-list/examples/agents/bodega-orquestrador/actions/AgenteCupons.mcs.yml +24 -0
- package/skills/cast-list/examples/agents/bodega-orquestrador/actions/AgenteDevolucoes.mcs.yml +24 -0
- package/skills/cast-list/examples/agents/bodega-orquestrador/actions/AgenteFrete.mcs.yml +24 -0
- package/skills/cast-list/examples/agents/bodega-orquestrador/actions/AgenteLojaFisica.mcs.yml +24 -0
- package/skills/cast-list/examples/agents/bodega-orquestrador/actions/AgentePedidos.mcs.yml +24 -0
- package/skills/cast-list/examples/agents/bodega-orquestrador/agent.mcs.yml +35 -0
- package/skills/cast-list/examples/agents/bodega-orquestrador/agents/SobreBodegaAzul/agent.mcs.yml +32 -0
- package/skills/cast-list/examples/agents/bodega-orquestrador/settings.mcs.yml +12 -0
- package/skills/cast-list/examples/agents/bodega-orquestrador/topics/ClassificarSolicitacao.topic.mcs.yml +35 -0
- package/skills/cast-list/examples/agents/bodega-orquestrador/topics/Escalate.topic.mcs.yml +20 -0
- package/skills/cast-list/examples/agents/bodega-orquestrador/topics/Fallback.topic.mcs.yml +32 -0
- package/skills/cast-list/examples/agents/bodega-orquestrador/topics/Greeting.topic.mcs.yml +14 -0
- package/skills/cast-list/examples/agents/bodega-orquestrador/topics/OnError.topic.mcs.yml +48 -0
- package/skills/cast-list/examples/agents/bodega-orquestrador/variables/CategoriaSolicitacao.mcs.yml +9 -0
- package/skills/cast-list/examples/agents/bodega-pedidos/actions/EnviarResumoPedido.mcs.yml +34 -0
- package/skills/cast-list/examples/agents/bodega-pedidos/agent.mcs.yml +26 -0
- package/skills/cast-list/examples/agents/bodega-pedidos/connectionreferences.mcs.yml +6 -0
- package/skills/cast-list/examples/agents/bodega-pedidos/knowledge/PoliticasPedidos.knowledge.mcs.yml +7 -0
- package/skills/cast-list/examples/agents/bodega-pedidos/settings.mcs.yml +13 -0
- package/skills/cast-list/examples/agents/bodega-pedidos/topics/ConsultarPoliticasPedidos.topic.mcs.yml +56 -0
- package/skills/cast-list/examples/agents/bodega-pedidos/topics/Escalate.topic.mcs.yml +20 -0
- package/skills/cast-list/examples/agents/bodega-pedidos/topics/Fallback.topic.mcs.yml +32 -0
- package/skills/cast-list/examples/agents/bodega-pedidos/topics/Greeting.topic.mcs.yml +14 -0
- package/skills/cast-list/examples/agents/bodega-pedidos/topics/OnError.topic.mcs.yml +48 -0
- package/skills/cast-list/examples/agents/bodega-pedidos/topics/RecebimentoOrquestrador.topic.mcs.yml +16 -0
- package/skills/cast-list/examples/agents/bodega-pedidos/variables/CategoriaSolicitacao.mcs.yml +10 -0
- package/skills/cast-list/examples/demo.cast.yaml +10 -0
- package/skills/cast-list/examples/profile.cast.yaml +15 -0
- package/skills/cast-list/references/format.md +50 -0
- package/skills/cast-list/references/keys.md +107 -0
- package/skills/cast-list/references/profile.md +32 -0
- package/skills/cast-list/scripts/browser.mjs +198 -0
- package/skills/cast-list/scripts/build.mjs +179 -0
- package/skills/cast-list/scripts/engine.mjs +155 -0
- package/skills/cast-list/scripts/page.mjs +15 -0
- package/skills/cast-list/scripts/read-xlsx.mjs +67 -0
- package/skills/cast-list/vendor/microsoft/LICENSE +21 -0
- package/skills/cast-list/vendor/microsoft/NOTICE +9 -0
- package/skills/cast-list/vendor/microsoft/package.json +1 -0
- package/skills/cast-list/vendor/microsoft/reference/bot.schema.yaml-authoring.json +27605 -0
- package/skills/cast-list/vendor/microsoft/scripts/schema-lookup.bundle.js +3495 -0
- package/skills/chalk-talk/assets/VERSION +1 -1
- package/skills/chalk-talk/assets/player.html +1 -1
- package/skills/chalk-talk/scripts/contract.mjs +1 -1
- package/skills/chalk-talk/scripts/mermaid.mjs +1 -1
- package/skills/chalk-talk/scripts/pptx.mjs +1 -1
- package/skills/dress-rehearsal/assets/drill.html +1 -1
- package/skills/gates-and-handoffs/assets/VERSION +1 -1
- package/skills/gates-and-handoffs/assets/lesson.html +1 -1
- package/skills/gates-and-handoffs/assets/map.html +36 -24
- package/skills/gates-and-handoffs/examples/feature-delivery.way.yaml +8 -1
- package/skills/gates-and-handoffs/references/format.schema.json +25 -1
- package/skills/gates-and-handoffs/references/questions.md +2 -1
- package/skills/gates-and-handoffs/scripts/engine.mjs +83 -83
- package/skills/service-blueprint/assets/VERSION +1 -1
- package/skills/service-blueprint/assets/lesson.html +1 -1
- package/skills/service-blueprint/assets/map.html +1 -1
- package/skills/service-blueprint/scripts/engine.mjs +1 -1
|
@@ -0,0 +1,3495 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
4
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
// node_modules/js-yaml/lib/common.js
|
|
8
|
+
var require_common = __commonJS({
|
|
9
|
+
"node_modules/js-yaml/lib/common.js"(exports2, module2) {
|
|
10
|
+
"use strict";
|
|
11
|
+
function isNothing(subject) {
|
|
12
|
+
return typeof subject === "undefined" || subject === null;
|
|
13
|
+
}
|
|
14
|
+
function isObject(subject) {
|
|
15
|
+
return typeof subject === "object" && subject !== null;
|
|
16
|
+
}
|
|
17
|
+
function toArray(sequence) {
|
|
18
|
+
if (Array.isArray(sequence)) return sequence;
|
|
19
|
+
else if (isNothing(sequence)) return [];
|
|
20
|
+
return [sequence];
|
|
21
|
+
}
|
|
22
|
+
function extend(target, source) {
|
|
23
|
+
var index, length, key, sourceKeys;
|
|
24
|
+
if (source) {
|
|
25
|
+
sourceKeys = Object.keys(source);
|
|
26
|
+
for (index = 0, length = sourceKeys.length; index < length; index += 1) {
|
|
27
|
+
key = sourceKeys[index];
|
|
28
|
+
target[key] = source[key];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return target;
|
|
32
|
+
}
|
|
33
|
+
function repeat(string, count) {
|
|
34
|
+
var result = "", cycle;
|
|
35
|
+
for (cycle = 0; cycle < count; cycle += 1) {
|
|
36
|
+
result += string;
|
|
37
|
+
}
|
|
38
|
+
return result;
|
|
39
|
+
}
|
|
40
|
+
function isNegativeZero(number) {
|
|
41
|
+
return number === 0 && Number.NEGATIVE_INFINITY === 1 / number;
|
|
42
|
+
}
|
|
43
|
+
module2.exports.isNothing = isNothing;
|
|
44
|
+
module2.exports.isObject = isObject;
|
|
45
|
+
module2.exports.toArray = toArray;
|
|
46
|
+
module2.exports.repeat = repeat;
|
|
47
|
+
module2.exports.isNegativeZero = isNegativeZero;
|
|
48
|
+
module2.exports.extend = extend;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// node_modules/js-yaml/lib/exception.js
|
|
53
|
+
var require_exception = __commonJS({
|
|
54
|
+
"node_modules/js-yaml/lib/exception.js"(exports2, module2) {
|
|
55
|
+
"use strict";
|
|
56
|
+
function formatError(exception, compact) {
|
|
57
|
+
var where = "", message = exception.reason || "(unknown reason)";
|
|
58
|
+
if (!exception.mark) return message;
|
|
59
|
+
if (exception.mark.name) {
|
|
60
|
+
where += 'in "' + exception.mark.name + '" ';
|
|
61
|
+
}
|
|
62
|
+
where += "(" + (exception.mark.line + 1) + ":" + (exception.mark.column + 1) + ")";
|
|
63
|
+
if (!compact && exception.mark.snippet) {
|
|
64
|
+
where += "\n\n" + exception.mark.snippet;
|
|
65
|
+
}
|
|
66
|
+
return message + " " + where;
|
|
67
|
+
}
|
|
68
|
+
function YAMLException(reason, mark) {
|
|
69
|
+
Error.call(this);
|
|
70
|
+
this.name = "YAMLException";
|
|
71
|
+
this.reason = reason;
|
|
72
|
+
this.mark = mark;
|
|
73
|
+
this.message = formatError(this, false);
|
|
74
|
+
if (Error.captureStackTrace) {
|
|
75
|
+
Error.captureStackTrace(this, this.constructor);
|
|
76
|
+
} else {
|
|
77
|
+
this.stack = new Error().stack || "";
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
YAMLException.prototype = Object.create(Error.prototype);
|
|
81
|
+
YAMLException.prototype.constructor = YAMLException;
|
|
82
|
+
YAMLException.prototype.toString = function toString(compact) {
|
|
83
|
+
return this.name + ": " + formatError(this, compact);
|
|
84
|
+
};
|
|
85
|
+
module2.exports = YAMLException;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// node_modules/js-yaml/lib/snippet.js
|
|
90
|
+
var require_snippet = __commonJS({
|
|
91
|
+
"node_modules/js-yaml/lib/snippet.js"(exports2, module2) {
|
|
92
|
+
"use strict";
|
|
93
|
+
var common = require_common();
|
|
94
|
+
function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
|
|
95
|
+
var head = "";
|
|
96
|
+
var tail = "";
|
|
97
|
+
var maxHalfLength = Math.floor(maxLineLength / 2) - 1;
|
|
98
|
+
if (position - lineStart > maxHalfLength) {
|
|
99
|
+
head = " ... ";
|
|
100
|
+
lineStart = position - maxHalfLength + head.length;
|
|
101
|
+
}
|
|
102
|
+
if (lineEnd - position > maxHalfLength) {
|
|
103
|
+
tail = " ...";
|
|
104
|
+
lineEnd = position + maxHalfLength - tail.length;
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, "\u2192") + tail,
|
|
108
|
+
pos: position - lineStart + head.length
|
|
109
|
+
// relative position
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
function padStart(string, max) {
|
|
113
|
+
return common.repeat(" ", max - string.length) + string;
|
|
114
|
+
}
|
|
115
|
+
function makeSnippet(mark, options) {
|
|
116
|
+
options = Object.create(options || null);
|
|
117
|
+
if (!mark.buffer) return null;
|
|
118
|
+
if (!options.maxLength) options.maxLength = 79;
|
|
119
|
+
if (typeof options.indent !== "number") options.indent = 1;
|
|
120
|
+
if (typeof options.linesBefore !== "number") options.linesBefore = 3;
|
|
121
|
+
if (typeof options.linesAfter !== "number") options.linesAfter = 2;
|
|
122
|
+
var re = /\r?\n|\r|\0/g;
|
|
123
|
+
var lineStarts = [0];
|
|
124
|
+
var lineEnds = [];
|
|
125
|
+
var match;
|
|
126
|
+
var foundLineNo = -1;
|
|
127
|
+
while (match = re.exec(mark.buffer)) {
|
|
128
|
+
lineEnds.push(match.index);
|
|
129
|
+
lineStarts.push(match.index + match[0].length);
|
|
130
|
+
if (mark.position <= match.index && foundLineNo < 0) {
|
|
131
|
+
foundLineNo = lineStarts.length - 2;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if (foundLineNo < 0) foundLineNo = lineStarts.length - 1;
|
|
135
|
+
var result = "", i, line;
|
|
136
|
+
var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length;
|
|
137
|
+
var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3);
|
|
138
|
+
for (i = 1; i <= options.linesBefore; i++) {
|
|
139
|
+
if (foundLineNo - i < 0) break;
|
|
140
|
+
line = getLine(
|
|
141
|
+
mark.buffer,
|
|
142
|
+
lineStarts[foundLineNo - i],
|
|
143
|
+
lineEnds[foundLineNo - i],
|
|
144
|
+
mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]),
|
|
145
|
+
maxLineLength
|
|
146
|
+
);
|
|
147
|
+
result = common.repeat(" ", options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + " | " + line.str + "\n" + result;
|
|
148
|
+
}
|
|
149
|
+
line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
|
|
150
|
+
result += common.repeat(" ", options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + " | " + line.str + "\n";
|
|
151
|
+
result += common.repeat("-", options.indent + lineNoLength + 3 + line.pos) + "^\n";
|
|
152
|
+
for (i = 1; i <= options.linesAfter; i++) {
|
|
153
|
+
if (foundLineNo + i >= lineEnds.length) break;
|
|
154
|
+
line = getLine(
|
|
155
|
+
mark.buffer,
|
|
156
|
+
lineStarts[foundLineNo + i],
|
|
157
|
+
lineEnds[foundLineNo + i],
|
|
158
|
+
mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]),
|
|
159
|
+
maxLineLength
|
|
160
|
+
);
|
|
161
|
+
result += common.repeat(" ", options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + " | " + line.str + "\n";
|
|
162
|
+
}
|
|
163
|
+
return result.replace(/\n$/, "");
|
|
164
|
+
}
|
|
165
|
+
module2.exports = makeSnippet;
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
// node_modules/js-yaml/lib/type.js
|
|
170
|
+
var require_type = __commonJS({
|
|
171
|
+
"node_modules/js-yaml/lib/type.js"(exports2, module2) {
|
|
172
|
+
"use strict";
|
|
173
|
+
var YAMLException = require_exception();
|
|
174
|
+
var TYPE_CONSTRUCTOR_OPTIONS = [
|
|
175
|
+
"kind",
|
|
176
|
+
"multi",
|
|
177
|
+
"resolve",
|
|
178
|
+
"construct",
|
|
179
|
+
"instanceOf",
|
|
180
|
+
"predicate",
|
|
181
|
+
"represent",
|
|
182
|
+
"representName",
|
|
183
|
+
"defaultStyle",
|
|
184
|
+
"styleAliases"
|
|
185
|
+
];
|
|
186
|
+
var YAML_NODE_KINDS = [
|
|
187
|
+
"scalar",
|
|
188
|
+
"sequence",
|
|
189
|
+
"mapping"
|
|
190
|
+
];
|
|
191
|
+
function compileStyleAliases(map) {
|
|
192
|
+
var result = {};
|
|
193
|
+
if (map !== null) {
|
|
194
|
+
Object.keys(map).forEach(function(style) {
|
|
195
|
+
map[style].forEach(function(alias) {
|
|
196
|
+
result[String(alias)] = style;
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
return result;
|
|
201
|
+
}
|
|
202
|
+
function Type(tag, options) {
|
|
203
|
+
options = options || {};
|
|
204
|
+
Object.keys(options).forEach(function(name) {
|
|
205
|
+
if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
|
|
206
|
+
throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
this.options = options;
|
|
210
|
+
this.tag = tag;
|
|
211
|
+
this.kind = options["kind"] || null;
|
|
212
|
+
this.resolve = options["resolve"] || function() {
|
|
213
|
+
return true;
|
|
214
|
+
};
|
|
215
|
+
this.construct = options["construct"] || function(data) {
|
|
216
|
+
return data;
|
|
217
|
+
};
|
|
218
|
+
this.instanceOf = options["instanceOf"] || null;
|
|
219
|
+
this.predicate = options["predicate"] || null;
|
|
220
|
+
this.represent = options["represent"] || null;
|
|
221
|
+
this.representName = options["representName"] || null;
|
|
222
|
+
this.defaultStyle = options["defaultStyle"] || null;
|
|
223
|
+
this.multi = options["multi"] || false;
|
|
224
|
+
this.styleAliases = compileStyleAliases(options["styleAliases"] || null);
|
|
225
|
+
if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
|
|
226
|
+
throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
module2.exports = Type;
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
// node_modules/js-yaml/lib/schema.js
|
|
234
|
+
var require_schema = __commonJS({
|
|
235
|
+
"node_modules/js-yaml/lib/schema.js"(exports2, module2) {
|
|
236
|
+
"use strict";
|
|
237
|
+
var YAMLException = require_exception();
|
|
238
|
+
var Type = require_type();
|
|
239
|
+
function compileList(schema, name) {
|
|
240
|
+
var result = [];
|
|
241
|
+
schema[name].forEach(function(currentType) {
|
|
242
|
+
var newIndex = result.length;
|
|
243
|
+
result.forEach(function(previousType, previousIndex) {
|
|
244
|
+
if (previousType.tag === currentType.tag && previousType.kind === currentType.kind && previousType.multi === currentType.multi) {
|
|
245
|
+
newIndex = previousIndex;
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
result[newIndex] = currentType;
|
|
249
|
+
});
|
|
250
|
+
return result;
|
|
251
|
+
}
|
|
252
|
+
function compileMap() {
|
|
253
|
+
var result = {
|
|
254
|
+
scalar: {},
|
|
255
|
+
sequence: {},
|
|
256
|
+
mapping: {},
|
|
257
|
+
fallback: {},
|
|
258
|
+
multi: {
|
|
259
|
+
scalar: [],
|
|
260
|
+
sequence: [],
|
|
261
|
+
mapping: [],
|
|
262
|
+
fallback: []
|
|
263
|
+
}
|
|
264
|
+
}, index, length;
|
|
265
|
+
function collectType(type) {
|
|
266
|
+
if (type.multi) {
|
|
267
|
+
result.multi[type.kind].push(type);
|
|
268
|
+
result.multi["fallback"].push(type);
|
|
269
|
+
} else {
|
|
270
|
+
result[type.kind][type.tag] = result["fallback"][type.tag] = type;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
for (index = 0, length = arguments.length; index < length; index += 1) {
|
|
274
|
+
arguments[index].forEach(collectType);
|
|
275
|
+
}
|
|
276
|
+
return result;
|
|
277
|
+
}
|
|
278
|
+
function Schema(definition) {
|
|
279
|
+
return this.extend(definition);
|
|
280
|
+
}
|
|
281
|
+
Schema.prototype.extend = function extend(definition) {
|
|
282
|
+
var implicit = [];
|
|
283
|
+
var explicit = [];
|
|
284
|
+
if (definition instanceof Type) {
|
|
285
|
+
explicit.push(definition);
|
|
286
|
+
} else if (Array.isArray(definition)) {
|
|
287
|
+
explicit = explicit.concat(definition);
|
|
288
|
+
} else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {
|
|
289
|
+
if (definition.implicit) implicit = implicit.concat(definition.implicit);
|
|
290
|
+
if (definition.explicit) explicit = explicit.concat(definition.explicit);
|
|
291
|
+
} else {
|
|
292
|
+
throw new YAMLException("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");
|
|
293
|
+
}
|
|
294
|
+
implicit.forEach(function(type) {
|
|
295
|
+
if (!(type instanceof Type)) {
|
|
296
|
+
throw new YAMLException("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
|
297
|
+
}
|
|
298
|
+
if (type.loadKind && type.loadKind !== "scalar") {
|
|
299
|
+
throw new YAMLException("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
|
|
300
|
+
}
|
|
301
|
+
if (type.multi) {
|
|
302
|
+
throw new YAMLException("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.");
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
explicit.forEach(function(type) {
|
|
306
|
+
if (!(type instanceof Type)) {
|
|
307
|
+
throw new YAMLException("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
var result = Object.create(Schema.prototype);
|
|
311
|
+
result.implicit = (this.implicit || []).concat(implicit);
|
|
312
|
+
result.explicit = (this.explicit || []).concat(explicit);
|
|
313
|
+
result.compiledImplicit = compileList(result, "implicit");
|
|
314
|
+
result.compiledExplicit = compileList(result, "explicit");
|
|
315
|
+
result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit);
|
|
316
|
+
return result;
|
|
317
|
+
};
|
|
318
|
+
module2.exports = Schema;
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
// node_modules/js-yaml/lib/type/str.js
|
|
323
|
+
var require_str = __commonJS({
|
|
324
|
+
"node_modules/js-yaml/lib/type/str.js"(exports2, module2) {
|
|
325
|
+
"use strict";
|
|
326
|
+
var Type = require_type();
|
|
327
|
+
module2.exports = new Type("tag:yaml.org,2002:str", {
|
|
328
|
+
kind: "scalar",
|
|
329
|
+
construct: function(data) {
|
|
330
|
+
return data !== null ? data : "";
|
|
331
|
+
}
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
// node_modules/js-yaml/lib/type/seq.js
|
|
337
|
+
var require_seq = __commonJS({
|
|
338
|
+
"node_modules/js-yaml/lib/type/seq.js"(exports2, module2) {
|
|
339
|
+
"use strict";
|
|
340
|
+
var Type = require_type();
|
|
341
|
+
module2.exports = new Type("tag:yaml.org,2002:seq", {
|
|
342
|
+
kind: "sequence",
|
|
343
|
+
construct: function(data) {
|
|
344
|
+
return data !== null ? data : [];
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
// node_modules/js-yaml/lib/type/map.js
|
|
351
|
+
var require_map = __commonJS({
|
|
352
|
+
"node_modules/js-yaml/lib/type/map.js"(exports2, module2) {
|
|
353
|
+
"use strict";
|
|
354
|
+
var Type = require_type();
|
|
355
|
+
module2.exports = new Type("tag:yaml.org,2002:map", {
|
|
356
|
+
kind: "mapping",
|
|
357
|
+
construct: function(data) {
|
|
358
|
+
return data !== null ? data : {};
|
|
359
|
+
}
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
});
|
|
363
|
+
|
|
364
|
+
// node_modules/js-yaml/lib/schema/failsafe.js
|
|
365
|
+
var require_failsafe = __commonJS({
|
|
366
|
+
"node_modules/js-yaml/lib/schema/failsafe.js"(exports2, module2) {
|
|
367
|
+
"use strict";
|
|
368
|
+
var Schema = require_schema();
|
|
369
|
+
module2.exports = new Schema({
|
|
370
|
+
explicit: [
|
|
371
|
+
require_str(),
|
|
372
|
+
require_seq(),
|
|
373
|
+
require_map()
|
|
374
|
+
]
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
// node_modules/js-yaml/lib/type/null.js
|
|
380
|
+
var require_null = __commonJS({
|
|
381
|
+
"node_modules/js-yaml/lib/type/null.js"(exports2, module2) {
|
|
382
|
+
"use strict";
|
|
383
|
+
var Type = require_type();
|
|
384
|
+
function resolveYamlNull(data) {
|
|
385
|
+
if (data === null) return true;
|
|
386
|
+
var max = data.length;
|
|
387
|
+
return max === 1 && data === "~" || max === 4 && (data === "null" || data === "Null" || data === "NULL");
|
|
388
|
+
}
|
|
389
|
+
function constructYamlNull() {
|
|
390
|
+
return null;
|
|
391
|
+
}
|
|
392
|
+
function isNull(object) {
|
|
393
|
+
return object === null;
|
|
394
|
+
}
|
|
395
|
+
module2.exports = new Type("tag:yaml.org,2002:null", {
|
|
396
|
+
kind: "scalar",
|
|
397
|
+
resolve: resolveYamlNull,
|
|
398
|
+
construct: constructYamlNull,
|
|
399
|
+
predicate: isNull,
|
|
400
|
+
represent: {
|
|
401
|
+
canonical: function() {
|
|
402
|
+
return "~";
|
|
403
|
+
},
|
|
404
|
+
lowercase: function() {
|
|
405
|
+
return "null";
|
|
406
|
+
},
|
|
407
|
+
uppercase: function() {
|
|
408
|
+
return "NULL";
|
|
409
|
+
},
|
|
410
|
+
camelcase: function() {
|
|
411
|
+
return "Null";
|
|
412
|
+
},
|
|
413
|
+
empty: function() {
|
|
414
|
+
return "";
|
|
415
|
+
}
|
|
416
|
+
},
|
|
417
|
+
defaultStyle: "lowercase"
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
});
|
|
421
|
+
|
|
422
|
+
// node_modules/js-yaml/lib/type/bool.js
|
|
423
|
+
var require_bool = __commonJS({
|
|
424
|
+
"node_modules/js-yaml/lib/type/bool.js"(exports2, module2) {
|
|
425
|
+
"use strict";
|
|
426
|
+
var Type = require_type();
|
|
427
|
+
function resolveYamlBoolean(data) {
|
|
428
|
+
if (data === null) return false;
|
|
429
|
+
var max = data.length;
|
|
430
|
+
return max === 4 && (data === "true" || data === "True" || data === "TRUE") || max === 5 && (data === "false" || data === "False" || data === "FALSE");
|
|
431
|
+
}
|
|
432
|
+
function constructYamlBoolean(data) {
|
|
433
|
+
return data === "true" || data === "True" || data === "TRUE";
|
|
434
|
+
}
|
|
435
|
+
function isBoolean(object) {
|
|
436
|
+
return Object.prototype.toString.call(object) === "[object Boolean]";
|
|
437
|
+
}
|
|
438
|
+
module2.exports = new Type("tag:yaml.org,2002:bool", {
|
|
439
|
+
kind: "scalar",
|
|
440
|
+
resolve: resolveYamlBoolean,
|
|
441
|
+
construct: constructYamlBoolean,
|
|
442
|
+
predicate: isBoolean,
|
|
443
|
+
represent: {
|
|
444
|
+
lowercase: function(object) {
|
|
445
|
+
return object ? "true" : "false";
|
|
446
|
+
},
|
|
447
|
+
uppercase: function(object) {
|
|
448
|
+
return object ? "TRUE" : "FALSE";
|
|
449
|
+
},
|
|
450
|
+
camelcase: function(object) {
|
|
451
|
+
return object ? "True" : "False";
|
|
452
|
+
}
|
|
453
|
+
},
|
|
454
|
+
defaultStyle: "lowercase"
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
});
|
|
458
|
+
|
|
459
|
+
// node_modules/js-yaml/lib/type/int.js
|
|
460
|
+
var require_int = __commonJS({
|
|
461
|
+
"node_modules/js-yaml/lib/type/int.js"(exports2, module2) {
|
|
462
|
+
"use strict";
|
|
463
|
+
var common = require_common();
|
|
464
|
+
var Type = require_type();
|
|
465
|
+
function isHexCode(c) {
|
|
466
|
+
return 48 <= c && c <= 57 || 65 <= c && c <= 70 || 97 <= c && c <= 102;
|
|
467
|
+
}
|
|
468
|
+
function isOctCode(c) {
|
|
469
|
+
return 48 <= c && c <= 55;
|
|
470
|
+
}
|
|
471
|
+
function isDecCode(c) {
|
|
472
|
+
return 48 <= c && c <= 57;
|
|
473
|
+
}
|
|
474
|
+
function resolveYamlInteger(data) {
|
|
475
|
+
if (data === null) return false;
|
|
476
|
+
var max = data.length, index = 0, hasDigits = false, ch;
|
|
477
|
+
if (!max) return false;
|
|
478
|
+
ch = data[index];
|
|
479
|
+
if (ch === "-" || ch === "+") {
|
|
480
|
+
ch = data[++index];
|
|
481
|
+
}
|
|
482
|
+
if (ch === "0") {
|
|
483
|
+
if (index + 1 === max) return true;
|
|
484
|
+
ch = data[++index];
|
|
485
|
+
if (ch === "b") {
|
|
486
|
+
index++;
|
|
487
|
+
for (; index < max; index++) {
|
|
488
|
+
ch = data[index];
|
|
489
|
+
if (ch === "_") continue;
|
|
490
|
+
if (ch !== "0" && ch !== "1") return false;
|
|
491
|
+
hasDigits = true;
|
|
492
|
+
}
|
|
493
|
+
return hasDigits && ch !== "_";
|
|
494
|
+
}
|
|
495
|
+
if (ch === "x") {
|
|
496
|
+
index++;
|
|
497
|
+
for (; index < max; index++) {
|
|
498
|
+
ch = data[index];
|
|
499
|
+
if (ch === "_") continue;
|
|
500
|
+
if (!isHexCode(data.charCodeAt(index))) return false;
|
|
501
|
+
hasDigits = true;
|
|
502
|
+
}
|
|
503
|
+
return hasDigits && ch !== "_";
|
|
504
|
+
}
|
|
505
|
+
if (ch === "o") {
|
|
506
|
+
index++;
|
|
507
|
+
for (; index < max; index++) {
|
|
508
|
+
ch = data[index];
|
|
509
|
+
if (ch === "_") continue;
|
|
510
|
+
if (!isOctCode(data.charCodeAt(index))) return false;
|
|
511
|
+
hasDigits = true;
|
|
512
|
+
}
|
|
513
|
+
return hasDigits && ch !== "_";
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
if (ch === "_") return false;
|
|
517
|
+
for (; index < max; index++) {
|
|
518
|
+
ch = data[index];
|
|
519
|
+
if (ch === "_") continue;
|
|
520
|
+
if (!isDecCode(data.charCodeAt(index))) {
|
|
521
|
+
return false;
|
|
522
|
+
}
|
|
523
|
+
hasDigits = true;
|
|
524
|
+
}
|
|
525
|
+
if (!hasDigits || ch === "_") return false;
|
|
526
|
+
return true;
|
|
527
|
+
}
|
|
528
|
+
function constructYamlInteger(data) {
|
|
529
|
+
var value = data, sign = 1, ch;
|
|
530
|
+
if (value.indexOf("_") !== -1) {
|
|
531
|
+
value = value.replace(/_/g, "");
|
|
532
|
+
}
|
|
533
|
+
ch = value[0];
|
|
534
|
+
if (ch === "-" || ch === "+") {
|
|
535
|
+
if (ch === "-") sign = -1;
|
|
536
|
+
value = value.slice(1);
|
|
537
|
+
ch = value[0];
|
|
538
|
+
}
|
|
539
|
+
if (value === "0") return 0;
|
|
540
|
+
if (ch === "0") {
|
|
541
|
+
if (value[1] === "b") return sign * parseInt(value.slice(2), 2);
|
|
542
|
+
if (value[1] === "x") return sign * parseInt(value.slice(2), 16);
|
|
543
|
+
if (value[1] === "o") return sign * parseInt(value.slice(2), 8);
|
|
544
|
+
}
|
|
545
|
+
return sign * parseInt(value, 10);
|
|
546
|
+
}
|
|
547
|
+
function isInteger(object) {
|
|
548
|
+
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 === 0 && !common.isNegativeZero(object));
|
|
549
|
+
}
|
|
550
|
+
module2.exports = new Type("tag:yaml.org,2002:int", {
|
|
551
|
+
kind: "scalar",
|
|
552
|
+
resolve: resolveYamlInteger,
|
|
553
|
+
construct: constructYamlInteger,
|
|
554
|
+
predicate: isInteger,
|
|
555
|
+
represent: {
|
|
556
|
+
binary: function(obj) {
|
|
557
|
+
return obj >= 0 ? "0b" + obj.toString(2) : "-0b" + obj.toString(2).slice(1);
|
|
558
|
+
},
|
|
559
|
+
octal: function(obj) {
|
|
560
|
+
return obj >= 0 ? "0o" + obj.toString(8) : "-0o" + obj.toString(8).slice(1);
|
|
561
|
+
},
|
|
562
|
+
decimal: function(obj) {
|
|
563
|
+
return obj.toString(10);
|
|
564
|
+
},
|
|
565
|
+
/* eslint-disable max-len */
|
|
566
|
+
hexadecimal: function(obj) {
|
|
567
|
+
return obj >= 0 ? "0x" + obj.toString(16).toUpperCase() : "-0x" + obj.toString(16).toUpperCase().slice(1);
|
|
568
|
+
}
|
|
569
|
+
},
|
|
570
|
+
defaultStyle: "decimal",
|
|
571
|
+
styleAliases: {
|
|
572
|
+
binary: [2, "bin"],
|
|
573
|
+
octal: [8, "oct"],
|
|
574
|
+
decimal: [10, "dec"],
|
|
575
|
+
hexadecimal: [16, "hex"]
|
|
576
|
+
}
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
});
|
|
580
|
+
|
|
581
|
+
// node_modules/js-yaml/lib/type/float.js
|
|
582
|
+
var require_float = __commonJS({
|
|
583
|
+
"node_modules/js-yaml/lib/type/float.js"(exports2, module2) {
|
|
584
|
+
"use strict";
|
|
585
|
+
var common = require_common();
|
|
586
|
+
var Type = require_type();
|
|
587
|
+
var YAML_FLOAT_PATTERN = new RegExp(
|
|
588
|
+
// 2.5e4, 2.5 and integers
|
|
589
|
+
"^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"
|
|
590
|
+
);
|
|
591
|
+
function resolveYamlFloat(data) {
|
|
592
|
+
if (data === null) return false;
|
|
593
|
+
if (!YAML_FLOAT_PATTERN.test(data) || // Quick hack to not allow integers end with `_`
|
|
594
|
+
// Probably should update regexp & check speed
|
|
595
|
+
data[data.length - 1] === "_") {
|
|
596
|
+
return false;
|
|
597
|
+
}
|
|
598
|
+
return true;
|
|
599
|
+
}
|
|
600
|
+
function constructYamlFloat(data) {
|
|
601
|
+
var value, sign;
|
|
602
|
+
value = data.replace(/_/g, "").toLowerCase();
|
|
603
|
+
sign = value[0] === "-" ? -1 : 1;
|
|
604
|
+
if ("+-".indexOf(value[0]) >= 0) {
|
|
605
|
+
value = value.slice(1);
|
|
606
|
+
}
|
|
607
|
+
if (value === ".inf") {
|
|
608
|
+
return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
|
|
609
|
+
} else if (value === ".nan") {
|
|
610
|
+
return NaN;
|
|
611
|
+
}
|
|
612
|
+
return sign * parseFloat(value, 10);
|
|
613
|
+
}
|
|
614
|
+
var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
|
|
615
|
+
function representYamlFloat(object, style) {
|
|
616
|
+
var res;
|
|
617
|
+
if (isNaN(object)) {
|
|
618
|
+
switch (style) {
|
|
619
|
+
case "lowercase":
|
|
620
|
+
return ".nan";
|
|
621
|
+
case "uppercase":
|
|
622
|
+
return ".NAN";
|
|
623
|
+
case "camelcase":
|
|
624
|
+
return ".NaN";
|
|
625
|
+
}
|
|
626
|
+
} else if (Number.POSITIVE_INFINITY === object) {
|
|
627
|
+
switch (style) {
|
|
628
|
+
case "lowercase":
|
|
629
|
+
return ".inf";
|
|
630
|
+
case "uppercase":
|
|
631
|
+
return ".INF";
|
|
632
|
+
case "camelcase":
|
|
633
|
+
return ".Inf";
|
|
634
|
+
}
|
|
635
|
+
} else if (Number.NEGATIVE_INFINITY === object) {
|
|
636
|
+
switch (style) {
|
|
637
|
+
case "lowercase":
|
|
638
|
+
return "-.inf";
|
|
639
|
+
case "uppercase":
|
|
640
|
+
return "-.INF";
|
|
641
|
+
case "camelcase":
|
|
642
|
+
return "-.Inf";
|
|
643
|
+
}
|
|
644
|
+
} else if (common.isNegativeZero(object)) {
|
|
645
|
+
return "-0.0";
|
|
646
|
+
}
|
|
647
|
+
res = object.toString(10);
|
|
648
|
+
return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res;
|
|
649
|
+
}
|
|
650
|
+
function isFloat(object) {
|
|
651
|
+
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || common.isNegativeZero(object));
|
|
652
|
+
}
|
|
653
|
+
module2.exports = new Type("tag:yaml.org,2002:float", {
|
|
654
|
+
kind: "scalar",
|
|
655
|
+
resolve: resolveYamlFloat,
|
|
656
|
+
construct: constructYamlFloat,
|
|
657
|
+
predicate: isFloat,
|
|
658
|
+
represent: representYamlFloat,
|
|
659
|
+
defaultStyle: "lowercase"
|
|
660
|
+
});
|
|
661
|
+
}
|
|
662
|
+
});
|
|
663
|
+
|
|
664
|
+
// node_modules/js-yaml/lib/schema/json.js
|
|
665
|
+
var require_json = __commonJS({
|
|
666
|
+
"node_modules/js-yaml/lib/schema/json.js"(exports2, module2) {
|
|
667
|
+
"use strict";
|
|
668
|
+
module2.exports = require_failsafe().extend({
|
|
669
|
+
implicit: [
|
|
670
|
+
require_null(),
|
|
671
|
+
require_bool(),
|
|
672
|
+
require_int(),
|
|
673
|
+
require_float()
|
|
674
|
+
]
|
|
675
|
+
});
|
|
676
|
+
}
|
|
677
|
+
});
|
|
678
|
+
|
|
679
|
+
// node_modules/js-yaml/lib/schema/core.js
|
|
680
|
+
var require_core = __commonJS({
|
|
681
|
+
"node_modules/js-yaml/lib/schema/core.js"(exports2, module2) {
|
|
682
|
+
"use strict";
|
|
683
|
+
module2.exports = require_json();
|
|
684
|
+
}
|
|
685
|
+
});
|
|
686
|
+
|
|
687
|
+
// node_modules/js-yaml/lib/type/timestamp.js
|
|
688
|
+
var require_timestamp = __commonJS({
|
|
689
|
+
"node_modules/js-yaml/lib/type/timestamp.js"(exports2, module2) {
|
|
690
|
+
"use strict";
|
|
691
|
+
var Type = require_type();
|
|
692
|
+
var YAML_DATE_REGEXP = new RegExp(
|
|
693
|
+
"^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"
|
|
694
|
+
);
|
|
695
|
+
var YAML_TIMESTAMP_REGEXP = new RegExp(
|
|
696
|
+
"^([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]))?))?$"
|
|
697
|
+
);
|
|
698
|
+
function resolveYamlTimestamp(data) {
|
|
699
|
+
if (data === null) return false;
|
|
700
|
+
if (YAML_DATE_REGEXP.exec(data) !== null) return true;
|
|
701
|
+
if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true;
|
|
702
|
+
return false;
|
|
703
|
+
}
|
|
704
|
+
function constructYamlTimestamp(data) {
|
|
705
|
+
var match, year, month, day, hour, minute, second, fraction = 0, delta = null, tz_hour, tz_minute, date;
|
|
706
|
+
match = YAML_DATE_REGEXP.exec(data);
|
|
707
|
+
if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data);
|
|
708
|
+
if (match === null) throw new Error("Date resolve error");
|
|
709
|
+
year = +match[1];
|
|
710
|
+
month = +match[2] - 1;
|
|
711
|
+
day = +match[3];
|
|
712
|
+
if (!match[4]) {
|
|
713
|
+
return new Date(Date.UTC(year, month, day));
|
|
714
|
+
}
|
|
715
|
+
hour = +match[4];
|
|
716
|
+
minute = +match[5];
|
|
717
|
+
second = +match[6];
|
|
718
|
+
if (match[7]) {
|
|
719
|
+
fraction = match[7].slice(0, 3);
|
|
720
|
+
while (fraction.length < 3) {
|
|
721
|
+
fraction += "0";
|
|
722
|
+
}
|
|
723
|
+
fraction = +fraction;
|
|
724
|
+
}
|
|
725
|
+
if (match[9]) {
|
|
726
|
+
tz_hour = +match[10];
|
|
727
|
+
tz_minute = +(match[11] || 0);
|
|
728
|
+
delta = (tz_hour * 60 + tz_minute) * 6e4;
|
|
729
|
+
if (match[9] === "-") delta = -delta;
|
|
730
|
+
}
|
|
731
|
+
date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
|
|
732
|
+
if (delta) date.setTime(date.getTime() - delta);
|
|
733
|
+
return date;
|
|
734
|
+
}
|
|
735
|
+
function representYamlTimestamp(object) {
|
|
736
|
+
return object.toISOString();
|
|
737
|
+
}
|
|
738
|
+
module2.exports = new Type("tag:yaml.org,2002:timestamp", {
|
|
739
|
+
kind: "scalar",
|
|
740
|
+
resolve: resolveYamlTimestamp,
|
|
741
|
+
construct: constructYamlTimestamp,
|
|
742
|
+
instanceOf: Date,
|
|
743
|
+
represent: representYamlTimestamp
|
|
744
|
+
});
|
|
745
|
+
}
|
|
746
|
+
});
|
|
747
|
+
|
|
748
|
+
// node_modules/js-yaml/lib/type/merge.js
|
|
749
|
+
var require_merge = __commonJS({
|
|
750
|
+
"node_modules/js-yaml/lib/type/merge.js"(exports2, module2) {
|
|
751
|
+
"use strict";
|
|
752
|
+
var Type = require_type();
|
|
753
|
+
function resolveYamlMerge(data) {
|
|
754
|
+
return data === "<<" || data === null;
|
|
755
|
+
}
|
|
756
|
+
module2.exports = new Type("tag:yaml.org,2002:merge", {
|
|
757
|
+
kind: "scalar",
|
|
758
|
+
resolve: resolveYamlMerge
|
|
759
|
+
});
|
|
760
|
+
}
|
|
761
|
+
});
|
|
762
|
+
|
|
763
|
+
// node_modules/js-yaml/lib/type/binary.js
|
|
764
|
+
var require_binary = __commonJS({
|
|
765
|
+
"node_modules/js-yaml/lib/type/binary.js"(exports2, module2) {
|
|
766
|
+
"use strict";
|
|
767
|
+
var Type = require_type();
|
|
768
|
+
var BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";
|
|
769
|
+
function resolveYamlBinary(data) {
|
|
770
|
+
if (data === null) return false;
|
|
771
|
+
var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP;
|
|
772
|
+
for (idx = 0; idx < max; idx++) {
|
|
773
|
+
code = map.indexOf(data.charAt(idx));
|
|
774
|
+
if (code > 64) continue;
|
|
775
|
+
if (code < 0) return false;
|
|
776
|
+
bitlen += 6;
|
|
777
|
+
}
|
|
778
|
+
return bitlen % 8 === 0;
|
|
779
|
+
}
|
|
780
|
+
function constructYamlBinary(data) {
|
|
781
|
+
var idx, tailbits, input = data.replace(/[\r\n=]/g, ""), max = input.length, map = BASE64_MAP, bits = 0, result = [];
|
|
782
|
+
for (idx = 0; idx < max; idx++) {
|
|
783
|
+
if (idx % 4 === 0 && idx) {
|
|
784
|
+
result.push(bits >> 16 & 255);
|
|
785
|
+
result.push(bits >> 8 & 255);
|
|
786
|
+
result.push(bits & 255);
|
|
787
|
+
}
|
|
788
|
+
bits = bits << 6 | map.indexOf(input.charAt(idx));
|
|
789
|
+
}
|
|
790
|
+
tailbits = max % 4 * 6;
|
|
791
|
+
if (tailbits === 0) {
|
|
792
|
+
result.push(bits >> 16 & 255);
|
|
793
|
+
result.push(bits >> 8 & 255);
|
|
794
|
+
result.push(bits & 255);
|
|
795
|
+
} else if (tailbits === 18) {
|
|
796
|
+
result.push(bits >> 10 & 255);
|
|
797
|
+
result.push(bits >> 2 & 255);
|
|
798
|
+
} else if (tailbits === 12) {
|
|
799
|
+
result.push(bits >> 4 & 255);
|
|
800
|
+
}
|
|
801
|
+
return new Uint8Array(result);
|
|
802
|
+
}
|
|
803
|
+
function representYamlBinary(object) {
|
|
804
|
+
var result = "", bits = 0, idx, tail, max = object.length, map = BASE64_MAP;
|
|
805
|
+
for (idx = 0; idx < max; idx++) {
|
|
806
|
+
if (idx % 3 === 0 && idx) {
|
|
807
|
+
result += map[bits >> 18 & 63];
|
|
808
|
+
result += map[bits >> 12 & 63];
|
|
809
|
+
result += map[bits >> 6 & 63];
|
|
810
|
+
result += map[bits & 63];
|
|
811
|
+
}
|
|
812
|
+
bits = (bits << 8) + object[idx];
|
|
813
|
+
}
|
|
814
|
+
tail = max % 3;
|
|
815
|
+
if (tail === 0) {
|
|
816
|
+
result += map[bits >> 18 & 63];
|
|
817
|
+
result += map[bits >> 12 & 63];
|
|
818
|
+
result += map[bits >> 6 & 63];
|
|
819
|
+
result += map[bits & 63];
|
|
820
|
+
} else if (tail === 2) {
|
|
821
|
+
result += map[bits >> 10 & 63];
|
|
822
|
+
result += map[bits >> 4 & 63];
|
|
823
|
+
result += map[bits << 2 & 63];
|
|
824
|
+
result += map[64];
|
|
825
|
+
} else if (tail === 1) {
|
|
826
|
+
result += map[bits >> 2 & 63];
|
|
827
|
+
result += map[bits << 4 & 63];
|
|
828
|
+
result += map[64];
|
|
829
|
+
result += map[64];
|
|
830
|
+
}
|
|
831
|
+
return result;
|
|
832
|
+
}
|
|
833
|
+
function isBinary(obj) {
|
|
834
|
+
return Object.prototype.toString.call(obj) === "[object Uint8Array]";
|
|
835
|
+
}
|
|
836
|
+
module2.exports = new Type("tag:yaml.org,2002:binary", {
|
|
837
|
+
kind: "scalar",
|
|
838
|
+
resolve: resolveYamlBinary,
|
|
839
|
+
construct: constructYamlBinary,
|
|
840
|
+
predicate: isBinary,
|
|
841
|
+
represent: representYamlBinary
|
|
842
|
+
});
|
|
843
|
+
}
|
|
844
|
+
});
|
|
845
|
+
|
|
846
|
+
// node_modules/js-yaml/lib/type/omap.js
|
|
847
|
+
var require_omap = __commonJS({
|
|
848
|
+
"node_modules/js-yaml/lib/type/omap.js"(exports2, module2) {
|
|
849
|
+
"use strict";
|
|
850
|
+
var Type = require_type();
|
|
851
|
+
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
852
|
+
var _toString = Object.prototype.toString;
|
|
853
|
+
function resolveYamlOmap(data) {
|
|
854
|
+
if (data === null) return true;
|
|
855
|
+
var objectKeys = [], index, length, pair, pairKey, pairHasKey, object = data;
|
|
856
|
+
for (index = 0, length = object.length; index < length; index += 1) {
|
|
857
|
+
pair = object[index];
|
|
858
|
+
pairHasKey = false;
|
|
859
|
+
if (_toString.call(pair) !== "[object Object]") return false;
|
|
860
|
+
for (pairKey in pair) {
|
|
861
|
+
if (_hasOwnProperty.call(pair, pairKey)) {
|
|
862
|
+
if (!pairHasKey) pairHasKey = true;
|
|
863
|
+
else return false;
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
if (!pairHasKey) return false;
|
|
867
|
+
if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);
|
|
868
|
+
else return false;
|
|
869
|
+
}
|
|
870
|
+
return true;
|
|
871
|
+
}
|
|
872
|
+
function constructYamlOmap(data) {
|
|
873
|
+
return data !== null ? data : [];
|
|
874
|
+
}
|
|
875
|
+
module2.exports = new Type("tag:yaml.org,2002:omap", {
|
|
876
|
+
kind: "sequence",
|
|
877
|
+
resolve: resolveYamlOmap,
|
|
878
|
+
construct: constructYamlOmap
|
|
879
|
+
});
|
|
880
|
+
}
|
|
881
|
+
});
|
|
882
|
+
|
|
883
|
+
// node_modules/js-yaml/lib/type/pairs.js
|
|
884
|
+
var require_pairs = __commonJS({
|
|
885
|
+
"node_modules/js-yaml/lib/type/pairs.js"(exports2, module2) {
|
|
886
|
+
"use strict";
|
|
887
|
+
var Type = require_type();
|
|
888
|
+
var _toString = Object.prototype.toString;
|
|
889
|
+
function resolveYamlPairs(data) {
|
|
890
|
+
if (data === null) return true;
|
|
891
|
+
var index, length, pair, keys, result, object = data;
|
|
892
|
+
result = new Array(object.length);
|
|
893
|
+
for (index = 0, length = object.length; index < length; index += 1) {
|
|
894
|
+
pair = object[index];
|
|
895
|
+
if (_toString.call(pair) !== "[object Object]") return false;
|
|
896
|
+
keys = Object.keys(pair);
|
|
897
|
+
if (keys.length !== 1) return false;
|
|
898
|
+
result[index] = [keys[0], pair[keys[0]]];
|
|
899
|
+
}
|
|
900
|
+
return true;
|
|
901
|
+
}
|
|
902
|
+
function constructYamlPairs(data) {
|
|
903
|
+
if (data === null) return [];
|
|
904
|
+
var index, length, pair, keys, result, object = data;
|
|
905
|
+
result = new Array(object.length);
|
|
906
|
+
for (index = 0, length = object.length; index < length; index += 1) {
|
|
907
|
+
pair = object[index];
|
|
908
|
+
keys = Object.keys(pair);
|
|
909
|
+
result[index] = [keys[0], pair[keys[0]]];
|
|
910
|
+
}
|
|
911
|
+
return result;
|
|
912
|
+
}
|
|
913
|
+
module2.exports = new Type("tag:yaml.org,2002:pairs", {
|
|
914
|
+
kind: "sequence",
|
|
915
|
+
resolve: resolveYamlPairs,
|
|
916
|
+
construct: constructYamlPairs
|
|
917
|
+
});
|
|
918
|
+
}
|
|
919
|
+
});
|
|
920
|
+
|
|
921
|
+
// node_modules/js-yaml/lib/type/set.js
|
|
922
|
+
var require_set = __commonJS({
|
|
923
|
+
"node_modules/js-yaml/lib/type/set.js"(exports2, module2) {
|
|
924
|
+
"use strict";
|
|
925
|
+
var Type = require_type();
|
|
926
|
+
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
927
|
+
function resolveYamlSet(data) {
|
|
928
|
+
if (data === null) return true;
|
|
929
|
+
var key, object = data;
|
|
930
|
+
for (key in object) {
|
|
931
|
+
if (_hasOwnProperty.call(object, key)) {
|
|
932
|
+
if (object[key] !== null) return false;
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
return true;
|
|
936
|
+
}
|
|
937
|
+
function constructYamlSet(data) {
|
|
938
|
+
return data !== null ? data : {};
|
|
939
|
+
}
|
|
940
|
+
module2.exports = new Type("tag:yaml.org,2002:set", {
|
|
941
|
+
kind: "mapping",
|
|
942
|
+
resolve: resolveYamlSet,
|
|
943
|
+
construct: constructYamlSet
|
|
944
|
+
});
|
|
945
|
+
}
|
|
946
|
+
});
|
|
947
|
+
|
|
948
|
+
// node_modules/js-yaml/lib/schema/default.js
|
|
949
|
+
var require_default = __commonJS({
|
|
950
|
+
"node_modules/js-yaml/lib/schema/default.js"(exports2, module2) {
|
|
951
|
+
"use strict";
|
|
952
|
+
module2.exports = require_core().extend({
|
|
953
|
+
implicit: [
|
|
954
|
+
require_timestamp(),
|
|
955
|
+
require_merge()
|
|
956
|
+
],
|
|
957
|
+
explicit: [
|
|
958
|
+
require_binary(),
|
|
959
|
+
require_omap(),
|
|
960
|
+
require_pairs(),
|
|
961
|
+
require_set()
|
|
962
|
+
]
|
|
963
|
+
});
|
|
964
|
+
}
|
|
965
|
+
});
|
|
966
|
+
|
|
967
|
+
// node_modules/js-yaml/lib/loader.js
|
|
968
|
+
var require_loader = __commonJS({
|
|
969
|
+
"node_modules/js-yaml/lib/loader.js"(exports2, module2) {
|
|
970
|
+
"use strict";
|
|
971
|
+
var common = require_common();
|
|
972
|
+
var YAMLException = require_exception();
|
|
973
|
+
var makeSnippet = require_snippet();
|
|
974
|
+
var DEFAULT_SCHEMA = require_default();
|
|
975
|
+
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
976
|
+
var CONTEXT_FLOW_IN = 1;
|
|
977
|
+
var CONTEXT_FLOW_OUT = 2;
|
|
978
|
+
var CONTEXT_BLOCK_IN = 3;
|
|
979
|
+
var CONTEXT_BLOCK_OUT = 4;
|
|
980
|
+
var CHOMPING_CLIP = 1;
|
|
981
|
+
var CHOMPING_STRIP = 2;
|
|
982
|
+
var CHOMPING_KEEP = 3;
|
|
983
|
+
var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
|
|
984
|
+
var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
|
|
985
|
+
var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
|
|
986
|
+
var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
|
|
987
|
+
var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
|
|
988
|
+
function _class(obj) {
|
|
989
|
+
return Object.prototype.toString.call(obj);
|
|
990
|
+
}
|
|
991
|
+
function is_EOL(c) {
|
|
992
|
+
return c === 10 || c === 13;
|
|
993
|
+
}
|
|
994
|
+
function is_WHITE_SPACE(c) {
|
|
995
|
+
return c === 9 || c === 32;
|
|
996
|
+
}
|
|
997
|
+
function is_WS_OR_EOL(c) {
|
|
998
|
+
return c === 9 || c === 32 || c === 10 || c === 13;
|
|
999
|
+
}
|
|
1000
|
+
function is_FLOW_INDICATOR(c) {
|
|
1001
|
+
return c === 44 || c === 91 || c === 93 || c === 123 || c === 125;
|
|
1002
|
+
}
|
|
1003
|
+
function fromHexCode(c) {
|
|
1004
|
+
var lc;
|
|
1005
|
+
if (48 <= c && c <= 57) {
|
|
1006
|
+
return c - 48;
|
|
1007
|
+
}
|
|
1008
|
+
lc = c | 32;
|
|
1009
|
+
if (97 <= lc && lc <= 102) {
|
|
1010
|
+
return lc - 97 + 10;
|
|
1011
|
+
}
|
|
1012
|
+
return -1;
|
|
1013
|
+
}
|
|
1014
|
+
function escapedHexLen(c) {
|
|
1015
|
+
if (c === 120) {
|
|
1016
|
+
return 2;
|
|
1017
|
+
}
|
|
1018
|
+
if (c === 117) {
|
|
1019
|
+
return 4;
|
|
1020
|
+
}
|
|
1021
|
+
if (c === 85) {
|
|
1022
|
+
return 8;
|
|
1023
|
+
}
|
|
1024
|
+
return 0;
|
|
1025
|
+
}
|
|
1026
|
+
function fromDecimalCode(c) {
|
|
1027
|
+
if (48 <= c && c <= 57) {
|
|
1028
|
+
return c - 48;
|
|
1029
|
+
}
|
|
1030
|
+
return -1;
|
|
1031
|
+
}
|
|
1032
|
+
function simpleEscapeSequence(c) {
|
|
1033
|
+
return c === 48 ? "\0" : c === 97 ? "\x07" : c === 98 ? "\b" : c === 116 ? " " : c === 9 ? " " : c === 110 ? "\n" : c === 118 ? "\v" : c === 102 ? "\f" : c === 114 ? "\r" : c === 101 ? "\x1B" : c === 32 ? " " : c === 34 ? '"' : c === 47 ? "/" : c === 92 ? "\\" : c === 78 ? "\x85" : c === 95 ? "\xA0" : c === 76 ? "\u2028" : c === 80 ? "\u2029" : "";
|
|
1034
|
+
}
|
|
1035
|
+
function charFromCodepoint(c) {
|
|
1036
|
+
if (c <= 65535) {
|
|
1037
|
+
return String.fromCharCode(c);
|
|
1038
|
+
}
|
|
1039
|
+
return String.fromCharCode(
|
|
1040
|
+
(c - 65536 >> 10) + 55296,
|
|
1041
|
+
(c - 65536 & 1023) + 56320
|
|
1042
|
+
);
|
|
1043
|
+
}
|
|
1044
|
+
function setProperty(object, key, value) {
|
|
1045
|
+
if (key === "__proto__") {
|
|
1046
|
+
Object.defineProperty(object, key, {
|
|
1047
|
+
configurable: true,
|
|
1048
|
+
enumerable: true,
|
|
1049
|
+
writable: true,
|
|
1050
|
+
value
|
|
1051
|
+
});
|
|
1052
|
+
} else {
|
|
1053
|
+
object[key] = value;
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
var simpleEscapeCheck = new Array(256);
|
|
1057
|
+
var simpleEscapeMap = new Array(256);
|
|
1058
|
+
for (i = 0; i < 256; i++) {
|
|
1059
|
+
simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
|
|
1060
|
+
simpleEscapeMap[i] = simpleEscapeSequence(i);
|
|
1061
|
+
}
|
|
1062
|
+
var i;
|
|
1063
|
+
function State(input, options) {
|
|
1064
|
+
this.input = input;
|
|
1065
|
+
this.filename = options["filename"] || null;
|
|
1066
|
+
this.schema = options["schema"] || DEFAULT_SCHEMA;
|
|
1067
|
+
this.onWarning = options["onWarning"] || null;
|
|
1068
|
+
this.legacy = options["legacy"] || false;
|
|
1069
|
+
this.json = options["json"] || false;
|
|
1070
|
+
this.listener = options["listener"] || null;
|
|
1071
|
+
this.implicitTypes = this.schema.compiledImplicit;
|
|
1072
|
+
this.typeMap = this.schema.compiledTypeMap;
|
|
1073
|
+
this.length = input.length;
|
|
1074
|
+
this.position = 0;
|
|
1075
|
+
this.line = 0;
|
|
1076
|
+
this.lineStart = 0;
|
|
1077
|
+
this.lineIndent = 0;
|
|
1078
|
+
this.firstTabInLine = -1;
|
|
1079
|
+
this.documents = [];
|
|
1080
|
+
}
|
|
1081
|
+
function generateError(state, message) {
|
|
1082
|
+
var mark = {
|
|
1083
|
+
name: state.filename,
|
|
1084
|
+
buffer: state.input.slice(0, -1),
|
|
1085
|
+
// omit trailing \0
|
|
1086
|
+
position: state.position,
|
|
1087
|
+
line: state.line,
|
|
1088
|
+
column: state.position - state.lineStart
|
|
1089
|
+
};
|
|
1090
|
+
mark.snippet = makeSnippet(mark);
|
|
1091
|
+
return new YAMLException(message, mark);
|
|
1092
|
+
}
|
|
1093
|
+
function throwError(state, message) {
|
|
1094
|
+
throw generateError(state, message);
|
|
1095
|
+
}
|
|
1096
|
+
function throwWarning(state, message) {
|
|
1097
|
+
if (state.onWarning) {
|
|
1098
|
+
state.onWarning.call(null, generateError(state, message));
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
var directiveHandlers = {
|
|
1102
|
+
YAML: function handleYamlDirective(state, name, args) {
|
|
1103
|
+
var match, major, minor;
|
|
1104
|
+
if (state.version !== null) {
|
|
1105
|
+
throwError(state, "duplication of %YAML directive");
|
|
1106
|
+
}
|
|
1107
|
+
if (args.length !== 1) {
|
|
1108
|
+
throwError(state, "YAML directive accepts exactly one argument");
|
|
1109
|
+
}
|
|
1110
|
+
match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
|
|
1111
|
+
if (match === null) {
|
|
1112
|
+
throwError(state, "ill-formed argument of the YAML directive");
|
|
1113
|
+
}
|
|
1114
|
+
major = parseInt(match[1], 10);
|
|
1115
|
+
minor = parseInt(match[2], 10);
|
|
1116
|
+
if (major !== 1) {
|
|
1117
|
+
throwError(state, "unacceptable YAML version of the document");
|
|
1118
|
+
}
|
|
1119
|
+
state.version = args[0];
|
|
1120
|
+
state.checkLineBreaks = minor < 2;
|
|
1121
|
+
if (minor !== 1 && minor !== 2) {
|
|
1122
|
+
throwWarning(state, "unsupported YAML version of the document");
|
|
1123
|
+
}
|
|
1124
|
+
},
|
|
1125
|
+
TAG: function handleTagDirective(state, name, args) {
|
|
1126
|
+
var handle, prefix;
|
|
1127
|
+
if (args.length !== 2) {
|
|
1128
|
+
throwError(state, "TAG directive accepts exactly two arguments");
|
|
1129
|
+
}
|
|
1130
|
+
handle = args[0];
|
|
1131
|
+
prefix = args[1];
|
|
1132
|
+
if (!PATTERN_TAG_HANDLE.test(handle)) {
|
|
1133
|
+
throwError(state, "ill-formed tag handle (first argument) of the TAG directive");
|
|
1134
|
+
}
|
|
1135
|
+
if (_hasOwnProperty.call(state.tagMap, handle)) {
|
|
1136
|
+
throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
|
|
1137
|
+
}
|
|
1138
|
+
if (!PATTERN_TAG_URI.test(prefix)) {
|
|
1139
|
+
throwError(state, "ill-formed tag prefix (second argument) of the TAG directive");
|
|
1140
|
+
}
|
|
1141
|
+
try {
|
|
1142
|
+
prefix = decodeURIComponent(prefix);
|
|
1143
|
+
} catch (err) {
|
|
1144
|
+
throwError(state, "tag prefix is malformed: " + prefix);
|
|
1145
|
+
}
|
|
1146
|
+
state.tagMap[handle] = prefix;
|
|
1147
|
+
}
|
|
1148
|
+
};
|
|
1149
|
+
function captureSegment(state, start, end, checkJson) {
|
|
1150
|
+
var _position, _length, _character, _result;
|
|
1151
|
+
if (start < end) {
|
|
1152
|
+
_result = state.input.slice(start, end);
|
|
1153
|
+
if (checkJson) {
|
|
1154
|
+
for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
|
|
1155
|
+
_character = _result.charCodeAt(_position);
|
|
1156
|
+
if (!(_character === 9 || 32 <= _character && _character <= 1114111)) {
|
|
1157
|
+
throwError(state, "expected valid JSON character");
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
} else if (PATTERN_NON_PRINTABLE.test(_result)) {
|
|
1161
|
+
throwError(state, "the stream contains non-printable characters");
|
|
1162
|
+
}
|
|
1163
|
+
state.result += _result;
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
function mergeMappings(state, destination, source, overridableKeys) {
|
|
1167
|
+
var sourceKeys, key, index, quantity;
|
|
1168
|
+
if (!common.isObject(source)) {
|
|
1169
|
+
throwError(state, "cannot merge mappings; the provided source object is unacceptable");
|
|
1170
|
+
}
|
|
1171
|
+
sourceKeys = Object.keys(source);
|
|
1172
|
+
for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
|
|
1173
|
+
key = sourceKeys[index];
|
|
1174
|
+
if (!_hasOwnProperty.call(destination, key)) {
|
|
1175
|
+
setProperty(destination, key, source[key]);
|
|
1176
|
+
overridableKeys[key] = true;
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startLineStart, startPos) {
|
|
1181
|
+
var index, quantity;
|
|
1182
|
+
if (Array.isArray(keyNode)) {
|
|
1183
|
+
keyNode = Array.prototype.slice.call(keyNode);
|
|
1184
|
+
for (index = 0, quantity = keyNode.length; index < quantity; index += 1) {
|
|
1185
|
+
if (Array.isArray(keyNode[index])) {
|
|
1186
|
+
throwError(state, "nested arrays are not supported inside keys");
|
|
1187
|
+
}
|
|
1188
|
+
if (typeof keyNode === "object" && _class(keyNode[index]) === "[object Object]") {
|
|
1189
|
+
keyNode[index] = "[object Object]";
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
if (typeof keyNode === "object" && _class(keyNode) === "[object Object]") {
|
|
1194
|
+
keyNode = "[object Object]";
|
|
1195
|
+
}
|
|
1196
|
+
keyNode = String(keyNode);
|
|
1197
|
+
if (_result === null) {
|
|
1198
|
+
_result = {};
|
|
1199
|
+
}
|
|
1200
|
+
if (keyTag === "tag:yaml.org,2002:merge") {
|
|
1201
|
+
if (Array.isArray(valueNode)) {
|
|
1202
|
+
for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
|
|
1203
|
+
mergeMappings(state, _result, valueNode[index], overridableKeys);
|
|
1204
|
+
}
|
|
1205
|
+
} else {
|
|
1206
|
+
mergeMappings(state, _result, valueNode, overridableKeys);
|
|
1207
|
+
}
|
|
1208
|
+
} else {
|
|
1209
|
+
if (!state.json && !_hasOwnProperty.call(overridableKeys, keyNode) && _hasOwnProperty.call(_result, keyNode)) {
|
|
1210
|
+
state.line = startLine || state.line;
|
|
1211
|
+
state.lineStart = startLineStart || state.lineStart;
|
|
1212
|
+
state.position = startPos || state.position;
|
|
1213
|
+
throwError(state, "duplicated mapping key");
|
|
1214
|
+
}
|
|
1215
|
+
setProperty(_result, keyNode, valueNode);
|
|
1216
|
+
delete overridableKeys[keyNode];
|
|
1217
|
+
}
|
|
1218
|
+
return _result;
|
|
1219
|
+
}
|
|
1220
|
+
function readLineBreak(state) {
|
|
1221
|
+
var ch;
|
|
1222
|
+
ch = state.input.charCodeAt(state.position);
|
|
1223
|
+
if (ch === 10) {
|
|
1224
|
+
state.position++;
|
|
1225
|
+
} else if (ch === 13) {
|
|
1226
|
+
state.position++;
|
|
1227
|
+
if (state.input.charCodeAt(state.position) === 10) {
|
|
1228
|
+
state.position++;
|
|
1229
|
+
}
|
|
1230
|
+
} else {
|
|
1231
|
+
throwError(state, "a line break is expected");
|
|
1232
|
+
}
|
|
1233
|
+
state.line += 1;
|
|
1234
|
+
state.lineStart = state.position;
|
|
1235
|
+
state.firstTabInLine = -1;
|
|
1236
|
+
}
|
|
1237
|
+
function skipSeparationSpace(state, allowComments, checkIndent) {
|
|
1238
|
+
var lineBreaks = 0, ch = state.input.charCodeAt(state.position);
|
|
1239
|
+
while (ch !== 0) {
|
|
1240
|
+
while (is_WHITE_SPACE(ch)) {
|
|
1241
|
+
if (ch === 9 && state.firstTabInLine === -1) {
|
|
1242
|
+
state.firstTabInLine = state.position;
|
|
1243
|
+
}
|
|
1244
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1245
|
+
}
|
|
1246
|
+
if (allowComments && ch === 35) {
|
|
1247
|
+
do {
|
|
1248
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1249
|
+
} while (ch !== 10 && ch !== 13 && ch !== 0);
|
|
1250
|
+
}
|
|
1251
|
+
if (is_EOL(ch)) {
|
|
1252
|
+
readLineBreak(state);
|
|
1253
|
+
ch = state.input.charCodeAt(state.position);
|
|
1254
|
+
lineBreaks++;
|
|
1255
|
+
state.lineIndent = 0;
|
|
1256
|
+
while (ch === 32) {
|
|
1257
|
+
state.lineIndent++;
|
|
1258
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1259
|
+
}
|
|
1260
|
+
} else {
|
|
1261
|
+
break;
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {
|
|
1265
|
+
throwWarning(state, "deficient indentation");
|
|
1266
|
+
}
|
|
1267
|
+
return lineBreaks;
|
|
1268
|
+
}
|
|
1269
|
+
function testDocumentSeparator(state) {
|
|
1270
|
+
var _position = state.position, ch;
|
|
1271
|
+
ch = state.input.charCodeAt(_position);
|
|
1272
|
+
if ((ch === 45 || ch === 46) && ch === state.input.charCodeAt(_position + 1) && ch === state.input.charCodeAt(_position + 2)) {
|
|
1273
|
+
_position += 3;
|
|
1274
|
+
ch = state.input.charCodeAt(_position);
|
|
1275
|
+
if (ch === 0 || is_WS_OR_EOL(ch)) {
|
|
1276
|
+
return true;
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
return false;
|
|
1280
|
+
}
|
|
1281
|
+
function writeFoldedLines(state, count) {
|
|
1282
|
+
if (count === 1) {
|
|
1283
|
+
state.result += " ";
|
|
1284
|
+
} else if (count > 1) {
|
|
1285
|
+
state.result += common.repeat("\n", count - 1);
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
function readPlainScalar(state, nodeIndent, withinFlowCollection) {
|
|
1289
|
+
var preceding, following, captureStart, captureEnd, hasPendingContent, _line, _lineStart, _lineIndent, _kind = state.kind, _result = state.result, ch;
|
|
1290
|
+
ch = state.input.charCodeAt(state.position);
|
|
1291
|
+
if (is_WS_OR_EOL(ch) || is_FLOW_INDICATOR(ch) || ch === 35 || ch === 38 || ch === 42 || ch === 33 || ch === 124 || ch === 62 || ch === 39 || ch === 34 || ch === 37 || ch === 64 || ch === 96) {
|
|
1292
|
+
return false;
|
|
1293
|
+
}
|
|
1294
|
+
if (ch === 63 || ch === 45) {
|
|
1295
|
+
following = state.input.charCodeAt(state.position + 1);
|
|
1296
|
+
if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
|
|
1297
|
+
return false;
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
state.kind = "scalar";
|
|
1301
|
+
state.result = "";
|
|
1302
|
+
captureStart = captureEnd = state.position;
|
|
1303
|
+
hasPendingContent = false;
|
|
1304
|
+
while (ch !== 0) {
|
|
1305
|
+
if (ch === 58) {
|
|
1306
|
+
following = state.input.charCodeAt(state.position + 1);
|
|
1307
|
+
if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
|
|
1308
|
+
break;
|
|
1309
|
+
}
|
|
1310
|
+
} else if (ch === 35) {
|
|
1311
|
+
preceding = state.input.charCodeAt(state.position - 1);
|
|
1312
|
+
if (is_WS_OR_EOL(preceding)) {
|
|
1313
|
+
break;
|
|
1314
|
+
}
|
|
1315
|
+
} else if (state.position === state.lineStart && testDocumentSeparator(state) || withinFlowCollection && is_FLOW_INDICATOR(ch)) {
|
|
1316
|
+
break;
|
|
1317
|
+
} else if (is_EOL(ch)) {
|
|
1318
|
+
_line = state.line;
|
|
1319
|
+
_lineStart = state.lineStart;
|
|
1320
|
+
_lineIndent = state.lineIndent;
|
|
1321
|
+
skipSeparationSpace(state, false, -1);
|
|
1322
|
+
if (state.lineIndent >= nodeIndent) {
|
|
1323
|
+
hasPendingContent = true;
|
|
1324
|
+
ch = state.input.charCodeAt(state.position);
|
|
1325
|
+
continue;
|
|
1326
|
+
} else {
|
|
1327
|
+
state.position = captureEnd;
|
|
1328
|
+
state.line = _line;
|
|
1329
|
+
state.lineStart = _lineStart;
|
|
1330
|
+
state.lineIndent = _lineIndent;
|
|
1331
|
+
break;
|
|
1332
|
+
}
|
|
1333
|
+
}
|
|
1334
|
+
if (hasPendingContent) {
|
|
1335
|
+
captureSegment(state, captureStart, captureEnd, false);
|
|
1336
|
+
writeFoldedLines(state, state.line - _line);
|
|
1337
|
+
captureStart = captureEnd = state.position;
|
|
1338
|
+
hasPendingContent = false;
|
|
1339
|
+
}
|
|
1340
|
+
if (!is_WHITE_SPACE(ch)) {
|
|
1341
|
+
captureEnd = state.position + 1;
|
|
1342
|
+
}
|
|
1343
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1344
|
+
}
|
|
1345
|
+
captureSegment(state, captureStart, captureEnd, false);
|
|
1346
|
+
if (state.result) {
|
|
1347
|
+
return true;
|
|
1348
|
+
}
|
|
1349
|
+
state.kind = _kind;
|
|
1350
|
+
state.result = _result;
|
|
1351
|
+
return false;
|
|
1352
|
+
}
|
|
1353
|
+
function readSingleQuotedScalar(state, nodeIndent) {
|
|
1354
|
+
var ch, captureStart, captureEnd;
|
|
1355
|
+
ch = state.input.charCodeAt(state.position);
|
|
1356
|
+
if (ch !== 39) {
|
|
1357
|
+
return false;
|
|
1358
|
+
}
|
|
1359
|
+
state.kind = "scalar";
|
|
1360
|
+
state.result = "";
|
|
1361
|
+
state.position++;
|
|
1362
|
+
captureStart = captureEnd = state.position;
|
|
1363
|
+
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
1364
|
+
if (ch === 39) {
|
|
1365
|
+
captureSegment(state, captureStart, state.position, true);
|
|
1366
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1367
|
+
if (ch === 39) {
|
|
1368
|
+
captureStart = state.position;
|
|
1369
|
+
state.position++;
|
|
1370
|
+
captureEnd = state.position;
|
|
1371
|
+
} else {
|
|
1372
|
+
return true;
|
|
1373
|
+
}
|
|
1374
|
+
} else if (is_EOL(ch)) {
|
|
1375
|
+
captureSegment(state, captureStart, captureEnd, true);
|
|
1376
|
+
writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
|
|
1377
|
+
captureStart = captureEnd = state.position;
|
|
1378
|
+
} else if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
1379
|
+
throwError(state, "unexpected end of the document within a single quoted scalar");
|
|
1380
|
+
} else {
|
|
1381
|
+
state.position++;
|
|
1382
|
+
captureEnd = state.position;
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
throwError(state, "unexpected end of the stream within a single quoted scalar");
|
|
1386
|
+
}
|
|
1387
|
+
function readDoubleQuotedScalar(state, nodeIndent) {
|
|
1388
|
+
var captureStart, captureEnd, hexLength, hexResult, tmp, ch;
|
|
1389
|
+
ch = state.input.charCodeAt(state.position);
|
|
1390
|
+
if (ch !== 34) {
|
|
1391
|
+
return false;
|
|
1392
|
+
}
|
|
1393
|
+
state.kind = "scalar";
|
|
1394
|
+
state.result = "";
|
|
1395
|
+
state.position++;
|
|
1396
|
+
captureStart = captureEnd = state.position;
|
|
1397
|
+
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
1398
|
+
if (ch === 34) {
|
|
1399
|
+
captureSegment(state, captureStart, state.position, true);
|
|
1400
|
+
state.position++;
|
|
1401
|
+
return true;
|
|
1402
|
+
} else if (ch === 92) {
|
|
1403
|
+
captureSegment(state, captureStart, state.position, true);
|
|
1404
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1405
|
+
if (is_EOL(ch)) {
|
|
1406
|
+
skipSeparationSpace(state, false, nodeIndent);
|
|
1407
|
+
} else if (ch < 256 && simpleEscapeCheck[ch]) {
|
|
1408
|
+
state.result += simpleEscapeMap[ch];
|
|
1409
|
+
state.position++;
|
|
1410
|
+
} else if ((tmp = escapedHexLen(ch)) > 0) {
|
|
1411
|
+
hexLength = tmp;
|
|
1412
|
+
hexResult = 0;
|
|
1413
|
+
for (; hexLength > 0; hexLength--) {
|
|
1414
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1415
|
+
if ((tmp = fromHexCode(ch)) >= 0) {
|
|
1416
|
+
hexResult = (hexResult << 4) + tmp;
|
|
1417
|
+
} else {
|
|
1418
|
+
throwError(state, "expected hexadecimal character");
|
|
1419
|
+
}
|
|
1420
|
+
}
|
|
1421
|
+
state.result += charFromCodepoint(hexResult);
|
|
1422
|
+
state.position++;
|
|
1423
|
+
} else {
|
|
1424
|
+
throwError(state, "unknown escape sequence");
|
|
1425
|
+
}
|
|
1426
|
+
captureStart = captureEnd = state.position;
|
|
1427
|
+
} else if (is_EOL(ch)) {
|
|
1428
|
+
captureSegment(state, captureStart, captureEnd, true);
|
|
1429
|
+
writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
|
|
1430
|
+
captureStart = captureEnd = state.position;
|
|
1431
|
+
} else if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
1432
|
+
throwError(state, "unexpected end of the document within a double quoted scalar");
|
|
1433
|
+
} else {
|
|
1434
|
+
state.position++;
|
|
1435
|
+
captureEnd = state.position;
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
throwError(state, "unexpected end of the stream within a double quoted scalar");
|
|
1439
|
+
}
|
|
1440
|
+
function readFlowCollection(state, nodeIndent) {
|
|
1441
|
+
var readNext = true, _line, _lineStart, _pos, _tag = state.tag, _result, _anchor = state.anchor, following, terminator, isPair, isExplicitPair, isMapping, overridableKeys = /* @__PURE__ */ Object.create(null), keyNode, keyTag, valueNode, ch;
|
|
1442
|
+
ch = state.input.charCodeAt(state.position);
|
|
1443
|
+
if (ch === 91) {
|
|
1444
|
+
terminator = 93;
|
|
1445
|
+
isMapping = false;
|
|
1446
|
+
_result = [];
|
|
1447
|
+
} else if (ch === 123) {
|
|
1448
|
+
terminator = 125;
|
|
1449
|
+
isMapping = true;
|
|
1450
|
+
_result = {};
|
|
1451
|
+
} else {
|
|
1452
|
+
return false;
|
|
1453
|
+
}
|
|
1454
|
+
if (state.anchor !== null) {
|
|
1455
|
+
state.anchorMap[state.anchor] = _result;
|
|
1456
|
+
}
|
|
1457
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1458
|
+
while (ch !== 0) {
|
|
1459
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
1460
|
+
ch = state.input.charCodeAt(state.position);
|
|
1461
|
+
if (ch === terminator) {
|
|
1462
|
+
state.position++;
|
|
1463
|
+
state.tag = _tag;
|
|
1464
|
+
state.anchor = _anchor;
|
|
1465
|
+
state.kind = isMapping ? "mapping" : "sequence";
|
|
1466
|
+
state.result = _result;
|
|
1467
|
+
return true;
|
|
1468
|
+
} else if (!readNext) {
|
|
1469
|
+
throwError(state, "missed comma between flow collection entries");
|
|
1470
|
+
} else if (ch === 44) {
|
|
1471
|
+
throwError(state, "expected the node content, but found ','");
|
|
1472
|
+
}
|
|
1473
|
+
keyTag = keyNode = valueNode = null;
|
|
1474
|
+
isPair = isExplicitPair = false;
|
|
1475
|
+
if (ch === 63) {
|
|
1476
|
+
following = state.input.charCodeAt(state.position + 1);
|
|
1477
|
+
if (is_WS_OR_EOL(following)) {
|
|
1478
|
+
isPair = isExplicitPair = true;
|
|
1479
|
+
state.position++;
|
|
1480
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
1481
|
+
}
|
|
1482
|
+
}
|
|
1483
|
+
_line = state.line;
|
|
1484
|
+
_lineStart = state.lineStart;
|
|
1485
|
+
_pos = state.position;
|
|
1486
|
+
composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
|
1487
|
+
keyTag = state.tag;
|
|
1488
|
+
keyNode = state.result;
|
|
1489
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
1490
|
+
ch = state.input.charCodeAt(state.position);
|
|
1491
|
+
if ((isExplicitPair || state.line === _line) && ch === 58) {
|
|
1492
|
+
isPair = true;
|
|
1493
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1494
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
1495
|
+
composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
|
1496
|
+
valueNode = state.result;
|
|
1497
|
+
}
|
|
1498
|
+
if (isMapping) {
|
|
1499
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos);
|
|
1500
|
+
} else if (isPair) {
|
|
1501
|
+
_result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos));
|
|
1502
|
+
} else {
|
|
1503
|
+
_result.push(keyNode);
|
|
1504
|
+
}
|
|
1505
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
1506
|
+
ch = state.input.charCodeAt(state.position);
|
|
1507
|
+
if (ch === 44) {
|
|
1508
|
+
readNext = true;
|
|
1509
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1510
|
+
} else {
|
|
1511
|
+
readNext = false;
|
|
1512
|
+
}
|
|
1513
|
+
}
|
|
1514
|
+
throwError(state, "unexpected end of the stream within a flow collection");
|
|
1515
|
+
}
|
|
1516
|
+
function readBlockScalar(state, nodeIndent) {
|
|
1517
|
+
var captureStart, folding, chomping = CHOMPING_CLIP, didReadContent = false, detectedIndent = false, textIndent = nodeIndent, emptyLines = 0, atMoreIndented = false, tmp, ch;
|
|
1518
|
+
ch = state.input.charCodeAt(state.position);
|
|
1519
|
+
if (ch === 124) {
|
|
1520
|
+
folding = false;
|
|
1521
|
+
} else if (ch === 62) {
|
|
1522
|
+
folding = true;
|
|
1523
|
+
} else {
|
|
1524
|
+
return false;
|
|
1525
|
+
}
|
|
1526
|
+
state.kind = "scalar";
|
|
1527
|
+
state.result = "";
|
|
1528
|
+
while (ch !== 0) {
|
|
1529
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1530
|
+
if (ch === 43 || ch === 45) {
|
|
1531
|
+
if (CHOMPING_CLIP === chomping) {
|
|
1532
|
+
chomping = ch === 43 ? CHOMPING_KEEP : CHOMPING_STRIP;
|
|
1533
|
+
} else {
|
|
1534
|
+
throwError(state, "repeat of a chomping mode identifier");
|
|
1535
|
+
}
|
|
1536
|
+
} else if ((tmp = fromDecimalCode(ch)) >= 0) {
|
|
1537
|
+
if (tmp === 0) {
|
|
1538
|
+
throwError(state, "bad explicit indentation width of a block scalar; it cannot be less than one");
|
|
1539
|
+
} else if (!detectedIndent) {
|
|
1540
|
+
textIndent = nodeIndent + tmp - 1;
|
|
1541
|
+
detectedIndent = true;
|
|
1542
|
+
} else {
|
|
1543
|
+
throwError(state, "repeat of an indentation width identifier");
|
|
1544
|
+
}
|
|
1545
|
+
} else {
|
|
1546
|
+
break;
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
if (is_WHITE_SPACE(ch)) {
|
|
1550
|
+
do {
|
|
1551
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1552
|
+
} while (is_WHITE_SPACE(ch));
|
|
1553
|
+
if (ch === 35) {
|
|
1554
|
+
do {
|
|
1555
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1556
|
+
} while (!is_EOL(ch) && ch !== 0);
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
while (ch !== 0) {
|
|
1560
|
+
readLineBreak(state);
|
|
1561
|
+
state.lineIndent = 0;
|
|
1562
|
+
ch = state.input.charCodeAt(state.position);
|
|
1563
|
+
while ((!detectedIndent || state.lineIndent < textIndent) && ch === 32) {
|
|
1564
|
+
state.lineIndent++;
|
|
1565
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1566
|
+
}
|
|
1567
|
+
if (!detectedIndent && state.lineIndent > textIndent) {
|
|
1568
|
+
textIndent = state.lineIndent;
|
|
1569
|
+
}
|
|
1570
|
+
if (is_EOL(ch)) {
|
|
1571
|
+
emptyLines++;
|
|
1572
|
+
continue;
|
|
1573
|
+
}
|
|
1574
|
+
if (state.lineIndent < textIndent) {
|
|
1575
|
+
if (chomping === CHOMPING_KEEP) {
|
|
1576
|
+
state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
|
1577
|
+
} else if (chomping === CHOMPING_CLIP) {
|
|
1578
|
+
if (didReadContent) {
|
|
1579
|
+
state.result += "\n";
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1582
|
+
break;
|
|
1583
|
+
}
|
|
1584
|
+
if (folding) {
|
|
1585
|
+
if (is_WHITE_SPACE(ch)) {
|
|
1586
|
+
atMoreIndented = true;
|
|
1587
|
+
state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
|
1588
|
+
} else if (atMoreIndented) {
|
|
1589
|
+
atMoreIndented = false;
|
|
1590
|
+
state.result += common.repeat("\n", emptyLines + 1);
|
|
1591
|
+
} else if (emptyLines === 0) {
|
|
1592
|
+
if (didReadContent) {
|
|
1593
|
+
state.result += " ";
|
|
1594
|
+
}
|
|
1595
|
+
} else {
|
|
1596
|
+
state.result += common.repeat("\n", emptyLines);
|
|
1597
|
+
}
|
|
1598
|
+
} else {
|
|
1599
|
+
state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
|
1600
|
+
}
|
|
1601
|
+
didReadContent = true;
|
|
1602
|
+
detectedIndent = true;
|
|
1603
|
+
emptyLines = 0;
|
|
1604
|
+
captureStart = state.position;
|
|
1605
|
+
while (!is_EOL(ch) && ch !== 0) {
|
|
1606
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1607
|
+
}
|
|
1608
|
+
captureSegment(state, captureStart, state.position, false);
|
|
1609
|
+
}
|
|
1610
|
+
return true;
|
|
1611
|
+
}
|
|
1612
|
+
function readBlockSequence(state, nodeIndent) {
|
|
1613
|
+
var _line, _tag = state.tag, _anchor = state.anchor, _result = [], following, detected = false, ch;
|
|
1614
|
+
if (state.firstTabInLine !== -1) return false;
|
|
1615
|
+
if (state.anchor !== null) {
|
|
1616
|
+
state.anchorMap[state.anchor] = _result;
|
|
1617
|
+
}
|
|
1618
|
+
ch = state.input.charCodeAt(state.position);
|
|
1619
|
+
while (ch !== 0) {
|
|
1620
|
+
if (state.firstTabInLine !== -1) {
|
|
1621
|
+
state.position = state.firstTabInLine;
|
|
1622
|
+
throwError(state, "tab characters must not be used in indentation");
|
|
1623
|
+
}
|
|
1624
|
+
if (ch !== 45) {
|
|
1625
|
+
break;
|
|
1626
|
+
}
|
|
1627
|
+
following = state.input.charCodeAt(state.position + 1);
|
|
1628
|
+
if (!is_WS_OR_EOL(following)) {
|
|
1629
|
+
break;
|
|
1630
|
+
}
|
|
1631
|
+
detected = true;
|
|
1632
|
+
state.position++;
|
|
1633
|
+
if (skipSeparationSpace(state, true, -1)) {
|
|
1634
|
+
if (state.lineIndent <= nodeIndent) {
|
|
1635
|
+
_result.push(null);
|
|
1636
|
+
ch = state.input.charCodeAt(state.position);
|
|
1637
|
+
continue;
|
|
1638
|
+
}
|
|
1639
|
+
}
|
|
1640
|
+
_line = state.line;
|
|
1641
|
+
composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
|
|
1642
|
+
_result.push(state.result);
|
|
1643
|
+
skipSeparationSpace(state, true, -1);
|
|
1644
|
+
ch = state.input.charCodeAt(state.position);
|
|
1645
|
+
if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
|
|
1646
|
+
throwError(state, "bad indentation of a sequence entry");
|
|
1647
|
+
} else if (state.lineIndent < nodeIndent) {
|
|
1648
|
+
break;
|
|
1649
|
+
}
|
|
1650
|
+
}
|
|
1651
|
+
if (detected) {
|
|
1652
|
+
state.tag = _tag;
|
|
1653
|
+
state.anchor = _anchor;
|
|
1654
|
+
state.kind = "sequence";
|
|
1655
|
+
state.result = _result;
|
|
1656
|
+
return true;
|
|
1657
|
+
}
|
|
1658
|
+
return false;
|
|
1659
|
+
}
|
|
1660
|
+
function readBlockMapping(state, nodeIndent, flowIndent) {
|
|
1661
|
+
var following, allowCompact, _line, _keyLine, _keyLineStart, _keyPos, _tag = state.tag, _anchor = state.anchor, _result = {}, overridableKeys = /* @__PURE__ */ Object.create(null), keyTag = null, keyNode = null, valueNode = null, atExplicitKey = false, detected = false, ch;
|
|
1662
|
+
if (state.firstTabInLine !== -1) return false;
|
|
1663
|
+
if (state.anchor !== null) {
|
|
1664
|
+
state.anchorMap[state.anchor] = _result;
|
|
1665
|
+
}
|
|
1666
|
+
ch = state.input.charCodeAt(state.position);
|
|
1667
|
+
while (ch !== 0) {
|
|
1668
|
+
if (!atExplicitKey && state.firstTabInLine !== -1) {
|
|
1669
|
+
state.position = state.firstTabInLine;
|
|
1670
|
+
throwError(state, "tab characters must not be used in indentation");
|
|
1671
|
+
}
|
|
1672
|
+
following = state.input.charCodeAt(state.position + 1);
|
|
1673
|
+
_line = state.line;
|
|
1674
|
+
if ((ch === 63 || ch === 58) && is_WS_OR_EOL(following)) {
|
|
1675
|
+
if (ch === 63) {
|
|
1676
|
+
if (atExplicitKey) {
|
|
1677
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
|
1678
|
+
keyTag = keyNode = valueNode = null;
|
|
1679
|
+
}
|
|
1680
|
+
detected = true;
|
|
1681
|
+
atExplicitKey = true;
|
|
1682
|
+
allowCompact = true;
|
|
1683
|
+
} else if (atExplicitKey) {
|
|
1684
|
+
atExplicitKey = false;
|
|
1685
|
+
allowCompact = true;
|
|
1686
|
+
} else {
|
|
1687
|
+
throwError(state, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");
|
|
1688
|
+
}
|
|
1689
|
+
state.position += 1;
|
|
1690
|
+
ch = following;
|
|
1691
|
+
} else {
|
|
1692
|
+
_keyLine = state.line;
|
|
1693
|
+
_keyLineStart = state.lineStart;
|
|
1694
|
+
_keyPos = state.position;
|
|
1695
|
+
if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
|
|
1696
|
+
break;
|
|
1697
|
+
}
|
|
1698
|
+
if (state.line === _line) {
|
|
1699
|
+
ch = state.input.charCodeAt(state.position);
|
|
1700
|
+
while (is_WHITE_SPACE(ch)) {
|
|
1701
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1702
|
+
}
|
|
1703
|
+
if (ch === 58) {
|
|
1704
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1705
|
+
if (!is_WS_OR_EOL(ch)) {
|
|
1706
|
+
throwError(state, "a whitespace character is expected after the key-value separator within a block mapping");
|
|
1707
|
+
}
|
|
1708
|
+
if (atExplicitKey) {
|
|
1709
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
|
1710
|
+
keyTag = keyNode = valueNode = null;
|
|
1711
|
+
}
|
|
1712
|
+
detected = true;
|
|
1713
|
+
atExplicitKey = false;
|
|
1714
|
+
allowCompact = false;
|
|
1715
|
+
keyTag = state.tag;
|
|
1716
|
+
keyNode = state.result;
|
|
1717
|
+
} else if (detected) {
|
|
1718
|
+
throwError(state, "can not read an implicit mapping pair; a colon is missed");
|
|
1719
|
+
} else {
|
|
1720
|
+
state.tag = _tag;
|
|
1721
|
+
state.anchor = _anchor;
|
|
1722
|
+
return true;
|
|
1723
|
+
}
|
|
1724
|
+
} else if (detected) {
|
|
1725
|
+
throwError(state, "can not read a block mapping entry; a multiline key may not be an implicit key");
|
|
1726
|
+
} else {
|
|
1727
|
+
state.tag = _tag;
|
|
1728
|
+
state.anchor = _anchor;
|
|
1729
|
+
return true;
|
|
1730
|
+
}
|
|
1731
|
+
}
|
|
1732
|
+
if (state.line === _line || state.lineIndent > nodeIndent) {
|
|
1733
|
+
if (atExplicitKey) {
|
|
1734
|
+
_keyLine = state.line;
|
|
1735
|
+
_keyLineStart = state.lineStart;
|
|
1736
|
+
_keyPos = state.position;
|
|
1737
|
+
}
|
|
1738
|
+
if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
|
|
1739
|
+
if (atExplicitKey) {
|
|
1740
|
+
keyNode = state.result;
|
|
1741
|
+
} else {
|
|
1742
|
+
valueNode = state.result;
|
|
1743
|
+
}
|
|
1744
|
+
}
|
|
1745
|
+
if (!atExplicitKey) {
|
|
1746
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos);
|
|
1747
|
+
keyTag = keyNode = valueNode = null;
|
|
1748
|
+
}
|
|
1749
|
+
skipSeparationSpace(state, true, -1);
|
|
1750
|
+
ch = state.input.charCodeAt(state.position);
|
|
1751
|
+
}
|
|
1752
|
+
if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
|
|
1753
|
+
throwError(state, "bad indentation of a mapping entry");
|
|
1754
|
+
} else if (state.lineIndent < nodeIndent) {
|
|
1755
|
+
break;
|
|
1756
|
+
}
|
|
1757
|
+
}
|
|
1758
|
+
if (atExplicitKey) {
|
|
1759
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
|
1760
|
+
}
|
|
1761
|
+
if (detected) {
|
|
1762
|
+
state.tag = _tag;
|
|
1763
|
+
state.anchor = _anchor;
|
|
1764
|
+
state.kind = "mapping";
|
|
1765
|
+
state.result = _result;
|
|
1766
|
+
}
|
|
1767
|
+
return detected;
|
|
1768
|
+
}
|
|
1769
|
+
function readTagProperty(state) {
|
|
1770
|
+
var _position, isVerbatim = false, isNamed = false, tagHandle, tagName, ch;
|
|
1771
|
+
ch = state.input.charCodeAt(state.position);
|
|
1772
|
+
if (ch !== 33) return false;
|
|
1773
|
+
if (state.tag !== null) {
|
|
1774
|
+
throwError(state, "duplication of a tag property");
|
|
1775
|
+
}
|
|
1776
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1777
|
+
if (ch === 60) {
|
|
1778
|
+
isVerbatim = true;
|
|
1779
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1780
|
+
} else if (ch === 33) {
|
|
1781
|
+
isNamed = true;
|
|
1782
|
+
tagHandle = "!!";
|
|
1783
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1784
|
+
} else {
|
|
1785
|
+
tagHandle = "!";
|
|
1786
|
+
}
|
|
1787
|
+
_position = state.position;
|
|
1788
|
+
if (isVerbatim) {
|
|
1789
|
+
do {
|
|
1790
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1791
|
+
} while (ch !== 0 && ch !== 62);
|
|
1792
|
+
if (state.position < state.length) {
|
|
1793
|
+
tagName = state.input.slice(_position, state.position);
|
|
1794
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1795
|
+
} else {
|
|
1796
|
+
throwError(state, "unexpected end of the stream within a verbatim tag");
|
|
1797
|
+
}
|
|
1798
|
+
} else {
|
|
1799
|
+
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
|
1800
|
+
if (ch === 33) {
|
|
1801
|
+
if (!isNamed) {
|
|
1802
|
+
tagHandle = state.input.slice(_position - 1, state.position + 1);
|
|
1803
|
+
if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
|
|
1804
|
+
throwError(state, "named tag handle cannot contain such characters");
|
|
1805
|
+
}
|
|
1806
|
+
isNamed = true;
|
|
1807
|
+
_position = state.position + 1;
|
|
1808
|
+
} else {
|
|
1809
|
+
throwError(state, "tag suffix cannot contain exclamation marks");
|
|
1810
|
+
}
|
|
1811
|
+
}
|
|
1812
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1813
|
+
}
|
|
1814
|
+
tagName = state.input.slice(_position, state.position);
|
|
1815
|
+
if (PATTERN_FLOW_INDICATORS.test(tagName)) {
|
|
1816
|
+
throwError(state, "tag suffix cannot contain flow indicator characters");
|
|
1817
|
+
}
|
|
1818
|
+
}
|
|
1819
|
+
if (tagName && !PATTERN_TAG_URI.test(tagName)) {
|
|
1820
|
+
throwError(state, "tag name cannot contain such characters: " + tagName);
|
|
1821
|
+
}
|
|
1822
|
+
try {
|
|
1823
|
+
tagName = decodeURIComponent(tagName);
|
|
1824
|
+
} catch (err) {
|
|
1825
|
+
throwError(state, "tag name is malformed: " + tagName);
|
|
1826
|
+
}
|
|
1827
|
+
if (isVerbatim) {
|
|
1828
|
+
state.tag = tagName;
|
|
1829
|
+
} else if (_hasOwnProperty.call(state.tagMap, tagHandle)) {
|
|
1830
|
+
state.tag = state.tagMap[tagHandle] + tagName;
|
|
1831
|
+
} else if (tagHandle === "!") {
|
|
1832
|
+
state.tag = "!" + tagName;
|
|
1833
|
+
} else if (tagHandle === "!!") {
|
|
1834
|
+
state.tag = "tag:yaml.org,2002:" + tagName;
|
|
1835
|
+
} else {
|
|
1836
|
+
throwError(state, 'undeclared tag handle "' + tagHandle + '"');
|
|
1837
|
+
}
|
|
1838
|
+
return true;
|
|
1839
|
+
}
|
|
1840
|
+
function readAnchorProperty(state) {
|
|
1841
|
+
var _position, ch;
|
|
1842
|
+
ch = state.input.charCodeAt(state.position);
|
|
1843
|
+
if (ch !== 38) return false;
|
|
1844
|
+
if (state.anchor !== null) {
|
|
1845
|
+
throwError(state, "duplication of an anchor property");
|
|
1846
|
+
}
|
|
1847
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1848
|
+
_position = state.position;
|
|
1849
|
+
while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
|
|
1850
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1851
|
+
}
|
|
1852
|
+
if (state.position === _position) {
|
|
1853
|
+
throwError(state, "name of an anchor node must contain at least one character");
|
|
1854
|
+
}
|
|
1855
|
+
state.anchor = state.input.slice(_position, state.position);
|
|
1856
|
+
return true;
|
|
1857
|
+
}
|
|
1858
|
+
function readAlias(state) {
|
|
1859
|
+
var _position, alias, ch;
|
|
1860
|
+
ch = state.input.charCodeAt(state.position);
|
|
1861
|
+
if (ch !== 42) return false;
|
|
1862
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1863
|
+
_position = state.position;
|
|
1864
|
+
while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
|
|
1865
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1866
|
+
}
|
|
1867
|
+
if (state.position === _position) {
|
|
1868
|
+
throwError(state, "name of an alias node must contain at least one character");
|
|
1869
|
+
}
|
|
1870
|
+
alias = state.input.slice(_position, state.position);
|
|
1871
|
+
if (!_hasOwnProperty.call(state.anchorMap, alias)) {
|
|
1872
|
+
throwError(state, 'unidentified alias "' + alias + '"');
|
|
1873
|
+
}
|
|
1874
|
+
state.result = state.anchorMap[alias];
|
|
1875
|
+
skipSeparationSpace(state, true, -1);
|
|
1876
|
+
return true;
|
|
1877
|
+
}
|
|
1878
|
+
function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
|
|
1879
|
+
var allowBlockStyles, allowBlockScalars, allowBlockCollections, indentStatus = 1, atNewLine = false, hasContent = false, typeIndex, typeQuantity, typeList, type, flowIndent, blockIndent;
|
|
1880
|
+
if (state.listener !== null) {
|
|
1881
|
+
state.listener("open", state);
|
|
1882
|
+
}
|
|
1883
|
+
state.tag = null;
|
|
1884
|
+
state.anchor = null;
|
|
1885
|
+
state.kind = null;
|
|
1886
|
+
state.result = null;
|
|
1887
|
+
allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext;
|
|
1888
|
+
if (allowToSeek) {
|
|
1889
|
+
if (skipSeparationSpace(state, true, -1)) {
|
|
1890
|
+
atNewLine = true;
|
|
1891
|
+
if (state.lineIndent > parentIndent) {
|
|
1892
|
+
indentStatus = 1;
|
|
1893
|
+
} else if (state.lineIndent === parentIndent) {
|
|
1894
|
+
indentStatus = 0;
|
|
1895
|
+
} else if (state.lineIndent < parentIndent) {
|
|
1896
|
+
indentStatus = -1;
|
|
1897
|
+
}
|
|
1898
|
+
}
|
|
1899
|
+
}
|
|
1900
|
+
if (indentStatus === 1) {
|
|
1901
|
+
while (readTagProperty(state) || readAnchorProperty(state)) {
|
|
1902
|
+
if (skipSeparationSpace(state, true, -1)) {
|
|
1903
|
+
atNewLine = true;
|
|
1904
|
+
allowBlockCollections = allowBlockStyles;
|
|
1905
|
+
if (state.lineIndent > parentIndent) {
|
|
1906
|
+
indentStatus = 1;
|
|
1907
|
+
} else if (state.lineIndent === parentIndent) {
|
|
1908
|
+
indentStatus = 0;
|
|
1909
|
+
} else if (state.lineIndent < parentIndent) {
|
|
1910
|
+
indentStatus = -1;
|
|
1911
|
+
}
|
|
1912
|
+
} else {
|
|
1913
|
+
allowBlockCollections = false;
|
|
1914
|
+
}
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
if (allowBlockCollections) {
|
|
1918
|
+
allowBlockCollections = atNewLine || allowCompact;
|
|
1919
|
+
}
|
|
1920
|
+
if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
|
|
1921
|
+
if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
|
|
1922
|
+
flowIndent = parentIndent;
|
|
1923
|
+
} else {
|
|
1924
|
+
flowIndent = parentIndent + 1;
|
|
1925
|
+
}
|
|
1926
|
+
blockIndent = state.position - state.lineStart;
|
|
1927
|
+
if (indentStatus === 1) {
|
|
1928
|
+
if (allowBlockCollections && (readBlockSequence(state, blockIndent) || readBlockMapping(state, blockIndent, flowIndent)) || readFlowCollection(state, flowIndent)) {
|
|
1929
|
+
hasContent = true;
|
|
1930
|
+
} else {
|
|
1931
|
+
if (allowBlockScalars && readBlockScalar(state, flowIndent) || readSingleQuotedScalar(state, flowIndent) || readDoubleQuotedScalar(state, flowIndent)) {
|
|
1932
|
+
hasContent = true;
|
|
1933
|
+
} else if (readAlias(state)) {
|
|
1934
|
+
hasContent = true;
|
|
1935
|
+
if (state.tag !== null || state.anchor !== null) {
|
|
1936
|
+
throwError(state, "alias node should not have any properties");
|
|
1937
|
+
}
|
|
1938
|
+
} else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
|
|
1939
|
+
hasContent = true;
|
|
1940
|
+
if (state.tag === null) {
|
|
1941
|
+
state.tag = "?";
|
|
1942
|
+
}
|
|
1943
|
+
}
|
|
1944
|
+
if (state.anchor !== null) {
|
|
1945
|
+
state.anchorMap[state.anchor] = state.result;
|
|
1946
|
+
}
|
|
1947
|
+
}
|
|
1948
|
+
} else if (indentStatus === 0) {
|
|
1949
|
+
hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
|
|
1950
|
+
}
|
|
1951
|
+
}
|
|
1952
|
+
if (state.tag === null) {
|
|
1953
|
+
if (state.anchor !== null) {
|
|
1954
|
+
state.anchorMap[state.anchor] = state.result;
|
|
1955
|
+
}
|
|
1956
|
+
} else if (state.tag === "?") {
|
|
1957
|
+
if (state.result !== null && state.kind !== "scalar") {
|
|
1958
|
+
throwError(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"');
|
|
1959
|
+
}
|
|
1960
|
+
for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
|
|
1961
|
+
type = state.implicitTypes[typeIndex];
|
|
1962
|
+
if (type.resolve(state.result)) {
|
|
1963
|
+
state.result = type.construct(state.result);
|
|
1964
|
+
state.tag = type.tag;
|
|
1965
|
+
if (state.anchor !== null) {
|
|
1966
|
+
state.anchorMap[state.anchor] = state.result;
|
|
1967
|
+
}
|
|
1968
|
+
break;
|
|
1969
|
+
}
|
|
1970
|
+
}
|
|
1971
|
+
} else if (state.tag !== "!") {
|
|
1972
|
+
if (_hasOwnProperty.call(state.typeMap[state.kind || "fallback"], state.tag)) {
|
|
1973
|
+
type = state.typeMap[state.kind || "fallback"][state.tag];
|
|
1974
|
+
} else {
|
|
1975
|
+
type = null;
|
|
1976
|
+
typeList = state.typeMap.multi[state.kind || "fallback"];
|
|
1977
|
+
for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) {
|
|
1978
|
+
if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) {
|
|
1979
|
+
type = typeList[typeIndex];
|
|
1980
|
+
break;
|
|
1981
|
+
}
|
|
1982
|
+
}
|
|
1983
|
+
}
|
|
1984
|
+
if (!type) {
|
|
1985
|
+
throwError(state, "unknown tag !<" + state.tag + ">");
|
|
1986
|
+
}
|
|
1987
|
+
if (state.result !== null && type.kind !== state.kind) {
|
|
1988
|
+
throwError(state, "unacceptable node kind for !<" + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"');
|
|
1989
|
+
}
|
|
1990
|
+
if (!type.resolve(state.result, state.tag)) {
|
|
1991
|
+
throwError(state, "cannot resolve a node with !<" + state.tag + "> explicit tag");
|
|
1992
|
+
} else {
|
|
1993
|
+
state.result = type.construct(state.result, state.tag);
|
|
1994
|
+
if (state.anchor !== null) {
|
|
1995
|
+
state.anchorMap[state.anchor] = state.result;
|
|
1996
|
+
}
|
|
1997
|
+
}
|
|
1998
|
+
}
|
|
1999
|
+
if (state.listener !== null) {
|
|
2000
|
+
state.listener("close", state);
|
|
2001
|
+
}
|
|
2002
|
+
return state.tag !== null || state.anchor !== null || hasContent;
|
|
2003
|
+
}
|
|
2004
|
+
function readDocument(state) {
|
|
2005
|
+
var documentStart = state.position, _position, directiveName, directiveArgs, hasDirectives = false, ch;
|
|
2006
|
+
state.version = null;
|
|
2007
|
+
state.checkLineBreaks = state.legacy;
|
|
2008
|
+
state.tagMap = /* @__PURE__ */ Object.create(null);
|
|
2009
|
+
state.anchorMap = /* @__PURE__ */ Object.create(null);
|
|
2010
|
+
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
2011
|
+
skipSeparationSpace(state, true, -1);
|
|
2012
|
+
ch = state.input.charCodeAt(state.position);
|
|
2013
|
+
if (state.lineIndent > 0 || ch !== 37) {
|
|
2014
|
+
break;
|
|
2015
|
+
}
|
|
2016
|
+
hasDirectives = true;
|
|
2017
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2018
|
+
_position = state.position;
|
|
2019
|
+
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
|
2020
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2021
|
+
}
|
|
2022
|
+
directiveName = state.input.slice(_position, state.position);
|
|
2023
|
+
directiveArgs = [];
|
|
2024
|
+
if (directiveName.length < 1) {
|
|
2025
|
+
throwError(state, "directive name must not be less than one character in length");
|
|
2026
|
+
}
|
|
2027
|
+
while (ch !== 0) {
|
|
2028
|
+
while (is_WHITE_SPACE(ch)) {
|
|
2029
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2030
|
+
}
|
|
2031
|
+
if (ch === 35) {
|
|
2032
|
+
do {
|
|
2033
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2034
|
+
} while (ch !== 0 && !is_EOL(ch));
|
|
2035
|
+
break;
|
|
2036
|
+
}
|
|
2037
|
+
if (is_EOL(ch)) break;
|
|
2038
|
+
_position = state.position;
|
|
2039
|
+
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
|
2040
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2041
|
+
}
|
|
2042
|
+
directiveArgs.push(state.input.slice(_position, state.position));
|
|
2043
|
+
}
|
|
2044
|
+
if (ch !== 0) readLineBreak(state);
|
|
2045
|
+
if (_hasOwnProperty.call(directiveHandlers, directiveName)) {
|
|
2046
|
+
directiveHandlers[directiveName](state, directiveName, directiveArgs);
|
|
2047
|
+
} else {
|
|
2048
|
+
throwWarning(state, 'unknown document directive "' + directiveName + '"');
|
|
2049
|
+
}
|
|
2050
|
+
}
|
|
2051
|
+
skipSeparationSpace(state, true, -1);
|
|
2052
|
+
if (state.lineIndent === 0 && state.input.charCodeAt(state.position) === 45 && state.input.charCodeAt(state.position + 1) === 45 && state.input.charCodeAt(state.position + 2) === 45) {
|
|
2053
|
+
state.position += 3;
|
|
2054
|
+
skipSeparationSpace(state, true, -1);
|
|
2055
|
+
} else if (hasDirectives) {
|
|
2056
|
+
throwError(state, "directives end mark is expected");
|
|
2057
|
+
}
|
|
2058
|
+
composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
|
|
2059
|
+
skipSeparationSpace(state, true, -1);
|
|
2060
|
+
if (state.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
|
|
2061
|
+
throwWarning(state, "non-ASCII line breaks are interpreted as content");
|
|
2062
|
+
}
|
|
2063
|
+
state.documents.push(state.result);
|
|
2064
|
+
if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
2065
|
+
if (state.input.charCodeAt(state.position) === 46) {
|
|
2066
|
+
state.position += 3;
|
|
2067
|
+
skipSeparationSpace(state, true, -1);
|
|
2068
|
+
}
|
|
2069
|
+
return;
|
|
2070
|
+
}
|
|
2071
|
+
if (state.position < state.length - 1) {
|
|
2072
|
+
throwError(state, "end of the stream or a document separator is expected");
|
|
2073
|
+
} else {
|
|
2074
|
+
return;
|
|
2075
|
+
}
|
|
2076
|
+
}
|
|
2077
|
+
function loadDocuments(input, options) {
|
|
2078
|
+
input = String(input);
|
|
2079
|
+
options = options || {};
|
|
2080
|
+
if (input.length !== 0) {
|
|
2081
|
+
if (input.charCodeAt(input.length - 1) !== 10 && input.charCodeAt(input.length - 1) !== 13) {
|
|
2082
|
+
input += "\n";
|
|
2083
|
+
}
|
|
2084
|
+
if (input.charCodeAt(0) === 65279) {
|
|
2085
|
+
input = input.slice(1);
|
|
2086
|
+
}
|
|
2087
|
+
}
|
|
2088
|
+
var state = new State(input, options);
|
|
2089
|
+
var nullpos = input.indexOf("\0");
|
|
2090
|
+
if (nullpos !== -1) {
|
|
2091
|
+
state.position = nullpos;
|
|
2092
|
+
throwError(state, "null byte is not allowed in input");
|
|
2093
|
+
}
|
|
2094
|
+
state.input += "\0";
|
|
2095
|
+
while (state.input.charCodeAt(state.position) === 32) {
|
|
2096
|
+
state.lineIndent += 1;
|
|
2097
|
+
state.position += 1;
|
|
2098
|
+
}
|
|
2099
|
+
while (state.position < state.length - 1) {
|
|
2100
|
+
readDocument(state);
|
|
2101
|
+
}
|
|
2102
|
+
return state.documents;
|
|
2103
|
+
}
|
|
2104
|
+
function loadAll(input, iterator, options) {
|
|
2105
|
+
if (iterator !== null && typeof iterator === "object" && typeof options === "undefined") {
|
|
2106
|
+
options = iterator;
|
|
2107
|
+
iterator = null;
|
|
2108
|
+
}
|
|
2109
|
+
var documents = loadDocuments(input, options);
|
|
2110
|
+
if (typeof iterator !== "function") {
|
|
2111
|
+
return documents;
|
|
2112
|
+
}
|
|
2113
|
+
for (var index = 0, length = documents.length; index < length; index += 1) {
|
|
2114
|
+
iterator(documents[index]);
|
|
2115
|
+
}
|
|
2116
|
+
}
|
|
2117
|
+
function load(input, options) {
|
|
2118
|
+
var documents = loadDocuments(input, options);
|
|
2119
|
+
if (documents.length === 0) {
|
|
2120
|
+
return void 0;
|
|
2121
|
+
} else if (documents.length === 1) {
|
|
2122
|
+
return documents[0];
|
|
2123
|
+
}
|
|
2124
|
+
throw new YAMLException("expected a single document in the stream, but found more");
|
|
2125
|
+
}
|
|
2126
|
+
module2.exports.loadAll = loadAll;
|
|
2127
|
+
module2.exports.load = load;
|
|
2128
|
+
}
|
|
2129
|
+
});
|
|
2130
|
+
|
|
2131
|
+
// node_modules/js-yaml/lib/dumper.js
|
|
2132
|
+
var require_dumper = __commonJS({
|
|
2133
|
+
"node_modules/js-yaml/lib/dumper.js"(exports2, module2) {
|
|
2134
|
+
"use strict";
|
|
2135
|
+
var common = require_common();
|
|
2136
|
+
var YAMLException = require_exception();
|
|
2137
|
+
var DEFAULT_SCHEMA = require_default();
|
|
2138
|
+
var _toString = Object.prototype.toString;
|
|
2139
|
+
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
2140
|
+
var CHAR_BOM = 65279;
|
|
2141
|
+
var CHAR_TAB = 9;
|
|
2142
|
+
var CHAR_LINE_FEED = 10;
|
|
2143
|
+
var CHAR_CARRIAGE_RETURN = 13;
|
|
2144
|
+
var CHAR_SPACE = 32;
|
|
2145
|
+
var CHAR_EXCLAMATION = 33;
|
|
2146
|
+
var CHAR_DOUBLE_QUOTE = 34;
|
|
2147
|
+
var CHAR_SHARP = 35;
|
|
2148
|
+
var CHAR_PERCENT = 37;
|
|
2149
|
+
var CHAR_AMPERSAND = 38;
|
|
2150
|
+
var CHAR_SINGLE_QUOTE = 39;
|
|
2151
|
+
var CHAR_ASTERISK = 42;
|
|
2152
|
+
var CHAR_COMMA = 44;
|
|
2153
|
+
var CHAR_MINUS = 45;
|
|
2154
|
+
var CHAR_COLON = 58;
|
|
2155
|
+
var CHAR_EQUALS = 61;
|
|
2156
|
+
var CHAR_GREATER_THAN = 62;
|
|
2157
|
+
var CHAR_QUESTION = 63;
|
|
2158
|
+
var CHAR_COMMERCIAL_AT = 64;
|
|
2159
|
+
var CHAR_LEFT_SQUARE_BRACKET = 91;
|
|
2160
|
+
var CHAR_RIGHT_SQUARE_BRACKET = 93;
|
|
2161
|
+
var CHAR_GRAVE_ACCENT = 96;
|
|
2162
|
+
var CHAR_LEFT_CURLY_BRACKET = 123;
|
|
2163
|
+
var CHAR_VERTICAL_LINE = 124;
|
|
2164
|
+
var CHAR_RIGHT_CURLY_BRACKET = 125;
|
|
2165
|
+
var ESCAPE_SEQUENCES = {};
|
|
2166
|
+
ESCAPE_SEQUENCES[0] = "\\0";
|
|
2167
|
+
ESCAPE_SEQUENCES[7] = "\\a";
|
|
2168
|
+
ESCAPE_SEQUENCES[8] = "\\b";
|
|
2169
|
+
ESCAPE_SEQUENCES[9] = "\\t";
|
|
2170
|
+
ESCAPE_SEQUENCES[10] = "\\n";
|
|
2171
|
+
ESCAPE_SEQUENCES[11] = "\\v";
|
|
2172
|
+
ESCAPE_SEQUENCES[12] = "\\f";
|
|
2173
|
+
ESCAPE_SEQUENCES[13] = "\\r";
|
|
2174
|
+
ESCAPE_SEQUENCES[27] = "\\e";
|
|
2175
|
+
ESCAPE_SEQUENCES[34] = '\\"';
|
|
2176
|
+
ESCAPE_SEQUENCES[92] = "\\\\";
|
|
2177
|
+
ESCAPE_SEQUENCES[133] = "\\N";
|
|
2178
|
+
ESCAPE_SEQUENCES[160] = "\\_";
|
|
2179
|
+
ESCAPE_SEQUENCES[8232] = "\\L";
|
|
2180
|
+
ESCAPE_SEQUENCES[8233] = "\\P";
|
|
2181
|
+
var DEPRECATED_BOOLEANS_SYNTAX = [
|
|
2182
|
+
"y",
|
|
2183
|
+
"Y",
|
|
2184
|
+
"yes",
|
|
2185
|
+
"Yes",
|
|
2186
|
+
"YES",
|
|
2187
|
+
"on",
|
|
2188
|
+
"On",
|
|
2189
|
+
"ON",
|
|
2190
|
+
"n",
|
|
2191
|
+
"N",
|
|
2192
|
+
"no",
|
|
2193
|
+
"No",
|
|
2194
|
+
"NO",
|
|
2195
|
+
"off",
|
|
2196
|
+
"Off",
|
|
2197
|
+
"OFF"
|
|
2198
|
+
];
|
|
2199
|
+
var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
|
|
2200
|
+
function compileStyleMap(schema, map) {
|
|
2201
|
+
var result, keys, index, length, tag, style, type;
|
|
2202
|
+
if (map === null) return {};
|
|
2203
|
+
result = {};
|
|
2204
|
+
keys = Object.keys(map);
|
|
2205
|
+
for (index = 0, length = keys.length; index < length; index += 1) {
|
|
2206
|
+
tag = keys[index];
|
|
2207
|
+
style = String(map[tag]);
|
|
2208
|
+
if (tag.slice(0, 2) === "!!") {
|
|
2209
|
+
tag = "tag:yaml.org,2002:" + tag.slice(2);
|
|
2210
|
+
}
|
|
2211
|
+
type = schema.compiledTypeMap["fallback"][tag];
|
|
2212
|
+
if (type && _hasOwnProperty.call(type.styleAliases, style)) {
|
|
2213
|
+
style = type.styleAliases[style];
|
|
2214
|
+
}
|
|
2215
|
+
result[tag] = style;
|
|
2216
|
+
}
|
|
2217
|
+
return result;
|
|
2218
|
+
}
|
|
2219
|
+
function encodeHex(character) {
|
|
2220
|
+
var string, handle, length;
|
|
2221
|
+
string = character.toString(16).toUpperCase();
|
|
2222
|
+
if (character <= 255) {
|
|
2223
|
+
handle = "x";
|
|
2224
|
+
length = 2;
|
|
2225
|
+
} else if (character <= 65535) {
|
|
2226
|
+
handle = "u";
|
|
2227
|
+
length = 4;
|
|
2228
|
+
} else if (character <= 4294967295) {
|
|
2229
|
+
handle = "U";
|
|
2230
|
+
length = 8;
|
|
2231
|
+
} else {
|
|
2232
|
+
throw new YAMLException("code point within a string may not be greater than 0xFFFFFFFF");
|
|
2233
|
+
}
|
|
2234
|
+
return "\\" + handle + common.repeat("0", length - string.length) + string;
|
|
2235
|
+
}
|
|
2236
|
+
var QUOTING_TYPE_SINGLE = 1;
|
|
2237
|
+
var QUOTING_TYPE_DOUBLE = 2;
|
|
2238
|
+
function State(options) {
|
|
2239
|
+
this.schema = options["schema"] || DEFAULT_SCHEMA;
|
|
2240
|
+
this.indent = Math.max(1, options["indent"] || 2);
|
|
2241
|
+
this.noArrayIndent = options["noArrayIndent"] || false;
|
|
2242
|
+
this.skipInvalid = options["skipInvalid"] || false;
|
|
2243
|
+
this.flowLevel = common.isNothing(options["flowLevel"]) ? -1 : options["flowLevel"];
|
|
2244
|
+
this.styleMap = compileStyleMap(this.schema, options["styles"] || null);
|
|
2245
|
+
this.sortKeys = options["sortKeys"] || false;
|
|
2246
|
+
this.lineWidth = options["lineWidth"] || 80;
|
|
2247
|
+
this.noRefs = options["noRefs"] || false;
|
|
2248
|
+
this.noCompatMode = options["noCompatMode"] || false;
|
|
2249
|
+
this.condenseFlow = options["condenseFlow"] || false;
|
|
2250
|
+
this.quotingType = options["quotingType"] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE;
|
|
2251
|
+
this.forceQuotes = options["forceQuotes"] || false;
|
|
2252
|
+
this.replacer = typeof options["replacer"] === "function" ? options["replacer"] : null;
|
|
2253
|
+
this.implicitTypes = this.schema.compiledImplicit;
|
|
2254
|
+
this.explicitTypes = this.schema.compiledExplicit;
|
|
2255
|
+
this.tag = null;
|
|
2256
|
+
this.result = "";
|
|
2257
|
+
this.duplicates = [];
|
|
2258
|
+
this.usedDuplicates = null;
|
|
2259
|
+
}
|
|
2260
|
+
function indentString(string, spaces) {
|
|
2261
|
+
var ind = common.repeat(" ", spaces), position = 0, next = -1, result = "", line, length = string.length;
|
|
2262
|
+
while (position < length) {
|
|
2263
|
+
next = string.indexOf("\n", position);
|
|
2264
|
+
if (next === -1) {
|
|
2265
|
+
line = string.slice(position);
|
|
2266
|
+
position = length;
|
|
2267
|
+
} else {
|
|
2268
|
+
line = string.slice(position, next + 1);
|
|
2269
|
+
position = next + 1;
|
|
2270
|
+
}
|
|
2271
|
+
if (line.length && line !== "\n") result += ind;
|
|
2272
|
+
result += line;
|
|
2273
|
+
}
|
|
2274
|
+
return result;
|
|
2275
|
+
}
|
|
2276
|
+
function generateNextLine(state, level) {
|
|
2277
|
+
return "\n" + common.repeat(" ", state.indent * level);
|
|
2278
|
+
}
|
|
2279
|
+
function testImplicitResolving(state, str) {
|
|
2280
|
+
var index, length, type;
|
|
2281
|
+
for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {
|
|
2282
|
+
type = state.implicitTypes[index];
|
|
2283
|
+
if (type.resolve(str)) {
|
|
2284
|
+
return true;
|
|
2285
|
+
}
|
|
2286
|
+
}
|
|
2287
|
+
return false;
|
|
2288
|
+
}
|
|
2289
|
+
function isWhitespace(c) {
|
|
2290
|
+
return c === CHAR_SPACE || c === CHAR_TAB;
|
|
2291
|
+
}
|
|
2292
|
+
function isPrintable(c) {
|
|
2293
|
+
return 32 <= c && c <= 126 || 161 <= c && c <= 55295 && c !== 8232 && c !== 8233 || 57344 <= c && c <= 65533 && c !== CHAR_BOM || 65536 <= c && c <= 1114111;
|
|
2294
|
+
}
|
|
2295
|
+
function isNsCharOrWhitespace(c) {
|
|
2296
|
+
return isPrintable(c) && c !== CHAR_BOM && c !== CHAR_CARRIAGE_RETURN && c !== CHAR_LINE_FEED;
|
|
2297
|
+
}
|
|
2298
|
+
function isPlainSafe(c, prev, inblock) {
|
|
2299
|
+
var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c);
|
|
2300
|
+
var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c);
|
|
2301
|
+
return (
|
|
2302
|
+
// ns-plain-safe
|
|
2303
|
+
(inblock ? (
|
|
2304
|
+
// c = flow-in
|
|
2305
|
+
cIsNsCharOrWhitespace
|
|
2306
|
+
) : cIsNsCharOrWhitespace && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET) && c !== CHAR_SHARP && !(prev === CHAR_COLON && !cIsNsChar) || isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP || prev === CHAR_COLON && cIsNsChar
|
|
2307
|
+
);
|
|
2308
|
+
}
|
|
2309
|
+
function isPlainSafeFirst(c) {
|
|
2310
|
+
return isPrintable(c) && c !== CHAR_BOM && !isWhitespace(c) && c !== CHAR_MINUS && c !== CHAR_QUESTION && c !== CHAR_COLON && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET && c !== CHAR_SHARP && c !== CHAR_AMPERSAND && c !== CHAR_ASTERISK && c !== CHAR_EXCLAMATION && c !== CHAR_VERTICAL_LINE && c !== CHAR_EQUALS && c !== CHAR_GREATER_THAN && c !== CHAR_SINGLE_QUOTE && c !== CHAR_DOUBLE_QUOTE && c !== CHAR_PERCENT && c !== CHAR_COMMERCIAL_AT && c !== CHAR_GRAVE_ACCENT;
|
|
2311
|
+
}
|
|
2312
|
+
function isPlainSafeLast(c) {
|
|
2313
|
+
return !isWhitespace(c) && c !== CHAR_COLON;
|
|
2314
|
+
}
|
|
2315
|
+
function codePointAt(string, pos) {
|
|
2316
|
+
var first = string.charCodeAt(pos), second;
|
|
2317
|
+
if (first >= 55296 && first <= 56319 && pos + 1 < string.length) {
|
|
2318
|
+
second = string.charCodeAt(pos + 1);
|
|
2319
|
+
if (second >= 56320 && second <= 57343) {
|
|
2320
|
+
return (first - 55296) * 1024 + second - 56320 + 65536;
|
|
2321
|
+
}
|
|
2322
|
+
}
|
|
2323
|
+
return first;
|
|
2324
|
+
}
|
|
2325
|
+
function needIndentIndicator(string) {
|
|
2326
|
+
var leadingSpaceRe = /^\n* /;
|
|
2327
|
+
return leadingSpaceRe.test(string);
|
|
2328
|
+
}
|
|
2329
|
+
var STYLE_PLAIN = 1;
|
|
2330
|
+
var STYLE_SINGLE = 2;
|
|
2331
|
+
var STYLE_LITERAL = 3;
|
|
2332
|
+
var STYLE_FOLDED = 4;
|
|
2333
|
+
var STYLE_DOUBLE = 5;
|
|
2334
|
+
function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType, quotingType, forceQuotes, inblock) {
|
|
2335
|
+
var i;
|
|
2336
|
+
var char = 0;
|
|
2337
|
+
var prevChar = null;
|
|
2338
|
+
var hasLineBreak = false;
|
|
2339
|
+
var hasFoldableLine = false;
|
|
2340
|
+
var shouldTrackWidth = lineWidth !== -1;
|
|
2341
|
+
var previousLineBreak = -1;
|
|
2342
|
+
var plain = isPlainSafeFirst(codePointAt(string, 0)) && isPlainSafeLast(codePointAt(string, string.length - 1));
|
|
2343
|
+
if (singleLineOnly || forceQuotes) {
|
|
2344
|
+
for (i = 0; i < string.length; char >= 65536 ? i += 2 : i++) {
|
|
2345
|
+
char = codePointAt(string, i);
|
|
2346
|
+
if (!isPrintable(char)) {
|
|
2347
|
+
return STYLE_DOUBLE;
|
|
2348
|
+
}
|
|
2349
|
+
plain = plain && isPlainSafe(char, prevChar, inblock);
|
|
2350
|
+
prevChar = char;
|
|
2351
|
+
}
|
|
2352
|
+
} else {
|
|
2353
|
+
for (i = 0; i < string.length; char >= 65536 ? i += 2 : i++) {
|
|
2354
|
+
char = codePointAt(string, i);
|
|
2355
|
+
if (char === CHAR_LINE_FEED) {
|
|
2356
|
+
hasLineBreak = true;
|
|
2357
|
+
if (shouldTrackWidth) {
|
|
2358
|
+
hasFoldableLine = hasFoldableLine || // Foldable line = too long, and not more-indented.
|
|
2359
|
+
i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ";
|
|
2360
|
+
previousLineBreak = i;
|
|
2361
|
+
}
|
|
2362
|
+
} else if (!isPrintable(char)) {
|
|
2363
|
+
return STYLE_DOUBLE;
|
|
2364
|
+
}
|
|
2365
|
+
plain = plain && isPlainSafe(char, prevChar, inblock);
|
|
2366
|
+
prevChar = char;
|
|
2367
|
+
}
|
|
2368
|
+
hasFoldableLine = hasFoldableLine || shouldTrackWidth && (i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ");
|
|
2369
|
+
}
|
|
2370
|
+
if (!hasLineBreak && !hasFoldableLine) {
|
|
2371
|
+
if (plain && !forceQuotes && !testAmbiguousType(string)) {
|
|
2372
|
+
return STYLE_PLAIN;
|
|
2373
|
+
}
|
|
2374
|
+
return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
|
|
2375
|
+
}
|
|
2376
|
+
if (indentPerLevel > 9 && needIndentIndicator(string)) {
|
|
2377
|
+
return STYLE_DOUBLE;
|
|
2378
|
+
}
|
|
2379
|
+
if (!forceQuotes) {
|
|
2380
|
+
return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
|
|
2381
|
+
}
|
|
2382
|
+
return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
|
|
2383
|
+
}
|
|
2384
|
+
function writeScalar(state, string, level, iskey, inblock) {
|
|
2385
|
+
state.dump = function() {
|
|
2386
|
+
if (string.length === 0) {
|
|
2387
|
+
return state.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''";
|
|
2388
|
+
}
|
|
2389
|
+
if (!state.noCompatMode) {
|
|
2390
|
+
if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) {
|
|
2391
|
+
return state.quotingType === QUOTING_TYPE_DOUBLE ? '"' + string + '"' : "'" + string + "'";
|
|
2392
|
+
}
|
|
2393
|
+
}
|
|
2394
|
+
var indent = state.indent * Math.max(1, level);
|
|
2395
|
+
var lineWidth = state.lineWidth === -1 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
|
|
2396
|
+
var singleLineOnly = iskey || state.flowLevel > -1 && level >= state.flowLevel;
|
|
2397
|
+
function testAmbiguity(string2) {
|
|
2398
|
+
return testImplicitResolving(state, string2);
|
|
2399
|
+
}
|
|
2400
|
+
switch (chooseScalarStyle(
|
|
2401
|
+
string,
|
|
2402
|
+
singleLineOnly,
|
|
2403
|
+
state.indent,
|
|
2404
|
+
lineWidth,
|
|
2405
|
+
testAmbiguity,
|
|
2406
|
+
state.quotingType,
|
|
2407
|
+
state.forceQuotes && !iskey,
|
|
2408
|
+
inblock
|
|
2409
|
+
)) {
|
|
2410
|
+
case STYLE_PLAIN:
|
|
2411
|
+
return string;
|
|
2412
|
+
case STYLE_SINGLE:
|
|
2413
|
+
return "'" + string.replace(/'/g, "''") + "'";
|
|
2414
|
+
case STYLE_LITERAL:
|
|
2415
|
+
return "|" + blockHeader(string, state.indent) + dropEndingNewline(indentString(string, indent));
|
|
2416
|
+
case STYLE_FOLDED:
|
|
2417
|
+
return ">" + blockHeader(string, state.indent) + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
|
|
2418
|
+
case STYLE_DOUBLE:
|
|
2419
|
+
return '"' + escapeString(string, lineWidth) + '"';
|
|
2420
|
+
default:
|
|
2421
|
+
throw new YAMLException("impossible error: invalid scalar style");
|
|
2422
|
+
}
|
|
2423
|
+
}();
|
|
2424
|
+
}
|
|
2425
|
+
function blockHeader(string, indentPerLevel) {
|
|
2426
|
+
var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : "";
|
|
2427
|
+
var clip = string[string.length - 1] === "\n";
|
|
2428
|
+
var keep = clip && (string[string.length - 2] === "\n" || string === "\n");
|
|
2429
|
+
var chomp = keep ? "+" : clip ? "" : "-";
|
|
2430
|
+
return indentIndicator + chomp + "\n";
|
|
2431
|
+
}
|
|
2432
|
+
function dropEndingNewline(string) {
|
|
2433
|
+
return string[string.length - 1] === "\n" ? string.slice(0, -1) : string;
|
|
2434
|
+
}
|
|
2435
|
+
function foldString(string, width) {
|
|
2436
|
+
var lineRe = /(\n+)([^\n]*)/g;
|
|
2437
|
+
var result = function() {
|
|
2438
|
+
var nextLF = string.indexOf("\n");
|
|
2439
|
+
nextLF = nextLF !== -1 ? nextLF : string.length;
|
|
2440
|
+
lineRe.lastIndex = nextLF;
|
|
2441
|
+
return foldLine(string.slice(0, nextLF), width);
|
|
2442
|
+
}();
|
|
2443
|
+
var prevMoreIndented = string[0] === "\n" || string[0] === " ";
|
|
2444
|
+
var moreIndented;
|
|
2445
|
+
var match;
|
|
2446
|
+
while (match = lineRe.exec(string)) {
|
|
2447
|
+
var prefix = match[1], line = match[2];
|
|
2448
|
+
moreIndented = line[0] === " ";
|
|
2449
|
+
result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? "\n" : "") + foldLine(line, width);
|
|
2450
|
+
prevMoreIndented = moreIndented;
|
|
2451
|
+
}
|
|
2452
|
+
return result;
|
|
2453
|
+
}
|
|
2454
|
+
function foldLine(line, width) {
|
|
2455
|
+
if (line === "" || line[0] === " ") return line;
|
|
2456
|
+
var breakRe = / [^ ]/g;
|
|
2457
|
+
var match;
|
|
2458
|
+
var start = 0, end, curr = 0, next = 0;
|
|
2459
|
+
var result = "";
|
|
2460
|
+
while (match = breakRe.exec(line)) {
|
|
2461
|
+
next = match.index;
|
|
2462
|
+
if (next - start > width) {
|
|
2463
|
+
end = curr > start ? curr : next;
|
|
2464
|
+
result += "\n" + line.slice(start, end);
|
|
2465
|
+
start = end + 1;
|
|
2466
|
+
}
|
|
2467
|
+
curr = next;
|
|
2468
|
+
}
|
|
2469
|
+
result += "\n";
|
|
2470
|
+
if (line.length - start > width && curr > start) {
|
|
2471
|
+
result += line.slice(start, curr) + "\n" + line.slice(curr + 1);
|
|
2472
|
+
} else {
|
|
2473
|
+
result += line.slice(start);
|
|
2474
|
+
}
|
|
2475
|
+
return result.slice(1);
|
|
2476
|
+
}
|
|
2477
|
+
function escapeString(string) {
|
|
2478
|
+
var result = "";
|
|
2479
|
+
var char = 0;
|
|
2480
|
+
var escapeSeq;
|
|
2481
|
+
for (var i = 0; i < string.length; char >= 65536 ? i += 2 : i++) {
|
|
2482
|
+
char = codePointAt(string, i);
|
|
2483
|
+
escapeSeq = ESCAPE_SEQUENCES[char];
|
|
2484
|
+
if (!escapeSeq && isPrintable(char)) {
|
|
2485
|
+
result += string[i];
|
|
2486
|
+
if (char >= 65536) result += string[i + 1];
|
|
2487
|
+
} else {
|
|
2488
|
+
result += escapeSeq || encodeHex(char);
|
|
2489
|
+
}
|
|
2490
|
+
}
|
|
2491
|
+
return result;
|
|
2492
|
+
}
|
|
2493
|
+
function writeFlowSequence(state, level, object) {
|
|
2494
|
+
var _result = "", _tag = state.tag, index, length, value;
|
|
2495
|
+
for (index = 0, length = object.length; index < length; index += 1) {
|
|
2496
|
+
value = object[index];
|
|
2497
|
+
if (state.replacer) {
|
|
2498
|
+
value = state.replacer.call(object, String(index), value);
|
|
2499
|
+
}
|
|
2500
|
+
if (writeNode(state, level, value, false, false) || typeof value === "undefined" && writeNode(state, level, null, false, false)) {
|
|
2501
|
+
if (_result !== "") _result += "," + (!state.condenseFlow ? " " : "");
|
|
2502
|
+
_result += state.dump;
|
|
2503
|
+
}
|
|
2504
|
+
}
|
|
2505
|
+
state.tag = _tag;
|
|
2506
|
+
state.dump = "[" + _result + "]";
|
|
2507
|
+
}
|
|
2508
|
+
function writeBlockSequence(state, level, object, compact) {
|
|
2509
|
+
var _result = "", _tag = state.tag, index, length, value;
|
|
2510
|
+
for (index = 0, length = object.length; index < length; index += 1) {
|
|
2511
|
+
value = object[index];
|
|
2512
|
+
if (state.replacer) {
|
|
2513
|
+
value = state.replacer.call(object, String(index), value);
|
|
2514
|
+
}
|
|
2515
|
+
if (writeNode(state, level + 1, value, true, true, false, true) || typeof value === "undefined" && writeNode(state, level + 1, null, true, true, false, true)) {
|
|
2516
|
+
if (!compact || _result !== "") {
|
|
2517
|
+
_result += generateNextLine(state, level);
|
|
2518
|
+
}
|
|
2519
|
+
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
2520
|
+
_result += "-";
|
|
2521
|
+
} else {
|
|
2522
|
+
_result += "- ";
|
|
2523
|
+
}
|
|
2524
|
+
_result += state.dump;
|
|
2525
|
+
}
|
|
2526
|
+
}
|
|
2527
|
+
state.tag = _tag;
|
|
2528
|
+
state.dump = _result || "[]";
|
|
2529
|
+
}
|
|
2530
|
+
function writeFlowMapping(state, level, object) {
|
|
2531
|
+
var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, pairBuffer;
|
|
2532
|
+
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
|
2533
|
+
pairBuffer = "";
|
|
2534
|
+
if (_result !== "") pairBuffer += ", ";
|
|
2535
|
+
if (state.condenseFlow) pairBuffer += '"';
|
|
2536
|
+
objectKey = objectKeyList[index];
|
|
2537
|
+
objectValue = object[objectKey];
|
|
2538
|
+
if (state.replacer) {
|
|
2539
|
+
objectValue = state.replacer.call(object, objectKey, objectValue);
|
|
2540
|
+
}
|
|
2541
|
+
if (!writeNode(state, level, objectKey, false, false)) {
|
|
2542
|
+
continue;
|
|
2543
|
+
}
|
|
2544
|
+
if (state.dump.length > 1024) pairBuffer += "? ";
|
|
2545
|
+
pairBuffer += state.dump + (state.condenseFlow ? '"' : "") + ":" + (state.condenseFlow ? "" : " ");
|
|
2546
|
+
if (!writeNode(state, level, objectValue, false, false)) {
|
|
2547
|
+
continue;
|
|
2548
|
+
}
|
|
2549
|
+
pairBuffer += state.dump;
|
|
2550
|
+
_result += pairBuffer;
|
|
2551
|
+
}
|
|
2552
|
+
state.tag = _tag;
|
|
2553
|
+
state.dump = "{" + _result + "}";
|
|
2554
|
+
}
|
|
2555
|
+
function writeBlockMapping(state, level, object, compact) {
|
|
2556
|
+
var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, explicitPair, pairBuffer;
|
|
2557
|
+
if (state.sortKeys === true) {
|
|
2558
|
+
objectKeyList.sort();
|
|
2559
|
+
} else if (typeof state.sortKeys === "function") {
|
|
2560
|
+
objectKeyList.sort(state.sortKeys);
|
|
2561
|
+
} else if (state.sortKeys) {
|
|
2562
|
+
throw new YAMLException("sortKeys must be a boolean or a function");
|
|
2563
|
+
}
|
|
2564
|
+
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
|
2565
|
+
pairBuffer = "";
|
|
2566
|
+
if (!compact || _result !== "") {
|
|
2567
|
+
pairBuffer += generateNextLine(state, level);
|
|
2568
|
+
}
|
|
2569
|
+
objectKey = objectKeyList[index];
|
|
2570
|
+
objectValue = object[objectKey];
|
|
2571
|
+
if (state.replacer) {
|
|
2572
|
+
objectValue = state.replacer.call(object, objectKey, objectValue);
|
|
2573
|
+
}
|
|
2574
|
+
if (!writeNode(state, level + 1, objectKey, true, true, true)) {
|
|
2575
|
+
continue;
|
|
2576
|
+
}
|
|
2577
|
+
explicitPair = state.tag !== null && state.tag !== "?" || state.dump && state.dump.length > 1024;
|
|
2578
|
+
if (explicitPair) {
|
|
2579
|
+
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
2580
|
+
pairBuffer += "?";
|
|
2581
|
+
} else {
|
|
2582
|
+
pairBuffer += "? ";
|
|
2583
|
+
}
|
|
2584
|
+
}
|
|
2585
|
+
pairBuffer += state.dump;
|
|
2586
|
+
if (explicitPair) {
|
|
2587
|
+
pairBuffer += generateNextLine(state, level);
|
|
2588
|
+
}
|
|
2589
|
+
if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
|
|
2590
|
+
continue;
|
|
2591
|
+
}
|
|
2592
|
+
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
2593
|
+
pairBuffer += ":";
|
|
2594
|
+
} else {
|
|
2595
|
+
pairBuffer += ": ";
|
|
2596
|
+
}
|
|
2597
|
+
pairBuffer += state.dump;
|
|
2598
|
+
_result += pairBuffer;
|
|
2599
|
+
}
|
|
2600
|
+
state.tag = _tag;
|
|
2601
|
+
state.dump = _result || "{}";
|
|
2602
|
+
}
|
|
2603
|
+
function detectType(state, object, explicit) {
|
|
2604
|
+
var _result, typeList, index, length, type, style;
|
|
2605
|
+
typeList = explicit ? state.explicitTypes : state.implicitTypes;
|
|
2606
|
+
for (index = 0, length = typeList.length; index < length; index += 1) {
|
|
2607
|
+
type = typeList[index];
|
|
2608
|
+
if ((type.instanceOf || type.predicate) && (!type.instanceOf || typeof object === "object" && object instanceof type.instanceOf) && (!type.predicate || type.predicate(object))) {
|
|
2609
|
+
if (explicit) {
|
|
2610
|
+
if (type.multi && type.representName) {
|
|
2611
|
+
state.tag = type.representName(object);
|
|
2612
|
+
} else {
|
|
2613
|
+
state.tag = type.tag;
|
|
2614
|
+
}
|
|
2615
|
+
} else {
|
|
2616
|
+
state.tag = "?";
|
|
2617
|
+
}
|
|
2618
|
+
if (type.represent) {
|
|
2619
|
+
style = state.styleMap[type.tag] || type.defaultStyle;
|
|
2620
|
+
if (_toString.call(type.represent) === "[object Function]") {
|
|
2621
|
+
_result = type.represent(object, style);
|
|
2622
|
+
} else if (_hasOwnProperty.call(type.represent, style)) {
|
|
2623
|
+
_result = type.represent[style](object, style);
|
|
2624
|
+
} else {
|
|
2625
|
+
throw new YAMLException("!<" + type.tag + '> tag resolver accepts not "' + style + '" style');
|
|
2626
|
+
}
|
|
2627
|
+
state.dump = _result;
|
|
2628
|
+
}
|
|
2629
|
+
return true;
|
|
2630
|
+
}
|
|
2631
|
+
}
|
|
2632
|
+
return false;
|
|
2633
|
+
}
|
|
2634
|
+
function writeNode(state, level, object, block, compact, iskey, isblockseq) {
|
|
2635
|
+
state.tag = null;
|
|
2636
|
+
state.dump = object;
|
|
2637
|
+
if (!detectType(state, object, false)) {
|
|
2638
|
+
detectType(state, object, true);
|
|
2639
|
+
}
|
|
2640
|
+
var type = _toString.call(state.dump);
|
|
2641
|
+
var inblock = block;
|
|
2642
|
+
var tagStr;
|
|
2643
|
+
if (block) {
|
|
2644
|
+
block = state.flowLevel < 0 || state.flowLevel > level;
|
|
2645
|
+
}
|
|
2646
|
+
var objectOrArray = type === "[object Object]" || type === "[object Array]", duplicateIndex, duplicate;
|
|
2647
|
+
if (objectOrArray) {
|
|
2648
|
+
duplicateIndex = state.duplicates.indexOf(object);
|
|
2649
|
+
duplicate = duplicateIndex !== -1;
|
|
2650
|
+
}
|
|
2651
|
+
if (state.tag !== null && state.tag !== "?" || duplicate || state.indent !== 2 && level > 0) {
|
|
2652
|
+
compact = false;
|
|
2653
|
+
}
|
|
2654
|
+
if (duplicate && state.usedDuplicates[duplicateIndex]) {
|
|
2655
|
+
state.dump = "*ref_" + duplicateIndex;
|
|
2656
|
+
} else {
|
|
2657
|
+
if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
|
|
2658
|
+
state.usedDuplicates[duplicateIndex] = true;
|
|
2659
|
+
}
|
|
2660
|
+
if (type === "[object Object]") {
|
|
2661
|
+
if (block && Object.keys(state.dump).length !== 0) {
|
|
2662
|
+
writeBlockMapping(state, level, state.dump, compact);
|
|
2663
|
+
if (duplicate) {
|
|
2664
|
+
state.dump = "&ref_" + duplicateIndex + state.dump;
|
|
2665
|
+
}
|
|
2666
|
+
} else {
|
|
2667
|
+
writeFlowMapping(state, level, state.dump);
|
|
2668
|
+
if (duplicate) {
|
|
2669
|
+
state.dump = "&ref_" + duplicateIndex + " " + state.dump;
|
|
2670
|
+
}
|
|
2671
|
+
}
|
|
2672
|
+
} else if (type === "[object Array]") {
|
|
2673
|
+
if (block && state.dump.length !== 0) {
|
|
2674
|
+
if (state.noArrayIndent && !isblockseq && level > 0) {
|
|
2675
|
+
writeBlockSequence(state, level - 1, state.dump, compact);
|
|
2676
|
+
} else {
|
|
2677
|
+
writeBlockSequence(state, level, state.dump, compact);
|
|
2678
|
+
}
|
|
2679
|
+
if (duplicate) {
|
|
2680
|
+
state.dump = "&ref_" + duplicateIndex + state.dump;
|
|
2681
|
+
}
|
|
2682
|
+
} else {
|
|
2683
|
+
writeFlowSequence(state, level, state.dump);
|
|
2684
|
+
if (duplicate) {
|
|
2685
|
+
state.dump = "&ref_" + duplicateIndex + " " + state.dump;
|
|
2686
|
+
}
|
|
2687
|
+
}
|
|
2688
|
+
} else if (type === "[object String]") {
|
|
2689
|
+
if (state.tag !== "?") {
|
|
2690
|
+
writeScalar(state, state.dump, level, iskey, inblock);
|
|
2691
|
+
}
|
|
2692
|
+
} else if (type === "[object Undefined]") {
|
|
2693
|
+
return false;
|
|
2694
|
+
} else {
|
|
2695
|
+
if (state.skipInvalid) return false;
|
|
2696
|
+
throw new YAMLException("unacceptable kind of an object to dump " + type);
|
|
2697
|
+
}
|
|
2698
|
+
if (state.tag !== null && state.tag !== "?") {
|
|
2699
|
+
tagStr = encodeURI(
|
|
2700
|
+
state.tag[0] === "!" ? state.tag.slice(1) : state.tag
|
|
2701
|
+
).replace(/!/g, "%21");
|
|
2702
|
+
if (state.tag[0] === "!") {
|
|
2703
|
+
tagStr = "!" + tagStr;
|
|
2704
|
+
} else if (tagStr.slice(0, 18) === "tag:yaml.org,2002:") {
|
|
2705
|
+
tagStr = "!!" + tagStr.slice(18);
|
|
2706
|
+
} else {
|
|
2707
|
+
tagStr = "!<" + tagStr + ">";
|
|
2708
|
+
}
|
|
2709
|
+
state.dump = tagStr + " " + state.dump;
|
|
2710
|
+
}
|
|
2711
|
+
}
|
|
2712
|
+
return true;
|
|
2713
|
+
}
|
|
2714
|
+
function getDuplicateReferences(object, state) {
|
|
2715
|
+
var objects = [], duplicatesIndexes = [], index, length;
|
|
2716
|
+
inspectNode(object, objects, duplicatesIndexes);
|
|
2717
|
+
for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {
|
|
2718
|
+
state.duplicates.push(objects[duplicatesIndexes[index]]);
|
|
2719
|
+
}
|
|
2720
|
+
state.usedDuplicates = new Array(length);
|
|
2721
|
+
}
|
|
2722
|
+
function inspectNode(object, objects, duplicatesIndexes) {
|
|
2723
|
+
var objectKeyList, index, length;
|
|
2724
|
+
if (object !== null && typeof object === "object") {
|
|
2725
|
+
index = objects.indexOf(object);
|
|
2726
|
+
if (index !== -1) {
|
|
2727
|
+
if (duplicatesIndexes.indexOf(index) === -1) {
|
|
2728
|
+
duplicatesIndexes.push(index);
|
|
2729
|
+
}
|
|
2730
|
+
} else {
|
|
2731
|
+
objects.push(object);
|
|
2732
|
+
if (Array.isArray(object)) {
|
|
2733
|
+
for (index = 0, length = object.length; index < length; index += 1) {
|
|
2734
|
+
inspectNode(object[index], objects, duplicatesIndexes);
|
|
2735
|
+
}
|
|
2736
|
+
} else {
|
|
2737
|
+
objectKeyList = Object.keys(object);
|
|
2738
|
+
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
|
2739
|
+
inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);
|
|
2740
|
+
}
|
|
2741
|
+
}
|
|
2742
|
+
}
|
|
2743
|
+
}
|
|
2744
|
+
}
|
|
2745
|
+
function dump(input, options) {
|
|
2746
|
+
options = options || {};
|
|
2747
|
+
var state = new State(options);
|
|
2748
|
+
if (!state.noRefs) getDuplicateReferences(input, state);
|
|
2749
|
+
var value = input;
|
|
2750
|
+
if (state.replacer) {
|
|
2751
|
+
value = state.replacer.call({ "": value }, "", value);
|
|
2752
|
+
}
|
|
2753
|
+
if (writeNode(state, 0, value, true, true)) return state.dump + "\n";
|
|
2754
|
+
return "";
|
|
2755
|
+
}
|
|
2756
|
+
module2.exports.dump = dump;
|
|
2757
|
+
}
|
|
2758
|
+
});
|
|
2759
|
+
|
|
2760
|
+
// node_modules/js-yaml/index.js
|
|
2761
|
+
var require_js_yaml = __commonJS({
|
|
2762
|
+
"node_modules/js-yaml/index.js"(exports2, module2) {
|
|
2763
|
+
"use strict";
|
|
2764
|
+
var loader = require_loader();
|
|
2765
|
+
var dumper = require_dumper();
|
|
2766
|
+
function renamed(from, to) {
|
|
2767
|
+
return function() {
|
|
2768
|
+
throw new Error("Function yaml." + from + " is removed in js-yaml 4. Use yaml." + to + " instead, which is now safe by default.");
|
|
2769
|
+
};
|
|
2770
|
+
}
|
|
2771
|
+
module2.exports.Type = require_type();
|
|
2772
|
+
module2.exports.Schema = require_schema();
|
|
2773
|
+
module2.exports.FAILSAFE_SCHEMA = require_failsafe();
|
|
2774
|
+
module2.exports.JSON_SCHEMA = require_json();
|
|
2775
|
+
module2.exports.CORE_SCHEMA = require_core();
|
|
2776
|
+
module2.exports.DEFAULT_SCHEMA = require_default();
|
|
2777
|
+
module2.exports.load = loader.load;
|
|
2778
|
+
module2.exports.loadAll = loader.loadAll;
|
|
2779
|
+
module2.exports.dump = dumper.dump;
|
|
2780
|
+
module2.exports.YAMLException = require_exception();
|
|
2781
|
+
module2.exports.types = {
|
|
2782
|
+
binary: require_binary(),
|
|
2783
|
+
float: require_float(),
|
|
2784
|
+
map: require_map(),
|
|
2785
|
+
null: require_null(),
|
|
2786
|
+
pairs: require_pairs(),
|
|
2787
|
+
set: require_set(),
|
|
2788
|
+
timestamp: require_timestamp(),
|
|
2789
|
+
bool: require_bool(),
|
|
2790
|
+
int: require_int(),
|
|
2791
|
+
merge: require_merge(),
|
|
2792
|
+
omap: require_omap(),
|
|
2793
|
+
seq: require_seq(),
|
|
2794
|
+
str: require_str()
|
|
2795
|
+
};
|
|
2796
|
+
module2.exports.safeLoad = renamed("safeLoad", "load");
|
|
2797
|
+
module2.exports.safeLoadAll = renamed("safeLoadAll", "loadAll");
|
|
2798
|
+
module2.exports.safeDump = renamed("safeDump", "dump");
|
|
2799
|
+
}
|
|
2800
|
+
});
|
|
2801
|
+
|
|
2802
|
+
// src/schema-lookup.js
|
|
2803
|
+
var fs = require("fs");
|
|
2804
|
+
var path = require("path");
|
|
2805
|
+
var yaml = require_js_yaml();
|
|
2806
|
+
function getSchemaPath() {
|
|
2807
|
+
const scriptDir = __dirname;
|
|
2808
|
+
let projectRoot = path.resolve(scriptDir, "..");
|
|
2809
|
+
let schemaPath = path.join(projectRoot, "reference", "bot.schema.yaml-authoring.json");
|
|
2810
|
+
if (!fs.existsSync(schemaPath)) {
|
|
2811
|
+
projectRoot = path.resolve(scriptDir, "..", "..");
|
|
2812
|
+
schemaPath = path.join(projectRoot, "reference", "bot.schema.yaml-authoring.json");
|
|
2813
|
+
}
|
|
2814
|
+
if (!fs.existsSync(schemaPath)) {
|
|
2815
|
+
console.error(`Error: Schema file not found at ${schemaPath}`);
|
|
2816
|
+
console.error("Please place 'bot.schema.yaml-authoring.json' in the 'reference/' directory.");
|
|
2817
|
+
process.exit(1);
|
|
2818
|
+
}
|
|
2819
|
+
return schemaPath;
|
|
2820
|
+
}
|
|
2821
|
+
function loadSchema() {
|
|
2822
|
+
const schemaPath = getSchemaPath();
|
|
2823
|
+
const raw = fs.readFileSync(schemaPath, "utf-8");
|
|
2824
|
+
return JSON.parse(raw);
|
|
2825
|
+
}
|
|
2826
|
+
function getDefinitions(schema) {
|
|
2827
|
+
return schema.definitions || {};
|
|
2828
|
+
}
|
|
2829
|
+
function lookupDefinition(name, definitions) {
|
|
2830
|
+
if (definitions[name]) return definitions[name];
|
|
2831
|
+
const nameLower = name.toLowerCase();
|
|
2832
|
+
for (const key of Object.keys(definitions)) {
|
|
2833
|
+
if (key.toLowerCase() === nameLower) return definitions[key];
|
|
2834
|
+
}
|
|
2835
|
+
return null;
|
|
2836
|
+
}
|
|
2837
|
+
function searchDefinitions(keyword, definitions) {
|
|
2838
|
+
const keywordLower = keyword.toLowerCase();
|
|
2839
|
+
return Object.keys(definitions).filter((k) => k.toLowerCase().includes(keywordLower)).sort();
|
|
2840
|
+
}
|
|
2841
|
+
function resolveDefinition(name, definitions, visited, depth, maxDepth) {
|
|
2842
|
+
visited = visited || /* @__PURE__ */ new Set();
|
|
2843
|
+
depth = depth || 0;
|
|
2844
|
+
maxDepth = maxDepth || 5;
|
|
2845
|
+
if (depth > maxDepth) {
|
|
2846
|
+
return { _note: `Max depth (${maxDepth}) reached, stopping recursion` };
|
|
2847
|
+
}
|
|
2848
|
+
if (visited.has(name)) {
|
|
2849
|
+
return { _ref: name, _note: "Circular reference detected" };
|
|
2850
|
+
}
|
|
2851
|
+
visited.add(name);
|
|
2852
|
+
const definition = lookupDefinition(name, definitions);
|
|
2853
|
+
if (!definition) {
|
|
2854
|
+
return { _error: `Definition '${name}' not found` };
|
|
2855
|
+
}
|
|
2856
|
+
return resolveObject(definition, definitions, new Set(visited), depth, maxDepth);
|
|
2857
|
+
}
|
|
2858
|
+
function resolveObject(obj, definitions, visited, depth, maxDepth) {
|
|
2859
|
+
if (Array.isArray(obj)) {
|
|
2860
|
+
return obj.map((item) => resolveObject(item, definitions, visited, depth, maxDepth));
|
|
2861
|
+
}
|
|
2862
|
+
if (typeof obj !== "object" || obj === null) {
|
|
2863
|
+
return obj;
|
|
2864
|
+
}
|
|
2865
|
+
if (obj.$ref && Object.keys(obj).length === 1) {
|
|
2866
|
+
const ref = obj.$ref;
|
|
2867
|
+
if (ref.startsWith("#/definitions/")) {
|
|
2868
|
+
const defName = ref.slice("#/definitions/".length);
|
|
2869
|
+
if (visited.has(defName)) {
|
|
2870
|
+
return { _ref: defName, _note: "Circular reference" };
|
|
2871
|
+
}
|
|
2872
|
+
return resolveDefinition(defName, definitions, visited, depth + 1, maxDepth);
|
|
2873
|
+
}
|
|
2874
|
+
return obj;
|
|
2875
|
+
}
|
|
2876
|
+
const resolved = {};
|
|
2877
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
2878
|
+
if (key === "$ref") {
|
|
2879
|
+
resolved[key] = value;
|
|
2880
|
+
} else {
|
|
2881
|
+
resolved[key] = resolveObject(value, definitions, visited, depth, maxDepth);
|
|
2882
|
+
}
|
|
2883
|
+
}
|
|
2884
|
+
return resolved;
|
|
2885
|
+
}
|
|
2886
|
+
function printModelReference(definitions) {
|
|
2887
|
+
const result = {};
|
|
2888
|
+
const noKind = resolveDefinition("CurrentModelsNoKind", definitions);
|
|
2889
|
+
if (noKind) result.CurrentModelsNoKind = noKind;
|
|
2890
|
+
const providerDef = resolveDefinition("ModelProvider", definitions);
|
|
2891
|
+
if (providerDef) result.ModelProvider = providerDef;
|
|
2892
|
+
const apiTypeDef = resolveDefinition("ModelApiType", definitions);
|
|
2893
|
+
if (apiTypeDef) result.ModelApiType = apiTypeDef;
|
|
2894
|
+
console.log(JSON.stringify(result, null, 2));
|
|
2895
|
+
}
|
|
2896
|
+
function findKindValues(definitions) {
|
|
2897
|
+
const kinds = /* @__PURE__ */ new Set();
|
|
2898
|
+
function extractKinds(obj) {
|
|
2899
|
+
if (Array.isArray(obj)) {
|
|
2900
|
+
obj.forEach(extractKinds);
|
|
2901
|
+
return;
|
|
2902
|
+
}
|
|
2903
|
+
if (typeof obj !== "object" || obj === null) return;
|
|
2904
|
+
if (obj.kind && typeof obj.kind === "object") {
|
|
2905
|
+
if (obj.kind.const) kinds.add(obj.kind.const);
|
|
2906
|
+
if (obj.kind.enum) obj.kind.enum.forEach((k) => kinds.add(k));
|
|
2907
|
+
}
|
|
2908
|
+
if (obj.properties && typeof obj.properties === "object" && obj.properties.kind) {
|
|
2909
|
+
const kindProp = obj.properties.kind;
|
|
2910
|
+
if (typeof kindProp === "object") {
|
|
2911
|
+
if (kindProp.const) kinds.add(kindProp.const);
|
|
2912
|
+
if (kindProp.enum) kindProp.enum.forEach((k) => kinds.add(k));
|
|
2913
|
+
}
|
|
2914
|
+
}
|
|
2915
|
+
for (const value of Object.values(obj)) {
|
|
2916
|
+
extractKinds(value);
|
|
2917
|
+
}
|
|
2918
|
+
}
|
|
2919
|
+
for (const definition of Object.values(definitions)) {
|
|
2920
|
+
extractKinds(definition);
|
|
2921
|
+
}
|
|
2922
|
+
return [...kinds].sort();
|
|
2923
|
+
}
|
|
2924
|
+
function getValidKindsFromOneOf(definitionName, definitions) {
|
|
2925
|
+
const def = definitions[definitionName];
|
|
2926
|
+
if (!def || !def.oneOf) return [];
|
|
2927
|
+
const kinds = [];
|
|
2928
|
+
for (const entry of def.oneOf) {
|
|
2929
|
+
const ref = entry.$ref;
|
|
2930
|
+
if (ref && ref.startsWith("#/definitions/")) {
|
|
2931
|
+
const refName = ref.slice("#/definitions/".length);
|
|
2932
|
+
const refDef = definitions[refName];
|
|
2933
|
+
if (refDef && refDef.properties && refDef.properties.kind) {
|
|
2934
|
+
const kindProp = refDef.properties.kind;
|
|
2935
|
+
if (kindProp.const) kinds.push(kindProp.const);
|
|
2936
|
+
if (kindProp.enum) kinds.push(...kindProp.enum);
|
|
2937
|
+
}
|
|
2938
|
+
}
|
|
2939
|
+
}
|
|
2940
|
+
return kinds;
|
|
2941
|
+
}
|
|
2942
|
+
function getValidProperties(definitionName, definitions) {
|
|
2943
|
+
const def = definitions[definitionName];
|
|
2944
|
+
if (!def) return /* @__PURE__ */ new Set();
|
|
2945
|
+
if (def.properties) {
|
|
2946
|
+
return new Set(Object.keys(def.properties));
|
|
2947
|
+
}
|
|
2948
|
+
if (def.oneOf) {
|
|
2949
|
+
const allProps = /* @__PURE__ */ new Set();
|
|
2950
|
+
for (const entry of def.oneOf) {
|
|
2951
|
+
const ref = entry.$ref;
|
|
2952
|
+
if (ref && ref.startsWith("#/definitions/")) {
|
|
2953
|
+
const refName = ref.slice("#/definitions/".length);
|
|
2954
|
+
const refDef = definitions[refName];
|
|
2955
|
+
if (refDef && refDef.properties) {
|
|
2956
|
+
Object.keys(refDef.properties).forEach((p) => allProps.add(p));
|
|
2957
|
+
}
|
|
2958
|
+
}
|
|
2959
|
+
if (entry.properties) {
|
|
2960
|
+
Object.keys(entry.properties).forEach((p) => allProps.add(p));
|
|
2961
|
+
}
|
|
2962
|
+
}
|
|
2963
|
+
return allProps;
|
|
2964
|
+
}
|
|
2965
|
+
return /* @__PURE__ */ new Set();
|
|
2966
|
+
}
|
|
2967
|
+
function formatDefinition(name, definition, compact) {
|
|
2968
|
+
if (!compact) {
|
|
2969
|
+
return JSON.stringify({ [name]: definition }, null, 2);
|
|
2970
|
+
}
|
|
2971
|
+
const output = [`Definition: ${name}`];
|
|
2972
|
+
if (definition.description) {
|
|
2973
|
+
output.push(`Description: ${definition.description}`);
|
|
2974
|
+
}
|
|
2975
|
+
if (definition.properties) {
|
|
2976
|
+
output.push("Properties:");
|
|
2977
|
+
for (const [propName, propDef] of Object.entries(definition.properties)) {
|
|
2978
|
+
let propType = propDef.type || "";
|
|
2979
|
+
if (propDef.$ref) propType = propDef.$ref.split("/").pop();
|
|
2980
|
+
output.push(` - ${propName}: ${propType}`);
|
|
2981
|
+
}
|
|
2982
|
+
}
|
|
2983
|
+
if (definition.required) {
|
|
2984
|
+
output.push(`Required: ${definition.required.join(", ")}`);
|
|
2985
|
+
}
|
|
2986
|
+
if (definition.oneOf) {
|
|
2987
|
+
output.push("OneOf:");
|
|
2988
|
+
for (const item of definition.oneOf) {
|
|
2989
|
+
if (item.$ref) output.push(` - ${item.$ref.split("/").pop()}`);
|
|
2990
|
+
}
|
|
2991
|
+
}
|
|
2992
|
+
if (definition.allOf) {
|
|
2993
|
+
output.push("AllOf:");
|
|
2994
|
+
for (const item of definition.allOf) {
|
|
2995
|
+
if (item.$ref) output.push(` - ${item.$ref.split("/").pop()}`);
|
|
2996
|
+
}
|
|
2997
|
+
}
|
|
2998
|
+
return output.join("\n");
|
|
2999
|
+
}
|
|
3000
|
+
function validateYamlFile(filepath, definitions) {
|
|
3001
|
+
if (!fs.existsSync(filepath)) {
|
|
3002
|
+
console.log(`[FAIL] File not found: ${filepath}`);
|
|
3003
|
+
process.exit(1);
|
|
3004
|
+
}
|
|
3005
|
+
let passes = 0;
|
|
3006
|
+
let warnings = 0;
|
|
3007
|
+
let failures = 0;
|
|
3008
|
+
const rawText = fs.readFileSync(filepath, "utf-8");
|
|
3009
|
+
let data;
|
|
3010
|
+
try {
|
|
3011
|
+
data = yaml.load(rawText);
|
|
3012
|
+
if (data == null) {
|
|
3013
|
+
console.log("[FAIL] File is empty or not valid YAML");
|
|
3014
|
+
process.exit(1);
|
|
3015
|
+
}
|
|
3016
|
+
console.log("[PASS] YAML parsing successful");
|
|
3017
|
+
passes++;
|
|
3018
|
+
} catch (e) {
|
|
3019
|
+
console.log(`[FAIL] YAML parsing error: ${e.message}`);
|
|
3020
|
+
process.exit(1);
|
|
3021
|
+
}
|
|
3022
|
+
const kind = data.kind;
|
|
3023
|
+
if (kind) {
|
|
3024
|
+
console.log(`[PASS] Kind detected: ${kind}`);
|
|
3025
|
+
passes++;
|
|
3026
|
+
const knownKinds = findKindValues(definitions);
|
|
3027
|
+
if (knownKinds.includes(kind)) {
|
|
3028
|
+
console.log(`[PASS] Kind '${kind}' exists in schema`);
|
|
3029
|
+
passes++;
|
|
3030
|
+
} else {
|
|
3031
|
+
console.log(`[WARN] Kind '${kind}' not found in schema kind values`);
|
|
3032
|
+
warnings++;
|
|
3033
|
+
}
|
|
3034
|
+
} else {
|
|
3035
|
+
console.log("[FAIL] No 'kind' property found at root level");
|
|
3036
|
+
failures++;
|
|
3037
|
+
}
|
|
3038
|
+
if (kind === "AdaptiveDialog") {
|
|
3039
|
+
if (data.beginDialog) {
|
|
3040
|
+
console.log("[PASS] Required 'beginDialog' property present");
|
|
3041
|
+
passes++;
|
|
3042
|
+
const bd = data.beginDialog;
|
|
3043
|
+
if (typeof bd === "object" && bd !== null) {
|
|
3044
|
+
if (bd.kind) {
|
|
3045
|
+
console.log(`[PASS] beginDialog.kind: ${bd.kind}`);
|
|
3046
|
+
passes++;
|
|
3047
|
+
} else {
|
|
3048
|
+
console.log("[FAIL] beginDialog missing 'kind' property");
|
|
3049
|
+
failures++;
|
|
3050
|
+
}
|
|
3051
|
+
if (bd.id) {
|
|
3052
|
+
console.log(`[PASS] beginDialog.id: ${bd.id}`);
|
|
3053
|
+
passes++;
|
|
3054
|
+
} else {
|
|
3055
|
+
console.log("[FAIL] beginDialog missing 'id' property");
|
|
3056
|
+
failures++;
|
|
3057
|
+
}
|
|
3058
|
+
}
|
|
3059
|
+
} else {
|
|
3060
|
+
console.log("[FAIL] AdaptiveDialog missing required 'beginDialog' property");
|
|
3061
|
+
failures++;
|
|
3062
|
+
}
|
|
3063
|
+
} else if (kind === "GptComponentMetadata") {
|
|
3064
|
+
for (const prop of ["displayName", "instructions"]) {
|
|
3065
|
+
if (data[prop]) {
|
|
3066
|
+
console.log(`[PASS] Required '${prop}' property present`);
|
|
3067
|
+
passes++;
|
|
3068
|
+
} else {
|
|
3069
|
+
console.log(`[WARN] Missing '${prop}' property (recommended)`);
|
|
3070
|
+
warnings++;
|
|
3071
|
+
}
|
|
3072
|
+
}
|
|
3073
|
+
} else if (kind === "KnowledgeSourceConfiguration") {
|
|
3074
|
+
if (data.source) {
|
|
3075
|
+
console.log("[PASS] Required 'source' property present");
|
|
3076
|
+
passes++;
|
|
3077
|
+
} else {
|
|
3078
|
+
console.log("[FAIL] Missing required 'source' property");
|
|
3079
|
+
failures++;
|
|
3080
|
+
}
|
|
3081
|
+
} else if (kind === "AgentDialog") {
|
|
3082
|
+
if (data.beginDialog) {
|
|
3083
|
+
console.log("[PASS] Required 'beginDialog' property present");
|
|
3084
|
+
passes++;
|
|
3085
|
+
const bd = data.beginDialog;
|
|
3086
|
+
if (bd.kind === "OnToolSelected") {
|
|
3087
|
+
console.log("[PASS] beginDialog.kind: OnToolSelected");
|
|
3088
|
+
passes++;
|
|
3089
|
+
} else {
|
|
3090
|
+
console.log(`[WARN] beginDialog.kind is '${bd.kind}' \u2014 expected 'OnToolSelected' for child agents`);
|
|
3091
|
+
warnings++;
|
|
3092
|
+
}
|
|
3093
|
+
if (bd.description) {
|
|
3094
|
+
console.log("[PASS] beginDialog.description present (used by parent orchestrator for routing)");
|
|
3095
|
+
passes++;
|
|
3096
|
+
} else {
|
|
3097
|
+
console.log("[WARN] beginDialog.description missing \u2014 the parent orchestrator needs this to know when to route to this child agent");
|
|
3098
|
+
warnings++;
|
|
3099
|
+
}
|
|
3100
|
+
if (bd.actions && Array.isArray(bd.actions) && bd.actions.length > 0) {
|
|
3101
|
+
const actionKinds = bd.actions.filter((a) => a && a.kind).map((a) => a.kind);
|
|
3102
|
+
console.log(`[FAIL] AgentDialog must NOT have beginDialog.actions (found ${bd.actions.length}: ${actionKinds.join(", ")}). Child agents use generative orchestration via settings.instructions \u2014 they cannot contain hardcoded action nodes like Question, SendActivity, BeginDialog, etc. Remove the actions array and define the agent's behavior in settings.instructions instead.`);
|
|
3103
|
+
failures++;
|
|
3104
|
+
} else {
|
|
3105
|
+
console.log("[PASS] No hardcoded actions in beginDialog (correct for AgentDialog)");
|
|
3106
|
+
passes++;
|
|
3107
|
+
}
|
|
3108
|
+
} else {
|
|
3109
|
+
console.log("[FAIL] AgentDialog missing required 'beginDialog' property");
|
|
3110
|
+
failures++;
|
|
3111
|
+
}
|
|
3112
|
+
if (data.settings && data.settings.instructions) {
|
|
3113
|
+
console.log("[PASS] settings.instructions present");
|
|
3114
|
+
passes++;
|
|
3115
|
+
} else {
|
|
3116
|
+
console.log("[WARN] Missing settings.instructions \u2014 child agents need instructions for generative orchestration");
|
|
3117
|
+
warnings++;
|
|
3118
|
+
}
|
|
3119
|
+
}
|
|
3120
|
+
if (kind && data.beginDialog && typeof data.beginDialog === "object") {
|
|
3121
|
+
const bd = data.beginDialog;
|
|
3122
|
+
const triggerKind = bd.kind;
|
|
3123
|
+
if (Array.isArray(bd.actions)) {
|
|
3124
|
+
const validActionKinds = getValidKindsFromOneOf("DialogAction", definitions);
|
|
3125
|
+
if (validActionKinds.length > 0) {
|
|
3126
|
+
for (const action of bd.actions) {
|
|
3127
|
+
if (action && typeof action === "object" && action.kind) {
|
|
3128
|
+
if (validActionKinds.includes(action.kind)) {
|
|
3129
|
+
passes++;
|
|
3130
|
+
} else {
|
|
3131
|
+
console.log(
|
|
3132
|
+
`[FAIL] '${action.kind}' is not a valid action kind inside beginDialog.actions (not found in DialogAction schema definition). Use 'schema-lookup.bundle.js resolve DialogAction' to see valid action kinds.`
|
|
3133
|
+
);
|
|
3134
|
+
failures++;
|
|
3135
|
+
}
|
|
3136
|
+
}
|
|
3137
|
+
}
|
|
3138
|
+
}
|
|
3139
|
+
}
|
|
3140
|
+
if (triggerKind) {
|
|
3141
|
+
const triggerProps = getValidProperties(triggerKind, definitions);
|
|
3142
|
+
const rootDef = definitions[kind];
|
|
3143
|
+
const rootProps = rootDef && rootDef.properties ? new Set(Object.keys(rootDef.properties)) : /* @__PURE__ */ new Set();
|
|
3144
|
+
for (const key of Object.keys(bd)) {
|
|
3145
|
+
if (key === "kind" || key === "id") continue;
|
|
3146
|
+
if (!triggerProps.has(key) && rootProps.has(key)) {
|
|
3147
|
+
console.log(
|
|
3148
|
+
`[FAIL] '${key}' is inside beginDialog but belongs at the ${kind} root level (not a valid property of ${triggerKind}, but is a property of ${kind}). Move '${key}' to the top level of the YAML.`
|
|
3149
|
+
);
|
|
3150
|
+
failures++;
|
|
3151
|
+
}
|
|
3152
|
+
}
|
|
3153
|
+
}
|
|
3154
|
+
}
|
|
3155
|
+
const idsFound = [];
|
|
3156
|
+
function collectIds(obj) {
|
|
3157
|
+
if (Array.isArray(obj)) {
|
|
3158
|
+
obj.forEach(collectIds);
|
|
3159
|
+
return;
|
|
3160
|
+
}
|
|
3161
|
+
if (typeof obj !== "object" || obj === null) return;
|
|
3162
|
+
if (typeof obj.id === "string") idsFound.push(obj.id);
|
|
3163
|
+
for (const v of Object.values(obj)) collectIds(v);
|
|
3164
|
+
}
|
|
3165
|
+
collectIds(data);
|
|
3166
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3167
|
+
const duplicates = /* @__PURE__ */ new Set();
|
|
3168
|
+
for (const id of idsFound) {
|
|
3169
|
+
if (seen.has(id)) duplicates.add(id);
|
|
3170
|
+
seen.add(id);
|
|
3171
|
+
}
|
|
3172
|
+
if (duplicates.size > 0) {
|
|
3173
|
+
for (const dup of [...duplicates].sort()) {
|
|
3174
|
+
console.log(`[FAIL] Duplicate ID found: ${dup}`);
|
|
3175
|
+
failures++;
|
|
3176
|
+
}
|
|
3177
|
+
} else if (idsFound.length > 0) {
|
|
3178
|
+
console.log(`[PASS] All ${idsFound.length} node IDs are unique`);
|
|
3179
|
+
passes++;
|
|
3180
|
+
}
|
|
3181
|
+
const replaceCount = (rawText.match(/_REPLACE/g) || []).length;
|
|
3182
|
+
if (replaceCount > 0) {
|
|
3183
|
+
console.log(`[FAIL] Found ${replaceCount} unresolved '_REPLACE' placeholder(s)`);
|
|
3184
|
+
failures++;
|
|
3185
|
+
} else {
|
|
3186
|
+
console.log("[PASS] No '_REPLACE' placeholders remaining");
|
|
3187
|
+
passes++;
|
|
3188
|
+
}
|
|
3189
|
+
function checkPowerfx(obj, pathStr) {
|
|
3190
|
+
const issues = [];
|
|
3191
|
+
if (Array.isArray(obj)) {
|
|
3192
|
+
obj.forEach((item, i) => issues.push(...checkPowerfx(item, `${pathStr}[${i}]`)));
|
|
3193
|
+
return issues;
|
|
3194
|
+
}
|
|
3195
|
+
if (typeof obj !== "object" || obj === null) return issues;
|
|
3196
|
+
for (const [key, val] of Object.entries(obj)) {
|
|
3197
|
+
if (key === "condition" && typeof val === "string" && !val.startsWith("=")) {
|
|
3198
|
+
issues.push(` condition at ${pathStr}.${key}: '${val}' (may need '=' prefix)`);
|
|
3199
|
+
}
|
|
3200
|
+
issues.push(...checkPowerfx(val, `${pathStr}.${key}`));
|
|
3201
|
+
}
|
|
3202
|
+
return issues;
|
|
3203
|
+
}
|
|
3204
|
+
const pfxIssues = checkPowerfx(data, "");
|
|
3205
|
+
if (pfxIssues.length > 0) {
|
|
3206
|
+
for (const issue of pfxIssues) {
|
|
3207
|
+
console.log(`[WARN] Possible missing '=' prefix: ${issue}`);
|
|
3208
|
+
warnings++;
|
|
3209
|
+
}
|
|
3210
|
+
} else {
|
|
3211
|
+
console.log("[PASS] No Power Fx prefix issues detected");
|
|
3212
|
+
passes++;
|
|
3213
|
+
}
|
|
3214
|
+
function checkVariables(obj) {
|
|
3215
|
+
const issues = [];
|
|
3216
|
+
if (Array.isArray(obj)) {
|
|
3217
|
+
obj.forEach((item) => issues.push(...checkVariables(item)));
|
|
3218
|
+
return issues;
|
|
3219
|
+
}
|
|
3220
|
+
if (typeof obj !== "object" || obj === null) return issues;
|
|
3221
|
+
if (typeof obj.variable === "string") {
|
|
3222
|
+
const cleanVar = obj.variable.replace("init:", "");
|
|
3223
|
+
if (!cleanVar.startsWith("Topic.") && !cleanVar.startsWith("System.") && !cleanVar.startsWith("Global.") && !cleanVar.startsWith("User.")) {
|
|
3224
|
+
issues.push(`Variable '${obj.variable}' missing scope prefix (Topic., System., Global., User.)`);
|
|
3225
|
+
}
|
|
3226
|
+
}
|
|
3227
|
+
for (const v of Object.values(obj)) issues.push(...checkVariables(v));
|
|
3228
|
+
return issues;
|
|
3229
|
+
}
|
|
3230
|
+
const varIssues = checkVariables(data);
|
|
3231
|
+
if (varIssues.length > 0) {
|
|
3232
|
+
for (const issue of varIssues) {
|
|
3233
|
+
console.log(`[WARN] ${issue}`);
|
|
3234
|
+
warnings++;
|
|
3235
|
+
}
|
|
3236
|
+
} else {
|
|
3237
|
+
console.log("[PASS] Variable scopes look correct");
|
|
3238
|
+
passes++;
|
|
3239
|
+
}
|
|
3240
|
+
if (data.inputs && data.inputType) {
|
|
3241
|
+
const inputNames = /* @__PURE__ */ new Set();
|
|
3242
|
+
for (const inp of data.inputs) {
|
|
3243
|
+
if (inp && typeof inp === "object" && inp.propertyName) {
|
|
3244
|
+
inputNames.add(inp.propertyName);
|
|
3245
|
+
}
|
|
3246
|
+
}
|
|
3247
|
+
const inputTypeProps = new Set(
|
|
3248
|
+
Object.keys(data.inputType && data.inputType.properties || {})
|
|
3249
|
+
);
|
|
3250
|
+
const setsEqual = inputNames.size === inputTypeProps.size && [...inputNames].every((n) => inputTypeProps.has(n));
|
|
3251
|
+
if (setsEqual) {
|
|
3252
|
+
console.log("[PASS] inputs and inputType.properties are consistent");
|
|
3253
|
+
passes++;
|
|
3254
|
+
} else {
|
|
3255
|
+
const missingInType = [...inputNames].filter((n) => !inputTypeProps.has(n));
|
|
3256
|
+
const missingInInputs = [...inputTypeProps].filter((n) => !inputNames.has(n));
|
|
3257
|
+
if (missingInType.length > 0) {
|
|
3258
|
+
console.log(`[WARN] inputs defined but missing from inputType: {${missingInType.join(", ")}}`);
|
|
3259
|
+
warnings++;
|
|
3260
|
+
}
|
|
3261
|
+
if (missingInInputs.length > 0) {
|
|
3262
|
+
console.log(`[WARN] inputType properties missing from inputs: {${missingInInputs.join(", ")}}`);
|
|
3263
|
+
warnings++;
|
|
3264
|
+
}
|
|
3265
|
+
}
|
|
3266
|
+
}
|
|
3267
|
+
console.log(`
|
|
3268
|
+
Summary: ${passes} passed, ${warnings} warnings, ${failures} failures`);
|
|
3269
|
+
if (failures > 0) process.exit(1);
|
|
3270
|
+
}
|
|
3271
|
+
function getAdaptiveCardSchemaPath() {
|
|
3272
|
+
const scriptDir = __dirname;
|
|
3273
|
+
let projectRoot = path.resolve(scriptDir, "..");
|
|
3274
|
+
let schemaPath = path.join(projectRoot, "reference", "adaptive-card.schema.json");
|
|
3275
|
+
if (!fs.existsSync(schemaPath)) {
|
|
3276
|
+
projectRoot = path.resolve(scriptDir, "..", "..");
|
|
3277
|
+
schemaPath = path.join(projectRoot, "reference", "adaptive-card.schema.json");
|
|
3278
|
+
}
|
|
3279
|
+
if (!fs.existsSync(schemaPath)) {
|
|
3280
|
+
console.error(`Error: Adaptive Card schema not found at ${schemaPath}`);
|
|
3281
|
+
process.exit(1);
|
|
3282
|
+
}
|
|
3283
|
+
return schemaPath;
|
|
3284
|
+
}
|
|
3285
|
+
function loadAdaptiveCardSchema() {
|
|
3286
|
+
const schemaPath = getAdaptiveCardSchemaPath();
|
|
3287
|
+
return JSON.parse(fs.readFileSync(schemaPath, "utf-8"));
|
|
3288
|
+
}
|
|
3289
|
+
function getAdaptiveCardDefinitions(schema) {
|
|
3290
|
+
return schema.definitions || {};
|
|
3291
|
+
}
|
|
3292
|
+
function printHelp() {
|
|
3293
|
+
console.log(`
|
|
3294
|
+
Copilot Studio YAML Schema Lookup Tool
|
|
3295
|
+
|
|
3296
|
+
Copilot Studio schema:
|
|
3297
|
+
node schema-lookup.js lookup <definition-name>
|
|
3298
|
+
node schema-lookup.js search <keyword>
|
|
3299
|
+
node schema-lookup.js list
|
|
3300
|
+
node schema-lookup.js resolve <definition-name>
|
|
3301
|
+
node schema-lookup.js kinds
|
|
3302
|
+
node schema-lookup.js summary <definition-name>
|
|
3303
|
+
node schema-lookup.js models
|
|
3304
|
+
node schema-lookup.js validate <path-to-yaml-file>
|
|
3305
|
+
|
|
3306
|
+
Adaptive Cards schema:
|
|
3307
|
+
node schema-lookup.js ac-lookup <element-name> (e.g., TextBlock, Input.Text)
|
|
3308
|
+
node schema-lookup.js ac-search <keyword> (e.g., input, action)
|
|
3309
|
+
node schema-lookup.js ac-list
|
|
3310
|
+
node schema-lookup.js ac-resolve <element-name>
|
|
3311
|
+
node schema-lookup.js ac-summary <element-name>
|
|
3312
|
+
`);
|
|
3313
|
+
}
|
|
3314
|
+
function main() {
|
|
3315
|
+
const args = process.argv.slice(2);
|
|
3316
|
+
if (args.length < 1) {
|
|
3317
|
+
printHelp();
|
|
3318
|
+
process.exit(1);
|
|
3319
|
+
}
|
|
3320
|
+
const command = args[0].toLowerCase();
|
|
3321
|
+
if (command === "help" || command === "--help" || command === "-h") {
|
|
3322
|
+
printHelp();
|
|
3323
|
+
process.exit(0);
|
|
3324
|
+
}
|
|
3325
|
+
const schema = loadSchema();
|
|
3326
|
+
const definitions = getDefinitions(schema);
|
|
3327
|
+
switch (command) {
|
|
3328
|
+
case "lookup": {
|
|
3329
|
+
if (args.length < 2) {
|
|
3330
|
+
console.error("Error: Please provide a definition name");
|
|
3331
|
+
console.error("Usage: node schema-lookup.js lookup <definition-name>");
|
|
3332
|
+
process.exit(1);
|
|
3333
|
+
}
|
|
3334
|
+
const name = args[1];
|
|
3335
|
+
const definition = lookupDefinition(name, definitions);
|
|
3336
|
+
if (definition) {
|
|
3337
|
+
console.log(formatDefinition(name, definition, false));
|
|
3338
|
+
} else {
|
|
3339
|
+
const similar = searchDefinitions(name, definitions).slice(0, 10);
|
|
3340
|
+
console.log(`Definition '${name}' not found.`);
|
|
3341
|
+
if (similar.length > 0) {
|
|
3342
|
+
console.log("Did you mean one of these?");
|
|
3343
|
+
similar.forEach((s) => console.log(` - ${s}`));
|
|
3344
|
+
}
|
|
3345
|
+
}
|
|
3346
|
+
break;
|
|
3347
|
+
}
|
|
3348
|
+
case "search": {
|
|
3349
|
+
if (args.length < 2) {
|
|
3350
|
+
console.error("Error: Please provide a search keyword");
|
|
3351
|
+
console.error("Usage: node schema-lookup.js search <keyword>");
|
|
3352
|
+
process.exit(1);
|
|
3353
|
+
}
|
|
3354
|
+
const keyword = args[1];
|
|
3355
|
+
const matches = searchDefinitions(keyword, definitions);
|
|
3356
|
+
if (matches.length > 0) {
|
|
3357
|
+
console.log(`Found ${matches.length} definitions matching '${keyword}':`);
|
|
3358
|
+
matches.forEach((m) => console.log(` - ${m}`));
|
|
3359
|
+
} else {
|
|
3360
|
+
console.log(`No definitions found matching '${keyword}'`);
|
|
3361
|
+
}
|
|
3362
|
+
break;
|
|
3363
|
+
}
|
|
3364
|
+
case "list": {
|
|
3365
|
+
const allDefs = Object.keys(definitions).sort();
|
|
3366
|
+
console.log(`Available definitions (${allDefs.length} total):`);
|
|
3367
|
+
allDefs.forEach((name) => console.log(` - ${name}`));
|
|
3368
|
+
break;
|
|
3369
|
+
}
|
|
3370
|
+
case "resolve": {
|
|
3371
|
+
if (args.length < 2) {
|
|
3372
|
+
console.error("Error: Please provide a definition name");
|
|
3373
|
+
console.error("Usage: node schema-lookup.js resolve <definition-name>");
|
|
3374
|
+
process.exit(1);
|
|
3375
|
+
}
|
|
3376
|
+
const name = args[1];
|
|
3377
|
+
const resolved = resolveDefinition(name, definitions);
|
|
3378
|
+
console.log(JSON.stringify({ [name]: resolved }, null, 2));
|
|
3379
|
+
break;
|
|
3380
|
+
}
|
|
3381
|
+
case "kinds": {
|
|
3382
|
+
const kinds = findKindValues(definitions);
|
|
3383
|
+
console.log(`Available 'kind' values (${kinds.length} total):`);
|
|
3384
|
+
kinds.forEach((k) => console.log(` - ${k}`));
|
|
3385
|
+
break;
|
|
3386
|
+
}
|
|
3387
|
+
case "summary": {
|
|
3388
|
+
if (args.length < 2) {
|
|
3389
|
+
console.error("Error: Please provide a definition name");
|
|
3390
|
+
console.error("Usage: node schema-lookup.js summary <definition-name>");
|
|
3391
|
+
process.exit(1);
|
|
3392
|
+
}
|
|
3393
|
+
const name = args[1];
|
|
3394
|
+
const definition = lookupDefinition(name, definitions);
|
|
3395
|
+
if (definition) {
|
|
3396
|
+
console.log(formatDefinition(name, definition, true));
|
|
3397
|
+
} else {
|
|
3398
|
+
console.log(`Definition '${name}' not found.`);
|
|
3399
|
+
}
|
|
3400
|
+
break;
|
|
3401
|
+
}
|
|
3402
|
+
case "models": {
|
|
3403
|
+
printModelReference(definitions);
|
|
3404
|
+
break;
|
|
3405
|
+
}
|
|
3406
|
+
case "validate": {
|
|
3407
|
+
if (args.length < 2) {
|
|
3408
|
+
console.error("Error: Please provide a YAML file path");
|
|
3409
|
+
console.error("Usage: node schema-lookup.js validate <path-to-yaml-file>");
|
|
3410
|
+
process.exit(1);
|
|
3411
|
+
}
|
|
3412
|
+
validateYamlFile(args[1], definitions);
|
|
3413
|
+
break;
|
|
3414
|
+
}
|
|
3415
|
+
case "ac-lookup": {
|
|
3416
|
+
if (args.length < 2) {
|
|
3417
|
+
console.error("Usage: node schema-lookup.js ac-lookup <element-name>");
|
|
3418
|
+
process.exit(1);
|
|
3419
|
+
}
|
|
3420
|
+
const acSchema = loadAdaptiveCardSchema();
|
|
3421
|
+
const acDefs = getAdaptiveCardDefinitions(acSchema);
|
|
3422
|
+
const name = args[1];
|
|
3423
|
+
const definition = lookupDefinition(name, acDefs);
|
|
3424
|
+
if (definition) {
|
|
3425
|
+
console.log(formatDefinition(name, definition, false));
|
|
3426
|
+
} else {
|
|
3427
|
+
const similar = searchDefinitions(name, acDefs).slice(0, 10);
|
|
3428
|
+
console.log(`Definition '${name}' not found in Adaptive Cards schema.`);
|
|
3429
|
+
if (similar.length > 0) {
|
|
3430
|
+
console.log("Did you mean one of these?");
|
|
3431
|
+
similar.forEach((s) => console.log(` - ${s}`));
|
|
3432
|
+
}
|
|
3433
|
+
}
|
|
3434
|
+
break;
|
|
3435
|
+
}
|
|
3436
|
+
case "ac-search": {
|
|
3437
|
+
if (args.length < 2) {
|
|
3438
|
+
console.error("Usage: node schema-lookup.js ac-search <keyword>");
|
|
3439
|
+
process.exit(1);
|
|
3440
|
+
}
|
|
3441
|
+
const acSchema = loadAdaptiveCardSchema();
|
|
3442
|
+
const acDefs = getAdaptiveCardDefinitions(acSchema);
|
|
3443
|
+
const keyword = args[1];
|
|
3444
|
+
const matches = searchDefinitions(keyword, acDefs);
|
|
3445
|
+
if (matches.length > 0) {
|
|
3446
|
+
console.log(`Found ${matches.length} Adaptive Card definitions matching '${keyword}':`);
|
|
3447
|
+
matches.forEach((m) => console.log(` - ${m}`));
|
|
3448
|
+
} else {
|
|
3449
|
+
console.log(`No Adaptive Card definitions found matching '${keyword}'`);
|
|
3450
|
+
}
|
|
3451
|
+
break;
|
|
3452
|
+
}
|
|
3453
|
+
case "ac-list": {
|
|
3454
|
+
const acSchema = loadAdaptiveCardSchema();
|
|
3455
|
+
const acDefs = getAdaptiveCardDefinitions(acSchema);
|
|
3456
|
+
const allDefs = Object.keys(acDefs).sort();
|
|
3457
|
+
console.log(`Adaptive Card definitions (${allDefs.length} total):`);
|
|
3458
|
+
allDefs.forEach((name) => console.log(` - ${name}`));
|
|
3459
|
+
break;
|
|
3460
|
+
}
|
|
3461
|
+
case "ac-resolve": {
|
|
3462
|
+
if (args.length < 2) {
|
|
3463
|
+
console.error("Usage: node schema-lookup.js ac-resolve <element-name>");
|
|
3464
|
+
process.exit(1);
|
|
3465
|
+
}
|
|
3466
|
+
const acSchema = loadAdaptiveCardSchema();
|
|
3467
|
+
const acDefs = getAdaptiveCardDefinitions(acSchema);
|
|
3468
|
+
const name = args[1];
|
|
3469
|
+
const resolved = resolveDefinition(name, acDefs);
|
|
3470
|
+
console.log(JSON.stringify({ [name]: resolved }, null, 2));
|
|
3471
|
+
break;
|
|
3472
|
+
}
|
|
3473
|
+
case "ac-summary": {
|
|
3474
|
+
if (args.length < 2) {
|
|
3475
|
+
console.error("Usage: node schema-lookup.js ac-summary <element-name>");
|
|
3476
|
+
process.exit(1);
|
|
3477
|
+
}
|
|
3478
|
+
const acSchema = loadAdaptiveCardSchema();
|
|
3479
|
+
const acDefs = getAdaptiveCardDefinitions(acSchema);
|
|
3480
|
+
const name = args[1];
|
|
3481
|
+
const definition = lookupDefinition(name, acDefs);
|
|
3482
|
+
if (definition) {
|
|
3483
|
+
console.log(formatDefinition(name, definition, true));
|
|
3484
|
+
} else {
|
|
3485
|
+
console.log(`Definition '${name}' not found in Adaptive Cards schema.`);
|
|
3486
|
+
}
|
|
3487
|
+
break;
|
|
3488
|
+
}
|
|
3489
|
+
default:
|
|
3490
|
+
console.error(`Unknown command: ${command}`);
|
|
3491
|
+
printHelp();
|
|
3492
|
+
process.exit(1);
|
|
3493
|
+
}
|
|
3494
|
+
}
|
|
3495
|
+
main();
|