Repository navigation
Conversation
Contributor
|
@robhogan has imported this pull request. If you are a Meta employee, you can view this in D101985455. |
robhogan
approved these changes
Apr 22, 2026
Contributor
robhogan
added a commit
to expo/expo
that referenced
this pull request
Sep 15, 2026
# Why `forceNodeFilesystemAPI` does nothing in the fork. It's declared on `InputOptions`, `BuildParameters`, `WatcherOptions` and `CrawlerOptions`, and threaded from `FileMap` through `Watcher` into the crawler options, but no crawler reads it. Upstream removed it along with the native `find` crawler it used to select (react/metro#1693), and `@expo/cli`'s `createFileMap` fork never passes it. # How Removes the option and its plumbing, its `rootRelativeCacheKeys` case, and the test fixtures that set it. It was a `BuildParameters` key, so this changes the file map cache key - the first start after this change misses the existing file map cache, as upstream's removal did. # Test Plan ``` pnpm --dir packages/@expo/metro-file-map typecheck pnpm --dir packages/@expo/metro-file-map test pnpm --dir packages/@expo/metro-file-map lint ``` Typecheck and lint clean, 704 tests passed (18 suites). # Checklist - [x] I added a `changelog.md` entry and rebuilt the package sources according to [this short guide](https://github.com/expo/expo/blob/main/CONTRIBUTING.md#-before-submitting) - [ ] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin). - [ ] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
1 of 3 tasks
robhogan
added a commit
to kitten/metro
that referenced
this pull request
Sep 24, 2026
Resolves conflicts with react#1687 (symlink targets stored lexically resolved, as normal POSIX paths) and react#1693 (native `find` crawler removed). - The Node crawler keeps this PR's lazy `lstat` inside main's single `find` path. - Symlinks with a known `mtime` are still read eagerly by `FileMap#maybeReadLink`, which now stores main's format. A symlink crawled without an `lstat` is still `1` until a lookup traverses it, and `TreeFS#readSymlinkTarget` then reads it and stores the target in that same format, so a target read lazily and one read eagerly are indistinguishable. This replaces the `WeakMap`-based `#resolveSymlinkTargetToNormalPath`, which main removed. - The `find` binary tests are dropped along with the crawler they covered, the committed `types/` defs are dropped as on main, and the tests mock `node:fs` to match main's imports.
robhogan
added a commit
to kitten/metro
that referenced
this pull request
Sep 24, 2026
Resolves the conflict with react#1693, which removed the native `find` crawler: `findNative` is dropped, and `nodeCrawl` keeps this PR's flattened promise, calling `find` directly.
robhogan
added a commit
to kitten/metro
that referenced
this pull request
Sep 24, 2026
Resolves conflicts with react#1677, which rewrote the Node crawler: its crawler already checks the extension before `lstat` and builds normal paths per directory, so this PR's crawler change reduces to skipping the `lstat` for a file with no previous mtime, reading `previousState` from the crawler options. The crawler tests follow: new files are now recorded without an `lstat`, the filesystem root test checks the path passed to `ignore()` rather than `lstat`, and `forceNodeFilesystemAPI` (removed by react#1693) is dropped from this PR's new tests. Also updates the API snapshot for `FileSystem.getMtimeByNormalPath`.
robhogan
added a commit
to expo/expo
that referenced
this pull request
Sep 25, 2026
…50193) # Why Upstream removed `forceNodeFileSystemAPI` along with the native `find` crawler it used to select in react/metro#1693, first released in [Metro 0.85.0](https://github.com/react/metro/releases/tag/v0.85.0), and `@expo/metro-file-map` had already removed the implementation, just not the config. This is not user-observable, just part of unforking. # How Removes the option and its plumbing, its `rootRelativeCacheKeys` case, and the test fixtures that set it. # Test Plan ``` pnpm --dir packages/@expo/metro-file-map typecheck pnpm --dir packages/@expo/metro-file-map test pnpm --dir packages/@expo/metro-file-map lint ``` Typecheck and lint clean, 704 tests passed (18 suites). # Checklist - [x] I added a `changelog.md` entry and rebuilt the package sources according to [this short guide](https://github.com/expo/expo/blob/main/CONTRIBUTING.md#-before-submitting) - [ ] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin). - [ ] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
3 tasks done
robhogan
added a commit
to expo/expo
that referenced
this pull request
Nov 17, 2026
…alse ## Why Expo CLI uses the Node watcher unless a Metro config sets `resolver.useWatchman: true`. Currently that default is spread over three places: `getDefaultConfig` sets `useWatchman` to `null`, and both `createFileMap-fork` and the `FileMap` constructor in `@expo/metro-file-map` read a nullish value as `false`. That shape only exists because of Metro's earlier tri-state `useWatchman`. Metro's `createFileMap` used to pass `forceNodeFilesystemAPI: !config.resolver.useWatchman` alongside `useWatchman`, and `metro-file-map` read a nullish `useWatchman` as `true`: https://github.com/react/metro/blob/b9c243f/packages/metro/src/node-haste/DependencyGraph/createFileMap.js#L109 So `true` (Metro's default) meant Watchman, falling back to the slow native `find` crawler when it was unavailable, `false` meant no Watchman, and `null` was the one value that kept Watchman while avoiding `find`. Hence the `null`, and the fork's `?? false` to turn it back into "no Watchman". react/metro#1693 removed the `find` crawler upstream, and #50193 removed the fork's leftover `forceNodeFilesystemAPI`, so `useWatchman` is now a plain boolean. The workaround has already cost us one bug - #47662, where the documented `true` opt-in was rewritten to `null` and then coerced to `false` (fixed by #47726). ## How `getDefaultConfig` sets `resolver.useWatchman: false` directly, and `createFileMap-fork` and `FileMap` read `useWatchman` exactly as upstream does, so this is no longer a divergence from Metro's file map. Through Expo CLI, the merged config resolves as before: - No `metro.config.js`, or one that passes `getDefaultConfig()` through -> `false`. - `useWatchman: true` set on Expo's defaults, or in a partial config -> `true`, so #47726's guarantee holds. - A config built on Metro's own defaults rather than `expo/metro-config` -> Metro's `true`, as before. Two edge cases do change: - Tools that start Metro without Expo CLI, eg `react-native start`, use upstream's file map, which read the `null` as "Watchman if available". They now see `false` and use the Node watcher, consistent with Expo CLI. - An explicit `useWatchman: null` or `undefined` in a user config now means Watchman, as it does in Metro, where previously it meant the Node watcher. ## Test Plan New unit tests: `FileMap` reads a nullish `useWatchman` as Watchman, `createFileMap-fork` passes it through unchanged, and a `true` set on Expo's defaults survives `loadUserConfig`. The first two fail before this change. `et check-packages @expo/metro-config @expo/cli @expo/metro-file-map` passes, apart from two cases in `language-plugins.test.ts` (dotAll and Unicode property regexps) that fail the same way on `main` locally with Node 26.11.1. Not tested against a live Watchman end to end. ## Checklist - [x] I added a changeset and followed [this short guide](https://github.com/expo/expo/blob/main/CONTRIBUTING.md#-before-submitting) - [x] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin). - [ ] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
robhogan
added a commit
to expo/expo
that referenced
this pull request
Nov 17, 2026
…alse ## Why `@expo/metro-config` defaults `resolver.useWatchman` to `null`, and Expo's file map fork reads a nullish value as `false`. That only made sense against Metro's old tri-state `useWatchman`, where `null` was the one value that kept Watchman without falling back to the slow native `find` crawler: https://github.com/react/metro/blob/b9c243f/packages/metro/src/node-haste/DependencyGraph/createFileMap.js#L109 That crawler was removed by react/metro#1693 and #50193, and the indirection has already cost us #47662. ## How Default `useWatchman` to `false` directly, and read it in `createFileMap-fork` and `FileMap` exactly as upstream does. Expo CLI resolves every config as before, including a user's `true`. Tools that start Metro without Expo CLI (eg `react-native start`) now get the Node watcher by default too, and an explicit `null` means Watchman, as in Metro. ## Test Plan Updated `ExpoMetroConfig-test` for the new default and a user's `true` merging over it. `et check-packages` passes, apart from two `language-plugins.test.ts` cases that also fail on `main`. ## Checklist - [x] I added a changeset and followed [this short guide](https://github.com/expo/expo/blob/main/CONTRIBUTING.md#-before-submitting) - [x] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin). - [ ] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
robhogan
added a commit
to expo/expo
that referenced
this pull request
Nov 17, 2026
…alse ## Why `@expo/metro-config` defaults `resolver.useWatchman` to `null`, and Expo's file map fork reads a nullish value as `false`. That was needed for Metro's earlier tri-state `useWatchman`, where `null` was the one value that kept Watchman while avoiding the slow native `find` crawler: https://github.com/react/metro/blob/b9c243f/packages/metro/src/node-haste/DependencyGraph/createFileMap.js#L109 Since react/metro#1693 and #50193 removed that crawler, `useWatchman` is a plain boolean, and Expo's default can be an ordinary `false`. That lets the fork read `useWatchman` as upstream does, removing a divergence. ## How This sets `useWatchman: false` in `getDefaultConfig` and drops the two `?? false` in the fork. Expo CLI resolves every config as before, including a user's `true`. Tools that start Metro without Expo CLI (eg `react-native start`) now get the Node watcher by default too, and an explicit `null` means Watchman, as in Metro. ## Test Plan Updated `ExpoMetroConfig-test` for the new default and a user's `true` merging over it. `et check-packages` passes, apart from two `language-plugins.test.ts` cases that also fail on `main`. ## Checklist - [x] I added a changeset and followed [this short guide](https://github.com/expo/expo/blob/main/CONTRIBUTING.md#-before-submitting) - [x] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin). - [ ] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
2 of 3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This is a proposal to drop the native find binary crawler code path entirely.
We've recently dropped the native find binary crawler in Expo, which was accidentally activated in some cases. We discovered (which is particularly obvious on large projects/repos and
expo/expoitself) that it's consistently much slower than the Node FS crawler.To get into the "correct" preference and use the Node crawler, we're currently forcing
useWatchman: null, which then defaults to use watchman, if it's installed, but falls back toforceNodeFilesystemAPI: true. This is outside of what the types specify as valid, but is the cleanest way to disable the native find binary crawling.This crawler basically just adds overhead over the Node.js implementation and is consistently slower, and less efficient, while the Node crawler is pretty optimised already (and has very low overhead once #1677 is merged)
The timings of the native find binary crawler in
expo/expowas also observed to scale with the size of this repo, compared to a minimal reproduction, so the overhead isn't just limited to the child process call and result parsing.Changelog: [Internal] Drop native find binary crawler and remove
forceNodeFilesystemAPIflagTest plan