@decimalturn/toml-patch 3.2.1-dev → 3.2.1-lite
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/patch.js +20 -0
- package/package.json +6 -11
- package/dist/dev/comment-alignment.js +0 -372
- package/dist/dev/comment-alignment.js.map +0 -1
- package/dist/dev/comment-ownership.js +0 -660
- package/dist/dev/comment-ownership.js.map +0 -1
- package/dist/dev/cst-source.js +0 -118
- package/dist/dev/cst-source.js.map +0 -1
- package/dist/dev/cst.js +0 -68
- package/dist/dev/cst.js.map +0 -1
- package/dist/dev/cursor.js +0 -66
- package/dist/dev/cursor.js.map +0 -1
- package/dist/dev/date-format.js +0 -196
- package/dist/dev/date-format.js.map +0 -1
- package/dist/dev/decode-utf8.js +0 -27
- package/dist/dev/decode-utf8.js.map +0 -1
- package/dist/dev/diff-lite.js +0 -123
- package/dist/dev/diff-lite.js.map +0 -1
- package/dist/dev/diff.js +0 -265
- package/dist/dev/diff.js.map +0 -1
- package/dist/dev/encode-lite.js +0 -193
- package/dist/dev/encode-lite.js.map +0 -1
- package/dist/dev/escape-preference.js +0 -166
- package/dist/dev/escape-preference.js.map +0 -1
- package/dist/dev/find-by-path.js +0 -111
- package/dist/dev/find-by-path.js.map +0 -1
- package/dist/dev/formatter.js +0 -298
- package/dist/dev/formatter.js.map +0 -1
- package/dist/dev/generate.js +0 -465
- package/dist/dev/generate.js.map +0 -1
- package/dist/dev/inline-comma-space.js +0 -13
- package/dist/dev/inline-comma-space.js.map +0 -1
- package/dist/dev/inline-format.js +0 -106
- package/dist/dev/inline-format.js.map +0 -1
- package/dist/dev/inline-layout.js +0 -107
- package/dist/dev/inline-layout.js.map +0 -1
- package/dist/dev/line-ending-backslash.js +0 -320
- package/dist/dev/line-ending-backslash.js.map +0 -1
- package/dist/dev/literal-string.js +0 -46
- package/dist/dev/literal-string.js.map +0 -1
- package/dist/dev/location.js +0 -104
- package/dist/dev/location.js.map +0 -1
- package/dist/dev/parse-error.js +0 -27
- package/dist/dev/parse-error.js.map +0 -1
- package/dist/dev/parse-js.js +0 -150
- package/dist/dev/parse-js.js.map +0 -1
- package/dist/dev/parse-string.js +0 -122
- package/dist/dev/parse-string.js.map +0 -1
- package/dist/dev/parse-toml.js +0 -714
- package/dist/dev/parse-toml.js.map +0 -1
- package/dist/dev/patch-lite.js +0 -4
- package/dist/dev/patch-lite2.js +0 -96
- package/dist/dev/patch-lite2.js.map +0 -1
- package/dist/dev/patch.js +0 -2652
- package/dist/dev/patch.js.map +0 -1
- package/dist/dev/smol-toml-date.js +0 -61
- package/dist/dev/smol-toml-date.js.map +0 -1
- package/dist/dev/to-js.js +0 -303
- package/dist/dev/to-js.js.map +0 -1
- package/dist/dev/to-toml.js +0 -874
- package/dist/dev/to-toml.js.map +0 -1
- package/dist/dev/tokenizer.js +0 -225
- package/dist/dev/tokenizer.js.map +0 -1
- package/dist/dev/toml-document.js +0 -220
- package/dist/dev/toml-document.js.map +0 -1
- package/dist/dev/toml-format.js +0 -528
- package/dist/dev/toml-format.js.map +0 -1
- package/dist/dev/toml-patch.js +0 -94
- package/dist/dev/toml-patch.js.map +0 -1
- package/dist/dev/traverse.js +0 -61
- package/dist/dev/traverse.js.map +0 -1
- package/dist/dev/truncate.js +0 -64
- package/dist/dev/truncate.js.map +0 -1
- package/dist/dev/update-order.js +0 -235
- package/dist/dev/update-order.js.map +0 -1
- package/dist/dev/utils.js +0 -244
- package/dist/dev/utils.js.map +0 -1
- package/dist/dev/writer.js +0 -758
- package/dist/dev/writer.js.map +0 -1
- package/dist/toml-patch.d.ts +0 -547
- /package/dist/{patch-lite.d.ts → patch.d.ts} +0 -0
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
//! @decimalturn/toml-patch v3.2.1 - https://github.com/DecimalTurn/toml-patch - @license: MIT
|
|
2
|
-
import { LocalDate, LocalDateTime, LocalTime, OffsetDateTime } from "./date-format.js";
|
|
3
|
-
|
|
4
|
-
//#region src/smol-toml-date.ts
|
|
5
|
-
/*!
|
|
6
|
-
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
7
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
8
|
-
*
|
|
9
|
-
* Redistribution and use in source and binary forms, with or without
|
|
10
|
-
* modification, are permitted provided that the following conditions are met:
|
|
11
|
-
*
|
|
12
|
-
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
13
|
-
* list of conditions and the following disclaimer.
|
|
14
|
-
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
15
|
-
* this list of conditions and the following disclaimer in the
|
|
16
|
-
* documentation and/or other materials provided with the distribution.
|
|
17
|
-
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
18
|
-
* may be used to endorse or promote products derived from this software without
|
|
19
|
-
* specific prior written permission.
|
|
20
|
-
*
|
|
21
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
22
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
23
|
-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
24
|
-
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
25
|
-
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
26
|
-
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
27
|
-
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
28
|
-
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
29
|
-
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
30
|
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
31
|
-
*/
|
|
32
|
-
/**
|
|
33
|
-
* True when `value` is a smol-toml `TomlDate` instance.
|
|
34
|
-
*
|
|
35
|
-
* Duck-typed rather than `instanceof TomlDate`: the caller's object was parsed
|
|
36
|
-
* by the smol-toml package, whose `TomlDate` is a different class object than
|
|
37
|
-
* this vendored copy, so `instanceof` would never match. The `isDate` /
|
|
38
|
-
* `isTime` / `isDateTime` methods only exist on smol-toml's date class, which
|
|
39
|
-
* is what distinguishes it from toml-patch's own date classes.
|
|
40
|
-
*/
|
|
41
|
-
function isSmolTomlDate(value) {
|
|
42
|
-
return value instanceof Date && typeof value.isDate === "function" && typeof value.isTime === "function" && typeof value.isDateTime === "function";
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Converts a smol-toml `TomlDate` into the equivalent toml-patch date class.
|
|
46
|
-
*
|
|
47
|
-
* smol-toml always renders a zero-fraction time or datetime with a trailing
|
|
48
|
-
* `.000`, while toml-patch omits it. Stripping it gives the canonical form
|
|
49
|
-
* that compares equal to a value parsed from TOML source without a fraction.
|
|
50
|
-
*/
|
|
51
|
-
function smolTomlDateToNative(value) {
|
|
52
|
-
const canonical = value.toISOString().replace(/\.000(?=([Zz]|[+-]\d{2}:\d{2})$|$)/, "");
|
|
53
|
-
if (value.isDate()) return new LocalDate(canonical);
|
|
54
|
-
if (value.isTime()) return new LocalTime(canonical, canonical);
|
|
55
|
-
if (value.isLocal()) return new LocalDateTime(canonical, false);
|
|
56
|
-
return new OffsetDateTime(canonical, false);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
//#endregion
|
|
60
|
-
export { isSmolTomlDate, smolTomlDateToNative };
|
|
61
|
-
//# sourceMappingURL=smol-toml-date.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"smol-toml-date.js","names":[],"sources":["../../src/smol-toml-date.ts"],"sourcesContent":["/*!\n * Copyright (c) Squirrel Chat et al., All rights reserved.\n * SPDX-License-Identifier: BSD-3-Clause\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the copyright holder nor the names of its contributors\n * may be used to endorse or promote products derived from this software without\n * specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n// Vendored from smol-toml (https://github.com/squirrelchat/smol-toml),\n// src/date.ts. Kept in the regular package so values produced by smol-toml's\n// parser can be recognised by type. The lite distribution duck-types these\n// values instead of importing this module, to stay small.\n\nimport { LocalDate, LocalTime, LocalDateTime, OffsetDateTime } from './date-format';\n\ntype Offset = string | null\n\nconst DATE_TIME_RE = /^(\\d{4}-\\d{2}-\\d{2})?[T ]?(?:(\\d{2}):\\d{2}(?::\\d{2}(?:\\.\\d+)?)?)?(Z|[-+]\\d{2}:\\d{2})?$/i\n\nexport class TomlDate extends Date {\n\t#hasDate = false\n\t#hasTime = false\n\t#offset: Offset = null\n\n\tconstructor(date: string | Date) {\n\t\tlet hasDate = true\n\t\tlet hasTime = true\n\t\tlet offset: Offset = 'Z'\n\n\t\tif (typeof date === 'string') {\n\t\t\tconst match = date.match(DATE_TIME_RE)\n\t\t\tif (match) {\n\t\t\t\tif (!match[1]) {\n\t\t\t\t\thasDate = false\n\t\t\t\t\tdate = `0000-01-01T${date}`\n\t\t\t\t}\n\n\t\t\t\thasTime = !!match[2]\n\t\t\t\t// Make sure to use T instead of a space. Breaks in case of extreme values otherwise.\n\t\t\t\tif (hasTime && date[10] === ' ') {\n\t\t\t\t\tdate = date.replace(' ', 'T')\n\t\t\t\t}\n\t\t\t\t// Do not allow rollover hours.\n\t\t\t\tif (match[2] && +match[2] > 23) {\n\t\t\t\t\tdate = ''\n\t\t\t\t} else {\n\t\t\t\t\toffset = match[3] || null\n\t\t\t\t\tdate = date.toUpperCase()\n\t\t\t\t\tif (!offset && hasTime) date += 'Z'\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdate = ''\n\t\t\t}\n\t\t}\n\n\t\tsuper(date)\n\t\tif (!isNaN(this.getTime())) {\n\t\t\tthis.#hasDate = hasDate\n\t\t\tthis.#hasTime = hasTime\n\t\t\tthis.#offset = offset\n\t\t}\n\t}\n\n\tisDateTime() {\n\t\treturn this.#hasDate && this.#hasTime\n\t}\n\n\tisLocal() {\n\t\treturn !this.#hasDate || !this.#hasTime || !this.#offset\n\t}\n\n\tisDate() {\n\t\treturn this.#hasDate && !this.#hasTime\n\t}\n\n\tisTime() {\n\t\treturn this.#hasTime && !this.#hasDate\n\t}\n\n\tisValid() {\n\t\treturn this.#hasDate || this.#hasTime\n\t}\n\n\toverride toISOString() {\n\t\tconst iso = super.toISOString()\n\n\t\t// Local Date\n\t\tif (this.isDate())\n\t\t\treturn iso.slice(0, 10)\n\n\t\t// Local Time\n\t\tif (this.isTime())\n\t\t\treturn iso.slice(11, 23)\n\n\t\t// Local DateTime\n\t\tif (this.#offset === null)\n\t\t\treturn iso.slice(0, -1)\n\n\t\t// Offset DateTime\n\t\tif (this.#offset === 'Z')\n\t\t\treturn iso\n\n\t\t// This part is quite annoying: JS strips the original timezone from the ISO string representation\n\t\t// Instead of using a \"modified\" date and \"Z\", we restore the representation \"as authored\"\n\n\t\tlet offset = (+(this.#offset.slice(1, 3)) * 60) + +(this.#offset.slice(4, 6))\n\t\toffset = this.#offset[0] === '-' ? offset : -offset\n\n\t\tconst offsetDate = new Date(this.getTime() - (offset * 60e3))\n\t\treturn offsetDate.toISOString().slice(0, -1) + this.#offset\n\t}\n\n\tstatic wrapAsOffsetDateTime(jsDate: Date, offset = 'Z') {\n\t\tconst date = new TomlDate(jsDate)\n\t\tdate.#offset = offset\n\t\treturn date\n\t}\n\n\tstatic wrapAsLocalDateTime(jsDate: Date) {\n\t\tconst date = new TomlDate(jsDate)\n\t\tdate.#offset = null\n\t\treturn date\n\t}\n\n\tstatic wrapAsLocalDate(jsDate: Date) {\n\t\tconst date = new TomlDate(jsDate)\n\t\tdate.#hasTime = false\n\t\tdate.#offset = null\n\t\treturn date\n\t}\n\n\tstatic wrapAsLocalTime(jsDate: Date) {\n\t\tconst date = new TomlDate(jsDate)\n\t\tdate.#hasDate = false\n\t\tdate.#offset = null\n\t\treturn date\n\t}\n}\n\n/**\n * True when `value` is a smol-toml `TomlDate` instance.\n *\n * Duck-typed rather than `instanceof TomlDate`: the caller's object was parsed\n * by the smol-toml package, whose `TomlDate` is a different class object than\n * this vendored copy, so `instanceof` would never match. The `isDate` /\n * `isTime` / `isDateTime` methods only exist on smol-toml's date class, which\n * is what distinguishes it from toml-patch's own date classes.\n */\nexport function isSmolTomlDate(value: unknown): value is TomlDate {\n return (\n value instanceof Date &&\n typeof (value as any).isDate === 'function' &&\n typeof (value as any).isTime === 'function' &&\n typeof (value as any).isDateTime === 'function'\n );\n}\n\n/**\n * Converts a smol-toml `TomlDate` into the equivalent toml-patch date class.\n *\n * smol-toml always renders a zero-fraction time or datetime with a trailing\n * `.000`, while toml-patch omits it. Stripping it gives the canonical form\n * that compares equal to a value parsed from TOML source without a fraction.\n */\nexport function smolTomlDateToNative(\n value: TomlDate\n): LocalDate | LocalTime | LocalDateTime | OffsetDateTime {\n const canonical = value.toISOString().replace(/\\.000(?=([Zz]|[+-]\\d{2}:\\d{2})$|$)/, '');\n\n if (value.isDate()) {\n return new LocalDate(canonical);\n }\n if (value.isTime()) {\n return new LocalTime(canonical, canonical);\n }\n if (value.isLocal()) {\n return new LocalDateTime(canonical, false);\n }\n return new OffsetDateTime(canonical, false);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwKA,SAAgB,eAAe,OAAmC;CAChE,OACE,iBAAiB,QACjB,OAAQ,MAAc,WAAW,cACjC,OAAQ,MAAc,WAAW,cACjC,OAAQ,MAAc,eAAe;AAEzC;;;;;;;;AASA,SAAgB,qBACd,OACwD;CACxD,MAAM,YAAY,MAAM,YAAY,CAAC,CAAC,QAAQ,sCAAsC,EAAE;CAEtF,IAAI,MAAM,OAAO,GACf,OAAO,IAAI,UAAU,SAAS;CAEhC,IAAI,MAAM,OAAO,GACf,OAAO,IAAI,UAAU,WAAW,SAAS;CAE3C,IAAI,MAAM,QAAQ,GAChB,OAAO,IAAI,cAAc,WAAW,KAAK;CAE3C,OAAO,IAAI,eAAe,WAAW,KAAK;AAC5C"}
|
package/dist/dev/to-js.js
DELETED
|
@@ -1,303 +0,0 @@
|
|
|
1
|
-
//! @decimalturn/toml-patch v3.2.1 - https://github.com/DecimalTurn/toml-patch - @license: MIT
|
|
2
|
-
import ParseError from "./parse-error.js";
|
|
3
|
-
import { LocalDate, LocalDateTime, LocalTime, OffsetDateTime } from "./date-format.js";
|
|
4
|
-
import { blank, has, isDate, last } from "./utils.js";
|
|
5
|
-
|
|
6
|
-
//#region src/to-js.ts
|
|
7
|
-
function integerFromRaw(raw, mode = "asNeeded") {
|
|
8
|
-
const compact = raw.replace(/_/g, "");
|
|
9
|
-
let normalized = compact;
|
|
10
|
-
if (/^[+-]?0x/i.test(compact) || /^[+-]?0o/i.test(compact) || /^[+-]?0b/i.test(compact)) {
|
|
11
|
-
const sign = compact[0] === "+" || compact[0] === "-" ? compact[0] : "";
|
|
12
|
-
normalized = sign + compact.slice(sign ? 1 : 0).toLowerCase();
|
|
13
|
-
}
|
|
14
|
-
let big;
|
|
15
|
-
try {
|
|
16
|
-
big = BigInt(normalized);
|
|
17
|
-
} catch {
|
|
18
|
-
return Number(compact);
|
|
19
|
-
}
|
|
20
|
-
if (mode === true) return big;
|
|
21
|
-
if (mode === false) return Number(big);
|
|
22
|
-
if (big >= BigInt(Number.MIN_SAFE_INTEGER) && big <= BigInt(Number.MAX_SAFE_INTEGER)) return Number(big);
|
|
23
|
-
return big;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Recursively tracks all nested inline tables within an inline table.
|
|
27
|
-
* This ensures that nested inline tables like { nest = {} } are also tracked as immutable.
|
|
28
|
-
*/
|
|
29
|
-
function trackNestedInlineTables(inlineTable, basePath, inlineTables) {
|
|
30
|
-
for (const item of inlineTable.items) {
|
|
31
|
-
const keyValue = item.item;
|
|
32
|
-
if (keyValue.value.type === "InlineTable") {
|
|
33
|
-
const fullPath = basePath.concat(keyValue.key.value);
|
|
34
|
-
inlineTables.add(encodeKey(fullPath));
|
|
35
|
-
trackNestedInlineTables(keyValue.value, fullPath, inlineTables);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Converts a custom Date subclass value to the corresponding Temporal object.
|
|
41
|
-
* Does NOT check for Temporal availability — callers must guard that.
|
|
42
|
-
*/
|
|
43
|
-
function dateValueToTemporal(value) {
|
|
44
|
-
var _value$constructor, _value$constructor$st, _value$constructor2, _value$constructor3, _value$constructor4, _value$constructor5;
|
|
45
|
-
if (((_value$constructor = value.constructor) === null || _value$constructor === void 0 || (_value$constructor = _value$constructor.name) === null || _value$constructor === void 0 || (_value$constructor$st = _value$constructor.startsWith) === null || _value$constructor$st === void 0 ? void 0 : _value$constructor$st.call(_value$constructor, "Temporal.")) || ((_value$constructor2 = value.constructor) === null || _value$constructor2 === void 0 ? void 0 : _value$constructor2.name) === "PlainDate" || ((_value$constructor3 = value.constructor) === null || _value$constructor3 === void 0 ? void 0 : _value$constructor3.name) === "PlainTime" || ((_value$constructor4 = value.constructor) === null || _value$constructor4 === void 0 ? void 0 : _value$constructor4.name) === "PlainDateTime" || ((_value$constructor5 = value.constructor) === null || _value$constructor5 === void 0 ? void 0 : _value$constructor5.name) === "ZonedDateTime") return value;
|
|
46
|
-
const T = globalThis.Temporal;
|
|
47
|
-
if (value instanceof LocalDate) return T.PlainDate.from(value.toISOString());
|
|
48
|
-
if (value instanceof LocalTime) return T.PlainTime.from(value.toISOString());
|
|
49
|
-
if (value instanceof LocalDateTime) return T.PlainDateTime.from(value.toISOString().replace(" ", "T"));
|
|
50
|
-
if (value instanceof OffsetDateTime) {
|
|
51
|
-
const iso = value.toISOString().replace(" ", "T");
|
|
52
|
-
const offsetMatch = iso.match(/([+-]\d{2}:\d{2}|Z)$/);
|
|
53
|
-
const offset = offsetMatch ? offsetMatch[1] : "Z";
|
|
54
|
-
const plainIso = iso.replace(/([+-]\d{2}:\d{2}|Z)$/, "");
|
|
55
|
-
const tz = offset === "Z" ? "+00:00" : offset;
|
|
56
|
-
return T.ZonedDateTime.from(`${plainIso}${offset}[${tz}]`);
|
|
57
|
-
}
|
|
58
|
-
return T.PlainDateTime.from(value.toISOString().replace("Z", ""));
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Converts the given CST to a JavaScript object.
|
|
62
|
-
*
|
|
63
|
-
* @param cst The Concrete Syntax Tree to convert.
|
|
64
|
-
* @param input The original input string (used for error reporting).
|
|
65
|
-
* @param opts.integersAsBigInt Controls integer representation.
|
|
66
|
-
* @param opts.temporal When true, date/time values are returned as Temporal objects.
|
|
67
|
-
* @returns The JavaScript object representation of the CST.
|
|
68
|
-
*/
|
|
69
|
-
function toJS(cst, input = "", opts = {}) {
|
|
70
|
-
const { integersAsBigInt = "asNeeded", temporal = false } = opts;
|
|
71
|
-
const result = blank();
|
|
72
|
-
const tables = /* @__PURE__ */ new Set();
|
|
73
|
-
const table_arrays = /* @__PURE__ */ new Set();
|
|
74
|
-
const defined = /* @__PURE__ */ new Set();
|
|
75
|
-
const implicit_tables = /* @__PURE__ */ new Set();
|
|
76
|
-
const inline_tables = /* @__PURE__ */ new Set();
|
|
77
|
-
let active = result;
|
|
78
|
-
let active_path = [];
|
|
79
|
-
const state = {
|
|
80
|
-
tables,
|
|
81
|
-
table_arrays,
|
|
82
|
-
defined,
|
|
83
|
-
implicit_tables,
|
|
84
|
-
inline_tables
|
|
85
|
-
};
|
|
86
|
-
for (const block of cst) switch (block.type) {
|
|
87
|
-
case "Table":
|
|
88
|
-
handleTable(block);
|
|
89
|
-
for (const item of block.items) if (item.type === "KeyValue") handleKeyValue(item);
|
|
90
|
-
break;
|
|
91
|
-
case "TableArray":
|
|
92
|
-
handleTableArray(block);
|
|
93
|
-
for (const item of block.items) if (item.type === "KeyValue") handleKeyValue(item);
|
|
94
|
-
break;
|
|
95
|
-
case "KeyValue": handleKeyValue(block);
|
|
96
|
-
}
|
|
97
|
-
return result;
|
|
98
|
-
function handleTable(node) {
|
|
99
|
-
const key = node.key.item.value;
|
|
100
|
-
try {
|
|
101
|
-
validateKey(result, [], key, node.type, state);
|
|
102
|
-
} catch (err) {
|
|
103
|
-
const e = err;
|
|
104
|
-
throw new ParseError(input, node.key.loc.start, e.message);
|
|
105
|
-
}
|
|
106
|
-
const joined_key = encodeKey(key);
|
|
107
|
-
tables.add(joined_key);
|
|
108
|
-
defined.add(joined_key);
|
|
109
|
-
active = ensureTable(result, key);
|
|
110
|
-
active_path = key;
|
|
111
|
-
}
|
|
112
|
-
function handleTableArray(node) {
|
|
113
|
-
const key = node.key.item.value;
|
|
114
|
-
try {
|
|
115
|
-
validateKey(result, [], key, node.type, state);
|
|
116
|
-
} catch (err) {
|
|
117
|
-
const e = err;
|
|
118
|
-
throw new ParseError(input, node.key.loc.start, e.message);
|
|
119
|
-
}
|
|
120
|
-
const joined_key = encodeKey(key);
|
|
121
|
-
table_arrays.add(joined_key);
|
|
122
|
-
defined.add(joined_key);
|
|
123
|
-
active = ensureTableArray(result, key);
|
|
124
|
-
active_path = key;
|
|
125
|
-
}
|
|
126
|
-
function handleKeyValue(node) {
|
|
127
|
-
const key = node.key.value;
|
|
128
|
-
try {
|
|
129
|
-
validateKey(active, active_path, key, node.type, state);
|
|
130
|
-
} catch (err) {
|
|
131
|
-
const e = err;
|
|
132
|
-
throw new ParseError(input, node.key.loc.start, e.message);
|
|
133
|
-
}
|
|
134
|
-
if (key.length > 1) for (let i = 1; i < key.length; i++) {
|
|
135
|
-
const implicit = encodeKey(active_path.concat(key.slice(0, i)));
|
|
136
|
-
implicit_tables.add(implicit);
|
|
137
|
-
defined.add(implicit);
|
|
138
|
-
}
|
|
139
|
-
let value;
|
|
140
|
-
try {
|
|
141
|
-
value = toValue(node.value, {
|
|
142
|
-
integersAsBigInt,
|
|
143
|
-
temporal
|
|
144
|
-
});
|
|
145
|
-
} catch (err) {
|
|
146
|
-
const e = err;
|
|
147
|
-
throw new ParseError(input, node.value.loc.start, e.message);
|
|
148
|
-
}
|
|
149
|
-
if (node.value.type === "InlineTable") {
|
|
150
|
-
const base_path = active_path.concat(key);
|
|
151
|
-
inline_tables.add(encodeKey(base_path));
|
|
152
|
-
trackNestedInlineTables(node.value, base_path, inline_tables);
|
|
153
|
-
}
|
|
154
|
-
const target = key.length > 1 ? ensureTable(active, key.slice(0, -1)) : active;
|
|
155
|
-
target[last(key)] = value;
|
|
156
|
-
defined.add(encodeKey(active_path.concat(key)));
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Converts a TOML CST value node to a JavaScript value.
|
|
161
|
-
* @param node The TOML CST value node.
|
|
162
|
-
* @param opts Options object:
|
|
163
|
-
* @param opts.integersAsBigInt Controls integer representation (`'asNeeded'` | `true` | `false`).
|
|
164
|
-
* @param opts.temporal When `true`, date/time values are returned as Temporal objects
|
|
165
|
-
* @returns The corresponding JavaScript value.
|
|
166
|
-
*/
|
|
167
|
-
function toValue(node, opts = {}) {
|
|
168
|
-
const { integersAsBigInt = "asNeeded", temporal = false } = opts;
|
|
169
|
-
switch (node.type) {
|
|
170
|
-
case "InlineTable":
|
|
171
|
-
const result = blank();
|
|
172
|
-
const defined_keys = /* @__PURE__ */ new Set();
|
|
173
|
-
const defined_prefixes = /* @__PURE__ */ new Map();
|
|
174
|
-
node.items.forEach(({ item }) => {
|
|
175
|
-
const key = item.key.value;
|
|
176
|
-
const value = toValue(item.value, {
|
|
177
|
-
integersAsBigInt,
|
|
178
|
-
temporal
|
|
179
|
-
});
|
|
180
|
-
const full_key = joinKey(key);
|
|
181
|
-
const encoded_key = encodeKey(key);
|
|
182
|
-
if (defined_keys.has(encoded_key)) throw new Error(`Duplicate key "${full_key}" in inline table`);
|
|
183
|
-
for (let i = 1; i < key.length; i++) {
|
|
184
|
-
const prefix = joinKey(key.slice(0, i));
|
|
185
|
-
if (defined_keys.has(encodeKey(key.slice(0, i)))) throw new Error(`Key "${full_key}" conflicts with key: "${prefix}"`);
|
|
186
|
-
}
|
|
187
|
-
if (defined_prefixes.has(encoded_key)) {
|
|
188
|
-
const existing = defined_prefixes.get(encoded_key);
|
|
189
|
-
throw new Error(`Key "${full_key}" conflicts with key: "${existing}"`);
|
|
190
|
-
}
|
|
191
|
-
defined_keys.add(encoded_key);
|
|
192
|
-
for (let i = 1; i < key.length; i++) {
|
|
193
|
-
const encoded_prefix = encodeKey(key.slice(0, i));
|
|
194
|
-
if (!defined_prefixes.has(encoded_prefix)) defined_prefixes.set(encoded_prefix, full_key);
|
|
195
|
-
}
|
|
196
|
-
const target = key.length > 1 ? ensureTable(result, key.slice(0, -1)) : result;
|
|
197
|
-
target[last(key)] = value;
|
|
198
|
-
});
|
|
199
|
-
return result;
|
|
200
|
-
case "InlineArray": return node.items.map((item) => toValue(item.item, {
|
|
201
|
-
integersAsBigInt,
|
|
202
|
-
temporal
|
|
203
|
-
}));
|
|
204
|
-
case "DateTime":
|
|
205
|
-
if (temporal) {
|
|
206
|
-
if (typeof globalThis.Temporal === "undefined") throw new Error("Temporal API is not available in this runtime. Set temporal: false or use a runtime with Temporal support.");
|
|
207
|
-
return dateValueToTemporal(node.value);
|
|
208
|
-
}
|
|
209
|
-
return node.value;
|
|
210
|
-
case "String": return node.value;
|
|
211
|
-
case "Integer": return integerFromRaw(node.raw, integersAsBigInt);
|
|
212
|
-
case "Float":
|
|
213
|
-
case "Boolean": return node.value;
|
|
214
|
-
default: throw new Error(`Unrecognized value type "${node.type}"`);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
function validateKey(object, prefix, key, type, state) {
|
|
218
|
-
const parts = prefix.length > 0 ? [...prefix] : [];
|
|
219
|
-
const candidates = new Array(key.length);
|
|
220
|
-
const encoded = new Array(key.length);
|
|
221
|
-
for (let i = 0; i < key.length; i++) {
|
|
222
|
-
parts.push(key[i]);
|
|
223
|
-
candidates[i] = joinKey(parts);
|
|
224
|
-
encoded[i] = encodeKey(parts);
|
|
225
|
-
}
|
|
226
|
-
const joined_full_key = candidates[key.length - 1];
|
|
227
|
-
const encoded_full_key = encoded[key.length - 1];
|
|
228
|
-
if (type === "KeyValue" && key.length > 1) for (let i = 1; i < key.length; i++) {
|
|
229
|
-
const candidate = candidates[i - 1];
|
|
230
|
-
if (state.inline_tables.has(encoded[i - 1])) throw new Error(`Cannot extend inline table at ${candidate}`);
|
|
231
|
-
}
|
|
232
|
-
if ((type === "Table" || type === "TableArray") && state.inline_tables.has(encoded_full_key)) throw new Error(`Cannot extend inline table at ${joined_full_key}`);
|
|
233
|
-
if (type === "Table" || type === "TableArray") for (let i = 1; i < key.length; i++) {
|
|
234
|
-
const candidate = candidates[i - 1];
|
|
235
|
-
if (state.inline_tables.has(encoded[i - 1])) throw new Error(`Cannot extend inline table at ${candidate}`);
|
|
236
|
-
}
|
|
237
|
-
if (type === "KeyValue" && key.length > 1) for (let i = 1; i < key.length; i++) {
|
|
238
|
-
const candidate = candidates[i - 1];
|
|
239
|
-
if (state.table_arrays.has(encoded[i - 1])) throw new Error(`Cannot traverse Array of Tables at ${candidate}`);
|
|
240
|
-
}
|
|
241
|
-
if ((type === "Table" || type === "TableArray") && state.implicit_tables.has(encoded_full_key)) throw new Error(`Implicit table already defined: ${joined_full_key}`);
|
|
242
|
-
if (type === "KeyValue" && state.implicit_tables.has(encoded_full_key)) throw new Error(`Table already defined: ${joined_full_key}`);
|
|
243
|
-
if (type === "KeyValue" && key.length > 1) for (let i = 1; i <= key.length; i++) {
|
|
244
|
-
const candidate = candidates[i - 1];
|
|
245
|
-
if (state.tables.has(encoded[i - 1])) throw new Error(`Cannot extend explicit table ${candidate} with dotted keys`);
|
|
246
|
-
}
|
|
247
|
-
let index = 0;
|
|
248
|
-
for (const part of key) {
|
|
249
|
-
if (!has(object, part)) return;
|
|
250
|
-
if (isPrimitive(object[part])) throw new Error(`Value already defined for ${candidates[index]}`);
|
|
251
|
-
const joined_parts = candidates[index];
|
|
252
|
-
if (Array.isArray(object[part]) && !state.table_arrays.has(encoded[index])) throw new Error(`Cannot add to static array at ${joined_parts}`);
|
|
253
|
-
const next_is_last = index++ < key.length - 1;
|
|
254
|
-
object = Array.isArray(object[part]) && next_is_last ? last(object[part]) : object[part];
|
|
255
|
-
}
|
|
256
|
-
const joined_key = joined_full_key;
|
|
257
|
-
if (object && type === "Table" && state.defined.has(encoded_full_key)) throw new Error(`Table already defined: ${joined_key}`);
|
|
258
|
-
if (object && type === "KeyValue" && key.length === 1 && state.defined.has(encoded_full_key)) {
|
|
259
|
-
if (!isPrimitive(object)) throw new Error(`Table already defined: ${joined_key}`);
|
|
260
|
-
}
|
|
261
|
-
if (object && type === "TableArray" && !state.table_arrays.has(encoded_full_key)) throw new Error(`Cannot add Array of Tables to table at ${joined_key}`);
|
|
262
|
-
}
|
|
263
|
-
function ensureTable(object, key) {
|
|
264
|
-
const target = ensure(object, key.slice(0, -1));
|
|
265
|
-
const last_key = last(key);
|
|
266
|
-
if (!target[last_key]) target[last_key] = blank();
|
|
267
|
-
return target[last_key];
|
|
268
|
-
}
|
|
269
|
-
function ensureTableArray(object, key) {
|
|
270
|
-
const target = ensure(object, key.slice(0, -1));
|
|
271
|
-
const last_key = last(key);
|
|
272
|
-
if (!target[last_key]) target[last_key] = [];
|
|
273
|
-
const next = blank();
|
|
274
|
-
target[last(key)].push(next);
|
|
275
|
-
return next;
|
|
276
|
-
}
|
|
277
|
-
function ensure(object, keys) {
|
|
278
|
-
return keys.reduce((active, subkey) => {
|
|
279
|
-
if (!active[subkey]) active[subkey] = blank();
|
|
280
|
-
return Array.isArray(active[subkey]) ? last(active[subkey]) : active[subkey];
|
|
281
|
-
}, object);
|
|
282
|
-
}
|
|
283
|
-
function isPrimitive(value) {
|
|
284
|
-
return typeof value !== "object" && !isDate(value);
|
|
285
|
-
}
|
|
286
|
-
function joinKey(key) {
|
|
287
|
-
return key.join(".");
|
|
288
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
* Unambiguous encoding of a key path for use as a `Set`/`Map` key.
|
|
291
|
-
*
|
|
292
|
-
* A plain `key.join('.')` collides for distinct key paths: `["", ""]` (an
|
|
293
|
-
* empty-string key nested in an empty-string table) and the single literal
|
|
294
|
-
* segment `["."]` both join to `.`, so a nested empty-key inline table is
|
|
295
|
-
* wrongly rejected when a `["."]` table header follows (fuzz seed 65682).
|
|
296
|
-
*/
|
|
297
|
-
function encodeKey(key) {
|
|
298
|
-
return JSON.stringify(key);
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
//#endregion
|
|
302
|
-
export { toJS as default, toValue };
|
|
303
|
-
//# sourceMappingURL=to-js.js.map
|
package/dist/dev/to-js.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"to-js.js","names":[],"sources":["../../src/to-js.ts"],"sourcesContent":["import { Value, NodeType, TreeNode, CST, InlineTable, Table, TableArray, KeyValue } from './cst';\nimport { last, blank, isDate, has } from './utils';\nimport ParseError from './parse-error';\nimport { IntegersAsBigInt } from './parse-options';\nimport { LocalDate, LocalTime, LocalDateTime, OffsetDateTime } from './date-format';\n\nfunction integerFromRaw(raw: string, mode: IntegersAsBigInt = 'asNeeded'): number | bigint {\n const compact = raw.replace(/_/g, '');\n let normalized = compact;\n\n if (/^[+-]?0x/i.test(compact) || /^[+-]?0o/i.test(compact) || /^[+-]?0b/i.test(compact)) {\n const sign = compact[0] === '+' || compact[0] === '-' ? compact[0] : '';\n const body = compact.slice(sign ? 1 : 0);\n normalized = sign + body.toLowerCase();\n }\n\n let big: bigint | undefined;\n try {\n big = BigInt(normalized);\n } catch {\n // Some integer-valued JS numbers can be stringified in scientific notation\n // (e.g. \"5e+22\"). BigInt cannot parse that syntax, so preserve behavior\n // by coercing back to Number instead of throwing.\n return Number(compact);\n }\n\n if (mode === true) {\n return big;\n }\n if (mode === false) {\n return Number(big);\n }\n // 'asNeeded': return number when safe, bigint otherwise\n if (big >= BigInt(Number.MIN_SAFE_INTEGER) && big <= BigInt(Number.MAX_SAFE_INTEGER)) {\n return Number(big);\n }\n return big;\n}\n\n/**\n * Recursively tracks all nested inline tables within an inline table.\n * This ensures that nested inline tables like { nest = {} } are also tracked as immutable.\n */\nfunction trackNestedInlineTables(inlineTable: InlineTable, basePath: string[], inlineTables: Set<string>) {\n for (const item of inlineTable.items) {\n const keyValue = item.item;\n \n if (keyValue.value.type === NodeType.InlineTable) {\n // Only allocate concat array when we actually have a nested inline table\n const fullPath = basePath.concat(keyValue.key.value);\n inlineTables.add(encodeKey(fullPath));\n // Recursively track nested inline tables\n trackNestedInlineTables(keyValue.value, fullPath, inlineTables);\n }\n }\n}\n\n/**\n * Converts a custom Date subclass value to the corresponding Temporal object.\n * Does NOT check for Temporal availability — callers must guard that.\n */\nfunction dateValueToTemporal(value: Date): any {\n // If the value is already a Temporal object (e.g. from a CST generated by\n // parseJS with Temporal input), return it directly — no conversion needed.\n if (value.constructor?.name?.startsWith?.('Temporal.') ||\n value.constructor?.name === 'PlainDate' ||\n value.constructor?.name === 'PlainTime' ||\n value.constructor?.name === 'PlainDateTime' ||\n value.constructor?.name === 'ZonedDateTime') {\n return value;\n }\n\n const T = (globalThis as any).Temporal;\n // LocalDate → Temporal.PlainDate\n if (value instanceof LocalDate) {\n return T.PlainDate.from(value.toISOString());\n }\n // LocalTime → Temporal.PlainTime\n if (value instanceof LocalTime) {\n return T.PlainTime.from(value.toISOString());\n }\n // LocalDateTime → Temporal.PlainDateTime\n if (value instanceof LocalDateTime) {\n // toISOString() uses a space separator when the original TOML did\n // (useSpaceSeparator flag). Temporal.from() requires T.\n return T.PlainDateTime.from(value.toISOString().replace(' ', 'T'));\n }\n // OffsetDateTime → Temporal.ZonedDateTime\n if (value instanceof OffsetDateTime) {\n // Same: toISOString() uses a space separator when the original TOML did.\n // Normalize to T before extracting the offset and calling .from().\n const iso = value.toISOString().replace(' ', 'T');\n const offsetMatch = iso.match(/([+-]\\d{2}:\\d{2}|Z)$/);\n const offset = offsetMatch ? offsetMatch[1] : 'Z';\n const plainIso = iso.replace(/([+-]\\d{2}:\\d{2}|Z)$/, '');\n const tz = offset === 'Z' ? '+00:00' : offset;\n return T.ZonedDateTime.from(`${plainIso}${offset}[${tz}]`);\n }\n // Fallback: native Date or unrecognized Date subclass → Temporal.PlainDateTime\n return T.PlainDateTime.from(value.toISOString().replace('Z', ''));\n}\n\n/**\n * Converts the given CST to a JavaScript object.\n * \n * @param cst The Concrete Syntax Tree to convert.\n * @param input The original input string (used for error reporting).\n * @param opts.integersAsBigInt Controls integer representation.\n * @param opts.temporal When true, date/time values are returned as Temporal objects.\n * @returns The JavaScript object representation of the CST.\n */\nexport default function toJS(\n cst: CST,\n input: string = '',\n opts: { integersAsBigInt?: IntegersAsBigInt; temporal?: boolean } = {}\n): any {\n const { integersAsBigInt = 'asNeeded', temporal = false } = opts;\n const result = blank();\n const tables: Set<string> = new Set();\n const table_arrays: Set<string> = new Set();\n const defined: Set<string> = new Set();\n const implicit_tables: Set<string> = new Set();\n const inline_tables: Set<string> = new Set();\n let active: any = result;\n let active_path: string[] = [];\n\n const state = { tables, table_arrays, defined, implicit_tables, inline_tables };\n\n // Specialized inline walk — only visits Table, TableArray, and KeyValue.\n // Skips Comment, Key, Value sub-nodes entirely (toValue handles InlineTable/\n // InlineArray recursively). This avoids the overhead of the generic traverse\n // dispatching through every CST node.\n for (const block of cst) {\n switch (block.type) {\n case NodeType.Table:\n handleTable(block as Table);\n for (const item of (block as Table).items) {\n if (item.type === NodeType.KeyValue) handleKeyValue(item as KeyValue);\n }\n break;\n\n case NodeType.TableArray:\n handleTableArray(block as TableArray);\n for (const item of (block as TableArray).items) {\n if (item.type === NodeType.KeyValue) handleKeyValue(item as KeyValue);\n }\n break;\n\n case NodeType.KeyValue:\n handleKeyValue(block as KeyValue);\n break;\n\n // Skip Comments\n }\n }\n\n return result;\n\n function handleTable(node: Table) {\n const key = node.key.item.value;\n try {\n validateKey(result, [], key, node.type, state);\n } catch (err) {\n const e = err as Error;\n throw new ParseError(input, node.key.loc.start, e.message);\n }\n\n const joined_key = encodeKey(key);\n tables.add(joined_key);\n defined.add(joined_key);\n\n active = ensureTable(result, key);\n active_path = key;\n }\n\n function handleTableArray(node: TableArray) {\n const key = node.key.item.value;\n\n try {\n validateKey(result, [], key, node.type, state);\n } catch (err) {\n const e = err as Error;\n throw new ParseError(input, node.key.loc.start, e.message);\n }\n\n const joined_key = encodeKey(key);\n table_arrays.add(joined_key);\n defined.add(joined_key);\n\n active = ensureTableArray(result, key);\n active_path = key;\n }\n\n function handleKeyValue(node: KeyValue) {\n const key = node.key.value;\n try {\n validateKey(active, active_path, key, node.type, state);\n } catch (err) {\n const e = err as Error;\n throw new ParseError(input, node.key.loc.start, e.message);\n }\n\n // Track implicit tables created by dotted keys.\n if (key.length > 1) {\n for (let i = 1; i < key.length; i++) {\n const implicit = encodeKey(active_path.concat(key.slice(0, i)));\n implicit_tables.add(implicit);\n defined.add(implicit);\n }\n }\n\n let value;\n try {\n value = toValue(node.value, { integersAsBigInt, temporal });\n } catch (err) {\n const e = err as Error;\n throw new ParseError(input, node.value.loc.start, e.message);\n }\n \n // Inline tables are immutable in TOML\n if (node.value.type === NodeType.InlineTable) {\n const base_path = active_path.concat(key);\n inline_tables.add(encodeKey(base_path));\n trackNestedInlineTables(node.value, base_path, inline_tables);\n }\n const target = key.length > 1 ? ensureTable(active, key.slice(0, -1)) : active;\n\n target[last(key)!] = value;\n defined.add(encodeKey(active_path.concat(key)));\n }\n}\n\n/**\n * Converts a TOML CST value node to a JavaScript value.\n * @param node The TOML CST value node.\n * @param opts Options object:\n * @param opts.integersAsBigInt Controls integer representation (`'asNeeded'` | `true` | `false`).\n * @param opts.temporal When `true`, date/time values are returned as Temporal objects\n * @returns The corresponding JavaScript value.\n */\nexport function toValue(\n node: Value,\n opts: { integersAsBigInt?: IntegersAsBigInt; temporal?: boolean } = {}\n): any {\n const { integersAsBigInt = 'asNeeded', temporal = false } = opts;\n switch (node.type) {\n case NodeType.InlineTable:\n const result = blank();\n const defined_keys = new Set<string>();\n const defined_prefixes = new Map<string, string>(); // prefix -> one of the full keys that uses it\n\n node.items.forEach(({ item }) => {\n const key = item.key.value;\n const value = toValue(item.value, { integersAsBigInt, temporal });\n\n // Check for duplicate keys and conflicting key paths. Set lookups use\n // the unambiguous encodeKey form; messages use the `.`-joined display.\n const full_key = joinKey(key);\n const encoded_key = encodeKey(key);\n\n // Check if this exact key was already defined\n if (defined_keys.has(encoded_key)) {\n throw new Error(`Duplicate key \"${full_key}\" in inline table`);\n }\n \n // Check if any prefix of this key conflicts with an existing key\n // e.g., if \"a.b\" is defined, we can't later define \"a.b.c\" (would overwrite the value)\n for (let i = 1; i < key.length; i++) {\n const prefix = joinKey(key.slice(0, i));\n if (defined_keys.has(encodeKey(key.slice(0, i)))) {\n throw new Error(`Key \"${full_key}\" conflicts with key: \"${prefix}\"`);\n }\n }\n \n // Check if this key is a prefix of an already defined key\n // e.g., if \"a.b.c\" is defined, we can't later define \"a.b\" (would overwrite the table)\n if (defined_prefixes.has(encoded_key)) {\n const existing = defined_prefixes.get(encoded_key)!;\n throw new Error(`Key \"${full_key}\" conflicts with key: \"${existing}\"`);\n }\n \n defined_keys.add(encoded_key);\n \n // Track all prefixes of this key\n for (let i = 1; i < key.length; i++) {\n const encoded_prefix = encodeKey(key.slice(0, i));\n if (!defined_prefixes.has(encoded_prefix)) {\n defined_prefixes.set(encoded_prefix, full_key);\n }\n }\n\n const target = key.length > 1 ? ensureTable(result, key.slice(0, -1)) : result;\n target[last(key)!] = value;\n });\n\n return result;\n\n case NodeType.InlineArray:\n return node.items.map(item => toValue(item.item as Value, { integersAsBigInt, temporal }));\n\n case NodeType.DateTime:\n if (temporal) {\n if (typeof (globalThis as any).Temporal === 'undefined') {\n throw new Error(\n 'Temporal API is not available in this runtime. ' +\n 'Set temporal: false or use a runtime with Temporal support.'\n );\n }\n return dateValueToTemporal(node.value);\n }\n // Preserve TOML date/time custom classes so format is retained when\n // round-tripping through stringify() (e.g. date-only, time-only, local vs offset).\n // These classes extend Date, so JS users can still treat them as Dates.\n return node.value;\n\n case NodeType.String:\n return node.value;\n\n case NodeType.Integer:\n return integerFromRaw(node.raw, integersAsBigInt);\n\n case NodeType.Float:\n case NodeType.Boolean:\n return node.value;\n\n default:\n throw new Error(`Unrecognized value type \"${(node as TreeNode).type}\"`);\n }\n}\n\nfunction validateKey(\n object: any,\n prefix: string[],\n key: string[],\n type: NodeType.Table | NodeType.TableArray | NodeType.KeyValue,\n state: {\n tables: Set<string>;\n table_arrays: Set<string>;\n defined: Set<string>;\n implicit_tables: Set<string>;\n inline_tables: Set<string>;\n }\n) {\n // Pre-compute candidate key strings incrementally to avoid repeated\n // prefix.concat(key.slice(0, i)) + join allocations. Two representations\n // are kept side by side: `candidates` is the human-readable `.`-joined path\n // used in error messages, while `encoded` is the unambiguous encodeKey form\n // used for the state sets below (a joined path collides for distinct keys —\n // fuzz seed 65682).\n // The accumulation must be structural, not string-truthiness based: an\n // empty-string key segment (e.g. the first segment of `\"\"`.lt = …) makes\n // the accumulated string '' and would silently drop the segment — then\n // lookups like state.table_arrays (registered with joinKey) miss and\n // valid AOT sub-table headers are rejected (fuzz seed 103).\n const parts: string[] = prefix.length > 0 ? [...prefix] : [];\n const candidates: string[] = new Array(key.length);\n const encoded: string[] = new Array(key.length);\n for (let i = 0; i < key.length; i++) {\n parts.push(key[i]);\n candidates[i] = joinKey(parts);\n encoded[i] = encodeKey(parts);\n }\n const joined_full_key = candidates[key.length - 1];\n const encoded_full_key = encoded[key.length - 1];\n\n // 0. Inline tables are immutable.\n // Once a key is assigned an inline table, it cannot be extended by dotted keys or table headers.\n // (toml-test invalid: spec-1.1.0/common-49-0, inline-table/overwrite-02, inline-table/overwrite-05)\n if (type === NodeType.KeyValue && key.length > 1) {\n for (let i = 1; i < key.length; i++) {\n const candidate = candidates[i - 1];\n if (state.inline_tables.has(encoded[i - 1])) {\n throw new Error(`Cannot extend inline table at ${candidate}`);\n }\n }\n }\n \n // Also check if a table header tries to extend an inline table\n if ((type === NodeType.Table || type === NodeType.TableArray) && state.inline_tables.has(encoded_full_key)) {\n throw new Error(`Cannot extend inline table at ${joined_full_key}`);\n }\n \n // Check if table header path contains an inline table\n if (type === NodeType.Table || type === NodeType.TableArray) {\n for (let i = 1; i < key.length; i++) {\n const candidate = candidates[i - 1];\n if (state.inline_tables.has(encoded[i - 1])) {\n throw new Error(`Cannot extend inline table at ${candidate}`);\n }\n }\n }\n\n // 0a. Dotted key-value assignments cannot traverse into an Array of Tables.\n // This would be ambiguous (which element?) and is rejected by toml-test's\n // append-with-dotted-keys fixtures.\n if (type === NodeType.KeyValue && key.length > 1) {\n for (let i = 1; i < key.length; i++) {\n const candidate = candidates[i - 1];\n if (state.table_arrays.has(encoded[i - 1])) {\n throw new Error(`Cannot traverse Array of Tables at ${candidate}`);\n }\n }\n }\n\n // 0b. Tables created implicitly by dotted keys cannot be re-opened via table headers.\n // (toml-test invalid: spec-1.1.0/common-46-0 and common-46-1)\n if ((type === NodeType.Table || type === NodeType.TableArray) && state.implicit_tables.has(encoded_full_key)) {\n throw new Error(`Implicit table already defined: ${joined_full_key}`);\n }\n\n // 0c. A table path cannot later be re-assigned as a value.\n // Example: `type.name = \"Nail\"` then `type = { edible = false }` is invalid.\n // Example: `a.b.c = 1` then `a.b = 2` is invalid (a.b was implicitly created as a table).\n // (toml-test invalid: spec-1.1.0/common-50-0, table/append-with-dotted-keys-05)\n if (type === NodeType.KeyValue && state.implicit_tables.has(encoded_full_key)) {\n throw new Error(`Table already defined: ${joined_full_key}`);\n }\n\n // 0d. Dotted keys cannot extend tables that were explicitly defined earlier.\n // Example: `[a.b.c]` followed by `[a]` then `b.c.t = \"value\"` is invalid.\n // (toml-test invalid: table/append-with-dotted-keys-01, table/append-with-dotted-keys-02)\n if (type === NodeType.KeyValue && key.length > 1) {\n for (let i = 1; i <= key.length; i++) {\n const candidate = candidates[i - 1];\n if (state.tables.has(encoded[i - 1])) {\n throw new Error(`Cannot extend explicit table ${candidate} with dotted keys`);\n }\n }\n }\n\n // 1. Cannot override primitive value\n let index = 0;\n for (const part of key) {\n if (!has(object, part)) return;\n if (isPrimitive(object[part])) {\n throw new Error(`Value already defined for ${candidates[index]}`);\n }\n\n const joined_parts = candidates[index];\n if (Array.isArray(object[part]) && !state.table_arrays.has(encoded[index])) {\n throw new Error(`Cannot add to static array at ${joined_parts}`);\n }\n\n const next_is_last = index++ < key.length - 1;\n object = Array.isArray(object[part]) && next_is_last ? last(object[part]) : object[part];\n }\n\n const joined_key = joined_full_key;\n\n // 2. Cannot override table\n if (object && type === NodeType.Table && state.defined.has(encoded_full_key)) {\n throw new Error(`Table already defined: ${joined_key}`);\n }\n\n // 2b. Cannot assign a value to a path that is already a table (explicit or implicit).\n if (object && type === NodeType.KeyValue && key.length === 1 && state.defined.has(encoded_full_key)) {\n // If the path exists as a structured value, overriding it is invalid.\n if (!isPrimitive(object)) {\n throw new Error(`Table already defined: ${joined_key}`);\n }\n }\n\n // 3. Cannot add table array to static array or table\n if (object && type === NodeType.TableArray && !state.table_arrays.has(encoded_full_key)) {\n throw new Error(`Cannot add Array of Tables to table at ${joined_key}`);\n }\n}\n\nfunction ensureTable(object: any, key: string[]): any {\n const target = ensure(object, key.slice(0, -1));\n const last_key = last(key)!;\n if (!target[last_key]) {\n target[last_key] = blank();\n }\n\n return target[last_key];\n}\n\nfunction ensureTableArray(object: any, key: string[]): any {\n const target = ensure(object, key.slice(0, -1));\n const last_key = last(key)!;\n if (!target[last_key]) {\n target[last_key] = [];\n }\n\n const next = blank();\n target[last(key)!].push(next);\n\n return next;\n}\n\nfunction ensure(object: any, keys: string[]): any {\n return keys.reduce((active, subkey) => {\n if (!active[subkey]) {\n active[subkey] = blank();\n }\n return Array.isArray(active[subkey]) ? last(active[subkey]) : active[subkey];\n }, object);\n}\n\nfunction isPrimitive(value: any) {\n return typeof value !== 'object' && !isDate(value);\n}\n\nfunction joinKey(key: string[]): string {\n return key.join('.');\n}\n\n/**\n * Unambiguous encoding of a key path for use as a `Set`/`Map` key.\n *\n * A plain `key.join('.')` collides for distinct key paths: `[\"\", \"\"]` (an\n * empty-string key nested in an empty-string table) and the single literal\n * segment `[\".\"]` both join to `.`, so a nested empty-key inline table is\n * wrongly rejected when a `[\".\"]` table header follows (fuzz seed 65682).\n */\nfunction encodeKey(key: string[]): string {\n return JSON.stringify(key);\n}\n"],"mappings":";;;;;;AAMA,SAAS,eAAe,KAAa,OAAyB,YAA6B;CACzF,MAAM,UAAU,IAAI,QAAQ,MAAM,EAAE;CACpC,IAAI,aAAa;C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