Guide/Codegen
Codegen
Use printSync to turn a program AST back into source. Import it from @swc-next/core, the focused @swc-next/codegen package, or the initialized browser package.
Print an edited program
Compact output
minify controls printing and whitespace. It does not perform the optimizations described under Minifier. Printing TypeScript also preserves types.
Reference
See the Codegen API for AST and metadata inputs, the output shape, and all formatting options. For a complete workflow, start with Parser and Walk.