next 15.4.2 → 15.4.4
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/generated-native.d.ts +21 -10
- package/dist/build/swc/index.js +3 -3
- package/dist/build/swc/index.js.map +1 -1
- package/dist/build/swc/types.d.ts +8 -4
- package/dist/build/templates/app-page.js +1 -1
- package/dist/build/templates/app-page.js.map +1 -1
- package/dist/build/templates/app-route.js +1 -1
- package/dist/build/templates/app-route.js.map +1 -1
- package/dist/build/templates/pages.js +11 -9
- package/dist/build/templates/pages.js.map +1 -1
- package/dist/build/turbopack-build/impl.js +5 -3
- package/dist/build/turbopack-build/impl.js.map +1 -1
- package/dist/build/webpack/loaders/css-loader/src/utils.js +3 -5
- package/dist/build/webpack/loaders/css-loader/src/utils.js.map +1 -1
- package/dist/build/webpack/loaders/metadata/resolve-route-data.js +4 -4
- package/dist/build/webpack/loaders/metadata/resolve-route-data.js.map +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-turbo.runtime.dev.js +1 -1
- package/dist/compiled/next-server/pages-turbo.runtime.dev.js.map +1 -1
- package/dist/esm/build/index.js +2 -2
- package/dist/esm/build/swc/generated-native.d.ts +21 -10
- package/dist/esm/build/swc/index.js +3 -3
- package/dist/esm/build/swc/index.js.map +1 -1
- package/dist/esm/build/swc/types.js.map +1 -1
- package/dist/esm/build/templates/app-page.js +1 -1
- package/dist/esm/build/templates/app-page.js.map +1 -1
- package/dist/esm/build/templates/app-route.js +1 -1
- package/dist/esm/build/templates/app-route.js.map +1 -1
- package/dist/esm/build/templates/pages.js +11 -9
- package/dist/esm/build/templates/pages.js.map +1 -1
- package/dist/esm/build/turbopack-build/impl.js +5 -3
- package/dist/esm/build/turbopack-build/impl.js.map +1 -1
- package/dist/esm/build/webpack/loaders/css-loader/src/utils.js +1 -3
- package/dist/esm/build/webpack/loaders/css-loader/src/utils.js.map +1 -1
- package/dist/esm/build/webpack/loaders/metadata/resolve-route-data.js +4 -4
- package/dist/esm/build/webpack/loaders/metadata/resolve-route-data.js.map +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/lib/normalize-path.js +6 -0
- package/dist/esm/lib/normalize-path.js.map +1 -0
- package/dist/esm/server/dev/hot-reloader-turbopack.js +6 -4
- package/dist/esm/server/dev/hot-reloader-turbopack.js.map +1 -1
- package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
- package/dist/esm/server/dev/next-dev-server.js +3 -1
- package/dist/esm/server/dev/next-dev-server.js.map +1 -1
- package/dist/esm/server/lib/app-info-log.js +1 -1
- package/dist/esm/server/lib/router-utils/setup-dev-bundler.js +6 -1
- package/dist/esm/server/lib/router-utils/setup-dev-bundler.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/lib/normalize-path.d.ts +1 -0
- package/dist/lib/normalize-path.js +21 -0
- package/dist/lib/normalize-path.js.map +1 -0
- package/dist/server/dev/hot-reloader-turbopack.js +5 -3
- package/dist/server/dev/hot-reloader-turbopack.js.map +1 -1
- package/dist/server/dev/hot-reloader-webpack.js +1 -1
- package/dist/server/dev/next-dev-server.js +3 -1
- package/dist/server/dev/next-dev-server.js.map +1 -1
- package/dist/server/lib/app-info-log.js +1 -1
- package/dist/server/lib/router-utils/setup-dev-bundler.js +6 -1
- package/dist/server/lib/router-utils/setup-dev-bundler.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/build/templates/app-page.ts"],"sourcesContent":["import type { LoaderTree } from '../../server/lib/app-dir-module'\nimport type { IncomingMessage, ServerResponse } from 'node:http'\n\nimport {\n AppPageRouteModule,\n type AppPageRouteHandlerContext,\n} from '../../server/route-modules/app-page/module.compiled' with { 'turbopack-transition': 'next-ssr' }\n\nimport { RouteKind } from '../../server/route-kind' with { 'turbopack-transition': 'next-server-utility' }\n\nimport { getRevalidateReason } from '../../server/instrumentation/utils'\nimport { getTracer, SpanKind, type Span } from '../../server/lib/trace/tracer'\nimport { getRequestMeta } from '../../server/request-meta'\nimport { BaseServerSpan } from '../../server/lib/trace/constants'\nimport { interopDefault } from '../../server/app-render/interop-default'\nimport { NodeNextRequest, NodeNextResponse } from '../../server/base-http/node'\nimport { checkIsAppPPREnabled } from '../../server/lib/experimental/ppr'\nimport {\n getFallbackRouteParams,\n type FallbackRouteParams,\n} from '../../server/request/fallback-params'\nimport { setReferenceManifestsSingleton } from '../../server/app-render/encryption-utils'\nimport {\n isHtmlBotRequest,\n shouldServeStreamingMetadata,\n} from '../../server/lib/streaming-metadata'\nimport { createServerModuleMap } from '../../server/app-render/action-utils'\nimport { normalizeAppPath } from '../../shared/lib/router/utils/app-paths'\nimport { getIsPossibleServerAction } from '../../server/lib/server-action-request-meta'\nimport {\n RSC_HEADER,\n NEXT_ROUTER_PREFETCH_HEADER,\n NEXT_IS_PRERENDER_HEADER,\n NEXT_DID_POSTPONE_HEADER,\n} from '../../client/components/app-router-headers'\nimport { getBotType, isBot } from '../../shared/lib/router/utils/is-bot'\nimport {\n CachedRouteKind,\n type CachedAppPageValue,\n type CachedPageValue,\n type ResponseCacheEntry,\n type ResponseGenerator,\n} from '../../server/response-cache'\nimport { FallbackMode, parseFallbackField } from '../../lib/fallback'\nimport RenderResult from '../../server/render-result'\nimport { CACHE_ONE_YEAR, NEXT_CACHE_TAGS_HEADER } from '../../lib/constants'\nimport type { CacheControl } from '../../server/lib/cache-control'\nimport { ENCODED_TAGS } from '../../server/stream-utils/encoded-tags'\nimport { sendRenderResult } from '../../server/send-payload'\nimport { NoFallbackError } from '../../shared/lib/no-fallback-error.external'\n\n// These are injected by the loader afterwards.\n\n/**\n * The tree created in next-app-loader that holds component segments and modules\n * and I've updated it.\n */\ndeclare const tree: LoaderTree\ndeclare const pages: any\n\n// We inject the tree and pages here so that we can use them in the route\n// module.\n// INJECT:tree\n// INJECT:pages\n\nexport { tree, pages }\n\nimport GlobalError from 'VAR_MODULE_GLOBAL_ERROR' with { 'turbopack-transition': 'next-server-utility' }\n\nexport { GlobalError }\n\n// These are injected by the loader afterwards.\ndeclare const __next_app_require__: (id: string | number) => unknown\ndeclare const __next_app_load_chunk__: (id: string | number) => Promise<unknown>\n\n// INJECT:__next_app_require__\n// INJECT:__next_app_load_chunk__\n\nexport const __next_app__ = {\n require: __next_app_require__,\n loadChunk: __next_app_load_chunk__,\n}\n\nimport * as entryBase from '../../server/app-render/entry-base' with { 'turbopack-transition': 'next-server-utility' }\nimport { RedirectStatusCode } from '../../client/components/redirect-status-code'\n\nexport * from '../../server/app-render/entry-base' with { 'turbopack-transition': 'next-server-utility' }\n\n// Create and export the route module that will be consumed.\nexport const routeModule = new AppPageRouteModule({\n definition: {\n kind: RouteKind.APP_PAGE,\n page: 'VAR_DEFINITION_PAGE',\n pathname: 'VAR_DEFINITION_PATHNAME',\n // The following aren't used in production.\n bundlePath: '',\n filename: '',\n appPaths: [],\n },\n userland: {\n loaderTree: tree,\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n projectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n})\n\nexport async function handler(\n req: IncomingMessage,\n res: ServerResponse,\n ctx: {\n waitUntil: (prom: Promise<void>) => void\n }\n) {\n let srcPage = 'VAR_DEFINITION_PAGE'\n\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/'\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/'\n }\n const multiZoneDraftMode = process.env\n .__NEXT_MULTI_ZONE_DRAFT_MODE as any as boolean\n\n const initialPostponed = getRequestMeta(req, 'postponed')\n // TODO: replace with more specific flags\n const minimalMode = getRequestMeta(req, 'minimalMode')\n\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode,\n })\n\n if (!prepareResult) {\n res.statusCode = 400\n res.end('Bad Request')\n ctx.waitUntil?.(Promise.resolve())\n return null\n }\n\n const {\n buildId,\n query,\n params,\n parsedUrl,\n pageIsDynamic,\n buildManifest,\n nextFontManifest,\n reactLoadableManifest,\n serverActionsManifest,\n clientReferenceManifest,\n subresourceIntegrityManifest,\n prerenderManifest,\n isDraftMode,\n resolvedPathname,\n revalidateOnlyGenerated,\n routerServerContext,\n nextConfig,\n } = prepareResult\n\n const pathname = parsedUrl.pathname || '/'\n const normalizedSrcPage = normalizeAppPath(srcPage)\n\n let { isOnDemandRevalidate } = prepareResult\n\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage]\n const isPrerendered = prerenderManifest.routes[resolvedPathname]\n\n let isSSG = Boolean(\n prerenderInfo ||\n isPrerendered ||\n prerenderManifest.routes[normalizedSrcPage]\n )\n\n const userAgent = req.headers['user-agent'] || ''\n const botType = getBotType(userAgent)\n const isHtmlBot = isHtmlBotRequest(req)\n\n /**\n * If true, this indicates that the request being made is for an app\n * prefetch request.\n */\n const isPrefetchRSCRequest =\n getRequestMeta(req, 'isPrefetchRSCRequest') ??\n Boolean(req.headers[NEXT_ROUTER_PREFETCH_HEADER])\n\n // NOTE: Don't delete headers[RSC] yet, it still needs to be used in renderToHTML later\n\n const isRSCRequest =\n getRequestMeta(req, 'isRSCRequest') ?? Boolean(req.headers[RSC_HEADER])\n\n const isPossibleServerAction = getIsPossibleServerAction(req)\n\n /**\n * If the route being rendered is an app page, and the ppr feature has been\n * enabled, then the given route _could_ support PPR.\n */\n const couldSupportPPR: boolean = checkIsAppPPREnabled(\n nextConfig.experimental.ppr\n )\n\n // When enabled, this will allow the use of the `?__nextppronly` query to\n // enable debugging of the static shell.\n const hasDebugStaticShellQuery =\n process.env.__NEXT_EXPERIMENTAL_STATIC_SHELL_DEBUGGING === '1' &&\n typeof query.__nextppronly !== 'undefined' &&\n couldSupportPPR\n\n // When enabled, this will allow the use of the `?__nextppronly` query\n // to enable debugging of the fallback shell.\n const hasDebugFallbackShellQuery =\n hasDebugStaticShellQuery && query.__nextppronly === 'fallback'\n\n // This page supports PPR if it is marked as being `PARTIALLY_STATIC` in the\n // prerender manifest and this is an app page.\n const isRoutePPREnabled: boolean =\n couldSupportPPR &&\n ((\n prerenderManifest.routes[normalizedSrcPage] ??\n prerenderManifest.dynamicRoutes[normalizedSrcPage]\n )?.renderingMode === 'PARTIALLY_STATIC' ||\n // Ideally we'd want to check the appConfig to see if this page has PPR\n // enabled or not, but that would require plumbing the appConfig through\n // to the server during development. We assume that the page supports it\n // but only during development.\n (hasDebugStaticShellQuery &&\n (routeModule.isDev === true ||\n routerServerContext?.experimentalTestProxy === true)))\n\n const isDebugStaticShell: boolean =\n hasDebugStaticShellQuery && isRoutePPREnabled\n\n // We should enable debugging dynamic accesses when the static shell\n // debugging has been enabled and we're also in development mode.\n const isDebugDynamicAccesses =\n isDebugStaticShell && routeModule.isDev === true\n\n const isDebugFallbackShell = hasDebugFallbackShellQuery && isRoutePPREnabled\n\n // If we're in minimal mode, then try to get the postponed information from\n // the request metadata. If available, use it for resuming the postponed\n // render.\n const minimalPostponed = isRoutePPREnabled ? initialPostponed : undefined\n\n // If PPR is enabled, and this is a RSC request (but not a prefetch), then\n // we can use this fact to only generate the flight data for the request\n // because we can't cache the HTML (as it's also dynamic).\n const isDynamicRSCRequest =\n isRoutePPREnabled && isRSCRequest && !isPrefetchRSCRequest\n\n // Need to read this before it's stripped by stripFlightHeaders. We don't\n // need to transfer it to the request meta because it's only read\n // within this function; the static segment data should have already been\n // generated, so we will always either return a static response or a 404.\n const segmentPrefetchHeader = getRequestMeta(req, 'segmentPrefetchRSCRequest')\n\n // TODO: investigate existing bug with shouldServeStreamingMetadata always\n // being true for a revalidate due to modifying the base-server this.renderOpts\n // when fixing this to correct logic it causes hydration issue since we set\n // serveStreamingMetadata to true during export\n let serveStreamingMetadata = !userAgent\n ? true\n : shouldServeStreamingMetadata(userAgent, nextConfig.htmlLimitedBots)\n\n if (isHtmlBot && isRoutePPREnabled) {\n isSSG = false\n serveStreamingMetadata = false\n }\n\n // In development, we always want to generate dynamic HTML.\n let supportsDynamicResponse: boolean =\n // If we're in development, we always support dynamic HTML, unless it's\n // a data request, in which case we only produce static HTML.\n routeModule.isDev === true ||\n // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isSSG ||\n // If this request has provided postponed data, it supports dynamic\n // HTML.\n typeof initialPostponed === 'string' ||\n // If this is a dynamic RSC request, then this render supports dynamic\n // HTML (it's dynamic).\n isDynamicRSCRequest\n\n // When html bots request PPR page, perform the full dynamic rendering.\n const shouldWaitOnAllReady = isHtmlBot && isRoutePPREnabled\n\n let ssgCacheKey: string | null = null\n if (\n !isDraftMode &&\n isSSG &&\n !supportsDynamicResponse &&\n !isPossibleServerAction &&\n !minimalPostponed &&\n !isDynamicRSCRequest\n ) {\n ssgCacheKey = resolvedPathname\n }\n\n // the staticPathKey differs from ssgCacheKey since\n // ssgCacheKey is null in dev since we're always in \"dynamic\"\n // mode in dev to bypass the cache, but we still need to honor\n // dynamicParams = false in dev mode\n let staticPathKey = ssgCacheKey\n if (!staticPathKey && routeModule.isDev) {\n staticPathKey = resolvedPathname\n }\n\n const ComponentMod = {\n ...entryBase,\n tree,\n pages,\n GlobalError,\n handler,\n routeModule,\n __next_app__,\n }\n\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setReferenceManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest,\n serverModuleMap: createServerModuleMap({\n serverActionsManifest,\n }),\n })\n }\n\n const method = req.method || 'GET'\n const tracer = getTracer()\n const activeSpan = tracer.getActiveScopeSpan()\n\n try {\n const invokeRouteModule = async (\n span: Span | undefined,\n context: AppPageRouteHandlerContext\n ) => {\n const nextReq = new NodeNextRequest(req)\n const nextRes = new NodeNextResponse(res)\n\n // TODO: adapt for putting the RDC inside the postponed data\n // If we're in dev, and this isn't a prefetch or a server action,\n // we should seed the resume data cache.\n if (process.env.NODE_ENV === 'development') {\n if (\n nextConfig.experimental.dynamicIO &&\n !isPrefetchRSCRequest &&\n !context.renderOpts.isPossibleServerAction\n ) {\n const warmup = await routeModule.warmup(nextReq, nextRes, context)\n\n // If the warmup is successful, we should use the resume data\n // cache from the warmup.\n if (warmup.metadata.renderResumeDataCache) {\n context.renderOpts.renderResumeDataCache =\n warmup.metadata.renderResumeDataCache\n }\n }\n }\n\n return routeModule.render(nextReq, nextRes, context).finally(() => {\n if (!span) return\n\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false,\n })\n\n const rootSpanAttributes = tracer.getRootSpanAttributes()\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return\n }\n\n if (\n rootSpanAttributes.get('next.span_type') !==\n BaseServerSpan.handleRequest\n ) {\n console.warn(\n `Unexpected root span type '${rootSpanAttributes.get(\n 'next.span_type'\n )}'. Please report this Next.js issue https://github.com/vercel/next.js`\n )\n return\n }\n\n const route = rootSpanAttributes.get('next.route')\n if (route) {\n const name = `${method} ${route}`\n\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name,\n })\n span.updateName(name)\n } else {\n span.updateName(`${method} ${req.url}`)\n }\n })\n }\n\n const doRender = async ({\n span,\n postponed,\n fallbackRouteParams,\n }: {\n span?: Span\n /**\n * The postponed data for this render. This is only provided when resuming\n * a render that has been postponed.\n */\n postponed: string | undefined\n\n /**\n * The unknown route params for this render.\n */\n fallbackRouteParams: FallbackRouteParams | null\n }): Promise<ResponseCacheEntry> => {\n const context: AppPageRouteHandlerContext = {\n query,\n params,\n page: normalizedSrcPage,\n sharedContext: {\n buildId,\n },\n serverComponentsHmrCache: getRequestMeta(\n req,\n 'serverComponentsHmrCache'\n ),\n fallbackRouteParams,\n renderOpts: {\n App: () => null,\n Document: () => null,\n pageConfig: {},\n ComponentMod,\n Component: interopDefault(ComponentMod),\n\n params,\n routeModule,\n page: srcPage,\n postponed,\n shouldWaitOnAllReady,\n serveStreamingMetadata,\n supportsDynamicResponse:\n typeof postponed === 'string' || supportsDynamicResponse,\n buildManifest,\n nextFontManifest,\n reactLoadableManifest,\n subresourceIntegrityManifest,\n serverActionsManifest,\n clientReferenceManifest,\n setIsrStatus: routerServerContext?.setIsrStatus,\n\n dir: routeModule.projectDir,\n isDraftMode,\n isRevalidate: isSSG && !postponed && !isDynamicRSCRequest,\n botType,\n isOnDemandRevalidate,\n isPossibleServerAction,\n assetPrefix: nextConfig.assetPrefix,\n nextConfigOutput: nextConfig.output,\n crossOrigin: nextConfig.crossOrigin,\n trailingSlash: nextConfig.trailingSlash,\n previewProps: prerenderManifest.preview,\n deploymentId: nextConfig.deploymentId,\n enableTainting: nextConfig.experimental.taint,\n htmlLimitedBots: nextConfig.htmlLimitedBots,\n devtoolSegmentExplorer:\n nextConfig.experimental.devtoolSegmentExplorer,\n reactMaxHeadersLength: nextConfig.reactMaxHeadersLength,\n\n multiZoneDraftMode,\n incrementalCache: getRequestMeta(req, 'incrementalCache'),\n cacheLifeProfiles: nextConfig.experimental.cacheLife,\n basePath: nextConfig.basePath,\n serverActions: nextConfig.experimental.serverActions,\n\n ...(isDebugStaticShell || isDebugDynamicAccesses\n ? {\n nextExport: true,\n supportsDynamicResponse: false,\n isStaticGeneration: true,\n isRevalidate: true,\n isDebugDynamicAccesses: isDebugDynamicAccesses,\n }\n : {}),\n\n experimental: {\n isRoutePPREnabled,\n expireTime: nextConfig.expireTime,\n staleTimes: nextConfig.experimental.staleTimes,\n dynamicIO: Boolean(nextConfig.experimental.dynamicIO),\n clientSegmentCache: Boolean(\n nextConfig.experimental.clientSegmentCache\n ),\n dynamicOnHover: Boolean(nextConfig.experimental.dynamicOnHover),\n inlineCss: Boolean(nextConfig.experimental.inlineCss),\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts),\n clientTraceMetadata:\n nextConfig.experimental.clientTraceMetadata || ([] as any),\n },\n\n waitUntil: ctx.waitUntil,\n onClose: (cb) => {\n res.on('close', cb)\n },\n onAfterTaskError: () => {},\n\n onInstrumentationRequestError: (error, _request, errorContext) =>\n routeModule.onRequestError(\n req,\n error,\n errorContext,\n routerServerContext\n ),\n err: getRequestMeta(req, 'invokeError'),\n dev: routeModule.isDev,\n },\n }\n\n const result = await invokeRouteModule(span, context)\n\n const { metadata } = result\n\n const {\n cacheControl,\n headers = {},\n // Add any fetch tags that were on the page to the response headers.\n fetchTags: cacheTags,\n } = metadata\n\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags\n }\n\n // Pull any fetch metrics from the render onto the request.\n ;(req as any).fetchMetrics = metadata.fetchMetrics\n\n // we don't throw static to dynamic errors in dev as isSSG\n // is a best guess in dev since we don't have the prerender pass\n // to know whether the path is actually static or not\n if (\n isSSG &&\n cacheControl?.revalidate === 0 &&\n !routeModule.isDev &&\n !isRoutePPREnabled\n ) {\n const staticBailoutInfo = metadata.staticBailoutInfo\n\n const err = new Error(\n `Page changed from static to dynamic at runtime ${resolvedPathname}${\n staticBailoutInfo?.description\n ? `, reason: ${staticBailoutInfo.description}`\n : ``\n }` +\n `\\nsee more here https://nextjs.org/docs/messages/app-static-to-dynamic-error`\n )\n\n if (staticBailoutInfo?.stack) {\n const stack = staticBailoutInfo.stack\n err.stack = err.message + stack.substring(stack.indexOf('\\n'))\n }\n\n throw err\n }\n\n return {\n value: {\n kind: CachedRouteKind.APP_PAGE,\n html: result,\n headers,\n rscData: metadata.flightData,\n postponed: metadata.postponed,\n status: metadata.statusCode,\n segmentData: metadata.segmentData,\n } satisfies CachedAppPageValue,\n cacheControl,\n } satisfies ResponseCacheEntry\n }\n\n const responseGenerator: ResponseGenerator = async ({\n hasResolved,\n previousCacheEntry,\n isRevalidating,\n span,\n }) => {\n const isProduction = routeModule.isDev === false\n const didRespond = hasResolved || res.writableEnded\n\n // skip on-demand revalidate if cache is not present and\n // revalidate-if-generated is set\n if (\n isOnDemandRevalidate &&\n revalidateOnlyGenerated &&\n !previousCacheEntry &&\n !minimalMode\n ) {\n if (routerServerContext?.render404) {\n await routerServerContext.render404(req, res)\n } else {\n res.statusCode = 404\n res.end('This page could not be found')\n }\n return null\n }\n\n let fallbackMode: FallbackMode | undefined\n\n if (prerenderInfo) {\n fallbackMode = parseFallbackField(prerenderInfo.fallback)\n }\n\n // When serving a bot request, we want to serve a blocking render and not\n // the prerendered page. This ensures that the correct content is served\n // to the bot in the head.\n if (fallbackMode === FallbackMode.PRERENDER && isBot(userAgent)) {\n fallbackMode = FallbackMode.BLOCKING_STATIC_RENDER\n }\n\n if (previousCacheEntry?.isStale === -1) {\n isOnDemandRevalidate = true\n }\n\n // TODO: adapt for PPR\n // only allow on-demand revalidate for fallback: true/blocking\n // or for prerendered fallback: false paths\n if (\n isOnDemandRevalidate &&\n (fallbackMode !== FallbackMode.NOT_FOUND || previousCacheEntry)\n ) {\n fallbackMode = FallbackMode.BLOCKING_STATIC_RENDER\n }\n\n if (\n !minimalMode &&\n fallbackMode !== FallbackMode.BLOCKING_STATIC_RENDER &&\n staticPathKey &&\n !didRespond &&\n !isDraftMode &&\n pageIsDynamic &&\n (isProduction || !isPrerendered)\n ) {\n // if the page has dynamicParams: false and this pathname wasn't\n // prerendered trigger the no fallback handling\n if (\n // In development, fall through to render to handle missing\n // getStaticPaths.\n (isProduction || prerenderInfo) &&\n // When fallback isn't present, abort this render so we 404\n fallbackMode === FallbackMode.NOT_FOUND\n ) {\n throw new NoFallbackError()\n }\n\n let fallbackResponse: ResponseCacheEntry | null | undefined\n\n if (isRoutePPREnabled && !isRSCRequest) {\n // We use the response cache here to handle the revalidation and\n // management of the fallback shell.\n fallbackResponse = await routeModule.handleResponse({\n cacheKey: isProduction ? normalizedSrcPage : null,\n req,\n nextConfig,\n routeKind: RouteKind.APP_PAGE,\n isFallback: true,\n prerenderManifest,\n isRoutePPREnabled,\n responseGenerator: async () =>\n doRender({\n span,\n // We pass `undefined` as rendering a fallback isn't resumed\n // here.\n postponed: undefined,\n fallbackRouteParams:\n // If we're in production or we're debugging the fallback\n // shell then we should postpone when dynamic params are\n // accessed.\n isProduction || isDebugFallbackShell\n ? getFallbackRouteParams(normalizedSrcPage)\n : null,\n }),\n waitUntil: ctx.waitUntil,\n })\n\n // If the fallback response was set to null, then we should return null.\n if (fallbackResponse === null) return null\n\n // Otherwise, if we did get a fallback response, we should return it.\n if (fallbackResponse) {\n // Remove the cache control from the response to prevent it from being\n // used in the surrounding cache.\n delete fallbackResponse.cacheControl\n\n return fallbackResponse\n }\n }\n }\n // Only requests that aren't revalidating can be resumed. If we have the\n // minimal postponed data, then we should resume the render with it.\n const postponed =\n !isOnDemandRevalidate && !isRevalidating && minimalPostponed\n ? minimalPostponed\n : undefined\n\n // When we're in minimal mode, if we're trying to debug the static shell,\n // we should just return nothing instead of resuming the dynamic render.\n if (\n (isDebugStaticShell || isDebugDynamicAccesses) &&\n typeof postponed !== 'undefined'\n ) {\n return {\n cacheControl: { revalidate: 1, expire: undefined },\n value: {\n kind: CachedRouteKind.PAGES,\n html: RenderResult.fromStatic(''),\n pageData: {},\n headers: undefined,\n status: undefined,\n } satisfies CachedPageValue,\n }\n }\n\n // If this is a dynamic route with PPR enabled and the default route\n // matches were set, then we should pass the fallback route params to\n // the renderer as this is a fallback revalidation request.\n const fallbackRouteParams =\n pageIsDynamic &&\n isRoutePPREnabled &&\n (getRequestMeta(req, 'renderFallbackShell') || isDebugFallbackShell)\n ? getFallbackRouteParams(pathname)\n : null\n\n // Perform the render.\n return doRender({\n span,\n postponed,\n fallbackRouteParams,\n })\n }\n\n const handleResponse = async (span?: Span): Promise<null | void> => {\n const cacheEntry = await routeModule.handleResponse({\n cacheKey: ssgCacheKey,\n responseGenerator: (c) =>\n responseGenerator({\n span,\n ...c,\n }),\n routeKind: RouteKind.APP_PAGE,\n isOnDemandRevalidate,\n isRoutePPREnabled,\n req,\n nextConfig,\n prerenderManifest,\n waitUntil: ctx.waitUntil,\n })\n\n if (isDraftMode) {\n res.setHeader(\n 'Cache-Control',\n 'private, no-cache, no-store, max-age=0, must-revalidate'\n )\n }\n\n // In dev, we should not cache pages for any reason.\n if (routeModule.isDev) {\n res.setHeader('Cache-Control', 'no-store, must-revalidate')\n }\n\n if (!cacheEntry) {\n if (ssgCacheKey) {\n // A cache entry might not be generated if a response is written\n // in `getInitialProps` or `getServerSideProps`, but those shouldn't\n // have a cache key. If we do have a cache key but we don't end up\n // with a cache entry, then either Next.js or the application has a\n // bug that needs fixing.\n throw new Error('invariant: cache entry required but not generated')\n }\n return null\n }\n\n if (cacheEntry.value?.kind !== CachedRouteKind.APP_PAGE) {\n throw new Error(\n `Invariant app-page handler received invalid cache entry ${cacheEntry.value?.kind}`\n )\n }\n\n const didPostpone = typeof cacheEntry.value.postponed === 'string'\n\n if (\n isSSG &&\n // We don't want to send a cache header for requests that contain dynamic\n // data. If this is a Dynamic RSC request or wasn't a Prefetch RSC\n // request, then we should set the cache header.\n !isDynamicRSCRequest &&\n (!didPostpone || isPrefetchRSCRequest)\n ) {\n if (!minimalMode) {\n // set x-nextjs-cache header to match the header\n // we set for the image-optimizer\n res.setHeader(\n 'x-nextjs-cache',\n isOnDemandRevalidate\n ? 'REVALIDATED'\n : cacheEntry.isMiss\n ? 'MISS'\n : cacheEntry.isStale\n ? 'STALE'\n : 'HIT'\n )\n }\n // Set a header used by the client router to signal the response is static\n // and should respect the `static` cache staleTime value.\n res.setHeader(NEXT_IS_PRERENDER_HEADER, '1')\n }\n const { value: cachedData } = cacheEntry\n\n // Coerce the cache control parameter from the render.\n let cacheControl: CacheControl | undefined\n\n // If this is a resume request in minimal mode it is streamed with dynamic\n // content and should not be cached.\n if (minimalPostponed) {\n cacheControl = { revalidate: 0, expire: undefined }\n }\n\n // If this is in minimal mode and this is a flight request that isn't a\n // prefetch request while PPR is enabled, it cannot be cached as it contains\n // dynamic content.\n else if (\n minimalMode &&\n isRSCRequest &&\n !isPrefetchRSCRequest &&\n isRoutePPREnabled\n ) {\n cacheControl = { revalidate: 0, expire: undefined }\n } else if (!routeModule.isDev) {\n // If this is a preview mode request, we shouldn't cache it\n if (isDraftMode) {\n cacheControl = { revalidate: 0, expire: undefined }\n }\n\n // If this isn't SSG, then we should set change the header only if it is\n // not set already.\n else if (!isSSG) {\n if (!res.getHeader('Cache-Control')) {\n cacheControl = { revalidate: 0, expire: undefined }\n }\n } else if (cacheEntry.cacheControl) {\n // If the cache entry has a cache control with a revalidate value that's\n // a number, use it.\n if (typeof cacheEntry.cacheControl.revalidate === 'number') {\n if (cacheEntry.cacheControl.revalidate < 1) {\n throw new Error(\n `Invalid revalidate configuration provided: ${cacheEntry.cacheControl.revalidate} < 1`\n )\n }\n\n cacheControl = {\n revalidate: cacheEntry.cacheControl.revalidate,\n expire: cacheEntry.cacheControl?.expire ?? nextConfig.expireTime,\n }\n }\n // Otherwise if the revalidate value is false, then we should use the\n // cache time of one year.\n else {\n cacheControl = { revalidate: CACHE_ONE_YEAR, expire: undefined }\n }\n }\n }\n\n cacheEntry.cacheControl = cacheControl\n\n if (\n typeof segmentPrefetchHeader === 'string' &&\n cachedData?.kind === CachedRouteKind.APP_PAGE &&\n cachedData.segmentData\n ) {\n // This is a prefetch request issued by the client Segment Cache. These\n // should never reach the application layer (lambda). We should either\n // respond from the cache (HIT) or respond with 204 No Content (MISS).\n\n // Set a header to indicate that PPR is enabled for this route. This\n // lets the client distinguish between a regular cache miss and a cache\n // miss due to PPR being disabled. In other contexts this header is used\n // to indicate that the response contains dynamic data, but here we're\n // only using it to indicate that the feature is enabled — the segment\n // response itself contains whether the data is dynamic.\n res.setHeader(NEXT_DID_POSTPONE_HEADER, '2')\n\n // Add the cache tags header to the response if it exists and we're in\n // minimal mode while rendering a static page.\n const tags = cachedData.headers?.[NEXT_CACHE_TAGS_HEADER]\n if (minimalMode && isSSG && tags && typeof tags === 'string') {\n res.setHeader(NEXT_CACHE_TAGS_HEADER, tags)\n }\n\n const matchedSegment = cachedData.segmentData.get(segmentPrefetchHeader)\n if (matchedSegment !== undefined) {\n // Cache hit\n return sendRenderResult({\n req,\n res,\n type: 'rsc',\n generateEtags: nextConfig.generateEtags,\n poweredByHeader: nextConfig.poweredByHeader,\n result: RenderResult.fromStatic(matchedSegment),\n cacheControl: cacheEntry.cacheControl,\n })\n }\n\n // Cache miss. Either a cache entry for this route has not been generated\n // (which technically should not be possible when PPR is enabled, because\n // at a minimum there should always be a fallback entry) or there's no\n // match for the requested segment. Respond with a 204 No Content. We\n // don't bother to respond with 404, because these requests are only\n // issued as part of a prefetch.\n res.statusCode = 204\n return sendRenderResult({\n req,\n res,\n type: 'rsc',\n generateEtags: nextConfig.generateEtags,\n poweredByHeader: nextConfig.poweredByHeader,\n result: RenderResult.fromStatic(''),\n cacheControl: cacheEntry.cacheControl,\n })\n }\n\n // If there's a callback for `onCacheEntry`, call it with the cache entry\n // and the revalidate options.\n const onCacheEntry = getRequestMeta(req, 'onCacheEntry')\n if (onCacheEntry) {\n const finished = await onCacheEntry(\n {\n ...cacheEntry,\n // TODO: remove this when upstream doesn't\n // always expect this value to be \"PAGE\"\n value: {\n ...cacheEntry.value,\n kind: 'PAGE',\n },\n },\n {\n url: getRequestMeta(req, 'initURL'),\n }\n )\n if (finished) {\n // TODO: maybe we have to end the request?\n return null\n }\n }\n\n // If the request has a postponed state and it's a resume request we\n // should error.\n if (didPostpone && minimalPostponed) {\n throw new Error(\n 'Invariant: postponed state should not be present on a resume request'\n )\n }\n\n if (cachedData.headers) {\n const headers = { ...cachedData.headers }\n\n if (!minimalMode || !isSSG) {\n delete headers[NEXT_CACHE_TAGS_HEADER]\n }\n\n for (let [key, value] of Object.entries(headers)) {\n if (typeof value === 'undefined') continue\n\n if (Array.isArray(value)) {\n for (const v of value) {\n res.appendHeader(key, v)\n }\n } else if (typeof value === 'number') {\n value = value.toString()\n res.appendHeader(key, value)\n } else {\n res.appendHeader(key, value)\n }\n }\n }\n\n // Add the cache tags header to the response if it exists and we're in\n // minimal mode while rendering a static page.\n const tags = cachedData.headers?.[NEXT_CACHE_TAGS_HEADER]\n if (minimalMode && isSSG && tags && typeof tags === 'string') {\n res.setHeader(NEXT_CACHE_TAGS_HEADER, tags)\n }\n\n // If the request is a data request, then we shouldn't set the status code\n // from the response because it should always be 200. This should be gated\n // behind the experimental PPR flag.\n if (cachedData.status && (!isRSCRequest || !isRoutePPREnabled)) {\n res.statusCode = cachedData.status\n }\n\n // Redirect information is encoded in RSC payload, so we don't need to use redirect status codes\n if (\n !minimalMode &&\n cachedData.status &&\n RedirectStatusCode[cachedData.status] &&\n isRSCRequest\n ) {\n res.statusCode = 200\n }\n\n // Mark that the request did postpone.\n if (didPostpone) {\n res.setHeader(NEXT_DID_POSTPONE_HEADER, '1')\n }\n\n // we don't go through this block when preview mode is true\n // as preview mode is a dynamic request (bypasses cache) and doesn't\n // generate both HTML and payloads in the same request so continue to just\n // return the generated payload\n if (isRSCRequest && !isDraftMode) {\n // If this is a dynamic RSC request, then stream the response.\n if (typeof cachedData.rscData === 'undefined') {\n if (cachedData.postponed) {\n throw new Error('Invariant: Expected postponed to be undefined')\n }\n\n return sendRenderResult({\n req,\n res,\n type: 'rsc',\n generateEtags: nextConfig.generateEtags,\n poweredByHeader: nextConfig.poweredByHeader,\n result: cachedData.html,\n // Dynamic RSC responses cannot be cached, even if they're\n // configured with `force-static` because we have no way of\n // distinguishing between `force-static` and pages that have no\n // postponed state.\n // TODO: distinguish `force-static` from pages with no postponed state (static)\n cacheControl: isDynamicRSCRequest\n ? { revalidate: 0, expire: undefined }\n : cacheEntry.cacheControl,\n })\n }\n\n // As this isn't a prefetch request, we should serve the static flight\n // data.\n return sendRenderResult({\n req,\n res,\n type: 'rsc',\n generateEtags: nextConfig.generateEtags,\n poweredByHeader: nextConfig.poweredByHeader,\n result: RenderResult.fromStatic(cachedData.rscData),\n cacheControl: cacheEntry.cacheControl,\n })\n }\n\n // This is a request for HTML data.\n let body = cachedData.html\n\n // If there's no postponed state, we should just serve the HTML. This\n // should also be the case for a resume request because it's completed\n // as a server render (rather than a static render).\n if (!didPostpone || minimalMode) {\n return sendRenderResult({\n req,\n res,\n type: 'html',\n generateEtags: nextConfig.generateEtags,\n poweredByHeader: nextConfig.poweredByHeader,\n result: body,\n cacheControl: cacheEntry.cacheControl,\n })\n }\n\n // If we're debugging the static shell or the dynamic API accesses, we\n // should just serve the HTML without resuming the render. The returned\n // HTML will be the static shell so all the Dynamic API's will be used\n // during static generation.\n if (isDebugStaticShell || isDebugDynamicAccesses) {\n // Since we're not resuming the render, we need to at least add the\n // closing body and html tags to create valid HTML.\n body.chain(\n new ReadableStream({\n start(controller) {\n controller.enqueue(ENCODED_TAGS.CLOSED.BODY_AND_HTML)\n controller.close()\n },\n })\n )\n\n return sendRenderResult({\n req,\n res,\n type: 'html',\n generateEtags: nextConfig.generateEtags,\n poweredByHeader: nextConfig.poweredByHeader,\n result: body,\n cacheControl: { revalidate: 0, expire: undefined },\n })\n }\n\n // This request has postponed, so let's create a new transformer that the\n // dynamic data can pipe to that will attach the dynamic data to the end\n // of the response.\n const transformer = new TransformStream<Uint8Array, Uint8Array>()\n body.chain(transformer.readable)\n\n // Perform the render again, but this time, provide the postponed state.\n // We don't await because we want the result to start streaming now, and\n // we've already chained the transformer's readable to the render result.\n doRender({\n span,\n postponed: cachedData.postponed,\n // This is a resume render, not a fallback render, so we don't need to\n // set this.\n fallbackRouteParams: null,\n })\n .then(async (result) => {\n if (!result) {\n throw new Error('Invariant: expected a result to be returned')\n }\n\n if (result.value?.kind !== CachedRouteKind.APP_PAGE) {\n throw new Error(\n `Invariant: expected a page response, got ${result.value?.kind}`\n )\n }\n\n // Pipe the resume result to the transformer.\n await result.value.html.pipeTo(transformer.writable)\n })\n .catch((err) => {\n // An error occurred during piping or preparing the render, abort\n // the transformers writer so we can terminate the stream.\n transformer.writable.abort(err).catch((e) => {\n console.error(\"couldn't abort transformer\", e)\n })\n })\n\n return sendRenderResult({\n req,\n res,\n type: 'html',\n generateEtags: nextConfig.generateEtags,\n poweredByHeader: nextConfig.poweredByHeader,\n result: body,\n // We don't want to cache the response if it has postponed data because\n // the response being sent to the client it's dynamic parts are streamed\n // to the client on the same request.\n cacheControl: { revalidate: 0, expire: undefined },\n })\n }\n\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (activeSpan) {\n await handleResponse(activeSpan)\n } else {\n return await tracer.withPropagatedContext(req.headers, () =>\n tracer.trace(\n BaseServerSpan.handleRequest,\n {\n spanName: `${method} ${req.url}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url,\n },\n },\n handleResponse\n )\n )\n }\n } catch (err) {\n // if we aren't wrapped by base-server handle here\n if (!activeSpan) {\n await routeModule.onRequestError(\n req,\n err,\n {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'render',\n revalidateReason: getRevalidateReason({\n isRevalidate: isSSG,\n isOnDemandRevalidate,\n }),\n },\n routerServerContext\n )\n }\n\n // rethrow so that we can handle serving error page\n throw err\n }\n}\n"],"names":["GlobalError","__next_app__","handler","pages","routeModule","tree","require","__next_app_require__","loadChunk","__next_app_load_chunk__","AppPageRouteModule","definition","kind","RouteKind","APP_PAGE","page","pathname","bundlePath","filename","appPaths","userland","loaderTree","distDir","process","env","__NEXT_RELATIVE_DIST_DIR","projectDir","__NEXT_RELATIVE_PROJECT_DIR","req","res","ctx","prerenderManifest","srcPage","TURBOPACK","replace","multiZoneDraftMode","__NEXT_MULTI_ZONE_DRAFT_MODE","initialPostponed","getRequestMeta","minimalMode","prepareResult","prepare","statusCode","end","waitUntil","Promise","resolve","buildId","query","params","parsedUrl","pageIsDynamic","buildManifest","nextFontManifest","reactLoadableManifest","serverActionsManifest","clientReferenceManifest","subresourceIntegrityManifest","isDraftMode","resolvedPathname","revalidateOnlyGenerated","routerServerContext","nextConfig","normalizedSrcPage","normalizeAppPath","isOnDemandRevalidate","prerenderInfo","dynamicRoutes","isPrerendered","routes","isSSG","Boolean","userAgent","headers","botType","getBotType","isHtmlBot","isHtmlBotRequest","isPrefetchRSCRequest","NEXT_ROUTER_PREFETCH_HEADER","isRSCRequest","RSC_HEADER","isPossibleServerAction","getIsPossibleServerAction","couldSupportPPR","checkIsAppPPREnabled","experimental","ppr","hasDebugStaticShellQuery","__NEXT_EXPERIMENTAL_STATIC_SHELL_DEBUGGING","__nextppronly","hasDebugFallbackShellQuery","isRoutePPREnabled","renderingMode","isDev","experimentalTestProxy","isDebugStaticShell","isDebugDynamicAccesses","isDebugFallbackShell","minimalPostponed","undefined","isDynamicRSCRequest","segmentPrefetchHeader","serveStreamingMetadata","shouldServeStreamingMetadata","htmlLimitedBots","supportsDynamicResponse","shouldWaitOnAllReady","ssgCacheKey","staticPathKey","ComponentMod","entryBase","setReferenceManifestsSingleton","serverModuleMap","createServerModuleMap","method","tracer","getTracer","activeSpan","getActiveScopeSpan","invokeRouteModule","span","context","nextReq","NodeNextRequest","nextRes","NodeNextResponse","NODE_ENV","dynamicIO","renderOpts","warmup","metadata","renderResumeDataCache","render","finally","setAttributes","rootSpanAttributes","getRootSpanAttributes","get","BaseServerSpan","handleRequest","console","warn","route","name","updateName","url","doRender","postponed","fallbackRouteParams","sharedContext","serverComponentsHmrCache","App","Document","pageConfig","Component","interopDefault","setIsrStatus","dir","isRevalidate","assetPrefix","nextConfigOutput","output","crossOrigin","trailingSlash","previewProps","preview","deploymentId","enableTainting","taint","devtoolSegmentExplorer","reactMaxHeadersLength","incrementalCache","cacheLifeProfiles","cacheLife","basePath","serverActions","nextExport","isStaticGeneration","expireTime","staleTimes","clientSegmentCache","dynamicOnHover","inlineCss","authInterrupts","clientTraceMetadata","onClose","cb","on","onAfterTaskError","onInstrumentationRequestError","error","_request","errorContext","onRequestError","err","dev","result","cacheControl","fetchTags","cacheTags","NEXT_CACHE_TAGS_HEADER","fetchMetrics","revalidate","staticBailoutInfo","Error","description","stack","message","substring","indexOf","value","CachedRouteKind","html","rscData","flightData","status","segmentData","responseGenerator","hasResolved","previousCacheEntry","isRevalidating","isProduction","didRespond","writableEnded","render404","fallbackMode","parseFallbackField","fallback","FallbackMode","PRERENDER","isBot","BLOCKING_STATIC_RENDER","isStale","NOT_FOUND","NoFallbackError","fallbackResponse","handleResponse","cacheKey","routeKind","isFallback","getFallbackRouteParams","expire","PAGES","RenderResult","fromStatic","pageData","cacheEntry","cachedData","c","setHeader","didPostpone","isMiss","NEXT_IS_PRERENDER_HEADER","getHeader","CACHE_ONE_YEAR","NEXT_DID_POSTPONE_HEADER","tags","matchedSegment","sendRenderResult","type","generateEtags","poweredByHeader","onCacheEntry","finished","key","Object","entries","Array","isArray","v","appendHeader","toString","RedirectStatusCode","body","chain","ReadableStream","start","controller","enqueue","ENCODED_TAGS","CLOSED","BODY_AND_HTML","close","transformer","TransformStream","readable","then","pipeTo","writable","catch","abort","e","withPropagatedContext","trace","spanName","SpanKind","SERVER","attributes","routerKind","routePath","routeType","revalidateReason","getRevalidateReason"],"mappings":";;;;;;;;;;;;;;;;;;;IAqESA,WAAW;eAAXA,gCAAW;;IASPC,YAAY;eAAZA;;IA4BSC,OAAO;eAAPA;;IAzCPC,KAAK;eAALA;;IAwBFC,WAAW;eAAXA;;IAxBJC,IAAI;eAAJA;;;;gCA3DF;2BAEmB;uBAEU;wBACW;6BAChB;2BACA;gCACA;sBACmB;qBACb;gCAI9B;iCACwC;mCAIxC;6BAC+B;0BACL;yCACS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;oBACpChJ,cAAczF;oBACdL;gBACF;YACF,GACAJ;QAEJ;QAEA,mDAAmD;QACnD,MAAMsI;IACR;AACF","ignoreList":[0]}
|
1
|
+
{"version":3,"sources":["../../../src/build/templates/app-page.ts"],"sourcesContent":["import type { LoaderTree } from '../../server/lib/app-dir-module'\nimport type { IncomingMessage, ServerResponse } from 'node:http'\n\nimport {\n AppPageRouteModule,\n type AppPageRouteHandlerContext,\n} from '../../server/route-modules/app-page/module.compiled' with { 'turbopack-transition': 'next-ssr' }\n\nimport { RouteKind } from '../../server/route-kind' with { 'turbopack-transition': 'next-server-utility' }\n\nimport { getRevalidateReason } from '../../server/instrumentation/utils'\nimport { getTracer, SpanKind, type Span } from '../../server/lib/trace/tracer'\nimport { getRequestMeta } from '../../server/request-meta'\nimport { BaseServerSpan } from '../../server/lib/trace/constants'\nimport { interopDefault } from '../../server/app-render/interop-default'\nimport { NodeNextRequest, NodeNextResponse } from '../../server/base-http/node'\nimport { checkIsAppPPREnabled } from '../../server/lib/experimental/ppr'\nimport {\n getFallbackRouteParams,\n type FallbackRouteParams,\n} from '../../server/request/fallback-params'\nimport { setReferenceManifestsSingleton } from '../../server/app-render/encryption-utils'\nimport {\n isHtmlBotRequest,\n shouldServeStreamingMetadata,\n} from '../../server/lib/streaming-metadata'\nimport { createServerModuleMap } from '../../server/app-render/action-utils'\nimport { normalizeAppPath } from '../../shared/lib/router/utils/app-paths'\nimport { getIsPossibleServerAction } from '../../server/lib/server-action-request-meta'\nimport {\n RSC_HEADER,\n NEXT_ROUTER_PREFETCH_HEADER,\n NEXT_IS_PRERENDER_HEADER,\n NEXT_DID_POSTPONE_HEADER,\n} from '../../client/components/app-router-headers'\nimport { getBotType, isBot } from '../../shared/lib/router/utils/is-bot'\nimport {\n CachedRouteKind,\n type CachedAppPageValue,\n type CachedPageValue,\n type ResponseCacheEntry,\n type ResponseGenerator,\n} from '../../server/response-cache'\nimport { FallbackMode, parseFallbackField } from '../../lib/fallback'\nimport RenderResult from '../../server/render-result'\nimport { CACHE_ONE_YEAR, NEXT_CACHE_TAGS_HEADER } from '../../lib/constants'\nimport type { CacheControl } from '../../server/lib/cache-control'\nimport { ENCODED_TAGS } from '../../server/stream-utils/encoded-tags'\nimport { sendRenderResult } from '../../server/send-payload'\nimport { NoFallbackError } from '../../shared/lib/no-fallback-error.external'\n\n// These are injected by the loader afterwards.\n\n/**\n * The tree created in next-app-loader that holds component segments and modules\n * and I've updated it.\n */\ndeclare const tree: LoaderTree\ndeclare const pages: any\n\n// We inject the tree and pages here so that we can use them in the route\n// module.\n// INJECT:tree\n// INJECT:pages\n\nexport { tree, pages }\n\nimport GlobalError from 'VAR_MODULE_GLOBAL_ERROR' with { 'turbopack-transition': 'next-server-utility' }\n\nexport { GlobalError }\n\n// These are injected by the loader afterwards.\ndeclare const __next_app_require__: (id: string | number) => unknown\ndeclare const __next_app_load_chunk__: (id: string | number) => Promise<unknown>\n\n// INJECT:__next_app_require__\n// INJECT:__next_app_load_chunk__\n\nexport const __next_app__ = {\n require: __next_app_require__,\n loadChunk: __next_app_load_chunk__,\n}\n\nimport * as entryBase from '../../server/app-render/entry-base' with { 'turbopack-transition': 'next-server-utility' }\nimport { RedirectStatusCode } from '../../client/components/redirect-status-code'\n\nexport * from '../../server/app-render/entry-base' with { 'turbopack-transition': 'next-server-utility' }\n\n// Create and export the route module that will be consumed.\nexport const routeModule = new AppPageRouteModule({\n definition: {\n kind: RouteKind.APP_PAGE,\n page: 'VAR_DEFINITION_PAGE',\n pathname: 'VAR_DEFINITION_PATHNAME',\n // The following aren't used in production.\n bundlePath: '',\n filename: '',\n appPaths: [],\n },\n userland: {\n loaderTree: tree,\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n projectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n})\n\nexport async function handler(\n req: IncomingMessage,\n res: ServerResponse,\n ctx: {\n waitUntil: (prom: Promise<void>) => void\n }\n) {\n let srcPage = 'VAR_DEFINITION_PAGE'\n\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/'\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/'\n }\n const multiZoneDraftMode = process.env\n .__NEXT_MULTI_ZONE_DRAFT_MODE as any as boolean\n\n const initialPostponed = getRequestMeta(req, 'postponed')\n // TODO: replace with more specific flags\n const minimalMode = getRequestMeta(req, 'minimalMode')\n\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode,\n })\n\n if (!prepareResult) {\n res.statusCode = 400\n res.end('Bad Request')\n ctx.waitUntil?.(Promise.resolve())\n return null\n }\n\n const {\n buildId,\n query,\n params,\n parsedUrl,\n pageIsDynamic,\n buildManifest,\n nextFontManifest,\n reactLoadableManifest,\n serverActionsManifest,\n clientReferenceManifest,\n subresourceIntegrityManifest,\n prerenderManifest,\n isDraftMode,\n resolvedPathname,\n revalidateOnlyGenerated,\n routerServerContext,\n nextConfig,\n } = prepareResult\n\n const pathname = parsedUrl.pathname || '/'\n const normalizedSrcPage = normalizeAppPath(srcPage)\n\n let { isOnDemandRevalidate } = prepareResult\n\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage]\n const isPrerendered = prerenderManifest.routes[resolvedPathname]\n\n let isSSG = Boolean(\n prerenderInfo ||\n isPrerendered ||\n prerenderManifest.routes[normalizedSrcPage]\n )\n\n const userAgent = req.headers['user-agent'] || ''\n const botType = getBotType(userAgent)\n const isHtmlBot = isHtmlBotRequest(req)\n\n /**\n * If true, this indicates that the request being made is for an app\n * prefetch request.\n */\n const isPrefetchRSCRequest =\n getRequestMeta(req, 'isPrefetchRSCRequest') ??\n Boolean(req.headers[NEXT_ROUTER_PREFETCH_HEADER])\n\n // NOTE: Don't delete headers[RSC] yet, it still needs to be used in renderToHTML later\n\n const isRSCRequest =\n getRequestMeta(req, 'isRSCRequest') ?? Boolean(req.headers[RSC_HEADER])\n\n const isPossibleServerAction = getIsPossibleServerAction(req)\n\n /**\n * If the route being rendered is an app page, and the ppr feature has been\n * enabled, then the given route _could_ support PPR.\n */\n const couldSupportPPR: boolean = checkIsAppPPREnabled(\n nextConfig.experimental.ppr\n )\n\n // When enabled, this will allow the use of the `?__nextppronly` query to\n // enable debugging of the static shell.\n const hasDebugStaticShellQuery =\n process.env.__NEXT_EXPERIMENTAL_STATIC_SHELL_DEBUGGING === '1' &&\n typeof query.__nextppronly !== 'undefined' &&\n couldSupportPPR\n\n // When enabled, this will allow the use of the `?__nextppronly` query\n // to enable debugging of the fallback shell.\n const hasDebugFallbackShellQuery =\n hasDebugStaticShellQuery && query.__nextppronly === 'fallback'\n\n // This page supports PPR if it is marked as being `PARTIALLY_STATIC` in the\n // prerender manifest and this is an app page.\n const isRoutePPREnabled: boolean =\n couldSupportPPR &&\n ((\n prerenderManifest.routes[normalizedSrcPage] ??\n prerenderManifest.dynamicRoutes[normalizedSrcPage]\n )?.renderingMode === 'PARTIALLY_STATIC' ||\n // Ideally we'd want to check the appConfig to see if this page has PPR\n // enabled or not, but that would require plumbing the appConfig through\n // to the server during development. We assume that the page supports it\n // but only during development.\n (hasDebugStaticShellQuery &&\n (routeModule.isDev === true ||\n routerServerContext?.experimentalTestProxy === true)))\n\n const isDebugStaticShell: boolean =\n hasDebugStaticShellQuery && isRoutePPREnabled\n\n // We should enable debugging dynamic accesses when the static shell\n // debugging has been enabled and we're also in development mode.\n const isDebugDynamicAccesses =\n isDebugStaticShell && routeModule.isDev === true\n\n const isDebugFallbackShell = hasDebugFallbackShellQuery && isRoutePPREnabled\n\n // If we're in minimal mode, then try to get the postponed information from\n // the request metadata. If available, use it for resuming the postponed\n // render.\n const minimalPostponed = isRoutePPREnabled ? initialPostponed : undefined\n\n // If PPR is enabled, and this is a RSC request (but not a prefetch), then\n // we can use this fact to only generate the flight data for the request\n // because we can't cache the HTML (as it's also dynamic).\n const isDynamicRSCRequest =\n isRoutePPREnabled && isRSCRequest && !isPrefetchRSCRequest\n\n // Need to read this before it's stripped by stripFlightHeaders. We don't\n // need to transfer it to the request meta because it's only read\n // within this function; the static segment data should have already been\n // generated, so we will always either return a static response or a 404.\n const segmentPrefetchHeader = getRequestMeta(req, 'segmentPrefetchRSCRequest')\n\n // TODO: investigate existing bug with shouldServeStreamingMetadata always\n // being true for a revalidate due to modifying the base-server this.renderOpts\n // when fixing this to correct logic it causes hydration issue since we set\n // serveStreamingMetadata to true during export\n let serveStreamingMetadata = !userAgent\n ? true\n : shouldServeStreamingMetadata(userAgent, nextConfig.htmlLimitedBots)\n\n if (isHtmlBot && isRoutePPREnabled) {\n isSSG = false\n serveStreamingMetadata = false\n }\n\n // In development, we always want to generate dynamic HTML.\n let supportsDynamicResponse: boolean =\n // If we're in development, we always support dynamic HTML, unless it's\n // a data request, in which case we only produce static HTML.\n routeModule.isDev === true ||\n // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isSSG ||\n // If this request has provided postponed data, it supports dynamic\n // HTML.\n typeof initialPostponed === 'string' ||\n // If this is a dynamic RSC request, then this render supports dynamic\n // HTML (it's dynamic).\n isDynamicRSCRequest\n\n // When html bots request PPR page, perform the full dynamic rendering.\n const shouldWaitOnAllReady = isHtmlBot && isRoutePPREnabled\n\n let ssgCacheKey: string | null = null\n if (\n !isDraftMode &&\n isSSG &&\n !supportsDynamicResponse &&\n !isPossibleServerAction &&\n !minimalPostponed &&\n !isDynamicRSCRequest\n ) {\n ssgCacheKey = resolvedPathname\n }\n\n // the staticPathKey differs from ssgCacheKey since\n // ssgCacheKey is null in dev since we're always in \"dynamic\"\n // mode in dev to bypass the cache, but we still need to honor\n // dynamicParams = false in dev mode\n let staticPathKey = ssgCacheKey\n if (!staticPathKey && routeModule.isDev) {\n staticPathKey = resolvedPathname\n }\n\n const ComponentMod = {\n ...entryBase,\n tree,\n pages,\n GlobalError,\n handler,\n routeModule,\n __next_app__,\n }\n\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setReferenceManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest,\n serverModuleMap: createServerModuleMap({\n serverActionsManifest,\n }),\n })\n }\n\n const method = req.method || 'GET'\n const tracer = getTracer()\n const activeSpan = tracer.getActiveScopeSpan()\n\n try {\n const invokeRouteModule = async (\n span: Span | undefined,\n context: AppPageRouteHandlerContext\n ) => {\n const nextReq = new NodeNextRequest(req)\n const nextRes = new NodeNextResponse(res)\n\n // TODO: adapt for putting the RDC inside the postponed data\n // If we're in dev, and this isn't a prefetch or a server action,\n // we should seed the resume data cache.\n if (process.env.NODE_ENV === 'development') {\n if (\n nextConfig.experimental.dynamicIO &&\n !isPrefetchRSCRequest &&\n !context.renderOpts.isPossibleServerAction\n ) {\n const warmup = await routeModule.warmup(nextReq, nextRes, context)\n\n // If the warmup is successful, we should use the resume data\n // cache from the warmup.\n if (warmup.metadata.renderResumeDataCache) {\n context.renderOpts.renderResumeDataCache =\n warmup.metadata.renderResumeDataCache\n }\n }\n }\n\n return routeModule.render(nextReq, nextRes, context).finally(() => {\n if (!span) return\n\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false,\n })\n\n const rootSpanAttributes = tracer.getRootSpanAttributes()\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return\n }\n\n if (\n rootSpanAttributes.get('next.span_type') !==\n BaseServerSpan.handleRequest\n ) {\n console.warn(\n `Unexpected root span type '${rootSpanAttributes.get(\n 'next.span_type'\n )}'. Please report this Next.js issue https://github.com/vercel/next.js`\n )\n return\n }\n\n const route = rootSpanAttributes.get('next.route')\n if (route) {\n const name = `${method} ${route}`\n\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name,\n })\n span.updateName(name)\n } else {\n span.updateName(`${method} ${req.url}`)\n }\n })\n }\n\n const doRender = async ({\n span,\n postponed,\n fallbackRouteParams,\n }: {\n span?: Span\n /**\n * The postponed data for this render. This is only provided when resuming\n * a render that has been postponed.\n */\n postponed: string | undefined\n\n /**\n * The unknown route params for this render.\n */\n fallbackRouteParams: FallbackRouteParams | null\n }): Promise<ResponseCacheEntry> => {\n const context: AppPageRouteHandlerContext = {\n query,\n params,\n page: normalizedSrcPage,\n sharedContext: {\n buildId,\n },\n serverComponentsHmrCache: getRequestMeta(\n req,\n 'serverComponentsHmrCache'\n ),\n fallbackRouteParams,\n renderOpts: {\n App: () => null,\n Document: () => null,\n pageConfig: {},\n ComponentMod,\n Component: interopDefault(ComponentMod),\n\n params,\n routeModule,\n page: srcPage,\n postponed,\n shouldWaitOnAllReady,\n serveStreamingMetadata,\n supportsDynamicResponse:\n typeof postponed === 'string' || supportsDynamicResponse,\n buildManifest,\n nextFontManifest,\n reactLoadableManifest,\n subresourceIntegrityManifest,\n serverActionsManifest,\n clientReferenceManifest,\n setIsrStatus: routerServerContext?.setIsrStatus,\n\n dir: routeModule.projectDir,\n isDraftMode,\n isRevalidate: isSSG && !postponed && !isDynamicRSCRequest,\n botType,\n isOnDemandRevalidate,\n isPossibleServerAction,\n assetPrefix: nextConfig.assetPrefix,\n nextConfigOutput: nextConfig.output,\n crossOrigin: nextConfig.crossOrigin,\n trailingSlash: nextConfig.trailingSlash,\n previewProps: prerenderManifest.preview,\n deploymentId: nextConfig.deploymentId,\n enableTainting: nextConfig.experimental.taint,\n htmlLimitedBots: nextConfig.htmlLimitedBots,\n devtoolSegmentExplorer:\n nextConfig.experimental.devtoolSegmentExplorer,\n reactMaxHeadersLength: nextConfig.reactMaxHeadersLength,\n\n multiZoneDraftMode,\n incrementalCache: getRequestMeta(req, 'incrementalCache'),\n cacheLifeProfiles: nextConfig.experimental.cacheLife,\n basePath: nextConfig.basePath,\n serverActions: nextConfig.experimental.serverActions,\n\n ...(isDebugStaticShell || isDebugDynamicAccesses\n ? {\n nextExport: true,\n supportsDynamicResponse: false,\n isStaticGeneration: true,\n isRevalidate: true,\n isDebugDynamicAccesses: isDebugDynamicAccesses,\n }\n : {}),\n\n experimental: {\n isRoutePPREnabled,\n expireTime: nextConfig.expireTime,\n staleTimes: nextConfig.experimental.staleTimes,\n dynamicIO: Boolean(nextConfig.experimental.dynamicIO),\n clientSegmentCache: Boolean(\n nextConfig.experimental.clientSegmentCache\n ),\n dynamicOnHover: Boolean(nextConfig.experimental.dynamicOnHover),\n inlineCss: Boolean(nextConfig.experimental.inlineCss),\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts),\n clientTraceMetadata:\n nextConfig.experimental.clientTraceMetadata || ([] as any),\n },\n\n waitUntil: ctx.waitUntil,\n onClose: (cb) => {\n res.on('close', cb)\n },\n onAfterTaskError: () => {},\n\n onInstrumentationRequestError: (error, _request, errorContext) =>\n routeModule.onRequestError(\n req,\n error,\n errorContext,\n routerServerContext\n ),\n err: getRequestMeta(req, 'invokeError'),\n dev: routeModule.isDev,\n },\n }\n\n const result = await invokeRouteModule(span, context)\n\n const { metadata } = result\n\n const {\n cacheControl,\n headers = {},\n // Add any fetch tags that were on the page to the response headers.\n fetchTags: cacheTags,\n } = metadata\n\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags\n }\n\n // Pull any fetch metrics from the render onto the request.\n ;(req as any).fetchMetrics = metadata.fetchMetrics\n\n // we don't throw static to dynamic errors in dev as isSSG\n // is a best guess in dev since we don't have the prerender pass\n // to know whether the path is actually static or not\n if (\n isSSG &&\n cacheControl?.revalidate === 0 &&\n !routeModule.isDev &&\n !isRoutePPREnabled\n ) {\n const staticBailoutInfo = metadata.staticBailoutInfo\n\n const err = new Error(\n `Page changed from static to dynamic at runtime ${resolvedPathname}${\n staticBailoutInfo?.description\n ? `, reason: ${staticBailoutInfo.description}`\n : ``\n }` +\n `\\nsee more here https://nextjs.org/docs/messages/app-static-to-dynamic-error`\n )\n\n if (staticBailoutInfo?.stack) {\n const stack = staticBailoutInfo.stack\n err.stack = err.message + stack.substring(stack.indexOf('\\n'))\n }\n\n throw err\n }\n\n return {\n value: {\n kind: CachedRouteKind.APP_PAGE,\n html: result,\n headers,\n rscData: metadata.flightData,\n postponed: metadata.postponed,\n status: metadata.statusCode,\n segmentData: metadata.segmentData,\n } satisfies CachedAppPageValue,\n cacheControl,\n } satisfies ResponseCacheEntry\n }\n\n const responseGenerator: ResponseGenerator = async ({\n hasResolved,\n previousCacheEntry,\n isRevalidating,\n span,\n }) => {\n const isProduction = routeModule.isDev === false\n const didRespond = hasResolved || res.writableEnded\n\n // skip on-demand revalidate if cache is not present and\n // revalidate-if-generated is set\n if (\n isOnDemandRevalidate &&\n revalidateOnlyGenerated &&\n !previousCacheEntry &&\n !minimalMode\n ) {\n if (routerServerContext?.render404) {\n await routerServerContext.render404(req, res)\n } else {\n res.statusCode = 404\n res.end('This page could not be found')\n }\n return null\n }\n\n let fallbackMode: FallbackMode | undefined\n\n if (prerenderInfo) {\n fallbackMode = parseFallbackField(prerenderInfo.fallback)\n }\n\n // When serving a bot request, we want to serve a blocking render and not\n // the prerendered page. This ensures that the correct content is served\n // to the bot in the head.\n if (fallbackMode === FallbackMode.PRERENDER && isBot(userAgent)) {\n fallbackMode = FallbackMode.BLOCKING_STATIC_RENDER\n }\n\n if (previousCacheEntry?.isStale === -1) {\n isOnDemandRevalidate = true\n }\n\n // TODO: adapt for PPR\n // only allow on-demand revalidate for fallback: true/blocking\n // or for prerendered fallback: false paths\n if (\n isOnDemandRevalidate &&\n (fallbackMode !== FallbackMode.NOT_FOUND || previousCacheEntry)\n ) {\n fallbackMode = FallbackMode.BLOCKING_STATIC_RENDER\n }\n\n if (\n !minimalMode &&\n fallbackMode !== FallbackMode.BLOCKING_STATIC_RENDER &&\n staticPathKey &&\n !didRespond &&\n !isDraftMode &&\n pageIsDynamic &&\n (isProduction || !isPrerendered)\n ) {\n // if the page has dynamicParams: false and this pathname wasn't\n // prerendered trigger the no fallback handling\n if (\n // In development, fall through to render to handle missing\n // getStaticPaths.\n (isProduction || prerenderInfo) &&\n // When fallback isn't present, abort this render so we 404\n fallbackMode === FallbackMode.NOT_FOUND\n ) {\n throw new NoFallbackError()\n }\n\n let fallbackResponse: ResponseCacheEntry | null | undefined\n\n if (isRoutePPREnabled && !isRSCRequest) {\n // We use the response cache here to handle the revalidation and\n // management of the fallback shell.\n fallbackResponse = await routeModule.handleResponse({\n cacheKey: isProduction ? normalizedSrcPage : null,\n req,\n nextConfig,\n routeKind: RouteKind.APP_PAGE,\n isFallback: true,\n prerenderManifest,\n isRoutePPREnabled,\n responseGenerator: async () =>\n doRender({\n span,\n // We pass `undefined` as rendering a fallback isn't resumed\n // here.\n postponed: undefined,\n fallbackRouteParams:\n // If we're in production or we're debugging the fallback\n // shell then we should postpone when dynamic params are\n // accessed.\n isProduction || isDebugFallbackShell\n ? getFallbackRouteParams(normalizedSrcPage)\n : null,\n }),\n waitUntil: ctx.waitUntil,\n })\n\n // If the fallback response was set to null, then we should return null.\n if (fallbackResponse === null) return null\n\n // Otherwise, if we did get a fallback response, we should return it.\n if (fallbackResponse) {\n // Remove the cache control from the response to prevent it from being\n // used in the surrounding cache.\n delete fallbackResponse.cacheControl\n\n return fallbackResponse\n }\n }\n }\n // Only requests that aren't revalidating can be resumed. If we have the\n // minimal postponed data, then we should resume the render with it.\n const postponed =\n !isOnDemandRevalidate && !isRevalidating && minimalPostponed\n ? minimalPostponed\n : undefined\n\n // When we're in minimal mode, if we're trying to debug the static shell,\n // we should just return nothing instead of resuming the dynamic render.\n if (\n (isDebugStaticShell || isDebugDynamicAccesses) &&\n typeof postponed !== 'undefined'\n ) {\n return {\n cacheControl: { revalidate: 1, expire: undefined },\n value: {\n kind: CachedRouteKind.PAGES,\n html: RenderResult.fromStatic(''),\n pageData: {},\n headers: undefined,\n status: undefined,\n } satisfies CachedPageValue,\n }\n }\n\n // If this is a dynamic route with PPR enabled and the default route\n // matches were set, then we should pass the fallback route params to\n // the renderer as this is a fallback revalidation request.\n const fallbackRouteParams =\n pageIsDynamic &&\n isRoutePPREnabled &&\n (getRequestMeta(req, 'renderFallbackShell') || isDebugFallbackShell)\n ? getFallbackRouteParams(pathname)\n : null\n\n // Perform the render.\n return doRender({\n span,\n postponed,\n fallbackRouteParams,\n })\n }\n\n const handleResponse = async (span?: Span): Promise<null | void> => {\n const cacheEntry = await routeModule.handleResponse({\n cacheKey: ssgCacheKey,\n responseGenerator: (c) =>\n responseGenerator({\n span,\n ...c,\n }),\n routeKind: RouteKind.APP_PAGE,\n isOnDemandRevalidate,\n isRoutePPREnabled,\n req,\n nextConfig,\n prerenderManifest,\n waitUntil: ctx.waitUntil,\n })\n\n if (isDraftMode) {\n res.setHeader(\n 'Cache-Control',\n 'private, no-cache, no-store, max-age=0, must-revalidate'\n )\n }\n\n // In dev, we should not cache pages for any reason.\n if (routeModule.isDev) {\n res.setHeader('Cache-Control', 'no-store, must-revalidate')\n }\n\n if (!cacheEntry) {\n if (ssgCacheKey) {\n // A cache entry might not be generated if a response is written\n // in `getInitialProps` or `getServerSideProps`, but those shouldn't\n // have a cache key. If we do have a cache key but we don't end up\n // with a cache entry, then either Next.js or the application has a\n // bug that needs fixing.\n throw new Error('invariant: cache entry required but not generated')\n }\n return null\n }\n\n if (cacheEntry.value?.kind !== CachedRouteKind.APP_PAGE) {\n throw new Error(\n `Invariant app-page handler received invalid cache entry ${cacheEntry.value?.kind}`\n )\n }\n\n const didPostpone = typeof cacheEntry.value.postponed === 'string'\n\n if (\n isSSG &&\n // We don't want to send a cache header for requests that contain dynamic\n // data. If this is a Dynamic RSC request or wasn't a Prefetch RSC\n // request, then we should set the cache header.\n !isDynamicRSCRequest &&\n (!didPostpone || isPrefetchRSCRequest)\n ) {\n if (!minimalMode) {\n // set x-nextjs-cache header to match the header\n // we set for the image-optimizer\n res.setHeader(\n 'x-nextjs-cache',\n isOnDemandRevalidate\n ? 'REVALIDATED'\n : cacheEntry.isMiss\n ? 'MISS'\n : cacheEntry.isStale\n ? 'STALE'\n : 'HIT'\n )\n }\n // Set a header used by the client router to signal the response is static\n // and should respect the `static` cache staleTime value.\n res.setHeader(NEXT_IS_PRERENDER_HEADER, '1')\n }\n const { value: cachedData } = cacheEntry\n\n // Coerce the cache control parameter from the render.\n let cacheControl: CacheControl | undefined\n\n // If this is a resume request in minimal mode it is streamed with dynamic\n // content and should not be cached.\n if (minimalPostponed) {\n cacheControl = { revalidate: 0, expire: undefined }\n }\n\n // If this is in minimal mode and this is a flight request that isn't a\n // prefetch request while PPR is enabled, it cannot be cached as it contains\n // dynamic content.\n else if (\n minimalMode &&\n isRSCRequest &&\n !isPrefetchRSCRequest &&\n isRoutePPREnabled\n ) {\n cacheControl = { revalidate: 0, expire: undefined }\n } else if (!routeModule.isDev) {\n // If this is a preview mode request, we shouldn't cache it\n if (isDraftMode) {\n cacheControl = { revalidate: 0, expire: undefined }\n }\n\n // If this isn't SSG, then we should set change the header only if it is\n // not set already.\n else if (!isSSG) {\n if (!res.getHeader('Cache-Control')) {\n cacheControl = { revalidate: 0, expire: undefined }\n }\n } else if (cacheEntry.cacheControl) {\n // If the cache entry has a cache control with a revalidate value that's\n // a number, use it.\n if (typeof cacheEntry.cacheControl.revalidate === 'number') {\n if (cacheEntry.cacheControl.revalidate < 1) {\n throw new Error(\n `Invalid revalidate configuration provided: ${cacheEntry.cacheControl.revalidate} < 1`\n )\n }\n\n cacheControl = {\n revalidate: cacheEntry.cacheControl.revalidate,\n expire: cacheEntry.cacheControl?.expire ?? nextConfig.expireTime,\n }\n }\n // Otherwise if the revalidate value is false, then we should use the\n // cache time of one year.\n else {\n cacheControl = { revalidate: CACHE_ONE_YEAR, expire: undefined }\n }\n }\n }\n\n cacheEntry.cacheControl = cacheControl\n\n if (\n typeof segmentPrefetchHeader === 'string' &&\n cachedData?.kind === CachedRouteKind.APP_PAGE &&\n cachedData.segmentData\n ) {\n // This is a prefetch request issued by the client Segment Cache. These\n // should never reach the application layer (lambda). We should either\n // respond from the cache (HIT) or respond with 204 No Content (MISS).\n\n // Set a header to indicate that PPR is enabled for this route. This\n // lets the client distinguish between a regular cache miss and a cache\n // miss due to PPR being disabled. In other contexts this header is used\n // to indicate that the response contains dynamic data, but here we're\n // only using it to indicate that the feature is enabled — the segment\n // response itself contains whether the data is dynamic.\n res.setHeader(NEXT_DID_POSTPONE_HEADER, '2')\n\n // Add the cache tags header to the response if it exists and we're in\n // minimal mode while rendering a static page.\n const tags = cachedData.headers?.[NEXT_CACHE_TAGS_HEADER]\n if (minimalMode && isSSG && tags && typeof tags === 'string') {\n res.setHeader(NEXT_CACHE_TAGS_HEADER, tags)\n }\n\n const matchedSegment = cachedData.segmentData.get(segmentPrefetchHeader)\n if (matchedSegment !== undefined) {\n // Cache hit\n return sendRenderResult({\n req,\n res,\n type: 'rsc',\n generateEtags: nextConfig.generateEtags,\n poweredByHeader: nextConfig.poweredByHeader,\n result: RenderResult.fromStatic(matchedSegment),\n cacheControl: cacheEntry.cacheControl,\n })\n }\n\n // Cache miss. Either a cache entry for this route has not been generated\n // (which technically should not be possible when PPR is enabled, because\n // at a minimum there should always be a fallback entry) or there's no\n // match for the requested segment. Respond with a 204 No Content. We\n // don't bother to respond with 404, because these requests are only\n // issued as part of a prefetch.\n res.statusCode = 204\n return sendRenderResult({\n req,\n res,\n type: 'rsc',\n generateEtags: nextConfig.generateEtags,\n poweredByHeader: nextConfig.poweredByHeader,\n result: RenderResult.fromStatic(''),\n cacheControl: cacheEntry.cacheControl,\n })\n }\n\n // If there's a callback for `onCacheEntry`, call it with the cache entry\n // and the revalidate options.\n const onCacheEntry = getRequestMeta(req, 'onCacheEntry')\n if (onCacheEntry) {\n const finished = await onCacheEntry(\n {\n ...cacheEntry,\n // TODO: remove this when upstream doesn't\n // always expect this value to be \"PAGE\"\n value: {\n ...cacheEntry.value,\n kind: 'PAGE',\n },\n },\n {\n url: getRequestMeta(req, 'initURL'),\n }\n )\n if (finished) {\n // TODO: maybe we have to end the request?\n return null\n }\n }\n\n // If the request has a postponed state and it's a resume request we\n // should error.\n if (didPostpone && minimalPostponed) {\n throw new Error(\n 'Invariant: postponed state should not be present on a resume request'\n )\n }\n\n if (cachedData.headers) {\n const headers = { ...cachedData.headers }\n\n if (!minimalMode || !isSSG) {\n delete headers[NEXT_CACHE_TAGS_HEADER]\n }\n\n for (let [key, value] of Object.entries(headers)) {\n if (typeof value === 'undefined') continue\n\n if (Array.isArray(value)) {\n for (const v of value) {\n res.appendHeader(key, v)\n }\n } else if (typeof value === 'number') {\n value = value.toString()\n res.appendHeader(key, value)\n } else {\n res.appendHeader(key, value)\n }\n }\n }\n\n // Add the cache tags header to the response if it exists and we're in\n // minimal mode while rendering a static page.\n const tags = cachedData.headers?.[NEXT_CACHE_TAGS_HEADER]\n if (minimalMode && isSSG && tags && typeof tags === 'string') {\n res.setHeader(NEXT_CACHE_TAGS_HEADER, tags)\n }\n\n // If the request is a data request, then we shouldn't set the status code\n // from the response because it should always be 200. This should be gated\n // behind the experimental PPR flag.\n if (cachedData.status && (!isRSCRequest || !isRoutePPREnabled)) {\n res.statusCode = cachedData.status\n }\n\n // Redirect information is encoded in RSC payload, so we don't need to use redirect status codes\n if (\n !minimalMode &&\n cachedData.status &&\n RedirectStatusCode[cachedData.status] &&\n isRSCRequest\n ) {\n res.statusCode = 200\n }\n\n // Mark that the request did postpone.\n if (didPostpone) {\n res.setHeader(NEXT_DID_POSTPONE_HEADER, '1')\n }\n\n // we don't go through this block when preview mode is true\n // as preview mode is a dynamic request (bypasses cache) and doesn't\n // generate both HTML and payloads in the same request so continue to just\n // return the generated payload\n if (isRSCRequest && !isDraftMode) {\n // If this is a dynamic RSC request, then stream the response.\n if (typeof cachedData.rscData === 'undefined') {\n if (cachedData.postponed) {\n throw new Error('Invariant: Expected postponed to be undefined')\n }\n\n return sendRenderResult({\n req,\n res,\n type: 'rsc',\n generateEtags: nextConfig.generateEtags,\n poweredByHeader: nextConfig.poweredByHeader,\n result: cachedData.html,\n // Dynamic RSC responses cannot be cached, even if they're\n // configured with `force-static` because we have no way of\n // distinguishing between `force-static` and pages that have no\n // postponed state.\n // TODO: distinguish `force-static` from pages with no postponed state (static)\n cacheControl: isDynamicRSCRequest\n ? { revalidate: 0, expire: undefined }\n : cacheEntry.cacheControl,\n })\n }\n\n // As this isn't a prefetch request, we should serve the static flight\n // data.\n return sendRenderResult({\n req,\n res,\n type: 'rsc',\n generateEtags: nextConfig.generateEtags,\n poweredByHeader: nextConfig.poweredByHeader,\n result: RenderResult.fromStatic(cachedData.rscData),\n cacheControl: cacheEntry.cacheControl,\n })\n }\n\n // This is a request for HTML data.\n let body = cachedData.html\n\n // If there's no postponed state, we should just serve the HTML. This\n // should also be the case for a resume request because it's completed\n // as a server render (rather than a static render).\n if (!didPostpone || minimalMode) {\n return sendRenderResult({\n req,\n res,\n type: 'html',\n generateEtags: nextConfig.generateEtags,\n poweredByHeader: nextConfig.poweredByHeader,\n result: body,\n cacheControl: cacheEntry.cacheControl,\n })\n }\n\n // If we're debugging the static shell or the dynamic API accesses, we\n // should just serve the HTML without resuming the render. The returned\n // HTML will be the static shell so all the Dynamic API's will be used\n // during static generation.\n if (isDebugStaticShell || isDebugDynamicAccesses) {\n // Since we're not resuming the render, we need to at least add the\n // closing body and html tags to create valid HTML.\n body.chain(\n new ReadableStream({\n start(controller) {\n controller.enqueue(ENCODED_TAGS.CLOSED.BODY_AND_HTML)\n controller.close()\n },\n })\n )\n\n return sendRenderResult({\n req,\n res,\n type: 'html',\n generateEtags: nextConfig.generateEtags,\n poweredByHeader: nextConfig.poweredByHeader,\n result: body,\n cacheControl: { revalidate: 0, expire: undefined },\n })\n }\n\n // This request has postponed, so let's create a new transformer that the\n // dynamic data can pipe to that will attach the dynamic data to the end\n // of the response.\n const transformer = new TransformStream<Uint8Array, Uint8Array>()\n body.chain(transformer.readable)\n\n // Perform the render again, but this time, provide the postponed state.\n // We don't await because we want the result to start streaming now, and\n // we've already chained the transformer's readable to the render result.\n doRender({\n span,\n postponed: cachedData.postponed,\n // This is a resume render, not a fallback render, so we don't need to\n // set this.\n fallbackRouteParams: null,\n })\n .then(async (result) => {\n if (!result) {\n throw new Error('Invariant: expected a result to be returned')\n }\n\n if (result.value?.kind !== CachedRouteKind.APP_PAGE) {\n throw new Error(\n `Invariant: expected a page response, got ${result.value?.kind}`\n )\n }\n\n // Pipe the resume result to the transformer.\n await result.value.html.pipeTo(transformer.writable)\n })\n .catch((err) => {\n // An error occurred during piping or preparing the render, abort\n // the transformers writer so we can terminate the stream.\n transformer.writable.abort(err).catch((e) => {\n console.error(\"couldn't abort transformer\", e)\n })\n })\n\n return sendRenderResult({\n req,\n res,\n type: 'html',\n generateEtags: nextConfig.generateEtags,\n poweredByHeader: nextConfig.poweredByHeader,\n result: body,\n // We don't want to cache the response if it has postponed data because\n // the response being sent to the client it's dynamic parts are streamed\n // to the client on the same request.\n cacheControl: { revalidate: 0, expire: undefined },\n })\n }\n\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (activeSpan) {\n await handleResponse(activeSpan)\n } else {\n return await tracer.withPropagatedContext(req.headers, () =>\n tracer.trace(\n BaseServerSpan.handleRequest,\n {\n spanName: `${method} ${req.url}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url,\n },\n },\n handleResponse\n )\n )\n }\n } catch (err) {\n // if we aren't wrapped by base-server handle here\n if (!activeSpan && !(err instanceof NoFallbackError)) {\n await routeModule.onRequestError(\n req,\n err,\n {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'render',\n revalidateReason: getRevalidateReason({\n isRevalidate: isSSG,\n isOnDemandRevalidate,\n }),\n },\n routerServerContext\n )\n }\n\n // rethrow so that we can handle serving error page\n throw err\n }\n}\n"],"names":["GlobalError","__next_app__","handler","pages","routeModule","tree","require","__next_app_require__","loadChunk","__next_app_load_chunk__","AppPageRouteModule","definition","kind","RouteKind","APP_PAGE","page","pathname","bundlePath","filename","appPaths","userland","loaderTree","distDir","process","env","__NEXT_RELATIVE_DIST_DIR","projectDir","__NEXT_RELATIVE_PROJECT_DIR","req","res","ctx","prerenderManifest","srcPage","TURBOPACK","replace","multiZoneDraftMode","__NEXT_MULTI_ZONE_DRAFT_MODE","initialPostponed","getRequestMeta","minimalMode","prepareResult","prepare","statusCode","end","waitUntil","Promise","resolve","buildId","query","params","parsedUrl","pageIsDynamic","buildManifest","nextFontManifest","reactLoadableManifest","serverActionsManifest","clientReferenceManifest","subresourceIntegrityManifest","isDraftMode","resolvedPathname","revalidateOnlyGenerated","routerServerContext","nextConfig","normalizedSrcPage","normalizeAppPath","isOnDemandRevalidate","prerenderInfo","dynamicRoutes","isPrerendered","routes","isSSG","Boolean","userAgent","headers","botType","getBotType","isHtmlBot","isHtmlBotRequest","isPrefetchRSCRequest","NEXT_ROUTER_PREFETCH_HEADER","isRSCRequest","RSC_HEADER","isPossibleServerAction","getIsPossibleServerAction","couldSupportPPR","checkIsAppPPREnabled","experimental","ppr","hasDebugStaticShellQuery","__NEXT_EXPERIMENTAL_STATIC_SHELL_DEBUGGING","__nextppronly","hasDebugFallbackShellQuery","isRoutePPREnabled","renderingMode","isDev","experimentalTestProxy","isDebugStaticShell","isDebugDynamicAccesses","isDebugFallbackShell","minimalPostponed","undefined","isDynamicRSCRequest","segmentPrefetchHeader","serveStreamingMetadata","shouldServeStreamingMetadata","htmlLimitedBots","supportsDynamicResponse","shouldWaitOnAllReady","ssgCacheKey","staticPathKey","ComponentMod","entryBase","setReferenceManifestsSingleton","serverModuleMap","createServerModuleMap","method","tracer","getTracer","activeSpan","getActiveScopeSpan","invokeRouteModule","span","context","nextReq","NodeNextRequest","nextRes","NodeNextResponse","NODE_ENV","dynamicIO","renderOpts","warmup","metadata","renderResumeDataCache","render","finally","setAttributes","rootSpanAttributes","getRootSpanAttributes","get","BaseServerSpan","handleRequest","console","warn","route","name","updateName","url","doRender","postponed","fallbackRouteParams","sharedContext","serverComponentsHmrCache","App","Document","pageConfig","Component","interopDefault","setIsrStatus","dir","isRevalidate","assetPrefix","nextConfigOutput","output","crossOrigin","trailingSlash","previewProps","preview","deploymentId","enableTainting","taint","devtoolSegmentExplorer","reactMaxHeadersLength","incrementalCache","cacheLifeProfiles","cacheLife","basePath","serverActions","nextExport","isStaticGeneration","expireTime","staleTimes","clientSegmentCache","dynamicOnHover","inlineCss","authInterrupts","clientTraceMetadata","onClose","cb","on","onAfterTaskError","onInstrumentationRequestError","error","_request","errorContext","onRequestError","err","dev","result","cacheControl","fetchTags","cacheTags","NEXT_CACHE_TAGS_HEADER","fetchMetrics","revalidate","staticBailoutInfo","Error","description","stack","message","substring","indexOf","value","CachedRouteKind","html","rscData","flightData","status","segmentData","responseGenerator","hasResolved","previousCacheEntry","isRevalidating","isProduction","didRespond","writableEnded","render404","fallbackMode","parseFallbackField","fallback","FallbackMode","PRERENDER","isBot","BLOCKING_STATIC_RENDER","isStale","NOT_FOUND","NoFallbackError","fallbackResponse","handleResponse","cacheKey","routeKind","isFallback","getFallbackRouteParams","expire","PAGES","RenderResult","fromStatic","pageData","cacheEntry","cachedData","c","setHeader","didPostpone","isMiss","NEXT_IS_PRERENDER_HEADER","getHeader","CACHE_ONE_YEAR","NEXT_DID_POSTPONE_HEADER","tags","matchedSegment","sendRenderResult","type","generateEtags","poweredByHeader","onCacheEntry","finished","key","Object","entries","Array","isArray","v","appendHeader","toString","RedirectStatusCode","body","chain","ReadableStream","start","controller","enqueue","ENCODED_TAGS","CLOSED","BODY_AND_HTML","close","transformer","TransformStream","readable","then","pipeTo","writable","catch","abort","e","withPropagatedContext","trace","spanName","SpanKind","SERVER","attributes","routerKind","routePath","routeType","revalidateReason","getRevalidateReason"],"mappings":";;;;;;;;;;;;;;;;;;;IAqESA,WAAW;eAAXA,gCAAW;;IASPC,YAAY;eAAZA;;IA4BSC,OAAO;eAAPA;;IAzCPC,KAAK;eAALA;;IAwBFC,WAAW;eAAXA;;IAxBJC,IAAI;eAAJA;;;;gCA3DF;2BAEmB;uBAEU;wBACW;6BAChB;2BACA;gCACA;sBACmB;qBACb;gCAI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ACEwG,YAAY;gBACZC,WAAW5Q;gBACX6Q,WAAW;gBACXC,kBAAkBC,IAAAA,0BAAmB,EAAC;oBACpChJ,cAAczF;oBACdL;gBACF;YACF,GACAJ;QAEJ;QAEA,mDAAmD;QACnD,MAAMsI;IACR;AACF","ignoreList":[0]}
|
@@ -367,7 +367,7 @@ async function handler(req, res, ctx) {
|
|
367
367
|
}
|
368
368
|
} catch (err) {
|
369
369
|
// if we aren't wrapped by base-server handle here
|
370
|
-
if (!activeSpan) {
|
370
|
+
if (!activeSpan && !(err instanceof _nofallbackerrorexternal.NoFallbackError)) {
|
371
371
|
await routeModule.onRequestError(req, err, {
|
372
372
|
routerKind: 'App Router',
|
373
373
|
routePath: normalizedSrcPage,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/build/templates/app-route.ts"],"sourcesContent":["import {\n AppRouteRouteModule,\n type AppRouteRouteHandlerContext,\n type AppRouteRouteModuleOptions,\n} from '../../server/route-modules/app-route/module.compiled'\nimport { RouteKind } from '../../server/route-kind'\nimport { patchFetch as _patchFetch } from '../../server/lib/patch-fetch'\nimport type { IncomingMessage, ServerResponse } from 'node:http'\nimport { getRequestMeta } from '../../server/request-meta'\nimport { getTracer, type Span, SpanKind } from '../../server/lib/trace/tracer'\nimport { normalizeAppPath } from '../../shared/lib/router/utils/app-paths'\nimport { NodeNextRequest, NodeNextResponse } from '../../server/base-http/node'\nimport {\n NextRequestAdapter,\n signalFromNodeResponse,\n} from '../../server/web/spec-extension/adapters/next-request'\nimport { BaseServerSpan } from '../../server/lib/trace/constants'\nimport { getRevalidateReason } from '../../server/instrumentation/utils'\nimport { sendResponse } from '../../server/send-response'\nimport {\n fromNodeOutgoingHttpHeaders,\n toNodeOutgoingHttpHeaders,\n} from '../../server/web/utils'\nimport { getCacheControlHeader } from '../../server/lib/cache-control'\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from '../../lib/constants'\nimport { NoFallbackError } from '../../shared/lib/no-fallback-error.external'\nimport {\n CachedRouteKind,\n type ResponseCacheEntry,\n type ResponseGenerator,\n} from '../../server/response-cache'\n\nimport * as userland from 'VAR_USERLAND'\n\n// These are injected by the loader afterwards. This is injected as a variable\n// instead of a replacement because this could also be `undefined` instead of\n// an empty string.\ndeclare const nextConfigOutput: AppRouteRouteModuleOptions['nextConfigOutput']\n\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\n// INJECT:nextConfigOutput\n\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: 'VAR_DEFINITION_PAGE',\n pathname: 'VAR_DEFINITION_PATHNAME',\n filename: 'VAR_DEFINITION_FILENAME',\n bundlePath: 'VAR_DEFINITION_BUNDLE_PATH',\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n projectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: 'VAR_RESOLVED_PAGE_PATH',\n nextConfigOutput,\n userland,\n})\n\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule\n\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage,\n })\n}\n\nexport {\n routeModule,\n workAsyncStorage,\n workUnitAsyncStorage,\n serverHooks,\n patchFetch,\n}\n\nexport async function handler(\n req: IncomingMessage,\n res: ServerResponse,\n ctx: {\n waitUntil: (prom: Promise<void>) => void\n }\n) {\n let srcPage = 'VAR_DEFINITION_PAGE'\n\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/'\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/'\n }\n const multiZoneDraftMode = process.env\n .__NEXT_MULTI_ZONE_DRAFT_MODE as any as boolean\n\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode,\n })\n\n if (!prepareResult) {\n res.statusCode = 400\n res.end('Bad Request')\n ctx.waitUntil?.(Promise.resolve())\n return null\n }\n\n const {\n buildId,\n params,\n nextConfig,\n isDraftMode,\n prerenderManifest,\n routerServerContext,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n resolvedPathname,\n } = prepareResult\n\n const normalizedSrcPage = normalizeAppPath(srcPage)\n\n let isIsr = Boolean(\n prerenderManifest.dynamicRoutes[normalizedSrcPage] ||\n prerenderManifest.routes[resolvedPathname]\n )\n\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname])\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage]\n\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n throw new NoFallbackError()\n }\n }\n }\n\n let cacheKey: string | null = null\n\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey\n }\n\n const supportsDynamicResponse: boolean =\n // If we're in development, we always support dynamic HTML\n routeModule.isDev === true ||\n // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr\n\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isRevalidate = isIsr && !supportsDynamicResponse\n\n const method = req.method || 'GET'\n const tracer = getTracer()\n const activeSpan = tracer.getActiveScopeSpan()\n\n const context: AppRouteRouteHandlerContext = {\n params,\n prerenderManifest,\n renderOpts: {\n experimental: {\n dynamicIO: Boolean(nextConfig.experimental.dynamicIO),\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts),\n },\n supportsDynamicResponse,\n incrementalCache: getRequestMeta(req, 'incrementalCache'),\n cacheLifeProfiles: nextConfig.experimental?.cacheLife,\n isRevalidate,\n waitUntil: ctx.waitUntil,\n onClose: (cb) => {\n res.on('close', cb)\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext) =>\n routeModule.onRequestError(\n req,\n error,\n errorContext,\n routerServerContext\n ),\n },\n sharedContext: {\n buildId,\n },\n }\n const nodeNextReq = new NodeNextRequest(req)\n const nodeNextRes = new NodeNextResponse(res)\n\n const nextReq = NextRequestAdapter.fromNodeNextRequest(\n nodeNextReq,\n signalFromNodeResponse(res)\n )\n\n try {\n const invokeRouteModule = async (span?: Span) => {\n return routeModule.handle(nextReq, context).finally(() => {\n if (!span) return\n\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false,\n })\n\n const rootSpanAttributes = tracer.getRootSpanAttributes()\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return\n }\n\n if (\n rootSpanAttributes.get('next.span_type') !==\n BaseServerSpan.handleRequest\n ) {\n console.warn(\n `Unexpected root span type '${rootSpanAttributes.get(\n 'next.span_type'\n )}'. Please report this Next.js issue https://github.com/vercel/next.js`\n )\n return\n }\n\n const route = rootSpanAttributes.get('next.route')\n if (route) {\n const name = `${method} ${route}`\n\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name,\n })\n span.updateName(name)\n } else {\n span.updateName(`${method} ${req.url}`)\n }\n })\n }\n\n const handleResponse = async (currentSpan?: Span) => {\n const responseGenerator: ResponseGenerator = async ({\n previousCacheEntry,\n }) => {\n try {\n if (\n !getRequestMeta(req, 'minimalMode') &&\n isOnDemandRevalidate &&\n revalidateOnlyGenerated &&\n !previousCacheEntry\n ) {\n res.statusCode = 404\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED')\n res.end('This page could not be found')\n return null\n }\n\n const response = await invokeRouteModule(currentSpan)\n\n ;(req as any).fetchMetrics = (context.renderOpts as any).fetchMetrics\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil\n\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil)\n pendingWaitUntil = undefined\n }\n }\n const cacheTags = context.renderOpts.collectedTags\n\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob()\n\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers)\n\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags\n }\n\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type\n }\n\n const revalidate =\n typeof context.renderOpts.collectedRevalidate === 'undefined' ||\n context.renderOpts.collectedRevalidate >= INFINITE_CACHE\n ? false\n : context.renderOpts.collectedRevalidate\n\n const expire =\n typeof context.renderOpts.collectedExpire === 'undefined' ||\n context.renderOpts.collectedExpire >= INFINITE_CACHE\n ? undefined\n : context.renderOpts.collectedExpire\n\n // Create the cache entry for the response.\n const cacheEntry: ResponseCacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers,\n },\n cacheControl: { revalidate, expire },\n }\n\n return cacheEntry\n } else {\n // send response without caching if not ISR\n await sendResponse(\n nodeNextReq,\n nodeNextRes,\n response,\n context.renderOpts.pendingWaitUntil\n )\n return null\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry?.isStale) {\n await routeModule.onRequestError(\n req,\n err,\n {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isRevalidate,\n isOnDemandRevalidate,\n }),\n },\n routerServerContext\n )\n }\n throw err\n }\n }\n\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n })\n\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null\n }\n\n if (cacheEntry?.value?.kind !== CachedRouteKind.APP_ROUTE) {\n throw new Error(\n `Invariant: app-route received invalid cache entry ${cacheEntry?.value?.kind}`\n )\n }\n\n if (!getRequestMeta(req, 'minimalMode')) {\n res.setHeader(\n 'x-nextjs-cache',\n isOnDemandRevalidate\n ? 'REVALIDATED'\n : cacheEntry.isMiss\n ? 'MISS'\n : cacheEntry.isStale\n ? 'STALE'\n : 'HIT'\n )\n }\n\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader(\n 'Cache-Control',\n 'private, no-cache, no-store, max-age=0, must-revalidate'\n )\n }\n\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers)\n\n if (!(getRequestMeta(req, 'minimalMode') && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER)\n }\n\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (\n cacheEntry.cacheControl &&\n !res.getHeader('Cache-Control') &&\n !headers.get('Cache-Control')\n ) {\n headers.set(\n 'Cache-Control',\n getCacheControlHeader(cacheEntry.cacheControl)\n )\n }\n\n await sendResponse(\n nodeNextReq,\n nodeNextRes,\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200,\n })\n )\n return null\n }\n\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (activeSpan) {\n await handleResponse(activeSpan)\n } else {\n await tracer.withPropagatedContext(req.headers, () =>\n tracer.trace(\n BaseServerSpan.handleRequest,\n {\n spanName: `${method} ${req.url}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url,\n },\n },\n handleResponse\n )\n )\n }\n } catch (err) {\n // if we aren't wrapped by base-server handle here\n if (!activeSpan) {\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isRevalidate,\n isOnDemandRevalidate,\n }),\n })\n }\n\n // rethrow so that we can handle serving error page\n\n // If this is during static generation, throw the error again.\n if (isIsr) throw err\n\n // Otherwise, send a 500 response.\n await sendResponse(\n nodeNextReq,\n nodeNextRes,\n new Response(null, { status: 500 })\n )\n return null\n }\n}\n"],"names":["handler","patchFetch","routeModule","serverHooks","workAsyncStorage","workUnitAsyncStorage","AppRouteRouteModule","definition","kind","RouteKind","APP_ROUTE","page","pathname","filename","bundlePath","distDir","process","env","__NEXT_RELATIVE_DIST_DIR","projectDir","__NEXT_RELATIVE_PROJECT_DIR","resolvedPagePath","nextConfigOutput","userland","_patchFetch","req","res","ctx","nextConfig","srcPage","TURBOPACK","replace","multiZoneDraftMode","__NEXT_MULTI_ZONE_DRAFT_MODE","prepareResult","prepare","statusCode","end","waitUntil","Promise","resolve","buildId","params","isDraftMode","prerenderManifest","routerServerContext","isOnDemandRevalidate","revalidateOnlyGenerated","resolvedPathname","normalizedSrcPage","normalizeAppPath","isIsr","Boolean","dynamicRoutes","routes","isPrerendered","prerenderInfo","fallback","NoFallbackError","cacheKey","isDev","supportsDynamicResponse","isRevalidate","method","tracer","getTracer","activeSpan","getActiveScopeSpan","context","renderOpts","experimental","dynamicIO","authInterrupts","incrementalCache","getRequestMeta","cacheLifeProfiles","cacheLife","onClose","cb","on","onAfterTaskError","undefined","onInstrumentationRequestError","error","_request","errorContext","onRequestError","sharedContext","nodeNextReq","NodeNextRequest","nodeNextRes","NodeNextResponse","nextReq","NextRequestAdapter","fromNodeNextRequest","signalFromNodeResponse","invokeRouteModule","span","handle","finally","setAttributes","rootSpanAttributes","getRootSpanAttributes","get","BaseServerSpan","handleRequest","console","warn","route","name","updateName","url","handleResponse","currentSpan","cacheEntry","responseGenerator","previousCacheEntry","setHeader","response","fetchMetrics","pendingWaitUntil","cacheTags","collectedTags","blob","headers","toNodeOutgoingHttpHeaders","NEXT_CACHE_TAGS_HEADER","type","revalidate","collectedRevalidate","INFINITE_CACHE","expire","collectedExpire","value","CachedRouteKind","status","body","Buffer","from","arrayBuffer","cacheControl","sendResponse","err","isStale","routerKind","routePath","routeType","revalidateReason","getRevalidateReason","routeKind","isFallback","isRoutePPREnabled","Error","isMiss","fromNodeOutgoingHttpHeaders","delete","getHeader","set","getCacheControlHeader","Response","withPropagatedContext","trace","spanName","SpanKind","SERVER","attributes"],"mappings":";;;;;;;;;;;;;;;;;;;IA8EsBA,OAAO;eAAPA;;IAHpBC,UAAU;eAAVA;;IAJAC,WAAW;eAAXA;;IAGAC,WAAW;eAAXA;;IAFAC,gBAAgB;eAAhBA;;IACAC,oBAAoB;eAApBA;;;gCArEK;2BACmB;4BACgB;6BAEX;wBACgB;0BACd;sBACiB;6BAI3C;2BACwB;uBACK;8BACP;wBAItB;8BAC+B;4BACiB;yCACvB;+BAKzB;sEAEmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAO1B,2EAA2E;AAC3E,UAAU;AACV,0BAA0B;AAE1B,MAAMH,cAAc,IAAII,mCAAmB,CAAC;IAC1CC,YAAY;QACVC,MAAMC,oBAAS,CAACC,SAAS;QACzBC,MAAM;QACNC,UAAU;QACVC,UAAU;QACVC,YAAY;IACd;IACAC,SAASC,QAAQC,GAAG,CAACC,wBAAwB,IAAI;IACjDC,YAAYH,QAAQC,GAAG,CAACG,2BAA2B,IAAI;IACvDC,kBAAkB;IAClBC;IACAC,UAAAA;AACF;AAEA,2EAA2E;AAC3E,2EAA2E;AAC3E,mCAAmC;AACnC,MAAM,EAAEnB,gBAAgB,EAAEC,oBAAoB,EAAEF,WAAW,EAAE,GAAGD;AAEhE,SAASD;IACP,OAAOuB,IAAAA,sBAAW,EAAC;QACjBpB;QACAC;IACF;AACF;AAUO,eAAeL,QACpByB,GAAoB,EACpBC,GAAmB,EACnBC,GAEC;QA6FsBC;IA3FvB,IAAIC,UAAU;IAEd,wDAAwD;IACxD,mDAAmD;IACnD,6DAA6D;IAC7D,IAAIb,QAAQC,GAAG,CAACa,SAAS,EA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,CACT,iBACAC,IAAAA,mCAAqB,EAAC5C,WAAW0B,YAAY;YAEjD;YAEA,MAAMC,IAAAA,0BAAY,EAChBrD,aACAE,aACA,IAAIqE,SAAS7C,WAAWmB,KAAK,CAACG,IAAI,EAAE;gBAClCZ;gBACAW,QAAQrB,WAAWmB,KAAK,CAACE,MAAM,IAAI;YACrC;YAEF,OAAO;QACT;QAEA,oDAAoD;QACpD,yDAAyD;QACzD,IAAIrE,YAAY;YACd,MAAM8C,eAAe9C;QACvB,OAAO;YACL,MAAMF,OAAOgG,qBAAqB,CAACvI,IAAImG,OAAO,EAAE,IAC9C5D,OAAOiG,KAAK,CACVzD,yBAAc,CAACC,aAAa,EAC5B;oBACEyD,UAAU,GAAGnG,OAAO,CAAC,EAAEtC,IAAIsF,GAAG,EAAE;oBAChCvG,MAAM2J,gBAAQ,CAACC,MAAM;oBACrBC,YAAY;wBACV,eAAetG;wBACf,eAAetC,IAAIsF,GAAG;oBACxB;gBACF,GACAC;QAGN;IACF,EAAE,OAAO8B,KAAK;QACZ,kDAAkD;QAClD,IAAI,CAAC5E,YAAY;YACf,MAAMhE,YAAYoF,cAAc,CAAC7D,KAAKqH,KAAK;gBACzCE,YAAY;gBACZC,WAAWhG;gBACXiG,WAAW;gBACXC,kBAAkBC,IAAAA,0BAAmB,EAAC;oBACpCtF;oBACAhB;gBACF;YACF;QACF;QAEA,mDAAmD;QAEnD,8DAA8D;QAC9D,IAAIK,OAAO,MAAM2F;QAEjB,kCAAkC;QAClC,MAAMD,IAAAA,0BAAY,EAChBrD,aACAE,aACA,IAAIqE,SAAS,MAAM;YAAExB,QAAQ;QAAI;QAEnC,OAAO;IACT;AACF","ignoreList":[0]}
|
1
|
+
{"version":3,"sources":["../../../src/build/templates/app-route.ts"],"sourcesContent":["import {\n AppRouteRouteModule,\n type AppRouteRouteHandlerContext,\n type AppRouteRouteModuleOptions,\n} from '../../server/route-modules/app-route/module.compiled'\nimport { RouteKind } from '../../server/route-kind'\nimport { patchFetch as _patchFetch } from '../../server/lib/patch-fetch'\nimport type { IncomingMessage, ServerResponse } from 'node:http'\nimport { getRequestMeta } from '../../server/request-meta'\nimport { getTracer, type Span, SpanKind } from '../../server/lib/trace/tracer'\nimport { normalizeAppPath } from '../../shared/lib/router/utils/app-paths'\nimport { NodeNextRequest, NodeNextResponse } from '../../server/base-http/node'\nimport {\n NextRequestAdapter,\n signalFromNodeResponse,\n} from '../../server/web/spec-extension/adapters/next-request'\nimport { BaseServerSpan } from '../../server/lib/trace/constants'\nimport { getRevalidateReason } from '../../server/instrumentation/utils'\nimport { sendResponse } from '../../server/send-response'\nimport {\n fromNodeOutgoingHttpHeaders,\n toNodeOutgoingHttpHeaders,\n} from '../../server/web/utils'\nimport { getCacheControlHeader } from '../../server/lib/cache-control'\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from '../../lib/constants'\nimport { NoFallbackError } from '../../shared/lib/no-fallback-error.external'\nimport {\n CachedRouteKind,\n type ResponseCacheEntry,\n type ResponseGenerator,\n} from '../../server/response-cache'\n\nimport * as userland from 'VAR_USERLAND'\n\n// These are injected by the loader afterwards. This is injected as a variable\n// instead of a replacement because this could also be `undefined` instead of\n// an empty string.\ndeclare const nextConfigOutput: AppRouteRouteModuleOptions['nextConfigOutput']\n\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\n// INJECT:nextConfigOutput\n\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: 'VAR_DEFINITION_PAGE',\n pathname: 'VAR_DEFINITION_PATHNAME',\n filename: 'VAR_DEFINITION_FILENAME',\n bundlePath: 'VAR_DEFINITION_BUNDLE_PATH',\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n projectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: 'VAR_RESOLVED_PAGE_PATH',\n nextConfigOutput,\n userland,\n})\n\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule\n\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage,\n })\n}\n\nexport {\n routeModule,\n workAsyncStorage,\n workUnitAsyncStorage,\n serverHooks,\n patchFetch,\n}\n\nexport async function handler(\n req: IncomingMessage,\n res: ServerResponse,\n ctx: {\n waitUntil: (prom: Promise<void>) => void\n }\n) {\n let srcPage = 'VAR_DEFINITION_PAGE'\n\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/'\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/'\n }\n const multiZoneDraftMode = process.env\n .__NEXT_MULTI_ZONE_DRAFT_MODE as any as boolean\n\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode,\n })\n\n if (!prepareResult) {\n res.statusCode = 400\n res.end('Bad Request')\n ctx.waitUntil?.(Promise.resolve())\n return null\n }\n\n const {\n buildId,\n params,\n nextConfig,\n isDraftMode,\n prerenderManifest,\n routerServerContext,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n resolvedPathname,\n } = prepareResult\n\n const normalizedSrcPage = normalizeAppPath(srcPage)\n\n let isIsr = Boolean(\n prerenderManifest.dynamicRoutes[normalizedSrcPage] ||\n prerenderManifest.routes[resolvedPathname]\n )\n\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname])\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage]\n\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n throw new NoFallbackError()\n }\n }\n }\n\n let cacheKey: string | null = null\n\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey\n }\n\n const supportsDynamicResponse: boolean =\n // If we're in development, we always support dynamic HTML\n routeModule.isDev === true ||\n // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr\n\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isRevalidate = isIsr && !supportsDynamicResponse\n\n const method = req.method || 'GET'\n const tracer = getTracer()\n const activeSpan = tracer.getActiveScopeSpan()\n\n const context: AppRouteRouteHandlerContext = {\n params,\n prerenderManifest,\n renderOpts: {\n experimental: {\n dynamicIO: Boolean(nextConfig.experimental.dynamicIO),\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts),\n },\n supportsDynamicResponse,\n incrementalCache: getRequestMeta(req, 'incrementalCache'),\n cacheLifeProfiles: nextConfig.experimental?.cacheLife,\n isRevalidate,\n waitUntil: ctx.waitUntil,\n onClose: (cb) => {\n res.on('close', cb)\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext) =>\n routeModule.onRequestError(\n req,\n error,\n errorContext,\n routerServerContext\n ),\n },\n sharedContext: {\n buildId,\n },\n }\n const nodeNextReq = new NodeNextRequest(req)\n const nodeNextRes = new NodeNextResponse(res)\n\n const nextReq = NextRequestAdapter.fromNodeNextRequest(\n nodeNextReq,\n signalFromNodeResponse(res)\n )\n\n try {\n const invokeRouteModule = async (span?: Span) => {\n return routeModule.handle(nextReq, context).finally(() => {\n if (!span) return\n\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false,\n })\n\n const rootSpanAttributes = tracer.getRootSpanAttributes()\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return\n }\n\n if (\n rootSpanAttributes.get('next.span_type') !==\n BaseServerSpan.handleRequest\n ) {\n console.warn(\n `Unexpected root span type '${rootSpanAttributes.get(\n 'next.span_type'\n )}'. Please report this Next.js issue https://github.com/vercel/next.js`\n )\n return\n }\n\n const route = rootSpanAttributes.get('next.route')\n if (route) {\n const name = `${method} ${route}`\n\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name,\n })\n span.updateName(name)\n } else {\n span.updateName(`${method} ${req.url}`)\n }\n })\n }\n\n const handleResponse = async (currentSpan?: Span) => {\n const responseGenerator: ResponseGenerator = async ({\n previousCacheEntry,\n }) => {\n try {\n if (\n !getRequestMeta(req, 'minimalMode') &&\n isOnDemandRevalidate &&\n revalidateOnlyGenerated &&\n !previousCacheEntry\n ) {\n res.statusCode = 404\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED')\n res.end('This page could not be found')\n return null\n }\n\n const response = await invokeRouteModule(currentSpan)\n\n ;(req as any).fetchMetrics = (context.renderOpts as any).fetchMetrics\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil\n\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil)\n pendingWaitUntil = undefined\n }\n }\n const cacheTags = context.renderOpts.collectedTags\n\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob()\n\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers)\n\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags\n }\n\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type\n }\n\n const revalidate =\n typeof context.renderOpts.collectedRevalidate === 'undefined' ||\n context.renderOpts.collectedRevalidate >= INFINITE_CACHE\n ? false\n : context.renderOpts.collectedRevalidate\n\n const expire =\n typeof context.renderOpts.collectedExpire === 'undefined' ||\n context.renderOpts.collectedExpire >= INFINITE_CACHE\n ? undefined\n : context.renderOpts.collectedExpire\n\n // Create the cache entry for the response.\n const cacheEntry: ResponseCacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers,\n },\n cacheControl: { revalidate, expire },\n }\n\n return cacheEntry\n } else {\n // send response without caching if not ISR\n await sendResponse(\n nodeNextReq,\n nodeNextRes,\n response,\n context.renderOpts.pendingWaitUntil\n )\n return null\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry?.isStale) {\n await routeModule.onRequestError(\n req,\n err,\n {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isRevalidate,\n isOnDemandRevalidate,\n }),\n },\n routerServerContext\n )\n }\n throw err\n }\n }\n\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n })\n\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null\n }\n\n if (cacheEntry?.value?.kind !== CachedRouteKind.APP_ROUTE) {\n throw new Error(\n `Invariant: app-route received invalid cache entry ${cacheEntry?.value?.kind}`\n )\n }\n\n if (!getRequestMeta(req, 'minimalMode')) {\n res.setHeader(\n 'x-nextjs-cache',\n isOnDemandRevalidate\n ? 'REVALIDATED'\n : cacheEntry.isMiss\n ? 'MISS'\n : cacheEntry.isStale\n ? 'STALE'\n : 'HIT'\n )\n }\n\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader(\n 'Cache-Control',\n 'private, no-cache, no-store, max-age=0, must-revalidate'\n )\n }\n\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers)\n\n if (!(getRequestMeta(req, 'minimalMode') && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER)\n }\n\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (\n cacheEntry.cacheControl &&\n !res.getHeader('Cache-Control') &&\n !headers.get('Cache-Control')\n ) {\n headers.set(\n 'Cache-Control',\n getCacheControlHeader(cacheEntry.cacheControl)\n )\n }\n\n await sendResponse(\n nodeNextReq,\n nodeNextRes,\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200,\n })\n )\n return null\n }\n\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (activeSpan) {\n await handleResponse(activeSpan)\n } else {\n await tracer.withPropagatedContext(req.headers, () =>\n tracer.trace(\n BaseServerSpan.handleRequest,\n {\n spanName: `${method} ${req.url}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url,\n },\n },\n handleResponse\n )\n )\n }\n } catch (err) {\n // if we aren't wrapped by base-server handle here\n if (!activeSpan && !(err instanceof NoFallbackError)) {\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isRevalidate,\n isOnDemandRevalidate,\n }),\n })\n }\n\n // rethrow so that we can handle serving error page\n\n // If this is during static generation, throw the error again.\n if (isIsr) throw err\n\n // Otherwise, send a 500 response.\n await sendResponse(\n nodeNextReq,\n nodeNextRes,\n new Response(null, { status: 500 })\n )\n return null\n }\n}\n"],"names":["handler","patchFetch","routeModule","serverHooks","workAsyncStorage","workUnitAsyncStorage","AppRouteRouteModule","definition","kind","RouteKind","APP_ROUTE","page","pathname","filename","bundlePath","distDir","process","env","__NEXT_RELATIVE_DIST_DIR","projectDir","__NEXT_RELATIVE_PROJECT_DIR","resolvedPagePath","nextConfigOutput","userland","_patchFetch","req","res","ctx","nextConfig","srcPage","TURBOPACK","replace","multiZoneDraftMode","__NEXT_MULTI_ZONE_DRAFT_MODE","prepareResult","prepare","statusCode","end","waitUntil","Promise","resolve","buildId","params","isDraftMode","prerenderManifest","routerServerContext","isOnDemandRevalidate","revalidateOnlyGenerated","resolvedPathname","normalizedSrcPage","normalizeAppPath","isIsr","Boolean","dynamicRoutes","routes","isPrerendered","prerenderInfo","fallback","NoFallbackError","cacheKey","isDev","supportsDynamicResponse","isRevalidate","method","tracer","getTracer","activeSpan","getActiveScopeSpan","context","renderOpts","experimental","dynamicIO","authInterrupts","incrementalCache","getRequestMeta","cacheLifeProfiles","cacheLife","onClose","cb","on","onAfterTaskError","undefined","onInstrumentationRequestError","error","_request","errorContext","onRequestError","sharedContext","nodeNextReq","NodeNextRequest","nodeNextRes","NodeNextResponse","nextReq","NextRequestAdapter","fromNodeNextRequest","signalFromNodeResponse","invokeRouteModule","span","handle","finally","setAttributes","rootSpanAttributes","getRootSpanAttributes","get","BaseServerSpan","handleRequest","console","warn","route","name","updateName","url","handleResponse","currentSpan","cacheEntry","responseGenerator","previousCacheEntry","setHeader","response","fetchMetrics","pendingWaitUntil","cacheTags","collectedTags","blob","headers","toNodeOutgoingHttpHeaders","NEXT_CACHE_TAGS_HEADER","type","revalidate","collectedRevalidate","INFINITE_CACHE","expire","collectedExpire","value","CachedRouteKind","status","body","Buffer","from","arrayBuffer","cacheControl","sendResponse","err","isStale","routerKind","routePath","routeType","revalidateReason","getRevalidateReason","routeKind","isFallback","isRoutePPREnabled","Error","isMiss","fromNodeOutgoingHttpHeaders","delete","getHeader","set","getCacheControlHeader","Response","withPropagatedContext","trace","spanName","SpanKind","SERVER","attributes"],"mappings":";;;;;;;;;;;;;;;;;;;IA8EsBA,OAAO;eAAPA;;IAHpBC,UAAU;eAAVA;;IAJAC,WAAW;eAAXA;;IAGAC,WAAW;eAAXA;;IAFAC,gBAAgB;eAAhBA;;IACAC,oBAAoB;eAApBA;;;gCArEK;2BACmB;4BACgB;6BAEX;wBACgB;0BACd;sBACiB;6BAI3C;2BACwB;uBACK;8BACP;wBAItB;8BAC+B;4BACiB;yCACvB;+BAKzB;sEAEmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAO1B,2EAA2E;AAC3E,UAAU;AACV,0BAA0B;AAE1B,MAAMH,cAAc,IAAII,mCAAmB,CAAC;I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K;QACZ,kDAAkD;QAClD,IAAI,CAAC5E,cAAc,CAAE4E,CAAAA,eAAepF,wCAAe,AAAD,GAAI;YACpD,MAAMxD,YAAYoF,cAAc,CAAC7D,KAAKqH,KAAK;gBACzCE,YAAY;gBACZC,WAAWhG;gBACXiG,WAAW;gBACXC,kBAAkBC,IAAAA,0BAAmB,EAAC;oBACpCtF;oBACAhB;gBACF;YACF;QACF;QAEA,mDAAmD;QAEnD,8DAA8D;QAC9D,IAAIK,OAAO,MAAM2F;QAEjB,kCAAkC;QAClC,MAAMD,IAAAA,0BAAY,EAChBrD,aACAE,aACA,IAAIqE,SAAS,MAAM;YAAExB,QAAQ;QAAI;QAEnC,OAAO;IACT;AACF","ignoreList":[0]}
|
@@ -632,15 +632,17 @@ async function handler(req, res, ctx) {
|
|
632
632
|
}, handleResponse));
|
633
633
|
}
|
634
634
|
} catch (err) {
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
635
|
+
if (!(err instanceof _nofallbackerrorexternal.NoFallbackError)) {
|
636
|
+
await routeModule.onRequestError(req, err, {
|
637
|
+
routerKind: 'Pages Router',
|
638
|
+
routePath: srcPage,
|
639
|
+
routeType: 'render',
|
640
|
+
revalidateReason: (0, _utils.getRevalidateReason)({
|
641
|
+
isRevalidate: hasStaticProps,
|
642
|
+
isOnDemandRevalidate
|
643
|
+
})
|
644
|
+
}, routerServerContext);
|
645
|
+
}
|
644
646
|
// rethrow so that we can handle serving error page
|
645
647
|
throw err;
|
646
648
|
}
|