413 Commits

Author SHA1 Message Date
Amjad Masad
d87480e9ac [react-pacakger] Fix failing test
Summary:
Fix failing test that matches the exact error string to match using `contains`.

I was under the impression that jest tests were running in CI -- turns out not yet.
2015-08-31 12:42:29 -08:00
James Ide
81c2216d82 [RN Debugger] Don't try to handle messages without a method
Summary:
Some messages are special and are intended for the devtools, like `{$open: id}` and `{$error: id}`. The main debugger-ui page can't handle these and thinks something is wrong when `object.method` is undefined. This diff handles messages only if they specify a method.

Fixes #2377

Closes https://github.com/facebook/react-native/pull/2405
Github Author: James Ide <ide@jameside.com>
2015-08-31 11:09:57 -08:00
Amjad Masad
250494acd3 [react-packager] Fail loudly with errors from the transformer 2015-08-31 09:27:26 -08:00
Martín Bigio
7fed668841 [react-packager] Cache BundlesLayout 2015-08-31 07:13:35 -08:00
Martín Bigio
5dbde93ec6 [react-packager] System.import transform 2015-08-27 09:28:48 -08:00
Amjad Masad
34b5aa2a57 [react-packager] Fix races
Summary:
A few potential races to fix:

1. Multiple clients maybe racing to delete a zombie socket
2. Servers who should die because other servers are already listening are taking the socket with them (move `process.on('exit'` code to after the server is listening
3. Servers which are redundant should immediatly die
2015-08-27 01:41:11 -08:00
Amjad Masad
1598cc6979 [react-packager] bump create server timeout to 60s 2015-08-26 23:11:44 -08:00
Alex Kotliarskyi
c7b1509615 [react-native] Fix tests and re-enable CI 2015-08-26 20:58:24 -08:00
Martín Bigio
ac5c1e9cc4 [react-packager] Make sure server is listening on socket 2015-08-26 16:25:17 -08:00
Martin Konicek
5526533f51 Updates from Wed 26 Aug 2015-08-26 14:04:01 +01:00
Felix Oghină
626f828d54 [reactnative] remove platform option from oss packager 2015-08-26 04:49:41 -08:00
Amjad Masad
074069e465 [react-packager] Cleanup socket interface code 2015-08-25 17:36:08 -08:00
Amjad Masad
2b7dd4650f [react-native] bump create server timeout 2015-08-25 17:13:13 -08:00
Martin Konicek
0203f87ea3 Add chalk mock 2015-08-25 22:02:19 +01:00
Martin Konicek
da7ac11c53 Updates from Tue 25 Aug 2015-08-25 19:21:59 +01:00
Martin Konicek
4f87ec5ce7 [ReactNative] Unbreak OSS packager JS tests 2015-08-25 10:18:39 -08:00
Natansh Verma
8d65367fbc Revert "[packager] Unbreak Bundler test" 2015-08-25 09:53:45 -08:00
Amjad Masad
54026024cc [react-packager] Expose a socket interface
Summary:
Buck (our build system) currently starts multiple packager instances for each target and may build multiple targets in parallel. This means we're paying startup costs and are duplicating the work. This enables us to start one instance of the packager and connect to it via socket to do all the work that needs to be done.

The way this is structured:

1. SocketServer: A server that listens on a socket path that is generated based on the server options
2. SocketClient: Interfaces with the server and exposes the operations that we support as methods
3. SocketInterface: Integration point and responsible for forking off the server
2015-08-25 09:37:08 -08:00
Martin Konicek
245a5b8e8c [packager] Unbreak Bundler test 2015-08-25 09:24:42 -08:00
Krzysztof Magiera
27a67c2434 [ReactNative] Respect --assets-dest in "download from server" mode 2015-08-25 07:22:05 -08:00
Jing Chen
a57353b2b4 [react-native] Make flow warn on timeout instead of redbox 2015-08-24 19:51:14 -08:00
Martín Bigio
9ba4697f02 [react-packager] Fix OSS tests 2015-08-24 18:49:05 -08:00
Amjad Masad
eb248e0b58 [react-packager] Implement transformer progress bar
Summary:
The transform step in currently the longest one in the bundling process. This adds a progress bar to track the transform progress.

{F23096660}
2015-08-24 16:09:34 -08:00
Christopher Chedeau
f3a165db4f [Logs] Name fs step
Summary:
There are two fs steps and it wasn't clear why. This now puts the right label:

```
[9:38:25 PM] <START> Building in-memory fs for JavaScript
[9:38:27 PM] <END>   Building in-memory fs for JavaScript (2030ms)
[9:38:27 PM] <START> Building in-memory fs for Assets
[9:38:27 PM] <END>   Building in-memory fs for Assets (615ms)
```
2015-08-21 14:29:05 -07:00
Alex Kotliarskyi
8d07df4a22 [ReactNative] Unbreak debugger 2015-08-21 11:20:17 -07:00
Martin Bigio
677f96c60e [react-packager] unbreak tests 2015-08-21 09:38:37 -07:00
Martín Bigio
320a9207f4 [react-packager] Avoid referring Module like objects in BundlesLayout
Summary:
The `BundlesLayout` will be used as a persistent index. As such, it would be easier to avoid having dependencies to `Module`, `Package`, `Asset`, etc. We're not using that information for now and if we happen to need to use it we could always fetch it using the `ModuleCache`.
2015-08-21 08:13:58 -07:00
Martín Bigio
d2f82b1dfd [react-packager] Move async dependencies to System.import
Summary:
We've decided to move the syntax for asynchronously requiring async dependencies. The new syntax works better with promises and therefore withe async/await as well. The new syntax looks like this: `System.import('moduleA').then(moduleA => {...});` or if you're using async/await you could simply do:
  let moduleA = await System.import('moduleA');
  new moduleA().someFunction();

If you need to require multiple dependencies just do:
  Promise
    .all([System.import('moduleA'), System.import('moduleB')])
    .then((moduleA, moduleB) => {...})

or the equivalent using async/await
2015-08-21 07:56:19 -07:00
Harrison Harnisch
46c6cde947 UI CPU and memory utilization graphs in Chrome debugging mode
Summary:
Chrome debugging UI is currently only showing connection state and logs in the console, leaving room for plenty of interesting information.

I've pushed the UI (using the same convention set by FPS -- UI/JS) CPU and memory utilization data over the debug Websocket and tapped into the existing stream of JS calls that get ran in V8.

The number of JS calls in a time interval is counted for all sub calls in a batch
https://github.com/hharnisc/react-native/blob/master/packager/debugger.html#L150

The last 5 batches of JS calls are displayed in a list format.

<img width="951" alt="screen shot 2015-07-19 at 7 34 00 pm" src="https://cloud.githubusercontent.com/assets/1388079/8769257/edc42f70-2e4d-11e5-8813-e86ef530a446.png">

Charts are created with [Chart.JS](https://github.com/nnnick/Chart.js) (MIT licensed).
Closes https://github.com/facebook/react-native/pull/2050
Github Author: Harrison Harnisch <hharnisc@gmail.com>
2015-08-21 02:11:45 -07:00
Amjad Masad
6debfce374 [react-native] Update graceful-fs and use it in _build_bundle.js 2015-08-20 23:58:51 -07:00
Amjad Masad
3bfa90e433 [react-packager] Fix error in template string and bump timeout
Summary:
Fix error in the template string (no plus, thinks it's a function).
And bump the timeout to 30 seconds because a file is taking more than 10 seconds `js/RKJSModules/Libraries/FBComponents/FBFed/FeedStoryFragments.js`
2015-08-20 15:29:38 -07:00
Christopher Chedeau
febc03a38b [Logs] Don't print flow error twice
Summary:
Flow errors are already throwing an exception in js, no need to also console.error in the packager
2015-08-20 14:05:47 -07:00
Martín Bigio
c1f90c1ecf [react-packager] Integration test for runServerHere.sh 2015-08-20 12:00:06 -07:00
Martín Bigio
5de0796126 [react-packager] Introduce bundle IDs and keep track of parent/child
Summary:
Since JS doesn't have the guarantee that once a bundle is loaded it will stay in memory (and this is something we actually don't want to enforce to keep memmory usage low), we need to keep track of parent/child relationships on the packager to pass it down to native. As part of this diff, we also introduced an ID for each bundle. The ID for a child bundle is shynthetized as the bundleID of the parent module + an index which gets incremented every time a new bundle is created. For instance given this tree:

       a,b
    c       f
  d   e       g

the ID for `d` will be `bundle.0.1.2`, the one for e will be `bundle.0.1.3` and the one for `g` will be `bundle.0.5.6`. This information will be useful to figure out which bundles need to be loaded when a `require.ensure` is re-written.
2015-08-20 10:19:09 -07:00
Amjad Masad
ec82ffa52b [react-packger] Add a timeout on transform jobs
Summary:
There's been a case where Babel can hang indefinitely on a file parse/transform. Possibly related to https://github.com/babel/babel/issues/2211

This adds a timeout to transform jobs and throws an error informing the user of the offending file. The timeout interval defaults to 10 seconds, but can be changed via an option.
2015-08-19 17:42:28 -07:00
Amjad Masad
24689006ab [react-packager] Remove unnecessary 'chalk' module mock 2015-08-19 17:28:18 -07:00
Amjad Masad
e76e60f88d [react-packager] Make the fs mock async 2015-08-19 17:17:15 -07:00
Amjad Masad
b4100b8332 [react-packager] Wait for haste map before accepting any requests
Summary:
D2319999 introduced a regression where we stopped waiting for the "build haste map" step to finish before we accept any requests. This makes sure that we block on that.

Need to unbreak with this, but will follow up with a test to catch this in the future.
2015-08-19 16:17:37 -07:00
Tim Yung
966a3bbc66 RN: Style Tweaks to Chrome Debugger UI 2015-08-19 16:00:03 -07:00
Martín Bigio
f4c7bb1103 [react-packager] Fix bug on Bundles Layout algorithm
Summary:
The layout algorithm wasn't getting deep into the sync dependencies recursively to async dependencies.
2015-08-19 14:20:38 -07:00
Alex Kotliarskyi
b18d73b568 [RN] Unbreak packager 2015-08-18 18:29:32 -07:00
Martín Bigio
291c8ff9ec [react-packager] Modernize Activity to ES6 2015-08-18 15:25:18 -07:00
Martín Bigio
51596f8674 [react-packager] Modernize AssetServer to ES6 2015-08-18 14:38:40 -07:00
Ben Alpert
65692b7235 [ReactNative] Don't redbox for React warnings when not using Chrome executor 2015-08-17 16:02:10 -07:00
Felix Oghină
f0dd9fb358 Merge pull request #2298 from foghina/yo
[cli] convert project generation to use yeoman
2015-08-17 13:51:24 +01:00
Ludo Fardel
8460db57bc Make flow check async 2015-08-17 03:13:16 -07:00
Amjad Masad
ca38908423 [react-packager] In production resolve __DEV__ to NODE_ENV === 'development' 2015-08-15 17:07:41 -07:00
Amjad Masad
3388d8fe79 [reat-packager] Switch platform resolution based on query param
Summary:
Currently the platform selection is controlled by the blacklist. However, since we want to use the same server instance for cross-platform development, we need this to be controlled per request.

One outstanding issue, is that the DependencyGraph class wasn't designed that way and it doesn't have a per-request state. This means that with the current design race conditions is possible. If we got a request for a different platfrom while processing the previous request, we may change the outcome of the previous request.

To fix this a larger refactor is needed. I'll follow up a diff to do that.

Finally, so I don't break the universe like last time, I'll leave it up to the RN guys to update the call sites.
2015-08-15 13:28:18 -07:00
Amjad Masad
9eb5151bd2 [react-native] Set NODE_ENV and use node-env-inline plugin
Summary:
This sets NODE_ENV based on the value of the `dev` option when bundling the apps. This would then be inlined by the node-env-inline babel plugin. And finally -- if unreachable -- will be dead-code-eliminated by uglify.

This is not used in development because we set NODE_ENV to the value of __DEV__, which can be switched via a query param. However, the plugin has minimal overhead and to avoid complexity in the transformers I just enabled it by default.
2015-08-15 13:25:09 -07:00
Alex Kotliarskyi
324d154cf7 [ReactNative] Add ability to listen for Packager events 2015-08-14 14:28:45 -08:00