( req: IncomingMessage, res: ServerResponse, pathname: string, query: NextParsedUrlQuery, renderOpts: Omit<RenderOpts, keyof RenderOptsExtra>, extra: RenderOptsExtra, sharedContext: PagesSharedContext, renderContext: PagesRenderContext )
| 455 | } |
| 456 | |
| 457 | export async function renderToHTMLImpl( |
| 458 | req: IncomingMessage, |
| 459 | res: ServerResponse, |
| 460 | pathname: string, |
| 461 | query: NextParsedUrlQuery, |
| 462 | renderOpts: Omit<RenderOpts, keyof RenderOptsExtra>, |
| 463 | extra: RenderOptsExtra, |
| 464 | sharedContext: PagesSharedContext, |
| 465 | renderContext: PagesRenderContext |
| 466 | ): Promise<RenderResult> { |
| 467 | // Adds support for reading `cookies` in `getServerSideProps` when SSR. |
| 468 | setLazyProp({ req: req as any }, 'cookies', getCookieParser(req.headers)) |
| 469 | |
| 470 | // cssCacheBuster is a workaround for a Safari bug |
| 471 | // (https://bugs.webkit.org/show_bug.cgi?id=187726) where preloaded CSS |
| 472 | // resources are cached and not re-fetched on HMR. It must only be applied |
| 473 | // to CSS and font assets — not to script tags — because the Turbopack |
| 474 | // runtime infers ASSET_SUFFIX from the executing script's query string and |
| 475 | // leaks it onto all static asset URLs (including images), causing |
| 476 | // next/image validation errors. |
| 477 | // See https://github.com/vercel/next.js/issues/92118. |
| 478 | const cssCacheBuster = getSafariCacheBusterQueryString(req) |
| 479 | |
| 480 | const mutableAssetQueryString = sharedContext.deploymentId |
| 481 | ? `?dpl=${sharedContext.deploymentId}` |
| 482 | : '' |
| 483 | const assetQueryString = sharedContext.clientAssetToken |
| 484 | ? `?dpl=${sharedContext.clientAssetToken}` |
| 485 | : '' |
| 486 | // cssAssetQueryString is assetQueryString with the cacheBuster prepended. |
| 487 | // Use this for CSS and font URLs; use assetQueryString for script URLs. |
| 488 | const cssAssetQueryString = |
| 489 | cssCacheBuster + |
| 490 | (sharedContext.clientAssetToken |
| 491 | ? `${cssCacheBuster ? '&' : '?'}dpl=${sharedContext.clientAssetToken}` |
| 492 | : '') |
| 493 | const metadata: PagesRenderResultMetadata = {} |
| 494 | |
| 495 | // don't modify original query object |
| 496 | query = Object.assign({}, query) |
| 497 | |
| 498 | const { |
| 499 | err, |
| 500 | pageConfig = {}, |
| 501 | buildManifest, |
| 502 | reactLoadableManifest, |
| 503 | ErrorDebug, |
| 504 | getStaticProps, |
| 505 | getStaticPaths, |
| 506 | getServerSideProps, |
| 507 | isNextDataRequest, |
| 508 | params, |
| 509 | previewProps, |
| 510 | basePath, |
| 511 | images, |
| 512 | runtime: globalRuntime, |
| 513 | isExperimentalCompile, |
| 514 | expireTime, |
no test coverage detected