/** * Module Hot Replacement 状态类型定义 * * - idle: The process is waiting for a call to check * - check: The process is checking for updates * - prepare: The process is getting ready for the update (e.g. downloading the updated module) * - ready: The update is prepared and available * - dispose: The process is calling the dispose handlers on the modules that will be replaced * - apply: The process is calling the accept handlers and re-executing self-accepted modules * - abort: An update was aborted, but the system is still in its previous state * - fail: An update has thrown an exception and the system's state has been compromised */ export type ModuleHotType = 'idle' | 'check' | 'prepare' | 'ready' | 'dispose' | 'apply' | 'abort' | 'fail'; export interface ModuleHotInstance { addStatusHandler: (handler: (status: ModuleHotType) => void) => void; removeStatusHandler: (handler: (status: ModuleHotType) => void) => void; } /** * 获取 Webpack HMR 实例 * 仅支持 Webpack/Rspack 的 HMR API */ export declare function getModuleHot(): ModuleHotInstance | null; /** * 创建模块热更成功处理函数 * 监听模块热更状态,检测 apply -> idle 转换表示热更成功 * * @param callback 热更回调函数,参数为是否成功和当前状态 */ export declare function createApplyHandle(callback: (success: boolean, status: ModuleHotType) => void): (status: ModuleHotType) => void;