metro-file-map 0.83.5 → 0.83.6

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.
Files changed (57) hide show
  1. package/package.json +1 -1
  2. package/src/Watcher.d.ts +13 -9
  3. package/src/Watcher.js +66 -39
  4. package/src/Watcher.js.flow +84 -51
  5. package/src/cache/DiskCacheManager.d.ts +8 -1
  6. package/src/constants.d.ts +8 -1
  7. package/src/crawlers/node/hasNativeFindSupport.d.ts +8 -1
  8. package/src/crawlers/node/index.d.ts +10 -5
  9. package/src/crawlers/node/index.js +4 -1
  10. package/src/crawlers/node/index.js.flow +8 -6
  11. package/src/crawlers/watchman/index.d.ts +12 -12
  12. package/src/crawlers/watchman/index.js.flow +2 -6
  13. package/src/flow-types.d.ts +88 -32
  14. package/src/flow-types.js.flow +89 -29
  15. package/src/index.d.ts +11 -4
  16. package/src/index.js +145 -120
  17. package/src/index.js.flow +199 -149
  18. package/src/lib/FileProcessor.d.ts +8 -1
  19. package/src/lib/FileSystemChangeAggregator.d.ts +40 -0
  20. package/src/lib/FileSystemChangeAggregator.js +89 -0
  21. package/src/lib/FileSystemChangeAggregator.js.flow +143 -0
  22. package/src/lib/RootPathUtils.d.ts +8 -1
  23. package/src/lib/TreeFS.d.ts +23 -8
  24. package/src/lib/TreeFS.js +67 -16
  25. package/src/lib/TreeFS.js.flow +89 -16
  26. package/src/lib/checkWatchmanCapabilities.d.ts +8 -1
  27. package/src/lib/normalizePathSeparatorsToPosix.d.ts +8 -1
  28. package/src/lib/normalizePathSeparatorsToSystem.d.ts +8 -1
  29. package/src/lib/rootRelativeCacheKeys.d.ts +8 -1
  30. package/src/lib/sorting.d.ts +8 -1
  31. package/src/plugins/DependencyPlugin.d.ts +9 -13
  32. package/src/plugins/DependencyPlugin.js +1 -3
  33. package/src/plugins/DependencyPlugin.js.flow +1 -16
  34. package/src/plugins/HastePlugin.d.ts +10 -11
  35. package/src/plugins/HastePlugin.js +11 -11
  36. package/src/plugins/HastePlugin.js.flow +12 -12
  37. package/src/plugins/MockPlugin.d.ts +10 -5
  38. package/src/plugins/MockPlugin.js +17 -20
  39. package/src/plugins/MockPlugin.js.flow +18 -22
  40. package/src/plugins/dependencies/dependencyExtractor.d.ts +1 -1
  41. package/src/plugins/haste/DuplicateHasteCandidatesError.d.ts +8 -1
  42. package/src/plugins/haste/HasteConflictsError.d.ts +8 -1
  43. package/src/plugins/haste/computeConflicts.d.ts +8 -1
  44. package/src/plugins/haste/getPlatformExtension.d.ts +8 -1
  45. package/src/plugins/mocks/getMockName.d.ts +8 -1
  46. package/src/watchers/AbstractWatcher.d.ts +8 -1
  47. package/src/watchers/FallbackWatcher.d.ts +8 -1
  48. package/src/watchers/FallbackWatcher.js +19 -3
  49. package/src/watchers/FallbackWatcher.js.flow +28 -5
  50. package/src/watchers/NativeWatcher.d.ts +9 -2
  51. package/src/watchers/NativeWatcher.js +27 -5
  52. package/src/watchers/NativeWatcher.js.flow +33 -6
  53. package/src/watchers/RecrawlWarning.d.ts +8 -1
  54. package/src/watchers/WatchmanWatcher.d.ts +8 -1
  55. package/src/watchers/common.d.ts +10 -1
  56. package/src/watchers/common.js +6 -1
  57. package/src/watchers/common.js.flow +1 -0
@@ -4,7 +4,14 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @format
7
+ * @noformat
8
+ * @generated SignedSource<<719a82b7670f09ecb97e007293fddfc6>>
9
+ *
10
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
11
+ * Original file: packages/metro-file-map/src/lib/normalizePathSeparatorsToSystem.js
12
+ * To regenerate, run:
13
+ * js1 build metro-ts-defs (internal) OR
14
+ * yarn run build-ts-defs (OSS)
8
15
  */
9
16
 
10
17
  declare const $$EXPORT_DEFAULT_DECLARATION$$: (filePath: string) => string;
@@ -4,8 +4,15 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @format
7
+ * @noformat
8
8
  * @oncall react_native
9
+ * @generated SignedSource<<f82cf1eeac38c409c5bf891686c2e828>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro-file-map/src/lib/rootRelativeCacheKeys.js
13
+ * To regenerate, run:
14
+ * js1 build metro-ts-defs (internal) OR
15
+ * yarn run build-ts-defs (OSS)
9
16
  */
10
17
 
11
18
  import type {BuildParameters} from '../flow-types';
@@ -4,7 +4,14 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @format
7
+ * @noformat
8
+ * @generated SignedSource<<8805bc71542c6b43e940f8c5761ff187>>
9
+ *
10
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
11
+ * Original file: packages/metro-file-map/src/lib/sorting.js
12
+ * To regenerate, run:
13
+ * js1 build metro-ts-defs (internal) OR
14
+ * yarn run build-ts-defs (OSS)
8
15
  */
9
16
 
10
17
  export declare function compareStrings(
@@ -4,12 +4,18 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @format
7
+ * @noformat
8
8
  * @oncall react_native
9
+ * @generated SignedSource<<e07a9c061b0224fc44191d956461bd6f>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro-file-map/src/plugins/DependencyPlugin.js
13
+ * To regenerate, run:
14
+ * js1 build metro-ts-defs (internal) OR
15
+ * yarn run build-ts-defs (OSS)
9
16
  */
10
17
 
11
18
  import type {
12
- FileMapDelta,
13
19
  FileMapPlugin,
14
20
  FileMapPluginInitOptions,
15
21
  FileMapPluginWorker,
@@ -32,17 +38,7 @@ declare class DependencyPlugin
32
38
  initOptions: FileMapPluginInitOptions<null, ReadonlyArray<string> | null>,
33
39
  ): Promise<void>;
34
40
  getSerializableSnapshot(): null;
35
- bulkUpdate(
36
- delta: FileMapDelta<null | undefined | ReadonlyArray<string>>,
37
- ): void;
38
- onNewOrModifiedFile(
39
- relativeFilePath: string,
40
- pluginData: null | undefined | ReadonlyArray<string>,
41
- ): void;
42
- onRemovedFile(
43
- relativeFilePath: string,
44
- pluginData: null | undefined | ReadonlyArray<string>,
45
- ): void;
41
+ onChanged(): void;
46
42
  assertValid(): void;
47
43
  getCacheKey(): string;
48
44
  getWorker(): FileMapPluginWorker;
@@ -28,9 +28,7 @@ class DependencyPlugin {
28
28
  getSerializableSnapshot() {
29
29
  return null;
30
30
  }
31
- bulkUpdate(delta) {}
32
- onNewOrModifiedFile(relativeFilePath, pluginData) {}
33
- onRemovedFile(relativeFilePath, pluginData) {}
31
+ onChanged() {}
34
32
  assertValid() {}
35
33
  getCacheKey() {
36
34
  if (this.#dependencyExtractor != null) {
@@ -10,7 +10,6 @@
10
10
  */
11
11
 
12
12
  import type {
13
- FileMapDelta,
14
13
  FileMapPlugin,
15
14
  FileMapPluginInitOptions,
16
15
  FileMapPluginWorker,
@@ -64,25 +63,11 @@ export default class DependencyPlugin
64
63
  return null;
65
64
  }
66
65
 
67
- bulkUpdate(delta: FileMapDelta<?ReadonlyArray<string>>): void {
66
+ onChanged(): void {
68
67
  // No-op: Worker already populated plugin data
69
68
  // Plugin data is write-only from worker
70
69
  }
71
70
 
72
- onNewOrModifiedFile(
73
- relativeFilePath: string,
74
- pluginData: ?ReadonlyArray<string>,
75
- ): void {
76
- // No-op: Dependencies already in plugin data
77
- }
78
-
79
- onRemovedFile(
80
- relativeFilePath: string,
81
- pluginData: ?ReadonlyArray<string>,
82
- ): void {
83
- // No-op
84
- }
85
-
86
71
  assertValid(): void {
87
72
  // No validation needed
88
73
  }
@@ -4,13 +4,19 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @format
7
+ * @noformat
8
8
  * @oncall react_native
9
+ * @generated SignedSource<<3d1462ab2325a09553e02b69b5de84eb>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro-file-map/src/plugins/HastePlugin.js
13
+ * To regenerate, run:
14
+ * js1 build metro-ts-defs (internal) OR
15
+ * yarn run build-ts-defs (OSS)
9
16
  */
10
17
 
11
18
  import type {
12
19
  Console,
13
- FileMapDelta,
14
20
  FileMapPlugin,
15
21
  FileMapPluginInitOptions,
16
22
  FileMapPluginWorker,
@@ -20,6 +26,7 @@ import type {
20
26
  HTypeValue,
21
27
  Path,
22
28
  PerfLogger,
29
+ ReadonlyFileSystemChanges,
23
30
  } from '../flow-types';
24
31
 
25
32
  export type HasteMapOptions = Readonly<{
@@ -52,16 +59,8 @@ declare class HastePlugin
52
59
  platform: null | undefined | string,
53
60
  _supportsNativePlatform?: null | undefined | boolean,
54
61
  ): null | undefined | Path;
55
- bulkUpdate(delta: FileMapDelta<null | undefined | string>): void;
56
- onNewOrModifiedFile(
57
- relativeFilePath: string,
58
- id: null | undefined | string,
59
- ): void;
62
+ onChanged(delta: ReadonlyFileSystemChanges<null | undefined | string>): void;
60
63
  setModule(id: string, module: HasteMapItemMetadata): void;
61
- onRemovedFile(
62
- relativeFilePath: string,
63
- moduleName: null | undefined | string,
64
- ): void;
65
64
  assertValid(): void;
66
65
  computeConflicts(): Array<HasteConflict>;
67
66
  getCacheKey(): string;
@@ -163,22 +163,22 @@ class HastePlugin {
163
163
  duplicates,
164
164
  );
165
165
  }
166
- bulkUpdate(delta) {
167
- for (const [normalPath, maybeHasteId] of delta.removed) {
168
- this.onRemovedFile(normalPath, maybeHasteId);
166
+ onChanged(delta) {
167
+ for (const [canonicalPath, maybeHasteId] of delta.removedFiles) {
168
+ this.#onRemovedFile(canonicalPath, maybeHasteId);
169
169
  }
170
- for (const [normalPath, maybeHasteId] of delta.addedOrModified) {
171
- this.onNewOrModifiedFile(normalPath, maybeHasteId);
170
+ for (const [canonicalPath, maybeHasteId] of delta.addedFiles) {
171
+ this.#onNewFile(canonicalPath, maybeHasteId);
172
172
  }
173
173
  }
174
- onNewOrModifiedFile(relativeFilePath, id) {
174
+ #onNewFile(canonicalPath, id) {
175
175
  if (id == null) {
176
176
  return;
177
177
  }
178
178
  const module = [
179
- relativeFilePath,
179
+ canonicalPath,
180
180
  this.#enableHastePackages &&
181
- _path.default.basename(relativeFilePath) === "package.json"
181
+ _path.default.basename(canonicalPath) === "package.json"
182
182
  ? _constants.default.PACKAGE
183
183
  : _constants.default.MODULE,
184
184
  ];
@@ -248,12 +248,12 @@ class HastePlugin {
248
248
  }
249
249
  hasteMapItem[platform] = module;
250
250
  }
251
- onRemovedFile(relativeFilePath, moduleName) {
251
+ #onRemovedFile(canonicalPath, moduleName) {
252
252
  if (moduleName == null) {
253
253
  return;
254
254
  }
255
255
  const platform =
256
- (0, _getPlatformExtension.default)(relativeFilePath, this.#platforms) ||
256
+ (0, _getPlatformExtension.default)(canonicalPath, this.#platforms) ||
257
257
  _constants.default.GENERIC_PLATFORM;
258
258
  const hasteMapItem = this.#map.get(moduleName);
259
259
  if (hasteMapItem != null) {
@@ -264,7 +264,7 @@ class HastePlugin {
264
264
  this.#map.set(moduleName, hasteMapItem);
265
265
  }
266
266
  }
267
- this.#recoverDuplicates(moduleName, relativeFilePath);
267
+ this.#recoverDuplicates(moduleName, canonicalPath);
268
268
  }
269
269
  assertValid() {
270
270
  if (!this.#failValidationOnConflicts) {
@@ -13,7 +13,6 @@ import type {
13
13
  Console,
14
14
  DuplicatesIndex,
15
15
  DuplicatesSet,
16
- FileMapDelta,
17
16
  FileMapPlugin,
18
17
  FileMapPluginInitOptions,
19
18
  FileMapPluginWorker,
@@ -24,6 +23,7 @@ import type {
24
23
  HTypeValue,
25
24
  Path,
26
25
  PerfLogger,
26
+ ReadonlyFileSystemChanges,
27
27
  } from '../flow-types';
28
28
 
29
29
  import H from '../constants';
@@ -237,26 +237,26 @@ export default class HastePlugin
237
237
  );
238
238
  }
239
239
 
240
- bulkUpdate(delta: FileMapDelta<?string>): void {
240
+ onChanged(delta: ReadonlyFileSystemChanges<?string>): void {
241
241
  // Process removals first so that moves aren't treated as duplicates.
242
- for (const [normalPath, maybeHasteId] of delta.removed) {
243
- this.onRemovedFile(normalPath, maybeHasteId);
242
+ for (const [canonicalPath, maybeHasteId] of delta.removedFiles) {
243
+ this.#onRemovedFile(canonicalPath, maybeHasteId);
244
244
  }
245
- for (const [normalPath, maybeHasteId] of delta.addedOrModified) {
246
- this.onNewOrModifiedFile(normalPath, maybeHasteId);
245
+ for (const [canonicalPath, maybeHasteId] of delta.addedFiles) {
246
+ this.#onNewFile(canonicalPath, maybeHasteId);
247
247
  }
248
248
  }
249
249
 
250
- onNewOrModifiedFile(relativeFilePath: string, id: ?string) {
250
+ #onNewFile(canonicalPath: string, id: ?string) {
251
251
  if (id == null) {
252
252
  // Not a Haste module or package
253
253
  return;
254
254
  }
255
255
 
256
256
  const module: HasteMapItemMetadata = [
257
- relativeFilePath,
257
+ canonicalPath,
258
258
  this.#enableHastePackages &&
259
- path.basename(relativeFilePath) === 'package.json'
259
+ path.basename(canonicalPath) === 'package.json'
260
260
  ? H.PACKAGE
261
261
  : H.MODULE,
262
262
  ];
@@ -324,14 +324,14 @@ export default class HastePlugin
324
324
  hasteMapItem[platform] = module;
325
325
  }
326
326
 
327
- onRemovedFile(relativeFilePath: string, moduleName: ?string) {
327
+ #onRemovedFile(canonicalPath: string, moduleName: ?string) {
328
328
  if (moduleName == null) {
329
329
  // Not a Haste module or package
330
330
  return;
331
331
  }
332
332
 
333
333
  const platform =
334
- getPlatformExtension(relativeFilePath, this.#platforms) ||
334
+ getPlatformExtension(canonicalPath, this.#platforms) ||
335
335
  H.GENERIC_PLATFORM;
336
336
 
337
337
  const hasteMapItem = this.#map.get(moduleName);
@@ -344,7 +344,7 @@ export default class HastePlugin
344
344
  }
345
345
  }
346
346
 
347
- this.#recoverDuplicates(moduleName, relativeFilePath);
347
+ this.#recoverDuplicates(moduleName, canonicalPath);
348
348
  }
349
349
 
350
350
  assertValid(): void {
@@ -4,18 +4,25 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @format
7
+ * @noformat
8
8
  * @oncall react_native
9
+ * @generated SignedSource<<d9402d4670982b1e675e1edd9201cf75>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro-file-map/src/plugins/MockPlugin.js
13
+ * To regenerate, run:
14
+ * js1 build metro-ts-defs (internal) OR
15
+ * yarn run build-ts-defs (OSS)
9
16
  */
10
17
 
11
18
  import type {
12
- FileMapDelta,
13
19
  FileMapPlugin,
14
20
  FileMapPluginInitOptions,
15
21
  FileMapPluginWorker,
16
22
  MockMap as IMockMap,
17
23
  Path,
18
24
  RawMockMap,
25
+ ReadonlyFileSystemChanges,
19
26
  } from '../flow-types';
20
27
 
21
28
  export declare const CACHE_VERSION: 2;
@@ -32,9 +39,7 @@ declare class MockPlugin implements FileMapPlugin<RawMockMap, void>, IMockMap {
32
39
  constructor($$PARAM_0$$: MockMapOptions);
33
40
  initialize($$PARAM_0$$: FileMapPluginInitOptions<RawMockMap>): Promise<void>;
34
41
  getMockModule(name: string): null | undefined | Path;
35
- bulkUpdate(delta: FileMapDelta): void;
36
- onNewOrModifiedFile(relativeFilePath: Path): void;
37
- onRemovedFile(relativeFilePath: Path): void;
42
+ onChanged(delta: ReadonlyFileSystemChanges<null | undefined | void>): void;
38
43
  getSerializableSnapshot(): RawMockMap;
39
44
  assertValid(): void;
40
45
  getCacheKey(): string;
@@ -51,15 +51,12 @@ class MockPlugin {
51
51
  if (pluginState != null && pluginState.version === this.#raw.version) {
52
52
  this.#raw = pluginState;
53
53
  } else {
54
- this.bulkUpdate({
55
- addedOrModified: [
56
- ...files.fileIterator({
57
- includeNodeModules: false,
58
- includeSymlinks: false,
59
- }),
60
- ].map(({ canonicalPath }) => [canonicalPath, null]),
61
- removed: [],
62
- });
54
+ for (const { canonicalPath } of files.fileIterator({
55
+ includeNodeModules: false,
56
+ includeSymlinks: false,
57
+ })) {
58
+ this.#onFileAdded(canonicalPath);
59
+ }
63
60
  }
64
61
  }
65
62
  getMockModule(name) {
@@ -72,22 +69,22 @@ class MockPlugin {
72
69
  (0, _normalizePathSeparatorsToSystem.default)(mockPosixRelativePath),
73
70
  );
74
71
  }
75
- bulkUpdate(delta) {
76
- for (const [relativeFilePath] of delta.removed) {
77
- this.onRemovedFile(relativeFilePath);
72
+ onChanged(delta) {
73
+ for (const [canonicalPath] of delta.removedFiles) {
74
+ this.#onFileRemoved(canonicalPath);
78
75
  }
79
- for (const [relativeFilePath] of delta.addedOrModified) {
80
- this.onNewOrModifiedFile(relativeFilePath);
76
+ for (const [canonicalPath] of delta.addedFiles) {
77
+ this.#onFileAdded(canonicalPath);
81
78
  }
82
79
  }
83
- onNewOrModifiedFile(relativeFilePath) {
84
- const absoluteFilePath = this.#pathUtils.normalToAbsolute(relativeFilePath);
80
+ #onFileAdded(canonicalPath) {
81
+ const absoluteFilePath = this.#pathUtils.normalToAbsolute(canonicalPath);
85
82
  if (!this.#mocksPattern.test(absoluteFilePath)) {
86
83
  return;
87
84
  }
88
85
  const mockName = (0, _getMockName.default)(absoluteFilePath);
89
86
  const posixRelativePath = (0, _normalizePathSeparatorsToPosix.default)(
90
- relativeFilePath,
87
+ canonicalPath,
91
88
  );
92
89
  const existingMockPosixPath = this.#raw.mocks.get(mockName);
93
90
  if (existingMockPosixPath != null) {
@@ -104,8 +101,8 @@ class MockPlugin {
104
101
  }
105
102
  this.#raw.mocks.set(mockName, posixRelativePath);
106
103
  }
107
- onRemovedFile(relativeFilePath) {
108
- const absoluteFilePath = this.#pathUtils.normalToAbsolute(relativeFilePath);
104
+ #onFileRemoved(canonicalPath) {
105
+ const absoluteFilePath = this.#pathUtils.normalToAbsolute(canonicalPath);
109
106
  if (!this.#mocksPattern.test(absoluteFilePath)) {
110
107
  return;
111
108
  }
@@ -113,7 +110,7 @@ class MockPlugin {
113
110
  const duplicates = this.#raw.duplicates.get(mockName);
114
111
  if (duplicates != null) {
115
112
  const posixRelativePath = (0, _normalizePathSeparatorsToPosix.default)(
116
- relativeFilePath,
113
+ canonicalPath,
117
114
  );
118
115
  duplicates.delete(posixRelativePath);
119
116
  if (duplicates.size === 1) {
@@ -10,13 +10,13 @@
10
10
  */
11
11
 
12
12
  import type {
13
- FileMapDelta,
14
13
  FileMapPlugin,
15
14
  FileMapPluginInitOptions,
16
15
  FileMapPluginWorker,
17
16
  MockMap as IMockMap,
18
17
  Path,
19
18
  RawMockMap,
19
+ ReadonlyFileSystemChanges,
20
20
  } from '../flow-types';
21
21
 
22
22
  import normalizePathSeparatorsToPosix from '../lib/normalizePathSeparatorsToPosix';
@@ -79,15 +79,12 @@ export default class MockPlugin
79
79
  this.#raw = pluginState;
80
80
  } else {
81
81
  // Otherwise, traverse all files to rebuild
82
- this.bulkUpdate({
83
- addedOrModified: [
84
- ...files.fileIterator({
85
- includeNodeModules: false,
86
- includeSymlinks: false,
87
- }),
88
- ].map(({canonicalPath}) => [canonicalPath, null]),
89
- removed: [],
90
- });
82
+ for (const {canonicalPath} of files.fileIterator({
83
+ includeNodeModules: false,
84
+ includeSymlinks: false,
85
+ })) {
86
+ this.#onFileAdded(canonicalPath);
87
+ }
91
88
  }
92
89
  }
93
90
 
@@ -102,24 +99,24 @@ export default class MockPlugin
102
99
  );
103
100
  }
104
101
 
105
- bulkUpdate(delta: FileMapDelta<>): void {
102
+ onChanged(delta: ReadonlyFileSystemChanges<?void>): void {
106
103
  // Process removals first so that moves aren't treated as duplicates.
107
- for (const [relativeFilePath] of delta.removed) {
108
- this.onRemovedFile(relativeFilePath);
104
+ for (const [canonicalPath] of delta.removedFiles) {
105
+ this.#onFileRemoved(canonicalPath);
109
106
  }
110
- for (const [relativeFilePath] of delta.addedOrModified) {
111
- this.onNewOrModifiedFile(relativeFilePath);
107
+ for (const [canonicalPath] of delta.addedFiles) {
108
+ this.#onFileAdded(canonicalPath);
112
109
  }
113
110
  }
114
111
 
115
- onNewOrModifiedFile(relativeFilePath: Path): void {
116
- const absoluteFilePath = this.#pathUtils.normalToAbsolute(relativeFilePath);
112
+ #onFileAdded(canonicalPath: Path): void {
113
+ const absoluteFilePath = this.#pathUtils.normalToAbsolute(canonicalPath);
117
114
  if (!this.#mocksPattern.test(absoluteFilePath)) {
118
115
  return;
119
116
  }
120
117
 
121
118
  const mockName = getMockName(absoluteFilePath);
122
- const posixRelativePath = normalizePathSeparatorsToPosix(relativeFilePath);
119
+ const posixRelativePath = normalizePathSeparatorsToPosix(canonicalPath);
123
120
 
124
121
  const existingMockPosixPath = this.#raw.mocks.get(mockName);
125
122
  if (existingMockPosixPath != null) {
@@ -141,16 +138,15 @@ export default class MockPlugin
141
138
  this.#raw.mocks.set(mockName, posixRelativePath);
142
139
  }
143
140
 
144
- onRemovedFile(relativeFilePath: Path): void {
145
- const absoluteFilePath = this.#pathUtils.normalToAbsolute(relativeFilePath);
141
+ #onFileRemoved(canonicalPath: Path): void {
142
+ const absoluteFilePath = this.#pathUtils.normalToAbsolute(canonicalPath);
146
143
  if (!this.#mocksPattern.test(absoluteFilePath)) {
147
144
  return;
148
145
  }
149
146
  const mockName = getMockName(absoluteFilePath);
150
147
  const duplicates = this.#raw.duplicates.get(mockName);
151
148
  if (duplicates != null) {
152
- const posixRelativePath =
153
- normalizePathSeparatorsToPosix(relativeFilePath);
149
+ const posixRelativePath = normalizePathSeparatorsToPosix(canonicalPath);
154
150
  duplicates.delete(posixRelativePath);
155
151
  if (duplicates.size === 1) {
156
152
  this.#raw.duplicates.delete(mockName);
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @format
7
+ * @generated by js1 build metro-ts-defs / yarn run build-ts-defs
8
8
  */
9
9
 
10
10
  declare const dependencyExtractor: {
@@ -4,8 +4,15 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @format
7
+ * @noformat
8
8
  * @oncall react_native
9
+ * @generated SignedSource<<2c991103bc4a71a81ef04de0884de576>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro-file-map/src/plugins/haste/DuplicateHasteCandidatesError.js
13
+ * To regenerate, run:
14
+ * js1 build metro-ts-defs (internal) OR
15
+ * yarn run build-ts-defs (OSS)
9
16
  */
10
17
 
11
18
  import type {DuplicatesSet} from '../../flow-types';
@@ -4,8 +4,15 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @format
7
+ * @noformat
8
8
  * @oncall react_native
9
+ * @generated SignedSource<<53c103ffe2115282c4d72593f47018aa>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro-file-map/src/plugins/haste/HasteConflictsError.js
13
+ * To regenerate, run:
14
+ * js1 build metro-ts-defs (internal) OR
15
+ * yarn run build-ts-defs (OSS)
9
16
  */
10
17
 
11
18
  import type {HasteConflict} from '../../flow-types';
@@ -4,7 +4,14 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @format
7
+ * @noformat
8
+ * @generated SignedSource<<f56c9fdb2fc1c692fa880c61a14ba1e3>>
9
+ *
10
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
11
+ * Original file: packages/metro-file-map/src/plugins/haste/computeConflicts.js
12
+ * To regenerate, run:
13
+ * js1 build metro-ts-defs (internal) OR
14
+ * yarn run build-ts-defs (OSS)
8
15
  */
9
16
 
10
17
  import type {HasteMapItem} from '../../flow-types';
@@ -4,7 +4,14 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @format
7
+ * @noformat
8
+ * @generated SignedSource<<3d628d7c2b6149348fcdc5782fc24bb7>>
9
+ *
10
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
11
+ * Original file: packages/metro-file-map/src/plugins/haste/getPlatformExtension.js
12
+ * To regenerate, run:
13
+ * js1 build metro-ts-defs (internal) OR
14
+ * yarn run build-ts-defs (OSS)
8
15
  */
9
16
 
10
17
  declare function getPlatformExtension(
@@ -4,7 +4,14 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @format
7
+ * @noformat
8
+ * @generated SignedSource<<1c1794b89fa69eff13b6cd80bf0ab42d>>
9
+ *
10
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
11
+ * Original file: packages/metro-file-map/src/plugins/mocks/getMockName.js
12
+ * To regenerate, run:
13
+ * js1 build metro-ts-defs (internal) OR
14
+ * yarn run build-ts-defs (OSS)
8
15
  */
9
16
 
10
17
  declare const $$EXPORT_DEFAULT_DECLARATION$$: (filePath: string) => string;
@@ -4,7 +4,14 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @format
7
+ * @noformat
8
+ * @generated SignedSource<<ba8a5de14ca08c751a87bea6b356a670>>
9
+ *
10
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
11
+ * Original file: packages/metro-file-map/src/watchers/AbstractWatcher.js
12
+ * To regenerate, run:
13
+ * js1 build metro-ts-defs (internal) OR
14
+ * yarn run build-ts-defs (OSS)
8
15
  */
9
16
 
10
17
  import type {
@@ -4,8 +4,15 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @format
7
+ * @noformat
8
8
  * @oncall react_native
9
+ * @generated SignedSource<<5152d1919d3373e4df611e0fca805e1c>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro-file-map/src/watchers/FallbackWatcher.js
13
+ * To regenerate, run:
14
+ * js1 build metro-ts-defs (internal) OR
15
+ * yarn run build-ts-defs (OSS)
9
16
  */
10
17
 
11
18
  import {AbstractWatcher} from './AbstractWatcher';