dillon1000/react

Commit

[compiler] Add JSX inlining optimization (#30867)

This adds an `InlineJsxTransform` optimization pass, toggled by the
`enableInlineJsxTransform` flag. When enabled, JSX will be transformed
into React Element object literals, preventing runtime overhead during
element creation.

TODO:
- [ ] Add conditionals to make transform PROD-only
- [ ] Make the React element symbol configurable so this works with
runtimes that support `react.element` or `react.transitional.element`
- [ ] Look into additional optimization to pass props spread through
directly if none of the properties are mutated
Browse files
Changed paths8 files
First-parent comparison
M compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Pipeline.ts ModifiedM compiler/packages/babel-plugin-react-compiler/src/HIR/BuildReactiveScopeTerminalsHIR.ts ModifiedM compiler/packages/babel-plugin-react-compiler/src/HIR/Environment.ts ModifiedM compiler/packages/babel-plugin-react-compiler/src/HIR/HIRBuilder.ts ModifiedA compiler/packages/babel-plugin-react-compiler/src/Optimization/InlineJsxTransform.ts AddedM compiler/packages/babel-plugin-react-compiler/src/Optimization/index.ts ModifiedA compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/inline-jsx-transform.expect.md AddedA compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/inline-jsx-transform.js Added
Patch

Files changed

Rendering syntax-highlighted changes…