refactor(rust/plugin): use Option<ModuleIdx>::None to represent invalid module idx#8152
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
How to use the Graphite Merge QueueAdd 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. |
There was a problem hiding this comment.
Pull request overview
This PR refactors the plugin context structs to use Option<ModuleIdx> instead of a bare ModuleIdx to represent cases where no valid module index is available, particularly for NAPI contexts.
Changes:
- Modified
LoadPluginContextandTransformPluginContextto storemodule_idxasOption<ModuleIdx> - Updated all constructor calls to wrap valid module indices with
Some()and useNonefor NAPI contexts - Added conditional logic to only track dependencies when a valid module index exists
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| crates/rolldown_plugin/src/plugin_driver/build_hooks.rs | Wrapped module_idx arguments with Some() when creating plugin contexts |
| crates/rolldown_plugin/src/plugin_context/transform_plugin_context.rs | Changed module_idx field to Option type and added conditional checks before using it |
| crates/rolldown_plugin/src/plugin_context/load_plugin_context.rs | Changed module_idx field to Option type and added conditional checks before using it |
| crates/rolldown_binding/src/options/plugin/binding_callable_builtin_plugin.rs | Used None for module_idx in NAPI contexts with explanatory comments |
Benchmarks Rust
|
Merge activity
|

No description provided.