next 15.6.0-canary.50 → 15.6.0-canary.52

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 (80) hide show
  1. package/dist/bin/next +1 -1
  2. package/dist/build/adapter/build-complete.d.ts +12 -1
  3. package/dist/build/adapter/build-complete.js +80 -21
  4. package/dist/build/adapter/build-complete.js.map +1 -1
  5. package/dist/build/index.js +31 -27
  6. package/dist/build/index.js.map +1 -1
  7. package/dist/build/swc/index.js +1 -1
  8. package/dist/build/type-check.js +15 -8
  9. package/dist/build/type-check.js.map +1 -1
  10. package/dist/build/webpack/config/blocks/css/index.js +1 -15
  11. package/dist/build/webpack/config/blocks/css/index.js.map +1 -1
  12. package/dist/build/webpack-config.js +2 -2
  13. package/dist/client/app-bootstrap.js +1 -1
  14. package/dist/client/index.js +1 -1
  15. package/dist/compiled/next-server/pages-api-turbo.runtime.dev.js +1 -1
  16. package/dist/compiled/next-server/pages-api-turbo.runtime.dev.js.map +1 -1
  17. package/dist/compiled/next-server/pages-api-turbo.runtime.prod.js +1 -1
  18. package/dist/compiled/next-server/pages-api-turbo.runtime.prod.js.map +1 -1
  19. package/dist/compiled/next-server/pages-api.runtime.prod.js +1 -1
  20. package/dist/compiled/next-server/pages-api.runtime.prod.js.map +1 -1
  21. package/dist/compiled/next-server/pages-turbo.runtime.dev.js +1 -1
  22. package/dist/compiled/next-server/pages-turbo.runtime.dev.js.map +1 -1
  23. package/dist/compiled/next-server/pages-turbo.runtime.prod.js +1 -1
  24. package/dist/compiled/next-server/pages-turbo.runtime.prod.js.map +1 -1
  25. package/dist/compiled/next-server/pages.runtime.prod.js +1 -1
  26. package/dist/compiled/next-server/pages.runtime.prod.js.map +1 -1
  27. package/dist/compiled/sass-loader/cjs.js +1 -1
  28. package/dist/esm/build/adapter/build-complete.js +80 -21
  29. package/dist/esm/build/adapter/build-complete.js.map +1 -1
  30. package/dist/esm/build/index.js +31 -27
  31. package/dist/esm/build/index.js.map +1 -1
  32. package/dist/esm/build/swc/index.js +1 -1
  33. package/dist/esm/build/type-check.js +15 -8
  34. package/dist/esm/build/type-check.js.map +1 -1
  35. package/dist/esm/build/webpack/config/blocks/css/index.js +1 -15
  36. package/dist/esm/build/webpack/config/blocks/css/index.js.map +1 -1
  37. package/dist/esm/build/webpack-config.js +2 -2
  38. package/dist/esm/client/app-bootstrap.js +1 -1
  39. package/dist/esm/client/index.js +1 -1
  40. package/dist/esm/lib/recursive-delete.js +1 -1
  41. package/dist/esm/lib/recursive-delete.js.map +1 -1
  42. package/dist/esm/server/dev/hot-reloader-turbopack.js +8 -2
  43. package/dist/esm/server/dev/hot-reloader-turbopack.js.map +1 -1
  44. package/dist/esm/server/dev/hot-reloader-webpack.js +10 -4
  45. package/dist/esm/server/dev/hot-reloader-webpack.js.map +1 -1
  46. package/dist/esm/server/lib/app-info-log.js +1 -1
  47. package/dist/esm/server/lib/start-server.js +1 -1
  48. package/dist/esm/server/mcp/get-mcp-middleware.js +2 -2
  49. package/dist/esm/server/mcp/get-mcp-middleware.js.map +1 -1
  50. package/dist/esm/server/mcp/get-or-create-mcp-server.js +7 -7
  51. package/dist/esm/server/mcp/get-or-create-mcp-server.js.map +1 -1
  52. package/dist/esm/server/mcp/tools/{get-project-path.js → get-project-metadata.js} +9 -5
  53. package/dist/esm/server/mcp/tools/get-project-metadata.js.map +1 -0
  54. package/dist/esm/shared/lib/canary-only.js +1 -1
  55. package/dist/lib/recursive-delete.d.ts +1 -1
  56. package/dist/lib/recursive-delete.js +1 -1
  57. package/dist/lib/recursive-delete.js.map +1 -1
  58. package/dist/server/dev/hot-reloader-turbopack.js +8 -2
  59. package/dist/server/dev/hot-reloader-turbopack.js.map +1 -1
  60. package/dist/server/dev/hot-reloader-webpack.js +10 -4
  61. package/dist/server/dev/hot-reloader-webpack.js.map +1 -1
  62. package/dist/server/lib/app-info-log.js +1 -1
  63. package/dist/server/lib/start-server.js +1 -1
  64. package/dist/server/mcp/get-mcp-middleware.d.ts +2 -2
  65. package/dist/server/mcp/get-mcp-middleware.js +2 -2
  66. package/dist/server/mcp/get-mcp-middleware.js.map +1 -1
  67. package/dist/server/mcp/get-or-create-mcp-server.d.ts +8 -1
  68. package/dist/server/mcp/get-or-create-mcp-server.js +7 -7
  69. package/dist/server/mcp/get-or-create-mcp-server.js.map +1 -1
  70. package/dist/server/mcp/tools/get-project-metadata.d.ts +2 -0
  71. package/dist/server/mcp/tools/{get-project-path.js → get-project-metadata.js} +11 -7
  72. package/dist/server/mcp/tools/get-project-metadata.js.map +1 -0
  73. package/dist/shared/lib/canary-only.js +1 -1
  74. package/dist/telemetry/anonymous-meta.js +1 -1
  75. package/dist/telemetry/events/session-stopped.js +2 -2
  76. package/dist/telemetry/events/version.js +2 -2
  77. package/package.json +16 -16
  78. package/dist/esm/server/mcp/tools/get-project-path.js.map +0 -1
  79. package/dist/server/mcp/tools/get-project-path.d.ts +0 -2
  80. package/dist/server/mcp/tools/get-project-path.js.map +0 -1
package/dist/bin/next CHANGED
@@ -79,7 +79,7 @@ const program = new NextRootCommand();
79
79
  program.name('next').description('The Next.js CLI allows you to develop, build, start your application, and more.').configureHelp({
80
80
  formatHelp: (cmd, helper)=>(0, _formatclihelpoutput.formatCliHelpOutput)(cmd, helper),
81
81
  subcommandTerm: (cmd)=>`${cmd.name()} ${cmd.usage()}`
82
- }).helpCommand(false).helpOption('-h, --help', 'Displays this message.').version(`Next.js v${"15.6.0-canary.50"}`, '-v, --version', 'Outputs the Next.js version.');
82
+ }).helpCommand(false).helpOption('-h, --help', 'Displays this message.').version(`Next.js v${"15.6.0-canary.52"}`, '-v, --version', 'Outputs the Next.js version.');
83
83
  program.command('build').description('Creates an optimized production build of your application. The output displays information about each route.').argument('[directory]', `A directory on which to build the application. ${(0, _picocolors.italic)('If no directory is provided, the current directory will be used.')}`).option('-d, --debug', 'Enables a more verbose build output.').option('--debug-prerender', 'Enables debug mode for prerendering. Not for production use!').option('--no-lint', 'Disables linting.').option('--no-mangling', 'Disables mangling.').option('--profile', 'Enables production profiling for React.').option('--experimental-app-only', 'Builds only App Router routes.').option('--turbo', 'Builds using Turbopack.').option('--turbopack', 'Builds using Turbopack.').option('--webpack', 'Builds using webpack.').addOption(new _commander.Option('--experimental-build-mode [mode]', 'Uses an experimental build mode.').choices([
84
84
  'compile',
85
85
  'generate',
@@ -31,6 +31,11 @@ interface SharedRouteFields {
31
31
  * is the absolute path to the file
32
32
  */
33
33
  assets: Record<string, string>;
34
+ /**
35
+ * wasmAssets are bundled wasm files with mapping of name
36
+ * to filePath on disk
37
+ */
38
+ wasmAssets?: Record<string, string>;
34
39
  /**
35
40
  * config related to the route
36
41
  */
@@ -46,6 +51,11 @@ interface SharedRouteFields {
46
51
  * region preferences to the provider being used
47
52
  */
48
53
  preferredRegion?: string | string[];
54
+ /**
55
+ * env is the environment variables to expose, this is only
56
+ * populated for edge runtime currently
57
+ */
58
+ env?: Record<string, string>;
49
59
  };
50
60
  }
51
61
  export interface AdapterOutput {
@@ -247,9 +257,10 @@ export interface NextAdapter {
247
257
  nextVersion: string;
248
258
  }) => Promise<void> | void;
249
259
  }
250
- export declare function handleBuildComplete({ dir, config, distDir, pageKeys, tracingRoot, adapterPath, appPageKeys, staticPages, nextVersion, hasStatic404, routesManifest, hasNodeMiddleware, prerenderManifest, middlewareManifest, requiredServerFiles, hasInstrumentationHook, functionsConfigManifest, }: {
260
+ export declare function handleBuildComplete({ dir, config, configOutDir, distDir, pageKeys, tracingRoot, adapterPath, appPageKeys, staticPages, nextVersion, hasStatic404, routesManifest, hasNodeMiddleware, prerenderManifest, middlewareManifest, requiredServerFiles, hasInstrumentationHook, functionsConfigManifest, }: {
251
261
  dir: string;
252
262
  distDir: string;
263
+ configOutDir: string;
253
264
  adapterPath: string;
254
265
  tracingRoot: string;
255
266
  nextVersion: string;
@@ -21,6 +21,8 @@ const _apppaths = require("../../shared/lib/router/utils/app-paths");
21
21
  const _constants = require("../../shared/lib/constants");
22
22
  const _normalizepagepath = require("../../shared/lib/page-path/normalize-page-path");
23
23
  const _constants1 = require("../../lib/constants");
24
+ const _normalizelocalepath = require("../../shared/lib/i18n/normalize-locale-path");
25
+ const _addpathprefix = require("../../shared/lib/router/utils/add-path-prefix");
24
26
  function _interop_require_default(obj) {
25
27
  return obj && obj.__esModule ? obj : {
26
28
  default: obj
@@ -67,19 +69,50 @@ function _interop_require_wildcard(obj, nodeInterop) {
67
69
  }
68
70
  return newObj;
69
71
  }
70
- async function handleBuildComplete({ dir, config, distDir, pageKeys, tracingRoot, adapterPath, appPageKeys, staticPages, nextVersion, hasStatic404, routesManifest, hasNodeMiddleware, prerenderManifest, middlewareManifest, requiredServerFiles, hasInstrumentationHook, functionsConfigManifest }) {
72
+ function normalizePathnames(config, outputs) {
73
+ // normalize pathname field with basePath
74
+ if (config.basePath) {
75
+ for (const output of [
76
+ ...outputs.pages,
77
+ ...outputs.pagesApi,
78
+ ...outputs.appPages,
79
+ ...outputs.appRoutes,
80
+ ...outputs.prerenders,
81
+ ...outputs.staticFiles,
82
+ ...outputs.middleware ? [
83
+ outputs.middleware
84
+ ] : []
85
+ ]){
86
+ output.pathname = (0, _addpathprefix.addPathPrefix)(output.pathname, config.basePath);
87
+ }
88
+ }
89
+ }
90
+ async function handleBuildComplete({ dir, config, configOutDir, distDir, pageKeys, tracingRoot, adapterPath, appPageKeys, staticPages, nextVersion, hasStatic404, routesManifest, hasNodeMiddleware, prerenderManifest, middlewareManifest, requiredServerFiles, hasInstrumentationHook, functionsConfigManifest }) {
71
91
  const adapterMod = (0, _interopdefault.interopDefault)(await import((0, _url.pathToFileURL)(require.resolve(adapterPath)).href));
72
92
  if (typeof adapterMod.onBuildComplete === 'function') {
73
93
  _log.info(`Running onBuildComplete from ${adapterMod.name}`);
74
- try {
75
- const outputs = {
76
- pages: [],
77
- pagesApi: [],
78
- appPages: [],
79
- appRoutes: [],
80
- prerenders: [],
81
- staticFiles: []
82
- };
94
+ const outputs = {
95
+ pages: [],
96
+ pagesApi: [],
97
+ appPages: [],
98
+ appRoutes: [],
99
+ prerenders: [],
100
+ staticFiles: []
101
+ };
102
+ if (config.output === 'export') {
103
+ // collect export assets and provide as static files
104
+ const exportFiles = await (0, _recursivereaddir.recursiveReadDir)(configOutDir);
105
+ for (const file of exportFiles){
106
+ let pathname = (file.endsWith('.html') ? file.replace(/\.html$/, '') : file).replace(/\\/g, '/');
107
+ pathname = pathname.startsWith('/') ? pathname : `/${pathname}`;
108
+ outputs.staticFiles.push({
109
+ id: file,
110
+ pathname,
111
+ filePath: _path.default.join(configOutDir, file),
112
+ type: _constants.AdapterOutputType.STATIC_FILE
113
+ });
114
+ }
115
+ } else {
83
116
  const staticFiles = await (0, _recursivereaddir.recursiveReadDir)(_path.default.join(distDir, 'static'));
84
117
  for (const file of staticFiles){
85
118
  const pathname = _path.default.posix.join('/_next/static', file);
@@ -144,9 +177,13 @@ async function handleBuildComplete({ dir, config, distDir, pageKeys, tracingRoot
144
177
  // should this field even be provided?
145
178
  page.files[0] || ''),
146
179
  assets: {},
147
- config: type === _constants.AdapterOutputType.MIDDLEWARE ? {
148
- matchers: page.matchers
149
- } : {}
180
+ wasmAssets: {},
181
+ config: {
182
+ ...type === _constants.AdapterOutputType.MIDDLEWARE ? {
183
+ matchers: page.matchers
184
+ } : {},
185
+ env: page.env
186
+ }
150
187
  };
151
188
  function handleFile(file) {
152
189
  const originalPath = _path.default.join(distDir, file);
@@ -160,11 +197,16 @@ async function handleBuildComplete({ dir, config, distDir, pageKeys, tracingRoot
160
197
  handleFile(file);
161
198
  }
162
199
  for (const item of [
163
- ...page.wasm || [],
164
200
  ...page.assets || []
165
201
  ]){
166
202
  handleFile(item.filePath);
167
203
  }
204
+ for (const item of page.wasm || []){
205
+ if (!output.wasmAssets) {
206
+ output.wasmAssets = {};
207
+ }
208
+ output.wasmAssets[item.name] = item.filePath;
209
+ }
168
210
  if (type === _constants.AdapterOutputType.MIDDLEWARE) {
169
211
  outputs.middleware = output;
170
212
  } else {
@@ -194,12 +236,24 @@ async function handleBuildComplete({ dir, config, distDir, pageKeys, tracingRoot
194
236
  // if it's an auto static optimized page it's just
195
237
  // a static file
196
238
  if (staticPages.has(page)) {
197
- outputs.staticFiles.push({
198
- id: page,
199
- pathname: route,
200
- type: _constants.AdapterOutputType.STATIC_FILE,
201
- filePath: pageFile.replace(/\.js$/, '.html')
202
- });
239
+ if (config.i18n) {
240
+ for (const locale of config.i18n.locales || []){
241
+ const localePage = page === '/' ? `/${locale}` : (0, _addpathprefix.addPathPrefix)(page, `/${locale}`);
242
+ outputs.staticFiles.push({
243
+ id: localePage,
244
+ pathname: localePage,
245
+ type: _constants.AdapterOutputType.STATIC_FILE,
246
+ filePath: _path.default.join(pagesDistDir, `${(0, _normalizepagepath.normalizePagePath)(localePage)}.html`)
247
+ });
248
+ }
249
+ } else {
250
+ outputs.staticFiles.push({
251
+ id: page,
252
+ pathname: route,
253
+ type: _constants.AdapterOutputType.STATIC_FILE,
254
+ filePath: pageFile.replace(/\.js$/, '.html')
255
+ });
256
+ }
203
257
  continue;
204
258
  }
205
259
  const pageTraceFile = `${pageFile}.nft.json`;
@@ -282,7 +336,9 @@ async function handleBuildComplete({ dir, config, distDir, pageKeys, tracingRoot
282
336
  }
283
337
  }
284
338
  const getParentOutput = (srcRoute, childRoute, allowMissing)=>{
285
- const parentOutput = pageOutputMap[srcRoute] || appOutputMap[srcRoute];
339
+ var _config_i18n;
340
+ const normalizedSrcRoute = (0, _normalizelocalepath.normalizeLocalePath)(srcRoute, ((_config_i18n = config.i18n) == null ? void 0 : _config_i18n.locales) || []).pathname;
341
+ const parentOutput = pageOutputMap[normalizedSrcRoute] || appOutputMap[normalizedSrcRoute];
286
342
  if (!parentOutput && !allowMissing) {
287
343
  console.error({
288
344
  appOutputs: Object.keys(appOutputMap),
@@ -482,6 +538,9 @@ async function handleBuildComplete({ dir, config, distDir, pageKeys, tracingRoot
482
538
  }
483
539
  prerenderGroupId += 1;
484
540
  }
541
+ }
542
+ normalizePathnames(config, outputs);
543
+ try {
485
544
  await adapterMod.onBuildComplete({
486
545
  routes: {
487
546
  dynamicRoutes: routesManifest.dynamicRoutes,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/build/adapter/build-complete.ts"],"sourcesContent":["import path from 'path'\nimport fs from 'fs/promises'\nimport { pathToFileURL } from 'url'\nimport * as Log from '../output/log'\nimport { isMiddlewareFilename } from '../utils'\nimport { RenderingMode } from '../rendering-mode'\nimport { interopDefault } from '../../lib/interop-default'\nimport type { RouteHas } from '../../lib/load-custom-routes'\nimport { recursiveReadDir } from '../../lib/recursive-readdir'\nimport { isDynamicRoute } from '../../shared/lib/router/utils'\nimport type { Revalidate } from '../../server/lib/cache-control'\nimport type { NextConfigComplete } from '../../server/config-shared'\nimport type { MiddlewareMatcher } from '../analysis/get-page-static-info'\nimport { normalizeAppPath } from '../../shared/lib/router/utils/app-paths'\nimport { AdapterOutputType, type PHASE_TYPE } from '../../shared/lib/constants'\nimport { normalizePagePath } from '../../shared/lib/page-path/normalize-page-path'\n\nimport type {\n MiddlewareManifest,\n EdgeFunctionDefinition,\n} from '../webpack/plugins/middleware-plugin'\n\nimport type {\n ManifestRoute,\n RoutesManifest,\n PrerenderManifest,\n ManifestHeaderRoute,\n ManifestRewriteRoute,\n ManifestRedirectRoute,\n FunctionsConfigManifest,\n} from '..'\n\nimport {\n HTML_CONTENT_TYPE_HEADER,\n JSON_CONTENT_TYPE_HEADER,\n NEXT_RESUME_HEADER,\n} from '../../lib/constants'\n\ninterface SharedRouteFields {\n /**\n * id is the unique identifier of the output\n */\n id: string\n /**\n * filePath is the location on disk of the built entrypoint asset\n */\n filePath: string\n /**\n * pathname is the URL pathname the asset should be served at\n */\n pathname: string\n /**\n * runtime is which runtime the entrypoint is built for\n */\n runtime: 'nodejs' | 'edge'\n /**\n * assets are all necessary traced assets that could be\n * loaded by the output to handle a request e.g. traced\n * node_modules or necessary manifests for Next.js.\n * The key is the relative path from the repo root and the value\n * is the absolute path to the file\n */\n assets: Record<string, string>\n\n /**\n * config related to the route\n */\n config: {\n /**\n * maxDuration is a segment config to signal the max\n * execution duration a route should be allowed before\n * it's timed out\n */\n maxDuration?: number\n /**\n * preferredRegion is a segment config to signal deployment\n * region preferences to the provider being used\n */\n preferredRegion?: string | string[]\n }\n}\n\nexport interface AdapterOutput {\n /**\n * `PAGES` represents all the React pages that are under `pages/`.\n */\n PAGES: SharedRouteFields & {\n type: AdapterOutputType.PAGES\n }\n\n /**\n * `PAGES_API` represents all the API routes under `pages/api/`.\n */\n PAGES_API: SharedRouteFields & {\n type: AdapterOutputType.PAGES_API\n }\n /**\n * `APP_PAGE` represents all the React pages that are under `app/` with the\n * filename of `page.{j,t}s{,x}`.\n */\n APP_PAGE: SharedRouteFields & {\n type: AdapterOutputType.APP_PAGE\n }\n\n /**\n * `APP_ROUTE` represents all the API routes and metadata routes that are under `app/` with the\n * filename of `route.{j,t}s{,x}`.\n */\n APP_ROUTE: SharedRouteFields & {\n type: AdapterOutputType.APP_ROUTE\n }\n\n /**\n * `PRERENDER` represents an ISR enabled route that might\n * have a seeded cache entry or fallback generated during build\n */\n PRERENDER: {\n id: string\n pathname: string\n type: AdapterOutputType.PRERENDER\n\n /**\n * For prerenders the parent output is the originating\n * page that the prerender is created from\n */\n parentOutputId: string\n\n /**\n * groupId is the identifier for a group of prerenders that should be\n * revalidated together\n */\n groupId: number\n\n pprChain?: {\n headers: Record<string, string>\n }\n\n /**\n * fallback is initial cache data generated during build for a prerender\n */\n fallback?: {\n /**\n * path to the fallback file can be HTML/JSON/RSC\n */\n filePath: string\n /**\n * initialStatus is the status code that should be applied\n * when serving the fallback\n */\n initialStatus?: number\n /**\n * initialHeaders are the headers that should be sent when\n * serving the fallback\n */\n initialHeaders?: Record<string, string | string[]>\n /**\n * initial expiration is how long until the fallback entry\n * is considered expired and no longer valid to serve\n */\n initialExpiration?: number\n /**\n * initial revalidate is how long until the fallback is\n * considered stale and should be revalidated\n */\n initialRevalidate?: Revalidate\n\n /**\n * postponedState is the PPR state when it postponed and is used for resuming\n */\n postponedState?: string\n }\n /**\n * config related to the route\n */\n config: {\n /**\n * allowQuery is the allowed query values to be passed\n * to an ISR function and what should be considered for the cacheKey\n * e.g. for /blog/[slug], \"slug\" is the only allowQuery\n */\n allowQuery?: string[]\n /**\n * allowHeader is the allowed headers to be passed to an\n * ISR function to prevent accidentally poisoning the cache\n * from leaking additional information that can impact the render\n */\n allowHeader?: string[]\n /**\n * bypass for is a list of has conditions the cache\n * should be bypassed and invoked directly e.g. action header\n */\n bypassFor?: RouteHas[]\n /**\n * renderingMode signals PPR or not for a prerender\n */\n renderingMode?: RenderingMode\n\n /**\n * matchers are the configured matchers for middleware\n */\n matchers?: MiddlewareMatcher[]\n\n /**\n * bypassToken is the generated token that signals a prerender cache\n * should be bypassed\n */\n bypassToken?: string\n }\n }\n\n /**\n * `STATIC_FILE` represents a static file (ie /_next/static) or a purely\n * static HTML asset e.g. an automatically statically optimized page\n * that does not use ISR\n */\n STATIC_FILE: {\n id: string\n filePath: string\n pathname: string\n type: AdapterOutputType.STATIC_FILE\n }\n\n /**\n * `MIDDLEWARE` represents the middleware output if present\n */\n MIDDLEWARE: SharedRouteFields & {\n type: AdapterOutputType.MIDDLEWARE\n /**\n * config related to the route\n */\n config: SharedRouteFields['config'] & {\n /**\n * matchers are the configured matchers for middleware\n */\n matchers?: MiddlewareMatcher[]\n }\n }\n}\n\nexport interface AdapterOutputs {\n pages: Array<AdapterOutput['PAGES']>\n middleware?: AdapterOutput['MIDDLEWARE']\n appPages: Array<AdapterOutput['APP_PAGE']>\n pagesApi: Array<AdapterOutput['PAGES_API']>\n appRoutes: Array<AdapterOutput['APP_ROUTE']>\n prerenders: Array<AdapterOutput['PRERENDER']>\n staticFiles: Array<AdapterOutput['STATIC_FILE']>\n}\n\nexport interface NextAdapter {\n name: string\n /**\n * modifyConfig is called for any CLI command that loads the next.config\n * to only apply for specific commands the \"phase\" should be used\n * @param config\n * @param ctx\n * @returns\n */\n modifyConfig?: (\n config: NextConfigComplete,\n ctx: {\n phase: PHASE_TYPE\n }\n ) => Promise<NextConfigComplete> | NextConfigComplete\n onBuildComplete?: (ctx: {\n routes: {\n headers: Array<ManifestHeaderRoute>\n redirects: Array<ManifestRedirectRoute>\n rewrites: {\n beforeFiles: Array<ManifestRewriteRoute>\n afterFiles: Array<ManifestRewriteRoute>\n fallback: Array<ManifestRewriteRoute>\n }\n dynamicRoutes: ReadonlyArray<ManifestRoute>\n }\n outputs: AdapterOutputs\n /**\n * projectDir is the absolute directory the Next.js application is in\n */\n projectDir: string\n /**\n * repoRoot is the absolute path of the detected root of the repo\n */\n repoRoot: string\n /**\n * distDir is the absolute path to the dist directory\n */\n distDir: string\n /**\n * config is the loaded next.config (has modifyConfig applied)\n */\n config: NextConfigComplete\n /**\n * nextVersion is the current version of Next.js being used\n */\n nextVersion: string\n }) => Promise<void> | void\n}\n\nexport async function handleBuildComplete({\n dir,\n config,\n distDir,\n pageKeys,\n tracingRoot,\n adapterPath,\n appPageKeys,\n staticPages,\n nextVersion,\n hasStatic404,\n routesManifest,\n hasNodeMiddleware,\n prerenderManifest,\n middlewareManifest,\n requiredServerFiles,\n hasInstrumentationHook,\n functionsConfigManifest,\n}: {\n dir: string\n distDir: string\n adapterPath: string\n tracingRoot: string\n nextVersion: string\n hasStatic404: boolean\n staticPages: Set<string>\n hasNodeMiddleware: boolean\n config: NextConfigComplete\n pageKeys: readonly string[]\n requiredServerFiles: string[]\n routesManifest: RoutesManifest\n hasInstrumentationHook: boolean\n prerenderManifest: PrerenderManifest\n middlewareManifest: MiddlewareManifest\n appPageKeys?: readonly string[] | undefined\n functionsConfigManifest: FunctionsConfigManifest\n}) {\n const adapterMod = interopDefault(\n await import(pathToFileURL(require.resolve(adapterPath)).href)\n ) as NextAdapter\n\n if (typeof adapterMod.onBuildComplete === 'function') {\n Log.info(`Running onBuildComplete from ${adapterMod.name}`)\n\n try {\n const outputs: AdapterOutputs = {\n pages: [],\n pagesApi: [],\n appPages: [],\n appRoutes: [],\n prerenders: [],\n staticFiles: [],\n }\n\n const staticFiles = await recursiveReadDir(path.join(distDir, 'static'))\n\n for (const file of staticFiles) {\n const pathname = path.posix.join('/_next/static', file)\n const filePath = path.join(distDir, 'static', file)\n outputs.staticFiles.push({\n type: AdapterOutputType.STATIC_FILE,\n id: path.join('static', file),\n pathname,\n filePath,\n })\n }\n\n const sharedNodeAssets: Record<string, string> = {}\n\n for (const file of requiredServerFiles) {\n // add to shared node assets\n const filePath = path.join(dir, file)\n const fileOutputPath = path.relative(tracingRoot, filePath)\n sharedNodeAssets[fileOutputPath] = filePath\n }\n\n if (hasInstrumentationHook) {\n const assets = await handleTraceFiles(\n path.join(distDir, 'server', 'instrumentation.js.nft.json')\n )\n const fileOutputPath = path.relative(\n tracingRoot,\n path.join(distDir, 'server', 'instrumentation.js')\n )\n sharedNodeAssets[fileOutputPath] = path.join(\n distDir,\n 'server',\n 'instrumentation.js'\n )\n Object.assign(sharedNodeAssets, assets)\n }\n\n async function handleTraceFiles(\n traceFilePath: string\n ): Promise<Record<string, string>> {\n const assets: Record<string, string> = Object.assign(\n {},\n sharedNodeAssets\n )\n const traceData = JSON.parse(\n await fs.readFile(traceFilePath, 'utf8')\n ) as {\n files: string[]\n }\n const traceFileDir = path.dirname(traceFilePath)\n\n for (const relativeFile of traceData.files) {\n const tracedFilePath = path.join(traceFileDir, relativeFile)\n const fileOutputPath = path.relative(tracingRoot, tracedFilePath)\n assets[fileOutputPath] = tracedFilePath\n }\n return assets\n }\n\n async function handleEdgeFunction(\n page: EdgeFunctionDefinition,\n isMiddleware: boolean = false\n ) {\n let type: AdapterOutputType = AdapterOutputType.PAGES\n const isAppPrefix = page.page.startsWith('app/')\n const isAppPage = isAppPrefix && page.page.endsWith('/page')\n const isAppRoute = isAppPrefix && page.page.endsWith('/route')\n let currentOutputs: Array<\n | AdapterOutput['PAGES']\n | AdapterOutput['PAGES_API']\n | AdapterOutput['APP_PAGE']\n | AdapterOutput['APP_ROUTE']\n > = outputs.pages\n\n if (isMiddleware) {\n type = AdapterOutputType.MIDDLEWARE\n } else if (isAppPage) {\n currentOutputs = outputs.appPages\n type = AdapterOutputType.APP_PAGE\n } else if (isAppRoute) {\n currentOutputs = outputs.appRoutes\n type = AdapterOutputType.APP_ROUTE\n } else if (page.page.startsWith('/api')) {\n currentOutputs = outputs.pagesApi\n type = AdapterOutputType.PAGES_API\n }\n\n const output: Omit<AdapterOutput[typeof type], 'type'> & {\n type: any\n } = {\n type,\n id: page.name,\n runtime: 'edge',\n pathname: isAppPrefix ? normalizeAppPath(page.name) : page.name,\n filePath: path.join(\n distDir,\n page.files.find(\n (item) =>\n item.startsWith('server/app') || item.startsWith('server/pages')\n ) ||\n // TODO: turbopack build doesn't name the main entry chunk\n // identifiably so we don't know which to mark here but\n // technically edge needs all chunks to load always so\n // should this field even be provided?\n page.files[0] ||\n ''\n ),\n assets: {},\n config:\n type === AdapterOutputType.MIDDLEWARE\n ? {\n matchers: page.matchers,\n }\n : {},\n }\n\n function handleFile(file: string) {\n const originalPath = path.join(distDir, file)\n const fileOutputPath = path.join(\n path.relative(tracingRoot, distDir),\n file\n )\n if (!output.assets) {\n output.assets = {}\n }\n output.assets[fileOutputPath] = originalPath\n }\n for (const file of page.files) {\n handleFile(file)\n }\n for (const item of [...(page.wasm || []), ...(page.assets || [])]) {\n handleFile(item.filePath)\n }\n\n if (type === AdapterOutputType.MIDDLEWARE) {\n outputs.middleware = output\n } else {\n currentOutputs.push(output)\n }\n }\n\n const edgeFunctionHandlers: Promise<any>[] = []\n\n for (const middleware of Object.values(middlewareManifest.middleware)) {\n if (isMiddlewareFilename(middleware.name)) {\n edgeFunctionHandlers.push(handleEdgeFunction(middleware, true))\n }\n }\n\n for (const page of Object.values(middlewareManifest.functions)) {\n edgeFunctionHandlers.push(handleEdgeFunction(page))\n }\n const pagesDistDir = path.join(distDir, 'server', 'pages')\n const pageOutputMap: Record<\n string,\n AdapterOutput['PAGES'] | AdapterOutput['PAGES_API']\n > = {}\n\n for (const page of pageKeys) {\n if (page === '/_app' || page === '/_document') {\n continue\n }\n\n if (middlewareManifest.functions.hasOwnProperty(page)) {\n continue\n }\n\n const route = normalizePagePath(page)\n const pageFile = path.join(\n pagesDistDir,\n `${normalizePagePath(page)}.js`\n )\n\n // if it's an auto static optimized page it's just\n // a static file\n if (staticPages.has(page)) {\n outputs.staticFiles.push({\n id: page,\n pathname: route,\n type: AdapterOutputType.STATIC_FILE,\n filePath: pageFile.replace(/\\.js$/, '.html'),\n } satisfies AdapterOutput['STATIC_FILE'])\n continue\n }\n\n const pageTraceFile = `${pageFile}.nft.json`\n const assets = await handleTraceFiles(pageTraceFile).catch((err) => {\n if (err.code !== 'ENOENT' || (page !== '/404' && page !== '/500')) {\n Log.warn(`Failed to locate traced assets for ${pageFile}`, err)\n }\n return {} as Record<string, string>\n })\n const functionConfig = functionsConfigManifest.functions[route] || {}\n\n const output: AdapterOutput['PAGES'] | AdapterOutput['PAGES_API'] = {\n id: route,\n type: page.startsWith('/api')\n ? AdapterOutputType.PAGES_API\n : AdapterOutputType.PAGES,\n filePath: pageTraceFile.replace(/\\.nft\\.json$/, ''),\n pathname: route,\n assets,\n runtime: 'nodejs',\n config: {\n maxDuration: functionConfig.maxDuration,\n preferredRegion: functionConfig.regions,\n },\n }\n pageOutputMap[page] = output\n\n if (output.type === AdapterOutputType.PAGES) {\n outputs.pages.push(output)\n } else {\n outputs.pagesApi.push(output)\n }\n }\n\n if (hasNodeMiddleware) {\n const middlewareFile = path.join(distDir, 'server', 'middleware.js')\n const middlewareTrace = `${middlewareFile}.nft.json`\n const assets = await handleTraceFiles(middlewareTrace)\n const functionConfig =\n functionsConfigManifest.functions['/_middleware'] || {}\n\n outputs.middleware = {\n pathname: '/_middleware',\n id: '/_middleware',\n assets,\n type: AdapterOutputType.MIDDLEWARE,\n runtime: 'nodejs',\n filePath: middlewareFile,\n config: {\n matchers: functionConfig.matchers,\n },\n } satisfies AdapterOutput['MIDDLEWARE']\n }\n const appOutputMap: Record<\n string,\n AdapterOutput['APP_PAGE'] | AdapterOutput['APP_ROUTE']\n > = {}\n const appDistDir = path.join(distDir, 'server', 'app')\n\n if (appPageKeys) {\n for (const page of appPageKeys) {\n if (middlewareManifest.functions.hasOwnProperty(page)) {\n continue\n }\n const normalizedPage = normalizeAppPath(page)\n const pageFile = path.join(appDistDir, `${page}.js`)\n const pageTraceFile = `${pageFile}.nft.json`\n const assets = await handleTraceFiles(pageTraceFile).catch((err) => {\n Log.warn(`Failed to copy traced files for ${pageFile}`, err)\n return {} as Record<string, string>\n })\n const functionConfig =\n functionsConfigManifest.functions[normalizedPage] || {}\n\n const output: AdapterOutput['APP_PAGE'] | AdapterOutput['APP_ROUTE'] =\n {\n pathname: normalizedPage,\n id: normalizedPage,\n assets,\n type: page.endsWith('/route')\n ? AdapterOutputType.APP_ROUTE\n : AdapterOutputType.APP_PAGE,\n runtime: 'nodejs',\n filePath: pageFile,\n config: {\n maxDuration: functionConfig.maxDuration,\n preferredRegion: functionConfig.regions,\n },\n }\n appOutputMap[normalizedPage] = output\n\n if (output.type === AdapterOutputType.APP_PAGE) {\n outputs.appPages.push(output)\n } else {\n outputs.appRoutes.push(output)\n }\n }\n }\n\n const getParentOutput = (\n srcRoute: string,\n childRoute: string,\n allowMissing?: boolean\n ) => {\n const parentOutput = pageOutputMap[srcRoute] || appOutputMap[srcRoute]\n\n if (!parentOutput && !allowMissing) {\n console.error({\n appOutputs: Object.keys(appOutputMap),\n pageOutputs: Object.keys(pageOutputMap),\n })\n throw new Error(\n `Invariant: failed to find source route ${srcRoute} for prerender ${childRoute}`\n )\n }\n return parentOutput\n }\n\n const {\n prefetchSegmentDirSuffix,\n prefetchSegmentSuffix,\n varyHeader,\n didPostponeHeader,\n contentTypeHeader: rscContentTypeHeader,\n } = routesManifest.rsc\n\n const handleAppMeta = async (\n route: string,\n initialOutput: AdapterOutput['PRERENDER'],\n meta: {\n postponed?: string\n segmentPaths?: string[]\n }\n ) => {\n if (meta.postponed && initialOutput.fallback) {\n initialOutput.fallback.postponedState = meta.postponed\n }\n\n if (meta?.segmentPaths) {\n const segmentsDir = path.join(\n appDistDir,\n `${route}${prefetchSegmentDirSuffix}`\n )\n\n for (const segmentPath of meta.segmentPaths) {\n const outputSegmentPath =\n path.join(\n appDistDir,\n route + prefetchSegmentDirSuffix,\n segmentPath\n ) + prefetchSegmentSuffix\n\n const fallbackPathname = path.join(\n segmentsDir,\n segmentPath + prefetchSegmentSuffix\n )\n\n outputs.prerenders.push({\n id: outputSegmentPath,\n pathname: outputSegmentPath,\n type: AdapterOutputType.PRERENDER,\n parentOutputId: initialOutput.parentOutputId,\n groupId: initialOutput.groupId,\n\n config: {\n ...initialOutput.config,\n },\n\n fallback: {\n filePath: fallbackPathname,\n initialExpiration: initialOutput.fallback?.initialExpiration,\n initialRevalidate: initialOutput.fallback?.initialRevalidate,\n\n initialHeaders: {\n ...initialOutput.fallback?.initialHeaders,\n vary: varyHeader,\n 'content-type': rscContentTypeHeader,\n [didPostponeHeader]: '2',\n },\n },\n } satisfies AdapterOutput['PRERENDER'])\n }\n }\n }\n\n let prerenderGroupId = 1\n\n type AppRouteMeta = {\n segmentPaths?: string[]\n postponed?: string\n headers?: Record<string, string>\n status?: number\n }\n\n const getAppRouteMeta = async (\n route: string,\n isAppPage: boolean\n ): Promise<AppRouteMeta> => {\n const meta: AppRouteMeta = isAppPage\n ? JSON.parse(\n await fs\n .readFile(path.join(appDistDir, `${route}.meta`), 'utf8')\n .catch(() => '{}')\n )\n : {}\n\n if (meta.headers) {\n // normalize these for consistency\n for (const key of Object.keys(meta.headers)) {\n const keyLower = key.toLowerCase()\n if (keyLower !== key) {\n const value = meta.headers[key]\n delete meta.headers[key]\n meta.headers[keyLower] = value\n }\n }\n }\n\n return meta\n }\n\n for (const route in prerenderManifest.routes) {\n const {\n initialExpireSeconds: initialExpiration,\n initialRevalidateSeconds: initialRevalidate,\n initialHeaders,\n initialStatus,\n prefetchDataRoute,\n dataRoute,\n renderingMode,\n allowHeader,\n experimentalBypassFor,\n } = prerenderManifest.routes[route]\n\n const srcRoute = prerenderManifest.routes[route].srcRoute || route\n const isAppPage =\n Boolean(appOutputMap[srcRoute]) || srcRoute === '/_not-found'\n\n const isNotFoundTrue = prerenderManifest.notFoundRoutes.includes(route)\n\n let allowQuery: string[] | undefined\n const routeKeys = routesManifest.dynamicRoutes.find(\n (item) => item.page === srcRoute\n )?.routeKeys\n\n if (!isDynamicRoute(srcRoute)) {\n // for non-dynamic routes we use an empty array since\n // no query values bust the cache for non-dynamic prerenders\n // prerendered paths also do not pass allowQuery as they match\n // during handle: 'filesystem' so should not cache differently\n // by query values\n allowQuery = []\n } else if (routeKeys) {\n // if we have routeKeys in the routes-manifest we use those\n // for allowQuery for dynamic routes\n allowQuery = Object.values(routeKeys)\n }\n\n let filePath = path.join(\n isAppPage ? appDistDir : pagesDistDir,\n `${route === '/' ? 'index' : route}.${isAppPage && !dataRoute ? 'body' : 'html'}`\n )\n\n // we use the static 404 for notFound: true if available\n // if not we do a blocking invoke on first request\n if (isNotFoundTrue && hasStatic404) {\n filePath = path.join(pagesDistDir, '404.html')\n }\n\n const meta = await getAppRouteMeta(route, isAppPage)\n\n const initialOutput: AdapterOutput['PRERENDER'] = {\n id: route,\n type: AdapterOutputType.PRERENDER,\n pathname: route,\n parentOutputId:\n srcRoute === '/_not-found'\n ? srcRoute\n : getParentOutput(srcRoute, route).id,\n groupId: prerenderGroupId,\n\n pprChain:\n isAppPage && config.experimental.ppr\n ? {\n headers: {\n [NEXT_RESUME_HEADER]: '1',\n },\n }\n : undefined,\n\n fallback:\n !isNotFoundTrue || (isNotFoundTrue && hasStatic404)\n ? {\n filePath,\n initialStatus,\n initialHeaders: {\n ...initialHeaders,\n vary: varyHeader,\n 'content-type': HTML_CONTENT_TYPE_HEADER,\n ...meta.headers,\n },\n initialExpiration,\n initialRevalidate: initialRevalidate || 1,\n }\n : undefined,\n config: {\n allowQuery,\n allowHeader,\n renderingMode,\n bypassFor: experimentalBypassFor,\n bypassToken: prerenderManifest.preview.previewModeId,\n },\n }\n outputs.prerenders.push(initialOutput)\n\n if (dataRoute) {\n let dataFilePath = path.join(\n pagesDistDir,\n `${route === '/' ? 'index' : route}.json`\n )\n\n if (isAppPage) {\n // When experimental PPR is enabled, we expect that the data\n // that should be served as a part of the prerender should\n // be from the prefetch data route. If this isn't enabled\n // for ppr, the only way to get the data is from the data\n // route.\n dataFilePath = path.join(\n appDistDir,\n prefetchDataRoute &&\n renderingMode === RenderingMode.PARTIALLY_STATIC\n ? prefetchDataRoute\n : dataRoute\n )\n }\n\n outputs.prerenders.push({\n ...initialOutput,\n id: dataRoute,\n pathname: dataRoute,\n fallback: isNotFoundTrue\n ? undefined\n : {\n ...initialOutput.fallback,\n initialHeaders: {\n ...initialOutput.fallback?.initialHeaders,\n 'content-type': isAppPage\n ? rscContentTypeHeader\n : JSON_CONTENT_TYPE_HEADER,\n },\n filePath: dataFilePath,\n },\n })\n }\n\n if (isAppPage) {\n await handleAppMeta(route, initialOutput, meta)\n }\n prerenderGroupId += 1\n }\n\n for (const dynamicRoute in prerenderManifest.dynamicRoutes) {\n const {\n fallback,\n fallbackExpire,\n fallbackRevalidate,\n fallbackHeaders,\n fallbackStatus,\n allowHeader,\n dataRoute,\n renderingMode,\n experimentalBypassFor,\n } = prerenderManifest.dynamicRoutes[dynamicRoute]\n\n const isAppPage = Boolean(appOutputMap[dynamicRoute])\n\n const allowQuery = Object.values(\n routesManifest.dynamicRoutes.find(\n (item) => item.page === dynamicRoute\n )?.routeKeys || {}\n )\n const meta = await getAppRouteMeta(dynamicRoute, isAppPage)\n\n const initialOutput: AdapterOutput['PRERENDER'] = {\n id: dynamicRoute,\n type: AdapterOutputType.PRERENDER,\n pathname: dynamicRoute,\n parentOutputId: getParentOutput(dynamicRoute, dynamicRoute).id,\n groupId: prerenderGroupId,\n config: {\n allowQuery,\n allowHeader,\n renderingMode,\n bypassFor: experimentalBypassFor,\n bypassToken: prerenderManifest.preview.previewModeId,\n },\n fallback:\n typeof fallback === 'string'\n ? {\n filePath: path.join(\n isAppPage ? appDistDir : pagesDistDir,\n // app router dynamic route fallbacks don't have the\n // extension so ensure it's added here\n fallback.endsWith('.html') ? fallback : `${fallback}.html`\n ),\n initialStatus: fallbackStatus,\n initialHeaders: {\n ...fallbackHeaders,\n 'content-type': HTML_CONTENT_TYPE_HEADER,\n },\n initialExpiration: fallbackExpire,\n initialRevalidate: fallbackRevalidate || 1,\n }\n : undefined,\n }\n outputs.prerenders.push(initialOutput)\n\n if (isAppPage) {\n await handleAppMeta(dynamicRoute, initialOutput, meta)\n }\n\n if (dataRoute) {\n outputs.prerenders.push({\n ...initialOutput,\n id: dataRoute,\n pathname: dataRoute,\n fallback: undefined,\n })\n }\n prerenderGroupId += 1\n }\n\n await adapterMod.onBuildComplete({\n routes: {\n dynamicRoutes: routesManifest.dynamicRoutes,\n rewrites: routesManifest.rewrites,\n redirects: routesManifest.redirects,\n headers: routesManifest.headers,\n },\n outputs,\n\n config,\n distDir,\n nextVersion,\n projectDir: dir,\n repoRoot: tracingRoot,\n })\n } catch (err) {\n Log.error(`Failed to run onBuildComplete from ${adapterMod.name}`)\n throw err\n }\n }\n}\n"],"names":["handleBuildComplete","dir","config","distDir","pageKeys","tracingRoot","adapterPath","appPageKeys","staticPages","nextVersion","hasStatic404","routesManifest","hasNodeMiddleware","prerenderManifest","middlewareManifest","requiredServerFiles","hasInstrumentationHook","functionsConfigManifest","adapterMod","interopDefault","pathToFileURL","require","resolve","href","onBuildComplete","Log","info","name","outputs","pages","pagesApi","appPages","appRoutes","prerenders","staticFiles","recursiveReadDir","path","join","file","pathname","posix","filePath","push","type","AdapterOutputType","STATIC_FILE","id","sharedNodeAssets","fileOutputPath","relative","assets","handleTraceFiles","Object","assign","traceFilePath","traceData","JSON","parse","fs","readFile","traceFileDir","dirname","relativeFile","files","tracedFilePath","handleEdgeFunction","page","isMiddleware","PAGES","isAppPrefix","startsWith","isAppPage","endsWith","isAppRoute","currentOutputs","MIDDLEWARE","APP_PAGE","APP_ROUTE","PAGES_API","output","runtime","normalizeAppPath","find","item","matchers","handleFile","originalPath","wasm","middleware","edgeFunctionHandlers","values","isMiddlewareFilename","functions","pagesDistDir","pageOutputMap","hasOwnProperty","route","normalizePagePath","pageFile","has","replace","pageTraceFile","catch","err","code","warn","functionConfig","maxDuration","preferredRegion","regions","middlewareFile","middlewareTrace","appOutputMap","appDistDir","normalizedPage","getParentOutput","srcRoute","childRoute","allowMissing","parentOutput","console","error","appOutputs","keys","pageOutputs","Error","prefetchSegmentDirSuffix","prefetchSegmentSuffix","varyHeader","didPostponeHeader","contentTypeHeader","rscContentTypeHeader","rsc","handleAppMeta","initialOutput","meta","postponed","fallback","postponedState","segmentPaths","segmentsDir","segmentPath","outputSegmentPath","fallbackPathname","PRERENDER","parentOutputId","groupId","initialExpiration","initialRevalidate","initialHeaders","vary","prerenderGroupId","getAppRouteMeta","headers","key","keyLower","toLowerCase","value","routes","initialExpireSeconds","initialRevalidateSeconds","initialStatus","prefetchDataRoute","dataRoute","renderingMode","allowHeader","experimentalBypassFor","Boolean","isNotFoundTrue","notFoundRoutes","includes","allowQuery","routeKeys","dynamicRoutes","isDynamicRoute","pprChain","experimental","ppr","NEXT_RESUME_HEADER","undefined","HTML_CONTENT_TYPE_HEADER","bypassFor","bypassToken","preview","previewModeId","dataFilePath","RenderingMode","PARTIALLY_STATIC","JSON_CONTENT_TYPE_HEADER","dynamicRoute","fallbackExpire","fallbackRevalidate","fallbackHeaders","fallbackStatus","rewrites","redirects","projectDir","repoRoot"],"mappings":";;;;+BA2SsBA;;;eAAAA;;;6DA3SL;iEACF;qBACe;6DACT;uBACgB;+BACP;gCACC;kCAEE;wBACF;0BAIE;2BACkB;mCACjB;4BAqB3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuQA,eAAeA,oBAAoB,EACxCC,GAAG,EACHC,MAAM,EACNC,OAAO,EACPC,QAAQ,EACRC,WAAW,EAC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AAU4H;wBACV1B,UAAU0C;oBACZ;gBACF;gBACA5B,oBAAoB;YACtB;YAEA,MAAMrI,WAAWM,eAAe,CAAC;gBAC/BsI,QAAQ;oBACNe,eAAelK,eAAekK,aAAa;oBAC3CqB,UAAUvL,eAAeuL,QAAQ;oBACjCC,WAAWxL,eAAewL,SAAS;oBACnC1C,SAAS9I,eAAe8I,OAAO;gBACjC;gBACA7H;gBAEA1B;gBACAC;gBACAM;gBACA2L,YAAYnM;gBACZoM,UAAUhM;YACZ;QACF,EAAE,OAAOkG,KAAK;YACZ9E,KAAIgG,KAAK,CAAC,CAAC,mCAAmC,EAAEvG,WAAWS,IAAI,EAAE;YACjE,MAAM4E;QACR;IACF;AACF","ignoreList":[0]}
1
+ {"version":3,"sources":["../../../src/build/adapter/build-complete.ts"],"sourcesContent":["import path from 'path'\nimport fs from 'fs/promises'\nimport { pathToFileURL } from 'url'\nimport * as Log from '../output/log'\nimport { isMiddlewareFilename } from '../utils'\nimport { RenderingMode } from '../rendering-mode'\nimport { interopDefault } from '../../lib/interop-default'\nimport type { RouteHas } from '../../lib/load-custom-routes'\nimport { recursiveReadDir } from '../../lib/recursive-readdir'\nimport { isDynamicRoute } from '../../shared/lib/router/utils'\nimport type { Revalidate } from '../../server/lib/cache-control'\nimport type { NextConfigComplete } from '../../server/config-shared'\nimport type { MiddlewareMatcher } from '../analysis/get-page-static-info'\nimport { normalizeAppPath } from '../../shared/lib/router/utils/app-paths'\nimport { AdapterOutputType, type PHASE_TYPE } from '../../shared/lib/constants'\nimport { normalizePagePath } from '../../shared/lib/page-path/normalize-page-path'\n\nimport type {\n MiddlewareManifest,\n EdgeFunctionDefinition,\n} from '../webpack/plugins/middleware-plugin'\n\nimport type {\n ManifestRoute,\n RoutesManifest,\n PrerenderManifest,\n ManifestHeaderRoute,\n ManifestRewriteRoute,\n ManifestRedirectRoute,\n FunctionsConfigManifest,\n} from '..'\n\nimport {\n HTML_CONTENT_TYPE_HEADER,\n JSON_CONTENT_TYPE_HEADER,\n NEXT_RESUME_HEADER,\n} from '../../lib/constants'\nimport { normalizeLocalePath } from '../../shared/lib/i18n/normalize-locale-path'\nimport { addPathPrefix } from '../../shared/lib/router/utils/add-path-prefix'\n\ninterface SharedRouteFields {\n /**\n * id is the unique identifier of the output\n */\n id: string\n /**\n * filePath is the location on disk of the built entrypoint asset\n */\n filePath: string\n /**\n * pathname is the URL pathname the asset should be served at\n */\n pathname: string\n /**\n * runtime is which runtime the entrypoint is built for\n */\n runtime: 'nodejs' | 'edge'\n /**\n * assets are all necessary traced assets that could be\n * loaded by the output to handle a request e.g. traced\n * node_modules or necessary manifests for Next.js.\n * The key is the relative path from the repo root and the value\n * is the absolute path to the file\n */\n assets: Record<string, string>\n\n /**\n * wasmAssets are bundled wasm files with mapping of name\n * to filePath on disk\n */\n wasmAssets?: Record<string, string>\n\n /**\n * config related to the route\n */\n config: {\n /**\n * maxDuration is a segment config to signal the max\n * execution duration a route should be allowed before\n * it's timed out\n */\n maxDuration?: number\n /**\n * preferredRegion is a segment config to signal deployment\n * region preferences to the provider being used\n */\n preferredRegion?: string | string[]\n\n /**\n * env is the environment variables to expose, this is only\n * populated for edge runtime currently\n */\n env?: Record<string, string>\n }\n}\n\nexport interface AdapterOutput {\n /**\n * `PAGES` represents all the React pages that are under `pages/`.\n */\n PAGES: SharedRouteFields & {\n type: AdapterOutputType.PAGES\n }\n\n /**\n * `PAGES_API` represents all the API routes under `pages/api/`.\n */\n PAGES_API: SharedRouteFields & {\n type: AdapterOutputType.PAGES_API\n }\n /**\n * `APP_PAGE` represents all the React pages that are under `app/` with the\n * filename of `page.{j,t}s{,x}`.\n */\n APP_PAGE: SharedRouteFields & {\n type: AdapterOutputType.APP_PAGE\n }\n\n /**\n * `APP_ROUTE` represents all the API routes and metadata routes that are under `app/` with the\n * filename of `route.{j,t}s{,x}`.\n */\n APP_ROUTE: SharedRouteFields & {\n type: AdapterOutputType.APP_ROUTE\n }\n\n /**\n * `PRERENDER` represents an ISR enabled route that might\n * have a seeded cache entry or fallback generated during build\n */\n PRERENDER: {\n id: string\n pathname: string\n type: AdapterOutputType.PRERENDER\n\n /**\n * For prerenders the parent output is the originating\n * page that the prerender is created from\n */\n parentOutputId: string\n\n /**\n * groupId is the identifier for a group of prerenders that should be\n * revalidated together\n */\n groupId: number\n\n pprChain?: {\n headers: Record<string, string>\n }\n\n /**\n * fallback is initial cache data generated during build for a prerender\n */\n fallback?: {\n /**\n * path to the fallback file can be HTML/JSON/RSC\n */\n filePath: string\n /**\n * initialStatus is the status code that should be applied\n * when serving the fallback\n */\n initialStatus?: number\n /**\n * initialHeaders are the headers that should be sent when\n * serving the fallback\n */\n initialHeaders?: Record<string, string | string[]>\n /**\n * initial expiration is how long until the fallback entry\n * is considered expired and no longer valid to serve\n */\n initialExpiration?: number\n /**\n * initial revalidate is how long until the fallback is\n * considered stale and should be revalidated\n */\n initialRevalidate?: Revalidate\n\n /**\n * postponedState is the PPR state when it postponed and is used for resuming\n */\n postponedState?: string\n }\n /**\n * config related to the route\n */\n config: {\n /**\n * allowQuery is the allowed query values to be passed\n * to an ISR function and what should be considered for the cacheKey\n * e.g. for /blog/[slug], \"slug\" is the only allowQuery\n */\n allowQuery?: string[]\n /**\n * allowHeader is the allowed headers to be passed to an\n * ISR function to prevent accidentally poisoning the cache\n * from leaking additional information that can impact the render\n */\n allowHeader?: string[]\n /**\n * bypass for is a list of has conditions the cache\n * should be bypassed and invoked directly e.g. action header\n */\n bypassFor?: RouteHas[]\n /**\n * renderingMode signals PPR or not for a prerender\n */\n renderingMode?: RenderingMode\n\n /**\n * matchers are the configured matchers for middleware\n */\n matchers?: MiddlewareMatcher[]\n\n /**\n * bypassToken is the generated token that signals a prerender cache\n * should be bypassed\n */\n bypassToken?: string\n }\n }\n\n /**\n * `STATIC_FILE` represents a static file (ie /_next/static) or a purely\n * static HTML asset e.g. an automatically statically optimized page\n * that does not use ISR\n */\n STATIC_FILE: {\n id: string\n filePath: string\n pathname: string\n type: AdapterOutputType.STATIC_FILE\n }\n\n /**\n * `MIDDLEWARE` represents the middleware output if present\n */\n MIDDLEWARE: SharedRouteFields & {\n type: AdapterOutputType.MIDDLEWARE\n /**\n * config related to the route\n */\n config: SharedRouteFields['config'] & {\n /**\n * matchers are the configured matchers for middleware\n */\n matchers?: MiddlewareMatcher[]\n }\n }\n}\n\nexport interface AdapterOutputs {\n pages: Array<AdapterOutput['PAGES']>\n middleware?: AdapterOutput['MIDDLEWARE']\n appPages: Array<AdapterOutput['APP_PAGE']>\n pagesApi: Array<AdapterOutput['PAGES_API']>\n appRoutes: Array<AdapterOutput['APP_ROUTE']>\n prerenders: Array<AdapterOutput['PRERENDER']>\n staticFiles: Array<AdapterOutput['STATIC_FILE']>\n}\n\nexport interface NextAdapter {\n name: string\n /**\n * modifyConfig is called for any CLI command that loads the next.config\n * to only apply for specific commands the \"phase\" should be used\n * @param config\n * @param ctx\n * @returns\n */\n modifyConfig?: (\n config: NextConfigComplete,\n ctx: {\n phase: PHASE_TYPE\n }\n ) => Promise<NextConfigComplete> | NextConfigComplete\n onBuildComplete?: (ctx: {\n routes: {\n headers: Array<ManifestHeaderRoute>\n redirects: Array<ManifestRedirectRoute>\n rewrites: {\n beforeFiles: Array<ManifestRewriteRoute>\n afterFiles: Array<ManifestRewriteRoute>\n fallback: Array<ManifestRewriteRoute>\n }\n dynamicRoutes: ReadonlyArray<ManifestRoute>\n }\n outputs: AdapterOutputs\n /**\n * projectDir is the absolute directory the Next.js application is in\n */\n projectDir: string\n /**\n * repoRoot is the absolute path of the detected root of the repo\n */\n repoRoot: string\n /**\n * distDir is the absolute path to the dist directory\n */\n distDir: string\n /**\n * config is the loaded next.config (has modifyConfig applied)\n */\n config: NextConfigComplete\n /**\n * nextVersion is the current version of Next.js being used\n */\n nextVersion: string\n }) => Promise<void> | void\n}\n\nfunction normalizePathnames(\n config: NextConfigComplete,\n outputs: AdapterOutputs\n) {\n // normalize pathname field with basePath\n if (config.basePath) {\n for (const output of [\n ...outputs.pages,\n ...outputs.pagesApi,\n ...outputs.appPages,\n ...outputs.appRoutes,\n ...outputs.prerenders,\n ...outputs.staticFiles,\n ...(outputs.middleware ? [outputs.middleware] : []),\n ]) {\n output.pathname = addPathPrefix(output.pathname, config.basePath)\n }\n }\n}\n\nexport async function handleBuildComplete({\n dir,\n config,\n configOutDir,\n distDir,\n pageKeys,\n tracingRoot,\n adapterPath,\n appPageKeys,\n staticPages,\n nextVersion,\n hasStatic404,\n routesManifest,\n hasNodeMiddleware,\n prerenderManifest,\n middlewareManifest,\n requiredServerFiles,\n hasInstrumentationHook,\n functionsConfigManifest,\n}: {\n dir: string\n distDir: string\n configOutDir: string\n adapterPath: string\n tracingRoot: string\n nextVersion: string\n hasStatic404: boolean\n staticPages: Set<string>\n hasNodeMiddleware: boolean\n config: NextConfigComplete\n pageKeys: readonly string[]\n requiredServerFiles: string[]\n routesManifest: RoutesManifest\n hasInstrumentationHook: boolean\n prerenderManifest: PrerenderManifest\n middlewareManifest: MiddlewareManifest\n appPageKeys?: readonly string[] | undefined\n functionsConfigManifest: FunctionsConfigManifest\n}) {\n const adapterMod = interopDefault(\n await import(pathToFileURL(require.resolve(adapterPath)).href)\n ) as NextAdapter\n\n if (typeof adapterMod.onBuildComplete === 'function') {\n Log.info(`Running onBuildComplete from ${adapterMod.name}`)\n\n const outputs: AdapterOutputs = {\n pages: [],\n pagesApi: [],\n appPages: [],\n appRoutes: [],\n prerenders: [],\n staticFiles: [],\n }\n\n if (config.output === 'export') {\n // collect export assets and provide as static files\n const exportFiles = await recursiveReadDir(configOutDir)\n\n for (const file of exportFiles) {\n let pathname = (\n file.endsWith('.html') ? file.replace(/\\.html$/, '') : file\n ).replace(/\\\\/g, '/')\n\n pathname = pathname.startsWith('/') ? pathname : `/${pathname}`\n\n outputs.staticFiles.push({\n id: file,\n pathname,\n filePath: path.join(configOutDir, file),\n type: AdapterOutputType.STATIC_FILE,\n } satisfies AdapterOutput['STATIC_FILE'])\n }\n } else {\n const staticFiles = await recursiveReadDir(path.join(distDir, 'static'))\n\n for (const file of staticFiles) {\n const pathname = path.posix.join('/_next/static', file)\n const filePath = path.join(distDir, 'static', file)\n outputs.staticFiles.push({\n type: AdapterOutputType.STATIC_FILE,\n id: path.join('static', file),\n pathname,\n filePath,\n })\n }\n\n const sharedNodeAssets: Record<string, string> = {}\n\n for (const file of requiredServerFiles) {\n // add to shared node assets\n const filePath = path.join(dir, file)\n const fileOutputPath = path.relative(tracingRoot, filePath)\n sharedNodeAssets[fileOutputPath] = filePath\n }\n\n if (hasInstrumentationHook) {\n const assets = await handleTraceFiles(\n path.join(distDir, 'server', 'instrumentation.js.nft.json')\n )\n const fileOutputPath = path.relative(\n tracingRoot,\n path.join(distDir, 'server', 'instrumentation.js')\n )\n sharedNodeAssets[fileOutputPath] = path.join(\n distDir,\n 'server',\n 'instrumentation.js'\n )\n Object.assign(sharedNodeAssets, assets)\n }\n\n async function handleTraceFiles(\n traceFilePath: string\n ): Promise<Record<string, string>> {\n const assets: Record<string, string> = Object.assign(\n {},\n sharedNodeAssets\n )\n const traceData = JSON.parse(\n await fs.readFile(traceFilePath, 'utf8')\n ) as {\n files: string[]\n }\n const traceFileDir = path.dirname(traceFilePath)\n\n for (const relativeFile of traceData.files) {\n const tracedFilePath = path.join(traceFileDir, relativeFile)\n const fileOutputPath = path.relative(tracingRoot, tracedFilePath)\n assets[fileOutputPath] = tracedFilePath\n }\n return assets\n }\n\n async function handleEdgeFunction(\n page: EdgeFunctionDefinition,\n isMiddleware: boolean = false\n ) {\n let type: AdapterOutputType = AdapterOutputType.PAGES\n const isAppPrefix = page.page.startsWith('app/')\n const isAppPage = isAppPrefix && page.page.endsWith('/page')\n const isAppRoute = isAppPrefix && page.page.endsWith('/route')\n let currentOutputs: Array<\n | AdapterOutput['PAGES']\n | AdapterOutput['PAGES_API']\n | AdapterOutput['APP_PAGE']\n | AdapterOutput['APP_ROUTE']\n > = outputs.pages\n\n if (isMiddleware) {\n type = AdapterOutputType.MIDDLEWARE\n } else if (isAppPage) {\n currentOutputs = outputs.appPages\n type = AdapterOutputType.APP_PAGE\n } else if (isAppRoute) {\n currentOutputs = outputs.appRoutes\n type = AdapterOutputType.APP_ROUTE\n } else if (page.page.startsWith('/api')) {\n currentOutputs = outputs.pagesApi\n type = AdapterOutputType.PAGES_API\n }\n\n const output: Omit<AdapterOutput[typeof type], 'type'> & {\n type: any\n } = {\n type,\n id: page.name,\n runtime: 'edge',\n pathname: isAppPrefix ? normalizeAppPath(page.name) : page.name,\n filePath: path.join(\n distDir,\n page.files.find(\n (item) =>\n item.startsWith('server/app') || item.startsWith('server/pages')\n ) ||\n // TODO: turbopack build doesn't name the main entry chunk\n // identifiably so we don't know which to mark here but\n // technically edge needs all chunks to load always so\n // should this field even be provided?\n page.files[0] ||\n ''\n ),\n assets: {},\n wasmAssets: {},\n config: {\n ...(type === AdapterOutputType.MIDDLEWARE\n ? {\n matchers: page.matchers,\n }\n : {}),\n env: page.env,\n },\n }\n\n function handleFile(file: string) {\n const originalPath = path.join(distDir, file)\n const fileOutputPath = path.join(\n path.relative(tracingRoot, distDir),\n file\n )\n if (!output.assets) {\n output.assets = {}\n }\n output.assets[fileOutputPath] = originalPath\n }\n for (const file of page.files) {\n handleFile(file)\n }\n for (const item of [...(page.assets || [])]) {\n handleFile(item.filePath)\n }\n for (const item of page.wasm || []) {\n if (!output.wasmAssets) {\n output.wasmAssets = {}\n }\n output.wasmAssets[item.name] = item.filePath\n }\n\n if (type === AdapterOutputType.MIDDLEWARE) {\n outputs.middleware = output\n } else {\n currentOutputs.push(output)\n }\n }\n\n const edgeFunctionHandlers: Promise<any>[] = []\n\n for (const middleware of Object.values(middlewareManifest.middleware)) {\n if (isMiddlewareFilename(middleware.name)) {\n edgeFunctionHandlers.push(handleEdgeFunction(middleware, true))\n }\n }\n\n for (const page of Object.values(middlewareManifest.functions)) {\n edgeFunctionHandlers.push(handleEdgeFunction(page))\n }\n const pagesDistDir = path.join(distDir, 'server', 'pages')\n const pageOutputMap: Record<\n string,\n AdapterOutput['PAGES'] | AdapterOutput['PAGES_API']\n > = {}\n\n for (const page of pageKeys) {\n if (page === '/_app' || page === '/_document') {\n continue\n }\n\n if (middlewareManifest.functions.hasOwnProperty(page)) {\n continue\n }\n\n const route = normalizePagePath(page)\n const pageFile = path.join(\n pagesDistDir,\n `${normalizePagePath(page)}.js`\n )\n\n // if it's an auto static optimized page it's just\n // a static file\n if (staticPages.has(page)) {\n if (config.i18n) {\n for (const locale of config.i18n.locales || []) {\n const localePage =\n page === '/' ? `/${locale}` : addPathPrefix(page, `/${locale}`)\n outputs.staticFiles.push({\n id: localePage,\n pathname: localePage,\n type: AdapterOutputType.STATIC_FILE,\n filePath: path.join(\n pagesDistDir,\n `${normalizePagePath(localePage)}.html`\n ),\n } satisfies AdapterOutput['STATIC_FILE'])\n }\n } else {\n outputs.staticFiles.push({\n id: page,\n pathname: route,\n type: AdapterOutputType.STATIC_FILE,\n filePath: pageFile.replace(/\\.js$/, '.html'),\n } satisfies AdapterOutput['STATIC_FILE'])\n }\n continue\n }\n\n const pageTraceFile = `${pageFile}.nft.json`\n const assets = await handleTraceFiles(pageTraceFile).catch((err) => {\n if (err.code !== 'ENOENT' || (page !== '/404' && page !== '/500')) {\n Log.warn(`Failed to locate traced assets for ${pageFile}`, err)\n }\n return {} as Record<string, string>\n })\n const functionConfig = functionsConfigManifest.functions[route] || {}\n\n const output: AdapterOutput['PAGES'] | AdapterOutput['PAGES_API'] = {\n id: route,\n type: page.startsWith('/api')\n ? AdapterOutputType.PAGES_API\n : AdapterOutputType.PAGES,\n filePath: pageTraceFile.replace(/\\.nft\\.json$/, ''),\n pathname: route,\n assets,\n runtime: 'nodejs',\n config: {\n maxDuration: functionConfig.maxDuration,\n preferredRegion: functionConfig.regions,\n },\n }\n pageOutputMap[page] = output\n\n if (output.type === AdapterOutputType.PAGES) {\n outputs.pages.push(output)\n } else {\n outputs.pagesApi.push(output)\n }\n }\n\n if (hasNodeMiddleware) {\n const middlewareFile = path.join(distDir, 'server', 'middleware.js')\n const middlewareTrace = `${middlewareFile}.nft.json`\n const assets = await handleTraceFiles(middlewareTrace)\n const functionConfig =\n functionsConfigManifest.functions['/_middleware'] || {}\n\n outputs.middleware = {\n pathname: '/_middleware',\n id: '/_middleware',\n assets,\n type: AdapterOutputType.MIDDLEWARE,\n runtime: 'nodejs',\n filePath: middlewareFile,\n config: {\n matchers: functionConfig.matchers,\n },\n } satisfies AdapterOutput['MIDDLEWARE']\n }\n const appOutputMap: Record<\n string,\n AdapterOutput['APP_PAGE'] | AdapterOutput['APP_ROUTE']\n > = {}\n const appDistDir = path.join(distDir, 'server', 'app')\n\n if (appPageKeys) {\n for (const page of appPageKeys) {\n if (middlewareManifest.functions.hasOwnProperty(page)) {\n continue\n }\n const normalizedPage = normalizeAppPath(page)\n const pageFile = path.join(appDistDir, `${page}.js`)\n const pageTraceFile = `${pageFile}.nft.json`\n const assets = await handleTraceFiles(pageTraceFile).catch((err) => {\n Log.warn(`Failed to copy traced files for ${pageFile}`, err)\n return {} as Record<string, string>\n })\n const functionConfig =\n functionsConfigManifest.functions[normalizedPage] || {}\n\n const output: AdapterOutput['APP_PAGE'] | AdapterOutput['APP_ROUTE'] =\n {\n pathname: normalizedPage,\n id: normalizedPage,\n assets,\n type: page.endsWith('/route')\n ? AdapterOutputType.APP_ROUTE\n : AdapterOutputType.APP_PAGE,\n runtime: 'nodejs',\n filePath: pageFile,\n config: {\n maxDuration: functionConfig.maxDuration,\n preferredRegion: functionConfig.regions,\n },\n }\n appOutputMap[normalizedPage] = output\n\n if (output.type === AdapterOutputType.APP_PAGE) {\n outputs.appPages.push(output)\n } else {\n outputs.appRoutes.push(output)\n }\n }\n }\n\n const getParentOutput = (\n srcRoute: string,\n childRoute: string,\n allowMissing?: boolean\n ) => {\n const normalizedSrcRoute = normalizeLocalePath(\n srcRoute,\n config.i18n?.locales || []\n ).pathname\n const parentOutput =\n pageOutputMap[normalizedSrcRoute] || appOutputMap[normalizedSrcRoute]\n\n if (!parentOutput && !allowMissing) {\n console.error({\n appOutputs: Object.keys(appOutputMap),\n pageOutputs: Object.keys(pageOutputMap),\n })\n throw new Error(\n `Invariant: failed to find source route ${srcRoute} for prerender ${childRoute}`\n )\n }\n return parentOutput\n }\n\n const {\n prefetchSegmentDirSuffix,\n prefetchSegmentSuffix,\n varyHeader,\n didPostponeHeader,\n contentTypeHeader: rscContentTypeHeader,\n } = routesManifest.rsc\n\n const handleAppMeta = async (\n route: string,\n initialOutput: AdapterOutput['PRERENDER'],\n meta: {\n postponed?: string\n segmentPaths?: string[]\n }\n ) => {\n if (meta.postponed && initialOutput.fallback) {\n initialOutput.fallback.postponedState = meta.postponed\n }\n\n if (meta?.segmentPaths) {\n const segmentsDir = path.join(\n appDistDir,\n `${route}${prefetchSegmentDirSuffix}`\n )\n\n for (const segmentPath of meta.segmentPaths) {\n const outputSegmentPath =\n path.join(\n appDistDir,\n route + prefetchSegmentDirSuffix,\n segmentPath\n ) + prefetchSegmentSuffix\n\n const fallbackPathname = path.join(\n segmentsDir,\n segmentPath + prefetchSegmentSuffix\n )\n\n outputs.prerenders.push({\n id: outputSegmentPath,\n pathname: outputSegmentPath,\n type: AdapterOutputType.PRERENDER,\n parentOutputId: initialOutput.parentOutputId,\n groupId: initialOutput.groupId,\n\n config: {\n ...initialOutput.config,\n },\n\n fallback: {\n filePath: fallbackPathname,\n initialExpiration: initialOutput.fallback?.initialExpiration,\n initialRevalidate: initialOutput.fallback?.initialRevalidate,\n\n initialHeaders: {\n ...initialOutput.fallback?.initialHeaders,\n vary: varyHeader,\n 'content-type': rscContentTypeHeader,\n [didPostponeHeader]: '2',\n },\n },\n } satisfies AdapterOutput['PRERENDER'])\n }\n }\n }\n\n let prerenderGroupId = 1\n\n type AppRouteMeta = {\n segmentPaths?: string[]\n postponed?: string\n headers?: Record<string, string>\n status?: number\n }\n\n const getAppRouteMeta = async (\n route: string,\n isAppPage: boolean\n ): Promise<AppRouteMeta> => {\n const meta: AppRouteMeta = isAppPage\n ? JSON.parse(\n await fs\n .readFile(path.join(appDistDir, `${route}.meta`), 'utf8')\n .catch(() => '{}')\n )\n : {}\n\n if (meta.headers) {\n // normalize these for consistency\n for (const key of Object.keys(meta.headers)) {\n const keyLower = key.toLowerCase()\n if (keyLower !== key) {\n const value = meta.headers[key]\n delete meta.headers[key]\n meta.headers[keyLower] = value\n }\n }\n }\n\n return meta\n }\n\n for (const route in prerenderManifest.routes) {\n const {\n initialExpireSeconds: initialExpiration,\n initialRevalidateSeconds: initialRevalidate,\n initialHeaders,\n initialStatus,\n prefetchDataRoute,\n dataRoute,\n renderingMode,\n allowHeader,\n experimentalBypassFor,\n } = prerenderManifest.routes[route]\n\n const srcRoute = prerenderManifest.routes[route].srcRoute || route\n const isAppPage =\n Boolean(appOutputMap[srcRoute]) || srcRoute === '/_not-found'\n\n const isNotFoundTrue = prerenderManifest.notFoundRoutes.includes(route)\n\n let allowQuery: string[] | undefined\n const routeKeys = routesManifest.dynamicRoutes.find(\n (item) => item.page === srcRoute\n )?.routeKeys\n\n if (!isDynamicRoute(srcRoute)) {\n // for non-dynamic routes we use an empty array since\n // no query values bust the cache for non-dynamic prerenders\n // prerendered paths also do not pass allowQuery as they match\n // during handle: 'filesystem' so should not cache differently\n // by query values\n allowQuery = []\n } else if (routeKeys) {\n // if we have routeKeys in the routes-manifest we use those\n // for allowQuery for dynamic routes\n allowQuery = Object.values(routeKeys)\n }\n\n let filePath = path.join(\n isAppPage ? appDistDir : pagesDistDir,\n `${route === '/' ? 'index' : route}.${isAppPage && !dataRoute ? 'body' : 'html'}`\n )\n\n // we use the static 404 for notFound: true if available\n // if not we do a blocking invoke on first request\n if (isNotFoundTrue && hasStatic404) {\n filePath = path.join(pagesDistDir, '404.html')\n }\n\n const meta = await getAppRouteMeta(route, isAppPage)\n\n const initialOutput: AdapterOutput['PRERENDER'] = {\n id: route,\n type: AdapterOutputType.PRERENDER,\n pathname: route,\n parentOutputId:\n srcRoute === '/_not-found'\n ? srcRoute\n : getParentOutput(srcRoute, route).id,\n groupId: prerenderGroupId,\n\n pprChain:\n isAppPage && config.experimental.ppr\n ? {\n headers: {\n [NEXT_RESUME_HEADER]: '1',\n },\n }\n : undefined,\n\n fallback:\n !isNotFoundTrue || (isNotFoundTrue && hasStatic404)\n ? {\n filePath,\n initialStatus,\n initialHeaders: {\n ...initialHeaders,\n vary: varyHeader,\n 'content-type': HTML_CONTENT_TYPE_HEADER,\n ...meta.headers,\n },\n initialExpiration,\n initialRevalidate: initialRevalidate || 1,\n }\n : undefined,\n config: {\n allowQuery,\n allowHeader,\n renderingMode,\n bypassFor: experimentalBypassFor,\n bypassToken: prerenderManifest.preview.previewModeId,\n },\n }\n outputs.prerenders.push(initialOutput)\n\n if (dataRoute) {\n let dataFilePath = path.join(\n pagesDistDir,\n `${route === '/' ? 'index' : route}.json`\n )\n\n if (isAppPage) {\n // When experimental PPR is enabled, we expect that the data\n // that should be served as a part of the prerender should\n // be from the prefetch data route. If this isn't enabled\n // for ppr, the only way to get the data is from the data\n // route.\n dataFilePath = path.join(\n appDistDir,\n prefetchDataRoute &&\n renderingMode === RenderingMode.PARTIALLY_STATIC\n ? prefetchDataRoute\n : dataRoute\n )\n }\n\n outputs.prerenders.push({\n ...initialOutput,\n id: dataRoute,\n pathname: dataRoute,\n fallback: isNotFoundTrue\n ? undefined\n : {\n ...initialOutput.fallback,\n initialHeaders: {\n ...initialOutput.fallback?.initialHeaders,\n 'content-type': isAppPage\n ? rscContentTypeHeader\n : JSON_CONTENT_TYPE_HEADER,\n },\n filePath: dataFilePath,\n },\n })\n }\n\n if (isAppPage) {\n await handleAppMeta(route, initialOutput, meta)\n }\n prerenderGroupId += 1\n }\n\n for (const dynamicRoute in prerenderManifest.dynamicRoutes) {\n const {\n fallback,\n fallbackExpire,\n fallbackRevalidate,\n fallbackHeaders,\n fallbackStatus,\n allowHeader,\n dataRoute,\n renderingMode,\n experimentalBypassFor,\n } = prerenderManifest.dynamicRoutes[dynamicRoute]\n\n const isAppPage = Boolean(appOutputMap[dynamicRoute])\n\n const allowQuery = Object.values(\n routesManifest.dynamicRoutes.find(\n (item) => item.page === dynamicRoute\n )?.routeKeys || {}\n )\n const meta = await getAppRouteMeta(dynamicRoute, isAppPage)\n\n const initialOutput: AdapterOutput['PRERENDER'] = {\n id: dynamicRoute,\n type: AdapterOutputType.PRERENDER,\n pathname: dynamicRoute,\n parentOutputId: getParentOutput(dynamicRoute, dynamicRoute).id,\n groupId: prerenderGroupId,\n config: {\n allowQuery,\n allowHeader,\n renderingMode,\n bypassFor: experimentalBypassFor,\n bypassToken: prerenderManifest.preview.previewModeId,\n },\n fallback:\n typeof fallback === 'string'\n ? {\n filePath: path.join(\n isAppPage ? appDistDir : pagesDistDir,\n // app router dynamic route fallbacks don't have the\n // extension so ensure it's added here\n fallback.endsWith('.html') ? fallback : `${fallback}.html`\n ),\n initialStatus: fallbackStatus,\n initialHeaders: {\n ...fallbackHeaders,\n 'content-type': HTML_CONTENT_TYPE_HEADER,\n },\n initialExpiration: fallbackExpire,\n initialRevalidate: fallbackRevalidate || 1,\n }\n : undefined,\n }\n outputs.prerenders.push(initialOutput)\n\n if (isAppPage) {\n await handleAppMeta(dynamicRoute, initialOutput, meta)\n }\n\n if (dataRoute) {\n outputs.prerenders.push({\n ...initialOutput,\n id: dataRoute,\n pathname: dataRoute,\n fallback: undefined,\n })\n }\n prerenderGroupId += 1\n }\n }\n\n normalizePathnames(config, outputs)\n\n try {\n await adapterMod.onBuildComplete({\n routes: {\n dynamicRoutes: routesManifest.dynamicRoutes,\n rewrites: routesManifest.rewrites,\n redirects: routesManifest.redirects,\n headers: routesManifest.headers,\n },\n outputs,\n\n config,\n distDir,\n nextVersion,\n projectDir: dir,\n repoRoot: tracingRoot,\n })\n } catch (err) {\n Log.error(`Failed to run onBuildComplete from ${adapterMod.name}`)\n throw err\n }\n }\n}\n"],"names":["handleBuildComplete","normalizePathnames","config","outputs","basePath","output","pages","pagesApi","appPages","appRoutes","prerenders","staticFiles","middleware","pathname","addPathPrefix","dir","configOutDir","distDir","pageKeys","tracingRoot","adapterPath","appPageKeys","staticPages","nextVersion","hasStatic404","routesManifest","hasNodeMiddleware","prerenderManifest","middlewareManifest","requiredServerFiles","hasInstrumentationHook","functionsConfigManifest","adapterMod","interopDefault","pathToFileURL","require","resolve","href","onBuildComplete","Log","info","name","exportFiles","recursiveReadDir","file","endsWith","replace","startsWith","push","id","filePath","path","join","type","AdapterOutputType","STATIC_FILE","posix","sharedNodeAssets","fileOutputPath","relative","assets","handleTraceFiles","Object","assign","traceFilePath","traceData","JSON","parse","fs","readFile","traceFileDir","dirname","relativeFile","files","tracedFilePath","handleEdgeFunction","page","isMiddleware","PAGES","isAppPrefix","isAppPage","isAppRoute","currentOutputs","MIDDLEWARE","APP_PAGE","APP_ROUTE","PAGES_API","runtime","normalizeAppPath","find","item","wasmAssets","matchers","env","handleFile","originalPath","wasm","edgeFunctionHandlers","values","isMiddlewareFilename","functions","pagesDistDir","pageOutputMap","hasOwnProperty","route","normalizePagePath","pageFile","has","i18n","locale","locales","localePage","pageTraceFile","catch","err","code","warn","functionConfig","maxDuration","preferredRegion","regions","middlewareFile","middlewareTrace","appOutputMap","appDistDir","normalizedPage","getParentOutput","srcRoute","childRoute","allowMissing","normalizedSrcRoute","normalizeLocalePath","parentOutput","console","error","appOutputs","keys","pageOutputs","Error","prefetchSegmentDirSuffix","prefetchSegmentSuffix","varyHeader","didPostponeHeader","contentTypeHeader","rscContentTypeHeader","rsc","handleAppMeta","initialOutput","meta","postponed","fallback","postponedState","segmentPaths","segmentsDir","segmentPath","outputSegmentPath","fallbackPathname","PRERENDER","parentOutputId","groupId","initialExpiration","initialRevalidate","initialHeaders","vary","prerenderGroupId","getAppRouteMeta","headers","key","keyLower","toLowerCase","value","routes","initialExpireSeconds","initialRevalidateSeconds","initialStatus","prefetchDataRoute","dataRoute","renderingMode","allowHeader","experimentalBypassFor","Boolean","isNotFoundTrue","notFoundRoutes","includes","allowQuery","routeKeys","dynamicRoutes","isDynamicRoute","pprChain","experimental","ppr","NEXT_RESUME_HEADER","undefined","HTML_CONTENT_TYPE_HEADER","bypassFor","bypassToken","preview","previewModeId","dataFilePath","RenderingMode","PARTIALLY_STATIC","JSON_CONTENT_TYPE_HEADER","dynamicRoute","fallbackExpire","fallbackRevalidate","fallbackHeaders","fallbackStatus","rewrites","redirects","projectDir","repoRoot"],"mappings":";;;;+BA6UsBA;;;eAAAA;;;6DA7UL;iEACF;qBACe;6DACT;uBACgB;+BACP;gCACC;kCAEE;wBACF;0BAIE;2BACkB;mCACjB;4BAqB3B;qCAC6B;+BACN;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmR9B,SAASC,mBACPC,MAA0B,EAC1BC,OAAuB;IAEvB,yCAAyC;IACzC,IAAID,OAAOE,QAAQ,EAAE;QACnB,KAAK,MAAMC,UAAU;eAChBF,QAAQG,KAAK;eACbH,QAAQI,QAAQ;eAChBJ,QAAQK,QAAQ;eAChBL,QAAQM,SAAS;eACjBN,QAAQO,UAAU;eAClBP,QAAQQ,WAAW;eAClBR,QAAQS,UAAU,GAAG;gBAACT,QAAQS,UAAU;aAAC,GAAG,EAAE;SACnD,CAAE;YACDP,OAAOQ,QAAQ,GAAGC,IAAAA,4BAAa,EAACT,OAAOQ,QAAQ,EAAEX,OAAOE,QAAQ;QAClE;IACF;AACF;AAEO,eAAeJ,oBAAoB,EACxCe,GAAG,EACHb,MAAM,EACNc,YAAY,EACZC,OAAO,EACPC,QAAQ,EACRC,WAAW,EACXC,WAAW,EACXC,WAAW,EACXC,WAAW,EACXC,WAAW,EACXC,YAAY,EACZC,cAAc,EACdC,iBAAiB,EACjBC,iBAAiB,EACjBC,kBAAkB,EAClBC,mBAAmB,EACnBC,sBAAsB,EACtBC,uBAAuB,EAoBxB;IACC,MAAMC,aAAaC,IAAAA,8BAAc,EAC/B,MAAM,MAAM,CAACC,IAAAA,kBAAa,EAACC,QAAQC,OAAO,CAAChB,cAAciB,IAA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,mBAAmBC,QAAQC;QAE3B,IAAI;YACF,MAAM6B,WAAWM,eAAe,CAAC;gBAC/BqI,QAAQ;oBACNe,eAAejK,eAAeiK,aAAa;oBAC3CqB,UAAUtL,eAAesL,QAAQ;oBACjCC,WAAWvL,eAAeuL,SAAS;oBACnC1C,SAAS7I,eAAe6I,OAAO;gBACjC;gBACAnK;gBAEAD;gBACAe;gBACAM;gBACA0L,YAAYlM;gBACZmM,UAAU/L;YACZ;QACF,EAAE,OAAO+F,KAAK;YACZ3E,KAAI+F,KAAK,CAAC,CAAC,mCAAmC,EAAEtG,WAAWS,IAAI,EAAE;YACjE,MAAMyE;QACR;IACF;AACF","ignoreList":[0]}
@@ -371,7 +371,7 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
371
371
  try {
372
372
  const nextBuildSpan = (0, _trace.trace)('next-build', undefined, {
373
373
  buildMode: experimentalBuildMode,
374
- version: "15.6.0-canary.50"
374
+ version: "15.6.0-canary.52"
375
375
  });
376
376
  _buildcontext.NextBuildContext.nextBuildSpan = nextBuildSpan;
377
377
  _buildcontext.NextBuildContext.dir = dir;
@@ -441,6 +441,29 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
441
441
  _buildcontext.NextBuildContext.hasRewrites = hasRewrites;
442
442
  _buildcontext.NextBuildContext.originalRewrites = config._originalRewrites;
443
443
  _buildcontext.NextBuildContext.originalRedirects = config._originalRedirects;
444
+ const distDirCreated = await nextBuildSpan.traceChild('create-dist-dir').traceAsyncFn(async ()=>{
445
+ try {
446
+ await _fs.promises.mkdir(distDir, {
447
+ recursive: true
448
+ });
449
+ return true;
450
+ } catch (err) {
451
+ if ((0, _iserror.default)(err) && err.code === 'EPERM') {
452
+ return false;
453
+ }
454
+ throw err;
455
+ }
456
+ });
457
+ if (!distDirCreated || !await (0, _iswriteable.isWriteable)(distDir)) {
458
+ throw Object.defineProperty(new Error('> Build directory is not writeable. https://nextjs.org/docs/messages/build-dir-not-writeable'), "__NEXT_ERROR_CODE", {
459
+ value: "E202",
460
+ enumerable: false,
461
+ configurable: true
462
+ });
463
+ }
464
+ if (config.cleanDistDir && !isGenerateMode) {
465
+ await nextBuildSpan.traceChild('clean').traceAsyncFn(()=>(0, _recursivedelete.recursiveDeleteSyncWithAsyncRetries)(distDir, /^(cache|dev)/));
466
+ }
444
467
  const cacheDir = getCacheDir(distDir);
445
468
  const telemetry = new _storage.Telemetry({
446
469
  distDir
@@ -507,29 +530,6 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
507
530
  config,
508
531
  cacheDir
509
532
  };
510
- const distDirCreated = await nextBuildSpan.traceChild('create-dist-dir').traceAsyncFn(async ()=>{
511
- try {
512
- await _fs.promises.mkdir(distDir, {
513
- recursive: true
514
- });
515
- return true;
516
- } catch (err) {
517
- if ((0, _iserror.default)(err) && err.code === 'EPERM') {
518
- return false;
519
- }
520
- throw err;
521
- }
522
- });
523
- if (!distDirCreated || !await (0, _iswriteable.isWriteable)(distDir)) {
524
- throw Object.defineProperty(new Error('> Build directory is not writeable. https://nextjs.org/docs/messages/build-dir-not-writeable'), "__NEXT_ERROR_CODE", {
525
- value: "E202",
526
- enumerable: false,
527
- configurable: true
528
- });
529
- }
530
- if (config.cleanDistDir && !isGenerateMode) {
531
- await nextBuildSpan.traceChild('clean').traceAsyncFn(()=>(0, _recursivedelete.recursiveDeleteSyncWithAsyncRetries)(distDir, /^(cache|dev)/));
532
- }
533
533
  if (appDir && 'exportPathMap' in config) {
534
534
  _log.error('The "exportPathMap" configuration cannot be used with the "app" directory. Please use generateStaticParams() instead.');
535
535
  await telemetry.flush();
@@ -853,7 +853,7 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
853
853
  // Files outside of the distDir can be "type": "module"
854
854
  await writeFileUtf8(_path.default.join(distDir, 'package.json'), '{"type": "commonjs"}');
855
855
  // These are written to distDir, so they need to come after creating and cleaning distDr.
856
- await (0, _builddiagnostics.recordFrameworkVersion)("15.6.0-canary.50");
856
+ await (0, _builddiagnostics.recordFrameworkVersion)("15.6.0-canary.52");
857
857
  await (0, _builddiagnostics.updateBuildDiagnostics)({
858
858
  buildStage: 'start'
859
859
  });
@@ -2295,7 +2295,7 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
2295
2295
  experimentalPPR: undefined,
2296
2296
  renderingMode: undefined,
2297
2297
  srcRoute: null,
2298
- dataRoute: _path.default.posix.join('/_next/data', buildId, `${file}.json`),
2298
+ dataRoute: _path.default.posix.join('/_next/data', buildId, `${localePage}.json`),
2299
2299
  prefetchDataRoute: undefined,
2300
2300
  allowHeader: ALLOWED_HEADERS
2301
2301
  };
@@ -2491,6 +2491,9 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
2491
2491
  await writeFullyStaticExport(config, dir, enabledDirectories, configOutDir, nextBuildSpan, appDirOnly);
2492
2492
  });
2493
2493
  }
2494
+ // This should come after output: export handling but before
2495
+ // output: standalone, in the future output: standalone might
2496
+ // not be allowed if an adapter with onBuildComplete is configured
2494
2497
  const adapterPath = config.experimental.adapterPath;
2495
2498
  if (adapterPath) {
2496
2499
  await nextBuildSpan.traceChild('adapter-handle-build-complete').traceAsyncFn(async ()=>{
@@ -2498,8 +2501,9 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
2498
2501
  dir,
2499
2502
  distDir,
2500
2503
  config,
2504
+ configOutDir: _path.default.join(dir, configOutDir),
2501
2505
  staticPages,
2502
- nextVersion: "15.6.0-canary.50",
2506
+ nextVersion: "15.6.0-canary.52",
2503
2507
  tracingRoot: outputFileTracingRoot,
2504
2508
  hasNodeMiddleware,
2505
2509
  hasInstrumentationHook,