@slidev/cli 0.31.1 → 0.31.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{build-WXX7THGM.js → build-5QYEFLVL.js} +11 -11
- package/dist/{build-6XVXRYOT.mjs → build-QLCAUS73.mjs} +3 -3
- package/dist/{chunk-D6ZT4BYV.mjs → chunk-25USV2L5.mjs} +0 -5
- package/dist/{chunk-DQJN3MWP.js → chunk-6FP4S4BJ.js} +4 -4
- package/dist/{chunk-6URMXVHV.mjs → chunk-7HNXF4RI.mjs} +222 -3278
- package/dist/{chunk-T33EPP2B.mjs → chunk-A6EFYWHQ.mjs} +2 -2
- package/dist/{chunk-SJH4ZSSX.mjs → chunk-NKDK3BW7.mjs} +26 -28
- package/dist/{chunk-OVW2G2MH.js → chunk-OYCSUJS7.js} +1 -6
- package/dist/{chunk-W64GQHIH.js → chunk-RQ7QDWD6.js} +80 -82
- package/dist/{chunk-IIMPX7JQ.js → chunk-VNV7XQUU.js} +505 -3561
- package/dist/cli.js +37 -35
- package/dist/cli.mjs +26 -24
- package/dist/{export-7O4RPYTW.mjs → export-RFA6N32W.mjs} +2 -2
- package/dist/{export-HDUCFTTI.js → export-W52T2VBO.js} +5 -5
- package/dist/index.d.ts +9 -68
- package/dist/index.js +7 -7
- package/dist/index.mjs +6 -6
- package/package.json +11 -11
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__commonJS,
|
|
3
3
|
__dirname,
|
|
4
|
-
__export,
|
|
5
4
|
__objRest,
|
|
6
5
|
__privateAdd,
|
|
7
6
|
__privateGet,
|
|
@@ -12,7 +11,7 @@ import {
|
|
|
12
11
|
__toESM,
|
|
13
12
|
init_esm_shims,
|
|
14
13
|
resolveImportPath
|
|
15
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-25USV2L5.mjs";
|
|
16
15
|
|
|
17
16
|
// ../../node_modules/.pnpm/semver@7.3.7/node_modules/semver/internal/constants.js
|
|
18
17
|
var require_constants = __commonJS({
|
|
@@ -373,7 +372,7 @@ var require_parse = __commonJS({
|
|
|
373
372
|
var { re, t } = require_re();
|
|
374
373
|
var SemVer = require_semver();
|
|
375
374
|
var parseOptions = require_parse_options();
|
|
376
|
-
var
|
|
375
|
+
var parse2 = (version3, options) => {
|
|
377
376
|
options = parseOptions(options);
|
|
378
377
|
if (version3 instanceof SemVer) {
|
|
379
378
|
return version3;
|
|
@@ -394,7 +393,7 @@ var require_parse = __commonJS({
|
|
|
394
393
|
return null;
|
|
395
394
|
}
|
|
396
395
|
};
|
|
397
|
-
module.exports =
|
|
396
|
+
module.exports = parse2;
|
|
398
397
|
}
|
|
399
398
|
});
|
|
400
399
|
|
|
@@ -402,9 +401,9 @@ var require_parse = __commonJS({
|
|
|
402
401
|
var require_valid = __commonJS({
|
|
403
402
|
"../../node_modules/.pnpm/semver@7.3.7/node_modules/semver/functions/valid.js"(exports, module) {
|
|
404
403
|
init_esm_shims();
|
|
405
|
-
var
|
|
404
|
+
var parse2 = require_parse();
|
|
406
405
|
var valid = (version3, options) => {
|
|
407
|
-
const v =
|
|
406
|
+
const v = parse2(version3, options);
|
|
408
407
|
return v ? v.version : null;
|
|
409
408
|
};
|
|
410
409
|
module.exports = valid;
|
|
@@ -415,9 +414,9 @@ var require_valid = __commonJS({
|
|
|
415
414
|
var require_clean = __commonJS({
|
|
416
415
|
"../../node_modules/.pnpm/semver@7.3.7/node_modules/semver/functions/clean.js"(exports, module) {
|
|
417
416
|
init_esm_shims();
|
|
418
|
-
var
|
|
417
|
+
var parse2 = require_parse();
|
|
419
418
|
var clean = (version3, options) => {
|
|
420
|
-
const s =
|
|
419
|
+
const s = parse2(version3.trim().replace(/^[=v]+/, ""), options);
|
|
421
420
|
return s ? s.version : null;
|
|
422
421
|
};
|
|
423
422
|
module.exports = clean;
|
|
@@ -468,14 +467,14 @@ var require_eq = __commonJS({
|
|
|
468
467
|
var require_diff = __commonJS({
|
|
469
468
|
"../../node_modules/.pnpm/semver@7.3.7/node_modules/semver/functions/diff.js"(exports, module) {
|
|
470
469
|
init_esm_shims();
|
|
471
|
-
var
|
|
470
|
+
var parse2 = require_parse();
|
|
472
471
|
var eq = require_eq();
|
|
473
472
|
var diff = (version1, version22) => {
|
|
474
473
|
if (eq(version1, version22)) {
|
|
475
474
|
return null;
|
|
476
475
|
} else {
|
|
477
|
-
const v1 =
|
|
478
|
-
const v2 =
|
|
476
|
+
const v1 = parse2(version1);
|
|
477
|
+
const v2 = parse2(version22);
|
|
479
478
|
const hasPre = v1.prerelease.length || v2.prerelease.length;
|
|
480
479
|
const prefix = hasPre ? "pre" : "";
|
|
481
480
|
const defaultResult = hasPre ? "prerelease" : "";
|
|
@@ -527,9 +526,9 @@ var require_patch = __commonJS({
|
|
|
527
526
|
var require_prerelease = __commonJS({
|
|
528
527
|
"../../node_modules/.pnpm/semver@7.3.7/node_modules/semver/functions/prerelease.js"(exports, module) {
|
|
529
528
|
init_esm_shims();
|
|
530
|
-
var
|
|
529
|
+
var parse2 = require_parse();
|
|
531
530
|
var prerelease = (version3, options) => {
|
|
532
|
-
const parsed =
|
|
531
|
+
const parsed = parse2(version3, options);
|
|
533
532
|
return parsed && parsed.prerelease.length ? parsed.prerelease : null;
|
|
534
533
|
};
|
|
535
534
|
module.exports = prerelease;
|
|
@@ -695,7 +694,7 @@ var require_coerce = __commonJS({
|
|
|
695
694
|
"../../node_modules/.pnpm/semver@7.3.7/node_modules/semver/functions/coerce.js"(exports, module) {
|
|
696
695
|
init_esm_shims();
|
|
697
696
|
var SemVer = require_semver();
|
|
698
|
-
var
|
|
697
|
+
var parse2 = require_parse();
|
|
699
698
|
var { re, t } = require_re();
|
|
700
699
|
var coerce = (version3, options) => {
|
|
701
700
|
if (version3 instanceof SemVer) {
|
|
@@ -724,7 +723,7 @@ var require_coerce = __commonJS({
|
|
|
724
723
|
if (match === null) {
|
|
725
724
|
return null;
|
|
726
725
|
}
|
|
727
|
-
return
|
|
726
|
+
return parse2(`${match[2]}.${match[3] || "0"}.${match[4] || "0"}`, options);
|
|
728
727
|
};
|
|
729
728
|
module.exports = coerce;
|
|
730
729
|
}
|
|
@@ -1389,28 +1388,28 @@ var require_range = __commonJS({
|
|
|
1389
1388
|
"../../node_modules/.pnpm/semver@7.3.7/node_modules/semver/classes/range.js"(exports, module) {
|
|
1390
1389
|
init_esm_shims();
|
|
1391
1390
|
var Range = class {
|
|
1392
|
-
constructor(
|
|
1391
|
+
constructor(range, options) {
|
|
1393
1392
|
options = parseOptions(options);
|
|
1394
|
-
if (
|
|
1395
|
-
if (
|
|
1396
|
-
return
|
|
1393
|
+
if (range instanceof Range) {
|
|
1394
|
+
if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
|
|
1395
|
+
return range;
|
|
1397
1396
|
} else {
|
|
1398
|
-
return new Range(
|
|
1397
|
+
return new Range(range.raw, options);
|
|
1399
1398
|
}
|
|
1400
1399
|
}
|
|
1401
|
-
if (
|
|
1402
|
-
this.raw =
|
|
1403
|
-
this.set = [[
|
|
1400
|
+
if (range instanceof Comparator) {
|
|
1401
|
+
this.raw = range.value;
|
|
1402
|
+
this.set = [[range]];
|
|
1404
1403
|
this.format();
|
|
1405
1404
|
return this;
|
|
1406
1405
|
}
|
|
1407
1406
|
this.options = options;
|
|
1408
1407
|
this.loose = !!options.loose;
|
|
1409
1408
|
this.includePrerelease = !!options.includePrerelease;
|
|
1410
|
-
this.raw =
|
|
1411
|
-
this.set =
|
|
1409
|
+
this.raw = range;
|
|
1410
|
+
this.set = range.split("||").map((r) => this.parseRange(r.trim())).filter((c2) => c2.length);
|
|
1412
1411
|
if (!this.set.length) {
|
|
1413
|
-
throw new TypeError(`Invalid SemVer Range: ${
|
|
1412
|
+
throw new TypeError(`Invalid SemVer Range: ${range}`);
|
|
1414
1413
|
}
|
|
1415
1414
|
if (this.set.length > 1) {
|
|
1416
1415
|
const first = this.set[0];
|
|
@@ -1437,24 +1436,24 @@ var require_range = __commonJS({
|
|
|
1437
1436
|
toString() {
|
|
1438
1437
|
return this.range;
|
|
1439
1438
|
}
|
|
1440
|
-
parseRange(
|
|
1441
|
-
|
|
1439
|
+
parseRange(range) {
|
|
1440
|
+
range = range.trim();
|
|
1442
1441
|
const memoOpts = Object.keys(this.options).join(",");
|
|
1443
|
-
const memoKey = `parseRange:${memoOpts}:${
|
|
1442
|
+
const memoKey = `parseRange:${memoOpts}:${range}`;
|
|
1444
1443
|
const cached = cache.get(memoKey);
|
|
1445
1444
|
if (cached) {
|
|
1446
1445
|
return cached;
|
|
1447
1446
|
}
|
|
1448
1447
|
const loose = this.options.loose;
|
|
1449
1448
|
const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
|
|
1450
|
-
|
|
1451
|
-
debug2("hyphen replace",
|
|
1452
|
-
|
|
1453
|
-
debug2("comparator trim",
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
let rangeList =
|
|
1449
|
+
range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
|
|
1450
|
+
debug2("hyphen replace", range);
|
|
1451
|
+
range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
|
|
1452
|
+
debug2("comparator trim", range);
|
|
1453
|
+
range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
|
|
1454
|
+
range = range.replace(re[t.CARETTRIM], caretTrimReplace);
|
|
1455
|
+
range = range.split(/\s+/).join(" ");
|
|
1456
|
+
let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
|
|
1458
1457
|
if (loose) {
|
|
1459
1458
|
rangeList = rangeList.filter((comp) => {
|
|
1460
1459
|
debug2("loose invalid filter", comp, this.options);
|
|
@@ -1477,12 +1476,12 @@ var require_range = __commonJS({
|
|
|
1477
1476
|
cache.set(memoKey, result);
|
|
1478
1477
|
return result;
|
|
1479
1478
|
}
|
|
1480
|
-
intersects(
|
|
1481
|
-
if (!(
|
|
1479
|
+
intersects(range, options) {
|
|
1480
|
+
if (!(range instanceof Range)) {
|
|
1482
1481
|
throw new TypeError("a Range is required");
|
|
1483
1482
|
}
|
|
1484
1483
|
return this.set.some((thisComparators) => {
|
|
1485
|
-
return isSatisfiable(thisComparators, options) &&
|
|
1484
|
+
return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
|
|
1486
1485
|
return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
|
|
1487
1486
|
return rangeComparators.every((rangeComparator) => {
|
|
1488
1487
|
return thisComparator.intersects(rangeComparator, options);
|
|
@@ -1718,20 +1717,20 @@ var require_range = __commonJS({
|
|
|
1718
1717
|
}
|
|
1719
1718
|
return `${from} ${to}`.trim();
|
|
1720
1719
|
};
|
|
1721
|
-
var testSet = (
|
|
1722
|
-
for (let i = 0; i <
|
|
1723
|
-
if (!
|
|
1720
|
+
var testSet = (set, version3, options) => {
|
|
1721
|
+
for (let i = 0; i < set.length; i++) {
|
|
1722
|
+
if (!set[i].test(version3)) {
|
|
1724
1723
|
return false;
|
|
1725
1724
|
}
|
|
1726
1725
|
}
|
|
1727
1726
|
if (version3.prerelease.length && !options.includePrerelease) {
|
|
1728
|
-
for (let i = 0; i <
|
|
1729
|
-
debug2(
|
|
1730
|
-
if (
|
|
1727
|
+
for (let i = 0; i < set.length; i++) {
|
|
1728
|
+
debug2(set[i].semver);
|
|
1729
|
+
if (set[i].semver === Comparator.ANY) {
|
|
1731
1730
|
continue;
|
|
1732
1731
|
}
|
|
1733
|
-
if (
|
|
1734
|
-
const allowed =
|
|
1732
|
+
if (set[i].semver.prerelease.length > 0) {
|
|
1733
|
+
const allowed = set[i].semver;
|
|
1735
1734
|
if (allowed.major === version3.major && allowed.minor === version3.minor && allowed.patch === version3.patch) {
|
|
1736
1735
|
return true;
|
|
1737
1736
|
}
|
|
@@ -1851,13 +1850,13 @@ var require_satisfies = __commonJS({
|
|
|
1851
1850
|
"../../node_modules/.pnpm/semver@7.3.7/node_modules/semver/functions/satisfies.js"(exports, module) {
|
|
1852
1851
|
init_esm_shims();
|
|
1853
1852
|
var Range = require_range();
|
|
1854
|
-
var satisfies2 = (version3,
|
|
1853
|
+
var satisfies2 = (version3, range, options) => {
|
|
1855
1854
|
try {
|
|
1856
|
-
|
|
1855
|
+
range = new Range(range, options);
|
|
1857
1856
|
} catch (er) {
|
|
1858
1857
|
return false;
|
|
1859
1858
|
}
|
|
1860
|
-
return
|
|
1859
|
+
return range.test(version3);
|
|
1861
1860
|
};
|
|
1862
1861
|
module.exports = satisfies2;
|
|
1863
1862
|
}
|
|
@@ -1868,7 +1867,7 @@ var require_to_comparators = __commonJS({
|
|
|
1868
1867
|
"../../node_modules/.pnpm/semver@7.3.7/node_modules/semver/ranges/to-comparators.js"(exports, module) {
|
|
1869
1868
|
init_esm_shims();
|
|
1870
1869
|
var Range = require_range();
|
|
1871
|
-
var toComparators = (
|
|
1870
|
+
var toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c2) => c2.value).join(" ").trim().split(" "));
|
|
1872
1871
|
module.exports = toComparators;
|
|
1873
1872
|
}
|
|
1874
1873
|
});
|
|
@@ -1879,12 +1878,12 @@ var require_max_satisfying = __commonJS({
|
|
|
1879
1878
|
init_esm_shims();
|
|
1880
1879
|
var SemVer = require_semver();
|
|
1881
1880
|
var Range = require_range();
|
|
1882
|
-
var maxSatisfying = (versions,
|
|
1881
|
+
var maxSatisfying = (versions, range, options) => {
|
|
1883
1882
|
let max = null;
|
|
1884
1883
|
let maxSV = null;
|
|
1885
1884
|
let rangeObj = null;
|
|
1886
1885
|
try {
|
|
1887
|
-
rangeObj = new Range(
|
|
1886
|
+
rangeObj = new Range(range, options);
|
|
1888
1887
|
} catch (er) {
|
|
1889
1888
|
return null;
|
|
1890
1889
|
}
|
|
@@ -1908,12 +1907,12 @@ var require_min_satisfying = __commonJS({
|
|
|
1908
1907
|
init_esm_shims();
|
|
1909
1908
|
var SemVer = require_semver();
|
|
1910
1909
|
var Range = require_range();
|
|
1911
|
-
var minSatisfying = (versions,
|
|
1910
|
+
var minSatisfying = (versions, range, options) => {
|
|
1912
1911
|
let min = null;
|
|
1913
1912
|
let minSV = null;
|
|
1914
1913
|
let rangeObj = null;
|
|
1915
1914
|
try {
|
|
1916
|
-
rangeObj = new Range(
|
|
1915
|
+
rangeObj = new Range(range, options);
|
|
1917
1916
|
} catch (er) {
|
|
1918
1917
|
return null;
|
|
1919
1918
|
}
|
|
@@ -1938,19 +1937,19 @@ var require_min_version = __commonJS({
|
|
|
1938
1937
|
var SemVer = require_semver();
|
|
1939
1938
|
var Range = require_range();
|
|
1940
1939
|
var gt = require_gt();
|
|
1941
|
-
var minVersion = (
|
|
1942
|
-
|
|
1940
|
+
var minVersion = (range, loose) => {
|
|
1941
|
+
range = new Range(range, loose);
|
|
1943
1942
|
let minver = new SemVer("0.0.0");
|
|
1944
|
-
if (
|
|
1943
|
+
if (range.test(minver)) {
|
|
1945
1944
|
return minver;
|
|
1946
1945
|
}
|
|
1947
1946
|
minver = new SemVer("0.0.0-0");
|
|
1948
|
-
if (
|
|
1947
|
+
if (range.test(minver)) {
|
|
1949
1948
|
return minver;
|
|
1950
1949
|
}
|
|
1951
1950
|
minver = null;
|
|
1952
|
-
for (let i = 0; i <
|
|
1953
|
-
const comparators =
|
|
1951
|
+
for (let i = 0; i < range.set.length; ++i) {
|
|
1952
|
+
const comparators = range.set[i];
|
|
1954
1953
|
let setMin = null;
|
|
1955
1954
|
comparators.forEach((comparator) => {
|
|
1956
1955
|
const compver = new SemVer(comparator.semver.version);
|
|
@@ -1979,7 +1978,7 @@ var require_min_version = __commonJS({
|
|
|
1979
1978
|
minver = setMin;
|
|
1980
1979
|
}
|
|
1981
1980
|
}
|
|
1982
|
-
if (minver &&
|
|
1981
|
+
if (minver && range.test(minver)) {
|
|
1983
1982
|
return minver;
|
|
1984
1983
|
}
|
|
1985
1984
|
return null;
|
|
@@ -1993,9 +1992,9 @@ var require_valid2 = __commonJS({
|
|
|
1993
1992
|
"../../node_modules/.pnpm/semver@7.3.7/node_modules/semver/ranges/valid.js"(exports, module) {
|
|
1994
1993
|
init_esm_shims();
|
|
1995
1994
|
var Range = require_range();
|
|
1996
|
-
var validRange = (
|
|
1995
|
+
var validRange = (range, options) => {
|
|
1997
1996
|
try {
|
|
1998
|
-
return new Range(
|
|
1997
|
+
return new Range(range, options).range || "*";
|
|
1999
1998
|
} catch (er) {
|
|
2000
1999
|
return null;
|
|
2001
2000
|
}
|
|
@@ -2017,9 +2016,9 @@ var require_outside = __commonJS({
|
|
|
2017
2016
|
var lt = require_lt();
|
|
2018
2017
|
var lte = require_lte();
|
|
2019
2018
|
var gte = require_gte();
|
|
2020
|
-
var outside = (version3,
|
|
2019
|
+
var outside = (version3, range, hilo, options) => {
|
|
2021
2020
|
version3 = new SemVer(version3, options);
|
|
2022
|
-
|
|
2021
|
+
range = new Range(range, options);
|
|
2023
2022
|
let gtfn, ltefn, ltfn, comp, ecomp;
|
|
2024
2023
|
switch (hilo) {
|
|
2025
2024
|
case ">":
|
|
@@ -2039,11 +2038,11 @@ var require_outside = __commonJS({
|
|
|
2039
2038
|
default:
|
|
2040
2039
|
throw new TypeError('Must provide a hilo val of "<" or ">"');
|
|
2041
2040
|
}
|
|
2042
|
-
if (satisfies2(version3,
|
|
2041
|
+
if (satisfies2(version3, range, options)) {
|
|
2043
2042
|
return false;
|
|
2044
2043
|
}
|
|
2045
|
-
for (let i = 0; i <
|
|
2046
|
-
const comparators =
|
|
2044
|
+
for (let i = 0; i < range.set.length; ++i) {
|
|
2045
|
+
const comparators = range.set[i];
|
|
2047
2046
|
let high = null;
|
|
2048
2047
|
let low = null;
|
|
2049
2048
|
comparators.forEach((comparator) => {
|
|
@@ -2078,7 +2077,7 @@ var require_gtr = __commonJS({
|
|
|
2078
2077
|
"../../node_modules/.pnpm/semver@7.3.7/node_modules/semver/ranges/gtr.js"(exports, module) {
|
|
2079
2078
|
init_esm_shims();
|
|
2080
2079
|
var outside = require_outside();
|
|
2081
|
-
var gtr = (version3,
|
|
2080
|
+
var gtr = (version3, range, options) => outside(version3, range, ">", options);
|
|
2082
2081
|
module.exports = gtr;
|
|
2083
2082
|
}
|
|
2084
2083
|
});
|
|
@@ -2088,7 +2087,7 @@ var require_ltr = __commonJS({
|
|
|
2088
2087
|
"../../node_modules/.pnpm/semver@7.3.7/node_modules/semver/ranges/ltr.js"(exports, module) {
|
|
2089
2088
|
init_esm_shims();
|
|
2090
2089
|
var outside = require_outside();
|
|
2091
|
-
var ltr = (version3,
|
|
2090
|
+
var ltr = (version3, range, options) => outside(version3, range, "<", options);
|
|
2092
2091
|
module.exports = ltr;
|
|
2093
2092
|
}
|
|
2094
2093
|
});
|
|
@@ -2113,13 +2112,13 @@ var require_simplify = __commonJS({
|
|
|
2113
2112
|
init_esm_shims();
|
|
2114
2113
|
var satisfies2 = require_satisfies();
|
|
2115
2114
|
var compare = require_compare();
|
|
2116
|
-
module.exports = (versions,
|
|
2117
|
-
const
|
|
2115
|
+
module.exports = (versions, range, options) => {
|
|
2116
|
+
const set = [];
|
|
2118
2117
|
let first = null;
|
|
2119
2118
|
let prev = null;
|
|
2120
2119
|
const v = versions.sort((a, b) => compare(a, b, options));
|
|
2121
2120
|
for (const version3 of v) {
|
|
2122
|
-
const included = satisfies2(version3,
|
|
2121
|
+
const included = satisfies2(version3, range, options);
|
|
2123
2122
|
if (included) {
|
|
2124
2123
|
prev = version3;
|
|
2125
2124
|
if (!first) {
|
|
@@ -2127,17 +2126,17 @@ var require_simplify = __commonJS({
|
|
|
2127
2126
|
}
|
|
2128
2127
|
} else {
|
|
2129
2128
|
if (prev) {
|
|
2130
|
-
|
|
2129
|
+
set.push([first, prev]);
|
|
2131
2130
|
}
|
|
2132
2131
|
prev = null;
|
|
2133
2132
|
first = null;
|
|
2134
2133
|
}
|
|
2135
2134
|
}
|
|
2136
2135
|
if (first) {
|
|
2137
|
-
|
|
2136
|
+
set.push([first, null]);
|
|
2138
2137
|
}
|
|
2139
2138
|
const ranges = [];
|
|
2140
|
-
for (const [min, max] of
|
|
2139
|
+
for (const [min, max] of set) {
|
|
2141
2140
|
if (min === max) {
|
|
2142
2141
|
ranges.push(min);
|
|
2143
2142
|
} else if (!max && min === v[0]) {
|
|
@@ -2151,8 +2150,8 @@ var require_simplify = __commonJS({
|
|
|
2151
2150
|
}
|
|
2152
2151
|
}
|
|
2153
2152
|
const simplified = ranges.join(" || ");
|
|
2154
|
-
const original = typeof
|
|
2155
|
-
return simplified.length < original.length ? simplified :
|
|
2153
|
+
const original = typeof range.raw === "string" ? range.raw : String(range);
|
|
2154
|
+
return simplified.length < original.length ? simplified : range;
|
|
2156
2155
|
};
|
|
2157
2156
|
}
|
|
2158
2157
|
});
|
|
@@ -2372,3069 +2371,12 @@ var require_semver2 = __commonJS({
|
|
|
2372
2371
|
}
|
|
2373
2372
|
});
|
|
2374
2373
|
|
|
2375
|
-
// ../parser/src/fs.ts
|
|
2376
|
-
var fs_exports = {};
|
|
2377
|
-
__export(fs_exports, {
|
|
2378
|
-
detectFeatures: () => detectFeatures,
|
|
2379
|
-
filterDisabled: () => filterDisabled,
|
|
2380
|
-
load: () => load2,
|
|
2381
|
-
mergeFeatureFlags: () => mergeFeatureFlags,
|
|
2382
|
-
parse: () => parse,
|
|
2383
|
-
parseAspectRatio: () => parseAspectRatio,
|
|
2384
|
-
parseRangeString: () => parseRangeString,
|
|
2385
|
-
parseSlide: () => parseSlide,
|
|
2386
|
-
prettify: () => prettify,
|
|
2387
|
-
prettifySlide: () => prettifySlide,
|
|
2388
|
-
resolveConfig: () => resolveConfig,
|
|
2389
|
-
resolveFonts: () => resolveFonts,
|
|
2390
|
-
save: () => save,
|
|
2391
|
-
saveExternalSlide: () => saveExternalSlide,
|
|
2392
|
-
scanMonacoModules: () => scanMonacoModules,
|
|
2393
|
-
stringify: () => stringify,
|
|
2394
|
-
stringifySlide: () => stringifySlide
|
|
2395
|
-
});
|
|
2396
|
-
init_esm_shims();
|
|
2397
|
-
import { promises as fs } from "fs";
|
|
2398
|
-
import { dirname, resolve } from "path";
|
|
2399
|
-
|
|
2400
|
-
// ../parser/src/core.ts
|
|
2401
|
-
init_esm_shims();
|
|
2402
|
-
|
|
2403
|
-
// ../../node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/dist/js-yaml.mjs
|
|
2404
|
-
init_esm_shims();
|
|
2405
|
-
function isNothing(subject) {
|
|
2406
|
-
return typeof subject === "undefined" || subject === null;
|
|
2407
|
-
}
|
|
2408
|
-
function isObject(subject) {
|
|
2409
|
-
return typeof subject === "object" && subject !== null;
|
|
2410
|
-
}
|
|
2411
|
-
function toArray(sequence) {
|
|
2412
|
-
if (Array.isArray(sequence))
|
|
2413
|
-
return sequence;
|
|
2414
|
-
else if (isNothing(sequence))
|
|
2415
|
-
return [];
|
|
2416
|
-
return [sequence];
|
|
2417
|
-
}
|
|
2418
|
-
function extend(target, source) {
|
|
2419
|
-
var index, length, key, sourceKeys;
|
|
2420
|
-
if (source) {
|
|
2421
|
-
sourceKeys = Object.keys(source);
|
|
2422
|
-
for (index = 0, length = sourceKeys.length; index < length; index += 1) {
|
|
2423
|
-
key = sourceKeys[index];
|
|
2424
|
-
target[key] = source[key];
|
|
2425
|
-
}
|
|
2426
|
-
}
|
|
2427
|
-
return target;
|
|
2428
|
-
}
|
|
2429
|
-
function repeat(string, count) {
|
|
2430
|
-
var result = "", cycle;
|
|
2431
|
-
for (cycle = 0; cycle < count; cycle += 1) {
|
|
2432
|
-
result += string;
|
|
2433
|
-
}
|
|
2434
|
-
return result;
|
|
2435
|
-
}
|
|
2436
|
-
function isNegativeZero(number2) {
|
|
2437
|
-
return number2 === 0 && Number.NEGATIVE_INFINITY === 1 / number2;
|
|
2438
|
-
}
|
|
2439
|
-
var isNothing_1 = isNothing;
|
|
2440
|
-
var isObject_1 = isObject;
|
|
2441
|
-
var toArray_1 = toArray;
|
|
2442
|
-
var repeat_1 = repeat;
|
|
2443
|
-
var isNegativeZero_1 = isNegativeZero;
|
|
2444
|
-
var extend_1 = extend;
|
|
2445
|
-
var common = {
|
|
2446
|
-
isNothing: isNothing_1,
|
|
2447
|
-
isObject: isObject_1,
|
|
2448
|
-
toArray: toArray_1,
|
|
2449
|
-
repeat: repeat_1,
|
|
2450
|
-
isNegativeZero: isNegativeZero_1,
|
|
2451
|
-
extend: extend_1
|
|
2452
|
-
};
|
|
2453
|
-
function formatError(exception2, compact) {
|
|
2454
|
-
var where = "", message = exception2.reason || "(unknown reason)";
|
|
2455
|
-
if (!exception2.mark)
|
|
2456
|
-
return message;
|
|
2457
|
-
if (exception2.mark.name) {
|
|
2458
|
-
where += 'in "' + exception2.mark.name + '" ';
|
|
2459
|
-
}
|
|
2460
|
-
where += "(" + (exception2.mark.line + 1) + ":" + (exception2.mark.column + 1) + ")";
|
|
2461
|
-
if (!compact && exception2.mark.snippet) {
|
|
2462
|
-
where += "\n\n" + exception2.mark.snippet;
|
|
2463
|
-
}
|
|
2464
|
-
return message + " " + where;
|
|
2465
|
-
}
|
|
2466
|
-
function YAMLException$1(reason, mark) {
|
|
2467
|
-
Error.call(this);
|
|
2468
|
-
this.name = "YAMLException";
|
|
2469
|
-
this.reason = reason;
|
|
2470
|
-
this.mark = mark;
|
|
2471
|
-
this.message = formatError(this, false);
|
|
2472
|
-
if (Error.captureStackTrace) {
|
|
2473
|
-
Error.captureStackTrace(this, this.constructor);
|
|
2474
|
-
} else {
|
|
2475
|
-
this.stack = new Error().stack || "";
|
|
2476
|
-
}
|
|
2477
|
-
}
|
|
2478
|
-
YAMLException$1.prototype = Object.create(Error.prototype);
|
|
2479
|
-
YAMLException$1.prototype.constructor = YAMLException$1;
|
|
2480
|
-
YAMLException$1.prototype.toString = function toString(compact) {
|
|
2481
|
-
return this.name + ": " + formatError(this, compact);
|
|
2482
|
-
};
|
|
2483
|
-
var exception = YAMLException$1;
|
|
2484
|
-
function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
|
|
2485
|
-
var head = "";
|
|
2486
|
-
var tail = "";
|
|
2487
|
-
var maxHalfLength = Math.floor(maxLineLength / 2) - 1;
|
|
2488
|
-
if (position - lineStart > maxHalfLength) {
|
|
2489
|
-
head = " ... ";
|
|
2490
|
-
lineStart = position - maxHalfLength + head.length;
|
|
2491
|
-
}
|
|
2492
|
-
if (lineEnd - position > maxHalfLength) {
|
|
2493
|
-
tail = " ...";
|
|
2494
|
-
lineEnd = position + maxHalfLength - tail.length;
|
|
2495
|
-
}
|
|
2496
|
-
return {
|
|
2497
|
-
str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, "\u2192") + tail,
|
|
2498
|
-
pos: position - lineStart + head.length
|
|
2499
|
-
};
|
|
2500
|
-
}
|
|
2501
|
-
function padStart(string, max) {
|
|
2502
|
-
return common.repeat(" ", max - string.length) + string;
|
|
2503
|
-
}
|
|
2504
|
-
function makeSnippet(mark, options) {
|
|
2505
|
-
options = Object.create(options || null);
|
|
2506
|
-
if (!mark.buffer)
|
|
2507
|
-
return null;
|
|
2508
|
-
if (!options.maxLength)
|
|
2509
|
-
options.maxLength = 79;
|
|
2510
|
-
if (typeof options.indent !== "number")
|
|
2511
|
-
options.indent = 1;
|
|
2512
|
-
if (typeof options.linesBefore !== "number")
|
|
2513
|
-
options.linesBefore = 3;
|
|
2514
|
-
if (typeof options.linesAfter !== "number")
|
|
2515
|
-
options.linesAfter = 2;
|
|
2516
|
-
var re = /\r?\n|\r|\0/g;
|
|
2517
|
-
var lineStarts = [0];
|
|
2518
|
-
var lineEnds = [];
|
|
2519
|
-
var match;
|
|
2520
|
-
var foundLineNo = -1;
|
|
2521
|
-
while (match = re.exec(mark.buffer)) {
|
|
2522
|
-
lineEnds.push(match.index);
|
|
2523
|
-
lineStarts.push(match.index + match[0].length);
|
|
2524
|
-
if (mark.position <= match.index && foundLineNo < 0) {
|
|
2525
|
-
foundLineNo = lineStarts.length - 2;
|
|
2526
|
-
}
|
|
2527
|
-
}
|
|
2528
|
-
if (foundLineNo < 0)
|
|
2529
|
-
foundLineNo = lineStarts.length - 1;
|
|
2530
|
-
var result = "", i, line;
|
|
2531
|
-
var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length;
|
|
2532
|
-
var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3);
|
|
2533
|
-
for (i = 1; i <= options.linesBefore; i++) {
|
|
2534
|
-
if (foundLineNo - i < 0)
|
|
2535
|
-
break;
|
|
2536
|
-
line = getLine(mark.buffer, lineStarts[foundLineNo - i], lineEnds[foundLineNo - i], mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]), maxLineLength);
|
|
2537
|
-
result = common.repeat(" ", options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + " | " + line.str + "\n" + result;
|
|
2538
|
-
}
|
|
2539
|
-
line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
|
|
2540
|
-
result += common.repeat(" ", options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + " | " + line.str + "\n";
|
|
2541
|
-
result += common.repeat("-", options.indent + lineNoLength + 3 + line.pos) + "^\n";
|
|
2542
|
-
for (i = 1; i <= options.linesAfter; i++) {
|
|
2543
|
-
if (foundLineNo + i >= lineEnds.length)
|
|
2544
|
-
break;
|
|
2545
|
-
line = getLine(mark.buffer, lineStarts[foundLineNo + i], lineEnds[foundLineNo + i], mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]), maxLineLength);
|
|
2546
|
-
result += common.repeat(" ", options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + " | " + line.str + "\n";
|
|
2547
|
-
}
|
|
2548
|
-
return result.replace(/\n$/, "");
|
|
2549
|
-
}
|
|
2550
|
-
var snippet = makeSnippet;
|
|
2551
|
-
var TYPE_CONSTRUCTOR_OPTIONS = [
|
|
2552
|
-
"kind",
|
|
2553
|
-
"multi",
|
|
2554
|
-
"resolve",
|
|
2555
|
-
"construct",
|
|
2556
|
-
"instanceOf",
|
|
2557
|
-
"predicate",
|
|
2558
|
-
"represent",
|
|
2559
|
-
"representName",
|
|
2560
|
-
"defaultStyle",
|
|
2561
|
-
"styleAliases"
|
|
2562
|
-
];
|
|
2563
|
-
var YAML_NODE_KINDS = [
|
|
2564
|
-
"scalar",
|
|
2565
|
-
"sequence",
|
|
2566
|
-
"mapping"
|
|
2567
|
-
];
|
|
2568
|
-
function compileStyleAliases(map2) {
|
|
2569
|
-
var result = {};
|
|
2570
|
-
if (map2 !== null) {
|
|
2571
|
-
Object.keys(map2).forEach(function(style2) {
|
|
2572
|
-
map2[style2].forEach(function(alias) {
|
|
2573
|
-
result[String(alias)] = style2;
|
|
2574
|
-
});
|
|
2575
|
-
});
|
|
2576
|
-
}
|
|
2577
|
-
return result;
|
|
2578
|
-
}
|
|
2579
|
-
function Type$1(tag, options) {
|
|
2580
|
-
options = options || {};
|
|
2581
|
-
Object.keys(options).forEach(function(name) {
|
|
2582
|
-
if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
|
|
2583
|
-
throw new exception('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
|
|
2584
|
-
}
|
|
2585
|
-
});
|
|
2586
|
-
this.options = options;
|
|
2587
|
-
this.tag = tag;
|
|
2588
|
-
this.kind = options["kind"] || null;
|
|
2589
|
-
this.resolve = options["resolve"] || function() {
|
|
2590
|
-
return true;
|
|
2591
|
-
};
|
|
2592
|
-
this.construct = options["construct"] || function(data) {
|
|
2593
|
-
return data;
|
|
2594
|
-
};
|
|
2595
|
-
this.instanceOf = options["instanceOf"] || null;
|
|
2596
|
-
this.predicate = options["predicate"] || null;
|
|
2597
|
-
this.represent = options["represent"] || null;
|
|
2598
|
-
this.representName = options["representName"] || null;
|
|
2599
|
-
this.defaultStyle = options["defaultStyle"] || null;
|
|
2600
|
-
this.multi = options["multi"] || false;
|
|
2601
|
-
this.styleAliases = compileStyleAliases(options["styleAliases"] || null);
|
|
2602
|
-
if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
|
|
2603
|
-
throw new exception('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
|
|
2604
|
-
}
|
|
2605
|
-
}
|
|
2606
|
-
var type = Type$1;
|
|
2607
|
-
function compileList(schema2, name) {
|
|
2608
|
-
var result = [];
|
|
2609
|
-
schema2[name].forEach(function(currentType) {
|
|
2610
|
-
var newIndex = result.length;
|
|
2611
|
-
result.forEach(function(previousType, previousIndex) {
|
|
2612
|
-
if (previousType.tag === currentType.tag && previousType.kind === currentType.kind && previousType.multi === currentType.multi) {
|
|
2613
|
-
newIndex = previousIndex;
|
|
2614
|
-
}
|
|
2615
|
-
});
|
|
2616
|
-
result[newIndex] = currentType;
|
|
2617
|
-
});
|
|
2618
|
-
return result;
|
|
2619
|
-
}
|
|
2620
|
-
function compileMap() {
|
|
2621
|
-
var result = {
|
|
2622
|
-
scalar: {},
|
|
2623
|
-
sequence: {},
|
|
2624
|
-
mapping: {},
|
|
2625
|
-
fallback: {},
|
|
2626
|
-
multi: {
|
|
2627
|
-
scalar: [],
|
|
2628
|
-
sequence: [],
|
|
2629
|
-
mapping: [],
|
|
2630
|
-
fallback: []
|
|
2631
|
-
}
|
|
2632
|
-
}, index, length;
|
|
2633
|
-
function collectType(type2) {
|
|
2634
|
-
if (type2.multi) {
|
|
2635
|
-
result.multi[type2.kind].push(type2);
|
|
2636
|
-
result.multi["fallback"].push(type2);
|
|
2637
|
-
} else {
|
|
2638
|
-
result[type2.kind][type2.tag] = result["fallback"][type2.tag] = type2;
|
|
2639
|
-
}
|
|
2640
|
-
}
|
|
2641
|
-
for (index = 0, length = arguments.length; index < length; index += 1) {
|
|
2642
|
-
arguments[index].forEach(collectType);
|
|
2643
|
-
}
|
|
2644
|
-
return result;
|
|
2645
|
-
}
|
|
2646
|
-
function Schema$1(definition) {
|
|
2647
|
-
return this.extend(definition);
|
|
2648
|
-
}
|
|
2649
|
-
Schema$1.prototype.extend = function extend2(definition) {
|
|
2650
|
-
var implicit = [];
|
|
2651
|
-
var explicit = [];
|
|
2652
|
-
if (definition instanceof type) {
|
|
2653
|
-
explicit.push(definition);
|
|
2654
|
-
} else if (Array.isArray(definition)) {
|
|
2655
|
-
explicit = explicit.concat(definition);
|
|
2656
|
-
} else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {
|
|
2657
|
-
if (definition.implicit)
|
|
2658
|
-
implicit = implicit.concat(definition.implicit);
|
|
2659
|
-
if (definition.explicit)
|
|
2660
|
-
explicit = explicit.concat(definition.explicit);
|
|
2661
|
-
} else {
|
|
2662
|
-
throw new exception("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");
|
|
2663
|
-
}
|
|
2664
|
-
implicit.forEach(function(type$1) {
|
|
2665
|
-
if (!(type$1 instanceof type)) {
|
|
2666
|
-
throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
|
2667
|
-
}
|
|
2668
|
-
if (type$1.loadKind && type$1.loadKind !== "scalar") {
|
|
2669
|
-
throw new exception("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
|
|
2670
|
-
}
|
|
2671
|
-
if (type$1.multi) {
|
|
2672
|
-
throw new exception("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.");
|
|
2673
|
-
}
|
|
2674
|
-
});
|
|
2675
|
-
explicit.forEach(function(type$1) {
|
|
2676
|
-
if (!(type$1 instanceof type)) {
|
|
2677
|
-
throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
|
2678
|
-
}
|
|
2679
|
-
});
|
|
2680
|
-
var result = Object.create(Schema$1.prototype);
|
|
2681
|
-
result.implicit = (this.implicit || []).concat(implicit);
|
|
2682
|
-
result.explicit = (this.explicit || []).concat(explicit);
|
|
2683
|
-
result.compiledImplicit = compileList(result, "implicit");
|
|
2684
|
-
result.compiledExplicit = compileList(result, "explicit");
|
|
2685
|
-
result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit);
|
|
2686
|
-
return result;
|
|
2687
|
-
};
|
|
2688
|
-
var schema = Schema$1;
|
|
2689
|
-
var str = new type("tag:yaml.org,2002:str", {
|
|
2690
|
-
kind: "scalar",
|
|
2691
|
-
construct: function(data) {
|
|
2692
|
-
return data !== null ? data : "";
|
|
2693
|
-
}
|
|
2694
|
-
});
|
|
2695
|
-
var seq = new type("tag:yaml.org,2002:seq", {
|
|
2696
|
-
kind: "sequence",
|
|
2697
|
-
construct: function(data) {
|
|
2698
|
-
return data !== null ? data : [];
|
|
2699
|
-
}
|
|
2700
|
-
});
|
|
2701
|
-
var map = new type("tag:yaml.org,2002:map", {
|
|
2702
|
-
kind: "mapping",
|
|
2703
|
-
construct: function(data) {
|
|
2704
|
-
return data !== null ? data : {};
|
|
2705
|
-
}
|
|
2706
|
-
});
|
|
2707
|
-
var failsafe = new schema({
|
|
2708
|
-
explicit: [
|
|
2709
|
-
str,
|
|
2710
|
-
seq,
|
|
2711
|
-
map
|
|
2712
|
-
]
|
|
2713
|
-
});
|
|
2714
|
-
function resolveYamlNull(data) {
|
|
2715
|
-
if (data === null)
|
|
2716
|
-
return true;
|
|
2717
|
-
var max = data.length;
|
|
2718
|
-
return max === 1 && data === "~" || max === 4 && (data === "null" || data === "Null" || data === "NULL");
|
|
2719
|
-
}
|
|
2720
|
-
function constructYamlNull() {
|
|
2721
|
-
return null;
|
|
2722
|
-
}
|
|
2723
|
-
function isNull(object) {
|
|
2724
|
-
return object === null;
|
|
2725
|
-
}
|
|
2726
|
-
var _null = new type("tag:yaml.org,2002:null", {
|
|
2727
|
-
kind: "scalar",
|
|
2728
|
-
resolve: resolveYamlNull,
|
|
2729
|
-
construct: constructYamlNull,
|
|
2730
|
-
predicate: isNull,
|
|
2731
|
-
represent: {
|
|
2732
|
-
canonical: function() {
|
|
2733
|
-
return "~";
|
|
2734
|
-
},
|
|
2735
|
-
lowercase: function() {
|
|
2736
|
-
return "null";
|
|
2737
|
-
},
|
|
2738
|
-
uppercase: function() {
|
|
2739
|
-
return "NULL";
|
|
2740
|
-
},
|
|
2741
|
-
camelcase: function() {
|
|
2742
|
-
return "Null";
|
|
2743
|
-
},
|
|
2744
|
-
empty: function() {
|
|
2745
|
-
return "";
|
|
2746
|
-
}
|
|
2747
|
-
},
|
|
2748
|
-
defaultStyle: "lowercase"
|
|
2749
|
-
});
|
|
2750
|
-
function resolveYamlBoolean(data) {
|
|
2751
|
-
if (data === null)
|
|
2752
|
-
return false;
|
|
2753
|
-
var max = data.length;
|
|
2754
|
-
return max === 4 && (data === "true" || data === "True" || data === "TRUE") || max === 5 && (data === "false" || data === "False" || data === "FALSE");
|
|
2755
|
-
}
|
|
2756
|
-
function constructYamlBoolean(data) {
|
|
2757
|
-
return data === "true" || data === "True" || data === "TRUE";
|
|
2758
|
-
}
|
|
2759
|
-
function isBoolean(object) {
|
|
2760
|
-
return Object.prototype.toString.call(object) === "[object Boolean]";
|
|
2761
|
-
}
|
|
2762
|
-
var bool = new type("tag:yaml.org,2002:bool", {
|
|
2763
|
-
kind: "scalar",
|
|
2764
|
-
resolve: resolveYamlBoolean,
|
|
2765
|
-
construct: constructYamlBoolean,
|
|
2766
|
-
predicate: isBoolean,
|
|
2767
|
-
represent: {
|
|
2768
|
-
lowercase: function(object) {
|
|
2769
|
-
return object ? "true" : "false";
|
|
2770
|
-
},
|
|
2771
|
-
uppercase: function(object) {
|
|
2772
|
-
return object ? "TRUE" : "FALSE";
|
|
2773
|
-
},
|
|
2774
|
-
camelcase: function(object) {
|
|
2775
|
-
return object ? "True" : "False";
|
|
2776
|
-
}
|
|
2777
|
-
},
|
|
2778
|
-
defaultStyle: "lowercase"
|
|
2779
|
-
});
|
|
2780
|
-
function isHexCode(c2) {
|
|
2781
|
-
return 48 <= c2 && c2 <= 57 || 65 <= c2 && c2 <= 70 || 97 <= c2 && c2 <= 102;
|
|
2782
|
-
}
|
|
2783
|
-
function isOctCode(c2) {
|
|
2784
|
-
return 48 <= c2 && c2 <= 55;
|
|
2785
|
-
}
|
|
2786
|
-
function isDecCode(c2) {
|
|
2787
|
-
return 48 <= c2 && c2 <= 57;
|
|
2788
|
-
}
|
|
2789
|
-
function resolveYamlInteger(data) {
|
|
2790
|
-
if (data === null)
|
|
2791
|
-
return false;
|
|
2792
|
-
var max = data.length, index = 0, hasDigits = false, ch;
|
|
2793
|
-
if (!max)
|
|
2794
|
-
return false;
|
|
2795
|
-
ch = data[index];
|
|
2796
|
-
if (ch === "-" || ch === "+") {
|
|
2797
|
-
ch = data[++index];
|
|
2798
|
-
}
|
|
2799
|
-
if (ch === "0") {
|
|
2800
|
-
if (index + 1 === max)
|
|
2801
|
-
return true;
|
|
2802
|
-
ch = data[++index];
|
|
2803
|
-
if (ch === "b") {
|
|
2804
|
-
index++;
|
|
2805
|
-
for (; index < max; index++) {
|
|
2806
|
-
ch = data[index];
|
|
2807
|
-
if (ch === "_")
|
|
2808
|
-
continue;
|
|
2809
|
-
if (ch !== "0" && ch !== "1")
|
|
2810
|
-
return false;
|
|
2811
|
-
hasDigits = true;
|
|
2812
|
-
}
|
|
2813
|
-
return hasDigits && ch !== "_";
|
|
2814
|
-
}
|
|
2815
|
-
if (ch === "x") {
|
|
2816
|
-
index++;
|
|
2817
|
-
for (; index < max; index++) {
|
|
2818
|
-
ch = data[index];
|
|
2819
|
-
if (ch === "_")
|
|
2820
|
-
continue;
|
|
2821
|
-
if (!isHexCode(data.charCodeAt(index)))
|
|
2822
|
-
return false;
|
|
2823
|
-
hasDigits = true;
|
|
2824
|
-
}
|
|
2825
|
-
return hasDigits && ch !== "_";
|
|
2826
|
-
}
|
|
2827
|
-
if (ch === "o") {
|
|
2828
|
-
index++;
|
|
2829
|
-
for (; index < max; index++) {
|
|
2830
|
-
ch = data[index];
|
|
2831
|
-
if (ch === "_")
|
|
2832
|
-
continue;
|
|
2833
|
-
if (!isOctCode(data.charCodeAt(index)))
|
|
2834
|
-
return false;
|
|
2835
|
-
hasDigits = true;
|
|
2836
|
-
}
|
|
2837
|
-
return hasDigits && ch !== "_";
|
|
2838
|
-
}
|
|
2839
|
-
}
|
|
2840
|
-
if (ch === "_")
|
|
2841
|
-
return false;
|
|
2842
|
-
for (; index < max; index++) {
|
|
2843
|
-
ch = data[index];
|
|
2844
|
-
if (ch === "_")
|
|
2845
|
-
continue;
|
|
2846
|
-
if (!isDecCode(data.charCodeAt(index))) {
|
|
2847
|
-
return false;
|
|
2848
|
-
}
|
|
2849
|
-
hasDigits = true;
|
|
2850
|
-
}
|
|
2851
|
-
if (!hasDigits || ch === "_")
|
|
2852
|
-
return false;
|
|
2853
|
-
return true;
|
|
2854
|
-
}
|
|
2855
|
-
function constructYamlInteger(data) {
|
|
2856
|
-
var value = data, sign = 1, ch;
|
|
2857
|
-
if (value.indexOf("_") !== -1) {
|
|
2858
|
-
value = value.replace(/_/g, "");
|
|
2859
|
-
}
|
|
2860
|
-
ch = value[0];
|
|
2861
|
-
if (ch === "-" || ch === "+") {
|
|
2862
|
-
if (ch === "-")
|
|
2863
|
-
sign = -1;
|
|
2864
|
-
value = value.slice(1);
|
|
2865
|
-
ch = value[0];
|
|
2866
|
-
}
|
|
2867
|
-
if (value === "0")
|
|
2868
|
-
return 0;
|
|
2869
|
-
if (ch === "0") {
|
|
2870
|
-
if (value[1] === "b")
|
|
2871
|
-
return sign * parseInt(value.slice(2), 2);
|
|
2872
|
-
if (value[1] === "x")
|
|
2873
|
-
return sign * parseInt(value.slice(2), 16);
|
|
2874
|
-
if (value[1] === "o")
|
|
2875
|
-
return sign * parseInt(value.slice(2), 8);
|
|
2876
|
-
}
|
|
2877
|
-
return sign * parseInt(value, 10);
|
|
2878
|
-
}
|
|
2879
|
-
function isInteger(object) {
|
|
2880
|
-
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 === 0 && !common.isNegativeZero(object));
|
|
2881
|
-
}
|
|
2882
|
-
var int = new type("tag:yaml.org,2002:int", {
|
|
2883
|
-
kind: "scalar",
|
|
2884
|
-
resolve: resolveYamlInteger,
|
|
2885
|
-
construct: constructYamlInteger,
|
|
2886
|
-
predicate: isInteger,
|
|
2887
|
-
represent: {
|
|
2888
|
-
binary: function(obj) {
|
|
2889
|
-
return obj >= 0 ? "0b" + obj.toString(2) : "-0b" + obj.toString(2).slice(1);
|
|
2890
|
-
},
|
|
2891
|
-
octal: function(obj) {
|
|
2892
|
-
return obj >= 0 ? "0o" + obj.toString(8) : "-0o" + obj.toString(8).slice(1);
|
|
2893
|
-
},
|
|
2894
|
-
decimal: function(obj) {
|
|
2895
|
-
return obj.toString(10);
|
|
2896
|
-
},
|
|
2897
|
-
hexadecimal: function(obj) {
|
|
2898
|
-
return obj >= 0 ? "0x" + obj.toString(16).toUpperCase() : "-0x" + obj.toString(16).toUpperCase().slice(1);
|
|
2899
|
-
}
|
|
2900
|
-
},
|
|
2901
|
-
defaultStyle: "decimal",
|
|
2902
|
-
styleAliases: {
|
|
2903
|
-
binary: [2, "bin"],
|
|
2904
|
-
octal: [8, "oct"],
|
|
2905
|
-
decimal: [10, "dec"],
|
|
2906
|
-
hexadecimal: [16, "hex"]
|
|
2907
|
-
}
|
|
2908
|
-
});
|
|
2909
|
-
var YAML_FLOAT_PATTERN = new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
|
|
2910
|
-
function resolveYamlFloat(data) {
|
|
2911
|
-
if (data === null)
|
|
2912
|
-
return false;
|
|
2913
|
-
if (!YAML_FLOAT_PATTERN.test(data) || data[data.length - 1] === "_") {
|
|
2914
|
-
return false;
|
|
2915
|
-
}
|
|
2916
|
-
return true;
|
|
2917
|
-
}
|
|
2918
|
-
function constructYamlFloat(data) {
|
|
2919
|
-
var value, sign;
|
|
2920
|
-
value = data.replace(/_/g, "").toLowerCase();
|
|
2921
|
-
sign = value[0] === "-" ? -1 : 1;
|
|
2922
|
-
if ("+-".indexOf(value[0]) >= 0) {
|
|
2923
|
-
value = value.slice(1);
|
|
2924
|
-
}
|
|
2925
|
-
if (value === ".inf") {
|
|
2926
|
-
return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
|
|
2927
|
-
} else if (value === ".nan") {
|
|
2928
|
-
return NaN;
|
|
2929
|
-
}
|
|
2930
|
-
return sign * parseFloat(value, 10);
|
|
2931
|
-
}
|
|
2932
|
-
var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
|
|
2933
|
-
function representYamlFloat(object, style2) {
|
|
2934
|
-
var res;
|
|
2935
|
-
if (isNaN(object)) {
|
|
2936
|
-
switch (style2) {
|
|
2937
|
-
case "lowercase":
|
|
2938
|
-
return ".nan";
|
|
2939
|
-
case "uppercase":
|
|
2940
|
-
return ".NAN";
|
|
2941
|
-
case "camelcase":
|
|
2942
|
-
return ".NaN";
|
|
2943
|
-
}
|
|
2944
|
-
} else if (Number.POSITIVE_INFINITY === object) {
|
|
2945
|
-
switch (style2) {
|
|
2946
|
-
case "lowercase":
|
|
2947
|
-
return ".inf";
|
|
2948
|
-
case "uppercase":
|
|
2949
|
-
return ".INF";
|
|
2950
|
-
case "camelcase":
|
|
2951
|
-
return ".Inf";
|
|
2952
|
-
}
|
|
2953
|
-
} else if (Number.NEGATIVE_INFINITY === object) {
|
|
2954
|
-
switch (style2) {
|
|
2955
|
-
case "lowercase":
|
|
2956
|
-
return "-.inf";
|
|
2957
|
-
case "uppercase":
|
|
2958
|
-
return "-.INF";
|
|
2959
|
-
case "camelcase":
|
|
2960
|
-
return "-.Inf";
|
|
2961
|
-
}
|
|
2962
|
-
} else if (common.isNegativeZero(object)) {
|
|
2963
|
-
return "-0.0";
|
|
2964
|
-
}
|
|
2965
|
-
res = object.toString(10);
|
|
2966
|
-
return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res;
|
|
2967
|
-
}
|
|
2968
|
-
function isFloat(object) {
|
|
2969
|
-
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || common.isNegativeZero(object));
|
|
2970
|
-
}
|
|
2971
|
-
var float = new type("tag:yaml.org,2002:float", {
|
|
2972
|
-
kind: "scalar",
|
|
2973
|
-
resolve: resolveYamlFloat,
|
|
2974
|
-
construct: constructYamlFloat,
|
|
2975
|
-
predicate: isFloat,
|
|
2976
|
-
represent: representYamlFloat,
|
|
2977
|
-
defaultStyle: "lowercase"
|
|
2978
|
-
});
|
|
2979
|
-
var json = failsafe.extend({
|
|
2980
|
-
implicit: [
|
|
2981
|
-
_null,
|
|
2982
|
-
bool,
|
|
2983
|
-
int,
|
|
2984
|
-
float
|
|
2985
|
-
]
|
|
2986
|
-
});
|
|
2987
|
-
var core = json;
|
|
2988
|
-
var YAML_DATE_REGEXP = new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$");
|
|
2989
|
-
var YAML_TIMESTAMP_REGEXP = new RegExp("^([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]))?))?$");
|
|
2990
|
-
function resolveYamlTimestamp(data) {
|
|
2991
|
-
if (data === null)
|
|
2992
|
-
return false;
|
|
2993
|
-
if (YAML_DATE_REGEXP.exec(data) !== null)
|
|
2994
|
-
return true;
|
|
2995
|
-
if (YAML_TIMESTAMP_REGEXP.exec(data) !== null)
|
|
2996
|
-
return true;
|
|
2997
|
-
return false;
|
|
2998
|
-
}
|
|
2999
|
-
function constructYamlTimestamp(data) {
|
|
3000
|
-
var match, year2, month2, day2, hour, minute, second, fraction = 0, delta = null, tz_hour, tz_minute, date2;
|
|
3001
|
-
match = YAML_DATE_REGEXP.exec(data);
|
|
3002
|
-
if (match === null)
|
|
3003
|
-
match = YAML_TIMESTAMP_REGEXP.exec(data);
|
|
3004
|
-
if (match === null)
|
|
3005
|
-
throw new Error("Date resolve error");
|
|
3006
|
-
year2 = +match[1];
|
|
3007
|
-
month2 = +match[2] - 1;
|
|
3008
|
-
day2 = +match[3];
|
|
3009
|
-
if (!match[4]) {
|
|
3010
|
-
return new Date(Date.UTC(year2, month2, day2));
|
|
3011
|
-
}
|
|
3012
|
-
hour = +match[4];
|
|
3013
|
-
minute = +match[5];
|
|
3014
|
-
second = +match[6];
|
|
3015
|
-
if (match[7]) {
|
|
3016
|
-
fraction = match[7].slice(0, 3);
|
|
3017
|
-
while (fraction.length < 3) {
|
|
3018
|
-
fraction += "0";
|
|
3019
|
-
}
|
|
3020
|
-
fraction = +fraction;
|
|
3021
|
-
}
|
|
3022
|
-
if (match[9]) {
|
|
3023
|
-
tz_hour = +match[10];
|
|
3024
|
-
tz_minute = +(match[11] || 0);
|
|
3025
|
-
delta = (tz_hour * 60 + tz_minute) * 6e4;
|
|
3026
|
-
if (match[9] === "-")
|
|
3027
|
-
delta = -delta;
|
|
3028
|
-
}
|
|
3029
|
-
date2 = new Date(Date.UTC(year2, month2, day2, hour, minute, second, fraction));
|
|
3030
|
-
if (delta)
|
|
3031
|
-
date2.setTime(date2.getTime() - delta);
|
|
3032
|
-
return date2;
|
|
3033
|
-
}
|
|
3034
|
-
function representYamlTimestamp(object) {
|
|
3035
|
-
return object.toISOString();
|
|
3036
|
-
}
|
|
3037
|
-
var timestamp = new type("tag:yaml.org,2002:timestamp", {
|
|
3038
|
-
kind: "scalar",
|
|
3039
|
-
resolve: resolveYamlTimestamp,
|
|
3040
|
-
construct: constructYamlTimestamp,
|
|
3041
|
-
instanceOf: Date,
|
|
3042
|
-
represent: representYamlTimestamp
|
|
3043
|
-
});
|
|
3044
|
-
function resolveYamlMerge(data) {
|
|
3045
|
-
return data === "<<" || data === null;
|
|
3046
|
-
}
|
|
3047
|
-
var merge = new type("tag:yaml.org,2002:merge", {
|
|
3048
|
-
kind: "scalar",
|
|
3049
|
-
resolve: resolveYamlMerge
|
|
3050
|
-
});
|
|
3051
|
-
var BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";
|
|
3052
|
-
function resolveYamlBinary(data) {
|
|
3053
|
-
if (data === null)
|
|
3054
|
-
return false;
|
|
3055
|
-
var code, idx, bitlen = 0, max = data.length, map2 = BASE64_MAP;
|
|
3056
|
-
for (idx = 0; idx < max; idx++) {
|
|
3057
|
-
code = map2.indexOf(data.charAt(idx));
|
|
3058
|
-
if (code > 64)
|
|
3059
|
-
continue;
|
|
3060
|
-
if (code < 0)
|
|
3061
|
-
return false;
|
|
3062
|
-
bitlen += 6;
|
|
3063
|
-
}
|
|
3064
|
-
return bitlen % 8 === 0;
|
|
3065
|
-
}
|
|
3066
|
-
function constructYamlBinary(data) {
|
|
3067
|
-
var idx, tailbits, input = data.replace(/[\r\n=]/g, ""), max = input.length, map2 = BASE64_MAP, bits = 0, result = [];
|
|
3068
|
-
for (idx = 0; idx < max; idx++) {
|
|
3069
|
-
if (idx % 4 === 0 && idx) {
|
|
3070
|
-
result.push(bits >> 16 & 255);
|
|
3071
|
-
result.push(bits >> 8 & 255);
|
|
3072
|
-
result.push(bits & 255);
|
|
3073
|
-
}
|
|
3074
|
-
bits = bits << 6 | map2.indexOf(input.charAt(idx));
|
|
3075
|
-
}
|
|
3076
|
-
tailbits = max % 4 * 6;
|
|
3077
|
-
if (tailbits === 0) {
|
|
3078
|
-
result.push(bits >> 16 & 255);
|
|
3079
|
-
result.push(bits >> 8 & 255);
|
|
3080
|
-
result.push(bits & 255);
|
|
3081
|
-
} else if (tailbits === 18) {
|
|
3082
|
-
result.push(bits >> 10 & 255);
|
|
3083
|
-
result.push(bits >> 2 & 255);
|
|
3084
|
-
} else if (tailbits === 12) {
|
|
3085
|
-
result.push(bits >> 4 & 255);
|
|
3086
|
-
}
|
|
3087
|
-
return new Uint8Array(result);
|
|
3088
|
-
}
|
|
3089
|
-
function representYamlBinary(object) {
|
|
3090
|
-
var result = "", bits = 0, idx, tail, max = object.length, map2 = BASE64_MAP;
|
|
3091
|
-
for (idx = 0; idx < max; idx++) {
|
|
3092
|
-
if (idx % 3 === 0 && idx) {
|
|
3093
|
-
result += map2[bits >> 18 & 63];
|
|
3094
|
-
result += map2[bits >> 12 & 63];
|
|
3095
|
-
result += map2[bits >> 6 & 63];
|
|
3096
|
-
result += map2[bits & 63];
|
|
3097
|
-
}
|
|
3098
|
-
bits = (bits << 8) + object[idx];
|
|
3099
|
-
}
|
|
3100
|
-
tail = max % 3;
|
|
3101
|
-
if (tail === 0) {
|
|
3102
|
-
result += map2[bits >> 18 & 63];
|
|
3103
|
-
result += map2[bits >> 12 & 63];
|
|
3104
|
-
result += map2[bits >> 6 & 63];
|
|
3105
|
-
result += map2[bits & 63];
|
|
3106
|
-
} else if (tail === 2) {
|
|
3107
|
-
result += map2[bits >> 10 & 63];
|
|
3108
|
-
result += map2[bits >> 4 & 63];
|
|
3109
|
-
result += map2[bits << 2 & 63];
|
|
3110
|
-
result += map2[64];
|
|
3111
|
-
} else if (tail === 1) {
|
|
3112
|
-
result += map2[bits >> 2 & 63];
|
|
3113
|
-
result += map2[bits << 4 & 63];
|
|
3114
|
-
result += map2[64];
|
|
3115
|
-
result += map2[64];
|
|
3116
|
-
}
|
|
3117
|
-
return result;
|
|
3118
|
-
}
|
|
3119
|
-
function isBinary(obj) {
|
|
3120
|
-
return Object.prototype.toString.call(obj) === "[object Uint8Array]";
|
|
3121
|
-
}
|
|
3122
|
-
var binary = new type("tag:yaml.org,2002:binary", {
|
|
3123
|
-
kind: "scalar",
|
|
3124
|
-
resolve: resolveYamlBinary,
|
|
3125
|
-
construct: constructYamlBinary,
|
|
3126
|
-
predicate: isBinary,
|
|
3127
|
-
represent: representYamlBinary
|
|
3128
|
-
});
|
|
3129
|
-
var _hasOwnProperty$3 = Object.prototype.hasOwnProperty;
|
|
3130
|
-
var _toString$2 = Object.prototype.toString;
|
|
3131
|
-
function resolveYamlOmap(data) {
|
|
3132
|
-
if (data === null)
|
|
3133
|
-
return true;
|
|
3134
|
-
var objectKeys = [], index, length, pair, pairKey, pairHasKey, object = data;
|
|
3135
|
-
for (index = 0, length = object.length; index < length; index += 1) {
|
|
3136
|
-
pair = object[index];
|
|
3137
|
-
pairHasKey = false;
|
|
3138
|
-
if (_toString$2.call(pair) !== "[object Object]")
|
|
3139
|
-
return false;
|
|
3140
|
-
for (pairKey in pair) {
|
|
3141
|
-
if (_hasOwnProperty$3.call(pair, pairKey)) {
|
|
3142
|
-
if (!pairHasKey)
|
|
3143
|
-
pairHasKey = true;
|
|
3144
|
-
else
|
|
3145
|
-
return false;
|
|
3146
|
-
}
|
|
3147
|
-
}
|
|
3148
|
-
if (!pairHasKey)
|
|
3149
|
-
return false;
|
|
3150
|
-
if (objectKeys.indexOf(pairKey) === -1)
|
|
3151
|
-
objectKeys.push(pairKey);
|
|
3152
|
-
else
|
|
3153
|
-
return false;
|
|
3154
|
-
}
|
|
3155
|
-
return true;
|
|
3156
|
-
}
|
|
3157
|
-
function constructYamlOmap(data) {
|
|
3158
|
-
return data !== null ? data : [];
|
|
3159
|
-
}
|
|
3160
|
-
var omap = new type("tag:yaml.org,2002:omap", {
|
|
3161
|
-
kind: "sequence",
|
|
3162
|
-
resolve: resolveYamlOmap,
|
|
3163
|
-
construct: constructYamlOmap
|
|
3164
|
-
});
|
|
3165
|
-
var _toString$1 = Object.prototype.toString;
|
|
3166
|
-
function resolveYamlPairs(data) {
|
|
3167
|
-
if (data === null)
|
|
3168
|
-
return true;
|
|
3169
|
-
var index, length, pair, keys, result, object = data;
|
|
3170
|
-
result = new Array(object.length);
|
|
3171
|
-
for (index = 0, length = object.length; index < length; index += 1) {
|
|
3172
|
-
pair = object[index];
|
|
3173
|
-
if (_toString$1.call(pair) !== "[object Object]")
|
|
3174
|
-
return false;
|
|
3175
|
-
keys = Object.keys(pair);
|
|
3176
|
-
if (keys.length !== 1)
|
|
3177
|
-
return false;
|
|
3178
|
-
result[index] = [keys[0], pair[keys[0]]];
|
|
3179
|
-
}
|
|
3180
|
-
return true;
|
|
3181
|
-
}
|
|
3182
|
-
function constructYamlPairs(data) {
|
|
3183
|
-
if (data === null)
|
|
3184
|
-
return [];
|
|
3185
|
-
var index, length, pair, keys, result, object = data;
|
|
3186
|
-
result = new Array(object.length);
|
|
3187
|
-
for (index = 0, length = object.length; index < length; index += 1) {
|
|
3188
|
-
pair = object[index];
|
|
3189
|
-
keys = Object.keys(pair);
|
|
3190
|
-
result[index] = [keys[0], pair[keys[0]]];
|
|
3191
|
-
}
|
|
3192
|
-
return result;
|
|
3193
|
-
}
|
|
3194
|
-
var pairs = new type("tag:yaml.org,2002:pairs", {
|
|
3195
|
-
kind: "sequence",
|
|
3196
|
-
resolve: resolveYamlPairs,
|
|
3197
|
-
construct: constructYamlPairs
|
|
3198
|
-
});
|
|
3199
|
-
var _hasOwnProperty$2 = Object.prototype.hasOwnProperty;
|
|
3200
|
-
function resolveYamlSet(data) {
|
|
3201
|
-
if (data === null)
|
|
3202
|
-
return true;
|
|
3203
|
-
var key, object = data;
|
|
3204
|
-
for (key in object) {
|
|
3205
|
-
if (_hasOwnProperty$2.call(object, key)) {
|
|
3206
|
-
if (object[key] !== null)
|
|
3207
|
-
return false;
|
|
3208
|
-
}
|
|
3209
|
-
}
|
|
3210
|
-
return true;
|
|
3211
|
-
}
|
|
3212
|
-
function constructYamlSet(data) {
|
|
3213
|
-
return data !== null ? data : {};
|
|
3214
|
-
}
|
|
3215
|
-
var set = new type("tag:yaml.org,2002:set", {
|
|
3216
|
-
kind: "mapping",
|
|
3217
|
-
resolve: resolveYamlSet,
|
|
3218
|
-
construct: constructYamlSet
|
|
3219
|
-
});
|
|
3220
|
-
var _default = core.extend({
|
|
3221
|
-
implicit: [
|
|
3222
|
-
timestamp,
|
|
3223
|
-
merge
|
|
3224
|
-
],
|
|
3225
|
-
explicit: [
|
|
3226
|
-
binary,
|
|
3227
|
-
omap,
|
|
3228
|
-
pairs,
|
|
3229
|
-
set
|
|
3230
|
-
]
|
|
3231
|
-
});
|
|
3232
|
-
var _hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
3233
|
-
var CONTEXT_FLOW_IN = 1;
|
|
3234
|
-
var CONTEXT_FLOW_OUT = 2;
|
|
3235
|
-
var CONTEXT_BLOCK_IN = 3;
|
|
3236
|
-
var CONTEXT_BLOCK_OUT = 4;
|
|
3237
|
-
var CHOMPING_CLIP = 1;
|
|
3238
|
-
var CHOMPING_STRIP = 2;
|
|
3239
|
-
var CHOMPING_KEEP = 3;
|
|
3240
|
-
var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
|
|
3241
|
-
var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
|
|
3242
|
-
var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
|
|
3243
|
-
var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
|
|
3244
|
-
var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
|
|
3245
|
-
function _class(obj) {
|
|
3246
|
-
return Object.prototype.toString.call(obj);
|
|
3247
|
-
}
|
|
3248
|
-
function is_EOL(c2) {
|
|
3249
|
-
return c2 === 10 || c2 === 13;
|
|
3250
|
-
}
|
|
3251
|
-
function is_WHITE_SPACE(c2) {
|
|
3252
|
-
return c2 === 9 || c2 === 32;
|
|
3253
|
-
}
|
|
3254
|
-
function is_WS_OR_EOL(c2) {
|
|
3255
|
-
return c2 === 9 || c2 === 32 || c2 === 10 || c2 === 13;
|
|
3256
|
-
}
|
|
3257
|
-
function is_FLOW_INDICATOR(c2) {
|
|
3258
|
-
return c2 === 44 || c2 === 91 || c2 === 93 || c2 === 123 || c2 === 125;
|
|
3259
|
-
}
|
|
3260
|
-
function fromHexCode(c2) {
|
|
3261
|
-
var lc;
|
|
3262
|
-
if (48 <= c2 && c2 <= 57) {
|
|
3263
|
-
return c2 - 48;
|
|
3264
|
-
}
|
|
3265
|
-
lc = c2 | 32;
|
|
3266
|
-
if (97 <= lc && lc <= 102) {
|
|
3267
|
-
return lc - 97 + 10;
|
|
3268
|
-
}
|
|
3269
|
-
return -1;
|
|
3270
|
-
}
|
|
3271
|
-
function escapedHexLen(c2) {
|
|
3272
|
-
if (c2 === 120) {
|
|
3273
|
-
return 2;
|
|
3274
|
-
}
|
|
3275
|
-
if (c2 === 117) {
|
|
3276
|
-
return 4;
|
|
3277
|
-
}
|
|
3278
|
-
if (c2 === 85) {
|
|
3279
|
-
return 8;
|
|
3280
|
-
}
|
|
3281
|
-
return 0;
|
|
3282
|
-
}
|
|
3283
|
-
function fromDecimalCode(c2) {
|
|
3284
|
-
if (48 <= c2 && c2 <= 57) {
|
|
3285
|
-
return c2 - 48;
|
|
3286
|
-
}
|
|
3287
|
-
return -1;
|
|
3288
|
-
}
|
|
3289
|
-
function simpleEscapeSequence(c2) {
|
|
3290
|
-
return c2 === 48 ? "\0" : c2 === 97 ? "\x07" : c2 === 98 ? "\b" : c2 === 116 ? " " : c2 === 9 ? " " : c2 === 110 ? "\n" : c2 === 118 ? "\v" : c2 === 102 ? "\f" : c2 === 114 ? "\r" : c2 === 101 ? "\x1B" : c2 === 32 ? " " : c2 === 34 ? '"' : c2 === 47 ? "/" : c2 === 92 ? "\\" : c2 === 78 ? "\x85" : c2 === 95 ? "\xA0" : c2 === 76 ? "\u2028" : c2 === 80 ? "\u2029" : "";
|
|
3291
|
-
}
|
|
3292
|
-
function charFromCodepoint(c2) {
|
|
3293
|
-
if (c2 <= 65535) {
|
|
3294
|
-
return String.fromCharCode(c2);
|
|
3295
|
-
}
|
|
3296
|
-
return String.fromCharCode((c2 - 65536 >> 10) + 55296, (c2 - 65536 & 1023) + 56320);
|
|
3297
|
-
}
|
|
3298
|
-
var simpleEscapeCheck = new Array(256);
|
|
3299
|
-
var simpleEscapeMap = new Array(256);
|
|
3300
|
-
for (i = 0; i < 256; i++) {
|
|
3301
|
-
simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
|
|
3302
|
-
simpleEscapeMap[i] = simpleEscapeSequence(i);
|
|
3303
|
-
}
|
|
3304
|
-
var i;
|
|
3305
|
-
function State$1(input, options) {
|
|
3306
|
-
this.input = input;
|
|
3307
|
-
this.filename = options["filename"] || null;
|
|
3308
|
-
this.schema = options["schema"] || _default;
|
|
3309
|
-
this.onWarning = options["onWarning"] || null;
|
|
3310
|
-
this.legacy = options["legacy"] || false;
|
|
3311
|
-
this.json = options["json"] || false;
|
|
3312
|
-
this.listener = options["listener"] || null;
|
|
3313
|
-
this.implicitTypes = this.schema.compiledImplicit;
|
|
3314
|
-
this.typeMap = this.schema.compiledTypeMap;
|
|
3315
|
-
this.length = input.length;
|
|
3316
|
-
this.position = 0;
|
|
3317
|
-
this.line = 0;
|
|
3318
|
-
this.lineStart = 0;
|
|
3319
|
-
this.lineIndent = 0;
|
|
3320
|
-
this.firstTabInLine = -1;
|
|
3321
|
-
this.documents = [];
|
|
3322
|
-
}
|
|
3323
|
-
function generateError(state, message) {
|
|
3324
|
-
var mark = {
|
|
3325
|
-
name: state.filename,
|
|
3326
|
-
buffer: state.input.slice(0, -1),
|
|
3327
|
-
position: state.position,
|
|
3328
|
-
line: state.line,
|
|
3329
|
-
column: state.position - state.lineStart
|
|
3330
|
-
};
|
|
3331
|
-
mark.snippet = snippet(mark);
|
|
3332
|
-
return new exception(message, mark);
|
|
3333
|
-
}
|
|
3334
|
-
function throwError(state, message) {
|
|
3335
|
-
throw generateError(state, message);
|
|
3336
|
-
}
|
|
3337
|
-
function throwWarning(state, message) {
|
|
3338
|
-
if (state.onWarning) {
|
|
3339
|
-
state.onWarning.call(null, generateError(state, message));
|
|
3340
|
-
}
|
|
3341
|
-
}
|
|
3342
|
-
var directiveHandlers = {
|
|
3343
|
-
YAML: function handleYamlDirective(state, name, args) {
|
|
3344
|
-
var match, major, minor;
|
|
3345
|
-
if (state.version !== null) {
|
|
3346
|
-
throwError(state, "duplication of %YAML directive");
|
|
3347
|
-
}
|
|
3348
|
-
if (args.length !== 1) {
|
|
3349
|
-
throwError(state, "YAML directive accepts exactly one argument");
|
|
3350
|
-
}
|
|
3351
|
-
match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
|
|
3352
|
-
if (match === null) {
|
|
3353
|
-
throwError(state, "ill-formed argument of the YAML directive");
|
|
3354
|
-
}
|
|
3355
|
-
major = parseInt(match[1], 10);
|
|
3356
|
-
minor = parseInt(match[2], 10);
|
|
3357
|
-
if (major !== 1) {
|
|
3358
|
-
throwError(state, "unacceptable YAML version of the document");
|
|
3359
|
-
}
|
|
3360
|
-
state.version = args[0];
|
|
3361
|
-
state.checkLineBreaks = minor < 2;
|
|
3362
|
-
if (minor !== 1 && minor !== 2) {
|
|
3363
|
-
throwWarning(state, "unsupported YAML version of the document");
|
|
3364
|
-
}
|
|
3365
|
-
},
|
|
3366
|
-
TAG: function handleTagDirective(state, name, args) {
|
|
3367
|
-
var handle, prefix;
|
|
3368
|
-
if (args.length !== 2) {
|
|
3369
|
-
throwError(state, "TAG directive accepts exactly two arguments");
|
|
3370
|
-
}
|
|
3371
|
-
handle = args[0];
|
|
3372
|
-
prefix = args[1];
|
|
3373
|
-
if (!PATTERN_TAG_HANDLE.test(handle)) {
|
|
3374
|
-
throwError(state, "ill-formed tag handle (first argument) of the TAG directive");
|
|
3375
|
-
}
|
|
3376
|
-
if (_hasOwnProperty$1.call(state.tagMap, handle)) {
|
|
3377
|
-
throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
|
|
3378
|
-
}
|
|
3379
|
-
if (!PATTERN_TAG_URI.test(prefix)) {
|
|
3380
|
-
throwError(state, "ill-formed tag prefix (second argument) of the TAG directive");
|
|
3381
|
-
}
|
|
3382
|
-
try {
|
|
3383
|
-
prefix = decodeURIComponent(prefix);
|
|
3384
|
-
} catch (err) {
|
|
3385
|
-
throwError(state, "tag prefix is malformed: " + prefix);
|
|
3386
|
-
}
|
|
3387
|
-
state.tagMap[handle] = prefix;
|
|
3388
|
-
}
|
|
3389
|
-
};
|
|
3390
|
-
function captureSegment(state, start, end, checkJson) {
|
|
3391
|
-
var _position, _length, _character, _result;
|
|
3392
|
-
if (start < end) {
|
|
3393
|
-
_result = state.input.slice(start, end);
|
|
3394
|
-
if (checkJson) {
|
|
3395
|
-
for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
|
|
3396
|
-
_character = _result.charCodeAt(_position);
|
|
3397
|
-
if (!(_character === 9 || 32 <= _character && _character <= 1114111)) {
|
|
3398
|
-
throwError(state, "expected valid JSON character");
|
|
3399
|
-
}
|
|
3400
|
-
}
|
|
3401
|
-
} else if (PATTERN_NON_PRINTABLE.test(_result)) {
|
|
3402
|
-
throwError(state, "the stream contains non-printable characters");
|
|
3403
|
-
}
|
|
3404
|
-
state.result += _result;
|
|
3405
|
-
}
|
|
3406
|
-
}
|
|
3407
|
-
function mergeMappings(state, destination, source, overridableKeys) {
|
|
3408
|
-
var sourceKeys, key, index, quantity;
|
|
3409
|
-
if (!common.isObject(source)) {
|
|
3410
|
-
throwError(state, "cannot merge mappings; the provided source object is unacceptable");
|
|
3411
|
-
}
|
|
3412
|
-
sourceKeys = Object.keys(source);
|
|
3413
|
-
for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
|
|
3414
|
-
key = sourceKeys[index];
|
|
3415
|
-
if (!_hasOwnProperty$1.call(destination, key)) {
|
|
3416
|
-
destination[key] = source[key];
|
|
3417
|
-
overridableKeys[key] = true;
|
|
3418
|
-
}
|
|
3419
|
-
}
|
|
3420
|
-
}
|
|
3421
|
-
function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startLineStart, startPos) {
|
|
3422
|
-
var index, quantity;
|
|
3423
|
-
if (Array.isArray(keyNode)) {
|
|
3424
|
-
keyNode = Array.prototype.slice.call(keyNode);
|
|
3425
|
-
for (index = 0, quantity = keyNode.length; index < quantity; index += 1) {
|
|
3426
|
-
if (Array.isArray(keyNode[index])) {
|
|
3427
|
-
throwError(state, "nested arrays are not supported inside keys");
|
|
3428
|
-
}
|
|
3429
|
-
if (typeof keyNode === "object" && _class(keyNode[index]) === "[object Object]") {
|
|
3430
|
-
keyNode[index] = "[object Object]";
|
|
3431
|
-
}
|
|
3432
|
-
}
|
|
3433
|
-
}
|
|
3434
|
-
if (typeof keyNode === "object" && _class(keyNode) === "[object Object]") {
|
|
3435
|
-
keyNode = "[object Object]";
|
|
3436
|
-
}
|
|
3437
|
-
keyNode = String(keyNode);
|
|
3438
|
-
if (_result === null) {
|
|
3439
|
-
_result = {};
|
|
3440
|
-
}
|
|
3441
|
-
if (keyTag === "tag:yaml.org,2002:merge") {
|
|
3442
|
-
if (Array.isArray(valueNode)) {
|
|
3443
|
-
for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
|
|
3444
|
-
mergeMappings(state, _result, valueNode[index], overridableKeys);
|
|
3445
|
-
}
|
|
3446
|
-
} else {
|
|
3447
|
-
mergeMappings(state, _result, valueNode, overridableKeys);
|
|
3448
|
-
}
|
|
3449
|
-
} else {
|
|
3450
|
-
if (!state.json && !_hasOwnProperty$1.call(overridableKeys, keyNode) && _hasOwnProperty$1.call(_result, keyNode)) {
|
|
3451
|
-
state.line = startLine || state.line;
|
|
3452
|
-
state.lineStart = startLineStart || state.lineStart;
|
|
3453
|
-
state.position = startPos || state.position;
|
|
3454
|
-
throwError(state, "duplicated mapping key");
|
|
3455
|
-
}
|
|
3456
|
-
if (keyNode === "__proto__") {
|
|
3457
|
-
Object.defineProperty(_result, keyNode, {
|
|
3458
|
-
configurable: true,
|
|
3459
|
-
enumerable: true,
|
|
3460
|
-
writable: true,
|
|
3461
|
-
value: valueNode
|
|
3462
|
-
});
|
|
3463
|
-
} else {
|
|
3464
|
-
_result[keyNode] = valueNode;
|
|
3465
|
-
}
|
|
3466
|
-
delete overridableKeys[keyNode];
|
|
3467
|
-
}
|
|
3468
|
-
return _result;
|
|
3469
|
-
}
|
|
3470
|
-
function readLineBreak(state) {
|
|
3471
|
-
var ch;
|
|
3472
|
-
ch = state.input.charCodeAt(state.position);
|
|
3473
|
-
if (ch === 10) {
|
|
3474
|
-
state.position++;
|
|
3475
|
-
} else if (ch === 13) {
|
|
3476
|
-
state.position++;
|
|
3477
|
-
if (state.input.charCodeAt(state.position) === 10) {
|
|
3478
|
-
state.position++;
|
|
3479
|
-
}
|
|
3480
|
-
} else {
|
|
3481
|
-
throwError(state, "a line break is expected");
|
|
3482
|
-
}
|
|
3483
|
-
state.line += 1;
|
|
3484
|
-
state.lineStart = state.position;
|
|
3485
|
-
state.firstTabInLine = -1;
|
|
3486
|
-
}
|
|
3487
|
-
function skipSeparationSpace(state, allowComments, checkIndent) {
|
|
3488
|
-
var lineBreaks = 0, ch = state.input.charCodeAt(state.position);
|
|
3489
|
-
while (ch !== 0) {
|
|
3490
|
-
while (is_WHITE_SPACE(ch)) {
|
|
3491
|
-
if (ch === 9 && state.firstTabInLine === -1) {
|
|
3492
|
-
state.firstTabInLine = state.position;
|
|
3493
|
-
}
|
|
3494
|
-
ch = state.input.charCodeAt(++state.position);
|
|
3495
|
-
}
|
|
3496
|
-
if (allowComments && ch === 35) {
|
|
3497
|
-
do {
|
|
3498
|
-
ch = state.input.charCodeAt(++state.position);
|
|
3499
|
-
} while (ch !== 10 && ch !== 13 && ch !== 0);
|
|
3500
|
-
}
|
|
3501
|
-
if (is_EOL(ch)) {
|
|
3502
|
-
readLineBreak(state);
|
|
3503
|
-
ch = state.input.charCodeAt(state.position);
|
|
3504
|
-
lineBreaks++;
|
|
3505
|
-
state.lineIndent = 0;
|
|
3506
|
-
while (ch === 32) {
|
|
3507
|
-
state.lineIndent++;
|
|
3508
|
-
ch = state.input.charCodeAt(++state.position);
|
|
3509
|
-
}
|
|
3510
|
-
} else {
|
|
3511
|
-
break;
|
|
3512
|
-
}
|
|
3513
|
-
}
|
|
3514
|
-
if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {
|
|
3515
|
-
throwWarning(state, "deficient indentation");
|
|
3516
|
-
}
|
|
3517
|
-
return lineBreaks;
|
|
3518
|
-
}
|
|
3519
|
-
function testDocumentSeparator(state) {
|
|
3520
|
-
var _position = state.position, ch;
|
|
3521
|
-
ch = state.input.charCodeAt(_position);
|
|
3522
|
-
if ((ch === 45 || ch === 46) && ch === state.input.charCodeAt(_position + 1) && ch === state.input.charCodeAt(_position + 2)) {
|
|
3523
|
-
_position += 3;
|
|
3524
|
-
ch = state.input.charCodeAt(_position);
|
|
3525
|
-
if (ch === 0 || is_WS_OR_EOL(ch)) {
|
|
3526
|
-
return true;
|
|
3527
|
-
}
|
|
3528
|
-
}
|
|
3529
|
-
return false;
|
|
3530
|
-
}
|
|
3531
|
-
function writeFoldedLines(state, count) {
|
|
3532
|
-
if (count === 1) {
|
|
3533
|
-
state.result += " ";
|
|
3534
|
-
} else if (count > 1) {
|
|
3535
|
-
state.result += common.repeat("\n", count - 1);
|
|
3536
|
-
}
|
|
3537
|
-
}
|
|
3538
|
-
function readPlainScalar(state, nodeIndent, withinFlowCollection) {
|
|
3539
|
-
var preceding, following, captureStart, captureEnd, hasPendingContent, _line, _lineStart, _lineIndent, _kind = state.kind, _result = state.result, ch;
|
|
3540
|
-
ch = state.input.charCodeAt(state.position);
|
|
3541
|
-
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) {
|
|
3542
|
-
return false;
|
|
3543
|
-
}
|
|
3544
|
-
if (ch === 63 || ch === 45) {
|
|
3545
|
-
following = state.input.charCodeAt(state.position + 1);
|
|
3546
|
-
if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
|
|
3547
|
-
return false;
|
|
3548
|
-
}
|
|
3549
|
-
}
|
|
3550
|
-
state.kind = "scalar";
|
|
3551
|
-
state.result = "";
|
|
3552
|
-
captureStart = captureEnd = state.position;
|
|
3553
|
-
hasPendingContent = false;
|
|
3554
|
-
while (ch !== 0) {
|
|
3555
|
-
if (ch === 58) {
|
|
3556
|
-
following = state.input.charCodeAt(state.position + 1);
|
|
3557
|
-
if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
|
|
3558
|
-
break;
|
|
3559
|
-
}
|
|
3560
|
-
} else if (ch === 35) {
|
|
3561
|
-
preceding = state.input.charCodeAt(state.position - 1);
|
|
3562
|
-
if (is_WS_OR_EOL(preceding)) {
|
|
3563
|
-
break;
|
|
3564
|
-
}
|
|
3565
|
-
} else if (state.position === state.lineStart && testDocumentSeparator(state) || withinFlowCollection && is_FLOW_INDICATOR(ch)) {
|
|
3566
|
-
break;
|
|
3567
|
-
} else if (is_EOL(ch)) {
|
|
3568
|
-
_line = state.line;
|
|
3569
|
-
_lineStart = state.lineStart;
|
|
3570
|
-
_lineIndent = state.lineIndent;
|
|
3571
|
-
skipSeparationSpace(state, false, -1);
|
|
3572
|
-
if (state.lineIndent >= nodeIndent) {
|
|
3573
|
-
hasPendingContent = true;
|
|
3574
|
-
ch = state.input.charCodeAt(state.position);
|
|
3575
|
-
continue;
|
|
3576
|
-
} else {
|
|
3577
|
-
state.position = captureEnd;
|
|
3578
|
-
state.line = _line;
|
|
3579
|
-
state.lineStart = _lineStart;
|
|
3580
|
-
state.lineIndent = _lineIndent;
|
|
3581
|
-
break;
|
|
3582
|
-
}
|
|
3583
|
-
}
|
|
3584
|
-
if (hasPendingContent) {
|
|
3585
|
-
captureSegment(state, captureStart, captureEnd, false);
|
|
3586
|
-
writeFoldedLines(state, state.line - _line);
|
|
3587
|
-
captureStart = captureEnd = state.position;
|
|
3588
|
-
hasPendingContent = false;
|
|
3589
|
-
}
|
|
3590
|
-
if (!is_WHITE_SPACE(ch)) {
|
|
3591
|
-
captureEnd = state.position + 1;
|
|
3592
|
-
}
|
|
3593
|
-
ch = state.input.charCodeAt(++state.position);
|
|
3594
|
-
}
|
|
3595
|
-
captureSegment(state, captureStart, captureEnd, false);
|
|
3596
|
-
if (state.result) {
|
|
3597
|
-
return true;
|
|
3598
|
-
}
|
|
3599
|
-
state.kind = _kind;
|
|
3600
|
-
state.result = _result;
|
|
3601
|
-
return false;
|
|
3602
|
-
}
|
|
3603
|
-
function readSingleQuotedScalar(state, nodeIndent) {
|
|
3604
|
-
var ch, captureStart, captureEnd;
|
|
3605
|
-
ch = state.input.charCodeAt(state.position);
|
|
3606
|
-
if (ch !== 39) {
|
|
3607
|
-
return false;
|
|
3608
|
-
}
|
|
3609
|
-
state.kind = "scalar";
|
|
3610
|
-
state.result = "";
|
|
3611
|
-
state.position++;
|
|
3612
|
-
captureStart = captureEnd = state.position;
|
|
3613
|
-
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
3614
|
-
if (ch === 39) {
|
|
3615
|
-
captureSegment(state, captureStart, state.position, true);
|
|
3616
|
-
ch = state.input.charCodeAt(++state.position);
|
|
3617
|
-
if (ch === 39) {
|
|
3618
|
-
captureStart = state.position;
|
|
3619
|
-
state.position++;
|
|
3620
|
-
captureEnd = state.position;
|
|
3621
|
-
} else {
|
|
3622
|
-
return true;
|
|
3623
|
-
}
|
|
3624
|
-
} else if (is_EOL(ch)) {
|
|
3625
|
-
captureSegment(state, captureStart, captureEnd, true);
|
|
3626
|
-
writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
|
|
3627
|
-
captureStart = captureEnd = state.position;
|
|
3628
|
-
} else if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
3629
|
-
throwError(state, "unexpected end of the document within a single quoted scalar");
|
|
3630
|
-
} else {
|
|
3631
|
-
state.position++;
|
|
3632
|
-
captureEnd = state.position;
|
|
3633
|
-
}
|
|
3634
|
-
}
|
|
3635
|
-
throwError(state, "unexpected end of the stream within a single quoted scalar");
|
|
3636
|
-
}
|
|
3637
|
-
function readDoubleQuotedScalar(state, nodeIndent) {
|
|
3638
|
-
var captureStart, captureEnd, hexLength, hexResult, tmp, ch;
|
|
3639
|
-
ch = state.input.charCodeAt(state.position);
|
|
3640
|
-
if (ch !== 34) {
|
|
3641
|
-
return false;
|
|
3642
|
-
}
|
|
3643
|
-
state.kind = "scalar";
|
|
3644
|
-
state.result = "";
|
|
3645
|
-
state.position++;
|
|
3646
|
-
captureStart = captureEnd = state.position;
|
|
3647
|
-
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
3648
|
-
if (ch === 34) {
|
|
3649
|
-
captureSegment(state, captureStart, state.position, true);
|
|
3650
|
-
state.position++;
|
|
3651
|
-
return true;
|
|
3652
|
-
} else if (ch === 92) {
|
|
3653
|
-
captureSegment(state, captureStart, state.position, true);
|
|
3654
|
-
ch = state.input.charCodeAt(++state.position);
|
|
3655
|
-
if (is_EOL(ch)) {
|
|
3656
|
-
skipSeparationSpace(state, false, nodeIndent);
|
|
3657
|
-
} else if (ch < 256 && simpleEscapeCheck[ch]) {
|
|
3658
|
-
state.result += simpleEscapeMap[ch];
|
|
3659
|
-
state.position++;
|
|
3660
|
-
} else if ((tmp = escapedHexLen(ch)) > 0) {
|
|
3661
|
-
hexLength = tmp;
|
|
3662
|
-
hexResult = 0;
|
|
3663
|
-
for (; hexLength > 0; hexLength--) {
|
|
3664
|
-
ch = state.input.charCodeAt(++state.position);
|
|
3665
|
-
if ((tmp = fromHexCode(ch)) >= 0) {
|
|
3666
|
-
hexResult = (hexResult << 4) + tmp;
|
|
3667
|
-
} else {
|
|
3668
|
-
throwError(state, "expected hexadecimal character");
|
|
3669
|
-
}
|
|
3670
|
-
}
|
|
3671
|
-
state.result += charFromCodepoint(hexResult);
|
|
3672
|
-
state.position++;
|
|
3673
|
-
} else {
|
|
3674
|
-
throwError(state, "unknown escape sequence");
|
|
3675
|
-
}
|
|
3676
|
-
captureStart = captureEnd = state.position;
|
|
3677
|
-
} else if (is_EOL(ch)) {
|
|
3678
|
-
captureSegment(state, captureStart, captureEnd, true);
|
|
3679
|
-
writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
|
|
3680
|
-
captureStart = captureEnd = state.position;
|
|
3681
|
-
} else if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
3682
|
-
throwError(state, "unexpected end of the document within a double quoted scalar");
|
|
3683
|
-
} else {
|
|
3684
|
-
state.position++;
|
|
3685
|
-
captureEnd = state.position;
|
|
3686
|
-
}
|
|
3687
|
-
}
|
|
3688
|
-
throwError(state, "unexpected end of the stream within a double quoted scalar");
|
|
3689
|
-
}
|
|
3690
|
-
function readFlowCollection(state, nodeIndent) {
|
|
3691
|
-
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;
|
|
3692
|
-
ch = state.input.charCodeAt(state.position);
|
|
3693
|
-
if (ch === 91) {
|
|
3694
|
-
terminator = 93;
|
|
3695
|
-
isMapping = false;
|
|
3696
|
-
_result = [];
|
|
3697
|
-
} else if (ch === 123) {
|
|
3698
|
-
terminator = 125;
|
|
3699
|
-
isMapping = true;
|
|
3700
|
-
_result = {};
|
|
3701
|
-
} else {
|
|
3702
|
-
return false;
|
|
3703
|
-
}
|
|
3704
|
-
if (state.anchor !== null) {
|
|
3705
|
-
state.anchorMap[state.anchor] = _result;
|
|
3706
|
-
}
|
|
3707
|
-
ch = state.input.charCodeAt(++state.position);
|
|
3708
|
-
while (ch !== 0) {
|
|
3709
|
-
skipSeparationSpace(state, true, nodeIndent);
|
|
3710
|
-
ch = state.input.charCodeAt(state.position);
|
|
3711
|
-
if (ch === terminator) {
|
|
3712
|
-
state.position++;
|
|
3713
|
-
state.tag = _tag;
|
|
3714
|
-
state.anchor = _anchor;
|
|
3715
|
-
state.kind = isMapping ? "mapping" : "sequence";
|
|
3716
|
-
state.result = _result;
|
|
3717
|
-
return true;
|
|
3718
|
-
} else if (!readNext) {
|
|
3719
|
-
throwError(state, "missed comma between flow collection entries");
|
|
3720
|
-
} else if (ch === 44) {
|
|
3721
|
-
throwError(state, "expected the node content, but found ','");
|
|
3722
|
-
}
|
|
3723
|
-
keyTag = keyNode = valueNode = null;
|
|
3724
|
-
isPair = isExplicitPair = false;
|
|
3725
|
-
if (ch === 63) {
|
|
3726
|
-
following = state.input.charCodeAt(state.position + 1);
|
|
3727
|
-
if (is_WS_OR_EOL(following)) {
|
|
3728
|
-
isPair = isExplicitPair = true;
|
|
3729
|
-
state.position++;
|
|
3730
|
-
skipSeparationSpace(state, true, nodeIndent);
|
|
3731
|
-
}
|
|
3732
|
-
}
|
|
3733
|
-
_line = state.line;
|
|
3734
|
-
_lineStart = state.lineStart;
|
|
3735
|
-
_pos = state.position;
|
|
3736
|
-
composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
|
3737
|
-
keyTag = state.tag;
|
|
3738
|
-
keyNode = state.result;
|
|
3739
|
-
skipSeparationSpace(state, true, nodeIndent);
|
|
3740
|
-
ch = state.input.charCodeAt(state.position);
|
|
3741
|
-
if ((isExplicitPair || state.line === _line) && ch === 58) {
|
|
3742
|
-
isPair = true;
|
|
3743
|
-
ch = state.input.charCodeAt(++state.position);
|
|
3744
|
-
skipSeparationSpace(state, true, nodeIndent);
|
|
3745
|
-
composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
|
3746
|
-
valueNode = state.result;
|
|
3747
|
-
}
|
|
3748
|
-
if (isMapping) {
|
|
3749
|
-
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos);
|
|
3750
|
-
} else if (isPair) {
|
|
3751
|
-
_result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos));
|
|
3752
|
-
} else {
|
|
3753
|
-
_result.push(keyNode);
|
|
3754
|
-
}
|
|
3755
|
-
skipSeparationSpace(state, true, nodeIndent);
|
|
3756
|
-
ch = state.input.charCodeAt(state.position);
|
|
3757
|
-
if (ch === 44) {
|
|
3758
|
-
readNext = true;
|
|
3759
|
-
ch = state.input.charCodeAt(++state.position);
|
|
3760
|
-
} else {
|
|
3761
|
-
readNext = false;
|
|
3762
|
-
}
|
|
3763
|
-
}
|
|
3764
|
-
throwError(state, "unexpected end of the stream within a flow collection");
|
|
3765
|
-
}
|
|
3766
|
-
function readBlockScalar(state, nodeIndent) {
|
|
3767
|
-
var captureStart, folding, chomping = CHOMPING_CLIP, didReadContent = false, detectedIndent = false, textIndent = nodeIndent, emptyLines = 0, atMoreIndented = false, tmp, ch;
|
|
3768
|
-
ch = state.input.charCodeAt(state.position);
|
|
3769
|
-
if (ch === 124) {
|
|
3770
|
-
folding = false;
|
|
3771
|
-
} else if (ch === 62) {
|
|
3772
|
-
folding = true;
|
|
3773
|
-
} else {
|
|
3774
|
-
return false;
|
|
3775
|
-
}
|
|
3776
|
-
state.kind = "scalar";
|
|
3777
|
-
state.result = "";
|
|
3778
|
-
while (ch !== 0) {
|
|
3779
|
-
ch = state.input.charCodeAt(++state.position);
|
|
3780
|
-
if (ch === 43 || ch === 45) {
|
|
3781
|
-
if (CHOMPING_CLIP === chomping) {
|
|
3782
|
-
chomping = ch === 43 ? CHOMPING_KEEP : CHOMPING_STRIP;
|
|
3783
|
-
} else {
|
|
3784
|
-
throwError(state, "repeat of a chomping mode identifier");
|
|
3785
|
-
}
|
|
3786
|
-
} else if ((tmp = fromDecimalCode(ch)) >= 0) {
|
|
3787
|
-
if (tmp === 0) {
|
|
3788
|
-
throwError(state, "bad explicit indentation width of a block scalar; it cannot be less than one");
|
|
3789
|
-
} else if (!detectedIndent) {
|
|
3790
|
-
textIndent = nodeIndent + tmp - 1;
|
|
3791
|
-
detectedIndent = true;
|
|
3792
|
-
} else {
|
|
3793
|
-
throwError(state, "repeat of an indentation width identifier");
|
|
3794
|
-
}
|
|
3795
|
-
} else {
|
|
3796
|
-
break;
|
|
3797
|
-
}
|
|
3798
|
-
}
|
|
3799
|
-
if (is_WHITE_SPACE(ch)) {
|
|
3800
|
-
do {
|
|
3801
|
-
ch = state.input.charCodeAt(++state.position);
|
|
3802
|
-
} while (is_WHITE_SPACE(ch));
|
|
3803
|
-
if (ch === 35) {
|
|
3804
|
-
do {
|
|
3805
|
-
ch = state.input.charCodeAt(++state.position);
|
|
3806
|
-
} while (!is_EOL(ch) && ch !== 0);
|
|
3807
|
-
}
|
|
3808
|
-
}
|
|
3809
|
-
while (ch !== 0) {
|
|
3810
|
-
readLineBreak(state);
|
|
3811
|
-
state.lineIndent = 0;
|
|
3812
|
-
ch = state.input.charCodeAt(state.position);
|
|
3813
|
-
while ((!detectedIndent || state.lineIndent < textIndent) && ch === 32) {
|
|
3814
|
-
state.lineIndent++;
|
|
3815
|
-
ch = state.input.charCodeAt(++state.position);
|
|
3816
|
-
}
|
|
3817
|
-
if (!detectedIndent && state.lineIndent > textIndent) {
|
|
3818
|
-
textIndent = state.lineIndent;
|
|
3819
|
-
}
|
|
3820
|
-
if (is_EOL(ch)) {
|
|
3821
|
-
emptyLines++;
|
|
3822
|
-
continue;
|
|
3823
|
-
}
|
|
3824
|
-
if (state.lineIndent < textIndent) {
|
|
3825
|
-
if (chomping === CHOMPING_KEEP) {
|
|
3826
|
-
state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
|
3827
|
-
} else if (chomping === CHOMPING_CLIP) {
|
|
3828
|
-
if (didReadContent) {
|
|
3829
|
-
state.result += "\n";
|
|
3830
|
-
}
|
|
3831
|
-
}
|
|
3832
|
-
break;
|
|
3833
|
-
}
|
|
3834
|
-
if (folding) {
|
|
3835
|
-
if (is_WHITE_SPACE(ch)) {
|
|
3836
|
-
atMoreIndented = true;
|
|
3837
|
-
state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
|
3838
|
-
} else if (atMoreIndented) {
|
|
3839
|
-
atMoreIndented = false;
|
|
3840
|
-
state.result += common.repeat("\n", emptyLines + 1);
|
|
3841
|
-
} else if (emptyLines === 0) {
|
|
3842
|
-
if (didReadContent) {
|
|
3843
|
-
state.result += " ";
|
|
3844
|
-
}
|
|
3845
|
-
} else {
|
|
3846
|
-
state.result += common.repeat("\n", emptyLines);
|
|
3847
|
-
}
|
|
3848
|
-
} else {
|
|
3849
|
-
state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
|
3850
|
-
}
|
|
3851
|
-
didReadContent = true;
|
|
3852
|
-
detectedIndent = true;
|
|
3853
|
-
emptyLines = 0;
|
|
3854
|
-
captureStart = state.position;
|
|
3855
|
-
while (!is_EOL(ch) && ch !== 0) {
|
|
3856
|
-
ch = state.input.charCodeAt(++state.position);
|
|
3857
|
-
}
|
|
3858
|
-
captureSegment(state, captureStart, state.position, false);
|
|
3859
|
-
}
|
|
3860
|
-
return true;
|
|
3861
|
-
}
|
|
3862
|
-
function readBlockSequence(state, nodeIndent) {
|
|
3863
|
-
var _line, _tag = state.tag, _anchor = state.anchor, _result = [], following, detected = false, ch;
|
|
3864
|
-
if (state.firstTabInLine !== -1)
|
|
3865
|
-
return false;
|
|
3866
|
-
if (state.anchor !== null) {
|
|
3867
|
-
state.anchorMap[state.anchor] = _result;
|
|
3868
|
-
}
|
|
3869
|
-
ch = state.input.charCodeAt(state.position);
|
|
3870
|
-
while (ch !== 0) {
|
|
3871
|
-
if (state.firstTabInLine !== -1) {
|
|
3872
|
-
state.position = state.firstTabInLine;
|
|
3873
|
-
throwError(state, "tab characters must not be used in indentation");
|
|
3874
|
-
}
|
|
3875
|
-
if (ch !== 45) {
|
|
3876
|
-
break;
|
|
3877
|
-
}
|
|
3878
|
-
following = state.input.charCodeAt(state.position + 1);
|
|
3879
|
-
if (!is_WS_OR_EOL(following)) {
|
|
3880
|
-
break;
|
|
3881
|
-
}
|
|
3882
|
-
detected = true;
|
|
3883
|
-
state.position++;
|
|
3884
|
-
if (skipSeparationSpace(state, true, -1)) {
|
|
3885
|
-
if (state.lineIndent <= nodeIndent) {
|
|
3886
|
-
_result.push(null);
|
|
3887
|
-
ch = state.input.charCodeAt(state.position);
|
|
3888
|
-
continue;
|
|
3889
|
-
}
|
|
3890
|
-
}
|
|
3891
|
-
_line = state.line;
|
|
3892
|
-
composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
|
|
3893
|
-
_result.push(state.result);
|
|
3894
|
-
skipSeparationSpace(state, true, -1);
|
|
3895
|
-
ch = state.input.charCodeAt(state.position);
|
|
3896
|
-
if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
|
|
3897
|
-
throwError(state, "bad indentation of a sequence entry");
|
|
3898
|
-
} else if (state.lineIndent < nodeIndent) {
|
|
3899
|
-
break;
|
|
3900
|
-
}
|
|
3901
|
-
}
|
|
3902
|
-
if (detected) {
|
|
3903
|
-
state.tag = _tag;
|
|
3904
|
-
state.anchor = _anchor;
|
|
3905
|
-
state.kind = "sequence";
|
|
3906
|
-
state.result = _result;
|
|
3907
|
-
return true;
|
|
3908
|
-
}
|
|
3909
|
-
return false;
|
|
3910
|
-
}
|
|
3911
|
-
function readBlockMapping(state, nodeIndent, flowIndent) {
|
|
3912
|
-
var following, allowCompact, _line, _keyLine, _keyLineStart, _keyPos, _tag = state.tag, _anchor = state.anchor, _result = {}, overridableKeys = /* @__PURE__ */ Object.create(null), keyTag = null, keyNode = null, valueNode = null, atExplicitKey = false, detected = false, ch;
|
|
3913
|
-
if (state.firstTabInLine !== -1)
|
|
3914
|
-
return false;
|
|
3915
|
-
if (state.anchor !== null) {
|
|
3916
|
-
state.anchorMap[state.anchor] = _result;
|
|
3917
|
-
}
|
|
3918
|
-
ch = state.input.charCodeAt(state.position);
|
|
3919
|
-
while (ch !== 0) {
|
|
3920
|
-
if (!atExplicitKey && state.firstTabInLine !== -1) {
|
|
3921
|
-
state.position = state.firstTabInLine;
|
|
3922
|
-
throwError(state, "tab characters must not be used in indentation");
|
|
3923
|
-
}
|
|
3924
|
-
following = state.input.charCodeAt(state.position + 1);
|
|
3925
|
-
_line = state.line;
|
|
3926
|
-
if ((ch === 63 || ch === 58) && is_WS_OR_EOL(following)) {
|
|
3927
|
-
if (ch === 63) {
|
|
3928
|
-
if (atExplicitKey) {
|
|
3929
|
-
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
|
3930
|
-
keyTag = keyNode = valueNode = null;
|
|
3931
|
-
}
|
|
3932
|
-
detected = true;
|
|
3933
|
-
atExplicitKey = true;
|
|
3934
|
-
allowCompact = true;
|
|
3935
|
-
} else if (atExplicitKey) {
|
|
3936
|
-
atExplicitKey = false;
|
|
3937
|
-
allowCompact = true;
|
|
3938
|
-
} else {
|
|
3939
|
-
throwError(state, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");
|
|
3940
|
-
}
|
|
3941
|
-
state.position += 1;
|
|
3942
|
-
ch = following;
|
|
3943
|
-
} else {
|
|
3944
|
-
_keyLine = state.line;
|
|
3945
|
-
_keyLineStart = state.lineStart;
|
|
3946
|
-
_keyPos = state.position;
|
|
3947
|
-
if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
|
|
3948
|
-
break;
|
|
3949
|
-
}
|
|
3950
|
-
if (state.line === _line) {
|
|
3951
|
-
ch = state.input.charCodeAt(state.position);
|
|
3952
|
-
while (is_WHITE_SPACE(ch)) {
|
|
3953
|
-
ch = state.input.charCodeAt(++state.position);
|
|
3954
|
-
}
|
|
3955
|
-
if (ch === 58) {
|
|
3956
|
-
ch = state.input.charCodeAt(++state.position);
|
|
3957
|
-
if (!is_WS_OR_EOL(ch)) {
|
|
3958
|
-
throwError(state, "a whitespace character is expected after the key-value separator within a block mapping");
|
|
3959
|
-
}
|
|
3960
|
-
if (atExplicitKey) {
|
|
3961
|
-
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
|
3962
|
-
keyTag = keyNode = valueNode = null;
|
|
3963
|
-
}
|
|
3964
|
-
detected = true;
|
|
3965
|
-
atExplicitKey = false;
|
|
3966
|
-
allowCompact = false;
|
|
3967
|
-
keyTag = state.tag;
|
|
3968
|
-
keyNode = state.result;
|
|
3969
|
-
} else if (detected) {
|
|
3970
|
-
throwError(state, "can not read an implicit mapping pair; a colon is missed");
|
|
3971
|
-
} else {
|
|
3972
|
-
state.tag = _tag;
|
|
3973
|
-
state.anchor = _anchor;
|
|
3974
|
-
return true;
|
|
3975
|
-
}
|
|
3976
|
-
} else if (detected) {
|
|
3977
|
-
throwError(state, "can not read a block mapping entry; a multiline key may not be an implicit key");
|
|
3978
|
-
} else {
|
|
3979
|
-
state.tag = _tag;
|
|
3980
|
-
state.anchor = _anchor;
|
|
3981
|
-
return true;
|
|
3982
|
-
}
|
|
3983
|
-
}
|
|
3984
|
-
if (state.line === _line || state.lineIndent > nodeIndent) {
|
|
3985
|
-
if (atExplicitKey) {
|
|
3986
|
-
_keyLine = state.line;
|
|
3987
|
-
_keyLineStart = state.lineStart;
|
|
3988
|
-
_keyPos = state.position;
|
|
3989
|
-
}
|
|
3990
|
-
if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
|
|
3991
|
-
if (atExplicitKey) {
|
|
3992
|
-
keyNode = state.result;
|
|
3993
|
-
} else {
|
|
3994
|
-
valueNode = state.result;
|
|
3995
|
-
}
|
|
3996
|
-
}
|
|
3997
|
-
if (!atExplicitKey) {
|
|
3998
|
-
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos);
|
|
3999
|
-
keyTag = keyNode = valueNode = null;
|
|
4000
|
-
}
|
|
4001
|
-
skipSeparationSpace(state, true, -1);
|
|
4002
|
-
ch = state.input.charCodeAt(state.position);
|
|
4003
|
-
}
|
|
4004
|
-
if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
|
|
4005
|
-
throwError(state, "bad indentation of a mapping entry");
|
|
4006
|
-
} else if (state.lineIndent < nodeIndent) {
|
|
4007
|
-
break;
|
|
4008
|
-
}
|
|
4009
|
-
}
|
|
4010
|
-
if (atExplicitKey) {
|
|
4011
|
-
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
|
4012
|
-
}
|
|
4013
|
-
if (detected) {
|
|
4014
|
-
state.tag = _tag;
|
|
4015
|
-
state.anchor = _anchor;
|
|
4016
|
-
state.kind = "mapping";
|
|
4017
|
-
state.result = _result;
|
|
4018
|
-
}
|
|
4019
|
-
return detected;
|
|
4020
|
-
}
|
|
4021
|
-
function readTagProperty(state) {
|
|
4022
|
-
var _position, isVerbatim = false, isNamed = false, tagHandle, tagName, ch;
|
|
4023
|
-
ch = state.input.charCodeAt(state.position);
|
|
4024
|
-
if (ch !== 33)
|
|
4025
|
-
return false;
|
|
4026
|
-
if (state.tag !== null) {
|
|
4027
|
-
throwError(state, "duplication of a tag property");
|
|
4028
|
-
}
|
|
4029
|
-
ch = state.input.charCodeAt(++state.position);
|
|
4030
|
-
if (ch === 60) {
|
|
4031
|
-
isVerbatim = true;
|
|
4032
|
-
ch = state.input.charCodeAt(++state.position);
|
|
4033
|
-
} else if (ch === 33) {
|
|
4034
|
-
isNamed = true;
|
|
4035
|
-
tagHandle = "!!";
|
|
4036
|
-
ch = state.input.charCodeAt(++state.position);
|
|
4037
|
-
} else {
|
|
4038
|
-
tagHandle = "!";
|
|
4039
|
-
}
|
|
4040
|
-
_position = state.position;
|
|
4041
|
-
if (isVerbatim) {
|
|
4042
|
-
do {
|
|
4043
|
-
ch = state.input.charCodeAt(++state.position);
|
|
4044
|
-
} while (ch !== 0 && ch !== 62);
|
|
4045
|
-
if (state.position < state.length) {
|
|
4046
|
-
tagName = state.input.slice(_position, state.position);
|
|
4047
|
-
ch = state.input.charCodeAt(++state.position);
|
|
4048
|
-
} else {
|
|
4049
|
-
throwError(state, "unexpected end of the stream within a verbatim tag");
|
|
4050
|
-
}
|
|
4051
|
-
} else {
|
|
4052
|
-
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
|
4053
|
-
if (ch === 33) {
|
|
4054
|
-
if (!isNamed) {
|
|
4055
|
-
tagHandle = state.input.slice(_position - 1, state.position + 1);
|
|
4056
|
-
if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
|
|
4057
|
-
throwError(state, "named tag handle cannot contain such characters");
|
|
4058
|
-
}
|
|
4059
|
-
isNamed = true;
|
|
4060
|
-
_position = state.position + 1;
|
|
4061
|
-
} else {
|
|
4062
|
-
throwError(state, "tag suffix cannot contain exclamation marks");
|
|
4063
|
-
}
|
|
4064
|
-
}
|
|
4065
|
-
ch = state.input.charCodeAt(++state.position);
|
|
4066
|
-
}
|
|
4067
|
-
tagName = state.input.slice(_position, state.position);
|
|
4068
|
-
if (PATTERN_FLOW_INDICATORS.test(tagName)) {
|
|
4069
|
-
throwError(state, "tag suffix cannot contain flow indicator characters");
|
|
4070
|
-
}
|
|
4071
|
-
}
|
|
4072
|
-
if (tagName && !PATTERN_TAG_URI.test(tagName)) {
|
|
4073
|
-
throwError(state, "tag name cannot contain such characters: " + tagName);
|
|
4074
|
-
}
|
|
4075
|
-
try {
|
|
4076
|
-
tagName = decodeURIComponent(tagName);
|
|
4077
|
-
} catch (err) {
|
|
4078
|
-
throwError(state, "tag name is malformed: " + tagName);
|
|
4079
|
-
}
|
|
4080
|
-
if (isVerbatim) {
|
|
4081
|
-
state.tag = tagName;
|
|
4082
|
-
} else if (_hasOwnProperty$1.call(state.tagMap, tagHandle)) {
|
|
4083
|
-
state.tag = state.tagMap[tagHandle] + tagName;
|
|
4084
|
-
} else if (tagHandle === "!") {
|
|
4085
|
-
state.tag = "!" + tagName;
|
|
4086
|
-
} else if (tagHandle === "!!") {
|
|
4087
|
-
state.tag = "tag:yaml.org,2002:" + tagName;
|
|
4088
|
-
} else {
|
|
4089
|
-
throwError(state, 'undeclared tag handle "' + tagHandle + '"');
|
|
4090
|
-
}
|
|
4091
|
-
return true;
|
|
4092
|
-
}
|
|
4093
|
-
function readAnchorProperty(state) {
|
|
4094
|
-
var _position, ch;
|
|
4095
|
-
ch = state.input.charCodeAt(state.position);
|
|
4096
|
-
if (ch !== 38)
|
|
4097
|
-
return false;
|
|
4098
|
-
if (state.anchor !== null) {
|
|
4099
|
-
throwError(state, "duplication of an anchor property");
|
|
4100
|
-
}
|
|
4101
|
-
ch = state.input.charCodeAt(++state.position);
|
|
4102
|
-
_position = state.position;
|
|
4103
|
-
while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
|
|
4104
|
-
ch = state.input.charCodeAt(++state.position);
|
|
4105
|
-
}
|
|
4106
|
-
if (state.position === _position) {
|
|
4107
|
-
throwError(state, "name of an anchor node must contain at least one character");
|
|
4108
|
-
}
|
|
4109
|
-
state.anchor = state.input.slice(_position, state.position);
|
|
4110
|
-
return true;
|
|
4111
|
-
}
|
|
4112
|
-
function readAlias(state) {
|
|
4113
|
-
var _position, alias, ch;
|
|
4114
|
-
ch = state.input.charCodeAt(state.position);
|
|
4115
|
-
if (ch !== 42)
|
|
4116
|
-
return false;
|
|
4117
|
-
ch = state.input.charCodeAt(++state.position);
|
|
4118
|
-
_position = state.position;
|
|
4119
|
-
while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
|
|
4120
|
-
ch = state.input.charCodeAt(++state.position);
|
|
4121
|
-
}
|
|
4122
|
-
if (state.position === _position) {
|
|
4123
|
-
throwError(state, "name of an alias node must contain at least one character");
|
|
4124
|
-
}
|
|
4125
|
-
alias = state.input.slice(_position, state.position);
|
|
4126
|
-
if (!_hasOwnProperty$1.call(state.anchorMap, alias)) {
|
|
4127
|
-
throwError(state, 'unidentified alias "' + alias + '"');
|
|
4128
|
-
}
|
|
4129
|
-
state.result = state.anchorMap[alias];
|
|
4130
|
-
skipSeparationSpace(state, true, -1);
|
|
4131
|
-
return true;
|
|
4132
|
-
}
|
|
4133
|
-
function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
|
|
4134
|
-
var allowBlockStyles, allowBlockScalars, allowBlockCollections, indentStatus = 1, atNewLine = false, hasContent = false, typeIndex, typeQuantity, typeList, type2, flowIndent, blockIndent;
|
|
4135
|
-
if (state.listener !== null) {
|
|
4136
|
-
state.listener("open", state);
|
|
4137
|
-
}
|
|
4138
|
-
state.tag = null;
|
|
4139
|
-
state.anchor = null;
|
|
4140
|
-
state.kind = null;
|
|
4141
|
-
state.result = null;
|
|
4142
|
-
allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext;
|
|
4143
|
-
if (allowToSeek) {
|
|
4144
|
-
if (skipSeparationSpace(state, true, -1)) {
|
|
4145
|
-
atNewLine = true;
|
|
4146
|
-
if (state.lineIndent > parentIndent) {
|
|
4147
|
-
indentStatus = 1;
|
|
4148
|
-
} else if (state.lineIndent === parentIndent) {
|
|
4149
|
-
indentStatus = 0;
|
|
4150
|
-
} else if (state.lineIndent < parentIndent) {
|
|
4151
|
-
indentStatus = -1;
|
|
4152
|
-
}
|
|
4153
|
-
}
|
|
4154
|
-
}
|
|
4155
|
-
if (indentStatus === 1) {
|
|
4156
|
-
while (readTagProperty(state) || readAnchorProperty(state)) {
|
|
4157
|
-
if (skipSeparationSpace(state, true, -1)) {
|
|
4158
|
-
atNewLine = true;
|
|
4159
|
-
allowBlockCollections = allowBlockStyles;
|
|
4160
|
-
if (state.lineIndent > parentIndent) {
|
|
4161
|
-
indentStatus = 1;
|
|
4162
|
-
} else if (state.lineIndent === parentIndent) {
|
|
4163
|
-
indentStatus = 0;
|
|
4164
|
-
} else if (state.lineIndent < parentIndent) {
|
|
4165
|
-
indentStatus = -1;
|
|
4166
|
-
}
|
|
4167
|
-
} else {
|
|
4168
|
-
allowBlockCollections = false;
|
|
4169
|
-
}
|
|
4170
|
-
}
|
|
4171
|
-
}
|
|
4172
|
-
if (allowBlockCollections) {
|
|
4173
|
-
allowBlockCollections = atNewLine || allowCompact;
|
|
4174
|
-
}
|
|
4175
|
-
if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
|
|
4176
|
-
if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
|
|
4177
|
-
flowIndent = parentIndent;
|
|
4178
|
-
} else {
|
|
4179
|
-
flowIndent = parentIndent + 1;
|
|
4180
|
-
}
|
|
4181
|
-
blockIndent = state.position - state.lineStart;
|
|
4182
|
-
if (indentStatus === 1) {
|
|
4183
|
-
if (allowBlockCollections && (readBlockSequence(state, blockIndent) || readBlockMapping(state, blockIndent, flowIndent)) || readFlowCollection(state, flowIndent)) {
|
|
4184
|
-
hasContent = true;
|
|
4185
|
-
} else {
|
|
4186
|
-
if (allowBlockScalars && readBlockScalar(state, flowIndent) || readSingleQuotedScalar(state, flowIndent) || readDoubleQuotedScalar(state, flowIndent)) {
|
|
4187
|
-
hasContent = true;
|
|
4188
|
-
} else if (readAlias(state)) {
|
|
4189
|
-
hasContent = true;
|
|
4190
|
-
if (state.tag !== null || state.anchor !== null) {
|
|
4191
|
-
throwError(state, "alias node should not have any properties");
|
|
4192
|
-
}
|
|
4193
|
-
} else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
|
|
4194
|
-
hasContent = true;
|
|
4195
|
-
if (state.tag === null) {
|
|
4196
|
-
state.tag = "?";
|
|
4197
|
-
}
|
|
4198
|
-
}
|
|
4199
|
-
if (state.anchor !== null) {
|
|
4200
|
-
state.anchorMap[state.anchor] = state.result;
|
|
4201
|
-
}
|
|
4202
|
-
}
|
|
4203
|
-
} else if (indentStatus === 0) {
|
|
4204
|
-
hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
|
|
4205
|
-
}
|
|
4206
|
-
}
|
|
4207
|
-
if (state.tag === null) {
|
|
4208
|
-
if (state.anchor !== null) {
|
|
4209
|
-
state.anchorMap[state.anchor] = state.result;
|
|
4210
|
-
}
|
|
4211
|
-
} else if (state.tag === "?") {
|
|
4212
|
-
if (state.result !== null && state.kind !== "scalar") {
|
|
4213
|
-
throwError(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"');
|
|
4214
|
-
}
|
|
4215
|
-
for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
|
|
4216
|
-
type2 = state.implicitTypes[typeIndex];
|
|
4217
|
-
if (type2.resolve(state.result)) {
|
|
4218
|
-
state.result = type2.construct(state.result);
|
|
4219
|
-
state.tag = type2.tag;
|
|
4220
|
-
if (state.anchor !== null) {
|
|
4221
|
-
state.anchorMap[state.anchor] = state.result;
|
|
4222
|
-
}
|
|
4223
|
-
break;
|
|
4224
|
-
}
|
|
4225
|
-
}
|
|
4226
|
-
} else if (state.tag !== "!") {
|
|
4227
|
-
if (_hasOwnProperty$1.call(state.typeMap[state.kind || "fallback"], state.tag)) {
|
|
4228
|
-
type2 = state.typeMap[state.kind || "fallback"][state.tag];
|
|
4229
|
-
} else {
|
|
4230
|
-
type2 = null;
|
|
4231
|
-
typeList = state.typeMap.multi[state.kind || "fallback"];
|
|
4232
|
-
for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) {
|
|
4233
|
-
if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) {
|
|
4234
|
-
type2 = typeList[typeIndex];
|
|
4235
|
-
break;
|
|
4236
|
-
}
|
|
4237
|
-
}
|
|
4238
|
-
}
|
|
4239
|
-
if (!type2) {
|
|
4240
|
-
throwError(state, "unknown tag !<" + state.tag + ">");
|
|
4241
|
-
}
|
|
4242
|
-
if (state.result !== null && type2.kind !== state.kind) {
|
|
4243
|
-
throwError(state, "unacceptable node kind for !<" + state.tag + '> tag; it should be "' + type2.kind + '", not "' + state.kind + '"');
|
|
4244
|
-
}
|
|
4245
|
-
if (!type2.resolve(state.result, state.tag)) {
|
|
4246
|
-
throwError(state, "cannot resolve a node with !<" + state.tag + "> explicit tag");
|
|
4247
|
-
} else {
|
|
4248
|
-
state.result = type2.construct(state.result, state.tag);
|
|
4249
|
-
if (state.anchor !== null) {
|
|
4250
|
-
state.anchorMap[state.anchor] = state.result;
|
|
4251
|
-
}
|
|
4252
|
-
}
|
|
4253
|
-
}
|
|
4254
|
-
if (state.listener !== null) {
|
|
4255
|
-
state.listener("close", state);
|
|
4256
|
-
}
|
|
4257
|
-
return state.tag !== null || state.anchor !== null || hasContent;
|
|
4258
|
-
}
|
|
4259
|
-
function readDocument(state) {
|
|
4260
|
-
var documentStart = state.position, _position, directiveName, directiveArgs, hasDirectives = false, ch;
|
|
4261
|
-
state.version = null;
|
|
4262
|
-
state.checkLineBreaks = state.legacy;
|
|
4263
|
-
state.tagMap = /* @__PURE__ */ Object.create(null);
|
|
4264
|
-
state.anchorMap = /* @__PURE__ */ Object.create(null);
|
|
4265
|
-
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
4266
|
-
skipSeparationSpace(state, true, -1);
|
|
4267
|
-
ch = state.input.charCodeAt(state.position);
|
|
4268
|
-
if (state.lineIndent > 0 || ch !== 37) {
|
|
4269
|
-
break;
|
|
4270
|
-
}
|
|
4271
|
-
hasDirectives = true;
|
|
4272
|
-
ch = state.input.charCodeAt(++state.position);
|
|
4273
|
-
_position = state.position;
|
|
4274
|
-
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
|
4275
|
-
ch = state.input.charCodeAt(++state.position);
|
|
4276
|
-
}
|
|
4277
|
-
directiveName = state.input.slice(_position, state.position);
|
|
4278
|
-
directiveArgs = [];
|
|
4279
|
-
if (directiveName.length < 1) {
|
|
4280
|
-
throwError(state, "directive name must not be less than one character in length");
|
|
4281
|
-
}
|
|
4282
|
-
while (ch !== 0) {
|
|
4283
|
-
while (is_WHITE_SPACE(ch)) {
|
|
4284
|
-
ch = state.input.charCodeAt(++state.position);
|
|
4285
|
-
}
|
|
4286
|
-
if (ch === 35) {
|
|
4287
|
-
do {
|
|
4288
|
-
ch = state.input.charCodeAt(++state.position);
|
|
4289
|
-
} while (ch !== 0 && !is_EOL(ch));
|
|
4290
|
-
break;
|
|
4291
|
-
}
|
|
4292
|
-
if (is_EOL(ch))
|
|
4293
|
-
break;
|
|
4294
|
-
_position = state.position;
|
|
4295
|
-
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
|
4296
|
-
ch = state.input.charCodeAt(++state.position);
|
|
4297
|
-
}
|
|
4298
|
-
directiveArgs.push(state.input.slice(_position, state.position));
|
|
4299
|
-
}
|
|
4300
|
-
if (ch !== 0)
|
|
4301
|
-
readLineBreak(state);
|
|
4302
|
-
if (_hasOwnProperty$1.call(directiveHandlers, directiveName)) {
|
|
4303
|
-
directiveHandlers[directiveName](state, directiveName, directiveArgs);
|
|
4304
|
-
} else {
|
|
4305
|
-
throwWarning(state, 'unknown document directive "' + directiveName + '"');
|
|
4306
|
-
}
|
|
4307
|
-
}
|
|
4308
|
-
skipSeparationSpace(state, true, -1);
|
|
4309
|
-
if (state.lineIndent === 0 && state.input.charCodeAt(state.position) === 45 && state.input.charCodeAt(state.position + 1) === 45 && state.input.charCodeAt(state.position + 2) === 45) {
|
|
4310
|
-
state.position += 3;
|
|
4311
|
-
skipSeparationSpace(state, true, -1);
|
|
4312
|
-
} else if (hasDirectives) {
|
|
4313
|
-
throwError(state, "directives end mark is expected");
|
|
4314
|
-
}
|
|
4315
|
-
composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
|
|
4316
|
-
skipSeparationSpace(state, true, -1);
|
|
4317
|
-
if (state.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
|
|
4318
|
-
throwWarning(state, "non-ASCII line breaks are interpreted as content");
|
|
4319
|
-
}
|
|
4320
|
-
state.documents.push(state.result);
|
|
4321
|
-
if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
4322
|
-
if (state.input.charCodeAt(state.position) === 46) {
|
|
4323
|
-
state.position += 3;
|
|
4324
|
-
skipSeparationSpace(state, true, -1);
|
|
4325
|
-
}
|
|
4326
|
-
return;
|
|
4327
|
-
}
|
|
4328
|
-
if (state.position < state.length - 1) {
|
|
4329
|
-
throwError(state, "end of the stream or a document separator is expected");
|
|
4330
|
-
} else {
|
|
4331
|
-
return;
|
|
4332
|
-
}
|
|
4333
|
-
}
|
|
4334
|
-
function loadDocuments(input, options) {
|
|
4335
|
-
input = String(input);
|
|
4336
|
-
options = options || {};
|
|
4337
|
-
if (input.length !== 0) {
|
|
4338
|
-
if (input.charCodeAt(input.length - 1) !== 10 && input.charCodeAt(input.length - 1) !== 13) {
|
|
4339
|
-
input += "\n";
|
|
4340
|
-
}
|
|
4341
|
-
if (input.charCodeAt(0) === 65279) {
|
|
4342
|
-
input = input.slice(1);
|
|
4343
|
-
}
|
|
4344
|
-
}
|
|
4345
|
-
var state = new State$1(input, options);
|
|
4346
|
-
var nullpos = input.indexOf("\0");
|
|
4347
|
-
if (nullpos !== -1) {
|
|
4348
|
-
state.position = nullpos;
|
|
4349
|
-
throwError(state, "null byte is not allowed in input");
|
|
4350
|
-
}
|
|
4351
|
-
state.input += "\0";
|
|
4352
|
-
while (state.input.charCodeAt(state.position) === 32) {
|
|
4353
|
-
state.lineIndent += 1;
|
|
4354
|
-
state.position += 1;
|
|
4355
|
-
}
|
|
4356
|
-
while (state.position < state.length - 1) {
|
|
4357
|
-
readDocument(state);
|
|
4358
|
-
}
|
|
4359
|
-
return state.documents;
|
|
4360
|
-
}
|
|
4361
|
-
function loadAll$1(input, iterator, options) {
|
|
4362
|
-
if (iterator !== null && typeof iterator === "object" && typeof options === "undefined") {
|
|
4363
|
-
options = iterator;
|
|
4364
|
-
iterator = null;
|
|
4365
|
-
}
|
|
4366
|
-
var documents = loadDocuments(input, options);
|
|
4367
|
-
if (typeof iterator !== "function") {
|
|
4368
|
-
return documents;
|
|
4369
|
-
}
|
|
4370
|
-
for (var index = 0, length = documents.length; index < length; index += 1) {
|
|
4371
|
-
iterator(documents[index]);
|
|
4372
|
-
}
|
|
4373
|
-
}
|
|
4374
|
-
function load$1(input, options) {
|
|
4375
|
-
var documents = loadDocuments(input, options);
|
|
4376
|
-
if (documents.length === 0) {
|
|
4377
|
-
return void 0;
|
|
4378
|
-
} else if (documents.length === 1) {
|
|
4379
|
-
return documents[0];
|
|
4380
|
-
}
|
|
4381
|
-
throw new exception("expected a single document in the stream, but found more");
|
|
4382
|
-
}
|
|
4383
|
-
var loadAll_1 = loadAll$1;
|
|
4384
|
-
var load_1 = load$1;
|
|
4385
|
-
var loader = {
|
|
4386
|
-
loadAll: loadAll_1,
|
|
4387
|
-
load: load_1
|
|
4388
|
-
};
|
|
4389
|
-
var _toString = Object.prototype.toString;
|
|
4390
|
-
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
4391
|
-
var CHAR_BOM = 65279;
|
|
4392
|
-
var CHAR_TAB = 9;
|
|
4393
|
-
var CHAR_LINE_FEED = 10;
|
|
4394
|
-
var CHAR_CARRIAGE_RETURN = 13;
|
|
4395
|
-
var CHAR_SPACE = 32;
|
|
4396
|
-
var CHAR_EXCLAMATION = 33;
|
|
4397
|
-
var CHAR_DOUBLE_QUOTE = 34;
|
|
4398
|
-
var CHAR_SHARP = 35;
|
|
4399
|
-
var CHAR_PERCENT = 37;
|
|
4400
|
-
var CHAR_AMPERSAND = 38;
|
|
4401
|
-
var CHAR_SINGLE_QUOTE = 39;
|
|
4402
|
-
var CHAR_ASTERISK = 42;
|
|
4403
|
-
var CHAR_COMMA = 44;
|
|
4404
|
-
var CHAR_MINUS = 45;
|
|
4405
|
-
var CHAR_COLON = 58;
|
|
4406
|
-
var CHAR_EQUALS = 61;
|
|
4407
|
-
var CHAR_GREATER_THAN = 62;
|
|
4408
|
-
var CHAR_QUESTION = 63;
|
|
4409
|
-
var CHAR_COMMERCIAL_AT = 64;
|
|
4410
|
-
var CHAR_LEFT_SQUARE_BRACKET = 91;
|
|
4411
|
-
var CHAR_RIGHT_SQUARE_BRACKET = 93;
|
|
4412
|
-
var CHAR_GRAVE_ACCENT = 96;
|
|
4413
|
-
var CHAR_LEFT_CURLY_BRACKET = 123;
|
|
4414
|
-
var CHAR_VERTICAL_LINE = 124;
|
|
4415
|
-
var CHAR_RIGHT_CURLY_BRACKET = 125;
|
|
4416
|
-
var ESCAPE_SEQUENCES = {};
|
|
4417
|
-
ESCAPE_SEQUENCES[0] = "\\0";
|
|
4418
|
-
ESCAPE_SEQUENCES[7] = "\\a";
|
|
4419
|
-
ESCAPE_SEQUENCES[8] = "\\b";
|
|
4420
|
-
ESCAPE_SEQUENCES[9] = "\\t";
|
|
4421
|
-
ESCAPE_SEQUENCES[10] = "\\n";
|
|
4422
|
-
ESCAPE_SEQUENCES[11] = "\\v";
|
|
4423
|
-
ESCAPE_SEQUENCES[12] = "\\f";
|
|
4424
|
-
ESCAPE_SEQUENCES[13] = "\\r";
|
|
4425
|
-
ESCAPE_SEQUENCES[27] = "\\e";
|
|
4426
|
-
ESCAPE_SEQUENCES[34] = '\\"';
|
|
4427
|
-
ESCAPE_SEQUENCES[92] = "\\\\";
|
|
4428
|
-
ESCAPE_SEQUENCES[133] = "\\N";
|
|
4429
|
-
ESCAPE_SEQUENCES[160] = "\\_";
|
|
4430
|
-
ESCAPE_SEQUENCES[8232] = "\\L";
|
|
4431
|
-
ESCAPE_SEQUENCES[8233] = "\\P";
|
|
4432
|
-
var DEPRECATED_BOOLEANS_SYNTAX = [
|
|
4433
|
-
"y",
|
|
4434
|
-
"Y",
|
|
4435
|
-
"yes",
|
|
4436
|
-
"Yes",
|
|
4437
|
-
"YES",
|
|
4438
|
-
"on",
|
|
4439
|
-
"On",
|
|
4440
|
-
"ON",
|
|
4441
|
-
"n",
|
|
4442
|
-
"N",
|
|
4443
|
-
"no",
|
|
4444
|
-
"No",
|
|
4445
|
-
"NO",
|
|
4446
|
-
"off",
|
|
4447
|
-
"Off",
|
|
4448
|
-
"OFF"
|
|
4449
|
-
];
|
|
4450
|
-
var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
|
|
4451
|
-
function compileStyleMap(schema2, map2) {
|
|
4452
|
-
var result, keys, index, length, tag, style2, type2;
|
|
4453
|
-
if (map2 === null)
|
|
4454
|
-
return {};
|
|
4455
|
-
result = {};
|
|
4456
|
-
keys = Object.keys(map2);
|
|
4457
|
-
for (index = 0, length = keys.length; index < length; index += 1) {
|
|
4458
|
-
tag = keys[index];
|
|
4459
|
-
style2 = String(map2[tag]);
|
|
4460
|
-
if (tag.slice(0, 2) === "!!") {
|
|
4461
|
-
tag = "tag:yaml.org,2002:" + tag.slice(2);
|
|
4462
|
-
}
|
|
4463
|
-
type2 = schema2.compiledTypeMap["fallback"][tag];
|
|
4464
|
-
if (type2 && _hasOwnProperty.call(type2.styleAliases, style2)) {
|
|
4465
|
-
style2 = type2.styleAliases[style2];
|
|
4466
|
-
}
|
|
4467
|
-
result[tag] = style2;
|
|
4468
|
-
}
|
|
4469
|
-
return result;
|
|
4470
|
-
}
|
|
4471
|
-
function encodeHex(character) {
|
|
4472
|
-
var string, handle, length;
|
|
4473
|
-
string = character.toString(16).toUpperCase();
|
|
4474
|
-
if (character <= 255) {
|
|
4475
|
-
handle = "x";
|
|
4476
|
-
length = 2;
|
|
4477
|
-
} else if (character <= 65535) {
|
|
4478
|
-
handle = "u";
|
|
4479
|
-
length = 4;
|
|
4480
|
-
} else if (character <= 4294967295) {
|
|
4481
|
-
handle = "U";
|
|
4482
|
-
length = 8;
|
|
4483
|
-
} else {
|
|
4484
|
-
throw new exception("code point within a string may not be greater than 0xFFFFFFFF");
|
|
4485
|
-
}
|
|
4486
|
-
return "\\" + handle + common.repeat("0", length - string.length) + string;
|
|
4487
|
-
}
|
|
4488
|
-
var QUOTING_TYPE_SINGLE = 1;
|
|
4489
|
-
var QUOTING_TYPE_DOUBLE = 2;
|
|
4490
|
-
function State(options) {
|
|
4491
|
-
this.schema = options["schema"] || _default;
|
|
4492
|
-
this.indent = Math.max(1, options["indent"] || 2);
|
|
4493
|
-
this.noArrayIndent = options["noArrayIndent"] || false;
|
|
4494
|
-
this.skipInvalid = options["skipInvalid"] || false;
|
|
4495
|
-
this.flowLevel = common.isNothing(options["flowLevel"]) ? -1 : options["flowLevel"];
|
|
4496
|
-
this.styleMap = compileStyleMap(this.schema, options["styles"] || null);
|
|
4497
|
-
this.sortKeys = options["sortKeys"] || false;
|
|
4498
|
-
this.lineWidth = options["lineWidth"] || 80;
|
|
4499
|
-
this.noRefs = options["noRefs"] || false;
|
|
4500
|
-
this.noCompatMode = options["noCompatMode"] || false;
|
|
4501
|
-
this.condenseFlow = options["condenseFlow"] || false;
|
|
4502
|
-
this.quotingType = options["quotingType"] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE;
|
|
4503
|
-
this.forceQuotes = options["forceQuotes"] || false;
|
|
4504
|
-
this.replacer = typeof options["replacer"] === "function" ? options["replacer"] : null;
|
|
4505
|
-
this.implicitTypes = this.schema.compiledImplicit;
|
|
4506
|
-
this.explicitTypes = this.schema.compiledExplicit;
|
|
4507
|
-
this.tag = null;
|
|
4508
|
-
this.result = "";
|
|
4509
|
-
this.duplicates = [];
|
|
4510
|
-
this.usedDuplicates = null;
|
|
4511
|
-
}
|
|
4512
|
-
function indentString(string, spaces) {
|
|
4513
|
-
var ind = common.repeat(" ", spaces), position = 0, next = -1, result = "", line, length = string.length;
|
|
4514
|
-
while (position < length) {
|
|
4515
|
-
next = string.indexOf("\n", position);
|
|
4516
|
-
if (next === -1) {
|
|
4517
|
-
line = string.slice(position);
|
|
4518
|
-
position = length;
|
|
4519
|
-
} else {
|
|
4520
|
-
line = string.slice(position, next + 1);
|
|
4521
|
-
position = next + 1;
|
|
4522
|
-
}
|
|
4523
|
-
if (line.length && line !== "\n")
|
|
4524
|
-
result += ind;
|
|
4525
|
-
result += line;
|
|
4526
|
-
}
|
|
4527
|
-
return result;
|
|
4528
|
-
}
|
|
4529
|
-
function generateNextLine(state, level) {
|
|
4530
|
-
return "\n" + common.repeat(" ", state.indent * level);
|
|
4531
|
-
}
|
|
4532
|
-
function testImplicitResolving(state, str2) {
|
|
4533
|
-
var index, length, type2;
|
|
4534
|
-
for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {
|
|
4535
|
-
type2 = state.implicitTypes[index];
|
|
4536
|
-
if (type2.resolve(str2)) {
|
|
4537
|
-
return true;
|
|
4538
|
-
}
|
|
4539
|
-
}
|
|
4540
|
-
return false;
|
|
4541
|
-
}
|
|
4542
|
-
function isWhitespace(c2) {
|
|
4543
|
-
return c2 === CHAR_SPACE || c2 === CHAR_TAB;
|
|
4544
|
-
}
|
|
4545
|
-
function isPrintable(c2) {
|
|
4546
|
-
return 32 <= c2 && c2 <= 126 || 161 <= c2 && c2 <= 55295 && c2 !== 8232 && c2 !== 8233 || 57344 <= c2 && c2 <= 65533 && c2 !== CHAR_BOM || 65536 <= c2 && c2 <= 1114111;
|
|
4547
|
-
}
|
|
4548
|
-
function isNsCharOrWhitespace(c2) {
|
|
4549
|
-
return isPrintable(c2) && c2 !== CHAR_BOM && c2 !== CHAR_CARRIAGE_RETURN && c2 !== CHAR_LINE_FEED;
|
|
4550
|
-
}
|
|
4551
|
-
function isPlainSafe(c2, prev, inblock) {
|
|
4552
|
-
var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c2);
|
|
4553
|
-
var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c2);
|
|
4554
|
-
return (inblock ? cIsNsCharOrWhitespace : cIsNsCharOrWhitespace && c2 !== CHAR_COMMA && c2 !== CHAR_LEFT_SQUARE_BRACKET && c2 !== CHAR_RIGHT_SQUARE_BRACKET && c2 !== CHAR_LEFT_CURLY_BRACKET && c2 !== CHAR_RIGHT_CURLY_BRACKET) && c2 !== CHAR_SHARP && !(prev === CHAR_COLON && !cIsNsChar) || isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c2 === CHAR_SHARP || prev === CHAR_COLON && cIsNsChar;
|
|
4555
|
-
}
|
|
4556
|
-
function isPlainSafeFirst(c2) {
|
|
4557
|
-
return isPrintable(c2) && c2 !== CHAR_BOM && !isWhitespace(c2) && c2 !== CHAR_MINUS && c2 !== CHAR_QUESTION && c2 !== CHAR_COLON && c2 !== CHAR_COMMA && c2 !== CHAR_LEFT_SQUARE_BRACKET && c2 !== CHAR_RIGHT_SQUARE_BRACKET && c2 !== CHAR_LEFT_CURLY_BRACKET && c2 !== CHAR_RIGHT_CURLY_BRACKET && c2 !== CHAR_SHARP && c2 !== CHAR_AMPERSAND && c2 !== CHAR_ASTERISK && c2 !== CHAR_EXCLAMATION && c2 !== CHAR_VERTICAL_LINE && c2 !== CHAR_EQUALS && c2 !== CHAR_GREATER_THAN && c2 !== CHAR_SINGLE_QUOTE && c2 !== CHAR_DOUBLE_QUOTE && c2 !== CHAR_PERCENT && c2 !== CHAR_COMMERCIAL_AT && c2 !== CHAR_GRAVE_ACCENT;
|
|
4558
|
-
}
|
|
4559
|
-
function isPlainSafeLast(c2) {
|
|
4560
|
-
return !isWhitespace(c2) && c2 !== CHAR_COLON;
|
|
4561
|
-
}
|
|
4562
|
-
function codePointAt(string, pos2) {
|
|
4563
|
-
var first = string.charCodeAt(pos2), second;
|
|
4564
|
-
if (first >= 55296 && first <= 56319 && pos2 + 1 < string.length) {
|
|
4565
|
-
second = string.charCodeAt(pos2 + 1);
|
|
4566
|
-
if (second >= 56320 && second <= 57343) {
|
|
4567
|
-
return (first - 55296) * 1024 + second - 56320 + 65536;
|
|
4568
|
-
}
|
|
4569
|
-
}
|
|
4570
|
-
return first;
|
|
4571
|
-
}
|
|
4572
|
-
function needIndentIndicator(string) {
|
|
4573
|
-
var leadingSpaceRe = /^\n* /;
|
|
4574
|
-
return leadingSpaceRe.test(string);
|
|
4575
|
-
}
|
|
4576
|
-
var STYLE_PLAIN = 1;
|
|
4577
|
-
var STYLE_SINGLE = 2;
|
|
4578
|
-
var STYLE_LITERAL = 3;
|
|
4579
|
-
var STYLE_FOLDED = 4;
|
|
4580
|
-
var STYLE_DOUBLE = 5;
|
|
4581
|
-
function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType, quotingType, forceQuotes, inblock) {
|
|
4582
|
-
var i;
|
|
4583
|
-
var char = 0;
|
|
4584
|
-
var prevChar = null;
|
|
4585
|
-
var hasLineBreak = false;
|
|
4586
|
-
var hasFoldableLine = false;
|
|
4587
|
-
var shouldTrackWidth = lineWidth !== -1;
|
|
4588
|
-
var previousLineBreak = -1;
|
|
4589
|
-
var plain = isPlainSafeFirst(codePointAt(string, 0)) && isPlainSafeLast(codePointAt(string, string.length - 1));
|
|
4590
|
-
if (singleLineOnly || forceQuotes) {
|
|
4591
|
-
for (i = 0; i < string.length; char >= 65536 ? i += 2 : i++) {
|
|
4592
|
-
char = codePointAt(string, i);
|
|
4593
|
-
if (!isPrintable(char)) {
|
|
4594
|
-
return STYLE_DOUBLE;
|
|
4595
|
-
}
|
|
4596
|
-
plain = plain && isPlainSafe(char, prevChar, inblock);
|
|
4597
|
-
prevChar = char;
|
|
4598
|
-
}
|
|
4599
|
-
} else {
|
|
4600
|
-
for (i = 0; i < string.length; char >= 65536 ? i += 2 : i++) {
|
|
4601
|
-
char = codePointAt(string, i);
|
|
4602
|
-
if (char === CHAR_LINE_FEED) {
|
|
4603
|
-
hasLineBreak = true;
|
|
4604
|
-
if (shouldTrackWidth) {
|
|
4605
|
-
hasFoldableLine = hasFoldableLine || i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ";
|
|
4606
|
-
previousLineBreak = i;
|
|
4607
|
-
}
|
|
4608
|
-
} else if (!isPrintable(char)) {
|
|
4609
|
-
return STYLE_DOUBLE;
|
|
4610
|
-
}
|
|
4611
|
-
plain = plain && isPlainSafe(char, prevChar, inblock);
|
|
4612
|
-
prevChar = char;
|
|
4613
|
-
}
|
|
4614
|
-
hasFoldableLine = hasFoldableLine || shouldTrackWidth && (i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ");
|
|
4615
|
-
}
|
|
4616
|
-
if (!hasLineBreak && !hasFoldableLine) {
|
|
4617
|
-
if (plain && !forceQuotes && !testAmbiguousType(string)) {
|
|
4618
|
-
return STYLE_PLAIN;
|
|
4619
|
-
}
|
|
4620
|
-
return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
|
|
4621
|
-
}
|
|
4622
|
-
if (indentPerLevel > 9 && needIndentIndicator(string)) {
|
|
4623
|
-
return STYLE_DOUBLE;
|
|
4624
|
-
}
|
|
4625
|
-
if (!forceQuotes) {
|
|
4626
|
-
return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
|
|
4627
|
-
}
|
|
4628
|
-
return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
|
|
4629
|
-
}
|
|
4630
|
-
function writeScalar(state, string, level, iskey, inblock) {
|
|
4631
|
-
state.dump = function() {
|
|
4632
|
-
if (string.length === 0) {
|
|
4633
|
-
return state.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''";
|
|
4634
|
-
}
|
|
4635
|
-
if (!state.noCompatMode) {
|
|
4636
|
-
if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) {
|
|
4637
|
-
return state.quotingType === QUOTING_TYPE_DOUBLE ? '"' + string + '"' : "'" + string + "'";
|
|
4638
|
-
}
|
|
4639
|
-
}
|
|
4640
|
-
var indent = state.indent * Math.max(1, level);
|
|
4641
|
-
var lineWidth = state.lineWidth === -1 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
|
|
4642
|
-
var singleLineOnly = iskey || state.flowLevel > -1 && level >= state.flowLevel;
|
|
4643
|
-
function testAmbiguity(string2) {
|
|
4644
|
-
return testImplicitResolving(state, string2);
|
|
4645
|
-
}
|
|
4646
|
-
switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity, state.quotingType, state.forceQuotes && !iskey, inblock)) {
|
|
4647
|
-
case STYLE_PLAIN:
|
|
4648
|
-
return string;
|
|
4649
|
-
case STYLE_SINGLE:
|
|
4650
|
-
return "'" + string.replace(/'/g, "''") + "'";
|
|
4651
|
-
case STYLE_LITERAL:
|
|
4652
|
-
return "|" + blockHeader(string, state.indent) + dropEndingNewline(indentString(string, indent));
|
|
4653
|
-
case STYLE_FOLDED:
|
|
4654
|
-
return ">" + blockHeader(string, state.indent) + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
|
|
4655
|
-
case STYLE_DOUBLE:
|
|
4656
|
-
return '"' + escapeString(string) + '"';
|
|
4657
|
-
default:
|
|
4658
|
-
throw new exception("impossible error: invalid scalar style");
|
|
4659
|
-
}
|
|
4660
|
-
}();
|
|
4661
|
-
}
|
|
4662
|
-
function blockHeader(string, indentPerLevel) {
|
|
4663
|
-
var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : "";
|
|
4664
|
-
var clip = string[string.length - 1] === "\n";
|
|
4665
|
-
var keep = clip && (string[string.length - 2] === "\n" || string === "\n");
|
|
4666
|
-
var chomp = keep ? "+" : clip ? "" : "-";
|
|
4667
|
-
return indentIndicator + chomp + "\n";
|
|
4668
|
-
}
|
|
4669
|
-
function dropEndingNewline(string) {
|
|
4670
|
-
return string[string.length - 1] === "\n" ? string.slice(0, -1) : string;
|
|
4671
|
-
}
|
|
4672
|
-
function foldString(string, width2) {
|
|
4673
|
-
var lineRe = /(\n+)([^\n]*)/g;
|
|
4674
|
-
var result = function() {
|
|
4675
|
-
var nextLF = string.indexOf("\n");
|
|
4676
|
-
nextLF = nextLF !== -1 ? nextLF : string.length;
|
|
4677
|
-
lineRe.lastIndex = nextLF;
|
|
4678
|
-
return foldLine(string.slice(0, nextLF), width2);
|
|
4679
|
-
}();
|
|
4680
|
-
var prevMoreIndented = string[0] === "\n" || string[0] === " ";
|
|
4681
|
-
var moreIndented;
|
|
4682
|
-
var match;
|
|
4683
|
-
while (match = lineRe.exec(string)) {
|
|
4684
|
-
var prefix = match[1], line = match[2];
|
|
4685
|
-
moreIndented = line[0] === " ";
|
|
4686
|
-
result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? "\n" : "") + foldLine(line, width2);
|
|
4687
|
-
prevMoreIndented = moreIndented;
|
|
4688
|
-
}
|
|
4689
|
-
return result;
|
|
4690
|
-
}
|
|
4691
|
-
function foldLine(line, width2) {
|
|
4692
|
-
if (line === "" || line[0] === " ")
|
|
4693
|
-
return line;
|
|
4694
|
-
var breakRe = / [^ ]/g;
|
|
4695
|
-
var match;
|
|
4696
|
-
var start = 0, end, curr = 0, next = 0;
|
|
4697
|
-
var result = "";
|
|
4698
|
-
while (match = breakRe.exec(line)) {
|
|
4699
|
-
next = match.index;
|
|
4700
|
-
if (next - start > width2) {
|
|
4701
|
-
end = curr > start ? curr : next;
|
|
4702
|
-
result += "\n" + line.slice(start, end);
|
|
4703
|
-
start = end + 1;
|
|
4704
|
-
}
|
|
4705
|
-
curr = next;
|
|
4706
|
-
}
|
|
4707
|
-
result += "\n";
|
|
4708
|
-
if (line.length - start > width2 && curr > start) {
|
|
4709
|
-
result += line.slice(start, curr) + "\n" + line.slice(curr + 1);
|
|
4710
|
-
} else {
|
|
4711
|
-
result += line.slice(start);
|
|
4712
|
-
}
|
|
4713
|
-
return result.slice(1);
|
|
4714
|
-
}
|
|
4715
|
-
function escapeString(string) {
|
|
4716
|
-
var result = "";
|
|
4717
|
-
var char = 0;
|
|
4718
|
-
var escapeSeq;
|
|
4719
|
-
for (var i = 0; i < string.length; char >= 65536 ? i += 2 : i++) {
|
|
4720
|
-
char = codePointAt(string, i);
|
|
4721
|
-
escapeSeq = ESCAPE_SEQUENCES[char];
|
|
4722
|
-
if (!escapeSeq && isPrintable(char)) {
|
|
4723
|
-
result += string[i];
|
|
4724
|
-
if (char >= 65536)
|
|
4725
|
-
result += string[i + 1];
|
|
4726
|
-
} else {
|
|
4727
|
-
result += escapeSeq || encodeHex(char);
|
|
4728
|
-
}
|
|
4729
|
-
}
|
|
4730
|
-
return result;
|
|
4731
|
-
}
|
|
4732
|
-
function writeFlowSequence(state, level, object) {
|
|
4733
|
-
var _result = "", _tag = state.tag, index, length, value;
|
|
4734
|
-
for (index = 0, length = object.length; index < length; index += 1) {
|
|
4735
|
-
value = object[index];
|
|
4736
|
-
if (state.replacer) {
|
|
4737
|
-
value = state.replacer.call(object, String(index), value);
|
|
4738
|
-
}
|
|
4739
|
-
if (writeNode(state, level, value, false, false) || typeof value === "undefined" && writeNode(state, level, null, false, false)) {
|
|
4740
|
-
if (_result !== "")
|
|
4741
|
-
_result += "," + (!state.condenseFlow ? " " : "");
|
|
4742
|
-
_result += state.dump;
|
|
4743
|
-
}
|
|
4744
|
-
}
|
|
4745
|
-
state.tag = _tag;
|
|
4746
|
-
state.dump = "[" + _result + "]";
|
|
4747
|
-
}
|
|
4748
|
-
function writeBlockSequence(state, level, object, compact) {
|
|
4749
|
-
var _result = "", _tag = state.tag, index, length, value;
|
|
4750
|
-
for (index = 0, length = object.length; index < length; index += 1) {
|
|
4751
|
-
value = object[index];
|
|
4752
|
-
if (state.replacer) {
|
|
4753
|
-
value = state.replacer.call(object, String(index), value);
|
|
4754
|
-
}
|
|
4755
|
-
if (writeNode(state, level + 1, value, true, true, false, true) || typeof value === "undefined" && writeNode(state, level + 1, null, true, true, false, true)) {
|
|
4756
|
-
if (!compact || _result !== "") {
|
|
4757
|
-
_result += generateNextLine(state, level);
|
|
4758
|
-
}
|
|
4759
|
-
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
4760
|
-
_result += "-";
|
|
4761
|
-
} else {
|
|
4762
|
-
_result += "- ";
|
|
4763
|
-
}
|
|
4764
|
-
_result += state.dump;
|
|
4765
|
-
}
|
|
4766
|
-
}
|
|
4767
|
-
state.tag = _tag;
|
|
4768
|
-
state.dump = _result || "[]";
|
|
4769
|
-
}
|
|
4770
|
-
function writeFlowMapping(state, level, object) {
|
|
4771
|
-
var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, pairBuffer;
|
|
4772
|
-
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
|
4773
|
-
pairBuffer = "";
|
|
4774
|
-
if (_result !== "")
|
|
4775
|
-
pairBuffer += ", ";
|
|
4776
|
-
if (state.condenseFlow)
|
|
4777
|
-
pairBuffer += '"';
|
|
4778
|
-
objectKey = objectKeyList[index];
|
|
4779
|
-
objectValue = object[objectKey];
|
|
4780
|
-
if (state.replacer) {
|
|
4781
|
-
objectValue = state.replacer.call(object, objectKey, objectValue);
|
|
4782
|
-
}
|
|
4783
|
-
if (!writeNode(state, level, objectKey, false, false)) {
|
|
4784
|
-
continue;
|
|
4785
|
-
}
|
|
4786
|
-
if (state.dump.length > 1024)
|
|
4787
|
-
pairBuffer += "? ";
|
|
4788
|
-
pairBuffer += state.dump + (state.condenseFlow ? '"' : "") + ":" + (state.condenseFlow ? "" : " ");
|
|
4789
|
-
if (!writeNode(state, level, objectValue, false, false)) {
|
|
4790
|
-
continue;
|
|
4791
|
-
}
|
|
4792
|
-
pairBuffer += state.dump;
|
|
4793
|
-
_result += pairBuffer;
|
|
4794
|
-
}
|
|
4795
|
-
state.tag = _tag;
|
|
4796
|
-
state.dump = "{" + _result + "}";
|
|
4797
|
-
}
|
|
4798
|
-
function writeBlockMapping(state, level, object, compact) {
|
|
4799
|
-
var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, explicitPair, pairBuffer;
|
|
4800
|
-
if (state.sortKeys === true) {
|
|
4801
|
-
objectKeyList.sort();
|
|
4802
|
-
} else if (typeof state.sortKeys === "function") {
|
|
4803
|
-
objectKeyList.sort(state.sortKeys);
|
|
4804
|
-
} else if (state.sortKeys) {
|
|
4805
|
-
throw new exception("sortKeys must be a boolean or a function");
|
|
4806
|
-
}
|
|
4807
|
-
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
|
4808
|
-
pairBuffer = "";
|
|
4809
|
-
if (!compact || _result !== "") {
|
|
4810
|
-
pairBuffer += generateNextLine(state, level);
|
|
4811
|
-
}
|
|
4812
|
-
objectKey = objectKeyList[index];
|
|
4813
|
-
objectValue = object[objectKey];
|
|
4814
|
-
if (state.replacer) {
|
|
4815
|
-
objectValue = state.replacer.call(object, objectKey, objectValue);
|
|
4816
|
-
}
|
|
4817
|
-
if (!writeNode(state, level + 1, objectKey, true, true, true)) {
|
|
4818
|
-
continue;
|
|
4819
|
-
}
|
|
4820
|
-
explicitPair = state.tag !== null && state.tag !== "?" || state.dump && state.dump.length > 1024;
|
|
4821
|
-
if (explicitPair) {
|
|
4822
|
-
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
4823
|
-
pairBuffer += "?";
|
|
4824
|
-
} else {
|
|
4825
|
-
pairBuffer += "? ";
|
|
4826
|
-
}
|
|
4827
|
-
}
|
|
4828
|
-
pairBuffer += state.dump;
|
|
4829
|
-
if (explicitPair) {
|
|
4830
|
-
pairBuffer += generateNextLine(state, level);
|
|
4831
|
-
}
|
|
4832
|
-
if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
|
|
4833
|
-
continue;
|
|
4834
|
-
}
|
|
4835
|
-
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
4836
|
-
pairBuffer += ":";
|
|
4837
|
-
} else {
|
|
4838
|
-
pairBuffer += ": ";
|
|
4839
|
-
}
|
|
4840
|
-
pairBuffer += state.dump;
|
|
4841
|
-
_result += pairBuffer;
|
|
4842
|
-
}
|
|
4843
|
-
state.tag = _tag;
|
|
4844
|
-
state.dump = _result || "{}";
|
|
4845
|
-
}
|
|
4846
|
-
function detectType(state, object, explicit) {
|
|
4847
|
-
var _result, typeList, index, length, type2, style2;
|
|
4848
|
-
typeList = explicit ? state.explicitTypes : state.implicitTypes;
|
|
4849
|
-
for (index = 0, length = typeList.length; index < length; index += 1) {
|
|
4850
|
-
type2 = typeList[index];
|
|
4851
|
-
if ((type2.instanceOf || type2.predicate) && (!type2.instanceOf || typeof object === "object" && object instanceof type2.instanceOf) && (!type2.predicate || type2.predicate(object))) {
|
|
4852
|
-
if (explicit) {
|
|
4853
|
-
if (type2.multi && type2.representName) {
|
|
4854
|
-
state.tag = type2.representName(object);
|
|
4855
|
-
} else {
|
|
4856
|
-
state.tag = type2.tag;
|
|
4857
|
-
}
|
|
4858
|
-
} else {
|
|
4859
|
-
state.tag = "?";
|
|
4860
|
-
}
|
|
4861
|
-
if (type2.represent) {
|
|
4862
|
-
style2 = state.styleMap[type2.tag] || type2.defaultStyle;
|
|
4863
|
-
if (_toString.call(type2.represent) === "[object Function]") {
|
|
4864
|
-
_result = type2.represent(object, style2);
|
|
4865
|
-
} else if (_hasOwnProperty.call(type2.represent, style2)) {
|
|
4866
|
-
_result = type2.represent[style2](object, style2);
|
|
4867
|
-
} else {
|
|
4868
|
-
throw new exception("!<" + type2.tag + '> tag resolver accepts not "' + style2 + '" style');
|
|
4869
|
-
}
|
|
4870
|
-
state.dump = _result;
|
|
4871
|
-
}
|
|
4872
|
-
return true;
|
|
4873
|
-
}
|
|
4874
|
-
}
|
|
4875
|
-
return false;
|
|
4876
|
-
}
|
|
4877
|
-
function writeNode(state, level, object, block, compact, iskey, isblockseq) {
|
|
4878
|
-
state.tag = null;
|
|
4879
|
-
state.dump = object;
|
|
4880
|
-
if (!detectType(state, object, false)) {
|
|
4881
|
-
detectType(state, object, true);
|
|
4882
|
-
}
|
|
4883
|
-
var type2 = _toString.call(state.dump);
|
|
4884
|
-
var inblock = block;
|
|
4885
|
-
var tagStr;
|
|
4886
|
-
if (block) {
|
|
4887
|
-
block = state.flowLevel < 0 || state.flowLevel > level;
|
|
4888
|
-
}
|
|
4889
|
-
var objectOrArray = type2 === "[object Object]" || type2 === "[object Array]", duplicateIndex, duplicate;
|
|
4890
|
-
if (objectOrArray) {
|
|
4891
|
-
duplicateIndex = state.duplicates.indexOf(object);
|
|
4892
|
-
duplicate = duplicateIndex !== -1;
|
|
4893
|
-
}
|
|
4894
|
-
if (state.tag !== null && state.tag !== "?" || duplicate || state.indent !== 2 && level > 0) {
|
|
4895
|
-
compact = false;
|
|
4896
|
-
}
|
|
4897
|
-
if (duplicate && state.usedDuplicates[duplicateIndex]) {
|
|
4898
|
-
state.dump = "*ref_" + duplicateIndex;
|
|
4899
|
-
} else {
|
|
4900
|
-
if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
|
|
4901
|
-
state.usedDuplicates[duplicateIndex] = true;
|
|
4902
|
-
}
|
|
4903
|
-
if (type2 === "[object Object]") {
|
|
4904
|
-
if (block && Object.keys(state.dump).length !== 0) {
|
|
4905
|
-
writeBlockMapping(state, level, state.dump, compact);
|
|
4906
|
-
if (duplicate) {
|
|
4907
|
-
state.dump = "&ref_" + duplicateIndex + state.dump;
|
|
4908
|
-
}
|
|
4909
|
-
} else {
|
|
4910
|
-
writeFlowMapping(state, level, state.dump);
|
|
4911
|
-
if (duplicate) {
|
|
4912
|
-
state.dump = "&ref_" + duplicateIndex + " " + state.dump;
|
|
4913
|
-
}
|
|
4914
|
-
}
|
|
4915
|
-
} else if (type2 === "[object Array]") {
|
|
4916
|
-
if (block && state.dump.length !== 0) {
|
|
4917
|
-
if (state.noArrayIndent && !isblockseq && level > 0) {
|
|
4918
|
-
writeBlockSequence(state, level - 1, state.dump, compact);
|
|
4919
|
-
} else {
|
|
4920
|
-
writeBlockSequence(state, level, state.dump, compact);
|
|
4921
|
-
}
|
|
4922
|
-
if (duplicate) {
|
|
4923
|
-
state.dump = "&ref_" + duplicateIndex + state.dump;
|
|
4924
|
-
}
|
|
4925
|
-
} else {
|
|
4926
|
-
writeFlowSequence(state, level, state.dump);
|
|
4927
|
-
if (duplicate) {
|
|
4928
|
-
state.dump = "&ref_" + duplicateIndex + " " + state.dump;
|
|
4929
|
-
}
|
|
4930
|
-
}
|
|
4931
|
-
} else if (type2 === "[object String]") {
|
|
4932
|
-
if (state.tag !== "?") {
|
|
4933
|
-
writeScalar(state, state.dump, level, iskey, inblock);
|
|
4934
|
-
}
|
|
4935
|
-
} else if (type2 === "[object Undefined]") {
|
|
4936
|
-
return false;
|
|
4937
|
-
} else {
|
|
4938
|
-
if (state.skipInvalid)
|
|
4939
|
-
return false;
|
|
4940
|
-
throw new exception("unacceptable kind of an object to dump " + type2);
|
|
4941
|
-
}
|
|
4942
|
-
if (state.tag !== null && state.tag !== "?") {
|
|
4943
|
-
tagStr = encodeURI(state.tag[0] === "!" ? state.tag.slice(1) : state.tag).replace(/!/g, "%21");
|
|
4944
|
-
if (state.tag[0] === "!") {
|
|
4945
|
-
tagStr = "!" + tagStr;
|
|
4946
|
-
} else if (tagStr.slice(0, 18) === "tag:yaml.org,2002:") {
|
|
4947
|
-
tagStr = "!!" + tagStr.slice(18);
|
|
4948
|
-
} else {
|
|
4949
|
-
tagStr = "!<" + tagStr + ">";
|
|
4950
|
-
}
|
|
4951
|
-
state.dump = tagStr + " " + state.dump;
|
|
4952
|
-
}
|
|
4953
|
-
}
|
|
4954
|
-
return true;
|
|
4955
|
-
}
|
|
4956
|
-
function getDuplicateReferences(object, state) {
|
|
4957
|
-
var objects = [], duplicatesIndexes = [], index, length;
|
|
4958
|
-
inspectNode(object, objects, duplicatesIndexes);
|
|
4959
|
-
for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {
|
|
4960
|
-
state.duplicates.push(objects[duplicatesIndexes[index]]);
|
|
4961
|
-
}
|
|
4962
|
-
state.usedDuplicates = new Array(length);
|
|
4963
|
-
}
|
|
4964
|
-
function inspectNode(object, objects, duplicatesIndexes) {
|
|
4965
|
-
var objectKeyList, index, length;
|
|
4966
|
-
if (object !== null && typeof object === "object") {
|
|
4967
|
-
index = objects.indexOf(object);
|
|
4968
|
-
if (index !== -1) {
|
|
4969
|
-
if (duplicatesIndexes.indexOf(index) === -1) {
|
|
4970
|
-
duplicatesIndexes.push(index);
|
|
4971
|
-
}
|
|
4972
|
-
} else {
|
|
4973
|
-
objects.push(object);
|
|
4974
|
-
if (Array.isArray(object)) {
|
|
4975
|
-
for (index = 0, length = object.length; index < length; index += 1) {
|
|
4976
|
-
inspectNode(object[index], objects, duplicatesIndexes);
|
|
4977
|
-
}
|
|
4978
|
-
} else {
|
|
4979
|
-
objectKeyList = Object.keys(object);
|
|
4980
|
-
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
|
4981
|
-
inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);
|
|
4982
|
-
}
|
|
4983
|
-
}
|
|
4984
|
-
}
|
|
4985
|
-
}
|
|
4986
|
-
}
|
|
4987
|
-
function dump$1(input, options) {
|
|
4988
|
-
options = options || {};
|
|
4989
|
-
var state = new State(options);
|
|
4990
|
-
if (!state.noRefs)
|
|
4991
|
-
getDuplicateReferences(input, state);
|
|
4992
|
-
var value = input;
|
|
4993
|
-
if (state.replacer) {
|
|
4994
|
-
value = state.replacer.call({ "": value }, "", value);
|
|
4995
|
-
}
|
|
4996
|
-
if (writeNode(state, 0, value, true, true))
|
|
4997
|
-
return state.dump + "\n";
|
|
4998
|
-
return "";
|
|
4999
|
-
}
|
|
5000
|
-
var dump_1 = dump$1;
|
|
5001
|
-
var dumper = {
|
|
5002
|
-
dump: dump_1
|
|
5003
|
-
};
|
|
5004
|
-
function renamed(from, to) {
|
|
5005
|
-
return function() {
|
|
5006
|
-
throw new Error("Function yaml." + from + " is removed in js-yaml 4. Use yaml." + to + " instead, which is now safe by default.");
|
|
5007
|
-
};
|
|
5008
|
-
}
|
|
5009
|
-
var Type = type;
|
|
5010
|
-
var Schema = schema;
|
|
5011
|
-
var FAILSAFE_SCHEMA = failsafe;
|
|
5012
|
-
var JSON_SCHEMA = json;
|
|
5013
|
-
var CORE_SCHEMA = core;
|
|
5014
|
-
var DEFAULT_SCHEMA = _default;
|
|
5015
|
-
var load = loader.load;
|
|
5016
|
-
var loadAll = loader.loadAll;
|
|
5017
|
-
var dump = dumper.dump;
|
|
5018
|
-
var YAMLException = exception;
|
|
5019
|
-
var types = {
|
|
5020
|
-
binary,
|
|
5021
|
-
float,
|
|
5022
|
-
map,
|
|
5023
|
-
null: _null,
|
|
5024
|
-
pairs,
|
|
5025
|
-
set,
|
|
5026
|
-
timestamp,
|
|
5027
|
-
bool,
|
|
5028
|
-
int,
|
|
5029
|
-
merge,
|
|
5030
|
-
omap,
|
|
5031
|
-
seq,
|
|
5032
|
-
str
|
|
5033
|
-
};
|
|
5034
|
-
var safeLoad = renamed("safeLoad", "load");
|
|
5035
|
-
var safeLoadAll = renamed("safeLoadAll", "loadAll");
|
|
5036
|
-
var safeDump = renamed("safeDump", "dump");
|
|
5037
|
-
var jsYaml = {
|
|
5038
|
-
Type,
|
|
5039
|
-
Schema,
|
|
5040
|
-
FAILSAFE_SCHEMA,
|
|
5041
|
-
JSON_SCHEMA,
|
|
5042
|
-
CORE_SCHEMA,
|
|
5043
|
-
DEFAULT_SCHEMA,
|
|
5044
|
-
load,
|
|
5045
|
-
loadAll,
|
|
5046
|
-
dump,
|
|
5047
|
-
YAMLException,
|
|
5048
|
-
types,
|
|
5049
|
-
safeLoad,
|
|
5050
|
-
safeLoadAll,
|
|
5051
|
-
safeDump
|
|
5052
|
-
};
|
|
5053
|
-
var js_yaml_default = jsYaml;
|
|
5054
|
-
|
|
5055
|
-
// ../parser/src/core.ts
|
|
5056
|
-
import { isObject as isObject2, isTruthy, objectMap } from "@antfu/utils";
|
|
5057
|
-
|
|
5058
|
-
// ../parser/src/config.ts
|
|
5059
|
-
init_esm_shims();
|
|
5060
|
-
import { toArray as toArray2, uniq as uniq2 } from "@antfu/utils";
|
|
5061
|
-
|
|
5062
|
-
// ../parser/src/utils.ts
|
|
5063
|
-
init_esm_shims();
|
|
5064
|
-
import { isNumber, range, uniq } from "@antfu/utils";
|
|
5065
|
-
function parseRangeString(total, rangeStr) {
|
|
5066
|
-
if (!rangeStr || rangeStr === "all" || rangeStr === "*")
|
|
5067
|
-
return range(1, total + 1);
|
|
5068
|
-
const pages = [];
|
|
5069
|
-
for (const part of rangeStr.split(/[,;]/g)) {
|
|
5070
|
-
if (!part.includes("-")) {
|
|
5071
|
-
pages.push(+part);
|
|
5072
|
-
} else {
|
|
5073
|
-
const [start, end] = part.split("-", 2);
|
|
5074
|
-
pages.push(...range(+start, !end ? total + 1 : +end + 1));
|
|
5075
|
-
}
|
|
5076
|
-
}
|
|
5077
|
-
return uniq(pages).filter((i) => i <= total).sort((a, b) => a - b);
|
|
5078
|
-
}
|
|
5079
|
-
function parseAspectRatio(str2) {
|
|
5080
|
-
if (isNumber(str2))
|
|
5081
|
-
return str2;
|
|
5082
|
-
if (!isNaN(+str2))
|
|
5083
|
-
return +str2;
|
|
5084
|
-
const [wStr = "", hStr = ""] = str2.split(/[:\/x\|]/);
|
|
5085
|
-
const w = parseFloat(wStr.trim());
|
|
5086
|
-
const h = parseFloat(hStr.trim());
|
|
5087
|
-
if (isNaN(w) || isNaN(h) || h === 0)
|
|
5088
|
-
throw new Error(`Invalid aspect ratio "${str2}"`);
|
|
5089
|
-
return w / h;
|
|
5090
|
-
}
|
|
5091
|
-
|
|
5092
|
-
// ../parser/src/config.ts
|
|
5093
|
-
function resolveConfig(headmatter, themeMeta = {}) {
|
|
5094
|
-
var _a, _b;
|
|
5095
|
-
const themeHightlighter = ["prism", "shiki"].includes(themeMeta.highlighter || "") ? themeMeta.highlighter : void 0;
|
|
5096
|
-
const themeColorSchema = ["light", "dark"].includes(themeMeta.colorSchema || "") ? themeMeta.colorSchema : void 0;
|
|
5097
|
-
const defaultConfig2 = {
|
|
5098
|
-
theme: "default",
|
|
5099
|
-
title: "Slidev",
|
|
5100
|
-
titleTemplate: "%s - Slidev",
|
|
5101
|
-
remoteAssets: false,
|
|
5102
|
-
monaco: "dev",
|
|
5103
|
-
download: false,
|
|
5104
|
-
info: false,
|
|
5105
|
-
highlighter: themeHightlighter || "prism",
|
|
5106
|
-
lineNumbers: false,
|
|
5107
|
-
colorSchema: themeColorSchema || "auto",
|
|
5108
|
-
routerMode: "history",
|
|
5109
|
-
aspectRatio: 16 / 9,
|
|
5110
|
-
canvasWidth: 980,
|
|
5111
|
-
exportFilename: "",
|
|
5112
|
-
selectable: false,
|
|
5113
|
-
themeConfig: {},
|
|
5114
|
-
fonts: {},
|
|
5115
|
-
favicon: "https://cdn.jsdelivr.net/gh/slidevjs/slidev/assets/favicon.png",
|
|
5116
|
-
drawings: {},
|
|
5117
|
-
plantUmlServer: "https://www.plantuml.com/plantuml",
|
|
5118
|
-
record: "dev"
|
|
5119
|
-
};
|
|
5120
|
-
const config2 = __spreadProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, defaultConfig2), themeMeta.defaults), headmatter.config), headmatter), {
|
|
5121
|
-
fonts: resolveFonts(__spreadValues(__spreadValues(__spreadValues({}, (_a = themeMeta.defaults) == null ? void 0 : _a.fonts), (_b = headmatter.config) == null ? void 0 : _b.fonts), headmatter == null ? void 0 : headmatter.fonts)),
|
|
5122
|
-
drawings: resolveDrawings(headmatter.drawings)
|
|
5123
|
-
});
|
|
5124
|
-
if (config2.colorSchema !== "dark" && config2.colorSchema !== "light")
|
|
5125
|
-
config2.colorSchema = "auto";
|
|
5126
|
-
if (themeColorSchema && config2.colorSchema === "auto")
|
|
5127
|
-
config2.colorSchema = themeColorSchema;
|
|
5128
|
-
config2.aspectRatio = parseAspectRatio(config2.aspectRatio);
|
|
5129
|
-
if (themeColorSchema && config2.colorSchema !== themeColorSchema)
|
|
5130
|
-
console.warn(`[slidev] Color schema "${config2.colorSchema}" does not supported by the theme`);
|
|
5131
|
-
if (themeHightlighter && config2.highlighter !== themeHightlighter)
|
|
5132
|
-
console.warn(`[slidev] Syntax highlighter "${config2.highlighter}" does not supported by the theme`);
|
|
5133
|
-
return config2;
|
|
5134
|
-
}
|
|
5135
|
-
function resolveFonts(fonts = {}) {
|
|
5136
|
-
const {
|
|
5137
|
-
fallbacks = true,
|
|
5138
|
-
italic = false,
|
|
5139
|
-
provider = "google"
|
|
5140
|
-
} = fonts;
|
|
5141
|
-
let sans = toArray2(fonts.sans).flatMap((i) => i.split(/,\s*/g)).map((i) => i.trim());
|
|
5142
|
-
let serif = toArray2(fonts.serif).flatMap((i) => i.split(/,\s*/g)).map((i) => i.trim());
|
|
5143
|
-
let mono = toArray2(fonts.mono).flatMap((i) => i.split(/,\s*/g)).map((i) => i.trim());
|
|
5144
|
-
const weights = toArray2(fonts.weights || "200,400,600").flatMap((i) => i.toString().split(/,\s*/g)).map((i) => i.trim());
|
|
5145
|
-
const custom = toArray2(fonts.custom).flatMap((i) => i.split(/,\s*/g)).map((i) => i.trim());
|
|
5146
|
-
const local = toArray2(fonts.local).flatMap((i) => i.split(/,\s*/g)).map((i) => i.trim());
|
|
5147
|
-
const webfonts = fonts.webfonts ? fonts.webfonts : fallbacks ? uniq2([...sans, ...serif, ...mono, ...custom]) : [];
|
|
5148
|
-
webfonts.filter((i) => local.includes(i));
|
|
5149
|
-
function toQuoted(font) {
|
|
5150
|
-
if (/^(['"]).*\1$/.test(font))
|
|
5151
|
-
return font;
|
|
5152
|
-
return `"${font}"`;
|
|
5153
|
-
}
|
|
5154
|
-
if (fallbacks) {
|
|
5155
|
-
sans = uniq2([
|
|
5156
|
-
...sans.map(toQuoted),
|
|
5157
|
-
"ui-sans-serif",
|
|
5158
|
-
"system-ui",
|
|
5159
|
-
"-apple-system",
|
|
5160
|
-
"BlinkMacSystemFont",
|
|
5161
|
-
'"Segoe UI"',
|
|
5162
|
-
"Roboto",
|
|
5163
|
-
'"Helvetica Neue"',
|
|
5164
|
-
"Arial",
|
|
5165
|
-
'"Noto Sans"',
|
|
5166
|
-
"sans-serif",
|
|
5167
|
-
'"Apple Color Emoji"',
|
|
5168
|
-
'"Segoe UI Emoji"',
|
|
5169
|
-
'"Segoe UI Symbol"',
|
|
5170
|
-
'"Noto Color Emoji"'
|
|
5171
|
-
]);
|
|
5172
|
-
serif = uniq2([
|
|
5173
|
-
...serif.map(toQuoted),
|
|
5174
|
-
"ui-serif",
|
|
5175
|
-
"Georgia",
|
|
5176
|
-
"Cambria",
|
|
5177
|
-
'"Times New Roman"',
|
|
5178
|
-
"Times",
|
|
5179
|
-
"serif"
|
|
5180
|
-
]);
|
|
5181
|
-
mono = uniq2([
|
|
5182
|
-
...mono.map(toQuoted),
|
|
5183
|
-
"ui-monospace",
|
|
5184
|
-
"SFMono-Regular",
|
|
5185
|
-
"Menlo",
|
|
5186
|
-
"Monaco",
|
|
5187
|
-
"Consolas",
|
|
5188
|
-
'"Liberation Mono"',
|
|
5189
|
-
'"Courier New"',
|
|
5190
|
-
"monospace"
|
|
5191
|
-
]);
|
|
5192
|
-
}
|
|
5193
|
-
return {
|
|
5194
|
-
sans,
|
|
5195
|
-
serif,
|
|
5196
|
-
mono,
|
|
5197
|
-
webfonts,
|
|
5198
|
-
provider,
|
|
5199
|
-
local,
|
|
5200
|
-
italic,
|
|
5201
|
-
weights
|
|
5202
|
-
};
|
|
5203
|
-
}
|
|
5204
|
-
function resolveDrawings(options = {}) {
|
|
5205
|
-
const {
|
|
5206
|
-
enabled = true,
|
|
5207
|
-
persist = false,
|
|
5208
|
-
presenterOnly = false,
|
|
5209
|
-
syncAll = true
|
|
5210
|
-
} = options;
|
|
5211
|
-
const persistPath = typeof persist === "string" ? persist : persist ? ".slidev/drawings" : false;
|
|
5212
|
-
return {
|
|
5213
|
-
enabled,
|
|
5214
|
-
persist: persistPath,
|
|
5215
|
-
presenterOnly,
|
|
5216
|
-
syncAll
|
|
5217
|
-
};
|
|
5218
|
-
}
|
|
5219
|
-
|
|
5220
|
-
// ../parser/src/core.ts
|
|
5221
|
-
function stringify(data) {
|
|
5222
|
-
return `${data.slides.filter((slide) => slide.source === void 0 || slide.inline !== void 0).map((slide, idx) => stringifySlide(slide.inline || slide, idx)).join("\n").trim()}
|
|
5223
|
-
`;
|
|
5224
|
-
}
|
|
5225
|
-
function filterDisabled(data) {
|
|
5226
|
-
data.slides = data.slides.filter((i) => {
|
|
5227
|
-
var _a;
|
|
5228
|
-
return !((_a = i.frontmatter) == null ? void 0 : _a.disabled);
|
|
5229
|
-
});
|
|
5230
|
-
return data;
|
|
5231
|
-
}
|
|
5232
|
-
function stringifySlide(data, idx = 0) {
|
|
5233
|
-
if (data.raw == null)
|
|
5234
|
-
prettifySlide(data);
|
|
5235
|
-
return data.raw.startsWith("---") || idx === 0 ? data.raw : `---
|
|
5236
|
-
${data.raw.startsWith("\n") ? data.raw : `
|
|
5237
|
-
${data.raw}`}`;
|
|
5238
|
-
}
|
|
5239
|
-
function prettifySlide(data) {
|
|
5240
|
-
data.content = `
|
|
5241
|
-
${data.content.trim()}
|
|
5242
|
-
`;
|
|
5243
|
-
data.raw = Object.keys(data.frontmatter || {}).length ? `---
|
|
5244
|
-
${js_yaml_default.dump(data.frontmatter).trim()}
|
|
5245
|
-
---
|
|
5246
|
-
${data.content}` : data.content;
|
|
5247
|
-
if (data.note)
|
|
5248
|
-
data.raw += `
|
|
5249
|
-
<!--
|
|
5250
|
-
${data.note.trim()}
|
|
5251
|
-
-->
|
|
5252
|
-
`;
|
|
5253
|
-
else
|
|
5254
|
-
data.raw += "\n";
|
|
5255
|
-
return data;
|
|
5256
|
-
}
|
|
5257
|
-
function prettify(data) {
|
|
5258
|
-
data.slides.forEach(prettifySlide);
|
|
5259
|
-
return data;
|
|
5260
|
-
}
|
|
5261
|
-
function matter(code) {
|
|
5262
|
-
let data = {};
|
|
5263
|
-
const content = code.replace(/^---.*\r?\n([\s\S]*?)---/, (_, d) => {
|
|
5264
|
-
data = js_yaml_default.load(d);
|
|
5265
|
-
if (!isObject2(data))
|
|
5266
|
-
data = {};
|
|
5267
|
-
return "";
|
|
5268
|
-
});
|
|
5269
|
-
return { data, content };
|
|
5270
|
-
}
|
|
5271
|
-
function detectFeatures(code) {
|
|
5272
|
-
return {
|
|
5273
|
-
katex: !!code.match(/\$.*?\$/) || !!code.match(/$\$\$/),
|
|
5274
|
-
monaco: !!code.match(/{monaco.*}/),
|
|
5275
|
-
tweet: !!code.match(/<Tweet\b/),
|
|
5276
|
-
mermaid: !!code.match(/^```mermaid/m)
|
|
5277
|
-
};
|
|
5278
|
-
}
|
|
5279
|
-
function parseSlide(raw) {
|
|
5280
|
-
var _a, _b;
|
|
5281
|
-
const result = matter(raw);
|
|
5282
|
-
let note;
|
|
5283
|
-
const frontmatter = result.data || {};
|
|
5284
|
-
let content = result.content.trim();
|
|
5285
|
-
const comments = Array.from(content.matchAll(/<!--([\s\S]*?)-->/g));
|
|
5286
|
-
if (comments.length) {
|
|
5287
|
-
const last = comments[comments.length - 1];
|
|
5288
|
-
if (last.index && last.index + last[0].length >= content.length) {
|
|
5289
|
-
note = last[1].trim();
|
|
5290
|
-
content = content.slice(0, last.index).trim();
|
|
5291
|
-
}
|
|
5292
|
-
}
|
|
5293
|
-
let title;
|
|
5294
|
-
let level;
|
|
5295
|
-
if (frontmatter.title || frontmatter.name) {
|
|
5296
|
-
title = frontmatter.title || frontmatter.name;
|
|
5297
|
-
level = frontmatter.level || 1;
|
|
5298
|
-
} else {
|
|
5299
|
-
const match = content.match(/^(#+) (.*)$/m);
|
|
5300
|
-
title = (_a = match == null ? void 0 : match[2]) == null ? void 0 : _a.trim();
|
|
5301
|
-
level = (_b = match == null ? void 0 : match[1]) == null ? void 0 : _b.length;
|
|
5302
|
-
}
|
|
5303
|
-
return {
|
|
5304
|
-
raw,
|
|
5305
|
-
title,
|
|
5306
|
-
level,
|
|
5307
|
-
content,
|
|
5308
|
-
frontmatter,
|
|
5309
|
-
note
|
|
5310
|
-
};
|
|
5311
|
-
}
|
|
5312
|
-
function parse(markdown, filepath, themeMeta) {
|
|
5313
|
-
var _a, _b;
|
|
5314
|
-
const lines2 = markdown.split(/\r?\n/g);
|
|
5315
|
-
const slides = [];
|
|
5316
|
-
let start = 0;
|
|
5317
|
-
function slice(end) {
|
|
5318
|
-
if (start === end)
|
|
5319
|
-
return;
|
|
5320
|
-
const raw = lines2.slice(start, end).join("\n");
|
|
5321
|
-
slides.push(__spreadProps(__spreadValues({}, parseSlide(raw)), {
|
|
5322
|
-
index: slides.length,
|
|
5323
|
-
start,
|
|
5324
|
-
end
|
|
5325
|
-
}));
|
|
5326
|
-
start = end + 1;
|
|
5327
|
-
}
|
|
5328
|
-
for (let i = 0; i < lines2.length; i++) {
|
|
5329
|
-
const line = lines2[i].trimEnd();
|
|
5330
|
-
if (line.match(/^---+/)) {
|
|
5331
|
-
slice(i);
|
|
5332
|
-
const next = lines2[i + 1];
|
|
5333
|
-
if (line.match(/^---([^-].*)?$/) && !(next == null ? void 0 : next.match(/^\s*$/))) {
|
|
5334
|
-
start = i;
|
|
5335
|
-
for (i += 1; i < lines2.length; i++) {
|
|
5336
|
-
if (lines2[i].trimEnd().match(/^---$/))
|
|
5337
|
-
break;
|
|
5338
|
-
}
|
|
5339
|
-
}
|
|
5340
|
-
} else if (line.startsWith("```")) {
|
|
5341
|
-
for (i += 1; i < lines2.length; i++) {
|
|
5342
|
-
if (lines2[i].startsWith("```"))
|
|
5343
|
-
break;
|
|
5344
|
-
}
|
|
5345
|
-
}
|
|
5346
|
-
}
|
|
5347
|
-
if (start <= lines2.length - 1)
|
|
5348
|
-
slice(lines2.length);
|
|
5349
|
-
const headmatter = ((_a = slides[0]) == null ? void 0 : _a.frontmatter) || {};
|
|
5350
|
-
headmatter.title = headmatter.title || ((_b = slides[0]) == null ? void 0 : _b.title);
|
|
5351
|
-
const config2 = resolveConfig(headmatter, themeMeta);
|
|
5352
|
-
const features = detectFeatures(markdown);
|
|
5353
|
-
return {
|
|
5354
|
-
raw: markdown,
|
|
5355
|
-
filepath,
|
|
5356
|
-
slides,
|
|
5357
|
-
config: config2,
|
|
5358
|
-
features,
|
|
5359
|
-
headmatter,
|
|
5360
|
-
themeMeta
|
|
5361
|
-
};
|
|
5362
|
-
}
|
|
5363
|
-
function mergeFeatureFlags(a, b) {
|
|
5364
|
-
return objectMap(a, (k, v) => [k, v || b[k]]);
|
|
5365
|
-
}
|
|
5366
|
-
function scanMonacoModules(md) {
|
|
5367
|
-
const typeModules = /* @__PURE__ */ new Set();
|
|
5368
|
-
md.replace(/^```(\w+?)\s*{monaco([\w:,-]*)}[\s\n]*([\s\S]+?)^```/mg, (full, lang = "ts", options, code) => {
|
|
5369
|
-
options = options || "";
|
|
5370
|
-
lang = lang.trim();
|
|
5371
|
-
if (lang === "ts" || lang === "typescript") {
|
|
5372
|
-
Array.from(code.matchAll(/\s+from\s+(["'])([\/\w@-]+)\1/g)).map((i) => i[2]).filter(isTruthy).map((i) => typeModules.add(i));
|
|
5373
|
-
}
|
|
5374
|
-
return "";
|
|
5375
|
-
});
|
|
5376
|
-
return Array.from(typeModules);
|
|
5377
|
-
}
|
|
5378
|
-
|
|
5379
|
-
// ../parser/src/fs.ts
|
|
5380
|
-
async function load2(filepath, themeMeta, content) {
|
|
5381
|
-
const dir = dirname(filepath);
|
|
5382
|
-
const markdown = content != null ? content : await fs.readFile(filepath, "utf-8");
|
|
5383
|
-
const data = parse(markdown, filepath, themeMeta);
|
|
5384
|
-
const entries = /* @__PURE__ */ new Set([
|
|
5385
|
-
filepath
|
|
5386
|
-
]);
|
|
5387
|
-
for (let iSlide = 0; iSlide < data.slides.length; ) {
|
|
5388
|
-
const baseSlide = data.slides[iSlide];
|
|
5389
|
-
if (!baseSlide.frontmatter.src) {
|
|
5390
|
-
iSlide++;
|
|
5391
|
-
continue;
|
|
5392
|
-
}
|
|
5393
|
-
data.slides.splice(iSlide, 1);
|
|
5394
|
-
const srcExpression = baseSlide.frontmatter.src;
|
|
5395
|
-
const path2 = resolve(dir, srcExpression);
|
|
5396
|
-
const raw = await fs.readFile(path2, "utf-8");
|
|
5397
|
-
const subSlides = parse(raw, path2, themeMeta);
|
|
5398
|
-
for (const [offset, subSlide] of subSlides.slides.entries()) {
|
|
5399
|
-
const slide = __spreadValues({}, baseSlide);
|
|
5400
|
-
slide.source = __spreadValues({
|
|
5401
|
-
filepath: path2
|
|
5402
|
-
}, subSlide);
|
|
5403
|
-
if (offset === 0 && !baseSlide.frontmatter.srcSequence) {
|
|
5404
|
-
slide.inline = __spreadValues({}, baseSlide);
|
|
5405
|
-
delete slide.inline.frontmatter.src;
|
|
5406
|
-
Object.assign(slide, slide.source, { raw: null });
|
|
5407
|
-
} else {
|
|
5408
|
-
Object.assign(slide, slide.source);
|
|
5409
|
-
}
|
|
5410
|
-
const baseSlideFrontMatterWithoutSrc = __spreadValues({}, baseSlide.frontmatter);
|
|
5411
|
-
delete baseSlideFrontMatterWithoutSrc.src;
|
|
5412
|
-
slide.frontmatter = __spreadProps(__spreadValues(__spreadValues({}, subSlide.frontmatter), baseSlideFrontMatterWithoutSrc), {
|
|
5413
|
-
srcSequence: `${baseSlide.frontmatter.srcSequence ? `${baseSlide.frontmatter.srcSequence},` : ""}${srcExpression}`
|
|
5414
|
-
});
|
|
5415
|
-
data.features = mergeFeatureFlags(data.features, detectFeatures(raw));
|
|
5416
|
-
entries.add(path2);
|
|
5417
|
-
data.slides.splice(iSlide + offset, 0, slide);
|
|
5418
|
-
}
|
|
5419
|
-
}
|
|
5420
|
-
for (let iSlide = 0; iSlide < data.slides.length; iSlide++)
|
|
5421
|
-
data.slides[iSlide].index = iSlide === 0 ? 0 : 1 + data.slides[iSlide - 1].index;
|
|
5422
|
-
data.entries = Array.from(entries);
|
|
5423
|
-
return data;
|
|
5424
|
-
}
|
|
5425
|
-
async function save(data, filepath) {
|
|
5426
|
-
filepath = filepath || data.filepath;
|
|
5427
|
-
await fs.writeFile(filepath, stringify(data), "utf-8");
|
|
5428
|
-
}
|
|
5429
|
-
async function saveExternalSlide(slide) {
|
|
5430
|
-
await fs.writeFile(slide.filepath, stringifySlide(slide), "utf-8");
|
|
5431
|
-
}
|
|
5432
|
-
|
|
5433
2374
|
// node/parser.ts
|
|
5434
2375
|
init_esm_shims();
|
|
2376
|
+
import * as parser from "@slidev/parser/fs";
|
|
5435
2377
|
|
|
5436
2378
|
// package.json
|
|
5437
|
-
var version = "0.31.
|
|
2379
|
+
var version = "0.31.4";
|
|
5438
2380
|
|
|
5439
2381
|
// node/themes.ts
|
|
5440
2382
|
init_esm_shims();
|
|
@@ -5445,7 +2387,7 @@ init_esm_shims();
|
|
|
5445
2387
|
|
|
5446
2388
|
// ../../node_modules/.pnpm/@antfu+ni@0.16.2/node_modules/@antfu/ni/dist/chunks/runner.mjs
|
|
5447
2389
|
init_esm_shims();
|
|
5448
|
-
import require$$0, { resolve
|
|
2390
|
+
import require$$0, { resolve } from "path";
|
|
5449
2391
|
import require$$0$5 from "readline";
|
|
5450
2392
|
import require$$2 from "events";
|
|
5451
2393
|
import { Buffer as Buffer$1 } from "buffer";
|
|
@@ -5598,11 +2540,11 @@ function checkMode(stat, options) {
|
|
|
5598
2540
|
var ret = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
|
|
5599
2541
|
return ret;
|
|
5600
2542
|
}
|
|
5601
|
-
var
|
|
2543
|
+
var core;
|
|
5602
2544
|
if (process.platform === "win32" || commonjsGlobal.TESTING_WINDOWS) {
|
|
5603
|
-
|
|
2545
|
+
core = windows;
|
|
5604
2546
|
} else {
|
|
5605
|
-
|
|
2547
|
+
core = mode;
|
|
5606
2548
|
}
|
|
5607
2549
|
var isexe_1 = isexe$1;
|
|
5608
2550
|
isexe$1.sync = sync;
|
|
@@ -5615,17 +2557,17 @@ function isexe$1(path2, options, cb) {
|
|
|
5615
2557
|
if (typeof Promise !== "function") {
|
|
5616
2558
|
throw new TypeError("callback not provided");
|
|
5617
2559
|
}
|
|
5618
|
-
return new Promise(function(
|
|
2560
|
+
return new Promise(function(resolve3, reject) {
|
|
5619
2561
|
isexe$1(path2, options || {}, function(er, is) {
|
|
5620
2562
|
if (er) {
|
|
5621
2563
|
reject(er);
|
|
5622
2564
|
} else {
|
|
5623
|
-
|
|
2565
|
+
resolve3(is);
|
|
5624
2566
|
}
|
|
5625
2567
|
});
|
|
5626
2568
|
});
|
|
5627
2569
|
}
|
|
5628
|
-
|
|
2570
|
+
core(path2, options || {}, function(er, is) {
|
|
5629
2571
|
if (er) {
|
|
5630
2572
|
if (er.code === "EACCES" || options && options.ignoreErrors) {
|
|
5631
2573
|
er = null;
|
|
@@ -5637,7 +2579,7 @@ function isexe$1(path2, options, cb) {
|
|
|
5637
2579
|
}
|
|
5638
2580
|
function sync(path2, options) {
|
|
5639
2581
|
try {
|
|
5640
|
-
return
|
|
2582
|
+
return core.sync(path2, options || {});
|
|
5641
2583
|
} catch (er) {
|
|
5642
2584
|
if (options && options.ignoreErrors || er.code === "EACCES") {
|
|
5643
2585
|
return false;
|
|
@@ -5678,27 +2620,27 @@ var which$1 = (cmd, opt, cb) => {
|
|
|
5678
2620
|
opt = {};
|
|
5679
2621
|
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
5680
2622
|
const found = [];
|
|
5681
|
-
const step = (i) => new Promise((
|
|
2623
|
+
const step = (i) => new Promise((resolve3, reject) => {
|
|
5682
2624
|
if (i === pathEnv.length)
|
|
5683
|
-
return opt.all && found.length ?
|
|
2625
|
+
return opt.all && found.length ? resolve3(found) : reject(getNotFoundError(cmd));
|
|
5684
2626
|
const ppRaw = pathEnv[i];
|
|
5685
2627
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
5686
2628
|
const pCmd = path$2.join(pathPart, cmd);
|
|
5687
2629
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
5688
|
-
|
|
2630
|
+
resolve3(subStep(p, i, 0));
|
|
5689
2631
|
});
|
|
5690
|
-
const subStep = (p, i, ii) => new Promise((
|
|
2632
|
+
const subStep = (p, i, ii) => new Promise((resolve3, reject) => {
|
|
5691
2633
|
if (ii === pathExt.length)
|
|
5692
|
-
return
|
|
2634
|
+
return resolve3(step(i + 1));
|
|
5693
2635
|
const ext = pathExt[ii];
|
|
5694
2636
|
isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
|
|
5695
2637
|
if (!er && is) {
|
|
5696
2638
|
if (opt.all)
|
|
5697
2639
|
found.push(p + ext);
|
|
5698
2640
|
else
|
|
5699
|
-
return
|
|
2641
|
+
return resolve3(p + ext);
|
|
5700
2642
|
}
|
|
5701
|
-
return
|
|
2643
|
+
return resolve3(subStep(p, i, ii + 1));
|
|
5702
2644
|
});
|
|
5703
2645
|
});
|
|
5704
2646
|
return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
|
|
@@ -5828,13 +2770,13 @@ var encode = (obj, opt) => {
|
|
|
5828
2770
|
}
|
|
5829
2771
|
return out;
|
|
5830
2772
|
};
|
|
5831
|
-
var dotSplit = (
|
|
5832
|
-
var decode = (
|
|
2773
|
+
var dotSplit = (str) => str.replace(/\1/g, "LITERAL\\1LITERAL").replace(/\\\./g, "").split(/\./).map((part) => part.replace(/\1/g, "\\.").replace(/\2LITERAL\\1LITERAL\2/g, ""));
|
|
2774
|
+
var decode = (str) => {
|
|
5833
2775
|
const out = /* @__PURE__ */ Object.create(null);
|
|
5834
2776
|
let p = out;
|
|
5835
2777
|
let section = null;
|
|
5836
2778
|
const re = /^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i;
|
|
5837
|
-
const lines2 =
|
|
2779
|
+
const lines2 = str.split(/[\r\n]+/g);
|
|
5838
2780
|
for (const line of lines2) {
|
|
5839
2781
|
if (!line || line.match(/^\s*[;#]/)) {
|
|
5840
2782
|
continue;
|
|
@@ -6022,18 +2964,18 @@ function pLimit(concurrency) {
|
|
|
6022
2964
|
queue.dequeue()();
|
|
6023
2965
|
}
|
|
6024
2966
|
};
|
|
6025
|
-
const run2 = async (fn,
|
|
2967
|
+
const run2 = async (fn, resolve3, args) => {
|
|
6026
2968
|
activeCount++;
|
|
6027
2969
|
const result = (async () => fn(...args))();
|
|
6028
|
-
|
|
2970
|
+
resolve3(result);
|
|
6029
2971
|
try {
|
|
6030
2972
|
await result;
|
|
6031
2973
|
} catch {
|
|
6032
2974
|
}
|
|
6033
2975
|
next();
|
|
6034
2976
|
};
|
|
6035
|
-
const enqueue = (fn,
|
|
6036
|
-
queue.enqueue(run2.bind(void 0, fn,
|
|
2977
|
+
const enqueue = (fn, resolve3, args) => {
|
|
2978
|
+
queue.enqueue(run2.bind(void 0, fn, resolve3, args));
|
|
6037
2979
|
(async () => {
|
|
6038
2980
|
await Promise.resolve();
|
|
6039
2981
|
if (activeCount < concurrency && queue.size > 0) {
|
|
@@ -6041,8 +2983,8 @@ function pLimit(concurrency) {
|
|
|
6041
2983
|
}
|
|
6042
2984
|
})();
|
|
6043
2985
|
};
|
|
6044
|
-
const generator = (fn, ...args) => new Promise((
|
|
6045
|
-
enqueue(fn,
|
|
2986
|
+
const generator = (fn, ...args) => new Promise((resolve3) => {
|
|
2987
|
+
enqueue(fn, resolve3, args);
|
|
6046
2988
|
});
|
|
6047
2989
|
Object.defineProperties(generator, {
|
|
6048
2990
|
activeCount: {
|
|
@@ -6093,28 +3035,28 @@ var typeMappings = {
|
|
|
6093
3035
|
directory: "isDirectory",
|
|
6094
3036
|
file: "isFile"
|
|
6095
3037
|
};
|
|
6096
|
-
function checkType(
|
|
6097
|
-
if (
|
|
3038
|
+
function checkType(type) {
|
|
3039
|
+
if (type in typeMappings) {
|
|
6098
3040
|
return;
|
|
6099
3041
|
}
|
|
6100
|
-
throw new Error(`Invalid type specified: ${
|
|
3042
|
+
throw new Error(`Invalid type specified: ${type}`);
|
|
6101
3043
|
}
|
|
6102
|
-
var matchType = (
|
|
3044
|
+
var matchType = (type, stat) => type === void 0 || stat[typeMappings[type]]();
|
|
6103
3045
|
var toPath$1 = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
|
|
6104
3046
|
async function locatePath(paths, {
|
|
6105
3047
|
cwd = process$2.cwd(),
|
|
6106
|
-
type
|
|
3048
|
+
type = "file",
|
|
6107
3049
|
allowSymlinks = true,
|
|
6108
3050
|
concurrency,
|
|
6109
3051
|
preserveOrder
|
|
6110
3052
|
} = {}) {
|
|
6111
|
-
checkType(
|
|
3053
|
+
checkType(type);
|
|
6112
3054
|
cwd = toPath$1(cwd);
|
|
6113
3055
|
const statFunction = allowSymlinks ? promises.stat : promises.lstat;
|
|
6114
3056
|
return pLocate(paths, async (path_) => {
|
|
6115
3057
|
try {
|
|
6116
3058
|
const stat = await statFunction(path$3.resolve(cwd, path_));
|
|
6117
|
-
return matchType(
|
|
3059
|
+
return matchType(type, stat);
|
|
6118
3060
|
} catch {
|
|
6119
3061
|
return false;
|
|
6120
3062
|
}
|
|
@@ -6268,22 +3210,22 @@ var shebangCommand$1 = (string = "") => {
|
|
|
6268
3210
|
return null;
|
|
6269
3211
|
}
|
|
6270
3212
|
const [path2, argument] = match[0].replace(/#! ?/, "").split(" ");
|
|
6271
|
-
const
|
|
6272
|
-
if (
|
|
3213
|
+
const binary = path2.split("/").pop();
|
|
3214
|
+
if (binary === "env") {
|
|
6273
3215
|
return argument;
|
|
6274
3216
|
}
|
|
6275
|
-
return argument ? `${
|
|
3217
|
+
return argument ? `${binary} ${argument}` : binary;
|
|
6276
3218
|
};
|
|
6277
|
-
var
|
|
3219
|
+
var fs = fs$3;
|
|
6278
3220
|
var shebangCommand = shebangCommand$1;
|
|
6279
3221
|
function readShebang$1(command) {
|
|
6280
3222
|
const size = 150;
|
|
6281
3223
|
const buffer = Buffer.alloc(size);
|
|
6282
3224
|
let fd;
|
|
6283
3225
|
try {
|
|
6284
|
-
fd =
|
|
6285
|
-
|
|
6286
|
-
|
|
3226
|
+
fd = fs.openSync(command, "r");
|
|
3227
|
+
fs.readSync(fd, buffer, 0, size, 0);
|
|
3228
|
+
fs.closeSync(fd);
|
|
6287
3229
|
} catch (e) {
|
|
6288
3230
|
}
|
|
6289
3231
|
return shebangCommand(buffer.toString());
|
|
@@ -6388,16 +3330,16 @@ var enoent$1 = {
|
|
|
6388
3330
|
notFoundError
|
|
6389
3331
|
};
|
|
6390
3332
|
var cp = require$$0$1;
|
|
6391
|
-
var
|
|
3333
|
+
var parse = parse_1;
|
|
6392
3334
|
var enoent = enoent$1;
|
|
6393
3335
|
function spawn(command, args, options) {
|
|
6394
|
-
const parsed =
|
|
3336
|
+
const parsed = parse(command, args, options);
|
|
6395
3337
|
const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
|
|
6396
3338
|
enoent.hookChildProcess(spawned, parsed);
|
|
6397
3339
|
return spawned;
|
|
6398
3340
|
}
|
|
6399
3341
|
function spawnSync(command, args, options) {
|
|
6400
|
-
const parsed =
|
|
3342
|
+
const parsed = parse(command, args, options);
|
|
6401
3343
|
const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
|
|
6402
3344
|
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
6403
3345
|
return result;
|
|
@@ -6405,7 +3347,7 @@ function spawnSync(command, args, options) {
|
|
|
6405
3347
|
crossSpawn$1.exports = spawn;
|
|
6406
3348
|
crossSpawn$1.exports.spawn = spawn;
|
|
6407
3349
|
crossSpawn$1.exports.sync = spawnSync;
|
|
6408
|
-
crossSpawn$1.exports._parse =
|
|
3350
|
+
crossSpawn$1.exports._parse = parse;
|
|
6409
3351
|
crossSpawn$1.exports._enoent = enoent;
|
|
6410
3352
|
var crossSpawn = crossSpawn$1.exports;
|
|
6411
3353
|
function stripFinalNewline(input) {
|
|
@@ -7016,7 +3958,7 @@ if (!processOk(process$1)) {
|
|
|
7016
3958
|
}
|
|
7017
3959
|
assert.equal(typeof cb, "function", "a callback must be provided for exit handler");
|
|
7018
3960
|
if (loaded === false) {
|
|
7019
|
-
|
|
3961
|
+
load();
|
|
7020
3962
|
}
|
|
7021
3963
|
var ev = "exit";
|
|
7022
3964
|
if (opts && opts.alwaysLast) {
|
|
@@ -7076,7 +4018,7 @@ if (!processOk(process$1)) {
|
|
|
7076
4018
|
return signals;
|
|
7077
4019
|
};
|
|
7078
4020
|
loaded = false;
|
|
7079
|
-
|
|
4021
|
+
load = function load2() {
|
|
7080
4022
|
if (loaded || !processOk(commonjsGlobal.process)) {
|
|
7081
4023
|
return;
|
|
7082
4024
|
}
|
|
@@ -7093,7 +4035,7 @@ if (!processOk(process$1)) {
|
|
|
7093
4035
|
process$1.emit = processEmit;
|
|
7094
4036
|
process$1.reallyExit = processReallyExit;
|
|
7095
4037
|
};
|
|
7096
|
-
signalExit.exports.load =
|
|
4038
|
+
signalExit.exports.load = load;
|
|
7097
4039
|
originalProcessReallyExit = process$1.reallyExit;
|
|
7098
4040
|
processReallyExit = function processReallyExit2(code) {
|
|
7099
4041
|
if (!processOk(commonjsGlobal.process)) {
|
|
@@ -7128,7 +4070,7 @@ var unload;
|
|
|
7128
4070
|
var emit;
|
|
7129
4071
|
var sigListeners;
|
|
7130
4072
|
var loaded;
|
|
7131
|
-
var
|
|
4073
|
+
var load;
|
|
7132
4074
|
var originalProcessReallyExit;
|
|
7133
4075
|
var processReallyExit;
|
|
7134
4076
|
var originalProcessEmit;
|
|
@@ -7178,7 +4120,7 @@ var setupTimeout = (spawned, { timeout, killSignal = "SIGTERM" }, spawnedPromise
|
|
|
7178
4120
|
return spawnedPromise;
|
|
7179
4121
|
}
|
|
7180
4122
|
let timeoutId;
|
|
7181
|
-
const timeoutPromise = new Promise((
|
|
4123
|
+
const timeoutPromise = new Promise((resolve3, reject) => {
|
|
7182
4124
|
timeoutId = setTimeout(() => {
|
|
7183
4125
|
timeoutKill(spawned, killSignal, reject);
|
|
7184
4126
|
}, timeout);
|
|
@@ -7266,7 +4208,7 @@ async function getStream(inputStream, options) {
|
|
|
7266
4208
|
}, options);
|
|
7267
4209
|
const { maxBuffer } = options;
|
|
7268
4210
|
const stream2 = bufferStream(options);
|
|
7269
|
-
await new Promise((
|
|
4211
|
+
await new Promise((resolve3, reject) => {
|
|
7270
4212
|
const rejectPromise = (error) => {
|
|
7271
4213
|
if (error && stream2.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
|
|
7272
4214
|
error.bufferedData = stream2.getBufferedValue();
|
|
@@ -7276,7 +4218,7 @@ async function getStream(inputStream, options) {
|
|
|
7276
4218
|
(async () => {
|
|
7277
4219
|
try {
|
|
7278
4220
|
await streamPipelinePromisified(inputStream, stream2);
|
|
7279
|
-
|
|
4221
|
+
resolve3();
|
|
7280
4222
|
} catch (error) {
|
|
7281
4223
|
rejectPromise(error);
|
|
7282
4224
|
}
|
|
@@ -7398,9 +4340,9 @@ var mergePromise = (spawned, promise) => {
|
|
|
7398
4340
|
}
|
|
7399
4341
|
return spawned;
|
|
7400
4342
|
};
|
|
7401
|
-
var getSpawnedPromise = (spawned) => new Promise((
|
|
4343
|
+
var getSpawnedPromise = (spawned) => new Promise((resolve3, reject) => {
|
|
7402
4344
|
spawned.on("exit", (exitCode, signal) => {
|
|
7403
|
-
|
|
4345
|
+
resolve3({ exitCode, signal });
|
|
7404
4346
|
});
|
|
7405
4347
|
spawned.on("error", (error) => {
|
|
7406
4348
|
reject(error);
|
|
@@ -7889,17 +4831,17 @@ var $ = {
|
|
|
7889
4831
|
bgCyan: init(46, 49),
|
|
7890
4832
|
bgWhite: init(47, 49)
|
|
7891
4833
|
};
|
|
7892
|
-
function run$1(arr,
|
|
4834
|
+
function run$1(arr, str) {
|
|
7893
4835
|
let i = 0, tmp, beg = "", end = "";
|
|
7894
4836
|
for (; i < arr.length; i++) {
|
|
7895
4837
|
tmp = arr[i];
|
|
7896
4838
|
beg += tmp.open;
|
|
7897
4839
|
end += tmp.close;
|
|
7898
|
-
if (
|
|
7899
|
-
|
|
4840
|
+
if (str.includes(tmp.close)) {
|
|
4841
|
+
str = str.replace(tmp.rgx, tmp.close + tmp.open);
|
|
7900
4842
|
}
|
|
7901
4843
|
}
|
|
7902
|
-
return beg +
|
|
4844
|
+
return beg + str + end;
|
|
7903
4845
|
}
|
|
7904
4846
|
function chain(has, keys) {
|
|
7905
4847
|
let ctx = { has, keys };
|
|
@@ -7999,10 +4941,10 @@ var action$3 = (key, isSelect) => {
|
|
|
7999
4941
|
return "left";
|
|
8000
4942
|
return false;
|
|
8001
4943
|
};
|
|
8002
|
-
var strip$5 = (
|
|
4944
|
+
var strip$5 = (str) => {
|
|
8003
4945
|
const pattern = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|");
|
|
8004
4946
|
const RGX = new RegExp(pattern, "g");
|
|
8005
|
-
return typeof
|
|
4947
|
+
return typeof str === "string" ? str.replace(RGX, "") : str;
|
|
8006
4948
|
};
|
|
8007
4949
|
var ESC = "\x1B";
|
|
8008
4950
|
var CSI = `${ESC}[`;
|
|
@@ -8121,7 +5063,7 @@ var strip$4 = strip$5;
|
|
|
8121
5063
|
var _require$a = src;
|
|
8122
5064
|
var erase$d = _require$a.erase;
|
|
8123
5065
|
var cursor$l = _require$a.cursor;
|
|
8124
|
-
var width$1 = (
|
|
5066
|
+
var width$1 = (str) => [...strip$4(str)].length;
|
|
8125
5067
|
var clear$j = function(prompt2, perLine) {
|
|
8126
5068
|
if (!perLine)
|
|
8127
5069
|
return erase$d.line + cursor$l.to(0);
|
|
@@ -8190,7 +5132,7 @@ var styles$1 = Object.freeze({
|
|
|
8190
5132
|
render: (input) => `${input}`
|
|
8191
5133
|
}
|
|
8192
5134
|
});
|
|
8193
|
-
var render$1 = (
|
|
5135
|
+
var render$1 = (type) => styles$1[type] || styles$1.default;
|
|
8194
5136
|
var symbols$1 = Object.freeze({
|
|
8195
5137
|
aborted: c$1.red(figures$g.cross),
|
|
8196
5138
|
done: c$1.green(figures$g.tick),
|
|
@@ -8270,10 +5212,10 @@ var Prompt$h = class extends EventEmitter$1 {
|
|
|
8270
5212
|
if (this.in.isTTY)
|
|
8271
5213
|
this.in.setRawMode(true);
|
|
8272
5214
|
const isSelect = ["SelectPrompt", "MultiselectPrompt"].indexOf(this.constructor.name) > -1;
|
|
8273
|
-
const keypress = (
|
|
5215
|
+
const keypress = (str, key) => {
|
|
8274
5216
|
let a = action$2(key, isSelect);
|
|
8275
5217
|
if (a === false) {
|
|
8276
|
-
this._ && this._(
|
|
5218
|
+
this._ && this._(str, key);
|
|
8277
5219
|
} else if (typeof this[a] === "function") {
|
|
8278
5220
|
this[a](key);
|
|
8279
5221
|
} else {
|
|
@@ -8308,7 +5250,7 @@ var Prompt$h = class extends EventEmitter$1 {
|
|
|
8308
5250
|
}
|
|
8309
5251
|
};
|
|
8310
5252
|
var prompt$3 = Prompt$h;
|
|
8311
|
-
function asyncGeneratorStep$4(gen,
|
|
5253
|
+
function asyncGeneratorStep$4(gen, resolve3, reject, _next, _throw, key, arg) {
|
|
8312
5254
|
try {
|
|
8313
5255
|
var info = gen[key](arg);
|
|
8314
5256
|
var value = info.value;
|
|
@@ -8317,7 +5259,7 @@ function asyncGeneratorStep$4(gen, resolve4, reject, _next, _throw, key, arg) {
|
|
|
8317
5259
|
return;
|
|
8318
5260
|
}
|
|
8319
5261
|
if (info.done) {
|
|
8320
|
-
|
|
5262
|
+
resolve3(value);
|
|
8321
5263
|
} else {
|
|
8322
5264
|
Promise.resolve(value).then(_next, _throw);
|
|
8323
5265
|
}
|
|
@@ -8325,13 +5267,13 @@ function asyncGeneratorStep$4(gen, resolve4, reject, _next, _throw, key, arg) {
|
|
|
8325
5267
|
function _asyncToGenerator$4(fn) {
|
|
8326
5268
|
return function() {
|
|
8327
5269
|
var self2 = this, args = arguments;
|
|
8328
|
-
return new Promise(function(
|
|
5270
|
+
return new Promise(function(resolve3, reject) {
|
|
8329
5271
|
var gen = fn.apply(self2, args);
|
|
8330
5272
|
function _next(value) {
|
|
8331
|
-
asyncGeneratorStep$4(gen,
|
|
5273
|
+
asyncGeneratorStep$4(gen, resolve3, reject, _next, _throw, "next", value);
|
|
8332
5274
|
}
|
|
8333
5275
|
function _throw(err) {
|
|
8334
|
-
asyncGeneratorStep$4(gen,
|
|
5276
|
+
asyncGeneratorStep$4(gen, resolve3, reject, _next, _throw, "throw", err);
|
|
8335
5277
|
}
|
|
8336
5278
|
_next(void 0);
|
|
8337
5279
|
});
|
|
@@ -8977,7 +5919,7 @@ var dateparts$1 = {
|
|
|
8977
5919
|
Seconds: seconds$1,
|
|
8978
5920
|
Year: year$1
|
|
8979
5921
|
};
|
|
8980
|
-
function asyncGeneratorStep$3(gen,
|
|
5922
|
+
function asyncGeneratorStep$3(gen, resolve3, reject, _next, _throw, key, arg) {
|
|
8981
5923
|
try {
|
|
8982
5924
|
var info = gen[key](arg);
|
|
8983
5925
|
var value = info.value;
|
|
@@ -8986,7 +5928,7 @@ function asyncGeneratorStep$3(gen, resolve4, reject, _next, _throw, key, arg) {
|
|
|
8986
5928
|
return;
|
|
8987
5929
|
}
|
|
8988
5930
|
if (info.done) {
|
|
8989
|
-
|
|
5931
|
+
resolve3(value);
|
|
8990
5932
|
} else {
|
|
8991
5933
|
Promise.resolve(value).then(_next, _throw);
|
|
8992
5934
|
}
|
|
@@ -8994,13 +5936,13 @@ function asyncGeneratorStep$3(gen, resolve4, reject, _next, _throw, key, arg) {
|
|
|
8994
5936
|
function _asyncToGenerator$3(fn) {
|
|
8995
5937
|
return function() {
|
|
8996
5938
|
var self2 = this, args = arguments;
|
|
8997
|
-
return new Promise(function(
|
|
5939
|
+
return new Promise(function(resolve3, reject) {
|
|
8998
5940
|
var gen = fn.apply(self2, args);
|
|
8999
5941
|
function _next(value) {
|
|
9000
|
-
asyncGeneratorStep$3(gen,
|
|
5942
|
+
asyncGeneratorStep$3(gen, resolve3, reject, _next, _throw, "next", value);
|
|
9001
5943
|
}
|
|
9002
5944
|
function _throw(err) {
|
|
9003
|
-
asyncGeneratorStep$3(gen,
|
|
5945
|
+
asyncGeneratorStep$3(gen, resolve3, reject, _next, _throw, "throw", err);
|
|
9004
5946
|
}
|
|
9005
5947
|
_next(void 0);
|
|
9006
5948
|
});
|
|
@@ -9196,7 +6138,7 @@ ${i ? ` ` : figures$d.pointerSmall} ${color$f.red().italic(l)}`, ``);
|
|
|
9196
6138
|
}
|
|
9197
6139
|
};
|
|
9198
6140
|
var date$1 = DatePrompt$1;
|
|
9199
|
-
function asyncGeneratorStep$2(gen,
|
|
6141
|
+
function asyncGeneratorStep$2(gen, resolve3, reject, _next, _throw, key, arg) {
|
|
9200
6142
|
try {
|
|
9201
6143
|
var info = gen[key](arg);
|
|
9202
6144
|
var value = info.value;
|
|
@@ -9205,7 +6147,7 @@ function asyncGeneratorStep$2(gen, resolve4, reject, _next, _throw, key, arg) {
|
|
|
9205
6147
|
return;
|
|
9206
6148
|
}
|
|
9207
6149
|
if (info.done) {
|
|
9208
|
-
|
|
6150
|
+
resolve3(value);
|
|
9209
6151
|
} else {
|
|
9210
6152
|
Promise.resolve(value).then(_next, _throw);
|
|
9211
6153
|
}
|
|
@@ -9213,13 +6155,13 @@ function asyncGeneratorStep$2(gen, resolve4, reject, _next, _throw, key, arg) {
|
|
|
9213
6155
|
function _asyncToGenerator$2(fn) {
|
|
9214
6156
|
return function() {
|
|
9215
6157
|
var self2 = this, args = arguments;
|
|
9216
|
-
return new Promise(function(
|
|
6158
|
+
return new Promise(function(resolve3, reject) {
|
|
9217
6159
|
var gen = fn.apply(self2, args);
|
|
9218
6160
|
function _next(value) {
|
|
9219
|
-
asyncGeneratorStep$2(gen,
|
|
6161
|
+
asyncGeneratorStep$2(gen, resolve3, reject, _next, _throw, "next", value);
|
|
9220
6162
|
}
|
|
9221
6163
|
function _throw(err) {
|
|
9222
|
-
asyncGeneratorStep$2(gen,
|
|
6164
|
+
asyncGeneratorStep$2(gen, resolve3, reject, _next, _throw, "throw", err);
|
|
9223
6165
|
}
|
|
9224
6166
|
_next(void 0);
|
|
9225
6167
|
});
|
|
@@ -9640,7 +6582,7 @@ Instructions:
|
|
|
9640
6582
|
}
|
|
9641
6583
|
};
|
|
9642
6584
|
var multiselect$1 = MultiselectPrompt$3;
|
|
9643
|
-
function asyncGeneratorStep$1(gen,
|
|
6585
|
+
function asyncGeneratorStep$1(gen, resolve3, reject, _next, _throw, key, arg) {
|
|
9644
6586
|
try {
|
|
9645
6587
|
var info = gen[key](arg);
|
|
9646
6588
|
var value = info.value;
|
|
@@ -9649,7 +6591,7 @@ function asyncGeneratorStep$1(gen, resolve4, reject, _next, _throw, key, arg) {
|
|
|
9649
6591
|
return;
|
|
9650
6592
|
}
|
|
9651
6593
|
if (info.done) {
|
|
9652
|
-
|
|
6594
|
+
resolve3(value);
|
|
9653
6595
|
} else {
|
|
9654
6596
|
Promise.resolve(value).then(_next, _throw);
|
|
9655
6597
|
}
|
|
@@ -9657,13 +6599,13 @@ function asyncGeneratorStep$1(gen, resolve4, reject, _next, _throw, key, arg) {
|
|
|
9657
6599
|
function _asyncToGenerator$1(fn) {
|
|
9658
6600
|
return function() {
|
|
9659
6601
|
var self2 = this, args = arguments;
|
|
9660
|
-
return new Promise(function(
|
|
6602
|
+
return new Promise(function(resolve3, reject) {
|
|
9661
6603
|
var gen = fn.apply(self2, args);
|
|
9662
6604
|
function _next(value) {
|
|
9663
|
-
asyncGeneratorStep$1(gen,
|
|
6605
|
+
asyncGeneratorStep$1(gen, resolve3, reject, _next, _throw, "next", value);
|
|
9664
6606
|
}
|
|
9665
6607
|
function _throw(err) {
|
|
9666
|
-
asyncGeneratorStep$1(gen,
|
|
6608
|
+
asyncGeneratorStep$1(gen, resolve3, reject, _next, _throw, "throw", err);
|
|
9667
6609
|
}
|
|
9668
6610
|
_next(void 0);
|
|
9669
6611
|
});
|
|
@@ -10141,9 +7083,9 @@ var elements$1 = {
|
|
|
10141
7083
|
const $2 = exports;
|
|
10142
7084
|
const el = elements$1;
|
|
10143
7085
|
const noop2 = (v) => v;
|
|
10144
|
-
function toPrompt(
|
|
7086
|
+
function toPrompt(type, args, opts = {}) {
|
|
10145
7087
|
return new Promise((res, rej) => {
|
|
10146
|
-
const p = new el[
|
|
7088
|
+
const p = new el[type](args);
|
|
10147
7089
|
const onAbort = opts.onAbort || noop2;
|
|
10148
7090
|
const onSubmit = opts.onSubmit || noop2;
|
|
10149
7091
|
const onExit2 = opts.onExit || noop2;
|
|
@@ -10168,7 +7110,7 @@ var elements$1 = {
|
|
|
10168
7110
|
$2.list = (args) => {
|
|
10169
7111
|
const sep = args.separator || ",";
|
|
10170
7112
|
return toPrompt("TextPrompt", args, {
|
|
10171
|
-
onSubmit: (
|
|
7113
|
+
onSubmit: (str) => str.split(sep).map((s) => s.trim())
|
|
10172
7114
|
});
|
|
10173
7115
|
};
|
|
10174
7116
|
$2.toggle = (args) => toPrompt("TogglePrompt", args);
|
|
@@ -10293,7 +7235,7 @@ function _arrayLikeToArray(arr, len) {
|
|
|
10293
7235
|
arr2[i] = arr[i];
|
|
10294
7236
|
return arr2;
|
|
10295
7237
|
}
|
|
10296
|
-
function asyncGeneratorStep(gen,
|
|
7238
|
+
function asyncGeneratorStep(gen, resolve3, reject, _next, _throw, key, arg) {
|
|
10297
7239
|
try {
|
|
10298
7240
|
var info = gen[key](arg);
|
|
10299
7241
|
var value = info.value;
|
|
@@ -10302,7 +7244,7 @@ function asyncGeneratorStep(gen, resolve4, reject, _next, _throw, key, arg) {
|
|
|
10302
7244
|
return;
|
|
10303
7245
|
}
|
|
10304
7246
|
if (info.done) {
|
|
10305
|
-
|
|
7247
|
+
resolve3(value);
|
|
10306
7248
|
} else {
|
|
10307
7249
|
Promise.resolve(value).then(_next, _throw);
|
|
10308
7250
|
}
|
|
@@ -10310,13 +7252,13 @@ function asyncGeneratorStep(gen, resolve4, reject, _next, _throw, key, arg) {
|
|
|
10310
7252
|
function _asyncToGenerator(fn) {
|
|
10311
7253
|
return function() {
|
|
10312
7254
|
var self2 = this, args = arguments;
|
|
10313
|
-
return new Promise(function(
|
|
7255
|
+
return new Promise(function(resolve3, reject) {
|
|
10314
7256
|
var gen = fn.apply(self2, args);
|
|
10315
7257
|
function _next(value) {
|
|
10316
|
-
asyncGeneratorStep(gen,
|
|
7258
|
+
asyncGeneratorStep(gen, resolve3, reject, _next, _throw, "next", value);
|
|
10317
7259
|
}
|
|
10318
7260
|
function _throw(err) {
|
|
10319
|
-
asyncGeneratorStep(gen,
|
|
7261
|
+
asyncGeneratorStep(gen, resolve3, reject, _next, _throw, "throw", err);
|
|
10320
7262
|
}
|
|
10321
7263
|
_next(void 0);
|
|
10322
7264
|
});
|
|
@@ -10337,7 +7279,7 @@ function _prompt() {
|
|
|
10337
7279
|
const answers = {};
|
|
10338
7280
|
const override2 = prompt$2._override || {};
|
|
10339
7281
|
questions = [].concat(questions);
|
|
10340
|
-
let answer, question, quit, name,
|
|
7282
|
+
let answer, question, quit, name, type, lastPrompt;
|
|
10341
7283
|
const getFormattedAnswer = /* @__PURE__ */ function() {
|
|
10342
7284
|
var _ref = _asyncToGenerator(function* (question2, answer2, skipValidation = false) {
|
|
10343
7285
|
if (!skipValidation && question2.validate && question2.validate(answer2) !== true) {
|
|
@@ -10355,12 +7297,12 @@ function _prompt() {
|
|
|
10355
7297
|
question = _step.value;
|
|
10356
7298
|
var _question = question;
|
|
10357
7299
|
name = _question.name;
|
|
10358
|
-
|
|
10359
|
-
if (typeof
|
|
10360
|
-
|
|
10361
|
-
question["type"] =
|
|
7300
|
+
type = _question.type;
|
|
7301
|
+
if (typeof type === "function") {
|
|
7302
|
+
type = yield type(answer, _objectSpread({}, answers), question);
|
|
7303
|
+
question["type"] = type;
|
|
10362
7304
|
}
|
|
10363
|
-
if (!
|
|
7305
|
+
if (!type)
|
|
10364
7306
|
continue;
|
|
10365
7307
|
for (let key in question) {
|
|
10366
7308
|
if (passOn$1.includes(key))
|
|
@@ -10374,9 +7316,9 @@ function _prompt() {
|
|
|
10374
7316
|
}
|
|
10375
7317
|
var _question2 = question;
|
|
10376
7318
|
name = _question2.name;
|
|
10377
|
-
|
|
10378
|
-
if (prompts$3[
|
|
10379
|
-
throw new Error(`prompt type (${
|
|
7319
|
+
type = _question2.type;
|
|
7320
|
+
if (prompts$3[type] === void 0) {
|
|
7321
|
+
throw new Error(`prompt type (${type}) is not defined`);
|
|
10380
7322
|
}
|
|
10381
7323
|
if (override2[question.name] !== void 0) {
|
|
10382
7324
|
answer = yield getFormattedAnswer(question, override2[question.name]);
|
|
@@ -10386,7 +7328,7 @@ function _prompt() {
|
|
|
10386
7328
|
}
|
|
10387
7329
|
}
|
|
10388
7330
|
try {
|
|
10389
|
-
answer = prompt$2._injected ? getInjectedAnswer$1(prompt$2._injected, question.initial) : yield prompts$3[
|
|
7331
|
+
answer = prompt$2._injected ? getInjectedAnswer$1(prompt$2._injected, question.initial) : yield prompts$3[type](question);
|
|
10390
7332
|
answers[name] = answer = yield getFormattedAnswer(question, answer, true);
|
|
10391
7333
|
quit = yield onSubmit(question, answer, answers);
|
|
10392
7334
|
} catch (err) {
|
|
@@ -10477,17 +7419,17 @@ var action$1 = (key, isSelect) => {
|
|
|
10477
7419
|
return "left";
|
|
10478
7420
|
return false;
|
|
10479
7421
|
};
|
|
10480
|
-
var strip$2 = (
|
|
7422
|
+
var strip$2 = (str) => {
|
|
10481
7423
|
const pattern = [
|
|
10482
7424
|
"[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
|
|
10483
7425
|
"(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"
|
|
10484
7426
|
].join("|");
|
|
10485
7427
|
const RGX = new RegExp(pattern, "g");
|
|
10486
|
-
return typeof
|
|
7428
|
+
return typeof str === "string" ? str.replace(RGX, "") : str;
|
|
10487
7429
|
};
|
|
10488
7430
|
var strip$1 = strip$2;
|
|
10489
7431
|
var { erase: erase$6, cursor: cursor$a } = src;
|
|
10490
|
-
var width = (
|
|
7432
|
+
var width = (str) => [...strip$1(str)].length;
|
|
10491
7433
|
var clear$9 = function(prompt2, perLine) {
|
|
10492
7434
|
if (!perLine)
|
|
10493
7435
|
return erase$6.line + cursor$a.to(0);
|
|
@@ -10536,7 +7478,7 @@ var styles = Object.freeze({
|
|
|
10536
7478
|
invisible: { scale: 0, render: (input) => "" },
|
|
10537
7479
|
default: { scale: 1, render: (input) => `${input}` }
|
|
10538
7480
|
});
|
|
10539
|
-
var render = (
|
|
7481
|
+
var render = (type) => styles[type] || styles.default;
|
|
10540
7482
|
var symbols = Object.freeze({
|
|
10541
7483
|
aborted: c.red(figures$7.cross),
|
|
10542
7484
|
done: c.green(figures$7.tick),
|
|
@@ -10607,10 +7549,10 @@ var Prompt$8 = class extends EventEmitter {
|
|
|
10607
7549
|
if (this.in.isTTY)
|
|
10608
7550
|
this.in.setRawMode(true);
|
|
10609
7551
|
const isSelect = ["SelectPrompt", "MultiselectPrompt"].indexOf(this.constructor.name) > -1;
|
|
10610
|
-
const keypress = (
|
|
7552
|
+
const keypress = (str, key) => {
|
|
10611
7553
|
let a = action(key, isSelect);
|
|
10612
7554
|
if (a === false) {
|
|
10613
|
-
this._ && this._(
|
|
7555
|
+
this._ && this._(str, key);
|
|
10614
7556
|
} else if (typeof this[a] === "function") {
|
|
10615
7557
|
this[a](key);
|
|
10616
7558
|
} else {
|
|
@@ -11441,7 +8383,7 @@ var color$4 = kleur;
|
|
|
11441
8383
|
var Prompt$3 = prompt$1;
|
|
11442
8384
|
var { cursor: cursor$4, erase: erase$2 } = src;
|
|
11443
8385
|
var { style: style$4, figures: figures$3, clear: clear$4, lines } = util;
|
|
11444
|
-
var
|
|
8386
|
+
var isNumber = /[0-9]/;
|
|
11445
8387
|
var isDef = (any) => any !== void 0;
|
|
11446
8388
|
var round = (number2, precision) => {
|
|
11447
8389
|
let factor = Math.pow(10, precision);
|
|
@@ -11485,7 +8427,7 @@ var NumberPrompt = class extends Prompt$3 {
|
|
|
11485
8427
|
return this.float ? parseFloat(x) : parseInt(x);
|
|
11486
8428
|
}
|
|
11487
8429
|
valid(c2) {
|
|
11488
|
-
return c2 === `-` || c2 === `.` && this.float ||
|
|
8430
|
+
return c2 === `-` || c2 === `.` && this.float || isNumber.test(c2);
|
|
11489
8431
|
}
|
|
11490
8432
|
reset() {
|
|
11491
8433
|
this.typed = ``;
|
|
@@ -12294,9 +9236,9 @@ var elements = {
|
|
|
12294
9236
|
const $2 = exports;
|
|
12295
9237
|
const el = elements;
|
|
12296
9238
|
const noop2 = (v) => v;
|
|
12297
|
-
function toPrompt(
|
|
9239
|
+
function toPrompt(type, args, opts = {}) {
|
|
12298
9240
|
return new Promise((res, rej) => {
|
|
12299
|
-
const p = new el[
|
|
9241
|
+
const p = new el[type](args);
|
|
12300
9242
|
const onAbort = opts.onAbort || noop2;
|
|
12301
9243
|
const onSubmit = opts.onSubmit || noop2;
|
|
12302
9244
|
const onExit2 = opts.onExit || noop2;
|
|
@@ -12321,7 +9263,7 @@ var elements = {
|
|
|
12321
9263
|
$2.list = (args) => {
|
|
12322
9264
|
const sep = args.separator || ",";
|
|
12323
9265
|
return toPrompt("TextPrompt", args, {
|
|
12324
|
-
onSubmit: (
|
|
9266
|
+
onSubmit: (str) => str.split(sep).map((s) => s.trim())
|
|
12325
9267
|
});
|
|
12326
9268
|
};
|
|
12327
9269
|
$2.toggle = (args) => toPrompt("TogglePrompt", args);
|
|
@@ -12357,7 +9299,7 @@ async function prompt(questions = [], { onSubmit = noop, onCancel = noop } = {})
|
|
|
12357
9299
|
const answers = {};
|
|
12358
9300
|
const override2 = prompt._override || {};
|
|
12359
9301
|
questions = [].concat(questions);
|
|
12360
|
-
let answer, question, quit, name,
|
|
9302
|
+
let answer, question, quit, name, type, lastPrompt;
|
|
12361
9303
|
const getFormattedAnswer = async (question2, answer2, skipValidation = false) => {
|
|
12362
9304
|
if (!skipValidation && question2.validate && question2.validate(answer2) !== true) {
|
|
12363
9305
|
return;
|
|
@@ -12365,12 +9307,12 @@ async function prompt(questions = [], { onSubmit = noop, onCancel = noop } = {})
|
|
|
12365
9307
|
return question2.format ? await question2.format(answer2, answers) : answer2;
|
|
12366
9308
|
};
|
|
12367
9309
|
for (question of questions) {
|
|
12368
|
-
({ name, type
|
|
12369
|
-
if (typeof
|
|
12370
|
-
|
|
12371
|
-
question["type"] =
|
|
9310
|
+
({ name, type } = question);
|
|
9311
|
+
if (typeof type === "function") {
|
|
9312
|
+
type = await type(answer, __spreadValues({}, answers), question);
|
|
9313
|
+
question["type"] = type;
|
|
12372
9314
|
}
|
|
12373
|
-
if (!
|
|
9315
|
+
if (!type)
|
|
12374
9316
|
continue;
|
|
12375
9317
|
for (let key in question) {
|
|
12376
9318
|
if (passOn.includes(key))
|
|
@@ -12382,9 +9324,9 @@ async function prompt(questions = [], { onSubmit = noop, onCancel = noop } = {})
|
|
|
12382
9324
|
if (typeof question.message !== "string") {
|
|
12383
9325
|
throw new Error("prompt message is required");
|
|
12384
9326
|
}
|
|
12385
|
-
({ name, type
|
|
12386
|
-
if (prompts$1[
|
|
12387
|
-
throw new Error(`prompt type (${
|
|
9327
|
+
({ name, type } = question);
|
|
9328
|
+
if (prompts$1[type] === void 0) {
|
|
9329
|
+
throw new Error(`prompt type (${type}) is not defined`);
|
|
12388
9330
|
}
|
|
12389
9331
|
if (override2[question.name] !== void 0) {
|
|
12390
9332
|
answer = await getFormattedAnswer(question, override2[question.name]);
|
|
@@ -12394,7 +9336,7 @@ async function prompt(questions = [], { onSubmit = noop, onCancel = noop } = {})
|
|
|
12394
9336
|
}
|
|
12395
9337
|
}
|
|
12396
9338
|
try {
|
|
12397
|
-
answer = prompt._injected ? getInjectedAnswer(prompt._injected, question.initial) : await prompts$1[
|
|
9339
|
+
answer = prompt._injected ? getInjectedAnswer(prompt._injected, question.initial) : await prompts$1[type](question);
|
|
12398
9340
|
answers[name] = answer = await getFormattedAnswer(question, answer, true);
|
|
12399
9341
|
quit = await onSubmit(question, answer, answers);
|
|
12400
9342
|
} catch (err) {
|
|
@@ -12485,7 +9427,7 @@ async function run(fn, args, options = {}) {
|
|
|
12485
9427
|
let cwd = process.cwd();
|
|
12486
9428
|
let command;
|
|
12487
9429
|
if (args[0] === "-C") {
|
|
12488
|
-
cwd =
|
|
9430
|
+
cwd = resolve(cwd, args[1]);
|
|
12489
9431
|
args.splice(0, 2);
|
|
12490
9432
|
}
|
|
12491
9433
|
const isGlobal = args.includes("-g");
|
|
@@ -12524,19 +9466,19 @@ async function run(fn, args, options = {}) {
|
|
|
12524
9466
|
var import_semver = __toESM(require_semver2());
|
|
12525
9467
|
import isInstalledGlobally from "is-installed-globally";
|
|
12526
9468
|
import { underline } from "kolorist";
|
|
12527
|
-
import
|
|
9469
|
+
import fs2 from "fs-extra";
|
|
12528
9470
|
|
|
12529
9471
|
// node/options.ts
|
|
12530
9472
|
init_esm_shims();
|
|
12531
|
-
import { dirname
|
|
12532
|
-
import { uniq
|
|
9473
|
+
import { dirname, join, resolve as resolve2 } from "path";
|
|
9474
|
+
import { uniq } from "@antfu/utils";
|
|
12533
9475
|
import _debug from "debug";
|
|
12534
9476
|
var debug = _debug("slidev:options");
|
|
12535
9477
|
function getClientRoot() {
|
|
12536
|
-
return
|
|
9478
|
+
return dirname(resolveImportPath("@slidev/client/package.json", true));
|
|
12537
9479
|
}
|
|
12538
9480
|
function getCLIRoot() {
|
|
12539
|
-
return
|
|
9481
|
+
return resolve2(__dirname, "..");
|
|
12540
9482
|
}
|
|
12541
9483
|
function isPath(name) {
|
|
12542
9484
|
return name.startsWith("/") || /^\.\.?[\/\\]/.test(name);
|
|
@@ -12546,25 +9488,26 @@ function getThemeRoots(name, entry) {
|
|
|
12546
9488
|
return [];
|
|
12547
9489
|
if (isPath(name)) {
|
|
12548
9490
|
return [
|
|
12549
|
-
|
|
9491
|
+
resolve2(dirname(entry), name)
|
|
12550
9492
|
];
|
|
12551
9493
|
} else {
|
|
12552
9494
|
return [
|
|
12553
|
-
|
|
9495
|
+
dirname(resolveImportPath(`${name}/package.json`, true))
|
|
12554
9496
|
];
|
|
12555
9497
|
}
|
|
12556
9498
|
}
|
|
12557
9499
|
function getUserRoot(options) {
|
|
12558
9500
|
const { entry: rawEntry = "slides.md", userRoot = process.cwd() } = options;
|
|
12559
|
-
const fullEntry =
|
|
12560
|
-
return { entry: fullEntry, userRoot:
|
|
9501
|
+
const fullEntry = resolve2(userRoot, rawEntry);
|
|
9502
|
+
return { entry: fullEntry, userRoot: dirname(fullEntry) };
|
|
12561
9503
|
}
|
|
12562
9504
|
async function resolveOptions(options, mode2, promptForInstallation = true) {
|
|
9505
|
+
const { remote } = options;
|
|
12563
9506
|
const {
|
|
12564
9507
|
entry,
|
|
12565
9508
|
userRoot
|
|
12566
9509
|
} = getUserRoot(options);
|
|
12567
|
-
const data = await
|
|
9510
|
+
const data = await parser.load(entry);
|
|
12568
9511
|
const theme = resolveThemeName(options.theme || data.config.theme);
|
|
12569
9512
|
if (promptForInstallation) {
|
|
12570
9513
|
if (await promptForThemeInstallation(theme) === false)
|
|
@@ -12578,12 +9521,12 @@ async function resolveOptions(options, mode2, promptForInstallation = true) {
|
|
|
12578
9521
|
const clientRoot = getClientRoot();
|
|
12579
9522
|
const cliRoot = getCLIRoot();
|
|
12580
9523
|
const themeRoots = getThemeRoots(theme, entry);
|
|
12581
|
-
const roots =
|
|
9524
|
+
const roots = uniq([clientRoot, ...themeRoots, userRoot]);
|
|
12582
9525
|
if (themeRoots.length) {
|
|
12583
9526
|
const themeMeta = await getThemeMeta(theme, join(themeRoots[0], "package.json"));
|
|
12584
9527
|
data.themeMeta = themeMeta;
|
|
12585
9528
|
if (themeMeta)
|
|
12586
|
-
data.config =
|
|
9529
|
+
data.config = parser.resolveConfig(data.headmatter, themeMeta);
|
|
12587
9530
|
}
|
|
12588
9531
|
debug({
|
|
12589
9532
|
config: data.config,
|
|
@@ -12594,7 +9537,8 @@ async function resolveOptions(options, mode2, promptForInstallation = true) {
|
|
|
12594
9537
|
clientRoot,
|
|
12595
9538
|
cliRoot,
|
|
12596
9539
|
themeRoots,
|
|
12597
|
-
roots
|
|
9540
|
+
roots,
|
|
9541
|
+
remote
|
|
12598
9542
|
});
|
|
12599
9543
|
return {
|
|
12600
9544
|
data,
|
|
@@ -12605,7 +9549,8 @@ async function resolveOptions(options, mode2, promptForInstallation = true) {
|
|
|
12605
9549
|
clientRoot,
|
|
12606
9550
|
cliRoot,
|
|
12607
9551
|
themeRoots,
|
|
12608
|
-
roots
|
|
9552
|
+
roots,
|
|
9553
|
+
remote
|
|
12609
9554
|
};
|
|
12610
9555
|
}
|
|
12611
9556
|
|
|
@@ -12624,10 +9569,10 @@ function packageExists(name) {
|
|
|
12624
9569
|
return false;
|
|
12625
9570
|
}
|
|
12626
9571
|
async function getThemeMeta(name, path2) {
|
|
12627
|
-
if (!
|
|
9572
|
+
if (!fs2.existsSync(path2))
|
|
12628
9573
|
return {};
|
|
12629
9574
|
if (path2) {
|
|
12630
|
-
const { slidev = {}, engines = {} } = await
|
|
9575
|
+
const { slidev = {}, engines = {} } = await fs2.readJSON(path2);
|
|
12631
9576
|
if (engines.slidev && !(0, import_semver.satisfies)(version, engines.slidev))
|
|
12632
9577
|
throw new Error(`[slidev] theme "${name}" requires Slidev version range "${engines.slidev}" but found "${version}"`);
|
|
12633
9578
|
return slidev;
|
|
@@ -12671,7 +9616,7 @@ async function promptForThemeInstallation(name) {
|
|
|
12671
9616
|
}
|
|
12672
9617
|
|
|
12673
9618
|
export {
|
|
12674
|
-
|
|
9619
|
+
parser,
|
|
12675
9620
|
version,
|
|
12676
9621
|
packageExists,
|
|
12677
9622
|
resolveThemeName,
|
|
@@ -12682,4 +9627,3 @@ export {
|
|
|
12682
9627
|
getUserRoot,
|
|
12683
9628
|
resolveOptions
|
|
12684
9629
|
};
|
|
12685
|
-
/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */
|