next 16.1.1-canary.7 → 16.1.1-canary.8

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 (84) hide show
  1. package/dist/bin/next +2 -2
  2. package/dist/build/index.js +4 -4
  3. package/dist/build/index.js.map +1 -1
  4. package/dist/build/swc/index.js +1 -1
  5. package/dist/build/webpack-config.js +3 -3
  6. package/dist/bundle-analyzer/404.html +2 -2
  7. package/dist/bundle-analyzer/__next.__PAGE__.txt +1 -1
  8. package/dist/bundle-analyzer/__next._full.txt +1 -1
  9. package/dist/bundle-analyzer/__next._head.txt +1 -1
  10. package/dist/bundle-analyzer/__next._index.txt +1 -1
  11. package/dist/bundle-analyzer/__next._tree.txt +1 -1
  12. package/dist/bundle-analyzer/_not-found/__next._full.txt +1 -1
  13. package/dist/bundle-analyzer/_not-found/__next._head.txt +1 -1
  14. package/dist/bundle-analyzer/_not-found/__next._index.txt +1 -1
  15. package/dist/bundle-analyzer/_not-found/__next._not-found.__PAGE__.txt +1 -1
  16. package/dist/bundle-analyzer/_not-found/__next._not-found.txt +1 -1
  17. package/dist/bundle-analyzer/_not-found/__next._tree.txt +1 -1
  18. package/dist/bundle-analyzer/_not-found.html +2 -2
  19. package/dist/bundle-analyzer/_not-found.txt +1 -1
  20. package/dist/bundle-analyzer/index.html +2 -2
  21. package/dist/bundle-analyzer/index.txt +1 -1
  22. package/dist/cli/next-typegen.js +1 -1
  23. package/dist/cli/next-typegen.js.map +1 -1
  24. package/dist/client/app-bootstrap.js +1 -1
  25. package/dist/client/index.js +1 -1
  26. package/dist/compiled/next-server/pages-api-turbo.runtime.dev.js +1 -1
  27. package/dist/compiled/next-server/pages-api-turbo.runtime.dev.js.map +1 -1
  28. package/dist/compiled/next-server/pages-api.runtime.prod.js +1 -1
  29. package/dist/compiled/next-server/pages-api.runtime.prod.js.map +1 -1
  30. package/dist/compiled/next-server/pages-turbo.runtime.dev.js +1 -1
  31. package/dist/compiled/next-server/pages-turbo.runtime.dev.js.map +1 -1
  32. package/dist/compiled/next-server/pages.runtime.prod.js +1 -1
  33. package/dist/compiled/next-server/pages.runtime.prod.js.map +1 -1
  34. package/dist/esm/build/index.js +4 -4
  35. package/dist/esm/build/index.js.map +1 -1
  36. package/dist/esm/build/swc/index.js +1 -1
  37. package/dist/esm/build/webpack-config.js +3 -3
  38. package/dist/esm/client/app-bootstrap.js +1 -1
  39. package/dist/esm/client/index.js +1 -1
  40. package/dist/esm/server/config-schema.js +1 -0
  41. package/dist/esm/server/config-schema.js.map +1 -1
  42. package/dist/esm/server/config-shared.js +1 -0
  43. package/dist/esm/server/config-shared.js.map +1 -1
  44. package/dist/esm/server/config.js +8 -0
  45. package/dist/esm/server/config.js.map +1 -1
  46. package/dist/esm/server/dev/hot-reloader-turbopack.js +1 -1
  47. package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
  48. package/dist/esm/server/lib/app-info-log.js +1 -1
  49. package/dist/esm/server/lib/router-utils/route-types-utils.js +4 -4
  50. package/dist/esm/server/lib/router-utils/route-types-utils.js.map +1 -1
  51. package/dist/esm/server/lib/router-utils/setup-dev-bundler.js +1 -1
  52. package/dist/esm/server/lib/router-utils/setup-dev-bundler.js.map +1 -1
  53. package/dist/esm/server/lib/router-utils/typegen.js +241 -0
  54. package/dist/esm/server/lib/router-utils/typegen.js.map +1 -1
  55. package/dist/esm/server/lib/start-server.js +1 -1
  56. package/dist/esm/shared/lib/errors/canary-only-config-error.js +1 -1
  57. package/dist/server/config-schema.d.ts +1 -0
  58. package/dist/server/config-schema.js +1 -0
  59. package/dist/server/config-schema.js.map +1 -1
  60. package/dist/server/config-shared.d.ts +6 -0
  61. package/dist/server/config-shared.js +1 -0
  62. package/dist/server/config-shared.js.map +1 -1
  63. package/dist/server/config.js +8 -0
  64. package/dist/server/config.js.map +1 -1
  65. package/dist/server/dev/hot-reloader-turbopack.js +1 -1
  66. package/dist/server/dev/hot-reloader-webpack.js +1 -1
  67. package/dist/server/lib/app-info-log.js +1 -1
  68. package/dist/server/lib/router-utils/route-types-utils.d.ts +1 -1
  69. package/dist/server/lib/router-utils/route-types-utils.js +3 -3
  70. package/dist/server/lib/router-utils/route-types-utils.js.map +1 -1
  71. package/dist/server/lib/router-utils/setup-dev-bundler.js +1 -1
  72. package/dist/server/lib/router-utils/setup-dev-bundler.js.map +1 -1
  73. package/dist/server/lib/router-utils/typegen.d.ts +2 -0
  74. package/dist/server/lib/router-utils/typegen.js +250 -1
  75. package/dist/server/lib/router-utils/typegen.js.map +1 -1
  76. package/dist/server/lib/start-server.js +1 -1
  77. package/dist/shared/lib/errors/canary-only-config-error.js +1 -1
  78. package/dist/telemetry/anonymous-meta.js +1 -1
  79. package/dist/telemetry/events/session-stopped.js +2 -2
  80. package/dist/telemetry/events/version.js +2 -2
  81. package/package.json +15 -15
  82. /package/dist/bundle-analyzer/_next/static/{AWFBEwiCWAUXxcVF_VRLZ → zd7Of5SMA1MaXT1RbEgqi}/_buildManifest.js +0 -0
  83. /package/dist/bundle-analyzer/_next/static/{AWFBEwiCWAUXxcVF_VRLZ → zd7Of5SMA1MaXT1RbEgqi}/_clientMiddlewareManifest.json +0 -0
  84. /package/dist/bundle-analyzer/_next/static/{AWFBEwiCWAUXxcVF_VRLZ → zd7Of5SMA1MaXT1RbEgqi}/_ssgManifest.js +0 -0
@@ -1,7 +1,7 @@
1
1
  import path from 'path';
2
2
  import { getRouteRegex } from '../../../shared/lib/router/utils/route-regex';
3
3
  import fs from 'fs';
4
- import { generateRouteTypesFile, generateLinkTypesFile, generateValidatorFile } from './typegen';
4
+ import { generateRouteTypesFile, generateLinkTypesFile, generateValidatorFile, generateValidatorFileStrict, generateRouteTypesFileStrict } from './typegen';
5
5
  import { tryToParsePath } from '../../../lib/try-to-parse-path';
6
6
  import { extractInterceptionRouteInformation, isInterceptionRouteAppPath } from '../../../shared/lib/router/utils/interception-routes';
7
7
  import { UNDERSCORE_GLOBAL_ERROR_ROUTE, UNDERSCORE_NOT_FOUND_ROUTE } from '../../../shared/lib/entry-constants';
@@ -235,21 +235,21 @@ export async function writeRouteTypesManifest(manifest, filePath, config) {
235
235
  });
236
236
  }
237
237
  // Write the main routes.d.ts file
238
- await fs.promises.writeFile(filePath, generateRouteTypesFile(manifest));
238
+ await fs.promises.writeFile(filePath, config.experimental.strictRouteTypes ? generateRouteTypesFileStrict(manifest) : generateRouteTypesFile(manifest));
239
239
  // Write the link.d.ts file if typedRoutes is enabled
240
240
  if (config.typedRoutes === true) {
241
241
  const linkTypesPath = path.join(dirname, 'link.d.ts');
242
242
  await fs.promises.writeFile(linkTypesPath, generateLinkTypesFile(manifest));
243
243
  }
244
244
  }
245
- export async function writeValidatorFile(manifest, filePath) {
245
+ export async function writeValidatorFile(manifest, filePath, strict) {
246
246
  const dirname = path.dirname(filePath);
247
247
  if (!fs.existsSync(dirname)) {
248
248
  await fs.promises.mkdir(dirname, {
249
249
  recursive: true
250
250
  });
251
251
  }
252
- await fs.promises.writeFile(filePath, generateValidatorFile(manifest));
252
+ await fs.promises.writeFile(filePath, strict ? generateValidatorFileStrict(manifest) : generateValidatorFile(manifest));
253
253
  }
254
254
 
255
255
  //# sourceMappingURL=route-types-utils.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/server/lib/router-utils/route-types-utils.ts"],"sourcesContent":["import path from 'path'\nimport {\n getRouteRegex,\n type Group,\n} from '../../../shared/lib/router/utils/route-regex'\nimport type { NextConfigComplete } from '../../config-shared'\n\nimport fs from 'fs'\nimport {\n generateRouteTypesFile,\n generateLinkTypesFile,\n generateValidatorFile,\n} from './typegen'\nimport { tryToParsePath } from '../../../lib/try-to-parse-path'\nimport {\n extractInterceptionRouteInformation,\n isInterceptionRouteAppPath,\n} from '../../../shared/lib/router/utils/interception-routes'\nimport {\n UNDERSCORE_GLOBAL_ERROR_ROUTE,\n UNDERSCORE_NOT_FOUND_ROUTE,\n} from '../../../shared/lib/entry-constants'\nimport { normalizePathSep } from '../../../shared/lib/page-path/normalize-path-sep'\n\ninterface RouteInfo {\n path: string\n groups: { [groupName: string]: Group }\n}\n\nexport interface RouteTypesManifest {\n appRoutes: Record<string, RouteInfo>\n pageRoutes: Record<string, RouteInfo>\n layoutRoutes: Record<string, RouteInfo & { slots: string[] }>\n appRouteHandlerRoutes: Record<string, RouteInfo>\n /** Map of redirect source => RouteInfo */\n redirectRoutes: Record<string, RouteInfo>\n /** Map of rewrite source => RouteInfo */\n rewriteRoutes: Record<string, RouteInfo>\n /** File paths for validation */\n appPagePaths: Set<string>\n pagesRouterPagePaths: Set<string>\n layoutPaths: Set<string>\n appRouteHandlers: Set<string>\n pageApiRoutes: Set<string>\n /** Direct mapping from file paths to routes for validation */\n filePathToRoute: Map<string, string>\n}\n\n// Convert a custom-route source string (`/blog/:slug`, `/docs/:path*`, ...)\n// into the bracket-syntax used by other Next.js route helpers so that we can\n// reuse `getRouteRegex()` to extract groups.\nexport function convertCustomRouteSource(source: string): string[] {\n const parseResult = tryToParsePath(source)\n\n if (parseResult.error || !parseResult.tokens) {\n // Fallback to original source if parsing fails\n return source.startsWith('/') ? [source] : ['/' + source]\n }\n\n const possibleNormalizedRoutes = ['']\n let slugCnt = 1\n\n function append(suffix: string) {\n for (let i = 0; i < possibleNormalizedRoutes.length; i++) {\n possibleNormalizedRoutes[i] += suffix\n }\n }\n\n function fork(suffix: string) {\n const currentLength = possibleNormalizedRoutes.length\n for (let i = 0; i < currentLength; i++) {\n possibleNormalizedRoutes.push(possibleNormalizedRoutes[i] + suffix)\n }\n }\n\n for (const token of parseResult.tokens) {\n if (typeof token === 'object') {\n // Make sure the slug is always named.\n const slug = token.name || (slugCnt++ === 1 ? 'slug' : `slug${slugCnt}`)\n if (token.modifier === '*') {\n append(`${token.prefix}[[...${slug}]]`)\n } else if (token.modifier === '+') {\n append(`${token.prefix}[...${slug}]`)\n } else if (token.modifier === '') {\n if (token.pattern === '[^\\\\/#\\\\?]+?') {\n // A safe slug\n append(`${token.prefix}[${slug}]`)\n } else if (token.pattern === '.*') {\n // An optional catch-all slug\n append(`${token.prefix}[[...${slug}]]`)\n } else if (token.pattern === '.+') {\n // A catch-all slug\n append(`${token.prefix}[...${slug}]`)\n } else {\n // Other regex patterns are not supported. Skip this route.\n return []\n }\n } else if (token.modifier === '?') {\n if (/^[a-zA-Z0-9_/]*$/.test(token.pattern)) {\n // An optional slug with plain text only, fork the route.\n append(token.prefix)\n fork(token.pattern)\n } else {\n // Optional modifier `?` and regex patterns are not supported.\n return []\n }\n }\n } else if (typeof token === 'string') {\n append(token)\n }\n }\n\n // Ensure leading slash\n return possibleNormalizedRoutes.map((route) =>\n route.startsWith('/') ? route : '/' + route\n )\n}\n\n/**\n * Extracts route parameters from a route pattern\n */\nexport function extractRouteParams(route: string) {\n const regex = getRouteRegex(route)\n return regex.groups\n}\n\n/**\n * Resolves an intercepting route to its canonical equivalent\n * Example: /gallery/test/(..)photo/[id] -> /gallery/photo/[id]\n */\nfunction resolveInterceptingRoute(route: string): string {\n // Reuse centralized interception route normalization logic\n try {\n if (!isInterceptionRouteAppPath(route)) return route\n const { interceptedRoute } = extractInterceptionRouteInformation(route)\n return interceptedRoute\n } catch {\n // If parsing fails, fall back to the original route\n return route\n }\n}\n\n/**\n * Creates a route types manifest from processed route data\n * (used for both build and dev)\n */\nexport async function createRouteTypesManifest({\n dir,\n pageRoutes,\n appRoutes,\n appRouteHandlers,\n pageApiRoutes,\n layoutRoutes,\n slots,\n redirects,\n rewrites,\n validatorFilePath,\n}: {\n dir: string\n pageRoutes: Array<{ route: string; filePath: string }>\n appRoutes: Array<{ route: string; filePath: string }>\n appRouteHandlers: Array<{ route: string; filePath: string }>\n pageApiRoutes: Array<{ route: string; filePath: string }>\n layoutRoutes: Array<{ route: string; filePath: string }>\n slots: Array<{ name: string; parent: string }>\n redirects?: NextConfigComplete['redirects']\n rewrites?: NextConfigComplete['rewrites']\n validatorFilePath?: string\n}): Promise<RouteTypesManifest> {\n // Helper function to calculate the correct relative path\n const getRelativePath = (filePath: string) => {\n if (validatorFilePath) {\n // For validator generation, calculate path relative to validator directory\n return normalizePathSep(\n path.relative(path.dirname(validatorFilePath), filePath)\n )\n }\n // For other uses, calculate path relative to project directory\n return normalizePathSep(path.relative(dir, filePath))\n }\n\n const manifest: RouteTypesManifest = {\n appRoutes: {},\n pageRoutes: {},\n layoutRoutes: {},\n appRouteHandlerRoutes: {},\n redirectRoutes: {},\n rewriteRoutes: {},\n appRouteHandlers: new Set(\n appRouteHandlers.map(({ filePath }) => getRelativePath(filePath))\n ),\n pageApiRoutes: new Set(\n pageApiRoutes.map(({ filePath }) => getRelativePath(filePath))\n ),\n appPagePaths: new Set(\n appRoutes.map(({ filePath }) => getRelativePath(filePath))\n ),\n pagesRouterPagePaths: new Set(\n pageRoutes.map(({ filePath }) => getRelativePath(filePath))\n ),\n layoutPaths: new Set(\n layoutRoutes.map(({ filePath }) => getRelativePath(filePath))\n ),\n filePathToRoute: new Map([\n ...appRoutes.map(\n ({ route, filePath }) =>\n [getRelativePath(filePath), resolveInterceptingRoute(route)] as [\n string,\n string,\n ]\n ),\n ...layoutRoutes.map(\n ({ route, filePath }) =>\n [getRelativePath(filePath), resolveInterceptingRoute(route)] as [\n string,\n string,\n ]\n ),\n ...appRouteHandlers.map(\n ({ route, filePath }) =>\n [getRelativePath(filePath), resolveInterceptingRoute(route)] as [\n string,\n string,\n ]\n ),\n ...pageRoutes.map(\n ({ route, filePath }) =>\n [getRelativePath(filePath), route] as [string, string]\n ),\n ...pageApiRoutes.map(\n ({ route, filePath }) =>\n [getRelativePath(filePath), route] as [string, string]\n ),\n ]),\n }\n\n // Process page routes\n for (const { route, filePath } of pageRoutes) {\n manifest.pageRoutes[route] = {\n path: getRelativePath(filePath),\n groups: extractRouteParams(route),\n }\n }\n\n // Process layout routes (exclude internal app error/not-found layouts)\n for (const { route, filePath } of layoutRoutes) {\n if (\n route === UNDERSCORE_GLOBAL_ERROR_ROUTE ||\n route === UNDERSCORE_NOT_FOUND_ROUTE\n )\n continue\n // Use the resolved route (for interception routes, this gives us the canonical route)\n const resolvedRoute = resolveInterceptingRoute(route)\n if (!manifest.layoutRoutes[resolvedRoute]) {\n manifest.layoutRoutes[resolvedRoute] = {\n path: getRelativePath(filePath),\n groups: extractRouteParams(resolvedRoute),\n slots: [],\n }\n }\n }\n\n // Process slots\n for (const slot of slots) {\n if (manifest.layoutRoutes[slot.parent]) {\n manifest.layoutRoutes[slot.parent].slots.push(slot.name)\n }\n }\n\n // Process app routes (exclude internal app routes)\n for (const { route, filePath } of appRoutes) {\n if (\n route === UNDERSCORE_GLOBAL_ERROR_ROUTE ||\n route === UNDERSCORE_NOT_FOUND_ROUTE\n )\n continue\n // Don't include metadata routes or pages\n if (\n !filePath.endsWith('page.ts') &&\n !filePath.endsWith('page.tsx') &&\n !filePath.endsWith('.mdx') &&\n !filePath.endsWith('.md')\n ) {\n continue\n }\n\n // Use the resolved route (for interception routes, this gives us the canonical route)\n const resolvedRoute = resolveInterceptingRoute(route)\n\n if (!manifest.appRoutes[resolvedRoute]) {\n manifest.appRoutes[resolvedRoute] = {\n path: getRelativePath(filePath),\n groups: extractRouteParams(resolvedRoute),\n }\n }\n }\n\n // Process app route handlers\n for (const { route, filePath } of appRouteHandlers) {\n // Use the resolved route (for interception routes, this gives us the canonical route)\n const resolvedRoute = resolveInterceptingRoute(route)\n\n if (!manifest.appRouteHandlerRoutes[resolvedRoute]) {\n manifest.appRouteHandlerRoutes[resolvedRoute] = {\n path: getRelativePath(filePath),\n groups: extractRouteParams(resolvedRoute),\n }\n }\n }\n\n // Process redirects\n if (typeof redirects === 'function') {\n const rd = await redirects()\n\n for (const item of rd) {\n const possibleRoutes = convertCustomRouteSource(item.source)\n for (const route of possibleRoutes) {\n manifest.redirectRoutes[route] = {\n path: route,\n groups: extractRouteParams(route),\n }\n }\n }\n }\n\n // Process rewrites\n if (typeof rewrites === 'function') {\n const rw = await rewrites()\n\n const allSources = Array.isArray(rw)\n ? rw\n : [\n ...(rw?.beforeFiles || []),\n ...(rw?.afterFiles || []),\n ...(rw?.fallback || []),\n ]\n\n for (const item of allSources) {\n const possibleRoutes = convertCustomRouteSource(item.source)\n for (const route of possibleRoutes) {\n manifest.rewriteRoutes[route] = {\n path: route,\n groups: extractRouteParams(route),\n }\n }\n }\n }\n\n return manifest\n}\n\nexport async function writeRouteTypesManifest(\n manifest: RouteTypesManifest,\n filePath: string,\n config: NextConfigComplete\n) {\n const dirname = path.dirname(filePath)\n\n if (!fs.existsSync(dirname)) {\n await fs.promises.mkdir(dirname, { recursive: true })\n }\n\n // Write the main routes.d.ts file\n await fs.promises.writeFile(filePath, generateRouteTypesFile(manifest))\n\n // Write the link.d.ts file if typedRoutes is enabled\n if (config.typedRoutes === true) {\n const linkTypesPath = path.join(dirname, 'link.d.ts')\n await fs.promises.writeFile(linkTypesPath, generateLinkTypesFile(manifest))\n }\n}\n\nexport async function writeValidatorFile(\n manifest: RouteTypesManifest,\n filePath: string\n) {\n const dirname = path.dirname(filePath)\n\n if (!fs.existsSync(dirname)) {\n await fs.promises.mkdir(dirname, { recursive: true })\n }\n\n await fs.promises.writeFile(filePath, generateValidatorFile(manifest))\n}\n"],"names":["path","getRouteRegex","fs","generateRouteTypesFile","generateLinkTypesFile","generateValidatorFile","tryToParsePath","extractInterceptionRouteInformation","isInterceptionRouteAppPath","UNDERSCORE_GLOBAL_ERROR_ROUTE","UNDERSCORE_NOT_FOUND_ROUTE","normalizePathSep","convertCustomRouteSource","source","parseResult","error","tokens","startsWith","possibleNormalizedRoutes","slugCnt","append","suffix","i","length","fork","currentLength","push","token","slug","name","modifier","prefix","pattern","test","map","route","extractRouteParams","regex","groups","resolveInterceptingRoute","interceptedRoute","createRouteTypesManifest","dir","pageRoutes","appRoutes","appRouteHandlers","pageApiRoutes","layoutRoutes","slots","redirects","rewrites","validatorFilePath","getRelativePath","filePath","relative","dirname","manifest","appRouteHandlerRoutes","redirectRoutes","rewriteRoutes","Set","appPagePaths","pagesRouterPagePaths","layoutPaths","filePathToRoute","Map","resolvedRoute","slot","parent","endsWith","rd","item","possibleRoutes","rw","allSources","Array","isArray","beforeFiles","afterFiles","fallback","writeRouteTypesManifest","config","existsSync","promises","mkdir","recursive","writeFile","typedRoutes","linkTypesPath","join","writeValidatorFile"],"mappings":"AAAA,OAAOA,UAAU,OAAM;AACvB,SACEC,aAAa,QAER,+CAA8C;AAGrD,OAAOC,QAAQ,KAAI;AACnB,SACEC,sBAAsB,EACtBC,qBAAqB,EACrBC,qBAAqB,QAChB,YAAW;AAClB,SAASC,cAAc,QAAQ,iCAAgC;AAC/D,SACEC,mCAAmC,EACnCC,0BAA0B,QACrB,uDAAsD;AAC7D,SACEC,6BAA6B,EAC7BC,0BAA0B,QACrB,sCAAqC;AAC5C,SAASC,gBAAgB,QAAQ,mDAAkD;AA0BnF,4EAA4E;AAC5E,6EAA6E;AAC7E,6CAA6C;AAC7C,OAAO,SAASC,yBAAyBC,MAAc;IACrD,MAAMC,cAAcR,eAAeO;IAEnC,IAAIC,YAAYC,KAAK,IAAI,CAACD,YAAYE,MAAM,EAAE;QAC5C,+CAA+C;QAC/C,OAAOH,OAAOI,UAAU,CAAC,OAAO;YAACJ;SAAO,GAAG;YAAC,MAAMA;SAAO;IAC3D;IAEA,MAAMK,2BAA2B;QAAC;KAAG;IACrC,IAAIC,UAAU;IAEd,SAASC,OAAOC,MAAc;QAC5B,IAAK,IAAIC,IAAI,GAAGA,IAAIJ,yBAAyBK,MAAM,EAAED,IAAK;YACxDJ,wBAAwB,CAACI,EAAE,IAAID;QACjC;IACF;IAEA,SAASG,KAAKH,MAAc;QAC1B,MAAMI,gBAAgBP,yBAAyBK,MAAM;QACrD,IAAK,IAAID,IAAI,GAAGA,IAAIG,eAAeH,IAAK;YACtCJ,yBAAyBQ,IAAI,CAACR,wBAAwB,CAACI,EAAE,GAAGD;QAC9D;IACF;IAEA,KAAK,MAAMM,SAASb,YAAYE,MAAM,CAAE;QACtC,IAAI,OAAOW,UAAU,UAAU;YAC7B,sCAAsC;YACtC,MA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MAAME,UAAUvD,KAAKuD,OAAO,CAACF;IAE7B,IAAI,CAACnD,GAAGgF,UAAU,CAAC3B,UAAU;QAC3B,MAAMrD,GAAGiF,QAAQ,CAACC,KAAK,CAAC7B,SAAS;YAAE8B,WAAW;QAAK;IACrD;IAEA,MAAMnF,GAAGiF,QAAQ,CAACG,SAAS,CAACjC,UAAUhD,sBAAsBmD;AAC9D","ignoreList":[0]}
1
+ {"version":3,"sources":["../../../../../src/server/lib/router-utils/route-types-utils.ts"],"sourcesContent":["import path from 'path'\nimport {\n getRouteRegex,\n type Group,\n} from '../../../shared/lib/router/utils/route-regex'\nimport type { NextConfigComplete } from '../../config-shared'\n\nimport fs from 'fs'\nimport {\n generateRouteTypesFile,\n generateLinkTypesFile,\n generateValidatorFile,\n generateValidatorFileStrict,\n generateRouteTypesFileStrict,\n} from './typegen'\nimport { tryToParsePath } from '../../../lib/try-to-parse-path'\nimport {\n extractInterceptionRouteInformation,\n isInterceptionRouteAppPath,\n} from '../../../shared/lib/router/utils/interception-routes'\nimport {\n UNDERSCORE_GLOBAL_ERROR_ROUTE,\n UNDERSCORE_NOT_FOUND_ROUTE,\n} from '../../../shared/lib/entry-constants'\nimport { normalizePathSep } from '../../../shared/lib/page-path/normalize-path-sep'\n\ninterface RouteInfo {\n path: string\n groups: { [groupName: string]: Group }\n}\n\nexport interface RouteTypesManifest {\n appRoutes: Record<string, RouteInfo>\n pageRoutes: Record<string, RouteInfo>\n layoutRoutes: Record<string, RouteInfo & { slots: string[] }>\n appRouteHandlerRoutes: Record<string, RouteInfo>\n /** Map of redirect source => RouteInfo */\n redirectRoutes: Record<string, RouteInfo>\n /** Map of rewrite source => RouteInfo */\n rewriteRoutes: Record<string, RouteInfo>\n /** File paths for validation */\n appPagePaths: Set<string>\n pagesRouterPagePaths: Set<string>\n layoutPaths: Set<string>\n appRouteHandlers: Set<string>\n pageApiRoutes: Set<string>\n /** Direct mapping from file paths to routes for validation */\n filePathToRoute: Map<string, string>\n}\n\n// Convert a custom-route source string (`/blog/:slug`, `/docs/:path*`, ...)\n// into the bracket-syntax used by other Next.js route helpers so that we can\n// reuse `getRouteRegex()` to extract groups.\nexport function convertCustomRouteSource(source: string): string[] {\n const parseResult = tryToParsePath(source)\n\n if (parseResult.error || !parseResult.tokens) {\n // Fallback to original source if parsing fails\n return source.startsWith('/') ? [source] : ['/' + source]\n }\n\n const possibleNormalizedRoutes = ['']\n let slugCnt = 1\n\n function append(suffix: string) {\n for (let i = 0; i < possibleNormalizedRoutes.length; i++) {\n possibleNormalizedRoutes[i] += suffix\n }\n }\n\n function fork(suffix: string) {\n const currentLength = possibleNormalizedRoutes.length\n for (let i = 0; i < currentLength; i++) {\n possibleNormalizedRoutes.push(possibleNormalizedRoutes[i] + suffix)\n }\n }\n\n for (const token of parseResult.tokens) {\n if (typeof token === 'object') {\n // Make sure the slug is always named.\n const slug = token.name || (slugCnt++ === 1 ? 'slug' : `slug${slugCnt}`)\n if (token.modifier === '*') {\n append(`${token.prefix}[[...${slug}]]`)\n } else if (token.modifier === '+') {\n append(`${token.prefix}[...${slug}]`)\n } else if (token.modifier === '') {\n if (token.pattern === '[^\\\\/#\\\\?]+?') {\n // A safe slug\n append(`${token.prefix}[${slug}]`)\n } else if (token.pattern === '.*') {\n // An optional catch-all slug\n append(`${token.prefix}[[...${slug}]]`)\n } else if (token.pattern === '.+') {\n // A catch-all slug\n append(`${token.prefix}[...${slug}]`)\n } else {\n // Other regex patterns are not supported. Skip this route.\n return []\n }\n } else if (token.modifier === '?') {\n if (/^[a-zA-Z0-9_/]*$/.test(token.pattern)) {\n // An optional slug with plain text only, fork the route.\n append(token.prefix)\n fork(token.pattern)\n } else {\n // Optional modifier `?` and regex patterns are not supported.\n return []\n }\n }\n } else if (typeof token === 'string') {\n append(token)\n }\n }\n\n // Ensure leading slash\n return possibleNormalizedRoutes.map((route) =>\n route.startsWith('/') ? route : '/' + route\n )\n}\n\n/**\n * Extracts route parameters from a route pattern\n */\nexport function extractRouteParams(route: string) {\n const regex = getRouteRegex(route)\n return regex.groups\n}\n\n/**\n * Resolves an intercepting route to its canonical equivalent\n * Example: /gallery/test/(..)photo/[id] -> /gallery/photo/[id]\n */\nfunction resolveInterceptingRoute(route: string): string {\n // Reuse centralized interception route normalization logic\n try {\n if (!isInterceptionRouteAppPath(route)) return route\n const { interceptedRoute } = extractInterceptionRouteInformation(route)\n return interceptedRoute\n } catch {\n // If parsing fails, fall back to the original route\n return route\n }\n}\n\n/**\n * Creates a route types manifest from processed route data\n * (used for both build and dev)\n */\nexport async function createRouteTypesManifest({\n dir,\n pageRoutes,\n appRoutes,\n appRouteHandlers,\n pageApiRoutes,\n layoutRoutes,\n slots,\n redirects,\n rewrites,\n validatorFilePath,\n}: {\n dir: string\n pageRoutes: Array<{ route: string; filePath: string }>\n appRoutes: Array<{ route: string; filePath: string }>\n appRouteHandlers: Array<{ route: string; filePath: string }>\n pageApiRoutes: Array<{ route: string; filePath: string }>\n layoutRoutes: Array<{ route: string; filePath: string }>\n slots: Array<{ name: string; parent: string }>\n redirects?: NextConfigComplete['redirects']\n rewrites?: NextConfigComplete['rewrites']\n validatorFilePath?: string\n}): Promise<RouteTypesManifest> {\n // Helper function to calculate the correct relative path\n const getRelativePath = (filePath: string) => {\n if (validatorFilePath) {\n // For validator generation, calculate path relative to validator directory\n return normalizePathSep(\n path.relative(path.dirname(validatorFilePath), filePath)\n )\n }\n // For other uses, calculate path relative to project directory\n return normalizePathSep(path.relative(dir, filePath))\n }\n\n const manifest: RouteTypesManifest = {\n appRoutes: {},\n pageRoutes: {},\n layoutRoutes: {},\n appRouteHandlerRoutes: {},\n redirectRoutes: {},\n rewriteRoutes: {},\n appRouteHandlers: new Set(\n appRouteHandlers.map(({ filePath }) => getRelativePath(filePath))\n ),\n pageApiRoutes: new Set(\n pageApiRoutes.map(({ filePath }) => getRelativePath(filePath))\n ),\n appPagePaths: new Set(\n appRoutes.map(({ filePath }) => getRelativePath(filePath))\n ),\n pagesRouterPagePaths: new Set(\n pageRoutes.map(({ filePath }) => getRelativePath(filePath))\n ),\n layoutPaths: new Set(\n layoutRoutes.map(({ filePath }) => getRelativePath(filePath))\n ),\n filePathToRoute: new Map([\n ...appRoutes.map(\n ({ route, filePath }) =>\n [getRelativePath(filePath), resolveInterceptingRoute(route)] as [\n string,\n string,\n ]\n ),\n ...layoutRoutes.map(\n ({ route, filePath }) =>\n [getRelativePath(filePath), resolveInterceptingRoute(route)] as [\n string,\n string,\n ]\n ),\n ...appRouteHandlers.map(\n ({ route, filePath }) =>\n [getRelativePath(filePath), resolveInterceptingRoute(route)] as [\n string,\n string,\n ]\n ),\n ...pageRoutes.map(\n ({ route, filePath }) =>\n [getRelativePath(filePath), route] as [string, string]\n ),\n ...pageApiRoutes.map(\n ({ route, filePath }) =>\n [getRelativePath(filePath), route] as [string, string]\n ),\n ]),\n }\n\n // Process page routes\n for (const { route, filePath } of pageRoutes) {\n manifest.pageRoutes[route] = {\n path: getRelativePath(filePath),\n groups: extractRouteParams(route),\n }\n }\n\n // Process layout routes (exclude internal app error/not-found layouts)\n for (const { route, filePath } of layoutRoutes) {\n if (\n route === UNDERSCORE_GLOBAL_ERROR_ROUTE ||\n route === UNDERSCORE_NOT_FOUND_ROUTE\n )\n continue\n // Use the resolved route (for interception routes, this gives us the canonical route)\n const resolvedRoute = resolveInterceptingRoute(route)\n if (!manifest.layoutRoutes[resolvedRoute]) {\n manifest.layoutRoutes[resolvedRoute] = {\n path: getRelativePath(filePath),\n groups: extractRouteParams(resolvedRoute),\n slots: [],\n }\n }\n }\n\n // Process slots\n for (const slot of slots) {\n if (manifest.layoutRoutes[slot.parent]) {\n manifest.layoutRoutes[slot.parent].slots.push(slot.name)\n }\n }\n\n // Process app routes (exclude internal app routes)\n for (const { route, filePath } of appRoutes) {\n if (\n route === UNDERSCORE_GLOBAL_ERROR_ROUTE ||\n route === UNDERSCORE_NOT_FOUND_ROUTE\n )\n continue\n // Don't include metadata routes or pages\n if (\n !filePath.endsWith('page.ts') &&\n !filePath.endsWith('page.tsx') &&\n !filePath.endsWith('.mdx') &&\n !filePath.endsWith('.md')\n ) {\n continue\n }\n\n // Use the resolved route (for interception routes, this gives us the canonical route)\n const resolvedRoute = resolveInterceptingRoute(route)\n\n if (!manifest.appRoutes[resolvedRoute]) {\n manifest.appRoutes[resolvedRoute] = {\n path: getRelativePath(filePath),\n groups: extractRouteParams(resolvedRoute),\n }\n }\n }\n\n // Process app route handlers\n for (const { route, filePath } of appRouteHandlers) {\n // Use the resolved route (for interception routes, this gives us the canonical route)\n const resolvedRoute = resolveInterceptingRoute(route)\n\n if (!manifest.appRouteHandlerRoutes[resolvedRoute]) {\n manifest.appRouteHandlerRoutes[resolvedRoute] = {\n path: getRelativePath(filePath),\n groups: extractRouteParams(resolvedRoute),\n }\n }\n }\n\n // Process redirects\n if (typeof redirects === 'function') {\n const rd = await redirects()\n\n for (const item of rd) {\n const possibleRoutes = convertCustomRouteSource(item.source)\n for (const route of possibleRoutes) {\n manifest.redirectRoutes[route] = {\n path: route,\n groups: extractRouteParams(route),\n }\n }\n }\n }\n\n // Process rewrites\n if (typeof rewrites === 'function') {\n const rw = await rewrites()\n\n const allSources = Array.isArray(rw)\n ? rw\n : [\n ...(rw?.beforeFiles || []),\n ...(rw?.afterFiles || []),\n ...(rw?.fallback || []),\n ]\n\n for (const item of allSources) {\n const possibleRoutes = convertCustomRouteSource(item.source)\n for (const route of possibleRoutes) {\n manifest.rewriteRoutes[route] = {\n path: route,\n groups: extractRouteParams(route),\n }\n }\n }\n }\n\n return manifest\n}\n\nexport async function writeRouteTypesManifest(\n manifest: RouteTypesManifest,\n filePath: string,\n config: NextConfigComplete\n) {\n const dirname = path.dirname(filePath)\n\n if (!fs.existsSync(dirname)) {\n await fs.promises.mkdir(dirname, { recursive: true })\n }\n\n // Write the main routes.d.ts file\n await fs.promises.writeFile(\n filePath,\n config.experimental.strictRouteTypes\n ? generateRouteTypesFileStrict(manifest)\n : generateRouteTypesFile(manifest)\n )\n\n // Write the link.d.ts file if typedRoutes is enabled\n if (config.typedRoutes === true) {\n const linkTypesPath = path.join(dirname, 'link.d.ts')\n await fs.promises.writeFile(linkTypesPath, generateLinkTypesFile(manifest))\n }\n}\n\nexport async function writeValidatorFile(\n manifest: RouteTypesManifest,\n filePath: string,\n strict: boolean\n) {\n const dirname = path.dirname(filePath)\n\n if (!fs.existsSync(dirname)) {\n await fs.promises.mkdir(dirname, { recursive: true })\n }\n\n await fs.promises.writeFile(\n filePath,\n strict\n ? generateValidatorFileStrict(manifest)\n : generateValidatorFile(manifest)\n )\n}\n"],"names":["path","getRouteRegex","fs","generateRouteTypesFile","generateLinkTypesFile","generateValidatorFile","generateValidatorFileStrict","generateRouteTypesFileStrict","tryToParsePath","extractInterceptionRouteInformation","isInterceptionRouteAppPath","UNDERSCORE_GLOBAL_ERROR_ROUTE","UNDERSCORE_NOT_FOUND_ROUTE","normalizePathSep","convertCustomRouteSource","source","parseResult","error","tokens","startsWith","possibleNormalizedRoutes","slugCnt","append","suffix","i","length","fork","currentLength","push","token","slug","name","modifier","prefix","pattern","test","map","route","extractRouteParams","regex","groups","resolveInterceptingRoute","interceptedRoute","createRouteTypesManifest","dir","pageRoutes","appRoutes","appRouteHandlers","pageApiRoutes","layoutRoutes","slots","redirects","rewrites","validatorFilePath","getRelativePath","filePath","relative","dirname","manifest","appRouteHandlerRoutes","redirectRoutes","rewriteRoutes","Set","appPagePaths","pagesRouterPagePaths","layoutPaths","filePathToRoute","Map","resolvedRoute","slot","parent","endsWith","rd","item","possibleRoutes","rw","allSources","Array","isArray","beforeFiles","afterFiles","fallback","writeRouteTypesManifest","config","existsSync","promises","mkdir","recursive","writeFile","experimental","strictRouteTypes","typedRoutes","linkTypesPath","join","writeValidatorFile","strict"],"mappings":"AAAA,OAAOA,UAAU,OAAM;AACvB,SACEC,aAAa,QAER,+CAA8C;AAGrD,OAAOC,QAAQ,KAAI;AACnB,SACEC,sBAAsB,EACtBC,qBAAqB,EACrBC,qBAAqB,EACrBC,2BAA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AQ,CAACG,SAAS,CACzBjC,UACAwC,SACIzF,4BAA4BoD,YAC5BrD,sBAAsBqD;AAE9B","ignoreList":[0]}
@@ -774,7 +774,7 @@ async function startWatcher(opts) {
774
774
  pageApiRoutes
775
775
  });
776
776
  await writeRouteTypesManifest(routeTypesManifest, routeTypesFilePath, opts.nextConfig);
777
- await writeValidatorFile(routeTypesManifest, validatorFilePath);
777
+ await writeValidatorFile(routeTypesManifest, validatorFilePath, Boolean(nextConfig.experimental.strictRouteTypes));
778
778
  // Generate cache-life types if cacheLife config exists
779
779
  const cacheLifeFilePath = path.join(distTypesDir, 'cache-life.d.ts');
780
780
  writeCacheLifeTypes(opts.nextConfig.cacheLife, cacheLifeFilePath);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/server/lib/router-utils/setup-dev-bundler.ts"],"sourcesContent":["import type { NextConfigComplete } from '../../config-shared'\nimport type { FilesystemDynamicRoute } from './filesystem'\nimport type { UnwrapPromise } from '../../../lib/coalesced-function'\nimport type { ProxyMatcher } from '../../../build/analysis/get-page-static-info'\nimport type { RoutesManifest } from '../../../build'\nimport type { MiddlewareRouteMatch } from '../../../shared/lib/router/utils/middleware-route-matcher'\nimport type { PropagateToWorkersField } from './types'\nimport type { NextJsHotReloaderInterface } from '../../dev/hot-reloader-types'\n\nimport { createDefineEnv } from '../../../build/swc'\nimport { installBindings } from '../../../build/swc/install-bindings'\nimport fs from 'fs'\nimport path from 'path'\nimport qs from 'querystring'\nimport Watchpack from 'next/dist/compiled/watchpack'\nimport findUp from 'next/dist/compiled/find-up'\nimport { buildCustomRoute } from './filesystem'\nimport * as Log from '../../../build/output/log'\nimport { setGlobal } from '../../../trace/shared'\nimport type { Telemetry } from '../../../telemetry/storage'\nimport type { IncomingMessage, ServerResponse } from 'http'\nimport { createValidFileMatcher } from '../find-page-file'\nimport {\n EVENT_BUILD_FEATURE_USAGE,\n eventCliSession,\n} from '../../../telemetry/events'\nimport { getSortedRoutes } from '../../../shared/lib/router/utils'\nimport { sortByPageExts } from '../../../build/sort-by-page-exts'\nimport { verifyTypeScriptSetup } from '../../../lib/verify-typescript-setup'\nimport { verifyPartytownSetup } from '../../../lib/verify-partytown-setup'\nimport { getNamedRouteRegex } from '../../../shared/lib/router/utils/route-regex'\nimport { normalizeAppPath } from '../../../shared/lib/router/utils/app-paths'\nimport { buildDataRoute } from './build-data-route'\nimport { getRouteMatcher } from '../../../shared/lib/router/utils/route-matcher'\nimport { normalizePathSep } from '../../../shared/lib/page-path/normalize-path-sep'\nimport { createClientRouterFilter } from '../../../lib/create-client-router-filter'\nimport { absolutePathToPage } from '../../../shared/lib/page-path/absolute-path-to-page'\nimport { generateInterceptionRoutesRewrites } from '../../../lib/generate-interception-routes-rewrites'\n\nimport {\n CLIENT_STATIC_FILES_PATH,\n DEV_CLIENT_PAGES_MANIFEST,\n DEV_CLIENT_MIDDLEWARE_MANIFEST,\n PHASE_DEVELOPMENT_SERVER,\n TURBOPACK_CLIENT_MIDDLEWARE_MANIFEST,\n ROUTES_MANIFEST,\n PRERENDER_MANIFEST,\n} from '../../../shared/lib/constants'\n\nimport { getMiddlewareRouteMatcher } from '../../../shared/lib/router/utils/middleware-route-matcher'\n\nimport {\n isMiddlewareFile,\n NestedMiddlewareError,\n isInstrumentationHookFile,\n getPossibleMiddlewareFilenames,\n getPossibleInstrumentationHookFilenames,\n} from '../../../build/utils'\nimport { devPageFiles } from '../../../build/webpack/plugins/next-types-plugin/shared'\nimport type { LazyRenderServerInstance } from '../router-server'\nimport { HMR_MESSAGE_SENT_TO_BROWSER } from '../../dev/hot-reloader-types'\nimport { PAGE_TYPES } from '../../../lib/page-types'\nimport { generateEncryptionKeyBase64 } from '../../app-render/encryption-utils-server'\nimport {\n isMetadataRouteFile,\n isStaticMetadataFile,\n} from '../../../lib/metadata/is-metadata-route'\nimport { normalizeMetadataPageToRoute } from '../../../lib/metadata/get-metadata-route'\nimport { JsConfigPathsPlugin } from '../../../build/webpack/plugins/jsconfig-paths-plugin'\nimport { store as consoleStore } from '../../../build/output/store'\nimport {\n isFileSystemCacheEnabledForDev,\n ModuleBuildError,\n} from '../../../shared/lib/turbopack/utils'\nimport { getDefineEnv } from '../../../build/define-env'\nimport { TurbopackInternalError } from '../../../shared/lib/turbopack/internal-error'\nimport { normalizePath } from '../../../lib/normalize-path'\nimport {\n JSON_CONTENT_TYPE_HEADER,\n MIDDLEWARE_FILENAME,\n PROXY_FILENAME,\n} from '../../../lib/constants'\nimport { parseUrl } from '../../../lib/url'\nimport {\n createRouteTypesManifest,\n writeRouteTypesManifest,\n writeValidatorFile,\n} from './route-types-utils'\nimport { writeCacheLifeTypes } from './cache-life-type-utils'\nimport { isParallelRouteSegment } from '../../../shared/lib/segment'\nimport { ensureLeadingSlash } from '../../../shared/lib/page-path/ensure-leading-slash'\nimport { Lockfile } from '../../../build/lockfile'\nimport { deobfuscateText } from '../../../shared/lib/magic-identifier'\n\nexport type SetupOpts = {\n renderServer: LazyRenderServerInstance\n dir: string\n turbo?: boolean\n appDir?: string\n pagesDir?: string\n telemetry: Telemetry\n isCustomServer?: boolean\n fsChecker: UnwrapPromise<\n ReturnType<typeof import('./filesystem').setupFsCheck>\n >\n nextConfig: NextConfigComplete\n port: number\n onDevServerCleanup: ((listener: () => Promise<void>) => void) | undefined\n resetFetch: () => void\n}\n\nexport interface DevRoutesManifest {\n version: number\n caseSensitive: RoutesManifest['caseSensitive']\n basePath: RoutesManifest['basePath']\n rewrites: RoutesManifest['rewrites']\n redirects: RoutesManifest['redirects']\n headers: RoutesManifest['headers']\n i18n: RoutesManifest['i18n']\n skipProxyUrlNormalize: RoutesManifest['skipProxyUrlNormalize']\n}\n\nexport type ServerFields = {\n actualMiddlewareFile?: string | undefined\n actualInstrumentationHookFile?: string | undefined\n appPathRoutes?: Record<string, string | string[]>\n middleware?:\n | {\n page: string\n match: MiddlewareRouteMatch\n matchers?: ProxyMatcher[]\n }\n | undefined\n hasAppNotFound?: boolean\n interceptionRoutes?: ReturnType<\n typeof import('./filesystem').buildCustomRoute\n >[]\n setIsrStatus?: (key: string, value: boolean | undefined) => void\n resetFetch?: () => void\n}\n\nasync function verifyTypeScript(opts: SetupOpts) {\n const verifyResult = await verifyTypeScriptSetup({\n dir: opts.dir,\n distDir: opts.nextConfig.distDir,\n typeCheckPreflight: false,\n tsconfigPath: opts.nextConfig.typescript.tsconfigPath,\n disableStaticImages: opts.nextConfig.images.disableStaticImages,\n hasAppDir: !!opts.appDir,\n hasPagesDir: !!opts.pagesDir,\n isolatedDevBuild: opts.nextConfig.experimental.isolatedDevBuild,\n appDir: opts.appDir,\n pagesDir: opts.pagesDir,\n })\n\n if (verifyResult.version) {\n return true\n }\n return false\n}\n\nexport async function propagateServerField(\n opts: SetupOpts,\n field: PropagateToWorkersField,\n args: any\n) {\n await opts.renderServer?.instance?.propagateServerField(opts.dir, field, args)\n}\n\nasync function startWatcher(\n opts: SetupOpts & {\n isSrcDir: boolean\n }\n) {\n const { nextConfig, appDir, pagesDir, dir, resetFetch } = opts\n const { useFileSystemPublicRoutes } = nextConfig\n\n const distDir = path.join(opts.dir, opts.nextConfig.distDir)\n\n setGlobal('distDir', distDir)\n setGlobal('phase', PHASE_DEVELOPMENT_SERVER)\n\n let lockfile\n if (opts.nextConfig.experimental.lockDistDir) {\n fs.mkdirSync(distDir, { recursive: true })\n lockfile = await Lockfile.acquireWithRetriesOrExit(\n path.join(distDir, 'lock'),\n 'next dev'\n )\n }\n\n const validFileMatcher = createValidFileMatcher(\n nextConfig.pageExtensions,\n appDir\n )\n\n const serverFields: ServerFields = {}\n\n // Update logging state once based on next.config.js when initializing\n consoleStore.setState({\n logging: nextConfig.logging !== false,\n })\n\n const hotReloader: NextJsHotReloaderInterface = opts.turbo\n ? await (async () => {\n const createHotReloaderTurbopack = (\n require('../../dev/hot-reloader-turbopack') as typeof import('../../dev/hot-reloader-turbopack')\n ).createHotReloaderTurbopack\n return await createHotReloaderTurbopack(\n opts,\n serverFields,\n distDir,\n resetFetch,\n lockfile\n )\n })()\n : await (async () => {\n const HotReloader = process.env.NEXT_RSPACK\n ? (\n require('../../dev/hot-reloader-rspack') as typeof import('../../dev/hot-reloader-rspack')\n ).default\n : (\n require('../../dev/hot-reloader-webpack') as typeof import('../../dev/hot-reloader-webpack')\n ).default\n return new HotReloader(opts.dir, {\n isSrcDir: opts.isSrcDir,\n appDir,\n pagesDir,\n distDir,\n config: opts.nextConfig,\n buildId: 'development',\n encryptionKey: await generateEncryptionKeyBase64({\n isBuild: false,\n distDir,\n }),\n telemetry: opts.telemetry,\n rewrites: opts.fsChecker.rewrites,\n previewProps: opts.fsChecker.prerenderManifest.preview,\n resetFetch,\n lockfile,\n onDevServerCleanup: opts.onDevServerCleanup,\n })\n })()\n\n await hotReloader.start()\n\n // have to write this after starting hot-reloader since that\n // cleans the dist dir\n const distTypesDir = path.join(distDir, 'types')\n await writeRouteTypesManifest(\n {\n appRoutes: {},\n pageRoutes: {},\n layoutRoutes: {},\n appRouteHandlerRoutes: {},\n redirectRoutes: {},\n rewriteRoutes: {},\n appPagePaths: new Set(),\n pagesRouterPagePaths: new Set(),\n layoutPaths: new Set(),\n appRouteHandlers: new Set(),\n pageApiRoutes: new Set(),\n filePathToRoute: new Map(),\n },\n path.join(distTypesDir, 'routes.d.ts'),\n opts.nextConfig\n )\n\n const routesManifestPath = path.join(distDir, ROUTES_MANIFEST)\n const routesManifest: DevRoutesManifest = {\n version: 3,\n caseSensitive: !!nextConfig.experimental.caseSensitiveRoutes,\n basePath: nextConfig.basePath,\n rewrites: opts.fsChecker.rewrites,\n redirects: opts.fsChecker.redirects,\n headers: opts.fsChecker.headers,\n i18n: nextConfig.i18n || undefined,\n skipProxyUrlNormalize: nextConfig.skipProxyUrlNormalize,\n }\n await fs.promises.writeFile(\n routesManifestPath,\n JSON.stringify(routesManifest)\n )\n\n const prerenderManifestPath = path.join(distDir, PRERENDER_MANIFEST)\n await fs.promises.writeFile(\n prerenderManifestPath,\n JSON.stringify(opts.fsChecker.prerenderManifest, null, 2)\n )\n\n if (opts.nextConfig.experimental.nextScriptWorkers) {\n await verifyPartytownSetup(\n opts.dir,\n path.join(distDir, CLIENT_STATIC_FILES_PATH)\n )\n }\n\n opts.fsChecker.ensureCallback(async function ensure(item) {\n if (item.type === 'appFile' || item.type === 'pageFile') {\n await hotReloader.ensurePage({\n clientOnly: false,\n page: item.itemPath,\n isApp: item.type === 'appFile',\n definition: undefined,\n })\n }\n })\n\n let resolved = false\n let prevSortedRoutes: string[] = []\n\n await new Promise<void>(async (resolve, reject) => {\n if (pagesDir) {\n // Watchpack doesn't emit an event for an empty directory\n fs.readdir(pagesDir, (_, files) => {\n if (files?.length) {\n return\n }\n\n if (!resolved) {\n resolve()\n resolved = true\n }\n })\n }\n\n const pages = pagesDir ? [pagesDir] : []\n const app = appDir ? [appDir] : []\n const directories = [...pages, ...app]\n\n const rootDir = pagesDir || appDir\n const files = [\n ...getPossibleMiddlewareFilenames(\n path.join(rootDir!, '..'),\n nextConfig.pageExtensions\n ),\n ...getPossibleInstrumentationHookFilenames(\n path.join(rootDir!, '..'),\n nextConfig.pageExtensions\n ),\n ]\n let nestedMiddleware: string[] = []\n\n const envFiles = [\n '.env.development.local',\n '.env.local',\n '.env.development',\n '.env',\n ].map((file) => path.join(dir, file))\n\n files.push(...envFiles)\n\n // tsconfig/jsconfig paths hot-reloading\n const tsconfigPaths = [\n path.join(dir, 'tsconfig.json'),\n path.join(dir, 'jsconfig.json'),\n ] as const\n files.push(...tsconfigPaths)\n\n const wp = new Watchpack({\n // Watchpack default is 200ms which adds 200ms of dead time on bootup.\n aggregateTimeout: 5, // Matches webpack-config.ts.\n ignored: (pathname: string) => {\n return (\n !files.some((file) => file.startsWith(pathname)) &&\n !directories.some(\n (d) => pathname.startsWith(d) || d.startsWith(pathname)\n )\n )\n },\n })\n const fileWatchTimes = new Map()\n let enabledTypeScript = await verifyTypeScript(opts)\n let previousClientRouterFilters: any\n let previousConflictingPagePaths: Set<string> = new Set()\n\n const routeTypesFilePath = path.join(distDir, 'types', 'routes.d.ts')\n const validatorFilePath = path.join(distDir, 'types', 'validator.ts')\n\n let initialWatchTime = performance.now() + performance.timeOrigin\n wp.on('aggregated', async () => {\n let writeEnvDefinitions = false\n let typescriptStatusFromLastAggregation = enabledTypeScript\n let middlewareMatchers: ProxyMatcher[] | undefined\n const routedPages: string[] = []\n const knownFiles = wp.getTimeInfoEntries()\n const appPaths: Record<string, string[]> = {}\n const pageNameSet = new Set<string>()\n const conflictingAppPagePaths = new Set<string>()\n const appPageFilePaths = new Map<string, string>()\n const pagesPageFilePaths = new Map<string, string>()\n const appRouteHandlers: Array<{ route: string; filePath: string }> = []\n const pageApiRoutes: Array<{ route: string; filePath: string }> = []\n\n const pageRoutes: Array<{ route: string; filePath: string }> = []\n const appRoutes: Array<{ route: string; filePath: string }> = []\n const layoutRoutes: Array<{ route: string; filePath: string }> = []\n const slots: Array<{ name: string; parent: string }> = []\n\n let envChange = false\n let tsconfigChange = false\n let conflictingPageChange = 0\n let hasRootAppNotFound = false\n\n const { appFiles, pageFiles, staticMetadataFiles } = opts.fsChecker\n\n appFiles.clear()\n pageFiles.clear()\n staticMetadataFiles.clear()\n devPageFiles.clear()\n\n const sortedKnownFiles: string[] = [...knownFiles.keys()].sort(\n sortByPageExts(nextConfig.pageExtensions)\n )\n\n let proxyFilePath: string | undefined\n let middlewareFilePath: string | undefined\n\n for (const fileName of sortedKnownFiles) {\n if (\n !files.includes(fileName) &&\n !directories.some((d) => fileName.startsWith(d))\n ) {\n continue\n }\n\n const { name: fileBaseName, dir: fileDir } = path.parse(fileName)\n\n const isAtConventionLevel =\n fileDir === dir || fileDir === path.join(dir, 'src')\n\n if (isAtConventionLevel && fileBaseName === MIDDLEWARE_FILENAME) {\n middlewareFilePath = fileName\n }\n if (isAtConventionLevel && fileBaseName === PROXY_FILENAME) {\n proxyFilePath = fileName\n }\n\n if (middlewareFilePath) {\n if (proxyFilePath) {\n const cwd = process.cwd()\n\n throw new Error(\n `Both ${MIDDLEWARE_FILENAME} file \"./${path.relative(cwd, middlewareFilePath)}\" and ${PROXY_FILENAME} file \"./${path.relative(cwd, proxyFilePath)}\" are detected. Please use \"./${path.relative(cwd, proxyFilePath)}\" only. Learn more: https://nextjs.org/docs/messages/middleware-to-proxy`\n )\n }\n Log.warnOnce(\n `The \"${MIDDLEWARE_FILENAME}\" file convention is deprecated. Please use \"${PROXY_FILENAME}\" instead. Learn more: https://nextjs.org/docs/messages/middleware-to-proxy`\n )\n }\n\n const meta = knownFiles.get(fileName)\n\n const watchTime = fileWatchTimes.get(fileName)\n const nextWatchTime = meta?.timestamp\n // If the file is showing up for the first time or the meta.timestamp is changed since last time\n // Files that were created before we started watching are not considered changed.\n // If any file was created by Next.js while booting, we assume those changes\n // are handled in the bootstrap phase.\n // Files that existed before we booted should be handled during bootstrapping.\n const fileChanged =\n (watchTime === undefined &&\n (nextWatchTime === undefined ||\n nextWatchTime >= initialWatchTime)) ||\n (watchTime && watchTime !== nextWatchTime)\n fileWatchTimes.set(fileName, nextWatchTime)\n\n if (envFiles.includes(fileName)) {\n if (fileChanged) {\n envChange = true\n }\n continue\n }\n\n if (tsconfigPaths.includes(fileName)) {\n if (fileName.endsWith('tsconfig.json')) {\n enabledTypeScript = true\n }\n if (fileChanged) {\n tsconfigChange = true\n }\n continue\n }\n\n if (\n meta?.accuracy === undefined ||\n !validFileMatcher.isPageFile(fileName)\n ) {\n continue\n }\n\n const isAppPath = Boolean(\n appDir &&\n normalizePathSep(fileName).startsWith(\n normalizePathSep(appDir) + '/'\n )\n )\n const isPagePath = Boolean(\n pagesDir &&\n normalizePathSep(fileName).startsWith(\n normalizePathSep(pagesDir) + '/'\n )\n )\n\n const rootFile = absolutePathToPage(fileName, {\n dir: dir,\n extensions: nextConfig.pageExtensions,\n keepIndex: false,\n pagesType: PAGE_TYPES.ROOT,\n })\n\n if (isMiddlewareFile(rootFile)) {\n const getStaticInfoIncludingLayouts = (\n require('../../../build/get-static-info-including-layouts') as typeof import('../../../build/get-static-info-including-layouts')\n ).getStaticInfoIncludingLayouts\n const staticInfo = await getStaticInfoIncludingLayouts({\n pageFilePath: fileName,\n config: nextConfig,\n appDir: appDir,\n page: rootFile,\n isDev: true,\n isInsideAppDir: isAppPath,\n pageExtensions: nextConfig.pageExtensions,\n })\n if (nextConfig.output === 'export') {\n Log.error(\n 'Middleware cannot be used with \"output: export\". See more info here: https://nextjs.org/docs/advanced-features/static-html-export'\n )\n continue\n }\n serverFields.actualMiddlewareFile = rootFile\n\n await propagateServerField(\n opts,\n 'actualMiddlewareFile',\n serverFields.actualMiddlewareFile\n )\n middlewareMatchers = staticInfo.middleware?.matchers || [\n { regexp: '^/.*$', originalSource: '/:path*' },\n ]\n continue\n }\n if (isInstrumentationHookFile(rootFile)) {\n serverFields.actualInstrumentationHookFile = rootFile\n await propagateServerField(\n opts,\n 'actualInstrumentationHookFile',\n serverFields.actualInstrumentationHookFile\n )\n continue\n }\n\n if (fileName.endsWith('.ts') || fileName.endsWith('.tsx')) {\n enabledTypeScript = true\n }\n\n if (!(isAppPath || isPagePath)) {\n continue\n }\n\n // Collect all current filenames for the TS plugin to use\n devPageFiles.add(fileName)\n\n let pageName = absolutePathToPage(fileName, {\n dir: isAppPath ? appDir! : pagesDir!,\n extensions: nextConfig.pageExtensions,\n keepIndex: isAppPath,\n pagesType: isAppPath ? PAGE_TYPES.APP : PAGE_TYPES.PAGES,\n })\n\n if (\n isAppPath &&\n appDir &&\n isMetadataRouteFile(\n fileName.replace(appDir, ''),\n nextConfig.pageExtensions,\n true\n )\n ) {\n const getPageStaticInfo = (\n require('../../../build/analysis/get-page-static-info') as typeof import('../../../build/analysis/get-page-static-info')\n ).getPageStaticInfo\n const staticInfo = await getPageStaticInfo({\n pageFilePath: fileName,\n nextConfig: {},\n page: pageName,\n isDev: true,\n pageType: PAGE_TYPES.APP,\n })\n\n pageName = normalizeMetadataPageToRoute(\n pageName,\n !!(staticInfo.generateSitemaps || staticInfo.generateImageMetadata)\n )\n }\n\n if (\n !isAppPath &&\n pageName.startsWith('/api/') &&\n nextConfig.output === 'export'\n ) {\n Log.error(\n 'API Routes cannot be used with \"output: export\". See more info here: https://nextjs.org/docs/advanced-features/static-html-export'\n )\n continue\n }\n\n if (isAppPath) {\n const isRootNotFound = validFileMatcher.isRootNotFound(fileName)\n hasRootAppNotFound = true\n\n if (isRootNotFound) {\n continue\n }\n\n // Ignore files/directories starting with `_` in the app directory\n if (normalizePathSep(pageName).includes('/_')) {\n continue\n }\n\n // Record parallel route slots for layout typing\n // May run multiple times (e.g. if a parallel route\n // has both a layout and a page, and children) but that's fine\n const segments = normalizePathSep(pageName).split('/')\n for (let i = segments.length - 1; i >= 0; i--) {\n const segment = segments[i]\n if (isParallelRouteSegment(segment)) {\n const parentPath = normalizeAppPath(\n segments.slice(0, i).join('/')\n )\n\n const slotName = segment.slice(1)\n // check if the slot already exists\n if (\n slots.some(\n (s) => s.name === slotName && s.parent === parentPath\n )\n )\n continue\n\n slots.push({\n name: slotName,\n parent: parentPath,\n })\n break\n }\n }\n\n // Record layouts\n if (validFileMatcher.isAppLayoutPage(fileName)) {\n layoutRoutes.push({\n route: ensureLeadingSlash(\n normalizeAppPath(normalizePathSep(pageName)).replace(\n /\\/layout$/,\n ''\n )\n ),\n filePath: fileName,\n })\n }\n\n if (!validFileMatcher.isAppRouterPage(fileName)) {\n continue\n }\n\n const originalPageName = pageName\n pageName = normalizeAppPath(pageName).replace(/%5F/g, '_')\n if (!appPaths[pageName]) {\n appPaths[pageName] = []\n }\n appPaths[pageName].push(\n opts.turbo\n ? // Turbopack outputs the correct path which is normalized with the `_`.\n originalPageName.replace(/%5F/g, '_')\n : originalPageName\n )\n\n if (useFileSystemPublicRoutes) {\n // Static metadata files will be served from filesystem.\n if (appDir && isStaticMetadataFile(fileName.replace(appDir, ''))) {\n staticMetadataFiles.set(pageName, fileName)\n } else {\n appFiles.add(pageName)\n }\n }\n\n if (validFileMatcher.isAppRouterRoute(fileName)) {\n appRouteHandlers.push({\n route: normalizePathSep(pageName),\n filePath: fileName,\n })\n } else {\n appRoutes.push({\n route: normalizePathSep(pageName),\n filePath: fileName,\n })\n }\n\n if (routedPages.includes(pageName)) {\n continue\n }\n } else {\n if (useFileSystemPublicRoutes) {\n pageFiles.add(pageName)\n // always add to nextDataRoutes for now but in future only add\n // entries that actually use getStaticProps/getServerSideProps\n opts.fsChecker.nextDataRoutes.add(pageName)\n }\n\n if (pageName.startsWith('/api/')) {\n pageApiRoutes.push({\n route: normalizePathSep(pageName),\n filePath: fileName,\n })\n } else {\n pageRoutes.push({\n route: normalizePathSep(pageName),\n filePath: fileName,\n })\n }\n }\n\n // Record pages\n if (isAppPath) {\n appPageFilePaths.set(pageName, fileName)\n } else {\n pagesPageFilePaths.set(pageName, fileName)\n }\n\n if (appDir && pageNameSet.has(pageName)) {\n conflictingAppPagePaths.add(pageName)\n } else {\n pageNameSet.add(pageName)\n }\n\n /**\n * If there is a middleware that is not declared in the root we will\n * warn without adding it so it doesn't make its way into the system.\n */\n if (/[\\\\\\\\/]_middleware$/.test(pageName)) {\n nestedMiddleware.push(pageName)\n continue\n }\n\n routedPages.push(pageName)\n }\n\n const numConflicting = conflictingAppPagePaths.size\n conflictingPageChange = numConflicting - previousConflictingPagePaths.size\n\n if (conflictingPageChange !== 0) {\n if (numConflicting > 0) {\n let errorMessage = `Conflicting app and page file${\n numConflicting === 1 ? ' was' : 's were'\n } found, please remove the conflicting files to continue:\\n`\n\n for (const p of conflictingAppPagePaths) {\n const appPath = path.relative(dir, appPageFilePaths.get(p)!)\n const pagesPath = path.relative(dir, pagesPageFilePaths.get(p)!)\n errorMessage += ` \"${pagesPath}\" - \"${appPath}\"\\n`\n }\n hotReloader.setHmrServerError(new Error(errorMessage))\n } else if (numConflicting === 0) {\n hotReloader.clearHmrServerError()\n await propagateServerField(opts, 'reloadMatchers', undefined)\n }\n }\n\n previousConflictingPagePaths = conflictingAppPagePaths\n\n let clientRouterFilters: any\n if (nextConfig.experimental.clientRouterFilter) {\n clientRouterFilters = createClientRouterFilter(\n Object.keys(appPaths),\n nextConfig.experimental.clientRouterFilterRedirects\n ? ((nextConfig as any)._originalRedirects || []).filter(\n (r: any) => !r.internal\n )\n : [],\n nextConfig.experimental.clientRouterFilterAllowedRate\n )\n\n if (\n !previousClientRouterFilters ||\n JSON.stringify(previousClientRouterFilters) !==\n JSON.stringify(clientRouterFilters)\n ) {\n envChange = true\n previousClientRouterFilters = clientRouterFilters\n }\n }\n\n if (envChange || tsconfigChange) {\n if (envChange) {\n writeEnvDefinitions = true\n\n await propagateServerField(opts, 'loadEnvConfig', [\n { dev: true, forceReload: true },\n ])\n }\n\n if (hotReloader.turbopackProject) {\n const hasRewrites =\n opts.fsChecker.rewrites.afterFiles.length > 0 ||\n opts.fsChecker.rewrites.beforeFiles.length > 0 ||\n opts.fsChecker.rewrites.fallback.length > 0\n\n const rootPath =\n opts.nextConfig.turbopack?.root ||\n opts.nextConfig.outputFileTracingRoot ||\n opts.dir\n await hotReloader.turbopackProject.update({\n defineEnv: createDefineEnv({\n isTurbopack: true,\n clientRouterFilters,\n config: nextConfig,\n dev: true,\n distDir,\n fetchCacheKeyPrefix:\n opts.nextConfig.experimental.fetchCacheKeyPrefix,\n hasRewrites,\n // TODO: Implement\n middlewareMatchers: undefined,\n projectPath: opts.dir,\n rewrites: opts.fsChecker.rewrites,\n }),\n rootPath,\n projectPath: normalizePath(path.relative(rootPath, dir)),\n })\n } else {\n let tsconfigResult:\n | UnwrapPromise<\n ReturnType<\n typeof import('../../../build/load-jsconfig').default\n >\n >\n | undefined\n // This is not relevant for Turbopack because tsconfig/jsconfig is handled internally.\n if (tsconfigChange) {\n try {\n const loadJsConfig = (\n require('../../../build/load-jsconfig') as typeof import('../../../build/load-jsconfig')\n ).default\n tsconfigResult = await loadJsConfig(dir, nextConfig)\n } catch (_) {\n /* do we want to log if there are syntax errors in tsconfig while editing? */\n }\n }\n\n hotReloader.activeWebpackConfigs?.forEach((config, idx) => {\n const isClient = idx === 0\n const isNodeServer = idx === 1\n const isEdgeServer = idx === 2\n const hasRewrites =\n opts.fsChecker.rewrites.afterFiles.length > 0 ||\n opts.fsChecker.rewrites.beforeFiles.length > 0 ||\n opts.fsChecker.rewrites.fallback.length > 0\n\n if (tsconfigChange) {\n config.resolve?.plugins?.forEach((plugin: any) => {\n // look for the JsConfigPathsPlugin and update with\n // the latest paths/baseUrl config\n if (plugin instanceof JsConfigPathsPlugin && tsconfigResult) {\n const { resolvedBaseUrl, jsConfig } = tsconfigResult\n const currentResolvedBaseUrl = plugin.resolvedBaseUrl\n const resolvedUrlIndex = config.resolve?.modules?.findIndex(\n (item) => item === currentResolvedBaseUrl?.baseUrl\n )\n\n if (resolvedBaseUrl) {\n if (\n resolvedBaseUrl.baseUrl !==\n currentResolvedBaseUrl?.baseUrl\n ) {\n // remove old baseUrl and add new one\n if (resolvedUrlIndex && resolvedUrlIndex > -1) {\n config.resolve?.modules?.splice(resolvedUrlIndex, 1)\n }\n\n // If the resolvedBaseUrl is implicit we only remove the previous value.\n // Only add the baseUrl if it's explicitly set in tsconfig/jsconfig\n if (!resolvedBaseUrl.isImplicit) {\n config.resolve?.modules?.push(resolvedBaseUrl.baseUrl)\n }\n }\n }\n\n if (jsConfig?.compilerOptions?.paths && resolvedBaseUrl) {\n Object.keys(plugin.paths).forEach((key) => {\n delete plugin.paths[key]\n })\n Object.assign(plugin.paths, jsConfig.compilerOptions.paths)\n plugin.resolvedBaseUrl = resolvedBaseUrl\n }\n }\n })\n }\n\n if (envChange) {\n config.plugins?.forEach((plugin: any) => {\n // we look for the DefinePlugin definitions so we can\n // update them on the active compilers\n if (\n plugin &&\n typeof plugin.definitions === 'object' &&\n plugin.definitions.__NEXT_DEFINE_ENV\n ) {\n const newDefine = getDefineEnv({\n isTurbopack: false,\n clientRouterFilters,\n config: nextConfig,\n dev: true,\n distDir,\n fetchCacheKeyPrefix:\n opts.nextConfig.experimental.fetchCacheKeyPrefix,\n hasRewrites,\n isClient,\n isEdgeServer,\n isNodeServer,\n middlewareMatchers: undefined,\n projectPath: opts.dir,\n rewrites: opts.fsChecker.rewrites,\n })\n\n Object.keys(plugin.definitions).forEach((key) => {\n if (!(key in newDefine)) {\n delete plugin.definitions[key]\n }\n })\n Object.assign(plugin.definitions, newDefine)\n }\n })\n }\n })\n }\n await hotReloader.invalidate({\n reloadAfterInvalidation: envChange,\n })\n }\n\n if (nestedMiddleware.length > 0) {\n Log.error(\n new NestedMiddlewareError(\n nestedMiddleware,\n dir,\n (pagesDir || appDir)!\n ).message\n )\n nestedMiddleware = []\n }\n\n // Make sure to sort parallel routes to make the result deterministic.\n serverFields.appPathRoutes = Object.fromEntries(\n Object.entries(appPaths).map(([k, v]) => [k, v.sort()])\n )\n await propagateServerField(\n opts,\n 'appPathRoutes',\n serverFields.appPathRoutes\n )\n\n // TODO: pass this to fsChecker/next-dev-server?\n serverFields.middleware = middlewareMatchers\n ? {\n match: null as any,\n page: '/',\n matchers: middlewareMatchers,\n }\n : undefined\n\n await propagateServerField(opts, 'middleware', serverFields.middleware)\n serverFields.hasAppNotFound = hasRootAppNotFound\n\n opts.fsChecker.middlewareMatcher = serverFields.middleware?.matchers\n ? getMiddlewareRouteMatcher(serverFields.middleware?.matchers)\n : undefined\n\n const interceptionRoutes = generateInterceptionRoutesRewrites(\n Object.keys(appPaths),\n opts.nextConfig.basePath\n ).map((item) =>\n buildCustomRoute(\n 'before_files_rewrite',\n item,\n opts.nextConfig.basePath,\n opts.nextConfig.experimental.caseSensitiveRoutes\n )\n )\n\n opts.fsChecker.rewrites.beforeFiles.push(...interceptionRoutes)\n\n const exportPathMap =\n (typeof nextConfig.exportPathMap === 'function' &&\n (await nextConfig.exportPathMap?.(\n {},\n {\n dev: true,\n dir: opts.dir,\n outDir: null,\n distDir: distDir,\n buildId: 'development',\n }\n ))) ||\n {}\n\n const exportPathMapEntries = Object.entries(exportPathMap || {})\n\n if (exportPathMapEntries.length > 0) {\n opts.fsChecker.exportPathMapRoutes = exportPathMapEntries.map(\n ([key, value]) =>\n buildCustomRoute(\n 'before_files_rewrite',\n {\n source: key,\n destination: `${value.page}${\n value.query ? '?' : ''\n }${qs.stringify(value.query)}`,\n },\n opts.nextConfig.basePath,\n opts.nextConfig.experimental.caseSensitiveRoutes\n )\n )\n }\n\n try {\n // we serve a separate manifest with all pages for the client in\n // dev mode so that we can match a page after a rewrite on the client\n // before it has been built and is populated in the _buildManifest\n const sortedRoutes = getSortedRoutes(routedPages)\n\n opts.fsChecker.dynamicRoutes = sortedRoutes.map(\n (page): FilesystemDynamicRoute => {\n const regex = getNamedRouteRegex(page, {\n prefixRouteKeys: true,\n })\n return {\n regex: regex.re.toString(),\n namedRegex: regex.namedRegex,\n routeKeys: regex.routeKeys,\n match: getRouteMatcher(regex),\n page,\n }\n }\n )\n\n const dataRoutes: typeof opts.fsChecker.dynamicRoutes = []\n\n for (const page of sortedRoutes) {\n const route = buildDataRoute(page, 'development')\n const routeRegex = getNamedRouteRegex(route.page, {\n prefixRouteKeys: true,\n })\n dataRoutes.push({\n ...route,\n regex: routeRegex.re.toString(),\n namedRegex: routeRegex.namedRegex,\n routeKeys: routeRegex.routeKeys,\n match: getRouteMatcher({\n // TODO: fix this in the manifest itself, must also be fixed in\n // upstream builder that relies on this\n re: opts.nextConfig.i18n\n ? new RegExp(\n route.dataRouteRegex.replace(\n `/development/`,\n `/development/(?<nextLocale>[^/]+?)/`\n )\n )\n : new RegExp(route.dataRouteRegex),\n groups: routeRegex.groups,\n }),\n })\n }\n opts.fsChecker.dynamicRoutes.unshift(...dataRoutes)\n\n // For Turbopack ADDED_PAGE and REMOVED_PAGE are implemented in hot-reloader-turbopack.ts\n // in order to avoid a race condition where ADDED_PAGE and REMOVED_PAGE are sent before Turbopack picked up the file change.\n if (!opts.turbo) {\n // Reload the matchers. The filesystem would have been written to,\n // and the matchers need to re-scan it to update the router.\n // Reloading the matchers should happen before `ADDED_PAGE` or `REMOVED_PAGE` is sent over the websocket\n // otherwise it sends the event too early.\n await propagateServerField(opts, 'reloadMatchers', undefined)\n\n if (\n !prevSortedRoutes?.every((val, idx) => val === sortedRoutes[idx])\n ) {\n const addedRoutes = sortedRoutes.filter(\n (route) => !prevSortedRoutes.includes(route)\n )\n const removedRoutes = prevSortedRoutes.filter(\n (route) => !sortedRoutes.includes(route)\n )\n\n // emit the change so clients fetch the update\n hotReloader.send({\n type: HMR_MESSAGE_SENT_TO_BROWSER.DEV_PAGES_MANIFEST_UPDATE,\n data: [\n {\n devPagesManifest: true,\n },\n ],\n })\n\n addedRoutes.forEach((route) => {\n hotReloader.send({\n type: HMR_MESSAGE_SENT_TO_BROWSER.ADDED_PAGE,\n data: [route],\n })\n })\n\n removedRoutes.forEach((route) => {\n hotReloader.send({\n type: HMR_MESSAGE_SENT_TO_BROWSER.REMOVED_PAGE,\n data: [route],\n })\n })\n }\n }\n prevSortedRoutes = sortedRoutes\n\n if (enabledTypeScript) {\n // Using === false to make the check clearer.\n if (typescriptStatusFromLastAggregation === false) {\n // we tolerate the error here as this is best effort\n // and the manual install command will be shown\n await verifyTypeScript(opts)\n .then(() => {\n tsconfigChange = true\n })\n .catch(() => {})\n }\n\n if (writeEnvDefinitions && nextConfig.experimental?.typedEnv) {\n // TODO: The call to propagateServerField 'loadEnvConfig' causes the env to be loaded twice on env file changes.\n const loadEnvConfig = (\n require('@next/env') as typeof import('@next/env')\n ).loadEnvConfig\n const { loadedEnvFiles } = loadEnvConfig(\n dir,\n process.env.NODE_ENV === 'development',\n // Silent as it's the second time `loadEnvConfig` is called in this pass.\n undefined,\n true\n )\n\n const createEnvDefinitions = (\n require('../experimental/create-env-definitions') as typeof import('../experimental/create-env-definitions')\n ).createEnvDefinitions\n await createEnvDefinitions({\n distDir,\n loadedEnvFiles: [\n ...loadedEnvFiles,\n {\n path: nextConfig.configFileName,\n env: nextConfig.env,\n contents: '',\n },\n ],\n })\n }\n\n const routeTypesManifest = await createRouteTypesManifest({\n dir,\n pageRoutes,\n appRoutes,\n layoutRoutes,\n slots,\n redirects: opts.nextConfig.redirects,\n rewrites: opts.nextConfig.rewrites,\n // Ensure relative paths in validator.ts are computed from validatorFilePath,\n // matching behavior of build and CLI typegen.\n validatorFilePath,\n appRouteHandlers,\n pageApiRoutes,\n })\n\n await writeRouteTypesManifest(\n routeTypesManifest,\n routeTypesFilePath,\n opts.nextConfig\n )\n await writeValidatorFile(routeTypesManifest, validatorFilePath)\n\n // Generate cache-life types if cacheLife config exists\n const cacheLifeFilePath = path.join(distTypesDir, 'cache-life.d.ts')\n writeCacheLifeTypes(opts.nextConfig.cacheLife, cacheLifeFilePath)\n }\n\n if (!resolved) {\n resolve()\n resolved = true\n }\n } catch (e) {\n if (!resolved) {\n reject(e)\n resolved = true\n } else {\n Log.warn('Failed to reload dynamic routes:', e)\n }\n }\n })\n\n wp.watch({ directories: [dir], startTime: 0 })\n })\n\n const clientPagesManifestPath = `/_next/${CLIENT_STATIC_FILES_PATH}/development/${DEV_CLIENT_PAGES_MANIFEST}`\n opts.fsChecker.devVirtualFsItems.add(clientPagesManifestPath)\n\n const devMiddlewareManifestPath = `/_next/${CLIENT_STATIC_FILES_PATH}/development/${DEV_CLIENT_MIDDLEWARE_MANIFEST}`\n opts.fsChecker.devVirtualFsItems.add(devMiddlewareManifestPath)\n\n const devTurbopackMiddlewareManifestPath = `/_next/${CLIENT_STATIC_FILES_PATH}/development/${TURBOPACK_CLIENT_MIDDLEWARE_MANIFEST}`\n opts.fsChecker.devVirtualFsItems.add(devTurbopackMiddlewareManifestPath)\n\n async function requestHandler(req: IncomingMessage, res: ServerResponse) {\n const parsedUrl = parseUrl(req.url || '/')\n const pathname = parsedUrl !== undefined ? parsedUrl.pathname : null\n\n if (pathname !== null && pathname.includes(clientPagesManifestPath)) {\n res.statusCode = 200\n res.setHeader('Content-Type', JSON_CONTENT_TYPE_HEADER)\n res.end(\n JSON.stringify({\n pages: prevSortedRoutes.filter(\n (route) => !opts.fsChecker.appFiles.has(route)\n ),\n })\n )\n return { finished: true }\n }\n\n if (\n pathname !== null &&\n (pathname.includes(devMiddlewareManifestPath) ||\n pathname.includes(devTurbopackMiddlewareManifestPath))\n ) {\n res.statusCode = 200\n res.setHeader('Content-Type', JSON_CONTENT_TYPE_HEADER)\n res.end(JSON.stringify(serverFields.middleware?.matchers || []))\n return { finished: true }\n }\n return { finished: false }\n }\n\n function logErrorWithOriginalStack(\n err: unknown,\n type?: 'unhandledRejection' | 'uncaughtException' | 'warning' | 'app-dir'\n ) {\n if (err instanceof Error) {\n err.message = deobfuscateText(err.message)\n }\n if (err instanceof ModuleBuildError) {\n // Errors that may come from issues from the user's code\n Log.error(err.message)\n } else if (err instanceof TurbopackInternalError) {\n // An internal Turbopack error that has been handled by next-swc, written\n // to disk and a simplified message shown to user on the Rust side.\n } else if (type === 'warning') {\n Log.warn(err)\n } else if (type === 'app-dir') {\n Log.error(err)\n } else if (type) {\n Log.error(`${type}:`, err)\n } else {\n Log.error(err)\n }\n }\n\n return {\n serverFields,\n hotReloader,\n requestHandler,\n logErrorWithOriginalStack,\n\n async ensureMiddleware(requestUrl?: string) {\n if (!serverFields.actualMiddlewareFile) return\n return hotReloader.ensurePage({\n page: serverFields.actualMiddlewareFile,\n clientOnly: false,\n definition: undefined,\n url: requestUrl,\n })\n },\n }\n}\n\nexport async function setupDevBundler(opts: SetupOpts) {\n const isSrcDir = path\n .relative(opts.dir, opts.pagesDir || opts.appDir || '')\n .startsWith('src')\n await installBindings(opts.nextConfig.experimental?.useWasmBinary)\n const result = await startWatcher({\n ...opts,\n isSrcDir,\n })\n\n opts.telemetry.record(\n eventCliSession(opts.nextConfig, {\n webpackVersion: 5,\n isSrcDir,\n turboFlag: !!opts.turbo,\n cliCommand: 'dev',\n appDir: !!opts.appDir,\n pagesDir: !!opts.pagesDir,\n isCustomServer: !!opts.isCustomServer,\n hasNowJson: !!(await findUp('now.json', { cwd: opts.dir })),\n })\n )\n\n // Track build features for dev server here:\n opts.telemetry.record({\n eventName: EVENT_BUILD_FEATURE_USAGE,\n payload: {\n featureName: 'turbopackFileSystemCache',\n invocationCount: isFileSystemCacheEnabledForDev(opts.nextConfig) ? 1 : 0,\n },\n })\n\n return result\n}\n\nexport type DevBundler = Awaited<ReturnType<typeof setupDevBundler>>\n\n// Returns a trace rewritten through Turbopack's sourcemaps\n"],"names":["createDefineEnv","installBindings","fs","path","qs","Watchpack","findUp","buildCustomRoute","Log","setGlobal","createValidFileMatcher","EVENT_BUILD_FEATURE_USAGE","eventCliSession","getSortedRoutes","sortByPageExts","verifyTypeScriptSetup","verifyPartytownSetup","getNamedRouteRegex","normalizeAppPath","buildDataRoute","getRouteMatcher","normalizePathSep","createClientRouterFilter","absolutePathToPage","generateInterceptionRoutesRewrites","CLIENT_STATIC_FILES_PATH","DEV_CLIENT_PAGES_MANIFEST","DEV_CLIENT_MIDDLEWARE_MANIFEST","PHASE_DEVELOPMENT_SERVER","TURBOPACK_CLIENT_MIDDLEWARE_MANIFEST","ROUTES_MANIFEST","PRERENDER_MANIFEST","getMiddlewareRouteMatcher","isMiddlewareFile","NestedMiddlewareError","isInstrumentationHookFile","getPossibleMiddlewareFilenames","getPossibleInstrumentationHookFilenames","devPageFiles","HMR_MESSAGE_SENT_TO_BROWSER","PAGE_TYPES","generateEncryptionKeyBase64","isMetadataRouteFile","isStaticMetadataFile","normalizeMetadataPageToRoute","JsConfigPathsPlugin","store","consoleStore","isFileSystemCacheEnabledForDev","ModuleBuildError","getDefineEnv","TurbopackInternalError","normalizePath","JSON_CONTENT_TYPE_HEADER","MIDDLEWARE_FILENAME","PROXY_FILENAME","parseUrl","createRouteTypesManifest","writeRouteTypesManifest","writeValidatorFile","writeCacheLifeTypes","isParallelRouteSegment","ensureLeadingSlash","Lockfile","deobfuscateText","verifyTypeScript","opts","verifyResult","dir","distDir","nextConfig","typeCheckPreflight","tsconfigPath","typescript","disableStaticImages","images","hasAppDir","appDir","hasPagesDir","pagesDir","isolatedDevBuild","experimental","version","propagateServerField","field","args","renderServer","instance","startWatcher","resetFetch","useFileSystemPublicRoutes","join","lockfile","lockDistDir","mkdirSync","recursive","acquireWithRetriesOrExit","validFileMatcher","pageExtensions","serverFields","setState","logging","hotReloader","turbo","createHotReloaderTurbopack","require","HotReloader","process","env","NEXT_RSPACK","default","isSrcDir","config","buildId","encryptionKey","isBuild","telemetry","rewrites","fsChecker","previewProps","prerenderManifest","preview","onDevServerCleanup","start","distTypesDir","appRoutes","pageRoutes","layoutRoutes","appRouteHandlerRoutes","redirectRoutes","rewriteRoutes","appPagePaths","Set","pagesRouterPagePaths","layoutPaths","appRouteHandlers","pageApiRoutes","filePathToRoute","Map","routesManifestPath","routesManifest","caseSensitive","caseSensitiveRoutes","basePath","redirects","headers","i18n","undefined","skipProxyUrlNormalize","promises","writeFile","JSON","stringify","prerenderManifestPath","nextScriptWorkers","ensureCallback","ensure","item","type","ensurePage","clientOnly","page","itemPath","isApp","definition","resolved","prevSortedRoutes","Promise","resolve","reject","readdir","_","files","length","pages","app","directories","rootDir","nestedMiddleware","envFiles","map","file","push","tsconfigPaths","wp","aggregateTimeout","ignored","pathname","some","startsWith","d","fileWatchTimes","enabledTypeScript","previousClientRouterFilters","previousConflictingPagePaths","routeTypesFilePath","validatorFilePath","initialWatchTime","performance","now","timeOrigin","on","writeEnvDefinitions","typescriptStatusFromLastAggregation","middlewareMatchers","routedPages","knownFiles","getTimeInfoEntries","appPaths","pageNameSet","conflictingAppPagePaths","appPageFilePaths","pagesPageFilePaths","slots","envChange","tsconfigChange","conflictingPageChange","hasRootAppNotFound","appFiles","pageFiles","staticMetadataFiles","clear","sortedKnownFiles","keys","sort","proxyFilePath","middlewareFilePath","fileName","includes","name","fileBaseName","fileDir","parse","isAtConventionLevel","cwd","Error","relative","warnOnce","meta","get","watchTime","nextWatchTime","timestamp","fileChanged","set","endsWith","accuracy","isPageFile","isAppPath","Boolean","isPagePath","rootFile","extensions","keepIndex","pagesType","ROOT","staticInfo","getStaticInfoIncludingLayouts","pageFilePath","isDev","isInsideAppDir","output","error","actualMiddlewareFile","middleware","matchers","regexp","originalSource","actualInstrumentationHookFile","add","pageName","APP","PAGES","replace","getPageStaticInfo","pageType","generateSitemaps","generateImageMetadata","isRootNotFound","segments","split","i","segment","parentPath","slice","slotName","s","parent","isAppLayoutPage","route","filePath","isAppRouterPage","originalPageName","isAppRouterRoute","nextDataRoutes","has","test","numConflicting","size","errorMessage","p","appPath","pagesPath","setHmrServerError","clearHmrServerError","clientRouterFilters","clientRouterFilter","Object","clientRouterFilterRedirects","_originalRedirects","filter","r","internal","clientRouterFilterAllowedRate","dev","forceReload","turbopackProject","hasRewrites","afterFiles","beforeFiles","fallback","rootPath","turbopack","root","outputFileTracingRoot","update","defineEnv","isTurbopack","fetchCacheKeyPrefix","projectPath","tsconfigResult","loadJsConfig","activeWebpackConfigs","forEach","idx","isClient","isNodeServer","isEdgeServer","plugins","plugin","jsConfig","resolvedBaseUrl","currentResolvedBaseUrl","resolvedUrlIndex","modules","findIndex","baseUrl","splice","isImplicit","compilerOptions","paths","key","assign","definitions","__NEXT_DEFINE_ENV","newDefine","invalidate","reloadAfterInvalidation","message","appPathRoutes","fromEntries","entries","k","v","match","hasAppNotFound","middlewareMatcher","interceptionRoutes","exportPathMap","outDir","exportPathMapEntries","exportPathMapRoutes","value","source","destination","query","sortedRoutes","dynamicRoutes","regex","prefixRouteKeys","re","toString","namedRegex","routeKeys","dataRoutes","routeRegex","RegExp","dataRouteRegex","groups","unshift","every","val","addedRoutes","removedRoutes","send","DEV_PAGES_MANIFEST_UPDATE","data","devPagesManifest","ADDED_PAGE","REMOVED_PAGE","then","catch","typedEnv","loadEnvConfig","loadedEnvFiles","NODE_ENV","createEnvDefinitions","configFileName","contents","routeTypesManifest","cacheLifeFilePath","cacheLife","e","warn","watch","startTime","clientPagesManifestPath","devVirtualFsItems","devMiddlewareManifestPath","devTurbopackMiddlewareManifestPath","requestHandler","req","res","parsedUrl","url","statusCode","setHeader","end","finished","logErrorWithOriginalStack","err","ensureMiddleware","requestUrl","setupDevBundler","useWasmBinary","result","record","webpackVersion","turbo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kD,SAAS,CAACgU,MAAM,CACnBxa,gBAAgBsD,KAAKI,UAAU,EAAE;QAC/B+W,gBAAgB;QAChBtU;QACAuU,WAAW,CAAC,CAACpX,KAAKqC,KAAK;QACvBgV,YAAY;QACZ1W,QAAQ,CAAC,CAACX,KAAKW,MAAM;QACrBE,UAAU,CAAC,CAACb,KAAKa,QAAQ;QACzByW,gBAAgB,CAAC,CAACtX,KAAKsX,cAAc;QACrCC,YAAY,CAAC,CAAE,MAAMnb,OAAO,YAAY;YAAEoO,KAAKxK,KAAKE,GAAG;QAAC;IAC1D;IAGF,4CAA4C;IAC5CF,KAAKkD,SAAS,CAACgU,MAAM,CAAC;QACpBM,WAAW/a;QACXgb,SAAS;YACPC,aAAa;YACbC,iBAAiB7Y,+BAA+BkB,KAAKI,UAAU,IAAI,IAAI;QACzE;IACF;IAEA,OAAO6W;AACT;CAIA,2DAA2D","ignoreList":[0]}
1
+ {"version":3,"sources":["../../../../../src/server/lib/router-utils/setup-dev-bundler.ts"],"sourcesContent":["import type { NextConfigComplete } from '../../config-shared'\nimport type { FilesystemDynamicRoute } from './filesystem'\nimport type { UnwrapPromise } from '../../../lib/coalesced-function'\nimport type { ProxyMatcher } from '../../../build/analysis/get-page-static-info'\nimport type { RoutesManifest } from '../../../build'\nimport type { MiddlewareRouteMatch } from '../../../shared/lib/router/utils/middleware-route-matcher'\nimport type { PropagateToWorkersField } from './types'\nimport type { NextJsHotReloaderInterface } from '../../dev/hot-reloader-types'\n\nimport { createDefineEnv } from '../../../build/swc'\nimport { installBindings } from '../../../build/swc/install-bindings'\nimport fs from 'fs'\nimport path from 'path'\nimport qs from 'querystring'\nimport Watchpack from 'next/dist/compiled/watchpack'\nimport findUp from 'next/dist/compiled/find-up'\nimport { buildCustomRoute } from './filesystem'\nimport * as Log from '../../../build/output/log'\nimport { setGlobal } from '../../../trace/shared'\nimport type { Telemetry } from '../../../telemetry/storage'\nimport type { IncomingMessage, ServerResponse } from 'http'\nimport { createValidFileMatcher } from '../find-page-file'\nimport {\n EVENT_BUILD_FEATURE_USAGE,\n eventCliSession,\n} from '../../../telemetry/events'\nimport { getSortedRoutes } from '../../../shared/lib/router/utils'\nimport { sortByPageExts } from '../../../build/sort-by-page-exts'\nimport { verifyTypeScriptSetup } from '../../../lib/verify-typescript-setup'\nimport { verifyPartytownSetup } from '../../../lib/verify-partytown-setup'\nimport { getNamedRouteRegex } from '../../../shared/lib/router/utils/route-regex'\nimport { normalizeAppPath } from '../../../shared/lib/router/utils/app-paths'\nimport { buildDataRoute } from './build-data-route'\nimport { getRouteMatcher } from '../../../shared/lib/router/utils/route-matcher'\nimport { normalizePathSep } from '../../../shared/lib/page-path/normalize-path-sep'\nimport { createClientRouterFilter } from '../../../lib/create-client-router-filter'\nimport { absolutePathToPage } from '../../../shared/lib/page-path/absolute-path-to-page'\nimport { generateInterceptionRoutesRewrites } from '../../../lib/generate-interception-routes-rewrites'\n\nimport {\n CLIENT_STATIC_FILES_PATH,\n DEV_CLIENT_PAGES_MANIFEST,\n DEV_CLIENT_MIDDLEWARE_MANIFEST,\n PHASE_DEVELOPMENT_SERVER,\n TURBOPACK_CLIENT_MIDDLEWARE_MANIFEST,\n ROUTES_MANIFEST,\n PRERENDER_MANIFEST,\n} from '../../../shared/lib/constants'\n\nimport { getMiddlewareRouteMatcher } from '../../../shared/lib/router/utils/middleware-route-matcher'\n\nimport {\n isMiddlewareFile,\n NestedMiddlewareError,\n isInstrumentationHookFile,\n getPossibleMiddlewareFilenames,\n getPossibleInstrumentationHookFilenames,\n} from '../../../build/utils'\nimport { devPageFiles } from '../../../build/webpack/plugins/next-types-plugin/shared'\nimport type { LazyRenderServerInstance } from '../router-server'\nimport { HMR_MESSAGE_SENT_TO_BROWSER } from '../../dev/hot-reloader-types'\nimport { PAGE_TYPES } from '../../../lib/page-types'\nimport { generateEncryptionKeyBase64 } from '../../app-render/encryption-utils-server'\nimport {\n isMetadataRouteFile,\n isStaticMetadataFile,\n} from '../../../lib/metadata/is-metadata-route'\nimport { normalizeMetadataPageToRoute } from '../../../lib/metadata/get-metadata-route'\nimport { JsConfigPathsPlugin } from '../../../build/webpack/plugins/jsconfig-paths-plugin'\nimport { store as consoleStore } from '../../../build/output/store'\nimport {\n isFileSystemCacheEnabledForDev,\n ModuleBuildError,\n} from '../../../shared/lib/turbopack/utils'\nimport { getDefineEnv } from '../../../build/define-env'\nimport { TurbopackInternalError } from '../../../shared/lib/turbopack/internal-error'\nimport { normalizePath } from '../../../lib/normalize-path'\nimport {\n JSON_CONTENT_TYPE_HEADER,\n MIDDLEWARE_FILENAME,\n PROXY_FILENAME,\n} from '../../../lib/constants'\nimport { parseUrl } from '../../../lib/url'\nimport {\n createRouteTypesManifest,\n writeRouteTypesManifest,\n writeValidatorFile,\n} from './route-types-utils'\nimport { writeCacheLifeTypes } from './cache-life-type-utils'\nimport { isParallelRouteSegment } from '../../../shared/lib/segment'\nimport { ensureLeadingSlash } from '../../../shared/lib/page-path/ensure-leading-slash'\nimport { Lockfile } from '../../../build/lockfile'\nimport { deobfuscateText } from '../../../shared/lib/magic-identifier'\n\nexport type SetupOpts = {\n renderServer: LazyRenderServerInstance\n dir: string\n turbo?: boolean\n appDir?: string\n pagesDir?: string\n telemetry: Telemetry\n isCustomServer?: boolean\n fsChecker: UnwrapPromise<\n ReturnType<typeof import('./filesystem').setupFsCheck>\n >\n nextConfig: NextConfigComplete\n port: number\n onDevServerCleanup: ((listener: () => Promise<void>) => void) | undefined\n resetFetch: () => void\n}\n\nexport interface DevRoutesManifest {\n version: number\n caseSensitive: RoutesManifest['caseSensitive']\n basePath: RoutesManifest['basePath']\n rewrites: RoutesManifest['rewrites']\n redirects: RoutesManifest['redirects']\n headers: RoutesManifest['headers']\n i18n: RoutesManifest['i18n']\n skipProxyUrlNormalize: RoutesManifest['skipProxyUrlNormalize']\n}\n\nexport type ServerFields = {\n actualMiddlewareFile?: string | undefined\n actualInstrumentationHookFile?: string | undefined\n appPathRoutes?: Record<string, string | string[]>\n middleware?:\n | {\n page: string\n match: MiddlewareRouteMatch\n matchers?: ProxyMatcher[]\n }\n | undefined\n hasAppNotFound?: boolean\n interceptionRoutes?: ReturnType<\n typeof import('./filesystem').buildCustomRoute\n >[]\n setIsrStatus?: (key: string, value: boolean | undefined) => void\n resetFetch?: () => void\n}\n\nasync function verifyTypeScript(opts: SetupOpts) {\n const verifyResult = await verifyTypeScriptSetup({\n dir: opts.dir,\n distDir: opts.nextConfig.distDir,\n typeCheckPreflight: false,\n tsconfigPath: opts.nextConfig.typescript.tsconfigPath,\n disableStaticImages: opts.nextConfig.images.disableStaticImages,\n hasAppDir: !!opts.appDir,\n hasPagesDir: !!opts.pagesDir,\n isolatedDevBuild: opts.nextConfig.experimental.isolatedDevBuild,\n appDir: opts.appDir,\n pagesDir: opts.pagesDir,\n })\n\n if (verifyResult.version) {\n return true\n }\n return false\n}\n\nexport async function propagateServerField(\n opts: SetupOpts,\n field: PropagateToWorkersField,\n args: any\n) {\n await opts.renderServer?.instance?.propagateServerField(opts.dir, field, args)\n}\n\nasync function startWatcher(\n opts: SetupOpts & {\n isSrcDir: boolean\n }\n) {\n const { nextConfig, appDir, pagesDir, dir, resetFetch } = opts\n const { useFileSystemPublicRoutes } = nextConfig\n\n const distDir = path.join(opts.dir, opts.nextConfig.distDir)\n\n setGlobal('distDir', distDir)\n setGlobal('phase', PHASE_DEVELOPMENT_SERVER)\n\n let lockfile\n if (opts.nextConfig.experimental.lockDistDir) {\n fs.mkdirSync(distDir, { recursive: true })\n lockfile = await Lockfile.acquireWithRetriesOrExit(\n path.join(distDir, 'lock'),\n 'next dev'\n )\n }\n\n const validFileMatcher = createValidFileMatcher(\n nextConfig.pageExtensions,\n appDir\n )\n\n const serverFields: ServerFields = {}\n\n // Update logging state once based on next.config.js when initializing\n consoleStore.setState({\n logging: nextConfig.logging !== false,\n })\n\n const hotReloader: NextJsHotReloaderInterface = opts.turbo\n ? await (async () => {\n const createHotReloaderTurbopack = (\n require('../../dev/hot-reloader-turbopack') as typeof import('../../dev/hot-reloader-turbopack')\n ).createHotReloaderTurbopack\n return await createHotReloaderTurbopack(\n opts,\n serverFields,\n distDir,\n resetFetch,\n lockfile\n )\n })()\n : await (async () => {\n const HotReloader = process.env.NEXT_RSPACK\n ? (\n require('../../dev/hot-reloader-rspack') as typeof import('../../dev/hot-reloader-rspack')\n ).default\n : (\n require('../../dev/hot-reloader-webpack') as typeof import('../../dev/hot-reloader-webpack')\n ).default\n return new HotReloader(opts.dir, {\n isSrcDir: opts.isSrcDir,\n appDir,\n pagesDir,\n distDir,\n config: opts.nextConfig,\n buildId: 'development',\n encryptionKey: await generateEncryptionKeyBase64({\n isBuild: false,\n distDir,\n }),\n telemetry: opts.telemetry,\n rewrites: opts.fsChecker.rewrites,\n previewProps: opts.fsChecker.prerenderManifest.preview,\n resetFetch,\n lockfile,\n onDevServerCleanup: opts.onDevServerCleanup,\n })\n })()\n\n await hotReloader.start()\n\n // have to write this after starting hot-reloader since that\n // cleans the dist dir\n const distTypesDir = path.join(distDir, 'types')\n await writeRouteTypesManifest(\n {\n appRoutes: {},\n pageRoutes: {},\n layoutRoutes: {},\n appRouteHandlerRoutes: {},\n redirectRoutes: {},\n rewriteRoutes: {},\n appPagePaths: new Set(),\n pagesRouterPagePaths: new Set(),\n layoutPaths: new Set(),\n appRouteHandlers: new Set(),\n pageApiRoutes: new Set(),\n filePathToRoute: new Map(),\n },\n path.join(distTypesDir, 'routes.d.ts'),\n opts.nextConfig\n )\n\n const routesManifestPath = path.join(distDir, ROUTES_MANIFEST)\n const routesManifest: DevRoutesManifest = {\n version: 3,\n caseSensitive: !!nextConfig.experimental.caseSensitiveRoutes,\n basePath: nextConfig.basePath,\n rewrites: opts.fsChecker.rewrites,\n redirects: opts.fsChecker.redirects,\n headers: opts.fsChecker.headers,\n i18n: nextConfig.i18n || undefined,\n skipProxyUrlNormalize: nextConfig.skipProxyUrlNormalize,\n }\n await fs.promises.writeFile(\n routesManifestPath,\n JSON.stringify(routesManifest)\n )\n\n const prerenderManifestPath = path.join(distDir, PRERENDER_MANIFEST)\n await fs.promises.writeFile(\n prerenderManifestPath,\n JSON.stringify(opts.fsChecker.prerenderManifest, null, 2)\n )\n\n if (opts.nextConfig.experimental.nextScriptWorkers) {\n await verifyPartytownSetup(\n opts.dir,\n path.join(distDir, CLIENT_STATIC_FILES_PATH)\n )\n }\n\n opts.fsChecker.ensureCallback(async function ensure(item) {\n if (item.type === 'appFile' || item.type === 'pageFile') {\n await hotReloader.ensurePage({\n clientOnly: false,\n page: item.itemPath,\n isApp: item.type === 'appFile',\n definition: undefined,\n })\n }\n })\n\n let resolved = false\n let prevSortedRoutes: string[] = []\n\n await new Promise<void>(async (resolve, reject) => {\n if (pagesDir) {\n // Watchpack doesn't emit an event for an empty directory\n fs.readdir(pagesDir, (_, files) => {\n if (files?.length) {\n return\n }\n\n if (!resolved) {\n resolve()\n resolved = true\n }\n })\n }\n\n const pages = pagesDir ? [pagesDir] : []\n const app = appDir ? [appDir] : []\n const directories = [...pages, ...app]\n\n const rootDir = pagesDir || appDir\n const files = [\n ...getPossibleMiddlewareFilenames(\n path.join(rootDir!, '..'),\n nextConfig.pageExtensions\n ),\n ...getPossibleInstrumentationHookFilenames(\n path.join(rootDir!, '..'),\n nextConfig.pageExtensions\n ),\n ]\n let nestedMiddleware: string[] = []\n\n const envFiles = [\n '.env.development.local',\n '.env.local',\n '.env.development',\n '.env',\n ].map((file) => path.join(dir, file))\n\n files.push(...envFiles)\n\n // tsconfig/jsconfig paths hot-reloading\n const tsconfigPaths = [\n path.join(dir, 'tsconfig.json'),\n path.join(dir, 'jsconfig.json'),\n ] as const\n files.push(...tsconfigPaths)\n\n const wp = new Watchpack({\n // Watchpack default is 200ms which adds 200ms of dead time on bootup.\n aggregateTimeout: 5, // Matches webpack-config.ts.\n ignored: (pathname: string) => {\n return (\n !files.some((file) => file.startsWith(pathname)) &&\n !directories.some(\n (d) => pathname.startsWith(d) || d.startsWith(pathname)\n )\n )\n },\n })\n const fileWatchTimes = new Map()\n let enabledTypeScript = await verifyTypeScript(opts)\n let previousClientRouterFilters: any\n let previousConflictingPagePaths: Set<string> = new Set()\n\n const routeTypesFilePath = path.join(distDir, 'types', 'routes.d.ts')\n const validatorFilePath = path.join(distDir, 'types', 'validator.ts')\n\n let initialWatchTime = performance.now() + performance.timeOrigin\n wp.on('aggregated', async () => {\n let writeEnvDefinitions = false\n let typescriptStatusFromLastAggregation = enabledTypeScript\n let middlewareMatchers: ProxyMatcher[] | undefined\n const routedPages: string[] = []\n const knownFiles = wp.getTimeInfoEntries()\n const appPaths: Record<string, string[]> = {}\n const pageNameSet = new Set<string>()\n const conflictingAppPagePaths = new Set<string>()\n const appPageFilePaths = new Map<string, string>()\n const pagesPageFilePaths = new Map<string, string>()\n const appRouteHandlers: Array<{ route: string; filePath: string }> = []\n const pageApiRoutes: Array<{ route: string; filePath: string }> = []\n\n const pageRoutes: Array<{ route: string; filePath: string }> = []\n const appRoutes: Array<{ route: string; filePath: string }> = []\n const layoutRoutes: Array<{ route: string; filePath: string }> = []\n const slots: Array<{ name: string; parent: string }> = []\n\n let envChange = false\n let tsconfigChange = false\n let conflictingPageChange = 0\n let hasRootAppNotFound = false\n\n const { appFiles, pageFiles, staticMetadataFiles } = opts.fsChecker\n\n appFiles.clear()\n pageFiles.clear()\n staticMetadataFiles.clear()\n devPageFiles.clear()\n\n const sortedKnownFiles: string[] = [...knownFiles.keys()].sort(\n sortByPageExts(nextConfig.pageExtensions)\n )\n\n let proxyFilePath: string | undefined\n let middlewareFilePath: string | undefined\n\n for (const fileName of sortedKnownFiles) {\n if (\n !files.includes(fileName) &&\n !directories.some((d) => fileName.startsWith(d))\n ) {\n continue\n }\n\n const { name: fileBaseName, dir: fileDir } = path.parse(fileName)\n\n const isAtConventionLevel =\n fileDir === dir || fileDir === path.join(dir, 'src')\n\n if (isAtConventionLevel && fileBaseName === MIDDLEWARE_FILENAME) {\n middlewareFilePath = fileName\n }\n if (isAtConventionLevel && fileBaseName === PROXY_FILENAME) {\n proxyFilePath = fileName\n }\n\n if (middlewareFilePath) {\n if (proxyFilePath) {\n const cwd = process.cwd()\n\n throw new Error(\n `Both ${MIDDLEWARE_FILENAME} file \"./${path.relative(cwd, middlewareFilePath)}\" and ${PROXY_FILENAME} file \"./${path.relative(cwd, proxyFilePath)}\" are detected. Please use \"./${path.relative(cwd, proxyFilePath)}\" only. Learn more: https://nextjs.org/docs/messages/middleware-to-proxy`\n )\n }\n Log.warnOnce(\n `The \"${MIDDLEWARE_FILENAME}\" file convention is deprecated. Please use \"${PROXY_FILENAME}\" instead. Learn more: https://nextjs.org/docs/messages/middleware-to-proxy`\n )\n }\n\n const meta = knownFiles.get(fileName)\n\n const watchTime = fileWatchTimes.get(fileName)\n const nextWatchTime = meta?.timestamp\n // If the file is showing up for the first time or the meta.timestamp is changed since last time\n // Files that were created before we started watching are not considered changed.\n // If any file was created by Next.js while booting, we assume those changes\n // are handled in the bootstrap phase.\n // Files that existed before we booted should be handled during bootstrapping.\n const fileChanged =\n (watchTime === undefined &&\n (nextWatchTime === undefined ||\n nextWatchTime >= initialWatchTime)) ||\n (watchTime && watchTime !== nextWatchTime)\n fileWatchTimes.set(fileName, nextWatchTime)\n\n if (envFiles.includes(fileName)) {\n if (fileChanged) {\n envChange = true\n }\n continue\n }\n\n if (tsconfigPaths.includes(fileName)) {\n if (fileName.endsWith('tsconfig.json')) {\n enabledTypeScript = true\n }\n if (fileChanged) {\n tsconfigChange = true\n }\n continue\n }\n\n if (\n meta?.accuracy === undefined ||\n !validFileMatcher.isPageFile(fileName)\n ) {\n continue\n }\n\n const isAppPath = Boolean(\n appDir &&\n normalizePathSep(fileName).startsWith(\n normalizePathSep(appDir) + '/'\n )\n )\n const isPagePath = Boolean(\n pagesDir &&\n normalizePathSep(fileName).startsWith(\n normalizePathSep(pagesDir) + '/'\n )\n )\n\n const rootFile = absolutePathToPage(fileName, {\n dir: dir,\n extensions: nextConfig.pageExtensions,\n keepIndex: false,\n pagesType: PAGE_TYPES.ROOT,\n })\n\n if (isMiddlewareFile(rootFile)) {\n const getStaticInfoIncludingLayouts = (\n require('../../../build/get-static-info-including-layouts') as typeof import('../../../build/get-static-info-including-layouts')\n ).getStaticInfoIncludingLayouts\n const staticInfo = await getStaticInfoIncludingLayouts({\n pageFilePath: fileName,\n config: nextConfig,\n appDir: appDir,\n page: rootFile,\n isDev: true,\n isInsideAppDir: isAppPath,\n pageExtensions: nextConfig.pageExtensions,\n })\n if (nextConfig.output === 'export') {\n Log.error(\n 'Middleware cannot be used with \"output: export\". See more info here: https://nextjs.org/docs/advanced-features/static-html-export'\n )\n continue\n }\n serverFields.actualMiddlewareFile = rootFile\n\n await propagateServerField(\n opts,\n 'actualMiddlewareFile',\n serverFields.actualMiddlewareFile\n )\n middlewareMatchers = staticInfo.middleware?.matchers || [\n { regexp: '^/.*$', originalSource: '/:path*' },\n ]\n continue\n }\n if (isInstrumentationHookFile(rootFile)) {\n serverFields.actualInstrumentationHookFile = rootFile\n await propagateServerField(\n opts,\n 'actualInstrumentationHookFile',\n serverFields.actualInstrumentationHookFile\n )\n continue\n }\n\n if (fileName.endsWith('.ts') || fileName.endsWith('.tsx')) {\n enabledTypeScript = true\n }\n\n if (!(isAppPath || isPagePath)) {\n continue\n }\n\n // Collect all current filenames for the TS plugin to use\n devPageFiles.add(fileName)\n\n let pageName = absolutePathToPage(fileName, {\n dir: isAppPath ? appDir! : pagesDir!,\n extensions: nextConfig.pageExtensions,\n keepIndex: isAppPath,\n pagesType: isAppPath ? PAGE_TYPES.APP : PAGE_TYPES.PAGES,\n })\n\n if (\n isAppPath &&\n appDir &&\n isMetadataRouteFile(\n fileName.replace(appDir, ''),\n nextConfig.pageExtensions,\n true\n )\n ) {\n const getPageStaticInfo = (\n require('../../../build/analysis/get-page-static-info') as typeof import('../../../build/analysis/get-page-static-info')\n ).getPageStaticInfo\n const staticInfo = await getPageStaticInfo({\n pageFilePath: fileName,\n nextConfig: {},\n page: pageName,\n isDev: true,\n pageType: PAGE_TYPES.APP,\n })\n\n pageName = normalizeMetadataPageToRoute(\n pageName,\n !!(staticInfo.generateSitemaps || staticInfo.generateImageMetadata)\n )\n }\n\n if (\n !isAppPath &&\n pageName.startsWith('/api/') &&\n nextConfig.output === 'export'\n ) {\n Log.error(\n 'API Routes cannot be used with \"output: export\". See more info here: https://nextjs.org/docs/advanced-features/static-html-export'\n )\n continue\n }\n\n if (isAppPath) {\n const isRootNotFound = validFileMatcher.isRootNotFound(fileName)\n hasRootAppNotFound = true\n\n if (isRootNotFound) {\n continue\n }\n\n // Ignore files/directories starting with `_` in the app directory\n if (normalizePathSep(pageName).includes('/_')) {\n continue\n }\n\n // Record parallel route slots for layout typing\n // May run multiple times (e.g. if a parallel route\n // has both a layout and a page, and children) but that's fine\n const segments = normalizePathSep(pageName).split('/')\n for (let i = segments.length - 1; i >= 0; i--) {\n const segment = segments[i]\n if (isParallelRouteSegment(segment)) {\n const parentPath = normalizeAppPath(\n segments.slice(0, i).join('/')\n )\n\n const slotName = segment.slice(1)\n // check if the slot already exists\n if (\n slots.some(\n (s) => s.name === slotName && s.parent === parentPath\n )\n )\n continue\n\n slots.push({\n name: slotName,\n parent: parentPath,\n })\n break\n }\n }\n\n // Record layouts\n if (validFileMatcher.isAppLayoutPage(fileName)) {\n layoutRoutes.push({\n route: ensureLeadingSlash(\n normalizeAppPath(normalizePathSep(pageName)).replace(\n /\\/layout$/,\n ''\n )\n ),\n filePath: fileName,\n })\n }\n\n if (!validFileMatcher.isAppRouterPage(fileName)) {\n continue\n }\n\n const originalPageName = pageName\n pageName = normalizeAppPath(pageName).replace(/%5F/g, '_')\n if (!appPaths[pageName]) {\n appPaths[pageName] = []\n }\n appPaths[pageName].push(\n opts.turbo\n ? // Turbopack outputs the correct path which is normalized with the `_`.\n originalPageName.replace(/%5F/g, '_')\n : originalPageName\n )\n\n if (useFileSystemPublicRoutes) {\n // Static metadata files will be served from filesystem.\n if (appDir && isStaticMetadataFile(fileName.replace(appDir, ''))) {\n staticMetadataFiles.set(pageName, fileName)\n } else {\n appFiles.add(pageName)\n }\n }\n\n if (validFileMatcher.isAppRouterRoute(fileName)) {\n appRouteHandlers.push({\n route: normalizePathSep(pageName),\n filePath: fileName,\n })\n } else {\n appRoutes.push({\n route: normalizePathSep(pageName),\n filePath: fileName,\n })\n }\n\n if (routedPages.includes(pageName)) {\n continue\n }\n } else {\n if (useFileSystemPublicRoutes) {\n pageFiles.add(pageName)\n // always add to nextDataRoutes for now but in future only add\n // entries that actually use getStaticProps/getServerSideProps\n opts.fsChecker.nextDataRoutes.add(pageName)\n }\n\n if (pageName.startsWith('/api/')) {\n pageApiRoutes.push({\n route: normalizePathSep(pageName),\n filePath: fileName,\n })\n } else {\n pageRoutes.push({\n route: normalizePathSep(pageName),\n filePath: fileName,\n })\n }\n }\n\n // Record pages\n if (isAppPath) {\n appPageFilePaths.set(pageName, fileName)\n } else {\n pagesPageFilePaths.set(pageName, fileName)\n }\n\n if (appDir && pageNameSet.has(pageName)) {\n conflictingAppPagePaths.add(pageName)\n } else {\n pageNameSet.add(pageName)\n }\n\n /**\n * If there is a middleware that is not declared in the root we will\n * warn without adding it so it doesn't make its way into the system.\n */\n if (/[\\\\\\\\/]_middleware$/.test(pageName)) {\n nestedMiddleware.push(pageName)\n continue\n }\n\n routedPages.push(pageName)\n }\n\n const numConflicting = conflictingAppPagePaths.size\n conflictingPageChange = numConflicting - previousConflictingPagePaths.size\n\n if (conflictingPageChange !== 0) {\n if (numConflicting > 0) {\n let errorMessage = `Conflicting app and page file${\n numConflicting === 1 ? ' was' : 's were'\n } found, please remove the conflicting files to continue:\\n`\n\n for (const p of conflictingAppPagePaths) {\n const appPath = path.relative(dir, appPageFilePaths.get(p)!)\n const pagesPath = path.relative(dir, pagesPageFilePaths.get(p)!)\n errorMessage += ` \"${pagesPath}\" - \"${appPath}\"\\n`\n }\n hotReloader.setHmrServerError(new Error(errorMessage))\n } else if (numConflicting === 0) {\n hotReloader.clearHmrServerError()\n await propagateServerField(opts, 'reloadMatchers', undefined)\n }\n }\n\n previousConflictingPagePaths = conflictingAppPagePaths\n\n let clientRouterFilters: any\n if (nextConfig.experimental.clientRouterFilter) {\n clientRouterFilters = createClientRouterFilter(\n Object.keys(appPaths),\n nextConfig.experimental.clientRouterFilterRedirects\n ? ((nextConfig as any)._originalRedirects || []).filter(\n (r: any) => !r.internal\n )\n : [],\n nextConfig.experimental.clientRouterFilterAllowedRate\n )\n\n if (\n !previousClientRouterFilters ||\n JSON.stringify(previousClientRouterFilters) !==\n JSON.stringify(clientRouterFilters)\n ) {\n envChange = true\n previousClientRouterFilters = clientRouterFilters\n }\n }\n\n if (envChange || tsconfigChange) {\n if (envChange) {\n writeEnvDefinitions = true\n\n await propagateServerField(opts, 'loadEnvConfig', [\n { dev: true, forceReload: true },\n ])\n }\n\n if (hotReloader.turbopackProject) {\n const hasRewrites =\n opts.fsChecker.rewrites.afterFiles.length > 0 ||\n opts.fsChecker.rewrites.beforeFiles.length > 0 ||\n opts.fsChecker.rewrites.fallback.length > 0\n\n const rootPath =\n opts.nextConfig.turbopack?.root ||\n opts.nextConfig.outputFileTracingRoot ||\n opts.dir\n await hotReloader.turbopackProject.update({\n defineEnv: createDefineEnv({\n isTurbopack: true,\n clientRouterFilters,\n config: nextConfig,\n dev: true,\n distDir,\n fetchCacheKeyPrefix:\n opts.nextConfig.experimental.fetchCacheKeyPrefix,\n hasRewrites,\n // TODO: Implement\n middlewareMatchers: undefined,\n projectPath: opts.dir,\n rewrites: opts.fsChecker.rewrites,\n }),\n rootPath,\n projectPath: normalizePath(path.relative(rootPath, dir)),\n })\n } else {\n let tsconfigResult:\n | UnwrapPromise<\n ReturnType<\n typeof import('../../../build/load-jsconfig').default\n >\n >\n | undefined\n // This is not relevant for Turbopack because tsconfig/jsconfig is handled internally.\n if (tsconfigChange) {\n try {\n const loadJsConfig = (\n require('../../../build/load-jsconfig') as typeof import('../../../build/load-jsconfig')\n ).default\n tsconfigResult = await loadJsConfig(dir, nextConfig)\n } catch (_) {\n /* do we want to log if there are syntax errors in tsconfig while editing? */\n }\n }\n\n hotReloader.activeWebpackConfigs?.forEach((config, idx) => {\n const isClient = idx === 0\n const isNodeServer = idx === 1\n const isEdgeServer = idx === 2\n const hasRewrites =\n opts.fsChecker.rewrites.afterFiles.length > 0 ||\n opts.fsChecker.rewrites.beforeFiles.length > 0 ||\n opts.fsChecker.rewrites.fallback.length > 0\n\n if (tsconfigChange) {\n config.resolve?.plugins?.forEach((plugin: any) => {\n // look for the JsConfigPathsPlugin and update with\n // the latest paths/baseUrl config\n if (plugin instanceof JsConfigPathsPlugin && tsconfigResult) {\n const { resolvedBaseUrl, jsConfig } = tsconfigResult\n const currentResolvedBaseUrl = plugin.resolvedBaseUrl\n const resolvedUrlIndex = config.resolve?.modules?.findIndex(\n (item) => item === currentResolvedBaseUrl?.baseUrl\n )\n\n if (resolvedBaseUrl) {\n if (\n resolvedBaseUrl.baseUrl !==\n currentResolvedBaseUrl?.baseUrl\n ) {\n // remove old baseUrl and add new one\n if (resolvedUrlIndex && resolvedUrlIndex > -1) {\n config.resolve?.modules?.splice(resolvedUrlIndex, 1)\n }\n\n // If the resolvedBaseUrl is implicit we only remove the previous value.\n // Only add the baseUrl if it's explicitly set in tsconfig/jsconfig\n if (!resolvedBaseUrl.isImplicit) {\n config.resolve?.modules?.push(resolvedBaseUrl.baseUrl)\n }\n }\n }\n\n if (jsConfig?.compilerOptions?.paths && resolvedBaseUrl) {\n Object.keys(plugin.paths).forEach((key) => {\n delete plugin.paths[key]\n })\n Object.assign(plugin.paths, jsConfig.compilerOptions.paths)\n plugin.resolvedBaseUrl = resolvedBaseUrl\n }\n }\n })\n }\n\n if (envChange) {\n config.plugins?.forEach((plugin: any) => {\n // we look for the DefinePlugin definitions so we can\n // update them on the active compilers\n if (\n plugin &&\n typeof plugin.definitions === 'object' &&\n plugin.definitions.__NEXT_DEFINE_ENV\n ) {\n const newDefine = getDefineEnv({\n isTurbopack: false,\n clientRouterFilters,\n config: nextConfig,\n dev: true,\n distDir,\n fetchCacheKeyPrefix:\n opts.nextConfig.experimental.fetchCacheKeyPrefix,\n hasRewrites,\n isClient,\n isEdgeServer,\n isNodeServer,\n middlewareMatchers: undefined,\n projectPath: opts.dir,\n rewrites: opts.fsChecker.rewrites,\n })\n\n Object.keys(plugin.definitions).forEach((key) => {\n if (!(key in newDefine)) {\n delete plugin.definitions[key]\n }\n })\n Object.assign(plugin.definitions, newDefine)\n }\n })\n }\n })\n }\n await hotReloader.invalidate({\n reloadAfterInvalidation: envChange,\n })\n }\n\n if (nestedMiddleware.length > 0) {\n Log.error(\n new NestedMiddlewareError(\n nestedMiddleware,\n dir,\n (pagesDir || appDir)!\n ).message\n )\n nestedMiddleware = []\n }\n\n // Make sure to sort parallel routes to make the result deterministic.\n serverFields.appPathRoutes = Object.fromEntries(\n Object.entries(appPaths).map(([k, v]) => [k, v.sort()])\n )\n await propagateServerField(\n opts,\n 'appPathRoutes',\n serverFields.appPathRoutes\n )\n\n // TODO: pass this to fsChecker/next-dev-server?\n serverFields.middleware = middlewareMatchers\n ? {\n match: null as any,\n page: '/',\n matchers: middlewareMatchers,\n }\n : undefined\n\n await propagateServerField(opts, 'middleware', serverFields.middleware)\n serverFields.hasAppNotFound = hasRootAppNotFound\n\n opts.fsChecker.middlewareMatcher = serverFields.middleware?.matchers\n ? getMiddlewareRouteMatcher(serverFields.middleware?.matchers)\n : undefined\n\n const interceptionRoutes = generateInterceptionRoutesRewrites(\n Object.keys(appPaths),\n opts.nextConfig.basePath\n ).map((item) =>\n buildCustomRoute(\n 'before_files_rewrite',\n item,\n opts.nextConfig.basePath,\n opts.nextConfig.experimental.caseSensitiveRoutes\n )\n )\n\n opts.fsChecker.rewrites.beforeFiles.push(...interceptionRoutes)\n\n const exportPathMap =\n (typeof nextConfig.exportPathMap === 'function' &&\n (await nextConfig.exportPathMap?.(\n {},\n {\n dev: true,\n dir: opts.dir,\n outDir: null,\n distDir: distDir,\n buildId: 'development',\n }\n ))) ||\n {}\n\n const exportPathMapEntries = Object.entries(exportPathMap || {})\n\n if (exportPathMapEntries.length > 0) {\n opts.fsChecker.exportPathMapRoutes = exportPathMapEntries.map(\n ([key, value]) =>\n buildCustomRoute(\n 'before_files_rewrite',\n {\n source: key,\n destination: `${value.page}${\n value.query ? '?' : ''\n }${qs.stringify(value.query)}`,\n },\n opts.nextConfig.basePath,\n opts.nextConfig.experimental.caseSensitiveRoutes\n )\n )\n }\n\n try {\n // we serve a separate manifest with all pages for the client in\n // dev mode so that we can match a page after a rewrite on the client\n // before it has been built and is populated in the _buildManifest\n const sortedRoutes = getSortedRoutes(routedPages)\n\n opts.fsChecker.dynamicRoutes = sortedRoutes.map(\n (page): FilesystemDynamicRoute => {\n const regex = getNamedRouteRegex(page, {\n prefixRouteKeys: true,\n })\n return {\n regex: regex.re.toString(),\n namedRegex: regex.namedRegex,\n routeKeys: regex.routeKeys,\n match: getRouteMatcher(regex),\n page,\n }\n }\n )\n\n const dataRoutes: typeof opts.fsChecker.dynamicRoutes = []\n\n for (const page of sortedRoutes) {\n const route = buildDataRoute(page, 'development')\n const routeRegex = getNamedRouteRegex(route.page, {\n prefixRouteKeys: true,\n })\n dataRoutes.push({\n ...route,\n regex: routeRegex.re.toString(),\n namedRegex: routeRegex.namedRegex,\n routeKeys: routeRegex.routeKeys,\n match: getRouteMatcher({\n // TODO: fix this in the manifest itself, must also be fixed in\n // upstream builder that relies on this\n re: opts.nextConfig.i18n\n ? new RegExp(\n route.dataRouteRegex.replace(\n `/development/`,\n `/development/(?<nextLocale>[^/]+?)/`\n )\n )\n : new RegExp(route.dataRouteRegex),\n groups: routeRegex.groups,\n }),\n })\n }\n opts.fsChecker.dynamicRoutes.unshift(...dataRoutes)\n\n // For Turbopack ADDED_PAGE and REMOVED_PAGE are implemented in hot-reloader-turbopack.ts\n // in order to avoid a race condition where ADDED_PAGE and REMOVED_PAGE are sent before Turbopack picked up the file change.\n if (!opts.turbo) {\n // Reload the matchers. The filesystem would have been written to,\n // and the matchers need to re-scan it to update the router.\n // Reloading the matchers should happen before `ADDED_PAGE` or `REMOVED_PAGE` is sent over the websocket\n // otherwise it sends the event too early.\n await propagateServerField(opts, 'reloadMatchers', undefined)\n\n if (\n !prevSortedRoutes?.every((val, idx) => val === sortedRoutes[idx])\n ) {\n const addedRoutes = sortedRoutes.filter(\n (route) => !prevSortedRoutes.includes(route)\n )\n const removedRoutes = prevSortedRoutes.filter(\n (route) => !sortedRoutes.includes(route)\n )\n\n // emit the change so clients fetch the update\n hotReloader.send({\n type: HMR_MESSAGE_SENT_TO_BROWSER.DEV_PAGES_MANIFEST_UPDATE,\n data: [\n {\n devPagesManifest: true,\n },\n ],\n })\n\n addedRoutes.forEach((route) => {\n hotReloader.send({\n type: HMR_MESSAGE_SENT_TO_BROWSER.ADDED_PAGE,\n data: [route],\n })\n })\n\n removedRoutes.forEach((route) => {\n hotReloader.send({\n type: HMR_MESSAGE_SENT_TO_BROWSER.REMOVED_PAGE,\n data: [route],\n })\n })\n }\n }\n prevSortedRoutes = sortedRoutes\n\n if (enabledTypeScript) {\n // Using === false to make the check clearer.\n if (typescriptStatusFromLastAggregation === false) {\n // we tolerate the error here as this is best effort\n // and the manual install command will be shown\n await verifyTypeScript(opts)\n .then(() => {\n tsconfigChange = true\n })\n .catch(() => {})\n }\n\n if (writeEnvDefinitions && nextConfig.experimental?.typedEnv) {\n // TODO: The call to propagateServerField 'loadEnvConfig' causes the env to be loaded twice on env file changes.\n const loadEnvConfig = (\n require('@next/env') as typeof import('@next/env')\n ).loadEnvConfig\n const { loadedEnvFiles } = loadEnvConfig(\n dir,\n process.env.NODE_ENV === 'development',\n // Silent as it's the second time `loadEnvConfig` is called in this pass.\n undefined,\n true\n )\n\n const createEnvDefinitions = (\n require('../experimental/create-env-definitions') as typeof import('../experimental/create-env-definitions')\n ).createEnvDefinitions\n await createEnvDefinitions({\n distDir,\n loadedEnvFiles: [\n ...loadedEnvFiles,\n {\n path: nextConfig.configFileName,\n env: nextConfig.env,\n contents: '',\n },\n ],\n })\n }\n\n const routeTypesManifest = await createRouteTypesManifest({\n dir,\n pageRoutes,\n appRoutes,\n layoutRoutes,\n slots,\n redirects: opts.nextConfig.redirects,\n rewrites: opts.nextConfig.rewrites,\n // Ensure relative paths in validator.ts are computed from validatorFilePath,\n // matching behavior of build and CLI typegen.\n validatorFilePath,\n appRouteHandlers,\n pageApiRoutes,\n })\n\n await writeRouteTypesManifest(\n routeTypesManifest,\n routeTypesFilePath,\n opts.nextConfig\n )\n await writeValidatorFile(\n routeTypesManifest,\n validatorFilePath,\n Boolean(nextConfig.experimental.strictRouteTypes)\n )\n\n // Generate cache-life types if cacheLife config exists\n const cacheLifeFilePath = path.join(distTypesDir, 'cache-life.d.ts')\n writeCacheLifeTypes(opts.nextConfig.cacheLife, cacheLifeFilePath)\n }\n\n if (!resolved) {\n resolve()\n resolved = true\n }\n } catch (e) {\n if (!resolved) {\n reject(e)\n resolved = true\n } else {\n Log.warn('Failed to reload dynamic routes:', e)\n }\n }\n })\n\n wp.watch({ directories: [dir], startTime: 0 })\n })\n\n const clientPagesManifestPath = `/_next/${CLIENT_STATIC_FILES_PATH}/development/${DEV_CLIENT_PAGES_MANIFEST}`\n opts.fsChecker.devVirtualFsItems.add(clientPagesManifestPath)\n\n const devMiddlewareManifestPath = `/_next/${CLIENT_STATIC_FILES_PATH}/development/${DEV_CLIENT_MIDDLEWARE_MANIFEST}`\n opts.fsChecker.devVirtualFsItems.add(devMiddlewareManifestPath)\n\n const devTurbopackMiddlewareManifestPath = `/_next/${CLIENT_STATIC_FILES_PATH}/development/${TURBOPACK_CLIENT_MIDDLEWARE_MANIFEST}`\n opts.fsChecker.devVirtualFsItems.add(devTurbopackMiddlewareManifestPath)\n\n async function requestHandler(req: IncomingMessage, res: ServerResponse) {\n const parsedUrl = parseUrl(req.url || '/')\n const pathname = parsedUrl !== undefined ? parsedUrl.pathname : null\n\n if (pathname !== null && pathname.includes(clientPagesManifestPath)) {\n res.statusCode = 200\n res.setHeader('Content-Type', JSON_CONTENT_TYPE_HEADER)\n res.end(\n JSON.stringify({\n pages: prevSortedRoutes.filter(\n (route) => !opts.fsChecker.appFiles.has(route)\n ),\n })\n )\n return { finished: true }\n }\n\n if (\n pathname !== null &&\n (pathname.includes(devMiddlewareManifestPath) ||\n pathname.includes(devTurbopackMiddlewareManifestPath))\n ) {\n res.statusCode = 200\n res.setHeader('Content-Type', JSON_CONTENT_TYPE_HEADER)\n res.end(JSON.stringify(serverFields.middleware?.matchers || []))\n return { finished: true }\n }\n return { finished: false }\n }\n\n function logErrorWithOriginalStack(\n err: unknown,\n type?: 'unhandledRejection' | 'uncaughtException' | 'warning' | 'app-dir'\n ) {\n if (err instanceof Error) {\n err.message = deobfuscateText(err.message)\n }\n if (err instanceof ModuleBuildError) {\n // Errors that may come from issues from the user's code\n Log.error(err.message)\n } else if (err instanceof TurbopackInternalError) {\n // An internal Turbopack error that has been handled by next-swc, written\n // to disk and a simplified message shown to user on the Rust side.\n } else if (type === 'warning') {\n Log.warn(err)\n } else if (type === 'app-dir') {\n Log.error(err)\n } else if (type) {\n Log.error(`${type}:`, err)\n } else {\n Log.error(err)\n }\n }\n\n return {\n serverFields,\n hotReloader,\n requestHandler,\n logErrorWithOriginalStack,\n\n async ensureMiddleware(requestUrl?: string) {\n if (!serverFields.actualMiddlewareFile) return\n return hotReloader.ensurePage({\n page: serverFields.actualMiddlewareFile,\n clientOnly: false,\n definition: undefined,\n url: requestUrl,\n })\n },\n }\n}\n\nexport async function setupDevBundler(opts: SetupOpts) {\n const isSrcDir = path\n .relative(opts.dir, opts.pagesDir || opts.appDir || '')\n .startsWith('src')\n await installBindings(opts.nextConfig.experimental?.useWasmBinary)\n const result = await startWatcher({\n ...opts,\n isSrcDir,\n })\n\n opts.telemetry.record(\n eventCliSession(opts.nextConfig, {\n webpackVersion: 5,\n isSrcDir,\n turboFlag: !!opts.turbo,\n cliCommand: 'dev',\n appDir: !!opts.appDir,\n pagesDir: !!opts.pagesDir,\n isCustomServer: !!opts.isCustomServer,\n hasNowJson: !!(await findUp('now.json', { cwd: opts.dir })),\n })\n )\n\n // Track build features for dev server here:\n opts.telemetry.record({\n eventName: EVENT_BUILD_FEATURE_USAGE,\n payload: {\n featureName: 'turbopackFileSystemCache',\n invocationCount: isFileSystemCacheEnabledForDev(opts.nextConfig) ? 1 : 0,\n },\n })\n\n return result\n}\n\nexport type DevBundler = Awaited<ReturnType<typeof setupDevBundler>>\n\n// Returns a trace rewritten through Turbopack's sourcemaps\n"],"names":["createDefineEnv","installBindings","fs","path","qs","Watchpack","findUp","buildCustomRoute","Log","setGlobal","createValidFileMatcher","EVENT_BUILD_FEATURE_USAGE","eventCliSession","getSortedRoutes","sortByPageExts","verifyTypeScriptSetup","verifyPartytownSetup","getNamedRouteRegex","normalizeAppPath","buildDataRoute","getRouteMatcher","normalizePathSep","createClientRouterFilter","absolutePathToPage","generateInterceptionRoutesRewrites","CLIENT_STATIC_FILES_PATH","DEV_CLIENT_PAGES_MANIFEST","DEV_CLIENT_MIDDLEWARE_MANIFEST","PHASE_DEVELOPMENT_SERVER","TURBOPACK_CLIENT_MIDDLEWARE_MANIFEST","ROUTES_MANIFEST","PRERENDER_MANIFEST","getMiddlewareRouteMatcher","isMiddlewareFile","NestedMiddlewareError","isInstrumentationHookFile","getPossibleMiddlewareFilenames","getPossibleInstrumentationHookFilenames","devPageFiles","HMR_MESSAGE_SENT_TO_BROWSER","PAGE_TYPES","generateEncryptionKeyBase64","isMetadataRouteFile","isStaticMetadataFile","normalizeMetadataPageToRoute","JsConfigPathsPlugin","store","consoleStore","isFileSystemCacheEnabledForDev","ModuleBuildError","getDefineEnv","TurbopackInternalError","normalizePath","JSON_CONTENT_TYPE_HEADER","MIDDLEWARE_FILENAME","PROXY_FILENAME","parseUrl","createRouteTypesManifest","writeRouteTypesManifest","writeValidatorFile","writeCacheLifeTypes","isParallelRouteSegment","ensureLeadingSlash","Lockfile","deobfuscateText","verifyTypeScript","opts","verifyResult","dir","distDir","nextConfig","typeCheckPreflight","tsconfigPath","typescript","disableStaticImages","images","hasAppDir","appDir","hasPagesDir","pagesDir","isolatedDevBuild","experimental","version","propagateServerField","field","args","renderServer","instance","startWatcher","resetFetch","useFileSystemPublicRoutes","join","lockfile","lockDistDir","mkdirSync","recursive","acquireWithRetriesOrExit","validFileMatcher","pageExtensions","serverFields","setState","logging","hotReloader","turbo","createHotReloaderTurbopack","require","HotReloader","process","env","NEXT_RSPACK","default","isSrcDir","config","buildId","encryptionKey","isBuild","telemetry","rewrites","fsChecker","previewProps","prerenderManifest","preview","onDevServerCleanup","start","distTypesDir","appRoutes","pageRoutes","layoutRoutes","appRouteHandlerRoutes","redirectRoutes","rewriteRoutes","appPagePaths","Set","pagesRouterPagePaths","layoutPaths","appRouteHandlers","pageApiRoutes","filePathToRoute","Map","routesManifestPath","routesManifest","caseSensitive","caseSensitiveRoutes","basePath","redirects","headers","i18n","undefined","skipProxyUrlNormalize","promises","writeFile","JSON","stringify","prerenderManifestPath","nextScriptWorkers","ensureCallback","ensure","item","type","ensurePage","clientOnly","page","itemPath","isApp","definition","resolved","prevSortedRoutes","Promise","resolve","reject","readdir","_","files","length","pages","app","directories","rootDir","nestedMiddleware","envFiles","map","file","push","tsconfigPaths","wp","aggregateTimeout","ignored","pathname","some","startsWith","d","fileWatchTimes","enabledTypeScript","previousClientRouterFilters","previousConflictingPagePaths","routeTypesFilePath","validatorFilePath","initialWatchTime","performance","now","timeOrigin","on","writeEnvDefinitions","typescriptStatusFromLastAggregation","middlewareMatchers","routedPages","knownFiles","getTimeInfoEntries","appPaths","pageNameSet","conflictingAppPagePaths","appPageFilePaths","pagesPageFilePaths","slots","envChange","tsconfigChange","conflictingPageChange","hasRootAppNotFound","appFiles","pageFiles","staticMetadataFiles","clear","sortedKnownFiles","keys","sort","proxyFilePath","middlewareFilePath","fileName","includes","name","fileBaseName","fileDir","parse","isAtConventionLevel","cwd","Error","relative","warnOnce","meta","get","watchTime","nextWatchTime","timestamp","fileChanged","set","endsWith","accuracy","isPageFile","isAppPath","Boolean","isPagePath","rootFile","extensions","keepIndex","pagesType","ROOT","staticInfo","getStaticInfoIncludingLayouts","pageFilePath","isDev","isInsideAppDir","output","error","actualMiddlewareFile","middleware","matchers","regexp","originalSource","actualInstrumentationHookFile","add","pageName","APP","PAGES","replace","getPageStaticInfo","pageType","generateSitemaps","generateImageMetadata","isRootNotFound","segments","split","i","segment","parentPath","slice","slotName","s","parent","isAppLayoutPage","route","filePath","isAppRouterPage","originalPageName","isAppRouterRoute","nextDataRoutes","has","test","numConflicting","size","errorMessage","p","appPath","pagesPath","setHmrServerError","clearHmrServerError","clientRouterFilters","clientRouterFilter","Object","clientRouterFilterRedirects","_originalRedirects","filter","r","internal","clientRouterFilterAllowedRate","dev","forceReload","turbopackProject","hasRewrites","afterFiles","beforeFiles","fallback","rootPath","turbopack","root","outputFileTracingRoot","update","defineEnv","isTurbopack","fetchCacheKeyPrefix","projectPath","tsconfigResult","loadJsConfig","activeWebpackConfigs","forEach","idx","isClient","isNodeServer","isEdgeServer","plugins","plugin","jsConfig","resolvedBaseUrl","currentResolvedBaseUrl","resolvedUrlIndex","modules","findIndex","baseUrl","splice","isImplicit","compilerOptions","paths","key","assign","definitions","__NEXT_DEFINE_ENV","newDefine","invalidate","reloadAfterInvalidation","message","appPathRoutes","fromEntries","entries","k","v","match","hasAppNotFound","middlewareMatcher","interceptionRoutes","exportPathMap","outDir","exportPathMapEntries","exportPathMapRoutes","value","source","destination","query","sortedRoutes","dynamicRoutes","regex","prefixRouteKeys","re","toString","namedRegex","routeKeys","dataRoutes","routeRegex","RegExp","dataRouteRegex","groups","unshift","every","val","addedRoutes","removedRoutes","send","DEV_PAGES_MANIFEST_UPDATE","data","devPagesManifest","ADDED_PAGE","REMOVED_PAGE","then","catch","typedEnv","loadEnvConfig","loadedEnvFiles","NODE_ENV","createEnvDefinitions","configFileName","contents","routeTypesManifest","strictRouteTypes","cacheLifeFilePath","cacheLife","e","warn","watch","startTime","clientPagesManifestPath","devVirtualFsItems","devMiddlewareManifestPath","devTurbopackMiddlewareManifestPath","requestHandler","req","res","parsedUrl","url","statusCode","setHeader","end","finished","logErrorWithOriginalStack","err","ensureMiddleware","requestUrl","setupDevBundler","useWasmBinary","result","record","webpackVersion","turboFlag","cliCommand","isCustomServer","hasNowJson","eventName","payload","featureName","invocationCount"],"mappings":"AASA,SAASA,eAAe,QAAQ,qBAAoB;AACpD,SAASC,eAAe,QAAQ,sCAAqC;AACrE,OAAOC,QAAQ,KAAI;AACnB,OAAOC,UAAU,OAAM;AACvB,OAAOC,QAAQ,cAAa;AAC5B,OAAOC,eAAe,+BAA8B;AACpD,OAAOC,YAAY,6BAA4B;AAC/C,SAASC,gBAAgB,QAAQ,eAAc;AAC/C,YAAYC,SAAS,4BAA2B;AAChD,SAASC,SAAS,QAAQ,wBAAuB;AAGjD,SAASC,sBAAsB,QAAQ,oBAAmB;AAC1D,SACEC,yBAAyB,EACzBC,eAAe,QACV,4BAA2B;AAClC,SAASC,eAAe,QAAQ,mCAAkC;AAClE,SAASC,cAAc,QAAQ,mCAAkC;AACjE,SAASC,qBAAqB,QAAQ,uCAAsC;AAC5E,SAASC,oBAAoB,QAAQ,sCAAqC;AAC1E,SAASC,kBAAkB,QAAQ,+CAA8C;AACjF,SAASC,gBAAgB,QAAQ,6CAA4C;AAC7E,SAASC,cAAc,QAAQ,qBAAoB;AACnD,SAASC,eAAe,QAAQ,iDAAgD;AAChF,SAASC,gBAAgB,QAAQ,mDAAkD;AACnF,SAASC,wBAAwB,QAAQ,2CAA0C;AACnF,SAASC,kBAAkB,QAAQ,sDAAqD;AACxF,SAASC,kCAAkC,QAAQ,qDAAoD;AAEvG,SACEC,wBAAwB,EACxBC,yBAAyB,EACzBC,8BAA8B,EAC9BC,wBAAwB,EACxBC,oCAAoC,EACpCC,eAAe,EACfC,kBAAkB,QACb,gCAA+B;AAEtC,SAASC,yBAAyB,QAAQ,4DAA2D;AAErG,SACEC,gBAAgB,EAChBC,qBAAqB,EACrB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