-
-
Notifications
You must be signed in to change notification settings - Fork 757
refactor: remove MaybeDynamicTargetExportInfo and simplify get_target #12601
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ Deploy Preview for rspack canceled.
|
There was a problem hiding this 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 export info type system by removing the MaybeDynamicTargetExportInfo and MaybeDynamicTargetExportInfoHashKey enums, replacing them with a more streamlined approach using Cow<ExportInfoData> and a new ExportInfoHashKey struct. The refactoring simplifies the codebase by:
- Replacing
MaybeDynamicTargetExportInfoenum withCow<'_, ExportInfoData>for more idiomatic Rust ownership handling - Introducing
ExportInfoHashKeystruct to replaceMaybeDynamicTargetExportInfoHashKey - Moving
can_move_targetfrom an instance method to a standalone function - Updating function visibility from
pub(crate)topubwhere needed for cross-crate usage
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
side_effects_flag_plugin.rs |
Updated imports and refactored to use new can_move_target function and get_target_from_maybe_export_info with Cow pattern matching |
link.rs |
Updated imports to use ExportInfoHashKey and find_target_from_export_info function |
target.rs |
Added new can_move_target standalone function, updated get_target_from_maybe_export_info to work with ExportInfoData directly, changed visibility to pub |
exports_info_getter.rs |
Simplified get_export_info_without_mut_module_graph to return Cow<'_, ExportInfoData> instead of MaybeDynamicTargetExportInfo enum |
export_info.rs |
Removed MaybeDynamicTargetExportInfo and MaybeDynamicTargetExportInfoHashKey enums, added new ExportInfoHashKey struct and as_hash_key() method |
concatenated_module.rs |
Updated imports to use ExportInfoHashKey and find_target_from_export_info function |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Rsdoctor Bundle Diff AnalysisFound 5 projects in monorepo, 5 projects with changes. 📊 Quick Summary
📋 Detailed Reports (Click to expand)📁 react-10kPath:
📦 Download Diff Report: react-10k Bundle Diff 📁 react-1kPath:
📦 Download Diff Report: react-1k Bundle Diff 📁 romePath:
📦 Download Diff Report: rome Bundle Diff 📁 react-5kPath:
📦 Download Diff Report: react-5k Bundle Diff 📁 ui-componentsPath:
📦 Download Diff Report: ui-components Bundle Diff Generated by Rsdoctor GitHub Action |
📦 Binary Size-limit
🎉 Size decreased by 4.38KB from 47.85MB to 47.84MB (⬇️0.01%) |
CodSpeed Performance ReportMerging #12601 will not alter performanceComparing Summary
Footnotes
|
Summary
This PR refactors the export info type system by removing the
MaybeDynamicTargetExportInfoenum andMaybeDynamicTargetExportInfoHashKeyenum, which were previously used to handle both static and dynamic export info scenarios. The refactoring simplifies the codebase by:ExportInfoDataand a newExportInfoHashKeystruct directlyMaybeDynamicTargetExportInfocan_move_targetfrom being a method onMaybeDynamicTargetExportInfoto a standalone function intarget.rsThis change improves code maintainability and reduces the cognitive overhead when working with export info types.
Checklist