Skip to content

chore: improve struct type and remove some useless fields#12071

Merged
JSerFeng merged 1 commit intomainfrom
chore/improve
Nov 4, 2025
Merged

chore: improve struct type and remove some useless fields#12071
JSerFeng merged 1 commit intomainfrom
chore/improve

Conversation

@JSerFeng
Copy link
Contributor

@JSerFeng JSerFeng commented Nov 3, 2025

Summary

Remove the sync::Arc inside RwLock, remove useless fields in loader

Related links

Checklist

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

Copilot AI review requested due to automatic review settings November 3, 2025 11:10
@netlify
Copy link

netlify bot commented Nov 3, 2025

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit fa9da48
🔍 Latest deploy log https://app.netlify.com/projects/rspack/deploys/69088d9ae9f38f0008597d09

@github-actions github-actions bot added the team The issue/pr is created by the member of Rspack. label Nov 3, 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 synchronization strategy for the concatenated_modules_map in the ESM library plugin. The primary change removes an unnecessary Arc wrapper from the RwLock protected map, simplifying the code since the RwLock itself provides sufficient synchronization. Additionally, it removes an unused current_loader field from the RspackLoaderRunnerPlugin struct.

Key changes:

  • Simplified the type of concatenated_modules_map from RwLock<Arc<IdentifierIndexMap<ModuleInfo>>> to RwLock<IdentifierIndexMap<ModuleInfo>>, removing redundant wrapping
  • Updated all references to work with the direct map instead of getting mutable access through Arc::get_mut
  • Removed unused current_loader field from RspackLoaderRunnerPlugin

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
crates/rspack_plugin_esm_library/src/plugin.rs Updated struct field type, added documentation comment, and removed Arc::new wrapper when assigning to the map
crates/rspack_plugin_esm_library/src/link.rs Removed Arc::get_mut call and updated all function calls to pass mutable references directly
crates/rspack_core/src/normal_module.rs Removed initialization of unused current_loader field
crates/rspack_core/src/loader/rspack_loader.rs Removed unused current_loader field declaration and import

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 3, 2025

📦 Binary Size-limit

Comparing fa9da48 to fix: use correct Cell for EsmLibraryPlugin (#12067) by Fy

🎉 Size decreased by 896bytes from 47.86MB to 47.86MB (⬇️0.00%)

@codspeed-hq
Copy link

codspeed-hq bot commented Nov 3, 2025

CodSpeed Performance Report

Merging #12071 will not alter performance

Comparing chore/improve (fa9da48) with main (46a54da)

Summary

✅ 17 untouched

@JSerFeng JSerFeng requested review from ahabhgk and quininer November 4, 2025 05:36
@JSerFeng JSerFeng enabled auto-merge (squash) November 4, 2025 05:37
@JSerFeng JSerFeng merged commit 2dc64de into main Nov 4, 2025
76 of 79 checks passed
@JSerFeng JSerFeng deleted the chore/improve branch November 4, 2025 05:37
@h-a-n-a h-a-n-a mentioned this pull request Nov 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants