-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
refactor(plugin): Switch plugin abi to flexible serialization #11198
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
|
CodSpeed Performance ReportMerging #11198 will not alter performanceComparing Summary
|
f02f7d4 to
0f85c06
Compare
|
No dependency changes detected. Learn more about Socket for GitHub. 👍 No dependency changes detected in pull request |
d043f9f to
119000c
Compare
eda5d89 to
f756aac
Compare
bf5f8ae to
b82f905
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 migrates the serialization layer from rkyv to cbor4ii encoding for the SWC plugin system. The changes include:
- Replacing
rkyv-implfeature flags withencoding-implacross multiple crates - Adding cbor4ii as a dependency for serialization/deserialization
- Updating field encoding attributes from rkyv-specific to cbor4ii-specific implementations
- Modifying CSS AST enum variants from tuple-style to named field syntax (e.g.,
Token::Dimension(v)→Token::Dimension { dimension: v }) - Removing deprecated CSS plugin transform functionality
- Updating visitor code generation to handle both tuple and named variant syntax
Reviewed Changes
Copilot reviewed 144 out of 154 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tools/generate-code/src/generators/visitor.rs | Enhanced visitor code generation to support both tuple and named field enum variants |
| crates/swc_xml_ast/src/*.rs | Added encoding-impl attributes for Option fields using cbor4ii::core::types::Maybe |
| crates/swc_plugin_runner/src/*.rs | Replaced __rkyv feature with encoding-impl and updated serialization logic |
| crates/swc_plugin_proxy/src/*.rs | Migrated from rkyv to cbor4ii serialization traits and simplified memory interop |
| crates/swc_ecma_ast/src/*.rs | Added encoding-impl attributes for TypeScript/JSX optional fields |
| crates/swc_css_parser/tests/**/*.{json,stderr} | Updated test snapshots to reflect new Token::Dimension structure |
| crates/swc_plugin_macro/src/lib.rs | Removed css_plugin_transform macro |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Binary Sizes
Commit: c6826db |
30ea2b1 to
ae17408
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
Copilot reviewed 144 out of 154 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Copilot reviewed 45 out of 51 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /// it from the old Wasm plugin (v1), serialize it back as old data (v1), and | ||
| /// deserialize it back from latest runtime (v2). | ||
| #[test] | ||
| fn bakward_compatible() { |
Copilot
AI
Nov 3, 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.
Corrected spelling of 'bakward' to 'backward'.
| /// | ||
| /// This is a test for Wasm plugin tests. | ||
| /// | ||
| /// This test simulates serilizing from the latest runtime (v2) and deserialize |
Copilot
AI
Nov 3, 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.
Corrected spelling of 'serilizing' to 'serializing'.
| name: &"Context", | ||
| found: 0, | ||
| })?; | ||
| let len = std::cmp::min(len, 4 * 1024); |
Copilot
AI
Nov 3, 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 magic number 4 * 1024 should be extracted as a named constant (e.g., const MAX_CONTEXT_ENTRIES: usize = 4096;) to improve code readability and maintainability.
4abc611 to
7b7829b
Compare
crates/swc_plugin_backend_tests/tests/fixture/swc_internal_plugin/src/lib.rs
Show resolved
Hide resolved
| @@ -0,0 +1,4 @@ | |||
| [target.wasm32-wasip1] | |||
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.
Can you update the plugin template to have this?
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.
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
Copilot reviewed 48 out of 54 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
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
Copilot reviewed 48 out of 54 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Copilot reviewed 48 out of 54 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Can you reflect some change requests about panic from |
|
Copilot provides an illusion-based patch, which we need to revert. |
62b37b3 to
f735956
Compare
|
Thank you so much for the hard work on the idea and implementing it! |


Description:
This is a follow up to #11100, which will result in plugin abi break.
It currently passes the plugin tests, but I still need to do some code and configuration cleanup, and add a regression test.
BREAKING CHANGE:
Since we switch serialization schemes, this will result in breaking changes on the plugin abi and api.
Related issue (if exists):