next 15.4.6 → 15.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/next +1 -1
- package/dist/build/index.js +2 -2
- package/dist/build/swc/index.js +1 -1
- package/dist/build/webpack-config.js +2 -2
- package/dist/client/app-bootstrap.js +1 -1
- package/dist/client/index.js +1 -1
- package/dist/compiled/next-server/pages-api-turbo.runtime.dev.js +1 -1
- package/dist/compiled/next-server/pages-api-turbo.runtime.dev.js.map +1 -1
- package/dist/compiled/next-server/pages-api-turbo.runtime.prod.js +1 -1
- package/dist/compiled/next-server/pages-api-turbo.runtime.prod.js.map +1 -1
- package/dist/compiled/next-server/pages-api.runtime.dev.js +1 -1
- package/dist/compiled/next-server/pages-api.runtime.dev.js.map +1 -1
- package/dist/compiled/next-server/pages-api.runtime.prod.js +1 -1
- package/dist/compiled/next-server/pages-api.runtime.prod.js.map +1 -1
- package/dist/compiled/next-server/pages-turbo.runtime.dev.js +1 -1
- package/dist/compiled/next-server/pages-turbo.runtime.dev.js.map +1 -1
- package/dist/compiled/next-server/pages-turbo.runtime.prod.js +1 -1
- package/dist/compiled/next-server/pages-turbo.runtime.prod.js.map +1 -1
- package/dist/compiled/next-server/pages.runtime.dev.js +1 -1
- package/dist/compiled/next-server/pages.runtime.dev.js.map +1 -1
- package/dist/compiled/next-server/pages.runtime.prod.js +1 -1
- package/dist/compiled/next-server/pages.runtime.prod.js.map +1 -1
- package/dist/esm/build/index.js +2 -2
- package/dist/esm/build/swc/index.js +1 -1
- package/dist/esm/build/webpack-config.js +2 -2
- package/dist/esm/client/app-bootstrap.js +1 -1
- package/dist/esm/client/index.js +1 -1
- package/dist/esm/server/dev/hot-reloader-turbopack.js +1 -1
- package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
- package/dist/esm/server/lib/app-info-log.js +1 -1
- package/dist/esm/server/lib/router-utils/resolve-routes.js +26 -10
- package/dist/esm/server/lib/router-utils/resolve-routes.js.map +1 -1
- package/dist/esm/server/lib/start-server.js +1 -1
- package/dist/esm/shared/lib/canary-only.js +1 -1
- package/dist/server/dev/hot-reloader-turbopack.js +1 -1
- package/dist/server/dev/hot-reloader-webpack.js +1 -1
- package/dist/server/lib/app-info-log.js +1 -1
- package/dist/server/lib/router-utils/resolve-routes.js +25 -9
- package/dist/server/lib/router-utils/resolve-routes.js.map +1 -1
- package/dist/server/lib/start-server.js +1 -1
- package/dist/shared/lib/canary-only.js +1 -1
- package/dist/telemetry/anonymous-meta.js +1 -1
- package/dist/telemetry/events/session-stopped.js +2 -2
- package/dist/telemetry/events/version.js +2 -2
- package/package.json +15 -15
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../src/server/lib/router-utils/resolve-routes.ts"],"sourcesContent":["import type { FsOutput } from './filesystem'\nimport type { IncomingMessage, ServerResponse } from 'http'\nimport type { NextConfigComplete } from '../../config-shared'\nimport type { RenderServer, initialize } from '../router-server'\nimport type { PatchMatcher } from '../../../shared/lib/router/utils/path-match'\nimport type { Redirect } from '../../../types'\nimport type { Header, Rewrite } from '../../../lib/load-custom-routes'\nimport type { UnwrapPromise } from '../../../lib/coalesced-function'\nimport type { NextUrlWithParsedQuery } from '../../request-meta'\n\nimport url from 'url'\nimport path from 'node:path'\nimport setupDebug from 'next/dist/compiled/debug'\nimport { getCloneableBody } from '../../body-streams'\nimport { filterReqHeaders, ipcForbiddenHeaders } from '../server-ipc/utils'\nimport { stringifyQuery } from '../../server-route-utils'\nimport { formatHostname } from '../format-hostname'\nimport { toNodeOutgoingHttpHeaders } from '../../web/utils'\nimport { isAbortError } from '../../pipe-readable'\nimport { getHostname } from '../../../shared/lib/get-hostname'\nimport { getRedirectStatus } from '../../../lib/redirect-status'\nimport { normalizeRepeatedSlashes } from '../../../shared/lib/utils'\nimport { getRelativeURL } from '../../../shared/lib/router/utils/relativize-url'\nimport { addPathPrefix } from '../../../shared/lib/router/utils/add-path-prefix'\nimport { pathHasPrefix } from '../../../shared/lib/router/utils/path-has-prefix'\nimport { detectDomainLocale } from '../../../shared/lib/i18n/detect-domain-locale'\nimport { normalizeLocalePath } from '../../../shared/lib/i18n/normalize-locale-path'\nimport { removePathPrefix } from '../../../shared/lib/router/utils/remove-path-prefix'\nimport { NextDataPathnameNormalizer } from '../../normalizers/request/next-data'\nimport { BasePathPathnameNormalizer } from '../../normalizers/request/base-path'\n\nimport { addRequestMeta } from '../../request-meta'\nimport {\n compileNonPath,\n matchHas,\n parseDestination,\n prepareDestination,\n} from '../../../shared/lib/router/utils/prepare-destination'\nimport type { TLSSocket } from 'tls'\nimport {\n NEXT_REWRITTEN_PATH_HEADER,\n NEXT_REWRITTEN_QUERY_HEADER,\n NEXT_ROUTER_STATE_TREE_HEADER,\n RSC_HEADER,\n} from '../../../client/components/app-router-headers'\nimport { getSelectedParams } from '../../../client/components/router-reducer/compute-changed-path'\nimport { isInterceptionRouteRewrite } from '../../../lib/generate-interception-routes-rewrites'\nimport { parseAndValidateFlightRouterState } from '../../app-render/parse-and-validate-flight-router-state'\n\nconst debug = setupDebug('next:router-server:resolve-routes')\n\nexport function getResolveRoutes(\n fsChecker: UnwrapPromise<\n ReturnType<typeof import('./filesystem').setupFsCheck>\n >,\n config: NextConfigComplete,\n opts: Parameters<typeof initialize>[0],\n renderServer: RenderServer,\n renderServerOpts: Parameters<RenderServer['initialize']>[0],\n ensureMiddleware?: (url?: string) => Promise<void>\n) {\n type Route = {\n /**\n * The path matcher to check if this route applies to this request.\n */\n match: PatchMatcher\n check?: boolean\n name?: string\n } & Partial<Header> &\n Partial<Redirect>\n\n const routes: Route[] = [\n // _next/data with middleware handling\n { match: () => ({}), name: 'middleware_next_data' },\n\n ...(opts.minimalMode ? [] : fsChecker.headers),\n ...(opts.minimalMode ? [] : fsChecker.redirects),\n\n // check middleware (using matchers)\n { match: () => ({}), name: 'middleware' },\n\n ...(opts.minimalMode ? [] : fsChecker.rewrites.beforeFiles),\n\n // check middleware (using matchers)\n { match: () => ({}), name: 'before_files_end' },\n\n // we check exact matches on fs before continuing to\n // after files rewrites\n { match: () => ({}), name: 'check_fs' },\n\n ...(opts.minimalMode ? [] : fsChecker.rewrites.afterFiles),\n\n // we always do the check: true handling before continuing to\n // fallback rewrites\n {\n check: true,\n match: () => ({}),\n name: 'after files check: true',\n },\n\n ...(opts.minimalMode ? [] : fsChecker.rewrites.fallback),\n ]\n\n async function resolveRoutes({\n req,\n res,\n isUpgradeReq,\n invokedOutputs,\n }: {\n req: IncomingMessage\n res: ServerResponse\n isUpgradeReq: boolean\n signal: AbortSignal\n invokedOutputs?: Set<string>\n }): Promise<{\n finished: boolean\n statusCode?: number\n bodyStream?: ReadableStream | null\n resHeaders: Record<string, string | string[]>\n parsedUrl: NextUrlWithParsedQuery\n matchedOutput?: FsOutput | null\n }> {\n let finished = false\n let resHeaders: Record<string, string | string[]> = {}\n let matchedOutput: FsOutput | null = null\n let parsedUrl = url.parse(req.url || '', true) as NextUrlWithParsedQuery\n let didRewrite = false\n\n const urlParts = (req.url || '').split('?', 1)\n const urlNoQuery = urlParts[0]\n\n // this normalizes repeated slashes in the path e.g. hello//world ->\n // hello/world or backslashes to forward slashes, this does not\n // handle trailing slash as that is handled the same as a next.config.js\n // redirect\n if (urlNoQuery?.match(/(\\\\|\\/\\/)/)) {\n parsedUrl = url.parse(normalizeRepeatedSlashes(req.url!), true)\n return {\n parsedUrl,\n resHeaders,\n finished: true,\n statusCode: 308,\n }\n }\n // TODO: inherit this from higher up\n const protocol =\n (req?.socket as TLSSocket)?.encrypted ||\n req.headers['x-forwarded-proto']?.includes('https')\n ? 'https'\n : 'http'\n\n // When there are hostname and port we build an absolute URL\n const initUrl = (config.experimental as any).trustHostHeader\n ? `https://${req.headers.host || 'localhost'}${req.url}`\n : opts.port\n ? `${protocol}://${formatHostname(opts.hostname || 'localhost')}:${\n opts.port\n }${req.url}`\n : req.url || ''\n\n addRequestMeta(req, 'initURL', initUrl)\n addRequestMeta(req, 'initQuery', { ...parsedUrl.query })\n addRequestMeta(req, 'initProtocol', protocol)\n\n if (!isUpgradeReq) {\n addRequestMeta(req, 'clonableBody', getCloneableBody(req))\n }\n\n const maybeAddTrailingSlash = (pathname: string) => {\n if (\n config.trailingSlash &&\n !config.skipMiddlewareUrlNormalize &&\n !pathname.endsWith('/')\n ) {\n return `${pathname}/`\n }\n return pathname\n }\n\n let domainLocale: ReturnType<typeof detectDomainLocale> | undefined\n let defaultLocale: string | undefined\n let initialLocaleResult:\n | ReturnType<typeof normalizeLocalePath>\n | undefined = undefined\n\n if (config.i18n) {\n const hadTrailingSlash = parsedUrl.pathname?.endsWith('/')\n const hadBasePath = pathHasPrefix(\n parsedUrl.pathname || '',\n config.basePath\n )\n let normalizedPath = parsedUrl.pathname || '/'\n\n if (config.basePath && pathHasPrefix(normalizedPath, config.basePath)) {\n normalizedPath = removePathPrefix(normalizedPath, config.basePath)\n } else if (\n config.assetPrefix &&\n pathHasPrefix(normalizedPath, config.assetPrefix)\n ) {\n normalizedPath = removePathPrefix(normalizedPath, config.assetPrefix)\n }\n\n initialLocaleResult = normalizeLocalePath(\n normalizedPath,\n config.i18n.locales\n )\n\n domainLocale = detectDomainLocale(\n config.i18n.domains,\n getHostname(parsedUrl, req.headers)\n )\n defaultLocale = domainLocale?.defaultLocale || config.i18n.defaultLocale\n\n addRequestMeta(req, 'defaultLocale', defaultLocale)\n addRequestMeta(\n req,\n 'locale',\n initialLocaleResult.detectedLocale || defaultLocale\n )\n\n // ensure locale is present for resolving routes\n if (\n !initialLocaleResult.detectedLocale &&\n !initialLocaleResult.pathname.startsWith('/_next/')\n ) {\n parsedUrl.pathname = addPathPrefix(\n initialLocaleResult.pathname === '/'\n ? `/${defaultLocale}`\n : addPathPrefix(\n initialLocaleResult.pathname || '',\n `/${defaultLocale}`\n ),\n hadBasePath ? config.basePath : ''\n )\n\n if (hadTrailingSlash) {\n parsedUrl.pathname = maybeAddTrailingSlash(parsedUrl.pathname)\n }\n }\n }\n\n const checkLocaleApi = (pathname: string) => {\n if (\n config.i18n &&\n pathname === urlNoQuery &&\n initialLocaleResult?.detectedLocale &&\n pathHasPrefix(initialLocaleResult.pathname, '/api')\n ) {\n return true\n }\n }\n\n async function checkTrue() {\n const pathname = parsedUrl.pathname || '/'\n\n if (checkLocaleApi(pathname)) {\n return\n }\n if (!invokedOutputs?.has(pathname)) {\n const output = await fsChecker.getItem(pathname)\n\n if (output) {\n if (\n config.useFileSystemPublicRoutes ||\n didRewrite ||\n (output.type !== 'appFile' && output.type !== 'pageFile')\n ) {\n return output\n }\n }\n }\n const dynamicRoutes = fsChecker.getDynamicRoutes()\n let curPathname = parsedUrl.pathname\n\n if (config.basePath) {\n if (!pathHasPrefix(curPathname || '', config.basePath)) {\n return\n }\n curPathname = curPathname?.substring(config.basePath.length) || '/'\n }\n const localeResult = fsChecker.handleLocale(curPathname || '')\n\n for (const route of dynamicRoutes) {\n // when resolving fallback: false the\n // render worker may return a no-fallback response\n // which signals we need to continue resolving.\n // TODO: optimize this to collect static paths\n // to use at the routing layer\n if (invokedOutputs?.has(route.page)) {\n continue\n }\n const params = route.match(localeResult.pathname)\n\n if (params) {\n const pageOutput = await fsChecker.getItem(\n addPathPrefix(route.page, config.basePath || '')\n )\n\n // i18n locales aren't matched for app dir\n if (\n pageOutput?.type === 'appFile' &&\n initialLocaleResult?.detectedLocale\n ) {\n continue\n }\n\n if (pageOutput && curPathname?.startsWith('/_next/data')) {\n addRequestMeta(req, 'isNextDataReq', true)\n }\n\n if (config.useFileSystemPublicRoutes || didRewrite) {\n return pageOutput\n }\n }\n }\n }\n\n const normalizers = {\n basePath:\n config.basePath && config.basePath !== '/'\n ? new BasePathPathnameNormalizer(config.basePath)\n : undefined,\n data: new NextDataPathnameNormalizer(fsChecker.buildId),\n }\n\n async function handleRoute(\n route: (typeof routes)[0]\n ): Promise<UnwrapPromise<ReturnType<typeof resolveRoutes>> | void> {\n let curPathname = parsedUrl.pathname || '/'\n\n if (config.i18n && route.internal) {\n const hadTrailingSlash = curPathname.endsWith('/')\n\n if (config.basePath) {\n curPathname = removePathPrefix(curPathname, config.basePath)\n }\n const hadBasePath = curPathname !== parsedUrl.pathname\n\n const localeResult = normalizeLocalePath(\n curPathname,\n config.i18n.locales\n )\n const isDefaultLocale = localeResult.detectedLocale === defaultLocale\n\n if (isDefaultLocale) {\n curPathname =\n localeResult.pathname === '/' && hadBasePath\n ? config.basePath\n : addPathPrefix(\n localeResult.pathname,\n hadBasePath ? config.basePath : ''\n )\n } else if (hadBasePath) {\n curPathname =\n curPathname === '/'\n ? config.basePath\n : addPathPrefix(curPathname, config.basePath)\n }\n\n if ((isDefaultLocale || hadBasePath) && hadTrailingSlash) {\n curPathname = maybeAddTrailingSlash(curPathname)\n }\n }\n let params = route.match(curPathname)\n\n if ((route.has || route.missing) && params) {\n const hasParams = matchHas(\n req,\n parsedUrl.query,\n route.has,\n route.missing\n )\n if (hasParams) {\n Object.assign(params, hasParams)\n } else {\n params = false\n }\n }\n\n if (params) {\n if (\n fsChecker.exportPathMapRoutes &&\n route.name === 'before_files_end'\n ) {\n for (const exportPathMapRoute of fsChecker.exportPathMapRoutes) {\n const result = await handleRoute(exportPathMapRoute)\n\n if (result) {\n return result\n }\n }\n }\n\n if (route.name === 'middleware_next_data' && parsedUrl.pathname) {\n if (fsChecker.getMiddlewareMatchers()?.length) {\n let normalized = parsedUrl.pathname\n\n // Remove the base path if it exists.\n const hadBasePath = normalizers.basePath?.match(parsedUrl.pathname)\n if (hadBasePath && normalizers.basePath) {\n normalized = normalizers.basePath.normalize(normalized, true)\n }\n\n let updated = false\n if (normalizers.data.match(normalized)) {\n updated = true\n addRequestMeta(req, 'isNextDataReq', true)\n normalized = normalizers.data.normalize(normalized, true)\n }\n\n if (config.i18n) {\n const curLocaleResult = normalizeLocalePath(\n normalized,\n config.i18n.locales\n )\n\n if (curLocaleResult.detectedLocale) {\n addRequestMeta(req, 'locale', curLocaleResult.detectedLocale)\n }\n }\n\n // If we updated the pathname, and it had a base path, re-add the\n // base path.\n if (updated) {\n if (hadBasePath) {\n normalized = path.posix.join(config.basePath, normalized)\n }\n\n // Re-add the trailing slash (if required).\n normalized = maybeAddTrailingSlash(normalized)\n\n parsedUrl.pathname = normalized\n }\n }\n }\n\n if (route.name === 'check_fs') {\n const pathname = parsedUrl.pathname || '/'\n\n if (invokedOutputs?.has(pathname) || checkLocaleApi(pathname)) {\n return\n }\n const output = await fsChecker.getItem(pathname)\n\n if (\n output &&\n !(\n config.i18n &&\n initialLocaleResult?.detectedLocale &&\n pathHasPrefix(pathname, '/api')\n )\n ) {\n if (\n config.useFileSystemPublicRoutes ||\n didRewrite ||\n (output.type !== 'appFile' && output.type !== 'pageFile')\n ) {\n matchedOutput = output\n\n if (output.locale) {\n addRequestMeta(req, 'locale', output.locale)\n }\n return {\n parsedUrl,\n resHeaders,\n finished: true,\n matchedOutput,\n }\n }\n }\n }\n\n if (!opts.minimalMode && route.name === 'middleware') {\n const match = fsChecker.getMiddlewareMatchers()\n let maybeDecodedPathname = parsedUrl.pathname || '/'\n\n try {\n maybeDecodedPathname = decodeURIComponent(maybeDecodedPathname)\n } catch {\n /* non-fatal we can't decode so can't match it */\n }\n\n if (\n // @ts-expect-error BaseNextRequest stuff\n match?.(parsedUrl.pathname, req, parsedUrl.query) ||\n match?.(\n maybeDecodedPathname,\n // @ts-expect-error BaseNextRequest stuff\n req,\n parsedUrl.query\n )\n ) {\n if (ensureMiddleware) {\n await ensureMiddleware(req.url)\n }\n\n const serverResult =\n await renderServer?.initialize(renderServerOpts)\n\n if (!serverResult) {\n throw new Error(`Failed to initialize render server \"middleware\"`)\n }\n\n addRequestMeta(req, 'invokePath', '')\n addRequestMeta(req, 'invokeOutput', '')\n addRequestMeta(req, 'invokeQuery', {})\n addRequestMeta(req, 'middlewareInvoke', true)\n debug('invoking middleware', req.url, req.headers)\n\n let middlewareRes: Response | undefined = undefined\n let bodyStream: ReadableStream | undefined = undefined\n try {\n try {\n await serverResult.requestHandler(req, res, parsedUrl)\n } catch (err: any) {\n if (!('result' in err) || !('response' in err.result)) {\n throw err\n }\n middlewareRes = err.result.response as Response\n res.statusCode = middlewareRes.status\n\n if (middlewareRes.body) {\n bodyStream = middlewareRes.body\n } else if (middlewareRes.status) {\n bodyStream = new ReadableStream({\n start(controller) {\n controller.enqueue('')\n controller.close()\n },\n })\n }\n }\n } catch (e) {\n // If the client aborts before we can receive a response object\n // (when the headers are flushed), then we can early exit without\n // further processing.\n if (isAbortError(e)) {\n return {\n parsedUrl,\n resHeaders,\n finished: true,\n }\n }\n throw e\n }\n\n if (res.closed || res.finished || !middlewareRes) {\n return {\n parsedUrl,\n resHeaders,\n finished: true,\n }\n }\n\n const middlewareHeaders = toNodeOutgoingHttpHeaders(\n middlewareRes.headers\n ) as Record<string, string | string[] | undefined>\n\n debug('middleware res', middlewareRes.status, middlewareHeaders)\n\n if (middlewareHeaders['x-middleware-override-headers']) {\n const overriddenHeaders: Set<string> = new Set()\n let overrideHeaders: string | string[] =\n middlewareHeaders['x-middleware-override-headers']\n\n if (typeof overrideHeaders === 'string') {\n overrideHeaders = overrideHeaders.split(',')\n }\n\n for (const key of overrideHeaders) {\n overriddenHeaders.add(key.trim())\n }\n delete middlewareHeaders['x-middleware-override-headers']\n\n // Delete headers.\n for (const key of Object.keys(req.headers)) {\n if (!overriddenHeaders.has(key)) {\n delete req.headers[key]\n }\n }\n\n // Update or add headers.\n for (const key of overriddenHeaders.keys()) {\n const valueKey = 'x-middleware-request-' + key\n const newValue = middlewareHeaders[valueKey]\n const oldValue = req.headers[key]\n\n if (oldValue !== newValue) {\n req.headers[key] = newValue === null ? undefined : newValue\n }\n delete middlewareHeaders[valueKey]\n }\n }\n\n if (\n !middlewareHeaders['x-middleware-rewrite'] &&\n !middlewareHeaders['x-middleware-next'] &&\n !middlewareHeaders['location']\n ) {\n middlewareHeaders['x-middleware-refresh'] = '1'\n }\n delete middlewareHeaders['x-middleware-next']\n\n for (const [key, value] of Object.entries({\n ...filterReqHeaders(middlewareHeaders, ipcForbiddenHeaders),\n })) {\n if (\n [\n 'content-length',\n 'x-middleware-rewrite',\n 'x-middleware-redirect',\n 'x-middleware-refresh',\n ].includes(key)\n ) {\n continue\n }\n\n // for set-cookie, the header shouldn't be added to the response\n // as it's only needed for the request to the middleware function.\n if (key === 'x-middleware-set-cookie') {\n req.headers[key] = value\n continue\n }\n\n if (value) {\n resHeaders[key] = value\n req.headers[key] = value\n }\n }\n\n if (middlewareHeaders['x-middleware-rewrite']) {\n const value = middlewareHeaders['x-middleware-rewrite'] as string\n const destination = getRelativeURL(value, initUrl)\n resHeaders['x-middleware-rewrite'] = destination\n\n parsedUrl = url.parse(destination, true)\n\n if (parsedUrl.protocol) {\n return {\n parsedUrl,\n resHeaders,\n finished: true,\n }\n }\n\n if (config.i18n) {\n const curLocaleResult = normalizeLocalePath(\n parsedUrl.pathname || '',\n config.i18n.locales\n )\n\n if (curLocaleResult.detectedLocale) {\n addRequestMeta(req, 'locale', curLocaleResult.detectedLocale)\n }\n }\n }\n\n if (middlewareHeaders['location']) {\n const value = middlewareHeaders['location'] as string\n const rel = getRelativeURL(value, initUrl)\n resHeaders['location'] = rel\n parsedUrl = url.parse(rel, true)\n\n return {\n parsedUrl,\n resHeaders,\n finished: true,\n statusCode: middlewareRes.status,\n }\n }\n\n if (middlewareHeaders['x-middleware-refresh']) {\n return {\n parsedUrl,\n resHeaders,\n finished: true,\n bodyStream,\n statusCode: middlewareRes.status,\n }\n }\n }\n }\n\n // handle redirect\n if (\n ('statusCode' in route || 'permanent' in route) &&\n route.destination\n ) {\n const { parsedDestination } = prepareDestination({\n appendParamsToQuery: false,\n destination: route.destination,\n params: params,\n query: parsedUrl.query,\n })\n\n const { query } = parsedDestination\n delete (parsedDestination as any).query\n\n parsedDestination.search = stringifyQuery(req as any, query)\n\n parsedDestination.pathname = normalizeRepeatedSlashes(\n parsedDestination.pathname\n )\n\n return {\n finished: true,\n // @ts-expect-error custom ParsedUrl\n parsedUrl: parsedDestination,\n statusCode: getRedirectStatus(route),\n }\n }\n\n // handle headers\n if (route.headers) {\n const hasParams = Object.keys(params).length > 0\n for (const header of route.headers) {\n let { key, value } = header\n if (hasParams) {\n key = compileNonPath(key, params)\n value = compileNonPath(value, params)\n }\n\n if (key.toLowerCase() === 'set-cookie') {\n if (!Array.isArray(resHeaders[key])) {\n const val = resHeaders[key]\n resHeaders[key] = typeof val === 'string' ? [val] : []\n }\n ;(resHeaders[key] as string[]).push(value)\n } else {\n resHeaders[key] = value\n }\n }\n }\n\n // handle rewrite\n if (route.destination) {\n let rewriteParams = params\n\n try {\n // An interception rewrite might reference a dynamic param for a route the user\n // is currently on, which wouldn't be extractable from the matched route params.\n // This attempts to extract the dynamic params from the provided router state.\n if (isInterceptionRouteRewrite(route as Rewrite)) {\n const stateHeader =\n req.headers[NEXT_ROUTER_STATE_TREE_HEADER.toLowerCase()]\n\n if (stateHeader) {\n rewriteParams = {\n ...getSelectedParams(\n parseAndValidateFlightRouterState(stateHeader)\n ),\n ...params,\n }\n }\n }\n } catch (err) {\n // this is a no-op -- we couldn't extract dynamic params from the provided router state,\n // so we'll just use the params from the route matcher\n }\n\n // We extract the search params of the destination so we can set it on\n // the response headers. We don't want to use the following\n // `parsedDestination` as the query object is mutated.\n const { search: destinationSearch, pathname: destinationPathname } =\n parseDestination({\n destination: route.destination,\n params: rewriteParams,\n query: parsedUrl.query,\n })\n\n const { parsedDestination } = prepareDestination({\n appendParamsToQuery: true,\n destination: route.destination,\n params: rewriteParams,\n query: parsedUrl.query,\n })\n\n if (parsedDestination.protocol) {\n return {\n // @ts-expect-error custom ParsedUrl\n parsedUrl: parsedDestination,\n finished: true,\n }\n }\n\n // Set the rewrite headers only if this is a RSC request.\n if (req.headers[RSC_HEADER.toLowerCase()] === '1') {\n // We set the rewritten path and query headers on the response now\n // that we know that the it's not an external rewrite.\n if (parsedUrl.pathname !== destinationPathname) {\n res.setHeader(NEXT_REWRITTEN_PATH_HEADER, destinationPathname)\n }\n if (destinationSearch) {\n res.setHeader(\n NEXT_REWRITTEN_QUERY_HEADER,\n // remove the leading ? from the search\n destinationSearch.slice(1)\n )\n }\n }\n\n if (config.i18n) {\n const curLocaleResult = normalizeLocalePath(\n removePathPrefix(parsedDestination.pathname, config.basePath),\n config.i18n.locales\n )\n\n if (curLocaleResult.detectedLocale) {\n addRequestMeta(req, 'locale', curLocaleResult.detectedLocale)\n }\n }\n didRewrite = true\n parsedUrl.pathname = parsedDestination.pathname\n Object.assign(parsedUrl.query, parsedDestination.query)\n }\n\n // handle check: true\n if (route.check) {\n const output = await checkTrue()\n\n if (output) {\n return {\n parsedUrl,\n resHeaders,\n finished: true,\n matchedOutput: output,\n }\n }\n }\n }\n }\n\n for (const route of routes) {\n const result = await handleRoute(route)\n if (result) {\n return result\n }\n }\n\n return {\n finished,\n parsedUrl,\n resHeaders,\n matchedOutput,\n }\n }\n\n return resolveRoutes\n}\n"],"names":["getResolveRoutes","debug","setupDebug","fsChecker","config","opts","renderServer","renderServerOpts","ensureMiddleware","routes","match","name","minimalMode","headers","redirects","rewrites","beforeFiles","afterFiles","check","fallback","resolveRoutes","req","res","isUpgradeReq","invokedOutputs","finished","resHeaders","matchedOutput","parsedUrl","url","parse","didRewrite","urlParts","split","urlNoQuery","normalizeRepeatedSlashes","statusCode","protocol","socket","encrypted","includes","initUrl","experimental","trustHostHeader","host","port","formatHostname","hostname","addRequestMeta","query","getCloneableBody","maybeAddTrailingSlash","pathname","trailingSlash","skipMiddlewareUrlNormalize","endsWith","domainLocale","defaultLocale","initialLocaleResult","undefined","i18n","hadTrailingSlash","hadBasePath","pathHasPrefix","basePath","normalizedPath","removePathPrefix","assetPrefix","normalizeLocalePath","locales","detectDomainLocale","domains","getHostname","detectedLocale","startsWith","addPathPrefix","checkLocaleApi","checkTrue","has","output","getItem","useFileSystemPublicRoutes","type","dynamicRoutes","getDynamicRoutes","curPathname","substring","length","localeResult","handleLocale","route","page","params","pageOutput","normalizers","BasePathPathnameNormalizer","data","NextDataPathnameNormalizer","buildId","handleRoute","internal","isDefaultLocale","missing","hasParams","matchHas","Object","assign","exportPathMapRoutes","exportPathMapRoute","result","getMiddlewareMatchers","normalized","normalize","updated","curLocaleResult","path","posix","join","locale","maybeDecodedPathname","decodeURIComponent","serverResult","initialize","Error","middlewareRes","bodyStream","requestHandler","err","response","status","body","ReadableStream","start","controller","enqueue","close","e","isAbortError","closed","middlewareHeaders","toNodeOutgoingHttpHeaders","overriddenHeaders","Set","overrideHeaders","key","add","trim","keys","valueKey","newValue","oldValue","value","entries","filterReqHeaders","ipcForbiddenHeaders","destination","getRelativeURL","rel","parsedDestination","prepareDestination","appendParamsToQuery","search","stringifyQuery","getRedirectStatus","header","compileNonPath","toLowerCase","Array","isArray","val","push","rewriteParams","isInterceptionRouteRewrite","stateHeader","NEXT_ROUTER_STATE_TREE_HEADER","getSelectedParams","parseAndValidateFlightRouterState","destinationSearch","destinationPathname","parseDestination","RSC_HEADER","setHeader","NEXT_REWRITTEN_PATH_HEADER","NEXT_REWRITTEN_QUERY_HEADER","slice"],"mappings":";;;;+BAmDgBA;;;eAAAA;;;4DAzCA;iEACC;8DACM;6BACU;uBACqB;kCACvB;gCACA;wBACW;8BACb;6BACD;gCACM;wBACO;+BACV;+BACD;+BACA;oCACK;qCACC;kCACH;0BACU;0BACA;6BAEZ;oCAMxB;kCAOA;oCAC2B;oDACS;mDACO;;;;;;AAElD,MAAMC,QAAQC,IAAAA,cAAU,EAAC;AAElB,SAASF,iBACdG,SAEC,EACDC,MAA0B,EAC1BC,IAAsC,EACtCC,YAA0B,EAC1BC,gBAA2D,EAC3DC,gBAAkD;IAYlD,MAAMC,SAAkB;QACtB,sCAAsC;QACtC;YAAEC,OAAO,IAAO,CAAA,CAAC,CAAA;YAAIC,MAAM;QAAuB;WAE9CN,KAAKO,WAAW,GAAG,EAAE,GAAGT,UAAUU,OAAO;WACzCR,KAAKO,WAAW,GAAG,EAAE,GAAGT,UAAUW,SAAS;QAE/C,oCAAoC;QACpC;YAAEJ,OAAO,IAAO,CAA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,UAAUwB,QAAQ,GAAG0G,kBAAkB1G,QAAQ;oBAC/CqD,OAAOC,MAAM,CAAC9E,UAAUqB,KAAK,EAAE6G,kBAAkB7G,KAAK;gBACxD;gBAEA,qBAAqB;gBACrB,IAAIyC,MAAMxE,KAAK,EAAE;oBACf,MAAM6D,SAAS,MAAMF;oBAErB,IAAIE,QAAQ;wBACV,OAAO;4BACLnD;4BACAF;4BACAD,UAAU;4BACVE,eAAeoD;wBACjB;oBACF;gBACF;YACF;QACF;QAEA,KAAK,MAAMW,SAASjF,OAAQ;YAC1B,MAAMoG,SAAS,MAAMV,YAAYT;YACjC,IAAImB,QAAQ;gBACV,OAAOA;YACT;QACF;QAEA,OAAO;YACLpF;YACAG;YACAF;YACAC;QACF;IACF;IAEA,OAAOP;AACT","ignoreList":[0]}
|
1
|
+
{"version":3,"sources":["../../../../src/server/lib/router-utils/resolve-routes.ts"],"sourcesContent":["import type { FsOutput } from './filesystem'\nimport type { IncomingMessage, ServerResponse } from 'http'\nimport type { NextConfigComplete } from '../../config-shared'\nimport type { RenderServer, initialize } from '../router-server'\nimport type { PatchMatcher } from '../../../shared/lib/router/utils/path-match'\nimport type { Redirect } from '../../../types'\nimport type { Header, Rewrite } from '../../../lib/load-custom-routes'\nimport type { UnwrapPromise } from '../../../lib/coalesced-function'\nimport type { NextUrlWithParsedQuery } from '../../request-meta'\n\nimport url from 'url'\nimport path from 'node:path'\nimport setupDebug from 'next/dist/compiled/debug'\nimport { getCloneableBody } from '../../body-streams'\nimport { filterReqHeaders, ipcForbiddenHeaders } from '../server-ipc/utils'\nimport { stringifyQuery } from '../../server-route-utils'\nimport { formatHostname } from '../format-hostname'\nimport { toNodeOutgoingHttpHeaders } from '../../web/utils'\nimport { isAbortError } from '../../pipe-readable'\nimport { getHostname } from '../../../shared/lib/get-hostname'\nimport {\n getRedirectStatus,\n allowedStatusCodes,\n} from '../../../lib/redirect-status'\nimport { normalizeRepeatedSlashes } from '../../../shared/lib/utils'\nimport { getRelativeURL } from '../../../shared/lib/router/utils/relativize-url'\nimport { addPathPrefix } from '../../../shared/lib/router/utils/add-path-prefix'\nimport { pathHasPrefix } from '../../../shared/lib/router/utils/path-has-prefix'\nimport { detectDomainLocale } from '../../../shared/lib/i18n/detect-domain-locale'\nimport { normalizeLocalePath } from '../../../shared/lib/i18n/normalize-locale-path'\nimport { removePathPrefix } from '../../../shared/lib/router/utils/remove-path-prefix'\nimport { NextDataPathnameNormalizer } from '../../normalizers/request/next-data'\nimport { BasePathPathnameNormalizer } from '../../normalizers/request/base-path'\n\nimport { addRequestMeta } from '../../request-meta'\nimport {\n compileNonPath,\n matchHas,\n parseDestination,\n prepareDestination,\n} from '../../../shared/lib/router/utils/prepare-destination'\nimport type { TLSSocket } from 'tls'\nimport {\n NEXT_REWRITTEN_PATH_HEADER,\n NEXT_REWRITTEN_QUERY_HEADER,\n NEXT_ROUTER_STATE_TREE_HEADER,\n RSC_HEADER,\n} from '../../../client/components/app-router-headers'\nimport { getSelectedParams } from '../../../client/components/router-reducer/compute-changed-path'\nimport { isInterceptionRouteRewrite } from '../../../lib/generate-interception-routes-rewrites'\nimport { parseAndValidateFlightRouterState } from '../../app-render/parse-and-validate-flight-router-state'\n\nconst debug = setupDebug('next:router-server:resolve-routes')\n\nexport function getResolveRoutes(\n fsChecker: UnwrapPromise<\n ReturnType<typeof import('./filesystem').setupFsCheck>\n >,\n config: NextConfigComplete,\n opts: Parameters<typeof initialize>[0],\n renderServer: RenderServer,\n renderServerOpts: Parameters<RenderServer['initialize']>[0],\n ensureMiddleware?: (url?: string) => Promise<void>\n) {\n type Route = {\n /**\n * The path matcher to check if this route applies to this request.\n */\n match: PatchMatcher\n check?: boolean\n name?: string\n } & Partial<Header> &\n Partial<Redirect>\n\n const routes: Route[] = [\n // _next/data with middleware handling\n { match: () => ({}), name: 'middleware_next_data' },\n\n ...(opts.minimalMode ? [] : fsChecker.headers),\n ...(opts.minimalMode ? [] : fsChecker.redirects),\n\n // check middleware (using matchers)\n { match: () => ({}), name: 'middleware' },\n\n ...(opts.minimalMode ? [] : fsChecker.rewrites.beforeFiles),\n\n // check middleware (using matchers)\n { match: () => ({}), name: 'before_files_end' },\n\n // we check exact matches on fs before continuing to\n // after files rewrites\n { match: () => ({}), name: 'check_fs' },\n\n ...(opts.minimalMode ? [] : fsChecker.rewrites.afterFiles),\n\n // we always do the check: true handling before continuing to\n // fallback rewrites\n {\n check: true,\n match: () => ({}),\n name: 'after files check: true',\n },\n\n ...(opts.minimalMode ? [] : fsChecker.rewrites.fallback),\n ]\n\n async function resolveRoutes({\n req,\n res,\n isUpgradeReq,\n invokedOutputs,\n }: {\n req: IncomingMessage\n res: ServerResponse\n isUpgradeReq: boolean\n signal: AbortSignal\n invokedOutputs?: Set<string>\n }): Promise<{\n finished: boolean\n statusCode?: number\n bodyStream?: ReadableStream | null\n resHeaders: Record<string, string | string[]>\n parsedUrl: NextUrlWithParsedQuery\n matchedOutput?: FsOutput | null\n }> {\n let finished = false\n let resHeaders: Record<string, string | string[]> = {}\n let matchedOutput: FsOutput | null = null\n let parsedUrl = url.parse(req.url || '', true) as NextUrlWithParsedQuery\n let didRewrite = false\n\n const urlParts = (req.url || '').split('?', 1)\n const urlNoQuery = urlParts[0]\n\n // this normalizes repeated slashes in the path e.g. hello//world ->\n // hello/world or backslashes to forward slashes, this does not\n // handle trailing slash as that is handled the same as a next.config.js\n // redirect\n if (urlNoQuery?.match(/(\\\\|\\/\\/)/)) {\n parsedUrl = url.parse(normalizeRepeatedSlashes(req.url!), true)\n return {\n parsedUrl,\n resHeaders,\n finished: true,\n statusCode: 308,\n }\n }\n // TODO: inherit this from higher up\n const protocol =\n (req?.socket as TLSSocket)?.encrypted ||\n req.headers['x-forwarded-proto']?.includes('https')\n ? 'https'\n : 'http'\n\n // When there are hostname and port we build an absolute URL\n const initUrl = (config.experimental as any).trustHostHeader\n ? `https://${req.headers.host || 'localhost'}${req.url}`\n : opts.port\n ? `${protocol}://${formatHostname(opts.hostname || 'localhost')}:${\n opts.port\n }${req.url}`\n : req.url || ''\n\n addRequestMeta(req, 'initURL', initUrl)\n addRequestMeta(req, 'initQuery', { ...parsedUrl.query })\n addRequestMeta(req, 'initProtocol', protocol)\n\n if (!isUpgradeReq) {\n addRequestMeta(req, 'clonableBody', getCloneableBody(req))\n }\n\n const maybeAddTrailingSlash = (pathname: string) => {\n if (\n config.trailingSlash &&\n !config.skipMiddlewareUrlNormalize &&\n !pathname.endsWith('/')\n ) {\n return `${pathname}/`\n }\n return pathname\n }\n\n let domainLocale: ReturnType<typeof detectDomainLocale> | undefined\n let defaultLocale: string | undefined\n let initialLocaleResult:\n | ReturnType<typeof normalizeLocalePath>\n | undefined = undefined\n\n if (config.i18n) {\n const hadTrailingSlash = parsedUrl.pathname?.endsWith('/')\n const hadBasePath = pathHasPrefix(\n parsedUrl.pathname || '',\n config.basePath\n )\n let normalizedPath = parsedUrl.pathname || '/'\n\n if (config.basePath && pathHasPrefix(normalizedPath, config.basePath)) {\n normalizedPath = removePathPrefix(normalizedPath, config.basePath)\n } else if (\n config.assetPrefix &&\n pathHasPrefix(normalizedPath, config.assetPrefix)\n ) {\n normalizedPath = removePathPrefix(normalizedPath, config.assetPrefix)\n }\n\n initialLocaleResult = normalizeLocalePath(\n normalizedPath,\n config.i18n.locales\n )\n\n domainLocale = detectDomainLocale(\n config.i18n.domains,\n getHostname(parsedUrl, req.headers)\n )\n defaultLocale = domainLocale?.defaultLocale || config.i18n.defaultLocale\n\n addRequestMeta(req, 'defaultLocale', defaultLocale)\n addRequestMeta(\n req,\n 'locale',\n initialLocaleResult.detectedLocale || defaultLocale\n )\n\n // ensure locale is present for resolving routes\n if (\n !initialLocaleResult.detectedLocale &&\n !initialLocaleResult.pathname.startsWith('/_next/')\n ) {\n parsedUrl.pathname = addPathPrefix(\n initialLocaleResult.pathname === '/'\n ? `/${defaultLocale}`\n : addPathPrefix(\n initialLocaleResult.pathname || '',\n `/${defaultLocale}`\n ),\n hadBasePath ? config.basePath : ''\n )\n\n if (hadTrailingSlash) {\n parsedUrl.pathname = maybeAddTrailingSlash(parsedUrl.pathname)\n }\n }\n }\n\n const checkLocaleApi = (pathname: string) => {\n if (\n config.i18n &&\n pathname === urlNoQuery &&\n initialLocaleResult?.detectedLocale &&\n pathHasPrefix(initialLocaleResult.pathname, '/api')\n ) {\n return true\n }\n }\n\n async function checkTrue() {\n const pathname = parsedUrl.pathname || '/'\n\n if (checkLocaleApi(pathname)) {\n return\n }\n if (!invokedOutputs?.has(pathname)) {\n const output = await fsChecker.getItem(pathname)\n\n if (output) {\n if (\n config.useFileSystemPublicRoutes ||\n didRewrite ||\n (output.type !== 'appFile' && output.type !== 'pageFile')\n ) {\n return output\n }\n }\n }\n const dynamicRoutes = fsChecker.getDynamicRoutes()\n let curPathname = parsedUrl.pathname\n\n if (config.basePath) {\n if (!pathHasPrefix(curPathname || '', config.basePath)) {\n return\n }\n curPathname = curPathname?.substring(config.basePath.length) || '/'\n }\n const localeResult = fsChecker.handleLocale(curPathname || '')\n\n for (const route of dynamicRoutes) {\n // when resolving fallback: false the\n // render worker may return a no-fallback response\n // which signals we need to continue resolving.\n // TODO: optimize this to collect static paths\n // to use at the routing layer\n if (invokedOutputs?.has(route.page)) {\n continue\n }\n const params = route.match(localeResult.pathname)\n\n if (params) {\n const pageOutput = await fsChecker.getItem(\n addPathPrefix(route.page, config.basePath || '')\n )\n\n // i18n locales aren't matched for app dir\n if (\n pageOutput?.type === 'appFile' &&\n initialLocaleResult?.detectedLocale\n ) {\n continue\n }\n\n if (pageOutput && curPathname?.startsWith('/_next/data')) {\n addRequestMeta(req, 'isNextDataReq', true)\n }\n\n if (config.useFileSystemPublicRoutes || didRewrite) {\n return pageOutput\n }\n }\n }\n }\n\n const normalizers = {\n basePath:\n config.basePath && config.basePath !== '/'\n ? new BasePathPathnameNormalizer(config.basePath)\n : undefined,\n data: new NextDataPathnameNormalizer(fsChecker.buildId),\n }\n\n async function handleRoute(\n route: (typeof routes)[0]\n ): Promise<UnwrapPromise<ReturnType<typeof resolveRoutes>> | void> {\n let curPathname = parsedUrl.pathname || '/'\n\n if (config.i18n && route.internal) {\n const hadTrailingSlash = curPathname.endsWith('/')\n\n if (config.basePath) {\n curPathname = removePathPrefix(curPathname, config.basePath)\n }\n const hadBasePath = curPathname !== parsedUrl.pathname\n\n const localeResult = normalizeLocalePath(\n curPathname,\n config.i18n.locales\n )\n const isDefaultLocale = localeResult.detectedLocale === defaultLocale\n\n if (isDefaultLocale) {\n curPathname =\n localeResult.pathname === '/' && hadBasePath\n ? config.basePath\n : addPathPrefix(\n localeResult.pathname,\n hadBasePath ? config.basePath : ''\n )\n } else if (hadBasePath) {\n curPathname =\n curPathname === '/'\n ? config.basePath\n : addPathPrefix(curPathname, config.basePath)\n }\n\n if ((isDefaultLocale || hadBasePath) && hadTrailingSlash) {\n curPathname = maybeAddTrailingSlash(curPathname)\n }\n }\n let params = route.match(curPathname)\n\n if ((route.has || route.missing) && params) {\n const hasParams = matchHas(\n req,\n parsedUrl.query,\n route.has,\n route.missing\n )\n if (hasParams) {\n Object.assign(params, hasParams)\n } else {\n params = false\n }\n }\n\n if (params) {\n if (\n fsChecker.exportPathMapRoutes &&\n route.name === 'before_files_end'\n ) {\n for (const exportPathMapRoute of fsChecker.exportPathMapRoutes) {\n const result = await handleRoute(exportPathMapRoute)\n\n if (result) {\n return result\n }\n }\n }\n\n if (route.name === 'middleware_next_data' && parsedUrl.pathname) {\n if (fsChecker.getMiddlewareMatchers()?.length) {\n let normalized = parsedUrl.pathname\n\n // Remove the base path if it exists.\n const hadBasePath = normalizers.basePath?.match(parsedUrl.pathname)\n if (hadBasePath && normalizers.basePath) {\n normalized = normalizers.basePath.normalize(normalized, true)\n }\n\n let updated = false\n if (normalizers.data.match(normalized)) {\n updated = true\n addRequestMeta(req, 'isNextDataReq', true)\n normalized = normalizers.data.normalize(normalized, true)\n }\n\n if (config.i18n) {\n const curLocaleResult = normalizeLocalePath(\n normalized,\n config.i18n.locales\n )\n\n if (curLocaleResult.detectedLocale) {\n addRequestMeta(req, 'locale', curLocaleResult.detectedLocale)\n }\n }\n\n // If we updated the pathname, and it had a base path, re-add the\n // base path.\n if (updated) {\n if (hadBasePath) {\n normalized = path.posix.join(config.basePath, normalized)\n }\n\n // Re-add the trailing slash (if required).\n normalized = maybeAddTrailingSlash(normalized)\n\n parsedUrl.pathname = normalized\n }\n }\n }\n\n if (route.name === 'check_fs') {\n const pathname = parsedUrl.pathname || '/'\n\n if (invokedOutputs?.has(pathname) || checkLocaleApi(pathname)) {\n return\n }\n const output = await fsChecker.getItem(pathname)\n\n if (\n output &&\n !(\n config.i18n &&\n initialLocaleResult?.detectedLocale &&\n pathHasPrefix(pathname, '/api')\n )\n ) {\n if (\n config.useFileSystemPublicRoutes ||\n didRewrite ||\n (output.type !== 'appFile' && output.type !== 'pageFile')\n ) {\n matchedOutput = output\n\n if (output.locale) {\n addRequestMeta(req, 'locale', output.locale)\n }\n return {\n parsedUrl,\n resHeaders,\n finished: true,\n matchedOutput,\n }\n }\n }\n }\n\n if (!opts.minimalMode && route.name === 'middleware') {\n const match = fsChecker.getMiddlewareMatchers()\n let maybeDecodedPathname = parsedUrl.pathname || '/'\n\n try {\n maybeDecodedPathname = decodeURIComponent(maybeDecodedPathname)\n } catch {\n /* non-fatal we can't decode so can't match it */\n }\n\n if (\n // @ts-expect-error BaseNextRequest stuff\n match?.(parsedUrl.pathname, req, parsedUrl.query) ||\n match?.(\n maybeDecodedPathname,\n // @ts-expect-error BaseNextRequest stuff\n req,\n parsedUrl.query\n )\n ) {\n if (ensureMiddleware) {\n await ensureMiddleware(req.url)\n }\n\n const serverResult =\n await renderServer?.initialize(renderServerOpts)\n\n if (!serverResult) {\n throw new Error(`Failed to initialize render server \"middleware\"`)\n }\n\n addRequestMeta(req, 'invokePath', '')\n addRequestMeta(req, 'invokeOutput', '')\n addRequestMeta(req, 'invokeQuery', {})\n addRequestMeta(req, 'middlewareInvoke', true)\n debug('invoking middleware', req.url, req.headers)\n\n let middlewareRes: Response | undefined = undefined\n let bodyStream: ReadableStream | undefined = undefined\n try {\n try {\n await serverResult.requestHandler(req, res, parsedUrl)\n } catch (err: any) {\n if (!('result' in err) || !('response' in err.result)) {\n throw err\n }\n middlewareRes = err.result.response as Response\n res.statusCode = middlewareRes.status\n\n if (middlewareRes.body) {\n bodyStream = middlewareRes.body\n } else if (middlewareRes.status) {\n bodyStream = new ReadableStream({\n start(controller) {\n controller.enqueue('')\n controller.close()\n },\n })\n }\n }\n } catch (e) {\n // If the client aborts before we can receive a response object\n // (when the headers are flushed), then we can early exit without\n // further processing.\n if (isAbortError(e)) {\n return {\n parsedUrl,\n resHeaders,\n finished: true,\n }\n }\n throw e\n }\n\n if (res.closed || res.finished || !middlewareRes) {\n return {\n parsedUrl,\n resHeaders,\n finished: true,\n }\n }\n\n const middlewareHeaders = toNodeOutgoingHttpHeaders(\n middlewareRes.headers\n ) as Record<string, string | string[] | undefined>\n\n debug('middleware res', middlewareRes.status, middlewareHeaders)\n\n if (middlewareHeaders['x-middleware-override-headers']) {\n const overriddenHeaders: Set<string> = new Set()\n let overrideHeaders: string | string[] =\n middlewareHeaders['x-middleware-override-headers']\n\n if (typeof overrideHeaders === 'string') {\n overrideHeaders = overrideHeaders.split(',')\n }\n\n for (const key of overrideHeaders) {\n overriddenHeaders.add(key.trim())\n }\n delete middlewareHeaders['x-middleware-override-headers']\n\n // Delete headers.\n for (const key of Object.keys(req.headers)) {\n if (!overriddenHeaders.has(key)) {\n delete req.headers[key]\n }\n }\n\n // Update or add headers.\n for (const key of overriddenHeaders.keys()) {\n const valueKey = 'x-middleware-request-' + key\n const newValue = middlewareHeaders[valueKey]\n const oldValue = req.headers[key]\n\n if (oldValue !== newValue) {\n req.headers[key] = newValue === null ? undefined : newValue\n }\n delete middlewareHeaders[valueKey]\n }\n }\n\n if (\n !middlewareHeaders['x-middleware-rewrite'] &&\n !middlewareHeaders['x-middleware-next'] &&\n !middlewareHeaders['location']\n ) {\n middlewareHeaders['x-middleware-refresh'] = '1'\n }\n delete middlewareHeaders['x-middleware-next']\n\n for (const [key, value] of Object.entries({\n ...filterReqHeaders(middlewareHeaders, ipcForbiddenHeaders),\n })) {\n if (\n [\n 'content-length',\n 'x-middleware-rewrite',\n 'x-middleware-redirect',\n 'x-middleware-refresh',\n ].includes(key)\n ) {\n continue\n }\n\n // for set-cookie, the header shouldn't be added to the response\n // as it's only needed for the request to the middleware function.\n if (key === 'x-middleware-set-cookie') {\n req.headers[key] = value\n continue\n }\n\n if (value) {\n resHeaders[key] = value\n req.headers[key] = value\n }\n }\n\n if (middlewareHeaders['x-middleware-rewrite']) {\n const value = middlewareHeaders['x-middleware-rewrite'] as string\n const destination = getRelativeURL(value, initUrl)\n resHeaders['x-middleware-rewrite'] = destination\n\n parsedUrl = url.parse(destination, true)\n\n if (parsedUrl.protocol) {\n return {\n parsedUrl,\n resHeaders,\n finished: true,\n }\n }\n\n if (config.i18n) {\n const curLocaleResult = normalizeLocalePath(\n parsedUrl.pathname || '',\n config.i18n.locales\n )\n\n if (curLocaleResult.detectedLocale) {\n addRequestMeta(req, 'locale', curLocaleResult.detectedLocale)\n }\n }\n }\n\n if (middlewareHeaders['location']) {\n const value = middlewareHeaders['location'] as string\n\n // Only process Location header as a redirect if it has a proper redirect status\n // This prevents a Location header with non-redirect status from being treated as a redirect\n const isRedirectStatus = allowedStatusCodes.has(\n middlewareRes.status\n )\n\n if (isRedirectStatus) {\n // Process as redirect: update parsedUrl and convert to relative URL\n const rel = getRelativeURL(value, initUrl)\n resHeaders['location'] = rel\n parsedUrl = url.parse(rel, true)\n\n return {\n parsedUrl,\n resHeaders,\n finished: true,\n statusCode: middlewareRes.status,\n }\n } else {\n // Not a redirect: just pass through the Location header\n resHeaders['location'] = value\n\n return {\n parsedUrl,\n resHeaders,\n finished: true,\n bodyStream,\n statusCode: middlewareRes.status,\n }\n }\n }\n\n if (middlewareHeaders['x-middleware-refresh']) {\n return {\n parsedUrl,\n resHeaders,\n finished: true,\n bodyStream,\n statusCode: middlewareRes.status,\n }\n }\n }\n }\n\n // handle redirect\n if (\n ('statusCode' in route || 'permanent' in route) &&\n route.destination\n ) {\n const { parsedDestination } = prepareDestination({\n appendParamsToQuery: false,\n destination: route.destination,\n params: params,\n query: parsedUrl.query,\n })\n\n const { query } = parsedDestination\n delete (parsedDestination as any).query\n\n parsedDestination.search = stringifyQuery(req as any, query)\n\n parsedDestination.pathname = normalizeRepeatedSlashes(\n parsedDestination.pathname\n )\n\n return {\n finished: true,\n // @ts-expect-error custom ParsedUrl\n parsedUrl: parsedDestination,\n statusCode: getRedirectStatus(route),\n }\n }\n\n // handle headers\n if (route.headers) {\n const hasParams = Object.keys(params).length > 0\n for (const header of route.headers) {\n let { key, value } = header\n if (hasParams) {\n key = compileNonPath(key, params)\n value = compileNonPath(value, params)\n }\n\n if (key.toLowerCase() === 'set-cookie') {\n if (!Array.isArray(resHeaders[key])) {\n const val = resHeaders[key]\n resHeaders[key] = typeof val === 'string' ? [val] : []\n }\n ;(resHeaders[key] as string[]).push(value)\n } else {\n resHeaders[key] = value\n }\n }\n }\n\n // handle rewrite\n if (route.destination) {\n let rewriteParams = params\n\n try {\n // An interception rewrite might reference a dynamic param for a route the user\n // is currently on, which wouldn't be extractable from the matched route params.\n // This attempts to extract the dynamic params from the provided router state.\n if (isInterceptionRouteRewrite(route as Rewrite)) {\n const stateHeader =\n req.headers[NEXT_ROUTER_STATE_TREE_HEADER.toLowerCase()]\n\n if (stateHeader) {\n rewriteParams = {\n ...getSelectedParams(\n parseAndValidateFlightRouterState(stateHeader)\n ),\n ...params,\n }\n }\n }\n } catch (err) {\n // this is a no-op -- we couldn't extract dynamic params from the provided router state,\n // so we'll just use the params from the route matcher\n }\n\n // We extract the search params of the destination so we can set it on\n // the response headers. We don't want to use the following\n // `parsedDestination` as the query object is mutated.\n const { search: destinationSearch, pathname: destinationPathname } =\n parseDestination({\n destination: route.destination,\n params: rewriteParams,\n query: parsedUrl.query,\n })\n\n const { parsedDestination } = prepareDestination({\n appendParamsToQuery: true,\n destination: route.destination,\n params: rewriteParams,\n query: parsedUrl.query,\n })\n\n if (parsedDestination.protocol) {\n return {\n // @ts-expect-error custom ParsedUrl\n parsedUrl: parsedDestination,\n finished: true,\n }\n }\n\n // Set the rewrite headers only if this is a RSC request.\n if (req.headers[RSC_HEADER.toLowerCase()] === '1') {\n // We set the rewritten path and query headers on the response now\n // that we know that the it's not an external rewrite.\n if (parsedUrl.pathname !== destinationPathname) {\n res.setHeader(NEXT_REWRITTEN_PATH_HEADER, destinationPathname)\n }\n if (destinationSearch) {\n res.setHeader(\n NEXT_REWRITTEN_QUERY_HEADER,\n // remove the leading ? from the search\n destinationSearch.slice(1)\n )\n }\n }\n\n if (config.i18n) {\n const curLocaleResult = normalizeLocalePath(\n removePathPrefix(parsedDestination.pathname, config.basePath),\n config.i18n.locales\n )\n\n if (curLocaleResult.detectedLocale) {\n addRequestMeta(req, 'locale', curLocaleResult.detectedLocale)\n }\n }\n didRewrite = true\n parsedUrl.pathname = parsedDestination.pathname\n Object.assign(parsedUrl.query, parsedDestination.query)\n }\n\n // handle check: true\n if (route.check) {\n const output = await checkTrue()\n\n if (output) {\n return {\n parsedUrl,\n resHeaders,\n finished: true,\n matchedOutput: output,\n }\n }\n }\n }\n }\n\n for (const route of routes) {\n const result = await handleRoute(route)\n if (result) {\n return result\n }\n }\n\n return {\n finished,\n parsedUrl,\n resHeaders,\n matchedOutput,\n }\n }\n\n return resolveRoutes\n}\n"],"names":["getResolveRoutes","debug","setupDebug","fsChecker","config","opts","renderServer","renderServerOpts","ensureMiddleware","routes","match","name","minimalMode","headers","redirects","rewrites","beforeFiles","afterFiles","check","fallback","resolveRoutes","req","res","isUpgradeReq","invokedOutputs","finished","resHeaders","matchedOutput","parsedUrl","url","parse","didRewrite","urlParts","split","urlNoQuery","normalizeRepeatedSlashes","statusCode","protocol","socket","encrypted","includes","initUrl","experimental","trustHostHeader","host","port","formatHostname","hostname","addRequestMeta","query","getCloneableBody","maybeAddTrailingSlash","pathname","trailingSlash","skipMiddlewareUrlNormalize","endsWith","domainLocale","defaultLocale","initialLocaleResult","undefined","i18n","hadTrailingSlash","hadBasePath","pathHasPrefix","basePath","normalizedPath","removePathPrefix","assetPrefix","normalizeLocalePath","locales","detectDomainLocale","domains","getHostname","detectedLocale","startsWith","addPathPrefix","checkLocaleApi","checkTrue","has","output","getItem","useFileSystemPublicRoutes","type","dynamicRoutes","getDynamicRoutes","curPathname","substring","length","localeResult","handleLocale","route","page","params","pageOutput","normalizers","BasePathPathnameNormalizer","data","NextDataPathnameNormalizer","buildId","handleRoute","internal","isDefaultLocale","missing","hasParams","matchHas","Object","assign","exportPathMapRoutes","exportPathMapRoute","result","getMiddlewareMatchers","normalized","normalize","updated","curLocaleResult","path","posix","join","locale","maybeDecodedPathname","decodeURIComponent","serverResult","initialize","Error","middlewareRes","bodyStream","requestHandler","err","response","status","body","ReadableStream","start","controller","enqueue","close","e","isAbortError","closed","middlewareHeaders","toNodeOutgoingHttpHeaders","overriddenHeaders","Set","overrideHeaders","key","add","trim","keys","valueKey","newValue","oldValue","value","entries","filterReqHeaders","ipcForbiddenHeaders","destination","getRelativeURL","isRedirectStatus","allowedStatusCodes","rel","parsedDestination","prepareDestination","appendParamsToQuery","search","stringifyQuery","getRedirectStatus","header","compileNonPath","toLowerCase","Array","isArray","val","push","rewriteParams","isInterceptionRouteRewrite","stateHeader","NEXT_ROUTER_STATE_TREE_HEADER","getSelectedParams","parseAndValidateFlightRouterState","destinationSearch","destinationPathname","parseDestination","RSC_HEADER","setHeader","NEXT_REWRITTEN_PATH_HEADER","NEXT_REWRITTEN_QUERY_HEADER","slice"],"mappings":";;;;+BAsDgBA;;;eAAAA;;;4DA5CA;iEACC;8DACM;6BACU;uBACqB;kCACvB;gCACA;wBACW;8BACb;6BACD;gCAIrB;wBACkC;+BACV;+BACD;+BACA;oCACK;qCACC;kCACH;0BACU;0BACA;6BAEZ;oCAMxB;kCAOA;oCAC2B;oDACS;mDACO;;;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({ dir, port, isDev, onDevServerCleanup, server
|
|
171
171
|
async function startServer(serverOptions) {
|
172
172
|
const { dir, isDev, hostname, minimalMode, allowRetry, keepAliveTimeout, selfSignedCertificate } = serverOptions;
|
173
173
|
let { port } = serverOptions;
|
174
|
-
process.title = `next-server (v${"15.4.
|
174
|
+
process.title = `next-server (v${"15.4.7"})`;
|
175
175
|
let handlersReady = ()=>{};
|
176
176
|
let handlersError = ()=>{};
|
177
177
|
let handlersPromise = new Promise((resolve, reject)=>{
|
@@ -22,7 +22,7 @@ _export(exports, {
|
|
22
22
|
});
|
23
23
|
function isStableBuild() {
|
24
24
|
var _process_env___NEXT_VERSION;
|
25
|
-
return !((_process_env___NEXT_VERSION = "15.4.
|
25
|
+
return !((_process_env___NEXT_VERSION = "15.4.7") == null ? void 0 : _process_env___NEXT_VERSION.includes('canary')) && !process.env.__NEXT_TEST_MODE && !process.env.NEXT_PRIVATE_LOCAL_DEV;
|
26
26
|
}
|
27
27
|
class CanaryOnlyError extends Error {
|
28
28
|
constructor(arg){
|
@@ -11,11 +11,11 @@ Object.defineProperty(exports, "eventCliSessionStopped", {
|
|
11
11
|
const EVENT_VERSION = 'NEXT_CLI_SESSION_STOPPED';
|
12
12
|
function eventCliSessionStopped(event) {
|
13
13
|
// This should be an invariant, if it fails our build tooling is broken.
|
14
|
-
if (typeof "15.4.
|
14
|
+
if (typeof "15.4.7" !== 'string') {
|
15
15
|
return [];
|
16
16
|
}
|
17
17
|
const payload = {
|
18
|
-
nextVersion: "15.4.
|
18
|
+
nextVersion: "15.4.7",
|
19
19
|
nodeVersion: process.version,
|
20
20
|
cliCommand: event.cliCommand,
|
21
21
|
durationMilliseconds: event.durationMilliseconds,
|
@@ -36,12 +36,12 @@ function hasBabelConfig(dir) {
|
|
36
36
|
function eventCliSession(dir, nextConfig, event) {
|
37
37
|
var _nextConfig_experimental_staleTimes, _nextConfig_experimental_staleTimes1, _nextConfig_experimental_reactCompiler, _nextConfig_experimental_reactCompiler1;
|
38
38
|
// This should be an invariant, if it fails our build tooling is broken.
|
39
|
-
if (typeof "15.4.
|
39
|
+
if (typeof "15.4.7" !== 'string') {
|
40
40
|
return [];
|
41
41
|
}
|
42
42
|
const { images, i18n } = nextConfig || {};
|
43
43
|
const payload = {
|
44
|
-
nextVersion: "15.4.
|
44
|
+
nextVersion: "15.4.7",
|
45
45
|
nodeVersion: process.version,
|
46
46
|
cliCommand: event.cliCommand,
|
47
47
|
isSrcDir: event.isSrcDir,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "next",
|
3
|
-
"version": "15.4.
|
3
|
+
"version": "15.4.7",
|
4
4
|
"description": "The React Framework",
|
5
5
|
"main": "./dist/server/next.js",
|
6
6
|
"license": "MIT",
|
@@ -100,7 +100,7 @@
|
|
100
100
|
]
|
101
101
|
},
|
102
102
|
"dependencies": {
|
103
|
-
"@next/env": "15.4.
|
103
|
+
"@next/env": "15.4.7",
|
104
104
|
"@swc/helpers": "0.5.15",
|
105
105
|
"caniuse-lite": "^1.0.30001579",
|
106
106
|
"postcss": "8.4.31",
|
@@ -130,14 +130,14 @@
|
|
130
130
|
},
|
131
131
|
"optionalDependencies": {
|
132
132
|
"sharp": "^0.34.3",
|
133
|
-
"@next/swc-darwin-arm64": "15.4.
|
134
|
-
"@next/swc-darwin-x64": "15.4.
|
135
|
-
"@next/swc-linux-arm64-gnu": "15.4.
|
136
|
-
"@next/swc-linux-arm64-musl": "15.4.
|
137
|
-
"@next/swc-linux-x64-gnu": "15.4.
|
138
|
-
"@next/swc-linux-x64-musl": "15.4.
|
139
|
-
"@next/swc-win32-arm64-msvc": "15.4.
|
140
|
-
"@next/swc-win32-x64-msvc": "15.4.
|
133
|
+
"@next/swc-darwin-arm64": "15.4.7",
|
134
|
+
"@next/swc-darwin-x64": "15.4.7",
|
135
|
+
"@next/swc-linux-arm64-gnu": "15.4.7",
|
136
|
+
"@next/swc-linux-arm64-musl": "15.4.7",
|
137
|
+
"@next/swc-linux-x64-gnu": "15.4.7",
|
138
|
+
"@next/swc-linux-x64-musl": "15.4.7",
|
139
|
+
"@next/swc-win32-arm64-msvc": "15.4.7",
|
140
|
+
"@next/swc-win32-x64-msvc": "15.4.7"
|
141
141
|
},
|
142
142
|
"devDependencies": {
|
143
143
|
"@ampproject/toolbox-optimizer": "2.8.3",
|
@@ -171,11 +171,11 @@
|
|
171
171
|
"@jest/types": "29.5.0",
|
172
172
|
"@mswjs/interceptors": "0.23.0",
|
173
173
|
"@napi-rs/triples": "1.2.0",
|
174
|
-
"@next/font": "15.4.
|
175
|
-
"@next/polyfill-module": "15.4.
|
176
|
-
"@next/polyfill-nomodule": "15.4.
|
177
|
-
"@next/react-refresh-utils": "15.4.
|
178
|
-
"@next/swc": "15.4.
|
174
|
+
"@next/font": "15.4.7",
|
175
|
+
"@next/polyfill-module": "15.4.7",
|
176
|
+
"@next/polyfill-nomodule": "15.4.7",
|
177
|
+
"@next/react-refresh-utils": "15.4.7",
|
178
|
+
"@next/swc": "15.4.7",
|
179
179
|
"@opentelemetry/api": "1.6.0",
|
180
180
|
"@playwright/test": "1.51.1",
|
181
181
|
"@rspack/core": "1.4.5",
|