CodeVetter · Repo Unpack · Behavior traces
rollup/rollup
Three concrete flows were followed through their implementation: CLI configuration builds, API build-to-output generation, and watch invalidation-to-rebuild. The CLI adds executable configuration loading and stdout handling around the API. The API separates graph construction from rendering and disk writes. Watch mode retains cache and coordinates asynchronous change notifications before another build.
- CLI startup runs argParser → runRollup → getConfigs; config mode resolves a configuration path and calls loadConfigFile, otherwise it loads options from the command.
- Configuration loading runs getConfigFileExport → getConfigList → mergeOptions → addCommandPluginsToInputOptions; exports may be objects, arrays, promises, or functions receiving command options.
- With configPlugin or bundleConfigAsCjs, configuration loading builds the config → generates ES/CJS code → writes a sibling temporary config → imports its default export → schedules unlink in finally.
- The CLI builds configurations sequentially; each build obtains an await-using bundle, generates the first output to stdout when destinationless, or writes configured outputs concurrently.
- API startup runs rollup → rollupInternal → getInputOptions → initWasm → Graph construction → buildStart → Graph.build → buildEnd; failures call buildEnd with the error and closeBundle.
- Output generation runs handleGenerateWrite → output option/plugin-driver setup → Bundle.generate → renderStart → generateChunks → renderChunks → generateBundle → asset finalization → filename validation.
- write additionally requires file or dir, queues writeOutputFile for generated files, and runs writeBundle after writes resolve; generate returns without this persistence branch.
- Watch startup merges/filter configs and constructs Watcher; filesystem events run Task.invalidate → Watcher.invalidate → pending-change announcements → restart → Task.run → rollupInternal → optional output writes → BUNDLE_END.