Commit Graph

1144 Commits

Author SHA1 Message Date
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
Jean Lauliac 7357a916c3 packager: GlobalTransformCache: reduce asynchronicity for non-cached bundles
Reviewed By: davidaurelio

Differential Revision: D4745595

fbshipit-source-id: 3126fdcc11dd1c8085316457ead0cabae633d0db
2017-03-21 06:06:11 -07:00
Jean Lauliac 112a177399 packager: GlobalTransformCache: ignore errors related to fetching
Reviewed By: davidaurelio

Differential Revision: D4745584

fbshipit-source-id: 2c9b2451d3525c90308fb88784945462cd827d1f
2017-03-21 06:06:11 -07:00
Jean Lauliac 2a9b50c529 packager: GlobalTransformCache: add unit test
Summary: Finally adding some unit test to increase confidence in the correctness of that piece of code.

Reviewed By: davidaurelio

Differential Revision: D4721543

fbshipit-source-id: 56776290d61f2b51c69d7eeae09663e3bc892b50
2017-03-21 06:06:11 -07:00
Marc Horowitz 2bec70bf7d Don't swallow the error if a module require fails
Reviewed By: davidaurelio

Differential Revision: D4733269

fbshipit-source-id: 2cca14c023b148b62cf24f204cdb355f8d2f3590
2017-03-20 13:05:58 -07:00
David Aurelio e5197e940e Use verbose module name when requiring module that errored
Summary: When requiring a module that has previously errored, the implementation of `require` only used the numerical module ID. In this diff, we enable usage of the verbose module name if present.

Reviewed By: bestander

Differential Revision: D4737723

fbshipit-source-id: 1c2d3906435a637f3e440e57f904489d84495bd2
2017-03-20 08:27:00 -07:00
David Aurelio f19e5215cf Allow flow-declared variables when inlining
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
2017-03-20 08:09:09 -07:00
David Aurelio 80faeb9034 Fix indentation of polyfills/require.js
Summary: Fixes the messed-up indentation of `polyfills/require.js`. Over half of the lines were indented with an odd number of spaces.

Reviewed By: arcanis, bestander

Differential Revision: D4737435

fbshipit-source-id: a5b9baf0a27f236a4d3d6b6c1c5a92f52859f62c
2017-03-20 05:36:30 -07:00
Kevin Cooper bbd4669180 Fix suggestion to "npm start -- --reset-cache"
Summary:
As discussed in https://github.com/facebook/react-native/pull/11983. The double dash is necessary to pass through the argument to node. Based on the comments [here](https://github.com/facebook/react-native/issues/1924#issuecomment-249861004), it looks like most people use the double dash; it's unclear whether it would do anything at all if the dashes were omitted. If anyone else has better insight, let me know!
Closes https://github.com/facebook/react-native/pull/13003

Differential Revision: D4731566

Pulled By: hramos

fbshipit-source-id: 62562536db7589a03a511762117cbf0e36d3aafb
2017-03-18 12:58:05 -07:00
Jean Lauliac b6ebb8010e packager: DependencyGraph-test: add broken use case
Summary:
This changeset adds a test that verifies that the duplicate modules use case is broken. The goal is to acknowledge the problem for now, and when we update `jest-haste`, we'll simply fix what needs to be fixed in that test.

See also, https://github.com/facebook/jest/pull/3107

Reviewed By: davidaurelio

Differential Revision: D4673431

fbshipit-source-id: 05e09bdf61a2eddf2e9d1e32a33d32065c9051f1
2017-03-16 13:51:54 -07:00
Jean Lauliac e3274bdef3 packager: FBGlobalTransformCache: move the retry/error logic
Reviewed By: davidaurelio

Differential Revision: D4713585

fbshipit-source-id: 6a83f858692b8a1f6326051f3a3f4a3a549e4027
2017-03-16 13:51:43 -07:00
Jean Lauliac 62d4c6e275 packager: GlobalTransformCache: finish conversion to async/await
Reviewed By: davidaurelio

Differential Revision: D4713456

fbshipit-source-id: f65c45439d1657872e28a296f13a73ee2032ea93
2017-03-16 09:23:39 -07:00