Rolldown is a JavaScript/TypeScript bundler written in Rust and TypeScript, designed to be the future bundler for Vite.
- You are an expert Rust, JavaScript and TypeScript developer.
- Rolldown's performance is critical for developers and tools built on top of it. As such, it is critical to aim for best possible performance when optimizing Rolldown.
Design docs live in meta/design/. They capture high-level vision and design intent, giving both humans and AI a shared understanding of what the system should be.
When a design doc exists for a topic, treat it as the source of truth — read it before coding, update it before changing the design. When there isn't one, just code.
- Format: See
meta/design/template.mdfor the suggested format. Keep it freeform — one concept per file, link between docs, no rigid structure required. - Traceability: When implementing or fixing something described in a design doc, link the relevant GitHub issue/PR in commit messages or comments so progress is traceable.
TypeScript API (/packages/rolldown)
↓
NAPI Bindings (crates/rolldown_binding)
↓
Rust Core (crates/rolldown)
- This is a hybrid Rust and Node.js monorepo managed with
pnpmandcargo. crates/: All Rust crates, including the core bundler, NAPI bindings, and builtin plugins.crates/rolldown: The Rust core, implementing the bundler logic.crates/rolldown/tests: Integration tests for the Rust core.crates/rolldown_binding: Defines NAPI bindings to expose Rust functionality to Node.js.crates/rolldown_plugin: Defines the plugin interface for writing plugins in Rust.crates/rolldown_plugin_*: All builtin plugins implemented in Rust.packages/: All Node.js packages, including the mainrolldownpackage.packages/rolldown: The main Node.js package exposing the TypeScript API.packages/rolldown-tests: Test suite for therolldownpackage using Vitest.packages/rollup-tests: Compatibility test suite for Rollup plugins.docs/: Documentation site built with VitePress.meta/design/: Design documents. See the "Spec-Driven Development" section above.
MANDATORY: NEVER edit these files directly.
packages/rolldown/src/binding.js- Based oncrates/rolldown_binding, auto-generated byjust build-rolldownpackages/rolldown/src/binding.d.ts- Based oncrates/rolldown_binding, auto-generated byjust build-rolldownpackages/debug/src/generated/*- Auto-generated code for devtools integrationrollup/*- Git submodule for test fixturestest262/*- Git submodule for ECMAScript test suite
IMPORTANT: The project uses just as a task runner. Always prefer just commands over direct npm or cargo commands. Run just --list before using npm or cargo directly.
just roll- Builds, lints, and tests everything (Rust + Node.js + repo)just build-rolldown- Builds therolldownnode package, its dependencies and binding binary.just lint- Lints everything (Rust + Node.js + repo)just lint-rust- Performs Rust related lintingjust lint-node- Performs Node.js related lintingjust lint-repo- Performs repository related lintingjust test- Tests everything (Rust + Node.js)just test-rust- Tests Rust crates. Snapshots will be updated automatically if needed.just test-node- Tests Node.js packagesjust fix- Auto-fixes what can be fixed (Rust + Node.js + repo)just fix-rust- Auto-fixes Rust issuesjust fix-node- Auto-fixes Node.js issuesjust fix-repo- Auto-fixes repository issues
AGENTS.mdis the source of truth.CLAUDE.mdis a symlink to it.- Check surrounding code for conventions: Before adding new code, always study the existing patterns, naming conventions, and architectural choices in the file and directory you are working in.
- Break large changes into tracked steps: Decompose substantial work into manageable subtasks. Track progress to prevent scope creep and missed items. Use
TodoWriteor similar tools to maintain a checklist. - Batch multiple edits: Prefer to batch multiple edits over sequential single edits. Use
MultiEditor similar tools if available.