next 16.0.2-canary.10 → 16.0.2-canary.12

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.
Files changed (114) hide show
  1. package/dist/bin/next +1 -1
  2. package/dist/build/babel/loader/get-config.js +5 -0
  3. package/dist/build/babel/loader/get-config.js.map +1 -1
  4. package/dist/build/index.js +7 -4
  5. package/dist/build/index.js.map +1 -1
  6. package/dist/build/jest/jest.js +2 -1
  7. package/dist/build/jest/jest.js.map +1 -1
  8. package/dist/build/load-entrypoint.js +1 -2
  9. package/dist/build/load-entrypoint.js.map +1 -1
  10. package/dist/build/lockfile.d.ts +1 -1
  11. package/dist/build/lockfile.js +5 -9
  12. package/dist/build/lockfile.js.map +1 -1
  13. package/dist/build/next-config-ts/transpile-config.js +13 -3
  14. package/dist/build/next-config-ts/transpile-config.js.map +1 -1
  15. package/dist/build/swc/index.d.ts +4 -2
  16. package/dist/build/swc/index.js +54 -51
  17. package/dist/build/swc/index.js.map +1 -1
  18. package/dist/build/swc/install-bindings.d.ts +15 -0
  19. package/dist/build/swc/install-bindings.js +30 -0
  20. package/dist/build/swc/install-bindings.js.map +1 -0
  21. package/dist/build/templates/app-page.js +7 -1
  22. package/dist/build/templates/app-page.js.map +1 -1
  23. package/dist/build/turbopack-build/impl.js +9 -4
  24. package/dist/build/turbopack-build/impl.js.map +1 -1
  25. package/dist/build/webpack/loaders/lightningcss-loader/src/loader.js +7 -2
  26. package/dist/build/webpack/loaders/lightningcss-loader/src/loader.js.map +1 -1
  27. package/dist/build/webpack/loaders/lightningcss-loader/src/minify.js +2 -2
  28. package/dist/build/webpack/loaders/lightningcss-loader/src/minify.js.map +1 -1
  29. package/dist/build/webpack/loaders/next-app-loader/index.js +6 -0
  30. package/dist/build/webpack/loaders/next-app-loader/index.js.map +1 -1
  31. package/dist/build/webpack/loaders/next-barrel-loader.js +5 -0
  32. package/dist/build/webpack/loaders/next-barrel-loader.js.map +1 -1
  33. package/dist/build/webpack/loaders/next-metadata-image-loader.js +5 -0
  34. package/dist/build/webpack/loaders/next-metadata-image-loader.js.map +1 -1
  35. package/dist/build/webpack/loaders/next-metadata-route-loader.js +5 -0
  36. package/dist/build/webpack/loaders/next-metadata-route-loader.js.map +1 -1
  37. package/dist/build/webpack/loaders/next-swc-loader.js +10 -6
  38. package/dist/build/webpack/loaders/next-swc-loader.js.map +1 -1
  39. package/dist/build/webpack-build/impl.js +4 -1
  40. package/dist/build/webpack-build/impl.js.map +1 -1
  41. package/dist/build/webpack-config.js +2 -7
  42. package/dist/build/webpack-config.js.map +1 -1
  43. package/dist/cli/next-typegen.js +3 -0
  44. package/dist/cli/next-typegen.js.map +1 -1
  45. package/dist/client/app-bootstrap.js +1 -1
  46. package/dist/client/index.js +1 -1
  47. package/dist/compiled/@next/font/dist/google/font-data.json +63 -0
  48. package/dist/compiled/@next/font/dist/google/index.d.ts +40 -0
  49. package/dist/esm/build/babel/loader/get-config.js +5 -0
  50. package/dist/esm/build/babel/loader/get-config.js.map +1 -1
  51. package/dist/esm/build/index.js +7 -4
  52. package/dist/esm/build/index.js.map +1 -1
  53. package/dist/esm/build/load-entrypoint.js +2 -3
  54. package/dist/esm/build/load-entrypoint.js.map +1 -1
  55. package/dist/esm/build/lockfile.js +5 -9
  56. package/dist/esm/build/lockfile.js.map +1 -1
  57. package/dist/esm/build/next-config-ts/transpile-config.js +13 -3
  58. package/dist/esm/build/next-config-ts/transpile-config.js.map +1 -1
  59. package/dist/esm/build/swc/index.js +52 -49
  60. package/dist/esm/build/swc/index.js.map +1 -1
  61. package/dist/esm/build/swc/install-bindings.js +20 -0
  62. package/dist/esm/build/swc/install-bindings.js.map +1 -0
  63. package/dist/esm/build/templates/app-page.js +7 -1
  64. package/dist/esm/build/templates/app-page.js.map +1 -1
  65. package/dist/esm/build/turbopack-build/impl.js +10 -5
  66. package/dist/esm/build/turbopack-build/impl.js.map +1 -1
  67. package/dist/esm/build/webpack/loaders/lightningcss-loader/src/loader.js +7 -2
  68. package/dist/esm/build/webpack/loaders/lightningcss-loader/src/loader.js.map +1 -1
  69. package/dist/esm/build/webpack/loaders/lightningcss-loader/src/minify.js +2 -2
  70. package/dist/esm/build/webpack/loaders/lightningcss-loader/src/minify.js.map +1 -1
  71. package/dist/esm/build/webpack/loaders/next-app-loader/index.js +6 -0
  72. package/dist/esm/build/webpack/loaders/next-app-loader/index.js.map +1 -1
  73. package/dist/esm/build/webpack/loaders/next-barrel-loader.js +5 -0
  74. package/dist/esm/build/webpack/loaders/next-barrel-loader.js.map +1 -1
  75. package/dist/esm/build/webpack/loaders/next-metadata-image-loader.js +5 -0
  76. package/dist/esm/build/webpack/loaders/next-metadata-image-loader.js.map +1 -1
  77. package/dist/esm/build/webpack/loaders/next-metadata-route-loader.js +5 -0
  78. package/dist/esm/build/webpack/loaders/next-metadata-route-loader.js.map +1 -1
  79. package/dist/esm/build/webpack/loaders/next-swc-loader.js +11 -7
  80. package/dist/esm/build/webpack/loaders/next-swc-loader.js.map +1 -1
  81. package/dist/esm/build/webpack-build/impl.js +4 -1
  82. package/dist/esm/build/webpack-build/impl.js.map +1 -1
  83. package/dist/esm/build/webpack-config.js +2 -7
  84. package/dist/esm/build/webpack-config.js.map +1 -1
  85. package/dist/esm/client/app-bootstrap.js +1 -1
  86. package/dist/esm/client/index.js +1 -1
  87. package/dist/esm/server/config.js +2 -2
  88. package/dist/esm/server/config.js.map +1 -1
  89. package/dist/esm/server/dev/hot-reloader-turbopack.js +3 -4
  90. package/dist/esm/server/dev/hot-reloader-turbopack.js.map +1 -1
  91. package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
  92. package/dist/esm/server/lib/app-info-log.js +1 -1
  93. package/dist/esm/server/lib/router-utils/setup-dev-bundler.js +3 -0
  94. package/dist/esm/server/lib/router-utils/setup-dev-bundler.js.map +1 -1
  95. package/dist/esm/server/lib/start-server.js +1 -1
  96. package/dist/esm/server/lib/trace/tracer.js +6 -5
  97. package/dist/esm/server/lib/trace/tracer.js.map +1 -1
  98. package/dist/esm/shared/lib/errors/canary-only-config-error.js +1 -1
  99. package/dist/server/config.js +2 -2
  100. package/dist/server/config.js.map +1 -1
  101. package/dist/server/dev/hot-reloader-turbopack.js +2 -3
  102. package/dist/server/dev/hot-reloader-turbopack.js.map +1 -1
  103. package/dist/server/dev/hot-reloader-webpack.js +1 -1
  104. package/dist/server/lib/app-info-log.js +1 -1
  105. package/dist/server/lib/router-utils/setup-dev-bundler.js +3 -0
  106. package/dist/server/lib/router-utils/setup-dev-bundler.js.map +1 -1
  107. package/dist/server/lib/start-server.js +1 -1
  108. package/dist/server/lib/trace/tracer.js +6 -5
  109. package/dist/server/lib/trace/tracer.js.map +1 -1
  110. package/dist/shared/lib/errors/canary-only-config-error.js +1 -1
  111. package/dist/telemetry/anonymous-meta.js +1 -1
  112. package/dist/telemetry/events/session-stopped.js +2 -2
  113. package/dist/telemetry/events/version.js +2 -2
  114. 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 { addRequestMeta, getRequestMeta } from '../../server/request-meta'\nimport { BaseServerSpan } from '../../server/lib/trace/constants'\nimport { interopDefault } from '../../server/app-render/interop-default'\nimport { stripFlightHeaders } from '../../server/app-render/strip-flight-headers'\nimport { NodeNextRequest, NodeNextResponse } from '../../server/base-http/node'\nimport { checkIsAppPPREnabled } from '../../server/lib/experimental/ppr'\nimport {\n getFallbackRouteParams,\n createOpaqueFallbackRouteParams,\n type OpaqueFallbackRouteParams,\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 RSC_CONTENT_TYPE_HEADER,\n} from '../../client/components/app-router-headers'\nimport { getBotType, isBot } from '../../shared/lib/router/utils/is-bot'\nimport {\n CachedRouteKind,\n IncrementalCacheKind,\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 {\n CACHE_ONE_YEAR,\n HTML_CONTENT_TYPE_HEADER,\n NEXT_CACHE_TAGS_HEADER,\n} 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\n\n// We inject the tree and pages here so that we can use them in the route\n// module.\n// INJECT:tree\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'\nimport { InvariantError } from '../../shared/lib/invariant-error'\nimport { scheduleOnNextTick } from '../../lib/scheduler'\nimport { isInterceptionRouteAppPath } from '../../shared/lib/router/utils/interception-routes'\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 relativeProjectDir: 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 if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint())\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 isMinimalMode = Boolean(\n process.env.MINIMAL_MODE || getRequestMeta(req, 'minimalMode')\n )\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 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 parsedUrl,\n interceptionRoutePatterns,\n } = prepareResult\n\n const normalizedSrcPage = normalizeAppPath(srcPage)\n\n let { isOnDemandRevalidate } = prepareResult\n\n // We use the resolvedPathname instead of the parsedUrl.pathname because it\n // is not rewritten as resolvedPathname is. This will ensure that the correct\n // prerender info is used instead of using the original pathname as the\n // source. If however PPR is enabled and cacheComponents is disabled, we\n // treat the pathname as dynamic. Currently, there's a bug in the PPR\n // implementation that incorrectly leaves %%drp placeholders in the output of\n // parallel routes. This is addressed with cacheComponents.\n const prerenderInfo =\n nextConfig.experimental.ppr &&\n !nextConfig.cacheComponents &&\n isInterceptionRouteAppPath(resolvedPathname)\n ? null\n : routeModule.match(resolvedPathname, prerenderManifest)\n\n const isPrerendered = !!prerenderManifest.routes[resolvedPathname]\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 req.headers[NEXT_ROUTER_PREFETCH_HEADER] === '1' // exclude runtime prefetches, which use '2'\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\n ? getRequestMeta(req, 'postponed')\n : 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 const serveStreamingMetadata =\n isHtmlBot && isRoutePPREnabled\n ? false\n : !userAgent\n ? true\n : shouldServeStreamingMetadata(userAgent, nextConfig.htmlLimitedBots)\n\n const isSSG = Boolean(\n (prerenderInfo ||\n isPrerendered ||\n prerenderManifest.routes[normalizedSrcPage]) &&\n // If this is a html bot request and PPR is enabled, then we don't want\n // to serve a static response.\n !(isHtmlBot && isRoutePPREnabled)\n )\n\n // When a page supports cacheComponents, we can support RDC for Navigations\n const supportsRDCForNavigations =\n isRoutePPREnabled && nextConfig.cacheComponents === true\n\n // In development, we always want to generate dynamic HTML.\n const 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 minimalPostponed === 'string' ||\n // If this handler supports onCacheEntryV2, then we can only support\n // dynamic responses if it's a dynamic RSC request and not in minimal mode. If it\n // doesn't support it we must fallback to the default behavior.\n (supportsRDCForNavigations && getRequestMeta(req, 'onCacheEntryV2')\n ? // In minimal mode, we'll always want to generate a static response\n // which will generate the RDC for the route. When resuming a Dynamic\n // RSC request, we'll pass the minimal postponed data to the render\n // which will trigger the `supportsDynamicResponse` to be true.\n isDynamicRSCRequest && !isMinimalMode\n : // Otherwise, we can support dynamic responses if it's a dynamic RSC request.\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 // If this is a request for an app path that should be statically generated\n // and we aren't in the edge runtime, strip the flight headers so it will\n // generate the static response.\n if (\n !routeModule.isDev &&\n !isDraftMode &&\n isSSG &&\n isRSCRequest &&\n !isDynamicRSCRequest\n ) {\n stripFlightHeaders(req.headers)\n }\n\n const ComponentMod = {\n ...entryBase,\n tree,\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 const render404 = async () => {\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext?.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false)\n } else {\n res.end('This page could not be found')\n }\n return null\n }\n\n try {\n const varyHeader = routeModule.getVaryHeader(\n resolvedPathname,\n interceptionRoutePatterns\n )\n res.setHeader('Vary', varyHeader)\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 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} ${srcPage}`)\n }\n })\n }\n\n const incrementalCache = getRequestMeta(req, 'incrementalCache')\n\n const doRender = async ({\n span,\n postponed,\n fallbackRouteParams,\n forceStaticRender,\n }: {\n span?: Span\n\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: OpaqueFallbackRouteParams | null\n\n /**\n * When true, this indicates that the response generator is being called\n * in a context where the response must be generated statically.\n *\n * CRITICAL: This should only currently be used when revalidating due to a\n * dynamic RSC request.\n */\n forceStaticRender: boolean\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 setCacheStatus: routerServerContext?.setCacheStatus,\n setIsrStatus: routerServerContext?.setIsrStatus,\n setReactDebugChannel: routerServerContext?.setReactDebugChannel,\n\n dir:\n process.env.NEXT_RUNTIME === 'nodejs'\n ? (require('path') as typeof import('path')).join(\n /* turbopackIgnore: true */\n process.cwd(),\n routeModule.relativeProjectDir\n )\n : `${process.cwd()}/${routeModule.relativeProjectDir}`,\n isDraftMode,\n botType,\n isOnDemandRevalidate,\n isPossibleServerAction,\n assetPrefix: nextConfig.assetPrefix,\n nextConfigOutput: nextConfig.output,\n crossOrigin: nextConfig.crossOrigin,\n trailingSlash: nextConfig.trailingSlash,\n images: nextConfig.images,\n previewProps: prerenderManifest.preview,\n deploymentId: nextConfig.deploymentId,\n enableTainting: nextConfig.experimental.taint,\n htmlLimitedBots: nextConfig.htmlLimitedBots,\n reactMaxHeadersLength: nextConfig.reactMaxHeadersLength,\n\n multiZoneDraftMode,\n incrementalCache,\n cacheLifeProfiles: nextConfig.cacheLife,\n basePath: nextConfig.basePath,\n serverActions: nextConfig.experimental.serverActions,\n\n ...(isDebugStaticShell ||\n isDebugDynamicAccesses ||\n isDebugFallbackShell\n ? {\n nextExport: true,\n supportsDynamicResponse: false,\n isStaticGeneration: true,\n isDebugDynamicAccesses: isDebugDynamicAccesses,\n }\n : {}),\n cacheComponents: Boolean(nextConfig.cacheComponents),\n experimental: {\n isRoutePPREnabled,\n expireTime: nextConfig.expireTime,\n staleTimes: nextConfig.experimental.staleTimes,\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 clientParamParsingOrigins:\n nextConfig.experimental.clientParamParsingOrigins,\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 if (isDebugStaticShell || isDebugDynamicAccesses) {\n context.renderOpts.nextExport = true\n context.renderOpts.supportsDynamicResponse = false\n context.renderOpts.isDebugDynamicAccesses = isDebugDynamicAccesses\n }\n\n // When we're revalidating in the background, we should not allow dynamic\n // responses.\n if (forceStaticRender) {\n context.renderOpts.supportsDynamicResponse = false\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 fetchMetrics,\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 = 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: previousIncrementalCacheEntry,\n isRevalidating,\n span,\n forceStaticRender = false,\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 !previousIncrementalCacheEntry &&\n !isMinimalMode\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 HTML bot request, we want to serve a blocking render and\n // not 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 if (!isRoutePPREnabled || isHtmlBot) {\n fallbackMode = FallbackMode.BLOCKING_STATIC_RENDER\n }\n }\n\n if (previousIncrementalCacheEntry?.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 ||\n previousIncrementalCacheEntry)\n ) {\n fallbackMode = FallbackMode.BLOCKING_STATIC_RENDER\n }\n\n if (\n !isMinimalMode &&\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 if (nextConfig.experimental.adapterPath) {\n return await render404()\n }\n throw new NoFallbackError()\n }\n\n // When cacheComponents is enabled, we can use the fallback\n // response if the request is not a dynamic RSC request because the\n // RSC data when this feature flag is enabled does not contain any\n // param references. Without this feature flag enabled, the RSC data\n // contains param references, and therefore we can't use the fallback.\n if (\n isRoutePPREnabled &&\n (nextConfig.cacheComponents ? !isDynamicRSCRequest : !isRSCRequest)\n ) {\n const cacheKey =\n isProduction && typeof prerenderInfo?.fallback === 'string'\n ? prerenderInfo.fallback\n : normalizedSrcPage\n\n const fallbackRouteParams =\n // If we're in production and we have fallback route params, then we\n // can use the manifest fallback route params.\n isProduction && prerenderInfo?.fallbackRouteParams\n ? createOpaqueFallbackRouteParams(\n prerenderInfo.fallbackRouteParams\n )\n : // Otherwise, if we're debugging the fallback shell, then we\n // have to manually generate the fallback route params.\n isDebugFallbackShell\n ? getFallbackRouteParams(normalizedSrcPage, routeModule)\n : null\n\n // We use the response cache here to handle the revalidation and\n // management of the fallback shell.\n const fallbackResponse = await routeModule.handleResponse({\n cacheKey,\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 forceStaticRender: false,\n }),\n waitUntil: ctx.waitUntil,\n isMinimalMode,\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\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 let postponed =\n !isOnDemandRevalidate && !isRevalidating && minimalPostponed\n ? minimalPostponed\n : undefined\n\n // If this is a dynamic RSC request, we should use the postponed data from\n // the static render (if available). This ensures that we can utilize the\n // resume data cache (RDC) from the static render to ensure that the data\n // is consistent between the static and dynamic renders.\n if (\n // Only enable RDC for Navigations if the feature is enabled.\n supportsRDCForNavigations &&\n process.env.NEXT_RUNTIME !== 'edge' &&\n !isMinimalMode &&\n incrementalCache &&\n isDynamicRSCRequest &&\n // We don't typically trigger an on-demand revalidation for dynamic RSC\n // requests, as we're typically revalidating the page in the background\n // instead. However, if the cache entry is stale, we should trigger a\n // background revalidation on dynamic RSC requests. This prevents us\n // from entering an infinite loop of revalidations.\n !forceStaticRender\n ) {\n const incrementalCacheEntry = await incrementalCache.get(\n resolvedPathname,\n {\n kind: IncrementalCacheKind.APP_PAGE,\n isRoutePPREnabled: true,\n isFallback: false,\n }\n )\n\n // If the cache entry is found, we should use the postponed data from\n // the cache.\n if (\n incrementalCacheEntry &&\n incrementalCacheEntry.value &&\n incrementalCacheEntry.value.kind === CachedRouteKind.APP_PAGE\n ) {\n // CRITICAL: we're assigning the postponed data from the cache entry\n // here as we're using the RDC to resume the render.\n postponed = incrementalCacheEntry.value.postponed\n\n // If the cache entry is stale, we should trigger a background\n // revalidation so that subsequent requests will get a fresh response.\n if (\n incrementalCacheEntry &&\n // We want to trigger this flow if the cache entry is stale and if\n // the requested revalidation flow is either foreground or\n // background.\n (incrementalCacheEntry.isStale === -1 ||\n incrementalCacheEntry.isStale === true)\n ) {\n // We want to schedule this on the next tick to ensure that the\n // render is not blocked on it.\n scheduleOnNextTick(async () => {\n const responseCache = routeModule.getResponseCache(req)\n\n try {\n await responseCache.revalidate(\n resolvedPathname,\n incrementalCache,\n isRoutePPREnabled,\n false,\n (c) =>\n responseGenerator({\n ...c,\n // CRITICAL: we need to set this to true as we're\n // revalidating in the background and typically this dynamic\n // RSC request is not treated as static.\n forceStaticRender: true,\n }),\n // CRITICAL: we need to pass null here because passing the\n // previous cache entry here (which is stale) will switch on\n // isOnDemandRevalidate and break the prerendering.\n null,\n hasResolved,\n ctx.waitUntil\n )\n } catch (err) {\n console.error(\n 'Error revalidating the page in the background',\n err\n )\n }\n })\n }\n }\n }\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.EMPTY,\n pageData: {},\n headers: undefined,\n status: undefined,\n } satisfies CachedPageValue,\n }\n }\n\n const fallbackRouteParams =\n // If we're in production and we have fallback route params, then we\n // can use the manifest fallback route params if we need to render the\n // fallback shell.\n isProduction &&\n prerenderInfo?.fallbackRouteParams &&\n getRequestMeta(req, 'renderFallbackShell')\n ? createOpaqueFallbackRouteParams(prerenderInfo.fallbackRouteParams)\n : // Otherwise, if we're debugging the fallback shell, then we have to\n // manually generate the fallback route params.\n isDebugFallbackShell\n ? getFallbackRouteParams(normalizedSrcPage, routeModule)\n : null\n\n // Perform the render.\n return doRender({\n span,\n postponed,\n fallbackRouteParams,\n forceStaticRender,\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 isMinimalMode,\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 (!isMinimalMode) {\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 (isDynamicRSCRequest) {\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 (isMinimalMode && 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 generateEtags: nextConfig.generateEtags,\n poweredByHeader: nextConfig.poweredByHeader,\n result: RenderResult.fromStatic(\n matchedSegment,\n RSC_CONTENT_TYPE_HEADER\n ),\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 generateEtags: nextConfig.generateEtags,\n poweredByHeader: nextConfig.poweredByHeader,\n result: RenderResult.EMPTY,\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. If we support RDC for Navigations, we\n // prefer the `onCacheEntryV2` callback. Once RDC for Navigations is the\n // default, we can remove the fallback to `onCacheEntry` as\n // `onCacheEntryV2` is now fully supported.\n const onCacheEntry = supportsRDCForNavigations\n ? (getRequestMeta(req, 'onCacheEntryV2') ??\n getRequestMeta(req, 'onCacheEntry'))\n : getRequestMeta(req, 'onCacheEntry')\n if (onCacheEntry) {\n const finished = await onCacheEntry(cacheEntry, {\n url: getRequestMeta(req, 'initURL') ?? req.url,\n })\n if (finished) return null\n }\n\n if (cachedData.headers) {\n const headers = { ...cachedData.headers }\n\n if (!isMinimalMode || !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 (isMinimalMode && 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 !isMinimalMode &&\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 && !isDynamicRSCRequest) {\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 the response is not an RSC response, then we can't serve it.\n if (cachedData.html.contentType !== RSC_CONTENT_TYPE_HEADER) {\n if (nextConfig.cacheComponents) {\n res.statusCode = 404\n return sendRenderResult({\n req,\n res,\n generateEtags: nextConfig.generateEtags,\n poweredByHeader: nextConfig.poweredByHeader,\n result: RenderResult.EMPTY,\n cacheControl: cacheEntry.cacheControl,\n })\n } else {\n // Otherwise this case is not expected.\n throw new InvariantError(\n `Expected RSC response, got ${cachedData.html.contentType}`\n )\n }\n }\n\n return sendRenderResult({\n req,\n res,\n generateEtags: nextConfig.generateEtags,\n poweredByHeader: nextConfig.poweredByHeader,\n result: cachedData.html,\n cacheControl: 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 generateEtags: nextConfig.generateEtags,\n poweredByHeader: nextConfig.poweredByHeader,\n result: RenderResult.fromStatic(\n cachedData.rscData,\n RSC_CONTENT_TYPE_HEADER\n ),\n cacheControl: cacheEntry.cacheControl,\n })\n }\n\n // This is a request for HTML data.\n const 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 || isMinimalMode || isRSCRequest) {\n // If we're in test mode, we should add a sentinel chunk to the response\n // that's between the static and dynamic parts so we can compare the\n // chunks and add assertions.\n if (\n process.env.__NEXT_TEST_MODE &&\n isMinimalMode &&\n isRoutePPREnabled &&\n body.contentType === HTML_CONTENT_TYPE_HEADER\n ) {\n // As we're in minimal mode, the static part would have already been\n // streamed first. The only part that this streams is the dynamic part\n // so we should FIRST stream the sentinel and THEN the dynamic part.\n body.unshift(createPPRBoundarySentinel())\n }\n\n return sendRenderResult({\n req,\n res,\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.push(\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 generateEtags: nextConfig.generateEtags,\n poweredByHeader: nextConfig.poweredByHeader,\n result: body,\n cacheControl: { revalidate: 0, expire: undefined },\n })\n }\n\n // If we're in test mode, we should add a sentinel chunk to the response\n // that's between the static and dynamic parts so we can compare the\n // chunks and add assertions.\n if (process.env.__NEXT_TEST_MODE) {\n body.push(createPPRBoundarySentinel())\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.push(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 forceStaticRender: false,\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 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} ${srcPage}`,\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 (!(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 isStaticGeneration: 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\n// TODO: omit this from production builds, only test builds should include it\n/**\n * Creates a readable stream that emits a PPR boundary sentinel.\n *\n * @returns A readable stream that emits a PPR boundary sentinel.\n */\nfunction createPPRBoundarySentinel() {\n return new ReadableStream({\n start(controller) {\n controller.enqueue(\n new TextEncoder().encode('<!-- PPR_BOUNDARY_SENTINEL -->')\n )\n controller.close()\n },\n })\n}\n"],"names":["AppPageRouteModule","RouteKind","getRevalidateReason","getTracer","SpanKind","addRequestMeta","getRequestMeta","BaseServerSpan","interopDefault","stripFlightHeaders","NodeNextRequest","NodeNextResponse","checkIsAppPPREnabled","getFallbackRouteParams","createOpaqueFallbackRouteParams","setReferenceManifestsSingleton","isHtmlBotRequest","shouldServeStreamingMetadata","createServerModuleMap","normalizeAppPath","getIsPossibleServerAction","RSC_HEADER","NEXT_ROUTER_PREFETCH_HEADER","NEXT_IS_PRERENDER_HEADER","NEXT_DID_POSTPONE_HEADER","RSC_CONTENT_TYPE_HEADER","getBotType","isBot","CachedRouteKind","IncrementalCacheKind","FallbackMode","parseFallbackField","RenderResult","CACHE_ONE_YEAR","HTML_CONTENT_TYPE_HEADER","NEXT_CACHE_TAGS_HEADER","ENCODED_TAGS","sendRenderResult","NoFallbackError","GlobalError","__next_app__","require","__next_app_require__","loadChunk","__next_app_load_chunk__","entryBase","RedirectStatusCode","InvariantError","scheduleOnNextTick","isInterceptionRouteAppPath","routeModule","definition","kind","APP_PAGE","page","pathname","bundlePath","filename","appPaths","userland","loaderTree","tree","distDir","process","env","__NEXT_RELATIVE_DIST_DIR","relativeProjectDir","__NEXT_RELATIVE_PROJECT_DIR","handler","req","res","ctx","prerenderManifest","isDev","hrtime","bigint","srcPage","TURBOPACK","replace","multiZoneDraftMode","__NEXT_MULTI_ZONE_DRAFT_MODE","isMinimalMode","Boolean","MINIMAL_MODE","prepareResult","prepare","statusCode","end","waitUntil","Promise","resolve","buildId","query","params","pageIsDynamic","buildManifest","nextFontManifest","reactLoadableManifest","serverActionsManifest","clientReferenceManifest","subresourceIntegrityManifest","isDraftMode","resolvedPathname","revalidateOnlyGenerated","routerServerContext","nextConfig","parsedUrl","interceptionRoutePatterns","normalizedSrcPage","isOnDemandRevalidate","prerenderInfo","experimental","ppr","cacheComponents","match","isPrerendered","routes","userAgent","headers","botType","isHtmlBot","isPrefetchRSCRequest","isRSCRequest","isPossibleServerAction","couldSupportPPR","hasDebugStaticShellQuery","__NEXT_EXPERIMENTAL_STATIC_SHELL_DEBUGGING","__nextppronly","hasDebugFallbackShellQuery","isRoutePPREnabled","dynamicRoutes","renderingMode","experimentalTestProxy","isDebugStaticShell","isDebugDynamicAccesses","isDebugFallbackShell","minimalPostponed","undefined","isDynamicRSCRequest","segmentPrefetchHeader","serveStreamingMetadata","htmlLimitedBots","isSSG","supportsRDCForNavigations","supportsDynamicResponse","shouldWaitOnAllReady","ssgCacheKey","staticPathKey","ComponentMod","serverModuleMap","method","tracer","activeSpan","getActiveScopeSpan","render404","varyHeader","getVaryHeader","setHeader","invokeRouteModule","span","context","nextReq","nextRes","render","finally","setAttributes","rootSpanAttributes","getRootSpanAttributes","get","handleRequest","console","warn","route","name","updateName","incrementalCache","doRender","postponed","fallbackRouteParams","forceStaticRender","sharedContext","serverComponentsHmrCache","renderOpts","App","Document","pageConfig","Component","setCacheStatus","setIsrStatus","setReactDebugChannel","dir","NEXT_RUNTIME","join","cwd","assetPrefix","nextConfigOutput","output","crossOrigin","trailingSlash","images","previewProps","preview","deploymentId","enableTainting","taint","reactMaxHeadersLength","cacheLifeProfiles","cacheLife","basePath","serverActions","nextExport","isStaticGeneration","expireTime","staleTimes","dynamicOnHover","inlineCss","authInterrupts","clientTraceMetadata","clientParamParsingOrigins","onClose","cb","on","onAfterTaskError","onInstrumentationRequestError","error","_request","errorContext","onRequestError","err","dev","result","metadata","cacheControl","fetchTags","cacheTags","fetchMetrics","revalidate","staticBailoutInfo","Error","description","stack","message","substring","indexOf","value","html","rscData","flightData","status","segmentData","responseGenerator","hasResolved","previousCacheEntry","previousIncrementalCacheEntry","isRevalidating","isProduction","didRespond","writableEnded","fallbackMode","fallback","PRERENDER","BLOCKING_STATIC_RENDER","isStale","NOT_FOUND","adapterPath","cacheKey","fallbackResponse","handleResponse","routeKind","isFallback","incrementalCacheEntry","responseCache","getResponseCache","c","expire","PAGES","EMPTY","pageData","cacheEntry","cachedData","didPostpone","isMiss","getHeader","tags","matchedSegment","generateEtags","poweredByHeader","fromStatic","onCacheEntry","finished","url","key","Object","entries","Array","isArray","v","appendHeader","toString","contentType","body","__NEXT_TEST_MODE","unshift","createPPRBoundarySentinel","push","ReadableStream","start","controller","enqueue","CLOSED","BODY_AND_HTML","close","transformer","TransformStream","readable","then","pipeTo","writable","catch","abort","e","withPropagatedContext","trace","spanName","SERVER","attributes","routerKind","routePath","routeType","revalidateReason","TextEncoder","encode"],"mappings":"AAGA,SACEA,kBAAkB,QAEb,2DAA2D;IAAE,wBAAwB;AAAW,EAAC;AAExG,SAASC,SAAS,QAAQ,+BAA+B;IAAE,wBAAwB;AAAsB,EAAC;AAE1G,SAASC,mBAAmB,QAAQ,qCAAoC;AACxE,SAASC,SAAS,EAAEC,QAAQ,QAAmB,gCAA+B;AAC9E,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AAYiL,cAAc,CAC9B9J,KACA+J,KACA;gBACEkG,YAAY;gBACZC,WAAW3P;gBACX4P,WAAW;gBACXC,kBAAkBvU,oBAAoB;oBACpCiN,oBAAoBrE;oBACpBjC;gBACF;YACF,GACAL;QAEJ;QAEA,mDAAmD;QACnD,MAAM4H;IACR;AACF;AAEA,6EAA6E;AAC7E;;;;CAIC,GACD,SAAS2E;IACP,OAAO,IAAIE,eAAe;QACxBC,OAAMC,UAAU;YACdA,WAAWC,OAAO,CAChB,IAAIsB,cAAcC,MAAM,CAAC;YAE3BxB,WAAWI,KAAK;QAClB;IACF;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 { addRequestMeta, getRequestMeta } from '../../server/request-meta'\nimport { BaseServerSpan } from '../../server/lib/trace/constants'\nimport { interopDefault } from '../../server/app-render/interop-default'\nimport { stripFlightHeaders } from '../../server/app-render/strip-flight-headers'\nimport { NodeNextRequest, NodeNextResponse } from '../../server/base-http/node'\nimport { checkIsAppPPREnabled } from '../../server/lib/experimental/ppr'\nimport {\n getFallbackRouteParams,\n createOpaqueFallbackRouteParams,\n type OpaqueFallbackRouteParams,\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 RSC_CONTENT_TYPE_HEADER,\n} from '../../client/components/app-router-headers'\nimport { getBotType, isBot } from '../../shared/lib/router/utils/is-bot'\nimport {\n CachedRouteKind,\n IncrementalCacheKind,\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 {\n CACHE_ONE_YEAR,\n HTML_CONTENT_TYPE_HEADER,\n NEXT_CACHE_TAGS_HEADER,\n} 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\n\n// We inject the tree and pages here so that we can use them in the route\n// module.\n// INJECT:tree\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'\nimport { InvariantError } from '../../shared/lib/invariant-error'\nimport { scheduleOnNextTick } from '../../lib/scheduler'\nimport { isInterceptionRouteAppPath } from '../../shared/lib/router/utils/interception-routes'\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 relativeProjectDir: 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 if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint())\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 isMinimalMode = Boolean(\n process.env.MINIMAL_MODE || getRequestMeta(req, 'minimalMode')\n )\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 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 parsedUrl,\n interceptionRoutePatterns,\n } = prepareResult\n\n const normalizedSrcPage = normalizeAppPath(srcPage)\n\n let { isOnDemandRevalidate } = prepareResult\n\n // We use the resolvedPathname instead of the parsedUrl.pathname because it\n // is not rewritten as resolvedPathname is. This will ensure that the correct\n // prerender info is used instead of using the original pathname as the\n // source. If however PPR is enabled and cacheComponents is disabled, we\n // treat the pathname as dynamic. Currently, there's a bug in the PPR\n // implementation that incorrectly leaves %%drp placeholders in the output of\n // parallel routes. This is addressed with cacheComponents.\n const prerenderInfo =\n nextConfig.experimental.ppr &&\n !nextConfig.cacheComponents &&\n isInterceptionRouteAppPath(resolvedPathname)\n ? null\n : routeModule.match(resolvedPathname, prerenderManifest)\n\n const isPrerendered = !!prerenderManifest.routes[resolvedPathname]\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 req.headers[NEXT_ROUTER_PREFETCH_HEADER] === '1' // exclude runtime prefetches, which use '2'\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\n ? getRequestMeta(req, 'postponed')\n : 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 let isDynamicRSCRequest =\n isRoutePPREnabled && isRSCRequest && !isPrefetchRSCRequest\n\n // During a PPR revalidation, the RSC request is not dynamic if we do not have the postponed data.\n // We only attach the postponed data during a resume. If there's no postponed data, then it must be a revalidation.\n // This is to ensure that we don't bypass the cache during a revalidation.\n if (isMinimalMode) {\n isDynamicRSCRequest = isDynamicRSCRequest && !!minimalPostponed\n }\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 const serveStreamingMetadata =\n isHtmlBot && isRoutePPREnabled\n ? false\n : !userAgent\n ? true\n : shouldServeStreamingMetadata(userAgent, nextConfig.htmlLimitedBots)\n\n const isSSG = Boolean(\n (prerenderInfo ||\n isPrerendered ||\n prerenderManifest.routes[normalizedSrcPage]) &&\n // If this is a html bot request and PPR is enabled, then we don't want\n // to serve a static response.\n !(isHtmlBot && isRoutePPREnabled)\n )\n\n // When a page supports cacheComponents, we can support RDC for Navigations\n const supportsRDCForNavigations =\n isRoutePPREnabled && nextConfig.cacheComponents === true\n\n // In development, we always want to generate dynamic HTML.\n const 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 minimalPostponed === 'string' ||\n // If this handler supports onCacheEntryV2, then we can only support\n // dynamic responses if it's a dynamic RSC request and not in minimal mode. If it\n // doesn't support it we must fallback to the default behavior.\n (supportsRDCForNavigations && getRequestMeta(req, 'onCacheEntryV2')\n ? // In minimal mode, we'll always want to generate a static response\n // which will generate the RDC for the route. When resuming a Dynamic\n // RSC request, we'll pass the minimal postponed data to the render\n // which will trigger the `supportsDynamicResponse` to be true.\n isDynamicRSCRequest && !isMinimalMode\n : // Otherwise, we can support dynamic responses if it's a dynamic RSC request.\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 // If this is a request for an app path that should be statically generated\n // and we aren't in the edge runtime, strip the flight headers so it will\n // generate the static response.\n if (\n !routeModule.isDev &&\n !isDraftMode &&\n isSSG &&\n isRSCRequest &&\n !isDynamicRSCRequest\n ) {\n stripFlightHeaders(req.headers)\n }\n\n const ComponentMod = {\n ...entryBase,\n tree,\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 const render404 = async () => {\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext?.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false)\n } else {\n res.end('This page could not be found')\n }\n return null\n }\n\n try {\n const varyHeader = routeModule.getVaryHeader(\n resolvedPathname,\n interceptionRoutePatterns\n )\n res.setHeader('Vary', varyHeader)\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 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} ${srcPage}`)\n }\n })\n }\n\n const incrementalCache = getRequestMeta(req, 'incrementalCache')\n\n const doRender = async ({\n span,\n postponed,\n fallbackRouteParams,\n forceStaticRender,\n }: {\n span?: Span\n\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: OpaqueFallbackRouteParams | null\n\n /**\n * When true, this indicates that the response generator is being called\n * in a context where the response must be generated statically.\n *\n * CRITICAL: This should only currently be used when revalidating due to a\n * dynamic RSC request.\n */\n forceStaticRender: boolean\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 setCacheStatus: routerServerContext?.setCacheStatus,\n setIsrStatus: routerServerContext?.setIsrStatus,\n setReactDebugChannel: routerServerContext?.setReactDebugChannel,\n\n dir:\n process.env.NEXT_RUNTIME === 'nodejs'\n ? (require('path') as typeof import('path')).join(\n /* turbopackIgnore: true */\n process.cwd(),\n routeModule.relativeProjectDir\n )\n : `${process.cwd()}/${routeModule.relativeProjectDir}`,\n isDraftMode,\n botType,\n isOnDemandRevalidate,\n isPossibleServerAction,\n assetPrefix: nextConfig.assetPrefix,\n nextConfigOutput: nextConfig.output,\n crossOrigin: nextConfig.crossOrigin,\n trailingSlash: nextConfig.trailingSlash,\n images: nextConfig.images,\n previewProps: prerenderManifest.preview,\n deploymentId: nextConfig.deploymentId,\n enableTainting: nextConfig.experimental.taint,\n htmlLimitedBots: nextConfig.htmlLimitedBots,\n reactMaxHeadersLength: nextConfig.reactMaxHeadersLength,\n\n multiZoneDraftMode,\n incrementalCache,\n cacheLifeProfiles: nextConfig.cacheLife,\n basePath: nextConfig.basePath,\n serverActions: nextConfig.experimental.serverActions,\n\n ...(isDebugStaticShell ||\n isDebugDynamicAccesses ||\n isDebugFallbackShell\n ? {\n nextExport: true,\n supportsDynamicResponse: false,\n isStaticGeneration: true,\n isDebugDynamicAccesses: isDebugDynamicAccesses,\n }\n : {}),\n cacheComponents: Boolean(nextConfig.cacheComponents),\n experimental: {\n isRoutePPREnabled,\n expireTime: nextConfig.expireTime,\n staleTimes: nextConfig.experimental.staleTimes,\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 clientParamParsingOrigins:\n nextConfig.experimental.clientParamParsingOrigins,\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 if (isDebugStaticShell || isDebugDynamicAccesses) {\n context.renderOpts.nextExport = true\n context.renderOpts.supportsDynamicResponse = false\n context.renderOpts.isDebugDynamicAccesses = isDebugDynamicAccesses\n }\n\n // When we're revalidating in the background, we should not allow dynamic\n // responses.\n if (forceStaticRender) {\n context.renderOpts.supportsDynamicResponse = false\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 fetchMetrics,\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 = 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: previousIncrementalCacheEntry,\n isRevalidating,\n span,\n forceStaticRender = false,\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 !previousIncrementalCacheEntry &&\n !isMinimalMode\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 HTML bot request, we want to serve a blocking render and\n // not 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 if (!isRoutePPREnabled || isHtmlBot) {\n fallbackMode = FallbackMode.BLOCKING_STATIC_RENDER\n }\n }\n\n if (previousIncrementalCacheEntry?.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 ||\n previousIncrementalCacheEntry)\n ) {\n fallbackMode = FallbackMode.BLOCKING_STATIC_RENDER\n }\n\n if (\n !isMinimalMode &&\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 if (nextConfig.experimental.adapterPath) {\n return await render404()\n }\n throw new NoFallbackError()\n }\n\n // When cacheComponents is enabled, we can use the fallback\n // response if the request is not a dynamic RSC request because the\n // RSC data when this feature flag is enabled does not contain any\n // param references. Without this feature flag enabled, the RSC data\n // contains param references, and therefore we can't use the fallback.\n if (\n isRoutePPREnabled &&\n (nextConfig.cacheComponents ? !isDynamicRSCRequest : !isRSCRequest)\n ) {\n const cacheKey =\n isProduction && typeof prerenderInfo?.fallback === 'string'\n ? prerenderInfo.fallback\n : normalizedSrcPage\n\n const fallbackRouteParams =\n // If we're in production and we have fallback route params, then we\n // can use the manifest fallback route params.\n isProduction && prerenderInfo?.fallbackRouteParams\n ? createOpaqueFallbackRouteParams(\n prerenderInfo.fallbackRouteParams\n )\n : // Otherwise, if we're debugging the fallback shell, then we\n // have to manually generate the fallback route params.\n isDebugFallbackShell\n ? getFallbackRouteParams(normalizedSrcPage, routeModule)\n : null\n\n // We use the response cache here to handle the revalidation and\n // management of the fallback shell.\n const fallbackResponse = await routeModule.handleResponse({\n cacheKey,\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 forceStaticRender: false,\n }),\n waitUntil: ctx.waitUntil,\n isMinimalMode,\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\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 let postponed =\n !isOnDemandRevalidate && !isRevalidating && minimalPostponed\n ? minimalPostponed\n : undefined\n\n // If this is a dynamic RSC request, we should use the postponed data from\n // the static render (if available). This ensures that we can utilize the\n // resume data cache (RDC) from the static render to ensure that the data\n // is consistent between the static and dynamic renders.\n if (\n // Only enable RDC for Navigations if the feature is enabled.\n supportsRDCForNavigations &&\n process.env.NEXT_RUNTIME !== 'edge' &&\n !isMinimalMode &&\n incrementalCache &&\n isDynamicRSCRequest &&\n // We don't typically trigger an on-demand revalidation for dynamic RSC\n // requests, as we're typically revalidating the page in the background\n // instead. However, if the cache entry is stale, we should trigger a\n // background revalidation on dynamic RSC requests. This prevents us\n // from entering an infinite loop of revalidations.\n !forceStaticRender\n ) {\n const incrementalCacheEntry = await incrementalCache.get(\n resolvedPathname,\n {\n kind: IncrementalCacheKind.APP_PAGE,\n isRoutePPREnabled: true,\n isFallback: false,\n }\n )\n\n // If the cache entry is found, we should use the postponed data from\n // the cache.\n if (\n incrementalCacheEntry &&\n incrementalCacheEntry.value &&\n incrementalCacheEntry.value.kind === CachedRouteKind.APP_PAGE\n ) {\n // CRITICAL: we're assigning the postponed data from the cache entry\n // here as we're using the RDC to resume the render.\n postponed = incrementalCacheEntry.value.postponed\n\n // If the cache entry is stale, we should trigger a background\n // revalidation so that subsequent requests will get a fresh response.\n if (\n incrementalCacheEntry &&\n // We want to trigger this flow if the cache entry is stale and if\n // the requested revalidation flow is either foreground or\n // background.\n (incrementalCacheEntry.isStale === -1 ||\n incrementalCacheEntry.isStale === true)\n ) {\n // We want to schedule this on the next tick to ensure that the\n // render is not blocked on it.\n scheduleOnNextTick(async () => {\n const responseCache = routeModule.getResponseCache(req)\n\n try {\n await responseCache.revalidate(\n resolvedPathname,\n incrementalCache,\n isRoutePPREnabled,\n false,\n (c) =>\n responseGenerator({\n ...c,\n // CRITICAL: we need to set this to true as we're\n // revalidating in the background and typically this dynamic\n // RSC request is not treated as static.\n forceStaticRender: true,\n }),\n // CRITICAL: we need to pass null here because passing the\n // previous cache entry here (which is stale) will switch on\n // isOnDemandRevalidate and break the prerendering.\n null,\n hasResolved,\n ctx.waitUntil\n )\n } catch (err) {\n console.error(\n 'Error revalidating the page in the background',\n err\n )\n }\n })\n }\n }\n }\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.EMPTY,\n pageData: {},\n headers: undefined,\n status: undefined,\n } satisfies CachedPageValue,\n }\n }\n\n const fallbackRouteParams =\n // If we're in production and we have fallback route params, then we\n // can use the manifest fallback route params if we need to render the\n // fallback shell.\n isProduction &&\n prerenderInfo?.fallbackRouteParams &&\n getRequestMeta(req, 'renderFallbackShell')\n ? createOpaqueFallbackRouteParams(prerenderInfo.fallbackRouteParams)\n : // Otherwise, if we're debugging the fallback shell, then we have to\n // manually generate the fallback route params.\n isDebugFallbackShell\n ? getFallbackRouteParams(normalizedSrcPage, routeModule)\n : null\n\n // Perform the render.\n return doRender({\n span,\n postponed,\n fallbackRouteParams,\n forceStaticRender,\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 isMinimalMode,\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 (!isMinimalMode) {\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 (isDynamicRSCRequest) {\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 (isMinimalMode && 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 generateEtags: nextConfig.generateEtags,\n poweredByHeader: nextConfig.poweredByHeader,\n result: RenderResult.fromStatic(\n matchedSegment,\n RSC_CONTENT_TYPE_HEADER\n ),\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 generateEtags: nextConfig.generateEtags,\n poweredByHeader: nextConfig.poweredByHeader,\n result: RenderResult.EMPTY,\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. If we support RDC for Navigations, we\n // prefer the `onCacheEntryV2` callback. Once RDC for Navigations is the\n // default, we can remove the fallback to `onCacheEntry` as\n // `onCacheEntryV2` is now fully supported.\n const onCacheEntry = supportsRDCForNavigations\n ? (getRequestMeta(req, 'onCacheEntryV2') ??\n getRequestMeta(req, 'onCacheEntry'))\n : getRequestMeta(req, 'onCacheEntry')\n if (onCacheEntry) {\n const finished = await onCacheEntry(cacheEntry, {\n url: getRequestMeta(req, 'initURL') ?? req.url,\n })\n if (finished) return null\n }\n\n if (cachedData.headers) {\n const headers = { ...cachedData.headers }\n\n if (!isMinimalMode || !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 (isMinimalMode && 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 !isMinimalMode &&\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 && !isDynamicRSCRequest) {\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 the response is not an RSC response, then we can't serve it.\n if (cachedData.html.contentType !== RSC_CONTENT_TYPE_HEADER) {\n if (nextConfig.cacheComponents) {\n res.statusCode = 404\n return sendRenderResult({\n req,\n res,\n generateEtags: nextConfig.generateEtags,\n poweredByHeader: nextConfig.poweredByHeader,\n result: RenderResult.EMPTY,\n cacheControl: cacheEntry.cacheControl,\n })\n } else {\n // Otherwise this case is not expected.\n throw new InvariantError(\n `Expected RSC response, got ${cachedData.html.contentType}`\n )\n }\n }\n\n return sendRenderResult({\n req,\n res,\n generateEtags: nextConfig.generateEtags,\n poweredByHeader: nextConfig.poweredByHeader,\n result: cachedData.html,\n cacheControl: 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 generateEtags: nextConfig.generateEtags,\n poweredByHeader: nextConfig.poweredByHeader,\n result: RenderResult.fromStatic(\n cachedData.rscData,\n RSC_CONTENT_TYPE_HEADER\n ),\n cacheControl: cacheEntry.cacheControl,\n })\n }\n\n // This is a request for HTML data.\n const 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 || isMinimalMode || isRSCRequest) {\n // If we're in test mode, we should add a sentinel chunk to the response\n // that's between the static and dynamic parts so we can compare the\n // chunks and add assertions.\n if (\n process.env.__NEXT_TEST_MODE &&\n isMinimalMode &&\n isRoutePPREnabled &&\n body.contentType === HTML_CONTENT_TYPE_HEADER\n ) {\n // As we're in minimal mode, the static part would have already been\n // streamed first. The only part that this streams is the dynamic part\n // so we should FIRST stream the sentinel and THEN the dynamic part.\n body.unshift(createPPRBoundarySentinel())\n }\n\n return sendRenderResult({\n req,\n res,\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.push(\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 generateEtags: nextConfig.generateEtags,\n poweredByHeader: nextConfig.poweredByHeader,\n result: body,\n cacheControl: { revalidate: 0, expire: undefined },\n })\n }\n\n // If we're in test mode, we should add a sentinel chunk to the response\n // that's between the static and dynamic parts so we can compare the\n // chunks and add assertions.\n if (process.env.__NEXT_TEST_MODE) {\n body.push(createPPRBoundarySentinel())\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.push(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 forceStaticRender: false,\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 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} ${srcPage}`,\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 (!(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 isStaticGeneration: 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\n// TODO: omit this from production builds, only test builds should include it\n/**\n * Creates a readable stream that emits a PPR boundary sentinel.\n *\n * @returns A readable stream that emits a PPR boundary sentinel.\n */\nfunction createPPRBoundarySentinel() {\n return new ReadableStream({\n start(controller) {\n controller.enqueue(\n new TextEncoder().encode('<!-- PPR_BOUNDARY_SENTINEL -->')\n )\n controller.close()\n },\n })\n}\n"],"names":["AppPageRouteModule","RouteKind","getRevalidateReason","getTracer","SpanKind","addRequestMeta","getRequestMeta","BaseServerSpan","interopDefault","stripFlightHeaders","NodeNextRequest","NodeNextResponse","checkIsAppPPREnabled","getFallbackRouteParams","createOpaqueFallbackRouteParams","setReferenceManifestsSingleton","isHtmlBotRequest","shouldServeStreamingMetadata","createServerModuleMap","normalizeAppPath","getIsPossibleServerAction","RSC_HEADER","NEXT_ROUTER_PREFETCH_HEADER","NEXT_IS_PRERENDER_HEADER","NEXT_DID_POSTPONE_HEADER","RSC_CONTENT_TYPE_HEADER","getBotType","isBot","CachedRouteKind","IncrementalCacheKind","FallbackMode","parseFallbackField","RenderResult","CACHE_ONE_YEAR","HTML_CONTENT_TYPE_HEADER","NEXT_CACHE_TAGS_HEADER","ENCODED_TAGS","sendRenderResult","NoFallbackError","GlobalError","__next_app__","require","__next_app_require__","loadChunk","__next_app_load_chunk__","entryBase","RedirectStatusCode","InvariantError","scheduleOnNextTick","isInterceptionRouteAppPath","routeModule","definition","kind","APP_PAGE","page","pathname","bundlePath","filename","appPaths","userland","loaderTree","tree","distDir","process","env","__NEXT_RELATIVE_DIST_DIR","relativeProjectDir","__NEXT_RELATIVE_PROJECT_DIR","handler","req","res","ctx","prerenderManifest","isDev","hrtime","bigint","srcPage","TURBOPACK","replace","multiZoneDraftMode","__NEXT_MULTI_ZONE_DRAFT_MODE","isMinimalMode","Boolean","MINIMAL_MODE","prepareResult","prepare","statusCode","end","waitUntil","Promise","resolve","buildId","query","params","pageIsDynamic","buildManifest","nextFontManifest","reactLoadableManifest","serverActionsManifest","clientReferenceManifest","subresourceIntegrityManifest","isDraftMode","resolvedPathname","revalidateOnlyGenerated","routerServerContext","nextConfig","parsedUrl","interceptionRoutePatterns","normalizedSrcPage","isOnDemandRevalidate","prerenderInfo","experimental","ppr","cacheComponents","match","isPrerendered","routes","userAgent","headers","botType","isHtmlBot","isPrefetchRSCRequest","isRSCRequest","isPossibleServerAction","couldSupportPPR","hasDebugStaticShellQuery","__NEXT_EXPERIMENTAL_STATIC_SHELL_DEBUGGING","__nextppronly","hasDebugFallbackShellQuery","isRoutePPREnabled","dynamicRoutes","renderingMode","experimentalTestProxy","isDebugStaticShell","isDebugDynamicAccesses","isDebugFallbackShell","minimalPostponed","undefined","isDynamicRSCRequest","segmentPrefetchHeader","serveStreamingMetadata","htmlLimitedBots","isSSG","supportsRDCForNavigations","supportsDynamicResponse","shouldWaitOnAllReady","ssgCacheKey","staticPathKey","ComponentMod","serverModuleMap","method","tracer","activeSpan","getActiveScopeSpan","render404","varyHeader","getVaryHeader","setHeader","invokeRouteModule","span","context","nextReq","nextRes","render","finally","setAttributes","rootSpanAttributes","getRootSpanAttributes","get","handleRequest","console","warn","route","name","updateName","incrementalCache","doRender","postponed","fallbackRouteParams","forceStaticRender","sharedContext","serverComponentsHmrCache","renderOpts","App","Document","pageConfig","Component","setCacheStatus","setIsrStatus","setReactDebugChannel","dir","NEXT_RUNTIME","join","cwd","assetPrefix","nextConfigOutput","output","crossOrigin","trailingSlash","images","previewProps","preview","deploymentId","enableTainting","taint","reactMaxHeadersLength","cacheLifeProfiles","cacheLife","basePath","serverActions","nextExport","isStaticGeneration","expireTime","staleTimes","dynamicOnHover","inlineCss","authInterrupts","clientTraceMetadata","clientParamParsingOrigins","onClose","cb","on","onAfterTaskError","onInstrumentationRequestError","error","_request","errorContext","onRequestError","err","dev","result","metadata","cacheControl","fetchTags","cacheTags","fetchMetrics","revalidate","staticBailoutInfo","Error","description","stack","message","substring","indexOf","value","html","rscData","flightData","status","segmentData","responseGenerator","hasResolved","previousCacheEntry","previousIncrementalCacheEntry","isRevalidating","isProduction","didRespond","writableEnded","fallbackMode","fallback","PRERENDER","BLOCKING_STATIC_RENDER","isStale","NOT_FOUND","adapterPath","cacheKey","fallbackResponse","handleResponse","routeKind","isFallback","incrementalCacheEntry","responseCache","getResponseCache","c","expire","PAGES","EMPTY","pageData","cacheEntry","cachedData","didPostpone","isMiss","getHeader","tags","matchedSegment","generateEtags","poweredByHeader","fromStatic","onCacheEntry","finished","url","key","Object","entries","Array","isArray","v","appendHeader","toString","contentType","body","__NEXT_TEST_MODE","unshift","createPPRBoundarySentinel","push","ReadableStream","start","controller","enqueue","CLOSED","BODY_AND_HTML","close","transformer","TransformStream","readable","then","pipeTo","writable","catch","abort","e","withPropagatedContext","trace","spanName","SERVER","attributes","routerKind","routePath","routeType","revalidateReason","TextEncoder","encode"],"mappings":"AAGA,SACEA,kBAAkB,QAEb,2DAA2D;IAAE,wBAAwB;AAAW,EAAC;AAExG,SAASC,SAAS,QAAQ,+BAA+B;IAAE,wBAAwB;AAAsB,EAAC;AAE1G,SAASC,mBAAmB,QAAQ,qCAAoC;AACxE,SAASC,SAAS,EAAEC,QAAQ,QAAmB,gCAA+B;AAC9E,SAASC,cAAc,EAAEC,cAA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F,EAAE,OAAOvC,KAAK;QACZ,IAAI,CAAEA,CAAAA,eAAe9L,eAAc,GAAI;YACrC,MAAMY,YAAYiL,cAAc,CAC9B9J,KACA+J,KACA;gBACEkG,YAAY;gBACZC,WAAW3P;gBACX4P,WAAW;gBACXC,kBAAkBvU,oBAAoB;oBACpCiN,oBAAoBrE;oBACpBjC;gBACF;YACF,GACAL;QAEJ;QAEA,mDAAmD;QACnD,MAAM4H;IACR;AACF;AAEA,6EAA6E;AAC7E;;;;CAIC,GACD,SAAS2E;IACP,OAAO,IAAIE,eAAe;QACxBC,OAAMC,UAAU;YACdA,WAAWC,OAAO,CAChB,IAAIsB,cAAcC,MAAM,CAAC;YAE3BxB,WAAWI,KAAK;QAClB;IACF;AACF","ignoreList":[0]}
@@ -2,7 +2,8 @@ import path from 'path';
2
2
  import { validateTurboNextConfig } from '../../lib/turbopack-warning';
3
3
  import { isFileSystemCacheEnabledForBuild } from '../../shared/lib/turbopack/utils';
4
4
  import { NextBuildContext } from '../build-context';
5
- import { createDefineEnv, loadBindings } from '../swc';
5
+ import { createDefineEnv, getBindingsSync } from '../swc';
6
+ import { installBindings } from '../swc/install-bindings';
6
7
  import { handleRouteType, rawEntrypointsToEntrypoints } from '../handle-entrypoints';
7
8
  import { TurbopackManifestLoader } from '../../shared/lib/turbopack/manifest-loader';
8
9
  import { promises as fs } from 'fs';
@@ -16,7 +17,7 @@ import { backgroundLogCompilationEvents } from '../../shared/lib/turbopack/compi
16
17
  import { getSupportedBrowsers, printBuildErrors } from '../utils';
17
18
  import { normalizePath } from '../../lib/normalize-path';
18
19
  export async function turbopackBuild() {
19
- var _config_experimental, _config_turbopack, _config_turbopack1, _config_experimental1;
20
+ var _config_turbopack, _config_turbopack1, _config_experimental;
20
21
  await validateTurboNextConfig({
21
22
  dir: NextBuildContext.dir,
22
23
  isDev: false
@@ -32,7 +33,8 @@ export async function turbopackBuild() {
32
33
  const noMangling = NextBuildContext.noMangling;
33
34
  const currentNodeJsVersion = process.versions.node;
34
35
  const startTime = process.hrtime();
35
- const bindings = await loadBindings(config == null ? void 0 : (_config_experimental = config.experimental) == null ? void 0 : _config_experimental.useWasmBinary);
36
+ const bindings = getBindingsSync() // our caller should have already loaded these
37
+ ;
36
38
  const dev = false;
37
39
  const supportedBrowsers = getSupportedBrowsers(dir, dev);
38
40
  const persistentCaching = isFileSystemCacheEnabledForBuild(config);
@@ -68,7 +70,7 @@ export async function turbopackBuild() {
68
70
  currentNodeJsVersion
69
71
  }, {
70
72
  persistentCaching,
71
- memoryLimit: (_config_experimental1 = config.experimental) == null ? void 0 : _config_experimental1.turbopackMemoryLimit,
73
+ memoryLimit: (_config_experimental = config.experimental) == null ? void 0 : _config_experimental.turbopackMemoryLimit,
72
74
  dependencyTracking: persistentCaching,
73
75
  isCi: isCI,
74
76
  isShortSession: true
@@ -168,10 +170,11 @@ export async function turbopackBuild() {
168
170
  }
169
171
  let shutdownPromise;
170
172
  export async function workerMain(workerData) {
173
+ var _config_experimental;
171
174
  // setup new build context from the serialized data passed from the parent
172
175
  Object.assign(NextBuildContext, workerData.buildContext);
173
176
  /// load the config because it's not serializable
174
- NextBuildContext.config = await loadConfig(PHASE_PRODUCTION_BUILD, NextBuildContext.dir, {
177
+ const config = NextBuildContext.config = await loadConfig(PHASE_PRODUCTION_BUILD, NextBuildContext.dir, {
175
178
  debugPrerender: NextBuildContext.debugPrerender,
176
179
  reactProductionProfiling: NextBuildContext.reactProductionProfiling
177
180
  });
@@ -186,6 +189,8 @@ export async function workerMain(workerData) {
186
189
  distDir: NextBuildContext.config.distDir
187
190
  });
188
191
  setGlobal('telemetry', telemetry);
192
+ // Install bindings early so we can access synchronously later
193
+ await installBindings((_config_experimental = config.experimental) == null ? void 0 : _config_experimental.useWasmBinary);
189
194
  const { shutdownPromise: resultShutdownPromise, buildTraceContext, duration } = await turbopackBuild();
190
195
  shutdownPromise = resultShutdownPromise;
191
196
  return {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/build/turbopack-build/impl.ts"],"sourcesContent":["import path from 'path'\nimport { validateTurboNextConfig } from '../../lib/turbopack-warning'\nimport { isFileSystemCacheEnabledForBuild } from '../../shared/lib/turbopack/utils'\nimport { NextBuildContext } from '../build-context'\nimport { createDefineEnv, loadBindings } from '../swc'\nimport {\n handleRouteType,\n rawEntrypointsToEntrypoints,\n} from '../handle-entrypoints'\nimport { TurbopackManifestLoader } from '../../shared/lib/turbopack/manifest-loader'\nimport { promises as fs } from 'fs'\nimport { PHASE_PRODUCTION_BUILD } from '../../shared/lib/constants'\nimport loadConfig from '../../server/config'\nimport { hasCustomExportOutput } from '../../export/utils'\nimport { Telemetry } from '../../telemetry/storage'\nimport { setGlobal } from '../../trace'\nimport { isCI } from '../../server/ci-info'\nimport { backgroundLogCompilationEvents } from '../../shared/lib/turbopack/compilation-events'\nimport { getSupportedBrowsers, printBuildErrors } from '../utils'\nimport { normalizePath } from '../../lib/normalize-path'\nimport type { RawEntrypoints, TurbopackResult } from '../swc/types'\n\nexport async function turbopackBuild(): Promise<{\n duration: number\n buildTraceContext: undefined\n shutdownPromise: Promise<void>\n}> {\n await validateTurboNextConfig({\n dir: NextBuildContext.dir!,\n isDev: false,\n })\n\n const config = NextBuildContext.config!\n const dir = NextBuildContext.dir!\n const distDir = NextBuildContext.distDir!\n const buildId = NextBuildContext.buildId!\n const encryptionKey = NextBuildContext.encryptionKey!\n const previewProps = NextBuildContext.previewProps!\n const hasRewrites = NextBuildContext.hasRewrites!\n const rewrites = NextBuildContext.rewrites!\n const noMangling = NextBuildContext.noMangling!\n const currentNodeJsVersion = process.versions.node\n\n const startTime = process.hrtime()\n const bindings = await loadBindings(config?.experimental?.useWasmBinary)\n const dev = false\n\n const supportedBrowsers = getSupportedBrowsers(dir, dev)\n\n const persistentCaching = isFileSystemCacheEnabledForBuild(config)\n const rootPath = config.turbopack?.root || config.outputFileTracingRoot || dir\n const project = await bindings.turbo.createProject(\n {\n rootPath: config.turbopack?.root || config.outputFileTracingRoot || dir,\n projectPath: normalizePath(path.relative(rootPath, dir) || '.'),\n distDir,\n nextConfig: config,\n watch: {\n enable: false,\n },\n dev,\n env: process.env as Record<string, string>,\n defineEnv: createDefineEnv({\n isTurbopack: true,\n clientRouterFilters: NextBuildContext.clientRouterFilters!,\n config,\n dev,\n distDir,\n projectPath: dir,\n fetchCacheKeyPrefix: config.experimental.fetchCacheKeyPrefix,\n hasRewrites,\n // Implemented separately in Turbopack, doesn't have to be passed here.\n middlewareMatchers: undefined,\n rewrites,\n }),\n buildId,\n encryptionKey,\n previewProps,\n browserslistQuery: supportedBrowsers.join(', '),\n noMangling,\n currentNodeJsVersion,\n },\n {\n persistentCaching,\n memoryLimit: config.experimental?.turbopackMemoryLimit,\n dependencyTracking: persistentCaching,\n isCi: isCI,\n isShortSession: true,\n }\n )\n try {\n backgroundLogCompilationEvents(project)\n\n // Write an empty file in a known location to signal this was built with Turbopack\n await fs.writeFile(path.join(distDir, 'turbopack'), '')\n\n await fs.mkdir(path.join(distDir, 'server'), { recursive: true })\n await fs.mkdir(path.join(distDir, 'static', buildId), {\n recursive: true,\n })\n await fs.writeFile(\n path.join(distDir, 'package.json'),\n '{\"type\": \"commonjs\"}'\n )\n\n let appDirOnly = NextBuildContext.appDirOnly!\n const entrypoints = await project.writeAllEntrypointsToDisk(appDirOnly)\n printBuildErrors(entrypoints, dev)\n\n let routes = entrypoints.routes\n if (!routes) {\n // This should never ever happen, there should be an error issue, or the bindings call should\n // have thrown.\n throw new Error(`Turbopack build failed`)\n }\n\n const hasPagesEntries = Array.from(routes.values()).some((route) => {\n if (route.type === 'page' || route.type === 'page-api') {\n return true\n }\n return false\n })\n // If there's no pages entries, then we are in app-dir-only mode\n if (!hasPagesEntries) {\n appDirOnly = true\n }\n\n const manifestLoader = new TurbopackManifestLoader({\n buildId,\n distDir,\n encryptionKey,\n })\n\n const currentEntrypoints = await rawEntrypointsToEntrypoints(\n entrypoints as TurbopackResult<RawEntrypoints>\n )\n\n const promises: Promise<void>[] = []\n\n if (!appDirOnly) {\n for (const [page, route] of currentEntrypoints.page) {\n promises.push(\n handleRouteType({\n page,\n route,\n manifestLoader,\n })\n )\n }\n }\n\n for (const [page, route] of currentEntrypoints.app) {\n promises.push(\n handleRouteType({\n page,\n route,\n manifestLoader,\n })\n )\n }\n\n await Promise.all(promises)\n\n await Promise.all([\n // Only load pages router manifests if not app-only\n ...(!appDirOnly\n ? [\n manifestLoader.loadBuildManifest('_app'),\n manifestLoader.loadPagesManifest('_app'),\n manifestLoader.loadFontManifest('_app'),\n manifestLoader.loadPagesManifest('_document'),\n manifestLoader.loadClientBuildManifest('_error'),\n manifestLoader.loadBuildManifest('_error'),\n manifestLoader.loadPagesManifest('_error'),\n manifestLoader.loadFontManifest('_error'),\n ]\n : []),\n entrypoints.instrumentation &&\n manifestLoader.loadMiddlewareManifest(\n 'instrumentation',\n 'instrumentation'\n ),\n entrypoints.middleware &&\n (await manifestLoader.loadMiddlewareManifest(\n 'middleware',\n 'middleware'\n )),\n ])\n\n manifestLoader.writeManifests({\n devRewrites: undefined,\n productionRewrites: rewrites,\n entrypoints: currentEntrypoints,\n })\n\n if (NextBuildContext.analyze) {\n await project.writeAnalyzeData(appDirOnly)\n }\n\n const shutdownPromise = project.shutdown()\n\n const time = process.hrtime(startTime)\n return {\n duration: time[0] + time[1] / 1e9,\n buildTraceContext: undefined,\n shutdownPromise,\n }\n } catch (err) {\n await project.shutdown()\n throw err\n }\n}\n\nlet shutdownPromise: Promise<void> | undefined\nexport async function workerMain(workerData: {\n buildContext: typeof NextBuildContext\n}): Promise<\n Omit<Awaited<ReturnType<typeof turbopackBuild>>, 'shutdownPromise'>\n> {\n // setup new build context from the serialized data passed from the parent\n Object.assign(NextBuildContext, workerData.buildContext)\n\n /// load the config because it's not serializable\n NextBuildContext.config = await loadConfig(\n PHASE_PRODUCTION_BUILD,\n NextBuildContext.dir!,\n {\n debugPrerender: NextBuildContext.debugPrerender,\n reactProductionProfiling: NextBuildContext.reactProductionProfiling,\n }\n )\n\n // Matches handling in build/index.ts\n // https://github.com/vercel/next.js/blob/84f347fc86f4efc4ec9f13615c215e4b9fb6f8f0/packages/next/src/build/index.ts#L815-L818\n // Ensures the `config.distDir` option is matched.\n if (hasCustomExportOutput(NextBuildContext.config)) {\n NextBuildContext.config.distDir = '.next'\n }\n\n // Clone the telemetry for worker\n const telemetry = new Telemetry({\n distDir: NextBuildContext.config.distDir,\n })\n setGlobal('telemetry', telemetry)\n\n const {\n shutdownPromise: resultShutdownPromise,\n buildTraceContext,\n duration,\n } = await turbopackBuild()\n shutdownPromise = resultShutdownPromise\n return {\n buildTraceContext,\n duration,\n }\n}\n\nexport async function waitForShutdown(): Promise<void> {\n if (shutdownPromise) {\n await shutdownPromise\n }\n}\n"],"names":["path","validateTurboNextConfig","isFileSystemCacheEnabledForBuild","NextBuildContext","createDefineEnv","loadBindings","handleRouteType","rawEntrypointsToEntrypoints","TurbopackManifestLoader","promises","fs","PHASE_PRODUCTION_BUILD","loadConfig","hasCustomExportOutput","Telemetry","setGlobal","isCI","backgroundLogCompilationEvents","getSupportedBrowsers","printBuildErrors","normalizePath","turbopackBuild","config","dir","isDev","distDir","buildId","encryptionKey","previewProps","hasRewrites","rewrites","noMangling","currentNodeJsVersion","process","versions","node","startTime","hrtime","bindings","experimental","useWasmBinary","dev","supportedBrowsers","persistentCaching","rootPath","turbopack","root","outputFileTracingRoot","project","turbo","createProject","projectPath","relative","nextConfig","watch","enable","env","defineEnv","isTurbopack","clientRouterFilters","fetchCacheKeyPrefix","middlewareMatchers","undefined","browserslistQuery","join","memoryLimit","turbopackMemoryLimit","dependencyTracking","isCi","isShortSession","writeFile","mkdir","recursive","appDirOnly","entrypoints","writeAllEntrypointsToDisk","routes","Error","hasPagesEntries","Array","from","values","some","route","type","manifestLoader","currentEntrypoints","page","push","app","Promise","all","loadBuildManifest","loadPagesManifest","loadFontManifest","loadClientBuildManifest","instrumentation","loadMiddlewareManifest","middleware","writeManifests","devRewrites","productionRewrites","analyze","writeAnalyzeData","shutdownPromise","shutdown","time","duration","buildTraceContext","err","workerMain","workerData","Object","assign","buildContext","debugPrerender","reactProductionProfiling","telemetry","resultShutdownPromise","waitForShutdown"],"mappings":"AAAA,OAAOA,UAAU,OAAM;AACvB,SAASC,uBAAuB,QAAQ,8BAA6B;AACrE,SAASC,gCAAgC,QAAQ,mCAAkC;AACnF,SAASC,gBAAgB,QAAQ,mBAAkB;AACnD,SAASC,eAAe,EAAEC,YAAY,QAAQ,SAAQ;AACtD,SACEC,eAAe,EACfC,2BAA2B,QACtB,wBAAuB;AAC9B,SAASC,uBAAuB,QAAQ,6CAA4C;AACpF,SAASC,YAAYC,EAAE,QAAQ,KAAI;AACnC,SAASC,sBAAsB,QAAQ,6BAA4B;AACnE,OAAOC,gBAAgB,sBAAqB;AAC5C,SAASC,qBAAqB,QAAQ,qBAAoB;AAC1D,SAASC,SAAS,QAAQ,0BAAyB;AACnD,SAASC,SAAS,QAAQ,cAAa;AACvC,SAASC,IAAI,QAAQ,uBAAsB;AAC3C,SAASC,8BAA8B,QAAQ,gDAA+C;AAC9F,SAASC,oBAAoB,EAAEC,gBAAgB,QAAQ,WAAU;AACjE,SAASC,aAAa,QAAQ,2BAA0B;AAGxD,OAAO,eAAeC;QAsBgBC,sBAMnBA,mBAGHA,oBA+BGA;IAzDjB,MAAMrB,wBAAwB;QAC5BsB,KAAKpB,iBAAiBoB,GAAG;QACzBC,OAAO;IACT;IAEA,MAAMF,SAASnB,iBAAiBmB,MAAM;IACtC,MAAMC,MAAMpB,iBAAiBoB,GAAG;IAChC,MAAME,UAAUtB,iBAAiBsB,OAAO;IACxC,MAAMC,UAAUvB,iBAAiBuB,OAAO;IACxC,MAAMC,gBAAgBxB,iBAAiBwB,aAAa;IACpD,MAAMC,eAAezB,iBAAiByB,YAAY;IAClD,MAAMC,cAAc1B,iBAAiB0B,WAAW;IAChD,MAAMC,WAAW3B,iBAAiB2B,QAAQ;IAC1C,MAAMC,aAAa5B,iBAAiB4B,UAAU;IAC9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BjH,iBAAiBiH,wBAAwB;IACrE;IAGF,qCAAqC;IACrC,6HAA6H;IAC7H,kDAAkD;IAClD,IAAIvG,sBAAsBV,iBAAiBmB,MAAM,GAAG;QAClDnB,iBAAiBmB,MAAM,CAACG,OAAO,GAAG;IACpC;IAEA,iCAAiC;IACjC,MAAM4F,YAAY,IAAIvG,UAAU;QAC9BW,SAAStB,iBAAiBmB,MAAM,CAACG,OAAO;IAC1C;IACAV,UAAU,aAAasG;IAEvB,MAAM,EACJb,iBAAiBc,qBAAqB,EACtCV,iBAAiB,EACjBD,QAAQ,EACT,GAAG,MAAMtF;IACVmF,kBAAkBc;IAClB,OAAO;QACLV;QACAD;IACF;AACF;AAEA,OAAO,eAAeY;IACpB,IAAIf,iBAAiB;QACnB,MAAMA;IACR;AACF","ignoreList":[0]}
1
+ {"version":3,"sources":["../../../../src/build/turbopack-build/impl.ts"],"sourcesContent":["import path from 'path'\nimport { validateTurboNextConfig } from '../../lib/turbopack-warning'\nimport { isFileSystemCacheEnabledForBuild } from '../../shared/lib/turbopack/utils'\nimport { NextBuildContext } from '../build-context'\nimport { createDefineEnv, getBindingsSync } from '../swc'\nimport { installBindings } from '../swc/install-bindings'\nimport {\n handleRouteType,\n rawEntrypointsToEntrypoints,\n} from '../handle-entrypoints'\nimport { TurbopackManifestLoader } from '../../shared/lib/turbopack/manifest-loader'\nimport { promises as fs } from 'fs'\nimport { PHASE_PRODUCTION_BUILD } from '../../shared/lib/constants'\nimport loadConfig from '../../server/config'\nimport { hasCustomExportOutput } from '../../export/utils'\nimport { Telemetry } from '../../telemetry/storage'\nimport { setGlobal } from '../../trace'\nimport { isCI } from '../../server/ci-info'\nimport { backgroundLogCompilationEvents } from '../../shared/lib/turbopack/compilation-events'\nimport { getSupportedBrowsers, printBuildErrors } from '../utils'\nimport { normalizePath } from '../../lib/normalize-path'\nimport type { RawEntrypoints, TurbopackResult } from '../swc/types'\n\nexport async function turbopackBuild(): Promise<{\n duration: number\n buildTraceContext: undefined\n shutdownPromise: Promise<void>\n}> {\n await validateTurboNextConfig({\n dir: NextBuildContext.dir!,\n isDev: false,\n })\n\n const config = NextBuildContext.config!\n const dir = NextBuildContext.dir!\n const distDir = NextBuildContext.distDir!\n const buildId = NextBuildContext.buildId!\n const encryptionKey = NextBuildContext.encryptionKey!\n const previewProps = NextBuildContext.previewProps!\n const hasRewrites = NextBuildContext.hasRewrites!\n const rewrites = NextBuildContext.rewrites!\n const noMangling = NextBuildContext.noMangling!\n const currentNodeJsVersion = process.versions.node\n\n const startTime = process.hrtime()\n const bindings = getBindingsSync() // our caller should have already loaded these\n const dev = false\n\n const supportedBrowsers = getSupportedBrowsers(dir, dev)\n\n const persistentCaching = isFileSystemCacheEnabledForBuild(config)\n const rootPath = config.turbopack?.root || config.outputFileTracingRoot || dir\n const project = await bindings.turbo.createProject(\n {\n rootPath: config.turbopack?.root || config.outputFileTracingRoot || dir,\n projectPath: normalizePath(path.relative(rootPath, dir) || '.'),\n distDir,\n nextConfig: config,\n watch: {\n enable: false,\n },\n dev,\n env: process.env as Record<string, string>,\n defineEnv: createDefineEnv({\n isTurbopack: true,\n clientRouterFilters: NextBuildContext.clientRouterFilters!,\n config,\n dev,\n distDir,\n projectPath: dir,\n fetchCacheKeyPrefix: config.experimental.fetchCacheKeyPrefix,\n hasRewrites,\n // Implemented separately in Turbopack, doesn't have to be passed here.\n middlewareMatchers: undefined,\n rewrites,\n }),\n buildId,\n encryptionKey,\n previewProps,\n browserslistQuery: supportedBrowsers.join(', '),\n noMangling,\n currentNodeJsVersion,\n },\n {\n persistentCaching,\n memoryLimit: config.experimental?.turbopackMemoryLimit,\n dependencyTracking: persistentCaching,\n isCi: isCI,\n isShortSession: true,\n }\n )\n try {\n backgroundLogCompilationEvents(project)\n\n // Write an empty file in a known location to signal this was built with Turbopack\n await fs.writeFile(path.join(distDir, 'turbopack'), '')\n\n await fs.mkdir(path.join(distDir, 'server'), { recursive: true })\n await fs.mkdir(path.join(distDir, 'static', buildId), {\n recursive: true,\n })\n await fs.writeFile(\n path.join(distDir, 'package.json'),\n '{\"type\": \"commonjs\"}'\n )\n\n let appDirOnly = NextBuildContext.appDirOnly!\n const entrypoints = await project.writeAllEntrypointsToDisk(appDirOnly)\n printBuildErrors(entrypoints, dev)\n\n let routes = entrypoints.routes\n if (!routes) {\n // This should never ever happen, there should be an error issue, or the bindings call should\n // have thrown.\n throw new Error(`Turbopack build failed`)\n }\n\n const hasPagesEntries = Array.from(routes.values()).some((route) => {\n if (route.type === 'page' || route.type === 'page-api') {\n return true\n }\n return false\n })\n // If there's no pages entries, then we are in app-dir-only mode\n if (!hasPagesEntries) {\n appDirOnly = true\n }\n\n const manifestLoader = new TurbopackManifestLoader({\n buildId,\n distDir,\n encryptionKey,\n })\n\n const currentEntrypoints = await rawEntrypointsToEntrypoints(\n entrypoints as TurbopackResult<RawEntrypoints>\n )\n\n const promises: Promise<void>[] = []\n\n if (!appDirOnly) {\n for (const [page, route] of currentEntrypoints.page) {\n promises.push(\n handleRouteType({\n page,\n route,\n manifestLoader,\n })\n )\n }\n }\n\n for (const [page, route] of currentEntrypoints.app) {\n promises.push(\n handleRouteType({\n page,\n route,\n manifestLoader,\n })\n )\n }\n\n await Promise.all(promises)\n\n await Promise.all([\n // Only load pages router manifests if not app-only\n ...(!appDirOnly\n ? [\n manifestLoader.loadBuildManifest('_app'),\n manifestLoader.loadPagesManifest('_app'),\n manifestLoader.loadFontManifest('_app'),\n manifestLoader.loadPagesManifest('_document'),\n manifestLoader.loadClientBuildManifest('_error'),\n manifestLoader.loadBuildManifest('_error'),\n manifestLoader.loadPagesManifest('_error'),\n manifestLoader.loadFontManifest('_error'),\n ]\n : []),\n entrypoints.instrumentation &&\n manifestLoader.loadMiddlewareManifest(\n 'instrumentation',\n 'instrumentation'\n ),\n entrypoints.middleware &&\n (await manifestLoader.loadMiddlewareManifest(\n 'middleware',\n 'middleware'\n )),\n ])\n\n manifestLoader.writeManifests({\n devRewrites: undefined,\n productionRewrites: rewrites,\n entrypoints: currentEntrypoints,\n })\n\n if (NextBuildContext.analyze) {\n await project.writeAnalyzeData(appDirOnly)\n }\n\n const shutdownPromise = project.shutdown()\n\n const time = process.hrtime(startTime)\n return {\n duration: time[0] + time[1] / 1e9,\n buildTraceContext: undefined,\n shutdownPromise,\n }\n } catch (err) {\n await project.shutdown()\n throw err\n }\n}\n\nlet shutdownPromise: Promise<void> | undefined\nexport async function workerMain(workerData: {\n buildContext: typeof NextBuildContext\n}): Promise<\n Omit<Awaited<ReturnType<typeof turbopackBuild>>, 'shutdownPromise'>\n> {\n // setup new build context from the serialized data passed from the parent\n Object.assign(NextBuildContext, workerData.buildContext)\n\n /// load the config because it's not serializable\n const config = (NextBuildContext.config = await loadConfig(\n PHASE_PRODUCTION_BUILD,\n NextBuildContext.dir!,\n {\n debugPrerender: NextBuildContext.debugPrerender,\n reactProductionProfiling: NextBuildContext.reactProductionProfiling,\n }\n ))\n // Matches handling in build/index.ts\n // https://github.com/vercel/next.js/blob/84f347fc86f4efc4ec9f13615c215e4b9fb6f8f0/packages/next/src/build/index.ts#L815-L818\n // Ensures the `config.distDir` option is matched.\n if (hasCustomExportOutput(NextBuildContext.config)) {\n NextBuildContext.config.distDir = '.next'\n }\n\n // Clone the telemetry for worker\n const telemetry = new Telemetry({\n distDir: NextBuildContext.config.distDir,\n })\n setGlobal('telemetry', telemetry)\n // Install bindings early so we can access synchronously later\n await installBindings(config.experimental?.useWasmBinary)\n\n const {\n shutdownPromise: resultShutdownPromise,\n buildTraceContext,\n duration,\n } = await turbopackBuild()\n shutdownPromise = resultShutdownPromise\n return {\n buildTraceContext,\n duration,\n }\n}\n\nexport async function waitForShutdown(): Promise<void> {\n if (shutdownPromise) {\n await shutdownPromise\n }\n}\n"],"names":["path","validateTurboNextConfig","isFileSystemCacheEnabledForBuild","NextBuildContext","createDefineEnv","getBindingsSync","installBindings","handleRouteType","rawEntrypointsToEntrypoints","TurbopackManifestLoader","promises","fs","PHASE_PRODUCTION_BUILD","loadConfig","hasCustomExportOutput","Telemetry","setGlobal","isCI","backgroundLogCompilationEvents","getSupportedBrowsers","printBuildErrors","normalizePath","turbopackBuild","config","dir","isDev","distDir","buildId","encryptionKey","previewProps","hasRewrites","rewrites","noMangling","currentNodeJsVersion","process","versions","node","startTime","hrtime","bindings","dev","supportedBrowsers","persistentCaching","rootPath","turbopack","root","outputFileTracingRoot","project","turbo","createProject","projectPath","relative","nextConfig","watch","enable","env","defineEnv","isTurbopack","clientRouterFilters","fetchCacheKeyPrefix","experimental","middlewareMatchers","undefined","browserslistQuery","join","memoryLimit","turbopackMemoryLimit","dependencyTracking","isCi","isShortSession","writeFile","mkdir","recursive","appDirOnly","entrypoints","writeAllEntrypointsToDisk","routes","Error","hasPagesEntries","Array","from","values","some","route","type","manifestLoader","currentEntrypoints","page","push","app","Promise","all","loadBuildManifest","loadPagesManifest","loadFontManifest","loadClientBuildManifest","instrumentation","loadMiddlewareManifest","middleware","writeManifests","devRewrites","productionRewrites","analyze","writeAnalyzeData","shutdownPromise","shutdown","time","duration","buildTraceContext","err","workerMain","workerData","Object","assign","buildContext","debugPrerender","reactProductionProfiling","telemetry","useWasmBinary","resultShutdownPromise","waitForShutdown"],"mappings":"AAAA,OAAOA,UAAU,OAAM;AACvB,SAASC,uBAAuB,QAAQ,8BAA6B;AACrE,SAASC,gCAAgC,QAAQ,mCAAkC;AACnF,SAASC,gBAAgB,QAAQ,mBAAkB;AACnD,SAASC,eAAe,EAAEC,eAAe,QAAQ,SAAQ;AACzD,SAASC,eAAe,QAAQ,0BAAyB;AACzD,SACEC,eAAe,EACfC,2BAA2B,QACtB,wBAAuB;AAC9B,SAASC,uBAAuB,QAAQ,6CAA4C;AACpF,SAASC,YAAYC,EAAE,QAAQ,KAAI;AACnC,SAASC,sBAAsB,QAAQ,6BAA4B;AACnE,OAAOC,gBAAgB,sBAAqB;AAC5C,SAASC,qBAAqB,QAAQ,qBAAoB;AAC1D,SAASC,SAAS,QAAQ,0BAAyB;AACnD,SAASC,SA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8 @@ import { getImportCode, getModuleCode, getExportCode } from './codegen';
3
3
  import { getFilter, getPreRequester, isDataUrl, isUrlRequestable, requestify, resolveRequests } from '../../css-loader/src/utils';
4
4
  import { stringifyRequest } from '../../../stringify-request';
5
5
  import { ECacheKey } from './interface';
6
+ import { getBindingsSync } from '../../../../../build/swc';
7
+ import { installBindings } from '../../../../../build/swc/install-bindings';
6
8
  const encoder = new TextEncoder();
7
9
  function createUrlAndImportVisitor(visitorOptions, apis, imports, replacements, replacedUrls, replacedImportUrls) {
8
10
  const importUrlToNameMap = new Map();
@@ -200,6 +202,10 @@ export async function LightningCssLoader(source, prevMap) {
200
202
  var _options_modules;
201
203
  const done = this.async();
202
204
  const options = this.getOptions();
205
+ // Install bindings early so they are definitely available to the loader.
206
+ // When run by webpack in next this is already done with correct configuration so this is a no-op.
207
+ // In turbopack loaders are run in a subprocess so it may or may not be done.
208
+ await installBindings();
203
209
  const { implementation, targets: userTargets, ...opts } = options;
204
210
  options.modules ??= {};
205
211
  if (implementation && typeof implementation.transformCss !== 'function') {
@@ -233,8 +239,7 @@ export async function LightningCssLoader(source, prevMap) {
233
239
  url: stringifyRequest(this, require.resolve('../../css-loader/src/runtime/api'))
234
240
  });
235
241
  }
236
- const { loadBindings } = require('../../../../../build/swc');
237
- const transform = (implementation == null ? void 0 : implementation.transformCss) ?? (await loadBindings()).css.lightning.transform;
242
+ const transform = (implementation == null ? void 0 : implementation.transformCss) ?? getBindingsSync().css.lightning.transform;
238
243
  const replacedUrls = new Map();
239
244
  const icssReplacedUrls = new Map();
240
245
  const replacedImportUrls = new Map();