-
-
Notifications
You must be signed in to change notification settings - Fork 757
refactor: use newtype for alias artifact #12754
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 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Rsdoctor Bundle Diff AnalysisFound 5 projects in monorepo, 0 projects with changes. 📊 Quick Summary
Generated by Rsdoctor GitHub Action |
📦 Binary Size-limit
🙈 Size remains the same at 48.03MB |
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 type aliases for artifact types into dedicated newtype structs, improving extensibility and enabling future metadata additions without breaking existing code. The change converts six type aliases (AsyncModulesArtifact, ImportedByDeferModulesArtifact, DependenciesDiagnosticsArtifact, ModuleIdsArtifact, CgcRuntimeRequirementsArtifact, and ChunkRenderArtifact) into proper newtype wrapper structs with comprehensive trait implementations.
Changes:
- Replaced type aliases with newtype structs in
artifacts/mod.rs - Created six new artifact module files with consistent trait implementations (Deref, DerefMut, From, FromIterator, IntoIterator)
- Updated usage sites to work with the new types using
.into()conversion
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| artifacts/mod.rs | Converted type aliases to module imports and exports |
| artifacts/async_modules_artifact.rs | New newtype wrapper for IdentifierSet with standard trait impls |
| artifacts/cgc_runtime_requirements_artifact.rs | New newtype wrapper for UkeyMap<ChunkUkey, RuntimeGlobals> with standard trait impls |
| artifacts/chunk_render_artifact.rs | New newtype wrapper for UkeyMap<ChunkUkey, ChunkRenderResult> with standard trait impls |
| artifacts/dependencies_diagnostics_artifact.rs | New newtype wrapper for IdentifierMap<Vec> with additional into_values method |
| artifacts/imported_by_defer_modules_artifact.rs | New newtype wrapper for IdentifierSet with standard trait impls |
| artifacts/module_ids_artifact.rs | New newtype wrapper for IdentifierMap with standard trait impls |
| compilation/finish_modules/mod.rs | Updated to use explicit type conversion with .into() |
| compilation/create_chunk_assets/mod.rs | Updated variable declaration to use new ChunkRenderArtifact type |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
use newtype for artifact which is more extensible and we can add more meta info in artifact in the future
Related links
Checklist