Skip to content

feat: (v1) Make env/internal/shared.ts optional in strict layout#1505

Merged
yamcodes merged 5 commits into
v1from
cursor/optional-strict-shared-forward-port-1dd0
Jul 25, 2026
Merged

feat: (v1) Make env/internal/shared.ts optional in strict layout#1505
yamcodes merged 5 commits into
v1from
cursor/optional-strict-shared-forward-port-1dd0

Conversation

@yamcodes

@yamcodes yamcodes commented Jul 25, 2026

Copy link
Copy Markdown
Owner

Fixes #1449
Forward-port of #1503 / #1448

Summary

  • @arkenv/build: strict auto-detect / findSchemaPath treat client.ts + server.ts as enough; internal/shared.ts optional (empty when absent). Explicit layout: "strict" only requires client.ts. Shared isStrictLayoutDir + assertFlatSchemaFile keep host integrations DRY.
  • @arkenv/nuxt: missing shared aliases #arkenv/shared-schema to empty-shared-schema (same stub as non-strict); present file without usable SharedSchema still fails.
  • @arkenv/nextjs: codegen already treated missing shared as empty; JSDoc + docs updated.
  • @arkenv/vite-plugin / @arkenv/bun-plugin: flat-only; reject a discovered strict env/ directory via assertFlatSchemaFile instead of reading a directory as a module.
  • Docs describe shared as optional; CLI still scaffolds shared.ts by default.

Test plan

  • Affected package tests + typecheck (@arkenv/build, nextjs, nuxt, vite-plugin, bun-plugin)
  • Strict env/ with only client.ts + server.ts auto-detects as strict
  • Nuxt strict succeeds without internal/shared.ts (empty auto-extend)
  • Present shared without SharedSchema export still fails
  • Vite/Bun discovery of a strict directory throws a clear flat-only error
  • CLI init --strict still scaffolds shared.ts
Open in Web Open in Cursor 

Forward-port #1503/#1448 onto v1: strict auto-detect and findSchemaPath
only require client.ts + server.ts. Nuxt #arkenv/shared-schema falls back
to empty-shared-schema when shared is omitted; Vite/Bun reject discovered
strict directories as flat-only.

Co-authored-by: Yam Borodetsky <hi@yam.codes>
@changeset-bot

changeset-bot Bot commented Jul 25, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5033c4f

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

This PR includes changesets to release 5 packages
Name Type
@arkenv/build Patch
@arkenv/nextjs Patch
@arkenv/nuxt Patch
@arkenv/bun-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

@github-actions github-actions Bot added docs Adds or changes documentation, or acts as documentation in and of itself @arkenv/vite-plugin Issues or Pull Requests involving the Vite plugin for ArkEnv www Improvements or additions to arkenv.js.org tests This issue or PR is about adding, removing or changing tests @arkenv/bun-plugin Issues or Pull Requests involving the Bun plugin for ArkEnv @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 labels Jul 25, 2026
@pkg-pr-new

pkg-pr-new Bot commented Jul 25, 2026

Copy link
Copy Markdown

Open in StackBlitz

arkenv

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

@arkenv/build

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

@arkenv/bun-plugin

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

@arkenv/core

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

@arkenv/fumadocs-ui

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

@arkenv/nextjs

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

@arkenv/nuxt

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

@arkenv/standard

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

@arkenv/vite-plugin

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

commit: 5033c4f

cursoragent and others added 3 commits July 25, 2026 14:43
Align assertFlatSchemaFile prefixes with host missing-schema errors and
restore a typed guard for registerStrictLayoutHooks.

Co-authored-by: Yam Borodetsky <hi@yam.codes>
Drop internal aliases/stub wording; keep the usage-first tone from the
changeset skill and the original #1503 notes.

Co-authored-by: Yam Borodetsky <hi@yam.codes>
Co-authored-by: Yam Borodetsky <hi@yam.codes>
@yamcodes
yamcodes marked this pull request as ready for review July 25, 2026 17:44

@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 — makes env/internal/shared.ts optional in strict layout across all integrations, forward-porting the same change from dev (#1503). Auto-detection and explicit layout: "strict" now require only client.ts + server.ts; shared keys are treated as empty when the file is absent.

  • Relax strict-layout isStrictLayoutDir and findSchemaPath — core auto-detection now treats client.ts + server.ts as sufficient; internal/shared.ts is optional.
  • New assertFlatSchemaFile shared guard — Vite and Bun plugins reject discovered strict directories with a clear host-specific diagnostic instead of reading a directory as a module.
  • Nuxt missing-shared fallback — absent env/internal/shared.ts aliases to the existing empty-shared-schema stub; present file without SharedSchema still fails with a clear diagnostic.
  • Next.js JSDoc only — codegen already handled missing shared with an empty-string fallback.
  • Docs and changeset — strict layout pages for Next.js and Nuxt updated; patch bump for all 5 affected packages.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) (GPT Sol not used — the program covers this model; add its provider key to run your pick) | 𝕏

@yamcodes
yamcodes merged commit 9bfe1c4 into v1 Jul 25, 2026
18 checks passed
@yamcodes
yamcodes deleted the cursor/optional-strict-shared-forward-port-1dd0 branch July 25, 2026 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

@arkenv/bun-plugin Issues or Pull Requests involving the Bun plugin for ArkEnv @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 @arkenv/vite-plugin Issues or Pull Requests involving the Vite plugin for ArkEnv docs Adds or changes documentation, or acts as documentation in and of itself 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.

2 participants