@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,257 @@
1
+ const require_chunk = require('./chunk-pbleEpgJ.cjs');
2
+ const require_EnvSource = require('./EnvSource-BVnmdHku.cjs');
3
+ let node_path = require("node:path");
4
+ node_path = require_chunk.__toESM(node_path);
5
+ let node_fs_promises = require("node:fs/promises");
6
+ node_fs_promises = require_chunk.__toESM(node_fs_promises);
7
+ let fs = require("fs");
8
+ fs = require_chunk.__toESM(fs);
9
+
10
+ //#region ../channels/src/channels/default/DefaultEnvChannel.ts
11
+ /**
12
+ * Default implementation of EnvChannel that works with .env files using envrw
13
+ */
14
+ var DefaultEnvChannel = class {
15
+ envSource;
16
+ /**
17
+ * Create a new DefaultEnvChannel
18
+ * @param filePath - Path to the .env file to manage
19
+ */
20
+ constructor(filePath) {
21
+ this.envSource = new require_EnvSource.EnvSource(filePath);
22
+ }
23
+ /**
24
+ * Get all environment variables
25
+ * @returns Promise that resolves to object containing all environment variable key-value pairs
26
+ */
27
+ async get() {
28
+ return await this.envSource.read();
29
+ }
30
+ /**
31
+ * Set multiple environment variables
32
+ * @param values - Object containing key-value pairs to set
33
+ * @returns Promise that resolves when the values have been set
34
+ */
35
+ async set(values) {
36
+ await this.envSource.write(values);
37
+ }
38
+ };
39
+
40
+ //#endregion
41
+ //#region ../channels/src/channels/dotenv/DotEnvChannel.ts
42
+ function isFileNotFound(error) {
43
+ return typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
44
+ }
45
+ function normalizeParsed(parsed) {
46
+ if (!parsed) return {};
47
+ const result = {};
48
+ for (const [key, value] of Object.entries(parsed)) {
49
+ if (typeof value === "undefined") continue;
50
+ result[key] = value;
51
+ }
52
+ return result;
53
+ }
54
+ var DotEnvChannel = class {
55
+ dotenv;
56
+ targetPath;
57
+ absolutePath;
58
+ encoding;
59
+ parseOptions;
60
+ envSource;
61
+ constructor(dotenv, defaultPath = ".env", getOptions = {}, parseOptions = {}) {
62
+ this.dotenv = dotenv;
63
+ this.targetPath = (typeof getOptions.path === "string" ? getOptions.path : void 0) ?? defaultPath;
64
+ this.absolutePath = (0, node_path.resolve)(process.cwd(), this.targetPath);
65
+ this.encoding = getOptions.encoding ?? "utf8";
66
+ this.parseOptions = { ...parseOptions };
67
+ this.envSource = new require_EnvSource.EnvSource(this.targetPath);
68
+ }
69
+ async get() {
70
+ try {
71
+ const content = await (0, node_fs_promises.readFile)(this.absolutePath, { encoding: this.encoding });
72
+ return normalizeParsed(this.dotenv.parse(content, this.parseOptions));
73
+ } catch (error) {
74
+ if (isFileNotFound(error)) return {};
75
+ throw error;
76
+ }
77
+ }
78
+ async set(values) {
79
+ await this.envSource.write(values);
80
+ const parsed = await this.get();
81
+ const mismatches = [];
82
+ for (const [key, expected] of Object.entries(values)) {
83
+ const actual = parsed[key];
84
+ if (actual !== expected) mismatches.push(`${key}=expected(${JSON.stringify(expected)}) actual(${JSON.stringify(actual)})`);
85
+ }
86
+ if (mismatches.length > 0) throw new Error(`Failed to correctly write values to ${this.targetPath}: ${mismatches.join(", ")}`);
87
+ }
88
+ getPrimaryPath() {
89
+ return this.targetPath;
90
+ }
91
+ clearCache() {}
92
+ };
93
+
94
+ //#endregion
95
+ //#region ../channels/src/channels/dotenvx/DotEnvXChannel.ts
96
+ /**
97
+ * Simple DotEnvX implementation of EnvChannel that wraps @dotenvx/dotenvx library
98
+ * This is just an API mapping wrapper without caching or complex state management
99
+ */
100
+ var DotEnvXChannel = class {
101
+ dotenvx;
102
+ getOptions;
103
+ setOptions;
104
+ defaultPath;
105
+ /**
106
+ * Create a new DotEnvXChannel
107
+ * @param dotenvx - The dotenvx instance to use
108
+ * @param defaultPath - Default path for env files
109
+ * @param getOptions - Options for get operations
110
+ * @param setOptions - Options for set operations
111
+ */
112
+ constructor(dotenvx, defaultPath = ".env", getOptions = {}, setOptions = {}) {
113
+ this.dotenvx = dotenvx;
114
+ this.defaultPath = defaultPath;
115
+ this.getOptions = getOptions;
116
+ this.setOptions = setOptions;
117
+ }
118
+ /**
119
+ * Get all environment variables
120
+ * @returns Promise that resolves to object containing all environment variable key-value pairs
121
+ */
122
+ async get() {
123
+ try {
124
+ return this.dotenvx.config({
125
+ processEnv: {},
126
+ quiet: true,
127
+ ignore: ["MISSING_ENV_FILE"],
128
+ path: this.defaultPath,
129
+ ...this.getOptions
130
+ }).parsed || {};
131
+ } catch {
132
+ return {};
133
+ }
134
+ }
135
+ /**
136
+ * Set multiple environment variables
137
+ * @param values - Object containing key-value pairs to set
138
+ * @returns Promise that resolves when the values have been set
139
+ */
140
+ async set(values) {
141
+ if (!(0, fs.existsSync)(this.defaultPath)) (0, fs.writeFileSync)(this.defaultPath, "", "utf8");
142
+ try {
143
+ const options = {
144
+ path: this.defaultPath,
145
+ ...this.setOptions
146
+ };
147
+ for (const [key, value] of Object.entries(values)) this.dotenvx.set(key, value, options);
148
+ } catch (error) {
149
+ throw new Error(`Failed to set environment variables: ${error}`);
150
+ }
151
+ }
152
+ /**
153
+ * Get the primary path being used for env files
154
+ * @returns The primary path
155
+ */
156
+ getPrimaryPath() {
157
+ return this.defaultPath;
158
+ }
159
+ /**
160
+ * Clear any cached data (no-op for this implementation since we don't cache)
161
+ */
162
+ clearCache() {}
163
+ };
164
+
165
+ //#endregion
166
+ //#region ../channels/src/channels/processenv/ProcessEnvChannel.ts
167
+ /**
168
+ * EnvChannel implementation that works with process.env
169
+ * This channel reads from and writes to the current process environment
170
+ */
171
+ var ProcessEnvChannel = class {
172
+ /**
173
+ * Get all environment variables from process.env
174
+ * @returns Promise that resolves to object containing all environment variable key-value pairs
175
+ */
176
+ async get() {
177
+ const env = {};
178
+ for (const [key, value] of Object.entries(process.env)) if (value !== void 0) env[key] = value;
179
+ return env;
180
+ }
181
+ /**
182
+ * Set multiple environment variables in process.env
183
+ * @param values - Object containing key-value pairs to set
184
+ * @returns Promise that resolves when the values have been set
185
+ */
186
+ async set(values) {
187
+ for (const [key, value] of Object.entries(values)) process.env[key] = value;
188
+ }
189
+ };
190
+
191
+ //#endregion
192
+ //#region ../channels/src/resolveChannel.ts
193
+ /**
194
+ * Resolve channel options into an EnvChannel instance
195
+ * @param options - The channel options to resolve
196
+ * @param defaultPath - Default path to use for env files (default: ".env")
197
+ * @returns An EnvChannel instance
198
+ */
199
+ function resolveChannel(options, defaultPath = ".env") {
200
+ if (options === void 0 || options === "default") return new DefaultEnvChannel(defaultPath);
201
+ if (options === "processenv") return new ProcessEnvChannel();
202
+ if (typeof options === "object" && options !== null) {
203
+ if ("dotenv" in options) {
204
+ const { dotenv, get: getOptions = {}, parse: parseOptions = {}, path } = options;
205
+ if (!dotenv) throw new Error("Dotenv instance is required for dotenv channel");
206
+ const resolvedPath = path ?? defaultPath;
207
+ const mergedGetOptions = { ...getOptions };
208
+ if (typeof mergedGetOptions.path !== "string") mergedGetOptions.path = resolvedPath;
209
+ return new DotEnvChannel(dotenv, resolvedPath, mergedGetOptions, parseOptions ?? {});
210
+ }
211
+ if ("dotenvx" in options) {
212
+ const { dotenvx, get: getOptions = {}, set: setOptions = {} } = options;
213
+ if (!dotenvx) throw new Error("DotEnvX instance is required for dotenvx channel");
214
+ return new DotEnvXChannel(dotenvx, defaultPath, getOptions, setOptions);
215
+ }
216
+ if ("process" in options) {
217
+ if (options.process && typeof options.process === "object" && "env" in options.process) return new ProcessEnvChannel();
218
+ throw new Error("Invalid process object provided to channel config");
219
+ }
220
+ if ("name" in options) if (options.name === "default") return new DefaultEnvChannel(defaultPath);
221
+ else if (options.name === "processenv") return new ProcessEnvChannel();
222
+ else throw new Error(`Unknown channel name: ${options.name}`);
223
+ }
224
+ throw new Error(`Invalid channel options: ${options}`);
225
+ }
226
+
227
+ //#endregion
228
+ Object.defineProperty(exports, 'DefaultEnvChannel', {
229
+ enumerable: true,
230
+ get: function () {
231
+ return DefaultEnvChannel;
232
+ }
233
+ });
234
+ Object.defineProperty(exports, 'DotEnvChannel', {
235
+ enumerable: true,
236
+ get: function () {
237
+ return DotEnvChannel;
238
+ }
239
+ });
240
+ Object.defineProperty(exports, 'DotEnvXChannel', {
241
+ enumerable: true,
242
+ get: function () {
243
+ return DotEnvXChannel;
244
+ }
245
+ });
246
+ Object.defineProperty(exports, 'ProcessEnvChannel', {
247
+ enumerable: true,
248
+ get: function () {
249
+ return ProcessEnvChannel;
250
+ }
251
+ });
252
+ Object.defineProperty(exports, 'resolveChannel', {
253
+ enumerable: true,
254
+ get: function () {
255
+ return resolveChannel;
256
+ }
257
+ });
@@ -0,0 +1,224 @@
1
+ import { t as EnvSource } from "./EnvSource-DA3ZGlES.js";
2
+ import { resolve } from "node:path";
3
+ import { readFile } from "node:fs/promises";
4
+ import { existsSync, writeFileSync } from "fs";
5
+
6
+ //#region ../channels/src/channels/default/DefaultEnvChannel.ts
7
+ /**
8
+ * Default implementation of EnvChannel that works with .env files using envrw
9
+ */
10
+ var DefaultEnvChannel = class {
11
+ envSource;
12
+ /**
13
+ * Create a new DefaultEnvChannel
14
+ * @param filePath - Path to the .env file to manage
15
+ */
16
+ constructor(filePath) {
17
+ this.envSource = new EnvSource(filePath);
18
+ }
19
+ /**
20
+ * Get all environment variables
21
+ * @returns Promise that resolves to object containing all environment variable key-value pairs
22
+ */
23
+ async get() {
24
+ return await this.envSource.read();
25
+ }
26
+ /**
27
+ * Set multiple environment variables
28
+ * @param values - Object containing key-value pairs to set
29
+ * @returns Promise that resolves when the values have been set
30
+ */
31
+ async set(values) {
32
+ await this.envSource.write(values);
33
+ }
34
+ };
35
+
36
+ //#endregion
37
+ //#region ../channels/src/channels/dotenv/DotEnvChannel.ts
38
+ function isFileNotFound(error) {
39
+ return typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
40
+ }
41
+ function normalizeParsed(parsed) {
42
+ if (!parsed) return {};
43
+ const result = {};
44
+ for (const [key, value] of Object.entries(parsed)) {
45
+ if (typeof value === "undefined") continue;
46
+ result[key] = value;
47
+ }
48
+ return result;
49
+ }
50
+ var DotEnvChannel = class {
51
+ dotenv;
52
+ targetPath;
53
+ absolutePath;
54
+ encoding;
55
+ parseOptions;
56
+ envSource;
57
+ constructor(dotenv, defaultPath = ".env", getOptions = {}, parseOptions = {}) {
58
+ this.dotenv = dotenv;
59
+ this.targetPath = (typeof getOptions.path === "string" ? getOptions.path : void 0) ?? defaultPath;
60
+ this.absolutePath = resolve(process.cwd(), this.targetPath);
61
+ this.encoding = getOptions.encoding ?? "utf8";
62
+ this.parseOptions = { ...parseOptions };
63
+ this.envSource = new EnvSource(this.targetPath);
64
+ }
65
+ async get() {
66
+ try {
67
+ const content = await readFile(this.absolutePath, { encoding: this.encoding });
68
+ return normalizeParsed(this.dotenv.parse(content, this.parseOptions));
69
+ } catch (error) {
70
+ if (isFileNotFound(error)) return {};
71
+ throw error;
72
+ }
73
+ }
74
+ async set(values) {
75
+ await this.envSource.write(values);
76
+ const parsed = await this.get();
77
+ const mismatches = [];
78
+ for (const [key, expected] of Object.entries(values)) {
79
+ const actual = parsed[key];
80
+ if (actual !== expected) mismatches.push(`${key}=expected(${JSON.stringify(expected)}) actual(${JSON.stringify(actual)})`);
81
+ }
82
+ if (mismatches.length > 0) throw new Error(`Failed to correctly write values to ${this.targetPath}: ${mismatches.join(", ")}`);
83
+ }
84
+ getPrimaryPath() {
85
+ return this.targetPath;
86
+ }
87
+ clearCache() {}
88
+ };
89
+
90
+ //#endregion
91
+ //#region ../channels/src/channels/dotenvx/DotEnvXChannel.ts
92
+ /**
93
+ * Simple DotEnvX implementation of EnvChannel that wraps @dotenvx/dotenvx library
94
+ * This is just an API mapping wrapper without caching or complex state management
95
+ */
96
+ var DotEnvXChannel = class {
97
+ dotenvx;
98
+ getOptions;
99
+ setOptions;
100
+ defaultPath;
101
+ /**
102
+ * Create a new DotEnvXChannel
103
+ * @param dotenvx - The dotenvx instance to use
104
+ * @param defaultPath - Default path for env files
105
+ * @param getOptions - Options for get operations
106
+ * @param setOptions - Options for set operations
107
+ */
108
+ constructor(dotenvx, defaultPath = ".env", getOptions = {}, setOptions = {}) {
109
+ this.dotenvx = dotenvx;
110
+ this.defaultPath = defaultPath;
111
+ this.getOptions = getOptions;
112
+ this.setOptions = setOptions;
113
+ }
114
+ /**
115
+ * Get all environment variables
116
+ * @returns Promise that resolves to object containing all environment variable key-value pairs
117
+ */
118
+ async get() {
119
+ try {
120
+ return this.dotenvx.config({
121
+ processEnv: {},
122
+ quiet: true,
123
+ ignore: ["MISSING_ENV_FILE"],
124
+ path: this.defaultPath,
125
+ ...this.getOptions
126
+ }).parsed || {};
127
+ } catch {
128
+ return {};
129
+ }
130
+ }
131
+ /**
132
+ * Set multiple environment variables
133
+ * @param values - Object containing key-value pairs to set
134
+ * @returns Promise that resolves when the values have been set
135
+ */
136
+ async set(values) {
137
+ if (!existsSync(this.defaultPath)) writeFileSync(this.defaultPath, "", "utf8");
138
+ try {
139
+ const options = {
140
+ path: this.defaultPath,
141
+ ...this.setOptions
142
+ };
143
+ for (const [key, value] of Object.entries(values)) this.dotenvx.set(key, value, options);
144
+ } catch (error) {
145
+ throw new Error(`Failed to set environment variables: ${error}`);
146
+ }
147
+ }
148
+ /**
149
+ * Get the primary path being used for env files
150
+ * @returns The primary path
151
+ */
152
+ getPrimaryPath() {
153
+ return this.defaultPath;
154
+ }
155
+ /**
156
+ * Clear any cached data (no-op for this implementation since we don't cache)
157
+ */
158
+ clearCache() {}
159
+ };
160
+
161
+ //#endregion
162
+ //#region ../channels/src/channels/processenv/ProcessEnvChannel.ts
163
+ /**
164
+ * EnvChannel implementation that works with process.env
165
+ * This channel reads from and writes to the current process environment
166
+ */
167
+ var ProcessEnvChannel = class {
168
+ /**
169
+ * Get all environment variables from process.env
170
+ * @returns Promise that resolves to object containing all environment variable key-value pairs
171
+ */
172
+ async get() {
173
+ const env = {};
174
+ for (const [key, value] of Object.entries(process.env)) if (value !== void 0) env[key] = value;
175
+ return env;
176
+ }
177
+ /**
178
+ * Set multiple environment variables in process.env
179
+ * @param values - Object containing key-value pairs to set
180
+ * @returns Promise that resolves when the values have been set
181
+ */
182
+ async set(values) {
183
+ for (const [key, value] of Object.entries(values)) process.env[key] = value;
184
+ }
185
+ };
186
+
187
+ //#endregion
188
+ //#region ../channels/src/resolveChannel.ts
189
+ /**
190
+ * Resolve channel options into an EnvChannel instance
191
+ * @param options - The channel options to resolve
192
+ * @param defaultPath - Default path to use for env files (default: ".env")
193
+ * @returns An EnvChannel instance
194
+ */
195
+ function resolveChannel(options, defaultPath = ".env") {
196
+ if (options === void 0 || options === "default") return new DefaultEnvChannel(defaultPath);
197
+ if (options === "processenv") return new ProcessEnvChannel();
198
+ if (typeof options === "object" && options !== null) {
199
+ if ("dotenv" in options) {
200
+ const { dotenv, get: getOptions = {}, parse: parseOptions = {}, path } = options;
201
+ if (!dotenv) throw new Error("Dotenv instance is required for dotenv channel");
202
+ const resolvedPath = path ?? defaultPath;
203
+ const mergedGetOptions = { ...getOptions };
204
+ if (typeof mergedGetOptions.path !== "string") mergedGetOptions.path = resolvedPath;
205
+ return new DotEnvChannel(dotenv, resolvedPath, mergedGetOptions, parseOptions ?? {});
206
+ }
207
+ if ("dotenvx" in options) {
208
+ const { dotenvx, get: getOptions = {}, set: setOptions = {} } = options;
209
+ if (!dotenvx) throw new Error("DotEnvX instance is required for dotenvx channel");
210
+ return new DotEnvXChannel(dotenvx, defaultPath, getOptions, setOptions);
211
+ }
212
+ if ("process" in options) {
213
+ if (options.process && typeof options.process === "object" && "env" in options.process) return new ProcessEnvChannel();
214
+ throw new Error("Invalid process object provided to channel config");
215
+ }
216
+ if ("name" in options) if (options.name === "default") return new DefaultEnvChannel(defaultPath);
217
+ else if (options.name === "processenv") return new ProcessEnvChannel();
218
+ else throw new Error(`Unknown channel name: ${options.name}`);
219
+ }
220
+ throw new Error(`Invalid channel options: ${options}`);
221
+ }
222
+
223
+ //#endregion
224
+ export { DefaultEnvChannel as a, DotEnvChannel as i, ProcessEnvChannel as n, DotEnvXChannel as r, resolveChannel as t };
package/dist/root.cjs ADDED
@@ -0,0 +1,36 @@
1
+ Object.defineProperty(exports, '__esModule', { value: true });
2
+ require('./EnvSource-BVnmdHku.cjs');
3
+ require('./resolveChannel-CjAuxy3p.cjs');
4
+ const require_src = require('./src-DWYoqPX1.cjs');
5
+ const require_src$1 = require('./src-meUnCASg.cjs');
6
+ require('./custom-D_Rqjm09.cjs');
7
+ require('./coerce-b7UVodS9.cjs');
8
+ const require_src$2 = require('./src-XjL5cyPG.cjs');
9
+ const require_src$3 = require('./src-Cjo2XA4n.cjs');
10
+ require('./redis-EcC7TX3K.cjs');
11
+ const require_src$4 = require('./src-DZmpNGrQ.cjs');
12
+ const require_vars = require('./vars-CYOaskkK.cjs');
13
+
14
+ //#region src/root.ts
15
+ var root_default = {
16
+ parse: require_src$3.parse,
17
+ prompt: require_src.prompt,
18
+ define: require_src$2.define
19
+ };
20
+
21
+ //#endregion
22
+ exports.default = root_default;
23
+ exports.define = require_src$2.define;
24
+ exports.parse = require_src$3.parse;
25
+ exports.preprocessors = require_src$1.preprocessors;
26
+ exports.processors = require_src$1.processors;
27
+ exports.prompt = require_src.prompt;
28
+ exports.s = require_src$1.s;
29
+ exports.schema = require_src$1.schema;
30
+ Object.defineProperty(exports, 'schemas', {
31
+ enumerable: true,
32
+ get: function () {
33
+ return require_src$4.src_exports;
34
+ }
35
+ });
36
+ exports.vars = require_vars.vars;
@@ -0,0 +1,21 @@
1
+ import "./EnvChannelOptions-BPkWDrmr.cjs";
2
+ import "./StringEnvVarSchema-BF6C0nyT.cjs";
3
+ import { _ as preprocessors, v as processors } from "./validate-BxA3a-ns.cjs";
4
+ import "./BooleanMap-B2eIP3tZ.cjs";
5
+ import "./EnvChannel-LMIRYvT1.cjs";
6
+ import { n as schema, t as s } from "./schema-DH4GiW9A.cjs";
7
+ import "./EnvModel-CrGclUpJ.cjs";
8
+ import { t as define } from "./model-ft0WhSSS.cjs";
9
+ import { t as parse } from "./parse-BT1QSa5e.cjs";
10
+ import { t as prompt } from "./prompt-C5WudV9x.cjs";
11
+ import { t as index_d_exports } from "./index-D8pslhp4.cjs";
12
+ import { t as vars } from "./vars-CptZRPX5.cjs";
13
+
14
+ //#region src/root.d.ts
15
+ declare const _default: {
16
+ parse: typeof parse;
17
+ prompt: typeof prompt;
18
+ define: typeof define;
19
+ };
20
+ //#endregion
21
+ export { _default as default, define, parse, preprocessors, processors, prompt, s, schema, index_d_exports as schemas, vars };
package/dist/root.d.ts ADDED
@@ -0,0 +1,21 @@
1
+ import "./EnvChannelOptions-CRwDLWjd.js";
2
+ import "./StringEnvVarSchema-B8MT7htU.js";
3
+ import { _ as preprocessors, v as processors } from "./validate-CyxrRacF.js";
4
+ import "./BooleanMap-DmFnCA-O.js";
5
+ import "./EnvChannel-w27PEm7x.js";
6
+ import { n as schema, t as s } from "./schema-jN4EtvEP.js";
7
+ import "./EnvModel-D8rt0EJ6.js";
8
+ import { t as define } from "./model-Dic8IJsf.js";
9
+ import { t as parse } from "./parse-DwtLpVhC.js";
10
+ import { t as prompt } from "./prompt-yKdccbtZ.js";
11
+ import { t as index_d_exports } from "./index-Dq_0aeAL.js";
12
+ import { t as vars } from "./vars-BNVI6k89.js";
13
+
14
+ //#region src/root.d.ts
15
+ declare const _default: {
16
+ parse: typeof parse;
17
+ prompt: typeof prompt;
18
+ define: typeof define;
19
+ };
20
+ //#endregion
21
+ export { _default as default, define, parse, preprocessors, processors, prompt, s, schema, index_d_exports as schemas, vars };
package/dist/root.js ADDED
@@ -0,0 +1,21 @@
1
+ import "./EnvSource-DA3ZGlES.js";
2
+ import "./resolveChannel-v9BDsw-M.js";
3
+ import { t as prompt } from "./src-Dtv7TlJx.js";
4
+ import { i as preprocessors, n as schema, t as s, u as processors } from "./src-CLTURaoo.js";
5
+ import "./custom-Bt_wnxIu.js";
6
+ import "./coerce-DNIuYAx4.js";
7
+ import { t as define } from "./src-CVdUqK3q.js";
8
+ import { t as parse } from "./src-BBwjK5SK.js";
9
+ import "./redis-CJOpRPjc.js";
10
+ import { t as src_exports } from "./src-B7FG1rak.js";
11
+ import { t as vars } from "./vars-DOW0LiiN.js";
12
+
13
+ //#region src/root.ts
14
+ var root_default = {
15
+ parse,
16
+ prompt,
17
+ define
18
+ };
19
+
20
+ //#endregion
21
+ export { root_default as default, define, parse, preprocessors, processors, prompt, s, schema, src_exports as schemas, vars };
@@ -0,0 +1,18 @@
1
+ import { a as EnumEnvVarSchema, c as BooleanEnvVarSchemaInput, i as NumberEnvVarSchemaInput, n as StringEnvVarSchemaInput, o as EnumEnvVarSchemaInput, r as NumberEnvVarSchema, s as BooleanEnvVarSchema, t as StringEnvVarSchema } from "./StringEnvVarSchema-BF6C0nyT.cjs";
2
+
3
+ //#region ../core/src/schemas/schema.d.ts
4
+
5
+ declare const schema: {
6
+ string: (input?: StringEnvVarSchemaInput) => StringEnvVarSchema;
7
+ number: (input?: NumberEnvVarSchemaInput) => NumberEnvVarSchema;
8
+ boolean: (input?: BooleanEnvVarSchemaInput) => BooleanEnvVarSchema;
9
+ enum: <T extends string = string>(input: EnumEnvVarSchemaInput<T>) => EnumEnvVarSchema<T>;
10
+ };
11
+ declare const s: {
12
+ string: (input?: StringEnvVarSchemaInput) => StringEnvVarSchema;
13
+ number: (input?: NumberEnvVarSchemaInput) => NumberEnvVarSchema;
14
+ boolean: (input?: BooleanEnvVarSchemaInput) => BooleanEnvVarSchema;
15
+ enum: <T extends string = string>(input: EnumEnvVarSchemaInput<T>) => EnumEnvVarSchema<T>;
16
+ };
17
+ //#endregion
18
+ export { schema as n, s as t };
@@ -0,0 +1,18 @@
1
+ import { a as EnumEnvVarSchema, c as BooleanEnvVarSchemaInput, i as NumberEnvVarSchemaInput, n as StringEnvVarSchemaInput, o as EnumEnvVarSchemaInput, r as NumberEnvVarSchema, s as BooleanEnvVarSchema, t as StringEnvVarSchema } from "./StringEnvVarSchema-B8MT7htU.js";
2
+
3
+ //#region ../core/src/schemas/schema.d.ts
4
+
5
+ declare const schema: {
6
+ string: (input?: StringEnvVarSchemaInput) => StringEnvVarSchema;
7
+ number: (input?: NumberEnvVarSchemaInput) => NumberEnvVarSchema;
8
+ boolean: (input?: BooleanEnvVarSchemaInput) => BooleanEnvVarSchema;
9
+ enum: <T extends string = string>(input: EnumEnvVarSchemaInput<T>) => EnumEnvVarSchema<T>;
10
+ };
11
+ declare const s: {
12
+ string: (input?: StringEnvVarSchemaInput) => StringEnvVarSchema;
13
+ number: (input?: NumberEnvVarSchemaInput) => NumberEnvVarSchema;
14
+ boolean: (input?: BooleanEnvVarSchemaInput) => BooleanEnvVarSchema;
15
+ enum: <T extends string = string>(input: EnumEnvVarSchemaInput<T>) => EnumEnvVarSchema<T>;
16
+ };
17
+ //#endregion
18
+ export { schema as n, s as t };