Skip to content

Conversation

@hardfist
Copy link
Contributor

@hardfist hardfist commented Jan 14, 2026

Summary

Inspired by rustc's rustc_passes design(https://github.com/rust-lang/rust/blob/e314b97ee54091b6bcf33db4770c93d82fded8bc/compiler/rustc_passes/src/lib.rs#L39),
move every pass into seperate folder and remove the complexity of compilation.rs and drive all these passes in run_passes function which

  • no distinction between make and seal
  • unify all pass behavior in run_passes function(like clear & reset artifact logic)
  • avoid expose internal info between passes

Follow up:

  • unify Artifact behavior using ArtifactExt trait
  • call ArtifactExt trait method like use_artifact to unify artifact behavior

Related links

Checklist

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

@netlify
Copy link

netlify bot commented Jan 14, 2026

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit 99c7bed
🔍 Latest deploy log https://app.netlify.com/projects/rspack/deploys/6967d57678964b00085de074

@github-actions github-actions bot added release: refactor team The issue/pr is created by the member of Rspack. labels Jan 14, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 14, 2026

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 825.4 KB 0
react-5k 2.7 MB 0
ui-components 2.1 MB 0
rome 984.3 KB 0

Generated by Rsdoctor GitHub Action

@github-actions
Copy link
Contributor

github-actions bot commented Jan 14, 2026

📦 Binary Size-limit

Comparing 99c7bed to chore(deps): update patch npm dependencies (#12717) by renovate[bot]

❌ Size increased by 45.25KB from 47.97MB to 48.01MB (⬆️0.09%)

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 14, 2026

Merging this PR will not alter performance

✅ 16 untouched benchmarks
⏩ 1 skipped benchmark1


Comparing yj/run-passes (99c7bed) with main (785c0f6)

Open in CodSpeed

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 changed the title refactor: move pass into separate folder and drive by run_passes refactor: move pass into separate folder and driven by run_passes Jan 14, 2026
@hardfist hardfist marked this pull request as ready for review January 14, 2026 16:52
Copilot AI review requested due to automatic review settings January 14, 2026 16:52
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 pull request refactors the Rspack compilation process by moving individual compilation passes from a monolithic mod.rs file into separate, dedicated modules. Inspired by Rust's rustc_passes design, this change improves code organization, maintainability, and separation of concerns.

Changes:

  • Extracted 16 compilation passes into separate modules (optimize_dependencies, build_chunk_graph, optimize_modules, optimize_chunks, optimize_tree, optimize_chunk_modules, module_ids, chunk_ids, assign_runtime_ids, optimize_code_generation, create_module_hashes, code_generation, runtime_requirements, create_hash, create_module_assets, create_chunk_assets, process_assets, after_seal, finish_module)
  • Created run_passes.rs to orchestrate all compilation passes in a single location
  • Added comprehensive documentation in rspack_passes.md describing the modular architecture and pass execution order

Reviewed changes

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

Show a summary per file
File Description
crates/rspack_core/src/compilation/mod.rs Removed large blocks of compilation pass code; added module declarations for new pass modules; removed obsolete imports
crates/rspack_core/src/compilation/run_passes.rs New orchestration module that drives all compilation passes in sequence
crates/rspack_core/src/compilation/rspack_passes.md Documentation describing the new modular architecture and pass order
crates/rspack_core/src/compilation/runtime_requirements/mod.rs Extracted runtime requirements pass implementation
crates/rspack_core/src/compilation/process_assets/mod.rs Extracted process assets pass implementation
crates/rspack_core/src/compilation/optimize_tree/mod.rs Extracted optimize tree pass implementation
crates/rspack_core/src/compilation/optimize_modules/mod.rs Extracted optimize modules pass implementation
crates/rspack_core/src/compilation/optimize_dependencies/mod.rs Extracted optimize dependencies pass implementation
crates/rspack_core/src/compilation/optimize_code_generation/mod.rs Extracted optimize code generation pass implementation
crates/rspack_core/src/compilation/optimize_chunks/mod.rs Extracted optimize chunks pass implementation
crates/rspack_core/src/compilation/optimize_chunk_modules/mod.rs Extracted optimize chunk modules pass implementation
crates/rspack_core/src/compilation/module_ids/mod.rs Extracted module IDs pass implementation
crates/rspack_core/src/compilation/finish_module/mod.rs Extracted finish module pass implementation
crates/rspack_core/src/compilation/create_module_hashes/mod.rs Extracted module hashes creation pass implementation
crates/rspack_core/src/compilation/create_module_assets/mod.rs Extracted module assets creation pass implementation
crates/rspack_core/src/compilation/create_hash/mod.rs Extracted hash creation pass implementation; includes ChunkHashResult struct definition
crates/rspack_core/src/compilation/create_chunk_assets/mod.rs Extracted chunk assets creation pass implementation
crates/rspack_core/src/compilation/code_generation/mod.rs Extracted code generation pass implementation
crates/rspack_core/src/compilation/chunk_ids/mod.rs Extracted chunk IDs pass implementation
crates/rspack_core/src/compilation/build_chunk_graph/pass.rs New pass wrapper for build chunk graph
crates/rspack_core/src/compilation/build_chunk_graph/mod.rs Added pass module declaration
crates/rspack_core/src/compilation/assign_runtime_ids/mod.rs Extracted runtime IDs assignment pass implementation
crates/rspack_core/src/compilation/after_seal/mod.rs Extracted after seal pass implementation

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

@hardfist hardfist enabled auto-merge (squash) January 14, 2026 17:43
@hardfist hardfist merged commit d9915de into main Jan 15, 2026
52 checks passed
@hardfist hardfist deleted the yj/run-passes branch January 15, 2026 01:32
LingyuCoder pushed a commit that referenced this pull request Jan 16, 2026
…2735)

* chore: add rspack_passes.md

* refactor: move pass into separate folder and drive by run_passes

* chore: use function

* refactor: move more into run_passes

* chore: fix stats logging

* chore: fix stats.logging
chenjiahan pushed a commit that referenced this pull request Jan 16, 2026
…2735)

* chore: add rspack_passes.md

* refactor: move pass into separate folder and drive by run_passes

* chore: use function

* refactor: move more into run_passes

* chore: fix stats logging

* chore: fix stats.logging
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