Remove ArkEnvError export from main entry#815
Conversation
this fixes an issue where createEnv conflicted (since it had the same name) and removed from the bundle completely.
🦋 Changeset detectedLatest commit: 5d4fa3f The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (6)
💤 Files with no reviewable changes (1)
WalkthroughThis PR relocates the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
commit: |
📦 Bundle Size Report
✅ All size limits passed! |
1 similar comment
📦 Bundle Size Report
✅ All size limits passed! |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## arkenv@0.11.0 ### Minor Changes - #### Remove `ArkEnvError` import from "arkenv" _[`#815`](#815) [`5e8025f`](5e8025f) [@yamcodes](https://github.com/yamcodes)_ The `ArkEnvError` class is now only available via: ```ts import { ArkEnvError } from "arkenv/core"; ``` ## @arkenv/bun-plugin@0.1.6 ### Patch Changes <details><summary>Updated 1 dependency</summary> <small> [`5e8025f`](5e8025f) </small> - `arkenv@0.11.0` </details> ## @arkenv/vite-plugin@0.0.32 ### Patch Changes <details><summary>Updated 1 dependency</summary> <small> [`5e8025f`](5e8025f) </small> - `arkenv@0.11.0` </details> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [arkenv](https://arkenv.js.org) ([source](https://redirect.github.com/yamcodes/arkenv)) | [`^0.9.0` → `^0.11.0`](https://renovatebot.com/diffs/npm/arkenv/0.9.3/0.11.0) |  |  | --- ### Release Notes <details> <summary>yamcodes/arkenv (arkenv)</summary> ### [`v0.11.0`](https://redirect.github.com/yamcodes/arkenv/releases/tag/arkenv%400.11.0) [Compare Source](https://redirect.github.com/yamcodes/arkenv/compare/arkenv@0.10.0...arkenv@0.11.0) ##### Minor Changes - #### Remove `ArkEnvError` import from "arkenv" *[`#815`](https://redirect.github.com/yamcodes/arkenv/pull/815) [`5e8025f`](https://redirect.github.com/yamcodes/arkenv/commit/5e8025fd53e5637cd326848f6e0e0d3a20fc1a8b) [@​yamcodes](https://redirect.github.com/yamcodes)* The `ArkEnvError` class is now only available via: ```ts import { ArkEnvError } from "arkenv/core"; ``` ### [`v0.10.0`](https://redirect.github.com/yamcodes/arkenv/releases/tag/arkenv%400.10.0) [Compare Source](https://redirect.github.com/yamcodes/arkenv/compare/arkenv@0.9.3...arkenv@0.10.0) ##### Minor Changes - #### `arkenv/standard` import *[`#806`](https://redirect.github.com/yamcodes/arkenv/pull/806) [`f9010d0`](https://redirect.github.com/yamcodes/arkenv/commit/f9010d00c3f05dbd9862e4aeafab099a9dea4d25) [@​yamcodes](https://redirect.github.com/yamcodes)* `arkenv` now ships three separate entry points: - **`arkenv`** (main): ArkType-first. Includes `createEnv` (aliased to `arkenv` default import), `type`, and `ArkEnvError`. Importing from this entry requires you to have ArkType installed. - **`arkenv/standard`**: ArkType-free. A standalone `createEnv` (aliased to `arkenv` default import) for Standard Schema validators (Zod, Valibot, etc.), not requiring ArkType. - **`arkenv/core`**: Mode-agnostic primitives - `ArkEnvError` and `ValidationIssue`. ##### Breaking changes ```` **1. `validator: "standard"` option removed; `arkenv` now statically requires ArkType.** The `validator` config option has been removed - ArkType is now always required when importing from `arkenv`. For a zero-ArkType bundle, use `arkenv/standard`: ```ts // ❌ Before import arkenv from "arkenv"; import { z } from "zod"; const env = arkenv({ PORT: z.coerce.number() }, { validator: "standard" }); // ✅ After import arkenv from "arkenv/standard"; import { z } from "zod"; const env = arkenv({ PORT: z.coerce.number() }); ``` **2. `type` moved from `arkenv/arktype` to `arkenv`.** The `type` helper is now exported from the main entry. The `arkenv/arktype` sub-path is no longer public: ```ts // ❌ Before import { type } from "arkenv/arktype"; // ✅ After import { type } from "arkenv"; // 'type' is the ArkEnv helper, not a TS type modifier ``` ```` </details> --- ### Configuration 📅 **Schedule**: Branch creation - "on friday" in timezone Asia/Almaty, Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/yamcodes/arkenv). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My42Ni40IiwidXBkYXRlZEluVmVyIjoiNDMuNjYuNCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
##### [v0.12.2](https://github.com/yamcodes/arkenv/releases/tag/arkenv%400.12.2) ##### Patch Changes - #### Expose `getSchemaKeys` helper *[`#1191`](yamcodes/arkenv#1191) [`a3e32db`](yamcodes/arkenv@a3e32db) [@yamcodes](https://github.com/yamcodes)* Expose `getSchemaKeys` helper and widen `RuntimeEnvironment` type to support typed framework runtime configurations. - #### Handle pre-parsed primitives gracefully in coercion logic *[`#1206`](yamcodes/arkenv#1206) [`12ed4f3`](yamcodes/arkenv@12ed4f3) [@yamcodes](https://github.com/yamcodes)* Updated the core coercion logic to defensively skip values that are not strings. This ensures ArkEnv won't crash or behave unpredictably when passed configuration objects that have already been parsed into numbers, booleans, or complex objects by other systems (such as Nuxt's `runtimeConfig`). - #### Fix coercion to prevent in-place mutation of environment config objects *[`#1206`](yamcodes/arkenv#1206) [`12ed4f3`](yamcodes/arkenv@12ed4f3) [@yamcodes](https://github.com/yamcodes)* Refactor `applyCoercion` to perform non-mutating updates on environment configuration data. Clone objects and arrays along the validation path instead of modifying them in-place, preventing runtime crashes on frozen configuration objects (e.g., framework runtime configurations) and avoiding side-effects on reusable config objects. Usage: ```ts import { createEnv } from "arkenv"; const env = createEnv( { DATABASE: { port: "number" } }, { env: { DATABASE: Object.freeze({ port: "3000" }) } } // Frozen object is now safely parsed without crashes! ); ``` ##### [v0.12.1](https://github.com/yamcodes/arkenv/releases/tag/arkenv%400.12.1) ##### Patch Changes - #### Add `emptyAsUndefined` option to treat empty env values as missing *[`#1188`](yamcodes/arkenv#1188) [`3bfbcb7`](yamcodes/arkenv@3bfbcb7) [@yamcodes](https://github.com/yamcodes)* Add a new `emptyAsUndefined` configuration option to both `createEnv` (ArkType mode) and `arkenv/standard` (Standard Schema mode). When enabled, environment variables set to empty strings (e.g., `PORT=` in a `.env` file) are treated as if they were missing, allowing defaults to apply and preventing unnecessary validation errors for numeric, boolean, or array types. **Usage:** ```ts import arkenv from "arkenv"; const env = arkenv( { PORT: "number = 3000", DEBUG: "boolean = false" }, { emptyAsUndefined: true } ); // Given PORT= and DEBUG= in the environment: // env.PORT → 3000 // env.DEBUG → false ``` ```ts import arkenv from "arkenv/standard"; import { z } from "zod"; const env = arkenv( { PORT: z.coerce.number().default(3000) }, { emptyAsUndefined: true } ); ``` - The default behavior remains unchanged (`emptyAsUndefined: false`). - Keys with empty values are removed from the input record before validation so that ArkType defaults and optional types work correctly. ##### [v0.12.0](https://github.com/yamcodes/arkenv/releases/tag/arkenv%400.12.0) ##### Minor Changes - #### Add Standard JSON Schema coercion to `arkenv/standard` *[`#1154`](yamcodes/arkenv#1154) [`88b0eee`](yamcodes/arkenv@88b0eee) [@yamcodes](https://github.com/yamcodes)* Introduce opt-out type coercion for standard mode (`arkenv/standard`). This coercion only works if the validator is a standard JSON Schema compliant validator (e.g., Zod, Valibot, or custom schemas that implement the `StandardJSONSchemaV1` interface). This automatically enables coercion for environment variables without relying on ArkType's runtime footprint. If you need to disable coercion, explicitly pass `{ coerce: false }` in your configuration: ```ts import arkenv from "arkenv/standard"; import { z } from "zod"; const env = arkenv({ PORT: z.number() }, { coerce: false }); ``` BREAKING CHANGE: Coercion is now enabled by default in `arkenv/standard`. This will automatically coerce environment variables to their expected types (e.g., strings containing numbers, booleans, or dates will be converted to their respective types) based on the JSON Schema of your validators. It's unlikely to affect you unless you were relying on validation failing for uncoerced string inputs, or have custom schemas that expect raw strings instead of coerced values. ##### [v0.11.1](https://github.com/yamcodes/arkenv/releases/tag/arkenv%400.11.1) ##### Patch Changes - #### Add `Infer<T>` helper to resolve environment variable types *[`#1092`](yamcodes/arkenv#1092) [`c6c30ab`](yamcodes/arkenv@c6c30ab) [@yamcodes](https://github.com/yamcodes)* Introduce the `Infer<T>` type helper, allowing developers to extract the inferred output types of their environment schemas. It supports both declarative schema shapes and compiled schemas (like Zod or ArkType types). Usage: ```ts import { createEnv, type Infer } from "arkenv"; import { type } from "arktype"; const schema = { PORT: type.number, }; export type Env = Infer<typeof schema>; ``` ##### [v0.11.0](https://github.com/yamcodes/arkenv/releases/tag/arkenv%400.11.0) ##### Minor Changes - #### Remove `ArkEnvError` import from "arkenv" *[`#815`](yamcodes/arkenv#815) [`5e8025f`](yamcodes/arkenv@5e8025f) [@yamcodes](https://github.com/yamcodes)* The `ArkEnvError` class is now only available via: ```ts import { ArkEnvError } from "arkenv/core"; ``` ##### [v0.10.0](https://github.com/yamcodes/arkenv/releases/tag/arkenv%400.10.0) ##### Minor Changes - #### `arkenv/standard` import *[`#806`](yamcodes/arkenv#806) [`f9010d0`](yamcodes/arkenv@f9010d0) [@yamcodes](https://github.com/yamcodes)* `arkenv` now ships three separate entry points: - **`arkenv`** (main): ArkType-first. Includes `createEnv` (aliased to `arkenv` default import), `type`, and `ArkEnvError`. Importing from this entry requires you to have ArkType installed. - **`arkenv/standard`**: ArkType-free. A standalone `createEnv` (aliased to `arkenv` default import) for Standard Schema validators (Zod, Valibot, etc.), not requiring ArkType. - **`arkenv/core`**: Mode-agnostic primitives - `ArkEnvError` and `ValidationIssue`. ##### Breaking changes ```` **1. `validator: "standard"` option removed; `arkenv` now statically requires ArkType.** The `validator` config option has been removed - ArkType is now always required when importing from `arkenv`. For a zero-ArkType bundle, use `arkenv/standard`: ```ts // ❌ Before import arkenv from "arkenv"; import { z } from "zod"; const env = arkenv({ PORT: z.coerce.number() }, { validator: "standard" }); // ✅ After import arkenv from "arkenv/standard"; import { z } from "zod"; const env = arkenv({ PORT: z.coerce.number() }); ``` **2. `type` moved from `arkenv/arktype` to `arkenv`.** The `type` helper is now exported from the main entry. The `arkenv/arktype` sub-path is no longer public: ```ts // ❌ Before import { type } from "arkenv/arktype"; // ✅ After import { type } from "arkenv"; // 'type' is the ArkEnv helper, not a TS type modifier ``` ````
##### [v0.12.3](https://github.com/yamcodes/arkenv/releases/tag/arkenv%400.12.3) ##### Patch Changes - #### Improve npm keywords across published packages for discoverability *[`#1383`](yamcodes/arkenv#1383) [`bf60ab2`](yamcodes/arkenv@bf60ab2) [@yamcodes](https://github.com/yamcodes)* Clean up and extend the `keywords` field of every published package so npm search, aggregators, and LLM-powered package discovery surface ArkEnv for the terms users actually search for. - Remove the misleading `pnpm` keyword from `arkenv` and add `env`, `environment-variables`, `dotenv`, `config`, `standard-schema`, and the supported validators `zod` and `valibot`. - Deduplicate the repeated `arkenv` keyword in `@arkenv/vite-plugin`. - Give every env-related package a shared baseline (`env`, `environment-variables`, `dotenv`, `config`, `validation`, `typesafe`, `standard-schema`) alongside their integration-specific terms. - Add a keyword set to `@arkenv/fumadocs-ui`, which previously had none. ##### [v0.12.2](https://github.com/yamcodes/arkenv/releases/tag/arkenv%400.12.2) ##### Patch Changes - #### Expose `getSchemaKeys` helper *[`#1191`](yamcodes/arkenv#1191) [`a3e32db`](yamcodes/arkenv@a3e32db) [@yamcodes](https://github.com/yamcodes)* Expose `getSchemaKeys` helper and widen `RuntimeEnvironment` type to support typed framework runtime configurations. - #### Handle pre-parsed primitives gracefully in coercion logic *[`#1206`](yamcodes/arkenv#1206) [`12ed4f3`](yamcodes/arkenv@12ed4f3) [@yamcodes](https://github.com/yamcodes)* Updated the core coercion logic to defensively skip values that are not strings. This ensures ArkEnv won't crash or behave unpredictably when passed configuration objects that have already been parsed into numbers, booleans, or complex objects by other systems (such as Nuxt's `runtimeConfig`). - #### Fix coercion to prevent in-place mutation of environment config objects *[`#1206`](yamcodes/arkenv#1206) [`12ed4f3`](yamcodes/arkenv@12ed4f3) [@yamcodes](https://github.com/yamcodes)* Refactor `applyCoercion` to perform non-mutating updates on environment configuration data. Clone objects and arrays along the validation path instead of modifying them in-place, preventing runtime crashes on frozen configuration objects (e.g., framework runtime configurations) and avoiding side-effects on reusable config objects. Usage: ```ts import { createEnv } from "arkenv"; const env = createEnv( { DATABASE: { port: "number" } }, { env: { DATABASE: Object.freeze({ port: "3000" }) } } // Frozen object is now safely parsed without crashes! ); ``` ##### [v0.12.1](https://github.com/yamcodes/arkenv/releases/tag/arkenv%400.12.1) ##### Patch Changes - #### Add `emptyAsUndefined` option to treat empty env values as missing *[`#1188`](yamcodes/arkenv#1188) [`3bfbcb7`](yamcodes/arkenv@3bfbcb7) [@yamcodes](https://github.com/yamcodes)* Add a new `emptyAsUndefined` configuration option to both `createEnv` (ArkType mode) and `arkenv/standard` (Standard Schema mode). When enabled, environment variables set to empty strings (e.g., `PORT=` in a `.env` file) are treated as if they were missing, allowing defaults to apply and preventing unnecessary validation errors for numeric, boolean, or array types. **Usage:** ```ts import arkenv from "arkenv"; const env = arkenv( { PORT: "number = 3000", DEBUG: "boolean = false" }, { emptyAsUndefined: true } ); // Given PORT= and DEBUG= in the environment: // env.PORT → 3000 // env.DEBUG → false ``` ```ts import arkenv from "arkenv/standard"; import { z } from "zod"; const env = arkenv( { PORT: z.coerce.number().default(3000) }, { emptyAsUndefined: true } ); ``` - The default behavior remains unchanged (`emptyAsUndefined: false`). - Keys with empty values are removed from the input record before validation so that ArkType defaults and optional types work correctly. ##### [v0.12.0](https://github.com/yamcodes/arkenv/releases/tag/arkenv%400.12.0) ##### Minor Changes - #### Add Standard JSON Schema coercion to `arkenv/standard` *[`#1154`](yamcodes/arkenv#1154) [`88b0eee`](yamcodes/arkenv@88b0eee) [@yamcodes](https://github.com/yamcodes)* Introduce opt-out type coercion for standard mode (`arkenv/standard`). This coercion only works if the validator is a standard JSON Schema compliant validator (e.g., Zod, Valibot, or custom schemas that implement the `StandardJSONSchemaV1` interface). This automatically enables coercion for environment variables without relying on ArkType's runtime footprint. If you need to disable coercion, explicitly pass `{ coerce: false }` in your configuration: ```ts import arkenv from "arkenv/standard"; import { z } from "zod"; const env = arkenv({ PORT: z.number() }, { coerce: false }); ``` BREAKING CHANGE: Coercion is now enabled by default in `arkenv/standard`. This will automatically coerce environment variables to their expected types (e.g., strings containing numbers, booleans, or dates will be converted to their respective types) based on the JSON Schema of your validators. It's unlikely to affect you unless you were relying on validation failing for uncoerced string inputs, or have custom schemas that expect raw strings instead of coerced values. ##### [v0.11.1](https://github.com/yamcodes/arkenv/releases/tag/arkenv%400.11.1) ##### Patch Changes - #### Add `Infer<T>` helper to resolve environment variable types *[`#1092`](yamcodes/arkenv#1092) [`c6c30ab`](yamcodes/arkenv@c6c30ab) [@yamcodes](https://github.com/yamcodes)* Introduce the `Infer<T>` type helper, allowing developers to extract the inferred output types of their environment schemas. It supports both declarative schema shapes and compiled schemas (like Zod or ArkType types). Usage: ```ts import { createEnv, type Infer } from "arkenv"; import { type } from "arktype"; const schema = { PORT: type.number, }; export type Env = Infer<typeof schema>; ``` ##### [v0.11.0](https://github.com/yamcodes/arkenv/releases/tag/arkenv%400.11.0) ##### Minor Changes - #### Remove `ArkEnvError` import from "arkenv" *[`#815`](yamcodes/arkenv#815) [`5e8025f`](yamcodes/arkenv@5e8025f) [@yamcodes](https://github.com/yamcodes)* The `ArkEnvError` class is now only available via: ```ts import { ArkEnvError } from "arkenv/core"; ``` ##### [v0.10.0](https://github.com/yamcodes/arkenv/releases/tag/arkenv%400.10.0) ##### Minor Changes - #### `arkenv/standard` import *[`#806`](yamcodes/arkenv#806) [`f9010d0`](yamcodes/arkenv@f9010d0) [@yamcodes](https://github.com/yamcodes)* `arkenv` now ships three separate entry points: - **`arkenv`** (main): ArkType-first. Includes `createEnv` (aliased to `arkenv` default import), `type`, and `ArkEnvError`. Importing from this entry requires you to have ArkType installed. - **`arkenv/standard`**: ArkType-free. A standalone `createEnv` (aliased to `arkenv` default import) for Standard Schema validators (Zod, Valibot, etc.), not requiring ArkType. - **`arkenv/core`**: Mode-agnostic primitives - `ArkEnvError` and `ValidationIssue`. ##### Breaking changes ```` **1. `validator: "standard"` option removed; `arkenv` now statically requires ArkType.** The `validator` config option has been removed - ArkType is now always required when importing from `arkenv`. For a zero-ArkType bundle, use `arkenv/standard`: ```ts // ❌ Before import arkenv from "arkenv"; import { z } from "zod"; const env = arkenv({ PORT: z.coerce.number() }, { validator: "standard" }); // ✅ After import arkenv from "arkenv/standard"; import { z } from "zod"; const env = arkenv({ PORT: z.coerce.number() }); ``` **2. `type` moved from `arkenv/arktype` to `arkenv`.** The `type` helper is now exported from the main entry. The `arkenv/arktype` sub-path is no longer public: ```ts // ❌ Before import { type } from "arkenv/arktype"; // ✅ After import { type } from "arkenv"; // 'type' is the ArkEnv helper, not a TS type modifier ``` ````
Summary by CodeRabbit