dillon1000/react

Commit

[rust-compiler] Drop the regex dependency from the napi binary (#36727)

The regex crate services exactly one pattern, the dynamic-gating
directive `^use memo if\(([^\)]*)\)$`, while costing ~570KB of `.text`
(regex + regex_automata + regex_syntax + aho_corasick) in the shipped
binary; after LTO the removal saves ~1MB through dead-code cascade.

Replaced with an exact hand parse: strip the `use memo if(` prefix and
`)` suffix, reject conditions containing a close paren. Equivalence with
the TS `DYNAMIC_GATING_DIRECTIVE` regex verified on the full gating
fixture directory: 30/30 byte-identical TS-vs-Rust on the e2e comparison
harness, dynamic-gating snap fixtures green.

Independent of #36726; the two compose to take the default release
binary from 11.2MB to 6.1MB.
Browse files
Changed paths3 files
First-parent comparison
M compiler/Cargo.lock ModifiedM compiler/crates/react_compiler/Cargo.toml ModifiedM compiler/crates/react_compiler/src/entrypoint/program.rs Modified
Patch

Files changed

Rendering syntax-highlighted changes…