next 15.5.2 → 15.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/next +1 -1
- package/dist/build/index.js +2 -2
- package/dist/build/swc/index.js +1 -1
- package/dist/build/templates/app-page.js +1 -2
- package/dist/build/templates/app-page.js.map +1 -1
- package/dist/build/templates/app-route.js +1 -2
- package/dist/build/templates/app-route.js.map +1 -1
- package/dist/build/webpack/loaders/devtool/devtool-style-inject.js +31 -26
- package/dist/build/webpack/loaders/devtool/devtool-style-inject.js.map +1 -1
- package/dist/build/webpack-config.js +2 -2
- package/dist/client/app-bootstrap.js +1 -1
- package/dist/client/index.js +1 -1
- package/dist/compiled/next-devtools/index.js +2 -2
- package/dist/compiled/next-devtools/index.js.map +1 -1
- package/dist/compiled/next-server/pages-api.runtime.dev.js +1 -1
- package/dist/compiled/next-server/pages-api.runtime.dev.js.map +1 -1
- package/dist/compiled/next-server/pages.runtime.dev.js +1 -1
- package/dist/compiled/next-server/pages.runtime.dev.js.map +1 -1
- package/dist/esm/build/index.js +2 -2
- package/dist/esm/build/swc/index.js +1 -1
- package/dist/esm/build/templates/app-page.js +1 -2
- package/dist/esm/build/templates/app-page.js.map +1 -1
- package/dist/esm/build/templates/app-route.js +1 -2
- package/dist/esm/build/templates/app-route.js.map +1 -1
- package/dist/esm/build/webpack/loaders/devtool/devtool-style-inject.js +31 -26
- package/dist/esm/build/webpack/loaders/devtool/devtool-style-inject.js.map +1 -1
- package/dist/esm/build/webpack-config.js +2 -2
- package/dist/esm/client/app-bootstrap.js +1 -1
- package/dist/esm/client/index.js +1 -1
- package/dist/esm/server/dev/hot-reloader-turbopack.js +1 -1
- package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
- package/dist/esm/server/lib/app-info-log.js +1 -1
- package/dist/esm/server/lib/router-utils/setup-dev-bundler.js +8 -5
- package/dist/esm/server/lib/router-utils/setup-dev-bundler.js.map +1 -1
- package/dist/esm/server/lib/router-utils/typegen.js +15 -5
- package/dist/esm/server/lib/router-utils/typegen.js.map +1 -1
- package/dist/esm/server/lib/start-server.js +1 -1
- package/dist/esm/shared/lib/canary-only.js +1 -1
- package/dist/next-devtools/dev-overlay/hooks/use-on-click-outside.d.ts +2 -1
- package/dist/server/dev/hot-reloader-turbopack.js +1 -1
- package/dist/server/dev/hot-reloader-webpack.js +1 -1
- package/dist/server/lib/app-info-log.js +1 -1
- package/dist/server/lib/router-utils/setup-dev-bundler.js +8 -5
- package/dist/server/lib/router-utils/setup-dev-bundler.js.map +1 -1
- package/dist/server/lib/router-utils/typegen.js +15 -5
- package/dist/server/lib/router-utils/typegen.js.map +1 -1
- package/dist/server/lib/start-server.js +1 -1
- package/dist/shared/lib/canary-only.js +1 -1
- package/dist/telemetry/anonymous-meta.js +1 -1
- package/dist/telemetry/events/session-stopped.js +2 -2
- package/dist/telemetry/events/version.js +2 -2
- package/package.json +15 -15
@@ -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 {\n getPageStaticInfo,\n type MiddlewareMatcher,\n} 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 fs from 'fs'\nimport url from 'url'\nimport path from 'path'\nimport qs from 'querystring'\nimport Watchpack from 'next/dist/compiled/watchpack'\nimport { loadEnvConfig } from '@next/env'\nimport findUp from 'next/dist/compiled/find-up'\nimport { buildCustomRoute } from './filesystem'\nimport * as Log from '../../../build/output/log'\nimport HotReloaderWebpack from '../../dev/hot-reloader-webpack'\nimport { setGlobal } from '../../../trace/shared'\nimport type { Telemetry } from '../../../telemetry/storage'\nimport type { IncomingMessage, ServerResponse } from 'http'\nimport loadJsConfig from '../../../build/load-jsconfig'\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 {\n getStaticInfoIncludingLayouts,\n sortByPageExts,\n} from '../../../build/entries'\nimport { verifyTypeScriptSetup } from '../../../lib/verify-typescript-setup'\nimport { verifyPartytownSetup } from '../../../lib/verify-partytown-setup'\nimport { getRouteRegex } 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_ACTIONS_SENT_TO_BROWSER } from '../../dev/hot-reloader-types'\nimport { PAGE_TYPES } from '../../../lib/page-types'\nimport { createHotReloaderTurbopack } from '../../dev/hot-reloader-turbopack'\nimport { generateEncryptionKeyBase64 } from '../../app-render/encryption-utils-server'\nimport { isMetadataRouteFile } from '../../../lib/metadata/is-metadata-route'\nimport { normalizeMetadataPageToRoute } from '../../../lib/metadata/get-metadata-route'\nimport { createEnvDefinitions } from '../experimental/create-env-definitions'\nimport { JsConfigPathsPlugin } from '../../../build/webpack/plugins/jsconfig-paths-plugin'\nimport { store as consoleStore } from '../../../build/output/store'\nimport {\n isPersistentCachingEnabled,\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 { JSON_CONTENT_TYPE_HEADER } from '../../../lib/constants'\nimport {\n createRouteTypesManifest,\n writeRouteTypesManifest,\n writeValidatorFile,\n} from './route-types-utils'\nimport { isParallelRouteSegment } from '../../../shared/lib/segment'\nimport { ensureLeadingSlash } from '../../../shared/lib/page-path/ensure-leading-slash'\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 skipMiddlewareUrlNormalize: RoutesManifest['skipMiddlewareUrlNormalize']\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?: MiddlewareMatcher[]\n }\n | undefined\n hasAppNotFound?: boolean\n interceptionRoutes?: ReturnType<\n typeof import('./filesystem').buildCustomRoute\n >[]\n setIsrStatus?: (key: string, value: boolean) => void\n resetFetch?: () => void\n}\n\nasync function verifyTypeScript(opts: SetupOpts) {\n let usingTypeScript = false\n const verifyResult = await verifyTypeScriptSetup({\n dir: opts.dir,\n distDir: opts.nextConfig.distDir,\n intentDirs: [opts.pagesDir, opts.appDir].filter(Boolean) as string[],\n typeCheckPreflight: false,\n tsconfigPath: opts.nextConfig.typescript.tsconfigPath,\n disableStaticImages: opts.nextConfig.images.disableStaticImages,\n hasAppDir: !!opts.appDir,\n hasPagesDir: !!opts.pagesDir,\n })\n\n if (verifyResult.version) {\n usingTypeScript = true\n }\n return usingTypeScript\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 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 createHotReloaderTurbopack(opts, serverFields, distDir, resetFetch)\n : new HotReloaderWebpack(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 })\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 usingTypeScript = await verifyTypeScript(opts)\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 skipMiddlewareUrlNormalize: nextConfig.skipMiddlewareUrlNormalize,\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 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 = usingTypeScript\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 wp.on('aggregated', async () => {\n let middlewareMatchers: MiddlewareMatcher[] | 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 } = opts.fsChecker\n\n appFiles.clear()\n pageFiles.clear()\n devPageFiles.clear()\n\n const sortedKnownFiles: string[] = [...knownFiles.keys()].sort(\n sortByPageExts(nextConfig.pageExtensions)\n )\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 const meta = knownFiles.get(fileName)\n\n const watchTime = fileWatchTimes.get(fileName)\n // If the file is showing up for the first time or the meta.timestamp is changed since last time\n const watchTimeChange =\n watchTime === undefined ||\n (watchTime && watchTime !== meta?.timestamp)\n fileWatchTimes.set(fileName, meta?.timestamp)\n\n if (envFiles.includes(fileName)) {\n if (watchTimeChange) {\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 (watchTimeChange) {\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 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 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 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: path.relative(\n path.dirname(validatorFilePath),\n fileName\n ),\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 appFiles.add(pageName)\n }\n\n if (validFileMatcher.isAppRouterRoute(fileName)) {\n appRouteHandlers.push({\n route: normalizePathSep(pageName),\n filePath: path.relative(\n path.dirname(validatorFilePath),\n fileName\n ),\n })\n } else {\n appRoutes.push({\n route: normalizePathSep(pageName),\n filePath: path.relative(\n path.dirname(validatorFilePath),\n fileName\n ),\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: path.relative(\n path.dirname(validatorFilePath),\n fileName\n ),\n })\n } else {\n pageRoutes.push({\n route: normalizePathSep(pageName),\n filePath: path.relative(\n path.dirname(validatorFilePath),\n fileName\n ),\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 (!usingTypeScript && enabledTypeScript) {\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 (envChange || tsconfigChange) {\n if (envChange) {\n const { loadedEnvFiles } = loadEnvConfig(\n dir,\n process.env.NODE_ENV === 'development',\n Log,\n true,\n (envFilePath) => {\n Log.info(`Reload env: ${envFilePath}`)\n }\n )\n\n if (usingTypeScript && nextConfig.experimental?.typedEnv) {\n // do not await, this is not essential for further process\n createEnvDefinitions({\n distDir,\n loadedEnvFiles: [\n ...loadedEnvFiles,\n {\n path: nextConfig.configFileName,\n env: nextConfig.env,\n contents: '',\n },\n ],\n })\n }\n\n await propagateServerField(opts, 'loadEnvConfig', [\n { dev: true, forceReload: true, silent: true },\n ])\n }\n let tsconfigResult:\n | UnwrapPromise<ReturnType<typeof loadJsConfig>>\n | undefined\n\n if (tsconfigChange) {\n try {\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 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 }\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 !== 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 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 = getRouteRegex(page)\n return {\n regex: regex.re.toString(),\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 = getRouteRegex(route.page)\n dataRoutes.push({\n ...route,\n regex: routeRegex.re.toString(),\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 if (!prevSortedRoutes?.every((val, idx) => val === sortedRoutes[idx])) {\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 action: HMR_ACTIONS_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 action: HMR_ACTIONS_SENT_TO_BROWSER.ADDED_PAGE,\n data: [route],\n })\n })\n\n removedRoutes.forEach((route) => {\n hotReloader.send({\n action: HMR_ACTIONS_SENT_TO_BROWSER.REMOVED_PAGE,\n data: [route],\n })\n })\n }\n prevSortedRoutes = sortedRoutes\n\n if (usingTypeScript) {\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 appRouteHandlers,\n pageApiRoutes,\n })\n\n await writeRouteTypesManifest(\n routeTypesManifest,\n routeTypesFilePath,\n opts.nextConfig\n )\n await writeValidatorFile(routeTypesManifest, validatorFilePath)\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 } finally {\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 await propagateServerField(opts, 'reloadMatchers', undefined)\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 = url.parse(req.url || '/')\n\n if (parsedUrl.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 parsedUrl.pathname?.includes(devMiddlewareManifestPath) ||\n parsedUrl.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 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\n const result = await startWatcher({\n ...opts,\n isSrcDir,\n })\n\n opts.telemetry.record(\n eventCliSession(\n path.join(opts.dir, opts.nextConfig.distDir),\n opts.nextConfig,\n {\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\n // Track build features for dev server here:\n opts.telemetry.record({\n eventName: EVENT_BUILD_FEATURE_USAGE,\n payload: {\n featureName: 'turbopackPersistentCaching',\n invocationCount: isPersistentCachingEnabled(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":["propagateServerField","setupDevBundler","verifyTypeScript","opts","usingTypeScript","verifyResult","verifyTypeScriptSetup","dir","distDir","nextConfig","intentDirs","pagesDir","appDir","filter","Boolean","typeCheckPreflight","tsconfigPath","typescript","disableStaticImages","images","hasAppDir","hasPagesDir","version","field","args","renderServer","instance","startWatcher","resetFetch","useFileSystemPublicRoutes","path","join","setGlobal","PHASE_DEVELOPMENT_SERVER","validFileMatcher","createValidFileMatcher","pageExtensions","serverFields","consoleStore","setState","logging","hotReloader","turbo","createHotReloaderTurbopack","HotReloaderWebpack","isSrcDir","config","buildId","encryptionKey","generateEncryptionKeyBase64","isBuild","telemetry","rewrites","fsChecker","previewProps","prerenderManifest","preview","start","distTypesDir","writeRouteTypesManifest","appRoutes","pageRoutes","layoutRoutes","appRouteHandlerRoutes","redirectRoutes","rewriteRoutes","appPagePaths","Set","pagesRouterPagePaths","layoutPaths","appRouteHandlers","pageApiRoutes","filePathToRoute","Map","routesManifestPath","ROUTES_MANIFEST","routesManifest","caseSensitive","experimental","caseSensitiveRoutes","basePath","redirects","headers","i18n","undefined","skipMiddlewareUrlNormalize","fs","promises","writeFile","JSON","stringify","prerenderManifestPath","PRERENDER_MANIFEST","nextScriptWorkers","verifyPartytownSetup","CLIENT_STATIC_FILES_PATH","ensureCallback","ensure","item","type","ensurePage","clientOnly","page","itemPath","isApp","definition","resolved","prevSortedRoutes","Promise","resolve","reject","readdir","_","files","length","pages","app","directories","rootDir","getPossibleMiddlewareFilenames","getPossibleInstrumentationHookFilenames","nestedMiddleware","envFiles","map","file","push","tsconfigPaths","wp","Watchpack","ignored","pathname","some","startsWith","d","fileWatchTimes","enabledTypeScript","previousClientRouterFilters","previousConflictingPagePaths","routeTypesFilePath","validatorFilePath","on","middlewareMatchers","routedPages","knownFiles","getTimeInfoEntries","appPaths","pageNameSet","conflictingAppPagePaths","appPageFilePaths","pagesPageFilePaths","slots","envChange","tsconfigChange","conflictingPageChange","hasRootAppNotFound","appFiles","pageFiles","clear","devPageFiles","sortedKnownFiles","keys","sort","sortByPageExts","fileName","includes","meta","get","watchTime","watchTimeChange","timestamp","set","endsWith","accuracy","isPageFile","isAppPath","normalizePathSep","isPagePath","rootFile","absolutePathToPage","extensions","keepIndex","pagesType","PAGE_TYPES","ROOT","isMiddlewareFile","staticInfo","getStaticInfoIncludingLayouts","pageFilePath","isDev","isInsideAppDir","output","Log","error","actualMiddlewareFile","middleware","matchers","regexp","originalSource","isInstrumentationHookFile","actualInstrumentationHookFile","add","pageName","APP","PAGES","isMetadataRouteFile","replace","getPageStaticInfo","pageType","normalizeMetadataPageToRoute","generateSitemaps","generateImageMetadata","isRootNotFound","segments","split","i","segment","isParallelRouteSegment","parentPath","normalizeAppPath","slice","slotName","s","name","parent","isAppLayoutPage","route","ensureLeadingSlash","filePath","relative","dirname","isAppRouterPage","originalPageName","isAppRouterRoute","nextDataRoutes","has","test","numConflicting","size","errorMessage","p","appPath","pagesPath","setHmrServerError","Error","clearHmrServerError","clientRouterFilters","clientRouterFilter","createClientRouterFilter","Object","clientRouterFilterRedirects","_originalRedirects","r","internal","clientRouterFilterAllowedRate","then","catch","loadedEnvFiles","loadEnvConfig","process","env","NODE_ENV","envFilePath","info","typedEnv","createEnvDefinitions","configFileName","contents","dev","forceReload","silent","tsconfigResult","loadJsConfig","turbopackProject","hasRewrites","afterFiles","beforeFiles","fallback","rootPath","turbopack","root","outputFileTracingRoot","update","defineEnv","createDefineEnv","isTurbopack","fetchCacheKeyPrefix","projectPath","normalizePath","activeWebpackConfigs","forEach","idx","isClient","isNodeServer","isEdgeServer","plugins","plugin","JsConfigPathsPlugin","jsConfig","resolvedBaseUrl","currentResolvedBaseUrl","resolvedUrlIndex","modules","findIndex","baseUrl","splice","isImplicit","compilerOptions","paths","key","assign","definitions","__NEXT_DEFINE_ENV","newDefine","getDefineEnv","invalidate","reloadAfterInvalidation","NestedMiddlewareError","message","appPathRoutes","fromEntries","entries","k","v","match","hasAppNotFound","middlewareMatcher","getMiddlewareRouteMatcher","interceptionRoutes","generateInterceptionRoutesRewrites","buildCustomRoute","exportPathMap","outDir","exportPathMapEntries","exportPathMapRoutes","value","source","destination","query","qs","sortedRoutes","getSortedRoutes","dynamicRoutes","regex","getRouteRegex","re","toString","getRouteMatcher","dataRoutes","buildDataRoute","routeRegex","RegExp","dataRouteRegex","groups","unshift","every","val","addedRoutes","removedRoutes","send","action","HMR_ACTIONS_SENT_TO_BROWSER","DEV_PAGES_MANIFEST_UPDATE","data","devPagesManifest","ADDED_PAGE","REMOVED_PAGE","routeTypesManifest","createRouteTypesManifest","writeValidatorFile","e","warn","watch","startTime","clientPagesManifestPath","DEV_CLIENT_PAGES_MANIFEST","devVirtualFsItems","devMiddlewareManifestPath","DEV_CLIENT_MIDDLEWARE_MANIFEST","devTurbopackMiddlewareManifestPath","TURBOPACK_CLIENT_MIDDLEWARE_MANIFEST","requestHandler","req","res","parsedUrl","url","parse","statusCode","setHeader","JSON_CONTENT_TYPE_HEADER","end","finished","logErrorWithOriginalStack","err","ModuleBuildError","TurbopackInternalError","ensureMiddleware","requestUrl","result","record","eventCliSession","webpackVersion","turboFlag","cliCommand","isCustomServer","hasNowJson","findUp","cwd","eventName","EVENT_BUILD_FEATURE_USAGE","payload","featureName","invocationCount","isPersistentCachingEnabled"],"mappings":";;;;;;;;;;;;;;;IAgKsBA,oBAAoB;eAApBA;;IAq/BAC,eAAe;eAAfA;;;mCA/oCf;qBAMyB;2DACjB;4DACC;6DACC;oEACF;kEACO;qBACQ;+DACX;4BACc;6DACZ;2EACU;w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C,iCAAyB;QACpCC,SAAS;YACPC,aAAa;YACbC,iBAAiBC,IAAAA,kCAA0B,EAACzZ,KAAKM,UAAU,IAAI,IAAI;QACrE;IACF;IAEA,OAAOoY;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 {\n getPageStaticInfo,\n type MiddlewareMatcher,\n} 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 fs from 'fs'\nimport url from 'url'\nimport path from 'path'\nimport qs from 'querystring'\nimport Watchpack from 'next/dist/compiled/watchpack'\nimport { loadEnvConfig } from '@next/env'\nimport findUp from 'next/dist/compiled/find-up'\nimport { buildCustomRoute } from './filesystem'\nimport * as Log from '../../../build/output/log'\nimport HotReloaderWebpack from '../../dev/hot-reloader-webpack'\nimport { setGlobal } from '../../../trace/shared'\nimport type { Telemetry } from '../../../telemetry/storage'\nimport type { IncomingMessage, ServerResponse } from 'http'\nimport loadJsConfig from '../../../build/load-jsconfig'\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 {\n getStaticInfoIncludingLayouts,\n sortByPageExts,\n} from '../../../build/entries'\nimport { verifyTypeScriptSetup } from '../../../lib/verify-typescript-setup'\nimport { verifyPartytownSetup } from '../../../lib/verify-partytown-setup'\nimport { getRouteRegex } 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_ACTIONS_SENT_TO_BROWSER } from '../../dev/hot-reloader-types'\nimport { PAGE_TYPES } from '../../../lib/page-types'\nimport { createHotReloaderTurbopack } from '../../dev/hot-reloader-turbopack'\nimport { generateEncryptionKeyBase64 } from '../../app-render/encryption-utils-server'\nimport { isMetadataRouteFile } from '../../../lib/metadata/is-metadata-route'\nimport { normalizeMetadataPageToRoute } from '../../../lib/metadata/get-metadata-route'\nimport { createEnvDefinitions } from '../experimental/create-env-definitions'\nimport { JsConfigPathsPlugin } from '../../../build/webpack/plugins/jsconfig-paths-plugin'\nimport { store as consoleStore } from '../../../build/output/store'\nimport {\n isPersistentCachingEnabled,\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 { JSON_CONTENT_TYPE_HEADER } from '../../../lib/constants'\nimport {\n createRouteTypesManifest,\n writeRouteTypesManifest,\n writeValidatorFile,\n} from './route-types-utils'\nimport { isParallelRouteSegment } from '../../../shared/lib/segment'\nimport { ensureLeadingSlash } from '../../../shared/lib/page-path/ensure-leading-slash'\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 skipMiddlewareUrlNormalize: RoutesManifest['skipMiddlewareUrlNormalize']\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?: MiddlewareMatcher[]\n }\n | undefined\n hasAppNotFound?: boolean\n interceptionRoutes?: ReturnType<\n typeof import('./filesystem').buildCustomRoute\n >[]\n setIsrStatus?: (key: string, value: boolean) => void\n resetFetch?: () => void\n}\n\nasync function verifyTypeScript(opts: SetupOpts) {\n let usingTypeScript = false\n const verifyResult = await verifyTypeScriptSetup({\n dir: opts.dir,\n distDir: opts.nextConfig.distDir,\n intentDirs: [opts.pagesDir, opts.appDir].filter(Boolean) as string[],\n typeCheckPreflight: false,\n tsconfigPath: opts.nextConfig.typescript.tsconfigPath,\n disableStaticImages: opts.nextConfig.images.disableStaticImages,\n hasAppDir: !!opts.appDir,\n hasPagesDir: !!opts.pagesDir,\n })\n\n if (verifyResult.version) {\n usingTypeScript = true\n }\n return usingTypeScript\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 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 createHotReloaderTurbopack(opts, serverFields, distDir, resetFetch)\n : new HotReloaderWebpack(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 })\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 usingTypeScript = await verifyTypeScript(opts)\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 skipMiddlewareUrlNormalize: nextConfig.skipMiddlewareUrlNormalize,\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 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 = usingTypeScript\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 wp.on('aggregated', async () => {\n let middlewareMatchers: MiddlewareMatcher[] | 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 } = opts.fsChecker\n\n appFiles.clear()\n pageFiles.clear()\n devPageFiles.clear()\n\n const sortedKnownFiles: string[] = [...knownFiles.keys()].sort(\n sortByPageExts(nextConfig.pageExtensions)\n )\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 const meta = knownFiles.get(fileName)\n\n const watchTime = fileWatchTimes.get(fileName)\n // If the file is showing up for the first time or the meta.timestamp is changed since last time\n const watchTimeChange =\n watchTime === undefined ||\n (watchTime && watchTime !== meta?.timestamp)\n fileWatchTimes.set(fileName, meta?.timestamp)\n\n if (envFiles.includes(fileName)) {\n if (watchTimeChange) {\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 (watchTimeChange) {\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 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 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 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 appFiles.add(pageName)\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 (!usingTypeScript && enabledTypeScript) {\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 (envChange || tsconfigChange) {\n if (envChange) {\n const { loadedEnvFiles } = loadEnvConfig(\n dir,\n process.env.NODE_ENV === 'development',\n Log,\n true,\n (envFilePath) => {\n Log.info(`Reload env: ${envFilePath}`)\n }\n )\n\n if (usingTypeScript && nextConfig.experimental?.typedEnv) {\n // do not await, this is not essential for further process\n createEnvDefinitions({\n distDir,\n loadedEnvFiles: [\n ...loadedEnvFiles,\n {\n path: nextConfig.configFileName,\n env: nextConfig.env,\n contents: '',\n },\n ],\n })\n }\n\n await propagateServerField(opts, 'loadEnvConfig', [\n { dev: true, forceReload: true, silent: true },\n ])\n }\n let tsconfigResult:\n | UnwrapPromise<ReturnType<typeof loadJsConfig>>\n | undefined\n\n if (tsconfigChange) {\n try {\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 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 }\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 !== 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 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 = getRouteRegex(page)\n return {\n regex: regex.re.toString(),\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 = getRouteRegex(route.page)\n dataRoutes.push({\n ...route,\n regex: routeRegex.re.toString(),\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 if (!prevSortedRoutes?.every((val, idx) => val === sortedRoutes[idx])) {\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 action: HMR_ACTIONS_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 action: HMR_ACTIONS_SENT_TO_BROWSER.ADDED_PAGE,\n data: [route],\n })\n })\n\n removedRoutes.forEach((route) => {\n hotReloader.send({\n action: HMR_ACTIONS_SENT_TO_BROWSER.REMOVED_PAGE,\n data: [route],\n })\n })\n }\n prevSortedRoutes = sortedRoutes\n\n if (usingTypeScript) {\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\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 } finally {\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 await propagateServerField(opts, 'reloadMatchers', undefined)\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 = url.parse(req.url || '/')\n\n if (parsedUrl.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 parsedUrl.pathname?.includes(devMiddlewareManifestPath) ||\n parsedUrl.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 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\n const result = await startWatcher({\n ...opts,\n isSrcDir,\n })\n\n opts.telemetry.record(\n eventCliSession(\n path.join(opts.dir, opts.nextConfig.distDir),\n opts.nextConfig,\n {\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\n // Track build features for dev server here:\n opts.telemetry.record({\n eventName: EVENT_BUILD_FEATURE_USAGE,\n payload: {\n featureName: 'turbopackPersistentCaching',\n invocationCount: isPersistentCachingEnabled(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":["propagateServerField","setupDevBundler","verifyTypeScript","opts","usingTypeScript","verifyResult","verifyTypeScriptSetup","dir","distDir","nextConfig","intentDirs","pagesDir","appDir","filter","Boolean","typeCheckPreflight","tsconfigPath","typescript","disableStaticImages","images","hasAppDir","hasPagesDir","version","field","args","renderServer","instance","startWatcher","resetFetch","useFileSystemPublicRoutes","path","join","setGlobal","PHASE_DEVELOPMENT_SERVER","validFileMatcher","createValidFileMatcher","pageExtensions","serverFields","consoleStore","setState","logging","hotReloader","turbo","createHotReloaderTurbopack","HotReloaderWebpack","isSrcDir","config","buildId","encryptionKey","generateEncryptionKeyBase64","isBuild","telemetry","rewrites","fsChecker","previewProps","prerenderManifest","preview","start","distTypesDir","writeRouteTypesManifest","appRoutes","pageRoutes","layoutRoutes","appRouteHandlerRoutes","redirectRoutes","rewriteRoutes","appPagePaths","Set","pagesRouterPagePaths","layoutPaths","appRouteHandlers","pageApiRoutes","filePathToRoute","Map","routesManifestPath","ROUTES_MANIFEST","routesManifest","caseSensitive","experimental","caseSensitiveRoutes","basePath","redirects","headers","i18n","undefined","skipMiddlewareUrlNormalize","fs","promises","writeFile","JSON","stringify","prerenderManifestPath","PRERENDER_MANIFEST","nextScriptWorkers","verifyPartytownSetup","CLIENT_STATIC_FILES_PATH","ensureCallback","ensure","item","type","ensurePage","clientOnly","page","itemPath","isApp","definition","resolved","prevSortedRoutes","Promise","resolve","reject","readdir","_","files","length","pages","app","directories","rootDir","getPossibleMiddlewareFilenames","getPossibleInstrumentationHookFilenames","nestedMiddleware","envFiles","map","file","push","tsconfigPaths","wp","Watchpack","ignored","pathname","some","startsWith","d","fileWatchTimes","enabledTypeScript","previousClientRouterFilters","previousConflictingPagePaths","routeTypesFilePath","validatorFilePath","on","middlewareMatchers","routedPages","knownFiles","getTimeInfoEntries","appPaths","pageNameSet","conflictingAppPagePaths","appPageFilePaths","pagesPageFilePaths","slots","envChange","tsconfigChange","conflictingPageChange","hasRootAppNotFound","appFiles","pageFiles","clear","devPageFiles","sortedKnownFiles","keys","sort","sortByPageExts","fileName","includes","meta","get","watchTime","watchTimeChange","timestamp","set","endsWith","accuracy","isPageFile","isAppPath","normalizePathSep","isPagePath","rootFile","absolutePathToPage","extensions","keepIndex","pagesType","PAGE_TYPES","ROOT","isMiddlewareFile","staticInfo","getStaticInfoIncludingLayouts","pageFilePath","isDev","isInsideAppDir","output","Log","error","actualMiddlewareFile","middleware","matchers","regexp","originalSource","isInstrumentationHookFile","actualInstrumentationHookFile","add","pageName","APP","PAGES","isMetadataRouteFile","replace","getPageStaticInfo","pageType","normalizeMetadataPageToRoute","generateSitemaps","generateImageMetadata","isRootNotFound","segments","split","i","segment","isParallelRouteSegment","parentPath","normalizeAppPath","slice","slotName","s","name","parent","isAppLayoutPage","route","ensureLeadingSlash","filePath","isAppRouterPage","originalPageName","isAppRouterRoute","nextDataRoutes","has","test","numConflicting","size","errorMessage","p","appPath","relative","pagesPath","setHmrServerError","Error","clearHmrServerError","clientRouterFilters","clientRouterFilter","createClientRouterFilter","Object","clientRouterFilterRedirects","_originalRedirects","r","internal","clientRouterFilterAllowedRate","then","catch","loadedEnvFiles","loadEnvConfig","process","env","NODE_ENV","envFilePath","info","typedEnv","createEnvDefinitions","configFileName","contents","dev","forceReload","silent","tsconfigResult","loadJsConfig","turbopackProject","hasRewrites","afterFiles","beforeFiles","fallback","rootPath","turbopack","root","outputFileTracingRoot","update","defineEnv","createDefineEnv","isTurbopack","fetchCacheKeyPrefix","projectPath","normalizePath","activeWebpackConfigs","forEach","idx","isClient","isNodeServer","isEdgeServer","plugins","plugin","JsConfigPathsPlugin","jsConfig","resolvedBaseUrl","currentResolvedBaseUrl","resolvedUrlIndex","modules","findIndex","baseUrl","splice","isImplicit","compilerOptions","paths","key","assign","definitions","__NEXT_DEFINE_ENV","newDefine","getDefineEnv","invalidate","reloadAfterInvalidation","NestedMiddlewareError","message","appPathRoutes","fromEntries","entries","k","v","match","hasAppNotFound","middlewareMatcher","getMiddlewareRouteMatcher","interceptionRoutes","generateInterceptionRoutesRewrites","buildCustomRoute","exportPathMap","outDir","exportPathMapEntries","exportPathMapRoutes","value","source","destination","query","qs","sortedRoutes","getSortedRoutes","dynamicRoutes","regex","getRouteRegex","re","toString","getRouteMatcher","dataRoutes","buildDataRoute","routeRegex","RegExp","dataRouteRegex","groups","unshift","every","val","addedRoutes","removedRoutes","send","action","HMR_ACTIONS_SENT_TO_BROWSER","DEV_PAGES_MANIFEST_UPDATE","data","devPagesManifest","ADDED_PAGE","REMOVED_PAGE","routeTypesManifest","createRouteTypesManifest","writeValidatorFile","e","warn","watch","startTime","clientPagesManifestPath","DEV_CLIENT_PAGES_MANIFEST","devVirtualFsItems","devMiddlewareManifestPath","DEV_CLIENT_MIDDLEWARE_MANIFEST","devTurbopackMiddlewareManifestPath","TURBOPACK_CLIENT_MIDDLEWARE_MANIFEST","requestHandler","req","res","parsedUrl","url","parse","statusCode","setHeader","JSON_CONTENT_TYPE_HEADER","end","finished","logErrorWithOriginalStack","err","ModuleBuildError","TurbopackInternalError","ensureMiddleware","requestUrl","result","record","eventCliSession","webpackVersion","turboFlag","cliCommand","isCustomServer","hasNowJson","findUp","cwd","eventName","EVENT_BUILD_FEATURE_USAGE","payload","featureName","invocationCount","isPersistentCachingEnabled"],"mappings":";;;;;;;;;;;;;;;IAgKsBA,oBAAoB;eAApBA;;IAy+BAC,eAAe;eAAfA;;;mCAnoCf;qBAMyB;2DACjB;4DACC;6DACC;oEACF;kEACO;qBACQ;+DACX;4BACc;6DACZ;2EACU;wBACL;qEAGD;8BACc;wBAIhC;uBACyB;yBAIzB;uCAC+B;sCACD;4BACP;0BACG;gCACF;8BACC;kCACC;0CACQ;oCACN;oDACgB;2BAU5C;wCAEmC;wBAQnC;yBACsB;kCAEe;2BACjB;sCACgB;uCACC;iCACR;kCACS;sCACR;qCACD;uBACE;wBAI/B;2BACsB;+BACU;+BACT;4BACW;iCAKlC;yBACgC;oCACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDnC,eAAeC,iBAAiBC,IAAe;IAC7C,IAAIC,kBAAkB;IACtB,MAAMC,eAAe,MAAMC,IAAAA,4CAAqB,EAAC;QAC/CC,KAAKJ,KAAKI,GAAG;QACbC,SAASL,KAAKM,UAAU,CAACD,OAAO;QAChCE,YAAY;YAACP,KAAKQ,QAAQ;YAAER,KAAKS,MAAM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AKM,UAAU,CAACD,OAAO,GAC3CL,KAAKM,UAAU,EACf;QACEsY,gBAAgB;QAChBlW;QACAmW,WAAW,CAAC,CAAC7Y,KAAKuC,KAAK;QACvBuW,YAAY;QACZrY,QAAQ,CAAC,CAACT,KAAKS,MAAM;QACrBD,UAAU,CAAC,CAACR,KAAKQ,QAAQ;QACzBuY,gBAAgB,CAAC,CAAC/Y,KAAK+Y,cAAc;QACrCC,YAAY,CAAC,CAAE,MAAMC,IAAAA,eAAM,EAAC,YAAY;YAAEC,KAAKlZ,KAAKI,GAAG;QAAC;IAC1D;IAIJ,4CAA4C;IAC5CJ,KAAKgD,SAAS,CAAC0V,MAAM,CAAC;QACpBS,WAAWC,iCAAyB;QACpCC,SAAS;YACPC,aAAa;YACbC,iBAAiBC,IAAAA,kCAA0B,EAACxZ,KAAKM,UAAU,IAAI,IAAI;QACrE;IACF;IAEA,OAAOmY;AACT;CAIA,2DAA2D","ignoreList":[0]}
|
@@ -377,8 +377,11 @@ function generateValidatorFile(routesManifest) {
|
|
377
377
|
const typeWithRoute = route && (type === 'AppPageConfig' || type === 'LayoutConfig' || type === 'RouteHandlerConfig') ? `${type}<${JSON.stringify(route)}>` : type;
|
378
378
|
return `// Validate ${filePath}
|
379
379
|
{
|
380
|
+
type __IsExpected<Specific extends ${typeWithRoute}> = Specific
|
380
381
|
const handler = {} as typeof import(${JSON.stringify(importPath.replace(/\.tsx?$/, '.js'))})
|
381
|
-
|
382
|
+
type __Check = __IsExpected<typeof handler>
|
383
|
+
// @ts-ignore
|
384
|
+
type __Unused = __Check
|
382
385
|
}`;
|
383
386
|
}).join('\n\n');
|
384
387
|
// Use direct mappings from the manifest
|
@@ -463,7 +466,7 @@ function generateValidatorFile(routesManifest) {
|
|
463
466
|
}
|
464
467
|
if (pagesApiRouteValidations) {
|
465
468
|
typeDefinitions += `type ApiRouteConfig = {
|
466
|
-
default: (req: any, res: any) =>
|
469
|
+
default: (req: any, res: any) => ReturnType<NextApiHandler>
|
467
470
|
config?: {
|
468
471
|
api?: {
|
469
472
|
bodyParser?: boolean | { sizeLimit?: string }
|
@@ -496,14 +499,21 @@ function generateValidatorFile(routesManifest) {
|
|
496
499
|
}
|
497
500
|
const routeImportStatement = routeImports.length > 0 ? `import type { ${routeImports.join(', ')} } from "./routes.js"` : '';
|
498
501
|
const nextRequestImport = hasAppRouteHandlers ? "import type { NextRequest } from 'next/server.js'\n" : '';
|
499
|
-
//
|
500
|
-
const
|
502
|
+
// Conditionally import types from next/types, merged into a single statement
|
503
|
+
const nextTypes = [];
|
504
|
+
if (pagesApiRouteValidations) {
|
505
|
+
nextTypes.push('NextApiHandler');
|
506
|
+
}
|
507
|
+
if (appPageValidations || layoutValidations) {
|
508
|
+
nextTypes.push('ResolvingMetadata', 'ResolvingViewport');
|
509
|
+
}
|
510
|
+
const nextTypesImport = nextTypes.length > 0 ? `import type { ${nextTypes.join(', ')} } from "next/types.js"\n` : '';
|
501
511
|
return `// This file is generated automatically by Next.js
|
502
512
|
// Do not edit this file manually
|
503
513
|
// This file validates that all pages and layouts export the correct types
|
504
514
|
|
505
515
|
${routeImportStatement}
|
506
|
-
${
|
516
|
+
${nextTypesImport}${nextRequestImport}
|
507
517
|
${typeDefinitions}
|
508
518
|
${appPageValidations}
|
509
519
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../src/server/lib/router-utils/typegen.ts"],"sourcesContent":["import type { RouteTypesManifest } from './route-types-utils'\nimport { isDynamicRoute } from '../../../shared/lib/router/utils/is-dynamic'\n\nfunction generateRouteTypes(routesManifest: RouteTypesManifest): string {\n const appRoutes = Object.keys(routesManifest.appRoutes).sort()\n const pageRoutes = Object.keys(routesManifest.pageRoutes).sort()\n const layoutRoutes = Object.keys(routesManifest.layoutRoutes).sort()\n const redirectRoutes = Object.keys(routesManifest.redirectRoutes).sort()\n const rewriteRoutes = Object.keys(routesManifest.rewriteRoutes).sort()\n\n let result = ''\n\n // Generate AppRoutes union type (pages only)\n if (appRoutes.length > 0) {\n result += `type AppRoutes = ${appRoutes.map((route) => JSON.stringify(route)).join(' | ')}\\n`\n } else {\n result += 'type AppRoutes = never\\n'\n }\n\n // Generate AppRouteHandlerRoutes union type for route handlers\n const appRouteHandlerRoutes = Object.keys(\n routesManifest.appRouteHandlerRoutes\n ).sort()\n\n const hasAppRouteHandlers = appRouteHandlerRoutes.length > 0\n\n if (hasAppRouteHandlers) {\n result += `type AppRouteHandlerRoutes = ${appRouteHandlerRoutes.map((route) => JSON.stringify(route)).join(' | ')}\\n`\n }\n\n // Generate PageRoutes union type\n if (pageRoutes.length > 0) {\n result += `type PageRoutes = ${pageRoutes.map((route) => JSON.stringify(route)).join(' | ')}\\n`\n } else {\n result += 'type PageRoutes = never\\n'\n }\n\n // Generate LayoutRoutes union type\n if (layoutRoutes.length > 0) {\n result += `type LayoutRoutes = ${layoutRoutes.map((route) => JSON.stringify(route)).join(' | ')}\\n`\n } else {\n result += 'type LayoutRoutes = never\\n'\n }\n\n // Generate RedirectRoutes union type\n if (redirectRoutes.length > 0) {\n result += `type RedirectRoutes = ${redirectRoutes\n .map((route) => JSON.stringify(route))\n .join(' | ')}\\n`\n } else {\n result += 'type RedirectRoutes = never\\n'\n }\n\n // Generate RewriteRoutes union type\n if (rewriteRoutes.length > 0) {\n result += `type RewriteRoutes = ${rewriteRoutes\n .map((route) => JSON.stringify(route))\n .join(' | ')}\\n`\n } else {\n result += 'type RewriteRoutes = never\\n'\n }\n\n // Only include AppRouteHandlerRoutes in Routes union if there are actual route handlers\n const routeUnionParts = [\n 'AppRoutes',\n 'PageRoutes',\n 'LayoutRoutes',\n 'RedirectRoutes',\n 'RewriteRoutes',\n ]\n if (hasAppRouteHandlers) {\n routeUnionParts.push('AppRouteHandlerRoutes')\n }\n\n result += `type Routes = ${routeUnionParts.join(' | ')}\\n`\n\n return result\n}\n\nfunction generateParamTypes(routesManifest: RouteTypesManifest): string {\n const allRoutes = {\n ...routesManifest.appRoutes,\n ...routesManifest.appRouteHandlerRoutes,\n ...routesManifest.pageRoutes,\n ...routesManifest.layoutRoutes,\n ...routesManifest.redirectRoutes,\n ...routesManifest.rewriteRoutes,\n }\n\n let paramTypes = 'interface ParamMap {\\n'\n\n // Sort routes deterministically for consistent output\n const sortedRoutes = Object.entries(allRoutes).sort(([a], [b]) =>\n a.localeCompare(b)\n )\n\n for (const [route, routeInfo] of sortedRoutes) {\n const { groups } = routeInfo\n\n // For static routes (no dynamic segments), we can produce an empty parameter map.\n if (!isDynamicRoute(route) || Object.keys(groups ?? {}).length === 0) {\n paramTypes += ` ${JSON.stringify(route)}: {}\\n`\n continue\n }\n\n let paramType = '{'\n\n // Process each group based on its properties\n for (const [key, group] of Object.entries(groups)) {\n const escapedKey = JSON.stringify(key)\n if (group.repeat) {\n // Catch-all parameters\n if (group.optional) {\n paramType += ` ${escapedKey}?: string[];`\n } else {\n paramType += ` ${escapedKey}: string[];`\n }\n } else {\n // Regular parameters\n if (group.optional) {\n paramType += ` ${escapedKey}?: string;`\n } else {\n paramType += ` ${escapedKey}: string;`\n }\n }\n }\n\n paramType += ' }'\n\n paramTypes += ` ${JSON.stringify(route)}: ${paramType}\\n`\n }\n\n paramTypes += '}\\n'\n return paramTypes\n}\n\nfunction generateLayoutSlotMap(routesManifest: RouteTypesManifest): string {\n let slotMap = 'interface LayoutSlotMap {\\n'\n\n // Sort routes deterministically for consistent output\n const sortedLayoutRoutes = Object.entries(routesManifest.layoutRoutes).sort(\n ([a], [b]) => a.localeCompare(b)\n )\n\n for (const [route, routeInfo] of sortedLayoutRoutes) {\n if ('slots' in routeInfo) {\n const slots = routeInfo.slots.sort()\n if (slots.length > 0) {\n slotMap += ` ${JSON.stringify(route)}: ${slots.map((slot) => JSON.stringify(slot)).join(' | ')}\\n`\n } else {\n slotMap += ` ${JSON.stringify(route)}: never\\n`\n }\n } else {\n slotMap += ` ${JSON.stringify(route)}: never\\n`\n }\n }\n\n slotMap += '}\\n'\n return slotMap\n}\n\n// Helper function to format routes to route types (matches the plugin logic exactly)\nfunction formatRouteToRouteType(route: string) {\n const isDynamic = isDynamicRoute(route)\n if (isDynamic) {\n route = route\n .split('/')\n .map((part) => {\n if (part.startsWith('[') && part.endsWith(']')) {\n if (part.startsWith('[...')) {\n // /[...slug]\n return `\\${CatchAllSlug<T>}`\n } else if (part.startsWith('[[...') && part.endsWith(']]')) {\n // /[[...slug]]\n return `\\${OptionalCatchAllSlug<T>}`\n }\n // /[slug]\n return `\\${SafeSlug<T>}`\n }\n return part\n })\n .join('/')\n }\n\n return {\n isDynamic,\n routeType: route,\n }\n}\n\n// Helper function to serialize route types (matches the plugin logic exactly)\nfunction serializeRouteTypes(routeTypes: string[]) {\n // route collection is not deterministic, this makes the output of the file deterministic\n return routeTypes\n .sort()\n .map((route) => `\\n | \\`${route}\\``)\n .join('')\n}\n\nexport function generateLinkTypesFile(\n routesManifest: RouteTypesManifest\n): string {\n // Generate serialized static and dynamic routes for the internal namespace\n // Build a unified set of routes across app/pages/redirect/rewrite as well as\n // app route handlers and Pages Router API routes.\n const allRoutesSet = new Set<string>([\n ...Object.keys(routesManifest.appRoutes),\n ...Object.keys(routesManifest.pageRoutes),\n ...Object.keys(routesManifest.redirectRoutes),\n ...Object.keys(routesManifest.rewriteRoutes),\n // Allow linking to App Route Handlers (e.g. `/logout/route.ts`)\n ...Object.keys(routesManifest.appRouteHandlerRoutes),\n // Allow linking to Pages Router API routes (e.g. `/api/*`)\n ...Array.from(routesManifest.pageApiRoutes),\n ])\n\n const staticRouteTypes: string[] = []\n const dynamicRouteTypes: string[] = []\n\n // Process each route using the same logic as the plugin\n for (const route of allRoutesSet) {\n const { isDynamic, routeType } = formatRouteToRouteType(route)\n if (isDynamic) {\n dynamicRouteTypes.push(routeType)\n } else {\n staticRouteTypes.push(routeType)\n }\n }\n\n const serializedStaticRouteTypes = serializeRouteTypes(staticRouteTypes)\n const serializedDynamicRouteTypes = serializeRouteTypes(dynamicRouteTypes)\n\n // If both StaticRoutes and DynamicRoutes are empty, fallback to type 'string & {}'.\n const routeTypesFallback =\n !serializedStaticRouteTypes && !serializedDynamicRouteTypes\n ? 'string & {}'\n : ''\n\n return `// This file is generated automatically by Next.js\n// Do not edit this file manually\n\n// Type definitions for Next.js routes\n\n/**\n * Internal types used by the Next.js router and Link component.\n * These types are not meant to be used directly.\n * @internal\n */\ndeclare namespace __next_route_internal_types__ {\n type SearchOrHash = \\`?\\${string}\\` | \\`#\\${string}\\`\n type WithProtocol = \\`\\${string}:\\${string}\\`\n\n type Suffix = '' | SearchOrHash\n\n type SafeSlug<S extends string> = S extends \\`\\${string}/\\${string}\\`\n ? never\n : S extends \\`\\${string}\\${SearchOrHash}\\`\n ? never\n : S extends ''\n ? never\n : S\n\n type CatchAllSlug<S extends string> = S extends \\`\\${string}\\${SearchOrHash}\\`\n ? never\n : S extends ''\n ? never\n : S\n\n type OptionalCatchAllSlug<S extends string> =\n S extends \\`\\${string}\\${SearchOrHash}\\` ? never : S\n\n type StaticRoutes = ${serializedStaticRouteTypes || 'never'}\n type DynamicRoutes<T extends string = string> = ${\n serializedDynamicRouteTypes || 'never'\n }\n\n type RouteImpl<T> = ${\n routeTypesFallback ||\n `\n ${\n // This keeps autocompletion working for static routes.\n '| StaticRoutes'\n }\n | SearchOrHash\n | WithProtocol\n | \\`\\${StaticRoutes}\\${SearchOrHash}\\`\n | (T extends \\`\\${DynamicRoutes<infer _>}\\${Suffix}\\` ? T : never)\n `\n }\n}\n\ndeclare module 'next' {\n export { default } from 'next/types.js'\n export * from 'next/types.js'\n\n export type Route<T extends string = string> =\n __next_route_internal_types__.RouteImpl<T>\n}\n\ndeclare module 'next/link' {\n import type { LinkProps as OriginalLinkProps } from 'next/dist/client/link.js'\n import type { AnchorHTMLAttributes, DetailedHTMLProps } from 'react'\n import type { UrlObject } from 'url'\n\n type LinkRestProps = Omit<\n Omit<\n DetailedHTMLProps<\n AnchorHTMLAttributes<HTMLAnchorElement>,\n HTMLAnchorElement\n >,\n keyof OriginalLinkProps\n > &\n OriginalLinkProps,\n 'href'\n >\n\n export type LinkProps<RouteInferType> = LinkRestProps & {\n /**\n * The path or URL to navigate to. This is the only required prop. It can also be an object.\n * @see https://nextjs.org/docs/api-reference/next/link\n */\n href: __next_route_internal_types__.RouteImpl<RouteInferType> | UrlObject\n }\n\n export default function Link<RouteType>(props: LinkProps<RouteType>): JSX.Element\n}\n\ndeclare module 'next/navigation' {\n export * from 'next/dist/client/components/navigation.js'\n\n import type { NavigateOptions, AppRouterInstance as OriginalAppRouterInstance } from 'next/dist/shared/lib/app-router-context.shared-runtime.js'\n import type { RedirectType } from 'next/dist/client/components/redirect-error.js'\n \n interface AppRouterInstance extends OriginalAppRouterInstance {\n /**\n * Navigate to the provided href.\n * Pushes a new history entry.\n */\n push<RouteType>(href: __next_route_internal_types__.RouteImpl<RouteType>, options?: NavigateOptions): void\n /**\n * Navigate to the provided href.\n * Replaces the current history entry.\n */\n replace<RouteType>(href: __next_route_internal_types__.RouteImpl<RouteType>, options?: NavigateOptions): void\n /**\n * Prefetch the provided href.\n */\n prefetch<RouteType>(href: __next_route_internal_types__.RouteImpl<RouteType>): void\n }\n\n export function useRouter(): AppRouterInstance;\n \n /**\n * This function allows you to redirect the user to another URL. It can be used in\n * [Server Components](https://nextjs.org/docs/app/building-your-application/rendering/server-components),\n * [Route Handlers](https://nextjs.org/docs/app/building-your-application/routing/route-handlers), and\n * [Server Actions](https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations).\n *\n * - In a Server Component, this will insert a meta tag to redirect the user to the target page.\n * - In a Route Handler or Server Action, it will serve a 307/303 to the caller.\n * - In a Server Action, type defaults to 'push' and 'replace' elsewhere.\n *\n * Read more: [Next.js Docs: redirect](https://nextjs.org/docs/app/api-reference/functions/redirect)\n */\n export function redirect<RouteType>(\n /** The URL to redirect to */\n url: __next_route_internal_types__.RouteImpl<RouteType>,\n type?: RedirectType\n ): never;\n \n /**\n * This function allows you to redirect the user to another URL. It can be used in\n * [Server Components](https://nextjs.org/docs/app/building-your-application/rendering/server-components),\n * [Route Handlers](https://nextjs.org/docs/app/building-your-application/routing/route-handlers), and\n * [Server Actions](https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations).\n *\n * - In a Server Component, this will insert a meta tag to redirect the user to the target page.\n * - In a Route Handler or Server Action, it will serve a 308/303 to the caller.\n *\n * Read more: [Next.js Docs: redirect](https://nextjs.org/docs/app/api-reference/functions/redirect)\n */\n export function permanentRedirect<RouteType>(\n /** The URL to redirect to */\n url: __next_route_internal_types__.RouteImpl<RouteType>,\n type?: RedirectType\n ): never;\n}\n\ndeclare module 'next/form' {\n import type { FormProps as OriginalFormProps } from 'next/dist/client/form.js'\n\n type FormRestProps = Omit<OriginalFormProps, 'action'>\n\n export type FormProps<RouteInferType> = {\n /**\n * \\`action\\` can be either a \\`string\\` or a function.\n * - If \\`action\\` is a string, it will be interpreted as a path or URL to navigate to when the form is submitted.\n * The path will be prefetched when the form becomes visible.\n * - If \\`action\\` is a function, it will be called when the form is submitted. See the [React docs](https://react.dev/reference/react-dom/components/form#props) for more.\n */\n action: __next_route_internal_types__.RouteImpl<RouteInferType> | ((formData: FormData) => void)\n } & FormRestProps\n\n export default function Form<RouteType>(props: FormProps<RouteType>): JSX.Element\n}\n`\n}\n\nexport function generateValidatorFile(\n routesManifest: RouteTypesManifest\n): string {\n const generateValidations = (\n paths: string[],\n type:\n | 'AppPageConfig'\n | 'PagesPageConfig'\n | 'LayoutConfig'\n | 'RouteHandlerConfig'\n | 'ApiRouteConfig',\n pathToRouteMap?: Map<string, string>\n ) =>\n paths\n .sort()\n // Only validate TypeScript files - JavaScript files have too many type inference limitations\n .filter(\n (filePath) => filePath.endsWith('.ts') || filePath.endsWith('.tsx')\n )\n .filter(\n // Don't include metadata routes or pages\n // (e.g. /manifest.webmanifest)\n (filePath) =>\n type !== 'AppPageConfig' ||\n filePath.endsWith('page.ts') ||\n filePath.endsWith('page.tsx')\n )\n .map((filePath) => {\n // Keep the file extension for TypeScript imports to support node16 module resolution\n const importPath = filePath\n const route = pathToRouteMap?.get(filePath)\n const typeWithRoute =\n route &&\n (type === 'AppPageConfig' ||\n type === 'LayoutConfig' ||\n type === 'RouteHandlerConfig')\n ? `${type}<${JSON.stringify(route)}>`\n : type\n return `// Validate ${filePath}\n{\n const handler = {} as typeof import(${JSON.stringify(\n importPath.replace(/\\.tsx?$/, '.js')\n )})\n handler satisfies ${typeWithRoute}\n}`\n })\n .join('\\n\\n')\n\n // Use direct mappings from the manifest\n\n // Generate validations for different route types\n const appPageValidations = generateValidations(\n Array.from(routesManifest.appPagePaths).sort(),\n 'AppPageConfig',\n routesManifest.filePathToRoute\n )\n const appRouteHandlerValidations = generateValidations(\n Array.from(routesManifest.appRouteHandlers).sort(),\n 'RouteHandlerConfig',\n routesManifest.filePathToRoute\n )\n const pagesRouterPageValidations = generateValidations(\n Array.from(routesManifest.pagesRouterPagePaths).sort(),\n 'PagesPageConfig'\n )\n const pagesApiRouteValidations = generateValidations(\n Array.from(routesManifest.pageApiRoutes).sort(),\n 'ApiRouteConfig'\n )\n const layoutValidations = generateValidations(\n Array.from(routesManifest.layoutPaths).sort(),\n 'LayoutConfig',\n routesManifest.filePathToRoute\n )\n\n const hasAppRouteHandlers =\n Object.keys(routesManifest.appRouteHandlerRoutes).length > 0\n\n // Build type definitions based on what's actually used\n let typeDefinitions = ''\n\n if (appPageValidations) {\n typeDefinitions += `type AppPageConfig<Route extends AppRoutes = AppRoutes> = {\n default: React.ComponentType<{ params: Promise<ParamMap[Route]> } & any> | ((props: { params: Promise<ParamMap[Route]> } & any) => React.ReactNode | Promise<React.ReactNode> | never | void | Promise<void>)\n generateStaticParams?: (props: { params: ParamMap[Route] }) => Promise<any[]> | any[]\n generateMetadata?: (\n props: { params: Promise<ParamMap[Route]> } & any,\n parent: ResolvingMetadata\n ) => Promise<any> | any\n generateViewport?: (\n props: { params: Promise<ParamMap[Route]> } & any,\n parent: ResolvingViewport\n ) => Promise<any> | any\n metadata?: any\n viewport?: any\n}\n\n`\n }\n\n if (pagesRouterPageValidations) {\n typeDefinitions += `type PagesPageConfig = {\n default: React.ComponentType<any> | ((props: any) => React.ReactNode | Promise<React.ReactNode> | never | void)\n getStaticProps?: (context: any) => Promise<any> | any\n getStaticPaths?: (context: any) => Promise<any> | any\n getServerSideProps?: (context: any) => Promise<any> | any\n getInitialProps?: (context: any) => Promise<any> | any\n /**\n * Segment configuration for legacy Pages Router pages.\n * Validated at build-time by parsePagesSegmentConfig.\n */\n config?: {\n amp?: boolean | 'hybrid' | string // necessary for JS\n maxDuration?: number\n runtime?: 'edge' | 'experimental-edge' | 'nodejs' | string // necessary unless config is exported as const\n regions?: string[]\n }\n}\n\n`\n }\n\n if (layoutValidations) {\n typeDefinitions += `type LayoutConfig<Route extends LayoutRoutes = LayoutRoutes> = {\n default: React.ComponentType<LayoutProps<Route>> | ((props: LayoutProps<Route>) => React.ReactNode | Promise<React.ReactNode> | never | void | Promise<void>)\n generateStaticParams?: (props: { params: ParamMap[Route] }) => Promise<any[]> | any[]\n generateMetadata?: (\n props: { params: Promise<ParamMap[Route]> } & any,\n parent: ResolvingMetadata\n ) => Promise<any> | any\n generateViewport?: (\n props: { params: Promise<ParamMap[Route]> } & any,\n parent: ResolvingViewport\n ) => Promise<any> | any\n metadata?: any\n viewport?: any\n}\n\n`\n }\n\n if (appRouteHandlerValidations) {\n typeDefinitions += `type RouteHandlerConfig<Route extends AppRouteHandlerRoutes = AppRouteHandlerRoutes> = {\n GET?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response | void> | Response | void\n POST?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response | void> | Response | void\n PUT?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response | void> | Response | void\n PATCH?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response | void> | Response | void\n DELETE?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response | void> | Response | void\n HEAD?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response | void> | Response | void\n OPTIONS?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response | void> | Response | void\n}\n\n`\n }\n\n if (pagesApiRouteValidations) {\n typeDefinitions += `type ApiRouteConfig = {\n default: (req: any, res: any) => Promise<Response | void> | Response | void\n config?: {\n api?: {\n bodyParser?: boolean | { sizeLimit?: string }\n responseLimit?: string | number | boolean\n externalResolver?: boolean\n }\n runtime?: 'edge' | 'experimental-edge' | 'nodejs' | string // necessary unless config is exported as const\n maxDuration?: number\n }\n}\n\n`\n }\n\n // Build import statement based on what's actually needed\n const routeImports = []\n\n // Only import AppRoutes if there are app pages\n if (appPageValidations) {\n routeImports.push('AppRoutes')\n }\n\n // Only import LayoutRoutes if there are layouts\n if (layoutValidations) {\n routeImports.push('LayoutRoutes')\n }\n\n // Only import ParamMap if there are routes that use it\n if (appPageValidations || layoutValidations || appRouteHandlerValidations) {\n routeImports.push('ParamMap')\n }\n\n if (hasAppRouteHandlers) {\n routeImports.push('AppRouteHandlerRoutes')\n }\n\n const routeImportStatement =\n routeImports.length > 0\n ? `import type { ${routeImports.join(', ')} } from \"./routes.js\"`\n : ''\n\n const nextRequestImport = hasAppRouteHandlers\n ? \"import type { NextRequest } from 'next/server.js'\\n\"\n : ''\n\n // Only import metadata types if there are App Router pages or layouts that might use them\n const metadataImport =\n appPageValidations || layoutValidations\n ? 'import type { ResolvingMetadata, ResolvingViewport } from \"next/dist/lib/metadata/types/metadata-interface.js\"\\n'\n : ''\n\n return `// This file is generated automatically by Next.js\n// Do not edit this file manually\n// This file validates that all pages and layouts export the correct types\n\n${routeImportStatement}\n${metadataImport}${nextRequestImport}\n${typeDefinitions}\n${appPageValidations}\n\n${appRouteHandlerValidations}\n\n${pagesRouterPageValidations}\n\n${pagesApiRouteValidations}\n\n${layoutValidations}\n`\n}\n\nexport function generateRouteTypesFile(\n routesManifest: RouteTypesManifest\n): string {\n const routeTypes = generateRouteTypes(routesManifest)\n const paramTypes = generateParamTypes(routesManifest)\n const layoutSlotMap = generateLayoutSlotMap(routesManifest)\n\n const hasAppRouteHandlers =\n Object.keys(routesManifest.appRouteHandlerRoutes).length > 0\n\n // Build export statement based on what's actually generated\n const routeExports = [\n 'AppRoutes',\n 'PageRoutes',\n 'LayoutRoutes',\n 'RedirectRoutes',\n 'RewriteRoutes',\n 'ParamMap',\n ]\n if (hasAppRouteHandlers) {\n routeExports.push('AppRouteHandlerRoutes')\n }\n\n const exportStatement = `export type { ${routeExports.join(', ')} }`\n\n const routeContextInterface = hasAppRouteHandlers\n ? `\n\n /**\n * Context for Next.js App Router route handlers\n * @example\n * \\`\\`\\`tsx\n * export async function GET(request: NextRequest, context: RouteContext<'/api/users/[id]'>) {\n * const { id } = await context.params\n * return Response.json({ id })\n * }\n * \\`\\`\\`\n */\n interface RouteContext<AppRouteHandlerRoute extends AppRouteHandlerRoutes> {\n params: Promise<ParamMap[AppRouteHandlerRoute]>\n }`\n : ''\n\n return `// This file is generated automatically by Next.js\n// Do not edit this file manually\n\n${routeTypes}\n\n${paramTypes}\n\nexport type ParamsOf<Route extends Routes> = ParamMap[Route]\n\n${layoutSlotMap}\n\n${exportStatement}\n\ndeclare global {\n /**\n * Props for Next.js App Router page components\n * @example\n * \\`\\`\\`tsx\n * export default function Page(props: PageProps<'/blog/[slug]'>) {\n * const { slug } = await props.params\n * return <div>Blog post: {slug}</div>\n * }\n * \\`\\`\\`\n */\n interface PageProps<AppRoute extends AppRoutes> {\n params: Promise<ParamMap[AppRoute]>\n searchParams: Promise<Record<string, string | string[] | undefined>>\n }\n\n /**\n * Props for Next.js App Router layout components\n * @example\n * \\`\\`\\`tsx\n * export default function Layout(props: LayoutProps<'/dashboard'>) {\n * return <div>{props.children}</div>\n * }\n * \\`\\`\\`\n */\n type LayoutProps<LayoutRoute extends LayoutRoutes> = {\n params: Promise<ParamMap[LayoutRoute]>\n children: React.ReactNode\n } & {\n [K in LayoutSlotMap[LayoutRoute]]: React.ReactNode\n }${routeContextInterface}\n}\n`\n}\n"],"names":["generateLinkTypesFile","generateRouteTypesFile","generateValidatorFile","generateRouteTypes","routesManifest","appRoutes","Object","keys","sort","pageRoutes","layoutRoutes","redirectRoutes","rewriteRoutes","result","length","map","route","JSON","stringify","join","appRouteHandlerRoutes","hasAppRouteHandlers","routeUnionParts","push","generateParamTypes","allRoutes","paramTypes","sortedRoutes","entries","a","b","localeCompare","routeInfo","groups","isDynamicRoute","paramType","key","group","escapedKey","repeat","optional","generateLayoutSlotMap","slotMap","sortedLayoutRoutes","slots","slot","formatRouteToRouteType","isDynamic","split","part","startsWith","endsWith","routeType","serializeRouteTypes","routeTypes","allRoutesSet","Set","Array","from","pageApiRoutes","staticRouteTypes","dynamicRouteTypes","serializedStaticRouteTypes","serializedDynamicRouteTypes","routeTypesFallback","generateValidations","paths","type","pathToRouteMap","filter","filePath","importPath","get","typeWithRoute","replace","appPageValidations","appPagePaths","filePathToRoute","appRouteHandlerValidations","appRouteHandlers","pagesRouterPageValidations","pagesRouterPagePaths","pagesApiRouteValidations","layoutValidations","layoutPaths","typeDefinitions","routeImports","routeImportStatement","nextRequestImport","metadataImport","layoutSlotMap","routeExports","exportStatement","routeContextInterface"],"mappings":";;;;;;;;;;;;;;;;IAuMgBA,qBAAqB;eAArBA;;IAqbAC,sBAAsB;eAAtBA;;IApOAC,qBAAqB;eAArBA;;;2BAvZe;AAE/B,SAASC,mBAAmBC,cAAkC;IAC5D,MAAMC,YAAYC,OAAOC,IAAI,CAACH,eAAeC,SAAS,EAAEG,IAAI;IAC5D,MAAMC,aAAaH,OAAOC,IAAI,CAACH,eAAeK,UAAU,EAAED,IAAI;IAC9D,MAAME,eAAeJ,OAAOC,IAAI,CAACH,eAAeM,YAAY,EAAEF,IAAI;IAClE,MAAMG,iBAAiBL,OAAOC,IAAI,CAACH,eAAeO,cAAc,EAAEH,IAAI;IACtE,MAAMI,gBAAgBN,OAAOC,IAAI,CAACH,eAAeQ,aAAa,EAA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M0E,wBAAwBxE,sBAC1B,CAAC;;;;;;;;;;;;;;GAcJ,CAAC,GACE;IAEJ,OAAO,CAAC;;;AAGV,EAAEiC,WAAW;;AAEb,EAAE5B,WAAW;;;;AAIb,EAAEgE,cAAc;;AAEhB,EAAEE,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCf,EAAEC,sBAAsB;;AAE3B,CAAC;AACD","ignoreList":[0]}
|
1
|
+
{"version":3,"sources":["../../../../src/server/lib/router-utils/typegen.ts"],"sourcesContent":["import type { RouteTypesManifest } from './route-types-utils'\nimport { isDynamicRoute } from '../../../shared/lib/router/utils/is-dynamic'\n\nfunction generateRouteTypes(routesManifest: RouteTypesManifest): string {\n const appRoutes = Object.keys(routesManifest.appRoutes).sort()\n const pageRoutes = Object.keys(routesManifest.pageRoutes).sort()\n const layoutRoutes = Object.keys(routesManifest.layoutRoutes).sort()\n const redirectRoutes = Object.keys(routesManifest.redirectRoutes).sort()\n const rewriteRoutes = Object.keys(routesManifest.rewriteRoutes).sort()\n\n let result = ''\n\n // Generate AppRoutes union type (pages only)\n if (appRoutes.length > 0) {\n result += `type AppRoutes = ${appRoutes.map((route) => JSON.stringify(route)).join(' | ')}\\n`\n } else {\n result += 'type AppRoutes = never\\n'\n }\n\n // Generate AppRouteHandlerRoutes union type for route handlers\n const appRouteHandlerRoutes = Object.keys(\n routesManifest.appRouteHandlerRoutes\n ).sort()\n\n const hasAppRouteHandlers = appRouteHandlerRoutes.length > 0\n\n if (hasAppRouteHandlers) {\n result += `type AppRouteHandlerRoutes = ${appRouteHandlerRoutes.map((route) => JSON.stringify(route)).join(' | ')}\\n`\n }\n\n // Generate PageRoutes union type\n if (pageRoutes.length > 0) {\n result += `type PageRoutes = ${pageRoutes.map((route) => JSON.stringify(route)).join(' | ')}\\n`\n } else {\n result += 'type PageRoutes = never\\n'\n }\n\n // Generate LayoutRoutes union type\n if (layoutRoutes.length > 0) {\n result += `type LayoutRoutes = ${layoutRoutes.map((route) => JSON.stringify(route)).join(' | ')}\\n`\n } else {\n result += 'type LayoutRoutes = never\\n'\n }\n\n // Generate RedirectRoutes union type\n if (redirectRoutes.length > 0) {\n result += `type RedirectRoutes = ${redirectRoutes\n .map((route) => JSON.stringify(route))\n .join(' | ')}\\n`\n } else {\n result += 'type RedirectRoutes = never\\n'\n }\n\n // Generate RewriteRoutes union type\n if (rewriteRoutes.length > 0) {\n result += `type RewriteRoutes = ${rewriteRoutes\n .map((route) => JSON.stringify(route))\n .join(' | ')}\\n`\n } else {\n result += 'type RewriteRoutes = never\\n'\n }\n\n // Only include AppRouteHandlerRoutes in Routes union if there are actual route handlers\n const routeUnionParts = [\n 'AppRoutes',\n 'PageRoutes',\n 'LayoutRoutes',\n 'RedirectRoutes',\n 'RewriteRoutes',\n ]\n if (hasAppRouteHandlers) {\n routeUnionParts.push('AppRouteHandlerRoutes')\n }\n\n result += `type Routes = ${routeUnionParts.join(' | ')}\\n`\n\n return result\n}\n\nfunction generateParamTypes(routesManifest: RouteTypesManifest): string {\n const allRoutes = {\n ...routesManifest.appRoutes,\n ...routesManifest.appRouteHandlerRoutes,\n ...routesManifest.pageRoutes,\n ...routesManifest.layoutRoutes,\n ...routesManifest.redirectRoutes,\n ...routesManifest.rewriteRoutes,\n }\n\n let paramTypes = 'interface ParamMap {\\n'\n\n // Sort routes deterministically for consistent output\n const sortedRoutes = Object.entries(allRoutes).sort(([a], [b]) =>\n a.localeCompare(b)\n )\n\n for (const [route, routeInfo] of sortedRoutes) {\n const { groups } = routeInfo\n\n // For static routes (no dynamic segments), we can produce an empty parameter map.\n if (!isDynamicRoute(route) || Object.keys(groups ?? {}).length === 0) {\n paramTypes += ` ${JSON.stringify(route)}: {}\\n`\n continue\n }\n\n let paramType = '{'\n\n // Process each group based on its properties\n for (const [key, group] of Object.entries(groups)) {\n const escapedKey = JSON.stringify(key)\n if (group.repeat) {\n // Catch-all parameters\n if (group.optional) {\n paramType += ` ${escapedKey}?: string[];`\n } else {\n paramType += ` ${escapedKey}: string[];`\n }\n } else {\n // Regular parameters\n if (group.optional) {\n paramType += ` ${escapedKey}?: string;`\n } else {\n paramType += ` ${escapedKey}: string;`\n }\n }\n }\n\n paramType += ' }'\n\n paramTypes += ` ${JSON.stringify(route)}: ${paramType}\\n`\n }\n\n paramTypes += '}\\n'\n return paramTypes\n}\n\nfunction generateLayoutSlotMap(routesManifest: RouteTypesManifest): string {\n let slotMap = 'interface LayoutSlotMap {\\n'\n\n // Sort routes deterministically for consistent output\n const sortedLayoutRoutes = Object.entries(routesManifest.layoutRoutes).sort(\n ([a], [b]) => a.localeCompare(b)\n )\n\n for (const [route, routeInfo] of sortedLayoutRoutes) {\n if ('slots' in routeInfo) {\n const slots = routeInfo.slots.sort()\n if (slots.length > 0) {\n slotMap += ` ${JSON.stringify(route)}: ${slots.map((slot) => JSON.stringify(slot)).join(' | ')}\\n`\n } else {\n slotMap += ` ${JSON.stringify(route)}: never\\n`\n }\n } else {\n slotMap += ` ${JSON.stringify(route)}: never\\n`\n }\n }\n\n slotMap += '}\\n'\n return slotMap\n}\n\n// Helper function to format routes to route types (matches the plugin logic exactly)\nfunction formatRouteToRouteType(route: string) {\n const isDynamic = isDynamicRoute(route)\n if (isDynamic) {\n route = route\n .split('/')\n .map((part) => {\n if (part.startsWith('[') && part.endsWith(']')) {\n if (part.startsWith('[...')) {\n // /[...slug]\n return `\\${CatchAllSlug<T>}`\n } else if (part.startsWith('[[...') && part.endsWith(']]')) {\n // /[[...slug]]\n return `\\${OptionalCatchAllSlug<T>}`\n }\n // /[slug]\n return `\\${SafeSlug<T>}`\n }\n return part\n })\n .join('/')\n }\n\n return {\n isDynamic,\n routeType: route,\n }\n}\n\n// Helper function to serialize route types (matches the plugin logic exactly)\nfunction serializeRouteTypes(routeTypes: string[]) {\n // route collection is not deterministic, this makes the output of the file deterministic\n return routeTypes\n .sort()\n .map((route) => `\\n | \\`${route}\\``)\n .join('')\n}\n\nexport function generateLinkTypesFile(\n routesManifest: RouteTypesManifest\n): string {\n // Generate serialized static and dynamic routes for the internal namespace\n // Build a unified set of routes across app/pages/redirect/rewrite as well as\n // app route handlers and Pages Router API routes.\n const allRoutesSet = new Set<string>([\n ...Object.keys(routesManifest.appRoutes),\n ...Object.keys(routesManifest.pageRoutes),\n ...Object.keys(routesManifest.redirectRoutes),\n ...Object.keys(routesManifest.rewriteRoutes),\n // Allow linking to App Route Handlers (e.g. `/logout/route.ts`)\n ...Object.keys(routesManifest.appRouteHandlerRoutes),\n // Allow linking to Pages Router API routes (e.g. `/api/*`)\n ...Array.from(routesManifest.pageApiRoutes),\n ])\n\n const staticRouteTypes: string[] = []\n const dynamicRouteTypes: string[] = []\n\n // Process each route using the same logic as the plugin\n for (const route of allRoutesSet) {\n const { isDynamic, routeType } = formatRouteToRouteType(route)\n if (isDynamic) {\n dynamicRouteTypes.push(routeType)\n } else {\n staticRouteTypes.push(routeType)\n }\n }\n\n const serializedStaticRouteTypes = serializeRouteTypes(staticRouteTypes)\n const serializedDynamicRouteTypes = serializeRouteTypes(dynamicRouteTypes)\n\n // If both StaticRoutes and DynamicRoutes are empty, fallback to type 'string & {}'.\n const routeTypesFallback =\n !serializedStaticRouteTypes && !serializedDynamicRouteTypes\n ? 'string & {}'\n : ''\n\n return `// This file is generated automatically by Next.js\n// Do not edit this file manually\n\n// Type definitions for Next.js routes\n\n/**\n * Internal types used by the Next.js router and Link component.\n * These types are not meant to be used directly.\n * @internal\n */\ndeclare namespace __next_route_internal_types__ {\n type SearchOrHash = \\`?\\${string}\\` | \\`#\\${string}\\`\n type WithProtocol = \\`\\${string}:\\${string}\\`\n\n type Suffix = '' | SearchOrHash\n\n type SafeSlug<S extends string> = S extends \\`\\${string}/\\${string}\\`\n ? never\n : S extends \\`\\${string}\\${SearchOrHash}\\`\n ? never\n : S extends ''\n ? never\n : S\n\n type CatchAllSlug<S extends string> = S extends \\`\\${string}\\${SearchOrHash}\\`\n ? never\n : S extends ''\n ? never\n : S\n\n type OptionalCatchAllSlug<S extends string> =\n S extends \\`\\${string}\\${SearchOrHash}\\` ? never : S\n\n type StaticRoutes = ${serializedStaticRouteTypes || 'never'}\n type DynamicRoutes<T extends string = string> = ${\n serializedDynamicRouteTypes || 'never'\n }\n\n type RouteImpl<T> = ${\n routeTypesFallback ||\n `\n ${\n // This keeps autocompletion working for static routes.\n '| StaticRoutes'\n }\n | SearchOrHash\n | WithProtocol\n | \\`\\${StaticRoutes}\\${SearchOrHash}\\`\n | (T extends \\`\\${DynamicRoutes<infer _>}\\${Suffix}\\` ? T : never)\n `\n }\n}\n\ndeclare module 'next' {\n export { default } from 'next/types.js'\n export * from 'next/types.js'\n\n export type Route<T extends string = string> =\n __next_route_internal_types__.RouteImpl<T>\n}\n\ndeclare module 'next/link' {\n import type { LinkProps as OriginalLinkProps } from 'next/dist/client/link.js'\n import type { AnchorHTMLAttributes, DetailedHTMLProps } from 'react'\n import type { UrlObject } from 'url'\n\n type LinkRestProps = Omit<\n Omit<\n DetailedHTMLProps<\n AnchorHTMLAttributes<HTMLAnchorElement>,\n HTMLAnchorElement\n >,\n keyof OriginalLinkProps\n > &\n OriginalLinkProps,\n 'href'\n >\n\n export type LinkProps<RouteInferType> = LinkRestProps & {\n /**\n * The path or URL to navigate to. This is the only required prop. It can also be an object.\n * @see https://nextjs.org/docs/api-reference/next/link\n */\n href: __next_route_internal_types__.RouteImpl<RouteInferType> | UrlObject\n }\n\n export default function Link<RouteType>(props: LinkProps<RouteType>): JSX.Element\n}\n\ndeclare module 'next/navigation' {\n export * from 'next/dist/client/components/navigation.js'\n\n import type { NavigateOptions, AppRouterInstance as OriginalAppRouterInstance } from 'next/dist/shared/lib/app-router-context.shared-runtime.js'\n import type { RedirectType } from 'next/dist/client/components/redirect-error.js'\n \n interface AppRouterInstance extends OriginalAppRouterInstance {\n /**\n * Navigate to the provided href.\n * Pushes a new history entry.\n */\n push<RouteType>(href: __next_route_internal_types__.RouteImpl<RouteType>, options?: NavigateOptions): void\n /**\n * Navigate to the provided href.\n * Replaces the current history entry.\n */\n replace<RouteType>(href: __next_route_internal_types__.RouteImpl<RouteType>, options?: NavigateOptions): void\n /**\n * Prefetch the provided href.\n */\n prefetch<RouteType>(href: __next_route_internal_types__.RouteImpl<RouteType>): void\n }\n\n export function useRouter(): AppRouterInstance;\n \n /**\n * This function allows you to redirect the user to another URL. It can be used in\n * [Server Components](https://nextjs.org/docs/app/building-your-application/rendering/server-components),\n * [Route Handlers](https://nextjs.org/docs/app/building-your-application/routing/route-handlers), and\n * [Server Actions](https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations).\n *\n * - In a Server Component, this will insert a meta tag to redirect the user to the target page.\n * - In a Route Handler or Server Action, it will serve a 307/303 to the caller.\n * - In a Server Action, type defaults to 'push' and 'replace' elsewhere.\n *\n * Read more: [Next.js Docs: redirect](https://nextjs.org/docs/app/api-reference/functions/redirect)\n */\n export function redirect<RouteType>(\n /** The URL to redirect to */\n url: __next_route_internal_types__.RouteImpl<RouteType>,\n type?: RedirectType\n ): never;\n \n /**\n * This function allows you to redirect the user to another URL. It can be used in\n * [Server Components](https://nextjs.org/docs/app/building-your-application/rendering/server-components),\n * [Route Handlers](https://nextjs.org/docs/app/building-your-application/routing/route-handlers), and\n * [Server Actions](https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations).\n *\n * - In a Server Component, this will insert a meta tag to redirect the user to the target page.\n * - In a Route Handler or Server Action, it will serve a 308/303 to the caller.\n *\n * Read more: [Next.js Docs: redirect](https://nextjs.org/docs/app/api-reference/functions/redirect)\n */\n export function permanentRedirect<RouteType>(\n /** The URL to redirect to */\n url: __next_route_internal_types__.RouteImpl<RouteType>,\n type?: RedirectType\n ): never;\n}\n\ndeclare module 'next/form' {\n import type { FormProps as OriginalFormProps } from 'next/dist/client/form.js'\n\n type FormRestProps = Omit<OriginalFormProps, 'action'>\n\n export type FormProps<RouteInferType> = {\n /**\n * \\`action\\` can be either a \\`string\\` or a function.\n * - If \\`action\\` is a string, it will be interpreted as a path or URL to navigate to when the form is submitted.\n * The path will be prefetched when the form becomes visible.\n * - If \\`action\\` is a function, it will be called when the form is submitted. See the [React docs](https://react.dev/reference/react-dom/components/form#props) for more.\n */\n action: __next_route_internal_types__.RouteImpl<RouteInferType> | ((formData: FormData) => void)\n } & FormRestProps\n\n export default function Form<RouteType>(props: FormProps<RouteType>): JSX.Element\n}\n`\n}\n\nexport function generateValidatorFile(\n routesManifest: RouteTypesManifest\n): string {\n const generateValidations = (\n paths: string[],\n type:\n | 'AppPageConfig'\n | 'PagesPageConfig'\n | 'LayoutConfig'\n | 'RouteHandlerConfig'\n | 'ApiRouteConfig',\n pathToRouteMap?: Map<string, string>\n ) =>\n paths\n .sort()\n // Only validate TypeScript files - JavaScript files have too many type inference limitations\n .filter(\n (filePath) => filePath.endsWith('.ts') || filePath.endsWith('.tsx')\n )\n .filter(\n // Don't include metadata routes or pages\n // (e.g. /manifest.webmanifest)\n (filePath) =>\n type !== 'AppPageConfig' ||\n filePath.endsWith('page.ts') ||\n filePath.endsWith('page.tsx')\n )\n .map((filePath) => {\n // Keep the file extension for TypeScript imports to support node16 module resolution\n const importPath = filePath\n const route = pathToRouteMap?.get(filePath)\n const typeWithRoute =\n route &&\n (type === 'AppPageConfig' ||\n type === 'LayoutConfig' ||\n type === 'RouteHandlerConfig')\n ? `${type}<${JSON.stringify(route)}>`\n : type\n return `// Validate ${filePath}\n{\n type __IsExpected<Specific extends ${typeWithRoute}> = Specific\n const handler = {} as typeof import(${JSON.stringify(\n importPath.replace(/\\.tsx?$/, '.js')\n )})\n type __Check = __IsExpected<typeof handler>\n // @ts-ignore\n type __Unused = __Check\n}`\n })\n .join('\\n\\n')\n\n // Use direct mappings from the manifest\n\n // Generate validations for different route types\n const appPageValidations = generateValidations(\n Array.from(routesManifest.appPagePaths).sort(),\n 'AppPageConfig',\n routesManifest.filePathToRoute\n )\n const appRouteHandlerValidations = generateValidations(\n Array.from(routesManifest.appRouteHandlers).sort(),\n 'RouteHandlerConfig',\n routesManifest.filePathToRoute\n )\n const pagesRouterPageValidations = generateValidations(\n Array.from(routesManifest.pagesRouterPagePaths).sort(),\n 'PagesPageConfig'\n )\n const pagesApiRouteValidations = generateValidations(\n Array.from(routesManifest.pageApiRoutes).sort(),\n 'ApiRouteConfig'\n )\n const layoutValidations = generateValidations(\n Array.from(routesManifest.layoutPaths).sort(),\n 'LayoutConfig',\n routesManifest.filePathToRoute\n )\n\n const hasAppRouteHandlers =\n Object.keys(routesManifest.appRouteHandlerRoutes).length > 0\n\n // Build type definitions based on what's actually used\n let typeDefinitions = ''\n\n if (appPageValidations) {\n typeDefinitions += `type AppPageConfig<Route extends AppRoutes = AppRoutes> = {\n default: React.ComponentType<{ params: Promise<ParamMap[Route]> } & any> | ((props: { params: Promise<ParamMap[Route]> } & any) => React.ReactNode | Promise<React.ReactNode> | never | void | Promise<void>)\n generateStaticParams?: (props: { params: ParamMap[Route] }) => Promise<any[]> | any[]\n generateMetadata?: (\n props: { params: Promise<ParamMap[Route]> } & any,\n parent: ResolvingMetadata\n ) => Promise<any> | any\n generateViewport?: (\n props: { params: Promise<ParamMap[Route]> } & any,\n parent: ResolvingViewport\n ) => Promise<any> | any\n metadata?: any\n viewport?: any\n}\n\n`\n }\n\n if (pagesRouterPageValidations) {\n typeDefinitions += `type PagesPageConfig = {\n default: React.ComponentType<any> | ((props: any) => React.ReactNode | Promise<React.ReactNode> | never | void)\n getStaticProps?: (context: any) => Promise<any> | any\n getStaticPaths?: (context: any) => Promise<any> | any\n getServerSideProps?: (context: any) => Promise<any> | any\n getInitialProps?: (context: any) => Promise<any> | any\n /**\n * Segment configuration for legacy Pages Router pages.\n * Validated at build-time by parsePagesSegmentConfig.\n */\n config?: {\n amp?: boolean | 'hybrid' | string // necessary for JS\n maxDuration?: number\n runtime?: 'edge' | 'experimental-edge' | 'nodejs' | string // necessary unless config is exported as const\n regions?: string[]\n }\n}\n\n`\n }\n\n if (layoutValidations) {\n typeDefinitions += `type LayoutConfig<Route extends LayoutRoutes = LayoutRoutes> = {\n default: React.ComponentType<LayoutProps<Route>> | ((props: LayoutProps<Route>) => React.ReactNode | Promise<React.ReactNode> | never | void | Promise<void>)\n generateStaticParams?: (props: { params: ParamMap[Route] }) => Promise<any[]> | any[]\n generateMetadata?: (\n props: { params: Promise<ParamMap[Route]> } & any,\n parent: ResolvingMetadata\n ) => Promise<any> | any\n generateViewport?: (\n props: { params: Promise<ParamMap[Route]> } & any,\n parent: ResolvingViewport\n ) => Promise<any> | any\n metadata?: any\n viewport?: any\n}\n\n`\n }\n\n if (appRouteHandlerValidations) {\n typeDefinitions += `type RouteHandlerConfig<Route extends AppRouteHandlerRoutes = AppRouteHandlerRoutes> = {\n GET?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response | void> | Response | void\n POST?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response | void> | Response | void\n PUT?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response | void> | Response | void\n PATCH?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response | void> | Response | void\n DELETE?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response | void> | Response | void\n HEAD?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response | void> | Response | void\n OPTIONS?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response | void> | Response | void\n}\n\n`\n }\n\n if (pagesApiRouteValidations) {\n typeDefinitions += `type ApiRouteConfig = {\n default: (req: any, res: any) => ReturnType<NextApiHandler>\n config?: {\n api?: {\n bodyParser?: boolean | { sizeLimit?: string }\n responseLimit?: string | number | boolean\n externalResolver?: boolean\n }\n runtime?: 'edge' | 'experimental-edge' | 'nodejs' | string // necessary unless config is exported as const\n maxDuration?: number\n }\n}\n\n`\n }\n\n // Build import statement based on what's actually needed\n const routeImports = []\n\n // Only import AppRoutes if there are app pages\n if (appPageValidations) {\n routeImports.push('AppRoutes')\n }\n\n // Only import LayoutRoutes if there are layouts\n if (layoutValidations) {\n routeImports.push('LayoutRoutes')\n }\n\n // Only import ParamMap if there are routes that use it\n if (appPageValidations || layoutValidations || appRouteHandlerValidations) {\n routeImports.push('ParamMap')\n }\n\n if (hasAppRouteHandlers) {\n routeImports.push('AppRouteHandlerRoutes')\n }\n\n const routeImportStatement =\n routeImports.length > 0\n ? `import type { ${routeImports.join(', ')} } from \"./routes.js\"`\n : ''\n\n const nextRequestImport = hasAppRouteHandlers\n ? \"import type { NextRequest } from 'next/server.js'\\n\"\n : ''\n\n // Conditionally import types from next/types, merged into a single statement\n const nextTypes: string[] = []\n if (pagesApiRouteValidations) {\n nextTypes.push('NextApiHandler')\n }\n if (appPageValidations || layoutValidations) {\n nextTypes.push('ResolvingMetadata', 'ResolvingViewport')\n }\n const nextTypesImport =\n nextTypes.length > 0\n ? `import type { ${nextTypes.join(', ')} } from \"next/types.js\"\\n`\n : ''\n\n return `// This file is generated automatically by Next.js\n// Do not edit this file manually\n// This file validates that all pages and layouts export the correct types\n\n${routeImportStatement}\n${nextTypesImport}${nextRequestImport}\n${typeDefinitions}\n${appPageValidations}\n\n${appRouteHandlerValidations}\n\n${pagesRouterPageValidations}\n\n${pagesApiRouteValidations}\n\n${layoutValidations}\n`\n}\n\nexport function generateRouteTypesFile(\n routesManifest: RouteTypesManifest\n): string {\n const routeTypes = generateRouteTypes(routesManifest)\n const paramTypes = generateParamTypes(routesManifest)\n const layoutSlotMap = generateLayoutSlotMap(routesManifest)\n\n const hasAppRouteHandlers =\n Object.keys(routesManifest.appRouteHandlerRoutes).length > 0\n\n // Build export statement based on what's actually generated\n const routeExports = [\n 'AppRoutes',\n 'PageRoutes',\n 'LayoutRoutes',\n 'RedirectRoutes',\n 'RewriteRoutes',\n 'ParamMap',\n ]\n if (hasAppRouteHandlers) {\n routeExports.push('AppRouteHandlerRoutes')\n }\n\n const exportStatement = `export type { ${routeExports.join(', ')} }`\n\n const routeContextInterface = hasAppRouteHandlers\n ? `\n\n /**\n * Context for Next.js App Router route handlers\n * @example\n * \\`\\`\\`tsx\n * export async function GET(request: NextRequest, context: RouteContext<'/api/users/[id]'>) {\n * const { id } = await context.params\n * return Response.json({ id })\n * }\n * \\`\\`\\`\n */\n interface RouteContext<AppRouteHandlerRoute extends AppRouteHandlerRoutes> {\n params: Promise<ParamMap[AppRouteHandlerRoute]>\n }`\n : ''\n\n return `// This file is generated automatically by Next.js\n// Do not edit this file manually\n\n${routeTypes}\n\n${paramTypes}\n\nexport type ParamsOf<Route extends Routes> = ParamMap[Route]\n\n${layoutSlotMap}\n\n${exportStatement}\n\ndeclare global {\n /**\n * Props for Next.js App Router page components\n * @example\n * \\`\\`\\`tsx\n * export default function Page(props: PageProps<'/blog/[slug]'>) {\n * const { slug } = await props.params\n * return <div>Blog post: {slug}</div>\n * }\n * \\`\\`\\`\n */\n interface PageProps<AppRoute extends AppRoutes> {\n params: Promise<ParamMap[AppRoute]>\n searchParams: Promise<Record<string, string | string[] | undefined>>\n }\n\n /**\n * Props for Next.js App Router layout components\n * @example\n * \\`\\`\\`tsx\n * export default function Layout(props: LayoutProps<'/dashboard'>) {\n * return <div>{props.children}</div>\n * }\n * \\`\\`\\`\n */\n type LayoutProps<LayoutRoute extends LayoutRoutes> = {\n params: Promise<ParamMap[LayoutRoute]>\n children: React.ReactNode\n } & {\n [K in LayoutSlotMap[LayoutRoute]]: React.ReactNode\n }${routeContextInterface}\n}\n`\n}\n"],"names":["generateLinkTypesFile","generateRouteTypesFile","generateValidatorFile","generateRouteTypes","routesManifest","appRoutes","Object","keys","sort","pageRoutes","layoutRoutes","redirectRoutes","rewriteRoutes","result","length","map","route","JSON","stringify","join","appRouteHandlerRoutes","hasAppRouteHandlers","routeUnionParts","push","generateParamTypes","allRoutes","paramTypes","sortedRoutes","entries","a","b","localeCompare","routeInfo","groups","isDynamicRoute","paramType","key","group","escapedKey","repeat","optional","generateLayoutSlotMap","slotMap","sortedLayoutRoutes","slots","slot","formatRouteToRouteType","isDynamic","split","part","startsWith","endsWith","routeType","serializeRouteTypes","routeTypes","allRoutesSet","Set","Array","from","pageApiRoutes","staticRouteTypes","dynamicRouteTypes","serializedStaticRouteTypes","serializedDynamicRouteTypes","routeTypesFallback","generateValidations","paths","type","pathToRouteMap","filter","filePath","importPath","get","typeWithRoute","replace","appPageValidations","appPagePaths","filePathToRoute","appRouteHandlerValidations","appRouteHandlers","pagesRouterPageValidations","pagesRouterPagePaths","pagesApiRouteValidations","layoutValidations","layoutPaths","typeDefinitions","routeImports","routeImportStatement","nextRequestImport","nextTypes","nextTypesImport","layoutSlotMap","routeExports","exportStatement","routeContextInterface"],"mappings":";;;;;;;;;;;;;;;;IAuMgBA,qBAAqB;eAArBA;;IA+bAC,sBAAsB;eAAtBA;;IA9OAC,qBAAqB;eAArBA;;;2BAvZe;AAE/B,SAASC,mBAAmBC,cAAkC;IAC5D,MAAMC,YAAYC,OAAOC,IAAI,CAACH,eAAeC,SAAS,EAAEG,IAAI;IAC5D,MAAMC,aAAaH,OAAOC,IAAI,CAACH,eAAeK,UAAU,EAAED,IAAI;IAC9D,MAAME,eAAeJ,OAAOC,IAAI,CAACH,eAAeM,YAAY,EAAEF,IAAI;IAClE,MAAMG,iBAAiBL,OAAOC,IAAI,CAACH,eAAeO,cAAc,EAAEH,IAAI;IACtE,MAAMI,gBAAgBN,OAAOC,IAAI,CAACH,eAAeQ,aAAa,EAAEJ,IAAI;IAEpE,IAAIK,SAAS;IAEb,6CAA6C;IAC7C,IAAIR,UAAUS,MAAM,GAAG,GAAG;QACxBD,UAAU,CAAC,iBAAiB,EAAER,UAAUU,GAAG,CAAC,CAACC,QAAUC,KAAKC,SAAS,CAACF,QAAQG,IAAI,CAAC,OAAO,EAAE,CAAC;IAC/F,OAAO;QACLN,UAAU;IACZ;IAEA,+DAA+D;IAC/D,MAAMO,wBAAwBd,OAAOC,IAAI,CACvCH,eAAegB,qBAAqB,EACpCZ,IAAI;IAEN,MAAMa,sBAAsBD,sBAAsBN,MAAM,GA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b,EAAEiE,cAAc;;AAEhB,EAAEE,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCf,EAAEC,sBAAsB;;AAE3B,CAAC;AACD","ignoreList":[0]}
|
@@ -179,7 +179,7 @@ async function getRequestHandlers({ dir, port, isDev, onDevServerCleanup, server
|
|
179
179
|
async function startServer(serverOptions) {
|
180
180
|
const { dir, isDev, hostname, minimalMode, allowRetry, keepAliveTimeout, selfSignedCertificate } = serverOptions;
|
181
181
|
let { port } = serverOptions;
|
182
|
-
process.title = `next-server (v${"15.5.
|
182
|
+
process.title = `next-server (v${"15.5.4"})`;
|
183
183
|
let handlersReady = ()=>{};
|
184
184
|
let handlersError = ()=>{};
|
185
185
|
let handlersPromise = new Promise((resolve, reject)=>{
|