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