Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Support React Server Component #6502

Open
wants to merge 24 commits into
base: release/rsc
Choose a base branch
from
Open

Conversation

chenjun1011
Copy link
Collaborator

@chenjun1011 chenjun1011 commented Aug 31, 2023

基础渲染链路

工程

  • 不同类型组件识别转换
  • 生成 Client Manifest
  • 构建 Client Bundle
  • React 版本可切换
  • RSC 能力的开关

Client 端

  • 基于 VDOM 渲染 Server Component
  • 动态拉取 Client Component 的 Bundle 并 Hydrate

Server 端

  • Document 独立渲染
  • Server Component 渲染,并以 VDOM 形式返回
  • 路由匹配
  • Context 透传
  • 数据请求

联动

  • 交互后更新 Server Component 的渲染内容
  • 路由跳转

Test Case

  • test case for rsc render

进阶

  • 首次渲染的形式
    • 默认:动态拉取 VDOM
    • Next.js:同 SSR,返回 HTML
  • 和流式渲染的结合

@ClarkXia ClarkXia changed the base branch from master to release/rsc August 31, 2023 08:37
chenjun1011 and others added 4 commits September 1, 2023 16:33
* feat: bundle canary version of react

* fix: bundle dependencies

* fix: add switch for rsc

* fix: compat with rsc plugin

* fix: server logic
@codecov-commenter
Copy link

codecov-commenter commented Sep 7, 2023

Codecov Report

Attention: 528 lines in your changes are missing coverage. Please review.

Comparison is base (effee4a) 79.93% compared to head (c1deba8) 77.93%.

Files Patch % Lines
...ackages/ice/src/webpack/FlightClientEntryPlugin.ts 16.61% 286 Missing ⚠️
packages/ice/src/webpack/FlightManifestPlugin.ts 23.02% 117 Missing ⚠️
packages/runtime/src/runRSCClientApp.tsx 31.25% 66 Missing ⚠️
packages/ice/src/plugins/web/config.ts 5.88% 16 Missing ⚠️
...ckages/ice/src/bundler/webpack/getWebpackConfig.ts 31.57% 13 Missing ⚠️
packages/ice/src/esbuild/assets.ts 18.75% 13 Missing ⚠️
packages/ice/src/plugins/web/index.ts 50.00% 6 Missing ⚠️
packages/ice/src/webpack/ServerCompilerPlugin.ts 16.66% 5 Missing ⚠️
packages/runtime/src/AppContext.tsx 57.14% 3 Missing ⚠️
packages/runtime/src/utils/getLocation.ts 90.90% 2 Missing ⚠️
... and 1 more
Additional details and impacted files
@@               Coverage Diff               @@
##           release/rsc    #6502      +/-   ##
===============================================
- Coverage        79.93%   77.93%   -2.00%     
===============================================
  Files              218      223       +5     
  Lines            19000    19668     +668     
  Branches          2454     2461       +7     
===============================================
+ Hits             15188    15329     +141     
- Misses            3781     4307     +526     
- Partials            31       32       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

chenjun1011 and others added 7 commits September 13, 2023 14:22
* feat: rsc router

* feat: use server context

* fix: lint

* feat: pass children to router

* fix: lint

* feat: server route

* refactor: rsc entry

* chore: remove dead code
* feat: refresh

* refactor: refresh api
* feat: support rsc transform by swc plugin

* chore: add async component demo

* fix: lint
@ClarkXia ClarkXia mentioned this pull request Sep 26, 2023
chenjun1011 and others added 2 commits September 27, 2023 16:52
* fix: root id

* chore: remove debug code

* chore: revert lock file

* fix: lint
This was referenced Oct 12, 2023
@wssgcg1213 wssgcg1213 changed the title [WIP]feat: rsc poc [WIP] Support React Server Component Oct 12, 2023
chenjun1011 and others added 10 commits October 13, 2023 16:11
* chore: bundle client imports

* chore: build as chunk

* refactor: entry plugin

* feat: generate client entry for rsc

* fix: type

* feat: remove temp route assets

* feat: load assets by default

* fix: avoid chunk information being overwritten

* revert: example

* fix: entry

* fix: lint

* fix: lint

* fix: append manifest

* chore: lock react plugin version

* chore: update lock

* refactor: use utils

* chore: get routes file

* fix: lint

* fix: rsc url
* feat: render rsc into document

* revert: lock file

* fix: init rsc data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants