Releases: yamcodes/arkenv
arkenv@0.8.3
Patch Changes
-
Object coercion
#69401c1704@copilot-swe-agentArkEnv now coerces objects when the
coerceoption is enabled (true by default).
Objects are parsed from JSON strings, allowing for nested typesafe configuration.Example:
DATABASE={"HOST": "localhost", "PORT": "5432"}
const env = arkenv({ DATABASE: { HOST: "string", PORT: "number", }, }); console.log(env.DATABASE.PORT); // 5432 (number)
arkenv@0.8.2
Patch Changes
-
Array coercion
#6937919b6d@yamcodesArkEnv now coerces arrays when the
coerceoption is enabled (true by default).
Arrays are parsed using trimmed, comma-separated values by default.You can customize this behavior with the
arrayFormatoption:comma(default): Strings are split by comma-separated values and trimmed.json: Strings are parsed as JSON.
Example:
MY_ARRAY=one,two,three MY_JSON_ARRAY=["a", "b"]
const env = arkenv( { MY_ARRAY: "string[]", }, { // optional, 'comma' is default arrayFormat: "comma", } ); console.log(env.MY_ARRAY); // ["one", "two", "three"] // Using JSON format const jsonEnv = arkenv( { MY_JSON_ARRAY: "string[]", }, { arrayFormat: "json", } ); console.log(jsonEnv.MY_JSON_ARRAY); // ["a", "b"]
@arkenv/vite-plugin@0.0.26
Patch Changes
@arkenv/vite-plugin@0.0.25
Patch Changes
@arkenv/bun-plugin@0.0.8
Patch Changes
@arkenv/bun-plugin@0.0.7
Patch Changes
@arkenv/vite-plugin@0.0.24
Patch Changes
-
Support Vite's
envDirfor custom env directories#614b5f2781@danciudevThe plugin now internally passes along Vite's
envDirconfig option, allowing users to specify a custom directory for environment files.
arkenv@0.8.1
Patch Changes
-
Strip undeclared keys from output by default
#662d83d746@yamcodesEnvironment variables not defined in your schema are now stripped from the output object by default.
You can customize this behavior using the new
onUndeclaredKeyoption.For example, assuming this is your
.envfile:MY_VAR=hello UNDECLARED_VAR=world
And this is your schema:
const env = arkenv({ MY_VAR: type.string(), }); console.log(env);
Current output:
{ MY_VAR: "hello"; }
Previous output:
{ MY_VAR: "hello", UNDECLARED_VAR: "world" }