mirror of
https://github.com/supabase/supabase.git
synced 2026-10-11 20:35:07 +03:00
chore(studio): shim next/server in Vite compat layer
Two App Router routes (incident-banner, incident-status) and a few type-only uses elsewhere import from 'next/server'. The Vite nextCompat guard was 500ing on the build. Shim exposes NextResponse.json (the only value surface used) and a type alias NextRequest = Request.
This commit is contained in:
1 parent
c58d02e29b
commit
2428cfd3b5
2 files changed
+14
No files matched your search
@@ -0,0 +1,13 @@
|
||||
// Vite-side compat for `next/server`. Workspace source uses `NextResponse`
|
||||
// (only `.json()`) in two App Router routes and `NextRequest` as a type-only
|
||||
// import elsewhere. Extend this file if more surface is needed.
|
||||
|
||||
export const NextResponse = {
|
||||
json: (data: unknown, init?: ResponseInit) => Response.json(data, init),
|
||||
}
|
||||
|
||||
// NextRequest extends Request with Next-specific fields (nextUrl, cookies,
|
||||
// ip, geo). None of our workspace source reads those fields at runtime —
|
||||
// the only imports are type-only. Aliasing to Request keeps TypeScript
|
||||
// happy without pulling in Next internals.
|
||||
export type NextRequest = Request
|
||||
@@ -23,6 +23,7 @@ const nextShims: Record<string, string> = {
|
||||
'next/navigation': path.join(compatRoot, 'navigation.ts'),
|
||||
'next/router': path.join(compatRoot, 'router.ts'),
|
||||
'next/script': path.join(compatRoot, 'script.tsx'),
|
||||
'next/server': path.join(compatRoot, 'server.ts'),
|
||||
}
|
||||
|
||||
// Combined compat + migration guard:
|
||||
|
||||
Reference in new issue
Block a user