UNPKG

2.99 kBTypeScriptView Raw
1/**
2 * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7/// <reference types="node" />
8import type { Stats } from 'graceful-fs';
9import type { Config } from '@jest/types';
10import type ModuleMap from './ModuleMap';
11import type HasteFS from './HasteFS';
12export declare type IgnoreMatcher = (item: string) => boolean;
13export declare type WorkerMessage = {
14 computeDependencies: boolean;
15 computeSha1: boolean;
16 dependencyExtractor?: string | null;
17 rootDir: string;
18 filePath: string;
19 hasteImplModulePath?: string;
20};
21export declare type WorkerMetadata = {
22 dependencies: Array<string> | undefined | null;
23 id: string | undefined | null;
24 module: ModuleMetaData | undefined | null;
25 sha1: string | undefined | null;
26};
27export declare type CrawlerOptions = {
28 computeSha1: boolean;
29 data: InternalHasteMap;
30 extensions: Array<string>;
31 forceNodeFilesystemAPI: boolean;
32 ignore: IgnoreMatcher;
33 rootDir: string;
34 roots: Array<string>;
35};
36export declare type HasteImpl = {
37 getHasteName(filePath: Config.Path): string | undefined;
38};
39export declare type FileData = Map<Config.Path, FileMetaData>;
40export declare type FileMetaData = [
41 string,
42 number,
43 number,
44 0 | 1,
45 string,
46 string | null | undefined
47];
48export declare type MockData = Map<string, Config.Path>;
49export declare type ModuleMapData = Map<string, ModuleMapItem>;
50export declare type WatchmanClocks = Map<Config.Path, string>;
51export declare type HasteRegExp = RegExp | ((str: string) => boolean);
52export declare type DuplicatesSet = Map<string, /* type */ number>;
53export declare type DuplicatesIndex = Map<string, Map<string, DuplicatesSet>>;
54export declare type InternalHasteMap = {
55 clocks: WatchmanClocks;
56 duplicates: DuplicatesIndex;
57 files: FileData;
58 map: ModuleMapData;
59 mocks: MockData;
60};
61export declare type HasteMap = {
62 hasteFS: HasteFS;
63 moduleMap: ModuleMap;
64 __hasteMapForTest?: InternalHasteMap | null;
65};
66export declare type RawModuleMap = {
67 rootDir: Config.Path;
68 duplicates: DuplicatesIndex;
69 map: ModuleMapData;
70 mocks: MockData;
71};
72declare type ModuleMapItem = {
73 [platform: string]: ModuleMetaData;
74};
75export declare type ModuleMetaData = [Config.Path, /* type */ number];
76export declare type HType = {
77 ID: 0;
78 MTIME: 1;
79 SIZE: 2;
80 VISITED: 3;
81 DEPENDENCIES: 4;
82 SHA1: 5;
83 PATH: 0;
84 TYPE: 1;
85 MODULE: 0;
86 PACKAGE: 1;
87 GENERIC_PLATFORM: 'g';
88 NATIVE_PLATFORM: 'native';
89 DEPENDENCY_DELIM: '\0';
90};
91export declare type HTypeValue = HType[keyof HType];
92export declare type EventsQueue = Array<{
93 filePath: Config.Path;
94 stat: Stats | undefined;
95 type: string;
96}>;
97export declare type ChangeEvent = {
98 eventsQueue: EventsQueue;
99 hasteFS: HasteFS;
100 moduleMap: ModuleMap;
101};
102export {};
103
\No newline at end of file