@rspress/core 1.8.4 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +89 -3708
- package/dist/index.js.map +1 -1
- package/dist/loader.js +21 -3643
- package/dist/loader.js.map +1 -1
- package/package.json +12 -15
package/dist/index.js
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import { createRequire } from "module";
|
|
2
2
|
const { url } = import.meta;
|
|
3
3
|
const require = createRequire(url);
|
|
4
|
-
var __create = Object.create;
|
|
5
4
|
var __defProp = Object.defineProperty;
|
|
6
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
5
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
6
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
12
7
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
@@ -15,3617 +10,40 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
15
10
|
return require.apply(this, arguments);
|
|
16
11
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
17
12
|
});
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
};
|
|
45
|
-
var __privateGet = (obj, member, getter) => {
|
|
46
|
-
__accessCheck(obj, member, "read from private field");
|
|
47
|
-
return getter ? getter.call(obj) : member.get(obj);
|
|
48
|
-
};
|
|
49
|
-
var __privateAdd = (obj, member, value) => {
|
|
50
|
-
if (member.has(obj))
|
|
51
|
-
throw TypeError("Cannot add the same private member more than once");
|
|
52
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
53
|
-
};
|
|
54
|
-
var __privateSet = (obj, member, value, setter) => {
|
|
55
|
-
__accessCheck(obj, member, "write to private field");
|
|
56
|
-
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
57
|
-
return value;
|
|
58
|
-
};
|
|
59
|
-
var __privateMethod = (obj, member, method) => {
|
|
60
|
-
__accessCheck(obj, member, "access private method");
|
|
61
|
-
return method;
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
// ../../node_modules/.pnpm/kind-of@6.0.3/node_modules/kind-of/index.js
|
|
65
|
-
var require_kind_of = __commonJS({
|
|
66
|
-
"../../node_modules/.pnpm/kind-of@6.0.3/node_modules/kind-of/index.js"(exports2, module2) {
|
|
67
|
-
var toString = Object.prototype.toString;
|
|
68
|
-
module2.exports = function kindOf(val) {
|
|
69
|
-
if (val === void 0)
|
|
70
|
-
return "undefined";
|
|
71
|
-
if (val === null)
|
|
72
|
-
return "null";
|
|
73
|
-
var type = typeof val;
|
|
74
|
-
if (type === "boolean")
|
|
75
|
-
return "boolean";
|
|
76
|
-
if (type === "string")
|
|
77
|
-
return "string";
|
|
78
|
-
if (type === "number")
|
|
79
|
-
return "number";
|
|
80
|
-
if (type === "symbol")
|
|
81
|
-
return "symbol";
|
|
82
|
-
if (type === "function") {
|
|
83
|
-
return isGeneratorFn(val) ? "generatorfunction" : "function";
|
|
84
|
-
}
|
|
85
|
-
if (isArray(val))
|
|
86
|
-
return "array";
|
|
87
|
-
if (isBuffer(val))
|
|
88
|
-
return "buffer";
|
|
89
|
-
if (isArguments(val))
|
|
90
|
-
return "arguments";
|
|
91
|
-
if (isDate(val))
|
|
92
|
-
return "date";
|
|
93
|
-
if (isError(val))
|
|
94
|
-
return "error";
|
|
95
|
-
if (isRegexp(val))
|
|
96
|
-
return "regexp";
|
|
97
|
-
switch (ctorName(val)) {
|
|
98
|
-
case "Symbol":
|
|
99
|
-
return "symbol";
|
|
100
|
-
case "Promise":
|
|
101
|
-
return "promise";
|
|
102
|
-
case "WeakMap":
|
|
103
|
-
return "weakmap";
|
|
104
|
-
case "WeakSet":
|
|
105
|
-
return "weakset";
|
|
106
|
-
case "Map":
|
|
107
|
-
return "map";
|
|
108
|
-
case "Set":
|
|
109
|
-
return "set";
|
|
110
|
-
case "Int8Array":
|
|
111
|
-
return "int8array";
|
|
112
|
-
case "Uint8Array":
|
|
113
|
-
return "uint8array";
|
|
114
|
-
case "Uint8ClampedArray":
|
|
115
|
-
return "uint8clampedarray";
|
|
116
|
-
case "Int16Array":
|
|
117
|
-
return "int16array";
|
|
118
|
-
case "Uint16Array":
|
|
119
|
-
return "uint16array";
|
|
120
|
-
case "Int32Array":
|
|
121
|
-
return "int32array";
|
|
122
|
-
case "Uint32Array":
|
|
123
|
-
return "uint32array";
|
|
124
|
-
case "Float32Array":
|
|
125
|
-
return "float32array";
|
|
126
|
-
case "Float64Array":
|
|
127
|
-
return "float64array";
|
|
128
|
-
}
|
|
129
|
-
if (isGeneratorObj(val)) {
|
|
130
|
-
return "generator";
|
|
131
|
-
}
|
|
132
|
-
type = toString.call(val);
|
|
133
|
-
switch (type) {
|
|
134
|
-
case "[object Object]":
|
|
135
|
-
return "object";
|
|
136
|
-
case "[object Map Iterator]":
|
|
137
|
-
return "mapiterator";
|
|
138
|
-
case "[object Set Iterator]":
|
|
139
|
-
return "setiterator";
|
|
140
|
-
case "[object String Iterator]":
|
|
141
|
-
return "stringiterator";
|
|
142
|
-
case "[object Array Iterator]":
|
|
143
|
-
return "arrayiterator";
|
|
144
|
-
}
|
|
145
|
-
return type.slice(8, -1).toLowerCase().replace(/\s/g, "");
|
|
146
|
-
};
|
|
147
|
-
function ctorName(val) {
|
|
148
|
-
return typeof val.constructor === "function" ? val.constructor.name : null;
|
|
149
|
-
}
|
|
150
|
-
function isArray(val) {
|
|
151
|
-
if (Array.isArray)
|
|
152
|
-
return Array.isArray(val);
|
|
153
|
-
return val instanceof Array;
|
|
154
|
-
}
|
|
155
|
-
function isError(val) {
|
|
156
|
-
return val instanceof Error || typeof val.message === "string" && val.constructor && typeof val.constructor.stackTraceLimit === "number";
|
|
157
|
-
}
|
|
158
|
-
function isDate(val) {
|
|
159
|
-
if (val instanceof Date)
|
|
160
|
-
return true;
|
|
161
|
-
return typeof val.toDateString === "function" && typeof val.getDate === "function" && typeof val.setDate === "function";
|
|
162
|
-
}
|
|
163
|
-
function isRegexp(val) {
|
|
164
|
-
if (val instanceof RegExp)
|
|
165
|
-
return true;
|
|
166
|
-
return typeof val.flags === "string" && typeof val.ignoreCase === "boolean" && typeof val.multiline === "boolean" && typeof val.global === "boolean";
|
|
167
|
-
}
|
|
168
|
-
function isGeneratorFn(name, val) {
|
|
169
|
-
return ctorName(name) === "GeneratorFunction";
|
|
170
|
-
}
|
|
171
|
-
function isGeneratorObj(val) {
|
|
172
|
-
return typeof val.throw === "function" && typeof val.return === "function" && typeof val.next === "function";
|
|
173
|
-
}
|
|
174
|
-
function isArguments(val) {
|
|
175
|
-
try {
|
|
176
|
-
if (typeof val.length === "number" && typeof val.callee === "function") {
|
|
177
|
-
return true;
|
|
178
|
-
}
|
|
179
|
-
} catch (err) {
|
|
180
|
-
if (err.message.indexOf("callee") !== -1) {
|
|
181
|
-
return true;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
return false;
|
|
185
|
-
}
|
|
186
|
-
function isBuffer(val) {
|
|
187
|
-
if (val.constructor && typeof val.constructor.isBuffer === "function") {
|
|
188
|
-
return val.constructor.isBuffer(val);
|
|
189
|
-
}
|
|
190
|
-
return false;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
// ../../node_modules/.pnpm/is-extendable@0.1.1/node_modules/is-extendable/index.js
|
|
196
|
-
var require_is_extendable = __commonJS({
|
|
197
|
-
"../../node_modules/.pnpm/is-extendable@0.1.1/node_modules/is-extendable/index.js"(exports2, module2) {
|
|
198
|
-
"use strict";
|
|
199
|
-
module2.exports = function isExtendable(val) {
|
|
200
|
-
return typeof val !== "undefined" && val !== null && (typeof val === "object" || typeof val === "function");
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
});
|
|
204
|
-
|
|
205
|
-
// ../../node_modules/.pnpm/extend-shallow@2.0.1/node_modules/extend-shallow/index.js
|
|
206
|
-
var require_extend_shallow = __commonJS({
|
|
207
|
-
"../../node_modules/.pnpm/extend-shallow@2.0.1/node_modules/extend-shallow/index.js"(exports2, module2) {
|
|
208
|
-
"use strict";
|
|
209
|
-
var isObject = require_is_extendable();
|
|
210
|
-
module2.exports = function extend(o) {
|
|
211
|
-
if (!isObject(o)) {
|
|
212
|
-
o = {};
|
|
213
|
-
}
|
|
214
|
-
var len = arguments.length;
|
|
215
|
-
for (var i = 1; i < len; i++) {
|
|
216
|
-
var obj = arguments[i];
|
|
217
|
-
if (isObject(obj)) {
|
|
218
|
-
assign(o, obj);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
return o;
|
|
222
|
-
};
|
|
223
|
-
function assign(a, b) {
|
|
224
|
-
for (var key in b) {
|
|
225
|
-
if (hasOwn(b, key)) {
|
|
226
|
-
a[key] = b[key];
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
function hasOwn(obj, key) {
|
|
231
|
-
return Object.prototype.hasOwnProperty.call(obj, key);
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
});
|
|
235
|
-
|
|
236
|
-
// ../../node_modules/.pnpm/section-matter@1.0.0/node_modules/section-matter/index.js
|
|
237
|
-
var require_section_matter = __commonJS({
|
|
238
|
-
"../../node_modules/.pnpm/section-matter@1.0.0/node_modules/section-matter/index.js"(exports2, module2) {
|
|
239
|
-
"use strict";
|
|
240
|
-
var typeOf = require_kind_of();
|
|
241
|
-
var extend = require_extend_shallow();
|
|
242
|
-
module2.exports = function(input, options2) {
|
|
243
|
-
if (typeof options2 === "function") {
|
|
244
|
-
options2 = { parse: options2 };
|
|
245
|
-
}
|
|
246
|
-
var file = toObject(input);
|
|
247
|
-
var defaults = { section_delimiter: "---", parse: identity };
|
|
248
|
-
var opts = extend({}, defaults, options2);
|
|
249
|
-
var delim = opts.section_delimiter;
|
|
250
|
-
var lines = file.content.split(/\r?\n/);
|
|
251
|
-
var sections = null;
|
|
252
|
-
var section = createSection();
|
|
253
|
-
var content = [];
|
|
254
|
-
var stack = [];
|
|
255
|
-
function initSections(val) {
|
|
256
|
-
file.content = val;
|
|
257
|
-
sections = [];
|
|
258
|
-
content = [];
|
|
259
|
-
}
|
|
260
|
-
function closeSection(val) {
|
|
261
|
-
if (stack.length) {
|
|
262
|
-
section.key = getKey(stack[0], delim);
|
|
263
|
-
section.content = val;
|
|
264
|
-
opts.parse(section, sections);
|
|
265
|
-
sections.push(section);
|
|
266
|
-
section = createSection();
|
|
267
|
-
content = [];
|
|
268
|
-
stack = [];
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
for (var i = 0; i < lines.length; i++) {
|
|
272
|
-
var line = lines[i];
|
|
273
|
-
var len = stack.length;
|
|
274
|
-
var ln = line.trim();
|
|
275
|
-
if (isDelimiter(ln, delim)) {
|
|
276
|
-
if (ln.length === 3 && i !== 0) {
|
|
277
|
-
if (len === 0 || len === 2) {
|
|
278
|
-
content.push(line);
|
|
279
|
-
continue;
|
|
280
|
-
}
|
|
281
|
-
stack.push(ln);
|
|
282
|
-
section.data = content.join("\n");
|
|
283
|
-
content = [];
|
|
284
|
-
continue;
|
|
285
|
-
}
|
|
286
|
-
if (sections === null) {
|
|
287
|
-
initSections(content.join("\n"));
|
|
288
|
-
}
|
|
289
|
-
if (len === 2) {
|
|
290
|
-
closeSection(content.join("\n"));
|
|
291
|
-
}
|
|
292
|
-
stack.push(ln);
|
|
293
|
-
continue;
|
|
294
|
-
}
|
|
295
|
-
content.push(line);
|
|
296
|
-
}
|
|
297
|
-
if (sections === null) {
|
|
298
|
-
initSections(content.join("\n"));
|
|
299
|
-
} else {
|
|
300
|
-
closeSection(content.join("\n"));
|
|
301
|
-
}
|
|
302
|
-
file.sections = sections;
|
|
303
|
-
return file;
|
|
304
|
-
};
|
|
305
|
-
function isDelimiter(line, delim) {
|
|
306
|
-
if (line.slice(0, delim.length) !== delim) {
|
|
307
|
-
return false;
|
|
308
|
-
}
|
|
309
|
-
if (line.charAt(delim.length + 1) === delim.slice(-1)) {
|
|
310
|
-
return false;
|
|
311
|
-
}
|
|
312
|
-
return true;
|
|
313
|
-
}
|
|
314
|
-
function toObject(input) {
|
|
315
|
-
if (typeOf(input) !== "object") {
|
|
316
|
-
input = { content: input };
|
|
317
|
-
}
|
|
318
|
-
if (typeof input.content !== "string" && !isBuffer(input.content)) {
|
|
319
|
-
throw new TypeError("expected a buffer or string");
|
|
320
|
-
}
|
|
321
|
-
input.content = input.content.toString();
|
|
322
|
-
input.sections = [];
|
|
323
|
-
return input;
|
|
324
|
-
}
|
|
325
|
-
function getKey(val, delim) {
|
|
326
|
-
return val ? val.slice(delim.length).trim() : "";
|
|
327
|
-
}
|
|
328
|
-
function createSection() {
|
|
329
|
-
return { key: "", data: "", content: "" };
|
|
330
|
-
}
|
|
331
|
-
function identity(val) {
|
|
332
|
-
return val;
|
|
333
|
-
}
|
|
334
|
-
function isBuffer(val) {
|
|
335
|
-
if (val && val.constructor && typeof val.constructor.isBuffer === "function") {
|
|
336
|
-
return val.constructor.isBuffer(val);
|
|
337
|
-
}
|
|
338
|
-
return false;
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
});
|
|
342
|
-
|
|
343
|
-
// ../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/common.js
|
|
344
|
-
var require_common = __commonJS({
|
|
345
|
-
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/common.js"(exports2, module2) {
|
|
346
|
-
"use strict";
|
|
347
|
-
function isNothing(subject) {
|
|
348
|
-
return typeof subject === "undefined" || subject === null;
|
|
349
|
-
}
|
|
350
|
-
function isObject(subject) {
|
|
351
|
-
return typeof subject === "object" && subject !== null;
|
|
352
|
-
}
|
|
353
|
-
function toArray(sequence) {
|
|
354
|
-
if (Array.isArray(sequence))
|
|
355
|
-
return sequence;
|
|
356
|
-
else if (isNothing(sequence))
|
|
357
|
-
return [];
|
|
358
|
-
return [sequence];
|
|
359
|
-
}
|
|
360
|
-
function extend(target, source) {
|
|
361
|
-
var index, length, key, sourceKeys;
|
|
362
|
-
if (source) {
|
|
363
|
-
sourceKeys = Object.keys(source);
|
|
364
|
-
for (index = 0, length = sourceKeys.length; index < length; index += 1) {
|
|
365
|
-
key = sourceKeys[index];
|
|
366
|
-
target[key] = source[key];
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
return target;
|
|
370
|
-
}
|
|
371
|
-
function repeat(string, count) {
|
|
372
|
-
var result = "", cycle;
|
|
373
|
-
for (cycle = 0; cycle < count; cycle += 1) {
|
|
374
|
-
result += string;
|
|
375
|
-
}
|
|
376
|
-
return result;
|
|
377
|
-
}
|
|
378
|
-
function isNegativeZero(number) {
|
|
379
|
-
return number === 0 && Number.NEGATIVE_INFINITY === 1 / number;
|
|
380
|
-
}
|
|
381
|
-
module2.exports.isNothing = isNothing;
|
|
382
|
-
module2.exports.isObject = isObject;
|
|
383
|
-
module2.exports.toArray = toArray;
|
|
384
|
-
module2.exports.repeat = repeat;
|
|
385
|
-
module2.exports.isNegativeZero = isNegativeZero;
|
|
386
|
-
module2.exports.extend = extend;
|
|
387
|
-
}
|
|
388
|
-
});
|
|
389
|
-
|
|
390
|
-
// ../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/exception.js
|
|
391
|
-
var require_exception = __commonJS({
|
|
392
|
-
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/exception.js"(exports2, module2) {
|
|
393
|
-
"use strict";
|
|
394
|
-
function YAMLException(reason, mark) {
|
|
395
|
-
Error.call(this);
|
|
396
|
-
this.name = "YAMLException";
|
|
397
|
-
this.reason = reason;
|
|
398
|
-
this.mark = mark;
|
|
399
|
-
this.message = (this.reason || "(unknown reason)") + (this.mark ? " " + this.mark.toString() : "");
|
|
400
|
-
if (Error.captureStackTrace) {
|
|
401
|
-
Error.captureStackTrace(this, this.constructor);
|
|
402
|
-
} else {
|
|
403
|
-
this.stack = new Error().stack || "";
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
YAMLException.prototype = Object.create(Error.prototype);
|
|
407
|
-
YAMLException.prototype.constructor = YAMLException;
|
|
408
|
-
YAMLException.prototype.toString = function toString(compact) {
|
|
409
|
-
var result = this.name + ": ";
|
|
410
|
-
result += this.reason || "(unknown reason)";
|
|
411
|
-
if (!compact && this.mark) {
|
|
412
|
-
result += " " + this.mark.toString();
|
|
413
|
-
}
|
|
414
|
-
return result;
|
|
415
|
-
};
|
|
416
|
-
module2.exports = YAMLException;
|
|
417
|
-
}
|
|
418
|
-
});
|
|
419
|
-
|
|
420
|
-
// ../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/mark.js
|
|
421
|
-
var require_mark = __commonJS({
|
|
422
|
-
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/mark.js"(exports2, module2) {
|
|
423
|
-
"use strict";
|
|
424
|
-
var common = require_common();
|
|
425
|
-
function Mark(name, buffer, position, line, column) {
|
|
426
|
-
this.name = name;
|
|
427
|
-
this.buffer = buffer;
|
|
428
|
-
this.position = position;
|
|
429
|
-
this.line = line;
|
|
430
|
-
this.column = column;
|
|
431
|
-
}
|
|
432
|
-
Mark.prototype.getSnippet = function getSnippet(indent, maxLength) {
|
|
433
|
-
var head, start, tail, end, snippet;
|
|
434
|
-
if (!this.buffer)
|
|
435
|
-
return null;
|
|
436
|
-
indent = indent || 4;
|
|
437
|
-
maxLength = maxLength || 75;
|
|
438
|
-
head = "";
|
|
439
|
-
start = this.position;
|
|
440
|
-
while (start > 0 && "\0\r\n
\u2028\u2029".indexOf(this.buffer.charAt(start - 1)) === -1) {
|
|
441
|
-
start -= 1;
|
|
442
|
-
if (this.position - start > maxLength / 2 - 1) {
|
|
443
|
-
head = " ... ";
|
|
444
|
-
start += 5;
|
|
445
|
-
break;
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
tail = "";
|
|
449
|
-
end = this.position;
|
|
450
|
-
while (end < this.buffer.length && "\0\r\n
\u2028\u2029".indexOf(this.buffer.charAt(end)) === -1) {
|
|
451
|
-
end += 1;
|
|
452
|
-
if (end - this.position > maxLength / 2 - 1) {
|
|
453
|
-
tail = " ... ";
|
|
454
|
-
end -= 5;
|
|
455
|
-
break;
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
snippet = this.buffer.slice(start, end);
|
|
459
|
-
return common.repeat(" ", indent) + head + snippet + tail + "\n" + common.repeat(" ", indent + this.position - start + head.length) + "^";
|
|
460
|
-
};
|
|
461
|
-
Mark.prototype.toString = function toString(compact) {
|
|
462
|
-
var snippet, where = "";
|
|
463
|
-
if (this.name) {
|
|
464
|
-
where += 'in "' + this.name + '" ';
|
|
465
|
-
}
|
|
466
|
-
where += "at line " + (this.line + 1) + ", column " + (this.column + 1);
|
|
467
|
-
if (!compact) {
|
|
468
|
-
snippet = this.getSnippet();
|
|
469
|
-
if (snippet) {
|
|
470
|
-
where += ":\n" + snippet;
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
return where;
|
|
474
|
-
};
|
|
475
|
-
module2.exports = Mark;
|
|
476
|
-
}
|
|
477
|
-
});
|
|
478
|
-
|
|
479
|
-
// ../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type.js
|
|
480
|
-
var require_type = __commonJS({
|
|
481
|
-
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type.js"(exports2, module2) {
|
|
482
|
-
"use strict";
|
|
483
|
-
var YAMLException = require_exception();
|
|
484
|
-
var TYPE_CONSTRUCTOR_OPTIONS = [
|
|
485
|
-
"kind",
|
|
486
|
-
"resolve",
|
|
487
|
-
"construct",
|
|
488
|
-
"instanceOf",
|
|
489
|
-
"predicate",
|
|
490
|
-
"represent",
|
|
491
|
-
"defaultStyle",
|
|
492
|
-
"styleAliases"
|
|
493
|
-
];
|
|
494
|
-
var YAML_NODE_KINDS = [
|
|
495
|
-
"scalar",
|
|
496
|
-
"sequence",
|
|
497
|
-
"mapping"
|
|
498
|
-
];
|
|
499
|
-
function compileStyleAliases(map) {
|
|
500
|
-
var result = {};
|
|
501
|
-
if (map !== null) {
|
|
502
|
-
Object.keys(map).forEach(function(style) {
|
|
503
|
-
map[style].forEach(function(alias) {
|
|
504
|
-
result[String(alias)] = style;
|
|
505
|
-
});
|
|
506
|
-
});
|
|
507
|
-
}
|
|
508
|
-
return result;
|
|
509
|
-
}
|
|
510
|
-
function Type(tag, options2) {
|
|
511
|
-
options2 = options2 || {};
|
|
512
|
-
Object.keys(options2).forEach(function(name) {
|
|
513
|
-
if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
|
|
514
|
-
throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
|
|
515
|
-
}
|
|
516
|
-
});
|
|
517
|
-
this.tag = tag;
|
|
518
|
-
this.kind = options2["kind"] || null;
|
|
519
|
-
this.resolve = options2["resolve"] || function() {
|
|
520
|
-
return true;
|
|
521
|
-
};
|
|
522
|
-
this.construct = options2["construct"] || function(data) {
|
|
523
|
-
return data;
|
|
524
|
-
};
|
|
525
|
-
this.instanceOf = options2["instanceOf"] || null;
|
|
526
|
-
this.predicate = options2["predicate"] || null;
|
|
527
|
-
this.represent = options2["represent"] || null;
|
|
528
|
-
this.defaultStyle = options2["defaultStyle"] || null;
|
|
529
|
-
this.styleAliases = compileStyleAliases(options2["styleAliases"] || null);
|
|
530
|
-
if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
|
|
531
|
-
throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
module2.exports = Type;
|
|
535
|
-
}
|
|
536
|
-
});
|
|
537
|
-
|
|
538
|
-
// ../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/schema.js
|
|
539
|
-
var require_schema = __commonJS({
|
|
540
|
-
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/schema.js"(exports2, module2) {
|
|
541
|
-
"use strict";
|
|
542
|
-
var common = require_common();
|
|
543
|
-
var YAMLException = require_exception();
|
|
544
|
-
var Type = require_type();
|
|
545
|
-
function compileList(schema, name, result) {
|
|
546
|
-
var exclude = [];
|
|
547
|
-
schema.include.forEach(function(includedSchema) {
|
|
548
|
-
result = compileList(includedSchema, name, result);
|
|
549
|
-
});
|
|
550
|
-
schema[name].forEach(function(currentType) {
|
|
551
|
-
result.forEach(function(previousType, previousIndex) {
|
|
552
|
-
if (previousType.tag === currentType.tag && previousType.kind === currentType.kind) {
|
|
553
|
-
exclude.push(previousIndex);
|
|
554
|
-
}
|
|
555
|
-
});
|
|
556
|
-
result.push(currentType);
|
|
557
|
-
});
|
|
558
|
-
return result.filter(function(type, index) {
|
|
559
|
-
return exclude.indexOf(index) === -1;
|
|
560
|
-
});
|
|
561
|
-
}
|
|
562
|
-
function compileMap() {
|
|
563
|
-
var result = {
|
|
564
|
-
scalar: {},
|
|
565
|
-
sequence: {},
|
|
566
|
-
mapping: {},
|
|
567
|
-
fallback: {}
|
|
568
|
-
}, index, length;
|
|
569
|
-
function collectType(type) {
|
|
570
|
-
result[type.kind][type.tag] = result["fallback"][type.tag] = type;
|
|
571
|
-
}
|
|
572
|
-
for (index = 0, length = arguments.length; index < length; index += 1) {
|
|
573
|
-
arguments[index].forEach(collectType);
|
|
574
|
-
}
|
|
575
|
-
return result;
|
|
576
|
-
}
|
|
577
|
-
function Schema(definition) {
|
|
578
|
-
this.include = definition.include || [];
|
|
579
|
-
this.implicit = definition.implicit || [];
|
|
580
|
-
this.explicit = definition.explicit || [];
|
|
581
|
-
this.implicit.forEach(function(type) {
|
|
582
|
-
if (type.loadKind && type.loadKind !== "scalar") {
|
|
583
|
-
throw new YAMLException("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
|
|
584
|
-
}
|
|
585
|
-
});
|
|
586
|
-
this.compiledImplicit = compileList(this, "implicit", []);
|
|
587
|
-
this.compiledExplicit = compileList(this, "explicit", []);
|
|
588
|
-
this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit);
|
|
589
|
-
}
|
|
590
|
-
Schema.DEFAULT = null;
|
|
591
|
-
Schema.create = function createSchema() {
|
|
592
|
-
var schemas, types;
|
|
593
|
-
switch (arguments.length) {
|
|
594
|
-
case 1:
|
|
595
|
-
schemas = Schema.DEFAULT;
|
|
596
|
-
types = arguments[0];
|
|
597
|
-
break;
|
|
598
|
-
case 2:
|
|
599
|
-
schemas = arguments[0];
|
|
600
|
-
types = arguments[1];
|
|
601
|
-
break;
|
|
602
|
-
default:
|
|
603
|
-
throw new YAMLException("Wrong number of arguments for Schema.create function");
|
|
604
|
-
}
|
|
605
|
-
schemas = common.toArray(schemas);
|
|
606
|
-
types = common.toArray(types);
|
|
607
|
-
if (!schemas.every(function(schema) {
|
|
608
|
-
return schema instanceof Schema;
|
|
609
|
-
})) {
|
|
610
|
-
throw new YAMLException("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");
|
|
611
|
-
}
|
|
612
|
-
if (!types.every(function(type) {
|
|
613
|
-
return type instanceof Type;
|
|
614
|
-
})) {
|
|
615
|
-
throw new YAMLException("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
|
616
|
-
}
|
|
617
|
-
return new Schema({
|
|
618
|
-
include: schemas,
|
|
619
|
-
explicit: types
|
|
620
|
-
});
|
|
621
|
-
};
|
|
622
|
-
module2.exports = Schema;
|
|
623
|
-
}
|
|
624
|
-
});
|
|
625
|
-
|
|
626
|
-
// ../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/str.js
|
|
627
|
-
var require_str = __commonJS({
|
|
628
|
-
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/str.js"(exports2, module2) {
|
|
629
|
-
"use strict";
|
|
630
|
-
var Type = require_type();
|
|
631
|
-
module2.exports = new Type("tag:yaml.org,2002:str", {
|
|
632
|
-
kind: "scalar",
|
|
633
|
-
construct: function(data) {
|
|
634
|
-
return data !== null ? data : "";
|
|
635
|
-
}
|
|
636
|
-
});
|
|
637
|
-
}
|
|
638
|
-
});
|
|
639
|
-
|
|
640
|
-
// ../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/seq.js
|
|
641
|
-
var require_seq = __commonJS({
|
|
642
|
-
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/seq.js"(exports2, module2) {
|
|
643
|
-
"use strict";
|
|
644
|
-
var Type = require_type();
|
|
645
|
-
module2.exports = new Type("tag:yaml.org,2002:seq", {
|
|
646
|
-
kind: "sequence",
|
|
647
|
-
construct: function(data) {
|
|
648
|
-
return data !== null ? data : [];
|
|
649
|
-
}
|
|
650
|
-
});
|
|
651
|
-
}
|
|
652
|
-
});
|
|
653
|
-
|
|
654
|
-
// ../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/map.js
|
|
655
|
-
var require_map = __commonJS({
|
|
656
|
-
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/map.js"(exports2, module2) {
|
|
657
|
-
"use strict";
|
|
658
|
-
var Type = require_type();
|
|
659
|
-
module2.exports = new Type("tag:yaml.org,2002:map", {
|
|
660
|
-
kind: "mapping",
|
|
661
|
-
construct: function(data) {
|
|
662
|
-
return data !== null ? data : {};
|
|
663
|
-
}
|
|
664
|
-
});
|
|
665
|
-
}
|
|
666
|
-
});
|
|
667
|
-
|
|
668
|
-
// ../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js
|
|
669
|
-
var require_failsafe = __commonJS({
|
|
670
|
-
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js"(exports2, module2) {
|
|
671
|
-
"use strict";
|
|
672
|
-
var Schema = require_schema();
|
|
673
|
-
module2.exports = new Schema({
|
|
674
|
-
explicit: [
|
|
675
|
-
require_str(),
|
|
676
|
-
require_seq(),
|
|
677
|
-
require_map()
|
|
678
|
-
]
|
|
679
|
-
});
|
|
680
|
-
}
|
|
681
|
-
});
|
|
682
|
-
|
|
683
|
-
// ../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/null.js
|
|
684
|
-
var require_null = __commonJS({
|
|
685
|
-
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/null.js"(exports2, module2) {
|
|
686
|
-
"use strict";
|
|
687
|
-
var Type = require_type();
|
|
688
|
-
function resolveYamlNull(data) {
|
|
689
|
-
if (data === null)
|
|
690
|
-
return true;
|
|
691
|
-
var max = data.length;
|
|
692
|
-
return max === 1 && data === "~" || max === 4 && (data === "null" || data === "Null" || data === "NULL");
|
|
693
|
-
}
|
|
694
|
-
function constructYamlNull() {
|
|
695
|
-
return null;
|
|
696
|
-
}
|
|
697
|
-
function isNull(object) {
|
|
698
|
-
return object === null;
|
|
699
|
-
}
|
|
700
|
-
module2.exports = new Type("tag:yaml.org,2002:null", {
|
|
701
|
-
kind: "scalar",
|
|
702
|
-
resolve: resolveYamlNull,
|
|
703
|
-
construct: constructYamlNull,
|
|
704
|
-
predicate: isNull,
|
|
705
|
-
represent: {
|
|
706
|
-
canonical: function() {
|
|
707
|
-
return "~";
|
|
708
|
-
},
|
|
709
|
-
lowercase: function() {
|
|
710
|
-
return "null";
|
|
711
|
-
},
|
|
712
|
-
uppercase: function() {
|
|
713
|
-
return "NULL";
|
|
714
|
-
},
|
|
715
|
-
camelcase: function() {
|
|
716
|
-
return "Null";
|
|
717
|
-
}
|
|
718
|
-
},
|
|
719
|
-
defaultStyle: "lowercase"
|
|
720
|
-
});
|
|
721
|
-
}
|
|
722
|
-
});
|
|
723
|
-
|
|
724
|
-
// ../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/bool.js
|
|
725
|
-
var require_bool = __commonJS({
|
|
726
|
-
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/bool.js"(exports2, module2) {
|
|
727
|
-
"use strict";
|
|
728
|
-
var Type = require_type();
|
|
729
|
-
function resolveYamlBoolean(data) {
|
|
730
|
-
if (data === null)
|
|
731
|
-
return false;
|
|
732
|
-
var max = data.length;
|
|
733
|
-
return max === 4 && (data === "true" || data === "True" || data === "TRUE") || max === 5 && (data === "false" || data === "False" || data === "FALSE");
|
|
734
|
-
}
|
|
735
|
-
function constructYamlBoolean(data) {
|
|
736
|
-
return data === "true" || data === "True" || data === "TRUE";
|
|
737
|
-
}
|
|
738
|
-
function isBoolean(object) {
|
|
739
|
-
return Object.prototype.toString.call(object) === "[object Boolean]";
|
|
740
|
-
}
|
|
741
|
-
module2.exports = new Type("tag:yaml.org,2002:bool", {
|
|
742
|
-
kind: "scalar",
|
|
743
|
-
resolve: resolveYamlBoolean,
|
|
744
|
-
construct: constructYamlBoolean,
|
|
745
|
-
predicate: isBoolean,
|
|
746
|
-
represent: {
|
|
747
|
-
lowercase: function(object) {
|
|
748
|
-
return object ? "true" : "false";
|
|
749
|
-
},
|
|
750
|
-
uppercase: function(object) {
|
|
751
|
-
return object ? "TRUE" : "FALSE";
|
|
752
|
-
},
|
|
753
|
-
camelcase: function(object) {
|
|
754
|
-
return object ? "True" : "False";
|
|
755
|
-
}
|
|
756
|
-
},
|
|
757
|
-
defaultStyle: "lowercase"
|
|
758
|
-
});
|
|
759
|
-
}
|
|
760
|
-
});
|
|
761
|
-
|
|
762
|
-
// ../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/int.js
|
|
763
|
-
var require_int = __commonJS({
|
|
764
|
-
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/int.js"(exports2, module2) {
|
|
765
|
-
"use strict";
|
|
766
|
-
var common = require_common();
|
|
767
|
-
var Type = require_type();
|
|
768
|
-
function isHexCode(c) {
|
|
769
|
-
return 48 <= c && c <= 57 || 65 <= c && c <= 70 || 97 <= c && c <= 102;
|
|
770
|
-
}
|
|
771
|
-
function isOctCode(c) {
|
|
772
|
-
return 48 <= c && c <= 55;
|
|
773
|
-
}
|
|
774
|
-
function isDecCode(c) {
|
|
775
|
-
return 48 <= c && c <= 57;
|
|
776
|
-
}
|
|
777
|
-
function resolveYamlInteger(data) {
|
|
778
|
-
if (data === null)
|
|
779
|
-
return false;
|
|
780
|
-
var max = data.length, index = 0, hasDigits = false, ch;
|
|
781
|
-
if (!max)
|
|
782
|
-
return false;
|
|
783
|
-
ch = data[index];
|
|
784
|
-
if (ch === "-" || ch === "+") {
|
|
785
|
-
ch = data[++index];
|
|
786
|
-
}
|
|
787
|
-
if (ch === "0") {
|
|
788
|
-
if (index + 1 === max)
|
|
789
|
-
return true;
|
|
790
|
-
ch = data[++index];
|
|
791
|
-
if (ch === "b") {
|
|
792
|
-
index++;
|
|
793
|
-
for (; index < max; index++) {
|
|
794
|
-
ch = data[index];
|
|
795
|
-
if (ch === "_")
|
|
796
|
-
continue;
|
|
797
|
-
if (ch !== "0" && ch !== "1")
|
|
798
|
-
return false;
|
|
799
|
-
hasDigits = true;
|
|
800
|
-
}
|
|
801
|
-
return hasDigits && ch !== "_";
|
|
802
|
-
}
|
|
803
|
-
if (ch === "x") {
|
|
804
|
-
index++;
|
|
805
|
-
for (; index < max; index++) {
|
|
806
|
-
ch = data[index];
|
|
807
|
-
if (ch === "_")
|
|
808
|
-
continue;
|
|
809
|
-
if (!isHexCode(data.charCodeAt(index)))
|
|
810
|
-
return false;
|
|
811
|
-
hasDigits = true;
|
|
812
|
-
}
|
|
813
|
-
return hasDigits && ch !== "_";
|
|
814
|
-
}
|
|
815
|
-
for (; index < max; index++) {
|
|
816
|
-
ch = data[index];
|
|
817
|
-
if (ch === "_")
|
|
818
|
-
continue;
|
|
819
|
-
if (!isOctCode(data.charCodeAt(index)))
|
|
820
|
-
return false;
|
|
821
|
-
hasDigits = true;
|
|
822
|
-
}
|
|
823
|
-
return hasDigits && ch !== "_";
|
|
824
|
-
}
|
|
825
|
-
if (ch === "_")
|
|
826
|
-
return false;
|
|
827
|
-
for (; index < max; index++) {
|
|
828
|
-
ch = data[index];
|
|
829
|
-
if (ch === "_")
|
|
830
|
-
continue;
|
|
831
|
-
if (ch === ":")
|
|
832
|
-
break;
|
|
833
|
-
if (!isDecCode(data.charCodeAt(index))) {
|
|
834
|
-
return false;
|
|
835
|
-
}
|
|
836
|
-
hasDigits = true;
|
|
837
|
-
}
|
|
838
|
-
if (!hasDigits || ch === "_")
|
|
839
|
-
return false;
|
|
840
|
-
if (ch !== ":")
|
|
841
|
-
return true;
|
|
842
|
-
return /^(:[0-5]?[0-9])+$/.test(data.slice(index));
|
|
843
|
-
}
|
|
844
|
-
function constructYamlInteger(data) {
|
|
845
|
-
var value = data, sign = 1, ch, base, digits = [];
|
|
846
|
-
if (value.indexOf("_") !== -1) {
|
|
847
|
-
value = value.replace(/_/g, "");
|
|
848
|
-
}
|
|
849
|
-
ch = value[0];
|
|
850
|
-
if (ch === "-" || ch === "+") {
|
|
851
|
-
if (ch === "-")
|
|
852
|
-
sign = -1;
|
|
853
|
-
value = value.slice(1);
|
|
854
|
-
ch = value[0];
|
|
855
|
-
}
|
|
856
|
-
if (value === "0")
|
|
857
|
-
return 0;
|
|
858
|
-
if (ch === "0") {
|
|
859
|
-
if (value[1] === "b")
|
|
860
|
-
return sign * parseInt(value.slice(2), 2);
|
|
861
|
-
if (value[1] === "x")
|
|
862
|
-
return sign * parseInt(value, 16);
|
|
863
|
-
return sign * parseInt(value, 8);
|
|
864
|
-
}
|
|
865
|
-
if (value.indexOf(":") !== -1) {
|
|
866
|
-
value.split(":").forEach(function(v) {
|
|
867
|
-
digits.unshift(parseInt(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 * parseInt(value, 10);
|
|
878
|
-
}
|
|
879
|
-
function isInteger(object) {
|
|
880
|
-
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 === 0 && !common.isNegativeZero(object));
|
|
881
|
-
}
|
|
882
|
-
module2.exports = new Type("tag:yaml.org,2002:int", {
|
|
883
|
-
kind: "scalar",
|
|
884
|
-
resolve: resolveYamlInteger,
|
|
885
|
-
construct: constructYamlInteger,
|
|
886
|
-
predicate: isInteger,
|
|
887
|
-
represent: {
|
|
888
|
-
binary: function(obj) {
|
|
889
|
-
return obj >= 0 ? "0b" + obj.toString(2) : "-0b" + obj.toString(2).slice(1);
|
|
890
|
-
},
|
|
891
|
-
octal: function(obj) {
|
|
892
|
-
return obj >= 0 ? "0" + obj.toString(8) : "-0" + obj.toString(8).slice(1);
|
|
893
|
-
},
|
|
894
|
-
decimal: function(obj) {
|
|
895
|
-
return obj.toString(10);
|
|
896
|
-
},
|
|
897
|
-
/* eslint-disable max-len */
|
|
898
|
-
hexadecimal: function(obj) {
|
|
899
|
-
return obj >= 0 ? "0x" + obj.toString(16).toUpperCase() : "-0x" + obj.toString(16).toUpperCase().slice(1);
|
|
900
|
-
}
|
|
901
|
-
},
|
|
902
|
-
defaultStyle: "decimal",
|
|
903
|
-
styleAliases: {
|
|
904
|
-
binary: [2, "bin"],
|
|
905
|
-
octal: [8, "oct"],
|
|
906
|
-
decimal: [10, "dec"],
|
|
907
|
-
hexadecimal: [16, "hex"]
|
|
908
|
-
}
|
|
909
|
-
});
|
|
910
|
-
}
|
|
911
|
-
});
|
|
912
|
-
|
|
913
|
-
// ../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/float.js
|
|
914
|
-
var require_float = __commonJS({
|
|
915
|
-
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/float.js"(exports2, module2) {
|
|
916
|
-
"use strict";
|
|
917
|
-
var common = require_common();
|
|
918
|
-
var Type = require_type();
|
|
919
|
-
var YAML_FLOAT_PATTERN = new RegExp(
|
|
920
|
-
// 2.5e4, 2.5 and integers
|
|
921
|
-
"^(?:[-+]?(?: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))$"
|
|
922
|
-
);
|
|
923
|
-
function resolveYamlFloat(data) {
|
|
924
|
-
if (data === null)
|
|
925
|
-
return false;
|
|
926
|
-
if (!YAML_FLOAT_PATTERN.test(data) || // Quick hack to not allow integers end with `_`
|
|
927
|
-
// Probably should update regexp & check speed
|
|
928
|
-
data[data.length - 1] === "_") {
|
|
929
|
-
return false;
|
|
930
|
-
}
|
|
931
|
-
return true;
|
|
932
|
-
}
|
|
933
|
-
function constructYamlFloat(data) {
|
|
934
|
-
var value, sign, base, digits;
|
|
935
|
-
value = data.replace(/_/g, "").toLowerCase();
|
|
936
|
-
sign = value[0] === "-" ? -1 : 1;
|
|
937
|
-
digits = [];
|
|
938
|
-
if ("+-".indexOf(value[0]) >= 0) {
|
|
939
|
-
value = value.slice(1);
|
|
940
|
-
}
|
|
941
|
-
if (value === ".inf") {
|
|
942
|
-
return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
|
|
943
|
-
} else if (value === ".nan") {
|
|
944
|
-
return NaN;
|
|
945
|
-
} else if (value.indexOf(":") >= 0) {
|
|
946
|
-
value.split(":").forEach(function(v) {
|
|
947
|
-
digits.unshift(parseFloat(v, 10));
|
|
948
|
-
});
|
|
949
|
-
value = 0;
|
|
950
|
-
base = 1;
|
|
951
|
-
digits.forEach(function(d) {
|
|
952
|
-
value += d * base;
|
|
953
|
-
base *= 60;
|
|
954
|
-
});
|
|
955
|
-
return sign * value;
|
|
956
|
-
}
|
|
957
|
-
return sign * parseFloat(value, 10);
|
|
958
|
-
}
|
|
959
|
-
var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
|
|
960
|
-
function representYamlFloat(object, style) {
|
|
961
|
-
var res;
|
|
962
|
-
if (isNaN(object)) {
|
|
963
|
-
switch (style) {
|
|
964
|
-
case "lowercase":
|
|
965
|
-
return ".nan";
|
|
966
|
-
case "uppercase":
|
|
967
|
-
return ".NAN";
|
|
968
|
-
case "camelcase":
|
|
969
|
-
return ".NaN";
|
|
970
|
-
}
|
|
971
|
-
} else if (Number.POSITIVE_INFINITY === object) {
|
|
972
|
-
switch (style) {
|
|
973
|
-
case "lowercase":
|
|
974
|
-
return ".inf";
|
|
975
|
-
case "uppercase":
|
|
976
|
-
return ".INF";
|
|
977
|
-
case "camelcase":
|
|
978
|
-
return ".Inf";
|
|
979
|
-
}
|
|
980
|
-
} else if (Number.NEGATIVE_INFINITY === object) {
|
|
981
|
-
switch (style) {
|
|
982
|
-
case "lowercase":
|
|
983
|
-
return "-.inf";
|
|
984
|
-
case "uppercase":
|
|
985
|
-
return "-.INF";
|
|
986
|
-
case "camelcase":
|
|
987
|
-
return "-.Inf";
|
|
988
|
-
}
|
|
989
|
-
} else if (common.isNegativeZero(object)) {
|
|
990
|
-
return "-0.0";
|
|
991
|
-
}
|
|
992
|
-
res = object.toString(10);
|
|
993
|
-
return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res;
|
|
994
|
-
}
|
|
995
|
-
function isFloat(object) {
|
|
996
|
-
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || common.isNegativeZero(object));
|
|
997
|
-
}
|
|
998
|
-
module2.exports = new Type("tag:yaml.org,2002:float", {
|
|
999
|
-
kind: "scalar",
|
|
1000
|
-
resolve: resolveYamlFloat,
|
|
1001
|
-
construct: constructYamlFloat,
|
|
1002
|
-
predicate: isFloat,
|
|
1003
|
-
represent: representYamlFloat,
|
|
1004
|
-
defaultStyle: "lowercase"
|
|
1005
|
-
});
|
|
1006
|
-
}
|
|
1007
|
-
});
|
|
1008
|
-
|
|
1009
|
-
// ../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/schema/json.js
|
|
1010
|
-
var require_json = __commonJS({
|
|
1011
|
-
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/schema/json.js"(exports2, module2) {
|
|
1012
|
-
"use strict";
|
|
1013
|
-
var Schema = require_schema();
|
|
1014
|
-
module2.exports = new Schema({
|
|
1015
|
-
include: [
|
|
1016
|
-
require_failsafe()
|
|
1017
|
-
],
|
|
1018
|
-
implicit: [
|
|
1019
|
-
require_null(),
|
|
1020
|
-
require_bool(),
|
|
1021
|
-
require_int(),
|
|
1022
|
-
require_float()
|
|
1023
|
-
]
|
|
1024
|
-
});
|
|
1025
|
-
}
|
|
1026
|
-
});
|
|
1027
|
-
|
|
1028
|
-
// ../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/schema/core.js
|
|
1029
|
-
var require_core = __commonJS({
|
|
1030
|
-
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/schema/core.js"(exports2, module2) {
|
|
1031
|
-
"use strict";
|
|
1032
|
-
var Schema = require_schema();
|
|
1033
|
-
module2.exports = new Schema({
|
|
1034
|
-
include: [
|
|
1035
|
-
require_json()
|
|
1036
|
-
]
|
|
1037
|
-
});
|
|
1038
|
-
}
|
|
1039
|
-
});
|
|
1040
|
-
|
|
1041
|
-
// ../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/timestamp.js
|
|
1042
|
-
var require_timestamp = __commonJS({
|
|
1043
|
-
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/timestamp.js"(exports2, module2) {
|
|
1044
|
-
"use strict";
|
|
1045
|
-
var Type = require_type();
|
|
1046
|
-
var YAML_DATE_REGEXP = new RegExp(
|
|
1047
|
-
"^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"
|
|
1048
|
-
);
|
|
1049
|
-
var YAML_TIMESTAMP_REGEXP = new RegExp(
|
|
1050
|
-
"^([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]))?))?$"
|
|
1051
|
-
);
|
|
1052
|
-
function resolveYamlTimestamp(data) {
|
|
1053
|
-
if (data === null)
|
|
1054
|
-
return false;
|
|
1055
|
-
if (YAML_DATE_REGEXP.exec(data) !== null)
|
|
1056
|
-
return true;
|
|
1057
|
-
if (YAML_TIMESTAMP_REGEXP.exec(data) !== null)
|
|
1058
|
-
return true;
|
|
1059
|
-
return false;
|
|
1060
|
-
}
|
|
1061
|
-
function constructYamlTimestamp(data) {
|
|
1062
|
-
var match, year, month, day, hour, minute, second, fraction = 0, delta = null, tz_hour, tz_minute, date;
|
|
1063
|
-
match = YAML_DATE_REGEXP.exec(data);
|
|
1064
|
-
if (match === null)
|
|
1065
|
-
match = YAML_TIMESTAMP_REGEXP.exec(data);
|
|
1066
|
-
if (match === null)
|
|
1067
|
-
throw new Error("Date resolve error");
|
|
1068
|
-
year = +match[1];
|
|
1069
|
-
month = +match[2] - 1;
|
|
1070
|
-
day = +match[3];
|
|
1071
|
-
if (!match[4]) {
|
|
1072
|
-
return new Date(Date.UTC(year, month, day));
|
|
1073
|
-
}
|
|
1074
|
-
hour = +match[4];
|
|
1075
|
-
minute = +match[5];
|
|
1076
|
-
second = +match[6];
|
|
1077
|
-
if (match[7]) {
|
|
1078
|
-
fraction = match[7].slice(0, 3);
|
|
1079
|
-
while (fraction.length < 3) {
|
|
1080
|
-
fraction += "0";
|
|
1081
|
-
}
|
|
1082
|
-
fraction = +fraction;
|
|
1083
|
-
}
|
|
1084
|
-
if (match[9]) {
|
|
1085
|
-
tz_hour = +match[10];
|
|
1086
|
-
tz_minute = +(match[11] || 0);
|
|
1087
|
-
delta = (tz_hour * 60 + tz_minute) * 6e4;
|
|
1088
|
-
if (match[9] === "-")
|
|
1089
|
-
delta = -delta;
|
|
1090
|
-
}
|
|
1091
|
-
date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
|
|
1092
|
-
if (delta)
|
|
1093
|
-
date.setTime(date.getTime() - delta);
|
|
1094
|
-
return date;
|
|
1095
|
-
}
|
|
1096
|
-
function representYamlTimestamp(object) {
|
|
1097
|
-
return object.toISOString();
|
|
1098
|
-
}
|
|
1099
|
-
module2.exports = new Type("tag:yaml.org,2002:timestamp", {
|
|
1100
|
-
kind: "scalar",
|
|
1101
|
-
resolve: resolveYamlTimestamp,
|
|
1102
|
-
construct: constructYamlTimestamp,
|
|
1103
|
-
instanceOf: Date,
|
|
1104
|
-
represent: representYamlTimestamp
|
|
1105
|
-
});
|
|
1106
|
-
}
|
|
1107
|
-
});
|
|
1108
|
-
|
|
1109
|
-
// ../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/merge.js
|
|
1110
|
-
var require_merge = __commonJS({
|
|
1111
|
-
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/merge.js"(exports2, module2) {
|
|
1112
|
-
"use strict";
|
|
1113
|
-
var Type = require_type();
|
|
1114
|
-
function resolveYamlMerge(data) {
|
|
1115
|
-
return data === "<<" || data === null;
|
|
1116
|
-
}
|
|
1117
|
-
module2.exports = new Type("tag:yaml.org,2002:merge", {
|
|
1118
|
-
kind: "scalar",
|
|
1119
|
-
resolve: resolveYamlMerge
|
|
1120
|
-
});
|
|
1121
|
-
}
|
|
1122
|
-
});
|
|
1123
|
-
|
|
1124
|
-
// ../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/binary.js
|
|
1125
|
-
var require_binary = __commonJS({
|
|
1126
|
-
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/binary.js"(exports2, module2) {
|
|
1127
|
-
"use strict";
|
|
1128
|
-
var NodeBuffer;
|
|
1129
|
-
try {
|
|
1130
|
-
_require = __require;
|
|
1131
|
-
NodeBuffer = _require("buffer").Buffer;
|
|
1132
|
-
} catch (__) {
|
|
1133
|
-
}
|
|
1134
|
-
var _require;
|
|
1135
|
-
var Type = require_type();
|
|
1136
|
-
var BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";
|
|
1137
|
-
function resolveYamlBinary(data) {
|
|
1138
|
-
if (data === null)
|
|
1139
|
-
return false;
|
|
1140
|
-
var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP;
|
|
1141
|
-
for (idx = 0; idx < max; idx++) {
|
|
1142
|
-
code = map.indexOf(data.charAt(idx));
|
|
1143
|
-
if (code > 64)
|
|
1144
|
-
continue;
|
|
1145
|
-
if (code < 0)
|
|
1146
|
-
return false;
|
|
1147
|
-
bitlen += 6;
|
|
1148
|
-
}
|
|
1149
|
-
return bitlen % 8 === 0;
|
|
1150
|
-
}
|
|
1151
|
-
function constructYamlBinary(data) {
|
|
1152
|
-
var idx, tailbits, input = data.replace(/[\r\n=]/g, ""), max = input.length, map = BASE64_MAP, bits = 0, result = [];
|
|
1153
|
-
for (idx = 0; idx < max; idx++) {
|
|
1154
|
-
if (idx % 4 === 0 && idx) {
|
|
1155
|
-
result.push(bits >> 16 & 255);
|
|
1156
|
-
result.push(bits >> 8 & 255);
|
|
1157
|
-
result.push(bits & 255);
|
|
1158
|
-
}
|
|
1159
|
-
bits = bits << 6 | map.indexOf(input.charAt(idx));
|
|
1160
|
-
}
|
|
1161
|
-
tailbits = max % 4 * 6;
|
|
1162
|
-
if (tailbits === 0) {
|
|
1163
|
-
result.push(bits >> 16 & 255);
|
|
1164
|
-
result.push(bits >> 8 & 255);
|
|
1165
|
-
result.push(bits & 255);
|
|
1166
|
-
} else if (tailbits === 18) {
|
|
1167
|
-
result.push(bits >> 10 & 255);
|
|
1168
|
-
result.push(bits >> 2 & 255);
|
|
1169
|
-
} else if (tailbits === 12) {
|
|
1170
|
-
result.push(bits >> 4 & 255);
|
|
1171
|
-
}
|
|
1172
|
-
if (NodeBuffer) {
|
|
1173
|
-
return NodeBuffer.from ? NodeBuffer.from(result) : new NodeBuffer(result);
|
|
1174
|
-
}
|
|
1175
|
-
return result;
|
|
1176
|
-
}
|
|
1177
|
-
function representYamlBinary(object) {
|
|
1178
|
-
var result = "", bits = 0, idx, tail, max = object.length, map = BASE64_MAP;
|
|
1179
|
-
for (idx = 0; idx < max; idx++) {
|
|
1180
|
-
if (idx % 3 === 0 && idx) {
|
|
1181
|
-
result += map[bits >> 18 & 63];
|
|
1182
|
-
result += map[bits >> 12 & 63];
|
|
1183
|
-
result += map[bits >> 6 & 63];
|
|
1184
|
-
result += map[bits & 63];
|
|
1185
|
-
}
|
|
1186
|
-
bits = (bits << 8) + object[idx];
|
|
1187
|
-
}
|
|
1188
|
-
tail = max % 3;
|
|
1189
|
-
if (tail === 0) {
|
|
1190
|
-
result += map[bits >> 18 & 63];
|
|
1191
|
-
result += map[bits >> 12 & 63];
|
|
1192
|
-
result += map[bits >> 6 & 63];
|
|
1193
|
-
result += map[bits & 63];
|
|
1194
|
-
} else if (tail === 2) {
|
|
1195
|
-
result += map[bits >> 10 & 63];
|
|
1196
|
-
result += map[bits >> 4 & 63];
|
|
1197
|
-
result += map[bits << 2 & 63];
|
|
1198
|
-
result += map[64];
|
|
1199
|
-
} else if (tail === 1) {
|
|
1200
|
-
result += map[bits >> 2 & 63];
|
|
1201
|
-
result += map[bits << 4 & 63];
|
|
1202
|
-
result += map[64];
|
|
1203
|
-
result += map[64];
|
|
1204
|
-
}
|
|
1205
|
-
return result;
|
|
1206
|
-
}
|
|
1207
|
-
function isBinary(object) {
|
|
1208
|
-
return NodeBuffer && NodeBuffer.isBuffer(object);
|
|
1209
|
-
}
|
|
1210
|
-
module2.exports = new Type("tag:yaml.org,2002:binary", {
|
|
1211
|
-
kind: "scalar",
|
|
1212
|
-
resolve: resolveYamlBinary,
|
|
1213
|
-
construct: constructYamlBinary,
|
|
1214
|
-
predicate: isBinary,
|
|
1215
|
-
represent: representYamlBinary
|
|
1216
|
-
});
|
|
1217
|
-
}
|
|
1218
|
-
});
|
|
1219
|
-
|
|
1220
|
-
// ../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/omap.js
|
|
1221
|
-
var require_omap = __commonJS({
|
|
1222
|
-
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/omap.js"(exports2, module2) {
|
|
1223
|
-
"use strict";
|
|
1224
|
-
var Type = require_type();
|
|
1225
|
-
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
1226
|
-
var _toString = Object.prototype.toString;
|
|
1227
|
-
function resolveYamlOmap(data) {
|
|
1228
|
-
if (data === null)
|
|
1229
|
-
return true;
|
|
1230
|
-
var objectKeys = [], index, length, pair, pairKey, pairHasKey, object = data;
|
|
1231
|
-
for (index = 0, length = object.length; index < length; index += 1) {
|
|
1232
|
-
pair = object[index];
|
|
1233
|
-
pairHasKey = false;
|
|
1234
|
-
if (_toString.call(pair) !== "[object Object]")
|
|
1235
|
-
return false;
|
|
1236
|
-
for (pairKey in pair) {
|
|
1237
|
-
if (_hasOwnProperty.call(pair, pairKey)) {
|
|
1238
|
-
if (!pairHasKey)
|
|
1239
|
-
pairHasKey = true;
|
|
1240
|
-
else
|
|
1241
|
-
return false;
|
|
1242
|
-
}
|
|
1243
|
-
}
|
|
1244
|
-
if (!pairHasKey)
|
|
1245
|
-
return false;
|
|
1246
|
-
if (objectKeys.indexOf(pairKey) === -1)
|
|
1247
|
-
objectKeys.push(pairKey);
|
|
1248
|
-
else
|
|
1249
|
-
return false;
|
|
1250
|
-
}
|
|
1251
|
-
return true;
|
|
1252
|
-
}
|
|
1253
|
-
function constructYamlOmap(data) {
|
|
1254
|
-
return data !== null ? data : [];
|
|
1255
|
-
}
|
|
1256
|
-
module2.exports = new Type("tag:yaml.org,2002:omap", {
|
|
1257
|
-
kind: "sequence",
|
|
1258
|
-
resolve: resolveYamlOmap,
|
|
1259
|
-
construct: constructYamlOmap
|
|
1260
|
-
});
|
|
1261
|
-
}
|
|
1262
|
-
});
|
|
1263
|
-
|
|
1264
|
-
// ../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/pairs.js
|
|
1265
|
-
var require_pairs = __commonJS({
|
|
1266
|
-
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/pairs.js"(exports2, module2) {
|
|
1267
|
-
"use strict";
|
|
1268
|
-
var Type = require_type();
|
|
1269
|
-
var _toString = Object.prototype.toString;
|
|
1270
|
-
function resolveYamlPairs(data) {
|
|
1271
|
-
if (data === null)
|
|
1272
|
-
return true;
|
|
1273
|
-
var index, length, pair, keys, result, object = data;
|
|
1274
|
-
result = new Array(object.length);
|
|
1275
|
-
for (index = 0, length = object.length; index < length; index += 1) {
|
|
1276
|
-
pair = object[index];
|
|
1277
|
-
if (_toString.call(pair) !== "[object Object]")
|
|
1278
|
-
return false;
|
|
1279
|
-
keys = Object.keys(pair);
|
|
1280
|
-
if (keys.length !== 1)
|
|
1281
|
-
return false;
|
|
1282
|
-
result[index] = [keys[0], pair[keys[0]]];
|
|
1283
|
-
}
|
|
1284
|
-
return true;
|
|
1285
|
-
}
|
|
1286
|
-
function constructYamlPairs(data) {
|
|
1287
|
-
if (data === null)
|
|
1288
|
-
return [];
|
|
1289
|
-
var index, length, pair, keys, result, object = data;
|
|
1290
|
-
result = new Array(object.length);
|
|
1291
|
-
for (index = 0, length = object.length; index < length; index += 1) {
|
|
1292
|
-
pair = object[index];
|
|
1293
|
-
keys = Object.keys(pair);
|
|
1294
|
-
result[index] = [keys[0], pair[keys[0]]];
|
|
1295
|
-
}
|
|
1296
|
-
return result;
|
|
1297
|
-
}
|
|
1298
|
-
module2.exports = new Type("tag:yaml.org,2002:pairs", {
|
|
1299
|
-
kind: "sequence",
|
|
1300
|
-
resolve: resolveYamlPairs,
|
|
1301
|
-
construct: constructYamlPairs
|
|
1302
|
-
});
|
|
1303
|
-
}
|
|
1304
|
-
});
|
|
1305
|
-
|
|
1306
|
-
// ../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/set.js
|
|
1307
|
-
var require_set = __commonJS({
|
|
1308
|
-
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/set.js"(exports2, module2) {
|
|
1309
|
-
"use strict";
|
|
1310
|
-
var Type = require_type();
|
|
1311
|
-
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
1312
|
-
function resolveYamlSet(data) {
|
|
1313
|
-
if (data === null)
|
|
1314
|
-
return true;
|
|
1315
|
-
var key, object = data;
|
|
1316
|
-
for (key in object) {
|
|
1317
|
-
if (_hasOwnProperty.call(object, key)) {
|
|
1318
|
-
if (object[key] !== null)
|
|
1319
|
-
return false;
|
|
1320
|
-
}
|
|
1321
|
-
}
|
|
1322
|
-
return true;
|
|
1323
|
-
}
|
|
1324
|
-
function constructYamlSet(data) {
|
|
1325
|
-
return data !== null ? data : {};
|
|
1326
|
-
}
|
|
1327
|
-
module2.exports = new Type("tag:yaml.org,2002:set", {
|
|
1328
|
-
kind: "mapping",
|
|
1329
|
-
resolve: resolveYamlSet,
|
|
1330
|
-
construct: constructYamlSet
|
|
1331
|
-
});
|
|
1332
|
-
}
|
|
1333
|
-
});
|
|
1334
|
-
|
|
1335
|
-
// ../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js
|
|
1336
|
-
var require_default_safe = __commonJS({
|
|
1337
|
-
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js"(exports2, module2) {
|
|
1338
|
-
"use strict";
|
|
1339
|
-
var Schema = require_schema();
|
|
1340
|
-
module2.exports = new Schema({
|
|
1341
|
-
include: [
|
|
1342
|
-
require_core()
|
|
1343
|
-
],
|
|
1344
|
-
implicit: [
|
|
1345
|
-
require_timestamp(),
|
|
1346
|
-
require_merge()
|
|
1347
|
-
],
|
|
1348
|
-
explicit: [
|
|
1349
|
-
require_binary(),
|
|
1350
|
-
require_omap(),
|
|
1351
|
-
require_pairs(),
|
|
1352
|
-
require_set()
|
|
1353
|
-
]
|
|
1354
|
-
});
|
|
1355
|
-
}
|
|
1356
|
-
});
|
|
1357
|
-
|
|
1358
|
-
// ../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js
|
|
1359
|
-
var require_undefined = __commonJS({
|
|
1360
|
-
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js"(exports2, module2) {
|
|
1361
|
-
"use strict";
|
|
1362
|
-
var Type = require_type();
|
|
1363
|
-
function resolveJavascriptUndefined() {
|
|
1364
|
-
return true;
|
|
1365
|
-
}
|
|
1366
|
-
function constructJavascriptUndefined() {
|
|
1367
|
-
return void 0;
|
|
1368
|
-
}
|
|
1369
|
-
function representJavascriptUndefined() {
|
|
1370
|
-
return "";
|
|
1371
|
-
}
|
|
1372
|
-
function isUndefined(object) {
|
|
1373
|
-
return typeof object === "undefined";
|
|
1374
|
-
}
|
|
1375
|
-
module2.exports = new Type("tag:yaml.org,2002:js/undefined", {
|
|
1376
|
-
kind: "scalar",
|
|
1377
|
-
resolve: resolveJavascriptUndefined,
|
|
1378
|
-
construct: constructJavascriptUndefined,
|
|
1379
|
-
predicate: isUndefined,
|
|
1380
|
-
represent: representJavascriptUndefined
|
|
1381
|
-
});
|
|
1382
|
-
}
|
|
1383
|
-
});
|
|
1384
|
-
|
|
1385
|
-
// ../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js
|
|
1386
|
-
var require_regexp = __commonJS({
|
|
1387
|
-
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js"(exports2, module2) {
|
|
1388
|
-
"use strict";
|
|
1389
|
-
var Type = require_type();
|
|
1390
|
-
function resolveJavascriptRegExp(data) {
|
|
1391
|
-
if (data === null)
|
|
1392
|
-
return false;
|
|
1393
|
-
if (data.length === 0)
|
|
1394
|
-
return false;
|
|
1395
|
-
var regexp = data, tail = /\/([gim]*)$/.exec(data), modifiers = "";
|
|
1396
|
-
if (regexp[0] === "/") {
|
|
1397
|
-
if (tail)
|
|
1398
|
-
modifiers = tail[1];
|
|
1399
|
-
if (modifiers.length > 3)
|
|
1400
|
-
return false;
|
|
1401
|
-
if (regexp[regexp.length - modifiers.length - 1] !== "/")
|
|
1402
|
-
return false;
|
|
1403
|
-
}
|
|
1404
|
-
return true;
|
|
1405
|
-
}
|
|
1406
|
-
function constructJavascriptRegExp(data) {
|
|
1407
|
-
var regexp = data, tail = /\/([gim]*)$/.exec(data), modifiers = "";
|
|
1408
|
-
if (regexp[0] === "/") {
|
|
1409
|
-
if (tail)
|
|
1410
|
-
modifiers = tail[1];
|
|
1411
|
-
regexp = regexp.slice(1, regexp.length - modifiers.length - 1);
|
|
1412
|
-
}
|
|
1413
|
-
return new RegExp(regexp, modifiers);
|
|
1414
|
-
}
|
|
1415
|
-
function representJavascriptRegExp(object) {
|
|
1416
|
-
var result = "/" + object.source + "/";
|
|
1417
|
-
if (object.global)
|
|
1418
|
-
result += "g";
|
|
1419
|
-
if (object.multiline)
|
|
1420
|
-
result += "m";
|
|
1421
|
-
if (object.ignoreCase)
|
|
1422
|
-
result += "i";
|
|
1423
|
-
return result;
|
|
1424
|
-
}
|
|
1425
|
-
function isRegExp(object) {
|
|
1426
|
-
return Object.prototype.toString.call(object) === "[object RegExp]";
|
|
1427
|
-
}
|
|
1428
|
-
module2.exports = new Type("tag:yaml.org,2002:js/regexp", {
|
|
1429
|
-
kind: "scalar",
|
|
1430
|
-
resolve: resolveJavascriptRegExp,
|
|
1431
|
-
construct: constructJavascriptRegExp,
|
|
1432
|
-
predicate: isRegExp,
|
|
1433
|
-
represent: representJavascriptRegExp
|
|
1434
|
-
});
|
|
1435
|
-
}
|
|
1436
|
-
});
|
|
1437
|
-
|
|
1438
|
-
// ../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/js/function.js
|
|
1439
|
-
var require_function = __commonJS({
|
|
1440
|
-
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/js/function.js"(exports2, module2) {
|
|
1441
|
-
"use strict";
|
|
1442
|
-
var esprima;
|
|
1443
|
-
try {
|
|
1444
|
-
_require = __require;
|
|
1445
|
-
esprima = _require("esprima");
|
|
1446
|
-
} catch (_) {
|
|
1447
|
-
if (typeof window !== "undefined")
|
|
1448
|
-
esprima = window.esprima;
|
|
1449
|
-
}
|
|
1450
|
-
var _require;
|
|
1451
|
-
var Type = require_type();
|
|
1452
|
-
function resolveJavascriptFunction(data) {
|
|
1453
|
-
if (data === null)
|
|
1454
|
-
return false;
|
|
1455
|
-
try {
|
|
1456
|
-
var source = "(" + data + ")", ast = esprima.parse(source, { range: true });
|
|
1457
|
-
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") {
|
|
1458
|
-
return false;
|
|
1459
|
-
}
|
|
1460
|
-
return true;
|
|
1461
|
-
} catch (err) {
|
|
1462
|
-
return false;
|
|
1463
|
-
}
|
|
1464
|
-
}
|
|
1465
|
-
function constructJavascriptFunction(data) {
|
|
1466
|
-
var source = "(" + data + ")", ast = esprima.parse(source, { range: true }), params = [], body;
|
|
1467
|
-
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") {
|
|
1468
|
-
throw new Error("Failed to resolve function");
|
|
1469
|
-
}
|
|
1470
|
-
ast.body[0].expression.params.forEach(function(param) {
|
|
1471
|
-
params.push(param.name);
|
|
1472
|
-
});
|
|
1473
|
-
body = ast.body[0].expression.body.range;
|
|
1474
|
-
if (ast.body[0].expression.body.type === "BlockStatement") {
|
|
1475
|
-
return new Function(params, source.slice(body[0] + 1, body[1] - 1));
|
|
1476
|
-
}
|
|
1477
|
-
return new Function(params, "return " + source.slice(body[0], body[1]));
|
|
1478
|
-
}
|
|
1479
|
-
function representJavascriptFunction(object) {
|
|
1480
|
-
return object.toString();
|
|
1481
|
-
}
|
|
1482
|
-
function isFunction(object) {
|
|
1483
|
-
return Object.prototype.toString.call(object) === "[object Function]";
|
|
1484
|
-
}
|
|
1485
|
-
module2.exports = new Type("tag:yaml.org,2002:js/function", {
|
|
1486
|
-
kind: "scalar",
|
|
1487
|
-
resolve: resolveJavascriptFunction,
|
|
1488
|
-
construct: constructJavascriptFunction,
|
|
1489
|
-
predicate: isFunction,
|
|
1490
|
-
represent: representJavascriptFunction
|
|
1491
|
-
});
|
|
1492
|
-
}
|
|
1493
|
-
});
|
|
1494
|
-
|
|
1495
|
-
// ../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/schema/default_full.js
|
|
1496
|
-
var require_default_full = __commonJS({
|
|
1497
|
-
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/schema/default_full.js"(exports2, module2) {
|
|
1498
|
-
"use strict";
|
|
1499
|
-
var Schema = require_schema();
|
|
1500
|
-
module2.exports = Schema.DEFAULT = new Schema({
|
|
1501
|
-
include: [
|
|
1502
|
-
require_default_safe()
|
|
1503
|
-
],
|
|
1504
|
-
explicit: [
|
|
1505
|
-
require_undefined(),
|
|
1506
|
-
require_regexp(),
|
|
1507
|
-
require_function()
|
|
1508
|
-
]
|
|
1509
|
-
});
|
|
1510
|
-
}
|
|
1511
|
-
});
|
|
1512
|
-
|
|
1513
|
-
// ../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/loader.js
|
|
1514
|
-
var require_loader = __commonJS({
|
|
1515
|
-
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/loader.js"(exports2, module2) {
|
|
1516
|
-
"use strict";
|
|
1517
|
-
var common = require_common();
|
|
1518
|
-
var YAMLException = require_exception();
|
|
1519
|
-
var Mark = require_mark();
|
|
1520
|
-
var DEFAULT_SAFE_SCHEMA = require_default_safe();
|
|
1521
|
-
var DEFAULT_FULL_SCHEMA = require_default_full();
|
|
1522
|
-
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
1523
|
-
var CONTEXT_FLOW_IN = 1;
|
|
1524
|
-
var CONTEXT_FLOW_OUT = 2;
|
|
1525
|
-
var CONTEXT_BLOCK_IN = 3;
|
|
1526
|
-
var CONTEXT_BLOCK_OUT = 4;
|
|
1527
|
-
var CHOMPING_CLIP = 1;
|
|
1528
|
-
var CHOMPING_STRIP = 2;
|
|
1529
|
-
var CHOMPING_KEEP = 3;
|
|
1530
|
-
var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
|
|
1531
|
-
var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
|
|
1532
|
-
var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
|
|
1533
|
-
var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
|
|
1534
|
-
var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
|
|
1535
|
-
function _class(obj) {
|
|
1536
|
-
return Object.prototype.toString.call(obj);
|
|
1537
|
-
}
|
|
1538
|
-
function is_EOL(c) {
|
|
1539
|
-
return c === 10 || c === 13;
|
|
1540
|
-
}
|
|
1541
|
-
function is_WHITE_SPACE(c) {
|
|
1542
|
-
return c === 9 || c === 32;
|
|
1543
|
-
}
|
|
1544
|
-
function is_WS_OR_EOL(c) {
|
|
1545
|
-
return c === 9 || c === 32 || c === 10 || c === 13;
|
|
1546
|
-
}
|
|
1547
|
-
function is_FLOW_INDICATOR(c) {
|
|
1548
|
-
return c === 44 || c === 91 || c === 93 || c === 123 || c === 125;
|
|
1549
|
-
}
|
|
1550
|
-
function fromHexCode(c) {
|
|
1551
|
-
var lc;
|
|
1552
|
-
if (48 <= c && c <= 57) {
|
|
1553
|
-
return c - 48;
|
|
1554
|
-
}
|
|
1555
|
-
lc = c | 32;
|
|
1556
|
-
if (97 <= lc && lc <= 102) {
|
|
1557
|
-
return lc - 97 + 10;
|
|
1558
|
-
}
|
|
1559
|
-
return -1;
|
|
1560
|
-
}
|
|
1561
|
-
function escapedHexLen(c) {
|
|
1562
|
-
if (c === 120) {
|
|
1563
|
-
return 2;
|
|
1564
|
-
}
|
|
1565
|
-
if (c === 117) {
|
|
1566
|
-
return 4;
|
|
1567
|
-
}
|
|
1568
|
-
if (c === 85) {
|
|
1569
|
-
return 8;
|
|
1570
|
-
}
|
|
1571
|
-
return 0;
|
|
1572
|
-
}
|
|
1573
|
-
function fromDecimalCode(c) {
|
|
1574
|
-
if (48 <= c && c <= 57) {
|
|
1575
|
-
return c - 48;
|
|
1576
|
-
}
|
|
1577
|
-
return -1;
|
|
1578
|
-
}
|
|
1579
|
-
function simpleEscapeSequence(c) {
|
|
1580
|
-
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 ? "
" : c === 95 ? " " : c === 76 ? "\u2028" : c === 80 ? "\u2029" : "";
|
|
1581
|
-
}
|
|
1582
|
-
function charFromCodepoint(c) {
|
|
1583
|
-
if (c <= 65535) {
|
|
1584
|
-
return String.fromCharCode(c);
|
|
1585
|
-
}
|
|
1586
|
-
return String.fromCharCode(
|
|
1587
|
-
(c - 65536 >> 10) + 55296,
|
|
1588
|
-
(c - 65536 & 1023) + 56320
|
|
1589
|
-
);
|
|
1590
|
-
}
|
|
1591
|
-
var simpleEscapeCheck = new Array(256);
|
|
1592
|
-
var simpleEscapeMap = new Array(256);
|
|
1593
|
-
for (i = 0; i < 256; i++) {
|
|
1594
|
-
simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
|
|
1595
|
-
simpleEscapeMap[i] = simpleEscapeSequence(i);
|
|
1596
|
-
}
|
|
1597
|
-
var i;
|
|
1598
|
-
function State(input, options2) {
|
|
1599
|
-
this.input = input;
|
|
1600
|
-
this.filename = options2["filename"] || null;
|
|
1601
|
-
this.schema = options2["schema"] || DEFAULT_FULL_SCHEMA;
|
|
1602
|
-
this.onWarning = options2["onWarning"] || null;
|
|
1603
|
-
this.legacy = options2["legacy"] || false;
|
|
1604
|
-
this.json = options2["json"] || false;
|
|
1605
|
-
this.listener = options2["listener"] || null;
|
|
1606
|
-
this.implicitTypes = this.schema.compiledImplicit;
|
|
1607
|
-
this.typeMap = this.schema.compiledTypeMap;
|
|
1608
|
-
this.length = input.length;
|
|
1609
|
-
this.position = 0;
|
|
1610
|
-
this.line = 0;
|
|
1611
|
-
this.lineStart = 0;
|
|
1612
|
-
this.lineIndent = 0;
|
|
1613
|
-
this.documents = [];
|
|
1614
|
-
}
|
|
1615
|
-
function generateError(state, message) {
|
|
1616
|
-
return new YAMLException(
|
|
1617
|
-
message,
|
|
1618
|
-
new Mark(state.filename, state.input, state.position, state.line, state.position - state.lineStart)
|
|
1619
|
-
);
|
|
1620
|
-
}
|
|
1621
|
-
function throwError(state, message) {
|
|
1622
|
-
throw generateError(state, message);
|
|
1623
|
-
}
|
|
1624
|
-
function throwWarning(state, message) {
|
|
1625
|
-
if (state.onWarning) {
|
|
1626
|
-
state.onWarning.call(null, generateError(state, message));
|
|
1627
|
-
}
|
|
1628
|
-
}
|
|
1629
|
-
var directiveHandlers = {
|
|
1630
|
-
YAML: function handleYamlDirective(state, name, args) {
|
|
1631
|
-
var match, major, minor;
|
|
1632
|
-
if (state.version !== null) {
|
|
1633
|
-
throwError(state, "duplication of %YAML directive");
|
|
1634
|
-
}
|
|
1635
|
-
if (args.length !== 1) {
|
|
1636
|
-
throwError(state, "YAML directive accepts exactly one argument");
|
|
1637
|
-
}
|
|
1638
|
-
match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
|
|
1639
|
-
if (match === null) {
|
|
1640
|
-
throwError(state, "ill-formed argument of the YAML directive");
|
|
1641
|
-
}
|
|
1642
|
-
major = parseInt(match[1], 10);
|
|
1643
|
-
minor = parseInt(match[2], 10);
|
|
1644
|
-
if (major !== 1) {
|
|
1645
|
-
throwError(state, "unacceptable YAML version of the document");
|
|
1646
|
-
}
|
|
1647
|
-
state.version = args[0];
|
|
1648
|
-
state.checkLineBreaks = minor < 2;
|
|
1649
|
-
if (minor !== 1 && minor !== 2) {
|
|
1650
|
-
throwWarning(state, "unsupported YAML version of the document");
|
|
1651
|
-
}
|
|
1652
|
-
},
|
|
1653
|
-
TAG: function handleTagDirective(state, name, args) {
|
|
1654
|
-
var handle, prefix;
|
|
1655
|
-
if (args.length !== 2) {
|
|
1656
|
-
throwError(state, "TAG directive accepts exactly two arguments");
|
|
1657
|
-
}
|
|
1658
|
-
handle = args[0];
|
|
1659
|
-
prefix = args[1];
|
|
1660
|
-
if (!PATTERN_TAG_HANDLE.test(handle)) {
|
|
1661
|
-
throwError(state, "ill-formed tag handle (first argument) of the TAG directive");
|
|
1662
|
-
}
|
|
1663
|
-
if (_hasOwnProperty.call(state.tagMap, handle)) {
|
|
1664
|
-
throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
|
|
1665
|
-
}
|
|
1666
|
-
if (!PATTERN_TAG_URI.test(prefix)) {
|
|
1667
|
-
throwError(state, "ill-formed tag prefix (second argument) of the TAG directive");
|
|
1668
|
-
}
|
|
1669
|
-
state.tagMap[handle] = prefix;
|
|
1670
|
-
}
|
|
1671
|
-
};
|
|
1672
|
-
function captureSegment(state, start, end, checkJson) {
|
|
1673
|
-
var _position, _length, _character, _result;
|
|
1674
|
-
if (start < end) {
|
|
1675
|
-
_result = state.input.slice(start, end);
|
|
1676
|
-
if (checkJson) {
|
|
1677
|
-
for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
|
|
1678
|
-
_character = _result.charCodeAt(_position);
|
|
1679
|
-
if (!(_character === 9 || 32 <= _character && _character <= 1114111)) {
|
|
1680
|
-
throwError(state, "expected valid JSON character");
|
|
1681
|
-
}
|
|
1682
|
-
}
|
|
1683
|
-
} else if (PATTERN_NON_PRINTABLE.test(_result)) {
|
|
1684
|
-
throwError(state, "the stream contains non-printable characters");
|
|
1685
|
-
}
|
|
1686
|
-
state.result += _result;
|
|
1687
|
-
}
|
|
1688
|
-
}
|
|
1689
|
-
function mergeMappings(state, destination, source, overridableKeys) {
|
|
1690
|
-
var sourceKeys, key, index, quantity;
|
|
1691
|
-
if (!common.isObject(source)) {
|
|
1692
|
-
throwError(state, "cannot merge mappings; the provided source object is unacceptable");
|
|
1693
|
-
}
|
|
1694
|
-
sourceKeys = Object.keys(source);
|
|
1695
|
-
for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
|
|
1696
|
-
key = sourceKeys[index];
|
|
1697
|
-
if (!_hasOwnProperty.call(destination, key)) {
|
|
1698
|
-
destination[key] = source[key];
|
|
1699
|
-
overridableKeys[key] = true;
|
|
1700
|
-
}
|
|
1701
|
-
}
|
|
1702
|
-
}
|
|
1703
|
-
function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startPos) {
|
|
1704
|
-
var index, quantity;
|
|
1705
|
-
if (Array.isArray(keyNode)) {
|
|
1706
|
-
keyNode = Array.prototype.slice.call(keyNode);
|
|
1707
|
-
for (index = 0, quantity = keyNode.length; index < quantity; index += 1) {
|
|
1708
|
-
if (Array.isArray(keyNode[index])) {
|
|
1709
|
-
throwError(state, "nested arrays are not supported inside keys");
|
|
1710
|
-
}
|
|
1711
|
-
if (typeof keyNode === "object" && _class(keyNode[index]) === "[object Object]") {
|
|
1712
|
-
keyNode[index] = "[object Object]";
|
|
1713
|
-
}
|
|
1714
|
-
}
|
|
1715
|
-
}
|
|
1716
|
-
if (typeof keyNode === "object" && _class(keyNode) === "[object Object]") {
|
|
1717
|
-
keyNode = "[object Object]";
|
|
1718
|
-
}
|
|
1719
|
-
keyNode = String(keyNode);
|
|
1720
|
-
if (_result === null) {
|
|
1721
|
-
_result = {};
|
|
1722
|
-
}
|
|
1723
|
-
if (keyTag === "tag:yaml.org,2002:merge") {
|
|
1724
|
-
if (Array.isArray(valueNode)) {
|
|
1725
|
-
for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
|
|
1726
|
-
mergeMappings(state, _result, valueNode[index], overridableKeys);
|
|
1727
|
-
}
|
|
1728
|
-
} else {
|
|
1729
|
-
mergeMappings(state, _result, valueNode, overridableKeys);
|
|
1730
|
-
}
|
|
1731
|
-
} else {
|
|
1732
|
-
if (!state.json && !_hasOwnProperty.call(overridableKeys, keyNode) && _hasOwnProperty.call(_result, keyNode)) {
|
|
1733
|
-
state.line = startLine || state.line;
|
|
1734
|
-
state.position = startPos || state.position;
|
|
1735
|
-
throwError(state, "duplicated mapping key");
|
|
1736
|
-
}
|
|
1737
|
-
_result[keyNode] = valueNode;
|
|
1738
|
-
delete overridableKeys[keyNode];
|
|
1739
|
-
}
|
|
1740
|
-
return _result;
|
|
1741
|
-
}
|
|
1742
|
-
function readLineBreak(state) {
|
|
1743
|
-
var ch;
|
|
1744
|
-
ch = state.input.charCodeAt(state.position);
|
|
1745
|
-
if (ch === 10) {
|
|
1746
|
-
state.position++;
|
|
1747
|
-
} else if (ch === 13) {
|
|
1748
|
-
state.position++;
|
|
1749
|
-
if (state.input.charCodeAt(state.position) === 10) {
|
|
1750
|
-
state.position++;
|
|
1751
|
-
}
|
|
1752
|
-
} else {
|
|
1753
|
-
throwError(state, "a line break is expected");
|
|
1754
|
-
}
|
|
1755
|
-
state.line += 1;
|
|
1756
|
-
state.lineStart = state.position;
|
|
1757
|
-
}
|
|
1758
|
-
function skipSeparationSpace(state, allowComments, checkIndent) {
|
|
1759
|
-
var lineBreaks = 0, ch = state.input.charCodeAt(state.position);
|
|
1760
|
-
while (ch !== 0) {
|
|
1761
|
-
while (is_WHITE_SPACE(ch)) {
|
|
1762
|
-
ch = state.input.charCodeAt(++state.position);
|
|
1763
|
-
}
|
|
1764
|
-
if (allowComments && ch === 35) {
|
|
1765
|
-
do {
|
|
1766
|
-
ch = state.input.charCodeAt(++state.position);
|
|
1767
|
-
} while (ch !== 10 && ch !== 13 && ch !== 0);
|
|
1768
|
-
}
|
|
1769
|
-
if (is_EOL(ch)) {
|
|
1770
|
-
readLineBreak(state);
|
|
1771
|
-
ch = state.input.charCodeAt(state.position);
|
|
1772
|
-
lineBreaks++;
|
|
1773
|
-
state.lineIndent = 0;
|
|
1774
|
-
while (ch === 32) {
|
|
1775
|
-
state.lineIndent++;
|
|
1776
|
-
ch = state.input.charCodeAt(++state.position);
|
|
1777
|
-
}
|
|
1778
|
-
} else {
|
|
1779
|
-
break;
|
|
1780
|
-
}
|
|
1781
|
-
}
|
|
1782
|
-
if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {
|
|
1783
|
-
throwWarning(state, "deficient indentation");
|
|
1784
|
-
}
|
|
1785
|
-
return lineBreaks;
|
|
1786
|
-
}
|
|
1787
|
-
function testDocumentSeparator(state) {
|
|
1788
|
-
var _position = state.position, ch;
|
|
1789
|
-
ch = state.input.charCodeAt(_position);
|
|
1790
|
-
if ((ch === 45 || ch === 46) && ch === state.input.charCodeAt(_position + 1) && ch === state.input.charCodeAt(_position + 2)) {
|
|
1791
|
-
_position += 3;
|
|
1792
|
-
ch = state.input.charCodeAt(_position);
|
|
1793
|
-
if (ch === 0 || is_WS_OR_EOL(ch)) {
|
|
1794
|
-
return true;
|
|
1795
|
-
}
|
|
1796
|
-
}
|
|
1797
|
-
return false;
|
|
1798
|
-
}
|
|
1799
|
-
function writeFoldedLines(state, count) {
|
|
1800
|
-
if (count === 1) {
|
|
1801
|
-
state.result += " ";
|
|
1802
|
-
} else if (count > 1) {
|
|
1803
|
-
state.result += common.repeat("\n", count - 1);
|
|
1804
|
-
}
|
|
1805
|
-
}
|
|
1806
|
-
function readPlainScalar(state, nodeIndent, withinFlowCollection) {
|
|
1807
|
-
var preceding, following, captureStart, captureEnd, hasPendingContent, _line, _lineStart, _lineIndent, _kind = state.kind, _result = state.result, ch;
|
|
1808
|
-
ch = state.input.charCodeAt(state.position);
|
|
1809
|
-
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) {
|
|
1810
|
-
return false;
|
|
1811
|
-
}
|
|
1812
|
-
if (ch === 63 || ch === 45) {
|
|
1813
|
-
following = state.input.charCodeAt(state.position + 1);
|
|
1814
|
-
if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
|
|
1815
|
-
return false;
|
|
1816
|
-
}
|
|
1817
|
-
}
|
|
1818
|
-
state.kind = "scalar";
|
|
1819
|
-
state.result = "";
|
|
1820
|
-
captureStart = captureEnd = state.position;
|
|
1821
|
-
hasPendingContent = false;
|
|
1822
|
-
while (ch !== 0) {
|
|
1823
|
-
if (ch === 58) {
|
|
1824
|
-
following = state.input.charCodeAt(state.position + 1);
|
|
1825
|
-
if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
|
|
1826
|
-
break;
|
|
1827
|
-
}
|
|
1828
|
-
} else if (ch === 35) {
|
|
1829
|
-
preceding = state.input.charCodeAt(state.position - 1);
|
|
1830
|
-
if (is_WS_OR_EOL(preceding)) {
|
|
1831
|
-
break;
|
|
1832
|
-
}
|
|
1833
|
-
} else if (state.position === state.lineStart && testDocumentSeparator(state) || withinFlowCollection && is_FLOW_INDICATOR(ch)) {
|
|
1834
|
-
break;
|
|
1835
|
-
} else if (is_EOL(ch)) {
|
|
1836
|
-
_line = state.line;
|
|
1837
|
-
_lineStart = state.lineStart;
|
|
1838
|
-
_lineIndent = state.lineIndent;
|
|
1839
|
-
skipSeparationSpace(state, false, -1);
|
|
1840
|
-
if (state.lineIndent >= nodeIndent) {
|
|
1841
|
-
hasPendingContent = true;
|
|
1842
|
-
ch = state.input.charCodeAt(state.position);
|
|
1843
|
-
continue;
|
|
1844
|
-
} else {
|
|
1845
|
-
state.position = captureEnd;
|
|
1846
|
-
state.line = _line;
|
|
1847
|
-
state.lineStart = _lineStart;
|
|
1848
|
-
state.lineIndent = _lineIndent;
|
|
1849
|
-
break;
|
|
1850
|
-
}
|
|
1851
|
-
}
|
|
1852
|
-
if (hasPendingContent) {
|
|
1853
|
-
captureSegment(state, captureStart, captureEnd, false);
|
|
1854
|
-
writeFoldedLines(state, state.line - _line);
|
|
1855
|
-
captureStart = captureEnd = state.position;
|
|
1856
|
-
hasPendingContent = false;
|
|
1857
|
-
}
|
|
1858
|
-
if (!is_WHITE_SPACE(ch)) {
|
|
1859
|
-
captureEnd = state.position + 1;
|
|
1860
|
-
}
|
|
1861
|
-
ch = state.input.charCodeAt(++state.position);
|
|
1862
|
-
}
|
|
1863
|
-
captureSegment(state, captureStart, captureEnd, false);
|
|
1864
|
-
if (state.result) {
|
|
1865
|
-
return true;
|
|
1866
|
-
}
|
|
1867
|
-
state.kind = _kind;
|
|
1868
|
-
state.result = _result;
|
|
1869
|
-
return false;
|
|
1870
|
-
}
|
|
1871
|
-
function readSingleQuotedScalar(state, nodeIndent) {
|
|
1872
|
-
var ch, captureStart, captureEnd;
|
|
1873
|
-
ch = state.input.charCodeAt(state.position);
|
|
1874
|
-
if (ch !== 39) {
|
|
1875
|
-
return false;
|
|
1876
|
-
}
|
|
1877
|
-
state.kind = "scalar";
|
|
1878
|
-
state.result = "";
|
|
1879
|
-
state.position++;
|
|
1880
|
-
captureStart = captureEnd = state.position;
|
|
1881
|
-
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
1882
|
-
if (ch === 39) {
|
|
1883
|
-
captureSegment(state, captureStart, state.position, true);
|
|
1884
|
-
ch = state.input.charCodeAt(++state.position);
|
|
1885
|
-
if (ch === 39) {
|
|
1886
|
-
captureStart = state.position;
|
|
1887
|
-
state.position++;
|
|
1888
|
-
captureEnd = state.position;
|
|
1889
|
-
} else {
|
|
1890
|
-
return true;
|
|
1891
|
-
}
|
|
1892
|
-
} else if (is_EOL(ch)) {
|
|
1893
|
-
captureSegment(state, captureStart, captureEnd, true);
|
|
1894
|
-
writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
|
|
1895
|
-
captureStart = captureEnd = state.position;
|
|
1896
|
-
} else if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
1897
|
-
throwError(state, "unexpected end of the document within a single quoted scalar");
|
|
1898
|
-
} else {
|
|
1899
|
-
state.position++;
|
|
1900
|
-
captureEnd = state.position;
|
|
1901
|
-
}
|
|
1902
|
-
}
|
|
1903
|
-
throwError(state, "unexpected end of the stream within a single quoted scalar");
|
|
1904
|
-
}
|
|
1905
|
-
function readDoubleQuotedScalar(state, nodeIndent) {
|
|
1906
|
-
var captureStart, captureEnd, hexLength, hexResult, tmp, ch;
|
|
1907
|
-
ch = state.input.charCodeAt(state.position);
|
|
1908
|
-
if (ch !== 34) {
|
|
1909
|
-
return false;
|
|
1910
|
-
}
|
|
1911
|
-
state.kind = "scalar";
|
|
1912
|
-
state.result = "";
|
|
1913
|
-
state.position++;
|
|
1914
|
-
captureStart = captureEnd = state.position;
|
|
1915
|
-
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
1916
|
-
if (ch === 34) {
|
|
1917
|
-
captureSegment(state, captureStart, state.position, true);
|
|
1918
|
-
state.position++;
|
|
1919
|
-
return true;
|
|
1920
|
-
} else if (ch === 92) {
|
|
1921
|
-
captureSegment(state, captureStart, state.position, true);
|
|
1922
|
-
ch = state.input.charCodeAt(++state.position);
|
|
1923
|
-
if (is_EOL(ch)) {
|
|
1924
|
-
skipSeparationSpace(state, false, nodeIndent);
|
|
1925
|
-
} else if (ch < 256 && simpleEscapeCheck[ch]) {
|
|
1926
|
-
state.result += simpleEscapeMap[ch];
|
|
1927
|
-
state.position++;
|
|
1928
|
-
} else if ((tmp = escapedHexLen(ch)) > 0) {
|
|
1929
|
-
hexLength = tmp;
|
|
1930
|
-
hexResult = 0;
|
|
1931
|
-
for (; hexLength > 0; hexLength--) {
|
|
1932
|
-
ch = state.input.charCodeAt(++state.position);
|
|
1933
|
-
if ((tmp = fromHexCode(ch)) >= 0) {
|
|
1934
|
-
hexResult = (hexResult << 4) + tmp;
|
|
1935
|
-
} else {
|
|
1936
|
-
throwError(state, "expected hexadecimal character");
|
|
1937
|
-
}
|
|
1938
|
-
}
|
|
1939
|
-
state.result += charFromCodepoint(hexResult);
|
|
1940
|
-
state.position++;
|
|
1941
|
-
} else {
|
|
1942
|
-
throwError(state, "unknown escape sequence");
|
|
1943
|
-
}
|
|
1944
|
-
captureStart = captureEnd = state.position;
|
|
1945
|
-
} else if (is_EOL(ch)) {
|
|
1946
|
-
captureSegment(state, captureStart, captureEnd, true);
|
|
1947
|
-
writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
|
|
1948
|
-
captureStart = captureEnd = state.position;
|
|
1949
|
-
} else if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
1950
|
-
throwError(state, "unexpected end of the document within a double quoted scalar");
|
|
1951
|
-
} else {
|
|
1952
|
-
state.position++;
|
|
1953
|
-
captureEnd = state.position;
|
|
1954
|
-
}
|
|
1955
|
-
}
|
|
1956
|
-
throwError(state, "unexpected end of the stream within a double quoted scalar");
|
|
1957
|
-
}
|
|
1958
|
-
function readFlowCollection(state, nodeIndent) {
|
|
1959
|
-
var readNext = true, _line, _tag = state.tag, _result, _anchor = state.anchor, following, terminator, isPair, isExplicitPair, isMapping, overridableKeys = {}, keyNode, keyTag, valueNode, ch;
|
|
1960
|
-
ch = state.input.charCodeAt(state.position);
|
|
1961
|
-
if (ch === 91) {
|
|
1962
|
-
terminator = 93;
|
|
1963
|
-
isMapping = false;
|
|
1964
|
-
_result = [];
|
|
1965
|
-
} else if (ch === 123) {
|
|
1966
|
-
terminator = 125;
|
|
1967
|
-
isMapping = true;
|
|
1968
|
-
_result = {};
|
|
1969
|
-
} else {
|
|
1970
|
-
return false;
|
|
1971
|
-
}
|
|
1972
|
-
if (state.anchor !== null) {
|
|
1973
|
-
state.anchorMap[state.anchor] = _result;
|
|
1974
|
-
}
|
|
1975
|
-
ch = state.input.charCodeAt(++state.position);
|
|
1976
|
-
while (ch !== 0) {
|
|
1977
|
-
skipSeparationSpace(state, true, nodeIndent);
|
|
1978
|
-
ch = state.input.charCodeAt(state.position);
|
|
1979
|
-
if (ch === terminator) {
|
|
1980
|
-
state.position++;
|
|
1981
|
-
state.tag = _tag;
|
|
1982
|
-
state.anchor = _anchor;
|
|
1983
|
-
state.kind = isMapping ? "mapping" : "sequence";
|
|
1984
|
-
state.result = _result;
|
|
1985
|
-
return true;
|
|
1986
|
-
} else if (!readNext) {
|
|
1987
|
-
throwError(state, "missed comma between flow collection entries");
|
|
1988
|
-
}
|
|
1989
|
-
keyTag = keyNode = valueNode = null;
|
|
1990
|
-
isPair = isExplicitPair = false;
|
|
1991
|
-
if (ch === 63) {
|
|
1992
|
-
following = state.input.charCodeAt(state.position + 1);
|
|
1993
|
-
if (is_WS_OR_EOL(following)) {
|
|
1994
|
-
isPair = isExplicitPair = true;
|
|
1995
|
-
state.position++;
|
|
1996
|
-
skipSeparationSpace(state, true, nodeIndent);
|
|
1997
|
-
}
|
|
1998
|
-
}
|
|
1999
|
-
_line = state.line;
|
|
2000
|
-
composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
|
2001
|
-
keyTag = state.tag;
|
|
2002
|
-
keyNode = state.result;
|
|
2003
|
-
skipSeparationSpace(state, true, nodeIndent);
|
|
2004
|
-
ch = state.input.charCodeAt(state.position);
|
|
2005
|
-
if ((isExplicitPair || state.line === _line) && ch === 58) {
|
|
2006
|
-
isPair = true;
|
|
2007
|
-
ch = state.input.charCodeAt(++state.position);
|
|
2008
|
-
skipSeparationSpace(state, true, nodeIndent);
|
|
2009
|
-
composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
|
2010
|
-
valueNode = state.result;
|
|
2011
|
-
}
|
|
2012
|
-
if (isMapping) {
|
|
2013
|
-
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode);
|
|
2014
|
-
} else if (isPair) {
|
|
2015
|
-
_result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode));
|
|
2016
|
-
} else {
|
|
2017
|
-
_result.push(keyNode);
|
|
2018
|
-
}
|
|
2019
|
-
skipSeparationSpace(state, true, nodeIndent);
|
|
2020
|
-
ch = state.input.charCodeAt(state.position);
|
|
2021
|
-
if (ch === 44) {
|
|
2022
|
-
readNext = true;
|
|
2023
|
-
ch = state.input.charCodeAt(++state.position);
|
|
2024
|
-
} else {
|
|
2025
|
-
readNext = false;
|
|
2026
|
-
}
|
|
2027
|
-
}
|
|
2028
|
-
throwError(state, "unexpected end of the stream within a flow collection");
|
|
2029
|
-
}
|
|
2030
|
-
function readBlockScalar(state, nodeIndent) {
|
|
2031
|
-
var captureStart, folding, chomping = CHOMPING_CLIP, didReadContent = false, detectedIndent = false, textIndent = nodeIndent, emptyLines = 0, atMoreIndented = false, tmp, ch;
|
|
2032
|
-
ch = state.input.charCodeAt(state.position);
|
|
2033
|
-
if (ch === 124) {
|
|
2034
|
-
folding = false;
|
|
2035
|
-
} else if (ch === 62) {
|
|
2036
|
-
folding = true;
|
|
2037
|
-
} else {
|
|
2038
|
-
return false;
|
|
2039
|
-
}
|
|
2040
|
-
state.kind = "scalar";
|
|
2041
|
-
state.result = "";
|
|
2042
|
-
while (ch !== 0) {
|
|
2043
|
-
ch = state.input.charCodeAt(++state.position);
|
|
2044
|
-
if (ch === 43 || ch === 45) {
|
|
2045
|
-
if (CHOMPING_CLIP === chomping) {
|
|
2046
|
-
chomping = ch === 43 ? CHOMPING_KEEP : CHOMPING_STRIP;
|
|
2047
|
-
} else {
|
|
2048
|
-
throwError(state, "repeat of a chomping mode identifier");
|
|
2049
|
-
}
|
|
2050
|
-
} else if ((tmp = fromDecimalCode(ch)) >= 0) {
|
|
2051
|
-
if (tmp === 0) {
|
|
2052
|
-
throwError(state, "bad explicit indentation width of a block scalar; it cannot be less than one");
|
|
2053
|
-
} else if (!detectedIndent) {
|
|
2054
|
-
textIndent = nodeIndent + tmp - 1;
|
|
2055
|
-
detectedIndent = true;
|
|
2056
|
-
} else {
|
|
2057
|
-
throwError(state, "repeat of an indentation width identifier");
|
|
2058
|
-
}
|
|
2059
|
-
} else {
|
|
2060
|
-
break;
|
|
2061
|
-
}
|
|
2062
|
-
}
|
|
2063
|
-
if (is_WHITE_SPACE(ch)) {
|
|
2064
|
-
do {
|
|
2065
|
-
ch = state.input.charCodeAt(++state.position);
|
|
2066
|
-
} while (is_WHITE_SPACE(ch));
|
|
2067
|
-
if (ch === 35) {
|
|
2068
|
-
do {
|
|
2069
|
-
ch = state.input.charCodeAt(++state.position);
|
|
2070
|
-
} while (!is_EOL(ch) && ch !== 0);
|
|
2071
|
-
}
|
|
2072
|
-
}
|
|
2073
|
-
while (ch !== 0) {
|
|
2074
|
-
readLineBreak(state);
|
|
2075
|
-
state.lineIndent = 0;
|
|
2076
|
-
ch = state.input.charCodeAt(state.position);
|
|
2077
|
-
while ((!detectedIndent || state.lineIndent < textIndent) && ch === 32) {
|
|
2078
|
-
state.lineIndent++;
|
|
2079
|
-
ch = state.input.charCodeAt(++state.position);
|
|
2080
|
-
}
|
|
2081
|
-
if (!detectedIndent && state.lineIndent > textIndent) {
|
|
2082
|
-
textIndent = state.lineIndent;
|
|
2083
|
-
}
|
|
2084
|
-
if (is_EOL(ch)) {
|
|
2085
|
-
emptyLines++;
|
|
2086
|
-
continue;
|
|
2087
|
-
}
|
|
2088
|
-
if (state.lineIndent < textIndent) {
|
|
2089
|
-
if (chomping === CHOMPING_KEEP) {
|
|
2090
|
-
state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
|
2091
|
-
} else if (chomping === CHOMPING_CLIP) {
|
|
2092
|
-
if (didReadContent) {
|
|
2093
|
-
state.result += "\n";
|
|
2094
|
-
}
|
|
2095
|
-
}
|
|
2096
|
-
break;
|
|
2097
|
-
}
|
|
2098
|
-
if (folding) {
|
|
2099
|
-
if (is_WHITE_SPACE(ch)) {
|
|
2100
|
-
atMoreIndented = true;
|
|
2101
|
-
state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
|
2102
|
-
} else if (atMoreIndented) {
|
|
2103
|
-
atMoreIndented = false;
|
|
2104
|
-
state.result += common.repeat("\n", emptyLines + 1);
|
|
2105
|
-
} else if (emptyLines === 0) {
|
|
2106
|
-
if (didReadContent) {
|
|
2107
|
-
state.result += " ";
|
|
2108
|
-
}
|
|
2109
|
-
} else {
|
|
2110
|
-
state.result += common.repeat("\n", emptyLines);
|
|
2111
|
-
}
|
|
2112
|
-
} else {
|
|
2113
|
-
state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
|
2114
|
-
}
|
|
2115
|
-
didReadContent = true;
|
|
2116
|
-
detectedIndent = true;
|
|
2117
|
-
emptyLines = 0;
|
|
2118
|
-
captureStart = state.position;
|
|
2119
|
-
while (!is_EOL(ch) && ch !== 0) {
|
|
2120
|
-
ch = state.input.charCodeAt(++state.position);
|
|
2121
|
-
}
|
|
2122
|
-
captureSegment(state, captureStart, state.position, false);
|
|
2123
|
-
}
|
|
2124
|
-
return true;
|
|
2125
|
-
}
|
|
2126
|
-
function readBlockSequence(state, nodeIndent) {
|
|
2127
|
-
var _line, _tag = state.tag, _anchor = state.anchor, _result = [], following, detected = false, ch;
|
|
2128
|
-
if (state.anchor !== null) {
|
|
2129
|
-
state.anchorMap[state.anchor] = _result;
|
|
2130
|
-
}
|
|
2131
|
-
ch = state.input.charCodeAt(state.position);
|
|
2132
|
-
while (ch !== 0) {
|
|
2133
|
-
if (ch !== 45) {
|
|
2134
|
-
break;
|
|
2135
|
-
}
|
|
2136
|
-
following = state.input.charCodeAt(state.position + 1);
|
|
2137
|
-
if (!is_WS_OR_EOL(following)) {
|
|
2138
|
-
break;
|
|
2139
|
-
}
|
|
2140
|
-
detected = true;
|
|
2141
|
-
state.position++;
|
|
2142
|
-
if (skipSeparationSpace(state, true, -1)) {
|
|
2143
|
-
if (state.lineIndent <= nodeIndent) {
|
|
2144
|
-
_result.push(null);
|
|
2145
|
-
ch = state.input.charCodeAt(state.position);
|
|
2146
|
-
continue;
|
|
2147
|
-
}
|
|
2148
|
-
}
|
|
2149
|
-
_line = state.line;
|
|
2150
|
-
composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
|
|
2151
|
-
_result.push(state.result);
|
|
2152
|
-
skipSeparationSpace(state, true, -1);
|
|
2153
|
-
ch = state.input.charCodeAt(state.position);
|
|
2154
|
-
if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
|
|
2155
|
-
throwError(state, "bad indentation of a sequence entry");
|
|
2156
|
-
} else if (state.lineIndent < nodeIndent) {
|
|
2157
|
-
break;
|
|
2158
|
-
}
|
|
2159
|
-
}
|
|
2160
|
-
if (detected) {
|
|
2161
|
-
state.tag = _tag;
|
|
2162
|
-
state.anchor = _anchor;
|
|
2163
|
-
state.kind = "sequence";
|
|
2164
|
-
state.result = _result;
|
|
2165
|
-
return true;
|
|
2166
|
-
}
|
|
2167
|
-
return false;
|
|
2168
|
-
}
|
|
2169
|
-
function readBlockMapping(state, nodeIndent, flowIndent) {
|
|
2170
|
-
var following, allowCompact, _line, _pos, _tag = state.tag, _anchor = state.anchor, _result = {}, overridableKeys = {}, keyTag = null, keyNode = null, valueNode = null, atExplicitKey = false, detected = false, ch;
|
|
2171
|
-
if (state.anchor !== null) {
|
|
2172
|
-
state.anchorMap[state.anchor] = _result;
|
|
2173
|
-
}
|
|
2174
|
-
ch = state.input.charCodeAt(state.position);
|
|
2175
|
-
while (ch !== 0) {
|
|
2176
|
-
following = state.input.charCodeAt(state.position + 1);
|
|
2177
|
-
_line = state.line;
|
|
2178
|
-
_pos = state.position;
|
|
2179
|
-
if ((ch === 63 || ch === 58) && is_WS_OR_EOL(following)) {
|
|
2180
|
-
if (ch === 63) {
|
|
2181
|
-
if (atExplicitKey) {
|
|
2182
|
-
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
|
|
2183
|
-
keyTag = keyNode = valueNode = null;
|
|
2184
|
-
}
|
|
2185
|
-
detected = true;
|
|
2186
|
-
atExplicitKey = true;
|
|
2187
|
-
allowCompact = true;
|
|
2188
|
-
} else if (atExplicitKey) {
|
|
2189
|
-
atExplicitKey = false;
|
|
2190
|
-
allowCompact = true;
|
|
2191
|
-
} else {
|
|
2192
|
-
throwError(state, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");
|
|
2193
|
-
}
|
|
2194
|
-
state.position += 1;
|
|
2195
|
-
ch = following;
|
|
2196
|
-
} else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
|
|
2197
|
-
if (state.line === _line) {
|
|
2198
|
-
ch = state.input.charCodeAt(state.position);
|
|
2199
|
-
while (is_WHITE_SPACE(ch)) {
|
|
2200
|
-
ch = state.input.charCodeAt(++state.position);
|
|
2201
|
-
}
|
|
2202
|
-
if (ch === 58) {
|
|
2203
|
-
ch = state.input.charCodeAt(++state.position);
|
|
2204
|
-
if (!is_WS_OR_EOL(ch)) {
|
|
2205
|
-
throwError(state, "a whitespace character is expected after the key-value separator within a block mapping");
|
|
2206
|
-
}
|
|
2207
|
-
if (atExplicitKey) {
|
|
2208
|
-
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
|
|
2209
|
-
keyTag = keyNode = valueNode = null;
|
|
2210
|
-
}
|
|
2211
|
-
detected = true;
|
|
2212
|
-
atExplicitKey = false;
|
|
2213
|
-
allowCompact = false;
|
|
2214
|
-
keyTag = state.tag;
|
|
2215
|
-
keyNode = state.result;
|
|
2216
|
-
} else if (detected) {
|
|
2217
|
-
throwError(state, "can not read an implicit mapping pair; a colon is missed");
|
|
2218
|
-
} else {
|
|
2219
|
-
state.tag = _tag;
|
|
2220
|
-
state.anchor = _anchor;
|
|
2221
|
-
return true;
|
|
2222
|
-
}
|
|
2223
|
-
} else if (detected) {
|
|
2224
|
-
throwError(state, "can not read a block mapping entry; a multiline key may not be an implicit key");
|
|
2225
|
-
} else {
|
|
2226
|
-
state.tag = _tag;
|
|
2227
|
-
state.anchor = _anchor;
|
|
2228
|
-
return true;
|
|
2229
|
-
}
|
|
2230
|
-
} else {
|
|
2231
|
-
break;
|
|
2232
|
-
}
|
|
2233
|
-
if (state.line === _line || state.lineIndent > nodeIndent) {
|
|
2234
|
-
if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
|
|
2235
|
-
if (atExplicitKey) {
|
|
2236
|
-
keyNode = state.result;
|
|
2237
|
-
} else {
|
|
2238
|
-
valueNode = state.result;
|
|
2239
|
-
}
|
|
2240
|
-
}
|
|
2241
|
-
if (!atExplicitKey) {
|
|
2242
|
-
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _pos);
|
|
2243
|
-
keyTag = keyNode = valueNode = null;
|
|
2244
|
-
}
|
|
2245
|
-
skipSeparationSpace(state, true, -1);
|
|
2246
|
-
ch = state.input.charCodeAt(state.position);
|
|
2247
|
-
}
|
|
2248
|
-
if (state.lineIndent > nodeIndent && ch !== 0) {
|
|
2249
|
-
throwError(state, "bad indentation of a mapping entry");
|
|
2250
|
-
} else if (state.lineIndent < nodeIndent) {
|
|
2251
|
-
break;
|
|
2252
|
-
}
|
|
2253
|
-
}
|
|
2254
|
-
if (atExplicitKey) {
|
|
2255
|
-
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
|
|
2256
|
-
}
|
|
2257
|
-
if (detected) {
|
|
2258
|
-
state.tag = _tag;
|
|
2259
|
-
state.anchor = _anchor;
|
|
2260
|
-
state.kind = "mapping";
|
|
2261
|
-
state.result = _result;
|
|
2262
|
-
}
|
|
2263
|
-
return detected;
|
|
2264
|
-
}
|
|
2265
|
-
function readTagProperty(state) {
|
|
2266
|
-
var _position, isVerbatim = false, isNamed = false, tagHandle, tagName, ch;
|
|
2267
|
-
ch = state.input.charCodeAt(state.position);
|
|
2268
|
-
if (ch !== 33)
|
|
2269
|
-
return false;
|
|
2270
|
-
if (state.tag !== null) {
|
|
2271
|
-
throwError(state, "duplication of a tag property");
|
|
2272
|
-
}
|
|
2273
|
-
ch = state.input.charCodeAt(++state.position);
|
|
2274
|
-
if (ch === 60) {
|
|
2275
|
-
isVerbatim = true;
|
|
2276
|
-
ch = state.input.charCodeAt(++state.position);
|
|
2277
|
-
} else if (ch === 33) {
|
|
2278
|
-
isNamed = true;
|
|
2279
|
-
tagHandle = "!!";
|
|
2280
|
-
ch = state.input.charCodeAt(++state.position);
|
|
2281
|
-
} else {
|
|
2282
|
-
tagHandle = "!";
|
|
2283
|
-
}
|
|
2284
|
-
_position = state.position;
|
|
2285
|
-
if (isVerbatim) {
|
|
2286
|
-
do {
|
|
2287
|
-
ch = state.input.charCodeAt(++state.position);
|
|
2288
|
-
} while (ch !== 0 && ch !== 62);
|
|
2289
|
-
if (state.position < state.length) {
|
|
2290
|
-
tagName = state.input.slice(_position, state.position);
|
|
2291
|
-
ch = state.input.charCodeAt(++state.position);
|
|
2292
|
-
} else {
|
|
2293
|
-
throwError(state, "unexpected end of the stream within a verbatim tag");
|
|
2294
|
-
}
|
|
2295
|
-
} else {
|
|
2296
|
-
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
|
2297
|
-
if (ch === 33) {
|
|
2298
|
-
if (!isNamed) {
|
|
2299
|
-
tagHandle = state.input.slice(_position - 1, state.position + 1);
|
|
2300
|
-
if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
|
|
2301
|
-
throwError(state, "named tag handle cannot contain such characters");
|
|
2302
|
-
}
|
|
2303
|
-
isNamed = true;
|
|
2304
|
-
_position = state.position + 1;
|
|
2305
|
-
} else {
|
|
2306
|
-
throwError(state, "tag suffix cannot contain exclamation marks");
|
|
2307
|
-
}
|
|
2308
|
-
}
|
|
2309
|
-
ch = state.input.charCodeAt(++state.position);
|
|
2310
|
-
}
|
|
2311
|
-
tagName = state.input.slice(_position, state.position);
|
|
2312
|
-
if (PATTERN_FLOW_INDICATORS.test(tagName)) {
|
|
2313
|
-
throwError(state, "tag suffix cannot contain flow indicator characters");
|
|
2314
|
-
}
|
|
2315
|
-
}
|
|
2316
|
-
if (tagName && !PATTERN_TAG_URI.test(tagName)) {
|
|
2317
|
-
throwError(state, "tag name cannot contain such characters: " + tagName);
|
|
2318
|
-
}
|
|
2319
|
-
if (isVerbatim) {
|
|
2320
|
-
state.tag = tagName;
|
|
2321
|
-
} else if (_hasOwnProperty.call(state.tagMap, tagHandle)) {
|
|
2322
|
-
state.tag = state.tagMap[tagHandle] + tagName;
|
|
2323
|
-
} else if (tagHandle === "!") {
|
|
2324
|
-
state.tag = "!" + tagName;
|
|
2325
|
-
} else if (tagHandle === "!!") {
|
|
2326
|
-
state.tag = "tag:yaml.org,2002:" + tagName;
|
|
2327
|
-
} else {
|
|
2328
|
-
throwError(state, 'undeclared tag handle "' + tagHandle + '"');
|
|
2329
|
-
}
|
|
2330
|
-
return true;
|
|
2331
|
-
}
|
|
2332
|
-
function readAnchorProperty(state) {
|
|
2333
|
-
var _position, ch;
|
|
2334
|
-
ch = state.input.charCodeAt(state.position);
|
|
2335
|
-
if (ch !== 38)
|
|
2336
|
-
return false;
|
|
2337
|
-
if (state.anchor !== null) {
|
|
2338
|
-
throwError(state, "duplication of an anchor property");
|
|
2339
|
-
}
|
|
2340
|
-
ch = state.input.charCodeAt(++state.position);
|
|
2341
|
-
_position = state.position;
|
|
2342
|
-
while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
|
|
2343
|
-
ch = state.input.charCodeAt(++state.position);
|
|
2344
|
-
}
|
|
2345
|
-
if (state.position === _position) {
|
|
2346
|
-
throwError(state, "name of an anchor node must contain at least one character");
|
|
2347
|
-
}
|
|
2348
|
-
state.anchor = state.input.slice(_position, state.position);
|
|
2349
|
-
return true;
|
|
2350
|
-
}
|
|
2351
|
-
function readAlias(state) {
|
|
2352
|
-
var _position, alias, ch;
|
|
2353
|
-
ch = state.input.charCodeAt(state.position);
|
|
2354
|
-
if (ch !== 42)
|
|
2355
|
-
return false;
|
|
2356
|
-
ch = state.input.charCodeAt(++state.position);
|
|
2357
|
-
_position = state.position;
|
|
2358
|
-
while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
|
|
2359
|
-
ch = state.input.charCodeAt(++state.position);
|
|
2360
|
-
}
|
|
2361
|
-
if (state.position === _position) {
|
|
2362
|
-
throwError(state, "name of an alias node must contain at least one character");
|
|
2363
|
-
}
|
|
2364
|
-
alias = state.input.slice(_position, state.position);
|
|
2365
|
-
if (!_hasOwnProperty.call(state.anchorMap, alias)) {
|
|
2366
|
-
throwError(state, 'unidentified alias "' + alias + '"');
|
|
2367
|
-
}
|
|
2368
|
-
state.result = state.anchorMap[alias];
|
|
2369
|
-
skipSeparationSpace(state, true, -1);
|
|
2370
|
-
return true;
|
|
2371
|
-
}
|
|
2372
|
-
function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
|
|
2373
|
-
var allowBlockStyles, allowBlockScalars, allowBlockCollections, indentStatus = 1, atNewLine = false, hasContent = false, typeIndex, typeQuantity, type, flowIndent, blockIndent;
|
|
2374
|
-
if (state.listener !== null) {
|
|
2375
|
-
state.listener("open", state);
|
|
2376
|
-
}
|
|
2377
|
-
state.tag = null;
|
|
2378
|
-
state.anchor = null;
|
|
2379
|
-
state.kind = null;
|
|
2380
|
-
state.result = null;
|
|
2381
|
-
allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext;
|
|
2382
|
-
if (allowToSeek) {
|
|
2383
|
-
if (skipSeparationSpace(state, true, -1)) {
|
|
2384
|
-
atNewLine = true;
|
|
2385
|
-
if (state.lineIndent > parentIndent) {
|
|
2386
|
-
indentStatus = 1;
|
|
2387
|
-
} else if (state.lineIndent === parentIndent) {
|
|
2388
|
-
indentStatus = 0;
|
|
2389
|
-
} else if (state.lineIndent < parentIndent) {
|
|
2390
|
-
indentStatus = -1;
|
|
2391
|
-
}
|
|
2392
|
-
}
|
|
2393
|
-
}
|
|
2394
|
-
if (indentStatus === 1) {
|
|
2395
|
-
while (readTagProperty(state) || readAnchorProperty(state)) {
|
|
2396
|
-
if (skipSeparationSpace(state, true, -1)) {
|
|
2397
|
-
atNewLine = true;
|
|
2398
|
-
allowBlockCollections = allowBlockStyles;
|
|
2399
|
-
if (state.lineIndent > parentIndent) {
|
|
2400
|
-
indentStatus = 1;
|
|
2401
|
-
} else if (state.lineIndent === parentIndent) {
|
|
2402
|
-
indentStatus = 0;
|
|
2403
|
-
} else if (state.lineIndent < parentIndent) {
|
|
2404
|
-
indentStatus = -1;
|
|
2405
|
-
}
|
|
2406
|
-
} else {
|
|
2407
|
-
allowBlockCollections = false;
|
|
2408
|
-
}
|
|
2409
|
-
}
|
|
2410
|
-
}
|
|
2411
|
-
if (allowBlockCollections) {
|
|
2412
|
-
allowBlockCollections = atNewLine || allowCompact;
|
|
2413
|
-
}
|
|
2414
|
-
if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
|
|
2415
|
-
if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
|
|
2416
|
-
flowIndent = parentIndent;
|
|
2417
|
-
} else {
|
|
2418
|
-
flowIndent = parentIndent + 1;
|
|
2419
|
-
}
|
|
2420
|
-
blockIndent = state.position - state.lineStart;
|
|
2421
|
-
if (indentStatus === 1) {
|
|
2422
|
-
if (allowBlockCollections && (readBlockSequence(state, blockIndent) || readBlockMapping(state, blockIndent, flowIndent)) || readFlowCollection(state, flowIndent)) {
|
|
2423
|
-
hasContent = true;
|
|
2424
|
-
} else {
|
|
2425
|
-
if (allowBlockScalars && readBlockScalar(state, flowIndent) || readSingleQuotedScalar(state, flowIndent) || readDoubleQuotedScalar(state, flowIndent)) {
|
|
2426
|
-
hasContent = true;
|
|
2427
|
-
} else if (readAlias(state)) {
|
|
2428
|
-
hasContent = true;
|
|
2429
|
-
if (state.tag !== null || state.anchor !== null) {
|
|
2430
|
-
throwError(state, "alias node should not have any properties");
|
|
2431
|
-
}
|
|
2432
|
-
} else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
|
|
2433
|
-
hasContent = true;
|
|
2434
|
-
if (state.tag === null) {
|
|
2435
|
-
state.tag = "?";
|
|
2436
|
-
}
|
|
2437
|
-
}
|
|
2438
|
-
if (state.anchor !== null) {
|
|
2439
|
-
state.anchorMap[state.anchor] = state.result;
|
|
2440
|
-
}
|
|
2441
|
-
}
|
|
2442
|
-
} else if (indentStatus === 0) {
|
|
2443
|
-
hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
|
|
2444
|
-
}
|
|
2445
|
-
}
|
|
2446
|
-
if (state.tag !== null && state.tag !== "!") {
|
|
2447
|
-
if (state.tag === "?") {
|
|
2448
|
-
if (state.result !== null && state.kind !== "scalar") {
|
|
2449
|
-
throwError(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"');
|
|
2450
|
-
}
|
|
2451
|
-
for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
|
|
2452
|
-
type = state.implicitTypes[typeIndex];
|
|
2453
|
-
if (type.resolve(state.result)) {
|
|
2454
|
-
state.result = type.construct(state.result);
|
|
2455
|
-
state.tag = type.tag;
|
|
2456
|
-
if (state.anchor !== null) {
|
|
2457
|
-
state.anchorMap[state.anchor] = state.result;
|
|
2458
|
-
}
|
|
2459
|
-
break;
|
|
2460
|
-
}
|
|
2461
|
-
}
|
|
2462
|
-
} else if (_hasOwnProperty.call(state.typeMap[state.kind || "fallback"], state.tag)) {
|
|
2463
|
-
type = state.typeMap[state.kind || "fallback"][state.tag];
|
|
2464
|
-
if (state.result !== null && type.kind !== state.kind) {
|
|
2465
|
-
throwError(state, "unacceptable node kind for !<" + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"');
|
|
2466
|
-
}
|
|
2467
|
-
if (!type.resolve(state.result)) {
|
|
2468
|
-
throwError(state, "cannot resolve a node with !<" + state.tag + "> explicit tag");
|
|
2469
|
-
} else {
|
|
2470
|
-
state.result = type.construct(state.result);
|
|
2471
|
-
if (state.anchor !== null) {
|
|
2472
|
-
state.anchorMap[state.anchor] = state.result;
|
|
2473
|
-
}
|
|
2474
|
-
}
|
|
2475
|
-
} else {
|
|
2476
|
-
throwError(state, "unknown tag !<" + state.tag + ">");
|
|
2477
|
-
}
|
|
2478
|
-
}
|
|
2479
|
-
if (state.listener !== null) {
|
|
2480
|
-
state.listener("close", state);
|
|
2481
|
-
}
|
|
2482
|
-
return state.tag !== null || state.anchor !== null || hasContent;
|
|
2483
|
-
}
|
|
2484
|
-
function readDocument(state) {
|
|
2485
|
-
var documentStart = state.position, _position, directiveName, directiveArgs, hasDirectives = false, ch;
|
|
2486
|
-
state.version = null;
|
|
2487
|
-
state.checkLineBreaks = state.legacy;
|
|
2488
|
-
state.tagMap = {};
|
|
2489
|
-
state.anchorMap = {};
|
|
2490
|
-
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
2491
|
-
skipSeparationSpace(state, true, -1);
|
|
2492
|
-
ch = state.input.charCodeAt(state.position);
|
|
2493
|
-
if (state.lineIndent > 0 || ch !== 37) {
|
|
2494
|
-
break;
|
|
2495
|
-
}
|
|
2496
|
-
hasDirectives = true;
|
|
2497
|
-
ch = state.input.charCodeAt(++state.position);
|
|
2498
|
-
_position = state.position;
|
|
2499
|
-
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
|
2500
|
-
ch = state.input.charCodeAt(++state.position);
|
|
2501
|
-
}
|
|
2502
|
-
directiveName = state.input.slice(_position, state.position);
|
|
2503
|
-
directiveArgs = [];
|
|
2504
|
-
if (directiveName.length < 1) {
|
|
2505
|
-
throwError(state, "directive name must not be less than one character in length");
|
|
2506
|
-
}
|
|
2507
|
-
while (ch !== 0) {
|
|
2508
|
-
while (is_WHITE_SPACE(ch)) {
|
|
2509
|
-
ch = state.input.charCodeAt(++state.position);
|
|
2510
|
-
}
|
|
2511
|
-
if (ch === 35) {
|
|
2512
|
-
do {
|
|
2513
|
-
ch = state.input.charCodeAt(++state.position);
|
|
2514
|
-
} while (ch !== 0 && !is_EOL(ch));
|
|
2515
|
-
break;
|
|
2516
|
-
}
|
|
2517
|
-
if (is_EOL(ch))
|
|
2518
|
-
break;
|
|
2519
|
-
_position = state.position;
|
|
2520
|
-
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
|
2521
|
-
ch = state.input.charCodeAt(++state.position);
|
|
2522
|
-
}
|
|
2523
|
-
directiveArgs.push(state.input.slice(_position, state.position));
|
|
2524
|
-
}
|
|
2525
|
-
if (ch !== 0)
|
|
2526
|
-
readLineBreak(state);
|
|
2527
|
-
if (_hasOwnProperty.call(directiveHandlers, directiveName)) {
|
|
2528
|
-
directiveHandlers[directiveName](state, directiveName, directiveArgs);
|
|
2529
|
-
} else {
|
|
2530
|
-
throwWarning(state, 'unknown document directive "' + directiveName + '"');
|
|
2531
|
-
}
|
|
2532
|
-
}
|
|
2533
|
-
skipSeparationSpace(state, true, -1);
|
|
2534
|
-
if (state.lineIndent === 0 && state.input.charCodeAt(state.position) === 45 && state.input.charCodeAt(state.position + 1) === 45 && state.input.charCodeAt(state.position + 2) === 45) {
|
|
2535
|
-
state.position += 3;
|
|
2536
|
-
skipSeparationSpace(state, true, -1);
|
|
2537
|
-
} else if (hasDirectives) {
|
|
2538
|
-
throwError(state, "directives end mark is expected");
|
|
2539
|
-
}
|
|
2540
|
-
composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
|
|
2541
|
-
skipSeparationSpace(state, true, -1);
|
|
2542
|
-
if (state.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
|
|
2543
|
-
throwWarning(state, "non-ASCII line breaks are interpreted as content");
|
|
2544
|
-
}
|
|
2545
|
-
state.documents.push(state.result);
|
|
2546
|
-
if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
2547
|
-
if (state.input.charCodeAt(state.position) === 46) {
|
|
2548
|
-
state.position += 3;
|
|
2549
|
-
skipSeparationSpace(state, true, -1);
|
|
2550
|
-
}
|
|
2551
|
-
return;
|
|
2552
|
-
}
|
|
2553
|
-
if (state.position < state.length - 1) {
|
|
2554
|
-
throwError(state, "end of the stream or a document separator is expected");
|
|
2555
|
-
} else {
|
|
2556
|
-
return;
|
|
2557
|
-
}
|
|
2558
|
-
}
|
|
2559
|
-
function loadDocuments(input, options2) {
|
|
2560
|
-
input = String(input);
|
|
2561
|
-
options2 = options2 || {};
|
|
2562
|
-
if (input.length !== 0) {
|
|
2563
|
-
if (input.charCodeAt(input.length - 1) !== 10 && input.charCodeAt(input.length - 1) !== 13) {
|
|
2564
|
-
input += "\n";
|
|
2565
|
-
}
|
|
2566
|
-
if (input.charCodeAt(0) === 65279) {
|
|
2567
|
-
input = input.slice(1);
|
|
2568
|
-
}
|
|
2569
|
-
}
|
|
2570
|
-
var state = new State(input, options2);
|
|
2571
|
-
var nullpos = input.indexOf("\0");
|
|
2572
|
-
if (nullpos !== -1) {
|
|
2573
|
-
state.position = nullpos;
|
|
2574
|
-
throwError(state, "null byte is not allowed in input");
|
|
2575
|
-
}
|
|
2576
|
-
state.input += "\0";
|
|
2577
|
-
while (state.input.charCodeAt(state.position) === 32) {
|
|
2578
|
-
state.lineIndent += 1;
|
|
2579
|
-
state.position += 1;
|
|
2580
|
-
}
|
|
2581
|
-
while (state.position < state.length - 1) {
|
|
2582
|
-
readDocument(state);
|
|
2583
|
-
}
|
|
2584
|
-
return state.documents;
|
|
2585
|
-
}
|
|
2586
|
-
function loadAll(input, iterator, options2) {
|
|
2587
|
-
if (iterator !== null && typeof iterator === "object" && typeof options2 === "undefined") {
|
|
2588
|
-
options2 = iterator;
|
|
2589
|
-
iterator = null;
|
|
2590
|
-
}
|
|
2591
|
-
var documents = loadDocuments(input, options2);
|
|
2592
|
-
if (typeof iterator !== "function") {
|
|
2593
|
-
return documents;
|
|
2594
|
-
}
|
|
2595
|
-
for (var index = 0, length = documents.length; index < length; index += 1) {
|
|
2596
|
-
iterator(documents[index]);
|
|
2597
|
-
}
|
|
2598
|
-
}
|
|
2599
|
-
function load(input, options2) {
|
|
2600
|
-
var documents = loadDocuments(input, options2);
|
|
2601
|
-
if (documents.length === 0) {
|
|
2602
|
-
return void 0;
|
|
2603
|
-
} else if (documents.length === 1) {
|
|
2604
|
-
return documents[0];
|
|
2605
|
-
}
|
|
2606
|
-
throw new YAMLException("expected a single document in the stream, but found more");
|
|
2607
|
-
}
|
|
2608
|
-
function safeLoadAll(input, iterator, options2) {
|
|
2609
|
-
if (typeof iterator === "object" && iterator !== null && typeof options2 === "undefined") {
|
|
2610
|
-
options2 = iterator;
|
|
2611
|
-
iterator = null;
|
|
2612
|
-
}
|
|
2613
|
-
return loadAll(input, iterator, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options2));
|
|
2614
|
-
}
|
|
2615
|
-
function safeLoad(input, options2) {
|
|
2616
|
-
return load(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options2));
|
|
2617
|
-
}
|
|
2618
|
-
module2.exports.loadAll = loadAll;
|
|
2619
|
-
module2.exports.load = load;
|
|
2620
|
-
module2.exports.safeLoadAll = safeLoadAll;
|
|
2621
|
-
module2.exports.safeLoad = safeLoad;
|
|
2622
|
-
}
|
|
2623
|
-
});
|
|
2624
|
-
|
|
2625
|
-
// ../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/dumper.js
|
|
2626
|
-
var require_dumper = __commonJS({
|
|
2627
|
-
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/dumper.js"(exports2, module2) {
|
|
2628
|
-
"use strict";
|
|
2629
|
-
var common = require_common();
|
|
2630
|
-
var YAMLException = require_exception();
|
|
2631
|
-
var DEFAULT_FULL_SCHEMA = require_default_full();
|
|
2632
|
-
var DEFAULT_SAFE_SCHEMA = require_default_safe();
|
|
2633
|
-
var _toString = Object.prototype.toString;
|
|
2634
|
-
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
2635
|
-
var CHAR_TAB = 9;
|
|
2636
|
-
var CHAR_LINE_FEED = 10;
|
|
2637
|
-
var CHAR_CARRIAGE_RETURN = 13;
|
|
2638
|
-
var CHAR_SPACE = 32;
|
|
2639
|
-
var CHAR_EXCLAMATION = 33;
|
|
2640
|
-
var CHAR_DOUBLE_QUOTE = 34;
|
|
2641
|
-
var CHAR_SHARP = 35;
|
|
2642
|
-
var CHAR_PERCENT = 37;
|
|
2643
|
-
var CHAR_AMPERSAND = 38;
|
|
2644
|
-
var CHAR_SINGLE_QUOTE = 39;
|
|
2645
|
-
var CHAR_ASTERISK = 42;
|
|
2646
|
-
var CHAR_COMMA = 44;
|
|
2647
|
-
var CHAR_MINUS = 45;
|
|
2648
|
-
var CHAR_COLON = 58;
|
|
2649
|
-
var CHAR_EQUALS = 61;
|
|
2650
|
-
var CHAR_GREATER_THAN = 62;
|
|
2651
|
-
var CHAR_QUESTION = 63;
|
|
2652
|
-
var CHAR_COMMERCIAL_AT = 64;
|
|
2653
|
-
var CHAR_LEFT_SQUARE_BRACKET = 91;
|
|
2654
|
-
var CHAR_RIGHT_SQUARE_BRACKET = 93;
|
|
2655
|
-
var CHAR_GRAVE_ACCENT = 96;
|
|
2656
|
-
var CHAR_LEFT_CURLY_BRACKET = 123;
|
|
2657
|
-
var CHAR_VERTICAL_LINE = 124;
|
|
2658
|
-
var CHAR_RIGHT_CURLY_BRACKET = 125;
|
|
2659
|
-
var ESCAPE_SEQUENCES = {};
|
|
2660
|
-
ESCAPE_SEQUENCES[0] = "\\0";
|
|
2661
|
-
ESCAPE_SEQUENCES[7] = "\\a";
|
|
2662
|
-
ESCAPE_SEQUENCES[8] = "\\b";
|
|
2663
|
-
ESCAPE_SEQUENCES[9] = "\\t";
|
|
2664
|
-
ESCAPE_SEQUENCES[10] = "\\n";
|
|
2665
|
-
ESCAPE_SEQUENCES[11] = "\\v";
|
|
2666
|
-
ESCAPE_SEQUENCES[12] = "\\f";
|
|
2667
|
-
ESCAPE_SEQUENCES[13] = "\\r";
|
|
2668
|
-
ESCAPE_SEQUENCES[27] = "\\e";
|
|
2669
|
-
ESCAPE_SEQUENCES[34] = '\\"';
|
|
2670
|
-
ESCAPE_SEQUENCES[92] = "\\\\";
|
|
2671
|
-
ESCAPE_SEQUENCES[133] = "\\N";
|
|
2672
|
-
ESCAPE_SEQUENCES[160] = "\\_";
|
|
2673
|
-
ESCAPE_SEQUENCES[8232] = "\\L";
|
|
2674
|
-
ESCAPE_SEQUENCES[8233] = "\\P";
|
|
2675
|
-
var DEPRECATED_BOOLEANS_SYNTAX = [
|
|
2676
|
-
"y",
|
|
2677
|
-
"Y",
|
|
2678
|
-
"yes",
|
|
2679
|
-
"Yes",
|
|
2680
|
-
"YES",
|
|
2681
|
-
"on",
|
|
2682
|
-
"On",
|
|
2683
|
-
"ON",
|
|
2684
|
-
"n",
|
|
2685
|
-
"N",
|
|
2686
|
-
"no",
|
|
2687
|
-
"No",
|
|
2688
|
-
"NO",
|
|
2689
|
-
"off",
|
|
2690
|
-
"Off",
|
|
2691
|
-
"OFF"
|
|
2692
|
-
];
|
|
2693
|
-
function compileStyleMap(schema, map) {
|
|
2694
|
-
var result, keys, index, length, tag, style, type;
|
|
2695
|
-
if (map === null)
|
|
2696
|
-
return {};
|
|
2697
|
-
result = {};
|
|
2698
|
-
keys = Object.keys(map);
|
|
2699
|
-
for (index = 0, length = keys.length; index < length; index += 1) {
|
|
2700
|
-
tag = keys[index];
|
|
2701
|
-
style = String(map[tag]);
|
|
2702
|
-
if (tag.slice(0, 2) === "!!") {
|
|
2703
|
-
tag = "tag:yaml.org,2002:" + tag.slice(2);
|
|
2704
|
-
}
|
|
2705
|
-
type = schema.compiledTypeMap["fallback"][tag];
|
|
2706
|
-
if (type && _hasOwnProperty.call(type.styleAliases, style)) {
|
|
2707
|
-
style = type.styleAliases[style];
|
|
2708
|
-
}
|
|
2709
|
-
result[tag] = style;
|
|
2710
|
-
}
|
|
2711
|
-
return result;
|
|
2712
|
-
}
|
|
2713
|
-
function encodeHex(character) {
|
|
2714
|
-
var string, handle, length;
|
|
2715
|
-
string = character.toString(16).toUpperCase();
|
|
2716
|
-
if (character <= 255) {
|
|
2717
|
-
handle = "x";
|
|
2718
|
-
length = 2;
|
|
2719
|
-
} else if (character <= 65535) {
|
|
2720
|
-
handle = "u";
|
|
2721
|
-
length = 4;
|
|
2722
|
-
} else if (character <= 4294967295) {
|
|
2723
|
-
handle = "U";
|
|
2724
|
-
length = 8;
|
|
2725
|
-
} else {
|
|
2726
|
-
throw new YAMLException("code point within a string may not be greater than 0xFFFFFFFF");
|
|
2727
|
-
}
|
|
2728
|
-
return "\\" + handle + common.repeat("0", length - string.length) + string;
|
|
2729
|
-
}
|
|
2730
|
-
function State(options2) {
|
|
2731
|
-
this.schema = options2["schema"] || DEFAULT_FULL_SCHEMA;
|
|
2732
|
-
this.indent = Math.max(1, options2["indent"] || 2);
|
|
2733
|
-
this.noArrayIndent = options2["noArrayIndent"] || false;
|
|
2734
|
-
this.skipInvalid = options2["skipInvalid"] || false;
|
|
2735
|
-
this.flowLevel = common.isNothing(options2["flowLevel"]) ? -1 : options2["flowLevel"];
|
|
2736
|
-
this.styleMap = compileStyleMap(this.schema, options2["styles"] || null);
|
|
2737
|
-
this.sortKeys = options2["sortKeys"] || false;
|
|
2738
|
-
this.lineWidth = options2["lineWidth"] || 80;
|
|
2739
|
-
this.noRefs = options2["noRefs"] || false;
|
|
2740
|
-
this.noCompatMode = options2["noCompatMode"] || false;
|
|
2741
|
-
this.condenseFlow = options2["condenseFlow"] || false;
|
|
2742
|
-
this.implicitTypes = this.schema.compiledImplicit;
|
|
2743
|
-
this.explicitTypes = this.schema.compiledExplicit;
|
|
2744
|
-
this.tag = null;
|
|
2745
|
-
this.result = "";
|
|
2746
|
-
this.duplicates = [];
|
|
2747
|
-
this.usedDuplicates = null;
|
|
2748
|
-
}
|
|
2749
|
-
function indentString(string, spaces) {
|
|
2750
|
-
var ind = common.repeat(" ", spaces), position = 0, next = -1, result = "", line, length = string.length;
|
|
2751
|
-
while (position < length) {
|
|
2752
|
-
next = string.indexOf("\n", position);
|
|
2753
|
-
if (next === -1) {
|
|
2754
|
-
line = string.slice(position);
|
|
2755
|
-
position = length;
|
|
2756
|
-
} else {
|
|
2757
|
-
line = string.slice(position, next + 1);
|
|
2758
|
-
position = next + 1;
|
|
2759
|
-
}
|
|
2760
|
-
if (line.length && line !== "\n")
|
|
2761
|
-
result += ind;
|
|
2762
|
-
result += line;
|
|
2763
|
-
}
|
|
2764
|
-
return result;
|
|
2765
|
-
}
|
|
2766
|
-
function generateNextLine(state, level) {
|
|
2767
|
-
return "\n" + common.repeat(" ", state.indent * level);
|
|
2768
|
-
}
|
|
2769
|
-
function testImplicitResolving(state, str2) {
|
|
2770
|
-
var index, length, type;
|
|
2771
|
-
for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {
|
|
2772
|
-
type = state.implicitTypes[index];
|
|
2773
|
-
if (type.resolve(str2)) {
|
|
2774
|
-
return true;
|
|
2775
|
-
}
|
|
2776
|
-
}
|
|
2777
|
-
return false;
|
|
2778
|
-
}
|
|
2779
|
-
function isWhitespace(c) {
|
|
2780
|
-
return c === CHAR_SPACE || c === CHAR_TAB;
|
|
2781
|
-
}
|
|
2782
|
-
function isPrintable(c) {
|
|
2783
|
-
return 32 <= c && c <= 126 || 161 <= c && c <= 55295 && c !== 8232 && c !== 8233 || 57344 <= c && c <= 65533 && c !== 65279 || 65536 <= c && c <= 1114111;
|
|
2784
|
-
}
|
|
2785
|
-
function isNsChar(c) {
|
|
2786
|
-
return isPrintable(c) && !isWhitespace(c) && c !== 65279 && c !== CHAR_CARRIAGE_RETURN && c !== CHAR_LINE_FEED;
|
|
2787
|
-
}
|
|
2788
|
-
function isPlainSafe(c, prev) {
|
|
2789
|
-
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));
|
|
2790
|
-
}
|
|
2791
|
-
function isPlainSafeFirst(c) {
|
|
2792
|
-
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;
|
|
2793
|
-
}
|
|
2794
|
-
function needIndentIndicator(string) {
|
|
2795
|
-
var leadingSpaceRe = /^\n* /;
|
|
2796
|
-
return leadingSpaceRe.test(string);
|
|
2797
|
-
}
|
|
2798
|
-
var STYLE_PLAIN = 1;
|
|
2799
|
-
var STYLE_SINGLE = 2;
|
|
2800
|
-
var STYLE_LITERAL = 3;
|
|
2801
|
-
var STYLE_FOLDED = 4;
|
|
2802
|
-
var STYLE_DOUBLE = 5;
|
|
2803
|
-
function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType) {
|
|
2804
|
-
var i;
|
|
2805
|
-
var char, prev_char;
|
|
2806
|
-
var hasLineBreak = false;
|
|
2807
|
-
var hasFoldableLine = false;
|
|
2808
|
-
var shouldTrackWidth = lineWidth !== -1;
|
|
2809
|
-
var previousLineBreak = -1;
|
|
2810
|
-
var plain = isPlainSafeFirst(string.charCodeAt(0)) && !isWhitespace(string.charCodeAt(string.length - 1));
|
|
2811
|
-
if (singleLineOnly) {
|
|
2812
|
-
for (i = 0; i < string.length; i++) {
|
|
2813
|
-
char = string.charCodeAt(i);
|
|
2814
|
-
if (!isPrintable(char)) {
|
|
2815
|
-
return STYLE_DOUBLE;
|
|
2816
|
-
}
|
|
2817
|
-
prev_char = i > 0 ? string.charCodeAt(i - 1) : null;
|
|
2818
|
-
plain = plain && isPlainSafe(char, prev_char);
|
|
2819
|
-
}
|
|
2820
|
-
} else {
|
|
2821
|
-
for (i = 0; i < string.length; i++) {
|
|
2822
|
-
char = string.charCodeAt(i);
|
|
2823
|
-
if (char === CHAR_LINE_FEED) {
|
|
2824
|
-
hasLineBreak = true;
|
|
2825
|
-
if (shouldTrackWidth) {
|
|
2826
|
-
hasFoldableLine = hasFoldableLine || // Foldable line = too long, and not more-indented.
|
|
2827
|
-
i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ";
|
|
2828
|
-
previousLineBreak = i;
|
|
2829
|
-
}
|
|
2830
|
-
} else if (!isPrintable(char)) {
|
|
2831
|
-
return STYLE_DOUBLE;
|
|
2832
|
-
}
|
|
2833
|
-
prev_char = i > 0 ? string.charCodeAt(i - 1) : null;
|
|
2834
|
-
plain = plain && isPlainSafe(char, prev_char);
|
|
2835
|
-
}
|
|
2836
|
-
hasFoldableLine = hasFoldableLine || shouldTrackWidth && (i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ");
|
|
2837
|
-
}
|
|
2838
|
-
if (!hasLineBreak && !hasFoldableLine) {
|
|
2839
|
-
return plain && !testAmbiguousType(string) ? STYLE_PLAIN : STYLE_SINGLE;
|
|
2840
|
-
}
|
|
2841
|
-
if (indentPerLevel > 9 && needIndentIndicator(string)) {
|
|
2842
|
-
return STYLE_DOUBLE;
|
|
2843
|
-
}
|
|
2844
|
-
return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
|
|
2845
|
-
}
|
|
2846
|
-
function writeScalar(state, string, level, iskey) {
|
|
2847
|
-
state.dump = function() {
|
|
2848
|
-
if (string.length === 0) {
|
|
2849
|
-
return "''";
|
|
2850
|
-
}
|
|
2851
|
-
if (!state.noCompatMode && DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1) {
|
|
2852
|
-
return "'" + string + "'";
|
|
2853
|
-
}
|
|
2854
|
-
var indent = state.indent * Math.max(1, level);
|
|
2855
|
-
var lineWidth = state.lineWidth === -1 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
|
|
2856
|
-
var singleLineOnly = iskey || state.flowLevel > -1 && level >= state.flowLevel;
|
|
2857
|
-
function testAmbiguity(string2) {
|
|
2858
|
-
return testImplicitResolving(state, string2);
|
|
2859
|
-
}
|
|
2860
|
-
switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity)) {
|
|
2861
|
-
case STYLE_PLAIN:
|
|
2862
|
-
return string;
|
|
2863
|
-
case STYLE_SINGLE:
|
|
2864
|
-
return "'" + string.replace(/'/g, "''") + "'";
|
|
2865
|
-
case STYLE_LITERAL:
|
|
2866
|
-
return "|" + blockHeader(string, state.indent) + dropEndingNewline(indentString(string, indent));
|
|
2867
|
-
case STYLE_FOLDED:
|
|
2868
|
-
return ">" + blockHeader(string, state.indent) + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
|
|
2869
|
-
case STYLE_DOUBLE:
|
|
2870
|
-
return '"' + escapeString(string, lineWidth) + '"';
|
|
2871
|
-
default:
|
|
2872
|
-
throw new YAMLException("impossible error: invalid scalar style");
|
|
2873
|
-
}
|
|
2874
|
-
}();
|
|
2875
|
-
}
|
|
2876
|
-
function blockHeader(string, indentPerLevel) {
|
|
2877
|
-
var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : "";
|
|
2878
|
-
var clip = string[string.length - 1] === "\n";
|
|
2879
|
-
var keep = clip && (string[string.length - 2] === "\n" || string === "\n");
|
|
2880
|
-
var chomp = keep ? "+" : clip ? "" : "-";
|
|
2881
|
-
return indentIndicator + chomp + "\n";
|
|
2882
|
-
}
|
|
2883
|
-
function dropEndingNewline(string) {
|
|
2884
|
-
return string[string.length - 1] === "\n" ? string.slice(0, -1) : string;
|
|
2885
|
-
}
|
|
2886
|
-
function foldString(string, width) {
|
|
2887
|
-
var lineRe = /(\n+)([^\n]*)/g;
|
|
2888
|
-
var result = function() {
|
|
2889
|
-
var nextLF = string.indexOf("\n");
|
|
2890
|
-
nextLF = nextLF !== -1 ? nextLF : string.length;
|
|
2891
|
-
lineRe.lastIndex = nextLF;
|
|
2892
|
-
return foldLine(string.slice(0, nextLF), width);
|
|
2893
|
-
}();
|
|
2894
|
-
var prevMoreIndented = string[0] === "\n" || string[0] === " ";
|
|
2895
|
-
var moreIndented;
|
|
2896
|
-
var match;
|
|
2897
|
-
while (match = lineRe.exec(string)) {
|
|
2898
|
-
var prefix = match[1], line = match[2];
|
|
2899
|
-
moreIndented = line[0] === " ";
|
|
2900
|
-
result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? "\n" : "") + foldLine(line, width);
|
|
2901
|
-
prevMoreIndented = moreIndented;
|
|
2902
|
-
}
|
|
2903
|
-
return result;
|
|
2904
|
-
}
|
|
2905
|
-
function foldLine(line, width) {
|
|
2906
|
-
if (line === "" || line[0] === " ")
|
|
2907
|
-
return line;
|
|
2908
|
-
var breakRe = / [^ ]/g;
|
|
2909
|
-
var match;
|
|
2910
|
-
var start = 0, end, curr = 0, next = 0;
|
|
2911
|
-
var result = "";
|
|
2912
|
-
while (match = breakRe.exec(line)) {
|
|
2913
|
-
next = match.index;
|
|
2914
|
-
if (next - start > width) {
|
|
2915
|
-
end = curr > start ? curr : next;
|
|
2916
|
-
result += "\n" + line.slice(start, end);
|
|
2917
|
-
start = end + 1;
|
|
2918
|
-
}
|
|
2919
|
-
curr = next;
|
|
2920
|
-
}
|
|
2921
|
-
result += "\n";
|
|
2922
|
-
if (line.length - start > width && curr > start) {
|
|
2923
|
-
result += line.slice(start, curr) + "\n" + line.slice(curr + 1);
|
|
2924
|
-
} else {
|
|
2925
|
-
result += line.slice(start);
|
|
2926
|
-
}
|
|
2927
|
-
return result.slice(1);
|
|
2928
|
-
}
|
|
2929
|
-
function escapeString(string) {
|
|
2930
|
-
var result = "";
|
|
2931
|
-
var char, nextChar;
|
|
2932
|
-
var escapeSeq;
|
|
2933
|
-
for (var i = 0; i < string.length; i++) {
|
|
2934
|
-
char = string.charCodeAt(i);
|
|
2935
|
-
if (char >= 55296 && char <= 56319) {
|
|
2936
|
-
nextChar = string.charCodeAt(i + 1);
|
|
2937
|
-
if (nextChar >= 56320 && nextChar <= 57343) {
|
|
2938
|
-
result += encodeHex((char - 55296) * 1024 + nextChar - 56320 + 65536);
|
|
2939
|
-
i++;
|
|
2940
|
-
continue;
|
|
2941
|
-
}
|
|
2942
|
-
}
|
|
2943
|
-
escapeSeq = ESCAPE_SEQUENCES[char];
|
|
2944
|
-
result += !escapeSeq && isPrintable(char) ? string[i] : escapeSeq || encodeHex(char);
|
|
2945
|
-
}
|
|
2946
|
-
return result;
|
|
2947
|
-
}
|
|
2948
|
-
function writeFlowSequence(state, level, object) {
|
|
2949
|
-
var _result = "", _tag = state.tag, index, length;
|
|
2950
|
-
for (index = 0, length = object.length; index < length; index += 1) {
|
|
2951
|
-
if (writeNode(state, level, object[index], false, false)) {
|
|
2952
|
-
if (index !== 0)
|
|
2953
|
-
_result += "," + (!state.condenseFlow ? " " : "");
|
|
2954
|
-
_result += state.dump;
|
|
2955
|
-
}
|
|
2956
|
-
}
|
|
2957
|
-
state.tag = _tag;
|
|
2958
|
-
state.dump = "[" + _result + "]";
|
|
2959
|
-
}
|
|
2960
|
-
function writeBlockSequence(state, level, object, compact) {
|
|
2961
|
-
var _result = "", _tag = state.tag, index, length;
|
|
2962
|
-
for (index = 0, length = object.length; index < length; index += 1) {
|
|
2963
|
-
if (writeNode(state, level + 1, object[index], true, true)) {
|
|
2964
|
-
if (!compact || index !== 0) {
|
|
2965
|
-
_result += generateNextLine(state, level);
|
|
2966
|
-
}
|
|
2967
|
-
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
2968
|
-
_result += "-";
|
|
2969
|
-
} else {
|
|
2970
|
-
_result += "- ";
|
|
2971
|
-
}
|
|
2972
|
-
_result += state.dump;
|
|
2973
|
-
}
|
|
2974
|
-
}
|
|
2975
|
-
state.tag = _tag;
|
|
2976
|
-
state.dump = _result || "[]";
|
|
2977
|
-
}
|
|
2978
|
-
function writeFlowMapping(state, level, object) {
|
|
2979
|
-
var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, pairBuffer;
|
|
2980
|
-
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
|
2981
|
-
pairBuffer = "";
|
|
2982
|
-
if (index !== 0)
|
|
2983
|
-
pairBuffer += ", ";
|
|
2984
|
-
if (state.condenseFlow)
|
|
2985
|
-
pairBuffer += '"';
|
|
2986
|
-
objectKey = objectKeyList[index];
|
|
2987
|
-
objectValue = object[objectKey];
|
|
2988
|
-
if (!writeNode(state, level, objectKey, false, false)) {
|
|
2989
|
-
continue;
|
|
2990
|
-
}
|
|
2991
|
-
if (state.dump.length > 1024)
|
|
2992
|
-
pairBuffer += "? ";
|
|
2993
|
-
pairBuffer += state.dump + (state.condenseFlow ? '"' : "") + ":" + (state.condenseFlow ? "" : " ");
|
|
2994
|
-
if (!writeNode(state, level, objectValue, false, false)) {
|
|
2995
|
-
continue;
|
|
2996
|
-
}
|
|
2997
|
-
pairBuffer += state.dump;
|
|
2998
|
-
_result += pairBuffer;
|
|
2999
|
-
}
|
|
3000
|
-
state.tag = _tag;
|
|
3001
|
-
state.dump = "{" + _result + "}";
|
|
3002
|
-
}
|
|
3003
|
-
function writeBlockMapping(state, level, object, compact) {
|
|
3004
|
-
var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, explicitPair, pairBuffer;
|
|
3005
|
-
if (state.sortKeys === true) {
|
|
3006
|
-
objectKeyList.sort();
|
|
3007
|
-
} else if (typeof state.sortKeys === "function") {
|
|
3008
|
-
objectKeyList.sort(state.sortKeys);
|
|
3009
|
-
} else if (state.sortKeys) {
|
|
3010
|
-
throw new YAMLException("sortKeys must be a boolean or a function");
|
|
3011
|
-
}
|
|
3012
|
-
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
|
3013
|
-
pairBuffer = "";
|
|
3014
|
-
if (!compact || index !== 0) {
|
|
3015
|
-
pairBuffer += generateNextLine(state, level);
|
|
3016
|
-
}
|
|
3017
|
-
objectKey = objectKeyList[index];
|
|
3018
|
-
objectValue = object[objectKey];
|
|
3019
|
-
if (!writeNode(state, level + 1, objectKey, true, true, true)) {
|
|
3020
|
-
continue;
|
|
3021
|
-
}
|
|
3022
|
-
explicitPair = state.tag !== null && state.tag !== "?" || state.dump && state.dump.length > 1024;
|
|
3023
|
-
if (explicitPair) {
|
|
3024
|
-
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
3025
|
-
pairBuffer += "?";
|
|
3026
|
-
} else {
|
|
3027
|
-
pairBuffer += "? ";
|
|
3028
|
-
}
|
|
3029
|
-
}
|
|
3030
|
-
pairBuffer += state.dump;
|
|
3031
|
-
if (explicitPair) {
|
|
3032
|
-
pairBuffer += generateNextLine(state, level);
|
|
3033
|
-
}
|
|
3034
|
-
if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
|
|
3035
|
-
continue;
|
|
3036
|
-
}
|
|
3037
|
-
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
3038
|
-
pairBuffer += ":";
|
|
3039
|
-
} else {
|
|
3040
|
-
pairBuffer += ": ";
|
|
3041
|
-
}
|
|
3042
|
-
pairBuffer += state.dump;
|
|
3043
|
-
_result += pairBuffer;
|
|
3044
|
-
}
|
|
3045
|
-
state.tag = _tag;
|
|
3046
|
-
state.dump = _result || "{}";
|
|
3047
|
-
}
|
|
3048
|
-
function detectType(state, object, explicit) {
|
|
3049
|
-
var _result, typeList, index, length, type, style;
|
|
3050
|
-
typeList = explicit ? state.explicitTypes : state.implicitTypes;
|
|
3051
|
-
for (index = 0, length = typeList.length; index < length; index += 1) {
|
|
3052
|
-
type = typeList[index];
|
|
3053
|
-
if ((type.instanceOf || type.predicate) && (!type.instanceOf || typeof object === "object" && object instanceof type.instanceOf) && (!type.predicate || type.predicate(object))) {
|
|
3054
|
-
state.tag = explicit ? type.tag : "?";
|
|
3055
|
-
if (type.represent) {
|
|
3056
|
-
style = state.styleMap[type.tag] || type.defaultStyle;
|
|
3057
|
-
if (_toString.call(type.represent) === "[object Function]") {
|
|
3058
|
-
_result = type.represent(object, style);
|
|
3059
|
-
} else if (_hasOwnProperty.call(type.represent, style)) {
|
|
3060
|
-
_result = type.represent[style](object, style);
|
|
3061
|
-
} else {
|
|
3062
|
-
throw new YAMLException("!<" + type.tag + '> tag resolver accepts not "' + style + '" style');
|
|
3063
|
-
}
|
|
3064
|
-
state.dump = _result;
|
|
3065
|
-
}
|
|
3066
|
-
return true;
|
|
3067
|
-
}
|
|
3068
|
-
}
|
|
3069
|
-
return false;
|
|
3070
|
-
}
|
|
3071
|
-
function writeNode(state, level, object, block, compact, iskey) {
|
|
3072
|
-
state.tag = null;
|
|
3073
|
-
state.dump = object;
|
|
3074
|
-
if (!detectType(state, object, false)) {
|
|
3075
|
-
detectType(state, object, true);
|
|
3076
|
-
}
|
|
3077
|
-
var type = _toString.call(state.dump);
|
|
3078
|
-
if (block) {
|
|
3079
|
-
block = state.flowLevel < 0 || state.flowLevel > level;
|
|
3080
|
-
}
|
|
3081
|
-
var objectOrArray = type === "[object Object]" || type === "[object Array]", duplicateIndex, duplicate;
|
|
3082
|
-
if (objectOrArray) {
|
|
3083
|
-
duplicateIndex = state.duplicates.indexOf(object);
|
|
3084
|
-
duplicate = duplicateIndex !== -1;
|
|
3085
|
-
}
|
|
3086
|
-
if (state.tag !== null && state.tag !== "?" || duplicate || state.indent !== 2 && level > 0) {
|
|
3087
|
-
compact = false;
|
|
3088
|
-
}
|
|
3089
|
-
if (duplicate && state.usedDuplicates[duplicateIndex]) {
|
|
3090
|
-
state.dump = "*ref_" + duplicateIndex;
|
|
3091
|
-
} else {
|
|
3092
|
-
if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
|
|
3093
|
-
state.usedDuplicates[duplicateIndex] = true;
|
|
3094
|
-
}
|
|
3095
|
-
if (type === "[object Object]") {
|
|
3096
|
-
if (block && Object.keys(state.dump).length !== 0) {
|
|
3097
|
-
writeBlockMapping(state, level, state.dump, compact);
|
|
3098
|
-
if (duplicate) {
|
|
3099
|
-
state.dump = "&ref_" + duplicateIndex + state.dump;
|
|
3100
|
-
}
|
|
3101
|
-
} else {
|
|
3102
|
-
writeFlowMapping(state, level, state.dump);
|
|
3103
|
-
if (duplicate) {
|
|
3104
|
-
state.dump = "&ref_" + duplicateIndex + " " + state.dump;
|
|
3105
|
-
}
|
|
3106
|
-
}
|
|
3107
|
-
} else if (type === "[object Array]") {
|
|
3108
|
-
var arrayLevel = state.noArrayIndent && level > 0 ? level - 1 : level;
|
|
3109
|
-
if (block && state.dump.length !== 0) {
|
|
3110
|
-
writeBlockSequence(state, arrayLevel, state.dump, compact);
|
|
3111
|
-
if (duplicate) {
|
|
3112
|
-
state.dump = "&ref_" + duplicateIndex + state.dump;
|
|
3113
|
-
}
|
|
3114
|
-
} else {
|
|
3115
|
-
writeFlowSequence(state, arrayLevel, state.dump);
|
|
3116
|
-
if (duplicate) {
|
|
3117
|
-
state.dump = "&ref_" + duplicateIndex + " " + state.dump;
|
|
3118
|
-
}
|
|
3119
|
-
}
|
|
3120
|
-
} else if (type === "[object String]") {
|
|
3121
|
-
if (state.tag !== "?") {
|
|
3122
|
-
writeScalar(state, state.dump, level, iskey);
|
|
3123
|
-
}
|
|
3124
|
-
} else {
|
|
3125
|
-
if (state.skipInvalid)
|
|
3126
|
-
return false;
|
|
3127
|
-
throw new YAMLException("unacceptable kind of an object to dump " + type);
|
|
3128
|
-
}
|
|
3129
|
-
if (state.tag !== null && state.tag !== "?") {
|
|
3130
|
-
state.dump = "!<" + state.tag + "> " + state.dump;
|
|
3131
|
-
}
|
|
3132
|
-
}
|
|
3133
|
-
return true;
|
|
3134
|
-
}
|
|
3135
|
-
function getDuplicateReferences(object, state) {
|
|
3136
|
-
var objects = [], duplicatesIndexes = [], index, length;
|
|
3137
|
-
inspectNode(object, objects, duplicatesIndexes);
|
|
3138
|
-
for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {
|
|
3139
|
-
state.duplicates.push(objects[duplicatesIndexes[index]]);
|
|
3140
|
-
}
|
|
3141
|
-
state.usedDuplicates = new Array(length);
|
|
3142
|
-
}
|
|
3143
|
-
function inspectNode(object, objects, duplicatesIndexes) {
|
|
3144
|
-
var objectKeyList, index, length;
|
|
3145
|
-
if (object !== null && typeof object === "object") {
|
|
3146
|
-
index = objects.indexOf(object);
|
|
3147
|
-
if (index !== -1) {
|
|
3148
|
-
if (duplicatesIndexes.indexOf(index) === -1) {
|
|
3149
|
-
duplicatesIndexes.push(index);
|
|
3150
|
-
}
|
|
3151
|
-
} else {
|
|
3152
|
-
objects.push(object);
|
|
3153
|
-
if (Array.isArray(object)) {
|
|
3154
|
-
for (index = 0, length = object.length; index < length; index += 1) {
|
|
3155
|
-
inspectNode(object[index], objects, duplicatesIndexes);
|
|
3156
|
-
}
|
|
3157
|
-
} else {
|
|
3158
|
-
objectKeyList = Object.keys(object);
|
|
3159
|
-
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
|
3160
|
-
inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);
|
|
3161
|
-
}
|
|
3162
|
-
}
|
|
3163
|
-
}
|
|
3164
|
-
}
|
|
3165
|
-
}
|
|
3166
|
-
function dump(input, options2) {
|
|
3167
|
-
options2 = options2 || {};
|
|
3168
|
-
var state = new State(options2);
|
|
3169
|
-
if (!state.noRefs)
|
|
3170
|
-
getDuplicateReferences(input, state);
|
|
3171
|
-
if (writeNode(state, 0, input, true, true))
|
|
3172
|
-
return state.dump + "\n";
|
|
3173
|
-
return "";
|
|
3174
|
-
}
|
|
3175
|
-
function safeDump(input, options2) {
|
|
3176
|
-
return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options2));
|
|
3177
|
-
}
|
|
3178
|
-
module2.exports.dump = dump;
|
|
3179
|
-
module2.exports.safeDump = safeDump;
|
|
3180
|
-
}
|
|
3181
|
-
});
|
|
3182
|
-
|
|
3183
|
-
// ../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml.js
|
|
3184
|
-
var require_js_yaml = __commonJS({
|
|
3185
|
-
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml.js"(exports2, module2) {
|
|
3186
|
-
"use strict";
|
|
3187
|
-
var loader = require_loader();
|
|
3188
|
-
var dumper = require_dumper();
|
|
3189
|
-
function deprecated(name) {
|
|
3190
|
-
return function() {
|
|
3191
|
-
throw new Error("Function " + name + " is deprecated and cannot be used.");
|
|
3192
|
-
};
|
|
3193
|
-
}
|
|
3194
|
-
module2.exports.Type = require_type();
|
|
3195
|
-
module2.exports.Schema = require_schema();
|
|
3196
|
-
module2.exports.FAILSAFE_SCHEMA = require_failsafe();
|
|
3197
|
-
module2.exports.JSON_SCHEMA = require_json();
|
|
3198
|
-
module2.exports.CORE_SCHEMA = require_core();
|
|
3199
|
-
module2.exports.DEFAULT_SAFE_SCHEMA = require_default_safe();
|
|
3200
|
-
module2.exports.DEFAULT_FULL_SCHEMA = require_default_full();
|
|
3201
|
-
module2.exports.load = loader.load;
|
|
3202
|
-
module2.exports.loadAll = loader.loadAll;
|
|
3203
|
-
module2.exports.safeLoad = loader.safeLoad;
|
|
3204
|
-
module2.exports.safeLoadAll = loader.safeLoadAll;
|
|
3205
|
-
module2.exports.dump = dumper.dump;
|
|
3206
|
-
module2.exports.safeDump = dumper.safeDump;
|
|
3207
|
-
module2.exports.YAMLException = require_exception();
|
|
3208
|
-
module2.exports.MINIMAL_SCHEMA = require_failsafe();
|
|
3209
|
-
module2.exports.SAFE_SCHEMA = require_default_safe();
|
|
3210
|
-
module2.exports.DEFAULT_SCHEMA = require_default_full();
|
|
3211
|
-
module2.exports.scan = deprecated("scan");
|
|
3212
|
-
module2.exports.parse = deprecated("parse");
|
|
3213
|
-
module2.exports.compose = deprecated("compose");
|
|
3214
|
-
module2.exports.addConstructor = deprecated("addConstructor");
|
|
3215
|
-
}
|
|
3216
|
-
});
|
|
3217
|
-
|
|
3218
|
-
// ../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/index.js
|
|
3219
|
-
var require_js_yaml2 = __commonJS({
|
|
3220
|
-
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/index.js"(exports2, module2) {
|
|
3221
|
-
"use strict";
|
|
3222
|
-
var yaml2 = require_js_yaml();
|
|
3223
|
-
module2.exports = yaml2;
|
|
3224
|
-
}
|
|
3225
|
-
});
|
|
3226
|
-
|
|
3227
|
-
// ../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/engines.js
|
|
3228
|
-
var require_engines = __commonJS({
|
|
3229
|
-
"../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/engines.js"(exports, module) {
|
|
3230
|
-
"use strict";
|
|
3231
|
-
var yaml = require_js_yaml2();
|
|
3232
|
-
var engines = exports = module.exports;
|
|
3233
|
-
engines.yaml = {
|
|
3234
|
-
parse: yaml.safeLoad.bind(yaml),
|
|
3235
|
-
stringify: yaml.safeDump.bind(yaml)
|
|
3236
|
-
};
|
|
3237
|
-
engines.json = {
|
|
3238
|
-
parse: JSON.parse.bind(JSON),
|
|
3239
|
-
stringify: function(obj, options2) {
|
|
3240
|
-
const opts = Object.assign({ replacer: null, space: 2 }, options2);
|
|
3241
|
-
return JSON.stringify(obj, opts.replacer, opts.space);
|
|
3242
|
-
}
|
|
3243
|
-
};
|
|
3244
|
-
engines.javascript = {
|
|
3245
|
-
parse: function parse(str, options, wrap) {
|
|
3246
|
-
try {
|
|
3247
|
-
if (wrap !== false) {
|
|
3248
|
-
str = "(function() {\nreturn " + str.trim() + ";\n}());";
|
|
3249
|
-
}
|
|
3250
|
-
return eval(str) || {};
|
|
3251
|
-
} catch (err) {
|
|
3252
|
-
if (wrap !== false && /(unexpected|identifier)/i.test(err.message)) {
|
|
3253
|
-
return parse(str, options, false);
|
|
3254
|
-
}
|
|
3255
|
-
throw new SyntaxError(err);
|
|
3256
|
-
}
|
|
3257
|
-
},
|
|
3258
|
-
stringify: function() {
|
|
3259
|
-
throw new Error("stringifying JavaScript is not supported");
|
|
3260
|
-
}
|
|
3261
|
-
};
|
|
3262
|
-
}
|
|
3263
|
-
});
|
|
3264
|
-
|
|
3265
|
-
// ../../node_modules/.pnpm/strip-bom-string@1.0.0/node_modules/strip-bom-string/index.js
|
|
3266
|
-
var require_strip_bom_string = __commonJS({
|
|
3267
|
-
"../../node_modules/.pnpm/strip-bom-string@1.0.0/node_modules/strip-bom-string/index.js"(exports2, module2) {
|
|
3268
|
-
"use strict";
|
|
3269
|
-
module2.exports = function(str2) {
|
|
3270
|
-
if (typeof str2 === "string" && str2.charAt(0) === "\uFEFF") {
|
|
3271
|
-
return str2.slice(1);
|
|
3272
|
-
}
|
|
3273
|
-
return str2;
|
|
3274
|
-
};
|
|
3275
|
-
}
|
|
3276
|
-
});
|
|
3277
|
-
|
|
3278
|
-
// ../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/utils.js
|
|
3279
|
-
var require_utils = __commonJS({
|
|
3280
|
-
"../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/utils.js"(exports2) {
|
|
3281
|
-
"use strict";
|
|
3282
|
-
var stripBom = require_strip_bom_string();
|
|
3283
|
-
var typeOf = require_kind_of();
|
|
3284
|
-
exports2.define = function(obj, key, val) {
|
|
3285
|
-
Reflect.defineProperty(obj, key, {
|
|
3286
|
-
enumerable: false,
|
|
3287
|
-
configurable: true,
|
|
3288
|
-
writable: true,
|
|
3289
|
-
value: val
|
|
3290
|
-
});
|
|
3291
|
-
};
|
|
3292
|
-
exports2.isBuffer = function(val) {
|
|
3293
|
-
return typeOf(val) === "buffer";
|
|
3294
|
-
};
|
|
3295
|
-
exports2.isObject = function(val) {
|
|
3296
|
-
return typeOf(val) === "object";
|
|
3297
|
-
};
|
|
3298
|
-
exports2.toBuffer = function(input) {
|
|
3299
|
-
return typeof input === "string" ? Buffer.from(input) : input;
|
|
3300
|
-
};
|
|
3301
|
-
exports2.toString = function(input) {
|
|
3302
|
-
if (exports2.isBuffer(input))
|
|
3303
|
-
return stripBom(String(input));
|
|
3304
|
-
if (typeof input !== "string") {
|
|
3305
|
-
throw new TypeError("expected input to be a string or buffer");
|
|
3306
|
-
}
|
|
3307
|
-
return stripBom(input);
|
|
3308
|
-
};
|
|
3309
|
-
exports2.arrayify = function(val) {
|
|
3310
|
-
return val ? Array.isArray(val) ? val : [val] : [];
|
|
3311
|
-
};
|
|
3312
|
-
exports2.startsWith = function(str2, substr, len) {
|
|
3313
|
-
if (typeof len !== "number")
|
|
3314
|
-
len = substr.length;
|
|
3315
|
-
return str2.slice(0, len) === substr;
|
|
3316
|
-
};
|
|
3317
|
-
}
|
|
3318
|
-
});
|
|
3319
|
-
|
|
3320
|
-
// ../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/defaults.js
|
|
3321
|
-
var require_defaults = __commonJS({
|
|
3322
|
-
"../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/defaults.js"(exports2, module2) {
|
|
3323
|
-
"use strict";
|
|
3324
|
-
var engines2 = require_engines();
|
|
3325
|
-
var utils = require_utils();
|
|
3326
|
-
module2.exports = function(options2) {
|
|
3327
|
-
const opts = Object.assign({}, options2);
|
|
3328
|
-
opts.delimiters = utils.arrayify(opts.delims || opts.delimiters || "---");
|
|
3329
|
-
if (opts.delimiters.length === 1) {
|
|
3330
|
-
opts.delimiters.push(opts.delimiters[0]);
|
|
3331
|
-
}
|
|
3332
|
-
opts.language = (opts.language || opts.lang || "yaml").toLowerCase();
|
|
3333
|
-
opts.engines = Object.assign({}, engines2, opts.parsers, opts.engines);
|
|
3334
|
-
return opts;
|
|
3335
|
-
};
|
|
3336
|
-
}
|
|
3337
|
-
});
|
|
3338
|
-
|
|
3339
|
-
// ../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/engine.js
|
|
3340
|
-
var require_engine = __commonJS({
|
|
3341
|
-
"../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/engine.js"(exports2, module2) {
|
|
3342
|
-
"use strict";
|
|
3343
|
-
module2.exports = function(name, options2) {
|
|
3344
|
-
let engine = options2.engines[name] || options2.engines[aliase(name)];
|
|
3345
|
-
if (typeof engine === "undefined") {
|
|
3346
|
-
throw new Error('gray-matter engine "' + name + '" is not registered');
|
|
3347
|
-
}
|
|
3348
|
-
if (typeof engine === "function") {
|
|
3349
|
-
engine = { parse: engine };
|
|
3350
|
-
}
|
|
3351
|
-
return engine;
|
|
3352
|
-
};
|
|
3353
|
-
function aliase(name) {
|
|
3354
|
-
switch (name.toLowerCase()) {
|
|
3355
|
-
case "js":
|
|
3356
|
-
case "javascript":
|
|
3357
|
-
return "javascript";
|
|
3358
|
-
case "coffee":
|
|
3359
|
-
case "coffeescript":
|
|
3360
|
-
case "cson":
|
|
3361
|
-
return "coffee";
|
|
3362
|
-
case "yaml":
|
|
3363
|
-
case "yml":
|
|
3364
|
-
return "yaml";
|
|
3365
|
-
default: {
|
|
3366
|
-
return name;
|
|
3367
|
-
}
|
|
3368
|
-
}
|
|
3369
|
-
}
|
|
3370
|
-
}
|
|
3371
|
-
});
|
|
3372
|
-
|
|
3373
|
-
// ../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/stringify.js
|
|
3374
|
-
var require_stringify = __commonJS({
|
|
3375
|
-
"../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/stringify.js"(exports2, module2) {
|
|
3376
|
-
"use strict";
|
|
3377
|
-
var typeOf = require_kind_of();
|
|
3378
|
-
var getEngine = require_engine();
|
|
3379
|
-
var defaults = require_defaults();
|
|
3380
|
-
module2.exports = function(file, data, options2) {
|
|
3381
|
-
if (data == null && options2 == null) {
|
|
3382
|
-
switch (typeOf(file)) {
|
|
3383
|
-
case "object":
|
|
3384
|
-
data = file.data;
|
|
3385
|
-
options2 = {};
|
|
3386
|
-
break;
|
|
3387
|
-
case "string":
|
|
3388
|
-
return file;
|
|
3389
|
-
default: {
|
|
3390
|
-
throw new TypeError("expected file to be a string or object");
|
|
3391
|
-
}
|
|
3392
|
-
}
|
|
3393
|
-
}
|
|
3394
|
-
const str2 = file.content;
|
|
3395
|
-
const opts = defaults(options2);
|
|
3396
|
-
if (data == null) {
|
|
3397
|
-
if (!opts.data)
|
|
3398
|
-
return file;
|
|
3399
|
-
data = opts.data;
|
|
3400
|
-
}
|
|
3401
|
-
const language = file.language || opts.language;
|
|
3402
|
-
const engine = getEngine(language, opts);
|
|
3403
|
-
if (typeof engine.stringify !== "function") {
|
|
3404
|
-
throw new TypeError('expected "' + language + '.stringify" to be a function');
|
|
3405
|
-
}
|
|
3406
|
-
data = Object.assign({}, file.data, data);
|
|
3407
|
-
const open = opts.delimiters[0];
|
|
3408
|
-
const close = opts.delimiters[1];
|
|
3409
|
-
const matter = engine.stringify(data, options2).trim();
|
|
3410
|
-
let buf = "";
|
|
3411
|
-
if (matter !== "{}") {
|
|
3412
|
-
buf = newline(open) + newline(matter) + newline(close);
|
|
3413
|
-
}
|
|
3414
|
-
if (typeof file.excerpt === "string" && file.excerpt !== "") {
|
|
3415
|
-
if (str2.indexOf(file.excerpt.trim()) === -1) {
|
|
3416
|
-
buf += newline(file.excerpt) + newline(close);
|
|
3417
|
-
}
|
|
3418
|
-
}
|
|
3419
|
-
return buf + newline(str2);
|
|
3420
|
-
};
|
|
3421
|
-
function newline(str2) {
|
|
3422
|
-
return str2.slice(-1) !== "\n" ? str2 + "\n" : str2;
|
|
3423
|
-
}
|
|
3424
|
-
}
|
|
3425
|
-
});
|
|
3426
|
-
|
|
3427
|
-
// ../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/excerpt.js
|
|
3428
|
-
var require_excerpt = __commonJS({
|
|
3429
|
-
"../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/excerpt.js"(exports2, module2) {
|
|
3430
|
-
"use strict";
|
|
3431
|
-
var defaults = require_defaults();
|
|
3432
|
-
module2.exports = function(file, options2) {
|
|
3433
|
-
const opts = defaults(options2);
|
|
3434
|
-
if (file.data == null) {
|
|
3435
|
-
file.data = {};
|
|
3436
|
-
}
|
|
3437
|
-
if (typeof opts.excerpt === "function") {
|
|
3438
|
-
return opts.excerpt(file, opts);
|
|
3439
|
-
}
|
|
3440
|
-
const sep = file.data.excerpt_separator || opts.excerpt_separator;
|
|
3441
|
-
if (sep == null && (opts.excerpt === false || opts.excerpt == null)) {
|
|
3442
|
-
return file;
|
|
3443
|
-
}
|
|
3444
|
-
const delimiter = typeof opts.excerpt === "string" ? opts.excerpt : sep || opts.delimiters[0];
|
|
3445
|
-
const idx = file.content.indexOf(delimiter);
|
|
3446
|
-
if (idx !== -1) {
|
|
3447
|
-
file.excerpt = file.content.slice(0, idx);
|
|
3448
|
-
}
|
|
3449
|
-
return file;
|
|
3450
|
-
};
|
|
3451
|
-
}
|
|
3452
|
-
});
|
|
3453
|
-
|
|
3454
|
-
// ../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/to-file.js
|
|
3455
|
-
var require_to_file = __commonJS({
|
|
3456
|
-
"../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/to-file.js"(exports2, module2) {
|
|
3457
|
-
"use strict";
|
|
3458
|
-
var typeOf = require_kind_of();
|
|
3459
|
-
var stringify = require_stringify();
|
|
3460
|
-
var utils = require_utils();
|
|
3461
|
-
module2.exports = function(file) {
|
|
3462
|
-
if (typeOf(file) !== "object") {
|
|
3463
|
-
file = { content: file };
|
|
3464
|
-
}
|
|
3465
|
-
if (typeOf(file.data) !== "object") {
|
|
3466
|
-
file.data = {};
|
|
3467
|
-
}
|
|
3468
|
-
if (file.contents && file.content == null) {
|
|
3469
|
-
file.content = file.contents;
|
|
3470
|
-
}
|
|
3471
|
-
utils.define(file, "orig", utils.toBuffer(file.content));
|
|
3472
|
-
utils.define(file, "language", file.language || "");
|
|
3473
|
-
utils.define(file, "matter", file.matter || "");
|
|
3474
|
-
utils.define(file, "stringify", function(data, options2) {
|
|
3475
|
-
if (options2 && options2.language) {
|
|
3476
|
-
file.language = options2.language;
|
|
3477
|
-
}
|
|
3478
|
-
return stringify(file, data, options2);
|
|
3479
|
-
});
|
|
3480
|
-
file.content = utils.toString(file.content);
|
|
3481
|
-
file.isEmpty = false;
|
|
3482
|
-
file.excerpt = "";
|
|
3483
|
-
return file;
|
|
3484
|
-
};
|
|
3485
|
-
}
|
|
3486
|
-
});
|
|
3487
|
-
|
|
3488
|
-
// ../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/parse.js
|
|
3489
|
-
var require_parse = __commonJS({
|
|
3490
|
-
"../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/parse.js"(exports2, module2) {
|
|
3491
|
-
"use strict";
|
|
3492
|
-
var getEngine = require_engine();
|
|
3493
|
-
var defaults = require_defaults();
|
|
3494
|
-
module2.exports = function(language, str2, options2) {
|
|
3495
|
-
const opts = defaults(options2);
|
|
3496
|
-
const engine = getEngine(language, opts);
|
|
3497
|
-
if (typeof engine.parse !== "function") {
|
|
3498
|
-
throw new TypeError('expected "' + language + '.parse" to be a function');
|
|
3499
|
-
}
|
|
3500
|
-
return engine.parse(str2, opts);
|
|
3501
|
-
};
|
|
3502
|
-
}
|
|
3503
|
-
});
|
|
3504
|
-
|
|
3505
|
-
// ../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/index.js
|
|
3506
|
-
var require_gray_matter = __commonJS({
|
|
3507
|
-
"../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/index.js"(exports2, module2) {
|
|
3508
|
-
"use strict";
|
|
3509
|
-
var fs11 = __require("fs");
|
|
3510
|
-
var sections = require_section_matter();
|
|
3511
|
-
var defaults = require_defaults();
|
|
3512
|
-
var stringify = require_stringify();
|
|
3513
|
-
var excerpt = require_excerpt();
|
|
3514
|
-
var engines2 = require_engines();
|
|
3515
|
-
var toFile = require_to_file();
|
|
3516
|
-
var parse2 = require_parse();
|
|
3517
|
-
var utils = require_utils();
|
|
3518
|
-
function matter(input, options2) {
|
|
3519
|
-
if (input === "") {
|
|
3520
|
-
return { data: {}, content: input, excerpt: "", orig: input };
|
|
3521
|
-
}
|
|
3522
|
-
let file = toFile(input);
|
|
3523
|
-
const cached = matter.cache[file.content];
|
|
3524
|
-
if (!options2) {
|
|
3525
|
-
if (cached) {
|
|
3526
|
-
file = Object.assign({}, cached);
|
|
3527
|
-
file.orig = cached.orig;
|
|
3528
|
-
return file;
|
|
3529
|
-
}
|
|
3530
|
-
matter.cache[file.content] = file;
|
|
3531
|
-
}
|
|
3532
|
-
return parseMatter(file, options2);
|
|
3533
|
-
}
|
|
3534
|
-
function parseMatter(file, options2) {
|
|
3535
|
-
const opts = defaults(options2);
|
|
3536
|
-
const open = opts.delimiters[0];
|
|
3537
|
-
const close = "\n" + opts.delimiters[1];
|
|
3538
|
-
let str2 = file.content;
|
|
3539
|
-
if (opts.language) {
|
|
3540
|
-
file.language = opts.language;
|
|
3541
|
-
}
|
|
3542
|
-
const openLen = open.length;
|
|
3543
|
-
if (!utils.startsWith(str2, open, openLen)) {
|
|
3544
|
-
excerpt(file, opts);
|
|
3545
|
-
return file;
|
|
3546
|
-
}
|
|
3547
|
-
if (str2.charAt(openLen) === open.slice(-1)) {
|
|
3548
|
-
return file;
|
|
3549
|
-
}
|
|
3550
|
-
str2 = str2.slice(openLen);
|
|
3551
|
-
const len = str2.length;
|
|
3552
|
-
const language = matter.language(str2, opts);
|
|
3553
|
-
if (language.name) {
|
|
3554
|
-
file.language = language.name;
|
|
3555
|
-
str2 = str2.slice(language.raw.length);
|
|
3556
|
-
}
|
|
3557
|
-
let closeIndex = str2.indexOf(close);
|
|
3558
|
-
if (closeIndex === -1) {
|
|
3559
|
-
closeIndex = len;
|
|
3560
|
-
}
|
|
3561
|
-
file.matter = str2.slice(0, closeIndex);
|
|
3562
|
-
const block = file.matter.replace(/^\s*#[^\n]+/gm, "").trim();
|
|
3563
|
-
if (block === "") {
|
|
3564
|
-
file.isEmpty = true;
|
|
3565
|
-
file.empty = file.content;
|
|
3566
|
-
file.data = {};
|
|
3567
|
-
} else {
|
|
3568
|
-
file.data = parse2(file.language, file.matter, opts);
|
|
3569
|
-
}
|
|
3570
|
-
if (closeIndex === len) {
|
|
3571
|
-
file.content = "";
|
|
3572
|
-
} else {
|
|
3573
|
-
file.content = str2.slice(closeIndex + close.length);
|
|
3574
|
-
if (file.content[0] === "\r") {
|
|
3575
|
-
file.content = file.content.slice(1);
|
|
3576
|
-
}
|
|
3577
|
-
if (file.content[0] === "\n") {
|
|
3578
|
-
file.content = file.content.slice(1);
|
|
3579
|
-
}
|
|
3580
|
-
}
|
|
3581
|
-
excerpt(file, opts);
|
|
3582
|
-
if (opts.sections === true || typeof opts.section === "function") {
|
|
3583
|
-
sections(file, opts.section);
|
|
3584
|
-
}
|
|
3585
|
-
return file;
|
|
3586
|
-
}
|
|
3587
|
-
matter.engines = engines2;
|
|
3588
|
-
matter.stringify = function(file, data, options2) {
|
|
3589
|
-
if (typeof file === "string")
|
|
3590
|
-
file = matter(file, options2);
|
|
3591
|
-
return stringify(file, data, options2);
|
|
3592
|
-
};
|
|
3593
|
-
matter.read = function(filepath, options2) {
|
|
3594
|
-
const str2 = fs11.readFileSync(filepath, "utf8");
|
|
3595
|
-
const file = matter(str2, options2);
|
|
3596
|
-
file.path = filepath;
|
|
3597
|
-
return file;
|
|
3598
|
-
};
|
|
3599
|
-
matter.test = function(str2, options2) {
|
|
3600
|
-
return utils.startsWith(str2, defaults(options2).delimiters[0]);
|
|
3601
|
-
};
|
|
3602
|
-
matter.language = function(str2, options2) {
|
|
3603
|
-
const opts = defaults(options2);
|
|
3604
|
-
const open = opts.delimiters[0];
|
|
3605
|
-
if (matter.test(str2)) {
|
|
3606
|
-
str2 = str2.slice(open.length);
|
|
3607
|
-
}
|
|
3608
|
-
const language = str2.slice(0, str2.search(/\r?\n/));
|
|
3609
|
-
return {
|
|
3610
|
-
raw: language,
|
|
3611
|
-
name: language ? language.trim() : ""
|
|
3612
|
-
};
|
|
3613
|
-
};
|
|
3614
|
-
matter.cache = {};
|
|
3615
|
-
matter.clearCache = function() {
|
|
3616
|
-
matter.cache = {};
|
|
3617
|
-
};
|
|
3618
|
-
module2.exports = matter;
|
|
3619
|
-
}
|
|
3620
|
-
});
|
|
13
|
+
var __publicField = (obj, key, value) => {
|
|
14
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
15
|
+
return value;
|
|
16
|
+
};
|
|
17
|
+
var __accessCheck = (obj, member, msg) => {
|
|
18
|
+
if (!member.has(obj))
|
|
19
|
+
throw TypeError("Cannot " + msg);
|
|
20
|
+
};
|
|
21
|
+
var __privateGet = (obj, member, getter) => {
|
|
22
|
+
__accessCheck(obj, member, "read from private field");
|
|
23
|
+
return getter ? getter.call(obj) : member.get(obj);
|
|
24
|
+
};
|
|
25
|
+
var __privateAdd = (obj, member, value) => {
|
|
26
|
+
if (member.has(obj))
|
|
27
|
+
throw TypeError("Cannot add the same private member more than once");
|
|
28
|
+
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
29
|
+
};
|
|
30
|
+
var __privateSet = (obj, member, value, setter) => {
|
|
31
|
+
__accessCheck(obj, member, "write to private field");
|
|
32
|
+
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
33
|
+
return value;
|
|
34
|
+
};
|
|
35
|
+
var __privateMethod = (obj, member, method) => {
|
|
36
|
+
__accessCheck(obj, member, "access private method");
|
|
37
|
+
return method;
|
|
38
|
+
};
|
|
3621
39
|
|
|
3622
40
|
// src/node/dev.ts
|
|
3623
41
|
import { removeLeadingSlash as removeLeadingSlash2 } from "@rspress/shared";
|
|
3624
|
-
import { logger as
|
|
42
|
+
import { logger as logger3 } from "@rspress/shared/logger";
|
|
3625
43
|
|
|
3626
44
|
// src/node/initRsbuild.ts
|
|
3627
45
|
import path10 from "path";
|
|
3628
|
-
import
|
|
46
|
+
import fs8 from "@rspress/shared/fs-extra";
|
|
3629
47
|
import {
|
|
3630
48
|
MDX_REGEXP as MDX_REGEXP3,
|
|
3631
49
|
RSPRESS_TEMP_DIR as RSPRESS_TEMP_DIR2,
|
|
@@ -3749,7 +167,7 @@ async function routeVMPlugin(context) {
|
|
|
3749
167
|
}
|
|
3750
168
|
|
|
3751
169
|
// src/node/runtimeModule/siteData/index.ts
|
|
3752
|
-
import
|
|
170
|
+
import path6 from "path";
|
|
3753
171
|
import { SEARCH_INDEX_NAME } from "@rspress/shared";
|
|
3754
172
|
import fs4 from "@rspress/shared/fs-extra";
|
|
3755
173
|
|
|
@@ -3937,13 +355,14 @@ function normalizeThemeConfig(docConfig, pages = []) {
|
|
|
3937
355
|
}
|
|
3938
356
|
|
|
3939
357
|
// src/node/runtimeModule/siteData/extractPageData.ts
|
|
3940
|
-
import
|
|
358
|
+
import path5 from "path";
|
|
3941
359
|
import {
|
|
3942
360
|
MDX_REGEXP as MDX_REGEXP2
|
|
3943
361
|
} from "@rspress/shared";
|
|
3944
362
|
import { htmlToText } from "html-to-text";
|
|
3945
363
|
import fs3 from "@rspress/shared/fs-extra";
|
|
3946
364
|
import { compile } from "@rspress/mdx-rs";
|
|
365
|
+
import { loadFrontMatter } from "@rspress/shared/node-utils";
|
|
3947
366
|
|
|
3948
367
|
// src/node/utils/normalizePath.ts
|
|
3949
368
|
import os from "os";
|
|
@@ -3965,8 +384,8 @@ function getPageKey(route) {
|
|
|
3965
384
|
|
|
3966
385
|
// src/node/utils/createHash.ts
|
|
3967
386
|
import { createHash as createHashFunc } from "crypto";
|
|
3968
|
-
function createHash(
|
|
3969
|
-
return createHashFunc("sha256").update(
|
|
387
|
+
function createHash(str) {
|
|
388
|
+
return createHashFunc("sha256").update(str).digest("hex").slice(0, 8);
|
|
3970
389
|
}
|
|
3971
390
|
|
|
3972
391
|
// src/node/utils/detectReactVersion.ts
|
|
@@ -4120,28 +539,6 @@ async function flattenMdxContent(content, basePath, alias) {
|
|
|
4120
539
|
return result;
|
|
4121
540
|
}
|
|
4122
541
|
|
|
4123
|
-
// src/node/utils/loadFrontMatter.ts
|
|
4124
|
-
var import_gray_matter = __toESM(require_gray_matter());
|
|
4125
|
-
import path5 from "path";
|
|
4126
|
-
import { logger as logger2 } from "@rspress/shared/logger";
|
|
4127
|
-
function loadFrontMatter(source, filepath, root, outputWarning = false) {
|
|
4128
|
-
let frontmatter = {};
|
|
4129
|
-
let content = "";
|
|
4130
|
-
try {
|
|
4131
|
-
({ data: frontmatter, content } = (0, import_gray_matter.default)(source));
|
|
4132
|
-
} catch (e) {
|
|
4133
|
-
if (outputWarning) {
|
|
4134
|
-
logger2.warn(
|
|
4135
|
-
`Parse frontmatter error: ${e.message} in ${path5.relative(
|
|
4136
|
-
root,
|
|
4137
|
-
filepath
|
|
4138
|
-
)}`
|
|
4139
|
-
);
|
|
4140
|
-
}
|
|
4141
|
-
}
|
|
4142
|
-
return { frontmatter, content };
|
|
4143
|
-
}
|
|
4144
|
-
|
|
4145
542
|
// src/node/runtimeModule/siteData/extractPageData.ts
|
|
4146
543
|
async function extractPageData(replaceRules, alias, domain, root, routeService2) {
|
|
4147
544
|
return Promise.all(
|
|
@@ -4246,7 +643,7 @@ ${item.text}#
|
|
|
4246
643
|
},
|
|
4247
644
|
version: route.version,
|
|
4248
645
|
_filepath: route.absolutePath,
|
|
4249
|
-
_relativePath:
|
|
646
|
+
_relativePath: path5.relative(root, route.absolutePath)
|
|
4250
647
|
};
|
|
4251
648
|
})
|
|
4252
649
|
);
|
|
@@ -4298,7 +695,7 @@ async function siteDataVMPlugin(context) {
|
|
|
4298
695
|
indexHashByLang[lang] = indexHash;
|
|
4299
696
|
await fs4.ensureDir(TEMP_DIR);
|
|
4300
697
|
await fs4.writeFile(
|
|
4301
|
-
|
|
698
|
+
path6.join(TEMP_DIR, `${SEARCH_INDEX_NAME}.${lang}.${indexHash}.json`),
|
|
4302
699
|
stringfiedIndex
|
|
4303
700
|
);
|
|
4304
701
|
})
|
|
@@ -4398,15 +795,17 @@ async function globalStylesVMPlugin(context) {
|
|
|
4398
795
|
}
|
|
4399
796
|
|
|
4400
797
|
// src/node/runtimeModule/searchHooks.ts
|
|
4401
|
-
import
|
|
798
|
+
import path7 from "path";
|
|
4402
799
|
async function searchHookVMPlugin(context) {
|
|
4403
800
|
const { config } = context;
|
|
4404
|
-
let content = "export const onSearch = () => {}";
|
|
801
|
+
let content = "export const onSearch = () => {};";
|
|
802
|
+
let extname = "";
|
|
4405
803
|
if (typeof config.search === "object" && typeof config.search.searchHooks === "string") {
|
|
4406
|
-
content =
|
|
804
|
+
content = `export * from '${config.search.searchHooks}'`;
|
|
805
|
+
extname = path7.extname(config.search.searchHooks);
|
|
4407
806
|
}
|
|
4408
807
|
return {
|
|
4409
|
-
["virtual-search-hooks" /* SearchHooks */]: content
|
|
808
|
+
[`${"virtual-search-hooks" /* SearchHooks */}${extname}`]: content
|
|
4410
809
|
};
|
|
4411
810
|
}
|
|
4412
811
|
|
|
@@ -4507,17 +906,17 @@ function rsbuildPluginDocVM(factoryContext) {
|
|
|
4507
906
|
|
|
4508
907
|
// src/node/searchIndex.ts
|
|
4509
908
|
import path8, { join as join2 } from "path";
|
|
4510
|
-
import
|
|
909
|
+
import fs6 from "@rspress/shared/fs-extra";
|
|
4511
910
|
import chalk from "@rspress/shared/chalk";
|
|
4512
911
|
import fetch from "node-fetch";
|
|
4513
912
|
import { isSCM, SEARCH_INDEX_NAME as SEARCH_INDEX_NAME2 } from "@rspress/shared";
|
|
4514
|
-
import { logger as
|
|
913
|
+
import { logger as logger2 } from "@rspress/shared/logger";
|
|
4515
914
|
async function writeSearchIndex(config) {
|
|
4516
915
|
if (config?.search === false) {
|
|
4517
916
|
return;
|
|
4518
917
|
}
|
|
4519
918
|
const cwd = process.cwd();
|
|
4520
|
-
const searchIndexFiles = await
|
|
919
|
+
const searchIndexFiles = await fs6.readdir(TEMP_DIR);
|
|
4521
920
|
const outDir = config?.outDir ?? join2(cwd, OUTPUT_DIR);
|
|
4522
921
|
let searchIndexData = "[]";
|
|
4523
922
|
let scaning = false;
|
|
@@ -4527,12 +926,12 @@ async function writeSearchIndex(config) {
|
|
|
4527
926
|
}
|
|
4528
927
|
const source = join2(TEMP_DIR, searchIndexFile);
|
|
4529
928
|
const target = join2(outDir, "static", searchIndexFile);
|
|
4530
|
-
const searchIndex = await
|
|
929
|
+
const searchIndex = await fs6.readFile(
|
|
4531
930
|
join2(TEMP_DIR, searchIndexFile),
|
|
4532
931
|
"utf-8"
|
|
4533
932
|
);
|
|
4534
933
|
searchIndexData = `${searchIndexData.slice(0, -1)}${scaning ? "," : ""}${searchIndex.slice(1)}`;
|
|
4535
|
-
await
|
|
934
|
+
await fs6.move(source, target, { overwrite: true });
|
|
4536
935
|
scaning = true;
|
|
4537
936
|
}
|
|
4538
937
|
if (isProduction() && isSCM() && config?.search?.mode === "remote") {
|
|
@@ -4543,13 +942,13 @@ async function writeSearchIndex(config) {
|
|
|
4543
942
|
body: searchIndexData,
|
|
4544
943
|
headers: { "Content-Type": "application/json" }
|
|
4545
944
|
});
|
|
4546
|
-
|
|
945
|
+
logger2.info(
|
|
4547
946
|
chalk.green(
|
|
4548
947
|
`[doc-tools] Search index uploaded to ${apiUrl}, indexName: ${indexName}`
|
|
4549
948
|
)
|
|
4550
949
|
);
|
|
4551
950
|
} catch (e) {
|
|
4552
|
-
|
|
951
|
+
logger2.info(
|
|
4553
952
|
chalk.red(
|
|
4554
953
|
`[doc-tools] Upload search index \`${indexName}\` failed:
|
|
4555
954
|
${e}`
|
|
@@ -4564,7 +963,7 @@ function serveSearchIndexMiddleware(config) {
|
|
|
4564
963
|
if (req.url?.includes(searchIndexRequestMatch)) {
|
|
4565
964
|
res.setHeader("Content-Type", "application/json");
|
|
4566
965
|
const searchIndexFile = req.url?.split("/").pop();
|
|
4567
|
-
const searchIndex =
|
|
966
|
+
const searchIndex = fs6.readFileSync(
|
|
4568
967
|
path8.join(
|
|
4569
968
|
process.cwd(),
|
|
4570
969
|
config?.outDir || OUTPUT_DIR,
|
|
@@ -4582,11 +981,11 @@ function serveSearchIndexMiddleware(config) {
|
|
|
4582
981
|
|
|
4583
982
|
// src/node/route/RouteService.ts
|
|
4584
983
|
import path9 from "path";
|
|
4585
|
-
import
|
|
984
|
+
import fs7 from "@rspress/shared/fs-extra";
|
|
4586
985
|
import { withBase as withBase2 } from "@rspress/shared";
|
|
4587
986
|
var DEFAULT_PAGE_EXTENSIONS = ["js", "jsx", "ts", "tsx", "md", "mdx"];
|
|
4588
|
-
var addLeadingSlash3 = (
|
|
4589
|
-
return
|
|
987
|
+
var addLeadingSlash3 = (str) => {
|
|
988
|
+
return str.startsWith("/") ? str : `/${str}`;
|
|
4590
989
|
};
|
|
4591
990
|
var normalizeRoutePath = (routePath, base, lang, version, langs, versions) => {
|
|
4592
991
|
const hasTrailSlash = routePath.endsWith("/");
|
|
@@ -4783,7 +1182,7 @@ _pluginDriver = new WeakMap();
|
|
|
4783
1182
|
_writeTempFile = new WeakSet();
|
|
4784
1183
|
writeTempFile_fn = async function(index, content) {
|
|
4785
1184
|
const tempFilePath = path9.join(__privateGet(this, _tempDir), `temp-${index}.mdx`);
|
|
4786
|
-
await
|
|
1185
|
+
await fs7.writeFile(tempFilePath, content);
|
|
4787
1186
|
return tempFilePath;
|
|
4788
1187
|
};
|
|
4789
1188
|
_generateRouteInfo = new WeakSet();
|
|
@@ -4816,8 +1215,8 @@ normalizeRoutePath_fn = function(routePath) {
|
|
|
4816
1215
|
|
|
4817
1216
|
// src/node/route/init.ts
|
|
4818
1217
|
var routeService = null;
|
|
4819
|
-
async function initRouteService(
|
|
4820
|
-
const { scanDir, config, runtimeTempDir, pluginDriver } =
|
|
1218
|
+
async function initRouteService(options) {
|
|
1219
|
+
const { scanDir, config, runtimeTempDir, pluginDriver } = options;
|
|
4821
1220
|
routeService = new RouteService(
|
|
4822
1221
|
scanDir,
|
|
4823
1222
|
config,
|
|
@@ -4831,15 +1230,15 @@ async function initRouteService(options2) {
|
|
|
4831
1230
|
// src/node/initRsbuild.ts
|
|
4832
1231
|
async function createInternalBuildConfig(userDocRoot, config, isSSR, routeService2, pluginDriver) {
|
|
4833
1232
|
const cwd = process.cwd();
|
|
4834
|
-
const { default:
|
|
1233
|
+
const { default: fs10 } = await import("@rspress/shared/fs-extra");
|
|
4835
1234
|
const CUSTOM_THEME_DIR = config?.themeDir ?? path10.join(process.cwd(), "theme");
|
|
4836
1235
|
const outDir = config?.outDir ?? OUTPUT_DIR;
|
|
4837
1236
|
const DEFAULT_THEME = __require.resolve("@rspress/theme-default");
|
|
4838
|
-
const themeDir = await
|
|
1237
|
+
const themeDir = await fs10.pathExists(CUSTOM_THEME_DIR) ? CUSTOM_THEME_DIR : DEFAULT_THEME;
|
|
4839
1238
|
const checkDeadLinks = (config?.markdown?.checkDeadLinks && !isSSR) ?? false;
|
|
4840
1239
|
const base = config?.base ?? "";
|
|
4841
1240
|
const publicDir = path10.join(userDocRoot, "public");
|
|
4842
|
-
const isPublicDirExist = await
|
|
1241
|
+
const isPublicDirExist = await fs10.pathExists(publicDir);
|
|
4843
1242
|
const assetPrefix = isProduction() ? removeTrailingSlash(config?.builderConfig?.output?.assetPrefix ?? base) : "";
|
|
4844
1243
|
const enableMdxRs = config?.markdown?.mdxRs ?? true;
|
|
4845
1244
|
const reactVersion = await detectReactVersion();
|
|
@@ -4950,10 +1349,10 @@ async function createInternalBuildConfig(userDocRoot, config, isSSR, routeServic
|
|
|
4950
1349
|
multiple: config?.replaceRules || []
|
|
4951
1350
|
});
|
|
4952
1351
|
if (chain.plugins.has(CHAIN_ID.PLUGIN.REACT_FAST_REFRESH)) {
|
|
4953
|
-
chain.plugin(CHAIN_ID.PLUGIN.REACT_FAST_REFRESH).tap((
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
return
|
|
1352
|
+
chain.plugin(CHAIN_ID.PLUGIN.REACT_FAST_REFRESH).tap((options) => {
|
|
1353
|
+
options[0] ?? (options[0] = {});
|
|
1354
|
+
options[0].include = [/\.([cm]js|[jt]sx?|flow)$/i, MDX_REGEXP3];
|
|
1355
|
+
return options;
|
|
4957
1356
|
});
|
|
4958
1357
|
}
|
|
4959
1358
|
chain.resolve.extensions.prepend(".md").prepend(".mdx").prepend(".mjs");
|
|
@@ -4967,7 +1366,7 @@ async function initRsbuild(rootDir, config, pluginDriver, isSSR = false, extraRs
|
|
|
4967
1366
|
const builderPlugins = config?.builderPlugins ?? [];
|
|
4968
1367
|
const runtimeTempDir = path10.join(RSPRESS_TEMP_DIR2, "runtime");
|
|
4969
1368
|
const runtimeAbsTempDir = path10.join(cwd, "node_modules", runtimeTempDir);
|
|
4970
|
-
await
|
|
1369
|
+
await fs8.ensureDir(runtimeAbsTempDir);
|
|
4971
1370
|
const routeService2 = await initRouteService({
|
|
4972
1371
|
config,
|
|
4973
1372
|
runtimeTempDir: runtimeAbsTempDir,
|
|
@@ -5181,8 +1580,8 @@ _plugins = new WeakMap();
|
|
|
5181
1580
|
_isProd = new WeakMap();
|
|
5182
1581
|
|
|
5183
1582
|
// src/node/dev.ts
|
|
5184
|
-
async function dev(
|
|
5185
|
-
const { docDirectory, config, extraBuilderConfig } =
|
|
1583
|
+
async function dev(options) {
|
|
1584
|
+
const { docDirectory, config, extraBuilderConfig } = options;
|
|
5186
1585
|
const base = config?.base ?? "";
|
|
5187
1586
|
const isProd = false;
|
|
5188
1587
|
const pluginDriver = new PluginDriver(config, isProd);
|
|
@@ -5206,7 +1605,7 @@ async function dev(options2) {
|
|
|
5206
1605
|
},
|
|
5207
1606
|
// We will support the following options in the future
|
|
5208
1607
|
getPortSilently: true,
|
|
5209
|
-
logger:
|
|
1608
|
+
logger: logger3
|
|
5210
1609
|
});
|
|
5211
1610
|
await pluginDriver.afterBuild();
|
|
5212
1611
|
return server;
|
|
@@ -5219,14 +1618,14 @@ async function dev(options2) {
|
|
|
5219
1618
|
import { dirname as dirname2, join as join3 } from "path";
|
|
5220
1619
|
import { pathToFileURL } from "url";
|
|
5221
1620
|
import chalk2 from "@rspress/shared/chalk";
|
|
5222
|
-
import
|
|
1621
|
+
import fs9 from "@rspress/shared/fs-extra";
|
|
5223
1622
|
import {
|
|
5224
1623
|
APPEARANCE_KEY,
|
|
5225
1624
|
normalizeSlash,
|
|
5226
1625
|
withBase as withBase3,
|
|
5227
1626
|
isDebugMode as isDebugMode2
|
|
5228
1627
|
} from "@rspress/shared";
|
|
5229
|
-
import { logger as
|
|
1628
|
+
import { logger as logger4 } from "@rspress/shared/logger";
|
|
5230
1629
|
var CHECK_DARK_LIGHT_SCRIPT = `
|
|
5231
1630
|
<script id="check-dark-light">
|
|
5232
1631
|
;(() => {
|
|
@@ -5252,8 +1651,8 @@ async function bundle(docDirectory, config, pluginDriver, enableSSG) {
|
|
|
5252
1651
|
disableMinimize: true
|
|
5253
1652
|
},
|
|
5254
1653
|
tools: {
|
|
5255
|
-
rspack(
|
|
5256
|
-
|
|
1654
|
+
rspack(options) {
|
|
1655
|
+
options.output.filename = "main.cjs";
|
|
5257
1656
|
}
|
|
5258
1657
|
}
|
|
5259
1658
|
})
|
|
@@ -5269,28 +1668,28 @@ async function bundle(docDirectory, config, pluginDriver, enableSSG) {
|
|
|
5269
1668
|
await clientBuilder.build();
|
|
5270
1669
|
}
|
|
5271
1670
|
const publicDir = join3(docDirectory, PUBLIC_DIR);
|
|
5272
|
-
if (await
|
|
5273
|
-
await
|
|
1671
|
+
if (await fs9.pathExists(publicDir)) {
|
|
1672
|
+
await fs9.copy(publicDir, outputDir);
|
|
5274
1673
|
}
|
|
5275
1674
|
} finally {
|
|
5276
1675
|
await writeSearchIndex(config);
|
|
5277
1676
|
}
|
|
5278
1677
|
}
|
|
5279
1678
|
async function renderPages(appDirectory, config, pluginDriver, enableSSG) {
|
|
5280
|
-
|
|
1679
|
+
logger4.info("Rendering pages...");
|
|
5281
1680
|
const startTime = Date.now();
|
|
5282
1681
|
const outputPath = config?.outDir ?? join3(appDirectory, OUTPUT_DIR);
|
|
5283
1682
|
const ssrBundlePath = join3(outputPath, "ssr", "main.cjs");
|
|
5284
1683
|
try {
|
|
5285
|
-
const { default:
|
|
1684
|
+
const { default: fs10 } = await import("@rspress/shared/fs-extra");
|
|
5286
1685
|
let render = null;
|
|
5287
1686
|
if (enableSSG) {
|
|
5288
1687
|
try {
|
|
5289
1688
|
const { default: ssrExports } = await import(pathToFileURL(ssrBundlePath).toString());
|
|
5290
1689
|
({ render } = ssrExports);
|
|
5291
1690
|
} catch (e) {
|
|
5292
|
-
|
|
5293
|
-
|
|
1691
|
+
logger4.error(e);
|
|
1692
|
+
logger4.warn(
|
|
5294
1693
|
`Failed to load SSR bundle: ${ssrBundlePath}, fallback to CSR.`
|
|
5295
1694
|
);
|
|
5296
1695
|
}
|
|
@@ -5298,7 +1697,7 @@ async function renderPages(appDirectory, config, pluginDriver, enableSSG) {
|
|
|
5298
1697
|
const routes = routeService.getRoutes();
|
|
5299
1698
|
const base = config?.base ?? "";
|
|
5300
1699
|
const htmlTemplatePath = join3(outputPath, "index.html");
|
|
5301
|
-
const htmlTemplate = await
|
|
1700
|
+
const htmlTemplate = await fs10.readFile(htmlTemplatePath, "utf-8");
|
|
5302
1701
|
const additionalRoutes = (await pluginDriver.addSSGRoutes()).map((route) => ({
|
|
5303
1702
|
routePath: withBase3(route.path, base)
|
|
5304
1703
|
}));
|
|
@@ -5315,7 +1714,7 @@ async function renderPages(appDirectory, config, pluginDriver, enableSSG) {
|
|
|
5315
1714
|
try {
|
|
5316
1715
|
({ appHtml } = await render(routePath, helmetContext.context));
|
|
5317
1716
|
} catch (e) {
|
|
5318
|
-
|
|
1717
|
+
logger4.warn(
|
|
5319
1718
|
`page "${routePath}" render error: ${e.message}, fallback to CSR.`
|
|
5320
1719
|
);
|
|
5321
1720
|
}
|
|
@@ -5352,29 +1751,29 @@ async function renderPages(appDirectory, config, pluginDriver, enableSSG) {
|
|
|
5352
1751
|
return `${path11}.html`.replace(normalizedBase, "");
|
|
5353
1752
|
};
|
|
5354
1753
|
const fileName = normalizeHtmlFilePath(routePath);
|
|
5355
|
-
await
|
|
5356
|
-
await
|
|
1754
|
+
await fs10.ensureDir(join3(outputPath, dirname2(fileName)));
|
|
1755
|
+
await fs10.writeFile(join3(outputPath, fileName), html);
|
|
5357
1756
|
})
|
|
5358
1757
|
);
|
|
5359
1758
|
if (!isDebugMode2()) {
|
|
5360
|
-
await
|
|
1759
|
+
await fs10.remove(join3(outputPath, "ssr"));
|
|
5361
1760
|
}
|
|
5362
|
-
await
|
|
1761
|
+
await fs10.remove(join3(outputPath, "html"));
|
|
5363
1762
|
const totalTime = Date.now() - startTime;
|
|
5364
|
-
|
|
1763
|
+
logger4.success(`Pages rendered in ${chalk2.yellow(totalTime)} ms.`);
|
|
5365
1764
|
} catch (e) {
|
|
5366
|
-
|
|
1765
|
+
logger4.error(`Pages render error: ${e.stack}`);
|
|
5367
1766
|
throw e;
|
|
5368
1767
|
}
|
|
5369
1768
|
}
|
|
5370
|
-
async function build(
|
|
5371
|
-
const { docDirectory, appDirectory, config } =
|
|
1769
|
+
async function build(options) {
|
|
1770
|
+
const { docDirectory, appDirectory, config } = options;
|
|
5372
1771
|
const pluginDriver = new PluginDriver(config, true);
|
|
5373
1772
|
const enableSSG = config.ssg ?? true;
|
|
5374
1773
|
await pluginDriver.init();
|
|
5375
1774
|
const modifiedConfig = await pluginDriver.modifyConfig();
|
|
5376
1775
|
await pluginDriver.beforeBuild();
|
|
5377
|
-
await
|
|
1776
|
+
await fs9.emptyDir(TEMP_DIR);
|
|
5378
1777
|
await bundle(docDirectory, modifiedConfig, pluginDriver, enableSSG);
|
|
5379
1778
|
await renderPages(appDirectory, modifiedConfig, pluginDriver, enableSSG);
|
|
5380
1779
|
await pluginDriver.afterBuild();
|
|
@@ -5384,8 +1783,8 @@ async function build(options2) {
|
|
|
5384
1783
|
import sirv2 from "sirv";
|
|
5385
1784
|
import compression from "compression";
|
|
5386
1785
|
import polka from "polka";
|
|
5387
|
-
async function serve(
|
|
5388
|
-
const { config, port: userPort, host: userHost } =
|
|
1786
|
+
async function serve(options) {
|
|
1787
|
+
const { config, port: userPort, host: userHost } = options;
|
|
5389
1788
|
const envPort = process.env.PORT;
|
|
5390
1789
|
const envHost = process.env.HOST;
|
|
5391
1790
|
const port = envPort || userPort || 4173;
|
|
@@ -5425,23 +1824,5 @@ export {
|
|
|
5425
1824
|
dev,
|
|
5426
1825
|
serve
|
|
5427
1826
|
};
|
|
5428
|
-
/*! Bundled license information:
|
|
5429
|
-
|
|
5430
|
-
is-extendable/index.js:
|
|
5431
|
-
(*!
|
|
5432
|
-
* is-extendable <https://github.com/jonschlinkert/is-extendable>
|
|
5433
|
-
*
|
|
5434
|
-
* Copyright (c) 2015, Jon Schlinkert.
|
|
5435
|
-
* Licensed under the MIT License.
|
|
5436
|
-
*)
|
|
5437
|
-
|
|
5438
|
-
strip-bom-string/index.js:
|
|
5439
|
-
(*!
|
|
5440
|
-
* strip-bom-string <https://github.com/jonschlinkert/strip-bom-string>
|
|
5441
|
-
*
|
|
5442
|
-
* Copyright (c) 2015, 2017, Jon Schlinkert.
|
|
5443
|
-
* Released under the MIT License.
|
|
5444
|
-
*)
|
|
5445
|
-
*/
|
|
5446
1827
|
|
|
5447
1828
|
//# sourceMappingURL=index.js.map
|