Conversation
…timizing standard error mapping
🦋 Changeset detectedLatest commit: 9bfe1c4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 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 |
arkenv
@arkenv/build
@arkenv/bun-plugin
@arkenv/core
@arkenv/fumadocs-ui
@arkenv/nextjs
@arkenv/nuxt
@arkenv/standard
@arkenv/vite-plugin
commit: |
Open
…pre-coercion model (#1193) Fixes #1178 Unifies the coercion execution model between the default `arkenv` and `arkenv/standard` entry points. Uses a pre-coercion flow that shallow-copies the env object and applies coercion prior to validation against the unmodified schema. ### Changes - Replace ArkType's `.pipe()` coercion wrapper with pre-coercion flow using `findCoercionPaths` + `applyCoercion` directly in `packages/arkenv/src/arktype/index.ts` - Delete the redundant wrapper file `packages/arkenv/src/arktype/coercion/coerce.ts` and its re-export - Update `coerce.test.ts` unit tests to use a local helper mapping the pre-coercion flow - Update coercion documentation, FAQ, Standard Schema docs, and ADR-0002
Contributor
📦 Bundle Size Report
✅ All size limits passed! |
…s in CONTRIBUTING.md
Version Packages (alpha)
Parks env-object vs schema/define language in CONTEXT for #1333. Fixes the v1 ADR-numbering footgun in the SPA-mode note.
Ports the missing canonical env-object ADR from dev onto v1 as ADR 0021. Drops the Nuxt-specific honesty ADR; keeps #1424 glossary in CONTEXT.
) ## Summary - Remove outdated “requires ArkType” callouts from Next/Nuxt/Vite/Bun intros; present `@arkenv/core` vs `@arkenv/standard` as a choose-one install. - Lead Zod/Valibot pages with Standard Mode (`/standard`, codegen/`standard/config` for Next, `standard/module` for Nuxt); shrink mixing-with-ArkType to a short secondary section. - Add dedicated “Do I need to install `arktype`?” FAQs (core + Next + Nuxt), Nuxt peer-engine FAQ parity, delete leftover `nuxt/layouts/simple.mdx` (redirect already exists), and lightly update package READMEs. ## Why `v1` Documents the `@arkenv/core` / `@arkenv/standard` packaging split. `dev` still uses `arkenv` / `arkenv/standard`, so this belongs on `v1` only. ## Test plan - [ ] Spot-check Next/Nuxt intro + validators pages for Standard Mode first, no requires-ArkType callout - [ ] Confirm FAQs answer “Do I need to install arktype?” and link correctly - [ ] Confirm `/docs/nuxt/layouts/simple` still redirects to flat - [ ] Sanity-check Vite/Bun intros still show both install paths Made with [Cursor](https://cursor.com) --------- Co-authored-by: Cursor <cursoragent@cursor.com>
…1422) Fixes #1414 ## Summary - Register `#arkenv/shared-schema` alias in `@arkenv/nuxt/module` for strict layout (alongside existing `#arkenv/client-env`) - Auto-extend `SharedSchema` from `env/internal/shared.ts` in `@arkenv/nuxt/client` and `@arkenv/nuxt/standard/client` when `extends` is omitted - Keep explicit `extends` (including `[]` and property presence) as an opt-out; fail clearly when shared file or `SharedSchema` export is missing - Simplify Nuxt strict CLI scaffolds, docs, playground, and example client entries ## Test plan - [x] `pnpm run typecheck` - [x] `pnpm run test` - [x] `pnpm run fix` - [ ] Verify `apps/playgrounds/nuxt-strict` builds with simplified `env/client.ts` - [ ] Confirm manual `extends: [SharedSchema]` still works as an opt-out Made with [Cursor](https://cursor.com) --------- Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
feat(v1): Guard that integration /standard entries never pull arktype
## Summary - Forward-ports [#1464](#1464) onto `v1`: triage skill records ArkEnv rejects in `docs/adr/` (or a closing comment), never a root `.out-of-scope/` folder. - Same paths on both branches (`skills/triage/*`); no package remapping or changeset. ## Source - Dev PR: #1464 - Merge commit: `874b95a8` ## Test plan - [x] Cherry-pick applied cleanly on `origin/v1` - [ ] Spot-check `skills/triage/SKILL.md` and `OUT-OF-SCOPE.md` for the ArkEnv override - [ ] No need for package typecheck/tests (skills markdown only) Made with [Cursor](https://cursor.com) Co-authored-by: Cursor <cursoragent@cursor.com>
Fixes #1329 ## Summary - Add dual-mode `@arkenv/bun-plugin`: `arkenv()` / zero-config default rewrites `env.ts` in browser bundles (inlined coerced `BUN_PUBLIC_*` literals + server-key guards); `arkenv(schema)` keeps SPA `process.env` rewriting - Server/`Bun.serve` continues to execute `env.ts` as-is for boot-time validation against the real environment (plugin is `target: "browser"`) - Extend `with-bun-react` with a server-only `DATABASE_URL` and shared `import { env } from "./env"` on client and server ## Test plan - [ ] `pnpm --filter @arkenv/bun-plugin test` passes (helpers + transform onLoad + SPA regression) - [ ] Client `Bun.build` bundle contains inlined literals / guard stub and no validator imports - [ ] `bun run` / `Bun.serve` fails fast when required env is missing - [ ] SPA `arkenv(schema)` + `ProcessEnvAugmented` path still works Made with [Cursor](https://cursor.com) --------- Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
## Summary - Remove embedded ArkType/Zod starters from Bun hybrid missing-schema errors (short message + `arkenv init` hint) for parity with Vite/Next/Nuxt config errors - When the Nuxt module is registered but no schema is found, emit a build warning and skip setup instead of failing silently - Closes #1465 as superseded (we are not adding Vite starters; walking back Bun instead) ## Test plan - [x] `pnpm exec vitest run packages/nuxt/src/module.test.ts packages/bun-plugin/src --run` - [x] `pnpm --filter @arkenv/bun-plugin --filter @arkenv/nuxt run typecheck` - [ ] Confirm Bun hybrid missing-schema error has no code fence / Zod / ArkType sample - [ ] Confirm Nuxt with module registered and no `env.ts` warns once and still builds Made with [Cursor](https://cursor.com) Co-authored-by: Cursor <cursoragent@cursor.com>
…lient env (#1458) Fixes #1424 ## Summary - Add a Nitro boot gate (registered by `@arkenv/nuxt/module`) that validates/coerces schema keys into `runtimeConfig` (including `public`) after `NUXT_*` / `NUXT_PUBLIC_*` string overrides - Make server and client `arkenv()` entries thin readers of that coerced payload; client package entries no longer import `@arkenv/core` / `arktype` - Keep build-time `validate: true` as a core call via schema capture (not thin `arkenv()` side effects) - Update docs/example to show coerced public number/boolean values ## Test plan - [x] `pnpm --filter @arkenv/nuxt typecheck` - [x] `pnpm --filter @arkenv/nuxt exec vitest run` (49 tests, including boot-gate coercion + client bundle isolation) - [ ] Override `NUXT_PUBLIC_PORT` at Nitro boot in `examples/with-nuxt` and confirm coerced `number` on server and client - [ ] Confirm invalid `NUXT_PUBLIC_*` overrides fail fast on the server - [ ] Confirm server-only keys remain unreadable on the client Made with [Cursor](https://cursor.com) --------- Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Fixes #1452 Forward-port hosting presets Phase 4 from #1450 onto `v1`: Cloudflare, Railway, Render, and Fly.io presets for `arkenv init` / `arkenv add host`, with matching docs, tests, and an `arkenv` changeset. Made with [Cursor](https://cursor.com) Co-authored-by: Cursor <cursoragent@cursor.com>
Preserve the warn-and-skip contract so no Vite/Nitro hooks register without a schema. Co-authored-by: Cursor <cursoragent@cursor.com>
Fixes #1470 Forward-port of #1472 onto `v1`. ## Summary - Replace Nuxt **warn-and-skip** (from #1468) with **throw** when no schema is found - Keep Bun / Vite / Next throw behavior unchanged - Update module tests (including the warn-specific case from #1468) - Changeset: `@arkenv/nuxt` major (**BREAKING CHANGE**) ## Test plan - [x] `pnpm run typecheck` - [x] `pnpm run test -- --run` (1062 passed) - [x] `pnpm run fix` Made with [Cursor](https://cursor.com) Co-authored-by: Cursor <cursoragent@cursor.com>
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 v1, this PR will be updated.⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ `v1` is currently in **pre mode** so this branch has prereleases rather than normal releases. If you want to exit prereleases, run `changeset pre exit` on `v1`.⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ # Releases ## @arkenv/nuxt@1.0.0-alpha.10 ### Major Changes - #### Throw when the Nuxt module cannot resolve an env schema _[`#1473`](#1473) [`0763a92`](0763a92) [@yamcodes](https://github.com/yamcodes)_ **BREAKING CHANGE**: The `@arkenv/nuxt` module now throws when no schema file is found (auto-discovery or `schemaPath`), instead of warning and skipping setup. Create an `env.ts` (or `src/env.ts`) schema, or set `arkenv.schemaPath` in `nuxt.config.ts`. ```ts // nuxt.config.ts export default defineNuxtConfig({ modules: ["@arkenv/nuxt/module"], arkenv: { schemaPath: "./env.ts", // required if auto-discovery cannot find a schema }, }); ``` ### Minor Changes - #### Auto-extend shared schema in Nuxt strict-layout client entry _[`#1422`](#1422) [`b1d8bad`](b1d8bad) [@yamcodes](https://github.com/yamcodes)_ **`@arkenv/nuxt`:** When the module runs in strict layout, omitting `extends` in `env/client.ts` auto-merges `SharedSchema` from `env/internal/shared.ts` via `#arkenv/shared-schema`. Applies to both `@arkenv/nuxt/client` and `@arkenv/nuxt/standard/client`. The server entry continues to auto-merge the composed client env. **`arkenv` (CLI):** The Nuxt strict scaffold now emits that simplified client template (no manual `SharedSchema` import or `extends` block). Next.js scaffolds remain unchanged. Usage: ```ts import arkenv from "@arkenv/nuxt/client"; export const env = arkenv({ NUXT_PUBLIC_API_URL: "string", }); ``` Auto-merge only runs when the `extends` key is omitted. Any explicit `extends` - including `extends: []` or a custom list - is used as-is and opts out of auto-merge. Strict layout still requires `env/internal/shared.ts` with a `SharedSchema` export — that schema may be empty (`type({})`) when you have no shared variables. A missing file or unusable export fails with a clear diagnostic (rather than silently treating shared as empty). ### Patch Changes - #### Coerce Nuxt public env overrides instead of leaving them as strings _[`#1458`](#1458) [`3667b7e`](3667b7e) [@yamcodes](https://github.com/yamcodes)_ **Bug:** With a numeric (or boolean) public schema key, setting a deploy-time override made Nitro put a _string_ into `runtimeConfig.public`. That string won, so `env` lied about the type on server and client. ```diff // env.ts export const env = arkenv({ NUXT_PUBLIC_PORT: "number", }); // Deploy / Nitro boot: NUXT_PUBLIC_PORT=4000 - env.NUXT_PUBLIC_PORT; // "4000" (string) — schema said number + env.NUXT_PUBLIC_PORT; // 4000 (number) — coerced after the override ``` Same import surface. As a side effect, `@arkenv/nuxt` / `@arkenv/nuxt/client` no longer ship the validator into the browser bundle. - Skip all Nuxt module setup (including boot-gate hooks) when no schema file is found, matching the warn-and-bail contract. _[`#1165`](#1165) [`882c0ce`](882c0ce) [@yamcodes](https://github.com/yamcodes)_ - #### Drop embedded env.ts starters and warn when the Nuxt module finds no schema _[`#1468`](#1468) [`0150e73`](0150e73) [@yamcodes](https://github.com/yamcodes)_ Keep missing-schema guidance short and host-parity consistent: Bun no longer embeds ArkType/Zod starters in the hybrid discovery error (prefer `arkenv init` / docs). When the Nuxt module is registered but no schema file is found, log a build warning and skip setup instead of failing silently. ## arkenv@1.0.0-alpha.10 ### Minor Changes - #### Add hosting presets for Cloudflare, Railway, Render, and Fly.io _[`#1469`](#1469) [`a64bd57`](a64bd57) [@yamcodes](https://github.com/yamcodes)_ Add hosting presets for Cloudflare, Railway, Render, and Fly.io to the interactive prompt selections in both `arkenv init` and `arkenv add host`. Usage: ```bash npx arkenv@latest add host cloudflare ``` or ```bash npx arkenv@latest init --host-preset cloudflare ``` - #### Support `arkenv add host` for strict multi-file layouts _[`#1434`](#1434) [`a3d93be`](a3d93be) [@yamcodes](https://github.com/yamcodes)_ Support `arkenv add host [provider]` in projects with strict multi-file layouts (`client.ts` and `server.ts`). Automatically partition preset variables into client-prefixed keys for `client.ts` and server-only keys for `server.ts`. Align help text and docs so `add host` is not described as flat-`env.ts`-only. Usage: ```bash npx arkenv@latest add host [provider] ``` - #### Auto-extend shared schema in Nuxt strict-layout client entry _[`#1422`](#1422) [`b1d8bad`](b1d8bad) [@yamcodes](https://github.com/yamcodes)_ **`@arkenv/nuxt`:** When the module runs in strict layout, omitting `extends` in `env/client.ts` auto-merges `SharedSchema` from `env/internal/shared.ts` via `#arkenv/shared-schema`. Applies to both `@arkenv/nuxt/client` and `@arkenv/nuxt/standard/client`. The server entry continues to auto-merge the composed client env. **`arkenv` (CLI):** The Nuxt strict scaffold now emits that simplified client template (no manual `SharedSchema` import or `extends` block). Next.js scaffolds remain unchanged. Usage: ```ts import arkenv from "@arkenv/nuxt/client"; export const env = arkenv({ NUXT_PUBLIC_API_URL: "string", }); ``` Auto-merge only runs when the `extends` key is omitted. Any explicit `extends` - including `extends: []` or a custom list - is used as-is and opts out of auto-merge. Strict layout still requires `env/internal/shared.ts` with a `SharedSchema` export — that schema may be empty (`type({})`) when you have no shared variables. A missing file or unusable export fails with a clear diagnostic (rather than silently treating shared as empty). ## @arkenv/bun-plugin@1.0.0-alpha.7 ### Minor Changes - #### Add `env.ts` transform for Bun fullstack apps _[`#1459`](#1459) [`5fc1c6a`](5fc1c6a) [@yamcodes](https://github.com/yamcodes)_ Let the Bun plugin discover your `env.ts` and expose a shared `env` object that works in both client and server code. On the client (`Bun.build` / `[serve.static]`), public (`BUN_PUBLIC_*`) values are inlined at build time and server-only keys throw if read; on the server (`bun run` / `Bun.serve`), `env.ts` still runs normally and validates against the real environment at boot. The plugin does not rewrite your `env.ts` file on disk. Works with `@arkenv/bun-plugin` and `@arkenv/bun-plugin/standard`. Usage: ```ts // bunfig.toml — zero-config browser transform // [serve.static] // plugins = ["@arkenv/bun-plugin"] // or explicitly in Bun.build: import arkenv from "@arkenv/bun-plugin"; await Bun.build({ entrypoints: ["./src/index.html"], target: "browser", plugins: [arkenv], // finds src/env.ts or env.ts // or: arkenv({ schemaPath: "src/env.ts", clientPrefix: "BUN_PUBLIC_" }) }); ``` ```ts // src/env.ts import arkenv from "@arkenv/core"; export const env = arkenv({ DATABASE_URL: "string", BUN_PUBLIC_API_URL: "string", }); ``` ```ts import { env } from "./env"; env.BUN_PUBLIC_API_URL; // available on client and server env.DATABASE_URL; // server only — throws if read in the browser ``` Passing a schema to `arkenv(schema)` (the previous `process.env` rewrite API) continues to work unchanged as SPA mode. ### Patch Changes - #### Clarify Standard Mode missing-schema guidance with a Zod example _[`#1457`](#1457) [`6cca0cf`](6cca0cf) [@yamcodes](https://github.com/yamcodes)_ When `@arkenv/bun-plugin/standard` cannot find `env.ts`, show an illustrative Zod starter (any Standard Schema validator works — Zod is just the most common): ```ts import arkenv from "@arkenv/standard"; import { z } from "zod"; export default arkenv({ BUN_PUBLIC_API_URL: z.string(), BUN_PUBLIC_DEBUG: z.enum(["true", "false"]), }); ``` - #### Drop embedded env.ts starters and warn when the Nuxt module finds no schema _[`#1468`](#1468) [`0150e73`](0150e73) [@yamcodes](https://github.com/yamcodes)_ Keep missing-schema guidance short and host-parity consistent: Bun no longer embeds ArkType/Zod starters in the hybrid discovery error (prefer `arkenv init` / docs). When the Nuxt module is registered but no schema file is found, log a build warning and skip setup instead of failing silently. ## @arkenv/vite-plugin@1.0.0-alpha.7 ### Minor Changes - #### Add `env.ts` transform for Vite fullstack apps _[`#1423`](#1423) [`e1cf6db`](e1cf6db) [@yamcodes](https://github.com/yamcodes)_ Let the Vite plugin discover your `env.ts` and expose a shared `env` object that works in both client and server code. On the client, public (`VITE_*`) values are inlined at build time and server-only keys throw if read; on the server/SSR, `env.ts` still runs normally and validates against the real environment at boot. The plugin does not rewrite your `env.ts` file on disk. Works with `@arkenv/vite-plugin` and `@arkenv/vite-plugin/standard`. Usage: ```ts // vite.config.ts import arkenv from "@arkenv/vite-plugin"; export default { plugins: [arkenv()], // finds src/env.ts or env.ts // or: arkenv({ schemaPath: "src/env.ts", clientPrefix: "VITE_" }) }; ``` ```ts // src/env.ts import arkenv from "@arkenv/core"; export const env = arkenv({ DATABASE_URL: "string", VITE_API_URL: "string", }); ``` ```ts import { env } from "./env"; env.VITE_API_URL; // available on client and server env.DATABASE_URL; // server only — throws if read in the browser ``` Passing a schema to `arkenv(schema)` (the previous `import.meta.env` define API) continues to work unchanged. Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
## Summary - Ports [#1481](#1481) (`dev`) to `v1`: `pull_request_target` for labeled PR previews so fork PRs receive Vercel secrets. - Keeps secret hygiene (checkout PR HEAD with `persist-credentials: false`; inject `VERCEL_*` only on Vercel CLI steps). - Updates CONTRIBUTING preview section to match; no package/changeset changes (workflows + docs only). ## Test plan - [ ] Same-repo / fork PRs targeting `v1` with `preview` get a green Actions Deploy-Preview after this merges - [ ] Unlabeled fork PRs do not deploy Made with [Cursor](https://cursor.com) Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
chore: verify v1 branch domain deploy (#1460)
ci: forward-port Vercel branch-domain alias wiring to v1 (#1460)
## Summary - Forward-port of [#1490](#1490) (`dev`) onto `v1` - Centralize missing-schema text in `formatMissingSchemaError` (`@arkenv/build`) - Wire **Bun, Vite, Next, and Nuxt** through the shared helper (Vite included on `v1` because it has a discovery miss path; `dev` Vite does not) - Mock registry fetch in CLI init tests (same flake fix as #1490) ## Test plan - [x] `pnpm exec vitest run packages/build packages/bun-plugin/src/env-module.test.ts packages/vite-plugin/src/env-module.test.ts packages/nuxt/src/module.test.ts packages/arkenv/src/cli/commands/init.test.ts --run` - [x] `pnpm run typecheck` - [x] `pnpm run fix` - [x] `pnpm run test -- --run` (1066 passed) Made with [Cursor](https://cursor.com) --------- Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://arkenv-v1.vercel.app