Core
The core packages provide synchronous parsing and code generation with the same function signatures and option types in Node.js and browsers.
Packages
Exports
For browser traversal, import walk from @swc-next/walker. That package is pure JavaScript and requires no initialization. createWalker and visitorKeys are also available from the walker package directly.
Browser WebAssembly
The browser package includes the WebAssembly binary and its JavaScript bindings. Its default export initializes the binding:
Await init() before calling parseSync or printSync. It loads the bundled .wasm file; after successful initialization, subsequent calls are idempotent no-ops. Serve the package with a bundler that resolves its WebAssembly asset.
Parsing and printing are synchronous after initialization. Run substantial workloads in a worker to keep the interface responsive.
Type imports
Import types alongside the functions they configure:
satisfies checks option names and values while preserving their inferred types. The browser package exports the same types from @swc-next/core-browser. Both packages also re-export AST node types, such as Program and Node.