feat(transform): integrate the React Compiler as a transform option#9656
Draft
Boshen wants to merge 1 commit into
Draft
feat(transform): integrate the React Compiler as a transform option#9656Boshen wants to merge 1 commit into
Boshen wants to merge 1 commit into
Conversation
✅ Deploy Preview for rolldown-rs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Run the Rust port of the React Compiler (oxc-project/oxc#22942) at the pre-ecma-ast stage, gated by a new `transform.reactCompiler` option. - pin the oxc crates to the integration PR via [patch.crates-io], and add the oxc_react_compiler git dependency - add `react_compiler` to the bundler transform options; run it on the pristine AST in pre_process_ecma_ast before the oxc transformer, returning the scoping the rest of the pipeline uses - expose it as `reactCompiler?: boolean | ReactCompilerOptions` through the napi binding (reusing oxc_transform_napi's resolver) and the TS types - add a snapshot integration test (enabled vs disabled) Depends on oxc-project/oxc#22942; the patch pins a git rev until it lands.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Runs the Rust port of the React Compiler (oxc-project/oxc#22942) at the pre-ecma-ast stage, gated by a new
transform.reactCompileroption.Changes
[patch.crates-io], and add theoxc_react_compilergit dependency.react_compilerto the bundler transform options; run it on the pristine AST inpre_process_ecma_astbefore the oxc transformer, returning the scoping the rest of the pipeline uses (mirrors howoxc::Compilersequences it).reactCompiler?: boolean | ReactCompilerOptionsthrough the napi binding (reusingoxc_transform_napi's resolver) and the TS types.crates/rolldown/tests/rolldown/topics/react_compiler/{basic,disabled}— enabled emits thereact/compiler-runtimeimport +c(n)memo cache; disabled does not.Usage
Notes
[patch.crates-io]pins a git rev until that lands; swap to a released oxc version before merging._cimport alias is renamed by rolldown's scope-hoisting linker (toc/react_compiler_runtime.c), so the test asserts on thereact/compiler-runtimeimport + memo cache rather than the literal_c(token.--workspacecheck, clippy, fmt, tsc, and the Rust snapshot test all pass).🤖 Generated with Claude Code