Skip to content

Conversation

@LingyuCoder
Copy link
Contributor

Summary

This PR refactors the export info type system by removing the MaybeDynamicTargetExportInfo enum and MaybeDynamicTargetExportInfoHashKey enum, which were previously used to handle both static and dynamic export info scenarios. The refactoring simplifies the codebase by:

  • Unifying the type system to use ExportInfoData and a new ExportInfoHashKey struct directly
  • Simplifying function signatures that previously accepted MaybeDynamicTargetExportInfo
  • Moving can_move_target from being a method on MaybeDynamicTargetExportInfo to a standalone function in target.rs
  • Reducing code complexity and removing unnecessary abstraction layers

This change improves code maintainability and reduces the cognitive overhead when working with export info types.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings December 31, 2025 06:02
@netlify
Copy link

netlify bot commented Dec 31, 2025

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit ce78efa
🔍 Latest deploy log https://app.netlify.com/projects/rspack/deploys/6954f8665c01fd0008796bee

@github-actions github-actions bot added release: refactor team The issue/pr is created by the member of Rspack. labels Dec 31, 2025
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 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 MaybeDynamicTargetExportInfo enum with Cow<'_, ExportInfoData> for more idiomatic Rust ownership handling
  • Introducing ExportInfoHashKey struct to replace MaybeDynamicTargetExportInfoHashKey
  • Moving can_move_target from an instance method to a standalone function
  • Updating function visibility from pub(crate) to pub where 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.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 31, 2025

Rsdoctor Bundle Diff Analysis

Found 5 projects in monorepo, 5 projects with changes.

📊 Quick Summary
Project Total Size Change
react-10k 5.7 MB +14.0 B (0.0%)
react-1k 823.4 KB +14.0 B (0.0%)
rome 984.4 KB +14.0 B (0.0%)
react-5k 2.7 MB +14.0 B (0.0%)
ui-components 2.1 MB +14.0 B (0.0%)
📋 Detailed Reports (Click to expand)

📁 react-10k

Path: ../build-tools-performance/cases/react-10k/dist/rsdoctor-data.json

📌 Baseline Commit: fc0b6db370 | PR: #12602

Metric Current Baseline Change
📊 Total Size 5.7 MB 5.7 MB +14.0 B (0.0%)
📄 JavaScript 5.7 MB 5.7 MB +14.0 B (0.0%)
🎨 CSS 21.0 B 21.0 B 0
🌐 HTML 0 B 0 B 0
📁 Other Assets 0 B 0 B 0

📦 Download Diff Report: react-10k Bundle Diff

📁 react-1k

Path: ../build-tools-performance/cases/react-1k/dist/rsdoctor-data.json

📌 Baseline Commit: fc0b6db370 | PR: #12602

Metric Current Baseline Change
📊 Total Size 823.4 KB 823.4 KB +14.0 B (0.0%)
📄 JavaScript 823.4 KB 823.4 KB +14.0 B (0.0%)
🎨 CSS 0 B 0 B 0
🌐 HTML 0 B 0 B 0
📁 Other Assets 0 B 0 B 0

📦 Download Diff Report: react-1k Bundle Diff

📁 rome

Path: ../build-tools-performance/cases/rome/dist/rsdoctor-data.json

📌 Baseline Commit: fc0b6db370 | PR: #12602

Metric Current Baseline Change
📊 Total Size 984.4 KB 984.3 KB +14.0 B (0.0%)
📄 JavaScript 984.4 KB 984.3 KB +14.0 B (0.0%)
🎨 CSS 0 B 0 B 0
🌐 HTML 0 B 0 B 0
📁 Other Assets 0 B 0 B 0

📦 Download Diff Report: rome Bundle Diff

📁 react-5k

Path: ../build-tools-performance/cases/react-5k/dist/rsdoctor-data.json

📌 Baseline Commit: fc0b6db370 | PR: #12602

Metric Current Baseline Change
📊 Total Size 2.7 MB 2.7 MB +14.0 B (0.0%)
📄 JavaScript 2.7 MB 2.7 MB +14.0 B (0.0%)
🎨 CSS 21.0 B 21.0 B 0
🌐 HTML 0 B 0 B 0
📁 Other Assets 0 B 0 B 0

📦 Download Diff Report: react-5k Bundle Diff

📁 ui-components

Path: ../build-tools-performance/cases/ui-components/dist/rsdoctor-data.json

📌 Baseline Commit: fc0b6db370 | PR: #12602

Metric Current Baseline Change
📊 Total Size 2.1 MB 2.1 MB +14.0 B (0.0%)
📄 JavaScript 2.0 MB 2.0 MB +14.0 B (0.0%)
🎨 CSS 83.0 KB 83.0 KB 0
🌐 HTML 0 B 0 B 0
📁 Other Assets 0 B 0 B 0

📦 Download Diff Report: ui-components Bundle Diff

Generated by Rsdoctor GitHub Action

@github-actions
Copy link
Contributor

github-actions bot commented Dec 31, 2025

📦 Binary Size-limit

Comparing ce78efa to refactor: use readonly compilation reference for after seal hook (#12602) by pshu

🎉 Size decreased by 4.38KB from 47.85MB to 47.84MB (⬇️0.01%)

@codspeed-hq
Copy link

codspeed-hq bot commented Dec 31, 2025

CodSpeed Performance Report

Merging #12601 will not alter performance

Comparing refactor/simplify-export-info-types (ce78efa) with main (fc0b6db)

Summary

✅ 16 untouched
⏩ 1 skipped1

Footnotes

  1. 1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports.

@LingyuCoder LingyuCoder requested a review from ahabhgk December 31, 2025 07:06
@LingyuCoder LingyuCoder enabled auto-merge (squash) December 31, 2025 07:06
@github-actions
Copy link
Contributor

github-actions bot commented Dec 31, 2025

📝 Ecosystem CI detail: Open

suite result
modernjs ❌ failure
rslib ✅ success
nuxt ✅ success
rstest ✅ success
plugin ✅ success
devserver ✅ success
lynx-stack ❌ failure
rsdoctor ❌ failure
rsbuild ✅ success
rspress ✅ success
examples ✅ success

@LingyuCoder LingyuCoder changed the title refactor: simplify export info types by removing MaybeDynamicTargetExportInfo refactor: remove MaybeDynamicTargetExportInfo and simplify get_target Jan 5, 2026
@LingyuCoder LingyuCoder merged commit b7f85d2 into main Jan 5, 2026
79 of 81 checks passed
@LingyuCoder LingyuCoder deleted the refactor/simplify-export-info-types branch January 5, 2026 02:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release: refactor team The issue/pr is created by the member of Rspack.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants