Summary:
This replaces `async/queue` with a hand-rolled queue that does not yield to the event loop if a unit of work can be run synchronously.
Anecdotally, this leads to a > 11x speedup for the graph traversal when all data is available synchronously, e.g. from an in-memory cache.
Reviewed By: jeanlauliac
Differential Revision: D5861763
fbshipit-source-id: f7cf5f916a13adf9ca418d7522cd2f19df596fba
Summary: Changes `GraphFn` to return a promise rather than taking a callback. This is more in line with call sites, which so far have been using `denodeify`.
Reviewed By: jeanlauliac
Differential Revision: D5857192
fbshipit-source-id: 61bbbef4fbf24b0b91c4a3008541eaa5a1af0f7a
Summary:
Changes `LoadFn` to be synchronous or return a promise, and `ResolveFn` to be synchronsous.
This makes for a nicer API, without losing the property of not yielding to the event loop for synchronous work.
Reviewed By: jeanlauliac
Differential Revision: D5855963
fbshipit-source-id: 4b3c3363f4e49a9890586462925e8e400872feb2
Summary: When running with node 8, the babel plugins `async-to-generator` and `syntax-trailing-function-commas` are unnecessary. Removing them makes runtime transpilation faster, and the resulting code is closer to the original (useful with debugging: less unmapped code areas, better breakpoint support, less renamed variables).
Reviewed By: mjesun
Differential Revision: D5842305
fbshipit-source-id: d99f719794e4a8f48fd10b0349fbb36f2994666e
Summary:
This copies the basic loading mechanism and default config from the RN local cli into Metro and exposes it under `metro-bundler`, and switches internal scripts over to it.
davidaurelio: I changed the packager-worker-for-buck to hardcode the rn.cli file, like we do in other files. I would like to pull the "find" mechanism that traverses up to find a config into Metro at some point, but for now I'd prefer to keep it lean until we need it. Let me know if that doesn't work for you.
The next diff will switch the RN cli over to these functions also.
Reviewed By: davidaurelio
Differential Revision: D5832596
fbshipit-source-id: a3e167644d96c8831e5a83378e8ba143e62426db
Summary: As a first step in defining a new public API and CLI for Metro, I'd like to pull the generally useful pieces from the RN cli into Metro. This diff makes it as a non-breaking change (so we don't have to bump the version of Metro for RN) by updating only the imports outside of the react-native-github folder.
Reviewed By: davidaurelio
Differential Revision: D5832464
fbshipit-source-id: 11b00b5517665441763c2207d577ae0e110c681b
Summary: Fixed the UNBUNDLE magic file location to match what JniJSModulesUnbundle.cpp expects.
Reviewed By: sahrens
Differential Revision: D5821637
fbshipit-source-id: 4342e4bb4d139b4eba77dd92a53b1683041fc7e9
Summary:
This diff renames all the stragglers in comments and strings from variations of "packager" to "Metro Bundler". I did one of three:
* Rename "packager" to "Metro Bundler"
* Rename "react-native-packager" to "Metro Bundler"
* Remove "packager" when code inside of Metro implies that it's about Metro
I also removed `Glossary.md` because it is unmaintained and very old. mjesun is currently starting to write documentation for Metro which will supersede whatever was there before.
Reviewed By: mjesun
Differential Revision: D5802993
fbshipit-source-id: ba99cb5ed04d84b0f7b7a8a0bf28ed99280a940a