Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
4 changes: 2 additions & 2 deletions packages/plugin-rsc/examples/e2e/middleware-mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import path from 'node:path'
import { pathToFileURL } from 'node:url'
// @ts-ignore
import connect from 'connect'
import { createRequestListener } from '@remix-run/node-fetch-server'
import { toNodeHandler } from 'srvx/node'
import sirv from 'sirv'
import type { Connect } from 'vite'

Expand All @@ -28,7 +28,7 @@ async function main() {
const entry = await import(
pathToFileURL(path.resolve('dist/rsc/index.js')).href
)
app.use(createRequestListener(entry.default))
app.use(toNodeHandler(entry.default))
} else {
console.error(`Unknown command: ${command}`)
process.exitCode = 1
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-rsc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@
"prepack": "tsdown"
},
"dependencies": {
"@remix-run/node-fetch-server": "^0.12.0",
"es-module-lexer": "^2.0.0",
"estree-walker": "^3.0.3",
"magic-string": "^0.30.21",
"periscopic": "^4.0.2",
"srvx": "^0.9.8",
"strip-literal": "^3.1.0",
"turbo-stream": "^3.1.0",
"vitefu": "^1.1.1"
Expand Down
3 changes: 2 additions & 1 deletion packages/plugin-rsc/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ export default defineConfig({
use: devices['Desktop Safari'],
},
],
workers: 2,
// workers: 2,
workers: 1,
Comment thread
hi-ogawa marked this conversation as resolved.
Outdated
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
reporter: ['list', process.env.CI && 'github']
Expand Down
10 changes: 4 additions & 6 deletions packages/plugin-rsc/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import fs from 'node:fs'
import { createRequire } from 'node:module'
import path from 'node:path'
import { pathToFileURL } from 'node:url'
import { createRequestListener } from '@remix-run/node-fetch-server'
import { toNodeHandler } from 'srvx/node'
import * as esModuleLexer from 'es-module-lexer'
import MagicString from 'magic-string'
import * as vite from 'vite'
Expand Down Expand Up @@ -573,9 +573,7 @@ export default function vitePluginRsc(
// for example, this restores `base` which is automatically stripped by Vite.
// https://github.com/vitejs/vite/blob/84079a84ad94de4c1ef4f1bdb2ab448ff2c01196/packages/vite/src/node/server/middlewares/base.ts#L18-L20
req.url = req.originalUrl ?? req.url
// ensure catching rejected promise
// https://github.com/mjackson/remix-the-web/blob/b5aa2ae24558f5d926af576482caf6e9b35461dc/packages/node-fetch-server/src/lib/request-listener.ts#L87
await createRequestListener(fetchHandler)(req, res)
await toNodeHandler(fetchHandler)(req, res)
} catch (e) {
next(e)
}
Expand All @@ -596,7 +594,7 @@ export default function vitePluginRsc(
const entry = pathToFileURL(entryFile).href
const mod = await import(/* @vite-ignore */ entry)
const fetchHandler = getFetchHandlerExport(mod)
const handler = createRequestListener(fetchHandler)
const handler = toNodeHandler(fetchHandler)

// disable compressions since it breaks html streaming
// https://github.com/vitejs/vite/blob/9f5c59f07aefb1756a37bcb1c0aff24d54288950/packages/vite/src/node/preview.ts#L178
Expand Down Expand Up @@ -866,7 +864,7 @@ export default function vitePluginRsc(
if (url.pathname === '/__vite_rsc_load_module_dev_proxy') {
try {
const handler = await createHandler(url)
createRequestListener(handler)(req, res)
await toNodeHandler(handler)(req, res)
} catch (e) {
next(e)
}
Expand Down
18 changes: 10 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading