metro-file-map 0.84.0 → 0.84.1

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.84.0",
3
+ "version": "0.84.1",
4
4
  "description": "[Experimental] - 🚇 File crawling, watching and mapping for Metro",
5
5
  "main": "src/index.js",
6
6
  "exports": {
@@ -213,7 +213,7 @@ export interface FileMapPlugin<
213
213
  initOptions: FileMapPluginInitOptions<SerializableState, PerFileData>,
214
214
  ): Promise<void>;
215
215
  assertValid(): void;
216
- bulkUpdate(delta: FileMapDelta<?PerFileData>): Promise<void>;
216
+ bulkUpdate(delta: FileMapDelta<?PerFileData>): void;
217
217
  getSerializableSnapshot(): SerializableState;
218
218
  onRemovedFile(relativeFilePath: string, pluginData: ?PerFileData): void;
219
219
  onNewOrModifiedFile(relativeFilePath: string, pluginData: ?PerFileData): void;
package/src/index.js CHANGED
@@ -458,18 +458,16 @@ class FileMap extends _events.default {
458
458
  fileSystem.bulkAddOrModify(changedFiles);
459
459
  this.#startupPerfLogger?.point("applyFileDelta_add_end");
460
460
  this.#startupPerfLogger?.point("applyFileDelta_updatePlugins_start");
461
- await Promise.all([
462
- plugins.map(({ plugin, dataIdx }) => {
463
- const mapFn =
464
- dataIdx != null
465
- ? ([relativePath, fileData]) => [relativePath, fileData[dataIdx]]
466
- : ([relativePath, fileData]) => [relativePath, null];
467
- return plugin.bulkUpdate({
468
- addedOrModified: mapIterator(changedFiles.entries(), mapFn),
469
- removed: mapIterator(removed.values(), mapFn),
470
- });
471
- }),
472
- ]);
461
+ plugins.forEach(({ plugin, dataIdx }) => {
462
+ const mapFn =
463
+ dataIdx != null
464
+ ? ([relativePath, fileData]) => [relativePath, fileData[dataIdx]]
465
+ : ([relativePath, fileData]) => [relativePath, null];
466
+ plugin.bulkUpdate({
467
+ addedOrModified: mapIterator(changedFiles.entries(), mapFn),
468
+ removed: mapIterator(removed.values(), mapFn),
469
+ });
470
+ });
473
471
  this.#startupPerfLogger?.point("applyFileDelta_updatePlugins_end");
474
472
  this.#startupPerfLogger?.point("applyFileDelta_end");
475
473
  }
package/src/index.js.flow CHANGED
@@ -667,21 +667,16 @@ export default class FileMap extends EventEmitter {
667
667
  this.#startupPerfLogger?.point('applyFileDelta_add_end');
668
668
 
669
669
  this.#startupPerfLogger?.point('applyFileDelta_updatePlugins_start');
670
-
671
- await Promise.all([
672
- plugins.map(({plugin, dataIdx}) => {
673
- const mapFn: (
674
- [CanonicalPath, FileMetadata],
675
- ) => [CanonicalPath, unknown] =
676
- dataIdx != null
677
- ? ([relativePath, fileData]) => [relativePath, fileData[dataIdx]]
678
- : ([relativePath, fileData]) => [relativePath, null];
679
- return plugin.bulkUpdate({
680
- addedOrModified: mapIterator(changedFiles.entries(), mapFn),
681
- removed: mapIterator(removed.values(), mapFn),
682
- });
683
- }),
684
- ]);
670
+ plugins.forEach(({plugin, dataIdx}) => {
671
+ const mapFn: ([CanonicalPath, FileMetadata]) => [CanonicalPath, unknown] =
672
+ dataIdx != null
673
+ ? ([relativePath, fileData]) => [relativePath, fileData[dataIdx]]
674
+ : ([relativePath, fileData]) => [relativePath, null];
675
+ plugin.bulkUpdate({
676
+ addedOrModified: mapIterator(changedFiles.entries(), mapFn),
677
+ removed: mapIterator(removed.values(), mapFn),
678
+ });
679
+ });
685
680
  this.#startupPerfLogger?.point('applyFileDelta_updatePlugins_end');
686
681
  this.#startupPerfLogger?.point('applyFileDelta_end');
687
682
  }
@@ -28,7 +28,7 @@ class DependencyPlugin {
28
28
  getSerializableSnapshot() {
29
29
  return null;
30
30
  }
31
- async bulkUpdate(delta) {}
31
+ bulkUpdate(delta) {}
32
32
  onNewOrModifiedFile(relativeFilePath, pluginData) {}
33
33
  onRemovedFile(relativeFilePath, pluginData) {}
34
34
  assertValid() {}
@@ -64,7 +64,7 @@ export default class DependencyPlugin
64
64
  return null;
65
65
  }
66
66
 
67
- async bulkUpdate(delta: FileMapDelta<?ReadonlyArray<string>>): Promise<void> {
67
+ bulkUpdate(delta: FileMapDelta<?ReadonlyArray<string>>): void {
68
68
  // No-op: Worker already populated plugin data
69
69
  // Plugin data is write-only from worker
70
70
  }
@@ -163,7 +163,7 @@ class HastePlugin {
163
163
  duplicates,
164
164
  );
165
165
  }
166
- async bulkUpdate(delta) {
166
+ bulkUpdate(delta) {
167
167
  for (const [normalPath, maybeHasteId] of delta.removed) {
168
168
  this.onRemovedFile(normalPath, maybeHasteId);
169
169
  }
@@ -237,7 +237,7 @@ export default class HastePlugin
237
237
  );
238
238
  }
239
239
 
240
- async bulkUpdate(delta: FileMapDelta<?string>): Promise<void> {
240
+ bulkUpdate(delta: FileMapDelta<?string>): void {
241
241
  // Process removals first so that moves aren't treated as duplicates.
242
242
  for (const [normalPath, maybeHasteId] of delta.removed) {
243
243
  this.onRemovedFile(normalPath, maybeHasteId);
@@ -51,7 +51,7 @@ class MockPlugin {
51
51
  if (pluginState != null && pluginState.version === this.#raw.version) {
52
52
  this.#raw = pluginState;
53
53
  } else {
54
- await this.bulkUpdate({
54
+ this.bulkUpdate({
55
55
  addedOrModified: [
56
56
  ...files.fileIterator({
57
57
  includeNodeModules: false,
@@ -72,7 +72,7 @@ class MockPlugin {
72
72
  (0, _normalizePathSeparatorsToSystem.default)(mockPosixRelativePath),
73
73
  );
74
74
  }
75
- async bulkUpdate(delta) {
75
+ bulkUpdate(delta) {
76
76
  for (const [relativeFilePath] of delta.removed) {
77
77
  this.onRemovedFile(relativeFilePath);
78
78
  }
@@ -79,7 +79,7 @@ export default class MockPlugin
79
79
  this.#raw = pluginState;
80
80
  } else {
81
81
  // Otherwise, traverse all files to rebuild
82
- await this.bulkUpdate({
82
+ this.bulkUpdate({
83
83
  addedOrModified: [
84
84
  ...files.fileIterator({
85
85
  includeNodeModules: false,
@@ -102,7 +102,7 @@ export default class MockPlugin
102
102
  );
103
103
  }
104
104
 
105
- async bulkUpdate(delta: FileMapDelta<>): Promise<void> {
105
+ bulkUpdate(delta: FileMapDelta<>): void {
106
106
  // Process removals first so that moves aren't treated as duplicates.
107
107
  for (const [relativeFilePath] of delta.removed) {
108
108
  this.onRemovedFile(relativeFilePath);
@@ -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: {