metro-file-map 0.80.6 → 0.80.8

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.80.6",
3
+ "version": "0.80.8",
4
4
  "description": "[Experimental] - 🚇 File crawling, watching and mapping for Metro",
5
5
  "main": "src/index.js",
6
6
  "repository": {
@@ -176,8 +176,8 @@ export class Watcher extends EventEmitter {
176
176
  const WatcherImpl = useWatchman
177
177
  ? WatchmanWatcher
178
178
  : FSEventsWatcher.isSupported()
179
- ? FSEventsWatcher
180
- : NodeWatcher;
179
+ ? FSEventsWatcher
180
+ : NodeWatcher;
181
181
 
182
182
  let watcher = 'node';
183
183
  if (WatcherImpl === WatchmanWatcher) {
@@ -165,10 +165,14 @@ module.exports = async function watchmanCrawl({
165
165
  let isFresh = false;
166
166
  await Promise.all(
167
167
  Array.from(rootProjectDirMappings).map(
168
- async ([root, { directoryFilters, watcher }], index) => {
168
+ async ([posixSeparatedRoot, { directoryFilters, watcher }], index) => {
169
169
  const since = previousState.clocks.get(
170
170
  (0, _normalizePathSeparatorsToPosix.default)(
171
- pathUtils.absoluteToNormal(root)
171
+ pathUtils.absoluteToNormal(
172
+ (0, _normalizePathSeparatorsToSystem.default)(
173
+ posixSeparatedRoot
174
+ )
175
+ )
172
176
  )
173
177
  );
174
178
  perfLogger?.annotate({
@@ -190,14 +194,14 @@ module.exports = async function watchmanCrawl({
190
194
  },
191
195
  });
192
196
  perfLogger?.point(`watchmanCrawl/query_${index}_start`);
193
- const response = await cmd("query", root, query);
197
+ const response = await cmd("query", posixSeparatedRoot, query);
194
198
  perfLogger?.point(`watchmanCrawl/query_${index}_end`);
195
199
  const isSourceControlQuery =
196
200
  typeof since !== "string" && since?.scm?.["mergebase-with"] != null;
197
201
  if (!isSourceControlQuery) {
198
202
  isFresh = isFresh || response.is_fresh_instance;
199
203
  }
200
- results.set(root, response);
204
+ results.set(posixSeparatedRoot, response);
201
205
  }
202
206
  )
203
207
  );
@@ -31,7 +31,7 @@ import {performance} from 'perf_hooks';
31
31
  const watchman = require('fb-watchman');
32
32
 
33
33
  type WatchmanRoots = Map<
34
- string,
34
+ string, // Posix-separated absolute path
35
35
  $ReadOnly<{directoryFilters: Array<string>, watcher: string}>,
36
36
  >;
37
37
 
@@ -181,7 +181,7 @@ module.exports = async function watchmanCrawl({
181
181
 
182
182
  await Promise.all(
183
183
  Array.from(rootProjectDirMappings).map(
184
- async ([root, {directoryFilters, watcher}], index) => {
184
+ async ([posixSeparatedRoot, {directoryFilters, watcher}], index) => {
185
185
  // Jest is only going to store one type of clock; a string that
186
186
  // represents a local clock. However, the Watchman crawler supports
187
187
  // a second type of clock that can be written by automation outside of
@@ -191,7 +191,11 @@ module.exports = async function watchmanCrawl({
191
191
  // By using scm queries, we can create the haste map on a different
192
192
  // system and import it, transforming the clock into a local clock.
193
193
  const since = previousState.clocks.get(
194
- normalizePathSeparatorsToPosix(pathUtils.absoluteToNormal(root)),
194
+ normalizePathSeparatorsToPosix(
195
+ pathUtils.absoluteToNormal(
196
+ normalizePathSeparatorsToSystem(posixSeparatedRoot),
197
+ ),
198
+ ),
195
199
  );
196
200
 
197
201
  perfLogger?.annotate({
@@ -218,7 +222,7 @@ module.exports = async function watchmanCrawl({
218
222
  perfLogger?.point(`watchmanCrawl/query_${index}_start`);
219
223
  const response = await cmd<WatchmanQueryResponse>(
220
224
  'query',
221
- root,
225
+ posixSeparatedRoot,
222
226
  query,
223
227
  );
224
228
  perfLogger?.point(`watchmanCrawl/query_${index}_end`);
@@ -232,7 +236,7 @@ module.exports = async function watchmanCrawl({
232
236
  isFresh = isFresh || response.is_fresh_instance;
233
237
  }
234
238
 
235
- results.set(root, response);
239
+ results.set(posixSeparatedRoot, response);
236
240
  },
237
241
  ),
238
242
  );
@@ -8,7 +8,7 @@
8
8
  * @oncall react_native
9
9
  */
10
10
 
11
- import type {PerfLoggerFactory, RootPerfLogger, PerfLogger} from 'metro-config';
11
+ import type {PerfLogger, PerfLoggerFactory, RootPerfLogger} from 'metro-config';
12
12
  import type {AbortSignal} from 'node-abort-controller';
13
13
 
14
14
  export type {PerfLoggerFactory, PerfLogger};