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 +1 -1
- package/src/flow-types.js.flow +1 -1
- package/src/index.js +10 -12
- package/src/index.js.flow +10 -15
- package/src/plugins/DependencyPlugin.js +1 -1
- package/src/plugins/DependencyPlugin.js.flow +1 -1
- package/src/plugins/HastePlugin.js +1 -1
- package/src/plugins/HastePlugin.js.flow +1 -1
- package/src/plugins/MockPlugin.js +2 -2
- package/src/plugins/MockPlugin.js.flow +2 -2
- package/src/plugins/dependencies/dependencyExtractor.d.ts +1 -1
package/package.json
CHANGED
package/src/flow-types.js.flow
CHANGED
|
@@ -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>):
|
|
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
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
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
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
[
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
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
|
}
|
|
@@ -64,7 +64,7 @@ export default class DependencyPlugin
|
|
|
64
64
|
return null;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
|
|
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
|
}
|
|
@@ -237,7 +237,7 @@ export default class HastePlugin
|
|
|
237
237
|
);
|
|
238
238
|
}
|
|
239
239
|
|
|
240
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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);
|