Jean Lauliac da7f06e115 packager: ResolutionRequest: skip dirExists in loadAsDir
Summary: I'm continuing my changes to avoid `lstat`-ing the folders when we don't really need to. That changeset in particular proposes to remove the check in `_loadAsDir`. The rationale is that right after that we try for the presence of the `package.json`. If that file exists, the folder necessarily exist so we can switch these two `if` blocks for sure without changing the logic. Finally, at the end we look for the "index" file. By removing the folder check, packager would now report "file `foo/index` does not exist" rather than "directory `foo` does not exist" if the folder does not exist. I think it's not much worse, especially as both of these are unhelpful for what I believe to be a large number of cases already anyway. Indeed, the whole algo is based on a series of try/catch, and only the very last try will see its error surfaced. But, most often, it'd be useful for earlier tries to be surfaced to the user. I do want to improve that; meanwhile, however, I sense it's not a big deal to remove that folder check for all these reasons. If you don't agree, I do have another proposition: we could catch errors generated by the last `_loadAsFile` call, and rethrow them as directory errors instead (if `dirExists` return `true`). That way, the call to `dirExists` would only happen in case of errors (but that could still happen quite a lot as a result).

Reviewed By: davidaurelio

Differential Revision: D5028341

fbshipit-source-id: 2d4c99c0f352b71599482aa529728559466b76fd
2017-05-10 04:46:09 -07:00
2017-01-26 12:56:40 +00:00
2017-01-26 12:56:40 +00:00
2017-04-11 19:19:25 +01:00
2017-04-11 18:14:32 +01:00
2017-01-26 12:56:40 +00:00
2017-02-28 11:45:45 +00:00
2017-04-11 18:22:31 +01:00
2017-03-01 11:01:35 +00:00
2017-01-26 12:56:40 +00:00
2017-01-26 12:56:40 +00:00
2017-01-26 12:56:40 +00:00
2017-01-26 12:56:40 +00:00
2017-01-26 12:56:40 +00:00
2017-03-01 11:01:35 +00:00
2017-01-26 12:56:40 +00:00
2017-04-11 19:19:25 +01:00
2017-01-26 12:56:40 +00:00
2017-01-26 12:56:40 +00:00
2017-04-11 19:19:25 +01:00

metro-bundler Build Status Windows Build Status npm version

The JavaScript bundler for React Native

Description
🚇 The JavaScript bundler for React Native.
https://facebook.github.io/metro
Readme MIT
Languages
JavaScript 100%