/opt/canhelp/node_modules/next/dist/server/route-modules
Edit: /opt/canhelp/node_modules/next/dist/server/route-modules/route-module.d.ts (5891B)
import type { IncomingMessage, ServerResponse } from 'node:http';
import type { InstrumentationOnRequestError, RequestErrorContext } from '../instrumentation/types';
import type { ParsedUrlQuery } from 'node:querystring';
import type { UrlWithParsedQuery } from 'node:url';
import type { PrerenderManifest, RequiredServerFilesManifest } from '../../build';
import type { DevRoutesManifest } from '../lib/router-utils/setup-dev-bundler';
import type { RouteDefinition } from '../route-definitions/route-definition';
import type { DeepReadonly } from '../../shared/lib/deep-readonly';
import type { PreviewData } from '../../types';
import type { BuildManifest } from '../get-page-files';
import type { ReactLoadableManifest } from '../load-components';
import type { NextFontManifest } from '../../build/webpack/plugins/next-font-manifest-plugin';
import { IncrementalCache } from '../lib/incremental-cache';
import type { RouteKind } from '../route-kind';
import type { BaseNextRequest } from '../base-http';
import type { NextConfigComplete } from '../config-shared';
import ResponseCache, { type ResponseGenerator } from '../response-cache';
import { type RouterServerContext } from '../lib/router-utils/router-server-context';
/**
* RouteModuleOptions is the options that are passed to the route module, other
* route modules should extend this class to add specific options for their
* route.
*/
export interface RouteModuleOptions
{
readonly definition: Readonly;
readonly userland: Readonly;
readonly distDir: string;
readonly relativeProjectDir: string;
}
/**
* RouteHandlerContext is the base context for a route handler.
*/
export interface RouteModuleHandleContext {
/**
* Any matched parameters for the request. This is only defined for dynamic
* routes.
*/
params: Record | undefined;
}
/**
* RouteModule is the base class for all route modules. This class should be
* extended by all route modules.
*/
export declare abstract class RouteModule {
/**
* The userland module. This is the module that is exported from the user's
* code. This is marked as readonly to ensure that the module is not mutated
* because the module (when compiled) only provides getters.
*/
readonly userland: Readonly;
/**
* The definition of the route.
*/
readonly definition: Readonly;
/**
* The shared modules that are exposed and required for the route module.
*/
static readonly sharedModules: any;
isDev: boolean;
distDir: string;
isAppRouter?: boolean;
relativeProjectDir: string;
incrementCache?: IncrementalCache;
responseCache?: ResponseCache;
constructor({ userland, definition, distDir, relativeProjectDir, }: RouteModuleOptions);
instrumentationOnRequestError(req: IncomingMessage | BaseNextRequest, ...args: Parameters): Promise;
private loadManifests;
loadCustomCacheHandlers(req: IncomingMessage | BaseNextRequest, nextConfig: NextConfigComplete): Promise;
getIncrementalCache(req: IncomingMessage | BaseNextRequest, nextConfig: NextConfigComplete, prerenderManifest: DeepReadonly): Promise;
onRequestError(req: IncomingMessage | BaseNextRequest, err: unknown, errorContext: RequestErrorContext, routerServerContext?: RouterServerContext[string]): Promise;
prepare(req: IncomingMessage | BaseNextRequest, res: ServerResponse | null, { srcPage, multiZoneDraftMode, }: {
srcPage: string;
multiZoneDraftMode?: boolean;
}): Promise<{
buildId: string;
locale?: string;
locales?: readonly string[];
defaultLocale?: string;
query: ParsedUrlQuery;
originalQuery: ParsedUrlQuery;
originalPathname: string;
params?: ParsedUrlQuery;
parsedUrl: UrlWithParsedQuery;
previewData: PreviewData;
pageIsDynamic: boolean;
isDraftMode: boolean;
resolvedPathname: string;
isNextDataRequest: boolean;
buildManifest: DeepReadonly;
fallbackBuildManifest: DeepReadonly;
nextFontManifest: DeepReadonly;
serverFilesManifest: DeepReadonly;
reactLoadableManifest: DeepReadonly;
routesManifest: DeepReadonly;
prerenderManifest: DeepReadonly;
clientReferenceManifest?: any;
serverActionsManifest?: any;
dynamicCssManifest?: any;
subresourceIntegrityManifest?: DeepReadonly>;
isOnDemandRevalidate: boolean;
revalidateOnlyGenerated: boolean;
nextConfig: NextConfigComplete;
routerServerContext?: RouterServerContext[string];
interceptionRoutePatterns?: any;
} | undefined>;
getResponseCache(req: IncomingMessage | BaseNextRequest): ResponseCache;
handleResponse({ req, nextConfig, cacheKey, routeKind, isFallback, prerenderManifest, isRoutePPREnabled, isOnDemandRevalidate, revalidateOnlyGenerated, responseGenerator, waitUntil, }: {
req: IncomingMessage | BaseNextRequest;
nextConfig: NextConfigComplete;
cacheKey: string | null;
routeKind: RouteKind;
isFallback?: boolean;
prerenderManifest: DeepReadonly;
isRoutePPREnabled?: boolean;
isOnDemandRevalidate?: boolean;
revalidateOnlyGenerated?: boolean;
responseGenerator: ResponseGenerator;
waitUntil?: (prom: Promise) => void;
}): Promise;
}