Skip to content

Commit ad18688

Browse files
authored
[codemod] Remove runtime config when running middleware-to-proxy (#85075)
Stacked on #85139 Closes NEXT-4746
1 parent 2002681 commit ad18688

15 files changed

+270
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { NextResponse, NextRequest } from 'next/server'
2+
3+
export function middleware(request: NextRequest) {
4+
return NextResponse.redirect(new URL('/home', request.url))
5+
}
6+
7+
export const runtime = 'edge'
8+
9+
export const config = {
10+
matcher: '/about/:path*',
11+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { NextResponse, NextRequest } from 'next/server'
2+
3+
export function proxy(request: NextRequest) {
4+
return NextResponse.redirect(new URL('/home', request.url))
5+
}
6+
7+
export const config = {
8+
matcher: '/about/:path*',
9+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { NextResponse, NextRequest } from 'next/server'
2+
3+
export function middleware(request: NextRequest) {
4+
return NextResponse.redirect(new URL('/home', request.url))
5+
}
6+
7+
export const config = {
8+
runtime: 'edge',
9+
matcher: '/about/:path*',
10+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { NextResponse, NextRequest } from 'next/server'
2+
3+
export function proxy(request: NextRequest) {
4+
return NextResponse.redirect(new URL('/home', request.url))
5+
}
6+
7+
export const config = {
8+
matcher: '/about/:path*'
9+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { NextResponse, NextRequest } from 'next/server'
2+
3+
export function middleware(request: NextRequest) {
4+
return NextResponse.redirect(new URL('/home', request.url))
5+
}
6+
7+
const runtime = 'edge', config = { matcher: '/test/*' }
8+
export { runtime, config }
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { NextResponse, NextRequest } from 'next/server'
2+
3+
export function proxy(request: NextRequest) {
4+
return NextResponse.redirect(new URL('/home', request.url))
5+
}
6+
7+
const config = { matcher: '/test/*' };
8+
export { config };
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { NextResponse, NextRequest } from 'next/server'
2+
3+
export function middleware(request: NextRequest) {
4+
return NextResponse.redirect(new URL('/home', request.url))
5+
}
6+
7+
export const runtime = 'edge'
8+
9+
export const config = {
10+
runtime: 'nodejs',
11+
matcher: '/about/:path*',
12+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { NextResponse, NextRequest } from 'next/server'
2+
3+
export function proxy(request: NextRequest) {
4+
return NextResponse.redirect(new URL('/home', request.url))
5+
}
6+
7+
export const config = {
8+
matcher: '/about/:path*'
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { NextResponse, NextRequest } from 'next/server'
2+
3+
export function middleware(request: NextRequest) {
4+
return NextResponse.redirect(new URL('/home', request.url))
5+
}
6+
7+
export const config = {
8+
runtime: 'edge',
9+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { NextResponse, NextRequest } from 'next/server'
2+
3+
export function proxy(request: NextRequest) {
4+
return NextResponse.redirect(new URL('/home', request.url))
5+
}

0 commit comments

Comments
 (0)