Skip to content

Conversation

@gaoachao
Copy link
Collaborator

@gaoachao gaoachao commented Sep 10, 2025

Partial cherry-pick from #1458

Summary by CodeRabbit

  • Performance

    • Release builds now enable link-time optimization and size-focused optimization, reducing binary size and potentially improving load times (notably for WebAssembly).
  • Chores

    • Centralized dependency versions across the workspace for consistency and simpler maintenance.
    • Updated WebAssembly target configuration to include a custom randomness feature.
    • Added a placeholder changeset entry.
  • Notes

    • No user-facing behavior changes expected.

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).

@gaoachao gaoachao requested a review from PupilTong as a code owner September 10, 2025 11:33
@changeset-bot
Copy link

changeset-bot bot commented Sep 10, 2025

🦋 Changeset detected

Latest commit: 66b7630

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 10, 2025

📝 Walkthrough

Walkthrough

Centralizes crate versions in a new [workspace.dependencies] in the root Cargo.toml, switches several crate Cargo.toml files to workspace-managed dependencies, enables LTO and size optimization in release profile, adds a wasm getrandom feature, and adds an empty changeset metadata file. No runtime or public API changes.

Changes

Cohort / File(s) Summary
Workspace dependency management
Cargo.toml
Adds [workspace.dependencies] listing common crates and pins versions workspace-wide; updates [profile.release] to lto = true and opt-level = "s". No API changes.
React transform crate deps
packages/react/transform/Cargo.toml
Replaces explicit versions with workspace = true for many deps (e.g., convert_case, hex, indexmap, once_cell, regex, rustc-hash, serde, serde_json, sha-1, swc_core, version-compare); retains features and adds features = ["custom"] for wasm32 getrandom target.
Web style transformer deps
packages/web-platform/web-style-transformer/Cargo.toml
Switches js-sys, lazy_static, and wasm-bindgen to workspace = true; inline-style-parser path dependency unchanged.
Repo metadata
.changeset/fluffy-cougars-post.md
Adds an empty changeset file containing only front-matter delimiters (--- blank ---).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • PupilTong
  • colinaaa

Pre-merge checks (2 passed, 1 warning)

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title Check ⚠️ Warning The current title is intended to summarize the migration of the React transform package to a Cargo workspace but contains a spelling error (“transfrom”) and thus fails to clearly and accurately convey the primary change. Please correct the spelling of “transfrom” to “transform” in the scope and ensure the title reads something like “refactor(react/transform): migrate to Cargo workspace” to clearly reflect the change.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

Poem

I hopped through Cargo.toml with a twitchy nose,
Gathered all the deps where the workspace grows.
LTO trimmed my whiskers, wasm got a bite,
A tiny changeset tucked in moonlight.
Hop—no code changed, just order neat and bright. 🐇✨

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/cargo-workspace

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 10, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

colinaaa
colinaaa previously approved these changes Sep 10, 2025
Copy link
Collaborator

@colinaaa colinaaa left a comment

Choose a reason for hiding this comment

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

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

🧹 Nitpick comments (1)
Cargo.toml (1)

10-26: Centralizing versions is good; watch out for dropped per-crate features.

Workspace deps don’t propagate features. If any member needs serde/derive (very common), ensure that crate re-adds the feature locally.

Would you like me to scan members and open a follow-up PR to add missing features where needed?

📜 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 6cc0e85 and 42389af.

📒 Files selected for processing (4)
  • .changeset/fluffy-cougars-post.md (1 hunks)
  • Cargo.toml (1 hunks)
  • packages/react/transform/Cargo.toml (1 hunks)
  • packages/web-platform/web-style-transformer/Cargo.toml (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
.changeset/*.md

📄 CodeRabbit inference engine (AGENTS.md)

For contributions, always generate a changeset and commit the resulting markdown file(s)

Files:

  • .changeset/fluffy-cougars-post.md
🧠 Learnings (2)
📚 Learning: 2025-07-22T09:23:07.797Z
Learnt from: colinaaa
PR: lynx-family/lynx-stack#1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.

Applied to files:

  • .changeset/fluffy-cougars-post.md
📚 Learning: 2025-07-22T09:26:16.722Z
Learnt from: colinaaa
PR: lynx-family/lynx-stack#1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.

Applied to files:

  • .changeset/fluffy-cougars-post.md
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Validate PR title
  • GitHub Check: build / Build (Windows)
  • GitHub Check: build / Build (Ubuntu)
  • GitHub Check: test-rust / Test (Ubuntu)
🔇 Additional comments (4)
.changeset/fluffy-cougars-post.md (1)

1-3: Empty changeset aligns with repo policy for internal refactors.

Per retrieved learnings for this repo, an empty changeset is acceptable to satisfy CI for non-user-facing refactors. Please just confirm CI accepts this file as-is.

Note: I used the stored learnings you provided to validate this behavior.

packages/web-platform/web-style-transformer/Cargo.toml (1)

11-13: LGTM: moved to workspace-managed wasm deps.

js-sys, lazy_static, and wasm-bindgen now resolve via workspace; versions will stay consistent across crates.

packages/react/transform/Cargo.toml (2)

22-22: SWC feature set preserved — good.

Feature list matches prior intent while moving to workspace-managed versioning.


26-27: Ignore WASM RNG feature suggestion

The custom getrandom implementation is registered via register_custom_getrandom!(custom_getrandom) in packages/react/transform/src/lib.rs, so keeping features = ["custom"] is correct.

Likely an incorrect or invalid review comment.

@relativeci
Copy link

relativeci bot commented Sep 10, 2025

React Example

#5073 Bundle Size — 238.2KiB (0%).

66b7630(current) vs 05c21dc main#5065(baseline)

Bundle metrics  no changes
                 Current
#5073
     Baseline
#5065
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 163 163
No change  Duplicate Modules 67 67
No change  Duplicate Code 46.88% 46.88%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#5073
     Baseline
#5065
No change  IMG 145.76KiB 145.76KiB
No change  Other 92.45KiB 92.45KiB

Bundle analysis reportBranch refactor/cargo-workspaceProject dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link

relativeci bot commented Sep 10, 2025

Web Explorer

#5066 Bundle Size — 361.93KiB (0%).

66b7630(current) vs 05c21dc main#5058(baseline)

Bundle metrics  no changes
                 Current
#5066
     Baseline
#5058
No change  Initial JS 144.4KiB 144.4KiB
No change  Initial CSS 31.84KiB 31.84KiB
No change  Cache Invalidation 0% 0%
No change  Chunks 8 8
No change  Assets 8 8
No change  Modules 219 219
No change  Duplicate Modules 16 16
No change  Duplicate Code 3.34% 3.34%
No change  Packages 4 4
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#5066
     Baseline
#5058
No change  JS 236.07KiB 236.07KiB
No change  Other 94.02KiB 94.02KiB
No change  CSS 31.84KiB 31.84KiB

Bundle analysis reportBranch refactor/cargo-workspaceProject dashboard


Generated by RelativeCIDocumentationReport issue

@codspeed-hq
Copy link

codspeed-hq bot commented Sep 10, 2025

CodSpeed Performance Report

Merging #1714 will not alter performance

Comparing refactor/cargo-workspace (66b7630) with main (05c21dc)

🎉 Hooray! codspeed-cpp just leveled up to 1.2.0!

A heads-up, this is a breaking change and it might affect your current performance baseline a bit. But here's the exciting part - it's packed with new, cool features and promises improved result stability 🥳!
Curious about what's new? Visit our releases page to delve into all the awesome details about this new version.

Summary

✅ 53 untouched benchmarks

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

♻️ Duplicate comments (1)
packages/react/transform/Cargo.toml (1)

19-19: Thank you for preserving serde derive.

Keeping features = ["derive"] avoids macro resolution failures after the workspace switch. This addresses the earlier feedback.

🧹 Nitpick comments (1)
packages/react/transform/Cargo.toml (1)

22-22: Consider gating internal/testing swc_core features.

"__testing_transform" (and sometimes "__visit") are internal/testing aids. If not required at runtime, remove them from default features or gate behind a local cargo feature to speed builds.

Example:

-swc_core = { workspace = true, features = ["base", "ecma_codegen", "ecma_parser", "ecma_minifier", "ecma_transforms_typescript", "ecma_utils", "ecma_quote", "ecma_transforms_react", "ecma_transforms_optimization", "css_parser", "css_ast", "css_visit", "css_codegen", "__visit", "__testing_transform"] }
+swc_core = { workspace = true, features = ["base", "ecma_codegen", "ecma_parser", "ecma_minifier", "ecma_transforms_typescript", "ecma_utils", "ecma_quote", "ecma_transforms_react", "ecma_transforms_optimization", "css_parser", "css_ast", "css_visit", "css_codegen"] }

Or gate testing-only ones:

[features]
noop = []
testing = []

[target.'cfg(any())'.dependencies]
# none

[dependencies]
# swc_core as above without testing flags

[dev-dependencies]
swc_core = { workspace = true, features = ["__testing_transform"] }
📜 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 42389af and 66b7630.

📒 Files selected for processing (2)
  • Cargo.toml (1 hunks)
  • packages/react/transform/Cargo.toml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • Cargo.toml
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: gaoachao
PR: lynx-family/lynx-stack#1714
File: packages/react/transform/Cargo.toml:19-19
Timestamp: 2025-09-10T11:42:36.812Z
Learning: In packages/react/transform/Cargo.toml, the crate uses serde derive macros (#[derive(Serialize, Deserialize)]) in multiple files including src/esbuild.rs and src/swc_plugin_extract_str/mod.rs, so the "derive" feature is required when migrating to workspace dependencies.
📚 Learning: 2025-09-10T11:42:36.812Z
Learnt from: gaoachao
PR: lynx-family/lynx-stack#1714
File: packages/react/transform/Cargo.toml:19-19
Timestamp: 2025-09-10T11:42:36.812Z
Learning: In packages/react/transform/Cargo.toml, the crate uses serde derive macros (#[derive(Serialize, Deserialize)]) in multiple files including src/esbuild.rs and src/swc_plugin_extract_str/mod.rs, so the "derive" feature is required when migrating to workspace dependencies.

Applied to files:

  • packages/react/transform/Cargo.toml
🔇 Additional comments (2)
packages/react/transform/Cargo.toml (2)

11-13: Workspace migration for shared crates looks good.

Converting convert_case, hex, indexmap, once_cell, regex, rustc-hash, sha-1, and version-compare to workspace-managed deps is consistent and reduces version drift.

Also applies to: 16-18, 21-21, 23-23


25-27: No changes needed—custom getrandom registration is in place
The wasm32-unknown-unknown module already calls register_custom_getrandom!(custom_getrandom), satisfying the “custom” feature requirement.

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.

4 participants