next 15.4.0-canary.26 → 15.4.0-canary.27

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 (48) hide show
  1. package/dist/bin/next +1 -1
  2. package/dist/build/index.js +2 -2
  3. package/dist/build/swc/index.js +1 -1
  4. package/dist/build/webpack-config.js +2 -2
  5. package/dist/client/app-bootstrap.js +1 -1
  6. package/dist/client/index.js +1 -1
  7. package/dist/client/script.js +9 -3
  8. package/dist/client/script.js.map +1 -1
  9. package/dist/compiled/next-server/pages-turbo.runtime.dev.js +4 -3
  10. package/dist/compiled/next-server/pages-turbo.runtime.dev.js.map +1 -1
  11. package/dist/compiled/next-server/pages-turbo.runtime.prod.js +7 -6
  12. package/dist/compiled/next-server/pages-turbo.runtime.prod.js.map +1 -1
  13. package/dist/compiled/next-server/pages.runtime.dev.js +4 -3
  14. package/dist/compiled/next-server/pages.runtime.dev.js.map +1 -1
  15. package/dist/compiled/next-server/pages.runtime.prod.js +9 -8
  16. package/dist/compiled/next-server/pages.runtime.prod.js.map +1 -1
  17. package/dist/esm/build/index.js +2 -2
  18. package/dist/esm/build/swc/index.js +1 -1
  19. package/dist/esm/build/webpack-config.js +2 -2
  20. package/dist/esm/client/app-bootstrap.js +1 -1
  21. package/dist/esm/client/index.js +1 -1
  22. package/dist/esm/client/script.js +9 -3
  23. package/dist/esm/client/script.js.map +1 -1
  24. package/dist/esm/pages/_document.js +7 -3
  25. package/dist/esm/pages/_document.js.map +1 -1
  26. package/dist/esm/server/dev/hot-reloader-turbopack.js +1 -1
  27. package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
  28. package/dist/esm/server/lib/app-info-log.js +1 -1
  29. package/dist/esm/server/lib/start-server.js +1 -1
  30. package/dist/esm/server/render.js +7 -2
  31. package/dist/esm/server/render.js.map +1 -1
  32. package/dist/esm/shared/lib/canary-only.js +1 -1
  33. package/dist/esm/shared/lib/html-context.shared-runtime.js.map +1 -1
  34. package/dist/pages/_document.js +7 -3
  35. package/dist/pages/_document.js.map +1 -1
  36. package/dist/server/dev/hot-reloader-turbopack.js +1 -1
  37. package/dist/server/dev/hot-reloader-webpack.js +1 -1
  38. package/dist/server/lib/app-info-log.js +1 -1
  39. package/dist/server/lib/start-server.js +1 -1
  40. package/dist/server/render.js +7 -2
  41. package/dist/server/render.js.map +1 -1
  42. package/dist/shared/lib/canary-only.js +1 -1
  43. package/dist/shared/lib/html-context.shared-runtime.d.ts +1 -0
  44. package/dist/shared/lib/html-context.shared-runtime.js.map +1 -1
  45. package/dist/telemetry/anonymous-meta.js +1 -1
  46. package/dist/telemetry/events/session-stopped.js +2 -2
  47. package/dist/telemetry/events/version.js +2 -2
  48. package/package.json +15 -15
@@ -35,6 +35,7 @@ import { RenderSpan } from './lib/trace/constants';
35
35
  import { ReflectAdapter } from './web/spec-extension/adapters/reflect';
36
36
  import { getCacheControlHeader } from './lib/cache-control';
37
37
  import { getErrorSource } from '../shared/lib/error-source';
38
+ import { getScriptNonceFromHeader } from './app-render/get-script-nonce-from-header';
38
39
  let tryGetPreviewData;
39
40
  let warn;
40
41
  let postProcessHTML;
@@ -377,6 +378,8 @@ export async function renderToHTMLImpl(req, res, pathname, query, renderOpts, ex
377
378
  if (hasPageScripts) {
378
379
  initialScripts.beforeInteractive = [].concat(hasPageScripts()).filter((script)=>script.props.strategy === 'beforeInteractive').map((script)=>script.props);
379
380
  }
381
+ const csp = req.headers['content-security-policy'] || req.headers['content-security-policy-report-only'];
382
+ const nonce = typeof csp === 'string' ? getScriptNonceFromHeader(csp) : undefined;
380
383
  const AppContainer = ({ children })=>/*#__PURE__*/ _jsx(AppRouterContext.Provider, {
381
384
  value: appRouter,
382
385
  children: /*#__PURE__*/ _jsx(SearchParamsContext.Provider, {
@@ -399,7 +402,8 @@ export async function renderToHTMLImpl(req, res, pathname, query, renderOpts, ex
399
402
  scriptLoader = scripts;
400
403
  },
401
404
  scripts: initialScripts,
402
- mountedInstances: new Set()
405
+ mountedInstances: new Set(),
406
+ nonce
403
407
  },
404
408
  children: /*#__PURE__*/ _jsx(LoadableContext.Provider, {
405
409
  value: (moduleName)=>reactLoadableModules.push(moduleName),
@@ -473,7 +477,7 @@ export async function renderToHTMLImpl(req, res, pathname, query, renderOpts, ex
473
477
  enhanceApp
474
478
  });
475
479
  const styles = jsxStyleRegistry.styles({
476
- nonce: options.nonce
480
+ nonce: options.nonce || nonce
477
481
  });
478
482
  jsxStyleRegistry.flush();
479
483
  return {
@@ -1053,6 +1057,7 @@ export async function renderToHTMLImpl(req, res, pathname, query, renderOpts, ex
1053
1057
  isPreview: isPreview === true ? true : undefined,
1054
1058
  notFoundSrcPage: notFoundSrcPage && dev ? notFoundSrcPage : undefined
1055
1059
  },
1060
+ nonce,
1056
1061
  strictNextHead: renderOpts.strictNextHead,
1057
1062
  buildManifest: filteredBuildManifest,
1058
1063
  docComponentsRendered,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/server/render.tsx"],"sourcesContent":["import type { IncomingMessage, ServerResponse } from 'http'\nimport type { ParsedUrlQuery } from 'querystring'\nimport type { NextRouter } from '../shared/lib/router/router'\nimport type { HtmlProps } from '../shared/lib/html-context.shared-runtime'\nimport type { DomainLocale } from './config'\nimport type {\n AppType,\n DocumentInitialProps,\n DocumentType,\n DocumentProps,\n DocumentContext,\n NextComponentType,\n RenderPage,\n RenderPageResult,\n} from '../shared/lib/utils'\nimport type { ImageConfigComplete } from '../shared/lib/image-config'\nimport type { Redirect } from '../lib/load-custom-routes'\nimport {\n type NextApiRequestCookies,\n type __ApiPreviewProps,\n setLazyProp,\n} from './api-utils'\nimport { getCookieParser } from './api-utils/get-cookie-parser'\nimport type { LoadComponentsReturnType } from './load-components'\nimport type {\n GetServerSideProps,\n GetStaticProps,\n PreviewData,\n ServerRuntime,\n SizeLimit,\n} from '../types'\nimport type { UnwrapPromise } from '../lib/coalesced-function'\nimport type { ReactReadableStream } from './stream-utils/node-web-streams-helper'\nimport type { ClientReferenceManifest } from '../build/webpack/plugins/flight-manifest-plugin'\nimport type { NextFontManifest } from '../build/webpack/plugins/next-font-manifest-plugin'\nimport type { PagesModule } from './route-modules/pages/module'\nimport type { ComponentsEnhancer } from '../shared/lib/utils'\nimport type { NextParsedUrlQuery } from './request-meta'\nimport type { Revalidate } from './lib/cache-control'\nimport type { COMPILER_NAMES } from '../shared/lib/constants'\n\nimport React, { type JSX } from 'react'\nimport ReactDOMServerPages from 'next/dist/server/ReactDOMServerPages'\nimport { StyleRegistry, createStyleRegistry } from 'styled-jsx'\nimport {\n GSP_NO_RETURNED_VALUE,\n GSSP_COMPONENT_MEMBER_ERROR,\n GSSP_NO_RETURNED_VALUE,\n STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR,\n SERVER_PROPS_GET_INIT_PROPS_CONFLICT,\n SERVER_PROPS_SSG_CONFLICT,\n SSG_GET_INITIAL_PROPS_CONFLICT,\n UNSTABLE_REVALIDATE_RENAME_ERROR,\n} from '../lib/constants'\nimport {\n NEXT_BUILTIN_DOCUMENT,\n SERVER_PROPS_ID,\n STATIC_PROPS_ID,\n STATIC_STATUS_PAGES,\n} from '../shared/lib/constants'\nimport { isSerializableProps } from '../lib/is-serializable-props'\nimport { isInAmpMode } from '../shared/lib/amp-mode'\nimport { AmpStateContext } from '../shared/lib/amp-context.shared-runtime'\nimport { defaultHead } from '../shared/lib/head'\nimport { HeadManagerContext } from '../shared/lib/head-manager-context.shared-runtime'\nimport Loadable from '../shared/lib/loadable.shared-runtime'\nimport { LoadableContext } from '../shared/lib/loadable-context.shared-runtime'\nimport { RouterContext } from '../shared/lib/router-context.shared-runtime'\nimport { isDynamicRoute } from '../shared/lib/router/utils/is-dynamic'\nimport {\n getDisplayName,\n isResSent,\n loadGetInitialProps,\n} from '../shared/lib/utils'\nimport { HtmlContext } from '../shared/lib/html-context.shared-runtime'\nimport { normalizePagePath } from '../shared/lib/page-path/normalize-page-path'\nimport { denormalizePagePath } from '../shared/lib/page-path/denormalize-page-path'\nimport { getRequestMeta } from './request-meta'\nimport { allowedStatusCodes, getRedirectStatus } from '../lib/redirect-status'\nimport RenderResult, { type PagesRenderResultMetadata } from './render-result'\nimport isError from '../lib/is-error'\nimport {\n streamToString,\n renderToInitialFizzStream,\n} from './stream-utils/node-web-streams-helper'\nimport { ImageConfigContext } from '../shared/lib/image-config-context.shared-runtime'\nimport stripAnsi from 'next/dist/compiled/strip-ansi'\nimport { stripInternalQueries } from './internal-utils'\nimport {\n adaptForAppRouterInstance,\n adaptForPathParams,\n adaptForSearchParams,\n PathnameContextProviderAdapter,\n} from '../shared/lib/router/adapters'\nimport { AppRouterContext } from '../shared/lib/app-router-context.shared-runtime'\nimport {\n SearchParamsContext,\n PathParamsContext,\n} from '../shared/lib/hooks-client-context.shared-runtime'\nimport { getTracer } from './lib/trace/tracer'\nimport { RenderSpan } from './lib/trace/constants'\nimport { ReflectAdapter } from './web/spec-extension/adapters/reflect'\nimport { getCacheControlHeader } from './lib/cache-control'\nimport { getErrorSource } from '../shared/lib/error-source'\nimport type { DeepReadonly } from '../shared/lib/deep-readonly'\nimport type { PagesDevOverlayType } from '../client/components/react-dev-overlay/pages/pages-dev-overlay'\n\nlet tryGetPreviewData: typeof import('./api-utils/node/try-get-preview-data').tryGetPreviewData\nlet warn: typeof import('../build/output/log').warn\nlet postProcessHTML: typeof import('./post-process').postProcessHTML\n\nconst DOCTYPE = '<!DOCTYPE html>'\n\nif (process.env.NEXT_RUNTIME !== 'edge') {\n tryGetPreviewData =\n require('./api-utils/node/try-get-preview-data').tryGetPreviewData\n warn = require('../build/output/log').warn\n postProcessHTML = require('./post-process').postProcessHTML\n} else {\n warn = console.warn.bind(console)\n postProcessHTML = async (_pathname: string, html: string) => html\n}\n\nfunction noRouter() {\n const message =\n 'No router instance found. you should only use \"next/router\" inside the client side of your app. https://nextjs.org/docs/messages/no-router-instance'\n throw new Error(message)\n}\n\nasync function renderToString(element: React.ReactElement) {\n const renderStream = await ReactDOMServerPages.renderToReadableStream(element)\n await renderStream.allReady\n return streamToString(renderStream)\n}\n\nclass ServerRouter implements NextRouter {\n route: string\n pathname: string\n query: ParsedUrlQuery\n asPath: string\n basePath: string\n events: any\n isFallback: boolean\n locale?: string\n isReady: boolean\n locales?: readonly string[]\n defaultLocale?: string\n domainLocales?: readonly DomainLocale[]\n isPreview: boolean\n isLocaleDomain: boolean\n\n constructor(\n pathname: string,\n query: ParsedUrlQuery,\n as: string,\n { isFallback }: { isFallback: boolean },\n isReady: boolean,\n basePath: string,\n locale?: string,\n locales?: readonly string[],\n defaultLocale?: string,\n domainLocales?: readonly DomainLocale[],\n isPreview?: boolean,\n isLocaleDomain?: boolean\n ) {\n this.route = pathname.replace(/\\/$/, '') || '/'\n this.pathname = pathname\n this.query = query\n this.asPath = as\n this.isFallback = isFallback\n this.basePath = basePath\n this.locale = locale\n this.locales = locales\n this.defaultLocale = defaultLocale\n this.isReady = isReady\n this.domainLocales = domainLocales\n this.isPreview = !!isPreview\n this.isLocaleDomain = !!isLocaleDomain\n }\n\n push(): any {\n noRouter()\n }\n replace(): any {\n noRouter()\n }\n reload() {\n noRouter()\n }\n back() {\n noRouter()\n }\n forward(): void {\n noRouter()\n }\n prefetch(): any {\n noRouter()\n }\n beforePopState() {\n noRouter()\n }\n}\n\nfunction enhanceComponents(\n options: ComponentsEnhancer,\n App: AppType,\n Component: NextComponentType\n): {\n App: AppType\n Component: NextComponentType\n} {\n // For backwards compatibility\n if (typeof options === 'function') {\n return {\n App,\n Component: options(Component),\n }\n }\n\n return {\n App: options.enhanceApp ? options.enhanceApp(App) : App,\n Component: options.enhanceComponent\n ? options.enhanceComponent(Component)\n : Component,\n }\n}\n\nfunction renderPageTree(\n App: AppType,\n Component: NextComponentType,\n props: any\n) {\n return <App Component={Component} {...props} />\n}\n\nexport type RenderOptsPartial = {\n canonicalBase: string\n runtimeConfig?: { [key: string]: any }\n assetPrefix?: string\n err?: Error | null\n nextExport?: boolean\n dev?: boolean\n ampPath?: string\n ErrorDebug?: PagesDevOverlayType\n ampValidator?: (html: string, pathname: string) => Promise<void>\n ampSkipValidation?: boolean\n ampOptimizerConfig?: { [key: string]: any }\n isNextDataRequest?: boolean\n params?: ParsedUrlQuery\n previewProps: __ApiPreviewProps | undefined\n basePath: string\n unstable_runtimeJS?: false\n unstable_JsPreload?: false\n optimizeCss: any\n nextConfigOutput?: 'standalone' | 'export'\n nextScriptWorkers: any\n assetQueryString?: string\n resolvedUrl?: string\n resolvedAsPath?: string\n setIsrStatus?: (key: string, value: boolean | null) => void\n clientReferenceManifest?: DeepReadonly<ClientReferenceManifest>\n nextFontManifest?: DeepReadonly<NextFontManifest>\n distDir?: string\n locale?: string\n locales?: readonly string[]\n defaultLocale?: string\n domainLocales?: readonly DomainLocale[]\n disableOptimizedLoading?: boolean\n supportsDynamicResponse: boolean\n botType?: 'dom' | 'html' | undefined\n serveStreamingMetadata?: boolean\n runtime?: ServerRuntime\n serverComponents?: boolean\n serverActions?: {\n bodySizeLimit?: SizeLimit\n allowedOrigins?: string[]\n }\n crossOrigin?: 'anonymous' | 'use-credentials' | '' | undefined\n images: ImageConfigComplete\n largePageDataBytes?: number\n isOnDemandRevalidate?: boolean\n strictNextHead: boolean\n isPossibleServerAction?: boolean\n isExperimentalCompile?: boolean\n isPrefetch?: boolean\n isBot?: boolean\n expireTime?: number\n experimental: {\n clientTraceMetadata?: string[]\n }\n}\n\nexport type RenderOpts = LoadComponentsReturnType<PagesModule> &\n RenderOptsPartial\n\n/**\n * Shared context used for all page renders.\n */\nexport type PagesSharedContext = {\n /**\n * Used to facilitate caching of page bundles, we send it to the client so\n * that pageloader knows where to load bundles.\n */\n buildId: string\n\n /**\n * The deployment ID if the user is deploying to a platform that provides one.\n */\n deploymentId: string | undefined\n\n /**\n * True if the user is using a custom server.\n */\n customServer: true | undefined\n}\n\n/**\n * The context for the given request.\n */\nexport type PagesRenderContext = {\n /**\n * Whether this should be rendered as a fallback page.\n */\n isFallback: boolean\n\n /**\n * Whether this is in draft mode.\n */\n isDraftMode: boolean | undefined\n\n /**\n * In development, the original source page that returned a 404.\n */\n developmentNotFoundSourcePage: string | undefined\n}\n\n/**\n * RenderOptsExtra is being used to split away functionality that's within the\n * renderOpts. Eventually we can have more explicit render options for each\n * route kind.\n */\nexport type RenderOptsExtra = {\n App: AppType\n Document: DocumentType\n}\n\nconst invalidKeysMsg = (\n methodName: 'getServerSideProps' | 'getStaticProps',\n invalidKeys: string[]\n) => {\n const docsPathname = `invalid-${methodName.toLocaleLowerCase()}-value`\n\n return (\n `Additional keys were returned from \\`${methodName}\\`. Properties intended for your component must be nested under the \\`props\\` key, e.g.:` +\n `\\n\\n\\treturn { props: { title: 'My Title', content: '...' } }` +\n `\\n\\nKeys that need to be moved: ${invalidKeys.join(', ')}.` +\n `\\nRead more: https://nextjs.org/docs/messages/${docsPathname}`\n )\n}\n\nfunction checkRedirectValues(\n redirect: Redirect,\n req: IncomingMessage,\n method: 'getStaticProps' | 'getServerSideProps'\n) {\n const { destination, permanent, statusCode, basePath } = redirect\n let errors: string[] = []\n\n const hasStatusCode = typeof statusCode !== 'undefined'\n const hasPermanent = typeof permanent !== 'undefined'\n\n if (hasPermanent && hasStatusCode) {\n errors.push(`\\`permanent\\` and \\`statusCode\\` can not both be provided`)\n } else if (hasPermanent && typeof permanent !== 'boolean') {\n errors.push(`\\`permanent\\` must be \\`true\\` or \\`false\\``)\n } else if (hasStatusCode && !allowedStatusCodes.has(statusCode!)) {\n errors.push(\n `\\`statusCode\\` must undefined or one of ${[...allowedStatusCodes].join(\n ', '\n )}`\n )\n }\n const destinationType = typeof destination\n\n if (destinationType !== 'string') {\n errors.push(\n `\\`destination\\` should be string but received ${destinationType}`\n )\n }\n\n const basePathType = typeof basePath\n\n if (basePathType !== 'undefined' && basePathType !== 'boolean') {\n errors.push(\n `\\`basePath\\` should be undefined or a false, received ${basePathType}`\n )\n }\n\n if (errors.length > 0) {\n throw new Error(\n `Invalid redirect object returned from ${method} for ${req.url}\\n` +\n errors.join(' and ') +\n '\\n' +\n `See more info here: https://nextjs.org/docs/messages/invalid-redirect-gssp`\n )\n }\n}\n\nexport function errorToJSON(err: Error) {\n let source: typeof COMPILER_NAMES.server | typeof COMPILER_NAMES.edgeServer =\n 'server'\n\n if (process.env.NEXT_RUNTIME !== 'edge') {\n source = getErrorSource(err) || 'server'\n }\n\n return {\n name: err.name,\n source,\n message: stripAnsi(err.message),\n stack: err.stack,\n digest: (err as any).digest,\n }\n}\n\nfunction serializeError(\n dev: boolean | undefined,\n err: Error\n): Error & {\n statusCode?: number\n source?: typeof COMPILER_NAMES.server | typeof COMPILER_NAMES.edgeServer\n} {\n if (dev) {\n return errorToJSON(err)\n }\n\n return {\n name: 'Internal Server Error.',\n message: '500 - Internal Server Error.',\n statusCode: 500,\n }\n}\n\nexport async function renderToHTMLImpl(\n req: IncomingMessage,\n res: ServerResponse,\n pathname: string,\n query: NextParsedUrlQuery,\n renderOpts: Omit<RenderOpts, keyof RenderOptsExtra>,\n extra: RenderOptsExtra,\n sharedContext: PagesSharedContext,\n renderContext: PagesRenderContext\n): Promise<RenderResult> {\n // Adds support for reading `cookies` in `getServerSideProps` when SSR.\n setLazyProp({ req: req as any }, 'cookies', getCookieParser(req.headers))\n\n const metadata: PagesRenderResultMetadata = {}\n\n metadata.assetQueryString =\n (renderOpts.dev && renderOpts.assetQueryString) || ''\n\n if (renderOpts.dev && !metadata.assetQueryString) {\n const userAgent = (req.headers['user-agent'] || '').toLowerCase()\n if (userAgent.includes('safari') && !userAgent.includes('chrome')) {\n // In dev we invalidate the cache by appending a timestamp to the resource URL.\n // This is a workaround to fix https://github.com/vercel/next.js/issues/5860\n // TODO: remove this workaround when https://bugs.webkit.org/show_bug.cgi?id=187726 is fixed.\n // Note: The workaround breaks breakpoints on reload since the script url always changes,\n // so we only apply it to Safari.\n metadata.assetQueryString = `?ts=${Date.now()}`\n }\n }\n\n // if deploymentId is provided we append it to all asset requests\n if (sharedContext.deploymentId) {\n metadata.assetQueryString += `${metadata.assetQueryString ? '&' : '?'}dpl=${\n sharedContext.deploymentId\n }`\n }\n\n // don't modify original query object\n query = Object.assign({}, query)\n\n const {\n err,\n dev = false,\n ampPath = '',\n pageConfig = {},\n buildManifest,\n reactLoadableManifest,\n ErrorDebug,\n getStaticProps,\n getStaticPaths,\n getServerSideProps,\n isNextDataRequest,\n params,\n previewProps,\n basePath,\n images,\n runtime: globalRuntime,\n isExperimentalCompile,\n expireTime,\n } = renderOpts\n const { App } = extra\n\n const assetQueryString = metadata.assetQueryString\n\n let Document = extra.Document\n\n let Component: React.ComponentType<{}> | ((props: any) => JSX.Element) =\n renderOpts.Component\n const OriginComponent = Component\n\n const isFallback = renderContext.isFallback ?? false\n const notFoundSrcPage = renderContext.developmentNotFoundSourcePage\n\n // next internal queries should be stripped out\n stripInternalQueries(query)\n\n const isSSG = !!getStaticProps\n const isBuildTimeSSG = isSSG && renderOpts.nextExport\n const defaultAppGetInitialProps =\n App.getInitialProps === (App as any).origGetInitialProps\n\n const hasPageGetInitialProps = !!(Component as any)?.getInitialProps\n const hasPageScripts = (Component as any)?.unstable_scriptLoader\n\n const pageIsDynamic = isDynamicRoute(pathname)\n\n const defaultErrorGetInitialProps =\n pathname === '/_error' &&\n (Component as any).getInitialProps ===\n (Component as any).origGetInitialProps\n\n if (\n renderOpts.nextExport &&\n hasPageGetInitialProps &&\n !defaultErrorGetInitialProps\n ) {\n warn(\n `Detected getInitialProps on page '${pathname}'` +\n ` while running export. It's recommended to use getStaticProps` +\n ` which has a more correct behavior for static exporting.` +\n `\\nRead more: https://nextjs.org/docs/messages/get-initial-props-export`\n )\n }\n\n let isAutoExport =\n !hasPageGetInitialProps &&\n defaultAppGetInitialProps &&\n !isSSG &&\n !getServerSideProps\n\n // if we are running from experimental compile and the page\n // would normally be automatically statically optimized\n // ensure we set cache header so it's not rendered on-demand\n // every request\n if (isAutoExport && !dev && isExperimentalCompile) {\n res.setHeader(\n 'Cache-Control',\n getCacheControlHeader({ revalidate: false, expire: expireTime })\n )\n isAutoExport = false\n }\n\n if (hasPageGetInitialProps && isSSG) {\n throw new Error(SSG_GET_INITIAL_PROPS_CONFLICT + ` ${pathname}`)\n }\n\n if (hasPageGetInitialProps && getServerSideProps) {\n throw new Error(SERVER_PROPS_GET_INIT_PROPS_CONFLICT + ` ${pathname}`)\n }\n\n if (getServerSideProps && isSSG) {\n throw new Error(SERVER_PROPS_SSG_CONFLICT + ` ${pathname}`)\n }\n\n if (getServerSideProps && renderOpts.nextConfigOutput === 'export') {\n throw new Error(\n 'getServerSideProps cannot be used with \"output: export\". See more info here: https://nextjs.org/docs/advanced-features/static-html-export'\n )\n }\n\n if (getStaticPaths && !pageIsDynamic) {\n throw new Error(\n `getStaticPaths is only allowed for dynamic SSG pages and was found on '${pathname}'.` +\n `\\nRead more: https://nextjs.org/docs/messages/non-dynamic-getstaticpaths-usage`\n )\n }\n\n if (!!getStaticPaths && !isSSG) {\n throw new Error(\n `getStaticPaths was added without a getStaticProps in ${pathname}. Without getStaticProps, getStaticPaths does nothing`\n )\n }\n\n if (isSSG && pageIsDynamic && !getStaticPaths) {\n throw new Error(\n `getStaticPaths is required for dynamic SSG pages and is missing for '${pathname}'.` +\n `\\nRead more: https://nextjs.org/docs/messages/invalid-getstaticpaths-value`\n )\n }\n\n let asPath: string = renderOpts.resolvedAsPath || (req.url as string)\n\n if (dev) {\n const { isValidElementType } = require('next/dist/compiled/react-is')\n if (!isValidElementType(Component)) {\n throw new Error(\n `The default export is not a React Component in page: \"${pathname}\"`\n )\n }\n\n if (!isValidElementType(App)) {\n throw new Error(\n `The default export is not a React Component in page: \"/_app\"`\n )\n }\n\n if (!isValidElementType(Document)) {\n throw new Error(\n `The default export is not a React Component in page: \"/_document\"`\n )\n }\n\n if (isAutoExport || isFallback) {\n // remove query values except ones that will be set during export\n query = {\n ...(query.amp\n ? {\n amp: query.amp,\n }\n : {}),\n }\n asPath = `${pathname}${\n // ensure trailing slash is present for non-dynamic auto-export pages\n req.url!.endsWith('/') && pathname !== '/' && !pageIsDynamic ? '/' : ''\n }`\n req.url = pathname\n }\n\n if (pathname === '/404' && (hasPageGetInitialProps || getServerSideProps)) {\n throw new Error(\n `\\`pages/404\\` ${STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR}`\n )\n }\n if (\n STATIC_STATUS_PAGES.includes(pathname) &&\n (hasPageGetInitialProps || getServerSideProps)\n ) {\n throw new Error(\n `\\`pages${pathname}\\` ${STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR}`\n )\n }\n\n if (renderOpts?.setIsrStatus) {\n renderOpts.setIsrStatus(asPath, isSSG || isAutoExport ? true : null)\n }\n }\n\n for (const methodName of [\n 'getStaticProps',\n 'getServerSideProps',\n 'getStaticPaths',\n ]) {\n if ((Component as any)?.[methodName]) {\n throw new Error(\n `page ${pathname} ${methodName} ${GSSP_COMPONENT_MEMBER_ERROR}`\n )\n }\n }\n\n await Loadable.preloadAll() // Make sure all dynamic imports are loaded\n\n let isPreview: boolean | undefined = undefined\n let previewData: PreviewData\n\n if (\n (isSSG || getServerSideProps) &&\n !isFallback &&\n process.env.NEXT_RUNTIME !== 'edge' &&\n previewProps\n ) {\n // Reads of this are cached on the `req` object, so this should resolve\n // instantly. There's no need to pass this data down from a previous\n // invoke.\n previewData = tryGetPreviewData(\n req,\n res,\n previewProps,\n !!renderOpts.multiZoneDraftMode\n )\n isPreview = previewData !== false\n }\n\n // url will always be set\n const routerIsReady = !!(\n getServerSideProps ||\n hasPageGetInitialProps ||\n (!defaultAppGetInitialProps && !isSSG) ||\n isExperimentalCompile\n )\n const router = new ServerRouter(\n pathname,\n query,\n asPath,\n {\n isFallback: isFallback,\n },\n routerIsReady,\n basePath,\n renderOpts.locale,\n renderOpts.locales,\n renderOpts.defaultLocale,\n renderOpts.domainLocales,\n isPreview,\n getRequestMeta(req, 'isLocaleDomain')\n )\n\n const appRouter = adaptForAppRouterInstance(router)\n\n let scriptLoader: any = {}\n const jsxStyleRegistry = createStyleRegistry()\n const ampState = {\n ampFirst: pageConfig.amp === true,\n hasQuery: Boolean(query.amp),\n hybrid: pageConfig.amp === 'hybrid',\n }\n\n // Disable AMP under the web environment\n const inAmpMode = process.env.NEXT_RUNTIME !== 'edge' && isInAmpMode(ampState)\n let head: JSX.Element[] = defaultHead(inAmpMode)\n const reactLoadableModules: string[] = []\n\n let initialScripts: any = {}\n if (hasPageScripts) {\n initialScripts.beforeInteractive = []\n .concat(hasPageScripts())\n .filter((script: any) => script.props.strategy === 'beforeInteractive')\n .map((script: any) => script.props)\n }\n\n const AppContainer = ({ children }: { children: JSX.Element }) => (\n <AppRouterContext.Provider value={appRouter}>\n <SearchParamsContext.Provider value={adaptForSearchParams(router)}>\n <PathnameContextProviderAdapter\n router={router}\n isAutoExport={isAutoExport}\n >\n <PathParamsContext.Provider value={adaptForPathParams(router)}>\n <RouterContext.Provider value={router}>\n <AmpStateContext.Provider value={ampState}>\n <HeadManagerContext.Provider\n value={{\n updateHead: (state) => {\n head = state\n },\n updateScripts: (scripts) => {\n scriptLoader = scripts\n },\n scripts: initialScripts,\n mountedInstances: new Set(),\n }}\n >\n <LoadableContext.Provider\n value={(moduleName) =>\n reactLoadableModules.push(moduleName)\n }\n >\n <StyleRegistry registry={jsxStyleRegistry}>\n <ImageConfigContext.Provider value={images}>\n {children}\n </ImageConfigContext.Provider>\n </StyleRegistry>\n </LoadableContext.Provider>\n </HeadManagerContext.Provider>\n </AmpStateContext.Provider>\n </RouterContext.Provider>\n </PathParamsContext.Provider>\n </PathnameContextProviderAdapter>\n </SearchParamsContext.Provider>\n </AppRouterContext.Provider>\n )\n\n // The `useId` API uses the path indexes to generate an ID for each node.\n // To guarantee the match of hydration, we need to ensure that the structure\n // of wrapper nodes is isomorphic in server and client.\n // TODO: With `enhanceApp` and `enhanceComponents` options, this approach may\n // not be useful.\n // https://github.com/facebook/react/pull/22644\n const Noop = () => null\n const AppContainerWithIsomorphicFiberStructure: React.FC<{\n children: JSX.Element\n }> = ({ children }) => {\n return (\n <>\n {/* <Head/> */}\n <Noop />\n <AppContainer>\n <>\n {/* <ReactDevOverlay/> */}\n {dev ? (\n <>\n {children}\n <Noop />\n </>\n ) : (\n children\n )}\n {/* <RouteAnnouncer/> */}\n <Noop />\n </>\n </AppContainer>\n </>\n )\n }\n\n const ctx = {\n err,\n req: isAutoExport ? undefined : req,\n res: isAutoExport ? undefined : res,\n pathname,\n query,\n asPath,\n locale: renderOpts.locale,\n locales: renderOpts.locales,\n defaultLocale: renderOpts.defaultLocale,\n AppTree: (props: any) => {\n return (\n <AppContainerWithIsomorphicFiberStructure>\n {renderPageTree(App, OriginComponent, { ...props, router })}\n </AppContainerWithIsomorphicFiberStructure>\n )\n },\n defaultGetInitialProps: async (\n docCtx: DocumentContext,\n options: { nonce?: string } = {}\n ): Promise<DocumentInitialProps> => {\n const enhanceApp = (AppComp: any) => {\n return (props: any) => <AppComp {...props} />\n }\n\n const { html, head: renderPageHead } = await docCtx.renderPage({\n enhanceApp,\n })\n const styles = jsxStyleRegistry.styles({ nonce: options.nonce })\n jsxStyleRegistry.flush()\n return { html, head: renderPageHead, styles }\n },\n }\n let props: any\n\n const nextExport =\n !isSSG && (renderOpts.nextExport || (dev && (isAutoExport || isFallback)))\n\n const styledJsxInsertedHTML = () => {\n const styles = jsxStyleRegistry.styles()\n jsxStyleRegistry.flush()\n return <>{styles}</>\n }\n\n props = await loadGetInitialProps(App, {\n AppTree: ctx.AppTree,\n Component,\n router,\n ctx,\n })\n\n if ((isSSG || getServerSideProps) && isPreview) {\n props.__N_PREVIEW = true\n }\n\n if (isSSG) {\n props[STATIC_PROPS_ID] = true\n }\n\n if (isSSG && !isFallback) {\n let data: Readonly<UnwrapPromise<ReturnType<GetStaticProps>>>\n\n try {\n data = await getTracer().trace(\n RenderSpan.getStaticProps,\n {\n spanName: `getStaticProps ${pathname}`,\n attributes: {\n 'next.route': pathname,\n },\n },\n () =>\n getStaticProps({\n ...(pageIsDynamic ? { params } : undefined),\n ...(isPreview\n ? { draftMode: true, preview: true, previewData: previewData }\n : undefined),\n locales: [...(renderOpts.locales ?? [])],\n locale: renderOpts.locale,\n defaultLocale: renderOpts.defaultLocale,\n revalidateReason: renderOpts.isOnDemandRevalidate\n ? 'on-demand'\n : isBuildTimeSSG\n ? 'build'\n : 'stale',\n })\n )\n } catch (staticPropsError: any) {\n // remove not found error code to prevent triggering legacy\n // 404 rendering\n if (staticPropsError && staticPropsError.code === 'ENOENT') {\n delete staticPropsError.code\n }\n throw staticPropsError\n }\n\n if (data == null) {\n throw new Error(GSP_NO_RETURNED_VALUE)\n }\n\n const invalidKeys = Object.keys(data).filter(\n (key) =>\n key !== 'revalidate' &&\n key !== 'props' &&\n key !== 'redirect' &&\n key !== 'notFound'\n )\n\n if (invalidKeys.includes('unstable_revalidate')) {\n throw new Error(UNSTABLE_REVALIDATE_RENAME_ERROR)\n }\n\n if (invalidKeys.length) {\n throw new Error(invalidKeysMsg('getStaticProps', invalidKeys))\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (\n typeof (data as any).notFound !== 'undefined' &&\n typeof (data as any).redirect !== 'undefined'\n ) {\n throw new Error(\n `\\`redirect\\` and \\`notFound\\` can not both be returned from ${\n isSSG ? 'getStaticProps' : 'getServerSideProps'\n } at the same time. Page: ${pathname}\\nSee more info here: https://nextjs.org/docs/messages/gssp-mixed-not-found-redirect`\n )\n }\n }\n\n if ('notFound' in data && data.notFound) {\n if (pathname === '/404') {\n throw new Error(\n `The /404 page can not return notFound in \"getStaticProps\", please remove it to continue!`\n )\n }\n\n metadata.isNotFound = true\n }\n\n if (\n 'redirect' in data &&\n data.redirect &&\n typeof data.redirect === 'object'\n ) {\n checkRedirectValues(data.redirect as Redirect, req, 'getStaticProps')\n\n if (isBuildTimeSSG) {\n throw new Error(\n `\\`redirect\\` can not be returned from getStaticProps during prerendering (${req.url})\\n` +\n `See more info here: https://nextjs.org/docs/messages/gsp-redirect-during-prerender`\n )\n }\n\n ;(data as any).props = {\n __N_REDIRECT: data.redirect.destination,\n __N_REDIRECT_STATUS: getRedirectStatus(data.redirect),\n }\n if (typeof data.redirect.basePath !== 'undefined') {\n ;(data as any).props.__N_REDIRECT_BASE_PATH = data.redirect.basePath\n }\n metadata.isRedirect = true\n }\n\n if (\n (dev || isBuildTimeSSG) &&\n !metadata.isNotFound &&\n !isSerializableProps(pathname, 'getStaticProps', (data as any).props)\n ) {\n // this fn should throw an error instead of ever returning `false`\n throw new Error(\n 'invariant: getStaticProps did not return valid props. Please report this.'\n )\n }\n\n let revalidate: Revalidate\n if ('revalidate' in data) {\n if (data.revalidate && renderOpts.nextConfigOutput === 'export') {\n throw new Error(\n 'ISR cannot be used with \"output: export\". See more info here: https://nextjs.org/docs/advanced-features/static-html-export'\n )\n }\n if (typeof data.revalidate === 'number') {\n if (!Number.isInteger(data.revalidate)) {\n throw new Error(\n `A page's revalidate option must be seconds expressed as a natural number for ${req.url}. Mixed numbers, such as '${data.revalidate}', cannot be used.` +\n `\\nTry changing the value to '${Math.ceil(\n data.revalidate\n )}' or using \\`Math.ceil()\\` if you're computing the value.`\n )\n } else if (data.revalidate <= 0) {\n throw new Error(\n `A page's revalidate option can not be less than or equal to zero for ${req.url}. A revalidate option of zero means to revalidate after _every_ request, and implies stale data cannot be tolerated.` +\n `\\n\\nTo never revalidate, you can set revalidate to \\`false\\` (only ran once at build-time).` +\n `\\nTo revalidate as soon as possible, you can set the value to \\`1\\`.`\n )\n } else {\n if (data.revalidate > 31536000) {\n // if it's greater than a year for some reason error\n console.warn(\n `Warning: A page's revalidate option was set to more than a year for ${req.url}. This may have been done in error.` +\n `\\nTo only run getStaticProps at build-time and not revalidate at runtime, you can set \\`revalidate\\` to \\`false\\`!`\n )\n }\n\n revalidate = data.revalidate\n }\n } else if (data.revalidate === true) {\n // When enabled, revalidate after 1 second. This value is optimal for\n // the most up-to-date page possible, but without a 1-to-1\n // request-refresh ratio.\n revalidate = 1\n } else if (\n data.revalidate === false ||\n typeof data.revalidate === 'undefined'\n ) {\n // By default, we never revalidate.\n revalidate = false\n } else {\n throw new Error(\n `A page's revalidate option must be seconds expressed as a natural number. Mixed numbers and strings cannot be used. Received '${JSON.stringify(\n data.revalidate\n )}' for ${req.url}`\n )\n }\n } else {\n // By default, we never revalidate.\n revalidate = false\n }\n\n props.pageProps = Object.assign(\n {},\n props.pageProps,\n 'props' in data ? data.props : undefined\n )\n\n // pass up cache control and props for export\n metadata.cacheControl = { revalidate, expire: undefined }\n metadata.pageData = props\n\n // this must come after revalidate is added to renderResultMeta\n if (metadata.isNotFound) {\n return new RenderResult(null, { metadata })\n }\n }\n\n if (getServerSideProps) {\n props[SERVER_PROPS_ID] = true\n }\n\n if (getServerSideProps && !isFallback) {\n let data: UnwrapPromise<ReturnType<GetServerSideProps>>\n\n let canAccessRes = true\n let resOrProxy = res\n let deferredContent = false\n if (process.env.NODE_ENV !== 'production') {\n resOrProxy = new Proxy<ServerResponse>(res, {\n get: function (obj, prop) {\n if (!canAccessRes) {\n const message =\n `You should not access 'res' after getServerSideProps resolves.` +\n `\\nRead more: https://nextjs.org/docs/messages/gssp-no-mutating-res`\n\n if (deferredContent) {\n throw new Error(message)\n } else {\n warn(message)\n }\n }\n\n if (typeof prop === 'symbol') {\n return ReflectAdapter.get(obj, prop, res)\n }\n\n return ReflectAdapter.get(obj, prop, res)\n },\n })\n }\n\n try {\n data = await getTracer().trace(\n RenderSpan.getServerSideProps,\n {\n spanName: `getServerSideProps ${pathname}`,\n attributes: {\n 'next.route': pathname,\n },\n },\n async () =>\n getServerSideProps({\n req: req as IncomingMessage & {\n cookies: NextApiRequestCookies\n },\n res: resOrProxy,\n query,\n resolvedUrl: renderOpts.resolvedUrl as string,\n ...(pageIsDynamic ? { params } : undefined),\n ...(previewData !== false\n ? { draftMode: true, preview: true, previewData: previewData }\n : undefined),\n // We create a copy here to avoid having the types of\n // `getServerSideProps` change. This ensures that users can't\n // mutate this array and have it poison the reference.\n locales: [...(renderOpts.locales ?? [])],\n locale: renderOpts.locale,\n defaultLocale: renderOpts.defaultLocale,\n })\n )\n canAccessRes = false\n metadata.cacheControl = { revalidate: 0, expire: undefined }\n } catch (serverSidePropsError: any) {\n // remove not found error code to prevent triggering legacy\n // 404 rendering\n if (\n isError(serverSidePropsError) &&\n serverSidePropsError.code === 'ENOENT'\n ) {\n delete serverSidePropsError.code\n }\n throw serverSidePropsError\n }\n\n if (data == null) {\n throw new Error(GSSP_NO_RETURNED_VALUE)\n }\n\n if ((data as any).props instanceof Promise) {\n deferredContent = true\n }\n\n const invalidKeys = Object.keys(data).filter(\n (key) => key !== 'props' && key !== 'redirect' && key !== 'notFound'\n )\n\n if ((data as any).unstable_notFound) {\n throw new Error(\n `unstable_notFound has been renamed to notFound, please update the field to continue. Page: ${pathname}`\n )\n }\n if ((data as any).unstable_redirect) {\n throw new Error(\n `unstable_redirect has been renamed to redirect, please update the field to continue. Page: ${pathname}`\n )\n }\n\n if (invalidKeys.length) {\n throw new Error(invalidKeysMsg('getServerSideProps', invalidKeys))\n }\n\n if ('notFound' in data && data.notFound) {\n if (pathname === '/404') {\n throw new Error(\n `The /404 page can not return notFound in \"getStaticProps\", please remove it to continue!`\n )\n }\n\n metadata.isNotFound = true\n return new RenderResult(null, { metadata })\n }\n\n if ('redirect' in data && typeof data.redirect === 'object') {\n checkRedirectValues(data.redirect as Redirect, req, 'getServerSideProps')\n ;(data as any).props = {\n __N_REDIRECT: data.redirect.destination,\n __N_REDIRECT_STATUS: getRedirectStatus(data.redirect),\n }\n if (typeof data.redirect.basePath !== 'undefined') {\n ;(data as any).props.__N_REDIRECT_BASE_PATH = data.redirect.basePath\n }\n metadata.isRedirect = true\n }\n\n if (deferredContent) {\n ;(data as any).props = await (data as any).props\n }\n\n if (\n (dev || isBuildTimeSSG) &&\n !isSerializableProps(pathname, 'getServerSideProps', (data as any).props)\n ) {\n // this fn should throw an error instead of ever returning `false`\n throw new Error(\n 'invariant: getServerSideProps did not return valid props. Please report this.'\n )\n }\n\n props.pageProps = Object.assign({}, props.pageProps, (data as any).props)\n metadata.pageData = props\n }\n\n if (\n !isSSG && // we only show this warning for legacy pages\n !getServerSideProps &&\n process.env.NODE_ENV !== 'production' &&\n Object.keys(props?.pageProps || {}).includes('url')\n ) {\n console.warn(\n `The prop \\`url\\` is a reserved prop in Next.js for legacy reasons and will be overridden on page ${pathname}\\n` +\n `See more info here: https://nextjs.org/docs/messages/reserved-page-prop`\n )\n }\n\n // Avoid rendering page un-necessarily for getServerSideProps data request\n // and getServerSideProps/getStaticProps redirects\n if ((isNextDataRequest && !isSSG) || metadata.isRedirect) {\n return new RenderResult(JSON.stringify(props), {\n metadata,\n })\n }\n\n // We don't call getStaticProps or getServerSideProps while generating\n // the fallback so make sure to set pageProps to an empty object\n if (isFallback) {\n props.pageProps = {}\n }\n\n // the response might be finished on the getInitialProps call\n if (isResSent(res) && !isSSG) return new RenderResult(null, { metadata })\n\n // we preload the buildManifest for auto-export dynamic pages\n // to speed up hydrating query values\n let filteredBuildManifest = buildManifest\n if (isAutoExport && pageIsDynamic) {\n const page = denormalizePagePath(normalizePagePath(pathname))\n // This code would be much cleaner using `immer` and directly pushing into\n // the result from `getPageFiles`, we could maybe consider that in the\n // future.\n if (page in filteredBuildManifest.pages) {\n filteredBuildManifest = {\n ...filteredBuildManifest,\n pages: {\n ...filteredBuildManifest.pages,\n [page]: [\n ...filteredBuildManifest.pages[page],\n ...filteredBuildManifest.lowPriorityFiles.filter((f) =>\n f.includes('_buildManifest')\n ),\n ],\n },\n lowPriorityFiles: filteredBuildManifest.lowPriorityFiles.filter(\n (f) => !f.includes('_buildManifest')\n ),\n }\n }\n }\n\n const Body = ({ children }: { children: JSX.Element }) => {\n return inAmpMode ? children : <div id=\"__next\">{children}</div>\n }\n\n const renderDocument = async () => {\n // For `Document`, there are two cases that we don't support:\n // 1. Using `Document.getInitialProps` in the Edge runtime.\n // 2. Using the class component `Document` with concurrent features.\n\n const BuiltinFunctionalDocument: DocumentType | undefined = (\n Document as any\n )[NEXT_BUILTIN_DOCUMENT]\n\n if (process.env.NEXT_RUNTIME === 'edge' && Document.getInitialProps) {\n // In the Edge runtime, `Document.getInitialProps` isn't supported.\n // We throw an error here if it's customized.\n if (BuiltinFunctionalDocument) {\n Document = BuiltinFunctionalDocument\n } else {\n throw new Error(\n '`getInitialProps` in Document component is not supported with the Edge Runtime.'\n )\n }\n }\n\n async function loadDocumentInitialProps(\n renderShell: (\n _App: AppType,\n _Component: NextComponentType\n ) => Promise<ReactReadableStream>\n ) {\n const renderPage: RenderPage = async (\n options: ComponentsEnhancer = {}\n ): Promise<RenderPageResult> => {\n if (ctx.err && ErrorDebug) {\n // Always start rendering the shell even if there's an error.\n if (renderShell) {\n renderShell(App, Component)\n }\n\n const html = await renderToString(\n <Body>\n <ErrorDebug />\n </Body>\n )\n return { html, head }\n }\n\n if (dev && (props.router || props.Component)) {\n throw new Error(\n `'router' and 'Component' can not be returned in getInitialProps from _app.js https://nextjs.org/docs/messages/cant-override-next-props`\n )\n }\n\n const { App: EnhancedApp, Component: EnhancedComponent } =\n enhanceComponents(options, App, Component)\n\n const stream = await renderShell(EnhancedApp, EnhancedComponent)\n await stream.allReady\n const html = await streamToString(stream)\n\n return { html, head }\n }\n const documentCtx = { ...ctx, renderPage }\n const docProps: DocumentInitialProps = await loadGetInitialProps(\n Document,\n documentCtx\n )\n // the response might be finished on the getInitialProps call\n if (isResSent(res) && !isSSG) return null\n\n if (!docProps || typeof docProps.html !== 'string') {\n const message = `\"${getDisplayName(\n Document\n )}.getInitialProps()\" should resolve to an object with a \"html\" prop set with a valid html string`\n throw new Error(message)\n }\n\n return { docProps, documentCtx }\n }\n\n const renderContent = (_App: AppType, _Component: NextComponentType) => {\n const EnhancedApp = _App || App\n const EnhancedComponent = _Component || Component\n\n return ctx.err && ErrorDebug ? (\n <Body>\n <ErrorDebug />\n </Body>\n ) : (\n <Body>\n <AppContainerWithIsomorphicFiberStructure>\n {renderPageTree(EnhancedApp, EnhancedComponent, {\n ...props,\n router,\n })}\n </AppContainerWithIsomorphicFiberStructure>\n </Body>\n )\n }\n\n // Always using react concurrent rendering mode with required react version 18.x\n const renderShell = async (\n EnhancedApp: AppType,\n EnhancedComponent: NextComponentType\n ) => {\n const content = renderContent(EnhancedApp, EnhancedComponent)\n return await renderToInitialFizzStream({\n ReactDOMServer: ReactDOMServerPages,\n element: content,\n })\n }\n\n const hasDocumentGetInitialProps =\n process.env.NEXT_RUNTIME !== 'edge' && !!Document.getInitialProps\n\n // If it has getInitialProps, we will render the shell in `renderPage`.\n // Otherwise we do it right now.\n let documentInitialPropsRes:\n | {}\n | Awaited<ReturnType<typeof loadDocumentInitialProps>>\n\n const [rawStyledJsxInsertedHTML, content] = await Promise.all([\n renderToString(styledJsxInsertedHTML()),\n (async () => {\n if (hasDocumentGetInitialProps) {\n documentInitialPropsRes = await loadDocumentInitialProps(renderShell)\n if (documentInitialPropsRes === null) return null\n const { docProps } = documentInitialPropsRes as any\n return docProps.html\n } else {\n documentInitialPropsRes = {}\n const stream = await renderShell(App, Component)\n await stream.allReady\n return streamToString(stream)\n }\n })(),\n ])\n\n if (content === null) {\n return null\n }\n\n const contentHTML = rawStyledJsxInsertedHTML + content\n\n // @ts-ignore: documentInitialPropsRes is set\n const { docProps } = (documentInitialPropsRes as any) || {}\n const documentElement = (htmlProps: any) => {\n if (process.env.NEXT_RUNTIME === 'edge') {\n return (Document as any)()\n } else {\n return <Document {...htmlProps} {...docProps} />\n }\n }\n\n let styles\n if (hasDocumentGetInitialProps) {\n styles = docProps.styles\n head = docProps.head\n } else {\n styles = jsxStyleRegistry.styles()\n jsxStyleRegistry.flush()\n }\n\n return {\n contentHTML,\n documentElement,\n head,\n headTags: [],\n styles,\n }\n }\n\n getTracer().setRootSpanAttribute('next.route', renderOpts.page)\n const documentResult = await getTracer().trace(\n RenderSpan.renderDocument,\n {\n spanName: `render route (pages) ${renderOpts.page}`,\n attributes: {\n 'next.route': renderOpts.page,\n },\n },\n async () => renderDocument()\n )\n if (!documentResult) {\n return new RenderResult(null, { metadata })\n }\n\n const dynamicImportsIds = new Set<string | number>()\n const dynamicImports = new Set<string>()\n\n for (const mod of reactLoadableModules) {\n const manifestItem = reactLoadableManifest[mod]\n\n if (manifestItem) {\n dynamicImportsIds.add(manifestItem.id)\n manifestItem.files.forEach((item) => {\n dynamicImports.add(item)\n })\n }\n }\n\n const hybridAmp = ampState.hybrid\n const docComponentsRendered: DocumentProps['docComponentsRendered'] = {}\n\n const {\n assetPrefix,\n defaultLocale,\n disableOptimizedLoading,\n domainLocales,\n locale,\n locales,\n runtimeConfig,\n } = renderOpts\n const htmlProps: HtmlProps = {\n __NEXT_DATA__: {\n props, // The result of getInitialProps\n page: pathname, // The rendered page\n query, // querystring parsed / passed by the user\n buildId: sharedContext.buildId,\n assetPrefix: assetPrefix === '' ? undefined : assetPrefix, // send assetPrefix to the client side when configured, otherwise don't sent in the resulting HTML\n runtimeConfig, // runtimeConfig if provided, otherwise don't sent in the resulting HTML\n nextExport: nextExport === true ? true : undefined, // If this is a page exported by `next export`\n autoExport: isAutoExport === true ? true : undefined, // If this is an auto exported page\n isFallback,\n isExperimentalCompile,\n dynamicIds:\n dynamicImportsIds.size === 0\n ? undefined\n : Array.from(dynamicImportsIds),\n err: renderOpts.err ? serializeError(dev, renderOpts.err) : undefined, // Error if one happened, otherwise don't sent in the resulting HTML\n gsp: !!getStaticProps ? true : undefined, // whether the page is getStaticProps\n gssp: !!getServerSideProps ? true : undefined, // whether the page is getServerSideProps\n customServer: sharedContext.customServer,\n gip: hasPageGetInitialProps ? true : undefined, // whether the page has getInitialProps\n appGip: !defaultAppGetInitialProps ? true : undefined, // whether the _app has getInitialProps\n locale,\n locales,\n defaultLocale,\n domainLocales,\n isPreview: isPreview === true ? true : undefined,\n notFoundSrcPage: notFoundSrcPage && dev ? notFoundSrcPage : undefined,\n },\n strictNextHead: renderOpts.strictNextHead,\n buildManifest: filteredBuildManifest,\n docComponentsRendered,\n dangerousAsPath: router.asPath,\n canonicalBase:\n !renderOpts.ampPath && getRequestMeta(req, 'didStripLocale')\n ? `${renderOpts.canonicalBase || ''}/${renderOpts.locale}`\n : renderOpts.canonicalBase,\n ampPath,\n inAmpMode,\n isDevelopment: !!dev,\n hybridAmp,\n dynamicImports: Array.from(dynamicImports),\n dynamicCssManifest: new Set(renderOpts.dynamicCssManifest || []),\n assetPrefix,\n // Only enabled in production as development mode has features relying on HMR (style injection for example)\n unstable_runtimeJS:\n process.env.NODE_ENV === 'production'\n ? pageConfig.unstable_runtimeJS\n : undefined,\n unstable_JsPreload: pageConfig.unstable_JsPreload,\n assetQueryString,\n scriptLoader,\n locale,\n disableOptimizedLoading,\n head: documentResult.head,\n headTags: documentResult.headTags,\n styles: documentResult.styles,\n crossOrigin: renderOpts.crossOrigin,\n optimizeCss: renderOpts.optimizeCss,\n nextConfigOutput: renderOpts.nextConfigOutput,\n nextScriptWorkers: renderOpts.nextScriptWorkers,\n runtime: globalRuntime,\n largePageDataBytes: renderOpts.largePageDataBytes,\n nextFontManifest: renderOpts.nextFontManifest,\n experimentalClientTraceMetadata:\n renderOpts.experimental.clientTraceMetadata,\n }\n\n const document = (\n <AmpStateContext.Provider value={ampState}>\n <HtmlContext.Provider value={htmlProps}>\n {documentResult.documentElement(htmlProps)}\n </HtmlContext.Provider>\n </AmpStateContext.Provider>\n )\n\n const documentHTML = await getTracer().trace(\n RenderSpan.renderToString,\n async () => renderToString(document)\n )\n\n if (process.env.NODE_ENV !== 'production') {\n const nonRenderedComponents = []\n const expectedDocComponents = ['Main', 'Head', 'NextScript', 'Html']\n\n for (const comp of expectedDocComponents) {\n if (!(docComponentsRendered as any)[comp]) {\n nonRenderedComponents.push(comp)\n }\n }\n\n if (nonRenderedComponents.length) {\n const missingComponentList = nonRenderedComponents\n .map((e) => `<${e} />`)\n .join(', ')\n const plural = nonRenderedComponents.length !== 1 ? 's' : ''\n console.warn(\n `Your custom Document (pages/_document) did not render all the required subcomponent${plural}.\\n` +\n `Missing component${plural}: ${missingComponentList}\\n` +\n 'Read how to fix here: https://nextjs.org/docs/messages/missing-document-component'\n )\n }\n }\n\n const [renderTargetPrefix, renderTargetSuffix] = documentHTML.split(\n '<next-js-internal-body-render-target></next-js-internal-body-render-target>',\n 2\n )\n\n let prefix = ''\n if (!documentHTML.startsWith(DOCTYPE)) {\n prefix += DOCTYPE\n }\n prefix += renderTargetPrefix\n if (inAmpMode) {\n prefix += '<!-- __NEXT_DATA__ -->'\n }\n\n const content = prefix + documentResult.contentHTML + renderTargetSuffix\n\n const optimizedHtml = await postProcessHTML(pathname, content, renderOpts, {\n inAmpMode,\n hybridAmp,\n })\n\n return new RenderResult(optimizedHtml, { metadata })\n}\n\nexport type PagesRender = (\n req: IncomingMessage,\n res: ServerResponse,\n pathname: string,\n query: NextParsedUrlQuery,\n renderOpts: RenderOpts,\n sharedContext: PagesSharedContext,\n renderContext: PagesRenderContext\n) => Promise<RenderResult>\n\nexport const renderToHTML: PagesRender = (\n req,\n res,\n pathname,\n query,\n renderOpts,\n sharedContext,\n renderContext\n) => {\n return renderToHTMLImpl(\n req,\n res,\n pathname,\n query,\n renderOpts,\n renderOpts,\n sharedContext,\n renderContext\n )\n}\n"],"names":["setLazyProp","getCookieParser","React","ReactDOMServerPages","StyleRegistry","createStyleRegistry","GSP_NO_RETURNED_VALUE","GSSP_COMPONENT_MEMBER_ERROR","GSSP_NO_RETURNED_VALUE","STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR","SERVER_PROPS_GET_INIT_PROPS_CONFLICT","SERVER_PROPS_SSG_CONFLICT","SSG_GET_INITIAL_PROPS_CONFLICT","UNSTABLE_REVALIDATE_RENAME_ERROR","NEXT_BUILTIN_DOCUMENT","SERVER_PROPS_ID","STATIC_PROPS_ID","STATIC_STATUS_PAGES","isSerializableProps","isInAmpMode","AmpStateContext","defaultHead","HeadManagerContext","Loadable","LoadableContext","RouterContext","isDynamicRoute","getDisplayName","isResSent","loadGetInitialProps","HtmlContext","normalizePagePath","denormalizePagePath","getRequestMeta","allowedStatusCodes","getRedirectStatus","RenderResult","isError","streamToString","renderToInitialFizzStream","ImageConfigContext","stripAnsi","stripInternalQueries","adaptForAppRouterInstance","adaptForPathParams","adaptForSearchParams","PathnameContextProviderAdapter","AppRouterContext","SearchParamsContext","PathParamsContext","getTracer","RenderSpan","ReflectAdapter","getCacheControlHeader","getErrorSource","tryGetPreviewData","warn","postProcessHTML","DOCTYPE","process","env","NEXT_RUNTIME","require","console","bind","_pathname","html","noRouter","message","Error","renderToString","element","renderStream","renderToReadableStream","allReady","ServerRouter","constructor","pathname","query","as","isFallback","isReady","basePath","locale","locales","defaultLocale","domainLocales","isPreview","isLocaleDomain","route","replace","asPath","push","reload","back","forward","prefetch","beforePopState","enhanceComponents","options","App","Component","enhanceApp","enhanceComponent","renderPageTree","props","invalidKeysMsg","methodName","invalidKeys","docsPathname","toLocaleLowerCase","join","checkRedirectValues","redirect","req","method","destination","permanent","statusCode","errors","hasStatusCode","hasPermanent","has","destinationType","basePathType","length","url","errorToJSON","err","source","name","stack","digest","serializeError","dev","renderToHTMLImpl","res","renderOpts","extra","sharedContext","renderContext","headers","metadata","assetQueryString","userAgent","toLowerCase","includes","Date","now","deploymentId","Object","assign","ampPath","pageConfig","buildManifest","reactLoadableManifest","ErrorDebug","getStaticProps","getStaticPaths","getServerSideProps","isNextDataRequest","params","previewProps","images","runtime","globalRuntime","isExperimentalCompile","expireTime","Document","OriginComponent","notFoundSrcPage","developmentNotFoundSourcePage","isSSG","isBuildTimeSSG","nextExport","defaultAppGetInitialProps","getInitialProps","origGetInitialProps","hasPageGetInitialProps","hasPageScripts","unstable_scriptLoader","pageIsDynamic","defaultErrorGetInitialProps","isAutoExport","setHeader","revalidate","expire","nextConfigOutput","resolvedAsPath","isValidElementType","amp","endsWith","setIsrStatus","preloadAll","undefined","previewData","multiZoneDraftMode","routerIsReady","router","appRouter","scriptLoader","jsxStyleRegistry","ampState","ampFirst","hasQuery","Boolean","hybrid","inAmpMode","head","reactLoadableModules","initialScripts","beforeInteractive","concat","filter","script","strategy","map","AppContainer","children","Provider","value","updateHead","state","updateScripts","scripts","mountedInstances","Set","moduleName","registry","Noop","AppContainerWithIsomorphicFiberStructure","ctx","AppTree","defaultGetInitialProps","docCtx","AppComp","renderPageHead","renderPage","styles","nonce","flush","styledJsxInsertedHTML","__N_PREVIEW","data","trace","spanName","attributes","draftMode","preview","revalidateReason","isOnDemandRevalidate","staticPropsError","code","keys","key","NODE_ENV","notFound","isNotFound","__N_REDIRECT","__N_REDIRECT_STATUS","__N_REDIRECT_BASE_PATH","isRedirect","Number","isInteger","Math","ceil","JSON","stringify","pageProps","cacheControl","pageData","canAccessRes","resOrProxy","deferredContent","Proxy","get","obj","prop","resolvedUrl","serverSidePropsError","Promise","unstable_notFound","unstable_redirect","filteredBuildManifest","page","pages","lowPriorityFiles","f","Body","div","id","renderDocument","BuiltinFunctionalDocument","loadDocumentInitialProps","renderShell","EnhancedApp","EnhancedComponent","stream","documentCtx","docProps","renderContent","_App","_Component","content","ReactDOMServer","hasDocumentGetInitialProps","documentInitialPropsRes","rawStyledJsxInsertedHTML","all","contentHTML","documentElement","htmlProps","headTags","setRootSpanAttribute","documentResult","dynamicImportsIds","dynamicImports","mod","manifestItem","add","files","forEach","item","hybridAmp","docComponentsRendered","assetPrefix","disableOptimizedLoading","runtimeConfig","__NEXT_DATA__","buildId","autoExport","dynamicIds","size","Array","from","gsp","gssp","customServer","gip","appGip","strictNextHead","dangerousAsPath","canonicalBase","isDevelopment","dynamicCssManifest","unstable_runtimeJS","unstable_JsPreload","crossOrigin","optimizeCss","nextScriptWorkers","largePageDataBytes","nextFontManifest","experimentalClientTraceMetadata","experimental","clientTraceMetadata","document","documentHTML","nonRenderedComponents","expectedDocComponents","comp","missingComponentList","e","plural","renderTargetPrefix","renderTargetSuffix","split","prefix","startsWith","optimizedHtml","renderToHTML"],"mappings":";AAiBA,SAGEA,WAAW,QACN,cAAa;AACpB,SAASC,eAAe,QAAQ,gCAA+B;AAmB/D,OAAOC,WAAyB,QAAO;AACvC,OAAOC,yBAAyB,uCAAs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,CAAC,GACvD;QAEN;IACF;IAEA,MAAM,CAACG,oBAAoBC,mBAAmB,GAAGR,aAAaS,KAAK,CACjE,+EACA;IAGF,IAAIC,SAAS;IACb,IAAI,CAACV,aAAaW,UAAU,CAACrT,UAAU;QACrCoT,UAAUpT;IACZ;IACAoT,UAAUH;IACV,IAAI5J,WAAW;QACb+J,UAAU;IACZ;IAEA,MAAM/D,UAAU+D,SAASpD,eAAeL,WAAW,GAAGuD;IAEtD,MAAMI,gBAAgB,MAAMvT,gBAAgBoB,UAAUkO,SAAStK,YAAY;QACzEsE;QACAoH;IACF;IAEA,OAAO,IAAI/R,aAAa4U,eAAe;QAAElO;IAAS;AACpD;AAYA,OAAO,MAAMmO,eAA4B,CACvC/P,KACAsB,KACA3D,UACAC,OACA2D,YACAE,eACAC;IAEA,OAAOL,iBACLrB,KACAsB,KACA3D,UACAC,OACA2D,YACAA,YACAE,eACAC;AAEJ,EAAC","ignoreList":[0]}
1
+ {"version":3,"sources":["../../src/server/render.tsx"],"sourcesContent":["import type { IncomingMessage, ServerResponse } from 'http'\nimport type { ParsedUrlQuery } from 'querystring'\nimport type { NextRouter } from '../shared/lib/router/router'\nimport type { HtmlProps } from '../shared/lib/html-context.shared-runtime'\nimport type { DomainLocale } from './config'\nimport type {\n AppType,\n DocumentInitialProps,\n DocumentType,\n DocumentProps,\n DocumentContext,\n NextComponentType,\n RenderPage,\n RenderPageResult,\n} from '../shared/lib/utils'\nimport type { ImageConfigComplete } from '../shared/lib/image-config'\nimport type { Redirect } from '../lib/load-custom-routes'\nimport {\n type NextApiRequestCookies,\n type __ApiPreviewProps,\n setLazyProp,\n} from './api-utils'\nimport { getCookieParser } from './api-utils/get-cookie-parser'\nimport type { LoadComponentsReturnType } from './load-components'\nimport type {\n GetServerSideProps,\n GetStaticProps,\n PreviewData,\n ServerRuntime,\n SizeLimit,\n} from '../types'\nimport type { UnwrapPromise } from '../lib/coalesced-function'\nimport type { ReactReadableStream } from './stream-utils/node-web-streams-helper'\nimport type { ClientReferenceManifest } from '../build/webpack/plugins/flight-manifest-plugin'\nimport type { NextFontManifest } from '../build/webpack/plugins/next-font-manifest-plugin'\nimport type { PagesModule } from './route-modules/pages/module'\nimport type { ComponentsEnhancer } from '../shared/lib/utils'\nimport type { NextParsedUrlQuery } from './request-meta'\nimport type { Revalidate } from './lib/cache-control'\nimport type { COMPILER_NAMES } from '../shared/lib/constants'\n\nimport React, { type JSX } from 'react'\nimport ReactDOMServerPages from 'next/dist/server/ReactDOMServerPages'\nimport { StyleRegistry, createStyleRegistry } from 'styled-jsx'\nimport {\n GSP_NO_RETURNED_VALUE,\n GSSP_COMPONENT_MEMBER_ERROR,\n GSSP_NO_RETURNED_VALUE,\n STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR,\n SERVER_PROPS_GET_INIT_PROPS_CONFLICT,\n SERVER_PROPS_SSG_CONFLICT,\n SSG_GET_INITIAL_PROPS_CONFLICT,\n UNSTABLE_REVALIDATE_RENAME_ERROR,\n} from '../lib/constants'\nimport {\n NEXT_BUILTIN_DOCUMENT,\n SERVER_PROPS_ID,\n STATIC_PROPS_ID,\n STATIC_STATUS_PAGES,\n} from '../shared/lib/constants'\nimport { isSerializableProps } from '../lib/is-serializable-props'\nimport { isInAmpMode } from '../shared/lib/amp-mode'\nimport { AmpStateContext } from '../shared/lib/amp-context.shared-runtime'\nimport { defaultHead } from '../shared/lib/head'\nimport { HeadManagerContext } from '../shared/lib/head-manager-context.shared-runtime'\nimport Loadable from '../shared/lib/loadable.shared-runtime'\nimport { LoadableContext } from '../shared/lib/loadable-context.shared-runtime'\nimport { RouterContext } from '../shared/lib/router-context.shared-runtime'\nimport { isDynamicRoute } from '../shared/lib/router/utils/is-dynamic'\nimport {\n getDisplayName,\n isResSent,\n loadGetInitialProps,\n} from '../shared/lib/utils'\nimport { HtmlContext } from '../shared/lib/html-context.shared-runtime'\nimport { normalizePagePath } from '../shared/lib/page-path/normalize-page-path'\nimport { denormalizePagePath } from '../shared/lib/page-path/denormalize-page-path'\nimport { getRequestMeta } from './request-meta'\nimport { allowedStatusCodes, getRedirectStatus } from '../lib/redirect-status'\nimport RenderResult, { type PagesRenderResultMetadata } from './render-result'\nimport isError from '../lib/is-error'\nimport {\n streamToString,\n renderToInitialFizzStream,\n} from './stream-utils/node-web-streams-helper'\nimport { ImageConfigContext } from '../shared/lib/image-config-context.shared-runtime'\nimport stripAnsi from 'next/dist/compiled/strip-ansi'\nimport { stripInternalQueries } from './internal-utils'\nimport {\n adaptForAppRouterInstance,\n adaptForPathParams,\n adaptForSearchParams,\n PathnameContextProviderAdapter,\n} from '../shared/lib/router/adapters'\nimport { AppRouterContext } from '../shared/lib/app-router-context.shared-runtime'\nimport {\n SearchParamsContext,\n PathParamsContext,\n} from '../shared/lib/hooks-client-context.shared-runtime'\nimport { getTracer } from './lib/trace/tracer'\nimport { RenderSpan } from './lib/trace/constants'\nimport { ReflectAdapter } from './web/spec-extension/adapters/reflect'\nimport { getCacheControlHeader } from './lib/cache-control'\nimport { getErrorSource } from '../shared/lib/error-source'\nimport type { DeepReadonly } from '../shared/lib/deep-readonly'\nimport type { PagesDevOverlayType } from '../client/components/react-dev-overlay/pages/pages-dev-overlay'\nimport { getScriptNonceFromHeader } from './app-render/get-script-nonce-from-header'\n\nlet tryGetPreviewData: typeof import('./api-utils/node/try-get-preview-data').tryGetPreviewData\nlet warn: typeof import('../build/output/log').warn\nlet postProcessHTML: typeof import('./post-process').postProcessHTML\n\nconst DOCTYPE = '<!DOCTYPE html>'\n\nif (process.env.NEXT_RUNTIME !== 'edge') {\n tryGetPreviewData =\n require('./api-utils/node/try-get-preview-data').tryGetPreviewData\n warn = require('../build/output/log').warn\n postProcessHTML = require('./post-process').postProcessHTML\n} else {\n warn = console.warn.bind(console)\n postProcessHTML = async (_pathname: string, html: string) => html\n}\n\nfunction noRouter() {\n const message =\n 'No router instance found. you should only use \"next/router\" inside the client side of your app. https://nextjs.org/docs/messages/no-router-instance'\n throw new Error(message)\n}\n\nasync function renderToString(element: React.ReactElement) {\n const renderStream = await ReactDOMServerPages.renderToReadableStream(element)\n await renderStream.allReady\n return streamToString(renderStream)\n}\n\nclass ServerRouter implements NextRouter {\n route: string\n pathname: string\n query: ParsedUrlQuery\n asPath: string\n basePath: string\n events: any\n isFallback: boolean\n locale?: string\n isReady: boolean\n locales?: readonly string[]\n defaultLocale?: string\n domainLocales?: readonly DomainLocale[]\n isPreview: boolean\n isLocaleDomain: boolean\n\n constructor(\n pathname: string,\n query: ParsedUrlQuery,\n as: string,\n { isFallback }: { isFallback: boolean },\n isReady: boolean,\n basePath: string,\n locale?: string,\n locales?: readonly string[],\n defaultLocale?: string,\n domainLocales?: readonly DomainLocale[],\n isPreview?: boolean,\n isLocaleDomain?: boolean\n ) {\n this.route = pathname.replace(/\\/$/, '') || '/'\n this.pathname = pathname\n this.query = query\n this.asPath = as\n this.isFallback = isFallback\n this.basePath = basePath\n this.locale = locale\n this.locales = locales\n this.defaultLocale = defaultLocale\n this.isReady = isReady\n this.domainLocales = domainLocales\n this.isPreview = !!isPreview\n this.isLocaleDomain = !!isLocaleDomain\n }\n\n push(): any {\n noRouter()\n }\n replace(): any {\n noRouter()\n }\n reload() {\n noRouter()\n }\n back() {\n noRouter()\n }\n forward(): void {\n noRouter()\n }\n prefetch(): any {\n noRouter()\n }\n beforePopState() {\n noRouter()\n }\n}\n\nfunction enhanceComponents(\n options: ComponentsEnhancer,\n App: AppType,\n Component: NextComponentType\n): {\n App: AppType\n Component: NextComponentType\n} {\n // For backwards compatibility\n if (typeof options === 'function') {\n return {\n App,\n Component: options(Component),\n }\n }\n\n return {\n App: options.enhanceApp ? options.enhanceApp(App) : App,\n Component: options.enhanceComponent\n ? options.enhanceComponent(Component)\n : Component,\n }\n}\n\nfunction renderPageTree(\n App: AppType,\n Component: NextComponentType,\n props: any\n) {\n return <App Component={Component} {...props} />\n}\n\nexport type RenderOptsPartial = {\n canonicalBase: string\n runtimeConfig?: { [key: string]: any }\n assetPrefix?: string\n err?: Error | null\n nextExport?: boolean\n dev?: boolean\n ampPath?: string\n ErrorDebug?: PagesDevOverlayType\n ampValidator?: (html: string, pathname: string) => Promise<void>\n ampSkipValidation?: boolean\n ampOptimizerConfig?: { [key: string]: any }\n isNextDataRequest?: boolean\n params?: ParsedUrlQuery\n previewProps: __ApiPreviewProps | undefined\n basePath: string\n unstable_runtimeJS?: false\n unstable_JsPreload?: false\n optimizeCss: any\n nextConfigOutput?: 'standalone' | 'export'\n nextScriptWorkers: any\n assetQueryString?: string\n resolvedUrl?: string\n resolvedAsPath?: string\n setIsrStatus?: (key: string, value: boolean | null) => void\n clientReferenceManifest?: DeepReadonly<ClientReferenceManifest>\n nextFontManifest?: DeepReadonly<NextFontManifest>\n distDir?: string\n locale?: string\n locales?: readonly string[]\n defaultLocale?: string\n domainLocales?: readonly DomainLocale[]\n disableOptimizedLoading?: boolean\n supportsDynamicResponse: boolean\n botType?: 'dom' | 'html' | undefined\n serveStreamingMetadata?: boolean\n runtime?: ServerRuntime\n serverComponents?: boolean\n serverActions?: {\n bodySizeLimit?: SizeLimit\n allowedOrigins?: string[]\n }\n crossOrigin?: 'anonymous' | 'use-credentials' | '' | undefined\n images: ImageConfigComplete\n largePageDataBytes?: number\n isOnDemandRevalidate?: boolean\n strictNextHead: boolean\n isPossibleServerAction?: boolean\n isExperimentalCompile?: boolean\n isPrefetch?: boolean\n isBot?: boolean\n expireTime?: number\n experimental: {\n clientTraceMetadata?: string[]\n }\n}\n\nexport type RenderOpts = LoadComponentsReturnType<PagesModule> &\n RenderOptsPartial\n\n/**\n * Shared context used for all page renders.\n */\nexport type PagesSharedContext = {\n /**\n * Used to facilitate caching of page bundles, we send it to the client so\n * that pageloader knows where to load bundles.\n */\n buildId: string\n\n /**\n * The deployment ID if the user is deploying to a platform that provides one.\n */\n deploymentId: string | undefined\n\n /**\n * True if the user is using a custom server.\n */\n customServer: true | undefined\n}\n\n/**\n * The context for the given request.\n */\nexport type PagesRenderContext = {\n /**\n * Whether this should be rendered as a fallback page.\n */\n isFallback: boolean\n\n /**\n * Whether this is in draft mode.\n */\n isDraftMode: boolean | undefined\n\n /**\n * In development, the original source page that returned a 404.\n */\n developmentNotFoundSourcePage: string | undefined\n}\n\n/**\n * RenderOptsExtra is being used to split away functionality that's within the\n * renderOpts. Eventually we can have more explicit render options for each\n * route kind.\n */\nexport type RenderOptsExtra = {\n App: AppType\n Document: DocumentType\n}\n\nconst invalidKeysMsg = (\n methodName: 'getServerSideProps' | 'getStaticProps',\n invalidKeys: string[]\n) => {\n const docsPathname = `invalid-${methodName.toLocaleLowerCase()}-value`\n\n return (\n `Additional keys were returned from \\`${methodName}\\`. Properties intended for your component must be nested under the \\`props\\` key, e.g.:` +\n `\\n\\n\\treturn { props: { title: 'My Title', content: '...' } }` +\n `\\n\\nKeys that need to be moved: ${invalidKeys.join(', ')}.` +\n `\\nRead more: https://nextjs.org/docs/messages/${docsPathname}`\n )\n}\n\nfunction checkRedirectValues(\n redirect: Redirect,\n req: IncomingMessage,\n method: 'getStaticProps' | 'getServerSideProps'\n) {\n const { destination, permanent, statusCode, basePath } = redirect\n let errors: string[] = []\n\n const hasStatusCode = typeof statusCode !== 'undefined'\n const hasPermanent = typeof permanent !== 'undefined'\n\n if (hasPermanent && hasStatusCode) {\n errors.push(`\\`permanent\\` and \\`statusCode\\` can not both be provided`)\n } else if (hasPermanent && typeof permanent !== 'boolean') {\n errors.push(`\\`permanent\\` must be \\`true\\` or \\`false\\``)\n } else if (hasStatusCode && !allowedStatusCodes.has(statusCode!)) {\n errors.push(\n `\\`statusCode\\` must undefined or one of ${[...allowedStatusCodes].join(\n ', '\n )}`\n )\n }\n const destinationType = typeof destination\n\n if (destinationType !== 'string') {\n errors.push(\n `\\`destination\\` should be string but received ${destinationType}`\n )\n }\n\n const basePathType = typeof basePath\n\n if (basePathType !== 'undefined' && basePathType !== 'boolean') {\n errors.push(\n `\\`basePath\\` should be undefined or a false, received ${basePathType}`\n )\n }\n\n if (errors.length > 0) {\n throw new Error(\n `Invalid redirect object returned from ${method} for ${req.url}\\n` +\n errors.join(' and ') +\n '\\n' +\n `See more info here: https://nextjs.org/docs/messages/invalid-redirect-gssp`\n )\n }\n}\n\nexport function errorToJSON(err: Error) {\n let source: typeof COMPILER_NAMES.server | typeof COMPILER_NAMES.edgeServer =\n 'server'\n\n if (process.env.NEXT_RUNTIME !== 'edge') {\n source = getErrorSource(err) || 'server'\n }\n\n return {\n name: err.name,\n source,\n message: stripAnsi(err.message),\n stack: err.stack,\n digest: (err as any).digest,\n }\n}\n\nfunction serializeError(\n dev: boolean | undefined,\n err: Error\n): Error & {\n statusCode?: number\n source?: typeof COMPILER_NAMES.server | typeof COMPILER_NAMES.edgeServer\n} {\n if (dev) {\n return errorToJSON(err)\n }\n\n return {\n name: 'Internal Server Error.',\n message: '500 - Internal Server Error.',\n statusCode: 500,\n }\n}\n\nexport async function renderToHTMLImpl(\n req: IncomingMessage,\n res: ServerResponse,\n pathname: string,\n query: NextParsedUrlQuery,\n renderOpts: Omit<RenderOpts, keyof RenderOptsExtra>,\n extra: RenderOptsExtra,\n sharedContext: PagesSharedContext,\n renderContext: PagesRenderContext\n): Promise<RenderResult> {\n // Adds support for reading `cookies` in `getServerSideProps` when SSR.\n setLazyProp({ req: req as any }, 'cookies', getCookieParser(req.headers))\n\n const metadata: PagesRenderResultMetadata = {}\n\n metadata.assetQueryString =\n (renderOpts.dev && renderOpts.assetQueryString) || ''\n\n if (renderOpts.dev && !metadata.assetQueryString) {\n const userAgent = (req.headers['user-agent'] || '').toLowerCase()\n if (userAgent.includes('safari') && !userAgent.includes('chrome')) {\n // In dev we invalidate the cache by appending a timestamp to the resource URL.\n // This is a workaround to fix https://github.com/vercel/next.js/issues/5860\n // TODO: remove this workaround when https://bugs.webkit.org/show_bug.cgi?id=187726 is fixed.\n // Note: The workaround breaks breakpoints on reload since the script url always changes,\n // so we only apply it to Safari.\n metadata.assetQueryString = `?ts=${Date.now()}`\n }\n }\n\n // if deploymentId is provided we append it to all asset requests\n if (sharedContext.deploymentId) {\n metadata.assetQueryString += `${metadata.assetQueryString ? '&' : '?'}dpl=${\n sharedContext.deploymentId\n }`\n }\n\n // don't modify original query object\n query = Object.assign({}, query)\n\n const {\n err,\n dev = false,\n ampPath = '',\n pageConfig = {},\n buildManifest,\n reactLoadableManifest,\n ErrorDebug,\n getStaticProps,\n getStaticPaths,\n getServerSideProps,\n isNextDataRequest,\n params,\n previewProps,\n basePath,\n images,\n runtime: globalRuntime,\n isExperimentalCompile,\n expireTime,\n } = renderOpts\n const { App } = extra\n\n const assetQueryString = metadata.assetQueryString\n\n let Document = extra.Document\n\n let Component: React.ComponentType<{}> | ((props: any) => JSX.Element) =\n renderOpts.Component\n const OriginComponent = Component\n\n const isFallback = renderContext.isFallback ?? false\n const notFoundSrcPage = renderContext.developmentNotFoundSourcePage\n\n // next internal queries should be stripped out\n stripInternalQueries(query)\n\n const isSSG = !!getStaticProps\n const isBuildTimeSSG = isSSG && renderOpts.nextExport\n const defaultAppGetInitialProps =\n App.getInitialProps === (App as any).origGetInitialProps\n\n const hasPageGetInitialProps = !!(Component as any)?.getInitialProps\n const hasPageScripts = (Component as any)?.unstable_scriptLoader\n\n const pageIsDynamic = isDynamicRoute(pathname)\n\n const defaultErrorGetInitialProps =\n pathname === '/_error' &&\n (Component as any).getInitialProps ===\n (Component as any).origGetInitialProps\n\n if (\n renderOpts.nextExport &&\n hasPageGetInitialProps &&\n !defaultErrorGetInitialProps\n ) {\n warn(\n `Detected getInitialProps on page '${pathname}'` +\n ` while running export. It's recommended to use getStaticProps` +\n ` which has a more correct behavior for static exporting.` +\n `\\nRead more: https://nextjs.org/docs/messages/get-initial-props-export`\n )\n }\n\n let isAutoExport =\n !hasPageGetInitialProps &&\n defaultAppGetInitialProps &&\n !isSSG &&\n !getServerSideProps\n\n // if we are running from experimental compile and the page\n // would normally be automatically statically optimized\n // ensure we set cache header so it's not rendered on-demand\n // every request\n if (isAutoExport && !dev && isExperimentalCompile) {\n res.setHeader(\n 'Cache-Control',\n getCacheControlHeader({ revalidate: false, expire: expireTime })\n )\n isAutoExport = false\n }\n\n if (hasPageGetInitialProps && isSSG) {\n throw new Error(SSG_GET_INITIAL_PROPS_CONFLICT + ` ${pathname}`)\n }\n\n if (hasPageGetInitialProps && getServerSideProps) {\n throw new Error(SERVER_PROPS_GET_INIT_PROPS_CONFLICT + ` ${pathname}`)\n }\n\n if (getServerSideProps && isSSG) {\n throw new Error(SERVER_PROPS_SSG_CONFLICT + ` ${pathname}`)\n }\n\n if (getServerSideProps && renderOpts.nextConfigOutput === 'export') {\n throw new Error(\n 'getServerSideProps cannot be used with \"output: export\". See more info here: https://nextjs.org/docs/advanced-features/static-html-export'\n )\n }\n\n if (getStaticPaths && !pageIsDynamic) {\n throw new Error(\n `getStaticPaths is only allowed for dynamic SSG pages and was found on '${pathname}'.` +\n `\\nRead more: https://nextjs.org/docs/messages/non-dynamic-getstaticpaths-usage`\n )\n }\n\n if (!!getStaticPaths && !isSSG) {\n throw new Error(\n `getStaticPaths was added without a getStaticProps in ${pathname}. Without getStaticProps, getStaticPaths does nothing`\n )\n }\n\n if (isSSG && pageIsDynamic && !getStaticPaths) {\n throw new Error(\n `getStaticPaths is required for dynamic SSG pages and is missing for '${pathname}'.` +\n `\\nRead more: https://nextjs.org/docs/messages/invalid-getstaticpaths-value`\n )\n }\n\n let asPath: string = renderOpts.resolvedAsPath || (req.url as string)\n\n if (dev) {\n const { isValidElementType } = require('next/dist/compiled/react-is')\n if (!isValidElementType(Component)) {\n throw new Error(\n `The default export is not a React Component in page: \"${pathname}\"`\n )\n }\n\n if (!isValidElementType(App)) {\n throw new Error(\n `The default export is not a React Component in page: \"/_app\"`\n )\n }\n\n if (!isValidElementType(Document)) {\n throw new Error(\n `The default export is not a React Component in page: \"/_document\"`\n )\n }\n\n if (isAutoExport || isFallback) {\n // remove query values except ones that will be set during export\n query = {\n ...(query.amp\n ? {\n amp: query.amp,\n }\n : {}),\n }\n asPath = `${pathname}${\n // ensure trailing slash is present for non-dynamic auto-export pages\n req.url!.endsWith('/') && pathname !== '/' && !pageIsDynamic ? '/' : ''\n }`\n req.url = pathname\n }\n\n if (pathname === '/404' && (hasPageGetInitialProps || getServerSideProps)) {\n throw new Error(\n `\\`pages/404\\` ${STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR}`\n )\n }\n if (\n STATIC_STATUS_PAGES.includes(pathname) &&\n (hasPageGetInitialProps || getServerSideProps)\n ) {\n throw new Error(\n `\\`pages${pathname}\\` ${STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR}`\n )\n }\n\n if (renderOpts?.setIsrStatus) {\n renderOpts.setIsrStatus(asPath, isSSG || isAutoExport ? true : null)\n }\n }\n\n for (const methodName of [\n 'getStaticProps',\n 'getServerSideProps',\n 'getStaticPaths',\n ]) {\n if ((Component as any)?.[methodName]) {\n throw new Error(\n `page ${pathname} ${methodName} ${GSSP_COMPONENT_MEMBER_ERROR}`\n )\n }\n }\n\n await Loadable.preloadAll() // Make sure all dynamic imports are loaded\n\n let isPreview: boolean | undefined = undefined\n let previewData: PreviewData\n\n if (\n (isSSG || getServerSideProps) &&\n !isFallback &&\n process.env.NEXT_RUNTIME !== 'edge' &&\n previewProps\n ) {\n // Reads of this are cached on the `req` object, so this should resolve\n // instantly. There's no need to pass this data down from a previous\n // invoke.\n previewData = tryGetPreviewData(\n req,\n res,\n previewProps,\n !!renderOpts.multiZoneDraftMode\n )\n isPreview = previewData !== false\n }\n\n // url will always be set\n const routerIsReady = !!(\n getServerSideProps ||\n hasPageGetInitialProps ||\n (!defaultAppGetInitialProps && !isSSG) ||\n isExperimentalCompile\n )\n const router = new ServerRouter(\n pathname,\n query,\n asPath,\n {\n isFallback: isFallback,\n },\n routerIsReady,\n basePath,\n renderOpts.locale,\n renderOpts.locales,\n renderOpts.defaultLocale,\n renderOpts.domainLocales,\n isPreview,\n getRequestMeta(req, 'isLocaleDomain')\n )\n\n const appRouter = adaptForAppRouterInstance(router)\n\n let scriptLoader: any = {}\n const jsxStyleRegistry = createStyleRegistry()\n const ampState = {\n ampFirst: pageConfig.amp === true,\n hasQuery: Boolean(query.amp),\n hybrid: pageConfig.amp === 'hybrid',\n }\n\n // Disable AMP under the web environment\n const inAmpMode = process.env.NEXT_RUNTIME !== 'edge' && isInAmpMode(ampState)\n let head: JSX.Element[] = defaultHead(inAmpMode)\n const reactLoadableModules: string[] = []\n\n let initialScripts: any = {}\n if (hasPageScripts) {\n initialScripts.beforeInteractive = []\n .concat(hasPageScripts())\n .filter((script: any) => script.props.strategy === 'beforeInteractive')\n .map((script: any) => script.props)\n }\n\n const csp =\n req.headers['content-security-policy'] ||\n req.headers['content-security-policy-report-only']\n\n const nonce =\n typeof csp === 'string' ? getScriptNonceFromHeader(csp) : undefined\n\n const AppContainer = ({ children }: { children: JSX.Element }) => (\n <AppRouterContext.Provider value={appRouter}>\n <SearchParamsContext.Provider value={adaptForSearchParams(router)}>\n <PathnameContextProviderAdapter\n router={router}\n isAutoExport={isAutoExport}\n >\n <PathParamsContext.Provider value={adaptForPathParams(router)}>\n <RouterContext.Provider value={router}>\n <AmpStateContext.Provider value={ampState}>\n <HeadManagerContext.Provider\n value={{\n updateHead: (state) => {\n head = state\n },\n updateScripts: (scripts) => {\n scriptLoader = scripts\n },\n scripts: initialScripts,\n mountedInstances: new Set(),\n nonce,\n }}\n >\n <LoadableContext.Provider\n value={(moduleName) =>\n reactLoadableModules.push(moduleName)\n }\n >\n <StyleRegistry registry={jsxStyleRegistry}>\n <ImageConfigContext.Provider value={images}>\n {children}\n </ImageConfigContext.Provider>\n </StyleRegistry>\n </LoadableContext.Provider>\n </HeadManagerContext.Provider>\n </AmpStateContext.Provider>\n </RouterContext.Provider>\n </PathParamsContext.Provider>\n </PathnameContextProviderAdapter>\n </SearchParamsContext.Provider>\n </AppRouterContext.Provider>\n )\n\n // The `useId` API uses the path indexes to generate an ID for each node.\n // To guarantee the match of hydration, we need to ensure that the structure\n // of wrapper nodes is isomorphic in server and client.\n // TODO: With `enhanceApp` and `enhanceComponents` options, this approach may\n // not be useful.\n // https://github.com/facebook/react/pull/22644\n const Noop = () => null\n const AppContainerWithIsomorphicFiberStructure: React.FC<{\n children: JSX.Element\n }> = ({ children }) => {\n return (\n <>\n {/* <Head/> */}\n <Noop />\n <AppContainer>\n <>\n {/* <ReactDevOverlay/> */}\n {dev ? (\n <>\n {children}\n <Noop />\n </>\n ) : (\n children\n )}\n {/* <RouteAnnouncer/> */}\n <Noop />\n </>\n </AppContainer>\n </>\n )\n }\n\n const ctx = {\n err,\n req: isAutoExport ? undefined : req,\n res: isAutoExport ? undefined : res,\n pathname,\n query,\n asPath,\n locale: renderOpts.locale,\n locales: renderOpts.locales,\n defaultLocale: renderOpts.defaultLocale,\n AppTree: (props: any) => {\n return (\n <AppContainerWithIsomorphicFiberStructure>\n {renderPageTree(App, OriginComponent, { ...props, router })}\n </AppContainerWithIsomorphicFiberStructure>\n )\n },\n defaultGetInitialProps: async (\n docCtx: DocumentContext,\n options: { nonce?: string } = {}\n ): Promise<DocumentInitialProps> => {\n const enhanceApp = (AppComp: any) => {\n return (props: any) => <AppComp {...props} />\n }\n\n const { html, head: renderPageHead } = await docCtx.renderPage({\n enhanceApp,\n })\n const styles = jsxStyleRegistry.styles({ nonce: options.nonce || nonce })\n jsxStyleRegistry.flush()\n return { html, head: renderPageHead, styles }\n },\n }\n let props: any\n\n const nextExport =\n !isSSG && (renderOpts.nextExport || (dev && (isAutoExport || isFallback)))\n\n const styledJsxInsertedHTML = () => {\n const styles = jsxStyleRegistry.styles()\n jsxStyleRegistry.flush()\n return <>{styles}</>\n }\n\n props = await loadGetInitialProps(App, {\n AppTree: ctx.AppTree,\n Component,\n router,\n ctx,\n })\n\n if ((isSSG || getServerSideProps) && isPreview) {\n props.__N_PREVIEW = true\n }\n\n if (isSSG) {\n props[STATIC_PROPS_ID] = true\n }\n\n if (isSSG && !isFallback) {\n let data: Readonly<UnwrapPromise<ReturnType<GetStaticProps>>>\n\n try {\n data = await getTracer().trace(\n RenderSpan.getStaticProps,\n {\n spanName: `getStaticProps ${pathname}`,\n attributes: {\n 'next.route': pathname,\n },\n },\n () =>\n getStaticProps({\n ...(pageIsDynamic ? { params } : undefined),\n ...(isPreview\n ? { draftMode: true, preview: true, previewData: previewData }\n : undefined),\n locales: [...(renderOpts.locales ?? [])],\n locale: renderOpts.locale,\n defaultLocale: renderOpts.defaultLocale,\n revalidateReason: renderOpts.isOnDemandRevalidate\n ? 'on-demand'\n : isBuildTimeSSG\n ? 'build'\n : 'stale',\n })\n )\n } catch (staticPropsError: any) {\n // remove not found error code to prevent triggering legacy\n // 404 rendering\n if (staticPropsError && staticPropsError.code === 'ENOENT') {\n delete staticPropsError.code\n }\n throw staticPropsError\n }\n\n if (data == null) {\n throw new Error(GSP_NO_RETURNED_VALUE)\n }\n\n const invalidKeys = Object.keys(data).filter(\n (key) =>\n key !== 'revalidate' &&\n key !== 'props' &&\n key !== 'redirect' &&\n key !== 'notFound'\n )\n\n if (invalidKeys.includes('unstable_revalidate')) {\n throw new Error(UNSTABLE_REVALIDATE_RENAME_ERROR)\n }\n\n if (invalidKeys.length) {\n throw new Error(invalidKeysMsg('getStaticProps', invalidKeys))\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (\n typeof (data as any).notFound !== 'undefined' &&\n typeof (data as any).redirect !== 'undefined'\n ) {\n throw new Error(\n `\\`redirect\\` and \\`notFound\\` can not both be returned from ${\n isSSG ? 'getStaticProps' : 'getServerSideProps'\n } at the same time. Page: ${pathname}\\nSee more info here: https://nextjs.org/docs/messages/gssp-mixed-not-found-redirect`\n )\n }\n }\n\n if ('notFound' in data && data.notFound) {\n if (pathname === '/404') {\n throw new Error(\n `The /404 page can not return notFound in \"getStaticProps\", please remove it to continue!`\n )\n }\n\n metadata.isNotFound = true\n }\n\n if (\n 'redirect' in data &&\n data.redirect &&\n typeof data.redirect === 'object'\n ) {\n checkRedirectValues(data.redirect as Redirect, req, 'getStaticProps')\n\n if (isBuildTimeSSG) {\n throw new Error(\n `\\`redirect\\` can not be returned from getStaticProps during prerendering (${req.url})\\n` +\n `See more info here: https://nextjs.org/docs/messages/gsp-redirect-during-prerender`\n )\n }\n\n ;(data as any).props = {\n __N_REDIRECT: data.redirect.destination,\n __N_REDIRECT_STATUS: getRedirectStatus(data.redirect),\n }\n if (typeof data.redirect.basePath !== 'undefined') {\n ;(data as any).props.__N_REDIRECT_BASE_PATH = data.redirect.basePath\n }\n metadata.isRedirect = true\n }\n\n if (\n (dev || isBuildTimeSSG) &&\n !metadata.isNotFound &&\n !isSerializableProps(pathname, 'getStaticProps', (data as any).props)\n ) {\n // this fn should throw an error instead of ever returning `false`\n throw new Error(\n 'invariant: getStaticProps did not return valid props. Please report this.'\n )\n }\n\n let revalidate: Revalidate\n if ('revalidate' in data) {\n if (data.revalidate && renderOpts.nextConfigOutput === 'export') {\n throw new Error(\n 'ISR cannot be used with \"output: export\". See more info here: https://nextjs.org/docs/advanced-features/static-html-export'\n )\n }\n if (typeof data.revalidate === 'number') {\n if (!Number.isInteger(data.revalidate)) {\n throw new Error(\n `A page's revalidate option must be seconds expressed as a natural number for ${req.url}. Mixed numbers, such as '${data.revalidate}', cannot be used.` +\n `\\nTry changing the value to '${Math.ceil(\n data.revalidate\n )}' or using \\`Math.ceil()\\` if you're computing the value.`\n )\n } else if (data.revalidate <= 0) {\n throw new Error(\n `A page's revalidate option can not be less than or equal to zero for ${req.url}. A revalidate option of zero means to revalidate after _every_ request, and implies stale data cannot be tolerated.` +\n `\\n\\nTo never revalidate, you can set revalidate to \\`false\\` (only ran once at build-time).` +\n `\\nTo revalidate as soon as possible, you can set the value to \\`1\\`.`\n )\n } else {\n if (data.revalidate > 31536000) {\n // if it's greater than a year for some reason error\n console.warn(\n `Warning: A page's revalidate option was set to more than a year for ${req.url}. This may have been done in error.` +\n `\\nTo only run getStaticProps at build-time and not revalidate at runtime, you can set \\`revalidate\\` to \\`false\\`!`\n )\n }\n\n revalidate = data.revalidate\n }\n } else if (data.revalidate === true) {\n // When enabled, revalidate after 1 second. This value is optimal for\n // the most up-to-date page possible, but without a 1-to-1\n // request-refresh ratio.\n revalidate = 1\n } else if (\n data.revalidate === false ||\n typeof data.revalidate === 'undefined'\n ) {\n // By default, we never revalidate.\n revalidate = false\n } else {\n throw new Error(\n `A page's revalidate option must be seconds expressed as a natural number. Mixed numbers and strings cannot be used. Received '${JSON.stringify(\n data.revalidate\n )}' for ${req.url}`\n )\n }\n } else {\n // By default, we never revalidate.\n revalidate = false\n }\n\n props.pageProps = Object.assign(\n {},\n props.pageProps,\n 'props' in data ? data.props : undefined\n )\n\n // pass up cache control and props for export\n metadata.cacheControl = { revalidate, expire: undefined }\n metadata.pageData = props\n\n // this must come after revalidate is added to renderResultMeta\n if (metadata.isNotFound) {\n return new RenderResult(null, { metadata })\n }\n }\n\n if (getServerSideProps) {\n props[SERVER_PROPS_ID] = true\n }\n\n if (getServerSideProps && !isFallback) {\n let data: UnwrapPromise<ReturnType<GetServerSideProps>>\n\n let canAccessRes = true\n let resOrProxy = res\n let deferredContent = false\n if (process.env.NODE_ENV !== 'production') {\n resOrProxy = new Proxy<ServerResponse>(res, {\n get: function (obj, prop) {\n if (!canAccessRes) {\n const message =\n `You should not access 'res' after getServerSideProps resolves.` +\n `\\nRead more: https://nextjs.org/docs/messages/gssp-no-mutating-res`\n\n if (deferredContent) {\n throw new Error(message)\n } else {\n warn(message)\n }\n }\n\n if (typeof prop === 'symbol') {\n return ReflectAdapter.get(obj, prop, res)\n }\n\n return ReflectAdapter.get(obj, prop, res)\n },\n })\n }\n\n try {\n data = await getTracer().trace(\n RenderSpan.getServerSideProps,\n {\n spanName: `getServerSideProps ${pathname}`,\n attributes: {\n 'next.route': pathname,\n },\n },\n async () =>\n getServerSideProps({\n req: req as IncomingMessage & {\n cookies: NextApiRequestCookies\n },\n res: resOrProxy,\n query,\n resolvedUrl: renderOpts.resolvedUrl as string,\n ...(pageIsDynamic ? { params } : undefined),\n ...(previewData !== false\n ? { draftMode: true, preview: true, previewData: previewData }\n : undefined),\n // We create a copy here to avoid having the types of\n // `getServerSideProps` change. This ensures that users can't\n // mutate this array and have it poison the reference.\n locales: [...(renderOpts.locales ?? [])],\n locale: renderOpts.locale,\n defaultLocale: renderOpts.defaultLocale,\n })\n )\n canAccessRes = false\n metadata.cacheControl = { revalidate: 0, expire: undefined }\n } catch (serverSidePropsError: any) {\n // remove not found error code to prevent triggering legacy\n // 404 rendering\n if (\n isError(serverSidePropsError) &&\n serverSidePropsError.code === 'ENOENT'\n ) {\n delete serverSidePropsError.code\n }\n throw serverSidePropsError\n }\n\n if (data == null) {\n throw new Error(GSSP_NO_RETURNED_VALUE)\n }\n\n if ((data as any).props instanceof Promise) {\n deferredContent = true\n }\n\n const invalidKeys = Object.keys(data).filter(\n (key) => key !== 'props' && key !== 'redirect' && key !== 'notFound'\n )\n\n if ((data as any).unstable_notFound) {\n throw new Error(\n `unstable_notFound has been renamed to notFound, please update the field to continue. Page: ${pathname}`\n )\n }\n if ((data as any).unstable_redirect) {\n throw new Error(\n `unstable_redirect has been renamed to redirect, please update the field to continue. Page: ${pathname}`\n )\n }\n\n if (invalidKeys.length) {\n throw new Error(invalidKeysMsg('getServerSideProps', invalidKeys))\n }\n\n if ('notFound' in data && data.notFound) {\n if (pathname === '/404') {\n throw new Error(\n `The /404 page can not return notFound in \"getStaticProps\", please remove it to continue!`\n )\n }\n\n metadata.isNotFound = true\n return new RenderResult(null, { metadata })\n }\n\n if ('redirect' in data && typeof data.redirect === 'object') {\n checkRedirectValues(data.redirect as Redirect, req, 'getServerSideProps')\n ;(data as any).props = {\n __N_REDIRECT: data.redirect.destination,\n __N_REDIRECT_STATUS: getRedirectStatus(data.redirect),\n }\n if (typeof data.redirect.basePath !== 'undefined') {\n ;(data as any).props.__N_REDIRECT_BASE_PATH = data.redirect.basePath\n }\n metadata.isRedirect = true\n }\n\n if (deferredContent) {\n ;(data as any).props = await (data as any).props\n }\n\n if (\n (dev || isBuildTimeSSG) &&\n !isSerializableProps(pathname, 'getServerSideProps', (data as any).props)\n ) {\n // this fn should throw an error instead of ever returning `false`\n throw new Error(\n 'invariant: getServerSideProps did not return valid props. Please report this.'\n )\n }\n\n props.pageProps = Object.assign({}, props.pageProps, (data as any).props)\n metadata.pageData = props\n }\n\n if (\n !isSSG && // we only show this warning for legacy pages\n !getServerSideProps &&\n process.env.NODE_ENV !== 'production' &&\n Object.keys(props?.pageProps || {}).includes('url')\n ) {\n console.warn(\n `The prop \\`url\\` is a reserved prop in Next.js for legacy reasons and will be overridden on page ${pathname}\\n` +\n `See more info here: https://nextjs.org/docs/messages/reserved-page-prop`\n )\n }\n\n // Avoid rendering page un-necessarily for getServerSideProps data request\n // and getServerSideProps/getStaticProps redirects\n if ((isNextDataRequest && !isSSG) || metadata.isRedirect) {\n return new RenderResult(JSON.stringify(props), {\n metadata,\n })\n }\n\n // We don't call getStaticProps or getServerSideProps while generating\n // the fallback so make sure to set pageProps to an empty object\n if (isFallback) {\n props.pageProps = {}\n }\n\n // the response might be finished on the getInitialProps call\n if (isResSent(res) && !isSSG) return new RenderResult(null, { metadata })\n\n // we preload the buildManifest for auto-export dynamic pages\n // to speed up hydrating query values\n let filteredBuildManifest = buildManifest\n if (isAutoExport && pageIsDynamic) {\n const page = denormalizePagePath(normalizePagePath(pathname))\n // This code would be much cleaner using `immer` and directly pushing into\n // the result from `getPageFiles`, we could maybe consider that in the\n // future.\n if (page in filteredBuildManifest.pages) {\n filteredBuildManifest = {\n ...filteredBuildManifest,\n pages: {\n ...filteredBuildManifest.pages,\n [page]: [\n ...filteredBuildManifest.pages[page],\n ...filteredBuildManifest.lowPriorityFiles.filter((f) =>\n f.includes('_buildManifest')\n ),\n ],\n },\n lowPriorityFiles: filteredBuildManifest.lowPriorityFiles.filter(\n (f) => !f.includes('_buildManifest')\n ),\n }\n }\n }\n\n const Body = ({ children }: { children: JSX.Element }) => {\n return inAmpMode ? children : <div id=\"__next\">{children}</div>\n }\n\n const renderDocument = async () => {\n // For `Document`, there are two cases that we don't support:\n // 1. Using `Document.getInitialProps` in the Edge runtime.\n // 2. Using the class component `Document` with concurrent features.\n\n const BuiltinFunctionalDocument: DocumentType | undefined = (\n Document as any\n )[NEXT_BUILTIN_DOCUMENT]\n\n if (process.env.NEXT_RUNTIME === 'edge' && Document.getInitialProps) {\n // In the Edge runtime, `Document.getInitialProps` isn't supported.\n // We throw an error here if it's customized.\n if (BuiltinFunctionalDocument) {\n Document = BuiltinFunctionalDocument\n } else {\n throw new Error(\n '`getInitialProps` in Document component is not supported with the Edge Runtime.'\n )\n }\n }\n\n async function loadDocumentInitialProps(\n renderShell: (\n _App: AppType,\n _Component: NextComponentType\n ) => Promise<ReactReadableStream>\n ) {\n const renderPage: RenderPage = async (\n options: ComponentsEnhancer = {}\n ): Promise<RenderPageResult> => {\n if (ctx.err && ErrorDebug) {\n // Always start rendering the shell even if there's an error.\n if (renderShell) {\n renderShell(App, Component)\n }\n\n const html = await renderToString(\n <Body>\n <ErrorDebug />\n </Body>\n )\n return { html, head }\n }\n\n if (dev && (props.router || props.Component)) {\n throw new Error(\n `'router' and 'Component' can not be returned in getInitialProps from _app.js https://nextjs.org/docs/messages/cant-override-next-props`\n )\n }\n\n const { App: EnhancedApp, Component: EnhancedComponent } =\n enhanceComponents(options, App, Component)\n\n const stream = await renderShell(EnhancedApp, EnhancedComponent)\n await stream.allReady\n const html = await streamToString(stream)\n\n return { html, head }\n }\n const documentCtx = { ...ctx, renderPage }\n const docProps: DocumentInitialProps = await loadGetInitialProps(\n Document,\n documentCtx\n )\n // the response might be finished on the getInitialProps call\n if (isResSent(res) && !isSSG) return null\n\n if (!docProps || typeof docProps.html !== 'string') {\n const message = `\"${getDisplayName(\n Document\n )}.getInitialProps()\" should resolve to an object with a \"html\" prop set with a valid html string`\n throw new Error(message)\n }\n\n return { docProps, documentCtx }\n }\n\n const renderContent = (_App: AppType, _Component: NextComponentType) => {\n const EnhancedApp = _App || App\n const EnhancedComponent = _Component || Component\n\n return ctx.err && ErrorDebug ? (\n <Body>\n <ErrorDebug />\n </Body>\n ) : (\n <Body>\n <AppContainerWithIsomorphicFiberStructure>\n {renderPageTree(EnhancedApp, EnhancedComponent, {\n ...props,\n router,\n })}\n </AppContainerWithIsomorphicFiberStructure>\n </Body>\n )\n }\n\n // Always using react concurrent rendering mode with required react version 18.x\n const renderShell = async (\n EnhancedApp: AppType,\n EnhancedComponent: NextComponentType\n ) => {\n const content = renderContent(EnhancedApp, EnhancedComponent)\n return await renderToInitialFizzStream({\n ReactDOMServer: ReactDOMServerPages,\n element: content,\n })\n }\n\n const hasDocumentGetInitialProps =\n process.env.NEXT_RUNTIME !== 'edge' && !!Document.getInitialProps\n\n // If it has getInitialProps, we will render the shell in `renderPage`.\n // Otherwise we do it right now.\n let documentInitialPropsRes:\n | {}\n | Awaited<ReturnType<typeof loadDocumentInitialProps>>\n\n const [rawStyledJsxInsertedHTML, content] = await Promise.all([\n renderToString(styledJsxInsertedHTML()),\n (async () => {\n if (hasDocumentGetInitialProps) {\n documentInitialPropsRes = await loadDocumentInitialProps(renderShell)\n if (documentInitialPropsRes === null) return null\n const { docProps } = documentInitialPropsRes as any\n return docProps.html\n } else {\n documentInitialPropsRes = {}\n const stream = await renderShell(App, Component)\n await stream.allReady\n return streamToString(stream)\n }\n })(),\n ])\n\n if (content === null) {\n return null\n }\n\n const contentHTML = rawStyledJsxInsertedHTML + content\n\n // @ts-ignore: documentInitialPropsRes is set\n const { docProps } = (documentInitialPropsRes as any) || {}\n const documentElement = (htmlProps: any) => {\n if (process.env.NEXT_RUNTIME === 'edge') {\n return (Document as any)()\n } else {\n return <Document {...htmlProps} {...docProps} />\n }\n }\n\n let styles\n if (hasDocumentGetInitialProps) {\n styles = docProps.styles\n head = docProps.head\n } else {\n styles = jsxStyleRegistry.styles()\n jsxStyleRegistry.flush()\n }\n\n return {\n contentHTML,\n documentElement,\n head,\n headTags: [],\n styles,\n }\n }\n\n getTracer().setRootSpanAttribute('next.route', renderOpts.page)\n const documentResult = await getTracer().trace(\n RenderSpan.renderDocument,\n {\n spanName: `render route (pages) ${renderOpts.page}`,\n attributes: {\n 'next.route': renderOpts.page,\n },\n },\n async () => renderDocument()\n )\n if (!documentResult) {\n return new RenderResult(null, { metadata })\n }\n\n const dynamicImportsIds = new Set<string | number>()\n const dynamicImports = new Set<string>()\n\n for (const mod of reactLoadableModules) {\n const manifestItem = reactLoadableManifest[mod]\n\n if (manifestItem) {\n dynamicImportsIds.add(manifestItem.id)\n manifestItem.files.forEach((item) => {\n dynamicImports.add(item)\n })\n }\n }\n\n const hybridAmp = ampState.hybrid\n const docComponentsRendered: DocumentProps['docComponentsRendered'] = {}\n\n const {\n assetPrefix,\n defaultLocale,\n disableOptimizedLoading,\n domainLocales,\n locale,\n locales,\n runtimeConfig,\n } = renderOpts\n const htmlProps: HtmlProps = {\n __NEXT_DATA__: {\n props, // The result of getInitialProps\n page: pathname, // The rendered page\n query, // querystring parsed / passed by the user\n buildId: sharedContext.buildId,\n assetPrefix: assetPrefix === '' ? undefined : assetPrefix, // send assetPrefix to the client side when configured, otherwise don't sent in the resulting HTML\n runtimeConfig, // runtimeConfig if provided, otherwise don't sent in the resulting HTML\n nextExport: nextExport === true ? true : undefined, // If this is a page exported by `next export`\n autoExport: isAutoExport === true ? true : undefined, // If this is an auto exported page\n isFallback,\n isExperimentalCompile,\n dynamicIds:\n dynamicImportsIds.size === 0\n ? undefined\n : Array.from(dynamicImportsIds),\n err: renderOpts.err ? serializeError(dev, renderOpts.err) : undefined, // Error if one happened, otherwise don't sent in the resulting HTML\n gsp: !!getStaticProps ? true : undefined, // whether the page is getStaticProps\n gssp: !!getServerSideProps ? true : undefined, // whether the page is getServerSideProps\n customServer: sharedContext.customServer,\n gip: hasPageGetInitialProps ? true : undefined, // whether the page has getInitialProps\n appGip: !defaultAppGetInitialProps ? true : undefined, // whether the _app has getInitialProps\n locale,\n locales,\n defaultLocale,\n domainLocales,\n isPreview: isPreview === true ? true : undefined,\n notFoundSrcPage: notFoundSrcPage && dev ? notFoundSrcPage : undefined,\n },\n nonce,\n strictNextHead: renderOpts.strictNextHead,\n buildManifest: filteredBuildManifest,\n docComponentsRendered,\n dangerousAsPath: router.asPath,\n canonicalBase:\n !renderOpts.ampPath && getRequestMeta(req, 'didStripLocale')\n ? `${renderOpts.canonicalBase || ''}/${renderOpts.locale}`\n : renderOpts.canonicalBase,\n ampPath,\n inAmpMode,\n isDevelopment: !!dev,\n hybridAmp,\n dynamicImports: Array.from(dynamicImports),\n dynamicCssManifest: new Set(renderOpts.dynamicCssManifest || []),\n assetPrefix,\n // Only enabled in production as development mode has features relying on HMR (style injection for example)\n unstable_runtimeJS:\n process.env.NODE_ENV === 'production'\n ? pageConfig.unstable_runtimeJS\n : undefined,\n unstable_JsPreload: pageConfig.unstable_JsPreload,\n assetQueryString,\n scriptLoader,\n locale,\n disableOptimizedLoading,\n head: documentResult.head,\n headTags: documentResult.headTags,\n styles: documentResult.styles,\n crossOrigin: renderOpts.crossOrigin,\n optimizeCss: renderOpts.optimizeCss,\n nextConfigOutput: renderOpts.nextConfigOutput,\n nextScriptWorkers: renderOpts.nextScriptWorkers,\n runtime: globalRuntime,\n largePageDataBytes: renderOpts.largePageDataBytes,\n nextFontManifest: renderOpts.nextFontManifest,\n experimentalClientTraceMetadata:\n renderOpts.experimental.clientTraceMetadata,\n }\n\n const document = (\n <AmpStateContext.Provider value={ampState}>\n <HtmlContext.Provider value={htmlProps}>\n {documentResult.documentElement(htmlProps)}\n </HtmlContext.Provider>\n </AmpStateContext.Provider>\n )\n\n const documentHTML = await getTracer().trace(\n RenderSpan.renderToString,\n async () => renderToString(document)\n )\n\n if (process.env.NODE_ENV !== 'production') {\n const nonRenderedComponents = []\n const expectedDocComponents = ['Main', 'Head', 'NextScript', 'Html']\n\n for (const comp of expectedDocComponents) {\n if (!(docComponentsRendered as any)[comp]) {\n nonRenderedComponents.push(comp)\n }\n }\n\n if (nonRenderedComponents.length) {\n const missingComponentList = nonRenderedComponents\n .map((e) => `<${e} />`)\n .join(', ')\n const plural = nonRenderedComponents.length !== 1 ? 's' : ''\n console.warn(\n `Your custom Document (pages/_document) did not render all the required subcomponent${plural}.\\n` +\n `Missing component${plural}: ${missingComponentList}\\n` +\n 'Read how to fix here: https://nextjs.org/docs/messages/missing-document-component'\n )\n }\n }\n\n const [renderTargetPrefix, renderTargetSuffix] = documentHTML.split(\n '<next-js-internal-body-render-target></next-js-internal-body-render-target>',\n 2\n )\n\n let prefix = ''\n if (!documentHTML.startsWith(DOCTYPE)) {\n prefix += DOCTYPE\n }\n prefix += renderTargetPrefix\n if (inAmpMode) {\n prefix += '<!-- __NEXT_DATA__ -->'\n }\n\n const content = prefix + documentResult.contentHTML + renderTargetSuffix\n\n const optimizedHtml = await postProcessHTML(pathname, content, renderOpts, {\n inAmpMode,\n hybridAmp,\n })\n\n return new RenderResult(optimizedHtml, { metadata })\n}\n\nexport type PagesRender = (\n req: IncomingMessage,\n res: ServerResponse,\n pathname: string,\n query: NextParsedUrlQuery,\n renderOpts: RenderOpts,\n sharedContext: PagesSharedContext,\n renderContext: PagesRenderContext\n) => Promise<RenderResult>\n\nexport const renderToHTML: PagesRender = (\n req,\n res,\n pathname,\n query,\n renderOpts,\n sharedContext,\n renderContext\n) => {\n return renderToHTMLImpl(\n req,\n res,\n pathname,\n query,\n renderOpts,\n renderOpts,\n sharedContext,\n renderContext\n )\n}\n"],"names":["setLazyProp","getCookieParser","React","ReactDOMServerPages","StyleRegistry","createStyleRegistry","GSP_NO_RETURNED_VALUE","GSSP_COMPONENT_MEMBER_ERROR","GSSP_NO_RETURNED_VALUE","STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR","SERVER_PROPS_GET_INIT_PROPS_CONFLICT","SERVER_PROPS_SSG_CONFLICT","SSG_GET_INITIAL_PROPS_CONFLICT","UNSTABLE_REVALIDATE_RENAME_ERROR","NEXT_BUILTIN_DOCUMENT","SERVER_PROPS_ID","STATIC_PROPS_ID","STATIC_STATUS_PAGES","isSerializableProps","isInAmpMode","AmpStateContext","defaultHead","HeadManagerContext","Loadable","LoadableContext","RouterContext","isDynamicRoute","getDisplayName","isResSent","loadGetInitialProps","HtmlContext","normalizePagePath","denormalizePagePath","getRequestMeta","allowedStatusCodes","getRedirectStatus","RenderResult","isError","streamToString","renderToInitialFizzStream","ImageConfigContext","stripAnsi","stripInternalQueries","adaptForAppRouterInstance","adaptForPathParams","adaptForSearchParams","PathnameContextProviderAdapter","AppRouterContext","SearchParamsContext","PathParamsContext","getTracer","RenderSpan","ReflectAdapter","getCacheControlHeader","getErrorSource","getScriptNonceFromHeader","tryGetPreviewData","warn","postProcessHTML","DOCTYPE","process","env","NEXT_RUNTIME","require","console","bind","_pathname","html","noRouter","message","Error","renderToString","element","renderStream","renderToReadableStream","allReady","ServerRouter","constructor","pathname","query","as","isFallback","isReady","basePath","locale","locales","defaultLocale","domainLocales","isPreview","isLocaleDomain","route","replace","asPath","push","reload","back","forward","prefetch","beforePopState","enhanceComponents","options","App","Component","enhanceApp","enhanceComponent","renderPageTree","props","invalidKeysMsg","methodName","invalidKeys","docsPathname","toLocaleLowerCase","join","checkRedirectValues","redirect","req","method","destination","permanent","statusCode","errors","hasStatusCode","hasPermanent","has","destinationType","basePathType","length","url","errorToJSON","err","source","name","stack","digest","serializeError","dev","renderToHTMLImpl","res","renderOpts","extra","sharedContext","renderContext","headers","metadata","assetQueryString","userAgent","toLowerCase","includes","Date","now","deploymentId","Object","assign","ampPath","pageConfig","buildManifest","reactLoadableManifest","ErrorDebug","getStaticProps","getStaticPaths","getServerSideProps","isNextDataRequest","params","previewProps","images","runtime","globalRuntime","isExperimentalCompile","expireTime","Document","OriginComponent","notFoundSrcPage","developmentNotFoundSourcePage","isSSG","isBuildTimeSSG","nextExport","defaultAppGetInitialProps","getInitialProps","origGetInitialProps","hasPageGetInitialProps","hasPageScripts","unstable_scriptLoader","pageIsDynamic","defaultErrorGetInitialProps","isAutoExport","setHeader","revalidate","expire","nextConfigOutput","resolvedAsPath","isValidElementType","amp","endsWith","setIsrStatus","preloadAll","undefined","previewData","multiZoneDraftMode","routerIsReady","router","appRouter","scriptLoader","jsxStyleRegistry","ampState","ampFirst","hasQuery","Boolean","hybrid","inAmpMode","head","reactLoadableModules","initialScripts","beforeInteractive","concat","filter","script","strategy","map","csp","nonce","AppContainer","children","Provider","value","updateHead","state","updateScripts","scripts","mountedInstances","Set","moduleName","registry","Noop","AppContainerWithIsomorphicFiberStructure","ctx","AppTree","defaultGetInitialProps","docCtx","AppComp","renderPageHead","renderPage","styles","flush","styledJsxInsertedHTML","__N_PREVIEW","data","trace","spanName","attributes","draftMode","preview","revalidateReason","isOnDemandRevalidate","staticPropsError","code","keys","key","NODE_ENV","notFound","isNotFound","__N_REDIRECT","__N_REDIRECT_STATUS","__N_REDIRECT_BASE_PATH","isRedirect","Number","isInteger","Math","ceil","JSON","stringify","pageProps","cacheControl","pageData","canAccessRes","resOrProxy","deferredContent","Proxy","get","obj","prop","resolvedUrl","serverSidePropsError","Promise","unstable_notFound","unstable_redirect","filteredBuildManifest","page","pages","lowPriorityFiles","f","Body","div","id","renderDocument","BuiltinFunctionalDocument","loadDocumentInitialProps","renderShell","EnhancedApp","EnhancedComponent","stream","documentCtx","docProps","renderContent","_App","_Component","content","ReactDOMServer","hasDocumentGetInitialProps","documentInitialPropsRes","rawStyledJsxInsertedHTML","all","contentHTML","documentElement","htmlProps","headTags","setRootSpanAttribute","documentResult","dynamicImportsIds","dynamicImports","mod","manifestItem","add","files","forEach","item","hybridAmp","docComponentsRendered","assetPrefix","disableOptimizedLoading","runtimeConfig","__NEXT_DATA__","buildId","autoExport","dynamicIds","size","Array","from","gsp","gssp","customServer","gip","appGip","strictNextHead","dangerousAsPath","canonicalBase","isDevelopment","dynamicCssManifest","unstable_runtimeJS","unstable_JsPreload","crossOrigin","optimizeCss","nextScriptWorkers","largePageDataBytes","nextFontManifest","experimentalClientTraceMetadata","experimental","clientTraceMetadata","document","documentHTML","nonRenderedComponents","expectedDocComponents","comp","missingComponentList","e","plural","renderTargetPrefix","renderTargetSuffix","split","prefix","startsWith","optimizedHtml","renderToHTML"],"mappings":";AAiBA,SAGEA,WAAW,QACN,cAAa;AACpB,SAASC,eAAe,QAAQ,gCAA+B;AAmB/D,OAAOC,WAAyB,QAAO;AACvC,OAAOC,yBAAyB,uCAAsC;AACtE,SAASC,aAAa,EAAEC,mBAAmB,QAAQ,aAAY;AAC/D,SACEC,qBAAqB,EACrBC,2BAA2B,EAC3BC,sBAAsB,EACtBC,0CAA0C,EAC1CC,oCAAoC,EACpCC,yBAAyB,EACzBC,8BAA8B,EAC9BC,gCAAgC,QAC3B,mBAAkB;AACzB,SACEC,qBAAqB,EACrBC,eAAe,EACfC,eAAe,EACfC,mBAAmB,QACd,0BAAyB;AAChC,SAASC,mBAAmB,QAAQ,+BAA8B;AAClE,SAASC,WAAW,QAAQ,yBAAwB;AACpD,SAASC,eAAe,QAAQ,2CAA0C;AAC1E,SAASC,WAAW,QAAQ,qBAAoB;AAChD,SAASC,kBAAkB,QAAQ,oDAAmD;AACtF,OAAOC,cAAc,wCAAuC;AAC5D,SAASC,eAAe,QAAQ,gDAA+C;AAC/E,SAASC,aAAa,QAAQ,8CAA6C;AAC3E,SAASC,cAAc,QAAQ,wCAAuC;AACtE,SACEC,cAAc,EACdC,SAAS,EACTC,mBAAmB,QACd,sBAAqB;AAC5B,SAASC,WAAW,QAAQ,4CAA2C;AACvE,SAASC,iBAAiB,QAAQ,8CAA6C;AAC/E,SAASC,mBAAmB,QAAQ,gDAA+C;AACnF,SAASC,cAAc,QAAQ,iBAAgB;AAC/C,SAASC,kBAAkB,EAAEC,iBAAiB,QAAQ,yBAAwB;AAC9E,OAAOC,kBAAsD,kBAAiB;AAC9E,OAAOC,aAAa,kBAAiB;AACrC,SACEC,cAAc,EACdC,yBAAyB,QACpB,yCAAwC;AAC/C,SAASC,kBAAkB,QAAQ,oDAAmD;AACtF,OAAOC,eAAe,gCAA+B;AACrD,SAASC,oBAAo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CAAC,AAAClC,qBAA6B,CAACmC,KAAK,EAAE;gBACzCF,sBAAsB1Q,IAAI,CAAC4Q;YAC7B;QACF;QAEA,IAAIF,sBAAsBzO,MAAM,EAAE;YAChC,MAAM4O,uBAAuBH,sBAC1B9I,GAAG,CAAC,CAACkJ,IAAM,CAAC,CAAC,EAAEA,EAAE,GAAG,CAAC,EACrB3P,IAAI,CAAC;YACR,MAAM4P,SAASL,sBAAsBzO,MAAM,KAAK,IAAI,MAAM;YAC1D9D,QAAQP,IAAI,CACV,CAAC,mFAAmF,EAAEmT,OAAO,GAAG,CAAC,GAC/F,CAAC,iBAAiB,EAAEA,OAAO,EAAE,EAAEF,qBAAqB,EAAE,CAAC,GACvD;QAEN;IACF;IAEA,MAAM,CAACG,oBAAoBC,mBAAmB,GAAGR,aAAaS,KAAK,CACjE,+EACA;IAGF,IAAIC,SAAS;IACb,IAAI,CAACV,aAAaW,UAAU,CAACtT,UAAU;QACrCqT,UAAUrT;IACZ;IACAqT,UAAUH;IACV,IAAI7J,WAAW;QACbgK,UAAU;IACZ;IAEA,MAAM/D,UAAU+D,SAASpD,eAAeL,WAAW,GAAGuD;IAEtD,MAAMI,gBAAgB,MAAMxT,gBAAgBoB,UAAUmO,SAASvK,YAAY;QACzEsE;QACAqH;IACF;IAEA,OAAO,IAAIjS,aAAa8U,eAAe;QAAEnO;IAAS;AACpD;AAYA,OAAO,MAAMoO,eAA4B,CACvChQ,KACAsB,KACA3D,UACAC,OACA2D,YACAE,eACAC;IAEA,OAAOL,iBACLrB,KACAsB,KACA3D,UACAC,OACA2D,YACAA,YACAE,eACAC;AAEJ,EAAC","ignoreList":[0]}
@@ -1,6 +1,6 @@
1
1
  export function isStableBuild() {
2
2
  var _process_env___NEXT_VERSION;
3
- return !((_process_env___NEXT_VERSION = "15.4.0-canary.26") == null ? void 0 : _process_env___NEXT_VERSION.includes('canary')) && !process.env.__NEXT_TEST_MODE && !process.env.NEXT_PRIVATE_LOCAL_DEV;
3
+ return !((_process_env___NEXT_VERSION = "15.4.0-canary.27") == null ? void 0 : _process_env___NEXT_VERSION.includes('canary')) && !process.env.__NEXT_TEST_MODE && !process.env.NEXT_PRIVATE_LOCAL_DEV;
4
4
  }
5
5
  export class CanaryOnlyError extends Error {
6
6
  constructor(arg){
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/shared/lib/html-context.shared-runtime.ts"],"sourcesContent":["import type { BuildManifest } from '../../server/get-page-files'\nimport type { ServerRuntime } from '../../types'\nimport type { NEXT_DATA } from './utils'\nimport type { NextFontManifest } from '../../build/webpack/plugins/next-font-manifest-plugin'\nimport type { DeepReadonly } from './deep-readonly'\n\nimport { createContext, useContext, type JSX } from 'react'\n\nexport type HtmlProps = {\n __NEXT_DATA__: NEXT_DATA\n strictNextHead: boolean\n dangerousAsPath: string\n docComponentsRendered: {\n Html?: boolean\n Main?: boolean\n Head?: boolean\n NextScript?: boolean\n }\n buildManifest: BuildManifest\n ampPath: string\n inAmpMode: boolean\n hybridAmp: boolean\n isDevelopment: boolean\n dynamicImports: string[]\n /**\n * This manifest is only needed for Pages dir, Production, Webpack\n * @see https://github.com/vercel/next.js/pull/72959\n */\n dynamicCssManifest: Set<string>\n assetPrefix?: string\n canonicalBase: string\n headTags: any[]\n unstable_runtimeJS?: false\n unstable_JsPreload?: false\n assetQueryString: string\n scriptLoader: {\n afterInteractive?: string[]\n beforeInteractive?: any[]\n worker?: any[]\n }\n locale?: string\n disableOptimizedLoading?: boolean\n styles?: React.ReactElement[] | Iterable<React.ReactNode>\n head?: Array<JSX.Element | null>\n crossOrigin?: 'anonymous' | 'use-credentials' | '' | undefined\n optimizeCss?: any\n nextConfigOutput?: 'standalone' | 'export'\n nextScriptWorkers?: boolean\n runtime?: ServerRuntime\n hasConcurrentFeatures?: boolean\n largePageDataBytes?: number\n nextFontManifest?: DeepReadonly<NextFontManifest>\n experimentalClientTraceMetadata?: string[]\n}\n\nexport const HtmlContext = createContext<HtmlProps | undefined>(undefined)\nif (process.env.NODE_ENV !== 'production') {\n HtmlContext.displayName = 'HtmlContext'\n}\n\nexport function useHtmlContext() {\n const context = useContext(HtmlContext)\n\n if (!context) {\n throw new Error(\n `<Html> should not be imported outside of pages/_document.\\n` +\n 'Read more: https://nextjs.org/docs/messages/no-document-import-in-page'\n )\n }\n\n return context\n}\n"],"names":["createContext","useContext","HtmlContext","undefined","process","env","NODE_ENV","displayName","useHtmlContext","context","Error"],"mappings":"AAMA,SAASA,aAAa,EAAEC,UAAU,QAAkB,QAAO;AAiD3D,OAAO,MAAMC,cAAcF,cAAqCG,WAAU;AAC1E,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;IACzCJ,YAAYK,WAAW,GAAG;AAC5B;AAEA,OAAO,SAASC;IACd,MAAMC,UAAUR,WAAWC;IAE3B,IAAI,CAACO,SAAS;QACZ,MAAM,qBAGL,CAHK,IAAIC,MACR,AAAC,gEACC,2EAFE,qBAAA;mBAAA;wBAAA;0BAAA;QAGN;IACF;IAEA,OAAOD;AACT","ignoreList":[0]}
1
+ {"version":3,"sources":["../../../src/shared/lib/html-context.shared-runtime.ts"],"sourcesContent":["import type { BuildManifest } from '../../server/get-page-files'\nimport type { ServerRuntime } from '../../types'\nimport type { NEXT_DATA } from './utils'\nimport type { NextFontManifest } from '../../build/webpack/plugins/next-font-manifest-plugin'\nimport type { DeepReadonly } from './deep-readonly'\n\nimport { createContext, useContext, type JSX } from 'react'\n\nexport type HtmlProps = {\n __NEXT_DATA__: NEXT_DATA\n nonce?: string\n strictNextHead: boolean\n dangerousAsPath: string\n docComponentsRendered: {\n Html?: boolean\n Main?: boolean\n Head?: boolean\n NextScript?: boolean\n }\n buildManifest: BuildManifest\n ampPath: string\n inAmpMode: boolean\n hybridAmp: boolean\n isDevelopment: boolean\n dynamicImports: string[]\n /**\n * This manifest is only needed for Pages dir, Production, Webpack\n * @see https://github.com/vercel/next.js/pull/72959\n */\n dynamicCssManifest: Set<string>\n assetPrefix?: string\n canonicalBase: string\n headTags: any[]\n unstable_runtimeJS?: false\n unstable_JsPreload?: false\n assetQueryString: string\n scriptLoader: {\n afterInteractive?: string[]\n beforeInteractive?: any[]\n worker?: any[]\n }\n locale?: string\n disableOptimizedLoading?: boolean\n styles?: React.ReactElement[] | Iterable<React.ReactNode>\n head?: Array<JSX.Element | null>\n crossOrigin?: 'anonymous' | 'use-credentials' | '' | undefined\n optimizeCss?: any\n nextConfigOutput?: 'standalone' | 'export'\n nextScriptWorkers?: boolean\n runtime?: ServerRuntime\n hasConcurrentFeatures?: boolean\n largePageDataBytes?: number\n nextFontManifest?: DeepReadonly<NextFontManifest>\n experimentalClientTraceMetadata?: string[]\n}\n\nexport const HtmlContext = createContext<HtmlProps | undefined>(undefined)\nif (process.env.NODE_ENV !== 'production') {\n HtmlContext.displayName = 'HtmlContext'\n}\n\nexport function useHtmlContext() {\n const context = useContext(HtmlContext)\n\n if (!context) {\n throw new Error(\n `<Html> should not be imported outside of pages/_document.\\n` +\n 'Read more: https://nextjs.org/docs/messages/no-document-import-in-page'\n )\n }\n\n return context\n}\n"],"names":["createContext","useContext","HtmlContext","undefined","process","env","NODE_ENV","displayName","useHtmlContext","context","Error"],"mappings":"AAMA,SAASA,aAAa,EAAEC,UAAU,QAAkB,QAAO;AAkD3D,OAAO,MAAMC,cAAcF,cAAqCG,WAAU;AAC1E,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;IACzCJ,YAAYK,WAAW,GAAG;AAC5B;AAEA,OAAO,SAASC;IACd,MAAMC,UAAUR,WAAWC;IAE3B,IAAI,CAACO,SAAS;QACZ,MAAM,qBAGL,CAHK,IAAIC,MACR,AAAC,gEACC,2EAFE,qBAAA;mBAAA;wBAAA;0BAAA;QAGN;IACF;IAEA,OAAOD;AACT","ignoreList":[0]}
@@ -264,7 +264,7 @@ function getPreNextScripts(context, props) {
264
264
  ...scriptProps,
265
265
  key: scriptProps.src || index,
266
266
  defer: scriptProps.defer ?? !disableOptimizedLoading,
267
- nonce: props.nonce,
267
+ nonce: scriptProps.nonce || props.nonce,
268
268
  "data-nscript": "beforeInteractive",
269
269
  crossOrigin: props.crossOrigin || crossOrigin
270
270
  });
@@ -813,11 +813,15 @@ class Document extends _react.default.Component {
813
813
  render() {
814
814
  return /*#__PURE__*/ (0, _jsxruntime.jsxs)(Html, {
815
815
  children: [
816
- /*#__PURE__*/ (0, _jsxruntime.jsx)(Head, {}),
816
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(Head, {
817
+ nonce: this.props.nonce
818
+ }),
817
819
  /*#__PURE__*/ (0, _jsxruntime.jsxs)("body", {
818
820
  children: [
819
821
  /*#__PURE__*/ (0, _jsxruntime.jsx)(Main, {}),
820
- /*#__PURE__*/ (0, _jsxruntime.jsx)(NextScript, {})
822
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(NextScript, {
823
+ nonce: this.props.nonce
824
+ })
821
825
  ]
822
826
  })
823
827
  ]