Skip to content

feat(rust): introduce rolldown_watcher#8161

Merged
graphite-app[bot] merged 1 commit intomainfrom
02-02-feat_rust_introduce_rolldown_watcher_
Feb 9, 2026
Merged

feat(rust): introduce rolldown_watcher#8161
graphite-app[bot] merged 1 commit intomainfrom
02-02-feat_rust_introduce_rolldown_watcher_

Conversation

@hyf0
Copy link
Member

@hyf0 hyf0 commented Feb 1, 2026

  • For each event, rollup will wait for its all listeners's finish. This PR uses trait-based design for dispatching events to stimulate similar behaviors.
  • Most of design is inspired from dev engine. I keep them separated instead of merging them together, because DevEngine is too complicated to be used for watch scenario.
  • Might have some bad smells. Will improve it in later PRs.

Copy link
Member Author

hyf0 commented Feb 1, 2026


How to use the Graphite Merge Queue

Add the label graphite: merge-when-ready to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@netlify
Copy link

netlify bot commented Feb 1, 2026

Deploy Preview for rolldown-rs canceled.

Name Link
🔨 Latest commit 9a5231f
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/6989d99278cf74000883accb

@hyf0 hyf0 force-pushed the 02-02-feat_rust_introduce_rolldown_watcher_ branch from 189e993 to e559fae Compare February 8, 2026 15:29
@hyf0 hyf0 marked this pull request as ready for review February 8, 2026 15:29
@hyf0 hyf0 requested review from Copilot and sapphi-red and removed request for Copilot February 8, 2026 15:29
@github-actions
Copy link
Contributor

github-actions bot commented Feb 8, 2026

Benchmarks Rust

  • target: main(c81f0af)
  • pr: 02-02-feat_rust_introduce_rolldown_watcher_(ac45759)
group                                                        pr                                     target
-----                                                        --                                     ------
bundle/bundle@multi-duplicated-top-level-symbol              1.05     74.7±3.14ms        ? ?/sec    1.00     70.9±2.04ms        ? ?/sec
bundle/bundle@multi-duplicated-top-level-symbol-sourcemap    1.03     80.0±2.44ms        ? ?/sec    1.00     77.7±2.22ms        ? ?/sec
bundle/bundle@rome_ts                                        1.00    103.9±2.91ms        ? ?/sec    1.01    105.4±3.03ms        ? ?/sec
bundle/bundle@rome_ts-sourcemap                              1.00    115.3±2.14ms        ? ?/sec    1.00    115.2±2.31ms        ? ?/sec
bundle/bundle@threejs                                        1.00     36.9±1.38ms        ? ?/sec    1.00     36.9±1.13ms        ? ?/sec
bundle/bundle@threejs-sourcemap                              1.00     41.5±1.05ms        ? ?/sec    1.00     41.6±1.50ms        ? ?/sec
bundle/bundle@threejs10x                                     1.00    377.6±6.61ms        ? ?/sec    1.00    376.2±6.88ms        ? ?/sec
bundle/bundle@threejs10x-sourcemap                           1.00    433.0±5.59ms        ? ?/sec    1.01   436.3±10.01ms        ? ?/sec
scan/scan@rome_ts                                            1.00     80.5±1.81ms        ? ?/sec    1.03     82.6±1.93ms        ? ?/sec
scan/scan@threejs                                            1.00     27.7±0.51ms        ? ?/sec    1.02     28.1±0.51ms        ? ?/sec
scan/scan@threejs10x                                         1.00    286.2±5.67ms        ? ?/sec    1.02    292.4±5.78ms        ? ?/sec

Copilot AI review requested due to automatic review settings February 8, 2026 15:56
@hyf0 hyf0 force-pushed the 02-02-feat_rust_introduce_rolldown_watcher_ branch from e559fae to 4bcdafc Compare February 8, 2026 15:56
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Introduces a new Rust crate rolldown_watcher implementing a watch-mode event loop with debouncing and trait-based event dispatch, plus a new example showcasing the API.

Changes:

  • Add rolldown_watcher crate (watcher + coordinator + per-task bundler integration + state machine).
  • Add a watch_new example in rolldown demonstrating watcher usage.
  • Expose a couple of experimental Bundler wrapper APIs to support watch/incremental workflows.

Reviewed changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
crates/rolldown_watcher/src/watcher.rs Public Watcher API, config mapping, and task/coordinator startup/shutdown wiring
crates/rolldown_watcher/src/watch_task.rs Per-config watch task: bundler ownership, watched-file tracking, rebuild logic, plugin hooks
crates/rolldown_watcher/src/watch_coordinator.rs Coordinator actor: debounce state machine integration and Rollup-like rebuild sequencing
crates/rolldown_watcher/src/state.rs Watcher debounce/close state machine and change de-duplication
crates/rolldown_watcher/src/msg.rs Internal messages between fs watchers and coordinator
crates/rolldown_watcher/src/lib.rs Module wiring + public re-exports
crates/rolldown_watcher/src/handler.rs Async event handler trait for watch lifecycle/change events
crates/rolldown_watcher/src/event.rs Watch event types and event payload structs
crates/rolldown_watcher/Cargo.toml New crate manifest + dependencies
crates/rolldown/src/bundler/impl_bundler_incremental_build.rs Add experimental public wrapper for cached-bundle helper
crates/rolldown/src/bundler/bundler.rs Add experimental public wrapper for resetting closed flag in watch mode
crates/rolldown/examples/watch_new.rs New example using rolldown_watcher
crates/rolldown/Cargo.toml Add rolldown_watcher dev-dependency for examples
Cargo.lock Lockfile updates for new crate/deps

@hyf0 hyf0 force-pushed the 02-02-feat_rust_introduce_rolldown_watcher_ branch from 4bcdafc to ac45759 Compare February 9, 2026 02:24
Copy link
Member Author

hyf0 commented Feb 9, 2026

Merge activity

- For each event, rollup will wait for its all listeners's finish. This PR uses trait-based design for dispatching events to stimulate similar behaviors.
- Most of design is inspired from dev engine. I keep them separated instead of merging them together, because `DevEngine` is too complicated to be used for watch scenario.
- Might have some bad smells. Will improve it in later PRs.
Copilot AI review requested due to automatic review settings February 9, 2026 12:56
@graphite-app graphite-app bot force-pushed the 02-02-feat_rust_introduce_rolldown_watcher_ branch from ac45759 to 9a5231f Compare February 9, 2026 12:56
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@graphite-app graphite-app bot merged commit 9a5231f into main Feb 9, 2026
35 checks passed
@graphite-app graphite-app bot deleted the 02-02-feat_rust_introduce_rolldown_watcher_ branch February 9, 2026 13:06
This was referenced Feb 11, 2026
shulaoda added a commit that referenced this pull request Feb 11, 2026
## [1.0.0-rc.4] - 2026-02-11

💡 Granular `comments` Option
- New `output.comments` option provides fine-grained control over comment preservation
- The `output.legalComments` option is now deprecated and use `comments.legal` instead

### 🚀 Features

- rename error name to `RolldownError` from `RollupError` (#8262) by @sapphi-red
- add hidden `resolve_tsconfig` function for Vite (#8257) by @sapphi-red
- rust: introduce `rolldown_watcher` (#8161) by @hyf0
- unify `comments` and `legalComments` into a single granular `comments` option (#8229) by @IWANABETHATGUY
- add builtin plugin for visualizing chunk graph (#8162) by @IWANABETHATGUY
- show import declaration location in AssignToImport errors (#8222) by @Copilot
- show import declaration span in CannotCallNamespace error (#8223) by @Copilot
- emit error when plugin accidentally removes runtime module symbols (#8203) by @IWANABETHATGUY
- support tsconfig loading & inputMap for `transform` (#8180) by @sapphi-red
- rolldown_plugin_vite_reporter: update warning message to link to Rolldown docs (#8205) by @sapphi-red

### 🐛 Bug Fixes

- avoid panic on untranspiled JSX syntax by reporting a diagnostic error (#8226) by @IWANABETHATGUY
- rolldown_plugin_vite_import_glob: relax absolute path check and improve invalid glob warning (#8219) by @shulaoda
- merge chunks after detect circular reference (#8154) by @IWANABETHATGUY
- rust: detect runtime module side effects based on its content (#8209) by @hyf0

### 🚜 Refactor

- rename `other` to `jsdoc` in comments options (#8256) by @IWANABETHATGUY
- rename chunk-visualize plugin with bundle-analyzer plugin (#8255) by @IWANABETHATGUY
- remove EXPORT_UNDEFINED_VARIABLE error (#8228) by @Copilot
- consolidate missing runtime symbol errors into a single diagnostic (#8220) by @IWANABETHATGUY
- stabilize `parse` and `parseSync` (#8215) by @sapphi-red
- return errors instead of panicking on builtin plugin conversion failure (#8217) by @shulaoda
- expose `parse` / `minify` / `transform` from `rolldown/utils` (#8214) by @sapphi-red
- prepare defer chunk merging (#8153) by @IWANABETHATGUY

### 📚 Documentation

- remove `<script>` escape behavior difference note from `platform` option (#8253) by @sapphi-red
- TypeScript & JSX support by plugins (#8183) by @sapphi-red

### 🧪 Testing

- ensure runtime module is preserved even if it's not used but has side effects (#8213) by @hyf0

### ⚙️ Miscellaneous Tasks

- deps: update oxc to v0.113.0 (#8267) by @renovate[bot]
- deps: update dependency oxlint-tsgolint to v0.12.0 (#8272) by @renovate[bot]
- deps: update oxc apps (#8269) by @renovate[bot]
- deps: update test262 submodule for tests (#8261) by @sapphi-red
- deps: update crate-ci/typos action to v1.43.4 (#8260) by @renovate[bot]
- deps: update dependency esbuild to v0.27.3 (#8250) by @renovate[bot]
- deps: update rust crates (#8244) by @renovate[bot]
- deps: update dependency semver to v7.7.4 (#8247) by @renovate[bot]
- deps: update github-actions (#8243) by @renovate[bot]
- deps: update npm packages (#8245) by @renovate[bot]
- deps: update oxc resolver to v11.17.1 (#8240) by @renovate[bot]
- deps: update rust crate oxc_sourcemap to v6.0.2 (#8241) by @renovate[bot]
- rust: handle ignored `RUSTSEC-2025-0141` cargo check error (#8235) by @hyf0
- deps: update dependency oxlint-tsgolint to v0.11.5 (#8233) by @renovate[bot]
- deps: update dependency rolldown-plugin-dts to ^0.22.0 (#8232) by @renovate[bot]
- deps: update crate-ci/typos action to v1.43.3 (#8225) by @renovate[bot]
- deps: update dependency rolldown-plugin-dts to v0.21.9 (#8224) by @renovate[bot]
- deps: update crate-ci/typos action to v1.43.2 (#8212) by @renovate[bot]
- remove rolldown_plugin_vite_wasm_helper (#8207) by @shulaoda
- build docs for production (#8206) by @sapphi-red

Co-authored-by: shulaoda <165626830+shulaoda@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants