Skip to content

Comments

feat(dev): add debounce control and PollWatcher support to DevWatchOptions#6070

Merged
graphite-app[bot] merged 1 commit intomainfrom
09-08-feat_dev_add_debounce_control_and_pollwatcher_support_to_devwatchoptions
Sep 9, 2025
Merged

feat(dev): add debounce control and PollWatcher support to DevWatchOptions#6070
graphite-app[bot] merged 1 commit intomainfrom
09-08-feat_dev_add_debounce_control_and_pollwatcher_support_to_devwatchoptions

Conversation

@hyf0
Copy link
Member

@hyf0 hyf0 commented Sep 8, 2025

Extends DevWatchOptions with useDebounce and debounceDuration options,
and implements smart watcher selection based on polling and debounce preferences.
Adds non-debounced PollWatcher for immediate file change responses.

Key Changes:

  • Add useDebounce and debounceDuration to DevWatchOptions across all layers
  • Implement PollWatcher for use_polling=true + use_debounce=false scenarios
  • Update watcher selection logic with 4 combinations:
    • Polling + no debounce → PollWatcher
    • Polling + debounce → DebouncedPollWatcher
    • Native + no debounce → RecommendedWatcher
    • Native + debounce → DebouncedRecommendedWatcher
  • Expose new options through TypeScript API wrapper
  • Update NAPI bindings and Rust core with proper option propagation

This enables fine-grained control over file watching behavior:

const devEngine = await dev(input, output, {
  watch: {
    usePolling: true,
    pollInterval: 200,
    useDebounce: false, // Use non-debounced PollWatcher for immediate responses
    debounceDuration: 100
  }
});

🤖 Generated with Claude Code

Co-Authored-By: Claude [email protected]

Copy link
Member Author

hyf0 commented Sep 8, 2025


How to use the Graphite Merge Queue

Add the label graphite: merge 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 Sep 8, 2025

Deploy Preview for rolldown-rs ready!

Name Link
🔨 Latest commit 202427e
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/68bfa10e49ea550008fa1ed1
😎 Deploy Preview https://deploy-preview-6070--rolldown-rs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 8, 2025

Benchmarks Rust

  • target: main(c910a23)
  • pr: 09-08-feat_dev_add_debounce_control_and_pollwatcher_support_to_devwatchoptions(202427e)
group                                                        pr                                     target
-----                                                        --                                     ------
bundle/bundle@multi-duplicated-top-level-symbol              1.03     80.3±2.90ms        ? ?/sec    1.00     78.0±2.03ms        ? ?/sec
bundle/bundle@multi-duplicated-top-level-symbol-sourcemap    1.02     89.9±2.53ms        ? ?/sec    1.00     88.3±2.45ms        ? ?/sec
bundle/bundle@rome_ts                                        1.00    118.6±2.15ms        ? ?/sec    1.00    118.6±2.96ms        ? ?/sec
bundle/bundle@rome_ts-sourcemap                              1.02    140.8±3.68ms        ? ?/sec    1.00    138.6±2.25ms        ? ?/sec
bundle/bundle@threejs                                        1.00     44.2±1.67ms        ? ?/sec    1.02     44.9±2.35ms        ? ?/sec
bundle/bundle@threejs-sourcemap                              1.00     53.4±2.05ms        ? ?/sec    1.00     53.3±0.84ms        ? ?/sec
bundle/bundle@threejs10x                                     1.00    464.1±9.49ms        ? ?/sec    1.00    463.6±7.40ms        ? ?/sec
bundle/bundle@threejs10x-sourcemap                           1.00    543.2±8.43ms        ? ?/sec    1.00    541.3±6.68ms        ? ?/sec
scan/scan@rome_ts                                            1.00     93.2±1.64ms        ? ?/sec    1.03     96.0±2.48ms        ? ?/sec
scan/scan@threejs                                            1.01     33.7±2.06ms        ? ?/sec    1.00     33.3±0.59ms        ? ?/sec
scan/scan@threejs10x                                         1.00    348.1±4.12ms        ? ?/sec    1.01    352.1±4.12ms        ? ?/sec

@hyf0 hyf0 requested a review from sapphi-red September 8, 2025 13:04
@hyf0 hyf0 force-pushed the 09-08-feat_dev_add_debounce_control_and_pollwatcher_support_to_devwatchoptions branch from 9942a32 to bdbeaeb Compare September 8, 2025 13:18
@hyf0 hyf0 force-pushed the 09-08-feat_dev_add_debounce_control_and_pollwatcher_support_to_devwatchoptions branch from bdbeaeb to 802efed Compare September 8, 2025 13:24
@hyf0 hyf0 requested a review from shulaoda September 8, 2025 13:31
@hyf0 hyf0 force-pushed the 09-08-feat_dev_add_debounce_control_and_pollwatcher_support_to_devwatchoptions branch from 802efed to e1958be Compare September 8, 2025 15:48
@hyf0 hyf0 force-pushed the 09-08-feat_dev_add_debounce_control_and_pollwatcher_support_to_devwatchoptions branch from e1958be to 9d4e121 Compare September 8, 2025 16:16
@sapphi-red
Copy link
Member

What is the reason to introduce a non-debounced one?

@hyf0
Copy link
Member Author

hyf0 commented Sep 9, 2025

What is the reason to introduce a non-debounced one?

I want to make them all configurable, so we could test the performance of all situations in benchmark in the future.

@graphite-app
Copy link
Contributor

graphite-app bot commented Sep 9, 2025

Merge activity

…tions (#6070)

Extends DevWatchOptions with useDebounce and debounceDuration options,
and implements smart watcher selection based on polling and debounce preferences.
Adds non-debounced PollWatcher for immediate file change responses.

Key Changes:
- Add useDebounce and debounceDuration to DevWatchOptions across all layers
- Implement PollWatcher for use_polling=true + use_debounce=false scenarios
- Update watcher selection logic with 4 combinations:
  * Polling + no debounce → PollWatcher
  * Polling + debounce → DebouncedPollWatcher
  * Native + no debounce → RecommendedWatcher
  * Native + debounce → DebouncedRecommendedWatcher
- Expose new options through TypeScript API wrapper
- Update NAPI bindings and Rust core with proper option propagation

This enables fine-grained control over file watching behavior:
```typescript
const devEngine = await dev(input, output, {
  watch: {
    usePolling: true,
    pollInterval: 200,
    useDebounce: false, // Use non-debounced PollWatcher for immediate responses
    debounceDuration: 100
  }
});
```

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@graphite-app graphite-app bot force-pushed the 09-08-feat_dev_add_debounce_control_and_pollwatcher_support_to_devwatchoptions branch from 9d4e121 to 202427e Compare September 9, 2025 03:37
@graphite-app graphite-app bot merged commit 202427e into main Sep 9, 2025
26 checks passed
@graphite-app graphite-app bot deleted the 09-08-feat_dev_add_debounce_control_and_pollwatcher_support_to_devwatchoptions branch September 9, 2025 03:52
Boshen added a commit that referenced this pull request Sep 10, 2025
## [1.0.0-beta.37] - 2025-09-10

### 🚀 Features

- partial align with const inline strategy with oxc in smart mode
(#6126) by @IWANABETHATGUY
- dev: use PathsMut for non-debounced RecommendedWatcher (#6120) by
@sapphi-red
- dev: return whether the build is already scheduled from
`scheduleBuildIfStale` method (#6116) by @sapphi-red
- handle errors from `BundlerBuilder#build` (#6104) by @shulaoda
- add debounceTickRate option for debounced watchers (#6113) by @hyf0
- support full build in `incrementalBuild` mode (#6098) by
@IWANABETHATGUY
- add compare_contents_for_polling option to dev watcher (#6108) by
@hyf0
- dev: add `scheduleBuildIfStale` method to DevEngine (#6087) by
@sapphi-red
- dev: return changed files in onHmrUpdates callback (#6086) by
@sapphi-red
- support function config with custom CLI arguments (#6076) by
@IWANABETHATGUY
- improve `MISSING_EXPORT` warning to suggest `type` modifier (#6085) by
@sapphi-red
- crates/rolldown_watcher: introduce `PathsMut` to batch watch/unwatch
behaviors (#6075) by @hyf0
- enable `treeshake.commonjs` by default (#6072) by @IWANABETHATGUY
- dev: add debounce control and PollWatcher support to DevWatchOptions
(#6070) by @hyf0

### 🐛 Bug Fixes

- use kqueue for file watch on mac (#6124) by @sapphi-red
- use patched notify for better file change event debouncing (#6125) by
@sapphi-red
- support passing all js primitive value for `alias` plugin (#6123) by
@IWANABETHATGUY
- track spans in member expression properties for accurate sourcemaps
(#6100) by @IWANABETHATGUY
- correctly handle inlined CommonJS exports in member expressions
(#6090) by @IWANABETHATGUY
- dev: ensure patch file names to be unique (#6096) by @sapphi-red
- dev: normalize slash on Windows before comparing paths (#6095) by
@sapphi-red
- dev/watch: debounce duration should default to 10 (#6078) by @hyf0

### 🚜 Refactor

- simplify `__export` runtime helper to create target object internally
(#6114) by @IWANABETHATGUY
- simplify module_namespace construction second try (#6118) by
@IWANABETHATGUY
- simplify module_namespace construction (#5939) by @IWANABETHATGUY
- optimize member expression creation in AstSnippet (#6091) by
@IWANABETHATGUY
- test-dev-server: sensible watcher configuration for CI env (#6077) by
@hyf0

### 🧪 Testing

- dev: apply HMR edits on Windows (#6094) by @sapphi-red

### ⚙️ Miscellaneous Tasks

- Revert "chore: adjust breaking change template of cliff (#6069)"
(#6130) by @IWANABETHATGUY
- test-dev-server: improve hmr test configuration (#6115) by @hyf0
- deps: update dependency rolldown-plugin-dts to v0.16.2 (#6128) by
@renovate[bot]
- Revert "refactor: simplify module_namespace construction (#5939)"
(#6117) by @IWANABETHATGUY
- test-dev-server: optimize test log output (#6107) by @hyf0
- enable compare_contents_for_polling and update poll interval for CI
test-dev-server (#6110) by @hyf0
- deps: update dependency vite to v7.1.5 [security] (#6111) by
@renovate[bot]
- fix warnings reported by `just lint` (#6105) by @shulaoda
- deps: update dependency tsdown to v0.15.0 (#6102) by @renovate[bot]
- use debug builds for browser tests in CI (#6092) by @hyf0
- test-dev-server: update polling interval and add retry logic for CI
tests (#6088) by @hyf0
- adjust breaking change template of cliff (#6069) by @IWANABETHATGUY

### ◀️ Revert

- "fix: replace_plugin does not work as expected with .ts config
(#5920)" (#6074) by @IWANABETHATGUY

Co-authored-by: Boshen <[email protected]>
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.

2 participants