@cloudflare/workers-utils 0.41.1 → 0.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.d.mts +1 -1
- package/dist/browser.mjs +1 -1
- package/dist/{chunk-4PNP2TCS.mjs → chunk-DKSA7K25.mjs} +1 -1
- package/dist/chunk-OWXQB7GP.mjs +14968 -0
- package/dist/{chunk-IKXB77SR.mjs → chunk-XNN5XXU4.mjs} +580 -431
- package/dist/{compliance-CLyWFvPo.d.mts → compliance-DzwHmPKm.d.mts} +49 -17
- package/dist/compliance.d.mts +1 -1
- package/dist/index.d.mts +5 -4
- package/dist/index.mjs +618 -15433
- package/dist/metafile-esm.json +1 -1
- package/dist/test-helpers/index.d.mts +1 -1
- package/dist/test-helpers/index.mjs +1 -1
- package/dist/zod-format.d.mts +3 -3
- package/dist/zod-format.mjs +1 -1
- package/package.json +3 -4
- package/dist/chunk-7AX24RFK.mjs +0 -265
|
@@ -7,13 +7,14 @@ import path, { resolve, isAbsolute, dirname, join } from 'node:path';
|
|
|
7
7
|
// src/config/exports.ts
|
|
8
8
|
function hasKnownExportType(entry) {
|
|
9
9
|
const type = entry?.type;
|
|
10
|
-
return type === "durable-object" || type === "worker";
|
|
10
|
+
return type === "durable-object" || type === "worker" || type === "workflow";
|
|
11
11
|
}
|
|
12
12
|
__name(hasKnownExportType, "hasKnownExportType");
|
|
13
13
|
function partitionExports(exports$1) {
|
|
14
14
|
const partitioned = {
|
|
15
15
|
"durable-object": {},
|
|
16
|
-
worker: {}
|
|
16
|
+
worker: {},
|
|
17
|
+
workflow: {}
|
|
17
18
|
};
|
|
18
19
|
if (exports$1 === void 0) {
|
|
19
20
|
return partitioned;
|
|
@@ -1104,15 +1105,15 @@ function visit(text, visitor, options = ParseOptions.DEFAULT) {
|
|
|
1104
1105
|
}
|
|
1105
1106
|
}
|
|
1106
1107
|
__name(scanNext, "scanNext");
|
|
1107
|
-
function handleError(error, skipUntilAfter = [],
|
|
1108
|
+
function handleError(error, skipUntilAfter = [], skipUntil = []) {
|
|
1108
1109
|
onError(error);
|
|
1109
|
-
if (skipUntilAfter.length +
|
|
1110
|
+
if (skipUntilAfter.length + skipUntil.length > 0) {
|
|
1110
1111
|
let token = _scanner.getToken();
|
|
1111
1112
|
while (token !== 17) {
|
|
1112
1113
|
if (skipUntilAfter.indexOf(token) !== -1) {
|
|
1113
1114
|
scanNext();
|
|
1114
1115
|
break;
|
|
1115
|
-
} else if (
|
|
1116
|
+
} else if (skipUntil.indexOf(token) !== -1) {
|
|
1116
1117
|
break;
|
|
1117
1118
|
}
|
|
1118
1119
|
token = scanNext();
|
|
@@ -1175,7 +1176,7 @@ function visit(text, visitor, options = ParseOptions.DEFAULT) {
|
|
|
1175
1176
|
if (_scanner.getToken() === 6) {
|
|
1176
1177
|
onSeparator(":");
|
|
1177
1178
|
scanNext();
|
|
1178
|
-
if (!
|
|
1179
|
+
if (!parseValue()) {
|
|
1179
1180
|
handleError(4, [], [
|
|
1180
1181
|
2,
|
|
1181
1182
|
5
|
|
@@ -1255,7 +1256,7 @@ function visit(text, visitor, options = ParseOptions.DEFAULT) {
|
|
|
1255
1256
|
} else {
|
|
1256
1257
|
_jsonPath[_jsonPath.length - 1]++;
|
|
1257
1258
|
}
|
|
1258
|
-
if (!
|
|
1259
|
+
if (!parseValue()) {
|
|
1259
1260
|
handleError(4, [], [
|
|
1260
1261
|
4,
|
|
1261
1262
|
5
|
|
@@ -1279,7 +1280,7 @@ function visit(text, visitor, options = ParseOptions.DEFAULT) {
|
|
|
1279
1280
|
return true;
|
|
1280
1281
|
}
|
|
1281
1282
|
__name(parseArray2, "parseArray");
|
|
1282
|
-
function
|
|
1283
|
+
function parseValue() {
|
|
1283
1284
|
switch (_scanner.getToken()) {
|
|
1284
1285
|
case 3:
|
|
1285
1286
|
return parseArray2();
|
|
@@ -1291,7 +1292,7 @@ function visit(text, visitor, options = ParseOptions.DEFAULT) {
|
|
|
1291
1292
|
return parseLiteral();
|
|
1292
1293
|
}
|
|
1293
1294
|
}
|
|
1294
|
-
__name(
|
|
1295
|
+
__name(parseValue, "parseValue");
|
|
1295
1296
|
scanNext();
|
|
1296
1297
|
if (_scanner.getToken() === 17) {
|
|
1297
1298
|
if (options.allowEmptyContent) {
|
|
@@ -1300,7 +1301,7 @@ function visit(text, visitor, options = ParseOptions.DEFAULT) {
|
|
|
1300
1301
|
handleError(4, [], []);
|
|
1301
1302
|
return false;
|
|
1302
1303
|
}
|
|
1303
|
-
if (!
|
|
1304
|
+
if (!parseValue()) {
|
|
1304
1305
|
handleError(4, [], []);
|
|
1305
1306
|
return false;
|
|
1306
1307
|
}
|
|
@@ -1598,109 +1599,14 @@ function applyEdits(text, edits) {
|
|
|
1598
1599
|
}
|
|
1599
1600
|
__name(applyEdits, "applyEdits");
|
|
1600
1601
|
|
|
1601
|
-
// ../../node_modules/.pnpm/smol-toml@1.
|
|
1602
|
-
var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;
|
|
1603
|
-
var TomlDate = class _TomlDate extends Date {
|
|
1604
|
-
static {
|
|
1605
|
-
__name(this, "TomlDate");
|
|
1606
|
-
}
|
|
1607
|
-
#hasDate = false;
|
|
1608
|
-
#hasTime = false;
|
|
1609
|
-
#offset = null;
|
|
1610
|
-
constructor(date) {
|
|
1611
|
-
let hasDate = true;
|
|
1612
|
-
let hasTime = true;
|
|
1613
|
-
let offset = "Z";
|
|
1614
|
-
if (typeof date === "string") {
|
|
1615
|
-
let match = date.match(DATE_TIME_RE);
|
|
1616
|
-
if (match) {
|
|
1617
|
-
if (!match[1]) {
|
|
1618
|
-
hasDate = false;
|
|
1619
|
-
date = `0000-01-01T${date}`;
|
|
1620
|
-
}
|
|
1621
|
-
hasTime = !!match[2];
|
|
1622
|
-
hasTime && date[10] === " " && (date = date.replace(" ", "T"));
|
|
1623
|
-
if (match[2] && +match[2] > 23) {
|
|
1624
|
-
date = "";
|
|
1625
|
-
} else {
|
|
1626
|
-
offset = match[3] || null;
|
|
1627
|
-
date = date.toUpperCase();
|
|
1628
|
-
if (!offset && hasTime)
|
|
1629
|
-
date += "Z";
|
|
1630
|
-
}
|
|
1631
|
-
} else {
|
|
1632
|
-
date = "";
|
|
1633
|
-
}
|
|
1634
|
-
}
|
|
1635
|
-
super(date);
|
|
1636
|
-
if (!isNaN(this.getTime())) {
|
|
1637
|
-
this.#hasDate = hasDate;
|
|
1638
|
-
this.#hasTime = hasTime;
|
|
1639
|
-
this.#offset = offset;
|
|
1640
|
-
}
|
|
1641
|
-
}
|
|
1642
|
-
isDateTime() {
|
|
1643
|
-
return this.#hasDate && this.#hasTime;
|
|
1644
|
-
}
|
|
1645
|
-
isLocal() {
|
|
1646
|
-
return !this.#hasDate || !this.#hasTime || !this.#offset;
|
|
1647
|
-
}
|
|
1648
|
-
isDate() {
|
|
1649
|
-
return this.#hasDate && !this.#hasTime;
|
|
1650
|
-
}
|
|
1651
|
-
isTime() {
|
|
1652
|
-
return this.#hasTime && !this.#hasDate;
|
|
1653
|
-
}
|
|
1654
|
-
isValid() {
|
|
1655
|
-
return this.#hasDate || this.#hasTime;
|
|
1656
|
-
}
|
|
1657
|
-
toISOString() {
|
|
1658
|
-
let iso = super.toISOString();
|
|
1659
|
-
if (this.isDate())
|
|
1660
|
-
return iso.slice(0, 10);
|
|
1661
|
-
if (this.isTime())
|
|
1662
|
-
return iso.slice(11, 23);
|
|
1663
|
-
if (this.#offset === null)
|
|
1664
|
-
return iso.slice(0, -1);
|
|
1665
|
-
if (this.#offset === "Z")
|
|
1666
|
-
return iso;
|
|
1667
|
-
let offset = +this.#offset.slice(1, 3) * 60 + +this.#offset.slice(4, 6);
|
|
1668
|
-
offset = this.#offset[0] === "-" ? offset : -offset;
|
|
1669
|
-
let offsetDate = new Date(this.getTime() - offset * 6e4);
|
|
1670
|
-
return offsetDate.toISOString().slice(0, -1) + this.#offset;
|
|
1671
|
-
}
|
|
1672
|
-
static wrapAsOffsetDateTime(jsDate, offset = "Z") {
|
|
1673
|
-
let date = new _TomlDate(jsDate);
|
|
1674
|
-
date.#offset = offset;
|
|
1675
|
-
return date;
|
|
1676
|
-
}
|
|
1677
|
-
static wrapAsLocalDateTime(jsDate) {
|
|
1678
|
-
let date = new _TomlDate(jsDate);
|
|
1679
|
-
date.#offset = null;
|
|
1680
|
-
return date;
|
|
1681
|
-
}
|
|
1682
|
-
static wrapAsLocalDate(jsDate) {
|
|
1683
|
-
let date = new _TomlDate(jsDate);
|
|
1684
|
-
date.#hasTime = false;
|
|
1685
|
-
date.#offset = null;
|
|
1686
|
-
return date;
|
|
1687
|
-
}
|
|
1688
|
-
static wrapAsLocalTime(jsDate) {
|
|
1689
|
-
let date = new _TomlDate(jsDate);
|
|
1690
|
-
date.#hasDate = false;
|
|
1691
|
-
date.#offset = null;
|
|
1692
|
-
return date;
|
|
1693
|
-
}
|
|
1694
|
-
};
|
|
1695
|
-
|
|
1696
|
-
// ../../node_modules/.pnpm/smol-toml@1.8.0/node_modules/smol-toml/dist/error.js
|
|
1602
|
+
// ../../node_modules/.pnpm/smol-toml@1.9.0/node_modules/smol-toml/dist/error.js
|
|
1697
1603
|
function getLineColFromPtr(string, ptr) {
|
|
1698
|
-
let lines = string.slice(0, ptr).split(/\r
|
|
1604
|
+
let lines = string.slice(0, ptr).split(/\r?\n/);
|
|
1699
1605
|
return [lines.length, lines.pop().length + 1];
|
|
1700
1606
|
}
|
|
1701
1607
|
__name(getLineColFromPtr, "getLineColFromPtr");
|
|
1702
1608
|
function makeCodeBlock(string, line, column) {
|
|
1703
|
-
let lines = string.split(/\r
|
|
1609
|
+
let lines = string.split(/\r?\n/);
|
|
1704
1610
|
let codeblock = "";
|
|
1705
1611
|
let numberLen = (Math.log10(line + 1) | 0) + 1;
|
|
1706
1612
|
for (let i = line - 1; i <= line + 1; i++) {
|
|
@@ -1719,7 +1625,7 @@ function makeCodeBlock(string, line, column) {
|
|
|
1719
1625
|
return codeblock;
|
|
1720
1626
|
}
|
|
1721
1627
|
__name(makeCodeBlock, "makeCodeBlock");
|
|
1722
|
-
var TomlError = class extends Error {
|
|
1628
|
+
var TomlError = class _TomlError extends Error {
|
|
1723
1629
|
static {
|
|
1724
1630
|
__name(this, "TomlError");
|
|
1725
1631
|
}
|
|
@@ -1736,73 +1642,15 @@ ${codeblock}`, options);
|
|
|
1736
1642
|
this.column = column;
|
|
1737
1643
|
this.codeblock = codeblock;
|
|
1738
1644
|
}
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
function indexOfNewline(str, start = 0) {
|
|
1743
|
-
let idx = str.indexOf("\n", start);
|
|
1744
|
-
if (str.charCodeAt(idx - 1) === 13)
|
|
1745
|
-
idx--;
|
|
1746
|
-
return idx;
|
|
1747
|
-
}
|
|
1748
|
-
__name(indexOfNewline, "indexOfNewline");
|
|
1749
|
-
function skipComment(ctx) {
|
|
1750
|
-
for (; ctx.p < ctx.s.length; ctx.p++) {
|
|
1751
|
-
let c = ctx.s.charCodeAt(ctx.p);
|
|
1752
|
-
if (c === 10)
|
|
1753
|
-
break;
|
|
1754
|
-
if (c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) {
|
|
1755
|
-
ctx.p++;
|
|
1756
|
-
break;
|
|
1757
|
-
}
|
|
1758
|
-
if (c < 32 && c !== 9 || c === 127) {
|
|
1759
|
-
throw new TomlError("control characters are not allowed in comments", {
|
|
1760
|
-
toml: ctx.s,
|
|
1761
|
-
ptr: ctx.p
|
|
1762
|
-
});
|
|
1763
|
-
}
|
|
1764
|
-
}
|
|
1765
|
-
}
|
|
1766
|
-
__name(skipComment, "skipComment");
|
|
1767
|
-
function skipVoid(ctx, banNewLines, banComments) {
|
|
1768
|
-
let c;
|
|
1769
|
-
while (1) {
|
|
1770
|
-
while ((c = ctx.s.charCodeAt(ctx.p)) === 32 || c === 9 || !banNewLines && (c === 10 || c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10))
|
|
1771
|
-
ctx.p++;
|
|
1772
|
-
if (banComments || c !== 35)
|
|
1773
|
-
break;
|
|
1774
|
-
skipComment(ctx);
|
|
1775
|
-
}
|
|
1776
|
-
}
|
|
1777
|
-
__name(skipVoid, "skipVoid");
|
|
1778
|
-
function skipUntil(ctx, sep, end) {
|
|
1779
|
-
let ptr = ctx.p;
|
|
1780
|
-
if (!end) {
|
|
1781
|
-
ptr = indexOfNewline(ctx.s, ptr);
|
|
1782
|
-
ctx.p = ptr < 0 ? ctx.s.length : ptr;
|
|
1783
|
-
return;
|
|
1645
|
+
/** @internal */
|
|
1646
|
+
static x(message, ctx, ptr) {
|
|
1647
|
+
throw new _TomlError(message, { toml: ctx.s, ptr: ptr ?? ctx.p });
|
|
1784
1648
|
}
|
|
1785
|
-
|
|
1786
|
-
let c = ctx.s.charCodeAt(ctx.p);
|
|
1787
|
-
if (c === 35) {
|
|
1788
|
-
skipComment(ctx);
|
|
1789
|
-
} else if (c === end || c === sep) {
|
|
1790
|
-
return;
|
|
1791
|
-
}
|
|
1792
|
-
}
|
|
1793
|
-
throw new TomlError("cannot find end of structure", {
|
|
1794
|
-
toml: ctx.s,
|
|
1795
|
-
ptr
|
|
1796
|
-
});
|
|
1797
|
-
}
|
|
1798
|
-
__name(skipUntil, "skipUntil");
|
|
1649
|
+
};
|
|
1799
1650
|
|
|
1800
|
-
// ../../node_modules/.pnpm/smol-toml@1.
|
|
1801
|
-
var INT_REGEX = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/;
|
|
1802
|
-
var FLOAT_REGEX = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/;
|
|
1803
|
-
var LEADING_ZERO = /^[+-]?0[0-9_]/;
|
|
1651
|
+
// ../../node_modules/.pnpm/smol-toml@1.9.0/node_modules/smol-toml/dist/primitive.js
|
|
1804
1652
|
function parseString(ctx) {
|
|
1805
|
-
let
|
|
1653
|
+
let startPtr = ctx.p;
|
|
1806
1654
|
let c = ctx.s.charCodeAt(ctx.p++);
|
|
1807
1655
|
let first = c;
|
|
1808
1656
|
let isLiteral = c === 39;
|
|
@@ -1821,10 +1669,7 @@ function parseString(ctx) {
|
|
|
1821
1669
|
if (isMultiline && (c === 10 || c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)) {
|
|
1822
1670
|
state = state && 3;
|
|
1823
1671
|
} else if (c < 32 && c !== 9 || c === 127) {
|
|
1824
|
-
|
|
1825
|
-
toml: ctx.s,
|
|
1826
|
-
ptr: ctx.p
|
|
1827
|
-
});
|
|
1672
|
+
TomlError.x("control characters are not allowed in strings", ctx);
|
|
1828
1673
|
} else if ((!state || state === 3) && c === first && (!isMultiline || ctx.s.charCodeAt(ctx.p + 1) === first && ctx.s.charCodeAt(ctx.p + 2) === first)) {
|
|
1829
1674
|
if (isMultiline) {
|
|
1830
1675
|
if (ctx.s.charCodeAt(ctx.p + 3) === first)
|
|
@@ -1832,8 +1677,10 @@ function parseString(ctx) {
|
|
|
1832
1677
|
if (ctx.s.charCodeAt(ctx.p + 3) === first)
|
|
1833
1678
|
ctx.p++;
|
|
1834
1679
|
}
|
|
1835
|
-
if (!state)
|
|
1836
|
-
|
|
1680
|
+
if (!state) {
|
|
1681
|
+
let s = ctx.s.slice(sliceStart, ctx.p);
|
|
1682
|
+
parsed = parsed ? parsed + s : s;
|
|
1683
|
+
}
|
|
1837
1684
|
ctx.p += isMultiline ? 3 : 1;
|
|
1838
1685
|
return parsed;
|
|
1839
1686
|
} else if (!state) {
|
|
@@ -1843,10 +1690,11 @@ function parseString(ctx) {
|
|
|
1843
1690
|
}
|
|
1844
1691
|
} else if (state === 1) {
|
|
1845
1692
|
if (c === 120 || c === 117 || c === 85) {
|
|
1693
|
+
let errPtr = ctx.p++ - 1;
|
|
1846
1694
|
let value = 0;
|
|
1847
1695
|
let len = c === 120 ? 2 : c === 117 ? 4 : 8;
|
|
1848
1696
|
for (let j = 0; j < len; j++, ctx.p++) {
|
|
1849
|
-
let hex = ctx.s.charCodeAt(ctx.p
|
|
1697
|
+
let hex = ctx.s.charCodeAt(ctx.p);
|
|
1850
1698
|
let digit = (
|
|
1851
1699
|
/* 0-9 */
|
|
1852
1700
|
hex >= 48 && hex <= 57 ? hex - 48 : (
|
|
@@ -1858,16 +1706,16 @@ function parseString(ctx) {
|
|
|
1858
1706
|
)
|
|
1859
1707
|
);
|
|
1860
1708
|
if (digit < 0)
|
|
1861
|
-
|
|
1709
|
+
TomlError.x("invalid non-hex character in unicode escape", ctx);
|
|
1862
1710
|
value = value << 4 | digit;
|
|
1863
1711
|
}
|
|
1864
1712
|
if (value < 0 || value > 1114111 || value >= 55296 && value <= 57343) {
|
|
1865
|
-
|
|
1713
|
+
TomlError.x("invalid unicode escape", ctx, errPtr);
|
|
1866
1714
|
}
|
|
1867
1715
|
parsed += String.fromCodePoint(value);
|
|
1868
|
-
sliceStart = ctx.p
|
|
1716
|
+
sliceStart = ctx.p--;
|
|
1869
1717
|
state = 0;
|
|
1870
|
-
} else if (c === 32 || c === 9) {
|
|
1718
|
+
} else if (isMultiline && (c === 32 || c === 9)) {
|
|
1871
1719
|
state = 2;
|
|
1872
1720
|
} else {
|
|
1873
1721
|
if (c === 98)
|
|
@@ -1887,87 +1735,156 @@ function parseString(ctx) {
|
|
|
1887
1735
|
else if (c === 92)
|
|
1888
1736
|
parsed += "\\";
|
|
1889
1737
|
else
|
|
1890
|
-
|
|
1738
|
+
TomlError.x("unrecognised escape sequence", ctx);
|
|
1891
1739
|
sliceStart = ctx.p + 1;
|
|
1892
1740
|
state = 0;
|
|
1893
1741
|
}
|
|
1894
1742
|
} else if (c !== 32 && c !== 9) {
|
|
1895
|
-
if (state === 2)
|
|
1896
|
-
|
|
1897
|
-
toml: ctx.s,
|
|
1898
|
-
ptr: sliceStart
|
|
1899
|
-
});
|
|
1900
|
-
}
|
|
1743
|
+
if (state === 2)
|
|
1744
|
+
TomlError.x("invalid escape: only line-ending whitespace may be escaped", ctx, sliceStart);
|
|
1901
1745
|
state = !isLiteral && c === 92 ? 1 : 0;
|
|
1902
1746
|
sliceStart = ctx.p;
|
|
1903
1747
|
}
|
|
1904
1748
|
}
|
|
1905
|
-
|
|
1749
|
+
TomlError.x("unfinished string", ctx, startPtr);
|
|
1906
1750
|
}
|
|
1907
1751
|
__name(parseString, "parseString");
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
}
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1752
|
+
|
|
1753
|
+
// ../../node_modules/.pnpm/smol-toml@1.9.0/node_modules/smol-toml/dist/date.js
|
|
1754
|
+
var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[Tt ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|z|[-+]\d{2}:\d{2})?$/i;
|
|
1755
|
+
var TomlDate = class _TomlDate extends Date {
|
|
1756
|
+
static {
|
|
1757
|
+
__name(this, "TomlDate");
|
|
1758
|
+
}
|
|
1759
|
+
#hasDate = false;
|
|
1760
|
+
#hasTime = false;
|
|
1761
|
+
#offset = null;
|
|
1762
|
+
constructor(date, fasttype, unsafeDelim) {
|
|
1763
|
+
let hasDate = true;
|
|
1764
|
+
let hasTime = true;
|
|
1765
|
+
let offset = "Z";
|
|
1766
|
+
let c;
|
|
1767
|
+
if (typeof date === "string") {
|
|
1768
|
+
if (fasttype)
|
|
1769
|
+
prep: {
|
|
1770
|
+
if (fasttype < 3) {
|
|
1771
|
+
if (+date.slice(11, 13) > 23) {
|
|
1772
|
+
date = "";
|
|
1773
|
+
break prep;
|
|
1774
|
+
}
|
|
1775
|
+
if (fasttype === 2) {
|
|
1776
|
+
offset = null;
|
|
1777
|
+
date += "Z";
|
|
1778
|
+
} else if ((c = date.charCodeAt(date.length - 1)) !== 90 && c !== 122) {
|
|
1779
|
+
offset = date.slice(date.length - 6);
|
|
1780
|
+
}
|
|
1781
|
+
if (unsafeDelim)
|
|
1782
|
+
date = date.slice(0, 10) + "T" + date.slice(11);
|
|
1783
|
+
} else if (fasttype === 4) {
|
|
1784
|
+
date = +date.slice(0, 2) > 23 ? "" : `0000-01-01T${date}Z`;
|
|
1785
|
+
}
|
|
1786
|
+
hasDate = fasttype !== 4;
|
|
1787
|
+
hasTime = fasttype !== 3;
|
|
1788
|
+
}
|
|
1789
|
+
else {
|
|
1790
|
+
let match = date.match(DATE_TIME_RE);
|
|
1791
|
+
if (match) {
|
|
1792
|
+
if (!match[1]) {
|
|
1793
|
+
hasDate = false;
|
|
1794
|
+
date = `0000-01-01T${date}`;
|
|
1795
|
+
}
|
|
1796
|
+
hasTime = !!match[2];
|
|
1797
|
+
hasTime && date[10] === " " && (date = date.replace(" ", "T"));
|
|
1798
|
+
if (match[2] && +match[2] > 23) {
|
|
1799
|
+
date = "";
|
|
1800
|
+
} else {
|
|
1801
|
+
offset = match[3] || null;
|
|
1802
|
+
if (!offset && hasTime)
|
|
1803
|
+
date += "Z";
|
|
1804
|
+
}
|
|
1805
|
+
} else {
|
|
1806
|
+
date = "";
|
|
1807
|
+
}
|
|
1946
1808
|
}
|
|
1947
|
-
if (isInt || integersAsBigInt === true)
|
|
1948
|
-
numeric = BigInt(value);
|
|
1949
1809
|
}
|
|
1950
|
-
|
|
1810
|
+
super(date);
|
|
1811
|
+
if (!isNaN(this.getTime())) {
|
|
1812
|
+
this.#hasDate = hasDate;
|
|
1813
|
+
this.#hasTime = hasTime;
|
|
1814
|
+
this.#offset = offset;
|
|
1815
|
+
}
|
|
1951
1816
|
}
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1817
|
+
isDateTime() {
|
|
1818
|
+
return this.#hasDate && this.#hasTime;
|
|
1819
|
+
}
|
|
1820
|
+
isLocal() {
|
|
1821
|
+
return !this.#hasDate || !this.#hasTime || !this.#offset;
|
|
1822
|
+
}
|
|
1823
|
+
isDate() {
|
|
1824
|
+
return this.#hasDate && !this.#hasTime;
|
|
1825
|
+
}
|
|
1826
|
+
isTime() {
|
|
1827
|
+
return this.#hasTime && !this.#hasDate;
|
|
1828
|
+
}
|
|
1829
|
+
isValid() {
|
|
1830
|
+
return this.#hasDate || this.#hasTime;
|
|
1831
|
+
}
|
|
1832
|
+
toISOString() {
|
|
1833
|
+
let iso = super.toISOString();
|
|
1834
|
+
if (this.isDate())
|
|
1835
|
+
return iso.slice(0, 10);
|
|
1836
|
+
if (this.isTime())
|
|
1837
|
+
return iso.slice(11, 23);
|
|
1838
|
+
if (this.#offset === null)
|
|
1839
|
+
return iso.slice(0, -1);
|
|
1840
|
+
if (this.#offset === "Z" || this.#offset === "z")
|
|
1841
|
+
return iso;
|
|
1842
|
+
let offset = +this.#offset.slice(1, 3) * 60 + +this.#offset.slice(4, 6);
|
|
1843
|
+
offset = this.#offset[0] === "-" ? offset : -offset;
|
|
1844
|
+
let offsetDate = new Date(this.getTime() - offset * 6e4);
|
|
1845
|
+
return offsetDate.toISOString().slice(0, -1) + this.#offset;
|
|
1846
|
+
}
|
|
1847
|
+
static wrapAsOffsetDateTime(jsDate, offset = "Z") {
|
|
1848
|
+
let date = new _TomlDate(jsDate);
|
|
1849
|
+
date.#offset = offset;
|
|
1850
|
+
return date;
|
|
1851
|
+
}
|
|
1852
|
+
static wrapAsLocalDateTime(jsDate) {
|
|
1853
|
+
let date = new _TomlDate(jsDate);
|
|
1854
|
+
date.#offset = null;
|
|
1855
|
+
return date;
|
|
1856
|
+
}
|
|
1857
|
+
static wrapAsLocalDate(jsDate) {
|
|
1858
|
+
let date = new _TomlDate(jsDate);
|
|
1859
|
+
date.#hasTime = false;
|
|
1860
|
+
date.#offset = null;
|
|
1861
|
+
return date;
|
|
1862
|
+
}
|
|
1863
|
+
static wrapAsLocalTime(jsDate) {
|
|
1864
|
+
let date = new _TomlDate(jsDate);
|
|
1865
|
+
date.#hasDate = false;
|
|
1866
|
+
date.#offset = null;
|
|
1867
|
+
return date;
|
|
1868
|
+
}
|
|
1869
|
+
};
|
|
1958
1870
|
|
|
1959
|
-
// ../../node_modules/.pnpm/smol-toml@1.
|
|
1960
|
-
function
|
|
1961
|
-
|
|
1962
|
-
|
|
1871
|
+
// ../../node_modules/.pnpm/smol-toml@1.9.0/node_modules/smol-toml/dist/extract.js
|
|
1872
|
+
function isDigit2(char, base = 10) {
|
|
1873
|
+
return base === 16 ? char > 47 && char < 58 || char > 64 && char < 71 || char > 96 && char < 103 : char > 47 && char < 48 + base;
|
|
1874
|
+
}
|
|
1875
|
+
__name(isDigit2, "isDigit");
|
|
1876
|
+
function isEndOfValue(char, delim) {
|
|
1877
|
+
return char === 32 || char === 9 || char === 10 || char === 13 || // Structure end or next value delimiter
|
|
1878
|
+
delim && (char === delim || char === 44) || // Comment
|
|
1879
|
+
char === 35;
|
|
1880
|
+
}
|
|
1881
|
+
__name(isEndOfValue, "isEndOfValue");
|
|
1882
|
+
function extractValue(ctx, end) {
|
|
1883
|
+
let errPtr = ctx.p;
|
|
1884
|
+
let c = ctx.s.charCodeAt(ctx.p);
|
|
1963
1885
|
if (c === 91 || c === 123) {
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
toml: ctx.s,
|
|
1967
|
-
ptr
|
|
1968
|
-
});
|
|
1969
|
-
}
|
|
1970
|
-
let value = c === 91 ? parseArray(ctx, integersAsBigInt) : parseInlineTable(ctx, integersAsBigInt);
|
|
1886
|
+
ctx.d-- || TomlError.x("document contains excessively nested structures. aborting.", ctx);
|
|
1887
|
+
let value = c === 91 ? parseArray(ctx) : parseInlineTable(ctx);
|
|
1971
1888
|
ctx.d++;
|
|
1972
1889
|
return value;
|
|
1973
1890
|
}
|
|
@@ -1976,92 +1893,271 @@ function extractValue(ctx, end, integersAsBigInt) {
|
|
|
1976
1893
|
}
|
|
1977
1894
|
if (c === 116) {
|
|
1978
1895
|
if (ctx.s.charCodeAt(++ctx.p) !== 114 || ctx.s.charCodeAt(++ctx.p) !== 117 || ctx.s.charCodeAt(++ctx.p) !== 101)
|
|
1979
|
-
|
|
1980
|
-
ctx.p
|
|
1981
|
-
return true;
|
|
1896
|
+
TomlError.x("invalid value", ctx, errPtr);
|
|
1897
|
+
return ctx.p++, true;
|
|
1982
1898
|
}
|
|
1983
1899
|
if (c === 102) {
|
|
1984
1900
|
if (ctx.s.charCodeAt(++ctx.p) !== 97 || ctx.s.charCodeAt(++ctx.p) !== 108 || ctx.s.charCodeAt(++ctx.p) !== 115 || ctx.s.charCodeAt(++ctx.p) !== 101)
|
|
1985
|
-
|
|
1986
|
-
ctx.p
|
|
1987
|
-
return false;
|
|
1901
|
+
TomlError.x("invalid value", ctx, errPtr);
|
|
1902
|
+
return ctx.p++, false;
|
|
1988
1903
|
}
|
|
1989
|
-
|
|
1904
|
+
if (c === 43 || c === 45) {
|
|
1905
|
+
return parseNumber(ctx, ctx.p, ctx.s.charCodeAt(++ctx.p), 44 - c, end);
|
|
1906
|
+
}
|
|
1907
|
+
if (ctx.s.charCodeAt(ctx.p + 4) === 45 && ctx.s.charCodeAt(ctx.p + 7) === 45) {
|
|
1908
|
+
return parseDate(ctx, c, end);
|
|
1909
|
+
}
|
|
1910
|
+
if (ctx.s.charCodeAt(ctx.p + 2) === 58) {
|
|
1911
|
+
return parseTime(ctx, c, end);
|
|
1912
|
+
}
|
|
1913
|
+
return parseNumber(ctx, ctx.p, c, 0, end);
|
|
1990
1914
|
}
|
|
1991
1915
|
__name(extractValue, "extractValue");
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1916
|
+
function parseNumber(ctx, startPtr, startChr, sign, endChr) {
|
|
1917
|
+
let c = startChr;
|
|
1918
|
+
let state = 0;
|
|
1919
|
+
let hasUnderscores = false;
|
|
1920
|
+
if (c === 105) {
|
|
1921
|
+
if (ctx.s.charCodeAt(++ctx.p) !== 110 || ctx.s.charCodeAt(++ctx.p) !== 102)
|
|
1922
|
+
TomlError.x("invalid value", ctx, startPtr);
|
|
1923
|
+
return ctx.p++, (sign || 1) / 0;
|
|
1924
|
+
}
|
|
1925
|
+
if (c === 110) {
|
|
1926
|
+
if (ctx.s.charCodeAt(++ctx.p) !== 97 || ctx.s.charCodeAt(++ctx.p) !== 110)
|
|
1927
|
+
TomlError.x("invalid value", ctx, startPtr);
|
|
1928
|
+
return ctx.p++, NaN;
|
|
1929
|
+
}
|
|
1930
|
+
if (c === 48) {
|
|
1931
|
+
if (++ctx.p >= ctx.s.length || isEndOfValue(c = ctx.s.charCodeAt(ctx.p), endChr))
|
|
1932
|
+
return ctx.bi === true ? 0n : 0;
|
|
1933
|
+
if (!sign) {
|
|
1934
|
+
if (c === 120)
|
|
1935
|
+
return parseIntegerBaseN(ctx, startPtr, 16, endChr);
|
|
1936
|
+
else if (c === 98)
|
|
1937
|
+
return parseIntegerBaseN(ctx, startPtr, 2, endChr);
|
|
1938
|
+
else if (c === 111)
|
|
1939
|
+
return parseIntegerBaseN(ctx, startPtr, 8, endChr);
|
|
1940
|
+
}
|
|
1941
|
+
if (c === 46)
|
|
1942
|
+
state = 2;
|
|
1943
|
+
else if (c === 101 || c === 69)
|
|
1944
|
+
state = 4;
|
|
1945
|
+
else
|
|
1946
|
+
TomlError.x("illegal leading zero", ctx, startPtr);
|
|
1947
|
+
} else if (!isDigit2(c))
|
|
1948
|
+
TomlError.x("invalid value", ctx, startPtr);
|
|
1949
|
+
while (++ctx.p < ctx.s.length && (c = ctx.s.charCodeAt(ctx.p), !isEndOfValue(c, endChr))) {
|
|
1950
|
+
if (!state)
|
|
1951
|
+
state = 1;
|
|
1952
|
+
if (c === 95) {
|
|
1953
|
+
if (!(state & 1))
|
|
1954
|
+
TomlError.x("illegal underscore", ctx);
|
|
1955
|
+
state += 11;
|
|
1956
|
+
hasUnderscores = true;
|
|
1957
|
+
} else if (state === 1 && c === 46)
|
|
1958
|
+
state = 2;
|
|
1959
|
+
else if ((state === 1 || state === 3) && (c === 101 || c === 69))
|
|
1960
|
+
state = 4;
|
|
1961
|
+
else if (state === 4 && (c === 43 || c === 45)) ; else if (!isDigit2(c))
|
|
1962
|
+
TomlError.x(`illegal character in numeric literal`, ctx);
|
|
1963
|
+
else if (state > 9)
|
|
1964
|
+
state -= 11;
|
|
1965
|
+
else if (!(state & 1))
|
|
1966
|
+
state++;
|
|
1967
|
+
}
|
|
1968
|
+
if (!state) {
|
|
1969
|
+
let val = (startChr - 48) * (sign || 1);
|
|
1970
|
+
return ctx.bi === true ? BigInt(val) : val;
|
|
1971
|
+
}
|
|
1972
|
+
if (!(state & 1))
|
|
1973
|
+
TomlError.x("unfinished numeric value", ctx, startPtr);
|
|
1974
|
+
let str = ctx.s.slice(startPtr, ctx.p);
|
|
1975
|
+
if (hasUnderscores)
|
|
1976
|
+
str = str.replaceAll("_", "");
|
|
1977
|
+
return state > 1 ? parseFloat(str) : parseInteger(ctx, str, 10, startPtr);
|
|
1978
|
+
}
|
|
1979
|
+
__name(parseNumber, "parseNumber");
|
|
1980
|
+
function parseIntegerBaseN(ctx, startPtr, base, endChr) {
|
|
1981
|
+
let c, underscore = 1;
|
|
1982
|
+
while (++ctx.p < ctx.s.length && (c = ctx.s.charCodeAt(ctx.p), !isEndOfValue(c, endChr))) {
|
|
1983
|
+
if (c === 95) {
|
|
1984
|
+
if (underscore & 1)
|
|
1985
|
+
TomlError.x("illegal underscore", ctx);
|
|
1986
|
+
underscore = 3;
|
|
1987
|
+
} else if (!isDigit2(c, base))
|
|
1988
|
+
TomlError.x(`illegal character in numeric literal`, ctx);
|
|
1989
|
+
else if (underscore & 1)
|
|
1990
|
+
underscore--;
|
|
1991
|
+
}
|
|
1992
|
+
if (underscore & 1)
|
|
1993
|
+
TomlError.x("unfinished numeric value", ctx);
|
|
1994
|
+
let str = ctx.s.slice(startPtr + 2, ctx.p);
|
|
1995
|
+
if (underscore)
|
|
1996
|
+
str = str.replaceAll("_", "");
|
|
1997
|
+
return parseInteger(ctx, str, base, startPtr);
|
|
1998
|
+
}
|
|
1999
|
+
__name(parseIntegerBaseN, "parseIntegerBaseN");
|
|
2000
|
+
function parseInteger(ctx, str, base, startPtr) {
|
|
2001
|
+
if (ctx.bi !== true)
|
|
2002
|
+
int: {
|
|
2003
|
+
let val = parseInt(str, base);
|
|
2004
|
+
if (!Number.isSafeInteger(val)) {
|
|
2005
|
+
if (ctx.bi)
|
|
2006
|
+
break int;
|
|
2007
|
+
TomlError.x("integer value cannot be represented losslessly", ctx, startPtr);
|
|
2008
|
+
}
|
|
2009
|
+
return val;
|
|
2010
|
+
}
|
|
2011
|
+
return base === 10 ? BigInt(str) : BigInt((base === 2 ? "0b" : base === 8 ? "0o" : "0x") + str);
|
|
2012
|
+
}
|
|
2013
|
+
__name(parseInteger, "parseInteger");
|
|
2014
|
+
function parseDate(ctx, c, endChr) {
|
|
2015
|
+
let startPtr = ctx.p++, unsafeSeparator;
|
|
2016
|
+
if (!isDigit2(c) || !isDigit2(ctx.s.charCodeAt(ctx.p++)) || !isDigit2(ctx.s.charCodeAt(ctx.p++)) || !isDigit2(ctx.s.charCodeAt(ctx.p++))) {
|
|
2017
|
+
return parseNumber(ctx, ctx.p = startPtr, c, 0, endChr);
|
|
2018
|
+
}
|
|
2019
|
+
ctx.p += 5;
|
|
2020
|
+
if (!isDigit2(ctx.s.charCodeAt(ctx.p++)))
|
|
2021
|
+
TomlError.x("invalid date-time: date part is malformed", ctx, startPtr);
|
|
2022
|
+
if (ctx.p >= ctx.s.length || ((c = ctx.s.charCodeAt(ctx.p)) !== 32 || (unsafeSeparator = true, !isDigit2(ctx.s.charCodeAt(ctx.p + 1)))) && c !== 84 && c !== 116) {
|
|
2023
|
+
let t2 = ctx.s.slice(startPtr, ctx.p);
|
|
2024
|
+
return readDate(ctx, t2, 3, false, startPtr);
|
|
2025
|
+
}
|
|
2026
|
+
if (ctx.s.charCodeAt(ctx.p += 3) !== 58)
|
|
2027
|
+
TomlError.x("invalid date-time: time part is malformed", ctx, startPtr);
|
|
2028
|
+
if (ctx.s.charCodeAt(ctx.p += 3) === 58)
|
|
2029
|
+
ctx.p += 3;
|
|
2030
|
+
if (ctx.s.charCodeAt(ctx.p) === 46)
|
|
2031
|
+
while (isDigit2(ctx.s.charCodeAt(++ctx.p)))
|
|
2032
|
+
;
|
|
2033
|
+
if (c = ctx.s.charCodeAt(ctx.p)) {
|
|
2034
|
+
if (c === 90 || c === 122) {
|
|
2035
|
+
let t2 = ctx.s.slice(startPtr, ++ctx.p);
|
|
2036
|
+
return readDate(ctx, t2, 1, unsafeSeparator, startPtr, "[+00:00]");
|
|
2037
|
+
}
|
|
2038
|
+
if (c === 43 || c === 45) {
|
|
2039
|
+
let t2 = ctx.s.slice(startPtr, ctx.p += 6);
|
|
2040
|
+
return readDate(ctx, t2, 1, unsafeSeparator, startPtr, !ctx.ld && "[" + ctx.s.slice(ctx.p - 6, ctx.p) + "]");
|
|
2041
|
+
}
|
|
2042
|
+
}
|
|
2043
|
+
let t = ctx.s.slice(startPtr, ctx.p);
|
|
2044
|
+
return readDate(ctx, t, 2, unsafeSeparator, startPtr);
|
|
2045
|
+
}
|
|
2046
|
+
__name(parseDate, "parseDate");
|
|
2047
|
+
function parseTime(ctx, c, endChr) {
|
|
1996
2048
|
let start = ctx.p;
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
if (
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2049
|
+
if (!isDigit2(c) || !isDigit2(ctx.s.charCodeAt(++ctx.p))) {
|
|
2050
|
+
return parseNumber(ctx, --ctx.p, c, 0, endChr);
|
|
2051
|
+
}
|
|
2052
|
+
if (ctx.s.charCodeAt(ctx.p += 4) === 58)
|
|
2053
|
+
ctx.p += 3;
|
|
2054
|
+
if (ctx.s.charCodeAt(ctx.p) === 46)
|
|
2055
|
+
while (isDigit2(ctx.s.charCodeAt(++ctx.p)))
|
|
2056
|
+
;
|
|
2057
|
+
let t = ctx.s.slice(start, ctx.p);
|
|
2058
|
+
return readDate(ctx, t, 4, false, start);
|
|
2059
|
+
}
|
|
2060
|
+
__name(parseTime, "parseTime");
|
|
2061
|
+
function readDate(ctx, str, type, unsafeDelim, errPtr, temporalSuffix) {
|
|
2062
|
+
if (ctx.ld) {
|
|
2063
|
+
let date = new TomlDate(str, type, unsafeDelim);
|
|
2064
|
+
if (!date.isValid())
|
|
2065
|
+
TomlError.x("invalid date", ctx, errPtr);
|
|
2066
|
+
return date;
|
|
2067
|
+
}
|
|
2068
|
+
try {
|
|
2069
|
+
if (temporalSuffix)
|
|
2070
|
+
str += temporalSuffix;
|
|
2071
|
+
switch (type) {
|
|
2072
|
+
case 1:
|
|
2073
|
+
return Temporal.ZonedDateTime.from(str);
|
|
2074
|
+
case 2:
|
|
2075
|
+
return Temporal.PlainDateTime.from(str);
|
|
2076
|
+
case 3:
|
|
2077
|
+
return Temporal.PlainDate.from(str);
|
|
2078
|
+
case 4:
|
|
2079
|
+
return Temporal.PlainTime.from(str);
|
|
2080
|
+
}
|
|
2081
|
+
} catch (e) {
|
|
2082
|
+
TomlError.x(e instanceof Error ? e.message : "" + e, ctx, errPtr);
|
|
2083
|
+
}
|
|
2084
|
+
}
|
|
2085
|
+
__name(readDate, "readDate");
|
|
2086
|
+
|
|
2087
|
+
// ../../node_modules/.pnpm/smol-toml@1.9.0/node_modules/smol-toml/dist/util.js
|
|
2088
|
+
function skipComment(ctx) {
|
|
2089
|
+
for (; ctx.p < ctx.s.length; ctx.p++) {
|
|
2090
|
+
let c = ctx.s.charCodeAt(ctx.p);
|
|
2091
|
+
if (c === 10)
|
|
2092
|
+
break;
|
|
2093
|
+
if (c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) {
|
|
2094
|
+
ctx.p++;
|
|
2095
|
+
break;
|
|
2096
|
+
}
|
|
2097
|
+
if (c < 32 && c !== 9 || c === 127) {
|
|
2098
|
+
TomlError.x("control characters are not allowed in comments", ctx);
|
|
2099
|
+
}
|
|
2100
|
+
}
|
|
2101
|
+
}
|
|
2102
|
+
__name(skipComment, "skipComment");
|
|
2103
|
+
function skipVoid(ctx, banNewLines, banComments) {
|
|
2104
|
+
let c;
|
|
2105
|
+
while (ctx.p < ctx.s.length) {
|
|
2106
|
+
while (ctx.p < ctx.s.length && ((c = ctx.s.charCodeAt(ctx.p)) === 32 || c === 9 || !banNewLines && (c === 10 || c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)))
|
|
2107
|
+
ctx.p++;
|
|
2108
|
+
if (banComments || c !== 35)
|
|
2109
|
+
break;
|
|
2110
|
+
skipComment(ctx);
|
|
2005
2111
|
}
|
|
2112
|
+
}
|
|
2113
|
+
__name(skipVoid, "skipVoid");
|
|
2114
|
+
|
|
2115
|
+
// ../../node_modules/.pnpm/smol-toml@1.9.0/node_modules/smol-toml/dist/struct.js
|
|
2116
|
+
function parseKey(ctx, end = 61) {
|
|
2117
|
+
let startPtr;
|
|
2118
|
+
let state = 0;
|
|
2119
|
+
let parsed = [];
|
|
2120
|
+
let sliceStart;
|
|
2121
|
+
let c = ctx.s.charCodeAt(startPtr = ctx.p);
|
|
2006
2122
|
do {
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
ptr: ctx.p
|
|
2030
|
-
});
|
|
2031
|
-
}
|
|
2032
|
-
if (endPtr < ctx.p) {
|
|
2033
|
-
endPtr = ctx.s.indexOf(end, ctx.p);
|
|
2034
|
-
if (endPtr < 0) {
|
|
2035
|
-
throw new TomlError("incomplete key-value: cannot find end of key", {
|
|
2036
|
-
toml: ctx.s,
|
|
2037
|
-
ptr: start
|
|
2038
|
-
});
|
|
2039
|
-
}
|
|
2040
|
-
}
|
|
2041
|
-
parsed.push(part);
|
|
2042
|
-
} else {
|
|
2043
|
-
dot = ctx.s.indexOf(".", ctx.p);
|
|
2044
|
-
let part = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
|
|
2045
|
-
if (!KEY_PART_RE.test(part)) {
|
|
2046
|
-
throw new TomlError("only letter, numbers, dashes and underscores are allowed in keys", {
|
|
2047
|
-
toml: ctx.s,
|
|
2048
|
-
ptr: ctx.p
|
|
2049
|
-
});
|
|
2050
|
-
}
|
|
2051
|
-
parsed.push(part.trimEnd());
|
|
2123
|
+
if (c === end) {
|
|
2124
|
+
if (!state)
|
|
2125
|
+
TomlError.x("unexpected end of key", ctx);
|
|
2126
|
+
if (state === 1)
|
|
2127
|
+
parsed.push(ctx.s.slice(sliceStart, ctx.p));
|
|
2128
|
+
return ctx.p++, parsed;
|
|
2129
|
+
} else if (c === 46) {
|
|
2130
|
+
if (!state)
|
|
2131
|
+
TomlError.x("illegal empty bare key", ctx);
|
|
2132
|
+
if (state === 1)
|
|
2133
|
+
parsed.push(ctx.s.slice(sliceStart, ctx.p));
|
|
2134
|
+
state = 0;
|
|
2135
|
+
} else if (!state && (c === 34 || c === 39)) {
|
|
2136
|
+
if (c === ctx.s.charCodeAt(ctx.p + 1) && c === ctx.s.charCodeAt(ctx.p + 2))
|
|
2137
|
+
TomlError.x("illegal quoted key: multiline strings are not allowed", ctx);
|
|
2138
|
+
parsed.push(parseString(ctx));
|
|
2139
|
+
state = 2;
|
|
2140
|
+
ctx.p--;
|
|
2141
|
+
} else if (c === 32 || c === 9) {
|
|
2142
|
+
if (state === 1) {
|
|
2143
|
+
parsed.push(ctx.s.slice(sliceStart, ctx.p));
|
|
2144
|
+
state = 2;
|
|
2052
2145
|
}
|
|
2146
|
+
} else if (state === 2 || c < 48 && c !== 45 || c > 57 && c < 65 || c > 90 && c < 97 && c !== 95 || c > 122) {
|
|
2147
|
+
TomlError.x("illegal character in key", ctx);
|
|
2148
|
+
} else if (!state) {
|
|
2149
|
+
state = 1;
|
|
2150
|
+
sliceStart = ctx.p;
|
|
2053
2151
|
}
|
|
2054
|
-
} while (
|
|
2055
|
-
|
|
2056
|
-
skipVoid(ctx, true, true);
|
|
2057
|
-
return parsed;
|
|
2152
|
+
} while (c = ctx.s.charCodeAt(++ctx.p));
|
|
2153
|
+
TomlError.x("incomplete key-value: cannot find end of key", ctx, startPtr);
|
|
2058
2154
|
}
|
|
2059
2155
|
__name(parseKey, "parseKey");
|
|
2060
|
-
function parseInlineTable(ctx
|
|
2061
|
-
let
|
|
2156
|
+
function parseInlineTable(ctx) {
|
|
2157
|
+
let startPtr = ctx.p++;
|
|
2158
|
+
let res = /* @__PURE__ */ Object.create(null);
|
|
2062
2159
|
let seen = /* @__PURE__ */ new Set();
|
|
2063
2160
|
let c;
|
|
2064
|
-
ctx.p++;
|
|
2065
2161
|
while (ctx.p < ctx.s.length) {
|
|
2066
2162
|
skipVoid(ctx);
|
|
2067
2163
|
if ((c = ctx.s.charCodeAt(ctx.p)) === 125) {
|
|
@@ -2071,72 +2167,73 @@ function parseInlineTable(ctx, integersAsBigInt) {
|
|
|
2071
2167
|
let k;
|
|
2072
2168
|
let t = res;
|
|
2073
2169
|
let hasOwn = false;
|
|
2074
|
-
let
|
|
2170
|
+
let errPtr = ctx.p;
|
|
2075
2171
|
let key = parseKey(ctx);
|
|
2076
2172
|
for (let i = 0; i < key.length; i++) {
|
|
2077
2173
|
if (i)
|
|
2078
|
-
t = hasOwn ? t[k] : t[k] =
|
|
2174
|
+
t = hasOwn ? t[k] : t[k] = /* @__PURE__ */ Object.create(null);
|
|
2079
2175
|
k = key[i];
|
|
2080
2176
|
if ((hasOwn = Object.hasOwn(t, k)) && (typeof t[k] !== "object" || seen.has(t[k]))) {
|
|
2081
|
-
|
|
2082
|
-
toml: ctx.s,
|
|
2083
|
-
ptr: p
|
|
2084
|
-
});
|
|
2177
|
+
TomlError.x("trying to redefine an already defined value", ctx, errPtr);
|
|
2085
2178
|
}
|
|
2086
|
-
|
|
2179
|
+
let unsafe = k === "__proto__";
|
|
2180
|
+
if (ctx.uk && (unsafe || k === "constructor")) {
|
|
2181
|
+
t = ctx.uk !== 1 && TomlError.x("document contains an unsafe property", ctx, errPtr);
|
|
2182
|
+
break;
|
|
2183
|
+
}
|
|
2184
|
+
if (!hasOwn && unsafe) {
|
|
2087
2185
|
Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
|
|
2088
2186
|
}
|
|
2089
2187
|
}
|
|
2090
2188
|
if (hasOwn) {
|
|
2091
|
-
|
|
2092
|
-
toml: ctx.s,
|
|
2093
|
-
ptr: ctx.p
|
|
2094
|
-
});
|
|
2189
|
+
TomlError.x("trying to redefine an already defined value", ctx, errPtr);
|
|
2095
2190
|
}
|
|
2096
|
-
|
|
2097
|
-
|
|
2191
|
+
skipVoid(ctx, true, true);
|
|
2192
|
+
let value = extractValue(
|
|
2193
|
+
ctx,
|
|
2194
|
+
125
|
|
2195
|
+
/* } */
|
|
2196
|
+
);
|
|
2197
|
+
if (t && typeof (t[k] = value) === "object")
|
|
2198
|
+
seen.add(value);
|
|
2098
2199
|
skipVoid(ctx);
|
|
2099
2200
|
if ((c = ctx.s.charCodeAt(ctx.p++)) === 125) {
|
|
2100
2201
|
return res;
|
|
2101
2202
|
}
|
|
2102
|
-
if (c !== 44)
|
|
2103
|
-
|
|
2104
|
-
}
|
|
2203
|
+
if (c !== 44)
|
|
2204
|
+
TomlError.x("expected comma or end of structure", ctx, ctx.p - 1);
|
|
2105
2205
|
}
|
|
2106
|
-
|
|
2107
|
-
toml: ctx.s,
|
|
2108
|
-
ptr: ctx.p
|
|
2109
|
-
});
|
|
2206
|
+
TomlError.x("unfinished table", ctx, startPtr);
|
|
2110
2207
|
}
|
|
2111
2208
|
__name(parseInlineTable, "parseInlineTable");
|
|
2112
|
-
function parseArray(ctx
|
|
2209
|
+
function parseArray(ctx) {
|
|
2210
|
+
let startPtr = ctx.p++;
|
|
2113
2211
|
let res = [];
|
|
2114
2212
|
let c;
|
|
2115
|
-
ctx.p++;
|
|
2116
2213
|
while (ctx.p < ctx.s.length) {
|
|
2117
2214
|
skipVoid(ctx);
|
|
2118
2215
|
if ((c = ctx.s.charCodeAt(ctx.p)) === 93) {
|
|
2119
2216
|
ctx.p++;
|
|
2120
2217
|
return res;
|
|
2121
2218
|
}
|
|
2122
|
-
res.push(extractValue(
|
|
2219
|
+
res.push(extractValue(
|
|
2220
|
+
ctx,
|
|
2221
|
+
93
|
|
2222
|
+
/* ] */
|
|
2223
|
+
));
|
|
2123
2224
|
skipVoid(ctx);
|
|
2124
2225
|
if ((c = ctx.s.charCodeAt(ctx.p++)) === 93) {
|
|
2125
2226
|
return res;
|
|
2126
2227
|
}
|
|
2127
|
-
if (c !== 44)
|
|
2128
|
-
|
|
2129
|
-
}
|
|
2228
|
+
if (c !== 44)
|
|
2229
|
+
TomlError.x("expected comma or end of structure", ctx, ctx.p - 1);
|
|
2130
2230
|
}
|
|
2131
|
-
|
|
2132
|
-
toml: ctx.s,
|
|
2133
|
-
ptr: ctx.p
|
|
2134
|
-
});
|
|
2231
|
+
TomlError.x("unfinished array", ctx, startPtr);
|
|
2135
2232
|
}
|
|
2136
2233
|
__name(parseArray, "parseArray");
|
|
2137
2234
|
|
|
2138
|
-
// ../../node_modules/.pnpm/smol-toml@1.
|
|
2139
|
-
function peekTable(key, table, meta, type) {
|
|
2235
|
+
// ../../node_modules/.pnpm/smol-toml@1.9.0/node_modules/smol-toml/dist/parse.js
|
|
2236
|
+
function peekTable(ctx, key, table, meta, type) {
|
|
2140
2237
|
let t = table;
|
|
2141
2238
|
let m = meta;
|
|
2142
2239
|
let k;
|
|
@@ -2144,7 +2241,7 @@ function peekTable(key, table, meta, type) {
|
|
|
2144
2241
|
let state;
|
|
2145
2242
|
for (let i = 0; i < key.length; i++) {
|
|
2146
2243
|
if (i) {
|
|
2147
|
-
t = hasOwn ? t[k] : t[k] =
|
|
2244
|
+
t = hasOwn ? t[k] : t[k] = /* @__PURE__ */ Object.create(null);
|
|
2148
2245
|
m = (state = m[k]).c;
|
|
2149
2246
|
if (type === 0 && (state.t === 1 || state.t === 2)) {
|
|
2150
2247
|
return null;
|
|
@@ -2160,7 +2257,10 @@ function peekTable(key, table, meta, type) {
|
|
|
2160
2257
|
return null;
|
|
2161
2258
|
}
|
|
2162
2259
|
if (!hasOwn) {
|
|
2163
|
-
|
|
2260
|
+
let unsafe = k === "__proto__";
|
|
2261
|
+
if (ctx.uk && (unsafe || k === "constructor"))
|
|
2262
|
+
return false;
|
|
2263
|
+
if (unsafe) {
|
|
2164
2264
|
Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
|
|
2165
2265
|
Object.defineProperty(m, k, { enumerable: true, configurable: true, writable: true });
|
|
2166
2266
|
}
|
|
@@ -2168,7 +2268,7 @@ function peekTable(key, table, meta, type) {
|
|
|
2168
2268
|
t: i < key.length - 1 && type === 2 ? 3 : type,
|
|
2169
2269
|
d: false,
|
|
2170
2270
|
i: 0,
|
|
2171
|
-
c:
|
|
2271
|
+
c: /* @__PURE__ */ Object.create(null)
|
|
2172
2272
|
};
|
|
2173
2273
|
}
|
|
2174
2274
|
}
|
|
@@ -2181,44 +2281,62 @@ function peekTable(key, table, meta, type) {
|
|
|
2181
2281
|
state.d = true;
|
|
2182
2282
|
t[k] = [];
|
|
2183
2283
|
}
|
|
2184
|
-
t[k].push(t =
|
|
2185
|
-
state.c[state.i++] = state = { t: 1, d: false, i: 0, c:
|
|
2284
|
+
t[k].push(t = /* @__PURE__ */ Object.create(null));
|
|
2285
|
+
state.c[state.i++] = state = { t: 1, d: false, i: 0, c: /* @__PURE__ */ Object.create(null) };
|
|
2186
2286
|
}
|
|
2187
2287
|
if (state.d) {
|
|
2188
2288
|
return null;
|
|
2189
2289
|
}
|
|
2190
2290
|
state.d = true;
|
|
2191
2291
|
if (type === 1) {
|
|
2192
|
-
t = hasOwn ? t[k] : t[k] =
|
|
2292
|
+
t = hasOwn ? t[k] : t[k] = /* @__PURE__ */ Object.create(null);
|
|
2193
2293
|
} else if (type === 0 && hasOwn) {
|
|
2194
2294
|
return null;
|
|
2195
2295
|
}
|
|
2196
2296
|
return [k, t, state.c];
|
|
2197
2297
|
}
|
|
2198
2298
|
__name(peekTable, "peekTable");
|
|
2199
|
-
function
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2299
|
+
function validateTablePeek(ctx, peek, ptr) {
|
|
2300
|
+
if (peek === null || ctx.uk === 2)
|
|
2301
|
+
TomlError.x(peek === null ? "trying to redefine an already defined table or value" : "document contains an unsafe property", ctx, ptr);
|
|
2302
|
+
}
|
|
2303
|
+
__name(validateTablePeek, "validateTablePeek");
|
|
2304
|
+
function parse3(toml, options = {}) {
|
|
2305
|
+
let ctx = {
|
|
2306
|
+
s: toml,
|
|
2307
|
+
p: 0,
|
|
2308
|
+
d: options.maxDepth ?? 1e3,
|
|
2309
|
+
bi: options.integersAsBigInt ?? false,
|
|
2310
|
+
ld: options.useLegacyDate ?? true,
|
|
2311
|
+
uk: options.unsafeKeyBehaviour === "throw" ? 2 : options.unsafeKeyBehaviour === "drop" ? 1 : 0
|
|
2312
|
+
};
|
|
2313
|
+
let res = /* @__PURE__ */ Object.create(null);
|
|
2314
|
+
let meta = /* @__PURE__ */ Object.create(null);
|
|
2203
2315
|
let tmp;
|
|
2316
|
+
let skipping = false;
|
|
2204
2317
|
let tbl = res;
|
|
2205
2318
|
let m = meta;
|
|
2319
|
+
if (toml.charCodeAt(0) === 65279)
|
|
2320
|
+
ctx.p++;
|
|
2206
2321
|
skipVoid(ctx);
|
|
2207
2322
|
while (ctx.p < toml.length) {
|
|
2208
2323
|
if (toml.charCodeAt(ctx.p) === 91) {
|
|
2209
2324
|
let isTableArray = toml.charCodeAt(++ctx.p) === 91;
|
|
2210
2325
|
tmp = ctx.p += +isTableArray;
|
|
2211
|
-
|
|
2326
|
+
skipping = false;
|
|
2327
|
+
let k = parseKey(
|
|
2328
|
+
ctx,
|
|
2329
|
+
93
|
|
2330
|
+
/* ] */
|
|
2331
|
+
);
|
|
2212
2332
|
if (isTableArray) {
|
|
2213
|
-
if (toml.charCodeAt(ctx.p
|
|
2214
|
-
|
|
2215
|
-
toml,
|
|
2216
|
-
ptr: ctx.p - 1
|
|
2217
|
-
});
|
|
2333
|
+
if (toml.charCodeAt(ctx.p) !== 93) {
|
|
2334
|
+
TomlError.x("expected end of table array declaration", ctx);
|
|
2218
2335
|
}
|
|
2219
2336
|
ctx.p++;
|
|
2220
2337
|
}
|
|
2221
2338
|
let p = peekTable(
|
|
2339
|
+
ctx,
|
|
2222
2340
|
k,
|
|
2223
2341
|
res,
|
|
2224
2342
|
meta,
|
|
@@ -2226,37 +2344,33 @@ function parse3(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
|
|
|
2226
2344
|
/* Type.EXPLICIT */
|
|
2227
2345
|
);
|
|
2228
2346
|
if (!p) {
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2347
|
+
validateTablePeek(ctx, p, tmp);
|
|
2348
|
+
skipping = true;
|
|
2349
|
+
} else {
|
|
2350
|
+
m = p[2];
|
|
2351
|
+
tbl = p[1];
|
|
2233
2352
|
}
|
|
2234
|
-
m = p[2];
|
|
2235
|
-
tbl = p[1];
|
|
2236
2353
|
} else {
|
|
2237
2354
|
tmp = ctx.p;
|
|
2238
2355
|
let k = parseKey(ctx);
|
|
2239
2356
|
let p = peekTable(
|
|
2357
|
+
ctx,
|
|
2240
2358
|
k,
|
|
2241
2359
|
tbl,
|
|
2242
2360
|
m,
|
|
2243
2361
|
0
|
|
2244
2362
|
/* Type.DOTTED */
|
|
2245
2363
|
);
|
|
2246
|
-
if (!p)
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
p[1][p[0]] = extractValue(ctx, void 0, integersAsBigInt);
|
|
2364
|
+
if (!p && !skipping)
|
|
2365
|
+
validateTablePeek(ctx, p, tmp);
|
|
2366
|
+
skipVoid(ctx, true, true);
|
|
2367
|
+
let v = extractValue(ctx, void 0);
|
|
2368
|
+
if (p && !skipping)
|
|
2369
|
+
p[1][p[0]] = v;
|
|
2253
2370
|
}
|
|
2254
2371
|
skipVoid(ctx, true);
|
|
2255
|
-
if (ctx.p < toml.length && (tmp = toml.charCodeAt(ctx.p)) !== 10 && tmp !== 13) {
|
|
2256
|
-
|
|
2257
|
-
toml,
|
|
2258
|
-
ptr: ctx.p
|
|
2259
|
-
});
|
|
2372
|
+
if (ctx.p < toml.length && (tmp = toml.charCodeAt(ctx.p)) !== 10 && (tmp !== 13 || toml.charCodeAt(ctx.p + 1) !== 10)) {
|
|
2373
|
+
TomlError.x("each key-value declaration must be followed by an end-of-line", ctx);
|
|
2260
2374
|
}
|
|
2261
2375
|
skipVoid(ctx);
|
|
2262
2376
|
}
|
|
@@ -2264,18 +2378,29 @@ function parse3(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
|
|
|
2264
2378
|
}
|
|
2265
2379
|
__name(parse3, "parse");
|
|
2266
2380
|
|
|
2267
|
-
// ../../node_modules/.pnpm/smol-toml@1.
|
|
2381
|
+
// ../../node_modules/.pnpm/smol-toml@1.9.0/node_modules/smol-toml/dist/stringify.js
|
|
2268
2382
|
var BARE_KEY = /^[a-z0-9-_]+$/i;
|
|
2383
|
+
var HAS_WELLFORMED = !!"".isWellFormed;
|
|
2269
2384
|
function extendedTypeOf(obj) {
|
|
2270
2385
|
let type = typeof obj;
|
|
2271
2386
|
if (type === "object") {
|
|
2272
2387
|
if (Array.isArray(obj))
|
|
2273
2388
|
return "array";
|
|
2274
|
-
if (typeof obj
|
|
2389
|
+
if (typeof obj.getUTCDate === "function" && obj instanceof Date)
|
|
2275
2390
|
return "date";
|
|
2276
|
-
if (globalThis.Temporal
|
|
2277
|
-
|
|
2278
|
-
|
|
2391
|
+
if (globalThis.Temporal) {
|
|
2392
|
+
if (obj.until) {
|
|
2393
|
+
if (obj instanceof Temporal.ZonedDateTime)
|
|
2394
|
+
return "temporal/tz+uc";
|
|
2395
|
+
if (obj instanceof Temporal.PlainDateTime || obj instanceof Temporal.PlainDate)
|
|
2396
|
+
return "temporal/uc";
|
|
2397
|
+
if (obj instanceof Temporal.PlainTime || obj instanceof Temporal.Instant)
|
|
2398
|
+
return "temporal";
|
|
2399
|
+
if (obj instanceof Temporal.PlainYearMonth)
|
|
2400
|
+
return "temporal/x";
|
|
2401
|
+
} else if (obj.toPlainDate && obj instanceof Temporal.PlainMonthDay || obj.negated && obj instanceof Temporal.Duration) {
|
|
2402
|
+
return "temporal/x";
|
|
2403
|
+
}
|
|
2279
2404
|
}
|
|
2280
2405
|
}
|
|
2281
2406
|
return type;
|
|
@@ -2289,18 +2414,23 @@ function isArrayOfTables(obj) {
|
|
|
2289
2414
|
return obj.length != 0;
|
|
2290
2415
|
}
|
|
2291
2416
|
__name(isArrayOfTables, "isArrayOfTables");
|
|
2417
|
+
function formatWellFormedStringUnchecked(s) {
|
|
2418
|
+
return JSON.stringify(s).replaceAll("\x7F", "\\u007f");
|
|
2419
|
+
}
|
|
2420
|
+
__name(formatWellFormedStringUnchecked, "formatWellFormedStringUnchecked");
|
|
2292
2421
|
function formatString(s) {
|
|
2293
|
-
return
|
|
2422
|
+
return formatWellFormedStringUnchecked(HAS_WELLFORMED ? s.toWellFormed() : s);
|
|
2294
2423
|
}
|
|
2295
2424
|
__name(formatString, "formatString");
|
|
2296
|
-
function
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2425
|
+
function formatKey(s) {
|
|
2426
|
+
if (BARE_KEY.test(s))
|
|
2427
|
+
return s;
|
|
2428
|
+
if (HAS_WELLFORMED && !s.isWellFormed())
|
|
2429
|
+
throw new RangeError("key contains illegal lone surrogates");
|
|
2430
|
+
return formatWellFormedStringUnchecked(s);
|
|
2431
|
+
}
|
|
2432
|
+
__name(formatKey, "formatKey");
|
|
2433
|
+
function stringifyValue(val, type, depth, numberAsFloat, strictTemporal) {
|
|
2304
2434
|
if (depth === 0) {
|
|
2305
2435
|
throw new Error("Could not stringify the object: maximum object depth exceeded");
|
|
2306
2436
|
}
|
|
@@ -2317,6 +2447,7 @@ function stringifyValue(val, type, depth, numberAsFloat) {
|
|
|
2317
2447
|
return val.toFixed(1);
|
|
2318
2448
|
case "bigint":
|
|
2319
2449
|
case "boolean":
|
|
2450
|
+
case "temporal":
|
|
2320
2451
|
return val.toString();
|
|
2321
2452
|
case "string":
|
|
2322
2453
|
return formatString(val);
|
|
@@ -2325,15 +2456,38 @@ function stringifyValue(val, type, depth, numberAsFloat) {
|
|
|
2325
2456
|
throw new TypeError("cannot serialize invalid date");
|
|
2326
2457
|
return val.toISOString();
|
|
2327
2458
|
case "object":
|
|
2328
|
-
return stringifyInlineTable(val, depth, numberAsFloat);
|
|
2459
|
+
return stringifyInlineTable(val, depth, numberAsFloat, strictTemporal);
|
|
2329
2460
|
case "array":
|
|
2330
|
-
return stringifyArray(val, depth, numberAsFloat);
|
|
2331
|
-
case
|
|
2332
|
-
|
|
2461
|
+
return stringifyArray(val, depth, numberAsFloat, strictTemporal);
|
|
2462
|
+
// @ts-expect-error -- intentional fallthrough case
|
|
2463
|
+
case "temporal/tz+uc":
|
|
2464
|
+
if (strictTemporal) {
|
|
2465
|
+
let tz = val.timeZoneId;
|
|
2466
|
+
let tzc = tz.charCodeAt(0);
|
|
2467
|
+
if (
|
|
2468
|
+
// Classic offset
|
|
2469
|
+
tzc !== 43 && tzc !== 45 && // Fast pre-check pass; see below for the actually accepted values
|
|
2470
|
+
(tzc !== 85 && tzc !== 71 && tzc !== 90 && tzc !== 69 || // UTC and its aliases; Temporal implementations don't all canonicalise unfortunately
|
|
2471
|
+
tz !== "UTC" && tz !== "UCT" && tz !== "Universal" && tz !== "Zulu" && // GMT is a TZ but it's for all intents and purposes equivalent to UTC. Safe to downgrade.
|
|
2472
|
+
!tz.startsWith("GMT") && tz !== "Greenwich" && // Etc/* are all safe to downgrade to offset (either UTC, GMT, or offset)
|
|
2473
|
+
!tz.startsWith("Etc/"))
|
|
2474
|
+
) {
|
|
2475
|
+
throw new TypeError("Temporal objects with an IANA timezone are not allowed in Temporal strict mode");
|
|
2476
|
+
}
|
|
2477
|
+
}
|
|
2478
|
+
case "temporal/uc":
|
|
2479
|
+
if (strictTemporal && val.calendarId !== "iso8601")
|
|
2480
|
+
throw new TypeError("Temporal objects with a non-default calendar are not allowed in Temporal strict mode");
|
|
2481
|
+
return val.toString({
|
|
2482
|
+
calendarName: "never",
|
|
2483
|
+
timeZoneName: "never"
|
|
2484
|
+
});
|
|
2485
|
+
case "temporal/x":
|
|
2486
|
+
throw new TypeError("Unsupported " + val[Symbol.toStringTag]);
|
|
2333
2487
|
}
|
|
2334
2488
|
}
|
|
2335
2489
|
__name(stringifyValue, "stringifyValue");
|
|
2336
|
-
function stringifyInlineTable(obj, depth, numberAsFloat) {
|
|
2490
|
+
function stringifyInlineTable(obj, depth, numberAsFloat, strictTemporal) {
|
|
2337
2491
|
let keys = Object.keys(obj);
|
|
2338
2492
|
if (keys.length === 0)
|
|
2339
2493
|
return "{}";
|
|
@@ -2342,14 +2496,12 @@ function stringifyInlineTable(obj, depth, numberAsFloat) {
|
|
|
2342
2496
|
let k = keys[i];
|
|
2343
2497
|
if (i)
|
|
2344
2498
|
res += ", ";
|
|
2345
|
-
res +=
|
|
2346
|
-
res += " = ";
|
|
2347
|
-
res += stringifyValue(obj[k], extendedTypeOf(obj[k]), depth - 1, numberAsFloat);
|
|
2499
|
+
res += formatKey(k) + " = " + stringifyValue(obj[k], extendedTypeOf(obj[k]), depth - 1, numberAsFloat, strictTemporal);
|
|
2348
2500
|
}
|
|
2349
2501
|
return res + " }";
|
|
2350
2502
|
}
|
|
2351
2503
|
__name(stringifyInlineTable, "stringifyInlineTable");
|
|
2352
|
-
function stringifyArray(array, depth, numberAsFloat) {
|
|
2504
|
+
function stringifyArray(array, depth, numberAsFloat, strictTemporal) {
|
|
2353
2505
|
if (array.length === 0)
|
|
2354
2506
|
return "[]";
|
|
2355
2507
|
let res = "[ ";
|
|
@@ -2359,12 +2511,12 @@ function stringifyArray(array, depth, numberAsFloat) {
|
|
|
2359
2511
|
if (array[i] === null || array[i] === void 0) {
|
|
2360
2512
|
throw new TypeError("arrays cannot contain null or undefined values");
|
|
2361
2513
|
}
|
|
2362
|
-
res += stringifyValue(array[i], extendedTypeOf(array[i]), depth - 1, numberAsFloat);
|
|
2514
|
+
res += stringifyValue(array[i], extendedTypeOf(array[i]), depth - 1, numberAsFloat, strictTemporal);
|
|
2363
2515
|
}
|
|
2364
2516
|
return res + " ]";
|
|
2365
2517
|
}
|
|
2366
2518
|
__name(stringifyArray, "stringifyArray");
|
|
2367
|
-
function stringifyArrayTable(array, key, depth, numberAsFloat) {
|
|
2519
|
+
function stringifyArrayTable(array, key, depth, numberAsFloat, strictTemporal) {
|
|
2368
2520
|
if (depth === 0) {
|
|
2369
2521
|
throw new Error("Could not stringify the object: maximum object depth exceeded");
|
|
2370
2522
|
}
|
|
@@ -2372,12 +2524,12 @@ function stringifyArrayTable(array, key, depth, numberAsFloat) {
|
|
|
2372
2524
|
for (let i = 0; i < array.length; i++) {
|
|
2373
2525
|
res += `${res && "\n"}[[${key}]]
|
|
2374
2526
|
`;
|
|
2375
|
-
res += stringifyTable(0, array[i], key, depth, numberAsFloat);
|
|
2527
|
+
res += stringifyTable(0, array[i], key, depth, numberAsFloat, strictTemporal);
|
|
2376
2528
|
}
|
|
2377
2529
|
return res;
|
|
2378
2530
|
}
|
|
2379
2531
|
__name(stringifyArrayTable, "stringifyArrayTable");
|
|
2380
|
-
function stringifyTable(tableKey, obj, prefix, depth, numberAsFloat) {
|
|
2532
|
+
function stringifyTable(tableKey, obj, prefix, depth, numberAsFloat, strictTemporal) {
|
|
2381
2533
|
if (depth === 0) {
|
|
2382
2534
|
throw new Error("Could not stringify the object: maximum object depth exceeded");
|
|
2383
2535
|
}
|
|
@@ -2391,16 +2543,16 @@ function stringifyTable(tableKey, obj, prefix, depth, numberAsFloat) {
|
|
|
2391
2543
|
if (type === "symbol" || type === "function") {
|
|
2392
2544
|
throw new TypeError(`cannot serialize values of type '${type}'`);
|
|
2393
2545
|
}
|
|
2394
|
-
let key =
|
|
2546
|
+
let key = formatKey(k);
|
|
2395
2547
|
if (type === "array" && isArrayOfTables(obj[k])) {
|
|
2396
|
-
tables += (tables && "\n") + stringifyArrayTable(obj[k], prefix ? `${prefix}.${key}` : key, depth - 1, numberAsFloat);
|
|
2548
|
+
tables += (tables && "\n") + stringifyArrayTable(obj[k], prefix ? `${prefix}.${key}` : key, depth - 1, numberAsFloat, strictTemporal);
|
|
2397
2549
|
} else if (type === "object") {
|
|
2398
2550
|
let tblKey = prefix ? `${prefix}.${key}` : key;
|
|
2399
|
-
tables += (tables && "\n") + stringifyTable(tblKey, obj[k], tblKey, depth - 1, numberAsFloat);
|
|
2551
|
+
tables += (tables && "\n") + stringifyTable(tblKey, obj[k], tblKey, depth - 1, numberAsFloat, strictTemporal);
|
|
2400
2552
|
} else {
|
|
2401
2553
|
preamble += key;
|
|
2402
2554
|
preamble += " = ";
|
|
2403
|
-
preamble += stringifyValue(obj[k], type, depth, numberAsFloat);
|
|
2555
|
+
preamble += stringifyValue(obj[k], type, depth, numberAsFloat, strictTemporal);
|
|
2404
2556
|
preamble += "\n";
|
|
2405
2557
|
}
|
|
2406
2558
|
}
|
|
@@ -2412,20 +2564,17 @@ ${preamble}` : `[${tableKey}]`;
|
|
|
2412
2564
|
${tables}` : preamble || tables;
|
|
2413
2565
|
}
|
|
2414
2566
|
__name(stringifyTable, "stringifyTable");
|
|
2415
|
-
function stringify(obj, { maxDepth = 1e3, numbersAsFloat = false } = {}) {
|
|
2567
|
+
function stringify(obj, { maxDepth = 1e3, numbersAsFloat = false, strictTemporal = false } = {}) {
|
|
2416
2568
|
if (extendedTypeOf(obj) !== "object") {
|
|
2417
2569
|
throw new TypeError("stringify can only be called with an object");
|
|
2418
2570
|
}
|
|
2419
|
-
let str = stringifyTable(0, obj, "", maxDepth, numbersAsFloat);
|
|
2571
|
+
let str = stringifyTable(0, obj, "", maxDepth, numbersAsFloat, strictTemporal);
|
|
2420
2572
|
if (str[str.length - 1] !== "\n")
|
|
2421
2573
|
return str + "\n";
|
|
2422
2574
|
return str;
|
|
2423
2575
|
}
|
|
2424
2576
|
__name(stringify, "stringify");
|
|
2425
2577
|
|
|
2426
|
-
// ../../node_modules/.pnpm/smol-toml@1.8.0/node_modules/smol-toml/dist/index.js
|
|
2427
|
-
var dist_default = { parse: parse3, stringify, TomlDate, TomlError };
|
|
2428
|
-
|
|
2429
2578
|
// src/parse.ts
|
|
2430
2579
|
var ParseError = class extends UserError {
|
|
2431
2580
|
static {
|
|
@@ -2495,7 +2644,7 @@ var APIError = class extends ParseError {
|
|
|
2495
2644
|
};
|
|
2496
2645
|
function parseTOML(tomlContent, filePath) {
|
|
2497
2646
|
try {
|
|
2498
|
-
return
|
|
2647
|
+
return parse3(tomlContent);
|
|
2499
2648
|
} catch (err) {
|
|
2500
2649
|
if (!(err instanceof TomlError)) {
|
|
2501
2650
|
throw err;
|
|
@@ -2944,7 +3093,7 @@ __name(configFileName, "configFileName");
|
|
|
2944
3093
|
function formatConfigSnippet(snippet, configPath, formatted = true) {
|
|
2945
3094
|
const format3 = configFormat(configPath);
|
|
2946
3095
|
if (format3 === "toml") {
|
|
2947
|
-
return
|
|
3096
|
+
return stringify(snippet);
|
|
2948
3097
|
} else {
|
|
2949
3098
|
return formatted ? JSON.stringify(snippet, null, 2) : JSON.stringify(snippet);
|
|
2950
3099
|
}
|
|
@@ -2972,7 +3121,7 @@ var experimental_readRawConfig = /* @__PURE__ */ __name((args, options = {}) =>
|
|
|
2972
3121
|
}, "experimental_readRawConfig");
|
|
2973
3122
|
/*! Bundled license information:
|
|
2974
3123
|
|
|
2975
|
-
smol-toml/dist/
|
|
3124
|
+
smol-toml/dist/error.js:
|
|
2976
3125
|
(*!
|
|
2977
3126
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
2978
3127
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -3001,7 +3150,7 @@ smol-toml/dist/date.js:
|
|
|
3001
3150
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
3002
3151
|
*)
|
|
3003
3152
|
|
|
3004
|
-
smol-toml/dist/
|
|
3153
|
+
smol-toml/dist/primitive.js:
|
|
3005
3154
|
(*!
|
|
3006
3155
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
3007
3156
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -3030,7 +3179,7 @@ smol-toml/dist/error.js:
|
|
|
3030
3179
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
3031
3180
|
*)
|
|
3032
3181
|
|
|
3033
|
-
smol-toml/dist/
|
|
3182
|
+
smol-toml/dist/date.js:
|
|
3034
3183
|
(*!
|
|
3035
3184
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
3036
3185
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -3059,7 +3208,7 @@ smol-toml/dist/util.js:
|
|
|
3059
3208
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
3060
3209
|
*)
|
|
3061
3210
|
|
|
3062
|
-
smol-toml/dist/
|
|
3211
|
+
smol-toml/dist/extract.js:
|
|
3063
3212
|
(*!
|
|
3064
3213
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
3065
3214
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -3088,7 +3237,7 @@ smol-toml/dist/primitive.js:
|
|
|
3088
3237
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
3089
3238
|
*)
|
|
3090
3239
|
|
|
3091
|
-
smol-toml/dist/
|
|
3240
|
+
smol-toml/dist/util.js:
|
|
3092
3241
|
(*!
|
|
3093
3242
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
3094
3243
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -3234,4 +3383,4 @@ smol-toml/dist/index.js:
|
|
|
3234
3383
|
*)
|
|
3235
3384
|
*/
|
|
3236
3385
|
|
|
3237
|
-
export { APIError, ENVIRONMENT_TAG_PREFIX, INHERIT_SYMBOL, JSON_CONFIG_FORMATS, PATH_TO_DEPLOY_CONFIG, ParseError, SERVICE_TAG_PREFIX, applyEdits, configFileName, configFormat, dir,
|
|
3386
|
+
export { APIError, ENVIRONMENT_TAG_PREFIX, INHERIT_SYMBOL, JSON_CONFIG_FORMATS, PATH_TO_DEPLOY_CONFIG, ParseError, SERVICE_TAG_PREFIX, applyEdits, configFileName, configFormat, dir, experimental_readRawConfig, findWranglerConfig, format2 as format, formatConfigSnippet, getContainerDurableObjectClassNames, getContainerNameToClassNameMap, getDurableObjectClassNameToUseSQLiteMap, getDurableObjectContainerApps, getDurableObjectExports, getResolvedDurableObjectContainerApps, hasDurableObjectExports, indexLocation, isDurableObjectContainerApp, isRedirectedConfig, isRedirectedRawConfig, modify, parseByteSize, parseHumanDuration, parseJSON, parseJSONC, parseNonHyphenedUuid, parsePackageJSON, parseTOML, partitionExports, readFileSync, readFileSyncToBuffer, resolveContainerClassName, resolveWranglerConfigPath, searchLocation, stringify, validateDurableObjectContainerApplications };
|