Граф коммитов

1155 Коммитов

Автор SHA1 Сообщение Дата
David Aurelio 1adb318589 Separate node polyfills from runtime transforms
Summary: Separates the polyfills used for node.js from the configuration of `babel-register`, to make pretransforming packager before invoking it easier.

Reviewed By: cpojer

Differential Revision: D4978047

fbshipit-source-id: 45d3d49d0a714a8257be8d244a01e41b68bbce3d
2017-05-02 05:35:22 -07:00
Jean Lauliac 91ff2159d9 packager: buck worker: better types
Reviewed By: davidaurelio

Differential Revision: D4970025

fbshipit-source-id: 77db309befebe539d25bd8df1039e2304176ca3f
2017-05-02 03:55:28 -07:00
Jean Lauliac cf4a98b053 packager: buck worker: output assets
Reviewed By: davidaurelio

Differential Revision: D4962816

fbshipit-source-id: 4ce4eacb28528c96829ac35134aff18a72063370
2017-05-02 03:55:23 -07:00
Jean Lauliac cc5997a2b1 packager: ResolutionRequest: keep option object as it is
Reviewed By: davidaurelio

Differential Revision: D4970219

fbshipit-source-id: 0e8a0b5e29452497e162d548229b086e0f91a516
2017-05-02 03:41:44 -07:00
David Aurelio a26e042784 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:01:18 -07:00
Karol Kuczmarski 8fe24da6c2 Add getCacheKey() to the open source transformer
Reviewed By: davidaurelio

Differential Revision: D4965737

fbshipit-source-id: a343d0cd2e8832567e4e2eed1e2ac0b1657d91a0
2017-04-28 16:45:57 -07:00
Jean Lauliac fddb3b0737 packager: GlobalTransformCache: fix non-bound function
Reviewed By: cpojer

Differential Revision: D4972905

fbshipit-source-id: c9aaaba47f2c74bf48b7cbbc1255992d36ae32b1
2017-04-28 15:04:40 -07:00
David Aurelio 58ba7fc075 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:35:23 -07:00
Karol Kuczmarski 6202e02326 Pass only the first projectRoot to transform options
Reviewed By: davidaurelio

Differential Revision: D4955013

fbshipit-source-id: c07254f54a61ad71bf4cf153c97c8e4149fd4809
2017-04-28 11:19:04 -07:00
David Aurelio 414d5a3023 Change postprocessing hook to work on `ModuleTransport` instances
Reviewed By: amnn

Differential Revision: D4962283

fbshipit-source-id: 25b609bcd4b8d7a881e35426010f15530548e301
2017-04-28 10:03:07 -07:00
Jean Lauliac 1e6bca22db 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 10:03:07 -07:00
Jean Lauliac eb72d5091a 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 10:03:07 -07:00
Ashok Menon 978592faab Order modules in bundle by path.
Reviewed By: davidaurelio

Differential Revision: D4835227

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

Differential Revision: D4945778

fbshipit-source-id: ea132a3d284ed09c59c69afbdd7b707af9e521b9
2017-04-25 12:04:01 -07:00
David Aurelio 3afbcfcd6b 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:45:45 -07:00
David Aurelio 3e08a28987 Remove irrelevant options from cache key
Reviewed By: jeanlauliac

Differential Revision: D4938131

fbshipit-source-id: 88b686bc5ee6946297e1fd1b91d46fa618f0d9d7
2017-04-25 04:02:06 -07:00
David Aurelio 291a497bc4 make test independent from side effects
Reviewed By: jeanlauliac

Differential Revision: D4939025

fbshipit-source-id: cc7f811484cba0db4df394edef294cabe7343c8b
2017-04-25 04:02:06 -07:00
Jean Lauliac b6a7a711de packager: buck library: aggregate assets
Reviewed By: davidaurelio

Differential Revision: D4938032

fbshipit-source-id: afc4f4f97b7cc513eca9c925e09fbee4871216f4
2017-04-24 09:34:41 -07:00
David Aurelio 13f89f4e38 Stronger typing for transform options / remove duplication
Reviewed By: jeanlauliac

Differential Revision: D4929276

fbshipit-source-id: 0b23435a1502c72377425cae775e258106a5bf14
2017-04-21 08:57:03 -07:00
Jean Lauliac 9bbbfb46ea packager: AssetServer: @flow
Reviewed By: davidaurelio

Differential Revision: D4921672

fbshipit-source-id: 6405275bbd04550d7dd87cd5b8ef35a6cf5904f2
2017-04-21 04:01:02 -07:00
Jean Lauliac 2403b42cf9 packager: getAssetDataFromName: @flow
Reviewed By: davidaurelio

Differential Revision: D4921247

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

Differential Revision: D4913509

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

Differential Revision: D4914187

fbshipit-source-id: ae3b8aa4ed4dbd1896ca35cf498b7c02fd109f58
2017-04-19 11:00:41 -07:00
Jean Lauliac 0b339362ff packager: buck: fix messed up file types
Reviewed By: cpojer

Differential Revision: D4913706

fbshipit-source-id: 792d78e1baf7d9bea4eba90f791a1dc593087b55
2017-04-19 08:51:14 -07:00
Jean Lauliac 0001d3ce4e packager: worker: strenghten TransformOptions
Reviewed By: davidaurelio

Differential Revision: D4906499

fbshipit-source-id: e7948d09c678d3e270ddd9fd355597eb5d535781
2017-04-19 06:33:52 -07:00
Jean Lauliac de3478c1b1 packager: GlobalTransformCache: cache the transform options digest
Reviewed By: davidaurelio

Differential Revision: D4906974

fbshipit-source-id: b6cf83ba6a072400685948329070e171f65c837d
2017-04-19 03:15:38 -07:00
David Aurelio 50f0ade13d `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:10 -07:00
Jean Lauliac c6f5717d2b packager: ResolutionRequest: stronger option typing
Reviewed By: cpojer

Differential Revision: D4906382

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

Differential Revision: D4868312

fbshipit-source-id: 44d20a5ed73637a9b3f43a99b5c82931f3e15dc6
2017-04-18 09:39:32 -07:00
Jean Lauliac 1c53c9b20f packager: Module: remove dead cacheTransformResults option
Reviewed By: davidaurelio

Differential Revision: D4884343

fbshipit-source-id: ae29757690d9b56d6f166bc86573aca9b1b6b65c
2017-04-18 09:39:32 -07:00
Jean Lauliac a6828f2127 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:31 -07:00
Alex Kring 665fc86a6e 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:17:51 -07:00
Jean Lauliac 219328d000 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:31:30 -07:00
Jean Lauliac 33749c2714 packager: ResolutionRequest: correct mistaken callsite
Reviewed By: cpojer

Differential Revision: D4875756

fbshipit-source-id: cdf29e3c1115003596f6a7b4d27988010d56d88d
2017-04-13 10:31:30 -07:00
Christoph Pojer abcd1b6370 Use escape hatch for mocked modules
Reviewed By: davidaurelio

Differential Revision: D4869222

fbshipit-source-id: d2cf66296a26710630f0d0f6c8efc7ff3ed97bc5
2017-04-12 09:47:34 -07:00
Jean Lauliac 3c85a6b902 packager: stronger option types
Reviewed By: davidaurelio

Differential Revision: D4868612

fbshipit-source-id: 50d72ce56d8e3ef0d917ee5bbe3dd42faf075584
2017-04-12 04:31:24 -07:00
Christoph Pojer deebf15a56 Move formatBanner into packager folder
Reviewed By: davidaurelio

Differential Revision: D4868954

fbshipit-source-id: 7a28019c781262bcf4aab0ad2e67868d35ebf9fb
2017-04-12 02:44:51 -07:00
Jean Lauliac 8fc3b48c65 packager: worker: remove `extern` option
Reviewed By: davidaurelio

Differential Revision: D4867367

fbshipit-source-id: ebe5fa860566e87bd6d042ee41b9a7aa9c777fc6
2017-04-11 08:15:57 -07:00
Jean Lauliac fabf833c3f 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:15:57 -07:00
David Aurelio 7f706e824d 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:02:24 -07:00
David Aurelio eabc9cecd6 Push handling of missing parent module to `resolve`
Reviewed By: jeanlauliac

Differential Revision: D4863235

fbshipit-source-id: 857814cb25ee661db5e2cbdeac7175d9276044db
2017-04-11 08:02:23 -07:00
David Aurelio 3bcf4acfc7 Allow resolution without a parent.
Reviewed By: jeanlauliac

Differential Revision: D4862926

fbshipit-source-id: 18f98b6db98e9f937632bd5d00e0b0acfcff9de5
2017-04-11 08:02:23 -07:00
Jean Lauliac cb88df00ae packager: TransformCache: do not include basename in hash
Reviewed By: cpojer

Differential Revision: D4867411

fbshipit-source-id: ece5214ee9cf152e23790c70f7a8b12060725150
2017-04-11 05:31:26 -07:00
Hilke Heremans 2ab840522c 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 11:00:31 -07:00
Jonathan Kim 3d3cd867c9 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:15:46 -07:00
David Aurelio 263f40a2d3 packager: HasteMap: expose getAllFiles()
Reviewed By: tomocchino

Differential Revision: D4850695

fbshipit-source-id: 8aae4353de8779f7a1358b2766dad4a6c751b4af
2017-04-07 20:15:46 -07:00
Jean Lauliac 568fb403bf packager: GlobalTransformCache: fix bug in retry logic
Reviewed By: bestander

Differential Revision: D4850644

fbshipit-source-id: ede9991eaac3c7bfd045f2a9c3e9d0b10d45af0f
2017-04-07 05:04:23 -07:00
Jean Lauliac b2101836dc 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:47:28 -07:00
Jean Lauliac 77bee75893 packager: GlobalTransformCache: make key globalized
Reviewed By: davidaurelio

Differential Revision: D4835217

fbshipit-source-id: b43456e1e1f83c849a887b07f4f01f8ed0e9df4b
2017-04-06 04:46:22 -07:00
Jean Lauliac 8755338728 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:15:23 -07:00
Jean Lauliac 03892d1036 packager: GlobalTransformCache: retry 502 and 503 HTTP statuses
Reviewed By: davidaurelio

Differential Revision: D4818997

fbshipit-source-id: b31b004939f9e83c8a3a8c34b07c8b1ae2d4d17e
2017-04-04 04:16:21 -07:00
David Aurelio a51e9a0704 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:05:48 -07:00
David Aurelio b4da59e9c2 Fix file indentation
Reviewed By: jeanlauliac

Differential Revision: D4819078

fbshipit-source-id: 76bdc2381e479396ef11144236817ffd590f1039
2017-04-03 09:03:54 -07:00
Mike Grabowski dcecfa3189 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:45:54 -07:00
Jean Lauliac cc2ec6ff07 packager: TransformCache: use sha1 instead of murmurhash
Reviewed By: davidaurelio

Differential Revision: D4809941

fbshipit-source-id: 33b6c56b4c48eca88d8c1922f52ed29a728d1173
2017-04-03 06:03:17 -07:00
Jean Lauliac 4bd7dc0035 packager: TransformCache: do not rehash transformOptions every single time
Reviewed By: davidaurelio

Differential Revision: D4809963

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

Differential Revision: D4809513

fbshipit-source-id: a9a4196b72b241faf7c788e26b9e6880cecebb3e
2017-04-02 08:46:22 -07:00
Jean Lauliac 3ef2055ee9 packager: sync Module#read()
Reviewed By: davidaurelio

Differential Revision: D4802783

fbshipit-source-id: c6309bcae6ad48bea2350de04353f694be6eea2f
2017-03-31 10:20:19 -07:00
Brent Vatne b80e2c8799 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:17:22 -07:00
Pieter De Baets 7db16a4020 Remove RelayFBPreloadedModules, error on overlapping modules
Reviewed By: davidaurelio

Differential Revision: D4779671

fbshipit-source-id: f2dfeb696baab457769c22ca7ab28972270e5fc0
2017-03-30 16:50:05 -07:00
Jean Lauliac 33000c74f9 packager: GlobalTransformCache: retry keys fetches
Reviewed By: davidaurelio

Differential Revision: D4779641

fbshipit-source-id: 1b156bf075fa2456d9e6b1a3f38855357abc1abb
2017-03-28 11:01:53 -07:00
Jean Lauliac e0ad42592b packager: ResolutionRequest.js: resolveDependency() now sync
Reviewed By: davidaurelio

Differential Revision: D4763593

fbshipit-source-id: b3dc95229d040c776833a88c9a156b9168e0cc4c
2017-03-27 09:46:37 -07:00
Jean Lauliac b96e210500 packager: ResolutionRequest.js: sync _resolveNodeDependency()
Summary: Moar synchronicity.

Reviewed By: davidaurelio

Differential Revision: D4756495

fbshipit-source-id: 4e0758ba8b55bd25a24d79dcc8ac4ace101e2ae8
2017-03-27 09:46:37 -07:00
Tim Yung 73c85e4f31 RN: Cleanup Flow / Jest / Metro Configs
Reviewed By: kassens

Differential Revision: D4777088

fbshipit-source-id: d07f4d1dd019a814c8bee4caeb57fc1dd3721c27
2017-03-26 16:05:10 -07:00
Lee Byron d2fc08d33b Move classic relay into oss packages
Reviewed By: kassens

Differential Revision: D4769497

fbshipit-source-id: 0144456a82c3969b399a4a0b37814b5627d191c5
2017-03-24 11:31:01 -07:00
Jean Lauliac 20ba987139 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:31:39 -07:00
Jean Lauliac 337daa3d19 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:20:46 -07:00
Jean Lauliac 3f0f7357cf packager: ResolutionRequest.js: sync _resolveFileOrDir
Reviewed By: davidaurelio

Differential Revision: D4754138

fbshipit-source-id: d19792a726220a673dead1c8c6cdf487e34a6808
2017-03-23 11:20:46 -07:00
Jean Lauliac f06384b1b7 packager: ResolutionRequest.js: _loadAsDir and _loadAsFile sync
Reviewed By: davidaurelio

Differential Revision: D4754090

fbshipit-source-id: 84ad1d988bf097d3094d90f3738ce64cc523879c
2017-03-23 11:20:46 -07:00
Jean Lauliac 30548427ef 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:01:45 -07:00
Jean Lauliac 909d2e5503 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:49:08 -07:00
Jean Lauliac 5eb954f660 packager: Module.js: make read()-based API sync
Reviewed By: davidaurelio

Differential Revision: D4746218

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

Differential Revision: D4745885

fbshipit-source-id: 3d327e5ca91fcbe7ec1d30ff8e6135b415074aa4
2017-03-22 06:54:20 -07:00
Jean Lauliac d5288e7698 packager: GlobalTransformCache-test: disable non-deterministic test
Reviewed By: davidaurelio

Differential Revision: D4751434

fbshipit-source-id: 1be748387abe9ca0ce030bd2423827dfe5c2a146
2017-03-22 06:54:20 -07:00
Brent Vatne 54989d0aaf 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:45:59 -07:00
Jean Lauliac 4797701b66 packager: clear cache
Reviewed By: davidaurelio

Differential Revision: D4746429

fbshipit-source-id: 1a49a4b6db75658749346f0fd94dad68ff084203
2017-03-21 11:45:42 -07:00
Jean Lauliac 439cb76a00 packager: GlobalTransformCache: reduce asynchronicity for non-cached bundles
Reviewed By: davidaurelio

Differential Revision: D4745595

fbshipit-source-id: 3126fdcc11dd1c8085316457ead0cabae633d0db
2017-03-21 06:01:12 -07:00
Jean Lauliac 4cbb64521a packager: GlobalTransformCache: ignore errors related to fetching
Reviewed By: davidaurelio

Differential Revision: D4745584

fbshipit-source-id: 2c9b2451d3525c90308fb88784945462cd827d1f
2017-03-21 06:01:12 -07:00
Jean Lauliac 5c128ad049 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:01:12 -07:00
Marc Horowitz d7314661fb Don't swallow the error if a module require fails
Reviewed By: davidaurelio

Differential Revision: D4733269

fbshipit-source-id: 2cca14c023b148b62cf24f204cdb355f8d2f3590
2017-03-20 13:07:06 -07:00
David Aurelio 14fee735a2 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:31:42 -07:00
David Aurelio 68c77395b1 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:03:20 -07:00
David Aurelio 5b3920567d 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:44:56 -07:00
Kevin Cooper 06dd08316f 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 13:02:29 -07:00
Jean Lauliac a1694ba86b 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 14:01:11 -07:00
Jean Lauliac 3bb9512484 packager: FBGlobalTransformCache: move the retry/error logic
Reviewed By: davidaurelio

Differential Revision: D4713585

fbshipit-source-id: 6a83f858692b8a1f6326051f3a3f4a3a549e4027
2017-03-16 14:01:10 -07:00
Jean Lauliac bb266715f1 packager: GlobalTransformCache: finish conversion to async/await
Reviewed By: davidaurelio

Differential Revision: D4713456

fbshipit-source-id: f65c45439d1657872e28a296f13a73ee2032ea93
2017-03-16 09:40:25 -07:00
Jean Lauliac 24183a363c packager: Resolver/polyfills/require: fix nit error message
Reviewed By: davidaurelio

Differential Revision: D4713066

fbshipit-source-id: 35f09ded85472191a3f1c36b5879acee55c60b8b
2017-03-15 07:45:23 -07:00
Jean Lauliac 7098c450d8 packager: attachHMRServer.js: Flow
Summary:
The breakage fixed by changeset [1] could have been identified earlier if we had typing on `attachHMRServer`, so I spent some time on that. This has revealed in turn a few functions across the codebase that were incorrectly typed, and that are now fixed.

[1] packager: attachHMRServer.js: fix callsite of Server#getModuleForPath()

Reviewed By: davidaurelio

Differential Revision: D4706241

fbshipit-source-id: fc4285245921ae45d5781a47d626fc0559dba998
2017-03-15 06:20:48 -07:00
Liu Zhanhong 6cbb57d0df BREAKING: Remove @provides support from packager
Summary:
see d82f2553fb
Closes https://github.com/facebook/react-native/pull/12355

Differential Revision: D4710001

Pulled By: davidaurelio

fbshipit-source-id: 1c2225fa3bd2881c3eaedfd02514c29b920948b6
2017-03-14 19:30:38 -07:00
David Aurelio bacee5ad56 Update worker to match command line args passed by Buck
Reviewed By: cpojer

Differential Revision: D4673955

fbshipit-source-id: 1886cef97a96efbe0e90b02b98f03544d5f3f155
2017-03-14 15:01:27 -07:00
Alexey Lang 0a475d2b32 Use performanceNow to calculate __BUNDLE_START_TIME__
Reviewed By: javache

Differential Revision: D4706142

fbshipit-source-id: aa983d9e5d5324f97ae34ec0190b1fc988d012c8
2017-03-14 13:47:56 -07:00
Jean Lauliac 4203c9c837 packager: fix buildBundle() options
Summary: The problem with `bundleOpts` is that it discards Flow typing, so it prevents reinforcing the integration of `Bundler` into `Server`. This changeset removes the `bundleOpts` to solve that issues. Instead, it makes the options explicit so that there is less uncertaintly. I love making options explicit, because they force callsites to take a consicious decision about what is really needed, making them more robust. They also expose oddities that probably needs refatoring, for example having a `resolutionRequest` in the bundle options does not seem correct, it should be an implementation details. Likewise, `onProgress` should probably be exposed differently, as it does not affect the content of the bundle itself.

Reviewed By: davidaurelio

Differential Revision: D4697729

fbshipit-source-id: d543870ba024e7588c10b101fa51429c77cc5ddc
2017-03-14 11:04:51 -07:00
Jean Lauliac 8ac35c8a0e packager: react-packager.js: reinforce the typing at API boundary
Reviewed By: davidaurelio

Differential Revision: D4698256

fbshipit-source-id: 7a42e9b79744f599e92b5d3d91c41cdd0de2ece5
2017-03-14 11:04:51 -07:00
Jean Lauliac ac452c0a17 packager: Server: make buildBundle() async
Summary: Also remove the unnecessary await of the resolver, because `_bundler.bundle()` already does that.

Reviewed By: davidaurelio

Differential Revision: D4689448

fbshipit-source-id: 3b4fd73b1368f8b00c6eb7483e751387d9856ce9
2017-03-13 06:15:36 -07:00
Jean Lauliac 76f5b9606a packager: Bundler: refactor the maxWorkerCount
Summary: The function giving the worker count was duplicated, let's just pass it down from a central place, the Bundler. Also, I simplified the function to use a simple formula rather than arbitrary ranges (it's still arbitrary, just a tad bit less :D ).

Reviewed By: davidaurelio

Differential Revision: D4689366

fbshipit-source-id: fe5b349396f1a07858f4f80ccaa63c375122fac8
2017-03-13 05:30:12 -07:00
Jean Lauliac 014eef3c74 packager: verify validity of TTY before using it
Reviewed By: mkonicek

Differential Revision: D4689779

fbshipit-source-id: 9bc2c1447bd64ec392adef772b1189a782f83545
2017-03-10 10:50:10 -08:00
Jean Lauliac 3e1542b485 packager: Resolver: remove opt defaults, simplify load()
Summary: Not having default everywhere (keeping them at the top level instead) makes for a code that is easier to understand, and more robust as different pieces of code cannot default to different values. This changeset also unifies the option types (ex. `platform`).

Reviewed By: cpojer

Differential Revision: D4688882

fbshipit-source-id: b5f407601386336f937a0ac1f68c666acc89dfd8
2017-03-10 08:33:56 -08:00
Jean Lauliac 0c46953ad0 packager: node-haste: async load()
Reviewed By: cpojer

Differential Revision: D4673384

fbshipit-source-id: 816529f8947079b4003c8e91443e221184fd589d
2017-03-10 04:13:06 -08:00
Jean Lauliac 1030aabbc4 packager: Resolver: make the Resolver construction a Promise
Reviewed By: cpojer

Differential Revision: D4681614

fbshipit-source-id: 5da558280edf300f67042e72c65b272e49351871
2017-03-10 04:13:06 -08:00
Jean Lauliac 0ff379bb76 packager: node-haste: cleanup the load() function
Reviewed By: davidaurelio

Differential Revision: D4659391

fbshipit-source-id: a83e218ba89ad459fed07a4dfb61c422a6b4db5d
2017-03-08 10:45:36 -08:00
Jean Lauliac a435fbcbd1 packager: node-haste: remove use of HasteMap class
Reviewed By: davidaurelio

Differential Revision: D4658741

fbshipit-source-id: 951c96df174c79a00b3cff102b3dda75abd4ef99
2017-03-08 10:45:36 -08:00
sonaye 160b1c8ee5 Support for defineEnumerableProperties
Summary:
**Motivation**
detailed in #12702.

**Test plan**
1) running [a piece of code](https://github.com/mobxjs/mobx/issues/839#issuecomment-284153126) that utilizes the helper without any modifications on the react native package results an error being thrown.

![b589a71c-0041-11e7-9d47-cb79efff3ba5](https://cloud.githubusercontent.com/assets/23000873/23579517/3c8fe992-0100-11e7-9eb5-93c47f3df3e0.png)

2) updating the list of helpers available by adding the definition of `defineEnumerableProperties` as provided by babel [babel/babel/packages/babel-helpers/src/helpers.js](https://github.com/babel/babel/blob/master/packages/babel-helpers/src/helpers.js#L275-L285) results no errors.

![kapture 2017-03-04 at 16 48 35](https://cloud.githubusercontent.com/assets/23000873/23579520/457b8ca0-0100-11e7-8ca4-c704c6e9631f.gif)
Closes https://github.com/facebook/react-native/pull/12703

Differential Revision: D4658120

Pulled By: ericvicenti

fbshipit-source-id: 914aed4d313b3cc4f7ab99049d05d0aef269a3be
2017-03-06 16:15:40 -08:00
Jean Lauliac c77f09b174 packager: node-haste: remove getHasteMap()
Reviewed By: davidaurelio

Differential Revision: D4597906

fbshipit-source-id: 4e239d0278fd79a8c60944b71e127e5a335b066f
2017-03-06 06:56:02 -08:00
Jean Lauliac 3e9dedf1ac packager: minimize terminal.log() work
Reviewed By: davidaurelio

Differential Revision: D4650441

fbshipit-source-id: 2de2c8e5bea29179fd04ef8db67ac385b3f0a06b
2017-03-03 11:14:53 -08:00
Jean Lauliac 0cb2bc104f packager: make DependencyGraph.processFileChange private
Reviewed By: davidaurelio

Differential Revision: D4635645

fbshipit-source-id: baf3ec75927dfa2d1b29d6548a13453370f434ba
2017-03-02 08:53:55 -08:00
Jean Lauliac 067496e5f6 packager: ResolutionRequest: use moduleMap instead of hasteMap
Reviewed By: cpojer

Differential Revision: D4605535

fbshipit-source-id: bc8394eb296f3fbeda5d8f0f3c17790db8691033
2017-03-02 08:53:55 -08:00
Jean Lauliac 5d37bfa605 packager: DependencyGraph-test: fix tests
Reviewed By: davidaurelio

Differential Revision: D4635348

fbshipit-source-id: 0130496e20d54f5ddf6546823b7a6cba3118917d
2017-03-02 08:53:55 -08:00
Christoph Pojer 94901b1e1d Bring back polyfill test
Reviewed By: jeanlauliac

Differential Revision: D4642517

fbshipit-source-id: 0882f453eb91c9f12a9e507ccfa60873106d2d71
2017-03-02 05:29:59 -08:00
Janic Duplessis 5facc23799 Packager - Fix absolute imports on Windows
Summary:
Absolute imports on Windows were broken, I'm not 100% sure when this happens but when I tested Exponent on Windows which uses `rn-cli.config.js` with
```js
getTransformOptions() {
    return {
      reactNativePath: path.resolve('./node_modules/react-native'),
      reactPath: path.resolve('./node_modules/react'),
    };
  }
```
it seemed to use absolute paths for these modules.

I also tested absolute paths in node repl and it does work for absolute paths of different formats. `C:/root/test.js`, `/root/test.js`, `C:\root\test.js` all do resolve properly to the same module.

To fix this I resolve the absolute path using `path.resolve` on Windows. Noop on other platforms to avoid the overhead since it's not necessary.

**Test plan**
- Tested that it fixed the bug I had when running Exponent on Windows.
- Updated the absolute path test to use forward slashes since this is what happens in practice when using `getTransformOptions`. We can't test all cases on linux since adding the drive letter au
Closes https://github.com/facebook/react-native/pull/12530

Differential Revision: D4634699

Pulled By: jeanlauliac

fbshipit-source-id: 0cf6528069b79cba2e0f79f48f5a524d59b7091e
2017-03-01 08:15:51 -08:00
Christoph Pojer 4d00df41b4 Fix lint errors 2/2
Reviewed By: jeanlauliac

Differential Revision: D4628330

fbshipit-source-id: 94fad1294e22fa0073e15843f94241ae778112a0
2017-03-01 08:15:51 -08:00
Jean Lauliac 04f42ab075 packager: DependencyGraph-test: go through fs.watch mock rather than manual API
Reviewed By: davidaurelio

Differential Revision: D4628593

fbshipit-source-id: 43ccdb038bd387e87096f2a7020c98d915fa5bba
2017-03-01 08:00:18 -08:00
Christoph Pojer 5403946f09 Fix lint errors 1/n
Reviewed By: davidaurelio

Differential Revision: D4627645

fbshipit-source-id: 3cf368c6a24a555b7d0a39045f6ba6fd92ae34e1
2017-02-28 09:00:42 -08:00
Christoph Pojer c637ca0d03 Remove outdated file
Reviewed By: jeanlauliac

Differential Revision: D4627603

fbshipit-source-id: 9b6187725335d17f65a18c9fdcd7e73d7141f551
2017-02-28 08:29:55 -08:00
Jean Lauliac 2030b6befe packager: terminal: split status too big to fit in screen
Reviewed By: cpojer

Differential Revision: D4627512

fbshipit-source-id: 6e7b5f3a6e2d012a44373014f93ab17ef4f290a2
2017-02-28 06:45:56 -08:00
Jean Lauliac f117533f82 packager: simplify fs.stat mocks
Reviewed By: davidaurelio

Differential Revision: D4620080

fbshipit-source-id: f78b20d2f728ddd32413f27dba85cb825ec7c9a9
2017-02-28 06:23:58 -08:00
Bhuwan Khattar 234f4f538d Introduce HasteImpl
Summary:
Similar to https://github.com/facebook/jest/pull/2877, this introduces an optional config `HasteImpl` of type `{getHasteName(filePath: string): (string|void)}` that returns the haste name for a module at filePath if it is a haste module or undefined otherwise.

This allows us to inject a custom implementation of haste's module id resolution rather than only relying on `providesModule` annotations

Reviewed By: davidaurelio

Differential Revision: D4589372

fbshipit-source-id: 4d1983dfbf09c9d67faf725e86ae86ab42433b7d
2017-02-27 14:04:58 -08:00
David Aurelio b6ca952eeb Symbolicate stack traces off the main process
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
2017-02-27 14:04:57 -08:00
Christoph Pojer 37b91a63c7 Fix flow errors
Reviewed By: davidaurelio

Differential Revision: D4619990

fbshipit-source-id: 80355b8f0d0c3f84691098a05cdf2ba136c4bf53
2017-02-27 14:04:57 -08:00
Gabe Levi 4a60be62bc Deploy v0.40.0
Reviewed By: yungsters

Differential Revision: D4612331

fbshipit-source-id: 3eaa2f99d3181227166064cbee29b9245401a775
2017-02-24 12:45:56 -08:00
Christoph Pojer 2a3fe0625d Fix a bunch of flow annotations
Reviewed By: jeanlauliac

Differential Revision: D4611846

fbshipit-source-id: c2fe468e34a3b1eba7fcd2596020aad136285363
2017-02-24 11:17:48 -08:00
Christoph Pojer cf627fbdac Fix typo in ResolutionRequest
Reviewed By: davidaurelio

Differential Revision: D4605569

fbshipit-source-id: 5cd942e35faa8c653c4b709edb026eac0636a32a
2017-02-23 10:46:05 -08:00
Bhuwan Khattar e11b9d832a Remove @providesModule from polyfills
Summary:
These are not modules and don't need a `providesModule` annotation.

`sed -i -e '/providesModule/d' packager/src/Resolver/polyfills/*.js`

Reviewed By: cpojer

Differential Revision: D4605374

fbshipit-source-id: 5045a9664bc105dab15936f408d373da8d9322fe
2017-02-23 09:16:16 -08:00
Jean Lauliac 4a4dddbfdc packager: node-haste: do not expose HasteMap
Reviewed By: davidaurelio

Differential Revision: D4598085

fbshipit-source-id: d993be8e3bdcfda018a898b4adb32b53c1f0a948
2017-02-23 03:46:10 -08:00
David Aurelio 3a1af41a5d Discard protocol, host, and port of URLs in bundle options
Summary:
HTTP request URLs don’t include protocol, host and port. Stack frames URLs, on the other hand, contain full URLs. These full URLs are used to get the correct bundle to build the source map from.

The method that creates option objects from URLs therefore now discards leading protocol, host and port to ensure that cached bundles can be reused for symbolication rather than triggering rebuilds.

Reviewed By: jeanlauliac, cpojer

Differential Revision: D4598077

fbshipit-source-id: 262df187bcdf7099011371e8b55ae692c6e1a942
2017-02-23 02:44:59 -08:00
Christoph Pojer 13edf6da2b Add dependencies to package.json
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
2017-02-22 11:33:04 -08:00
Jean Lauliac ac29f45679 packager: cleanup node-haste/index.js opts
Reviewed By: cpojer

Differential Revision: D4591599

fbshipit-source-id: d1906b0b9a80f173f2a07174304dabe30985a5bc
2017-02-22 04:00:06 -08:00
Jean Lauliac a7d3940de6 GlobalTransformCache: increase timeout
Reviewed By: davidaurelio

Differential Revision: D4589052

fbshipit-source-id: 7eaec58a196db7f89b3039afbda4620889c9bcef
2017-02-20 10:46:04 -08:00
Jean Lauliac 564126f2bf packager: BatchProcessor: use Promise for processBatch()
Reviewed By: cpojer

Differential Revision: D4572495

fbshipit-source-id: 4a18b6ae16ea588104c337f2085707be07609005
2017-02-20 08:45:21 -08:00
Jean Lauliac bac576c433 packager: BatchProcessor: use Promise for queue()
Reviewed By: cpojer

Differential Revision: D4572181

fbshipit-source-id: 34c3824f05efd93847df9ba5931b0735c6711c28
2017-02-20 08:45:19 -08:00
Jean Lauliac 1a5b56d070 packager: introducing async/await, return of the yarn
Summary:
The first time I tried to commit this changeset, it was causing many new packages to be installed, because the dependency would depend on newer versions that what we have installed. So, I had made a diff so upgrade all the babel packages. Unfortunately this caused some problem as the newer versions of Babel are more strict on some syntaxes. Of course, these have to be addressed, but I don't want this changeset to be coupled with Babel upgrades and the issues that arise from it.

So instead, I decided to install the slightly older version of the async-to-generator module. At first I tried with just doing:

    yarn add babel-plugin-transform-async-to-generator@6.16.0

But, `yarn` is stubborn: because this module depends on a caret version of `babel-helper-remap-async-to-generator`, it installs the very last version of it, that itself needs more recent versions of other Babel modules. So, instead, I add to install a slightly older version of the dependency manually, then then the plugin:

    yarn add babel-helper-remap-async-to-generator@6.16.0
    yarn add babel-plugin-transform-async-to-generator@6.16.0

This allows us to have a `yarn.lock` with only a minimal amount of changes, and uncouple this change from any Babel upgrades. Because we only have a few new modules, the `node_modules` folder also stays the same, 133M, and it gives us confidence this will not cause significant startup time regressions.

Reviewed By: cpojer

Differential Revision: D4578733

fbshipit-source-id: deb0f720b895b7196aaf432adec3e56f18663940
2017-02-20 08:45:18 -08:00
Jean Lauliac 8be2a27aab Revert D4559167: packager: introducing async/await
Differential Revision: D4559167

fbshipit-source-id: de887a737ad1d02ef07a431ee0713d0bad65eb85
2017-02-16 10:59:57 -08:00
Jean Lauliac 26304dacf1 packager: introducing async/await
Summary:
allow-large-files

By using async/await the code is (1) less nested, (2) more compact and (3) more robust (no exceptions running away, and much less risks of forgetting to call the callback/resolve, or mistakenly calling it twice). I now tend to think we could switch to it for all the callsites that are not in a perf-critical path.

I switched from 'request' to 'node-fetch' because 'request' has an annoying callback with 2 arguments. So it's simpler to use an interface that's (1) already returning a Promise and (2) that is becoming standard.

This changeset was a way for me to start experiment with introducing async/await in packager codebase, and it looks pretty good so far.

Reviewed By: cpojer

Differential Revision: D4559167

fbshipit-source-id: 89a328c5766c2ba890e9d0e67a81a38dac6cfc73
2017-02-15 13:47:52 -08:00
Jean Lauliac e56b5be904 packager: JSONReporter: expose errors correctly
Reviewed By: cpojer

Differential Revision: D4536721

fbshipit-source-id: d8969a42e844da809bd167cbc1bae2cb11f1db57
2017-02-10 09:30:08 -08:00
Jean Lauliac 57010d63b6 packager: cleanup build status reporting
Reviewed By: cpojer

Differential Revision: D4521560

fbshipit-source-id: 8943e179192522da5145e4f14f0b648d3548cc36
2017-02-09 04:20:41 -08:00
Christoph Pojer fc60f5948a Change `transformCacheKey` to `getTransformCacheKey`
Reviewed By: jeanlauliac

Differential Revision: D4506459

fbshipit-source-id: cd42cb4f09c0130d08c27e3a097710b91c5dc6ba
2017-02-09 04:03:17 -08:00
Christoph Pojer a4d7a7835f Remove baseTransformer
Reviewed By: jeanlauliac

Differential Revision: D4506124

fbshipit-source-id: 642f06dffe4ea710113e8e8426915bf1b40d4611
2017-02-09 04:03:17 -08:00
Jhen ee6adf817e Fix resolveNodeDependency for Windows
Summary:
Related to https://github.com/zalmoxisus/remote-redux-devtools/issues/62, we got the wrong resolved path on Windows, should use `path.sep` instead of `'/'`.
Closes https://github.com/facebook/react-native/pull/12206

Differential Revision: D4513338

fbshipit-source-id: 17814920986d091a6c6deae648f951f7be1cb688
2017-02-07 12:45:50 -08:00
Alexey Kureev f30ab35e92 Add default option for Platform.select
Summary:
satya164 asked me to take over fixes for [this PR](https://github.com/facebook/react-native/pull/11608), so here we go!
Closes https://github.com/facebook/react-native/pull/12218

Differential Revision: D4515285

Pulled By: davidaurelio

fbshipit-source-id: 8987c518401fc67093dfe93bbbb63b934c20f6f9
2017-02-07 04:30:16 -08:00
Jean Lauliac 75c14e3674 packager: fix uncaught rejection
Summary: I figured out that the uncaught rejection that happens on transform error originated from a "fork" along the chain, where we both "then" on a promise, and return that promise. In that case Node.js, legitimately I think, identifies this as an uncaught rejection case. One solution, in this changeset, is to do the side-effects as part of the promise chain instead of "forking". Another option would be to add an explicit error handler to the additional "then", but it seems we don't have to handle that case here.

Reviewed By: davidaurelio

Differential Revision: D4515592

fbshipit-source-id: 17d813cfdbc76685b6273b8d94e97d948fd68674
2017-02-06 11:01:11 -08:00
Bhuwan Khattar d8694a258f refactor Module.js
Reviewed By: davidaurelio

Differential Revision: D4507868

fbshipit-source-id: 8b845bf8a484f494af1900eaf36454a8f3f78a9f
2017-02-06 08:28:36 -08:00
Bhuwan Khattar 4e96b3aec5 Random @providesModule related fixes
Reviewed By: jeanlauliac

Differential Revision: D4507885

fbshipit-source-id: 34d1a7be26febf7d93b65ba8fff635ab44e6459d
2017-02-06 07:58:40 -08:00
Jean Lauliac 242ced150c packager: reestablish changes reverted by d63f9c
Reviewed By: cpojer

Differential Revision: D4514889

fbshipit-source-id: de5d1350cbcea7a26395e532fefd78a816167b4a
2017-02-06 06:58:27 -08:00
Bhuwan Khattar d82f2553fb Replace @provides with @providesModule
Reviewed By: davidaurelio

Differential Revision: D4494624

fbshipit-source-id: 192cc77126a99b3a3baeb806ed605c2194c4713a
2017-02-02 08:58:33 -08:00
Christoph Pojer a2c84d14ce Remove `react-packager` indirection.
Summary:
This moves the `src` directory one level up and removes the `react-packager` folder. Personally, I always disliked this indirection. I'm reorganizing some things in RNP, so this seems to make sense.

Not sure if I forgot to update any paths. Can anyone advice if there are more places that need change?

Reviewed By: jeanlauliac

Differential Revision: D4487867

fbshipit-source-id: d63f9c79d6238300df9632d2e6a4e6a4196d5ccb
2017-02-02 05:44:15 -08:00
Jean Lauliac fd1a1325f3 packager: JSTransform cleanup: remove options object
Summary: We can simplify as there's only one option, and it seems to me we can also make it required, as otherwise the `JSTransformer` is essentially doing nothing. I don't believe we still have use cases where no transform happens at all, even in OSS?

Reviewed By: davidaurelio

Differential Revision: D4481723

fbshipit-source-id: b2e3830b206d56242d298ff3a7b5f4587ecfd29a
2017-01-31 05:28:35 -08:00
Jean Lauliac b6f494c313 packager: JSTransform cleanup: remove opts.methods
Summary: It's not used from any callsite as far as I can see.

Reviewed By: davidaurelio

Differential Revision: D4481708

fbshipit-source-id: 2c503fb7ef20f9370a950c315832f3ace4709739
2017-01-31 03:58:42 -08:00
Jean Lauliac 7bc25f5ece packager: JSTransform cleanup: remove opts.worker
Summary: it's not used from any callsite as far as I can see.

Reviewed By: davidaurelio

Differential Revision: D4481699

fbshipit-source-id: 4cf63ef7953d6cfc58e7ef4f22ecb99bf51e76a0
2017-01-31 03:58:42 -08:00
Jean Lauliac a10824c9c7 packager: JSTransform cleanup: remove transformTimeoutInterval
Summary: It's not used in any callsite.

Reviewed By: cpojer

Differential Revision: D4481683

fbshipit-source-id: 3fa55693f5f56b4fb6c455ad77d7780f69be81a9
2017-01-31 03:58:42 -08:00
Jean Lauliac a28f1536c8 packager: json reporter
Summary: The idea is to make it easier to interact with tools consuming the packager's output. For example, Nuclide. Do you think that'd work well?

Reviewed By: davidaurelio

Differential Revision: D4482041

fbshipit-source-id: 6c64d7963195a4d786ed8902640f9e9f279f5f83
2017-01-31 03:58:42 -08:00