metro-file-map 0.84.2 → 0.84.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 +1 -1
- package/src/Watcher.d.ts +6 -9
- package/src/Watcher.js +66 -39
- package/src/Watcher.js.flow +84 -51
- package/src/crawlers/node/index.d.ts +3 -5
- package/src/crawlers/node/index.js +4 -1
- package/src/crawlers/node/index.js.flow +8 -6
- package/src/crawlers/watchman/index.d.ts +5 -12
- package/src/crawlers/watchman/index.js.flow +2 -6
- package/src/flow-types.d.ts +81 -32
- package/src/flow-types.js.flow +89 -29
- package/src/index.d.ts +4 -4
- package/src/index.js +145 -120
- package/src/index.js.flow +199 -149
- package/src/lib/FileSystemChangeAggregator.d.ts +40 -0
- package/src/lib/FileSystemChangeAggregator.js +89 -0
- package/src/lib/FileSystemChangeAggregator.js.flow +143 -0
- package/src/lib/TreeFS.d.ts +16 -8
- package/src/lib/TreeFS.js +67 -16
- package/src/lib/TreeFS.js.flow +89 -16
- package/src/plugins/DependencyPlugin.d.ts +2 -13
- package/src/plugins/DependencyPlugin.js +1 -3
- package/src/plugins/DependencyPlugin.js.flow +1 -16
- package/src/plugins/HastePlugin.d.ts +3 -11
- package/src/plugins/HastePlugin.js +11 -11
- package/src/plugins/HastePlugin.js.flow +12 -12
- package/src/plugins/MockPlugin.d.ts +3 -5
- package/src/plugins/MockPlugin.js +17 -20
- package/src/plugins/MockPlugin.js.flow +18 -22
- package/src/watchers/FallbackWatcher.js +19 -3
- package/src/watchers/FallbackWatcher.js.flow +28 -5
- package/src/watchers/NativeWatcher.d.ts +2 -2
- package/src/watchers/NativeWatcher.js +27 -5
- package/src/watchers/NativeWatcher.js.flow +33 -6
- package/src/watchers/common.d.ts +3 -1
- package/src/watchers/common.js +6 -1
- package/src/watchers/common.js.flow +1 -0
package/package.json
CHANGED
package/src/Watcher.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
* @noformat
|
|
8
|
-
* @generated SignedSource<<
|
|
8
|
+
* @generated SignedSource<<25fee66c7d26ad53cdd5bbab454fe50b>>
|
|
9
9
|
*
|
|
10
10
|
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
|
|
11
11
|
* Original file: packages/metro-file-map/src/Watcher.js
|
|
@@ -17,20 +17,13 @@
|
|
|
17
17
|
import type {
|
|
18
18
|
Console,
|
|
19
19
|
CrawlerOptions,
|
|
20
|
-
|
|
21
|
-
Path,
|
|
20
|
+
CrawlResult,
|
|
22
21
|
PerfLogger,
|
|
23
22
|
WatcherBackendChangeEvent,
|
|
24
|
-
WatchmanClocks,
|
|
25
23
|
} from './flow-types';
|
|
26
24
|
|
|
27
25
|
import EventEmitter from 'events';
|
|
28
26
|
|
|
29
|
-
type CrawlResult = {
|
|
30
|
-
changedFiles: FileData;
|
|
31
|
-
clocks?: WatchmanClocks;
|
|
32
|
-
removedFiles: Set<Path>;
|
|
33
|
-
};
|
|
34
27
|
type WatcherOptions = {
|
|
35
28
|
abortSignal: AbortSignal;
|
|
36
29
|
computeSha1: boolean;
|
|
@@ -71,6 +64,10 @@ export type HealthCheckResult =
|
|
|
71
64
|
export declare class Watcher extends EventEmitter {
|
|
72
65
|
constructor(options: WatcherOptions);
|
|
73
66
|
crawl(): Promise<CrawlResult>;
|
|
67
|
+
recrawl(
|
|
68
|
+
subpath: string,
|
|
69
|
+
currentFileSystem: CrawlerOptions['previousState']['fileSystem'],
|
|
70
|
+
): Promise<CrawlResult>;
|
|
74
71
|
watch(onChange: (change: WatcherBackendChangeEvent) => void): void;
|
|
75
72
|
close(): void;
|
|
76
73
|
checkHealth(timeout: number): Promise<HealthCheckResult>;
|
package/src/Watcher.js
CHANGED
|
@@ -69,10 +69,32 @@ class Watcher extends _events.default {
|
|
|
69
69
|
async crawl() {
|
|
70
70
|
this.#options.perfLogger?.point("crawl_start");
|
|
71
71
|
const options = this.#options;
|
|
72
|
+
const result = await this.#crawl({
|
|
73
|
+
previousState: options.previousState,
|
|
74
|
+
roots: options.roots,
|
|
75
|
+
useWatchman: options.useWatchman,
|
|
76
|
+
});
|
|
77
|
+
this.#options.perfLogger?.point("crawl_end");
|
|
78
|
+
return result;
|
|
79
|
+
}
|
|
80
|
+
async recrawl(subpath, currentFileSystem) {
|
|
81
|
+
return this.#crawl({
|
|
82
|
+
previousState: {
|
|
83
|
+
clocks: new Map(),
|
|
84
|
+
fileSystem: currentFileSystem,
|
|
85
|
+
},
|
|
86
|
+
roots: [path.join(this.#options.rootDir, subpath)],
|
|
87
|
+
subpath,
|
|
88
|
+
useWatchman: false,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
async #crawl(crawlOptions) {
|
|
92
|
+
const options = this.#options;
|
|
93
|
+
const { useWatchman, subpath } = crawlOptions;
|
|
72
94
|
const ignoreForCrawl = (filePath) =>
|
|
73
95
|
options.ignoreForCrawl(filePath) ||
|
|
74
96
|
path.basename(filePath).startsWith(this.#options.healthCheckFilePrefix);
|
|
75
|
-
const crawl =
|
|
97
|
+
const crawl = useWatchman ? _watchman.default : _node.default;
|
|
76
98
|
let crawler = crawl === _watchman.default ? "watchman" : "node";
|
|
77
99
|
options.abortSignal.throwIfAborted();
|
|
78
100
|
const crawlerOptions = {
|
|
@@ -87,49 +109,47 @@ class Watcher extends _events.default {
|
|
|
87
109
|
this.emit("status", status);
|
|
88
110
|
},
|
|
89
111
|
perfLogger: options.perfLogger,
|
|
90
|
-
previousState:
|
|
112
|
+
previousState: crawlOptions.previousState,
|
|
91
113
|
rootDir: options.rootDir,
|
|
92
|
-
roots:
|
|
114
|
+
roots: crawlOptions.roots,
|
|
115
|
+
subpath,
|
|
93
116
|
};
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
"empty `.watchmanconfig` file in your project's root folder or " +
|
|
102
|
-
"initialize a git or hg repository in your project.\n" +
|
|
103
|
-
" " +
|
|
104
|
-
error.toString(),
|
|
105
|
-
);
|
|
106
|
-
return (0, _node.default)(crawlerOptions).catch((e) => {
|
|
107
|
-
throw new Error(
|
|
108
|
-
"Crawler retry failed:\n" +
|
|
109
|
-
` Original error: ${error.message}\n` +
|
|
110
|
-
` Retry error: ${e.message}\n`,
|
|
111
|
-
);
|
|
112
|
-
});
|
|
117
|
+
debug("Crawling roots: %s with %s crawler.", crawlOptions.roots, crawler);
|
|
118
|
+
let delta;
|
|
119
|
+
try {
|
|
120
|
+
delta = await crawl(crawlerOptions);
|
|
121
|
+
} catch (firstError) {
|
|
122
|
+
if (crawl !== _watchman.default) {
|
|
123
|
+
throw firstError;
|
|
113
124
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
125
|
+
crawler = "node";
|
|
126
|
+
options.console.warn(
|
|
127
|
+
"metro-file-map: Watchman crawl failed. Retrying once with node " +
|
|
128
|
+
"crawler.\n" +
|
|
129
|
+
" Usually this happens when watchman isn't running. Create an " +
|
|
130
|
+
"empty `.watchmanconfig` file in your project's root folder or " +
|
|
131
|
+
"initialize a git or hg repository in your project.\n" +
|
|
132
|
+
" " +
|
|
133
|
+
firstError.toString(),
|
|
123
134
|
);
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
135
|
+
try {
|
|
136
|
+
delta = await (0, _node.default)(crawlerOptions);
|
|
137
|
+
} catch (retryError) {
|
|
138
|
+
throw new Error(
|
|
139
|
+
"Crawler retry failed:\n" +
|
|
140
|
+
` Original error: ${firstError.message}\n` +
|
|
141
|
+
` Retry error: ${retryError.message}\n`,
|
|
142
|
+
);
|
|
143
|
+
}
|
|
132
144
|
}
|
|
145
|
+
debug(
|
|
146
|
+
'Crawler "%s" returned %d added/modified, %d removed, %d clock(s).',
|
|
147
|
+
crawler,
|
|
148
|
+
delta.changedFiles.size,
|
|
149
|
+
delta.removedFiles.size,
|
|
150
|
+
delta.clocks?.size ?? 0,
|
|
151
|
+
);
|
|
152
|
+
return delta;
|
|
133
153
|
}
|
|
134
154
|
async watch(onChange) {
|
|
135
155
|
const { extensions, ignorePatternForWatch, useWatchman } = this.#options;
|
|
@@ -181,6 +201,13 @@ class Watcher extends _events.default {
|
|
|
181
201
|
}
|
|
182
202
|
return;
|
|
183
203
|
}
|
|
204
|
+
if (change.event === "recrawl" && useWatchman) {
|
|
205
|
+
this.#options.console.error(
|
|
206
|
+
"metro-file-map: Received unexpected recrawl event while using " +
|
|
207
|
+
"Watchman. Watchman recrawls are not implemented.",
|
|
208
|
+
);
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
184
211
|
onChange(change);
|
|
185
212
|
});
|
|
186
213
|
await watcher.startWatching();
|
package/src/Watcher.js.flow
CHANGED
|
@@ -11,12 +11,11 @@
|
|
|
11
11
|
import type {
|
|
12
12
|
Console,
|
|
13
13
|
CrawlerOptions,
|
|
14
|
-
|
|
14
|
+
CrawlResult,
|
|
15
15
|
Path,
|
|
16
16
|
PerfLogger,
|
|
17
17
|
WatcherBackend,
|
|
18
18
|
WatcherBackendChangeEvent,
|
|
19
|
-
WatchmanClocks,
|
|
20
19
|
} from './flow-types';
|
|
21
20
|
import type {WatcherOptions as WatcherBackendOptions} from './watchers/common';
|
|
22
21
|
|
|
@@ -37,11 +36,12 @@ const debug = require('debug')('Metro:Watcher');
|
|
|
37
36
|
|
|
38
37
|
const MAX_WAIT_TIME = 240000;
|
|
39
38
|
|
|
40
|
-
type
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
type InternalCrawlOptions = Readonly<{
|
|
40
|
+
previousState: CrawlerOptions['previousState'],
|
|
41
|
+
roots: ReadonlyArray<string>,
|
|
42
|
+
subpath?: string,
|
|
43
|
+
useWatchman: boolean,
|
|
44
|
+
}>;
|
|
45
45
|
|
|
46
46
|
type WatcherOptions = {
|
|
47
47
|
abortSignal: AbortSignal,
|
|
@@ -86,12 +86,41 @@ export class Watcher extends EventEmitter {
|
|
|
86
86
|
|
|
87
87
|
async crawl(): Promise<CrawlResult> {
|
|
88
88
|
this.#options.perfLogger?.point('crawl_start');
|
|
89
|
+
const options = this.#options;
|
|
90
|
+
|
|
91
|
+
const result = await this.#crawl({
|
|
92
|
+
previousState: options.previousState,
|
|
93
|
+
roots: options.roots,
|
|
94
|
+
useWatchman: options.useWatchman,
|
|
95
|
+
});
|
|
89
96
|
|
|
97
|
+
this.#options.perfLogger?.point('crawl_end');
|
|
98
|
+
return result;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
async recrawl(
|
|
102
|
+
subpath: string,
|
|
103
|
+
currentFileSystem: CrawlerOptions['previousState']['fileSystem'],
|
|
104
|
+
): Promise<CrawlResult> {
|
|
105
|
+
return this.#crawl({
|
|
106
|
+
previousState: {
|
|
107
|
+
clocks: new Map(),
|
|
108
|
+
fileSystem: currentFileSystem,
|
|
109
|
+
},
|
|
110
|
+
roots: [path.join(this.#options.rootDir, subpath)],
|
|
111
|
+
subpath,
|
|
112
|
+
useWatchman: false,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
async #crawl(crawlOptions: InternalCrawlOptions): Promise<CrawlResult> {
|
|
90
117
|
const options = this.#options;
|
|
118
|
+
const {useWatchman, subpath} = crawlOptions;
|
|
119
|
+
|
|
91
120
|
const ignoreForCrawl = (filePath: string) =>
|
|
92
121
|
options.ignoreForCrawl(filePath) ||
|
|
93
122
|
path.basename(filePath).startsWith(this.#options.healthCheckFilePrefix);
|
|
94
|
-
const crawl =
|
|
123
|
+
const crawl = useWatchman ? watchmanCrawl : nodeCrawl;
|
|
95
124
|
let crawler = crawl === watchmanCrawl ? 'watchman' : 'node';
|
|
96
125
|
|
|
97
126
|
options.abortSignal.throwIfAborted();
|
|
@@ -108,55 +137,50 @@ export class Watcher extends EventEmitter {
|
|
|
108
137
|
this.emit('status', status);
|
|
109
138
|
},
|
|
110
139
|
perfLogger: options.perfLogger,
|
|
111
|
-
previousState:
|
|
140
|
+
previousState: crawlOptions.previousState,
|
|
112
141
|
rootDir: options.rootDir,
|
|
113
|
-
roots:
|
|
142
|
+
roots: crawlOptions.roots,
|
|
143
|
+
subpath,
|
|
114
144
|
};
|
|
115
145
|
|
|
116
|
-
|
|
117
|
-
if (crawl === watchmanCrawl) {
|
|
118
|
-
crawler = 'node';
|
|
119
|
-
options.console.warn(
|
|
120
|
-
'metro-file-map: Watchman crawl failed. Retrying once with node ' +
|
|
121
|
-
'crawler.\n' +
|
|
122
|
-
" Usually this happens when watchman isn't running. Create an " +
|
|
123
|
-
"empty `.watchmanconfig` file in your project's root folder or " +
|
|
124
|
-
'initialize a git or hg repository in your project.\n' +
|
|
125
|
-
' ' +
|
|
126
|
-
error.toString(),
|
|
127
|
-
);
|
|
128
|
-
// $FlowFixMe[incompatible-type] Found when updating Promise type definition
|
|
129
|
-
return nodeCrawl(crawlerOptions).catch<CrawlResult>(e => {
|
|
130
|
-
throw new Error(
|
|
131
|
-
'Crawler retry failed:\n' +
|
|
132
|
-
` Original error: ${error.message}\n` +
|
|
133
|
-
` Retry error: ${e.message}\n`,
|
|
134
|
-
);
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
throw error;
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
const logEnd = (delta: CrawlResult): CrawlResult => {
|
|
142
|
-
debug(
|
|
143
|
-
'Crawler "%s" returned %d added/modified, %d removed, %d clock(s).',
|
|
144
|
-
crawler,
|
|
145
|
-
delta.changedFiles.size,
|
|
146
|
-
delta.removedFiles.size,
|
|
147
|
-
delta.clocks?.size ?? 0,
|
|
148
|
-
);
|
|
149
|
-
this.#options.perfLogger?.point('crawl_end');
|
|
150
|
-
return delta;
|
|
151
|
-
};
|
|
146
|
+
debug('Crawling roots: %s with %s crawler.', crawlOptions.roots, crawler);
|
|
152
147
|
|
|
153
|
-
|
|
148
|
+
let delta: CrawlResult;
|
|
154
149
|
try {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
150
|
+
delta = await crawl(crawlerOptions);
|
|
151
|
+
} catch (firstError) {
|
|
152
|
+
if (crawl !== watchmanCrawl) {
|
|
153
|
+
throw firstError;
|
|
154
|
+
}
|
|
155
|
+
crawler = 'node';
|
|
156
|
+
options.console.warn(
|
|
157
|
+
'metro-file-map: Watchman crawl failed. Retrying once with node ' +
|
|
158
|
+
'crawler.\n' +
|
|
159
|
+
" Usually this happens when watchman isn't running. Create an " +
|
|
160
|
+
"empty `.watchmanconfig` file in your project's root folder or " +
|
|
161
|
+
'initialize a git or hg repository in your project.\n' +
|
|
162
|
+
' ' +
|
|
163
|
+
firstError.toString(),
|
|
164
|
+
);
|
|
165
|
+
try {
|
|
166
|
+
delta = await nodeCrawl(crawlerOptions);
|
|
167
|
+
} catch (retryError) {
|
|
168
|
+
throw new Error(
|
|
169
|
+
'Crawler retry failed:\n' +
|
|
170
|
+
` Original error: ${firstError.message}\n` +
|
|
171
|
+
` Retry error: ${retryError.message}\n`,
|
|
172
|
+
);
|
|
173
|
+
}
|
|
159
174
|
}
|
|
175
|
+
|
|
176
|
+
debug(
|
|
177
|
+
'Crawler "%s" returned %d added/modified, %d removed, %d clock(s).',
|
|
178
|
+
crawler,
|
|
179
|
+
delta.changedFiles.size,
|
|
180
|
+
delta.removedFiles.size,
|
|
181
|
+
delta.clocks?.size ?? 0,
|
|
182
|
+
);
|
|
183
|
+
return delta;
|
|
160
184
|
}
|
|
161
185
|
|
|
162
186
|
async watch(onChange: (change: WatcherBackendChangeEvent) => void) {
|
|
@@ -214,6 +238,15 @@ export class Watcher extends EventEmitter {
|
|
|
214
238
|
}
|
|
215
239
|
return;
|
|
216
240
|
}
|
|
241
|
+
// Watchman handles recrawls internally - receiving a recrawl event
|
|
242
|
+
// when using Watchman would indicate a bug. Log an error and ignore.
|
|
243
|
+
if (change.event === 'recrawl' && useWatchman) {
|
|
244
|
+
this.#options.console.error(
|
|
245
|
+
'metro-file-map: Received unexpected recrawl event while using ' +
|
|
246
|
+
'Watchman. Watchman recrawls are not implemented.',
|
|
247
|
+
);
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
217
250
|
onChange(change);
|
|
218
251
|
});
|
|
219
252
|
await watcher.startWatching();
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @noformat
|
|
8
8
|
* @oncall react_native
|
|
9
|
-
* @generated SignedSource<<
|
|
9
|
+
* @generated SignedSource<<27109494e4956802ba89ac6fd22aa277>>
|
|
10
10
|
*
|
|
11
11
|
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
|
|
12
12
|
* Original file: packages/metro-file-map/src/crawlers/node/index.js
|
|
@@ -15,9 +15,7 @@
|
|
|
15
15
|
* yarn run build-ts-defs (OSS)
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
import type {
|
|
18
|
+
import type {CrawlerOptions, CrawlResult} from '../../flow-types';
|
|
19
19
|
|
|
20
|
-
declare function nodeCrawl(
|
|
21
|
-
options: CrawlerOptions,
|
|
22
|
-
): Promise<{removedFiles: Set<CanonicalPath>; changedFiles: FileData}>;
|
|
20
|
+
declare function nodeCrawl(options: CrawlerOptions): Promise<CrawlResult>;
|
|
23
21
|
export default nodeCrawl;
|
|
@@ -183,6 +183,7 @@ async function nodeCrawl(options) {
|
|
|
183
183
|
perfLogger,
|
|
184
184
|
roots,
|
|
185
185
|
abortSignal,
|
|
186
|
+
subpath,
|
|
186
187
|
} = options;
|
|
187
188
|
abortSignal?.throwIfAborted();
|
|
188
189
|
perfLogger?.point("nodeCrawl_start");
|
|
@@ -193,7 +194,9 @@ async function nodeCrawl(options) {
|
|
|
193
194
|
debug("Using system find: %s", useNativeFind);
|
|
194
195
|
return new Promise((resolve, reject) => {
|
|
195
196
|
const callback = (fileData) => {
|
|
196
|
-
const difference = previousState.fileSystem.getDifference(fileData
|
|
197
|
+
const difference = previousState.fileSystem.getDifference(fileData, {
|
|
198
|
+
subpath,
|
|
199
|
+
});
|
|
197
200
|
perfLogger?.point("nodeCrawl_end");
|
|
198
201
|
try {
|
|
199
202
|
abortSignal?.throwIfAborted();
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import type {
|
|
13
|
-
CanonicalPath,
|
|
14
13
|
Console,
|
|
15
14
|
CrawlerOptions,
|
|
15
|
+
CrawlResult,
|
|
16
16
|
FileData,
|
|
17
17
|
IgnoreMatcher,
|
|
18
18
|
} from '../../flow-types';
|
|
@@ -170,10 +170,9 @@ function findNative(
|
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
export default async function nodeCrawl(
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}> {
|
|
173
|
+
export default async function nodeCrawl(
|
|
174
|
+
options: CrawlerOptions,
|
|
175
|
+
): Promise<CrawlResult> {
|
|
177
176
|
const {
|
|
178
177
|
console,
|
|
179
178
|
previousState,
|
|
@@ -185,6 +184,7 @@ export default async function nodeCrawl(options: CrawlerOptions): Promise<{
|
|
|
185
184
|
perfLogger,
|
|
186
185
|
roots,
|
|
187
186
|
abortSignal,
|
|
187
|
+
subpath,
|
|
188
188
|
} = options;
|
|
189
189
|
|
|
190
190
|
abortSignal?.throwIfAborted();
|
|
@@ -199,7 +199,9 @@ export default async function nodeCrawl(options: CrawlerOptions): Promise<{
|
|
|
199
199
|
|
|
200
200
|
return new Promise((resolve, reject) => {
|
|
201
201
|
const callback: Callback = fileData => {
|
|
202
|
-
const difference = previousState.fileSystem.getDifference(fileData
|
|
202
|
+
const difference = previousState.fileSystem.getDifference(fileData, {
|
|
203
|
+
subpath,
|
|
204
|
+
});
|
|
203
205
|
|
|
204
206
|
perfLogger?.point('nodeCrawl_end');
|
|
205
207
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @noformat
|
|
8
8
|
* @oncall react_native
|
|
9
|
-
* @generated SignedSource<<
|
|
9
|
+
* @generated SignedSource<<bcfb58810773510450845bc00a93beae>>
|
|
10
10
|
*
|
|
11
11
|
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
|
|
12
12
|
* Original file: packages/metro-file-map/src/crawlers/watchman/index.js
|
|
@@ -15,16 +15,9 @@
|
|
|
15
15
|
* yarn run build-ts-defs (OSS)
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
import type {
|
|
19
|
-
CanonicalPath,
|
|
20
|
-
CrawlerOptions,
|
|
21
|
-
FileData,
|
|
22
|
-
WatchmanClocks,
|
|
23
|
-
} from '../../flow-types';
|
|
18
|
+
import type {CrawlerOptions, CrawlResult} from '../../flow-types';
|
|
24
19
|
|
|
25
|
-
declare function watchmanCrawl(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
clocks: WatchmanClocks;
|
|
29
|
-
}>;
|
|
20
|
+
declare function watchmanCrawl(
|
|
21
|
+
$$PARAM_0$$: CrawlerOptions,
|
|
22
|
+
): Promise<CrawlResult>;
|
|
30
23
|
export default watchmanCrawl;
|
|
@@ -13,10 +13,10 @@ import type {WatchmanClockSpec} from '../../flow-types';
|
|
|
13
13
|
import type {
|
|
14
14
|
CanonicalPath,
|
|
15
15
|
CrawlerOptions,
|
|
16
|
+
CrawlResult,
|
|
16
17
|
FileData,
|
|
17
18
|
FileMetadata,
|
|
18
19
|
Path,
|
|
19
|
-
WatchmanClocks,
|
|
20
20
|
} from '../../flow-types';
|
|
21
21
|
import type {WatchmanQueryResponse, WatchmanWatchResponse} from 'fb-watchman';
|
|
22
22
|
|
|
@@ -57,11 +57,7 @@ export default async function watchmanCrawl({
|
|
|
57
57
|
previousState,
|
|
58
58
|
rootDir,
|
|
59
59
|
roots,
|
|
60
|
-
}: CrawlerOptions): Promise<{
|
|
61
|
-
changedFiles: FileData,
|
|
62
|
-
removedFiles: Set<CanonicalPath>,
|
|
63
|
-
clocks: WatchmanClocks,
|
|
64
|
-
}> {
|
|
60
|
+
}: CrawlerOptions): Promise<CrawlResult> {
|
|
65
61
|
abortSignal?.throwIfAborted();
|
|
66
62
|
|
|
67
63
|
const client = new watchman.Client();
|