@o3co/ts.hocon 1.9.0 → 1.10.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,41 @@
1
+ import { C as Config } from '../config-PdhVgeLS.cjs';
2
+
3
+ type EnvOptions = {
4
+ /**
5
+ * Selects which variables to mount, and is stripped from the resulting path.
6
+ * Required by {@link loadEnv}: mounting the whole environment would pull in
7
+ * PATH, HOME and whatever secrets happen to be set (spec F1.1).
8
+ * {@link parseDotEnv} allows it to be empty, a `.env` file being a closed set
9
+ * the caller chose deliberately.
10
+ */
11
+ prefix?: string;
12
+ /** Source name for error messages. */
13
+ originDescription?: string;
14
+ };
15
+ /**
16
+ * Mount a prefixed slice of the environment as config.
17
+ *
18
+ * ```ts
19
+ * const base = loadEnv({ prefix: 'APP_' }) // APP_DB__HOST -> db.host
20
+ * ```
21
+ *
22
+ * Reading a single variable needs nothing from here — HOCON's own `${?VAR}`
23
+ * already does that. This is for mounting a whole namespace as a subtree.
24
+ *
25
+ * Values are always strings, and a `${...}` inside one stays literal (F0.2, F1.4).
26
+ */
27
+ declare function loadEnv(opts?: EnvOptions & {
28
+ env?: Record<string, string | undefined>;
29
+ }): Config;
30
+ /**
31
+ * Read `.env` file content.
32
+ *
33
+ * The dialect is deliberately small (spec F1.7): `NAME=value`, an optional
34
+ * `export ` prefix, whole-line `#` comments, single quotes taken literally,
35
+ * double quotes with `\n \r \t \\ \"`. Multi-line values and trailing comments
36
+ * are not supported — an unquoted value containing ` #` is an error rather than
37
+ * a guess about whether a comment was meant. No `${...}` expansion.
38
+ */
39
+ declare function parseDotEnv(input: string, opts?: EnvOptions): Config;
40
+
41
+ export { type EnvOptions, loadEnv, parseDotEnv };
@@ -0,0 +1,41 @@
1
+ import { C as Config } from '../config-PdhVgeLS.js';
2
+
3
+ type EnvOptions = {
4
+ /**
5
+ * Selects which variables to mount, and is stripped from the resulting path.
6
+ * Required by {@link loadEnv}: mounting the whole environment would pull in
7
+ * PATH, HOME and whatever secrets happen to be set (spec F1.1).
8
+ * {@link parseDotEnv} allows it to be empty, a `.env` file being a closed set
9
+ * the caller chose deliberately.
10
+ */
11
+ prefix?: string;
12
+ /** Source name for error messages. */
13
+ originDescription?: string;
14
+ };
15
+ /**
16
+ * Mount a prefixed slice of the environment as config.
17
+ *
18
+ * ```ts
19
+ * const base = loadEnv({ prefix: 'APP_' }) // APP_DB__HOST -> db.host
20
+ * ```
21
+ *
22
+ * Reading a single variable needs nothing from here — HOCON's own `${?VAR}`
23
+ * already does that. This is for mounting a whole namespace as a subtree.
24
+ *
25
+ * Values are always strings, and a `${...}` inside one stays literal (F0.2, F1.4).
26
+ */
27
+ declare function loadEnv(opts?: EnvOptions & {
28
+ env?: Record<string, string | undefined>;
29
+ }): Config;
30
+ /**
31
+ * Read `.env` file content.
32
+ *
33
+ * The dialect is deliberately small (spec F1.7): `NAME=value`, an optional
34
+ * `export ` prefix, whole-line `#` comments, single quotes taken literally,
35
+ * double quotes with `\n \r \t \\ \"`. Multi-line values and trailing comments
36
+ * are not supported — an unquoted value containing ` #` is an error rather than
37
+ * a guess about whether a comment was meant. No `${...}` expansion.
38
+ */
39
+ declare function parseDotEnv(input: string, opts?: EnvOptions): Config;
40
+
41
+ export { type EnvOptions, loadEnv, parseDotEnv };