123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 |
- import EventEmitter from 'events';
- import { Config } from '@jest/types';
- import H from './constants';
- import HasteFS from './HasteFS';
- import HasteModuleMap, { SerializableModuleMap as HasteSerializableModuleMap } from './ModuleMap';
- import { ChangeEvent, HasteMap as InternalHasteMapObject, HasteRegExp, InternalHasteMap, Mapper } from './types';
- declare type HType = typeof H;
- declare type Options = {
- cacheDirectory?: string;
- computeDependencies?: boolean;
- computeSha1?: boolean;
- console?: Console;
- dependencyExtractor?: string;
- extensions: Array<string>;
- forceNodeFilesystemAPI?: boolean;
- hasteImplModulePath?: string;
- ignorePattern?: HasteRegExp;
- mapper?: Mapper;
- maxWorkers: number;
- mocksPattern?: string;
- name: string;
- platforms: Array<string>;
- providesModuleNodeModules?: Array<string>;
- resetCache?: boolean;
- retainAllFiles: boolean;
- rootDir: string;
- roots: Array<string>;
- skipPackageJson?: boolean;
- throwOnModuleCollision?: boolean;
- useWatchman?: boolean;
- watch?: boolean;
- };
- declare namespace HasteMap {
- type ModuleMap = HasteModuleMap;
- type SerializableModuleMap = HasteSerializableModuleMap;
- type FS = HasteFS;
- type HasteMapObject = InternalHasteMapObject;
- type HasteChangeEvent = ChangeEvent;
- }
- declare class HasteMap extends EventEmitter {
- private _buildPromise;
- private _cachePath;
- private _changeInterval?;
- private _console;
- private _options;
- private _watchers;
- private _whitelist;
- private _worker;
- constructor(options: Options);
- static getCacheFilePath(tmpdir: Config.Path, name: string, ...extra: Array<string>): string;
- getCacheFilePath(): string;
- build(): Promise<InternalHasteMapObject>;
- /**
- * 1. read data from the cache or create an empty structure.
- */
- read(): InternalHasteMap;
- readModuleMap(): HasteModuleMap;
- /**
- * 2. crawl the file system.
- */
- private _buildFileMap;
- /**
- * 3. parse and extract metadata from changed files.
- */
- private _processFile;
- private _buildHasteMap;
- private _cleanup;
- /**
- * 4. serialize the new `HasteMap` in a cache file.
- */
- private _persist;
- /**
- * Creates workers or parses files and extracts metadata in-process.
- */
- private _getWorker;
- private _crawl;
- /**
- * Watch mode
- */
- private _watch;
- /**
- * This function should be called when the file under `filePath` is removed
- * or changed. When that happens, we want to figure out if that file was
- * part of a group of files that had the same ID. If it was, we want to
- * remove it from the group. Furthermore, if there is only one file
- * remaining in the group, then we want to restore that single file as the
- * correct resolution for its ID, and cleanup the duplicates index.
- */
- private _recoverDuplicates;
- end(): Promise<void>;
- /**
- * Helpers
- */
- private _ignore;
- private _isNodeModulesDir;
- private _createEmptyMap;
- static H: HType;
- static DuplicateError: typeof DuplicateError;
- static ModuleMap: typeof HasteModuleMap;
- }
- declare class DuplicateError extends Error {
- mockPath1: string;
- mockPath2: string;
- constructor(mockPath1: string, mockPath2: string);
- }
- export = HasteMap;
- //# sourceMappingURL=index.d.ts.map
|