@@ -9,7 +9,6 @@ import type { UnwrapPromise } from '../../../lib/coalesced-function'
9
9
import type { NextUrlWithParsedQuery } from '../../request-meta'
10
10
11
11
import url from 'url'
12
- import path from 'node:path'
13
12
import setupDebug from 'next/dist/compiled/debug'
14
13
import { getCloneableBody } from '../../body-streams'
15
14
import { filterReqHeaders , ipcForbiddenHeaders } from '../server-ipc/utils'
@@ -26,9 +25,6 @@ import { pathHasPrefix } from '../../../shared/lib/router/utils/path-has-prefix'
26
25
import { detectDomainLocale } from '../../../shared/lib/i18n/detect-domain-locale'
27
26
import { normalizeLocalePath } from '../../../shared/lib/i18n/normalize-locale-path'
28
27
import { removePathPrefix } from '../../../shared/lib/router/utils/remove-path-prefix'
29
- import { NextDataPathnameNormalizer } from '../../normalizers/request/next-data'
30
- import { BasePathPathnameNormalizer } from '../../normalizers/request/base-path'
31
- import { PostponedPathnameNormalizer } from '../../normalizers/request/postponed'
32
28
33
29
import { addRequestMeta } from '../../request-meta'
34
30
import {
@@ -65,9 +61,6 @@ export function getResolveRoutes(
65
61
Partial < Redirect >
66
62
67
63
const routes : Route [ ] = [
68
- // _next/data with middleware handling
69
- { match : ( ) => ( { } ) , name : 'middleware_next_data' } ,
70
-
71
64
...( opts . minimalMode ? [ ] : fsChecker . headers ) ,
72
65
...( opts . minimalMode ? [ ] : fsChecker . redirects ) ,
73
66
@@ -296,17 +289,6 @@ export function getResolveRoutes(
296
289
}
297
290
}
298
291
299
- const normalizers = {
300
- basePath :
301
- config . basePath && config . basePath !== '/'
302
- ? new BasePathPathnameNormalizer ( config . basePath )
303
- : undefined ,
304
- data : new NextDataPathnameNormalizer ( fsChecker . buildId ) ,
305
- postponed : config . experimental . ppr
306
- ? new PostponedPathnameNormalizer ( )
307
- : undefined ,
308
- }
309
-
310
292
async function handleRoute (
311
293
route : ( typeof routes ) [ 0 ]
312
294
) : Promise < UnwrapPromise < ReturnType < typeof resolveRoutes > > | void > {
@@ -375,41 +357,6 @@ export function getResolveRoutes(
375
357
}
376
358
}
377
359
378
- if ( route . name === 'middleware_next_data' && parsedUrl . pathname ) {
379
- if ( fsChecker . getMiddlewareMatchers ( ) ?. length ) {
380
- let normalized = parsedUrl . pathname
381
-
382
- // Remove the base path if it exists.
383
- const hadBasePath = normalizers . basePath ?. match ( parsedUrl . pathname )
384
- if ( hadBasePath && normalizers . basePath ) {
385
- normalized = normalizers . basePath . normalize ( normalized , true )
386
- }
387
-
388
- let updated = false
389
- if ( normalizers . data . match ( normalized ) ) {
390
- updated = true
391
- parsedUrl . query . __nextDataReq = '1'
392
- normalized = normalizers . data . normalize ( normalized , true )
393
- } else if ( normalizers . postponed ?. match ( normalized ) ) {
394
- updated = true
395
- normalized = normalizers . postponed . normalize ( normalized , true )
396
- }
397
-
398
- // If we updated the pathname, and it had a base path, re-add the
399
- // base path.
400
- if ( updated ) {
401
- if ( hadBasePath ) {
402
- normalized = path . posix . join ( config . basePath , normalized )
403
- }
404
-
405
- // Re-add the trailing slash (if required).
406
- normalized = maybeAddTrailingSlash ( normalized )
407
-
408
- parsedUrl . pathname = normalized
409
- }
410
- }
411
- }
412
-
413
360
if ( route . name === 'check_fs' ) {
414
361
const pathname = parsedUrl . pathname || ''
415
362
@@ -743,6 +690,7 @@ export function getResolveRoutes(
743
690
}
744
691
}
745
692
didRewrite = true
693
+ console . log ( 'setting pathname 775' , parsedDestination . pathname )
746
694
parsedUrl . pathname = parsedDestination . pathname
747
695
Object . assign ( parsedUrl . query , parsedDestination . query )
748
696
}
0 commit comments