API reference/API reference

API reference

Parse source text into an AST compatible with ESTree, inspect or edit its nodes, and generate code with SWC Next's JavaScript packages.

JavaScript

APIFunctions and types
CoreNode.js and browser packages, exports, and WebAssembly initialization
ParserparseSync, parser options, results, and diagnostics
Walkwalk, visitor hooks, traversal context, and createWalker
CodegenprintSync, formatting options, and generated output
AST typesNode declarations and source positions

Compiler components

Compiler components operate on the flat AST to resolve names, lower syntax, optimize programs, and generate declarations.