CodeVetter · Repo Unpack · System map
swc-project/swc
SWC is organized as a compiler workspace with several embedding boundaries. Rust crates provide compilation and language infrastructure, while Node and WebAssembly bindings expose selected operations to JavaScript consumers. The standalone CLI dispatches through a separate implementation crate, and native package loading includes a verified filesystem cache. Build, test, benchmark, and publication workflows are separate operational surfaces.
- The Cargo workspace includes xtask, bindings, crates, code generation, release tooling, and the native addon packer; shared packages use Rust edition 2021.
- The compiler layers separate AST definitions, parsing, code generation, and base transforms; resolver distinguishes bindings, hygiene renames conflicting symbols, and fixer restores valid expression structure.
- @swc/core exposes a TypeScript Compiler facade backed by native bindings or @swc/wasm; SWC_BINARY_PATH overrides the native module location.
- binding_core_node is a cdylib targeting N-API 3; its default features enable swc_v1 bundling and native Wasmer plugins with filesystem caching.
- Compiler owns an Arc<SourceMap> and comments; the Node binding provides both a lazy shared compiler and get_fresh_compiler for isolated source maps.
- The standalone executable calls swc_cli_impl::run, which parses Clap options and dispatches plugin-new, compile, minify, bundle, or lint handlers.
- Development uses pnpm@10.33.3; core build scripts run TypeScript declaration generation and napi build, while package tests invoke Rstest.
- Distribution includes native npm addons and Rust crates: carrier documentation defines eight compressed targets, while automatic crate publication requires a main-branch commit beginning 'chore: Publish' and obtains crates.io authentication through OIDC.