next 15.1.1-canary.3 → 15.1.1-canary.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of next might be problematic. Click here for more details.

Files changed (49) 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/utils.js +6 -3
  5. package/dist/build/utils.js.map +1 -1
  6. package/dist/build/webpack-config.js +2 -2
  7. package/dist/client/app-bootstrap.js +1 -1
  8. package/dist/client/index.js +1 -1
  9. package/dist/compiled/next-server/server.runtime.prod.js +1 -1
  10. package/dist/compiled/next-server/server.runtime.prod.js.map +1 -1
  11. package/dist/esm/build/index.js +2 -2
  12. package/dist/esm/build/swc/index.js +1 -1
  13. package/dist/esm/build/utils.js +6 -3
  14. package/dist/esm/build/utils.js.map +1 -1
  15. package/dist/esm/build/webpack-config.js +2 -2
  16. package/dist/esm/client/app-bootstrap.js +1 -1
  17. package/dist/esm/client/index.js +1 -1
  18. package/dist/esm/export/worker.js +2 -1
  19. package/dist/esm/export/worker.js.map +1 -1
  20. package/dist/esm/server/config.js +1 -1
  21. package/dist/esm/server/dev/hot-reloader-turbopack.js +1 -1
  22. package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
  23. package/dist/esm/server/dev/static-paths-worker.js +2 -1
  24. package/dist/esm/server/dev/static-paths-worker.js.map +1 -1
  25. package/dist/esm/server/lib/app-info-log.js +1 -1
  26. package/dist/esm/server/lib/start-server.js +1 -1
  27. package/dist/esm/server/load-components.js +13 -8
  28. package/dist/esm/server/load-components.js.map +1 -1
  29. package/dist/esm/server/next-server.js +11 -5
  30. package/dist/esm/server/next-server.js.map +1 -1
  31. package/dist/export/worker.js +2 -1
  32. package/dist/export/worker.js.map +1 -1
  33. package/dist/server/config.js +1 -1
  34. package/dist/server/dev/hot-reloader-turbopack.js +1 -1
  35. package/dist/server/dev/hot-reloader-webpack.js +1 -1
  36. package/dist/server/dev/static-paths-worker.js +2 -1
  37. package/dist/server/dev/static-paths-worker.js.map +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/load-components.d.ts +2 -1
  41. package/dist/server/load-components.js +13 -8
  42. package/dist/server/load-components.js.map +1 -1
  43. package/dist/server/next-server.d.ts +1 -0
  44. package/dist/server/next-server.js +11 -5
  45. package/dist/server/next-server.js.map +1 -1
  46. package/dist/telemetry/anonymous-meta.js +1 -1
  47. package/dist/telemetry/events/session-stopped.js +2 -2
  48. package/dist/telemetry/events/version.js +2 -2
  49. package/package.json +15 -15
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/export/worker.ts"],"sourcesContent":["import type {\n ExportPagesInput,\n ExportPageInput,\n ExportPageResult,\n ExportRouteResult,\n ExportedPageFile,\n FileWriter,\n WorkerRenderOpts,\n ExportPagesResult,\n} from './types'\n\nimport '../server/node-environment'\n\nprocess.env.NEXT_IS_EXPORT_WORKER = 'true'\n\nimport { extname, join, dirname, sep } from 'path'\nimport fs from 'fs/promises'\nimport { loadComponents } from '../server/load-components'\nimport { isDynamicRoute } from '../shared/lib/router/utils/is-dynamic'\nimport { normalizePagePath } from '../shared/lib/page-path/normalize-page-path'\nimport { normalizeLocalePath } from '../shared/lib/i18n/normalize-locale-path'\nimport { trace } from '../trace'\nimport { setHttpClientAndAgentOptions } from '../server/setup-http-agent-env'\nimport isError from '../lib/is-error'\nimport { addRequestMeta } from '../server/request-meta'\nimport { normalizeAppPath } from '../shared/lib/router/utils/app-paths'\n\nimport { createRequestResponseMocks } from '../server/lib/mock-request'\nimport { isAppRouteRoute } from '../lib/is-app-route-route'\nimport { hasNextSupport } from '../server/ci-info'\nimport { exportAppRoute } from './routes/app-route'\nimport { exportAppPage, prospectiveRenderAppPage } from './routes/app-page'\nimport { exportPagesPage } from './routes/pages'\nimport { getParams } from './helpers/get-params'\nimport { createIncrementalCache } from './helpers/create-incremental-cache'\nimport { isPostpone } from '../server/lib/router-utils/is-postpone'\nimport { isDynamicUsageError } from './helpers/is-dynamic-usage-error'\nimport { isBailoutToCSRError } from '../shared/lib/lazy-dynamic/bailout-to-csr'\nimport {\n turborepoTraceAccess,\n TurborepoAccessTraceResult,\n} from '../build/turborepo-access-trace'\nimport type { Params } from '../server/request/params'\nimport {\n getFallbackRouteParams,\n type FallbackRouteParams,\n} from '../server/request/fallback-params'\nimport { needsExperimentalReact } from '../lib/needs-experimental-react'\nimport type { AppRouteRouteModule } from '../server/route-modules/app-route/module.compiled'\nimport { isStaticGenBailoutError } from '../client/components/static-generation-bailout'\n\nconst envConfig = require('../shared/lib/runtime-config.external')\n\n;(globalThis as any).__NEXT_DATA__ = {\n nextExport: true,\n}\n\nclass TimeoutError extends Error {\n code = 'NEXT_EXPORT_TIMEOUT_ERROR'\n}\n\nclass ExportPageError extends Error {\n code = 'NEXT_EXPORT_PAGE_ERROR'\n}\n\nasync function exportPageImpl(\n input: ExportPageInput,\n fileWriter: FileWriter\n): Promise<ExportRouteResult | undefined> {\n const {\n path,\n pathMap,\n distDir,\n pagesDataDir,\n buildExport = false,\n serverRuntimeConfig,\n subFolders = false,\n optimizeCss,\n disableOptimizedLoading,\n debugOutput = false,\n enableExperimentalReact,\n ampValidatorPath,\n trailingSlash,\n } = input\n\n if (enableExperimentalReact) {\n process.env.__NEXT_EXPERIMENTAL_REACT = 'true'\n }\n\n const {\n page,\n\n // The parameters that are currently unknown.\n _fallbackRouteParams = [],\n\n // Check if this is an `app/` page.\n _isAppDir: isAppDir = false,\n\n // Check if this should error when dynamic usage is detected.\n _isDynamicError: isDynamicError = false,\n\n // If this page supports partial prerendering, then we need to pass that to\n // the renderOpts.\n _isRoutePPREnabled: isRoutePPREnabled,\n\n // If this is a prospective render, we don't actually want to persist the\n // result, we just want to use it to error the build if there's a problem.\n _isProspectiveRender: isProspectiveRender = false,\n\n // Pull the original query out.\n query: originalQuery = {},\n } = pathMap\n\n const fallbackRouteParams: FallbackRouteParams | null =\n getFallbackRouteParams(_fallbackRouteParams)\n\n let query = { ...originalQuery }\n const pathname = normalizeAppPath(page)\n const isDynamic = isDynamicRoute(page)\n const outDir = isAppDir ? join(distDir, 'server/app') : input.outDir\n\n const filePath = normalizePagePath(path)\n const ampPath = `${filePath}.amp`\n let renderAmpPath = ampPath\n\n let updatedPath = query.__nextSsgPath || path\n delete query.__nextSsgPath\n\n let locale = query.__nextLocale || input.renderOpts.locale\n delete query.__nextLocale\n\n if (input.renderOpts.locale) {\n const localePathResult = normalizeLocalePath(path, input.renderOpts.locales)\n\n if (localePathResult.detectedLocale) {\n updatedPath = localePathResult.pathname\n locale = localePathResult.detectedLocale\n\n if (locale === input.renderOpts.defaultLocale) {\n renderAmpPath = `${normalizePagePath(updatedPath)}.amp`\n }\n }\n }\n\n // We need to show a warning if they try to provide query values\n // for an auto-exported page since they won't be available\n const hasOrigQueryValues = Object.keys(originalQuery).length > 0\n\n // Check if the page is a specified dynamic route\n const { pathname: nonLocalizedPath } = normalizeLocalePath(\n path,\n input.renderOpts.locales\n )\n\n let params: Params | undefined\n\n if (isDynamic && page !== nonLocalizedPath) {\n const normalizedPage = isAppDir ? normalizeAppPath(page) : page\n\n params = getParams(normalizedPage, updatedPath)\n }\n\n const { req, res } = createRequestResponseMocks({ url: updatedPath })\n\n // If this is a status code page, then set the response code.\n for (const statusCode of [404, 500]) {\n if (\n [\n `/${statusCode}`,\n `/${statusCode}.html`,\n `/${statusCode}/index.html`,\n ].some((p) => p === updatedPath || `/${locale}${p}` === updatedPath)\n ) {\n res.statusCode = statusCode\n }\n }\n\n // Ensure that the URL has a trailing slash if it's configured.\n if (trailingSlash && !req.url?.endsWith('/')) {\n req.url += '/'\n }\n\n if (\n locale &&\n buildExport &&\n input.renderOpts.domainLocales &&\n input.renderOpts.domainLocales.some(\n (dl) => dl.defaultLocale === locale || dl.locales?.includes(locale || '')\n )\n ) {\n addRequestMeta(req, 'isLocaleDomain', true)\n }\n\n envConfig.setConfig({\n serverRuntimeConfig,\n publicRuntimeConfig: input.renderOpts.runtimeConfig,\n })\n\n const getHtmlFilename = (p: string) =>\n subFolders ? `${p}${sep}index.html` : `${p}.html`\n\n let htmlFilename = getHtmlFilename(filePath)\n\n // dynamic routes can provide invalid extensions e.g. /blog/[...slug] returns an\n // extension of `.slug]`\n const pageExt = isDynamic || isAppDir ? '' : extname(page)\n const pathExt = isDynamic || isAppDir ? '' : extname(path)\n\n // force output 404.html for backwards compat\n if (path === '/404.html') {\n htmlFilename = path\n }\n // Make sure page isn't a folder with a dot in the name e.g. `v1.2`\n else if (pageExt !== pathExt && pathExt !== '') {\n const isBuiltinPaths = ['/500', '/404'].some(\n (p) => p === path || p === path + '.html'\n )\n // If the ssg path has .html extension, and it's not builtin paths, use it directly\n // Otherwise, use that as the filename instead\n const isHtmlExtPath = !isBuiltinPaths && path.endsWith('.html')\n htmlFilename = isHtmlExtPath ? getHtmlFilename(path) : path\n } else if (path === '/') {\n // If the path is the root, just use index.html\n htmlFilename = 'index.html'\n }\n\n const baseDir = join(outDir, dirname(htmlFilename))\n let htmlFilepath = join(outDir, htmlFilename)\n\n await fs.mkdir(baseDir, { recursive: true })\n\n const components = await loadComponents({\n distDir,\n page,\n isAppPath: isAppDir,\n })\n\n // Handle App Routes.\n if (isAppDir && isAppRouteRoute(page)) {\n return exportAppRoute(\n req,\n res,\n params,\n page,\n components.routeModule as AppRouteRouteModule,\n input.renderOpts.incrementalCache,\n input.renderOpts.cacheLifeProfiles,\n htmlFilepath,\n fileWriter,\n input.renderOpts.experimental,\n input.renderOpts.buildId\n )\n }\n\n const renderOpts: WorkerRenderOpts = {\n ...components,\n ...input.renderOpts,\n ampPath: renderAmpPath,\n params,\n optimizeCss,\n disableOptimizedLoading,\n locale,\n supportsDynamicResponse: false,\n experimental: {\n ...input.renderOpts.experimental,\n isRoutePPREnabled,\n },\n }\n\n if (hasNextSupport) {\n renderOpts.isRevalidate = true\n }\n\n // Handle App Pages\n if (isAppDir) {\n // If this is a prospective render, don't return any metrics or revalidate\n // timings as we aren't persisting this render (it was only to error).\n if (isProspectiveRender) {\n return prospectiveRenderAppPage(\n req,\n res,\n page,\n pathname,\n query,\n fallbackRouteParams,\n renderOpts\n )\n }\n\n return exportAppPage(\n req,\n res,\n page,\n path,\n pathname,\n query,\n fallbackRouteParams,\n renderOpts,\n htmlFilepath,\n debugOutput,\n isDynamicError,\n fileWriter\n )\n }\n\n return exportPagesPage(\n req,\n res,\n path,\n page,\n query,\n params,\n htmlFilepath,\n htmlFilename,\n ampPath,\n subFolders,\n outDir,\n ampValidatorPath,\n pagesDataDir,\n buildExport,\n isDynamic,\n hasOrigQueryValues,\n renderOpts,\n components,\n fileWriter\n )\n}\n\nexport async function exportPages(\n input: ExportPagesInput\n): Promise<ExportPagesResult> {\n const {\n exportPathMap,\n paths,\n dir,\n distDir,\n outDir,\n cacheHandler,\n cacheMaxMemorySize,\n fetchCacheKeyPrefix,\n pagesDataDir,\n renderOpts,\n nextConfig,\n options,\n } = input\n\n // If the fetch cache was enabled, we need to create an incremental\n // cache instance for this page.\n const incrementalCache = await createIncrementalCache({\n cacheHandler,\n cacheMaxMemorySize,\n fetchCacheKeyPrefix,\n distDir,\n dir,\n dynamicIO: Boolean(nextConfig.experimental.dynamicIO),\n // skip writing to disk in minimal mode for now, pending some\n // changes to better support it\n flushToDisk: !hasNextSupport,\n cacheHandlers: nextConfig.experimental.cacheHandlers,\n })\n\n renderOpts.incrementalCache = incrementalCache\n\n const maxConcurrency =\n nextConfig.experimental.staticGenerationMaxConcurrency ?? 8\n const results: ExportPagesResult = []\n\n const exportPageWithRetry = async (path: string, maxAttempts: number) => {\n const pathMap = exportPathMap[path]\n const { page } = exportPathMap[path]\n const pageKey = page !== path ? `${page}: ${path}` : path\n let attempt = 0\n let result\n\n while (attempt < maxAttempts) {\n try {\n result = await Promise.race<ExportPageResult | undefined>([\n exportPage({\n path,\n pathMap,\n distDir,\n outDir,\n pagesDataDir,\n renderOpts,\n ampValidatorPath:\n nextConfig.experimental.amp?.validator || undefined,\n trailingSlash: nextConfig.trailingSlash,\n serverRuntimeConfig: nextConfig.serverRuntimeConfig,\n subFolders: nextConfig.trailingSlash && !options.buildExport,\n buildExport: options.buildExport,\n optimizeCss: nextConfig.experimental.optimizeCss,\n disableOptimizedLoading:\n nextConfig.experimental.disableOptimizedLoading,\n parentSpanId: input.parentSpanId,\n httpAgentOptions: nextConfig.httpAgentOptions,\n debugOutput: options.debugOutput,\n enableExperimentalReact: needsExperimentalReact(nextConfig),\n }),\n // If exporting the page takes longer than the timeout, reject the promise.\n new Promise((_, reject) => {\n setTimeout(() => {\n reject(new TimeoutError())\n }, nextConfig.staticPageGenerationTimeout * 1000)\n }),\n ])\n\n // If there was an error in the export, throw it immediately. In the catch block, we might retry the export,\n // or immediately fail the build, depending on user configuration. We might also continue on and attempt other pages.\n if (result && 'error' in result) {\n throw new ExportPageError()\n }\n\n // If the export succeeds, break out of the retry loop\n break\n } catch (err) {\n // The only error that should be caught here is an ExportError, as `exportPage` doesn't throw and instead returns an object with an `error` property.\n // This is an overly cautious check to ensure that we don't accidentally catch an unexpected error.\n if (!(err instanceof ExportPageError || err instanceof TimeoutError)) {\n throw err\n }\n\n if (err instanceof TimeoutError) {\n // If the export times out, we will restart the worker up to 3 times.\n maxAttempts = 3\n }\n\n // We've reached the maximum number of attempts\n if (attempt >= maxAttempts - 1) {\n // Log a message if we've reached the maximum number of attempts.\n // We only care to do this if maxAttempts was configured.\n if (maxAttempts > 1) {\n console.info(\n `Failed to build ${pageKey} after ${maxAttempts} attempts.`\n )\n }\n // If prerenderEarlyExit is enabled, we'll exit the build immediately.\n if (nextConfig.experimental.prerenderEarlyExit) {\n console.error(\n `Export encountered an error on ${pageKey}, exiting the build.`\n )\n process.exit(1)\n } else {\n // Otherwise, this is a no-op. The build will continue, and a summary of failed pages will be displayed at the end.\n }\n } else {\n // Otherwise, we have more attempts to make. Wait before retrying\n if (err instanceof TimeoutError) {\n console.info(\n `Failed to build ${pageKey} (attempt ${attempt + 1} of ${maxAttempts}) because it took more than ${nextConfig.staticPageGenerationTimeout} seconds. Retrying again shortly.`\n )\n } else {\n console.info(\n `Failed to build ${pageKey} (attempt ${attempt + 1} of ${maxAttempts}). Retrying again shortly.`\n )\n }\n await new Promise((r) => setTimeout(r, Math.random() * 500))\n }\n }\n\n attempt++\n }\n\n return { result, path, pageKey }\n }\n\n for (let i = 0; i < paths.length; i += maxConcurrency) {\n const subset = paths.slice(i, i + maxConcurrency)\n\n const subsetResults = await Promise.all(\n subset.map((path) =>\n exportPageWithRetry(\n path,\n nextConfig.experimental.staticGenerationRetryCount ?? 1\n )\n )\n )\n\n results.push(...subsetResults)\n }\n\n return results\n}\n\nasync function exportPage(\n input: ExportPageInput\n): Promise<ExportPageResult | undefined> {\n trace('export-page', input.parentSpanId).setAttribute('path', input.path)\n\n // Configure the http agent.\n setHttpClientAndAgentOptions({\n httpAgentOptions: input.httpAgentOptions,\n })\n\n const files: ExportedPageFile[] = []\n const baseFileWriter: FileWriter = async (\n type,\n path,\n content,\n encodingOptions = 'utf-8'\n ) => {\n await fs.mkdir(dirname(path), { recursive: true })\n await fs.writeFile(path, content, encodingOptions)\n files.push({ type, path })\n }\n\n const exportPageSpan = trace('export-page-worker', input.parentSpanId)\n\n const start = Date.now()\n\n const turborepoAccessTraceResult = new TurborepoAccessTraceResult()\n\n // Export the page.\n let result: ExportRouteResult | undefined\n try {\n result = await exportPageSpan.traceAsyncFn(() =>\n turborepoTraceAccess(\n () => exportPageImpl(input, baseFileWriter),\n turborepoAccessTraceResult\n )\n )\n\n // If there was no result, then we can exit early.\n if (!result) return\n\n // If there was an error, then we can exit early.\n if ('error' in result) {\n return { error: result.error, duration: Date.now() - start, files: [] }\n }\n } catch (err) {\n console.error(\n `Error occurred prerendering page \"${input.path}\". Read more: https://nextjs.org/docs/messages/prerender-error`\n )\n\n // bailoutToCSRError errors should not leak to the user as they are not actionable; they're\n // a framework signal\n if (!isBailoutToCSRError(err)) {\n // A static generation bailout error is a framework signal to fail static generation but\n // and will encode a reason in the error message. If there is a message, we'll print it.\n // Otherwise there's nothing to show as we don't want to leak an error internal error stack to the user.\n if (isStaticGenBailoutError(err)) {\n if (err.message) {\n console.error(`Error: ${err.message}`)\n }\n } else if (isError(err) && err.stack) {\n console.error(err.stack)\n } else {\n console.error(err)\n }\n }\n\n return { error: true, duration: Date.now() - start, files: [] }\n }\n\n // Notify the parent process that we processed a page (used by the progress activity indicator)\n process.send?.([3, { type: 'activity' }])\n\n // Otherwise we can return the result.\n return {\n duration: Date.now() - start,\n files,\n ampValidations: result.ampValidations,\n revalidate: result.revalidate,\n metadata: result.metadata,\n ssgNotFound: result.ssgNotFound,\n hasEmptyPrelude: result.hasEmptyPrelude,\n hasPostponed: result.hasPostponed,\n turborepoAccessTraceResult: turborepoAccessTraceResult.serialize(),\n fetchMetrics: result.fetchMetrics,\n }\n}\n\nprocess.on('unhandledRejection', (err: unknown) => {\n // if it's a postpone error, it'll be handled later\n // when the postponed promise is actually awaited.\n if (isPostpone(err)) {\n return\n }\n\n // we don't want to log these errors\n if (isDynamicUsageError(err)) {\n return\n }\n\n console.error(err)\n})\n\nprocess.on('rejectionHandled', () => {\n // It is ok to await a Promise late in Next.js as it allows for better\n // prefetching patterns to avoid waterfalls. We ignore logging these.\n // We should've already errored in anyway unhandledRejection.\n})\n\nconst FATAL_UNHANDLED_NEXT_API_EXIT_CODE = 78\n\nprocess.on('uncaughtException', (err) => {\n if (isDynamicUsageError(err)) {\n console.error(\n 'A Next.js API that uses exceptions to signal framework behavior was uncaught. This suggests improper usage of a Next.js API. The original error is printed below and the build will now exit.'\n )\n console.error(err)\n process.exit(FATAL_UNHANDLED_NEXT_API_EXIT_CODE)\n } else {\n console.error(err)\n }\n})\n"],"names":["exportPages","process","env","NEXT_IS_EXPORT_WORKER","envConfig","require","globalThis","__NEXT_DATA__","nextExport","TimeoutError","Error","code","ExportPageError","exportPageImpl","input","fileWriter","req","path","pathMap","distDir","pagesDataDir","buildExport","serverRuntimeConfig","subFolders","optimizeCss","disableOptimizedLoading","debugOutput","enableExperimentalReact","ampValidatorPath","trailingSlash","__NEXT_EXPERIMENTAL_REACT","page","_fallbackRouteParams","_isAppDir","isAppDir","_isDynamicError","isDynamicError","_isRoutePPREnabled","isRoutePPREnabled","_isProspectiveRender","isProspectiveRender","query","originalQuery","fallbackRouteParams","getFallbackRouteParams","pathname","normalizeAppPath","isDynamic","isDynamicRoute","outDir","join","filePath","normalizePagePath","ampPath","renderAmpPath","updatedPath","__nextSsgPath","locale","__nextLocale","renderOpts","localePathResult","normalizeLocalePath","locales","detectedLocale","defaultLocale","hasOrigQueryValues","Object","keys","length","nonLocalizedPath","params","normalizedPage","getParams","res","createRequestResponseMocks","url","statusCode","some","p","endsWith","domainLocales","dl","includes","addRequestMeta","setConfig","publicRuntimeConfig","runtimeConfig","getHtmlFilename","sep","htmlFilename","pageExt","extname","pathExt","isBuiltinPaths","isHtmlExtPath","baseDir","dirname","htmlFilepath","fs","mkdir","recursive","components","loadComponents","isAppPath","isAppRouteRoute","exportAppRoute","routeModule","incrementalCache","cacheLifeProfiles","experimental","buildId","supportsDynamicResponse","hasNextSupport","isRevalidate","prospectiveRenderAppPage","exportAppPage","exportPagesPage","exportPathMap","paths","dir","cacheHandler","cacheMaxMemorySize","fetchCacheKeyPrefix","nextConfig","options","createIncrementalCache","dynamicIO","Boolean","flushToDisk","cacheHandlers","maxConcurrency","staticGenerationMaxConcurrency","results","exportPageWithRetry","maxAttempts","pageKey","attempt","result","Promise","race","exportPage","amp","validator","undefined","parentSpanId","httpAgentOptions","needsExperimentalReact","_","reject","setTimeout","staticPageGenerationTimeout","err","console","info","prerenderEarlyExit","error","exit","r","Math","random","i","subset","slice","subsetResults","all","map","staticGenerationRetryCount","push","trace","setAttribute","setHttpClientAndAgentOptions","files","baseFileWriter","type","content","encodingOptions","writeFile","exportPageSpan","start","Date","now","turborepoAccessTraceResult","TurborepoAccessTraceResult","traceAsyncFn","turborepoTraceAccess","duration","isBailoutToCSRError","isStaticGenBailoutError","message","isError","stack","send","ampValidations","revalidate","metadata","ssgNotFound","hasEmptyPrelude","hasPostponed","serialize","fetchMetrics","on","isPostpone","isDynamicUsageError","FATAL_UNHANDLED_NEXT_API_EXIT_CODE"],"mappings":";;;;+BAwUsBA;;;eAAAA;;;QA7Tf;sBAIqC;iEAC7B;gCACgB;2BACA;mCACG;qCACE;uBACd;mCACuB;gEACzB;6BACW;0BACE;6BAEU;iCACX;wBACD;0BACA;yBACyB;uBACxB;2BACN;wCACa;4BACZ;qCACS;8BACA;sCAI7B;gCAKA;wCACgC;yCAEC;;;;;;AApCxCC,QAAQC,GAAG,CAACC,qBAAqB,GAAG;AAsCpC,MAAMC,YAAYC,QAAQ;AAExBC,WAAmBC,aAAa,GAAG;IACnCC,YAAY;AACd;AAEA,MAAMC,qBAAqBC;;QAA3B,qBACEC,OAAO;;AACT;AAEA,MAAMC,wBAAwBF;;QAA9B,qBACEC,OAAO;;AACT;AAEA,eAAeE,eACbC,KAAsB,EACtBC,UAAsB;QA+GAC;IA7GtB,MAAM,EACJC,IAAI,EACJC,OAAO,EACPC,OAAO,EACPC,YAAY,EACZC,cAAc,KAAK,EACnBC,mBAAmB,EACnBC,aAAa,KAAK,EAClBC,WAAW,EACXC,uBAAuB,EACvBC,cAAc,KAAK,EACnBC,uBAAuB,EACvBC,gBAAgB,EAChBC,aAAa,EACd,GAAGf;IAEJ,IAAIa,yBAAyB;QAC3B1B,QAAQC,GAAG,CAAC4B,yBAAyB,GAAG;IAC1C;IAEA,MAAM,EACJC,IAAI,EAEJ,6CAA6C;IAC7CC,uBAAuB,EAAE,EAEzB,mCAAmC;IACnCC,WAAWC,WAAW,KAAK,EAE3B,6DAA6D;IAC7DC,iBAAiBC,iBAAiB,KAAK,EAEvC,2EAA2E;IAC3E,kBAAkB;IAClBC,oBAAoBC,iBAAiB,EAErC,yEAAyE;IACzE,0EAA0E;IAC1EC,sBAAsBC,sBAAsB,KAAK,EAEjD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AoB;AAC7B,sEAAsE;AACtE,qEAAqE;AACrE,6DAA6D;AAC/D;AAEA,MAAMG,qCAAqC;AAE3C1M,QAAQuM,EAAE,CAAC,qBAAqB,CAACjD;IAC/B,IAAImD,IAAAA,wCAAmB,EAACnD,MAAM;QAC5BC,QAAQG,KAAK,CACX;QAEFH,QAAQG,KAAK,CAACJ;QACdtJ,QAAQ2J,IAAI,CAAC+C;IACf,OAAO;QACLnD,QAAQG,KAAK,CAACJ;IAChB;AACF"}
1
+ {"version":3,"sources":["../../src/export/worker.ts"],"sourcesContent":["import type {\n ExportPagesInput,\n ExportPageInput,\n ExportPageResult,\n ExportRouteResult,\n ExportedPageFile,\n FileWriter,\n WorkerRenderOpts,\n ExportPagesResult,\n} from './types'\n\nimport '../server/node-environment'\n\nprocess.env.NEXT_IS_EXPORT_WORKER = 'true'\n\nimport { extname, join, dirname, sep } from 'path'\nimport fs from 'fs/promises'\nimport { loadComponents } from '../server/load-components'\nimport { isDynamicRoute } from '../shared/lib/router/utils/is-dynamic'\nimport { normalizePagePath } from '../shared/lib/page-path/normalize-page-path'\nimport { normalizeLocalePath } from '../shared/lib/i18n/normalize-locale-path'\nimport { trace } from '../trace'\nimport { setHttpClientAndAgentOptions } from '../server/setup-http-agent-env'\nimport isError from '../lib/is-error'\nimport { addRequestMeta } from '../server/request-meta'\nimport { normalizeAppPath } from '../shared/lib/router/utils/app-paths'\n\nimport { createRequestResponseMocks } from '../server/lib/mock-request'\nimport { isAppRouteRoute } from '../lib/is-app-route-route'\nimport { hasNextSupport } from '../server/ci-info'\nimport { exportAppRoute } from './routes/app-route'\nimport { exportAppPage, prospectiveRenderAppPage } from './routes/app-page'\nimport { exportPagesPage } from './routes/pages'\nimport { getParams } from './helpers/get-params'\nimport { createIncrementalCache } from './helpers/create-incremental-cache'\nimport { isPostpone } from '../server/lib/router-utils/is-postpone'\nimport { isDynamicUsageError } from './helpers/is-dynamic-usage-error'\nimport { isBailoutToCSRError } from '../shared/lib/lazy-dynamic/bailout-to-csr'\nimport {\n turborepoTraceAccess,\n TurborepoAccessTraceResult,\n} from '../build/turborepo-access-trace'\nimport type { Params } from '../server/request/params'\nimport {\n getFallbackRouteParams,\n type FallbackRouteParams,\n} from '../server/request/fallback-params'\nimport { needsExperimentalReact } from '../lib/needs-experimental-react'\nimport type { AppRouteRouteModule } from '../server/route-modules/app-route/module.compiled'\nimport { isStaticGenBailoutError } from '../client/components/static-generation-bailout'\n\nconst envConfig = require('../shared/lib/runtime-config.external')\n\n;(globalThis as any).__NEXT_DATA__ = {\n nextExport: true,\n}\n\nclass TimeoutError extends Error {\n code = 'NEXT_EXPORT_TIMEOUT_ERROR'\n}\n\nclass ExportPageError extends Error {\n code = 'NEXT_EXPORT_PAGE_ERROR'\n}\n\nasync function exportPageImpl(\n input: ExportPageInput,\n fileWriter: FileWriter\n): Promise<ExportRouteResult | undefined> {\n const {\n path,\n pathMap,\n distDir,\n pagesDataDir,\n buildExport = false,\n serverRuntimeConfig,\n subFolders = false,\n optimizeCss,\n disableOptimizedLoading,\n debugOutput = false,\n enableExperimentalReact,\n ampValidatorPath,\n trailingSlash,\n } = input\n\n if (enableExperimentalReact) {\n process.env.__NEXT_EXPERIMENTAL_REACT = 'true'\n }\n\n const {\n page,\n\n // The parameters that are currently unknown.\n _fallbackRouteParams = [],\n\n // Check if this is an `app/` page.\n _isAppDir: isAppDir = false,\n\n // Check if this should error when dynamic usage is detected.\n _isDynamicError: isDynamicError = false,\n\n // If this page supports partial prerendering, then we need to pass that to\n // the renderOpts.\n _isRoutePPREnabled: isRoutePPREnabled,\n\n // If this is a prospective render, we don't actually want to persist the\n // result, we just want to use it to error the build if there's a problem.\n _isProspectiveRender: isProspectiveRender = false,\n\n // Pull the original query out.\n query: originalQuery = {},\n } = pathMap\n\n const fallbackRouteParams: FallbackRouteParams | null =\n getFallbackRouteParams(_fallbackRouteParams)\n\n let query = { ...originalQuery }\n const pathname = normalizeAppPath(page)\n const isDynamic = isDynamicRoute(page)\n const outDir = isAppDir ? join(distDir, 'server/app') : input.outDir\n\n const filePath = normalizePagePath(path)\n const ampPath = `${filePath}.amp`\n let renderAmpPath = ampPath\n\n let updatedPath = query.__nextSsgPath || path\n delete query.__nextSsgPath\n\n let locale = query.__nextLocale || input.renderOpts.locale\n delete query.__nextLocale\n\n if (input.renderOpts.locale) {\n const localePathResult = normalizeLocalePath(path, input.renderOpts.locales)\n\n if (localePathResult.detectedLocale) {\n updatedPath = localePathResult.pathname\n locale = localePathResult.detectedLocale\n\n if (locale === input.renderOpts.defaultLocale) {\n renderAmpPath = `${normalizePagePath(updatedPath)}.amp`\n }\n }\n }\n\n // We need to show a warning if they try to provide query values\n // for an auto-exported page since they won't be available\n const hasOrigQueryValues = Object.keys(originalQuery).length > 0\n\n // Check if the page is a specified dynamic route\n const { pathname: nonLocalizedPath } = normalizeLocalePath(\n path,\n input.renderOpts.locales\n )\n\n let params: Params | undefined\n\n if (isDynamic && page !== nonLocalizedPath) {\n const normalizedPage = isAppDir ? normalizeAppPath(page) : page\n\n params = getParams(normalizedPage, updatedPath)\n }\n\n const { req, res } = createRequestResponseMocks({ url: updatedPath })\n\n // If this is a status code page, then set the response code.\n for (const statusCode of [404, 500]) {\n if (\n [\n `/${statusCode}`,\n `/${statusCode}.html`,\n `/${statusCode}/index.html`,\n ].some((p) => p === updatedPath || `/${locale}${p}` === updatedPath)\n ) {\n res.statusCode = statusCode\n }\n }\n\n // Ensure that the URL has a trailing slash if it's configured.\n if (trailingSlash && !req.url?.endsWith('/')) {\n req.url += '/'\n }\n\n if (\n locale &&\n buildExport &&\n input.renderOpts.domainLocales &&\n input.renderOpts.domainLocales.some(\n (dl) => dl.defaultLocale === locale || dl.locales?.includes(locale || '')\n )\n ) {\n addRequestMeta(req, 'isLocaleDomain', true)\n }\n\n envConfig.setConfig({\n serverRuntimeConfig,\n publicRuntimeConfig: input.renderOpts.runtimeConfig,\n })\n\n const getHtmlFilename = (p: string) =>\n subFolders ? `${p}${sep}index.html` : `${p}.html`\n\n let htmlFilename = getHtmlFilename(filePath)\n\n // dynamic routes can provide invalid extensions e.g. /blog/[...slug] returns an\n // extension of `.slug]`\n const pageExt = isDynamic || isAppDir ? '' : extname(page)\n const pathExt = isDynamic || isAppDir ? '' : extname(path)\n\n // force output 404.html for backwards compat\n if (path === '/404.html') {\n htmlFilename = path\n }\n // Make sure page isn't a folder with a dot in the name e.g. `v1.2`\n else if (pageExt !== pathExt && pathExt !== '') {\n const isBuiltinPaths = ['/500', '/404'].some(\n (p) => p === path || p === path + '.html'\n )\n // If the ssg path has .html extension, and it's not builtin paths, use it directly\n // Otherwise, use that as the filename instead\n const isHtmlExtPath = !isBuiltinPaths && path.endsWith('.html')\n htmlFilename = isHtmlExtPath ? getHtmlFilename(path) : path\n } else if (path === '/') {\n // If the path is the root, just use index.html\n htmlFilename = 'index.html'\n }\n\n const baseDir = join(outDir, dirname(htmlFilename))\n let htmlFilepath = join(outDir, htmlFilename)\n\n await fs.mkdir(baseDir, { recursive: true })\n\n const components = await loadComponents({\n distDir,\n page,\n isAppPath: isAppDir,\n isDev: false,\n })\n\n // Handle App Routes.\n if (isAppDir && isAppRouteRoute(page)) {\n return exportAppRoute(\n req,\n res,\n params,\n page,\n components.routeModule as AppRouteRouteModule,\n input.renderOpts.incrementalCache,\n input.renderOpts.cacheLifeProfiles,\n htmlFilepath,\n fileWriter,\n input.renderOpts.experimental,\n input.renderOpts.buildId\n )\n }\n\n const renderOpts: WorkerRenderOpts = {\n ...components,\n ...input.renderOpts,\n ampPath: renderAmpPath,\n params,\n optimizeCss,\n disableOptimizedLoading,\n locale,\n supportsDynamicResponse: false,\n experimental: {\n ...input.renderOpts.experimental,\n isRoutePPREnabled,\n },\n }\n\n if (hasNextSupport) {\n renderOpts.isRevalidate = true\n }\n\n // Handle App Pages\n if (isAppDir) {\n // If this is a prospective render, don't return any metrics or revalidate\n // timings as we aren't persisting this render (it was only to error).\n if (isProspectiveRender) {\n return prospectiveRenderAppPage(\n req,\n res,\n page,\n pathname,\n query,\n fallbackRouteParams,\n renderOpts\n )\n }\n\n return exportAppPage(\n req,\n res,\n page,\n path,\n pathname,\n query,\n fallbackRouteParams,\n renderOpts,\n htmlFilepath,\n debugOutput,\n isDynamicError,\n fileWriter\n )\n }\n\n return exportPagesPage(\n req,\n res,\n path,\n page,\n query,\n params,\n htmlFilepath,\n htmlFilename,\n ampPath,\n subFolders,\n outDir,\n ampValidatorPath,\n pagesDataDir,\n buildExport,\n isDynamic,\n hasOrigQueryValues,\n renderOpts,\n components,\n fileWriter\n )\n}\n\nexport async function exportPages(\n input: ExportPagesInput\n): Promise<ExportPagesResult> {\n const {\n exportPathMap,\n paths,\n dir,\n distDir,\n outDir,\n cacheHandler,\n cacheMaxMemorySize,\n fetchCacheKeyPrefix,\n pagesDataDir,\n renderOpts,\n nextConfig,\n options,\n } = input\n\n // If the fetch cache was enabled, we need to create an incremental\n // cache instance for this page.\n const incrementalCache = await createIncrementalCache({\n cacheHandler,\n cacheMaxMemorySize,\n fetchCacheKeyPrefix,\n distDir,\n dir,\n dynamicIO: Boolean(nextConfig.experimental.dynamicIO),\n // skip writing to disk in minimal mode for now, pending some\n // changes to better support it\n flushToDisk: !hasNextSupport,\n cacheHandlers: nextConfig.experimental.cacheHandlers,\n })\n\n renderOpts.incrementalCache = incrementalCache\n\n const maxConcurrency =\n nextConfig.experimental.staticGenerationMaxConcurrency ?? 8\n const results: ExportPagesResult = []\n\n const exportPageWithRetry = async (path: string, maxAttempts: number) => {\n const pathMap = exportPathMap[path]\n const { page } = exportPathMap[path]\n const pageKey = page !== path ? `${page}: ${path}` : path\n let attempt = 0\n let result\n\n while (attempt < maxAttempts) {\n try {\n result = await Promise.race<ExportPageResult | undefined>([\n exportPage({\n path,\n pathMap,\n distDir,\n outDir,\n pagesDataDir,\n renderOpts,\n ampValidatorPath:\n nextConfig.experimental.amp?.validator || undefined,\n trailingSlash: nextConfig.trailingSlash,\n serverRuntimeConfig: nextConfig.serverRuntimeConfig,\n subFolders: nextConfig.trailingSlash && !options.buildExport,\n buildExport: options.buildExport,\n optimizeCss: nextConfig.experimental.optimizeCss,\n disableOptimizedLoading:\n nextConfig.experimental.disableOptimizedLoading,\n parentSpanId: input.parentSpanId,\n httpAgentOptions: nextConfig.httpAgentOptions,\n debugOutput: options.debugOutput,\n enableExperimentalReact: needsExperimentalReact(nextConfig),\n }),\n // If exporting the page takes longer than the timeout, reject the promise.\n new Promise((_, reject) => {\n setTimeout(() => {\n reject(new TimeoutError())\n }, nextConfig.staticPageGenerationTimeout * 1000)\n }),\n ])\n\n // If there was an error in the export, throw it immediately. In the catch block, we might retry the export,\n // or immediately fail the build, depending on user configuration. We might also continue on and attempt other pages.\n if (result && 'error' in result) {\n throw new ExportPageError()\n }\n\n // If the export succeeds, break out of the retry loop\n break\n } catch (err) {\n // The only error that should be caught here is an ExportError, as `exportPage` doesn't throw and instead returns an object with an `error` property.\n // This is an overly cautious check to ensure that we don't accidentally catch an unexpected error.\n if (!(err instanceof ExportPageError || err instanceof TimeoutError)) {\n throw err\n }\n\n if (err instanceof TimeoutError) {\n // If the export times out, we will restart the worker up to 3 times.\n maxAttempts = 3\n }\n\n // We've reached the maximum number of attempts\n if (attempt >= maxAttempts - 1) {\n // Log a message if we've reached the maximum number of attempts.\n // We only care to do this if maxAttempts was configured.\n if (maxAttempts > 1) {\n console.info(\n `Failed to build ${pageKey} after ${maxAttempts} attempts.`\n )\n }\n // If prerenderEarlyExit is enabled, we'll exit the build immediately.\n if (nextConfig.experimental.prerenderEarlyExit) {\n console.error(\n `Export encountered an error on ${pageKey}, exiting the build.`\n )\n process.exit(1)\n } else {\n // Otherwise, this is a no-op. The build will continue, and a summary of failed pages will be displayed at the end.\n }\n } else {\n // Otherwise, we have more attempts to make. Wait before retrying\n if (err instanceof TimeoutError) {\n console.info(\n `Failed to build ${pageKey} (attempt ${attempt + 1} of ${maxAttempts}) because it took more than ${nextConfig.staticPageGenerationTimeout} seconds. Retrying again shortly.`\n )\n } else {\n console.info(\n `Failed to build ${pageKey} (attempt ${attempt + 1} of ${maxAttempts}). Retrying again shortly.`\n )\n }\n await new Promise((r) => setTimeout(r, Math.random() * 500))\n }\n }\n\n attempt++\n }\n\n return { result, path, pageKey }\n }\n\n for (let i = 0; i < paths.length; i += maxConcurrency) {\n const subset = paths.slice(i, i + maxConcurrency)\n\n const subsetResults = await Promise.all(\n subset.map((path) =>\n exportPageWithRetry(\n path,\n nextConfig.experimental.staticGenerationRetryCount ?? 1\n )\n )\n )\n\n results.push(...subsetResults)\n }\n\n return results\n}\n\nasync function exportPage(\n input: ExportPageInput\n): Promise<ExportPageResult | undefined> {\n trace('export-page', input.parentSpanId).setAttribute('path', input.path)\n\n // Configure the http agent.\n setHttpClientAndAgentOptions({\n httpAgentOptions: input.httpAgentOptions,\n })\n\n const files: ExportedPageFile[] = []\n const baseFileWriter: FileWriter = async (\n type,\n path,\n content,\n encodingOptions = 'utf-8'\n ) => {\n await fs.mkdir(dirname(path), { recursive: true })\n await fs.writeFile(path, content, encodingOptions)\n files.push({ type, path })\n }\n\n const exportPageSpan = trace('export-page-worker', input.parentSpanId)\n\n const start = Date.now()\n\n const turborepoAccessTraceResult = new TurborepoAccessTraceResult()\n\n // Export the page.\n let result: ExportRouteResult | undefined\n try {\n result = await exportPageSpan.traceAsyncFn(() =>\n turborepoTraceAccess(\n () => exportPageImpl(input, baseFileWriter),\n turborepoAccessTraceResult\n )\n )\n\n // If there was no result, then we can exit early.\n if (!result) return\n\n // If there was an error, then we can exit early.\n if ('error' in result) {\n return { error: result.error, duration: Date.now() - start, files: [] }\n }\n } catch (err) {\n console.error(\n `Error occurred prerendering page \"${input.path}\". Read more: https://nextjs.org/docs/messages/prerender-error`\n )\n\n // bailoutToCSRError errors should not leak to the user as they are not actionable; they're\n // a framework signal\n if (!isBailoutToCSRError(err)) {\n // A static generation bailout error is a framework signal to fail static generation but\n // and will encode a reason in the error message. If there is a message, we'll print it.\n // Otherwise there's nothing to show as we don't want to leak an error internal error stack to the user.\n if (isStaticGenBailoutError(err)) {\n if (err.message) {\n console.error(`Error: ${err.message}`)\n }\n } else if (isError(err) && err.stack) {\n console.error(err.stack)\n } else {\n console.error(err)\n }\n }\n\n return { error: true, duration: Date.now() - start, files: [] }\n }\n\n // Notify the parent process that we processed a page (used by the progress activity indicator)\n process.send?.([3, { type: 'activity' }])\n\n // Otherwise we can return the result.\n return {\n duration: Date.now() - start,\n files,\n ampValidations: result.ampValidations,\n revalidate: result.revalidate,\n metadata: result.metadata,\n ssgNotFound: result.ssgNotFound,\n hasEmptyPrelude: result.hasEmptyPrelude,\n hasPostponed: result.hasPostponed,\n turborepoAccessTraceResult: turborepoAccessTraceResult.serialize(),\n fetchMetrics: result.fetchMetrics,\n }\n}\n\nprocess.on('unhandledRejection', (err: unknown) => {\n // if it's a postpone error, it'll be handled later\n // when the postponed promise is actually awaited.\n if (isPostpone(err)) {\n return\n }\n\n // we don't want to log these errors\n if (isDynamicUsageError(err)) {\n return\n }\n\n console.error(err)\n})\n\nprocess.on('rejectionHandled', () => {\n // It is ok to await a Promise late in Next.js as it allows for better\n // prefetching patterns to avoid waterfalls. We ignore logging these.\n // We should've already errored in anyway unhandledRejection.\n})\n\nconst FATAL_UNHANDLED_NEXT_API_EXIT_CODE = 78\n\nprocess.on('uncaughtException', (err) => {\n if (isDynamicUsageError(err)) {\n console.error(\n 'A Next.js API that uses exceptions to signal framework behavior was uncaught. This suggests improper usage of a Next.js API. The original error is printed below and the build will now exit.'\n )\n console.error(err)\n process.exit(FATAL_UNHANDLED_NEXT_API_EXIT_CODE)\n } else {\n console.error(err)\n }\n})\n"],"names":["exportPages","process","env","NEXT_IS_EXPORT_WORKER","envConfig","require","globalThis","__NEXT_DATA__","nextExport","TimeoutError","Error","code","ExportPageError","exportPageImpl","input","fileWriter","req","path","pathMap","distDir","pagesDataDir","buildExport","serverRuntimeConfig","subFolders","optimizeCss","disableOptimizedLoading","debugOutput","enableExperimentalReact","ampValidatorPath","trailingSlash","__NEXT_EXPERIMENTAL_REACT","page","_fallbackRouteParams","_isAppDir","isAppDir","_isDynamicError","isDynamicError","_isRoutePPREnabled","isRoutePPREnabled","_isProspectiveRender","isProspectiveRender","query","originalQuery","fallbackRouteParams","getFallbackRouteParams","pathname","normalizeAppPath","isDynamic","isDynamicRoute","outDir","join","filePath","normalizePagePath","ampPath","renderAmpPath","updatedPath","__nextSsgPath","locale","__nextLocale","renderOpts","localePathResult","normalizeLocalePath","locales","detectedLocale","defaultLocale","hasOrigQueryValues","Object","keys","length","nonLocalizedPath","params","normalizedPage","getParams","res","createRequestResponseMocks","url","statusCode","some","p","endsWith","domainLocales","dl","includes","addRequestMeta","setConfig","publicRuntimeConfig","runtimeConfig","getHtmlFilename","sep","htmlFilename","pageExt","extname","pathExt","isBuiltinPaths","isHtmlExtPath","baseDir","dirname","htmlFilepath","fs","mkdir","recursive","components","loadComponents","isAppPath","isDev","isAppRouteRoute","exportAppRoute","routeModule","incrementalCache","cacheLifeProfiles","experimental","buildId","supportsDynamicResponse","hasNextSupport","isRevalidate","prospectiveRenderAppPage","exportAppPage","exportPagesPage","exportPathMap","paths","dir","cacheHandler","cacheMaxMemorySize","fetchCacheKeyPrefix","nextConfig","options","createIncrementalCache","dynamicIO","Boolean","flushToDisk","cacheHandlers","maxConcurrency","staticGenerationMaxConcurrency","results","exportPageWithRetry","maxAttempts","pageKey","attempt","result","Promise","race","exportPage","amp","validator","undefined","parentSpanId","httpAgentOptions","needsExperimentalReact","_","reject","setTimeout","staticPageGenerationTimeout","err","console","info","prerenderEarlyExit","error","exit","r","Math","random","i","subset","slice","subsetResults","all","map","staticGenerationRetryCount","push","trace","setAttribute","setHttpClientAndAgentOptions","files","baseFileWriter","type","content","encodingOptions","writeFile","exportPageSpan","start","Date","now","turborepoAccessTraceResult","TurborepoAccessTraceResult","traceAsyncFn","turborepoTraceAccess","duration","isBailoutToCSRError","isStaticGenBailoutError","message","isError","stack","send","ampValidations","revalidate","metadata","ssgNotFound","hasEmptyPrelude","hasPostponed","ser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C3M,QAAQwM,EAAE,CAAC,qBAAqB,CAACjD;IAC/B,IAAImD,IAAAA,wCAAmB,EAACnD,MAAM;QAC5BC,QAAQG,KAAK,CACX;QAEFH,QAAQG,KAAK,CAACJ;QACdvJ,QAAQ4J,IAAI,CAAC+C;IACf,OAAO;QACLnD,QAAQG,KAAK,CAACJ;IAChB;AACF"}
@@ -255,7 +255,7 @@ function assignDefaults(dir, userConfig, silent) {
255
255
  enumerable: false
256
256
  });
257
257
  }
258
- if (!((_process_env___NEXT_VERSION = "15.1.1-canary.3") == null ? void 0 : _process_env___NEXT_VERSION.includes('canary')) && !process.env.__NEXT_TEST_MODE && !process.env.NEXT_PRIVATE_SKIP_CANARY_CHECK) {
258
+ if (!((_process_env___NEXT_VERSION = "15.1.1-canary.4") == null ? void 0 : _process_env___NEXT_VERSION.includes('canary')) && !process.env.__NEXT_TEST_MODE && !process.env.NEXT_PRIVATE_SKIP_CANARY_CHECK) {
259
259
  var _result_experimental7, _result_experimental8, _result_experimental_turbo3, _result_experimental9;
260
260
  // Prevents usage of certain experimental features outside of canary
261
261
  if ((_result_experimental7 = result.experimental) == null ? void 0 : _result_experimental7.ppr) {
@@ -134,7 +134,7 @@ async function createHotReloaderTurbopack(opts, serverFields, distDir, resetFetc
134
134
  }
135
135
  const hasRewrites = opts.fsChecker.rewrites.afterFiles.length > 0 || opts.fsChecker.rewrites.beforeFiles.length > 0 || opts.fsChecker.rewrites.fallback.length > 0;
136
136
  const hotReloaderSpan = (0, _trace.trace)('hot-reloader', undefined, {
137
- version: "15.1.1-canary.3"
137
+ version: "15.1.1-canary.4"
138
138
  });
139
139
  // Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing
140
140
  // of the current `next dev` invocation.
@@ -260,7 +260,7 @@ class HotReloaderWebpack {
260
260
  this.previewProps = previewProps;
261
261
  this.rewrites = rewrites;
262
262
  this.hotReloaderSpan = (0, _trace.trace)('hot-reloader', undefined, {
263
- version: "15.1.1-canary.3"
263
+ version: "15.1.1-canary.4"
264
264
  });
265
265
  // Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing
266
266
  // of the current `next dev` invocation.
@@ -27,7 +27,8 @@ async function loadStaticPaths({ dir, distDir, pathname, config, httpAgentOption
27
27
  distDir,
28
28
  // In `pages/`, the page is the same as the pathname.
29
29
  page: page || pathname,
30
- isAppPath
30
+ isAppPath,
31
+ isDev: true
31
32
  });
32
33
  if (isAppPath) {
33
34
  const segments = await (0, _appsegments.collectSegments)(components);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/server/dev/static-paths-worker.ts"],"sourcesContent":["import type { NextConfigComplete } from '../config-shared'\n\nimport '../require-hook'\nimport '../node-environment'\n\nimport {\n buildAppStaticPaths,\n buildStaticPaths,\n reduceAppConfig,\n} from '../../build/utils'\nimport { collectSegments } from '../../build/segment-config/app/app-segments'\nimport type { PartialStaticPathsResult } from '../../build/utils'\nimport { loadComponents } from '../load-components'\nimport { setHttpClientAndAgentOptions } from '../setup-http-agent-env'\nimport type { IncrementalCache } from '../lib/incremental-cache'\nimport { isAppPageRouteModule } from '../route-modules/checks'\nimport {\n checkIsRoutePPREnabled,\n type ExperimentalPPRConfig,\n} from '../lib/experimental/ppr'\nimport { InvariantError } from '../../shared/lib/invariant-error'\n\ntype RuntimeConfig = {\n pprConfig: ExperimentalPPRConfig | undefined\n configFileName: string\n publicRuntimeConfig: { [key: string]: any }\n serverRuntimeConfig: { [key: string]: any }\n dynamicIO: boolean\n}\n\n// we call getStaticPaths in a separate process to ensure\n// side-effects aren't relied on in dev that will break\n// during a production build\nexport async function loadStaticPaths({\n dir,\n distDir,\n pathname,\n config,\n httpAgentOptions,\n locales,\n defaultLocale,\n isAppPath,\n page,\n isrFlushToDisk,\n fetchCacheKeyPrefix,\n maxMemoryCacheSize,\n requestHeaders,\n cacheHandler,\n cacheLifeProfiles,\n nextConfigOutput,\n buildId,\n authInterrupts,\n}: {\n dir: string\n distDir: string\n pathname: string\n config: RuntimeConfig\n httpAgentOptions: NextConfigComplete['httpAgentOptions']\n locales?: string[]\n defaultLocale?: string\n isAppPath: boolean\n page: string\n isrFlushToDisk?: boolean\n fetchCacheKeyPrefix?: string\n maxMemoryCacheSize?: number\n requestHeaders: IncrementalCache['requestHeaders']\n cacheHandler?: string\n cacheLifeProfiles?: {\n [profile: string]: import('../../server/use-cache/cache-life').CacheLife\n }\n nextConfigOutput: 'standalone' | 'export' | undefined\n buildId: string\n authInterrupts: boolean\n}): Promise<PartialStaticPathsResult> {\n // update work memory runtime-config\n require('../../shared/lib/runtime-config.external').setConfig(config)\n setHttpClientAndAgentOptions({\n httpAgentOptions,\n })\n\n const components = await loadComponents({\n distDir,\n // In `pages/`, the page is the same as the pathname.\n page: page || pathname,\n isAppPath,\n })\n\n if (isAppPath) {\n const segments = await collectSegments(components)\n\n const isRoutePPREnabled =\n isAppPageRouteModule(components.routeModule) &&\n checkIsRoutePPREnabled(config.pprConfig, reduceAppConfig(segments))\n\n return buildAppStaticPaths({\n dir,\n page: pathname,\n dynamicIO: config.dynamicIO,\n segments,\n configFileName: config.configFileName,\n distDir,\n requestHeaders,\n cacheHandler,\n cacheLifeProfiles,\n isrFlushToDisk,\n fetchCacheKeyPrefix,\n maxMemoryCacheSize,\n ComponentMod: components.ComponentMod,\n nextConfigOutput,\n isRoutePPREnabled,\n buildId,\n authInterrupts,\n })\n } else if (!components.getStaticPaths) {\n // We shouldn't get to this point since the worker should only be called for\n // SSG pages with getStaticPaths.\n throw new InvariantError(\n `Failed to load page with getStaticPaths for ${pathname}`\n )\n }\n\n return buildStaticPaths({\n page: pathname,\n getStaticPaths: components.getStaticPaths,\n configFileName: config.configFileName,\n locales,\n defaultLocale,\n })\n}\n"],"names":["loadStaticPaths","dir","distDir","pathname","config","httpAgentOptions","locales","defaultLocale","isAppPath","page","isrFlushToDisk","fetchCacheKeyPrefix","maxMemoryCacheSize","requestHeaders","cacheHandler","cacheLifeProfiles","nextConfigOutput","buildId","authInterrupts","require","setConfig","setHttpClientAndAgentOptions","components","loadComponents","segments","collectSegments","isRoutePPREnabled","isAppPageRouteModule","routeModule","checkIsRoutePPREnabled","pprConfig","reduceAppConfig","buildAppStaticPaths","dynamicIO","configFileName","ComponentMod","getStaticPaths","InvariantError","buildStaticPaths"],"mappings":";;;;+BAiCsBA;;;eAAAA;;;QA/Bf;QACA;uBAMA;6BACyB;gCAED;mCACc;wBAER;qBAI9B;gCACwB;AAaxB,eAAeA,gBAAgB,EACpCC,GAAG,EACHC,OAAO,EACPC,QAAQ,EACRC,MAAM,EACNC,gBAAgB,EAChBC,OAAO,EACPC,aAAa,EACbC,SAAS,EACTC,IAAI,EACJC,cAAc,EACdC,mBAAmB,EACnBC,kBAAkB,EAClBC,cAAc,EACdC,YAAY,EACZC,iBAAiB,EACjBC,gBAAgB,EAChBC,OAAO,EACPC,cAAc,EAsBf;IACC,oCAAoC;IACpCC,QAAQ,4CAA4CC,SAAS,CAAChB;IAC9DiB,IAAAA,+CAA4B,EAAC;QAC3BhB;IACF;IAEA,MAAMiB,aAAa,MAAMC,IAAAA,8BAAc,EAAC;QACtCrB;QACA,qDAAqD;QACrDO,MAAMA,QAAQN;QACdK;IACF;IAEA,IAAIA,WAAW;QACb,MAAMgB,WAAW,MAAMC,IAAAA,4BAAe,EAACH;QAEvC,MAAMI,oBACJC,IAAAA,4BAAoB,EAACL,WAAWM,WAAW,KAC3CC,IAAAA,2BAAsB,EAACzB,OAAO0B,SAAS,EAAEC,IAAAA,sBAAe,EAACP;QAE3D,OAAOQ,IAAAA,0BAAmB,EAAC;YACzB/B;YACAQ,MAAMN;YACN8B,WAAW7B,OAAO6B,SAAS;YAC3BT;YACAU,gBAAgB9B,OAAO8B,cAAc;YACrChC;YACAW;YACAC;YACAC;YACAL;YACAC;YACAC;YACAuB,cAAcb,WAAWa,YAAY;YACrCnB;YACAU;YACAT;YACAC;QACF;IACF,OAAO,IAAI,CAACI,WAAWc,cAAc,EAAE;QACrC,4EAA4E;QAC5E,iCAAiC;QACjC,MAAM,qBAEL,CAFK,IAAIC,8BAAc,CACtB,CAAC,4CAA4C,EAAElC,UAAU,GADrD,qBAAA;mBAAA;wBAAA;QAEN;IACF;IAEA,OAAOmC,IAAAA,uBAAgB,EAAC;QACtB7B,MAAMN;QACNiC,gBAAgBd,WAAWc,cAAc;QACzCF,gBAAgB9B,OAAO8B,cAAc;QACrC5B;QACAC;IACF;AACF"}
1
+ {"version":3,"sources":["../../../src/server/dev/static-paths-worker.ts"],"sourcesContent":["import type { NextConfigComplete } from '../config-shared'\n\nimport '../require-hook'\nimport '../node-environment'\n\nimport {\n buildAppStaticPaths,\n buildStaticPaths,\n reduceAppConfig,\n} from '../../build/utils'\nimport { collectSegments } from '../../build/segment-config/app/app-segments'\nimport type { PartialStaticPathsResult } from '../../build/utils'\nimport { loadComponents } from '../load-components'\nimport { setHttpClientAndAgentOptions } from '../setup-http-agent-env'\nimport type { IncrementalCache } from '../lib/incremental-cache'\nimport { isAppPageRouteModule } from '../route-modules/checks'\nimport {\n checkIsRoutePPREnabled,\n type ExperimentalPPRConfig,\n} from '../lib/experimental/ppr'\nimport { InvariantError } from '../../shared/lib/invariant-error'\n\ntype RuntimeConfig = {\n pprConfig: ExperimentalPPRConfig | undefined\n configFileName: string\n publicRuntimeConfig: { [key: string]: any }\n serverRuntimeConfig: { [key: string]: any }\n dynamicIO: boolean\n}\n\n// we call getStaticPaths in a separate process to ensure\n// side-effects aren't relied on in dev that will break\n// during a production build\nexport async function loadStaticPaths({\n dir,\n distDir,\n pathname,\n config,\n httpAgentOptions,\n locales,\n defaultLocale,\n isAppPath,\n page,\n isrFlushToDisk,\n fetchCacheKeyPrefix,\n maxMemoryCacheSize,\n requestHeaders,\n cacheHandler,\n cacheLifeProfiles,\n nextConfigOutput,\n buildId,\n authInterrupts,\n}: {\n dir: string\n distDir: string\n pathname: string\n config: RuntimeConfig\n httpAgentOptions: NextConfigComplete['httpAgentOptions']\n locales?: string[]\n defaultLocale?: string\n isAppPath: boolean\n page: string\n isrFlushToDisk?: boolean\n fetchCacheKeyPrefix?: string\n maxMemoryCacheSize?: number\n requestHeaders: IncrementalCache['requestHeaders']\n cacheHandler?: string\n cacheLifeProfiles?: {\n [profile: string]: import('../../server/use-cache/cache-life').CacheLife\n }\n nextConfigOutput: 'standalone' | 'export' | undefined\n buildId: string\n authInterrupts: boolean\n}): Promise<PartialStaticPathsResult> {\n // update work memory runtime-config\n require('../../shared/lib/runtime-config.external').setConfig(config)\n setHttpClientAndAgentOptions({\n httpAgentOptions,\n })\n\n const components = await loadComponents({\n distDir,\n // In `pages/`, the page is the same as the pathname.\n page: page || pathname,\n isAppPath,\n isDev: true,\n })\n\n if (isAppPath) {\n const segments = await collectSegments(components)\n\n const isRoutePPREnabled =\n isAppPageRouteModule(components.routeModule) &&\n checkIsRoutePPREnabled(config.pprConfig, reduceAppConfig(segments))\n\n return buildAppStaticPaths({\n dir,\n page: pathname,\n dynamicIO: config.dynamicIO,\n segments,\n configFileName: config.configFileName,\n distDir,\n requestHeaders,\n cacheHandler,\n cacheLifeProfiles,\n isrFlushToDisk,\n fetchCacheKeyPrefix,\n maxMemoryCacheSize,\n ComponentMod: components.ComponentMod,\n nextConfigOutput,\n isRoutePPREnabled,\n buildId,\n authInterrupts,\n })\n } else if (!components.getStaticPaths) {\n // We shouldn't get to this point since the worker should only be called for\n // SSG pages with getStaticPaths.\n throw new InvariantError(\n `Failed to load page with getStaticPaths for ${pathname}`\n )\n }\n\n return buildStaticPaths({\n page: pathname,\n getStaticPaths: components.getStaticPaths,\n configFileName: config.configFileName,\n locales,\n defaultLocale,\n })\n}\n"],"names":["loadStaticPaths","dir","distDir","pathname","config","httpAgentOptions","locales","defaultLocale","isAppPath","page","isrFlushToDisk","fetchCacheKeyPrefix","maxMemoryCacheSize","requestHeaders","cacheHandler","cacheLifeProfiles","nextConfigOutput","buildId","authInterrupts","require","setConfig","setHttpClientAndAgentOptions","components","loadComponents","isDev","segments","collectSegments","isRoutePPREnabled","isAppPageRouteModule","routeModule","checkIsRoutePPREnabled","pprConfig","reduceAppConfig","buildAppStaticPaths","dynamicIO","configFileName","ComponentMod","getStaticPaths","InvariantError","buildStaticPaths"],"mappings":";;;;+BAiCsBA;;;eAAAA;;;QA/Bf;QACA;uBAMA;6BACyB;gCAED;mCACc;wBAER;qBAI9B;gCACwB;AAaxB,eAAeA,gBAAgB,EACpCC,GAAG,EACHC,OAAO,EACPC,QAAQ,EACRC,MAAM,EACNC,gBAAgB,EAChBC,OAAO,EACPC,aAAa,EACbC,SAAS,EACTC,IAAI,EACJC,cAAc,EACdC,mBAAmB,EACnBC,kBAAkB,EAClBC,cAAc,EACdC,YAAY,EACZC,iBAAiB,EACjBC,gBAAgB,EAChBC,OAAO,EACPC,cAAc,EAsBf;IACC,oCAAoC;IACpCC,QAAQ,4CAA4CC,SAAS,CAAChB;IAC9DiB,IAAAA,+CAA4B,EAAC;QAC3BhB;IACF;IAEA,MAAMiB,aAAa,MAAMC,IAAAA,8BAAc,EAAC;QACtCrB;QACA,qDAAqD;QACrDO,MAAMA,QAAQN;QACdK;QACAgB,OAAO;IACT;IAEA,IAAIhB,WAAW;QACb,MAAMiB,WAAW,MAAMC,IAAAA,4BAAe,EAACJ;QAEvC,MAAMK,oBACJC,IAAAA,4BAAoB,EAACN,WAAWO,WAAW,KAC3CC,IAAAA,2BAAsB,EAAC1B,OAAO2B,SAAS,EAAEC,IAAAA,sBAAe,EAACP;QAE3D,OAAOQ,IAAAA,0BAAmB,EAAC;YACzBhC;YACAQ,MAAMN;YACN+B,WAAW9B,OAAO8B,SAAS;YAC3BT;YACAU,gBAAgB/B,OAAO+B,cAAc;YACrCjC;YACAW;YACAC;YACAC;YACAL;YACAC;YACAC;YACAwB,cAAcd,WAAWc,YAAY;YACrCpB;YACAW;YACAV;YACAC;QACF;IACF,OAAO,IAAI,CAACI,WAAWe,cAAc,EAAE;QACrC,4EAA4E;QAC5E,iCAAiC;QACjC,MAAM,qBAEL,CAFK,IAAIC,8BAAc,CACtB,CAAC,4CAA4C,EAAEnC,UAAU,GADrD,qBAAA;mBAAA;wBAAA;QAEN;IACF;IAEA,OAAOoC,IAAAA,uBAAgB,EAAC;QACtB9B,MAAMN;QACNkC,gBAAgBf,WAAWe,cAAc;QACzCF,gBAAgB/B,OAAO+B,cAAc;QACrC7B;QACAC;IACF;AACF"}
@@ -67,7 +67,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
67
67
  return newObj;
68
68
  }
69
69
  function logStartInfo({ networkUrl, appUrl, envInfo, expFeatureInfo, maxExperimentalFeatures = Infinity }) {
70
- _log.bootstrap(`${(0, _picocolors.bold)((0, _picocolors.purple)(`${_log.prefixes.ready} Next.js ${"15.1.1-canary.3"}`))}${process.env.TURBOPACK ? ' (Turbopack)' : ''}`);
70
+ _log.bootstrap(`${(0, _picocolors.bold)((0, _picocolors.purple)(`${_log.prefixes.ready} Next.js ${"15.1.1-canary.4"}`))}${process.env.TURBOPACK ? ' (Turbopack)' : ''}`);
71
71
  if (appUrl) {
72
72
  _log.bootstrap(`- Local: ${appUrl}`);
73
73
  }
@@ -111,7 +111,7 @@ async function getRequestHandlers({ dir, port, isDev, onDevServerCleanup, server
111
111
  async function startServer(serverOptions) {
112
112
  const { dir, isDev, hostname, minimalMode, allowRetry, keepAliveTimeout, selfSignedCertificate } = serverOptions;
113
113
  let { port } = serverOptions;
114
- process.title = `next-server (v${"15.1.1-canary.3"})`;
114
+ process.title = `next-server (v${"15.1.1-canary.4"})`;
115
115
  let handlersReady = ()=>{};
116
116
  let handlersError = ()=>{};
117
117
  let handlersPromise = new Promise((resolve, reject)=>{
@@ -58,10 +58,11 @@ export declare function loadManifestWithRetries<T extends object>(manifestPath:
58
58
  * Load manifest file with retries, defaults to 3 attempts.
59
59
  */
60
60
  export declare function evalManifestWithRetries<T extends object>(manifestPath: string, attempts?: number): Promise<DeepReadonly<T>>;
61
- declare function loadComponentsImpl<N = any>({ distDir, page, isAppPath, }: {
61
+ declare function loadComponentsImpl<N = any>({ distDir, page, isAppPath, isDev, }: {
62
62
  distDir: string;
63
63
  page: string;
64
64
  isAppPath: boolean;
65
+ isDev: boolean;
65
66
  }): Promise<LoadComponentsReturnType<N>>;
66
67
  export declare const loadComponents: typeof loadComponentsImpl;
67
68
  export {};
@@ -57,15 +57,15 @@ async function evalManifestWithRetries(manifestPath, attempts = 3) {
57
57
  }
58
58
  }
59
59
  }
60
- async function loadClientReferenceManifest(manifestPath, entryName) {
60
+ async function loadClientReferenceManifest(manifestPath, entryName, attempts) {
61
61
  try {
62
- const context = await evalManifestWithRetries(manifestPath);
62
+ const context = await evalManifestWithRetries(manifestPath, attempts);
63
63
  return context.__RSC_MANIFEST[entryName];
64
64
  } catch (err) {
65
65
  return undefined;
66
66
  }
67
67
  }
68
- async function loadComponentsImpl({ distDir, page, isAppPath }) {
68
+ async function loadComponentsImpl({ distDir, page, isAppPath, isDev }) {
69
69
  let DocumentMod = {};
70
70
  let AppMod = {};
71
71
  if (!isAppPath) {
@@ -77,14 +77,19 @@ async function loadComponentsImpl({ distDir, page, isAppPath }) {
77
77
  }
78
78
  // Make sure to avoid loading the manifest for metadata route handlers.
79
79
  const hasClientManifest = isAppPath && !(0, _ismetadataroute.isMetadataRoute)(page);
80
+ // In dev mode we retry loading a manifest file to handle a race condition
81
+ // that can occur while app and pages are compiling at the same time, and the
82
+ // build-manifest is still being written to disk while an app path is
83
+ // attempting to load.
84
+ const manifestLoadAttempts = isDev ? 3 : 1;
80
85
  // Load the manifest files first
81
86
  const [buildManifest, reactLoadableManifest, dynamicCssManifest, clientReferenceManifest, serverActionsManifest] = await Promise.all([
82
- loadManifestWithRetries((0, _path.join)(distDir, _constants.BUILD_MANIFEST)),
83
- loadManifestWithRetries((0, _path.join)(distDir, _constants.REACT_LOADABLE_MANIFEST)),
87
+ loadManifestWithRetries((0, _path.join)(distDir, _constants.BUILD_MANIFEST), manifestLoadAttempts),
88
+ loadManifestWithRetries((0, _path.join)(distDir, _constants.REACT_LOADABLE_MANIFEST), manifestLoadAttempts),
84
89
  // This manifest will only exist in Pages dir && Production && Webpack.
85
- isAppPath || process.env.TURBOPACK ? undefined : loadManifestWithRetries((0, _path.join)(distDir, `${_constants.DYNAMIC_CSS_MANIFEST}.json`)).catch(()=>undefined),
86
- hasClientManifest ? loadClientReferenceManifest((0, _path.join)(distDir, 'server', 'app', page.replace(/%5F/g, '_') + '_' + _constants.CLIENT_REFERENCE_MANIFEST + '.js'), page.replace(/%5F/g, '_')) : undefined,
87
- isAppPath ? loadManifestWithRetries((0, _path.join)(distDir, 'server', _constants.SERVER_REFERENCE_MANIFEST + '.json')).catch(()=>null) : null
90
+ isAppPath || process.env.TURBOPACK ? undefined : loadManifestWithRetries((0, _path.join)(distDir, `${_constants.DYNAMIC_CSS_MANIFEST}.json`), manifestLoadAttempts).catch(()=>undefined),
91
+ hasClientManifest ? loadClientReferenceManifest((0, _path.join)(distDir, 'server', 'app', page.replace(/%5F/g, '_') + '_' + _constants.CLIENT_REFERENCE_MANIFEST + '.js'), page.replace(/%5F/g, '_'), manifestLoadAttempts) : undefined,
92
+ isAppPath ? loadManifestWithRetries((0, _path.join)(distDir, 'server', _constants.SERVER_REFERENCE_MANIFEST + '.json'), manifestLoadAttempts).catch(()=>null) : null
88
93
  ]);
89
94
  // Before requiring the actual page module, we have to set the reference
90
95
  // manifests to our global store so Server Action's encryption util can access
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/server/load-components.ts"],"sourcesContent":["import type {\n AppType,\n DocumentType,\n NextComponentType,\n} from '../shared/lib/utils'\nimport type { ClientReferenceManifest } from '../build/webpack/plugins/flight-manifest-plugin'\nimport type {\n PageConfig,\n GetStaticPaths,\n GetServerSideProps,\n GetStaticProps,\n} from '../types'\nimport type { RouteModule } from './route-modules/route-module'\nimport type { BuildManifest } from './get-page-files'\nimport type { ActionManifest } from '../build/webpack/plugins/flight-client-entry-plugin'\n\nimport {\n BUILD_MANIFEST,\n REACT_LOADABLE_MANIFEST,\n CLIENT_REFERENCE_MANIFEST,\n SERVER_REFERENCE_MANIFEST,\n DYNAMIC_CSS_MANIFEST,\n} from '../shared/lib/constants'\nimport { join } from 'path'\nimport { requirePage } from './require'\nimport { interopDefault } from '../lib/interop-default'\nimport { getTracer } from './lib/trace/tracer'\nimport { LoadComponentsSpan } from './lib/trace/constants'\nimport { evalManifest, loadManifest } from './load-manifest'\nimport { wait } from '../lib/wait'\nimport { setReferenceManifestsSingleton } from './app-render/encryption-utils'\nimport { createServerModuleMap } from './app-render/action-utils'\nimport type { DeepReadonly } from '../shared/lib/deep-readonly'\nimport { isMetadataRoute } from '../lib/metadata/is-metadata-route'\n\nexport type ManifestItem = {\n id: number | string\n files: string[]\n}\n\nexport type ReactLoadableManifest = { [moduleId: string]: ManifestItem }\n/**\n * This manifest prevents removing server rendered <link> tags after client\n * navigation. This is only needed under `Pages dir && Production && Webpack`.\n * @see https://github.com/vercel/next.js/pull/72959\n */\nexport type DynamicCssManifest = string[]\n\n/**\n * A manifest entry type for the react-loadable-manifest.json.\n *\n * The whole manifest.json is a type of `Record<pathname, LoadableManifest>`\n * where pathname is a string-based key points to the path of the page contains\n * each dynamic imports.\n */\nexport interface LoadableManifest {\n [k: string]: { id: string | number; files: string[] }\n}\n\nexport type LoadComponentsReturnType<NextModule = any> = {\n Component: NextComponentType\n pageConfig: PageConfig\n buildManifest: DeepReadonly<BuildManifest>\n subresourceIntegrityManifest?: DeepReadonly<Record<string, string>>\n reactLoadableManifest: DeepReadonly<ReactLoadableManifest>\n dynamicCssManifest?: DeepReadonly<DynamicCssManifest>\n clientReferenceManifest?: DeepReadonly<ClientReferenceManifest>\n serverActionsManifest?: any\n Document: DocumentType\n App: AppType\n getStaticProps?: GetStaticProps\n getStaticPaths?: GetStaticPaths\n getServerSideProps?: GetServerSideProps\n ComponentMod: NextModule\n routeModule: RouteModule\n isAppPath?: boolean\n page: string\n multiZoneDraftMode?: boolean\n}\n\n/**\n * Load manifest file with retries, defaults to 3 attempts.\n */\nexport async function loadManifestWithRetries<T extends object>(\n manifestPath: string,\n attempts = 3\n) {\n while (true) {\n try {\n return loadManifest<T>(manifestPath)\n } catch (err) {\n attempts--\n if (attempts <= 0) throw err\n\n await wait(100)\n }\n }\n}\n\n/**\n * Load manifest file with retries, defaults to 3 attempts.\n */\nexport async function evalManifestWithRetries<T extends object>(\n manifestPath: string,\n attempts = 3\n) {\n while (true) {\n try {\n return evalManifest<T>(manifestPath)\n } catch (err) {\n attempts--\n if (attempts <= 0) throw err\n\n await wait(100)\n }\n }\n}\n\nasync function loadClientReferenceManifest(\n manifestPath: string,\n entryName: string\n) {\n try {\n const context = await evalManifestWithRetries<{\n __RSC_MANIFEST: { [key: string]: ClientReferenceManifest }\n }>(manifestPath)\n return context.__RSC_MANIFEST[entryName]\n } catch (err) {\n return undefined\n }\n}\n\nasync function loadComponentsImpl<N = any>({\n distDir,\n page,\n isAppPath,\n}: {\n distDir: string\n page: string\n isAppPath: boolean\n}): Promise<LoadComponentsReturnType<N>> {\n let DocumentMod = {}\n let AppMod = {}\n if (!isAppPath) {\n ;[DocumentMod, AppMod] = await Promise.all([\n requirePage('/_document', distDir, false),\n requirePage('/_app', distDir, false),\n ])\n }\n\n // Make sure to avoid loading the manifest for metadata route handlers.\n const hasClientManifest = isAppPath && !isMetadataRoute(page)\n\n // Load the manifest files first\n const [\n buildManifest,\n reactLoadableManifest,\n dynamicCssManifest,\n clientReferenceManifest,\n serverActionsManifest,\n ] = await Promise.all([\n loadManifestWithRetries<BuildManifest>(join(distDir, BUILD_MANIFEST)),\n loadManifestWithRetries<ReactLoadableManifest>(\n join(distDir, REACT_LOADABLE_MANIFEST)\n ),\n // This manifest will only exist in Pages dir && Production && Webpack.\n isAppPath || process.env.TURBOPACK\n ? undefined\n : loadManifestWithRetries<DynamicCssManifest>(\n join(distDir, `${DYNAMIC_CSS_MANIFEST}.json`)\n ).catch(() => undefined),\n hasClientManifest\n ? loadClientReferenceManifest(\n join(\n distDir,\n 'server',\n 'app',\n page.replace(/%5F/g, '_') + '_' + CLIENT_REFERENCE_MANIFEST + '.js'\n ),\n page.replace(/%5F/g, '_')\n )\n : undefined,\n isAppPath\n ? loadManifestWithRetries<ActionManifest>(\n join(distDir, 'server', SERVER_REFERENCE_MANIFEST + '.json')\n ).catch(() => null)\n : null,\n ])\n\n // Before requiring the actual page module, we have to set the reference\n // manifests to our global store so Server Action's encryption util can access\n // to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setReferenceManifestsSingleton({\n page,\n clientReferenceManifest,\n serverActionsManifest,\n serverModuleMap: createServerModuleMap({\n serverActionsManifest,\n }),\n })\n }\n\n const ComponentMod = await requirePage(page, distDir, isAppPath)\n\n const Component = interopDefault(ComponentMod)\n const Document = interopDefault(DocumentMod)\n const App = interopDefault(AppMod)\n\n const { getServerSideProps, getStaticProps, getStaticPaths, routeModule } =\n ComponentMod\n\n return {\n App,\n Document,\n Component,\n buildManifest,\n reactLoadableManifest,\n dynamicCssManifest,\n pageConfig: ComponentMod.config || {},\n ComponentMod,\n getServerSideProps,\n getStaticProps,\n getStaticPaths,\n clientReferenceManifest,\n serverActionsManifest,\n isAppPath,\n page,\n routeModule,\n }\n}\n\nexport const loadComponents = getTracer().wrap(\n LoadComponentsSpan.loadComponents,\n loadComponentsImpl\n)\n"],"names":["evalManifestWithRetries","loadComponents","loadManifestWithRetries","manifestPath","attempts","loadManifest","err","wait","evalManifest","loadClientReferenceManifest","entryName","context","__RSC_MANIFEST","undefined","loadComponentsImpl","distDir","page","isAppPath","DocumentMod","AppMod","Promise","all","requirePage","hasClientManifest","isMetadataRoute","buildManifest","reactLoadableManifest","dynamicCssManifest","clientReferenceManifest","serverActionsManifest","join","BUILD_MANIFEST","REACT_LOADABLE_MANIFEST","process","env","TURBOPACK","DYNAMIC_CSS_MANIFEST","catch","replace","CLIENT_REFERENCE_MANIFEST","SERVER_REFERENCE_MANIFEST","setReferenceManifestsSingleton","serverModuleMap","createServerModuleMap","ComponentMod","Component","interopDefault","Document","App","getServerSideProps","getStaticProps","getStaticPaths","routeModule","pageConfig","config","getTracer","wrap","LoadComponentsSpan"],"mappings":";;;;;;;;;;;;;;;;IAsGsBA,uBAAuB;eAAvBA;;IAkITC,cAAc;eAAdA;;IArJSC,uBAAuB;eAAvBA;;;2BA7Df;sBACc;yBACO;gCACG;wBACL;4BACS;8BACQ;sBACtB;iCAC0B;6BACT;iCAEN;AAkDzB,eAAeA,wBACpBC,YAAoB,EACpBC,WAAW,CAAC;IAEZ,MAAO,KAAM;QACX,IAAI;YACF,OAAOC,IAAAA,0BAAY,EAAIF;QACzB,EAAE,OAAOG,KAAK;YACZF;YACA,IAAIA,YAAY,GAAG,MAAME;YAEzB,MAAMC,IAAAA,UAAI,EAAC;QACb;IACF;AACF;AAKO,eAAeP,wBACpBG,YAAoB,EACpBC,WAAW,CAAC;IAEZ,MAAO,KAAM;QACX,IAAI;YACF,OAAOI,IAAAA,0BAAY,EAAIL;QACzB,EAAE,OAAOG,KAAK;YACZF;YACA,IAAIA,YAAY,GAAG,MAAME;YAEzB,MAAMC,IAAAA,UAAI,EAAC;QACb;IACF;AACF;AAEA,eAAeE,4BACbN,YAAoB,EACpBO,SAAiB;IAEjB,IAAI;QACF,MAAMC,UAAU,MAAMX,wBAEnBG;QACH,OAAOQ,QAAQC,cAAc,CAACF,UAAU;IAC1C,EAAE,OAAOJ,KAAK;QACZ,OAAOO;IACT;AACF;AAEA,eAAeC,mBAA4B,EACzCC,OAAO,EACPC,IAAI,EACJC,SAAS,EAKV;IACC,IAAIC,cAAc,CAAC;IACnB,IAAIC,SAAS,CAAC;IACd,IAAI,CAACF,WAAW;;QACb,CAACC,aAAaC,OAAO,GAAG,MAAMC,QAAQC,GAAG,CAAC;YACzCC,IAAAA,oBAAW,EAAC,cAAcP,SAAS;YACnCO,IAAAA,oBAAW,EAAC,SAASP,SAAS;SAC/B;IACH;IAEA,uEAAuE;IACvE,MAAMQ,oBAAoBN,aAAa,CAACO,IAAAA,gCAAe,EAACR;IAExD,gCAAgC;IAChC,MAAM,C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AMnD,iBAAiBsD,IAAAA,iBAAS,IAAGC,IAAI,CAC5CC,8BAAkB,CAACxD,cAAc,EACjCa"}
1
+ {"version":3,"sources":["../../src/server/load-components.ts"],"sourcesContent":["import type {\n AppType,\n DocumentType,\n NextComponentType,\n} from '../shared/lib/utils'\nimport type { ClientReferenceManifest } from '../build/webpack/plugins/flight-manifest-plugin'\nimport type {\n PageConfig,\n GetStaticPaths,\n GetServerSideProps,\n GetStaticProps,\n} from '../types'\nimport type { RouteModule } from './route-modules/route-module'\nimport type { BuildManifest } from './get-page-files'\nimport type { ActionManifest } from '../build/webpack/plugins/flight-client-entry-plugin'\n\nimport {\n BUILD_MANIFEST,\n REACT_LOADABLE_MANIFEST,\n CLIENT_REFERENCE_MANIFEST,\n SERVER_REFERENCE_MANIFEST,\n DYNAMIC_CSS_MANIFEST,\n} from '../shared/lib/constants'\nimport { join } from 'path'\nimport { requirePage } from './require'\nimport { interopDefault } from '../lib/interop-default'\nimport { getTracer } from './lib/trace/tracer'\nimport { LoadComponentsSpan } from './lib/trace/constants'\nimport { evalManifest, loadManifest } from './load-manifest'\nimport { wait } from '../lib/wait'\nimport { setReferenceManifestsSingleton } from './app-render/encryption-utils'\nimport { createServerModuleMap } from './app-render/action-utils'\nimport type { DeepReadonly } from '../shared/lib/deep-readonly'\nimport { isMetadataRoute } from '../lib/metadata/is-metadata-route'\n\nexport type ManifestItem = {\n id: number | string\n files: string[]\n}\n\nexport type ReactLoadableManifest = { [moduleId: string]: ManifestItem }\n/**\n * This manifest prevents removing server rendered <link> tags after client\n * navigation. This is only needed under `Pages dir && Production && Webpack`.\n * @see https://github.com/vercel/next.js/pull/72959\n */\nexport type DynamicCssManifest = string[]\n\n/**\n * A manifest entry type for the react-loadable-manifest.json.\n *\n * The whole manifest.json is a type of `Record<pathname, LoadableManifest>`\n * where pathname is a string-based key points to the path of the page contains\n * each dynamic imports.\n */\nexport interface LoadableManifest {\n [k: string]: { id: string | number; files: string[] }\n}\n\nexport type LoadComponentsReturnType<NextModule = any> = {\n Component: NextComponentType\n pageConfig: PageConfig\n buildManifest: DeepReadonly<BuildManifest>\n subresourceIntegrityManifest?: DeepReadonly<Record<string, string>>\n reactLoadableManifest: DeepReadonly<ReactLoadableManifest>\n dynamicCssManifest?: DeepReadonly<DynamicCssManifest>\n clientReferenceManifest?: DeepReadonly<ClientReferenceManifest>\n serverActionsManifest?: any\n Document: DocumentType\n App: AppType\n getStaticProps?: GetStaticProps\n getStaticPaths?: GetStaticPaths\n getServerSideProps?: GetServerSideProps\n ComponentMod: NextModule\n routeModule: RouteModule\n isAppPath?: boolean\n page: string\n multiZoneDraftMode?: boolean\n}\n\n/**\n * Load manifest file with retries, defaults to 3 attempts.\n */\nexport async function loadManifestWithRetries<T extends object>(\n manifestPath: string,\n attempts = 3\n) {\n while (true) {\n try {\n return loadManifest<T>(manifestPath)\n } catch (err) {\n attempts--\n if (attempts <= 0) throw err\n\n await wait(100)\n }\n }\n}\n\n/**\n * Load manifest file with retries, defaults to 3 attempts.\n */\nexport async function evalManifestWithRetries<T extends object>(\n manifestPath: string,\n attempts = 3\n) {\n while (true) {\n try {\n return evalManifest<T>(manifestPath)\n } catch (err) {\n attempts--\n if (attempts <= 0) throw err\n\n await wait(100)\n }\n }\n}\n\nasync function loadClientReferenceManifest(\n manifestPath: string,\n entryName: string,\n attempts?: number\n) {\n try {\n const context = await evalManifestWithRetries<{\n __RSC_MANIFEST: { [key: string]: ClientReferenceManifest }\n }>(manifestPath, attempts)\n return context.__RSC_MANIFEST[entryName]\n } catch (err) {\n return undefined\n }\n}\n\nasync function loadComponentsImpl<N = any>({\n distDir,\n page,\n isAppPath,\n isDev,\n}: {\n distDir: string\n page: string\n isAppPath: boolean\n isDev: boolean\n}): Promise<LoadComponentsReturnType<N>> {\n let DocumentMod = {}\n let AppMod = {}\n if (!isAppPath) {\n ;[DocumentMod, AppMod] = await Promise.all([\n requirePage('/_document', distDir, false),\n requirePage('/_app', distDir, false),\n ])\n }\n\n // Make sure to avoid loading the manifest for metadata route handlers.\n const hasClientManifest = isAppPath && !isMetadataRoute(page)\n\n // In dev mode we retry loading a manifest file to handle a race condition\n // that can occur while app and pages are compiling at the same time, and the\n // build-manifest is still being written to disk while an app path is\n // attempting to load.\n const manifestLoadAttempts = isDev ? 3 : 1\n\n // Load the manifest files first\n const [\n buildManifest,\n reactLoadableManifest,\n dynamicCssManifest,\n clientReferenceManifest,\n serverActionsManifest,\n ] = await Promise.all([\n loadManifestWithRetries<BuildManifest>(\n join(distDir, BUILD_MANIFEST),\n manifestLoadAttempts\n ),\n loadManifestWithRetries<ReactLoadableManifest>(\n join(distDir, REACT_LOADABLE_MANIFEST),\n manifestLoadAttempts\n ),\n // This manifest will only exist in Pages dir && Production && Webpack.\n isAppPath || process.env.TURBOPACK\n ? undefined\n : loadManifestWithRetries<DynamicCssManifest>(\n join(distDir, `${DYNAMIC_CSS_MANIFEST}.json`),\n manifestLoadAttempts\n ).catch(() => undefined),\n hasClientManifest\n ? loadClientReferenceManifest(\n join(\n distDir,\n 'server',\n 'app',\n page.replace(/%5F/g, '_') + '_' + CLIENT_REFERENCE_MANIFEST + '.js'\n ),\n page.replace(/%5F/g, '_'),\n manifestLoadAttempts\n )\n : undefined,\n isAppPath\n ? loadManifestWithRetries<ActionManifest>(\n join(distDir, 'server', SERVER_REFERENCE_MANIFEST + '.json'),\n manifestLoadAttempts\n ).catch(() => null)\n : null,\n ])\n\n // Before requiring the actual page module, we have to set the reference\n // manifests to our global store so Server Action's encryption util can access\n // to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setReferenceManifestsSingleton({\n page,\n clientReferenceManifest,\n serverActionsManifest,\n serverModuleMap: createServerModuleMap({\n serverActionsManifest,\n }),\n })\n }\n\n const ComponentMod = await requirePage(page, distDir, isAppPath)\n\n const Component = interopDefault(ComponentMod)\n const Document = interopDefault(DocumentMod)\n const App = interopDefault(AppMod)\n\n const { getServerSideProps, getStaticProps, getStaticPaths, routeModule } =\n ComponentMod\n\n return {\n App,\n Document,\n Component,\n buildManifest,\n reactLoadableManifest,\n dynamicCssManifest,\n pageConfig: ComponentMod.config || {},\n ComponentMod,\n getServerSideProps,\n getStaticProps,\n getStaticPaths,\n clientReferenceManifest,\n serverActionsManifest,\n isAppPath,\n page,\n routeModule,\n }\n}\n\nexport const loadComponents = getTracer().wrap(\n LoadComponentsSpan.loadComponents,\n loadComponentsImpl\n)\n"],"names":["evalManifestWithRetries","loadComponents","loadManifestWithRetries","manifestPath","attempts","loadManifest","err","wait","evalManifest","loadClientReferenceManifest","entryName","context","__RSC_MANIFEST","undefined","loadComponentsImpl","distDir","page","isAppPath","isDev","DocumentMod","AppMod","Promise","all","requirePage","hasClientManifest","isMetadataRoute","manifestLoadAttempts","buildManifest","reactLoadableManifest","dynamicCssManifest","clientReferenceManifest","serverActionsManifest","join","BUILD_MANIFEST","REACT_LOADABLE_MANIFEST","process","env","TURBOPACK","DYNAMIC_CSS_MANIFEST","catch","replace","CLIENT_REFERENCE_MANIFEST","SERVER_REFERENCE_MANIFEST","setReferenceManifestsSingleton","serverModuleMap","createServerModuleMap","ComponentMod","Component","interopDefault","Document","App","getServerSideProps","getStaticProps","getStaticPaths","routeModule","pageConfig","config","getTracer","wrap","LoadComponentsSpan"],"mappings":";;;;;;;;;;;;;;;;IAsGsBA,uBAAuB;eAAvBA;;IAkJTC,cAAc;eAAdA;;IArKSC,uBAAuB;eAAvBA;;;2BA7Df;sBACc;yBACO;gCACG;wBACL;4BACS;8BACQ;sBACtB;iCAC0B;6BACT;iCAEN;AAkDzB,eAAeA,wBACpBC,YAAoB,EACpBC,WAAW,CAAC;IAEZ,MAAO,KAAM;QACX,IAAI;YACF,OAAOC,IAAAA,0BAAY,EAAIF;QACzB,EAAE,OAAOG,KAAK;YACZF;YACA,IAAIA,YAAY,GAAG,MAAME;YAEzB,MAAMC,IAAAA,UAAI,EAAC;QACb;IACF;AACF;AAKO,eAAeP,wBACpBG,YAAoB,EACpBC,WAAW,CAAC;IAE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B;QAClBW,oBACIf,4BACEuB,IAAAA,UAAI,EACFjB,SACA,UACA,OACAC,KAAKwB,OAAO,CAAC,QAAQ,OAAO,MAAMC,oCAAyB,GAAG,QAEhEzB,KAAKwB,OAAO,CAAC,QAAQ,MACrBd,wBAEFb;QACJI,YACIf,wBACE8B,IAAAA,UAAI,EAACjB,SAAS,UAAU2B,oCAAyB,GAAG,UACpDhB,sBACAa,KAAK,CAAC,IAAM,QACd;KACL;IAED,wEAAwE;IACxE,8EAA8E;IAC9E,+CAA+C;IAC/C,IAAIR,yBAAyBD,yBAAyB;QACpDa,IAAAA,+CAA8B,EAAC;YAC7B3B;YACAc;YACAC;YACAa,iBAAiBC,IAAAA,kCAAqB,EAAC;gBACrCd;YACF;QACF;IACF;IAEA,MAAMe,eAAe,MAAMvB,IAAAA,oBAAW,EAACP,MAAMD,SAASE;IAEtD,MAAM8B,YAAYC,IAAAA,8BAAc,EAACF;IACjC,MAAMG,WAAWD,IAAAA,8BAAc,EAAC7B;IAChC,MAAM+B,MAAMF,IAAAA,8BAAc,EAAC5B;IAE3B,MAAM,EAAE+B,kBAAkB,EAAEC,cAAc,EAAEC,cAAc,EAAEC,WAAW,EAAE,GACvER;IAEF,OAAO;QACLI;QACAD;QACAF;QACApB;QACAC;QACAC;QACA0B,YAAYT,aAAaU,MAAM,IAAI,CAAC;QACpCV;QACAK;QACAC;QACAC;QACAvB;QACAC;QACAd;QACAD;QACAsC;IACF;AACF;AAEO,MAAMrD,iBAAiBwD,IAAAA,iBAAS,IAAGC,IAAI,CAC5CC,8BAAkB,CAAC1D,cAAc,EACjCa"}
@@ -43,6 +43,7 @@ export default class NextNodeServer extends BaseServer<Options, NodeNextRequest,
43
43
  private routerServerHandler?;
44
44
  protected cleanupListeners: AsyncCallbackSet;
45
45
  protected internalWaitUntil: WaitUntil | undefined;
46
+ private isDev;
46
47
  constructor(options: Options);
47
48
  unstable_preloadEntries(): Promise<void>;
48
49
  protected handleUpgrade(): Promise<void>;
@@ -389,6 +389,7 @@ class NextNodeServer extends _baseserver.default {
389
389
  }
390
390
  return result.finished;
391
391
  };
392
+ this.isDev = options.dev ?? false;
392
393
  /**
393
394
  * This sets environment variable to be used at the time of SSR by head.tsx.
394
395
  * Using this from process.env allows targeting SSR by calling
@@ -411,12 +412,14 @@ class NextNodeServer extends _baseserver.default {
411
412
  (0, _loadcomponents.loadComponents)({
412
413
  distDir: this.distDir,
413
414
  page: '/_document',
414
- isAppPath: false
415
+ isAppPath: false,
416
+ isDev: this.isDev
415
417
  }).catch(()=>{});
416
418
  (0, _loadcomponents.loadComponents)({
417
419
  distDir: this.distDir,
418
420
  page: '/_app',
419
- isAppPath: false
421
+ isAppPath: false,
422
+ isDev: this.isDev
420
423
  }).catch(()=>{});
421
424
  }
422
425
  if (!options.dev && !this.minimalMode && this.nextConfig.experimental.preloadEntriesOnStart) {
@@ -461,14 +464,16 @@ class NextNodeServer extends _baseserver.default {
461
464
  await (0, _loadcomponents.loadComponents)({
462
465
  distDir: this.distDir,
463
466
  page,
464
- isAppPath: false
467
+ isAppPath: false,
468
+ isDev: this.isDev
465
469
  }).catch(()=>{});
466
470
  }
467
471
  for (const page of Object.keys(appPathsManifest || {})){
468
472
  await (0, _loadcomponents.loadComponents)({
469
473
  distDir: this.distDir,
470
474
  page,
471
- isAppPath: true
475
+ isAppPath: true,
476
+ isDev: this.isDev
472
477
  }).then(async ({ ComponentMod })=>{
473
478
  // we need to ensure fetch is patched before we require the page,
474
479
  // otherwise if the fetch is patched by user code, we will be patching it
@@ -777,7 +782,8 @@ class NextNodeServer extends _baseserver.default {
777
782
  const components = await (0, _loadcomponents.loadComponents)({
778
783
  distDir: this.distDir,
779
784
  page: pagePath,
780
- isAppPath
785
+ isAppPath,
786
+ isDev: this.isDev
781
787
  });
782
788
  if (query.__nextLocale && typeof components.Component === 'string' && !pagePath.startsWith(`/${query.__nextLocale}`)) {
783
789
  continue;