Commit Graph

1105 Commits

Author SHA1 Message Date
Jean Lauliac 781b3b9bb7 packager: Module: remove dead cacheTransformResults option
Reviewed By: davidaurelio

Differential Revision: D4884343

fbshipit-source-id: ae29757690d9b56d6f166bc86573aca9b1b6b65c
2017-04-18 09:39:13 -07:00
Jean Lauliac edcaf438a7 packager: remove Cache
Summary: It seems we don't need that one much anymore, as we have a FS-based cache for files, and removing the last callsites doesn't really change perf, as we have to read these files eventually (plus some of these are read from `HasteMap`, that I believe is already dead code).

Reviewed By: davidaurelio

Differential Revision: D4884220

fbshipit-source-id: 4cf59f16a6f0bdf275abe81e9de2f34816866bae
2017-04-18 09:39:13 -07:00
Alex Kring c0533fc57c Don't build js bundles for debug simulator build configurations
Summary:
Don't build js bundles for debug simulator build configurations

Motivation:
We have more than one debug build configuration that we run in the simulator, and none of them are exactly named 'Debug'. We want to establish the convention that any simulator build configuration containing the word 'Debug' will not build the react js bundles. We believe this is less intrusive to the developer.
Closes https://github.com/facebook/react-native/pull/13472

Differential Revision: D4890622

Pulled By: javache

fbshipit-source-id: 4c809551f64ad575335416de28887a90b0756de1
2017-04-15 10:21:20 -07:00
Jean Lauliac 5a87cc6e4b packager: preprocess outdated dependencies
Summary:
Note: if this changeset causes some breakage, consider disabling rather than reverting. To disable, the call to `_preprocessPotentialDependencies` in `ResolutionRequest` can be removed.

It's a bit of an experiment. I couldn't see any particular regression caused by this, but I could see net improvement of the global cache performance, as it unlock much, much stronger batching: indeed, instead of discovering dependencies progressively, we synchronously figure out the list of all potential modules of a bundle, and kick-off cache fetching and/or transformations. So when it comes to fetching from the global cache, it'll do less requests, and each requests will ask for considerably more keys at a time.

Potential problem caused by this changeset: if a module's dependencies completely changed, then the first time we try to build the bundle it'll start transforming modules that we probably don't care at all anymore, spending precious CPU time for nothing. I've been thinking about it and I cannot see such a case happening much often. Even if it happens, it should not cause any bug or corruption, it would just take additional time.

Other potential problem: that this new code doesn't handle some types of edge cases. It's quite hard to figure out what could possibly break in the `ResolutionRequest` code (and I think it would benefit from a larger refactor). We do have a good test coverage for `DependencyGraph` and it seems to work smoothly, so I'm relatively confident we're not breaking edge cases.

Reviewed By: davidaurelio

Differential Revision: D4875467

fbshipit-source-id: 2dfcc755bec638d3d1c47862ec1de5220953e812
2017-04-13 10:36:51 -07:00
Jean Lauliac fea8f7079d packager: ResolutionRequest: correct mistaken callsite
Reviewed By: cpojer

Differential Revision: D4875756

fbshipit-source-id: cdf29e3c1115003596f6a7b4d27988010d56d88d
2017-04-13 10:36:51 -07:00
Christoph Pojer 0fa1c5f0f1 Use escape hatch for mocked modules
Reviewed By: davidaurelio

Differential Revision: D4869222

fbshipit-source-id: d2cf66296a26710630f0d0f6c8efc7ff3ed97bc5
2017-04-12 09:36:39 -07:00
Jean Lauliac 2318321208 packager: stronger option types
Reviewed By: davidaurelio

Differential Revision: D4868612

fbshipit-source-id: 50d72ce56d8e3ef0d917ee5bbe3dd42faf075584
2017-04-12 04:36:18 -07:00
Christoph Pojer 834df449ff Move formatBanner into packager folder
Reviewed By: davidaurelio

Differential Revision: D4868954

fbshipit-source-id: 7a28019c781262bcf4aab0ad2e67868d35ebf9fb
2017-04-12 02:52:37 -07:00
cpojer 16d4cb329b Make most tests work. 2017-04-11 19:19:25 +01:00
cpojer cb6f300ed1 Update flow. 2017-04-11 18:22:31 +01:00
cpojer cbd8149abd Fixes. 2017-04-11 18:14:32 +01:00
Jean Lauliac 87effd2669 packager: worker: remove `extern` option
Reviewed By: davidaurelio

Differential Revision: D4867367

fbshipit-source-id: ebe5fa860566e87bd6d042ee41b9a7aa9c777fc6
2017-04-11 08:39:36 -07:00
Jean Lauliac 5790a4b57f packager: Module.js: fix Haste name code
Summary: The original code wasn't very readable. Better with this change, I think.

Reviewed By: davidaurelio

Differential Revision: D4851335

fbshipit-source-id: 210309d4b727aff58bea48d0ab324256234cd941
2017-04-11 08:06:36 -07:00
David Aurelio 056a829136 Use exact types for options
Summary: Make option types exact to prevent stale options in our code base.

Reviewed By: jeanlauliac

Differential Revision: D4867773

fbshipit-source-id: 6aa06649735d6105f4b6ff2af7f699cf8ba336c7
2017-04-11 08:06:36 -07:00
David Aurelio 41a6317fd2 Push handling of missing parent module to `resolve`
Reviewed By: jeanlauliac

Differential Revision: D4863235

fbshipit-source-id: 857814cb25ee661db5e2cbdeac7175d9276044db
2017-04-11 07:50:49 -07:00
David Aurelio 67aea411bd Allow resolution without a parent.
Reviewed By: jeanlauliac

Differential Revision: D4862926

fbshipit-source-id: 18f98b6db98e9f937632bd5d00e0b0acfcff9de5
2017-04-11 07:50:49 -07:00
Jean Lauliac 2c0a79383b packager: TransformCache: do not include basename in hash
Reviewed By: cpojer

Differential Revision: D4867411

fbshipit-source-id: ece5214ee9cf152e23790c70f7a8b12060725150
2017-04-11 05:36:42 -07:00
Hilke Heremans a42fd8c16b Ignore all loopback addresses for ip detection
Summary:
There is a bug with IP detection on Macs that have (1) multiple ethernet interfaces, (2) are using the second or third interface as their primary connection and (3) have extra loopback IPs configured (for example when running OpenVPN, running some Docker configurations or other more exotic applications). In those cases, automatic IP detection will falsely detect the IP as something like `127.94.0.1`, which will make it impossible to run debug builds from a physical device.

The underlying network configurations looks something similar to this (irrelevant parts omitted):
```
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
	options=1203<RXCSUM,TXCSUM,TXSTATUS,SW_TIMESTAMP>
	inet 127.0.0.1 netmask 0xff000000
	inet 127.94.0.1 netmask 0xff000000
	nd6 options=201<PERFORMNUD,DAD>
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	options=10b<RXCSUM,TXCSUM,VLAN_HWTAGGING,AV>
	ether xx:xx:xx:xx:xx:xx
	nd6 options=201<PERFORMNUD,DAD>
	media: autoselect
Closes https://github.com/facebook/react-native/pull/13415

Differential Revision: D4859654

Pulled By: javache

fbshipit-source-id: 3c5d06201c48a2dfe1c274ff433423e5d7f2cded
2017-04-10 10:52:34 -07:00
Jonathan Kim 079dcaed99 Added option to disable xip
Summary:
When running an app on a real iPhone in debug mode, I occasionally get issues when trying to load the js bundle and I suspect the issue is with xip.io (and it doesn't look like I'm the only one: https://github.com/facebook/react-native/issues/12786 https://github.com/facebook/react-native/issues/9688#issuecomment-272591839). So I've added the ability to optionally disable the use of xip.io if an env variable `DISABLE_XIP` is set.

Add `export DISABLE_XIP=true` to the `Bundle React Native code and images` build phase. Run the app on a real iPhone and ensure that it can load the JS bundle from the host computers IP.
Closes https://github.com/facebook/react-native/pull/13326

Differential Revision: D4855719

Pulled By: ericvicenti

fbshipit-source-id: cb2e91291acadaa78ea302800b55c2e5388f6380
2017-04-07 20:20:55 -07:00
David Aurelio 80fe73885e packager: HasteMap: expose getAllFiles()
Reviewed By: tomocchino

Differential Revision: D4850695

fbshipit-source-id: 8aae4353de8779f7a1358b2766dad4a6c751b4af
2017-04-07 20:06:14 -07:00
Jean Lauliac 4c2427126f packager: GlobalTransformCache: fix bug in retry logic
Reviewed By: bestander

Differential Revision: D4850644

fbshipit-source-id: ede9991eaac3c7bfd045f2a9c3e9d0b10d45af0f
2017-04-07 05:07:35 -07:00
Jean Lauliac 8d34f16a70 packager: index files by dir for fast matching
Summary: This removes the call to `HasteFS#matchFiles()`, that has linear complexity. Instead, we index all the files by directory from `HasteFS` once loaded, a linear operation. Then, we can filter files from a particular directory much quicker.

Reviewed By: davidaurelio

Differential Revision: D4826721

fbshipit-source-id: c31a0ed9a354dbc7f2dcd56179b859e491faa16c
2017-04-06 07:57:20 -07:00
Jean Lauliac d1ea86b84c packager: GlobalTransformCache: make key globalized
Reviewed By: davidaurelio

Differential Revision: D4835217

fbshipit-source-id: b43456e1e1f83c849a887b07f4f01f8ed0e9df4b
2017-04-06 04:37:55 -07:00
Jean Lauliac c1a2a5e942 packager: get rid of type `any` in ResolutionRequest
Summary:
One of my changeset broke the "ModuleGraph" code without warning earlier because we are using `any`, that equivalent to having no typing at all. This changeset fixes the types so that `ResolutionRequest` is exactly what it actually is: a class usable for any `Module`-looking class, including the normal one, and the "ModuleGraph" one used for Buck builds. That way, the ModuleGraph's `Module` is typechecked against `Moduleish`.

Concretely this change mostly migrates the `Module` to its generic parameter counterpart `TModule` inside `ResolutionRequest`.

Reviewed By: kentaromiura

Differential Revision: D4826256

fbshipit-source-id: fcd7ca08ac6c35e4e9ca983e2aab260e352bcb4e
2017-04-04 07:07:33 -07:00
Jean Lauliac fc8c5130be packager: GlobalTransformCache: retry 502 and 503 HTTP statuses
Reviewed By: davidaurelio

Differential Revision: D4818997

fbshipit-source-id: b31b004939f9e83c8a3a8c34b07c8b1ae2d4d17e
2017-04-04 04:07:41 -07:00
David Aurelio 6bdc5e9f21 Adapt interface of node-haste duplicates
Summary: Adapts mocked / duplicated functionality from `node-haste` to match the new synchronous return types in the original.

Reviewed By: jeanlauliac

Differential Revision: D4819137

fbshipit-source-id: 183316adc3fae161ad9999bf72bccb8218ef8941
2017-04-03 10:07:44 -07:00
David Aurelio 015700ea7c Fix file indentation
Reviewed By: jeanlauliac

Differential Revision: D4819078

fbshipit-source-id: 76bdc2381e479396ef11144236817ffd590f1039
2017-04-03 08:51:45 -07:00
Mike Grabowski 850ed35845 Make CLI executable configurable
Summary:
Follow up to #13248 for iOS.

This pull request allows changing the default path to `cli` when running from Xcode environment. That is especially useful when debugging from a different location or... running `Haul`.

Set `export CLI_PATH=./node_modules/react-native/local-cli/cli.js` and run. Should use new path provided.
Closes https://github.com/facebook/react-native/pull/13264

Differential Revision: D4819059

Pulled By: ericvicenti

fbshipit-source-id: 4a6241823c0bc8f1fa16869bc872bdbe04df510f
2017-04-03 08:37:49 -07:00
Jean Lauliac a6bcbd61e6 packager: TransformCache: use sha1 instead of murmurhash
Reviewed By: davidaurelio

Differential Revision: D4809941

fbshipit-source-id: 33b6c56b4c48eca88d8c1922f52ed29a728d1173
2017-04-03 05:51:32 -07:00
Jean Lauliac 83e38fe2ca packager: TransformCache: do not rehash transformOptions every single time
Reviewed By: davidaurelio

Differential Revision: D4809963

fbshipit-source-id: 9d3ac907e822596567ee7af4427bcd24f1bac73f
2017-04-03 04:51:51 -07:00
Tim Yung 5ded44cdc1 RN: Options to Preload Bundles on Startup
Reviewed By: achen1

Differential Revision: D4809513

fbshipit-source-id: a9a4196b72b241faf7c788e26b9e6880cecebb3e
2017-04-02 08:38:53 -07:00
Jean Lauliac 87c7e781a2 packager: sync Module#read()
Reviewed By: davidaurelio

Differential Revision: D4802783

fbshipit-source-id: c6309bcae6ad48bea2350de04353f694be6eea2f
2017-03-31 10:21:36 -07:00
Brent Vatne b9bfe3b85d Move packager initialization events to reporter
Summary:
This PR depends on #13172

Packager events are mostly logged through the TerminalReporter by default (#13172 makes this configurable). But there are a few things that aren't passed through TerminalReporter.

- We [log a banner with some information about the port and what's going on](8c7b32d5f1/local-cli/server/server.js (L22-L32))
- Also [a message about looking for JS files](8c7b32d5f1/local-cli/server/server.js (L34-L38)) (not sure what that is for / if it is useful beyond telling the user what directory root they started the packager in, but that's another thing).
- If the packager fails to start, then [we log an error message](8c7b32d5f1/local-cli/server/server.js (L41-L61)).

This pull request changes those log messages to be handled by TerminalReporter. I tri
Closes https://github.com/facebook/react-native/pull/13209

Differential Revision: D4809759

Pulled By: davidaurelio

fbshipit-source-id: 2c427ec0c1accaf54bf6b2d1da882cd6bfaa7829
2017-03-31 02:22:24 -07:00
Pieter De Baets 67fbd61ebf Remove RelayFBPreloadedModules, error on overlapping modules
Reviewed By: davidaurelio

Differential Revision: D4779671

fbshipit-source-id: f2dfeb696baab457769c22ca7ab28972270e5fc0
2017-03-30 16:36:51 -07:00
Jean Lauliac 6b89f0ac28 packager: GlobalTransformCache: retry keys fetches
Reviewed By: davidaurelio

Differential Revision: D4779641

fbshipit-source-id: 1b156bf075fa2456d9e6b1a3f38855357abc1abb
2017-03-28 10:51:45 -07:00
Jean Lauliac f2340c746b packager: ResolutionRequest.js: resolveDependency() now sync
Reviewed By: davidaurelio

Differential Revision: D4763593

fbshipit-source-id: b3dc95229d040c776833a88c9a156b9168e0cc4c
2017-03-27 09:51:48 -07:00
Jean Lauliac 62c07e39dc packager: ResolutionRequest.js: sync _resolveNodeDependency()
Summary: Moar synchronicity.

Reviewed By: davidaurelio

Differential Revision: D4756495

fbshipit-source-id: 4e0758ba8b55bd25a24d79dcc8ac4ace101e2ae8
2017-03-27 09:51:48 -07:00
Tim Yung 4d9826eb64 RN: Cleanup Flow / Jest / Metro Configs
Reviewed By: kassens

Differential Revision: D4777088

fbshipit-source-id: d07f4d1dd019a814c8bee4caeb57fc1dd3721c27
2017-03-26 16:08:57 -07:00
Lee Byron 81af8f341f Move classic relay into oss packages
Reviewed By: kassens

Differential Revision: D4769497

fbshipit-source-id: 0144456a82c3969b399a4a0b37814b5627d191c5
2017-03-24 11:23:51 -07:00
Jean Lauliac 1b898cba22 packager: TerminalReporter: stop reporting global cache errors
Summary: At FB we log errors into the error infra, and these errors are not actionnable for end users, so let's reduce the noise generated on the terminal. In the OSS case, people can simply add a handler in a TerminalReporter decorator, the same way we do internally (anyhow, I do not know of anyone using the global cache in OSS for now).

Reviewed By: davidaurelio

Differential Revision: D4762858

fbshipit-source-id: 880c02e175ae551df11b7ce273acc318222c46bf
2017-03-23 12:37:58 -07:00
Jean Lauliac a9589df976 packager: ResolutionRequest.js: sync _resolveHasteDependency()
Summary: Some more synchronicity, one step at a time.

Reviewed By: davidaurelio

Differential Revision: D4756542

fbshipit-source-id: 0c56dbca61b3da764aa8d28e29c0e20b54de091e
2017-03-23 11:09:38 -07:00
Jean Lauliac aec6307c4c packager: ResolutionRequest.js: sync _resolveFileOrDir
Reviewed By: davidaurelio

Differential Revision: D4754138

fbshipit-source-id: d19792a726220a673dead1c8c6cdf487e34a6808
2017-03-23 11:09:38 -07:00
Jean Lauliac 25c82f2e8c packager: ResolutionRequest.js: _loadAsDir and _loadAsFile sync
Reviewed By: davidaurelio

Differential Revision: D4754090

fbshipit-source-id: 84ad1d988bf097d3094d90f3738ce64cc523879c
2017-03-23 11:09:37 -07:00
Jean Lauliac 9bd757822e packager: Module.js: cover the error cases
Summary: We want any exception thrown by `_getHasteName` to be captured by the promise instead of breaking the outer stack.

Reviewed By: davidaurelio

Differential Revision: D4754825

fbshipit-source-id: 173c7c8867da73efb198ed3159704d6fd0e7b87d
2017-03-22 12:08:50 -07:00
Jean Lauliac ba88046c24 packager: Package.js: cover the error cases
Summary: In case the sync function throws, it wouldn't be handled through the promise anymore, that is not what we want. So we revert that in this changeset.

Reviewed By: davidaurelio

Differential Revision: D4754740

fbshipit-source-id: 4da360f4b629bbdf9cd284389060429cc9259c2c
2017-03-22 11:51:48 -07:00
Jean Lauliac 51b44a5b52 packager: Module.js: make read()-based API sync
Reviewed By: davidaurelio

Differential Revision: D4746218

fbshipit-source-id: 1a36bd00a47a6b871cc77433b2325a11e90035b2
2017-03-22 08:33:58 -07:00
Jean Lauliac ebd732784b packager: Package.js: make read()-based API sync
Reviewed By: davidaurelio

Differential Revision: D4745885

fbshipit-source-id: 3d327e5ca91fcbe7ec1d30ff8e6135b415074aa4
2017-03-22 07:05:35 -07:00
Jean Lauliac fc95a312b9 packager: GlobalTransformCache-test: disable non-deterministic test
Reviewed By: davidaurelio

Differential Revision: D4751434

fbshipit-source-id: 1be748387abe9ca0ce030bd2423827dfe5c2a146
2017-03-22 06:21:49 -07:00
Brent Vatne e3daf33ed8 Lock version to 2.7.5 to avoid breakage like #12772
Summary:
As per uglify-js maintainer kzc's comment in https://github.com/mishoo/UglifyJS2/issues/1573#issuecomment-284940371 we should be locking our version to prevent issues like #12772 from happening again.

No test plan needed, people are already using this version of uglify-js (it's the latest).
Closes https://github.com/facebook/react-native/pull/12802

Differential Revision: D4749853

Pulled By: javache

fbshipit-source-id: 866a19cb2c1add31b55e14d0f4dadb7f68fda64c
2017-03-22 05:53:50 -07:00
Jean Lauliac 28952d2475 packager: clear cache
Reviewed By: davidaurelio

Differential Revision: D4746429

fbshipit-source-id: 1a49a4b6db75658749346f0fd94dad68ff084203
2017-03-21 11:38:20 -07:00