import type { ActionManifest } from '../../build/webpack/plugins/flight-client-entry-plugin';
import type { NextFontManifest } from '../../build/webpack/plugins/next-font-manifest-plugin';
import type { LoadableManifest } from '../load-components';
import type { MiddlewareManifest } from '../../build/webpack/plugins/middleware-plugin';
import type { PagesManifest } from '../../build/webpack/plugins/pages-manifest-plugin';
import type { AppBuildManifest } from '../../build/webpack/plugins/app-build-manifest-plugin';
import type { BuildManifest } from '../get-page-files';
import type { NextConfigComplete } from '../config-shared';
import { APP_BUILD_MANIFEST, APP_PATHS_MANIFEST, BUILD_MANIFEST, MIDDLEWARE_MANIFEST, NEXT_FONT_MANIFEST, PAGES_MANIFEST, SERVER_REFERENCE_MANIFEST, REACT_LOADABLE_MANIFEST } from '../../shared/lib/constants';
import type { ServerFields, SetupOpts } from '../lib/router-utils/setup-dev-bundler';
import type { Issue, Route, TurbopackResult, StyledString, Endpoint, WrittenEndpoint, Entrypoints } from '../../build/swc';
import { type HMR_ACTION_TYPES } from './hot-reloader-types';
import type { PropagateToWorkersField } from '../lib/router-utils/types';
export interface InstrumentationDefinition {
    files: string[];
    name: 'instrumentation';
}
export type TurbopackMiddlewareManifest = MiddlewareManifest & {
    instrumentation?: InstrumentationDefinition;
};
export declare function mergeBuildManifests(manifests: Iterable<BuildManifest>): Partial<BuildManifest> & Pick<BuildManifest, "pages">;
export declare function mergeAppBuildManifests(manifests: Iterable<AppBuildManifest>): AppBuildManifest;
export declare function mergePagesManifests(manifests: Iterable<PagesManifest>): PagesManifest;
export declare function mergeMiddlewareManifests(manifests: Iterable<TurbopackMiddlewareManifest>): MiddlewareManifest;
export declare function mergeActionManifests(manifests: Iterable<ActionManifest>): Promise<ActionManifest>;
export declare function mergeFontManifests(manifests: Iterable<NextFontManifest>): NextFontManifest;
export declare function mergeLoadableManifests(manifests: Iterable<LoadableManifest>): LoadableManifest;
export declare function getTurbopackJsConfig(dir: string, nextConfig: NextConfigComplete): Promise<{
    compilerOptions: Record<string, any>;
}>;
export declare function readPartialManifest<T>(distDir: string, name: typeof MIDDLEWARE_MANIFEST | typeof BUILD_MANIFEST | typeof APP_BUILD_MANIFEST | typeof PAGES_MANIFEST | typeof APP_PATHS_MANIFEST | `${typeof SERVER_REFERENCE_MANIFEST}.json` | `${typeof NEXT_FONT_MANIFEST}.json` | typeof REACT_LOADABLE_MANIFEST, pageName: string, type?: 'pages' | 'app' | 'app-route' | 'middleware' | 'instrumentation'): Promise<T>;
export type BuildManifests = Map<string, BuildManifest>;
export type AppBuildManifests = Map<string, AppBuildManifest>;
export type PagesManifests = Map<string, PagesManifest>;
export type AppPathsManifests = Map<string, PagesManifest>;
export type MiddlewareManifests = Map<string, TurbopackMiddlewareManifest>;
export type ActionManifests = Map<string, ActionManifest>;
export type FontManifests = Map<string, NextFontManifest>;
export type LoadableManifests = Map<string, LoadableManifest>;
export type CurrentEntrypoints = Map<string, Route>;
export type ChangeSubscriptions = Map<string, Promise<AsyncIterableIterator<TurbopackResult>>>;
export declare function loadMiddlewareManifest(distDir: string, middlewareManifests: MiddlewareManifests, pageName: string, type: 'pages' | 'app' | 'app-route' | 'middleware' | 'instrumentation'): Promise<void>;
export declare function writeManifests({ rewrites, distDir, buildId, buildManifests, appBuildManifests, pagesManifests, appPathsManifests, middlewareManifests, actionManifests, fontManifests, loadableManifests, currentEntrypoints, }: {
    rewrites: SetupOpts['fsChecker']['rewrites'];
    distDir: string;
    buildId: string;
    buildManifests: BuildManifests;
    appBuildManifests: AppBuildManifests;
    pagesManifests: PagesManifests;
    appPathsManifests: AppPathsManifests;
    middlewareManifests: MiddlewareManifests;
    actionManifests: ActionManifests;
    fontManifests: FontManifests;
    loadableManifests: LoadableManifests;
    currentEntrypoints: CurrentEntrypoints;
}): Promise<void>;
export declare function formatIssue(issue: Issue): string;
export type CurrentIssues = Map<string, Map<string, Issue>>;
export declare function processIssues(currentIssues: CurrentIssues, name: string, result: TurbopackResult, throwIssue?: boolean): void;
export declare function renderStyledStringToErrorAnsi(string: StyledString): string;
export declare function msToNs(ms: number): bigint;
export interface GlobalEntrypoints {
    app: Endpoint | undefined;
    document: Endpoint | undefined;
    error: Endpoint | undefined;
}
export type HandleRequireCacheClearing = (id: string, result: TurbopackResult<WrittenEndpoint>) => void;
export type ChangeSubscription = (page: string, type: 'client' | 'server', includeIssues: boolean, endpoint: Endpoint | undefined, makePayload: (page: string, change: TurbopackResult) => Promise<HMR_ACTION_TYPES> | HMR_ACTION_TYPES | void) => Promise<void>;
export type ClearChangeSubscription = (page: string, type: 'server' | 'client') => Promise<void>;
export type SendHmr = (id: string, payload: HMR_ACTION_TYPES) => void;
export type StartBuilding = (id: string, requestUrl: string | undefined, forceRebuild: boolean) => () => void;
export type ReadyIds = Set<string>;
export declare function handleRouteType({ rewrites, distDir, buildId, globalEntrypoints, currentIssues, buildManifests, appBuildManifests, pagesManifests, appPathsManifests, middlewareManifests, actionManifests, fontManifests, loadableManifests, currentEntrypoints, handleRequireCacheClearing, changeSubscription, readyIds, page, route, }: {
    rewrites: SetupOpts['fsChecker']['rewrites'];
    distDir: string;
    buildId: string;
    globalEntrypoints: GlobalEntrypoints;
    currentIssues: CurrentIssues;
    buildManifests: BuildManifests;
    appBuildManifests: AppBuildManifests;
    pagesManifests: PagesManifests;
    appPathsManifests: AppPathsManifests;
    middlewareManifests: MiddlewareManifests;
    actionManifests: ActionManifests;
    fontManifests: FontManifests;
    loadableManifests: LoadableManifests;
    currentEntrypoints: CurrentEntrypoints;
    handleRequireCacheClearing: HandleRequireCacheClearing | undefined;
    changeSubscription: ChangeSubscription | undefined;
    readyIds: ReadyIds | undefined;
    page: string;
    route: Route;
}): Promise<void>;
export declare function handleEntrypoints({ rewrites, nextConfig, entrypoints, serverFields, propagateServerField, distDir, buildId, globalEntrypoints, currentEntrypoints, changeSubscriptions, changeSubscription, clearChangeSubscription, sendHmr, startBuilding, handleRequireCacheClearing, prevMiddleware, currentIssues, buildManifests, appBuildManifests, pagesManifests, appPathsManifests, middlewareManifests, actionManifests, fontManifests, loadableManifests, }: {
    rewrites: SetupOpts['fsChecker']['rewrites'];
    nextConfig: NextConfigComplete;
    entrypoints: TurbopackResult<Entrypoints>;
    serverFields: ServerFields | undefined;
    propagateServerField: ((field: PropagateToWorkersField, args: any) => Promise<void>) | undefined;
    distDir: string;
    buildId: string;
    globalEntrypoints: GlobalEntrypoints;
    currentEntrypoints: CurrentEntrypoints;
    changeSubscriptions: ChangeSubscriptions | undefined;
    changeSubscription: ChangeSubscription | undefined;
    clearChangeSubscription: ClearChangeSubscription | undefined;
    sendHmr: SendHmr | undefined;
    startBuilding: StartBuilding | undefined;
    handleRequireCacheClearing: HandleRequireCacheClearing | undefined;
    prevMiddleware: boolean | undefined;
    currentIssues: CurrentIssues;
    buildManifests: BuildManifests;
    appBuildManifests: AppBuildManifests;
    pagesManifests: PagesManifests;
    appPathsManifests: AppPathsManifests;
    middlewareManifests: MiddlewareManifests;
    actionManifests: ActionManifests;
    fontManifests: FontManifests;
    loadableManifests: LoadableManifests;
}): Promise<void>;
export declare function handlePagesErrorRoute({ rewrites, globalEntrypoints, currentIssues, distDir, buildId, buildManifests, pagesManifests, fontManifests, appBuildManifests, appPathsManifests, middlewareManifests, actionManifests, loadableManifests, currentEntrypoints, handleRequireCacheClearing, changeSubscription, }: {
    rewrites: SetupOpts['fsChecker']['rewrites'];
    globalEntrypoints: GlobalEntrypoints;
    currentIssues: CurrentIssues;
    distDir: string;
    buildId: string;
    buildManifests: BuildManifests;
    pagesManifests: PagesManifests;
    fontManifests: FontManifests;
    appBuildManifests: AppBuildManifests;
    appPathsManifests: AppPathsManifests;
    middlewareManifests: MiddlewareManifests;
    actionManifests: ActionManifests;
    loadableManifests: LoadableManifests;
    currentEntrypoints: CurrentEntrypoints;
    handleRequireCacheClearing: HandleRequireCacheClearing | undefined;
    changeSubscription: ChangeSubscription | undefined;
}): Promise<void>;
