Skip to content

fix(server): declare h3 as optional peer dependency (#2601)#2602

Merged
ymc9 merged 1 commit intozenstackhq:devfrom
genu:genu/issue-2601-check
Apr 22, 2026
Merged

fix(server): declare h3 as optional peer dependency (#2601)#2602
ymc9 merged 1 commit intozenstackhq:devfrom
genu:genu/issue-2601-check

Conversation

@genu
Copy link
Copy Markdown
Contributor

@genu genu commented Apr 22, 2026

Summary

Fixes #2601. In 3.6.x, dist/nuxt.d.mts inlined H3Event and its transitive type graph from the pinned devDependency h3@1.15.5, causing TS2345 for consumers on a newer h3 (e.g. Nuxt 4 on h3@1.15.9).

Root cause: the tsuptsdown migration changed dts emission. rolldown-plugin-dts bundles declarations and externalizes only what's declared in dependencies / peerDependencies. h3 was only in devDependencies, so its types got inlined.

This PR adds h3 as an optional peerDependency (matching how nuxt, next, express, fastify, hono, elysia, @sveltejs/kit, fastify-plugin are already declared), keeping the fix consistent with the rest of the adapter deps and requiring no build-config changes.

Test plan

  • Rebuild @zenstackhq/server; confirm dist/nuxt.d.mts now emits import { H3Event, EventHandlerRequest } from "h3" instead of inlined interfaces (size dropped to ~0.88 kB).
  • Verify in a Nuxt 4 consumer (h3@1.15.9) that passing the handler's event into functions typed with the real H3Event no longer produces TS2345.

Summary by CodeRabbit

  • Chores
    • Added support for an optional dependency to enhance compatibility with different runtime environments and project configurations.

Prevents tsdown from inlining h3 types into dist/nuxt.d.mts, which caused
structural incompatibility for consumers on newer h3 versions (e.g. Nuxt 4).
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 22, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4a305c32-9404-4929-9124-d1a2cefd7463

📥 Commits

Reviewing files that changed from the base of the PR and between 14e1d55 and fcb0327.

📒 Files selected for processing (1)
  • packages/server/package.json

📝 Walkthrough

Walkthrough

The server package now declares h3 as an optional peer dependency version ^1.15.0, preventing the build tool from bundling h3 type definitions and ensuring downstream consumers use their own version-matched types instead of a stale inlined copy.

Changes

Cohort / File(s) Summary
Peer Dependency Declaration
packages/server/package.json
Added h3: ^1.15.0 to peerDependencies and marked it optional in peerDependenciesMeta to prevent type bundling during build.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A nibble, a hop—h3 joins the tree,
Optional peer, exactly as it should be!
No bundled types causing TypeScript despair,
External stays fresh, floating light as air,
The build tool respects it, types bloom anew—
Our rabbit's small fix makes everything true! 🥕✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely summarizes the main change: declaring h3 as an optional peer dependency to fix type bundling issues.
Linked Issues check ✅ Passed The PR fully implements the primary objective from issue #2601: adding h3 as an optional peerDependency to prevent type inlining in dist/nuxt.d.mts.
Out of Scope Changes check ✅ Passed All changes are directly scoped to addressing issue #2601 with no unrelated modifications to the codebase.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Member

@ymc9 ymc9 left a comment

Choose a reason for hiding this comment

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

Yes, it should indeed be an optional peer. Thanks for the fix!

@ymc9 ymc9 merged commit 6f967a9 into zenstackhq:dev Apr 22, 2026
9 checks passed
@genu genu deleted the genu/issue-2601-check branch April 22, 2026 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@zenstackhq/server 3.6.x bundles h3 types into nuxt.d.mts, breaking consumers on newer h3

2 participants