-
-
Notifications
You must be signed in to change notification settings - Fork 757
refactor: introduce ArtifactExt trait #12800
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.
|
Rsdoctor Bundle Diff AnalysisFound 5 projects in monorepo, 0 projects with changes. 📊 Quick Summary
Generated by Rsdoctor GitHub Action |
Deploying rspack-v2 with
|
| Latest commit: |
5484541
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://89240449.rspack-v2.pages.dev |
| Branch Preview URL: | https://yj-artifact-trait.rspack-v2.pages.dev |
📦 Binary Size-limit
🎉 Size decreased by 1.50KB from 48.01MB to 48.01MB (⬇️0.00%) |
CodSpeed Performance ReportMerging this PR will not alter performanceComparing Summary
Footnotes
|
8bcb1b7 to
c550637
Compare
c550637 to
5484541
Compare
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 introduces a unified ArtifactExt trait to streamline artifact recovery during incremental compilation rebuilds. The refactoring replaces repetitive conditional recovery logic with a trait-based approach that associates each artifact with its corresponding incremental pass.
Changes:
- Introduced
ArtifactExttrait withPASSconstant,should_recover, andrecovermethods to unify artifact recovery logic - Implemented
ArtifactExtfor all artifact types (14 artifacts total) and wrapper types (DerefOption,Arc<AtomicRefCell>,BindingCell,Box) - Refactored rebuild.rs to use the new
recover_artifacthelper function, replacing ~90 lines of repetitive conditional logic with ~80 lines of clean, uniform recovery calls - Added comprehensive documentation in agents/ARTIFACTS.md explaining the artifact system design and usage
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/rspack_core/src/artifacts/mod.rs | Defines ArtifactExt trait and wrapper implementations for unified artifact recovery |
| crates/rspack_core/src/utils/deref_option.rs | Implements ArtifactExt for DerefOption<T> wrapper |
| crates/rspack_core/src/compiler/rebuild.rs | Refactored to use recover_artifact function instead of manual conditional logic |
| crates/rspack_core/src/artifacts/async_modules_artifact.rs | Added ArtifactExt implementation with INFER_ASYNC_MODULES pass |
| crates/rspack_core/src/artifacts/dependencies_diagnostics_artifact.rs | Added ArtifactExt implementation with DEPENDENCIES_DIAGNOSTICS pass |
| crates/rspack_core/src/artifacts/side_effects_do_optimize_artifact.rs | Changed from type alias to newtype struct with ArtifactExt implementation |
| crates/rspack_core/src/artifacts/code_generation_results.rs | Added ArtifactExt implementation with MODULES_CODEGEN pass |
| crates/rspack_core/src/artifacts/module_ids_artifact.rs | Added ArtifactExt implementation with MODULE_IDS pass |
| crates/rspack_core/src/artifacts/chunk_ids_artifact.rs | Added ArtifactExt implementation with CHUNK_IDS pass |
| crates/rspack_core/src/artifacts/cgm_hash_artifact.rs | Added ArtifactExt implementation with MODULES_HASHES pass |
| crates/rspack_core/src/artifacts/cgm_runtime_requirement_artifact.rs | Added ArtifactExt implementation with MODULES_RUNTIME_REQUIREMENTS pass |
| crates/rspack_core/src/artifacts/cgc_runtime_requirements_artifact.rs | Added ArtifactExt implementation with CHUNKS_RUNTIME_REQUIREMENTS pass |
| crates/rspack_core/src/artifacts/chunk_hashes_artifact.rs | Added ArtifactExt implementation with CHUNKS_HASHES pass |
| crates/rspack_core/src/artifacts/chunk_render_artifact.rs | Added ArtifactExt implementation with CHUNKS_RENDER pass |
| crates/rspack_core/src/artifacts/chunk_render_cache_artifact.rs | Added ArtifactExt with custom recover that calls start_next_generation |
| crates/rspack_core/src/artifacts/code_generate_cache_artifact.rs | Added ArtifactExt with custom recover that calls start_next_generation |
| crates/rspack_core/src/artifacts/process_runtime_requirements_cache_artifact.rs | Added ArtifactExt with custom recover that calls start_next_generation |
| crates/rspack_core/src/artifacts/imported_by_defer_modules_artifact.rs | Added ArtifactExt implementation with empty pass (has FIXME comment) |
| crates/rspack_core/src/artifacts/build_module_graph_artifact.rs | Added ArtifactExt implementation with MAKE pass |
| crates/rspack_core/src/artifacts/build_chunk_graph_artifact.rs | Added ArtifactExt implementation with BUILD_CHUNK_GRAPH pass |
| agents/ARTIFACTS.md | New documentation file explaining artifact system design and usage |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
* refactor: introduce ArtifactExt trait * refactor: fix wrapper
* refactor: introduce ArtifactExt trait * refactor: fix wrapper
* refactor: introduce ArtifactExt trait * refactor: fix wrapper
Summary
Refactor artifact recovery in rebuild.rs to use the unified ArtifactExt trait and recover_artifact function for
all artifact types, including wrapped types.
Changes
Related links
Checklist