fix(vue): expose @unhead/vue/stream/iife with correct types#707
Conversation
β¦reamingIifeCode` The `unhead` build hook overwrites `dist/stream/iife.mjs` post-build to export `streamingIifeCode` (string) and `streamingIifeSize` (number), but the generated `.d.ts` still declared the source-level `init` export. This caused consumers to need `as unknown as` casts when importing. Now the build hook writes correct `.d.ts` files alongside the overwritten `.mjs`, and `@unhead/vue` re-exports the subpath so Vue users can import from `@unhead/vue/stream/iife`.
|
No actionable comments were generated in the recent review. π βΉοΈ Recent review infoβοΈ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: π Files selected for processing (9)
π WalkthroughWalkthroughThis PR introduces public API exports for streaming IIFE code assets across the unhead and Vue packages, adding TypeScript declarations, build configurations, and package.json exports for Changes
Estimated code review effortπ― 3 (Moderate) | β±οΈ ~22 minutes Poem
π₯ Pre-merge checks | β 2 | β 1β Failed checks (1 warning)
β Passed checks (2 passed)
βοΈ Tip: You can configure your own custom pre-merge checks in the settings. β¨ Finishing Touchesπ Generate docstrings
π§ͺ 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 |
Bundle Size Analysis
|
π Linked issue
N/A (internal TODO)
β Type of change
π Description
The
unheadbuild hook overwritesdist/stream/iife.mjspost-build to exportstreamingIifeCode(string) andstreamingIifeSize(number), but the generated.d.tsstill declared the source-levelinitexport. This forced consumers to useas unknown ascasts.Now the build hook writes correct
.d.tsfiles alongside the overwritten.mjs, the tsconfig path points to an ambient declaration matching the post-build API, and@unhead/vueexposes./stream/iifeas a subpath re-export.Summary by CodeRabbit
./stream/iifesubpath export provides access tostreamingIifeCode(bundled code for HTML inlining) andstreamingIifeSize(byte-length metadata) with complete TypeScript type declarations, enabling enhanced streaming support with improved type safety and integration capabilities.