Skip to content

refactor(devtools): replace NormalizedId with ModuleId#7693

Closed
hyf0 wants to merge 1 commit into12-29-refactor_use_normalizedid_to_ensure_consistent_behavior_for_idfrom
12-29-refactor_devtools_replace_normalizedid_with_moduleid_
Closed

refactor(devtools): replace NormalizedId with ModuleId#7693
hyf0 wants to merge 1 commit into12-29-refactor_use_normalizedid_to_ensure_consistent_behavior_for_idfrom
12-29-refactor_devtools_replace_normalizedid_with_moduleid_

Conversation

@hyf0
Copy link
Member

@hyf0 hyf0 commented Dec 29, 2025

No description provided.

@hyf0 hyf0 marked this pull request as ready for review December 29, 2025 13:24
Copilot AI review requested due to automatic review settings December 29, 2025 13:24
Copy link
Member Author

hyf0 commented Dec 29, 2025

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.
Learn more


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.

@hyf0 hyf0 force-pushed the 12-29-refactor_devtools_replace_normalizedid_with_moduleid_ branch from 5218199 to fcc68d9 Compare December 29, 2025 13:25
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 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 NormalizedId type entirely and merged its functionality into ModuleId
  • Added helper methods to ModuleId: as_str(), as_arc_str(), and Display trait implementation
  • Updated all usages of NormalizedId::new() to ModuleId::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()),
Copy link

Copilot AI Dec 29, 2025

Choose a reason for hiding this comment

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

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().

Suggested change
facade_module_id: value.facade_module_id.map(|x| x.to_string()),
facade_module_id: value.facade_module_id.map(ToString::to_string),

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Contributor

Benchmarks Rust

  • target: 12-29-refactor_use_normalizedid_to_ensure_consistent_behavior_for_id(22353de)
  • pr: 12-29-refactor_devtools_replace_normalizedid_with_moduleid_(fcc68d9)
group                                                        pr                                     target
-----                                                        --                                     ------
bundle/bundle@multi-duplicated-top-level-symbol              1.01     66.2±2.75ms        ? ?/sec    1.00     65.7±2.19ms        ? ?/sec
bundle/bundle@multi-duplicated-top-level-symbol-sourcemap    1.00     71.5±1.83ms        ? ?/sec    1.01     71.9±1.83ms        ? ?/sec
bundle/bundle@rome_ts                                        1.00    108.1±2.45ms        ? ?/sec    1.00    107.7±1.93ms        ? ?/sec
bundle/bundle@rome_ts-sourcemap                              1.01    121.0±3.40ms        ? ?/sec    1.00    120.0±1.83ms        ? ?/sec
bundle/bundle@threejs                                        1.02     40.1±1.03ms        ? ?/sec    1.00     39.3±0.65ms        ? ?/sec
bundle/bundle@threejs-sourcemap                              1.02     44.1±1.05ms        ? ?/sec    1.00     43.3±0.72ms        ? ?/sec
bundle/bundle@threejs10x                                     1.00    393.8±4.98ms        ? ?/sec    1.01    396.4±8.35ms        ? ?/sec
bundle/bundle@threejs10x-sourcemap                           1.00    453.8±4.36ms        ? ?/sec    1.00    453.2±3.73ms        ? ?/sec
scan/scan@rome_ts                                            1.00     84.2±1.42ms        ? ?/sec    1.02     86.0±1.84ms        ? ?/sec
scan/scan@threejs                                            1.00     29.0±1.85ms        ? ?/sec    1.01     29.3±1.70ms        ? ?/sec
scan/scan@threejs10x                                         1.00    295.6±5.13ms        ? ?/sec    1.01    299.3±4.33ms        ? ?/sec

@hyf0 hyf0 closed this Dec 30, 2025
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