CodeVetter · Repo Unpack · Data flow
rollup/rollup
Input options become a normalized build configuration and then a graph of resolved modules. Loaded source passes through transform hooks before parsing and inclusion analysis. Rendering constructs output chunks, resolves content hashes, and returns files or writes them through a filesystem adapter. Incremental state is represented by module and plugin caches retained by callers or watch tasks.
- getInputOptions first processes plugin options hooks, then normalizes input options and assigns anonymous plugin names.
- resolveId asks plugins first; fallback resolution handles entry/relative/absolute paths, tries .mjs and .js, and optionally dereferences symlinks.
- addModuleSource obtains the first non-null load result or reads UTF-8 through options.fs, validates its code shape, and strips the BOM.
- transform reduces source through transform hooks while recording sourcemaps, watched transform dependencies, emitted files, and custom-cache usage.
- Module.setSource stores code and maps, initializes MagicString and AST context, then uses a provided AST or parseAsync plus convertProgram.
- ModuleLoader recursively fetches static/dynamic dependencies, links imports, and awaits moduleParsed; Graph then orders modules, binds references, and includes statements.
- renderChunks renders chunks, transforms them and obtains content-hash inputs, computes final dependency-sensitive hashes, and adds resulting chunks to the output bundle.
- Graph.getCache serializes modules and plugin cache entries with expiry eviction; writeOutputFile resolves the destination and persists asset sources or chunk code through injected mkdir/writeFile.