@e-n-v/env 0.0.2 → 0.0.4

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.
Files changed (99) hide show
  1. package/README.md +43 -24
  2. package/dist/BooleanMap-B2eIP3tZ.d.cts +32 -0
  3. package/dist/BooleanMap-DmFnCA-O.d.ts +32 -0
  4. package/dist/EnvChannel-LMIRYvT1.d.cts +16 -0
  5. package/dist/EnvChannel-w27PEm7x.d.ts +16 -0
  6. package/dist/EnvChannelOptions-BPkWDrmr.d.cts +108 -0
  7. package/dist/EnvChannelOptions-CRwDLWjd.d.ts +108 -0
  8. package/dist/EnvModel-CrGclUpJ.d.cts +134 -0
  9. package/dist/EnvModel-D8rt0EJ6.d.ts +134 -0
  10. package/dist/EnvSource-BVnmdHku.cjs +420 -0
  11. package/dist/EnvSource-DA3ZGlES.js +400 -0
  12. package/dist/ProcessEnvChannel-D465c-dp.d.cts +97 -0
  13. package/dist/ProcessEnvChannel-Do4-yiLI.d.ts +97 -0
  14. package/dist/StringEnvVarSchema-B8MT7htU.d.ts +64 -0
  15. package/dist/StringEnvVarSchema-BF6C0nyT.d.cts +64 -0
  16. package/dist/channels.cjs +8 -0
  17. package/dist/channels.d.cts +20 -0
  18. package/dist/channels.d.ts +20 -0
  19. package/dist/channels.js +4 -0
  20. package/dist/chunk-pbleEpgJ.cjs +44 -0
  21. package/dist/cli.cjs +16 -10
  22. package/dist/cli.js +7 -2
  23. package/dist/coerce-DNIuYAx4.js +11028 -0
  24. package/dist/coerce-b7UVodS9.cjs +12365 -0
  25. package/dist/core.cjs +68 -0
  26. package/dist/core.d.cts +6 -0
  27. package/dist/core.d.ts +6 -0
  28. package/dist/core.js +40 -0
  29. package/dist/custom-Bt_wnxIu.js +114 -0
  30. package/dist/custom-D_Rqjm09.cjs +168 -0
  31. package/dist/files.cjs +18 -0
  32. package/dist/files.d.cts +38 -0
  33. package/dist/files.d.ts +38 -0
  34. package/dist/files.js +13 -0
  35. package/dist/index-D8pslhp4.d.cts +170 -0
  36. package/dist/index-Dq_0aeAL.d.ts +170 -0
  37. package/dist/model-Dic8IJsf.d.ts +29 -0
  38. package/dist/model-ft0WhSSS.d.cts +29 -0
  39. package/dist/model.cjs +14 -0
  40. package/dist/model.d.cts +35 -0
  41. package/dist/model.d.ts +35 -0
  42. package/dist/model.js +9 -0
  43. package/dist/parse-BT1QSa5e.d.cts +28 -0
  44. package/dist/parse-DwtLpVhC.d.ts +28 -0
  45. package/dist/parse.cjs +17 -0
  46. package/dist/parse.d.cts +52 -0
  47. package/dist/parse.d.ts +52 -0
  48. package/dist/parse.js +10 -0
  49. package/dist/prompt-C5WudV9x.d.cts +74 -0
  50. package/dist/prompt-yKdccbtZ.d.ts +74 -0
  51. package/dist/prompt.cjs +24 -0
  52. package/dist/prompt.d.cts +17 -0
  53. package/dist/prompt.d.ts +17 -0
  54. package/dist/prompt.js +12 -0
  55. package/dist/redis-CJOpRPjc.js +395 -0
  56. package/dist/redis-EcC7TX3K.cjs +611 -0
  57. package/dist/resolveChannel-CjAuxy3p.cjs +257 -0
  58. package/dist/resolveChannel-v9BDsw-M.js +224 -0
  59. package/dist/root.cjs +36 -0
  60. package/dist/root.d.cts +21 -0
  61. package/dist/root.d.ts +21 -0
  62. package/dist/root.js +21 -0
  63. package/dist/schema-DH4GiW9A.d.cts +18 -0
  64. package/dist/schema-jN4EtvEP.d.ts +18 -0
  65. package/dist/schemas/zod.cjs +629 -0
  66. package/dist/schemas/zod.d.cts +239 -0
  67. package/dist/schemas/zod.d.ts +239 -0
  68. package/dist/schemas/zod.js +550 -0
  69. package/dist/schemas.cjs +133 -0
  70. package/dist/schemas.d.cts +3 -0
  71. package/dist/schemas.d.ts +3 -0
  72. package/dist/schemas.js +6 -0
  73. package/dist/src-B7FG1rak.js +638 -0
  74. package/dist/src-BBwjK5SK.js +127 -0
  75. package/dist/src-CLTURaoo.js +311 -0
  76. package/dist/src-CVdUqK3q.js +850 -0
  77. package/dist/src-Cjo2XA4n.cjs +138 -0
  78. package/dist/{src-oetJm-nZ.cjs → src-DWYoqPX1.cjs} +31 -1964
  79. package/dist/src-DZmpNGrQ.cjs +1411 -0
  80. package/dist/{src-RlCvrI0s.js → src-Dtv7TlJx.js} +14 -1726
  81. package/dist/src-XjL5cyPG.cjs +873 -0
  82. package/dist/src-meUnCASg.cjs +413 -0
  83. package/dist/validate-BxA3a-ns.d.cts +203 -0
  84. package/dist/validate-CyxrRacF.d.ts +203 -0
  85. package/dist/vars-BNVI6k89.d.ts +21 -0
  86. package/dist/vars-CYOaskkK.cjs +27 -0
  87. package/dist/vars-CptZRPX5.d.cts +21 -0
  88. package/dist/vars-DOW0LiiN.js +22 -0
  89. package/dist/vars.cjs +138 -0
  90. package/dist/vars.d.cts +7 -0
  91. package/dist/vars.d.ts +7 -0
  92. package/dist/vars.js +9 -0
  93. package/package.json +57 -9
  94. package/assets/demo.gif +0 -0
  95. package/assets/env-logo.png +0 -0
  96. package/dist/bundle.cjs +0 -1290
  97. package/dist/bundle.d.cts +0 -1057
  98. package/dist/bundle.d.ts +0 -1055
  99. package/dist/bundle.js +0 -1244
@@ -0,0 +1,52 @@
1
+ import "./StringEnvVarSchema-B8MT7htU.js";
2
+ import { i as EnvVarSchema } from "./BooleanMap-DmFnCA-O.js";
3
+ import { n as schema, t as s } from "./schema-jN4EtvEP.js";
4
+ import { a as SupportedSchema, n as EnvModelOptions, t as EnvModel } from "./EnvModel-D8rt0EJ6.js";
5
+ import { t as define } from "./model-Dic8IJsf.js";
6
+ import { n as ParseEnvOptions, t as parse } from "./parse-DwtLpVhC.js";
7
+
8
+ //#region ../parse/src/errors/EnvParseError.d.ts
9
+ type EnvParseIssueMissing = {
10
+ type: "missing";
11
+ key: string;
12
+ message: string;
13
+ };
14
+ type EnvParseIssueInvalid = {
15
+ type: "invalid";
16
+ key: string;
17
+ value: string;
18
+ message: string;
19
+ };
20
+ type EnvParseIssue = EnvParseIssueMissing | EnvParseIssueInvalid;
21
+ type EnvParseResult<TValue> = {
22
+ ok: true;
23
+ value: TValue;
24
+ } | {
25
+ ok: false;
26
+ error: EnvParseError<TValue>;
27
+ };
28
+ /**
29
+ * Error thrown when parsing environment variables fails.
30
+ * Collects all issues so callers can inspect them without relying on subclasses.
31
+ */
32
+ declare class EnvParseError<TValue = Record<string, unknown>> extends Error {
33
+ readonly issues: ReadonlyArray<EnvParseIssue>;
34
+ readonly partial: Partial<TValue>;
35
+ constructor(params: {
36
+ issues: EnvParseIssue[];
37
+ partial?: Partial<TValue>;
38
+ });
39
+ /** Number of issues encountered while parsing. */
40
+ get issueCount(): number;
41
+ /** Keys that were missing but required. */
42
+ get missing(): string[];
43
+ /** Keys that were present but invalid. */
44
+ get invalid(): string[];
45
+ /**
46
+ * Get all issue messages as a numbered list for easy logging.
47
+ */
48
+ formatIssues(): string;
49
+ private static formatMessage;
50
+ }
51
+ //#endregion
52
+ export { EnvModel, EnvModelOptions, EnvParseError, EnvParseIssue, EnvParseIssueInvalid, EnvParseIssueMissing, EnvParseResult, EnvVarSchema, ParseEnvOptions, SupportedSchema, parse as default, parse, define, s, schema };
package/dist/parse.js ADDED
@@ -0,0 +1,10 @@
1
+ import { n as schema, t as s } from "./src-CLTURaoo.js";
2
+ import "./coerce-DNIuYAx4.js";
3
+ import { n as EnvModel, t as define } from "./src-CVdUqK3q.js";
4
+ import { n as EnvParseError, t as parse } from "./src-BBwjK5SK.js";
5
+
6
+ //#region src/parse.ts
7
+ var parse_default = parse;
8
+
9
+ //#endregion
10
+ export { EnvModel, EnvParseError, parse_default as default, define, parse, s, schema };
@@ -0,0 +1,74 @@
1
+ import { t as EnvChannelOptions } from "./EnvChannelOptions-BPkWDrmr.cjs";
2
+ import { t as EnvChannel } from "./EnvChannel-LMIRYvT1.cjs";
3
+ import { n as EnvModelOptions, t as EnvModel } from "./EnvModel-CrGclUpJ.cjs";
4
+ import { Formatter } from "picocolors/types";
5
+
6
+ //#region ../prompt/src/options/PromptEnvInteractiveOptions.d.ts
7
+ /**
8
+ * Configuration options for the prompt function
9
+ */
10
+ type PromptEnvInteractiveOptions = {
11
+ /**
12
+ * Path to the .env file to read from and write to
13
+ * @default ".env"
14
+ * @example ".env.local", ".env.production", "config/.env"
15
+ */
16
+ path?: string;
17
+ /**
18
+ * Root location used to resolve relative env file paths.
19
+ * Supply CommonJS `__dirname` or ESM `import.meta.url` so the env path resolves next to the caller.
20
+ * Falls back to the current working directory when omitted.
21
+ * @default process.cwd()
22
+ * @example import.meta.url, __dirname
23
+ */
24
+ root?: string;
25
+ /**
26
+ * Channel configuration for reading and writing environment variables.
27
+ * Can be undefined (default), "default", a dotenvx instance, channel config objects, or an EnvChannel instance.
28
+ * @default undefined (uses default file-based channel)
29
+ * @example dotenvx, { name: "default" }, { dotenvx: instance, get: {}, set: {} }, new DefaultEnvChannel(".env")
30
+ */
31
+ channel?: EnvChannelOptions | EnvChannel;
32
+ /**
33
+ * Maximum number of characters to display for values in prompts before truncating
34
+ * Longer values will be shown as "value..." to keep the interface clean
35
+ * @default 40
36
+ * @example 20, 60, 100
37
+ */
38
+ truncate?: number;
39
+ /**
40
+ * Array of patterns (strings or RegExp) used to identify secret environment variables
41
+ * Secret variables will be masked in prompts and can be toggled to reveal/hide
42
+ * @default DEFAULT_SECRET_PATTERNS (includes password, token, api_key, database_url, etc.)
43
+ * @example ["PASSWORD", /secret/i, "API_KEY"], [] (empty array disables masking)
44
+ */
45
+ secrets?: Array<RegExp | string>;
46
+ /**
47
+ * Color theme function for styling the CLI interface
48
+ * Uses picocolors formatter functions to customize the primary color scheme
49
+ * @default color.magenta
50
+ * @example color.blue, color.green, color.cyan
51
+ */
52
+ theme?: Formatter;
53
+ };
54
+ //#endregion
55
+ //#region ../prompt/src/options/PromptEnvOptions.d.ts
56
+ /**
57
+ * Configuration options for the prompt function
58
+ */
59
+ type PromptEnvOptions = EnvModelOptions & PromptEnvInteractiveOptions;
60
+ //#endregion
61
+ //#region ../prompt/src/prompt.d.ts
62
+ /**
63
+ * Interactive CLI tool to generate .env files with schema validation
64
+ * @param model - Environment model instance
65
+ * @param options - Interactive configuration options
66
+ */
67
+ declare function prompt(model: EnvModel, options?: PromptEnvInteractiveOptions): Promise<void>;
68
+ /**
69
+ * Interactive CLI tool to generate .env files with schema validation
70
+ * @param options - Configuration options including schemas and interactive settings
71
+ */
72
+ declare function prompt(options: PromptEnvOptions): Promise<void>;
73
+ //#endregion
74
+ export { PromptEnvOptions as n, prompt as t };
@@ -0,0 +1,74 @@
1
+ import { t as EnvChannelOptions } from "./EnvChannelOptions-CRwDLWjd.js";
2
+ import { t as EnvChannel } from "./EnvChannel-w27PEm7x.js";
3
+ import { n as EnvModelOptions, t as EnvModel } from "./EnvModel-D8rt0EJ6.js";
4
+ import { Formatter } from "picocolors/types";
5
+
6
+ //#region ../prompt/src/options/PromptEnvInteractiveOptions.d.ts
7
+ /**
8
+ * Configuration options for the prompt function
9
+ */
10
+ type PromptEnvInteractiveOptions = {
11
+ /**
12
+ * Path to the .env file to read from and write to
13
+ * @default ".env"
14
+ * @example ".env.local", ".env.production", "config/.env"
15
+ */
16
+ path?: string;
17
+ /**
18
+ * Root location used to resolve relative env file paths.
19
+ * Supply CommonJS `__dirname` or ESM `import.meta.url` so the env path resolves next to the caller.
20
+ * Falls back to the current working directory when omitted.
21
+ * @default process.cwd()
22
+ * @example import.meta.url, __dirname
23
+ */
24
+ root?: string;
25
+ /**
26
+ * Channel configuration for reading and writing environment variables.
27
+ * Can be undefined (default), "default", a dotenvx instance, channel config objects, or an EnvChannel instance.
28
+ * @default undefined (uses default file-based channel)
29
+ * @example dotenvx, { name: "default" }, { dotenvx: instance, get: {}, set: {} }, new DefaultEnvChannel(".env")
30
+ */
31
+ channel?: EnvChannelOptions | EnvChannel;
32
+ /**
33
+ * Maximum number of characters to display for values in prompts before truncating
34
+ * Longer values will be shown as "value..." to keep the interface clean
35
+ * @default 40
36
+ * @example 20, 60, 100
37
+ */
38
+ truncate?: number;
39
+ /**
40
+ * Array of patterns (strings or RegExp) used to identify secret environment variables
41
+ * Secret variables will be masked in prompts and can be toggled to reveal/hide
42
+ * @default DEFAULT_SECRET_PATTERNS (includes password, token, api_key, database_url, etc.)
43
+ * @example ["PASSWORD", /secret/i, "API_KEY"], [] (empty array disables masking)
44
+ */
45
+ secrets?: Array<RegExp | string>;
46
+ /**
47
+ * Color theme function for styling the CLI interface
48
+ * Uses picocolors formatter functions to customize the primary color scheme
49
+ * @default color.magenta
50
+ * @example color.blue, color.green, color.cyan
51
+ */
52
+ theme?: Formatter;
53
+ };
54
+ //#endregion
55
+ //#region ../prompt/src/options/PromptEnvOptions.d.ts
56
+ /**
57
+ * Configuration options for the prompt function
58
+ */
59
+ type PromptEnvOptions = EnvModelOptions & PromptEnvInteractiveOptions;
60
+ //#endregion
61
+ //#region ../prompt/src/prompt.d.ts
62
+ /**
63
+ * Interactive CLI tool to generate .env files with schema validation
64
+ * @param model - Environment model instance
65
+ * @param options - Interactive configuration options
66
+ */
67
+ declare function prompt(model: EnvModel, options?: PromptEnvInteractiveOptions): Promise<void>;
68
+ /**
69
+ * Interactive CLI tool to generate .env files with schema validation
70
+ * @param options - Configuration options including schemas and interactive settings
71
+ */
72
+ declare function prompt(options: PromptEnvOptions): Promise<void>;
73
+ //#endregion
74
+ export { PromptEnvOptions as n, prompt as t };
@@ -0,0 +1,24 @@
1
+ Object.defineProperty(exports, '__esModule', { value: true });
2
+ require('./EnvSource-BVnmdHku.cjs');
3
+ const require_resolveChannel = require('./resolveChannel-CjAuxy3p.cjs');
4
+ const require_src = require('./src-DWYoqPX1.cjs');
5
+ require('./src-meUnCASg.cjs');
6
+ require('./coerce-b7UVodS9.cjs');
7
+ require('./src-XjL5cyPG.cjs');
8
+
9
+ //#region src/prompt.ts
10
+ var prompt_default = require_src.prompt;
11
+
12
+ //#endregion
13
+ exports.DefaultEnvChannel = require_resolveChannel.DefaultEnvChannel;
14
+ exports.DotEnvXChannel = require_resolveChannel.DotEnvXChannel;
15
+ exports.ProcessEnvChannel = require_resolveChannel.ProcessEnvChannel;
16
+ exports.default = prompt_default;
17
+ Object.defineProperty(exports, 'defaults', {
18
+ enumerable: true,
19
+ get: function () {
20
+ return require_src.defaults_exports;
21
+ }
22
+ });
23
+ exports.prompt = require_src.prompt;
24
+ exports.resolveChannel = require_resolveChannel.resolveChannel;
@@ -0,0 +1,17 @@
1
+ import { a as DotEnvXChannelConfig, i as DefaultChannelConfig, n as ProcessChannelConfig, r as ProcessEnvChannelConfig, t as EnvChannelOptions } from "./EnvChannelOptions-BPkWDrmr.cjs";
2
+ import "./StringEnvVarSchema-BF6C0nyT.cjs";
3
+ import "./BooleanMap-B2eIP3tZ.cjs";
4
+ import { t as EnvChannel } from "./EnvChannel-LMIRYvT1.cjs";
5
+ import { i as resolveChannel, n as DotEnvXChannel, r as DefaultEnvChannel, t as ProcessEnvChannel } from "./ProcessEnvChannel-D465c-dp.cjs";
6
+ import "./EnvModel-CrGclUpJ.cjs";
7
+ import { n as PromptEnvOptions, t as prompt } from "./prompt-C5WudV9x.cjs";
8
+
9
+ //#region ../prompt/src/options/defaults.d.ts
10
+ declare namespace defaults_d_exports {
11
+ export { ENV_PATH, SECRET_PATTERNS, TRUNCATE_LENGTH };
12
+ }
13
+ declare const ENV_PATH = ".env";
14
+ declare const TRUNCATE_LENGTH = 40;
15
+ declare const SECRET_PATTERNS: ReadonlyArray<RegExp | string>;
16
+ //#endregion
17
+ export { DefaultChannelConfig, DefaultEnvChannel, DotEnvXChannel, DotEnvXChannelConfig, EnvChannel, EnvChannelOptions, ProcessChannelConfig, ProcessEnvChannel, ProcessEnvChannelConfig, PromptEnvOptions, prompt as default, prompt, defaults_d_exports as defaults, resolveChannel };
@@ -0,0 +1,17 @@
1
+ import { a as DotEnvXChannelConfig, i as DefaultChannelConfig, n as ProcessChannelConfig, r as ProcessEnvChannelConfig, t as EnvChannelOptions } from "./EnvChannelOptions-CRwDLWjd.js";
2
+ import "./StringEnvVarSchema-B8MT7htU.js";
3
+ import "./BooleanMap-DmFnCA-O.js";
4
+ import { t as EnvChannel } from "./EnvChannel-w27PEm7x.js";
5
+ import { i as resolveChannel, n as DotEnvXChannel, r as DefaultEnvChannel, t as ProcessEnvChannel } from "./ProcessEnvChannel-Do4-yiLI.js";
6
+ import "./EnvModel-D8rt0EJ6.js";
7
+ import { n as PromptEnvOptions, t as prompt } from "./prompt-yKdccbtZ.js";
8
+
9
+ //#region ../prompt/src/options/defaults.d.ts
10
+ declare namespace defaults_d_exports {
11
+ export { ENV_PATH, SECRET_PATTERNS, TRUNCATE_LENGTH };
12
+ }
13
+ declare const ENV_PATH = ".env";
14
+ declare const TRUNCATE_LENGTH = 40;
15
+ declare const SECRET_PATTERNS: ReadonlyArray<RegExp | string>;
16
+ //#endregion
17
+ export { DefaultChannelConfig, DefaultEnvChannel, DotEnvXChannel, DotEnvXChannelConfig, EnvChannel, EnvChannelOptions, ProcessChannelConfig, ProcessEnvChannel, ProcessEnvChannelConfig, PromptEnvOptions, prompt as default, prompt, defaults_d_exports as defaults, resolveChannel };
package/dist/prompt.js ADDED
@@ -0,0 +1,12 @@
1
+ import "./EnvSource-DA3ZGlES.js";
2
+ import { a as DefaultEnvChannel, n as ProcessEnvChannel, r as DotEnvXChannel, t as resolveChannel } from "./resolveChannel-v9BDsw-M.js";
3
+ import { n as defaults_exports, t as prompt } from "./src-Dtv7TlJx.js";
4
+ import "./src-CLTURaoo.js";
5
+ import "./coerce-DNIuYAx4.js";
6
+ import "./src-CVdUqK3q.js";
7
+
8
+ //#region src/prompt.ts
9
+ var prompt_default = prompt;
10
+
11
+ //#endregion
12
+ export { DefaultEnvChannel, DotEnvXChannel, ProcessEnvChannel, prompt_default as default, defaults_exports as defaults, prompt, resolveChannel };