Skip to main content

Crate react_compiler_swc

Crate react_compiler_swc 

Source

Modules§

apply_renames
convert_ast
convert_ast_reverse
Reverse AST converter: react_compiler_ast (Babel format) → SWC AST.
convert_scope
diagnostics
prefilter

Structs§

LintResult
Result of linting a program via the SWC frontend.
TransformResult
Result of compiling a program via the SWC frontend.

Enums§

BlankLinePosition
Describes where a blank line should be inserted relative to a body item.

Functions§

emit
Emit an SWC Module to a string via swc_ecma_codegen. If transform was called on the same thread, any comments from the compiled AST are automatically included.
emit_with_comments
Emit an SWC Module to a string, optionally including comments. blank_line_positions describes where blank lines should be inserted to match Babel’s blank line behavior.
lint
Lint API — same as transform but only collects diagnostics, no AST output.
lint_source
Convenience wrapper — parses source text, then lints.
normalize_source
Normalize source code formatting to match Babel’s codegen behavior. Applied to source text that was not modified by the compiler. Currently adds blank lines after directive sequences, matching Babel’s generator which always emits a blank line after the last directive in a function/program body.
transform
Primary transform API — accepts pre-parsed SWC Module.
transform_source
Convenience wrapper — parses source text, then transforms.