fix(server): declare h3 as optional peer dependency (#2601)#2602
fix(server): declare h3 as optional peer dependency (#2601)#2602ymc9 merged 1 commit intozenstackhq:devfrom
Conversation
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).
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe server package now declares Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
ymc9
left a comment
There was a problem hiding this comment.
Yes, it should indeed be an optional peer. Thanks for the fix!
Summary
Fixes #2601. In 3.6.x,
dist/nuxt.d.mtsinlinedH3Eventand its transitive type graph from the pinned devDependencyh3@1.15.5, causing TS2345 for consumers on a newerh3(e.g. Nuxt 4 onh3@1.15.9).Root cause: the
tsup→tsdownmigration changed dts emission.rolldown-plugin-dtsbundles declarations and externalizes only what's declared independencies/peerDependencies.h3was only indevDependencies, so its types got inlined.This PR adds
h3as an optionalpeerDependency(matching hownuxt,next,express,fastify,hono,elysia,@sveltejs/kit,fastify-pluginare already declared), keeping the fix consistent with the rest of the adapter deps and requiring no build-config changes.Test plan
@zenstackhq/server; confirmdist/nuxt.d.mtsnow emitsimport { H3Event, EventHandlerRequest } from "h3"instead of inlined interfaces (size dropped to ~0.88 kB).h3@1.15.9) that passing the handler's event into functions typed with the realH3Eventno longer produces TS2345.Summary by CodeRabbit