@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
@@ -301,7 +301,7 @@ export default async function build(dir, reactProductionProfiling = false, debug
301
301
  const nextBuildSpan = trace('next-build', undefined, {
302
302
  buildMode: experimentalBuildMode,
303
303
  isTurboBuild: String(isTurbopack),
304
- version: "15.6.0-bun.25"
304
+ version: "15.6.0-bun.27"
305
305
  });
306
306
  NextBuildContext.nextBuildSpan = nextBuildSpan;
307
307
  NextBuildContext.dir = dir;
@@ -780,7 +780,7 @@ export default async function build(dir, reactProductionProfiling = false, debug
780
780
  // Files outside of the distDir can be "type": "module"
781
781
  await writeFileUtf8(path.join(distDir, 'package.json'), '{"type": "commonjs"}');
782
782
  // These are written to distDir, so they need to come after creating and cleaning distDr.
783
- await recordFrameworkVersion("15.6.0-bun.25");
783
+ await recordFrameworkVersion("15.6.0-bun.27");
784
784
  await updateBuildDiagnostics({
785
785
  buildStage: 'start'
786
786
  });
@@ -2425,7 +2425,7 @@ export default async function build(dir, reactProductionProfiling = false, debug
2425
2425
  distDir,
2426
2426
  config,
2427
2427
  staticPages,
2428
- nextVersion: "15.6.0-bun.25",
2428
+ nextVersion: "15.6.0-bun.27",
2429
2429
  tracingRoot: outputFileTracingRoot,
2430
2430
  hasNodeMiddleware,
2431
2431
  hasInstrumentationHook,
@@ -11,7 +11,7 @@ import { isDeepStrictEqual } from 'util';
11
11
  import { getDefineEnv } from '../define-env';
12
12
  import { getReactCompilerLoader } from '../get-babel-loader-config';
13
13
  import { throwTurbopackInternalError } from '../../shared/lib/turbopack/internal-error';
14
- const nextVersion = "15.6.0-bun.25";
14
+ const nextVersion = "15.6.0-bun.27";
15
15
  const ArchName = arch();
16
16
  const PlatformName = platform();
17
17
  function infoLog(...args) {
@@ -2,6 +2,8 @@ import fs from 'fs/promises';
2
2
  import { webpack, sources } from 'next/dist/compiled/webpack/webpack';
3
3
  import path from 'path';
4
4
  import { WEBPACK_LAYERS } from '../../../../lib/constants';
5
+ // Read package name dynamically to support forked packages
6
+ const PKG_NAME = require('../../../../../package.json').name;
5
7
  import { denormalizePagePath } from '../../../../shared/lib/page-path/denormalize-page-path';
6
8
  import { ensureLeadingSlash } from '../../../../shared/lib/page-path/ensure-leading-slash';
7
9
  import { normalizePathSep } from '../../../../shared/lib/page-path/normalize-path-sep';
@@ -14,7 +16,7 @@ const PLUGIN_NAME = 'NextTypesPlugin';
14
16
  function createTypeGuardFile(fullPath, relativePath, options) {
15
17
  return `// File: ${fullPath}
16
18
  import * as entry from '${relativePath}.js'
17
- ${options.type === 'route' ? `import type { NextRequest } from 'next/server.js'` : `import type { ResolvingMetadata, ResolvingViewport } from 'next/dist/lib/metadata/types/metadata-interface.js'`}
19
+ ${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'`}
18
20
 
19
21
  type TEntry = typeof import('${relativePath}.js')
20
22
 
@@ -300,25 +302,25 @@ function isSubpath(parentLayoutPath, potentialChildLayoutPath) {
300
302
  }
301
303
  function createServerDefinitions(rootParams) {
302
304
  return `
303
- declare module 'next/server' {
305
+ declare module '${PKG_NAME}/server' {
304
306
 
305
307
  import type { AsyncLocalStorage as NodeAsyncLocalStorage } from 'async_hooks'
306
308
  declare global {
307
309
  var AsyncLocalStorage: typeof NodeAsyncLocalStorage
308
310
  }
309
- export { NextFetchEvent } from 'next/dist/server/web/spec-extension/fetch-event'
310
- export { NextRequest } from 'next/dist/server/web/spec-extension/request'
311
- export { NextResponse } from 'next/dist/server/web/spec-extension/response'
312
- export { NextMiddleware, MiddlewareConfig } from 'next/dist/server/web/types'
313
- export { userAgentFromString } from 'next/dist/server/web/spec-extension/user-agent'
314
- export { userAgent } from 'next/dist/server/web/spec-extension/user-agent'
315
- export { URLPattern } from 'next/dist/compiled/@edge-runtime/primitives/url'
316
- export { ImageResponse } from 'next/dist/server/web/spec-extension/image-response'
317
- export type { ImageResponseOptions } from 'next/dist/compiled/@vercel/og/types'
318
- export { after } from 'next/dist/server/after'
319
- export { connection } from 'next/dist/server/request/connection'
320
- export type { UnsafeUnwrappedSearchParams } from 'next/dist/server/request/search-params'
321
- export type { UnsafeUnwrappedParams } from 'next/dist/server/request/params'
311
+ export { NextFetchEvent } from '${PKG_NAME}/dist/server/web/spec-extension/fetch-event'
312
+ export { NextRequest } from '${PKG_NAME}/dist/server/web/spec-extension/request'
313
+ export { NextResponse } from '${PKG_NAME}/dist/server/web/spec-extension/response'
314
+ export { NextMiddleware, MiddlewareConfig } from '${PKG_NAME}/dist/server/web/types'
315
+ export { userAgentFromString } from '${PKG_NAME}/dist/server/web/spec-extension/user-agent'
316
+ export { userAgent } from '${PKG_NAME}/dist/server/web/spec-extension/user-agent'
317
+ export { URLPattern } from '${PKG_NAME}/dist/compiled/@edge-runtime/primitives/url'
318
+ export { ImageResponse } from '${PKG_NAME}/dist/server/web/spec-extension/image-response'
319
+ export type { ImageResponseOptions } from '${PKG_NAME}/dist/compiled/@vercel/og/types'
320
+ export { after } from '${PKG_NAME}/dist/server/after'
321
+ export { connection } from '${PKG_NAME}/dist/server/request/connection'
322
+ export type { UnsafeUnwrappedSearchParams } from '${PKG_NAME}/dist/server/request/search-params'
323
+ export type { UnsafeUnwrappedParams } from '${PKG_NAME}/dist/server/request/params'
322
324
  export function unstable_rootParams(): Promise<{ ${rootParams.map(({ param, optional })=>// ensure params with dashes are valid keys
323
325
  `${param.includes('-') ? `'${param}'` : param}${optional ? '?' : ''}: string`).join(', ')} }>
324
326
  }
@@ -412,19 +414,19 @@ function createCustomCacheLifeDefinitions(cacheLife) {
412
414
  // Redefine the cacheLife() accepted arguments.
413
415
  return `// Type definitions for Next.js cacheLife configs
414
416
 
415
- declare module 'next/cache' {
416
- export { unstable_cache } from 'next/dist/server/web/spec-extension/unstable-cache'
417
+ declare module '${PKG_NAME}/cache' {
418
+ export { unstable_cache } from '${PKG_NAME}/dist/server/web/spec-extension/unstable-cache'
417
419
  export {
418
420
  revalidateTag,
419
421
  revalidatePath,
420
422
  unstable_expireTag,
421
423
  unstable_expirePath,
422
- } from 'next/dist/server/web/spec-extension/revalidate'
423
- export { unstable_noStore } from 'next/dist/server/web/spec-extension/unstable-no-store'
424
+ } from '${PKG_NAME}/dist/server/web/spec-extension/revalidate'
425
+ export { unstable_noStore } from '${PKG_NAME}/dist/server/web/spec-extension/unstable-no-store'
424
426
 
425
427
  ${overloads}
426
428
 
427
- export { cacheTag as unstable_cacheTag } from 'next/dist/server/use-cache/cache-tag'
429
+ export { cacheTag as unstable_cacheTag } from '${PKG_NAME}/dist/server/use-cache/cache-tag'
428
430
  }
429
431
  `;
430
432
  }
@@ -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":["fs","webpack","sources","path","WEBPACK_LAYERS","denormalizePagePath","ensureLeadingSlash","normalizePathSep","HTTP_METHODS","isDynamicRoute","normalizeAppPath","getPageFromPath","getProxiedPluginState","PLUGIN_NAME","createTypeGuardFile","fullPath","relativePath","options","type","map","method","join","slots","slot","collectNamedSlots","layoutPath","layoutDir","dirname","items","readdir","withFileTypes","item","isDirectory","name","startsWith","push","slice","pluginState","collectedRootParams","routeTypes","edge","static","dynamic","node","extra","formatRouteToRouteType","route","isDynamic","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","NextTypesPlugin","constructor","dir","distDir","appDir","dev","isEdgeServer","pageExtensions","pagesDir","cacheLifeConfig","distDirAbsolutePath","getRelativePathFromAppTypesDir","moduleRelativePathToAppDir","moduleAbsolutePath","moduleInAppTypesAbsolutePath","relative","collectPage","filePath","isApp","sep","isPages","apply","compiler","assetDirRelative","handleModule","mod","compilation","resource","pageExtensionsRegex","RegExp","layer","reactServerComponents","IS_PRIVATE","replace","IS_LAYOUT","IS_PAGE","IS_ROUTE","IS_IMPORTABLE","relativePathToApp","typePath","relativeImportPath","assetPath","rootLayoutPath","foundParams","matchAll","match","emitAsset","RawSource","hooks","tap","processAssets","tapAsync","stage","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":"AAEA,OAAOA,QAAQ,cAAa;AAC5B,SAASC,OAAO,EAAEC,OAAO,QAAQ,qCAAoC;AACrE,OAAOC,UAAU,OAAM;AAEvB,SAASC,cAAc,QAAQ,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BsI,CAAAA,MAAMvI,IAAI,CAACiB,QAAQ,CAAC,YACnBsH,MAAMvI,IAAI,CAACiB,QAAQ,CAAC,SAAQ,CAAC,GAEjC;4BACA;wBACF;wBAEA,MAAMuH,eACJrC,YAAYsC,UAAU,CAACC,uBAAuB,CAC5CH;wBAEJ,KAAK,MAAMrC,OAAOsC,aAAc;4BAC9BN,SAAShI,IAAI,CAAC+F,aAAaC,KAAKC;4BAEhC,oEAAoE;4BACpE,MAAMwC,YAAYzC;4BAGlB,IAAIyC,UAAUC,OAAO,EAAE;gCACrBD,UAAUC,OAAO,CAACR,OAAO,CAAC,CAACS;oCACzBX,SAAShI,IAAI,CAAC+F,aAAa4C,iBAAiB1C;gCAC9C;4BACF;wBACF;oBACF;gBACF;gBAEA,MAAM2C,QAAQC,GAAG,CAACb;gBAElB,MAAM/F,aAAaV,yBACjBrB,YAAYC,mBAAmB;gBAEjC,sEAAsE;gBACtE,+DAA+D;gBAC/D,IAAI8B,WAAWF,MAAM,GAAG,GAAG;oBACzB,MAAM+G,kBAAkB9K,KAAKkB,IAAI,CAC/B4G,kBACA;oBAGFG,YAAYoB,SAAS,CACnByB,iBACA,IAAI/K,QAAQuJ,SAAS,CACnBhE,wBAAwBrB;gBAG9B;gBAEA,8EAA8E;gBAE9E,MAAM8G,uBAAuB/K,KAAKkB,IAAI,CACpC4G,kBACA;gBAGFG,YAAYoB,SAAS,CACnB0B,sBACA,IAAIhL,QAAQuJ,SAAS,CACnB;gBAIJ,IAAI,IAAI,CAACtC,eAAe,EAAE;oBACxB,MAAMgE,qBAAqBhL,KAAKkB,IAAI,CAClC4G,kBACA;oBAGFG,YAAYoB,SAAS,CACnB2B,oBACA,IAAIjL,QAAQuJ,SAAS,CACnB9D,iCAAiC,IAAI,CAACwB,eAAe;gBAG3D;gBAEA+C;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":["fs","webpack","sources","path","WEBPACK_LAYERS","PKG_NAME","require","name","denormalizePagePath","ensureLeadingSlash","normalizePathSep","HTTP_METHODS","isDynamicRoute","normalizeAppPath","getPageFromPath","getProxiedPluginState","PLUGIN_NAME","createTypeGuardFile","fullPath","relativePath","options","type","map","method","join","slots","slot","collectNamedSlots","layoutPath","layoutDir","dirname","items","readdir","withFileTypes","item","isDirectory","startsWith","push","slice","pluginState","collectedRootParams","routeTypes","edge","static","dynamic","node","extra","formatRouteToRouteType","route","isDynamic","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","NextTypesPlugin","constructor","dir","distDir","appDir","dev","isEdgeServer","pageExtensions","pagesDir","cacheLifeConfig","distDirAbsolutePath","getRelativePathFromAppTypesDir","moduleRelativePathToAppDir","moduleAbsolutePath","moduleInAppTypesAbsolutePath","relative","collectPage","filePath","isApp","sep","isPages","apply","compiler","assetDirRelative","handleModule","mod","compilation","resource","pageExtensionsRegex","RegExp","layer","reactServerComponents","IS_PRIVATE","replace","IS_LAYOUT","IS_PAGE","IS_ROUTE","IS_IMPORTABLE","relativePathToApp","typePath","relativeImportPath","assetPath","rootLayoutPath","foundParams","matchAll","match","emitAsset","RawSource","hooks","tap","processAssets","tapAsync","stage","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":"AAEA,OAAOA,QAAQ,cAAa;AAC5B,SAASC,OAAO,EAAEC,OAAO,QAAQ,qCAAoC;AACrE,OAAOC,UAAU,OAAM;AAEvB,SAASC,cAAc,QAAQ,4BAA2B;AAE1D,2DAA2D;AAC3D,MAAMC,WAAWC,QAAQ,+BAA+BC,IAAI;AAC5D,SAASC,mBAAmB,QAAQ,yDAAwD;AAC5F,SAASC,kBAAkB,QAAQ,wDAAuD;AAC1F,SAASC,gBAAgB,QAAQ,sDAAqD;AACtF,SAASC,YAAY,QAAQ,8BAA6B;AAC1D,SAASC,cAAc,QAAQ,sCAAqC;AACpE,SAASC,gBAAgB,QAAQ,gDAA+C;AAChF,SAASC,eAAe,QAAQ,mBAAkB;AAElD,SAASC,qBAAqB,QAAQ,yBAAwB;AAG9D,MAAMC,cAAc;AAoBpB,SAASC,oBACPC,QAAgB,EAChBC,YAAoB,EACpBC,OAGC;IAED,OAAO,CAAC,SAAS,EAAEF,SAAS;wBACN,EAAEC,aAAa;AACvC,EACEC,QAAQC,IAAI,KA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AAQ,CAAC,YACnBsH,MAAMnK,IAAI,CAAC6C,QAAQ,CAAC,SAAQ,CAAC,GAEjC;4BACA;wBACF;wBAEA,MAAMuH,eACJrC,YAAYsC,UAAU,CAACC,uBAAuB,CAC5CH;wBAEJ,KAAK,MAAMrC,OAAOsC,aAAc;4BAC9BN,SAAShI,IAAI,CAAC+F,aAAaC,KAAKC;4BAEhC,oEAAoE;4BACpE,MAAMwC,YAAYzC;4BAGlB,IAAIyC,UAAUC,OAAO,EAAE;gCACrBD,UAAUC,OAAO,CAACR,OAAO,CAAC,CAACS;oCACzBX,SAAShI,IAAI,CAAC+F,aAAa4C,iBAAiB1C;gCAC9C;4BACF;wBACF;oBACF;gBACF;gBAEA,MAAM2C,QAAQC,GAAG,CAACb;gBAElB,MAAM/F,aAAaV,yBACjBrB,YAAYC,mBAAmB;gBAEjC,sEAAsE;gBACtE,+DAA+D;gBAC/D,IAAI8B,WAAWF,MAAM,GAAG,GAAG;oBACzB,MAAM+G,kBAAkBhL,KAAKqB,IAAI,CAC/B2G,kBACA;oBAGFG,YAAYoB,SAAS,CACnByB,iBACA,IAAIjL,QAAQyJ,SAAS,CACnBhE,wBAAwBrB;gBAG9B;gBAEA,8EAA8E;gBAE9E,MAAM8G,uBAAuBjL,KAAKqB,IAAI,CACpC2G,kBACA;gBAGFG,YAAYoB,SAAS,CACnB0B,sBACA,IAAIlL,QAAQyJ,SAAS,CACnB;gBAIJ,IAAI,IAAI,CAACtC,eAAe,EAAE;oBACxB,MAAMgE,qBAAqBlL,KAAKqB,IAAI,CAClC2G,kBACA;oBAGFG,YAAYoB,SAAS,CACnB2B,oBACA,IAAInL,QAAQyJ,SAAS,CACnB9D,iCAAiC,IAAI,CAACwB,eAAe;gBAG3D;gBAEA+C;YACF;QAEJ;IACF;AACF","ignoreList":[0]}
@@ -1575,7 +1575,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
1575
1575
  isClient && new CopyFilePlugin({
1576
1576
  // file path to build output of `@next/polyfill-nomodule`
1577
1577
  filePath: require.resolve('./polyfills/polyfill-nomodule'),
1578
- cacheKey: "15.6.0-bun.25",
1578
+ cacheKey: "15.6.0-bun.27",
1579
1579
  name: `static/chunks/polyfills${dev ? '' : '-[hash]'}.js`,
1580
1580
  minimize: false,
1581
1581
  info: {
@@ -1756,7 +1756,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
1756
1756
  // - Next.js location on disk (some loaders use absolute paths and some resolve options depend on absolute paths)
1757
1757
  // - Next.js version
1758
1758
  // - next.config.js keys that affect compilation
1759
- version: `${__dirname}|${"15.6.0-bun.25"}|${configVars}`,
1759
+ version: `${__dirname}|${"15.6.0-bun.27"}|${configVars}`,
1760
1760
  cacheDirectory: path.join(distDir, 'cache', 'webpack'),
1761
1761
  // For production builds, it's more efficient to compress all cache files together instead of compression each one individually.
1762
1762
  // So we disable compression here and allow the build runner to take care of compressing the cache as a whole.
@@ -5,7 +5,7 @@
5
5
  * - next/script with `beforeInteractive` strategy
6
6
  */ import { getAssetPrefix } from './asset-prefix';
7
7
  import { setAttributesFromProps } from './set-attributes-from-props';
8
- const version = "15.6.0-bun.25";
8
+ const version = "15.6.0-bun.27";
9
9
  window.next = {
10
10
  version,
11
11
  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.6.0-bun.25";
29
+ export const version = "15.6.0-bun.27";
30
30
  export let router;
31
31
  export const emitter = mitt();
32
32
  const looseToArray = (input)=>[].slice.call(input);
@@ -227,6 +227,11 @@ export async function writeConfigurationDefaults(ts, tsConfigPath, isFirstTimeSe
227
227
  if (!userTsConfig.compilerOptions) {
228
228
  userTsConfig.compilerOptions = {};
229
229
  }
230
+ // baseUrl is required for path mappings to work correctly
231
+ if (!userTsConfig.compilerOptions.baseUrl) {
232
+ userTsConfig.compilerOptions.baseUrl = '.';
233
+ suggestedActions.push(cyan('baseUrl') + ' was set to ' + bold(`"."`) + ' (required for path mappings)');
234
+ }
230
235
  if (!userTsConfig.compilerOptions.paths) {
231
236
  userTsConfig.compilerOptions.paths = {};
232
237
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/typescript/writeConfigurationDefaults.ts"],"sourcesContent":["import { promises as fs } from 'fs'\nimport { bold, cyan, white } from '../picocolors'\nimport * as CommentJson from 'next/dist/compiled/comment-json'\nimport semver from 'next/dist/compiled/semver'\nimport os from 'os'\nimport path from 'path'\nimport type { CompilerOptions } from 'typescript'\nimport { getTypeScriptConfiguration } from './getTypeScriptConfiguration'\nimport * as Log from '../../build/output/log'\n\n// Read package name dynamically to support forked packages\n// From dist/lib/typescript, go up 3 levels to reach package root\nconst PKG_NAME = require(path.join(__dirname, '../../../package.json')).name\n\ntype DesiredCompilerOptionsShape = {\n [K in keyof CompilerOptions]:\n | { suggested: any; reason?: string }\n | {\n parsedValue?: any\n parsedValues?: Array<any>\n value: any\n reason: string\n }\n}\n\nfunction getDesiredCompilerOptions(\n ts: typeof import('typescript'),\n tsOptions?: CompilerOptions\n): DesiredCompilerOptionsShape {\n const o: DesiredCompilerOptionsShape = {\n target: {\n suggested: 'ES2017',\n reason:\n 'For top-level `await`. Note: Next.js only polyfills for the esmodules target.',\n },\n // These are suggested values and will be set when not present in the\n // tsconfig.json\n lib: { suggested: ['dom', 'dom.iterable', 'esnext'] },\n allowJs: { suggested: true },\n skipLibCheck: { suggested: true },\n strict: { suggested: false },\n ...(semver.lt(ts.version, '5.0.0')\n ? { forceConsistentCasingInFileNames: { suggested: true } }\n : undefined),\n noEmit: { suggested: true },\n ...(semver.gte(ts.version, '4.4.2')\n ? { incremental: { suggested: true } }\n : undefined),\n\n // These values are required and cannot be changed by the user\n // Keep this in sync with the webpack config\n // 'parsedValue' matches the output value from ts.parseJsonConfigFileContent()\n module: {\n parsedValue: ts.ModuleKind.ESNext,\n // All of these values work:\n parsedValues: [\n semver.gte(ts.version, '5.4.0') && (ts.ModuleKind as any).Preserve,\n ts.ModuleKind.ES2020,\n ts.ModuleKind.ESNext,\n ts.ModuleKind.CommonJS,\n ts.ModuleKind.AMD,\n ts.ModuleKind.NodeNext,\n ts.ModuleKind.Node16,\n ],\n value: 'esnext',\n reason: 'for dynamic import() support',\n },\n // TODO: Semver check not needed once Next.js repo uses 5.4.\n ...(semver.gte(ts.version, '5.4.0') &&\n tsOptions?.module === (ts.ModuleKind as any).Preserve\n ? {\n // TypeScript 5.4 introduced `Preserve`. Using `Preserve` implies\n // - `moduleResolution` is `Bundler`\n // - `esModuleInterop` is `true`\n // - `resolveJsonModule` is `true`\n // This means that if the user is using Preserve, they don't need these options\n }\n : {\n esModuleInterop: {\n value: true,\n reason: 'requirement for SWC / babel',\n },\n moduleResolution: {\n // In TypeScript 5.0, `NodeJs` has renamed to `Node10`\n parsedValue:\n ts.ModuleResolutionKind.Bundler ??\n ts.ModuleResolutionKind.NodeNext ??\n (ts.ModuleResolutionKind as any).Node10 ??\n ts.ModuleResolutionKind.NodeJs,\n // All of these values work:\n parsedValues: [\n (ts.ModuleResolutionKind as any).Node10 ??\n ts.ModuleResolutionKind.NodeJs,\n // only newer TypeScript versions have this field, it\n // will be filtered for new versions of TypeScript\n (ts.ModuleResolutionKind as any).Node12,\n ts.ModuleResolutionKind.Node16,\n ts.ModuleResolutionKind.NodeNext,\n ts.ModuleResolutionKind.Bundler,\n ].filter((val) => typeof val !== 'undefined'),\n value: 'node',\n reason: 'to match webpack resolution',\n },\n resolveJsonModule: {\n value: true,\n reason: 'to match webpack resolution',\n },\n }),\n ...(tsOptions?.verbatimModuleSyntax === true\n ? undefined\n : {\n isolatedModules: {\n value: true,\n reason: 'requirement for SWC / Babel',\n },\n }),\n jsx: {\n parsedValue: ts.JsxEmit.ReactJSX,\n value: 'react-jsx',\n reason: 'next.js uses the React automatic runtime',\n },\n }\n\n return o\n}\n\nexport function getRequiredConfiguration(\n ts: typeof import('typescript')\n): Partial<import('typescript').CompilerOptions> {\n const res: Partial<import('typescript').CompilerOptions> = {}\n\n const desiredCompilerOptions = getDesiredCompilerOptions(ts)\n for (const optionKey of Object.keys(desiredCompilerOptions)) {\n const ev = desiredCompilerOptions[optionKey]\n if (!('value' in ev)) {\n continue\n }\n res[optionKey] = ev.parsedValue ?? ev.value\n }\n\n return res\n}\n\nconst localDevTestFilesExcludeAction =\n 'NEXT_PRIVATE_LOCAL_DEV_TEST_FILES_EXCLUDE'\n\nexport async function writeConfigurationDefaults(\n ts: typeof import('typescript'),\n tsConfigPath: string,\n isFirstTimeSetup: boolean,\n hasAppDir: boolean,\n distDir: string,\n hasPagesDir: boolean\n): Promise<void> {\n if (isFirstTimeSetup) {\n await fs.writeFile(tsConfigPath, '{}' + os.EOL)\n }\n\n const { options: tsOptions, raw: rawConfig } =\n await getTypeScriptConfiguration(ts, tsConfigPath, true)\n\n const userTsConfigContent = await fs.readFile(tsConfigPath, {\n encoding: 'utf8',\n })\n const userTsConfig = CommentJson.parse(userTsConfigContent)\n if (userTsConfig.compilerOptions == null && !('extends' in rawConfig)) {\n userTsConfig.compilerOptions = {}\n isFirstTimeSetup = true\n }\n\n const desiredCompilerOptions = getDesiredCompilerOptions(ts, tsOptions)\n\n const suggestedActions: string[] = []\n const requiredActions: string[] = []\n for (const optionKey of Object.keys(desiredCompilerOptions)) {\n const check = desiredCompilerOptions[optionKey]\n if ('suggested' in check) {\n if (!(optionKey in tsOptions)) {\n if (!userTsConfig.compilerOptions) {\n userTsConfig.compilerOptions = {}\n }\n userTsConfig.compilerOptions[optionKey] = check.suggested\n suggestedActions.push(\n cyan(optionKey) +\n ' was set to ' +\n bold(check.suggested) +\n (check.reason ? ` (${check.reason})` : '')\n )\n }\n } else if ('value' in check) {\n const ev = tsOptions[optionKey]\n if (\n !('parsedValues' in check\n ? check.parsedValues?.includes(ev)\n : 'parsedValue' in check\n ? check.parsedValue === ev\n : check.value === ev)\n ) {\n if (!userTsConfig.compilerOptions) {\n userTsConfig.compilerOptions = {}\n }\n userTsConfig.compilerOptions[optionKey] = check.value\n requiredActions.push(\n cyan(optionKey) +\n ' was set to ' +\n bold(check.value) +\n ` (${check.reason})`\n )\n }\n } else {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const _: never = check\n }\n }\n\n const nextAppTypes = `${distDir}/types/**/*.ts`\n\n if (!('include' in rawConfig)) {\n userTsConfig.include = hasAppDir\n ? ['next-env.d.ts', nextAppTypes, '**/*.ts', '**/*.tsx']\n : ['next-env.d.ts', '**/*.ts', '**/*.tsx']\n suggestedActions.push(\n cyan('include') +\n ' was set to ' +\n bold(\n hasAppDir\n ? `['next-env.d.ts', '${nextAppTypes}', '**/*.ts', '**/*.tsx']`\n : `['next-env.d.ts', '**/*.ts', '**/*.tsx']`\n )\n )\n } else if (hasAppDir && !rawConfig.include.includes(nextAppTypes)) {\n if (!Array.isArray(userTsConfig.include)) {\n userTsConfig.include = []\n }\n // rawConfig will resolve all extends and include paths (ex: tsconfig.json, tsconfig.base.json, etc.)\n // if it doesn't match userTsConfig then update the userTsConfig to add the\n // rawConfig's includes in addition to nextAppTypes\n if (\n rawConfig.include.length !== userTsConfig.include.length ||\n JSON.stringify(rawConfig.include.sort()) !==\n JSON.stringify(userTsConfig.include.sort())\n ) {\n userTsConfig.include.push(...rawConfig.include, nextAppTypes)\n suggestedActions.push(\n cyan('include') +\n ' was set to ' +\n bold(\n `[${[...rawConfig.include, nextAppTypes]\n .map((i) => `'${i}'`)\n .join(', ')}]`\n )\n )\n } else {\n userTsConfig.include.push(nextAppTypes)\n suggestedActions.push(\n cyan('include') + ' was updated to add ' + bold(`'${nextAppTypes}'`)\n )\n }\n }\n\n // Enable the Next.js typescript plugin.\n if (hasAppDir) {\n // Check if the config or the resolved config has the plugin already.\n const plugins = [\n ...(Array.isArray(tsOptions.plugins) ? tsOptions.plugins : []),\n ...(userTsConfig.compilerOptions &&\n Array.isArray(userTsConfig.compilerOptions.plugins)\n ? userTsConfig.compilerOptions.plugins\n : []),\n ]\n const hasNextPlugin = plugins.some(\n ({ name }: { name: string }) => name === 'next'\n )\n\n // If the TS config extends on another config, we can't add the `plugin` field\n // because that will override the parent config's plugins.\n // Instead we have to show a message to the user to add the plugin manually.\n if (\n !userTsConfig.compilerOptions ||\n (plugins.length &&\n !hasNextPlugin &&\n 'extends' in rawConfig &&\n (!rawConfig.compilerOptions || !rawConfig.compilerOptions.plugins))\n ) {\n Log.info(\n `\\nYour ${bold(\n 'tsconfig.json'\n )} extends another configuration, which means we cannot add the Next.js TypeScript plugin automatically. To improve your development experience, we recommend adding the Next.js plugin (\\`${cyan(\n '\"plugins\": [{ \"name\": \"next\" }]'\n )}\\`) manually to your TypeScript configuration. Learn more: https://nextjs.org/docs/app/api-reference/config/typescript#the-typescript-plugin\\n`\n )\n } else if (!hasNextPlugin) {\n if (!('plugins' in userTsConfig.compilerOptions)) {\n userTsConfig.compilerOptions.plugins = []\n }\n userTsConfig.compilerOptions.plugins.push({ name: 'next' })\n suggestedActions.push(\n cyan('plugins') + ' was updated to add ' + bold(`{ name: 'next' }`)\n )\n }\n\n // If `strict` is set to `false` and `strictNullChecks` is set to `false`,\n // then set `strictNullChecks` to `true`.\n if (\n hasPagesDir &&\n hasAppDir &&\n !tsOptions.strict &&\n !('strictNullChecks' in tsOptions)\n ) {\n userTsConfig.compilerOptions.strictNullChecks = true\n suggestedActions.push(\n cyan('strictNullChecks') + ' was set to ' + bold(`true`)\n )\n }\n }\n\n // If the package name is not 'next', add a path mapping to redirect 'next' imports\n // to the actual package name. This is necessary for forked packages.\n if (PKG_NAME !== 'next') {\n if (!userTsConfig.compilerOptions) {\n userTsConfig.compilerOptions = {}\n }\n if (!userTsConfig.compilerOptions.paths) {\n userTsConfig.compilerOptions.paths = {}\n }\n\n // Add path mapping for 'next' and 'next/*' to redirect to the actual package\n const nextMapping = `${PKG_NAME}`\n const nextWildcardMapping = `${PKG_NAME}/*`\n\n if (!userTsConfig.compilerOptions.paths['next']) {\n userTsConfig.compilerOptions.paths['next'] = [nextMapping]\n suggestedActions.push(\n cyan('paths[\"next\"]') + ' was set to ' + bold(`[\"${nextMapping}\"]`) +\n ' (for forked package support)'\n )\n }\n\n if (!userTsConfig.compilerOptions.paths['next/*']) {\n userTsConfig.compilerOptions.paths['next/*'] = [nextWildcardMapping]\n suggestedActions.push(\n cyan('paths[\"next/*\"]') + ' was set to ' + bold(`[\"${nextWildcardMapping}\"]`) +\n ' (for forked package support)'\n )\n }\n }\n\n if (!('exclude' in rawConfig)) {\n userTsConfig.exclude = ['node_modules']\n suggestedActions.push(\n cyan('exclude') + ' was set to ' + bold(`['node_modules']`)\n )\n }\n\n // During local development inside Next.js repo, exclude the test files coverage by the local tsconfig\n if (process.env.NEXT_PRIVATE_LOCAL_DEV && userTsConfig.exclude) {\n const tsGlob = '**/*.test.ts'\n const tsxGlob = '**/*.test.tsx'\n let hasUpdates = false\n if (!userTsConfig.exclude.includes(tsGlob)) {\n userTsConfig.exclude.push(tsGlob)\n hasUpdates = true\n }\n if (!userTsConfig.exclude.includes(tsxGlob)) {\n userTsConfig.exclude.push(tsxGlob)\n hasUpdates = true\n }\n\n if (hasUpdates) {\n requiredActions.push(localDevTestFilesExcludeAction)\n }\n }\n\n if (suggestedActions.length < 1 && requiredActions.length < 1) {\n return\n }\n\n await fs.writeFile(\n tsConfigPath,\n CommentJson.stringify(userTsConfig, null, 2) + os.EOL\n )\n\n Log.info('')\n if (isFirstTimeSetup) {\n Log.info(\n `We detected TypeScript in your project and created a ${cyan(\n 'tsconfig.json'\n )} file for you.`\n )\n return\n }\n\n Log.info(\n `We detected TypeScript in your project and reconfigured your ${cyan(\n 'tsconfig.json'\n )} file for you.${\n userTsConfig.compilerOptions?.strict\n ? ''\n : ` Strict-mode is set to ${cyan('false')} by default.`\n }`\n )\n\n if (suggestedActions.length) {\n Log.info(\n `The following suggested values were added to your ${cyan(\n 'tsconfig.json'\n )}. These values ${cyan('can be changed')} to fit your project's needs:\\n`\n )\n\n suggestedActions.forEach((action) => Log.info(`\\t- ${action}`))\n\n Log.info('')\n }\n\n const requiredActionsToBeLogged = process.env.NEXT_PRIVATE_LOCAL_DEV\n ? requiredActions.filter(\n (action) => action !== localDevTestFilesExcludeAction\n )\n : requiredActions\n\n if (requiredActionsToBeLogged.length) {\n Log.info(\n `The following ${white('mandatory changes')} were made to your ${cyan(\n 'tsconfig.json'\n )}:\\n`\n )\n\n requiredActionsToBeLogged.forEach((action) => Log.info(`\\t- ${action}`))\n\n Log.info('')\n }\n}\n"],"names":["promises","fs","bold","cyan","white","CommentJson","semver","os","path","getTypeScriptConfiguration","Log","PKG_NAME","require","join","__dirname","name","getDesiredCompilerOptions","ts","tsOptions","o","target","suggested","reason","lib","allowJs","skipLibCheck","strict","lt","version","forceConsistentCasingInFileNames","undefined","noEmit","gte","incremental","module","parsedValue","ModuleKind","ESNext","parsedValues","Preserve","ES2020","CommonJS","AMD","NodeNext","Node16","value","esModuleInterop","moduleResolution","ModuleResolutionKind","Bundler","Node10","NodeJs","Node12","filter","val","resolveJsonModule","verbatimModuleSyntax","isolatedModules","jsx","JsxEmit","ReactJSX","getRequiredConfiguration","res","desiredCompilerOptions","optionKey","Object","keys","ev","localDevTestFilesExcludeAction","writeConfigurationDefaults","tsConfigPath","isFirstTimeSetup","hasAppDir","distDir","hasPagesDir","userTsConfig","writeFile","EOL","options","raw","rawConfig","userTsConfigContent","readFile","encoding","parse","compilerOptions","suggestedActions","requiredActions","check","push","includes","_","nextAppTypes","include","Array","isArray","length","JSON","stringify","sort","map","i","plugins","hasNextPlugin","some","info","strictNullChecks","paths","nextMapping","nextWildcardMapping","exclude","process","env","NEXT_PRIVATE_LOCAL_DEV","tsGlob","tsxGlob","hasUpdates","forEach","action","requiredActionsToBeLogged"],"mappings":"AAAA,SAASA,YAAYC,EAAE,QAAQ,KAAI;AACnC,SAASC,IAAI,EAAEC,IAAI,EAAEC,KAAK,QAAQ,gBAAe;A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pB7D,IAAI+F,IAAI,CACN,CAAC,qDAAqD,EAAEtG,KACtD,iBACA,cAAc,CAAC;QAEnB;IACF;IAEAO,IAAI+F,IAAI,CACN,CAAC,6DAA6D,EAAEtG,KAC9D,iBACA,cAAc,EACdwE,EAAAA,gCAAAA,aAAaU,eAAe,qBAA5BV,8BAA8BjD,MAAM,IAChC,KACA,CAAC,uBAAuB,EAAEvB,KAAK,SAAS,YAAY,CAAC,EACzD;IAGJ,IAAImF,iBAAiBU,MAAM,EAAE;QAC3BtF,IAAI+F,IAAI,CACN,CAAC,kDAAkD,EAAEtG,KACnD,iBACA,eAAe,EAAEA,KAAK,kBAAkB,+BAA+B,CAAC;QAG5EmF,iBAAiB+B,OAAO,CAAC,CAACC,SAAW5G,IAAI+F,IAAI,CAAC,CAAC,IAAI,EAAEa,QAAQ;QAE7D5G,IAAI+F,IAAI,CAAC;IACX;IAEA,MAAMc,4BAA4BR,QAAQC,GAAG,CAACC,sBAAsB,GAChE1B,gBAAgBlC,MAAM,CACpB,CAACiE,SAAWA,WAAWlD,kCAEzBmB;IAEJ,IAAIgC,0BAA0BvB,MAAM,EAAE;QACpCtF,IAAI+F,IAAI,CACN,CAAC,cAAc,EAAErG,MAAM,qBAAqB,mBAAmB,EAAED,KAC/D,iBACA,GAAG,CAAC;QAGRoH,0BAA0BF,OAAO,CAAC,CAACC,SAAW5G,IAAI+F,IAAI,CAAC,CAAC,IAAI,EAAEa,QAAQ;QAEtE5G,IAAI+F,IAAI,CAAC;IACX;AACF","ignoreList":[0]}
1
+ {"version":3,"sources":["../../../src/lib/typescript/writeConfigurationDefaults.ts"],"sourcesContent":["import { promises as fs } from 'fs'\nimport { bold, cyan, white } from '../picocolors'\nimport * as CommentJson from 'next/dist/compiled/comment-json'\nimport semver from 'next/dist/compiled/semver'\nimport os from 'os'\nimport path from 'path'\nimport type { CompilerOptions } from 'typescript'\nimport { getTypeScriptConfiguration } from './getTypeScriptConfiguration'\nimport * as Log from '../../build/output/log'\n\n// Read package name dynamically to support forked packages\n// From dist/lib/typescript, go up 3 levels to reach package root\nconst PKG_NAME = require(path.join(__dirname, '../../../package.json')).name\n\ntype DesiredCompilerOptionsShape = {\n [K in keyof CompilerOptions]:\n | { suggested: any; reason?: string }\n | {\n parsedValue?: any\n parsedValues?: Array<any>\n value: any\n reason: string\n }\n}\n\nfunction getDesiredCompilerOptions(\n ts: typeof import('typescript'),\n tsOptions?: CompilerOptions\n): DesiredCompilerOptionsShape {\n const o: DesiredCompilerOptionsShape = {\n target: {\n suggested: 'ES2017',\n reason:\n 'For top-level `await`. Note: Next.js only polyfills for the esmodules target.',\n },\n // These are suggested values and will be set when not present in the\n // tsconfig.json\n lib: { suggested: ['dom', 'dom.iterable', 'esnext'] },\n allowJs: { suggested: true },\n skipLibCheck: { suggested: true },\n strict: { suggested: false },\n ...(semver.lt(ts.version, '5.0.0')\n ? { forceConsistentCasingInFileNames: { suggested: true } }\n : undefined),\n noEmit: { suggested: true },\n ...(semver.gte(ts.version, '4.4.2')\n ? { incremental: { suggested: true } }\n : undefined),\n\n // These values are required and cannot be changed by the user\n // Keep this in sync with the webpack config\n // 'parsedValue' matches the output value from ts.parseJsonConfigFileContent()\n module: {\n parsedValue: ts.ModuleKind.ESNext,\n // All of these values work:\n parsedValues: [\n semver.gte(ts.version, '5.4.0') && (ts.ModuleKind as any).Preserve,\n ts.ModuleKind.ES2020,\n ts.ModuleKind.ESNext,\n ts.ModuleKind.CommonJS,\n ts.ModuleKind.AMD,\n ts.ModuleKind.NodeNext,\n ts.ModuleKind.Node16,\n ],\n value: 'esnext',\n reason: 'for dynamic import() support',\n },\n // TODO: Semver check not needed once Next.js repo uses 5.4.\n ...(semver.gte(ts.version, '5.4.0') &&\n tsOptions?.module === (ts.ModuleKind as any).Preserve\n ? {\n // TypeScript 5.4 introduced `Preserve`. Using `Preserve` implies\n // - `moduleResolution` is `Bundler`\n // - `esModuleInterop` is `true`\n // - `resolveJsonModule` is `true`\n // This means that if the user is using Preserve, they don't need these options\n }\n : {\n esModuleInterop: {\n value: true,\n reason: 'requirement for SWC / babel',\n },\n moduleResolution: {\n // In TypeScript 5.0, `NodeJs` has renamed to `Node10`\n parsedValue:\n ts.ModuleResolutionKind.Bundler ??\n ts.ModuleResolutionKind.NodeNext ??\n (ts.ModuleResolutionKind as any).Node10 ??\n ts.ModuleResolutionKind.NodeJs,\n // All of these values work:\n parsedValues: [\n (ts.ModuleResolutionKind as any).Node10 ??\n ts.ModuleResolutionKind.NodeJs,\n // only newer TypeScript versions have this field, it\n // will be filtered for new versions of TypeScript\n (ts.ModuleResolutionKind as any).Node12,\n ts.ModuleResolutionKind.Node16,\n ts.ModuleResolutionKind.NodeNext,\n ts.ModuleResolutionKind.Bundler,\n ].filter((val) => typeof val !== 'undefined'),\n value: 'node',\n reason: 'to match webpack resolution',\n },\n resolveJsonModule: {\n value: true,\n reason: 'to match webpack resolution',\n },\n }),\n ...(tsOptions?.verbatimModuleSyntax === true\n ? undefined\n : {\n isolatedModules: {\n value: true,\n reason: 'requirement for SWC / Babel',\n },\n }),\n jsx: {\n parsedValue: ts.JsxEmit.ReactJSX,\n value: 'react-jsx',\n reason: 'next.js uses the React automatic runtime',\n },\n }\n\n return o\n}\n\nexport function getRequiredConfiguration(\n ts: typeof import('typescript')\n): Partial<import('typescript').CompilerOptions> {\n const res: Partial<import('typescript').CompilerOptions> = {}\n\n const desiredCompilerOptions = getDesiredCompilerOptions(ts)\n for (const optionKey of Object.keys(desiredCompilerOptions)) {\n const ev = desiredCompilerOptions[optionKey]\n if (!('value' in ev)) {\n continue\n }\n res[optionKey] = ev.parsedValue ?? ev.value\n }\n\n return res\n}\n\nconst localDevTestFilesExcludeAction =\n 'NEXT_PRIVATE_LOCAL_DEV_TEST_FILES_EXCLUDE'\n\nexport async function writeConfigurationDefaults(\n ts: typeof import('typescript'),\n tsConfigPath: string,\n isFirstTimeSetup: boolean,\n hasAppDir: boolean,\n distDir: string,\n hasPagesDir: boolean\n): Promise<void> {\n if (isFirstTimeSetup) {\n await fs.writeFile(tsConfigPath, '{}' + os.EOL)\n }\n\n const { options: tsOptions, raw: rawConfig } =\n await getTypeScriptConfiguration(ts, tsConfigPath, true)\n\n const userTsConfigContent = await fs.readFile(tsConfigPath, {\n encoding: 'utf8',\n })\n const userTsConfig = CommentJson.parse(userTsConfigContent)\n if (userTsConfig.compilerOptions == null && !('extends' in rawConfig)) {\n userTsConfig.compilerOptions = {}\n isFirstTimeSetup = true\n }\n\n const desiredCompilerOptions = getDesiredCompilerOptions(ts, tsOptions)\n\n const suggestedActions: string[] = []\n const requiredActions: string[] = []\n for (const optionKey of Object.keys(desiredCompilerOptions)) {\n const check = desiredCompilerOptions[optionKey]\n if ('suggested' in check) {\n if (!(optionKey in tsOptions)) {\n if (!userTsConfig.compilerOptions) {\n userTsConfig.compilerOptions = {}\n }\n userTsConfig.compilerOptions[optionKey] = check.suggested\n suggestedActions.push(\n cyan(optionKey) +\n ' was set to ' +\n bold(check.suggested) +\n (check.reason ? ` (${check.reason})` : '')\n )\n }\n } else if ('value' in check) {\n const ev = tsOptions[optionKey]\n if (\n !('parsedValues' in check\n ? check.parsedValues?.includes(ev)\n : 'parsedValue' in check\n ? check.parsedValue === ev\n : check.value === ev)\n ) {\n if (!userTsConfig.compilerOptions) {\n userTsConfig.compilerOptions = {}\n }\n userTsConfig.compilerOptions[optionKey] = check.value\n requiredActions.push(\n cyan(optionKey) +\n ' was set to ' +\n bold(check.value) +\n ` (${check.reason})`\n )\n }\n } else {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const _: never = check\n }\n }\n\n const nextAppTypes = `${distDir}/types/**/*.ts`\n\n if (!('include' in rawConfig)) {\n userTsConfig.include = hasAppDir\n ? ['next-env.d.ts', nextAppTypes, '**/*.ts', '**/*.tsx']\n : ['next-env.d.ts', '**/*.ts', '**/*.tsx']\n suggestedActions.push(\n cyan('include') +\n ' was set to ' +\n bold(\n hasAppDir\n ? `['next-env.d.ts', '${nextAppTypes}', '**/*.ts', '**/*.tsx']`\n : `['next-env.d.ts', '**/*.ts', '**/*.tsx']`\n )\n )\n } else if (hasAppDir && !rawConfig.include.includes(nextAppTypes)) {\n if (!Array.isArray(userTsConfig.include)) {\n userTsConfig.include = []\n }\n // rawConfig will resolve all extends and include paths (ex: tsconfig.json, tsconfig.base.json, etc.)\n // if it doesn't match userTsConfig then update the userTsConfig to add the\n // rawConfig's includes in addition to nextAppTypes\n if (\n rawConfig.include.length !== userTsConfig.include.length ||\n JSON.stringify(rawConfig.include.sort()) !==\n JSON.stringify(userTsConfig.include.sort())\n ) {\n userTsConfig.include.push(...rawConfig.include, nextAppTypes)\n suggestedActions.push(\n cyan('include') +\n ' was set to ' +\n bold(\n `[${[...rawConfig.include, nextAppTypes]\n .map((i) => `'${i}'`)\n .join(', ')}]`\n )\n )\n } else {\n userTsConfig.include.push(nextAppTypes)\n suggestedActions.push(\n cyan('include') + ' was updated to add ' + bold(`'${nextAppTypes}'`)\n )\n }\n }\n\n // Enable the Next.js typescript plugin.\n if (hasAppDir) {\n // Check if the config or the resolved config has the plugin already.\n const plugins = [\n ...(Array.isArray(tsOptions.plugins) ? tsOptions.plugins : []),\n ...(userTsConfig.compilerOptions &&\n Array.isArray(userTsConfig.compilerOptions.plugins)\n ? userTsConfig.compilerOptions.plugins\n : []),\n ]\n const hasNextPlugin = plugins.some(\n ({ name }: { name: string }) => name === 'next'\n )\n\n // If the TS config extends on another config, we can't add the `plugin` field\n // because that will override the parent config's plugins.\n // Instead we have to show a message to the user to add the plugin manually.\n if (\n !userTsConfig.compilerOptions ||\n (plugins.length &&\n !hasNextPlugin &&\n 'extends' in rawConfig &&\n (!rawConfig.compilerOptions || !rawConfig.compilerOptions.plugins))\n ) {\n Log.info(\n `\\nYour ${bold(\n 'tsconfig.json'\n )} extends another configuration, which means we cannot add the Next.js TypeScript plugin automatically. To improve your development experience, we recommend adding the Next.js plugin (\\`${cyan(\n '\"plugins\": [{ \"name\": \"next\" }]'\n )}\\`) manually to your TypeScript configuration. Learn more: https://nextjs.org/docs/app/api-reference/config/typescript#the-typescript-plugin\\n`\n )\n } else if (!hasNextPlugin) {\n if (!('plugins' in userTsConfig.compilerOptions)) {\n userTsConfig.compilerOptions.plugins = []\n }\n userTsConfig.compilerOptions.plugins.push({ name: 'next' })\n suggestedActions.push(\n cyan('plugins') + ' was updated to add ' + bold(`{ name: 'next' }`)\n )\n }\n\n // If `strict` is set to `false` and `strictNullChecks` is set to `false`,\n // then set `strictNullChecks` to `true`.\n if (\n hasPagesDir &&\n hasAppDir &&\n !tsOptions.strict &&\n !('strictNullChecks' in tsOptions)\n ) {\n userTsConfig.compilerOptions.strictNullChecks = true\n suggestedActions.push(\n cyan('strictNullChecks') + ' was set to ' + bold(`true`)\n )\n }\n }\n\n // If the package name is not 'next', add a path mapping to redirect 'next' imports\n // to the actual package name. This is necessary for forked packages.\n if (PKG_NAME !== 'next') {\n if (!userTsConfig.compilerOptions) {\n userTsConfig.compilerOptions = {}\n }\n\n // baseUrl is required for path mappings to work correctly\n if (!userTsConfig.compilerOptions.baseUrl) {\n userTsConfig.compilerOptions.baseUrl = '.'\n suggestedActions.push(\n cyan('baseUrl') + ' was set to ' + bold(`\".\"`) +\n ' (required for path mappings)'\n )\n }\n\n if (!userTsConfig.compilerOptions.paths) {\n userTsConfig.compilerOptions.paths = {}\n }\n\n // Add path mapping for 'next' and 'next/*' to redirect to the actual package\n const nextMapping = `${PKG_NAME}`\n const nextWildcardMapping = `${PKG_NAME}/*`\n\n if (!userTsConfig.compilerOptions.paths['next']) {\n userTsConfig.compilerOptions.paths['next'] = [nextMapping]\n suggestedActions.push(\n cyan('paths[\"next\"]') + ' was set to ' + bold(`[\"${nextMapping}\"]`) +\n ' (for forked package support)'\n )\n }\n\n if (!userTsConfig.compilerOptions.paths['next/*']) {\n userTsConfig.compilerOptions.paths['next/*'] = [nextWildcardMapping]\n suggestedActions.push(\n cyan('paths[\"next/*\"]') + ' was set to ' + bold(`[\"${nextWildcardMapping}\"]`) +\n ' (for forked package support)'\n )\n }\n }\n\n if (!('exclude' in rawConfig)) {\n userTsConfig.exclude = ['node_modules']\n suggestedActions.push(\n cyan('exclude') + ' was set to ' + bold(`['node_modules']`)\n )\n }\n\n // During local development inside Next.js repo, exclude the test files coverage by the local tsconfig\n if (process.env.NEXT_PRIVATE_LOCAL_DEV && userTsConfig.exclude) {\n const tsGlob = '**/*.test.ts'\n const tsxGlob = '**/*.test.tsx'\n let hasUpdates = false\n if (!userTsConfig.exclude.includes(tsGlob)) {\n userTsConfig.exclude.push(tsGlob)\n hasUpdates = true\n }\n if (!userTsConfig.exclude.includes(tsxGlob)) {\n userTsConfig.exclude.push(tsxGlob)\n hasUpdates = true\n }\n\n if (hasUpdates) {\n requiredActions.push(localDevTestFilesExcludeAction)\n }\n }\n\n if (suggestedActions.length < 1 && requiredActions.length < 1) {\n return\n }\n\n await fs.writeFile(\n tsConfigPath,\n CommentJson.stringify(userTsConfig, null, 2) + os.EOL\n )\n\n Log.info('')\n if (isFirstTimeSetup) {\n Log.info(\n `We detected TypeScript in your project and created a ${cyan(\n 'tsconfig.json'\n )} file for you.`\n )\n return\n }\n\n Log.info(\n `We detected TypeScript in your project and reconfigured your ${cyan(\n 'tsconfig.json'\n )} file for you.${\n userTsConfig.compilerOptions?.strict\n ? ''\n : ` Strict-mode is set to ${cyan('false')} by default.`\n }`\n )\n\n if (suggestedActions.length) {\n Log.info(\n `The following suggested values were added to your ${cyan(\n 'tsconfig.json'\n )}. These values ${cyan('can be changed')} to fit your project's needs:\\n`\n )\n\n suggestedActions.forEach((action) => Log.info(`\\t- ${action}`))\n\n Log.info('')\n }\n\n const requiredActionsToBeLogged = process.env.NEXT_PRIVATE_LOCAL_DEV\n ? requiredActions.filter(\n (action) => action !== localDevTestFilesExcludeAction\n )\n : requiredActions\n\n if (requiredActionsToBeLogged.length) {\n Log.info(\n `The following ${white('mandatory changes')} were made to your ${cyan(\n 'tsconfig.json'\n )}:\\n`\n )\n\n requiredActionsToBeLogged.forEach((action) => Log.info(`\\t- ${action}`))\n\n Log.info('')\n }\n}\n"],"names":["promises","fs","bold","cyan","white","CommentJson","semver","os","path","getTypeScriptConfiguration","Log","PKG_NAME","require","join","__dirname","name","getDesiredCompilerOptions","ts","tsOptions","o","target","suggested","reason","lib","allowJs","skipLibCheck","strict","lt","version","forceConsistentCasingInFileNames","undefined","noEmit","gte","incremental","module","parsedValue","ModuleKind","ESNext","parsedValues","Preserve","ES2020","CommonJS","AMD","NodeNext","Node16","value","esModuleInterop","moduleResolution","ModuleResolutionKind","Bundler","Node10","NodeJs","Node12","filter","val","resolveJsonModule","verbatimModuleSyntax","isolatedModules","jsx","JsxEmit","ReactJSX","getRequiredConfiguration","res","desiredCompilerOptions","optionKey","Object","keys","ev","localDevTestFilesExcludeAction","writeConfigurationDefaults","tsConfigPath","isFirstTimeSetup","hasAppDir","distDir","hasPagesDir","userTsConfig","writeFile","EOL","options","raw","rawConfig","userTsConfigContent","readFile","encoding","parse","compilerOptions","suggestedActions","requiredActions","check","push","includes","_","nextAppTypes","include","Array","isArray","length","JSON","stringify","sort","map","i","plugins","hasNextPlugin","some","info","strictNullChecks","baseUrl","paths","nextMapping","nextWildcardMapping","exclude","process","env","NEXT_PRIVATE_LOCAL_DEV","tsGlob","tsxGlob","hasUpdates","forEach","action","requiredActionsToBeLogged"],"mappings":"AAAA,SAASA,YAAYC,EAAE,QAAQ,KAAI;AACnC,SAASC,IAAI,EAAEC,IAAI,EAAEC,KAAK,QAAQ,gBAAe;AACjD,YAAYC,iBAAiB,kCAAiC;AAC9D,OAAOC,YAAY,4BAA2B;AAC9C,OAAOC,QAAQ,KAAI;AACnB,OAAOC,UAAU,OAAM;AAEvB,SAASC,0BAA0B,QAAQ,+BAA8B;AACzE,YAAYC,SAAS,yBAAwB;AAE7C,2DAA2D;AAC3D,iEAAiE;AACjE,MAAMC,WAAWC,QAAQJ,KAAKK,IAAI,CAACC,WAAW,0BAA0BC,IAAI;AAa5E,SAASC,0BACPC,EAA+B,E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IAAI+F,IAAI,CACN,CAAC,6DAA6D,EAAEtG,KAC9D,iBACA,cAAc,EACdwE,EAAAA,gCAAAA,aAAaU,eAAe,qBAA5BV,8BAA8BjD,MAAM,IAChC,KACA,CAAC,uBAAuB,EAAEvB,KAAK,SAAS,YAAY,CAAC,EACzD;IAGJ,IAAImF,iBAAiBU,MAAM,EAAE;QAC3BtF,IAAI+F,IAAI,CACN,CAAC,kDAAkD,EAAEtG,KACnD,iBACA,eAAe,EAAEA,KAAK,kBAAkB,+BAA+B,CAAC;QAG5EmF,iBAAiBgC,OAAO,CAAC,CAACC,SAAW7G,IAAI+F,IAAI,CAAC,CAAC,IAAI,EAAEc,QAAQ;QAE7D7G,IAAI+F,IAAI,CAAC;IACX;IAEA,MAAMe,4BAA4BR,QAAQC,GAAG,CAACC,sBAAsB,GAChE3B,gBAAgBlC,MAAM,CACpB,CAACkE,SAAWA,WAAWnD,kCAEzBmB;IAEJ,IAAIiC,0BAA0BxB,MAAM,EAAE;QACpCtF,IAAI+F,IAAI,CACN,CAAC,cAAc,EAAErG,MAAM,qBAAqB,mBAAmB,EAAED,KAC/D,iBACA,GAAG,CAAC;QAGRqH,0BAA0BF,OAAO,CAAC,CAACC,SAAW7G,IAAI+F,IAAI,CAAC,CAAC,IAAI,EAAEc,QAAQ;QAEtE7G,IAAI+F,IAAI,CAAC;IACX;AACF","ignoreList":[0]}
@@ -158,7 +158,7 @@ export default class HotReloaderWebpack {
158
158
  this.previewProps = previewProps;
159
159
  this.rewrites = rewrites;
160
160
  this.hotReloaderSpan = trace('hot-reloader', undefined, {
161
- version: "15.6.0-bun.25"
161
+ version: "15.6.0-bun.27"
162
162
  });
163
163
  // Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing
164
164
  // of the current `next dev` invocation.
@@ -14,7 +14,7 @@ export function logStartInfo({ networkUrl, appUrl, envInfo, experimentalFeatures
14
14
  bundlerSuffix = ' (webpack)';
15
15
  }
16
16
  }
17
- Log.bootstrap(`${bold(purple(`${Log.prefixes.ready} Next.js ${"15.6.0-bun.25"}`))}${bundlerSuffix}`);
17
+ Log.bootstrap(`${bold(purple(`${Log.prefixes.ready} Next.js ${"15.6.0-bun.27"}`))}${bundlerSuffix}`);
18
18
  if (appUrl) {
19
19
  Log.bootstrap(`- Local: ${appUrl}`);
20
20
  }
@@ -87,7 +87,7 @@ export async function getRequestHandlers({ dir, port, isDev, onDevServerCleanup,
87
87
  export async function startServer(serverOptions) {
88
88
  const { dir, isDev, hostname, minimalMode, allowRetry, keepAliveTimeout, selfSignedCertificate } = serverOptions;
89
89
  let { port } = serverOptions;
90
- process.title = `next-server (v${"15.6.0-bun.25"})`;
90
+ process.title = `next-server (v${"15.6.0-bun.27"})`;
91
91
  let handlersReady = ()=>{};
92
92
  let handlersError = ()=>{};
93
93
  let handlersPromise = new Promise((resolve, reject)=>{
@@ -1,6 +1,6 @@
1
1
  export function isStableBuild() {
2
2
  var _process_env___NEXT_VERSION;
3
- return !((_process_env___NEXT_VERSION = "15.6.0-bun.25") == 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.6.0-bun.27") == 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){
@@ -295,6 +295,11 @@ async function writeConfigurationDefaults(ts, tsConfigPath, isFirstTimeSetup, ha
295
295
  if (!userTsConfig.compilerOptions) {
296
296
  userTsConfig.compilerOptions = {};
297
297
  }
298
+ // baseUrl is required for path mappings to work correctly
299
+ if (!userTsConfig.compilerOptions.baseUrl) {
300
+ userTsConfig.compilerOptions.baseUrl = '.';
301
+ suggestedActions.push((0, _picocolors.cyan)('baseUrl') + ' was set to ' + (0, _picocolors.bold)(`"."`) + ' (required for path mappings)');
302
+ }
298
303
  if (!userTsConfig.compilerOptions.paths) {
299
304
  userTsConfig.compilerOptions.paths = {};
300
305
  }