Skip to content

Conversation

@hardfist
Copy link
Contributor

Summary

make compilation readonly for optimize_modules phase

Related links

Checklist

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

Copilot AI review requested due to automatic review settings December 30, 2025 08:53
@github-actions github-actions bot added release: refactor team The issue/pr is created by the member of Rspack. labels Dec 30, 2025
@netlify
Copy link

netlify bot commented Dec 30, 2025

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit 596f793
🔍 Latest deploy log https://app.netlify.com/projects/rspack/deploys/6953a14795f7070008411a05

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 optimize_modules compilation hook to make the Compilation object readonly during the optimize modules phase. This is achieved by changing the hook signature to accept an immutable Compilation reference and a separate mutable diagnostics vector for collecting diagnostics.

Key changes:

  • Modified the CompilationOptimizeModules hook definition to accept &Compilation (readonly) instead of &mut Compilation and added a diagnostics: &mut Vec<Diagnostic> parameter
  • Updated all implementations of the hook across plugins to match the new signature
  • Changed diagnostics collection to accumulate in a separate vector that is merged into the compilation after the hook completes

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
crates/rspack_core/src/compilation/mod.rs Updated hook definition from &mut Compilation to &Compilation with added &mut Vec<Diagnostic> parameter; modified hook invocation to accumulate and merge diagnostics
crates/rspack_plugin_progress/src/lib.rs Updated optimize_modules implementation to match new hook signature with readonly compilation and diagnostics parameter
crates/rspack_plugin_circular_dependencies/src/lib.rs Updated optimize_modules and helper methods to use readonly compilation and separate diagnostics vector; changed from compilation.push_diagnostic() to diagnostics.push()
crates/rspack_binding_api/src/plugins/interceptor.rs Updated JS binding implementation of CompilationOptimizeModules trait to match new signature

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

@github-actions
Copy link
Contributor

github-actions bot commented Dec 30, 2025

Rsdoctor Bundle Diff Analysis

Found 5 projects in monorepo, 0 projects with changes.

📊 Quick Summary
Project Total Size Change
react-10k 5.7 MB 0
react-1k 823.4 KB 0
react-5k 2.7 MB 0
rome 984.4 KB 0
ui-components 2.1 MB 0

Generated by Rsdoctor GitHub Action

@github-actions
Copy link
Contributor

github-actions bot commented Dec 30, 2025

📦 Binary Size-limit

Comparing 596f793 to fix: shebang should always in entry chunk (#12585) by Fy

❌ Size increased by 384bytes from 47.85MB to 47.85MB (⬆️0.00%)

@codspeed-hq
Copy link

codspeed-hq bot commented Dec 30, 2025

CodSpeed Performance Report

Merging #12586 will not alter performance

Comparing yj/pure-optimize-modules (596f793) with main (7922a9a)

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.

@hardfist hardfist force-pushed the yj/pure-optimize-modules branch from 8825cc3 to 596f793 Compare December 30, 2025 09:54
@chenjiahan chenjiahan merged commit 2625393 into main Dec 30, 2025
77 of 79 checks passed
@chenjiahan chenjiahan deleted the yj/pure-optimize-modules branch December 30, 2025 10:43
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