arkenv 0.8.1 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -28,15 +28,11 @@
28
28
  <br/>
29
29
  <br/>
30
30
 
31
- ## Introduction
31
+ ## What is ArkEnv?
32
32
 
33
- > [!TIP]
34
- > 📖 **Reading this on GitHub?** Check out [this page in our docs](https://arkenv.js.org/docs/arkenv) to hover over code blocks and get type hints!
33
+ ArkEnv is an environment variable validator for modern JavaScript runtimes. It creates a ready-to-use, typesafe environment variable object:
35
34
 
36
- ArkEnv is an environment variable validator for modern JavaScript runtimes.
37
- It lets you create a ready-to-use, typesafe environment variable object:
38
-
39
- ```ts twoslash
35
+ ```ts
40
36
  import arkenv from "arkenv";
41
37
 
42
38
  const env = arkenv({
@@ -45,15 +41,9 @@ const env = arkenv({
45
41
  NODE_ENV: "'development' | 'production' | 'test' = 'development'",
46
42
  DEBUGGING: "boolean = false",
47
43
  });
48
-
49
- // Hover to see ✨exact✨ types
50
- const host = env.HOST;
51
- const port = env.PORT;
52
- const nodeEnv = env.NODE_ENV;
53
- const debugging = env.DEBUGGING;
54
44
  ```
55
45
 
56
- > ArkEnv supports native [ArkType](https://arktype.io/) notation and any [Standard Schema](https://standardschema.dev/schema) validator: Zod, Valibot, Typia, etc.
46
+ > ArkEnv defaults to [ArkType](https://arktype.io/) notation, the closest match to TypeScript syntax for editor-to-runtime typesafety. You can also use any [Standard Schema](https://standardschema.dev/schema) validator, including Zod, Valibot, and Typia.
57
47
 
58
48
  With ArkEnv, your environment variables are **guaranteed to match your schema**. If any variable is incorrect or missing, the app won't start and a clear error will be thrown:
59
49
 
@@ -67,23 +57,15 @@ ArkEnvError: Errors found while validating environment variables
67
57
 
68
58
  ## Features
69
59
 
70
-  ⛯ Zero external dependencies
71
-
72
-  ⛯ Works in Node.js, Bun, and Vite
73
-
74
-  ⛯ Tiny: <2kB gzipped
75
-
76
-  ⛯ Build-time / runtime validation with editor autocomplete & type hints
77
-
78
-  ⛯ Single import, zero config for most projects
79
-
80
-  ⛯ Optional variables and default values
81
-
82
-  ⛯ Intuitive automatic coercion
83
-
84
-  ⛯ Compatible with any Standard Schema validator (Zod, Valibot, etc.)
85
-
86
-  ⛯ Native support for ArkType, TypeScript’s 1:1 validator
60
+ * Zero external dependencies
61
+ * Works in Node.js, Bun, and Vite
62
+ * Tiny: <2kB gzipped
63
+ * Build-time / runtime validation with editor autocomplete & type hints
64
+ * Single import, zero config for most projects
65
+ * Optional variables and default values
66
+ * Intuitive automatic coercion
67
+ * Compatible with any Standard Schema validator (Zod, Valibot, etc.)
68
+ * Native support for ArkType, TypeScript’s 1:1 validator
87
69
 
88
70
  > See how ArkEnv compares to alternatives like T3 Env, znv, and envalid in the [comparison cheatsheet](https://arkenv.js.org/docs/arkenv/comparison#comparison-cheatsheet).
89
71
 
@@ -164,6 +146,7 @@ You are also welcome to [contribute to the project](https://github.com/yamcodes/
164
146
  <td align="center" valign="top" width="14.28%"><a href="https://yam.codes"><img src="https://avatars.githubusercontent.com/u/2014360?v=4?s=100" width="100px;" alt="Yam C Borodetsky"/><br /><sub><b>Yam C Borodetsky</b></sub></a><br /><a href="https://github.com/yamcodes/arkenv/commits?author=yamcodes" title="Code">💻</a> <a href="#question-yamcodes" title="Answering Questions">💬</a> <a href="#ideas-yamcodes" title="Ideas, Planning, & Feedback">🤔</a> <a href="#design-yamcodes" title="Design">🎨</a> <a href="https://github.com/yamcodes/arkenv/commits?author=yamcodes" title="Documentation">📖</a> <a href="https://github.com/yamcodes/arkenv/issues?q=author%3Ayamcodes" title="Bug reports">🐛</a> <a href="#example-yamcodes" title="Examples">💡</a> <a href="#infra-yamcodes" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="https://github.com/yamcodes/arkenv/commits?author=yamcodes" title="Tests">⚠️</a></td>
165
147
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/aruaycodes"><img src="https://avatars.githubusercontent.com/u/57131628?v=4?s=100" width="100px;" alt="Aruay Berdikulova"/><br /><sub><b>Aruay Berdikulova</b></sub></a><br /><a href="https://github.com/yamcodes/arkenv/commits?author=aruaycodes" title="Code">💻</a> <a href="#ideas-aruaycodes" title="Ideas, Planning, & Feedback">🤔</a></td>
166
148
  <td align="center" valign="top" width="14.28%"><a href="https://arktype.io"><img src="https://avatars.githubusercontent.com/u/10645823?v=4?s=100" width="100px;" alt="David Blass"/><br /><sub><b>David Blass</b></sub></a><br /><a href="#ideas-ssalbdivad" title="Ideas, Planning, & Feedback">🤔</a> <a href="#mentoring-ssalbdivad" title="Mentoring">🧑‍🏫</a> <a href="#question-ssalbdivad" title="Answering Questions">💬</a></td>
149
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/danciudev"><img src="https://avatars.githubusercontent.com/u/44430251?v=4?s=100" width="100px;" alt="Andrei Danciu"/><br /><sub><b>Andrei Danciu</b></sub></a><br /><a href="https://github.com/yamcodes/arkenv/commits?author=danciudev" title="Code">💻</a></td>
167
150
  </tr>
168
151
  </tbody>
169
152
  </table>
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports,`__esModule`,{value:!0});let e=require(`arktype`);const t=(0,e.type)(`unknown`).pipe(e=>{if(typeof e==`number`||typeof e!=`string`)return e;let t=e.trim();if(t===``)return e;if(t===`NaN`)return NaN;let n=Number(t);return Number.isNaN(n)?e:n}),n=(0,e.type)(`unknown`).pipe(e=>e===`true`?!0:e===`false`?!1:e),r=(0,e.type)(`0 <= number.integer <= 65535`),i=(0,e.type)(`string.ip | 'localhost'`),a=(0,e.scope)({string:e.type.module({...e.type.keywords.string,host:i}),number:e.type.module({...e.type.keywords.number,port:r})}),o=`*`,s=(e,t=[])=>{let n=[];if(typeof e==`boolean`)return n;if(`const`in e&&(typeof e.const==`number`||typeof e.const==`boolean`)&&n.push({path:[...t]}),`enum`in e&&e.enum&&e.enum.some(e=>typeof e==`number`||typeof e==`boolean`)&&n.push({path:[...t]}),`type`in e){if(e.type===`number`||e.type===`integer`)n.push({path:[...t]});else if(e.type===`boolean`)n.push({path:[...t]});else if(e.type===`array`)`items`in e&&e.items&&(Array.isArray(e.items)?e.items.forEach((e,r)=>{n.push(...s(e,[...t,`${r}`]))}):n.push(...s(e.items,[...t,`*`])));else if(e.type===`object`&&`properties`in e&&e.properties)for(let[r,i]of Object.entries(e.properties))n.push(...s(i,[...t,r]))}if(`anyOf`in e&&e.anyOf)for(let r of e.anyOf)n.push(...s(r,t));if(`allOf`in e&&e.allOf)for(let r of e.allOf)n.push(...s(r,t));if(`oneOf`in e&&e.oneOf)for(let r of e.oneOf)n.push(...s(r,t));let r=new Set;return n.filter(e=>{let t=JSON.stringify(e.path);return r.has(t)?!1:(r.add(t),!0)})},c=(e,r)=>{if(typeof e!=`object`||!e){if(r.some(e=>e.path.length===0)){let r=t(e);return typeof r==`number`?r:n(e)}return e}let i=(e,r)=>{if(!e||typeof e!=`object`)return;if(r.length===0){if(Array.isArray(e))for(let t of e)i(t,[]);return}if(r.length===1){let i=r[0];if(i===`*`){if(Array.isArray(e))for(let r=0;r<e.length;r++){let i=e[r],a=t(i);typeof a==`number`?e[r]=a:e[r]=n(i)}return}let a=e;if(Object.prototype.hasOwnProperty.call(a,i)){let e=a[i];if(Array.isArray(e))for(let r=0;r<e.length;r++){let i=e[r],a=t(i);typeof a==`number`?e[r]=a:e[r]=n(i)}else{let r=t(e);typeof r==`number`?a[i]=r:a[i]=n(e)}}return}let[a,...o]=r;if(a===`*`){if(Array.isArray(e))for(let t of e)i(t,o);return}i(e[a],o)};for(let t of r)i(e,t.path);return e};function l(t){let n=s(t.in.toJsonSchema({fallback:e=>e.base}));return n.length===0?t:(0,e.type)(`unknown`).pipe(e=>c(e,n)).pipe(t)}const u=(e,t=2,{dontDetectNewlines:n=!1}={})=>n?`${` `.repeat(t)}${e}`:e.split(`
1
+ Object.defineProperty(exports,`__esModule`,{value:!0});let e=require(`arktype`);const t=(0,e.type)(`unknown`).pipe(e=>{if(typeof e==`number`||typeof e!=`string`)return e;let t=e.trim();if(t===``)return e;if(t===`NaN`)return NaN;let n=Number(t);return Number.isNaN(n)?e:n}),n=(0,e.type)(`unknown`).pipe(e=>e===`true`?!0:e===`false`?!1:e),r=(0,e.type)(`0 <= number.integer <= 65535`),i=(0,e.type)(`string.ip | 'localhost'`),a=(0,e.scope)({string:e.type.module({...e.type.keywords.string,host:i}),number:e.type.module({...e.type.keywords.number,port:r})}),o=`*`,s=(e,t=[])=>{let n=[];if(typeof e==`boolean`)return n;if(`const`in e&&(typeof e.const==`number`||typeof e.const==`boolean`)&&n.push({path:[...t],type:`primitive`}),`enum`in e&&e.enum&&e.enum.some(e=>typeof e==`number`||typeof e==`boolean`)&&n.push({path:[...t],type:`primitive`}),`type`in e){if(e.type===`number`||e.type===`integer`)n.push({path:[...t],type:`primitive`});else if(e.type===`boolean`)n.push({path:[...t],type:`primitive`});else if(e.type===`array`)n.push({path:[...t],type:`array`}),`items`in e&&e.items&&(Array.isArray(e.items)?e.items.forEach((e,r)=>{n.push(...s(e,[...t,`${r}`]))}):n.push(...s(e.items,[...t,`*`])));else if(e.type===`object`&&`properties`in e&&e.properties)for(let[r,i]of Object.entries(e.properties))n.push(...s(i,[...t,r]))}if(`anyOf`in e&&e.anyOf)for(let r of e.anyOf)n.push(...s(r,t));if(`allOf`in e&&e.allOf)for(let r of e.allOf)n.push(...s(r,t));if(`oneOf`in e&&e.oneOf)for(let r of e.oneOf)n.push(...s(r,t));let r=new Set;return n.filter(e=>{let t=JSON.stringify(e.path)+e.type;return r.has(t)?!1:(r.add(t),!0)})},c=(e,r,i={})=>{let{arrayFormat:a=`comma`}=i,o=e=>{if(a===`json`)try{return JSON.parse(e)}catch{return e}return e.trim()?e.split(`,`).map(e=>e.trim()):[]};if(typeof e!=`object`||!e){if(r.some(e=>e.path.length===0)){if(r.find(e=>e.path.length===0)?.type===`array`&&typeof e==`string`)return o(e);let i=t(e);return typeof i==`number`?i:n(e)}return e}let s=(e,r,i)=>{if(!e||typeof e!=`object`||r.length===0)return;if(r.length===1){let a=r[0];if(a===`*`){if(Array.isArray(e))for(let r=0;r<e.length;r++){let a=e[r];if(i===`primitive`){let i=t(a);typeof i==`number`?e[r]=i:e[r]=n(a)}}return}let s=e;if(Object.prototype.hasOwnProperty.call(s,a)){let e=s[a];if(i===`array`&&typeof e==`string`){s[a]=o(e);return}if(Array.isArray(e)){if(i===`primitive`)for(let r=0;r<e.length;r++){let i=e[r],a=t(i);typeof a==`number`?e[r]=a:e[r]=n(i)}}else if(i===`primitive`){let r=t(e);typeof r==`number`?s[a]=r:s[a]=n(e)}}return}let[a,...c]=r;if(a===`*`){if(Array.isArray(e))for(let t of e)s(t,c,i);return}s(e[a],c,i)};for(let t of r)s(e,t.path,t.type);return e};function l(t,n){let r=s(t.in.toJsonSchema({fallback:e=>e.base}));return r.length===0?t:(0,e.type)(`unknown`).pipe(e=>c(e,r,n)).pipe(t)}const u=(e,t=2,{dontDetectNewlines:n=!1}={})=>n?`${` `.repeat(t)}${e}`:e.split(`
2
2
  `).map(e=>`${` `.repeat(t)}${e}`).join(`
3
3
  `),d={red:`\x1B[31m`,yellow:`\x1B[33m`,cyan:`\x1B[36m`,reset:`\x1B[0m`},f=()=>typeof process<`u`&&process.versions!=null&&process.versions.node!=null,p=()=>!!(!f()||process.env.NO_COLOR!==void 0||process.env.CI!==void 0||process.stdout&&!process.stdout.isTTY),m=(e,t)=>f()&&!p()?`${d[e]}${t}${d.reset}`:t,h=e=>Object.entries(e.byPath).map(([e,t])=>{let n=t.message.startsWith(e)?t.message.slice(e.length):t.message,r=n.match(/\(was "([^"]+)"\)/),i=r?n.replace(`(was "${r[1]}")`,`(was ${m(`cyan`,`"${r[1]}"`)})`):n;return`${m(`yellow`,e)} ${i.trimStart()}`}).join(`
4
- `);var g=class extends Error{constructor(e,t=`Errors found while validating environment variables`){super(`${m(`red`,t)}\n${u(h(e))}\n`),this.name=`ArkEnvError`}};Object.defineProperty(g,`name`,{value:`ArkEnvError`});const _=a.type;function v(e,{env:t=process.env,coerce:n=!0,onUndeclaredKey:r=`delete`}={}){let i=typeof e==`function`&&`assert`in e?e:a.type.raw(e);i=i.onUndeclaredKey(r),n&&(i=l(i));let o=i(t);if(o instanceof _.errors)throw new g(o);return o}const y=v;var b=y;exports.ArkEnvError=g,exports.createEnv=v,exports.default=b,exports.type=_;
4
+ `);var g=class extends Error{constructor(e,t=`Errors found while validating environment variables`){super(`${m(`red`,t)}\n${u(h(e))}\n`),this.name=`ArkEnvError`}};Object.defineProperty(g,`name`,{value:`ArkEnvError`});const _=a.type;function v(e,{env:t=process.env,coerce:n=!0,onUndeclaredKey:r=`delete`,arrayFormat:i=`comma`}={}){let o=typeof e==`function`&&`assert`in e?e:a.type.raw(e);o=o.onUndeclaredKey(r),n&&(o=l(o,{arrayFormat:i}));let s=o(t);if(s instanceof _.errors)throw new g(s);return s}const y=v;var b=y;exports.ArkEnvError=g,exports.createEnv=v,exports.default=b,exports.type=_;
package/dist/index.d.cts CHANGED
@@ -103,6 +103,18 @@ declare const SchemaShape: arktype_internal_variants_object_ts0.ObjectType<{
103
103
  type SchemaShape = typeof SchemaShape.infer;
104
104
  type EnvSchemaWithType = Type<SchemaShape, $>;
105
105
  //#endregion
106
+ //#region src/utils/coerce.d.ts
107
+ /**
108
+ * Options for coercion behavior.
109
+ */
110
+ type CoerceOptions = {
111
+ /**
112
+ * format to use for array parsing
113
+ * @default "comma"
114
+ */
115
+ arrayFormat?: "comma" | "json";
116
+ };
117
+ //#endregion
106
118
  //#region src/create-env.d.ts
107
119
  type EnvSchema<def$1> = type$1.validate<def$1, $>;
108
120
  type RuntimeEnvironment = Record<string, string | undefined>;
@@ -133,6 +145,15 @@ type ArkEnvConfig = {
133
145
  * @see https://arktype.io/docs/configuration#onundeclaredkey
134
146
  */
135
147
  onUndeclaredKey?: "ignore" | "delete" | "reject";
148
+ /**
149
+ * The format to use for array parsing when coercion is enabled.
150
+ *
151
+ * - `comma` (default): Strings are split by comma and trimmed.
152
+ * - `json`: Strings are parsed as JSON.
153
+ *
154
+ * @default "comma"
155
+ */
156
+ arrayFormat?: CoerceOptions["arrayFormat"];
136
157
  };
137
158
  /**
138
159
  * TODO: `SchemaShape` is basically `Record<string, unknown>`.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":["arktype0","arktype_internal_keywords_string_ts0","arktype_internal_attributes_ts0","$","trim","To","Submodule","normalize","capitalize","stringDate","stringInteger","ip","stringJson","lower","stringNumeric","url","uuid","Scope","type","InferType","T","Record","errors","Any","$","Type","SchemaShape","arktype_internal_variants_object_ts0","ObjectType","infer","EnvSchemaWithType"],"sources":["../../internal/scope/dist/index.d.ts","../../internal/types/dist/infer-type.d.ts","../../internal/types/dist/schema.d.ts","../src/create-env.ts","../src/type.ts","../src/errors.ts","../src/index.ts"],"sourcesContent":["import * as arktype0 from \"arktype\";\nimport * as arktype_internal_keywords_string_ts0 from \"arktype/internal/keywords/string.ts\";\nimport * as arktype_internal_attributes_ts0 from \"arktype/internal/attributes.ts\";\n\n//#region src/index.d.ts\n/**\n * The root scope for the ArkEnv library,\n * containing extensions to the ArkType scopes with ArkEnv-specific types\n * like `string.host` and `number.port`.\n */\ndeclare const $: arktype0.Scope<{\n string: arktype0.Submodule<{\n trim: arktype0.Submodule<arktype_internal_keywords_string_ts0.trim.$ & {\n \" arkInferred\": (In: string) => arktype_internal_attributes_ts0.To<string>;\n }>;\n normalize: arktype0.Submodule<arktype_internal_keywords_string_ts0.normalize.$ & {\n \" arkInferred\": (In: string) => arktype_internal_attributes_ts0.To<string>;\n }>;\n root: string;\n alpha: string;\n alphanumeric: string;\n hex: string;\n base64: arktype0.Submodule<{\n root: string;\n url: string;\n } & {\n \" arkInferred\": string;\n }>;\n capitalize: arktype0.Submodule<arktype_internal_keywords_string_ts0.capitalize.$ & {\n \" arkInferred\": (In: string) => arktype_internal_attributes_ts0.To<string>;\n }>;\n creditCard: string;\n date: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringDate.$ & {\n \" arkInferred\": string;\n }>;\n digits: string;\n email: string;\n integer: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringInteger.$ & {\n \" arkInferred\": string;\n }>;\n ip: arktype0.Submodule<arktype_internal_keywords_string_ts0.ip.$ & {\n \" arkInferred\": string;\n }>;\n json: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringJson.$ & {\n \" arkInferred\": string;\n }>;\n lower: arktype0.Submodule<arktype_internal_keywords_string_ts0.lower.$ & {\n \" arkInferred\": (In: string) => arktype_internal_attributes_ts0.To<string>;\n }>;\n numeric: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringNumeric.$ & {\n \" arkInferred\": string;\n }>;\n regex: string;\n semver: string;\n upper: arktype0.Submodule<{\n root: (In: string) => arktype_internal_attributes_ts0.To<string>;\n preformatted: string;\n } & {\n \" arkInferred\": (In: string) => arktype_internal_attributes_ts0.To<string>;\n }>;\n url: arktype0.Submodule<arktype_internal_keywords_string_ts0.url.$ & {\n \" arkInferred\": string;\n }>;\n uuid: arktype0.Submodule<arktype_internal_keywords_string_ts0.uuid.$ & {\n \" arkInferred\": string;\n }>;\n \" arkInferred\": string;\n host: string;\n }>;\n number: arktype0.Submodule<{\n NaN: number;\n Infinity: number;\n root: number;\n integer: number;\n \" arkInferred\": number;\n epoch: number;\n safe: number;\n NegativeInfinity: number;\n port: number;\n }>;\n}>;\ntype $ = (typeof $)[\"t\"];\n//#endregion\nexport { $ };\n//# sourceMappingURL=index.d.ts.map","import type { type } from \"arktype\";\n/**\n * Extract the inferred type from an ArkType type definition by checking its call signature.\n * When a type definition is called, it returns either the validated value or type.errors.\n *\n * @template T - The ArkType type definition to infer from\n */\nexport type InferType<T> = T extends (value: Record<string, string | undefined>) => infer R ? R extends type.errors ? never : R : T extends type.Any<infer U, infer _Scope> ? U : never;\n//# sourceMappingURL=infer-type.d.ts.map","import type { $ } from \"@repo/scope\";\nimport { type Type } from \"arktype\";\nexport declare const SchemaShape: import(\"arktype/internal/variants/object.ts\").ObjectType<{\n [x: string]: unknown;\n}, {}>;\nexport type SchemaShape = typeof SchemaShape.infer;\nexport type EnvSchemaWithType = Type<SchemaShape, $>;\n//# sourceMappingURL=schema.d.ts.map"],"mappings":";;;;;;;;;;;;;AAEkF;;cAQpEG,CAGwBD,EAHrBF,QAAAA,CAASiB,KAGYf,CAAAA;EAD5BF,MAAAA,EADAA,QAAAA,CAASM,SACAA,CAAAA;IAGeL,IAAAA,EAHxBD,QAAAA,CAASM,SAGeL,CAHLA,oCAAAA,CAAqCG,IAAAA,CAAKD,CAGUA,GAAAA;MAC3CD,cAAAA,EAAAA,CAAAA,EAAAA,EAAAA,MAAgCG,EAAAA,GAHhCH,+BAAAA,CAAgCG,EAGAA,CAAAA,MAAAA,CAAAA;IADvDL,CAAAA,CAAAA;IAOHA,SAASM,EAPNN,QAAAA,CAASM,SAOHA,CAPaL,oCAAAA,CAAqCM,SAAAA,CAAUJ,CAO5DG,GAAAA;MAMcL,cAAAA,EAAAA,CAAAA,EAAAA,EAAAA,MAAAA,EAAAA,GAZGC,+BAAAA,CAAgCG,EAYaF,CAAAA,MAAAA,CAAAA;IAC7CD,CAAAA,CAAAA;IADtBF,IAAAA,EAASM,MAAAA;IAIIL,KAAAA,EAAAA,MAAAA;IAAnBD,YAASM,EAAAA,MAAAA;IAKaL,GAAAA,EAAAA,MAAAA;IAAnBD,MAASM,EAfVN,QAAAA,CAASM,SAeCA,CAAAA;MAGKL,IAAAA,EAAAA,MAAAA;MAAnBD,GAAAA,EAASM,MAAAA;IAGYL,CAAAA,GAAAA;MAAnBD,cAASM,EAAAA,MAAAA;IAGWL,CAAAA,CAAAA;IACQC,UAAAA,EAnBtBF,QAAAA,CAASM,SAmB6CD,CAnBnCJ,oCAAAA,CAAqCO,UAAAA,CAAWL,CAmBbE,GAAAA;MAD3DL,cAASM,EAAAA,CAAAA,EAAAA,EAAAA,MAAAA,EAAAA,GAjBkBJ,+BAAAA,CAAgCG,EAiBlDC,CAA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A,IAAAA,oBAAgCG,qDAAAA;MAJlDC,cAAAA,EAAAA,MAAAA;IAMQL,CAAAA,CAAAA;IAAnBD,KAASM,oBAAAA,gDAAAA;MAGWL,cAAAA,EAAAA,CAAAA,EAAAA,EAAAA,MAAqCe,EAAAA,qCAAKb,CAAAA,MAAAA,CAAAA;IAA7DH,CAAAA,CAASM;IApDTN,OAASM,oBAAAA,wDAAAA;MA0DAA,cAAAA,EAAAA,MAAAA;IA3DFN,CAAAA,CAASiB;IAAK,KAAA,EAAA,MAAA;IAuEzB,MAAA,EAAA,MAAY;;;;IC1ENE,CAAAA,GAAAA;MAAeC,cAAAA,EAAAA,CAAAA,EAAAA,EAAAA,MAAAA,EAAAA,qCAAAA,CAAAA,MAAAA,CAAAA;IAAkBC,CAAAA,CAAAA;IAAgEC,GAAAA,oBAAAA,8CAAAA;MAAqBF,cAAAA,EAAAA,MAAAA;IAAeG,CAAAA,CAAAA;IAAG,IAAA,oBAAA,+CAAA;;;;ICL/HG,IAAAA,EAAAA,MAEf;EACMA,CAAAA,CAAAA;EACAI,MAAAA,oBAAiB,CAAA;IAAQJ,GAAAA,EAAAA,MAAAA;IAAaF,QAAAA,EAAAA,MAAAA;IAAlBC,IAAAA,EAAAA,MAAAA;IAAI,OAAA,EAAA,MAAA;;;;ICCxB,gBAAS,EAAA,MAAA;IAAoB,IAAA,EAAA,MAAA;EAAK,CAAA,CAAA;CAAjB,CAAA;;;cEqBhB,WAAA,SAAoB,KAAA;ELlBnBtB,WAsEZ,CAAA,MAAA,EKlDQ,SLkDR,EAAA,OAAA,CAAA,EAAA,MAAA;;;;;;;;;cMvEI,eAAM"}
1
+ {"version":3,"file":"index.d.cts","names":["arktype0","arktype_internal_keywords_string_ts0","arktype_internal_attributes_ts0","$","trim","To","Submodule","normalize","capitalize","stringDate","stringInteger","ip","stringJson","lower","stringNumeric","url","uuid","Scope","type","InferType","T","Record","errors","Any","$","Type","SchemaShape","arktype_internal_variants_object_ts0","ObjectType","infer","EnvSchemaWithType"],"sources":["../../internal/scope/dist/index.d.ts","../../internal/types/dist/infer-type.d.ts","../../internal/types/dist/schema.d.ts","../src/utils/coerce.ts","../src/create-env.ts","../src/type.ts","../src/errors.ts","../src/index.ts"],"sourcesContent":["import * as arktype0 from \"arktype\";\nimport * as arktype_internal_keywords_string_ts0 from \"arktype/internal/keywords/string.ts\";\nimport * as arktype_internal_attributes_ts0 from \"arktype/internal/attributes.ts\";\n\n//#region src/index.d.ts\n/**\n * The root scope for the ArkEnv library,\n * containing extensions to the ArkType scopes with ArkEnv-specific types\n * like `string.host` and `number.port`.\n */\ndeclare const $: arktype0.Scope<{\n string: arktype0.Submodule<{\n trim: arktype0.Submodule<arktype_internal_keywords_string_ts0.trim.$ & {\n \" arkInferred\": (In: string) => arktype_internal_attributes_ts0.To<string>;\n }>;\n normalize: arktype0.Submodule<arktype_internal_keywords_string_ts0.normalize.$ & {\n \" arkInferred\": (In: string) => arktype_internal_attributes_ts0.To<string>;\n }>;\n root: string;\n alpha: string;\n alphanumeric: string;\n hex: string;\n base64: arktype0.Submodule<{\n root: string;\n url: string;\n } & {\n \" arkInferred\": string;\n }>;\n capitalize: arktype0.Submodule<arktype_internal_keywords_string_ts0.capitalize.$ & {\n \" arkInferred\": (In: string) => arktype_internal_attributes_ts0.To<string>;\n }>;\n creditCard: string;\n date: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringDate.$ & {\n \" arkInferred\": string;\n }>;\n digits: string;\n email: string;\n integer: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringInteger.$ & {\n \" arkInferred\": string;\n }>;\n ip: arktype0.Submodule<arktype_internal_keywords_string_ts0.ip.$ & {\n \" arkInferred\": string;\n }>;\n json: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringJson.$ & {\n \" arkInferred\": string;\n }>;\n lower: arktype0.Submodule<arktype_internal_keywords_string_ts0.lower.$ & {\n \" arkInferred\": (In: string) => arktype_internal_attributes_ts0.To<string>;\n }>;\n numeric: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringNumeric.$ & {\n \" arkInferred\": string;\n }>;\n regex: string;\n semver: string;\n upper: arktype0.Submodule<{\n root: (In: string) => arktype_internal_attributes_ts0.To<string>;\n preformatted: string;\n } & {\n \" arkInferred\": (In: string) => arktype_internal_attributes_ts0.To<string>;\n }>;\n url: arktype0.Submodule<arktype_internal_keywords_string_ts0.url.$ & {\n \" arkInferred\": string;\n }>;\n uuid: arktype0.Submodule<arktype_internal_keywords_string_ts0.uuid.$ & {\n \" arkInferred\": string;\n }>;\n \" arkInferred\": string;\n host: string;\n }>;\n number: arktype0.Submodule<{\n NaN: number;\n Infinity: number;\n root: number;\n integer: number;\n \" arkInferred\": number;\n epoch: number;\n safe: number;\n NegativeInfinity: number;\n port: number;\n }>;\n}>;\ntype $ = (typeof $)[\"t\"];\n//#endregion\nexport { $ };\n//# sourceMappingURL=index.d.ts.map","import type { type } from \"arktype\";\n/**\n * Extract the inferred type from an ArkType type definition by checking its call signature.\n * When a type definition is called, it returns either the validated value or type.errors.\n *\n * @template T - The ArkType type definition to infer from\n */\nexport type InferType<T> = T extends (value: Record<string, string | undefined>) => infer R ? R extends type.errors ? never : R : T extends type.Any<infer U, infer _Scope> ? U : never;\n//# sourceMappingURL=infer-type.d.ts.map","import type { $ } from \"@repo/scope\";\nimport { type Type } from \"arktype\";\nexport declare const SchemaShape: import(\"arktype/internal/variants/object.ts\").ObjectType<{\n [x: string]: unknown;\n}, {}>;\nexport type SchemaShape = typeof SchemaShape.infer;\nexport type EnvSchemaWithType = Type<SchemaShape, $>;\n//# sourceMappingURL=schema.d.ts.map"],"mappings":";;;;;;;;;;;;;AAEkF;;cAQpEG,CAGwBD,EAHrBF,QAAAA,CAASiB,KAGYf,CAAAA;EAD5BF,MAAAA,EADAA,QAAAA,CAASM,SACAA,CAAAA;IAGeL,IAAAA,EAHxBD,QAAAA,CAASM,SAGeL,CAHLA,oCAAAA,CAAqCG,IAAAA,CAAKD,CAGUA,GAAAA;MAC3CD,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AAA;MA0DAA,cAAAA,EAAAA,MAAAA;IA3DFN,CAAAA,CAASiB;IAAK,KAAA,EAAA,MAAA;IAuEzB,MAAA,EAAA,MAAY;;;;IC1ENE,CAAAA,GAAAA;MAAeC,cAAAA,EAAAA,CAAAA,EAAAA,EAAAA,MAAAA,EAAAA,qCAAAA,CAAAA,MAAAA,CAAAA;IAAkBC,CAAAA,CAAAA;IAAgEC,GAAAA,oBAAAA,8CAAAA;MAAqBF,cAAAA,EAAAA,MAAAA;IAAeG,CAAAA,CAAAA;IAAG,IAAA,oBAAA,+CAAA;;;;ICL/HG,IAAAA,EAAAA,MAEf;EACMA,CAAAA,CAAAA;EACAI,MAAAA,oBAAiB,CAAA;IAAQJ,GAAAA,EAAAA,MAAAA;IAAaF,QAAAA,EAAAA,MAAAA;IAAlBC,IAAAA,EAAAA,MAAAA;IAAI,OAAA,EAAA,MAAA;;;;ICexB,gBAAa,EAAA,MAAA;;;;;;cGOZ,WAAA,SAAoB,KAAA;ENlBnBtB,WAsEZ,CAAA,MAAA,EMlDQ,SNkDR,EAAA,OAAA,CAAA,EAAA,MAAA;;;;;;;;;cOvEI,eAAM"}
package/dist/index.d.ts CHANGED
@@ -103,6 +103,18 @@ declare const SchemaShape: arktype_internal_variants_object_ts0.ObjectType<{
103
103
  type SchemaShape = typeof SchemaShape.infer;
104
104
  type EnvSchemaWithType = Type<SchemaShape, $>;
105
105
  //#endregion
106
+ //#region src/utils/coerce.d.ts
107
+ /**
108
+ * Options for coercion behavior.
109
+ */
110
+ type CoerceOptions = {
111
+ /**
112
+ * format to use for array parsing
113
+ * @default "comma"
114
+ */
115
+ arrayFormat?: "comma" | "json";
116
+ };
117
+ //#endregion
106
118
  //#region src/create-env.d.ts
107
119
  type EnvSchema<def$1> = type$1.validate<def$1, $>;
108
120
  type RuntimeEnvironment = Record<string, string | undefined>;
@@ -133,6 +145,15 @@ type ArkEnvConfig = {
133
145
  * @see https://arktype.io/docs/configuration#onundeclaredkey
134
146
  */
135
147
  onUndeclaredKey?: "ignore" | "delete" | "reject";
148
+ /**
149
+ * The format to use for array parsing when coercion is enabled.
150
+ *
151
+ * - `comma` (default): Strings are split by comma and trimmed.
152
+ * - `json`: Strings are parsed as JSON.
153
+ *
154
+ * @default "comma"
155
+ */
156
+ arrayFormat?: CoerceOptions["arrayFormat"];
136
157
  };
137
158
  /**
138
159
  * TODO: `SchemaShape` is basically `Record<string, unknown>`.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":["arktype0","arktype_internal_keywords_string_ts0","arktype_internal_attributes_ts0","$","trim","To","Submodule","normalize","capitalize","stringDate","stringInteger","ip","stringJson","lower","stringNumeric","url","uuid","Scope","type","InferType","T","Record","errors","Any","$","Type","SchemaShape","arktype_internal_variants_object_ts0","ObjectType","infer","EnvSchemaWithType"],"sources":["../../internal/scope/dist/index.d.ts","../../internal/types/dist/infer-type.d.ts","../../internal/types/dist/schema.d.ts","../src/create-env.ts","../src/type.ts","../src/errors.ts","../src/index.ts"],"sourcesContent":["import * as arktype0 from \"arktype\";\nimport * as arktype_internal_keywords_string_ts0 from \"arktype/internal/keywords/string.ts\";\nimport * as arktype_internal_attributes_ts0 from \"arktype/internal/attributes.ts\";\n\n//#region src/index.d.ts\n/**\n * The root scope for the ArkEnv library,\n * containing extensions to the ArkType scopes with ArkEnv-specific types\n * like `string.host` and `number.port`.\n */\ndeclare const $: arktype0.Scope<{\n string: arktype0.Submodule<{\n trim: arktype0.Submodule<arktype_internal_keywords_string_ts0.trim.$ & {\n \" arkInferred\": (In: string) => arktype_internal_attributes_ts0.To<string>;\n }>;\n normalize: arktype0.Submodule<arktype_internal_keywords_string_ts0.normalize.$ & {\n \" arkInferred\": (In: string) => arktype_internal_attributes_ts0.To<string>;\n }>;\n root: string;\n alpha: string;\n alphanumeric: string;\n hex: string;\n base64: arktype0.Submodule<{\n root: string;\n url: string;\n } & {\n \" arkInferred\": string;\n }>;\n capitalize: arktype0.Submodule<arktype_internal_keywords_string_ts0.capitalize.$ & {\n \" arkInferred\": (In: string) => arktype_internal_attributes_ts0.To<string>;\n }>;\n creditCard: string;\n date: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringDate.$ & {\n \" arkInferred\": string;\n }>;\n digits: string;\n email: string;\n integer: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringInteger.$ & {\n \" arkInferred\": string;\n }>;\n ip: arktype0.Submodule<arktype_internal_keywords_string_ts0.ip.$ & {\n \" arkInferred\": string;\n }>;\n json: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringJson.$ & {\n \" arkInferred\": string;\n }>;\n lower: arktype0.Submodule<arktype_internal_keywords_string_ts0.lower.$ & {\n \" arkInferred\": (In: string) => arktype_internal_attributes_ts0.To<string>;\n }>;\n numeric: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringNumeric.$ & {\n \" arkInferred\": string;\n }>;\n regex: string;\n semver: string;\n upper: arktype0.Submodule<{\n root: (In: string) => arktype_internal_attributes_ts0.To<string>;\n preformatted: string;\n } & {\n \" arkInferred\": (In: string) => arktype_internal_attributes_ts0.To<string>;\n }>;\n url: arktype0.Submodule<arktype_internal_keywords_string_ts0.url.$ & {\n \" arkInferred\": string;\n }>;\n uuid: arktype0.Submodule<arktype_internal_keywords_string_ts0.uuid.$ & {\n \" arkInferred\": string;\n }>;\n \" arkInferred\": string;\n host: string;\n }>;\n number: arktype0.Submodule<{\n NaN: number;\n Infinity: number;\n root: number;\n integer: number;\n \" arkInferred\": number;\n epoch: number;\n safe: number;\n NegativeInfinity: number;\n port: number;\n }>;\n}>;\ntype $ = (typeof $)[\"t\"];\n//#endregion\nexport { $ };\n//# sourceMappingURL=index.d.ts.map","import type { type } from \"arktype\";\n/**\n * Extract the inferred type from an ArkType type definition by checking its call signature.\n * When a type definition is called, it returns either the validated value or type.errors.\n *\n * @template T - The ArkType type definition to infer from\n */\nexport type InferType<T> = T extends (value: Record<string, string | undefined>) => infer R ? R extends type.errors ? never : R : T extends type.Any<infer U, infer _Scope> ? U : never;\n//# sourceMappingURL=infer-type.d.ts.map","import type { $ } from \"@repo/scope\";\nimport { type Type } from \"arktype\";\nexport declare const SchemaShape: import(\"arktype/internal/variants/object.ts\").ObjectType<{\n [x: string]: unknown;\n}, {}>;\nexport type SchemaShape = typeof SchemaShape.infer;\nexport type EnvSchemaWithType = Type<SchemaShape, $>;\n//# sourceMappingURL=schema.d.ts.map"],"mappings":";;;;;;;;;;;;;AAEkF;;cAQpEG,CAGwBD,EAHrBF,QAAAA,CAASiB,KAGYf,CAAAA;EAD5BF,MAAAA,EADAA,QAAAA,CAASM,SACAA,CAAAA;IAGeL,IAAAA,EAHxBD,QAAAA,CAASM,SAGeL,CAHLA,oCAAAA,CAAqCG,IAAAA,CAAKD,CAGUA,GAAAA;MAC3CD,cAAAA,EAAAA,CAAAA,EAAAA,EAAAA,MAAgCG,EAAAA,GAHhCH,+BAAAA,CAAgCG,EAGAA,CAAAA,MAAAA,CAAAA;IADvDL,CAAAA,CAAAA;IAOHA,SAASM,EAPNN,QAAAA,CAASM,SAOHA,CAPaL,oCAAAA,CAAqCM,SAAAA,CAAUJ,CAO5DG,GAAAA;MAMcL,cAAAA,EAAAA,CAAAA,EAAAA,EAAAA,MAAAA,EAAAA,GAZGC,+BAAAA,CAAgCG,EAYaF,CAAAA,MAAAA,CAAAA;IAC7CD,CAAAA,CAAAA;IADtBF,IAAAA,EAASM,MAAAA;IAIIL,KAAAA,EAAAA,MAAAA;IAAnBD,YAASM,EAAAA,MAAAA;IAKaL,GAAAA,EAAAA,MAAAA;IAAnBD,MAASM,EAfVN,QAAAA,CAASM,SAeCA,CAAAA;MAGKL,IAAAA,EAAAA,MAAAA;MAAnBD,GAAAA,EAASM,MAAAA;IAGYL,CAAAA,GAAAA;MAAnBD,cAASM,EAAAA,MAAAA;IAGWL,CAAAA,CAAAA;IACQC,UAAAA,EAnBtBF,QAAAA,CAASM,SAmB6CD,CAnBnCJ,oCAAAA,CAAqCO,UAAAA,CAAWL,CAmBbE,GAAAA;M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,CAASM;IAGYL,EAAAA,oBAAqCa,6CAAcX;MAA7DG,cAAAA,EAAAA,MAAAA;IAMMJ,CAAAA,CAAAA;IAGUA,IAAAA,oBAAgCG,qDAAAA;MAJlDC,cAAAA,EAAAA,MAAAA;IAMQL,CAAAA,CAAAA;IAAnBD,KAASM,oBAAAA,gDAAAA;MAGWL,cAAAA,EAAAA,CAAAA,EAAAA,EAAAA,MAAqCe,EAAAA,qCAAKb,CAAAA,MAAAA,CAAAA;IAA7DH,CAAAA,CAASM;IApDTN,OAASM,oBAAAA,wDAAAA;MA0DAA,cAAAA,EAAAA,MAAAA;IA3DFN,CAAAA,CAASiB;IAAK,KAAA,EAAA,MAAA;IAuEzB,MAAA,EAAA,MAAY;;;;IC1ENE,CAAAA,GAAAA;MAAeC,cAAAA,EAAAA,CAAAA,EAAAA,EAAAA,MAAAA,EAAAA,qCAAAA,CAAAA,MAAAA,CAAAA;IAAkBC,CAAAA,CAAAA;IAAgEC,GAAAA,oBAAAA,8CAAAA;MAAqBF,cAAAA,EAAAA,MAAAA;IAAeG,CAAAA,CAAAA;IAAG,IAAA,oBAAA,+CAAA;;;;ICL/HG,IAAAA,EAAAA,MAEf;EACMA,CAAAA,CAAAA;EACAI,MAAAA,oBAAiB,CAAA;IAAQJ,GAAAA,EAAAA,MAAAA;IAAaF,QAAAA,EAAAA,MAAAA;IAAlBC,IAAAA,EAAAA,MAAAA;IAAI,OAAA,EAAA,MAAA;;;;ICCxB,gBAAS,EAAA,MAAA;IAAoB,IAAA,EAAA,MAAA;EAAK,CAAA,CAAA;CAAjB,CAAA;;;cEqBhB,WAAA,SAAoB,KAAA;ELlBnBtB,WAsEZ,CAAA,MAAA,EKlDQ,SLkDR,EAAA,OAAA,CAAA,EAAA,MAAA;;;;;;;;;cMvEI,eAAM"}
1
+ {"version":3,"file":"index.d.ts","names":["arktype0","arktype_internal_keywords_string_ts0","arktype_internal_attributes_ts0","$","trim","To","Submodule","normalize","capitalize","stringDate","stringInteger","ip","stringJson","lower","stringNumeric","url","uuid","Scope","type","InferType","T","Record","errors","Any","$","Type","SchemaShape","arktype_internal_variants_object_ts0","ObjectType","infer","EnvSchemaWithType"],"sources":["../../internal/scope/dist/index.d.ts","../../internal/types/dist/infer-type.d.ts","../../internal/types/dist/schema.d.ts","../src/utils/coerce.ts","../src/create-env.ts","../src/type.ts","../src/errors.ts","../src/index.ts"],"sourcesContent":["import * as arktype0 from \"arktype\";\nimport * as arktype_internal_keywords_string_ts0 from \"arktype/internal/keywords/string.ts\";\nimport * as arktype_internal_attributes_ts0 from \"arktype/internal/attributes.ts\";\n\n//#region src/index.d.ts\n/**\n * The root scope for the ArkEnv library,\n * containing extensions to the ArkType scopes with ArkEnv-specific types\n * like `string.host` and `number.port`.\n */\ndeclare const $: arktype0.Scope<{\n string: arktype0.Submodule<{\n trim: arktype0.Submodule<arktype_internal_keywords_string_ts0.trim.$ & {\n \" arkInferred\": (In: string) => arktype_internal_attributes_ts0.To<string>;\n }>;\n normalize: arktype0.Submodule<arktype_internal_keywords_string_ts0.normalize.$ & {\n \" arkInferred\": (In: string) => arktype_internal_attributes_ts0.To<string>;\n }>;\n root: string;\n alpha: string;\n alphanumeric: string;\n hex: string;\n base64: arktype0.Submodule<{\n root: string;\n url: string;\n } & {\n \" arkInferred\": string;\n }>;\n capitalize: arktype0.Submodule<arktype_internal_keywords_string_ts0.capitalize.$ & {\n \" arkInferred\": (In: string) => arktype_internal_attributes_ts0.To<string>;\n }>;\n creditCard: string;\n date: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringDate.$ & {\n \" arkInferred\": string;\n }>;\n digits: string;\n email: string;\n integer: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringInteger.$ & {\n \" arkInferred\": string;\n }>;\n ip: arktype0.Submodule<arktype_internal_keywords_string_ts0.ip.$ & {\n \" arkInferred\": string;\n }>;\n json: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringJson.$ & {\n \" arkInferred\": string;\n }>;\n lower: arktype0.Submodule<arktype_internal_keywords_string_ts0.lower.$ & {\n \" arkInferred\": (In: string) => arktype_internal_attributes_ts0.To<string>;\n }>;\n numeric: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringNumeric.$ & {\n \" arkInferred\": string;\n }>;\n regex: string;\n semver: string;\n upper: arktype0.Submodule<{\n root: (In: string) => arktype_internal_attributes_ts0.To<string>;\n preformatted: string;\n } & {\n \" arkInferred\": (In: string) => arktype_internal_attributes_ts0.To<string>;\n }>;\n url: arktype0.Submodule<arktype_internal_keywords_string_ts0.url.$ & {\n \" arkInferred\": string;\n }>;\n uuid: arktype0.Submodule<arktype_internal_keywords_string_ts0.uuid.$ & {\n \" arkInferred\": string;\n }>;\n \" arkInferred\": string;\n host: string;\n }>;\n number: arktype0.Submodule<{\n NaN: number;\n Infinity: number;\n root: number;\n integer: number;\n \" arkInferred\": number;\n epoch: number;\n safe: number;\n NegativeInfinity: number;\n port: number;\n }>;\n}>;\ntype $ = (typeof $)[\"t\"];\n//#endregion\nexport { $ };\n//# sourceMappingURL=index.d.ts.map","import type { type } from \"arktype\";\n/**\n * Extract the inferred type from an ArkType type definition by checking its call signature.\n * When a type definition is called, it returns either the validated value or type.errors.\n *\n * @template T - The ArkType type definition to infer from\n */\nexport type InferType<T> = T extends (value: Record<string, string | undefined>) => infer R ? R extends type.errors ? never : R : T extends type.Any<infer U, infer _Scope> ? U : never;\n//# sourceMappingURL=infer-type.d.ts.map","import type { $ } from \"@repo/scope\";\nimport { type Type } from \"arktype\";\nexport declare const SchemaShape: import(\"arktype/internal/variants/object.ts\").ObjectType<{\n [x: string]: unknown;\n}, {}>;\nexport type SchemaShape = typeof SchemaShape.infer;\nexport type EnvSchemaWithType = Type<SchemaShape, $>;\n//# sourceMappingURL=schema.d.ts.map"],"mappings":";;;;;;;;;;;;;AAEkF;;cAQpEG,CAGwBD,EAHrBF,QAAAA,CAASiB,KAGYf,CAAAA;EAD5BF,MAAAA,EADAA,QAAAA,CAASM,SACAA,CAAAA;IAGeL,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AAA,MAAqCe,EAAAA,qCAAKb,CAAAA,MAAAA,CAAAA;IAA7DH,CAAAA,CAASM;IApDTN,OAASM,oBAAAA,wDAAAA;MA0DAA,cAAAA,EAAAA,MAAAA;IA3DFN,CAAAA,CAASiB;IAAK,KAAA,EAAA,MAAA;IAuEzB,MAAA,EAAA,MAAY;;;;IC1ENE,CAAAA,GAAAA;MAAeC,cAAAA,EAAAA,CAAAA,EAAAA,EAAAA,MAAAA,EAAAA,qCAAAA,CAAAA,MAAAA,CAAAA;IAAkBC,CAAAA,CAAAA;IAAgEC,GAAAA,oBAAAA,8CAAAA;MAAqBF,cAAAA,EAAAA,MAAAA;IAAeG,CAAAA,CAAAA;IAAG,IAAA,oBAAA,+CAAA;;;;ICL/HG,IAAAA,EAAAA,MAEf;EACMA,CAAAA,CAAAA;EACAI,MAAAA,oBAAiB,CAAA;IAAQJ,GAAAA,EAAAA,MAAAA;IAAaF,QAAAA,EAAAA,MAAAA;IAAlBC,IAAAA,EAAAA,MAAAA;IAAI,OAAA,EAAA,MAAA;;;;ICexB,gBAAa,EAAA,MAAA;;;;;;cGOZ,WAAA,SAAoB,KAAA;ENlBnBtB,WAsEZ,CAAA,MAAA,EMlDQ,SNkDR,EAAA,OAAA,CAAA,EAAA,MAAA;;;;;;;;;cOvEI,eAAM"}
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import{scope as e,type as t}from"arktype";const n=t(`unknown`).pipe(e=>{if(typeof e==`number`||typeof e!=`string`)return e;let t=e.trim();if(t===``)return e;if(t===`NaN`)return NaN;let n=Number(t);return Number.isNaN(n)?e:n}),r=t(`unknown`).pipe(e=>e===`true`?!0:e===`false`?!1:e),i=t(`0 <= number.integer <= 65535`),a=t(`string.ip | 'localhost'`),o=e({string:t.module({...t.keywords.string,host:a}),number:t.module({...t.keywords.number,port:i})}),s=(e,t=[])=>{let n=[];if(typeof e==`boolean`)return n;if(`const`in e&&(typeof e.const==`number`||typeof e.const==`boolean`)&&n.push({path:[...t]}),`enum`in e&&e.enum&&e.enum.some(e=>typeof e==`number`||typeof e==`boolean`)&&n.push({path:[...t]}),`type`in e){if(e.type===`number`||e.type===`integer`)n.push({path:[...t]});else if(e.type===`boolean`)n.push({path:[...t]});else if(e.type===`array`)`items`in e&&e.items&&(Array.isArray(e.items)?e.items.forEach((e,r)=>{n.push(...s(e,[...t,`${r}`]))}):n.push(...s(e.items,[...t,`*`])));else if(e.type===`object`&&`properties`in e&&e.properties)for(let[r,i]of Object.entries(e.properties))n.push(...s(i,[...t,r]))}if(`anyOf`in e&&e.anyOf)for(let r of e.anyOf)n.push(...s(r,t));if(`allOf`in e&&e.allOf)for(let r of e.allOf)n.push(...s(r,t));if(`oneOf`in e&&e.oneOf)for(let r of e.oneOf)n.push(...s(r,t));let r=new Set;return n.filter(e=>{let t=JSON.stringify(e.path);return r.has(t)?!1:(r.add(t),!0)})},c=(e,t)=>{if(typeof e!=`object`||!e){if(t.some(e=>e.path.length===0)){let t=n(e);return typeof t==`number`?t:r(e)}return e}let i=(e,t)=>{if(!e||typeof e!=`object`)return;if(t.length===0){if(Array.isArray(e))for(let t of e)i(t,[]);return}if(t.length===1){let i=t[0];if(i===`*`){if(Array.isArray(e))for(let t=0;t<e.length;t++){let i=e[t],a=n(i);typeof a==`number`?e[t]=a:e[t]=r(i)}return}let a=e;if(Object.prototype.hasOwnProperty.call(a,i)){let e=a[i];if(Array.isArray(e))for(let t=0;t<e.length;t++){let i=e[t],a=n(i);typeof a==`number`?e[t]=a:e[t]=r(i)}else{let t=n(e);typeof t==`number`?a[i]=t:a[i]=r(e)}}return}let[a,...o]=t;if(a===`*`){if(Array.isArray(e))for(let t of e)i(t,o);return}i(e[a],o)};for(let n of t)i(e,n.path);return e};function l(e){let n=s(e.in.toJsonSchema({fallback:e=>e.base}));return n.length===0?e:t(`unknown`).pipe(e=>c(e,n)).pipe(e)}const u=(e,t=2,{dontDetectNewlines:n=!1}={})=>n?`${` `.repeat(t)}${e}`:e.split(`
1
+ import{scope as e,type as t}from"arktype";const n=t(`unknown`).pipe(e=>{if(typeof e==`number`||typeof e!=`string`)return e;let t=e.trim();if(t===``)return e;if(t===`NaN`)return NaN;let n=Number(t);return Number.isNaN(n)?e:n}),r=t(`unknown`).pipe(e=>e===`true`?!0:e===`false`?!1:e),i=t(`0 <= number.integer <= 65535`),a=t(`string.ip | 'localhost'`),o=e({string:t.module({...t.keywords.string,host:a}),number:t.module({...t.keywords.number,port:i})}),s=(e,t=[])=>{let n=[];if(typeof e==`boolean`)return n;if(`const`in e&&(typeof e.const==`number`||typeof e.const==`boolean`)&&n.push({path:[...t],type:`primitive`}),`enum`in e&&e.enum&&e.enum.some(e=>typeof e==`number`||typeof e==`boolean`)&&n.push({path:[...t],type:`primitive`}),`type`in e){if(e.type===`number`||e.type===`integer`)n.push({path:[...t],type:`primitive`});else if(e.type===`boolean`)n.push({path:[...t],type:`primitive`});else if(e.type===`array`)n.push({path:[...t],type:`array`}),`items`in e&&e.items&&(Array.isArray(e.items)?e.items.forEach((e,r)=>{n.push(...s(e,[...t,`${r}`]))}):n.push(...s(e.items,[...t,`*`])));else if(e.type===`object`&&`properties`in e&&e.properties)for(let[r,i]of Object.entries(e.properties))n.push(...s(i,[...t,r]))}if(`anyOf`in e&&e.anyOf)for(let r of e.anyOf)n.push(...s(r,t));if(`allOf`in e&&e.allOf)for(let r of e.allOf)n.push(...s(r,t));if(`oneOf`in e&&e.oneOf)for(let r of e.oneOf)n.push(...s(r,t));let r=new Set;return n.filter(e=>{let t=JSON.stringify(e.path)+e.type;return r.has(t)?!1:(r.add(t),!0)})},c=(e,t,i={})=>{let{arrayFormat:a=`comma`}=i,o=e=>{if(a===`json`)try{return JSON.parse(e)}catch{return e}return e.trim()?e.split(`,`).map(e=>e.trim()):[]};if(typeof e!=`object`||!e){if(t.some(e=>e.path.length===0)){if(t.find(e=>e.path.length===0)?.type===`array`&&typeof e==`string`)return o(e);let i=n(e);return typeof i==`number`?i:r(e)}return e}let s=(e,t,i)=>{if(!e||typeof e!=`object`||t.length===0)return;if(t.length===1){let a=t[0];if(a===`*`){if(Array.isArray(e))for(let t=0;t<e.length;t++){let a=e[t];if(i===`primitive`){let i=n(a);typeof i==`number`?e[t]=i:e[t]=r(a)}}return}let s=e;if(Object.prototype.hasOwnProperty.call(s,a)){let e=s[a];if(i===`array`&&typeof e==`string`){s[a]=o(e);return}if(Array.isArray(e)){if(i===`primitive`)for(let t=0;t<e.length;t++){let i=e[t],a=n(i);typeof a==`number`?e[t]=a:e[t]=r(i)}}else if(i===`primitive`){let t=n(e);typeof t==`number`?s[a]=t:s[a]=r(e)}}return}let[a,...c]=t;if(a===`*`){if(Array.isArray(e))for(let t of e)s(t,c,i);return}s(e[a],c,i)};for(let n of t)s(e,n.path,n.type);return e};function l(e,n){let r=s(e.in.toJsonSchema({fallback:e=>e.base}));return r.length===0?e:t(`unknown`).pipe(e=>c(e,r,n)).pipe(e)}const u=(e,t=2,{dontDetectNewlines:n=!1}={})=>n?`${` `.repeat(t)}${e}`:e.split(`
2
2
  `).map(e=>`${` `.repeat(t)}${e}`).join(`
3
3
  `),d={red:`\x1B[31m`,yellow:`\x1B[33m`,cyan:`\x1B[36m`,reset:`\x1B[0m`},f=()=>typeof process<`u`&&process.versions!=null&&process.versions.node!=null,p=()=>!!(!f()||process.env.NO_COLOR!==void 0||process.env.CI!==void 0||process.stdout&&!process.stdout.isTTY),m=(e,t)=>f()&&!p()?`${d[e]}${t}${d.reset}`:t,h=e=>Object.entries(e.byPath).map(([e,t])=>{let n=t.message.startsWith(e)?t.message.slice(e.length):t.message,r=n.match(/\(was "([^"]+)"\)/),i=r?n.replace(`(was "${r[1]}")`,`(was ${m(`cyan`,`"${r[1]}"`)})`):n;return`${m(`yellow`,e)} ${i.trimStart()}`}).join(`
4
- `);var g=class extends Error{constructor(e,t=`Errors found while validating environment variables`){super(`${m(`red`,t)}\n${u(h(e))}\n`),this.name=`ArkEnvError`}};Object.defineProperty(g,`name`,{value:`ArkEnvError`});const _=o.type;function v(e,{env:t=process.env,coerce:n=!0,onUndeclaredKey:r=`delete`}={}){let i=typeof e==`function`&&`assert`in e?e:o.type.raw(e);i=i.onUndeclaredKey(r),n&&(i=l(i));let a=i(t);if(a instanceof _.errors)throw new g(a);return a}var y=v;export{g as ArkEnvError,v as createEnv,y as default,_ as type};
4
+ `);var g=class extends Error{constructor(e,t=`Errors found while validating environment variables`){super(`${m(`red`,t)}\n${u(h(e))}\n`),this.name=`ArkEnvError`}};Object.defineProperty(g,`name`,{value:`ArkEnvError`});const _=o.type;function v(e,{env:t=process.env,coerce:n=!0,onUndeclaredKey:r=`delete`,arrayFormat:i=`comma`}={}){let a=typeof e==`function`&&`assert`in e?e:o.type.raw(e);a=a.onUndeclaredKey(r),n&&(a=l(a,{arrayFormat:i}));let s=a(t);if(s instanceof _.errors)throw new g(s);return s}var y=v;export{g as ArkEnvError,v as createEnv,y as default,_ as type};
5
5
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["e","t","n","i","n","r","e","t","results: CoercionTarget[]","t","maybeParsedNumber","maybeParsedBoolean","i","type","$","$"],"sources":["../../internal/keywords/dist/index.js","../../internal/scope/dist/index.js","../src/utils/coerce.ts","../src/utils/indent.ts","../src/utils/style-text.ts","../src/errors.ts","../src/type.ts","../src/create-env.ts","../src/index.ts"],"sourcesContent":["import{type as e}from\"arktype\";const t=e(`unknown`).pipe(e=>{if(typeof e==`number`||typeof e!=`string`)return e;let t=e.trim();if(t===``)return e;if(t===`NaN`)return NaN;let n=Number(t);return Number.isNaN(n)?e:n}),n=e(`unknown`).pipe(e=>e===`true`?!0:e===`false`?!1:e),r=e(`0 <= number.integer <= 65535`),i=e(`string.ip | 'localhost'`);export{i as host,n as maybeParsedBoolean,t as maybeParsedNumber,r as port};\n//# sourceMappingURL=index.js.map","import{host as e,port as t}from\"@repo/keywords\";import{scope as n,type as r}from\"arktype\";const i=n({string:r.module({...r.keywords.string,host:e}),number:r.module({...r.keywords.number,port:t})});export{i as $};\n//# sourceMappingURL=index.js.map","import { maybeParsedBoolean, maybeParsedNumber } from \"@repo/keywords\";\nimport { type BaseType, type JsonSchema, type } from \"arktype\";\n\n/**\n * A marker used in the coercion path to indicate that the target\n * is the *elements* of an array, rather than the array property itself.\n */\nconst ARRAY_ITEM_MARKER = \"*\";\n\n/**\n * @internal\n * Information about a path in the schema that requires coercion.\n */\ntype CoercionTarget = {\n\tpath: string[];\n};\n\n/**\n * Recursively find all paths in a JSON Schema that require coercion.\n * We prioritize \"number\", \"integer\", and \"boolean\" types.\n */\nconst findCoercionPaths = (\n\tnode: JsonSchema,\n\tpath: string[] = [],\n): CoercionTarget[] => {\n\tconst results: CoercionTarget[] = [];\n\n\tif (typeof node === \"boolean\") {\n\t\treturn results;\n\t}\n\n\tif (\"const\" in node) {\n\t\tif (typeof node.const === \"number\" || typeof node.const === \"boolean\") {\n\t\t\tresults.push({ path: [...path] });\n\t\t}\n\t}\n\n\tif (\"enum\" in node && node.enum) {\n\t\tif (\n\t\t\tnode.enum.some((v) => typeof v === \"number\" || typeof v === \"boolean\")\n\t\t) {\n\t\t\tresults.push({ path: [...path] });\n\t\t}\n\t}\n\n\tif (\"type\" in node) {\n\t\tif (node.type === \"number\" || node.type === \"integer\") {\n\t\t\tresults.push({ path: [...path] });\n\t\t} else if (node.type === \"boolean\") {\n\t\t\tresults.push({ path: [...path] });\n\t\t} else if (node.type === \"array\") {\n\t\t\tif (\"items\" in node && node.items) {\n\t\t\t\tif (Array.isArray(node.items)) {\n\t\t\t\t\t// Tuple traversal\n\t\t\t\t\tnode.items.forEach((item, index) => {\n\t\t\t\t\t\tresults.push(\n\t\t\t\t\t\t\t...findCoercionPaths(item as JsonSchema, [...path, `${index}`]),\n\t\t\t\t\t\t);\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\t// List traversal\n\t\t\t\t\tresults.push(\n\t\t\t\t\t\t...findCoercionPaths(node.items as JsonSchema, [\n\t\t\t\t\t\t\t...path,\n\t\t\t\t\t\t\tARRAY_ITEM_MARKER,\n\t\t\t\t\t\t]),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (node.type === \"object\") {\n\t\t\tif (\"properties\" in node && node.properties) {\n\t\t\t\tfor (const [key, prop] of Object.entries(node.properties)) {\n\t\t\t\t\tresults.push(\n\t\t\t\t\t\t...findCoercionPaths(prop as JsonSchema, [...path, key]),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (\"anyOf\" in node && node.anyOf) {\n\t\tfor (const branch of node.anyOf) {\n\t\t\tresults.push(...findCoercionPaths(branch as JsonSchema, path));\n\t\t}\n\t}\n\n\tif (\"allOf\" in node && node.allOf) {\n\t\tfor (const branch of node.allOf) {\n\t\t\tresults.push(...findCoercionPaths(branch as JsonSchema, path));\n\t\t}\n\t}\n\n\tif (\"oneOf\" in node && node.oneOf) {\n\t\tfor (const branch of node.oneOf) {\n\t\t\tresults.push(...findCoercionPaths(branch as JsonSchema, path));\n\t\t}\n\t}\n\n\t// Deduplicate by path\n\tconst seen = new Set<string>();\n\treturn results.filter((t) => {\n\t\tconst key = JSON.stringify(t.path);\n\t\tif (seen.has(key)) return false;\n\t\tseen.add(key);\n\t\treturn true;\n\t});\n};\n\n/**\n * Apply coercion to a data object based on identified paths.\n */\nconst applyCoercion = (data: unknown, targets: CoercionTarget[]) => {\n\tif (typeof data !== \"object\" || data === null) {\n\t\t// If root data needs coercion (e.g. root schema is number/boolean), handle it\n\t\tif (targets.some((t) => t.path.length === 0)) {\n\t\t\tconst asNumber = maybeParsedNumber(data);\n\t\t\tif (typeof asNumber === \"number\") {\n\t\t\t\treturn asNumber;\n\t\t\t}\n\t\t\treturn maybeParsedBoolean(data);\n\t\t}\n\t\treturn data;\n\t}\n\n\tconst walk = (current: unknown, targetPath: string[]) => {\n\t\tif (!current || typeof current !== \"object\") return;\n\n\t\t// Defensive: handle root-level or exhausted-path array traversal\n\t\t// Currently, root arrays produce targets like [{ path: [\"*\"] }] so this is rarely reached,\n\t\t// but guards against edge cases in schema introspection\n\t\tif (targetPath.length === 0) {\n\t\t\tif (Array.isArray(current)) {\n\t\t\t\tfor (const item of current) {\n\t\t\t\t\twalk(item, []);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// If we've reached the last key, apply coercion\n\t\tif (targetPath.length === 1) {\n\t\t\tconst lastKey = targetPath[0];\n\n\t\t\tif (lastKey === ARRAY_ITEM_MARKER) {\n\t\t\t\tif (Array.isArray(current)) {\n\t\t\t\t\tfor (let i = 0; i < current.length; i++) {\n\t\t\t\t\t\tconst original = current[i];\n\t\t\t\t\t\tconst asNumber = maybeParsedNumber(original);\n\t\t\t\t\t\tif (typeof asNumber === \"number\") {\n\t\t\t\t\t\t\tcurrent[i] = asNumber;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tcurrent[i] = maybeParsedBoolean(original);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst record = current as Record<string, unknown>;\n\t\t\t// biome-ignore lint/suspicious/noPrototypeBuiltins: ES2020 compatibility\n\t\t\tif (Object.prototype.hasOwnProperty.call(record, lastKey)) {\n\t\t\t\tconst original = record[lastKey];\n\n\t\t\t\tif (Array.isArray(original)) {\n\t\t\t\t\tfor (let i = 0; i < original.length; i++) {\n\t\t\t\t\t\tconst item = original[i];\n\t\t\t\t\t\tconst asNumber = maybeParsedNumber(item);\n\t\t\t\t\t\tif (typeof asNumber === \"number\") {\n\t\t\t\t\t\t\toriginal[i] = asNumber;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\toriginal[i] = maybeParsedBoolean(item);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconst asNumber = maybeParsedNumber(original);\n\t\t\t\t\t// If numeric parsing didn't produce a number, try boolean coercion\n\t\t\t\t\tif (typeof asNumber === \"number\") {\n\t\t\t\t\t\trecord[lastKey] = asNumber;\n\t\t\t\t\t} else {\n\t\t\t\t\t\trecord[lastKey] = maybeParsedBoolean(original);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// Recurse down\n\t\tconst [nextKey, ...rest] = targetPath;\n\n\t\tif (nextKey === ARRAY_ITEM_MARKER) {\n\t\t\tif (Array.isArray(current)) {\n\t\t\t\tfor (const item of current) {\n\t\t\t\t\twalk(item, rest);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tconst record = current as Record<string, unknown>;\n\t\twalk(record[nextKey], rest);\n\t};\n\n\tfor (const target of targets) {\n\t\twalk(data, target.path);\n\t}\n\n\treturn data;\n};\n\n/**\n * Create a coercing wrapper around an ArkType schema using JSON Schema introspection.\n * Pre-process input data to coerce string values to numbers/booleans at identified paths\n * before validation.\n */\nexport function coerce<t, $ = {}>(schema: BaseType<t, $>): BaseType<t, $> {\n\t// Use a fallback to handle unjsonifiable parts of the schema (like predicates)\n\t// by preserving the base schema. This ensures that even if part of the schema\n\t// cannot be fully represented in JSON Schema, we can still perform coercion\n\t// for the parts that can.\n\tconst json = schema.in.toJsonSchema({\n\t\tfallback: (ctx) => ctx.base,\n\t});\n\tconst targets = findCoercionPaths(json);\n\n\tif (targets.length === 0) {\n\t\treturn schema;\n\t}\n\n\t/*\n\t * We use `type(\"unknown\")` to start the pipeline, which initializes a default scope.\n\t * Integrating the original `schema` with its custom scope `$` into this pipeline\n\t * creates a scope mismatch in TypeScript ({} vs $).\n\t * We cast to `BaseType<t, $>` to assert the final contract is maintained.\n\t */\n\treturn type(\"unknown\")\n\t\t.pipe((data) => applyCoercion(data, targets))\n\t\t.pipe(schema) as BaseType<t, $>;\n}\n","/**\n * Options for the `indent` function\n */\ntype IndentOptions = {\n\t/**\n\t * Whether to detect newlines and indent each line individually, defaults to false (indenting the whole string)\n\t */\n\tdontDetectNewlines?: boolean;\n};\n\n/**\n * Indent a string by a given amount\n * @param str - The string to indent\n * @param amt - The amount to indent by, defaults to 2\n * @param options - {@link IndentOptions}\n * @returns The indented string\n */\nexport const indent = (\n\tstr: string,\n\tamt = 2,\n\t{ dontDetectNewlines = false }: IndentOptions = {},\n) => {\n\tconst detectNewlines = !dontDetectNewlines;\n\tif (detectNewlines) {\n\t\treturn str\n\t\t\t.split(\"\\n\")\n\t\t\t.map((line) => `${\" \".repeat(amt)}${line}`)\n\t\t\t.join(\"\\n\");\n\t}\n\n\treturn `${\" \".repeat(amt)}${str}`;\n};\n","/**\n * Cross-platform text styling utility\n * Uses ANSI colors in Node environments, plain text in browsers\n * Respects NO_COLOR, CI environment variables, and TTY detection\n */\n\n// ANSI color codes for Node environments\nconst colors = {\n\tred: \"\\x1b[31m\",\n\tyellow: \"\\x1b[33m\",\n\tcyan: \"\\x1b[36m\",\n\treset: \"\\x1b[0m\",\n} as const;\n\n/**\n * Check if we're in a Node environment (not browser)\n * Checked dynamically to allow for testing with mocked globals\n */\nconst isNode = (): boolean =>\n\ttypeof process !== \"undefined\" &&\n\tprocess.versions != null &&\n\tprocess.versions.node != null;\n\n/**\n * Check if colors should be disabled based on environment\n * Respects NO_COLOR, CI environment variables, and TTY detection\n */\nconst shouldDisableColors = (): boolean => {\n\tif (!isNode()) return true;\n\n\t// Respect NO_COLOR environment variable (https://no-color.org/)\n\tif (process.env.NO_COLOR !== undefined) return true;\n\n\t// Disable colors in CI environments by default\n\tif (process.env.CI !== undefined) return true;\n\n\t// Disable colors if not writing to a TTY\n\tif (process.stdout && !process.stdout.isTTY) return true;\n\n\treturn false;\n};\n\n/**\n * Style text with color. Uses ANSI codes in Node, plain text in browsers.\n * @param color - The color to apply\n * @param text - The text to style\n * @returns Styled text in Node (if colors enabled), plain text otherwise\n */\nexport const styleText = (\n\tcolor: \"red\" | \"yellow\" | \"cyan\",\n\ttext: string,\n): string => {\n\t// Use ANSI colors only in Node environments with colors enabled\n\tif (isNode() && !shouldDisableColors()) {\n\t\treturn `${colors[color]}${text}${colors.reset}`;\n\t}\n\t// Fall back to plain text in browsers or when colors are disabled\n\treturn text;\n};\n","import type { ArkErrors } from \"arktype\";\nimport { indent, styleText } from \"./utils\";\n\n/**\n * Format the errors returned by ArkType to be more readable\n * @param errors - The errors returned by ArkType\n * @returns A string of the formatted errors\n */\nexport const formatErrors = (errors: ArkErrors): string =>\n\tObject.entries(errors.byPath)\n\t\t.map(([path, error]) => {\n\t\t\tconst messageWithoutPath = error.message.startsWith(path)\n\t\t\t\t? error.message.slice(path.length)\n\t\t\t\t: error.message;\n\n\t\t\t// Extract the value in parentheses if it exists\n\t\t\tconst valueMatch = messageWithoutPath.match(/\\(was \"([^\"]+)\"\\)/);\n\t\t\tconst formattedMessage = valueMatch\n\t\t\t\t? messageWithoutPath.replace(\n\t\t\t\t\t\t`(was \"${valueMatch[1]}\")`,\n\t\t\t\t\t\t`(was ${styleText(\"cyan\", `\"${valueMatch[1]}\"`)})`,\n\t\t\t\t\t)\n\t\t\t\t: messageWithoutPath;\n\n\t\t\treturn `${styleText(\"yellow\", path)} ${formattedMessage.trimStart()}`;\n\t\t})\n\t\t.join(\"\\n\");\n\nexport class ArkEnvError extends Error {\n\tconstructor(\n\t\terrors: ArkErrors,\n\t\tmessage = \"Errors found while validating environment variables\",\n\t) {\n\t\tsuper(`${styleText(\"red\", message)}\\n${indent(formatErrors(errors))}\\n`);\n\t\tthis.name = \"ArkEnvError\";\n\t}\n}\n\nObject.defineProperty(ArkEnvError, \"name\", { value: \"ArkEnvError\" });\n","import { $ } from \"@repo/scope\";\n\nexport const type = $.type;\n","import { $ } from \"@repo/scope\";\nimport type { EnvSchemaWithType, InferType, SchemaShape } from \"@repo/types\";\nimport type { type as at, distill } from \"arktype\";\nimport { ArkEnvError } from \"./errors\";\nimport { type } from \"./type\";\nimport { coerce } from \"./utils\";\n\nexport type EnvSchema<def> = at.validate<def, $>;\ntype RuntimeEnvironment = Record<string, string | undefined>;\n\n/**\n * Configuration options for `createEnv`\n */\nexport type ArkEnvConfig = {\n\t/**\n\t * The environment variables to validate. Defaults to `process.env`\n\t */\n\tenv?: RuntimeEnvironment;\n\t/**\n\t * Whether to coerce environment variables to their defined types. Defaults to `true`\n\t */\n\tcoerce?: boolean;\n\t/**\n\t * Control how ArkEnv handles environment variables that are not defined in your schema.\n\t *\n\t * Defaults to `'delete'` to ensure your output object only contains\n\t * keys you've explicitly declared. This differs from ArkType's standard behavior, which\n\t * mirrors TypeScript by defaulting to `'ignore'`.\n\t *\n\t * - `delete` (ArkEnv default): Undeclared keys are allowed on input but stripped from the output.\n\t * - `ignore` (ArkType default): Undeclared keys are allowed and preserved in the output.\n\t * - `reject`: Undeclared keys will cause validation to fail.\n\t *\n\t * @default \"delete\"\n\t * @see https://arktype.io/docs/configuration#onundeclaredkey\n\t */\n\tonUndeclaredKey?: \"ignore\" | \"delete\" | \"reject\";\n};\n\n/**\n * TODO: `SchemaShape` is basically `Record<string, unknown>`.\n * If possible, find a better type than \"const T extends Record<string, unknown>\",\n * and be as close as possible to the type accepted by ArkType's `type`.\n */\n\n/**\n * Create an environment variables object from a schema and an environment\n * @param def - The environment variable schema (raw object or type definition created with `type()`)\n * @param config - Configuration options, see {@link ArkEnvConfig}\n * @returns The validated environment variable schema\n * @throws An {@link ArkEnvError | error} if the environment variables are invalid.\n */\nexport function createEnv<const T extends SchemaShape>(\n\tdef: EnvSchema<T>,\n\tconfig?: ArkEnvConfig,\n): distill.Out<at.infer<T, $>>;\nexport function createEnv<T extends EnvSchemaWithType>(\n\tdef: T,\n\tconfig?: ArkEnvConfig,\n): InferType<T>;\nexport function createEnv<const T extends SchemaShape>(\n\tdef: EnvSchema<T> | EnvSchemaWithType,\n\tconfig?: ArkEnvConfig,\n): distill.Out<at.infer<T, $>> | InferType<typeof def>;\nexport function createEnv<const T extends SchemaShape>(\n\tdef: EnvSchema<T> | EnvSchemaWithType,\n\t{\n\t\tenv = process.env,\n\t\tcoerce: shouldCoerce = true,\n\t\tonUndeclaredKey = \"delete\",\n\t}: ArkEnvConfig = {},\n): distill.Out<at.infer<T, $>> | InferType<typeof def> {\n\t// If def is a type definition (has assert method), use it directly\n\t// Otherwise, use raw() to convert the schema definition\n\tconst isCompiledType = typeof def === \"function\" && \"assert\" in def;\n\tlet schema = isCompiledType ? def : $.type.raw(def as EnvSchema<T>);\n\n\t// Apply the `onUndeclaredKey` option\n\tschema = schema.onUndeclaredKey(onUndeclaredKey);\n\n\t// Apply coercion transformation to allow strings to be parsed as numbers/booleans\n\tif (shouldCoerce) {\n\t\tschema = coerce(schema);\n\t}\n\n\t// Validate the environment variables\n\tconst validatedEnv = schema(env);\n\n\tif (validatedEnv instanceof type.errors) {\n\t\tthrow new ArkEnvError(validatedEnv);\n\t}\n\n\treturn validatedEnv;\n}\n","export type { EnvSchema } from \"./create-env\";\n\nimport { createEnv } from \"./create-env\";\n\n/**\n * `arkenv`'s main export, an alias for {@link createEnv}\n *\n * {@link https://arkenv.js.org | ArkEnv} is a typesafe environment variables validator from editor to runtime.\n */\nconst arkenv = createEnv;\nexport default arkenv;\nexport { type } from \"./type\";\nexport { createEnv };\nexport { ArkEnvError } from \"./errors\";\n"],"mappings":"0CAA+B,MAAM,EAAEA,EAAE,UAAU,CAAC,KAAK,GAAG,CAAC,GAAG,OAAO,GAAG,UAAU,OAAO,GAAG,SAAS,OAAO,EAAE,IAAIC,EAAE,EAAE,MAAM,CAAC,GAAGA,IAAI,GAAG,OAAO,EAAE,GAAGA,IAAI,MAAM,MAAO,KAAI,IAAIC,EAAE,OAAOD,EAAE,CAAC,OAAO,OAAO,MAAMC,EAAE,CAAC,EAAEA,GAAG,CAAC,EAAEF,EAAE,UAAU,CAAC,KAAK,GAAG,IAAI,OAAO,CAAC,EAAE,IAAI,QAAQ,CAAC,EAAE,EAAE,CAAC,EAAEA,EAAE,+BAA+B,CAACG,EAAEH,EAAE,0BAA0B,CCAhP,EAAEI,EAAE,CAAC,OAAOC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","names":["e","t","n","i","n","r","e","t","results: CoercionTarget[]","t","maybeNumber","maybeBoolean","i","type","$","$"],"sources":["../../internal/keywords/dist/index.js","../../internal/scope/dist/index.js","../src/utils/coerce.ts","../src/utils/indent.ts","../src/utils/style-text.ts","../src/errors.ts","../src/type.ts","../src/create-env.ts","../src/index.ts"],"sourcesContent":["import{type as e}from\"arktype\";const t=e(`unknown`).pipe(e=>{if(typeof e==`number`||typeof e!=`string`)return e;let t=e.trim();if(t===``)return e;if(t===`NaN`)return NaN;let n=Number(t);return Number.isNaN(n)?e:n}),n=e(`unknown`).pipe(e=>e===`true`?!0:e===`false`?!1:e),r=e(`0 <= number.integer <= 65535`),i=e(`string.ip | 'localhost'`);export{i as host,n as maybeBoolean,t as maybeNumber,r as port};\n//# sourceMappingURL=index.js.map","import{host as e,port as t}from\"@repo/keywords\";import{scope as n,type as r}from\"arktype\";const i=n({string:r.module({...r.keywords.string,host:e}),number:r.module({...r.keywords.number,port:t})});export{i as $};\n//# sourceMappingURL=index.js.map","import { maybeBoolean, maybeNumber } from \"@repo/keywords\";\nimport { type BaseType, type JsonSchema, type } from \"arktype\";\n\n/**\n * A marker used in the coercion path to indicate that the target\n * is the *elements* of an array, rather than the array property itself.\n */\nconst ARRAY_ITEM_MARKER = \"*\";\n\n/**\n * @internal\n * Information about a path in the schema that requires coercion.\n */\ntype CoercionTarget = {\n\tpath: string[];\n\ttype: \"primitive\" | \"array\";\n};\n\n/**\n * Options for coercion behavior.\n */\nexport type CoerceOptions = {\n\t/**\n\t * format to use for array parsing\n\t * @default \"comma\"\n\t */\n\tarrayFormat?: \"comma\" | \"json\";\n};\n\n/**\n * Recursively find all paths in a JSON Schema that require coercion.\n * We prioritize \"number\", \"integer\", \"boolean\", and \"array\" types.\n */\nconst findCoercionPaths = (\n\tnode: JsonSchema,\n\tpath: string[] = [],\n): CoercionTarget[] => {\n\tconst results: CoercionTarget[] = [];\n\n\tif (typeof node === \"boolean\") {\n\t\treturn results;\n\t}\n\n\tif (\"const\" in node) {\n\t\tif (typeof node.const === \"number\" || typeof node.const === \"boolean\") {\n\t\t\tresults.push({ path: [...path], type: \"primitive\" });\n\t\t}\n\t}\n\n\tif (\"enum\" in node && node.enum) {\n\t\tif (\n\t\t\tnode.enum.some((v) => typeof v === \"number\" || typeof v === \"boolean\")\n\t\t) {\n\t\t\tresults.push({ path: [...path], type: \"primitive\" });\n\t\t}\n\t}\n\n\tif (\"type\" in node) {\n\t\tif (node.type === \"number\" || node.type === \"integer\") {\n\t\t\tresults.push({ path: [...path], type: \"primitive\" });\n\t\t} else if (node.type === \"boolean\") {\n\t\t\tresults.push({ path: [...path], type: \"primitive\" });\n\t\t} else if (node.type === \"array\") {\n\t\t\t// Mark the array itself as a target for splitting strings\n\t\t\tresults.push({ path: [...path], type: \"array\" });\n\n\t\t\tif (\"items\" in node && node.items) {\n\t\t\t\tif (Array.isArray(node.items)) {\n\t\t\t\t\t// Tuple traversal\n\t\t\t\t\tnode.items.forEach((item, index) => {\n\t\t\t\t\t\tresults.push(\n\t\t\t\t\t\t\t...findCoercionPaths(item as JsonSchema, [...path, `${index}`]),\n\t\t\t\t\t\t);\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\t// List traversal\n\t\t\t\t\tresults.push(\n\t\t\t\t\t\t...findCoercionPaths(node.items as JsonSchema, [\n\t\t\t\t\t\t\t...path,\n\t\t\t\t\t\t\tARRAY_ITEM_MARKER,\n\t\t\t\t\t\t]),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (node.type === \"object\") {\n\t\t\tif (\"properties\" in node && node.properties) {\n\t\t\t\tfor (const [key, prop] of Object.entries(node.properties)) {\n\t\t\t\t\tresults.push(\n\t\t\t\t\t\t...findCoercionPaths(prop as JsonSchema, [...path, key]),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (\"anyOf\" in node && node.anyOf) {\n\t\tfor (const branch of node.anyOf) {\n\t\t\tresults.push(...findCoercionPaths(branch as JsonSchema, path));\n\t\t}\n\t}\n\n\tif (\"allOf\" in node && node.allOf) {\n\t\tfor (const branch of node.allOf) {\n\t\t\tresults.push(...findCoercionPaths(branch as JsonSchema, path));\n\t\t}\n\t}\n\n\tif (\"oneOf\" in node && node.oneOf) {\n\t\tfor (const branch of node.oneOf) {\n\t\t\tresults.push(...findCoercionPaths(branch as JsonSchema, path));\n\t\t}\n\t}\n\n\t// Deduplicate by path\n\tconst seen = new Set<string>();\n\treturn results.filter((t) => {\n\t\tconst key = JSON.stringify(t.path);\n\t\t// Prioritize array type over primitive if duplicate path exists?\n\t\t// Actually duplicates shouldn't happen for same path with conflicting types in valid schemas usually,\n\t\t// but let's allow \"array\" to exist.\n\t\t// If a path is both array and primitive (e.g. union), we might want both.\n\t\t// But for now, let's just use the key including type.\n\t\tconst uniqueKey = key + t.type;\n\t\tif (seen.has(uniqueKey)) return false;\n\t\tseen.add(uniqueKey);\n\t\treturn true;\n\t});\n};\n\n/**\n * Apply coercion to a data object based on identified paths.\n */\nconst applyCoercion = (\n\tdata: unknown,\n\ttargets: CoercionTarget[],\n\toptions: CoerceOptions = {},\n) => {\n\tconst { arrayFormat = \"comma\" } = options;\n\n\t// Helper to split string to array\n\tconst splitString = (val: string) => {\n\t\tif (arrayFormat === \"json\") {\n\t\t\ttry {\n\t\t\t\treturn JSON.parse(val);\n\t\t\t} catch {\n\t\t\t\treturn val;\n\t\t\t}\n\t\t}\n\n\t\tif (!val.trim()) return [];\n\t\treturn val.split(\",\").map((s) => s.trim());\n\t};\n\n\tif (typeof data !== \"object\" || data === null) {\n\t\t// If root data needs coercion\n\t\tif (targets.some((t) => t.path.length === 0)) {\n\t\t\tconst rootTarget = targets.find((t) => t.path.length === 0);\n\t\t\tif (rootTarget?.type === \"array\" && typeof data === \"string\") {\n\t\t\t\treturn splitString(data);\n\t\t\t}\n\n\t\t\tconst asNumber = maybeNumber(data);\n\t\t\tif (typeof asNumber === \"number\") {\n\t\t\t\treturn asNumber;\n\t\t\t}\n\t\t\treturn maybeBoolean(data);\n\t\t}\n\t\treturn data;\n\t}\n\n\tconst walk = (\n\t\tcurrent: unknown,\n\t\ttargetPath: string[],\n\t\ttype: \"primitive\" | \"array\",\n\t) => {\n\t\tif (!current || typeof current !== \"object\") return;\n\n\t\tif (targetPath.length === 0) {\n\t\t\t// Already matched path (should rely on caller)\n\t\t\t// But strict recursion logic stops at length 1 usually.\n\t\t\treturn;\n\t\t}\n\n\t\t// If we've reached the last key, apply coercion\n\t\tif (targetPath.length === 1) {\n\t\t\tconst lastKey = targetPath[0];\n\n\t\t\tif (lastKey === ARRAY_ITEM_MARKER) {\n\t\t\t\tif (Array.isArray(current)) {\n\t\t\t\t\tfor (let i = 0; i < current.length; i++) {\n\t\t\t\t\t\tconst original = current[i];\n\t\t\t\t\t\tif (type === \"primitive\") {\n\t\t\t\t\t\t\tconst asNumber = maybeNumber(original);\n\t\t\t\t\t\t\tif (typeof asNumber === \"number\") {\n\t\t\t\t\t\t\t\tcurrent[i] = asNumber;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tcurrent[i] = maybeBoolean(original);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst record = current as Record<string, unknown>;\n\t\t\t// biome-ignore lint/suspicious/noPrototypeBuiltins: ES2020 compatibility\n\t\t\tif (Object.prototype.hasOwnProperty.call(record, lastKey)) {\n\t\t\t\tconst original = record[lastKey];\n\n\t\t\t\tif (type === \"array\" && typeof original === \"string\") {\n\t\t\t\t\trecord[lastKey] = splitString(original);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (Array.isArray(original)) {\n\t\t\t\t\t// It's already an array, maybe coerce items if we are targeting primitive items?\n\t\t\t\t\t// But if we are here, targetPath len is 1, so we are targeting `record[lastKey]`.\n\t\t\t\t\t// If target type is \"primitive\", but it's an array, we iterating?\n\t\t\t\t\t// No, ARRAY_ITEM_MARKER handles iteration.\n\t\t\t\t\t// If we are here, we are targeting the value itself.\n\t\t\t\t\t// If it is an array and we expect primitive... do nothing?\n\n\t\t\t\t\tif (type === \"primitive\") {\n\t\t\t\t\t\tfor (let i = 0; i < original.length; i++) {\n\t\t\t\t\t\t\tconst item = original[i];\n\t\t\t\t\t\t\tconst asNumber = maybeNumber(item);\n\t\t\t\t\t\t\tif (typeof asNumber === \"number\") {\n\t\t\t\t\t\t\t\toriginal[i] = asNumber;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\toriginal[i] = maybeBoolean(item);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (type === \"primitive\") {\n\t\t\t\t\t\tconst asNumber = maybeNumber(original);\n\t\t\t\t\t\t// If numeric parsing didn't produce a number, try boolean coercion\n\t\t\t\t\t\tif (typeof asNumber === \"number\") {\n\t\t\t\t\t\t\trecord[lastKey] = asNumber;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\trecord[lastKey] = maybeBoolean(original);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// Recurse down\n\t\tconst [nextKey, ...rest] = targetPath;\n\n\t\tif (nextKey === ARRAY_ITEM_MARKER) {\n\t\t\tif (Array.isArray(current)) {\n\t\t\t\tfor (const item of current) {\n\t\t\t\t\twalk(item, rest, type);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tconst record = current as Record<string, unknown>;\n\t\twalk(record[nextKey], rest, type);\n\t};\n\n\tfor (const target of targets) {\n\t\twalk(data, target.path, target.type);\n\t}\n\n\treturn data;\n};\n\n/**\n * Create a coercing wrapper around an ArkType schema using JSON Schema introspection.\n * Pre-process input data to coerce string values to numbers/booleans at identified paths\n * before validation.\n */\nexport function coerce<t, $ = {}>(\n\tschema: BaseType<t, $>,\n\toptions?: CoerceOptions,\n): BaseType<t, $> {\n\t// Use a fallback to handle unjsonifiable parts of the schema (like predicates)\n\t// by preserving the base schema. This ensures that even if part of the schema\n\t// cannot be fully represented in JSON Schema, we can still perform coercion\n\t// for the parts that can.\n\tconst json = schema.in.toJsonSchema({\n\t\tfallback: (ctx) => ctx.base,\n\t});\n\tconst targets = findCoercionPaths(json);\n\n\tif (targets.length === 0) {\n\t\treturn schema;\n\t}\n\n\t/*\n\t * We use `type(\"unknown\")` to start the pipeline, which initializes a default scope.\n\t * Integrating the original `schema` with its custom scope `$` into this pipeline\n\t * creates a scope mismatch in TypeScript ({} vs $).\n\t * We cast to `BaseType<t, $>` to assert the final contract is maintained.\n\t */\n\treturn type(\"unknown\")\n\t\t.pipe((data) => applyCoercion(data, targets, options))\n\t\t.pipe(schema) as BaseType<t, $>;\n}\n","/**\n * Options for the `indent` function\n */\ntype IndentOptions = {\n\t/**\n\t * Whether to detect newlines and indent each line individually, defaults to false (indenting the whole string)\n\t */\n\tdontDetectNewlines?: boolean;\n};\n\n/**\n * Indent a string by a given amount\n * @param str - The string to indent\n * @param amt - The amount to indent by, defaults to 2\n * @param options - {@link IndentOptions}\n * @returns The indented string\n */\nexport const indent = (\n\tstr: string,\n\tamt = 2,\n\t{ dontDetectNewlines = false }: IndentOptions = {},\n) => {\n\tconst detectNewlines = !dontDetectNewlines;\n\tif (detectNewlines) {\n\t\treturn str\n\t\t\t.split(\"\\n\")\n\t\t\t.map((line) => `${\" \".repeat(amt)}${line}`)\n\t\t\t.join(\"\\n\");\n\t}\n\n\treturn `${\" \".repeat(amt)}${str}`;\n};\n","/**\n * Cross-platform text styling utility\n * Uses ANSI colors in Node environments, plain text in browsers\n * Respects NO_COLOR, CI environment variables, and TTY detection\n */\n\n// ANSI color codes for Node environments\nconst colors = {\n\tred: \"\\x1b[31m\",\n\tyellow: \"\\x1b[33m\",\n\tcyan: \"\\x1b[36m\",\n\treset: \"\\x1b[0m\",\n} as const;\n\n/**\n * Check if we're in a Node environment (not browser)\n * Checked dynamically to allow for testing with mocked globals\n */\nconst isNode = (): boolean =>\n\ttypeof process !== \"undefined\" &&\n\tprocess.versions != null &&\n\tprocess.versions.node != null;\n\n/**\n * Check if colors should be disabled based on environment\n * Respects NO_COLOR, CI environment variables, and TTY detection\n */\nconst shouldDisableColors = (): boolean => {\n\tif (!isNode()) return true;\n\n\t// Respect NO_COLOR environment variable (https://no-color.org/)\n\tif (process.env.NO_COLOR !== undefined) return true;\n\n\t// Disable colors in CI environments by default\n\tif (process.env.CI !== undefined) return true;\n\n\t// Disable colors if not writing to a TTY\n\tif (process.stdout && !process.stdout.isTTY) return true;\n\n\treturn false;\n};\n\n/**\n * Style text with color. Uses ANSI codes in Node, plain text in browsers.\n * @param color - The color to apply\n * @param text - The text to style\n * @returns Styled text in Node (if colors enabled), plain text otherwise\n */\nexport const styleText = (\n\tcolor: \"red\" | \"yellow\" | \"cyan\",\n\ttext: string,\n): string => {\n\t// Use ANSI colors only in Node environments with colors enabled\n\tif (isNode() && !shouldDisableColors()) {\n\t\treturn `${colors[color]}${text}${colors.reset}`;\n\t}\n\t// Fall back to plain text in browsers or when colors are disabled\n\treturn text;\n};\n","import type { ArkErrors } from \"arktype\";\nimport { indent, styleText } from \"./utils\";\n\n/**\n * Format the errors returned by ArkType to be more readable\n * @param errors - The errors returned by ArkType\n * @returns A string of the formatted errors\n */\nexport const formatErrors = (errors: ArkErrors): string =>\n\tObject.entries(errors.byPath)\n\t\t.map(([path, error]) => {\n\t\t\tconst messageWithoutPath = error.message.startsWith(path)\n\t\t\t\t? error.message.slice(path.length)\n\t\t\t\t: error.message;\n\n\t\t\t// Extract the value in parentheses if it exists\n\t\t\tconst valueMatch = messageWithoutPath.match(/\\(was \"([^\"]+)\"\\)/);\n\t\t\tconst formattedMessage = valueMatch\n\t\t\t\t? messageWithoutPath.replace(\n\t\t\t\t\t\t`(was \"${valueMatch[1]}\")`,\n\t\t\t\t\t\t`(was ${styleText(\"cyan\", `\"${valueMatch[1]}\"`)})`,\n\t\t\t\t\t)\n\t\t\t\t: messageWithoutPath;\n\n\t\t\treturn `${styleText(\"yellow\", path)} ${formattedMessage.trimStart()}`;\n\t\t})\n\t\t.join(\"\\n\");\n\nexport class ArkEnvError extends Error {\n\tconstructor(\n\t\terrors: ArkErrors,\n\t\tmessage = \"Errors found while validating environment variables\",\n\t) {\n\t\tsuper(`${styleText(\"red\", message)}\\n${indent(formatErrors(errors))}\\n`);\n\t\tthis.name = \"ArkEnvError\";\n\t}\n}\n\nObject.defineProperty(ArkEnvError, \"name\", { value: \"ArkEnvError\" });\n","import { $ } from \"@repo/scope\";\n\nexport const type = $.type;\n","import { $ } from \"@repo/scope\";\nimport type { EnvSchemaWithType, InferType, SchemaShape } from \"@repo/types\";\nimport type { type as at, distill } from \"arktype\";\nimport { ArkEnvError } from \"./errors\";\nimport { type } from \"./type\";\nimport { type CoerceOptions, coerce } from \"./utils\";\n\nexport type EnvSchema<def> = at.validate<def, $>;\ntype RuntimeEnvironment = Record<string, string | undefined>;\n\n/**\n * Configuration options for `createEnv`\n */\nexport type ArkEnvConfig = {\n\t/**\n\t * The environment variables to validate. Defaults to `process.env`\n\t */\n\tenv?: RuntimeEnvironment;\n\t/**\n\t * Whether to coerce environment variables to their defined types. Defaults to `true`\n\t */\n\tcoerce?: boolean;\n\t/**\n\t * Control how ArkEnv handles environment variables that are not defined in your schema.\n\t *\n\t * Defaults to `'delete'` to ensure your output object only contains\n\t * keys you've explicitly declared. This differs from ArkType's standard behavior, which\n\t * mirrors TypeScript by defaulting to `'ignore'`.\n\t *\n\t * - `delete` (ArkEnv default): Undeclared keys are allowed on input but stripped from the output.\n\t * - `ignore` (ArkType default): Undeclared keys are allowed and preserved in the output.\n\t * - `reject`: Undeclared keys will cause validation to fail.\n\t *\n\t * @default \"delete\"\n\t * @see https://arktype.io/docs/configuration#onundeclaredkey\n\t */\n\tonUndeclaredKey?: \"ignore\" | \"delete\" | \"reject\";\n\n\t/**\n\t * The format to use for array parsing when coercion is enabled.\n\t *\n\t * - `comma` (default): Strings are split by comma and trimmed.\n\t * - `json`: Strings are parsed as JSON.\n\t *\n\t * @default \"comma\"\n\t */\n\tarrayFormat?: CoerceOptions[\"arrayFormat\"];\n};\n\n/**\n * TODO: `SchemaShape` is basically `Record<string, unknown>`.\n * If possible, find a better type than \"const T extends Record<string, unknown>\",\n * and be as close as possible to the type accepted by ArkType's `type`.\n */\n\n/**\n * Create an environment variables object from a schema and an environment\n * @param def - The environment variable schema (raw object or type definition created with `type()`)\n * @param config - Configuration options, see {@link ArkEnvConfig}\n * @returns The validated environment variable schema\n * @throws An {@link ArkEnvError | error} if the environment variables are invalid.\n */\nexport function createEnv<const T extends SchemaShape>(\n\tdef: EnvSchema<T>,\n\tconfig?: ArkEnvConfig,\n): distill.Out<at.infer<T, $>>;\nexport function createEnv<T extends EnvSchemaWithType>(\n\tdef: T,\n\tconfig?: ArkEnvConfig,\n): InferType<T>;\nexport function createEnv<const T extends SchemaShape>(\n\tdef: EnvSchema<T> | EnvSchemaWithType,\n\tconfig?: ArkEnvConfig,\n): distill.Out<at.infer<T, $>> | InferType<typeof def>;\nexport function createEnv<const T extends SchemaShape>(\n\tdef: EnvSchema<T> | EnvSchemaWithType,\n\t{\n\t\tenv = process.env,\n\t\tcoerce: shouldCoerce = true,\n\t\tonUndeclaredKey = \"delete\",\n\t\tarrayFormat = \"comma\",\n\t}: ArkEnvConfig = {},\n): distill.Out<at.infer<T, $>> | InferType<typeof def> {\n\t// If def is a type definition (has assert method), use it directly\n\t// Otherwise, use raw() to convert the schema definition\n\tconst isCompiledType = typeof def === \"function\" && \"assert\" in def;\n\tlet schema = isCompiledType ? def : $.type.raw(def as EnvSchema<T>);\n\n\t// Apply the `onUndeclaredKey` option\n\tschema = schema.onUndeclaredKey(onUndeclaredKey);\n\n\t// Apply coercion transformation to allow strings to be parsed as numbers/booleans\n\tif (shouldCoerce) {\n\t\tschema = coerce(schema, { arrayFormat });\n\t}\n\n\t// Validate the environment variables\n\tconst validatedEnv = schema(env);\n\n\tif (validatedEnv instanceof type.errors) {\n\t\tthrow new ArkEnvError(validatedEnv);\n\t}\n\n\treturn validatedEnv;\n}\n","export type { EnvSchema } from \"./create-env\";\n\nimport { createEnv } from \"./create-env\";\n\n/**\n * `arkenv`'s main export, an alias for {@link createEnv}\n *\n * {@link https://arkenv.js.org | ArkEnv} is a typesafe environment variables validator from editor to runtime.\n */\nconst arkenv = createEnv;\nexport default arkenv;\nexport { type } from \"./type\";\nexport { createEnv };\nexport { ArkEnvError } from \"./errors\";\n"],"mappings":"0CAA+B,MAAM,EAAEA,EAAE,UAAU,CAAC,KAAK,GAAG,CAAC,GAAG,OAAO,GAAG,UAAU,OAAO,GAAG,SAAS,OAAO,EAAE,IAAIC,EAAE,EAAE,MAAM,CAAC,GAAGA,IAAI,GAAG,OAAO,EAAE,GAAGA,IAAI,MAAM,MAAO,KAAI,IAAIC,EAAE,OAAOD,EAAE,CAAC,OAAO,OAAO,MAAMC,EAAE,CAAC,EAAEA,GAAG,CAAC,EAAEF,EAAE,UAAU,CAAC,KAAK,GAAG,IAAI,OAAO,CAAC,EAAE,IAAI,QAAQ,CAAC,EAAE,EAAE,CAAC,EAAEA,EAAE,+BAA+B,CAACG,EAAEH,EAAE,0BAA0B,CCAhP,EAAEI,EAAE,CAAC,OAAOC,EAAE,OAAO,CAAC,GAAGA,EAAE,SAAS,OAAO,KAAKC,EAAE,CAAC,CAAC,OAAOD,EAAE,OAAO,CAAC,GAAGA,EAAE,SAAS,OAAO,KAAKE,EAAE,CAAC,CAAC,CAAC,CCiC9L,GACL,EACA,EAAiB,EAAE,GACG,CACtB,IAAMC,EAA4B,EAAE,CAEpC,GAAI,OAAO,GAAS,UACnB,OAAO,EAiBR,GAdI,UAAW,IACV,OAAO,EAAK,OAAU,UAAY,OAAO,EAAK,OAAU,YAC3D,EAAQ,KAAK,CAAE,KAAM,CAAC,GAAG,EAAK,CAAE,KAAM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AG5C,IACH,EAAS,EAAO,EAAQ,CAAE,cAAa,CAAC,EAIzC,IAAM,EAAe,EAAO,EAAI,CAEhC,GAAI,aAAwB,EAAK,OAChC,MAAM,IAAI,EAAY,EAAa,CAGpC,OAAO,EC7FR,IAAA,EADe"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "arkenv",
3
3
  "type": "module",
4
- "version": "0.8.1",
4
+ "version": "0.8.2",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
@@ -37,12 +37,12 @@
37
37
  "arktype": "2.1.29",
38
38
  "rimraf": "6.1.2",
39
39
  "size-limit": "12.0.0",
40
- "tsdown": "0.18.3",
40
+ "tsdown": "0.18.4",
41
41
  "typescript": "5.9.3",
42
42
  "vitest": "4.0.16",
43
- "@repo/keywords": "0.1.0",
44
- "@repo/scope": "0.1.0",
45
- "@repo/types": "1.0.0"
43
+ "@repo/keywords": "0.2.0",
44
+ "@repo/scope": "0.1.1",
45
+ "@repo/types": "0.0.5"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "arktype": "^2.1.22"