Skip to content

Commit

Permalink
fix(metro-resolver-symlinks): print Metro path (#2694)
Browse files Browse the repository at this point in the history
  • Loading branch information
tido64 authored Sep 21, 2023
1 parent a442ffd commit 3c65642
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/breezy-dolphins-greet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rnx-kit/metro-resolver-symlinks": patch
---

Print the path to the Metro instance that will be monkey patched if `experimental_retryResolvingFromDisk` is enabled
1 change: 1 addition & 0 deletions packages/metro-resolver-symlinks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"test": "rnx-kit-scripts test"
},
"dependencies": {
"@rnx-kit/console": "^1.0.0",
"@rnx-kit/tools-node": "^2.0.0",
"@rnx-kit/tools-react-native": "^1.3.2",
"enhanced-resolve": "^5.8.3"
Expand Down
5 changes: 4 additions & 1 deletion packages/metro-resolver-symlinks/src/utils/patchMetro.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { info, warn } from "@rnx-kit/console";
import { findMetroPath } from "@rnx-kit/tools-react-native/metro";
import * as fs from "fs";
import * as path from "path";
Expand Down Expand Up @@ -40,7 +41,7 @@ export function shouldEnableRetryResolvingFromDisk({
experimental_retryResolvingFromDisk !== "force" &&
!supportsRetryResolvingFromDisk()
) {
console.warn(
warn(
"The version of Metro you're using has not been tested with " +
"`experimental_retryResolvingFromDisk`. If you still want to enable " +
"it, please set it to 'force'."
Expand Down Expand Up @@ -83,6 +84,8 @@ export function patchMetro(options: Options): void {
return;
}

info(`experimental_retryResolvingFromDisk: Patching '${findMetroPath()}'`);

const DependencyGraph = importMetroModule("/src/node-haste/DependencyGraph");

// Patch `_createModuleResolver` and `_doesFileExist` to use `fs.existsSync`.
Expand Down
1 change: 1 addition & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3787,6 +3787,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@rnx-kit/metro-resolver-symlinks@workspace:packages/metro-resolver-symlinks"
dependencies:
"@rnx-kit/console": ^1.0.0
"@rnx-kit/eslint-config": "*"
"@rnx-kit/scripts": "*"
"@rnx-kit/tools-node": ^2.0.0
Expand Down

0 comments on commit 3c65642

Please sign in to comment.