arkenv 0.11.0 → 0.11.1

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/dist/index.d.cts CHANGED
@@ -1,12 +1,11 @@
1
- import { a as Dict, n as SchemaShape, o as $, r as InferType, t as CompiledEnvSchema } from "./index-bSO6Cmhi.cjs";
2
- import * as arktype_internal_keywords_string_ts0 from "arktype/internal/keywords/string.ts";
3
- import * as arktype_internal_attributes_ts0 from "arktype/internal/attributes.ts";
4
- import * as arktype0 from "arktype";
1
+ import { a as Dict, n as SchemaShape, o as $, r as InferType, t as CompiledEnvSchema } from "./index-CzNfOanV.cjs";
2
+ import * as _$arktype_internal_keywords_string_ts0 from "arktype/internal/keywords/string.ts";
3
+ import * as _$arktype_internal_attributes_ts0 from "arktype/internal/attributes.ts";
4
+ import * as _$arktype from "arktype";
5
5
  import { distill, type as type$1 } from "arktype";
6
- import * as arktype_internal_type_ts0 from "arktype/internal/type.ts";
6
+ import * as _$arktype_internal_type_ts0 from "arktype/internal/type.ts";
7
7
 
8
8
  //#region src/create-env.d.ts
9
-
10
9
  /**
11
10
  * Declarative environment schema definition accepted by ArkEnv.
12
11
  *
@@ -21,7 +20,14 @@ import * as arktype_internal_type_ts0 from "arktype/internal/type.ts";
21
20
  *
22
21
  * @template def - The schema shape object
23
22
  */
24
- type EnvSchema<def$1> = type$1.validate<def$1, $>;
23
+ type EnvSchema<def> = type$1.validate<def, $>;
24
+ /**
25
+ * Infer the validated and coerced environment object type from a schema.
26
+ * Supports declarative schema shapes, compiled ArkType schemas, and Standard Schema validators.
27
+ *
28
+ * @template T - The schema type
29
+ */
30
+ type Infer<T> = T extends SchemaShape ? distill.Out<type$1.infer<T, $>> : InferType<T>;
25
31
  type RuntimeEnvironment = Dict<string>;
26
32
  /**
27
33
  * Configuration options for `createEnv`
@@ -86,66 +92,66 @@ declare function createEnv<const T extends SchemaShape>(def: EnvSchema<T> | Comp
86
92
  * See ArkType's docs for the full API:
87
93
  * https://arktype.io/docs/type-api
88
94
  */
89
- declare const type: arktype_internal_type_ts0.TypeParser<{
90
- string: arktype0.Submodule<{
91
- trim: arktype0.Submodule<arktype_internal_keywords_string_ts0.trim.$ & {
92
- " arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
95
+ declare const type: _$arktype_internal_type_ts0.TypeParser<{
96
+ string: _$arktype.Submodule<{
97
+ trim: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.trim.$ & {
98
+ " arkInferred": (In: string) => _$arktype_internal_attributes_ts0.To<string>;
93
99
  }>;
94
- normalize: arktype0.Submodule<arktype_internal_keywords_string_ts0.normalize.$ & {
95
- " arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
100
+ normalize: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.normalize.$ & {
101
+ " arkInferred": (In: string) => _$arktype_internal_attributes_ts0.To<string>;
96
102
  }>;
97
103
  root: string;
98
104
  alpha: string;
99
105
  alphanumeric: string;
100
106
  hex: string;
101
- base64: arktype0.Submodule<{
107
+ base64: _$arktype.Submodule<{
102
108
  root: string;
103
109
  url: string;
104
110
  } & {
105
111
  " arkInferred": string;
106
112
  }>;
107
- capitalize: arktype0.Submodule<arktype_internal_keywords_string_ts0.capitalize.$ & {
108
- " arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
113
+ capitalize: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.capitalize.$ & {
114
+ " arkInferred": (In: string) => _$arktype_internal_attributes_ts0.To<string>;
109
115
  }>;
110
116
  creditCard: string;
111
- date: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringDate.$ & {
117
+ date: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.stringDate.$ & {
112
118
  " arkInferred": string;
113
119
  }>;
114
120
  digits: string;
115
121
  email: string;
116
- integer: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringInteger.$ & {
122
+ integer: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.stringInteger.$ & {
117
123
  " arkInferred": string;
118
124
  }>;
119
- ip: arktype0.Submodule<arktype_internal_keywords_string_ts0.ip.$ & {
125
+ ip: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.ip.$ & {
120
126
  " arkInferred": string;
121
127
  }>;
122
- json: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringJson.$ & {
128
+ json: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.stringJson.$ & {
123
129
  " arkInferred": string;
124
130
  }>;
125
- lower: arktype0.Submodule<arktype_internal_keywords_string_ts0.lower.$ & {
126
- " arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
131
+ lower: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.lower.$ & {
132
+ " arkInferred": (In: string) => _$arktype_internal_attributes_ts0.To<string>;
127
133
  }>;
128
- numeric: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringNumeric.$ & {
134
+ numeric: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.stringNumeric.$ & {
129
135
  " arkInferred": string;
130
136
  }>;
131
137
  regex: string;
132
138
  semver: string;
133
- upper: arktype0.Submodule<{
134
- root: (In: string) => arktype_internal_attributes_ts0.To<string>;
139
+ upper: _$arktype.Submodule<{
140
+ root: (In: string) => _$arktype_internal_attributes_ts0.To<string>;
135
141
  preformatted: string;
136
142
  } & {
137
- " arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
143
+ " arkInferred": (In: string) => _$arktype_internal_attributes_ts0.To<string>;
138
144
  }>;
139
- url: arktype0.Submodule<arktype_internal_keywords_string_ts0.url.$ & {
145
+ url: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.url.$ & {
140
146
  " arkInferred": string;
141
147
  }>;
142
- uuid: arktype0.Submodule<arktype_internal_keywords_string_ts0.uuid.$ & {
148
+ uuid: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.uuid.$ & {
143
149
  " arkInferred": string;
144
150
  }>;
145
151
  " arkInferred": string;
146
152
  host: string;
147
153
  }>;
148
- number: arktype0.Submodule<{
154
+ number: _$arktype.Submodule<{
149
155
  NaN: number;
150
156
  Infinity: number;
151
157
  root: number;
@@ -164,7 +170,7 @@ declare const type: arktype_internal_type_ts0.TypeParser<{
164
170
  */
165
171
  declare const arkenv: typeof createEnv;
166
172
  //#endregion
167
- export { type ArkEnvConfig, type EnvSchema, createEnv, arkenv as default, type };
173
+ export { type ArkEnvConfig, type EnvSchema, type Infer, createEnv, arkenv as default, type };
168
174
 
169
175
  // CJS Interop Shim
170
176
  if (module.exports && module.exports.default) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/create-env.ts","../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;AAyBA;;;;;AAAiD;AAMjD;AAiDA;;AACgB,KAxDJ,SAwDI,CAAA,KAAA,CAAA,GAxDa,MAAA,CAAG,QAwDhB,CAxDyB,KAwDzB,EAxD8B,CAwD9B,CAAA;KAvDX,kBAAA,GAAqB,IAuDpB,CAAA,MAAA,CAAA;;;;AAES,KApDH,YAAA,GAoDM;EAAf;;AACH;EAAoC,GAAA,CAAA,EAjD7B,kBAiD6B;EAC9B;;;EAEH,MAAA,CAAA,EAAA,OAAA;EAAS;AACZ;;;;;;;;;;;;;;;;AC3EA;;;;;;;;;;;;;;;;;;;;iBDmEgB,0BAA0B,kBACpC,UAAU,aACN,eACP,OAAA,CAAQ,IAAI,MAAA,CAAG,MAAM,GAAG;iBACX,oBAAoB,wBAC9B,YACI,eACP,UAAU;iBACG,0BAA0B,kBACpC,UAAU,KAAK,4BACX,eACP,OAAA,CAAQ,IAAI,MAAA,CAAG,MAAM,GAAG,MAAM,iBAAiB;;;;;;;;;AAlElD;;;AAA6B,cCZhB,IDYmB,4BCZf,UDYe,CAAA;EAAQ,MAAA,oBAAA,CAAA;IACnC,IAAA,oBAAyB,+CAAA;MAKlB,cAAY,EAAA,CAAA,EAIjB,EAAA,MAAA,EAAA,qCAAkB,CAAA,MAAA,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SAAA,CAAU,CAAA;AAAA,KAER,kBAAA,GAAqB,IAAA;;;;KAKd,YAAA;EARG;;;EAYd,GAAA,GAAM,kBAAA;EAXK;;;EAeX,MAAA;EAjBgC;;;;;;;;;;;AAEjB;;;EA8Bf,eAAA;EA5B6B;AAK9B;;;;;;;EAiCC,WAAA;AAAA;;;AAgBD;;;;;;;;;;iBAAgB,SAAA,iBAA0B,WAAA,CAAA,CACzC,GAAA,EAAK,SAAA,CAAU,CAAA,GACf,MAAA,GAAS,YAAA,GACP,OAAA,CAAQ,GAAA,CAAI,MAAA,CAAG,KAAA,CAAM,CAAA,EAAG,CAAA;AAAA,iBACX,SAAA,WAAoB,iBAAA,CAAA,CACnC,GAAA,EAAK,CAAA,EACL,MAAA,GAAS,YAAA,GACP,SAAA,CAAU,CAAA;AAAA,iBACG,SAAA,iBAA0B,WAAA,CAAA,CACzC,GAAA,EAAK,SAAA,CAAU,CAAA,IAAK,iBAAA,EACpB,MAAA,GAAS,YAAA,GACP,OAAA,CAAQ,GAAA,CAAI,MAAA,CAAG,KAAA,CAAM,CAAA,EAAG,CAAA,KAAM,SAAA,QAAiB,GAAA;;;;;;;;;AA7ElD;;;cCZa,IAAA,8BAAI,UAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAQX,MAAA,SAAM,SAAA"}
package/dist/index.d.mts CHANGED
@@ -1,12 +1,11 @@
1
- import { a as Dict, n as SchemaShape, o as $, r as InferType, t as CompiledEnvSchema } from "./index-Cic20SzT.mjs";
2
- import * as arktype0 from "arktype";
1
+ import { a as Dict, n as SchemaShape, o as $, r as InferType, t as CompiledEnvSchema } from "./index-Bx89Loyb.mjs";
2
+ import * as _$arktype from "arktype";
3
3
  import { distill, type as type$1 } from "arktype";
4
- import * as arktype_internal_keywords_string_ts0 from "arktype/internal/keywords/string.ts";
5
- import * as arktype_internal_attributes_ts0 from "arktype/internal/attributes.ts";
6
- import * as arktype_internal_type_ts0 from "arktype/internal/type.ts";
4
+ import * as _$arktype_internal_keywords_string_ts0 from "arktype/internal/keywords/string.ts";
5
+ import * as _$arktype_internal_attributes_ts0 from "arktype/internal/attributes.ts";
6
+ import * as _$arktype_internal_type_ts0 from "arktype/internal/type.ts";
7
7
 
8
8
  //#region src/create-env.d.ts
9
-
10
9
  /**
11
10
  * Declarative environment schema definition accepted by ArkEnv.
12
11
  *
@@ -21,7 +20,14 @@ import * as arktype_internal_type_ts0 from "arktype/internal/type.ts";
21
20
  *
22
21
  * @template def - The schema shape object
23
22
  */
24
- type EnvSchema<def$1> = type$1.validate<def$1, $>;
23
+ type EnvSchema<def> = type$1.validate<def, $>;
24
+ /**
25
+ * Infer the validated and coerced environment object type from a schema.
26
+ * Supports declarative schema shapes, compiled ArkType schemas, and Standard Schema validators.
27
+ *
28
+ * @template T - The schema type
29
+ */
30
+ type Infer<T> = T extends SchemaShape ? distill.Out<type$1.infer<T, $>> : InferType<T>;
25
31
  type RuntimeEnvironment = Dict<string>;
26
32
  /**
27
33
  * Configuration options for `createEnv`
@@ -86,66 +92,66 @@ declare function createEnv<const T extends SchemaShape>(def: EnvSchema<T> | Comp
86
92
  * See ArkType's docs for the full API:
87
93
  * https://arktype.io/docs/type-api
88
94
  */
89
- declare const type: arktype_internal_type_ts0.TypeParser<{
90
- string: arktype0.Submodule<{
91
- trim: arktype0.Submodule<arktype_internal_keywords_string_ts0.trim.$ & {
92
- " arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
95
+ declare const type: _$arktype_internal_type_ts0.TypeParser<{
96
+ string: _$arktype.Submodule<{
97
+ trim: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.trim.$ & {
98
+ " arkInferred": (In: string) => _$arktype_internal_attributes_ts0.To<string>;
93
99
  }>;
94
- normalize: arktype0.Submodule<arktype_internal_keywords_string_ts0.normalize.$ & {
95
- " arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
100
+ normalize: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.normalize.$ & {
101
+ " arkInferred": (In: string) => _$arktype_internal_attributes_ts0.To<string>;
96
102
  }>;
97
103
  root: string;
98
104
  alpha: string;
99
105
  alphanumeric: string;
100
106
  hex: string;
101
- base64: arktype0.Submodule<{
107
+ base64: _$arktype.Submodule<{
102
108
  root: string;
103
109
  url: string;
104
110
  } & {
105
111
  " arkInferred": string;
106
112
  }>;
107
- capitalize: arktype0.Submodule<arktype_internal_keywords_string_ts0.capitalize.$ & {
108
- " arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
113
+ capitalize: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.capitalize.$ & {
114
+ " arkInferred": (In: string) => _$arktype_internal_attributes_ts0.To<string>;
109
115
  }>;
110
116
  creditCard: string;
111
- date: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringDate.$ & {
117
+ date: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.stringDate.$ & {
112
118
  " arkInferred": string;
113
119
  }>;
114
120
  digits: string;
115
121
  email: string;
116
- integer: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringInteger.$ & {
122
+ integer: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.stringInteger.$ & {
117
123
  " arkInferred": string;
118
124
  }>;
119
- ip: arktype0.Submodule<arktype_internal_keywords_string_ts0.ip.$ & {
125
+ ip: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.ip.$ & {
120
126
  " arkInferred": string;
121
127
  }>;
122
- json: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringJson.$ & {
128
+ json: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.stringJson.$ & {
123
129
  " arkInferred": string;
124
130
  }>;
125
- lower: arktype0.Submodule<arktype_internal_keywords_string_ts0.lower.$ & {
126
- " arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
131
+ lower: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.lower.$ & {
132
+ " arkInferred": (In: string) => _$arktype_internal_attributes_ts0.To<string>;
127
133
  }>;
128
- numeric: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringNumeric.$ & {
134
+ numeric: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.stringNumeric.$ & {
129
135
  " arkInferred": string;
130
136
  }>;
131
137
  regex: string;
132
138
  semver: string;
133
- upper: arktype0.Submodule<{
134
- root: (In: string) => arktype_internal_attributes_ts0.To<string>;
139
+ upper: _$arktype.Submodule<{
140
+ root: (In: string) => _$arktype_internal_attributes_ts0.To<string>;
135
141
  preformatted: string;
136
142
  } & {
137
- " arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
143
+ " arkInferred": (In: string) => _$arktype_internal_attributes_ts0.To<string>;
138
144
  }>;
139
- url: arktype0.Submodule<arktype_internal_keywords_string_ts0.url.$ & {
145
+ url: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.url.$ & {
140
146
  " arkInferred": string;
141
147
  }>;
142
- uuid: arktype0.Submodule<arktype_internal_keywords_string_ts0.uuid.$ & {
148
+ uuid: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.uuid.$ & {
143
149
  " arkInferred": string;
144
150
  }>;
145
151
  " arkInferred": string;
146
152
  host: string;
147
153
  }>;
148
- number: arktype0.Submodule<{
154
+ number: _$arktype.Submodule<{
149
155
  NaN: number;
150
156
  Infinity: number;
151
157
  root: number;
@@ -164,6 +170,6 @@ declare const type: arktype_internal_type_ts0.TypeParser<{
164
170
  */
165
171
  declare const arkenv: typeof createEnv;
166
172
  //#endregion
167
- export { type ArkEnvConfig, type EnvSchema, createEnv, arkenv as default, type };
173
+ export { type ArkEnvConfig, type EnvSchema, type Infer, createEnv, arkenv as default, type };
168
174
 
169
175
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/create-env.ts","../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;AAyBA;;;;;AAAiD;AAMjD;A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AAA,CAAU,CAAA;AAAA,iBACG,SAAA,iBAA0B,WAAA,CAAA,CACzC,GAAA,EAAK,SAAA,CAAU,CAAA,IAAK,iBAAA,EACpB,MAAA,GAAS,YAAA,GACP,OAAA,CAAQ,GAAA,CAAI,MAAA,CAAG,KAAA,CAAM,CAAA,EAAG,CAAA,KAAM,SAAA,QAAiB,GAAA;;;;;;;;;AA7ElD;;;cCZa,IAAA,8BAAI,UAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAQX,MAAA,SAAM,SAAA"}
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import{r as e,t}from"./core-DzT5rjcY.mjs";import{ArkErrors as n,scope as r,type as i}from"arktype";const a=i(`0 <= number.integer <= 65535`),o=i(`string.ip | 'localhost'`),s=r({string:i.module({...i.keywords.string,host:o}),number:i.module({...i.keywords.number,port:a})}),c=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},l=e=>e===`true`?!0:e===`false`?!1:e,u=e=>{if(typeof e!=`string`)return e;let t=e.trim();if(!t.startsWith(`{`)&&!t.startsWith(`[`))return e;try{return JSON.parse(t)}catch{return e}},d=(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===`object`){if(`properties`in e&&e.properties&&Object.keys(e.properties).length>0&&n.push({path:[...t],type:`object`}),`properties`in e&&e.properties)for(let[r,i]of Object.entries(e.properties))n.push(...d(i,[...t,r]))}else 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(...d(e,[...t,`${r}`]))}):n.push(...d(e.items,[...t,`*`]))));if(`anyOf`in e&&e.anyOf)for(let r of e.anyOf)n.push(...d(r,t));if(`allOf`in e&&e.allOf)for(let r of e.allOf)n.push(...d(r,t));if(`oneOf`in e&&e.oneOf)for(let r of e.oneOf)n.push(...d(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)})},f=(e,t,n={})=>{let{arrayFormat:r=`comma`}=n,i=e=>{if(r===`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)){let n=t.find(e=>e.path.length===0);if(n?.type===`object`&&typeof e==`string`)return u(e);if(n?.type===`array`&&typeof e==`string`)return i(e);let r=c(e);return typeof r==`number`?r:l(e)}return e}let a=[...t].sort((e,t)=>e.path.length-t.path.length),o=(e,t,n)=>{if(!e||typeof e!=`object`||t.length===0)return;if(t.length===1){let r=t[0];if(r===`*`){if(Array.isArray(e))for(let t=0;t<e.length;t++){let r=e[t];if(n===`primitive`){let n=c(r);typeof n==`number`?e[t]=n:e[t]=l(r)}else n===`object`&&(e[t]=u(r))}return}let a=e;if(Object.prototype.hasOwnProperty.call(a,r)){let e=a[r];if(n===`array`&&typeof e==`string`){a[r]=i(e);return}if(n===`object`&&typeof e==`string`){a[r]=u(e);return}if(Array.isArray(e)){if(n===`primitive`)for(let t=0;t<e.length;t++){let n=e[t],r=c(n);typeof r==`number`?e[t]=r:e[t]=l(n)}}else if(n===`primitive`){let t=c(e);typeof t==`number`?a[r]=t:a[r]=l(e)}}return}let[r,...a]=t;if(r===`*`){if(Array.isArray(e))for(let t of e)o(t,a,n);return}o(e[r],a,n)};for(let t of a)o(e,t.path,t.type);return e};function p(e,t,n){let r=d(t.in.toJsonSchema({fallback:e=>e.base}));return r.length===0?t:e(`unknown`).pipe(e=>f(e,r,n)).pipe(t)}function m(t){return Object.entries(t.byPath).map(([t,n])=>{let r=n.message,i=r.trimStart();if(i.length>0&&`:.-`.includes(i[0])&&(i=i.slice(1).trimStart()),i.toLowerCase().startsWith(t.toLowerCase())){let e=i.slice(t.length).trimStart();e.length>0&&`:.-`.includes(e[0])&&(e=e.slice(1)),r=e.trimStart()}let a=r.match(/\(was (.*)\)/);if(a?.[1]){let t=a[1];t.includes(`\x1B[`)||(r=r.replace(`(was ${t})`,`(was ${e(`cyan`,t)})`))}return{path:t,message:r}})}function h(e,r){let{env:i=process.env,coerce:a=!0,onUndeclaredKey:o=`delete`,arrayFormat:c=`comma`}=r,l=(typeof e==`function`&&`assert`in e?e:s.type.raw(e)).onUndeclaredKey(o),u=l;a&&(u=p(s.type,l,{arrayFormat:c}));let d=u(i);if(d instanceof n)throw new t(m(d));return d}function g(e,t={}){return h(e,t)}const _=s.type;var v=g;export{g as createEnv,v as default,_ as type};
1
+ import{r as e,t}from"./core-B51xxxje.mjs";import{ArkErrors as n,scope as r,type as i}from"arktype";const a=i(`0 <= number.integer <= 65535`),o=i(`string.ip | 'localhost'`),s=r({string:i.module({...i.keywords.string,host:o}),number:i.module({...i.keywords.number,port:a})}),c=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},l=e=>e===`true`?!0:e===`false`?!1:e,u=e=>{if(typeof e!=`string`)return e;let t=e.trim();if(!t.startsWith(`{`)&&!t.startsWith(`[`))return e;try{return JSON.parse(t)}catch{return e}},d=(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===`object`){if(`properties`in e&&e.properties&&Object.keys(e.properties).length>0&&n.push({path:[...t],type:`object`}),`properties`in e&&e.properties)for(let[r,i]of Object.entries(e.properties))n.push(...d(i,[...t,r]))}else 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(...d(e,[...t,`${r}`]))}):n.push(...d(e.items,[...t,`*`]))));if(`anyOf`in e&&e.anyOf)for(let r of e.anyOf)n.push(...d(r,t));if(`allOf`in e&&e.allOf)for(let r of e.allOf)n.push(...d(r,t));if(`oneOf`in e&&e.oneOf)for(let r of e.oneOf)n.push(...d(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)})},f=(e,t,n={})=>{let{arrayFormat:r=`comma`}=n,i=e=>{if(r===`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)){let n=t.find(e=>e.path.length===0);if(n?.type===`object`&&typeof e==`string`)return u(e);if(n?.type===`array`&&typeof e==`string`)return i(e);let r=c(e);return typeof r==`number`?r:l(e)}return e}let a=[...t].sort((e,t)=>e.path.length-t.path.length),o=(e,t,n)=>{if(!e||typeof e!=`object`||t.length===0)return;if(t.length===1){let r=t[0];if(r===`*`){if(Array.isArray(e))for(let t=0;t<e.length;t++){let r=e[t];if(n===`primitive`){let n=c(r);typeof n==`number`?e[t]=n:e[t]=l(r)}else n===`object`&&(e[t]=u(r))}return}let a=e;if(Object.prototype.hasOwnProperty.call(a,r)){let e=a[r];if(n===`array`&&typeof e==`string`){a[r]=i(e);return}if(n===`object`&&typeof e==`string`){a[r]=u(e);return}if(Array.isArray(e)){if(n===`primitive`)for(let t=0;t<e.length;t++){let n=e[t],r=c(n);typeof r==`number`?e[t]=r:e[t]=l(n)}}else if(n===`primitive`){let t=c(e);typeof t==`number`?a[r]=t:a[r]=l(e)}}return}let[r,...a]=t;if(r===`*`){if(Array.isArray(e))for(let t of e)o(t,a,n);return}o(e[r],a,n)};for(let t of a)o(e,t.path,t.type);return e};function p(e,t,n){let r=d(t.in.toJsonSchema({fallback:e=>e.base}));return r.length===0?t:e(`unknown`).pipe(e=>f(e,r,n)).pipe(t)}function m(t){return Object.entries(t.byPath).map(([t,n])=>{let r=n.message,i=r.trimStart();if(i.length>0&&`:.-`.includes(i[0])&&(i=i.slice(1).trimStart()),i.toLowerCase().startsWith(t.toLowerCase())){let e=i.slice(t.length).trimStart();e.length>0&&`:.-`.includes(e[0])&&(e=e.slice(1)),r=e.trimStart()}let a=r.match(/\(was (.*)\)/);if(a?.[1]){let t=a[1];t.includes(`\x1B[`)||(r=r.replace(`(was ${t})`,`(was ${e(`cyan`,t)})`))}return{path:t,message:r}})}function h(e,r){let{env:i=process.env,coerce:a=!0,onUndeclaredKey:o=`delete`,arrayFormat:c=`comma`}=r,l=(typeof e==`function`&&`assert`in e?e:s.type.raw(e)).onUndeclaredKey(o),u=l;a&&(u=p(s.type,l,{arrayFormat:c}));let d=u(i);if(d instanceof n)throw new t(m(d));return d}function g(e,t={}){return h(e,t)}const _=s.type,v=g;export{g as createEnv,v as default,_ as type};
2
2
 
3
3
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["t","e","n","i","type","$","$"],"sources":["../../internal/scope/dist/index.js","../src/arktype/coercion/morphs.ts","../src/arktype/coercion/coerce.ts","../src/arktype/index.ts","../src/create-env.ts","../src/index.ts"],"sourcesContent":["import{scope as e,type as t}from\"arktype\";const n=t(`0 <= number.integer <= 65535`),r=t(`string.ip | 'localhost'`),i=e({string:t.module({...t.keywords.string,host:r}),number:t.module({...t.keywords.number,port:n})});export{i as $};\n//# sourceMappingURL=index.js.map","/**\n * Attempt to coerce a value to a number.\n *\n * If the input is already a number, returns it unchanged.\n * If the input is a string that can be parsed as a number, returns the parsed number.\n * Otherwise, returns the original value unchanged.\n *\n * @internal\n * @param s - The value to coerce\n * @returns The coerced number or the original value\n */\nexport const coerceNumber = (s: unknown) => {\n\tif (typeof s === \"number\") return s;\n\tif (typeof s !== \"string\") return s;\n\tconst trimmed = s.trim();\n\tif (trimmed === \"\") return s;\n\tif (trimmed === \"NaN\") return Number.NaN;\n\tconst n = Number(trimmed);\n\treturn Number.isNaN(n) ? s : n;\n};\n\n/**\n * Attempt to coerce a value to a boolean.\n *\n * Convert the strings \"true\" and \"false\" to their boolean equivalents.\n * All other values are returned unchanged.\n *\n * @internal\n * @param s - The value to coerce\n * @returns The coerced boolean or the original value\n */\nexport const coerceBoolean = (s: unknown) => {\n\tif (s === \"true\") return true;\n\tif (s === \"false\") return false;\n\treturn s;\n};\n\n/**\n * Attempt to parse a value as JSON.\n *\n * If the input is a string that starts with `{` or `[` and can be parsed as JSON,\n * returns the parsed object or array. Otherwise, returns the original value unchanged.\n *\n * @internal\n * @param s - The value to parse\n * @returns The parsed JSON or the original value\n */\nexport const coerceJson = (s: unknown) => {\n\tif (typeof s !== \"string\") return s;\n\tconst trimmed = s.trim();\n\tif (!trimmed.startsWith(\"{\") && !trimmed.startsWith(\"[\")) return s;\n\ttry {\n\t\treturn JSON.parse(trimmed);\n\t} catch {\n\t\treturn s;\n\t}\n};\n","import type { BaseType, JsonSchema } from \"arktype\";\nimport { coerceBoolean, coerceJson, coerceNumber } from \"./morphs.ts\";\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\" | \"object\";\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\", \"array\", and \"object\" 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 === \"object\") {\n\t\t\t// Check if this object has properties defined\n\t\t\t// If it does, we want to coerce the whole object from a JSON string\n\t\t\t// But we also want to recursively check nested properties\n\t\t\tconst hasProperties =\n\t\t\t\t\"properties\" in node &&\n\t\t\t\tnode.properties &&\n\t\t\t\tObject.keys(node.properties).length > 0;\n\n\t\t\tif (hasProperties) {\n\t\t\t\t// Mark this path as needing object coercion (JSON parsing)\n\t\t\t\tresults.push({ path: [...path], type: \"object\" });\n\t\t\t}\n\n\t\t\t// Also recursively check nested properties for their own coercions\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} 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}\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 and type combination\n\tconst seen = new Set<string>();\n\treturn results.filter((t) => {\n\t\tconst key = JSON.stringify(t.path) + t.type;\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 = (\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\n\t\t\tif (rootTarget?.type === \"object\" && typeof data === \"string\") {\n\t\t\t\treturn coerceJson(data);\n\t\t\t}\n\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 = coerceNumber(data);\n\t\t\tif (typeof asNumber === \"number\") {\n\t\t\t\treturn asNumber;\n\t\t\t}\n\t\t\treturn coerceBoolean(data);\n\t\t}\n\t\treturn data;\n\t}\n\n\t// Sort targets by path length to ensure parent objects/arrays are coerced before their children\n\tconst sortedTargets = [...targets].sort(\n\t\t(a, b) => a.path.length - b.path.length,\n\t);\n\n\tconst walk = (\n\t\tcurrent: unknown,\n\t\ttargetPath: string[],\n\t\ttype: \"primitive\" | \"array\" | \"object\",\n\t) => {\n\t\tif (!current || typeof current !== \"object\") return;\n\n\t\tif (targetPath.length === 0) {\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 = coerceNumber(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] = coerceBoolean(original);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else if (type === \"object\") {\n\t\t\t\t\t\t\tcurrent[i] = coerceJson(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 (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 (type === \"object\" && typeof original === \"string\") {\n\t\t\t\t\trecord[lastKey] = coerceJson(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\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 = coerceNumber(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] = coerceBoolean(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 = coerceNumber(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] = coerceBoolean(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 sortedTargets) {\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\tat: any,\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 as any).base,\n\t});\n\tconst targets = findCoercionPaths(json as any);\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 at(\"unknown\")\n\t\t.pipe((data: unknown) => applyCoercion(data, targets, options))\n\t\t.pipe(schema) as BaseType<t, $>;\n}\n","import { $ } from \"@repo/scope\";\nimport type { SchemaShape } from \"@repo/types\";\nimport type { distill } from \"arktype\";\nimport { ArkErrors } from \"arktype\";\nimport { ArkEnvError, type ValidationIssue } from \"../core\";\nimport type { ArkEnvConfig, EnvSchema } from \"../create-env\";\nimport { styleText } from \"../utils/style-text.ts\";\nimport { coerce } from \"./coercion/coerce\";\n\n/**\n * Re-export of ArkType's `distill` utilities.\n *\n * Exposed for internal use cases and type-level integrations.\n * ArkEnv does not add behavior or guarantees beyond what ArkType provides.\n *\n * @internal\n * @see https://github.com/arktypeio/arktype\n */\nexport type { distill };\n\n/**\n * Converts ArkType's `ArkErrors` (keyed by path) into a flat `ValidationIssue[]`\n * suitable for `ArkEnvError`. Strips leading path references from messages to\n * avoid duplication when `formatInternalErrors` prepends the styled path, and\n * applies cyan styling to inline \"(was …)\" values.\n *\n * @internal\n */\nfunction arkErrorsToIssues(errors: ArkErrors): ValidationIssue[] {\n\treturn Object.entries(errors.byPath).map(([path, error]) => {\n\t\tlet message = error.message;\n\n\t\t// Strip leading path reference if ArkType included it in the message\n\t\tlet trimmed = message.trimStart();\n\t\tif (trimmed.length > 0 && \":.-\".includes(trimmed[0])) {\n\t\t\ttrimmed = trimmed.slice(1).trimStart();\n\t\t}\n\t\tif (trimmed.toLowerCase().startsWith(path.toLowerCase())) {\n\t\t\tlet rest = trimmed.slice(path.length).trimStart();\n\t\t\tif (rest.length > 0 && \":.-\".includes(rest[0])) {\n\t\t\t\trest = rest.slice(1);\n\t\t\t}\n\t\t\tmessage = rest.trimStart();\n\t\t}\n\n\t\t// Style (was ...) inline values\n\t\tconst valueMatch = message.match(/\\(was (.*)\\)/);\n\t\tif (valueMatch?.[1]) {\n\t\t\tconst value = valueMatch[1];\n\t\t\tif (!value.includes(\"\\x1b[\")) {\n\t\t\t\tmessage = message.replace(\n\t\t\t\t\t`(was ${value})`,\n\t\t\t\t\t`(was ${styleText(\"cyan\", value)})`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn { path, message };\n\t});\n}\n\n/**\n * Parse and validate environment variables using ArkEnv's schema rules.\n *\n * This applies:\n * - schema validation\n * - optional coercion (strings → numbers, booleans, arrays)\n * - undeclared key handling\n *\n * On success, returns the validated environment object.\n * On failure, throws an {@link ArkEnvError}.\n *\n * This is a low-level utility used internally by ArkEnv.\n * Most users should prefer the default `arkenv()` export.\n *\n * @internal\n */\nexport function parse<const T extends SchemaShape>(\n\tdef: EnvSchema<T>,\n\tconfig: ArkEnvConfig,\n) {\n\tconst {\n\t\tenv = process.env,\n\t\tcoerce: shouldCoerce = true,\n\t\tonUndeclaredKey = \"delete\",\n\t\tarrayFormat = \"comma\",\n\t} = config;\n\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\tconst schema = (isCompiledType ? def : $.type.raw(def)) as any;\n\n\t// Apply the `onUndeclaredKey` option\n\tconst schemaWithKeys = schema.onUndeclaredKey(onUndeclaredKey);\n\n\t// Apply coercion transformation to allow strings to be parsed as numbers/booleans\n\tlet finalSchema = schemaWithKeys;\n\tif (shouldCoerce) {\n\t\tfinalSchema = coerce($.type, schemaWithKeys, { arrayFormat });\n\t}\n\n\t// Validate the environment variables\n\tconst validatedEnv = finalSchema(env);\n\n\t// In ArkType 2.x, calling a type as a function returns the validated data or ArkErrors\n\tif (validatedEnv instanceof ArkErrors) {\n\t\tthrow new ArkEnvError(arkErrorsToIssues(validatedEnv));\n\t}\n\n\treturn validatedEnv;\n}\n","import type { $ } from \"@repo/scope\";\nimport type {\n\tCompiledEnvSchema,\n\tDict,\n\tInferType,\n\tSchemaShape,\n} from \"@repo/types\";\nimport type { type as at, distill } from \"arktype\";\nimport { parse } from \"./arktype\";\nimport type { ArkEnvError } from \"./core\";\n\n/**\n * Declarative environment schema definition accepted by ArkEnv.\n *\n * Represents a declarative schema object mapping environment\n * variable names to schema definitions (e.g. ArkType DSL strings\n * or Standard Schema validators).\n *\n * This type is used to validate that a schema object is compatible with\n * ArkEnv’s validator scope before being compiled or parsed.\n *\n * Most users will provide schemas in this form.\n *\n * @template def - The schema shape object\n */\nexport type EnvSchema<def> = at.validate<def, $>;\ntype RuntimeEnvironment = Dict<string>;\n\n/**\n * Configuration options for `createEnv`\n */\nexport type ArkEnvConfig = {\n\t/**\n\t * The environment variables to parse. 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?: \"comma\" | \"json\";\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 * Utility to parse environment variables using ArkType or Standard Schema\n * @param def - The schema definition\n * @param config - The evaluation configuration\n * @returns The parsed environment variables\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 CompiledEnvSchema>(\n\tdef: T,\n\tconfig?: ArkEnvConfig,\n): InferType<T>;\nexport function createEnv<const T extends SchemaShape>(\n\tdef: EnvSchema<T> | CompiledEnvSchema,\n\tconfig?: ArkEnvConfig,\n): distill.Out<at.infer<T, $>> | InferType<typeof def>;\nexport function createEnv<const T extends SchemaShape>(\n\tdef: EnvSchema<T> | CompiledEnvSchema,\n\tconfig: ArkEnvConfig = {},\n): distill.Out<at.infer<T, $>> | InferType<typeof def> {\n\t// biome-ignore lint/suspicious/noExplicitAny: parse handles both EnvSchema<T> and CompiledEnvSchema at runtime\n\treturn parse(def as any, config);\n}\n","import { $ } from \"@repo/scope\";\nimport { createEnv } from \"./create-env\";\n\nexport { createEnv };\n/**\n * Like ArkType's `type`, but with ArkEnv's extra keywords, such as:\n *\n * - `string.host` – a hostname (e.g. `\"localhost\"`, `\"127.0.0.1\"`)\n * - `number.port` – a port number (e.g. `8080`)\n *\n * See ArkType's docs for the full API:\n * https://arktype.io/docs/type-api\n */\nexport const type = $.type;\nexport type { ArkEnvConfig, EnvSchema } 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;\n"],"mappings":"mGAA0C,MAAM,EAAEA,EAAE,+BAA+B,CAAC,EAAEA,EAAE,0BAA0B,CAAC,EAAEC,EAAE,CAAC,OAAOD,EAAE,OAAO,CAAC,GAAGA,EAAE,SAAS,OAAO,KAAK,EAAE,CAAC,CAAC,OAAOA,EAAE,OAAO,CAAC,GAAGA,EAAE,SAAS,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,CCW1M,EAAgB,GAAe,CAE3C,GADI,OAAO,GAAM,UACb,OAAO,GAAM,SAAU,OAAO,EAClC,IAAM,EAAU,EAAE,MAAM,CACxB,GAAI,IAAY,GAAI,OAAO,EAC3B,GAAI,IAAY,MAAO,MAAO,KAC9B,IAAME,EAAI,OAAO,EAAQ,CACzB,OAAO,OAAO,MAAMA,EAAE,CAAG,EAAIA,GAajB,EAAiB,GACzB,IAAM,OAAe,GACrB,IAAM,QAAgB,GACnB,EAaK,EAAc,GAAe,CACzC,GAAI,OAAO,GAAM,SAAU,OAAO,EAClC,IAAM,EAAU,EAAE,MAAM,CAC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Q,EAAM,CAAC,GACjC,EAIH,MAAO,CAAE,OAAM,UAAS,EACvB,CAmBH,SAAgB,EACf,EACA,EACC,CACD,GAAM,CACL,MAAM,QAAQ,IACd,OAAQ,EAAe,GACvB,kBAAkB,SAClB,cAAc,SACX,EAQE,GAJiB,OAAO,GAAQ,YAAc,WAAY,EAC/B,EAAMC,EAAE,KAAK,IAAI,EAAI,EAGxB,gBAAgB,EAAgB,CAG1D,EAAc,EACd,IACH,EAAc,EAAOA,EAAE,KAAM,EAAgB,CAAE,cAAa,CAAC,EAI9D,IAAM,EAAe,EAAY,EAAI,CAGrC,GAAI,aAAwB,EAC3B,MAAM,IAAI,EAAY,EAAkB,EAAa,CAAC,CAGvD,OAAO,EClBR,SAAgB,EACf,EACA,EAAuB,EAAE,CAC6B,CAEtD,OAAO,EAAM,EAAY,EAAO,CCpFjC,MAAa,EAAOC,EAAE,KAStB,IAAA,EADe"}
1
+ {"version":3,"file":"index.mjs","names":["t","e","record","$","$"],"sources":["../../internal/scope/dist/index.js","../src/arktype/coercion/morphs.ts","../src/arktype/coercion/coerce.ts","../src/arktype/index.ts","../src/create-env.ts","../src/index.ts"],"sourcesContent":["import{scope as e,type as t}from\"arktype\";const n=t(`0 <= number.integer <= 65535`),r=t(`string.ip | 'localhost'`),i=e({string:t.module({...t.keywords.string,host:r}),number:t.module({...t.keywords.number,port:n})});export{i as $};\n//# sourceMappingURL=index.js.map","/**\n * Attempt to coerce a value to a number.\n *\n * If the input is already a number, returns it unchanged.\n * If the input is a string that can be parsed as a number, returns the parsed number.\n * Otherwise, returns the original value unchanged.\n *\n * @internal\n * @param s - The value to coerce\n * @returns The coerced number or the original value\n */\nexport const coerceNumber = (s: unknown) => {\n\tif (typeof s === \"number\") return s;\n\tif (typeof s !== \"string\") return s;\n\tconst trimmed = s.trim();\n\tif (trimmed === \"\") return s;\n\tif (trimmed === \"NaN\") return Number.NaN;\n\tconst n = Number(trimmed);\n\treturn Number.isNaN(n) ? s : n;\n};\n\n/**\n * Attempt to coerce a value to a boolean.\n *\n * Convert the strings \"true\" and \"false\" to their boolean equivalents.\n * All other values are returned unchanged.\n *\n * @internal\n * @param s - The value to coerce\n * @returns The coerced boolean or the original value\n */\nexport const coerceBoolean = (s: unknown) => {\n\tif (s === \"true\") return true;\n\tif (s === \"false\") return false;\n\treturn s;\n};\n\n/**\n * Attempt to parse a value as JSON.\n *\n * If the input is a string that starts with `{` or `[` and can be parsed as JSON,\n * returns the parsed object or array. Otherwise, returns the original value unchanged.\n *\n * @internal\n * @param s - The value to parse\n * @returns The parsed JSON or the original value\n */\nexport const coerceJson = (s: unknown) => {\n\tif (typeof s !== \"string\") return s;\n\tconst trimmed = s.trim();\n\tif (!trimmed.startsWith(\"{\") && !trimmed.startsWith(\"[\")) return s;\n\ttry {\n\t\treturn JSON.parse(trimmed);\n\t} catch {\n\t\treturn s;\n\t}\n};\n","import type { BaseType, JsonSchema } from \"arktype\";\nimport { coerceBoolean, coerceJson, coerceNumber } from \"./morphs.ts\";\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\" | \"object\";\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\", \"array\", and \"object\" 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 === \"object\") {\n\t\t\t// Check if this object has properties defined\n\t\t\t// If it does, we want to coerce the whole object from a JSON string\n\t\t\t// But we also want to recursively check nested properties\n\t\t\tconst hasProperties =\n\t\t\t\t\"properties\" in node &&\n\t\t\t\tnode.properties &&\n\t\t\t\tObject.keys(node.properties).length > 0;\n\n\t\t\tif (hasProperties) {\n\t\t\t\t// Mark this path as needing object coercion (JSON parsing)\n\t\t\t\tresults.push({ path: [...path], type: \"object\" });\n\t\t\t}\n\n\t\t\t// Also recursively check nested properties for their own coercions\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} 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}\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 and type combination\n\tconst seen = new Set<string>();\n\treturn results.filter((t) => {\n\t\tconst key = JSON.stringify(t.path) + t.type;\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 = (\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\n\t\t\tif (rootTarget?.type === \"object\" && typeof data === \"string\") {\n\t\t\t\treturn coerceJson(data);\n\t\t\t}\n\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 = coerceNumber(data);\n\t\t\tif (typeof asNumber === \"number\") {\n\t\t\t\treturn asNumber;\n\t\t\t}\n\t\t\treturn coerceBoolean(data);\n\t\t}\n\t\treturn data;\n\t}\n\n\t// Sort targets by path length to ensure parent objects/arrays are coerced before their children\n\tconst sortedTargets = [...targets].sort(\n\t\t(a, b) => a.path.length - b.path.length,\n\t);\n\n\tconst walk = (\n\t\tcurrent: unknown,\n\t\ttargetPath: string[],\n\t\ttype: \"primitive\" | \"array\" | \"object\",\n\t) => {\n\t\tif (!current || typeof current !== \"object\") return;\n\n\t\tif (targetPath.length === 0) {\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 = coerceNumber(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] = coerceBoolean(original);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else if (type === \"object\") {\n\t\t\t\t\t\t\tcurrent[i] = coerceJson(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 (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 (type === \"object\" && typeof original === \"string\") {\n\t\t\t\t\trecord[lastKey] = coerceJson(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\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 = coerceNumber(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] = coerceBoolean(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 = coerceNumber(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] = coerceBoolean(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 sortedTargets) {\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\tat: any,\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 as any).base,\n\t});\n\tconst targets = findCoercionPaths(json as any);\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 at(\"unknown\")\n\t\t.pipe((data: unknown) => applyCoercion(data, targets, options))\n\t\t.pipe(schema) as BaseType<t, $>;\n}\n","import { $ } from \"@repo/scope\";\nimport type { SchemaShape } from \"@repo/types\";\nimport type { distill } from \"arktype\";\nimport { ArkErrors } from \"arktype\";\nimport { ArkEnvError, type ValidationIssue } from \"../core\";\nimport type { ArkEnvConfig, EnvSchema } from \"../create-env\";\nimport { styleText } from \"../utils/style-text.ts\";\nimport { coerce } from \"./coercion/coerce\";\n\n/**\n * Re-export of ArkType's `distill` utilities.\n *\n * Exposed for internal use cases and type-level integrations.\n * ArkEnv does not add behavior or guarantees beyond what ArkType provides.\n *\n * @internal\n * @see https://github.com/arktypeio/arktype\n */\nexport type { distill };\n\n/**\n * Converts ArkType's `ArkErrors` (keyed by path) into a flat `ValidationIssue[]`\n * suitable for `ArkEnvError`. Strips leading path references from messages to\n * avoid duplication when `formatInternalErrors` prepends the styled path, and\n * applies cyan styling to inline \"(was …)\" values.\n *\n * @internal\n */\nfunction arkErrorsToIssues(errors: ArkErrors): ValidationIssue[] {\n\treturn Object.entries(errors.byPath).map(([path, error]) => {\n\t\tlet message = error.message;\n\n\t\t// Strip leading path reference if ArkType included it in the message\n\t\tlet trimmed = message.trimStart();\n\t\tif (trimmed.length > 0 && \":.-\".includes(trimmed[0])) {\n\t\t\ttrimmed = trimmed.slice(1).trimStart();\n\t\t}\n\t\tif (trimmed.toLowerCase().startsWith(path.toLowerCase())) {\n\t\t\tlet rest = trimmed.slice(path.length).trimStart();\n\t\t\tif (rest.length > 0 && \":.-\".includes(rest[0])) {\n\t\t\t\trest = rest.slice(1);\n\t\t\t}\n\t\t\tmessage = rest.trimStart();\n\t\t}\n\n\t\t// Style (was ...) inline values\n\t\tconst valueMatch = message.match(/\\(was (.*)\\)/);\n\t\tif (valueMatch?.[1]) {\n\t\t\tconst value = valueMatch[1];\n\t\t\tif (!value.includes(\"\\x1b[\")) {\n\t\t\t\tmessage = message.replace(\n\t\t\t\t\t`(was ${value})`,\n\t\t\t\t\t`(was ${styleText(\"cyan\", value)})`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn { path, message };\n\t});\n}\n\n/**\n * Parse and validate environment variables using ArkEnv's schema rules.\n *\n * This applies:\n * - schema validation\n * - optional coercion (strings → numbers, booleans, arrays)\n * - undeclared key handling\n *\n * On success, returns the validated environment object.\n * On failure, throws an {@link ArkEnvError}.\n *\n * This is a low-level utility used internally by ArkEnv.\n * Most users should prefer the default `arkenv()` export.\n *\n * @internal\n */\nexport function parse<const T extends SchemaShape>(\n\tdef: EnvSchema<T>,\n\tconfig: ArkEnvConfig,\n) {\n\tconst {\n\t\tenv = process.env,\n\t\tcoerce: shouldCoerce = true,\n\t\tonUndeclaredKey = \"delete\",\n\t\tarrayFormat = \"comma\",\n\t} = config;\n\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\tconst schema = (isCompiledType ? def : $.type.raw(def)) as any;\n\n\t// Apply the `onUndeclaredKey` option\n\tconst schemaWithKeys = schema.onUndeclaredKey(onUndeclaredKey);\n\n\t// Apply coercion transformation to allow strings to be parsed as numbers/booleans\n\tlet finalSchema = schemaWithKeys;\n\tif (shouldCoerce) {\n\t\tfinalSchema = coerce($.type, schemaWithKeys, { arrayFormat });\n\t}\n\n\t// Validate the environment variables\n\tconst validatedEnv = finalSchema(env);\n\n\t// In ArkType 2.x, calling a type as a function returns the validated data or ArkErrors\n\tif (validatedEnv instanceof ArkErrors) {\n\t\tthrow new ArkEnvError(arkErrorsToIssues(validatedEnv));\n\t}\n\n\treturn validatedEnv;\n}\n","import type { $ } from \"@repo/scope\";\nimport type {\n\tCompiledEnvSchema,\n\tDict,\n\tInferType,\n\tSchemaShape,\n} from \"@repo/types\";\nimport type { type as at, distill } from \"arktype\";\nimport { parse } from \"./arktype\";\nimport type { ArkEnvError } from \"./core\";\n\n/**\n * Declarative environment schema definition accepted by ArkEnv.\n *\n * Represents a declarative schema object mapping environment\n * variable names to schema definitions (e.g. ArkType DSL strings\n * or Standard Schema validators).\n *\n * This type is used to validate that a schema object is compatible with\n * ArkEnv’s validator scope before being compiled or parsed.\n *\n * Most users will provide schemas in this form.\n *\n * @template def - The schema shape object\n */\nexport type EnvSchema<def> = at.validate<def, $>;\n\n/**\n * Infer the validated and coerced environment object type from a schema.\n * Supports declarative schema shapes, compiled ArkType schemas, and Standard Schema validators.\n *\n * @template T - The schema type\n */\nexport type Infer<T> = T extends SchemaShape\n\t? distill.Out<at.infer<T, $>>\n\t: InferType<T>;\n\ntype RuntimeEnvironment = Dict<string>;\n\n/**\n * Configuration options for `createEnv`\n */\nexport type ArkEnvConfig = {\n\t/**\n\t * The environment variables to parse. 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?: \"comma\" | \"json\";\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 * Utility to parse environment variables using ArkType or Standard Schema\n * @param def - The schema definition\n * @param config - The evaluation configuration\n * @returns The parsed environment variables\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 CompiledEnvSchema>(\n\tdef: T,\n\tconfig?: ArkEnvConfig,\n): InferType<T>;\nexport function createEnv<const T extends SchemaShape>(\n\tdef: EnvSchema<T> | CompiledEnvSchema,\n\tconfig?: ArkEnvConfig,\n): distill.Out<at.infer<T, $>> | InferType<typeof def>;\nexport function createEnv<const T extends SchemaShape>(\n\tdef: EnvSchema<T> | CompiledEnvSchema,\n\tconfig: ArkEnvConfig = {},\n): distill.Out<at.infer<T, $>> | InferType<typeof def> {\n\t// biome-ignore lint/suspicious/noExplicitAny: parse handles both EnvSchema<T> and CompiledEnvSchema at runtime\n\treturn parse(def as any, config);\n}\n","import { $ } from \"@repo/scope\";\nimport { createEnv } from \"./create-env\";\n\nexport { createEnv };\n/**\n * Like ArkType's `type`, but with ArkEnv's extra keywords, such as:\n *\n * - `string.host` – a hostname (e.g. `\"localhost\"`, `\"127.0.0.1\"`)\n * - `number.port` – a port number (e.g. `8080`)\n *\n * See ArkType's docs for the full API:\n * https://arktype.io/docs/type-api\n */\nexport const type = $.type;\nexport type { ArkEnvConfig, EnvSchema, Infer } 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;\n"],"mappings":"mGAA0C,MAAM,EAAEA,EAAE,+BAA+B,CAAC,EAAEA,EAAE,0BAA0B,CAAC,EAAEC,EAAE,CAAC,OAAOD,EAAE,OAAO,CAAC,GAAGA,EAAE,SAAS,OAAO,KAAK,EAAE,CAAC,CAAC,OAAOA,EAAE,OAAO,CAAC,GAAGA,EAAE,SAAS,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,CCW1M,EAAgB,GAAe,CAE3C,GADI,OAAO,GAAM,UACb,OAAO,GAAM,SAAU,OAAO,EAClC,IAAM,EAAU,EAAE,MAAM,CACxB,GAAI,IAAY,GAAI,OAAO,EAC3B,GAAI,IAAY,MAAO,MAAO,KAC9B,IAAM,EAAI,OAAO,EAAQ,CACzB,OAAO,OAAO,MAAM,EAAE,CAAG,EAAI,GAajB,EAAiB,GACzB,IAAM,OAAe,GACrB,IAAM,QAAgB,GACnB,EAaK,EAAc,GAAe,CACzC,GAAI,OAAO,GAAM,SAAU,OAAO,EAClC,IAAM,EAAU,EAAE,MAAM,CACxB,GAAI,CAAC,EAAQ,WAAW,IAAI,EAAI,CAAC,EAAQ,WAAW,IAAI,CAAE,OAAO,EACjE,GAAI,CACH,OAAO,KAAK,MAAM,EAAQ,MACnB,CACP,OAAO,ICrBH,GACL,EACA,EA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AQE,GAJiB,OAAO,GAAQ,YAAc,WAAY,EAC/B,EAAMC,EAAE,KAAK,IAAI,EAAI,EAGxB,gBAAgB,EAAgB,CAG1D,EAAc,EACd,IACH,EAAc,EAAOA,EAAE,KAAM,EAAgB,CAAE,cAAa,CAAC,EAI9D,IAAM,EAAe,EAAY,EAAI,CAGrC,GAAI,aAAwB,EAC3B,MAAM,IAAI,EAAY,EAAkB,EAAa,CAAC,CAGvD,OAAO,ECPR,SAAgB,EACf,EACA,EAAuB,EAAE,CAC6B,CAEtD,OAAO,EAAM,EAAY,EAAO,CC/FjC,MAAa,EAAOC,EAAE,KAQhB,EAAS"}
package/dist/standard.cjs CHANGED
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports,`__esModule`,{value:!0});const e=require(`./core-Byznlywt.cjs`);function t(t,n){if(typeof n==`string`)throw new e.t([{path:t,message:`ArkType DSL strings are not supported in "standard" mode. Use a Standard Schema validator (e.g., Zod, Valibot) or import from "arkenv" for ArkType schemas.`}])}function n(t,n){let r=n&&typeof n==`object`&&`~standard`in n&&n[`~standard`];if(!r||typeof r!=`object`||!(`validate`in r)||typeof r.validate!=`function`)throw new e.t([{path:t,message:`Invalid validator: expected a Standard Schema 1.0 validator (must have "~standard" property). Import from "arkenv" to use ArkType schemas.`}])}function r(t){if(!t||typeof t!=`object`||Array.isArray(t))throw new e.t([{path:``,message:`Invalid schema: expected an object mapping in "standard" mode.`}])}function i(t,n){let{env:r=process.env,onUndeclaredKey:i=`delete`}=n,a={},o=[],s=new Set(Object.keys(r));for(let n in t){let i=t[n],c=r[n];if(!i||typeof i!=`object`||!(`~standard`in i))throw new e.t([{path:n,message:`Invalid schema: expected a Standard Schema 1.0 validator (e.g. Zod, Valibot) in 'standard' mode.`}]);let l=i[`~standard`].validate(c);if(l instanceof Promise)throw new e.t([{path:n,message:`Async validation is not supported. ArkEnv is synchronous.`}]);if(l.issues)for(let e of l.issues){let t=e.path&&e.path.length>0?`${n}.${e.path.map(e=>typeof e==`object`&&e&&`key`in e?String(e.key):String(e)).join(`.`)}`:n;o.push({path:t,message:e.message})}else a[n]=l.value;s.delete(n)}if(i!==`delete`)for(let e of s)i===`reject`?o.push({path:e,message:`Undeclared key`}):i===`ignore`&&(a[e]=r[e]);if(o.length>0)throw new e.t(o);return a}function a(e,a){for(let i in r(e),e){let r=e[i];t(i,r),n(i,r)}return i(e,a??{})}const o=a;var s=o;exports.createEnv=a,exports.default=s;
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require(`./core-Byznlywt.cjs`);function t(t,n){if(typeof n==`string`)throw new e.t([{path:t,message:`ArkType DSL strings are not supported in "standard" mode. Use a Standard Schema validator (e.g., Zod, Valibot) or import from "arkenv" for ArkType schemas.`}])}function n(t,n){let r=n&&typeof n==`object`&&`~standard`in n&&n[`~standard`];if(!r||typeof r!=`object`||!(`validate`in r)||typeof r.validate!=`function`)throw new e.t([{path:t,message:`Invalid validator: expected a Standard Schema 1.0 validator (must have "~standard" property). Import from "arkenv" to use ArkType schemas.`}])}function r(t){if(!t||typeof t!=`object`||Array.isArray(t))throw new e.t([{path:``,message:`Invalid schema: expected an object mapping in "standard" mode.`}])}function i(t,n){let{env:r=process.env,onUndeclaredKey:i=`delete`}=n,a={},o=[],s=new Set(Object.keys(r));for(let n in t){let i=t[n],c=r[n];if(!i||typeof i!=`object`||!(`~standard`in i))throw new e.t([{path:n,message:`Invalid schema: expected a Standard Schema 1.0 validator (e.g. Zod, Valibot) in 'standard' mode.`}]);let l=i[`~standard`].validate(c);if(l instanceof Promise)throw new e.t([{path:n,message:`Async validation is not supported. ArkEnv is synchronous.`}]);if(l.issues)for(let e of l.issues){let t=e.path&&e.path.length>0?`${n}.${e.path.map(e=>typeof e==`object`&&e&&`key`in e?String(e.key):String(e)).join(`.`)}`:n;o.push({path:t,message:e.message})}else a[n]=l.value;s.delete(n)}if(i!==`delete`)for(let e of s)i===`reject`?o.push({path:e,message:`Undeclared key`}):i===`ignore`&&(a[e]=r[e]);if(o.length>0)throw new e.t(o);return a}function a(e,a){r(e);for(let r in e){let i=e[r];t(r,i),n(r,i)}return i(e,a??{})}const o=a;exports.createEnv=a,exports.default=o;
2
2
 
3
3
  // CJS Interop Shim
4
4
  if (module.exports && module.exports.default) {
@@ -1,4 +1,4 @@
1
- import { i as StandardSchemaV1 } from "./index-bSO6Cmhi.cjs";
1
+ import { i as StandardSchemaV1 } from "./index-CzNfOanV.cjs";
2
2
 
3
3
  //#region src/parse-standard.d.ts
4
4
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"standard.d.cts","names":[],"sources":["../src/parse-standard.ts","../src/standard.ts"],"sourcesContent":[],"mappings":";;;;;;AAMY,KAAA,mBAAA,GAAmB;;;;ECKnB,GAAA,CAAA,EDDL,MCCK,CAAA,MAAA,EAAiB,MAAA,GAAA,SAAG,CAAA;EAwBhB;;;;;;;;;;AAef;;;;;;;AD5CD;;KCKY,iBAAA,GAAoB;;AAAhC;AAwBA;;;;;;;;;;AAeC;;;;;;;;;;iBAfe,0BAA0B,eAAe,wBACnD,YACI,kCACO,IAAI,gBAAA,CAAiB,YAAY,EAAE;;;;;;cAmB9C,eAAM"}
1
+ {"version":3,"file":"standard.d.cts","names":[],"sources":["../src/parse-standard.ts","../src/standard.ts"],"mappings":";;;;;;KAMY,mBAAA;EAAmB;;;EAI9B,GAAA,GAAM,MAAA;EAAA;;;;;;;ACCP;;;;;EDYC,eAAA;AAAA;;;;AAjBD;;KCKY,iBAAA,GAAoB,mBAAA;;;;;;;;;;AAAhC;;;;;AAwBA;;;;;;;;iBAAgB,SAAA,iBAA0B,MAAA,SAAe,gBAAA,EAAA,CACxD,GAAA,EAAK,CAAA,EACL,MAAA,GAAS,iBAAA,iBACO,CAAA,GAAI,gBAAA,CAAiB,WAAA,CAAY,CAAA,CAAE,CAAA;;;;;;cAmB9C,MAAA,SAAM,SAAA"}
@@ -1,4 +1,4 @@
1
- import { i as StandardSchemaV1 } from "./index-Cic20SzT.mjs";
1
+ import { i as StandardSchemaV1 } from "./index-Bx89Loyb.mjs";
2
2
 
3
3
  //#region src/parse-standard.d.ts
4
4
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"standard.d.mts","names":[],"sources":["../src/parse-standard.ts","../src/standard.ts"],"sourcesContent":[],"mappings":";;;;;;AAMY,KAAA,mBAAA,GAAmB;;;;ECKnB,GAAA,CAAA,EDDL,MCCK,CAAA,MAAA,EAAiB,MAAA,GAAA,SAAG,CAAA;EAwBhB;;;;;;;;;;AAef;;;;;;;AD5CD;;KCKY,iBAAA,GAAoB;;AAAhC;AAwBA;;;;;;;;;;AAeC;;;;;;;;;;iBAfe,0BAA0B,eAAe,wBACnD,YACI,kCACO,IAAI,gBAAA,CAAiB,YAAY,EAAE;;;;;;cAmB9C,eAAM"}
1
+ {"version":3,"file":"standard.d.mts","names":[],"sources":["../src/parse-standard.ts","../src/standard.ts"],"mappings":";;;;;;KAMY,mBAAA;EAAmB;;;EAI9B,GAAA,GAAM,MAAA;EAAA;;;;;;;ACCP;;;;;EDYC,eAAA;AAAA;;;;AAjBD;;KCKY,iBAAA,GAAoB,mBAAA;;;;;;;;;;AAAhC;;;;;AAwBA;;;;;;;;iBAAgB,SAAA,iBAA0B,MAAA,SAAe,gBAAA,EAAA,CACxD,GAAA,EAAK,CAAA,EACL,MAAA,GAAS,iBAAA,iBACO,CAAA,GAAI,gBAAA,CAAiB,WAAA,CAAY,CAAA,CAAE,CAAA;;;;;;cAmB9C,MAAA,SAAM,SAAA"}
package/dist/standard.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import{t as e}from"./core-DzT5rjcY.mjs";function t(t,n){if(typeof n==`string`)throw new e([{path:t,message:`ArkType DSL strings are not supported in "standard" mode. Use a Standard Schema validator (e.g., Zod, Valibot) or import from "arkenv" for ArkType schemas.`}])}function n(t,n){let r=n&&typeof n==`object`&&`~standard`in n&&n[`~standard`];if(!r||typeof r!=`object`||!(`validate`in r)||typeof r.validate!=`function`)throw new e([{path:t,message:`Invalid validator: expected a Standard Schema 1.0 validator (must have "~standard" property). Import from "arkenv" to use ArkType schemas.`}])}function r(t){if(!t||typeof t!=`object`||Array.isArray(t))throw new e([{path:``,message:`Invalid schema: expected an object mapping in "standard" mode.`}])}function i(t,n){let{env:r=process.env,onUndeclaredKey:i=`delete`}=n,a={},o=[],s=new Set(Object.keys(r));for(let n in t){let i=t[n],c=r[n];if(!i||typeof i!=`object`||!(`~standard`in i))throw new e([{path:n,message:`Invalid schema: expected a Standard Schema 1.0 validator (e.g. Zod, Valibot) in 'standard' mode.`}]);let l=i[`~standard`].validate(c);if(l instanceof Promise)throw new e([{path:n,message:`Async validation is not supported. ArkEnv is synchronous.`}]);if(l.issues)for(let e of l.issues){let t=e.path&&e.path.length>0?`${n}.${e.path.map(e=>typeof e==`object`&&e&&`key`in e?String(e.key):String(e)).join(`.`)}`:n;o.push({path:t,message:e.message})}else a[n]=l.value;s.delete(n)}if(i!==`delete`)for(let e of s)i===`reject`?o.push({path:e,message:`Undeclared key`}):i===`ignore`&&(a[e]=r[e]);if(o.length>0)throw new e(o);return a}function a(e,a){for(let i in r(e),e){let r=e[i];t(i,r),n(i,r)}return i(e,a??{})}var o=a;export{a as createEnv,o as default};
1
+ import{t as e}from"./core-B51xxxje.mjs";function t(t,n){if(typeof n==`string`)throw new e([{path:t,message:`ArkType DSL strings are not supported in "standard" mode. Use a Standard Schema validator (e.g., Zod, Valibot) or import from "arkenv" for ArkType schemas.`}])}function n(t,n){let r=n&&typeof n==`object`&&`~standard`in n&&n[`~standard`];if(!r||typeof r!=`object`||!(`validate`in r)||typeof r.validate!=`function`)throw new e([{path:t,message:`Invalid validator: expected a Standard Schema 1.0 validator (must have "~standard" property). Import from "arkenv" to use ArkType schemas.`}])}function r(t){if(!t||typeof t!=`object`||Array.isArray(t))throw new e([{path:``,message:`Invalid schema: expected an object mapping in "standard" mode.`}])}function i(t,n){let{env:r=process.env,onUndeclaredKey:i=`delete`}=n,a={},o=[],s=new Set(Object.keys(r));for(let n in t){let i=t[n],c=r[n];if(!i||typeof i!=`object`||!(`~standard`in i))throw new e([{path:n,message:`Invalid schema: expected a Standard Schema 1.0 validator (e.g. Zod, Valibot) in 'standard' mode.`}]);let l=i[`~standard`].validate(c);if(l instanceof Promise)throw new e([{path:n,message:`Async validation is not supported. ArkEnv is synchronous.`}]);if(l.issues)for(let e of l.issues){let t=e.path&&e.path.length>0?`${n}.${e.path.map(e=>typeof e==`object`&&e&&`key`in e?String(e.key):String(e)).join(`.`)}`:n;o.push({path:t,message:e.message})}else a[n]=l.value;s.delete(n)}if(i!==`delete`)for(let e of s)i===`reject`?o.push({path:e,message:`Undeclared key`}):i===`ignore`&&(a[e]=r[e]);if(o.length>0)throw new e(o);return a}function a(e,a){r(e);for(let r in e){let i=e[r];t(r,i),n(r,i)}return i(e,a??{})}const o=a;export{a as createEnv,o as default};
2
2
 
3
3
  //# sourceMappingURL=standard.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"standard.mjs","names":[],"sources":["../src/guards.ts","../src/parse-standard.ts","../src/standard.ts"],"sourcesContent":["import { ArkEnvError } from \"./core\";\n\n/**\n * Throws if the given value is a string (ArkType DSL) in standard mode.\n * @internal\n */\nexport function assertNotArkTypeDsl(key: string, value: unknown): void {\n\tif (typeof value === \"string\") {\n\t\tthrow new ArkEnvError([\n\t\t\t{\n\t\t\t\tpath: key,\n\t\t\t\tmessage:\n\t\t\t\t\t'ArkType DSL strings are not supported in \"standard\" mode. Use a Standard Schema validator (e.g., Zod, Valibot) or import from \"arkenv\" for ArkType schemas.',\n\t\t\t},\n\t\t]);\n\t}\n}\n\n/**\n * Throws if the given value is not a well-formed Standard Schema validator\n * (must have a `~standard` property whose `validate` field is a function).\n * @internal\n */\nexport function assertStandardSchema(key: string, value: unknown): void {\n\tconst std =\n\t\tvalue &&\n\t\ttypeof value === \"object\" &&\n\t\t\"~standard\" in value &&\n\t\t(value as Record<string, unknown>)[\"~standard\"];\n\n\tif (\n\t\t!std ||\n\t\ttypeof std !== \"object\" ||\n\t\t!(\"validate\" in std) ||\n\t\ttypeof (std as Record<string, unknown>).validate !== \"function\"\n\t) {\n\t\tthrow new ArkEnvError([\n\t\t\t{\n\t\t\t\tpath: key,\n\t\t\t\tmessage:\n\t\t\t\t\t'Invalid validator: expected a Standard Schema 1.0 validator (must have \"~standard\" property). Import from \"arkenv\" to use ArkType schemas.',\n\t\t\t},\n\t\t]);\n\t}\n}\n\n/**\n * Throws if `def` is not a plain object (i.e. not a valid schema map).\n * @internal\n */\nexport function assertStandardSchemaMap(\n\tdef: unknown,\n): asserts def is Record<string, unknown> {\n\tif (!def || typeof def !== \"object\" || Array.isArray(def)) {\n\t\tthrow new ArkEnvError([\n\t\t\t{\n\t\t\t\tpath: \"\",\n\t\t\t\tmessage:\n\t\t\t\t\t'Invalid schema: expected an object mapping in \"standard\" mode.',\n\t\t\t},\n\t\t]);\n\t}\n}\n","import type { StandardSchemaV1 } from \"@repo/types\";\nimport { ArkEnvError, type ValidationIssue } from \"./core\";\n\n/**\n * Configuration options for {@link parseStandard}.\n */\nexport type ParseStandardConfig = {\n\t/**\n\t * The environment variables to parse. Defaults to `process.env`\n\t */\n\tenv?: Record<string, string | undefined>;\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.\n\t *\n\t * - `delete` (ArkEnv default): Undeclared keys are allowed on input but stripped from the output.\n\t * - `ignore`: 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 */\n\tonUndeclaredKey?: \"ignore\" | \"delete\" | \"reject\";\n};\n\n/**\n * Standard Schema 1.0 parser dispatcher.\n * This helper implements parsing for the `arkenv/standard` entry point.\n *\n * @param def - An object mapping environment variable keys to Standard Schema 1.0 validators.\n * @param config - Parsing options (env source, undeclared key handling).\n */\nexport function parseStandard(\n\tdef: Record<string, unknown>,\n\tconfig: ParseStandardConfig,\n) {\n\tconst { env = process.env, onUndeclaredKey = \"delete\" } = config;\n\tconst output: Record<string, unknown> = {};\n\tconst errors: ValidationIssue[] = [];\n\tconst envKeys = new Set(Object.keys(env));\n\n\t// 1. Validate declared keys\n\tfor (const key in def) {\n\t\tconst validator = def[key];\n\t\tconst value = env[key];\n\n\t\t// Check if it's a Standard Schema validator\n\t\tif (\n\t\t\t!validator ||\n\t\t\ttypeof validator !== \"object\" ||\n\t\t\t!(\"~standard\" in validator)\n\t\t) {\n\t\t\tthrow new ArkEnvError([\n\t\t\t\t{\n\t\t\t\t\tpath: key,\n\t\t\t\t\tmessage: `Invalid schema: expected a Standard Schema 1.0 validator (e.g. Zod, Valibot) in 'standard' mode.`,\n\t\t\t\t},\n\t\t\t]);\n\t\t}\n\n\t\tconst result = (validator as StandardSchemaV1)[\"~standard\"].validate(value);\n\n\t\tif (result instanceof Promise) {\n\t\t\tthrow new ArkEnvError([\n\t\t\t\t{\n\t\t\t\t\tpath: key,\n\t\t\t\t\tmessage: \"Async validation is not supported. ArkEnv is synchronous.\",\n\t\t\t\t},\n\t\t\t]);\n\t\t}\n\n\t\tif (result.issues) {\n\t\t\tfor (const issue of result.issues) {\n\t\t\t\tconst issuePath =\n\t\t\t\t\tissue.path && issue.path.length > 0\n\t\t\t\t\t\t? `${key}.${issue.path\n\t\t\t\t\t\t\t\t.map((segment) =>\n\t\t\t\t\t\t\t\t\tsegment !== null &&\n\t\t\t\t\t\t\t\t\ttypeof segment === \"object\" &&\n\t\t\t\t\t\t\t\t\t\"key\" in segment\n\t\t\t\t\t\t\t\t\t\t? String(segment.key)\n\t\t\t\t\t\t\t\t\t\t: String(segment),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t.join(\".\")}`\n\t\t\t\t\t\t: key;\n\t\t\t\terrors.push({\n\t\t\t\t\tpath: issuePath,\n\t\t\t\t\tmessage: issue.message,\n\t\t\t\t});\n\t\t\t}\n\t\t} else {\n\t\t\toutput[key] = result.value;\n\t\t}\n\n\t\tenvKeys.delete(key);\n\t}\n\n\t// 2. Handle undeclared keys\n\tif (onUndeclaredKey !== \"delete\") {\n\t\tfor (const key of envKeys) {\n\t\t\tif (onUndeclaredKey === \"reject\") {\n\t\t\t\terrors.push({\n\t\t\t\t\tpath: key,\n\t\t\t\t\tmessage: \"Undeclared key\",\n\t\t\t\t});\n\t\t\t} else if (onUndeclaredKey === \"ignore\") {\n\t\t\t\toutput[key] = env[key];\n\t\t\t}\n\t\t}\n\t}\n\n\tif (errors.length > 0) {\n\t\tthrow new ArkEnvError(errors);\n\t}\n\n\treturn output;\n}\n","import type { StandardSchemaV1 } from \"@repo/types\";\nimport {\n\tassertNotArkTypeDsl,\n\tassertStandardSchema,\n\tassertStandardSchemaMap,\n} from \"./guards\";\nimport { type ParseStandardConfig, parseStandard } from \"./parse-standard\";\n\n/**\n * Configuration options for the `arkenv/standard` entry's `createEnv`.\n */\nexport type StandardEnvConfig = ParseStandardConfig;\n\n/**\n * Parse and validate environment variables using Standard Schema 1.0 validators (e.g. Zod, Valibot).\n *\n * This entry is ArkType-free - ArkType is never imported, even transitively.\n * Use this when your project must not depend on ArkType.\n *\n * @param def - An object mapping variable names to Standard Schema validators\n * @param config - Optional configuration\n * @returns The validated environment variables\n * @throws An {@link ArkEnvError} if validation fails\n *\n * @example\n * ```ts\n * import arkenv from \"arkenv/standard\";\n * import { z } from \"zod\";\n *\n * const env = arkenv({\n * PORT: z.coerce.number(),\n * HOST: z.string(),\n * });\n * ```\n */\nexport function createEnv<const T extends Record<string, StandardSchemaV1>>(\n\tdef: T,\n\tconfig?: StandardEnvConfig,\n): { [K in keyof T]: StandardSchemaV1.InferOutput<T[K]> } {\n\tassertStandardSchemaMap(def);\n\n\tfor (const key in def) {\n\t\tconst validator = (def as Record<string, unknown>)[key];\n\t\tassertNotArkTypeDsl(key, validator);\n\t\tassertStandardSchema(key, validator);\n\t}\n\n\treturn parseStandard(def as Record<string, unknown>, config ?? {}) as {\n\t\t[K in keyof T]: StandardSchemaV1.InferOutput<T[K]>;\n\t};\n}\n\n/**\n * ArkEnv's Standard Schema 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;\n"],"mappings":"wCAMA,SAAgB,EAAoB,EAAa,EAAsB,CACtE,GAAI,OAAO,GAAU,SACpB,MAAM,IAAI,EAAY,CACrB,CACC,KAAM,EACN,QACC,8JACD,CACD,CAAC,CASJ,SAAgB,EAAqB,EAAa,EAAsB,CACvE,IAAM,EACL,GACA,OAAO,GAAU,UACjB,cAAe,GACd,EAAkC,aAEpC,GACC,CAAC,GACD,OAAO,GAAQ,UACf,EAAE,aAAc,IAChB,OAAQ,EAAgC,UAAa,WAErD,MAAM,IAAI,EAAY,CACrB,CACC,KAAM,EACN,QACC,6IACD,CACD,CAAC,CAQJ,SAAgB,EACf,EACyC,CACzC,GAAI,CAAC,GAAO,OAAO,GAAQ,UAAY,MAAM,QAAQ,EAAI,CACxD,MAAM,IAAI,EAAY,CACrB,CACC,KAAM,GACN,QACC,iEACD,CACD,CAAC,CC3BJ,SAAgB,EACf,EACA,EACC,CACD,GAAM,CAAE,MAAM,QAAQ,IAAK,kBAAkB,UAAa,EACpD,EAAkC,EAAE,CACpC,EAA4B,EAAE,CAC9B,EAAU,IAAI,IAAI,OAAO,KAAK,EAAI,CAAC,CAGzC,IAAK,IAAM,KAAO,EAAK,CACtB,IAAM,EAAY,EAAI,GAChB,EAAQ,EAAI,GAGlB,GACC,CAAC,GACD,OAAO,GAAc,UACrB,EAAE,cAAe,GAEjB,MAAM,IAAI,EAAY,CACrB,CACC,KAAM,EACN,QAAS,mGACT,CACD,CAAC,CAGH,IAAM,EAAU,EAA+B,aAAa,SAAS,EAAM,CAE3E,GAAI,aAAkB,QACrB,MAAM,IAAI,EAAY,CACrB,CACC,KAAM,EACN,QAAS,4DACT,CACD,CAAC,CAGH,GAAI,EAAO,OACV,IAAK,IAAM,KAAS,EAAO,OAAQ,CAClC,IAAM,EACL,EAAM,MAAQ,EAAM,KAAK,OAAS,EAC/B,GAAG,EAAI,GAAG,EAAM,KACf,IAAK,GAEL,OAAO,GAAY,UADnB,GAEA,QAAS,EACN,OAAO,EAAQ,IAAI,CACnB,OAAO,EAAQ,CAClB,CACA,KAAK,IAAI,GACV,EACJ,EAAO,KAAK,CACX,KAAM,EACN,QAAS,EAAM,QACf,CAAC,MAGH,EAAO,GAAO,EAAO,MAGtB,EAAQ,OAAO,EAAI,CAIpB,GAAI,IAAoB,aAClB,IAAM,KAAO,EACb,IAAoB,SACvB,EAAO,KAAK,CACX,KAAM,EACN,QAAS,iBACT,CAAC,CACQ,IAAoB,WAC9B,EAAO,GAAO,EAAI,IAKrB,GAAI,EAAO,OAAS,EACnB,MAAM,IAAI,EAAY,EAAO,CAG9B,OAAO,ECjFR,SAAgB,EACf,EACA,EACyD,CAGzD,IAAK,IAAM,KAFX,EAAwB,EAAI,CAEV,EAAK,CACtB,IAAM,EAAa,EAAgC,GACnD,EAAoB,EAAK,EAAU,CACnC,EAAqB,EAAK,EAAU,CAGrC,OAAO,EAAc,EAAgC,GAAU,EAAE,CAAC,CAWnE,IAAA,EADe"}
1
+ {"version":3,"file":"standard.mjs","names":[],"sources":["../src/guards.ts","../src/parse-standard.ts","../src/standard.ts"],"sourcesContent":["import { ArkEnvError } from \"./core\";\n\n/**\n * Throws if the given value is a string (ArkType DSL) in standard mode.\n * @internal\n */\nexport function assertNotArkTypeDsl(key: string, value: unknown): void {\n\tif (typeof value === \"string\") {\n\t\tthrow new ArkEnvError([\n\t\t\t{\n\t\t\t\tpath: key,\n\t\t\t\tmessage:\n\t\t\t\t\t'ArkType DSL strings are not supported in \"standard\" mode. Use a Standard Schema validator (e.g., Zod, Valibot) or import from \"arkenv\" for ArkType schemas.',\n\t\t\t},\n\t\t]);\n\t}\n}\n\n/**\n * Throws if the given value is not a well-formed Standard Schema validator\n * (must have a `~standard` property whose `validate` field is a function).\n * @internal\n */\nexport function assertStandardSchema(key: string, value: unknown): void {\n\tconst std =\n\t\tvalue &&\n\t\ttypeof value === \"object\" &&\n\t\t\"~standard\" in value &&\n\t\t(value as Record<string, unknown>)[\"~standard\"];\n\n\tif (\n\t\t!std ||\n\t\ttypeof std !== \"object\" ||\n\t\t!(\"validate\" in std) ||\n\t\ttypeof (std as Record<string, unknown>).validate !== \"function\"\n\t) {\n\t\tthrow new ArkEnvError([\n\t\t\t{\n\t\t\t\tpath: key,\n\t\t\t\tmessage:\n\t\t\t\t\t'Invalid validator: expected a Standard Schema 1.0 validator (must have \"~standard\" property). Import from \"arkenv\" to use ArkType schemas.',\n\t\t\t},\n\t\t]);\n\t}\n}\n\n/**\n * Throws if `def` is not a plain object (i.e. not a valid schema map).\n * @internal\n */\nexport function assertStandardSchemaMap(\n\tdef: unknown,\n): asserts def is Record<string, unknown> {\n\tif (!def || typeof def !== \"object\" || Array.isArray(def)) {\n\t\tthrow new ArkEnvError([\n\t\t\t{\n\t\t\t\tpath: \"\",\n\t\t\t\tmessage:\n\t\t\t\t\t'Invalid schema: expected an object mapping in \"standard\" mode.',\n\t\t\t},\n\t\t]);\n\t}\n}\n","import type { StandardSchemaV1 } from \"@repo/types\";\nimport { ArkEnvError, type ValidationIssue } from \"./core\";\n\n/**\n * Configuration options for {@link parseStandard}.\n */\nexport type ParseStandardConfig = {\n\t/**\n\t * The environment variables to parse. Defaults to `process.env`\n\t */\n\tenv?: Record<string, string | undefined>;\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.\n\t *\n\t * - `delete` (ArkEnv default): Undeclared keys are allowed on input but stripped from the output.\n\t * - `ignore`: 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 */\n\tonUndeclaredKey?: \"ignore\" | \"delete\" | \"reject\";\n};\n\n/**\n * Standard Schema 1.0 parser dispatcher.\n * This helper implements parsing for the `arkenv/standard` entry point.\n *\n * @param def - An object mapping environment variable keys to Standard Schema 1.0 validators.\n * @param config - Parsing options (env source, undeclared key handling).\n */\nexport function parseStandard(\n\tdef: Record<string, unknown>,\n\tconfig: ParseStandardConfig,\n) {\n\tconst { env = process.env, onUndeclaredKey = \"delete\" } = config;\n\tconst output: Record<string, unknown> = {};\n\tconst errors: ValidationIssue[] = [];\n\tconst envKeys = new Set(Object.keys(env));\n\n\t// 1. Validate declared keys\n\tfor (const key in def) {\n\t\tconst validator = def[key];\n\t\tconst value = env[key];\n\n\t\t// Check if it's a Standard Schema validator\n\t\tif (\n\t\t\t!validator ||\n\t\t\ttypeof validator !== \"object\" ||\n\t\t\t!(\"~standard\" in validator)\n\t\t) {\n\t\t\tthrow new ArkEnvError([\n\t\t\t\t{\n\t\t\t\t\tpath: key,\n\t\t\t\t\tmessage: `Invalid schema: expected a Standard Schema 1.0 validator (e.g. Zod, Valibot) in 'standard' mode.`,\n\t\t\t\t},\n\t\t\t]);\n\t\t}\n\n\t\tconst result = (validator as StandardSchemaV1)[\"~standard\"].validate(value);\n\n\t\tif (result instanceof Promise) {\n\t\t\tthrow new ArkEnvError([\n\t\t\t\t{\n\t\t\t\t\tpath: key,\n\t\t\t\t\tmessage: \"Async validation is not supported. ArkEnv is synchronous.\",\n\t\t\t\t},\n\t\t\t]);\n\t\t}\n\n\t\tif (result.issues) {\n\t\t\tfor (const issue of result.issues) {\n\t\t\t\tconst issuePath =\n\t\t\t\t\tissue.path && issue.path.length > 0\n\t\t\t\t\t\t? `${key}.${issue.path\n\t\t\t\t\t\t\t\t.map((segment) =>\n\t\t\t\t\t\t\t\t\tsegment !== null &&\n\t\t\t\t\t\t\t\t\ttypeof segment === \"object\" &&\n\t\t\t\t\t\t\t\t\t\"key\" in segment\n\t\t\t\t\t\t\t\t\t\t? String(segment.key)\n\t\t\t\t\t\t\t\t\t\t: String(segment),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t.join(\".\")}`\n\t\t\t\t\t\t: key;\n\t\t\t\terrors.push({\n\t\t\t\t\tpath: issuePath,\n\t\t\t\t\tmessage: issue.message,\n\t\t\t\t});\n\t\t\t}\n\t\t} else {\n\t\t\toutput[key] = result.value;\n\t\t}\n\n\t\tenvKeys.delete(key);\n\t}\n\n\t// 2. Handle undeclared keys\n\tif (onUndeclaredKey !== \"delete\") {\n\t\tfor (const key of envKeys) {\n\t\t\tif (onUndeclaredKey === \"reject\") {\n\t\t\t\terrors.push({\n\t\t\t\t\tpath: key,\n\t\t\t\t\tmessage: \"Undeclared key\",\n\t\t\t\t});\n\t\t\t} else if (onUndeclaredKey === \"ignore\") {\n\t\t\t\toutput[key] = env[key];\n\t\t\t}\n\t\t}\n\t}\n\n\tif (errors.length > 0) {\n\t\tthrow new ArkEnvError(errors);\n\t}\n\n\treturn output;\n}\n","import type { StandardSchemaV1 } from \"@repo/types\";\nimport {\n\tassertNotArkTypeDsl,\n\tassertStandardSchema,\n\tassertStandardSchemaMap,\n} from \"./guards\";\nimport { type ParseStandardConfig, parseStandard } from \"./parse-standard\";\n\n/**\n * Configuration options for the `arkenv/standard` entry's `createEnv`.\n */\nexport type StandardEnvConfig = ParseStandardConfig;\n\n/**\n * Parse and validate environment variables using Standard Schema 1.0 validators (e.g. Zod, Valibot).\n *\n * This entry is ArkType-free - ArkType is never imported, even transitively.\n * Use this when your project must not depend on ArkType.\n *\n * @param def - An object mapping variable names to Standard Schema validators\n * @param config - Optional configuration\n * @returns The validated environment variables\n * @throws An {@link ArkEnvError} if validation fails\n *\n * @example\n * ```ts\n * import arkenv from \"arkenv/standard\";\n * import { z } from \"zod\";\n *\n * const env = arkenv({\n * PORT: z.coerce.number(),\n * HOST: z.string(),\n * });\n * ```\n */\nexport function createEnv<const T extends Record<string, StandardSchemaV1>>(\n\tdef: T,\n\tconfig?: StandardEnvConfig,\n): { [K in keyof T]: StandardSchemaV1.InferOutput<T[K]> } {\n\tassertStandardSchemaMap(def);\n\n\tfor (const key in def) {\n\t\tconst validator = (def as Record<string, unknown>)[key];\n\t\tassertNotArkTypeDsl(key, validator);\n\t\tassertStandardSchema(key, validator);\n\t}\n\n\treturn parseStandard(def as Record<string, unknown>, config ?? {}) as {\n\t\t[K in keyof T]: StandardSchemaV1.InferOutput<T[K]>;\n\t};\n}\n\n/**\n * ArkEnv's Standard Schema 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;\n"],"mappings":"wCAMA,SAAgB,EAAoB,EAAa,EAAsB,CACtE,GAAI,OAAO,GAAU,SACpB,MAAM,IAAI,EAAY,CACrB,CACC,KAAM,EACN,QACC,8JACD,CACD,CAAC,CASJ,SAAgB,EAAqB,EAAa,EAAsB,CACvE,IAAM,EACL,GACA,OAAO,GAAU,UACjB,cAAe,GACd,EAAkC,aAEpC,GACC,CAAC,GACD,OAAO,GAAQ,UACf,EAAE,aAAc,IAChB,OAAQ,EAAgC,UAAa,WAErD,MAAM,IAAI,EAAY,CACrB,CACC,KAAM,EACN,QACC,6IACD,CACD,CAAC,CAQJ,SAAgB,EACf,EACyC,CACzC,GAAI,CAAC,GAAO,OAAO,GAAQ,UAAY,MAAM,QAAQ,EAAI,CACxD,MAAM,IAAI,EAAY,CACrB,CACC,KAAM,GACN,QACC,iEACD,CACD,CAAC,CC3BJ,SAAgB,EACf,EACA,EACC,CACD,GAAM,CAAE,MAAM,QAAQ,IAAK,kBAAkB,UAAa,EACpD,EAAkC,EAAE,CACpC,EAA4B,EAAE,CAC9B,EAAU,IAAI,IAAI,OAAO,KAAK,EAAI,CAAC,CAGzC,IAAK,IAAM,KAAO,EAAK,CACtB,IAAM,EAAY,EAAI,GAChB,EAAQ,EAAI,GAGlB,GACC,CAAC,GACD,OAAO,GAAc,UACrB,EAAE,cAAe,GAEjB,MAAM,IAAI,EAAY,CACrB,CACC,KAAM,EACN,QAAS,mGACT,CACD,CAAC,CAGH,IAAM,EAAU,EAA+B,aAAa,SAAS,EAAM,CAE3E,GAAI,aAAkB,QACrB,MAAM,IAAI,EAAY,CACrB,CACC,KAAM,EACN,QAAS,4DACT,CACD,CAAC,CAGH,GAAI,EAAO,OACV,IAAK,IAAM,KAAS,EAAO,OAAQ,CAClC,IAAM,EACL,EAAM,MAAQ,EAAM,KAAK,OAAS,EAC/B,GAAG,EAAI,GAAG,EAAM,KACf,IAAK,GAEL,OAAO,GAAY,UADnB,GAEA,QAAS,EACN,OAAO,EAAQ,IAAI,CACnB,OAAO,EAAQ,CAClB,CACA,KAAK,IAAI,GACV,EACJ,EAAO,KAAK,CACX,KAAM,EACN,QAAS,EAAM,QACf,CAAC,MAGH,EAAO,GAAO,EAAO,MAGtB,EAAQ,OAAO,EAAI,CAIpB,GAAI,IAAoB,aAClB,IAAM,KAAO,EACb,IAAoB,SACvB,EAAO,KAAK,CACX,KAAM,EACN,QAAS,iBACT,CAAC,CACQ,IAAoB,WAC9B,EAAO,GAAO,EAAI,IAKrB,GAAI,EAAO,OAAS,EACnB,MAAM,IAAI,EAAY,EAAO,CAG9B,OAAO,ECjFR,SAAgB,EACf,EACA,EACyD,CACzD,EAAwB,EAAI,CAE5B,IAAK,IAAM,KAAO,EAAK,CACtB,IAAM,EAAa,EAAgC,GACnD,EAAoB,EAAK,EAAU,CACnC,EAAqB,EAAK,EAAU,CAGrC,OAAO,EAAc,EAAgC,GAAU,EAAE,CAAC,CAUnE,MAAM,EAAS"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "arkenv",
3
3
  "type": "module",
4
- "version": "0.11.0",
4
+ "version": "0.11.1",
5
5
  "description": "Typesafe environment variables parsing and validation with ArkType",
6
6
  "main": "./dist/index.cjs",
7
7
  "module": "./dist/index.mjs",
@@ -52,15 +52,17 @@
52
52
  "bugs": "https://github.com/yamcodes/arkenv/labels/arkenv",
53
53
  "author": "Yam Borodetsky <yam@yam.codes>",
54
54
  "devDependencies": {
55
- "@size-limit/esbuild-why": "12.0.0",
56
- "@size-limit/preset-small-lib": "12.0.0",
57
- "@types/node": "24.10.9",
58
- "arktype": "2.1.29",
59
- "rimraf": "6.1.2",
60
- "size-limit": "12.0.0",
61
- "tsdown": "0.19.0",
62
- "typescript": "5.9.3",
63
- "vitest": "4.0.17",
55
+ "@ark/attest": "0.56.0",
56
+ "@size-limit/esbuild-why": "12.1.0",
57
+ "@size-limit/preset-small-lib": "12.1.0",
58
+ "@types/node": "24.12.2",
59
+ "arktype": "2.2.0",
60
+ "rimraf": "6.1.3",
61
+ "size-limit": "12.1.0",
62
+ "tsdown": "0.21.10",
63
+ "typescript": "6.0.3",
64
+ "vitest": "4.1.5",
65
+ "zod": "4.4.1",
64
66
  "@repo/scope": "0.1.3",
65
67
  "@repo/types": "0.1.0"
66
68
  },
@@ -97,11 +99,12 @@
97
99
  ],
98
100
  "scripts": {
99
101
  "build": "tsdown",
100
- "size": "size-limit",
101
- "test:once": "pnpm test",
102
+ "size": "size-limit --json > .size-limit.json",
103
+ "test:once": "vitest run",
102
104
  "typecheck": "tsc --noEmit",
103
105
  "clean": "rimraf dist node_modules",
104
106
  "test": "vitest",
107
+ "test:types": "vitest run --typecheck.only",
105
108
  "fix": "pnpm -w run fix"
106
109
  }
107
110
  }