Install
Choose the package for your runtime. The following guides show how to parse source, walk the AST, and generate code.
Node.js
Install the combined package:
It provides parseSync, printSync, and walk:
Use ESM imports, for example in an .mjs file. See the Core API for its exports.
Browser WebAssembly
Install the browser package:
Call init() once before parsing or printing. It loads the WebAssembly binary bundled with the package.
Use a bundler that serves the package's .wasm asset. For AST traversal, add the standalone @swc-next/walker package. See the Browser API for initialization and runtime details.
Focused packages
Install these separately when you only need part of the pipeline:
Continue with Parser, Walk, and Codegen. Examples use @swc-next/core; in the browser, import parsing and printing from @swc-next/core-browser after initialization, and walking from @swc-next/walker.