import { RollupError } from "rollup";
import { Server } from ".";
import { ModuleNode } from "./moduleMap";
import type { IHMRType } from "../../client/hmr";
export declare namespace HMRType {
    type All = IHMRType.All;
    class Connected implements IHMRType.Connected {
        type: "connected";
    }
    class Custom implements IHMRType.Custom {
        event: string;
        data?: any;
        type: "custom";
        constructor(event: string, data?: any);
    }
    class Error implements IHMRType.Error {
        err: IHMRType.Error["err"];
        type: "error";
        constructor(err: IHMRType.Error["err"]);
    }
    class Reload implements IHMRType.Reload {
        path: string;
        type: "reload";
        constructor(path: string);
    }
    class Prune implements IHMRType.Prune {
        paths: string[];
        type: "prune";
        constructor(paths: string[]);
    }
    class Update implements IHMRType.Update {
        updates: IHMRType.UpdateItem[];
        type: "update";
        constructor(updates: IHMRType.UpdateItem[]);
    }
}
export declare function parserHMRError(err: Error | RollupError): HMRType.Error["err"];
/**
 * 收集HMR自定义监听的Dep依赖
 * @param code
 * @param start
 * @param urls
 * @returns selfAccepts
 */
export declare function acceptedHMRDeps(code: string, start: number, urls: Set<{
    url: string;
    start: number;
    end: number;
}>): boolean;
export declare function acceptedHMRExports(code: string, start: number, exportNames: Set<string>): boolean;
export declare function normalizeHMRUrl(url: string): string;
/**
 * 通知并去除不再使用的import modules
 * @param modules
 * @param server
 */
export declare function hmrPruned(modules: Set<ModuleNode>, server: Server): void;
export declare function hmrUpdate(file: string, server: Server): Promise<void>;
export declare function hmrFileAddUnlink(file: string, server: Server): Promise<void>;
export declare function updateModules(ctx: HMRContext): void;
export declare class HMRContext {
    file: string;
    readonly server: Server;
    modules: ModuleNode[];
    timestamp: number;
    relativePath: string;
    constructor(file: string, server: Server, _modules?: Set<ModuleNode>);
    read(): Promise<string>;
}
