Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 0 additions & 48 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,54 +45,6 @@ jobs:
- run: pnpm -C packages/import-attributes build
- run: pnpm -C packages/import-attributes test-e2e

# superseded by @vitejs/plugin-rsc
# https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-rsc
# test-rsc:
# name: test-rsc (${{ matrix.os }} / ${{ matrix.browser }})
# runs-on: ${{ matrix.os }}
# strategy:
# # TODO: shard?
# matrix:
# os: [ubuntu-latest, macos-latest, windows-latest]
# browser: [chromium]
# include:
# - os: ubuntu-latest
# browser: firefox
# - os: macos-latest
# browser: webkit
# fail-fast: false
# steps:
# - uses: actions/checkout@v4
# - uses: ./.github/actions/setup
# with:
# build: false
# playwright: false
# - run: pnpm vite-ecosystem-ci:build
# - run: pnpm exec playwright install ${{ matrix.browser }}
# - run: pnpm -C packages/rsc test-e2e-ci --project=${{ matrix.browser }}
# env:
# TEST_ISOLATED: true
# - uses: actions/upload-artifact@v4
# if: always()
# with:
# name: test-results-${{ matrix.os }}-${{ matrix.browser }}
# path: |
# packages/rsc/test-results

# test-rolldown:
# name: test-rolldown
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: ./.github/actions/setup
# with:
# build: false
# - run: pnpm vite-ecosystem-ci:build
# - run: pnpm i -w vite@npm:rolldown-vite@latest && pnpm i --no-frozen-lockfile
# - run: pnpm -C packages/rsc test-e2e --grep-invert cloudflare
# env:
# TEST_ISOLATED: true

# test-react-server-basic:
# runs-on: ubuntu-latest
# steps:
Expand Down
24 changes: 0 additions & 24 deletions .github/workflows/pkg-pr-new.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,6 @@ jobs:
with:
playwright: false

# stable
- run: |
cp -rf packages/rsc packages/rsc-stable

# canary
- run: |
pnpm i -w react@canary react-dom@canary react-server-dom-webpack@canary
pnpm i --no-frozen-lockfile
pnpm -C packages/rsc build
cp -rf packages/rsc packages/rsc-canary
sed -i 's#"name": "@hiogawa/vite-rsc"#"name": "@hiogawa/vite-rsc-canary"#' packages/rsc-canary/package.json

# experimental
- run: |
pnpm i -w react@experimental react-dom@experimental react-server-dom-webpack@experimental
pnpm i --no-frozen-lockfile
pnpm -C packages/rsc build
cp -rf packages/rsc packages/rsc-experimental
sed -i 's#"name": "@hiogawa/vite-rsc"#"name": "@hiogawa/vite-rsc-experimental"#' packages/rsc-experimental/package.json

# strip prepack to avoid duplicate builds
- run: |
for pkg in packages/*/package.json; do
Expand All @@ -43,10 +23,6 @@ jobs:
pnpx pkg-pr-new publish --comment=off \
packages/react-server \
packages/react-server-next \
packages/rsc-stable \
packages/rsc-canary \
packages/rsc-experimental \
packages/rsc-react-router \
packages/transforms \
packages/import-attributes \
packages/vite-plugin-ssr-middleware \
Expand Down
15 changes: 4 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@ Random collection of vite plugins

## plugins

### [`@hiogawa/vite-rsc`](./packages/rsc)

> [!important]
> `@hiogawa/vite-rsc` is now maintained as Vite's official package [`@vitejs/plugin-rsc`](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-rsc).

Framework-less Vite RSC plugin

### [`@hiogawa/react-server`](./packages/react-server)

Next.js-like RSC framework on Vite
Expand All @@ -24,9 +17,9 @@ and [`@vavite/expose-vite-dev-server`](https://github.com/cyco130/vavite/tree/ma

### How to release a package

Example: `packages/rsc`
Example: `packages/transforms`

1. Manually bump `packages/rsc/package.json` version
2. Update changelog via `pnpm changelog packages/rsc`
1. Manually bump `packages/transforms/package.json` version
2. Update changelog via `pnpm changelog packages/transforms`
3. Create a PR and merge to main
4. Locally run `pnpm release packages/rsc`
4. Locally run `pnpm release packages/transforms`
88 changes: 88 additions & 0 deletions docs/2026-01-05-rsc-cleanup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# RSC Packages Cleanup

## Summary

Removed the following packages from this repository:

- **`packages/rsc`** - Now maintained as Vite's official package [`@vitejs/plugin-rsc`](https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-rsc)
- **`packages/rsc-react-router`** - Now officially supported by React Router team at https://reactrouter.com/how-to/react-server-components

## react-server Migration to @vitejs/plugin-rsc

`packages/react-server` can be migrated to use `@vitejs/plugin-rsc` with the following changes:

### Import Path Mappings

| @hiogawa/vite-rsc | @vitejs/plugin-rsc |
|---|---|
| `/react/browser` | `/browser` |
| `/react/rsc` | `/rsc` |
| `/react/ssr` | `/ssr` |
| `/core/plugin` (default export) | main export |

### Files Requiring Updates (11 files)

| File | Current Import |
|------|---------------|
| `src/entry/browser.tsx` | `@hiogawa/vite-rsc/react/browser` |
| `src/entry/server.tsx` | `@hiogawa/vite-rsc/react/rsc` |
| `src/entry/ssr.tsx` | `@hiogawa/vite-rsc/react/ssr` |
| `src/features/client-component/browser.tsx` | `@hiogawa/vite-rsc/react/browser` |
| `src/features/client-component/server.tsx` | `@hiogawa/vite-rsc/react/rsc` |
| `src/features/client-component/ssr.tsx` | `@hiogawa/vite-rsc/react/ssr` |
| `src/features/client-component/plugin.ts` | `@hiogawa/vite-rsc/vite-utils` |
| `src/features/server-action/browser.tsx` | `@hiogawa/vite-rsc/react/browser` |
| `src/features/server-action/server.tsx` | `@hiogawa/vite-rsc/react/rsc` |
| `src/features/server-action/ssr.tsx` | `@hiogawa/vite-rsc/react/ssr` |
| `src/plugin/index.ts` | `@hiogawa/vite-rsc/core/plugin`, `@hiogawa/vite-rsc/plugin` |

### Utility Functions Not Exported by @vitejs/plugin-rsc

These need to be copied into react-server or alternative implementations found:

#### 1. `vitePluginFindSourceMapURL` (~60 lines)

- **Source**: `packages/rsc/src/plugin.ts:1315-1375`
- **Purpose**: Provides source map URLs for React's error overlay
- **Used at**: `packages/react-server/src/plugin/index.ts:332`

```typescript
export function vitePluginFindSourceMapURL(): Plugin[] {
return [
{
name: "rsc:findSourceMapURL",
apply: "serve",
configureServer(server) {
server.middlewares.use(async (req, res, next) => {
const url = new URL(req.url!, `http://localhost`);
if (url.pathname === "/__vite_rsc_findSourceMapURL") {
// ... handle source map URL lookup
}
next();
});
},
},
];
}
```

#### 2. `normalizeViteImportAnalysisUrl` (~15 lines + dependencies ~100 lines)

- **Source**: `packages/rsc/src/vite-utils.ts`
- **Purpose**: Normalizes client reference IDs to match Vite's import analysis
- **Used at**: `packages/react-server/src/features/client-component/plugin.ts:121`

This function depends on several helper utilities from the same file:
- `VALID_ID_PREFIX`, `NULL_BYTE_PLACEHOLDER`, `FS_PREFIX`
- `wrapId`, `unwrapId`, `withTrailingSlash`, `cleanUrl`
- `splitFileAndPostfix`, `slash`, `injectQuery`, `joinUrlSegments`
- `normalizeResolvedIdToUrl`

### React Runtime APIs (Should Be Compatible)

These are re-exports from react-server-dom and should work the same:

- `renderToReadableStream`, `createFromReadableStream`
- `decodeReply`, `loadServerAction`, `decodeAction`, `decodeFormState`
- `encodeReply`, `createFromFetch`, `setServerCallback`
- `setRequireModule`, `registerClientReference`, `registerServerReference`
4 changes: 0 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
"tsc": "tsc -b packages/*/tsconfig.json packages/*/e2e/tsconfig.json packages/*/examples/*/tsconfig.json",
"tsc-dev": "pnpm tsc --watch --preserveWatchOutput",
"test": "pnpm -r --sequential test run",
"vite-ecosystem-ci:build": "pnpm -r --filter '@hiogawa/vite-rsc...' build",
"vite-ecosystem-ci:before-test": "playwright install chromium",
"vite-ecosystem-ci:test": "pnpm -C packages/rsc test-e2e",
"lint": "biome check --write .",
"lint-check": "biome check ."
},
Expand Down Expand Up @@ -50,7 +47,6 @@
"react-dom": "$react-dom",
"react-server-dom-webpack": "$react-server-dom-webpack",
"@hiogawa/react-server": "workspace:*",
"@hiogawa/vite-rsc": "workspace:*",
"@playwright/test": "$@playwright/test",
"@types/react": "$@types/react",
"@types/react-dom": "$@types/react-dom",
Expand Down
1 change: 0 additions & 1 deletion packages/react-server/misc/overrides.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const deps = ["react-server", "transforms", "vite-plugin-ssr-middleware"];
const overrides = Object.fromEntries(
deps.map((dep) => [`@hiogawa/${dep}`, `file:${resolve(packages, dep)}`]),
);
overrides["@hiogawa/vite-rsc"] = `file:${resolve(packages, "rsc")}`;

editJson(argv[2], (pkg) => {
Object.assign(((pkg.pnpm ??= {}).overrides ??= {}), overrides);
Expand Down
2 changes: 1 addition & 1 deletion packages/react-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
},
"dependencies": {
"@hiogawa/transforms": "workspace:*",
"@hiogawa/vite-rsc": "workspace:*",
"@hiogawa/vite-rsc": "^0.4.9",
"es-module-lexer": "^1.6.0",
"fast-glob": "^3.3.3",
"vitefu": "^1.0.5"
Expand Down
22 changes: 2 additions & 20 deletions packages/rsc-react-router/README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,2 @@
# @hiogawa/vite-rsc-react-router

This is a package to integrate [Experimental React Router RSC support](https://remix.run/blog/rsc-preview) on Vite using [`@hiogawa/vite-rsc`](https://github.com/hi-ogawa/vite-plugins/tree/main/packages/rsc). It provides a basic [`routes.ts`](https://reactrouter.com/explanation/special-files#routests) support. See [rsc-movies](https://github.com/hi-ogawa/rsc-movies/) for an example.

## Usage

- `vite.config.ts`

```js
import rsc from "@hiogawa/vite-rsc/plugin";
import { reactRouter } from "@hiogawa/vite-rsc-react-router/plugin";
import { defineConfig } from "vite";

export default defineConfig({
plugins: [
reactRouter(),
rsc(),
],
});
```
React Server Components are now officially supported by React Router.
See https://reactrouter.com/how-to/react-server-components
35 changes: 0 additions & 35 deletions packages/rsc-react-router/package.json

This file was deleted.

19 changes: 0 additions & 19 deletions packages/rsc-react-router/src/client.tsx

This file was deleted.

38 changes: 0 additions & 38 deletions packages/rsc-react-router/src/entry.browser.tsx

This file was deleted.

8 changes: 0 additions & 8 deletions packages/rsc-react-router/src/entry.rsc.single.tsx

This file was deleted.

Loading
Loading