@o3co/ts.hocon 1.9.0 → 1.11.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.
@@ -0,0 +1,51 @@
1
+ import { C as Config } from '../config-Dlq6rF3w.cjs';
2
+
3
+ /**
4
+ * Read a YAML document as HOCON config.
5
+ *
6
+ * This is a HOCON library, not a YAML implementation, and the API keeps that
7
+ * boundary. What this package owns is the decoded-tree → HOCON step, exposed
8
+ * directly as {@link fromYamlValue}: root must be a mapping, `${...}` stays
9
+ * literal, NaN and infinity are refused, a multi-document stream is refused,
10
+ * binary becomes its base64 text. How YAML *text* becomes a tree — whether
11
+ * `010` is 8 or 10, whether `no` is a boolean — is the YAML library's answer,
12
+ * not a contract here.
13
+ *
14
+ * `parseYaml` is a convenience front on `yaml` (eemeli), pinned to
15
+ * `version: '1.2'` so a library default cannot drift under it. A caller who
16
+ * needs a different library, version or schema decodes the text themselves and
17
+ * hands the tree to {@link fromYamlValue} — that is the supported way to swap
18
+ * parsers, and it keeps the choice, and its consequences, in the caller's
19
+ * hands:
20
+ *
21
+ * ```ts
22
+ * import jsy from 'js-yaml'
23
+ * const cfg = fromYamlValue(jsy.load(src), 'their-file.yml')
24
+ * ```
25
+ *
26
+ * Integers are ingested losslessly (F0.5): the document is decoded with
27
+ * `intAsBigInt`, so a literal too wide for a JS `number` keeps its digits —
28
+ * `getString` returns them exactly — and one outside int64 is refused rather
29
+ * than rounded. `getNumber` and `toObject` still apply the JS number model, so
30
+ * read large identifiers with `getString`.
31
+ *
32
+ * See docs/specs/format-ingestion-mapping.md items F5.x in the hocon scope.
33
+ */
34
+ declare function parseYaml(input: string, originDescription?: string): Config;
35
+ /**
36
+ * Build a Config from an already-decoded YAML value tree, produced by whatever
37
+ * YAML library and settings the caller chose. This is the tree-level boundary
38
+ * this module actually owns (spec F5); `parseYaml` is just a default decoder in
39
+ * front of it.
40
+ *
41
+ * Leaf normalization accepts the shapes common across JS YAML libraries, not
42
+ * only the default one: a `Map` (eemeli with `mapAsMap`) has its scalar keys
43
+ * stringified per F5.3, a `Date` (js-yaml 4 timestamps) becomes its ISO string
44
+ * — the same reasoning as F4.2 for TOML dates — and a `Uint8Array` becomes
45
+ * base64 (F5.5), at any size. A `bigint` (a library decoding integers widely)
46
+ * narrows to a number where a double is exact and otherwise keeps its digits,
47
+ * bounded by int64 (F0.5).
48
+ */
49
+ declare function fromYamlValue(value: unknown, originDescription?: string): Config;
50
+
51
+ export { fromYamlValue, parseYaml };
@@ -0,0 +1,51 @@
1
+ import { C as Config } from '../config-Dlq6rF3w.js';
2
+
3
+ /**
4
+ * Read a YAML document as HOCON config.
5
+ *
6
+ * This is a HOCON library, not a YAML implementation, and the API keeps that
7
+ * boundary. What this package owns is the decoded-tree → HOCON step, exposed
8
+ * directly as {@link fromYamlValue}: root must be a mapping, `${...}` stays
9
+ * literal, NaN and infinity are refused, a multi-document stream is refused,
10
+ * binary becomes its base64 text. How YAML *text* becomes a tree — whether
11
+ * `010` is 8 or 10, whether `no` is a boolean — is the YAML library's answer,
12
+ * not a contract here.
13
+ *
14
+ * `parseYaml` is a convenience front on `yaml` (eemeli), pinned to
15
+ * `version: '1.2'` so a library default cannot drift under it. A caller who
16
+ * needs a different library, version or schema decodes the text themselves and
17
+ * hands the tree to {@link fromYamlValue} — that is the supported way to swap
18
+ * parsers, and it keeps the choice, and its consequences, in the caller's
19
+ * hands:
20
+ *
21
+ * ```ts
22
+ * import jsy from 'js-yaml'
23
+ * const cfg = fromYamlValue(jsy.load(src), 'their-file.yml')
24
+ * ```
25
+ *
26
+ * Integers are ingested losslessly (F0.5): the document is decoded with
27
+ * `intAsBigInt`, so a literal too wide for a JS `number` keeps its digits —
28
+ * `getString` returns them exactly — and one outside int64 is refused rather
29
+ * than rounded. `getNumber` and `toObject` still apply the JS number model, so
30
+ * read large identifiers with `getString`.
31
+ *
32
+ * See docs/specs/format-ingestion-mapping.md items F5.x in the hocon scope.
33
+ */
34
+ declare function parseYaml(input: string, originDescription?: string): Config;
35
+ /**
36
+ * Build a Config from an already-decoded YAML value tree, produced by whatever
37
+ * YAML library and settings the caller chose. This is the tree-level boundary
38
+ * this module actually owns (spec F5); `parseYaml` is just a default decoder in
39
+ * front of it.
40
+ *
41
+ * Leaf normalization accepts the shapes common across JS YAML libraries, not
42
+ * only the default one: a `Map` (eemeli with `mapAsMap`) has its scalar keys
43
+ * stringified per F5.3, a `Date` (js-yaml 4 timestamps) becomes its ISO string
44
+ * — the same reasoning as F4.2 for TOML dates — and a `Uint8Array` becomes
45
+ * base64 (F5.5), at any size. A `bigint` (a library decoding integers widely)
46
+ * narrows to a number where a double is exact and otherwise keeps its digits,
47
+ * bounded by int64 (F0.5).
48
+ */
49
+ declare function fromYamlValue(value: unknown, originDescription?: string): Config;
50
+
51
+ export { fromYamlValue, parseYaml };