Commit Graph

1133 Commits

Author SHA1 Message Date
Jean Lauliac 655806afe3 packager: buck worker: better types
Reviewed By: davidaurelio

Differential Revision: D4970025

fbshipit-source-id: 77db309befebe539d25bd8df1039e2304176ca3f
2017-05-02 03:50:47 -07:00
Jean Lauliac 873e2fa25e packager: buck worker: output assets
Reviewed By: davidaurelio

Differential Revision: D4962816

fbshipit-source-id: 4ce4eacb28528c96829ac35134aff18a72063370
2017-05-02 03:50:47 -07:00
Jean Lauliac 446b00018f packager: ResolutionRequest: keep option object as it is
Reviewed By: davidaurelio

Differential Revision: D4970219

fbshipit-source-id: 0e8a0b5e29452497e162d548229b086e0f91a516
2017-05-02 03:36:20 -07:00
David Aurelio ee0fc30814 Fix support for haste packages
Summary: Fixes support for haste packages in `ModuleGraph`. As `HasteMap` is no longer used for anything else, we can probably strip it down completely.

Reviewed By: cpojer

Differential Revision: D4967367

fbshipit-source-id: d40cbe46c1e8b05690c0a2c71955479c28607c01
2017-04-28 17:08:57 -07:00
Karol Kuczmarski 054b5aa4ce Add getCacheKey() to the open source transformer
Reviewed By: davidaurelio

Differential Revision: D4965737

fbshipit-source-id: a343d0cd2e8832567e4e2eed1e2ac0b1657d91a0
2017-04-28 16:55:35 -07:00
Jean Lauliac 95db7be042 packager: GlobalTransformCache: fix non-bound function
Reviewed By: cpojer

Differential Revision: D4972905

fbshipit-source-id: c9aaaba47f2c74bf48b7cbbc1255992d36ae32b1
2017-04-28 15:07:17 -07:00
David Aurelio 2da9c66c78 Unify source map types
Summary: deduplicates / unifies types for source maps across the code base

Reviewed By: jeanlauliac

Differential Revision: D4955924

fbshipit-source-id: 25cb71031dce835dd7d2bc1c27d6b20050906e81
2017-04-28 12:37:43 -07:00
Karol Kuczmarski ff3f15b9ad Pass only the first projectRoot to transform options
Reviewed By: davidaurelio

Differential Revision: D4955013

fbshipit-source-id: c07254f54a61ad71bf4cf153c97c8e4149fd4809
2017-04-28 11:06:34 -07:00
David Aurelio 0c7d61ccc0 Change postprocessing hook to work on `ModuleTransport` instances
Reviewed By: amnn

Differential Revision: D4962283

fbshipit-source-id: 25b609bcd4b8d7a881e35426010f15530548e301
2017-04-28 09:38:12 -07:00
Jean Lauliac 7c725aa1bf packager: TransformCache: include UID + do not use base64
Summary:
Two things in there:

* Using `base64` was kinda broken, as it can contain slashes, invalid in file names. It would still work however because it would just create a second level folder when doing `mkdirp`. Still I think it's better to fix that correctness.
* Include the UID in the hash, so that different users have different folders for sure, and that we reduce potiential permissions issues. `tmpdir()` already returns a folder that's user-specific on OS X, but this is not a guarantee on all platforms.

Reviewed By: cpojer

Differential Revision: D4969856

fbshipit-source-id: 4a9be35104ac9698edf2c84c58d395ee171ce2a8
2017-04-28 09:22:16 -07:00
Jean Lauliac e379a077ce packager: TransformCache: store last cache collection time
Summary: Oftentimes packager stalls for several seconds after requiring a bundle, because it's busy cleaning up old cache files. We shouldn't do that when, for example, we just restarted packager. This changeset stores the micro-timestamp of the last collection so that we don't waste time next time.

Reviewed By: cpojer

Differential Revision: D4969832

fbshipit-source-id: 3aa0495b18d5a8efa1b8f87dbf7a40b0673fd9fd
2017-04-28 09:22:14 -07:00
Ashok Menon 2818bf2347 Order modules in bundle by path.
Reviewed By: davidaurelio

Differential Revision: D4835227

fbshipit-source-id: 4974036fed7452447501fc07445afaa349e521c9
2017-04-27 17:40:39 -07:00
Jean Lauliac 82dcddcb12 packager: buck library: expose asset content
Reviewed By: davidaurelio

Differential Revision: D4945778

fbshipit-source-id: ea132a3d284ed09c59c69afbdd7b707af9e521b9
2017-04-25 11:55:41 -07:00
David Aurelio b58e5dc930 inline plugin: type options
Summary: Adds a stronger type for the inline plugin to help with future refactors

Reviewed By: jeanlauliac

Differential Revision: D4945842

fbshipit-source-id: f9bde75bf47271d80d2420d985a6a5609cee8952
2017-04-25 11:55:41 -07:00
David Aurelio 0f1b5c0e10 Remove irrelevant options from cache key
Reviewed By: jeanlauliac

Differential Revision: D4938131

fbshipit-source-id: 88b686bc5ee6946297e1fd1b91d46fa618f0d9d7
2017-04-25 03:54:39 -07:00
David Aurelio 222884edd4 make test independent from side effects
Reviewed By: jeanlauliac

Differential Revision: D4939025

fbshipit-source-id: cc7f811484cba0db4df394edef294cabe7343c8b
2017-04-25 03:54:39 -07:00
Jean Lauliac a12d8410c3 packager: buck library: aggregate assets
Reviewed By: davidaurelio

Differential Revision: D4938032

fbshipit-source-id: afc4f4f97b7cc513eca9c925e09fbee4871216f4
2017-04-24 09:37:06 -07:00
David Aurelio ca24ab1da6 Stronger typing for transform options / remove duplication
Reviewed By: jeanlauliac

Differential Revision: D4929276

fbshipit-source-id: 0b23435a1502c72377425cae775e258106a5bf14
2017-04-21 08:54:56 -07:00
Jean Lauliac 3e9063fba6 packager: AssetServer: @flow
Reviewed By: davidaurelio

Differential Revision: D4921672

fbshipit-source-id: 6405275bbd04550d7dd87cd5b8ef35a6cf5904f2
2017-04-21 04:06:51 -07:00
Jean Lauliac 30b1e17ba5 packager: getAssetDataFromName: @flow
Reviewed By: davidaurelio

Differential Revision: D4921247

fbshipit-source-id: 47c516257cde5de6b69604d714e45310d00afe19
2017-04-20 07:35:33 -07:00
Jean Lauliac b8e9ed1559 packager: correct transform for assets to avoid string
Reviewed By: davidaurelio

Differential Revision: D4913509

fbshipit-source-id: 9997da819483056d896fedecdc47510ecd381c03
2017-04-20 03:06:01 -07:00
Jean Lauliac 65cb03c22f packager: GlobalTransformCache: throat() the file fetching function
Reviewed By: cpojer

Differential Revision: D4914187

fbshipit-source-id: ae3b8aa4ed4dbd1896ca35cf498b7c02fd109f58
2017-04-19 11:06:49 -07:00
Jean Lauliac 6bf0d16899 packager: buck: fix messed up file types
Reviewed By: cpojer

Differential Revision: D4913706

fbshipit-source-id: 792d78e1baf7d9bea4eba90f791a1dc593087b55
2017-04-19 08:50:53 -07:00
Jean Lauliac b721e8207e packager: worker: strenghten TransformOptions
Reviewed By: davidaurelio

Differential Revision: D4906499

fbshipit-source-id: e7948d09c678d3e270ddd9fd355597eb5d535781
2017-04-19 06:36:18 -07:00
Jean Lauliac 7253a0d532 packager: GlobalTransformCache: cache the transform options digest
Reviewed By: davidaurelio

Differential Revision: D4906974

fbshipit-source-id: b6cf83ba6a072400685948329070e171f65c837d
2017-04-19 03:23:24 -07:00
David Aurelio 561ca97519 `getTransformOptions` can only return promises
Summary: Changes the contract for `getTransformOptions` so that it has to return a promises. That allows call sites to get rid of special logic / wrapping.

Reviewed By: jeanlauliac

Differential Revision: D4905959

fbshipit-source-id: c7d434c0766984e25987de1d769594e7c922d691
2017-04-18 11:21:20 -07:00
Jean Lauliac aa3be70fb9 packager: ResolutionRequest: stronger option typing
Reviewed By: cpojer

Differential Revision: D4906382

fbshipit-source-id: 1696c3e7fe07c84a3a497740dc87a237d9b71d1e
2017-04-18 10:08:42 -07:00
Jean Lauliac e18d213116 packager: buck: transform-module: add support for assets
Reviewed By: davidaurelio

Differential Revision: D4868312

fbshipit-source-id: 44d20a5ed73637a9b3f43a99b5c82931f3e15dc6
2017-04-18 09:39:13 -07:00
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