CodeVetter · Repo Unpack · System map
web-infra-dev/rspack
Rspack has three cooperating runtime layers: the JavaScript API, the native binding, and the Rust compilation engine. Compiler and Compilation have different lifetimes, while filesystem adapters and callback bridges connect the layers. Distribution includes npm packages, native bindings, and WASM variants rather than a single hosted service. The documentation website and repository automation have separate build responsibilities.
- The public core entrypoint attaches exports to the rspack function, aliases both rspack and webpack to that function, and provides CommonJS-compatible module.exports behavior.
- The CLI executable conditionally enables Node compile caching outside CI, imports the built CLI package, constructs RspackCLI, and passes process.argv to run.
- Compiler.#getInstance lazily constructs binding.JsCompiler with raw options, builtin plugins, hook registrations, filesystem adapters, resolver access, cache, and binding helpers.
- The Rust compiler constructs normal and context module factories, runs passes against Compilation, and collects plugin-driver diagnostics into that compilation.
- NodeEnvironmentPlugin installs a CachedInputFileSystem with a 60000 ms duration, Node fs output, and either NativeWatchFileSystem or NodeWatchFileSystem according to experiments.nativeWatcher.
- Experimental new-cache storage supports optional memory and filesystem layers; its database selects TurboDatabase on native targets and NoopDatabase on WASM.
- The Cargo workspace includes crates and xtask members with Rust 2024 metadata; pnpm includes packages, bindings, website, and test workspaces, and root scripts build the binding before JS in build:cli:dev.
- Release automation builds platform-specific npm bindings including WASI and browser variants; the separate website package uses rs doc and React/Rspress dependencies.