skillhub 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
+
__commonJS,
|
|
4
|
+
__require,
|
|
5
|
+
__toESM,
|
|
3
6
|
ensureSkillsDir,
|
|
4
7
|
getConfigPath,
|
|
5
8
|
getPlatformFilePath,
|
|
@@ -9,7 +12,3491 @@ import {
|
|
|
9
12
|
isSkillInstalled,
|
|
10
13
|
loadConfig,
|
|
11
14
|
saveConfig
|
|
12
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-5WBBOQ42.js";
|
|
16
|
+
|
|
17
|
+
// ../../node_modules/.pnpm/kind-of@6.0.3/node_modules/kind-of/index.js
|
|
18
|
+
var require_kind_of = __commonJS({
|
|
19
|
+
"../../node_modules/.pnpm/kind-of@6.0.3/node_modules/kind-of/index.js"(exports2, module2) {
|
|
20
|
+
"use strict";
|
|
21
|
+
var toString = Object.prototype.toString;
|
|
22
|
+
module2.exports = function kindOf(val) {
|
|
23
|
+
if (val === void 0) return "undefined";
|
|
24
|
+
if (val === null) return "null";
|
|
25
|
+
var type = typeof val;
|
|
26
|
+
if (type === "boolean") return "boolean";
|
|
27
|
+
if (type === "string") return "string";
|
|
28
|
+
if (type === "number") return "number";
|
|
29
|
+
if (type === "symbol") return "symbol";
|
|
30
|
+
if (type === "function") {
|
|
31
|
+
return isGeneratorFn(val) ? "generatorfunction" : "function";
|
|
32
|
+
}
|
|
33
|
+
if (isArray(val)) return "array";
|
|
34
|
+
if (isBuffer(val)) return "buffer";
|
|
35
|
+
if (isArguments(val)) return "arguments";
|
|
36
|
+
if (isDate(val)) return "date";
|
|
37
|
+
if (isError(val)) return "error";
|
|
38
|
+
if (isRegexp(val)) return "regexp";
|
|
39
|
+
switch (ctorName(val)) {
|
|
40
|
+
case "Symbol":
|
|
41
|
+
return "symbol";
|
|
42
|
+
case "Promise":
|
|
43
|
+
return "promise";
|
|
44
|
+
// Set, Map, WeakSet, WeakMap
|
|
45
|
+
case "WeakMap":
|
|
46
|
+
return "weakmap";
|
|
47
|
+
case "WeakSet":
|
|
48
|
+
return "weakset";
|
|
49
|
+
case "Map":
|
|
50
|
+
return "map";
|
|
51
|
+
case "Set":
|
|
52
|
+
return "set";
|
|
53
|
+
// 8-bit typed arrays
|
|
54
|
+
case "Int8Array":
|
|
55
|
+
return "int8array";
|
|
56
|
+
case "Uint8Array":
|
|
57
|
+
return "uint8array";
|
|
58
|
+
case "Uint8ClampedArray":
|
|
59
|
+
return "uint8clampedarray";
|
|
60
|
+
// 16-bit typed arrays
|
|
61
|
+
case "Int16Array":
|
|
62
|
+
return "int16array";
|
|
63
|
+
case "Uint16Array":
|
|
64
|
+
return "uint16array";
|
|
65
|
+
// 32-bit typed arrays
|
|
66
|
+
case "Int32Array":
|
|
67
|
+
return "int32array";
|
|
68
|
+
case "Uint32Array":
|
|
69
|
+
return "uint32array";
|
|
70
|
+
case "Float32Array":
|
|
71
|
+
return "float32array";
|
|
72
|
+
case "Float64Array":
|
|
73
|
+
return "float64array";
|
|
74
|
+
}
|
|
75
|
+
if (isGeneratorObj(val)) {
|
|
76
|
+
return "generator";
|
|
77
|
+
}
|
|
78
|
+
type = toString.call(val);
|
|
79
|
+
switch (type) {
|
|
80
|
+
case "[object Object]":
|
|
81
|
+
return "object";
|
|
82
|
+
// iterators
|
|
83
|
+
case "[object Map Iterator]":
|
|
84
|
+
return "mapiterator";
|
|
85
|
+
case "[object Set Iterator]":
|
|
86
|
+
return "setiterator";
|
|
87
|
+
case "[object String Iterator]":
|
|
88
|
+
return "stringiterator";
|
|
89
|
+
case "[object Array Iterator]":
|
|
90
|
+
return "arrayiterator";
|
|
91
|
+
}
|
|
92
|
+
return type.slice(8, -1).toLowerCase().replace(/\s/g, "");
|
|
93
|
+
};
|
|
94
|
+
function ctorName(val) {
|
|
95
|
+
return typeof val.constructor === "function" ? val.constructor.name : null;
|
|
96
|
+
}
|
|
97
|
+
function isArray(val) {
|
|
98
|
+
if (Array.isArray) return Array.isArray(val);
|
|
99
|
+
return val instanceof Array;
|
|
100
|
+
}
|
|
101
|
+
function isError(val) {
|
|
102
|
+
return val instanceof Error || typeof val.message === "string" && val.constructor && typeof val.constructor.stackTraceLimit === "number";
|
|
103
|
+
}
|
|
104
|
+
function isDate(val) {
|
|
105
|
+
if (val instanceof Date) return true;
|
|
106
|
+
return typeof val.toDateString === "function" && typeof val.getDate === "function" && typeof val.setDate === "function";
|
|
107
|
+
}
|
|
108
|
+
function isRegexp(val) {
|
|
109
|
+
if (val instanceof RegExp) return true;
|
|
110
|
+
return typeof val.flags === "string" && typeof val.ignoreCase === "boolean" && typeof val.multiline === "boolean" && typeof val.global === "boolean";
|
|
111
|
+
}
|
|
112
|
+
function isGeneratorFn(name, val) {
|
|
113
|
+
return ctorName(name) === "GeneratorFunction";
|
|
114
|
+
}
|
|
115
|
+
function isGeneratorObj(val) {
|
|
116
|
+
return typeof val.throw === "function" && typeof val.return === "function" && typeof val.next === "function";
|
|
117
|
+
}
|
|
118
|
+
function isArguments(val) {
|
|
119
|
+
try {
|
|
120
|
+
if (typeof val.length === "number" && typeof val.callee === "function") {
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
} catch (err) {
|
|
124
|
+
if (err.message.indexOf("callee") !== -1) {
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
function isBuffer(val) {
|
|
131
|
+
if (val.constructor && typeof val.constructor.isBuffer === "function") {
|
|
132
|
+
return val.constructor.isBuffer(val);
|
|
133
|
+
}
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
// ../../node_modules/.pnpm/is-extendable@0.1.1/node_modules/is-extendable/index.js
|
|
140
|
+
var require_is_extendable = __commonJS({
|
|
141
|
+
"../../node_modules/.pnpm/is-extendable@0.1.1/node_modules/is-extendable/index.js"(exports2, module2) {
|
|
142
|
+
"use strict";
|
|
143
|
+
module2.exports = function isExtendable(val) {
|
|
144
|
+
return typeof val !== "undefined" && val !== null && (typeof val === "object" || typeof val === "function");
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
// ../../node_modules/.pnpm/extend-shallow@2.0.1/node_modules/extend-shallow/index.js
|
|
150
|
+
var require_extend_shallow = __commonJS({
|
|
151
|
+
"../../node_modules/.pnpm/extend-shallow@2.0.1/node_modules/extend-shallow/index.js"(exports2, module2) {
|
|
152
|
+
"use strict";
|
|
153
|
+
var isObject = require_is_extendable();
|
|
154
|
+
module2.exports = function extend(o) {
|
|
155
|
+
if (!isObject(o)) {
|
|
156
|
+
o = {};
|
|
157
|
+
}
|
|
158
|
+
var len = arguments.length;
|
|
159
|
+
for (var i = 1; i < len; i++) {
|
|
160
|
+
var obj = arguments[i];
|
|
161
|
+
if (isObject(obj)) {
|
|
162
|
+
assign(o, obj);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return o;
|
|
166
|
+
};
|
|
167
|
+
function assign(a, b) {
|
|
168
|
+
for (var key in b) {
|
|
169
|
+
if (hasOwn(b, key)) {
|
|
170
|
+
a[key] = b[key];
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
function hasOwn(obj, key) {
|
|
175
|
+
return Object.prototype.hasOwnProperty.call(obj, key);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
// ../../node_modules/.pnpm/section-matter@1.0.0/node_modules/section-matter/index.js
|
|
181
|
+
var require_section_matter = __commonJS({
|
|
182
|
+
"../../node_modules/.pnpm/section-matter@1.0.0/node_modules/section-matter/index.js"(exports2, module2) {
|
|
183
|
+
"use strict";
|
|
184
|
+
var typeOf = require_kind_of();
|
|
185
|
+
var extend = require_extend_shallow();
|
|
186
|
+
module2.exports = function(input, options2) {
|
|
187
|
+
if (typeof options2 === "function") {
|
|
188
|
+
options2 = { parse: options2 };
|
|
189
|
+
}
|
|
190
|
+
var file = toObject(input);
|
|
191
|
+
var defaults = { section_delimiter: "---", parse: identity };
|
|
192
|
+
var opts = extend({}, defaults, options2);
|
|
193
|
+
var delim = opts.section_delimiter;
|
|
194
|
+
var lines = file.content.split(/\r?\n/);
|
|
195
|
+
var sections = null;
|
|
196
|
+
var section = createSection();
|
|
197
|
+
var content = [];
|
|
198
|
+
var stack = [];
|
|
199
|
+
function initSections(val) {
|
|
200
|
+
file.content = val;
|
|
201
|
+
sections = [];
|
|
202
|
+
content = [];
|
|
203
|
+
}
|
|
204
|
+
function closeSection(val) {
|
|
205
|
+
if (stack.length) {
|
|
206
|
+
section.key = getKey(stack[0], delim);
|
|
207
|
+
section.content = val;
|
|
208
|
+
opts.parse(section, sections);
|
|
209
|
+
sections.push(section);
|
|
210
|
+
section = createSection();
|
|
211
|
+
content = [];
|
|
212
|
+
stack = [];
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
for (var i = 0; i < lines.length; i++) {
|
|
216
|
+
var line = lines[i];
|
|
217
|
+
var len = stack.length;
|
|
218
|
+
var ln = line.trim();
|
|
219
|
+
if (isDelimiter(ln, delim)) {
|
|
220
|
+
if (ln.length === 3 && i !== 0) {
|
|
221
|
+
if (len === 0 || len === 2) {
|
|
222
|
+
content.push(line);
|
|
223
|
+
continue;
|
|
224
|
+
}
|
|
225
|
+
stack.push(ln);
|
|
226
|
+
section.data = content.join("\n");
|
|
227
|
+
content = [];
|
|
228
|
+
continue;
|
|
229
|
+
}
|
|
230
|
+
if (sections === null) {
|
|
231
|
+
initSections(content.join("\n"));
|
|
232
|
+
}
|
|
233
|
+
if (len === 2) {
|
|
234
|
+
closeSection(content.join("\n"));
|
|
235
|
+
}
|
|
236
|
+
stack.push(ln);
|
|
237
|
+
continue;
|
|
238
|
+
}
|
|
239
|
+
content.push(line);
|
|
240
|
+
}
|
|
241
|
+
if (sections === null) {
|
|
242
|
+
initSections(content.join("\n"));
|
|
243
|
+
} else {
|
|
244
|
+
closeSection(content.join("\n"));
|
|
245
|
+
}
|
|
246
|
+
file.sections = sections;
|
|
247
|
+
return file;
|
|
248
|
+
};
|
|
249
|
+
function isDelimiter(line, delim) {
|
|
250
|
+
if (line.slice(0, delim.length) !== delim) {
|
|
251
|
+
return false;
|
|
252
|
+
}
|
|
253
|
+
if (line.charAt(delim.length + 1) === delim.slice(-1)) {
|
|
254
|
+
return false;
|
|
255
|
+
}
|
|
256
|
+
return true;
|
|
257
|
+
}
|
|
258
|
+
function toObject(input) {
|
|
259
|
+
if (typeOf(input) !== "object") {
|
|
260
|
+
input = { content: input };
|
|
261
|
+
}
|
|
262
|
+
if (typeof input.content !== "string" && !isBuffer(input.content)) {
|
|
263
|
+
throw new TypeError("expected a buffer or string");
|
|
264
|
+
}
|
|
265
|
+
input.content = input.content.toString();
|
|
266
|
+
input.sections = [];
|
|
267
|
+
return input;
|
|
268
|
+
}
|
|
269
|
+
function getKey(val, delim) {
|
|
270
|
+
return val ? val.slice(delim.length).trim() : "";
|
|
271
|
+
}
|
|
272
|
+
function createSection() {
|
|
273
|
+
return { key: "", data: "", content: "" };
|
|
274
|
+
}
|
|
275
|
+
function identity(val) {
|
|
276
|
+
return val;
|
|
277
|
+
}
|
|
278
|
+
function isBuffer(val) {
|
|
279
|
+
if (val && val.constructor && typeof val.constructor.isBuffer === "function") {
|
|
280
|
+
return val.constructor.isBuffer(val);
|
|
281
|
+
}
|
|
282
|
+
return false;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/common.js
|
|
288
|
+
var require_common = __commonJS({
|
|
289
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/common.js"(exports2, module2) {
|
|
290
|
+
"use strict";
|
|
291
|
+
function isNothing(subject) {
|
|
292
|
+
return typeof subject === "undefined" || subject === null;
|
|
293
|
+
}
|
|
294
|
+
function isObject(subject) {
|
|
295
|
+
return typeof subject === "object" && subject !== null;
|
|
296
|
+
}
|
|
297
|
+
function toArray(sequence) {
|
|
298
|
+
if (Array.isArray(sequence)) return sequence;
|
|
299
|
+
else if (isNothing(sequence)) return [];
|
|
300
|
+
return [sequence];
|
|
301
|
+
}
|
|
302
|
+
function extend(target, source) {
|
|
303
|
+
var index, length, key, sourceKeys;
|
|
304
|
+
if (source) {
|
|
305
|
+
sourceKeys = Object.keys(source);
|
|
306
|
+
for (index = 0, length = sourceKeys.length; index < length; index += 1) {
|
|
307
|
+
key = sourceKeys[index];
|
|
308
|
+
target[key] = source[key];
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
return target;
|
|
312
|
+
}
|
|
313
|
+
function repeat(string, count) {
|
|
314
|
+
var result = "", cycle;
|
|
315
|
+
for (cycle = 0; cycle < count; cycle += 1) {
|
|
316
|
+
result += string;
|
|
317
|
+
}
|
|
318
|
+
return result;
|
|
319
|
+
}
|
|
320
|
+
function isNegativeZero(number) {
|
|
321
|
+
return number === 0 && Number.NEGATIVE_INFINITY === 1 / number;
|
|
322
|
+
}
|
|
323
|
+
module2.exports.isNothing = isNothing;
|
|
324
|
+
module2.exports.isObject = isObject;
|
|
325
|
+
module2.exports.toArray = toArray;
|
|
326
|
+
module2.exports.repeat = repeat;
|
|
327
|
+
module2.exports.isNegativeZero = isNegativeZero;
|
|
328
|
+
module2.exports.extend = extend;
|
|
329
|
+
}
|
|
330
|
+
});
|
|
331
|
+
|
|
332
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/exception.js
|
|
333
|
+
var require_exception = __commonJS({
|
|
334
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/exception.js"(exports2, module2) {
|
|
335
|
+
"use strict";
|
|
336
|
+
function YAMLException(reason, mark) {
|
|
337
|
+
Error.call(this);
|
|
338
|
+
this.name = "YAMLException";
|
|
339
|
+
this.reason = reason;
|
|
340
|
+
this.mark = mark;
|
|
341
|
+
this.message = (this.reason || "(unknown reason)") + (this.mark ? " " + this.mark.toString() : "");
|
|
342
|
+
if (Error.captureStackTrace) {
|
|
343
|
+
Error.captureStackTrace(this, this.constructor);
|
|
344
|
+
} else {
|
|
345
|
+
this.stack = new Error().stack || "";
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
YAMLException.prototype = Object.create(Error.prototype);
|
|
349
|
+
YAMLException.prototype.constructor = YAMLException;
|
|
350
|
+
YAMLException.prototype.toString = function toString(compact) {
|
|
351
|
+
var result = this.name + ": ";
|
|
352
|
+
result += this.reason || "(unknown reason)";
|
|
353
|
+
if (!compact && this.mark) {
|
|
354
|
+
result += " " + this.mark.toString();
|
|
355
|
+
}
|
|
356
|
+
return result;
|
|
357
|
+
};
|
|
358
|
+
module2.exports = YAMLException;
|
|
359
|
+
}
|
|
360
|
+
});
|
|
361
|
+
|
|
362
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/mark.js
|
|
363
|
+
var require_mark = __commonJS({
|
|
364
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/mark.js"(exports2, module2) {
|
|
365
|
+
"use strict";
|
|
366
|
+
var common = require_common();
|
|
367
|
+
function Mark(name, buffer, position, line, column) {
|
|
368
|
+
this.name = name;
|
|
369
|
+
this.buffer = buffer;
|
|
370
|
+
this.position = position;
|
|
371
|
+
this.line = line;
|
|
372
|
+
this.column = column;
|
|
373
|
+
}
|
|
374
|
+
Mark.prototype.getSnippet = function getSnippet(indent, maxLength) {
|
|
375
|
+
var head, start, tail, end, snippet;
|
|
376
|
+
if (!this.buffer) return null;
|
|
377
|
+
indent = indent || 4;
|
|
378
|
+
maxLength = maxLength || 75;
|
|
379
|
+
head = "";
|
|
380
|
+
start = this.position;
|
|
381
|
+
while (start > 0 && "\0\r\n\x85\u2028\u2029".indexOf(this.buffer.charAt(start - 1)) === -1) {
|
|
382
|
+
start -= 1;
|
|
383
|
+
if (this.position - start > maxLength / 2 - 1) {
|
|
384
|
+
head = " ... ";
|
|
385
|
+
start += 5;
|
|
386
|
+
break;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
tail = "";
|
|
390
|
+
end = this.position;
|
|
391
|
+
while (end < this.buffer.length && "\0\r\n\x85\u2028\u2029".indexOf(this.buffer.charAt(end)) === -1) {
|
|
392
|
+
end += 1;
|
|
393
|
+
if (end - this.position > maxLength / 2 - 1) {
|
|
394
|
+
tail = " ... ";
|
|
395
|
+
end -= 5;
|
|
396
|
+
break;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
snippet = this.buffer.slice(start, end);
|
|
400
|
+
return common.repeat(" ", indent) + head + snippet + tail + "\n" + common.repeat(" ", indent + this.position - start + head.length) + "^";
|
|
401
|
+
};
|
|
402
|
+
Mark.prototype.toString = function toString(compact) {
|
|
403
|
+
var snippet, where = "";
|
|
404
|
+
if (this.name) {
|
|
405
|
+
where += 'in "' + this.name + '" ';
|
|
406
|
+
}
|
|
407
|
+
where += "at line " + (this.line + 1) + ", column " + (this.column + 1);
|
|
408
|
+
if (!compact) {
|
|
409
|
+
snippet = this.getSnippet();
|
|
410
|
+
if (snippet) {
|
|
411
|
+
where += ":\n" + snippet;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
return where;
|
|
415
|
+
};
|
|
416
|
+
module2.exports = Mark;
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
|
|
420
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type.js
|
|
421
|
+
var require_type = __commonJS({
|
|
422
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type.js"(exports2, module2) {
|
|
423
|
+
"use strict";
|
|
424
|
+
var YAMLException = require_exception();
|
|
425
|
+
var TYPE_CONSTRUCTOR_OPTIONS = [
|
|
426
|
+
"kind",
|
|
427
|
+
"resolve",
|
|
428
|
+
"construct",
|
|
429
|
+
"instanceOf",
|
|
430
|
+
"predicate",
|
|
431
|
+
"represent",
|
|
432
|
+
"defaultStyle",
|
|
433
|
+
"styleAliases"
|
|
434
|
+
];
|
|
435
|
+
var YAML_NODE_KINDS = [
|
|
436
|
+
"scalar",
|
|
437
|
+
"sequence",
|
|
438
|
+
"mapping"
|
|
439
|
+
];
|
|
440
|
+
function compileStyleAliases(map) {
|
|
441
|
+
var result = {};
|
|
442
|
+
if (map !== null) {
|
|
443
|
+
Object.keys(map).forEach(function(style) {
|
|
444
|
+
map[style].forEach(function(alias) {
|
|
445
|
+
result[String(alias)] = style;
|
|
446
|
+
});
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
return result;
|
|
450
|
+
}
|
|
451
|
+
function Type(tag, options2) {
|
|
452
|
+
options2 = options2 || {};
|
|
453
|
+
Object.keys(options2).forEach(function(name) {
|
|
454
|
+
if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
|
|
455
|
+
throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
|
|
456
|
+
}
|
|
457
|
+
});
|
|
458
|
+
this.tag = tag;
|
|
459
|
+
this.kind = options2["kind"] || null;
|
|
460
|
+
this.resolve = options2["resolve"] || function() {
|
|
461
|
+
return true;
|
|
462
|
+
};
|
|
463
|
+
this.construct = options2["construct"] || function(data) {
|
|
464
|
+
return data;
|
|
465
|
+
};
|
|
466
|
+
this.instanceOf = options2["instanceOf"] || null;
|
|
467
|
+
this.predicate = options2["predicate"] || null;
|
|
468
|
+
this.represent = options2["represent"] || null;
|
|
469
|
+
this.defaultStyle = options2["defaultStyle"] || null;
|
|
470
|
+
this.styleAliases = compileStyleAliases(options2["styleAliases"] || null);
|
|
471
|
+
if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
|
|
472
|
+
throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
module2.exports = Type;
|
|
476
|
+
}
|
|
477
|
+
});
|
|
478
|
+
|
|
479
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/schema.js
|
|
480
|
+
var require_schema = __commonJS({
|
|
481
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/schema.js"(exports2, module2) {
|
|
482
|
+
"use strict";
|
|
483
|
+
var common = require_common();
|
|
484
|
+
var YAMLException = require_exception();
|
|
485
|
+
var Type = require_type();
|
|
486
|
+
function compileList(schema, name, result) {
|
|
487
|
+
var exclude = [];
|
|
488
|
+
schema.include.forEach(function(includedSchema) {
|
|
489
|
+
result = compileList(includedSchema, name, result);
|
|
490
|
+
});
|
|
491
|
+
schema[name].forEach(function(currentType) {
|
|
492
|
+
result.forEach(function(previousType, previousIndex) {
|
|
493
|
+
if (previousType.tag === currentType.tag && previousType.kind === currentType.kind) {
|
|
494
|
+
exclude.push(previousIndex);
|
|
495
|
+
}
|
|
496
|
+
});
|
|
497
|
+
result.push(currentType);
|
|
498
|
+
});
|
|
499
|
+
return result.filter(function(type, index) {
|
|
500
|
+
return exclude.indexOf(index) === -1;
|
|
501
|
+
});
|
|
502
|
+
}
|
|
503
|
+
function compileMap() {
|
|
504
|
+
var result = {
|
|
505
|
+
scalar: {},
|
|
506
|
+
sequence: {},
|
|
507
|
+
mapping: {},
|
|
508
|
+
fallback: {}
|
|
509
|
+
}, index, length;
|
|
510
|
+
function collectType(type) {
|
|
511
|
+
result[type.kind][type.tag] = result["fallback"][type.tag] = type;
|
|
512
|
+
}
|
|
513
|
+
for (index = 0, length = arguments.length; index < length; index += 1) {
|
|
514
|
+
arguments[index].forEach(collectType);
|
|
515
|
+
}
|
|
516
|
+
return result;
|
|
517
|
+
}
|
|
518
|
+
function Schema(definition) {
|
|
519
|
+
this.include = definition.include || [];
|
|
520
|
+
this.implicit = definition.implicit || [];
|
|
521
|
+
this.explicit = definition.explicit || [];
|
|
522
|
+
this.implicit.forEach(function(type) {
|
|
523
|
+
if (type.loadKind && type.loadKind !== "scalar") {
|
|
524
|
+
throw new YAMLException("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
|
|
525
|
+
}
|
|
526
|
+
});
|
|
527
|
+
this.compiledImplicit = compileList(this, "implicit", []);
|
|
528
|
+
this.compiledExplicit = compileList(this, "explicit", []);
|
|
529
|
+
this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit);
|
|
530
|
+
}
|
|
531
|
+
Schema.DEFAULT = null;
|
|
532
|
+
Schema.create = function createSchema() {
|
|
533
|
+
var schemas, types;
|
|
534
|
+
switch (arguments.length) {
|
|
535
|
+
case 1:
|
|
536
|
+
schemas = Schema.DEFAULT;
|
|
537
|
+
types = arguments[0];
|
|
538
|
+
break;
|
|
539
|
+
case 2:
|
|
540
|
+
schemas = arguments[0];
|
|
541
|
+
types = arguments[1];
|
|
542
|
+
break;
|
|
543
|
+
default:
|
|
544
|
+
throw new YAMLException("Wrong number of arguments for Schema.create function");
|
|
545
|
+
}
|
|
546
|
+
schemas = common.toArray(schemas);
|
|
547
|
+
types = common.toArray(types);
|
|
548
|
+
if (!schemas.every(function(schema) {
|
|
549
|
+
return schema instanceof Schema;
|
|
550
|
+
})) {
|
|
551
|
+
throw new YAMLException("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");
|
|
552
|
+
}
|
|
553
|
+
if (!types.every(function(type) {
|
|
554
|
+
return type instanceof Type;
|
|
555
|
+
})) {
|
|
556
|
+
throw new YAMLException("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
|
557
|
+
}
|
|
558
|
+
return new Schema({
|
|
559
|
+
include: schemas,
|
|
560
|
+
explicit: types
|
|
561
|
+
});
|
|
562
|
+
};
|
|
563
|
+
module2.exports = Schema;
|
|
564
|
+
}
|
|
565
|
+
});
|
|
566
|
+
|
|
567
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/str.js
|
|
568
|
+
var require_str = __commonJS({
|
|
569
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/str.js"(exports2, module2) {
|
|
570
|
+
"use strict";
|
|
571
|
+
var Type = require_type();
|
|
572
|
+
module2.exports = new Type("tag:yaml.org,2002:str", {
|
|
573
|
+
kind: "scalar",
|
|
574
|
+
construct: function(data) {
|
|
575
|
+
return data !== null ? data : "";
|
|
576
|
+
}
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
});
|
|
580
|
+
|
|
581
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/seq.js
|
|
582
|
+
var require_seq = __commonJS({
|
|
583
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/seq.js"(exports2, module2) {
|
|
584
|
+
"use strict";
|
|
585
|
+
var Type = require_type();
|
|
586
|
+
module2.exports = new Type("tag:yaml.org,2002:seq", {
|
|
587
|
+
kind: "sequence",
|
|
588
|
+
construct: function(data) {
|
|
589
|
+
return data !== null ? data : [];
|
|
590
|
+
}
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
});
|
|
594
|
+
|
|
595
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/map.js
|
|
596
|
+
var require_map = __commonJS({
|
|
597
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/map.js"(exports2, module2) {
|
|
598
|
+
"use strict";
|
|
599
|
+
var Type = require_type();
|
|
600
|
+
module2.exports = new Type("tag:yaml.org,2002:map", {
|
|
601
|
+
kind: "mapping",
|
|
602
|
+
construct: function(data) {
|
|
603
|
+
return data !== null ? data : {};
|
|
604
|
+
}
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
});
|
|
608
|
+
|
|
609
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js
|
|
610
|
+
var require_failsafe = __commonJS({
|
|
611
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js"(exports2, module2) {
|
|
612
|
+
"use strict";
|
|
613
|
+
var Schema = require_schema();
|
|
614
|
+
module2.exports = new Schema({
|
|
615
|
+
explicit: [
|
|
616
|
+
require_str(),
|
|
617
|
+
require_seq(),
|
|
618
|
+
require_map()
|
|
619
|
+
]
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
});
|
|
623
|
+
|
|
624
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/null.js
|
|
625
|
+
var require_null = __commonJS({
|
|
626
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/null.js"(exports2, module2) {
|
|
627
|
+
"use strict";
|
|
628
|
+
var Type = require_type();
|
|
629
|
+
function resolveYamlNull(data) {
|
|
630
|
+
if (data === null) return true;
|
|
631
|
+
var max = data.length;
|
|
632
|
+
return max === 1 && data === "~" || max === 4 && (data === "null" || data === "Null" || data === "NULL");
|
|
633
|
+
}
|
|
634
|
+
function constructYamlNull() {
|
|
635
|
+
return null;
|
|
636
|
+
}
|
|
637
|
+
function isNull(object) {
|
|
638
|
+
return object === null;
|
|
639
|
+
}
|
|
640
|
+
module2.exports = new Type("tag:yaml.org,2002:null", {
|
|
641
|
+
kind: "scalar",
|
|
642
|
+
resolve: resolveYamlNull,
|
|
643
|
+
construct: constructYamlNull,
|
|
644
|
+
predicate: isNull,
|
|
645
|
+
represent: {
|
|
646
|
+
canonical: function() {
|
|
647
|
+
return "~";
|
|
648
|
+
},
|
|
649
|
+
lowercase: function() {
|
|
650
|
+
return "null";
|
|
651
|
+
},
|
|
652
|
+
uppercase: function() {
|
|
653
|
+
return "NULL";
|
|
654
|
+
},
|
|
655
|
+
camelcase: function() {
|
|
656
|
+
return "Null";
|
|
657
|
+
}
|
|
658
|
+
},
|
|
659
|
+
defaultStyle: "lowercase"
|
|
660
|
+
});
|
|
661
|
+
}
|
|
662
|
+
});
|
|
663
|
+
|
|
664
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/bool.js
|
|
665
|
+
var require_bool = __commonJS({
|
|
666
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/bool.js"(exports2, module2) {
|
|
667
|
+
"use strict";
|
|
668
|
+
var Type = require_type();
|
|
669
|
+
function resolveYamlBoolean(data) {
|
|
670
|
+
if (data === null) return false;
|
|
671
|
+
var max = data.length;
|
|
672
|
+
return max === 4 && (data === "true" || data === "True" || data === "TRUE") || max === 5 && (data === "false" || data === "False" || data === "FALSE");
|
|
673
|
+
}
|
|
674
|
+
function constructYamlBoolean(data) {
|
|
675
|
+
return data === "true" || data === "True" || data === "TRUE";
|
|
676
|
+
}
|
|
677
|
+
function isBoolean(object) {
|
|
678
|
+
return Object.prototype.toString.call(object) === "[object Boolean]";
|
|
679
|
+
}
|
|
680
|
+
module2.exports = new Type("tag:yaml.org,2002:bool", {
|
|
681
|
+
kind: "scalar",
|
|
682
|
+
resolve: resolveYamlBoolean,
|
|
683
|
+
construct: constructYamlBoolean,
|
|
684
|
+
predicate: isBoolean,
|
|
685
|
+
represent: {
|
|
686
|
+
lowercase: function(object) {
|
|
687
|
+
return object ? "true" : "false";
|
|
688
|
+
},
|
|
689
|
+
uppercase: function(object) {
|
|
690
|
+
return object ? "TRUE" : "FALSE";
|
|
691
|
+
},
|
|
692
|
+
camelcase: function(object) {
|
|
693
|
+
return object ? "True" : "False";
|
|
694
|
+
}
|
|
695
|
+
},
|
|
696
|
+
defaultStyle: "lowercase"
|
|
697
|
+
});
|
|
698
|
+
}
|
|
699
|
+
});
|
|
700
|
+
|
|
701
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/int.js
|
|
702
|
+
var require_int = __commonJS({
|
|
703
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/int.js"(exports2, module2) {
|
|
704
|
+
"use strict";
|
|
705
|
+
var common = require_common();
|
|
706
|
+
var Type = require_type();
|
|
707
|
+
function isHexCode(c) {
|
|
708
|
+
return 48 <= c && c <= 57 || 65 <= c && c <= 70 || 97 <= c && c <= 102;
|
|
709
|
+
}
|
|
710
|
+
function isOctCode(c) {
|
|
711
|
+
return 48 <= c && c <= 55;
|
|
712
|
+
}
|
|
713
|
+
function isDecCode(c) {
|
|
714
|
+
return 48 <= c && c <= 57;
|
|
715
|
+
}
|
|
716
|
+
function resolveYamlInteger(data) {
|
|
717
|
+
if (data === null) return false;
|
|
718
|
+
var max = data.length, index = 0, hasDigits = false, ch;
|
|
719
|
+
if (!max) return false;
|
|
720
|
+
ch = data[index];
|
|
721
|
+
if (ch === "-" || ch === "+") {
|
|
722
|
+
ch = data[++index];
|
|
723
|
+
}
|
|
724
|
+
if (ch === "0") {
|
|
725
|
+
if (index + 1 === max) return true;
|
|
726
|
+
ch = data[++index];
|
|
727
|
+
if (ch === "b") {
|
|
728
|
+
index++;
|
|
729
|
+
for (; index < max; index++) {
|
|
730
|
+
ch = data[index];
|
|
731
|
+
if (ch === "_") continue;
|
|
732
|
+
if (ch !== "0" && ch !== "1") return false;
|
|
733
|
+
hasDigits = true;
|
|
734
|
+
}
|
|
735
|
+
return hasDigits && ch !== "_";
|
|
736
|
+
}
|
|
737
|
+
if (ch === "x") {
|
|
738
|
+
index++;
|
|
739
|
+
for (; index < max; index++) {
|
|
740
|
+
ch = data[index];
|
|
741
|
+
if (ch === "_") continue;
|
|
742
|
+
if (!isHexCode(data.charCodeAt(index))) return false;
|
|
743
|
+
hasDigits = true;
|
|
744
|
+
}
|
|
745
|
+
return hasDigits && ch !== "_";
|
|
746
|
+
}
|
|
747
|
+
for (; index < max; index++) {
|
|
748
|
+
ch = data[index];
|
|
749
|
+
if (ch === "_") continue;
|
|
750
|
+
if (!isOctCode(data.charCodeAt(index))) return false;
|
|
751
|
+
hasDigits = true;
|
|
752
|
+
}
|
|
753
|
+
return hasDigits && ch !== "_";
|
|
754
|
+
}
|
|
755
|
+
if (ch === "_") return false;
|
|
756
|
+
for (; index < max; index++) {
|
|
757
|
+
ch = data[index];
|
|
758
|
+
if (ch === "_") continue;
|
|
759
|
+
if (ch === ":") break;
|
|
760
|
+
if (!isDecCode(data.charCodeAt(index))) {
|
|
761
|
+
return false;
|
|
762
|
+
}
|
|
763
|
+
hasDigits = true;
|
|
764
|
+
}
|
|
765
|
+
if (!hasDigits || ch === "_") return false;
|
|
766
|
+
if (ch !== ":") return true;
|
|
767
|
+
return /^(:[0-5]?[0-9])+$/.test(data.slice(index));
|
|
768
|
+
}
|
|
769
|
+
function constructYamlInteger(data) {
|
|
770
|
+
var value = data, sign = 1, ch, base, digits = [];
|
|
771
|
+
if (value.indexOf("_") !== -1) {
|
|
772
|
+
value = value.replace(/_/g, "");
|
|
773
|
+
}
|
|
774
|
+
ch = value[0];
|
|
775
|
+
if (ch === "-" || ch === "+") {
|
|
776
|
+
if (ch === "-") sign = -1;
|
|
777
|
+
value = value.slice(1);
|
|
778
|
+
ch = value[0];
|
|
779
|
+
}
|
|
780
|
+
if (value === "0") return 0;
|
|
781
|
+
if (ch === "0") {
|
|
782
|
+
if (value[1] === "b") return sign * parseInt(value.slice(2), 2);
|
|
783
|
+
if (value[1] === "x") return sign * parseInt(value, 16);
|
|
784
|
+
return sign * parseInt(value, 8);
|
|
785
|
+
}
|
|
786
|
+
if (value.indexOf(":") !== -1) {
|
|
787
|
+
value.split(":").forEach(function(v) {
|
|
788
|
+
digits.unshift(parseInt(v, 10));
|
|
789
|
+
});
|
|
790
|
+
value = 0;
|
|
791
|
+
base = 1;
|
|
792
|
+
digits.forEach(function(d) {
|
|
793
|
+
value += d * base;
|
|
794
|
+
base *= 60;
|
|
795
|
+
});
|
|
796
|
+
return sign * value;
|
|
797
|
+
}
|
|
798
|
+
return sign * parseInt(value, 10);
|
|
799
|
+
}
|
|
800
|
+
function isInteger(object) {
|
|
801
|
+
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 === 0 && !common.isNegativeZero(object));
|
|
802
|
+
}
|
|
803
|
+
module2.exports = new Type("tag:yaml.org,2002:int", {
|
|
804
|
+
kind: "scalar",
|
|
805
|
+
resolve: resolveYamlInteger,
|
|
806
|
+
construct: constructYamlInteger,
|
|
807
|
+
predicate: isInteger,
|
|
808
|
+
represent: {
|
|
809
|
+
binary: function(obj) {
|
|
810
|
+
return obj >= 0 ? "0b" + obj.toString(2) : "-0b" + obj.toString(2).slice(1);
|
|
811
|
+
},
|
|
812
|
+
octal: function(obj) {
|
|
813
|
+
return obj >= 0 ? "0" + obj.toString(8) : "-0" + obj.toString(8).slice(1);
|
|
814
|
+
},
|
|
815
|
+
decimal: function(obj) {
|
|
816
|
+
return obj.toString(10);
|
|
817
|
+
},
|
|
818
|
+
/* eslint-disable max-len */
|
|
819
|
+
hexadecimal: function(obj) {
|
|
820
|
+
return obj >= 0 ? "0x" + obj.toString(16).toUpperCase() : "-0x" + obj.toString(16).toUpperCase().slice(1);
|
|
821
|
+
}
|
|
822
|
+
},
|
|
823
|
+
defaultStyle: "decimal",
|
|
824
|
+
styleAliases: {
|
|
825
|
+
binary: [2, "bin"],
|
|
826
|
+
octal: [8, "oct"],
|
|
827
|
+
decimal: [10, "dec"],
|
|
828
|
+
hexadecimal: [16, "hex"]
|
|
829
|
+
}
|
|
830
|
+
});
|
|
831
|
+
}
|
|
832
|
+
});
|
|
833
|
+
|
|
834
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/float.js
|
|
835
|
+
var require_float = __commonJS({
|
|
836
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/float.js"(exports2, module2) {
|
|
837
|
+
"use strict";
|
|
838
|
+
var common = require_common();
|
|
839
|
+
var Type = require_type();
|
|
840
|
+
var YAML_FLOAT_PATTERN = new RegExp(
|
|
841
|
+
// 2.5e4, 2.5 and integers
|
|
842
|
+
"^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"
|
|
843
|
+
);
|
|
844
|
+
function resolveYamlFloat(data) {
|
|
845
|
+
if (data === null) return false;
|
|
846
|
+
if (!YAML_FLOAT_PATTERN.test(data) || // Quick hack to not allow integers end with `_`
|
|
847
|
+
// Probably should update regexp & check speed
|
|
848
|
+
data[data.length - 1] === "_") {
|
|
849
|
+
return false;
|
|
850
|
+
}
|
|
851
|
+
return true;
|
|
852
|
+
}
|
|
853
|
+
function constructYamlFloat(data) {
|
|
854
|
+
var value, sign, base, digits;
|
|
855
|
+
value = data.replace(/_/g, "").toLowerCase();
|
|
856
|
+
sign = value[0] === "-" ? -1 : 1;
|
|
857
|
+
digits = [];
|
|
858
|
+
if ("+-".indexOf(value[0]) >= 0) {
|
|
859
|
+
value = value.slice(1);
|
|
860
|
+
}
|
|
861
|
+
if (value === ".inf") {
|
|
862
|
+
return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
|
|
863
|
+
} else if (value === ".nan") {
|
|
864
|
+
return NaN;
|
|
865
|
+
} else if (value.indexOf(":") >= 0) {
|
|
866
|
+
value.split(":").forEach(function(v) {
|
|
867
|
+
digits.unshift(parseFloat(v, 10));
|
|
868
|
+
});
|
|
869
|
+
value = 0;
|
|
870
|
+
base = 1;
|
|
871
|
+
digits.forEach(function(d) {
|
|
872
|
+
value += d * base;
|
|
873
|
+
base *= 60;
|
|
874
|
+
});
|
|
875
|
+
return sign * value;
|
|
876
|
+
}
|
|
877
|
+
return sign * parseFloat(value, 10);
|
|
878
|
+
}
|
|
879
|
+
var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
|
|
880
|
+
function representYamlFloat(object, style) {
|
|
881
|
+
var res;
|
|
882
|
+
if (isNaN(object)) {
|
|
883
|
+
switch (style) {
|
|
884
|
+
case "lowercase":
|
|
885
|
+
return ".nan";
|
|
886
|
+
case "uppercase":
|
|
887
|
+
return ".NAN";
|
|
888
|
+
case "camelcase":
|
|
889
|
+
return ".NaN";
|
|
890
|
+
}
|
|
891
|
+
} else if (Number.POSITIVE_INFINITY === object) {
|
|
892
|
+
switch (style) {
|
|
893
|
+
case "lowercase":
|
|
894
|
+
return ".inf";
|
|
895
|
+
case "uppercase":
|
|
896
|
+
return ".INF";
|
|
897
|
+
case "camelcase":
|
|
898
|
+
return ".Inf";
|
|
899
|
+
}
|
|
900
|
+
} else if (Number.NEGATIVE_INFINITY === object) {
|
|
901
|
+
switch (style) {
|
|
902
|
+
case "lowercase":
|
|
903
|
+
return "-.inf";
|
|
904
|
+
case "uppercase":
|
|
905
|
+
return "-.INF";
|
|
906
|
+
case "camelcase":
|
|
907
|
+
return "-.Inf";
|
|
908
|
+
}
|
|
909
|
+
} else if (common.isNegativeZero(object)) {
|
|
910
|
+
return "-0.0";
|
|
911
|
+
}
|
|
912
|
+
res = object.toString(10);
|
|
913
|
+
return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res;
|
|
914
|
+
}
|
|
915
|
+
function isFloat(object) {
|
|
916
|
+
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || common.isNegativeZero(object));
|
|
917
|
+
}
|
|
918
|
+
module2.exports = new Type("tag:yaml.org,2002:float", {
|
|
919
|
+
kind: "scalar",
|
|
920
|
+
resolve: resolveYamlFloat,
|
|
921
|
+
construct: constructYamlFloat,
|
|
922
|
+
predicate: isFloat,
|
|
923
|
+
represent: representYamlFloat,
|
|
924
|
+
defaultStyle: "lowercase"
|
|
925
|
+
});
|
|
926
|
+
}
|
|
927
|
+
});
|
|
928
|
+
|
|
929
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/schema/json.js
|
|
930
|
+
var require_json = __commonJS({
|
|
931
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/schema/json.js"(exports2, module2) {
|
|
932
|
+
"use strict";
|
|
933
|
+
var Schema = require_schema();
|
|
934
|
+
module2.exports = new Schema({
|
|
935
|
+
include: [
|
|
936
|
+
require_failsafe()
|
|
937
|
+
],
|
|
938
|
+
implicit: [
|
|
939
|
+
require_null(),
|
|
940
|
+
require_bool(),
|
|
941
|
+
require_int(),
|
|
942
|
+
require_float()
|
|
943
|
+
]
|
|
944
|
+
});
|
|
945
|
+
}
|
|
946
|
+
});
|
|
947
|
+
|
|
948
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/schema/core.js
|
|
949
|
+
var require_core = __commonJS({
|
|
950
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/schema/core.js"(exports2, module2) {
|
|
951
|
+
"use strict";
|
|
952
|
+
var Schema = require_schema();
|
|
953
|
+
module2.exports = new Schema({
|
|
954
|
+
include: [
|
|
955
|
+
require_json()
|
|
956
|
+
]
|
|
957
|
+
});
|
|
958
|
+
}
|
|
959
|
+
});
|
|
960
|
+
|
|
961
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/timestamp.js
|
|
962
|
+
var require_timestamp = __commonJS({
|
|
963
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/timestamp.js"(exports2, module2) {
|
|
964
|
+
"use strict";
|
|
965
|
+
var Type = require_type();
|
|
966
|
+
var YAML_DATE_REGEXP = new RegExp(
|
|
967
|
+
"^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"
|
|
968
|
+
);
|
|
969
|
+
var YAML_TIMESTAMP_REGEXP = new RegExp(
|
|
970
|
+
"^([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]))?))?$"
|
|
971
|
+
);
|
|
972
|
+
function resolveYamlTimestamp(data) {
|
|
973
|
+
if (data === null) return false;
|
|
974
|
+
if (YAML_DATE_REGEXP.exec(data) !== null) return true;
|
|
975
|
+
if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true;
|
|
976
|
+
return false;
|
|
977
|
+
}
|
|
978
|
+
function constructYamlTimestamp(data) {
|
|
979
|
+
var match, year, month, day, hour, minute, second, fraction = 0, delta = null, tz_hour, tz_minute, date;
|
|
980
|
+
match = YAML_DATE_REGEXP.exec(data);
|
|
981
|
+
if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data);
|
|
982
|
+
if (match === null) throw new Error("Date resolve error");
|
|
983
|
+
year = +match[1];
|
|
984
|
+
month = +match[2] - 1;
|
|
985
|
+
day = +match[3];
|
|
986
|
+
if (!match[4]) {
|
|
987
|
+
return new Date(Date.UTC(year, month, day));
|
|
988
|
+
}
|
|
989
|
+
hour = +match[4];
|
|
990
|
+
minute = +match[5];
|
|
991
|
+
second = +match[6];
|
|
992
|
+
if (match[7]) {
|
|
993
|
+
fraction = match[7].slice(0, 3);
|
|
994
|
+
while (fraction.length < 3) {
|
|
995
|
+
fraction += "0";
|
|
996
|
+
}
|
|
997
|
+
fraction = +fraction;
|
|
998
|
+
}
|
|
999
|
+
if (match[9]) {
|
|
1000
|
+
tz_hour = +match[10];
|
|
1001
|
+
tz_minute = +(match[11] || 0);
|
|
1002
|
+
delta = (tz_hour * 60 + tz_minute) * 6e4;
|
|
1003
|
+
if (match[9] === "-") delta = -delta;
|
|
1004
|
+
}
|
|
1005
|
+
date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
|
|
1006
|
+
if (delta) date.setTime(date.getTime() - delta);
|
|
1007
|
+
return date;
|
|
1008
|
+
}
|
|
1009
|
+
function representYamlTimestamp(object) {
|
|
1010
|
+
return object.toISOString();
|
|
1011
|
+
}
|
|
1012
|
+
module2.exports = new Type("tag:yaml.org,2002:timestamp", {
|
|
1013
|
+
kind: "scalar",
|
|
1014
|
+
resolve: resolveYamlTimestamp,
|
|
1015
|
+
construct: constructYamlTimestamp,
|
|
1016
|
+
instanceOf: Date,
|
|
1017
|
+
represent: representYamlTimestamp
|
|
1018
|
+
});
|
|
1019
|
+
}
|
|
1020
|
+
});
|
|
1021
|
+
|
|
1022
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/merge.js
|
|
1023
|
+
var require_merge = __commonJS({
|
|
1024
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/merge.js"(exports2, module2) {
|
|
1025
|
+
"use strict";
|
|
1026
|
+
var Type = require_type();
|
|
1027
|
+
function resolveYamlMerge(data) {
|
|
1028
|
+
return data === "<<" || data === null;
|
|
1029
|
+
}
|
|
1030
|
+
module2.exports = new Type("tag:yaml.org,2002:merge", {
|
|
1031
|
+
kind: "scalar",
|
|
1032
|
+
resolve: resolveYamlMerge
|
|
1033
|
+
});
|
|
1034
|
+
}
|
|
1035
|
+
});
|
|
1036
|
+
|
|
1037
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/binary.js
|
|
1038
|
+
var require_binary = __commonJS({
|
|
1039
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/binary.js"(exports2, module2) {
|
|
1040
|
+
"use strict";
|
|
1041
|
+
var NodeBuffer;
|
|
1042
|
+
try {
|
|
1043
|
+
_require = __require;
|
|
1044
|
+
NodeBuffer = _require("buffer").Buffer;
|
|
1045
|
+
} catch (__) {
|
|
1046
|
+
}
|
|
1047
|
+
var _require;
|
|
1048
|
+
var Type = require_type();
|
|
1049
|
+
var BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";
|
|
1050
|
+
function resolveYamlBinary(data) {
|
|
1051
|
+
if (data === null) return false;
|
|
1052
|
+
var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP;
|
|
1053
|
+
for (idx = 0; idx < max; idx++) {
|
|
1054
|
+
code = map.indexOf(data.charAt(idx));
|
|
1055
|
+
if (code > 64) continue;
|
|
1056
|
+
if (code < 0) return false;
|
|
1057
|
+
bitlen += 6;
|
|
1058
|
+
}
|
|
1059
|
+
return bitlen % 8 === 0;
|
|
1060
|
+
}
|
|
1061
|
+
function constructYamlBinary(data) {
|
|
1062
|
+
var idx, tailbits, input = data.replace(/[\r\n=]/g, ""), max = input.length, map = BASE64_MAP, bits = 0, result = [];
|
|
1063
|
+
for (idx = 0; idx < max; idx++) {
|
|
1064
|
+
if (idx % 4 === 0 && idx) {
|
|
1065
|
+
result.push(bits >> 16 & 255);
|
|
1066
|
+
result.push(bits >> 8 & 255);
|
|
1067
|
+
result.push(bits & 255);
|
|
1068
|
+
}
|
|
1069
|
+
bits = bits << 6 | map.indexOf(input.charAt(idx));
|
|
1070
|
+
}
|
|
1071
|
+
tailbits = max % 4 * 6;
|
|
1072
|
+
if (tailbits === 0) {
|
|
1073
|
+
result.push(bits >> 16 & 255);
|
|
1074
|
+
result.push(bits >> 8 & 255);
|
|
1075
|
+
result.push(bits & 255);
|
|
1076
|
+
} else if (tailbits === 18) {
|
|
1077
|
+
result.push(bits >> 10 & 255);
|
|
1078
|
+
result.push(bits >> 2 & 255);
|
|
1079
|
+
} else if (tailbits === 12) {
|
|
1080
|
+
result.push(bits >> 4 & 255);
|
|
1081
|
+
}
|
|
1082
|
+
if (NodeBuffer) {
|
|
1083
|
+
return NodeBuffer.from ? NodeBuffer.from(result) : new NodeBuffer(result);
|
|
1084
|
+
}
|
|
1085
|
+
return result;
|
|
1086
|
+
}
|
|
1087
|
+
function representYamlBinary(object) {
|
|
1088
|
+
var result = "", bits = 0, idx, tail, max = object.length, map = BASE64_MAP;
|
|
1089
|
+
for (idx = 0; idx < max; idx++) {
|
|
1090
|
+
if (idx % 3 === 0 && idx) {
|
|
1091
|
+
result += map[bits >> 18 & 63];
|
|
1092
|
+
result += map[bits >> 12 & 63];
|
|
1093
|
+
result += map[bits >> 6 & 63];
|
|
1094
|
+
result += map[bits & 63];
|
|
1095
|
+
}
|
|
1096
|
+
bits = (bits << 8) + object[idx];
|
|
1097
|
+
}
|
|
1098
|
+
tail = max % 3;
|
|
1099
|
+
if (tail === 0) {
|
|
1100
|
+
result += map[bits >> 18 & 63];
|
|
1101
|
+
result += map[bits >> 12 & 63];
|
|
1102
|
+
result += map[bits >> 6 & 63];
|
|
1103
|
+
result += map[bits & 63];
|
|
1104
|
+
} else if (tail === 2) {
|
|
1105
|
+
result += map[bits >> 10 & 63];
|
|
1106
|
+
result += map[bits >> 4 & 63];
|
|
1107
|
+
result += map[bits << 2 & 63];
|
|
1108
|
+
result += map[64];
|
|
1109
|
+
} else if (tail === 1) {
|
|
1110
|
+
result += map[bits >> 2 & 63];
|
|
1111
|
+
result += map[bits << 4 & 63];
|
|
1112
|
+
result += map[64];
|
|
1113
|
+
result += map[64];
|
|
1114
|
+
}
|
|
1115
|
+
return result;
|
|
1116
|
+
}
|
|
1117
|
+
function isBinary(object) {
|
|
1118
|
+
return NodeBuffer && NodeBuffer.isBuffer(object);
|
|
1119
|
+
}
|
|
1120
|
+
module2.exports = new Type("tag:yaml.org,2002:binary", {
|
|
1121
|
+
kind: "scalar",
|
|
1122
|
+
resolve: resolveYamlBinary,
|
|
1123
|
+
construct: constructYamlBinary,
|
|
1124
|
+
predicate: isBinary,
|
|
1125
|
+
represent: representYamlBinary
|
|
1126
|
+
});
|
|
1127
|
+
}
|
|
1128
|
+
});
|
|
1129
|
+
|
|
1130
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/omap.js
|
|
1131
|
+
var require_omap = __commonJS({
|
|
1132
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/omap.js"(exports2, module2) {
|
|
1133
|
+
"use strict";
|
|
1134
|
+
var Type = require_type();
|
|
1135
|
+
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
1136
|
+
var _toString = Object.prototype.toString;
|
|
1137
|
+
function resolveYamlOmap(data) {
|
|
1138
|
+
if (data === null) return true;
|
|
1139
|
+
var objectKeys = [], index, length, pair, pairKey, pairHasKey, object = data;
|
|
1140
|
+
for (index = 0, length = object.length; index < length; index += 1) {
|
|
1141
|
+
pair = object[index];
|
|
1142
|
+
pairHasKey = false;
|
|
1143
|
+
if (_toString.call(pair) !== "[object Object]") return false;
|
|
1144
|
+
for (pairKey in pair) {
|
|
1145
|
+
if (_hasOwnProperty.call(pair, pairKey)) {
|
|
1146
|
+
if (!pairHasKey) pairHasKey = true;
|
|
1147
|
+
else return false;
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
if (!pairHasKey) return false;
|
|
1151
|
+
if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);
|
|
1152
|
+
else return false;
|
|
1153
|
+
}
|
|
1154
|
+
return true;
|
|
1155
|
+
}
|
|
1156
|
+
function constructYamlOmap(data) {
|
|
1157
|
+
return data !== null ? data : [];
|
|
1158
|
+
}
|
|
1159
|
+
module2.exports = new Type("tag:yaml.org,2002:omap", {
|
|
1160
|
+
kind: "sequence",
|
|
1161
|
+
resolve: resolveYamlOmap,
|
|
1162
|
+
construct: constructYamlOmap
|
|
1163
|
+
});
|
|
1164
|
+
}
|
|
1165
|
+
});
|
|
1166
|
+
|
|
1167
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/pairs.js
|
|
1168
|
+
var require_pairs = __commonJS({
|
|
1169
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/pairs.js"(exports2, module2) {
|
|
1170
|
+
"use strict";
|
|
1171
|
+
var Type = require_type();
|
|
1172
|
+
var _toString = Object.prototype.toString;
|
|
1173
|
+
function resolveYamlPairs(data) {
|
|
1174
|
+
if (data === null) return true;
|
|
1175
|
+
var index, length, pair, keys, result, object = data;
|
|
1176
|
+
result = new Array(object.length);
|
|
1177
|
+
for (index = 0, length = object.length; index < length; index += 1) {
|
|
1178
|
+
pair = object[index];
|
|
1179
|
+
if (_toString.call(pair) !== "[object Object]") return false;
|
|
1180
|
+
keys = Object.keys(pair);
|
|
1181
|
+
if (keys.length !== 1) return false;
|
|
1182
|
+
result[index] = [keys[0], pair[keys[0]]];
|
|
1183
|
+
}
|
|
1184
|
+
return true;
|
|
1185
|
+
}
|
|
1186
|
+
function constructYamlPairs(data) {
|
|
1187
|
+
if (data === null) return [];
|
|
1188
|
+
var index, length, pair, keys, result, object = data;
|
|
1189
|
+
result = new Array(object.length);
|
|
1190
|
+
for (index = 0, length = object.length; index < length; index += 1) {
|
|
1191
|
+
pair = object[index];
|
|
1192
|
+
keys = Object.keys(pair);
|
|
1193
|
+
result[index] = [keys[0], pair[keys[0]]];
|
|
1194
|
+
}
|
|
1195
|
+
return result;
|
|
1196
|
+
}
|
|
1197
|
+
module2.exports = new Type("tag:yaml.org,2002:pairs", {
|
|
1198
|
+
kind: "sequence",
|
|
1199
|
+
resolve: resolveYamlPairs,
|
|
1200
|
+
construct: constructYamlPairs
|
|
1201
|
+
});
|
|
1202
|
+
}
|
|
1203
|
+
});
|
|
1204
|
+
|
|
1205
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/set.js
|
|
1206
|
+
var require_set = __commonJS({
|
|
1207
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/set.js"(exports2, module2) {
|
|
1208
|
+
"use strict";
|
|
1209
|
+
var Type = require_type();
|
|
1210
|
+
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
1211
|
+
function resolveYamlSet(data) {
|
|
1212
|
+
if (data === null) return true;
|
|
1213
|
+
var key, object = data;
|
|
1214
|
+
for (key in object) {
|
|
1215
|
+
if (_hasOwnProperty.call(object, key)) {
|
|
1216
|
+
if (object[key] !== null) return false;
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
return true;
|
|
1220
|
+
}
|
|
1221
|
+
function constructYamlSet(data) {
|
|
1222
|
+
return data !== null ? data : {};
|
|
1223
|
+
}
|
|
1224
|
+
module2.exports = new Type("tag:yaml.org,2002:set", {
|
|
1225
|
+
kind: "mapping",
|
|
1226
|
+
resolve: resolveYamlSet,
|
|
1227
|
+
construct: constructYamlSet
|
|
1228
|
+
});
|
|
1229
|
+
}
|
|
1230
|
+
});
|
|
1231
|
+
|
|
1232
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js
|
|
1233
|
+
var require_default_safe = __commonJS({
|
|
1234
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js"(exports2, module2) {
|
|
1235
|
+
"use strict";
|
|
1236
|
+
var Schema = require_schema();
|
|
1237
|
+
module2.exports = new Schema({
|
|
1238
|
+
include: [
|
|
1239
|
+
require_core()
|
|
1240
|
+
],
|
|
1241
|
+
implicit: [
|
|
1242
|
+
require_timestamp(),
|
|
1243
|
+
require_merge()
|
|
1244
|
+
],
|
|
1245
|
+
explicit: [
|
|
1246
|
+
require_binary(),
|
|
1247
|
+
require_omap(),
|
|
1248
|
+
require_pairs(),
|
|
1249
|
+
require_set()
|
|
1250
|
+
]
|
|
1251
|
+
});
|
|
1252
|
+
}
|
|
1253
|
+
});
|
|
1254
|
+
|
|
1255
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js
|
|
1256
|
+
var require_undefined = __commonJS({
|
|
1257
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js"(exports2, module2) {
|
|
1258
|
+
"use strict";
|
|
1259
|
+
var Type = require_type();
|
|
1260
|
+
function resolveJavascriptUndefined() {
|
|
1261
|
+
return true;
|
|
1262
|
+
}
|
|
1263
|
+
function constructJavascriptUndefined() {
|
|
1264
|
+
return void 0;
|
|
1265
|
+
}
|
|
1266
|
+
function representJavascriptUndefined() {
|
|
1267
|
+
return "";
|
|
1268
|
+
}
|
|
1269
|
+
function isUndefined(object) {
|
|
1270
|
+
return typeof object === "undefined";
|
|
1271
|
+
}
|
|
1272
|
+
module2.exports = new Type("tag:yaml.org,2002:js/undefined", {
|
|
1273
|
+
kind: "scalar",
|
|
1274
|
+
resolve: resolveJavascriptUndefined,
|
|
1275
|
+
construct: constructJavascriptUndefined,
|
|
1276
|
+
predicate: isUndefined,
|
|
1277
|
+
represent: representJavascriptUndefined
|
|
1278
|
+
});
|
|
1279
|
+
}
|
|
1280
|
+
});
|
|
1281
|
+
|
|
1282
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js
|
|
1283
|
+
var require_regexp = __commonJS({
|
|
1284
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js"(exports2, module2) {
|
|
1285
|
+
"use strict";
|
|
1286
|
+
var Type = require_type();
|
|
1287
|
+
function resolveJavascriptRegExp(data) {
|
|
1288
|
+
if (data === null) return false;
|
|
1289
|
+
if (data.length === 0) return false;
|
|
1290
|
+
var regexp = data, tail = /\/([gim]*)$/.exec(data), modifiers = "";
|
|
1291
|
+
if (regexp[0] === "/") {
|
|
1292
|
+
if (tail) modifiers = tail[1];
|
|
1293
|
+
if (modifiers.length > 3) return false;
|
|
1294
|
+
if (regexp[regexp.length - modifiers.length - 1] !== "/") return false;
|
|
1295
|
+
}
|
|
1296
|
+
return true;
|
|
1297
|
+
}
|
|
1298
|
+
function constructJavascriptRegExp(data) {
|
|
1299
|
+
var regexp = data, tail = /\/([gim]*)$/.exec(data), modifiers = "";
|
|
1300
|
+
if (regexp[0] === "/") {
|
|
1301
|
+
if (tail) modifiers = tail[1];
|
|
1302
|
+
regexp = regexp.slice(1, regexp.length - modifiers.length - 1);
|
|
1303
|
+
}
|
|
1304
|
+
return new RegExp(regexp, modifiers);
|
|
1305
|
+
}
|
|
1306
|
+
function representJavascriptRegExp(object) {
|
|
1307
|
+
var result = "/" + object.source + "/";
|
|
1308
|
+
if (object.global) result += "g";
|
|
1309
|
+
if (object.multiline) result += "m";
|
|
1310
|
+
if (object.ignoreCase) result += "i";
|
|
1311
|
+
return result;
|
|
1312
|
+
}
|
|
1313
|
+
function isRegExp(object) {
|
|
1314
|
+
return Object.prototype.toString.call(object) === "[object RegExp]";
|
|
1315
|
+
}
|
|
1316
|
+
module2.exports = new Type("tag:yaml.org,2002:js/regexp", {
|
|
1317
|
+
kind: "scalar",
|
|
1318
|
+
resolve: resolveJavascriptRegExp,
|
|
1319
|
+
construct: constructJavascriptRegExp,
|
|
1320
|
+
predicate: isRegExp,
|
|
1321
|
+
represent: representJavascriptRegExp
|
|
1322
|
+
});
|
|
1323
|
+
}
|
|
1324
|
+
});
|
|
1325
|
+
|
|
1326
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/js/function.js
|
|
1327
|
+
var require_function = __commonJS({
|
|
1328
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/type/js/function.js"(exports2, module2) {
|
|
1329
|
+
"use strict";
|
|
1330
|
+
var esprima;
|
|
1331
|
+
try {
|
|
1332
|
+
_require = __require;
|
|
1333
|
+
esprima = _require("esprima");
|
|
1334
|
+
} catch (_) {
|
|
1335
|
+
if (typeof window !== "undefined") esprima = window.esprima;
|
|
1336
|
+
}
|
|
1337
|
+
var _require;
|
|
1338
|
+
var Type = require_type();
|
|
1339
|
+
function resolveJavascriptFunction(data) {
|
|
1340
|
+
if (data === null) return false;
|
|
1341
|
+
try {
|
|
1342
|
+
var source = "(" + data + ")", ast = esprima.parse(source, { range: true });
|
|
1343
|
+
if (ast.type !== "Program" || ast.body.length !== 1 || ast.body[0].type !== "ExpressionStatement" || ast.body[0].expression.type !== "ArrowFunctionExpression" && ast.body[0].expression.type !== "FunctionExpression") {
|
|
1344
|
+
return false;
|
|
1345
|
+
}
|
|
1346
|
+
return true;
|
|
1347
|
+
} catch (err) {
|
|
1348
|
+
return false;
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1351
|
+
function constructJavascriptFunction(data) {
|
|
1352
|
+
var source = "(" + data + ")", ast = esprima.parse(source, { range: true }), params = [], body;
|
|
1353
|
+
if (ast.type !== "Program" || ast.body.length !== 1 || ast.body[0].type !== "ExpressionStatement" || ast.body[0].expression.type !== "ArrowFunctionExpression" && ast.body[0].expression.type !== "FunctionExpression") {
|
|
1354
|
+
throw new Error("Failed to resolve function");
|
|
1355
|
+
}
|
|
1356
|
+
ast.body[0].expression.params.forEach(function(param) {
|
|
1357
|
+
params.push(param.name);
|
|
1358
|
+
});
|
|
1359
|
+
body = ast.body[0].expression.body.range;
|
|
1360
|
+
if (ast.body[0].expression.body.type === "BlockStatement") {
|
|
1361
|
+
return new Function(params, source.slice(body[0] + 1, body[1] - 1));
|
|
1362
|
+
}
|
|
1363
|
+
return new Function(params, "return " + source.slice(body[0], body[1]));
|
|
1364
|
+
}
|
|
1365
|
+
function representJavascriptFunction(object) {
|
|
1366
|
+
return object.toString();
|
|
1367
|
+
}
|
|
1368
|
+
function isFunction(object) {
|
|
1369
|
+
return Object.prototype.toString.call(object) === "[object Function]";
|
|
1370
|
+
}
|
|
1371
|
+
module2.exports = new Type("tag:yaml.org,2002:js/function", {
|
|
1372
|
+
kind: "scalar",
|
|
1373
|
+
resolve: resolveJavascriptFunction,
|
|
1374
|
+
construct: constructJavascriptFunction,
|
|
1375
|
+
predicate: isFunction,
|
|
1376
|
+
represent: representJavascriptFunction
|
|
1377
|
+
});
|
|
1378
|
+
}
|
|
1379
|
+
});
|
|
1380
|
+
|
|
1381
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/schema/default_full.js
|
|
1382
|
+
var require_default_full = __commonJS({
|
|
1383
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/schema/default_full.js"(exports2, module2) {
|
|
1384
|
+
"use strict";
|
|
1385
|
+
var Schema = require_schema();
|
|
1386
|
+
module2.exports = Schema.DEFAULT = new Schema({
|
|
1387
|
+
include: [
|
|
1388
|
+
require_default_safe()
|
|
1389
|
+
],
|
|
1390
|
+
explicit: [
|
|
1391
|
+
require_undefined(),
|
|
1392
|
+
require_regexp(),
|
|
1393
|
+
require_function()
|
|
1394
|
+
]
|
|
1395
|
+
});
|
|
1396
|
+
}
|
|
1397
|
+
});
|
|
1398
|
+
|
|
1399
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/loader.js
|
|
1400
|
+
var require_loader = __commonJS({
|
|
1401
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/loader.js"(exports2, module2) {
|
|
1402
|
+
"use strict";
|
|
1403
|
+
var common = require_common();
|
|
1404
|
+
var YAMLException = require_exception();
|
|
1405
|
+
var Mark = require_mark();
|
|
1406
|
+
var DEFAULT_SAFE_SCHEMA = require_default_safe();
|
|
1407
|
+
var DEFAULT_FULL_SCHEMA = require_default_full();
|
|
1408
|
+
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
1409
|
+
var CONTEXT_FLOW_IN = 1;
|
|
1410
|
+
var CONTEXT_FLOW_OUT = 2;
|
|
1411
|
+
var CONTEXT_BLOCK_IN = 3;
|
|
1412
|
+
var CONTEXT_BLOCK_OUT = 4;
|
|
1413
|
+
var CHOMPING_CLIP = 1;
|
|
1414
|
+
var CHOMPING_STRIP = 2;
|
|
1415
|
+
var CHOMPING_KEEP = 3;
|
|
1416
|
+
var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
|
|
1417
|
+
var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
|
|
1418
|
+
var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
|
|
1419
|
+
var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
|
|
1420
|
+
var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
|
|
1421
|
+
function _class(obj) {
|
|
1422
|
+
return Object.prototype.toString.call(obj);
|
|
1423
|
+
}
|
|
1424
|
+
function is_EOL(c) {
|
|
1425
|
+
return c === 10 || c === 13;
|
|
1426
|
+
}
|
|
1427
|
+
function is_WHITE_SPACE(c) {
|
|
1428
|
+
return c === 9 || c === 32;
|
|
1429
|
+
}
|
|
1430
|
+
function is_WS_OR_EOL(c) {
|
|
1431
|
+
return c === 9 || c === 32 || c === 10 || c === 13;
|
|
1432
|
+
}
|
|
1433
|
+
function is_FLOW_INDICATOR(c) {
|
|
1434
|
+
return c === 44 || c === 91 || c === 93 || c === 123 || c === 125;
|
|
1435
|
+
}
|
|
1436
|
+
function fromHexCode(c) {
|
|
1437
|
+
var lc;
|
|
1438
|
+
if (48 <= c && c <= 57) {
|
|
1439
|
+
return c - 48;
|
|
1440
|
+
}
|
|
1441
|
+
lc = c | 32;
|
|
1442
|
+
if (97 <= lc && lc <= 102) {
|
|
1443
|
+
return lc - 97 + 10;
|
|
1444
|
+
}
|
|
1445
|
+
return -1;
|
|
1446
|
+
}
|
|
1447
|
+
function escapedHexLen(c) {
|
|
1448
|
+
if (c === 120) {
|
|
1449
|
+
return 2;
|
|
1450
|
+
}
|
|
1451
|
+
if (c === 117) {
|
|
1452
|
+
return 4;
|
|
1453
|
+
}
|
|
1454
|
+
if (c === 85) {
|
|
1455
|
+
return 8;
|
|
1456
|
+
}
|
|
1457
|
+
return 0;
|
|
1458
|
+
}
|
|
1459
|
+
function fromDecimalCode(c) {
|
|
1460
|
+
if (48 <= c && c <= 57) {
|
|
1461
|
+
return c - 48;
|
|
1462
|
+
}
|
|
1463
|
+
return -1;
|
|
1464
|
+
}
|
|
1465
|
+
function simpleEscapeSequence(c) {
|
|
1466
|
+
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" : "";
|
|
1467
|
+
}
|
|
1468
|
+
function charFromCodepoint(c) {
|
|
1469
|
+
if (c <= 65535) {
|
|
1470
|
+
return String.fromCharCode(c);
|
|
1471
|
+
}
|
|
1472
|
+
return String.fromCharCode(
|
|
1473
|
+
(c - 65536 >> 10) + 55296,
|
|
1474
|
+
(c - 65536 & 1023) + 56320
|
|
1475
|
+
);
|
|
1476
|
+
}
|
|
1477
|
+
function setProperty(object, key, value) {
|
|
1478
|
+
if (key === "__proto__") {
|
|
1479
|
+
Object.defineProperty(object, key, {
|
|
1480
|
+
configurable: true,
|
|
1481
|
+
enumerable: true,
|
|
1482
|
+
writable: true,
|
|
1483
|
+
value
|
|
1484
|
+
});
|
|
1485
|
+
} else {
|
|
1486
|
+
object[key] = value;
|
|
1487
|
+
}
|
|
1488
|
+
}
|
|
1489
|
+
var simpleEscapeCheck = new Array(256);
|
|
1490
|
+
var simpleEscapeMap = new Array(256);
|
|
1491
|
+
for (i = 0; i < 256; i++) {
|
|
1492
|
+
simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
|
|
1493
|
+
simpleEscapeMap[i] = simpleEscapeSequence(i);
|
|
1494
|
+
}
|
|
1495
|
+
var i;
|
|
1496
|
+
function State(input, options2) {
|
|
1497
|
+
this.input = input;
|
|
1498
|
+
this.filename = options2["filename"] || null;
|
|
1499
|
+
this.schema = options2["schema"] || DEFAULT_FULL_SCHEMA;
|
|
1500
|
+
this.onWarning = options2["onWarning"] || null;
|
|
1501
|
+
this.legacy = options2["legacy"] || false;
|
|
1502
|
+
this.json = options2["json"] || false;
|
|
1503
|
+
this.listener = options2["listener"] || null;
|
|
1504
|
+
this.implicitTypes = this.schema.compiledImplicit;
|
|
1505
|
+
this.typeMap = this.schema.compiledTypeMap;
|
|
1506
|
+
this.length = input.length;
|
|
1507
|
+
this.position = 0;
|
|
1508
|
+
this.line = 0;
|
|
1509
|
+
this.lineStart = 0;
|
|
1510
|
+
this.lineIndent = 0;
|
|
1511
|
+
this.documents = [];
|
|
1512
|
+
}
|
|
1513
|
+
function generateError(state, message) {
|
|
1514
|
+
return new YAMLException(
|
|
1515
|
+
message,
|
|
1516
|
+
new Mark(state.filename, state.input, state.position, state.line, state.position - state.lineStart)
|
|
1517
|
+
);
|
|
1518
|
+
}
|
|
1519
|
+
function throwError(state, message) {
|
|
1520
|
+
throw generateError(state, message);
|
|
1521
|
+
}
|
|
1522
|
+
function throwWarning(state, message) {
|
|
1523
|
+
if (state.onWarning) {
|
|
1524
|
+
state.onWarning.call(null, generateError(state, message));
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1527
|
+
var directiveHandlers = {
|
|
1528
|
+
YAML: function handleYamlDirective(state, name, args) {
|
|
1529
|
+
var match, major, minor;
|
|
1530
|
+
if (state.version !== null) {
|
|
1531
|
+
throwError(state, "duplication of %YAML directive");
|
|
1532
|
+
}
|
|
1533
|
+
if (args.length !== 1) {
|
|
1534
|
+
throwError(state, "YAML directive accepts exactly one argument");
|
|
1535
|
+
}
|
|
1536
|
+
match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
|
|
1537
|
+
if (match === null) {
|
|
1538
|
+
throwError(state, "ill-formed argument of the YAML directive");
|
|
1539
|
+
}
|
|
1540
|
+
major = parseInt(match[1], 10);
|
|
1541
|
+
minor = parseInt(match[2], 10);
|
|
1542
|
+
if (major !== 1) {
|
|
1543
|
+
throwError(state, "unacceptable YAML version of the document");
|
|
1544
|
+
}
|
|
1545
|
+
state.version = args[0];
|
|
1546
|
+
state.checkLineBreaks = minor < 2;
|
|
1547
|
+
if (minor !== 1 && minor !== 2) {
|
|
1548
|
+
throwWarning(state, "unsupported YAML version of the document");
|
|
1549
|
+
}
|
|
1550
|
+
},
|
|
1551
|
+
TAG: function handleTagDirective(state, name, args) {
|
|
1552
|
+
var handle, prefix;
|
|
1553
|
+
if (args.length !== 2) {
|
|
1554
|
+
throwError(state, "TAG directive accepts exactly two arguments");
|
|
1555
|
+
}
|
|
1556
|
+
handle = args[0];
|
|
1557
|
+
prefix = args[1];
|
|
1558
|
+
if (!PATTERN_TAG_HANDLE.test(handle)) {
|
|
1559
|
+
throwError(state, "ill-formed tag handle (first argument) of the TAG directive");
|
|
1560
|
+
}
|
|
1561
|
+
if (_hasOwnProperty.call(state.tagMap, handle)) {
|
|
1562
|
+
throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
|
|
1563
|
+
}
|
|
1564
|
+
if (!PATTERN_TAG_URI.test(prefix)) {
|
|
1565
|
+
throwError(state, "ill-formed tag prefix (second argument) of the TAG directive");
|
|
1566
|
+
}
|
|
1567
|
+
state.tagMap[handle] = prefix;
|
|
1568
|
+
}
|
|
1569
|
+
};
|
|
1570
|
+
function captureSegment(state, start, end, checkJson) {
|
|
1571
|
+
var _position, _length, _character, _result;
|
|
1572
|
+
if (start < end) {
|
|
1573
|
+
_result = state.input.slice(start, end);
|
|
1574
|
+
if (checkJson) {
|
|
1575
|
+
for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
|
|
1576
|
+
_character = _result.charCodeAt(_position);
|
|
1577
|
+
if (!(_character === 9 || 32 <= _character && _character <= 1114111)) {
|
|
1578
|
+
throwError(state, "expected valid JSON character");
|
|
1579
|
+
}
|
|
1580
|
+
}
|
|
1581
|
+
} else if (PATTERN_NON_PRINTABLE.test(_result)) {
|
|
1582
|
+
throwError(state, "the stream contains non-printable characters");
|
|
1583
|
+
}
|
|
1584
|
+
state.result += _result;
|
|
1585
|
+
}
|
|
1586
|
+
}
|
|
1587
|
+
function mergeMappings(state, destination, source, overridableKeys) {
|
|
1588
|
+
var sourceKeys, key, index, quantity;
|
|
1589
|
+
if (!common.isObject(source)) {
|
|
1590
|
+
throwError(state, "cannot merge mappings; the provided source object is unacceptable");
|
|
1591
|
+
}
|
|
1592
|
+
sourceKeys = Object.keys(source);
|
|
1593
|
+
for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
|
|
1594
|
+
key = sourceKeys[index];
|
|
1595
|
+
if (!_hasOwnProperty.call(destination, key)) {
|
|
1596
|
+
setProperty(destination, key, source[key]);
|
|
1597
|
+
overridableKeys[key] = true;
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
}
|
|
1601
|
+
function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startPos) {
|
|
1602
|
+
var index, quantity;
|
|
1603
|
+
if (Array.isArray(keyNode)) {
|
|
1604
|
+
keyNode = Array.prototype.slice.call(keyNode);
|
|
1605
|
+
for (index = 0, quantity = keyNode.length; index < quantity; index += 1) {
|
|
1606
|
+
if (Array.isArray(keyNode[index])) {
|
|
1607
|
+
throwError(state, "nested arrays are not supported inside keys");
|
|
1608
|
+
}
|
|
1609
|
+
if (typeof keyNode === "object" && _class(keyNode[index]) === "[object Object]") {
|
|
1610
|
+
keyNode[index] = "[object Object]";
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
}
|
|
1614
|
+
if (typeof keyNode === "object" && _class(keyNode) === "[object Object]") {
|
|
1615
|
+
keyNode = "[object Object]";
|
|
1616
|
+
}
|
|
1617
|
+
keyNode = String(keyNode);
|
|
1618
|
+
if (_result === null) {
|
|
1619
|
+
_result = {};
|
|
1620
|
+
}
|
|
1621
|
+
if (keyTag === "tag:yaml.org,2002:merge") {
|
|
1622
|
+
if (Array.isArray(valueNode)) {
|
|
1623
|
+
for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
|
|
1624
|
+
mergeMappings(state, _result, valueNode[index], overridableKeys);
|
|
1625
|
+
}
|
|
1626
|
+
} else {
|
|
1627
|
+
mergeMappings(state, _result, valueNode, overridableKeys);
|
|
1628
|
+
}
|
|
1629
|
+
} else {
|
|
1630
|
+
if (!state.json && !_hasOwnProperty.call(overridableKeys, keyNode) && _hasOwnProperty.call(_result, keyNode)) {
|
|
1631
|
+
state.line = startLine || state.line;
|
|
1632
|
+
state.position = startPos || state.position;
|
|
1633
|
+
throwError(state, "duplicated mapping key");
|
|
1634
|
+
}
|
|
1635
|
+
setProperty(_result, keyNode, valueNode);
|
|
1636
|
+
delete overridableKeys[keyNode];
|
|
1637
|
+
}
|
|
1638
|
+
return _result;
|
|
1639
|
+
}
|
|
1640
|
+
function readLineBreak(state) {
|
|
1641
|
+
var ch;
|
|
1642
|
+
ch = state.input.charCodeAt(state.position);
|
|
1643
|
+
if (ch === 10) {
|
|
1644
|
+
state.position++;
|
|
1645
|
+
} else if (ch === 13) {
|
|
1646
|
+
state.position++;
|
|
1647
|
+
if (state.input.charCodeAt(state.position) === 10) {
|
|
1648
|
+
state.position++;
|
|
1649
|
+
}
|
|
1650
|
+
} else {
|
|
1651
|
+
throwError(state, "a line break is expected");
|
|
1652
|
+
}
|
|
1653
|
+
state.line += 1;
|
|
1654
|
+
state.lineStart = state.position;
|
|
1655
|
+
}
|
|
1656
|
+
function skipSeparationSpace(state, allowComments, checkIndent) {
|
|
1657
|
+
var lineBreaks = 0, ch = state.input.charCodeAt(state.position);
|
|
1658
|
+
while (ch !== 0) {
|
|
1659
|
+
while (is_WHITE_SPACE(ch)) {
|
|
1660
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1661
|
+
}
|
|
1662
|
+
if (allowComments && ch === 35) {
|
|
1663
|
+
do {
|
|
1664
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1665
|
+
} while (ch !== 10 && ch !== 13 && ch !== 0);
|
|
1666
|
+
}
|
|
1667
|
+
if (is_EOL(ch)) {
|
|
1668
|
+
readLineBreak(state);
|
|
1669
|
+
ch = state.input.charCodeAt(state.position);
|
|
1670
|
+
lineBreaks++;
|
|
1671
|
+
state.lineIndent = 0;
|
|
1672
|
+
while (ch === 32) {
|
|
1673
|
+
state.lineIndent++;
|
|
1674
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1675
|
+
}
|
|
1676
|
+
} else {
|
|
1677
|
+
break;
|
|
1678
|
+
}
|
|
1679
|
+
}
|
|
1680
|
+
if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {
|
|
1681
|
+
throwWarning(state, "deficient indentation");
|
|
1682
|
+
}
|
|
1683
|
+
return lineBreaks;
|
|
1684
|
+
}
|
|
1685
|
+
function testDocumentSeparator(state) {
|
|
1686
|
+
var _position = state.position, ch;
|
|
1687
|
+
ch = state.input.charCodeAt(_position);
|
|
1688
|
+
if ((ch === 45 || ch === 46) && ch === state.input.charCodeAt(_position + 1) && ch === state.input.charCodeAt(_position + 2)) {
|
|
1689
|
+
_position += 3;
|
|
1690
|
+
ch = state.input.charCodeAt(_position);
|
|
1691
|
+
if (ch === 0 || is_WS_OR_EOL(ch)) {
|
|
1692
|
+
return true;
|
|
1693
|
+
}
|
|
1694
|
+
}
|
|
1695
|
+
return false;
|
|
1696
|
+
}
|
|
1697
|
+
function writeFoldedLines(state, count) {
|
|
1698
|
+
if (count === 1) {
|
|
1699
|
+
state.result += " ";
|
|
1700
|
+
} else if (count > 1) {
|
|
1701
|
+
state.result += common.repeat("\n", count - 1);
|
|
1702
|
+
}
|
|
1703
|
+
}
|
|
1704
|
+
function readPlainScalar(state, nodeIndent, withinFlowCollection) {
|
|
1705
|
+
var preceding, following, captureStart, captureEnd, hasPendingContent, _line, _lineStart, _lineIndent, _kind = state.kind, _result = state.result, ch;
|
|
1706
|
+
ch = state.input.charCodeAt(state.position);
|
|
1707
|
+
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) {
|
|
1708
|
+
return false;
|
|
1709
|
+
}
|
|
1710
|
+
if (ch === 63 || ch === 45) {
|
|
1711
|
+
following = state.input.charCodeAt(state.position + 1);
|
|
1712
|
+
if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
|
|
1713
|
+
return false;
|
|
1714
|
+
}
|
|
1715
|
+
}
|
|
1716
|
+
state.kind = "scalar";
|
|
1717
|
+
state.result = "";
|
|
1718
|
+
captureStart = captureEnd = state.position;
|
|
1719
|
+
hasPendingContent = false;
|
|
1720
|
+
while (ch !== 0) {
|
|
1721
|
+
if (ch === 58) {
|
|
1722
|
+
following = state.input.charCodeAt(state.position + 1);
|
|
1723
|
+
if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
|
|
1724
|
+
break;
|
|
1725
|
+
}
|
|
1726
|
+
} else if (ch === 35) {
|
|
1727
|
+
preceding = state.input.charCodeAt(state.position - 1);
|
|
1728
|
+
if (is_WS_OR_EOL(preceding)) {
|
|
1729
|
+
break;
|
|
1730
|
+
}
|
|
1731
|
+
} else if (state.position === state.lineStart && testDocumentSeparator(state) || withinFlowCollection && is_FLOW_INDICATOR(ch)) {
|
|
1732
|
+
break;
|
|
1733
|
+
} else if (is_EOL(ch)) {
|
|
1734
|
+
_line = state.line;
|
|
1735
|
+
_lineStart = state.lineStart;
|
|
1736
|
+
_lineIndent = state.lineIndent;
|
|
1737
|
+
skipSeparationSpace(state, false, -1);
|
|
1738
|
+
if (state.lineIndent >= nodeIndent) {
|
|
1739
|
+
hasPendingContent = true;
|
|
1740
|
+
ch = state.input.charCodeAt(state.position);
|
|
1741
|
+
continue;
|
|
1742
|
+
} else {
|
|
1743
|
+
state.position = captureEnd;
|
|
1744
|
+
state.line = _line;
|
|
1745
|
+
state.lineStart = _lineStart;
|
|
1746
|
+
state.lineIndent = _lineIndent;
|
|
1747
|
+
break;
|
|
1748
|
+
}
|
|
1749
|
+
}
|
|
1750
|
+
if (hasPendingContent) {
|
|
1751
|
+
captureSegment(state, captureStart, captureEnd, false);
|
|
1752
|
+
writeFoldedLines(state, state.line - _line);
|
|
1753
|
+
captureStart = captureEnd = state.position;
|
|
1754
|
+
hasPendingContent = false;
|
|
1755
|
+
}
|
|
1756
|
+
if (!is_WHITE_SPACE(ch)) {
|
|
1757
|
+
captureEnd = state.position + 1;
|
|
1758
|
+
}
|
|
1759
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1760
|
+
}
|
|
1761
|
+
captureSegment(state, captureStart, captureEnd, false);
|
|
1762
|
+
if (state.result) {
|
|
1763
|
+
return true;
|
|
1764
|
+
}
|
|
1765
|
+
state.kind = _kind;
|
|
1766
|
+
state.result = _result;
|
|
1767
|
+
return false;
|
|
1768
|
+
}
|
|
1769
|
+
function readSingleQuotedScalar(state, nodeIndent) {
|
|
1770
|
+
var ch, captureStart, captureEnd;
|
|
1771
|
+
ch = state.input.charCodeAt(state.position);
|
|
1772
|
+
if (ch !== 39) {
|
|
1773
|
+
return false;
|
|
1774
|
+
}
|
|
1775
|
+
state.kind = "scalar";
|
|
1776
|
+
state.result = "";
|
|
1777
|
+
state.position++;
|
|
1778
|
+
captureStart = captureEnd = state.position;
|
|
1779
|
+
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
1780
|
+
if (ch === 39) {
|
|
1781
|
+
captureSegment(state, captureStart, state.position, true);
|
|
1782
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1783
|
+
if (ch === 39) {
|
|
1784
|
+
captureStart = state.position;
|
|
1785
|
+
state.position++;
|
|
1786
|
+
captureEnd = state.position;
|
|
1787
|
+
} else {
|
|
1788
|
+
return true;
|
|
1789
|
+
}
|
|
1790
|
+
} else if (is_EOL(ch)) {
|
|
1791
|
+
captureSegment(state, captureStart, captureEnd, true);
|
|
1792
|
+
writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
|
|
1793
|
+
captureStart = captureEnd = state.position;
|
|
1794
|
+
} else if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
1795
|
+
throwError(state, "unexpected end of the document within a single quoted scalar");
|
|
1796
|
+
} else {
|
|
1797
|
+
state.position++;
|
|
1798
|
+
captureEnd = state.position;
|
|
1799
|
+
}
|
|
1800
|
+
}
|
|
1801
|
+
throwError(state, "unexpected end of the stream within a single quoted scalar");
|
|
1802
|
+
}
|
|
1803
|
+
function readDoubleQuotedScalar(state, nodeIndent) {
|
|
1804
|
+
var captureStart, captureEnd, hexLength, hexResult, tmp, ch;
|
|
1805
|
+
ch = state.input.charCodeAt(state.position);
|
|
1806
|
+
if (ch !== 34) {
|
|
1807
|
+
return false;
|
|
1808
|
+
}
|
|
1809
|
+
state.kind = "scalar";
|
|
1810
|
+
state.result = "";
|
|
1811
|
+
state.position++;
|
|
1812
|
+
captureStart = captureEnd = state.position;
|
|
1813
|
+
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
1814
|
+
if (ch === 34) {
|
|
1815
|
+
captureSegment(state, captureStart, state.position, true);
|
|
1816
|
+
state.position++;
|
|
1817
|
+
return true;
|
|
1818
|
+
} else if (ch === 92) {
|
|
1819
|
+
captureSegment(state, captureStart, state.position, true);
|
|
1820
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1821
|
+
if (is_EOL(ch)) {
|
|
1822
|
+
skipSeparationSpace(state, false, nodeIndent);
|
|
1823
|
+
} else if (ch < 256 && simpleEscapeCheck[ch]) {
|
|
1824
|
+
state.result += simpleEscapeMap[ch];
|
|
1825
|
+
state.position++;
|
|
1826
|
+
} else if ((tmp = escapedHexLen(ch)) > 0) {
|
|
1827
|
+
hexLength = tmp;
|
|
1828
|
+
hexResult = 0;
|
|
1829
|
+
for (; hexLength > 0; hexLength--) {
|
|
1830
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1831
|
+
if ((tmp = fromHexCode(ch)) >= 0) {
|
|
1832
|
+
hexResult = (hexResult << 4) + tmp;
|
|
1833
|
+
} else {
|
|
1834
|
+
throwError(state, "expected hexadecimal character");
|
|
1835
|
+
}
|
|
1836
|
+
}
|
|
1837
|
+
state.result += charFromCodepoint(hexResult);
|
|
1838
|
+
state.position++;
|
|
1839
|
+
} else {
|
|
1840
|
+
throwError(state, "unknown escape sequence");
|
|
1841
|
+
}
|
|
1842
|
+
captureStart = captureEnd = state.position;
|
|
1843
|
+
} else if (is_EOL(ch)) {
|
|
1844
|
+
captureSegment(state, captureStart, captureEnd, true);
|
|
1845
|
+
writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
|
|
1846
|
+
captureStart = captureEnd = state.position;
|
|
1847
|
+
} else if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
1848
|
+
throwError(state, "unexpected end of the document within a double quoted scalar");
|
|
1849
|
+
} else {
|
|
1850
|
+
state.position++;
|
|
1851
|
+
captureEnd = state.position;
|
|
1852
|
+
}
|
|
1853
|
+
}
|
|
1854
|
+
throwError(state, "unexpected end of the stream within a double quoted scalar");
|
|
1855
|
+
}
|
|
1856
|
+
function readFlowCollection(state, nodeIndent) {
|
|
1857
|
+
var readNext = true, _line, _tag = state.tag, _result, _anchor = state.anchor, following, terminator, isPair, isExplicitPair, isMapping, overridableKeys = {}, keyNode, keyTag, valueNode, ch;
|
|
1858
|
+
ch = state.input.charCodeAt(state.position);
|
|
1859
|
+
if (ch === 91) {
|
|
1860
|
+
terminator = 93;
|
|
1861
|
+
isMapping = false;
|
|
1862
|
+
_result = [];
|
|
1863
|
+
} else if (ch === 123) {
|
|
1864
|
+
terminator = 125;
|
|
1865
|
+
isMapping = true;
|
|
1866
|
+
_result = {};
|
|
1867
|
+
} else {
|
|
1868
|
+
return false;
|
|
1869
|
+
}
|
|
1870
|
+
if (state.anchor !== null) {
|
|
1871
|
+
state.anchorMap[state.anchor] = _result;
|
|
1872
|
+
}
|
|
1873
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1874
|
+
while (ch !== 0) {
|
|
1875
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
1876
|
+
ch = state.input.charCodeAt(state.position);
|
|
1877
|
+
if (ch === terminator) {
|
|
1878
|
+
state.position++;
|
|
1879
|
+
state.tag = _tag;
|
|
1880
|
+
state.anchor = _anchor;
|
|
1881
|
+
state.kind = isMapping ? "mapping" : "sequence";
|
|
1882
|
+
state.result = _result;
|
|
1883
|
+
return true;
|
|
1884
|
+
} else if (!readNext) {
|
|
1885
|
+
throwError(state, "missed comma between flow collection entries");
|
|
1886
|
+
}
|
|
1887
|
+
keyTag = keyNode = valueNode = null;
|
|
1888
|
+
isPair = isExplicitPair = false;
|
|
1889
|
+
if (ch === 63) {
|
|
1890
|
+
following = state.input.charCodeAt(state.position + 1);
|
|
1891
|
+
if (is_WS_OR_EOL(following)) {
|
|
1892
|
+
isPair = isExplicitPair = true;
|
|
1893
|
+
state.position++;
|
|
1894
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
1895
|
+
}
|
|
1896
|
+
}
|
|
1897
|
+
_line = state.line;
|
|
1898
|
+
composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
|
1899
|
+
keyTag = state.tag;
|
|
1900
|
+
keyNode = state.result;
|
|
1901
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
1902
|
+
ch = state.input.charCodeAt(state.position);
|
|
1903
|
+
if ((isExplicitPair || state.line === _line) && ch === 58) {
|
|
1904
|
+
isPair = true;
|
|
1905
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1906
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
1907
|
+
composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
|
1908
|
+
valueNode = state.result;
|
|
1909
|
+
}
|
|
1910
|
+
if (isMapping) {
|
|
1911
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode);
|
|
1912
|
+
} else if (isPair) {
|
|
1913
|
+
_result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode));
|
|
1914
|
+
} else {
|
|
1915
|
+
_result.push(keyNode);
|
|
1916
|
+
}
|
|
1917
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
1918
|
+
ch = state.input.charCodeAt(state.position);
|
|
1919
|
+
if (ch === 44) {
|
|
1920
|
+
readNext = true;
|
|
1921
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1922
|
+
} else {
|
|
1923
|
+
readNext = false;
|
|
1924
|
+
}
|
|
1925
|
+
}
|
|
1926
|
+
throwError(state, "unexpected end of the stream within a flow collection");
|
|
1927
|
+
}
|
|
1928
|
+
function readBlockScalar(state, nodeIndent) {
|
|
1929
|
+
var captureStart, folding, chomping = CHOMPING_CLIP, didReadContent = false, detectedIndent = false, textIndent = nodeIndent, emptyLines = 0, atMoreIndented = false, tmp, ch;
|
|
1930
|
+
ch = state.input.charCodeAt(state.position);
|
|
1931
|
+
if (ch === 124) {
|
|
1932
|
+
folding = false;
|
|
1933
|
+
} else if (ch === 62) {
|
|
1934
|
+
folding = true;
|
|
1935
|
+
} else {
|
|
1936
|
+
return false;
|
|
1937
|
+
}
|
|
1938
|
+
state.kind = "scalar";
|
|
1939
|
+
state.result = "";
|
|
1940
|
+
while (ch !== 0) {
|
|
1941
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1942
|
+
if (ch === 43 || ch === 45) {
|
|
1943
|
+
if (CHOMPING_CLIP === chomping) {
|
|
1944
|
+
chomping = ch === 43 ? CHOMPING_KEEP : CHOMPING_STRIP;
|
|
1945
|
+
} else {
|
|
1946
|
+
throwError(state, "repeat of a chomping mode identifier");
|
|
1947
|
+
}
|
|
1948
|
+
} else if ((tmp = fromDecimalCode(ch)) >= 0) {
|
|
1949
|
+
if (tmp === 0) {
|
|
1950
|
+
throwError(state, "bad explicit indentation width of a block scalar; it cannot be less than one");
|
|
1951
|
+
} else if (!detectedIndent) {
|
|
1952
|
+
textIndent = nodeIndent + tmp - 1;
|
|
1953
|
+
detectedIndent = true;
|
|
1954
|
+
} else {
|
|
1955
|
+
throwError(state, "repeat of an indentation width identifier");
|
|
1956
|
+
}
|
|
1957
|
+
} else {
|
|
1958
|
+
break;
|
|
1959
|
+
}
|
|
1960
|
+
}
|
|
1961
|
+
if (is_WHITE_SPACE(ch)) {
|
|
1962
|
+
do {
|
|
1963
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1964
|
+
} while (is_WHITE_SPACE(ch));
|
|
1965
|
+
if (ch === 35) {
|
|
1966
|
+
do {
|
|
1967
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1968
|
+
} while (!is_EOL(ch) && ch !== 0);
|
|
1969
|
+
}
|
|
1970
|
+
}
|
|
1971
|
+
while (ch !== 0) {
|
|
1972
|
+
readLineBreak(state);
|
|
1973
|
+
state.lineIndent = 0;
|
|
1974
|
+
ch = state.input.charCodeAt(state.position);
|
|
1975
|
+
while ((!detectedIndent || state.lineIndent < textIndent) && ch === 32) {
|
|
1976
|
+
state.lineIndent++;
|
|
1977
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1978
|
+
}
|
|
1979
|
+
if (!detectedIndent && state.lineIndent > textIndent) {
|
|
1980
|
+
textIndent = state.lineIndent;
|
|
1981
|
+
}
|
|
1982
|
+
if (is_EOL(ch)) {
|
|
1983
|
+
emptyLines++;
|
|
1984
|
+
continue;
|
|
1985
|
+
}
|
|
1986
|
+
if (state.lineIndent < textIndent) {
|
|
1987
|
+
if (chomping === CHOMPING_KEEP) {
|
|
1988
|
+
state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
|
1989
|
+
} else if (chomping === CHOMPING_CLIP) {
|
|
1990
|
+
if (didReadContent) {
|
|
1991
|
+
state.result += "\n";
|
|
1992
|
+
}
|
|
1993
|
+
}
|
|
1994
|
+
break;
|
|
1995
|
+
}
|
|
1996
|
+
if (folding) {
|
|
1997
|
+
if (is_WHITE_SPACE(ch)) {
|
|
1998
|
+
atMoreIndented = true;
|
|
1999
|
+
state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
|
2000
|
+
} else if (atMoreIndented) {
|
|
2001
|
+
atMoreIndented = false;
|
|
2002
|
+
state.result += common.repeat("\n", emptyLines + 1);
|
|
2003
|
+
} else if (emptyLines === 0) {
|
|
2004
|
+
if (didReadContent) {
|
|
2005
|
+
state.result += " ";
|
|
2006
|
+
}
|
|
2007
|
+
} else {
|
|
2008
|
+
state.result += common.repeat("\n", emptyLines);
|
|
2009
|
+
}
|
|
2010
|
+
} else {
|
|
2011
|
+
state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
|
2012
|
+
}
|
|
2013
|
+
didReadContent = true;
|
|
2014
|
+
detectedIndent = true;
|
|
2015
|
+
emptyLines = 0;
|
|
2016
|
+
captureStart = state.position;
|
|
2017
|
+
while (!is_EOL(ch) && ch !== 0) {
|
|
2018
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2019
|
+
}
|
|
2020
|
+
captureSegment(state, captureStart, state.position, false);
|
|
2021
|
+
}
|
|
2022
|
+
return true;
|
|
2023
|
+
}
|
|
2024
|
+
function readBlockSequence(state, nodeIndent) {
|
|
2025
|
+
var _line, _tag = state.tag, _anchor = state.anchor, _result = [], following, detected = false, ch;
|
|
2026
|
+
if (state.anchor !== null) {
|
|
2027
|
+
state.anchorMap[state.anchor] = _result;
|
|
2028
|
+
}
|
|
2029
|
+
ch = state.input.charCodeAt(state.position);
|
|
2030
|
+
while (ch !== 0) {
|
|
2031
|
+
if (ch !== 45) {
|
|
2032
|
+
break;
|
|
2033
|
+
}
|
|
2034
|
+
following = state.input.charCodeAt(state.position + 1);
|
|
2035
|
+
if (!is_WS_OR_EOL(following)) {
|
|
2036
|
+
break;
|
|
2037
|
+
}
|
|
2038
|
+
detected = true;
|
|
2039
|
+
state.position++;
|
|
2040
|
+
if (skipSeparationSpace(state, true, -1)) {
|
|
2041
|
+
if (state.lineIndent <= nodeIndent) {
|
|
2042
|
+
_result.push(null);
|
|
2043
|
+
ch = state.input.charCodeAt(state.position);
|
|
2044
|
+
continue;
|
|
2045
|
+
}
|
|
2046
|
+
}
|
|
2047
|
+
_line = state.line;
|
|
2048
|
+
composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
|
|
2049
|
+
_result.push(state.result);
|
|
2050
|
+
skipSeparationSpace(state, true, -1);
|
|
2051
|
+
ch = state.input.charCodeAt(state.position);
|
|
2052
|
+
if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
|
|
2053
|
+
throwError(state, "bad indentation of a sequence entry");
|
|
2054
|
+
} else if (state.lineIndent < nodeIndent) {
|
|
2055
|
+
break;
|
|
2056
|
+
}
|
|
2057
|
+
}
|
|
2058
|
+
if (detected) {
|
|
2059
|
+
state.tag = _tag;
|
|
2060
|
+
state.anchor = _anchor;
|
|
2061
|
+
state.kind = "sequence";
|
|
2062
|
+
state.result = _result;
|
|
2063
|
+
return true;
|
|
2064
|
+
}
|
|
2065
|
+
return false;
|
|
2066
|
+
}
|
|
2067
|
+
function readBlockMapping(state, nodeIndent, flowIndent) {
|
|
2068
|
+
var following, allowCompact, _line, _pos, _tag = state.tag, _anchor = state.anchor, _result = {}, overridableKeys = {}, keyTag = null, keyNode = null, valueNode = null, atExplicitKey = false, detected = false, ch;
|
|
2069
|
+
if (state.anchor !== null) {
|
|
2070
|
+
state.anchorMap[state.anchor] = _result;
|
|
2071
|
+
}
|
|
2072
|
+
ch = state.input.charCodeAt(state.position);
|
|
2073
|
+
while (ch !== 0) {
|
|
2074
|
+
following = state.input.charCodeAt(state.position + 1);
|
|
2075
|
+
_line = state.line;
|
|
2076
|
+
_pos = state.position;
|
|
2077
|
+
if ((ch === 63 || ch === 58) && is_WS_OR_EOL(following)) {
|
|
2078
|
+
if (ch === 63) {
|
|
2079
|
+
if (atExplicitKey) {
|
|
2080
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
|
|
2081
|
+
keyTag = keyNode = valueNode = null;
|
|
2082
|
+
}
|
|
2083
|
+
detected = true;
|
|
2084
|
+
atExplicitKey = true;
|
|
2085
|
+
allowCompact = true;
|
|
2086
|
+
} else if (atExplicitKey) {
|
|
2087
|
+
atExplicitKey = false;
|
|
2088
|
+
allowCompact = true;
|
|
2089
|
+
} else {
|
|
2090
|
+
throwError(state, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");
|
|
2091
|
+
}
|
|
2092
|
+
state.position += 1;
|
|
2093
|
+
ch = following;
|
|
2094
|
+
} else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
|
|
2095
|
+
if (state.line === _line) {
|
|
2096
|
+
ch = state.input.charCodeAt(state.position);
|
|
2097
|
+
while (is_WHITE_SPACE(ch)) {
|
|
2098
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2099
|
+
}
|
|
2100
|
+
if (ch === 58) {
|
|
2101
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2102
|
+
if (!is_WS_OR_EOL(ch)) {
|
|
2103
|
+
throwError(state, "a whitespace character is expected after the key-value separator within a block mapping");
|
|
2104
|
+
}
|
|
2105
|
+
if (atExplicitKey) {
|
|
2106
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
|
|
2107
|
+
keyTag = keyNode = valueNode = null;
|
|
2108
|
+
}
|
|
2109
|
+
detected = true;
|
|
2110
|
+
atExplicitKey = false;
|
|
2111
|
+
allowCompact = false;
|
|
2112
|
+
keyTag = state.tag;
|
|
2113
|
+
keyNode = state.result;
|
|
2114
|
+
} else if (detected) {
|
|
2115
|
+
throwError(state, "can not read an implicit mapping pair; a colon is missed");
|
|
2116
|
+
} else {
|
|
2117
|
+
state.tag = _tag;
|
|
2118
|
+
state.anchor = _anchor;
|
|
2119
|
+
return true;
|
|
2120
|
+
}
|
|
2121
|
+
} else if (detected) {
|
|
2122
|
+
throwError(state, "can not read a block mapping entry; a multiline key may not be an implicit key");
|
|
2123
|
+
} else {
|
|
2124
|
+
state.tag = _tag;
|
|
2125
|
+
state.anchor = _anchor;
|
|
2126
|
+
return true;
|
|
2127
|
+
}
|
|
2128
|
+
} else {
|
|
2129
|
+
break;
|
|
2130
|
+
}
|
|
2131
|
+
if (state.line === _line || state.lineIndent > nodeIndent) {
|
|
2132
|
+
if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
|
|
2133
|
+
if (atExplicitKey) {
|
|
2134
|
+
keyNode = state.result;
|
|
2135
|
+
} else {
|
|
2136
|
+
valueNode = state.result;
|
|
2137
|
+
}
|
|
2138
|
+
}
|
|
2139
|
+
if (!atExplicitKey) {
|
|
2140
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _pos);
|
|
2141
|
+
keyTag = keyNode = valueNode = null;
|
|
2142
|
+
}
|
|
2143
|
+
skipSeparationSpace(state, true, -1);
|
|
2144
|
+
ch = state.input.charCodeAt(state.position);
|
|
2145
|
+
}
|
|
2146
|
+
if (state.lineIndent > nodeIndent && ch !== 0) {
|
|
2147
|
+
throwError(state, "bad indentation of a mapping entry");
|
|
2148
|
+
} else if (state.lineIndent < nodeIndent) {
|
|
2149
|
+
break;
|
|
2150
|
+
}
|
|
2151
|
+
}
|
|
2152
|
+
if (atExplicitKey) {
|
|
2153
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
|
|
2154
|
+
}
|
|
2155
|
+
if (detected) {
|
|
2156
|
+
state.tag = _tag;
|
|
2157
|
+
state.anchor = _anchor;
|
|
2158
|
+
state.kind = "mapping";
|
|
2159
|
+
state.result = _result;
|
|
2160
|
+
}
|
|
2161
|
+
return detected;
|
|
2162
|
+
}
|
|
2163
|
+
function readTagProperty(state) {
|
|
2164
|
+
var _position, isVerbatim = false, isNamed = false, tagHandle, tagName, ch;
|
|
2165
|
+
ch = state.input.charCodeAt(state.position);
|
|
2166
|
+
if (ch !== 33) return false;
|
|
2167
|
+
if (state.tag !== null) {
|
|
2168
|
+
throwError(state, "duplication of a tag property");
|
|
2169
|
+
}
|
|
2170
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2171
|
+
if (ch === 60) {
|
|
2172
|
+
isVerbatim = true;
|
|
2173
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2174
|
+
} else if (ch === 33) {
|
|
2175
|
+
isNamed = true;
|
|
2176
|
+
tagHandle = "!!";
|
|
2177
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2178
|
+
} else {
|
|
2179
|
+
tagHandle = "!";
|
|
2180
|
+
}
|
|
2181
|
+
_position = state.position;
|
|
2182
|
+
if (isVerbatim) {
|
|
2183
|
+
do {
|
|
2184
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2185
|
+
} while (ch !== 0 && ch !== 62);
|
|
2186
|
+
if (state.position < state.length) {
|
|
2187
|
+
tagName = state.input.slice(_position, state.position);
|
|
2188
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2189
|
+
} else {
|
|
2190
|
+
throwError(state, "unexpected end of the stream within a verbatim tag");
|
|
2191
|
+
}
|
|
2192
|
+
} else {
|
|
2193
|
+
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
|
2194
|
+
if (ch === 33) {
|
|
2195
|
+
if (!isNamed) {
|
|
2196
|
+
tagHandle = state.input.slice(_position - 1, state.position + 1);
|
|
2197
|
+
if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
|
|
2198
|
+
throwError(state, "named tag handle cannot contain such characters");
|
|
2199
|
+
}
|
|
2200
|
+
isNamed = true;
|
|
2201
|
+
_position = state.position + 1;
|
|
2202
|
+
} else {
|
|
2203
|
+
throwError(state, "tag suffix cannot contain exclamation marks");
|
|
2204
|
+
}
|
|
2205
|
+
}
|
|
2206
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2207
|
+
}
|
|
2208
|
+
tagName = state.input.slice(_position, state.position);
|
|
2209
|
+
if (PATTERN_FLOW_INDICATORS.test(tagName)) {
|
|
2210
|
+
throwError(state, "tag suffix cannot contain flow indicator characters");
|
|
2211
|
+
}
|
|
2212
|
+
}
|
|
2213
|
+
if (tagName && !PATTERN_TAG_URI.test(tagName)) {
|
|
2214
|
+
throwError(state, "tag name cannot contain such characters: " + tagName);
|
|
2215
|
+
}
|
|
2216
|
+
if (isVerbatim) {
|
|
2217
|
+
state.tag = tagName;
|
|
2218
|
+
} else if (_hasOwnProperty.call(state.tagMap, tagHandle)) {
|
|
2219
|
+
state.tag = state.tagMap[tagHandle] + tagName;
|
|
2220
|
+
} else if (tagHandle === "!") {
|
|
2221
|
+
state.tag = "!" + tagName;
|
|
2222
|
+
} else if (tagHandle === "!!") {
|
|
2223
|
+
state.tag = "tag:yaml.org,2002:" + tagName;
|
|
2224
|
+
} else {
|
|
2225
|
+
throwError(state, 'undeclared tag handle "' + tagHandle + '"');
|
|
2226
|
+
}
|
|
2227
|
+
return true;
|
|
2228
|
+
}
|
|
2229
|
+
function readAnchorProperty(state) {
|
|
2230
|
+
var _position, ch;
|
|
2231
|
+
ch = state.input.charCodeAt(state.position);
|
|
2232
|
+
if (ch !== 38) return false;
|
|
2233
|
+
if (state.anchor !== null) {
|
|
2234
|
+
throwError(state, "duplication of an anchor property");
|
|
2235
|
+
}
|
|
2236
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2237
|
+
_position = state.position;
|
|
2238
|
+
while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
|
|
2239
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2240
|
+
}
|
|
2241
|
+
if (state.position === _position) {
|
|
2242
|
+
throwError(state, "name of an anchor node must contain at least one character");
|
|
2243
|
+
}
|
|
2244
|
+
state.anchor = state.input.slice(_position, state.position);
|
|
2245
|
+
return true;
|
|
2246
|
+
}
|
|
2247
|
+
function readAlias(state) {
|
|
2248
|
+
var _position, alias, ch;
|
|
2249
|
+
ch = state.input.charCodeAt(state.position);
|
|
2250
|
+
if (ch !== 42) return false;
|
|
2251
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2252
|
+
_position = state.position;
|
|
2253
|
+
while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
|
|
2254
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2255
|
+
}
|
|
2256
|
+
if (state.position === _position) {
|
|
2257
|
+
throwError(state, "name of an alias node must contain at least one character");
|
|
2258
|
+
}
|
|
2259
|
+
alias = state.input.slice(_position, state.position);
|
|
2260
|
+
if (!_hasOwnProperty.call(state.anchorMap, alias)) {
|
|
2261
|
+
throwError(state, 'unidentified alias "' + alias + '"');
|
|
2262
|
+
}
|
|
2263
|
+
state.result = state.anchorMap[alias];
|
|
2264
|
+
skipSeparationSpace(state, true, -1);
|
|
2265
|
+
return true;
|
|
2266
|
+
}
|
|
2267
|
+
function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
|
|
2268
|
+
var allowBlockStyles, allowBlockScalars, allowBlockCollections, indentStatus = 1, atNewLine = false, hasContent = false, typeIndex, typeQuantity, type, flowIndent, blockIndent;
|
|
2269
|
+
if (state.listener !== null) {
|
|
2270
|
+
state.listener("open", state);
|
|
2271
|
+
}
|
|
2272
|
+
state.tag = null;
|
|
2273
|
+
state.anchor = null;
|
|
2274
|
+
state.kind = null;
|
|
2275
|
+
state.result = null;
|
|
2276
|
+
allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext;
|
|
2277
|
+
if (allowToSeek) {
|
|
2278
|
+
if (skipSeparationSpace(state, true, -1)) {
|
|
2279
|
+
atNewLine = true;
|
|
2280
|
+
if (state.lineIndent > parentIndent) {
|
|
2281
|
+
indentStatus = 1;
|
|
2282
|
+
} else if (state.lineIndent === parentIndent) {
|
|
2283
|
+
indentStatus = 0;
|
|
2284
|
+
} else if (state.lineIndent < parentIndent) {
|
|
2285
|
+
indentStatus = -1;
|
|
2286
|
+
}
|
|
2287
|
+
}
|
|
2288
|
+
}
|
|
2289
|
+
if (indentStatus === 1) {
|
|
2290
|
+
while (readTagProperty(state) || readAnchorProperty(state)) {
|
|
2291
|
+
if (skipSeparationSpace(state, true, -1)) {
|
|
2292
|
+
atNewLine = true;
|
|
2293
|
+
allowBlockCollections = allowBlockStyles;
|
|
2294
|
+
if (state.lineIndent > parentIndent) {
|
|
2295
|
+
indentStatus = 1;
|
|
2296
|
+
} else if (state.lineIndent === parentIndent) {
|
|
2297
|
+
indentStatus = 0;
|
|
2298
|
+
} else if (state.lineIndent < parentIndent) {
|
|
2299
|
+
indentStatus = -1;
|
|
2300
|
+
}
|
|
2301
|
+
} else {
|
|
2302
|
+
allowBlockCollections = false;
|
|
2303
|
+
}
|
|
2304
|
+
}
|
|
2305
|
+
}
|
|
2306
|
+
if (allowBlockCollections) {
|
|
2307
|
+
allowBlockCollections = atNewLine || allowCompact;
|
|
2308
|
+
}
|
|
2309
|
+
if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
|
|
2310
|
+
if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
|
|
2311
|
+
flowIndent = parentIndent;
|
|
2312
|
+
} else {
|
|
2313
|
+
flowIndent = parentIndent + 1;
|
|
2314
|
+
}
|
|
2315
|
+
blockIndent = state.position - state.lineStart;
|
|
2316
|
+
if (indentStatus === 1) {
|
|
2317
|
+
if (allowBlockCollections && (readBlockSequence(state, blockIndent) || readBlockMapping(state, blockIndent, flowIndent)) || readFlowCollection(state, flowIndent)) {
|
|
2318
|
+
hasContent = true;
|
|
2319
|
+
} else {
|
|
2320
|
+
if (allowBlockScalars && readBlockScalar(state, flowIndent) || readSingleQuotedScalar(state, flowIndent) || readDoubleQuotedScalar(state, flowIndent)) {
|
|
2321
|
+
hasContent = true;
|
|
2322
|
+
} else if (readAlias(state)) {
|
|
2323
|
+
hasContent = true;
|
|
2324
|
+
if (state.tag !== null || state.anchor !== null) {
|
|
2325
|
+
throwError(state, "alias node should not have any properties");
|
|
2326
|
+
}
|
|
2327
|
+
} else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
|
|
2328
|
+
hasContent = true;
|
|
2329
|
+
if (state.tag === null) {
|
|
2330
|
+
state.tag = "?";
|
|
2331
|
+
}
|
|
2332
|
+
}
|
|
2333
|
+
if (state.anchor !== null) {
|
|
2334
|
+
state.anchorMap[state.anchor] = state.result;
|
|
2335
|
+
}
|
|
2336
|
+
}
|
|
2337
|
+
} else if (indentStatus === 0) {
|
|
2338
|
+
hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
|
|
2339
|
+
}
|
|
2340
|
+
}
|
|
2341
|
+
if (state.tag !== null && state.tag !== "!") {
|
|
2342
|
+
if (state.tag === "?") {
|
|
2343
|
+
if (state.result !== null && state.kind !== "scalar") {
|
|
2344
|
+
throwError(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"');
|
|
2345
|
+
}
|
|
2346
|
+
for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
|
|
2347
|
+
type = state.implicitTypes[typeIndex];
|
|
2348
|
+
if (type.resolve(state.result)) {
|
|
2349
|
+
state.result = type.construct(state.result);
|
|
2350
|
+
state.tag = type.tag;
|
|
2351
|
+
if (state.anchor !== null) {
|
|
2352
|
+
state.anchorMap[state.anchor] = state.result;
|
|
2353
|
+
}
|
|
2354
|
+
break;
|
|
2355
|
+
}
|
|
2356
|
+
}
|
|
2357
|
+
} else if (_hasOwnProperty.call(state.typeMap[state.kind || "fallback"], state.tag)) {
|
|
2358
|
+
type = state.typeMap[state.kind || "fallback"][state.tag];
|
|
2359
|
+
if (state.result !== null && type.kind !== state.kind) {
|
|
2360
|
+
throwError(state, "unacceptable node kind for !<" + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"');
|
|
2361
|
+
}
|
|
2362
|
+
if (!type.resolve(state.result)) {
|
|
2363
|
+
throwError(state, "cannot resolve a node with !<" + state.tag + "> explicit tag");
|
|
2364
|
+
} else {
|
|
2365
|
+
state.result = type.construct(state.result);
|
|
2366
|
+
if (state.anchor !== null) {
|
|
2367
|
+
state.anchorMap[state.anchor] = state.result;
|
|
2368
|
+
}
|
|
2369
|
+
}
|
|
2370
|
+
} else {
|
|
2371
|
+
throwError(state, "unknown tag !<" + state.tag + ">");
|
|
2372
|
+
}
|
|
2373
|
+
}
|
|
2374
|
+
if (state.listener !== null) {
|
|
2375
|
+
state.listener("close", state);
|
|
2376
|
+
}
|
|
2377
|
+
return state.tag !== null || state.anchor !== null || hasContent;
|
|
2378
|
+
}
|
|
2379
|
+
function readDocument(state) {
|
|
2380
|
+
var documentStart = state.position, _position, directiveName, directiveArgs, hasDirectives = false, ch;
|
|
2381
|
+
state.version = null;
|
|
2382
|
+
state.checkLineBreaks = state.legacy;
|
|
2383
|
+
state.tagMap = {};
|
|
2384
|
+
state.anchorMap = {};
|
|
2385
|
+
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
2386
|
+
skipSeparationSpace(state, true, -1);
|
|
2387
|
+
ch = state.input.charCodeAt(state.position);
|
|
2388
|
+
if (state.lineIndent > 0 || ch !== 37) {
|
|
2389
|
+
break;
|
|
2390
|
+
}
|
|
2391
|
+
hasDirectives = true;
|
|
2392
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2393
|
+
_position = state.position;
|
|
2394
|
+
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
|
2395
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2396
|
+
}
|
|
2397
|
+
directiveName = state.input.slice(_position, state.position);
|
|
2398
|
+
directiveArgs = [];
|
|
2399
|
+
if (directiveName.length < 1) {
|
|
2400
|
+
throwError(state, "directive name must not be less than one character in length");
|
|
2401
|
+
}
|
|
2402
|
+
while (ch !== 0) {
|
|
2403
|
+
while (is_WHITE_SPACE(ch)) {
|
|
2404
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2405
|
+
}
|
|
2406
|
+
if (ch === 35) {
|
|
2407
|
+
do {
|
|
2408
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2409
|
+
} while (ch !== 0 && !is_EOL(ch));
|
|
2410
|
+
break;
|
|
2411
|
+
}
|
|
2412
|
+
if (is_EOL(ch)) break;
|
|
2413
|
+
_position = state.position;
|
|
2414
|
+
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
|
2415
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2416
|
+
}
|
|
2417
|
+
directiveArgs.push(state.input.slice(_position, state.position));
|
|
2418
|
+
}
|
|
2419
|
+
if (ch !== 0) readLineBreak(state);
|
|
2420
|
+
if (_hasOwnProperty.call(directiveHandlers, directiveName)) {
|
|
2421
|
+
directiveHandlers[directiveName](state, directiveName, directiveArgs);
|
|
2422
|
+
} else {
|
|
2423
|
+
throwWarning(state, 'unknown document directive "' + directiveName + '"');
|
|
2424
|
+
}
|
|
2425
|
+
}
|
|
2426
|
+
skipSeparationSpace(state, true, -1);
|
|
2427
|
+
if (state.lineIndent === 0 && state.input.charCodeAt(state.position) === 45 && state.input.charCodeAt(state.position + 1) === 45 && state.input.charCodeAt(state.position + 2) === 45) {
|
|
2428
|
+
state.position += 3;
|
|
2429
|
+
skipSeparationSpace(state, true, -1);
|
|
2430
|
+
} else if (hasDirectives) {
|
|
2431
|
+
throwError(state, "directives end mark is expected");
|
|
2432
|
+
}
|
|
2433
|
+
composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
|
|
2434
|
+
skipSeparationSpace(state, true, -1);
|
|
2435
|
+
if (state.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
|
|
2436
|
+
throwWarning(state, "non-ASCII line breaks are interpreted as content");
|
|
2437
|
+
}
|
|
2438
|
+
state.documents.push(state.result);
|
|
2439
|
+
if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
2440
|
+
if (state.input.charCodeAt(state.position) === 46) {
|
|
2441
|
+
state.position += 3;
|
|
2442
|
+
skipSeparationSpace(state, true, -1);
|
|
2443
|
+
}
|
|
2444
|
+
return;
|
|
2445
|
+
}
|
|
2446
|
+
if (state.position < state.length - 1) {
|
|
2447
|
+
throwError(state, "end of the stream or a document separator is expected");
|
|
2448
|
+
} else {
|
|
2449
|
+
return;
|
|
2450
|
+
}
|
|
2451
|
+
}
|
|
2452
|
+
function loadDocuments(input, options2) {
|
|
2453
|
+
input = String(input);
|
|
2454
|
+
options2 = options2 || {};
|
|
2455
|
+
if (input.length !== 0) {
|
|
2456
|
+
if (input.charCodeAt(input.length - 1) !== 10 && input.charCodeAt(input.length - 1) !== 13) {
|
|
2457
|
+
input += "\n";
|
|
2458
|
+
}
|
|
2459
|
+
if (input.charCodeAt(0) === 65279) {
|
|
2460
|
+
input = input.slice(1);
|
|
2461
|
+
}
|
|
2462
|
+
}
|
|
2463
|
+
var state = new State(input, options2);
|
|
2464
|
+
var nullpos = input.indexOf("\0");
|
|
2465
|
+
if (nullpos !== -1) {
|
|
2466
|
+
state.position = nullpos;
|
|
2467
|
+
throwError(state, "null byte is not allowed in input");
|
|
2468
|
+
}
|
|
2469
|
+
state.input += "\0";
|
|
2470
|
+
while (state.input.charCodeAt(state.position) === 32) {
|
|
2471
|
+
state.lineIndent += 1;
|
|
2472
|
+
state.position += 1;
|
|
2473
|
+
}
|
|
2474
|
+
while (state.position < state.length - 1) {
|
|
2475
|
+
readDocument(state);
|
|
2476
|
+
}
|
|
2477
|
+
return state.documents;
|
|
2478
|
+
}
|
|
2479
|
+
function loadAll(input, iterator, options2) {
|
|
2480
|
+
if (iterator !== null && typeof iterator === "object" && typeof options2 === "undefined") {
|
|
2481
|
+
options2 = iterator;
|
|
2482
|
+
iterator = null;
|
|
2483
|
+
}
|
|
2484
|
+
var documents = loadDocuments(input, options2);
|
|
2485
|
+
if (typeof iterator !== "function") {
|
|
2486
|
+
return documents;
|
|
2487
|
+
}
|
|
2488
|
+
for (var index = 0, length = documents.length; index < length; index += 1) {
|
|
2489
|
+
iterator(documents[index]);
|
|
2490
|
+
}
|
|
2491
|
+
}
|
|
2492
|
+
function load(input, options2) {
|
|
2493
|
+
var documents = loadDocuments(input, options2);
|
|
2494
|
+
if (documents.length === 0) {
|
|
2495
|
+
return void 0;
|
|
2496
|
+
} else if (documents.length === 1) {
|
|
2497
|
+
return documents[0];
|
|
2498
|
+
}
|
|
2499
|
+
throw new YAMLException("expected a single document in the stream, but found more");
|
|
2500
|
+
}
|
|
2501
|
+
function safeLoadAll(input, iterator, options2) {
|
|
2502
|
+
if (typeof iterator === "object" && iterator !== null && typeof options2 === "undefined") {
|
|
2503
|
+
options2 = iterator;
|
|
2504
|
+
iterator = null;
|
|
2505
|
+
}
|
|
2506
|
+
return loadAll(input, iterator, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options2));
|
|
2507
|
+
}
|
|
2508
|
+
function safeLoad(input, options2) {
|
|
2509
|
+
return load(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options2));
|
|
2510
|
+
}
|
|
2511
|
+
module2.exports.loadAll = loadAll;
|
|
2512
|
+
module2.exports.load = load;
|
|
2513
|
+
module2.exports.safeLoadAll = safeLoadAll;
|
|
2514
|
+
module2.exports.safeLoad = safeLoad;
|
|
2515
|
+
}
|
|
2516
|
+
});
|
|
2517
|
+
|
|
2518
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/dumper.js
|
|
2519
|
+
var require_dumper = __commonJS({
|
|
2520
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml/dumper.js"(exports2, module2) {
|
|
2521
|
+
"use strict";
|
|
2522
|
+
var common = require_common();
|
|
2523
|
+
var YAMLException = require_exception();
|
|
2524
|
+
var DEFAULT_FULL_SCHEMA = require_default_full();
|
|
2525
|
+
var DEFAULT_SAFE_SCHEMA = require_default_safe();
|
|
2526
|
+
var _toString = Object.prototype.toString;
|
|
2527
|
+
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
2528
|
+
var CHAR_TAB = 9;
|
|
2529
|
+
var CHAR_LINE_FEED = 10;
|
|
2530
|
+
var CHAR_CARRIAGE_RETURN = 13;
|
|
2531
|
+
var CHAR_SPACE = 32;
|
|
2532
|
+
var CHAR_EXCLAMATION = 33;
|
|
2533
|
+
var CHAR_DOUBLE_QUOTE = 34;
|
|
2534
|
+
var CHAR_SHARP = 35;
|
|
2535
|
+
var CHAR_PERCENT = 37;
|
|
2536
|
+
var CHAR_AMPERSAND = 38;
|
|
2537
|
+
var CHAR_SINGLE_QUOTE = 39;
|
|
2538
|
+
var CHAR_ASTERISK = 42;
|
|
2539
|
+
var CHAR_COMMA = 44;
|
|
2540
|
+
var CHAR_MINUS = 45;
|
|
2541
|
+
var CHAR_COLON = 58;
|
|
2542
|
+
var CHAR_EQUALS = 61;
|
|
2543
|
+
var CHAR_GREATER_THAN = 62;
|
|
2544
|
+
var CHAR_QUESTION = 63;
|
|
2545
|
+
var CHAR_COMMERCIAL_AT = 64;
|
|
2546
|
+
var CHAR_LEFT_SQUARE_BRACKET = 91;
|
|
2547
|
+
var CHAR_RIGHT_SQUARE_BRACKET = 93;
|
|
2548
|
+
var CHAR_GRAVE_ACCENT = 96;
|
|
2549
|
+
var CHAR_LEFT_CURLY_BRACKET = 123;
|
|
2550
|
+
var CHAR_VERTICAL_LINE = 124;
|
|
2551
|
+
var CHAR_RIGHT_CURLY_BRACKET = 125;
|
|
2552
|
+
var ESCAPE_SEQUENCES = {};
|
|
2553
|
+
ESCAPE_SEQUENCES[0] = "\\0";
|
|
2554
|
+
ESCAPE_SEQUENCES[7] = "\\a";
|
|
2555
|
+
ESCAPE_SEQUENCES[8] = "\\b";
|
|
2556
|
+
ESCAPE_SEQUENCES[9] = "\\t";
|
|
2557
|
+
ESCAPE_SEQUENCES[10] = "\\n";
|
|
2558
|
+
ESCAPE_SEQUENCES[11] = "\\v";
|
|
2559
|
+
ESCAPE_SEQUENCES[12] = "\\f";
|
|
2560
|
+
ESCAPE_SEQUENCES[13] = "\\r";
|
|
2561
|
+
ESCAPE_SEQUENCES[27] = "\\e";
|
|
2562
|
+
ESCAPE_SEQUENCES[34] = '\\"';
|
|
2563
|
+
ESCAPE_SEQUENCES[92] = "\\\\";
|
|
2564
|
+
ESCAPE_SEQUENCES[133] = "\\N";
|
|
2565
|
+
ESCAPE_SEQUENCES[160] = "\\_";
|
|
2566
|
+
ESCAPE_SEQUENCES[8232] = "\\L";
|
|
2567
|
+
ESCAPE_SEQUENCES[8233] = "\\P";
|
|
2568
|
+
var DEPRECATED_BOOLEANS_SYNTAX = [
|
|
2569
|
+
"y",
|
|
2570
|
+
"Y",
|
|
2571
|
+
"yes",
|
|
2572
|
+
"Yes",
|
|
2573
|
+
"YES",
|
|
2574
|
+
"on",
|
|
2575
|
+
"On",
|
|
2576
|
+
"ON",
|
|
2577
|
+
"n",
|
|
2578
|
+
"N",
|
|
2579
|
+
"no",
|
|
2580
|
+
"No",
|
|
2581
|
+
"NO",
|
|
2582
|
+
"off",
|
|
2583
|
+
"Off",
|
|
2584
|
+
"OFF"
|
|
2585
|
+
];
|
|
2586
|
+
function compileStyleMap(schema, map) {
|
|
2587
|
+
var result, keys, index, length, tag, style, type;
|
|
2588
|
+
if (map === null) return {};
|
|
2589
|
+
result = {};
|
|
2590
|
+
keys = Object.keys(map);
|
|
2591
|
+
for (index = 0, length = keys.length; index < length; index += 1) {
|
|
2592
|
+
tag = keys[index];
|
|
2593
|
+
style = String(map[tag]);
|
|
2594
|
+
if (tag.slice(0, 2) === "!!") {
|
|
2595
|
+
tag = "tag:yaml.org,2002:" + tag.slice(2);
|
|
2596
|
+
}
|
|
2597
|
+
type = schema.compiledTypeMap["fallback"][tag];
|
|
2598
|
+
if (type && _hasOwnProperty.call(type.styleAliases, style)) {
|
|
2599
|
+
style = type.styleAliases[style];
|
|
2600
|
+
}
|
|
2601
|
+
result[tag] = style;
|
|
2602
|
+
}
|
|
2603
|
+
return result;
|
|
2604
|
+
}
|
|
2605
|
+
function encodeHex(character) {
|
|
2606
|
+
var string, handle, length;
|
|
2607
|
+
string = character.toString(16).toUpperCase();
|
|
2608
|
+
if (character <= 255) {
|
|
2609
|
+
handle = "x";
|
|
2610
|
+
length = 2;
|
|
2611
|
+
} else if (character <= 65535) {
|
|
2612
|
+
handle = "u";
|
|
2613
|
+
length = 4;
|
|
2614
|
+
} else if (character <= 4294967295) {
|
|
2615
|
+
handle = "U";
|
|
2616
|
+
length = 8;
|
|
2617
|
+
} else {
|
|
2618
|
+
throw new YAMLException("code point within a string may not be greater than 0xFFFFFFFF");
|
|
2619
|
+
}
|
|
2620
|
+
return "\\" + handle + common.repeat("0", length - string.length) + string;
|
|
2621
|
+
}
|
|
2622
|
+
function State(options2) {
|
|
2623
|
+
this.schema = options2["schema"] || DEFAULT_FULL_SCHEMA;
|
|
2624
|
+
this.indent = Math.max(1, options2["indent"] || 2);
|
|
2625
|
+
this.noArrayIndent = options2["noArrayIndent"] || false;
|
|
2626
|
+
this.skipInvalid = options2["skipInvalid"] || false;
|
|
2627
|
+
this.flowLevel = common.isNothing(options2["flowLevel"]) ? -1 : options2["flowLevel"];
|
|
2628
|
+
this.styleMap = compileStyleMap(this.schema, options2["styles"] || null);
|
|
2629
|
+
this.sortKeys = options2["sortKeys"] || false;
|
|
2630
|
+
this.lineWidth = options2["lineWidth"] || 80;
|
|
2631
|
+
this.noRefs = options2["noRefs"] || false;
|
|
2632
|
+
this.noCompatMode = options2["noCompatMode"] || false;
|
|
2633
|
+
this.condenseFlow = options2["condenseFlow"] || false;
|
|
2634
|
+
this.implicitTypes = this.schema.compiledImplicit;
|
|
2635
|
+
this.explicitTypes = this.schema.compiledExplicit;
|
|
2636
|
+
this.tag = null;
|
|
2637
|
+
this.result = "";
|
|
2638
|
+
this.duplicates = [];
|
|
2639
|
+
this.usedDuplicates = null;
|
|
2640
|
+
}
|
|
2641
|
+
function indentString(string, spaces) {
|
|
2642
|
+
var ind = common.repeat(" ", spaces), position = 0, next = -1, result = "", line, length = string.length;
|
|
2643
|
+
while (position < length) {
|
|
2644
|
+
next = string.indexOf("\n", position);
|
|
2645
|
+
if (next === -1) {
|
|
2646
|
+
line = string.slice(position);
|
|
2647
|
+
position = length;
|
|
2648
|
+
} else {
|
|
2649
|
+
line = string.slice(position, next + 1);
|
|
2650
|
+
position = next + 1;
|
|
2651
|
+
}
|
|
2652
|
+
if (line.length && line !== "\n") result += ind;
|
|
2653
|
+
result += line;
|
|
2654
|
+
}
|
|
2655
|
+
return result;
|
|
2656
|
+
}
|
|
2657
|
+
function generateNextLine(state, level) {
|
|
2658
|
+
return "\n" + common.repeat(" ", state.indent * level);
|
|
2659
|
+
}
|
|
2660
|
+
function testImplicitResolving(state, str2) {
|
|
2661
|
+
var index, length, type;
|
|
2662
|
+
for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {
|
|
2663
|
+
type = state.implicitTypes[index];
|
|
2664
|
+
if (type.resolve(str2)) {
|
|
2665
|
+
return true;
|
|
2666
|
+
}
|
|
2667
|
+
}
|
|
2668
|
+
return false;
|
|
2669
|
+
}
|
|
2670
|
+
function isWhitespace(c) {
|
|
2671
|
+
return c === CHAR_SPACE || c === CHAR_TAB;
|
|
2672
|
+
}
|
|
2673
|
+
function isPrintable(c) {
|
|
2674
|
+
return 32 <= c && c <= 126 || 161 <= c && c <= 55295 && c !== 8232 && c !== 8233 || 57344 <= c && c <= 65533 && c !== 65279 || 65536 <= c && c <= 1114111;
|
|
2675
|
+
}
|
|
2676
|
+
function isNsChar(c) {
|
|
2677
|
+
return isPrintable(c) && !isWhitespace(c) && c !== 65279 && c !== CHAR_CARRIAGE_RETURN && c !== CHAR_LINE_FEED;
|
|
2678
|
+
}
|
|
2679
|
+
function isPlainSafe(c, prev) {
|
|
2680
|
+
return isPrintable(c) && c !== 65279 && 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_COLON && (c !== CHAR_SHARP || prev && isNsChar(prev));
|
|
2681
|
+
}
|
|
2682
|
+
function isPlainSafeFirst(c) {
|
|
2683
|
+
return isPrintable(c) && c !== 65279 && !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;
|
|
2684
|
+
}
|
|
2685
|
+
function needIndentIndicator(string) {
|
|
2686
|
+
var leadingSpaceRe = /^\n* /;
|
|
2687
|
+
return leadingSpaceRe.test(string);
|
|
2688
|
+
}
|
|
2689
|
+
var STYLE_PLAIN = 1;
|
|
2690
|
+
var STYLE_SINGLE = 2;
|
|
2691
|
+
var STYLE_LITERAL = 3;
|
|
2692
|
+
var STYLE_FOLDED = 4;
|
|
2693
|
+
var STYLE_DOUBLE = 5;
|
|
2694
|
+
function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType) {
|
|
2695
|
+
var i;
|
|
2696
|
+
var char, prev_char;
|
|
2697
|
+
var hasLineBreak = false;
|
|
2698
|
+
var hasFoldableLine = false;
|
|
2699
|
+
var shouldTrackWidth = lineWidth !== -1;
|
|
2700
|
+
var previousLineBreak = -1;
|
|
2701
|
+
var plain = isPlainSafeFirst(string.charCodeAt(0)) && !isWhitespace(string.charCodeAt(string.length - 1));
|
|
2702
|
+
if (singleLineOnly) {
|
|
2703
|
+
for (i = 0; i < string.length; i++) {
|
|
2704
|
+
char = string.charCodeAt(i);
|
|
2705
|
+
if (!isPrintable(char)) {
|
|
2706
|
+
return STYLE_DOUBLE;
|
|
2707
|
+
}
|
|
2708
|
+
prev_char = i > 0 ? string.charCodeAt(i - 1) : null;
|
|
2709
|
+
plain = plain && isPlainSafe(char, prev_char);
|
|
2710
|
+
}
|
|
2711
|
+
} else {
|
|
2712
|
+
for (i = 0; i < string.length; i++) {
|
|
2713
|
+
char = string.charCodeAt(i);
|
|
2714
|
+
if (char === CHAR_LINE_FEED) {
|
|
2715
|
+
hasLineBreak = true;
|
|
2716
|
+
if (shouldTrackWidth) {
|
|
2717
|
+
hasFoldableLine = hasFoldableLine || // Foldable line = too long, and not more-indented.
|
|
2718
|
+
i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ";
|
|
2719
|
+
previousLineBreak = i;
|
|
2720
|
+
}
|
|
2721
|
+
} else if (!isPrintable(char)) {
|
|
2722
|
+
return STYLE_DOUBLE;
|
|
2723
|
+
}
|
|
2724
|
+
prev_char = i > 0 ? string.charCodeAt(i - 1) : null;
|
|
2725
|
+
plain = plain && isPlainSafe(char, prev_char);
|
|
2726
|
+
}
|
|
2727
|
+
hasFoldableLine = hasFoldableLine || shouldTrackWidth && (i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ");
|
|
2728
|
+
}
|
|
2729
|
+
if (!hasLineBreak && !hasFoldableLine) {
|
|
2730
|
+
return plain && !testAmbiguousType(string) ? STYLE_PLAIN : STYLE_SINGLE;
|
|
2731
|
+
}
|
|
2732
|
+
if (indentPerLevel > 9 && needIndentIndicator(string)) {
|
|
2733
|
+
return STYLE_DOUBLE;
|
|
2734
|
+
}
|
|
2735
|
+
return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
|
|
2736
|
+
}
|
|
2737
|
+
function writeScalar(state, string, level, iskey) {
|
|
2738
|
+
state.dump = (function() {
|
|
2739
|
+
if (string.length === 0) {
|
|
2740
|
+
return "''";
|
|
2741
|
+
}
|
|
2742
|
+
if (!state.noCompatMode && DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1) {
|
|
2743
|
+
return "'" + string + "'";
|
|
2744
|
+
}
|
|
2745
|
+
var indent = state.indent * Math.max(1, level);
|
|
2746
|
+
var lineWidth = state.lineWidth === -1 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
|
|
2747
|
+
var singleLineOnly = iskey || state.flowLevel > -1 && level >= state.flowLevel;
|
|
2748
|
+
function testAmbiguity(string2) {
|
|
2749
|
+
return testImplicitResolving(state, string2);
|
|
2750
|
+
}
|
|
2751
|
+
switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity)) {
|
|
2752
|
+
case STYLE_PLAIN:
|
|
2753
|
+
return string;
|
|
2754
|
+
case STYLE_SINGLE:
|
|
2755
|
+
return "'" + string.replace(/'/g, "''") + "'";
|
|
2756
|
+
case STYLE_LITERAL:
|
|
2757
|
+
return "|" + blockHeader(string, state.indent) + dropEndingNewline(indentString(string, indent));
|
|
2758
|
+
case STYLE_FOLDED:
|
|
2759
|
+
return ">" + blockHeader(string, state.indent) + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
|
|
2760
|
+
case STYLE_DOUBLE:
|
|
2761
|
+
return '"' + escapeString(string, lineWidth) + '"';
|
|
2762
|
+
default:
|
|
2763
|
+
throw new YAMLException("impossible error: invalid scalar style");
|
|
2764
|
+
}
|
|
2765
|
+
})();
|
|
2766
|
+
}
|
|
2767
|
+
function blockHeader(string, indentPerLevel) {
|
|
2768
|
+
var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : "";
|
|
2769
|
+
var clip = string[string.length - 1] === "\n";
|
|
2770
|
+
var keep = clip && (string[string.length - 2] === "\n" || string === "\n");
|
|
2771
|
+
var chomp = keep ? "+" : clip ? "" : "-";
|
|
2772
|
+
return indentIndicator + chomp + "\n";
|
|
2773
|
+
}
|
|
2774
|
+
function dropEndingNewline(string) {
|
|
2775
|
+
return string[string.length - 1] === "\n" ? string.slice(0, -1) : string;
|
|
2776
|
+
}
|
|
2777
|
+
function foldString(string, width) {
|
|
2778
|
+
var lineRe = /(\n+)([^\n]*)/g;
|
|
2779
|
+
var result = (function() {
|
|
2780
|
+
var nextLF = string.indexOf("\n");
|
|
2781
|
+
nextLF = nextLF !== -1 ? nextLF : string.length;
|
|
2782
|
+
lineRe.lastIndex = nextLF;
|
|
2783
|
+
return foldLine(string.slice(0, nextLF), width);
|
|
2784
|
+
})();
|
|
2785
|
+
var prevMoreIndented = string[0] === "\n" || string[0] === " ";
|
|
2786
|
+
var moreIndented;
|
|
2787
|
+
var match;
|
|
2788
|
+
while (match = lineRe.exec(string)) {
|
|
2789
|
+
var prefix = match[1], line = match[2];
|
|
2790
|
+
moreIndented = line[0] === " ";
|
|
2791
|
+
result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? "\n" : "") + foldLine(line, width);
|
|
2792
|
+
prevMoreIndented = moreIndented;
|
|
2793
|
+
}
|
|
2794
|
+
return result;
|
|
2795
|
+
}
|
|
2796
|
+
function foldLine(line, width) {
|
|
2797
|
+
if (line === "" || line[0] === " ") return line;
|
|
2798
|
+
var breakRe = / [^ ]/g;
|
|
2799
|
+
var match;
|
|
2800
|
+
var start = 0, end, curr = 0, next = 0;
|
|
2801
|
+
var result = "";
|
|
2802
|
+
while (match = breakRe.exec(line)) {
|
|
2803
|
+
next = match.index;
|
|
2804
|
+
if (next - start > width) {
|
|
2805
|
+
end = curr > start ? curr : next;
|
|
2806
|
+
result += "\n" + line.slice(start, end);
|
|
2807
|
+
start = end + 1;
|
|
2808
|
+
}
|
|
2809
|
+
curr = next;
|
|
2810
|
+
}
|
|
2811
|
+
result += "\n";
|
|
2812
|
+
if (line.length - start > width && curr > start) {
|
|
2813
|
+
result += line.slice(start, curr) + "\n" + line.slice(curr + 1);
|
|
2814
|
+
} else {
|
|
2815
|
+
result += line.slice(start);
|
|
2816
|
+
}
|
|
2817
|
+
return result.slice(1);
|
|
2818
|
+
}
|
|
2819
|
+
function escapeString(string) {
|
|
2820
|
+
var result = "";
|
|
2821
|
+
var char, nextChar;
|
|
2822
|
+
var escapeSeq;
|
|
2823
|
+
for (var i = 0; i < string.length; i++) {
|
|
2824
|
+
char = string.charCodeAt(i);
|
|
2825
|
+
if (char >= 55296 && char <= 56319) {
|
|
2826
|
+
nextChar = string.charCodeAt(i + 1);
|
|
2827
|
+
if (nextChar >= 56320 && nextChar <= 57343) {
|
|
2828
|
+
result += encodeHex((char - 55296) * 1024 + nextChar - 56320 + 65536);
|
|
2829
|
+
i++;
|
|
2830
|
+
continue;
|
|
2831
|
+
}
|
|
2832
|
+
}
|
|
2833
|
+
escapeSeq = ESCAPE_SEQUENCES[char];
|
|
2834
|
+
result += !escapeSeq && isPrintable(char) ? string[i] : escapeSeq || encodeHex(char);
|
|
2835
|
+
}
|
|
2836
|
+
return result;
|
|
2837
|
+
}
|
|
2838
|
+
function writeFlowSequence(state, level, object) {
|
|
2839
|
+
var _result = "", _tag = state.tag, index, length;
|
|
2840
|
+
for (index = 0, length = object.length; index < length; index += 1) {
|
|
2841
|
+
if (writeNode(state, level, object[index], false, false)) {
|
|
2842
|
+
if (index !== 0) _result += "," + (!state.condenseFlow ? " " : "");
|
|
2843
|
+
_result += state.dump;
|
|
2844
|
+
}
|
|
2845
|
+
}
|
|
2846
|
+
state.tag = _tag;
|
|
2847
|
+
state.dump = "[" + _result + "]";
|
|
2848
|
+
}
|
|
2849
|
+
function writeBlockSequence(state, level, object, compact) {
|
|
2850
|
+
var _result = "", _tag = state.tag, index, length;
|
|
2851
|
+
for (index = 0, length = object.length; index < length; index += 1) {
|
|
2852
|
+
if (writeNode(state, level + 1, object[index], true, true)) {
|
|
2853
|
+
if (!compact || index !== 0) {
|
|
2854
|
+
_result += generateNextLine(state, level);
|
|
2855
|
+
}
|
|
2856
|
+
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
2857
|
+
_result += "-";
|
|
2858
|
+
} else {
|
|
2859
|
+
_result += "- ";
|
|
2860
|
+
}
|
|
2861
|
+
_result += state.dump;
|
|
2862
|
+
}
|
|
2863
|
+
}
|
|
2864
|
+
state.tag = _tag;
|
|
2865
|
+
state.dump = _result || "[]";
|
|
2866
|
+
}
|
|
2867
|
+
function writeFlowMapping(state, level, object) {
|
|
2868
|
+
var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, pairBuffer;
|
|
2869
|
+
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
|
2870
|
+
pairBuffer = "";
|
|
2871
|
+
if (index !== 0) pairBuffer += ", ";
|
|
2872
|
+
if (state.condenseFlow) pairBuffer += '"';
|
|
2873
|
+
objectKey = objectKeyList[index];
|
|
2874
|
+
objectValue = object[objectKey];
|
|
2875
|
+
if (!writeNode(state, level, objectKey, false, false)) {
|
|
2876
|
+
continue;
|
|
2877
|
+
}
|
|
2878
|
+
if (state.dump.length > 1024) pairBuffer += "? ";
|
|
2879
|
+
pairBuffer += state.dump + (state.condenseFlow ? '"' : "") + ":" + (state.condenseFlow ? "" : " ");
|
|
2880
|
+
if (!writeNode(state, level, objectValue, false, false)) {
|
|
2881
|
+
continue;
|
|
2882
|
+
}
|
|
2883
|
+
pairBuffer += state.dump;
|
|
2884
|
+
_result += pairBuffer;
|
|
2885
|
+
}
|
|
2886
|
+
state.tag = _tag;
|
|
2887
|
+
state.dump = "{" + _result + "}";
|
|
2888
|
+
}
|
|
2889
|
+
function writeBlockMapping(state, level, object, compact) {
|
|
2890
|
+
var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, explicitPair, pairBuffer;
|
|
2891
|
+
if (state.sortKeys === true) {
|
|
2892
|
+
objectKeyList.sort();
|
|
2893
|
+
} else if (typeof state.sortKeys === "function") {
|
|
2894
|
+
objectKeyList.sort(state.sortKeys);
|
|
2895
|
+
} else if (state.sortKeys) {
|
|
2896
|
+
throw new YAMLException("sortKeys must be a boolean or a function");
|
|
2897
|
+
}
|
|
2898
|
+
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
|
2899
|
+
pairBuffer = "";
|
|
2900
|
+
if (!compact || index !== 0) {
|
|
2901
|
+
pairBuffer += generateNextLine(state, level);
|
|
2902
|
+
}
|
|
2903
|
+
objectKey = objectKeyList[index];
|
|
2904
|
+
objectValue = object[objectKey];
|
|
2905
|
+
if (!writeNode(state, level + 1, objectKey, true, true, true)) {
|
|
2906
|
+
continue;
|
|
2907
|
+
}
|
|
2908
|
+
explicitPair = state.tag !== null && state.tag !== "?" || state.dump && state.dump.length > 1024;
|
|
2909
|
+
if (explicitPair) {
|
|
2910
|
+
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
2911
|
+
pairBuffer += "?";
|
|
2912
|
+
} else {
|
|
2913
|
+
pairBuffer += "? ";
|
|
2914
|
+
}
|
|
2915
|
+
}
|
|
2916
|
+
pairBuffer += state.dump;
|
|
2917
|
+
if (explicitPair) {
|
|
2918
|
+
pairBuffer += generateNextLine(state, level);
|
|
2919
|
+
}
|
|
2920
|
+
if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
|
|
2921
|
+
continue;
|
|
2922
|
+
}
|
|
2923
|
+
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
2924
|
+
pairBuffer += ":";
|
|
2925
|
+
} else {
|
|
2926
|
+
pairBuffer += ": ";
|
|
2927
|
+
}
|
|
2928
|
+
pairBuffer += state.dump;
|
|
2929
|
+
_result += pairBuffer;
|
|
2930
|
+
}
|
|
2931
|
+
state.tag = _tag;
|
|
2932
|
+
state.dump = _result || "{}";
|
|
2933
|
+
}
|
|
2934
|
+
function detectType(state, object, explicit) {
|
|
2935
|
+
var _result, typeList, index, length, type, style;
|
|
2936
|
+
typeList = explicit ? state.explicitTypes : state.implicitTypes;
|
|
2937
|
+
for (index = 0, length = typeList.length; index < length; index += 1) {
|
|
2938
|
+
type = typeList[index];
|
|
2939
|
+
if ((type.instanceOf || type.predicate) && (!type.instanceOf || typeof object === "object" && object instanceof type.instanceOf) && (!type.predicate || type.predicate(object))) {
|
|
2940
|
+
state.tag = explicit ? type.tag : "?";
|
|
2941
|
+
if (type.represent) {
|
|
2942
|
+
style = state.styleMap[type.tag] || type.defaultStyle;
|
|
2943
|
+
if (_toString.call(type.represent) === "[object Function]") {
|
|
2944
|
+
_result = type.represent(object, style);
|
|
2945
|
+
} else if (_hasOwnProperty.call(type.represent, style)) {
|
|
2946
|
+
_result = type.represent[style](object, style);
|
|
2947
|
+
} else {
|
|
2948
|
+
throw new YAMLException("!<" + type.tag + '> tag resolver accepts not "' + style + '" style');
|
|
2949
|
+
}
|
|
2950
|
+
state.dump = _result;
|
|
2951
|
+
}
|
|
2952
|
+
return true;
|
|
2953
|
+
}
|
|
2954
|
+
}
|
|
2955
|
+
return false;
|
|
2956
|
+
}
|
|
2957
|
+
function writeNode(state, level, object, block, compact, iskey) {
|
|
2958
|
+
state.tag = null;
|
|
2959
|
+
state.dump = object;
|
|
2960
|
+
if (!detectType(state, object, false)) {
|
|
2961
|
+
detectType(state, object, true);
|
|
2962
|
+
}
|
|
2963
|
+
var type = _toString.call(state.dump);
|
|
2964
|
+
if (block) {
|
|
2965
|
+
block = state.flowLevel < 0 || state.flowLevel > level;
|
|
2966
|
+
}
|
|
2967
|
+
var objectOrArray = type === "[object Object]" || type === "[object Array]", duplicateIndex, duplicate;
|
|
2968
|
+
if (objectOrArray) {
|
|
2969
|
+
duplicateIndex = state.duplicates.indexOf(object);
|
|
2970
|
+
duplicate = duplicateIndex !== -1;
|
|
2971
|
+
}
|
|
2972
|
+
if (state.tag !== null && state.tag !== "?" || duplicate || state.indent !== 2 && level > 0) {
|
|
2973
|
+
compact = false;
|
|
2974
|
+
}
|
|
2975
|
+
if (duplicate && state.usedDuplicates[duplicateIndex]) {
|
|
2976
|
+
state.dump = "*ref_" + duplicateIndex;
|
|
2977
|
+
} else {
|
|
2978
|
+
if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
|
|
2979
|
+
state.usedDuplicates[duplicateIndex] = true;
|
|
2980
|
+
}
|
|
2981
|
+
if (type === "[object Object]") {
|
|
2982
|
+
if (block && Object.keys(state.dump).length !== 0) {
|
|
2983
|
+
writeBlockMapping(state, level, state.dump, compact);
|
|
2984
|
+
if (duplicate) {
|
|
2985
|
+
state.dump = "&ref_" + duplicateIndex + state.dump;
|
|
2986
|
+
}
|
|
2987
|
+
} else {
|
|
2988
|
+
writeFlowMapping(state, level, state.dump);
|
|
2989
|
+
if (duplicate) {
|
|
2990
|
+
state.dump = "&ref_" + duplicateIndex + " " + state.dump;
|
|
2991
|
+
}
|
|
2992
|
+
}
|
|
2993
|
+
} else if (type === "[object Array]") {
|
|
2994
|
+
var arrayLevel = state.noArrayIndent && level > 0 ? level - 1 : level;
|
|
2995
|
+
if (block && state.dump.length !== 0) {
|
|
2996
|
+
writeBlockSequence(state, arrayLevel, state.dump, compact);
|
|
2997
|
+
if (duplicate) {
|
|
2998
|
+
state.dump = "&ref_" + duplicateIndex + state.dump;
|
|
2999
|
+
}
|
|
3000
|
+
} else {
|
|
3001
|
+
writeFlowSequence(state, arrayLevel, state.dump);
|
|
3002
|
+
if (duplicate) {
|
|
3003
|
+
state.dump = "&ref_" + duplicateIndex + " " + state.dump;
|
|
3004
|
+
}
|
|
3005
|
+
}
|
|
3006
|
+
} else if (type === "[object String]") {
|
|
3007
|
+
if (state.tag !== "?") {
|
|
3008
|
+
writeScalar(state, state.dump, level, iskey);
|
|
3009
|
+
}
|
|
3010
|
+
} else {
|
|
3011
|
+
if (state.skipInvalid) return false;
|
|
3012
|
+
throw new YAMLException("unacceptable kind of an object to dump " + type);
|
|
3013
|
+
}
|
|
3014
|
+
if (state.tag !== null && state.tag !== "?") {
|
|
3015
|
+
state.dump = "!<" + state.tag + "> " + state.dump;
|
|
3016
|
+
}
|
|
3017
|
+
}
|
|
3018
|
+
return true;
|
|
3019
|
+
}
|
|
3020
|
+
function getDuplicateReferences(object, state) {
|
|
3021
|
+
var objects = [], duplicatesIndexes = [], index, length;
|
|
3022
|
+
inspectNode(object, objects, duplicatesIndexes);
|
|
3023
|
+
for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {
|
|
3024
|
+
state.duplicates.push(objects[duplicatesIndexes[index]]);
|
|
3025
|
+
}
|
|
3026
|
+
state.usedDuplicates = new Array(length);
|
|
3027
|
+
}
|
|
3028
|
+
function inspectNode(object, objects, duplicatesIndexes) {
|
|
3029
|
+
var objectKeyList, index, length;
|
|
3030
|
+
if (object !== null && typeof object === "object") {
|
|
3031
|
+
index = objects.indexOf(object);
|
|
3032
|
+
if (index !== -1) {
|
|
3033
|
+
if (duplicatesIndexes.indexOf(index) === -1) {
|
|
3034
|
+
duplicatesIndexes.push(index);
|
|
3035
|
+
}
|
|
3036
|
+
} else {
|
|
3037
|
+
objects.push(object);
|
|
3038
|
+
if (Array.isArray(object)) {
|
|
3039
|
+
for (index = 0, length = object.length; index < length; index += 1) {
|
|
3040
|
+
inspectNode(object[index], objects, duplicatesIndexes);
|
|
3041
|
+
}
|
|
3042
|
+
} else {
|
|
3043
|
+
objectKeyList = Object.keys(object);
|
|
3044
|
+
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
|
3045
|
+
inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);
|
|
3046
|
+
}
|
|
3047
|
+
}
|
|
3048
|
+
}
|
|
3049
|
+
}
|
|
3050
|
+
}
|
|
3051
|
+
function dump(input, options2) {
|
|
3052
|
+
options2 = options2 || {};
|
|
3053
|
+
var state = new State(options2);
|
|
3054
|
+
if (!state.noRefs) getDuplicateReferences(input, state);
|
|
3055
|
+
if (writeNode(state, 0, input, true, true)) return state.dump + "\n";
|
|
3056
|
+
return "";
|
|
3057
|
+
}
|
|
3058
|
+
function safeDump(input, options2) {
|
|
3059
|
+
return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options2));
|
|
3060
|
+
}
|
|
3061
|
+
module2.exports.dump = dump;
|
|
3062
|
+
module2.exports.safeDump = safeDump;
|
|
3063
|
+
}
|
|
3064
|
+
});
|
|
3065
|
+
|
|
3066
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml.js
|
|
3067
|
+
var require_js_yaml = __commonJS({
|
|
3068
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/lib/js-yaml.js"(exports2, module2) {
|
|
3069
|
+
"use strict";
|
|
3070
|
+
var loader = require_loader();
|
|
3071
|
+
var dumper = require_dumper();
|
|
3072
|
+
function deprecated(name) {
|
|
3073
|
+
return function() {
|
|
3074
|
+
throw new Error("Function " + name + " is deprecated and cannot be used.");
|
|
3075
|
+
};
|
|
3076
|
+
}
|
|
3077
|
+
module2.exports.Type = require_type();
|
|
3078
|
+
module2.exports.Schema = require_schema();
|
|
3079
|
+
module2.exports.FAILSAFE_SCHEMA = require_failsafe();
|
|
3080
|
+
module2.exports.JSON_SCHEMA = require_json();
|
|
3081
|
+
module2.exports.CORE_SCHEMA = require_core();
|
|
3082
|
+
module2.exports.DEFAULT_SAFE_SCHEMA = require_default_safe();
|
|
3083
|
+
module2.exports.DEFAULT_FULL_SCHEMA = require_default_full();
|
|
3084
|
+
module2.exports.load = loader.load;
|
|
3085
|
+
module2.exports.loadAll = loader.loadAll;
|
|
3086
|
+
module2.exports.safeLoad = loader.safeLoad;
|
|
3087
|
+
module2.exports.safeLoadAll = loader.safeLoadAll;
|
|
3088
|
+
module2.exports.dump = dumper.dump;
|
|
3089
|
+
module2.exports.safeDump = dumper.safeDump;
|
|
3090
|
+
module2.exports.YAMLException = require_exception();
|
|
3091
|
+
module2.exports.MINIMAL_SCHEMA = require_failsafe();
|
|
3092
|
+
module2.exports.SAFE_SCHEMA = require_default_safe();
|
|
3093
|
+
module2.exports.DEFAULT_SCHEMA = require_default_full();
|
|
3094
|
+
module2.exports.scan = deprecated("scan");
|
|
3095
|
+
module2.exports.parse = deprecated("parse");
|
|
3096
|
+
module2.exports.compose = deprecated("compose");
|
|
3097
|
+
module2.exports.addConstructor = deprecated("addConstructor");
|
|
3098
|
+
}
|
|
3099
|
+
});
|
|
3100
|
+
|
|
3101
|
+
// ../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/index.js
|
|
3102
|
+
var require_js_yaml2 = __commonJS({
|
|
3103
|
+
"../../node_modules/.pnpm/js-yaml@3.14.2/node_modules/js-yaml/index.js"(exports2, module2) {
|
|
3104
|
+
"use strict";
|
|
3105
|
+
var yaml2 = require_js_yaml();
|
|
3106
|
+
module2.exports = yaml2;
|
|
3107
|
+
}
|
|
3108
|
+
});
|
|
3109
|
+
|
|
3110
|
+
// ../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/engines.js
|
|
3111
|
+
var require_engines = __commonJS({
|
|
3112
|
+
"../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/engines.js"(exports, module) {
|
|
3113
|
+
"use strict";
|
|
3114
|
+
var yaml = require_js_yaml2();
|
|
3115
|
+
var engines = exports = module.exports;
|
|
3116
|
+
engines.yaml = {
|
|
3117
|
+
parse: yaml.safeLoad.bind(yaml),
|
|
3118
|
+
stringify: yaml.safeDump.bind(yaml)
|
|
3119
|
+
};
|
|
3120
|
+
engines.json = {
|
|
3121
|
+
parse: JSON.parse.bind(JSON),
|
|
3122
|
+
stringify: function(obj, options2) {
|
|
3123
|
+
const opts = Object.assign({ replacer: null, space: 2 }, options2);
|
|
3124
|
+
return JSON.stringify(obj, opts.replacer, opts.space);
|
|
3125
|
+
}
|
|
3126
|
+
};
|
|
3127
|
+
engines.javascript = {
|
|
3128
|
+
parse: function parse(str, options, wrap) {
|
|
3129
|
+
try {
|
|
3130
|
+
if (wrap !== false) {
|
|
3131
|
+
str = "(function() {\nreturn " + str.trim() + ";\n}());";
|
|
3132
|
+
}
|
|
3133
|
+
return eval(str) || {};
|
|
3134
|
+
} catch (err) {
|
|
3135
|
+
if (wrap !== false && /(unexpected|identifier)/i.test(err.message)) {
|
|
3136
|
+
return parse(str, options, false);
|
|
3137
|
+
}
|
|
3138
|
+
throw new SyntaxError(err);
|
|
3139
|
+
}
|
|
3140
|
+
},
|
|
3141
|
+
stringify: function() {
|
|
3142
|
+
throw new Error("stringifying JavaScript is not supported");
|
|
3143
|
+
}
|
|
3144
|
+
};
|
|
3145
|
+
}
|
|
3146
|
+
});
|
|
3147
|
+
|
|
3148
|
+
// ../../node_modules/.pnpm/strip-bom-string@1.0.0/node_modules/strip-bom-string/index.js
|
|
3149
|
+
var require_strip_bom_string = __commonJS({
|
|
3150
|
+
"../../node_modules/.pnpm/strip-bom-string@1.0.0/node_modules/strip-bom-string/index.js"(exports2, module2) {
|
|
3151
|
+
"use strict";
|
|
3152
|
+
module2.exports = function(str2) {
|
|
3153
|
+
if (typeof str2 === "string" && str2.charAt(0) === "\uFEFF") {
|
|
3154
|
+
return str2.slice(1);
|
|
3155
|
+
}
|
|
3156
|
+
return str2;
|
|
3157
|
+
};
|
|
3158
|
+
}
|
|
3159
|
+
});
|
|
3160
|
+
|
|
3161
|
+
// ../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/utils.js
|
|
3162
|
+
var require_utils = __commonJS({
|
|
3163
|
+
"../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/utils.js"(exports2) {
|
|
3164
|
+
"use strict";
|
|
3165
|
+
var stripBom = require_strip_bom_string();
|
|
3166
|
+
var typeOf = require_kind_of();
|
|
3167
|
+
exports2.define = function(obj, key, val) {
|
|
3168
|
+
Reflect.defineProperty(obj, key, {
|
|
3169
|
+
enumerable: false,
|
|
3170
|
+
configurable: true,
|
|
3171
|
+
writable: true,
|
|
3172
|
+
value: val
|
|
3173
|
+
});
|
|
3174
|
+
};
|
|
3175
|
+
exports2.isBuffer = function(val) {
|
|
3176
|
+
return typeOf(val) === "buffer";
|
|
3177
|
+
};
|
|
3178
|
+
exports2.isObject = function(val) {
|
|
3179
|
+
return typeOf(val) === "object";
|
|
3180
|
+
};
|
|
3181
|
+
exports2.toBuffer = function(input) {
|
|
3182
|
+
return typeof input === "string" ? Buffer.from(input) : input;
|
|
3183
|
+
};
|
|
3184
|
+
exports2.toString = function(input) {
|
|
3185
|
+
if (exports2.isBuffer(input)) return stripBom(String(input));
|
|
3186
|
+
if (typeof input !== "string") {
|
|
3187
|
+
throw new TypeError("expected input to be a string or buffer");
|
|
3188
|
+
}
|
|
3189
|
+
return stripBom(input);
|
|
3190
|
+
};
|
|
3191
|
+
exports2.arrayify = function(val) {
|
|
3192
|
+
return val ? Array.isArray(val) ? val : [val] : [];
|
|
3193
|
+
};
|
|
3194
|
+
exports2.startsWith = function(str2, substr, len) {
|
|
3195
|
+
if (typeof len !== "number") len = substr.length;
|
|
3196
|
+
return str2.slice(0, len) === substr;
|
|
3197
|
+
};
|
|
3198
|
+
}
|
|
3199
|
+
});
|
|
3200
|
+
|
|
3201
|
+
// ../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/defaults.js
|
|
3202
|
+
var require_defaults = __commonJS({
|
|
3203
|
+
"../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/defaults.js"(exports2, module2) {
|
|
3204
|
+
"use strict";
|
|
3205
|
+
var engines2 = require_engines();
|
|
3206
|
+
var utils = require_utils();
|
|
3207
|
+
module2.exports = function(options2) {
|
|
3208
|
+
const opts = Object.assign({}, options2);
|
|
3209
|
+
opts.delimiters = utils.arrayify(opts.delims || opts.delimiters || "---");
|
|
3210
|
+
if (opts.delimiters.length === 1) {
|
|
3211
|
+
opts.delimiters.push(opts.delimiters[0]);
|
|
3212
|
+
}
|
|
3213
|
+
opts.language = (opts.language || opts.lang || "yaml").toLowerCase();
|
|
3214
|
+
opts.engines = Object.assign({}, engines2, opts.parsers, opts.engines);
|
|
3215
|
+
return opts;
|
|
3216
|
+
};
|
|
3217
|
+
}
|
|
3218
|
+
});
|
|
3219
|
+
|
|
3220
|
+
// ../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/engine.js
|
|
3221
|
+
var require_engine = __commonJS({
|
|
3222
|
+
"../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/engine.js"(exports2, module2) {
|
|
3223
|
+
"use strict";
|
|
3224
|
+
module2.exports = function(name, options2) {
|
|
3225
|
+
let engine = options2.engines[name] || options2.engines[aliase(name)];
|
|
3226
|
+
if (typeof engine === "undefined") {
|
|
3227
|
+
throw new Error('gray-matter engine "' + name + '" is not registered');
|
|
3228
|
+
}
|
|
3229
|
+
if (typeof engine === "function") {
|
|
3230
|
+
engine = { parse: engine };
|
|
3231
|
+
}
|
|
3232
|
+
return engine;
|
|
3233
|
+
};
|
|
3234
|
+
function aliase(name) {
|
|
3235
|
+
switch (name.toLowerCase()) {
|
|
3236
|
+
case "js":
|
|
3237
|
+
case "javascript":
|
|
3238
|
+
return "javascript";
|
|
3239
|
+
case "coffee":
|
|
3240
|
+
case "coffeescript":
|
|
3241
|
+
case "cson":
|
|
3242
|
+
return "coffee";
|
|
3243
|
+
case "yaml":
|
|
3244
|
+
case "yml":
|
|
3245
|
+
return "yaml";
|
|
3246
|
+
default: {
|
|
3247
|
+
return name;
|
|
3248
|
+
}
|
|
3249
|
+
}
|
|
3250
|
+
}
|
|
3251
|
+
}
|
|
3252
|
+
});
|
|
3253
|
+
|
|
3254
|
+
// ../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/stringify.js
|
|
3255
|
+
var require_stringify = __commonJS({
|
|
3256
|
+
"../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/stringify.js"(exports2, module2) {
|
|
3257
|
+
"use strict";
|
|
3258
|
+
var typeOf = require_kind_of();
|
|
3259
|
+
var getEngine = require_engine();
|
|
3260
|
+
var defaults = require_defaults();
|
|
3261
|
+
module2.exports = function(file, data, options2) {
|
|
3262
|
+
if (data == null && options2 == null) {
|
|
3263
|
+
switch (typeOf(file)) {
|
|
3264
|
+
case "object":
|
|
3265
|
+
data = file.data;
|
|
3266
|
+
options2 = {};
|
|
3267
|
+
break;
|
|
3268
|
+
case "string":
|
|
3269
|
+
return file;
|
|
3270
|
+
default: {
|
|
3271
|
+
throw new TypeError("expected file to be a string or object");
|
|
3272
|
+
}
|
|
3273
|
+
}
|
|
3274
|
+
}
|
|
3275
|
+
const str2 = file.content;
|
|
3276
|
+
const opts = defaults(options2);
|
|
3277
|
+
if (data == null) {
|
|
3278
|
+
if (!opts.data) return file;
|
|
3279
|
+
data = opts.data;
|
|
3280
|
+
}
|
|
3281
|
+
const language = file.language || opts.language;
|
|
3282
|
+
const engine = getEngine(language, opts);
|
|
3283
|
+
if (typeof engine.stringify !== "function") {
|
|
3284
|
+
throw new TypeError('expected "' + language + '.stringify" to be a function');
|
|
3285
|
+
}
|
|
3286
|
+
data = Object.assign({}, file.data, data);
|
|
3287
|
+
const open = opts.delimiters[0];
|
|
3288
|
+
const close = opts.delimiters[1];
|
|
3289
|
+
const matter2 = engine.stringify(data, options2).trim();
|
|
3290
|
+
let buf = "";
|
|
3291
|
+
if (matter2 !== "{}") {
|
|
3292
|
+
buf = newline(open) + newline(matter2) + newline(close);
|
|
3293
|
+
}
|
|
3294
|
+
if (typeof file.excerpt === "string" && file.excerpt !== "") {
|
|
3295
|
+
if (str2.indexOf(file.excerpt.trim()) === -1) {
|
|
3296
|
+
buf += newline(file.excerpt) + newline(close);
|
|
3297
|
+
}
|
|
3298
|
+
}
|
|
3299
|
+
return buf + newline(str2);
|
|
3300
|
+
};
|
|
3301
|
+
function newline(str2) {
|
|
3302
|
+
return str2.slice(-1) !== "\n" ? str2 + "\n" : str2;
|
|
3303
|
+
}
|
|
3304
|
+
}
|
|
3305
|
+
});
|
|
3306
|
+
|
|
3307
|
+
// ../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/excerpt.js
|
|
3308
|
+
var require_excerpt = __commonJS({
|
|
3309
|
+
"../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/excerpt.js"(exports2, module2) {
|
|
3310
|
+
"use strict";
|
|
3311
|
+
var defaults = require_defaults();
|
|
3312
|
+
module2.exports = function(file, options2) {
|
|
3313
|
+
const opts = defaults(options2);
|
|
3314
|
+
if (file.data == null) {
|
|
3315
|
+
file.data = {};
|
|
3316
|
+
}
|
|
3317
|
+
if (typeof opts.excerpt === "function") {
|
|
3318
|
+
return opts.excerpt(file, opts);
|
|
3319
|
+
}
|
|
3320
|
+
const sep = file.data.excerpt_separator || opts.excerpt_separator;
|
|
3321
|
+
if (sep == null && (opts.excerpt === false || opts.excerpt == null)) {
|
|
3322
|
+
return file;
|
|
3323
|
+
}
|
|
3324
|
+
const delimiter = typeof opts.excerpt === "string" ? opts.excerpt : sep || opts.delimiters[0];
|
|
3325
|
+
const idx = file.content.indexOf(delimiter);
|
|
3326
|
+
if (idx !== -1) {
|
|
3327
|
+
file.excerpt = file.content.slice(0, idx);
|
|
3328
|
+
}
|
|
3329
|
+
return file;
|
|
3330
|
+
};
|
|
3331
|
+
}
|
|
3332
|
+
});
|
|
3333
|
+
|
|
3334
|
+
// ../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/to-file.js
|
|
3335
|
+
var require_to_file = __commonJS({
|
|
3336
|
+
"../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/to-file.js"(exports2, module2) {
|
|
3337
|
+
"use strict";
|
|
3338
|
+
var typeOf = require_kind_of();
|
|
3339
|
+
var stringify = require_stringify();
|
|
3340
|
+
var utils = require_utils();
|
|
3341
|
+
module2.exports = function(file) {
|
|
3342
|
+
if (typeOf(file) !== "object") {
|
|
3343
|
+
file = { content: file };
|
|
3344
|
+
}
|
|
3345
|
+
if (typeOf(file.data) !== "object") {
|
|
3346
|
+
file.data = {};
|
|
3347
|
+
}
|
|
3348
|
+
if (file.contents && file.content == null) {
|
|
3349
|
+
file.content = file.contents;
|
|
3350
|
+
}
|
|
3351
|
+
utils.define(file, "orig", utils.toBuffer(file.content));
|
|
3352
|
+
utils.define(file, "language", file.language || "");
|
|
3353
|
+
utils.define(file, "matter", file.matter || "");
|
|
3354
|
+
utils.define(file, "stringify", function(data, options2) {
|
|
3355
|
+
if (options2 && options2.language) {
|
|
3356
|
+
file.language = options2.language;
|
|
3357
|
+
}
|
|
3358
|
+
return stringify(file, data, options2);
|
|
3359
|
+
});
|
|
3360
|
+
file.content = utils.toString(file.content);
|
|
3361
|
+
file.isEmpty = false;
|
|
3362
|
+
file.excerpt = "";
|
|
3363
|
+
return file;
|
|
3364
|
+
};
|
|
3365
|
+
}
|
|
3366
|
+
});
|
|
3367
|
+
|
|
3368
|
+
// ../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/parse.js
|
|
3369
|
+
var require_parse = __commonJS({
|
|
3370
|
+
"../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/parse.js"(exports2, module2) {
|
|
3371
|
+
"use strict";
|
|
3372
|
+
var getEngine = require_engine();
|
|
3373
|
+
var defaults = require_defaults();
|
|
3374
|
+
module2.exports = function(language, str2, options2) {
|
|
3375
|
+
const opts = defaults(options2);
|
|
3376
|
+
const engine = getEngine(language, opts);
|
|
3377
|
+
if (typeof engine.parse !== "function") {
|
|
3378
|
+
throw new TypeError('expected "' + language + '.parse" to be a function');
|
|
3379
|
+
}
|
|
3380
|
+
return engine.parse(str2, opts);
|
|
3381
|
+
};
|
|
3382
|
+
}
|
|
3383
|
+
});
|
|
3384
|
+
|
|
3385
|
+
// ../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/index.js
|
|
3386
|
+
var require_gray_matter = __commonJS({
|
|
3387
|
+
"../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/index.js"(exports2, module2) {
|
|
3388
|
+
"use strict";
|
|
3389
|
+
var fs3 = __require("fs");
|
|
3390
|
+
var sections = require_section_matter();
|
|
3391
|
+
var defaults = require_defaults();
|
|
3392
|
+
var stringify = require_stringify();
|
|
3393
|
+
var excerpt = require_excerpt();
|
|
3394
|
+
var engines2 = require_engines();
|
|
3395
|
+
var toFile = require_to_file();
|
|
3396
|
+
var parse2 = require_parse();
|
|
3397
|
+
var utils = require_utils();
|
|
3398
|
+
function matter2(input, options2) {
|
|
3399
|
+
if (input === "") {
|
|
3400
|
+
return { data: {}, content: input, excerpt: "", orig: input };
|
|
3401
|
+
}
|
|
3402
|
+
let file = toFile(input);
|
|
3403
|
+
const cached = matter2.cache[file.content];
|
|
3404
|
+
if (!options2) {
|
|
3405
|
+
if (cached) {
|
|
3406
|
+
file = Object.assign({}, cached);
|
|
3407
|
+
file.orig = cached.orig;
|
|
3408
|
+
return file;
|
|
3409
|
+
}
|
|
3410
|
+
matter2.cache[file.content] = file;
|
|
3411
|
+
}
|
|
3412
|
+
return parseMatter(file, options2);
|
|
3413
|
+
}
|
|
3414
|
+
function parseMatter(file, options2) {
|
|
3415
|
+
const opts = defaults(options2);
|
|
3416
|
+
const open = opts.delimiters[0];
|
|
3417
|
+
const close = "\n" + opts.delimiters[1];
|
|
3418
|
+
let str2 = file.content;
|
|
3419
|
+
if (opts.language) {
|
|
3420
|
+
file.language = opts.language;
|
|
3421
|
+
}
|
|
3422
|
+
const openLen = open.length;
|
|
3423
|
+
if (!utils.startsWith(str2, open, openLen)) {
|
|
3424
|
+
excerpt(file, opts);
|
|
3425
|
+
return file;
|
|
3426
|
+
}
|
|
3427
|
+
if (str2.charAt(openLen) === open.slice(-1)) {
|
|
3428
|
+
return file;
|
|
3429
|
+
}
|
|
3430
|
+
str2 = str2.slice(openLen);
|
|
3431
|
+
const len = str2.length;
|
|
3432
|
+
const language = matter2.language(str2, opts);
|
|
3433
|
+
if (language.name) {
|
|
3434
|
+
file.language = language.name;
|
|
3435
|
+
str2 = str2.slice(language.raw.length);
|
|
3436
|
+
}
|
|
3437
|
+
let closeIndex = str2.indexOf(close);
|
|
3438
|
+
if (closeIndex === -1) {
|
|
3439
|
+
closeIndex = len;
|
|
3440
|
+
}
|
|
3441
|
+
file.matter = str2.slice(0, closeIndex);
|
|
3442
|
+
const block = file.matter.replace(/^\s*#[^\n]+/gm, "").trim();
|
|
3443
|
+
if (block === "") {
|
|
3444
|
+
file.isEmpty = true;
|
|
3445
|
+
file.empty = file.content;
|
|
3446
|
+
file.data = {};
|
|
3447
|
+
} else {
|
|
3448
|
+
file.data = parse2(file.language, file.matter, opts);
|
|
3449
|
+
}
|
|
3450
|
+
if (closeIndex === len) {
|
|
3451
|
+
file.content = "";
|
|
3452
|
+
} else {
|
|
3453
|
+
file.content = str2.slice(closeIndex + close.length);
|
|
3454
|
+
if (file.content[0] === "\r") {
|
|
3455
|
+
file.content = file.content.slice(1);
|
|
3456
|
+
}
|
|
3457
|
+
if (file.content[0] === "\n") {
|
|
3458
|
+
file.content = file.content.slice(1);
|
|
3459
|
+
}
|
|
3460
|
+
}
|
|
3461
|
+
excerpt(file, opts);
|
|
3462
|
+
if (opts.sections === true || typeof opts.section === "function") {
|
|
3463
|
+
sections(file, opts.section);
|
|
3464
|
+
}
|
|
3465
|
+
return file;
|
|
3466
|
+
}
|
|
3467
|
+
matter2.engines = engines2;
|
|
3468
|
+
matter2.stringify = function(file, data, options2) {
|
|
3469
|
+
if (typeof file === "string") file = matter2(file, options2);
|
|
3470
|
+
return stringify(file, data, options2);
|
|
3471
|
+
};
|
|
3472
|
+
matter2.read = function(filepath, options2) {
|
|
3473
|
+
const str2 = fs3.readFileSync(filepath, "utf8");
|
|
3474
|
+
const file = matter2(str2, options2);
|
|
3475
|
+
file.path = filepath;
|
|
3476
|
+
return file;
|
|
3477
|
+
};
|
|
3478
|
+
matter2.test = function(str2, options2) {
|
|
3479
|
+
return utils.startsWith(str2, defaults(options2).delimiters[0]);
|
|
3480
|
+
};
|
|
3481
|
+
matter2.language = function(str2, options2) {
|
|
3482
|
+
const opts = defaults(options2);
|
|
3483
|
+
const open = opts.delimiters[0];
|
|
3484
|
+
if (matter2.test(str2)) {
|
|
3485
|
+
str2 = str2.slice(open.length);
|
|
3486
|
+
}
|
|
3487
|
+
const language = str2.slice(0, str2.search(/\r?\n/));
|
|
3488
|
+
return {
|
|
3489
|
+
raw: language,
|
|
3490
|
+
name: language ? language.trim() : ""
|
|
3491
|
+
};
|
|
3492
|
+
};
|
|
3493
|
+
matter2.cache = {};
|
|
3494
|
+
matter2.clearCache = function() {
|
|
3495
|
+
matter2.cache = {};
|
|
3496
|
+
};
|
|
3497
|
+
module2.exports = matter2;
|
|
3498
|
+
}
|
|
3499
|
+
});
|
|
13
3500
|
|
|
14
3501
|
// src/index.ts
|
|
15
3502
|
import { Command } from "commander";
|
|
@@ -21,7 +3508,325 @@ import fs from "fs-extra";
|
|
|
21
3508
|
import * as path from "path";
|
|
22
3509
|
import chalk from "chalk";
|
|
23
3510
|
import ora from "ora";
|
|
24
|
-
|
|
3511
|
+
|
|
3512
|
+
// ../../packages/core/dist/index.js
|
|
3513
|
+
var import_gray_matter = __toESM(require_gray_matter(), 1);
|
|
3514
|
+
var VALID_PLATFORMS = ["claude", "codex", "copilot", "cursor", "windsurf"];
|
|
3515
|
+
var NAME_PATTERN = /^[a-z0-9][a-z0-9-]*[a-z0-9]$|^[a-z0-9]$/;
|
|
3516
|
+
var MAX_DESCRIPTION_LENGTH = 1024;
|
|
3517
|
+
var MAX_NAME_LENGTH = 64;
|
|
3518
|
+
var INSTRUCTION_FILE_PATTERNS = [
|
|
3519
|
+
{
|
|
3520
|
+
format: "skill.md",
|
|
3521
|
+
filename: "SKILL.md",
|
|
3522
|
+
searchQuery: "filename:SKILL.md",
|
|
3523
|
+
rootOnly: false,
|
|
3524
|
+
hasFrontmatter: true,
|
|
3525
|
+
inferredPlatform: "claude",
|
|
3526
|
+
minContentLength: 50
|
|
3527
|
+
},
|
|
3528
|
+
{
|
|
3529
|
+
format: "agents.md",
|
|
3530
|
+
filename: "AGENTS.md",
|
|
3531
|
+
searchQuery: "filename:AGENTS.md",
|
|
3532
|
+
rootOnly: false,
|
|
3533
|
+
hasFrontmatter: false,
|
|
3534
|
+
inferredPlatform: "codex",
|
|
3535
|
+
minContentLength: 100
|
|
3536
|
+
},
|
|
3537
|
+
{
|
|
3538
|
+
format: "copilot-instructions",
|
|
3539
|
+
filename: "copilot-instructions.md",
|
|
3540
|
+
searchQuery: "filename:copilot-instructions.md path:.github",
|
|
3541
|
+
pathFilter: ".github/",
|
|
3542
|
+
rootOnly: false,
|
|
3543
|
+
hasFrontmatter: false,
|
|
3544
|
+
inferredPlatform: "copilot",
|
|
3545
|
+
minContentLength: 100
|
|
3546
|
+
},
|
|
3547
|
+
{
|
|
3548
|
+
format: "cursorrules",
|
|
3549
|
+
filename: ".cursorrules",
|
|
3550
|
+
searchQuery: "filename:.cursorrules",
|
|
3551
|
+
rootOnly: true,
|
|
3552
|
+
hasFrontmatter: false,
|
|
3553
|
+
inferredPlatform: "cursor",
|
|
3554
|
+
minContentLength: 100
|
|
3555
|
+
},
|
|
3556
|
+
{
|
|
3557
|
+
format: "windsurfrules",
|
|
3558
|
+
filename: ".windsurfrules",
|
|
3559
|
+
searchQuery: "filename:.windsurfrules",
|
|
3560
|
+
rootOnly: true,
|
|
3561
|
+
hasFrontmatter: false,
|
|
3562
|
+
inferredPlatform: "windsurf",
|
|
3563
|
+
minContentLength: 100
|
|
3564
|
+
}
|
|
3565
|
+
];
|
|
3566
|
+
var FORMAT_LABELS = {
|
|
3567
|
+
"skill.md": "SKILL.md",
|
|
3568
|
+
"agents.md": "AGENTS.md",
|
|
3569
|
+
"cursorrules": ".cursorrules",
|
|
3570
|
+
"windsurfrules": ".windsurfrules",
|
|
3571
|
+
"copilot-instructions": "Copilot Instructions"
|
|
3572
|
+
};
|
|
3573
|
+
function parseSkillMd(content) {
|
|
3574
|
+
const { data: frontmatter, content: body } = (0, import_gray_matter.default)(content);
|
|
3575
|
+
const errors = [];
|
|
3576
|
+
const warnings = [];
|
|
3577
|
+
if (!frontmatter.name) {
|
|
3578
|
+
errors.push({
|
|
3579
|
+
code: "MISSING_NAME",
|
|
3580
|
+
message: "Missing required field: name",
|
|
3581
|
+
field: "name"
|
|
3582
|
+
});
|
|
3583
|
+
} else {
|
|
3584
|
+
validateName(frontmatter.name, errors, warnings);
|
|
3585
|
+
}
|
|
3586
|
+
if (!frontmatter.description) {
|
|
3587
|
+
errors.push({
|
|
3588
|
+
code: "MISSING_DESCRIPTION",
|
|
3589
|
+
message: "Missing required field: description",
|
|
3590
|
+
field: "description"
|
|
3591
|
+
});
|
|
3592
|
+
} else {
|
|
3593
|
+
validateDescription(frontmatter.description, warnings);
|
|
3594
|
+
}
|
|
3595
|
+
if (frontmatter.compatibility) {
|
|
3596
|
+
validateCompatibility(frontmatter.compatibility, errors, warnings);
|
|
3597
|
+
}
|
|
3598
|
+
if (frontmatter.triggers) {
|
|
3599
|
+
validateTriggers(frontmatter.triggers, warnings);
|
|
3600
|
+
}
|
|
3601
|
+
const metadata = {
|
|
3602
|
+
name: String(frontmatter.name || ""),
|
|
3603
|
+
description: String(frontmatter.description || ""),
|
|
3604
|
+
version: frontmatter.version ? String(frontmatter.version) : void 0,
|
|
3605
|
+
license: frontmatter.license ? String(frontmatter.license) : void 0,
|
|
3606
|
+
author: frontmatter.author ? String(frontmatter.author) : void 0,
|
|
3607
|
+
homepage: frontmatter.homepage ? String(frontmatter.homepage) : void 0,
|
|
3608
|
+
repository: frontmatter.repository ? String(frontmatter.repository) : void 0,
|
|
3609
|
+
compatibility: frontmatter.compatibility,
|
|
3610
|
+
triggers: frontmatter.triggers,
|
|
3611
|
+
metadata: frontmatter.metadata
|
|
3612
|
+
};
|
|
3613
|
+
const resources = discoverResources(body);
|
|
3614
|
+
const validation = {
|
|
3615
|
+
isValid: errors.length === 0,
|
|
3616
|
+
errors,
|
|
3617
|
+
warnings
|
|
3618
|
+
};
|
|
3619
|
+
return {
|
|
3620
|
+
metadata,
|
|
3621
|
+
content: body.trim(),
|
|
3622
|
+
resources,
|
|
3623
|
+
validation,
|
|
3624
|
+
rawFrontmatter: frontmatter
|
|
3625
|
+
};
|
|
3626
|
+
}
|
|
3627
|
+
function validateName(name, errors, warnings) {
|
|
3628
|
+
if (typeof name !== "string") {
|
|
3629
|
+
errors.push({
|
|
3630
|
+
code: "INVALID_NAME_TYPE",
|
|
3631
|
+
message: "Name must be a string",
|
|
3632
|
+
field: "name"
|
|
3633
|
+
});
|
|
3634
|
+
return;
|
|
3635
|
+
}
|
|
3636
|
+
if (name.length > MAX_NAME_LENGTH) {
|
|
3637
|
+
errors.push({
|
|
3638
|
+
code: "NAME_TOO_LONG",
|
|
3639
|
+
message: `Name exceeds ${MAX_NAME_LENGTH} characters`,
|
|
3640
|
+
field: "name"
|
|
3641
|
+
});
|
|
3642
|
+
}
|
|
3643
|
+
if (!NAME_PATTERN.test(name)) {
|
|
3644
|
+
errors.push({
|
|
3645
|
+
code: "INVALID_NAME_FORMAT",
|
|
3646
|
+
message: 'Name must be lowercase alphanumeric with hyphens (e.g., "my-skill")',
|
|
3647
|
+
field: "name"
|
|
3648
|
+
});
|
|
3649
|
+
}
|
|
3650
|
+
const reserved = ["test", "example", "demo", "skill", "template"];
|
|
3651
|
+
if (reserved.includes(name)) {
|
|
3652
|
+
warnings.push({
|
|
3653
|
+
code: "RESERVED_NAME",
|
|
3654
|
+
message: `"${name}" is a reserved name and may cause conflicts`,
|
|
3655
|
+
field: "name",
|
|
3656
|
+
suggestion: `Consider using a more specific name like "my-${name}"`
|
|
3657
|
+
});
|
|
3658
|
+
}
|
|
3659
|
+
}
|
|
3660
|
+
function validateDescription(description, warnings) {
|
|
3661
|
+
if (typeof description !== "string") {
|
|
3662
|
+
return;
|
|
3663
|
+
}
|
|
3664
|
+
if (description.length > MAX_DESCRIPTION_LENGTH) {
|
|
3665
|
+
warnings.push({
|
|
3666
|
+
code: "DESCRIPTION_TOO_LONG",
|
|
3667
|
+
message: `Description exceeds ${MAX_DESCRIPTION_LENGTH} characters`,
|
|
3668
|
+
field: "description",
|
|
3669
|
+
suggestion: "Consider shortening the description for better display"
|
|
3670
|
+
});
|
|
3671
|
+
}
|
|
3672
|
+
if (description.length < 20) {
|
|
3673
|
+
warnings.push({
|
|
3674
|
+
code: "DESCRIPTION_TOO_SHORT",
|
|
3675
|
+
message: "Description is very short",
|
|
3676
|
+
field: "description",
|
|
3677
|
+
suggestion: "Add more detail to help users understand the skill"
|
|
3678
|
+
});
|
|
3679
|
+
}
|
|
3680
|
+
}
|
|
3681
|
+
function validateCompatibility(compatibility, errors, warnings) {
|
|
3682
|
+
if (typeof compatibility !== "object" || compatibility === null) {
|
|
3683
|
+
errors.push({
|
|
3684
|
+
code: "INVALID_COMPATIBILITY",
|
|
3685
|
+
message: "Compatibility must be an object",
|
|
3686
|
+
field: "compatibility"
|
|
3687
|
+
});
|
|
3688
|
+
return;
|
|
3689
|
+
}
|
|
3690
|
+
const compat = compatibility;
|
|
3691
|
+
if (compat.platforms) {
|
|
3692
|
+
if (!Array.isArray(compat.platforms)) {
|
|
3693
|
+
errors.push({
|
|
3694
|
+
code: "INVALID_PLATFORMS",
|
|
3695
|
+
message: "Platforms must be an array",
|
|
3696
|
+
field: "compatibility.platforms"
|
|
3697
|
+
});
|
|
3698
|
+
} else {
|
|
3699
|
+
for (const platform of compat.platforms) {
|
|
3700
|
+
if (!VALID_PLATFORMS.includes(platform)) {
|
|
3701
|
+
warnings.push({
|
|
3702
|
+
code: "UNKNOWN_PLATFORM",
|
|
3703
|
+
message: `Unknown platform: ${platform}`,
|
|
3704
|
+
field: "compatibility.platforms",
|
|
3705
|
+
suggestion: `Valid platforms are: ${VALID_PLATFORMS.join(", ")}`
|
|
3706
|
+
});
|
|
3707
|
+
}
|
|
3708
|
+
}
|
|
3709
|
+
}
|
|
3710
|
+
}
|
|
3711
|
+
}
|
|
3712
|
+
function validateTriggers(triggers, warnings) {
|
|
3713
|
+
if (typeof triggers !== "object" || triggers === null) {
|
|
3714
|
+
return;
|
|
3715
|
+
}
|
|
3716
|
+
const trig = triggers;
|
|
3717
|
+
if (trig.filePatterns && !Array.isArray(trig.filePatterns)) {
|
|
3718
|
+
warnings.push({
|
|
3719
|
+
code: "INVALID_FILE_PATTERNS",
|
|
3720
|
+
message: "filePatterns should be an array",
|
|
3721
|
+
field: "triggers.filePatterns"
|
|
3722
|
+
});
|
|
3723
|
+
}
|
|
3724
|
+
if (trig.keywords && !Array.isArray(trig.keywords)) {
|
|
3725
|
+
warnings.push({
|
|
3726
|
+
code: "INVALID_KEYWORDS",
|
|
3727
|
+
message: "keywords should be an array",
|
|
3728
|
+
field: "triggers.keywords"
|
|
3729
|
+
});
|
|
3730
|
+
}
|
|
3731
|
+
}
|
|
3732
|
+
function discoverResources(content) {
|
|
3733
|
+
const scripts = [];
|
|
3734
|
+
const references = [];
|
|
3735
|
+
const assets = [];
|
|
3736
|
+
const scriptPattern = /scripts\/([a-zA-Z0-9_-]+\.(sh|py|js|ts))/g;
|
|
3737
|
+
let match;
|
|
3738
|
+
while ((match = scriptPattern.exec(content)) !== null) {
|
|
3739
|
+
scripts.push({
|
|
3740
|
+
name: match[1],
|
|
3741
|
+
path: `scripts/${match[1]}`
|
|
3742
|
+
});
|
|
3743
|
+
}
|
|
3744
|
+
const refPattern = /references\/([a-zA-Z0-9_.-]+)/g;
|
|
3745
|
+
while ((match = refPattern.exec(content)) !== null) {
|
|
3746
|
+
references.push({
|
|
3747
|
+
name: match[1],
|
|
3748
|
+
path: `references/${match[1]}`
|
|
3749
|
+
});
|
|
3750
|
+
}
|
|
3751
|
+
const assetPattern = /assets\/([a-zA-Z0-9_.-]+)/g;
|
|
3752
|
+
while ((match = assetPattern.exec(content)) !== null) {
|
|
3753
|
+
assets.push({
|
|
3754
|
+
name: match[1],
|
|
3755
|
+
path: `assets/${match[1]}`
|
|
3756
|
+
});
|
|
3757
|
+
}
|
|
3758
|
+
return { scripts, references, assets };
|
|
3759
|
+
}
|
|
3760
|
+
function parseGenericInstructionFile(content, format, repoMeta) {
|
|
3761
|
+
let frontmatter = {};
|
|
3762
|
+
let body = content;
|
|
3763
|
+
try {
|
|
3764
|
+
const parsed = (0, import_gray_matter.default)(content);
|
|
3765
|
+
if (parsed.data && Object.keys(parsed.data).length > 0) {
|
|
3766
|
+
frontmatter = parsed.data;
|
|
3767
|
+
body = parsed.content;
|
|
3768
|
+
}
|
|
3769
|
+
} catch {
|
|
3770
|
+
}
|
|
3771
|
+
const errors = [];
|
|
3772
|
+
const warnings = [];
|
|
3773
|
+
const pattern = INSTRUCTION_FILE_PATTERNS.find((p) => p.format === format);
|
|
3774
|
+
const minLen = pattern?.minContentLength || 100;
|
|
3775
|
+
if (body.trim().length < minLen) {
|
|
3776
|
+
errors.push({
|
|
3777
|
+
code: "CONTENT_TOO_SHORT",
|
|
3778
|
+
message: `Content is too short for ${FORMAT_LABELS[format]} (minimum ${minLen} chars)`
|
|
3779
|
+
});
|
|
3780
|
+
}
|
|
3781
|
+
const rawName = frontmatter.name || repoMeta.name;
|
|
3782
|
+
const derivedName = sanitizeToSkillName(rawName);
|
|
3783
|
+
const derivedDescription = frontmatter.description || repoMeta.description || extractFirstParagraph(body) || `${FORMAT_LABELS[format]} from ${repoMeta.owner}/${repoMeta.name}`;
|
|
3784
|
+
const inferredPlatform = pattern?.inferredPlatform || "claude";
|
|
3785
|
+
const metadata = {
|
|
3786
|
+
name: derivedName,
|
|
3787
|
+
description: derivedDescription.slice(0, MAX_DESCRIPTION_LENGTH),
|
|
3788
|
+
version: frontmatter.version ? String(frontmatter.version) : void 0,
|
|
3789
|
+
license: frontmatter.license ? String(frontmatter.license) : void 0,
|
|
3790
|
+
author: frontmatter.author ? String(frontmatter.author) : repoMeta.owner,
|
|
3791
|
+
compatibility: {
|
|
3792
|
+
platforms: [inferredPlatform]
|
|
3793
|
+
}
|
|
3794
|
+
};
|
|
3795
|
+
const resources = discoverResources(body);
|
|
3796
|
+
return {
|
|
3797
|
+
metadata,
|
|
3798
|
+
content: body.trim(),
|
|
3799
|
+
resources,
|
|
3800
|
+
validation: {
|
|
3801
|
+
isValid: errors.length === 0,
|
|
3802
|
+
errors,
|
|
3803
|
+
warnings
|
|
3804
|
+
},
|
|
3805
|
+
rawFrontmatter: frontmatter
|
|
3806
|
+
};
|
|
3807
|
+
}
|
|
3808
|
+
function sanitizeToSkillName(input) {
|
|
3809
|
+
return input.toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "").slice(0, MAX_NAME_LENGTH) || "skill";
|
|
3810
|
+
}
|
|
3811
|
+
function extractFirstParagraph(content) {
|
|
3812
|
+
const lines = content.split("\n");
|
|
3813
|
+
let current = "";
|
|
3814
|
+
for (const line of lines) {
|
|
3815
|
+
const trimmed = line.trim();
|
|
3816
|
+
if (trimmed === "" || trimmed.startsWith("#")) {
|
|
3817
|
+
if (current.length >= 20) {
|
|
3818
|
+
return current.trim();
|
|
3819
|
+
}
|
|
3820
|
+
current = "";
|
|
3821
|
+
continue;
|
|
3822
|
+
}
|
|
3823
|
+
current += " " + trimmed;
|
|
3824
|
+
}
|
|
3825
|
+
if (current.length >= 20) {
|
|
3826
|
+
return current.trim();
|
|
3827
|
+
}
|
|
3828
|
+
return null;
|
|
3829
|
+
}
|
|
25
3830
|
|
|
26
3831
|
// src/utils/api.ts
|
|
27
3832
|
import https from "https";
|
|
@@ -29,21 +3834,21 @@ import http from "http";
|
|
|
29
3834
|
var API_BASE_URL = process.env.SKILLHUB_API_URL || "https://skills.palebluedot.live/api";
|
|
30
3835
|
var API_TIMEOUT = parseInt(process.env.SKILLHUB_API_TIMEOUT || "20000");
|
|
31
3836
|
var API_FILES_TIMEOUT = parseInt(process.env.SKILLHUB_API_FILES_TIMEOUT || "45000");
|
|
32
|
-
function httpsRequest(url,
|
|
3837
|
+
function httpsRequest(url, options2 = {}) {
|
|
33
3838
|
return new Promise((resolve, reject) => {
|
|
34
3839
|
const parsedUrl = new URL(url);
|
|
35
3840
|
const isHttps = parsedUrl.protocol === "https:";
|
|
36
3841
|
const lib = isHttps ? https : http;
|
|
37
|
-
const requestTimeout =
|
|
3842
|
+
const requestTimeout = options2.timeout || API_TIMEOUT;
|
|
38
3843
|
const reqOptions = {
|
|
39
3844
|
hostname: parsedUrl.hostname,
|
|
40
3845
|
port: parsedUrl.port || (isHttps ? 443 : 80),
|
|
41
3846
|
path: parsedUrl.pathname + parsedUrl.search,
|
|
42
|
-
method:
|
|
3847
|
+
method: options2.method || "GET",
|
|
43
3848
|
headers: {
|
|
44
3849
|
"User-Agent": "skillhub-cli",
|
|
45
3850
|
"Accept": "application/json",
|
|
46
|
-
...
|
|
3851
|
+
...options2.headers
|
|
47
3852
|
},
|
|
48
3853
|
timeout: requestTimeout
|
|
49
3854
|
};
|
|
@@ -93,21 +3898,21 @@ function httpsRequest(url, options = {}) {
|
|
|
93
3898
|
req.destroy();
|
|
94
3899
|
reject(new Error(`Request timeout after ${requestTimeout / 1e3}s`));
|
|
95
3900
|
});
|
|
96
|
-
if (
|
|
97
|
-
req.write(
|
|
3901
|
+
if (options2.body) {
|
|
3902
|
+
req.write(options2.body);
|
|
98
3903
|
}
|
|
99
3904
|
req.end();
|
|
100
3905
|
});
|
|
101
3906
|
}
|
|
102
|
-
async function searchSkills(query,
|
|
3907
|
+
async function searchSkills(query, options2 = {}) {
|
|
103
3908
|
const params = new URLSearchParams({
|
|
104
3909
|
q: query,
|
|
105
|
-
limit: String(
|
|
106
|
-
page: String(
|
|
107
|
-
sort:
|
|
3910
|
+
limit: String(options2.limit || 10),
|
|
3911
|
+
page: String(options2.page || 1),
|
|
3912
|
+
sort: options2.sort || "downloads"
|
|
108
3913
|
});
|
|
109
|
-
if (
|
|
110
|
-
params.set("platform",
|
|
3914
|
+
if (options2.platform) {
|
|
3915
|
+
params.set("platform", options2.platform);
|
|
111
3916
|
}
|
|
112
3917
|
const response = await httpsRequest(`${API_BASE_URL}/skills?${params}`);
|
|
113
3918
|
if (response.statusCode !== 200) {
|
|
@@ -156,7 +3961,6 @@ async function getSkillFiles(id) {
|
|
|
156
3961
|
|
|
157
3962
|
// src/utils/github.ts
|
|
158
3963
|
import { Octokit } from "@octokit/rest";
|
|
159
|
-
import { INSTRUCTION_FILE_PATTERNS } from "skillhub-core";
|
|
160
3964
|
import https2 from "https";
|
|
161
3965
|
var octokit = null;
|
|
162
3966
|
function getOctokit() {
|
|
@@ -442,7 +4246,7 @@ function truncateAtSectionBoundary(content, limit) {
|
|
|
442
4246
|
}
|
|
443
4247
|
|
|
444
4248
|
// src/commands/install.ts
|
|
445
|
-
async function install(skillId,
|
|
4249
|
+
async function install(skillId, options2) {
|
|
446
4250
|
const spinner = ora("Parsing skill ID...").start();
|
|
447
4251
|
try {
|
|
448
4252
|
const parts = skillId.split("/");
|
|
@@ -453,7 +4257,7 @@ async function install(skillId, options) {
|
|
|
453
4257
|
const [owner, repo, ...rest] = parts;
|
|
454
4258
|
let skillPath = rest.join("/");
|
|
455
4259
|
let skillInfo;
|
|
456
|
-
if (!
|
|
4260
|
+
if (!options2.noApi) {
|
|
457
4261
|
spinner.text = `Connecting to ${process.env.SKILLHUB_API_URL || "https://skills.palebluedot.live"}...`;
|
|
458
4262
|
try {
|
|
459
4263
|
skillInfo = await getSkill(skillId);
|
|
@@ -487,18 +4291,18 @@ async function install(skillId, options) {
|
|
|
487
4291
|
throw error;
|
|
488
4292
|
}
|
|
489
4293
|
}
|
|
490
|
-
const installed = await isSkillInstalled(
|
|
491
|
-
if (installed && !
|
|
4294
|
+
const installed = await isSkillInstalled(options2.platform, skillName, options2.project);
|
|
4295
|
+
if (installed && !options2.force) {
|
|
492
4296
|
spinner.fail(
|
|
493
4297
|
`Skill ${chalk.cyan(skillName)} is already installed. Use ${chalk.yellow("--force")} to overwrite.`
|
|
494
4298
|
);
|
|
495
4299
|
process.exit(1);
|
|
496
4300
|
}
|
|
497
|
-
await ensureSkillsDir(
|
|
4301
|
+
await ensureSkillsDir(options2.platform, options2.project);
|
|
498
4302
|
spinner.text = `Downloading ${skillInfo?.name || skillId}...`;
|
|
499
4303
|
let content;
|
|
500
4304
|
let apiWasReachable = false;
|
|
501
|
-
if (!
|
|
4305
|
+
if (!options2.noApi && skillInfo) {
|
|
502
4306
|
apiWasReachable = true;
|
|
503
4307
|
try {
|
|
504
4308
|
spinner.text = "Downloading skill files...";
|
|
@@ -555,7 +4359,7 @@ async function install(skillId, options) {
|
|
|
555
4359
|
}
|
|
556
4360
|
}
|
|
557
4361
|
const actualName = parsed.metadata.name || skillName;
|
|
558
|
-
const installPath = getSkillPath(
|
|
4362
|
+
const installPath = getSkillPath(options2.platform, actualName, options2.project);
|
|
559
4363
|
const metadataPath = path.join(installPath, ".skillhub.json");
|
|
560
4364
|
if (await fs.pathExists(metadataPath)) {
|
|
561
4365
|
try {
|
|
@@ -567,7 +4371,7 @@ A different skill is already installed with the name "${actualName}":`));
|
|
|
567
4371
|
console.log(chalk.dim(` Existing: ${existingMetadata.skillId}`));
|
|
568
4372
|
console.log(chalk.dim(` New: ${skillId}`));
|
|
569
4373
|
console.log();
|
|
570
|
-
if (!
|
|
4374
|
+
if (!options2.force) {
|
|
571
4375
|
console.log(chalk.red("Installation cancelled to prevent overwriting."));
|
|
572
4376
|
console.log(chalk.dim("Use --force to overwrite the existing skill."));
|
|
573
4377
|
process.exit(1);
|
|
@@ -578,36 +4382,36 @@ A different skill is already installed with the name "${actualName}":`));
|
|
|
578
4382
|
} catch {
|
|
579
4383
|
}
|
|
580
4384
|
}
|
|
581
|
-
if (installed &&
|
|
4385
|
+
if (installed && options2.force) {
|
|
582
4386
|
await fs.remove(installPath);
|
|
583
4387
|
}
|
|
584
4388
|
spinner.text = "Installing skill...";
|
|
585
4389
|
await fs.ensureDir(installPath);
|
|
586
|
-
const platformFileName = getPlatformFileName(
|
|
587
|
-
const { content: transformedContent, warnings: transformWarnings } = transformForPlatform(
|
|
4390
|
+
const platformFileName = getPlatformFileName(options2.platform, actualName);
|
|
4391
|
+
const { content: transformedContent, warnings: transformWarnings } = transformForPlatform(options2.platform, content.skillMd, parsed);
|
|
588
4392
|
for (const warning of transformWarnings) {
|
|
589
4393
|
console.log(chalk.yellow(` Warning: ${warning}`));
|
|
590
4394
|
}
|
|
591
|
-
if (isFlatFilePlatform(
|
|
4395
|
+
if (isFlatFilePlatform(options2.platform)) {
|
|
592
4396
|
const platformFilePath2 = getPlatformFilePath(
|
|
593
|
-
|
|
4397
|
+
options2.platform,
|
|
594
4398
|
actualName,
|
|
595
4399
|
platformFileName,
|
|
596
|
-
|
|
4400
|
+
options2.project
|
|
597
4401
|
);
|
|
598
4402
|
await fs.writeFile(platformFilePath2, transformedContent);
|
|
599
4403
|
} else {
|
|
600
4404
|
await fs.writeFile(path.join(installPath, platformFileName), transformedContent);
|
|
601
4405
|
}
|
|
602
|
-
if (shouldKeepOriginal(
|
|
4406
|
+
if (shouldKeepOriginal(options2.platform)) {
|
|
603
4407
|
await fs.writeFile(path.join(installPath, "SKILL.md"), content.skillMd);
|
|
604
4408
|
}
|
|
605
4409
|
const canonicalId = skillInfo?.id || skillId;
|
|
606
|
-
const platformFilePath = isFlatFilePlatform(
|
|
4410
|
+
const platformFilePath = isFlatFilePlatform(options2.platform) ? getPlatformFilePath(options2.platform, actualName, platformFileName, options2.project) : null;
|
|
607
4411
|
await fs.writeJson(path.join(installPath, ".skillhub.json"), {
|
|
608
4412
|
skillId: canonicalId,
|
|
609
4413
|
installedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
610
|
-
platform:
|
|
4414
|
+
platform: options2.platform,
|
|
611
4415
|
version: parsed.metadata.version || null,
|
|
612
4416
|
platformFileName,
|
|
613
4417
|
platformFilePath
|
|
@@ -629,7 +4433,7 @@ A different skill is already installed with the name "${actualName}":`));
|
|
|
629
4433
|
}
|
|
630
4434
|
}
|
|
631
4435
|
const trackingId = skillInfo?.id || skillId;
|
|
632
|
-
await trackInstall(trackingId,
|
|
4436
|
+
await trackInstall(trackingId, options2.platform, "cli");
|
|
633
4437
|
spinner.succeed(`Skill ${chalk.green(actualName)} installed successfully!`);
|
|
634
4438
|
console.log();
|
|
635
4439
|
console.log(chalk.dim(`Path: ${installPath}`));
|
|
@@ -640,9 +4444,9 @@ A different skill is already installed with the name "${actualName}":`));
|
|
|
640
4444
|
}
|
|
641
4445
|
console.log(chalk.yellow("Usage:"));
|
|
642
4446
|
console.log(
|
|
643
|
-
` This skill will be automatically activated when your ${getPlatformName(
|
|
4447
|
+
` This skill will be automatically activated when your ${getPlatformName(options2.platform)} agent recognizes it's relevant.`
|
|
644
4448
|
);
|
|
645
|
-
const setupInstructions = getPlatformSetupInstructions(
|
|
4449
|
+
const setupInstructions = getPlatformSetupInstructions(options2.platform, installPath);
|
|
646
4450
|
if (setupInstructions) {
|
|
647
4451
|
console.log();
|
|
648
4452
|
console.log(chalk.cyan("Next Steps:"));
|
|
@@ -685,12 +4489,12 @@ function getPlatformSetupInstructions(platform, installPath) {
|
|
|
685
4489
|
return null;
|
|
686
4490
|
}
|
|
687
4491
|
}
|
|
688
|
-
var MAIN_FILE_NAMES =
|
|
4492
|
+
var MAIN_FILE_NAMES = INSTRUCTION_FILE_PATTERNS.map((p) => p.filename);
|
|
689
4493
|
function convertCachedFilesToSkillContent(response, sourceFormat = "skill.md") {
|
|
690
4494
|
let skillMd = "";
|
|
691
4495
|
const scripts = [];
|
|
692
4496
|
const references = [];
|
|
693
|
-
const expectedPattern =
|
|
4497
|
+
const expectedPattern = INSTRUCTION_FILE_PATTERNS.find((p) => p.format === sourceFormat);
|
|
694
4498
|
const expectedFilename = expectedPattern?.filename || "SKILL.md";
|
|
695
4499
|
for (const file of response.files) {
|
|
696
4500
|
if (!file.content) continue;
|
|
@@ -723,14 +4527,14 @@ function convertCachedFilesToSkillContent(response, sourceFormat = "skill.md") {
|
|
|
723
4527
|
// src/commands/search.ts
|
|
724
4528
|
import chalk2 from "chalk";
|
|
725
4529
|
import ora2 from "ora";
|
|
726
|
-
async function search(query,
|
|
4530
|
+
async function search(query, options2) {
|
|
727
4531
|
const spinner = ora2("Searching skills...").start();
|
|
728
4532
|
try {
|
|
729
|
-
const limit = parseInt(
|
|
730
|
-
const page = parseInt(
|
|
731
|
-
const sort =
|
|
4533
|
+
const limit = parseInt(options2.limit || "10");
|
|
4534
|
+
const page = parseInt(options2.page || "1");
|
|
4535
|
+
const sort = options2.sort || "downloads";
|
|
732
4536
|
const result = await searchSkills(query, {
|
|
733
|
-
platform:
|
|
4537
|
+
platform: options2.platform,
|
|
734
4538
|
limit,
|
|
735
4539
|
page,
|
|
736
4540
|
sort
|
|
@@ -818,13 +4622,12 @@ function getSecurityBadge(score) {
|
|
|
818
4622
|
import fs2 from "fs-extra";
|
|
819
4623
|
import * as path2 from "path";
|
|
820
4624
|
import chalk3 from "chalk";
|
|
821
|
-
import { parseSkillMd as parseSkillMd2 } from "skillhub-core";
|
|
822
4625
|
var ALL_PLATFORMS = ["claude", "codex", "copilot", "cursor", "windsurf"];
|
|
823
|
-
async function list(
|
|
824
|
-
const platforms =
|
|
4626
|
+
async function list(options2) {
|
|
4627
|
+
const platforms = options2.platform ? [options2.platform] : ALL_PLATFORMS;
|
|
825
4628
|
let totalSkills = 0;
|
|
826
|
-
const checkGlobal =
|
|
827
|
-
const checkProject =
|
|
4629
|
+
const checkGlobal = options2.all || !options2.project;
|
|
4630
|
+
const checkProject = options2.all || options2.project;
|
|
828
4631
|
if (checkGlobal) {
|
|
829
4632
|
for (const platform of platforms) {
|
|
830
4633
|
const skills = await getInstalledSkills(platform, false);
|
|
@@ -832,7 +4635,7 @@ async function list(options) {
|
|
|
832
4635
|
continue;
|
|
833
4636
|
}
|
|
834
4637
|
totalSkills += skills.length;
|
|
835
|
-
const header =
|
|
4638
|
+
const header = options2.all ? `${getPlatformName2(platform)} - Global (${skills.length} skills)` : `${getPlatformName2(platform)} (${skills.length} skills)`;
|
|
836
4639
|
console.log(chalk3.bold(`
|
|
837
4640
|
${header}:`));
|
|
838
4641
|
console.log(chalk3.dim("\u2500".repeat(60)));
|
|
@@ -852,7 +4655,7 @@ ${header}:`));
|
|
|
852
4655
|
continue;
|
|
853
4656
|
}
|
|
854
4657
|
totalSkills += skills.length;
|
|
855
|
-
const header =
|
|
4658
|
+
const header = options2.all ? `${getPlatformName2(platform)} - Project (${skills.length} skills)` : `${getPlatformName2(platform)} (${skills.length} skills)`;
|
|
856
4659
|
console.log(chalk3.bold(`
|
|
857
4660
|
${header}:`));
|
|
858
4661
|
console.log(chalk3.dim("\u2500".repeat(60)));
|
|
@@ -867,10 +4670,10 @@ ${header}:`));
|
|
|
867
4670
|
}
|
|
868
4671
|
}
|
|
869
4672
|
if (totalSkills === 0) {
|
|
870
|
-
if (
|
|
4673
|
+
if (options2.project) {
|
|
871
4674
|
console.log(chalk3.yellow("\nNo skills installed in project."));
|
|
872
4675
|
console.log(chalk3.dim("Install a skill with: npx skillhub install <skill-id> --project"));
|
|
873
|
-
} else if (
|
|
4676
|
+
} else if (options2.all) {
|
|
874
4677
|
console.log(chalk3.yellow("\nNo skills installed (global or project)."));
|
|
875
4678
|
} else {
|
|
876
4679
|
console.log(chalk3.yellow("\nNo skills installed globally."));
|
|
@@ -906,7 +4709,7 @@ async function getInstalledSkills(platform, project = false) {
|
|
|
906
4709
|
try {
|
|
907
4710
|
if (hasSkillMd) {
|
|
908
4711
|
const content = await fs2.readFile(skillMdPath, "utf-8");
|
|
909
|
-
const parsed =
|
|
4712
|
+
const parsed = parseSkillMd(content);
|
|
910
4713
|
skills.push({
|
|
911
4714
|
name: parsed.metadata.name || entry.name,
|
|
912
4715
|
description: parsed.metadata.description,
|
|
@@ -944,9 +4747,9 @@ function getPlatformName2(platform) {
|
|
|
944
4747
|
|
|
945
4748
|
// src/commands/config.ts
|
|
946
4749
|
import chalk4 from "chalk";
|
|
947
|
-
async function config(
|
|
4750
|
+
async function config(options2) {
|
|
948
4751
|
const currentConfig = await loadConfig();
|
|
949
|
-
if (
|
|
4752
|
+
if (options2.list || !options2.set && !options2.get) {
|
|
950
4753
|
console.log(chalk4.bold("SkillHub CLI Configuration:\n"));
|
|
951
4754
|
console.log(chalk4.dim(`Config file: ${getConfigPath()}
|
|
952
4755
|
`));
|
|
@@ -964,18 +4767,18 @@ async function config(options) {
|
|
|
964
4767
|
}
|
|
965
4768
|
return;
|
|
966
4769
|
}
|
|
967
|
-
if (
|
|
968
|
-
const value = currentConfig[
|
|
4770
|
+
if (options2.get) {
|
|
4771
|
+
const value = currentConfig[options2.get];
|
|
969
4772
|
if (value === void 0) {
|
|
970
|
-
console.log(chalk4.yellow(`Config '${
|
|
4773
|
+
console.log(chalk4.yellow(`Config '${options2.get}' is not set.`));
|
|
971
4774
|
return;
|
|
972
4775
|
}
|
|
973
|
-
const displayValue =
|
|
4776
|
+
const displayValue = options2.get.toLowerCase().includes("token") ? maskSecret(String(value)) : String(value);
|
|
974
4777
|
console.log(displayValue);
|
|
975
4778
|
return;
|
|
976
4779
|
}
|
|
977
|
-
if (
|
|
978
|
-
const [key, ...valueParts] =
|
|
4780
|
+
if (options2.set) {
|
|
4781
|
+
const [key, ...valueParts] = options2.set.split("=");
|
|
979
4782
|
const value = valueParts.join("=");
|
|
980
4783
|
if (!key || value === void 0) {
|
|
981
4784
|
console.error(chalk4.red("Invalid format. Use: --set key=value"));
|
|
@@ -1000,38 +4803,38 @@ var pkg = require2("../package.json");
|
|
|
1000
4803
|
var VERSION = pkg.version;
|
|
1001
4804
|
var program = new Command();
|
|
1002
4805
|
program.name("skillhub").description("CLI for managing AI Agent skills").version(VERSION);
|
|
1003
|
-
program.command("install <skill-id>").description("Install a skill from the registry").option("-p, --platform <platform>", "Target platform (claude, codex, copilot, cursor, windsurf)").option("--project", "Install in the current project instead of globally").option("-f, --force", "Overwrite existing skill").option("--no-api", "Skip API lookup and fetch directly from GitHub").action(async (skillId,
|
|
4806
|
+
program.command("install <skill-id>").description("Install a skill from the registry").option("-p, --platform <platform>", "Target platform (claude, codex, copilot, cursor, windsurf)").option("--project", "Install in the current project instead of globally").option("-f, --force", "Overwrite existing skill").option("--no-api", "Skip API lookup and fetch directly from GitHub").action(async (skillId, options2) => {
|
|
1004
4807
|
const userConfig = await loadConfig();
|
|
1005
|
-
const platform =
|
|
4808
|
+
const platform = options2.platform || userConfig.defaultPlatform || "claude";
|
|
1006
4809
|
await install(skillId, {
|
|
1007
4810
|
platform,
|
|
1008
|
-
project:
|
|
1009
|
-
force:
|
|
1010
|
-
noApi: !
|
|
4811
|
+
project: options2.project,
|
|
4812
|
+
force: options2.force,
|
|
4813
|
+
noApi: !options2.api
|
|
1011
4814
|
// Commander converts --no-api to api: false
|
|
1012
4815
|
});
|
|
1013
4816
|
});
|
|
1014
|
-
program.command("search <query>").description("Search for skills in the registry").option("-p, --platform <platform>", "Filter by platform").option("-s, --sort <sort>", "Sort by: downloads, stars, rating, recent", "downloads").option("-l, --limit <number>", "Number of results", "10").option("--page <number>", "Page number", "1").action(async (query,
|
|
1015
|
-
await search(query,
|
|
4817
|
+
program.command("search <query>").description("Search for skills in the registry").option("-p, --platform <platform>", "Filter by platform").option("-s, --sort <sort>", "Sort by: downloads, stars, rating, recent", "downloads").option("-l, --limit <number>", "Number of results", "10").option("--page <number>", "Page number", "1").action(async (query, options2) => {
|
|
4818
|
+
await search(query, options2);
|
|
1016
4819
|
});
|
|
1017
|
-
program.command("list").description("List installed skills").option("-p, --platform <platform>", "Filter by platform").option("--project", "List skills in the current project").option("--all", "List both global and project skills").action(async (
|
|
1018
|
-
await list(
|
|
4820
|
+
program.command("list").description("List installed skills").option("-p, --platform <platform>", "Filter by platform").option("--project", "List skills in the current project").option("--all", "List both global and project skills").action(async (options2) => {
|
|
4821
|
+
await list(options2);
|
|
1019
4822
|
});
|
|
1020
|
-
program.command("config").description("Manage CLI configuration").option("--set <key=value>", "Set a configuration value").option("--get <key>", "Get a configuration value").option("--list", "List all configuration values").action(async (
|
|
1021
|
-
await config(
|
|
4823
|
+
program.command("config").description("Manage CLI configuration").option("--set <key=value>", "Set a configuration value").option("--get <key>", "Get a configuration value").option("--list", "List all configuration values").action(async (options2) => {
|
|
4824
|
+
await config(options2);
|
|
1022
4825
|
});
|
|
1023
|
-
program.command("uninstall <skill-name>").description("Uninstall a skill").option("-p, --platform <platform>", "Target platform").option("--project", "Uninstall from project instead of globally").action(async (skillName,
|
|
4826
|
+
program.command("uninstall <skill-name>").description("Uninstall a skill").option("-p, --platform <platform>", "Target platform").option("--project", "Uninstall from project instead of globally").action(async (skillName, options2) => {
|
|
1024
4827
|
const fs3 = await import("fs-extra");
|
|
1025
4828
|
const pathModule = await import("path");
|
|
1026
|
-
const { getSkillPath: getSkillPath2, isSkillInstalled: isSkillInstalled2 } = await import("./paths-
|
|
4829
|
+
const { getSkillPath: getSkillPath2, isSkillInstalled: isSkillInstalled2 } = await import("./paths-XP6IKJAN.js");
|
|
1027
4830
|
const userConfig = await loadConfig();
|
|
1028
|
-
const platform =
|
|
1029
|
-
const installed = await isSkillInstalled2(platform, skillName,
|
|
4831
|
+
const platform = options2.platform || userConfig.defaultPlatform || "claude";
|
|
4832
|
+
const installed = await isSkillInstalled2(platform, skillName, options2.project);
|
|
1030
4833
|
if (!installed) {
|
|
1031
4834
|
console.log(chalk5.yellow(`Skill ${skillName} is not installed.`));
|
|
1032
4835
|
process.exit(1);
|
|
1033
4836
|
}
|
|
1034
|
-
const skillPath = getSkillPath2(platform, skillName,
|
|
4837
|
+
const skillPath = getSkillPath2(platform, skillName, options2.project);
|
|
1035
4838
|
const metadataPath = pathModule.join(skillPath, ".skillhub.json");
|
|
1036
4839
|
if (await fs3.default.pathExists(metadataPath)) {
|
|
1037
4840
|
try {
|
|
@@ -1045,16 +4848,16 @@ program.command("uninstall <skill-name>").description("Uninstall a skill").optio
|
|
|
1045
4848
|
await fs3.default.remove(skillPath);
|
|
1046
4849
|
console.log(chalk5.green(`Skill ${skillName} uninstalled successfully.`));
|
|
1047
4850
|
});
|
|
1048
|
-
program.command("update [skill-name]").description("Update installed skills").option("-p, --platform <platform>", "Target platform").option("--all", "Update all installed skills").action(async (skillName,
|
|
4851
|
+
program.command("update [skill-name]").description("Update installed skills").option("-p, --platform <platform>", "Target platform").option("--all", "Update all installed skills").action(async (skillName, options2) => {
|
|
1049
4852
|
const fsExtra = await import("fs-extra");
|
|
1050
4853
|
const pathModule = await import("path");
|
|
1051
|
-
const { getSkillsPath: getSkillsPath2, getSkillPath: getSkillPath2 } = await import("./paths-
|
|
4854
|
+
const { getSkillsPath: getSkillsPath2, getSkillPath: getSkillPath2 } = await import("./paths-XP6IKJAN.js");
|
|
1052
4855
|
const userConfig = await loadConfig();
|
|
1053
|
-
const platform =
|
|
4856
|
+
const platform = options2.platform || userConfig.defaultPlatform || "claude";
|
|
1054
4857
|
const ALL_PLATFORMS2 = ["claude", "codex", "copilot", "cursor", "windsurf"];
|
|
1055
|
-
if (
|
|
4858
|
+
if (options2.all) {
|
|
1056
4859
|
console.log(chalk5.cyan("\nUpdating all installed skills...\n"));
|
|
1057
|
-
const platforms =
|
|
4860
|
+
const platforms = options2.platform ? [platform] : ALL_PLATFORMS2;
|
|
1058
4861
|
let updated = 0;
|
|
1059
4862
|
let failed = 0;
|
|
1060
4863
|
let skipped = 0;
|
|
@@ -1131,3 +4934,21 @@ program.parse();
|
|
|
1131
4934
|
if (!process.argv.slice(2).length) {
|
|
1132
4935
|
program.help();
|
|
1133
4936
|
}
|
|
4937
|
+
/*! Bundled license information:
|
|
4938
|
+
|
|
4939
|
+
is-extendable/index.js:
|
|
4940
|
+
(*!
|
|
4941
|
+
* is-extendable <https://github.com/jonschlinkert/is-extendable>
|
|
4942
|
+
*
|
|
4943
|
+
* Copyright (c) 2015, Jon Schlinkert.
|
|
4944
|
+
* Licensed under the MIT License.
|
|
4945
|
+
*)
|
|
4946
|
+
|
|
4947
|
+
strip-bom-string/index.js:
|
|
4948
|
+
(*!
|
|
4949
|
+
* strip-bom-string <https://github.com/jonschlinkert/strip-bom-string>
|
|
4950
|
+
*
|
|
4951
|
+
* Copyright (c) 2015, 2017, Jon Schlinkert.
|
|
4952
|
+
* Released under the MIT License.
|
|
4953
|
+
*)
|
|
4954
|
+
*/
|