-
Notifications
You must be signed in to change notification settings - Fork 619
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Currently, `metro-file-map`'s worker exports a `worker` and a `getSha1` method, which have identical signatures but different behaviour. `worker` could be used for everything, except that it differs from `getSha1` in the following ways: - `worker` will check whether the file is a `package.json`, and if not, whether it passes a Haste / `computeDependencies` exclusion list *even if there's no work to be done*. - `worker` will re-use a memoised `hasteImpl` even if `hasteImplModulePath` is not given. - `worker` is not able to calculate the sha1 of binary files, because it reads contents in `utf8`. This diff changes things around a bit so that we can consolidate on the one `worker` export - the motivation primarily being to bring in symlink support without adding new code paths in several places. - Move lazy loading of `hasteImpl` to where it's required, and use it only if `hasteImplModulePath` is non-null. - Have `getContent` return a `Buffer` and decode it where necessary. - Don't parse a `package.json` as a Haste package unless new option `enableHastePackages = true`. - Don't check `exclusionList` (now `excludedExtensions`) unless there's something to do if the check passes. All this means we can delete `getSha1` and the `worker` can cover all of our needs - so we'll only have one place to add symlink target reads in the next diff. Changelog: [Internal] Reviewed By: jacdebug Differential Revision: D42537300 fbshipit-source-id: 31faa076c3e7fc6ddf9c3e6a906b0f0796a1be51
- Loading branch information
1 parent
20920b0
commit 51df674
Showing
5 changed files
with
100 additions
and
74 deletions.
There are no files selected for viewing
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
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
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
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
Oops, something went wrong.