CodeVetter · Repo Unpack · Data flow
web-infra-dev/rspack
Configuration enters through either the JavaScript API or CLI loading, then becomes normalized options and native binding inputs. Loader results and compiler passes populate compilation state before assets cross the output filesystem boundary. Rebuilds carry changed paths and prior artifacts into a new compilation. Cache storage follows a separate path with namespaced keys, memory lookup, disk restoration, and deferred persistence.
- CLI config loading resolves an explicit path or discovers rspack.config, passes env and CLI options to baseLoadConfig with fresh:true, and rejects exports that are neither an object nor an array.
- loadExtendedConfig resolves file URLs, relative/absolute paths, or packages, recursively merges base configuration beneath the current result, and accumulates loaded paths in a WeakMap.
- createCompiler normalizes options and installs the Node environment before user plugins; it then applies full defaults and options-driven plugins before initialize.
- The JS-to-Rust boundary includes builtin rule references and virtual files in raw options, and adapts input filesystem callbacks only when ThreadsafeInputNodeFS.needsBinding permits it.
- Normal loaders consume content, sourceMap, and additionalData; a cache hit restores these values, while executed loaders return transformed values that can be stored for reuse.
- Pass execution checks is_enabled, recovers pass-associated incremental artifacts, invokes cache restore hooks, runs the pass, then invokes save hooks and captures artifacts only after success.
- CompilerCache prefixes facade names with compiler_path; Cache.get checks memory first, falls through to disk only for NotCached, and records disk hits or misses in memory.
- Asset output strips filename queries, joins the target with the configured output path, compares existing content when configured, writes through output_filesystem, and calls asset_emitted with source and target metadata.