Summary:
**Summary**
Minification fails or minified bundle may crash due to uglify-es bugs which have been fixed recently. See https://github.com/facebook/react-native/issues/16689
**Test plan**
Try to production bundle a project using ex-navigation, which fails with:
```
Maximum call stack size exceeded
```
Use this patch and see that bundling suceeds. There are also minified runtime errors solved by this change, see https://github.com/facebook/react-native/issues/16689 for more information.
Closes https://github.com/facebook/metro-bundler/pull/85
Reviewed By: mjesun
Differential Revision: D6259177
Pulled By: rafeca
fbshipit-source-id: 55987eb338b06938181c0da74d104d23eeb135b6
Summary:
This diff migrates Metro Bundler from `worker-farm` to `jest-worker`:
* Fully removes the custom patched `worker-farm` fork.
* Removes //a lot// of non-clear Flow types used to cast functions from callbacks to promises.
* Reduces cyclomatic complexity of the `Transformer` class by using `async`/`await`.
* Cleans all additional methods inside `JSTransformer/index.js`, by moving them to a single class and properly scoping them.
**Note:** this diff does not still enable the ability to bind files to workers by using `computeWorkerKey`; this will come at a later stage.
Reviewed By: davidaurelio
Differential Revision: D6247532
fbshipit-source-id: 51259360a5c15117996777a3be74b73b583f595e
Summary:
The `formatBanner.js` file is requiring the `wordwrap` package, but it was not defined in the package.json. Somehow this was working before (maybe the package was being downloaded by another depdendency or maybe `formatBanner` was not used).
This fixes https://github.com/facebook/metro-bundler/issues/79
Reviewed By: mjesun
Differential Revision: D6136865
fbshipit-source-id: 722dd61cb936fca893453f4cfc3248718a329779
Summary: Upgrades uglify to version 3 with (experimental) ES6 support turned on.
Reviewed By: jeanlauliac
Differential Revision: D5842410
fbshipit-source-id: 1c8ccea15785bc5bb1c68d7a83b75881432d0ce2
Summary:
Adding a Babel plugin that will analyze the file looking for any potential candidate to use `regenerator-runtime`, and if so, will inject dynamically the module. The module is injected per file, so we avoid polluting the global environment. The plugin is also able to inject the `require` call beforehand, so that the inliner can pick them and inline them.
The Babel plugin is part of `react-native-babel-preset`, so as long as you are using this preset you are safe. If not, you should include the specific transformer into your list of plugins, as `react-native-babel-preset/transforms/transform-regenerator-runtime-insertion.js`.
Reviewed By: davidaurelio
Differential Revision: D5388655
fbshipit-source-id: dc403f3d5e2d807529eb8569a85c45fec36a6a3e
Summary: Bump dependencies to the same version that react native uses
Reviewed By: jeanlauliac
Differential Revision: D5364009
fbshipit-source-id: 302db951a5509584da13a18a7fab6965e0b1e394
Summary:
Remove our internal docbloc module and use `jest-docblock` instead.
The development server is using `jest-haste-map` exclusively, which in turn relies on `jest-docblock`, which differs slightly from our own docblock module.
Depending on only one version greatly reduces the number of edge cases
Reviewed By: cpojer
Differential Revision: D5328472
fbshipit-source-id: 4a31d8159519e01a83fda04b76e8f14f0beb16af
Summary:
We use custom npm scripts (`prepare-release`, `cleanup-release`) to
- move `src` to `src.orig`, and `build` to `src` before creating the tarball
- move everything back afterwards
We run these scripts with lerna before and after publishing. Custom hooks avoid problems with `prepublishOnly` and `postpublish` not being run at opportune times, `prepack` and `postpack` not being supported by npm v4 and yarn, and using `lerna run prepublishOnly` resulting in duplicated execution of the command.
This ensures that development is closer to what is pulled in from npm.
Reviewed By: jeanlauliac
Differential Revision: D5310133
fbshipit-source-id: 6b9885c88b936ef3fe5f1858738ad63d581a8731
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
Summary: Upgrades uglify to version 3 with (experimental) ES6 support turned on.
Reviewed By: cpojer
Differential Revision: D5227245
fbshipit-source-id: db8638eebe2daf40b60570cac34905e9a7288705
Summary: This allows us to get the new fix for recovery on duplicate modules.
Reviewed By: cpojer
Differential Revision: D5128975
fbshipit-source-id: 5a2b60430bbca1806a97798c482af8522366e071
Summary:
Pass `localPath` to transformers to allow usage of plugins like `transform-react-jsx-source` that don’t conflict with x-machine caches, e.g. Buck or our own global cache.
These caches don’t work properly if paths local to a specific machine are part of cached outputs.
Reviewed By: jeanlauliac
Differential Revision: D5044147
fbshipit-source-id: 1177afb48d6dd9351738fcd4da8f9f6357e25e81
Summary: The logic of the `inline` babel transform regarded identifiers as global if no binding exists for them. We extend that logic to also accept flow-declared variables.
Reviewed By: arcanis
Differential Revision: D4737620
fbshipit-source-id: e71cfdf77c7b7751265cfa4412430b4f29e9e853
Summary:
Moves stack trace symbolication to a worker process.
The worker process is spawned laziliy, and is treated as an exclusive resource (requests are queued).
This helps keeping the server process responsive when symbolicating.
Reviewed By: cpojer
Differential Revision: D4602722
fbshipit-source-id: 5da97e53afd9a1ab981c5ba4b02a7d1d869dee71
Summary:
I extracted all the dependencies (using jest-haste-map) and copied them from the package.json in react-native to RNP. There is some duplication here for now but we can later go back and remove the duplicated dependencies from react-native that aren't needed there.
I also removed a mock file that hasn't been in use for a long time.
Reviewed By: jeanlauliac
Differential Revision: D4598155
fbshipit-source-id: 850b6dfa6fc2eec138ebdd7208cd34bee21f7927