-
Notifications
You must be signed in to change notification settings - Fork 637
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduce duplication, tighten types in Watcher backends, remove anymatch dependency #1407
Closed
Conversation
This file contains 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
facebook-github-bot
added
the
CLA Signed
This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
label
Dec 16, 2024
This pull request was exported from Phabricator. Differential Revision: D67259981 |
facebook-github-bot
force-pushed
the
export-D67259981
branch
from
December 18, 2024 14:39
e43b5da
to
7e72bd8
Compare
This pull request was exported from Phabricator. Differential Revision: D67259981 |
…cy (#1407) Summary: We currently use the [`anymatch`](https://www.npmjs.com/package/anymatch) dependency to evaluate ignore patterns in watcher backends. `anymatch` handles various input types including globs and arrays of globs/regexps However, since D67285745, it's become clear that the `ignored` param is only ever a `?RegExp`, so we hardly use any of `anymatch` and can simply `test()` paths, and remove the dependency. One subtlety to note that this change makes explicit, is that `anymatch` converts all input paths to posix separators before testing against the input `RegExp` (see block comment). We do the same in this diff so that the change is behaviour-preserving - however, this isn't a convention in Metro and should be revisited (maybe in a breaking change). Note that we don't need to handle other kinds of path normalisation (like `anymatch` does with [`normalize-path`](https://www.npmjs.com/package/normalize-path)) because watcher backends must already emit normal paths, with no trailing separators. Changelog: Internal Differential Revision: D67259981
robhogan
force-pushed
the
export-D67259981
branch
from
December 20, 2024 13:04
7e72bd8
to
a20d658
Compare
This pull request was exported from Phabricator. Differential Revision: D67259981 |
facebook-github-bot
pushed a commit
that referenced
this pull request
Dec 21, 2024
…cy (#1407) Summary: We currently use the [`anymatch`](https://www.npmjs.com/package/anymatch) dependency to evaluate ignore patterns in watcher backends. `anymatch` handles various input types including globs and arrays of globs/regexps However, since D67285745, it's become clear that the `ignored` param is only ever a `?RegExp`, so we hardly use any of `anymatch` and can simply `test()` paths, and remove the dependency. One subtlety to note that this change makes explicit, is that `anymatch` converts all input paths to posix separators before testing against the input `RegExp` (see block comment). We do the same in this diff so that the change is behaviour-preserving - however, this isn't a convention in Metro and should be revisited (maybe in a breaking change). Note that we don't need to handle other kinds of path normalisation (like `anymatch` does with [`normalize-path`](https://www.npmjs.com/package/normalize-path)) because watcher backends must already emit normal paths, with no trailing separators. Changelog: Internal Reviewed By: hoxyq Differential Revision: D67259981
This pull request has been merged in 11c062a. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
CLA Signed
This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
fb-exported
Merged
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.
Differential Revision: D67259981