graph LR
Entrypoint["Entrypoint"]
HIR_BuildHIR["HIR.BuildHIR"]
TypeInference_InferTypes["TypeInference.InferTypes"]
Inference_InferReferenceEffects["Inference.InferReferenceEffects"]
ReactiveScopes_BuildReactiveFunction["ReactiveScopes.BuildReactiveFunction"]
Optimization_DeadCodeElimination["Optimization.DeadCodeElimination"]
Validation_ValidateHooksUsage["Validation.ValidateHooksUsage"]
ReactiveScopes_CodegenReactiveFunction["ReactiveScopes.CodegenReactiveFunction"]
Entrypoint -- "initiates" --> HIR_BuildHIR
HIR_BuildHIR -- "produces HIR for" --> TypeInference_InferTypes
HIR_BuildHIR -- "produces HIR for" --> Inference_InferReferenceEffects
HIR_BuildHIR -- "produces HIR for" --> Optimization_DeadCodeElimination
HIR_BuildHIR -- "produces HIR for" --> Validation_ValidateHooksUsage
TypeInference_InferTypes -- "provides type information to" --> ReactiveScopes_BuildReactiveFunction
Inference_InferReferenceEffects -- "provides effect information to" --> ReactiveScopes_BuildReactiveFunction
ReactiveScopes_BuildReactiveFunction -- "provides reactive function representation to" --> ReactiveScopes_CodegenReactiveFunction
Optimization_DeadCodeElimination -- "contributes optimized HIR to" --> ReactiveScopes_CodegenReactiveFunction
Validation_ValidateHooksUsage -- "ensures correctness for" --> ReactiveScopes_CodegenReactiveFunction
The React Compiler Core subsystem is responsible for transforming React source code into optimized output through a multi-stage compilation pipeline. Its boundaries are defined by the compiler.packages.babel_plugin_react_compiler.src package, which encapsulates the entire compilation process from initial AST transformation to final code generation.
The primary orchestrator, initiating and managing the overall compilation flow.
Related Classes/Methods:
The initial transformation step, crucial for converting source Abstract Syntax Tree (AST) into the compiler's internal Hierarchical Intermediate Representation (HIR).
Related Classes/Methods:
Provides essential type information for subsequent analysis and optimization passes within the compiler.
Related Classes/Methods:
Determines side effects of operations, which is critical for accurate memoization and understanding reactivity within React components.
Related Classes/Methods:
A key analysis phase that identifies and constructs reactive scopes, directly impacting the compiler's memoization strategies and re-render optimizations.
Related Classes/Methods:
A standard compiler optimization that identifies and removes unreachable or unused code, improving performance and reducing the final bundle size.
Related Classes/Methods:
Ensures adherence to React's rules of Hooks, maintaining the correctness and predictability of React component behavior after compilation.
Related Classes/Methods:
The final code generation phase, responsible for transforming the optimized internal representation back into optimized JavaScript output.
Related Classes/Methods: