You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 2e23de2
Browse filesBrowse the repository at this point in the historyBrowse files
metro-file-map: Always include package.json, drop the extension recheck
`Watcher` always watches `package.json` files, whatever `extensions` says, because they're crucial for module resolution. Neither crawler does the same, so with `json` absent from `extensions` they're skipped at startup. `FileMap` then checks every regular file change against `extensions` again, which drops the `package.json` events the watcher backend let through.
This passes the same basenames to both crawlers. The Node crawler checks them alongside extensions. The Watchman crawler adds a `name` term for any basename whose extension isn't in `extensions`, and widens the `suffix` generator to cover it.
With crawling and watching agreeing on which files to include, the watcher backends' `included` filter from #2000 is the only one needed, so this removes `FileMap`'s `hasWatchedExtension` recheck.
There's no difference for a default Metro config, where `json` is in `sourceExts`.
Changelog: [Fix] Include `package.json` files in the file map even when `json` is not in `sourceExts`, `assetExts` or `watcher.additionalExts`.
Test plan:
New `planQuery` tests for basenames, including that they don't change the query when `extensions` already covers them. The crawler integration test runs both crawlers against a real fixture tree with a `package.json` and only `js` in `extensions`. The `FileMap` test for the removed recheck is deleted, since `common-test.js` covers the backends' filter.
0 commit comments