RepoPilot

rollup/rollup

Next-generation ES module bundler

Mixed

Mixed signals — read the receipts

ConcernsDependency

non-standard license (Other)

HealthyFork & modify

Has a license, tests, and CI — clean foundation to fork and modify.

HealthyLearn from

Documented and popular — useful reference codebase to read through.

HealthyDeploy as-is

No critical CVEs, sane security posture — runnable as-is.

  • Concentrated ownership — top contributor handles 61% of recent commits
  • Non-standard license (Other) — review terms
  • Scorecard: dangerous CI workflow (0/10)
  • Used by 1 trusted project: vitejs/vite
  • Last commit today
  • 20 active contributors
  • Other licensed
  • CI configured
  • Tests present

What would improve this?

  • Use as dependency Concerns to Mixed if: clarify license terms

Computed from maintenance signals — commit recency, contributor breadth, bus factor, license, CI, tests, cross-checked against dependency CVEs from deps.dev and OpenSSF Scorecard

Informational only. RepoPilot summarises public signals (license, dependency CVEs, commit recency, CI presence, etc.) at the time of analysis. Signals can be incomplete or stale. Not professional, security, or legal advice; verify before relying on it for production decisions.

Want this for your own repo?

Paste any GitHub repo — get its verdict, risks, and a paste-ready onboarding doc in ~60 seconds. Free, no sign-up.

Embed the "Forkable" badge

Paste into your README — live-updates from the latest cached analysis.

Variant:
RepoPilot: Forkable
[![RepoPilot: Forkable](https://repopilot.app/api/badge/rollup/rollup?axis=fork)](https://repopilot.app/r/rollup/rollup)

Paste at the top of your README.md — renders inline like a shields.io badge.

Preview social card

This card auto-renders when someone shares https://repopilot.app/r/rollup/rollup on X, Slack, or LinkedIn.

Ask AI about rollup/rollup

Grounded in the actual source code. Pick a starter question or write your own.

Or write your own question

Onboarding doc

Onboarding: rollup/rollup

Generated by RepoPilot · 2026-06-28 · Source

🎯Verdict

Mixed — Mixed signals — read the receipts

  • Used by 1 trusted project: vitejs/vite
  • Last commit today
  • 20 active contributors
  • Other licensed
  • CI configured
  • Tests present
  • ⚠ Concentrated ownership — top contributor handles 61% of recent commits
  • ⚠ Non-standard license (Other) — review terms
  • ⚠ Scorecard: dangerous CI workflow (0/10)

<sub>Computed from maintenance signals — commit recency, contributor breadth, bus factor, license, CI, tests, cross-checked against dependency CVEs from deps.dev and OpenSSF Scorecard</sub>

TL;DR

Rollup is an ES module bundler that compiles small JavaScript/TypeScript pieces into optimized single files or library bundles, supporting both modern ESM and legacy formats (IIFE, CommonJS, UMD). It's written primarily in JavaScript/TypeScript with performance-critical Rust components, and serves as the de facto standard bundler for npm libraries and modern web applications. Monorepo structure: core bundler logic in src/ (JavaScript/TypeScript), browser-specific build in browser/src/ with polyfilled fs.ts and path.ts, Rust FFI bindings for performance-critical parsing/linking. CI/GitHub workflows in .github/, configuration templates and documentation at root level (ARCHITECTURE.md for detailed layout), test fixtures and integration tests distributed across the src tree.

LLM-derived; treat as a starting point, not verified fact.

👥Who it's for

Library authors bundling npm packages, framework maintainers (React, Vue, Svelte all use Rollup), and application developers who need tree-shaking and code-splitting for modern ESM workflows. Specifically: engineers shipping isomorphic code, plugin developers extending bundler functionality, and teams standardizing on ES modules across their build pipeline.

LLM-derived; treat as a starting point, not verified fact.

🌱Maturity & risk

Highly mature and production-ready. The codebase shows 8.4M+ LOC of JavaScript, comprehensive CI/CD via GitHub Actions (build-and-tests.yml, performance-report.yml), extensive test coverage (.nycrc config present), and multiple stable release channels (CHANGELOG-0.md through CHANGELOG.md indicate v4+ releases). Last commit recency and active issue triage visible in workflow setup confirm ongoing maintenance.

Standard open source risks apply.

LLM-derived; treat as a starting point, not verified fact.

Active areas of work

Active v4.x development cycle (version 4.62.2 visible in browser/package.json). Ongoing CI infrastructure maintenance (repl-artefacts.yml, clean-cache.yml workflows suggest REPL upkeep and performance monitoring). Bug fixes and feature work tracked via issue templates (bug.yaml, feature.yaml, modification.yaml) in .github/ISSUE_TEMPLATE/, with Dependabot dependency scanning enabled.

LLM-derived; treat as a starting point, not verified fact.

🚀Get running

git clone https://github.com/rollup/rollup.git
cd rollup
npm install
npm test

For local development with the CLI: npm run build then node dist/rollup.js --help to verify the build.

Daily commands:

npm run build       # Build bundler from TypeScript to dist/
npm run dev         # Watch mode (inferred from .husky pre-commit setup)
npm test            # Run test suite
npm run lint        # ESLint via .lintstagedrc.js

🗺️Map of the codebase

  • src/index.ts — Main entry point for Rollup bundler; defines the core rollup() function and public API
  • src/rollup/index.ts — Central bundler orchestrator handling the build pipeline, module resolution, and code generation
  • src/ast/nodes/Program.ts — AST node representing the root module; critical for tree-shaking and module transformation
  • cli/run/index.ts — CLI command dispatcher; entry point for command-line interface and watch mode handling
  • build-plugins — Custom Rollup plugins used in Rollup's own build; demonstrates plugin architecture and conventions
  • ARCHITECTURE.md — High-level design documentation explaining bundler phases, AST transformation, and module resolution

🧩Components & responsibilities

  • Graph (src/Graph.ts) (TypeScript, AST analysis) — Manages module dependency resolution and tree-shaking via binding analysis
    • Failure mode: Circular dependencies undetected; incorrect tree-shaking due to false bindings
  • Module (src/Module.ts) (Custom AST parser, binding analysis) — Parses single ES module, extracts imports/exports, and builds identifier bindings
    • Failure mode: Parse errors; incorrect binding detection causing false positives in tree-shaking
  • PluginDriver (src/utils/pluginDriver.ts) (Async hook system, plugin interface) — Orchestrates plugin hook execution and context injection throughout bundler phases
    • Failure mode: Hook ordering errors; plugin exceptions crashing entire build without recovery
  • Bundler (src/Bundler.ts) (TypeScript, output generation) — Coordinates build phases and generates output in specified format
    • Failure mode: Format-specific bugs; incorrect chunk splitting or missing exports
  • CLI (cli/run/index.ts) (Node.js fs, config loading) — Parses command-line arguments, loads config, and orchestrates build or watch mode
    • Failure mode: Config parsing failures; watch mode race conditions
  • Browser Shims (browser/src/) (WASM, browser APIs) — Polyfills Node.js APIs (fs, path, process) for browser bundler execution
    • Failure mode: Missing API coverage; WASM initialization failures in REPL

🔀Data flow

  • User Config / CLI ArgsBundler Engine (src/rollup/index.ts) — Configuration object and normalized options passed to bundler initialization
  • Bundler EngineGraph (src/Graph.ts) — Entry points and output options used to recursively load and analyze modules
  • GraphModule (src/Module.ts) — Specifiers resolved to file paths; modules parsed and binding maps extracted
  • Module AST + BindingsTree-Shake Analysis — Binding information used to mark used/unused exports and eliminate dead code
  • Tree-Shaken ModulesOutput Generator (src/Bundler.ts) — Filtered modules rendered into format-specific bundle (esm, umd, iife, cjs)
  • Output GeneratorFile System / Browser Memory — Generated bundle written to disk or returned as string for browser execution

🛠️How to make changes

Add a New AST Node Type

  1. Define the TypeScript class in src/ast/nodes/ extending Node base class (src/ast/nodes/index.ts)
  2. Implement toString() method for code generation and any visit() hook handling (src/ast/nodes/[YourNodeType].ts)
  3. Register binding analysis in src/ast/analyze.ts if identifier binding is needed (src/ast/analyze.ts)
  4. Add parsing logic to the parser to create instances of your node type (src/Module.ts)

Add a New Plugin Hook

  1. Define hook type in src/types/rollup/plugin.d.ts or related interface (src/rollup/index.ts)
  2. Call await this.pluginDriver.hookParallel() or hookSeq() at appropriate build phase (src/rollup/index.ts)
  3. Document the hook in docs/ with parameter and return value specifications (docs)

Add a New Output Format

  1. Create output generator in src/ handling format-specific rendering (src/Bundler.ts)
  2. Integrate into Bundler.generate() conditionally based on output.format option (src/Bundler.ts)
  3. Add format-specific tests and update CLI help documentation (cli/help.md)

Add a Browser Shim for a Node.js Module

  1. Create shim implementation in browser/src/ with minimal API surface (browser/src/[moduleName].ts)
  2. Register alias mapping in build-plugins/replace-browser-modules.ts (build-plugins/replace-browser-modules.ts)
  3. Export from browser/src/index.ts to make available in browser build (browser/src)

🔧Why these technologies

  • TypeScript — Type safety for complex AST transformations and plugin system with ~600 files
  • Custom AST Parser — Precise control over ES module semantics, binding analysis, and tree-shaking optimization
  • Plugin Architecture (async hooks) — Extensibility for resolvers, transformers, and output formatters without forking
  • WASM (optional) — Browser-compatible bundling via WebAssembly compilation path for REPL

⚖️Trade-offs already made

  • Single-threaded, graph-based bundling vs. parallel module processing

    • Why: Simplifies dependency ordering and caching; avoids race conditions in tree-shaking
    • Consequence: Slower on multi-core systems but more predictable and debuggable
  • Custom AST over acorn/babel

    • Why: Exact control over bindings and dead-code analysis without third-party overhead
    • Consequence: Maintenance burden for parser; tight coupling to ES module semantics
  • Browser build with Node.js shims vs. separate bundle

    • Why: Reuse same bundler logic in browser via shims for fs, path, process
    • Consequence: Added complexity in build-plugins but enables REPL and browser IDE integrations

🚫Non-goals (don't propose these)

  • Does not handle CommonJS module transformation (requires plugins for cjs compatibility)
  • Does not optimize bundle size beyond tree-shaking; minification delegated to external tools
  • Does not provide source-map manipulation or advanced error recovery
  • Does not support synchronous bundling; all operations are async

📊Code metrics

  • Avg cyclomatic complexity: ~7.2 — Complex AST transformations, tree-shaking binding analysis, and plugin hook orchestration; heavy use of recursive module traversal
  • Largest file: src/ast/nodes/Program.ts (2,800 lines)
  • Estimated quality issues: ~12 — AST analysis logic tightly coupled with rendering; limited test coverage for edge cases in binding analysis; error messages lack source location precision

⚠️Anti-patterns to avoid

  • Mutable Global State in Plugins (High)src/utils/pluginDriver.ts, plugin hook contexts: Plugin hooks can mutate shared context; no isolation between concurrent plugin executions
  • Loose Error Handling in AST Traversal (Medium)src/ast/analyze.ts, src/Module.ts: Parse errors may not include precise source locations; difficult to debug binding analysis failures
  • Implicit Module Ordering Assumptions (Medium)src/Bundler.ts output generation: Module concatenation order relied upon for correct semantics; no explicit ordering guarantees
  • Cache Invalidation Complexity (Medium)cli/run/watchHooks.ts: Watch mode cache invalidation rules are scattered; difficult to ensure all deps are recomputed on change

🔥Performance hotspots

  • src/Graph.ts buildGraph() (I/O Bottleneck) — Module resolution and loading serialized per import; cannot parallelize resolution across dependency tree
  • src/ast/analyze.ts (Computation Bottleneck) — Full AST traversal for each module binding analysis; no caching of identifier scope maps across builds
  • src/Bundler.ts generate() (Rendering Bottleneck) — Code rendering concatenated sequentially; no chunking parallelization in multi-chunk builds
  • cli/run/index.ts watch mode (Watch Mode Bottleneck) — Full graph rebuild on any file change; incremental module updates not implemented

🪤Traps & gotchas

  1. Pre-commit hooks (.husky/pre-commit) enforce linting via .lintstagedrc.js — commits fail if code is not formatted; run npm run lint --fix first. 2) Workspace-aware: rollup exports both ESM (dist/es/) and CJS (dist/) — test both formats if modifying exports. 3) Rust FFI for perf-sensitive code paths — changes to native binding calls require Rust toolchain + wasm-pack setup (check .tool-versions for pinned versions). 4) Browser build uses polyfilled fs/path (browser/src/fs.ts, browser/src/path.ts) — file I/O semantics differ from Node.js. 5) Tests require specific Node version from .tool-versions or .nvmrc — version mismatches cause cryptic failures.

🏗️Architecture

💡Concepts to learn

  • Tree-shaking (Dead Code Elimination) — Core Rollup feature that statically analyzes unused exports and removes them; requires understanding ESM static analysis and side-effect tracking (see src/ast/Variable.ts).
  • Code Splitting and Chunk Strategy — Rollup splits bundles into multiple chunks for lazy loading; understanding chunk boundaries, entry points, and shared dependencies is critical for contributing to src/Bundle.ts and src/Chunk.ts.
  • Module Resolution and Conditional Exports — Rollup's resolver (src/utils/resolveId.ts) must handle Node.js package.json exports field, subpath patterns, and ESM-first resolution; essential for plugin and core debugging.
  • AST Walking and Scope Analysis — Rollup performs static analysis on Acorn/estree ASTs (src/ast/) to track variable bindings, identify side effects, and determine reachability; foundational for tree-shaking and transformation.
  • Plugin Hook System and Lifecycle — Extensibility via plugins (resolveId, load, transform, generateBundle, etc.); src/utils/PluginDriver.ts orchestrates hook execution; critical for understanding how plugins integrate.
  • Rollup's Chunk Format Outputs (IIFE, CJS, UMD, ESM) — Rollup generates code in multiple formats; understanding format-specific wrapping (IIFE for browsers, CJS for Node) is necessary for debugging output issues.
  • WASM and Rust FFI for Performance — Performance-critical code (parsing, linking) uses Rust via WASM or native bindings; understanding the bridge is essential for perf contributions and debugging native code failures.
  • evanw/esbuild — Alternative ES module bundler written in Go, much faster but less configurable; direct competitor for performance-critical builds.
  • webpack/webpack — Legacy bundler standard; Rollup specifically targets simpler, faster bundling vs Webpack's flexibility; many projects migrate from Webpack → Rollup for libraries.
  • vitejs/vite — Modern dev server and build tool that uses Rollup as its production bundler; primary downstream consumer and integration test suite.
  • swc-project/swc — Rust-based JavaScript compiler and bundler; shares Rollup's philosophy of Rust for performance but offers different plugin API; used alongside Rollup in some toolchains.
  • rollup/plugins — Official plugin monorepo (rollup/plugins) — essential reference for plugin API, includes @rollup/plugin-node-resolve, @rollup/plugin-commonjs, and others that extend Rollup's core.

🪄PR ideas

Click to expand

To work on one of these in Claude Code or Cursor, paste: Implement the "<title>" PR idea from CLAUDE.md, working through the checklist as the task list.

Add comprehensive test suite for browser build polyfills (browser/src/)

The browser/ directory contains critical polyfill modules (fs.ts, path.ts, process.ts, performance.ts, wasm.ts) that replace Node.js APIs for browser environments, but there's no visible test coverage for these modules. Since this is a published @rollup/browser package with its own npm distribution, these polyfills need robust test coverage to ensure browser compatibility and prevent regressions. This is high-value because bundle consumers depend on these shims working correctly.

  • [ ] Create test/browser/ directory structure mirroring browser/src/
  • [ ] Add unit tests for browser/src/fs.ts covering readFileSync, readFile, and other exposed methods
  • [ ] Add tests for browser/src/path.ts validating path manipulation in browser context
  • [ ] Add tests for browser/src/process.ts env and cwd implementations
  • [ ] Add integration test for browser/src/wasm.ts initialization and module loading
  • [ ] Integrate new tests into .github/workflows/build-and-tests.yml to run on all PRs

Create specific documentation for build-plugins/ architecture in ARCHITECTURE.md

The build-plugins/ directory contains 13+ custom Rollup plugins (add-cli-entry.ts, emit-wasm-file.ts, replace-browser-modules.ts, etc.) that are critical to the Rollup build process itself, but ARCHITECTURE.md exists without clear explanation of when/why each plugin is used. New contributors rebuilding the bundler or modifying the build process lack guidance. This is concrete because the file exists but is incomplete regarding this specific subsystem.

  • [ ] Review each file in build-plugins/ and understand its purpose in the build chain
  • [ ] Add 'Build System Plugins' section to ARCHITECTURE.md documenting the plugin pipeline
  • [ ] Document the order plugins execute in (reference rollup.config.js or similar)
  • [ ] Explain use cases: add-cli-entry (CLI integration), emit-wasm-file (WASM distribution), replace-browser-modules (browser polyfills)
  • [ ] Add examples showing how to modify/extend build-plugins safely
  • [ ] Reference which plugins are used for main package vs @rollup/browser distribution

Add performance regression tests for key bundling scenarios in CI

.github/workflows/performance-report.yml exists but likely only runs on demand. Create a baseline performance test suite that runs on every PR to detect regressions in core bundling operations (tree-shaking, code-splitting, minification). This prevents performance degradation from being merged silently. The repo already has .nycrc (coverage config) and performance infrastructure, so this extends existing patterns.

  • [ ] Create test/performance-regression/ directory with benchmark fixtures (small, medium, large bundle scenarios)
  • [ ] Add test runner that bundles each fixture and compares bundle size/build time against baseline
  • [ ] Store baseline metrics in .github/performance-baseline.json (version-controlled reference)
  • [ ] Create GitHub Action that runs on all PRs, posts results as comment if delta > threshold (e.g., +5% size)
  • [ ] Document baseline update process in CONTRIBUTING.md for maintainers
  • [ ] Integrate into build-and-tests.yml workflow with conditional failure on regression > 10%

🌿Good first issues

  • Add tree-shaking tests for complex module patterns (circular deps, re-exports) — src/tests/ lacks coverage for edge cases in src/ast/Variable.ts side-effect tracking.: Critical for bundler correctness; visible gaps in test matrix for CommonJS-to-ESM interop.
  • Document plugin hook ordering and timing in ARCHITECTURE.md — currently only CONTRIBUTING.md mentions the lifecycle; add a table with hook execution order (resolveId → load → transform → generateBundle) and examples.: Plugin authors frequently ask; inline documentation gaps cause misunderstandings.
  • Expand browser/ polyfill compatibility tests — browser/src/fs.ts and path.ts are minimal stubs; add tests for path.resolve(), path.join(), and fs.readFile() edge cases across browsers.: Browser bundling is a growing use case; gaps block adoption in web-based IDEs and REPL tools.
  • Add error message improvements for unresolved imports — src/utils/resolveId.ts throws generic 'failed to resolve' without suggestions; add 'did you mean' logic for typos.: UX improvement that reduces support burden; similar tools (esbuild, webpack) do this.

Top contributors

Click to expand

📝Recent commits

Click to expand
  • ff0a94b — chore(deps): update dependency eslint-plugin-unicorn to v68 (#6424) (renovate[bot])
  • 0c52acd — docs: update x_google_ignoreList link to canonical URL (#6421) (DucMinhNe)
  • 2b14968 — fix(deps): update minor/patch updates (#6422) (renovate[bot])
  • 5e5d1b9 — chore(deps): lock file maintenance (#6426) (renovate[bot])
  • cb000f2 — chore(deps): update actions/checkout action to v7 (#6423) (renovate[bot])
  • ff94a86 — chore(deps): lock file maintenance (#6425) (renovate[bot])
  • 8faa187 — 4.62.2 (lukastaegert)
  • a38a795 — refactor(rust/parser_ast): extract property AstConverter write buffer kind logic to new method (#6416) (fabianbernhart)
  • 6cc5c31 — Skip side-effect-free external imports when hoisting is disabled (#6411) (morgan-coded)
  • caacf70 — 4.62.1 (lukastaegert)

🔒Security observations

Click to expand

The Rollup browser build package demonstrates a strong security posture with minimal critical vulnerabilities. The codebase has established security infrastructure including a SECURITY.md file, Dependabot configuration for dependency management, and husky pre-commit hooks for code quality. Main recommendations focus on tightening dependency version specifications, restricting exported files, and enhancing security documentation. No hardcoded credentials, injection vulnerabilities, or critical misconfigurations were detected in the provided file structure. The project follows security best practices with GitHub's private vulnerability reporting mechanism.

  • Low · Dependency Version Pinning - @types/estree — browser/package.json - dependencies. The @types/estree dependency is pinned to version 1.0.9. While this is a type definition package with minimal risk, pinning to exact versions can prevent security patches in minor/patch releases. Consider using a caret (^) or tilde (~) range for type packages. Fix: Update dependency specification from '1.0.9' to '^1.0.9' to allow patch and minor updates, or implement automated dependency scanning and updates via Dependabot (which is already configured in .github/dependabot.yml)
  • Low · Broad File Export Patterns — browser/package.json - exports. The package.json exports configuration includes './dist/' which exposes all files in the dist directory without explicit control. This could potentially expose internal files or build artifacts that weren't intended for public consumption. Fix: Replace the broad './dist/' pattern with explicit export paths for only the intended public API. For example, explicitly list only the necessary files like './dist/rollup.browser.d.ts' and './dist/rollup.browser.js'
  • Low · Missing Content Security Policy Headers — .github/workflows/repl-artefacts.yml, browser distribution. The browser build is a bundler that runs in browsers, but there are no visible CSP or security header configurations in the provided file structure. If a REPL or playground is served (indicated by repl-artefacts in workflows), it may lack proper security headers. Fix: Ensure any web-served components (like a REPL) include proper security headers: Content-Security-Policy, X-Content-Type-Options, X-Frame-Options, and Strict-Transport-Security
  • Low · Incomplete SECURITY.md Documentation — SECURITY.md. While a SECURITY.md file exists with vulnerability reporting guidelines, it lacks information about security best practices for users of the library, supported versions for security updates, or a security update timeline. Fix: Expand SECURITY.md to include: (1) Supported version ranges for security fixes, (2) Expected timeframe for security patch releases, (3) Known limitations or security considerations for users, (4) Links to security advisories

LLM-derived; treat as a starting point, not a security audit.

The exported doc (Copy CLAUDE.md / Download / .cursor/rules) also includes an agent protocol and a verification script written for AI coding agents — omitted here to keep this view scannable.

Embed this chat in your README

Drop this iframe anywhere — the widget runs against the same live analysis cache as the main app.

<iframe
  src="https://repopilot.app/embed/rollup/rollup"
  width="100%" height="500"
  style="border:1px solid #d0d7de; border-radius:8px;"
  allow="microphone"
  loading="lazy"
></iframe>