-
-
Notifications
You must be signed in to change notification settings - Fork 775
feat: simplify mock logic, dynamic import based hoist #11521
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.
|
📦 Binary Size-limit
🎉 Size decreased by 4.13KB from 47.32MB to 47.32MB (⬇️0.01%) |
5db36e9
to
a37ca02
Compare
CodSpeed Performance ReportMerging #11521 will not alter performanceComparing 🎉 Hooray!
|
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 simplifies the mock logic in the rspack_plugin_rstest by transitioning from a static import to dynamic import based approach. The changes reduce complexity by removing hoisting-related parameters and dependencies while adding support for a new MOCKREQUIRE comment pattern.
- Adds MOCKREQUIRE pattern support to the regex for parsing rstest comments
- Removes complex hoisting logic with async factory parameters and position-based dependencies
- Refactors parser plugin methods to handle rstest calls through declarator and statement hooks instead of call_member_chain
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
crates/rspack_plugin_rstest/src/plugin.rs | Adds MOCKREQUIRE pattern to the regex for processing rstest assets |
crates/rspack_plugin_rstest/src/parser_plugin.rs | Major refactoring removes complex hoisting logic and simplifies method call handling |
crates/rspack_plugin_rstest/src/mock_module_id_dependency.rs | Removes hoist and async_factory parameters and related template logic |
crates/rspack_plugin_rstest/src/mock_method_dependency.rs | Removes position-based dependencies and adds new mock method variants |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
1cd207e
to
cb824d2
Compare
cb824d2
to
206104a
Compare
Summary
the corresponding Rstest side PR is: web-infra-dev/rstest#519.
InitFragmentStage::StageAsyncDependencies
stage, as there will be no static imports or conflicting import orders.Related links
Checklist