metro-file-map 0.81.2 → 0.82.0
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 +2 -2
- package/src/flow-types.js.flow +1 -0
- package/src/index.js +5 -1
- package/src/index.js.flow +5 -1
- package/src/lib/TreeFS.js +2 -2
- package/src/lib/TreeFS.js.flow +2 -2
- package/src/plugins/MockPlugin.js +9 -6
- package/src/plugins/MockPlugin.js.flow +10 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "metro-file-map",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.82.0",
|
|
4
4
|
"description": "[Experimental] - 🚇 File crawling, watching and mapping for Metro",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"debug": "^
|
|
24
|
+
"debug": "^4.4.0",
|
|
25
25
|
"fb-watchman": "^2.0.0",
|
|
26
26
|
"flow-enums-runtime": "^0.0.6",
|
|
27
27
|
"graceful-fs": "^4.2.4",
|
package/src/flow-types.js.flow
CHANGED
package/src/index.js
CHANGED
|
@@ -381,7 +381,11 @@ class FileMap extends _events.default {
|
|
|
381
381
|
fileData[_constants.default.SYMLINK] === 0 &&
|
|
382
382
|
!this._options.computeDependencies &&
|
|
383
383
|
!this._options.computeSha1 &&
|
|
384
|
-
this._options.hasteImplModulePath == null
|
|
384
|
+
this._options.hasteImplModulePath == null &&
|
|
385
|
+
!(
|
|
386
|
+
this._options.enableHastePackages &&
|
|
387
|
+
relativeFilePath.endsWith(PACKAGE_JSON)
|
|
388
|
+
)
|
|
385
389
|
) {
|
|
386
390
|
continue;
|
|
387
391
|
}
|
package/src/index.js.flow
CHANGED
|
@@ -608,7 +608,11 @@ export default class FileMap extends EventEmitter {
|
|
|
608
608
|
fileData[H.SYMLINK] === 0 &&
|
|
609
609
|
!this._options.computeDependencies &&
|
|
610
610
|
!this._options.computeSha1 &&
|
|
611
|
-
this._options.hasteImplModulePath == null
|
|
611
|
+
this._options.hasteImplModulePath == null &&
|
|
612
|
+
!(
|
|
613
|
+
this._options.enableHastePackages &&
|
|
614
|
+
relativeFilePath.endsWith(PACKAGE_JSON)
|
|
615
|
+
)
|
|
612
616
|
) {
|
|
613
617
|
// Nothing to process
|
|
614
618
|
continue;
|
package/src/lib/TreeFS.js
CHANGED
|
@@ -190,10 +190,10 @@ class TreeFS {
|
|
|
190
190
|
return null;
|
|
191
191
|
}
|
|
192
192
|
const fileType = isRegularFile(fileMetadata) ? "f" : "l";
|
|
193
|
-
const modifiedTime = fileMetadata[_constants.default.MTIME];
|
|
194
193
|
return {
|
|
195
194
|
fileType,
|
|
196
|
-
modifiedTime,
|
|
195
|
+
modifiedTime: fileMetadata[_constants.default.MTIME],
|
|
196
|
+
size: fileMetadata[_constants.default.SIZE],
|
|
197
197
|
};
|
|
198
198
|
}
|
|
199
199
|
*matchFiles({
|
package/src/lib/TreeFS.js.flow
CHANGED
|
@@ -298,10 +298,10 @@ export default class TreeFS implements MutableFileSystem {
|
|
|
298
298
|
return null;
|
|
299
299
|
}
|
|
300
300
|
const fileType = isRegularFile(fileMetadata) ? 'f' : 'l';
|
|
301
|
-
const modifiedTime = fileMetadata[H.MTIME];
|
|
302
301
|
return {
|
|
303
302
|
fileType,
|
|
304
|
-
modifiedTime,
|
|
303
|
+
modifiedTime: fileMetadata[H.MTIME],
|
|
304
|
+
size: fileMetadata[H.SIZE],
|
|
305
305
|
};
|
|
306
306
|
}
|
|
307
307
|
|
|
@@ -29,16 +29,19 @@ class MockPlugin {
|
|
|
29
29
|
constructor({
|
|
30
30
|
console,
|
|
31
31
|
mocksPattern,
|
|
32
|
-
rawMockMap
|
|
32
|
+
rawMockMap = {
|
|
33
|
+
mocks: new Map(),
|
|
34
|
+
duplicates: new Map(),
|
|
35
|
+
version: CACHE_VERSION,
|
|
36
|
+
},
|
|
33
37
|
rootDir,
|
|
34
38
|
throwOnModuleCollision,
|
|
35
39
|
}) {
|
|
36
40
|
this.#mocksPattern = mocksPattern;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
};
|
|
41
|
+
if (rawMockMap.version !== CACHE_VERSION) {
|
|
42
|
+
throw new Error("Incompatible state passed to MockPlugin");
|
|
43
|
+
}
|
|
44
|
+
this.#raw = rawMockMap;
|
|
42
45
|
this.#rootDir = rootDir;
|
|
43
46
|
this.#console = console;
|
|
44
47
|
this.#pathUtils = new _RootPathUtils.RootPathUtils(rootDir);
|
|
@@ -40,22 +40,25 @@ export default class MockPlugin implements FileMapPlugin<RawMockMap>, IMockMap {
|
|
|
40
40
|
constructor({
|
|
41
41
|
console,
|
|
42
42
|
mocksPattern,
|
|
43
|
-
rawMockMap
|
|
43
|
+
rawMockMap = {
|
|
44
|
+
mocks: new Map(),
|
|
45
|
+
duplicates: new Map(),
|
|
46
|
+
version: CACHE_VERSION,
|
|
47
|
+
},
|
|
44
48
|
rootDir,
|
|
45
49
|
throwOnModuleCollision,
|
|
46
50
|
}: {
|
|
47
51
|
console: typeof console,
|
|
48
52
|
mocksPattern: RegExp,
|
|
49
|
-
rawMockMap?:
|
|
53
|
+
rawMockMap?: RawMockMap,
|
|
50
54
|
rootDir: Path,
|
|
51
55
|
throwOnModuleCollision: boolean,
|
|
52
56
|
}) {
|
|
53
57
|
this.#mocksPattern = mocksPattern;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
};
|
|
58
|
+
if (rawMockMap.version !== CACHE_VERSION) {
|
|
59
|
+
throw new Error('Incompatible state passed to MockPlugin');
|
|
60
|
+
}
|
|
61
|
+
this.#raw = rawMockMap;
|
|
59
62
|
this.#rootDir = rootDir;
|
|
60
63
|
this.#console = console;
|
|
61
64
|
this.#pathUtils = new RootPathUtils(rootDir);
|