Skip to content

Commit bd6a2a1

Browse files
authored
chore(rsc): deprecate @vitejs/plugin-rsc/extra API (#592)
1 parent fa1d260 commit bd6a2a1

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

packages/plugin-rsc/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,10 @@ export default defineConfig({
419419
})
420420
```
421421

422-
## Higher level API
422+
## High level API
423+
424+
> [!NOTE]
425+
> High level API is deprecated. Please write on your own `@vitejs/plugin-rsc/{rsc,ssr,browser}` integration.
423426

424427
This is a wrapper of `react-server-dom` API and helper API to setup a minimal RSC app without writing own framework code like [`./examples/starter/src/framework`](./examples/starter/src/framework/). See [`./examples/basic`](./examples/basic/) for how this API is used.
425428

packages/plugin-rsc/src/extra/browser.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ import {
1111
} from '../browser'
1212
import type { RscPayload } from './rsc'
1313

14+
/**
15+
* @deprecated Use `@vitejs/plugin-rsc/browser` API instead.
16+
*/
1417
export async function hydrate(): Promise<void> {
1518
const callServer: CallServerCallback = async (id, args) => {
1619
const url = new URL(window.location.href)
@@ -71,6 +74,9 @@ export async function hydrate(): Promise<void> {
7174
}
7275
}
7376

77+
/**
78+
* @deprecated Use `@vitejs/plugin-rsc/browser` API instead.
79+
*/
7480
export async function fetchRSC(
7581
request: string | URL | Request,
7682
): Promise<RscPayload['root']> {

packages/plugin-rsc/src/extra/rsc.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ export type RscPayload = {
1414
returnValue?: unknown
1515
}
1616

17+
/**
18+
* @deprecated Use `@vitejs/plugin-rsc/rsc` API instead.
19+
*/
1720
export async function renderRequest(
1821
request: Request,
1922
root: React.ReactNode,

packages/plugin-rsc/src/extra/ssr.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ import { injectRSCPayload } from 'rsc-html-stream/server'
55
import { createFromReadableStream } from '../ssr'
66
import type { RscPayload } from './rsc'
77

8+
/**
9+
* @deprecated Use `@vitejs/plugin-rsc/ssr` API instead.
10+
*/
811
export async function renderHtml(
912
rscStream: ReadableStream<Uint8Array>,
1013
options?: {

0 commit comments

Comments
 (0)