Skip to content

Commit 93966c0

Browse files
robhoganfacebook-github-bot
authored andcommittedMay 19, 2022
Mark metro-file-map as experimental, rename hasteMapCacheDirectory -> fileMapCacheDirectory
Summary: `metro-file-map` has not yet been part of an OSS Metro release. This marks it as "experimental" (i.e. semver-excluded), for as long as we're making regular changes to its API, which is typically only consumed by other Metro packages. Additionally, this makes a top-level config name change `hasteMapCacheDirectory` -> `fileMapCacheDirectory`, to reflect `jest-haste-map` -> `metro-file-map`, while retaining support for `hasteMapCacheDirectory` as a deprecated alias. Reviewed By: motiz88 Differential Revision: D36451806 fbshipit-source-id: 498271c1b4b6037cb567b5f87abee2f47b094916
1 parent a86cac5 commit 93966c0

File tree

5 files changed

+21
-6
lines changed

5 files changed

+21
-6
lines changed
 

‎docs/Configuration.md

+8-2
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,17 @@ Type: `number`
9999

100100
The number of workers we should parallelize the transformer on.
101101

102-
#### `hasteMapCacheDirectory`
102+
#### `fileMapCacheDirectory`
103103

104104
Type: `string`
105105

106-
The path to the haste map cache directory, defaults to `os.tmpdir()`.
106+
The path to the `metro-file-map` cache directory, defaults to `os.tmpdir()`.
107+
108+
#### Deprecated: `hasteMapCacheDirectory`
109+
110+
Type: `string`
111+
112+
Alias of `fileMapCacheDirectory`
107113

108114
---
109115
### Resolver Options

‎packages/metro-config/src/configTypes.flow.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ type TransformerConfigT = {
116116
type MetalConfigT = {
117117
cacheStores: $ReadOnlyArray<CacheStore<TransformResult<>>>,
118118
cacheVersion: string,
119-
hasteMapCacheDirectory?: string,
119+
fileMapCacheDirectory?: string,
120+
hasteMapCacheDirectory?: string, // Deprecated, alias of fileMapCacheDirectory
120121
maxWorkers: number,
121122
projectRoot: string,
122123
stickyWorkers: boolean,

‎packages/metro-file-map/README.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1-
# Metro File Map
1+
# \[Experimental\] Metro File Map
22

33
🚇 File system crawling, watching and mapping for [Metro](https://facebook.github.io/metro/).
44

55
Originally a fork of [`jest-haste-map`](https://github.com/facebook/jest/tree/main/packages/jest-haste-map).
6+
7+
This entire package should be considered "experimental" for the time being -
8+
the API is considered internal and changes will not be semver-breaking.
9+
10+
If you need to rely on `metro-file-map` APIs directly please
11+
[raise an issue](https://github.com/facebook/metro/issues/new) to discuss your
12+
use case.

‎packages/metro-file-map/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "metro-file-map",
33
"version": "0.70.2",
4-
"description": "🚇 File crawling, watching and mapping for Metro",
4+
"description": "[Experimental] - 🚇 File crawling, watching and mapping for Metro",
55
"main": "src/index.js",
66
"repository": {
77
"type": "git",

‎packages/metro/src/node-haste/DependencyGraph/createHasteMap.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ function createHasteMap(
5858
const computeDependencies = dependencyExtractor != null;
5959

6060
return MetroFileMap.create({
61-
cacheDirectory: config.hasteMapCacheDirectory,
61+
cacheDirectory:
62+
config.fileMapCacheDirectory ?? config.hasteMapCacheDirectory,
6263
computeDependencies,
6364
computeSha1: true,
6465
dependencyExtractor: config.resolver.dependencyExtractor,

0 commit comments

Comments
 (0)
Please sign in to comment.