Skip to content

feat!: remove Next/Nuxt nested bag API and expose/shared aliases - #1928

Closed
yamcodes wants to merge 3 commits into
v1from
cursor/remove-nested-bag-api-6377
Closed

yamcodes wants to merge 3 commits into
v1from
cursor/remove-nested-bag-api-6377

Conversation

@yamcodes

@yamcodes yamcodes commented Sep 21, 2026 •

Copy link
Copy Markdown
Owner

Fixes #1915

Removes the legacy nested arkenv({ server, client, shared, runtimeEnv }) overload and the expose / shared option aliases from @arkenv/nextjs and @arkenv/nuxt. Flat arkenv(schema, { exposeToClient }) is the only supported path.

Changes

  • Drop nested bag overloads and aliases from Next (client, RSC, Standard) and Nuxt (ArkType, Standard)
  • Throw a shared migration error when a nested bag (or boolean second arg) is still passed
  • Flatten @arkenv/build extractKeys and Next codegen to flat-only (exposeToClient only)
  • Replace nested/alias tests with flat success + legacy rejection coverage
  • Update the v1 migration guide (Deprecated → Removed)
  • Breaking changesets for @arkenv/nextjs, @arkenv/nuxt, and @arkenv/build

Migration

export const env = arkenv(
  {
    DATABASE_URL: "string",
    NEXT_PUBLIC_API_URL: "string",
    CUSTOM_PUBLIC: "string",
  },
  { exposeToClient: ["CUSTOM_PUBLIC"] },
);

Validation

  • Built affected packages (@repo/utils, @arkenv/build, @arkenv/nextjs, @arkenv/nuxt, and deps)
  • Typecheck passed for those packages
  • Tests: nextjs 51/51, nuxt 47/47, utils+build nested-bag/extractKeys 21/21
  • Biome format applied to touched files

issue-1915-validation.log

To show artifacts inline, enable in settings.

Open in Web Open in Cursor 

Flat arkenv(schema, { exposeToClient }) is the only supported shape.
Nested bags and option aliases now fail with a migration error.

Co-authored-by: Yam Borodetsky <[email protected]>
@changeset-bot

changeset-bot Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: fb6663b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@arkenv/nextjs Major
@arkenv/nuxt Major
@arkenv/build Major
@arkenv/bun-plugin Patch
@arkenv/rsbuild-plugin Patch
@arkenv/vite-plugin Patch

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

@yamcodes yamcodes added @arkenv/nextjs Issues or Pull Requests involving the Next.js integration for ArkEnv @arkenv/nuxt Issues or Pull Requests involving the Nuxt integration for ArkEnv docs Adds or changes documentation, or acts as documentation in and of itself enhancement New feature or improvement tests This issue or PR is about adding, removing or changing tests labels Sep 21, 2026 — with Cursor
@pkg-pr-new

pkg-pr-new Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@arkenv/agent-plugin

npm i https://pkg.pr.new/@arkenv/agent-plugin@1928

arkenv

npm i https://pkg.pr.new/arkenv@1928

@arkenv/build

npm i https://pkg.pr.new/@arkenv/build@1928

@arkenv/bun-plugin

npm i https://pkg.pr.new/@arkenv/bun-plugin@1928

@arkenv/core

npm i https://pkg.pr.new/@arkenv/core@1928

@arkenv/fumadocs-ui

npm i https://pkg.pr.new/@arkenv/fumadocs-ui@1928

@arkenv/nextjs

npm i https://pkg.pr.new/@arkenv/nextjs@1928

@arkenv/nuxt

npm i https://pkg.pr.new/@arkenv/nuxt@1928

@arkenv/rsbuild-plugin

npm i https://pkg.pr.new/@arkenv/rsbuild-plugin@1928

@arkenv/standard

npm i https://pkg.pr.new/@arkenv/standard@1928

@arkenv/tanstack-addon

npm i https://pkg.pr.new/@arkenv/tanstack-addon@1928

@arkenv/vite-plugin

npm i https://pkg.pr.new/@arkenv/vite-plugin@1928

commit: fb6663b

cursoragent and others added 2 commits September 21, 2026 08:55
Align @ts-expect-error placement with flat-only signatures and apply
formatter fixes from biome.

Co-authored-by: Yam Borodetsky <[email protected]>
@github-actions github-actions Bot added the www Improvements or additions to arkenv.js.org label Sep 21, 2026
cursor Bot pushed a commit that referenced this pull request Sep 21, 2026
Deduplicate the Next/Nuxt/build helpers into
@repo/utils/nested-bag-migration-error (from PR #1928), keeping
value-aware detection so flat keys named server are not misclassified.

Co-authored-by: Yam Borodetsky <[email protected]>
@yamcodes

Copy link
Copy Markdown
Owner Author

Closing as a duplicate of #1929 (same nested-bag / expose/shared cut).

#1929 absorbed the useful bit from this PR — the shared @repo/utils/nested-bag-migration-error helper — while keeping value-aware detection (so a flat env key named server is not misclassified) and the broader docs/twoslash coverage. It now also Fixes #1915.

@yamcodes yamcodes closed this Sep 21, 2026

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — the removal is complete and internally consistent. A couple of stale references and small rough edges below.

Reviewed changes

  • Nested bag overloads removed — @arkenv/nextjs and @arkenv/nuxt (ArkType + Standard) accept only arkenv(schema, options); legacy bags and boolean second args throw the shared migration error from the new @repo/utils/nested-bag-migration-error helper.
  • expose / shared aliases dropped — flat options and Next.js codegen read exposeToClient only; type-level tests assert the aliases are rejected.
  • @arkenv/build flattened — extractKeys drops isLegacy and throws on nested bags, generateFactoryCode is deleted, and codegen always emits the flat factory.
  • Tests and migration guide updated — nested success tests become flat success + legacy-rejection coverage; migrating-to-v1.mdx moves these APIs from Deprecated to Removed; breaking changeset for @arkenv/nextjs, @arkenv/nuxt, @arkenv/build.

ℹ️ Example and playground READMEs still document the removed nested schema

examples/with-nextjs/README.md and apps/playgrounds/nextjs/README.md both present arkenv({ server, client, shared }) as the setup, even though their own env.ts files are already flat. Anyone copying the README now hits the migration throw.

Technical details
# Stale nested-API references

## Affected sites
- `examples/with-nextjs/README.md:16` — `env.ts` snippet uses `server` / `client` / `shared` buckets
- `apps/playgrounds/nextjs/README.md:16` — identical snippet
- `docs/design/v0-parity-audit.md:52` — table row still says nested "Still works on Next/Nuxt; migrate to flat + `exposeToClient`"

## Required outcome
- Both README snippets match the flat `env.ts` (drop the buckets; note `NEXT_PUBLIC_` auto-exposure).
- The parity-audit row reflects removal.

ℹ️ Nitpicks

  • packages/internal/utils/src/utils/nested-bag-migration-error.ts:31 — a boolean second argument yields the nested-bag message even when no bag was passed; the wording could mention the removed boolean isServer flag.
  • packages/nextjs/src/index.ts:65, packages/nextjs/src/react-server.ts:37, and packages/nextjs/src/standard/index.ts:47 call assertNotNestedBag immediately before arkenvInternal, which asserts again — harmless but redundant.
  • The removed expose / shared option aliases are silently ignored at runtime (tests pin this) while the nested bag throws; untyped callers get no migration signal.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes (incremental)

  • fb6663b6 — [autofix.ci] apply automated fixes — only whitespace/formatting in apps/www/content/docs/guides/migrating-to-v1.mdx (a blank line before the changelog note and spacing in the Removed APIs list). The sentence reads correctly in full; no behavioral change.

Prior feedback still stands: examples/with-nextjs/README.md, apps/playgrounds/nextjs/README.md, and docs/design/v0-parity-audit.md still document the removed nested schema.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@yamcodes
yamcodes deleted the cursor/remove-nested-bag-api-6377 branch September 25, 2026 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

@arkenv/nextjs Issues or Pull Requests involving the Next.js integration for ArkEnv @arkenv/nuxt Issues or Pull Requests involving the Nuxt integration for ArkEnv docs Adds or changes documentation, or acts as documentation in and of itself enhancement New feature or improvement tests This issue or PR is about adding, removing or changing tests www Improvements or additions to arkenv.js.org

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove Next/Nuxt nested bag API and expose/shared aliases

2 participants