Skip to content

Conversation

@gaoachao
Copy link
Collaborator

@gaoachao gaoachao commented Sep 22, 2025

Summary by CodeRabbit

  • New Features
    • Exposed the worklet transform via Node.js bindings with configurable mode and options.
    • Added JSON-configurable syntax and module-kind options.
  • Refactor
    • Consolidated transform mode into a shared module for consistency.
    • Removed the legacy “shake” transform feature and related utilities.
  • Documentation
    • Removed outdated README content for deprecated functionality.
  • Tests
    • Removed obsolete tests tied to the deprecated “shake” feature.
  • Chores
    • Added a new internal dependency to support transformations.
    • Added a placeholder changeset entry.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).
  • Changeset added, and when a BREAKING CHANGE occurs, it needs to be clearly marked (or not required).

@changeset-bot
Copy link

changeset-bot bot commented Sep 22, 2025

🦋 Changeset detected

Latest commit: c66bfeb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 22, 2025

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

Adds a new swc_plugin_worklet crate with N-API bindings, updates dependencies and imports, centralizes TransformMode into swc_plugins_shared, introduces SyntaxConfig and IsModuleConfig wrappers with N-API conversions, and removes the swc_plugin_shake module and related files. Also adds a minimal changeset file.

Changes

Cohort / File(s) Summary
Changeset metadata
.changeset/sixty-ants-act.md
Added an empty changeset file; no code changes.
Workspace dependency updates
packages/react/transform/Cargo.toml
Added dependency: swc_plugin_worklet.
New crate: swc_plugin_worklet (manifest)
packages/react/transform/crates/swc_plugin_worklet/Cargo.toml
New crate manifest with package metadata, lib path, and dependencies (swc_core with features, swc_plugins_shared, and workspace deps).
swc_plugin_worklet source updates
packages/react/transform/crates/swc_plugin_worklet/lib.rs, .../napi.rs, .../extract_ident.rs, .../gen_stmt.rs
Introduced N-API module exposing WorkletVisitor and config; adjusted imports/paths; added clippy allows; removed #[napi(object)] from config in lib and moved N-API surface to napi.rs.
Shared types exposure
packages/react/transform/crates/swc_plugins_shared/lib.rs, .../transform_mode.rs, .../transform_mode_napi.rs
Added public TransformMode enum and N-API conversions; exported new modules from shared crate.
React transform API adjustments
packages/react/transform/src/lib.rs
Removed local TransformMode and its N-API impls; adopted shared TransformMode; added public SyntaxConfig and IsModuleConfig wrappers with defaults and N-API conversions; updated imports to new worklet N-API.
Removal: swc_plugin_shake
packages/react/transform/src/swc_plugin_shake/README.md, .../is_component_class.rs, .../mod.rs
Deleted README and removed the shake transformer, component-class detection visitor, helpers, and tests.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested labels

framework:React

Suggested reviewers

  • hzy
  • upupming

Poem

A rabbit taps keys in the moonlit night,
Bundles a worklet, shared modes take flight.
Shakes off the shake, no classes to prune,
New configs hop softly, in JS they croon.
Cargo trails sparkle—rusty and bright.
Hop hop—transform’s just right! 🐰✨

✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/extract-swc-plugin-worklet

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 886715b and c66bfeb.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (14)
  • .changeset/sixty-ants-act.md (1 hunks)
  • packages/react/transform/Cargo.toml (1 hunks)
  • packages/react/transform/crates/swc_plugin_worklet/Cargo.toml (1 hunks)
  • packages/react/transform/crates/swc_plugin_worklet/extract_ident.rs (1 hunks)
  • packages/react/transform/crates/swc_plugin_worklet/gen_stmt.rs (1 hunks)
  • packages/react/transform/crates/swc_plugin_worklet/lib.rs (3 hunks)
  • packages/react/transform/crates/swc_plugin_worklet/napi.rs (1 hunks)
  • packages/react/transform/crates/swc_plugins_shared/lib.rs (1 hunks)
  • packages/react/transform/crates/swc_plugins_shared/transform_mode.rs (1 hunks)
  • packages/react/transform/crates/swc_plugins_shared/transform_mode_napi.rs (1 hunks)
  • packages/react/transform/src/lib.rs (1 hunks)
  • packages/react/transform/src/swc_plugin_shake/README.md (0 hunks)
  • packages/react/transform/src/swc_plugin_shake/is_component_class.rs (0 hunks)
  • packages/react/transform/src/swc_plugin_shake/mod.rs (0 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Sep 22, 2025

Codecov Report

❌ Patch coverage is 0% with 97 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
.../react/transform/crates/swc_plugin_worklet/napi.rs 0.00% 55 Missing ⚠️
...m/crates/swc_plugins_shared/transform_mode_napi.rs 0.00% 42 Missing ⚠️

📢 Thoughts on this report? Let us know!

@relativeci
Copy link

relativeci bot commented Sep 22, 2025

Web Explorer

#5441 Bundle Size — 365.49KiB (0%).

c66bfeb(current) vs 886715b main#5435(baseline)

Bundle metrics  Change 1 change
                 Current
#5441
     Baseline
#5435
No change  Initial JS 145.66KiB 145.66KiB
No change  Initial CSS 32KiB 32KiB
No change  Cache Invalidation 0% 0%
No change  Chunks 8 8
No change  Assets 8 8
Change  Modules 220(+0.46%) 219
No change  Duplicate Modules 16 16
No change  Duplicate Code 3.37% 3.37%
No change  Packages 4 4
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#5441
     Baseline
#5435
No change  JS 239.48KiB 239.48KiB
No change  Other 94.02KiB 94.02KiB
No change  CSS 32KiB 32KiB

Bundle analysis reportBranch refactor/extract-swc-plugin-work...Project dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link

relativeci bot commented Sep 22, 2025

React Example

#5447 Bundle Size — 237.65KiB (0%).

c66bfeb(current) vs 886715b main#5441(baseline)

Bundle metrics  no changes
                 Current
#5447
     Baseline
#5441
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
No change  Cache Invalidation 0% 0%
No change  Chunks 0 0
No change  Assets 4 4
No change  Modules 165 165
No change  Duplicate Modules 67 67
No change  Duplicate Code 46.76% 46.76%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#5447
     Baseline
#5441
No change  IMG 145.76KiB 145.76KiB
No change  Other 91.89KiB 91.89KiB

Bundle analysis reportBranch refactor/extract-swc-plugin-work...Project dashboard


Generated by RelativeCIDocumentationReport issue

@codspeed-hq
Copy link

codspeed-hq bot commented Sep 22, 2025

CodSpeed Performance Report

Merging #1805 will improve performances by 11.52%

Comparing refactor/extract-swc-plugin-worklet (c66bfeb) with main (886715b)

Summary

⚡ 1 improvement
✅ 52 untouched
⏩ 3 skipped1

Benchmarks breakdown

Benchmark BASE HEAD Change
basic-performance-small-css 7.5 ms 6.7 ms +11.52%

Footnotes

  1. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@gaoachao gaoachao marked this pull request as ready for review September 22, 2025 10:02
@gaoachao gaoachao requested a review from upupming September 22, 2025 10:02
@gaoachao gaoachao merged commit cf57c58 into main Sep 22, 2025
110 of 118 checks passed
@gaoachao gaoachao deleted the refactor/extract-swc-plugin-worklet branch September 22, 2025 10:07
@coderabbitai coderabbitai bot mentioned this pull request Nov 5, 2025
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants