Skip to content

refactor(react-compiler): remove compiler impl and keep fast_check#11753

Merged
kdy1 merged 2 commits intomainfrom
kdy1/react-compiler-fast-check-only-11751
Mar 31, 2026
Merged

refactor(react-compiler): remove compiler impl and keep fast_check#11753
kdy1 merged 2 commits intomainfrom
kdy1/react-compiler-fast-check-only-11751

Conversation

@kdy1
Copy link
Copy Markdown
Member

@kdy1 kdy1 commented Mar 31, 2026

Summary

  • remove the React Compiler implementation from swc_ecma_react_compiler
  • keep only swc_ecma_react_compiler::fast_check::is_required
  • remove React Compiler fixture/script assets and related CI special-case handling

API changes

  • kept: fast_check::is_required
  • removed: react_compiler, compile_program, compile_fn, CompilerPass, CompileReport, option/error/codegen re-exports

Verification

  • git submodule update --init --recursive
  • cargo test -p swc_ecma_react_compiler
  • cargo check -p binding_react_compiler_node
  • cargo check -p swc_core --features ecma_react_compiler
  • cargo fmt --all
  • cargo clippy --all --all-targets -- -D warnings

Related to #11751.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 31, 2026

🦋 Changeset detected

Latest commit: e399ef1

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@kdy1 kdy1 changed the title refactor(swc_ecma_react_compiler): remove compiler impl and keep fast_check refactor(react-compiler): remove compiler impl and keep fast_check Mar 31, 2026
@socket-security
Copy link
Copy Markdown

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn High
Obfuscated code: npm js-beautify is 100.0% likely obfuscated

Confidence: 1.00

Location: Package overview

From: package.jsonnpm/[email protected]

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at [email protected].

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/[email protected]. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

@kdy1 kdy1 marked this pull request as ready for review March 31, 2026 04:37
@kdy1 kdy1 requested review from a team as code owners March 31, 2026 04:37
Copilot AI review requested due to automatic review settings March 31, 2026 04:37
kodiakhq[bot]
kodiakhq Bot previously approved these changes Mar 31, 2026
@kdy1 kdy1 added this to the Planned milestone Mar 31, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR removes the in-crate React Compiler implementation from swc_ecma_react_compiler, leaving only the fast_check::is_required API and cleaning up related fixtures and CI handling.

Changes:

  • Removed compiler implementation modules (entrypoint, HIR, inference, optimization, SSA, transform, validation, utils) and their public re-exports from swc_ecma_react_compiler.
  • Deleted React Compiler fixture assets (inputs/outputs/errors) under crates/swc_ecma_react_compiler/tests/fixtures/**.
  • Simplified CI by removing the swc_ecma_react_compiler special-case test step and env var.

Reviewed changes

Copilot reviewed 297 out of 3504 changed files in this pull request and generated no comments.

Show a summary per file
File Description
crates/swc_ecma_react_compiler/src/lib.rs Removes compiler modules and exports, retaining only fast_check.
crates/swc_ecma_react_compiler/Cargo.toml Drops compiler-related dependencies/dev-dependencies and adjusts remaining dev deps.
.github/workflows/CI.yml Removes swc_ecma_react_compiler special-case test step/env var and runs it like other crates.
crates/swc_ecma_react_compiler/src/validation/** Deletes validation infrastructure previously used by the compiler implementation.
crates/swc_ecma_react_compiler/src/utils/mod.rs Deletes directive/helper utilities previously used by the compiler implementation.
crates/swc_ecma_react_compiler/src/transform/mod.rs Deletes compiler transform utilities previously used for AST/HIR processing.
crates/swc_ecma_react_compiler/src/ssa/** Deletes SSA pipeline placeholders previously used by the compiler implementation.
crates/swc_ecma_react_compiler/src/optimization/** Deletes optimization pipeline placeholders previously used by the compiler implementation.
crates/swc_ecma_react_compiler/src/inference/** Deletes inference pipeline placeholders previously used by the compiler implementation.
crates/swc_ecma_react_compiler/src/hir/mod.rs Deletes HIR definition/lowering previously used by the compiler implementation.
crates/swc_ecma_react_compiler/src/entrypoint/mod.rs Deletes compiler entrypoint module wiring.
crates/swc_ecma_react_compiler/tests/fixtures/** Removes React Compiler test fixtures (inputs/outputs/errors).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 31, 2026

Binary Sizes

File Size
swc.linux-x64-gnu.node 28M (29081800 bytes)

Commit: e6d35ee

@claude

This comment has been minimized.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Mar 31, 2026

Merging this PR will not alter performance

✅ 219 untouched benchmarks


Comparing kdy1/react-compiler-fast-check-only-11751 (e399ef1) with main (7d8d11b)

Open in CodSpeed

@kdy1 kdy1 merged commit f21d336 into main Mar 31, 2026
21 checks passed
@kdy1 kdy1 deleted the kdy1/react-compiler-fast-check-only-11751 branch March 31, 2026 06:37
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Mar 31, 2026

PR Review: refactor(react-compiler): remove compiler impl and keep fast_check

Summary

Clean removal of the in-house React Compiler implementation (~122K lines deleted) in preparation for migrating to the official Rust React Compiler (#11751). Only fast_check::is_required is retained — which is the right call since the node binding (binding_react_compiler_node) only depends on that function.

Code Quality

  • lib.rs is now minimal and clean — just #![deny(clippy::all)] and pub mod fast_check. Good.
  • Cargo.toml dependencies are properly trimmed: swc_atoms, swc_ecma_codegen, and serde_json are removed since they were only used by the deleted compiler code. swc_common is correctly moved to [dev-dependencies] (needed by the inline tests in fast_check.rs).
  • CI.yml cleanup is correct — the swc_ecma_react_compiler special-case with REACT_COMPILER_FIXTURE_ALLOW_FAILURE is no longer needed, and the crate now runs through the standard test path.
  • Changeset correctly marks this as a major version bump, which is appropriate given the removed public API surface.

Potential Concerns

  1. Downstream re-export via swc_core: swc_core re-exports swc_ecma_react_compiler as react_compiler behind the ecma_react_compiler feature flag. After this PR, consumers using swc_core::react_compiler::react_compiler(), CompilerPass, ParsedPluginOptions, etc. will break. This is expected for a major bump, but worth confirming that no first-party consumer (e.g., swc main crate) depends on those removed exports. The binding_react_compiler_node only uses fast_check::is_required, so that's fine.

  2. fast_check.rs — minor early-exit optimization opportunity: The visit_var_declarator implementation visits all children even when self.found is already true. The visit_stmt and visit_expr methods have early exits for self.found, but visit_var_declarator and the other visitors don't. This is pre-existing and not introduced by this PR, but worth noting as a potential follow-up since this is now the only code in the crate.

  3. No fast_check module-level doc comment: Since this is now the entire public surface of the crate, a brief doc comment on pub fn is_required explaining what "required" means (i.e., the program contains React components or hooks that would benefit from compilation) would help consumers. Again, pre-existing — not a blocker.

Test Coverage

  • The inline #[cfg(test)] tests in fast_check.rs are preserved and cover the key cases: components with JSX, hooks usage, arrow functions, export defaults, and negative cases. This is adequate for the remaining functionality.
  • Fixture tests for the removed compiler are correctly deleted.
  • The CI change ensures swc_ecma_react_compiler now runs through the standard test path without the REACT_COMPILER_FIXTURE_ALLOW_FAILURE env var — good cleanup.

Security

No concerns — this is purely a deletion of code.

Performance

No concerns — the remaining fast_check::is_required is a single-pass AST visitor with early exits, which is efficient.

Verdict

Looks good. This is a straightforward, well-scoped deletion that correctly preserves the only actively-used API (fast_check::is_required) and properly updates dependencies, CI, and versioning. The PR description's verification checklist is thorough.

🤖 Generated with Claude Code

@github-actions github-actions Bot modified the milestones: Planned, 1.15.24 Apr 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants