Repository navigation
Conversation
114ddb6 to
4f1b967
Compare
Metro review: Looks goodRisk: low · Commit: This PR adds a No findings. Verified
Not run: Watchman integration tests can't run here because the sandbox blocks Watchman's state dir, so Watchman is covered only by the mocked crawler and planQuery tests. The base comparison run showed the same error but was stopped at its time limit. Windows is unverified (no machine): drive-letter case in relativePathWithin and separators in watcher-relative paths. No benchmark: the default path adds only a cheap check per file. Watchman switches to the Automated review by Claude. Advisory only: it never approves or blocks, and a maintainer makes the call. |
| * must be spelled as the roots are (with the same case, and through the same | ||
| * symlinks), and files outside every root are not crawled or watched. | ||
| */ | ||
| additionalFiles?: ?ReadonlyArray<string>, |
There was a problem hiding this comment.
nit · New public InputOptions field is labeled Changelog: Internal
additionalFiles is a new option on the exported InputOptions of the published metro-file-map package, and API.md changes with it. Programmatic users such as Expo are the intended consumers, so [Feature] fits better than [Internal], even without Metro config wiring. Something like Changelog: [Feature] metro-file-map: Add additionalFiles option to include specific files by path.
Evidence: The diff adds additionalFiles?: ?ReadonlyArray<string> to InputOptions in src/index.js and to the API.md snapshot. yarn verify-api-snapshots passes with the updated snapshot. The PR description has Changelog: Internal. · id 694273ba
There was a problem hiding this comment.
This isn't a public field - metro-file-map as a whole is semver experimental, per root README.
There was a problem hiding this comment.
Agreed, and withdrawn. packages/metro-file-map/README.md says the whole package is experimental, its API is internal, and changes to it aren't semver-breaking. The root README doesn't say this, but the package README does. So a new InputOptions field doesn't need a [Feature] entry, and Changelog: Internal is correct.
Metro review bot, re finding 694273ba
Add a mechanism to allow watching particular paths under watch roots, without watching all files of the same basename or extensions. The motivating case is `.env`, `.env.local`, `.env.production` etc. Expo and `react-native-dotenv` support reading these from the project root, but ideally we wouldn't map all such files in eg a monorepo setup, where some might belong to different project - in particular because these files often store secrets. This adds a `metro-file-map` option, `additionalFiles`: absolute paths of regular files to include whatever their extension. A listed file is crawled if it exists and watched for creation, change and deletion, like any other file. Files outside every root are not watched. This is a `FileMap` option only for now, with no Metro config wiring. That's sufficient for Expo which creates `metro-file-map` programmatically. Changelog: Internal Test plan: New unit tests, and tests against a real file system for both crawlers (using Watchman when it's installed) and for watching. An AI-driven script also runs a packed build of this branch on each OS, against a workspace with an app as `rootDir` and another package beside it, with the app's `.env` files listed. It checks a cold crawl, then edits, additions and deletions while watching, then a warm crawl from the cache. It does that for every crawler and watcher, with symlinks on and off, and with the workspace as the Watchman root and nested under one, which covers each Watchman query shape. Only the listed files are included, never the other package's `.env.local` or the app's `foo.env.local`. All 808 checks pass: | OS | Crawlers | Watchers | Checks | |---|---|---|---| | macOS 27.0.1 | Node, Watchman 2026.10.26 | Native, Fallback, Watchman | 344 | | Linux Mint 22.3 | Node, Watchman 2026.07.27 | Fallback, Watchman | 232 | | Windows 11 Pro | Node, Watchman 2026.11.30 | Fallback, Watchman | 232 | Signed-off-by: Rob Hogan <2590098+robhogan@users.noreply.github.com>
Add a mechanism to allow watching particular paths under watch roots, without watching all files of the same basename or extensions.
The motivating case is
.env,.env.local,.env.productionetc. Expo andreact-native-dotenvsupport reading these from the project root, but ideally we wouldn't map all such files in eg a monorepo setup, where some might belong to different project - in particular because these files often store secrets.This adds a
metro-file-mapoption,additionalFiles: absolute paths of regular files to include whatever their extension. A listed file is crawled if it exists and watched for creation, change and deletion, like any other file. Files outside every root are not watched.This is a
FileMapoption only for now, with no Metro config wiring. That's sufficient for Expo which createsmetro-file-mapprogrammatically.Changelog: Internal
Test plan:
New unit tests, and tests against a real file system for both crawlers (using Watchman when it's installed) and for watching.
An AI-driven script also runs a packed build of this branch on each OS, against a workspace with an app as
rootDirand another package beside it, with the app's.envfiles listed. It checks a cold crawl, then edits, additions and deletions while watching, then a warm crawl from the cache. It does that for every crawler and watcher, with symlinks on and off, and with the workspace as the Watchman root and nested under one, which covers each Watchman query shape.Only the listed files are included, never the other package's
.env.localor the app'sfoo.env.local. All 808 checks pass:Signed-off-by: Rob Hogan 2590098+robhogan@users.noreply.github.com