import type { NextConfigComplete } from '../config-shared';
import type { ServerFields, SetupOpts } from '../lib/router-utils/setup-dev-bundler';
import type { Endpoint, Entrypoints as RawEntrypoints, Issue, StyledString, TurbopackResult, WrittenEndpoint } from '../../build/swc';
import { type HMR_ACTION_TYPES } from './hot-reloader-types';
import type { PropagateToWorkersField } from '../lib/router-utils/types';
import type { TurbopackManifestLoader } from './turbopack/manifest-loader';
import type { AppRoute, Entrypoints, PageRoute } from './turbopack/types';
import { type EntryKey } from './turbopack/entry-key';
export declare function getTurbopackJsConfig(dir: string, nextConfig: NextConfigComplete): Promise<{
    compilerOptions: Record<string, any>;
}>;
export declare function formatIssue(issue: Issue): string;
export type CurrentIssues = Map<EntryKey, Map<string, Issue>>;
export declare function processIssues(currentIssues: CurrentIssues, key: EntryKey, result: TurbopackResult, throwIssue?: boolean): void;
export declare function renderStyledStringToErrorAnsi(string: StyledString): string;
export declare function msToNs(ms: number): bigint;
export type ChangeSubscriptions = Map<EntryKey, Promise<AsyncIterableIterator<TurbopackResult>>>;
export type HandleWrittenEndpoint = (key: EntryKey, result: TurbopackResult<WrittenEndpoint>) => void;
export type StartChangeSubscription = (key: EntryKey, includeIssues: boolean, endpoint: Endpoint | undefined, makePayload: (change: TurbopackResult) => Promise<HMR_ACTION_TYPES> | HMR_ACTION_TYPES | void) => Promise<void>;
export type StopChangeSubscription = (key: EntryKey) => 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>;
type HandleRouteTypeHooks = {
    handleWrittenEndpoint: HandleWrittenEndpoint;
    subscribeToChanges: StartChangeSubscription;
};
export declare function handleRouteType({ dev, page, pathname, route, currentIssues, entrypoints, manifestLoader, readyIds, rewrites, hooks, }: {
    dev: boolean;
    page: string;
    pathname: string;
    route: PageRoute | AppRoute;
    currentIssues: CurrentIssues;
    entrypoints: Entrypoints;
    manifestLoader: TurbopackManifestLoader;
    rewrites: SetupOpts['fsChecker']['rewrites'];
    readyIds?: ReadyIds;
    hooks?: HandleRouteTypeHooks;
}): Promise<void>;
type HandleEntrypointsHooks = {
    handleWrittenEndpoint: HandleWrittenEndpoint;
    propagateServerField: (field: PropagateToWorkersField, args: any) => Promise<void>;
    sendHmr: SendHmr;
    startBuilding: StartBuilding;
    subscribeToChanges: StartChangeSubscription;
    unsubscribeFromChanges: StopChangeSubscription;
};
export declare function handleEntrypoints({ entrypoints, currentEntrypoints, currentIssues, manifestLoader, nextConfig, rewrites, changeSubscriptions, serverFields, hooks, }: {
    entrypoints: TurbopackResult<RawEntrypoints>;
    currentEntrypoints: Entrypoints;
    currentIssues: CurrentIssues;
    manifestLoader: TurbopackManifestLoader;
    nextConfig: NextConfigComplete;
    rewrites: SetupOpts['fsChecker']['rewrites'];
    changeSubscriptions?: ChangeSubscriptions;
    serverFields?: ServerFields;
    hooks?: HandleEntrypointsHooks;
}): Promise<void>;
export declare function handlePagesErrorRoute({ currentIssues, entrypoints, manifestLoader, rewrites, hooks, }: {
    currentIssues: CurrentIssues;
    entrypoints: Entrypoints;
    manifestLoader: TurbopackManifestLoader;
    rewrites: SetupOpts['fsChecker']['rewrites'];
    hooks?: HandleRouteTypeHooks;
}): Promise<void>;
export {};
