Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThe PR introduces extensive Next.js configuration types and public exports alongside incremental functional enhancements across components, hooks, and configuration files. Changes include TypeScript type exports for Next.js config structures, session management improvements, error handling in voice assistant hooks, accessibility enhancements, and build configuration updates. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
types.d.ts (1)
123-123:⚠️ Potential issue | 🔴 Critical
PlanTypeis unresolved and will cause a TypeScript compilation error.
SessionCheckResult.planon line 123 referencesPlanType, but this type is not defined or imported anywhere in the codebase. DefinePlanTypeor import it from the appropriate module.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@types.d.ts` at line 123, SessionCheckResult.plan references an undefined PlanType which will break TypeScript; fix by either importing the correct PlanType into types.d.ts (e.g. add an import for the module that exports PlanType) or by declaring/exporting a local PlanType typedef in this file, then update the SessionCheckResult type to use that defined/imported PlanType so the symbol is resolved.
🧹 Nitpick comments (1)
app/(root)/page.tsx (1)
6-6: Removeforce-dynamicand use cache revalidation instead.This page does not use request-scoped APIs (no
cookies(),headers(),searchParams, etc.). ThegetAllBooks()server action is stateless and performs the same database query every time. SincerevalidatePath('/')is already called on mutations increateBook(), the page should rely on cache revalidation rather than force dynamic rendering, which disables all caching and increases database load unnecessarily.Consider replacing with
export const revalidate = 60;(or another appropriate interval) to balance freshness and performance.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/`(root)/page.tsx at line 6, Remove the export const dynamic = 'force-dynamic' and instead export a revalidate interval (e.g., export const revalidate = 60) so the page can use Next.js ISR; update the module that currently declares dynamic to remove that symbol, keep using the stateless getAllBooks() data fetching and rely on createBook()'s existing revalidatePath('/') call to refresh the cache after mutations, ensuring the page is cached between revalidations rather than forced dynamic on every request.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.output.txt:
- Around line 1-1305: Delete the unused generated artifact .output.txt from the
repo and remove it from git tracking; this file contains TypeScript types like
NextConfigComplete, defaultConfig and normalizeConfig but is not referenced
anywhere, so remove the file, run git rm --cached (or git rm) to untrack it, and
add a rule to .gitignore if it is produced by your build process to prevent
re-adding it; ensure no imports or references to symbols such as
getNextConfigRuntime, NextConfigRuntime, or DEFAULT_MAX_POSTPONED_STATE_SIZE
exist before committing the deletion.
In `@hooks/useVapi.ts`:
- Around line 271-274: endVoiceSession returns a result object with a success
flag rather than throwing, so replace fire-and-forget .catch() usage with
awaiting the call and inspecting the returned { success } at each call site
(e.g., where sessionIdRef.current is used and endVoiceSession is invoked around
the handlers at the sites referenced). Concretely, in functions referencing
sessionIdRef and calling endVoiceSession (including the occurrences near the
current snippet and those ~lines 107, 185, 214), await
endVoiceSession(sessionIdRef.current, 0), check if result.success is false, and
log or handle the error using the returned result (and then set
sessionIdRef.current = null) instead of using .catch().
In `@next.config.ts`:
- Around line 4-10: The config currently disables build safety gates by setting
typescript.ignoreBuildErrors = true and eslint.ignoreDuringBuilds = true (with
an `@ts-ignore` masking typing drift); revert these by removing the `@ts-ignore` and
setting typescript.ignoreBuildErrors = false and eslint.ignoreDuringBuilds =
false so type/lint errors fail builds, and add/enable CI checks (a workflow step
that runs TypeScript type-check and ESLint) to enforce them before merge; ensure
any legitimate type/lint issues are fixed instead of silencing the checks in the
next.config.ts configuration.
---
Outside diff comments:
In `@types.d.ts`:
- Line 123: SessionCheckResult.plan references an undefined PlanType which will
break TypeScript; fix by either importing the correct PlanType into types.d.ts
(e.g. add an import for the module that exports PlanType) or by
declaring/exporting a local PlanType typedef in this file, then update the
SessionCheckResult type to use that defined/imported PlanType so the symbol is
resolved.
---
Nitpick comments:
In `@app/`(root)/page.tsx:
- Line 6: Remove the export const dynamic = 'force-dynamic' and instead export a
revalidate interval (e.g., export const revalidate = 60) so the page can use
Next.js ISR; update the module that currently declares dynamic to remove that
symbol, keep using the stateless getAllBooks() data fetching and rely on
createBook()'s existing revalidatePath('/') call to refresh the cache after
mutations, ensuring the page is cached between revalidations rather than forced
dynamic on every request.
ℹ️ Review info
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
.output.txtapp/(root)/page.tsxcomponents/VapiControls.tsxhooks/useVapi.tslib/actions/book.actions.tsnext.config.tstypes.d.ts
| import type { webpack } from 'next/dist/compiled/webpack/webpack'; | ||
| import type { Header, Redirect, Rewrite } from '../lib/load-custom-routes'; | ||
| import type { ImageConfig, ImageConfigComplete } from '../shared/lib/image-config'; | ||
| import type { SubresourceIntegrityAlgorithm } from '../build/webpack/plugins/subresource-integrity-plugin'; | ||
| import type { WEB_VITALS } from '../shared/lib/utils'; | ||
| import type { NextParsedUrlQuery } from './request-meta'; | ||
| import type { SizeLimit } from '../types'; | ||
| import type { SupportedTestRunners } from '../cli/next-test'; | ||
| import type { ExperimentalPPRConfig } from './lib/experimental/ppr'; | ||
| export type NextConfigComplete = Required<Omit<NextConfig, 'configFile'>> & { | ||
| images: Required<ImageConfigComplete>; | ||
| typescript: TypeScriptConfig; | ||
| configFile: string | undefined; | ||
| configFileName: string; | ||
| htmlLimitedBots: string | undefined; | ||
| experimental: ExperimentalConfig; | ||
| distDirRoot: string; | ||
| }; | ||
| export type I18NDomains = readonly DomainLocale[]; | ||
| export interface I18NConfig { | ||
| defaultLocale: string; | ||
| domains?: I18NDomains; | ||
| localeDetection?: false; | ||
| locales: readonly string[]; | ||
| } | ||
| export interface DomainLocale { | ||
| defaultLocale: string; | ||
| domain: string; | ||
| http?: true; | ||
| locales?: readonly string[]; | ||
| } | ||
| export interface TypeScriptConfig { | ||
| /** Do not run TypeScript during production builds (`next build`). */ | ||
| ignoreBuildErrors?: boolean; | ||
| /** Relative path to a custom tsconfig file */ | ||
| tsconfigPath?: string; | ||
| } | ||
| export interface EmotionConfig { | ||
| sourceMap?: boolean; | ||
| autoLabel?: 'dev-only' | 'always' | 'never'; | ||
| labelFormat?: string; | ||
| importMap?: { | ||
| [importName: string]: { | ||
| [exportName: string]: { | ||
| canonicalImport?: [string, string]; | ||
| styledBaseImport?: [string, string]; | ||
| }; | ||
| }; | ||
| }; | ||
| } | ||
| export interface StyledComponentsConfig { | ||
| /** | ||
| * Enabled by default in development, disabled in production to reduce file size, | ||
| * setting this will override the default for all environments. | ||
| */ | ||
| displayName?: boolean; | ||
| topLevelImportPaths?: string[]; | ||
| ssr?: boolean; | ||
| fileName?: boolean; | ||
| meaninglessFileNames?: string[]; | ||
| minify?: boolean; | ||
| transpileTemplateLiterals?: boolean; | ||
| namespace?: string; | ||
| pure?: boolean; | ||
| cssProp?: boolean; | ||
| } | ||
| export type JSONValue = string | number | boolean | JSONValue[] | { | ||
| [k: string]: JSONValue; | ||
| }; | ||
| export type TurbopackLoaderOptions = Record<string, JSONValue>; | ||
| export type TurbopackLoaderItem = string | { | ||
| loader: string; | ||
| options?: TurbopackLoaderOptions; | ||
| }; | ||
| export type TurbopackLoaderBuiltinCondition = 'browser' | 'foreign' | 'development' | 'production' | 'node' | 'edge-light'; | ||
| export type TurbopackRuleCondition = { | ||
| all: TurbopackRuleCondition[]; | ||
| } | { | ||
| any: TurbopackRuleCondition[]; | ||
| } | { | ||
| not: TurbopackRuleCondition; | ||
| } | TurbopackLoaderBuiltinCondition | { | ||
| path?: string | RegExp; | ||
| content?: RegExp; | ||
| }; | ||
| export type TurbopackRuleConfigItem = { | ||
| loaders: TurbopackLoaderItem[]; | ||
| as?: string; | ||
| condition?: TurbopackRuleCondition; | ||
| }; | ||
| /** | ||
| * Interface for put, upload and multipart upload operations. | ||
| * This type omits all options that are encoded in the client token. | ||
| * This can be an object representing a single configuration, or a list of | ||
| * loaders and/or rule configuration objects. | ||
| * | ||
| * - A list of loader path strings or objects is the "shorthand" syntax. | ||
| * - A list of rule configuration objects can be useful when each configuration | ||
| * object has different `condition` fields, but still match the same top-level | ||
| * path glob. | ||
| */ | ||
| interface ClientCommonCreateBlobOptions { | ||
| export type TurbopackRuleConfigCollection = TurbopackRuleConfigItem | (TurbopackLoaderItem | TurbopackRuleConfigItem)[]; | ||
| export interface TurbopackOptions { | ||
| /** | ||
| * Whether the blob should be publicly accessible. | ||
| * - 'public': The blob will be publicly accessible via its URL. | ||
| * - 'private': The blob will require authentication to access. | ||
| * (`next --turbopack` only) A mapping of aliased imports to modules to load in their place. | ||
| * | ||
| * @see [Resolve Alias](https://nextjs.org/docs/app/api-reference/config/next-config-js/turbopack#resolving-aliases) | ||
| */ | ||
| access: BlobAccessType; | ||
| resolveAlias?: Record<string, string | string[] | Record<string, string | string[]>>; | ||
| /** | ||
| * Defines the content type of the blob. By default, this value is inferred from the pathname. | ||
| * Sent as the 'content-type' header when downloading a blob. | ||
| * (`next --turbopack` only) A list of extensions to resolve when importing files. | ||
| * | ||
| * @see [Resolve Extensions](https://nextjs.org/docs/app/api-reference/config/next-config-js/turbopack#resolving-custom-extensions) | ||
| */ | ||
| contentType?: string; | ||
| resolveExtensions?: string[]; | ||
| /** | ||
| * `AbortSignal` to cancel the running request. See https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | ||
| * (`next --turbopack` only) A list of webpack loaders to apply when running with Turbopack. | ||
| * | ||
| * @see [Turbopack Loaders](https://nextjs.org/docs/app/api-reference/config/next-config-js/turbopack#configuring-webpack-loaders) | ||
| */ | ||
| abortSignal?: AbortSignal; | ||
| } | ||
| /** | ||
| * Shared interface for put and multipart operations that use client tokens. | ||
| */ | ||
| interface ClientTokenOptions { | ||
| rules?: Record<string, TurbopackRuleConfigCollection>; | ||
| /** | ||
| * A client token that was generated by your server using the `generateClientToken` method. | ||
| * This is the repo root usually and only files above this | ||
| * directory can be resolved by turbopack. | ||
| */ | ||
| token: string; | ||
| } | ||
| /** | ||
| * Shared interface for put and upload operations. | ||
| * @internal This is an internal interface not intended for direct use by consumers. | ||
| */ | ||
| interface ClientCommonPutOptions extends ClientCommonCreateBlobOptions, WithUploadProgress { | ||
| root?: string; | ||
| /** | ||
| * Whether to use multipart upload. Use this when uploading large files. | ||
| * It will split the file into multiple parts, upload them in parallel and retry failed parts. | ||
| * Enables generation of debug IDs in JavaScript bundles and source maps. | ||
| * These debug IDs help with debugging and error tracking by providing stable identifiers. | ||
| * | ||
| * @see https://github.com/tc39/ecma426/blob/main/proposals/debug-id.md TC39 Debug ID Proposal | ||
| */ | ||
| multipart?: boolean; | ||
| debugIds?: boolean; | ||
| } | ||
| export interface WebpackConfigContext { | ||
| /** Next.js root directory */ | ||
| dir: string; | ||
| /** Indicates if the compilation will be done in development */ | ||
| dev: boolean; | ||
| /** It's `true` for server-side compilation, and `false` for client-side compilation */ | ||
| isServer: boolean; | ||
| /** The build id, used as a unique identifier between builds */ | ||
| buildId: string; | ||
| /** The next.config.js merged with default values */ | ||
| config: NextConfigComplete; | ||
| /** Default loaders used internally by Next.js */ | ||
| defaultLoaders: { | ||
| /** Default babel-loader configuration */ | ||
| babel: any; | ||
| }; | ||
| /** Number of total Next.js pages */ | ||
| totalPages: number; | ||
| /** The webpack configuration */ | ||
| webpack: any; | ||
| /** The current server runtime */ | ||
| nextRuntime?: 'nodejs' | 'edge'; | ||
| } | ||
| export interface NextJsWebpackConfig { | ||
| ( | ||
| /** Existing Webpack config */ | ||
| config: any, context: WebpackConfigContext): any; | ||
| } | ||
| /** | ||
| * Options for the client-side put operation. | ||
| */ | ||
| type ClientPutCommandOptions = ClientCommonPutOptions & ClientTokenOptions; | ||
| /** | ||
| * Uploads a file to the blob store using a client token. | ||
| * | ||
| * @param pathname - The pathname to upload the blob to, including the extension. This will influence the URL of your blob. | ||
| * @param body - The content of your blob. Can be a string, File, Blob, Buffer or ReadableStream. | ||
| * @param options - Configuration options including: | ||
| * - access - (Required) Must be 'public' or 'private'. Public blobs are accessible via URL, private blobs require authentication. | ||
| * - token - (Required) A client token generated by your server using the generateClientTokenFromReadWriteToken method. | ||
| * - contentType - (Optional) The media type for the blob. By default, it's derived from the pathname. | ||
| * - multipart - (Optional) Whether to use multipart upload for large files. It will split the file into multiple parts, upload them in parallel and retry failed parts. | ||
| * - abortSignal - (Optional) AbortSignal to cancel the operation. | ||
| * - onUploadProgress - (Optional) Callback to track upload progress: onUploadProgress(\{loaded: number, total: number, percentage: number\}) | ||
| * @returns A promise that resolves to the blob information, including pathname, contentType, contentDisposition, url, and downloadUrl. | ||
| */ | ||
| declare const put: (pathname: string, body: PutBody, optionsInput: ClientPutCommandOptions) => Promise<PutBlobResult>; | ||
| /** | ||
| * Options for creating a multipart upload from the client side. | ||
| */ | ||
| type ClientCreateMultipartUploadCommandOptions = ClientCommonCreateBlobOptions & ClientTokenOptions; | ||
| /** | ||
| * Creates a multipart upload. This is the first step in the manual multipart upload process. | ||
| * | ||
| * @param pathname - A string specifying the path inside the blob store. This will be the base value of the return URL and includes the filename and extension. | ||
| * @param options - Configuration options including: | ||
| * - access - (Required) Must be 'public' or 'private'. Public blobs are accessible via URL, private blobs require authentication. | ||
| * - token - (Required) A client token generated by your server using the generateClientTokenFromReadWriteToken method. | ||
| * - contentType - (Optional) The media type for the file. If not specified, it's derived from the file extension. | ||
| * - abortSignal - (Optional) AbortSignal to cancel the operation. | ||
| * @returns A promise that resolves to an object containing: | ||
| * - key: A string that identifies the blob object. | ||
| * - uploadId: A string that identifies the multipart upload. Both are needed for subsequent uploadPart calls. | ||
| */ | ||
| declare const createMultipartUpload: (pathname: string, optionsInput: ClientCreateMultipartUploadCommandOptions) => Promise<{ | ||
| key: string; | ||
| uploadId: string; | ||
| }>; | ||
| /** | ||
| * Creates a multipart uploader that simplifies the multipart upload process. | ||
| * This is a wrapper around the manual multipart upload process that provides a more convenient API. | ||
| * Set of options for React Compiler that Next.js currently supports. | ||
| * | ||
| * @param pathname - A string specifying the path inside the blob store. This will be the base value of the return URL and includes the filename and extension. | ||
| * @param options - Configuration options including: | ||
| * - access - (Required) Must be 'public' or 'private'. Public blobs are accessible via URL, private blobs require authentication. | ||
| * - token - (Required) A client token generated by your server using the generateClientTokenFromReadWriteToken method. | ||
| * - contentType - (Optional) The media type for the file. If not specified, it's derived from the file extension. | ||
| * - abortSignal - (Optional) AbortSignal to cancel the operation. | ||
| * @returns A promise that resolves to an uploader object with the following properties and methods: | ||
| * - key: A string that identifies the blob object. | ||
| * - uploadId: A string that identifies the multipart upload. | ||
| * - uploadPart: A method to upload a part of the file. | ||
| * - complete: A method to complete the multipart upload process. | ||
| */ | ||
| declare const createMultipartUploader: (pathname: string, optionsInput: ClientCreateMultipartUploadCommandOptions) => Promise<{ | ||
| key: string; | ||
| uploadId: string; | ||
| uploadPart(partNumber: number, body: PutBody): Promise<{ | ||
| etag: string; | ||
| partNumber: number; | ||
| }>; | ||
| complete(parts: Part[]): Promise<PutBlobResult>; | ||
| }>; | ||
| /** | ||
| * @internal Internal type for multipart upload options. | ||
| */ | ||
| type ClientMultipartUploadCommandOptions = ClientCommonCreateBlobOptions & ClientTokenOptions & CommonMultipartUploadOptions & WithUploadProgress; | ||
| /** | ||
| * Uploads a part of a multipart upload. | ||
| * Used as part of the manual multipart upload process. | ||
| * These options may be changed in breaking ways at any time without notice | ||
| * while support for React Compiler is experimental. | ||
| * | ||
| * @param pathname - Same value as the pathname parameter passed to createMultipartUpload. This will influence the final URL of your blob. | ||
| * @param body - A blob object as ReadableStream, String, ArrayBuffer or Blob based on these supported body types. Each part must be a minimum of 5MB, except the last one which can be smaller. | ||
| * @param options - Configuration options including: | ||
| * - access - (Required) Must be 'public' or 'private'. Public blobs are accessible via URL, private blobs require authentication. | ||
| * - token - (Required) A client token generated by your server using the generateClientTokenFromReadWriteToken method. | ||
| * - uploadId - (Required) A string returned from createMultipartUpload which identifies the multipart upload. | ||
| * - key - (Required) A string returned from createMultipartUpload which identifies the blob object. | ||
| * - partNumber - (Required) A number identifying which part is uploaded (1-based index). | ||
| * - contentType - (Optional) The media type for the blob. By default, it's derived from the pathname. | ||
| * - abortSignal - (Optional) AbortSignal to cancel the running request. | ||
| * - onUploadProgress - (Optional) Callback to track upload progress: onUploadProgress(\{loaded: number, total: number, percentage: number\}) | ||
| * @returns A promise that resolves to the uploaded part information containing etag and partNumber, which will be needed for the completeMultipartUpload call. | ||
| * @see https://react.dev/reference/react-compiler/configuration | ||
| */ | ||
| declare const uploadPart: (pathname: string, body: PutBody, optionsInput: ClientMultipartUploadCommandOptions) => Promise<Part>; | ||
| /** | ||
| * @internal Internal type for completing multipart uploads. | ||
| */ | ||
| type ClientCompleteMultipartUploadCommandOptions = ClientCommonCreateBlobOptions & ClientTokenOptions & CommonCompleteMultipartUploadOptions; | ||
| /** | ||
| * Completes a multipart upload by combining all uploaded parts. | ||
| * This is the final step in the manual multipart upload process. | ||
| * | ||
| * @param pathname - Same value as the pathname parameter passed to createMultipartUpload. | ||
| * @param parts - An array containing all the uploaded parts information from previous uploadPart calls. Each part must have properties etag and partNumber. | ||
| * @param options - Configuration options including: | ||
| * - access - (Required) Must be 'public' or 'private'. Public blobs are accessible via URL, private blobs require authentication. | ||
| * - token - (Required) A client token generated by your server using the generateClientTokenFromReadWriteToken method. | ||
| * - uploadId - (Required) A string returned from createMultipartUpload which identifies the multipart upload. | ||
| * - key - (Required) A string returned from createMultipartUpload which identifies the blob object. | ||
| * - contentType - (Optional) The media type for the file. If not specified, it's derived from the file extension. | ||
| * - abortSignal - (Optional) AbortSignal to cancel the operation. | ||
| * @returns A promise that resolves to the finalized blob information, including pathname, contentType, contentDisposition, url, and downloadUrl. | ||
| */ | ||
| declare const completeMultipartUpload: (pathname: string, parts: Part[], optionsInput: ClientCompleteMultipartUploadCommandOptions) => Promise<PutBlobResult>; | ||
| /** | ||
| * Options for client-side upload operations. | ||
| */ | ||
| interface CommonUploadOptions { | ||
| export interface ReactCompilerOptions { | ||
| /** | ||
| * A route that implements the `handleUpload` function for generating a client token. | ||
| * Controls the strategy for determining which functions the React Compiler | ||
| * will optimize. | ||
| * | ||
| * The default is `'infer'`, which uses intelligent heuristics to identify | ||
| * React components and hooks. | ||
| * | ||
| * When using `infer`, Next.js applies its own heuristics before calling | ||
| * `react-compiler`. This improves compilation performance by avoiding extra | ||
| * invocations of Babel and reducing redundant parsing of code. | ||
| * | ||
| * @see https://react.dev/reference/react-compiler/compilationMode | ||
| */ | ||
| handleUploadUrl: string; | ||
| compilationMode?: 'infer' | 'annotation' | 'all'; | ||
| /** | ||
| * Additional data which will be sent to your `handleUpload` route. | ||
| * Controls how the React Compiler handles errors during compilation. | ||
| * | ||
| * The default is `'none'`, which skips components which cannot be compiled. | ||
| * | ||
| * @see https://react.dev/reference/react-compiler/panicThreshold | ||
| */ | ||
| clientPayload?: string; | ||
| panicThreshold?: 'none' | 'critical_errors' | 'all_errors'; | ||
| } | ||
| export interface IncomingRequestLoggingConfig { | ||
| /** | ||
| * Additional headers to be sent when making the request to your `handleUpload` route. | ||
| * This is useful for sending authorization headers or any other custom headers. | ||
| * A regular expression array to match incoming requests that should not be logged. | ||
| * You can specify multiple patterns to match incoming requests that should not be logged. | ||
| */ | ||
| headers?: Record<string, string>; | ||
| ignore?: RegExp[]; | ||
| } | ||
| /** | ||
| * Options for the upload method, which handles client-side uploads. | ||
| */ | ||
| type UploadOptions = ClientCommonPutOptions & CommonUploadOptions; | ||
| /** | ||
| * Uploads a blob into your store from the client. | ||
| * Detailed documentation can be found here: https://vercel.com/docs/vercel-blob/using-blob-sdk#client-uploads | ||
| * | ||
| * If you want to upload from your server instead, check out the documentation for the put operation: https://vercel.com/docs/vercel-blob/using-blob-sdk#upload-a-blob | ||
| * | ||
| * Unlike the put method, this method does not require a client token as it will fetch one from your server. | ||
| * | ||
| * @param pathname - The pathname to upload the blob to. This includes the filename and extension. | ||
| * @param body - The contents of your blob. This has to be a supported fetch body type (string, Blob, File, ArrayBuffer, etc). | ||
| * @param options - Configuration options including: | ||
| * - access - (Required) Must be 'public' or 'private'. Public blobs are accessible via URL, private blobs require authentication. | ||
| * - handleUploadUrl - (Required) A string specifying the route to call for generating client tokens for client uploads. | ||
| * - clientPayload - (Optional) A string to be sent to your handleUpload server code. Example use-case: attaching the post id an image relates to. | ||
| * - headers - (Optional) An object containing custom headers to be sent with the request to your handleUpload route. Example use-case: sending Authorization headers. | ||
| * - contentType - (Optional) A string indicating the media type. By default, it's extracted from the pathname's extension. | ||
| * - multipart - (Optional) Whether to use multipart upload for large files. It will split the file into multiple parts, upload them in parallel and retry failed parts. | ||
| * - abortSignal - (Optional) AbortSignal to cancel the operation. | ||
| * - onUploadProgress - (Optional) Callback to track upload progress: onUploadProgress(\{loaded: number, total: number, percentage: number\}) | ||
| * @returns A promise that resolves to the blob information, including pathname, contentType, contentDisposition, url, and downloadUrl. | ||
| */ | ||
| declare const upload: (pathname: string, body: PutBody, optionsInput: UploadOptions) => Promise<PutBlobResult>; | ||
| /** | ||
| * Decoded payload from a client token. | ||
| */ | ||
| type DecodedClientTokenPayload = Omit<GenerateClientTokenOptions, 'token'> & { | ||
| export interface LoggingConfig { | ||
| fetches?: { | ||
| fullUrl?: boolean; | ||
| /** | ||
| * If true, fetch requests that are restored from the HMR cache are logged | ||
| * during an HMR refresh request, i.e. when editing a server component. | ||
| */ | ||
| hmrRefreshes?: boolean; | ||
| }; | ||
| /** | ||
| * Timestamp in milliseconds when the token will expire. | ||
| * If set to false, incoming request logging is disabled. | ||
| * You can specify a pattern to match incoming requests that should not be logged. | ||
| */ | ||
| validUntil: number; | ||
| }; | ||
| /** | ||
| * Extracts and decodes the payload from a client token. | ||
| * | ||
| * @param clientToken - The client token string to decode | ||
| * @returns The decoded payload containing token options | ||
| */ | ||
| declare function getPayloadFromClientToken(clientToken: string): DecodedClientTokenPayload; | ||
| /** | ||
| * @internal Event type constants for internal use. | ||
| */ | ||
| declare const EventTypes: { | ||
| readonly generateClientToken: "blob.generate-client-token"; | ||
| readonly uploadCompleted: "blob.upload-completed"; | ||
| }; | ||
| /** | ||
| * Event for generating a client token for blob uploads. | ||
| * @internal This is an internal interface used by the SDK. | ||
| */ | ||
| interface GenerateClientTokenEvent { | ||
| incomingRequests?: boolean | IncomingRequestLoggingConfig; | ||
| } | ||
| export interface ExperimentalConfig { | ||
| adapterPath?: string; | ||
| useSkewCookie?: boolean; | ||
| /** @deprecated use top-level `cacheHandlers` instead */ | ||
| cacheHandlers?: NextConfig['cacheHandlers']; | ||
| multiZoneDraftMode?: boolean; | ||
| appNavFailHandling?: boolean; | ||
| prerenderEarlyExit?: boolean; | ||
| linkNoTouchStart?: boolean; | ||
| caseSensitiveRoutes?: boolean; | ||
| /** | ||
| * Type identifier for the generate client token event. | ||
| * The origins that are allowed to write the rewritten headers when | ||
| * performing a non-relative rewrite. When undefined, no non-relative | ||
| * rewrites will get the rewrite headers. | ||
| */ | ||
| type: (typeof EventTypes)['generateClientToken']; | ||
| clientParamParsingOrigins?: string[]; | ||
| dynamicOnHover?: boolean; | ||
| preloadEntriesOnStart?: boolean; | ||
| clientRouterFilter?: boolean; | ||
| clientRouterFilterRedirects?: boolean; | ||
| /** | ||
| * Payload containing information needed to generate a client token. | ||
| * This config can be used to override the cache behavior for the client router. | ||
| * These values indicate the time, in seconds, that the cache should be considered | ||
| * reusable. When the `prefetch` Link prop is left unspecified, this will use the `dynamic` value. | ||
| * When the `prefetch` Link prop is set to `true`, this will use the `static` value. | ||
| */ | ||
| payload: { | ||
| staleTimes?: { | ||
| dynamic?: number; | ||
| /** Must be greater than or equal to 30 seconds, to ensure prefetching is not completely wasteful */ | ||
| static?: number; | ||
| }; | ||
| /** | ||
| * @deprecated use top-level `cacheLife` instead | ||
| */ | ||
| cacheLife?: NextConfig['cacheLife']; | ||
| clientRouterFilterAllowedRate?: number; | ||
| /** | ||
| * @deprecated Use `externalProxyRewritesResolve` instead. | ||
| */ | ||
| externalMiddlewareRewritesResolve?: boolean; | ||
| externalProxyRewritesResolve?: boolean; | ||
| extensionAlias?: Record<string, any>; | ||
| allowedRevalidateHeaderKeys?: string[]; | ||
| fetchCacheKeyPrefix?: string; | ||
| imgOptConcurrency?: number | null; | ||
| imgOptTimeoutInSeconds?: number; | ||
| imgOptMaxInputPixels?: number; | ||
| imgOptSequentialRead?: boolean | null; | ||
| imgOptSkipMetadata?: boolean | null; | ||
| optimisticClientCache?: boolean; | ||
| /** | ||
| * @deprecated use config.expireTime instead | ||
| */ | ||
| expireTime?: number; | ||
| /** | ||
| * @deprecated Use `proxyPrefetch` instead. | ||
| */ | ||
| middlewarePrefetch?: 'strict' | 'flexible'; | ||
| proxyPrefetch?: 'strict' | 'flexible'; | ||
| manualClientBasePath?: boolean; | ||
| /** | ||
| * CSS Chunking strategy. Defaults to `true` ("loose" mode), which guesses dependencies | ||
| * between CSS files to keep ordering of them. | ||
| * An alternative is 'strict', which will try to keep correct ordering as | ||
| * much as possible, even when this leads to many requests. | ||
| */ | ||
| cssChunking?: boolean | 'strict'; | ||
| disablePostcssPresetEnv?: boolean; | ||
| cpus?: number; | ||
| memoryBasedWorkersCount?: boolean; | ||
| proxyTimeout?: number; | ||
| isrFlushToDisk?: boolean; | ||
| workerThreads?: boolean; | ||
| optimizeCss?: boolean | Record<string, unknown>; | ||
| nextScriptWorkers?: boolean; | ||
| scrollRestoration?: boolean; | ||
| externalDir?: boolean; | ||
| disableOptimizedLoading?: boolean; | ||
| /** @deprecated A no-op as of Next 16, size metrics were removed from the build output. */ | ||
| gzipSize?: boolean; | ||
| craCompat?: boolean; | ||
| esmExternals?: boolean | 'loose'; | ||
| fullySpecified?: boolean; | ||
| urlImports?: NonNullable<webpack.Configuration['experiments']>['buildHttp']; | ||
| swcTraceProfiling?: boolean; | ||
| forceSwcTransforms?: boolean; | ||
| swcPlugins?: Array<[string, Record<string, unknown>]>; | ||
| largePageDataBytes?: number; | ||
| /** | ||
| * If set to `false`, webpack won't fall back to polyfill Node.js modules in the browser | ||
| * Full list of old polyfills is accessible here: | ||
| * [webpack/webpack#ModuleNotoundError.js#L13-L42](https://github.com/webpack/webpack/blob/2a0536cf510768111a3a6dceeb14cb79b9f59273/lib/ModuleNotFoundError.js#L13-L42) | ||
| */ | ||
| fallbackNodePolyfills?: false; | ||
| sri?: { | ||
| algorithm?: SubresourceIntegrityAlgorithm; | ||
| }; | ||
| webVitalsAttribution?: Array<(typeof WEB_VITALS)[number]>; | ||
| /** | ||
| * Automatically apply the "modularizeImports" optimization to imports of the specified packages. | ||
| */ | ||
| optimizePackageImports?: string[]; | ||
| /** | ||
| * Optimize React APIs for server builds. | ||
| */ | ||
| optimizeServerReact?: boolean; | ||
| /** | ||
| * Displays an indicator when a React Transition has no other indicator rendered. | ||
| * This includes displaying an indicator on client-side navigations. | ||
| */ | ||
| transitionIndicator?: boolean; | ||
| /** | ||
| * A target memory limit for turbo, in bytes. | ||
| */ | ||
| turbopackMemoryLimit?: number; | ||
| /** | ||
| * Enable minification. Defaults to true in build mode and false in dev mode. | ||
| */ | ||
| turbopackMinify?: boolean; | ||
| /** | ||
| * Enable support for `with {type: "module"}` for ESM imports. | ||
| */ | ||
| turbopackImportTypeBytes?: boolean; | ||
| /** | ||
| * Enable scope hoisting. Defaults to true in build mode. Always disabled in development mode. | ||
| */ | ||
| turbopackScopeHoisting?: boolean; | ||
| /** | ||
| * Enable nested async chunking for client side assets. Defaults to true in build mode and false in dev mode. | ||
| * This optimization computes all possible paths through dynamic imports in the applications to figure out the modules needed at dynamic imports for every path. | ||
| */ | ||
| turbopackClientSideNestedAsyncChunking?: boolean; | ||
| /** | ||
| * Enable nested async chunking for server side assets. Defaults to false in dev and build mode. | ||
| * This optimization computes all possible paths through dynamic imports in the applications to figure out the modules needed at dynamic imports for every path. | ||
| */ | ||
| turbopackServerSideNestedAsyncChunking?: boolean; | ||
| /** | ||
| * Enable filesystem cache for the turbopack dev server. | ||
| * | ||
| * Defaults to `true`. | ||
| */ | ||
| turbopackFileSystemCacheForDev?: boolean; | ||
| /** | ||
| * Enable filesystem cache for the turbopack build. | ||
| * | ||
| * Defaults to `false`. | ||
| */ | ||
| turbopackFileSystemCacheForBuild?: boolean; | ||
| /** | ||
| * Enable source maps. Defaults to true. | ||
| */ | ||
| turbopackSourceMaps?: boolean; | ||
| /** | ||
| * Enable extraction of source maps from input files. Defaults to true. | ||
| */ | ||
| turbopackInputSourceMaps?: boolean; | ||
| /** | ||
| * Enable tree shaking for the turbopack dev server and build. | ||
| */ | ||
| turbopackTreeShaking?: boolean; | ||
| /** | ||
| * Enable removing unused imports for turbopack dev server and build. | ||
| */ | ||
| turbopackRemoveUnusedImports?: boolean; | ||
| /** | ||
| * Enable removing unused exports for turbopack dev server and build. | ||
| */ | ||
| turbopackRemoveUnusedExports?: boolean; | ||
| /** | ||
| * Enable local analysis to infer side effect free modules. When enabled, Turbopack will | ||
| * analyze module code to determine if it has side effects. This can improve tree shaking | ||
| * and bundle size at the cost of some additional analysis. | ||
| * | ||
| * Defaults to `true` in canary builds only | ||
| */ | ||
| turbopackInferModuleSideEffects?: boolean; | ||
| /** | ||
| * Use the system-provided CA roots instead of bundled CA roots for external HTTPS requests | ||
| * made by Turbopack. Currently this is only used for fetching data from Google Fonts. | ||
| * | ||
| * This may be useful in cases where you or an employer are MITMing traffic. | ||
| * | ||
| * This option is experimental because: | ||
| * - This may cause small performance problems, as it uses [`rustls-native-certs`]( | ||
| * https://github.com/rustls/rustls-native-certs). | ||
| * - In the future, this may become the default, and this option may be eliminated, once | ||
| * <https://github.com/seanmonstar/reqwest/issues/2159> is resolved. | ||
| * | ||
| * Users who need to configure this behavior system-wide can override the project | ||
| * configuration using the `NEXT_TURBOPACK_EXPERIMENTAL_USE_SYSTEM_TLS_CERTS=1` environment | ||
| * variable. | ||
| * | ||
| * This option is ignored on Windows on ARM, where the native TLS implementation is always | ||
| * used. | ||
| * | ||
| * If you need to set a proxy, Turbopack [respects the common `HTTP_PROXY` and `HTTPS_PROXY` | ||
| * environment variable convention](https://docs.rs/reqwest/latest/reqwest/#proxies). HTTP | ||
| * proxies are supported, SOCKS proxies are not currently supported. | ||
| */ | ||
| turbopackUseSystemTlsCerts?: boolean; | ||
| /** | ||
| * Set this to `false` to disable the automatic configuration of the babel loader when a Babel | ||
| * configuration file is present. This option is enabled by default. | ||
| * | ||
| * If this is set to `false`, but `reactCompiler` is `true`, the built-in Babel will | ||
| * still be configured, but any Babel configuration files on disk will be ignored. If you wish to | ||
| * use React Compiler with a different manually-configured `babel-loader`, you should disable both | ||
| * this and `reactCompiler`. | ||
| */ | ||
| turbopackUseBuiltinBabel?: boolean; | ||
| /** | ||
| * Set this to `false` to disable the automatic configuration of the sass loader. The sass loader | ||
| * configuration is enabled by default. | ||
| */ | ||
| turbopackUseBuiltinSass?: boolean; | ||
| /** | ||
| * The module ID strategy to use for Turbopack. | ||
| * If not set, the default is `'named'` for development and `'deterministic'` | ||
| * for production. | ||
| */ | ||
| turbopackModuleIds?: 'named' | 'deterministic'; | ||
| /** | ||
| * For use with `@next/mdx`. Compile MDX files using the new Rust compiler. | ||
| * @see https://nextjs.org/docs/app/api-reference/next-config-js/mdxRs | ||
| */ | ||
| mdxRs?: boolean | { | ||
| development?: boolean; | ||
| jsx?: boolean; | ||
| jsxRuntime?: string; | ||
| jsxImportSource?: string; | ||
| providerImportSource?: string; | ||
| mdxType?: 'gfm' | 'commonmark'; | ||
| }; | ||
| /** | ||
| * Enable type checking for Link and Router.push, etc. | ||
| * @deprecated Use `typedRoutes` instead — this feature is now stable. | ||
| * @see https://nextjs.org/docs/app/api-reference/config/typescript#statically-typed-links | ||
| */ | ||
| typedRoutes?: boolean; | ||
| /** | ||
| * Enable type-checking and autocompletion for environment variables. | ||
| * | ||
| * @default false | ||
| */ | ||
| typedEnv?: boolean; | ||
| /** | ||
| * Runs the compilations for server and edge in parallel instead of in serial. | ||
| * This will make builds faster if there is enough server and edge functions | ||
| * in the application at the cost of more memory. | ||
| * | ||
| * NOTE: This option is only valid when the build process can use workers. See | ||
| * the documentation for `webpackBuildWorker` for more details. | ||
| */ | ||
| parallelServerCompiles?: boolean; | ||
| /** | ||
| * Runs the logic to collect build traces for the server routes in parallel | ||
| * with other work during the compilation. This will increase the speed of | ||
| * the build at the cost of more memory. This option may incur some additional | ||
| * work compared to if the option was disabled since the work is started | ||
| * before data from the client compilation is available to potentially reduce | ||
| * the amount of code that needs to be traced. Despite that, this may still | ||
| * result in faster builds for some applications. | ||
| * | ||
| * Valid values are: | ||
| * - `true`: Collect the server build traces in parallel. | ||
| * - `false`: Do not collect the server build traces in parallel. | ||
| * - `undefined`: Collect server build traces in parallel only in the `experimental-compile` mode. | ||
| * | ||
| * NOTE: This option is only valid when the build process can use workers. See | ||
| * the documentation for `webpackBuildWorker` for more details. | ||
| */ | ||
| parallelServerBuildTraces?: boolean; | ||
| /** | ||
| * Run the Webpack build in a separate process to optimize memory usage during build. | ||
| * Valid values are: | ||
| * - `false`: Disable the Webpack build worker | ||
| * - `true`: Enable the Webpack build worker | ||
| * - `undefined`: Enable the Webpack build worker only if the webpack config is not customized | ||
| */ | ||
| webpackBuildWorker?: boolean; | ||
| /** | ||
| * Enables optimizations to reduce memory usage in Webpack. This reduces the max size of the heap | ||
| * but may increase compile times slightly. | ||
| * Valid values are: | ||
| * - `false`: Disable Webpack memory optimizations (default). | ||
| * - `true`: Enables Webpack memory optimizations. | ||
| */ | ||
| webpackMemoryOptimizations?: boolean; | ||
| /** | ||
| * The array of the meta tags to the client injected by tracing propagation data. | ||
| */ | ||
| clientTraceMetadata?: string[]; | ||
| /** | ||
| * @deprecated This configuration option has been merged into `cacheComponents`. | ||
| * The Partial Prerendering feature is still available via `cacheComponents`. | ||
| */ | ||
| ppr?: ExperimentalPPRConfig; | ||
| /** | ||
| * Enables experimental taint APIs in React. | ||
| * Using this feature will enable the `react@experimental` for the `app` directory. | ||
| */ | ||
| taint?: boolean; | ||
| /** | ||
| * Uninstalls all "unhandledRejection" and "uncaughtException" listeners from | ||
| * the global process so that we can override the behavior, which in some | ||
| * runtimes is to exit the process. | ||
| * | ||
| * This is experimental until we've considered the impact in various | ||
| * deployment environments. | ||
| */ | ||
| removeUncaughtErrorAndRejectionListeners?: boolean; | ||
| /** | ||
| * During an RSC request, validates that the request headers match the | ||
| * cache-busting search parameter sent by the client. | ||
| */ | ||
| validateRSCRequestHeaders?: boolean; | ||
| serverActions?: { | ||
| /** | ||
| * The destination path for the blob. | ||
| * Allows adjusting body parser size limit for server actions. | ||
| */ | ||
| pathname: string; | ||
| bodySizeLimit?: SizeLimit; | ||
| /** | ||
| * Whether the upload will use multipart uploading. | ||
| * Allowed origins that can bypass Server Action's CSRF check. This is helpful | ||
| * when you have reverse proxy in front of your app. | ||
| * @example | ||
| * ["my-app.com", "*.my-app.com"] | ||
| */ | ||
| multipart: boolean; | ||
| allowedOrigins?: string[]; | ||
| }; | ||
| /** | ||
| * Allows adjusting the maximum size of the postponed state body for PPR | ||
| * resume requests. This includes the Resume Data Cache (RDC) which may grow | ||
| * large for some applications. | ||
| * @default '100 MB' | ||
| */ | ||
| maxPostponedStateSize?: SizeLimit; | ||
| /** | ||
| * enables the minification of server code. | ||
| */ | ||
| serverMinification?: boolean; | ||
| /** | ||
| * Enables source maps generation for the server production bundle. | ||
| */ | ||
| serverSourceMaps?: boolean; | ||
| useWasmBinary?: boolean; | ||
| /** | ||
| * Use lightningcss instead of postcss-loader | ||
| */ | ||
| useLightningcss?: boolean; | ||
| /** | ||
| * Enables view transitions by using the {@link https://react.dev/reference/react/ViewTransition ViewTransition} Component. | ||
| */ | ||
| viewTransition?: boolean; | ||
| /** | ||
| * Enables `fetch` requests to be proxied to the experimental test proxy server | ||
| */ | ||
| testProxy?: boolean; | ||
| /** | ||
| * Set a default test runner to be used by `next experimental-test`. | ||
| */ | ||
| defaultTestRunner?: SupportedTestRunners; | ||
| /** | ||
| * Allow NODE_ENV=development even for `next build`. | ||
| */ | ||
| allowDevelopmentBuild?: true; | ||
| /** | ||
| * @deprecated use `config.bundlePagesRouterDependencies` instead | ||
| * | ||
| */ | ||
| bundlePagesExternals?: boolean; | ||
| /** | ||
| * @deprecated use `config.serverExternalPackages` instead | ||
| * | ||
| */ | ||
| serverComponentsExternalPackages?: string[]; | ||
| /** | ||
| * When enabled, in dev mode, Next.js will send React's debug info through the | ||
| * WebSocket connection, instead of including it in the main RSC payload. | ||
| */ | ||
| reactDebugChannel?: boolean; | ||
| /** | ||
| * @deprecated use top-level `cacheComponents` instead | ||
| */ | ||
| cacheComponents?: boolean; | ||
| /** | ||
| * The number of times to retry static generation (per page) before giving up. | ||
| */ | ||
| staticGenerationRetryCount?: number; | ||
| /** | ||
| * The amount of pages to export per worker during static generation. | ||
| */ | ||
| staticGenerationMaxConcurrency?: number; | ||
| /** | ||
| * The minimum number of pages to be chunked into each export worker. | ||
| */ | ||
| staticGenerationMinPagesPerWorker?: number; | ||
| /** | ||
| * Allows previously fetched data to be re-used when editing server components. | ||
| */ | ||
| serverComponentsHmrCache?: boolean; | ||
| /** | ||
| * Render <style> tags inline in the HTML for imported CSS assets. | ||
| * Supports app-router in production mode only. | ||
| */ | ||
| inlineCss?: boolean; | ||
| /** | ||
| * This config allows you to enable the experimental navigation API `forbidden` and `unauthorized`. | ||
| */ | ||
| authInterrupts?: boolean; | ||
| /** | ||
| * Enables the use of the `"use cache"` directive. | ||
| */ | ||
| useCache?: boolean; | ||
| /** | ||
| * Enables detection and reporting of slow modules during development builds. | ||
| * Enabling this may impact build performance to ensure accurate measurements. | ||
| */ | ||
| slowModuleDetection?: { | ||
| /** | ||
| * Additional data from the client which will be available in onBeforeGenerateToken. | ||
| * The time threshold in milliseconds for identifying slow modules. | ||
| * Modules taking longer than this build time threshold will be reported. | ||
| */ | ||
| clientPayload: string | null; | ||
| buildTimeThresholdMs: number; | ||
| }; | ||
| } | ||
| /** | ||
| * Event that occurs when a client upload has completed. | ||
| * @internal This is an internal interface used by the SDK. | ||
| */ | ||
| interface UploadCompletedEvent { | ||
| /** | ||
| * Type identifier for the upload completed event. | ||
| * Enables using the global-not-found.js file in the app directory | ||
| * | ||
| */ | ||
| type: (typeof EventTypes)['uploadCompleted']; | ||
| globalNotFound?: boolean; | ||
| /** | ||
| * Payload containing information about the uploaded blob. | ||
| * Enable debug information to be forwarded from browser to dev server stdout/stderr | ||
| */ | ||
| payload: { | ||
| browserDebugInfoInTerminal?: boolean | { | ||
| /** | ||
| * Option to limit stringification at a specific nesting depth when logging circular objects. | ||
| * @default 5 | ||
| */ | ||
| depthLimit?: number; | ||
| /** | ||
| * Details about the blob that was uploaded. | ||
| * Maximum number of properties/elements to stringify when logging objects/arrays with circular references. | ||
| * @default 100 | ||
| */ | ||
| blob: PutBlobResult; | ||
| edgeLimit?: number; | ||
| /** | ||
| * Optional payload that was defined during token generation. | ||
| * Whether to include source location information in debug output when available | ||
| */ | ||
| tokenPayload?: string | null; | ||
| showSourceLocation?: boolean; | ||
| }; | ||
| } | ||
| /** | ||
| * Union type representing either a request to generate a client token or a notification that an upload completed. | ||
| */ | ||
| type HandleUploadBody = GenerateClientTokenEvent | UploadCompletedEvent; | ||
| /** | ||
| * Type representing either a Node.js IncomingMessage or a web standard Request object. | ||
| * @internal This is an internal type used by the SDK. | ||
| */ | ||
| type RequestType = IncomingMessage | Request; | ||
| /** | ||
| * Options for the handleUpload function. | ||
| */ | ||
| interface HandleUploadOptions { | ||
| /** | ||
| * The request body containing upload information. | ||
| * Enable accessing root params via the `next/root-params` module. | ||
| */ | ||
| body: HandleUploadBody; | ||
| rootParams?: boolean; | ||
| /** | ||
| * Function called before generating the client token for uploads. | ||
| * Use an isolated directory for development builds to prevent conflicts | ||
| * with production builds. Development builds will use `{distDir}/dev` | ||
| * instead of `{distDir}`. | ||
| */ | ||
| isolatedDevBuild?: boolean; | ||
| /** | ||
| * Body size limit for request bodies with middleware configured. | ||
| * Defaults to 10MB. Can be specified as a number (bytes) or string (e.g. '5mb'). | ||
| * | ||
| * @param pathname - The destination path for the blob | ||
| * @param clientPayload - A string payload specified on the client when calling upload() | ||
| * @param multipart - A boolean specifying whether the file is a multipart upload | ||
| * @deprecated Use `proxyClientMaxBodySize` instead. | ||
| */ | ||
| middlewareClientMaxBodySize?: SizeLimit; | ||
| /** | ||
| * Body size limit for request bodies with proxy configured. | ||
| * Defaults to 10MB. Can be specified as a number (bytes) or string (e.g. '5mb'). | ||
| */ | ||
| proxyClientMaxBodySize?: SizeLimit; | ||
| /** | ||
| * Enable the Model Context Protocol (MCP) server for AI-assisted development. | ||
| * When enabled, Next.js will expose an MCP server at `/_next/mcp` that provides | ||
| * code intelligence and project context to AI assistants. | ||
| * | ||
| * @returns An object with configuration options for the client token including the optional callbackUrl | ||
| * @default true | ||
| */ | ||
| onBeforeGenerateToken: (pathname: string, clientPayload: string | null, multipart: boolean) => Promise<Pick<GenerateClientTokenOptions, 'allowedContentTypes' | 'maximumSizeInBytes' | 'validUntil' | 'addRandomSuffix' | 'allowOverwrite' | 'cacheControlMaxAge' | 'ifMatch'> & { | ||
| tokenPayload?: string | null; | ||
| callbackUrl?: string; | ||
| }>; | ||
| mcpServer?: boolean; | ||
| /** | ||
| * Function called by Vercel Blob when the client upload finishes. | ||
| * This is useful to update your database with the blob URL that was uploaded. | ||
| * Acquires a lockfile at `<distDir>/lock` when starting `next dev` or `next | ||
| * build`. Failing to acquire the lock causes the process to exit with an | ||
| * error message. | ||
| * | ||
| * This is because if multiple processes write to the same `distDir` at the | ||
| * same time, it can mangle the state of the directory. Disabling this option | ||
| * is not recommended. | ||
| * | ||
| * @param body - Contains information about the completed upload including the blob details | ||
| * @default true | ||
| */ | ||
| onUploadCompleted?: (body: UploadCompletedEvent['payload']) => Promise<void>; | ||
| lockDistDir?: boolean; | ||
| /** | ||
| * A string specifying the read-write token to use when making requests. | ||
| * It defaults to process.env.BLOB_READ_WRITE_TOKEN when deployed on Vercel. | ||
| * Hide logs that occur after a render has already aborted. | ||
| * This can help reduce noise in the console when dealing with aborted renders. | ||
| * | ||
| * @default false | ||
| */ | ||
| token?: string; | ||
| hideLogsAfterAbort?: boolean; | ||
| /** | ||
| * An IncomingMessage or Request object to be used to determine the action to take. | ||
| * Whether `process.env.NEXT_DEPLOYMENT_ID` is available at runtime in the server (and `next | ||
| * build` doesn't need to embed the deployment ID value into the build output). | ||
| * | ||
| * @default false | ||
| */ | ||
| request: RequestType; | ||
| runtimeServerDeploymentId?: boolean; | ||
| } | ||
| export type ExportPathMap = { | ||
| [path: string]: { | ||
| page: string; | ||
| query?: NextParsedUrlQuery; | ||
| }; | ||
| }; | ||
| /** | ||
| * A server-side route helper to manage client uploads. It has two responsibilities: | ||
| * 1. Generate tokens for client uploads | ||
| * 2. Listen for completed client uploads, so you can update your database with the URL of the uploaded file | ||
| * Next.js can be configured through a `next.config.js` file in the root of your project directory. | ||
| * | ||
| * @param options - Configuration options for handling uploads | ||
| * - request - (Required) An IncomingMessage or Request object to be used to determine the action to take. | ||
| * - body - (Required) The request body containing upload information. | ||
| * - onBeforeGenerateToken - (Required) Function called before generating the client token for uploads. | ||
| * - onUploadCompleted - (Optional) Function called by Vercel Blob when the client upload finishes. | ||
| * - token - (Optional) A string specifying the read-write token to use when making requests. Defaults to process.env.BLOB_READ_WRITE_TOKEN. | ||
| * @returns A promise that resolves to either a client token generation result or an upload completion result | ||
| */ | ||
| declare function handleUpload({ token, request, body, onBeforeGenerateToken, onUploadCompleted, }: HandleUploadOptions): Promise<{ | ||
| type: 'blob.generate-client-token'; | ||
| clientToken: string; | ||
| } | { | ||
| type: 'blob.upload-completed'; | ||
| response: 'ok'; | ||
| }>; | ||
| /** | ||
| * Generates a client token from a read-write token. This function must be called from a server environment. | ||
| * The client token contains permissions and constraints that limit what the client can do. | ||
| * This can change the behavior, enable experimental features, and configure other advanced options. | ||
| * | ||
| * @param options - Options for generating the client token | ||
| * - pathname - (Required) The destination path for the blob. | ||
| * - token - (Optional) A string specifying the read-write token to use. Defaults to process.env.BLOB_READ_WRITE_TOKEN. | ||
| * - onUploadCompleted - (Optional) Configuration for upload completion callback. | ||
| * - maximumSizeInBytes - (Optional) A number specifying the maximum size in bytes that can be uploaded (max 5TB). | ||
| * - allowedContentTypes - (Optional) An array of media types that are allowed to be uploaded. Wildcards are supported (text/*). | ||
| * - validUntil - (Optional) A timestamp in ms when the token will expire. Defaults to one hour from generation. | ||
| * - addRandomSuffix - (Optional) Whether to add a random suffix to the filename. Defaults to false. | ||
| * - allowOverwrite - (Optional) Whether to allow overwriting existing blobs. Defaults to false. | ||
| * - cacheControlMaxAge - (Optional) Number of seconds to configure cache duration. Defaults to one month. | ||
| * - ifMatch - (Optional) Only write if the ETag matches (optimistic concurrency control). | ||
| * @returns A promise that resolves to the generated client token string which can be used in client-side upload operations. | ||
| */ | ||
| declare function generateClientTokenFromReadWriteToken({ token, ...argsWithoutToken }: GenerateClientTokenOptions): Promise<string>; | ||
| /** | ||
| * Options for generating a client token. | ||
| * Read more: [Next.js Docs: `next.config.js`](https://nextjs.org/docs/app/api-reference/config/next-config-js) | ||
| */ | ||
| interface GenerateClientTokenOptions extends BlobCommandOptions { | ||
| export interface NextConfig { | ||
| allowedDevOrigins?: string[]; | ||
| exportPathMap?: (defaultMap: ExportPathMap, ctx: { | ||
| dev: boolean; | ||
| dir: string; | ||
| outDir: string | null; | ||
| distDir: string; | ||
| buildId: string; | ||
| }) => Promise<ExportPathMap> | ExportPathMap; | ||
| /** | ||
| * Internationalization configuration | ||
| * | ||
| * @see [Internationalization docs](https://nextjs.org/docs/advanced-features/i18n-routing) | ||
| */ | ||
| i18n?: I18NConfig | null; | ||
| /** | ||
| * @see [Next.js TypeScript documentation](https://nextjs.org/docs/app/api-reference/config/typescript) | ||
| */ | ||
| typescript?: TypeScriptConfig; | ||
| /** | ||
| * The destination path for the blob | ||
| * Enable type checking for Link and Router.push, etc. | ||
| * This feature requires TypeScript in your project. | ||
| * | ||
| * @see [Typed Links documentation](https://nextjs.org/docs/app/api-reference/config/typescript#statically-typed-links) | ||
| */ | ||
| typedRoutes?: boolean; | ||
| /** | ||
| * Headers allow you to set custom HTTP headers for an incoming request path. | ||
| * | ||
| * @see [Headers configuration documentation](https://nextjs.org/docs/app/api-reference/config/next-config-js/headers) | ||
| */ | ||
| pathname: string; | ||
| headers?: () => Promise<Header[]> | Header[]; | ||
| /** | ||
| * Configuration for upload completion callback | ||
| * Rewrites allow you to map an incoming request path to a different destination path. | ||
| * | ||
| * @see [Rewrites configuration documentation](https://nextjs.org/docs/app/api-reference/config/next-config-js/rewrites) | ||
| */ | ||
| onUploadCompleted?: { | ||
| callbackUrl: string; | ||
| tokenPayload?: string | null; | ||
| rewrites?: () => Promise<Rewrite[] | { | ||
| beforeFiles?: Rewrite[]; | ||
| afterFiles?: Rewrite[]; | ||
| fallback?: Rewrite[]; | ||
| }> | Rewrite[] | { | ||
| beforeFiles?: Rewrite[]; | ||
| afterFiles?: Rewrite[]; | ||
| fallback?: Rewrite[]; | ||
| }; | ||
| /** | ||
| * A number specifying the maximum size in bytes that can be uploaded. The maximum is 5TB. | ||
| * Redirects allow you to redirect an incoming request path to a different destination path. | ||
| * | ||
| * @see [Redirects configuration documentation](https://nextjs.org/docs/app/api-reference/config/next-config-js/redirects) | ||
| */ | ||
| redirects?: () => Promise<Redirect[]> | Redirect[]; | ||
| /** | ||
| * @see [Moment.js locales excluded by default](https://nextjs.org/docs/upgrading#momentjs-locales-excluded-by-default) | ||
| */ | ||
| maximumSizeInBytes?: number; | ||
| excludeDefaultMomentLocales?: boolean; | ||
| /** | ||
| * An array of strings specifying the media type that are allowed to be uploaded. | ||
| * By default, it's all content types. Wildcards are supported (text/*) | ||
| * Before continuing to add custom webpack configuration to your application make sure Next.js doesn't already support your use-case | ||
| * | ||
| * @see [Custom Webpack Config documentation](https://nextjs.org/docs/app/api-reference/config/next-config-js/webpack) | ||
| */ | ||
| allowedContentTypes?: string[]; | ||
| webpack?: NextJsWebpackConfig | null; | ||
| /** | ||
| * A number specifying the timestamp in ms when the token will expire. | ||
| * By default, it's now + 1 hour. | ||
| * By default Next.js will redirect urls with trailing slashes to their counterpart without a trailing slash. | ||
| * | ||
| * @default false | ||
| * @see [Trailing Slash Configuration](https://nextjs.org/docs/app/api-reference/config/next-config-js/trailingSlash) | ||
| */ | ||
| validUntil?: number; | ||
| trailingSlash?: boolean; | ||
| /** | ||
| * Adds a random suffix to the filename. | ||
| * @defaultvalue false | ||
| * Next.js comes with built-in support for environment variables | ||
| * | ||
| * @see [Environment Variables documentation](https://nextjs.org/docs/app/api-reference/config/next-config-js/env) | ||
| */ | ||
| addRandomSuffix?: boolean; | ||
| env?: Record<string, string | undefined>; | ||
| /** | ||
| * Allow overwriting an existing blob. By default this is set to false and will throw an error if the blob already exists. | ||
| * @defaultvalue false | ||
| * Destination directory (defaults to `.next`) | ||
| */ | ||
| allowOverwrite?: boolean; | ||
| distDir?: string; | ||
| /** | ||
| * Number in seconds to configure how long Blobs are cached. Defaults to one month. Cannot be set to a value lower than 1 minute. | ||
| * @defaultvalue 30 * 24 * 60 * 60 (1 Month) | ||
| * The build output directory (defaults to `.next`) is now cleared by default except for the Next.js caches. | ||
| */ | ||
| cacheControlMaxAge?: number; | ||
| cleanDistDir?: boolean; | ||
| /** | ||
| * Only write if the ETag matches (optimistic concurrency control). | ||
| * Use this for conditional writes to prevent overwriting changes made by others. | ||
| * If the ETag doesn't match, a `BlobPreconditionFailedError` will be thrown. | ||
| * To set up a CDN, you can set up an asset prefix and configure your CDN's origin to resolve to the domain that Next.js is hosted on. | ||
| * | ||
| * @see [CDN Support with Asset Prefix](https://nextjs.org/docs/app/api-reference/config/next-config-js/assetPrefix) | ||
| */ | ||
| ifMatch?: string; | ||
| assetPrefix?: string; | ||
| /** | ||
| * The default cache handler for the Pages and App Router uses the filesystem cache. This requires no configuration, however, you can customize the cache handler if you prefer. | ||
| * | ||
| * @see [Configuring Caching](https://nextjs.org/docs/app/building-your-application/deploying#configuring-caching) and the [API Reference](https://nextjs.org/docs/app/api-reference/next-config-js/incrementalCacheHandlerPath). | ||
| */ | ||
| cacheHandler?: string | undefined; | ||
| cacheHandlers?: { | ||
| default?: string; | ||
| remote?: string; | ||
| static?: string; | ||
| [handlerName: string]: string | undefined; | ||
| }; | ||
| /** | ||
| * Configure the in-memory cache size in bytes. Defaults to 50 MB. | ||
| * If `cacheMaxMemorySize: 0`, this disables in-memory caching entirely. | ||
| * | ||
| * @see [Configuring Caching](https://nextjs.org/docs/app/building-your-application/deploying#configuring-caching). | ||
| */ | ||
| cacheMaxMemorySize?: number; | ||
| /** | ||
| * By default, `Next` will serve each file in the `pages` folder under a pathname matching the filename. | ||
| * To disable this behavior and prevent routing based set this to `true`. | ||
| * | ||
| * @default true | ||
| * @see [Disabling file-system routing](https://nextjs.org/docs/advanced-features/custom-server#disabling-file-system-routing) | ||
| */ | ||
| useFileSystemPublicRoutes?: boolean; | ||
| /** | ||
| * @see [Configuring the build ID](https://nextjs.org/docs/app/api-reference/config/next-config-js/generateBuildId) | ||
| */ | ||
| generateBuildId?: () => string | null | Promise<string | null>; | ||
| /** @see [Disabling ETag Configuration](https://nextjs.org/docs/app/api-reference/config/next-config-js/generateEtags) */ | ||
| generateEtags?: boolean; | ||
| /** @see [Including non-page files in the pages directory](https://nextjs.org/docs/app/api-reference/config/next-config-js/pageExtensions) */ | ||
| pageExtensions?: string[]; | ||
| /** @see [Compression documentation](https://nextjs.org/docs/app/api-reference/config/next-config-js/compress) */ | ||
| compress?: boolean; | ||
| /** @see [Disabling x-powered-by](https://nextjs.org/docs/app/api-reference/config/next-config-js/poweredByHeader) */ | ||
| poweredByHeader?: boolean; | ||
| /** @see [Using the Image Component](https://nextjs.org/docs/app/api-reference/next-config-js/images) */ | ||
| images?: ImageConfig; | ||
| /** Configure indicators in development environment */ | ||
| devIndicators?: false | { | ||
| /** | ||
| * Position of the development tools indicator in the browser window. | ||
| * @default "bottom-left" | ||
| * */ | ||
| position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'; | ||
| }; | ||
| /** | ||
| * Next.js exposes some options that give you some control over how the server will dispose or keep in memory built pages in development. | ||
| * | ||
| * @see [Configuring `onDemandEntries`](https://nextjs.org/docs/app/api-reference/config/next-config-js/onDemandEntries) | ||
| */ | ||
| onDemandEntries?: { | ||
| /** period (in ms) where the server will keep pages in the buffer */ | ||
| maxInactiveAge?: number; | ||
| /** number of pages that should be kept simultaneously without being disposed */ | ||
| pagesBufferLength?: number; | ||
| }; | ||
| /** | ||
| * A unique identifier for a deployment that will be included in each request's query string or header. | ||
| */ | ||
| deploymentId?: string; | ||
| /** | ||
| * Deploy a Next.js application under a sub-path of a domain | ||
| * | ||
| * @see [Base path configuration](https://nextjs.org/docs/app/api-reference/config/next-config-js/basePath) | ||
| */ | ||
| basePath?: string; | ||
| /** @see [Customizing sass options](https://nextjs.org/docs/app/api-reference/next-config-js/sassOptions) */ | ||
| sassOptions?: { | ||
| implementation?: string; | ||
| [key: string]: any; | ||
| }; | ||
| /** | ||
| * Enable browser source map generation during the production build | ||
| * | ||
| * @see [Source Maps](https://nextjs.org/docs/advanced-features/source-maps) | ||
| */ | ||
| productionBrowserSourceMaps?: boolean; | ||
| /** | ||
| * Enable {@link https://nextjs.org/docs/app/api-reference/config/next-config-js/reactCompiler React Compiler in Next.js}. | ||
| * Configuration accepts partial config object of the Compiler. | ||
| * If provided, the Compiler will be enabled. | ||
| */ | ||
| reactCompiler?: boolean | ReactCompilerOptions; | ||
| /** | ||
| * Enable react profiling in production | ||
| * | ||
| */ | ||
| reactProductionProfiling?: boolean; | ||
| /** | ||
| * The Next.js runtime is Strict Mode-compliant. | ||
| * | ||
| * @see [React Strict Mode](https://nextjs.org/docs/app/api-reference/config/next-config-js/reactStrictMode) | ||
| */ | ||
| reactStrictMode?: boolean | null; | ||
| /** | ||
| * The maximum length of the headers that are emitted by React and added to | ||
| * the response. | ||
| * | ||
| * @see [React Max Headers Length](https://nextjs.org/docs/app/api-reference/config/next-config-js/reactMaxHeadersLength) | ||
| */ | ||
| reactMaxHeadersLength?: number; | ||
| /** | ||
| * Next.js enables HTTP Keep-Alive by default. | ||
| * You may want to disable HTTP Keep-Alive for certain `fetch()` calls or globally. | ||
| * | ||
| * @see [Disabling HTTP Keep-Alive](https://nextjs.org/docs/app/api-reference/next-config-js/httpAgentOptions) | ||
| */ | ||
| httpAgentOptions?: { | ||
| keepAlive?: boolean; | ||
| }; | ||
| /** | ||
| * Timeout after waiting to generate static pages in seconds | ||
| * | ||
| * @default 60 | ||
| */ | ||
| staticPageGenerationTimeout?: number; | ||
| /** | ||
| * Add `"crossorigin"` attribute to generated `<script>` elements generated by `<Head />` or `<NextScript />` components | ||
| * | ||
| * | ||
| * @see [`crossorigin` attribute documentation](https://developer.mozilla.org/docs/Web/HTML/Attributes/crossorigin) | ||
| */ | ||
| crossOrigin?: 'anonymous' | 'use-credentials'; | ||
| /** | ||
| * Optionally enable compiler transforms | ||
| * | ||
| * @see [Supported Compiler Options](https://nextjs.org/docs/advanced-features/compiler#supported-features) | ||
| */ | ||
| compiler?: { | ||
| reactRemoveProperties?: boolean | { | ||
| properties?: string[]; | ||
| }; | ||
| relay?: { | ||
| src: string; | ||
| artifactDirectory?: string; | ||
| language?: 'typescript' | 'javascript' | 'flow'; | ||
| eagerEsModules?: boolean; | ||
| }; | ||
| removeConsole?: boolean | { | ||
| exclude?: string[]; | ||
| }; | ||
| styledComponents?: boolean | StyledComponentsConfig; | ||
| emotion?: boolean | EmotionConfig; | ||
| styledJsx?: boolean | { | ||
| useLightningcss?: boolean; | ||
| }; | ||
| /** | ||
| * Replaces variables in your code during compile time. Each key will be | ||
| * replaced with the respective values. | ||
| */ | ||
| define?: Record<string, string>; | ||
| /** | ||
| * Replaces server-only (Node.js and Edge) variables in your code during compile time. | ||
| * Each key will be replaced with the respective values. | ||
| */ | ||
| defineServer?: Record<string, string>; | ||
| /** | ||
| * A hook function that executes after production build compilation finishes, | ||
| * but before running post-compilation tasks such as type checking and | ||
| * static page generation. | ||
| */ | ||
| runAfterProductionCompile?: (metadata: { | ||
| /** | ||
| * The root directory of the project | ||
| */ | ||
| projectDir: string; | ||
| /** | ||
| * The build output directory (defaults to `.next`) | ||
| */ | ||
| distDir: string; | ||
| }) => Promise<void>; | ||
| }; | ||
| /** | ||
| * The type of build output. | ||
| * - `undefined`: The default build output, `.next` directory, that works with production mode `next start` or a hosting provider like Vercel | ||
| * - `'standalone'`: A standalone build output, `.next/standalone` directory, that only includes necessary files/dependencies. Useful for self-hosting in a Docker container. | ||
| * - `'export'`: An exported build output, `out` directory, that only includes static HTML/CSS/JS. Useful for self-hosting without a Node.js server. | ||
| * @see [Output File Tracing](https://nextjs.org/docs/advanced-features/output-file-tracing) | ||
| * @see [Static HTML Export](https://nextjs.org/docs/advanced-features/static-html-export) | ||
| */ | ||
| output?: 'standalone' | 'export'; | ||
| /** | ||
| * Automatically transpile and bundle dependencies from local packages (like monorepos) or from external dependencies (`node_modules`). This replaces the | ||
| * `next-transpile-modules` package. | ||
| * @see [transpilePackages](https://nextjs.org/docs/advanced-features/compiler#module-transpilation) | ||
| */ | ||
| transpilePackages?: string[]; | ||
| /** | ||
| * Options for Turbopack. Temporarily also available as `experimental.turbo` for compatibility. | ||
| */ | ||
| turbopack?: TurbopackOptions; | ||
| /** | ||
| * @deprecated Use `skipProxyUrlNormalize` instead. | ||
| */ | ||
| skipMiddlewareUrlNormalize?: boolean; | ||
| skipProxyUrlNormalize?: boolean; | ||
| skipTrailingSlashRedirect?: boolean; | ||
| modularizeImports?: Record<string, { | ||
| transform: string | Record<string, string>; | ||
| preventFullImport?: boolean; | ||
| skipDefaultConversion?: boolean; | ||
| }>; | ||
| /** | ||
| * Logging configuration. Set to `false` to disable logging. | ||
| */ | ||
| logging?: LoggingConfig | false; | ||
| /** | ||
| * Enables source maps while generating static pages. | ||
| * Helps with errors during the prerender phase in `next build`. | ||
| */ | ||
| enablePrerenderSourceMaps?: boolean; | ||
| /** | ||
| * When enabled, in development and build, Next.js will automatically cache | ||
| * page-level components and functions for faster builds and rendering. This | ||
| * includes Partial Prerendering support. | ||
| * | ||
| * @see [Cache Components documentation](https://nextjs.org/docs/app/api-reference/config/next-config-js/cacheComponents) | ||
| */ | ||
| cacheComponents?: boolean; | ||
| cacheLife?: { | ||
| [profile: string]: { | ||
| stale?: number; | ||
| revalidate?: number; | ||
| expire?: number; | ||
| }; | ||
| }; | ||
| /** | ||
| * period (in seconds) where the server allow to serve stale cache | ||
| */ | ||
| expireTime?: number; | ||
| /** | ||
| * Enable experimental features. Note that all experimental features are subject to breaking changes in the future. | ||
| */ | ||
| experimental?: ExperimentalConfig; | ||
| /** | ||
| * Enables the bundling of node_modules packages (externals) for pages server-side bundles. | ||
| * @see https://nextjs.org/docs/pages/api-reference/next-config-js/bundlePagesRouterDependencies | ||
| */ | ||
| bundlePagesRouterDependencies?: boolean; | ||
| /** | ||
| * A list of packages that should be treated as external in the server build. | ||
| * @see https://nextjs.org/docs/app/api-reference/next-config-js/serverExternalPackages | ||
| */ | ||
| serverExternalPackages?: string[]; | ||
| /** | ||
| * This is the repo root usually and only files above this | ||
| * directory are traced and included. | ||
| */ | ||
| outputFileTracingRoot?: string; | ||
| /** | ||
| * This allows manually excluding traced files if too many | ||
| * are included incorrectly on a per-page basis. | ||
| */ | ||
| outputFileTracingExcludes?: Record<string, string[]>; | ||
| /** | ||
| * This allows manually including traced files if some | ||
| * were not detected on a per-page basis. | ||
| */ | ||
| outputFileTracingIncludes?: Record<string, string[]>; | ||
| watchOptions?: { | ||
| pollIntervalMs?: number; | ||
| }; | ||
| /** | ||
| * User Agent of bots that can handle streaming metadata. | ||
| * Besides the default behavior, Next.js act differently on serving metadata to bots based on their capability. | ||
| * | ||
| * @default | ||
| * /Mediapartners-Google|Slurp|DuckDuckBot|baiduspider|yandex|sogou|bitlybot|tumblr|vkShare|quora link preview|redditbot|ia_archiver|Bingbot|BingPreview|applebot|facebookexternalhit|facebookcatalog|Twitterbot|LinkedInBot|Slackbot|Discordbot|WhatsApp|SkypeUriPreview/i | ||
| */ | ||
| htmlLimitedBots?: RegExp; | ||
| } | ||
| export declare const defaultConfig: Readonly<{ | ||
| env: {}; | ||
| webpack: null; | ||
| typescript: { | ||
| ignoreBuildErrors: false; | ||
| tsconfigPath: undefined; | ||
| }; | ||
| typedRoutes: false; | ||
| distDir: string; | ||
| cleanDistDir: true; | ||
| assetPrefix: string; | ||
| cacheHandler: string | undefined; | ||
| cacheMaxMemorySize: number; | ||
| configOrigin: string; | ||
| useFileSystemPublicRoutes: true; | ||
| generateBuildId: () => null; | ||
| generateEtags: true; | ||
| pageExtensions: string[]; | ||
| poweredByHeader: true; | ||
| compress: true; | ||
| images: ImageConfigComplete; | ||
| devIndicators: { | ||
| position: "bottom-left"; | ||
| }; | ||
| onDemandEntries: { | ||
| maxInactiveAge: number; | ||
| pagesBufferLength: number; | ||
| }; | ||
| basePath: string; | ||
| sassOptions: {}; | ||
| trailingSlash: false; | ||
| i18n: null; | ||
| productionBrowserSourceMaps: false; | ||
| excludeDefaultMomentLocales: true; | ||
| reactProductionProfiling: false; | ||
| reactStrictMode: null; | ||
| reactMaxHeadersLength: number; | ||
| httpAgentOptions: { | ||
| keepAlive: true; | ||
| }; | ||
| logging: {}; | ||
| compiler: {}; | ||
| expireTime: number | undefined; | ||
| staticPageGenerationTimeout: number; | ||
| output: "standalone" | undefined; | ||
| modularizeImports: undefined; | ||
| outputFileTracingRoot: string; | ||
| allowedDevOrigins: undefined; | ||
| enablePrerenderSourceMaps: undefined; | ||
| cacheComponents: false; | ||
| cacheLife: { | ||
| default: { | ||
| stale: undefined; | ||
| revalidate: number; | ||
| expire: number; | ||
| }; | ||
| seconds: { | ||
| stale: number; | ||
| revalidate: number; | ||
| expire: number; | ||
| }; | ||
| minutes: { | ||
| stale: number; | ||
| revalidate: number; | ||
| expire: number; | ||
| }; | ||
| hours: { | ||
| stale: number; | ||
| revalidate: number; | ||
| expire: number; | ||
| }; | ||
| days: { | ||
| stale: number; | ||
| revalidate: number; | ||
| expire: number; | ||
| }; | ||
| weeks: { | ||
| stale: number; | ||
| revalidate: number; | ||
| expire: number; | ||
| }; | ||
| max: { | ||
| stale: number; | ||
| revalidate: number; | ||
| expire: number; | ||
| }; | ||
| }; | ||
| cacheHandlers: { | ||
| default: string | undefined; | ||
| remote: string | undefined; | ||
| static: string | undefined; | ||
| }; | ||
| experimental: { | ||
| adapterPath: string | undefined; | ||
| useSkewCookie: false; | ||
| cssChunking: true; | ||
| multiZoneDraftMode: false; | ||
| appNavFailHandling: false; | ||
| prerenderEarlyExit: true; | ||
| serverMinification: true; | ||
| linkNoTouchStart: false; | ||
| caseSensitiveRoutes: false; | ||
| clientParamParsingOrigins: undefined; | ||
| dynamicOnHover: false; | ||
| preloadEntriesOnStart: true; | ||
| clientRouterFilter: true; | ||
| clientRouterFilterRedirects: false; | ||
| fetchCacheKeyPrefix: string; | ||
| proxyPrefetch: "flexible"; | ||
| optimisticClientCache: true; | ||
| manualClientBasePath: false; | ||
| cpus: number; | ||
| memoryBasedWorkersCount: false; | ||
| imgOptConcurrency: null; | ||
| imgOptTimeoutInSeconds: number; | ||
| imgOptMaxInputPixels: number; | ||
| imgOptSequentialRead: null; | ||
| imgOptSkipMetadata: null; | ||
| isrFlushToDisk: true; | ||
| workerThreads: false; | ||
| proxyTimeout: undefined; | ||
| optimizeCss: false; | ||
| nextScriptWorkers: false; | ||
| scrollRestoration: false; | ||
| externalDir: false; | ||
| disableOptimizedLoading: false; | ||
| gzipSize: true; | ||
| craCompat: false; | ||
| esmExternals: true; | ||
| fullySpecified: false; | ||
| swcTraceProfiling: false; | ||
| forceSwcTransforms: false; | ||
| swcPlugins: undefined; | ||
| largePageDataBytes: number; | ||
| disablePostcssPresetEnv: undefined; | ||
| urlImports: undefined; | ||
| typedEnv: false; | ||
| clientTraceMetadata: undefined; | ||
| parallelServerCompiles: false; | ||
| parallelServerBuildTraces: false; | ||
| ppr: false; | ||
| authInterrupts: false; | ||
| webpackBuildWorker: undefined; | ||
| webpackMemoryOptimizations: false; | ||
| optimizeServerReact: true; | ||
| viewTransition: false; | ||
| removeUncaughtErrorAndRejectionListeners: false; | ||
| validateRSCRequestHeaders: boolean; | ||
| staleTimes: { | ||
| dynamic: number; | ||
| static: number; | ||
| }; | ||
| allowDevelopmentBuild: undefined; | ||
| reactDebugChannel: false; | ||
| staticGenerationRetryCount: undefined; | ||
| serverComponentsHmrCache: true; | ||
| staticGenerationMaxConcurrency: number; | ||
| staticGenerationMinPagesPerWorker: number; | ||
| transitionIndicator: false; | ||
| inlineCss: false; | ||
| useCache: undefined; | ||
| slowModuleDetection: undefined; | ||
| globalNotFound: false; | ||
| browserDebugInfoInTerminal: false; | ||
| lockDistDir: true; | ||
| isolatedDevBuild: true; | ||
| proxyClientMaxBodySize: number; | ||
| hideLogsAfterAbort: false; | ||
| mcpServer: true; | ||
| turbopackFileSystemCacheForDev: true; | ||
| turbopackFileSystemCacheForBuild: false; | ||
| turbopackInferModuleSideEffects: boolean; | ||
| }; | ||
| htmlLimitedBots: undefined; | ||
| bundlePagesRouterDependencies: false; | ||
| }>; | ||
| export declare function normalizeConfig(phase: string, config: any): Promise<any>; | ||
| export interface NextConfigRuntime { | ||
| deploymentId?: NextConfigComplete['deploymentId']; | ||
| configFileName?: string; | ||
| env?: NextConfigComplete['env']; | ||
| distDir: NextConfigComplete['distDir']; | ||
| cacheComponents: NextConfigComplete['cacheComponents']; | ||
| htmlLimitedBots: NextConfigComplete['htmlLimitedBots']; | ||
| assetPrefix: NextConfigComplete['assetPrefix']; | ||
| output: NextConfigComplete['output']; | ||
| crossOrigin: NextConfigComplete['crossOrigin']; | ||
| trailingSlash: NextConfigComplete['trailingSlash']; | ||
| images: NextConfigComplete['images']; | ||
| reactMaxHeadersLength: NextConfigComplete['reactMaxHeadersLength']; | ||
| cacheLife: NextConfigComplete['cacheLife']; | ||
| basePath: NextConfigComplete['basePath']; | ||
| expireTime: NextConfigComplete['expireTime']; | ||
| generateEtags: NextConfigComplete['generateEtags']; | ||
| poweredByHeader: NextConfigComplete['poweredByHeader']; | ||
| cacheHandler: NextConfigComplete['cacheHandler']; | ||
| cacheHandlers: NextConfigComplete['cacheHandlers']; | ||
| cacheMaxMemorySize: NextConfigComplete['cacheMaxMemorySize']; | ||
| compress: NextConfigComplete['compress']; | ||
| i18n: NextConfigComplete['i18n']; | ||
| httpAgentOptions: NextConfigComplete['httpAgentOptions']; | ||
| skipProxyUrlNormalize: NextConfigComplete['skipProxyUrlNormalize']; | ||
| pageExtensions: NextConfigComplete['pageExtensions']; | ||
| useFileSystemPublicRoutes: NextConfigComplete['useFileSystemPublicRoutes']; | ||
| experimental: Pick<NextConfigComplete['experimental'], 'ppr' | 'taint' | 'serverActions' | 'staleTimes' | 'dynamicOnHover' | 'inlineCss' | 'authInterrupts' | 'clientTraceMetadata' | 'clientParamParsingOrigins' | 'adapterPath' | 'allowedRevalidateHeaderKeys' | 'fetchCacheKeyPrefix' | 'isrFlushToDisk' | 'optimizeCss' | 'nextScriptWorkers' | 'disableOptimizedLoading' | 'largePageDataBytes' | 'serverComponentsHmrCache' | 'caseSensitiveRoutes' | 'validateRSCRequestHeaders' | 'sri' | 'useSkewCookie' | 'preloadEntriesOnStart' | 'hideLogsAfterAbort' | 'removeUncaughtErrorAndRejectionListeners' | 'imgOptConcurrency' | 'imgOptMaxInputPixels' | 'imgOptSequentialRead' | 'imgOptSkipMetadata' | 'imgOptTimeoutInSeconds' | 'proxyClientMaxBodySize' | 'proxyTimeout' | 'testProxy' | 'runtimeServerDeploymentId' | 'maxPostponedStateSize'> & {}; | ||
| } | ||
| export { type ClientCommonCreateBlobOptions, type ClientCreateMultipartUploadCommandOptions, type ClientPutCommandOptions, type ClientTokenOptions, type CommonUploadOptions, type DecodedClientTokenPayload, type GenerateClientTokenOptions, type HandleUploadBody, type HandleUploadOptions, type UploadOptions, completeMultipartUpload, createMultipartUpload, createMultipartUploader, generateClientTokenFromReadWriteToken, getPayloadFromClientToken, handleUpload, put, upload, uploadPart }; | ||
| export declare function getNextConfigRuntime(config: NextConfigComplete | NextConfigRuntime): NextConfigRuntime; | ||
| export { DEFAULT_MAX_POSTPONED_STATE_SIZE, parseMaxPostponedStateSize, } from '../shared/lib/size-limit'; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Search for references to .output.txt in the repository
rg -n "\.output\.txt|output\.txt" --max-count=20
# Also check if it appears in .gitignore or similar patterns
echo "=== Checking .gitignore and related files ==="
find . -name ".gitignore" -o -name "*.config.*" -o -name "*.json" | head -20 | xargs grep -l "output" 2>/dev/null | head -10
# Check git status to see if file is tracked
echo "=== Git tracking status ==="
git ls-files | grep "output.txt"Repository: adrianhajdin/jsm_bookified
Length of output: 155
Remove .output.txt — it's an unused generated artifact.
The file is tracked in git but has no references anywhere in the codebase. At 1305 lines of TypeScript type definitions, it adds significant noise to the PR without serving any clear purpose. If this file is not consumed by build tooling or documentation generation, it should be deleted.
🧰 Tools
🪛 LanguageTool
[grammar] ~343-~343: Use a hyphen to join words.
Context: ... Enable nested async chunking for client side assets. Defaults to true in build m...
(QB_NEW_EN_HYPHEN)
[grammar] ~348-~348: Use a hyphen to join words.
Context: ... Enable nested async chunking for server side assets. Defaults to false in dev an...
(QB_NEW_EN_HYPHEN)
[grammar] ~385-~385: Use a hyphen to join words.
Context: ... * Enable local analysis to infer side effect free modules. When enabled, Turbo...
(QB_NEW_EN_HYPHEN)
[grammar] ~385-~385: Use a hyphen to join words.
Context: ...able local analysis to infer side effect free modules. When enabled, Turbopack wi...
(QB_NEW_EN_HYPHEN)
[style] ~676-~676: To form a complete sentence, be sure to include a subject.
Context: ...re configured. * Defaults to 10MB. Can be specified as a number (bytes) or str...
(MISSING_IT_THERE)
[style] ~683-~683: To form a complete sentence, be sure to include a subject.
Context: ...xy configured. * Defaults to 10MB. Can be specified as a number (bytes) or str...
(MISSING_IT_THERE)
[style] ~980-~980: You have already used this phrasing in nearby sentences. Consider using an alternative to add variety to your writing.
Context: ...mpile time. * Each key will be replaced with the respective values. */ ...
(REP_REPLACEMENT)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.output.txt around lines 1 - 1305, Delete the unused generated artifact
.output.txt from the repo and remove it from git tracking; this file contains
TypeScript types like NextConfigComplete, defaultConfig and normalizeConfig but
is not referenced anywhere, so remove the file, run git rm --cached (or git rm)
to untrack it, and add a rule to .gitignore if it is produced by your build
process to prevent re-adding it; ensure no imports or references to symbols such
as getNextConfigRuntime, NextConfigRuntime, or DEFAULT_MAX_POSTPONED_STATE_SIZE
exist before committing the deletion.
| if (sessionIdRef.current) { | ||
| endVoiceSession(sessionIdRef.current, 0).catch((endErr) => console.error('Failed to rollback voice session after start failure:', endErr),); | ||
| sessionIdRef.current = null; | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# First, find and examine the endVoiceSession implementation
fd -t f "session.actions.ts" --exec cat -n {} \;
# Also check the useVapi.ts file around lines 271-274
fd -t f "useVapi.ts" --exec sed -n '260,285p' {} \;Repository: adrianhajdin/jsm_bookified
Length of output: 3218
🏁 Script executed:
# Check for other call sites using endVoiceSession with .catch()
rg -n "endVoiceSession.*\.catch" hooks/useVapi.ts
# Get broader context around the issue area to ensure this is the only instance
rg -B2 -A2 "endVoiceSession" hooks/useVapi.tsRepository: adrianhajdin/jsm_bookified
Length of output: 1915
Apply consistent error handling for endVoiceSession across all call sites.
endVoiceSession returns { success: false } on failure instead of throwing, making .catch() handlers ineffective. This pattern appears at lines 107, 185, 214, and 272, silently skipping error handling in all cases. Update all call sites to await the result and check the success flag:
- endVoiceSession(sessionIdRef.current, 0).catch((endErr) => console.error('Failed to rollback voice session after start failure:', endErr),);
+ const rollbackResult = await endVoiceSession(sessionIdRef.current, 0);
+ if (!rollbackResult.success) {
+ console.error('Failed to rollback voice session after start failure:', rollbackResult.error);
+ }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if (sessionIdRef.current) { | |
| endVoiceSession(sessionIdRef.current, 0).catch((endErr) => console.error('Failed to rollback voice session after start failure:', endErr),); | |
| sessionIdRef.current = null; | |
| } | |
| if (sessionIdRef.current) { | |
| const rollbackResult = await endVoiceSession(sessionIdRef.current, 0); | |
| if (!rollbackResult.success) { | |
| console.error('Failed to rollback voice session after start failure:', rollbackResult.error); | |
| } | |
| sessionIdRef.current = null; | |
| } |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@hooks/useVapi.ts` around lines 271 - 274, endVoiceSession returns a result
object with a success flag rather than throwing, so replace fire-and-forget
.catch() usage with awaiting the call and inspecting the returned { success } at
each call site (e.g., where sessionIdRef.current is used and endVoiceSession is
invoked around the handlers at the sites referenced). Concretely, in functions
referencing sessionIdRef and calling endVoiceSession (including the occurrences
near the current snippet and those ~lines 107, 185, 214), await
endVoiceSession(sessionIdRef.current, 0), check if result.success is false, and
log or handle the error using the returned result (and then set
sessionIdRef.current = null) instead of using .catch().
| typescript: { | ||
| ignoreBuildErrors: true, | ||
| }, | ||
| // @ts-ignore | ||
| eslint: { | ||
| ignoreDuringBuilds: true, | ||
| }, |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check package.json for build/lint/typecheck scripts
echo "=== Checking package.json for build/lint/typecheck scripts ==="
if [ -f package.json ]; then
rg -n "\"(build|lint|typecheck)\"\\s*:" package.json
else
echo "package.json not found"
fi
echo ""
echo "=== Checking .github/workflows for CI checks ==="
# Find and search workflow files
fd -t f '.*\.(yml|yaml)$' .github/workflows 2>/dev/null | head -20 | while read -r file; do
echo "File: $file"
rg -n "lint|eslint|typecheck|tsc|next build|pnpm build|npm run build|yarn build" "$file" 2>/dev/null
done
echo ""
echo "=== Full next.config.ts content (first 50 lines) ==="
if [ -f next.config.ts ]; then
head -50 next.config.ts
fiRepository: adrianhajdin/jsm_bookified
Length of output: 734
Build safety gates are effectively disabled with no CI compensation.
Both typescript.ignoreBuildErrors and eslint.ignoreDuringBuilds are enabled, allowing broken typing and lint errors to ship undetected. The @ts-ignore comment masks config typing drift. No CI workflows are configured to enforce these checks separately, leaving no safety net before merge.
Recommended fix
typescript: {
- ignoreBuildErrors: true,
+ ignoreBuildErrors: false,
},
- // `@ts-ignore`
eslint: {
- ignoreDuringBuilds: true,
+ ignoreDuringBuilds: false,
},🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@next.config.ts` around lines 4 - 10, The config currently disables build
safety gates by setting typescript.ignoreBuildErrors = true and
eslint.ignoreDuringBuilds = true (with an `@ts-ignore` masking typing drift);
revert these by removing the `@ts-ignore` and setting typescript.ignoreBuildErrors
= false and eslint.ignoreDuringBuilds = false so type/lint errors fail builds,
and add/enable CI checks (a workflow step that runs TypeScript type-check and
ESLint) to enforce them before merge; ensure any legitimate type/lint issues are
fixed instead of silencing the checks in the next.config.ts configuration.
Summary by CodeRabbit
Bug Fixes
New Features
Improvements