Skip to content

feat!: use defer_options for build_module_artifact#12578

Merged
hardfist merged 3 commits intomainfrom
yj/deref-mg
Dec 30, 2025
Merged

feat!: use defer_options for build_module_artifact#12578
hardfist merged 3 commits intomainfrom
yj/deref-mg

Conversation

@hardfist
Copy link
Contributor

@hardfist hardfist commented Dec 29, 2025

Summary

use derefOption for build_module_graph_artifact to support runtime exclusive check in the future,
It will panic if js access incomplete module_graph

Breaking!

ModuleGraph is not accessible during loader phase now since it's not finished and mutual write & read access from both rust and js side is undefined behavior

Related links

Checklist

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

Copilot AI review requested due to automatic review settings December 29, 2025 13:25
@netlify
Copy link

netlify bot commented Dec 29, 2025

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit 55deb1c
🔍 Latest deploy log https://app.netlify.com/projects/rspack/deploys/695363695ec4b20008581fbe

@github-actions github-actions bot added release: refactor team The issue/pr is created by the member of Rspack. labels Dec 29, 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 build_module_graph_artifact field in the Compilation struct to use DerefOption wrapper, replacing direct usage of std::mem operations with DerefOption's methods.

Key Changes:

  • Changed build_module_graph_artifact type from BuildModuleGraphArtifact to DerefOption<BuildModuleGraphArtifact>
  • Replaced all mem::take calls with DerefOption::take() method
  • Wrapped all assignments with DerefOption::new() to maintain the wrapper
  • Updated swap_build_module_graph_artifact to use DerefOption::swap() method
  • Removed unused mem import from the use statement (though std::mem is still used elsewhere with fully qualified paths)

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

@github-actions
Copy link
Contributor

github-actions bot commented Dec 29, 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
rome 984.3 KB 0
react-5k 2.7 MB 0
ui-components 2.1 MB 0

Generated by Rsdoctor GitHub Action

@github-actions
Copy link
Contributor

github-actions bot commented Dec 29, 2025

📦 Binary Size-limit

Comparing 55deb1c to refactor: refine exports info for CJS and ESM interop (#12577) by harpsealjs

❌ Size increased by 8.88KB from 48.00MB to 48.01MB (⬆️0.02%)

@codspeed-hq
Copy link

codspeed-hq bot commented Dec 29, 2025

CodSpeed Performance Report

Merging #12578 will not alter performance

Comparing yj/deref-mg (55deb1c) with main (5bf9ecc)

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 enabled auto-merge (squash) December 30, 2025 05:50
@hardfist hardfist merged commit 23c1ee5 into main Dec 30, 2025
55 checks passed
@hardfist hardfist deleted the yj/deref-mg branch December 30, 2025 05:53
@hardfist hardfist changed the title refactor: use defer_options for build_module_artifact refactor!: use defer_options for build_module_artifact Jan 6, 2026
@hardfist hardfist changed the title refactor!: use defer_options for build_module_artifact fix!: use defer_options for build_module_artifact Jan 6, 2026
@github-actions github-actions bot added release: bug fix release: bug related release(mr only) and removed release: refactor labels Jan 6, 2026
@hardfist hardfist changed the title fix!: use defer_options for build_module_artifact feat!: use defer_options for build_module_artifact Jan 6, 2026
@github-actions github-actions bot added release: feature release: feature related release(mr only) and removed release: bug fix release: bug related release(mr only) labels Jan 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release: feature release: feature related release(mr only) 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