Commit Graph

1115 Commits

Author SHA1 Message Date
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
Jean Lauliac bf930e473a packager: simplify ScribeLogger-test
Reviewed By: cpojer

Differential Revision: D4481570

fbshipit-source-id: 27beae850806d8d7f526a3196b2962a18e514007
2017-01-30 07:43:31 -08:00
Jean Lauliac abf75fa23c packager: add utilities to log errors internally
Reviewed By: davidaurelio

Differential Revision: D4468471

fbshipit-source-id: 10deb5014d06e4d3bb9d3122eef362c09f74d044
2017-01-27 11:13:27 -08:00
Jean Lauliac 5af697b3bb packager: backticks for module names
Reviewed By: cpojer

Differential Revision: D4468850

fbshipit-source-id: 281064a81ff1262094711f4e800effcd17fb7e4d
2017-01-26 10:43:31 -08:00
Jean Lauliac 48b86022fb packager: remove rogue terminal.log()
Reviewed By: cpojer

Differential Revision: D4468825

fbshipit-source-id: 29320f50cabc6002401e470a9ac278e9cb6673d3
2017-01-26 10:43:31 -08:00
Jean Lauliac 3ab9137b9e packager: add BatchProcessor-test
Reviewed By: davidaurelio

Differential Revision: D4468735

fbshipit-source-id: 8d20b44ef20aa24e72cd53182dbc34139a10df41
2017-01-26 09:43:32 -08:00
Jean Lauliac a9dbe6a439 packager: server/runServer.js: @flow
Reviewed By: davidaurelio

Differential Revision: D4462611

fbshipit-source-id: 22f4cc299e2a30fe260dbe8d4c67323ceb8178e8
2017-01-26 03:43:33 -08:00
Jean Lauliac 50168b7d6e packager: server/server.js: @flow
Reviewed By: davidaurelio

Differential Revision: D4462520

fbshipit-source-id: dc08aef691a78acb571a4da8038343184019d09f
2017-01-26 03:43:33 -08:00
Jean Lauliac be490d2f0c Backed out changeset 35b573bece59
Reviewed By: davidaurelio

Differential Revision: D4461681

fbshipit-source-id: f5c45f713f2fe68443986a2822aa325b01dd5075
2017-01-26 03:43:33 -08:00
Liu Zhanhong 0623a47ecd Sync with Resolver/polyfills/require.js
Summary:
I don't know which version is better, but it should sync with `Resolver/polyfills/require.js: 168`
```js
    // keep args in sync with with defineModuleCode in
    // packager/react-packager/src/Resolver/index.js
    // and packager/react-packager/src/ModuleGraph/worker.js
    factory(global, require, moduleObject, exports, dependencyMap);
```
Closes https://github.com/facebook/react-native/pull/12033

Differential Revision: D4461635

Pulled By: davidaurelio

fbshipit-source-id: 1a17e6cbac5525dc09609b658bef82a23574b00c
2017-01-25 03:58:30 -08:00
Jing Chen 7cb5b6e523 Revert stacked revisions on packager that causes packager to instacrash
Reviewed By: fkgozali, bestander

Differential Revision: D4456911

fbshipit-source-id: 35b573bece59c59c0700ef2d8ab26c0b7150d3cf
2017-01-24 11:43:36 -08:00
David Aurelio a116dbf4a4 Add tests for source map generator
Summary: This adds test for our high-perf source map generator.

Reviewed By: cpojer

Differential Revision: D4455547

fbshipit-source-id: 293bfe09c9c020259ae3daa4fa52f829248cca3c
2017-01-24 08:58:42 -08:00
Jean Lauliac f8b37b7d24 packager: extract BatchProcessor module
Reviewed By: davidaurelio

Differential Revision: D4449820

fbshipit-source-id: f54e6dd53ba4d211694e0bdc955af846d25778b8
2017-01-24 03:43:36 -08:00
Jean Lauliac 7b6272c952 packager: move error handling from Module to GlobalTransformCache
Reviewed By: davidaurelio

Differential Revision: D4449685

fbshipit-source-id: 4f57cfe132036f476e36933bd2ffcb9f23c42ccc
2017-01-24 03:43:36 -08:00
Jean Lauliac ccf94aa65a packager: GlobalTransformCache: remove global variable
Reviewed By: davidaurelio

Differential Revision: D4449333

fbshipit-source-id: b9546b90d2fd5ddca9c1ee2719c6c454b60bdfa4
2017-01-24 03:43:36 -08:00
David Aurelio 2ab7988cbe add tests
Summary: Tests for things introduced over the last 10 weeks

Reviewed By: cpojer

Differential Revision: D4442404

fbshipit-source-id: cf7a14f237360fde083b7e2ffcd9d70aafd0ced6
2017-01-23 03:58:24 -08:00
Radek Czemerys f521e992cc Fix typo in ResolutionRequest.js
Summary:
Small fix:
Fix typo in error message - should be `npm start --reset-cache`
Closes https://github.com/facebook/react-native/pull/11983

Reviewed By: AsyncDBConnMarkedDownDBException

Differential Revision: D4443749

Pulled By: hramos

fbshipit-source-id: eeaa531180c58a85df482fe3162b2a0b2169c891
2017-01-20 17:43:27 -08:00
David Aurelio cec787563a amend babel definitions to allow inline plugins without configuration
Summary: Updates babel flow defs to allow for inline plugins without configuration arguments.

Reviewed By: jeanlauliac

Differential Revision: D4442217

fbshipit-source-id: 1b4392bf13977d97984c72cff65b28e62f602300
2017-01-20 10:43:29 -08:00
David Aurelio 3b3d294a6b Even faster source map generation
Summary:
This replaces a polymorphic method with three separate methods that support the different used invocations.

In isolation, this leads to a 25% speedup.

Shoutout to trueadm for teaching me about this.

Reviewed By: trueadm

Differential Revision: D4436781

fbshipit-source-id: 3dce83556debf19d5305c4566a56b9e9565e85bc
2017-01-20 07:13:26 -08:00
Gabe Levi e2ce98b7c6 Fix the suppress comment regex for react_native
Reviewed By: davidaurelio

Differential Revision: D4435640

fbshipit-source-id: c680aee6931979859f04c0dca47037ba6f6cba73
2017-01-19 10:28:28 -08:00
Gabe Levi a4bfac907e Deploy v0.38.0
Reviewed By: jeffmo

Differential Revision: D4428858

fbshipit-source-id: 10dc69349a2b563e1fa444a8b0612e3b2d4ccd1c
2017-01-18 11:13:30 -08:00
David Aurelio 09072b9d77 Fix loading minified bundle over HTTP
Summary: Sets `generateSourceMaps` to true when requesting a bundle in non-dev mode or minified.

Reviewed By: bestander, cpojer

Differential Revision: D4415492

fbshipit-source-id: 9b4dcbd577a535dab143bb7a067210fbd831bf1a
2017-01-13 10:43:27 -08:00
David Aurelio 9a4e4e8ee8 Fix packager breakages on node4
Summary:
This fixes issues that only surface when running with node4 / npm2.
Closes https://github.com/facebook/react-native/pull/11888

Differential Revision: D4415021

Pulled By: bestander

fbshipit-source-id: 8672cd892c9dae41cc7b5b7b3227eb24dd780d22
2017-01-13 09:28:41 -08:00
Andrew Imm 09a83f976e Allow project-specific config for RN CLI using providesModuleNodeModules
Reviewed By: davidaurelio

Differential Revision: D4409046

fbshipit-source-id: 5af0d08542935a784f4737653ccac49fd7517aff
2017-01-12 21:13:36 -08:00
David Aurelio 0849f84df2 create better debuggable source maps
Summary:
Introduces a new mechanism to build source maps that allows us to use real mapping segments instead of just mapping line-by-line.

This mechanism is only used when building development bundles to improve the debugging experience in Chrome.

The new mechanism takes advantage of a new feature in babel-generator that exposes raw mapping objects. These raw mapping objects are converted to arrays with 2, 4, or 5 for the most compact representation possible.
We no longer generate a source map for the bundle that maps each line to itself in conjunction with configuring babel generator to retain lines.

Instead, we create a source map with a large mappings object produced from the mappings of each individual file in conjunction with a “carry over” – the number of preceding lines in the bundle.

The implementation makes a couple of assumptions that hold true for babel transform results, e.g. mappings being in the order of the generated code, and that a block of mappings always belongs to the same source file. In addition, the implementation avoids allocation of objects and strings at all costs. All calculations are purely numeric, and base64 vlq produces numeric ascii character codes. These are written to a preallocated buffer objects, which is turned to a string only at the end of the building process. This implementation is ~5x faster than using the source-map library.

In addition to providing development source maps that work better, we can now also produce individual high-quality source maps for production builds and combine them to an “index source map”. This approach is unfeasable for development source maps, because index source map consistently crash Chrome.

Better production source maps are useful to get precise information about source location and symbol names when symbolicating stack traces from crashes in production.

Reviewed By: jeanlauliac

Differential Revision: D4382290

fbshipit-source-id: 365a176fa142729d0a4cef43edeb81084361e54d
2017-01-12 14:28:41 -08:00
Jean Lauliac d12d0b4c53 packager: do not try to fetch uncached files
Reviewed By: davidaurelio

Differential Revision: D4403623

fbshipit-source-id: 8319e6bac365fe5fcebefd4f338faf145f662ecb
2017-01-12 10:43:32 -08:00
David Aurelio 7ca5316562 High-perf source map builder
Summary:
Adds a high performance source map builder that has certain restrictions compared to the `'source-map'` package:

- mappings have to be in the order of the generated source
- source files have to be started/ended separately on the generator. That means building up mappings is optimized for blocks of mappings that all belong to the same source file (or no file)

The implementation avoids allocation of complex value, i.e. strings and objects as much as possible by preallocating a buffer and using numeric character values throughout. The buffer is converted to a string only at the end.

This implementation is ~5✕ faster than using `'source-map'`.

Reviewed By: jeanlauliac

Differential Revision: D4392260

fbshipit-source-id: 406381302d951b919243a2b15e8bb75981e9f979
2017-01-09 11:43:28 -08:00
Jean Lauliac e2a5bc1a35 packager: socket timeout for global cache
Reviewed By: davidaurelio

Differential Revision: D4393059

fbshipit-source-id: 23c0c9ab69388ffd6de136d07728d44d1d8a947a
2017-01-09 11:13:32 -08:00
Jean Lauliac 4f60ac40fc packager: disable global cache stdout
Reviewed By: davidaurelio

Differential Revision: D4392486

fbshipit-source-id: bc1c33c781335b4af2d735596bbcdf7520312777
2017-01-09 10:13:33 -08:00
Jean Lauliac ff50420b0f packager: create the reporter higher in the stack
Reviewed By: davidaurelio

Differential Revision: D4392283

fbshipit-source-id: 4cd470ca0cbddcbb515407b5249272a758849b82
2017-01-09 10:13:33 -08:00
Jean Lauliac 8f87ab648c packager: remove validateOpts for Bundler class
Reviewed By: davidaurelio, cpojer

Differential Revision: D4380831

fbshipit-source-id: e3b5b2c39e83bf0b49028820e0f17daef27d7b3c
2017-01-06 06:13:54 -08:00
Jean Lauliac 446995306a packager: remove validateOpts for Server class
Summary: Remove the validateOpts() that prevents full Flow typing. In turn, having full Flow typing will allow us to remove 'defaults' across the codebase, that are source of inconsistencies.

Reviewed By: davidaurelio, cpojer

Differential Revision: D4377823

fbshipit-source-id: 8bb0a6b5069de64a9bb9d63892cd08854da91777
2017-01-06 06:13:54 -08:00
Jean Lauliac 207776107d packager: enable @flow in react-packager/index.js
Reviewed By: cpojer

Differential Revision: D4377411

fbshipit-source-id: 300d239d8e2818f0488549feafc98fd3451e452d
2017-01-06 06:13:54 -08:00
Jean Lauliac 28f1c67ced packager: centralize babelRegisterOnly callsites
Reviewed By: davidaurelio

Differential Revision: D4380987

fbshipit-source-id: db34e56b2025fb072798ef2cc3e52f3d1cb7c33c
2017-01-06 06:13:54 -08:00
Chris Hopman da59258372 Add --sourcemap-sources-root to RN packager
Reviewed By: davidaurelio

Differential Revision: D4357122

fbshipit-source-id: dc19474aa54ea4684a6b1c586a9d1e5da0980327
2017-01-04 20:58:33 -08:00
David Aurelio 78118d5023 Revamp debug logging
Summary:
- Switch namespace prefix from `ReactNativePackager:` to `RNP:`
- Add logging for handled requests
- Log transform cache key
- Add logging for transform cache hits/misses

Reviewed By: jeanlauliac

Differential Revision: D4377867

fbshipit-source-id: 9ec2060432f8c5e68561d3fe8ec7127f76c4a081
2017-01-04 07:13:32 -08:00
David Aurelio ea752b9655 Use `version` from `packager/package.json` for cache key
Reviewed By: jeanlauliac

Differential Revision: D4380910

fbshipit-source-id: 25d980bdf46046c3d53a4b2e120fd86a5534af6a
2017-01-04 06:58:35 -08:00
Jean Lauliac d54f702532 packager: enable @flow in node-haste types.js
Reviewed By: cpojer

Differential Revision: D4377132

fbshipit-source-id: 5a1c0fb34c85974135c326065fd0c54f44282286
2017-01-04 05:28:42 -08:00
Jean Lauliac 26a8da898d packager: AssetModule: @flow
Reviewed By: cpojer

Differential Revision: D4377137

fbshipit-source-id: 991619c0a42319a3bb4bf28dab4dd0fe1a474def
2017-01-03 09:58:35 -08:00
Jhen 2249af16b7 Fix the `path.sep` replacement of node-haste for Windows
Summary:
Fix the `path.sep` replacement for Windows, currently it just replace one segment:

```js
// Result: './lib/random\random-byte.js'
'./lib\\random\\random-byte.js'.replace(path.sep, '/')
```

Change to regex will work fine:

```js
// Result: './lib/random/random-byte.js' (correct)
'./lib\\random\\random-byte.js'.replace(new RegExp('\\' + path.sep, 'g'), '/')
```
Closes https://github.com/facebook/react-native/pull/11641

Differential Revision: D4368402

fbshipit-source-id: 46f456359d1cd2ca790881773e8a76af8616cd21
2016-12-27 14:43:32 -08:00
Chris Hopman a8affb838d make the RN packager output more deterministic
Reviewed By: davidaurelio

Differential Revision: D4357109

fbshipit-source-id: bc9ef04d81223299fe7708aeb0fe654647330ab7
2016-12-22 15:58:30 -08:00