next 15.4.2-canary.47 → 15.4.2-canary.48

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

Potentially problematic release.


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

package/dist/bin/next CHANGED
@@ -79,7 +79,7 @@ const program = new NextRootCommand();
79
79
  program.name('next').description('The Next.js CLI allows you to develop, build, start your application, and more.').configureHelp({
80
80
  formatHelp: (cmd, helper)=>(0, _formatclihelpoutput.formatCliHelpOutput)(cmd, helper),
81
81
  subcommandTerm: (cmd)=>`${cmd.name()} ${cmd.usage()}`
82
- }).helpCommand(false).helpOption('-h, --help', 'Displays this message.').version(`Next.js v${"15.4.2-canary.47"}`, '-v, --version', 'Outputs the Next.js version.');
82
+ }).helpCommand(false).helpOption('-h, --help', 'Displays this message.').version(`Next.js v${"15.4.2-canary.48"}`, '-v, --version', 'Outputs the Next.js version.');
83
83
  program.command('build').description('Creates an optimized production build of your application. The output displays information about each route.').argument('[directory]', `A directory on which to build the application. ${(0, _picocolors.italic)('If no directory is provided, the current directory will be used.')}`).option('-d, --debug', 'Enables a more verbose build output.').option('--debug-prerender', 'Enables debug mode for prerendering. Not for production use!').option('--no-lint', 'Disables linting.').option('--no-mangling', 'Disables mangling.').option('--profile', 'Enables production profiling for React.').option('--experimental-app-only', 'Builds only App Router routes.').option('--turbo', 'Starts development mode using Turbopack.').option('--turbopack', 'Starts development mode using Turbopack.').addOption(new _commander.Option('--experimental-build-mode [mode]', 'Uses an experimental build mode.').choices([
84
84
  'compile',
85
85
  'generate',
@@ -367,7 +367,7 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
367
367
  const nextBuildSpan = (0, _trace.trace)('next-build', undefined, {
368
368
  buildMode: experimentalBuildMode,
369
369
  isTurboBuild: String(isTurbopack),
370
- version: "15.4.2-canary.47"
370
+ version: "15.4.2-canary.48"
371
371
  });
372
372
  _buildcontext.NextBuildContext.nextBuildSpan = nextBuildSpan;
373
373
  _buildcontext.NextBuildContext.dir = dir;
@@ -822,7 +822,7 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
822
822
  // Files outside of the distDir can be "type": "module"
823
823
  await writeFileUtf8(_path.default.join(distDir, 'package.json'), '{"type": "commonjs"}');
824
824
  // These are written to distDir, so they need to come after creating and cleaning distDr.
825
- await (0, _builddiagnostics.recordFrameworkVersion)("15.4.2-canary.47");
825
+ await (0, _builddiagnostics.recordFrameworkVersion)("15.4.2-canary.48");
826
826
  await (0, _builddiagnostics.updateBuildDiagnostics)({
827
827
  buildStage: 'start'
828
828
  });
@@ -131,7 +131,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
131
131
  }
132
132
  return newObj;
133
133
  }
134
- const nextVersion = "15.4.2-canary.47";
134
+ const nextVersion = "15.4.2-canary.48";
135
135
  const ArchName = (0, _os.arch)();
136
136
  const PlatformName = (0, _os.platform)();
137
137
  function infoLog(...args) {
@@ -1711,7 +1711,7 @@ async function getBaseWebpackConfig(dir, { buildId, encryptionKey, config, compi
1711
1711
  isClient && new _copyfileplugin.CopyFilePlugin({
1712
1712
  // file path to build output of `@next/polyfill-nomodule`
1713
1713
  filePath: require.resolve('./polyfills/polyfill-nomodule'),
1714
- cacheKey: "15.4.2-canary.47",
1714
+ cacheKey: "15.4.2-canary.48",
1715
1715
  name: `static/chunks/polyfills${dev ? '' : '-[hash]'}.js`,
1716
1716
  minimize: false,
1717
1717
  info: {
@@ -1890,7 +1890,7 @@ async function getBaseWebpackConfig(dir, { buildId, encryptionKey, config, compi
1890
1890
  // - Next.js location on disk (some loaders use absolute paths and some resolve options depend on absolute paths)
1891
1891
  // - Next.js version
1892
1892
  // - next.config.js keys that affect compilation
1893
- version: `${__dirname}|${"15.4.2-canary.47"}|${configVars}`,
1893
+ version: `${__dirname}|${"15.4.2-canary.48"}|${configVars}`,
1894
1894
  cacheDirectory: _path.default.join(distDir, 'cache', 'webpack'),
1895
1895
  // For production builds, it's more efficient to compress all cache files together instead of compression each one individually.
1896
1896
  // So we disable compression here and allow the build runner to take care of compressing the cache as a whole.
@@ -14,7 +14,7 @@ Object.defineProperty(exports, "appBootstrap", {
14
14
  }
15
15
  });
16
16
  const _setattributesfromprops = require("./set-attributes-from-props");
17
- const version = "15.4.2-canary.47";
17
+ const version = "15.4.2-canary.48";
18
18
  window.next = {
19
19
  version,
20
20
  appDir: true
@@ -61,7 +61,7 @@ const _hooksclientcontextsharedruntime = require("../shared/lib/hooks-client-con
61
61
  const _onrecoverableerror = require("./react-client-callbacks/on-recoverable-error");
62
62
  const _tracer = /*#__PURE__*/ _interop_require_default._(require("./tracing/tracer"));
63
63
  const _isnextroutererror = require("./components/is-next-router-error");
64
- const version = "15.4.2-canary.47";
64
+ const version = "15.4.2-canary.48";
65
65
  let router;
66
66
  const emitter = (0, _mitt.default)();
67
67
  const looseToArray = (input)=>[].slice.call(input);
@@ -299,7 +299,7 @@ export default async function build(dir, reactProductionProfiling = false, debug
299
299
  const nextBuildSpan = trace('next-build', undefined, {
300
300
  buildMode: experimentalBuildMode,
301
301
  isTurboBuild: String(isTurbopack),
302
- version: "15.4.2-canary.47"
302
+ version: "15.4.2-canary.48"
303
303
  });
304
304
  NextBuildContext.nextBuildSpan = nextBuildSpan;
305
305
  NextBuildContext.dir = dir;
@@ -754,7 +754,7 @@ export default async function build(dir, reactProductionProfiling = false, debug
754
754
  // Files outside of the distDir can be "type": "module"
755
755
  await writeFileUtf8(path.join(distDir, 'package.json'), '{"type": "commonjs"}');
756
756
  // These are written to distDir, so they need to come after creating and cleaning distDr.
757
- await recordFrameworkVersion("15.4.2-canary.47");
757
+ await recordFrameworkVersion("15.4.2-canary.48");
758
758
  await updateBuildDiagnostics({
759
759
  buildStage: 'start'
760
760
  });
@@ -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.4.2-canary.47";
14
+ const nextVersion = "15.4.2-canary.48";
15
15
  const ArchName = arch();
16
16
  const PlatformName = platform();
17
17
  function infoLog(...args) {
@@ -1608,7 +1608,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
1608
1608
  isClient && new CopyFilePlugin({
1609
1609
  // file path to build output of `@next/polyfill-nomodule`
1610
1610
  filePath: require.resolve('./polyfills/polyfill-nomodule'),
1611
- cacheKey: "15.4.2-canary.47",
1611
+ cacheKey: "15.4.2-canary.48",
1612
1612
  name: `static/chunks/polyfills${dev ? '' : '-[hash]'}.js`,
1613
1613
  minimize: false,
1614
1614
  info: {
@@ -1787,7 +1787,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
1787
1787
  // - Next.js location on disk (some loaders use absolute paths and some resolve options depend on absolute paths)
1788
1788
  // - Next.js version
1789
1789
  // - next.config.js keys that affect compilation
1790
- version: `${__dirname}|${"15.4.2-canary.47"}|${configVars}`,
1790
+ version: `${__dirname}|${"15.4.2-canary.48"}|${configVars}`,
1791
1791
  cacheDirectory: path.join(distDir, 'cache', 'webpack'),
1792
1792
  // For production builds, it's more efficient to compress all cache files together instead of compression each one individually.
1793
1793
  // So we disable compression here and allow the build runner to take care of compressing the cache as a whole.
@@ -4,7 +4,7 @@
4
4
  * - Polyfills
5
5
  * - next/script with `beforeInteractive` strategy
6
6
  */ import { setAttributesFromProps } from './set-attributes-from-props';
7
- const version = "15.4.2-canary.47";
7
+ const version = "15.4.2-canary.48";
8
8
  window.next = {
9
9
  version,
10
10
  appDir: true
@@ -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.4.2-canary.47";
29
+ export const version = "15.4.2-canary.48";
30
30
  export let router;
31
31
  export const emitter = mitt();
32
32
  const looseToArray = (input)=>[].slice.call(input);
@@ -89,7 +89,7 @@ export async function createHotReloaderTurbopack(opts, serverFields, distDir, re
89
89
  }
90
90
  const hasRewrites = opts.fsChecker.rewrites.afterFiles.length > 0 || opts.fsChecker.rewrites.beforeFiles.length > 0 || opts.fsChecker.rewrites.fallback.length > 0;
91
91
  const hotReloaderSpan = trace('hot-reloader', undefined, {
92
- version: "15.4.2-canary.47"
92
+ version: "15.4.2-canary.48"
93
93
  });
94
94
  // Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing
95
95
  // of the current `next dev` invocation.
@@ -186,7 +186,7 @@ export default class HotReloaderWebpack {
186
186
  this.previewProps = previewProps;
187
187
  this.rewrites = rewrites;
188
188
  this.hotReloaderSpan = trace('hot-reloader', undefined, {
189
- version: "15.4.2-canary.47"
189
+ version: "15.4.2-canary.48"
190
190
  });
191
191
  // Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing
192
192
  // of the current `next dev` invocation.
@@ -12,7 +12,7 @@ export function logStartInfo({ networkUrl, appUrl, envInfo, experimentalFeatures
12
12
  } else {
13
13
  bundlerSuffix = '';
14
14
  }
15
- Log.bootstrap(`${bold(purple(`${Log.prefixes.ready} Next.js ${"15.4.2-canary.47"}`))}${bundlerSuffix}`);
15
+ Log.bootstrap(`${bold(purple(`${Log.prefixes.ready} Next.js ${"15.4.2-canary.48"}`))}${bundlerSuffix}`);
16
16
  if (appUrl) {
17
17
  Log.bootstrap(`- Local: ${appUrl}`);
18
18
  }
@@ -298,7 +298,7 @@ export function generateValidatorFile(routesManifest) {
298
298
  const typeWithRoute = route && (type === 'AppPageConfig' || type === 'LayoutConfig' || type === 'RouteHandlerConfig') ? `${type}<${JSON.stringify(route)}>` : type;
299
299
  return `// Validate ${filePath}
300
300
  {
301
- const handler = {} as typeof import(${JSON.stringify(importPath)})
301
+ const handler = {} as typeof import(${JSON.stringify(importPath.replace(/\.tsx?$/, '.js'))})
302
302
  handler satisfies ${typeWithRoute}
303
303
  }`;
304
304
  }).join('\n\n');
@@ -431,7 +431,7 @@ declare global {
431
431
  params: Promise<ParamMap[AppRoute]>
432
432
  searchParams: Promise<Record<string, string | string[] | undefined>>
433
433
  }
434
-
434
+
435
435
  /**
436
436
  * Props for Next.js App Router layout components
437
437
  * @example
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/server/lib/router-utils/typegen.ts"],"sourcesContent":["import type { RouteTypesManifest } from './route-types-utils'\nimport { isDynamicRoute } from '../../../shared/lib/router/utils/is-dynamic'\n\nfunction generateRouteTypes(routesManifest: RouteTypesManifest): string {\n const appRoutes = Object.keys(routesManifest.appRoutes).sort()\n const pageRoutes = Object.keys(routesManifest.pageRoutes).sort()\n const layoutRoutes = Object.keys(routesManifest.layoutRoutes).sort()\n const redirectRoutes = Object.keys(routesManifest.redirectRoutes).sort()\n const rewriteRoutes = Object.keys(routesManifest.rewriteRoutes).sort()\n\n let result = ''\n\n // Generate AppRoutes union type (pages only)\n if (appRoutes.length > 0) {\n result += `type AppRoutes = ${appRoutes.map((route) => JSON.stringify(route)).join(' | ')}\\n`\n } else {\n result += 'type AppRoutes = never\\n'\n }\n\n // Generate AppRouteHandlerRoutes union type for route handlers\n const appRouteHandlerRoutes = Object.keys(\n routesManifest.appRouteHandlerRoutes\n ).sort()\n\n if (appRouteHandlerRoutes.length > 0) {\n result += `type AppRouteHandlerRoutes = ${appRouteHandlerRoutes.map((route) => JSON.stringify(route)).join(' | ')}\\n`\n } else {\n result += 'type AppRouteHandlerRoutes = never\\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 result +=\n 'type Routes = AppRoutes | AppRouteHandlerRoutes | PageRoutes | LayoutRoutes | RedirectRoutes | RewriteRoutes\\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 const allRoutes = {\n ...routesManifest.appRoutes,\n ...routesManifest.pageRoutes,\n ...routesManifest.redirectRoutes,\n ...routesManifest.rewriteRoutes,\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 Object.keys(allRoutes)) {\n const { isDynamic, routeType } = formatRouteToRouteType(route)\n if (isDynamic) {\n dynamicRouteTypes.push(routeType)\n } else {\n staticRouteTypes.push(routeType)\n }\n }\n\n const serializedStaticRouteTypes = serializeRouteTypes(staticRouteTypes)\n const serializedDynamicRouteTypes = serializeRouteTypes(dynamicRouteTypes)\n\n // If both StaticRoutes and DynamicRoutes are empty, fallback to type 'string & {}'.\n const routeTypesFallback =\n !serializedStaticRouteTypes && !serializedDynamicRouteTypes\n ? 'string & {}'\n : ''\n\n return `// This file is generated automatically by Next.js\n// Do not edit this file manually\n\n// Type definitions for Next.js routes\n\n/**\n * Internal types used by the Next.js router and Link component.\n * These types are not meant to be used directly.\n * @internal\n */\ndeclare namespace __next_route_internal_types__ {\n type SearchOrHash = \\`?\\${string}\\` | \\`#\\${string}\\`\n type WithProtocol = \\`\\${string}:\\${string}\\`\n\n type Suffix = '' | SearchOrHash\n\n type SafeSlug<S extends string> = S extends \\`\\${string}/\\${string}\\`\n ? never\n : S extends \\`\\${string}\\${SearchOrHash}\\`\n ? never\n : S extends ''\n ? never\n : S\n\n type CatchAllSlug<S extends string> = S extends \\`\\${string}\\${SearchOrHash}\\`\n ? never\n : S extends ''\n ? never\n : S\n\n type OptionalCatchAllSlug<S extends string> =\n S extends \\`\\${string}\\${SearchOrHash}\\` ? never : S\n\n type StaticRoutes = ${serializedStaticRouteTypes || 'never'}\n type DynamicRoutes<T extends string = string> = ${\n serializedDynamicRouteTypes || 'never'\n }\n\n type RouteImpl<T> = ${\n routeTypesFallback ||\n `\n ${\n // This keeps autocompletion working for static routes.\n '| StaticRoutes'\n }\n | SearchOrHash\n | WithProtocol\n | \\`\\${StaticRoutes}\\${SearchOrHash}\\`\n | (T extends \\`\\${DynamicRoutes<infer _>}\\${Suffix}\\` ? T : never)\n `\n }\n}\n\ndeclare module 'next' {\n export { default } from 'next/types.js'\n export * from 'next/types.js'\n\n export type Route<T extends string = string> =\n __next_route_internal_types__.RouteImpl<T>\n}\n\ndeclare module 'next/link' {\n import type { LinkProps as OriginalLinkProps } from 'next/dist/client/link.js'\n import type { AnchorHTMLAttributes, DetailedHTMLProps } from 'react'\n import type { UrlObject } from 'url'\n\n type LinkRestProps = Omit<\n Omit<\n DetailedHTMLProps<\n AnchorHTMLAttributes<HTMLAnchorElement>,\n HTMLAnchorElement\n >,\n keyof OriginalLinkProps\n > &\n OriginalLinkProps,\n 'href'\n >\n\n export type LinkProps<RouteInferType> = LinkRestProps & {\n /**\n * The path or URL to navigate to. This is the only required prop. It can also be an object.\n * @see https://nextjs.org/docs/api-reference/next/link\n */\n href: __next_route_internal_types__.RouteImpl<RouteInferType> | UrlObject\n }\n\n export default function Link<RouteType>(props: LinkProps<RouteType>): JSX.Element\n}\n\ndeclare module 'next/navigation' {\n export * from 'next/dist/client/components/navigation.js'\n\n import type { NavigateOptions, AppRouterInstance as OriginalAppRouterInstance } from 'next/dist/shared/lib/app-router-context.shared-runtime.js'\n 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\ndeclare module 'next/form' {\n import type { FormProps as OriginalFormProps } from 'next/dist/client/form.js'\n\n type FormRestProps = Omit<OriginalFormProps, 'action'>\n\n export type FormProps<RouteInferType> = {\n /**\n * \\`action\\` can be either a \\`string\\` or a function.\n * - If \\`action\\` is a string, it will be interpreted as a path or URL to navigate to when the form is submitted.\n * The path will be prefetched when the form becomes visible.\n * - If \\`action\\` is a function, it will be called when the form is submitted. See the [React docs](https://react.dev/reference/react-dom/components/form#props) for more.\n */\n action: __next_route_internal_types__.RouteImpl<RouteInferType> | ((formData: FormData) => void)\n } & FormRestProps\n\n export default function Form<RouteType>(props: FormProps<RouteType>): JSX.Element\n}\n`\n}\n\nexport function generateValidatorFile(\n routesManifest: RouteTypesManifest\n): string {\n const generateValidations = (\n paths: string[],\n type:\n | 'AppPageConfig'\n | 'PagesPageConfig'\n | 'LayoutConfig'\n | 'RouteHandlerConfig'\n | 'ApiRouteConfig',\n pathToRouteMap?: Map<string, string>\n ) =>\n paths\n .sort()\n // Only validate TypeScript files - JavaScript files have too many type inference limitations\n .filter(\n (filePath) => filePath.endsWith('.ts') || filePath.endsWith('.tsx')\n )\n .filter(\n // Don't include metadata routes or pages\n // (e.g. /manifest.webmanifest)\n (filePath) =>\n type !== 'AppPageConfig' ||\n filePath.endsWith('page.ts') ||\n filePath.endsWith('page.tsx')\n )\n .map((filePath) => {\n // Keep the file extension for TypeScript imports to support node16 module resolution\n const importPath = filePath\n const route = pathToRouteMap?.get(filePath)\n const typeWithRoute =\n route &&\n (type === 'AppPageConfig' ||\n type === 'LayoutConfig' ||\n type === 'RouteHandlerConfig')\n ? `${type}<${JSON.stringify(route)}>`\n : type\n return `// Validate ${filePath}\n{\n const handler = {} as typeof import(${JSON.stringify(importPath)})\n handler satisfies ${typeWithRoute}\n}`\n })\n .join('\\n\\n')\n\n // Use direct mappings from the manifest\n\n // Generate validations for different route types\n const appPageValidations = generateValidations(\n Array.from(routesManifest.appPagePaths).sort(),\n 'AppPageConfig',\n routesManifest.filePathToRoute\n )\n const appRouteHandlerValidations = generateValidations(\n Array.from(routesManifest.appRouteHandlers).sort(),\n 'RouteHandlerConfig',\n routesManifest.filePathToRoute\n )\n const pagesRouterPageValidations = generateValidations(\n Array.from(routesManifest.pagesRouterPagePaths).sort(),\n 'PagesPageConfig'\n )\n const pagesApiRouteValidations = generateValidations(\n Array.from(routesManifest.pageApiRoutes).sort(),\n 'ApiRouteConfig'\n )\n const layoutValidations = generateValidations(\n Array.from(routesManifest.layoutPaths).sort(),\n 'LayoutConfig',\n routesManifest.filePathToRoute\n )\n\n 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\nimport type { AppRoutes, AppRouteHandlerRoutes, LayoutRoutes, ParamMap } from \"./routes.js\"\nimport type { ResolvingMetadata, ResolvingViewport } from \"next/dist/lib/metadata/types/metadata-interface.js\"\nimport type { NextRequest } from 'next/server.js'\n\ntype 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\ntype 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'\n maxDuration?: number\n runtime?: 'edge' | 'experimental-edge' | 'nodejs' | string // necessary unless config is exported as const\n regions?: string[]\n }\n}\n\ntype 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\ntype RouteHandlerConfig<Route extends AppRouteHandlerRoutes = AppRouteHandlerRoutes> = {\n GET?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response> | Response | Promise<void> | void\n POST?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response> | Response | Promise<void> | void\n PUT?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response> | Response | Promise<void> | void\n PATCH?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response> | Response | Promise<void> | void\n DELETE?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response> | Response | Promise<void> | void\n HEAD?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response> | Response | Promise<void> | void\n OPTIONS?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response> | Response | Promise<void> | void\n}\n\ntype ApiRouteConfig = {\n default: (req: any, res: any) => Promise<void> | void | Promise<Response> | Response\n config?: {\n api?: {\n bodyParser?: boolean | { sizeLimit?: string }\n responseLimit?: string | number\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${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 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\nexport type { AppRoutes, AppRouteHandlerRoutes, PageRoutes, LayoutRoutes, RedirectRoutes, RewriteRoutes, ParamMap }\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 }\n}\n`\n}\n"],"names":["isDynamicRoute","generateRouteTypes","routesManifest","appRoutes","Object","keys","sort","pageRoutes","layoutRoutes","redirectRoutes","rewriteRoutes","result","length","map","route","JSON","stringify","join","appRouteHandlerRoutes","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","staticRouteTypes","dynamicRouteTypes","push","serializedStaticRouteTypes","serializedDynamicRouteTypes","routeTypesFallback","generateValidatorFile","generateValidations","paths","type","pathToRouteMap","filter","filePath","importPath","get","typeWithRoute","appPageValidations","Array","from","appPagePaths","filePathToRoute","appRouteHandlerValidations","appRouteHandlers","pagesRouterPageValidations","pagesRouterPagePaths","pagesApiRouteValidations","pageApiRoutes","layoutValidations","layoutPaths","generateRouteTypesFile","layoutSlotMap"],"mappings":"AACA,SAASA,cAAc,QAAQ,8CA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/typegen.ts"],"sourcesContent":["import type { RouteTypesManifest } from './route-types-utils'\nimport { isDynamicRoute } from '../../../shared/lib/router/utils/is-dynamic'\n\nfunction generateRouteTypes(routesManifest: RouteTypesManifest): string {\n const appRoutes = Object.keys(routesManifest.appRoutes).sort()\n const pageRoutes = Object.keys(routesManifest.pageRoutes).sort()\n const layoutRoutes = Object.keys(routesManifest.layoutRoutes).sort()\n const redirectRoutes = Object.keys(routesManifest.redirectRoutes).sort()\n const rewriteRoutes = Object.keys(routesManifest.rewriteRoutes).sort()\n\n let result = ''\n\n // Generate AppRoutes union type (pages only)\n if (appRoutes.length > 0) {\n result += `type AppRoutes = ${appRoutes.map((route) => JSON.stringify(route)).join(' | ')}\\n`\n } else {\n result += 'type AppRoutes = never\\n'\n }\n\n // Generate AppRouteHandlerRoutes union type for route handlers\n const appRouteHandlerRoutes = Object.keys(\n routesManifest.appRouteHandlerRoutes\n ).sort()\n\n if (appRouteHandlerRoutes.length > 0) {\n result += `type AppRouteHandlerRoutes = ${appRouteHandlerRoutes.map((route) => JSON.stringify(route)).join(' | ')}\\n`\n } else {\n result += 'type AppRouteHandlerRoutes = never\\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 result +=\n 'type Routes = AppRoutes | AppRouteHandlerRoutes | PageRoutes | LayoutRoutes | RedirectRoutes | RewriteRoutes\\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 const allRoutes = {\n ...routesManifest.appRoutes,\n ...routesManifest.pageRoutes,\n ...routesManifest.redirectRoutes,\n ...routesManifest.rewriteRoutes,\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 Object.keys(allRoutes)) {\n const { isDynamic, routeType } = formatRouteToRouteType(route)\n if (isDynamic) {\n dynamicRouteTypes.push(routeType)\n } else {\n staticRouteTypes.push(routeType)\n }\n }\n\n const serializedStaticRouteTypes = serializeRouteTypes(staticRouteTypes)\n const serializedDynamicRouteTypes = serializeRouteTypes(dynamicRouteTypes)\n\n // If both StaticRoutes and DynamicRoutes are empty, fallback to type 'string & {}'.\n const routeTypesFallback =\n !serializedStaticRouteTypes && !serializedDynamicRouteTypes\n ? 'string & {}'\n : ''\n\n return `// This file is generated automatically by Next.js\n// Do not edit this file manually\n\n// Type definitions for Next.js routes\n\n/**\n * Internal types used by the Next.js router and Link component.\n * These types are not meant to be used directly.\n * @internal\n */\ndeclare namespace __next_route_internal_types__ {\n type SearchOrHash = \\`?\\${string}\\` | \\`#\\${string}\\`\n type WithProtocol = \\`\\${string}:\\${string}\\`\n\n type Suffix = '' | SearchOrHash\n\n type SafeSlug<S extends string> = S extends \\`\\${string}/\\${string}\\`\n ? never\n : S extends \\`\\${string}\\${SearchOrHash}\\`\n ? never\n : S extends ''\n ? never\n : S\n\n type CatchAllSlug<S extends string> = S extends \\`\\${string}\\${SearchOrHash}\\`\n ? never\n : S extends ''\n ? never\n : S\n\n type OptionalCatchAllSlug<S extends string> =\n S extends \\`\\${string}\\${SearchOrHash}\\` ? never : S\n\n type StaticRoutes = ${serializedStaticRouteTypes || 'never'}\n type DynamicRoutes<T extends string = string> = ${\n serializedDynamicRouteTypes || 'never'\n }\n\n type RouteImpl<T> = ${\n routeTypesFallback ||\n `\n ${\n // This keeps autocompletion working for static routes.\n '| StaticRoutes'\n }\n | SearchOrHash\n | WithProtocol\n | \\`\\${StaticRoutes}\\${SearchOrHash}\\`\n | (T extends \\`\\${DynamicRoutes<infer _>}\\${Suffix}\\` ? T : never)\n `\n }\n}\n\ndeclare module 'next' {\n export { default } from 'next/types.js'\n export * from 'next/types.js'\n\n export type Route<T extends string = string> =\n __next_route_internal_types__.RouteImpl<T>\n}\n\ndeclare module 'next/link' {\n import type { LinkProps as OriginalLinkProps } from 'next/dist/client/link.js'\n import type { AnchorHTMLAttributes, DetailedHTMLProps } from 'react'\n import type { UrlObject } from 'url'\n\n type LinkRestProps = Omit<\n Omit<\n DetailedHTMLProps<\n AnchorHTMLAttributes<HTMLAnchorElement>,\n HTMLAnchorElement\n >,\n keyof OriginalLinkProps\n > &\n OriginalLinkProps,\n 'href'\n >\n\n export type LinkProps<RouteInferType> = LinkRestProps & {\n /**\n * The path or URL to navigate to. This is the only required prop. It can also be an object.\n * @see https://nextjs.org/docs/api-reference/next/link\n */\n href: __next_route_internal_types__.RouteImpl<RouteInferType> | UrlObject\n }\n\n export default function Link<RouteType>(props: LinkProps<RouteType>): JSX.Element\n}\n\ndeclare module 'next/navigation' {\n export * from 'next/dist/client/components/navigation.js'\n\n import type { NavigateOptions, AppRouterInstance as OriginalAppRouterInstance } from 'next/dist/shared/lib/app-router-context.shared-runtime.js'\n 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\ndeclare module 'next/form' {\n import type { FormProps as OriginalFormProps } from 'next/dist/client/form.js'\n\n type FormRestProps = Omit<OriginalFormProps, 'action'>\n\n export type FormProps<RouteInferType> = {\n /**\n * \\`action\\` can be either a \\`string\\` or a function.\n * - If \\`action\\` is a string, it will be interpreted as a path or URL to navigate to when the form is submitted.\n * The path will be prefetched when the form becomes visible.\n * - If \\`action\\` is a function, it will be called when the form is submitted. See the [React docs](https://react.dev/reference/react-dom/components/form#props) for more.\n */\n action: __next_route_internal_types__.RouteImpl<RouteInferType> | ((formData: FormData) => void)\n } & FormRestProps\n\n export default function Form<RouteType>(props: FormProps<RouteType>): JSX.Element\n}\n`\n}\n\nexport function generateValidatorFile(\n routesManifest: RouteTypesManifest\n): string {\n const generateValidations = (\n paths: string[],\n type:\n | 'AppPageConfig'\n | 'PagesPageConfig'\n | 'LayoutConfig'\n | 'RouteHandlerConfig'\n | 'ApiRouteConfig',\n pathToRouteMap?: Map<string, string>\n ) =>\n paths\n .sort()\n // Only validate TypeScript files - JavaScript files have too many type inference limitations\n .filter(\n (filePath) => filePath.endsWith('.ts') || filePath.endsWith('.tsx')\n )\n .filter(\n // Don't include metadata routes or pages\n // (e.g. /manifest.webmanifest)\n (filePath) =>\n type !== 'AppPageConfig' ||\n filePath.endsWith('page.ts') ||\n filePath.endsWith('page.tsx')\n )\n .map((filePath) => {\n // Keep the file extension for TypeScript imports to support node16 module resolution\n const importPath = filePath\n const route = pathToRouteMap?.get(filePath)\n const typeWithRoute =\n route &&\n (type === 'AppPageConfig' ||\n type === 'LayoutConfig' ||\n type === 'RouteHandlerConfig')\n ? `${type}<${JSON.stringify(route)}>`\n : type\n return `// Validate ${filePath}\n{\n const handler = {} as typeof import(${JSON.stringify(\n importPath.replace(/\\.tsx?$/, '.js')\n )})\n handler satisfies ${typeWithRoute}\n}`\n })\n .join('\\n\\n')\n\n // Use direct mappings from the manifest\n\n // Generate validations for different route types\n const appPageValidations = generateValidations(\n Array.from(routesManifest.appPagePaths).sort(),\n 'AppPageConfig',\n routesManifest.filePathToRoute\n )\n const appRouteHandlerValidations = generateValidations(\n Array.from(routesManifest.appRouteHandlers).sort(),\n 'RouteHandlerConfig',\n routesManifest.filePathToRoute\n )\n const pagesRouterPageValidations = generateValidations(\n Array.from(routesManifest.pagesRouterPagePaths).sort(),\n 'PagesPageConfig'\n )\n const pagesApiRouteValidations = generateValidations(\n Array.from(routesManifest.pageApiRoutes).sort(),\n 'ApiRouteConfig'\n )\n const layoutValidations = generateValidations(\n Array.from(routesManifest.layoutPaths).sort(),\n 'LayoutConfig',\n routesManifest.filePathToRoute\n )\n\n 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\nimport type { AppRoutes, AppRouteHandlerRoutes, LayoutRoutes, ParamMap } from \"./routes.js\"\nimport type { ResolvingMetadata, ResolvingViewport } from \"next/dist/lib/metadata/types/metadata-interface.js\"\nimport type { NextRequest } from 'next/server.js'\n\ntype 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\ntype 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'\n maxDuration?: number\n runtime?: 'edge' | 'experimental-edge' | 'nodejs' | string // necessary unless config is exported as const\n regions?: string[]\n }\n}\n\ntype 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\ntype RouteHandlerConfig<Route extends AppRouteHandlerRoutes = AppRouteHandlerRoutes> = {\n GET?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response> | Response | Promise<void> | void\n POST?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response> | Response | Promise<void> | void\n PUT?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response> | Response | Promise<void> | void\n PATCH?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response> | Response | Promise<void> | void\n DELETE?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response> | Response | Promise<void> | void\n HEAD?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response> | Response | Promise<void> | void\n OPTIONS?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response> | Response | Promise<void> | void\n}\n\ntype ApiRouteConfig = {\n default: (req: any, res: any) => Promise<void> | void | Promise<Response> | Response\n config?: {\n api?: {\n bodyParser?: boolean | { sizeLimit?: string }\n responseLimit?: string | number\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${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 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\nexport type { AppRoutes, AppRouteHandlerRoutes, PageRoutes, LayoutRoutes, RedirectRoutes, RewriteRoutes, ParamMap }\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 }\n}\n`\n}\n"],"names":["isDynamicRoute","generateRouteTypes","routesManifest","appRoutes","Object","keys","sort","pageRoutes","layoutRoutes","redirectRoutes","rewriteRoutes","result","length","map","route","JSON","stringify","join","appRouteHandlerRoutes","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","staticRouteTypes","dynamicRouteTypes","push","serializedStaticRouteTypes","serializedDynamicRouteTypes","routeTypesFallback","generateValidatorFile","generateValidations","paths","type","pathToRouteMap","filter","filePath","importPath","get","typeWithRoute","replace","appPageValidations","Array","from","appPagePaths","filePathToRoute","appRouteHandlerValidations","appRouteHandlers","pagesRouterPageValidations","pagesRouterPagePaths","pagesApiRouteValidations","pageApiRoutes","layoutValidations","layoutPaths","generateRouteTypesFile","layoutSlotMap"],"mappings":"AACA,SAASA,cAAc,QAAQ,8CAA6C;AAE5E,SAASC,mBAAmBC,cAAkC;IAC5D,MAAMC,YAAYC,OAAOC,IAAI,CAACH,eAAeC,SAAS,EAAEG,IAAI;IAC5D,MAAMC,aAAaH,OAAOC,IAAI,CAACH,eAAeK,UAAU,EAAED,IAAI;IAC9D,MAA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BV,oBACzBW,MAAMC,IAAI,CAACnE,eAAeoE,YAAY,EAAEhE,IAAI,IAC5C,iBACAJ,eAAeqE,eAAe;IAEhC,MAAMC,6BAA6Bf,oBACjCW,MAAMC,IAAI,CAACnE,eAAeuE,gBAAgB,EAAEnE,IAAI,IAChD,sBACAJ,eAAeqE,eAAe;IAEhC,MAAMG,6BAA6BjB,oBACjCW,MAAMC,IAAI,CAACnE,eAAeyE,oBAAoB,EAAErE,IAAI,IACpD;IAEF,MAAMsE,2BAA2BnB,oBAC/BW,MAAMC,IAAI,CAACnE,eAAe2E,aAAa,EAAEvE,IAAI,IAC7C;IAEF,MAAMwE,oBAAoBrB,oBACxBW,MAAMC,IAAI,CAACnE,eAAe6E,WAAW,EAAEzE,IAAI,IAC3C,gBACAJ,eAAeqE,eAAe;IAGhC,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+EV,EAAEJ,mBAAmB;;AAErB,EAAEK,2BAA2B;;AAE7B,EAAEE,2BAA2B;;AAE7B,EAAEE,yBAAyB;;AAE3B,EAAEE,kBAAkB;AACpB,CAAC;AACD;AAEA,OAAO,SAASE,uBACd9E,cAAkC;IAElC,MAAM8C,aAAa/C,mBAAmBC;IACtC,MAAMmB,aAAaF,mBAAmBjB;IACtC,MAAM+E,gBAAgB9C,sBAAsBjC;IAE5C,OAAO,CAAC;;;AAGV,EAAE8C,WAAW;;AAEb,EAAE3B,WAAW;;;;AAIb,EAAE4D,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoChB,CAAC;AACD","ignoreList":[0]}
@@ -111,7 +111,7 @@ export async function getRequestHandlers({ dir, port, isDev, onDevServerCleanup,
111
111
  export async function startServer(serverOptions) {
112
112
  const { dir, isDev, hostname, minimalMode, allowRetry, keepAliveTimeout, selfSignedCertificate } = serverOptions;
113
113
  let { port } = serverOptions;
114
- process.title = `next-server (v${"15.4.2-canary.47"})`;
114
+ process.title = `next-server (v${"15.4.2-canary.48"})`;
115
115
  let handlersReady = ()=>{};
116
116
  let handlersError = ()=>{};
117
117
  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.4.2-canary.47") == null ? void 0 : _process_env___NEXT_VERSION.includes('canary')) && !process.env.__NEXT_TEST_MODE && !process.env.NEXT_PRIVATE_LOCAL_DEV;
3
+ return !((_process_env___NEXT_VERSION = "15.4.2-canary.48") == 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){
@@ -145,7 +145,7 @@ async function createHotReloaderTurbopack(opts, serverFields, distDir, resetFetc
145
145
  }
146
146
  const hasRewrites = opts.fsChecker.rewrites.afterFiles.length > 0 || opts.fsChecker.rewrites.beforeFiles.length > 0 || opts.fsChecker.rewrites.fallback.length > 0;
147
147
  const hotReloaderSpan = (0, _trace.trace)('hot-reloader', undefined, {
148
- version: "15.4.2-canary.47"
148
+ version: "15.4.2-canary.48"
149
149
  });
150
150
  // Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing
151
151
  // of the current `next dev` invocation.
@@ -262,7 +262,7 @@ class HotReloaderWebpack {
262
262
  this.previewProps = previewProps;
263
263
  this.rewrites = rewrites;
264
264
  this.hotReloaderSpan = (0, _trace.trace)('hot-reloader', undefined, {
265
- version: "15.4.2-canary.47"
265
+ version: "15.4.2-canary.48"
266
266
  });
267
267
  // Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing
268
268
  // of the current `next dev` invocation.
@@ -80,7 +80,7 @@ function logStartInfo({ networkUrl, appUrl, envInfo, experimentalFeatures, maxEx
80
80
  } else {
81
81
  bundlerSuffix = '';
82
82
  }
83
- _log.bootstrap(`${(0, _picocolors.bold)((0, _picocolors.purple)(`${_log.prefixes.ready} Next.js ${"15.4.2-canary.47"}`))}${bundlerSuffix}`);
83
+ _log.bootstrap(`${(0, _picocolors.bold)((0, _picocolors.purple)(`${_log.prefixes.ready} Next.js ${"15.4.2-canary.48"}`))}${bundlerSuffix}`);
84
84
  if (appUrl) {
85
85
  _log.bootstrap(`- Local: ${appUrl}`);
86
86
  }
@@ -324,7 +324,7 @@ function generateValidatorFile(routesManifest) {
324
324
  const typeWithRoute = route && (type === 'AppPageConfig' || type === 'LayoutConfig' || type === 'RouteHandlerConfig') ? `${type}<${JSON.stringify(route)}>` : type;
325
325
  return `// Validate ${filePath}
326
326
  {
327
- const handler = {} as typeof import(${JSON.stringify(importPath)})
327
+ const handler = {} as typeof import(${JSON.stringify(importPath.replace(/\.tsx?$/, '.js'))})
328
328
  handler satisfies ${typeWithRoute}
329
329
  }`;
330
330
  }).join('\n\n');
@@ -457,7 +457,7 @@ declare global {
457
457
  params: Promise<ParamMap[AppRoute]>
458
458
  searchParams: Promise<Record<string, string | string[] | undefined>>
459
459
  }
460
-
460
+
461
461
  /**
462
462
  * Props for Next.js App Router layout components
463
463
  * @example
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/server/lib/router-utils/typegen.ts"],"sourcesContent":["import type { RouteTypesManifest } from './route-types-utils'\nimport { isDynamicRoute } from '../../../shared/lib/router/utils/is-dynamic'\n\nfunction generateRouteTypes(routesManifest: RouteTypesManifest): string {\n const appRoutes = Object.keys(routesManifest.appRoutes).sort()\n const pageRoutes = Object.keys(routesManifest.pageRoutes).sort()\n const layoutRoutes = Object.keys(routesManifest.layoutRoutes).sort()\n const redirectRoutes = Object.keys(routesManifest.redirectRoutes).sort()\n const rewriteRoutes = Object.keys(routesManifest.rewriteRoutes).sort()\n\n let result = ''\n\n // Generate AppRoutes union type (pages only)\n if (appRoutes.length > 0) {\n result += `type AppRoutes = ${appRoutes.map((route) => JSON.stringify(route)).join(' | ')}\\n`\n } else {\n result += 'type AppRoutes = never\\n'\n }\n\n // Generate AppRouteHandlerRoutes union type for route handlers\n const appRouteHandlerRoutes = Object.keys(\n routesManifest.appRouteHandlerRoutes\n ).sort()\n\n if (appRouteHandlerRoutes.length > 0) {\n result += `type AppRouteHandlerRoutes = ${appRouteHandlerRoutes.map((route) => JSON.stringify(route)).join(' | ')}\\n`\n } else {\n result += 'type AppRouteHandlerRoutes = never\\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 result +=\n 'type Routes = AppRoutes | AppRouteHandlerRoutes | PageRoutes | LayoutRoutes | RedirectRoutes | RewriteRoutes\\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 const allRoutes = {\n ...routesManifest.appRoutes,\n ...routesManifest.pageRoutes,\n ...routesManifest.redirectRoutes,\n ...routesManifest.rewriteRoutes,\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 Object.keys(allRoutes)) {\n const { isDynamic, routeType } = formatRouteToRouteType(route)\n if (isDynamic) {\n dynamicRouteTypes.push(routeType)\n } else {\n staticRouteTypes.push(routeType)\n }\n }\n\n const serializedStaticRouteTypes = serializeRouteTypes(staticRouteTypes)\n const serializedDynamicRouteTypes = serializeRouteTypes(dynamicRouteTypes)\n\n // If both StaticRoutes and DynamicRoutes are empty, fallback to type 'string & {}'.\n const routeTypesFallback =\n !serializedStaticRouteTypes && !serializedDynamicRouteTypes\n ? 'string & {}'\n : ''\n\n return `// This file is generated automatically by Next.js\n// Do not edit this file manually\n\n// Type definitions for Next.js routes\n\n/**\n * Internal types used by the Next.js router and Link component.\n * These types are not meant to be used directly.\n * @internal\n */\ndeclare namespace __next_route_internal_types__ {\n type SearchOrHash = \\`?\\${string}\\` | \\`#\\${string}\\`\n type WithProtocol = \\`\\${string}:\\${string}\\`\n\n type Suffix = '' | SearchOrHash\n\n type SafeSlug<S extends string> = S extends \\`\\${string}/\\${string}\\`\n ? never\n : S extends \\`\\${string}\\${SearchOrHash}\\`\n ? never\n : S extends ''\n ? never\n : S\n\n type CatchAllSlug<S extends string> = S extends \\`\\${string}\\${SearchOrHash}\\`\n ? never\n : S extends ''\n ? never\n : S\n\n type OptionalCatchAllSlug<S extends string> =\n S extends \\`\\${string}\\${SearchOrHash}\\` ? never : S\n\n type StaticRoutes = ${serializedStaticRouteTypes || 'never'}\n type DynamicRoutes<T extends string = string> = ${\n serializedDynamicRouteTypes || 'never'\n }\n\n type RouteImpl<T> = ${\n routeTypesFallback ||\n `\n ${\n // This keeps autocompletion working for static routes.\n '| StaticRoutes'\n }\n | SearchOrHash\n | WithProtocol\n | \\`\\${StaticRoutes}\\${SearchOrHash}\\`\n | (T extends \\`\\${DynamicRoutes<infer _>}\\${Suffix}\\` ? T : never)\n `\n }\n}\n\ndeclare module 'next' {\n export { default } from 'next/types.js'\n export * from 'next/types.js'\n\n export type Route<T extends string = string> =\n __next_route_internal_types__.RouteImpl<T>\n}\n\ndeclare module 'next/link' {\n import type { LinkProps as OriginalLinkProps } from 'next/dist/client/link.js'\n import type { AnchorHTMLAttributes, DetailedHTMLProps } from 'react'\n import type { UrlObject } from 'url'\n\n type LinkRestProps = Omit<\n Omit<\n DetailedHTMLProps<\n AnchorHTMLAttributes<HTMLAnchorElement>,\n HTMLAnchorElement\n >,\n keyof OriginalLinkProps\n > &\n OriginalLinkProps,\n 'href'\n >\n\n export type LinkProps<RouteInferType> = LinkRestProps & {\n /**\n * The path or URL to navigate to. This is the only required prop. It can also be an object.\n * @see https://nextjs.org/docs/api-reference/next/link\n */\n href: __next_route_internal_types__.RouteImpl<RouteInferType> | UrlObject\n }\n\n export default function Link<RouteType>(props: LinkProps<RouteType>): JSX.Element\n}\n\ndeclare module 'next/navigation' {\n export * from 'next/dist/client/components/navigation.js'\n\n import type { NavigateOptions, AppRouterInstance as OriginalAppRouterInstance } from 'next/dist/shared/lib/app-router-context.shared-runtime.js'\n 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\ndeclare module 'next/form' {\n import type { FormProps as OriginalFormProps } from 'next/dist/client/form.js'\n\n type FormRestProps = Omit<OriginalFormProps, 'action'>\n\n export type FormProps<RouteInferType> = {\n /**\n * \\`action\\` can be either a \\`string\\` or a function.\n * - If \\`action\\` is a string, it will be interpreted as a path or URL to navigate to when the form is submitted.\n * The path will be prefetched when the form becomes visible.\n * - If \\`action\\` is a function, it will be called when the form is submitted. See the [React docs](https://react.dev/reference/react-dom/components/form#props) for more.\n */\n action: __next_route_internal_types__.RouteImpl<RouteInferType> | ((formData: FormData) => void)\n } & FormRestProps\n\n export default function Form<RouteType>(props: FormProps<RouteType>): JSX.Element\n}\n`\n}\n\nexport function generateValidatorFile(\n routesManifest: RouteTypesManifest\n): string {\n const generateValidations = (\n paths: string[],\n type:\n | 'AppPageConfig'\n | 'PagesPageConfig'\n | 'LayoutConfig'\n | 'RouteHandlerConfig'\n | 'ApiRouteConfig',\n pathToRouteMap?: Map<string, string>\n ) =>\n paths\n .sort()\n // Only validate TypeScript files - JavaScript files have too many type inference limitations\n .filter(\n (filePath) => filePath.endsWith('.ts') || filePath.endsWith('.tsx')\n )\n .filter(\n // Don't include metadata routes or pages\n // (e.g. /manifest.webmanifest)\n (filePath) =>\n type !== 'AppPageConfig' ||\n filePath.endsWith('page.ts') ||\n filePath.endsWith('page.tsx')\n )\n .map((filePath) => {\n // Keep the file extension for TypeScript imports to support node16 module resolution\n const importPath = filePath\n const route = pathToRouteMap?.get(filePath)\n const typeWithRoute =\n route &&\n (type === 'AppPageConfig' ||\n type === 'LayoutConfig' ||\n type === 'RouteHandlerConfig')\n ? `${type}<${JSON.stringify(route)}>`\n : type\n return `// Validate ${filePath}\n{\n const handler = {} as typeof import(${JSON.stringify(importPath)})\n handler satisfies ${typeWithRoute}\n}`\n })\n .join('\\n\\n')\n\n // Use direct mappings from the manifest\n\n // Generate validations for different route types\n const appPageValidations = generateValidations(\n Array.from(routesManifest.appPagePaths).sort(),\n 'AppPageConfig',\n routesManifest.filePathToRoute\n )\n const appRouteHandlerValidations = generateValidations(\n Array.from(routesManifest.appRouteHandlers).sort(),\n 'RouteHandlerConfig',\n routesManifest.filePathToRoute\n )\n const pagesRouterPageValidations = generateValidations(\n Array.from(routesManifest.pagesRouterPagePaths).sort(),\n 'PagesPageConfig'\n )\n const pagesApiRouteValidations = generateValidations(\n Array.from(routesManifest.pageApiRoutes).sort(),\n 'ApiRouteConfig'\n )\n const layoutValidations = generateValidations(\n Array.from(routesManifest.layoutPaths).sort(),\n 'LayoutConfig',\n routesManifest.filePathToRoute\n )\n\n 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\nimport type { AppRoutes, AppRouteHandlerRoutes, LayoutRoutes, ParamMap } from \"./routes.js\"\nimport type { ResolvingMetadata, ResolvingViewport } from \"next/dist/lib/metadata/types/metadata-interface.js\"\nimport type { NextRequest } from 'next/server.js'\n\ntype 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\ntype 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'\n maxDuration?: number\n runtime?: 'edge' | 'experimental-edge' | 'nodejs' | string // necessary unless config is exported as const\n regions?: string[]\n }\n}\n\ntype 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\ntype RouteHandlerConfig<Route extends AppRouteHandlerRoutes = AppRouteHandlerRoutes> = {\n GET?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response> | Response | Promise<void> | void\n POST?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response> | Response | Promise<void> | void\n PUT?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response> | Response | Promise<void> | void\n PATCH?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response> | Response | Promise<void> | void\n DELETE?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response> | Response | Promise<void> | void\n HEAD?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response> | Response | Promise<void> | void\n OPTIONS?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response> | Response | Promise<void> | void\n}\n\ntype ApiRouteConfig = {\n default: (req: any, res: any) => Promise<void> | void | Promise<Response> | Response\n config?: {\n api?: {\n bodyParser?: boolean | { sizeLimit?: string }\n responseLimit?: string | number\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${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 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\nexport type { AppRoutes, AppRouteHandlerRoutes, PageRoutes, LayoutRoutes, RedirectRoutes, RewriteRoutes, ParamMap }\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 }\n}\n`\n}\n"],"names":["generateLinkTypesFile","generateRouteTypesFile","generateValidatorFile","generateRouteTypes","routesManifest","appRoutes","Object","keys","sort","pageRoutes","layoutRoutes","redirectRoutes","rewriteRoutes","result","length","map","route","JSON","stringify","join","appRouteHandlerRoutes","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","staticRouteTypes","dynamicRouteTypes","push","serializedStaticRouteTypes","serializedDynamicRouteTypes","routeTypesFallback","generateValidations","paths","type","pathToRouteMap","filter","filePath","importPath","get","typeWithRoute","appPageValidations","Array","from","appPagePaths","filePathToRoute","appRouteHandlerValidations","appRouteHandlers","pagesRouterPageValidations","pagesRouterPagePaths","pagesApiRouteValidations","pageApiRoutes","layoutValidations","layoutPaths","layoutSlotMap"],"mappings":";;;;;;;;;;;;;;;;IA4LgBA,qBAAqB;eAArBA;;IA0UAC,sBAAsB;eAAtBA;;IApKAC,qBAAqB;eAArBA;;;2BAjWe;AAE/B,SAASC,mBAAmBC,cAAkC;IAC5D,MAAMC,YAAYC,OAAOC,IAAI,CAACH,eAAeC,SAAS,EAAEG,IAAI;IAC5D,MAAMC,aAAaH,OAAOC,IAAI,CAACH,eAAeK,UAAU,EAAED,IAAI;IAC9D,MAAME,eAAeJ,OAAOC,IAAI,CAACH,eAAeM,YAAY,EAAEF,IAAI;IAClE,MAAMG,iBAAiBL,OAAOC,IAAI,CAACH,eAAeO,cAAc,EAAEH,IAAI;IACtE,MAAMI,gBAAgBN,OAAOC,IAAI,CAACH,eAAeQ,aAAa,EAAEJ,IAAI;IAEpE,IAAIK,SAAS;IAEb,6CAA6C;IAC7C,IAAIR,UAAUS,MAAM,GAAG,GAAG;QACxBD,UAAU,CAAC,iBAAiB,EAAER,UAAUU,GAAG,CAAC,CAACC,QAAUC,KAAKC,SAAS,CAACF,QAAQG,IAAI,CAAC,OAAO,EAAE,CAAC;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B,oBACxBU,MAAMC,IAAI,CAACjE,eAAe2E,WAAW,EAAEvE,IAAI,IAC3C,gBACAJ,eAAemE,eAAe;IAGhC,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+EV,EAAEJ,mBAAmB;;AAErB,EAAEK,2BAA2B;;AAE7B,EAAEE,2BAA2B;;AAE7B,EAAEE,yBAAyB;;AAE3B,EAAEE,kBAAkB;AACpB,CAAC;AACD;AAEO,SAAS7E,uBACdG,cAAkC;IAElC,MAAM+C,aAAahD,mBAAmBC;IACtC,MAAMmB,aAAaF,mBAAmBjB;IACtC,MAAM4E,gBAAgB1C,sBAAsBlC;IAE5C,OAAO,CAAC;;;AAGV,EAAE+C,WAAW;;AAEb,EAAE5B,WAAW;;;;AAIb,EAAEyD,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoChB,CAAC;AACD","ignoreList":[0]}
1
+ {"version":3,"sources":["../../../../src/server/lib/router-utils/typegen.ts"],"sourcesContent":["import type { RouteTypesManifest } from './route-types-utils'\nimport { isDynamicRoute } from '../../../shared/lib/router/utils/is-dynamic'\n\nfunction generateRouteTypes(routesManifest: RouteTypesManifest): string {\n const appRoutes = Object.keys(routesManifest.appRoutes).sort()\n const pageRoutes = Object.keys(routesManifest.pageRoutes).sort()\n const layoutRoutes = Object.keys(routesManifest.layoutRoutes).sort()\n const redirectRoutes = Object.keys(routesManifest.redirectRoutes).sort()\n const rewriteRoutes = Object.keys(routesManifest.rewriteRoutes).sort()\n\n let result = ''\n\n // Generate AppRoutes union type (pages only)\n if (appRoutes.length > 0) {\n result += `type AppRoutes = ${appRoutes.map((route) => JSON.stringify(route)).join(' | ')}\\n`\n } else {\n result += 'type AppRoutes = never\\n'\n }\n\n // Generate AppRouteHandlerRoutes union type for route handlers\n const appRouteHandlerRoutes = Object.keys(\n routesManifest.appRouteHandlerRoutes\n ).sort()\n\n if (appRouteHandlerRoutes.length > 0) {\n result += `type AppRouteHandlerRoutes = ${appRouteHandlerRoutes.map((route) => JSON.stringify(route)).join(' | ')}\\n`\n } else {\n result += 'type AppRouteHandlerRoutes = never\\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 result +=\n 'type Routes = AppRoutes | AppRouteHandlerRoutes | PageRoutes | LayoutRoutes | RedirectRoutes | RewriteRoutes\\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 const allRoutes = {\n ...routesManifest.appRoutes,\n ...routesManifest.pageRoutes,\n ...routesManifest.redirectRoutes,\n ...routesManifest.rewriteRoutes,\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 Object.keys(allRoutes)) {\n const { isDynamic, routeType } = formatRouteToRouteType(route)\n if (isDynamic) {\n dynamicRouteTypes.push(routeType)\n } else {\n staticRouteTypes.push(routeType)\n }\n }\n\n const serializedStaticRouteTypes = serializeRouteTypes(staticRouteTypes)\n const serializedDynamicRouteTypes = serializeRouteTypes(dynamicRouteTypes)\n\n // If both StaticRoutes and DynamicRoutes are empty, fallback to type 'string & {}'.\n const routeTypesFallback =\n !serializedStaticRouteTypes && !serializedDynamicRouteTypes\n ? 'string & {}'\n : ''\n\n return `// This file is generated automatically by Next.js\n// Do not edit this file manually\n\n// Type definitions for Next.js routes\n\n/**\n * Internal types used by the Next.js router and Link component.\n * These types are not meant to be used directly.\n * @internal\n */\ndeclare namespace __next_route_internal_types__ {\n type SearchOrHash = \\`?\\${string}\\` | \\`#\\${string}\\`\n type WithProtocol = \\`\\${string}:\\${string}\\`\n\n type Suffix = '' | SearchOrHash\n\n type SafeSlug<S extends string> = S extends \\`\\${string}/\\${string}\\`\n ? never\n : S extends \\`\\${string}\\${SearchOrHash}\\`\n ? never\n : S extends ''\n ? never\n : S\n\n type CatchAllSlug<S extends string> = S extends \\`\\${string}\\${SearchOrHash}\\`\n ? never\n : S extends ''\n ? never\n : S\n\n type OptionalCatchAllSlug<S extends string> =\n S extends \\`\\${string}\\${SearchOrHash}\\` ? never : S\n\n type StaticRoutes = ${serializedStaticRouteTypes || 'never'}\n type DynamicRoutes<T extends string = string> = ${\n serializedDynamicRouteTypes || 'never'\n }\n\n type RouteImpl<T> = ${\n routeTypesFallback ||\n `\n ${\n // This keeps autocompletion working for static routes.\n '| StaticRoutes'\n }\n | SearchOrHash\n | WithProtocol\n | \\`\\${StaticRoutes}\\${SearchOrHash}\\`\n | (T extends \\`\\${DynamicRoutes<infer _>}\\${Suffix}\\` ? T : never)\n `\n }\n}\n\ndeclare module 'next' {\n export { default } from 'next/types.js'\n export * from 'next/types.js'\n\n export type Route<T extends string = string> =\n __next_route_internal_types__.RouteImpl<T>\n}\n\ndeclare module 'next/link' {\n import type { LinkProps as OriginalLinkProps } from 'next/dist/client/link.js'\n import type { AnchorHTMLAttributes, DetailedHTMLProps } from 'react'\n import type { UrlObject } from 'url'\n\n type LinkRestProps = Omit<\n Omit<\n DetailedHTMLProps<\n AnchorHTMLAttributes<HTMLAnchorElement>,\n HTMLAnchorElement\n >,\n keyof OriginalLinkProps\n > &\n OriginalLinkProps,\n 'href'\n >\n\n export type LinkProps<RouteInferType> = LinkRestProps & {\n /**\n * The path or URL to navigate to. This is the only required prop. It can also be an object.\n * @see https://nextjs.org/docs/api-reference/next/link\n */\n href: __next_route_internal_types__.RouteImpl<RouteInferType> | UrlObject\n }\n\n export default function Link<RouteType>(props: LinkProps<RouteType>): JSX.Element\n}\n\ndeclare module 'next/navigation' {\n export * from 'next/dist/client/components/navigation.js'\n\n import type { NavigateOptions, AppRouterInstance as OriginalAppRouterInstance } from 'next/dist/shared/lib/app-router-context.shared-runtime.js'\n 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\ndeclare module 'next/form' {\n import type { FormProps as OriginalFormProps } from 'next/dist/client/form.js'\n\n type FormRestProps = Omit<OriginalFormProps, 'action'>\n\n export type FormProps<RouteInferType> = {\n /**\n * \\`action\\` can be either a \\`string\\` or a function.\n * - If \\`action\\` is a string, it will be interpreted as a path or URL to navigate to when the form is submitted.\n * The path will be prefetched when the form becomes visible.\n * - If \\`action\\` is a function, it will be called when the form is submitted. See the [React docs](https://react.dev/reference/react-dom/components/form#props) for more.\n */\n action: __next_route_internal_types__.RouteImpl<RouteInferType> | ((formData: FormData) => void)\n } & FormRestProps\n\n export default function Form<RouteType>(props: FormProps<RouteType>): JSX.Element\n}\n`\n}\n\nexport function generateValidatorFile(\n routesManifest: RouteTypesManifest\n): string {\n const generateValidations = (\n paths: string[],\n type:\n | 'AppPageConfig'\n | 'PagesPageConfig'\n | 'LayoutConfig'\n | 'RouteHandlerConfig'\n | 'ApiRouteConfig',\n pathToRouteMap?: Map<string, string>\n ) =>\n paths\n .sort()\n // Only validate TypeScript files - JavaScript files have too many type inference limitations\n .filter(\n (filePath) => filePath.endsWith('.ts') || filePath.endsWith('.tsx')\n )\n .filter(\n // Don't include metadata routes or pages\n // (e.g. /manifest.webmanifest)\n (filePath) =>\n type !== 'AppPageConfig' ||\n filePath.endsWith('page.ts') ||\n filePath.endsWith('page.tsx')\n )\n .map((filePath) => {\n // Keep the file extension for TypeScript imports to support node16 module resolution\n const importPath = filePath\n const route = pathToRouteMap?.get(filePath)\n const typeWithRoute =\n route &&\n (type === 'AppPageConfig' ||\n type === 'LayoutConfig' ||\n type === 'RouteHandlerConfig')\n ? `${type}<${JSON.stringify(route)}>`\n : type\n return `// Validate ${filePath}\n{\n const handler = {} as typeof import(${JSON.stringify(\n importPath.replace(/\\.tsx?$/, '.js')\n )})\n handler satisfies ${typeWithRoute}\n}`\n })\n .join('\\n\\n')\n\n // Use direct mappings from the manifest\n\n // Generate validations for different route types\n const appPageValidations = generateValidations(\n Array.from(routesManifest.appPagePaths).sort(),\n 'AppPageConfig',\n routesManifest.filePathToRoute\n )\n const appRouteHandlerValidations = generateValidations(\n Array.from(routesManifest.appRouteHandlers).sort(),\n 'RouteHandlerConfig',\n routesManifest.filePathToRoute\n )\n const pagesRouterPageValidations = generateValidations(\n Array.from(routesManifest.pagesRouterPagePaths).sort(),\n 'PagesPageConfig'\n )\n const pagesApiRouteValidations = generateValidations(\n Array.from(routesManifest.pageApiRoutes).sort(),\n 'ApiRouteConfig'\n )\n const layoutValidations = generateValidations(\n Array.from(routesManifest.layoutPaths).sort(),\n 'LayoutConfig',\n routesManifest.filePathToRoute\n )\n\n 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\nimport type { AppRoutes, AppRouteHandlerRoutes, LayoutRoutes, ParamMap } from \"./routes.js\"\nimport type { ResolvingMetadata, ResolvingViewport } from \"next/dist/lib/metadata/types/metadata-interface.js\"\nimport type { NextRequest } from 'next/server.js'\n\ntype 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\ntype 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'\n maxDuration?: number\n runtime?: 'edge' | 'experimental-edge' | 'nodejs' | string // necessary unless config is exported as const\n regions?: string[]\n }\n}\n\ntype 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\ntype RouteHandlerConfig<Route extends AppRouteHandlerRoutes = AppRouteHandlerRoutes> = {\n GET?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response> | Response | Promise<void> | void\n POST?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response> | Response | Promise<void> | void\n PUT?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response> | Response | Promise<void> | void\n PATCH?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response> | Response | Promise<void> | void\n DELETE?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response> | Response | Promise<void> | void\n HEAD?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response> | Response | Promise<void> | void\n OPTIONS?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response> | Response | Promise<void> | void\n}\n\ntype ApiRouteConfig = {\n default: (req: any, res: any) => Promise<void> | void | Promise<Response> | Response\n config?: {\n api?: {\n bodyParser?: boolean | { sizeLimit?: string }\n responseLimit?: string | number\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${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 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\nexport type { AppRoutes, AppRouteHandlerRoutes, PageRoutes, LayoutRoutes, RedirectRoutes, RewriteRoutes, ParamMap }\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 }\n}\n`\n}\n"],"names":["generateLinkTypesFile","generateRouteTypesFile","generateValidatorFile","generateRouteTypes","routesManifest","appRoutes","Object","keys","sort","pageRoutes","layoutRoutes","redirectRoutes","rewriteRoutes","result","length","map","route","JSON","stringify","join","appRouteHandlerRoutes","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","staticRouteTypes","dynamicRouteTypes","push","serializedStaticRouteTypes","serializedDynamicRouteTypes","routeTypesFallback","generateValidations","paths","type","pathToRouteMap","filter","filePath","importPath","get","typeWithRoute","replace","appPageValidations","Array","from","appPagePaths","filePathToRoute","appRouteHandlerValidations","appRouteHandlers","pagesRouterPageValidations","pagesRouterPagePaths","pagesApiRouteValidations","pageApiRoutes","layoutValidations","layoutPaths","layoutSlotMap"],"mappings":";;;;;;;;;;;;;;;;IA4LgBA,qBAAqB;eAArBA;;IA4UAC,sBAAsB;eAAtBA;;IAtKAC,qBAAqB;eAArBA;;;2BAjWe;AAE/B,SAASC,mBAAmBC,cAAkC;IAC5D,MAAMC,YAAYC,OAAOC,IAAI,CAACH,eAAeC,SAAS,EAAEG,IAAI;IAC5D,MAAMC,aAAaH,OAAOC,IAAI,CAACH,eAAeK,UAAU,EAAED,IAAI;IAC9D,MAAME,eAAeJ,OAAOC,IAAI,CAACH,eAAeM,YAAY,EAAEF,IAAI;IAClE,MAAMG,iBAAiBL,OAAOC,IAAI,CAACH,eAAeO,cAAc,EAAEH,IAAI;IACtE,MAAMI,gBAAgBN,OAAOC,IAAI,CAACH,eAAeQ,aAAa,EAAEJ,IAAI;IAEpE,IAAIK,SAAS;IAEb,6CAA6C;IAC7C,IAAIR,UAAUS,MAAM,GAAG,GAAG;QACxBD,UAAU,CAAC,iBAAiB,EAAER,UAAUU,GAAG,CAAC,CAACC,QAAUC,KAAKC,SAAS,CAACF,QAAQG,IAAI,CAAC,OAAO,EAAE,CAAC;IAC/F,OAAO;QACLN,UAAU;IACZ;IAEA,+DAA+D;IAC/D,MAAMO,wBAAwBd,OAAOC,IAAI,CACvCH,eAAegB,qBA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AeoE,eAAe;IAGhC,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+EV,EAAEJ,mBAAmB;;AAErB,EAAEK,2BAA2B;;AAE7B,EAAEE,2BAA2B;;AAE7B,EAAEE,yBAAyB;;AAE3B,EAAEE,kBAAkB;AACpB,CAAC;AACD;AAEO,SAAS9E,uBACdG,cAAkC;IAElC,MAAM+C,aAAahD,mBAAmBC;IACtC,MAAMmB,aAAaF,mBAAmBjB;IACtC,MAAM6E,gBAAgB3C,sBAAsBlC;IAE5C,OAAO,CAAC;;;AAGV,EAAE+C,WAAW;;AAEb,EAAE5B,WAAW;;;;AAIb,EAAE0D,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoChB,CAAC;AACD","ignoreList":[0]}
@@ -179,7 +179,7 @@ async function getRequestHandlers({ dir, port, isDev, onDevServerCleanup, server
179
179
  async function startServer(serverOptions) {
180
180
  const { dir, isDev, hostname, minimalMode, allowRetry, keepAliveTimeout, selfSignedCertificate } = serverOptions;
181
181
  let { port } = serverOptions;
182
- process.title = `next-server (v${"15.4.2-canary.47"})`;
182
+ process.title = `next-server (v${"15.4.2-canary.48"})`;
183
183
  let handlersReady = ()=>{};
184
184
  let handlersError = ()=>{};
185
185
  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.4.2-canary.47") == null ? void 0 : _process_env___NEXT_VERSION.includes('canary')) && !process.env.__NEXT_TEST_MODE && !process.env.NEXT_PRIVATE_LOCAL_DEV;
25
+ return !((_process_env___NEXT_VERSION = "15.4.2-canary.48") == 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){
@@ -81,7 +81,7 @@ function getAnonymousMeta() {
81
81
  isWsl: _iswsl.default,
82
82
  isCI: _ciinfo.isCI,
83
83
  ciName: _ciinfo.isCI && _ciinfo.name || null,
84
- nextVersion: "15.4.2-canary.47"
84
+ nextVersion: "15.4.2-canary.48"
85
85
  };
86
86
  return traits;
87
87
  }
@@ -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.4.2-canary.47" !== 'string') {
14
+ if (typeof "15.4.2-canary.48" !== 'string') {
15
15
  return [];
16
16
  }
17
17
  const payload = {
18
- nextVersion: "15.4.2-canary.47",
18
+ nextVersion: "15.4.2-canary.48",
19
19
  nodeVersion: process.version,
20
20
  cliCommand: event.cliCommand,
21
21
  durationMilliseconds: event.durationMilliseconds,
@@ -36,12 +36,12 @@ function hasBabelConfig(dir) {
36
36
  function eventCliSession(dir, nextConfig, event) {
37
37
  var _nextConfig_experimental_staleTimes, _nextConfig_experimental_staleTimes1, _nextConfig_experimental_reactCompiler, _nextConfig_experimental_reactCompiler1;
38
38
  // This should be an invariant, if it fails our build tooling is broken.
39
- if (typeof "15.4.2-canary.47" !== 'string') {
39
+ if (typeof "15.4.2-canary.48" !== 'string') {
40
40
  return [];
41
41
  }
42
42
  const { images, i18n } = nextConfig || {};
43
43
  const payload = {
44
- nextVersion: "15.4.2-canary.47",
44
+ nextVersion: "15.4.2-canary.48",
45
45
  nodeVersion: process.version,
46
46
  cliCommand: event.cliCommand,
47
47
  isSrcDir: event.isSrcDir,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next",
3
- "version": "15.4.2-canary.47",
3
+ "version": "15.4.2-canary.48",
4
4
  "description": "The React Framework",
5
5
  "main": "./dist/server/next.js",
6
6
  "license": "MIT",
@@ -102,7 +102,7 @@
102
102
  ]
103
103
  },
104
104
  "dependencies": {
105
- "@next/env": "15.4.2-canary.47",
105
+ "@next/env": "15.4.2-canary.48",
106
106
  "@swc/helpers": "0.5.15",
107
107
  "caniuse-lite": "^1.0.30001579",
108
108
  "postcss": "8.4.31",
@@ -132,14 +132,14 @@
132
132
  },
133
133
  "optionalDependencies": {
134
134
  "sharp": "^0.34.3",
135
- "@next/swc-darwin-arm64": "15.4.2-canary.47",
136
- "@next/swc-darwin-x64": "15.4.2-canary.47",
137
- "@next/swc-linux-arm64-gnu": "15.4.2-canary.47",
138
- "@next/swc-linux-arm64-musl": "15.4.2-canary.47",
139
- "@next/swc-linux-x64-gnu": "15.4.2-canary.47",
140
- "@next/swc-linux-x64-musl": "15.4.2-canary.47",
141
- "@next/swc-win32-arm64-msvc": "15.4.2-canary.47",
142
- "@next/swc-win32-x64-msvc": "15.4.2-canary.47"
135
+ "@next/swc-darwin-arm64": "15.4.2-canary.48",
136
+ "@next/swc-darwin-x64": "15.4.2-canary.48",
137
+ "@next/swc-linux-arm64-gnu": "15.4.2-canary.48",
138
+ "@next/swc-linux-arm64-musl": "15.4.2-canary.48",
139
+ "@next/swc-linux-x64-gnu": "15.4.2-canary.48",
140
+ "@next/swc-linux-x64-musl": "15.4.2-canary.48",
141
+ "@next/swc-win32-arm64-msvc": "15.4.2-canary.48",
142
+ "@next/swc-win32-x64-msvc": "15.4.2-canary.48"
143
143
  },
144
144
  "devDependencies": {
145
145
  "@ampproject/toolbox-optimizer": "2.8.3",
@@ -174,11 +174,11 @@
174
174
  "@jest/types": "29.5.0",
175
175
  "@mswjs/interceptors": "0.23.0",
176
176
  "@napi-rs/triples": "1.2.0",
177
- "@next/font": "15.4.2-canary.47",
178
- "@next/polyfill-module": "15.4.2-canary.47",
179
- "@next/polyfill-nomodule": "15.4.2-canary.47",
180
- "@next/react-refresh-utils": "15.4.2-canary.47",
181
- "@next/swc": "15.4.2-canary.47",
177
+ "@next/font": "15.4.2-canary.48",
178
+ "@next/polyfill-module": "15.4.2-canary.48",
179
+ "@next/polyfill-nomodule": "15.4.2-canary.48",
180
+ "@next/react-refresh-utils": "15.4.2-canary.48",
181
+ "@next/swc": "15.4.2-canary.48",
182
182
  "@opentelemetry/api": "1.6.0",
183
183
  "@playwright/test": "1.51.1",
184
184
  "@rspack/core": "1.4.5",