@openuiai/next 15.6.0-bun.29 → 15.6.0-bun.30
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 +3 -3
- package/dist/build/swc/index.js +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-server/pages-api.runtime.prod.js +1 -1
- package/dist/compiled/next-server/pages-api.runtime.prod.js.map +1 -1
- package/dist/compiled/next-server/pages.runtime.prod.js +1 -1
- package/dist/compiled/next-server/pages.runtime.prod.js.map +1 -1
- package/dist/esm/build/index.js +3 -3
- package/dist/esm/build/swc/index.js +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-webpack.js +1 -1
- package/dist/esm/server/lib/app-info-log.js +1 -1
- package/dist/esm/server/lib/router-utils/typegen.js +5 -1
- 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/server/dev/hot-reloader-webpack.js +1 -1
- package/dist/server/lib/app-info-log.js +1 -1
- package/dist/server/lib/router-utils/typegen.js +10 -1
- 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 +1 -1
package/dist/esm/build/index.js
CHANGED
|
@@ -301,7 +301,7 @@ export default async function build(dir, reactProductionProfiling = false, debug
|
|
|
301
301
|
const nextBuildSpan = trace('next-build', undefined, {
|
|
302
302
|
buildMode: experimentalBuildMode,
|
|
303
303
|
isTurboBuild: String(isTurbopack),
|
|
304
|
-
version: "15.6.0-bun.
|
|
304
|
+
version: "15.6.0-bun.30"
|
|
305
305
|
});
|
|
306
306
|
NextBuildContext.nextBuildSpan = nextBuildSpan;
|
|
307
307
|
NextBuildContext.dir = dir;
|
|
@@ -780,7 +780,7 @@ export default async function build(dir, reactProductionProfiling = false, debug
|
|
|
780
780
|
// Files outside of the distDir can be "type": "module"
|
|
781
781
|
await writeFileUtf8(path.join(distDir, 'package.json'), '{"type": "commonjs"}');
|
|
782
782
|
// These are written to distDir, so they need to come after creating and cleaning distDr.
|
|
783
|
-
await recordFrameworkVersion("15.6.0-bun.
|
|
783
|
+
await recordFrameworkVersion("15.6.0-bun.30");
|
|
784
784
|
await updateBuildDiagnostics({
|
|
785
785
|
buildStage: 'start'
|
|
786
786
|
});
|
|
@@ -2425,7 +2425,7 @@ export default async function build(dir, reactProductionProfiling = false, debug
|
|
|
2425
2425
|
distDir,
|
|
2426
2426
|
config,
|
|
2427
2427
|
staticPages,
|
|
2428
|
-
nextVersion: "15.6.0-bun.
|
|
2428
|
+
nextVersion: "15.6.0-bun.30",
|
|
2429
2429
|
tracingRoot: outputFileTracingRoot,
|
|
2430
2430
|
hasNodeMiddleware,
|
|
2431
2431
|
hasInstrumentationHook,
|
|
@@ -11,7 +11,7 @@ import { isDeepStrictEqual } from 'util';
|
|
|
11
11
|
import { getDefineEnv } from '../define-env';
|
|
12
12
|
import { getReactCompilerLoader } from '../get-babel-loader-config';
|
|
13
13
|
import { throwTurbopackInternalError } from '../../shared/lib/turbopack/internal-error';
|
|
14
|
-
const nextVersion = "15.6.0-bun.
|
|
14
|
+
const nextVersion = "15.6.0-bun.30";
|
|
15
15
|
const ArchName = arch();
|
|
16
16
|
const PlatformName = platform();
|
|
17
17
|
function infoLog(...args) {
|
|
@@ -1575,7 +1575,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
|
|
|
1575
1575
|
isClient && new CopyFilePlugin({
|
|
1576
1576
|
// file path to build output of `@next/polyfill-nomodule`
|
|
1577
1577
|
filePath: require.resolve('./polyfills/polyfill-nomodule'),
|
|
1578
|
-
cacheKey: "15.6.0-bun.
|
|
1578
|
+
cacheKey: "15.6.0-bun.30",
|
|
1579
1579
|
name: `static/chunks/polyfills${dev ? '' : '-[hash]'}.js`,
|
|
1580
1580
|
minimize: false,
|
|
1581
1581
|
info: {
|
|
@@ -1756,7 +1756,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
|
|
|
1756
1756
|
// - Next.js location on disk (some loaders use absolute paths and some resolve options depend on absolute paths)
|
|
1757
1757
|
// - Next.js version
|
|
1758
1758
|
// - next.config.js keys that affect compilation
|
|
1759
|
-
version: `${__dirname}|${"15.6.0-bun.
|
|
1759
|
+
version: `${__dirname}|${"15.6.0-bun.30"}|${configVars}`,
|
|
1760
1760
|
cacheDirectory: path.join(distDir, 'cache', 'webpack'),
|
|
1761
1761
|
// For production builds, it's more efficient to compress all cache files together instead of compression each one individually.
|
|
1762
1762
|
// So we disable compression here and allow the build runner to take care of compressing the cache as a whole.
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* - next/script with `beforeInteractive` strategy
|
|
6
6
|
*/ import { getAssetPrefix } from './asset-prefix';
|
|
7
7
|
import { setAttributesFromProps } from './set-attributes-from-props';
|
|
8
|
-
const version = "15.6.0-bun.
|
|
8
|
+
const version = "15.6.0-bun.30";
|
|
9
9
|
window.next = {
|
|
10
10
|
version,
|
|
11
11
|
appDir: true
|
package/dist/esm/client/index.js
CHANGED
|
@@ -26,7 +26,7 @@ import { SearchParamsContext, PathParamsContext } from '../shared/lib/hooks-clie
|
|
|
26
26
|
import { onRecoverableError } from './react-client-callbacks/on-recoverable-error';
|
|
27
27
|
import tracer from './tracing/tracer';
|
|
28
28
|
import { isNextRouterError } from './components/is-next-router-error';
|
|
29
|
-
export const version = "15.6.0-bun.
|
|
29
|
+
export const version = "15.6.0-bun.30";
|
|
30
30
|
export let router;
|
|
31
31
|
export const emitter = mitt();
|
|
32
32
|
const looseToArray = (input)=>[].slice.call(input);
|
|
@@ -158,7 +158,7 @@ export default class HotReloaderWebpack {
|
|
|
158
158
|
this.previewProps = previewProps;
|
|
159
159
|
this.rewrites = rewrites;
|
|
160
160
|
this.hotReloaderSpan = trace('hot-reloader', undefined, {
|
|
161
|
-
version: "15.6.0-bun.
|
|
161
|
+
version: "15.6.0-bun.30"
|
|
162
162
|
});
|
|
163
163
|
// Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing
|
|
164
164
|
// of the current `next dev` invocation.
|
|
@@ -14,7 +14,7 @@ export function logStartInfo({ networkUrl, appUrl, envInfo, experimentalFeatures
|
|
|
14
14
|
bundlerSuffix = ' (webpack)';
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
Log.bootstrap(`${bold(purple(`${Log.prefixes.ready} Next.js ${"15.6.0-bun.
|
|
17
|
+
Log.bootstrap(`${bold(purple(`${Log.prefixes.ready} Next.js ${"15.6.0-bun.30"}`))}${bundlerSuffix}`);
|
|
18
18
|
if (appUrl) {
|
|
19
19
|
Log.bootstrap(`- Local: ${appUrl}`);
|
|
20
20
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { isDynamicRoute } from '../../../shared/lib/router/utils/is-dynamic';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import fs from 'fs';
|
|
2
4
|
// Read package name dynamically to support forked packages
|
|
3
|
-
|
|
5
|
+
// Use dynamic path resolution to avoid bundler issues
|
|
6
|
+
const packageJsonPath = path.join(__dirname, '../../../../../package.json');
|
|
7
|
+
const PKG_NAME = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8')).name;
|
|
4
8
|
function generateRouteTypes(routesManifest) {
|
|
5
9
|
const appRoutes = Object.keys(routesManifest.appRoutes).sort();
|
|
6
10
|
const pageRoutes = Object.keys(routesManifest.pageRoutes).sort();
|
|
@@ -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\n// Read package name dynamically to support forked packages\nconst PKG_NAME = require('../../../../../package.json').name\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 '${PKG_NAME}' {\n export { default } from '${PKG_NAME}/types.js'\n export * from '${PKG_NAME}/types.js'\n\n export type Route<T extends string = string> =\n __next_route_internal_types__.RouteImpl<T>\n}\n\ndeclare module '${PKG_NAME}/link' {\n export { useLinkStatus } from '${PKG_NAME}/dist/client/link.js'\n\n import type { LinkProps as OriginalLinkProps } from '${PKG_NAME}/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 '${PKG_NAME}/navigation' {\n export * from '${PKG_NAME}/dist/client/components/navigation.js'\n\n import type { NavigateOptions, AppRouterInstance as OriginalAppRouterInstance } from '${PKG_NAME}/dist/shared/lib/app-router-context.shared-runtime.js'\n import type { RedirectType } from '${PKG_NAME}/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 '${PKG_NAME}/form' {\n import type { FormProps as OriginalFormProps } from '${PKG_NAME}/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\n // NOTE: we previously used `satisfies` here, but it's not supported by TypeScript 4.8 and below.\n // If we ever raise the TS minimum version, we can switch back.\n\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 '${PKG_NAME}/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 \"${PKG_NAME}/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":["isDynamicRoute","PKG_NAME","require","name","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","paramType","key","group","escapedKey","repeat","optional","generateLayoutSlotMap","slotMap","sortedLayoutRoutes","slots","slot","formatRouteToRouteType","isDynamic","split","part","startsWith","endsWith","routeType","serializeRouteTypes","routeTypes","generateLinkTypesFile","allRoutesSet","Set","Array","from","pageApiRoutes","staticRouteTypes","dynamicRouteTypes","serializedStaticRouteTypes","serializedDynamicRouteTypes","routeTypesFallback","generateValidatorFile","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","generateRouteTypesFile","layoutSlotMap","routeExports","exportStatement","routeContextInterface"],"mappings":"AACA,SAASA,cAAc,QAAQ,8CAA6C;AAE5E,2DAA2D;AAC3D,MAAMC,WAAWC,QAAQ,+BAA+BC,IAAI;AAE5D,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,GAAG;IAE3D,IAAIO,qBAAqB;QACvBR,UAAU,CA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ACD,IAAIzE,qBAAqB;QACvByE,aAAavE,IAAI,CAAC;IACpB;IAEA,MAAMwE,kBAAkB,CAAC,cAAc,EAAED,aAAa3E,IAAI,CAAC,MAAM,EAAE,CAAC;IAEpE,MAAM6E,wBAAwB3E,sBAC1B,CAAC;;;;;;;;;;;;;;GAcJ,CAAC,GACE;IAEJ,OAAO,CAAC;;;AAGV,EAAEgC,WAAW;;AAEb,EAAE3B,WAAW;;;;AAIb,EAAEmE,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'\nimport path from 'path'\nimport fs from 'fs'\n\n// Read package name dynamically to support forked packages\n// Use dynamic path resolution to avoid bundler issues\nconst packageJsonPath = path.join(__dirname, '../../../../../package.json')\nconst PKG_NAME = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8')).name\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 '${PKG_NAME}' {\n export { default } from '${PKG_NAME}/types.js'\n export * from '${PKG_NAME}/types.js'\n\n export type Route<T extends string = string> =\n __next_route_internal_types__.RouteImpl<T>\n}\n\ndeclare module '${PKG_NAME}/link' {\n export { useLinkStatus } from '${PKG_NAME}/dist/client/link.js'\n\n import type { LinkProps as OriginalLinkProps } from '${PKG_NAME}/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 '${PKG_NAME}/navigation' {\n export * from '${PKG_NAME}/dist/client/components/navigation.js'\n\n import type { NavigateOptions, AppRouterInstance as OriginalAppRouterInstance } from '${PKG_NAME}/dist/shared/lib/app-router-context.shared-runtime.js'\n import type { RedirectType } from '${PKG_NAME}/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 '${PKG_NAME}/form' {\n import type { FormProps as OriginalFormProps } from '${PKG_NAME}/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\n // NOTE: we previously used `satisfies` here, but it's not supported by TypeScript 4.8 and below.\n // If we ever raise the TS minimum version, we can switch back.\n\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 '${PKG_NAME}/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 \"${PKG_NAME}/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":["isDynamicRoute","path","fs","packageJsonPath","join","__dirname","PKG_NAME","JSON","parse","readFileSync","name","generateRouteTypes","routesManifest","appRoutes","Object","keys","sort","pageRoutes","layoutRoutes","redirectRoutes","rewriteRoutes","result","length","map","route","stringify","appRouteHandlerRoutes","hasAppRouteHandlers","routeUnionParts","push","generateParamTypes","allRoutes","paramTypes","sortedRoutes","entries","a","b","localeCompare","routeInfo","groups","paramType","key","group","escapedKey","repeat","optional","generateLayoutSlotMap","slotMap","sortedLayoutRoutes","slots","slot","formatRouteToRouteType","isDynamic","split","part","startsWith","endsWith","routeType","serializeRouteTypes","routeTypes","generateLinkTypesFile","allRoutesSet","Set","Array","from","pageApiRoutes","staticRouteTypes","dynamicRouteTypes","serializedStaticRouteTypes","serializedDynamicRouteTypes","routeTypesFallback","generateValidatorFile","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","generateRouteTypesFile","layoutSlotMap","routeExports","exportStatement","routeContextInterface"],"mappings":"AACA,SAASA,cAAc,QAAQ,8CAA6C;AAC5E,OAAOC,UAAU,OAAM;AACvB,OAAOC,QAAQ,KAAI;AAEnB,2DAA2D;AAC3D,sDAAsD;AACtD,MAAMC,kBAAkBF,KAAKG,IAAI,CAACC,WAAW;AAC7C,MAAMC,WAAWC,KAAKC,KAAK,CAACN,GAAGO,YAAY,CAACN,iBAAiB,SAASO,IAAI;AA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@@ export async function getRequestHandlers({ dir, port, isDev, onDevServerCleanup,
|
|
|
87
87
|
export async function startServer(serverOptions) {
|
|
88
88
|
const { dir, isDev, hostname, minimalMode, allowRetry, keepAliveTimeout, selfSignedCertificate } = serverOptions;
|
|
89
89
|
let { port } = serverOptions;
|
|
90
|
-
process.title = `next-server (v${"15.6.0-bun.
|
|
90
|
+
process.title = `next-server (v${"15.6.0-bun.30"})`;
|
|
91
91
|
let handlersReady = ()=>{};
|
|
92
92
|
let handlersError = ()=>{};
|
|
93
93
|
let handlersPromise = new Promise((resolve, reject)=>{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export function isStableBuild() {
|
|
2
2
|
var _process_env___NEXT_VERSION;
|
|
3
|
-
return !((_process_env___NEXT_VERSION = "15.6.0-bun.
|
|
3
|
+
return !((_process_env___NEXT_VERSION = "15.6.0-bun.30") == null ? void 0 : _process_env___NEXT_VERSION.includes('canary')) && !process.env.__NEXT_TEST_MODE && !process.env.NEXT_PRIVATE_LOCAL_DEV;
|
|
4
4
|
}
|
|
5
5
|
export class CanaryOnlyError extends Error {
|
|
6
6
|
constructor(arg){
|
|
@@ -226,7 +226,7 @@ class HotReloaderWebpack {
|
|
|
226
226
|
this.previewProps = previewProps;
|
|
227
227
|
this.rewrites = rewrites;
|
|
228
228
|
this.hotReloaderSpan = (0, _trace.trace)('hot-reloader', undefined, {
|
|
229
|
-
version: "15.6.0-bun.
|
|
229
|
+
version: "15.6.0-bun.30"
|
|
230
230
|
});
|
|
231
231
|
// Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing
|
|
232
232
|
// of the current `next dev` invocation.
|
|
@@ -82,7 +82,7 @@ function logStartInfo({ networkUrl, appUrl, envInfo, experimentalFeatures, logBu
|
|
|
82
82
|
bundlerSuffix = ' (webpack)';
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
_log.bootstrap(`${(0, _picocolors.bold)((0, _picocolors.purple)(`${_log.prefixes.ready} Next.js ${"15.6.0-bun.
|
|
85
|
+
_log.bootstrap(`${(0, _picocolors.bold)((0, _picocolors.purple)(`${_log.prefixes.ready} Next.js ${"15.6.0-bun.30"}`))}${bundlerSuffix}`);
|
|
86
86
|
if (appUrl) {
|
|
87
87
|
_log.bootstrap(`- Local: ${appUrl}`);
|
|
88
88
|
}
|
|
@@ -25,8 +25,17 @@ _export(exports, {
|
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
27
|
const _isdynamic = require("../../../shared/lib/router/utils/is-dynamic");
|
|
28
|
+
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
29
|
+
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
30
|
+
function _interop_require_default(obj) {
|
|
31
|
+
return obj && obj.__esModule ? obj : {
|
|
32
|
+
default: obj
|
|
33
|
+
};
|
|
34
|
+
}
|
|
28
35
|
// Read package name dynamically to support forked packages
|
|
29
|
-
|
|
36
|
+
// Use dynamic path resolution to avoid bundler issues
|
|
37
|
+
const packageJsonPath = _path.default.join(__dirname, '../../../../../package.json');
|
|
38
|
+
const PKG_NAME = JSON.parse(_fs.default.readFileSync(packageJsonPath, 'utf8')).name;
|
|
30
39
|
function generateRouteTypes(routesManifest) {
|
|
31
40
|
const appRoutes = Object.keys(routesManifest.appRoutes).sort();
|
|
32
41
|
const pageRoutes = Object.keys(routesManifest.pageRoutes).sort();
|
|
@@ -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\n// Read package name dynamically to support forked packages\nconst PKG_NAME = require('../../../../../package.json').name\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 '${PKG_NAME}' {\n export { default } from '${PKG_NAME}/types.js'\n export * from '${PKG_NAME}/types.js'\n\n export type Route<T extends string = string> =\n __next_route_internal_types__.RouteImpl<T>\n}\n\ndeclare module '${PKG_NAME}/link' {\n export { useLinkStatus } from '${PKG_NAME}/dist/client/link.js'\n\n import type { LinkProps as OriginalLinkProps } from '${PKG_NAME}/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 '${PKG_NAME}/navigation' {\n export * from '${PKG_NAME}/dist/client/components/navigation.js'\n\n import type { NavigateOptions, AppRouterInstance as OriginalAppRouterInstance } from '${PKG_NAME}/dist/shared/lib/app-router-context.shared-runtime.js'\n import type { RedirectType } from '${PKG_NAME}/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 '${PKG_NAME}/form' {\n import type { FormProps as OriginalFormProps } from '${PKG_NAME}/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\n // NOTE: we previously used `satisfies` here, but it's not supported by TypeScript 4.8 and below.\n // If we ever raise the TS minimum version, we can switch back.\n\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 '${PKG_NAME}/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 \"${PKG_NAME}/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","PKG_NAME","require","name","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","nextRequ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CAAC;;;AAGV,EAAEiC,WAAW;;AAEb,EAAE5B,WAAW;;;;AAIb,EAAEiE,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'\nimport path from 'path'\nimport fs from 'fs'\n\n// Read package name dynamically to support forked packages\n// Use dynamic path resolution to avoid bundler issues\nconst packageJsonPath = path.join(__dirname, '../../../../../package.json')\nconst PKG_NAME = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8')).name\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 '${PKG_NAME}' {\n export { default } from '${PKG_NAME}/types.js'\n export * from '${PKG_NAME}/types.js'\n\n export type Route<T extends string = string> =\n __next_route_internal_types__.RouteImpl<T>\n}\n\ndeclare module '${PKG_NAME}/link' {\n export { useLinkStatus } from '${PKG_NAME}/dist/client/link.js'\n\n import type { LinkProps as OriginalLinkProps } from '${PKG_NAME}/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 '${PKG_NAME}/navigation' {\n export * from '${PKG_NAME}/dist/client/components/navigation.js'\n\n import type { NavigateOptions, AppRouterInstance as OriginalAppRouterInstance } from '${PKG_NAME}/dist/shared/lib/app-router-context.shared-runtime.js'\n import type { RedirectType } from '${PKG_NAME}/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 '${PKG_NAME}/form' {\n import type { FormProps as OriginalFormProps } from '${PKG_NAME}/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\n // NOTE: we previously used `satisfies` here, but it's not supported by TypeScript 4.8 and below.\n // If we ever raise the TS minimum version, we can switch back.\n\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 '${PKG_NAME}/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 \"${PKG_NAME}/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","packageJsonPath","path","join","__dirname","PKG_NAME","JSON","parse","fs","readFileSync","name","generateRouteTypes","routesManifest","appRoutes","Object","keys","sort","pageRoutes","layoutRoutes","redirectRoutes","rewriteRoutes","result","length","map","route","stringify","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":";;;;;;;;;;;;;;;;IA8MgBA,qBAAqB;eAArBA;;IAqcAC,sBAAsB;eAAtBA;;IAlPAC,qBAAqB;eAArBA;;;2BAhae;6DACd;2DACF;;;;;;AAEf,2DAA2D;AAC3D,sDAAsD;AACtD,MAAMC,kBAAkBC,aAAI,CAACC,IAAI,CAACC,WAAW;AAC7C,MAAMC,WAAWC,KAAKC,KAAK,CAACC,WAAE,CAACC,YAAY,CAACR,iBAAiB,SAASS,IAAI;AAE1E,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,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B;IACtC;IACA,MAAMmE,kBACJD,UAAUzE,MAAM,GAAG,IACf,CAAC,cAAc,EAAEyE,UAAU5F,IAAI,CAAC,MAAM,SAAS,EAAEE,SAAS,YAAY,CAAC,GACvE;IAEN,OAAO,CAAC;;;;AAIV,EAAEwF,qBAAqB;AACvB,EAAEG,kBAAkBF,kBAAkB;AACtC,EAAEH,gBAAgB;AAClB,EAAEV,mBAAmB;;AAErB,EAAEG,2BAA2B;;AAE7B,EAAEE,2BAA2B;;AAE7B,EAAEE,yBAAyB;;AAE3B,EAAEC,kBAAkB;AACpB,CAAC;AACD;AAEO,SAAS1F,uBACda,cAAkC;IAElC,MAAMgD,aAAajD,mBAAmBC;IACtC,MAAMoB,aAAaF,mBAAmBlB;IACtC,MAAMqF,gBAAgBlD,sBAAsBnC;IAE5C,MAAMe,sBACJb,OAAOC,IAAI,CAACH,eAAec,qBAAqB,EAAEJ,MAAM,GAAG;IAE7D,4DAA4D;IAC5D,MAAM4E,eAAe;QACnB;QACA;QACA;QACA;QACA;QACA;KACD;IACD,IAAIvE,qBAAqB;QACvBuE,aAAarE,IAAI,CAAC;IACpB;IAEA,MAAMsE,kBAAkB,CAAC,cAAc,EAAED,aAAa/F,IAAI,CAAC,MAAM,EAAE,CAAC;IAEpE,MAAMiG,wBAAwBzE,sBAC1B,CAAC;;;;;;;;;;;;;;GAcJ,CAAC,GACE;IAEJ,OAAO,CAAC;;;AAGV,EAAEiC,WAAW;;AAEb,EAAE5B,WAAW;;;;AAIb,EAAEiE,cAAc;;AAEhB,EAAEE,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCf,EAAEC,sBAAsB;;AAE3B,CAAC;AACD","ignoreList":[0]}
|
|
@@ -155,7 +155,7 @@ async function getRequestHandlers({ dir, port, isDev, onDevServerCleanup, server
|
|
|
155
155
|
async function startServer(serverOptions) {
|
|
156
156
|
const { dir, isDev, hostname, minimalMode, allowRetry, keepAliveTimeout, selfSignedCertificate } = serverOptions;
|
|
157
157
|
let { port } = serverOptions;
|
|
158
|
-
process.title = `next-server (v${"15.6.0-bun.
|
|
158
|
+
process.title = `next-server (v${"15.6.0-bun.30"})`;
|
|
159
159
|
let handlersReady = ()=>{};
|
|
160
160
|
let handlersError = ()=>{};
|
|
161
161
|
let handlersPromise = new Promise((resolve, reject)=>{
|
|
@@ -22,7 +22,7 @@ _export(exports, {
|
|
|
22
22
|
});
|
|
23
23
|
function isStableBuild() {
|
|
24
24
|
var _process_env___NEXT_VERSION;
|
|
25
|
-
return !((_process_env___NEXT_VERSION = "15.6.0-bun.
|
|
25
|
+
return !((_process_env___NEXT_VERSION = "15.6.0-bun.30") == null ? void 0 : _process_env___NEXT_VERSION.includes('canary')) && !process.env.__NEXT_TEST_MODE && !process.env.NEXT_PRIVATE_LOCAL_DEV;
|
|
26
26
|
}
|
|
27
27
|
class CanaryOnlyError extends Error {
|
|
28
28
|
constructor(arg){
|
|
@@ -11,11 +11,11 @@ Object.defineProperty(exports, "eventCliSessionStopped", {
|
|
|
11
11
|
const EVENT_VERSION = 'NEXT_CLI_SESSION_STOPPED';
|
|
12
12
|
function eventCliSessionStopped(event) {
|
|
13
13
|
// This should be an invariant, if it fails our build tooling is broken.
|
|
14
|
-
if (typeof "15.6.0-bun.
|
|
14
|
+
if (typeof "15.6.0-bun.30" !== 'string') {
|
|
15
15
|
return [];
|
|
16
16
|
}
|
|
17
17
|
const payload = {
|
|
18
|
-
nextVersion: "15.6.0-bun.
|
|
18
|
+
nextVersion: "15.6.0-bun.30",
|
|
19
19
|
nodeVersion: process.version,
|
|
20
20
|
cliCommand: event.cliCommand,
|
|
21
21
|
durationMilliseconds: event.durationMilliseconds,
|