UNPKG

hot-import

Version:

Hot Module Replacement (HMR) for Node.js

34 lines (33 loc) 1.56 kB
import { log } from 'brolog'; export { VERSION } from './version'; export interface KVStore { [id: string]: any; } export declare const moduleStore: KVStore; export declare const proxyStore: KVStore; export declare const watcherStore: KVStore; export declare function refreshImport(absFilePath: string): Promise<void>; export declare function hotImport(modulePathRelativeToCaller: string): Promise<any>; export declare function hotImport(modulePathRelativeToCaller: string | null, watch: boolean): Promise<void>; export declare function makeHot(absFilePath: string): void; export declare function makeCold(absFilePath: string): void; export declare function makeCold(mod: any): void; export declare function makeColdAll(): void; export declare function makeHotAll(): void; export declare function cloneProperties(dst: any, src: any): void; /** * Resolve filename based on caller's __dirname */ export declare function callerResolve(filePath: string, callerFileExcept?: string): string; /** * create an object instance (via the new operator), * but pass an arbitrary number of arguments to the constructor. * https://stackoverflow.com/a/8843181/1123955 */ export declare function newCall(cls: any, ..._: any[]): any; export declare function initProxyModule(absFilePath: string): any; export declare function importFile(absFilePath: string): Promise<any>; export declare function purgeRequireCache(absFilePath: string): any; export declare function restoreRequireCache(absFilePath: string, cache: any): void; export { log, }; export default hotImport;