Skip to content

Releases: yamcodes/arkenv

[email protected]

10 Nov 19:23
56f434f

Choose a tag to compare

Patch Changes

  • Add declaration maps for better IDE experience #360 17c970f @yamcodes

    Enable 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]

10 Nov 17:45
7aaf234

Choose a tag to compare

Patch Changes

  • Enable minification to reduce bundle size #336 7236cb2 @yamcodes

    Enable 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.styleText with cross-platform ANSI codes #290 bf465de @yamcodes

    Replace Node.js util.styleText with 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.styleText with custom ANSI implementation
    • Added environment detection (uses ANSI in Node, plain text in browsers)
    • Respects NO_COLOR, CI environment 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",
    });

@arkenv/[email protected]

10 Nov 19:23
56f434f

Choose a tag to compare

Patch Changes

  • Add declaration maps for better IDE experience #360 17c970f @yamcodes

    Enable 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 #353 67003ee @yamcodes

    Enable minification in build output. Comments are removed from the bundle but remain in source files.

Updated 1 dependency

17c970f

@arkenv/[email protected]

10 Nov 17:45
7aaf234

Choose a tag to compare

Patch Changes

Updated 1 dependency

7236cb2 bf465de

@arkenv/[email protected]

13 Oct 15:19
0ab77a2

Choose a tag to compare

Patch Changes

  • Support array defaults using type().default() syntax #224 ecf9b64 @yamcodes

    Fix 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.

  • Fix import.meta.env not respecting morphed environment variables #227 d41878f @yamcodes

    The 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 called createEnv() without integrating the results with Vite's environment system.

    Now the plugin uses Vite's define option to expose the morphed values, ensuring all schema transformations are respected.

[email protected]

12 Oct 22:47
e577127

Choose a tag to compare

Patch Changes

  • Automatic boolean string conversion #218 e554e2b @yamcodes

    The boolean type 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]

12 Oct 22:47
e577127

Choose a tag to compare

Patch Changes

  • Support Vite 2.x #212 bfe08f6 @yamcodes

    Extended the supported Vite versions to include 2.9.18 through 7.x (inclusive).

    Also, we've added the vite-plugin keyword to the package.json, and a section in the README.md explaining why this plugin is a Vite only plugin (and not a Rollup plugin).

Updated 1 dependency

e554e2b

[email protected]

06 Oct 14:58
cc7d0ba

Choose a tag to compare

Patch Changes

  • Support array defaults using type().default() syntax #199 e50dba1 @copilot-swe-agent

    Fix to an issue where type("array[]").default(() => [...]) syntax was not accepted by createEnv due 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",
    });

@arkenv/[email protected]

06 Oct 14:58
cc7d0ba

Choose a tag to compare

Patch Changes

Updated 1 dependency

e50dba1

[email protected]

14 Sep 22:05
ebba85b

Choose a tag to compare

Patch Changes

  • Export ArkEnvError #161 221f9ef @yamcodes

    You can now import ArkEnvError from arkenv:

    import { ArkEnvError } from "arkenv";
  • Improve JSDoc #161 221f9ef @yamcodes

    The JSDoc for arkenv and createEnv is now more descriptive.