@farmfe/core
Version:
Farm is a extremely fast web build tool written in Rust. Farm can start a project in milliseconds and perform HMR within 10ms, making it much faster than similar tools like webpack and vite.
37 lines (30 loc) • 1.01 kB
TypeScript
import type { InferCustomEventPayload } from './custom-event';
export type ModuleNamespace = Record<string, any> & {
[Symbol.toStringTag]: 'Module';
};
export interface ViteHotContext {
readonly data: any;
accept(): void;
accept(cb: (mod: ModuleNamespace | undefined) => void): void;
accept(dep: string, cb: (mod: ModuleNamespace | undefined) => void): void;
accept(
deps: readonly string[],
cb: (mods: Array<ModuleNamespace | undefined>) => void
): void;
acceptExports(
exportNames: string | readonly string[],
cb?: (mod: ModuleNamespace | undefined) => void
): void;
dispose(cb: (data: any) => void): void;
prune(cb: (data: any) => void): void;
invalidate(message?: string): void;
on<T extends string>(
event: T,
cb: (payload: InferCustomEventPayload<T>) => void
): void;
off<T extends string>(
event: T,
cb: (payload: InferCustomEventPayload<T>) => void
): void;
send<T extends string>(event: T, data?: InferCustomEventPayload<T>): void;
}