CodeVetter · Repo Unpack · Extension points
rollup/rollup
Plugins are the primary public extension mechanism and receive graph, parsing, filesystem, cache, and file-emission capabilities. Hook execution categories and ordering are explicit contracts. Internal extension surfaces include option normalization, finalisers, AST schemas, and browser replacement registries. New native functions require coordinated adapters across environments.
- Plugins are objects with properties and build/output hooks; documented examples implement resolveId and load to supply virtual modules.
- PluginDriver distinguishes first-result hooks, sequential argument reduction, and parallel hooks; sequential-marked parallel hooks wait for preceding parallel work.
- Hook descriptors support pre/post ordering; validated plugins are returned as pre, normal, then post groups.
- PluginContext exposes addWatchFile, cache, fs, emitFile, getFileName, module introspection, load, parse, resolve, setAssetSource, and structured logging.
- Output plugins are appended to the base driver's plugins with shared emission state; input hooks in output-only plugins produce warnings.
- Input fs is an injectable capability used by core I/O and exposed as this.fs; browser defaults are throwing stubs checked against RollupFsModule.
- scripts/ast-types.js defines generated Rust constants, JSON decoders, internal AST parsers, and child keys; format finalisers have a separate shared function interface and registry.
- Browser substitutions are registered in JS_REPLACED_MODULES and wasmModulesMap; additional binding functions must synchronize both Rust crates and all three JavaScript handover points.