serverPluginHmr.d.ts 1.2 KB

1234567891011121314151617181920212223
  1. import { ServerPlugin } from '.';
  2. import { FSWatcher } from 'chokidar';
  3. import MagicString from 'magic-string';
  4. import { InternalResolver } from '../resolver';
  5. import LRUCache from 'lru-cache';
  6. import { HMRPayload } from '../../hmrPayload';
  7. export declare const debugHmr: any;
  8. export declare type HMRWatcher = FSWatcher & {
  9. handleVueReload: (filePath: string, timestamp?: number, content?: string) => void;
  10. handleJSReload: (filePath: string, timestamp?: number) => void;
  11. send: (payload: HMRPayload) => void;
  12. };
  13. declare type HMRStateMap = Map<string, Set<string>>;
  14. export declare const hmrAcceptanceMap: HMRStateMap;
  15. export declare const hmrDeclineSet: Set<string>;
  16. export declare const importerMap: HMRStateMap;
  17. export declare const importeeMap: HMRStateMap;
  18. export declare const hmrDirtyFilesMap: LRUCache<string, Set<string>>;
  19. export declare const latestVersionsMap: Map<string, string>;
  20. export declare const hmrPlugin: ServerPlugin;
  21. export declare function ensureMapEntry(map: HMRStateMap, key: string): Set<string>;
  22. export declare function rewriteFileWithHMR(root: string, source: string, importer: string, resolver: InternalResolver, s: MagicString): void;
  23. export {};