@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,45 @@
|
|
|
1
|
+
import { C as Config } from '../config-Dlq6rF3w.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Read JSON with comments and trailing commas — the dialect VS Code and
|
|
5
|
+
* TypeScript use for their config files — as HOCON config.
|
|
6
|
+
*
|
|
7
|
+
* Plain JSON needs no adapter at all: HOCON is a JSON superset, so `parse`
|
|
8
|
+
* already accepts a .json file. This exists for the two things HOCON does not
|
|
9
|
+
* accept, block comments and trailing commas. (HOCON has `//` and `#` comments
|
|
10
|
+
* of its own.)
|
|
11
|
+
*
|
|
12
|
+
* Comments and trailing commas are removed and `JSON.parse` does the rest, so
|
|
13
|
+
* the accepted grammar is otherwise exactly the platform's JSON. A comment is
|
|
14
|
+
* replaced by whitespace rather than deleted, so it separates the tokens around
|
|
15
|
+
* it and `{"a":1/*x*\/2}` is a syntax error rather than `{"a":12}` (F3.2).
|
|
16
|
+
*
|
|
17
|
+
* Integers are ingested losslessly (F0.5): a literal too wide for a JS `number`
|
|
18
|
+
* keeps its digits — `getString` returns them exactly — and one outside int64
|
|
19
|
+
* is refused instead of being rounded. `getNumber` and `toObject` still apply
|
|
20
|
+
* the JS number model, as they do for HOCON's own literals, so read large
|
|
21
|
+
* identifiers with `getString`.
|
|
22
|
+
*
|
|
23
|
+
* See docs/specs/format-ingestion-mapping.md items F3.x in the hocon scope.
|
|
24
|
+
*/
|
|
25
|
+
declare function parseJsonc(input: string, originDescription?: string): Config;
|
|
26
|
+
/**
|
|
27
|
+
* Remove `//` line comments and block comments, leaving string literals alone.
|
|
28
|
+
*
|
|
29
|
+
* F3.2: a comment is replaced by *whitespace*, never the empty string — it must
|
|
30
|
+
* keep separating the tokens around it, so a `1`, a block comment and a `2` stay
|
|
31
|
+
* two tokens and fail the JSON decode instead of silently reading as `12`.
|
|
32
|
+
* Newlines inside a removed span are kept so JSON.parse still reports useful
|
|
33
|
+
* positions; a span with no newline becomes a single space.
|
|
34
|
+
*
|
|
35
|
+
* A `//` comment ends at **LF or CR** (F3.2), and at nothing else. Stopping only
|
|
36
|
+
* at LF let a CR-terminated comment eat the rest of the line, and the
|
|
37
|
+
* trailing-comma pass then tidied the remains into valid JSON — so
|
|
38
|
+
* `{"a":1,//c\r"b":2,\n"c":3}` decoded as `{"a":1,"c":3}`, losing a key with no
|
|
39
|
+
* error at all. Stopping at U+2028/U+2029 would be the mirror-image mistake:
|
|
40
|
+
* ending a comment the dialect's own parser is still inside, so the document
|
|
41
|
+
* would mean something different here than in VS Code. See {@link isLineBreak}.
|
|
42
|
+
*/
|
|
43
|
+
declare function stripComments(src: string): string;
|
|
44
|
+
|
|
45
|
+
export { parseJsonc, stripComments };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { C as Config } from '../config-Dlq6rF3w.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Read JSON with comments and trailing commas — the dialect VS Code and
|
|
5
|
+
* TypeScript use for their config files — as HOCON config.
|
|
6
|
+
*
|
|
7
|
+
* Plain JSON needs no adapter at all: HOCON is a JSON superset, so `parse`
|
|
8
|
+
* already accepts a .json file. This exists for the two things HOCON does not
|
|
9
|
+
* accept, block comments and trailing commas. (HOCON has `//` and `#` comments
|
|
10
|
+
* of its own.)
|
|
11
|
+
*
|
|
12
|
+
* Comments and trailing commas are removed and `JSON.parse` does the rest, so
|
|
13
|
+
* the accepted grammar is otherwise exactly the platform's JSON. A comment is
|
|
14
|
+
* replaced by whitespace rather than deleted, so it separates the tokens around
|
|
15
|
+
* it and `{"a":1/*x*\/2}` is a syntax error rather than `{"a":12}` (F3.2).
|
|
16
|
+
*
|
|
17
|
+
* Integers are ingested losslessly (F0.5): a literal too wide for a JS `number`
|
|
18
|
+
* keeps its digits — `getString` returns them exactly — and one outside int64
|
|
19
|
+
* is refused instead of being rounded. `getNumber` and `toObject` still apply
|
|
20
|
+
* the JS number model, as they do for HOCON's own literals, so read large
|
|
21
|
+
* identifiers with `getString`.
|
|
22
|
+
*
|
|
23
|
+
* See docs/specs/format-ingestion-mapping.md items F3.x in the hocon scope.
|
|
24
|
+
*/
|
|
25
|
+
declare function parseJsonc(input: string, originDescription?: string): Config;
|
|
26
|
+
/**
|
|
27
|
+
* Remove `//` line comments and block comments, leaving string literals alone.
|
|
28
|
+
*
|
|
29
|
+
* F3.2: a comment is replaced by *whitespace*, never the empty string — it must
|
|
30
|
+
* keep separating the tokens around it, so a `1`, a block comment and a `2` stay
|
|
31
|
+
* two tokens and fail the JSON decode instead of silently reading as `12`.
|
|
32
|
+
* Newlines inside a removed span are kept so JSON.parse still reports useful
|
|
33
|
+
* positions; a span with no newline becomes a single space.
|
|
34
|
+
*
|
|
35
|
+
* A `//` comment ends at **LF or CR** (F3.2), and at nothing else. Stopping only
|
|
36
|
+
* at LF let a CR-terminated comment eat the rest of the line, and the
|
|
37
|
+
* trailing-comma pass then tidied the remains into valid JSON — so
|
|
38
|
+
* `{"a":1,//c\r"b":2,\n"c":3}` decoded as `{"a":1,"c":3}`, losing a key with no
|
|
39
|
+
* error at all. Stopping at U+2028/U+2029 would be the mirror-image mistake:
|
|
40
|
+
* ending a comment the dialect's own parser is still inside, so the document
|
|
41
|
+
* would mean something different here than in VS Code. See {@link isLineBreak}.
|
|
42
|
+
*/
|
|
43
|
+
declare function stripComments(src: string): string;
|
|
44
|
+
|
|
45
|
+
export { parseJsonc, stripComments };
|