arkenv 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,80 +2,41 @@
2
2
  <a href="https://github.com/yamcodes/arkenv/blob/main/apps/www/public/assets/icon.svg"><img alt="ArkEnv Logo" src="https://arkenv.js.org/assets/icon.svg" width="160px" align="center"/></a>
3
3
  <h1 align="center">ArkEnv</h1>
4
4
  <div align="center">
5
- <p align="center">Environment variable validation from editor to runtime</p>
5
+ <p align="center">
6
+ Environment variable validation from editor to runtime<br/> for <a href="https://nextjs.org/">Next.js</a>, <a href="https://nodejs.org/">Node.js</a>, <a href="https://vite.dev/">Vite</a>, and <a href="https://bun.com/">Bun</a>
7
+ </p>
6
8
  <a href="https://github.com/yamcodes/arkenv/actions/workflows/test.yml?query=branch%3Amain"><img alt="Test Status" src="https://github.com/yamcodes/arkenv/actions/workflows/tests-badge.yml/badge.svg?branch=main"></a>
7
9
  <a href="https://bundlephobia.com/package/arkenv"><img alt="npm bundle size" src="https://img.shields.io/bundlephobia/minzip/arkenv"></a>
8
- <a href="https://www.typescriptlang.org/"><img alt="TypeScript" src="https://img.shields.io/badge/TypeScript-3178C6?style=flat&logo=typescript&logoColor=white"></a>
9
- <a href="https://arktype.io/"><img alt="Powered By ArkType" src="https://custom-icon-badges.demolab.com/badge/ArkType-0d1526?logo=arktype2&logoColor=e9eef9"></a>
10
- <a href="https://nodejs.org/en"><img alt="Node.js" src="https://img.shields.io/badge/Node.js-339933?style=flat&logo=node.js&logoColor=white"></a>
11
- <a href="https://bun.com/"><img alt="Bun" src="https://img.shields.io/badge/Bun-14151a?logo=bun&logoColor=fbf0df"></a>
12
- <a href="https://vite.dev/"><img alt="Vite" src="https://custom-icon-badges.demolab.com/badge/Vite-2e2742?logo=vite2&logoColor=dfdfd6"></a>
13
- <a href="https://discord.gg/zAmUyuxXH9"><img alt="Chat on Discord" src="https://img.shields.io/discord/957797212103016458?label=Chat&color=5865f4&logo=discord&labelColor=121214"></a>
10
+ <a href="https://arktype.io/docs/ecosystem#arkenv"><img alt="ArkType Ecosystem" src="https://custom-icon-badges.demolab.com/badge/ArkType%20Ecosystem-0d1526?logo=arktype2&logoColor=e9eef9"></a>
11
+ <a href="https://pullfrog.com"><img alt="Pullfrog" src="https://custom-icon-badges.demolab.com/badge/Powered%20by%20Pullfrog-2f4032?logo=pullfrog-white"></a>
14
12
  </div>
15
13
  </p>
16
- <h3 align="center">Proud part of the <a href="https://arktype.io/docs/ecosystem#arkenv">ArkType ecosystem</a></h3>
14
+
15
+ <div align="center">
16
+ <a href="https://arkenv.js.org/docs/arkenv">Docs</a>
17
+ <span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
18
+ <a href="https://arkenv.js.org/docs/arkenv/faq">FAQ</a>
19
+ <span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
20
+ <a href="https://stackblitz.com/github/yamcodes/arkenv/tree/main/examples/stackblitz?file=index.ts">Try on StackBlitz</a>
21
+ <br />
22
+ </div>
23
+
24
+ <br />
25
+ <br />
17
26
 
18
27
  <p align="center">
19
28
  <img alt="ArkEnv Demo" src="https://arkenv.js.org/assets/demo.gif" />
20
29
  </p>
21
30
 
22
- <br/>
23
- <br/>
24
- <br/>
25
-
26
- ### [Read the docs →](https://arkenv.js.org/docs/arkenv)
27
-
28
- <br/>
29
- <br/>
30
-
31
- ## What is ArkEnv?
32
-
33
- ArkEnv is an environment variable validator for modern JavaScript runtimes. It creates a ready-to-use, typesafe environment variable object:
31
+ <br />
34
32
 
35
- ```ts
36
- import arkenv from "arkenv";
37
33
 
38
- const env = arkenv({
39
- HOST: "string.ip | 'localhost'",
40
- PORT: "0 <= number.integer <= 65535",
41
- NODE_ENV: "'development' | 'production' | 'test' = 'development'",
42
- DEBUGGING: "boolean = false",
43
- });
44
- ```
45
-
46
- > ArkEnv defaults to [ArkType](https://arktype.io/) notation, the closest match to TypeScript syntax for editor-to-runtime typesafety. You can also use any [Standard Schema](https://standardschema.dev/schema) validator, including Zod, Valibot, and Typia.
47
-
48
- With ArkEnv, your environment variables are **guaranteed to match your schema**. If any variable is incorrect or missing, the app won't start and a clear error will be thrown:
49
-
50
- ```bash title="Terminal"
51
- ❯ PORT=hello npm start
52
-
53
- ArkEnvError: Errors found while validating environment variables
54
- HOST must be a string or "localhost" (was missing)
55
- PORT must be a number (was a string)
56
- ```
57
-
58
- ## Features
59
-
60
- * Zero external dependencies
61
- * Works in Node.js, Bun, and Vite
62
- * Tiny: <3kB gzipped
63
- * Build-time / runtime validation with editor autocomplete & type hints
64
- * Single import, zero config for most projects
65
- * Optional variables and default values
66
- * Intuitive automatic coercion
67
- * Compatible with any Standard Schema validator (Zod, Valibot, etc.)
68
- * Native support for ArkType, TypeScript's 1\:1 validator
69
-
70
- > See how ArkEnv compares to alternatives like T3 Env, znv, and envalid in the [comparison cheatsheet](https://arkenv.js.org/docs/arkenv/comparison#comparison-cheatsheet).
71
-
72
- ## Installation
73
34
 
74
35
  <details open>
75
36
  <summary>npm</summary>
76
37
 
77
38
  ```sh
78
- npm install arkenv arktype
39
+ npx @arkenv/cli@latest init
79
40
  ```
80
41
 
81
42
  </details>
@@ -84,7 +45,7 @@ npm install arkenv arktype
84
45
  <summary>pnpm</summary>
85
46
 
86
47
  ```sh
87
- pnpm add arkenv arktype
48
+ pnx @arkenv/cli@latest init
88
49
  ```
89
50
 
90
51
  </details>
@@ -93,7 +54,7 @@ pnpm add arkenv arktype
93
54
  <summary>Yarn</summary>
94
55
 
95
56
  ```sh
96
- yarn add arkenv arktype
57
+ yarn dlx @arkenv/cli@latest init
97
58
  ```
98
59
 
99
60
  </details>
@@ -102,40 +63,22 @@ yarn add arkenv arktype
102
63
  <summary>Bun</summary>
103
64
 
104
65
  ```sh
105
- bun add arkenv arktype
66
+ bunx @arkenv/cli@latest init
106
67
  ```
107
68
 
108
69
  </details>
109
70
 
110
- :rocket: **Let's get started!** Read the [2-minute setup guide](https://arkenv.js.org/docs/quickstart) or [start with an example](https://arkenv.js.org/docs/examples).
111
-
112
- > Improve your DX with _syntax highlighting_ in [VS Code](https://arkenv.js.org/docs/arkenv/integrations/api/vscode), [Cursor, Antigravity](https://arkenv.js.org/docs/arkenv/integrations/api/open-vsx), and [JetBrains IDEs](https://arkenv.js.org/docs/arkenv/integrations/api/jetbrains).
113
-
114
- ## Requirements
115
-
116
- ArkEnv is tested on [**Node.js LTS** and **Current**](https://github.com/yamcodes/arkenv/tree/main/examples/basic), [**Bun 1.3.2**](https://github.com/yamcodes/arkenv/tree/main/examples/with-bun), and [**Vite** from **2.9.18** to **7.x**](https://github.com/yamcodes/arkenv/tree/main/examples/with-vite-react). Older versions may work but are not officially supported.
117
-
118
- ### TypeScript requirements
119
-
120
- - [**Modern TypeScript module resolution**](https://www.typescriptlang.org/tsconfig/#moduleResolution). One of the following is required in your `tsconfig.json`:
121
- - `"moduleResolution": "bundler"` - Recommended for modern bundlers (Vite, Next.js, etc.). Supplied by default when using `"module": "Preserve"` (Introduced in TypeScript v5.4).
122
- - `"moduleResolution": "node16"` or `"nodenext"` - For Node.js projects. Supplied by default when using a matching `"module"` value.
123
- - **TypeScript >= 5.1** and [anything else required by ArkType](https://arktype.io/docs/intro/setup#installation)
124
-
125
- > While TypeScript is the recommended setup, ArkEnv works with plain JavaScript. See the [basic-js](https://github.com/yamcodes/arkenv/tree/main/examples/basic-js) example for details and tradeoffs.
126
-
127
- ## Plugins
71
+ <br />
128
72
 
129
- Beyond [the core package](https://arkenv.js.org/docs/arkenv), we also provide plugins for frameworks that require a specific implementation to adhere to best practices.
73
+ ### [Read the docs ](https://arkenv.js.org/docs/ArkEnv/quickstart)
130
74
 
131
- - [@arkenv/vite-plugin](https://arkenv.js.org/docs/vite-plugin)
132
- - [@arkenv/bun-plugin](https://arkenv.js.org/docs/bun-plugin)
75
+ <br />
133
76
 
134
77
  ## Supporting ArkEnv
135
78
 
136
79
  If you love ArkEnv, you can support the project by **starring it on GitHub**!
137
80
 
138
- You are also welcome to [contribute to the project](https://github.com/yamcodes/arkenv/blob/main/CONTRIBUTING.md) and join the wonderful people who have contributed:
81
+ You are also welcome to [contribute to the project](https://github.com/yamcodes/arkenv/blob/main/docs/CONTRIBUTING.md) and join the wonderful people who have contributed:
139
82
 
140
83
  <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
141
84
  <!-- prettier-ignore-start -->
@@ -148,6 +91,7 @@ You are also welcome to [contribute to the project](https://github.com/yamcodes/
148
91
  <td align="center" valign="top" width="14.28%"><a href="https://arktype.io"><img src="https://avatars.githubusercontent.com/u/10645823?v=4?s=100" width="100px;" alt="David Blass"/><br /><sub><b>David Blass</b></sub></a><br /><a href="#ideas-ssalbdivad" title="Ideas, Planning, & Feedback">🤔</a> <a href="#mentoring-ssalbdivad" title="Mentoring">🧑‍🏫</a> <a href="#question-ssalbdivad" title="Answering Questions">💬</a></td>
149
92
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/danciudev"><img src="https://avatars.githubusercontent.com/u/44430251?v=4?s=100" width="100px;" alt="Andrei Danciu"/><br /><sub><b>Andrei Danciu</b></sub></a><br /><a href="https://github.com/yamcodes/arkenv/commits?author=danciudev" title="Code">💻</a></td>
150
93
  <td align="center" valign="top" width="14.28%"><a href="https://joakim.beng.se"><img src="https://avatars.githubusercontent.com/u/1427383?v=4?s=100" width="100px;" alt="Joakim Carlstein"/><br /><sub><b>Joakim Carlstein</b></sub></a><br /><a href="https://github.com/yamcodes/arkenv/commits?author=joakimbeng" title="Code">💻</a> <a href="https://github.com/yamcodes/arkenv/commits?author=joakimbeng" title="Documentation">📖</a></td>
94
+ <td align="center" valign="top" width="14.28%"><a href="https://fresh-accordion-06a.notion.site/Jiayi-Du-1817075e92978076b95cf9d90fb5eceb"><img src="https://avatars.githubusercontent.com/u/166608075?v=4?s=100" width="100px;" alt="RoomWithOutRoof"/><br /><sub><b>RoomWithOutRoof</b></sub></a><br /><a href="https://github.com/yamcodes/arkenv/commits?author=Jah-yee" title="Documentation">📖</a></td>
151
95
  </tr>
152
96
  </tbody>
153
97
  </table>
@@ -157,4 +101,4 @@ You are also welcome to [contribute to the project](https://github.com/yamcodes/
157
101
 
158
102
  <!-- ALL-CONTRIBUTORS-LIST:END -->
159
103
 
160
- ## [Acknowledgements](https://github.com/yamcodes/arkenv/blob/main/ACKNOWLEDGEMENTS.md)
104
+ We [acknowledge](https://github.com/yamcodes/arkenv/blob/main/docs/ACKNOWLEDGEMENTS.md) the various projects and people that inspired ArkEnv.
@@ -3,4 +3,4 @@ const e=(e,t=2,{dontDetectNewlines:n=!1}={})=>n?`${` `.repeat(t)}${e}`:e.split(`
3
3
  `),t={red:`\x1B[31m`,yellow:`\x1B[33m`,cyan:`\x1B[36m`,reset:`\x1B[0m`},n=()=>typeof process<`u`&&process.versions!=null&&process.versions.node!=null,r=()=>!!(!n()||process.env.NO_COLOR!==void 0||process.env.CI!==void 0||process.stdout&&!process.stdout.isTTY),i=(e,i)=>n()&&!r()?`${t[e]}${i}${t.reset}`:i,a=e=>e.map(e=>`${i(`yellow`,e.path)} ${e.message.trimStart()}`).join(`
4
4
  `);var o=class extends Error{constructor(t,n=`Errors found while validating environment variables`){let r=a(t);super(`${i(`red`,n)}\n${e(r)}\n`),this.name=`ArkEnvError`}};Object.defineProperty(o,`name`,{value:`ArkEnvError`});export{a as n,i as r,o as t};
5
5
 
6
- //# sourceMappingURL=core-DzT5rjcY.mjs.map
6
+ //# sourceMappingURL=core-B51xxxje.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"core-DzT5rjcY.mjs","names":[],"sources":["../src/utils/indent.ts","../src/utils/style-text.ts","../src/core.ts"],"sourcesContent":["/**\n * Options for the `indent` function\n */\ntype IndentOptions = {\n\t/**\n\t * Whether to detect newlines and indent each line individually, defaults to false (indenting the whole string)\n\t */\n\tdontDetectNewlines?: boolean;\n};\n\n/**\n * Indent a string by a given amount\n * @param str - The string to indent\n * @param amt - The amount to indent by, defaults to 2\n * @param options - {@link IndentOptions}\n * @returns The indented string\n */\nexport const indent = (\n\tstr: string,\n\tamt = 2,\n\t{ dontDetectNewlines = false }: IndentOptions = {},\n) => {\n\tconst detectNewlines = !dontDetectNewlines;\n\tif (detectNewlines) {\n\t\treturn str\n\t\t\t.split(\"\\n\")\n\t\t\t.map((line) => `${\" \".repeat(amt)}${line}`)\n\t\t\t.join(\"\\n\");\n\t}\n\n\treturn `${\" \".repeat(amt)}${str}`;\n};\n","/**\n * Cross-platform text styling utility\n * Uses ANSI colors in Node environments, plain text in browsers\n * Respects NO_COLOR, CI environment variables, and TTY detection\n */\n\n// ANSI color codes for Node environments\nconst colors = {\n\tred: \"\\x1b[31m\",\n\tyellow: \"\\x1b[33m\",\n\tcyan: \"\\x1b[36m\",\n\treset: \"\\x1b[0m\",\n} as const;\n\n/**\n * Check if we're in a Node environment (not browser)\n * Checked dynamically to allow for testing with mocked globals\n */\nconst isNode = (): boolean =>\n\ttypeof process !== \"undefined\" &&\n\tprocess.versions != null &&\n\tprocess.versions.node != null;\n\n/**\n * Check if colors should be disabled based on environment\n * Respects NO_COLOR, CI environment variables, and TTY detection\n */\nconst shouldDisableColors = (): boolean => {\n\tif (!isNode()) return true;\n\n\t// Respect NO_COLOR environment variable (https://no-color.org/)\n\tif (process.env.NO_COLOR !== undefined) return true;\n\n\t// Disable colors in CI environments by default\n\tif (process.env.CI !== undefined) return true;\n\n\t// Disable colors if not writing to a TTY\n\tif (process.stdout && !process.stdout.isTTY) return true;\n\n\treturn false;\n};\n\n/**\n * Style text with color. Uses ANSI codes in Node, plain text in browsers.\n * @param color - The color to apply\n * @param text - The text to style\n * @returns Styled text in Node (if colors enabled), plain text otherwise\n */\nexport const styleText = (\n\tcolor: \"red\" | \"yellow\" | \"cyan\",\n\ttext: string,\n): string => {\n\t// Use ANSI colors only in Node environments with colors enabled\n\tif (isNode() && !shouldDisableColors()) {\n\t\treturn `${colors[color]}${text}${colors.reset}`;\n\t}\n\t// Fall back to plain text in browsers or when colors are disabled\n\treturn text;\n};\n","import { indent } from \"./utils/indent.ts\";\nimport { styleText } from \"./utils/style-text.ts\";\n\n/**\n * A single validation issue produced during environment variable parsing.\n * Used by {@link ArkEnvError} to report which key failed and why.\n */\nexport type ValidationIssue = {\n\tpath: string;\n\tmessage: string;\n};\n\nexport const formatInternalErrors = (errors: ValidationIssue[]): string =>\n\terrors\n\t\t.map(\n\t\t\t(error) =>\n\t\t\t\t`${styleText(\"yellow\", error.path)} ${error.message.trimStart()}`,\n\t\t)\n\t\t.join(\"\\n\");\n\n/**\n * Error thrown when environment variable validation fails.\n *\n * This error extends the native `Error` class and provides formatted error messages\n * that clearly indicate which environment variables are invalid and why.\n *\n * @example\n * ```ts\n * import arkenv from 'arkenv';\n * import { ArkEnvError } from 'arkenv/core';\n *\n * try {\n * const env = arkenv({\n * PORT: 'number.port',\n * HOST: 'string.host',\n * });\n * } catch (error) {\n * if (error instanceof ArkEnvError) {\n * console.error('Environment validation failed:', error.message);\n * }\n * }\n * ```\n */\nexport class ArkEnvError extends Error {\n\tconstructor(\n\t\terrors: ValidationIssue[],\n\t\tmessage = \"Errors found while validating environment variables\",\n\t) {\n\t\tconst formattedErrors = formatInternalErrors(errors);\n\t\tsuper(`${styleText(\"red\", message)}\\n${indent(formattedErrors)}\\n`);\n\t\tthis.name = \"ArkEnvError\";\n\t}\n}\n\nObject.defineProperty(ArkEnvError, \"name\", { value: \"ArkEnvError\" });\n"],"mappings":"AAiBA,MAAa,GACZ,EACA,EAAM,EACN,CAAE,qBAAqB,IAAyB,EAAE,GAE1B,EAQjB,GAAG,IAAI,OAAO,EAAI,GAAG,IANpB,EACL,MAAM;EAAK,CACX,IAAK,GAAS,GAAG,IAAI,OAAO,EAAI,GAAG,IAAO,CAC1C,KAAK;EAAK,CCpBR,EAAS,CACd,IAAK,WACL,OAAQ,WACR,KAAM,WACN,MAAO,UACP,CAMK,MACL,OAAO,QAAY,KACnB,QAAQ,UAAY,MACpB,QAAQ,SAAS,MAAQ,KAMpB,MAUL,GATI,CAAC,GAAQ,EAGT,QAAQ,IAAI,WAAa,IAAA,IAGzB,QAAQ,IAAI,KAAO,IAAA,IAGnB,QAAQ,QAAU,CAAC,QAAQ,OAAO,OAW1B,GACZ,EACA,IAGI,GAAQ,EAAI,CAAC,GAAqB,CAC9B,GAAG,EAAO,KAAS,IAAO,EAAO,QAGlC,EC7CK,EAAwB,GACpC,EACE,IACC,GACA,GAAG,EAAU,SAAU,EAAM,KAAK,CAAC,GAAG,EAAM,QAAQ,WAAW,GAChE,CACA,KAAK;EAAK,CAyBb,IAAa,EAAb,cAAiC,KAAM,CACtC,YACC,EACA,EAAU,sDACT,CACD,IAAM,EAAkB,EAAqB,EAAO,CACpD,MAAM,GAAG,EAAU,MAAO,EAAQ,CAAC,IAAI,EAAO,EAAgB,CAAC,IAAI,CACnE,KAAK,KAAO,gBAId,OAAO,eAAe,EAAa,OAAQ,CAAE,MAAO,cAAe,CAAC"}
1
+ {"version":3,"file":"core-B51xxxje.mjs","names":[],"sources":["../src/utils/indent.ts","../src/utils/style-text.ts","../src/core.ts"],"sourcesContent":["/**\n * Options for the `indent` function\n */\ntype IndentOptions = {\n\t/**\n\t * Whether to detect newlines and indent each line individually, defaults to false (indenting the whole string)\n\t */\n\tdontDetectNewlines?: boolean;\n};\n\n/**\n * Indent a string by a given amount\n * @param str - The string to indent\n * @param amt - The amount to indent by, defaults to 2\n * @param options - {@link IndentOptions}\n * @returns The indented string\n */\nexport const indent = (\n\tstr: string,\n\tamt = 2,\n\t{ dontDetectNewlines = false }: IndentOptions = {},\n) => {\n\tconst detectNewlines = !dontDetectNewlines;\n\tif (detectNewlines) {\n\t\treturn str\n\t\t\t.split(\"\\n\")\n\t\t\t.map((line) => `${\" \".repeat(amt)}${line}`)\n\t\t\t.join(\"\\n\");\n\t}\n\n\treturn `${\" \".repeat(amt)}${str}`;\n};\n","/**\n * Cross-platform text styling utility\n * Uses ANSI colors in Node environments, plain text in browsers\n * Respects NO_COLOR, CI environment variables, and TTY detection\n */\n\n// ANSI color codes for Node environments\nconst colors = {\n\tred: \"\\x1b[31m\",\n\tyellow: \"\\x1b[33m\",\n\tcyan: \"\\x1b[36m\",\n\treset: \"\\x1b[0m\",\n} as const;\n\n/**\n * Check if we're in a Node environment (not browser)\n * Checked dynamically to allow for testing with mocked globals\n */\nconst isNode = (): boolean =>\n\ttypeof process !== \"undefined\" &&\n\tprocess.versions != null &&\n\tprocess.versions.node != null;\n\n/**\n * Check if colors should be disabled based on environment\n * Respects NO_COLOR, CI environment variables, and TTY detection\n */\nconst shouldDisableColors = (): boolean => {\n\tif (!isNode()) return true;\n\n\t// Respect NO_COLOR environment variable (https://no-color.org/)\n\tif (process.env.NO_COLOR !== undefined) return true;\n\n\t// Disable colors in CI environments by default\n\tif (process.env.CI !== undefined) return true;\n\n\t// Disable colors if not writing to a TTY\n\tif (process.stdout && !process.stdout.isTTY) return true;\n\n\treturn false;\n};\n\n/**\n * Style text with color. Uses ANSI codes in Node, plain text in browsers.\n * @param color - The color to apply\n * @param text - The text to style\n * @returns Styled text in Node (if colors enabled), plain text otherwise\n */\nexport const styleText = (\n\tcolor: \"red\" | \"yellow\" | \"cyan\",\n\ttext: string,\n): string => {\n\t// Use ANSI colors only in Node environments with colors enabled\n\tif (isNode() && !shouldDisableColors()) {\n\t\treturn `${colors[color]}${text}${colors.reset}`;\n\t}\n\t// Fall back to plain text in browsers or when colors are disabled\n\treturn text;\n};\n","import { indent } from \"./utils/indent\";\nimport { styleText } from \"./utils/style-text\";\n\n/**\n * A single validation issue produced during environment variable parsing.\n * Used by {@link ArkEnvError} to report which key failed and why.\n */\nexport type ValidationIssue = {\n\tpath: string;\n\tmessage: string;\n};\n\nexport const formatInternalErrors = (errors: ValidationIssue[]): string =>\n\terrors\n\t\t.map(\n\t\t\t(error) =>\n\t\t\t\t`${styleText(\"yellow\", error.path)} ${error.message.trimStart()}`,\n\t\t)\n\t\t.join(\"\\n\");\n\n/**\n * Error thrown when environment variable validation fails.\n *\n * This error extends the native `Error` class and provides formatted error messages\n * that clearly indicate which environment variables are invalid and why.\n *\n * @example\n * ```ts\n * import arkenv from 'arkenv';\n * import { ArkEnvError } from 'arkenv/core';\n *\n * try {\n * const env = arkenv({\n * PORT: 'number.port',\n * HOST: 'string.host',\n * });\n * } catch (error) {\n * if (error instanceof ArkEnvError) {\n * console.error('Environment validation failed:', error.message);\n * }\n * }\n * ```\n */\nexport class ArkEnvError extends Error {\n\tconstructor(\n\t\terrors: ValidationIssue[],\n\t\tmessage = \"Errors found while validating environment variables\",\n\t) {\n\t\tconst formattedErrors = formatInternalErrors(errors);\n\t\tsuper(`${styleText(\"red\", message)}\\n${indent(formattedErrors)}\\n`);\n\t\tthis.name = \"ArkEnvError\";\n\t}\n}\n\nObject.defineProperty(ArkEnvError, \"name\", { value: \"ArkEnvError\" });\n"],"mappings":"AAiBA,MAAa,GACZ,EACA,EAAM,EACN,CAAE,qBAAqB,IAAyB,EAAE,GAE1B,EAQjB,GAAG,IAAI,OAAO,EAAI,GAAG,IANpB,EACL,MAAM;EAAK,CACX,IAAK,GAAS,GAAG,IAAI,OAAO,EAAI,GAAG,IAAO,CAC1C,KAAK;EAAK,CCpBR,EAAS,CACd,IAAK,WACL,OAAQ,WACR,KAAM,WACN,MAAO,UACP,CAMK,MACL,OAAO,QAAY,KACnB,QAAQ,UAAY,MACpB,QAAQ,SAAS,MAAQ,KAMpB,MAUL,GATI,CAAC,GAAQ,EAGT,QAAQ,IAAI,WAAa,IAAA,IAGzB,QAAQ,IAAI,KAAO,IAAA,IAGnB,QAAQ,QAAU,CAAC,QAAQ,OAAO,OAW1B,GACZ,EACA,IAGI,GAAQ,EAAI,CAAC,GAAqB,CAC9B,GAAG,EAAO,KAAS,IAAO,EAAO,QAGlC,EC7CK,EAAwB,GACpC,EACE,IACC,GACA,GAAG,EAAU,SAAU,EAAM,KAAK,CAAC,GAAG,EAAM,QAAQ,WAAW,GAChE,CACA,KAAK;EAAK,CAyBb,IAAa,EAAb,cAAiC,KAAM,CACtC,YACC,EACA,EAAU,sDACT,CACD,IAAM,EAAkB,EAAqB,EAAO,CACpD,MAAM,GAAG,EAAU,MAAO,EAAQ,CAAC,IAAI,EAAO,EAAgB,CAAC,IAAI,CACnE,KAAK,KAAO,gBAId,OAAO,eAAe,EAAa,OAAQ,CAAE,MAAO,cAAe,CAAC"}
package/dist/core.cjs CHANGED
@@ -1,4 +1,4 @@
1
- const e=require(`./core-Byznlywt.cjs`);exports.ArkEnvError=e.t,exports.formatInternalErrors=e.n;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./core-Byznlywt.cjs`);exports.ArkEnvError=e.t,exports.formatInternalErrors=e.n;
2
2
 
3
3
  // CJS Interop Shim
4
4
  if (module.exports && module.exports.default) {
@@ -1 +1 @@
1
- {"version":3,"file":"core.d.cts","names":[],"sources":["../src/core.ts"],"sourcesContent":[],"mappings":";;AAOA;AAKA;AA+BA;KApCY,eAAA;;;;cAKC,+BAAgC;;;;;;;;;;;;;;;;;;;;;;;;cA+BhC,WAAA,SAAoB,KAAA;sBAEvB"}
1
+ {"version":3,"file":"core.d.cts","names":[],"sources":["../src/core.ts"],"mappings":";;AAOA;;;KAAY,eAAA;EACX,IAAA;EACA,OAAA;AAAA;AAAA,cAGY,oBAAA,GAAwB,MAAA,EAAQ,eAAA;;;AA+B7C;;;;;;;;;;;;;;;;;;;;;cAAa,WAAA,SAAoB,KAAA;cAE/B,MAAA,EAAQ,eAAA,IACR,OAAA;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"core.d.mts","names":[],"sources":["../src/core.ts"],"sourcesContent":[],"mappings":";;AAOA;AAKA;AA+BA;KApCY,eAAA;;;;cAKC,+BAAgC;;;;;;;;;;;;;;;;;;;;;;;;cA+BhC,WAAA,SAAoB,KAAA;sBAEvB"}
1
+ {"version":3,"file":"core.d.mts","names":[],"sources":["../src/core.ts"],"mappings":";;AAOA;;;KAAY,eAAA;EACX,IAAA;EACA,OAAA;AAAA;AAAA,cAGY,oBAAA,GAAwB,MAAA,EAAQ,eAAA;;;AA+B7C;;;;;;;;;;;;;;;;;;;;;cAAa,WAAA,SAAoB,KAAA;cAE/B,MAAA,EAAQ,eAAA,IACR,OAAA;AAAA"}
package/dist/core.mjs CHANGED
@@ -1 +1 @@
1
- import{n as e,t}from"./core-DzT5rjcY.mjs";export{t as ArkEnvError,e as formatInternalErrors};
1
+ import{n as e,t}from"./core-B51xxxje.mjs";export{t as ArkEnvError,e as formatInternalErrors};
@@ -1,76 +1,75 @@
1
- import * as arktype0 from "arktype";
1
+ import * as _$arktype from "arktype";
2
2
  import { Type, type } from "arktype";
3
- import * as arktype_internal_keywords_string_ts0 from "arktype/internal/keywords/string.ts";
4
- import * as arktype_internal_attributes_ts0 from "arktype/internal/attributes.ts";
3
+ import * as _$arktype_internal_keywords_string_ts0 from "arktype/internal/keywords/string.ts";
4
+ import * as _$arktype_internal_attributes_ts0 from "arktype/internal/attributes.ts";
5
5
 
6
6
  //#region ../internal/scope/dist/index.d.ts
7
-
8
7
  //#region src/root.d.ts
9
8
  /**
10
9
  * The root scope for the ArkEnv library,
11
10
  * containing extensions to the ArkType scopes with ArkEnv-specific types
12
11
  * like `string.host` and `number.port`.
13
12
  */
14
- declare const $: arktype0.Scope<{
15
- string: arktype0.Submodule<{
16
- trim: arktype0.Submodule<arktype_internal_keywords_string_ts0.trim.$ & {
17
- " arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
13
+ declare const $: _$arktype.Scope<{
14
+ string: _$arktype.Submodule<{
15
+ trim: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.trim.$ & {
16
+ " arkInferred": (In: string) => _$arktype_internal_attributes_ts0.To<string>;
18
17
  }>;
19
- normalize: arktype0.Submodule<arktype_internal_keywords_string_ts0.normalize.$ & {
20
- " arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
18
+ normalize: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.normalize.$ & {
19
+ " arkInferred": (In: string) => _$arktype_internal_attributes_ts0.To<string>;
21
20
  }>;
22
21
  root: string;
23
22
  alpha: string;
24
23
  alphanumeric: string;
25
24
  hex: string;
26
- base64: arktype0.Submodule<{
25
+ base64: _$arktype.Submodule<{
27
26
  root: string;
28
27
  url: string;
29
28
  } & {
30
29
  " arkInferred": string;
31
30
  }>;
32
- capitalize: arktype0.Submodule<arktype_internal_keywords_string_ts0.capitalize.$ & {
33
- " arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
31
+ capitalize: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.capitalize.$ & {
32
+ " arkInferred": (In: string) => _$arktype_internal_attributes_ts0.To<string>;
34
33
  }>;
35
34
  creditCard: string;
36
- date: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringDate.$ & {
35
+ date: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.stringDate.$ & {
37
36
  " arkInferred": string;
38
37
  }>;
39
38
  digits: string;
40
39
  email: string;
41
- integer: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringInteger.$ & {
40
+ integer: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.stringInteger.$ & {
42
41
  " arkInferred": string;
43
42
  }>;
44
- ip: arktype0.Submodule<arktype_internal_keywords_string_ts0.ip.$ & {
43
+ ip: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.ip.$ & {
45
44
  " arkInferred": string;
46
45
  }>;
47
- json: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringJson.$ & {
46
+ json: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.stringJson.$ & {
48
47
  " arkInferred": string;
49
48
  }>;
50
- lower: arktype0.Submodule<arktype_internal_keywords_string_ts0.lower.$ & {
51
- " arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
49
+ lower: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.lower.$ & {
50
+ " arkInferred": (In: string) => _$arktype_internal_attributes_ts0.To<string>;
52
51
  }>;
53
- numeric: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringNumeric.$ & {
52
+ numeric: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.stringNumeric.$ & {
54
53
  " arkInferred": string;
55
54
  }>;
56
55
  regex: string;
57
56
  semver: string;
58
- upper: arktype0.Submodule<{
59
- root: (In: string) => arktype_internal_attributes_ts0.To<string>;
57
+ upper: _$arktype.Submodule<{
58
+ root: (In: string) => _$arktype_internal_attributes_ts0.To<string>;
60
59
  preformatted: string;
61
60
  } & {
62
- " arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
61
+ " arkInferred": (In: string) => _$arktype_internal_attributes_ts0.To<string>;
63
62
  }>;
64
- url: arktype0.Submodule<arktype_internal_keywords_string_ts0.url.$ & {
63
+ url: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.url.$ & {
65
64
  " arkInferred": string;
66
65
  }>;
67
- uuid: arktype0.Submodule<arktype_internal_keywords_string_ts0.uuid.$ & {
66
+ uuid: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.uuid.$ & {
68
67
  " arkInferred": string;
69
68
  }>;
70
69
  " arkInferred": string;
71
70
  host: string;
72
71
  }>;
73
- number: arktype0.Submodule<{
72
+ number: _$arktype.Submodule<{
74
73
  NaN: number;
75
74
  Infinity: number;
76
75
  root: number;
@@ -82,8 +81,7 @@ declare const $: arktype0.Scope<{
82
81
  port: number;
83
82
  }>;
84
83
  }>;
85
- type $ = (typeof $)["t"];
86
- //#endregion
84
+ type $ = (typeof $)["t"]; //#endregion
87
85
  //#endregion
88
86
  //#region ../internal/types/dist/helpers.d.ts
89
87
  type Dict<T> = Record<string, T | undefined>;
@@ -203,4 +201,4 @@ type CompiledEnvSchema = Type<SchemaShape, $>;
203
201
  //#endregion
204
202
  export { Dict as a, StandardSchemaV1 as i, SchemaShape as n, $ as o, InferType as r, CompiledEnvSchema as t };
205
203
 
206
- //# sourceMappingURL=index-Cic20SzT.d.mts.map
204
+ //# sourceMappingURL=index-Br22fqkz.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-Br22fqkz.d.mts","names":["_$arktype","_$arktype_internal_keywords_string_ts0","_$arktype_internal_attributes_ts0","$","trim","To","Submodule","normalize","capitalize","stringDate","stringInteger","ip","stringJson","lower","stringNumeric","url","uuid","Scope","string","In","root","alpha","alphanumeric","hex","base64","creditCard","date","digits","email","integer","json","numeric","regex","semver","upper","preformatted","host","number","NaN","Infinity","epoch","safe","NegativeInfinity","port","Dict","T","Record","StandardTypedV1","Input","Output","Props","Schema","Types","NonNullable","version","vendor","types","input","output","InferInput","InferOutput","StandardSchemaV1","Options","Result","Promise","SuccessResult","FailureResult","Record","Issue","ReadonlyArray","PropertyKey","PathSegment","validate","value","options","issues","libraryOptions","message","path","key","StandardJSONSchemaV1","Converter","Target","jsonSchema","target","type","StandardSchemaV1","InferType","T","Record","errors","Any","_Input","Output","value","R","t","U","_Scope","$","Type","SchemaShape","Record","CompiledEnvSchema"],"sources":["../../internal/scope/dist/index.d.ts","../../internal/types/dist/helpers.d.ts","../../internal/types/dist/standard-schema.d.ts","../../internal/types/dist/infer-type.d.ts","../../internal/types/dist/schema.d.ts"],"mappings":";;;;;;;;AAEoF;;;;cAQtEG,CAAAA,EAAGH,SAAAA,CAAUiB,KAAAA;EACzBC,MAAAA,EAAQlB,SAAAA,CAAUM,SAAAA;IAChBF,IAAAA,EAAMJ,SAAAA,CAAUM,SAAAA,CAAUL,sCAAAA,CAAuCG,IAAAA,CAAKD,CAAAA;MACpE,cAAA,GAAiBgB,EAAAA,aAAejB,iCAAAA,CAAkCG,EAAAA;IAAAA;IAEpEE,SAAAA,EAAWP,SAAAA,CAAUM,SAAAA,CAAUL,sCAAAA,CAAuCM,SAAAA,CAAUJ,CAAAA;MAC9E,cAAA,GAAiBgB,EAAAA,aAAejB,iCAAAA,CAAkCG,EAAAA;IAAAA;IAEpEe,IAAAA;IACAC,KAAAA;IACAC,YAAAA;IACAC,GAAAA;IACAC,MAAAA,EAAQxB,SAAAA,CAAUM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AAAA,KEoDKoD,WAAAA,gBAA2Bb,eAAAA,IAAmBA,eAAAA,CAAgBa,WAAAA,CAAYT,MAAAA;AAAAA;;;;;;;AF9EC;;;;;KGSxEoC,SAAAA,MAAeC,CAAAA,SAAUF,gBAAAA,+BAA+CO,MAAAA,GAASL,CAAAA,WAAWM,KAAAA,EAAOL,MAAAA,4CAAiDM,CAAAA,SAAUV,IAAAA,CAAKK,MAAAA,WAAiBK,CAAAA,GAAIP,CAAAA;EAChMQ,CAAAA;AAAAA,IACAC,CAAAA,GAAIT,CAAAA,SAAUH,IAAAA,CAAKM,GAAAA,0BAA6BM,CAAAA;;;KCXxCI,WAAAA,GAAcC,MAAAA;;;;AJA0D;;;;;;;;;KIaxEC,iBAAAA,GAAoBH,IAAAA,CAAKC,WAAAA,EAAaF,CAAAA"}
@@ -1,76 +1,75 @@
1
- import * as arktype_internal_keywords_string_ts0 from "arktype/internal/keywords/string.ts";
2
- import * as arktype_internal_attributes_ts0 from "arktype/internal/attributes.ts";
3
- import * as arktype0 from "arktype";
1
+ import * as _$arktype_internal_keywords_string_ts0 from "arktype/internal/keywords/string.ts";
2
+ import * as _$arktype_internal_attributes_ts0 from "arktype/internal/attributes.ts";
3
+ import * as _$arktype from "arktype";
4
4
  import { Type, type } from "arktype";
5
5
 
6
6
  //#region ../internal/scope/dist/index.d.ts
7
-
8
7
  //#region src/root.d.ts
9
8
  /**
10
9
  * The root scope for the ArkEnv library,
11
10
  * containing extensions to the ArkType scopes with ArkEnv-specific types
12
11
  * like `string.host` and `number.port`.
13
12
  */
14
- declare const $: arktype0.Scope<{
15
- string: arktype0.Submodule<{
16
- trim: arktype0.Submodule<arktype_internal_keywords_string_ts0.trim.$ & {
17
- " arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
13
+ declare const $: _$arktype.Scope<{
14
+ string: _$arktype.Submodule<{
15
+ trim: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.trim.$ & {
16
+ " arkInferred": (In: string) => _$arktype_internal_attributes_ts0.To<string>;
18
17
  }>;
19
- normalize: arktype0.Submodule<arktype_internal_keywords_string_ts0.normalize.$ & {
20
- " arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
18
+ normalize: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.normalize.$ & {
19
+ " arkInferred": (In: string) => _$arktype_internal_attributes_ts0.To<string>;
21
20
  }>;
22
21
  root: string;
23
22
  alpha: string;
24
23
  alphanumeric: string;
25
24
  hex: string;
26
- base64: arktype0.Submodule<{
25
+ base64: _$arktype.Submodule<{
27
26
  root: string;
28
27
  url: string;
29
28
  } & {
30
29
  " arkInferred": string;
31
30
  }>;
32
- capitalize: arktype0.Submodule<arktype_internal_keywords_string_ts0.capitalize.$ & {
33
- " arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
31
+ capitalize: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.capitalize.$ & {
32
+ " arkInferred": (In: string) => _$arktype_internal_attributes_ts0.To<string>;
34
33
  }>;
35
34
  creditCard: string;
36
- date: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringDate.$ & {
35
+ date: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.stringDate.$ & {
37
36
  " arkInferred": string;
38
37
  }>;
39
38
  digits: string;
40
39
  email: string;
41
- integer: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringInteger.$ & {
40
+ integer: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.stringInteger.$ & {
42
41
  " arkInferred": string;
43
42
  }>;
44
- ip: arktype0.Submodule<arktype_internal_keywords_string_ts0.ip.$ & {
43
+ ip: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.ip.$ & {
45
44
  " arkInferred": string;
46
45
  }>;
47
- json: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringJson.$ & {
46
+ json: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.stringJson.$ & {
48
47
  " arkInferred": string;
49
48
  }>;
50
- lower: arktype0.Submodule<arktype_internal_keywords_string_ts0.lower.$ & {
51
- " arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
49
+ lower: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.lower.$ & {
50
+ " arkInferred": (In: string) => _$arktype_internal_attributes_ts0.To<string>;
52
51
  }>;
53
- numeric: arktype0.Submodule<arktype_internal_keywords_string_ts0.stringNumeric.$ & {
52
+ numeric: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.stringNumeric.$ & {
54
53
  " arkInferred": string;
55
54
  }>;
56
55
  regex: string;
57
56
  semver: string;
58
- upper: arktype0.Submodule<{
59
- root: (In: string) => arktype_internal_attributes_ts0.To<string>;
57
+ upper: _$arktype.Submodule<{
58
+ root: (In: string) => _$arktype_internal_attributes_ts0.To<string>;
60
59
  preformatted: string;
61
60
  } & {
62
- " arkInferred": (In: string) => arktype_internal_attributes_ts0.To<string>;
61
+ " arkInferred": (In: string) => _$arktype_internal_attributes_ts0.To<string>;
63
62
  }>;
64
- url: arktype0.Submodule<arktype_internal_keywords_string_ts0.url.$ & {
63
+ url: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.url.$ & {
65
64
  " arkInferred": string;
66
65
  }>;
67
- uuid: arktype0.Submodule<arktype_internal_keywords_string_ts0.uuid.$ & {
66
+ uuid: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.uuid.$ & {
68
67
  " arkInferred": string;
69
68
  }>;
70
69
  " arkInferred": string;
71
70
  host: string;
72
71
  }>;
73
- number: arktype0.Submodule<{
72
+ number: _$arktype.Submodule<{
74
73
  NaN: number;
75
74
  Infinity: number;
76
75
  root: number;
@@ -82,8 +81,7 @@ declare const $: arktype0.Scope<{
82
81
  port: number;
83
82
  }>;
84
83
  }>;
85
- type $ = (typeof $)["t"];
86
- //#endregion
84
+ type $ = (typeof $)["t"]; //#endregion
87
85
  //#endregion
88
86
  //#region ../internal/types/dist/helpers.d.ts
89
87
  type Dict<T> = Record<string, T | undefined>;
@@ -209,4 +207,4 @@ if (module.exports && module.exports.default) {
209
207
  module.exports = module.exports.default;
210
208
  }
211
209
 
212
- //# sourceMappingURL=index-bSO6Cmhi.d.cts.map
210
+ //# sourceMappingURL=index-CzNfOanV.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-CzNfOanV.d.cts","names":["_$arktype","_$arktype_internal_keywords_string_ts0","_$arktype_internal_attributes_ts0","$","trim","To","Submodule","normalize","capitalize","stringDate","stringInteger","ip","stringJson","lower","stringNumeric","url","uuid","Scope","string","In","root","alpha","alphanumeric","hex","base64","creditCard","date","digits","email","integer","json","numeric","regex","semver","upper","preformatted","host","number","NaN","Infinity","epoch","safe","NegativeInfinity","port","Dict","T","Record","StandardTypedV1","Input","Output","Props","Schema","Types","NonNullable","version","vendor","types","input","output","InferInput","InferOutput","StandardSchemaV1","Options","Result","Promise","SuccessResult","FailureResult","Record","Issue","ReadonlyArray","PropertyKey","PathSegment","validate","value","options","issues","libraryOptions","message","path","key","StandardJSONSchemaV1","Converter","Target","jsonSchema","target","type","StandardSchemaV1","InferType","T","Record","errors","Any","_Input","Output","value","R","t","U","_Scope","$","Type","SchemaShape","Record","CompiledEnvSchema"],"sources":["../../internal/scope/dist/index.d.ts","../../internal/types/dist/helpers.d.ts","../../internal/types/dist/standard-schema.d.ts","../../internal/types/dist/infer-type.d.ts","../../internal/types/dist/schema.d.ts"],"mappings":";;;;;;;;AAEoF;;;;cAQtEG,CAAAA,EAAGH,SAAAA,CAAUiB,KAAAA;EACzBC,MAAAA,EAAQlB,SAAAA,CAAUM,SAAAA;IAChBF,IAAAA,EAAMJ,SAAAA,CAAUM,SAAAA,CAAUL,sCAAAA,CAAuCG,IAAAA,CAAKD,CAAAA;MACpE,cAAA,GAAiBgB,EAAAA,aAAejB,iCAAAA,CAAkCG,EAAAA;IAAAA;IAEpEE,SAAAA,EAAWP,SAAAA,CAAUM,SAAAA,CAAUL,sCAAAA,CAAuCM,SAAAA,CAAUJ,CAAAA;MAC9E,cAAA,GAAiBgB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MJ,KAAAA,EAAOC,MAAAA;EFnDpFlC;EAAAA,KEsDG4C,UAAAA,gBAA0BZ,eAAAA,IAAmBA,eAAAA,CAAgBY,UAAAA,CAAWR,MAAAA;EFlD7E3C;EAAAA,KEoDKoD,WAAAA,gBAA2Bb,eAAAA,IAAmBA,eAAAA,CAAgBa,WAAAA,CAAYT,MAAAA;AAAAA;;;;;;;AF9EC;;;;;KGSxEoC,SAAAA,MAAeC,CAAAA,SAAUF,gBAAAA,+BAA+CO,MAAAA,GAASL,CAAAA,WAAWM,KAAAA,EAAOL,MAAAA,4CAAiDM,CAAAA,SAAUV,IAAAA,CAAKK,MAAAA,WAAiBK,CAAAA,GAAIP,CAAAA;EAChMQ,CAAAA;AAAAA,IACAC,CAAAA,GAAIT,CAAAA,SAAUH,IAAAA,CAAKM,GAAAA,0BAA6BM,CAAAA;;;KCXxCI,WAAAA,GAAcC,MAAAA;;;;AJA0D;;;;;;;;;KIaxEC,iBAAAA,GAAoBH,IAAAA,CAAKC,WAAAA,EAAaF,CAAAA"}
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports,`__esModule`,{value:!0});const e=require(`./core-Byznlywt.cjs`);let t=require(`arktype`);const n=(0,t.type)(`0 <= number.integer <= 65535`),r=(0,t.type)(`string.ip | 'localhost'`),i=(0,t.scope)({string:t.type.module({...t.type.keywords.string,host:r}),number:t.type.module({...t.type.keywords.number,port:n})}),a=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},o=e=>e===`true`?!0:e===`false`?!1:e,s=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}},c=`*`,l=(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(...l(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(...l(e,[...t,`${r}`]))}):n.push(...l(e.items,[...t,`*`]))));if(`anyOf`in e&&e.anyOf)for(let r of e.anyOf)n.push(...l(r,t));if(`allOf`in e&&e.allOf)for(let r of e.allOf)n.push(...l(r,t));if(`oneOf`in e&&e.oneOf)for(let r of e.oneOf)n.push(...l(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)})},u=(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 s(e);if(n?.type===`array`&&typeof e==`string`)return i(e);let r=a(e);return typeof r==`number`?r:o(e)}return e}let c=[...t].sort((e,t)=>e.path.length-t.path.length),l=(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=a(r);typeof n==`number`?e[t]=n:e[t]=o(r)}else n===`object`&&(e[t]=s(r))}return}let c=e;if(Object.prototype.hasOwnProperty.call(c,r)){let e=c[r];if(n===`array`&&typeof e==`string`){c[r]=i(e);return}if(n===`object`&&typeof e==`string`){c[r]=s(e);return}if(Array.isArray(e)){if(n===`primitive`)for(let t=0;t<e.length;t++){let n=e[t],r=a(n);typeof r==`number`?e[t]=r:e[t]=o(n)}}else if(n===`primitive`){let t=a(e);typeof t==`number`?c[r]=t:c[r]=o(e)}}return}let[r,...c]=t;if(r===`*`){if(Array.isArray(e))for(let t of e)l(t,c,n);return}l(e[r],c,n)};for(let t of c)l(e,t.path,t.type);return e};function d(e,t,n){let r=l(t.in.toJsonSchema({fallback:e=>e.base}));return r.length===0?t:e(`unknown`).pipe(e=>u(e,r,n)).pipe(t)}function f(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.r(`cyan`,t)})`))}return{path:t,message:r}})}function p(n,r){let{env:a=process.env,coerce:o=!0,onUndeclaredKey:s=`delete`,arrayFormat:c=`comma`}=r,l=(typeof n==`function`&&`assert`in n?n:i.type.raw(n)).onUndeclaredKey(s),u=l;o&&(u=d(i.type,l,{arrayFormat:c}));let p=u(a);if(p instanceof t.ArkErrors)throw new e.t(f(p));return p}function m(e,t={}){return p(e,t)}const h=i.type,g=m;var _=g;exports.createEnv=m,exports.default=_,exports.type=h;
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require(`./core-Byznlywt.cjs`),t=require(`./shared-Sfv4WYag.cjs`);let n=require(`arktype`);const r=(0,n.type)(`0 <= number.integer <= 65535`),i=(0,n.type)(`string.ip | 'localhost'`),a=(0,n.scope)({string:n.type.module({...n.type.keywords.string,host:i}),number:n.type.module({...n.type.keywords.number,port:r})});function o(e,n,r){let i=t.n(n.in.toJsonSchema({fallback:e=>e.base}));return i.length===0?n:e(`unknown`).pipe(e=>t.t(e,i,r)).pipe(n)}function s(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.r(`cyan`,t)})`))}return{path:t,message:r}})}function c(t,r){let{env:i=process.env,coerce:c=!0,onUndeclaredKey:l=`delete`,arrayFormat:u=`comma`}=r,d=(typeof t==`function`&&`assert`in t?t:a.type.raw(t)).onUndeclaredKey(l),f=d;c&&(f=o(a.type,d,{arrayFormat:u}));let p=f(i);if(p instanceof n.ArkErrors)throw new e.t(s(p));return p}function l(e,t={}){return c(e,t)}const u=a.type,d=l;exports.createEnv=l,exports.default=d,exports.type=u;
2
2
 
3
3
  // CJS Interop Shim
4
4
  if (module.exports && module.exports.default) {