CodeVetter
← All unpacks
CodeVetter · Repo Unpack evidence

swc-project/swc

Scanned commit 3c46139b86 dated 2026-10-02 — last upstream commit. Generated by codevetter 1.15.0 on 2026-10-02.

github.com/swc-project/swc ↗ · 4000 files · 9.6 MB · scan capped

Make the web (development) faster. SWC (stands for Speedy Web Compiler) is a super-fast TypeScript / JavaScript compiler written in Rust.

Deep analysis by cli:codex via the codex CLI on 2026-10-02 (583s) — every claim below links to its cited source files. Source inspection; upstream code and tests were not executed.

Overview

SWC is a Rust compiler toolkit for JavaScript and TypeScript, exposed through Rust libraries, native Node packages, WebAssembly bindings, and a standalone CLI. Its central pipeline parses source into an AST, applies configurable transforms or plugins, and emits code with optional source maps; related packages handle HTML, CSS, and React Compiler functionality. At commit 3c46139b86b27a7b3fefcf7b19ca07a63de9db0a, native packages also contain compressed carriers that verify and materialize the original addon before loading it. This brief reflects bounded source inspection, including more than twelve implementation files and concrete loading, transformation, AST round-trip, minification, and CLI flows.

System map

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.

Feature catalog

The principal public features are parsing, transformation, printing, and minification through synchronous and asynchronous APIs. Configuration supports language lowering, module formats, source maps, and custom transformations. Additional surfaces provide bundling, CLI compilation, HTML minification, CSS components, and React analysis. Availability depends on binding, target, and Cargo features; command names alone do not establish implementation.

Data flow

JavaScript requests cross the native boundary as source strings, serialized Programs, and JSON option buffers. Compiler instances own source maps, while AST envelopes preserve enough original source information to restore positions across calls. Configuration builds the transformation pass and output metadata before code generation. Persistent state mainly appears in native image and plugin caches; CLI handlers separately own generated-file writes.

Behavior traces

The inspected flows trace concrete calls across JavaScript, native bindings, compiler configuration, and output boundaries. Startup includes platform selection and, for carrier packages, verified materialization before dynamic loading. Transformation and AST round-tripping take different compiler ownership branches. Minification and CLI output provide additional complete paths with explicit failure conditions.

Testing signals

Tests and CI were inspected, not executed; no passing result or coverage percentage is asserted. The inspected suites combine Rstest API assertions, Rust tests and fixture macros, external execution comparisons, and Node test-runner release contracts. Coverage includes source-context behavior, compiler ordering, source maps, native cache repair, and parser conformance. Feature gates, exclusions, optional suites, and selective CI matrices limit what test existence establishes.

Risk map

The security-sensitive surfaces are native dynamic loading, cache filesystem operations, executable configuration, plugins, subprocesses, and release automation. The observations below describe explicit source behavior and trust assumptions, not confirmed vulnerabilities. Correctness risks include panic-based input handling, feature-dependent unfinished APIs, and silent loss of AST context through ordinary serialization. This bounded inspection cannot establish repository-wide absence of other risks or tests.

Extension points

SWC primarily extends through typed passes, visitor traits, feature-gated modules, and binding adapters. Plugins have a configurable sequence and an injectable execution runtime rather than a single permanently fixed backend. CLI operations follow a command enum and execution trait. Generated visitors and release carrier formats introduce additional maintenance contracts that extensions must preserve.

Contributor handoff

Begin with the public API and the smallest corresponding binding/compiler/configuration files, then follow the exact input and output branches. Preserve pass ordering, source-context ownership, generated artifacts, and feature-dependent behavior. Tests and CI were inspected, not executed, and this brief provides bounded onboarding evidence rather than a whole-repository audit. The commands below describe repository verification expectations for separately authorized implementation work.

Languages

LanguageFilesShare of source
JavaScript3717676%
JSON14503docs/config
TypeScript1016221%
HTML2689docs/config
CSS1921docs/config
Rust14693%
Markdown161docs/config
TOML1580%

Start reading here

Probable source entrypoint: Cargo.toml — inferred from the directory tree and manifest, not the upstream docs.

Source roots

crates/ (3404 files) packages/ (219 files)

Source layout — crates/

PathFiles
crates/ast_node/1
crates/better_scoped_tls/2
crates/binding_macros/1
crates/dbg-swc/1
crates/from_variant/1
crates/hstr/3
crates/jsdoc/37

Repository structure

Top-level pathFiles
crates/3404
packages/219
bindings/119
.github/108
scripts/60
tools/14
xtask/13
docs/10

Docs found: AGENTS.mdARCHITECTURE.mdCLAUDE.mdCONTRIBUTING.mdREADME.mddocs/adr/00000-whats-the-big-idea.mddocs/adr/00001-support-transformation-plugin-native.mddocs/adr/00002-support-event-trace-profiling.mddocs/adr/00003-reserve-bytepos-0-for-dummy-span.mddocs/adr/00004-add-ast-path-info-to-visitor.md

Package

Cargo.toml — , 0 declared dependencies.

CI & config entrypoints

Structural health signals

Average score 8.1/10 across 96 analyzed source files; 15 hotspots surfaced.

These are deterministic review leads — size, churn, and structural signals — not proof of a bug in this project.

Recent history