arkenv 1.0.0-alpha.0 → 1.0.0-alpha.10

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,191 +1 @@
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
- import { distill, type as type$1 } from "arktype";
6
- import * as _$arktype_internal_type_ts0 from "arktype/internal/type.ts";
7
-
8
- //#region src/create-env.d.ts
9
- /**
10
- * Declarative environment schema definition accepted by ArkEnv.
11
- *
12
- * Represents a declarative schema object mapping environment
13
- * variable names to schema definitions (e.g. ArkType DSL strings
14
- * or Standard Schema validators).
15
- *
16
- * This type is used to validate that a schema object is compatible with
17
- * ArkEnv’s validator scope before being compiled or parsed.
18
- *
19
- * Most users will provide schemas in this form.
20
- *
21
- * @template def - The schema shape object
22
- */
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>;
31
- type RuntimeEnvironment = Dict<string>;
32
- /**
33
- * Configuration options for `createEnv`
34
- */
35
- type ArkEnvConfig = {
36
- /**
37
- * The environment variables to parse. Defaults to `process.env`
38
- */
39
- env?: RuntimeEnvironment;
40
- /**
41
- * Whether to coerce environment variables to their defined types. Defaults to `true`
42
- */
43
- coerce?: boolean;
44
- /**
45
- * Control how ArkEnv handles environment variables that are not defined in your schema.
46
- *
47
- * Defaults to `'delete'` to ensure your output object only contains
48
- * keys you've explicitly declared. This differs from ArkType's standard behavior, which
49
- * mirrors TypeScript by defaulting to `'ignore'`.
50
- *
51
- * - `delete` (ArkEnv default): Undeclared keys are allowed on input but stripped from the output.
52
- * - `ignore` (ArkType default): Undeclared keys are allowed and preserved in the output.
53
- * - `reject`: Undeclared keys will cause validation to fail.
54
- *
55
- * @default "delete"
56
- * @see https://arktype.io/docs/configuration#onundeclaredkey
57
- */
58
- onUndeclaredKey?: "ignore" | "delete" | "reject";
59
- /**
60
- * The format to use for array parsing when coercion is enabled.
61
- *
62
- * - `comma` (default): Strings are split by comma and trimmed.
63
- * - `json`: Strings are parsed as JSON.
64
- *
65
- * @default "comma"
66
- */
67
- arrayFormat?: "comma" | "json";
68
- /**
69
- * Whether to treat empty strings (`""`) as `undefined` before validation.
70
- *
71
- * When enabled, an environment variable set to an empty value (e.g. `PORT=`)
72
- * will be treated as if it were missing, allowing defaults to apply and
73
- * preventing validation errors for numeric or boolean types.
74
- *
75
- * @default false
76
- */
77
- emptyAsUndefined?: boolean;
78
- };
79
- /**
80
- * TODO: `SchemaShape` is basically `Record<string, unknown>`.
81
- * If possible, find a better type than "const T extends Record<string, unknown>",
82
- * and be as close as possible to the type accepted by ArkType's `type`.
83
- */
84
- /**
85
- * Utility to parse environment variables using ArkType or Standard Schema
86
- * @param def - The schema definition
87
- * @param config - The evaluation configuration
88
- * @returns The parsed environment variables
89
- * @throws An {@link ArkEnvError | error} if the environment variables are invalid.
90
- */
91
- declare function createEnv<const T extends SchemaShape>(def: EnvSchema<T>, config?: ArkEnvConfig): distill.Out<type$1.infer<T, $>>;
92
- declare function createEnv<T extends CompiledEnvSchema>(def: T, config?: ArkEnvConfig): InferType<T>;
93
- declare function createEnv<const T extends SchemaShape>(def: EnvSchema<T> | CompiledEnvSchema, config?: ArkEnvConfig): distill.Out<type$1.infer<T, $>> | InferType<typeof def>;
94
- //#endregion
95
- //#region src/index.d.ts
96
- /**
97
- * Like ArkType's `type`, but with ArkEnv's extra keywords, such as:
98
- *
99
- * - `string.host` – a hostname (e.g. `"localhost"`, `"127.0.0.1"`)
100
- * - `number.port` – a port number (e.g. `8080`)
101
- *
102
- * See ArkType's docs for the full API:
103
- * https://arktype.io/docs/type-api
104
- */
105
- declare const type: _$arktype_internal_type_ts0.TypeParser<{
106
- string: _$arktype.Submodule<{
107
- trim: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.trim.$ & {
108
- " arkInferred": (In: string) => _$arktype_internal_attributes_ts0.To<string>;
109
- }>;
110
- normalize: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.normalize.$ & {
111
- " arkInferred": (In: string) => _$arktype_internal_attributes_ts0.To<string>;
112
- }>;
113
- root: string;
114
- alpha: string;
115
- alphanumeric: string;
116
- hex: string;
117
- base64: _$arktype.Submodule<{
118
- root: string;
119
- url: string;
120
- } & {
121
- " arkInferred": string;
122
- }>;
123
- capitalize: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.capitalize.$ & {
124
- " arkInferred": (In: string) => _$arktype_internal_attributes_ts0.To<string>;
125
- }>;
126
- creditCard: string;
127
- date: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.stringDate.$ & {
128
- " arkInferred": string;
129
- }>;
130
- digits: string;
131
- email: string;
132
- integer: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.stringInteger.$ & {
133
- " arkInferred": string;
134
- }>;
135
- ip: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.ip.$ & {
136
- " arkInferred": string;
137
- }>;
138
- json: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.stringJson.$ & {
139
- " arkInferred": string;
140
- }>;
141
- lower: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.lower.$ & {
142
- " arkInferred": (In: string) => _$arktype_internal_attributes_ts0.To<string>;
143
- }>;
144
- numeric: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.stringNumeric.$ & {
145
- " arkInferred": string;
146
- }>;
147
- regex: string;
148
- semver: string;
149
- upper: _$arktype.Submodule<{
150
- root: (In: string) => _$arktype_internal_attributes_ts0.To<string>;
151
- preformatted: string;
152
- } & {
153
- " arkInferred": (In: string) => _$arktype_internal_attributes_ts0.To<string>;
154
- }>;
155
- url: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.url.$ & {
156
- " arkInferred": string;
157
- }>;
158
- uuid: _$arktype.Submodule<_$arktype_internal_keywords_string_ts0.uuid.$ & {
159
- " arkInferred": string;
160
- }>;
161
- " arkInferred": string;
162
- host: string;
163
- }>;
164
- number: _$arktype.Submodule<{
165
- NaN: number;
166
- Infinity: number;
167
- root: number;
168
- integer: number;
169
- " arkInferred": number;
170
- epoch: number;
171
- safe: number;
172
- NegativeInfinity: number;
173
- port: number;
174
- }>;
175
- }>;
176
- /**
177
- * ArkEnv's main export, an alias for {@link createEnv}
178
- *
179
- * {@link https://arkenv.js.org | ArkEnv} is a typesafe environment variables validator from editor to runtime.
180
- */
181
- declare const arkenv: typeof createEnv;
182
- //#endregion
183
- export { type ArkEnvConfig, type EnvSchema, type Infer, createEnv, arkenv as default, type };
184
-
185
- // CJS Interop Shim
186
- if (module.exports && module.exports.default) {
187
- Object.assign(module.exports.default, module.exports);
188
- module.exports = module.exports.default;
189
- }
190
-
191
- //# sourceMappingURL=index.d.cts.map
1
+ export { };
package/package.json CHANGED
@@ -1,47 +1,34 @@
1
1
  {
2
2
  "name": "arkenv",
3
3
  "type": "module",
4
- "version": "1.0.0-alpha.0",
5
- "description": "Typesafe environment variables parsing and validation with ArkType",
4
+ "version": "1.0.0-alpha.10",
5
+ "description": "Interactive CLI for scaffolding ArkEnv projects",
6
+ "bin": {
7
+ "arkenv": "./dist/index.cjs"
8
+ },
6
9
  "main": "./dist/index.cjs",
7
- "module": "./dist/index.mjs",
8
- "types": "./dist/index.d.mts",
10
+ "types": "./dist/index.d.ts",
9
11
  "exports": {
10
12
  ".": {
11
- "types": {
12
- "import": "./dist/index.d.mts",
13
- "require": "./dist/index.d.cts"
14
- },
15
- "import": "./dist/index.mjs",
13
+ "types": "./dist/index.d.ts",
14
+ "import": "./dist/index.js",
16
15
  "require": "./dist/index.cjs"
17
16
  },
18
- "./standard": {
19
- "types": {
20
- "import": "./dist/standard.d.mts",
21
- "require": "./dist/standard.d.cts"
22
- },
23
- "import": "./dist/standard.mjs",
24
- "require": "./dist/standard.cjs"
25
- },
26
- "./core": {
27
- "types": {
28
- "import": "./dist/core.d.mts",
29
- "require": "./dist/core.d.cts"
30
- },
31
- "import": "./dist/core.mjs",
32
- "require": "./dist/core.cjs"
33
- }
17
+ "./*": "./dist/*"
34
18
  },
35
19
  "files": [
36
20
  "dist"
37
21
  ],
38
22
  "keywords": [
39
- "pnpm",
40
- "arktype",
41
- "environment",
42
- "variables",
43
- "typesafe",
44
- "validation"
23
+ "arkenv",
24
+ "cli",
25
+ "scaffold",
26
+ "init",
27
+ "create",
28
+ "generator",
29
+ "env",
30
+ "environment-variables",
31
+ "config"
45
32
  ],
46
33
  "license": "MIT",
47
34
  "homepage": "https://arkenv.js.org",
@@ -49,63 +36,31 @@
49
36
  "type": "git",
50
37
  "url": "git+https://github.com/yamcodes/arkenv.git"
51
38
  },
52
- "bugs": "https://github.com/yamcodes/arkenv/labels/arkenv",
39
+ "bugs": "https://github.com/yamcodes/arkenv/labels/arkenv-cli",
53
40
  "author": "Yam Borodetsky <yam@yam.codes>",
41
+ "dependencies": {
42
+ "@clack/prompts": "^1.3.0",
43
+ "dedent": "^1.7.2",
44
+ "jsonc-parser": "^3.3.1",
45
+ "magicast": "^0.5.2",
46
+ "picocolors": "^1.1.1",
47
+ "radashi": "^12.9.1",
48
+ "yaml": "^2.4.5"
49
+ },
54
50
  "devDependencies": {
55
- "@ark/attest": "0.56.0",
56
- "@size-limit/esbuild-why": "12.1.0",
57
- "@size-limit/preset-small-lib": "12.1.0",
58
51
  "@types/node": "24.12.2",
59
- "arktype": "2.2.0",
60
- "rimraf": "6.1.3",
61
- "size-limit": "12.1.0",
62
52
  "tsdown": "0.21.10",
63
53
  "typescript": "6.0.3",
64
54
  "vitest": "4.1.5",
65
- "zod": "4.4.1",
66
- "@repo/scope": "0.1.3",
67
- "@repo/types": "0.1.0"
68
- },
69
- "peerDependencies": {
70
- "arktype": "^2.1.22"
55
+ "@repo/log": "0.0.1",
56
+ "@repo/utils": "0.1.3"
71
57
  },
72
- "peerDependenciesMeta": {
73
- "arktype": {
74
- "optional": true
75
- }
76
- },
77
- "size-limit": [
78
- {
79
- "name": "arkenv",
80
- "path": "dist/index.mjs",
81
- "limit": "2 kB",
82
- "import": "*",
83
- "ignore": [
84
- "arktype"
85
- ]
86
- },
87
- {
88
- "name": "arkenv/standard",
89
- "path": "dist/standard.mjs",
90
- "limit": "2.3 kB",
91
- "import": "*"
92
- },
93
- {
94
- "name": "arkenv/core",
95
- "path": "dist/core.mjs",
96
- "limit": "500 B",
97
- "import": "*"
98
- }
99
- ],
100
58
  "scripts": {
101
59
  "build": "tsdown",
102
- "size": "size-limit --json > .size-limit.json",
103
- "test:once": "vitest run",
104
- "test:dist": "vitest run test/dist.test.ts",
105
- "typecheck": "tsc --noEmit",
106
- "clean": "rimraf dist node_modules",
60
+ "start": "node ./dist/index.cjs init",
61
+ "dev": "tsdown --watch",
107
62
  "test": "vitest",
108
- "test:types": "vitest run --typecheck.only",
109
- "fix": "pnpm -w run fix"
63
+ "test:run": "vitest run",
64
+ "typecheck": "tsc --noEmit"
110
65
  }
111
66
  }
@@ -1,6 +0,0 @@
1
- const e=(e,t=2,{dontDetectNewlines:n=!1}={})=>n?`${` `.repeat(t)}${e}`:e.split(`
2
- `).map(e=>`${` `.repeat(t)}${e}`).join(`
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
- `);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
-
6
- //# sourceMappingURL=core-B0IkKRzg.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"core-B0IkKRzg.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"}
@@ -1,11 +0,0 @@
1
- const e=(e,t=2,{dontDetectNewlines:n=!1}={})=>n?`${` `.repeat(t)}${e}`:e.split(`
2
- `).map(e=>`${` `.repeat(t)}${e}`).join(`
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
- `);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`}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return o}});
5
-
6
- // CJS Interop Shim
7
- if (module.exports && module.exports.default) {
8
- Object.assign(module.exports.default, module.exports);
9
- module.exports = module.exports.default;
10
- }
11
-
package/dist/core.cjs DELETED
@@ -1,8 +0,0 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./core-BftJnV8f.cjs`);exports.ArkEnvError=e.t,exports.formatInternalErrors=e.n;
2
-
3
- // CJS Interop Shim
4
- if (module.exports && module.exports.default) {
5
- Object.assign(module.exports.default, module.exports);
6
- module.exports = module.exports.default;
7
- }
8
-
package/dist/core.d.cts DELETED
@@ -1,46 +0,0 @@
1
- //#region src/core.d.ts
2
- /**
3
- * A single validation issue produced during environment variable parsing.
4
- * Used by {@link ArkEnvError} to report which key failed and why.
5
- */
6
- type ValidationIssue = {
7
- path: string;
8
- message: string;
9
- };
10
- declare const formatInternalErrors: (errors: ValidationIssue[]) => string;
11
- /**
12
- * Error thrown when environment variable validation fails.
13
- *
14
- * This error extends the native `Error` class and provides formatted error messages
15
- * that clearly indicate which environment variables are invalid and why.
16
- *
17
- * @example
18
- * ```ts
19
- * import arkenv from 'arkenv';
20
- * import { ArkEnvError } from 'arkenv/core';
21
- *
22
- * try {
23
- * const env = arkenv({
24
- * PORT: 'number.port',
25
- * HOST: 'string.host',
26
- * });
27
- * } catch (error) {
28
- * if (error instanceof ArkEnvError) {
29
- * console.error('Environment validation failed:', error.message);
30
- * }
31
- * }
32
- * ```
33
- */
34
- declare class ArkEnvError extends Error {
35
- constructor(errors: ValidationIssue[], message?: string);
36
- }
37
- //#endregion
38
- export { ArkEnvError, ValidationIssue, formatInternalErrors };
39
-
40
- // CJS Interop Shim
41
- if (module.exports && module.exports.default) {
42
- Object.assign(module.exports.default, module.exports);
43
- module.exports = module.exports.default;
44
- }
45
-
46
- //# sourceMappingURL=core.d.cts.map
@@ -1 +0,0 @@
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"}
package/dist/core.d.mts DELETED
@@ -1,40 +0,0 @@
1
- //#region src/core.d.ts
2
- /**
3
- * A single validation issue produced during environment variable parsing.
4
- * Used by {@link ArkEnvError} to report which key failed and why.
5
- */
6
- type ValidationIssue = {
7
- path: string;
8
- message: string;
9
- };
10
- declare const formatInternalErrors: (errors: ValidationIssue[]) => string;
11
- /**
12
- * Error thrown when environment variable validation fails.
13
- *
14
- * This error extends the native `Error` class and provides formatted error messages
15
- * that clearly indicate which environment variables are invalid and why.
16
- *
17
- * @example
18
- * ```ts
19
- * import arkenv from 'arkenv';
20
- * import { ArkEnvError } from 'arkenv/core';
21
- *
22
- * try {
23
- * const env = arkenv({
24
- * PORT: 'number.port',
25
- * HOST: 'string.host',
26
- * });
27
- * } catch (error) {
28
- * if (error instanceof ArkEnvError) {
29
- * console.error('Environment validation failed:', error.message);
30
- * }
31
- * }
32
- * ```
33
- */
34
- declare class ArkEnvError extends Error {
35
- constructor(errors: ValidationIssue[], message?: string);
36
- }
37
- //#endregion
38
- export { ArkEnvError, ValidationIssue, formatInternalErrors };
39
-
40
- //# sourceMappingURL=core.d.mts.map
@@ -1 +0,0 @@
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 DELETED
@@ -1 +0,0 @@
1
- import{n as e,t}from"./core-B0IkKRzg.mjs";export{t as ArkEnvError,e as formatInternalErrors};