refactor(devtools): replace NormalizedId with ModuleId#7693
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. |
5218199 to
fcc68d9
Compare
There was a problem hiding this comment.
Pull request overview
This PR refactors the codebase by consolidating NormalizedId into ModuleId, removing redundancy and simplifying the type system. The Windows path normalization functionality (backslash to forward slash conversion for absolute paths) that was in NormalizedId is now integrated directly into ModuleId::new().
Key changes:
- Removed the
NormalizedIdtype entirely and merged its functionality intoModuleId - Added helper methods to
ModuleId:as_str(),as_arc_str(), andDisplaytrait implementation - Updated all usages of
NormalizedId::new()toModuleId::new()throughout the codebase
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| crates/rolldown_common/src/types/normalized_id.rs | Deleted - NormalizedId type removed entirely |
| crates/rolldown_common/src/types/module_id.rs | Enhanced with Windows path normalization, added as_str(), as_arc_str(), and Display trait |
| crates/rolldown_common/src/types/resolved_id.rs | Updated to use ModuleId instead of NormalizedId |
| crates/rolldown_common/src/types/mod.rs | Removed normalized_id module export |
| crates/rolldown_common/src/lib.rs | Removed NormalizedId from public exports |
| crates/rolldown_resolver/src/resolver.rs | Updated ResolveReturn to construct ModuleId instead of NormalizedId |
| crates/rolldown_plugin/src/utils/resolve_id_with_plugins.rs | Replaced all NormalizedId::new() calls with ModuleId::new() |
| crates/rolldown_plugin/src/utils/resolve_id_check_external.rs | Updated external resolution to use ModuleId |
| crates/rolldown_plugin/src/plugin_context/native_plugin_context.rs | Updated module loading and watch file tracking to use ModuleId |
| crates/rolldown/src/module_loader/runtime_module_task.rs | Updated runtime module creation to use ModuleId |
| crates/rolldown/src/module_loader/resolve_utils.rs | Updated module resolution to construct ModuleId |
| crates/rolldown/src/module_loader/module_task.rs | Simplified code by using ModuleId directly; improved style with info.id.as_arc_str().clone() |
| crates/rolldown/src/bundle/bundle.rs | Style improvement: changed .map(|i| i.to_string()) to .map(ToString::to_string) |
| crates/rolldown_binding/src/types/binding_rendered_chunk.rs | Style improvement: changed closure to ToString::to_string |
| crates/rolldown_binding/src/types/binding_module_info.rs | Style improvements: consistent use of ToString::to_string |
| crates/rolldown_binding/src/options/binding_output_options/binding_pre_rendered_chunk.rs | Style improvement for module_ids iteration |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -16,7 +16,7 @@ impl From<rolldown_common::RollupPreRenderedChunk> for PreRenderedChunk { | |||
| is_entry: value.is_entry, | |||
| is_dynamic_entry: value.is_dynamic_entry, | |||
| facade_module_id: value.facade_module_id.map(|x| x.to_string()), | |||
There was a problem hiding this comment.
For consistency with the other changes in this file (lines 19-20), consider using ToString::to_string instead of the closure |x| x.to_string().
| facade_module_id: value.facade_module_id.map(|x| x.to_string()), | |
| facade_module_id: value.facade_module_id.map(ToString::to_string), |
Benchmarks Rust
|

No description provided.