metro-file-map 0.71.0 → 0.71.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "metro-file-map",
3
- "version": "0.71.0",
3
+ "version": "0.71.3",
4
4
  "description": "[Experimental] - 🚇 File crawling, watching and mapping for Metro",
5
5
  "main": "src/index.js",
6
6
  "repository": {
@@ -13,7 +13,9 @@
13
13
  },
14
14
  "license": "MIT",
15
15
  "dependencies": {
16
+ "abort-controller": "^3.0.0",
16
17
  "anymatch": "^3.0.3",
18
+ "debug": "^2.2.0",
17
19
  "fb-watchman": "^2.0.0",
18
20
  "graceful-fs": "^4.2.4",
19
21
  "invariant": "^2.2.4",
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true,
5
+ });
6
+ exports.DiskCacheManager = void 0;
7
+
8
+ var _rootRelativeCacheKeys = _interopRequireDefault(
9
+ require("../lib/rootRelativeCacheKeys")
10
+ );
11
+
12
+ var _gracefulFs = require("graceful-fs");
13
+
14
+ var _os = require("os");
15
+
16
+ var _path = _interopRequireDefault(require("path"));
17
+
18
+ var _v = require("v8");
19
+
20
+ function _interopRequireDefault(obj) {
21
+ return obj && obj.__esModule ? obj : { default: obj };
22
+ }
23
+
24
+ /**
25
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
26
+ *
27
+ * This source code is licensed under the MIT license found in the
28
+ * LICENSE file in the root directory of this source tree.
29
+ *
30
+ *
31
+ * @format
32
+ */
33
+ // $FlowFixMe[missing-export] - serialize and deserialize missing typedefs
34
+ const DEFAULT_PREFIX = "metro-file-map";
35
+ const DEFAULT_DIRECTORY = (0, _os.tmpdir)();
36
+
37
+ class DiskCacheManager {
38
+ constructor({ buildParameters, cacheDirectory, cacheFilePrefix }) {
39
+ this._cachePath = DiskCacheManager.getCacheFilePath(
40
+ buildParameters,
41
+ cacheFilePrefix,
42
+ cacheDirectory
43
+ );
44
+ }
45
+
46
+ static getCacheFilePath(buildParameters, cacheFilePrefix, cacheDirectory) {
47
+ const { rootDirHash, relativeConfigHash } = (0,
48
+ _rootRelativeCacheKeys.default)(buildParameters);
49
+ return _path.default.join(
50
+ cacheDirectory !== null && cacheDirectory !== void 0
51
+ ? cacheDirectory
52
+ : DEFAULT_DIRECTORY,
53
+ `${
54
+ cacheFilePrefix !== null && cacheFilePrefix !== void 0
55
+ ? cacheFilePrefix
56
+ : DEFAULT_PREFIX
57
+ }-${rootDirHash}-${relativeConfigHash}`
58
+ );
59
+ }
60
+
61
+ getCacheFilePath() {
62
+ return this._cachePath;
63
+ }
64
+
65
+ async read() {
66
+ try {
67
+ return (0, _v.deserialize)(
68
+ (0, _gracefulFs.readFileSync)(this._cachePath)
69
+ );
70
+ } catch {}
71
+
72
+ return null;
73
+ }
74
+
75
+ async write(dataSnapshot, { changed, removed }) {
76
+ if (changed.size > 0 || removed.size > 0) {
77
+ (0, _gracefulFs.writeFileSync)(
78
+ this._cachePath,
79
+ (0, _v.serialize)(dataSnapshot)
80
+ );
81
+ }
82
+ }
83
+ }
84
+
85
+ exports.DiskCacheManager = DiskCacheManager;
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
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
+ * @flow strict-local
8
+ * @format
9
+ */
10
+
11
+ import type {
12
+ BuildParameters,
13
+ CacheManager,
14
+ FileData,
15
+ InternalData,
16
+ } from '../flow-types';
17
+
18
+ import rootRelativeCacheKeys from '../lib/rootRelativeCacheKeys';
19
+ import {readFileSync, writeFileSync} from 'graceful-fs';
20
+ import {tmpdir} from 'os';
21
+ import path from 'path';
22
+ // $FlowFixMe[missing-export] - serialize and deserialize missing typedefs
23
+ import {deserialize, serialize} from 'v8';
24
+
25
+ type DiskCacheConfig = {
26
+ buildParameters: BuildParameters,
27
+ cacheFilePrefix?: ?string,
28
+ cacheDirectory?: ?string,
29
+ };
30
+
31
+ const DEFAULT_PREFIX = 'metro-file-map';
32
+ const DEFAULT_DIRECTORY = tmpdir();
33
+
34
+ export class DiskCacheManager implements CacheManager {
35
+ _cachePath: string;
36
+
37
+ constructor({
38
+ buildParameters,
39
+ cacheDirectory,
40
+ cacheFilePrefix,
41
+ }: DiskCacheConfig) {
42
+ this._cachePath = DiskCacheManager.getCacheFilePath(
43
+ buildParameters,
44
+ cacheFilePrefix,
45
+ cacheDirectory,
46
+ );
47
+ }
48
+
49
+ static getCacheFilePath(
50
+ buildParameters: BuildParameters,
51
+ cacheFilePrefix?: ?string,
52
+ cacheDirectory?: ?string,
53
+ ): string {
54
+ const {rootDirHash, relativeConfigHash} =
55
+ rootRelativeCacheKeys(buildParameters);
56
+
57
+ return path.join(
58
+ cacheDirectory ?? DEFAULT_DIRECTORY,
59
+ `${
60
+ cacheFilePrefix ?? DEFAULT_PREFIX
61
+ }-${rootDirHash}-${relativeConfigHash}`,
62
+ );
63
+ }
64
+
65
+ getCacheFilePath(): string {
66
+ return this._cachePath;
67
+ }
68
+
69
+ async read(): Promise<?InternalData> {
70
+ try {
71
+ return deserialize(readFileSync(this._cachePath));
72
+ } catch {}
73
+ return null;
74
+ }
75
+
76
+ async write(
77
+ dataSnapshot: InternalData,
78
+ {changed, removed}: $ReadOnly<{changed: FileData, removed: FileData}>,
79
+ ): Promise<void> {
80
+ if (changed.size > 0 || removed.size > 0) {
81
+ writeFileSync(this._cachePath, serialize(dataSnapshot));
82
+ }
83
+ }
84
+ }
@@ -256,7 +256,7 @@ module.exports = async function nodeCrawl(options) {
256
256
  } = options;
257
257
  perfLogger === null || perfLogger === void 0
258
258
  ? void 0
259
- : perfLogger.markerPoint("nodeCrawl_start");
259
+ : perfLogger.point("nodeCrawl_start");
260
260
  const useNativeFind = await hasNativeFindSupport(forceNodeFilesystemAPI);
261
261
  return new Promise((resolve) => {
262
262
  const callback = (list) => {
@@ -279,7 +279,7 @@ module.exports = async function nodeCrawl(options) {
279
279
  data.files = files;
280
280
  perfLogger === null || perfLogger === void 0
281
281
  ? void 0
282
- : perfLogger.markerPoint("nodeCrawl_end");
282
+ : perfLogger.point("nodeCrawl_end");
283
283
  resolve({
284
284
  hasteMap: data,
285
285
  removedFiles,
@@ -12,7 +12,7 @@ import type {
12
12
  CrawlerOptions,
13
13
  FileData,
14
14
  IgnoreMatcher,
15
- InternalHasteMap,
15
+ InternalData,
16
16
  } from '../flow-types';
17
17
 
18
18
  import H from '../constants';
@@ -206,7 +206,7 @@ function findNative(
206
206
 
207
207
  module.exports = async function nodeCrawl(options: CrawlerOptions): Promise<{
208
208
  removedFiles: FileData,
209
- hasteMap: InternalHasteMap,
209
+ hasteMap: InternalData,
210
210
  }> {
211
211
  const {
212
212
  data,
@@ -218,7 +218,7 @@ module.exports = async function nodeCrawl(options: CrawlerOptions): Promise<{
218
218
  perfLogger,
219
219
  roots,
220
220
  } = options;
221
- perfLogger?.markerPoint('nodeCrawl_start');
221
+ perfLogger?.point('nodeCrawl_start');
222
222
  const useNativeFind = await hasNativeFindSupport(forceNodeFilesystemAPI);
223
223
 
224
224
  return new Promise(resolve => {
@@ -239,7 +239,7 @@ module.exports = async function nodeCrawl(options: CrawlerOptions): Promise<{
239
239
  });
240
240
  data.files = files;
241
241
 
242
- perfLogger?.markerPoint('nodeCrawl_end');
242
+ perfLogger?.point('nodeCrawl_end');
243
243
  resolve({
244
244
  hasteMap: data,
245
245
  removedFiles,
@@ -102,16 +102,22 @@ async function capabilityCheck(client, caps) {
102
102
  }
103
103
 
104
104
  module.exports = async function watchmanCrawl(options) {
105
+ var _options$abortSignal;
106
+
105
107
  const fields = ["name", "exists", "mtime_ms", "size"];
106
108
  const { data, extensions, ignore, rootDir, roots, perfLogger } = options;
107
109
  const clocks = data.clocks;
108
110
  perfLogger === null || perfLogger === void 0
109
111
  ? void 0
110
- : perfLogger.markerPoint("watchmanCrawl_start");
112
+ : perfLogger.point("watchmanCrawl_start");
111
113
  const client = new watchman.Client();
114
+ (_options$abortSignal = options.abortSignal) === null ||
115
+ _options$abortSignal === void 0
116
+ ? void 0
117
+ : _options$abortSignal.addEventListener("abort", () => client.end());
112
118
  perfLogger === null || perfLogger === void 0
113
119
  ? void 0
114
- : perfLogger.markerPoint("watchmanCrawl/negotiateCapabilities_start"); // https://facebook.github.io/watchman/docs/capabilities.html
120
+ : perfLogger.point("watchmanCrawl/negotiateCapabilities_start"); // https://facebook.github.io/watchman/docs/capabilities.html
115
121
  // Check adds about ~28ms
116
122
 
117
123
  const capabilities = await capabilityCheck(client, {
@@ -171,22 +177,22 @@ module.exports = async function watchmanCrawl(options) {
171
177
 
172
178
  perfLogger === null || perfLogger === void 0
173
179
  ? void 0
174
- : perfLogger.markerPoint("watchmanCrawl/negotiateCapabilities_end");
180
+ : perfLogger.point("watchmanCrawl/negotiateCapabilities_end");
175
181
 
176
182
  async function getWatchmanRoots(roots) {
177
183
  perfLogger === null || perfLogger === void 0
178
184
  ? void 0
179
- : perfLogger.markerPoint("watchmanCrawl/getWatchmanRoots_start");
185
+ : perfLogger.point("watchmanCrawl/getWatchmanRoots_start");
180
186
  const watchmanRoots = new Map();
181
187
  await Promise.all(
182
188
  roots.map(async (root, index) => {
183
189
  perfLogger === null || perfLogger === void 0
184
190
  ? void 0
185
- : perfLogger.markerPoint(`watchmanCrawl/watchProject_${index}_start`);
191
+ : perfLogger.point(`watchmanCrawl/watchProject_${index}_start`);
186
192
  const response = await cmd("watch-project", root);
187
193
  perfLogger === null || perfLogger === void 0
188
194
  ? void 0
189
- : perfLogger.markerPoint(`watchmanCrawl/watchProject_${index}_end`);
195
+ : perfLogger.point(`watchmanCrawl/watchProject_${index}_end`);
190
196
  const existing = watchmanRoots.get(response.watch); // A root can only be filtered if it was never seen with a
191
197
  // relative_path before.
192
198
 
@@ -209,14 +215,14 @@ module.exports = async function watchmanCrawl(options) {
209
215
  );
210
216
  perfLogger === null || perfLogger === void 0
211
217
  ? void 0
212
- : perfLogger.markerPoint("watchmanCrawl/getWatchmanRoots_end");
218
+ : perfLogger.point("watchmanCrawl/getWatchmanRoots_end");
213
219
  return watchmanRoots;
214
220
  }
215
221
 
216
222
  async function queryWatchmanForDirs(rootProjectDirMappings) {
217
223
  perfLogger === null || perfLogger === void 0
218
224
  ? void 0
219
- : perfLogger.markerPoint("watchmanCrawl/queryWatchmanForDirs_start");
225
+ : perfLogger.point("watchmanCrawl/queryWatchmanForDirs_start");
220
226
  const results = new Map();
221
227
  let isFresh = false;
222
228
  await Promise.all(
@@ -235,7 +241,7 @@ module.exports = async function watchmanCrawl(options) {
235
241
  const since = clocks.get(fastPath.relative(rootDir, root));
236
242
  perfLogger === null || perfLogger === void 0
237
243
  ? void 0
238
- : perfLogger.markerAnnotate({
244
+ : perfLogger.annotate({
239
245
  bool: {
240
246
  [`watchmanCrawl/query_${index}_has_clock`]: since != null,
241
247
  },
@@ -297,18 +303,18 @@ module.exports = async function watchmanCrawl(options) {
297
303
 
298
304
  perfLogger === null || perfLogger === void 0
299
305
  ? void 0
300
- : perfLogger.markerAnnotate({
306
+ : perfLogger.annotate({
301
307
  string: {
302
308
  [`watchmanCrawl/query_${index}_generator`]: queryGenerator,
303
309
  },
304
310
  });
305
311
  perfLogger === null || perfLogger === void 0
306
312
  ? void 0
307
- : perfLogger.markerPoint(`watchmanCrawl/query_${index}_start`);
313
+ : perfLogger.point(`watchmanCrawl/query_${index}_start`);
308
314
  const response = await cmd("query", root, query);
309
315
  perfLogger === null || perfLogger === void 0
310
316
  ? void 0
311
- : perfLogger.markerPoint(`watchmanCrawl/query_${index}_end`);
317
+ : perfLogger.point(`watchmanCrawl/query_${index}_end`);
312
318
 
313
319
  if ("warning" in response) {
314
320
  console.warn("watchman warning: ", response.warning);
@@ -334,7 +340,7 @@ module.exports = async function watchmanCrawl(options) {
334
340
  );
335
341
  perfLogger === null || perfLogger === void 0
336
342
  ? void 0
337
- : perfLogger.markerPoint("watchmanCrawl/queryWatchmanForDirs_end");
343
+ : perfLogger.point("watchmanCrawl/queryWatchmanForDirs_end");
338
344
  return {
339
345
  isFresh,
340
346
  results,
@@ -366,13 +372,13 @@ module.exports = async function watchmanCrawl(options) {
366
372
  if (clientError) {
367
373
  perfLogger === null || perfLogger === void 0
368
374
  ? void 0
369
- : perfLogger.markerPoint("watchmanCrawl_end");
375
+ : perfLogger.point("watchmanCrawl_end");
370
376
  throw clientError;
371
377
  }
372
378
 
373
379
  perfLogger === null || perfLogger === void 0
374
380
  ? void 0
375
- : perfLogger.markerPoint("watchmanCrawl/processResults_start");
381
+ : perfLogger.point("watchmanCrawl/processResults_start");
376
382
 
377
383
  for (const [watchRoot, response] of results) {
378
384
  const fsRoot = (0, _normalizePathSep.default)(watchRoot);
@@ -460,10 +466,10 @@ module.exports = async function watchmanCrawl(options) {
460
466
  data.files = files;
461
467
  perfLogger === null || perfLogger === void 0
462
468
  ? void 0
463
- : perfLogger.markerPoint("watchmanCrawl/processResults_end");
469
+ : perfLogger.point("watchmanCrawl/processResults_end");
464
470
  perfLogger === null || perfLogger === void 0
465
471
  ? void 0
466
- : perfLogger.markerPoint("watchmanCrawl_end");
472
+ : perfLogger.point("watchmanCrawl_end");
467
473
 
468
474
  if (didLogWatchmanWaitMessage) {
469
475
  console.warn("Watchman query finished.");
@@ -12,7 +12,7 @@ import type {
12
12
  CrawlerOptions,
13
13
  FileData,
14
14
  FileMetaData,
15
- InternalHasteMap,
15
+ InternalData,
16
16
  Path,
17
17
  } from '../flow-types';
18
18
 
@@ -106,16 +106,17 @@ module.exports = async function watchmanCrawl(
106
106
  ): Promise<{
107
107
  changedFiles?: FileData,
108
108
  removedFiles: FileData,
109
- hasteMap: InternalHasteMap,
109
+ hasteMap: InternalData,
110
110
  }> {
111
111
  const fields = ['name', 'exists', 'mtime_ms', 'size'];
112
112
  const {data, extensions, ignore, rootDir, roots, perfLogger} = options;
113
113
  const clocks = data.clocks;
114
114
 
115
- perfLogger?.markerPoint('watchmanCrawl_start');
115
+ perfLogger?.point('watchmanCrawl_start');
116
116
  const client = new watchman.Client();
117
+ options.abortSignal?.addEventListener('abort', () => client.end());
117
118
 
118
- perfLogger?.markerPoint('watchmanCrawl/negotiateCapabilities_start');
119
+ perfLogger?.point('watchmanCrawl/negotiateCapabilities_start');
119
120
  // https://facebook.github.io/watchman/docs/capabilities.html
120
121
  // Check adds about ~28ms
121
122
  const capabilities = await capabilityCheck(client, {
@@ -172,21 +173,21 @@ module.exports = async function watchmanCrawl(
172
173
  }
173
174
  }
174
175
 
175
- perfLogger?.markerPoint('watchmanCrawl/negotiateCapabilities_end');
176
+ perfLogger?.point('watchmanCrawl/negotiateCapabilities_end');
176
177
 
177
178
  async function getWatchmanRoots(
178
179
  roots: $ReadOnlyArray<Path>,
179
180
  ): Promise<WatchmanRoots> {
180
- perfLogger?.markerPoint('watchmanCrawl/getWatchmanRoots_start');
181
+ perfLogger?.point('watchmanCrawl/getWatchmanRoots_start');
181
182
  const watchmanRoots = new Map();
182
183
  await Promise.all(
183
184
  roots.map(async (root, index) => {
184
- perfLogger?.markerPoint(`watchmanCrawl/watchProject_${index}_start`);
185
+ perfLogger?.point(`watchmanCrawl/watchProject_${index}_start`);
185
186
  const response = await cmd<WatchmanWatchProjectResponse>(
186
187
  'watch-project',
187
188
  root,
188
189
  );
189
- perfLogger?.markerPoint(`watchmanCrawl/watchProject_${index}_end`);
190
+ perfLogger?.point(`watchmanCrawl/watchProject_${index}_end`);
190
191
  const existing = watchmanRoots.get(response.watch);
191
192
  // A root can only be filtered if it was never seen with a
192
193
  // relative_path before.
@@ -207,12 +208,12 @@ module.exports = async function watchmanCrawl(
207
208
  }
208
209
  }),
209
210
  );
210
- perfLogger?.markerPoint('watchmanCrawl/getWatchmanRoots_end');
211
+ perfLogger?.point('watchmanCrawl/getWatchmanRoots_end');
211
212
  return watchmanRoots;
212
213
  }
213
214
 
214
215
  async function queryWatchmanForDirs(rootProjectDirMappings: WatchmanRoots) {
215
- perfLogger?.markerPoint('watchmanCrawl/queryWatchmanForDirs_start');
216
+ perfLogger?.point('watchmanCrawl/queryWatchmanForDirs_start');
216
217
  const results = new Map<string, WatchmanQueryResponse>();
217
218
  let isFresh = false;
218
219
  await Promise.all(
@@ -228,7 +229,7 @@ module.exports = async function watchmanCrawl(
228
229
  // system and import it, transforming the clock into a local clock.
229
230
  const since = clocks.get(fastPath.relative(rootDir, root));
230
231
 
231
- perfLogger?.markerAnnotate({
232
+ perfLogger?.annotate({
232
233
  bool: {
233
234
  [`watchmanCrawl/query_${index}_has_clock`]: since != null,
234
235
  },
@@ -294,19 +295,19 @@ module.exports = async function watchmanCrawl(
294
295
  queryGenerator = 'suffix';
295
296
  }
296
297
 
297
- perfLogger?.markerAnnotate({
298
+ perfLogger?.annotate({
298
299
  string: {
299
300
  [`watchmanCrawl/query_${index}_generator`]: queryGenerator,
300
301
  },
301
302
  });
302
303
 
303
- perfLogger?.markerPoint(`watchmanCrawl/query_${index}_start`);
304
+ perfLogger?.point(`watchmanCrawl/query_${index}_start`);
304
305
  const response = await cmd<WatchmanQueryResponse>(
305
306
  'query',
306
307
  root,
307
308
  query,
308
309
  );
309
- perfLogger?.markerPoint(`watchmanCrawl/query_${index}_end`);
310
+ perfLogger?.point(`watchmanCrawl/query_${index}_end`);
310
311
 
311
312
  if ('warning' in response) {
312
313
  console.warn('watchman warning: ', response.warning);
@@ -326,7 +327,7 @@ module.exports = async function watchmanCrawl(
326
327
  ),
327
328
  );
328
329
 
329
- perfLogger?.markerPoint('watchmanCrawl/queryWatchmanForDirs_end');
330
+ perfLogger?.point('watchmanCrawl/queryWatchmanForDirs_end');
330
331
 
331
332
  return {
332
333
  isFresh,
@@ -357,11 +358,11 @@ module.exports = async function watchmanCrawl(
357
358
  }
358
359
 
359
360
  if (clientError) {
360
- perfLogger?.markerPoint('watchmanCrawl_end');
361
+ perfLogger?.point('watchmanCrawl_end');
361
362
  throw clientError;
362
363
  }
363
364
 
364
- perfLogger?.markerPoint('watchmanCrawl/processResults_start');
365
+ perfLogger?.point('watchmanCrawl/processResults_start');
365
366
 
366
367
  for (const [watchRoot, response] of results) {
367
368
  const fsRoot = normalizePathSep(watchRoot);
@@ -438,8 +439,8 @@ module.exports = async function watchmanCrawl(
438
439
 
439
440
  data.files = files;
440
441
 
441
- perfLogger?.markerPoint('watchmanCrawl/processResults_end');
442
- perfLogger?.markerPoint('watchmanCrawl_end');
442
+ perfLogger?.point('watchmanCrawl/processResults_end');
443
+ perfLogger?.point('watchmanCrawl_end');
443
444
  if (didLogWatchmanWaitMessage) {
444
445
  console.warn('Watchman query finished.');
445
446
  }
@@ -13,6 +13,44 @@
13
13
  import type HasteFS from './HasteFS';
14
14
  import type ModuleMap from './ModuleMap';
15
15
  import type {Stats} from 'graceful-fs';
16
+ import type {PerfLogger} from 'metro-config';
17
+
18
+ export type {PerfLogger};
19
+
20
+ // These inputs affect the internal data collected for a given filesystem
21
+ // state, and changes may invalidate a cache.
22
+ export type BuildParameters = $ReadOnly<{
23
+ computeDependencies: boolean,
24
+ computeSha1: boolean,
25
+ enableSymlinks: boolean,
26
+ extensions: $ReadOnlyArray<string>,
27
+ forceNodeFilesystemAPI: boolean,
28
+ ignorePattern: RegExp,
29
+ mocksPattern: ?RegExp,
30
+ platforms: $ReadOnlyArray<string>,
31
+ retainAllFiles: boolean,
32
+ rootDir: string,
33
+ roots: $ReadOnlyArray<string>,
34
+ skipPackageJson: boolean,
35
+
36
+ // Module paths that should export a 'getCacheKey' method
37
+ dependencyExtractor: ?string,
38
+ hasteImplModulePath: ?string,
39
+
40
+ cacheBreaker: string,
41
+ }>;
42
+
43
+ export interface CacheManager {
44
+ read(): Promise<?InternalData>;
45
+ write(
46
+ dataSnapshot: InternalData,
47
+ delta: $ReadOnly<{changed: FileData, removed: FileData}>,
48
+ ): Promise<void>;
49
+ }
50
+
51
+ export type CacheManagerFactory = (
52
+ buildParameters: BuildParameters,
53
+ ) => CacheManager;
16
54
 
17
55
  export type ChangeEvent = {
18
56
  eventsQueue: EventsQueue,
@@ -23,9 +61,10 @@ export type ChangeEvent = {
23
61
  export type Console = typeof global.console;
24
62
 
25
63
  export type CrawlerOptions = {
64
+ abortSignal: ?AbortSignal,
26
65
  computeSha1: boolean,
27
66
  enableSymlinks: boolean,
28
- data: InternalHasteMap,
67
+ data: InternalData,
29
68
  extensions: $ReadOnlyArray<string>,
30
69
  forceNodeFilesystemAPI: boolean,
31
70
  ignore: IgnoreMatcher,
@@ -46,20 +85,8 @@ export type EventsQueue = Array<{
46
85
  export type HasteMap = {
47
86
  hasteFS: HasteFS,
48
87
  moduleMap: ModuleMap,
49
- __hasteMapForTest?: ?InternalHasteMap,
50
- };
51
-
52
- export type HasteMapStatic<S = SerializableModuleMap> = {
53
- getCacheFilePath(
54
- tmpdir: Path,
55
- name: string,
56
- ...extra: $ReadOnlyArray<string>
57
- ): string,
58
- getModuleMapFromJSON(json: S): IModuleMap<S>,
59
88
  };
60
89
 
61
- export type HasteRegExp = RegExp | ((str: string) => boolean);
62
-
63
90
  export type HType = {
64
91
  ID: 0,
65
92
  MTIME: 1,
@@ -80,7 +107,7 @@ export type HTypeValue = $Values<HType>;
80
107
 
81
108
  export type IgnoreMatcher = (item: string) => boolean;
82
109
 
83
- export type InternalHasteMap = {
110
+ export type InternalData = {
84
111
  clocks: WatchmanClocks,
85
112
  duplicates: DuplicatesIndex,
86
113
  files: FileData,
@@ -131,22 +158,6 @@ export type ModuleMetaData = [/* path */ string, /* type */ number];
131
158
 
132
159
  export type Path = string;
133
160
 
134
- export interface PerfLogger {
135
- markerPoint(name: string): void;
136
- markerAnnotate(annotations: PerfAnnotations): void;
137
- }
138
-
139
- export type PerfAnnotations = $Shape<{
140
- string: {[key: string]: string},
141
- int: {[key: string]: number},
142
- double: {[key: string]: number},
143
- bool: {[key: string]: boolean},
144
- string_array: {[key: string]: Array<string>},
145
- int_array: {[key: string]: Array<number>},
146
- double_array: {[key: string]: Array<number>},
147
- bool_array: {[key: string]: Array<boolean>},
148
- }>;
149
-
150
161
  export type RawModuleMap = {
151
162
  rootDir: Path,
152
163
  duplicates: DuplicatesIndex,