@o3co/ts.hocon 1.3.0 → 1.4.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.md +55 -6
- package/dist/config-BwjvKeZ5.d.cts +271 -0
- package/dist/config-BwjvKeZ5.d.ts +271 -0
- package/dist/index.cjs +1105 -360
- package/dist/index.d.cts +45 -2
- package/dist/index.d.ts +45 -2
- package/dist/index.js +1094 -359
- package/dist/zod.cjs +823 -198
- package/dist/zod.d.cts +1 -1
- package/dist/zod.d.ts +1 -1
- package/dist/zod.js +822 -198
- package/package.json +3 -1
- package/dist/parse-nNbyqnOh.d.cts +0 -53
- package/dist/parse-nNbyqnOh.d.ts +0 -53
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { C as Config } from './config-BwjvKeZ5.cjs';
|
|
2
|
+
export { B as ByteUnit, D as DurationUnit, H as HoconValue, P as PackageResolver, a as ParseOptions, R as ResolveOptions, S as ScalarValueType, d as defaultParseOptions, b as defaultResolveOptions, p as parse, c as parseAsync, e as parseFile, f as parseFileAsync, g as parseFileWithOptions, h as parseString, i as parseStringWithOptions } from './config-BwjvKeZ5.cjs';
|
|
2
3
|
|
|
3
4
|
declare class ParseError extends Error {
|
|
4
5
|
readonly line: number;
|
|
@@ -13,9 +14,51 @@ declare class ResolveError extends Error {
|
|
|
13
14
|
readonly file?: string | undefined;
|
|
14
15
|
constructor(message: string, path: string, line: number, col: number, file?: string | undefined);
|
|
15
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Thrown when `include package("id", "file")` resolution fails because the
|
|
19
|
+
* package cannot be located via `require.resolve` or a custom `packageResolver`.
|
|
20
|
+
* Extends `ResolveError` so callers who catch `ResolveError` still handle it,
|
|
21
|
+
* while callers who need to distinguish a missing-package error can use:
|
|
22
|
+
* `if (err instanceof PackageLookupError) { ... }`
|
|
23
|
+
*/
|
|
24
|
+
declare class PackageLookupError extends ResolveError {
|
|
25
|
+
readonly identifier: string;
|
|
26
|
+
readonly packageFile: string;
|
|
27
|
+
constructor(message: string, identifier: string, packageFile: string, line: number, col: number);
|
|
28
|
+
}
|
|
16
29
|
declare class ConfigError extends Error {
|
|
17
30
|
readonly path: string;
|
|
18
31
|
constructor(message: string, path: string);
|
|
19
32
|
}
|
|
33
|
+
/** Thrown when a getter is called on a Config whose value (or any transitive
|
|
34
|
+
* parent) contains an unresolved substitution placeholder. E12 decision 12.
|
|
35
|
+
* Use `instanceof NotResolvedError` to detect; also passes `instanceof ConfigError`. */
|
|
36
|
+
declare class NotResolvedError extends ConfigError {
|
|
37
|
+
constructor(path: string);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Constructs a resolved Config from a plain JS/TS object. Keys are treated as
|
|
42
|
+
* plain keys (NOT path expressions — "a.b" produces a top-level key literally
|
|
43
|
+
* named "a.b", not nested a → b). Values are coerced per E12 § "Value factories":
|
|
44
|
+
*
|
|
45
|
+
* string → scalar/string
|
|
46
|
+
* number (finite) → scalar/number (integer or float as-is; NaN/Infinity error)
|
|
47
|
+
* boolean → scalar/boolean
|
|
48
|
+
* null → scalar/null
|
|
49
|
+
* Array<unknown> → array (elements recursively coerced)
|
|
50
|
+
* Record<string,unknown> → object (values recursively coerced)
|
|
51
|
+
* undefined / function / symbol / bigint (> MAX_SAFE_INTEGER) → ConfigError
|
|
52
|
+
*
|
|
53
|
+
* originDescription (optional) provides a source name for error messages.
|
|
54
|
+
* E12 decision 13.
|
|
55
|
+
*/
|
|
56
|
+
declare function fromMap(values: Record<string, unknown>, originDescription?: string): Config;
|
|
57
|
+
/**
|
|
58
|
+
* Returns a resolved Config with no keys. Equivalent to fromMap({}).
|
|
59
|
+
* originDescription (optional) labels the source in error messages.
|
|
60
|
+
* E12 decision 13.
|
|
61
|
+
*/
|
|
62
|
+
declare function empty(originDescription?: string): Config;
|
|
20
63
|
|
|
21
|
-
export { ConfigError, ParseError, ResolveError };
|
|
64
|
+
export { Config, ConfigError, NotResolvedError, PackageLookupError, ParseError, ResolveError, empty, fromMap };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { C as Config } from './config-BwjvKeZ5.js';
|
|
2
|
+
export { B as ByteUnit, D as DurationUnit, H as HoconValue, P as PackageResolver, a as ParseOptions, R as ResolveOptions, S as ScalarValueType, d as defaultParseOptions, b as defaultResolveOptions, p as parse, c as parseAsync, e as parseFile, f as parseFileAsync, g as parseFileWithOptions, h as parseString, i as parseStringWithOptions } from './config-BwjvKeZ5.js';
|
|
2
3
|
|
|
3
4
|
declare class ParseError extends Error {
|
|
4
5
|
readonly line: number;
|
|
@@ -13,9 +14,51 @@ declare class ResolveError extends Error {
|
|
|
13
14
|
readonly file?: string | undefined;
|
|
14
15
|
constructor(message: string, path: string, line: number, col: number, file?: string | undefined);
|
|
15
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Thrown when `include package("id", "file")` resolution fails because the
|
|
19
|
+
* package cannot be located via `require.resolve` or a custom `packageResolver`.
|
|
20
|
+
* Extends `ResolveError` so callers who catch `ResolveError` still handle it,
|
|
21
|
+
* while callers who need to distinguish a missing-package error can use:
|
|
22
|
+
* `if (err instanceof PackageLookupError) { ... }`
|
|
23
|
+
*/
|
|
24
|
+
declare class PackageLookupError extends ResolveError {
|
|
25
|
+
readonly identifier: string;
|
|
26
|
+
readonly packageFile: string;
|
|
27
|
+
constructor(message: string, identifier: string, packageFile: string, line: number, col: number);
|
|
28
|
+
}
|
|
16
29
|
declare class ConfigError extends Error {
|
|
17
30
|
readonly path: string;
|
|
18
31
|
constructor(message: string, path: string);
|
|
19
32
|
}
|
|
33
|
+
/** Thrown when a getter is called on a Config whose value (or any transitive
|
|
34
|
+
* parent) contains an unresolved substitution placeholder. E12 decision 12.
|
|
35
|
+
* Use `instanceof NotResolvedError` to detect; also passes `instanceof ConfigError`. */
|
|
36
|
+
declare class NotResolvedError extends ConfigError {
|
|
37
|
+
constructor(path: string);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Constructs a resolved Config from a plain JS/TS object. Keys are treated as
|
|
42
|
+
* plain keys (NOT path expressions — "a.b" produces a top-level key literally
|
|
43
|
+
* named "a.b", not nested a → b). Values are coerced per E12 § "Value factories":
|
|
44
|
+
*
|
|
45
|
+
* string → scalar/string
|
|
46
|
+
* number (finite) → scalar/number (integer or float as-is; NaN/Infinity error)
|
|
47
|
+
* boolean → scalar/boolean
|
|
48
|
+
* null → scalar/null
|
|
49
|
+
* Array<unknown> → array (elements recursively coerced)
|
|
50
|
+
* Record<string,unknown> → object (values recursively coerced)
|
|
51
|
+
* undefined / function / symbol / bigint (> MAX_SAFE_INTEGER) → ConfigError
|
|
52
|
+
*
|
|
53
|
+
* originDescription (optional) provides a source name for error messages.
|
|
54
|
+
* E12 decision 13.
|
|
55
|
+
*/
|
|
56
|
+
declare function fromMap(values: Record<string, unknown>, originDescription?: string): Config;
|
|
57
|
+
/**
|
|
58
|
+
* Returns a resolved Config with no keys. Equivalent to fromMap({}).
|
|
59
|
+
* originDescription (optional) labels the source in error messages.
|
|
60
|
+
* E12 decision 13.
|
|
61
|
+
*/
|
|
62
|
+
declare function empty(originDescription?: string): Config;
|
|
20
63
|
|
|
21
|
-
export { ConfigError, ParseError, ResolveError };
|
|
64
|
+
export { Config, ConfigError, NotResolvedError, PackageLookupError, ParseError, ResolveError, empty, fromMap };
|