Skip to content

Comments

refactor(rust): tweak incremental build related methods of Bundler#6884

Merged
graphite-app[bot] merged 1 commit intomainfrom
11-08-refactor_rust_tweak_incremental_build_related_methods_of_bundler_
Nov 7, 2025
Merged

refactor(rust): tweak incremental build related methods of Bundler#6884
graphite-app[bot] merged 1 commit intomainfrom
11-08-refactor_rust_tweak_incremental_build_related_methods_of_bundler_

Conversation

@hyf0
Copy link
Member

@hyf0 hyf0 commented Nov 7, 2025

No description provided.

Copy link
Member Author

hyf0 commented Nov 7, 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.

@hyf0 hyf0 marked this pull request as ready for review November 7, 2025 18:33
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

This pull request refactors the bundler's scan API to support an incremental build pattern and introduces an "experimental" feature flag. The changes simplify the API by creating a new scan() method that doesn't return intermediate output, and refactor incremental build operations to use a new with_incremental_build helper that manages cache handling.

Key changes:

  • Added experimental feature flag to gate the new scan() API
  • Introduced with_incremental_build helper to encapsulate cache management for incremental builds
  • Refactored incremental_write and incremental_generate methods to use the new pattern
  • Updated watcher and dev server tasks to use the new incremental build pattern

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
crates/rolldown/Cargo.toml Adds experimental feature flag
crates/rolldown_binding/Cargo.toml Enables experimental feature for rolldown dependency
crates/bench/Cargo.toml Enables experimental feature for rolldown dependency
crates/rolldown/src/bundler/impl_bundler_build.rs Adds new scan() method gated behind experimental feature
crates/rolldown/src/bundler/impl_bundler_incremental_build.rs Refactors incremental build methods to use new with_incremental_build helper pattern
crates/rolldown_binding/src/binding_bundler_impl.rs Updates binding to use new scan API, removes ScanMode parameter
crates/rolldown/src/dev/building_task.rs Refactors rebuild logic to use new incremental API methods
crates/rolldown/src/watch/watcher_task.rs Refactors to use with_incremental_build pattern for better cache management
crates/bench/benches/scan.rs Updates benchmark to use new scan API without ScanMode parameter

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@hyf0 hyf0 force-pushed the 11-08-refactor_rust_tweak_incremental_build_related_methods_of_bundler_ branch from 5f72212 to 7f475b9 Compare November 7, 2025 18:45
@hyf0 hyf0 force-pushed the 11-08-refactor_rust_manage_build_via_buildfactory_for_bundler_ branch from 5784259 to 1c1e7cf Compare November 7, 2025 18:45
@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2025

Benchmarks Rust

  • target: 11-08-refactor_rust_manage_build_via_buildfactory_for_bundler_(c19666e)
  • pr: 11-08-refactor_rust_tweak_incremental_build_related_methods_of_bundler_(94026e8)
group                                                        pr                                     target
-----                                                        --                                     ------
bundle/bundle@multi-duplicated-top-level-symbol              1.03     64.4±1.97ms        ? ?/sec    1.00     62.3±1.16ms        ? ?/sec
bundle/bundle@multi-duplicated-top-level-symbol-sourcemap    1.01     69.9±1.98ms        ? ?/sec    1.00     69.1±1.97ms        ? ?/sec
bundle/bundle@rome_ts                                        1.01    107.4±2.35ms        ? ?/sec    1.00    105.9±1.67ms        ? ?/sec
bundle/bundle@rome_ts-sourcemap                              1.01    119.8±1.58ms        ? ?/sec    1.00    118.2±1.70ms        ? ?/sec
bundle/bundle@threejs                                        1.04     39.9±2.60ms        ? ?/sec    1.00     38.5±0.56ms        ? ?/sec
bundle/bundle@threejs-sourcemap                              1.02     42.8±0.88ms        ? ?/sec    1.00     42.0±0.90ms        ? ?/sec
bundle/bundle@threejs10x                                     1.00    389.0±3.98ms        ? ?/sec    1.04   404.7±14.76ms        ? ?/sec
bundle/bundle@threejs10x-sourcemap                           1.00    453.6±6.28ms        ? ?/sec    1.04   470.6±16.25ms        ? ?/sec
scan/scan@rome_ts                                            1.02     88.2±3.23ms        ? ?/sec    1.00     86.9±3.43ms        ? ?/sec
scan/scan@threejs                                            1.01     29.7±1.92ms        ? ?/sec    1.00     29.5±2.15ms        ? ?/sec
scan/scan@threejs10x                                         1.00    297.9±4.93ms        ? ?/sec    1.00    298.4±5.97ms        ? ?/sec

@graphite-app
Copy link
Contributor

graphite-app bot commented Nov 7, 2025

Merge activity

@graphite-app graphite-app bot force-pushed the 11-08-refactor_rust_manage_build_via_buildfactory_for_bundler_ branch from 1c1e7cf to c19666e Compare November 7, 2025 19:47
@graphite-app graphite-app bot force-pushed the 11-08-refactor_rust_tweak_incremental_build_related_methods_of_bundler_ branch from 7f475b9 to 94026e8 Compare November 7, 2025 19:48
Base automatically changed from 11-08-refactor_rust_manage_build_via_buildfactory_for_bundler_ to main November 7, 2025 20:01
@graphite-app graphite-app bot merged commit 94026e8 into main Nov 7, 2025
24 checks passed
@graphite-app graphite-app bot deleted the 11-08-refactor_rust_tweak_incremental_build_related_methods_of_bundler_ branch November 7, 2025 20:02
shulaoda added a commit that referenced this pull request Nov 10, 2025
## [1.0.0-beta.48] - 2025-11-10

:boom: Breaking Changes

- `this.emitFile` now respects `chunkFileNames` for chunk type
```js
// rolldown.config.js
export default {
  output: {
    chunkFileNames: 'chunks/[name]-[hash].js'
  }
}

// In plugin
this.emitFile({
  type: 'chunk',
  id: './my-module.js'
});

// Before: Output might not follow chunkFileNames pattern
// After: Output follows 'chunks/[name]-[hash].js' pattern
```

- Deprecated top-level options removed
  - `define` → `transform.define`
  - `inject` → `transform.inject`
  - `dropLabels` → `transform.dropLabels`
  - `keepNames` → `output.keepNames`
  - `profilerNames` → `output.generatedCode.profilerNames`

- Stable plugins moved from experimental
```js
// Before
import { replacePlugin, esmExternalRequirePlugin } from 'rolldown/experimental';

// After
import { replacePlugin, esmExternalRequirePlugin } from 'rolldown/plugins';
```

- `RolldownBuild#scan` is removed, now only available from `rolldown/experimental`
```js
// Before: scan was a method on RolldownBuild
const build = await rolldown(config);
await build.scan();

// After: import scan from rolldown/experimental
import { scan } from 'rolldown/experimental';
await scan(config);
```

### 💥 BREAKING CHANGES

- `this.emitFile` does not respect `chunkFileNames` (#6868) by @Copilot
- remove deprecated top-level `dropLabels` option (#6915) by @sapphi-red
- remove deprecated top-level `keepNames` option (#6914) by @sapphi-red
- remove deprecated top-level `profilerNames` option (#6913) by @sapphi-red
- remove deprecated top-level `define` and `inject` options (#6912) by @sapphi-red
- move stable plugins from experimental to `rolldown/plugins` (#6303) by @shulaoda
- node: remove experimental `RolldownBuild#scan`, only expose it from `rolldown/experimental` (#6889) by @hyf0

### 🚀 Features

- add side-effect detection for global constructors with primitive arguments (#6898) by @IWANABETHATGUY
- rust: use `BundleMode` to handle incremental build exhaustively (#6894) by @hyf0
- detect side-effect-free global function calls (#6897) by @IWANABETHATGUY
- expose `parseSync` / `parseAsync` function (#6866) by @sapphi-red
- skip `__toESM` helper when only named imports are used from CJS modules (#6850) by @Copilot
- rolldown_binding: expose `htmlInlineProxyPlugin` (#6856) by @shulaoda
- rolldown_plugin_html_inline_proxy: align `load` hook logic (#6855) by @shulaoda
- rolldown_plugin_html_inline_proxy: align `resolveId` hook logic (#6854) by @shulaoda
- rolldown_plugin_html_inline_proxy: initialize (#6853) by @shulaoda

### 🐛 Bug Fixes

- cli: support nested options in CLI properly (#6911) by @sapphi-red
- debug: ensure injecting `hook_resolve_id_trigger` correctly (#6908) by @hyf0
- use chunk-specific exports for entry module export detection (#6904) by @IWANABETHATGUY
- debug: ensure build get injected and add tests (#6896) by @hyf0
- error: return friendly error for bundler already closed scenario (#6878) by @hyf0
- improve dynamic entry processing with iterative approach (#6869) by @IWANABETHATGUY
- handle tsconfig option resolve error (#6871) by @sapphi-red
- handle error when creating output chunk directories (#6870) by @sapphi-red
- node: `NormalizedOutputOptionsImpl` and `NormalizedInputOptionsImpl` enumerable (#6861) by @hyf0
- node: keys of `RolldownOutput` should be enumerable (#6852) by @Copilot

### 🚜 Refactor

- rust: rename `BundleContext` to `BundleHandle` (#6893) by @hyf0
- rust: rename `build_span` to `bundle_span` (#6892) by @hyf0
- rust: introduce `PluginDriverFactory` to manage creation of `PluginDriver` (#6891) by @hyf0
- crates/rolldown_binding: remove useless `BindingBundlerImpl` (#6888) by @hyf0
- crates/rolldown_binding: rename `Bundler` to `ClassicBundler` and clarify the purpose (#6887) by @hyf0
- rust: rename `BuildFactory/Build` to `BundleFactory/Bundle` (#6886) by @hyf0
- rust: tweak incremental build related methods of `Bundler` (#6884) by @hyf0
- rust: manage build via `BuildFactory` for `Bundler` (#6883) by @hyf0
- node: implement a new `Bundler` that satisfy the usage of `RolldownBuild` (#6877) by @hyf0
- node: remove useless `nonEnumerable` decorator (#6862) by @hyf0

### 📚 Documentation

- add documentation for native replace plugin (#6315) by @shulaoda
- in-depth/directives: expand description of how directives are handled (#6882) by @sapphi-red
- in-depth/bundling-cjs: clarify the condition of `default` export interop (#6875) by @sapphi-red
- add troubleshooting section for `this` in exported functions (#6865) by @sapphi-red
- update prebuilt binaries list based on Node 24 platform support tier (#6864) by @sapphi-red
- remove unsupported [ext] placeholder from entryFileNames and chunkFileNames (#6859) by @Copilot

### ⚡ Performance

- rolldown: improve sourcemap chain processing (#6858) by @Brooooooklyn

### 🧪 Testing

- add test case for issue #6881 with scientific notation (#6906) by @IWANABETHATGUY

### ⚙️ Miscellaneous Tasks

- deps: update npm packages (#6918) by @renovate[bot]
- deps: update dependency rolldown-plugin-dts to v0.17.5 (#6917) by @renovate[bot]
- deps: lock file maintenance (#6907) by @renovate[bot]
- deps: update rust crates (#6905) by @renovate[bot]
- deps: update npm packages (#6903) by @renovate[bot]
- deps: update github-actions (#6902) by @renovate[bot]
- deps: update `oxc_resolver` and `oxc_resolver_napi` (#6901) by @shulaoda
- deps: update dependency rolldown-plugin-dts to v0.17.4 (#6895) by @renovate[bot]
- deps: update dependency tsdown to v0.16.1 (#6885) by @renovate[bot]
- deps: upgrade napi to remove linker args that skip missing symbols (#6867) by @Boshen

Co-authored-by: shulaoda <[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