Skip to content

fix(rsc): fix transformWrapExport with filter and rejectNonAsyncFunction#1254

Merged
hi-ogawa merged 11 commits into
vitejs:mainfrom
james-elicx:codex/rsc-filtered-exports
Jul 17, 2026
Merged

fix(rsc): fix transformWrapExport with filter and rejectNonAsyncFunction#1254
hi-ogawa merged 11 commits into
vitejs:mainfrom
james-elicx:codex/rsc-filtered-exports

Conversation

@james-elicx

@james-elicx james-elicx commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Updated description by @hi-ogawa

transformWrapExport currently validates filter-ed exports and includes them in exportNames even though their values are not wrapped. It also makes metadata exports fail async validation and reports references that were never registered.

This behavior wasn't a problem for rsc plugin's internal use for rsc css transform https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-rsc/README.md#css-support, but is a problem for more general usages such as the integration indicated in #1246.

This PR fixes transformWrapExport so that filter and rejectNonAsyncFunction options and exportNames return value behaves naturally and consistently. It also refines ExportMeta.isFunction: boolean | undefined detection so filter can make use of it more flexibly. The new test is added to cover hopefully all possible patterns of ExportMeta.


Original description

Extracted from #1246.

transformWrapExport currently validates filtered exports and includes them in exportNames even though their values are not wrapped. This makes metadata exports fail async validation and reports references that were never registered.

This applies filtering before validation/reporting and keeps unresolved identifier exports eligible for wrapping. Tests cover named exports, default exports, and unknown identifier metadata.

@james-elicx
james-elicx marked this pull request as ready for review June 30, 2026 23:29
hi-ogawa and others added 9 commits July 17, 2026 14:40
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
@hi-ogawa hi-ogawa changed the title fix(rsc): exclude filtered exports from transforms fix(rsc): fix transformWrapExport with filter and rejectNonAsyncFunction Jul 17, 2026

@hi-ogawa hi-ogawa 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.

Hey, thanks for the fix! This looks like a nicely scoped change, so I've adjusted a bit and will be merging. Will try to capture larger picture as I go through other PRs.

@hi-ogawa
hi-ogawa merged commit 24d6376 into vitejs:main Jul 17, 2026
26 checks passed
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.

2 participants