Skip to content

Commit

Permalink
Mark metro-file-map as experimental, rename `hasteMapCacheDirectory…
Browse files Browse the repository at this point in the history
…` -> `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
  • Loading branch information
robhogan authored and facebook-github-bot committed May 19, 2022
1 parent a86cac5 commit 93966c0
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 6 deletions.
10 changes: 8 additions & 2 deletions docs/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,17 @@ Type: `number`

The number of workers we should parallelize the transformer on.

#### `hasteMapCacheDirectory`
#### `fileMapCacheDirectory`

Type: `string`

The path to the haste map cache directory, defaults to `os.tmpdir()`.
The path to the `metro-file-map` cache directory, defaults to `os.tmpdir()`.

#### Deprecated: `hasteMapCacheDirectory`

Type: `string`

Alias of `fileMapCacheDirectory`

---
### Resolver Options
Expand Down
3 changes: 2 additions & 1 deletion packages/metro-config/src/configTypes.flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ type TransformerConfigT = {
type MetalConfigT = {
cacheStores: $ReadOnlyArray<CacheStore<TransformResult<>>>,
cacheVersion: string,
hasteMapCacheDirectory?: string,
fileMapCacheDirectory?: string,
hasteMapCacheDirectory?: string, // Deprecated, alias of fileMapCacheDirectory
maxWorkers: number,
projectRoot: string,
stickyWorkers: boolean,
Expand Down
9 changes: 8 additions & 1 deletion packages/metro-file-map/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Metro File Map
# \[Experimental\] Metro File Map

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

Originally a fork of [`jest-haste-map`](https://github.com/facebook/jest/tree/main/packages/jest-haste-map).

This entire package should be considered "experimental" for the time being -
the API is considered internal and changes will not be semver-breaking.

If you need to rely on `metro-file-map` APIs directly please
[raise an issue](https://github.com/facebook/metro/issues/new) to discuss your
use case.
2 changes: 1 addition & 1 deletion packages/metro-file-map/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "metro-file-map",
"version": "0.70.2",
"description": "🚇 File crawling, watching and mapping for Metro",
"description": "[Experimental] - 🚇 File crawling, watching and mapping for Metro",
"main": "src/index.js",
"repository": {
"type": "git",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ function createHasteMap(
const computeDependencies = dependencyExtractor != null;

return MetroFileMap.create({
cacheDirectory: config.hasteMapCacheDirectory,
cacheDirectory:
config.fileMapCacheDirectory ?? config.hasteMapCacheDirectory,
computeDependencies,
computeSha1: true,
dependencyExtractor: config.resolver.dependencyExtractor,
Expand Down

0 comments on commit 93966c0

Please sign in to comment.