-
-
Couldn't load subscription status.
- Fork 729
perf: context and dependency_type in ExternalItemFnCtx #11772
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
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for rspack canceled.
|
📦 Binary Size-limit
🎉 Size decreased by 384bytes from 47.89MB to 47.89MB (⬇️0.00%) |
CodSpeed Performance ReportMerging #11772 will not alter performanceComparing 🎉 Hooray!
|
eadb12d to
79254ee
Compare
79254ee to
c4731b5
Compare
c4731b5 to
6b73fc7
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 changes the type of context and dependency_type fields in ExternalItemFnCtx struct from strings to their respective typed equivalents (Context and DependencyCategory). This improves type safety and reduces unnecessary string conversions when creating the context object.
- Changed
contextfield fromStringtoContexttype - Changed
dependency_typefield fromStringtoDependencyCategoryenum - Updated all references to use the typed values directly instead of string comparisons
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| crates/rspack_core/src/options/externals.rs | Updated ExternalItemFnCtx struct to use typed fields |
| crates/rspack_plugin_externals/src/plugin.rs | Removed string conversions when creating ExternalItemFnCtx |
| crates/rspack_plugin_externals/src/http_externals_plugin.rs | Updated comparisons to use DependencyCategory enum variants |
| crates/rspack_binding_api/src/raw_options/raw_external.rs | Updated RawExternalItemFnCtxInner to match new types |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| context: Context, | ||
| dependency_type: DependencyCategory, |
Copilot
AI
Sep 28, 2025
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.
The RawExternalItemFnCtxInner struct now uses typed fields but this change may break the JavaScript/TypeScript binding layer. The raw bindings typically need to convert between Rust types and JavaScript types, and changing from strings to typed enums could require additional conversion logic in the getter methods.
Summary
Related links
Checklist