๐Ÿ“ฆ robhogan / bench-file-map

๐Ÿ“„ index.d.ts ยท 94 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @format
 * @oncall react_native
 */

import type {
  BuildParameters,
  BuildResult,
  CacheData,
  CacheManagerFactory,
  ChangeEventMetadata,
  Console,
  FileData,
  FileSystem,
  HasteMapData,
  HasteMapItem,
  PerfLoggerFactory,
} from './flow-types';
import type {EventEmitter} from 'events';

export type {
  BuildParameters,
  CacheData,
  ChangeEventMetadata,
  FileData,
  FileMap,
  FileSystem,
  HasteMapData,
  HasteMapItem,
};

export type InputOptions = Readonly<{
  computeDependencies?: boolean | null;
  computeSha1?: boolean | null;
  enableSymlinks?: boolean | null;
  extensions: ReadonlyArray<string>;
  forceNodeFilesystemAPI?: boolean | null;
  ignorePattern?: RegExp | null;
  mocksPattern?: string | null;
  platforms: ReadonlyArray<string>;
  retainAllFiles: boolean;
  rootDir: string;
  roots: ReadonlyArray<string>;
  skipPackageJson?: boolean | null;

  /** Module paths that should export a 'getCacheKey' method */
  dependencyExtractor?: string | null;
  hasteImplModulePath?: string | null;

  perfLoggerFactory?: PerfLoggerFactory | null;
  resetCache?: boolean | null;
  maxWorkers: number;
  throwOnModuleCollision?: boolean | null;
  useWatchman?: boolean | null;
  watchmanDeferStates?: ReadonlyArray<string>;
  watch?: boolean | null;
  console?: Console;
  cacheManagerFactory?: CacheManagerFactory | null;

  healthCheck: HealthCheckOptions;
}>;

type HealthCheckOptions = Readonly<{
  enabled: boolean;
  interval: number;
  timeout: number;
  filePrefix: string;
}>;

export {DiskCacheManager} from './cache/DiskCacheManager';
export {DuplicateHasteCandidatesError} from './lib/DuplicateHasteCandidatesError';
export type {HasteMap} from './flow-types';
export type {HealthCheckResult} from './Watcher';
export type {
  CacheManager,
  CacheManagerFactory,
  ChangeEvent,
  WatcherStatus,
} from './flow-types';

export default class FileMap extends EventEmitter {
  static create(options: InputOptions): FileMap;
  constructor(options: InputOptions);
  build(): Promise<BuildResult>;
  read(): Promise<CacheData | null>;
}

export class DuplicateError extends Error {}