-
-
Notifications
You must be signed in to change notification settings - Fork 754
refactor: make compilation readonly for optimize_modules phase #12586
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 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
CompilationOptimizeModuleshook definition to accept&Compilation(readonly) instead of&mut Compilationand added adiagnostics: &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.
Rsdoctor Bundle Diff AnalysisFound 5 projects in monorepo, 0 projects with changes. 📊 Quick Summary
Generated by Rsdoctor GitHub Action |
📦 Binary Size-limit
❌ Size increased by 384bytes from 47.85MB to 47.85MB (⬆️0.00%) |
CodSpeed Performance ReportMerging #12586 will not alter performanceComparing Summary
Footnotes
|
8825cc3 to
596f793
Compare
Summary
make compilation readonly for optimize_modules phase
Related links
Checklist