@tmrp/env 0.1.0-alpha.0 → 0.1.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.
Files changed (56) hide show
  1. package/README.md +72 -18
  2. package/dist/create-env.d.ts +8 -4
  3. package/dist/create-env.d.ts.map +1 -1
  4. package/dist/create-env.js +8 -4
  5. package/dist/create-env.js.map +1 -1
  6. package/dist/effects/create-env-effect.d.ts +2 -2
  7. package/dist/effects/create-env-effect.d.ts.map +1 -1
  8. package/dist/effects/create-env-effect.js +2 -2
  9. package/dist/effects/create-env-effect.js.map +1 -1
  10. package/dist/effects/env-parse-value-effect.d.ts +2 -1
  11. package/dist/effects/env-parse-value-effect.d.ts.map +1 -1
  12. package/dist/effects/env-parse-value-effect.js +7 -2
  13. package/dist/effects/env-parse-value-effect.js.map +1 -1
  14. package/dist/effects/env-read-value-effect.d.ts +2 -1
  15. package/dist/effects/env-read-value-effect.d.ts.map +1 -1
  16. package/dist/effects/env-read-value-effect.js +7 -1
  17. package/dist/effects/env-read-value-effect.js.map +1 -1
  18. package/dist/lib/types.d.ts +3 -0
  19. package/dist/lib/types.d.ts.map +1 -1
  20. package/dist/runtime/browser/create-browser-env.d.ts +7 -3
  21. package/dist/runtime/browser/create-browser-env.d.ts.map +1 -1
  22. package/dist/runtime/browser/create-browser-env.js +7 -3
  23. package/dist/runtime/browser/create-browser-env.js.map +1 -1
  24. package/dist/runtime/bun/create-bun-env.d.ts +7 -3
  25. package/dist/runtime/bun/create-bun-env.d.ts.map +1 -1
  26. package/dist/runtime/bun/create-bun-env.js +7 -3
  27. package/dist/runtime/bun/create-bun-env.js.map +1 -1
  28. package/dist/runtime/cloudflare/create-cloudflare-env.d.ts +7 -3
  29. package/dist/runtime/cloudflare/create-cloudflare-env.d.ts.map +1 -1
  30. package/dist/runtime/cloudflare/create-cloudflare-env.js +7 -3
  31. package/dist/runtime/cloudflare/create-cloudflare-env.js.map +1 -1
  32. package/dist/runtime/deno/create-deno-env.d.ts +7 -3
  33. package/dist/runtime/deno/create-deno-env.d.ts.map +1 -1
  34. package/dist/runtime/deno/create-deno-env.js +7 -3
  35. package/dist/runtime/deno/create-deno-env.js.map +1 -1
  36. package/dist/runtime/import-meta/create-import-meta-env.d.ts +7 -3
  37. package/dist/runtime/import-meta/create-import-meta-env.d.ts.map +1 -1
  38. package/dist/runtime/import-meta/create-import-meta-env.js +7 -3
  39. package/dist/runtime/import-meta/create-import-meta-env.js.map +1 -1
  40. package/dist/runtime/netlify/create-netlify-env.d.ts +7 -3
  41. package/dist/runtime/netlify/create-netlify-env.d.ts.map +1 -1
  42. package/dist/runtime/netlify/create-netlify-env.js +7 -3
  43. package/dist/runtime/netlify/create-netlify-env.js.map +1 -1
  44. package/dist/runtime/node/create-node-env.d.ts +7 -3
  45. package/dist/runtime/node/create-node-env.d.ts.map +1 -1
  46. package/dist/runtime/node/create-node-env.js +7 -3
  47. package/dist/runtime/node/create-node-env.js.map +1 -1
  48. package/dist/runtime/record/create-record-env.d.ts +7 -3
  49. package/dist/runtime/record/create-record-env.d.ts.map +1 -1
  50. package/dist/runtime/record/create-record-env.js +7 -3
  51. package/dist/runtime/record/create-record-env.js.map +1 -1
  52. package/dist/runtime/vercel/create-vercel-edge-env.d.ts +7 -3
  53. package/dist/runtime/vercel/create-vercel-edge-env.d.ts.map +1 -1
  54. package/dist/runtime/vercel/create-vercel-edge-env.js +7 -3
  55. package/dist/runtime/vercel/create-vercel-edge-env.js.map +1 -1
  56. package/package.json +17 -15
package/README.md CHANGED
@@ -14,6 +14,7 @@ Cloudflare Workers, Vercel Edge, Netlify, browser-injected config, and
14
14
  - Validate environment variables with any Zod schema.
15
15
  - Infer TypeScript types from your schema definitions.
16
16
  - Fail fast when required environment variables are missing.
17
+ - Skip validation for build or CI steps where runtime env vars are unavailable.
17
18
  - Trim string values before validation.
18
19
  - Support Node.js `process.env`, Deno `Deno.env.get`, Bun `Bun.env`, and known
19
20
  global env records.
@@ -328,6 +329,46 @@ const env = createEnv({
328
329
  });
329
330
  ```
330
331
 
332
+ ## Skipping Validation
333
+
334
+ Use `skipValidation` when code needs to import or initialize an env module in a
335
+ context where runtime environment variables are not available, such as CI,
336
+ documentation builds, static analysis, or framework build steps.
337
+
338
+ ```ts
339
+ import { createEnv } from "@tmrp/env";
340
+ import z from "zod";
341
+
342
+ export const env = createEnv(
343
+ {
344
+ API_URL: z.url(),
345
+ DATABASE_URL: z.url(),
346
+ PORT: z.coerce.number().int().positive(),
347
+ },
348
+ { skipValidation: process.env.CI === "true" }
349
+ );
350
+ ```
351
+
352
+ When `skipValidation` is enabled, missing variables are returned as `undefined`
353
+ instead of throwing, and existing values are returned raw. Zod parsing,
354
+ validation, coercion, transforms, and defaults are not applied.
355
+
356
+ ```ts
357
+ const env = createEnv(
358
+ {
359
+ PORT: z.coerce.number(),
360
+ SECRET_KEY: z.string().min(32),
361
+ },
362
+ { skipValidation: true }
363
+ );
364
+
365
+ env.PORT; // raw string value, or undefined when unavailable
366
+ env.SECRET_KEY; // raw string value, or undefined when unavailable
367
+ ```
368
+
369
+ This option is intended for non-runtime code paths. Do not use it for application
370
+ startup if the returned values will be used as validated configuration.
371
+
331
372
  ## Error Behavior
332
373
 
333
374
  All creators run synchronously and throw on failure.
@@ -345,7 +386,8 @@ Environment variable "PORT" failed validation: ...
345
386
  ```
346
387
 
347
388
  This behavior is intentional: configuration errors should fail application
348
- startup immediately.
389
+ startup immediately. When `skipValidation` is enabled, missing and invalid
390
+ values do not throw.
349
391
 
350
392
  ## Example `.env`
351
393
 
@@ -360,62 +402,71 @@ An example file is included at `.env.example`.
360
402
 
361
403
  ## API Reference
362
404
 
363
- ### `createEnv(envKeys)`
405
+ ### `createEnv(envKeys, options?)`
364
406
 
365
407
  Reads variables from the detected Bun, Node, or Deno runtime and validates them.
366
408
 
367
409
  ```ts
410
+ type Options = {
411
+ skipValidation?: boolean;
412
+ };
413
+
368
414
  function createEnv<const TEnvKeys extends Record<string, ZodType>>(
369
- envKeys: TEnvKeys
415
+ envKeys: TEnvKeys,
416
+ options?: Options
370
417
  ): { [K in keyof TEnvKeys]: z.infer<TEnvKeys[K]> };
371
418
  ```
372
419
 
373
420
  Use this from `@tmrp/env`.
374
421
 
375
- ### `createBunEnv(envKeys)`
422
+ ### `createBunEnv(envKeys, options?)`
376
423
 
377
424
  Reads variables from Bun `Bun.env` and validates them.
378
425
 
379
426
  ```ts
380
427
  function createBunEnv<const TEnvKeys extends Record<string, ZodType>>(
381
- envKeys: TEnvKeys
428
+ envKeys: TEnvKeys,
429
+ options?: Options
382
430
  ): { [K in keyof TEnvKeys]: z.infer<TEnvKeys[K]> };
383
431
  ```
384
432
 
385
433
  Use this from `@tmrp/env/bun`.
386
434
 
387
- ### `createNodeEnv(envKeys)`
435
+ ### `createNodeEnv(envKeys, options?)`
388
436
 
389
437
  Reads variables from Node.js `process.env` and validates them.
390
438
 
391
439
  ```ts
392
440
  function createNodeEnv<const TEnvKeys extends Record<string, ZodType>>(
393
- envKeys: TEnvKeys
441
+ envKeys: TEnvKeys,
442
+ options?: Options
394
443
  ): { [K in keyof TEnvKeys]: z.infer<TEnvKeys[K]> };
395
444
  ```
396
445
 
397
446
  Use this from `@tmrp/env/node`.
398
447
 
399
- ### `createDenoEnv(envKeys)`
448
+ ### `createDenoEnv(envKeys, options?)`
400
449
 
401
450
  Reads variables from Deno `Deno.env.get` and validates them.
402
451
 
403
452
  ```ts
404
453
  function createDenoEnv<const TEnvKeys extends Record<string, ZodType>>(
405
- envKeys: TEnvKeys
454
+ envKeys: TEnvKeys,
455
+ options?: Options
406
456
  ): { [K in keyof TEnvKeys]: z.infer<TEnvKeys[K]> };
407
457
  ```
408
458
 
409
459
  Use this from `@tmrp/env/deno`.
410
460
 
411
- ### `createRecordEnv(envKeys, record)`
461
+ ### `createRecordEnv(envKeys, record, options?)`
412
462
 
413
463
  Reads variables from an explicit object and validates them.
414
464
 
415
465
  ```ts
416
466
  function createRecordEnv<const TEnvKeys extends Record<string, ZodType>>(
417
467
  envKeys: TEnvKeys,
418
- record: Record<string, unknown>
468
+ record: Record<string, unknown>,
469
+ options?: Options
419
470
  ): { [K in keyof TEnvKeys]: z.infer<TEnvKeys[K]> };
420
471
  ```
421
472
 
@@ -426,13 +477,16 @@ Use this from `@tmrp/env/record`.
426
477
  These entry points all use the same explicit-record validation model, but expose
427
478
  runtime-specific names for clearer application code:
428
479
 
429
- | Entry point | Function |
430
- | ----------------------- | --------------------------------------------- |
431
- | `@tmrp/env/cloudflare` | `createCloudflareEnv(envKeys, bindings)` |
432
- | `@tmrp/env/vercel-edge` | `createVercelEdgeEnv(envKeys, env)` |
433
- | `@tmrp/env/netlify` | `createNetlifyEnv(envKeys, env)` |
434
- | `@tmrp/env/browser` | `createBrowserEnv(envKeys, env)` |
435
- | `@tmrp/env/import-meta` | `createImportMetaEnv(envKeys, importMetaEnv)` |
480
+ | Entry point | Function |
481
+ | ----------------------- | ------------------------------------------------------- |
482
+ | `@tmrp/env/cloudflare` | `createCloudflareEnv(envKeys, bindings, options?)` |
483
+ | `@tmrp/env/vercel-edge` | `createVercelEdgeEnv(envKeys, env, options?)` |
484
+ | `@tmrp/env/netlify` | `createNetlifyEnv(envKeys, env, options?)` |
485
+ | `@tmrp/env/browser` | `createBrowserEnv(envKeys, env, options?)` |
486
+ | `@tmrp/env/import-meta` | `createImportMetaEnv(envKeys, importMetaEnv, options?)` |
487
+
488
+ All creators accept the same `Options` object. Set `skipValidation: true` to
489
+ return raw values and `undefined` for unavailable variables instead of throwing.
436
490
 
437
491
  ## Development
438
492
 
@@ -1,4 +1,4 @@
1
- import type { EnvKeys } from "./lib/types.js";
1
+ import type { EnvKeys, Options } from "./lib/types.js";
2
2
  /**
3
3
  * Creates a typed environment object from the currently available runtime.
4
4
  *
@@ -13,7 +13,7 @@ import type { EnvKeys } from "./lib/types.js";
13
13
  *
14
14
  * @example
15
15
  * ```ts
16
- * import { createEnv } from "@tmrp/env/default";
16
+ * import { createEnv } from "@tmrp/env";
17
17
  * import z from "zod";
18
18
  *
19
19
  * const env = createEnv({
@@ -24,8 +24,12 @@ import type { EnvKeys } from "./lib/types.js";
24
24
  * ```
25
25
  *
26
26
  * @param envKeys Environment variable names mapped to Zod schemas.
27
+ * @param options Parsing options. Set `skipValidation` to return raw values and
28
+ * `undefined` for unavailable variables instead of throwing, such as during CI
29
+ * or build steps where runtime env vars are not present.
27
30
  * @returns A strongly typed object inferred from `envKeys`.
28
- * @throws When a configured variable is missing or fails validation.
31
+ * @throws When a configured variable is missing or fails validation, unless
32
+ * `options.skipValidation` is enabled.
29
33
  */
30
- export declare function createEnv<const TEnvKeys extends EnvKeys>(envKeys: TEnvKeys): import("./lib/types.js").Env<TEnvKeys>;
34
+ export declare function createEnv<const TEnvKeys extends EnvKeys>(envKeys: TEnvKeys, options?: Options): import("./lib/types.js").Env<TEnvKeys>;
31
35
  //# sourceMappingURL=create-env.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-env.d.ts","sourceRoot":"","sources":["../src/create-env.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAM9C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,SAAS,CAAC,KAAK,CAAC,QAAQ,SAAS,OAAO,EAAE,OAAO,EAAE,QAAQ,0CAE1E"}
1
+ {"version":3,"file":"create-env.d.ts","sourceRoot":"","sources":["../src/create-env.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAMvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,SAAS,CAAC,KAAK,CAAC,QAAQ,SAAS,OAAO,EACtD,OAAO,EAAE,QAAQ,EACjB,OAAO,CAAC,EAAE,OAAO,0CAGlB"}
@@ -15,7 +15,7 @@ import { RuntimeGlobalsSchema } from "./lib/schema.js";
15
15
  *
16
16
  * @example
17
17
  * ```ts
18
- * import { createEnv } from "@tmrp/env/default";
18
+ * import { createEnv } from "@tmrp/env";
19
19
  * import z from "zod";
20
20
  *
21
21
  * const env = createEnv({
@@ -26,10 +26,14 @@ import { RuntimeGlobalsSchema } from "./lib/schema.js";
26
26
  * ```
27
27
  *
28
28
  * @param envKeys Environment variable names mapped to Zod schemas.
29
+ * @param options Parsing options. Set `skipValidation` to return raw values and
30
+ * `undefined` for unavailable variables instead of throwing, such as during CI
31
+ * or build steps where runtime env vars are not present.
29
32
  * @returns A strongly typed object inferred from `envKeys`.
30
- * @throws When a configured variable is missing or fails validation.
33
+ * @throws When a configured variable is missing or fails validation, unless
34
+ * `options.skipValidation` is enabled.
31
35
  */
32
- export function createEnv(envKeys) {
33
- return createEnvEffect(envKeys, RuntimeGlobalsSchema, readEnvEffect);
36
+ export function createEnv(envKeys, options) {
37
+ return createEnvEffect(envKeys, RuntimeGlobalsSchema, readEnvEffect, options);
34
38
  }
35
39
  //# sourceMappingURL=create-env.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-env.js","sourceRoot":"","sources":["../src/create-env.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,UAAU,SAAS,CAAiC,OAAiB;IACzE,OAAO,eAAe,CAAC,OAAO,EAAE,oBAAoB,EAAE,aAAa,CAAC,CAAC;AACvE,CAAC"}
1
+ {"version":3,"file":"create-env.js","sourceRoot":"","sources":["../src/create-env.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,UAAU,SAAS,CACvB,OAAiB,EACjB,OAAiB;IAEjB,OAAO,eAAe,CAAC,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;AAChF,CAAC"}
@@ -1,4 +1,4 @@
1
1
  import type { RuntimeGlobalsSchemaType } from "../lib/schema.js";
2
- import type { Env, EnvKeys } from "../lib/types.js";
3
- export declare function createEnvEffect<const TEnvKeys extends EnvKeys>(envKeys: TEnvKeys, runtimeSchema: RuntimeGlobalsSchemaType, runtimeEnvReadEffect: (key: string, schema: RuntimeGlobalsSchemaType) => unknown): Env<TEnvKeys>;
2
+ import type { Env, EnvKeys, Options } from "../lib/types.js";
3
+ export declare function createEnvEffect<const TEnvKeys extends EnvKeys>(envKeys: TEnvKeys, runtimeSchema: RuntimeGlobalsSchemaType, runtimeEnvReadEffect: (key: string, schema: RuntimeGlobalsSchemaType) => unknown, options?: Options): Env<TEnvKeys>;
4
4
  //# sourceMappingURL=create-env-effect.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-env-effect.d.ts","sourceRoot":"","sources":["../../src/effects/create-env-effect.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAKpD,wBAAgB,eAAe,CAAC,KAAK,CAAC,QAAQ,SAAS,OAAO,EAC5D,OAAO,EAAE,QAAQ,EACjB,aAAa,EAAE,wBAAwB,EACvC,oBAAoB,EAAE,CACpB,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,wBAAwB,KAC7B,OAAO,GAaE,GAAG,CAAC,QAAQ,CAAC,CAC5B"}
1
+ {"version":3,"file":"create-env-effect.d.ts","sourceRoot":"","sources":["../../src/effects/create-env-effect.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAK7D,wBAAgB,eAAe,CAAC,KAAK,CAAC,QAAQ,SAAS,OAAO,EAC5D,OAAO,EAAE,QAAQ,EACjB,aAAa,EAAE,wBAAwB,EACvC,oBAAoB,EAAE,CACpB,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,wBAAwB,KAC7B,OAAO,EACZ,OAAO,CAAC,EAAE,OAAO,GAiBH,GAAG,CAAC,QAAQ,CAAC,CAC5B"}
@@ -1,8 +1,8 @@
1
1
  import { Effect } from "effect";
2
2
  import { envParseValueEffect } from "./env-parse-value-effect.js";
3
3
  import { envReadValueEffect } from "./env-read-value-effect.js";
4
- export function createEnvEffect(envKeys, runtimeSchema, runtimeEnvReadEffect) {
5
- const env = Effect.runSync(Effect.forEach(Object.entries(envKeys), ([key, schema]) => envReadValueEffect(key, (env) => runtimeEnvReadEffect(env, runtimeSchema)).pipe(Effect.flatMap((value) => envParseValueEffect(key, schema, value)), Effect.map((value) => [key, value]))).pipe(Effect.map((entries) => Object.fromEntries(entries))));
4
+ export function createEnvEffect(envKeys, runtimeSchema, runtimeEnvReadEffect, options) {
5
+ const env = Effect.runSync(Effect.forEach(Object.entries(envKeys), ([key, schema]) => envReadValueEffect(key, (env) => runtimeEnvReadEffect(env, runtimeSchema), options).pipe(Effect.flatMap((value) => envParseValueEffect(key, schema, value, options)), Effect.map((value) => [key, value]))).pipe(Effect.map((entries) => Object.fromEntries(entries))));
6
6
  return env;
7
7
  }
8
8
  //# sourceMappingURL=create-env-effect.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-env-effect.js","sourceRoot":"","sources":["../../src/effects/create-env-effect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAKhC,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,MAAM,UAAU,eAAe,CAC7B,OAAiB,EACjB,aAAuC,EACvC,oBAGY;IAEZ,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CACxB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,EAAE,CACxD,kBAAkB,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,EAAE,CAC9B,oBAAoB,CAAC,GAAG,EAAE,aAAa,CAAC,CACzC,CAAC,IAAI,CACJ,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,EAClE,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,KAAK,CAAU,CAAC,CAC7C,CACF,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAC7D,CAAC;IAEF,OAAO,GAAoB,CAAC;AAC9B,CAAC"}
1
+ {"version":3,"file":"create-env-effect.js","sourceRoot":"","sources":["../../src/effects/create-env-effect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAKhC,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,MAAM,UAAU,eAAe,CAC7B,OAAiB,EACjB,aAAuC,EACvC,oBAGY,EACZ,OAAiB;IAEjB,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CACxB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,EAAE,CACxD,kBAAkB,CAChB,GAAG,EACH,CAAC,GAAG,EAAE,EAAE,CAAC,oBAAoB,CAAC,GAAG,EAAE,aAAa,CAAC,EACjD,OAAO,CACR,CAAC,IAAI,CACJ,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CACvB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CACjD,EACD,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,KAAK,CAAU,CAAC,CAC7C,CACF,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAC7D,CAAC;IAEF,OAAO,GAAoB,CAAC;AAC9B,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import type { ZodType } from "zod";
2
2
  import { Effect } from "effect";
3
- export declare const envParseValueEffect: (key: string, schema: ZodType, value: unknown) => Effect.Effect<unknown, Error, never>;
3
+ import type { Options } from "../lib/types.js";
4
+ export declare const envParseValueEffect: (key: string, schema: ZodType, value: unknown, options?: Options) => Effect.Effect<unknown, Error, never>;
4
5
  //# sourceMappingURL=env-parse-value-effect.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"env-parse-value-effect.d.ts","sourceRoot":"","sources":["../../src/effects/env-parse-value-effect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAEnC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,eAAO,MAAM,mBAAmB,GAC9B,KAAK,MAAM,EACX,QAAQ,OAAO,EACf,OAAO,OAAO,yCAQZ,CAAC"}
1
+ {"version":3,"file":"env-parse-value-effect.d.ts","sourceRoot":"","sources":["../../src/effects/env-parse-value-effect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAEnC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE/C,eAAO,MAAM,mBAAmB,GAC9B,KAAK,MAAM,EACX,QAAQ,OAAO,EACf,OAAO,OAAO,EACd,UAAU,OAAO,yCAcf,CAAC"}
@@ -1,6 +1,11 @@
1
1
  import { Effect } from "effect";
2
- export const envParseValueEffect = (key, schema, value) => Effect.try({
3
- try: () => schema.parse(value),
2
+ export const envParseValueEffect = (key, schema, value, options) => Effect.try({
3
+ try: () => {
4
+ if (options?.skipValidation) {
5
+ return value;
6
+ }
7
+ return schema.parse(value);
8
+ },
4
9
  catch: (error) => new Error(`Environment variable "${key}" failed validation: ${error}`, {
5
10
  cause: error,
6
11
  }),
@@ -1 +1 @@
1
- {"version":3,"file":"env-parse-value-effect.js","sourceRoot":"","sources":["../../src/effects/env-parse-value-effect.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,GAAW,EACX,MAAe,EACf,KAAc,EACd,EAAE,CACF,MAAM,CAAC,GAAG,CAAC;IACT,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;IAC9B,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CACf,IAAI,KAAK,CAAC,yBAAyB,GAAG,wBAAwB,KAAK,EAAE,EAAE;QACrE,KAAK,EAAE,KAAK;KACb,CAAC;CACL,CAAC,CAAC"}
1
+ {"version":3,"file":"env-parse-value-effect.js","sourceRoot":"","sources":["../../src/effects/env-parse-value-effect.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIhC,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,GAAW,EACX,MAAe,EACf,KAAc,EACd,OAAiB,EACjB,EAAE,CACF,MAAM,CAAC,GAAG,CAAC;IACT,GAAG,EAAE,GAAG,EAAE;QACR,IAAI,OAAO,EAAE,cAAc,EAAE,CAAC;YAC5B,OAAO,KAAK,CAAC;QACf,CAAC;QAED,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;IACD,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CACf,IAAI,KAAK,CAAC,yBAAyB,GAAG,wBAAwB,KAAK,EAAE,EAAE;QACrE,KAAK,EAAE,KAAK;KACb,CAAC;CACL,CAAC,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { Effect } from "effect";
2
+ import type { Options } from "../lib/types.js";
2
3
  type Key = string;
3
4
  type readRuntimeEnvEffect = (key: Key) => unknown;
4
- export declare const envReadValueEffect: (key: Key, readRuntimeEnvEffect: readRuntimeEnvEffect) => Effect.Effect<{}, Error, never>;
5
+ export declare const envReadValueEffect: (key: Key, readRuntimeEnvEffect: readRuntimeEnvEffect, options?: Options) => Effect.Effect<unknown, Error>;
5
6
  export {};
6
7
  //# sourceMappingURL=env-read-value-effect.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"env-read-value-effect.d.ts","sourceRoot":"","sources":["../../src/effects/env-read-value-effect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,KAAK,GAAG,GAAG,MAAM,CAAC;AAElB,KAAK,oBAAoB,GAAG,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC;AAElD,eAAO,MAAM,kBAAkB,GAC7B,KAAK,GAAG,EACR,sBAAsB,oBAAoB,oCAMzC,CAAC"}
1
+ {"version":3,"file":"env-read-value-effect.d.ts","sourceRoot":"","sources":["../../src/effects/env-read-value-effect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE/C,KAAK,GAAG,GAAG,MAAM,CAAC;AAElB,KAAK,oBAAoB,GAAG,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC;AAElD,eAAO,MAAM,kBAAkB,GAC7B,KAAK,GAAG,EACR,sBAAsB,oBAAoB,EAC1C,UAAU,OAAO,KAChB,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAY9B,CAAC"}
@@ -1,3 +1,9 @@
1
1
  import { Effect } from "effect";
2
- export const envReadValueEffect = (key, readRuntimeEnvEffect) => Effect.fromNullable(readRuntimeEnvEffect(key)).pipe(Effect.mapError(() => new Error(`Environment variable "${key}" is not defined`)));
2
+ export const envReadValueEffect = (key, readRuntimeEnvEffect, options) => {
3
+ const value = readRuntimeEnvEffect(key);
4
+ if (options?.skipValidation) {
5
+ return Effect.succeed(value);
6
+ }
7
+ return Effect.fromNullable(value).pipe(Effect.mapError(() => new Error(`Environment variable "${key}" is not defined`)));
8
+ };
3
9
  //# sourceMappingURL=env-read-value-effect.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"env-read-value-effect.js","sourceRoot":"","sources":["../../src/effects/env-read-value-effect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAMhC,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,GAAQ,EACR,oBAA0C,EAC1C,EAAE,CACF,MAAM,CAAC,YAAY,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CACjD,MAAM,CAAC,QAAQ,CACb,GAAG,EAAE,CAAC,IAAI,KAAK,CAAC,yBAAyB,GAAG,kBAAkB,CAAC,CAChE,CACF,CAAC"}
1
+ {"version":3,"file":"env-read-value-effect.js","sourceRoot":"","sources":["../../src/effects/env-read-value-effect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAQhC,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,GAAQ,EACR,oBAA0C,EAC1C,OAAiB,EACc,EAAE;IACjC,MAAM,KAAK,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC;IAExC,IAAI,OAAO,EAAE,cAAc,EAAE,CAAC;QAC5B,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAED,OAAO,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,IAAI,CACpC,MAAM,CAAC,QAAQ,CACb,GAAG,EAAE,CAAC,IAAI,KAAK,CAAC,yBAAyB,GAAG,kBAAkB,CAAC,CAChE,CACF,CAAC;AACJ,CAAC,CAAC"}
@@ -4,4 +4,7 @@ export type Env<TEnvKeys extends EnvKeys> = {
4
4
  };
5
5
  export type EnvKeys = Record<string, ZodType>;
6
6
  export type EnvRecord = object;
7
+ export type Options = {
8
+ skipValidation?: boolean;
9
+ };
7
10
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAEtC,MAAM,MAAM,GAAG,CAAC,QAAQ,SAAS,OAAO,IAAI;KACzC,CAAC,IAAI,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;CAC5C,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE9C,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAEtC,MAAM,MAAM,GAAG,CAAC,QAAQ,SAAS,OAAO,IAAI;KACzC,CAAC,IAAI,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;CAC5C,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE9C,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAE/B,MAAM,MAAM,OAAO,GAAG;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { EnvKeys, EnvRecord } from "../../lib/types.js";
1
+ import type { EnvKeys, EnvRecord, Options } from "../../lib/types.js";
2
2
  /**
3
3
  * Creates a typed environment object from an explicit browser config object.
4
4
  *
@@ -19,8 +19,12 @@ import type { EnvKeys, EnvRecord } from "../../lib/types.js";
19
19
  *
20
20
  * @param envKeys Environment variable names mapped to Zod schemas.
21
21
  * @param env Browser config object to read values from.
22
+ * @param options Parsing options. Set `skipValidation` to return raw values and
23
+ * `undefined` for unavailable values instead of throwing, such as during CI or
24
+ * build steps where runtime env vars are not present.
22
25
  * @returns A strongly typed object inferred from `envKeys`.
23
- * @throws When a configured value is missing or fails validation.
26
+ * @throws When a configured value is missing or fails validation, unless
27
+ * `options.skipValidation` is enabled.
24
28
  */
25
- export declare function createBrowserEnv<const TEnvKeys extends EnvKeys>(envKeys: TEnvKeys, env: EnvRecord): import("../../lib/types.js").Env<TEnvKeys>;
29
+ export declare function createBrowserEnv<const TEnvKeys extends EnvKeys>(envKeys: TEnvKeys, env: EnvRecord, options?: Options): import("../../lib/types.js").Env<TEnvKeys>;
26
30
  //# sourceMappingURL=create-browser-env.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-browser-env.d.ts","sourceRoot":"","sources":["../../../src/runtime/browser/create-browser-env.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAI7D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,CAAC,QAAQ,SAAS,OAAO,EAC7D,OAAO,EAAE,QAAQ,EACjB,GAAG,EAAE,SAAS,8CAGf"}
1
+ {"version":3,"file":"create-browser-env.d.ts","sourceRoot":"","sources":["../../../src/runtime/browser/create-browser-env.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAItE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,CAAC,QAAQ,SAAS,OAAO,EAC7D,OAAO,EAAE,QAAQ,EACjB,GAAG,EAAE,SAAS,EACd,OAAO,CAAC,EAAE,OAAO,8CAGlB"}
@@ -19,10 +19,14 @@ import { createRecordEnv } from "../record/create-record-env.js";
19
19
  *
20
20
  * @param envKeys Environment variable names mapped to Zod schemas.
21
21
  * @param env Browser config object to read values from.
22
+ * @param options Parsing options. Set `skipValidation` to return raw values and
23
+ * `undefined` for unavailable values instead of throwing, such as during CI or
24
+ * build steps where runtime env vars are not present.
22
25
  * @returns A strongly typed object inferred from `envKeys`.
23
- * @throws When a configured value is missing or fails validation.
26
+ * @throws When a configured value is missing or fails validation, unless
27
+ * `options.skipValidation` is enabled.
24
28
  */
25
- export function createBrowserEnv(envKeys, env) {
26
- return createRecordEnv(envKeys, env);
29
+ export function createBrowserEnv(envKeys, env, options) {
30
+ return createRecordEnv(envKeys, env, options);
27
31
  }
28
32
  //# sourceMappingURL=create-browser-env.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-browser-env.js","sourceRoot":"","sources":["../../../src/runtime/browser/create-browser-env.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,gBAAgB,CAC9B,OAAiB,EACjB,GAAc;IAEd,OAAO,eAAe,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AACvC,CAAC"}
1
+ {"version":3,"file":"create-browser-env.js","sourceRoot":"","sources":["../../../src/runtime/browser/create-browser-env.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,gBAAgB,CAC9B,OAAiB,EACjB,GAAc,EACd,OAAiB;IAEjB,OAAO,eAAe,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;AAChD,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { EnvKeys } from "../../lib/types.js";
1
+ import type { EnvKeys, Options } from "../../lib/types.js";
2
2
  /**
3
3
  * Creates a typed environment object from Bun's `Bun.env`.
4
4
  *
@@ -17,8 +17,12 @@ import type { EnvKeys } from "../../lib/types.js";
17
17
  * ```
18
18
  *
19
19
  * @param envKeys Environment variable names mapped to Zod schemas.
20
+ * @param options Parsing options. Set `skipValidation` to return raw values and
21
+ * `undefined` for unavailable variables instead of throwing, such as during CI
22
+ * or build steps where runtime env vars are not present.
20
23
  * @returns A strongly typed object inferred from `envKeys`.
21
- * @throws When a configured variable is missing or fails validation.
24
+ * @throws When a configured variable is missing or fails validation, unless
25
+ * `options.skipValidation` is enabled.
22
26
  */
23
- export declare function createBunEnv<const TEnvKeys extends EnvKeys>(envKeys: TEnvKeys): import("../../lib/types.js").Env<TEnvKeys>;
27
+ export declare function createBunEnv<const TEnvKeys extends EnvKeys>(envKeys: TEnvKeys, options?: Options): import("../../lib/types.js").Env<TEnvKeys>;
24
28
  //# sourceMappingURL=create-bun-env.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-bun-env.d.ts","sourceRoot":"","sources":["../../../src/runtime/bun/create-bun-env.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAMlD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,YAAY,CAAC,KAAK,CAAC,QAAQ,SAAS,OAAO,EACzD,OAAO,EAAE,QAAQ,8CAKlB"}
1
+ {"version":3,"file":"create-bun-env.d.ts","sourceRoot":"","sources":["../../../src/runtime/bun/create-bun-env.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAM3D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,YAAY,CAAC,KAAK,CAAC,QAAQ,SAAS,OAAO,EACzD,OAAO,EAAE,QAAQ,EACjB,OAAO,CAAC,EAAE,OAAO,8CAQlB"}
@@ -19,10 +19,14 @@ import { BunRuntimeGlobalsSchema } from "./lib/schema.js";
19
19
  * ```
20
20
  *
21
21
  * @param envKeys Environment variable names mapped to Zod schemas.
22
+ * @param options Parsing options. Set `skipValidation` to return raw values and
23
+ * `undefined` for unavailable variables instead of throwing, such as during CI
24
+ * or build steps where runtime env vars are not present.
22
25
  * @returns A strongly typed object inferred from `envKeys`.
23
- * @throws When a configured variable is missing or fails validation.
26
+ * @throws When a configured variable is missing or fails validation, unless
27
+ * `options.skipValidation` is enabled.
24
28
  */
25
- export function createBunEnv(envKeys) {
26
- return createEnvEffect(envKeys, BunRuntimeGlobalsSchema, (env) => readBunEnv(env));
29
+ export function createBunEnv(envKeys, options) {
30
+ return createEnvEffect(envKeys, BunRuntimeGlobalsSchema, (env) => readBunEnv(env), options);
27
31
  }
28
32
  //# sourceMappingURL=create-bun-env.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-bun-env.js","sourceRoot":"","sources":["../../../src/runtime/bun/create-bun-env.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,YAAY,CAC1B,OAAiB;IAEjB,OAAO,eAAe,CAAC,OAAO,EAAE,uBAAuB,EAAE,CAAC,GAAG,EAAE,EAAE,CAC/D,UAAU,CAAC,GAAG,CAAC,CAChB,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"create-bun-env.js","sourceRoot":"","sources":["../../../src/runtime/bun/create-bun-env.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,YAAY,CAC1B,OAAiB,EACjB,OAAiB;IAEjB,OAAO,eAAe,CACpB,OAAO,EACP,uBAAuB,EACvB,CAAC,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,EACxB,OAAO,CACR,CAAC;AACJ,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { EnvKeys, EnvRecord } from "../../lib/types.js";
1
+ import type { EnvKeys, EnvRecord, Options } from "../../lib/types.js";
2
2
  /**
3
3
  * Creates a typed environment object from Cloudflare Worker bindings.
4
4
  *
@@ -25,8 +25,12 @@ import type { EnvKeys, EnvRecord } from "../../lib/types.js";
25
25
  *
26
26
  * @param envKeys Binding names mapped to Zod schemas.
27
27
  * @param bindings Cloudflare Worker bindings object.
28
+ * @param options Parsing options. Set `skipValidation` to return raw values and
29
+ * `undefined` for unavailable bindings instead of throwing, such as during CI
30
+ * or build steps where runtime env vars are not present.
28
31
  * @returns A strongly typed object inferred from `envKeys`.
29
- * @throws When a configured binding is missing or fails validation.
32
+ * @throws When a configured binding is missing or fails validation, unless
33
+ * `options.skipValidation` is enabled.
30
34
  */
31
- export declare function createCloudflareEnv<const TEnvKeys extends EnvKeys>(envKeys: TEnvKeys, bindings: EnvRecord): import("../../lib/types.js").Env<TEnvKeys>;
35
+ export declare function createCloudflareEnv<const TEnvKeys extends EnvKeys>(envKeys: TEnvKeys, bindings: EnvRecord, options?: Options): import("../../lib/types.js").Env<TEnvKeys>;
32
36
  //# sourceMappingURL=create-cloudflare-env.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-cloudflare-env.d.ts","sourceRoot":"","sources":["../../../src/runtime/cloudflare/create-cloudflare-env.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAI7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,CAAC,QAAQ,SAAS,OAAO,EAChE,OAAO,EAAE,QAAQ,EACjB,QAAQ,EAAE,SAAS,8CAGpB"}
1
+ {"version":3,"file":"create-cloudflare-env.d.ts","sourceRoot":"","sources":["../../../src/runtime/cloudflare/create-cloudflare-env.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAItE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,CAAC,QAAQ,SAAS,OAAO,EAChE,OAAO,EAAE,QAAQ,EACjB,QAAQ,EAAE,SAAS,EACnB,OAAO,CAAC,EAAE,OAAO,8CAGlB"}
@@ -25,10 +25,14 @@ import { createRecordEnv } from "../record/create-record-env.js";
25
25
  *
26
26
  * @param envKeys Binding names mapped to Zod schemas.
27
27
  * @param bindings Cloudflare Worker bindings object.
28
+ * @param options Parsing options. Set `skipValidation` to return raw values and
29
+ * `undefined` for unavailable bindings instead of throwing, such as during CI
30
+ * or build steps where runtime env vars are not present.
28
31
  * @returns A strongly typed object inferred from `envKeys`.
29
- * @throws When a configured binding is missing or fails validation.
32
+ * @throws When a configured binding is missing or fails validation, unless
33
+ * `options.skipValidation` is enabled.
30
34
  */
31
- export function createCloudflareEnv(envKeys, bindings) {
32
- return createRecordEnv(envKeys, bindings);
35
+ export function createCloudflareEnv(envKeys, bindings, options) {
36
+ return createRecordEnv(envKeys, bindings, options);
33
37
  }
34
38
  //# sourceMappingURL=create-cloudflare-env.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-cloudflare-env.js","sourceRoot":"","sources":["../../../src/runtime/cloudflare/create-cloudflare-env.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,UAAU,mBAAmB,CACjC,OAAiB,EACjB,QAAmB;IAEnB,OAAO,eAAe,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC5C,CAAC"}
1
+ {"version":3,"file":"create-cloudflare-env.js","sourceRoot":"","sources":["../../../src/runtime/cloudflare/create-cloudflare-env.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,UAAU,mBAAmB,CACjC,OAAiB,EACjB,QAAmB,EACnB,OAAiB;IAEjB,OAAO,eAAe,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;AACrD,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { EnvKeys } from "../../lib/types.js";
1
+ import type { EnvKeys, Options } from "../../lib/types.js";
2
2
  /**
3
3
  * Creates a typed environment object from Deno's `Deno.env.get`.
4
4
  *
@@ -16,8 +16,12 @@ import type { EnvKeys } from "../../lib/types.js";
16
16
  * ```
17
17
  *
18
18
  * @param envKeys Environment variable names mapped to Zod schemas.
19
+ * @param options Parsing options. Set `skipValidation` to return raw values and
20
+ * `undefined` for unavailable variables instead of throwing, such as during CI
21
+ * or build steps where runtime env vars are not present.
19
22
  * @returns A strongly typed object inferred from `envKeys`.
20
- * @throws When a configured variable is missing or fails validation.
23
+ * @throws When a configured variable is missing or fails validation, unless
24
+ * `options.skipValidation` is enabled.
21
25
  */
22
- export declare function createDenoEnv<const TEnvKeys extends EnvKeys>(envKeys: TEnvKeys): import("../../lib/types.js").Env<TEnvKeys>;
26
+ export declare function createDenoEnv<const TEnvKeys extends EnvKeys>(envKeys: TEnvKeys, options?: Options): import("../../lib/types.js").Env<TEnvKeys>;
23
27
  //# sourceMappingURL=create-deno-env.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-deno-env.d.ts","sourceRoot":"","sources":["../../../src/runtime/deno/create-deno-env.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAMlD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,aAAa,CAAC,KAAK,CAAC,QAAQ,SAAS,OAAO,EAC1D,OAAO,EAAE,QAAQ,8CAGlB"}
1
+ {"version":3,"file":"create-deno-env.d.ts","sourceRoot":"","sources":["../../../src/runtime/deno/create-deno-env.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAM3D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,aAAa,CAAC,KAAK,CAAC,QAAQ,SAAS,OAAO,EAC1D,OAAO,EAAE,QAAQ,EACjB,OAAO,CAAC,EAAE,OAAO,8CAQlB"}
@@ -18,10 +18,14 @@ import { DenoRuntimeGlobalsSchema } from "./lib/schema.js";
18
18
  * ```
19
19
  *
20
20
  * @param envKeys Environment variable names mapped to Zod schemas.
21
+ * @param options Parsing options. Set `skipValidation` to return raw values and
22
+ * `undefined` for unavailable variables instead of throwing, such as during CI
23
+ * or build steps where runtime env vars are not present.
21
24
  * @returns A strongly typed object inferred from `envKeys`.
22
- * @throws When a configured variable is missing or fails validation.
25
+ * @throws When a configured variable is missing or fails validation, unless
26
+ * `options.skipValidation` is enabled.
23
27
  */
24
- export function createDenoEnv(envKeys) {
25
- return createEnvEffect(envKeys, DenoRuntimeGlobalsSchema, readEnvEffect);
28
+ export function createDenoEnv(envKeys, options) {
29
+ return createEnvEffect(envKeys, DenoRuntimeGlobalsSchema, readEnvEffect, options);
26
30
  }
27
31
  //# sourceMappingURL=create-deno-env.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-deno-env.js","sourceRoot":"","sources":["../../../src/runtime/deno/create-deno-env.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,aAAa,CAC3B,OAAiB;IAEjB,OAAO,eAAe,CAAC,OAAO,EAAE,wBAAwB,EAAE,aAAa,CAAC,CAAC;AAC3E,CAAC"}
1
+ {"version":3,"file":"create-deno-env.js","sourceRoot":"","sources":["../../../src/runtime/deno/create-deno-env.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,aAAa,CAC3B,OAAiB,EACjB,OAAiB;IAEjB,OAAO,eAAe,CACpB,OAAO,EACP,wBAAwB,EACxB,aAAa,EACb,OAAO,CACR,CAAC;AACJ,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { EnvKeys, EnvRecord } from "../../lib/types.js";
1
+ import type { EnvKeys, EnvRecord, Options } from "../../lib/types.js";
2
2
  /**
3
3
  * Creates a typed environment object from an `import.meta.env`-style object.
4
4
  *
@@ -21,8 +21,12 @@ import type { EnvKeys, EnvRecord } from "../../lib/types.js";
21
21
  *
22
22
  * @param envKeys Environment variable names mapped to Zod schemas.
23
23
  * @param importMetaEnv The `import.meta.env` object, or a compatible object.
24
+ * @param options Parsing options. Set `skipValidation` to return raw values and
25
+ * `undefined` for unavailable values instead of throwing, such as during CI or
26
+ * build steps where runtime env vars are not present.
24
27
  * @returns A strongly typed object inferred from `envKeys`.
25
- * @throws When a configured value is missing or fails validation.
28
+ * @throws When a configured value is missing or fails validation, unless
29
+ * `options.skipValidation` is enabled.
26
30
  */
27
- export declare function createImportMetaEnv<const TEnvKeys extends EnvKeys>(envKeys: TEnvKeys, importMetaEnv: EnvRecord): import("../../lib/types.js").Env<TEnvKeys>;
31
+ export declare function createImportMetaEnv<const TEnvKeys extends EnvKeys>(envKeys: TEnvKeys, importMetaEnv: EnvRecord, options?: Options): import("../../lib/types.js").Env<TEnvKeys>;
28
32
  //# sourceMappingURL=create-import-meta-env.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-import-meta-env.d.ts","sourceRoot":"","sources":["../../../src/runtime/import-meta/create-import-meta-env.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAI7D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,CAAC,QAAQ,SAAS,OAAO,EAChE,OAAO,EAAE,QAAQ,EACjB,aAAa,EAAE,SAAS,8CAGzB"}
1
+ {"version":3,"file":"create-import-meta-env.d.ts","sourceRoot":"","sources":["../../../src/runtime/import-meta/create-import-meta-env.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAItE;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,CAAC,QAAQ,SAAS,OAAO,EAChE,OAAO,EAAE,QAAQ,EACjB,aAAa,EAAE,SAAS,EACxB,OAAO,CAAC,EAAE,OAAO,8CAGlB"}
@@ -21,10 +21,14 @@ import { createRecordEnv } from "../record/create-record-env.js";
21
21
  *
22
22
  * @param envKeys Environment variable names mapped to Zod schemas.
23
23
  * @param importMetaEnv The `import.meta.env` object, or a compatible object.
24
+ * @param options Parsing options. Set `skipValidation` to return raw values and
25
+ * `undefined` for unavailable values instead of throwing, such as during CI or
26
+ * build steps where runtime env vars are not present.
24
27
  * @returns A strongly typed object inferred from `envKeys`.
25
- * @throws When a configured value is missing or fails validation.
28
+ * @throws When a configured value is missing or fails validation, unless
29
+ * `options.skipValidation` is enabled.
26
30
  */
27
- export function createImportMetaEnv(envKeys, importMetaEnv) {
28
- return createRecordEnv(envKeys, importMetaEnv);
31
+ export function createImportMetaEnv(envKeys, importMetaEnv, options) {
32
+ return createRecordEnv(envKeys, importMetaEnv, options);
29
33
  }
30
34
  //# sourceMappingURL=create-import-meta-env.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-import-meta-env.js","sourceRoot":"","sources":["../../../src/runtime/import-meta/create-import-meta-env.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,mBAAmB,CACjC,OAAiB,EACjB,aAAwB;IAExB,OAAO,eAAe,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;AACjD,CAAC"}
1
+ {"version":3,"file":"create-import-meta-env.js","sourceRoot":"","sources":["../../../src/runtime/import-meta/create-import-meta-env.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,UAAU,mBAAmB,CACjC,OAAiB,EACjB,aAAwB,EACxB,OAAiB;IAEjB,OAAO,eAAe,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;AAC1D,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { EnvKeys, EnvRecord } from "../../lib/types.js";
1
+ import type { EnvKeys, EnvRecord, Options } from "../../lib/types.js";
2
2
  /**
3
3
  * Creates a typed environment object from a Netlify env-like object.
4
4
  *
@@ -18,8 +18,12 @@ import type { EnvKeys, EnvRecord } from "../../lib/types.js";
18
18
  *
19
19
  * @param envKeys Environment variable names mapped to Zod schemas.
20
20
  * @param env Netlify env object to read values from.
21
+ * @param options Parsing options. Set `skipValidation` to return raw values and
22
+ * `undefined` for unavailable values instead of throwing, such as during CI or
23
+ * build steps where runtime env vars are not present.
21
24
  * @returns A strongly typed object inferred from `envKeys`.
22
- * @throws When a configured value is missing or fails validation.
25
+ * @throws When a configured value is missing or fails validation, unless
26
+ * `options.skipValidation` is enabled.
23
27
  */
24
- export declare function createNetlifyEnv<const TEnvKeys extends EnvKeys>(envKeys: TEnvKeys, env: EnvRecord): import("../../lib/types.js").Env<TEnvKeys>;
28
+ export declare function createNetlifyEnv<const TEnvKeys extends EnvKeys>(envKeys: TEnvKeys, env: EnvRecord, options?: Options): import("../../lib/types.js").Env<TEnvKeys>;
25
29
  //# sourceMappingURL=create-netlify-env.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-netlify-env.d.ts","sourceRoot":"","sources":["../../../src/runtime/netlify/create-netlify-env.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAI7D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,CAAC,QAAQ,SAAS,OAAO,EAC7D,OAAO,EAAE,QAAQ,EACjB,GAAG,EAAE,SAAS,8CAGf"}
1
+ {"version":3,"file":"create-netlify-env.d.ts","sourceRoot":"","sources":["../../../src/runtime/netlify/create-netlify-env.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAItE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,CAAC,QAAQ,SAAS,OAAO,EAC7D,OAAO,EAAE,QAAQ,EACjB,GAAG,EAAE,SAAS,EACd,OAAO,CAAC,EAAE,OAAO,8CAGlB"}
@@ -18,10 +18,14 @@ import { createRecordEnv } from "../record/create-record-env.js";
18
18
  *
19
19
  * @param envKeys Environment variable names mapped to Zod schemas.
20
20
  * @param env Netlify env object to read values from.
21
+ * @param options Parsing options. Set `skipValidation` to return raw values and
22
+ * `undefined` for unavailable values instead of throwing, such as during CI or
23
+ * build steps where runtime env vars are not present.
21
24
  * @returns A strongly typed object inferred from `envKeys`.
22
- * @throws When a configured value is missing or fails validation.
25
+ * @throws When a configured value is missing or fails validation, unless
26
+ * `options.skipValidation` is enabled.
23
27
  */
24
- export function createNetlifyEnv(envKeys, env) {
25
- return createRecordEnv(envKeys, env);
28
+ export function createNetlifyEnv(envKeys, env, options) {
29
+ return createRecordEnv(envKeys, env, options);
26
30
  }
27
31
  //# sourceMappingURL=create-netlify-env.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-netlify-env.js","sourceRoot":"","sources":["../../../src/runtime/netlify/create-netlify-env.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,gBAAgB,CAC9B,OAAiB,EACjB,GAAc;IAEd,OAAO,eAAe,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AACvC,CAAC"}
1
+ {"version":3,"file":"create-netlify-env.js","sourceRoot":"","sources":["../../../src/runtime/netlify/create-netlify-env.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,gBAAgB,CAC9B,OAAiB,EACjB,GAAc,EACd,OAAiB;IAEjB,OAAO,eAAe,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;AAChD,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { EnvKeys } from "../../lib/types.js";
1
+ import type { EnvKeys, Options } from "../../lib/types.js";
2
2
  /**
3
3
  * Creates a typed environment object from Node.js `process.env`.
4
4
  *
@@ -20,8 +20,12 @@ import type { EnvKeys } from "../../lib/types.js";
20
20
  * ```
21
21
  *
22
22
  * @param envKeys Environment variable names mapped to Zod schemas.
23
+ * @param options Parsing options. Set `skipValidation` to return raw values and
24
+ * `undefined` for unavailable variables instead of throwing, such as during CI
25
+ * or build steps where runtime env vars are not present.
23
26
  * @returns A strongly typed object inferred from `envKeys`.
24
- * @throws When a configured variable is missing or fails validation.
27
+ * @throws When a configured variable is missing or fails validation, unless
28
+ * `options.skipValidation` is enabled.
25
29
  */
26
- export declare function createNodeEnv<const TEnvKeys extends EnvKeys>(envKeys: TEnvKeys): import("../../lib/types.js").Env<TEnvKeys>;
30
+ export declare function createNodeEnv<const TEnvKeys extends EnvKeys>(envKeys: TEnvKeys, options?: Options): import("../../lib/types.js").Env<TEnvKeys>;
27
31
  //# sourceMappingURL=create-node-env.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-node-env.d.ts","sourceRoot":"","sources":["../../../src/runtime/node/create-node-env.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAMlD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,aAAa,CAAC,KAAK,CAAC,QAAQ,SAAS,OAAO,EAC1D,OAAO,EAAE,QAAQ,8CAGlB"}
1
+ {"version":3,"file":"create-node-env.d.ts","sourceRoot":"","sources":["../../../src/runtime/node/create-node-env.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAM3D;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,aAAa,CAAC,KAAK,CAAC,QAAQ,SAAS,OAAO,EAC1D,OAAO,EAAE,QAAQ,EACjB,OAAO,CAAC,EAAE,OAAO,8CAQlB"}
@@ -22,10 +22,14 @@ import { NodeRuntimeGlobalsSchema } from "./lib/schema.js";
22
22
  * ```
23
23
  *
24
24
  * @param envKeys Environment variable names mapped to Zod schemas.
25
+ * @param options Parsing options. Set `skipValidation` to return raw values and
26
+ * `undefined` for unavailable variables instead of throwing, such as during CI
27
+ * or build steps where runtime env vars are not present.
25
28
  * @returns A strongly typed object inferred from `envKeys`.
26
- * @throws When a configured variable is missing or fails validation.
29
+ * @throws When a configured variable is missing or fails validation, unless
30
+ * `options.skipValidation` is enabled.
27
31
  */
28
- export function createNodeEnv(envKeys) {
29
- return createEnvEffect(envKeys, NodeRuntimeGlobalsSchema, readEnvEffect);
32
+ export function createNodeEnv(envKeys, options) {
33
+ return createEnvEffect(envKeys, NodeRuntimeGlobalsSchema, readEnvEffect, options);
30
34
  }
31
35
  //# sourceMappingURL=create-node-env.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-node-env.js","sourceRoot":"","sources":["../../../src/runtime/node/create-node-env.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,aAAa,CAC3B,OAAiB;IAEjB,OAAO,eAAe,CAAC,OAAO,EAAE,wBAAwB,EAAE,aAAa,CAAC,CAAC;AAC3E,CAAC"}
1
+ {"version":3,"file":"create-node-env.js","sourceRoot":"","sources":["../../../src/runtime/node/create-node-env.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,UAAU,aAAa,CAC3B,OAAiB,EACjB,OAAiB;IAEjB,OAAO,eAAe,CACpB,OAAO,EACP,wBAAwB,EACxB,aAAa,EACb,OAAO,CACR,CAAC;AACJ,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { Env, EnvKeys, EnvRecord } from "../../lib/types.js";
1
+ import type { Env, EnvKeys, EnvRecord, Options } from "../../lib/types.js";
2
2
  /**
3
3
  * Creates a typed environment object from any explicit object.
4
4
  *
@@ -22,8 +22,12 @@ import type { Env, EnvKeys, EnvRecord } from "../../lib/types.js";
22
22
  *
23
23
  * @param envKeys Environment variable names mapped to Zod schemas.
24
24
  * @param record Object to read values from.
25
+ * @param options Parsing options. Set `skipValidation` to return raw values and
26
+ * `undefined` for unavailable values instead of throwing, such as during CI or
27
+ * build steps where runtime env vars are not present.
25
28
  * @returns A strongly typed object inferred from `envKeys`.
26
- * @throws When a configured value is missing or fails validation.
29
+ * @throws When a configured value is missing or fails validation, unless
30
+ * `options.skipValidation` is enabled.
27
31
  */
28
- export declare function createRecordEnv<const TEnvKeys extends EnvKeys>(envKeys: TEnvKeys, record: EnvRecord): Env<TEnvKeys>;
32
+ export declare function createRecordEnv<const TEnvKeys extends EnvKeys>(envKeys: TEnvKeys, record: EnvRecord, options?: Options): Env<TEnvKeys>;
29
33
  //# sourceMappingURL=create-record-env.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-record-env.d.ts","sourceRoot":"","sources":["../../../src/runtime/record/create-record-env.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAMlE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,eAAe,CAAC,KAAK,CAAC,QAAQ,SAAS,OAAO,EAC5D,OAAO,EAAE,QAAQ,EACjB,MAAM,EAAE,SAAS,GAWH,GAAG,CAAC,QAAQ,CAAC,CAC5B"}
1
+ {"version":3,"file":"create-record-env.d.ts","sourceRoot":"","sources":["../../../src/runtime/record/create-record-env.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAM3E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,eAAe,CAAC,KAAK,CAAC,QAAQ,SAAS,OAAO,EAC5D,OAAO,EAAE,QAAQ,EACjB,MAAM,EAAE,SAAS,EACjB,OAAO,CAAC,EAAE,OAAO,GAiBH,GAAG,CAAC,QAAQ,CAAC,CAC5B"}
@@ -25,11 +25,15 @@ import { readRecordEnv } from "./lib/read-record-env.js";
25
25
  *
26
26
  * @param envKeys Environment variable names mapped to Zod schemas.
27
27
  * @param record Object to read values from.
28
+ * @param options Parsing options. Set `skipValidation` to return raw values and
29
+ * `undefined` for unavailable values instead of throwing, such as during CI or
30
+ * build steps where runtime env vars are not present.
28
31
  * @returns A strongly typed object inferred from `envKeys`.
29
- * @throws When a configured value is missing or fails validation.
32
+ * @throws When a configured value is missing or fails validation, unless
33
+ * `options.skipValidation` is enabled.
30
34
  */
31
- export function createRecordEnv(envKeys, record) {
32
- const env = Effect.runSync(Effect.forEach(Object.entries(envKeys), ([key, schema]) => envReadValueEffect(key, (env) => readRecordEnv(env, record)).pipe(Effect.flatMap((value) => envParseValueEffect(key, schema, value)), Effect.map((value) => [key, value]))).pipe(Effect.map((entries) => Object.fromEntries(entries))));
35
+ export function createRecordEnv(envKeys, record, options) {
36
+ const env = Effect.runSync(Effect.forEach(Object.entries(envKeys), ([key, schema]) => envReadValueEffect(key, (env) => readRecordEnv(env, record), options).pipe(Effect.flatMap((value) => envParseValueEffect(key, schema, value, options)), Effect.map((value) => [key, value]))).pipe(Effect.map((entries) => Object.fromEntries(entries))));
33
37
  return env;
34
38
  }
35
39
  //# sourceMappingURL=create-record-env.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-record-env.js","sourceRoot":"","sources":["../../../src/runtime/record/create-record-env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIhC,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,eAAe,CAC7B,OAAiB,EACjB,MAAiB;IAEjB,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CACxB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,EAAE,CACxD,kBAAkB,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAC/D,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,EAClE,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,KAAK,CAAU,CAAC,CAC7C,CACF,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAC7D,CAAC;IAEF,OAAO,GAAoB,CAAC;AAC9B,CAAC"}
1
+ {"version":3,"file":"create-record-env.js","sourceRoot":"","sources":["../../../src/runtime/record/create-record-env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIhC,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,UAAU,eAAe,CAC7B,OAAiB,EACjB,MAAiB,EACjB,OAAiB;IAEjB,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CACxB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,EAAE,CACxD,kBAAkB,CAChB,GAAG,EACH,CAAC,GAAG,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,EAAE,MAAM,CAAC,EACnC,OAAO,CACR,CAAC,IAAI,CACJ,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CACvB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CACjD,EACD,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,KAAK,CAAU,CAAC,CAC7C,CACF,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAC7D,CAAC;IAEF,OAAO,GAAoB,CAAC;AAC9B,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { EnvKeys, EnvRecord } from "../../lib/types.js";
1
+ import type { EnvKeys, EnvRecord, Options } from "../../lib/types.js";
2
2
  /**
3
3
  * Creates a typed environment object from a Vercel Edge env-like object.
4
4
  *
@@ -19,8 +19,12 @@ import type { EnvKeys, EnvRecord } from "../../lib/types.js";
19
19
  *
20
20
  * @param envKeys Environment variable names mapped to Zod schemas.
21
21
  * @param env Vercel Edge env object to read values from.
22
+ * @param options Parsing options. Set `skipValidation` to return raw values and
23
+ * `undefined` for unavailable values instead of throwing, such as during CI or
24
+ * build steps where runtime env vars are not present.
22
25
  * @returns A strongly typed object inferred from `envKeys`.
23
- * @throws When a configured value is missing or fails validation.
26
+ * @throws When a configured value is missing or fails validation, unless
27
+ * `options.skipValidation` is enabled.
24
28
  */
25
- export declare function createVercelEdgeEnv<const TEnvKeys extends EnvKeys>(envKeys: TEnvKeys, env: EnvRecord): import("../../lib/types.js").Env<TEnvKeys>;
29
+ export declare function createVercelEdgeEnv<const TEnvKeys extends EnvKeys>(envKeys: TEnvKeys, env: EnvRecord, options?: Options): import("../../lib/types.js").Env<TEnvKeys>;
26
30
  //# sourceMappingURL=create-vercel-edge-env.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-vercel-edge-env.d.ts","sourceRoot":"","sources":["../../../src/runtime/vercel/create-vercel-edge-env.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAI7D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,CAAC,QAAQ,SAAS,OAAO,EAChE,OAAO,EAAE,QAAQ,EACjB,GAAG,EAAE,SAAS,8CAGf"}
1
+ {"version":3,"file":"create-vercel-edge-env.d.ts","sourceRoot":"","sources":["../../../src/runtime/vercel/create-vercel-edge-env.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAItE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,CAAC,QAAQ,SAAS,OAAO,EAChE,OAAO,EAAE,QAAQ,EACjB,GAAG,EAAE,SAAS,EACd,OAAO,CAAC,EAAE,OAAO,8CAGlB"}
@@ -19,10 +19,14 @@ import { createRecordEnv } from "../record/create-record-env.js";
19
19
  *
20
20
  * @param envKeys Environment variable names mapped to Zod schemas.
21
21
  * @param env Vercel Edge env object to read values from.
22
+ * @param options Parsing options. Set `skipValidation` to return raw values and
23
+ * `undefined` for unavailable values instead of throwing, such as during CI or
24
+ * build steps where runtime env vars are not present.
22
25
  * @returns A strongly typed object inferred from `envKeys`.
23
- * @throws When a configured value is missing or fails validation.
26
+ * @throws When a configured value is missing or fails validation, unless
27
+ * `options.skipValidation` is enabled.
24
28
  */
25
- export function createVercelEdgeEnv(envKeys, env) {
26
- return createRecordEnv(envKeys, env);
29
+ export function createVercelEdgeEnv(envKeys, env, options) {
30
+ return createRecordEnv(envKeys, env, options);
27
31
  }
28
32
  //# sourceMappingURL=create-vercel-edge-env.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-vercel-edge-env.js","sourceRoot":"","sources":["../../../src/runtime/vercel/create-vercel-edge-env.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,mBAAmB,CACjC,OAAiB,EACjB,GAAc;IAEd,OAAO,eAAe,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AACvC,CAAC"}
1
+ {"version":3,"file":"create-vercel-edge-env.js","sourceRoot":"","sources":["../../../src/runtime/vercel/create-vercel-edge-env.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,mBAAmB,CACjC,OAAiB,EACjB,GAAc,EACd,OAAiB;IAEjB,OAAO,eAAe,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;AAChD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmrp/env",
3
- "version": "0.1.0-alpha.0",
3
+ "version": "0.1.0",
4
4
  "description": "Type-safe environment variable parsing, powered by Zod.",
5
5
  "keywords": [
6
6
  "env",
@@ -70,23 +70,11 @@
70
70
  "LICENSE",
71
71
  "README.md"
72
72
  ],
73
- "scripts": {
74
- "build": "tsc -p tsconfig.build.json",
75
- "clean": "rm -rf dist",
76
- "format": "prettier --write .",
77
- "lint": "eslint .",
78
- "test": "vitest run",
79
- "test:coverage": "vitest run --coverage",
80
- "test:runtime": "pnpm test:runtime:node && pnpm test:runtime:bun && pnpm test:runtime:deno",
81
- "test:runtime:bun": "bun run scripts/runtime-smoke/bun.mjs",
82
- "test:runtime:deno": "deno run --no-lock --allow-env --node-modules-dir=auto scripts/runtime-smoke/deno.mjs",
83
- "test:runtime:node": "node scripts/runtime-smoke/node.mjs",
84
- "typecheck": "tsc --noEmit"
85
- },
86
73
  "dependencies": {
87
74
  "effect": "^3.21.2"
88
75
  },
89
76
  "devDependencies": {
77
+ "@changesets/cli": "^2.31.0",
90
78
  "@eslint/js": "^10.0.1",
91
79
  "@tsconfig/recommended": "^1.0.13",
92
80
  "@types/node": "^25.6.0",
@@ -108,5 +96,19 @@
108
96
  },
109
97
  "engines": {
110
98
  "node": ">=24.15.0"
99
+ },
100
+ "scripts": {
101
+ "build": "tsc -p tsconfig.build.json",
102
+ "clean": "rm -rf dist",
103
+ "format": "prettier --write .",
104
+ "lint": "eslint .",
105
+ "test": "vitest run",
106
+ "test:coverage": "vitest run --coverage",
107
+ "test:runtime": "pnpm test:runtime:node && pnpm test:runtime:bun && pnpm test:runtime:deno",
108
+ "test:runtime:bun": "bun run scripts/runtime-smoke/bun.mjs",
109
+ "test:runtime:deno": "deno run --no-lock --allow-env --node-modules-dir=auto scripts/runtime-smoke/deno.mjs",
110
+ "test:runtime:node": "node scripts/runtime-smoke/node.mjs",
111
+ "typecheck": "tsc --noEmit",
112
+ "release": "pnpm build && changeset publish --access public"
111
113
  }
112
- }
114
+ }