Skip to content

refactor(react): remove worklet runtime shell package#2440

Merged
Yradex merged 3 commits intolynx-family:mainfrom
Yradex:wt/move-mts-runtime-3-20260401
Apr 9, 2026
Merged

refactor(react): remove worklet runtime shell package#2440
Yradex merged 3 commits intolynx-family:mainfrom
Yradex:wt/move-mts-runtime-3-20260401

Conversation

@Yradex
Copy link
Copy Markdown
Collaborator

@Yradex Yradex commented Apr 9, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Added null safety checks to selector methods (querySelector and querySelectorAll), ensuring graceful handling when the page element is unavailable by returning null or an empty array respectively.
  • Chores

    • Updated build configurations and internal package structure for improved maintainability.
    • Refined test and lint configurations.

Summary

  • remove the standalone packages/react/worklet-runtime shell package and move its worklet bundle build under packages/react
  • keep @lynx-js/react/worklet-runtime and @lynx-js/react/worklet-dev-runtime exported from @lynx-js/react while resolving bindings from runtime/lib/worklet-runtime
  • wire @lynx-js/react-runtime#build into the turbo graph and keep its incremental metadata under runtime/lib so clean builds and published tarballs regenerate both runtime lib artifacts and worklet bundle outputs

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 Apr 9, 2026

⚠️ No Changeset found

Latest commit: 04f043e

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 Apr 9, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: cb46dcd0-f859-42ab-bab4-42605fd289ab

📥 Commits

Reviewing files that changed from the base of the PR and between 09e18e4 and 04f043e.

📒 Files selected for processing (2)
  • eslint.config.js
  • packages/react/runtime/vitest.config.ts
✅ Files skipped from review due to trivial changes (2)
  • packages/react/runtime/vitest.config.ts
  • eslint.config.js

📝 Walkthrough

Walkthrough

This PR consolidates the standalone @lynx-js/react-worklet-runtime package into the main React package by moving its contents under packages/react/runtime, removing the separate package directory, and updating related build configurations, export paths, and workspace settings accordingly.

Changes

Cohort / File(s) Summary
Package Consolidation & Removal
packages/react/worklet-runtime/package.json, packages/react/worklet-runtime/tsconfig.json, packages/react/worklet-runtime/vitest.config.ts, packages/react/worklet-runtime/.gitignore, packages/react/worklet-runtime/.npmignore
Entire worklet-runtime package removed, including manifests, TypeScript config, test config, and git/npm ignore rules previously managing the standalone package.
Build & Configuration Updates
packages/react/rslib.config.ts, packages/react/runtime/turbo.json, packages/react/turbo.json, packages/react/runtime/tsconfig.json
Updated entry paths from relative ../runtime/ to ./runtime/ in rslib config; revised turbo build tasks to reference new output locations (lib/ instead of dist/) and removed worklet-runtime build dependency; added TypeScript paths alias and removed project reference to consolidated worklet-runtime.
Export Paths & Package Scripts
packages/react/package.json, packages/react/runtime/package.json
Updated main package exports for worklet-runtime from ./worklet-runtime/dist/* to ./runtime/worklet-runtime/*; removed top-level worklet-runtime from published files; added build scripts to both packages using rslib build and tsc --build.
Workflow, Workspace & Linting Setup
.github/workflows/test.yml, pnpm-workspace.yaml, eslint.config.js, packages/react/runtime/vitest.config.ts
Removed worklet-runtime from pnpm workspace packages and test workflow filters; added ESLint ignore pattern for generated worklet bundles; excluded worklet-runtime/** from test coverage tracking.
Ignore Rules Updates
packages/react/runtime/.gitignore, packages/react/runtime/.npmignore
Added worklet-runtime/ ignore patterns to prevent publishing build artifacts from the runtime directory.
Source Logic Enhancement
packages/react/runtime/src/worklet-runtime/api/lepusQuerySelector.ts
Refactored querySelector and querySelectorAll to capture PageElement.get() into local variable and return early (null/empty array) when page element is missing, avoiding unnecessary function calls.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~35 minutes

Possibly related PRs

Suggested reviewers

  • hzy
  • HuJean
  • colinaaa
  • luhc228

Poem

🐰 A worklet hops from standing alone,
Into the runtime, it finds its home,
Paths reorganized with care and grace,
Build configs shuffle to their new place,
One small logic fix, then all's complete! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: removing the standalone worklet-runtime package and consolidating it under the main react package.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 Apr 9, 2026

Codecov Report

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

Files with missing lines Patch % Lines
...time/src/worklet-runtime/api/lepusQuerySelector.ts 0.00% 10 Missing ⚠️

📢 Thoughts on this report? Let us know!

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/runtime/__test__/worklet-runtime/runtimeSourceLayout.test.js`:
- Line 63: The test only asserts that 'worklet-runtime' is removed from
reactPackageJson.files; add a positive assertion to ensure the new bundle
directory is published by asserting reactPackageJson.files contains
'runtime/worklet-runtime' (i.e., add an
expect(reactPackageJson.files).toContain('runtime/worklet-runtime') alongside
the existing not.toContain check in runtimeSourceLayout.test.js).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1d8afea1-d8ef-44da-984c-397b9133418f

📥 Commits

Reviewing files that changed from the base of the PR and between 59d11b2 and 09e18e4.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (18)
  • .github/workflows/test.yml
  • packages/react/package.json
  • packages/react/rslib.config.ts
  • packages/react/runtime/.gitignore
  • packages/react/runtime/.npmignore
  • packages/react/runtime/__test__/worklet-runtime/runtimeSourceLayout.test.js
  • packages/react/runtime/package.json
  • packages/react/runtime/src/worklet-runtime/api/lepusQuerySelector.ts
  • packages/react/runtime/tsconfig.json
  • packages/react/runtime/turbo.json
  • packages/react/tsconfig.json
  • packages/react/turbo.json
  • packages/react/worklet-runtime/.gitignore
  • packages/react/worklet-runtime/.npmignore
  • packages/react/worklet-runtime/package.json
  • packages/react/worklet-runtime/tsconfig.json
  • packages/react/worklet-runtime/vitest.config.ts
  • pnpm-workspace.yaml
💤 Files with no reviewable changes (8)
  • packages/react/tsconfig.json
  • pnpm-workspace.yaml
  • packages/react/worklet-runtime/.npmignore
  • .github/workflows/test.yml
  • packages/react/worklet-runtime/.gitignore
  • packages/react/worklet-runtime/vitest.config.ts
  • packages/react/worklet-runtime/package.json
  • packages/react/worklet-runtime/tsconfig.json

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Apr 9, 2026

Merging this PR will improve performance by 16.94%

⚡ 1 improved benchmark
✅ 71 untouched benchmarks
⏩ 21 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
transform 1000 view elements 47.3 ms 40.5 ms +16.94%

Comparing Yradex:wt/move-mts-runtime-3-20260401 (04f043e) with main (59d11b2)

Open in CodSpeed

Footnotes

  1. 21 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.

@relativeci
Copy link
Copy Markdown

relativeci bot commented Apr 9, 2026

React External

#283 Bundle Size — 590.57KiB (0%).

04f043e(current) vs 59d11b2 main#264(baseline)

Bundle metrics  no changes
                 Current
#283
     Baseline
#264
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 3 3
No change  Modules 17 17
No change  Duplicate Modules 5 5
No change  Duplicate Code 8.59% 8.59%
No change  Packages 0 0
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#283
     Baseline
#264
No change  Other 590.57KiB 590.57KiB

Bundle analysis reportBranch Yradex:wt/move-mts-runtime-3-202...Project dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link
Copy Markdown

relativeci bot commented Apr 9, 2026

React MTF Example

#298 Bundle Size — 206.09KiB (+0.02%).

04f043e(current) vs 59d11b2 main#278(baseline)

Bundle metrics  Change 1 change
                 Current
#298
     Baseline
#278
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
Change  Cache Invalidation 46.02% 0%
No change  Chunks 0 0
No change  Assets 3 3
No change  Modules 173 173
No change  Duplicate Modules 67 67
No change  Duplicate Code 45.77% 45.77%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  Change 1 change Regression 1 regression
                 Current
#298
     Baseline
#278
No change  IMG 111.23KiB 111.23KiB
Regression  Other 94.85KiB (+0.04%) 94.81KiB

Bundle analysis reportBranch Yradex:wt/move-mts-runtime-3-202...Project dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link
Copy Markdown

relativeci bot commented Apr 9, 2026

Web Explorer

#8740 Bundle Size — 730.24KiB (0%).

04f043e(current) vs 59d11b2 main#8720(baseline)

Bundle metrics  no changes
                 Current
#8740
     Baseline
#8720
No change  Initial JS 43.63KiB 43.63KiB
No change  Initial CSS 2.16KiB 2.16KiB
No change  Cache Invalidation 0% 0%
No change  Chunks 8 8
No change  Assets 10 10
No change  Modules 150 150
No change  Duplicate Modules 11 11
No change  Duplicate Code 34.68% 34.68%
No change  Packages 3 3
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#8740
     Baseline
#8720
No change  Other 385.55KiB 385.55KiB
No change  JS 342.53KiB 342.53KiB
No change  CSS 2.16KiB 2.16KiB

Bundle analysis reportBranch Yradex:wt/move-mts-runtime-3-202...Project dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link
Copy Markdown

relativeci bot commented Apr 9, 2026

React Example

#7165 Bundle Size — 236.79KiB (0%).

04f043e(current) vs 59d11b2 main#7145(baseline)

Bundle metrics  no changes
                 Current
#7165
     Baseline
#7145
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 179 179
No change  Duplicate Modules 70 70
No change  Duplicate Code 46.11% 46.11%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#7165
     Baseline
#7145
No change  IMG 145.76KiB 145.76KiB
No change  Other 91.03KiB 91.03KiB

Bundle analysis reportBranch Yradex:wt/move-mts-runtime-3-202...Project dashboard


Generated by RelativeCIDocumentationReport issue

@Yradex Yradex marked this pull request as ready for review April 9, 2026 08:23
@Yradex Yradex requested review from HuJean and hzy as code owners April 9, 2026 08:23
@Yradex Yradex merged commit 045ca2f into lynx-family:main Apr 9, 2026
48 of 50 checks passed
@Yradex Yradex deleted the wt/move-mts-runtime-3-20260401 branch April 9, 2026 11:09
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.

2 participants