feat(nuxt): core API & flat layout support - #1248
Conversation
🦋 Changeset detectedLatest commit: 3330c83 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 |
arkenv
@arkenv/build
@arkenv/bun-plugin
@arkenv/cli
@arkenv/fumadocs-ui
@arkenv/nextjs
@arkenv/nuxt
@arkenv/vite-plugin
commit: |
📦 Bundle Size Report
✅ All size limits passed! |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Important
The new flat createEnv(schema, options) overload in @arkenv/nuxt declares an options.runtimeEnv field, but createEnvInternal never consumes it, so passing runtimeEnv silently does nothing. This is inconsistent with @arkenv/nextjs and is likely to mislead users migrating to the flat layout.
Reviewed changes — Nuxt flat-layout support and build-package extraction refactor.
- Add a
createEnv(schema, options)overload to@arkenv/nuxt(universal, server, client, and shared entry points) with flat-layout TypeScript inference. - Refactor
@arkenv/buildsoextractKeysaccepts a framework public prefix and detects both the legacy nested layout and the flat layout. - Update
@arkenv/nextjsto use the shared@arkenv/buildextraction logic instead of duplicating the parser. - Update the Nuxt module to recognize
"flat"as a layout option and emit a one-time deprecation warning for"simple". - Add runtime and build-time extraction tests for the Nuxt flat layout.
ℹ️ Nitpicks
.changeset/nuxt-flat-layout.mdbumps both packages aspatch, but the changeset adds a new public API (createEnv(schema, options)and a new module layout option). Under semantic-versioning conventions that usually warrantsminor.packages/nuxt/src/type-regression.test-d.tsonly exercises the legacycreateEnv({ server, client, shared })signature; consider adding type-level coverage for the new flat overload so inference regressions are caught bypnpm --filter @arkenv/nuxt typecheck.
Note: 1 inline comment(s) dropped because they did not anchor to lines inside the PR diff:
packages/nuxt/src/type-regression.test-d.ts:88(RIGHT) — line 88 (RIGHT) is not inside a diff hunk
Kimi K2 (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — the new commits address the prior review feedback by wiring runtimeEnv through the Nuxt flat layout, adding flat type-regression coverage, and bumping the changeset severity.
- Wired
options.runtimeEnvintocreateEnvInternalfor both legacy and flat layouts, with validation that every key exists in the schema. - Added runtime tests in
packages/nuxt/src/index.test.tsverifying thatruntimeEnvoverridesprocess.envand rejects unknown keys. - Added a flat-layout type-regression test in
packages/nuxt/src/type-regression.test-d.tscoveringexposeToClientandruntimeEnvinference. - Bumped
@arkenv/nuxttominorin.changeset/nuxt-flat-layout.md.
Kimi K2 (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — the new commits refactor the shared build-time extraction parsers and tidy the changeset/comment wording.
- Refactored
@arkenv/buildparsers to a regex token scanner —extractCallArguments,extractBlock,parseBlockKeys, andextractArkenvBlocknow share a single tokenizer that skips comments, strings, and template literals while matching braces/parens/brackets.@arkenv/nextjsand@arkenv/nuxtnow delegate toextractKeyswith their public prefixes (NEXT_PUBLIC_/NUXT_PUBLIC_). - Switched the changeset severity to
patchand updated the description to use "typesafe" instead of "type-safe". - Updated Nuxt strict entry points to pass
strictLayout: "client"/"server"so the flat schema is interpreted as client-only/server-only in those dedicated entry points. - Standardized "typesafe" spelling in Nuxt entry-point JSDoc comments.
ℹ️ @arkenv/build extractors have no dedicated tests
The extraction logic is now the single implementation behind both Next.js and Nuxt codegen, but packages/build has no unit tests of its own. Both framework packages cover it indirectly through their config tests, and those pass. Adding focused tests for the token scanner directly in @arkenv/build would make future parser changes cheaper to validate and catch cross-framework edge cases earlier.
Kimi K2 (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — the latest commit cleans up lint-in-expression patterns in the shared parser and suppresses intentional deprecation warnings.
- Refactored regex token-scanner loops in
packages/build/src/index.tsto avoid assignment-in-expression patterns. - Added
// biome-ignore lint/suspicious/noConsoleannotations before deliberate dev-time deprecation warnings inpackages/nuxt/src/create-env.tsandpackages/nuxt/src/module.ts.
No new issues found; existing Nuxt/Next.js config and runtime tests pass, and @arkenv/nuxt typecheck passes.
Kimi K2 (free via Pullfrog for OSS) | 𝕏
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 dev, this PR will be updated. # Releases ## @arkenv/build@0.0.2 ### Patch Changes - #### Add flat layout support to `@arkenv/nuxt` _[`#1248`](#1248) [`be8034f`](be8034f) [@yamcodes](https://github.com/yamcodes)_ Introduce flat layout schema support and typesafe `createEnv` signature overloads to `@arkenv/nuxt`. - Add `"flat"` layout mode to `ModuleOptions` and auto-detect it when a single `env.ts` file is configured. - Emit a deprecation warning in development when using the legacy `"simple"` layout option. - Expose flat `createEnv(schema, options)` overload with type inference for `NUXT_PUBLIC_` prefixes, `NODE_ENV`, and custom `exposeToClient` variables. ## @arkenv/nextjs@0.1.3 ### Patch Changes <details><summary>Updated 1 dependency</summary> <small> [`be8034f`](be8034f) </small> - `@arkenv/build@0.0.2` </details> ## @arkenv/nuxt@0.0.2 ### Patch Changes - #### Add flat layout support to `@arkenv/nuxt` _[`#1248`](#1248) [`be8034f`](be8034f) [@yamcodes](https://github.com/yamcodes)_ Introduce flat layout schema support and typesafe `createEnv` signature overloads to `@arkenv/nuxt`. - Add `"flat"` layout mode to `ModuleOptions` and auto-detect it when a single `env.ts` file is configured. - Emit a deprecation warning in development when using the legacy `"simple"` layout option. - Expose flat `createEnv(schema, options)` overload with type inference for `NUXT_PUBLIC_` prefixes, `NODE_ENV`, and custom `exposeToClient` variables. <details><summary>Updated 1 dependency</summary> <small> [`be8034f`](be8034f) </small> - `@arkenv/build@0.0.2` </details> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

Fixes #1242
This PR adds core API and flat layout support to
@arkenv/nuxt, aligning it with the Next.js integration features.Changes:
ModuleOptions.layouttype to support"flat", treating"simple"as a deprecated alias with dev-time warnings.@arkenv/buildto support parameterized framework prefixes, avoiding duplicate AST RegExp parsing in@arkenv/nuxtand@arkenv/nextjs.createEnvInternalto support runtime key categorization and proxy shielding under the flat layout usingNUXT_PUBLIC_,NODE_ENV, andexposeToClient.createEnventrypoint in@arkenv/nuxtwith robust TypeScript type inference.