Releases: yamcodes/arkenv
[email protected]
Patch Changes
-
Add declaration maps for better IDE experience
#36017c970f@yamcodesEnable TypeScript declaration maps so that when you use "Go to Definition" in your IDE, it navigates directly to the original source code instead of the generated type definition files. This makes it easier to explore and understand how the packages work.
[email protected]
Patch Changes
-
Enable minification to reduce bundle size
#3367236cb2@yamcodesEnable minification in build output. Reduces bundle size from 711 B to 708 B. Comments are removed from the bundle but remain in source files.
-
Fix browser compatibility by replacing
util.styleTextwith cross-platform ANSI codes#290bf465de@yamcodesReplace Node.js
util.styleTextwith cross-platform ANSI color codes to fix the "Module 'node:util' has been externalized for browser compatibility" error in browser environments. The library still maintains zero dependencies!Changes:
- Replaced
node:util.styleTextwith custom ANSI implementation - Added environment detection (uses ANSI in Node, plain text in browsers)
- Respects
NO_COLOR,CIenvironment variables, and TTY detection - Organized utilities into
lib/folder with comprehensive tests
// No longer throws "node:util has been externalized" error import { createEnv } from "arkenv"; const env = createEnv({ VITE_API_URL: "string", VITE_PORT: "number.port", });
- Replaced
@arkenv/[email protected]
Patch Changes
-
Add declaration maps for better IDE experience
#36017c970f@yamcodesEnable TypeScript declaration maps so that when you use "Go to Definition" in your IDE, it navigates directly to the original source code instead of the generated type definition files. This makes it easier to explore and understand how the packages work.
-
Enable minification to reduce bundle size
#35367003ee@yamcodesEnable minification in build output. Comments are removed from the bundle but remain in source files.
@arkenv/[email protected]
Patch Changes
@arkenv/[email protected]
Patch Changes
-
Support array defaults using
type().default()syntax#224ecf9b64@yamcodesFix to an issue where
type("array[]").default(() => [...])syntax was not accepted by the plugin due to overly restrictive type constraints. The plugin now accepts any string-keyed record while still maintaining type safety through ArkType's validation system.New Features
- Array defaults to empty using
type("string[]").default(() => [])syntax - Support for complex array types with defaults
- Mixed schemas combining string-based and type-based defaults
Example
// vite.config.ts import arkenv from "@arkenv/vite-plugin"; import { type } from "arkenv"; export default defineConfig({ plugins: [ arkenv({ ALLOWED_ORIGINS: type("string[]").default(() => ["localhost"]), FEATURE_FLAGS: type("string[]").default(() => []), PORT: "number.port", }), ], });
[!NOTE]
This is the same fix as in[email protected](the core library), but for the Vite plugin. - Array defaults to empty using
-
Fix
import.meta.envnot respecting morphed environment variables#227d41878f@yamcodesThe Vite plugin now properly exposes transformed environment variables through
import.meta.env.Previously, type transformations (
string → number,string → boolean) and default values were lost because the plugin only calledcreateEnv()without integrating the results with Vite's environment system.Now the plugin uses Vite's
defineoption to expose the morphed values, ensuring all schema transformations are respected.
[email protected]
Patch Changes
-
Automatic boolean string conversion
#218e554e2b@yamcodesThe
booleantype now accepts"true"/"false"strings from environment variables and converts them to actual boolean values. This also works with boolean defaults.Example:
import arkenv from "arkenv"; const env = arkenv({ DEBUG: "boolean", ENABLE_FEATURE: "boolean = true", }); console.log(env.DEBUG); console.log(env.ENABLE_FEATURE);
Result:
❯ DEBUG=true npx tsx index.ts true true
@arkenv/[email protected]
Patch Changes
[email protected]
Patch Changes
-
Support array defaults using type().default() syntax
#199e50dba1@copilot-swe-agentFix to an issue where
type("array[]").default(() => [...])syntax was not accepted bycreateEnvdue to overly restrictive type constraints. The function now accepts any string-keyed record while still maintaining type safety through ArkType's validation system.New Features
- Array defaults to empty using
type("string[]").default(() => [])syntax - Support for complex array types with defaults
- Mixed schemas combining string-based and type-based defaults
Example
const env = arkenv({ ALLOWED_ORIGINS: type("string[]").default(() => ["localhost"]), FEATURE_FLAGS: type("string[]").default(() => []), PORT: "number.port", });
- Array defaults to empty using