Skip to content

chore(swc): optimize swc_core features#2294

Open
colinaaa wants to merge 1 commit intolynx-family:mainfrom
colinaaa:chore/optimize-swc-features
Open

chore(swc): optimize swc_core features#2294
colinaaa wants to merge 1 commit intolynx-family:mainfrom
colinaaa:chore/optimize-swc-features

Conversation

@colinaaa
Copy link
Copy Markdown
Collaborator

@colinaaa colinaaa commented Mar 3, 2026

Summary by CodeRabbit

  • Chores
    • Optimized internal build system dependencies by streamlining tooling configurations across build packages. Removed unused features from core build tools and reorganized development-specific dependencies for better maintenance. These internal optimizations improve compilation efficiency while maintaining full functionality.

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
Copy Markdown

changeset-bot Bot commented Mar 3, 2026

⚠️ No Changeset found

Latest commit: d4d98de

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

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

Click here to learn what changesets are, and how to add one.

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

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 3, 2026

📝 Walkthrough

Walkthrough

This PR modifies three Cargo.toml files in the React transform package to optimize swc_core feature flags. It removes several unused features (ecma_parser, ecma_quote, ecma_transforms_react, ecma_visit, testing_transform) from main dependencies and reorganizes feature flags, moving test-specific features to dev-dependencies in the swc_plugin_compat crate.

Changes

Cohort / File(s) Summary
swc_core feature optimization
packages/react/transform/Cargo.toml, packages/react/transform/crates/swc_plugin_compat/Cargo.toml, packages/react/transform/swc-plugin-reactlynx/Cargo.toml
Reduced swc_core feature flags across React transform crates. Main transform removes 5 features (ecma_parser, ecma_quote, ecma_transforms_react, ecma_visit, testing_transform). Plugin compat crate moves ecma_parser and testing_transform to dev-dependencies. Reactlynx plugin removes ecma_visit feature.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

framework:React

Suggested reviewers

  • gaoachao
  • upupming

Poem

🐰 With features trimmed and deps aligned,
We build more lean, leave bloat behind!
The swc_core now knows what's needed—
Optimization's call has been heeded! 🎯✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'chore(swc): optimize swc_core features' directly aligns with the main change—removing unnecessary swc_core features across multiple Cargo.toml files to optimize the dependency configuration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
Copy Markdown

codecov Bot commented Mar 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Mar 3, 2026

Merging this PR will improve performance by 9.62%

⚡ 2 improved benchmarks
✅ 70 untouched benchmarks
⏩ 3 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
basic-performance-nest-level-100 7.6 ms 6.9 ms +9.62%
transform 1000 view elements 44.9 ms 42.2 ms +6.55%

Comparing colinaaa:chore/optimize-swc-features (d4d98de) with main (4a17a62)2

Open in CodSpeed

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.

  2. No successful run was found on main (6cbe5d8) during the generation of this report, so 4a17a62 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@relativeci
Copy link
Copy Markdown

relativeci Bot commented Mar 3, 2026

Web Explorer

#7927 Bundle Size — 383.53KiB (0%).

d4d98de(current) vs 4a17a62 main#7923(baseline)

Bundle metrics  Change 1 change
                 Current
#7927
     Baseline
#7923
No change  Initial JS 154.63KiB 154.63KiB
No change  Initial CSS 35.1KiB 35.1KiB
No change  Cache Invalidation 0% 0%
No change  Chunks 8 8
No change  Assets 8 8
Change  Modules 239(+0.42%) 238
No change  Duplicate Modules 16 16
No change  Duplicate Code 2.99% 2.99%
No change  Packages 4 4
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#7927
     Baseline
#7923
No change  JS 252.58KiB 252.58KiB
No change  Other 95.85KiB 95.85KiB
No change  CSS 35.1KiB 35.1KiB

Bundle analysis reportBranch colinaaa:chore/optimize-swc-feat...Project dashboard


Generated by RelativeCIDocumentationReport issue

@colinaaa colinaaa marked this pull request as ready for review March 3, 2026 15:48
@colinaaa colinaaa requested a review from gaoachao as a code owner March 3, 2026 15:48
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/react/transform/Cargo.toml`:
- Line 22: The swc_core dependency in Cargo.toml was pruned and must be restored
to include the features used by non-test code: add "ecma_visit" (needed for
VisitMut trait implementations referenced by swc_plugin_worklet_post_process,
swc_plugin_extract_str, swc_plugin_refresh, swc_plugin_compat_post) and
"ecma_quote" (needed for the quote! macro used in swc_plugin_extract_str and
swc_plugin_refresh) back into the swc_core features array so the feature list
includes "base", "ecma_codegen", "ecma_transforms_typescript",
"ecma_transforms_optimization", "ecma_visit", and "ecma_quote".

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6cbe5d8 and d4d98de.

📒 Files selected for processing (3)
  • packages/react/transform/Cargo.toml
  • packages/react/transform/crates/swc_plugin_compat/Cargo.toml
  • packages/react/transform/swc-plugin-reactlynx/Cargo.toml

Comment thread packages/react/transform/Cargo.toml
@colinaaa
Copy link
Copy Markdown
Collaborator Author

colinaaa commented Mar 3, 2026

@coderabbitai I've verified that the project compiles successfully with cargo check. It seems ecma_visit and ecma_quote are transitively enabled by other features in swc_core, so explicit declaration isn't needed.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

This pull request has been automatically marked as stale because it has not had recent activity. If this pull request is still relevant, please leave any comment (for example, "bump").

@github-actions github-actions Bot added stale Inactive for 30 days. Will be closed by bots. and removed stale Inactive for 30 days. Will be closed by bots. labels May 2, 2026
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.

1 participant