CodeVetter · Repo Unpack · Extension points
web-infra-dev/rspack
Rspack offers extension seams at the CLI, configuration, compiler hooks, native plugins, module-type parsing, loaders, filesystems, and cache services. JavaScript and Rust plugin models meet through staged hook registrations. New behavior should attach to the owning lifecycle rather than bypass its boundaries. The inspected factories and registries make these integration points concrete.
- New CLI commands implement apply(cli) and join RspackCLI.registerCommands' builtin command list; asynchronous actions use wrapAction so run can await their failures.
- Configuration accepts function plugins called with the compiler as receiver and argument, or object plugins with apply(compiler); definePlugin provides typed identity helpers for both shapes.
- Rust plugins implement Plugin: Debug + Send + Sync with apply(ApplyContext), name, and clear_cache; PluginExt boxes implementations into BoxPlugin.
- PluginDriver supplies ApplyContext with compiler/compilation/factory hooks and a ModuleType-keyed parser-and-generator builder registry.
- PassExt supports run_pass, cache-aware execution, incremental artifact groups, before/after cache hooks, and is_enabled, allowing conditional compilation transformations within the shared runner.
- CompilerBuilder accepts extra plugins and independent readable, intermediate, and writable filesystem implementations; build combines configured builtin plugins with supplied plugins.
- JavaScript hook bridging partitions taps by stage ranges, skips unused hooks, and updates non-skippable registration kinds when hook usage changes.
- Compiler.get_cache exposes namespaced CacheFacade views, while HttpUriPlugin accepts a custom httpClient and configurable filesystem-backed remote cache/lockfile locations.