dillon1000/react

Commit

[rust-compiler] Return the compiled AST by value instead of JSON (#36729)

`compile_program` serialized the transformed `File` to a JSON string and
every in-process consumer immediately deserialized it back, so each
oxc/swc compile paid a full serialize/parse round-trip of the entire
program for nothing. `CompileResult::Success.ast` is now
`Option<react_compiler_ast::File>`; the napi bridge keeps its JSON
boundary by serializing at the edge, while the oxc and swc frontends
consume the typed AST directly.

This ports the typed-AST patch the Oxc team carries on their fork
(co-authored with Boshen), which also makes their integration patch-free
going forward.

Verified: cargo workspace tests, both snap channels 1804/1804, e2e
comparison harness at parity baseline (1802 byte-identical, fbt
local-require the one known divergence).

First of a stack of three with #36730 and #36731.

Co-authored-by: Boshen <[email protected]>
Browse files
Changed paths4 files
First-parent comparison
M compiler/crates/react_compiler/src/entrypoint/compile_result.rs ModifiedM compiler/crates/react_compiler/src/entrypoint/program.rs ModifiedM compiler/crates/react_compiler_oxc/src/lib.rs ModifiedM compiler/crates/react_compiler_swc/src/lib.rs Modified
Patch

Files changed

Rendering syntax-highlighted changes…