Skip to content

Commit

Permalink
Remove unstable_enableSymlinks (now always-on)
Browse files Browse the repository at this point in the history
Summary:
Symlink support has been enabled by default since Metro 0.79, but it was still possible to turn it off via `unstable_enableSymlinks`. As noted in the docs:

> In a future release of Metro, this option will be removed (symlink support will be always-on).

This removes the config option - symlink support is always-on.

Docs: Move note about symlink targets and workspaces under `watchFolders`.

Changelog:
```
 - **[Experimental]**: Remove redundant `unstable_enableSymlinks` - symlink support is stable and always-on.
```

Reviewed By: huntie

Differential Revision: D62707315

fbshipit-source-id: b86d5b75cd75753c627478a7411ef603bc3393e2
  • Loading branch information
robhogan authored and facebook-github-bot committed Sep 16, 2024
1 parent 9d80599 commit e52b5ff
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 32 deletions.
32 changes: 8 additions & 24 deletions docs/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,14 @@ A list of directories outside of [`projectRoot`](#projectroot) that can contain
Despite the naming of this option, it isn't related solely to file watching. Even in an offline build (for example, in CI), all files must be visible to Metro through the combination of `watchFolders` and `projectRoot`.
:::

:::info

Note that, as with any other file Metro needs to resolve, targets of any symlinks within your `watchFolders` *must also be within `watchFolders`* and not otherwise excluded.

If you have a Metro project within a workspace, such as a [Yarn workspace](https://classic.yarnpkg.com/lang/en/docs/workspaces/) (a subdirectory of a Yarn workspace root), it's likely you'll want to include your workspace *root* path in your configured `watchFolders` so that Metro can resolve other workspaces or hoisted `node_modules`. Similarly, to use [linked packages](https://classic.yarnpkg.com/lang/en/docs/cli/link/), you'll need to list those package source locations (or a containing directory) in `watchFolders`.

:::

#### `transformerPath`

Type: `string`
Expand Down Expand Up @@ -391,30 +399,6 @@ In a future release of Metro, this option will become `true` by default.
---
#### `unstable_enableSymlinks` <div class="label experimental">Experimental</div>
Type: `boolean`
Enable experimental support for projects containing symbolic links (symlinks).
When enabled, Metro traverses symlinks during module and asset [resolution](./Resolution.md), instead of ignoring symlinks. Note that, as with any other file Metro needs to resolve, the symlink target *must be within configured [watched folders](#watchfolders)* and not otherwise excluded.
Defaults to `true` since Metro v0.79.0.
:::info
For example, if you have a Metro project within a [Yarn workspace](https://classic.yarnpkg.com/lang/en/docs/workspaces/) (a subdirectory of a Yarn workspace root), it's likely you'll want to include your workspace *root* path in your configured [`watchFolders`](#watchfolders) so that Metro can resolve other workspaces or hoisted `node_modules`. Similarly, to use [linked packages](https://classic.yarnpkg.com/lang/en/docs/cli/link/), you'll need to list those package source locations (or a containing directory) in [`watchFolders`](#watchfolders).
:::
:::note
In a future release of Metro, this option will be removed (symlink support will be always-on).
:::
---
### Transformer Options
<!-- Keep old links to `asyncRequireModulePath` working -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ Object {
],
},
"unstable_enablePackageExports": false,
"unstable_enableSymlinks": true,
"useWatchman": true,
},
"serializer": Object {
Expand Down Expand Up @@ -269,7 +268,6 @@ Object {
],
},
"unstable_enablePackageExports": false,
"unstable_enableSymlinks": true,
"useWatchman": true,
},
"serializer": Object {
Expand Down Expand Up @@ -453,7 +451,6 @@ Object {
],
},
"unstable_enablePackageExports": false,
"unstable_enableSymlinks": true,
"useWatchman": true,
},
"serializer": Object {
Expand Down Expand Up @@ -637,7 +634,6 @@ Object {
],
},
"unstable_enablePackageExports": false,
"unstable_enableSymlinks": true,
"useWatchman": true,
},
"serializer": Object {
Expand Down
1 change: 0 additions & 1 deletion packages/metro-config/src/configTypes.flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ type ResolverConfigT = {
dependencyExtractor: ?string,
emptyModulePath: string,
enableGlobalPackages: boolean,
unstable_enableSymlinks: boolean,
extraNodeModules: {[name: string]: string, ...},
hasteImplModulePath: ?string,
nodeModulesPaths: $ReadOnlyArray<string>,
Expand Down
1 change: 0 additions & 1 deletion packages/metro-config/src/defaults/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ const getDefaultValues = (projectRoot: ?string): ConfigT => ({
blockList: exclusionList(),
dependencyExtractor: undefined,
disableHierarchicalLookup: false,
unstable_enableSymlinks: true,
emptyModulePath: require.resolve(
'metro-runtime/src/modules/empty-module.js',
),
Expand Down
1 change: 0 additions & 1 deletion packages/metro-config/types/configTypes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ export interface ResolverConfigT {
resolveRequest?: CustomResolver;
resolverMainFields: ReadonlyArray<string>;
sourceExts: ReadonlyArray<string>;
unstable_enableSymlinks: boolean;
unstable_conditionNames: ReadonlyArray<string>;
unstable_conditionsByPlatform: Readonly<{
[platform: string]: ReadonlyArray<string>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function createFileMap(
computeSha1: true,
dependencyExtractor: config.resolver.dependencyExtractor,
enableHastePackages: config?.resolver.enableGlobalPackages,
enableSymlinks: config.resolver.unstable_enableSymlinks,
enableSymlinks: true,
enableWorkerThreads: config.watcher.unstable_workerThreads,
extensions: Array.from(
new Set([
Expand Down

0 comments on commit e52b5ff

Please sign in to comment.