@openuiai/next 15.6.0-bun.26 → 15.6.0-bun.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/bin/next +1 -1
  2. package/dist/build/index.js +3 -3
  3. package/dist/build/swc/index.js +1 -1
  4. package/dist/build/webpack/plugins/next-types-plugin/index.js +22 -20
  5. package/dist/build/webpack/plugins/next-types-plugin/index.js.map +1 -1
  6. package/dist/build/webpack-config.js +2 -2
  7. package/dist/client/app-bootstrap.js +1 -1
  8. package/dist/client/index.js +1 -1
  9. package/dist/compiled/next-server/pages-api-turbo.runtime.prod.js +1 -1
  10. package/dist/compiled/next-server/pages-api-turbo.runtime.prod.js.map +1 -1
  11. package/dist/compiled/next-server/pages-api.runtime.dev.js +1 -1
  12. package/dist/compiled/next-server/pages-api.runtime.dev.js.map +1 -1
  13. package/dist/compiled/next-server/pages-turbo.runtime.prod.js +1 -1
  14. package/dist/compiled/next-server/pages-turbo.runtime.prod.js.map +1 -1
  15. package/dist/compiled/next-server/pages.runtime.dev.js +1 -1
  16. package/dist/compiled/next-server/pages.runtime.dev.js.map +1 -1
  17. package/dist/esm/build/index.js +3 -3
  18. package/dist/esm/build/swc/index.js +1 -1
  19. package/dist/esm/build/webpack/plugins/next-types-plugin/index.js +22 -20
  20. package/dist/esm/build/webpack/plugins/next-types-plugin/index.js.map +1 -1
  21. package/dist/esm/build/webpack-config.js +2 -2
  22. package/dist/esm/client/app-bootstrap.js +1 -1
  23. package/dist/esm/client/index.js +1 -1
  24. package/dist/esm/lib/typescript/writeConfigurationDefaults.js +5 -0
  25. package/dist/esm/lib/typescript/writeConfigurationDefaults.js.map +1 -1
  26. package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
  27. package/dist/esm/server/lib/app-info-log.js +1 -1
  28. package/dist/esm/server/lib/start-server.js +1 -1
  29. package/dist/esm/shared/lib/canary-only.js +1 -1
  30. package/dist/lib/typescript/writeConfigurationDefaults.js +5 -0
  31. package/dist/lib/typescript/writeConfigurationDefaults.js.map +1 -1
  32. package/dist/server/dev/hot-reloader-webpack.js +1 -1
  33. package/dist/server/lib/app-info-log.js +1 -1
  34. package/dist/server/lib/start-server.js +1 -1
  35. package/dist/shared/lib/canary-only.js +1 -1
  36. package/dist/telemetry/anonymous-meta.js +1 -1
  37. package/dist/telemetry/events/session-stopped.js +2 -2
  38. package/dist/telemetry/events/version.js +2 -2
  39. package/package.json +1 -1
package/dist/bin/next CHANGED
@@ -79,7 +79,7 @@ const program = new NextRootCommand();
79
79
  program.name('next').description('The Next.js CLI allows you to develop, build, start your application, and more.').configureHelp({
80
80
  formatHelp: (cmd, helper)=>(0, _formatclihelpoutput.formatCliHelpOutput)(cmd, helper),
81
81
  subcommandTerm: (cmd)=>`${cmd.name()} ${cmd.usage()}`
82
- }).helpCommand(false).helpOption('-h, --help', 'Displays this message.').version(`Next.js v${"15.6.0-bun.25"}`, '-v, --version', 'Outputs the Next.js version.');
82
+ }).helpCommand(false).helpOption('-h, --help', 'Displays this message.').version(`Next.js v${"15.6.0-bun.27"}`, '-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',
@@ -369,7 +369,7 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
369
369
  const nextBuildSpan = (0, _trace.trace)('next-build', undefined, {
370
370
  buildMode: experimentalBuildMode,
371
371
  isTurboBuild: String(isTurbopack),
372
- version: "15.6.0-bun.25"
372
+ version: "15.6.0-bun.27"
373
373
  });
374
374
  _buildcontext.NextBuildContext.nextBuildSpan = nextBuildSpan;
375
375
  _buildcontext.NextBuildContext.dir = dir;
@@ -848,7 +848,7 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
848
848
  // Files outside of the distDir can be "type": "module"
849
849
  await writeFileUtf8(_path.default.join(distDir, 'package.json'), '{"type": "commonjs"}');
850
850
  // These are written to distDir, so they need to come after creating and cleaning distDr.
851
- await (0, _builddiagnostics.recordFrameworkVersion)("15.6.0-bun.25");
851
+ await (0, _builddiagnostics.recordFrameworkVersion)("15.6.0-bun.27");
852
852
  await (0, _builddiagnostics.updateBuildDiagnostics)({
853
853
  buildStage: 'start'
854
854
  });
@@ -2493,7 +2493,7 @@ async function build(dir, reactProductionProfiling = false, debugOutput = false,
2493
2493
  distDir,
2494
2494
  config,
2495
2495
  staticPages,
2496
- nextVersion: "15.6.0-bun.25",
2496
+ nextVersion: "15.6.0-bun.27",
2497
2497
  tracingRoot: outputFileTracingRoot,
2498
2498
  hasNodeMiddleware,
2499
2499
  hasInstrumentationHook,
@@ -131,7 +131,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
131
131
  }
132
132
  return newObj;
133
133
  }
134
- const nextVersion = "15.6.0-bun.25";
134
+ const nextVersion = "15.6.0-bun.27";
135
135
  const ArchName = (0, _os.arch)();
136
136
  const PlatformName = (0, _os.platform)();
137
137
  function infoLog(...args) {
@@ -25,11 +25,13 @@ function _interop_require_default(obj) {
25
25
  default: obj
26
26
  };
27
27
  }
28
+ // Read package name dynamically to support forked packages
29
+ const PKG_NAME = require('../../../../../package.json').name;
28
30
  const PLUGIN_NAME = 'NextTypesPlugin';
29
31
  function createTypeGuardFile(fullPath, relativePath, options) {
30
32
  return `// File: ${fullPath}
31
33
  import * as entry from '${relativePath}.js'
32
- ${options.type === 'route' ? `import type { NextRequest } from 'next/server.js'` : `import type { ResolvingMetadata, ResolvingViewport } from 'next/dist/lib/metadata/types/metadata-interface.js'`}
34
+ ${options.type === 'route' ? `import type { NextRequest } from '${PKG_NAME}/server.js'` : `import type { ResolvingMetadata, ResolvingViewport } from '${PKG_NAME}/dist/lib/metadata/types/metadata-interface.js'`}
33
35
 
34
36
  type TEntry = typeof import('${relativePath}.js')
35
37
 
@@ -315,25 +317,25 @@ function isSubpath(parentLayoutPath, potentialChildLayoutPath) {
315
317
  }
316
318
  function createServerDefinitions(rootParams) {
317
319
  return `
318
- declare module 'next/server' {
320
+ declare module '${PKG_NAME}/server' {
319
321
 
320
322
  import type { AsyncLocalStorage as NodeAsyncLocalStorage } from 'async_hooks'
321
323
  declare global {
322
324
  var AsyncLocalStorage: typeof NodeAsyncLocalStorage
323
325
  }
324
- export { NextFetchEvent } from 'next/dist/server/web/spec-extension/fetch-event'
325
- export { NextRequest } from 'next/dist/server/web/spec-extension/request'
326
- export { NextResponse } from 'next/dist/server/web/spec-extension/response'
327
- export { NextMiddleware, MiddlewareConfig } from 'next/dist/server/web/types'
328
- export { userAgentFromString } from 'next/dist/server/web/spec-extension/user-agent'
329
- export { userAgent } from 'next/dist/server/web/spec-extension/user-agent'
330
- export { URLPattern } from 'next/dist/compiled/@edge-runtime/primitives/url'
331
- export { ImageResponse } from 'next/dist/server/web/spec-extension/image-response'
332
- export type { ImageResponseOptions } from 'next/dist/compiled/@vercel/og/types'
333
- export { after } from 'next/dist/server/after'
334
- export { connection } from 'next/dist/server/request/connection'
335
- export type { UnsafeUnwrappedSearchParams } from 'next/dist/server/request/search-params'
336
- export type { UnsafeUnwrappedParams } from 'next/dist/server/request/params'
326
+ export { NextFetchEvent } from '${PKG_NAME}/dist/server/web/spec-extension/fetch-event'
327
+ export { NextRequest } from '${PKG_NAME}/dist/server/web/spec-extension/request'
328
+ export { NextResponse } from '${PKG_NAME}/dist/server/web/spec-extension/response'
329
+ export { NextMiddleware, MiddlewareConfig } from '${PKG_NAME}/dist/server/web/types'
330
+ export { userAgentFromString } from '${PKG_NAME}/dist/server/web/spec-extension/user-agent'
331
+ export { userAgent } from '${PKG_NAME}/dist/server/web/spec-extension/user-agent'
332
+ export { URLPattern } from '${PKG_NAME}/dist/compiled/@edge-runtime/primitives/url'
333
+ export { ImageResponse } from '${PKG_NAME}/dist/server/web/spec-extension/image-response'
334
+ export type { ImageResponseOptions } from '${PKG_NAME}/dist/compiled/@vercel/og/types'
335
+ export { after } from '${PKG_NAME}/dist/server/after'
336
+ export { connection } from '${PKG_NAME}/dist/server/request/connection'
337
+ export type { UnsafeUnwrappedSearchParams } from '${PKG_NAME}/dist/server/request/search-params'
338
+ export type { UnsafeUnwrappedParams } from '${PKG_NAME}/dist/server/request/params'
337
339
  export function unstable_rootParams(): Promise<{ ${rootParams.map(({ param, optional })=>// ensure params with dashes are valid keys
338
340
  `${param.includes('-') ? `'${param}'` : param}${optional ? '?' : ''}: string`).join(', ')} }>
339
341
  }
@@ -427,19 +429,19 @@ function createCustomCacheLifeDefinitions(cacheLife) {
427
429
  // Redefine the cacheLife() accepted arguments.
428
430
  return `// Type definitions for Next.js cacheLife configs
429
431
 
430
- declare module 'next/cache' {
431
- export { unstable_cache } from 'next/dist/server/web/spec-extension/unstable-cache'
432
+ declare module '${PKG_NAME}/cache' {
433
+ export { unstable_cache } from '${PKG_NAME}/dist/server/web/spec-extension/unstable-cache'
432
434
  export {
433
435
  revalidateTag,
434
436
  revalidatePath,
435
437
  unstable_expireTag,
436
438
  unstable_expirePath,
437
- } from 'next/dist/server/web/spec-extension/revalidate'
438
- export { unstable_noStore } from 'next/dist/server/web/spec-extension/unstable-no-store'
439
+ } from '${PKG_NAME}/dist/server/web/spec-extension/revalidate'
440
+ export { unstable_noStore } from '${PKG_NAME}/dist/server/web/spec-extension/unstable-no-store'
439
441
 
440
442
  ${overloads}
441
443
 
442
- export { cacheTag as unstable_cacheTag } from 'next/dist/server/use-cache/cache-tag'
444
+ export { cacheTag as unstable_cacheTag } from '${PKG_NAME}/dist/server/use-cache/cache-tag'
443
445
  }
444
446
  `;
445
447
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/build/webpack/plugins/next-types-plugin/index.ts"],"sourcesContent":["import type { Rewrite, Redirect } from '../../../../lib/load-custom-routes'\n\nimport fs from 'fs/promises'\nimport { webpack, sources } from 'next/dist/compiled/webpack/webpack'\nimport path from 'path'\n\nimport { WEBPACK_LAYERS } from '../../../../lib/constants'\nimport { denormalizePagePath } from '../../../../shared/lib/page-path/denormalize-page-path'\nimport { ensureLeadingSlash } from '../../../../shared/lib/page-path/ensure-leading-slash'\nimport { normalizePathSep } from '../../../../shared/lib/page-path/normalize-path-sep'\nimport { HTTP_METHODS } from '../../../../server/web/http'\nimport { isDynamicRoute } from '../../../../shared/lib/router/utils'\nimport { normalizeAppPath } from '../../../../shared/lib/router/utils/app-paths'\nimport { getPageFromPath } from '../../../entries'\nimport type { PageExtensions } from '../../../page-extensions-type'\nimport { getProxiedPluginState } from '../../../build-context'\nimport type { CacheLife } from '../../../../server/use-cache/cache-life'\n\nconst PLUGIN_NAME = 'NextTypesPlugin'\n\ntype Rewrites = {\n fallback: Rewrite[]\n afterFiles: Rewrite[]\n beforeFiles: Rewrite[]\n}\n\ninterface Options {\n dir: string\n distDir: string\n appDir: string\n dev: boolean\n isEdgeServer: boolean\n pageExtensions: PageExtensions\n cacheLifeConfig: undefined | { [profile: string]: CacheLife }\n originalRewrites: Rewrites | undefined\n originalRedirects: Redirect[] | undefined\n}\n\nfunction createTypeGuardFile(\n fullPath: string,\n relativePath: string,\n options: {\n type: 'layout' | 'page' | 'route'\n slots?: string[]\n }\n) {\n return `// File: ${fullPath}\nimport * as entry from '${relativePath}.js'\n${\n options.type === 'route'\n ? `import type { NextRequest } from 'next/server.js'`\n : `import type { ResolvingMetadata, ResolvingViewport } from 'next/dist/lib/metadata/types/metadata-interface.js'`\n}\n\ntype TEntry = typeof import('${relativePath}.js')\n\ntype SegmentParams<T extends Object = any> = T extends Record<string, any>\n ? { [K in keyof T]: T[K] extends string ? string | string[] | undefined : never }\n : T\n\n// Check that the entry is a valid entry\ncheckFields<Diff<{\n ${\n options.type === 'route'\n ? HTTP_METHODS.map((method) => `${method}?: Function`).join('\\n ')\n : 'default: Function'\n }\n config?: {}\n generateStaticParams?: Function\n unstable_prefetch?: 'unstable_static' | 'unstable_runtime'\n revalidate?: RevalidateRange<TEntry> | false\n dynamic?: 'auto' | 'force-dynamic' | 'error' | 'force-static'\n dynamicParams?: boolean\n fetchCache?: 'auto' | 'force-no-store' | 'only-no-store' | 'default-no-store' | 'default-cache' | 'only-cache' | 'force-cache'\n preferredRegion?: 'auto' | 'global' | 'home' | string | string[]\n runtime?: 'nodejs' | 'experimental-edge' | 'edge'\n maxDuration?: number\n ${\n options.type === 'route'\n ? ''\n : `\n metadata?: any\n generateMetadata?: Function\n viewport?: any\n generateViewport?: Function\n experimental_ppr?: boolean\n `\n }\n}, TEntry, ''>>()\n\n${options.type === 'route' ? `type RouteContext = { params: Promise<SegmentParams> }` : ''}\n${\n options.type === 'route'\n ? HTTP_METHODS.map(\n (method) => `// Check the prop type of the entry function\nif ('${method}' in entry) {\n checkFields<\n Diff<\n ParamCheck<Request | NextRequest>,\n {\n __tag__: '${method}'\n __param_position__: 'first'\n __param_type__: FirstArg<MaybeField<TEntry, '${method}'>>\n },\n '${method}'\n >\n >()\n checkFields<\n Diff<\n ParamCheck<RouteContext>,\n {\n __tag__: '${method}'\n __param_position__: 'second'\n __param_type__: SecondArg<MaybeField<TEntry, '${method}'>>\n },\n '${method}'\n >\n >()\n ${\n ''\n // Adding void to support never return type without explicit return:\n // e.g. notFound() will interrupt the execution but the handler return type is inferred as void.\n // x-ref: https://github.com/microsoft/TypeScript/issues/16608#issuecomment-309327984\n }\n checkFields<\n Diff<\n {\n __tag__: '${method}',\n __return_type__: Response | void | never | Promise<Response | void | never>\n },\n {\n __tag__: '${method}',\n __return_type__: ReturnType<MaybeField<TEntry, '${method}'>>\n },\n '${method}'\n >\n >()\n}\n`\n ).join('')\n : `// Check the prop type of the entry function\ncheckFields<Diff<${\n options.type === 'page' ? 'PageProps' : 'LayoutProps'\n }, FirstArg<TEntry['default']>, 'default'>>()\n\n// Check the arguments and return type of the generateMetadata function\nif ('generateMetadata' in entry) {\n checkFields<Diff<${\n options.type === 'page' ? 'PageProps' : 'LayoutProps'\n }, FirstArg<MaybeField<TEntry, 'generateMetadata'>>, 'generateMetadata'>>()\n checkFields<Diff<ResolvingMetadata, SecondArg<MaybeField<TEntry, 'generateMetadata'>>, 'generateMetadata'>>()\n}\n\n// Check the arguments and return type of the generateViewport function\nif ('generateViewport' in entry) {\n checkFields<Diff<${\n options.type === 'page' ? 'PageProps' : 'LayoutProps'\n }, FirstArg<MaybeField<TEntry, 'generateViewport'>>, 'generateViewport'>>()\n checkFields<Diff<ResolvingViewport, SecondArg<MaybeField<TEntry, 'generateViewport'>>, 'generateViewport'>>()\n}\n`\n}\n// Check the arguments and return type of the generateStaticParams function\nif ('generateStaticParams' in entry) {\n checkFields<Diff<{ params: SegmentParams }, FirstArg<MaybeField<TEntry, 'generateStaticParams'>>, 'generateStaticParams'>>()\n checkFields<Diff<{ __tag__: 'generateStaticParams', __return_type__: any[] | Promise<any[]> }, { __tag__: 'generateStaticParams', __return_type__: ReturnType<MaybeField<TEntry, 'generateStaticParams'>> }>>()\n}\n\nexport interface PageProps {\n params?: Promise<SegmentParams>\n searchParams?: Promise<any>\n}\nexport interface LayoutProps {\n children?: React.ReactNode\n${\n options.slots\n ? options.slots.map((slot) => ` ${slot}: React.ReactNode`).join('\\n')\n : ''\n}\n params?: Promise<SegmentParams>\n}\n\n// =============\n// Utility types\ntype RevalidateRange<T> = T extends { revalidate: any } ? NonNegative<T['revalidate']> : never\n\n// If T is unknown or any, it will be an empty {} type. Otherwise, it will be the same as Omit<T, keyof Base>.\ntype OmitWithTag<T, K extends keyof any, _M> = Omit<T, K>\ntype Diff<Base, T extends Base, Message extends string = ''> = 0 extends (1 & T) ? {} : OmitWithTag<T, keyof Base, Message>\n\ntype FirstArg<T extends Function> = T extends (...args: [infer T, any]) => any ? unknown extends T ? any : T : never\ntype SecondArg<T extends Function> = T extends (...args: [any, infer T]) => any ? unknown extends T ? any : T : never\ntype MaybeField<T, K extends string> = T extends { [k in K]: infer G } ? G extends Function ? G : never : never\n\n${\n options.type === 'route'\n ? `type ParamCheck<T> = {\n __tag__: string\n __param_position__: string\n __param_type__: T\n}`\n : ''\n}\n\nfunction checkFields<_ extends { [k in keyof any]: never }>() {}\n\n// https://github.com/sindresorhus/type-fest\ntype Numeric = number | bigint\ntype Zero = 0 | 0n\ntype Negative<T extends Numeric> = T extends Zero ? never : \\`\\${T}\\` extends \\`-\\${string}\\` ? T : never\ntype NonNegative<T extends Numeric> = T extends Zero ? T : Negative<T> extends never ? T : '__invalid_negative_number__'\n`\n}\n\nasync function collectNamedSlots(layoutPath: string) {\n const layoutDir = path.dirname(layoutPath)\n const items = await fs.readdir(layoutDir, { withFileTypes: true })\n const slots = []\n for (const item of items) {\n if (\n item.isDirectory() &&\n item.name.startsWith('@') &&\n // `@children slots are matched to the children prop, and should not be handled separately for type-checking\n item.name !== '@children'\n ) {\n slots.push(item.name.slice(1))\n }\n }\n return slots\n}\n\n// By exposing the static route types separately as string literals,\n// editors can provide autocompletion for them. However it's currently not\n// possible to provide the same experience for dynamic routes.\n\nconst pluginState = getProxiedPluginState({\n collectedRootParams: {} as Record<string, string[]>,\n routeTypes: {\n edge: {\n static: [],\n dynamic: [],\n },\n node: {\n static: [],\n dynamic: [],\n },\n extra: {\n static: [],\n dynamic: [],\n },\n } as Record<\n 'edge' | 'node' | 'extra',\n Record<'static' | 'dynamic', string[]>\n >,\n})\n\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\nfunction formatTimespan(seconds: number): string {\n if (seconds > 0) {\n if (seconds === 18748800) {\n return '1 month'\n }\n if (seconds === 18144000) {\n return '1 month'\n }\n if (seconds === 604800) {\n return '1 week'\n }\n if (seconds === 86400) {\n return '1 day'\n }\n if (seconds === 3600) {\n return '1 hour'\n }\n if (seconds === 60) {\n return '1 minute'\n }\n if (seconds % 18748800 === 0) {\n return seconds / 18748800 + ' months'\n }\n if (seconds % 18144000 === 0) {\n return seconds / 18144000 + ' months'\n }\n if (seconds % 604800 === 0) {\n return seconds / 604800 + ' weeks'\n }\n if (seconds % 86400 === 0) {\n return seconds / 86400 + ' days'\n }\n if (seconds % 3600 === 0) {\n return seconds / 3600 + ' hours'\n }\n if (seconds % 60 === 0) {\n return seconds / 60 + ' minutes'\n }\n }\n return seconds + ' seconds'\n}\n\nfunction formatTimespanWithSeconds(seconds: undefined | number): string {\n if (seconds === undefined) {\n return 'default'\n }\n if (seconds >= 0xfffffffe) {\n return 'never'\n }\n const text = seconds + ' seconds'\n const descriptive = formatTimespan(seconds)\n if (descriptive === text) {\n return text\n }\n return text + ' (' + descriptive + ')'\n}\n\nfunction getRootParamsFromLayouts(layouts: Record<string, string[]>) {\n // Sort layouts by depth (descending)\n const sortedLayouts = Object.entries(layouts).sort(\n (a, b) => b[0].split('/').length - a[0].split('/').length\n )\n\n if (!sortedLayouts.length) {\n return []\n }\n\n // we assume the shorted layout path is the root layout\n let rootLayout = sortedLayouts[sortedLayouts.length - 1][0]\n\n let rootParams = new Set<string>()\n let isMultipleRootLayouts = false\n\n for (const [layoutPath, params] of sortedLayouts) {\n const allSegmentsAreDynamic = layoutPath\n .split('/')\n .slice(1, -1)\n // match dynamic params but not catch-all or optional catch-all\n .every((segment) => /^\\[[^[.\\]]+\\]$/.test(segment))\n\n if (allSegmentsAreDynamic) {\n if (isSubpath(rootLayout, layoutPath)) {\n // Current path is a subpath of the root layout, update root\n rootLayout = layoutPath\n rootParams = new Set(params)\n } else {\n // Found another potential root layout\n isMultipleRootLayouts = true\n // Add any new params\n for (const param of params) {\n rootParams.add(param)\n }\n }\n }\n }\n\n // Create result array\n const result = Array.from(rootParams).map((param) => ({\n param,\n optional: isMultipleRootLayouts,\n }))\n\n return result\n}\n\nfunction isSubpath(parentLayoutPath: string, potentialChildLayoutPath: string) {\n // we strip off the `layout` part of the path as those will always conflict with being a subpath\n const parentSegments = parentLayoutPath.split('/').slice(1, -1)\n const childSegments = potentialChildLayoutPath.split('/').slice(1, -1)\n\n // child segments should be shorter or equal to parent segments to be a subpath\n if (childSegments.length > parentSegments.length || !childSegments.length)\n return false\n\n // Verify all segment values are equal\n return childSegments.every(\n (childSegment, index) => childSegment === parentSegments[index]\n )\n}\n\nfunction createServerDefinitions(\n rootParams: { param: string; optional: boolean }[]\n) {\n return `\n declare module 'next/server' {\n\n import type { AsyncLocalStorage as NodeAsyncLocalStorage } from 'async_hooks'\n declare global {\n var AsyncLocalStorage: typeof NodeAsyncLocalStorage\n }\n export { NextFetchEvent } from 'next/dist/server/web/spec-extension/fetch-event'\n export { NextRequest } from 'next/dist/server/web/spec-extension/request'\n export { NextResponse } from 'next/dist/server/web/spec-extension/response'\n export { NextMiddleware, MiddlewareConfig } from 'next/dist/server/web/types'\n export { userAgentFromString } from 'next/dist/server/web/spec-extension/user-agent'\n export { userAgent } from 'next/dist/server/web/spec-extension/user-agent'\n export { URLPattern } from 'next/dist/compiled/@edge-runtime/primitives/url'\n export { ImageResponse } from 'next/dist/server/web/spec-extension/image-response'\n export type { ImageResponseOptions } from 'next/dist/compiled/@vercel/og/types'\n export { after } from 'next/dist/server/after'\n export { connection } from 'next/dist/server/request/connection'\n export type { UnsafeUnwrappedSearchParams } from 'next/dist/server/request/search-params'\n export type { UnsafeUnwrappedParams } from 'next/dist/server/request/params'\n export function unstable_rootParams(): Promise<{ ${rootParams\n .map(\n ({ param, optional }) =>\n // ensure params with dashes are valid keys\n `${param.includes('-') ? `'${param}'` : param}${optional ? '?' : ''}: string`\n )\n .join(', ')} }>\n }\n `\n}\n\nfunction createCustomCacheLifeDefinitions(cacheLife: {\n [profile: string]: CacheLife\n}) {\n let overloads = ''\n\n const profileNames = Object.keys(cacheLife)\n for (let i = 0; i < profileNames.length; i++) {\n const profileName = profileNames[i]\n const profile = cacheLife[profileName]\n if (typeof profile !== 'object' || profile === null) {\n continue\n }\n\n let description = ''\n\n if (profile.stale === undefined) {\n description += `\n * This cache may be stale on clients for the default stale time of the scope before checking with the server.`\n } else if (profile.stale >= 0xfffffffe) {\n description += `\n * This cache may be stale on clients indefinitely before checking with the server.`\n } else {\n description += `\n * This cache may be stale on clients for ${formatTimespan(profile.stale)} before checking with the server.`\n }\n if (\n profile.revalidate !== undefined &&\n profile.expire !== undefined &&\n profile.revalidate >= profile.expire\n ) {\n description += `\n * This cache will expire after ${formatTimespan(profile.expire)}. The next request will recompute it.`\n } else {\n if (profile.revalidate === undefined) {\n description += `\n * It will inherit the default revalidate time of its scope since it does not define its own.`\n } else if (profile.revalidate >= 0xfffffffe) {\n // Nothing to mention.\n } else {\n description += `\n * If the server receives a new request after ${formatTimespan(profile.revalidate)}, start revalidating new values in the background.`\n }\n if (profile.expire === undefined) {\n description += `\n * It will inherit the default expiration time of its scope since it does not define its own.`\n } else if (profile.expire >= 0xfffffffe) {\n description += `\n * It lives for the maximum age of the server cache. If this entry has no traffic for a while, it may serve an old value the next request.`\n } else {\n description += `\n * If this entry has no traffic for ${formatTimespan(profile.expire)} it will expire. The next request will recompute it.`\n }\n }\n\n overloads += `\n /**\n * Cache this \\`\"use cache\"\\` for a timespan defined by the \\`${JSON.stringify(profileName)}\\` profile.\n * \\`\\`\\`\n * stale: ${formatTimespanWithSeconds(profile.stale)}\n * revalidate: ${formatTimespanWithSeconds(profile.revalidate)}\n * expire: ${formatTimespanWithSeconds(profile.expire)}\n * \\`\\`\\`\n * ${description}\n */\n export function unstable_cacheLife(profile: ${JSON.stringify(profileName)}): void\n `\n }\n\n overloads += `\n /**\n * Cache this \\`\"use cache\"\\` using a custom timespan.\n * \\`\\`\\`\n * stale: ... // seconds\n * revalidate: ... // seconds\n * expire: ... // seconds\n * \\`\\`\\`\n *\n * This is similar to Cache-Control: max-age=\\`stale\\`,s-max-age=\\`revalidate\\`,stale-while-revalidate=\\`expire-revalidate\\`\n *\n * If a value is left out, the lowest of other cacheLife() calls or the default, is used instead.\n */\n export function unstable_cacheLife(profile: {\n /**\n * This cache may be stale on clients for ... seconds before checking with the server.\n */\n stale?: number,\n /**\n * If the server receives a new request after ... seconds, start revalidating new values in the background.\n */\n revalidate?: number,\n /**\n * If this entry has no traffic for ... seconds it will expire. The next request will recompute it.\n */\n expire?: number\n }): void\n `\n\n // Redefine the cacheLife() accepted arguments.\n return `// Type definitions for Next.js cacheLife configs\n\ndeclare module 'next/cache' {\n export { unstable_cache } from 'next/dist/server/web/spec-extension/unstable-cache'\n export {\n revalidateTag,\n revalidatePath,\n unstable_expireTag,\n unstable_expirePath,\n } from 'next/dist/server/web/spec-extension/revalidate'\n export { unstable_noStore } from 'next/dist/server/web/spec-extension/unstable-no-store'\n\n ${overloads}\n\n export { cacheTag as unstable_cacheTag } from 'next/dist/server/use-cache/cache-tag'\n}\n`\n}\n\nconst appTypesBasePath = path.join('types', 'app')\n\nexport class NextTypesPlugin {\n dir: string\n distDir: string\n appDir: string\n dev: boolean\n isEdgeServer: boolean\n pageExtensions: string[]\n pagesDir: string\n cacheLifeConfig: undefined | { [profile: string]: CacheLife }\n distDirAbsolutePath: string\n\n constructor(options: Options) {\n this.dir = options.dir\n this.distDir = options.distDir\n this.appDir = options.appDir\n this.dev = options.dev\n this.isEdgeServer = options.isEdgeServer\n this.pageExtensions = options.pageExtensions\n this.pagesDir = path.join(this.appDir, '..', 'pages')\n this.cacheLifeConfig = options.cacheLifeConfig\n this.distDirAbsolutePath = path.join(this.dir, this.distDir)\n }\n\n getRelativePathFromAppTypesDir(moduleRelativePathToAppDir: string) {\n const moduleAbsolutePath = path.join(\n this.appDir,\n moduleRelativePathToAppDir\n )\n\n const moduleInAppTypesAbsolutePath = path.join(\n this.distDirAbsolutePath,\n appTypesBasePath,\n moduleRelativePathToAppDir\n )\n\n return path.relative(\n moduleInAppTypesAbsolutePath + '/..',\n moduleAbsolutePath\n )\n }\n\n collectPage(filePath: string) {\n const isApp = filePath.startsWith(this.appDir + path.sep)\n const isPages = !isApp && filePath.startsWith(this.pagesDir + path.sep)\n\n if (!isApp && !isPages) {\n return\n }\n\n // Filter out non-page and non-route files in app dir\n if (isApp && !/[/\\\\](?:page|route)\\.[^.]+$/.test(filePath)) {\n return\n }\n\n // Filter out non-page files in pages dir\n if (\n isPages &&\n /[/\\\\](?:_app|_document|_error|404|500)\\.[^.]+$/.test(filePath)\n ) {\n return\n }\n\n let route = (isApp ? normalizeAppPath : denormalizePagePath)(\n ensureLeadingSlash(\n getPageFromPath(\n path.relative(isApp ? this.appDir : this.pagesDir, filePath),\n this.pageExtensions\n )\n )\n )\n\n const { isDynamic, routeType } = formatRouteToRouteType(route)\n\n pluginState.routeTypes[this.isEdgeServer ? 'edge' : 'node'][\n isDynamic ? 'dynamic' : 'static'\n ].push(routeType)\n }\n\n apply(compiler: webpack.Compiler) {\n // From asset root to dist root\n const assetDirRelative = this.dev\n ? '..'\n : this.isEdgeServer\n ? '..'\n : '../..'\n\n const handleModule = async (\n mod: webpack.NormalModule,\n compilation: webpack.Compilation\n ) => {\n if (!mod.resource) return\n\n const pageExtensionsRegex = new RegExp(\n `\\\\.(${this.pageExtensions.join('|')})$`\n )\n\n if (!pageExtensionsRegex.test(mod.resource)) return\n\n if (!mod.resource.startsWith(this.appDir + path.sep)) {\n if (!this.dev) {\n if (mod.resource.startsWith(this.pagesDir + path.sep)) {\n this.collectPage(mod.resource)\n }\n }\n return\n }\n if (mod.layer !== WEBPACK_LAYERS.reactServerComponents) return\n\n // skip for /app/_private dir convention\n // matches <app-dir>/**/_*\n const IS_PRIVATE = /(?:\\/[^/]+)*\\/_.*$/.test(\n mod.resource.replace(this.appDir, '')\n )\n if (IS_PRIVATE) return\n\n const IS_LAYOUT = /[/\\\\]layout\\.[^./\\\\]+$/.test(mod.resource)\n const IS_PAGE = !IS_LAYOUT && /[/\\\\]page\\.[^.]+$/.test(mod.resource)\n const IS_ROUTE = !IS_PAGE && /[/\\\\]route\\.[^.]+$/.test(mod.resource)\n const IS_IMPORTABLE = /\\.(js|jsx|ts|tsx|mjs|cjs)$/.test(mod.resource)\n const relativePathToApp = path.relative(this.appDir, mod.resource)\n\n if (!this.dev) {\n if (IS_PAGE || IS_ROUTE) {\n this.collectPage(mod.resource)\n }\n }\n\n const typePath = path.join(\n appTypesBasePath,\n relativePathToApp.replace(pageExtensionsRegex, '.ts')\n )\n const relativeImportPath = normalizePathSep(\n path\n .join(this.getRelativePathFromAppTypesDir(relativePathToApp))\n .replace(pageExtensionsRegex, '')\n )\n\n const assetPath = path.join(assetDirRelative, typePath)\n\n // Typescript won’t allow relative-importing (for example) a .mdx file using the .js extension\n // so for now we only generate “type guard files” for files that typescript can transform\n if (!IS_IMPORTABLE) return\n\n if (IS_LAYOUT) {\n const rootLayoutPath = normalizeAppPath(\n ensureLeadingSlash(\n getPageFromPath(\n path.relative(this.appDir, mod.resource),\n this.pageExtensions\n )\n )\n )\n\n const foundParams = Array.from(\n rootLayoutPath.matchAll(/\\[(.*?)\\]/g),\n (match) => match[1]\n )\n\n pluginState.collectedRootParams[rootLayoutPath] = foundParams\n\n const slots = await collectNamedSlots(mod.resource)\n compilation.emitAsset(\n assetPath,\n new sources.RawSource(\n createTypeGuardFile(mod.resource, relativeImportPath, {\n type: 'layout',\n slots,\n })\n ) as unknown as webpack.sources.RawSource\n )\n } else if (IS_PAGE) {\n compilation.emitAsset(\n assetPath,\n new sources.RawSource(\n createTypeGuardFile(mod.resource, relativeImportPath, {\n type: 'page',\n })\n ) as unknown as webpack.sources.RawSource\n )\n } else if (IS_ROUTE) {\n compilation.emitAsset(\n assetPath,\n new sources.RawSource(\n createTypeGuardFile(mod.resource, relativeImportPath, {\n type: 'route',\n })\n ) as unknown as webpack.sources.RawSource\n )\n }\n }\n\n compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {\n compilation.hooks.processAssets.tapAsync(\n {\n name: PLUGIN_NAME,\n stage: webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_HASH,\n },\n async (_, callback) => {\n const promises: Promise<any>[] = []\n\n // Clear routes\n if (this.isEdgeServer) {\n pluginState.routeTypes.edge.dynamic = []\n pluginState.routeTypes.edge.static = []\n } else {\n pluginState.routeTypes.node.dynamic = []\n pluginState.routeTypes.node.static = []\n }\n\n compilation.chunkGroups.forEach((chunkGroup) => {\n chunkGroup.chunks.forEach((chunk) => {\n if (!chunk.name) return\n\n // Here we only track page and route chunks.\n if (\n !chunk.name.startsWith('pages/') &&\n !(\n chunk.name.startsWith('app/') &&\n (chunk.name.endsWith('/page') ||\n chunk.name.endsWith('/route'))\n )\n ) {\n return\n }\n\n const chunkModules =\n compilation.chunkGraph.getChunkModulesIterable(\n chunk\n ) as Iterable<webpack.NormalModule>\n for (const mod of chunkModules) {\n promises.push(handleModule(mod, compilation))\n\n // If this is a concatenation, register each child to the parent ID.\n const anyModule = mod as unknown as {\n modules: webpack.NormalModule[]\n }\n if (anyModule.modules) {\n anyModule.modules.forEach((concatenatedMod) => {\n promises.push(handleModule(concatenatedMod, compilation))\n })\n }\n }\n })\n })\n\n await Promise.all(promises)\n\n const rootParams = getRootParamsFromLayouts(\n pluginState.collectedRootParams\n )\n // If we discovered rootParams, we'll override the `next/server` types\n // since we're able to determine the root params at build time.\n if (rootParams.length > 0) {\n const serverTypesPath = path.join(\n assetDirRelative,\n 'types/server.d.ts'\n )\n\n compilation.emitAsset(\n serverTypesPath,\n new sources.RawSource(\n createServerDefinitions(rootParams)\n ) as unknown as webpack.sources.RawSource\n )\n }\n\n // Support `\"moduleResolution\": \"Node16\" | \"NodeNext\"` with `\"type\": \"module\"`\n\n const packageJsonAssetPath = path.join(\n assetDirRelative,\n 'types/package.json'\n )\n\n compilation.emitAsset(\n packageJsonAssetPath,\n new sources.RawSource(\n '{\"type\": \"module\"}'\n ) as unknown as webpack.sources.RawSource\n )\n\n if (this.cacheLifeConfig) {\n const cacheLifeAssetPath = path.join(\n assetDirRelative,\n 'types/cache-life.d.ts'\n )\n\n compilation.emitAsset(\n cacheLifeAssetPath,\n new sources.RawSource(\n createCustomCacheLifeDefinitions(this.cacheLifeConfig)\n ) as unknown as webpack.sources.RawSource\n )\n }\n\n callback()\n }\n )\n })\n }\n}\n"],"names":["NextTypesPlugin","PLUGIN_NAME","createTypeGuardFile","fullPath","relativePath","options","type","HTTP_METHODS","map","method","join","slots","slot","collectNamedSlots","layoutPath","layoutDir","path","dirname","items","fs","readdir","withFileTypes","item","isDirectory","name","startsWith","push","slice","pluginState","getProxiedPluginState","collectedRootParams","routeTypes","edge","static","dynamic","node","extra","formatRouteToRouteType","route","isDynamic","isDynamicRoute","split","part","endsWith","routeType","formatTimespan","seconds","formatTimespanWithSeconds","undefined","text","descriptive","getRootParamsFromLayouts","layouts","sortedLayouts","Object","entries","sort","a","b","length","rootLayout","rootParams","Set","isMultipleRootLayouts","params","allSegmentsAreDynamic","every","segment","test","isSubpath","param","add","result","Array","from","optional","parentLayoutPath","potentialChildLayoutPath","parentSegments","childSegments","childSegment","index","createServerDefinitions","includes","createCustomCacheLifeDefinitions","cacheLife","overloads","profileNames","keys","i","profileName","profile","description","stale","revalidate","expire","JSON","stringify","appTypesBasePath","constructor","dir","distDir","appDir","dev","isEdgeServer","pageExtensions","pagesDir","cacheLifeConfig","distDirAbsolutePath","getRelativePathFromAppTypesDir","moduleRelativePathToAppDir","moduleAbsolutePath","moduleInAppTypesAbsolutePath","relative","collectPage","filePath","isApp","sep","isPages","normalizeAppPath","denormalizePagePath","ensureLeadingSlash","getPageFromPath","apply","compiler","assetDirRelative","handleModule","mod","compilation","resource","pageExtensionsRegex","RegExp","layer","WEBPACK_LAYERS","reactServerComponents","IS_PRIVATE","replace","IS_LAYOUT","IS_PAGE","IS_ROUTE","IS_IMPORTABLE","relativePathToApp","typePath","relativeImportPath","normalizePathSep","assetPath","rootLayoutPath","foundParams","matchAll","match","emitAsset","sources","RawSource","hooks","tap","processAssets","tapAsync","stage","webpack","Compilation","PROCESS_ASSETS_STAGE_OPTIMIZE_HASH","_","callback","promises","chunkGroups","forEach","chunkGroup","chunks","chunk","chunkModules","chunkGraph","getChunkModulesIterable","anyModule","modules","concatenatedMod","Promise","all","serverTypesPath","packageJsonAssetPath","cacheLifeAssetPath"],"mappings":";;;;+BA6iBaA;;;eAAAA;;;iEA3iBE;yBACkB;6DAChB;2BAEc;qCACK;oCACD;kCACF;sBACJ;uBACE;0BACE;yBACD;8BAEM;;;;;;AAGtC,MAAMC,cAAc;AAoBpB,SAASC,oBACPC,QAAgB,EAChBC,YAAoB,EACpBC,OAGC;IAED,OAAO,CAAC,SAAS,EAAEF,SAAS;wBACN,EAAEC,aAAa;AACvC,EACEC,QAAQC,IAAI,KAAK,UACb,CAAC,iDAAiD,CAAC,GACnD,CAAC,8GAA8G,CAAC,CACrH;;6BAE4B,EAAEF,aAAa;;;;;;;;EAQ1C,EACEC,QAAQC,IAAI,KAAK,UACbC,kBAAY,CAACC,GAAG,CAAC,CAACC,SAAW,GAAGA,OAAO,WAAW,CAAC,EAAEC,IAAI,CAAC,UAC1D,oBACL;;;;;;;;;;;EAWD,EACEL,QAAQC,IAAI,KAAK,UACb,KACA,CAAC;;;;;;EAMP,CAAC,CACA;;;AAGH,EAAED,QAAQC,IAAI,KAAK,UAAU,CAAC,sDAAsD,CAAC,GAAG,GAAG;AAC3F,EACED,QAAQC,IAAI,KAAK,UACbC,kBAAY,CAACC,GAAG,CACd,CAACC,SAAW,CAAC;KAChB,EAAE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AAS,CACnB2B,iBACA,IAAI1B,gBAAO,CAACC,SAAS,CACnBtE,wBAAwBrB;gBAG9B;gBAEA,8EAA8E;gBAE9E,MAAMqH,uBAAuBlK,aAAI,CAACN,IAAI,CACpCmH,kBACA;gBAGFG,YAAYsB,SAAS,CACnB4B,sBACA,IAAI3B,gBAAO,CAACC,SAAS,CACnB;gBAIJ,IAAI,IAAI,CAAC7C,eAAe,EAAE;oBACxB,MAAMwE,qBAAqBnK,aAAI,CAACN,IAAI,CAClCmH,kBACA;oBAGFG,YAAYsB,SAAS,CACnB6B,oBACA,IAAI5B,gBAAO,CAACC,SAAS,CACnBpE,iCAAiC,IAAI,CAACuB,eAAe;gBAG3D;gBAEAuD;YACF;QAEJ;IACF;AACF","ignoreList":[0]}
1
+ {"version":3,"sources":["../../../../../src/build/webpack/plugins/next-types-plugin/index.ts"],"sourcesContent":["import type { Rewrite, Redirect } from '../../../../lib/load-custom-routes'\n\nimport fs from 'fs/promises'\nimport { webpack, sources } from 'next/dist/compiled/webpack/webpack'\nimport path from 'path'\n\nimport { WEBPACK_LAYERS } from '../../../../lib/constants'\n\n// Read package name dynamically to support forked packages\nconst PKG_NAME = require('../../../../../package.json').name\nimport { denormalizePagePath } from '../../../../shared/lib/page-path/denormalize-page-path'\nimport { ensureLeadingSlash } from '../../../../shared/lib/page-path/ensure-leading-slash'\nimport { normalizePathSep } from '../../../../shared/lib/page-path/normalize-path-sep'\nimport { HTTP_METHODS } from '../../../../server/web/http'\nimport { isDynamicRoute } from '../../../../shared/lib/router/utils'\nimport { normalizeAppPath } from '../../../../shared/lib/router/utils/app-paths'\nimport { getPageFromPath } from '../../../entries'\nimport type { PageExtensions } from '../../../page-extensions-type'\nimport { getProxiedPluginState } from '../../../build-context'\nimport type { CacheLife } from '../../../../server/use-cache/cache-life'\n\nconst PLUGIN_NAME = 'NextTypesPlugin'\n\ntype Rewrites = {\n fallback: Rewrite[]\n afterFiles: Rewrite[]\n beforeFiles: Rewrite[]\n}\n\ninterface Options {\n dir: string\n distDir: string\n appDir: string\n dev: boolean\n isEdgeServer: boolean\n pageExtensions: PageExtensions\n cacheLifeConfig: undefined | { [profile: string]: CacheLife }\n originalRewrites: Rewrites | undefined\n originalRedirects: Redirect[] | undefined\n}\n\nfunction createTypeGuardFile(\n fullPath: string,\n relativePath: string,\n options: {\n type: 'layout' | 'page' | 'route'\n slots?: string[]\n }\n) {\n return `// File: ${fullPath}\nimport * as entry from '${relativePath}.js'\n${\n options.type === 'route'\n ? `import type { NextRequest } from '${PKG_NAME}/server.js'`\n : `import type { ResolvingMetadata, ResolvingViewport } from '${PKG_NAME}/dist/lib/metadata/types/metadata-interface.js'`\n}\n\ntype TEntry = typeof import('${relativePath}.js')\n\ntype SegmentParams<T extends Object = any> = T extends Record<string, any>\n ? { [K in keyof T]: T[K] extends string ? string | string[] | undefined : never }\n : T\n\n// Check that the entry is a valid entry\ncheckFields<Diff<{\n ${\n options.type === 'route'\n ? HTTP_METHODS.map((method) => `${method}?: Function`).join('\\n ')\n : 'default: Function'\n }\n config?: {}\n generateStaticParams?: Function\n unstable_prefetch?: 'unstable_static' | 'unstable_runtime'\n revalidate?: RevalidateRange<TEntry> | false\n dynamic?: 'auto' | 'force-dynamic' | 'error' | 'force-static'\n dynamicParams?: boolean\n fetchCache?: 'auto' | 'force-no-store' | 'only-no-store' | 'default-no-store' | 'default-cache' | 'only-cache' | 'force-cache'\n preferredRegion?: 'auto' | 'global' | 'home' | string | string[]\n runtime?: 'nodejs' | 'experimental-edge' | 'edge'\n maxDuration?: number\n ${\n options.type === 'route'\n ? ''\n : `\n metadata?: any\n generateMetadata?: Function\n viewport?: any\n generateViewport?: Function\n experimental_ppr?: boolean\n `\n }\n}, TEntry, ''>>()\n\n${options.type === 'route' ? `type RouteContext = { params: Promise<SegmentParams> }` : ''}\n${\n options.type === 'route'\n ? HTTP_METHODS.map(\n (method) => `// Check the prop type of the entry function\nif ('${method}' in entry) {\n checkFields<\n Diff<\n ParamCheck<Request | NextRequest>,\n {\n __tag__: '${method}'\n __param_position__: 'first'\n __param_type__: FirstArg<MaybeField<TEntry, '${method}'>>\n },\n '${method}'\n >\n >()\n checkFields<\n Diff<\n ParamCheck<RouteContext>,\n {\n __tag__: '${method}'\n __param_position__: 'second'\n __param_type__: SecondArg<MaybeField<TEntry, '${method}'>>\n },\n '${method}'\n >\n >()\n ${\n ''\n // Adding void to support never return type without explicit return:\n // e.g. notFound() will interrupt the execution but the handler return type is inferred as void.\n // x-ref: https://github.com/microsoft/TypeScript/issues/16608#issuecomment-309327984\n }\n checkFields<\n Diff<\n {\n __tag__: '${method}',\n __return_type__: Response | void | never | Promise<Response | void | never>\n },\n {\n __tag__: '${method}',\n __return_type__: ReturnType<MaybeField<TEntry, '${method}'>>\n },\n '${method}'\n >\n >()\n}\n`\n ).join('')\n : `// Check the prop type of the entry function\ncheckFields<Diff<${\n options.type === 'page' ? 'PageProps' : 'LayoutProps'\n }, FirstArg<TEntry['default']>, 'default'>>()\n\n// Check the arguments and return type of the generateMetadata function\nif ('generateMetadata' in entry) {\n checkFields<Diff<${\n options.type === 'page' ? 'PageProps' : 'LayoutProps'\n }, FirstArg<MaybeField<TEntry, 'generateMetadata'>>, 'generateMetadata'>>()\n checkFields<Diff<ResolvingMetadata, SecondArg<MaybeField<TEntry, 'generateMetadata'>>, 'generateMetadata'>>()\n}\n\n// Check the arguments and return type of the generateViewport function\nif ('generateViewport' in entry) {\n checkFields<Diff<${\n options.type === 'page' ? 'PageProps' : 'LayoutProps'\n }, FirstArg<MaybeField<TEntry, 'generateViewport'>>, 'generateViewport'>>()\n checkFields<Diff<ResolvingViewport, SecondArg<MaybeField<TEntry, 'generateViewport'>>, 'generateViewport'>>()\n}\n`\n}\n// Check the arguments and return type of the generateStaticParams function\nif ('generateStaticParams' in entry) {\n checkFields<Diff<{ params: SegmentParams }, FirstArg<MaybeField<TEntry, 'generateStaticParams'>>, 'generateStaticParams'>>()\n checkFields<Diff<{ __tag__: 'generateStaticParams', __return_type__: any[] | Promise<any[]> }, { __tag__: 'generateStaticParams', __return_type__: ReturnType<MaybeField<TEntry, 'generateStaticParams'>> }>>()\n}\n\nexport interface PageProps {\n params?: Promise<SegmentParams>\n searchParams?: Promise<any>\n}\nexport interface LayoutProps {\n children?: React.ReactNode\n${\n options.slots\n ? options.slots.map((slot) => ` ${slot}: React.ReactNode`).join('\\n')\n : ''\n}\n params?: Promise<SegmentParams>\n}\n\n// =============\n// Utility types\ntype RevalidateRange<T> = T extends { revalidate: any } ? NonNegative<T['revalidate']> : never\n\n// If T is unknown or any, it will be an empty {} type. Otherwise, it will be the same as Omit<T, keyof Base>.\ntype OmitWithTag<T, K extends keyof any, _M> = Omit<T, K>\ntype Diff<Base, T extends Base, Message extends string = ''> = 0 extends (1 & T) ? {} : OmitWithTag<T, keyof Base, Message>\n\ntype FirstArg<T extends Function> = T extends (...args: [infer T, any]) => any ? unknown extends T ? any : T : never\ntype SecondArg<T extends Function> = T extends (...args: [any, infer T]) => any ? unknown extends T ? any : T : never\ntype MaybeField<T, K extends string> = T extends { [k in K]: infer G } ? G extends Function ? G : never : never\n\n${\n options.type === 'route'\n ? `type ParamCheck<T> = {\n __tag__: string\n __param_position__: string\n __param_type__: T\n}`\n : ''\n}\n\nfunction checkFields<_ extends { [k in keyof any]: never }>() {}\n\n// https://github.com/sindresorhus/type-fest\ntype Numeric = number | bigint\ntype Zero = 0 | 0n\ntype Negative<T extends Numeric> = T extends Zero ? never : \\`\\${T}\\` extends \\`-\\${string}\\` ? T : never\ntype NonNegative<T extends Numeric> = T extends Zero ? T : Negative<T> extends never ? T : '__invalid_negative_number__'\n`\n}\n\nasync function collectNamedSlots(layoutPath: string) {\n const layoutDir = path.dirname(layoutPath)\n const items = await fs.readdir(layoutDir, { withFileTypes: true })\n const slots = []\n for (const item of items) {\n if (\n item.isDirectory() &&\n item.name.startsWith('@') &&\n // `@children slots are matched to the children prop, and should not be handled separately for type-checking\n item.name !== '@children'\n ) {\n slots.push(item.name.slice(1))\n }\n }\n return slots\n}\n\n// By exposing the static route types separately as string literals,\n// editors can provide autocompletion for them. However it's currently not\n// possible to provide the same experience for dynamic routes.\n\nconst pluginState = getProxiedPluginState({\n collectedRootParams: {} as Record<string, string[]>,\n routeTypes: {\n edge: {\n static: [],\n dynamic: [],\n },\n node: {\n static: [],\n dynamic: [],\n },\n extra: {\n static: [],\n dynamic: [],\n },\n } as Record<\n 'edge' | 'node' | 'extra',\n Record<'static' | 'dynamic', string[]>\n >,\n})\n\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\nfunction formatTimespan(seconds: number): string {\n if (seconds > 0) {\n if (seconds === 18748800) {\n return '1 month'\n }\n if (seconds === 18144000) {\n return '1 month'\n }\n if (seconds === 604800) {\n return '1 week'\n }\n if (seconds === 86400) {\n return '1 day'\n }\n if (seconds === 3600) {\n return '1 hour'\n }\n if (seconds === 60) {\n return '1 minute'\n }\n if (seconds % 18748800 === 0) {\n return seconds / 18748800 + ' months'\n }\n if (seconds % 18144000 === 0) {\n return seconds / 18144000 + ' months'\n }\n if (seconds % 604800 === 0) {\n return seconds / 604800 + ' weeks'\n }\n if (seconds % 86400 === 0) {\n return seconds / 86400 + ' days'\n }\n if (seconds % 3600 === 0) {\n return seconds / 3600 + ' hours'\n }\n if (seconds % 60 === 0) {\n return seconds / 60 + ' minutes'\n }\n }\n return seconds + ' seconds'\n}\n\nfunction formatTimespanWithSeconds(seconds: undefined | number): string {\n if (seconds === undefined) {\n return 'default'\n }\n if (seconds >= 0xfffffffe) {\n return 'never'\n }\n const text = seconds + ' seconds'\n const descriptive = formatTimespan(seconds)\n if (descriptive === text) {\n return text\n }\n return text + ' (' + descriptive + ')'\n}\n\nfunction getRootParamsFromLayouts(layouts: Record<string, string[]>) {\n // Sort layouts by depth (descending)\n const sortedLayouts = Object.entries(layouts).sort(\n (a, b) => b[0].split('/').length - a[0].split('/').length\n )\n\n if (!sortedLayouts.length) {\n return []\n }\n\n // we assume the shorted layout path is the root layout\n let rootLayout = sortedLayouts[sortedLayouts.length - 1][0]\n\n let rootParams = new Set<string>()\n let isMultipleRootLayouts = false\n\n for (const [layoutPath, params] of sortedLayouts) {\n const allSegmentsAreDynamic = layoutPath\n .split('/')\n .slice(1, -1)\n // match dynamic params but not catch-all or optional catch-all\n .every((segment) => /^\\[[^[.\\]]+\\]$/.test(segment))\n\n if (allSegmentsAreDynamic) {\n if (isSubpath(rootLayout, layoutPath)) {\n // Current path is a subpath of the root layout, update root\n rootLayout = layoutPath\n rootParams = new Set(params)\n } else {\n // Found another potential root layout\n isMultipleRootLayouts = true\n // Add any new params\n for (const param of params) {\n rootParams.add(param)\n }\n }\n }\n }\n\n // Create result array\n const result = Array.from(rootParams).map((param) => ({\n param,\n optional: isMultipleRootLayouts,\n }))\n\n return result\n}\n\nfunction isSubpath(parentLayoutPath: string, potentialChildLayoutPath: string) {\n // we strip off the `layout` part of the path as those will always conflict with being a subpath\n const parentSegments = parentLayoutPath.split('/').slice(1, -1)\n const childSegments = potentialChildLayoutPath.split('/').slice(1, -1)\n\n // child segments should be shorter or equal to parent segments to be a subpath\n if (childSegments.length > parentSegments.length || !childSegments.length)\n return false\n\n // Verify all segment values are equal\n return childSegments.every(\n (childSegment, index) => childSegment === parentSegments[index]\n )\n}\n\nfunction createServerDefinitions(\n rootParams: { param: string; optional: boolean }[]\n) {\n return `\n declare module '${PKG_NAME}/server' {\n\n import type { AsyncLocalStorage as NodeAsyncLocalStorage } from 'async_hooks'\n declare global {\n var AsyncLocalStorage: typeof NodeAsyncLocalStorage\n }\n export { NextFetchEvent } from '${PKG_NAME}/dist/server/web/spec-extension/fetch-event'\n export { NextRequest } from '${PKG_NAME}/dist/server/web/spec-extension/request'\n export { NextResponse } from '${PKG_NAME}/dist/server/web/spec-extension/response'\n export { NextMiddleware, MiddlewareConfig } from '${PKG_NAME}/dist/server/web/types'\n export { userAgentFromString } from '${PKG_NAME}/dist/server/web/spec-extension/user-agent'\n export { userAgent } from '${PKG_NAME}/dist/server/web/spec-extension/user-agent'\n export { URLPattern } from '${PKG_NAME}/dist/compiled/@edge-runtime/primitives/url'\n export { ImageResponse } from '${PKG_NAME}/dist/server/web/spec-extension/image-response'\n export type { ImageResponseOptions } from '${PKG_NAME}/dist/compiled/@vercel/og/types'\n export { after } from '${PKG_NAME}/dist/server/after'\n export { connection } from '${PKG_NAME}/dist/server/request/connection'\n export type { UnsafeUnwrappedSearchParams } from '${PKG_NAME}/dist/server/request/search-params'\n export type { UnsafeUnwrappedParams } from '${PKG_NAME}/dist/server/request/params'\n export function unstable_rootParams(): Promise<{ ${rootParams\n .map(\n ({ param, optional }) =>\n // ensure params with dashes are valid keys\n `${param.includes('-') ? `'${param}'` : param}${optional ? '?' : ''}: string`\n )\n .join(', ')} }>\n }\n `\n}\n\nfunction createCustomCacheLifeDefinitions(cacheLife: {\n [profile: string]: CacheLife\n}) {\n let overloads = ''\n\n const profileNames = Object.keys(cacheLife)\n for (let i = 0; i < profileNames.length; i++) {\n const profileName = profileNames[i]\n const profile = cacheLife[profileName]\n if (typeof profile !== 'object' || profile === null) {\n continue\n }\n\n let description = ''\n\n if (profile.stale === undefined) {\n description += `\n * This cache may be stale on clients for the default stale time of the scope before checking with the server.`\n } else if (profile.stale >= 0xfffffffe) {\n description += `\n * This cache may be stale on clients indefinitely before checking with the server.`\n } else {\n description += `\n * This cache may be stale on clients for ${formatTimespan(profile.stale)} before checking with the server.`\n }\n if (\n profile.revalidate !== undefined &&\n profile.expire !== undefined &&\n profile.revalidate >= profile.expire\n ) {\n description += `\n * This cache will expire after ${formatTimespan(profile.expire)}. The next request will recompute it.`\n } else {\n if (profile.revalidate === undefined) {\n description += `\n * It will inherit the default revalidate time of its scope since it does not define its own.`\n } else if (profile.revalidate >= 0xfffffffe) {\n // Nothing to mention.\n } else {\n description += `\n * If the server receives a new request after ${formatTimespan(profile.revalidate)}, start revalidating new values in the background.`\n }\n if (profile.expire === undefined) {\n description += `\n * It will inherit the default expiration time of its scope since it does not define its own.`\n } else if (profile.expire >= 0xfffffffe) {\n description += `\n * It lives for the maximum age of the server cache. If this entry has no traffic for a while, it may serve an old value the next request.`\n } else {\n description += `\n * If this entry has no traffic for ${formatTimespan(profile.expire)} it will expire. The next request will recompute it.`\n }\n }\n\n overloads += `\n /**\n * Cache this \\`\"use cache\"\\` for a timespan defined by the \\`${JSON.stringify(profileName)}\\` profile.\n * \\`\\`\\`\n * stale: ${formatTimespanWithSeconds(profile.stale)}\n * revalidate: ${formatTimespanWithSeconds(profile.revalidate)}\n * expire: ${formatTimespanWithSeconds(profile.expire)}\n * \\`\\`\\`\n * ${description}\n */\n export function unstable_cacheLife(profile: ${JSON.stringify(profileName)}): void\n `\n }\n\n overloads += `\n /**\n * Cache this \\`\"use cache\"\\` using a custom timespan.\n * \\`\\`\\`\n * stale: ... // seconds\n * revalidate: ... // seconds\n * expire: ... // seconds\n * \\`\\`\\`\n *\n * This is similar to Cache-Control: max-age=\\`stale\\`,s-max-age=\\`revalidate\\`,stale-while-revalidate=\\`expire-revalidate\\`\n *\n * If a value is left out, the lowest of other cacheLife() calls or the default, is used instead.\n */\n export function unstable_cacheLife(profile: {\n /**\n * This cache may be stale on clients for ... seconds before checking with the server.\n */\n stale?: number,\n /**\n * If the server receives a new request after ... seconds, start revalidating new values in the background.\n */\n revalidate?: number,\n /**\n * If this entry has no traffic for ... seconds it will expire. The next request will recompute it.\n */\n expire?: number\n }): void\n `\n\n // Redefine the cacheLife() accepted arguments.\n return `// Type definitions for Next.js cacheLife configs\n\ndeclare module '${PKG_NAME}/cache' {\n export { unstable_cache } from '${PKG_NAME}/dist/server/web/spec-extension/unstable-cache'\n export {\n revalidateTag,\n revalidatePath,\n unstable_expireTag,\n unstable_expirePath,\n } from '${PKG_NAME}/dist/server/web/spec-extension/revalidate'\n export { unstable_noStore } from '${PKG_NAME}/dist/server/web/spec-extension/unstable-no-store'\n\n ${overloads}\n\n export { cacheTag as unstable_cacheTag } from '${PKG_NAME}/dist/server/use-cache/cache-tag'\n}\n`\n}\n\nconst appTypesBasePath = path.join('types', 'app')\n\nexport class NextTypesPlugin {\n dir: string\n distDir: string\n appDir: string\n dev: boolean\n isEdgeServer: boolean\n pageExtensions: string[]\n pagesDir: string\n cacheLifeConfig: undefined | { [profile: string]: CacheLife }\n distDirAbsolutePath: string\n\n constructor(options: Options) {\n this.dir = options.dir\n this.distDir = options.distDir\n this.appDir = options.appDir\n this.dev = options.dev\n this.isEdgeServer = options.isEdgeServer\n this.pageExtensions = options.pageExtensions\n this.pagesDir = path.join(this.appDir, '..', 'pages')\n this.cacheLifeConfig = options.cacheLifeConfig\n this.distDirAbsolutePath = path.join(this.dir, this.distDir)\n }\n\n getRelativePathFromAppTypesDir(moduleRelativePathToAppDir: string) {\n const moduleAbsolutePath = path.join(\n this.appDir,\n moduleRelativePathToAppDir\n )\n\n const moduleInAppTypesAbsolutePath = path.join(\n this.distDirAbsolutePath,\n appTypesBasePath,\n moduleRelativePathToAppDir\n )\n\n return path.relative(\n moduleInAppTypesAbsolutePath + '/..',\n moduleAbsolutePath\n )\n }\n\n collectPage(filePath: string) {\n const isApp = filePath.startsWith(this.appDir + path.sep)\n const isPages = !isApp && filePath.startsWith(this.pagesDir + path.sep)\n\n if (!isApp && !isPages) {\n return\n }\n\n // Filter out non-page and non-route files in app dir\n if (isApp && !/[/\\\\](?:page|route)\\.[^.]+$/.test(filePath)) {\n return\n }\n\n // Filter out non-page files in pages dir\n if (\n isPages &&\n /[/\\\\](?:_app|_document|_error|404|500)\\.[^.]+$/.test(filePath)\n ) {\n return\n }\n\n let route = (isApp ? normalizeAppPath : denormalizePagePath)(\n ensureLeadingSlash(\n getPageFromPath(\n path.relative(isApp ? this.appDir : this.pagesDir, filePath),\n this.pageExtensions\n )\n )\n )\n\n const { isDynamic, routeType } = formatRouteToRouteType(route)\n\n pluginState.routeTypes[this.isEdgeServer ? 'edge' : 'node'][\n isDynamic ? 'dynamic' : 'static'\n ].push(routeType)\n }\n\n apply(compiler: webpack.Compiler) {\n // From asset root to dist root\n const assetDirRelative = this.dev\n ? '..'\n : this.isEdgeServer\n ? '..'\n : '../..'\n\n const handleModule = async (\n mod: webpack.NormalModule,\n compilation: webpack.Compilation\n ) => {\n if (!mod.resource) return\n\n const pageExtensionsRegex = new RegExp(\n `\\\\.(${this.pageExtensions.join('|')})$`\n )\n\n if (!pageExtensionsRegex.test(mod.resource)) return\n\n if (!mod.resource.startsWith(this.appDir + path.sep)) {\n if (!this.dev) {\n if (mod.resource.startsWith(this.pagesDir + path.sep)) {\n this.collectPage(mod.resource)\n }\n }\n return\n }\n if (mod.layer !== WEBPACK_LAYERS.reactServerComponents) return\n\n // skip for /app/_private dir convention\n // matches <app-dir>/**/_*\n const IS_PRIVATE = /(?:\\/[^/]+)*\\/_.*$/.test(\n mod.resource.replace(this.appDir, '')\n )\n if (IS_PRIVATE) return\n\n const IS_LAYOUT = /[/\\\\]layout\\.[^./\\\\]+$/.test(mod.resource)\n const IS_PAGE = !IS_LAYOUT && /[/\\\\]page\\.[^.]+$/.test(mod.resource)\n const IS_ROUTE = !IS_PAGE && /[/\\\\]route\\.[^.]+$/.test(mod.resource)\n const IS_IMPORTABLE = /\\.(js|jsx|ts|tsx|mjs|cjs)$/.test(mod.resource)\n const relativePathToApp = path.relative(this.appDir, mod.resource)\n\n if (!this.dev) {\n if (IS_PAGE || IS_ROUTE) {\n this.collectPage(mod.resource)\n }\n }\n\n const typePath = path.join(\n appTypesBasePath,\n relativePathToApp.replace(pageExtensionsRegex, '.ts')\n )\n const relativeImportPath = normalizePathSep(\n path\n .join(this.getRelativePathFromAppTypesDir(relativePathToApp))\n .replace(pageExtensionsRegex, '')\n )\n\n const assetPath = path.join(assetDirRelative, typePath)\n\n // Typescript won’t allow relative-importing (for example) a .mdx file using the .js extension\n // so for now we only generate “type guard files” for files that typescript can transform\n if (!IS_IMPORTABLE) return\n\n if (IS_LAYOUT) {\n const rootLayoutPath = normalizeAppPath(\n ensureLeadingSlash(\n getPageFromPath(\n path.relative(this.appDir, mod.resource),\n this.pageExtensions\n )\n )\n )\n\n const foundParams = Array.from(\n rootLayoutPath.matchAll(/\\[(.*?)\\]/g),\n (match) => match[1]\n )\n\n pluginState.collectedRootParams[rootLayoutPath] = foundParams\n\n const slots = await collectNamedSlots(mod.resource)\n compilation.emitAsset(\n assetPath,\n new sources.RawSource(\n createTypeGuardFile(mod.resource, relativeImportPath, {\n type: 'layout',\n slots,\n })\n ) as unknown as webpack.sources.RawSource\n )\n } else if (IS_PAGE) {\n compilation.emitAsset(\n assetPath,\n new sources.RawSource(\n createTypeGuardFile(mod.resource, relativeImportPath, {\n type: 'page',\n })\n ) as unknown as webpack.sources.RawSource\n )\n } else if (IS_ROUTE) {\n compilation.emitAsset(\n assetPath,\n new sources.RawSource(\n createTypeGuardFile(mod.resource, relativeImportPath, {\n type: 'route',\n })\n ) as unknown as webpack.sources.RawSource\n )\n }\n }\n\n compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {\n compilation.hooks.processAssets.tapAsync(\n {\n name: PLUGIN_NAME,\n stage: webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_HASH,\n },\n async (_, callback) => {\n const promises: Promise<any>[] = []\n\n // Clear routes\n if (this.isEdgeServer) {\n pluginState.routeTypes.edge.dynamic = []\n pluginState.routeTypes.edge.static = []\n } else {\n pluginState.routeTypes.node.dynamic = []\n pluginState.routeTypes.node.static = []\n }\n\n compilation.chunkGroups.forEach((chunkGroup) => {\n chunkGroup.chunks.forEach((chunk) => {\n if (!chunk.name) return\n\n // Here we only track page and route chunks.\n if (\n !chunk.name.startsWith('pages/') &&\n !(\n chunk.name.startsWith('app/') &&\n (chunk.name.endsWith('/page') ||\n chunk.name.endsWith('/route'))\n )\n ) {\n return\n }\n\n const chunkModules =\n compilation.chunkGraph.getChunkModulesIterable(\n chunk\n ) as Iterable<webpack.NormalModule>\n for (const mod of chunkModules) {\n promises.push(handleModule(mod, compilation))\n\n // If this is a concatenation, register each child to the parent ID.\n const anyModule = mod as unknown as {\n modules: webpack.NormalModule[]\n }\n if (anyModule.modules) {\n anyModule.modules.forEach((concatenatedMod) => {\n promises.push(handleModule(concatenatedMod, compilation))\n })\n }\n }\n })\n })\n\n await Promise.all(promises)\n\n const rootParams = getRootParamsFromLayouts(\n pluginState.collectedRootParams\n )\n // If we discovered rootParams, we'll override the `next/server` types\n // since we're able to determine the root params at build time.\n if (rootParams.length > 0) {\n const serverTypesPath = path.join(\n assetDirRelative,\n 'types/server.d.ts'\n )\n\n compilation.emitAsset(\n serverTypesPath,\n new sources.RawSource(\n createServerDefinitions(rootParams)\n ) as unknown as webpack.sources.RawSource\n )\n }\n\n // Support `\"moduleResolution\": \"Node16\" | \"NodeNext\"` with `\"type\": \"module\"`\n\n const packageJsonAssetPath = path.join(\n assetDirRelative,\n 'types/package.json'\n )\n\n compilation.emitAsset(\n packageJsonAssetPath,\n new sources.RawSource(\n '{\"type\": \"module\"}'\n ) as unknown as webpack.sources.RawSource\n )\n\n if (this.cacheLifeConfig) {\n const cacheLifeAssetPath = path.join(\n assetDirRelative,\n 'types/cache-life.d.ts'\n )\n\n compilation.emitAsset(\n cacheLifeAssetPath,\n new sources.RawSource(\n createCustomCacheLifeDefinitions(this.cacheLifeConfig)\n ) as unknown as webpack.sources.RawSource\n )\n }\n\n callback()\n }\n )\n })\n }\n}\n"],"names":["NextTypesPlugin","PKG_NAME","require","name","PLUGIN_NAME","createTypeGuardFile","fullPath","relativePath","options","type","HTTP_METHODS","map","method","join","slots","slot","collectNamedSlots","layoutPath","layoutDir","path","dirname","items","fs","readdir","withFileTypes","item","isDirectory","startsWith","push","slice","pluginState","getProxiedPluginState","collectedRootParams","routeTypes","edge","static","dynamic","node","extra","formatRouteToRouteType","route","isDynamic","isDynamicRoute","split","part","endsWith","routeType","formatTimespan","seconds","formatTimespanWithSeconds","undefined","text","descriptive","getRootParamsFromLayouts","layouts","sortedLayouts","Object","entries","sort","a","b","length","rootLayout","rootParams","Set","isMultipleRootLayouts","params","allSegmentsAreDynamic","every","segment","test","isSubpath","param","add","result","Array","from","optional","parentLayoutPath","potentialChildLayoutPath","parentSegments","childSegments","childSegment","index","createServerDefinitions","includes","createCustomCacheLifeDefinitions","cacheLife","overloads","profileNames","keys","i","profileName","profile","description","stale","revalidate","expire","JSON","stringify","appTypesBasePath","constructor","dir","distDir","appDir","dev","isEdgeServer","pageExtensions","pagesDir","cacheLifeConfig","distDirAbsolutePath","getRelativePathFromAppTypesDir","moduleRelativePathToAppDir","moduleAbsolutePath","moduleInAppTypesAbsolutePath","relative","collectPage","filePath","isApp","sep","isPages","normalizeAppPath","denormalizePagePath","ensureLeadingSlash","getPageFromPath","apply","compiler","assetDirRelative","handleModule","mod","compilation","resource","pageExtensionsRegex","RegExp","layer","WEBPACK_LAYERS","reactServerComponents","IS_PRIVATE","replace","IS_LAYOUT","IS_PAGE","IS_ROUTE","IS_IMPORTABLE","relativePathToApp","typePath","relativeImportPath","normalizePathSep","assetPath","rootLayoutPath","foundParams","matchAll","match","emitAsset","sources","RawSource","hooks","tap","processAssets","tapAsync","stage","webpack","Compilation","PROCESS_ASSETS_STAGE_OPTIMIZE_HASH","_","callback","promises","chunkGroups","forEach","chunkGroup","chunks","chunk","chunkModules","chunkGraph","getChunkModulesIterable","anyModule","modules","concatenatedMod","Promise","all","serverTypesPath","packageJsonAssetPath","cacheLifeAssetPath"],"mappings":";;;;+BAgjBaA;;;eAAAA;;;iEA9iBE;yBACkB;6DAChB;2BAEc;qCAIK;oCACD;kCACF;sBACJ;uBACE;0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BAAuBjK,aAAI,CAACN,IAAI,CACpCkH,kBACA;gBAGFG,YAAYsB,SAAS,CACnB4B,sBACA,IAAI3B,gBAAO,CAACC,SAAS,CACnB;gBAIJ,IAAI,IAAI,CAAC7C,eAAe,EAAE;oBACxB,MAAMwE,qBAAqBlK,aAAI,CAACN,IAAI,CAClCkH,kBACA;oBAGFG,YAAYsB,SAAS,CACnB6B,oBACA,IAAI5B,gBAAO,CAACC,SAAS,CACnBpE,iCAAiC,IAAI,CAACuB,eAAe;gBAG3D;gBAEAuD;YACF;QAEJ;IACF;AACF","ignoreList":[0]}
@@ -1678,7 +1678,7 @@ async function getBaseWebpackConfig(dir, { buildId, encryptionKey, config, compi
1678
1678
  isClient && new _copyfileplugin.CopyFilePlugin({
1679
1679
  // file path to build output of `@next/polyfill-nomodule`
1680
1680
  filePath: require.resolve('./polyfills/polyfill-nomodule'),
1681
- cacheKey: "15.6.0-bun.25",
1681
+ cacheKey: "15.6.0-bun.27",
1682
1682
  name: `static/chunks/polyfills${dev ? '' : '-[hash]'}.js`,
1683
1683
  minimize: false,
1684
1684
  info: {
@@ -1859,7 +1859,7 @@ async function getBaseWebpackConfig(dir, { buildId, encryptionKey, config, compi
1859
1859
  // - Next.js location on disk (some loaders use absolute paths and some resolve options depend on absolute paths)
1860
1860
  // - Next.js version
1861
1861
  // - next.config.js keys that affect compilation
1862
- version: `${__dirname}|${"15.6.0-bun.25"}|${configVars}`,
1862
+ version: `${__dirname}|${"15.6.0-bun.27"}|${configVars}`,
1863
1863
  cacheDirectory: _path.default.join(distDir, 'cache', 'webpack'),
1864
1864
  // For production builds, it's more efficient to compress all cache files together instead of compression each one individually.
1865
1865
  // So we disable compression here and allow the build runner to take care of compressing the cache as a whole.
@@ -15,7 +15,7 @@ Object.defineProperty(exports, "appBootstrap", {
15
15
  });
16
16
  const _assetprefix = require("./asset-prefix");
17
17
  const _setattributesfromprops = require("./set-attributes-from-props");
18
- const version = "15.6.0-bun.25";
18
+ const version = "15.6.0-bun.27";
19
19
  window.next = {
20
20
  version,
21
21
  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.6.0-bun.25";
64
+ const version = "15.6.0-bun.27";
65
65
  let router;
66
66
  const emitter = (0, _mitt.default)();
67
67
  const looseToArray = (input)=>[].slice.call(input);