ssqch 0.9.0 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/bundled/completions/bash +1 -1
- package/bundled/completions/elvish +1 -0
- package/bundled/completions/fish +1 -0
- package/bundled/completions/powershell +1 -0
- package/bundled/completions/zsh +1 -0
- package/bundled/docs/agents.md +70 -0
- package/bundled/docs/benchmarks.md +29 -0
- package/bundled/docs/build-summary.md +57 -0
- package/bundled/docs/comparing-builds.md +51 -0
- package/bundled/docs/configuring.md +138 -0
- package/bundled/docs/content-schemas.md +54 -0
- package/bundled/docs/css-and-javascript.md +33 -0
- package/bundled/docs/data-files.md +55 -0
- package/bundled/docs/deploying.md +47 -0
- package/bundled/docs/field-guide.md +144 -0
- package/bundled/docs/footprint.md +27 -0
- package/bundled/docs/github-pages.md +41 -0
- package/bundled/docs/index.md +26 -0
- package/bundled/docs/install.md +27 -0
- package/bundled/docs/known-gaps.md +18 -0
- package/bundled/docs/markdown.md +114 -0
- package/bundled/docs/multilingual.md +14 -0
- package/bundled/docs/nav.yml +50 -0
- package/bundled/docs/netlify.md +30 -0
- package/bundled/docs/new-pages.md +42 -0
- package/bundled/docs/plugins.md +13 -0
- package/bundled/docs/rust-plugins.md +32 -0
- package/bundled/docs/seo.md +19 -0
- package/bundled/docs/template-languages.md +106 -0
- package/bundled/docs/templates.md +37 -0
- package/bundled/docs/themes.md +31 -0
- package/bundled/{trailheads → docs/trailheads}/from-component-frameworks.md +7 -3
- package/bundled/{trailheads → docs/trailheads}/from-docusaurus.md +7 -4
- package/bundled/{trailheads → docs/trailheads}/from-eleventy.md +7 -4
- package/bundled/{trailheads → docs/trailheads}/from-hexo.md +7 -4
- package/bundled/{trailheads → docs/trailheads}/from-jekyll.md +6 -3
- package/bundled/{trailheads → docs/trailheads}/from-mkdocs.md +8 -5
- package/bundled/{trailheads → docs/trailheads}/from-zola.md +6 -3
- package/bundled/docs/trailheads.md +38 -0
- package/bundled/docs/where-values-come-from.md +57 -0
- package/bundled/ssqch.d.ts +10 -3
- package/lib/assets.js +18 -12
- package/lib/{chunk-7PWCYHTJ.js → chunk-26SHWRC6.js} +6 -8
- package/lib/{chunk-GUKSZ2XM.js → chunk-3BQJY6GF.js} +4 -6
- package/lib/{chunk-TICWN55Z.js → chunk-3LODFCCH.js} +2 -3
- package/lib/{chunk-TVU3OPPK.js → chunk-3NDFUMV2.js} +3 -3
- package/lib/{chunk-YTHQBMDJ.js → chunk-6OUT5VFK.js} +3 -6
- package/lib/{chunk-HXCLCXRT.js → chunk-6RSZV5O2.js} +5 -3
- package/lib/{chunk-4Q6WMTER.js → chunk-7JGYYAKI.js} +1 -1
- package/lib/{chunk-MI6EJWA2.js → chunk-BT3NVQOD.js} +1 -1
- package/lib/{chunk-DDV6JEC2.js → chunk-BXARVN5Z.js} +1 -1
- package/lib/{chunk-RNJFPFXE.js → chunk-CXRHH5P5.js} +5 -6
- package/lib/{chunk-HPXAZ2HU.js → chunk-DNWA7WNO.js} +1 -1
- package/lib/{chunk-SURPOAW7.js → chunk-DTSTCVRX.js} +8 -9
- package/lib/{chunk-7SD7K567.js → chunk-DUGGZ4EE.js} +1 -1
- package/lib/{chunk-7XLK2GEG.js → chunk-ERNVEZOK.js} +1 -1
- package/lib/{chunk-3A647I3N.js → chunk-FYRC2HBU.js} +4 -6
- package/lib/{chunk-IJWHOFRP.js → chunk-FYU22VDK.js} +12 -13
- package/lib/{chunk-II5DEH3Q.js → chunk-FZGJUJAL.js} +5 -7
- package/lib/{chunk-BEGC7YP6.js → chunk-G67W2FTJ.js} +9 -11
- package/lib/{chunk-7RDRZHJD.js → chunk-HMVYNV6M.js} +13 -15
- package/lib/{chunk-DELWRJAO.js → chunk-HNG372DW.js} +143 -74
- package/lib/{chunk-47P4YREZ.js → chunk-II7ZRIAC.js} +11 -13
- package/lib/{chunk-NCWFYT74.js → chunk-IOXCGMSF.js} +5 -7
- package/lib/{chunk-GRWMGC7D.js → chunk-JFPLNHEQ.js} +2410 -2298
- package/lib/{chunk-LPHNACE4.js → chunk-LU73FTIR.js} +10 -11
- package/lib/{chunk-D2XE2GTY.js → chunk-LYPKL524.js} +9 -10
- package/lib/{chunk-NKXEPHRZ.js → chunk-MDB3D3LP.js} +106 -4
- package/lib/{chunk-CZ4XQC56.js → chunk-MDG5A4NI.js} +15 -13
- package/lib/{chunk-SXMJ52IK.js → chunk-MUYWL4ZX.js} +58 -19
- package/lib/{chunk-R7K3D5W5.js → chunk-P2TRR6XK.js} +83 -24
- package/lib/{chunk-SF4I6Z7S.js → chunk-R2YGC3VE.js} +2 -3
- package/lib/{chunk-76NTVE34.js → chunk-RFNLZM7W.js} +2 -4
- package/lib/{chunk-3K3ANWZ2.js → chunk-X7C6GFUM.js} +4 -4
- package/lib/{chunk-XMXBHXZR.js → chunk-XR7GFL4B.js} +12 -13
- package/lib/{chunk-NNUKIGOO.js → chunk-ZZBHBLDB.js} +16 -18
- package/lib/cli.js +25 -25
- package/lib/elements.js +10 -12
- package/lib/image.js +10 -11
- package/lib/links.js +13 -15
- package/lib/minify.js +9 -10
- package/lib/redirects.js +11 -13
- package/lib/rss.js +22 -22
- package/lib/sass.js +10 -12
- package/lib/sitemap.js +10 -12
- package/lib/ssqch.js +4 -5
- package/package.json +2 -2
- package/types/index.d.ts +9 -2
- package/types/rss.d.ts +1 -1
- package/bundled/README.md +0 -1314
- package/lib/chunk-VJWQSYEG.js +0 -119
- package/lib/{chunk-DELWRJAO.js.LEGAL.txt → chunk-HNG372DW.js.LEGAL.txt} +0 -0
- package/lib/{chunk-GRWMGC7D.js.LEGAL.txt → chunk-JFPLNHEQ.js.LEGAL.txt} +3 -3
|
@@ -1,2044 +1,1379 @@
|
|
|
1
1
|
import { createRequire as __ssqchCreateRequire } from "node:module";
|
|
2
2
|
const require = __ssqchCreateRequire(import.meta.url);
|
|
3
|
-
import {
|
|
4
|
-
realPath
|
|
5
|
-
} from "./chunk-VJWQSYEG.js";
|
|
6
3
|
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
// src/paths.ts
|
|
5
|
+
import fs from "node:fs";
|
|
6
|
+
import path from "node:path";
|
|
7
|
+
var slashes = (p) => path.sep === "/" ? p : p.split(path.sep).join("/");
|
|
8
|
+
function displayPath(root, file) {
|
|
9
|
+
if (file === root) return "./";
|
|
10
|
+
return file.startsWith(root + path.sep) ? `./${slashes(file.slice(root.length + 1))}` : file;
|
|
11
|
+
}
|
|
12
|
+
var shown = (root, file) => displayPath(root, file).replace(/^\.\//, "");
|
|
13
|
+
var relative = (dir, file) => slashes(path.relative(dir, file));
|
|
14
|
+
var joinAsGiven = (base, rel) => path.isAbsolute(rel) || base === "" ? rel : /[\\/]$/.test(base) ? base + rel : base + path.sep + rel;
|
|
15
|
+
function parentAsGiven(p) {
|
|
16
|
+
const separators = path.sep === "/" ? "/" : "\\/";
|
|
17
|
+
let end = p.length;
|
|
18
|
+
while (end > 1 && separators.includes(p[end - 1])) end--;
|
|
19
|
+
let at = end - 1;
|
|
20
|
+
while (at >= 0 && !separators.includes(p[at])) at--;
|
|
21
|
+
if (at < 0) return "";
|
|
22
|
+
let parent = at;
|
|
23
|
+
while (parent > 0 && separators.includes(p[parent - 1])) parent--;
|
|
24
|
+
return parent === 0 ? p.slice(0, 1) : p.slice(0, parent);
|
|
25
|
+
}
|
|
26
|
+
var realPath = (p) => {
|
|
27
|
+
try {
|
|
28
|
+
return fs.realpathSync.native(p);
|
|
29
|
+
} catch {
|
|
30
|
+
return p;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
var isFile = (p) => fs.statSync(p, { throwIfNoEntry: false })?.isFile() ?? false;
|
|
34
|
+
var isDir = (p) => fs.statSync(p, { throwIfNoEntry: false })?.isDirectory() ?? false;
|
|
35
|
+
var isInside = (dir, file) => file === dir || file.startsWith(dir.endsWith(path.sep) ? dir : dir + path.sep);
|
|
36
|
+
function compareText(a, b) {
|
|
37
|
+
const n = Math.min(a.length, b.length);
|
|
38
|
+
for (let i2 = 0; i2 < n; i2++) {
|
|
39
|
+
let x = a.charCodeAt(i2), y = b.charCodeAt(i2);
|
|
40
|
+
if (x === y) continue;
|
|
41
|
+
if (x >= 55296 && y >= 55296) {
|
|
42
|
+
x = x >= 57344 ? x - 2048 : x + 8192;
|
|
43
|
+
y = y >= 57344 ? y - 2048 : y + 8192;
|
|
44
|
+
}
|
|
45
|
+
return x - y;
|
|
46
|
+
}
|
|
47
|
+
return a.length - b.length;
|
|
48
|
+
}
|
|
49
|
+
function comparePaths(a, b) {
|
|
50
|
+
if (a === b) return 0;
|
|
51
|
+
const x = a.split(path.sep), y = b.split(path.sep);
|
|
52
|
+
const n = Math.min(x.length, y.length);
|
|
53
|
+
for (let i2 = 0; i2 < n; i2++) {
|
|
54
|
+
if (x[i2] === y[i2]) continue;
|
|
55
|
+
return compareText(x[i2], y[i2]);
|
|
56
|
+
}
|
|
57
|
+
return x.length - y.length;
|
|
58
|
+
}
|
|
59
|
+
function walkFiles(dir) {
|
|
60
|
+
const out = [];
|
|
61
|
+
const walk = (d) => {
|
|
62
|
+
let entries;
|
|
63
|
+
try {
|
|
64
|
+
entries = fs.readdirSync(d, { withFileTypes: true });
|
|
65
|
+
} catch {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
for (const entry of entries) {
|
|
69
|
+
const p = path.join(d, entry.name);
|
|
70
|
+
if (entry.isDirectory()) walk(p);
|
|
71
|
+
else if (entry.isFile()) out.push(p);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
walk(dir);
|
|
75
|
+
return out;
|
|
11
76
|
}
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
77
|
+
function readFollowing(dir, above, onError) {
|
|
78
|
+
const out = [];
|
|
79
|
+
const here = above[above.length - 1] ?? realPath(dir);
|
|
80
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
81
|
+
const file = path.join(dir, entry.name);
|
|
82
|
+
if (!entry.isSymbolicLink()) {
|
|
83
|
+
out.push({ name: entry.name, path: file, isDirectory: entry.isDirectory(), isFile: entry.isFile(), real: path.join(here, entry.name) });
|
|
19
84
|
continue;
|
|
20
|
-
codeblock += i2.toString().padEnd(numberLen, " ");
|
|
21
|
-
codeblock += ": ";
|
|
22
|
-
codeblock += l;
|
|
23
|
-
codeblock += "\n";
|
|
24
|
-
if (i2 === line) {
|
|
25
|
-
codeblock += " ".repeat(numberLen + column + 2);
|
|
26
|
-
codeblock += "^\n";
|
|
27
85
|
}
|
|
86
|
+
const stat = fs.statSync(file, { throwIfNoEntry: false });
|
|
87
|
+
if (!stat) {
|
|
88
|
+
onError({ path: file, broken: true });
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
const real = realPath(file);
|
|
92
|
+
if (stat.isDirectory()) {
|
|
93
|
+
const at = above.indexOf(real);
|
|
94
|
+
if (at !== -1) {
|
|
95
|
+
onError({ path: file, loop: above[at] });
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
out.push({ name: entry.name, path: file, isDirectory: stat.isDirectory(), isFile: stat.isFile(), real });
|
|
28
100
|
}
|
|
29
|
-
return
|
|
101
|
+
return out;
|
|
30
102
|
}
|
|
31
|
-
var TomlError = class _TomlError extends Error {
|
|
32
|
-
line;
|
|
33
|
-
column;
|
|
34
|
-
codeblock;
|
|
35
|
-
constructor(message, options) {
|
|
36
|
-
const [line, column] = getLineColFromPtr(options.toml, options.ptr);
|
|
37
|
-
const codeblock = makeCodeBlock(options.toml, line, column);
|
|
38
|
-
super(`Invalid TOML document: ${message}
|
|
39
103
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
104
|
+
// node_modules/js-yaml/dist/js-yaml.mjs
|
|
105
|
+
function isNothing(subject) {
|
|
106
|
+
return typeof subject === "undefined" || subject === null;
|
|
107
|
+
}
|
|
108
|
+
function isObject(subject) {
|
|
109
|
+
return typeof subject === "object" && subject !== null;
|
|
110
|
+
}
|
|
111
|
+
function toArray(sequence) {
|
|
112
|
+
if (Array.isArray(sequence)) return sequence;
|
|
113
|
+
else if (isNothing(sequence)) return [];
|
|
114
|
+
return [sequence];
|
|
115
|
+
}
|
|
116
|
+
function extend(target, source) {
|
|
117
|
+
var index, length, key, sourceKeys;
|
|
118
|
+
if (source) {
|
|
119
|
+
sourceKeys = Object.keys(source);
|
|
120
|
+
for (index = 0, length = sourceKeys.length; index < length; index += 1) {
|
|
121
|
+
key = sourceKeys[index];
|
|
122
|
+
target[key] = source[key];
|
|
123
|
+
}
|
|
44
124
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
125
|
+
return target;
|
|
126
|
+
}
|
|
127
|
+
function repeat(string, count) {
|
|
128
|
+
var result = "", cycle;
|
|
129
|
+
for (cycle = 0; cycle < count; cycle += 1) {
|
|
130
|
+
result += string;
|
|
48
131
|
}
|
|
132
|
+
return result;
|
|
133
|
+
}
|
|
134
|
+
function isNegativeZero(number) {
|
|
135
|
+
return number === 0 && Number.NEGATIVE_INFINITY === 1 / number;
|
|
136
|
+
}
|
|
137
|
+
var isNothing_1 = isNothing;
|
|
138
|
+
var isObject_1 = isObject;
|
|
139
|
+
var toArray_1 = toArray;
|
|
140
|
+
var repeat_1 = repeat;
|
|
141
|
+
var isNegativeZero_1 = isNegativeZero;
|
|
142
|
+
var extend_1 = extend;
|
|
143
|
+
var common = {
|
|
144
|
+
isNothing: isNothing_1,
|
|
145
|
+
isObject: isObject_1,
|
|
146
|
+
toArray: toArray_1,
|
|
147
|
+
repeat: repeat_1,
|
|
148
|
+
isNegativeZero: isNegativeZero_1,
|
|
149
|
+
extend: extend_1
|
|
49
150
|
};
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
let first = c;
|
|
56
|
-
let isLiteral = c === 39;
|
|
57
|
-
let isMultiline = c === ctx.s.charCodeAt(ctx.p) && c === ctx.s.charCodeAt(ctx.p + 1);
|
|
58
|
-
if (isMultiline) {
|
|
59
|
-
if ((c = ctx.s.charCodeAt(ctx.p += 2)) === 10)
|
|
60
|
-
ctx.p++;
|
|
61
|
-
else if (c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)
|
|
62
|
-
ctx.p += 2;
|
|
151
|
+
function formatError(exception2, compact) {
|
|
152
|
+
var where = "", message = exception2.reason || "(unknown reason)";
|
|
153
|
+
if (!exception2.mark) return message;
|
|
154
|
+
if (exception2.mark.name) {
|
|
155
|
+
where += 'in "' + exception2.mark.name + '" ';
|
|
63
156
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
for (; ctx.p < ctx.s.length; ctx.p++) {
|
|
68
|
-
c = ctx.s.charCodeAt(ctx.p);
|
|
69
|
-
if (isMultiline && (c === 10 || c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)) {
|
|
70
|
-
state = state && 3;
|
|
71
|
-
} else if (c < 32 && c !== 9 || c === 127) {
|
|
72
|
-
TomlError.x("control characters are not allowed in strings", ctx);
|
|
73
|
-
} else if ((!state || state === 3) && c === first && (!isMultiline || ctx.s.charCodeAt(ctx.p + 1) === first && ctx.s.charCodeAt(ctx.p + 2) === first)) {
|
|
74
|
-
if (isMultiline) {
|
|
75
|
-
if (ctx.s.charCodeAt(ctx.p + 3) === first)
|
|
76
|
-
ctx.p++;
|
|
77
|
-
if (ctx.s.charCodeAt(ctx.p + 3) === first)
|
|
78
|
-
ctx.p++;
|
|
79
|
-
}
|
|
80
|
-
if (!state) {
|
|
81
|
-
let s = ctx.s.slice(sliceStart, ctx.p);
|
|
82
|
-
parsed = parsed ? parsed + s : s;
|
|
83
|
-
}
|
|
84
|
-
ctx.p += isMultiline ? 3 : 1;
|
|
85
|
-
return parsed;
|
|
86
|
-
} else if (!state) {
|
|
87
|
-
if (!isLiteral && c === 92) {
|
|
88
|
-
parsed += ctx.s.slice(sliceStart, sliceStart = ctx.p);
|
|
89
|
-
state = 1;
|
|
90
|
-
}
|
|
91
|
-
} else if (state === 1) {
|
|
92
|
-
if (c === 120 || c === 117 || c === 85) {
|
|
93
|
-
let errPtr = ctx.p++ - 1;
|
|
94
|
-
let value = 0;
|
|
95
|
-
let len = c === 120 ? 2 : c === 117 ? 4 : 8;
|
|
96
|
-
for (let j = 0; j < len; j++, ctx.p++) {
|
|
97
|
-
let hex = ctx.s.charCodeAt(ctx.p);
|
|
98
|
-
let digit = (
|
|
99
|
-
/* 0-9 */
|
|
100
|
-
hex >= 48 && hex <= 57 ? hex - 48 : (
|
|
101
|
-
/* A-F */
|
|
102
|
-
hex >= 65 && hex <= 70 ? hex - 65 + 10 : (
|
|
103
|
-
/* a-f */
|
|
104
|
-
hex >= 97 && hex <= 102 ? hex - 97 + 10 : -1
|
|
105
|
-
)
|
|
106
|
-
)
|
|
107
|
-
);
|
|
108
|
-
if (digit < 0)
|
|
109
|
-
TomlError.x("invalid non-hex character in unicode escape", ctx);
|
|
110
|
-
value = value << 4 | digit;
|
|
111
|
-
}
|
|
112
|
-
if (value < 0 || value > 1114111 || value >= 55296 && value <= 57343) {
|
|
113
|
-
TomlError.x("invalid unicode escape", ctx, errPtr);
|
|
114
|
-
}
|
|
115
|
-
parsed += String.fromCodePoint(value);
|
|
116
|
-
sliceStart = ctx.p--;
|
|
117
|
-
state = 0;
|
|
118
|
-
} else if (isMultiline && (c === 32 || c === 9)) {
|
|
119
|
-
state = 2;
|
|
120
|
-
} else {
|
|
121
|
-
if (c === 98)
|
|
122
|
-
parsed += "\b";
|
|
123
|
-
else if (c === 116)
|
|
124
|
-
parsed += " ";
|
|
125
|
-
else if (c === 110)
|
|
126
|
-
parsed += "\n";
|
|
127
|
-
else if (c === 102)
|
|
128
|
-
parsed += "\f";
|
|
129
|
-
else if (c === 114)
|
|
130
|
-
parsed += "\r";
|
|
131
|
-
else if (c === 101)
|
|
132
|
-
parsed += "\x1B";
|
|
133
|
-
else if (c === 34)
|
|
134
|
-
parsed += '"';
|
|
135
|
-
else if (c === 92)
|
|
136
|
-
parsed += "\\";
|
|
137
|
-
else
|
|
138
|
-
TomlError.x("unrecognised escape sequence", ctx);
|
|
139
|
-
sliceStart = ctx.p + 1;
|
|
140
|
-
state = 0;
|
|
141
|
-
}
|
|
142
|
-
} else if (c !== 32 && c !== 9) {
|
|
143
|
-
if (state === 2)
|
|
144
|
-
TomlError.x("invalid escape: only line-ending whitespace may be escaped", ctx, sliceStart);
|
|
145
|
-
state = !isLiteral && c === 92 ? 1 : 0;
|
|
146
|
-
sliceStart = ctx.p;
|
|
147
|
-
}
|
|
157
|
+
where += "(" + (exception2.mark.line + 1) + ":" + (exception2.mark.column + 1) + ")";
|
|
158
|
+
if (!compact && exception2.mark.snippet) {
|
|
159
|
+
where += "\n\n" + exception2.mark.snippet;
|
|
148
160
|
}
|
|
149
|
-
|
|
161
|
+
return message + " " + where;
|
|
150
162
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
let offset = "Z";
|
|
162
|
-
let c;
|
|
163
|
-
if (typeof date === "string") {
|
|
164
|
-
if (fasttype)
|
|
165
|
-
prep: {
|
|
166
|
-
if (fasttype < 3) {
|
|
167
|
-
if (+date.slice(11, 13) > 23) {
|
|
168
|
-
date = "";
|
|
169
|
-
break prep;
|
|
170
|
-
}
|
|
171
|
-
if (fasttype === 2) {
|
|
172
|
-
offset = null;
|
|
173
|
-
date += "Z";
|
|
174
|
-
} else if ((c = date.charCodeAt(date.length - 1)) !== 90 && c !== 122) {
|
|
175
|
-
offset = date.slice(date.length - 6);
|
|
176
|
-
}
|
|
177
|
-
if (unsafeDelim)
|
|
178
|
-
date = date.slice(0, 10) + "T" + date.slice(11);
|
|
179
|
-
} else if (fasttype === 4) {
|
|
180
|
-
date = +date.slice(0, 2) > 23 ? "" : `0000-01-01T${date}Z`;
|
|
181
|
-
}
|
|
182
|
-
hasDate = fasttype !== 4;
|
|
183
|
-
hasTime = fasttype !== 3;
|
|
184
|
-
}
|
|
185
|
-
else {
|
|
186
|
-
let match = date.match(DATE_TIME_RE);
|
|
187
|
-
if (match) {
|
|
188
|
-
if (!match[1]) {
|
|
189
|
-
hasDate = false;
|
|
190
|
-
date = `0000-01-01T${date}`;
|
|
191
|
-
}
|
|
192
|
-
hasTime = !!match[2];
|
|
193
|
-
hasTime && date[10] === " " && (date = date.replace(" ", "T"));
|
|
194
|
-
if (match[2] && +match[2] > 23) {
|
|
195
|
-
date = "";
|
|
196
|
-
} else {
|
|
197
|
-
offset = match[3] || null;
|
|
198
|
-
if (!offset && hasTime)
|
|
199
|
-
date += "Z";
|
|
200
|
-
}
|
|
201
|
-
} else {
|
|
202
|
-
date = "";
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
super(date);
|
|
207
|
-
if (!isNaN(this.getTime())) {
|
|
208
|
-
this.#hasDate = hasDate;
|
|
209
|
-
this.#hasTime = hasTime;
|
|
210
|
-
this.#offset = offset;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
isDateTime() {
|
|
214
|
-
return this.#hasDate && this.#hasTime;
|
|
215
|
-
}
|
|
216
|
-
isLocal() {
|
|
217
|
-
return !this.#hasDate || !this.#hasTime || !this.#offset;
|
|
218
|
-
}
|
|
219
|
-
isDate() {
|
|
220
|
-
return this.#hasDate && !this.#hasTime;
|
|
163
|
+
function YAMLException$1(reason, mark) {
|
|
164
|
+
Error.call(this);
|
|
165
|
+
this.name = "YAMLException";
|
|
166
|
+
this.reason = reason;
|
|
167
|
+
this.mark = mark;
|
|
168
|
+
this.message = formatError(this, false);
|
|
169
|
+
if (Error.captureStackTrace) {
|
|
170
|
+
Error.captureStackTrace(this, this.constructor);
|
|
171
|
+
} else {
|
|
172
|
+
this.stack = new Error().stack || "";
|
|
221
173
|
}
|
|
222
|
-
|
|
223
|
-
|
|
174
|
+
}
|
|
175
|
+
YAMLException$1.prototype = Object.create(Error.prototype);
|
|
176
|
+
YAMLException$1.prototype.constructor = YAMLException$1;
|
|
177
|
+
YAMLException$1.prototype.toString = function toString(compact) {
|
|
178
|
+
return this.name + ": " + formatError(this, compact);
|
|
179
|
+
};
|
|
180
|
+
var exception = YAMLException$1;
|
|
181
|
+
function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
|
|
182
|
+
var head = "";
|
|
183
|
+
var tail = "";
|
|
184
|
+
var maxHalfLength = Math.floor(maxLineLength / 2) - 1;
|
|
185
|
+
if (position - lineStart > maxHalfLength) {
|
|
186
|
+
head = " ... ";
|
|
187
|
+
lineStart = position - maxHalfLength + head.length;
|
|
224
188
|
}
|
|
225
|
-
|
|
226
|
-
|
|
189
|
+
if (lineEnd - position > maxHalfLength) {
|
|
190
|
+
tail = " ...";
|
|
191
|
+
lineEnd = position + maxHalfLength - tail.length;
|
|
227
192
|
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
193
|
+
return {
|
|
194
|
+
str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, "\u2192") + tail,
|
|
195
|
+
pos: position - lineStart + head.length
|
|
196
|
+
// relative position
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
function padStart(string, max) {
|
|
200
|
+
return common.repeat(" ", max - string.length) + string;
|
|
201
|
+
}
|
|
202
|
+
function makeSnippet(mark, options) {
|
|
203
|
+
options = Object.create(options || null);
|
|
204
|
+
if (!mark.buffer) return null;
|
|
205
|
+
if (!options.maxLength) options.maxLength = 79;
|
|
206
|
+
if (typeof options.indent !== "number") options.indent = 1;
|
|
207
|
+
if (typeof options.linesBefore !== "number") options.linesBefore = 3;
|
|
208
|
+
if (typeof options.linesAfter !== "number") options.linesAfter = 2;
|
|
209
|
+
var re = /\r?\n|\r|\0/g;
|
|
210
|
+
var lineStarts = [0];
|
|
211
|
+
var lineEnds = [];
|
|
212
|
+
var match;
|
|
213
|
+
var foundLineNo = -1;
|
|
214
|
+
while (match = re.exec(mark.buffer)) {
|
|
215
|
+
lineEnds.push(match.index);
|
|
216
|
+
lineStarts.push(match.index + match[0].length);
|
|
217
|
+
if (mark.position <= match.index && foundLineNo < 0) {
|
|
218
|
+
foundLineNo = lineStarts.length - 2;
|
|
219
|
+
}
|
|
242
220
|
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
221
|
+
if (foundLineNo < 0) foundLineNo = lineStarts.length - 1;
|
|
222
|
+
var result = "", i2, line;
|
|
223
|
+
var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length;
|
|
224
|
+
var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3);
|
|
225
|
+
for (i2 = 1; i2 <= options.linesBefore; i2++) {
|
|
226
|
+
if (foundLineNo - i2 < 0) break;
|
|
227
|
+
line = getLine(
|
|
228
|
+
mark.buffer,
|
|
229
|
+
lineStarts[foundLineNo - i2],
|
|
230
|
+
lineEnds[foundLineNo - i2],
|
|
231
|
+
mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i2]),
|
|
232
|
+
maxLineLength
|
|
233
|
+
);
|
|
234
|
+
result = common.repeat(" ", options.indent) + padStart((mark.line - i2 + 1).toString(), lineNoLength) + " | " + line.str + "\n" + result;
|
|
247
235
|
}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
236
|
+
line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
|
|
237
|
+
result += common.repeat(" ", options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + " | " + line.str + "\n";
|
|
238
|
+
result += common.repeat("-", options.indent + lineNoLength + 3 + line.pos) + "^\n";
|
|
239
|
+
for (i2 = 1; i2 <= options.linesAfter; i2++) {
|
|
240
|
+
if (foundLineNo + i2 >= lineEnds.length) break;
|
|
241
|
+
line = getLine(
|
|
242
|
+
mark.buffer,
|
|
243
|
+
lineStarts[foundLineNo + i2],
|
|
244
|
+
lineEnds[foundLineNo + i2],
|
|
245
|
+
mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i2]),
|
|
246
|
+
maxLineLength
|
|
247
|
+
);
|
|
248
|
+
result += common.repeat(" ", options.indent) + padStart((mark.line + i2 + 1).toString(), lineNoLength) + " | " + line.str + "\n";
|
|
252
249
|
}
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
250
|
+
return result.replace(/\n$/, "");
|
|
251
|
+
}
|
|
252
|
+
var snippet = makeSnippet;
|
|
253
|
+
var TYPE_CONSTRUCTOR_OPTIONS = [
|
|
254
|
+
"kind",
|
|
255
|
+
"multi",
|
|
256
|
+
"resolve",
|
|
257
|
+
"construct",
|
|
258
|
+
"instanceOf",
|
|
259
|
+
"predicate",
|
|
260
|
+
"represent",
|
|
261
|
+
"representName",
|
|
262
|
+
"defaultStyle",
|
|
263
|
+
"styleAliases"
|
|
264
|
+
];
|
|
265
|
+
var YAML_NODE_KINDS = [
|
|
266
|
+
"scalar",
|
|
267
|
+
"sequence",
|
|
268
|
+
"mapping"
|
|
269
|
+
];
|
|
270
|
+
function compileStyleAliases(map2) {
|
|
271
|
+
var result = {};
|
|
272
|
+
if (map2 !== null) {
|
|
273
|
+
Object.keys(map2).forEach(function(style) {
|
|
274
|
+
map2[style].forEach(function(alias) {
|
|
275
|
+
result[String(alias)] = style;
|
|
276
|
+
});
|
|
277
|
+
});
|
|
258
278
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
279
|
+
return result;
|
|
280
|
+
}
|
|
281
|
+
function Type$1(tag, options) {
|
|
282
|
+
options = options || {};
|
|
283
|
+
Object.keys(options).forEach(function(name) {
|
|
284
|
+
if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
|
|
285
|
+
throw new exception('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
this.options = options;
|
|
289
|
+
this.tag = tag;
|
|
290
|
+
this.kind = options["kind"] || null;
|
|
291
|
+
this.resolve = options["resolve"] || function() {
|
|
292
|
+
return true;
|
|
293
|
+
};
|
|
294
|
+
this.construct = options["construct"] || function(data) {
|
|
295
|
+
return data;
|
|
296
|
+
};
|
|
297
|
+
this.instanceOf = options["instanceOf"] || null;
|
|
298
|
+
this.predicate = options["predicate"] || null;
|
|
299
|
+
this.represent = options["represent"] || null;
|
|
300
|
+
this.representName = options["representName"] || null;
|
|
301
|
+
this.defaultStyle = options["defaultStyle"] || null;
|
|
302
|
+
this.multi = options["multi"] || false;
|
|
303
|
+
this.styleAliases = compileStyleAliases(options["styleAliases"] || null);
|
|
304
|
+
if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
|
|
305
|
+
throw new exception('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
|
|
264
306
|
}
|
|
265
|
-
};
|
|
266
|
-
|
|
267
|
-
// node_modules/smol-toml/dist/extract.js
|
|
268
|
-
function isDigit(char, base = 10) {
|
|
269
|
-
return base === 16 ? char > 47 && char < 58 || char > 64 && char < 71 || char > 96 && char < 103 : char > 47 && char < 48 + base;
|
|
270
307
|
}
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
308
|
+
var type = Type$1;
|
|
309
|
+
function compileList(schema2, name) {
|
|
310
|
+
var result = [];
|
|
311
|
+
schema2[name].forEach(function(currentType) {
|
|
312
|
+
var newIndex = result.length;
|
|
313
|
+
result.forEach(function(previousType, previousIndex) {
|
|
314
|
+
if (previousType.tag === currentType.tag && previousType.kind === currentType.kind && previousType.multi === currentType.multi) {
|
|
315
|
+
newIndex = previousIndex;
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
result[newIndex] = currentType;
|
|
319
|
+
});
|
|
320
|
+
return result;
|
|
275
321
|
}
|
|
276
|
-
function
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
322
|
+
function compileMap() {
|
|
323
|
+
var result = {
|
|
324
|
+
scalar: {},
|
|
325
|
+
sequence: {},
|
|
326
|
+
mapping: {},
|
|
327
|
+
fallback: {},
|
|
328
|
+
multi: {
|
|
329
|
+
scalar: [],
|
|
330
|
+
sequence: [],
|
|
331
|
+
mapping: [],
|
|
332
|
+
fallback: []
|
|
333
|
+
}
|
|
334
|
+
}, index, length;
|
|
335
|
+
function collectType(type2) {
|
|
336
|
+
if (type2.multi) {
|
|
337
|
+
result.multi[type2.kind].push(type2);
|
|
338
|
+
result.multi["fallback"].push(type2);
|
|
339
|
+
} else {
|
|
340
|
+
result[type2.kind][type2.tag] = result["fallback"][type2.tag] = type2;
|
|
341
|
+
}
|
|
292
342
|
}
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
TomlError.x("invalid value", ctx, errPtr);
|
|
296
|
-
return ctx.p++, false;
|
|
343
|
+
for (index = 0, length = arguments.length; index < length; index += 1) {
|
|
344
|
+
arguments[index].forEach(collectType);
|
|
297
345
|
}
|
|
298
|
-
|
|
299
|
-
return parseNumber(ctx, ctx.p, ctx.s.charCodeAt(++ctx.p), 44 - c, end);
|
|
300
|
-
}
|
|
301
|
-
if (ctx.s.charCodeAt(ctx.p + 4) === 45 && ctx.s.charCodeAt(ctx.p + 7) === 45) {
|
|
302
|
-
return parseDate(ctx, c, end);
|
|
303
|
-
}
|
|
304
|
-
if (ctx.s.charCodeAt(ctx.p + 2) === 58) {
|
|
305
|
-
return parseTime(ctx, c, end);
|
|
306
|
-
}
|
|
307
|
-
return parseNumber(ctx, ctx.p, c, 0, end);
|
|
346
|
+
return result;
|
|
308
347
|
}
|
|
309
|
-
function
|
|
310
|
-
|
|
311
|
-
let state = 0;
|
|
312
|
-
let hasUnderscores = false;
|
|
313
|
-
if (c === 105) {
|
|
314
|
-
if (ctx.s.charCodeAt(++ctx.p) !== 110 || ctx.s.charCodeAt(++ctx.p) !== 102)
|
|
315
|
-
TomlError.x("invalid value", ctx, startPtr);
|
|
316
|
-
return ctx.p++, (sign || 1) / 0;
|
|
317
|
-
}
|
|
318
|
-
if (c === 110) {
|
|
319
|
-
if (ctx.s.charCodeAt(++ctx.p) !== 97 || ctx.s.charCodeAt(++ctx.p) !== 110)
|
|
320
|
-
TomlError.x("invalid value", ctx, startPtr);
|
|
321
|
-
return ctx.p++, NaN;
|
|
322
|
-
}
|
|
323
|
-
if (c === 48) {
|
|
324
|
-
if (++ctx.p >= ctx.s.length || isEndOfValue(c = ctx.s.charCodeAt(ctx.p), endChr))
|
|
325
|
-
return ctx.bi === true ? 0n : 0;
|
|
326
|
-
if (!sign) {
|
|
327
|
-
if (c === 120)
|
|
328
|
-
return parseIntegerBaseN(ctx, startPtr, 16, endChr);
|
|
329
|
-
else if (c === 98)
|
|
330
|
-
return parseIntegerBaseN(ctx, startPtr, 2, endChr);
|
|
331
|
-
else if (c === 111)
|
|
332
|
-
return parseIntegerBaseN(ctx, startPtr, 8, endChr);
|
|
333
|
-
}
|
|
334
|
-
if (c === 46)
|
|
335
|
-
state = 2;
|
|
336
|
-
else if (c === 101 || c === 69)
|
|
337
|
-
state = 4;
|
|
338
|
-
else
|
|
339
|
-
TomlError.x("illegal leading zero", ctx, startPtr);
|
|
340
|
-
} else if (!isDigit(c))
|
|
341
|
-
TomlError.x("invalid value", ctx, startPtr);
|
|
342
|
-
while (++ctx.p < ctx.s.length && (c = ctx.s.charCodeAt(ctx.p), !isEndOfValue(c, endChr))) {
|
|
343
|
-
if (!state)
|
|
344
|
-
state = 1;
|
|
345
|
-
if (c === 95) {
|
|
346
|
-
if (!(state & 1))
|
|
347
|
-
TomlError.x("illegal underscore", ctx);
|
|
348
|
-
state += 11;
|
|
349
|
-
hasUnderscores = true;
|
|
350
|
-
} else if (state === 1 && c === 46)
|
|
351
|
-
state = 2;
|
|
352
|
-
else if ((state === 1 || state === 3) && (c === 101 || c === 69))
|
|
353
|
-
state = 4;
|
|
354
|
-
else if (state === 4 && (c === 43 || c === 45)) {
|
|
355
|
-
state = 6;
|
|
356
|
-
} else if (!isDigit(c))
|
|
357
|
-
TomlError.x(`illegal character in numeric literal`, ctx);
|
|
358
|
-
else if (state > 9)
|
|
359
|
-
state -= 11;
|
|
360
|
-
else if (!(state & 1))
|
|
361
|
-
state++;
|
|
362
|
-
}
|
|
363
|
-
if (!state) {
|
|
364
|
-
let val = (startChr - 48) * (sign || 1);
|
|
365
|
-
return ctx.bi === true ? BigInt(val) : val;
|
|
366
|
-
}
|
|
367
|
-
if (!(state & 1))
|
|
368
|
-
TomlError.x("unfinished numeric value", ctx, startPtr);
|
|
369
|
-
let str2 = ctx.s.slice(startPtr, ctx.p);
|
|
370
|
-
if (hasUnderscores)
|
|
371
|
-
str2 = str2.replaceAll("_", "");
|
|
372
|
-
return state > 1 ? parseFloat(str2) : parseInteger(ctx, str2, 10, startPtr);
|
|
348
|
+
function Schema$1(definition) {
|
|
349
|
+
return this.extend(definition);
|
|
373
350
|
}
|
|
374
|
-
function
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
351
|
+
Schema$1.prototype.extend = function extend2(definition) {
|
|
352
|
+
var implicit = [];
|
|
353
|
+
var explicit = [];
|
|
354
|
+
if (definition instanceof type) {
|
|
355
|
+
explicit.push(definition);
|
|
356
|
+
} else if (Array.isArray(definition)) {
|
|
357
|
+
explicit = explicit.concat(definition);
|
|
358
|
+
} else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {
|
|
359
|
+
if (definition.implicit) implicit = implicit.concat(definition.implicit);
|
|
360
|
+
if (definition.explicit) explicit = explicit.concat(definition.explicit);
|
|
361
|
+
} else {
|
|
362
|
+
throw new exception("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");
|
|
385
363
|
}
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
if (underscore)
|
|
390
|
-
str2 = str2.replaceAll("_", "");
|
|
391
|
-
return parseInteger(ctx, str2, base, startPtr);
|
|
392
|
-
}
|
|
393
|
-
function parseInteger(ctx, str2, base, startPtr) {
|
|
394
|
-
if (ctx.bi !== true)
|
|
395
|
-
int: {
|
|
396
|
-
let val = parseInt(str2, base);
|
|
397
|
-
if (!Number.isSafeInteger(val)) {
|
|
398
|
-
if (ctx.bi)
|
|
399
|
-
break int;
|
|
400
|
-
TomlError.x("integer value cannot be represented losslessly", ctx, startPtr);
|
|
401
|
-
}
|
|
402
|
-
return val;
|
|
364
|
+
implicit.forEach(function(type$1) {
|
|
365
|
+
if (!(type$1 instanceof type)) {
|
|
366
|
+
throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
|
403
367
|
}
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
function parseDate(ctx, c, endChr) {
|
|
407
|
-
let startPtr = ctx.p++, unsafeSeparator;
|
|
408
|
-
if (!isDigit(c) || !isDigit(ctx.s.charCodeAt(ctx.p++)) || !isDigit(ctx.s.charCodeAt(ctx.p++)) || !isDigit(ctx.s.charCodeAt(ctx.p++))) {
|
|
409
|
-
return parseNumber(ctx, ctx.p = startPtr, c, 0, endChr);
|
|
410
|
-
}
|
|
411
|
-
ctx.p += 5;
|
|
412
|
-
if (!isDigit(ctx.s.charCodeAt(ctx.p++)))
|
|
413
|
-
TomlError.x("invalid date-time: date part is malformed", ctx, startPtr);
|
|
414
|
-
if (ctx.p >= ctx.s.length || ((c = ctx.s.charCodeAt(ctx.p)) !== 32 || (unsafeSeparator = true, !isDigit(ctx.s.charCodeAt(ctx.p + 1)))) && c !== 84 && c !== 116) {
|
|
415
|
-
let t2 = ctx.s.slice(startPtr, ctx.p);
|
|
416
|
-
return readDate(ctx, t2, 3, false, startPtr);
|
|
417
|
-
}
|
|
418
|
-
if (ctx.s.charCodeAt(ctx.p += 3) !== 58)
|
|
419
|
-
TomlError.x("invalid date-time: time part is malformed", ctx, startPtr);
|
|
420
|
-
if (ctx.s.charCodeAt(ctx.p += 3) === 58)
|
|
421
|
-
ctx.p += 3;
|
|
422
|
-
if (ctx.s.charCodeAt(ctx.p) === 46)
|
|
423
|
-
while (isDigit(ctx.s.charCodeAt(++ctx.p)))
|
|
424
|
-
;
|
|
425
|
-
if (c = ctx.s.charCodeAt(ctx.p)) {
|
|
426
|
-
if (c === 90 || c === 122) {
|
|
427
|
-
let t2 = ctx.s.slice(startPtr, ++ctx.p);
|
|
428
|
-
return readDate(ctx, t2, 1, unsafeSeparator, startPtr, "[+00:00]");
|
|
368
|
+
if (type$1.loadKind && type$1.loadKind !== "scalar") {
|
|
369
|
+
throw new exception("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
|
|
429
370
|
}
|
|
430
|
-
if (
|
|
431
|
-
|
|
432
|
-
return readDate(ctx, t2, 1, unsafeSeparator, startPtr, !ctx.ld && "[" + ctx.s.slice(ctx.p - 6, ctx.p) + "]");
|
|
371
|
+
if (type$1.multi) {
|
|
372
|
+
throw new exception("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.");
|
|
433
373
|
}
|
|
374
|
+
});
|
|
375
|
+
explicit.forEach(function(type$1) {
|
|
376
|
+
if (!(type$1 instanceof type)) {
|
|
377
|
+
throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
|
378
|
+
}
|
|
379
|
+
});
|
|
380
|
+
var result = Object.create(Schema$1.prototype);
|
|
381
|
+
result.implicit = (this.implicit || []).concat(implicit);
|
|
382
|
+
result.explicit = (this.explicit || []).concat(explicit);
|
|
383
|
+
result.compiledImplicit = compileList(result, "implicit");
|
|
384
|
+
result.compiledExplicit = compileList(result, "explicit");
|
|
385
|
+
result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit);
|
|
386
|
+
return result;
|
|
387
|
+
};
|
|
388
|
+
var schema = Schema$1;
|
|
389
|
+
var str = new type("tag:yaml.org,2002:str", {
|
|
390
|
+
kind: "scalar",
|
|
391
|
+
construct: function(data) {
|
|
392
|
+
return data !== null ? data : "";
|
|
434
393
|
}
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
function
|
|
439
|
-
|
|
440
|
-
if (!isDigit(c) || !isDigit(ctx.s.charCodeAt(++ctx.p))) {
|
|
441
|
-
return parseNumber(ctx, --ctx.p, c, 0, endChr);
|
|
442
|
-
}
|
|
443
|
-
if (ctx.s.charCodeAt(ctx.p += 4) === 58)
|
|
444
|
-
ctx.p += 3;
|
|
445
|
-
if (ctx.s.charCodeAt(ctx.p) === 46)
|
|
446
|
-
while (isDigit(ctx.s.charCodeAt(++ctx.p)))
|
|
447
|
-
;
|
|
448
|
-
let t = ctx.s.slice(start, ctx.p);
|
|
449
|
-
return readDate(ctx, t, 4, false, start);
|
|
450
|
-
}
|
|
451
|
-
function readDate(ctx, str2, type2, unsafeDelim, errPtr, temporalSuffix) {
|
|
452
|
-
if (ctx.ld) {
|
|
453
|
-
let date = new TomlDate(str2, type2, unsafeDelim);
|
|
454
|
-
if (!date.isValid())
|
|
455
|
-
TomlError.x("invalid date", ctx, errPtr);
|
|
456
|
-
return date;
|
|
394
|
+
});
|
|
395
|
+
var seq = new type("tag:yaml.org,2002:seq", {
|
|
396
|
+
kind: "sequence",
|
|
397
|
+
construct: function(data) {
|
|
398
|
+
return data !== null ? data : [];
|
|
457
399
|
}
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
return Temporal.ZonedDateTime.from(str2);
|
|
464
|
-
case 2:
|
|
465
|
-
return Temporal.PlainDateTime.from(str2);
|
|
466
|
-
case 3:
|
|
467
|
-
return Temporal.PlainDate.from(str2);
|
|
468
|
-
case 4:
|
|
469
|
-
return Temporal.PlainTime.from(str2);
|
|
470
|
-
}
|
|
471
|
-
} catch (e) {
|
|
472
|
-
TomlError.x(e instanceof Error ? e.message : "" + e, ctx, errPtr);
|
|
400
|
+
});
|
|
401
|
+
var map = new type("tag:yaml.org,2002:map", {
|
|
402
|
+
kind: "mapping",
|
|
403
|
+
construct: function(data) {
|
|
404
|
+
return data !== null ? data : {};
|
|
473
405
|
}
|
|
406
|
+
});
|
|
407
|
+
var failsafe = new schema({
|
|
408
|
+
explicit: [
|
|
409
|
+
str,
|
|
410
|
+
seq,
|
|
411
|
+
map
|
|
412
|
+
]
|
|
413
|
+
});
|
|
414
|
+
function resolveYamlNull(data) {
|
|
415
|
+
if (data === null) return true;
|
|
416
|
+
var max = data.length;
|
|
417
|
+
return max === 1 && data === "~" || max === 4 && (data === "null" || data === "Null" || data === "NULL");
|
|
474
418
|
}
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
function skipComment(ctx) {
|
|
478
|
-
for (; ctx.p < ctx.s.length; ctx.p++) {
|
|
479
|
-
let c = ctx.s.charCodeAt(ctx.p);
|
|
480
|
-
if (c === 10)
|
|
481
|
-
break;
|
|
482
|
-
if (c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) {
|
|
483
|
-
ctx.p++;
|
|
484
|
-
break;
|
|
485
|
-
}
|
|
486
|
-
if (c < 32 && c !== 9 || c === 127) {
|
|
487
|
-
TomlError.x("control characters are not allowed in comments", ctx);
|
|
488
|
-
}
|
|
489
|
-
}
|
|
419
|
+
function constructYamlNull() {
|
|
420
|
+
return null;
|
|
490
421
|
}
|
|
491
|
-
function
|
|
492
|
-
|
|
493
|
-
while (ctx.p < ctx.s.length) {
|
|
494
|
-
while (ctx.p < ctx.s.length && ((c = ctx.s.charCodeAt(ctx.p)) === 32 || c === 9 || !banNewLines && (c === 10 || c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)))
|
|
495
|
-
ctx.p++;
|
|
496
|
-
if (banComments || c !== 35)
|
|
497
|
-
break;
|
|
498
|
-
skipComment(ctx);
|
|
499
|
-
}
|
|
422
|
+
function isNull(object) {
|
|
423
|
+
return object === null;
|
|
500
424
|
}
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
state = 0;
|
|
522
|
-
} else if (!state && (c === 34 || c === 39)) {
|
|
523
|
-
if (c === ctx.s.charCodeAt(ctx.p + 1) && c === ctx.s.charCodeAt(ctx.p + 2))
|
|
524
|
-
TomlError.x("illegal quoted key: multiline strings are not allowed", ctx);
|
|
525
|
-
parsed.push(parseString(ctx));
|
|
526
|
-
state = 2;
|
|
527
|
-
ctx.p--;
|
|
528
|
-
} else if (c === 32 || c === 9) {
|
|
529
|
-
if (state === 1) {
|
|
530
|
-
parsed.push(ctx.s.slice(sliceStart, ctx.p));
|
|
531
|
-
state = 2;
|
|
532
|
-
}
|
|
533
|
-
} else if (state === 2 || c < 48 && c !== 45 || c > 57 && c < 65 || c > 90 && c < 97 && c !== 95 || c > 122) {
|
|
534
|
-
TomlError.x("illegal character in key", ctx);
|
|
535
|
-
} else if (!state) {
|
|
536
|
-
state = 1;
|
|
537
|
-
sliceStart = ctx.p;
|
|
425
|
+
var _null = new type("tag:yaml.org,2002:null", {
|
|
426
|
+
kind: "scalar",
|
|
427
|
+
resolve: resolveYamlNull,
|
|
428
|
+
construct: constructYamlNull,
|
|
429
|
+
predicate: isNull,
|
|
430
|
+
represent: {
|
|
431
|
+
canonical: function() {
|
|
432
|
+
return "~";
|
|
433
|
+
},
|
|
434
|
+
lowercase: function() {
|
|
435
|
+
return "null";
|
|
436
|
+
},
|
|
437
|
+
uppercase: function() {
|
|
438
|
+
return "NULL";
|
|
439
|
+
},
|
|
440
|
+
camelcase: function() {
|
|
441
|
+
return "Null";
|
|
442
|
+
},
|
|
443
|
+
empty: function() {
|
|
444
|
+
return "";
|
|
538
445
|
}
|
|
539
|
-
}
|
|
540
|
-
|
|
446
|
+
},
|
|
447
|
+
defaultStyle: "lowercase"
|
|
448
|
+
});
|
|
449
|
+
function resolveYamlBoolean(data) {
|
|
450
|
+
if (data === null) return false;
|
|
451
|
+
var max = data.length;
|
|
452
|
+
return max === 4 && (data === "true" || data === "True" || data === "TRUE") || max === 5 && (data === "false" || data === "False" || data === "FALSE");
|
|
541
453
|
}
|
|
542
|
-
function
|
|
543
|
-
|
|
544
|
-
let res = /* @__PURE__ */ Object.create(null);
|
|
545
|
-
let seen = /* @__PURE__ */ new Set();
|
|
546
|
-
let c;
|
|
547
|
-
while (ctx.p < ctx.s.length) {
|
|
548
|
-
skipVoid(ctx);
|
|
549
|
-
if ((c = ctx.s.charCodeAt(ctx.p)) === 125) {
|
|
550
|
-
ctx.p++;
|
|
551
|
-
return res;
|
|
552
|
-
}
|
|
553
|
-
let k;
|
|
554
|
-
let t = res;
|
|
555
|
-
let hasOwn = false;
|
|
556
|
-
let errPtr = ctx.p;
|
|
557
|
-
let key = parseKey(ctx);
|
|
558
|
-
for (let i2 = 0; i2 < key.length; i2++) {
|
|
559
|
-
if (i2)
|
|
560
|
-
t = hasOwn ? t[k] : t[k] = /* @__PURE__ */ Object.create(null);
|
|
561
|
-
k = key[i2];
|
|
562
|
-
if ((hasOwn = Object.hasOwn(t, k)) && (typeof t[k] !== "object" || seen.has(t[k]))) {
|
|
563
|
-
TomlError.x("trying to redefine an already defined value", ctx, errPtr);
|
|
564
|
-
}
|
|
565
|
-
let unsafe = k === "__proto__";
|
|
566
|
-
if (ctx.uk && (unsafe || k === "constructor")) {
|
|
567
|
-
t = ctx.uk !== 1 && TomlError.x("document contains an unsafe property", ctx, errPtr);
|
|
568
|
-
break;
|
|
569
|
-
}
|
|
570
|
-
if (!hasOwn && unsafe) {
|
|
571
|
-
Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
if (hasOwn) {
|
|
575
|
-
TomlError.x("trying to redefine an already defined value", ctx, errPtr);
|
|
576
|
-
}
|
|
577
|
-
skipVoid(ctx, true, true);
|
|
578
|
-
let value = extractValue(
|
|
579
|
-
ctx,
|
|
580
|
-
125
|
|
581
|
-
/* } */
|
|
582
|
-
);
|
|
583
|
-
if (t && typeof (t[k] = value) === "object")
|
|
584
|
-
seen.add(value);
|
|
585
|
-
skipVoid(ctx);
|
|
586
|
-
if ((c = ctx.s.charCodeAt(ctx.p++)) === 125) {
|
|
587
|
-
return res;
|
|
588
|
-
}
|
|
589
|
-
if (c !== 44)
|
|
590
|
-
TomlError.x("expected comma or end of structure", ctx, ctx.p - 1);
|
|
591
|
-
}
|
|
592
|
-
TomlError.x("unfinished table", ctx, startPtr);
|
|
454
|
+
function constructYamlBoolean(data) {
|
|
455
|
+
return data === "true" || data === "True" || data === "TRUE";
|
|
593
456
|
}
|
|
594
|
-
function
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
return res;
|
|
457
|
+
function isBoolean(object) {
|
|
458
|
+
return Object.prototype.toString.call(object) === "[object Boolean]";
|
|
459
|
+
}
|
|
460
|
+
var bool = new type("tag:yaml.org,2002:bool", {
|
|
461
|
+
kind: "scalar",
|
|
462
|
+
resolve: resolveYamlBoolean,
|
|
463
|
+
construct: constructYamlBoolean,
|
|
464
|
+
predicate: isBoolean,
|
|
465
|
+
represent: {
|
|
466
|
+
lowercase: function(object) {
|
|
467
|
+
return object ? "true" : "false";
|
|
468
|
+
},
|
|
469
|
+
uppercase: function(object) {
|
|
470
|
+
return object ? "TRUE" : "FALSE";
|
|
471
|
+
},
|
|
472
|
+
camelcase: function(object) {
|
|
473
|
+
return object ? "True" : "False";
|
|
612
474
|
}
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
475
|
+
},
|
|
476
|
+
defaultStyle: "lowercase"
|
|
477
|
+
});
|
|
478
|
+
function isHexCode(c) {
|
|
479
|
+
return 48 <= c && c <= 57 || 65 <= c && c <= 70 || 97 <= c && c <= 102;
|
|
617
480
|
}
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
481
|
+
function isOctCode(c) {
|
|
482
|
+
return 48 <= c && c <= 55;
|
|
483
|
+
}
|
|
484
|
+
function isDecCode(c) {
|
|
485
|
+
return 48 <= c && c <= 57;
|
|
486
|
+
}
|
|
487
|
+
function resolveYamlInteger(data) {
|
|
488
|
+
if (data === null) return false;
|
|
489
|
+
var max = data.length, index = 0, hasDigits = false, ch;
|
|
490
|
+
if (!max) return false;
|
|
491
|
+
ch = data[index];
|
|
492
|
+
if (ch === "-" || ch === "+") {
|
|
493
|
+
ch = data[++index];
|
|
494
|
+
}
|
|
495
|
+
if (ch === "0") {
|
|
496
|
+
if (index + 1 === max) return true;
|
|
497
|
+
ch = data[++index];
|
|
498
|
+
if (ch === "b") {
|
|
499
|
+
index++;
|
|
500
|
+
for (; index < max; index++) {
|
|
501
|
+
ch = data[index];
|
|
502
|
+
if (ch === "_") continue;
|
|
503
|
+
if (ch !== "0" && ch !== "1") return false;
|
|
504
|
+
hasDigits = true;
|
|
637
505
|
}
|
|
506
|
+
return hasDigits && ch !== "_";
|
|
638
507
|
}
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
508
|
+
if (ch === "x") {
|
|
509
|
+
index++;
|
|
510
|
+
for (; index < max; index++) {
|
|
511
|
+
ch = data[index];
|
|
512
|
+
if (ch === "_") continue;
|
|
513
|
+
if (!isHexCode(data.charCodeAt(index))) return false;
|
|
514
|
+
hasDigits = true;
|
|
515
|
+
}
|
|
516
|
+
return hasDigits && ch !== "_";
|
|
642
517
|
}
|
|
643
|
-
if (
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
518
|
+
if (ch === "o") {
|
|
519
|
+
index++;
|
|
520
|
+
for (; index < max; index++) {
|
|
521
|
+
ch = data[index];
|
|
522
|
+
if (ch === "_") continue;
|
|
523
|
+
if (!isOctCode(data.charCodeAt(index))) return false;
|
|
524
|
+
hasDigits = true;
|
|
650
525
|
}
|
|
651
|
-
|
|
652
|
-
t: i2 < key.length - 1 && type2 === 2 ? 3 : type2,
|
|
653
|
-
d: false,
|
|
654
|
-
i: 0,
|
|
655
|
-
c: /* @__PURE__ */ Object.create(null)
|
|
656
|
-
};
|
|
526
|
+
return hasDigits && ch !== "_";
|
|
657
527
|
}
|
|
658
528
|
}
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
state.d = true;
|
|
666
|
-
t[k] = [];
|
|
529
|
+
if (ch === "_") return false;
|
|
530
|
+
for (; index < max; index++) {
|
|
531
|
+
ch = data[index];
|
|
532
|
+
if (ch === "_") continue;
|
|
533
|
+
if (!isDecCode(data.charCodeAt(index))) {
|
|
534
|
+
return false;
|
|
667
535
|
}
|
|
668
|
-
|
|
669
|
-
state.c[state.i++] = state = { t: 1, d: false, i: 0, c: /* @__PURE__ */ Object.create(null) };
|
|
536
|
+
hasDigits = true;
|
|
670
537
|
}
|
|
671
|
-
if (
|
|
672
|
-
|
|
538
|
+
if (!hasDigits || ch === "_") return false;
|
|
539
|
+
return true;
|
|
540
|
+
}
|
|
541
|
+
function constructYamlInteger(data) {
|
|
542
|
+
var value = data, sign = 1, ch;
|
|
543
|
+
if (value.indexOf("_") !== -1) {
|
|
544
|
+
value = value.replace(/_/g, "");
|
|
673
545
|
}
|
|
674
|
-
|
|
675
|
-
if (
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
546
|
+
ch = value[0];
|
|
547
|
+
if (ch === "-" || ch === "+") {
|
|
548
|
+
if (ch === "-") sign = -1;
|
|
549
|
+
value = value.slice(1);
|
|
550
|
+
ch = value[0];
|
|
679
551
|
}
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
}
|
|
686
|
-
function parse(toml, options = {}) {
|
|
687
|
-
let ctx = {
|
|
688
|
-
s: toml,
|
|
689
|
-
p: 0,
|
|
690
|
-
d: options.maxDepth ?? 1e3,
|
|
691
|
-
bi: options.integersAsBigInt ?? false,
|
|
692
|
-
ld: options.useLegacyDate ?? true,
|
|
693
|
-
uk: options.unsafeKeyBehaviour === "throw" ? 2 : options.unsafeKeyBehaviour === "drop" ? 1 : 0
|
|
694
|
-
};
|
|
695
|
-
let res = /* @__PURE__ */ Object.create(null);
|
|
696
|
-
let meta = /* @__PURE__ */ Object.create(null);
|
|
697
|
-
let tmp;
|
|
698
|
-
let skipping = false;
|
|
699
|
-
let tbl = res;
|
|
700
|
-
let m = meta;
|
|
701
|
-
if (toml.charCodeAt(0) === 65279)
|
|
702
|
-
ctx.p++;
|
|
703
|
-
skipVoid(ctx);
|
|
704
|
-
while (ctx.p < toml.length) {
|
|
705
|
-
if (toml.charCodeAt(ctx.p) === 91) {
|
|
706
|
-
let isTableArray = toml.charCodeAt(++ctx.p) === 91;
|
|
707
|
-
tmp = ctx.p += +isTableArray;
|
|
708
|
-
skipping = false;
|
|
709
|
-
let k = parseKey(
|
|
710
|
-
ctx,
|
|
711
|
-
93
|
|
712
|
-
/* ] */
|
|
713
|
-
);
|
|
714
|
-
if (isTableArray) {
|
|
715
|
-
if (toml.charCodeAt(ctx.p) !== 93) {
|
|
716
|
-
TomlError.x("expected end of table array declaration", ctx);
|
|
717
|
-
}
|
|
718
|
-
ctx.p++;
|
|
719
|
-
}
|
|
720
|
-
let p = peekTable(
|
|
721
|
-
ctx,
|
|
722
|
-
k,
|
|
723
|
-
res,
|
|
724
|
-
meta,
|
|
725
|
-
isTableArray ? 2 : 1
|
|
726
|
-
/* Type.EXPLICIT */
|
|
727
|
-
);
|
|
728
|
-
if (!p) {
|
|
729
|
-
validateTablePeek(ctx, p, tmp);
|
|
730
|
-
skipping = true;
|
|
731
|
-
} else {
|
|
732
|
-
m = p[2];
|
|
733
|
-
tbl = p[1];
|
|
734
|
-
}
|
|
735
|
-
} else {
|
|
736
|
-
tmp = ctx.p;
|
|
737
|
-
let k = parseKey(ctx);
|
|
738
|
-
let p = peekTable(
|
|
739
|
-
ctx,
|
|
740
|
-
k,
|
|
741
|
-
tbl,
|
|
742
|
-
m,
|
|
743
|
-
0
|
|
744
|
-
/* Type.DOTTED */
|
|
745
|
-
);
|
|
746
|
-
if (!p && !skipping)
|
|
747
|
-
validateTablePeek(ctx, p, tmp);
|
|
748
|
-
skipVoid(ctx, true, true);
|
|
749
|
-
let v = extractValue(ctx, void 0);
|
|
750
|
-
if (p && !skipping)
|
|
751
|
-
p[1][p[0]] = v;
|
|
752
|
-
}
|
|
753
|
-
skipVoid(ctx, true);
|
|
754
|
-
if (ctx.p < toml.length && (tmp = toml.charCodeAt(ctx.p)) !== 10 && (tmp !== 13 || toml.charCodeAt(ctx.p + 1) !== 10)) {
|
|
755
|
-
TomlError.x("each key-value declaration must be followed by an end-of-line", ctx);
|
|
756
|
-
}
|
|
757
|
-
skipVoid(ctx);
|
|
552
|
+
if (value === "0") return 0;
|
|
553
|
+
if (ch === "0") {
|
|
554
|
+
if (value[1] === "b") return sign * parseInt(value.slice(2), 2);
|
|
555
|
+
if (value[1] === "x") return sign * parseInt(value.slice(2), 16);
|
|
556
|
+
if (value[1] === "o") return sign * parseInt(value.slice(2), 8);
|
|
758
557
|
}
|
|
759
|
-
return
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
// node_modules/smol-toml/dist/stringify.js
|
|
763
|
-
var HAS_WELLFORMED = !!"".isWellFormed;
|
|
764
|
-
|
|
765
|
-
// src/data.ts
|
|
766
|
-
import fs3 from "node:fs";
|
|
767
|
-
import path3 from "node:path";
|
|
768
|
-
|
|
769
|
-
// node_modules/js-yaml/dist/js-yaml.mjs
|
|
770
|
-
function isNothing(subject) {
|
|
771
|
-
return typeof subject === "undefined" || subject === null;
|
|
772
|
-
}
|
|
773
|
-
function isObject(subject) {
|
|
774
|
-
return typeof subject === "object" && subject !== null;
|
|
558
|
+
return sign * parseInt(value, 10);
|
|
775
559
|
}
|
|
776
|
-
function
|
|
777
|
-
|
|
778
|
-
else if (isNothing(sequence)) return [];
|
|
779
|
-
return [sequence];
|
|
560
|
+
function isInteger(object) {
|
|
561
|
+
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 === 0 && !common.isNegativeZero(object));
|
|
780
562
|
}
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
563
|
+
var int = new type("tag:yaml.org,2002:int", {
|
|
564
|
+
kind: "scalar",
|
|
565
|
+
resolve: resolveYamlInteger,
|
|
566
|
+
construct: constructYamlInteger,
|
|
567
|
+
predicate: isInteger,
|
|
568
|
+
represent: {
|
|
569
|
+
binary: function(obj) {
|
|
570
|
+
return obj >= 0 ? "0b" + obj.toString(2) : "-0b" + obj.toString(2).slice(1);
|
|
571
|
+
},
|
|
572
|
+
octal: function(obj) {
|
|
573
|
+
return obj >= 0 ? "0o" + obj.toString(8) : "-0o" + obj.toString(8).slice(1);
|
|
574
|
+
},
|
|
575
|
+
decimal: function(obj) {
|
|
576
|
+
return obj.toString(10);
|
|
577
|
+
},
|
|
578
|
+
/* eslint-disable max-len */
|
|
579
|
+
hexadecimal: function(obj) {
|
|
580
|
+
return obj >= 0 ? "0x" + obj.toString(16).toUpperCase() : "-0x" + obj.toString(16).toUpperCase().slice(1);
|
|
788
581
|
}
|
|
582
|
+
},
|
|
583
|
+
defaultStyle: "decimal",
|
|
584
|
+
styleAliases: {
|
|
585
|
+
binary: [2, "bin"],
|
|
586
|
+
octal: [8, "oct"],
|
|
587
|
+
decimal: [10, "dec"],
|
|
588
|
+
hexadecimal: [16, "hex"]
|
|
789
589
|
}
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
590
|
+
});
|
|
591
|
+
var YAML_FLOAT_PATTERN = new RegExp(
|
|
592
|
+
// 2.5e4, 2.5 and integers
|
|
593
|
+
"^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"
|
|
594
|
+
);
|
|
595
|
+
function resolveYamlFloat(data) {
|
|
596
|
+
if (data === null) return false;
|
|
597
|
+
if (!YAML_FLOAT_PATTERN.test(data) || // Quick hack to not allow integers end with `_`
|
|
598
|
+
// Probably should update regexp & check speed
|
|
599
|
+
data[data.length - 1] === "_") {
|
|
600
|
+
return false;
|
|
796
601
|
}
|
|
797
|
-
return
|
|
798
|
-
}
|
|
799
|
-
function isNegativeZero(number) {
|
|
800
|
-
return number === 0 && Number.NEGATIVE_INFINITY === 1 / number;
|
|
602
|
+
return true;
|
|
801
603
|
}
|
|
802
|
-
|
|
803
|
-
var
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
var common = {
|
|
809
|
-
isNothing: isNothing_1,
|
|
810
|
-
isObject: isObject_1,
|
|
811
|
-
toArray: toArray_1,
|
|
812
|
-
repeat: repeat_1,
|
|
813
|
-
isNegativeZero: isNegativeZero_1,
|
|
814
|
-
extend: extend_1
|
|
815
|
-
};
|
|
816
|
-
function formatError(exception2, compact) {
|
|
817
|
-
var where = "", message = exception2.reason || "(unknown reason)";
|
|
818
|
-
if (!exception2.mark) return message;
|
|
819
|
-
if (exception2.mark.name) {
|
|
820
|
-
where += 'in "' + exception2.mark.name + '" ';
|
|
604
|
+
function constructYamlFloat(data) {
|
|
605
|
+
var value, sign;
|
|
606
|
+
value = data.replace(/_/g, "").toLowerCase();
|
|
607
|
+
sign = value[0] === "-" ? -1 : 1;
|
|
608
|
+
if ("+-".indexOf(value[0]) >= 0) {
|
|
609
|
+
value = value.slice(1);
|
|
821
610
|
}
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
611
|
+
if (value === ".inf") {
|
|
612
|
+
return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
|
|
613
|
+
} else if (value === ".nan") {
|
|
614
|
+
return NaN;
|
|
825
615
|
}
|
|
826
|
-
return
|
|
616
|
+
return sign * parseFloat(value, 10);
|
|
827
617
|
}
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
618
|
+
var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
|
|
619
|
+
function representYamlFloat(object, style) {
|
|
620
|
+
var res;
|
|
621
|
+
if (isNaN(object)) {
|
|
622
|
+
switch (style) {
|
|
623
|
+
case "lowercase":
|
|
624
|
+
return ".nan";
|
|
625
|
+
case "uppercase":
|
|
626
|
+
return ".NAN";
|
|
627
|
+
case "camelcase":
|
|
628
|
+
return ".NaN";
|
|
629
|
+
}
|
|
630
|
+
} else if (Number.POSITIVE_INFINITY === object) {
|
|
631
|
+
switch (style) {
|
|
632
|
+
case "lowercase":
|
|
633
|
+
return ".inf";
|
|
634
|
+
case "uppercase":
|
|
635
|
+
return ".INF";
|
|
636
|
+
case "camelcase":
|
|
637
|
+
return ".Inf";
|
|
638
|
+
}
|
|
639
|
+
} else if (Number.NEGATIVE_INFINITY === object) {
|
|
640
|
+
switch (style) {
|
|
641
|
+
case "lowercase":
|
|
642
|
+
return "-.inf";
|
|
643
|
+
case "uppercase":
|
|
644
|
+
return "-.INF";
|
|
645
|
+
case "camelcase":
|
|
646
|
+
return "-.Inf";
|
|
647
|
+
}
|
|
648
|
+
} else if (common.isNegativeZero(object)) {
|
|
649
|
+
return "-0.0";
|
|
838
650
|
}
|
|
651
|
+
res = object.toString(10);
|
|
652
|
+
return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res;
|
|
839
653
|
}
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
YAMLException$1.prototype.toString = function toString(compact) {
|
|
843
|
-
return this.name + ": " + formatError(this, compact);
|
|
844
|
-
};
|
|
845
|
-
var exception = YAMLException$1;
|
|
846
|
-
function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
|
|
847
|
-
var head = "";
|
|
848
|
-
var tail = "";
|
|
849
|
-
var maxHalfLength = Math.floor(maxLineLength / 2) - 1;
|
|
850
|
-
if (position - lineStart > maxHalfLength) {
|
|
851
|
-
head = " ... ";
|
|
852
|
-
lineStart = position - maxHalfLength + head.length;
|
|
853
|
-
}
|
|
854
|
-
if (lineEnd - position > maxHalfLength) {
|
|
855
|
-
tail = " ...";
|
|
856
|
-
lineEnd = position + maxHalfLength - tail.length;
|
|
857
|
-
}
|
|
858
|
-
return {
|
|
859
|
-
str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, "\u2192") + tail,
|
|
860
|
-
pos: position - lineStart + head.length
|
|
861
|
-
// relative position
|
|
862
|
-
};
|
|
654
|
+
function isFloat(object) {
|
|
655
|
+
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || common.isNegativeZero(object));
|
|
863
656
|
}
|
|
864
|
-
|
|
865
|
-
|
|
657
|
+
var float = new type("tag:yaml.org,2002:float", {
|
|
658
|
+
kind: "scalar",
|
|
659
|
+
resolve: resolveYamlFloat,
|
|
660
|
+
construct: constructYamlFloat,
|
|
661
|
+
predicate: isFloat,
|
|
662
|
+
represent: representYamlFloat,
|
|
663
|
+
defaultStyle: "lowercase"
|
|
664
|
+
});
|
|
665
|
+
var json = failsafe.extend({
|
|
666
|
+
implicit: [
|
|
667
|
+
_null,
|
|
668
|
+
bool,
|
|
669
|
+
int,
|
|
670
|
+
float
|
|
671
|
+
]
|
|
672
|
+
});
|
|
673
|
+
var core = json;
|
|
674
|
+
var YAML_DATE_REGEXP = new RegExp(
|
|
675
|
+
"^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"
|
|
676
|
+
);
|
|
677
|
+
var YAML_TIMESTAMP_REGEXP = new RegExp(
|
|
678
|
+
"^([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]))?))?$"
|
|
679
|
+
);
|
|
680
|
+
function resolveYamlTimestamp(data) {
|
|
681
|
+
if (data === null) return false;
|
|
682
|
+
if (YAML_DATE_REGEXP.exec(data) !== null) return true;
|
|
683
|
+
if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true;
|
|
684
|
+
return false;
|
|
866
685
|
}
|
|
867
|
-
function
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
if (
|
|
871
|
-
if (
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
686
|
+
function constructYamlTimestamp(data) {
|
|
687
|
+
var match, year, month, day, hour, minute, second, fraction = 0, delta = null, tz_hour, tz_minute, date;
|
|
688
|
+
match = YAML_DATE_REGEXP.exec(data);
|
|
689
|
+
if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data);
|
|
690
|
+
if (match === null) throw new Error("Date resolve error");
|
|
691
|
+
year = +match[1];
|
|
692
|
+
month = +match[2] - 1;
|
|
693
|
+
day = +match[3];
|
|
694
|
+
if (!match[4]) {
|
|
695
|
+
return new Date(Date.UTC(year, month, day));
|
|
696
|
+
}
|
|
697
|
+
hour = +match[4];
|
|
698
|
+
minute = +match[5];
|
|
699
|
+
second = +match[6];
|
|
700
|
+
if (match[7]) {
|
|
701
|
+
fraction = match[7].slice(0, 3);
|
|
702
|
+
while (fraction.length < 3) {
|
|
703
|
+
fraction += "0";
|
|
884
704
|
}
|
|
705
|
+
fraction = +fraction;
|
|
885
706
|
}
|
|
886
|
-
if (
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
if (foundLineNo - i2 < 0) break;
|
|
892
|
-
line = getLine(
|
|
893
|
-
mark.buffer,
|
|
894
|
-
lineStarts[foundLineNo - i2],
|
|
895
|
-
lineEnds[foundLineNo - i2],
|
|
896
|
-
mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i2]),
|
|
897
|
-
maxLineLength
|
|
898
|
-
);
|
|
899
|
-
result = common.repeat(" ", options.indent) + padStart((mark.line - i2 + 1).toString(), lineNoLength) + " | " + line.str + "\n" + result;
|
|
707
|
+
if (match[9]) {
|
|
708
|
+
tz_hour = +match[10];
|
|
709
|
+
tz_minute = +(match[11] || 0);
|
|
710
|
+
delta = (tz_hour * 60 + tz_minute) * 6e4;
|
|
711
|
+
if (match[9] === "-") delta = -delta;
|
|
900
712
|
}
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
713
|
+
date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
|
|
714
|
+
if (delta) date.setTime(date.getTime() - delta);
|
|
715
|
+
return date;
|
|
716
|
+
}
|
|
717
|
+
function representYamlTimestamp(object) {
|
|
718
|
+
return object.toISOString();
|
|
719
|
+
}
|
|
720
|
+
var timestamp = new type("tag:yaml.org,2002:timestamp", {
|
|
721
|
+
kind: "scalar",
|
|
722
|
+
resolve: resolveYamlTimestamp,
|
|
723
|
+
construct: constructYamlTimestamp,
|
|
724
|
+
instanceOf: Date,
|
|
725
|
+
represent: representYamlTimestamp
|
|
726
|
+
});
|
|
727
|
+
function resolveYamlMerge(data) {
|
|
728
|
+
return data === "<<" || data === null;
|
|
729
|
+
}
|
|
730
|
+
var merge = new type("tag:yaml.org,2002:merge", {
|
|
731
|
+
kind: "scalar",
|
|
732
|
+
resolve: resolveYamlMerge
|
|
733
|
+
});
|
|
734
|
+
var BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";
|
|
735
|
+
function resolveYamlBinary(data) {
|
|
736
|
+
if (data === null) return false;
|
|
737
|
+
var code, idx, bitlen = 0, max = data.length, map2 = BASE64_MAP;
|
|
738
|
+
for (idx = 0; idx < max; idx++) {
|
|
739
|
+
code = map2.indexOf(data.charAt(idx));
|
|
740
|
+
if (code > 64) continue;
|
|
741
|
+
if (code < 0) return false;
|
|
742
|
+
bitlen += 6;
|
|
914
743
|
}
|
|
915
|
-
return
|
|
744
|
+
return bitlen % 8 === 0;
|
|
916
745
|
}
|
|
917
|
-
|
|
918
|
-
var
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
"representName",
|
|
927
|
-
"defaultStyle",
|
|
928
|
-
"styleAliases"
|
|
929
|
-
];
|
|
930
|
-
var YAML_NODE_KINDS = [
|
|
931
|
-
"scalar",
|
|
932
|
-
"sequence",
|
|
933
|
-
"mapping"
|
|
934
|
-
];
|
|
935
|
-
function compileStyleAliases(map2) {
|
|
936
|
-
var result = {};
|
|
937
|
-
if (map2 !== null) {
|
|
938
|
-
Object.keys(map2).forEach(function(style) {
|
|
939
|
-
map2[style].forEach(function(alias) {
|
|
940
|
-
result[String(alias)] = style;
|
|
941
|
-
});
|
|
942
|
-
});
|
|
746
|
+
function constructYamlBinary(data) {
|
|
747
|
+
var idx, tailbits, input = data.replace(/[\r\n=]/g, ""), max = input.length, map2 = BASE64_MAP, bits = 0, result = [];
|
|
748
|
+
for (idx = 0; idx < max; idx++) {
|
|
749
|
+
if (idx % 4 === 0 && idx) {
|
|
750
|
+
result.push(bits >> 16 & 255);
|
|
751
|
+
result.push(bits >> 8 & 255);
|
|
752
|
+
result.push(bits & 255);
|
|
753
|
+
}
|
|
754
|
+
bits = bits << 6 | map2.indexOf(input.charAt(idx));
|
|
943
755
|
}
|
|
944
|
-
|
|
756
|
+
tailbits = max % 4 * 6;
|
|
757
|
+
if (tailbits === 0) {
|
|
758
|
+
result.push(bits >> 16 & 255);
|
|
759
|
+
result.push(bits >> 8 & 255);
|
|
760
|
+
result.push(bits & 255);
|
|
761
|
+
} else if (tailbits === 18) {
|
|
762
|
+
result.push(bits >> 10 & 255);
|
|
763
|
+
result.push(bits >> 2 & 255);
|
|
764
|
+
} else if (tailbits === 12) {
|
|
765
|
+
result.push(bits >> 4 & 255);
|
|
766
|
+
}
|
|
767
|
+
return new Uint8Array(result);
|
|
945
768
|
}
|
|
946
|
-
function
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
if (
|
|
950
|
-
|
|
769
|
+
function representYamlBinary(object) {
|
|
770
|
+
var result = "", bits = 0, idx, tail, max = object.length, map2 = BASE64_MAP;
|
|
771
|
+
for (idx = 0; idx < max; idx++) {
|
|
772
|
+
if (idx % 3 === 0 && idx) {
|
|
773
|
+
result += map2[bits >> 18 & 63];
|
|
774
|
+
result += map2[bits >> 12 & 63];
|
|
775
|
+
result += map2[bits >> 6 & 63];
|
|
776
|
+
result += map2[bits & 63];
|
|
951
777
|
}
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
throw new exception('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
|
|
778
|
+
bits = (bits << 8) + object[idx];
|
|
779
|
+
}
|
|
780
|
+
tail = max % 3;
|
|
781
|
+
if (tail === 0) {
|
|
782
|
+
result += map2[bits >> 18 & 63];
|
|
783
|
+
result += map2[bits >> 12 & 63];
|
|
784
|
+
result += map2[bits >> 6 & 63];
|
|
785
|
+
result += map2[bits & 63];
|
|
786
|
+
} else if (tail === 2) {
|
|
787
|
+
result += map2[bits >> 10 & 63];
|
|
788
|
+
result += map2[bits >> 4 & 63];
|
|
789
|
+
result += map2[bits << 2 & 63];
|
|
790
|
+
result += map2[64];
|
|
791
|
+
} else if (tail === 1) {
|
|
792
|
+
result += map2[bits >> 2 & 63];
|
|
793
|
+
result += map2[bits << 4 & 63];
|
|
794
|
+
result += map2[64];
|
|
795
|
+
result += map2[64];
|
|
971
796
|
}
|
|
797
|
+
return result;
|
|
972
798
|
}
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
var result = [];
|
|
976
|
-
schema2[name].forEach(function(currentType) {
|
|
977
|
-
var newIndex = result.length;
|
|
978
|
-
result.forEach(function(previousType, previousIndex) {
|
|
979
|
-
if (previousType.tag === currentType.tag && previousType.kind === currentType.kind && previousType.multi === currentType.multi) {
|
|
980
|
-
newIndex = previousIndex;
|
|
981
|
-
}
|
|
982
|
-
});
|
|
983
|
-
result[newIndex] = currentType;
|
|
984
|
-
});
|
|
985
|
-
return result;
|
|
799
|
+
function isBinary(obj) {
|
|
800
|
+
return Object.prototype.toString.call(obj) === "[object Uint8Array]";
|
|
986
801
|
}
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
802
|
+
var binary = new type("tag:yaml.org,2002:binary", {
|
|
803
|
+
kind: "scalar",
|
|
804
|
+
resolve: resolveYamlBinary,
|
|
805
|
+
construct: constructYamlBinary,
|
|
806
|
+
predicate: isBinary,
|
|
807
|
+
represent: representYamlBinary
|
|
808
|
+
});
|
|
809
|
+
var _hasOwnProperty$3 = Object.prototype.hasOwnProperty;
|
|
810
|
+
var _toString$2 = Object.prototype.toString;
|
|
811
|
+
function resolveYamlOmap(data) {
|
|
812
|
+
if (data === null) return true;
|
|
813
|
+
var objectKeys = [], index, length, pair, pairKey, pairHasKey, object = data;
|
|
814
|
+
for (index = 0, length = object.length; index < length; index += 1) {
|
|
815
|
+
pair = object[index];
|
|
816
|
+
pairHasKey = false;
|
|
817
|
+
if (_toString$2.call(pair) !== "[object Object]") return false;
|
|
818
|
+
for (pairKey in pair) {
|
|
819
|
+
if (_hasOwnProperty$3.call(pair, pairKey)) {
|
|
820
|
+
if (!pairHasKey) pairHasKey = true;
|
|
821
|
+
else return false;
|
|
822
|
+
}
|
|
1006
823
|
}
|
|
824
|
+
if (!pairHasKey) return false;
|
|
825
|
+
if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);
|
|
826
|
+
else return false;
|
|
1007
827
|
}
|
|
1008
|
-
|
|
1009
|
-
arguments[index].forEach(collectType);
|
|
1010
|
-
}
|
|
1011
|
-
return result;
|
|
828
|
+
return true;
|
|
1012
829
|
}
|
|
1013
|
-
function
|
|
1014
|
-
return
|
|
830
|
+
function constructYamlOmap(data) {
|
|
831
|
+
return data !== null ? data : [];
|
|
1015
832
|
}
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
833
|
+
var omap = new type("tag:yaml.org,2002:omap", {
|
|
834
|
+
kind: "sequence",
|
|
835
|
+
resolve: resolveYamlOmap,
|
|
836
|
+
construct: constructYamlOmap
|
|
837
|
+
});
|
|
838
|
+
var _toString$1 = Object.prototype.toString;
|
|
839
|
+
function resolveYamlPairs(data) {
|
|
840
|
+
if (data === null) return true;
|
|
841
|
+
var index, length, pair, keys, result, object = data;
|
|
842
|
+
result = new Array(object.length);
|
|
843
|
+
for (index = 0, length = object.length; index < length; index += 1) {
|
|
844
|
+
pair = object[index];
|
|
845
|
+
if (_toString$1.call(pair) !== "[object Object]") return false;
|
|
846
|
+
keys = Object.keys(pair);
|
|
847
|
+
if (keys.length !== 1) return false;
|
|
848
|
+
result[index] = [keys[0], pair[keys[0]]];
|
|
1028
849
|
}
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
});
|
|
1040
|
-
explicit.forEach(function(type$1) {
|
|
1041
|
-
if (!(type$1 instanceof type)) {
|
|
1042
|
-
throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
|
1043
|
-
}
|
|
1044
|
-
});
|
|
1045
|
-
var result = Object.create(Schema$1.prototype);
|
|
1046
|
-
result.implicit = (this.implicit || []).concat(implicit);
|
|
1047
|
-
result.explicit = (this.explicit || []).concat(explicit);
|
|
1048
|
-
result.compiledImplicit = compileList(result, "implicit");
|
|
1049
|
-
result.compiledExplicit = compileList(result, "explicit");
|
|
1050
|
-
result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit);
|
|
1051
|
-
return result;
|
|
1052
|
-
};
|
|
1053
|
-
var schema = Schema$1;
|
|
1054
|
-
var str = new type("tag:yaml.org,2002:str", {
|
|
1055
|
-
kind: "scalar",
|
|
1056
|
-
construct: function(data) {
|
|
1057
|
-
return data !== null ? data : "";
|
|
850
|
+
return true;
|
|
851
|
+
}
|
|
852
|
+
function constructYamlPairs(data) {
|
|
853
|
+
if (data === null) return [];
|
|
854
|
+
var index, length, pair, keys, result, object = data;
|
|
855
|
+
result = new Array(object.length);
|
|
856
|
+
for (index = 0, length = object.length; index < length; index += 1) {
|
|
857
|
+
pair = object[index];
|
|
858
|
+
keys = Object.keys(pair);
|
|
859
|
+
result[index] = [keys[0], pair[keys[0]]];
|
|
1058
860
|
}
|
|
1059
|
-
|
|
1060
|
-
|
|
861
|
+
return result;
|
|
862
|
+
}
|
|
863
|
+
var pairs = new type("tag:yaml.org,2002:pairs", {
|
|
1061
864
|
kind: "sequence",
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
}
|
|
865
|
+
resolve: resolveYamlPairs,
|
|
866
|
+
construct: constructYamlPairs
|
|
1065
867
|
});
|
|
1066
|
-
var
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
868
|
+
var _hasOwnProperty$2 = Object.prototype.hasOwnProperty;
|
|
869
|
+
function resolveYamlSet(data) {
|
|
870
|
+
if (data === null) return true;
|
|
871
|
+
var key, object = data;
|
|
872
|
+
for (key in object) {
|
|
873
|
+
if (_hasOwnProperty$2.call(object, key)) {
|
|
874
|
+
if (object[key] !== null) return false;
|
|
875
|
+
}
|
|
1070
876
|
}
|
|
877
|
+
return true;
|
|
878
|
+
}
|
|
879
|
+
function constructYamlSet(data) {
|
|
880
|
+
return data !== null ? data : {};
|
|
881
|
+
}
|
|
882
|
+
var set = new type("tag:yaml.org,2002:set", {
|
|
883
|
+
kind: "mapping",
|
|
884
|
+
resolve: resolveYamlSet,
|
|
885
|
+
construct: constructYamlSet
|
|
1071
886
|
});
|
|
1072
|
-
var
|
|
887
|
+
var _default = core.extend({
|
|
888
|
+
implicit: [
|
|
889
|
+
timestamp,
|
|
890
|
+
merge
|
|
891
|
+
],
|
|
1073
892
|
explicit: [
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
893
|
+
binary,
|
|
894
|
+
omap,
|
|
895
|
+
pairs,
|
|
896
|
+
set
|
|
1077
897
|
]
|
|
1078
898
|
});
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
899
|
+
var _hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
900
|
+
var CONTEXT_FLOW_IN = 1;
|
|
901
|
+
var CONTEXT_FLOW_OUT = 2;
|
|
902
|
+
var CONTEXT_BLOCK_IN = 3;
|
|
903
|
+
var CONTEXT_BLOCK_OUT = 4;
|
|
904
|
+
var CHOMPING_CLIP = 1;
|
|
905
|
+
var CHOMPING_STRIP = 2;
|
|
906
|
+
var CHOMPING_KEEP = 3;
|
|
907
|
+
var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
|
|
908
|
+
var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
|
|
909
|
+
var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
|
|
910
|
+
var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
|
|
911
|
+
var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
|
|
912
|
+
function _class(obj) {
|
|
913
|
+
return Object.prototype.toString.call(obj);
|
|
1083
914
|
}
|
|
1084
|
-
function
|
|
1085
|
-
return
|
|
915
|
+
function is_EOL(c) {
|
|
916
|
+
return c === 10 || c === 13;
|
|
1086
917
|
}
|
|
1087
|
-
function
|
|
1088
|
-
return
|
|
918
|
+
function is_WHITE_SPACE(c) {
|
|
919
|
+
return c === 9 || c === 32;
|
|
1089
920
|
}
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
resolve: resolveYamlNull,
|
|
1093
|
-
construct: constructYamlNull,
|
|
1094
|
-
predicate: isNull,
|
|
1095
|
-
represent: {
|
|
1096
|
-
canonical: function() {
|
|
1097
|
-
return "~";
|
|
1098
|
-
},
|
|
1099
|
-
lowercase: function() {
|
|
1100
|
-
return "null";
|
|
1101
|
-
},
|
|
1102
|
-
uppercase: function() {
|
|
1103
|
-
return "NULL";
|
|
1104
|
-
},
|
|
1105
|
-
camelcase: function() {
|
|
1106
|
-
return "Null";
|
|
1107
|
-
},
|
|
1108
|
-
empty: function() {
|
|
1109
|
-
return "";
|
|
1110
|
-
}
|
|
1111
|
-
},
|
|
1112
|
-
defaultStyle: "lowercase"
|
|
1113
|
-
});
|
|
1114
|
-
function resolveYamlBoolean(data) {
|
|
1115
|
-
if (data === null) return false;
|
|
1116
|
-
var max = data.length;
|
|
1117
|
-
return max === 4 && (data === "true" || data === "True" || data === "TRUE") || max === 5 && (data === "false" || data === "False" || data === "FALSE");
|
|
921
|
+
function is_WS_OR_EOL(c) {
|
|
922
|
+
return c === 9 || c === 32 || c === 10 || c === 13;
|
|
1118
923
|
}
|
|
1119
|
-
function
|
|
1120
|
-
return
|
|
924
|
+
function is_FLOW_INDICATOR(c) {
|
|
925
|
+
return c === 44 || c === 91 || c === 93 || c === 123 || c === 125;
|
|
1121
926
|
}
|
|
1122
|
-
function
|
|
1123
|
-
|
|
927
|
+
function fromHexCode(c) {
|
|
928
|
+
var lc;
|
|
929
|
+
if (48 <= c && c <= 57) {
|
|
930
|
+
return c - 48;
|
|
931
|
+
}
|
|
932
|
+
lc = c | 32;
|
|
933
|
+
if (97 <= lc && lc <= 102) {
|
|
934
|
+
return lc - 97 + 10;
|
|
935
|
+
}
|
|
936
|
+
return -1;
|
|
1124
937
|
}
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
construct: constructYamlBoolean,
|
|
1129
|
-
predicate: isBoolean,
|
|
1130
|
-
represent: {
|
|
1131
|
-
lowercase: function(object) {
|
|
1132
|
-
return object ? "true" : "false";
|
|
1133
|
-
},
|
|
1134
|
-
uppercase: function(object) {
|
|
1135
|
-
return object ? "TRUE" : "FALSE";
|
|
1136
|
-
},
|
|
1137
|
-
camelcase: function(object) {
|
|
1138
|
-
return object ? "True" : "False";
|
|
1139
|
-
}
|
|
1140
|
-
},
|
|
1141
|
-
defaultStyle: "lowercase"
|
|
1142
|
-
});
|
|
1143
|
-
function isHexCode(c) {
|
|
1144
|
-
return 48 <= c && c <= 57 || 65 <= c && c <= 70 || 97 <= c && c <= 102;
|
|
1145
|
-
}
|
|
1146
|
-
function isOctCode(c) {
|
|
1147
|
-
return 48 <= c && c <= 55;
|
|
1148
|
-
}
|
|
1149
|
-
function isDecCode(c) {
|
|
1150
|
-
return 48 <= c && c <= 57;
|
|
1151
|
-
}
|
|
1152
|
-
function resolveYamlInteger(data) {
|
|
1153
|
-
if (data === null) return false;
|
|
1154
|
-
var max = data.length, index = 0, hasDigits = false, ch;
|
|
1155
|
-
if (!max) return false;
|
|
1156
|
-
ch = data[index];
|
|
1157
|
-
if (ch === "-" || ch === "+") {
|
|
1158
|
-
ch = data[++index];
|
|
938
|
+
function escapedHexLen(c) {
|
|
939
|
+
if (c === 120) {
|
|
940
|
+
return 2;
|
|
1159
941
|
}
|
|
1160
|
-
if (
|
|
1161
|
-
|
|
1162
|
-
ch = data[++index];
|
|
1163
|
-
if (ch === "b") {
|
|
1164
|
-
index++;
|
|
1165
|
-
for (; index < max; index++) {
|
|
1166
|
-
ch = data[index];
|
|
1167
|
-
if (ch === "_") continue;
|
|
1168
|
-
if (ch !== "0" && ch !== "1") return false;
|
|
1169
|
-
hasDigits = true;
|
|
1170
|
-
}
|
|
1171
|
-
return hasDigits && ch !== "_";
|
|
1172
|
-
}
|
|
1173
|
-
if (ch === "x") {
|
|
1174
|
-
index++;
|
|
1175
|
-
for (; index < max; index++) {
|
|
1176
|
-
ch = data[index];
|
|
1177
|
-
if (ch === "_") continue;
|
|
1178
|
-
if (!isHexCode(data.charCodeAt(index))) return false;
|
|
1179
|
-
hasDigits = true;
|
|
1180
|
-
}
|
|
1181
|
-
return hasDigits && ch !== "_";
|
|
1182
|
-
}
|
|
1183
|
-
if (ch === "o") {
|
|
1184
|
-
index++;
|
|
1185
|
-
for (; index < max; index++) {
|
|
1186
|
-
ch = data[index];
|
|
1187
|
-
if (ch === "_") continue;
|
|
1188
|
-
if (!isOctCode(data.charCodeAt(index))) return false;
|
|
1189
|
-
hasDigits = true;
|
|
1190
|
-
}
|
|
1191
|
-
return hasDigits && ch !== "_";
|
|
1192
|
-
}
|
|
942
|
+
if (c === 117) {
|
|
943
|
+
return 4;
|
|
1193
944
|
}
|
|
1194
|
-
if (
|
|
1195
|
-
|
|
1196
|
-
ch = data[index];
|
|
1197
|
-
if (ch === "_") continue;
|
|
1198
|
-
if (!isDecCode(data.charCodeAt(index))) {
|
|
1199
|
-
return false;
|
|
1200
|
-
}
|
|
1201
|
-
hasDigits = true;
|
|
945
|
+
if (c === 85) {
|
|
946
|
+
return 8;
|
|
1202
947
|
}
|
|
1203
|
-
|
|
1204
|
-
return true;
|
|
948
|
+
return 0;
|
|
1205
949
|
}
|
|
1206
|
-
function
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
value = value.replace(/_/g, "");
|
|
1210
|
-
}
|
|
1211
|
-
ch = value[0];
|
|
1212
|
-
if (ch === "-" || ch === "+") {
|
|
1213
|
-
if (ch === "-") sign = -1;
|
|
1214
|
-
value = value.slice(1);
|
|
1215
|
-
ch = value[0];
|
|
1216
|
-
}
|
|
1217
|
-
if (value === "0") return 0;
|
|
1218
|
-
if (ch === "0") {
|
|
1219
|
-
if (value[1] === "b") return sign * parseInt(value.slice(2), 2);
|
|
1220
|
-
if (value[1] === "x") return sign * parseInt(value.slice(2), 16);
|
|
1221
|
-
if (value[1] === "o") return sign * parseInt(value.slice(2), 8);
|
|
950
|
+
function fromDecimalCode(c) {
|
|
951
|
+
if (48 <= c && c <= 57) {
|
|
952
|
+
return c - 48;
|
|
1222
953
|
}
|
|
1223
|
-
return
|
|
954
|
+
return -1;
|
|
1224
955
|
}
|
|
1225
|
-
function
|
|
1226
|
-
return
|
|
956
|
+
function simpleEscapeSequence(c) {
|
|
957
|
+
return c === 48 ? "\0" : c === 97 ? "\x07" : c === 98 ? "\b" : c === 116 ? " " : c === 9 ? " " : c === 110 ? "\n" : c === 118 ? "\v" : c === 102 ? "\f" : c === 114 ? "\r" : c === 101 ? "\x1B" : c === 32 ? " " : c === 34 ? '"' : c === 47 ? "/" : c === 92 ? "\\" : c === 78 ? "\x85" : c === 95 ? "\xA0" : c === 76 ? "\u2028" : c === 80 ? "\u2029" : "";
|
|
1227
958
|
}
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
construct: constructYamlInteger,
|
|
1232
|
-
predicate: isInteger,
|
|
1233
|
-
represent: {
|
|
1234
|
-
binary: function(obj) {
|
|
1235
|
-
return obj >= 0 ? "0b" + obj.toString(2) : "-0b" + obj.toString(2).slice(1);
|
|
1236
|
-
},
|
|
1237
|
-
octal: function(obj) {
|
|
1238
|
-
return obj >= 0 ? "0o" + obj.toString(8) : "-0o" + obj.toString(8).slice(1);
|
|
1239
|
-
},
|
|
1240
|
-
decimal: function(obj) {
|
|
1241
|
-
return obj.toString(10);
|
|
1242
|
-
},
|
|
1243
|
-
/* eslint-disable max-len */
|
|
1244
|
-
hexadecimal: function(obj) {
|
|
1245
|
-
return obj >= 0 ? "0x" + obj.toString(16).toUpperCase() : "-0x" + obj.toString(16).toUpperCase().slice(1);
|
|
1246
|
-
}
|
|
1247
|
-
},
|
|
1248
|
-
defaultStyle: "decimal",
|
|
1249
|
-
styleAliases: {
|
|
1250
|
-
binary: [2, "bin"],
|
|
1251
|
-
octal: [8, "oct"],
|
|
1252
|
-
decimal: [10, "dec"],
|
|
1253
|
-
hexadecimal: [16, "hex"]
|
|
1254
|
-
}
|
|
1255
|
-
});
|
|
1256
|
-
var YAML_FLOAT_PATTERN = new RegExp(
|
|
1257
|
-
// 2.5e4, 2.5 and integers
|
|
1258
|
-
"^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"
|
|
1259
|
-
);
|
|
1260
|
-
function resolveYamlFloat(data) {
|
|
1261
|
-
if (data === null) return false;
|
|
1262
|
-
if (!YAML_FLOAT_PATTERN.test(data) || // Quick hack to not allow integers end with `_`
|
|
1263
|
-
// Probably should update regexp & check speed
|
|
1264
|
-
data[data.length - 1] === "_") {
|
|
1265
|
-
return false;
|
|
959
|
+
function charFromCodepoint(c) {
|
|
960
|
+
if (c <= 65535) {
|
|
961
|
+
return String.fromCharCode(c);
|
|
1266
962
|
}
|
|
1267
|
-
return
|
|
963
|
+
return String.fromCharCode(
|
|
964
|
+
(c - 65536 >> 10) + 55296,
|
|
965
|
+
(c - 65536 & 1023) + 56320
|
|
966
|
+
);
|
|
1268
967
|
}
|
|
1269
|
-
function
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
968
|
+
function setProperty(object, key, value) {
|
|
969
|
+
if (key === "__proto__") {
|
|
970
|
+
Object.defineProperty(object, key, {
|
|
971
|
+
configurable: true,
|
|
972
|
+
enumerable: true,
|
|
973
|
+
writable: true,
|
|
974
|
+
value
|
|
975
|
+
});
|
|
976
|
+
} else {
|
|
977
|
+
object[key] = value;
|
|
1275
978
|
}
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
979
|
+
}
|
|
980
|
+
var simpleEscapeCheck = new Array(256);
|
|
981
|
+
var simpleEscapeMap = new Array(256);
|
|
982
|
+
for (i = 0; i < 256; i++) {
|
|
983
|
+
simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
|
|
984
|
+
simpleEscapeMap[i] = simpleEscapeSequence(i);
|
|
985
|
+
}
|
|
986
|
+
var i;
|
|
987
|
+
function State$1(input, options) {
|
|
988
|
+
this.input = input;
|
|
989
|
+
this.filename = options["filename"] || null;
|
|
990
|
+
this.schema = options["schema"] || _default;
|
|
991
|
+
this.onWarning = options["onWarning"] || null;
|
|
992
|
+
this.legacy = options["legacy"] || false;
|
|
993
|
+
this.json = options["json"] || false;
|
|
994
|
+
this.listener = options["listener"] || null;
|
|
995
|
+
this.implicitTypes = this.schema.compiledImplicit;
|
|
996
|
+
this.typeMap = this.schema.compiledTypeMap;
|
|
997
|
+
this.length = input.length;
|
|
998
|
+
this.position = 0;
|
|
999
|
+
this.line = 0;
|
|
1000
|
+
this.lineStart = 0;
|
|
1001
|
+
this.lineIndent = 0;
|
|
1002
|
+
this.firstTabInLine = -1;
|
|
1003
|
+
this.documents = [];
|
|
1004
|
+
}
|
|
1005
|
+
function generateError(state, message) {
|
|
1006
|
+
var mark = {
|
|
1007
|
+
name: state.filename,
|
|
1008
|
+
buffer: state.input.slice(0, -1),
|
|
1009
|
+
// omit trailing \0
|
|
1010
|
+
position: state.position,
|
|
1011
|
+
line: state.line,
|
|
1012
|
+
column: state.position - state.lineStart
|
|
1013
|
+
};
|
|
1014
|
+
mark.snippet = snippet(mark);
|
|
1015
|
+
return new exception(message, mark);
|
|
1016
|
+
}
|
|
1017
|
+
function throwError(state, message) {
|
|
1018
|
+
throw generateError(state, message);
|
|
1019
|
+
}
|
|
1020
|
+
function throwWarning(state, message) {
|
|
1021
|
+
if (state.onWarning) {
|
|
1022
|
+
state.onWarning.call(null, generateError(state, message));
|
|
1280
1023
|
}
|
|
1281
|
-
return sign * parseFloat(value, 10);
|
|
1282
1024
|
}
|
|
1283
|
-
var
|
|
1284
|
-
function
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
case "lowercase":
|
|
1289
|
-
return ".nan";
|
|
1290
|
-
case "uppercase":
|
|
1291
|
-
return ".NAN";
|
|
1292
|
-
case "camelcase":
|
|
1293
|
-
return ".NaN";
|
|
1025
|
+
var directiveHandlers = {
|
|
1026
|
+
YAML: function handleYamlDirective(state, name, args) {
|
|
1027
|
+
var match, major, minor;
|
|
1028
|
+
if (state.version !== null) {
|
|
1029
|
+
throwError(state, "duplication of %YAML directive");
|
|
1294
1030
|
}
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
case "lowercase":
|
|
1298
|
-
return ".inf";
|
|
1299
|
-
case "uppercase":
|
|
1300
|
-
return ".INF";
|
|
1301
|
-
case "camelcase":
|
|
1302
|
-
return ".Inf";
|
|
1031
|
+
if (args.length !== 1) {
|
|
1032
|
+
throwError(state, "YAML directive accepts exactly one argument");
|
|
1303
1033
|
}
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
return "-.inf";
|
|
1308
|
-
case "uppercase":
|
|
1309
|
-
return "-.INF";
|
|
1310
|
-
case "camelcase":
|
|
1311
|
-
return "-.Inf";
|
|
1034
|
+
match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
|
|
1035
|
+
if (match === null) {
|
|
1036
|
+
throwError(state, "ill-formed argument of the YAML directive");
|
|
1312
1037
|
}
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res;
|
|
1318
|
-
}
|
|
1319
|
-
function isFloat(object) {
|
|
1320
|
-
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || common.isNegativeZero(object));
|
|
1321
|
-
}
|
|
1322
|
-
var float = new type("tag:yaml.org,2002:float", {
|
|
1323
|
-
kind: "scalar",
|
|
1324
|
-
resolve: resolveYamlFloat,
|
|
1325
|
-
construct: constructYamlFloat,
|
|
1326
|
-
predicate: isFloat,
|
|
1327
|
-
represent: representYamlFloat,
|
|
1328
|
-
defaultStyle: "lowercase"
|
|
1329
|
-
});
|
|
1330
|
-
var json = failsafe.extend({
|
|
1331
|
-
implicit: [
|
|
1332
|
-
_null,
|
|
1333
|
-
bool,
|
|
1334
|
-
int,
|
|
1335
|
-
float
|
|
1336
|
-
]
|
|
1337
|
-
});
|
|
1338
|
-
var core = json;
|
|
1339
|
-
var YAML_DATE_REGEXP = new RegExp(
|
|
1340
|
-
"^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"
|
|
1341
|
-
);
|
|
1342
|
-
var YAML_TIMESTAMP_REGEXP = new RegExp(
|
|
1343
|
-
"^([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]))?))?$"
|
|
1344
|
-
);
|
|
1345
|
-
function resolveYamlTimestamp(data) {
|
|
1346
|
-
if (data === null) return false;
|
|
1347
|
-
if (YAML_DATE_REGEXP.exec(data) !== null) return true;
|
|
1348
|
-
if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true;
|
|
1349
|
-
return false;
|
|
1350
|
-
}
|
|
1351
|
-
function constructYamlTimestamp(data) {
|
|
1352
|
-
var match, year, month, day, hour, minute, second, fraction = 0, delta = null, tz_hour, tz_minute, date;
|
|
1353
|
-
match = YAML_DATE_REGEXP.exec(data);
|
|
1354
|
-
if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data);
|
|
1355
|
-
if (match === null) throw new Error("Date resolve error");
|
|
1356
|
-
year = +match[1];
|
|
1357
|
-
month = +match[2] - 1;
|
|
1358
|
-
day = +match[3];
|
|
1359
|
-
if (!match[4]) {
|
|
1360
|
-
return new Date(Date.UTC(year, month, day));
|
|
1361
|
-
}
|
|
1362
|
-
hour = +match[4];
|
|
1363
|
-
minute = +match[5];
|
|
1364
|
-
second = +match[6];
|
|
1365
|
-
if (match[7]) {
|
|
1366
|
-
fraction = match[7].slice(0, 3);
|
|
1367
|
-
while (fraction.length < 3) {
|
|
1368
|
-
fraction += "0";
|
|
1038
|
+
major = parseInt(match[1], 10);
|
|
1039
|
+
minor = parseInt(match[2], 10);
|
|
1040
|
+
if (major !== 1) {
|
|
1041
|
+
throwError(state, "unacceptable YAML version of the document");
|
|
1369
1042
|
}
|
|
1370
|
-
|
|
1043
|
+
state.version = args[0];
|
|
1044
|
+
state.checkLineBreaks = minor < 2;
|
|
1045
|
+
if (minor !== 1 && minor !== 2) {
|
|
1046
|
+
throwWarning(state, "unsupported YAML version of the document");
|
|
1047
|
+
}
|
|
1048
|
+
},
|
|
1049
|
+
TAG: function handleTagDirective(state, name, args) {
|
|
1050
|
+
var handle, prefix;
|
|
1051
|
+
if (args.length !== 2) {
|
|
1052
|
+
throwError(state, "TAG directive accepts exactly two arguments");
|
|
1053
|
+
}
|
|
1054
|
+
handle = args[0];
|
|
1055
|
+
prefix = args[1];
|
|
1056
|
+
if (!PATTERN_TAG_HANDLE.test(handle)) {
|
|
1057
|
+
throwError(state, "ill-formed tag handle (first argument) of the TAG directive");
|
|
1058
|
+
}
|
|
1059
|
+
if (_hasOwnProperty$1.call(state.tagMap, handle)) {
|
|
1060
|
+
throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
|
|
1061
|
+
}
|
|
1062
|
+
if (!PATTERN_TAG_URI.test(prefix)) {
|
|
1063
|
+
throwError(state, "ill-formed tag prefix (second argument) of the TAG directive");
|
|
1064
|
+
}
|
|
1065
|
+
try {
|
|
1066
|
+
prefix = decodeURIComponent(prefix);
|
|
1067
|
+
} catch (err) {
|
|
1068
|
+
throwError(state, "tag prefix is malformed: " + prefix);
|
|
1069
|
+
}
|
|
1070
|
+
state.tagMap[handle] = prefix;
|
|
1371
1071
|
}
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1072
|
+
};
|
|
1073
|
+
function captureSegment(state, start, end, checkJson) {
|
|
1074
|
+
var _position, _length, _character, _result;
|
|
1075
|
+
if (start < end) {
|
|
1076
|
+
_result = state.input.slice(start, end);
|
|
1077
|
+
if (checkJson) {
|
|
1078
|
+
for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
|
|
1079
|
+
_character = _result.charCodeAt(_position);
|
|
1080
|
+
if (!(_character === 9 || 32 <= _character && _character <= 1114111)) {
|
|
1081
|
+
throwError(state, "expected valid JSON character");
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
} else if (PATTERN_NON_PRINTABLE.test(_result)) {
|
|
1085
|
+
throwError(state, "the stream contains non-printable characters");
|
|
1086
|
+
}
|
|
1087
|
+
state.result += _result;
|
|
1377
1088
|
}
|
|
1378
|
-
date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
|
|
1379
|
-
if (delta) date.setTime(date.getTime() - delta);
|
|
1380
|
-
return date;
|
|
1381
|
-
}
|
|
1382
|
-
function representYamlTimestamp(object) {
|
|
1383
|
-
return object.toISOString();
|
|
1384
|
-
}
|
|
1385
|
-
var timestamp = new type("tag:yaml.org,2002:timestamp", {
|
|
1386
|
-
kind: "scalar",
|
|
1387
|
-
resolve: resolveYamlTimestamp,
|
|
1388
|
-
construct: constructYamlTimestamp,
|
|
1389
|
-
instanceOf: Date,
|
|
1390
|
-
represent: representYamlTimestamp
|
|
1391
|
-
});
|
|
1392
|
-
function resolveYamlMerge(data) {
|
|
1393
|
-
return data === "<<" || data === null;
|
|
1394
1089
|
}
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
var BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";
|
|
1400
|
-
function resolveYamlBinary(data) {
|
|
1401
|
-
if (data === null) return false;
|
|
1402
|
-
var code, idx, bitlen = 0, max = data.length, map2 = BASE64_MAP;
|
|
1403
|
-
for (idx = 0; idx < max; idx++) {
|
|
1404
|
-
code = map2.indexOf(data.charAt(idx));
|
|
1405
|
-
if (code > 64) continue;
|
|
1406
|
-
if (code < 0) return false;
|
|
1407
|
-
bitlen += 6;
|
|
1090
|
+
function mergeMappings(state, destination, source, overridableKeys) {
|
|
1091
|
+
var sourceKeys, key, index, quantity;
|
|
1092
|
+
if (!common.isObject(source)) {
|
|
1093
|
+
throwError(state, "cannot merge mappings; the provided source object is unacceptable");
|
|
1408
1094
|
}
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
result.push(bits >> 16 & 255);
|
|
1416
|
-
result.push(bits >> 8 & 255);
|
|
1417
|
-
result.push(bits & 255);
|
|
1095
|
+
sourceKeys = Object.keys(source);
|
|
1096
|
+
for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
|
|
1097
|
+
key = sourceKeys[index];
|
|
1098
|
+
if (!_hasOwnProperty$1.call(destination, key)) {
|
|
1099
|
+
setProperty(destination, key, source[key]);
|
|
1100
|
+
overridableKeys[key] = true;
|
|
1418
1101
|
}
|
|
1419
|
-
bits = bits << 6 | map2.indexOf(input.charAt(idx));
|
|
1420
|
-
}
|
|
1421
|
-
tailbits = max % 4 * 6;
|
|
1422
|
-
if (tailbits === 0) {
|
|
1423
|
-
result.push(bits >> 16 & 255);
|
|
1424
|
-
result.push(bits >> 8 & 255);
|
|
1425
|
-
result.push(bits & 255);
|
|
1426
|
-
} else if (tailbits === 18) {
|
|
1427
|
-
result.push(bits >> 10 & 255);
|
|
1428
|
-
result.push(bits >> 2 & 255);
|
|
1429
|
-
} else if (tailbits === 12) {
|
|
1430
|
-
result.push(bits >> 4 & 255);
|
|
1431
1102
|
}
|
|
1432
|
-
return new Uint8Array(result);
|
|
1433
1103
|
}
|
|
1434
|
-
function
|
|
1435
|
-
var
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1104
|
+
function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startLineStart, startPos) {
|
|
1105
|
+
var index, quantity;
|
|
1106
|
+
if (Array.isArray(keyNode)) {
|
|
1107
|
+
keyNode = Array.prototype.slice.call(keyNode);
|
|
1108
|
+
for (index = 0, quantity = keyNode.length; index < quantity; index += 1) {
|
|
1109
|
+
if (Array.isArray(keyNode[index])) {
|
|
1110
|
+
throwError(state, "nested arrays are not supported inside keys");
|
|
1111
|
+
}
|
|
1112
|
+
if (typeof keyNode === "object" && _class(keyNode[index]) === "[object Object]") {
|
|
1113
|
+
keyNode[index] = "[object Object]";
|
|
1114
|
+
}
|
|
1442
1115
|
}
|
|
1443
|
-
bits = (bits << 8) + object[idx];
|
|
1444
1116
|
}
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
result += map2[bits >> 18 & 63];
|
|
1448
|
-
result += map2[bits >> 12 & 63];
|
|
1449
|
-
result += map2[bits >> 6 & 63];
|
|
1450
|
-
result += map2[bits & 63];
|
|
1451
|
-
} else if (tail === 2) {
|
|
1452
|
-
result += map2[bits >> 10 & 63];
|
|
1453
|
-
result += map2[bits >> 4 & 63];
|
|
1454
|
-
result += map2[bits << 2 & 63];
|
|
1455
|
-
result += map2[64];
|
|
1456
|
-
} else if (tail === 1) {
|
|
1457
|
-
result += map2[bits >> 2 & 63];
|
|
1458
|
-
result += map2[bits << 4 & 63];
|
|
1459
|
-
result += map2[64];
|
|
1460
|
-
result += map2[64];
|
|
1117
|
+
if (typeof keyNode === "object" && _class(keyNode) === "[object Object]") {
|
|
1118
|
+
keyNode = "[object Object]";
|
|
1461
1119
|
}
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
construct: constructYamlBinary,
|
|
1471
|
-
predicate: isBinary,
|
|
1472
|
-
represent: representYamlBinary
|
|
1473
|
-
});
|
|
1474
|
-
var _hasOwnProperty$3 = Object.prototype.hasOwnProperty;
|
|
1475
|
-
var _toString$2 = Object.prototype.toString;
|
|
1476
|
-
function resolveYamlOmap(data) {
|
|
1477
|
-
if (data === null) return true;
|
|
1478
|
-
var objectKeys = [], index, length, pair, pairKey, pairHasKey, object = data;
|
|
1479
|
-
for (index = 0, length = object.length; index < length; index += 1) {
|
|
1480
|
-
pair = object[index];
|
|
1481
|
-
pairHasKey = false;
|
|
1482
|
-
if (_toString$2.call(pair) !== "[object Object]") return false;
|
|
1483
|
-
for (pairKey in pair) {
|
|
1484
|
-
if (_hasOwnProperty$3.call(pair, pairKey)) {
|
|
1485
|
-
if (!pairHasKey) pairHasKey = true;
|
|
1486
|
-
else return false;
|
|
1120
|
+
keyNode = String(keyNode);
|
|
1121
|
+
if (_result === null) {
|
|
1122
|
+
_result = {};
|
|
1123
|
+
}
|
|
1124
|
+
if (keyTag === "tag:yaml.org,2002:merge") {
|
|
1125
|
+
if (Array.isArray(valueNode)) {
|
|
1126
|
+
for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
|
|
1127
|
+
mergeMappings(state, _result, valueNode[index], overridableKeys);
|
|
1487
1128
|
}
|
|
1129
|
+
} else {
|
|
1130
|
+
mergeMappings(state, _result, valueNode, overridableKeys);
|
|
1488
1131
|
}
|
|
1489
|
-
|
|
1490
|
-
if (
|
|
1491
|
-
|
|
1132
|
+
} else {
|
|
1133
|
+
if (!state.json && !_hasOwnProperty$1.call(overridableKeys, keyNode) && _hasOwnProperty$1.call(_result, keyNode)) {
|
|
1134
|
+
state.line = startLine || state.line;
|
|
1135
|
+
state.lineStart = startLineStart || state.lineStart;
|
|
1136
|
+
state.position = startPos || state.position;
|
|
1137
|
+
throwError(state, "duplicated mapping key");
|
|
1138
|
+
}
|
|
1139
|
+
setProperty(_result, keyNode, valueNode);
|
|
1140
|
+
delete overridableKeys[keyNode];
|
|
1492
1141
|
}
|
|
1493
|
-
return
|
|
1142
|
+
return _result;
|
|
1494
1143
|
}
|
|
1495
|
-
function
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
result = new Array(object.length);
|
|
1508
|
-
for (index = 0, length = object.length; index < length; index += 1) {
|
|
1509
|
-
pair = object[index];
|
|
1510
|
-
if (_toString$1.call(pair) !== "[object Object]") return false;
|
|
1511
|
-
keys = Object.keys(pair);
|
|
1512
|
-
if (keys.length !== 1) return false;
|
|
1513
|
-
result[index] = [keys[0], pair[keys[0]]];
|
|
1144
|
+
function readLineBreak(state) {
|
|
1145
|
+
var ch;
|
|
1146
|
+
ch = state.input.charCodeAt(state.position);
|
|
1147
|
+
if (ch === 10) {
|
|
1148
|
+
state.position++;
|
|
1149
|
+
} else if (ch === 13) {
|
|
1150
|
+
state.position++;
|
|
1151
|
+
if (state.input.charCodeAt(state.position) === 10) {
|
|
1152
|
+
state.position++;
|
|
1153
|
+
}
|
|
1154
|
+
} else {
|
|
1155
|
+
throwError(state, "a line break is expected");
|
|
1514
1156
|
}
|
|
1515
|
-
|
|
1157
|
+
state.line += 1;
|
|
1158
|
+
state.lineStart = state.position;
|
|
1159
|
+
state.firstTabInLine = -1;
|
|
1516
1160
|
}
|
|
1517
|
-
function
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1161
|
+
function skipSeparationSpace(state, allowComments, checkIndent) {
|
|
1162
|
+
var lineBreaks = 0, ch = state.input.charCodeAt(state.position);
|
|
1163
|
+
while (ch !== 0) {
|
|
1164
|
+
while (is_WHITE_SPACE(ch)) {
|
|
1165
|
+
if (ch === 9 && state.firstTabInLine === -1) {
|
|
1166
|
+
state.firstTabInLine = state.position;
|
|
1167
|
+
}
|
|
1168
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1169
|
+
}
|
|
1170
|
+
if (allowComments && ch === 35) {
|
|
1171
|
+
do {
|
|
1172
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1173
|
+
} while (ch !== 10 && ch !== 13 && ch !== 0);
|
|
1174
|
+
}
|
|
1175
|
+
if (is_EOL(ch)) {
|
|
1176
|
+
readLineBreak(state);
|
|
1177
|
+
ch = state.input.charCodeAt(state.position);
|
|
1178
|
+
lineBreaks++;
|
|
1179
|
+
state.lineIndent = 0;
|
|
1180
|
+
while (ch === 32) {
|
|
1181
|
+
state.lineIndent++;
|
|
1182
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1183
|
+
}
|
|
1184
|
+
} else {
|
|
1185
|
+
break;
|
|
1186
|
+
}
|
|
1525
1187
|
}
|
|
1526
|
-
|
|
1188
|
+
if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {
|
|
1189
|
+
throwWarning(state, "deficient indentation");
|
|
1190
|
+
}
|
|
1191
|
+
return lineBreaks;
|
|
1527
1192
|
}
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
var key, object = data;
|
|
1537
|
-
for (key in object) {
|
|
1538
|
-
if (_hasOwnProperty$2.call(object, key)) {
|
|
1539
|
-
if (object[key] !== null) return false;
|
|
1193
|
+
function testDocumentSeparator(state) {
|
|
1194
|
+
var _position = state.position, ch;
|
|
1195
|
+
ch = state.input.charCodeAt(_position);
|
|
1196
|
+
if ((ch === 45 || ch === 46) && ch === state.input.charCodeAt(_position + 1) && ch === state.input.charCodeAt(_position + 2)) {
|
|
1197
|
+
_position += 3;
|
|
1198
|
+
ch = state.input.charCodeAt(_position);
|
|
1199
|
+
if (ch === 0 || is_WS_OR_EOL(ch)) {
|
|
1200
|
+
return true;
|
|
1540
1201
|
}
|
|
1541
1202
|
}
|
|
1542
|
-
return
|
|
1543
|
-
}
|
|
1544
|
-
function constructYamlSet(data) {
|
|
1545
|
-
return data !== null ? data : {};
|
|
1546
|
-
}
|
|
1547
|
-
var set = new type("tag:yaml.org,2002:set", {
|
|
1548
|
-
kind: "mapping",
|
|
1549
|
-
resolve: resolveYamlSet,
|
|
1550
|
-
construct: constructYamlSet
|
|
1551
|
-
});
|
|
1552
|
-
var _default = core.extend({
|
|
1553
|
-
implicit: [
|
|
1554
|
-
timestamp,
|
|
1555
|
-
merge
|
|
1556
|
-
],
|
|
1557
|
-
explicit: [
|
|
1558
|
-
binary,
|
|
1559
|
-
omap,
|
|
1560
|
-
pairs,
|
|
1561
|
-
set
|
|
1562
|
-
]
|
|
1563
|
-
});
|
|
1564
|
-
var _hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
1565
|
-
var CONTEXT_FLOW_IN = 1;
|
|
1566
|
-
var CONTEXT_FLOW_OUT = 2;
|
|
1567
|
-
var CONTEXT_BLOCK_IN = 3;
|
|
1568
|
-
var CONTEXT_BLOCK_OUT = 4;
|
|
1569
|
-
var CHOMPING_CLIP = 1;
|
|
1570
|
-
var CHOMPING_STRIP = 2;
|
|
1571
|
-
var CHOMPING_KEEP = 3;
|
|
1572
|
-
var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
|
|
1573
|
-
var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
|
|
1574
|
-
var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
|
|
1575
|
-
var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
|
|
1576
|
-
var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
|
|
1577
|
-
function _class(obj) {
|
|
1578
|
-
return Object.prototype.toString.call(obj);
|
|
1579
|
-
}
|
|
1580
|
-
function is_EOL(c) {
|
|
1581
|
-
return c === 10 || c === 13;
|
|
1582
|
-
}
|
|
1583
|
-
function is_WHITE_SPACE(c) {
|
|
1584
|
-
return c === 9 || c === 32;
|
|
1585
|
-
}
|
|
1586
|
-
function is_WS_OR_EOL(c) {
|
|
1587
|
-
return c === 9 || c === 32 || c === 10 || c === 13;
|
|
1588
|
-
}
|
|
1589
|
-
function is_FLOW_INDICATOR(c) {
|
|
1590
|
-
return c === 44 || c === 91 || c === 93 || c === 123 || c === 125;
|
|
1203
|
+
return false;
|
|
1591
1204
|
}
|
|
1592
|
-
function
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
lc = c | 32;
|
|
1598
|
-
if (97 <= lc && lc <= 102) {
|
|
1599
|
-
return lc - 97 + 10;
|
|
1205
|
+
function writeFoldedLines(state, count) {
|
|
1206
|
+
if (count === 1) {
|
|
1207
|
+
state.result += " ";
|
|
1208
|
+
} else if (count > 1) {
|
|
1209
|
+
state.result += common.repeat("\n", count - 1);
|
|
1600
1210
|
}
|
|
1601
|
-
return -1;
|
|
1602
1211
|
}
|
|
1603
|
-
function
|
|
1604
|
-
|
|
1605
|
-
|
|
1212
|
+
function readPlainScalar(state, nodeIndent, withinFlowCollection) {
|
|
1213
|
+
var preceding, following, captureStart, captureEnd, hasPendingContent, _line, _lineStart, _lineIndent, _kind = state.kind, _result = state.result, ch;
|
|
1214
|
+
ch = state.input.charCodeAt(state.position);
|
|
1215
|
+
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) {
|
|
1216
|
+
return false;
|
|
1606
1217
|
}
|
|
1607
|
-
if (
|
|
1608
|
-
|
|
1218
|
+
if (ch === 63 || ch === 45) {
|
|
1219
|
+
following = state.input.charCodeAt(state.position + 1);
|
|
1220
|
+
if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
|
|
1221
|
+
return false;
|
|
1222
|
+
}
|
|
1609
1223
|
}
|
|
1610
|
-
|
|
1611
|
-
|
|
1224
|
+
state.kind = "scalar";
|
|
1225
|
+
state.result = "";
|
|
1226
|
+
captureStart = captureEnd = state.position;
|
|
1227
|
+
hasPendingContent = false;
|
|
1228
|
+
while (ch !== 0) {
|
|
1229
|
+
if (ch === 58) {
|
|
1230
|
+
following = state.input.charCodeAt(state.position + 1);
|
|
1231
|
+
if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
|
|
1232
|
+
break;
|
|
1233
|
+
}
|
|
1234
|
+
} else if (ch === 35) {
|
|
1235
|
+
preceding = state.input.charCodeAt(state.position - 1);
|
|
1236
|
+
if (is_WS_OR_EOL(preceding)) {
|
|
1237
|
+
break;
|
|
1238
|
+
}
|
|
1239
|
+
} else if (state.position === state.lineStart && testDocumentSeparator(state) || withinFlowCollection && is_FLOW_INDICATOR(ch)) {
|
|
1240
|
+
break;
|
|
1241
|
+
} else if (is_EOL(ch)) {
|
|
1242
|
+
_line = state.line;
|
|
1243
|
+
_lineStart = state.lineStart;
|
|
1244
|
+
_lineIndent = state.lineIndent;
|
|
1245
|
+
skipSeparationSpace(state, false, -1);
|
|
1246
|
+
if (state.lineIndent >= nodeIndent) {
|
|
1247
|
+
hasPendingContent = true;
|
|
1248
|
+
ch = state.input.charCodeAt(state.position);
|
|
1249
|
+
continue;
|
|
1250
|
+
} else {
|
|
1251
|
+
state.position = captureEnd;
|
|
1252
|
+
state.line = _line;
|
|
1253
|
+
state.lineStart = _lineStart;
|
|
1254
|
+
state.lineIndent = _lineIndent;
|
|
1255
|
+
break;
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
if (hasPendingContent) {
|
|
1259
|
+
captureSegment(state, captureStart, captureEnd, false);
|
|
1260
|
+
writeFoldedLines(state, state.line - _line);
|
|
1261
|
+
captureStart = captureEnd = state.position;
|
|
1262
|
+
hasPendingContent = false;
|
|
1263
|
+
}
|
|
1264
|
+
if (!is_WHITE_SPACE(ch)) {
|
|
1265
|
+
captureEnd = state.position + 1;
|
|
1266
|
+
}
|
|
1267
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1612
1268
|
}
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
if (48 <= c && c <= 57) {
|
|
1617
|
-
return c - 48;
|
|
1269
|
+
captureSegment(state, captureStart, captureEnd, false);
|
|
1270
|
+
if (state.result) {
|
|
1271
|
+
return true;
|
|
1618
1272
|
}
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
return c === 48 ? "\0" : c === 97 ? "\x07" : c === 98 ? "\b" : c === 116 ? " " : c === 9 ? " " : c === 110 ? "\n" : c === 118 ? "\v" : c === 102 ? "\f" : c === 114 ? "\r" : c === 101 ? "\x1B" : c === 32 ? " " : c === 34 ? '"' : c === 47 ? "/" : c === 92 ? "\\" : c === 78 ? "\x85" : c === 95 ? "\xA0" : c === 76 ? "\u2028" : c === 80 ? "\u2029" : "";
|
|
1273
|
+
state.kind = _kind;
|
|
1274
|
+
state.result = _result;
|
|
1275
|
+
return false;
|
|
1623
1276
|
}
|
|
1624
|
-
function
|
|
1625
|
-
|
|
1626
|
-
|
|
1277
|
+
function readSingleQuotedScalar(state, nodeIndent) {
|
|
1278
|
+
var ch, captureStart, captureEnd;
|
|
1279
|
+
ch = state.input.charCodeAt(state.position);
|
|
1280
|
+
if (ch !== 39) {
|
|
1281
|
+
return false;
|
|
1627
1282
|
}
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
object[key] = value;
|
|
1643
|
-
}
|
|
1644
|
-
}
|
|
1645
|
-
var simpleEscapeCheck = new Array(256);
|
|
1646
|
-
var simpleEscapeMap = new Array(256);
|
|
1647
|
-
for (i = 0; i < 256; i++) {
|
|
1648
|
-
simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
|
|
1649
|
-
simpleEscapeMap[i] = simpleEscapeSequence(i);
|
|
1650
|
-
}
|
|
1651
|
-
var i;
|
|
1652
|
-
function State$1(input, options) {
|
|
1653
|
-
this.input = input;
|
|
1654
|
-
this.filename = options["filename"] || null;
|
|
1655
|
-
this.schema = options["schema"] || _default;
|
|
1656
|
-
this.onWarning = options["onWarning"] || null;
|
|
1657
|
-
this.legacy = options["legacy"] || false;
|
|
1658
|
-
this.json = options["json"] || false;
|
|
1659
|
-
this.listener = options["listener"] || null;
|
|
1660
|
-
this.implicitTypes = this.schema.compiledImplicit;
|
|
1661
|
-
this.typeMap = this.schema.compiledTypeMap;
|
|
1662
|
-
this.length = input.length;
|
|
1663
|
-
this.position = 0;
|
|
1664
|
-
this.line = 0;
|
|
1665
|
-
this.lineStart = 0;
|
|
1666
|
-
this.lineIndent = 0;
|
|
1667
|
-
this.firstTabInLine = -1;
|
|
1668
|
-
this.documents = [];
|
|
1669
|
-
}
|
|
1670
|
-
function generateError(state, message) {
|
|
1671
|
-
var mark = {
|
|
1672
|
-
name: state.filename,
|
|
1673
|
-
buffer: state.input.slice(0, -1),
|
|
1674
|
-
// omit trailing \0
|
|
1675
|
-
position: state.position,
|
|
1676
|
-
line: state.line,
|
|
1677
|
-
column: state.position - state.lineStart
|
|
1678
|
-
};
|
|
1679
|
-
mark.snippet = snippet(mark);
|
|
1680
|
-
return new exception(message, mark);
|
|
1681
|
-
}
|
|
1682
|
-
function throwError(state, message) {
|
|
1683
|
-
throw generateError(state, message);
|
|
1684
|
-
}
|
|
1685
|
-
function throwWarning(state, message) {
|
|
1686
|
-
if (state.onWarning) {
|
|
1687
|
-
state.onWarning.call(null, generateError(state, message));
|
|
1688
|
-
}
|
|
1689
|
-
}
|
|
1690
|
-
var directiveHandlers = {
|
|
1691
|
-
YAML: function handleYamlDirective(state, name, args) {
|
|
1692
|
-
var match, major, minor;
|
|
1693
|
-
if (state.version !== null) {
|
|
1694
|
-
throwError(state, "duplication of %YAML directive");
|
|
1695
|
-
}
|
|
1696
|
-
if (args.length !== 1) {
|
|
1697
|
-
throwError(state, "YAML directive accepts exactly one argument");
|
|
1698
|
-
}
|
|
1699
|
-
match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
|
|
1700
|
-
if (match === null) {
|
|
1701
|
-
throwError(state, "ill-formed argument of the YAML directive");
|
|
1702
|
-
}
|
|
1703
|
-
major = parseInt(match[1], 10);
|
|
1704
|
-
minor = parseInt(match[2], 10);
|
|
1705
|
-
if (major !== 1) {
|
|
1706
|
-
throwError(state, "unacceptable YAML version of the document");
|
|
1707
|
-
}
|
|
1708
|
-
state.version = args[0];
|
|
1709
|
-
state.checkLineBreaks = minor < 2;
|
|
1710
|
-
if (minor !== 1 && minor !== 2) {
|
|
1711
|
-
throwWarning(state, "unsupported YAML version of the document");
|
|
1712
|
-
}
|
|
1713
|
-
},
|
|
1714
|
-
TAG: function handleTagDirective(state, name, args) {
|
|
1715
|
-
var handle, prefix;
|
|
1716
|
-
if (args.length !== 2) {
|
|
1717
|
-
throwError(state, "TAG directive accepts exactly two arguments");
|
|
1718
|
-
}
|
|
1719
|
-
handle = args[0];
|
|
1720
|
-
prefix = args[1];
|
|
1721
|
-
if (!PATTERN_TAG_HANDLE.test(handle)) {
|
|
1722
|
-
throwError(state, "ill-formed tag handle (first argument) of the TAG directive");
|
|
1723
|
-
}
|
|
1724
|
-
if (_hasOwnProperty$1.call(state.tagMap, handle)) {
|
|
1725
|
-
throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
|
|
1726
|
-
}
|
|
1727
|
-
if (!PATTERN_TAG_URI.test(prefix)) {
|
|
1728
|
-
throwError(state, "ill-formed tag prefix (second argument) of the TAG directive");
|
|
1729
|
-
}
|
|
1730
|
-
try {
|
|
1731
|
-
prefix = decodeURIComponent(prefix);
|
|
1732
|
-
} catch (err) {
|
|
1733
|
-
throwError(state, "tag prefix is malformed: " + prefix);
|
|
1734
|
-
}
|
|
1735
|
-
state.tagMap[handle] = prefix;
|
|
1736
|
-
}
|
|
1737
|
-
};
|
|
1738
|
-
function captureSegment(state, start, end, checkJson) {
|
|
1739
|
-
var _position, _length, _character, _result;
|
|
1740
|
-
if (start < end) {
|
|
1741
|
-
_result = state.input.slice(start, end);
|
|
1742
|
-
if (checkJson) {
|
|
1743
|
-
for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
|
|
1744
|
-
_character = _result.charCodeAt(_position);
|
|
1745
|
-
if (!(_character === 9 || 32 <= _character && _character <= 1114111)) {
|
|
1746
|
-
throwError(state, "expected valid JSON character");
|
|
1747
|
-
}
|
|
1283
|
+
state.kind = "scalar";
|
|
1284
|
+
state.result = "";
|
|
1285
|
+
state.position++;
|
|
1286
|
+
captureStart = captureEnd = state.position;
|
|
1287
|
+
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
1288
|
+
if (ch === 39) {
|
|
1289
|
+
captureSegment(state, captureStart, state.position, true);
|
|
1290
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1291
|
+
if (ch === 39) {
|
|
1292
|
+
captureStart = state.position;
|
|
1293
|
+
state.position++;
|
|
1294
|
+
captureEnd = state.position;
|
|
1295
|
+
} else {
|
|
1296
|
+
return true;
|
|
1748
1297
|
}
|
|
1749
|
-
} else if (
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
throwError(state, "cannot merge mappings; the provided source object is unacceptable");
|
|
1759
|
-
}
|
|
1760
|
-
sourceKeys = Object.keys(source);
|
|
1761
|
-
for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
|
|
1762
|
-
key = sourceKeys[index];
|
|
1763
|
-
if (!_hasOwnProperty$1.call(destination, key)) {
|
|
1764
|
-
setProperty(destination, key, source[key]);
|
|
1765
|
-
overridableKeys[key] = true;
|
|
1298
|
+
} else if (is_EOL(ch)) {
|
|
1299
|
+
captureSegment(state, captureStart, captureEnd, true);
|
|
1300
|
+
writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
|
|
1301
|
+
captureStart = captureEnd = state.position;
|
|
1302
|
+
} else if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
1303
|
+
throwError(state, "unexpected end of the document within a single quoted scalar");
|
|
1304
|
+
} else {
|
|
1305
|
+
state.position++;
|
|
1306
|
+
captureEnd = state.position;
|
|
1766
1307
|
}
|
|
1767
1308
|
}
|
|
1309
|
+
throwError(state, "unexpected end of the stream within a single quoted scalar");
|
|
1768
1310
|
}
|
|
1769
|
-
function
|
|
1770
|
-
var
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
if (Array.isArray(keyNode[index])) {
|
|
1775
|
-
throwError(state, "nested arrays are not supported inside keys");
|
|
1776
|
-
}
|
|
1777
|
-
if (typeof keyNode === "object" && _class(keyNode[index]) === "[object Object]") {
|
|
1778
|
-
keyNode[index] = "[object Object]";
|
|
1779
|
-
}
|
|
1780
|
-
}
|
|
1781
|
-
}
|
|
1782
|
-
if (typeof keyNode === "object" && _class(keyNode) === "[object Object]") {
|
|
1783
|
-
keyNode = "[object Object]";
|
|
1784
|
-
}
|
|
1785
|
-
keyNode = String(keyNode);
|
|
1786
|
-
if (_result === null) {
|
|
1787
|
-
_result = {};
|
|
1311
|
+
function readDoubleQuotedScalar(state, nodeIndent) {
|
|
1312
|
+
var captureStart, captureEnd, hexLength, hexResult, tmp, ch;
|
|
1313
|
+
ch = state.input.charCodeAt(state.position);
|
|
1314
|
+
if (ch !== 34) {
|
|
1315
|
+
return false;
|
|
1788
1316
|
}
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1317
|
+
state.kind = "scalar";
|
|
1318
|
+
state.result = "";
|
|
1319
|
+
state.position++;
|
|
1320
|
+
captureStart = captureEnd = state.position;
|
|
1321
|
+
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
1322
|
+
if (ch === 34) {
|
|
1323
|
+
captureSegment(state, captureStart, state.position, true);
|
|
1324
|
+
state.position++;
|
|
1325
|
+
return true;
|
|
1326
|
+
} else if (ch === 92) {
|
|
1327
|
+
captureSegment(state, captureStart, state.position, true);
|
|
1328
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1329
|
+
if (is_EOL(ch)) {
|
|
1330
|
+
skipSeparationSpace(state, false, nodeIndent);
|
|
1331
|
+
} else if (ch < 256 && simpleEscapeCheck[ch]) {
|
|
1332
|
+
state.result += simpleEscapeMap[ch];
|
|
1333
|
+
state.position++;
|
|
1334
|
+
} else if ((tmp = escapedHexLen(ch)) > 0) {
|
|
1335
|
+
hexLength = tmp;
|
|
1336
|
+
hexResult = 0;
|
|
1337
|
+
for (; hexLength > 0; hexLength--) {
|
|
1338
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1339
|
+
if ((tmp = fromHexCode(ch)) >= 0) {
|
|
1340
|
+
hexResult = (hexResult << 4) + tmp;
|
|
1341
|
+
} else {
|
|
1342
|
+
throwError(state, "expected hexadecimal character");
|
|
1343
|
+
}
|
|
1344
|
+
}
|
|
1345
|
+
state.result += charFromCodepoint(hexResult);
|
|
1346
|
+
state.position++;
|
|
1347
|
+
} else {
|
|
1348
|
+
throwError(state, "unknown escape sequence");
|
|
1793
1349
|
}
|
|
1350
|
+
captureStart = captureEnd = state.position;
|
|
1351
|
+
} else if (is_EOL(ch)) {
|
|
1352
|
+
captureSegment(state, captureStart, captureEnd, true);
|
|
1353
|
+
writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
|
|
1354
|
+
captureStart = captureEnd = state.position;
|
|
1355
|
+
} else if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
1356
|
+
throwError(state, "unexpected end of the document within a double quoted scalar");
|
|
1794
1357
|
} else {
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
} else {
|
|
1798
|
-
if (!state.json && !_hasOwnProperty$1.call(overridableKeys, keyNode) && _hasOwnProperty$1.call(_result, keyNode)) {
|
|
1799
|
-
state.line = startLine || state.line;
|
|
1800
|
-
state.lineStart = startLineStart || state.lineStart;
|
|
1801
|
-
state.position = startPos || state.position;
|
|
1802
|
-
throwError(state, "duplicated mapping key");
|
|
1358
|
+
state.position++;
|
|
1359
|
+
captureEnd = state.position;
|
|
1803
1360
|
}
|
|
1804
|
-
setProperty(_result, keyNode, valueNode);
|
|
1805
|
-
delete overridableKeys[keyNode];
|
|
1806
1361
|
}
|
|
1807
|
-
|
|
1362
|
+
throwError(state, "unexpected end of the stream within a double quoted scalar");
|
|
1808
1363
|
}
|
|
1809
|
-
function
|
|
1810
|
-
var ch;
|
|
1364
|
+
function readFlowCollection(state, nodeIndent) {
|
|
1365
|
+
var readNext = true, _line, _lineStart, _pos, _tag = state.tag, _result, _anchor = state.anchor, following, terminator, isPair, isExplicitPair, isMapping, overridableKeys = /* @__PURE__ */ Object.create(null), keyNode, keyTag, valueNode, ch;
|
|
1811
1366
|
ch = state.input.charCodeAt(state.position);
|
|
1812
|
-
if (ch ===
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1367
|
+
if (ch === 91) {
|
|
1368
|
+
terminator = 93;
|
|
1369
|
+
isMapping = false;
|
|
1370
|
+
_result = [];
|
|
1371
|
+
} else if (ch === 123) {
|
|
1372
|
+
terminator = 125;
|
|
1373
|
+
isMapping = true;
|
|
1374
|
+
_result = {};
|
|
1819
1375
|
} else {
|
|
1820
|
-
|
|
1821
|
-
}
|
|
1822
|
-
state.line += 1;
|
|
1823
|
-
state.lineStart = state.position;
|
|
1824
|
-
state.firstTabInLine = -1;
|
|
1825
|
-
}
|
|
1826
|
-
function skipSeparationSpace(state, allowComments, checkIndent) {
|
|
1827
|
-
var lineBreaks = 0, ch = state.input.charCodeAt(state.position);
|
|
1828
|
-
while (ch !== 0) {
|
|
1829
|
-
while (is_WHITE_SPACE(ch)) {
|
|
1830
|
-
if (ch === 9 && state.firstTabInLine === -1) {
|
|
1831
|
-
state.firstTabInLine = state.position;
|
|
1832
|
-
}
|
|
1833
|
-
ch = state.input.charCodeAt(++state.position);
|
|
1834
|
-
}
|
|
1835
|
-
if (allowComments && ch === 35) {
|
|
1836
|
-
do {
|
|
1837
|
-
ch = state.input.charCodeAt(++state.position);
|
|
1838
|
-
} while (ch !== 10 && ch !== 13 && ch !== 0);
|
|
1839
|
-
}
|
|
1840
|
-
if (is_EOL(ch)) {
|
|
1841
|
-
readLineBreak(state);
|
|
1842
|
-
ch = state.input.charCodeAt(state.position);
|
|
1843
|
-
lineBreaks++;
|
|
1844
|
-
state.lineIndent = 0;
|
|
1845
|
-
while (ch === 32) {
|
|
1846
|
-
state.lineIndent++;
|
|
1847
|
-
ch = state.input.charCodeAt(++state.position);
|
|
1848
|
-
}
|
|
1849
|
-
} else {
|
|
1850
|
-
break;
|
|
1851
|
-
}
|
|
1852
|
-
}
|
|
1853
|
-
if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {
|
|
1854
|
-
throwWarning(state, "deficient indentation");
|
|
1855
|
-
}
|
|
1856
|
-
return lineBreaks;
|
|
1857
|
-
}
|
|
1858
|
-
function testDocumentSeparator(state) {
|
|
1859
|
-
var _position = state.position, ch;
|
|
1860
|
-
ch = state.input.charCodeAt(_position);
|
|
1861
|
-
if ((ch === 45 || ch === 46) && ch === state.input.charCodeAt(_position + 1) && ch === state.input.charCodeAt(_position + 2)) {
|
|
1862
|
-
_position += 3;
|
|
1863
|
-
ch = state.input.charCodeAt(_position);
|
|
1864
|
-
if (ch === 0 || is_WS_OR_EOL(ch)) {
|
|
1865
|
-
return true;
|
|
1866
|
-
}
|
|
1867
|
-
}
|
|
1868
|
-
return false;
|
|
1869
|
-
}
|
|
1870
|
-
function writeFoldedLines(state, count) {
|
|
1871
|
-
if (count === 1) {
|
|
1872
|
-
state.result += " ";
|
|
1873
|
-
} else if (count > 1) {
|
|
1874
|
-
state.result += common.repeat("\n", count - 1);
|
|
1875
|
-
}
|
|
1876
|
-
}
|
|
1877
|
-
function readPlainScalar(state, nodeIndent, withinFlowCollection) {
|
|
1878
|
-
var preceding, following, captureStart, captureEnd, hasPendingContent, _line, _lineStart, _lineIndent, _kind = state.kind, _result = state.result, ch;
|
|
1879
|
-
ch = state.input.charCodeAt(state.position);
|
|
1880
|
-
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) {
|
|
1881
|
-
return false;
|
|
1882
|
-
}
|
|
1883
|
-
if (ch === 63 || ch === 45) {
|
|
1884
|
-
following = state.input.charCodeAt(state.position + 1);
|
|
1885
|
-
if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
|
|
1886
|
-
return false;
|
|
1887
|
-
}
|
|
1888
|
-
}
|
|
1889
|
-
state.kind = "scalar";
|
|
1890
|
-
state.result = "";
|
|
1891
|
-
captureStart = captureEnd = state.position;
|
|
1892
|
-
hasPendingContent = false;
|
|
1893
|
-
while (ch !== 0) {
|
|
1894
|
-
if (ch === 58) {
|
|
1895
|
-
following = state.input.charCodeAt(state.position + 1);
|
|
1896
|
-
if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
|
|
1897
|
-
break;
|
|
1898
|
-
}
|
|
1899
|
-
} else if (ch === 35) {
|
|
1900
|
-
preceding = state.input.charCodeAt(state.position - 1);
|
|
1901
|
-
if (is_WS_OR_EOL(preceding)) {
|
|
1902
|
-
break;
|
|
1903
|
-
}
|
|
1904
|
-
} else if (state.position === state.lineStart && testDocumentSeparator(state) || withinFlowCollection && is_FLOW_INDICATOR(ch)) {
|
|
1905
|
-
break;
|
|
1906
|
-
} else if (is_EOL(ch)) {
|
|
1907
|
-
_line = state.line;
|
|
1908
|
-
_lineStart = state.lineStart;
|
|
1909
|
-
_lineIndent = state.lineIndent;
|
|
1910
|
-
skipSeparationSpace(state, false, -1);
|
|
1911
|
-
if (state.lineIndent >= nodeIndent) {
|
|
1912
|
-
hasPendingContent = true;
|
|
1913
|
-
ch = state.input.charCodeAt(state.position);
|
|
1914
|
-
continue;
|
|
1915
|
-
} else {
|
|
1916
|
-
state.position = captureEnd;
|
|
1917
|
-
state.line = _line;
|
|
1918
|
-
state.lineStart = _lineStart;
|
|
1919
|
-
state.lineIndent = _lineIndent;
|
|
1920
|
-
break;
|
|
1921
|
-
}
|
|
1922
|
-
}
|
|
1923
|
-
if (hasPendingContent) {
|
|
1924
|
-
captureSegment(state, captureStart, captureEnd, false);
|
|
1925
|
-
writeFoldedLines(state, state.line - _line);
|
|
1926
|
-
captureStart = captureEnd = state.position;
|
|
1927
|
-
hasPendingContent = false;
|
|
1928
|
-
}
|
|
1929
|
-
if (!is_WHITE_SPACE(ch)) {
|
|
1930
|
-
captureEnd = state.position + 1;
|
|
1931
|
-
}
|
|
1932
|
-
ch = state.input.charCodeAt(++state.position);
|
|
1933
|
-
}
|
|
1934
|
-
captureSegment(state, captureStart, captureEnd, false);
|
|
1935
|
-
if (state.result) {
|
|
1936
|
-
return true;
|
|
1937
|
-
}
|
|
1938
|
-
state.kind = _kind;
|
|
1939
|
-
state.result = _result;
|
|
1940
|
-
return false;
|
|
1941
|
-
}
|
|
1942
|
-
function readSingleQuotedScalar(state, nodeIndent) {
|
|
1943
|
-
var ch, captureStart, captureEnd;
|
|
1944
|
-
ch = state.input.charCodeAt(state.position);
|
|
1945
|
-
if (ch !== 39) {
|
|
1946
|
-
return false;
|
|
1947
|
-
}
|
|
1948
|
-
state.kind = "scalar";
|
|
1949
|
-
state.result = "";
|
|
1950
|
-
state.position++;
|
|
1951
|
-
captureStart = captureEnd = state.position;
|
|
1952
|
-
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
1953
|
-
if (ch === 39) {
|
|
1954
|
-
captureSegment(state, captureStart, state.position, true);
|
|
1955
|
-
ch = state.input.charCodeAt(++state.position);
|
|
1956
|
-
if (ch === 39) {
|
|
1957
|
-
captureStart = state.position;
|
|
1958
|
-
state.position++;
|
|
1959
|
-
captureEnd = state.position;
|
|
1960
|
-
} else {
|
|
1961
|
-
return true;
|
|
1962
|
-
}
|
|
1963
|
-
} else if (is_EOL(ch)) {
|
|
1964
|
-
captureSegment(state, captureStart, captureEnd, true);
|
|
1965
|
-
writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
|
|
1966
|
-
captureStart = captureEnd = state.position;
|
|
1967
|
-
} else if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
1968
|
-
throwError(state, "unexpected end of the document within a single quoted scalar");
|
|
1969
|
-
} else {
|
|
1970
|
-
state.position++;
|
|
1971
|
-
captureEnd = state.position;
|
|
1972
|
-
}
|
|
1973
|
-
}
|
|
1974
|
-
throwError(state, "unexpected end of the stream within a single quoted scalar");
|
|
1975
|
-
}
|
|
1976
|
-
function readDoubleQuotedScalar(state, nodeIndent) {
|
|
1977
|
-
var captureStart, captureEnd, hexLength, hexResult, tmp, ch;
|
|
1978
|
-
ch = state.input.charCodeAt(state.position);
|
|
1979
|
-
if (ch !== 34) {
|
|
1980
|
-
return false;
|
|
1981
|
-
}
|
|
1982
|
-
state.kind = "scalar";
|
|
1983
|
-
state.result = "";
|
|
1984
|
-
state.position++;
|
|
1985
|
-
captureStart = captureEnd = state.position;
|
|
1986
|
-
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
1987
|
-
if (ch === 34) {
|
|
1988
|
-
captureSegment(state, captureStart, state.position, true);
|
|
1989
|
-
state.position++;
|
|
1990
|
-
return true;
|
|
1991
|
-
} else if (ch === 92) {
|
|
1992
|
-
captureSegment(state, captureStart, state.position, true);
|
|
1993
|
-
ch = state.input.charCodeAt(++state.position);
|
|
1994
|
-
if (is_EOL(ch)) {
|
|
1995
|
-
skipSeparationSpace(state, false, nodeIndent);
|
|
1996
|
-
} else if (ch < 256 && simpleEscapeCheck[ch]) {
|
|
1997
|
-
state.result += simpleEscapeMap[ch];
|
|
1998
|
-
state.position++;
|
|
1999
|
-
} else if ((tmp = escapedHexLen(ch)) > 0) {
|
|
2000
|
-
hexLength = tmp;
|
|
2001
|
-
hexResult = 0;
|
|
2002
|
-
for (; hexLength > 0; hexLength--) {
|
|
2003
|
-
ch = state.input.charCodeAt(++state.position);
|
|
2004
|
-
if ((tmp = fromHexCode(ch)) >= 0) {
|
|
2005
|
-
hexResult = (hexResult << 4) + tmp;
|
|
2006
|
-
} else {
|
|
2007
|
-
throwError(state, "expected hexadecimal character");
|
|
2008
|
-
}
|
|
2009
|
-
}
|
|
2010
|
-
state.result += charFromCodepoint(hexResult);
|
|
2011
|
-
state.position++;
|
|
2012
|
-
} else {
|
|
2013
|
-
throwError(state, "unknown escape sequence");
|
|
2014
|
-
}
|
|
2015
|
-
captureStart = captureEnd = state.position;
|
|
2016
|
-
} else if (is_EOL(ch)) {
|
|
2017
|
-
captureSegment(state, captureStart, captureEnd, true);
|
|
2018
|
-
writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
|
|
2019
|
-
captureStart = captureEnd = state.position;
|
|
2020
|
-
} else if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
2021
|
-
throwError(state, "unexpected end of the document within a double quoted scalar");
|
|
2022
|
-
} else {
|
|
2023
|
-
state.position++;
|
|
2024
|
-
captureEnd = state.position;
|
|
2025
|
-
}
|
|
2026
|
-
}
|
|
2027
|
-
throwError(state, "unexpected end of the stream within a double quoted scalar");
|
|
2028
|
-
}
|
|
2029
|
-
function readFlowCollection(state, nodeIndent) {
|
|
2030
|
-
var readNext = true, _line, _lineStart, _pos, _tag = state.tag, _result, _anchor = state.anchor, following, terminator, isPair, isExplicitPair, isMapping, overridableKeys = /* @__PURE__ */ Object.create(null), keyNode, keyTag, valueNode, ch;
|
|
2031
|
-
ch = state.input.charCodeAt(state.position);
|
|
2032
|
-
if (ch === 91) {
|
|
2033
|
-
terminator = 93;
|
|
2034
|
-
isMapping = false;
|
|
2035
|
-
_result = [];
|
|
2036
|
-
} else if (ch === 123) {
|
|
2037
|
-
terminator = 125;
|
|
2038
|
-
isMapping = true;
|
|
2039
|
-
_result = {};
|
|
2040
|
-
} else {
|
|
2041
|
-
return false;
|
|
1376
|
+
return false;
|
|
2042
1377
|
}
|
|
2043
1378
|
if (state.anchor !== null) {
|
|
2044
1379
|
state.anchorMap[state.anchor] = _result;
|
|
@@ -2956,447 +2291,1209 @@ function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, te
|
|
|
2956
2291
|
}
|
|
2957
2292
|
return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
|
|
2958
2293
|
}
|
|
2959
|
-
if (indentPerLevel > 9 && needIndentIndicator(string)) {
|
|
2960
|
-
return STYLE_DOUBLE;
|
|
2294
|
+
if (indentPerLevel > 9 && needIndentIndicator(string)) {
|
|
2295
|
+
return STYLE_DOUBLE;
|
|
2296
|
+
}
|
|
2297
|
+
if (!forceQuotes) {
|
|
2298
|
+
return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
|
|
2299
|
+
}
|
|
2300
|
+
return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
|
|
2301
|
+
}
|
|
2302
|
+
function writeScalar(state, string, level, iskey, inblock) {
|
|
2303
|
+
state.dump = (function() {
|
|
2304
|
+
if (string.length === 0) {
|
|
2305
|
+
return state.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''";
|
|
2306
|
+
}
|
|
2307
|
+
if (!state.noCompatMode) {
|
|
2308
|
+
if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) {
|
|
2309
|
+
return state.quotingType === QUOTING_TYPE_DOUBLE ? '"' + string + '"' : "'" + string + "'";
|
|
2310
|
+
}
|
|
2311
|
+
}
|
|
2312
|
+
var indent = state.indent * Math.max(1, level);
|
|
2313
|
+
var lineWidth = state.lineWidth === -1 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
|
|
2314
|
+
var singleLineOnly = iskey || state.flowLevel > -1 && level >= state.flowLevel;
|
|
2315
|
+
function testAmbiguity(string2) {
|
|
2316
|
+
return testImplicitResolving(state, string2);
|
|
2317
|
+
}
|
|
2318
|
+
switch (chooseScalarStyle(
|
|
2319
|
+
string,
|
|
2320
|
+
singleLineOnly,
|
|
2321
|
+
state.indent,
|
|
2322
|
+
lineWidth,
|
|
2323
|
+
testAmbiguity,
|
|
2324
|
+
state.quotingType,
|
|
2325
|
+
state.forceQuotes && !iskey,
|
|
2326
|
+
inblock
|
|
2327
|
+
)) {
|
|
2328
|
+
case STYLE_PLAIN:
|
|
2329
|
+
return string;
|
|
2330
|
+
case STYLE_SINGLE:
|
|
2331
|
+
return "'" + string.replace(/'/g, "''") + "'";
|
|
2332
|
+
case STYLE_LITERAL:
|
|
2333
|
+
return "|" + blockHeader(string, state.indent) + dropEndingNewline(indentString(string, indent));
|
|
2334
|
+
case STYLE_FOLDED:
|
|
2335
|
+
return ">" + blockHeader(string, state.indent) + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
|
|
2336
|
+
case STYLE_DOUBLE:
|
|
2337
|
+
return '"' + escapeString(string) + '"';
|
|
2338
|
+
default:
|
|
2339
|
+
throw new exception("impossible error: invalid scalar style");
|
|
2340
|
+
}
|
|
2341
|
+
})();
|
|
2342
|
+
}
|
|
2343
|
+
function blockHeader(string, indentPerLevel) {
|
|
2344
|
+
var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : "";
|
|
2345
|
+
var clip = string[string.length - 1] === "\n";
|
|
2346
|
+
var keep = clip && (string[string.length - 2] === "\n" || string === "\n");
|
|
2347
|
+
var chomp = keep ? "+" : clip ? "" : "-";
|
|
2348
|
+
return indentIndicator + chomp + "\n";
|
|
2349
|
+
}
|
|
2350
|
+
function dropEndingNewline(string) {
|
|
2351
|
+
return string[string.length - 1] === "\n" ? string.slice(0, -1) : string;
|
|
2352
|
+
}
|
|
2353
|
+
function foldString(string, width) {
|
|
2354
|
+
var lineRe = /(\n+)([^\n]*)/g;
|
|
2355
|
+
var result = (function() {
|
|
2356
|
+
var nextLF = string.indexOf("\n");
|
|
2357
|
+
nextLF = nextLF !== -1 ? nextLF : string.length;
|
|
2358
|
+
lineRe.lastIndex = nextLF;
|
|
2359
|
+
return foldLine(string.slice(0, nextLF), width);
|
|
2360
|
+
})();
|
|
2361
|
+
var prevMoreIndented = string[0] === "\n" || string[0] === " ";
|
|
2362
|
+
var moreIndented;
|
|
2363
|
+
var match;
|
|
2364
|
+
while (match = lineRe.exec(string)) {
|
|
2365
|
+
var prefix = match[1], line = match[2];
|
|
2366
|
+
moreIndented = line[0] === " ";
|
|
2367
|
+
result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? "\n" : "") + foldLine(line, width);
|
|
2368
|
+
prevMoreIndented = moreIndented;
|
|
2369
|
+
}
|
|
2370
|
+
return result;
|
|
2371
|
+
}
|
|
2372
|
+
function foldLine(line, width) {
|
|
2373
|
+
if (line === "" || line[0] === " ") return line;
|
|
2374
|
+
var breakRe = / [^ ]/g;
|
|
2375
|
+
var match;
|
|
2376
|
+
var start = 0, end, curr = 0, next = 0;
|
|
2377
|
+
var result = "";
|
|
2378
|
+
while (match = breakRe.exec(line)) {
|
|
2379
|
+
next = match.index;
|
|
2380
|
+
if (next - start > width) {
|
|
2381
|
+
end = curr > start ? curr : next;
|
|
2382
|
+
result += "\n" + line.slice(start, end);
|
|
2383
|
+
start = end + 1;
|
|
2384
|
+
}
|
|
2385
|
+
curr = next;
|
|
2386
|
+
}
|
|
2387
|
+
result += "\n";
|
|
2388
|
+
if (line.length - start > width && curr > start) {
|
|
2389
|
+
result += line.slice(start, curr) + "\n" + line.slice(curr + 1);
|
|
2390
|
+
} else {
|
|
2391
|
+
result += line.slice(start);
|
|
2392
|
+
}
|
|
2393
|
+
return result.slice(1);
|
|
2394
|
+
}
|
|
2395
|
+
function escapeString(string) {
|
|
2396
|
+
var result = "";
|
|
2397
|
+
var char = 0;
|
|
2398
|
+
var escapeSeq;
|
|
2399
|
+
for (var i2 = 0; i2 < string.length; char >= 65536 ? i2 += 2 : i2++) {
|
|
2400
|
+
char = codePointAt(string, i2);
|
|
2401
|
+
escapeSeq = ESCAPE_SEQUENCES[char];
|
|
2402
|
+
if (!escapeSeq && isPrintable(char)) {
|
|
2403
|
+
result += string[i2];
|
|
2404
|
+
if (char >= 65536) result += string[i2 + 1];
|
|
2405
|
+
} else {
|
|
2406
|
+
result += escapeSeq || encodeHex(char);
|
|
2407
|
+
}
|
|
2408
|
+
}
|
|
2409
|
+
return result;
|
|
2410
|
+
}
|
|
2411
|
+
function writeFlowSequence(state, level, object) {
|
|
2412
|
+
var _result = "", _tag = state.tag, index, length, value;
|
|
2413
|
+
for (index = 0, length = object.length; index < length; index += 1) {
|
|
2414
|
+
value = object[index];
|
|
2415
|
+
if (state.replacer) {
|
|
2416
|
+
value = state.replacer.call(object, String(index), value);
|
|
2417
|
+
}
|
|
2418
|
+
if (writeNode(state, level, value, false, false) || typeof value === "undefined" && writeNode(state, level, null, false, false)) {
|
|
2419
|
+
if (_result !== "") _result += "," + (!state.condenseFlow ? " " : "");
|
|
2420
|
+
_result += state.dump;
|
|
2421
|
+
}
|
|
2422
|
+
}
|
|
2423
|
+
state.tag = _tag;
|
|
2424
|
+
state.dump = "[" + _result + "]";
|
|
2425
|
+
}
|
|
2426
|
+
function writeBlockSequence(state, level, object, compact) {
|
|
2427
|
+
var _result = "", _tag = state.tag, index, length, value;
|
|
2428
|
+
for (index = 0, length = object.length; index < length; index += 1) {
|
|
2429
|
+
value = object[index];
|
|
2430
|
+
if (state.replacer) {
|
|
2431
|
+
value = state.replacer.call(object, String(index), value);
|
|
2432
|
+
}
|
|
2433
|
+
if (writeNode(state, level + 1, value, true, true, false, true) || typeof value === "undefined" && writeNode(state, level + 1, null, true, true, false, true)) {
|
|
2434
|
+
if (!compact || _result !== "") {
|
|
2435
|
+
_result += generateNextLine(state, level);
|
|
2436
|
+
}
|
|
2437
|
+
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
2438
|
+
_result += "-";
|
|
2439
|
+
} else {
|
|
2440
|
+
_result += "- ";
|
|
2441
|
+
}
|
|
2442
|
+
_result += state.dump;
|
|
2443
|
+
}
|
|
2444
|
+
}
|
|
2445
|
+
state.tag = _tag;
|
|
2446
|
+
state.dump = _result || "[]";
|
|
2447
|
+
}
|
|
2448
|
+
function writeFlowMapping(state, level, object) {
|
|
2449
|
+
var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, pairBuffer;
|
|
2450
|
+
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
|
2451
|
+
pairBuffer = "";
|
|
2452
|
+
if (_result !== "") pairBuffer += ", ";
|
|
2453
|
+
if (state.condenseFlow) pairBuffer += '"';
|
|
2454
|
+
objectKey = objectKeyList[index];
|
|
2455
|
+
objectValue = object[objectKey];
|
|
2456
|
+
if (state.replacer) {
|
|
2457
|
+
objectValue = state.replacer.call(object, objectKey, objectValue);
|
|
2458
|
+
}
|
|
2459
|
+
if (!writeNode(state, level, objectKey, false, false)) {
|
|
2460
|
+
continue;
|
|
2461
|
+
}
|
|
2462
|
+
if (state.dump.length > 1024) pairBuffer += "? ";
|
|
2463
|
+
pairBuffer += state.dump + (state.condenseFlow ? '"' : "") + ":" + (state.condenseFlow ? "" : " ");
|
|
2464
|
+
if (!writeNode(state, level, objectValue, false, false)) {
|
|
2465
|
+
continue;
|
|
2466
|
+
}
|
|
2467
|
+
pairBuffer += state.dump;
|
|
2468
|
+
_result += pairBuffer;
|
|
2469
|
+
}
|
|
2470
|
+
state.tag = _tag;
|
|
2471
|
+
state.dump = "{" + _result + "}";
|
|
2472
|
+
}
|
|
2473
|
+
function writeBlockMapping(state, level, object, compact) {
|
|
2474
|
+
var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, explicitPair, pairBuffer;
|
|
2475
|
+
if (state.sortKeys === true) {
|
|
2476
|
+
objectKeyList.sort();
|
|
2477
|
+
} else if (typeof state.sortKeys === "function") {
|
|
2478
|
+
objectKeyList.sort(state.sortKeys);
|
|
2479
|
+
} else if (state.sortKeys) {
|
|
2480
|
+
throw new exception("sortKeys must be a boolean or a function");
|
|
2481
|
+
}
|
|
2482
|
+
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
|
2483
|
+
pairBuffer = "";
|
|
2484
|
+
if (!compact || _result !== "") {
|
|
2485
|
+
pairBuffer += generateNextLine(state, level);
|
|
2486
|
+
}
|
|
2487
|
+
objectKey = objectKeyList[index];
|
|
2488
|
+
objectValue = object[objectKey];
|
|
2489
|
+
if (state.replacer) {
|
|
2490
|
+
objectValue = state.replacer.call(object, objectKey, objectValue);
|
|
2491
|
+
}
|
|
2492
|
+
if (!writeNode(state, level + 1, objectKey, true, true, true)) {
|
|
2493
|
+
continue;
|
|
2494
|
+
}
|
|
2495
|
+
explicitPair = state.tag !== null && state.tag !== "?" || state.dump && state.dump.length > 1024;
|
|
2496
|
+
if (explicitPair) {
|
|
2497
|
+
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
2498
|
+
pairBuffer += "?";
|
|
2499
|
+
} else {
|
|
2500
|
+
pairBuffer += "? ";
|
|
2501
|
+
}
|
|
2502
|
+
}
|
|
2503
|
+
pairBuffer += state.dump;
|
|
2504
|
+
if (explicitPair) {
|
|
2505
|
+
pairBuffer += generateNextLine(state, level);
|
|
2506
|
+
}
|
|
2507
|
+
if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
|
|
2508
|
+
continue;
|
|
2509
|
+
}
|
|
2510
|
+
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
2511
|
+
pairBuffer += ":";
|
|
2512
|
+
} else {
|
|
2513
|
+
pairBuffer += ": ";
|
|
2514
|
+
}
|
|
2515
|
+
pairBuffer += state.dump;
|
|
2516
|
+
_result += pairBuffer;
|
|
2517
|
+
}
|
|
2518
|
+
state.tag = _tag;
|
|
2519
|
+
state.dump = _result || "{}";
|
|
2520
|
+
}
|
|
2521
|
+
function detectType(state, object, explicit) {
|
|
2522
|
+
var _result, typeList, index, length, type2, style;
|
|
2523
|
+
typeList = explicit ? state.explicitTypes : state.implicitTypes;
|
|
2524
|
+
for (index = 0, length = typeList.length; index < length; index += 1) {
|
|
2525
|
+
type2 = typeList[index];
|
|
2526
|
+
if ((type2.instanceOf || type2.predicate) && (!type2.instanceOf || typeof object === "object" && object instanceof type2.instanceOf) && (!type2.predicate || type2.predicate(object))) {
|
|
2527
|
+
if (explicit) {
|
|
2528
|
+
if (type2.multi && type2.representName) {
|
|
2529
|
+
state.tag = type2.representName(object);
|
|
2530
|
+
} else {
|
|
2531
|
+
state.tag = type2.tag;
|
|
2532
|
+
}
|
|
2533
|
+
} else {
|
|
2534
|
+
state.tag = "?";
|
|
2535
|
+
}
|
|
2536
|
+
if (type2.represent) {
|
|
2537
|
+
style = state.styleMap[type2.tag] || type2.defaultStyle;
|
|
2538
|
+
if (_toString.call(type2.represent) === "[object Function]") {
|
|
2539
|
+
_result = type2.represent(object, style);
|
|
2540
|
+
} else if (_hasOwnProperty.call(type2.represent, style)) {
|
|
2541
|
+
_result = type2.represent[style](object, style);
|
|
2542
|
+
} else {
|
|
2543
|
+
throw new exception("!<" + type2.tag + '> tag resolver accepts not "' + style + '" style');
|
|
2544
|
+
}
|
|
2545
|
+
state.dump = _result;
|
|
2546
|
+
}
|
|
2547
|
+
return true;
|
|
2548
|
+
}
|
|
2549
|
+
}
|
|
2550
|
+
return false;
|
|
2551
|
+
}
|
|
2552
|
+
function writeNode(state, level, object, block, compact, iskey, isblockseq) {
|
|
2553
|
+
state.tag = null;
|
|
2554
|
+
state.dump = object;
|
|
2555
|
+
if (!detectType(state, object, false)) {
|
|
2556
|
+
detectType(state, object, true);
|
|
2557
|
+
}
|
|
2558
|
+
var type2 = _toString.call(state.dump);
|
|
2559
|
+
var inblock = block;
|
|
2560
|
+
var tagStr;
|
|
2561
|
+
if (block) {
|
|
2562
|
+
block = state.flowLevel < 0 || state.flowLevel > level;
|
|
2563
|
+
}
|
|
2564
|
+
var objectOrArray = type2 === "[object Object]" || type2 === "[object Array]", duplicateIndex, duplicate;
|
|
2565
|
+
if (objectOrArray) {
|
|
2566
|
+
duplicateIndex = state.duplicates.indexOf(object);
|
|
2567
|
+
duplicate = duplicateIndex !== -1;
|
|
2568
|
+
}
|
|
2569
|
+
if (state.tag !== null && state.tag !== "?" || duplicate || state.indent !== 2 && level > 0) {
|
|
2570
|
+
compact = false;
|
|
2571
|
+
}
|
|
2572
|
+
if (duplicate && state.usedDuplicates[duplicateIndex]) {
|
|
2573
|
+
state.dump = "*ref_" + duplicateIndex;
|
|
2574
|
+
} else {
|
|
2575
|
+
if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
|
|
2576
|
+
state.usedDuplicates[duplicateIndex] = true;
|
|
2577
|
+
}
|
|
2578
|
+
if (type2 === "[object Object]") {
|
|
2579
|
+
if (block && Object.keys(state.dump).length !== 0) {
|
|
2580
|
+
writeBlockMapping(state, level, state.dump, compact);
|
|
2581
|
+
if (duplicate) {
|
|
2582
|
+
state.dump = "&ref_" + duplicateIndex + state.dump;
|
|
2583
|
+
}
|
|
2584
|
+
} else {
|
|
2585
|
+
writeFlowMapping(state, level, state.dump);
|
|
2586
|
+
if (duplicate) {
|
|
2587
|
+
state.dump = "&ref_" + duplicateIndex + " " + state.dump;
|
|
2588
|
+
}
|
|
2589
|
+
}
|
|
2590
|
+
} else if (type2 === "[object Array]") {
|
|
2591
|
+
if (block && state.dump.length !== 0) {
|
|
2592
|
+
if (state.noArrayIndent && !isblockseq && level > 0) {
|
|
2593
|
+
writeBlockSequence(state, level - 1, state.dump, compact);
|
|
2594
|
+
} else {
|
|
2595
|
+
writeBlockSequence(state, level, state.dump, compact);
|
|
2596
|
+
}
|
|
2597
|
+
if (duplicate) {
|
|
2598
|
+
state.dump = "&ref_" + duplicateIndex + state.dump;
|
|
2599
|
+
}
|
|
2600
|
+
} else {
|
|
2601
|
+
writeFlowSequence(state, level, state.dump);
|
|
2602
|
+
if (duplicate) {
|
|
2603
|
+
state.dump = "&ref_" + duplicateIndex + " " + state.dump;
|
|
2604
|
+
}
|
|
2605
|
+
}
|
|
2606
|
+
} else if (type2 === "[object String]") {
|
|
2607
|
+
if (state.tag !== "?") {
|
|
2608
|
+
writeScalar(state, state.dump, level, iskey, inblock);
|
|
2609
|
+
}
|
|
2610
|
+
} else if (type2 === "[object Undefined]") {
|
|
2611
|
+
return false;
|
|
2612
|
+
} else {
|
|
2613
|
+
if (state.skipInvalid) return false;
|
|
2614
|
+
throw new exception("unacceptable kind of an object to dump " + type2);
|
|
2615
|
+
}
|
|
2616
|
+
if (state.tag !== null && state.tag !== "?") {
|
|
2617
|
+
tagStr = encodeURI(
|
|
2618
|
+
state.tag[0] === "!" ? state.tag.slice(1) : state.tag
|
|
2619
|
+
).replace(/!/g, "%21");
|
|
2620
|
+
if (state.tag[0] === "!") {
|
|
2621
|
+
tagStr = "!" + tagStr;
|
|
2622
|
+
} else if (tagStr.slice(0, 18) === "tag:yaml.org,2002:") {
|
|
2623
|
+
tagStr = "!!" + tagStr.slice(18);
|
|
2624
|
+
} else {
|
|
2625
|
+
tagStr = "!<" + tagStr + ">";
|
|
2626
|
+
}
|
|
2627
|
+
state.dump = tagStr + " " + state.dump;
|
|
2628
|
+
}
|
|
2629
|
+
}
|
|
2630
|
+
return true;
|
|
2631
|
+
}
|
|
2632
|
+
function getDuplicateReferences(object, state) {
|
|
2633
|
+
var objects = [], duplicatesIndexes = [], index, length;
|
|
2634
|
+
inspectNode(object, objects, duplicatesIndexes);
|
|
2635
|
+
for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {
|
|
2636
|
+
state.duplicates.push(objects[duplicatesIndexes[index]]);
|
|
2637
|
+
}
|
|
2638
|
+
state.usedDuplicates = new Array(length);
|
|
2639
|
+
}
|
|
2640
|
+
function inspectNode(object, objects, duplicatesIndexes) {
|
|
2641
|
+
var objectKeyList, index, length;
|
|
2642
|
+
if (object !== null && typeof object === "object") {
|
|
2643
|
+
index = objects.indexOf(object);
|
|
2644
|
+
if (index !== -1) {
|
|
2645
|
+
if (duplicatesIndexes.indexOf(index) === -1) {
|
|
2646
|
+
duplicatesIndexes.push(index);
|
|
2647
|
+
}
|
|
2648
|
+
} else {
|
|
2649
|
+
objects.push(object);
|
|
2650
|
+
if (Array.isArray(object)) {
|
|
2651
|
+
for (index = 0, length = object.length; index < length; index += 1) {
|
|
2652
|
+
inspectNode(object[index], objects, duplicatesIndexes);
|
|
2653
|
+
}
|
|
2654
|
+
} else {
|
|
2655
|
+
objectKeyList = Object.keys(object);
|
|
2656
|
+
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
|
2657
|
+
inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);
|
|
2658
|
+
}
|
|
2659
|
+
}
|
|
2660
|
+
}
|
|
2661
|
+
}
|
|
2662
|
+
}
|
|
2663
|
+
function dump$1(input, options) {
|
|
2664
|
+
options = options || {};
|
|
2665
|
+
var state = new State(options);
|
|
2666
|
+
if (!state.noRefs) getDuplicateReferences(input, state);
|
|
2667
|
+
var value = input;
|
|
2668
|
+
if (state.replacer) {
|
|
2669
|
+
value = state.replacer.call({ "": value }, "", value);
|
|
2670
|
+
}
|
|
2671
|
+
if (writeNode(state, 0, value, true, true)) return state.dump + "\n";
|
|
2672
|
+
return "";
|
|
2673
|
+
}
|
|
2674
|
+
var dump_1 = dump$1;
|
|
2675
|
+
var dumper = {
|
|
2676
|
+
dump: dump_1
|
|
2677
|
+
};
|
|
2678
|
+
function renamed(from, to) {
|
|
2679
|
+
return function() {
|
|
2680
|
+
throw new Error("Function yaml." + from + " is removed in js-yaml 4. Use yaml." + to + " instead, which is now safe by default.");
|
|
2681
|
+
};
|
|
2682
|
+
}
|
|
2683
|
+
var Type = type;
|
|
2684
|
+
var Schema = schema;
|
|
2685
|
+
var FAILSAFE_SCHEMA = failsafe;
|
|
2686
|
+
var JSON_SCHEMA = json;
|
|
2687
|
+
var CORE_SCHEMA = core;
|
|
2688
|
+
var DEFAULT_SCHEMA = _default;
|
|
2689
|
+
var load = loader.load;
|
|
2690
|
+
var loadAll = loader.loadAll;
|
|
2691
|
+
var dump = dumper.dump;
|
|
2692
|
+
var YAMLException = exception;
|
|
2693
|
+
var types = {
|
|
2694
|
+
binary,
|
|
2695
|
+
float,
|
|
2696
|
+
map,
|
|
2697
|
+
null: _null,
|
|
2698
|
+
pairs,
|
|
2699
|
+
set,
|
|
2700
|
+
timestamp,
|
|
2701
|
+
bool,
|
|
2702
|
+
int,
|
|
2703
|
+
merge,
|
|
2704
|
+
omap,
|
|
2705
|
+
seq,
|
|
2706
|
+
str
|
|
2707
|
+
};
|
|
2708
|
+
var safeLoad = renamed("safeLoad", "load");
|
|
2709
|
+
var safeLoadAll = renamed("safeLoadAll", "loadAll");
|
|
2710
|
+
var safeDump = renamed("safeDump", "dump");
|
|
2711
|
+
var jsYaml = {
|
|
2712
|
+
Type,
|
|
2713
|
+
Schema,
|
|
2714
|
+
FAILSAFE_SCHEMA,
|
|
2715
|
+
JSON_SCHEMA,
|
|
2716
|
+
CORE_SCHEMA,
|
|
2717
|
+
DEFAULT_SCHEMA,
|
|
2718
|
+
load,
|
|
2719
|
+
loadAll,
|
|
2720
|
+
dump,
|
|
2721
|
+
YAMLException,
|
|
2722
|
+
types,
|
|
2723
|
+
safeLoad,
|
|
2724
|
+
safeLoadAll,
|
|
2725
|
+
safeDump
|
|
2726
|
+
};
|
|
2727
|
+
|
|
2728
|
+
// node_modules/smol-toml/dist/error.js
|
|
2729
|
+
function getLineColFromPtr(string, ptr) {
|
|
2730
|
+
let lines = string.slice(0, ptr).split(/\r?\n/);
|
|
2731
|
+
return [lines.length, lines.pop().length + 1];
|
|
2732
|
+
}
|
|
2733
|
+
function makeCodeBlock(string, line, column) {
|
|
2734
|
+
let lines = string.split(/\r?\n/);
|
|
2735
|
+
let codeblock = "";
|
|
2736
|
+
let numberLen = (Math.log10(line + 1) | 0) + 1;
|
|
2737
|
+
for (let i2 = line - 1; i2 <= line + 1; i2++) {
|
|
2738
|
+
let l = lines[i2 - 1];
|
|
2739
|
+
if (!l)
|
|
2740
|
+
continue;
|
|
2741
|
+
codeblock += i2.toString().padEnd(numberLen, " ");
|
|
2742
|
+
codeblock += ": ";
|
|
2743
|
+
codeblock += l;
|
|
2744
|
+
codeblock += "\n";
|
|
2745
|
+
if (i2 === line) {
|
|
2746
|
+
codeblock += " ".repeat(numberLen + column + 2);
|
|
2747
|
+
codeblock += "^\n";
|
|
2748
|
+
}
|
|
2749
|
+
}
|
|
2750
|
+
return codeblock;
|
|
2751
|
+
}
|
|
2752
|
+
var TomlError = class _TomlError extends Error {
|
|
2753
|
+
line;
|
|
2754
|
+
column;
|
|
2755
|
+
codeblock;
|
|
2756
|
+
constructor(message, options) {
|
|
2757
|
+
const [line, column] = getLineColFromPtr(options.toml, options.ptr);
|
|
2758
|
+
const codeblock = makeCodeBlock(options.toml, line, column);
|
|
2759
|
+
super(`Invalid TOML document: ${message}
|
|
2760
|
+
|
|
2761
|
+
${codeblock}`, options);
|
|
2762
|
+
this.line = line;
|
|
2763
|
+
this.column = column;
|
|
2764
|
+
this.codeblock = codeblock;
|
|
2765
|
+
}
|
|
2766
|
+
/** @internal */
|
|
2767
|
+
static x(message, ctx, ptr) {
|
|
2768
|
+
throw new _TomlError(message, { toml: ctx.s, ptr: ptr ?? ctx.p });
|
|
2769
|
+
}
|
|
2770
|
+
};
|
|
2771
|
+
|
|
2772
|
+
// node_modules/smol-toml/dist/primitive.js
|
|
2773
|
+
function parseString(ctx) {
|
|
2774
|
+
let startPtr = ctx.p;
|
|
2775
|
+
let c = ctx.s.charCodeAt(ctx.p++);
|
|
2776
|
+
let first = c;
|
|
2777
|
+
let isLiteral = c === 39;
|
|
2778
|
+
let isMultiline = c === ctx.s.charCodeAt(ctx.p) && c === ctx.s.charCodeAt(ctx.p + 1);
|
|
2779
|
+
if (isMultiline) {
|
|
2780
|
+
if ((c = ctx.s.charCodeAt(ctx.p += 2)) === 10)
|
|
2781
|
+
ctx.p++;
|
|
2782
|
+
else if (c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)
|
|
2783
|
+
ctx.p += 2;
|
|
2784
|
+
}
|
|
2785
|
+
let parsed = "";
|
|
2786
|
+
let sliceStart = ctx.p;
|
|
2787
|
+
let state = 0;
|
|
2788
|
+
for (; ctx.p < ctx.s.length; ctx.p++) {
|
|
2789
|
+
c = ctx.s.charCodeAt(ctx.p);
|
|
2790
|
+
if (isMultiline && (c === 10 || c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)) {
|
|
2791
|
+
state = state && 3;
|
|
2792
|
+
} else if (c < 32 && c !== 9 || c === 127) {
|
|
2793
|
+
TomlError.x("control characters are not allowed in strings", ctx);
|
|
2794
|
+
} else if ((!state || state === 3) && c === first && (!isMultiline || ctx.s.charCodeAt(ctx.p + 1) === first && ctx.s.charCodeAt(ctx.p + 2) === first)) {
|
|
2795
|
+
if (isMultiline) {
|
|
2796
|
+
if (ctx.s.charCodeAt(ctx.p + 3) === first)
|
|
2797
|
+
ctx.p++;
|
|
2798
|
+
if (ctx.s.charCodeAt(ctx.p + 3) === first)
|
|
2799
|
+
ctx.p++;
|
|
2800
|
+
}
|
|
2801
|
+
if (!state) {
|
|
2802
|
+
let s = ctx.s.slice(sliceStart, ctx.p);
|
|
2803
|
+
parsed = parsed ? parsed + s : s;
|
|
2804
|
+
}
|
|
2805
|
+
ctx.p += isMultiline ? 3 : 1;
|
|
2806
|
+
return parsed;
|
|
2807
|
+
} else if (!state) {
|
|
2808
|
+
if (!isLiteral && c === 92) {
|
|
2809
|
+
parsed += ctx.s.slice(sliceStart, sliceStart = ctx.p);
|
|
2810
|
+
state = 1;
|
|
2811
|
+
}
|
|
2812
|
+
} else if (state === 1) {
|
|
2813
|
+
if (c === 120 || c === 117 || c === 85) {
|
|
2814
|
+
let errPtr = ctx.p++ - 1;
|
|
2815
|
+
let value = 0;
|
|
2816
|
+
let len = c === 120 ? 2 : c === 117 ? 4 : 8;
|
|
2817
|
+
for (let j = 0; j < len; j++, ctx.p++) {
|
|
2818
|
+
let hex = ctx.s.charCodeAt(ctx.p);
|
|
2819
|
+
let digit = (
|
|
2820
|
+
/* 0-9 */
|
|
2821
|
+
hex >= 48 && hex <= 57 ? hex - 48 : (
|
|
2822
|
+
/* A-F */
|
|
2823
|
+
hex >= 65 && hex <= 70 ? hex - 65 + 10 : (
|
|
2824
|
+
/* a-f */
|
|
2825
|
+
hex >= 97 && hex <= 102 ? hex - 97 + 10 : -1
|
|
2826
|
+
)
|
|
2827
|
+
)
|
|
2828
|
+
);
|
|
2829
|
+
if (digit < 0)
|
|
2830
|
+
TomlError.x("invalid non-hex character in unicode escape", ctx);
|
|
2831
|
+
value = value << 4 | digit;
|
|
2832
|
+
}
|
|
2833
|
+
if (value < 0 || value > 1114111 || value >= 55296 && value <= 57343) {
|
|
2834
|
+
TomlError.x("invalid unicode escape", ctx, errPtr);
|
|
2835
|
+
}
|
|
2836
|
+
parsed += String.fromCodePoint(value);
|
|
2837
|
+
sliceStart = ctx.p--;
|
|
2838
|
+
state = 0;
|
|
2839
|
+
} else if (isMultiline && (c === 32 || c === 9)) {
|
|
2840
|
+
state = 2;
|
|
2841
|
+
} else {
|
|
2842
|
+
if (c === 98)
|
|
2843
|
+
parsed += "\b";
|
|
2844
|
+
else if (c === 116)
|
|
2845
|
+
parsed += " ";
|
|
2846
|
+
else if (c === 110)
|
|
2847
|
+
parsed += "\n";
|
|
2848
|
+
else if (c === 102)
|
|
2849
|
+
parsed += "\f";
|
|
2850
|
+
else if (c === 114)
|
|
2851
|
+
parsed += "\r";
|
|
2852
|
+
else if (c === 101)
|
|
2853
|
+
parsed += "\x1B";
|
|
2854
|
+
else if (c === 34)
|
|
2855
|
+
parsed += '"';
|
|
2856
|
+
else if (c === 92)
|
|
2857
|
+
parsed += "\\";
|
|
2858
|
+
else
|
|
2859
|
+
TomlError.x("unrecognised escape sequence", ctx);
|
|
2860
|
+
sliceStart = ctx.p + 1;
|
|
2861
|
+
state = 0;
|
|
2862
|
+
}
|
|
2863
|
+
} else if (c !== 32 && c !== 9) {
|
|
2864
|
+
if (state === 2)
|
|
2865
|
+
TomlError.x("invalid escape: only line-ending whitespace may be escaped", ctx, sliceStart);
|
|
2866
|
+
state = !isLiteral && c === 92 ? 1 : 0;
|
|
2867
|
+
sliceStart = ctx.p;
|
|
2868
|
+
}
|
|
2869
|
+
}
|
|
2870
|
+
TomlError.x("unfinished string", ctx, startPtr);
|
|
2871
|
+
}
|
|
2872
|
+
|
|
2873
|
+
// node_modules/smol-toml/dist/date.js
|
|
2874
|
+
var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[Tt ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|z|[-+]\d{2}:\d{2})?$/i;
|
|
2875
|
+
var TomlDate = class _TomlDate extends Date {
|
|
2876
|
+
#hasDate = false;
|
|
2877
|
+
#hasTime = false;
|
|
2878
|
+
#offset = null;
|
|
2879
|
+
constructor(date, fasttype, unsafeDelim) {
|
|
2880
|
+
let hasDate = true;
|
|
2881
|
+
let hasTime = true;
|
|
2882
|
+
let offset = "Z";
|
|
2883
|
+
let c;
|
|
2884
|
+
if (typeof date === "string") {
|
|
2885
|
+
if (fasttype)
|
|
2886
|
+
prep: {
|
|
2887
|
+
if (fasttype < 3) {
|
|
2888
|
+
if (+date.slice(11, 13) > 23) {
|
|
2889
|
+
date = "";
|
|
2890
|
+
break prep;
|
|
2891
|
+
}
|
|
2892
|
+
if (fasttype === 2) {
|
|
2893
|
+
offset = null;
|
|
2894
|
+
date += "Z";
|
|
2895
|
+
} else if ((c = date.charCodeAt(date.length - 1)) !== 90 && c !== 122) {
|
|
2896
|
+
offset = date.slice(date.length - 6);
|
|
2897
|
+
}
|
|
2898
|
+
if (unsafeDelim)
|
|
2899
|
+
date = date.slice(0, 10) + "T" + date.slice(11);
|
|
2900
|
+
} else if (fasttype === 4) {
|
|
2901
|
+
date = +date.slice(0, 2) > 23 ? "" : `0000-01-01T${date}Z`;
|
|
2902
|
+
}
|
|
2903
|
+
hasDate = fasttype !== 4;
|
|
2904
|
+
hasTime = fasttype !== 3;
|
|
2905
|
+
}
|
|
2906
|
+
else {
|
|
2907
|
+
let match = date.match(DATE_TIME_RE);
|
|
2908
|
+
if (match) {
|
|
2909
|
+
if (!match[1]) {
|
|
2910
|
+
hasDate = false;
|
|
2911
|
+
date = `0000-01-01T${date}`;
|
|
2912
|
+
}
|
|
2913
|
+
hasTime = !!match[2];
|
|
2914
|
+
hasTime && date[10] === " " && (date = date.replace(" ", "T"));
|
|
2915
|
+
if (match[2] && +match[2] > 23) {
|
|
2916
|
+
date = "";
|
|
2917
|
+
} else {
|
|
2918
|
+
offset = match[3] || null;
|
|
2919
|
+
if (!offset && hasTime)
|
|
2920
|
+
date += "Z";
|
|
2921
|
+
}
|
|
2922
|
+
} else {
|
|
2923
|
+
date = "";
|
|
2924
|
+
}
|
|
2925
|
+
}
|
|
2926
|
+
}
|
|
2927
|
+
super(date);
|
|
2928
|
+
if (!isNaN(this.getTime())) {
|
|
2929
|
+
this.#hasDate = hasDate;
|
|
2930
|
+
this.#hasTime = hasTime;
|
|
2931
|
+
this.#offset = offset;
|
|
2932
|
+
}
|
|
2933
|
+
}
|
|
2934
|
+
isDateTime() {
|
|
2935
|
+
return this.#hasDate && this.#hasTime;
|
|
2936
|
+
}
|
|
2937
|
+
isLocal() {
|
|
2938
|
+
return !this.#hasDate || !this.#hasTime || !this.#offset;
|
|
2939
|
+
}
|
|
2940
|
+
isDate() {
|
|
2941
|
+
return this.#hasDate && !this.#hasTime;
|
|
2942
|
+
}
|
|
2943
|
+
isTime() {
|
|
2944
|
+
return this.#hasTime && !this.#hasDate;
|
|
2945
|
+
}
|
|
2946
|
+
isValid() {
|
|
2947
|
+
return this.#hasDate || this.#hasTime;
|
|
2948
|
+
}
|
|
2949
|
+
toISOString() {
|
|
2950
|
+
let iso = super.toISOString();
|
|
2951
|
+
if (this.isDate())
|
|
2952
|
+
return iso.slice(0, 10);
|
|
2953
|
+
if (this.isTime())
|
|
2954
|
+
return iso.slice(11, 23);
|
|
2955
|
+
if (this.#offset === null)
|
|
2956
|
+
return iso.slice(0, -1);
|
|
2957
|
+
if (this.#offset === "Z" || this.#offset === "z")
|
|
2958
|
+
return iso;
|
|
2959
|
+
let offset = +this.#offset.slice(1, 3) * 60 + +this.#offset.slice(4, 6);
|
|
2960
|
+
offset = this.#offset[0] === "-" ? offset : -offset;
|
|
2961
|
+
let offsetDate = new Date(this.getTime() - offset * 6e4);
|
|
2962
|
+
return offsetDate.toISOString().slice(0, -1) + this.#offset;
|
|
2963
|
+
}
|
|
2964
|
+
static wrapAsOffsetDateTime(jsDate, offset = "Z") {
|
|
2965
|
+
let date = new _TomlDate(jsDate);
|
|
2966
|
+
date.#offset = offset;
|
|
2967
|
+
return date;
|
|
2968
|
+
}
|
|
2969
|
+
static wrapAsLocalDateTime(jsDate) {
|
|
2970
|
+
let date = new _TomlDate(jsDate);
|
|
2971
|
+
date.#offset = null;
|
|
2972
|
+
return date;
|
|
2973
|
+
}
|
|
2974
|
+
static wrapAsLocalDate(jsDate) {
|
|
2975
|
+
let date = new _TomlDate(jsDate);
|
|
2976
|
+
date.#hasTime = false;
|
|
2977
|
+
date.#offset = null;
|
|
2978
|
+
return date;
|
|
2979
|
+
}
|
|
2980
|
+
static wrapAsLocalTime(jsDate) {
|
|
2981
|
+
let date = new _TomlDate(jsDate);
|
|
2982
|
+
date.#hasDate = false;
|
|
2983
|
+
date.#offset = null;
|
|
2984
|
+
return date;
|
|
2985
|
+
}
|
|
2986
|
+
};
|
|
2987
|
+
|
|
2988
|
+
// node_modules/smol-toml/dist/extract.js
|
|
2989
|
+
function isDigit(char, base = 10) {
|
|
2990
|
+
return base === 16 ? char > 47 && char < 58 || char > 64 && char < 71 || char > 96 && char < 103 : char > 47 && char < 48 + base;
|
|
2991
|
+
}
|
|
2992
|
+
function isEndOfValue(char, delim) {
|
|
2993
|
+
return char === 32 || char === 9 || char === 10 || char === 13 || // Structure end or next value delimiter
|
|
2994
|
+
delim && (char === delim || char === 44) || // Comment
|
|
2995
|
+
char === 35;
|
|
2996
|
+
}
|
|
2997
|
+
function extractValue(ctx, end) {
|
|
2998
|
+
let errPtr = ctx.p;
|
|
2999
|
+
let c = ctx.s.charCodeAt(ctx.p);
|
|
3000
|
+
if (c === 91 || c === 123) {
|
|
3001
|
+
ctx.d-- || TomlError.x("document contains excessively nested structures. aborting.", ctx);
|
|
3002
|
+
let value = c === 91 ? parseArray(ctx) : parseInlineTable(ctx);
|
|
3003
|
+
ctx.d++;
|
|
3004
|
+
return value;
|
|
3005
|
+
}
|
|
3006
|
+
if (c === 34 || c === 39) {
|
|
3007
|
+
return parseString(ctx);
|
|
3008
|
+
}
|
|
3009
|
+
if (c === 116) {
|
|
3010
|
+
if (ctx.s.charCodeAt(++ctx.p) !== 114 || ctx.s.charCodeAt(++ctx.p) !== 117 || ctx.s.charCodeAt(++ctx.p) !== 101)
|
|
3011
|
+
TomlError.x("invalid value", ctx, errPtr);
|
|
3012
|
+
return ctx.p++, true;
|
|
3013
|
+
}
|
|
3014
|
+
if (c === 102) {
|
|
3015
|
+
if (ctx.s.charCodeAt(++ctx.p) !== 97 || ctx.s.charCodeAt(++ctx.p) !== 108 || ctx.s.charCodeAt(++ctx.p) !== 115 || ctx.s.charCodeAt(++ctx.p) !== 101)
|
|
3016
|
+
TomlError.x("invalid value", ctx, errPtr);
|
|
3017
|
+
return ctx.p++, false;
|
|
3018
|
+
}
|
|
3019
|
+
if (c === 43 || c === 45) {
|
|
3020
|
+
return parseNumber(ctx, ctx.p, ctx.s.charCodeAt(++ctx.p), 44 - c, end);
|
|
3021
|
+
}
|
|
3022
|
+
if (ctx.s.charCodeAt(ctx.p + 4) === 45 && ctx.s.charCodeAt(ctx.p + 7) === 45) {
|
|
3023
|
+
return parseDate(ctx, c, end);
|
|
3024
|
+
}
|
|
3025
|
+
if (ctx.s.charCodeAt(ctx.p + 2) === 58) {
|
|
3026
|
+
return parseTime(ctx, c, end);
|
|
3027
|
+
}
|
|
3028
|
+
return parseNumber(ctx, ctx.p, c, 0, end);
|
|
3029
|
+
}
|
|
3030
|
+
function parseNumber(ctx, startPtr, startChr, sign, endChr) {
|
|
3031
|
+
let c = startChr;
|
|
3032
|
+
let state = 0;
|
|
3033
|
+
let hasUnderscores = false;
|
|
3034
|
+
if (c === 105) {
|
|
3035
|
+
if (ctx.s.charCodeAt(++ctx.p) !== 110 || ctx.s.charCodeAt(++ctx.p) !== 102)
|
|
3036
|
+
TomlError.x("invalid value", ctx, startPtr);
|
|
3037
|
+
return ctx.p++, (sign || 1) / 0;
|
|
3038
|
+
}
|
|
3039
|
+
if (c === 110) {
|
|
3040
|
+
if (ctx.s.charCodeAt(++ctx.p) !== 97 || ctx.s.charCodeAt(++ctx.p) !== 110)
|
|
3041
|
+
TomlError.x("invalid value", ctx, startPtr);
|
|
3042
|
+
return ctx.p++, NaN;
|
|
3043
|
+
}
|
|
3044
|
+
if (c === 48) {
|
|
3045
|
+
if (++ctx.p >= ctx.s.length || isEndOfValue(c = ctx.s.charCodeAt(ctx.p), endChr))
|
|
3046
|
+
return ctx.bi === true ? 0n : 0;
|
|
3047
|
+
if (!sign) {
|
|
3048
|
+
if (c === 120)
|
|
3049
|
+
return parseIntegerBaseN(ctx, startPtr, 16, endChr);
|
|
3050
|
+
else if (c === 98)
|
|
3051
|
+
return parseIntegerBaseN(ctx, startPtr, 2, endChr);
|
|
3052
|
+
else if (c === 111)
|
|
3053
|
+
return parseIntegerBaseN(ctx, startPtr, 8, endChr);
|
|
3054
|
+
}
|
|
3055
|
+
if (c === 46)
|
|
3056
|
+
state = 2;
|
|
3057
|
+
else if (c === 101 || c === 69)
|
|
3058
|
+
state = 4;
|
|
3059
|
+
else
|
|
3060
|
+
TomlError.x("illegal leading zero", ctx, startPtr);
|
|
3061
|
+
} else if (!isDigit(c))
|
|
3062
|
+
TomlError.x("invalid value", ctx, startPtr);
|
|
3063
|
+
while (++ctx.p < ctx.s.length && (c = ctx.s.charCodeAt(ctx.p), !isEndOfValue(c, endChr))) {
|
|
3064
|
+
if (!state)
|
|
3065
|
+
state = 1;
|
|
3066
|
+
if (c === 95) {
|
|
3067
|
+
if (!(state & 1))
|
|
3068
|
+
TomlError.x("illegal underscore", ctx);
|
|
3069
|
+
state += 11;
|
|
3070
|
+
hasUnderscores = true;
|
|
3071
|
+
} else if (state === 1 && c === 46)
|
|
3072
|
+
state = 2;
|
|
3073
|
+
else if ((state === 1 || state === 3) && (c === 101 || c === 69))
|
|
3074
|
+
state = 4;
|
|
3075
|
+
else if (state === 4 && (c === 43 || c === 45)) {
|
|
3076
|
+
state = 6;
|
|
3077
|
+
} else if (!isDigit(c))
|
|
3078
|
+
TomlError.x(`illegal character in numeric literal`, ctx);
|
|
3079
|
+
else if (state > 9)
|
|
3080
|
+
state -= 11;
|
|
3081
|
+
else if (!(state & 1))
|
|
3082
|
+
state++;
|
|
3083
|
+
}
|
|
3084
|
+
if (!state) {
|
|
3085
|
+
let val = (startChr - 48) * (sign || 1);
|
|
3086
|
+
return ctx.bi === true ? BigInt(val) : val;
|
|
2961
3087
|
}
|
|
2962
|
-
if (!
|
|
2963
|
-
|
|
3088
|
+
if (!(state & 1))
|
|
3089
|
+
TomlError.x("unfinished numeric value", ctx, startPtr);
|
|
3090
|
+
let str2 = ctx.s.slice(startPtr, ctx.p);
|
|
3091
|
+
if (hasUnderscores)
|
|
3092
|
+
str2 = str2.replaceAll("_", "");
|
|
3093
|
+
return state > 1 ? parseFloat(str2) : parseInteger(ctx, str2, 10, startPtr);
|
|
3094
|
+
}
|
|
3095
|
+
function parseIntegerBaseN(ctx, startPtr, base, endChr) {
|
|
3096
|
+
let c, underscore = 1;
|
|
3097
|
+
while (++ctx.p < ctx.s.length && (c = ctx.s.charCodeAt(ctx.p), !isEndOfValue(c, endChr))) {
|
|
3098
|
+
if (c === 95) {
|
|
3099
|
+
if (underscore & 1)
|
|
3100
|
+
TomlError.x("illegal underscore", ctx);
|
|
3101
|
+
underscore = 3;
|
|
3102
|
+
} else if (!isDigit(c, base))
|
|
3103
|
+
TomlError.x(`illegal character in numeric literal`, ctx);
|
|
3104
|
+
else if (underscore & 1)
|
|
3105
|
+
underscore--;
|
|
2964
3106
|
}
|
|
2965
|
-
|
|
3107
|
+
if (underscore & 1)
|
|
3108
|
+
TomlError.x("unfinished numeric value", ctx);
|
|
3109
|
+
let str2 = ctx.s.slice(startPtr + 2, ctx.p);
|
|
3110
|
+
if (underscore)
|
|
3111
|
+
str2 = str2.replaceAll("_", "");
|
|
3112
|
+
return parseInteger(ctx, str2, base, startPtr);
|
|
2966
3113
|
}
|
|
2967
|
-
function
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
3114
|
+
function parseInteger(ctx, str2, base, startPtr) {
|
|
3115
|
+
if (ctx.bi !== true)
|
|
3116
|
+
int: {
|
|
3117
|
+
let val = parseInt(str2, base);
|
|
3118
|
+
if (!Number.isSafeInteger(val)) {
|
|
3119
|
+
if (ctx.bi)
|
|
3120
|
+
break int;
|
|
3121
|
+
TomlError.x("integer value cannot be represented losslessly", ctx, startPtr);
|
|
2975
3122
|
}
|
|
3123
|
+
return val;
|
|
2976
3124
|
}
|
|
2977
|
-
|
|
2978
|
-
var lineWidth = state.lineWidth === -1 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
|
|
2979
|
-
var singleLineOnly = iskey || state.flowLevel > -1 && level >= state.flowLevel;
|
|
2980
|
-
function testAmbiguity(string2) {
|
|
2981
|
-
return testImplicitResolving(state, string2);
|
|
2982
|
-
}
|
|
2983
|
-
switch (chooseScalarStyle(
|
|
2984
|
-
string,
|
|
2985
|
-
singleLineOnly,
|
|
2986
|
-
state.indent,
|
|
2987
|
-
lineWidth,
|
|
2988
|
-
testAmbiguity,
|
|
2989
|
-
state.quotingType,
|
|
2990
|
-
state.forceQuotes && !iskey,
|
|
2991
|
-
inblock
|
|
2992
|
-
)) {
|
|
2993
|
-
case STYLE_PLAIN:
|
|
2994
|
-
return string;
|
|
2995
|
-
case STYLE_SINGLE:
|
|
2996
|
-
return "'" + string.replace(/'/g, "''") + "'";
|
|
2997
|
-
case STYLE_LITERAL:
|
|
2998
|
-
return "|" + blockHeader(string, state.indent) + dropEndingNewline(indentString(string, indent));
|
|
2999
|
-
case STYLE_FOLDED:
|
|
3000
|
-
return ">" + blockHeader(string, state.indent) + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
|
|
3001
|
-
case STYLE_DOUBLE:
|
|
3002
|
-
return '"' + escapeString(string) + '"';
|
|
3003
|
-
default:
|
|
3004
|
-
throw new exception("impossible error: invalid scalar style");
|
|
3005
|
-
}
|
|
3006
|
-
})();
|
|
3007
|
-
}
|
|
3008
|
-
function blockHeader(string, indentPerLevel) {
|
|
3009
|
-
var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : "";
|
|
3010
|
-
var clip = string[string.length - 1] === "\n";
|
|
3011
|
-
var keep = clip && (string[string.length - 2] === "\n" || string === "\n");
|
|
3012
|
-
var chomp = keep ? "+" : clip ? "" : "-";
|
|
3013
|
-
return indentIndicator + chomp + "\n";
|
|
3014
|
-
}
|
|
3015
|
-
function dropEndingNewline(string) {
|
|
3016
|
-
return string[string.length - 1] === "\n" ? string.slice(0, -1) : string;
|
|
3017
|
-
}
|
|
3018
|
-
function foldString(string, width) {
|
|
3019
|
-
var lineRe = /(\n+)([^\n]*)/g;
|
|
3020
|
-
var result = (function() {
|
|
3021
|
-
var nextLF = string.indexOf("\n");
|
|
3022
|
-
nextLF = nextLF !== -1 ? nextLF : string.length;
|
|
3023
|
-
lineRe.lastIndex = nextLF;
|
|
3024
|
-
return foldLine(string.slice(0, nextLF), width);
|
|
3025
|
-
})();
|
|
3026
|
-
var prevMoreIndented = string[0] === "\n" || string[0] === " ";
|
|
3027
|
-
var moreIndented;
|
|
3028
|
-
var match;
|
|
3029
|
-
while (match = lineRe.exec(string)) {
|
|
3030
|
-
var prefix = match[1], line = match[2];
|
|
3031
|
-
moreIndented = line[0] === " ";
|
|
3032
|
-
result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? "\n" : "") + foldLine(line, width);
|
|
3033
|
-
prevMoreIndented = moreIndented;
|
|
3034
|
-
}
|
|
3035
|
-
return result;
|
|
3125
|
+
return base === 10 ? BigInt(str2) : BigInt((base === 2 ? "0b" : base === 8 ? "0o" : "0x") + str2);
|
|
3036
3126
|
}
|
|
3037
|
-
function
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
var start = 0, end, curr = 0, next = 0;
|
|
3042
|
-
var result = "";
|
|
3043
|
-
while (match = breakRe.exec(line)) {
|
|
3044
|
-
next = match.index;
|
|
3045
|
-
if (next - start > width) {
|
|
3046
|
-
end = curr > start ? curr : next;
|
|
3047
|
-
result += "\n" + line.slice(start, end);
|
|
3048
|
-
start = end + 1;
|
|
3049
|
-
}
|
|
3050
|
-
curr = next;
|
|
3051
|
-
}
|
|
3052
|
-
result += "\n";
|
|
3053
|
-
if (line.length - start > width && curr > start) {
|
|
3054
|
-
result += line.slice(start, curr) + "\n" + line.slice(curr + 1);
|
|
3055
|
-
} else {
|
|
3056
|
-
result += line.slice(start);
|
|
3127
|
+
function parseDate(ctx, c, endChr) {
|
|
3128
|
+
let startPtr = ctx.p++, unsafeSeparator;
|
|
3129
|
+
if (!isDigit(c) || !isDigit(ctx.s.charCodeAt(ctx.p++)) || !isDigit(ctx.s.charCodeAt(ctx.p++)) || !isDigit(ctx.s.charCodeAt(ctx.p++))) {
|
|
3130
|
+
return parseNumber(ctx, ctx.p = startPtr, c, 0, endChr);
|
|
3057
3131
|
}
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
for (var i2 = 0; i2 < string.length; char >= 65536 ? i2 += 2 : i2++) {
|
|
3065
|
-
char = codePointAt(string, i2);
|
|
3066
|
-
escapeSeq = ESCAPE_SEQUENCES[char];
|
|
3067
|
-
if (!escapeSeq && isPrintable(char)) {
|
|
3068
|
-
result += string[i2];
|
|
3069
|
-
if (char >= 65536) result += string[i2 + 1];
|
|
3070
|
-
} else {
|
|
3071
|
-
result += escapeSeq || encodeHex(char);
|
|
3072
|
-
}
|
|
3132
|
+
ctx.p += 5;
|
|
3133
|
+
if (!isDigit(ctx.s.charCodeAt(ctx.p++)))
|
|
3134
|
+
TomlError.x("invalid date-time: date part is malformed", ctx, startPtr);
|
|
3135
|
+
if (ctx.p >= ctx.s.length || ((c = ctx.s.charCodeAt(ctx.p)) !== 32 || (unsafeSeparator = true, !isDigit(ctx.s.charCodeAt(ctx.p + 1)))) && c !== 84 && c !== 116) {
|
|
3136
|
+
let t2 = ctx.s.slice(startPtr, ctx.p);
|
|
3137
|
+
return readDate(ctx, t2, 3, false, startPtr);
|
|
3073
3138
|
}
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3139
|
+
if (ctx.s.charCodeAt(ctx.p += 3) !== 58)
|
|
3140
|
+
TomlError.x("invalid date-time: time part is malformed", ctx, startPtr);
|
|
3141
|
+
if (ctx.s.charCodeAt(ctx.p += 3) === 58)
|
|
3142
|
+
ctx.p += 3;
|
|
3143
|
+
if (ctx.s.charCodeAt(ctx.p) === 46)
|
|
3144
|
+
while (isDigit(ctx.s.charCodeAt(++ctx.p)))
|
|
3145
|
+
;
|
|
3146
|
+
if (c = ctx.s.charCodeAt(ctx.p)) {
|
|
3147
|
+
if (c === 90 || c === 122) {
|
|
3148
|
+
let t2 = ctx.s.slice(startPtr, ++ctx.p);
|
|
3149
|
+
return readDate(ctx, t2, 1, unsafeSeparator, startPtr, "[+00:00]");
|
|
3082
3150
|
}
|
|
3083
|
-
if (
|
|
3084
|
-
|
|
3085
|
-
|
|
3151
|
+
if (c === 43 || c === 45) {
|
|
3152
|
+
let t2 = ctx.s.slice(startPtr, ctx.p += 6);
|
|
3153
|
+
return readDate(ctx, t2, 1, unsafeSeparator, startPtr, !ctx.ld && "[" + ctx.s.slice(ctx.p - 6, ctx.p) + "]");
|
|
3086
3154
|
}
|
|
3087
3155
|
}
|
|
3088
|
-
|
|
3089
|
-
|
|
3156
|
+
let t = ctx.s.slice(startPtr, ctx.p);
|
|
3157
|
+
return readDate(ctx, t, 2, unsafeSeparator, startPtr);
|
|
3090
3158
|
}
|
|
3091
|
-
function
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
if (state.replacer) {
|
|
3096
|
-
value = state.replacer.call(object, String(index), value);
|
|
3097
|
-
}
|
|
3098
|
-
if (writeNode(state, level + 1, value, true, true, false, true) || typeof value === "undefined" && writeNode(state, level + 1, null, true, true, false, true)) {
|
|
3099
|
-
if (!compact || _result !== "") {
|
|
3100
|
-
_result += generateNextLine(state, level);
|
|
3101
|
-
}
|
|
3102
|
-
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
3103
|
-
_result += "-";
|
|
3104
|
-
} else {
|
|
3105
|
-
_result += "- ";
|
|
3106
|
-
}
|
|
3107
|
-
_result += state.dump;
|
|
3108
|
-
}
|
|
3159
|
+
function parseTime(ctx, c, endChr) {
|
|
3160
|
+
let start = ctx.p;
|
|
3161
|
+
if (!isDigit(c) || !isDigit(ctx.s.charCodeAt(++ctx.p))) {
|
|
3162
|
+
return parseNumber(ctx, --ctx.p, c, 0, endChr);
|
|
3109
3163
|
}
|
|
3110
|
-
|
|
3111
|
-
|
|
3164
|
+
if (ctx.s.charCodeAt(ctx.p += 4) === 58)
|
|
3165
|
+
ctx.p += 3;
|
|
3166
|
+
if (ctx.s.charCodeAt(ctx.p) === 46)
|
|
3167
|
+
while (isDigit(ctx.s.charCodeAt(++ctx.p)))
|
|
3168
|
+
;
|
|
3169
|
+
let t = ctx.s.slice(start, ctx.p);
|
|
3170
|
+
return readDate(ctx, t, 4, false, start);
|
|
3112
3171
|
}
|
|
3113
|
-
function
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
if (
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3172
|
+
function readDate(ctx, str2, type2, unsafeDelim, errPtr, temporalSuffix) {
|
|
3173
|
+
if (ctx.ld) {
|
|
3174
|
+
let date = new TomlDate(str2, type2, unsafeDelim);
|
|
3175
|
+
if (!date.isValid())
|
|
3176
|
+
TomlError.x("invalid date", ctx, errPtr);
|
|
3177
|
+
return date;
|
|
3178
|
+
}
|
|
3179
|
+
try {
|
|
3180
|
+
if (temporalSuffix)
|
|
3181
|
+
str2 += temporalSuffix;
|
|
3182
|
+
switch (type2) {
|
|
3183
|
+
case 1:
|
|
3184
|
+
return Temporal.ZonedDateTime.from(str2);
|
|
3185
|
+
case 2:
|
|
3186
|
+
return Temporal.PlainDateTime.from(str2);
|
|
3187
|
+
case 3:
|
|
3188
|
+
return Temporal.PlainDate.from(str2);
|
|
3189
|
+
case 4:
|
|
3190
|
+
return Temporal.PlainTime.from(str2);
|
|
3131
3191
|
}
|
|
3132
|
-
|
|
3133
|
-
|
|
3192
|
+
} catch (e) {
|
|
3193
|
+
TomlError.x(e instanceof Error ? e.message : "" + e, ctx, errPtr);
|
|
3134
3194
|
}
|
|
3135
|
-
state.tag = _tag;
|
|
3136
|
-
state.dump = "{" + _result + "}";
|
|
3137
3195
|
}
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
pairBuffer = "";
|
|
3149
|
-
if (!compact || _result !== "") {
|
|
3150
|
-
pairBuffer += generateNextLine(state, level);
|
|
3151
|
-
}
|
|
3152
|
-
objectKey = objectKeyList[index];
|
|
3153
|
-
objectValue = object[objectKey];
|
|
3154
|
-
if (state.replacer) {
|
|
3155
|
-
objectValue = state.replacer.call(object, objectKey, objectValue);
|
|
3196
|
+
|
|
3197
|
+
// node_modules/smol-toml/dist/util.js
|
|
3198
|
+
function skipComment(ctx) {
|
|
3199
|
+
for (; ctx.p < ctx.s.length; ctx.p++) {
|
|
3200
|
+
let c = ctx.s.charCodeAt(ctx.p);
|
|
3201
|
+
if (c === 10)
|
|
3202
|
+
break;
|
|
3203
|
+
if (c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) {
|
|
3204
|
+
ctx.p++;
|
|
3205
|
+
break;
|
|
3156
3206
|
}
|
|
3157
|
-
if (
|
|
3158
|
-
|
|
3207
|
+
if (c < 32 && c !== 9 || c === 127) {
|
|
3208
|
+
TomlError.x("control characters are not allowed in comments", ctx);
|
|
3159
3209
|
}
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3210
|
+
}
|
|
3211
|
+
}
|
|
3212
|
+
function skipVoid(ctx, banNewLines, banComments) {
|
|
3213
|
+
let c;
|
|
3214
|
+
while (ctx.p < ctx.s.length) {
|
|
3215
|
+
while (ctx.p < ctx.s.length && ((c = ctx.s.charCodeAt(ctx.p)) === 32 || c === 9 || !banNewLines && (c === 10 || c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)))
|
|
3216
|
+
ctx.p++;
|
|
3217
|
+
if (banComments || c !== 35)
|
|
3218
|
+
break;
|
|
3219
|
+
skipComment(ctx);
|
|
3220
|
+
}
|
|
3221
|
+
}
|
|
3222
|
+
|
|
3223
|
+
// node_modules/smol-toml/dist/struct.js
|
|
3224
|
+
function parseKey(ctx, end = 61) {
|
|
3225
|
+
let startPtr;
|
|
3226
|
+
let state = 0;
|
|
3227
|
+
let parsed = [];
|
|
3228
|
+
let sliceStart;
|
|
3229
|
+
let c = ctx.s.charCodeAt(startPtr = ctx.p);
|
|
3230
|
+
do {
|
|
3231
|
+
if (c === end) {
|
|
3232
|
+
if (!state)
|
|
3233
|
+
TomlError.x("unexpected end of key", ctx);
|
|
3234
|
+
if (state === 1)
|
|
3235
|
+
parsed.push(ctx.s.slice(sliceStart, ctx.p));
|
|
3236
|
+
return ctx.p++, parsed;
|
|
3237
|
+
} else if (c === 46) {
|
|
3238
|
+
if (!state)
|
|
3239
|
+
TomlError.x("illegal empty bare key", ctx);
|
|
3240
|
+
if (state === 1)
|
|
3241
|
+
parsed.push(ctx.s.slice(sliceStart, ctx.p));
|
|
3242
|
+
state = 0;
|
|
3243
|
+
} else if (!state && (c === 34 || c === 39)) {
|
|
3244
|
+
if (c === ctx.s.charCodeAt(ctx.p + 1) && c === ctx.s.charCodeAt(ctx.p + 2))
|
|
3245
|
+
TomlError.x("illegal quoted key: multiline strings are not allowed", ctx);
|
|
3246
|
+
parsed.push(parseString(ctx));
|
|
3247
|
+
state = 2;
|
|
3248
|
+
ctx.p--;
|
|
3249
|
+
} else if (c === 32 || c === 9) {
|
|
3250
|
+
if (state === 1) {
|
|
3251
|
+
parsed.push(ctx.s.slice(sliceStart, ctx.p));
|
|
3252
|
+
state = 2;
|
|
3166
3253
|
}
|
|
3254
|
+
} else if (state === 2 || c < 48 && c !== 45 || c > 57 && c < 65 || c > 90 && c < 97 && c !== 95 || c > 122) {
|
|
3255
|
+
TomlError.x("illegal character in key", ctx);
|
|
3256
|
+
} else if (!state) {
|
|
3257
|
+
state = 1;
|
|
3258
|
+
sliceStart = ctx.p;
|
|
3167
3259
|
}
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
pairBuffer += generateNextLine(state, level);
|
|
3171
|
-
}
|
|
3172
|
-
if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
|
|
3173
|
-
continue;
|
|
3174
|
-
}
|
|
3175
|
-
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
3176
|
-
pairBuffer += ":";
|
|
3177
|
-
} else {
|
|
3178
|
-
pairBuffer += ": ";
|
|
3179
|
-
}
|
|
3180
|
-
pairBuffer += state.dump;
|
|
3181
|
-
_result += pairBuffer;
|
|
3182
|
-
}
|
|
3183
|
-
state.tag = _tag;
|
|
3184
|
-
state.dump = _result || "{}";
|
|
3260
|
+
} while (c = ctx.s.charCodeAt(++ctx.p));
|
|
3261
|
+
TomlError.x("incomplete key-value: cannot find end of key", ctx, startPtr);
|
|
3185
3262
|
}
|
|
3186
|
-
function
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3263
|
+
function parseInlineTable(ctx) {
|
|
3264
|
+
let startPtr = ctx.p++;
|
|
3265
|
+
let res = /* @__PURE__ */ Object.create(null);
|
|
3266
|
+
let seen = /* @__PURE__ */ new Set();
|
|
3267
|
+
let c;
|
|
3268
|
+
while (ctx.p < ctx.s.length) {
|
|
3269
|
+
skipVoid(ctx);
|
|
3270
|
+
if ((c = ctx.s.charCodeAt(ctx.p)) === 125) {
|
|
3271
|
+
ctx.p++;
|
|
3272
|
+
return res;
|
|
3273
|
+
}
|
|
3274
|
+
let k;
|
|
3275
|
+
let t = res;
|
|
3276
|
+
let hasOwn = false;
|
|
3277
|
+
let errPtr = ctx.p;
|
|
3278
|
+
let key = parseKey(ctx);
|
|
3279
|
+
for (let i2 = 0; i2 < key.length; i2++) {
|
|
3280
|
+
if (i2)
|
|
3281
|
+
t = hasOwn ? t[k] : t[k] = /* @__PURE__ */ Object.create(null);
|
|
3282
|
+
k = key[i2];
|
|
3283
|
+
if ((hasOwn = Object.hasOwn(t, k)) && (typeof t[k] !== "object" || seen.has(t[k]))) {
|
|
3284
|
+
TomlError.x("trying to redefine an already defined value", ctx, errPtr);
|
|
3200
3285
|
}
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
} else if (_hasOwnProperty.call(type2.represent, style)) {
|
|
3206
|
-
_result = type2.represent[style](object, style);
|
|
3207
|
-
} else {
|
|
3208
|
-
throw new exception("!<" + type2.tag + '> tag resolver accepts not "' + style + '" style');
|
|
3209
|
-
}
|
|
3210
|
-
state.dump = _result;
|
|
3286
|
+
let unsafe = k === "__proto__";
|
|
3287
|
+
if (ctx.uk && (unsafe || k === "constructor")) {
|
|
3288
|
+
t = ctx.uk !== 1 && TomlError.x("document contains an unsafe property", ctx, errPtr);
|
|
3289
|
+
break;
|
|
3211
3290
|
}
|
|
3212
|
-
|
|
3291
|
+
if (!hasOwn && unsafe) {
|
|
3292
|
+
Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
|
|
3293
|
+
}
|
|
3294
|
+
}
|
|
3295
|
+
if (hasOwn) {
|
|
3296
|
+
TomlError.x("trying to redefine an already defined value", ctx, errPtr);
|
|
3297
|
+
}
|
|
3298
|
+
skipVoid(ctx, true, true);
|
|
3299
|
+
let value = extractValue(
|
|
3300
|
+
ctx,
|
|
3301
|
+
125
|
|
3302
|
+
/* } */
|
|
3303
|
+
);
|
|
3304
|
+
if (t && typeof (t[k] = value) === "object")
|
|
3305
|
+
seen.add(value);
|
|
3306
|
+
skipVoid(ctx);
|
|
3307
|
+
if ((c = ctx.s.charCodeAt(ctx.p++)) === 125) {
|
|
3308
|
+
return res;
|
|
3213
3309
|
}
|
|
3310
|
+
if (c !== 44)
|
|
3311
|
+
TomlError.x("expected comma or end of structure", ctx, ctx.p - 1);
|
|
3214
3312
|
}
|
|
3215
|
-
|
|
3313
|
+
TomlError.x("unfinished table", ctx, startPtr);
|
|
3216
3314
|
}
|
|
3217
|
-
function
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
if (block) {
|
|
3227
|
-
block = state.flowLevel < 0 || state.flowLevel > level;
|
|
3228
|
-
}
|
|
3229
|
-
var objectOrArray = type2 === "[object Object]" || type2 === "[object Array]", duplicateIndex, duplicate;
|
|
3230
|
-
if (objectOrArray) {
|
|
3231
|
-
duplicateIndex = state.duplicates.indexOf(object);
|
|
3232
|
-
duplicate = duplicateIndex !== -1;
|
|
3233
|
-
}
|
|
3234
|
-
if (state.tag !== null && state.tag !== "?" || duplicate || state.indent !== 2 && level > 0) {
|
|
3235
|
-
compact = false;
|
|
3236
|
-
}
|
|
3237
|
-
if (duplicate && state.usedDuplicates[duplicateIndex]) {
|
|
3238
|
-
state.dump = "*ref_" + duplicateIndex;
|
|
3239
|
-
} else {
|
|
3240
|
-
if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
|
|
3241
|
-
state.usedDuplicates[duplicateIndex] = true;
|
|
3315
|
+
function parseArray(ctx) {
|
|
3316
|
+
let startPtr = ctx.p++;
|
|
3317
|
+
let res = [];
|
|
3318
|
+
let c;
|
|
3319
|
+
while (ctx.p < ctx.s.length) {
|
|
3320
|
+
skipVoid(ctx);
|
|
3321
|
+
if ((c = ctx.s.charCodeAt(ctx.p)) === 93) {
|
|
3322
|
+
ctx.p++;
|
|
3323
|
+
return res;
|
|
3242
3324
|
}
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3325
|
+
res.push(extractValue(
|
|
3326
|
+
ctx,
|
|
3327
|
+
93
|
|
3328
|
+
/* ] */
|
|
3329
|
+
));
|
|
3330
|
+
skipVoid(ctx);
|
|
3331
|
+
if ((c = ctx.s.charCodeAt(ctx.p++)) === 93) {
|
|
3332
|
+
return res;
|
|
3333
|
+
}
|
|
3334
|
+
if (c !== 44)
|
|
3335
|
+
TomlError.x("expected comma or end of structure", ctx, ctx.p - 1);
|
|
3336
|
+
}
|
|
3337
|
+
TomlError.x("unfinished array", ctx, startPtr);
|
|
3338
|
+
}
|
|
3339
|
+
|
|
3340
|
+
// node_modules/smol-toml/dist/parse.js
|
|
3341
|
+
function peekTable(ctx, key, table, meta, type2) {
|
|
3342
|
+
let t = table;
|
|
3343
|
+
let m = meta;
|
|
3344
|
+
let k;
|
|
3345
|
+
let hasOwn = false;
|
|
3346
|
+
let state;
|
|
3347
|
+
for (let i2 = 0; i2 < key.length; i2++) {
|
|
3348
|
+
if (i2) {
|
|
3349
|
+
t = hasOwn ? t[k] : t[k] = /* @__PURE__ */ Object.create(null);
|
|
3350
|
+
m = (state = m[k]).c;
|
|
3351
|
+
if (type2 === 0 && (state.t === 1 || state.t === 2)) {
|
|
3352
|
+
return null;
|
|
3270
3353
|
}
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3354
|
+
if (state.t === 2) {
|
|
3355
|
+
let l = t.length - 1;
|
|
3356
|
+
t = t[l];
|
|
3357
|
+
m = m[l].c;
|
|
3274
3358
|
}
|
|
3275
|
-
} else if (type2 === "[object Undefined]") {
|
|
3276
|
-
return false;
|
|
3277
|
-
} else {
|
|
3278
|
-
if (state.skipInvalid) return false;
|
|
3279
|
-
throw new exception("unacceptable kind of an object to dump " + type2);
|
|
3280
3359
|
}
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3360
|
+
k = key[i2];
|
|
3361
|
+
if ((hasOwn = Object.hasOwn(t, k)) && m[k]?.t === 0 && m[k]?.d) {
|
|
3362
|
+
return null;
|
|
3363
|
+
}
|
|
3364
|
+
if (!hasOwn) {
|
|
3365
|
+
let unsafe = k === "__proto__";
|
|
3366
|
+
if (ctx.uk && (unsafe || k === "constructor"))
|
|
3367
|
+
return false;
|
|
3368
|
+
if (unsafe) {
|
|
3369
|
+
Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
|
|
3370
|
+
Object.defineProperty(m, k, { enumerable: true, configurable: true, writable: true });
|
|
3291
3371
|
}
|
|
3292
|
-
|
|
3372
|
+
m[k] = {
|
|
3373
|
+
t: i2 < key.length - 1 && type2 === 2 ? 3 : type2,
|
|
3374
|
+
d: false,
|
|
3375
|
+
i: 0,
|
|
3376
|
+
c: /* @__PURE__ */ Object.create(null)
|
|
3377
|
+
};
|
|
3293
3378
|
}
|
|
3294
3379
|
}
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
var objects = [], duplicatesIndexes = [], index, length;
|
|
3299
|
-
inspectNode(object, objects, duplicatesIndexes);
|
|
3300
|
-
for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {
|
|
3301
|
-
state.duplicates.push(objects[duplicatesIndexes[index]]);
|
|
3380
|
+
state = m[k];
|
|
3381
|
+
if (state.t !== type2 && !(type2 === 1 && state.t === 3)) {
|
|
3382
|
+
return null;
|
|
3302
3383
|
}
|
|
3303
|
-
|
|
3384
|
+
if (type2 === 2) {
|
|
3385
|
+
if (!state.d) {
|
|
3386
|
+
state.d = true;
|
|
3387
|
+
t[k] = [];
|
|
3388
|
+
}
|
|
3389
|
+
t[k].push(t = /* @__PURE__ */ Object.create(null));
|
|
3390
|
+
state.c[state.i++] = state = { t: 1, d: false, i: 0, c: /* @__PURE__ */ Object.create(null) };
|
|
3391
|
+
}
|
|
3392
|
+
if (state.d) {
|
|
3393
|
+
return null;
|
|
3394
|
+
}
|
|
3395
|
+
state.d = true;
|
|
3396
|
+
if (type2 === 1) {
|
|
3397
|
+
t = hasOwn ? t[k] : t[k] = /* @__PURE__ */ Object.create(null);
|
|
3398
|
+
} else if (type2 === 0 && hasOwn) {
|
|
3399
|
+
return null;
|
|
3400
|
+
}
|
|
3401
|
+
return [k, t, state.c];
|
|
3304
3402
|
}
|
|
3305
|
-
function
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3403
|
+
function validateTablePeek(ctx, peek, ptr) {
|
|
3404
|
+
if (peek === null || ctx.uk === 2)
|
|
3405
|
+
TomlError.x(peek === null ? "trying to redefine an already defined table or value" : "document contains an unsafe property", ctx, ptr);
|
|
3406
|
+
}
|
|
3407
|
+
function parse(toml, options = {}) {
|
|
3408
|
+
let ctx = {
|
|
3409
|
+
s: toml,
|
|
3410
|
+
p: 0,
|
|
3411
|
+
d: options.maxDepth ?? 1e3,
|
|
3412
|
+
bi: options.integersAsBigInt ?? false,
|
|
3413
|
+
ld: options.useLegacyDate ?? true,
|
|
3414
|
+
uk: options.unsafeKeyBehaviour === "throw" ? 2 : options.unsafeKeyBehaviour === "drop" ? 1 : 0
|
|
3415
|
+
};
|
|
3416
|
+
let res = /* @__PURE__ */ Object.create(null);
|
|
3417
|
+
let meta = /* @__PURE__ */ Object.create(null);
|
|
3418
|
+
let tmp;
|
|
3419
|
+
let skipping = false;
|
|
3420
|
+
let tbl = res;
|
|
3421
|
+
let m = meta;
|
|
3422
|
+
if (toml.charCodeAt(0) === 65279)
|
|
3423
|
+
ctx.p++;
|
|
3424
|
+
skipVoid(ctx);
|
|
3425
|
+
while (ctx.p < toml.length) {
|
|
3426
|
+
if (toml.charCodeAt(ctx.p) === 91) {
|
|
3427
|
+
let isTableArray = toml.charCodeAt(++ctx.p) === 91;
|
|
3428
|
+
tmp = ctx.p += +isTableArray;
|
|
3429
|
+
skipping = false;
|
|
3430
|
+
let k = parseKey(
|
|
3431
|
+
ctx,
|
|
3432
|
+
93
|
|
3433
|
+
/* ] */
|
|
3434
|
+
);
|
|
3435
|
+
if (isTableArray) {
|
|
3436
|
+
if (toml.charCodeAt(ctx.p) !== 93) {
|
|
3437
|
+
TomlError.x("expected end of table array declaration", ctx);
|
|
3318
3438
|
}
|
|
3439
|
+
ctx.p++;
|
|
3440
|
+
}
|
|
3441
|
+
let p = peekTable(
|
|
3442
|
+
ctx,
|
|
3443
|
+
k,
|
|
3444
|
+
res,
|
|
3445
|
+
meta,
|
|
3446
|
+
isTableArray ? 2 : 1
|
|
3447
|
+
/* Type.EXPLICIT */
|
|
3448
|
+
);
|
|
3449
|
+
if (!p) {
|
|
3450
|
+
validateTablePeek(ctx, p, tmp);
|
|
3451
|
+
skipping = true;
|
|
3319
3452
|
} else {
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);
|
|
3323
|
-
}
|
|
3453
|
+
m = p[2];
|
|
3454
|
+
tbl = p[1];
|
|
3324
3455
|
}
|
|
3456
|
+
} else {
|
|
3457
|
+
tmp = ctx.p;
|
|
3458
|
+
let k = parseKey(ctx);
|
|
3459
|
+
let p = peekTable(
|
|
3460
|
+
ctx,
|
|
3461
|
+
k,
|
|
3462
|
+
tbl,
|
|
3463
|
+
m,
|
|
3464
|
+
0
|
|
3465
|
+
/* Type.DOTTED */
|
|
3466
|
+
);
|
|
3467
|
+
if (!p && !skipping)
|
|
3468
|
+
validateTablePeek(ctx, p, tmp);
|
|
3469
|
+
skipVoid(ctx, true, true);
|
|
3470
|
+
let v = extractValue(ctx, void 0);
|
|
3471
|
+
if (p && !skipping)
|
|
3472
|
+
p[1][p[0]] = v;
|
|
3325
3473
|
}
|
|
3474
|
+
skipVoid(ctx, true);
|
|
3475
|
+
if (ctx.p < toml.length && (tmp = toml.charCodeAt(ctx.p)) !== 10 && (tmp !== 13 || toml.charCodeAt(ctx.p + 1) !== 10)) {
|
|
3476
|
+
TomlError.x("each key-value declaration must be followed by an end-of-line", ctx);
|
|
3477
|
+
}
|
|
3478
|
+
skipVoid(ctx);
|
|
3326
3479
|
}
|
|
3480
|
+
return res;
|
|
3327
3481
|
}
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
}
|
|
3336
|
-
if (writeNode(state, 0, value, true, true)) return state.dump + "\n";
|
|
3337
|
-
return "";
|
|
3338
|
-
}
|
|
3339
|
-
var dump_1 = dump$1;
|
|
3340
|
-
var dumper = {
|
|
3341
|
-
dump: dump_1
|
|
3342
|
-
};
|
|
3343
|
-
function renamed(from, to) {
|
|
3344
|
-
return function() {
|
|
3345
|
-
throw new Error("Function yaml." + from + " is removed in js-yaml 4. Use yaml." + to + " instead, which is now safe by default.");
|
|
3346
|
-
};
|
|
3347
|
-
}
|
|
3348
|
-
var Type = type;
|
|
3349
|
-
var Schema = schema;
|
|
3350
|
-
var FAILSAFE_SCHEMA = failsafe;
|
|
3351
|
-
var JSON_SCHEMA = json;
|
|
3352
|
-
var CORE_SCHEMA = core;
|
|
3353
|
-
var DEFAULT_SCHEMA = _default;
|
|
3354
|
-
var load = loader.load;
|
|
3355
|
-
var loadAll = loader.loadAll;
|
|
3356
|
-
var dump = dumper.dump;
|
|
3357
|
-
var YAMLException = exception;
|
|
3358
|
-
var types = {
|
|
3359
|
-
binary,
|
|
3360
|
-
float,
|
|
3361
|
-
map,
|
|
3362
|
-
null: _null,
|
|
3363
|
-
pairs,
|
|
3364
|
-
set,
|
|
3365
|
-
timestamp,
|
|
3366
|
-
bool,
|
|
3367
|
-
int,
|
|
3368
|
-
merge,
|
|
3369
|
-
omap,
|
|
3370
|
-
seq,
|
|
3371
|
-
str
|
|
3372
|
-
};
|
|
3373
|
-
var safeLoad = renamed("safeLoad", "load");
|
|
3374
|
-
var safeLoadAll = renamed("safeLoadAll", "loadAll");
|
|
3375
|
-
var safeDump = renamed("safeDump", "dump");
|
|
3376
|
-
var jsYaml = {
|
|
3377
|
-
Type,
|
|
3378
|
-
Schema,
|
|
3379
|
-
FAILSAFE_SCHEMA,
|
|
3380
|
-
JSON_SCHEMA,
|
|
3381
|
-
CORE_SCHEMA,
|
|
3382
|
-
DEFAULT_SCHEMA,
|
|
3383
|
-
load,
|
|
3384
|
-
loadAll,
|
|
3385
|
-
dump,
|
|
3386
|
-
YAMLException,
|
|
3387
|
-
types,
|
|
3388
|
-
safeLoad,
|
|
3389
|
-
safeLoadAll,
|
|
3390
|
-
safeDump
|
|
3391
|
-
};
|
|
3482
|
+
|
|
3483
|
+
// node_modules/smol-toml/dist/stringify.js
|
|
3484
|
+
var HAS_WELLFORMED = !!"".isWellFormed;
|
|
3485
|
+
|
|
3486
|
+
// src/data.ts
|
|
3487
|
+
import fs4 from "node:fs";
|
|
3488
|
+
import path4 from "node:path";
|
|
3392
3489
|
|
|
3393
3490
|
// src/diagnostics.ts
|
|
3394
|
-
import
|
|
3395
|
-
import
|
|
3491
|
+
import fs3 from "node:fs";
|
|
3492
|
+
import path3 from "node:path";
|
|
3396
3493
|
|
|
3397
3494
|
// src/equivalents.ts
|
|
3398
|
-
import
|
|
3399
|
-
import
|
|
3495
|
+
import fs2 from "node:fs";
|
|
3496
|
+
import path2 from "node:path";
|
|
3400
3497
|
var SERVE = "ssqch's dev server is `ssqch serve`: it builds, watches and reloads the browser.";
|
|
3401
3498
|
var TABLE = [
|
|
3402
3499
|
// Commands.
|
|
@@ -3498,15 +3595,15 @@ var OTHER_CONFIGS = [
|
|
|
3498
3595
|
[".vitepress/config.js", "VitePress", null, "from-component-frameworks.md"]
|
|
3499
3596
|
];
|
|
3500
3597
|
function otherGenerator(root) {
|
|
3501
|
-
const
|
|
3598
|
+
const isFile2 = (file2) => fs2.statSync(path2.join(root, file2), { throwIfNoEntry: false })?.isFile() ?? false;
|
|
3502
3599
|
const read = (file2) => {
|
|
3503
3600
|
try {
|
|
3504
|
-
return
|
|
3601
|
+
return fs2.readFileSync(path2.join(root, file2), "utf8");
|
|
3505
3602
|
} catch {
|
|
3506
3603
|
return void 0;
|
|
3507
3604
|
}
|
|
3508
3605
|
};
|
|
3509
|
-
let found = OTHER_CONFIGS.find(([file2]) =>
|
|
3606
|
+
let found = OTHER_CONFIGS.find(([file2]) => isFile2(file2));
|
|
3510
3607
|
if (!found) {
|
|
3511
3608
|
const toml = read("config.toml");
|
|
3512
3609
|
if (toml?.includes("base_url")) found = ["config.toml", "Zola", "zola", "from-zola.md"];
|
|
@@ -3627,20 +3724,20 @@ var Locator = class {
|
|
|
3627
3724
|
name = name.replace(/^["'`]+|["'`]+$/g, "");
|
|
3628
3725
|
if (name === "") return void 0;
|
|
3629
3726
|
for (const dir of this.dirs) {
|
|
3630
|
-
let file =
|
|
3631
|
-
if (!
|
|
3727
|
+
let file = path3.resolve(dir, name);
|
|
3728
|
+
if (!fs3.statSync(file, { throwIfNoEntry: false })?.isFile()) continue;
|
|
3632
3729
|
file = realPath(file);
|
|
3633
|
-
const rel =
|
|
3634
|
-
const outside = rel === ".." || rel.startsWith(`..${
|
|
3635
|
-
const
|
|
3636
|
-
return { path: file, shown };
|
|
3730
|
+
const rel = path3.relative(realPath(this.root), file);
|
|
3731
|
+
const outside = rel === ".." || rel.startsWith(`..${path3.sep}`) || path3.isAbsolute(rel);
|
|
3732
|
+
const shown2 = (outside ? file : rel).split(path3.sep).join("/");
|
|
3733
|
+
return { path: file, shown: shown2 };
|
|
3637
3734
|
}
|
|
3638
3735
|
return void 0;
|
|
3639
3736
|
}
|
|
3640
3737
|
};
|
|
3641
3738
|
function linesBeforeBody(file) {
|
|
3642
3739
|
try {
|
|
3643
|
-
const src =
|
|
3740
|
+
const src = fs3.readFileSync(file, "utf8");
|
|
3644
3741
|
const { body } = parseFrontMatter(src);
|
|
3645
3742
|
return src.slice(0, src.length - body.length).split("\n").length - 1;
|
|
3646
3743
|
} catch {
|
|
@@ -3728,8 +3825,8 @@ function fileLines(message, at) {
|
|
|
3728
3825
|
function frames(e, fallback, at) {
|
|
3729
3826
|
const found = [];
|
|
3730
3827
|
for (const problem of fromError(e, fallback, at)) {
|
|
3731
|
-
const
|
|
3732
|
-
if (
|
|
3828
|
+
const shown2 = frame(problem, at);
|
|
3829
|
+
if (shown2 !== void 0 && !found.includes(shown2)) found.push(shown2);
|
|
3733
3830
|
if (found.length === 3) break;
|
|
3734
3831
|
}
|
|
3735
3832
|
return found.length ? found.join("\n\n") : void 0;
|
|
@@ -3739,7 +3836,7 @@ function frame(problem, at) {
|
|
|
3739
3836
|
if (problem.file === void 0) return void 0;
|
|
3740
3837
|
let source;
|
|
3741
3838
|
try {
|
|
3742
|
-
source =
|
|
3839
|
+
source = fs3.readFileSync(path3.resolve(at.root, problem.file), "utf8");
|
|
3743
3840
|
} catch {
|
|
3744
3841
|
return void 0;
|
|
3745
3842
|
}
|
|
@@ -4239,7 +4336,7 @@ function tomlDateText(d) {
|
|
|
4239
4336
|
return d.toISOString().replace(/\.(\d*?)0+(?=$|Z|[+-]\d\d:\d\d$)/, (_, digits) => digits ? `.${digits}` : "");
|
|
4240
4337
|
}
|
|
4241
4338
|
function readText(file) {
|
|
4242
|
-
return decodeText(
|
|
4339
|
+
return decodeText(fs4.readFileSync(file));
|
|
4243
4340
|
}
|
|
4244
4341
|
var utf8 = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true });
|
|
4245
4342
|
function decodeText(bytes) {
|
|
@@ -4251,7 +4348,7 @@ function decodeText(bytes) {
|
|
|
4251
4348
|
}
|
|
4252
4349
|
var stripBom = (text) => text.charCodeAt(0) === 65279 ? text.slice(1) : text;
|
|
4253
4350
|
function loadStaticDataFile(file) {
|
|
4254
|
-
const ext =
|
|
4351
|
+
const ext = path4.extname(file).slice(1);
|
|
4255
4352
|
const read = () => {
|
|
4256
4353
|
try {
|
|
4257
4354
|
return readText(file);
|
|
@@ -4287,7 +4384,7 @@ function loadStaticDataFile(file) {
|
|
|
4287
4384
|
}
|
|
4288
4385
|
var STATIC_DATA_EXTENSIONS = ["json", "yaml", "yml", "toml"];
|
|
4289
4386
|
function loadDataFile(file, extra) {
|
|
4290
|
-
const ext =
|
|
4387
|
+
const ext = path4.extname(file).slice(1);
|
|
4291
4388
|
if (STATIC_DATA_EXTENSIONS.includes(ext)) return loadStaticDataFile(file);
|
|
4292
4389
|
const load2 = extra.get(ext);
|
|
4293
4390
|
return load2 ? load2(file) : NOT_DATA;
|
|
@@ -4384,6 +4481,21 @@ function utcMs(y, mo, d, h = "0", mi = "0", s = "0", fraction) {
|
|
|
4384
4481
|
}
|
|
4385
4482
|
|
|
4386
4483
|
export {
|
|
4484
|
+
slashes,
|
|
4485
|
+
displayPath,
|
|
4486
|
+
shown,
|
|
4487
|
+
relative,
|
|
4488
|
+
joinAsGiven,
|
|
4489
|
+
parentAsGiven,
|
|
4490
|
+
realPath,
|
|
4491
|
+
isFile,
|
|
4492
|
+
isDir,
|
|
4493
|
+
isInside,
|
|
4494
|
+
compareText,
|
|
4495
|
+
comparePaths,
|
|
4496
|
+
walkFiles,
|
|
4497
|
+
readFollowing,
|
|
4498
|
+
jsYaml,
|
|
4387
4499
|
TomlError,
|
|
4388
4500
|
buildTime,
|
|
4389
4501
|
sourceDateEpoch,
|
|
@@ -4432,4 +4544,4 @@ export {
|
|
|
4432
4544
|
describe,
|
|
4433
4545
|
printError
|
|
4434
4546
|
};
|
|
4435
|
-
/*! For license information please see chunk-
|
|
4547
|
+
/*! For license information please see chunk-JFPLNHEQ.js.LEGAL.txt */
|