Skip to content

feat: support web preview in rspeedy dev#1893

Merged
PupilTong merged 4 commits intolynx-family:mainfrom
PupilTong:p/hw/rspeedy-use-middleware-no-print
Oct 17, 2025
Merged

feat: support web preview in rspeedy dev#1893
PupilTong merged 4 commits intolynx-family:mainfrom
PupilTong:p/hw/rspeedy-use-middleware-no-print

Conversation

@PupilTong
Copy link
Copy Markdown
Collaborator

@PupilTong PupilTong commented Oct 17, 2025

#1806

Summary by CodeRabbit

  • New Features

    • Added experimental web preview functionality to rspeedy dev environment, enabling developers to preview web-based content during development with enhanced middleware support.
  • Tests

    • Added test coverage for web preview middleware initialization to ensure proper functionality when the web environment is configured.

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 Oct 17, 2025

🦋 Changeset detected

Latest commit: 61aa18d

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

This PR includes changesets to release 3 packages
Name Type
@lynx-js/rspeedy Patch
create-rspeedy Patch
upgrade-rspeedy Patch

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

coderabbitai bot commented Oct 17, 2025

📝 Walkthrough

Walkthrough

This pull request adds web preview support to rspeedy dev by introducing a new middleware dependency, registering a web preview middleware during dev server initialization, and adding corresponding test coverage. The changes include a changeset entry, dependency configuration, conditional middleware registration, and test validation.

Changes

Cohort / File(s) Summary
Changeset entry
.changeset/twenty-places-pump.md
Records a patch-level version bump for @lynx-js/rspeedy with experimental web preview feature description.
Configuration updates
packages/rspeedy/core/package.json, packages/rspeedy/core/tsconfig.json
Adds @lynx-js/web-rsbuild-server-middleware dependency and corresponding tsconfig reference.
Dev plugin implementation
packages/rspeedy/core/src/plugins/dev.plugin.ts
Implements onBeforeStartDevServer hook that conditionally registers createWebVirtualFilesMiddleware at /__web_preview endpoint when web environment is present.
Test coverage
packages/rspeedy/core/test/plugins/dev.plugin.test.ts
Adds test case verifying web middleware installation for environment.web configuration.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

The changes span multiple file types (changeset, config, implementation, test) with straightforward conditional middleware registration logic. Review requires verifying dependency integration, middleware correctness, and test adequacy across the cohesive feature addition.

Possibly related PRs

Suggested reviewers

  • colinaaa
  • gaoachao

Poem

🐰✨ A dev server blooms, with web preview so bright,
Middleware dances at /__web_preview's light,
Lynx leaps forward with rspeedy's new flight,
Conditional hooks make the dev path just right! 🌐⚡

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "feat: support web preview in rspeedy dev" directly and accurately reflects the main change across all modified files. The changeset confirms this is a patch-level update introducing web preview support in rspeedy dev, and all code changes align with this objective: adding a new dependency, implementing the onBeforeStartDevServer hook to register web preview middleware, adding corresponding test coverage, and updating TypeScript configuration. The title is clear, specific, concise, and uses conventional commit formatting without vague or misleading language.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 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 Oct 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 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

🧹 Nitpick comments (1)
packages/rspeedy/core/test/plugins/dev.plugin.test.ts (1)

654-670: Consider verifying the middleware path parameter.

The test successfully verifies that the middleware is installed, but doesn't check that it was called with the correct path '/__web_preview'.

Optionally strengthen the assertion:

 await using server = await rsbuild.usingDevServer()
 await server.waitDevCompileDone()
-expect(vi.mocked(middleware.createWebVirtualFilesMiddleware)).toBeCalled()
+expect(vi.mocked(middleware.createWebVirtualFilesMiddleware))
+  .toHaveBeenCalledWith('/__web_preview')
📜 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 7570a5e and 61aa18d.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (5)
  • .changeset/twenty-places-pump.md (1 hunks)
  • packages/rspeedy/core/package.json (1 hunks)
  • packages/rspeedy/core/src/plugins/dev.plugin.ts (1 hunks)
  • packages/rspeedy/core/test/plugins/dev.plugin.test.ts (1 hunks)
  • packages/rspeedy/core/tsconfig.json (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
.changeset/*.md

📄 CodeRabbit inference engine (AGENTS.md)

For contributions, generate and commit a Changeset describing your changes

Files:

  • .changeset/twenty-places-pump.md
🧬 Code graph analysis (2)
packages/rspeedy/core/test/plugins/dev.plugin.test.ts (1)
packages/rspeedy/core/test/createStubRspeedy.ts (1)
  • createStubRspeedy (20-64)
packages/rspeedy/core/src/plugins/dev.plugin.ts (1)
packages/web-platform/web-rsbuild-server-middleware/src/node/index.ts (1)
  • createWebVirtualFilesMiddleware (22-89)
⏰ 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). (3)
  • GitHub Check: build / Build (Ubuntu)
  • GitHub Check: build / Build (Windows)
  • GitHub Check: test-rust / Test (Ubuntu)
🔇 Additional comments (3)
packages/rspeedy/core/package.json (1)

59-59: LGTM! Dependency addition aligns with the new web preview feature.

The workspace protocol is appropriate for internal monorepo dependencies.

packages/rspeedy/core/tsconfig.json (1)

24-24: LGTM! TypeScript project reference correctly configured.

This reference aligns with the newly added dependency.

.changeset/twenty-places-pump.md (1)

1-7: LGTM! Changeset correctly documents the new feature.

The patch-level bump is appropriate, and marking the feature as experimental sets clear expectations.

Comment thread packages/rspeedy/core/src/plugins/dev.plugin.ts
@relativeci
Copy link
Copy Markdown

relativeci bot commented Oct 17, 2025

React Example

#5936 Bundle Size — 237.5KiB (0%).

61aa18d(current) vs 7570a5e main#5928(baseline)

Bundle metrics  no changes
                 Current
#5936
     Baseline
#5928
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.77% 46.77%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#5936
     Baseline
#5928
No change  IMG 145.76KiB 145.76KiB
No change  Other 91.74KiB 91.74KiB

Bundle analysis reportBranch PupilTong:p/hw/rspeedy-use-middl...Project dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link
Copy Markdown

relativeci bot commented Oct 17, 2025

Web Explorer

#5932 Bundle Size — 364.68KiB (0%).

61aa18d(current) vs 7570a5e main#5924(baseline)

Bundle metrics  Change 1 change
                 Current
#5932
     Baseline
#5924
No change  Initial JS 144.63KiB 144.63KiB
No change  Initial CSS 32.11KiB 32.11KiB
No change  Cache Invalidation 0% 0%
No change  Chunks 8 8
No change  Assets 8 8
Change  Modules 218(-0.46%) 219
No change  Duplicate Modules 16 16
No change  Duplicate Code 3.23% 3.23%
No change  Packages 4 4
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#5932
     Baseline
#5924
No change  JS 238.77KiB 238.77KiB
No change  Other 93.8KiB 93.8KiB
No change  CSS 32.11KiB 32.11KiB

Bundle analysis reportBranch PupilTong:p/hw/rspeedy-use-middl...Project dashboard


Generated by RelativeCIDocumentationReport issue

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Oct 17, 2025

CodSpeed Performance Report

Merging #1893 will degrade performances by 9.68%

Comparing PupilTong:p/hw/rspeedy-use-middleware-no-print (61aa18d) with main (7570a5e)

Summary

⚡ 2 improvements
❌ 2 regressions
✅ 49 untouched
⏩ 3 skipped1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark BASE HEAD Change
basic-performance-div-100 5.9 ms 6.5 ms -9.68%
basic-performance-div-10000 382.7 ms 404.9 ms -5.49%
basic-performance-scroll-view-100 9.7 ms 8.9 ms +9.01%
basic-performance-small-css 7.8 ms 7 ms +11.82%

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.

@PupilTong PupilTong merged commit fc42e83 into lynx-family:main Oct 17, 2025
51 of 52 checks passed
colinaaa pushed a commit that referenced this pull request Oct 25, 2025
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @lynx-js/react@0.114.3

### Patch Changes

- Initialize `ctxNotFoundEventListener` before each test in testing
library ([#1888](#1888))

- fix: main thread functions created during the initial render cannot
correctly modify `MainThreadRef`s after hydration
([#1884](#1884))

## @lynx-js/rspeedy@0.11.7

### Patch Changes

- Bump Rsbuild v1.5.17.
([#1889](#1889))

- feat: support web preview in rspeedy dev
([#1893](#1893))

    -   support web preview in rspeedy dev (experimental)

-   Updated dependencies \[]:
    -   @lynx-js/web-rsbuild-server-middleware@0.18.1

## @lynx-js/web-constants@0.18.1

### Patch Changes

-   Updated dependencies \[]:
    -   @lynx-js/web-worker-rpc@0.18.1

## @lynx-js/web-core@0.18.1

### Patch Changes

- fix: mts freeze after reload()
([#1892](#1892))

    The mts may be freezed after reload() called.

We fixed it by waiting until the all-on-ui Javascript realm
implementation, an iframe, to be fully loaded.

- Updated dependencies
\[[`70a18fc`](70a18fc)]:
    -   @lynx-js/web-mainthread-apis@0.18.1
    -   @lynx-js/web-worker-runtime@0.18.1
    -   @lynx-js/web-constants@0.18.1
    -   @lynx-js/web-worker-rpc@0.18.1

## @lynx-js/web-elements@0.8.9

### Patch Changes

- fix: layoutchange event result `detail.top` and `detail.left` was `0`
incorrectly
([#1887](#1887))

- textarea placeholder inherits font-size by default
([#1874](#1874))

- feat: support <x-text text="content"></x-text>
([#1881](#1881))

-   Updated dependencies \[]:
    -   @lynx-js/web-elements-template@0.8.9

## @lynx-js/web-mainthread-apis@0.18.1

### Patch Changes

- fix: mts freeze after reload()
([#1892](#1892))

    The mts may be freezed after reload() called.

We fixed it by waiting until the all-on-ui Javascript realm
implementation, an iframe, to be fully loaded.

-   Updated dependencies \[]:
    -   @lynx-js/web-constants@0.18.1
    -   @lynx-js/web-style-transformer@0.18.1

## @lynx-js/web-worker-runtime@0.18.1

### Patch Changes

- Updated dependencies
\[[`70a18fc`](70a18fc)]:
    -   @lynx-js/web-mainthread-apis@0.18.1
    -   @lynx-js/web-constants@0.18.1
    -   @lynx-js/web-worker-rpc@0.18.1

## create-rspeedy@0.11.7



## upgrade-rspeedy@0.11.7



## @lynx-js/web-core-server@0.18.1



## @lynx-js/web-elements-template@0.8.9



## @lynx-js/web-rsbuild-server-middleware@0.18.1



## @lynx-js/web-style-transformer@0.18.1



## @lynx-js/web-worker-rpc@0.18.1

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants