@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.
- package/README.ja.md +129 -1
- package/README.md +122 -2
- package/dist/adapters/env.cjs +1738 -0
- package/dist/adapters/env.d.cts +56 -0
- package/dist/adapters/env.d.ts +56 -0
- package/dist/adapters/env.js +1700 -0
- package/dist/adapters/jsonc.cjs +1716 -0
- package/dist/adapters/jsonc.d.cts +45 -0
- package/dist/adapters/jsonc.d.ts +45 -0
- package/dist/adapters/jsonc.js +1678 -0
- package/dist/adapters/properties.cjs +1744 -0
- package/dist/adapters/properties.d.cts +32 -0
- package/dist/adapters/properties.d.ts +32 -0
- package/dist/adapters/properties.js +1707 -0
- package/dist/adapters/toml.cjs +1629 -0
- package/dist/adapters/toml.d.cts +18 -0
- package/dist/adapters/toml.d.ts +18 -0
- package/dist/adapters/toml.js +1594 -0
- package/dist/adapters/yaml.cjs +1686 -0
- package/dist/adapters/yaml.d.cts +51 -0
- package/dist/adapters/yaml.d.ts +51 -0
- package/dist/adapters/yaml.js +1650 -0
- package/dist/{config-D27s3_aG.d.cts → config-Dlq6rF3w.d.cts} +50 -4
- package/dist/{config-D27s3_aG.d.ts → config-Dlq6rF3w.d.ts} +50 -4
- package/dist/index.cjs +207 -35
- package/dist/index.d.cts +10 -3
- package/dist/index.d.ts +10 -3
- package/dist/index.js +214 -35
- package/dist/zod.cjs +203 -33
- package/dist/zod.d.cts +1 -1
- package/dist/zod.d.ts +1 -1
- package/dist/zod.js +210 -33
- package/package.json +89 -19
|
@@ -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 };
|