metro/packages/metro-bundler
Christoph Pojer 9127fce33c Add --maxWorkers flag and allow transformers to run in-band.
Summary:
This diff cleans up some cruft and adds some features:

* It removes the usage of an env variable to control workers.
* It removes the lazy and handwavy calculation on how many workers to use for jest-haste-map. Jest itself uses the maximum amount of workers available and it has never been reported as an issue – especially since it is a one-time startup cost of about 3 seconds on a cold cache only.
* It adds a `--max-workers` flag to replace the env variable. This one is able to control both the number of workers for `jest-haste-map` as well as the transformers.
* It makes the transformers run in the parent process if 1 or fewer workers are are specified. This should help with debugging.

Once you approve this diff, I will publish a new version of metro to npm and update the version used in RN and remove the use of the env variable altogether: https://our.intern.facebook.com/intern/biggrep/?corpus=xplat&filename=&case=false&view=default&extre=&s=REACT_NATIVE_MAX_WORKERS&engine=apr_strmatch&context=false&filter[uninteresting]=false&filter[intern]=false&filter[test]=false&grep_regex=

Note: the process of adding a CLI option is really broken. Commander also has a weird API. We should consider building a better public API for Metro and then consider how to build a new CLI on top of it and simplify our internal integration. I really don't like how Metro is integrated across pieces of the RN cli in ways that is hard to manage. But that is a larger task for another time :)

Reviewed By: jeanlauliac

Differential Revision: D5217726

fbshipit-source-id: 74efddbb87755a9e744c816fbc62efa21f6a79bf
2017-06-13 09:21:40 -07:00
..
src Add --maxWorkers flag and allow transformers to run in-band. 2017-06-13 09:21:40 -07:00
.eslintrc Add `"node"` env to packager `.eslintrc` 2017-05-19 07:36:26 -07:00
.npmignore Add .npmignore 2017-06-06 08:41:04 -07:00
Glossary.md Add glossary, some renames 2017-05-11 16:51:38 -07:00
README.md Update README 2017-06-06 03:29:08 -07:00
package.json Add --maxWorkers flag and allow transformers to run in-band. 2017-06-13 09:21:40 -07:00
rn-babelrc.json Remove `react-packager` indirection. 2017-02-02 05:34:12 -08:00
yarn.lock Upgrade uglify to v3 + es support 2017-06-12 10:11:20 -07:00

README.md

metro-bundler

🚇 The JavaScript bundler for React Native.

  • 🚅 Fast: We aim for sub-second reload cycles, fast startup and quick bundling speeds.
  • ⚖️ Scalable: Works with thousands of modules in a single application.
  • ⚛️ Integrated: Supports every React Native project out of the box.

This project was previously part of the react-native repository. In this smaller repository it is easier for the team working on Metro Bundler to respond to both issues and pull requests. See react-native#13976 for the initial announcement.