Commit Graph

595 Commits

Author SHA1 Message Date
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
Martín Bigio 3be2b1d966 [react-packager] Modernize `Server` to ES6 2015-08-14 12:34:23 -08:00
Martín Bigio 0623371814 [react-packager] Cache in which bundle is each module
Summary:
Not that at the moment a module can be present in multiple bundles, so the new API will return only one of them. In the near future we'll impose the invariant that a module can only be present in a single bundle so this API will return the exact bundle in which it is.
2015-08-14 12:30:30 -08:00
Martín Bigio 76e37c4423 [react-packager] Modernize `Server-test` by using ES6 features 2015-08-14 12:23:02 -08:00
Amjad Masad bc28a35bda [react-packager] Use module objects across the codebase (rid of getPlainObject etc)
Summary:
Instead of using plain objects and having to convert to and from them we just use the `Module` class across the codebase.
This seems cleaner and can enforce the type as opposed to fuzzy objects.
2015-08-13 15:52:31 -08:00
Amjad Masad abce124198 [react-packager] Remove horribly outdated example_project
Summary:
Removes some old unused code.
2015-08-13 13:02:52 -08:00
Martín Bigio 5cad2e9370 [react-packager] Introduce Bundler
Summary:
Introduce a Bundler capable of generating the layout of modules for a given entry point. The current algorithm is the most trivial we could come up with: (1)it puts all the sync dependencies into the same bundle and (2) each group of async  dependencies with all their dependencies into a separate bundle. For async dependencies we do this recursivelly, meaning that async dependencies could have async dependencies which will end up on separate bundles as well.

The output of of the layout is an array of bundles. Each bundle is just an array for now with the dependencies in the order the requires where processed. Using this information we should be able to generate the actual bundles by using the `/path/to/entry/point.bundle` endpoint. We might change the structure of this json in the future, for instance to account for parent/child bundles relationships.

The next step will be to improve this algorithm to avoid repeating quite a bit dependencies across bundles.
2015-08-13 12:57:55 -08:00
Amjad Masad 7750db05e6 [react-packager] Set a lifetime on workers to avoid memory leaks 2015-08-12 19:26:26 -08:00
Martín Bigio cfcf604b3d [react-packager] Introduce `require.ensure`
Summary:
This is the first step to add support for splitting the JS bundle into multiple ones. This diff adds support for keeping track of the async dependencies each module has. To do so we introduce the following syntax:

  require.ensure(['dep1', 'dep2, ..., 'depN'], callback);

Where the callback function is asynchronously invoked once all the indicated modules are loaded.

Internally, the packager keeps track of every set of async dependencies a module has. So for instance if a module looks like this:
  require.ensure(['dep1'], () => {...});
  require.ensure(['dep2'], () => {...});

the `Module` object will keep track of each set of dependencies separately (because we might want to put them on separate bundles).
2015-08-12 12:23:42 -08:00
Amjad Masad 309326db2e [react-packager] Rename 'Package' to 'Bundle'
Summary:
The word Package is overloaded, it may mean npm package, or may mean a collection of bundles. Neither is what we mean. We mean `bundle`.

This renames it and modernize some of the Bundler code.
2015-08-12 12:09:01 -08:00
Felix Oghină f83675d191 [cli] convert project generation to use yeoman 2015-08-12 12:04:27 +01:00
Martín Bigio 70624dc347 [react-packager] Fix Cache-test 2015-08-11 11:27:15 -08:00
Christopher Chedeau 5ebe0ed717 Bust jest caching and fix tests 2015-08-11 11:02:19 -07:00
Christopher Chedeau 0d636a017d Updates from Tue 11 Aug 2015-08-11 08:42:07 -07:00
Evan Solomon 51ccdfa36a [Babel] Upgrade babel and regenerator to the latest version
Summary:
See c0fd4c1f9e
Closes https://github.com/facebook/react-native/pull/1753
Github Author: Evan Solomon <evan@evanalyze.com>

@allow-crlf-text
2015-08-10 20:37:39 -08:00
Martín Bigio a303a42e28 [react-packager] Add more granular Activity logging 2015-08-10 16:25:04 -08:00
Martín Bigio 2afeb8fbe6 [react-packager] Promote Cache to top level
Summary:
The cache is only used for JSTransformer at the moment. We're doing IO and some computation to get each module's name, whether is a haste or node module and it's dependencies. This work happens on startup so by caching this value we shouldbe able to reduce the start up time. Lets promote the Cache to the Packager level to be able to use it by any of the components of the packager. For now, on this diff we'll start using it to cache the mentioned fields.

Also we had to introduce the concept of fields in the cache as manually merging the date we had for each path is not possible as we're using promisses all around. With the new API, each field is a promise.

@amasad and I did some manual testing to measure the impact of this change and looks like it's saves 1 second when building the haste map (which represents 50% of the time). Overall this reduces 1 second of start up time which was currently about 8s on my mac book pro.
2015-08-10 16:25:03 -08:00
Jacob Turner 5b5cadeb30 Grammar 2015-08-10 14:34:27 +01:00
Alex Kotliarskyi e21fb91786 [ReactNative] Show banner promoting DevTools
Summary:
When React DevTools is not installed, React prints a tiny warning to the console.
However, in debugger.html we have a lot of free space we could use to promote
React DevTools more actively.
2015-08-07 15:23:22 -08:00
Martín Bigio aefdf82cdc [JSAppServer] Don't keep track of not found packages 2015-08-06 11:34:56 -08:00
Thomas Aylott a6ff11f1d2 [react-packager] Fixes stack traces
Summary:
TransformErrors weren't showing stack traces, making it hard to debug problems in transformer code.
2015-08-05 12:46:30 -08:00
James Ide 47e1d1aef8 [Async] Enable async/await and update UIExplorer and tests
Summary:
- Enables async/await in .babelrc and transformer.js
- Adds regenerator to package.json. Users still need to explicitly require the regenerator runtime -- this is so that you only pay for what you use.
- Update AsyncStorage examples in UIExplorer to use async/await
- Update promise tests in UIExplorer to use async/await in addition to the promise API

Closes https://github.com/facebook/react-native/pull/1765
Github Author: James Ide <ide@jameside.com>
2015-08-04 05:35:13 -08:00
Amjad Masad 18452940f0 [react-packager] Add support for platform in the resolver
Summary:
Teach the resolver about platform-based resolution. The platform extension is inferred from the entry point.
It works for haste modules, as well as node-based resolution.
2015-08-03 18:29:20 -08:00
Felix Oghina 90b80e375c [reactnative] add launchAndroidPackager.command 2015-07-30 03:35:29 -08:00
Ben Alpert e0ea046092 [ReactNative] Fix ResponderEventPlugin after React upgrade 2015-07-29 02:47:55 -08:00
Alex Kotliarskyi 2eb401a496 Updates from 2015-07-27 2015-07-27 10:01:30 -07:00
James Ide 53222f0dda [Packager] Include Content-Type headers with bundle and source maps
Summary:
The packager did not send back the Content-Type headers. Adding these.

Closes https://github.com/facebook/react-native/pull/2029
Github Author: James Ide <ide@jameside.com>
2015-07-24 18:46:17 -08:00
Ben Alpert e01f90784f [ReactNative] Update core RN modules to work with React 0.14-beta1 2015-07-23 18:07:59 -08:00
Jared Forsyth 9e4af68d91 [react-native] enable react devtools from JavascriptCore 2015-07-23 17:14:09 -08:00
Alex Kotliarskyi 03dccfbf71 Updates from Thu, July 23 2015-07-23 13:09:48 -07:00
Daniel Brockman 064dafa618 #!/bin/bash => #!/usr/bin/env bash
Summary:
This change makes `npm start` work correctly on e.g. NixOS.
Closes https://github.com/facebook/react-native/pull/2006
Github Author: Daniel Brockman <daniel@brockman.se>
2015-07-23 11:17:22 -08:00
Spencer Ahrens 4a5f12aa29 Updates from Fri July 17th 2015-07-17 14:14:30 +02:00
Sean Powell fa4c570d33 Support debugger reconnection when the packager goes down.
Summary:
This should resolve the issue highlighted in #1709
Closes https://github.com/facebook/react-native/pull/1992
Github Author: Sean Powell <sean@longdivision.co.uk>
2015-07-16 13:32:01 -08:00
Spencer Ahrens 902ffbbfb8 Updates from Wed July 15th 2015-07-15 19:05:08 +02:00
Dave Sibiski 70feab9d50 [Packager] Fix when loading a path that can't be handled
Summary:
[Packager] Adds `NotFoundError` when loading a path that can't be handled

Resolves https://github.com/facebook/react-native/issues/1944
Closes https://github.com/facebook/react-native/pull/1948
Github Author: Dave Sibiski <dsibiski@gmail.com>
2015-07-15 08:25:31 -08:00
Nick Lockwood 7fa08e5c3f Updates for Fri 10 Jul 2015-07-10 17:48:12 +01:00
James Ide 40a043109d [io.js] Print a warning message if the user is not on io.js 2.x
Summary:
Detects if the user is on Node or io.js 1.x and prints a banner explaining how to upgrade. We probably should link to more detailed upgrade docs so this is just a start.

I also added a function to format banners that is kind of useful.

Addresses part of #1737

![packager-banner](https://cloud.githubusercontent.com/assets/379606/8447050/ad615402-1f67-11e5-8c02-ece5f7488135.png)

Closes https://github.com/facebook/react-native/pull/1824
Github Author: James Ide <ide@jameside.com>
2015-07-10 00:32:46 -08:00
Alexsander Akers 13be9454cc Update with test fixes 2015-07-02 11:19:17 +01:00
Amjad Masad b45e2ed7ed [react-packager] fix test 2015-07-01 17:37:51 -08:00
Alexsander Akers d161640f52 Update with required PRs 2015-07-01 22:05:10 +01:00
James Ide 5aa27586f0 [Tests] Update tests to run on io.js with the latest version of jest
Summary:
[This is a preview diff for getting RN's tests to pass with a future version of jest that supports io.js and other future versions of Node. This can be merged once the diff to update jest is merged upstream and published.]

Updates the tests in small ways so they run on io.js with two updates:

 - The Cache test which relies on Promises uses `runAllImmediates` for modern versions of Node because bluebird uses `setImmediate` instead of `process.nextTick` for Node >0.10.

Closes https://github.com/facebook/react-native/pull/1382
Github Author: James Ide <ide@jameside.com>

Test Plan:  Run `npm test` with the latest version of jest.
2015-07-01 13:02:29 -08:00
Alexsander Akers 44c587e828 Updates from Wed 1 Jul 2015-07-01 19:10:35 +01:00
Amjad Masad 7d184adf1a [react-packager] Use latest babel-core in place of babel (40% perf improvement) 2015-06-30 03:55:21 -08:00
Dmitry Soshnikov 555236865b [react-native][jest] Sync to 0.5.x and update to io.js 2015-06-29 20:36:34 -08:00
Amjad Masad 73b032ab87 [react-packager] Update sane to get a new version of fb-watchman (perf) 2015-06-26 17:48:39 -08:00
Joe Wood 19e32399b0 [Packager] Windows support for Packager - Blacklist changes
Summary:
Another Pull Request implementing the changes in issue #468 - Enabled Packager to run on Windows
This change relates to the blacklist fixes. It includes the path conversion for blacklist and changes to the default watched directory.  It has no impact on Mac OSX.
Closes https://github.com/facebook/react-native/pull/893
Github Author: Joe Wood <joewood>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-06-26 16:27:12 -08:00
Amjad Masad de020b44c9 [react-packager] Enable watchman fs crawl
Summary:
@public
Now that watchman perf issue was fixed we can enable watchman-based fs crawling which is faster than node.
This showed an existing issue with some files missing from the blacklist which I addressed.

Test Plan:
./fbrnios.sh run
click around and scroll all the apps
2015-06-26 16:20:50 -08:00
Johannes Lumpe 1461e4a17e [Packager] Allow user to specify a custom transformer file
Summary:
This is an edited re-submission of #1458 because I'm stupid.
Closes https://github.com/facebook/react-native/pull/1497
Github Author: Johannes Lumpe <johannes@johanneslumpe.de>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-06-26 16:00:37 -08:00
Alex Kotliarskyi cfe13f2c4e Updates Thu, 25 Jun 2015-06-25 09:37:02 -07:00
Amjad Masad 1109ce3b8c [react-packager] Injectible file crawlers (2x crawl speedup) 2015-06-24 18:04:57 -08:00
Jing Chen c157051da7 [events] Add JS require time and fix up some existing logs 2015-06-24 16:59:00 -08:00
Alex Kotliarskyi d269ae3e9b More updates from Wed, 24 Jun 2015-06-24 16:24:42 -07:00
Amjad Masad 4ac5c7e19e [react-packager] Fix the confused node_modules detection function
Summary:
@public

We have a function that detects whether a give file is to be treated as a node_modules. If so it doesn't have access to the haste module map. There is an exception to this rule which is a few modules that are allowed to do that. Currently thats react-native, react-tools, and parse.

The current implementation had a bug where if you had `react-native` (or react-tools etc) in the name before the actual package root then the detection will be off. This fixes the problem by starting from the `lastIndexOf('node_modules')` directory, that way nothing confuses us.

Test Plan:
./runJestTests.sh
export OSS, patch, run e2e test
2015-06-24 15:20:35 -08:00
Alex Kotliarskyi 0898bb427f Second part of updates from Wed 24 Jun 2015-06-24 15:56:31 -07:00
Christopher Chedeau eb9c7235e2 [ReactNative] Bring in node console.log formatting
Summary:
@public

The current output of console.log is extremely bad. If you pass NaN, it shows up as null (super confusing I know -_-), if you pass a cyclical object, it just says that it is cyclic and that's it. It doesn't print up the first few levels which are NOT cyclical and would be really helpful.

It turns out that nodejs console.log pretty printer is really awesome and can be easily extracted as a few hundred lines. This is going to be such a productivity boost that I think it's the right tradeoff to embed it like this

Test Plan:
```
var a = {kikoo: {lol: 1}}
a.kikoo.nice = a;

console.log(a);
> { kikoo: { lol: 1, nice: [Circular] } }

console.log(NaN)
> NaN
```
2015-06-24 14:11:55 -08:00
Alex Kotliarskyi 2e4cbc41b0 Updates from Wed 24 Jun 2015-06-24 10:49:09 -07:00
Alex Kotliarskyi b309e9b50e Enable react.displayName transform
Fixes #1715
2015-06-22 16:38:52 -07:00
Philipp von Weitershausen a8011f283d [React Native][Packager] allow --assetRoots to be relative paths 2015-06-22 12:58:04 -08:00
Forbes Lindesay fccea2f365 Replace bluebird with promise 2015-06-22 08:44:03 -08:00
Jarek Potiuk 2cb0546d15 Added support for React installed in the application via Cocoapods
Summary:
Similarly to npm-installed react, this change makes changes to the packager so that it understands that it's been installed via Cocoapods and determines the project and asset roots properly (from the main application directory).
Closes https://github.com/facebook/react-native/pull/1568
Github Author: Jarek Potiuk <jarek@potiuk.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-06-22 03:15:31 -08:00
Bill Fisher 5aee4cec98 [ReactNative][easy] fix server 500 response typo
Summary:
@public
corrected small typo in the 500 response from the packager server

Test Plan: add throw to promise function prior to error handler, run packager, cache a bundle with bundle extension URI, open /debug/packages, see clean 500 error
2015-06-20 16:43:18 -08:00
Amjad Masad 2845e78080 [react-packager] Cache in-memory file lookups (~200ms win on file change) 2015-06-19 22:47:26 -08:00
Amjad Masad 2d4055e513 [react-packager] Rewrite dependency graph (support node_modules, speed, fix bugs etc)
Summary:
@public
Fixes #773, #1055
The resolver was getting a bit unwieldy because a lot has changed since the initial writing (porting node-haste).
This also splits up a large complex file into the following:

* Makes use of classes: Module, AssetModule, Package, and AssetModule_DEPRECATED (`image!` modules)
* DependencyGraph is lazy for everything that isn't haste modules and packages (need to read ahead of time)
* Lazy makes it fast, easier to reason about, and easier to add new loaders
* Has a centralized filesystem wrapper: fast-fs (ffs)
* ffs is async and lazy for any read operation and sync for directory/file lookup which makes it fast
* we can easily drop in different adapters for ffs to be able to build up the tree: watchman, git ls-files, etc
* use es6 for classes and easier to read promise-based code

Follow up diffs will include:
* Using new types (Module, AssetModule etc) in the rest of the codebase (currently we convert to plain object which is a bit of a hack)
* using watchman to build up the fs
* some caching at the object creation level (we are recreating Modules and Packages many times, we can cache them)
* A plugin system for loaders (e.g. @tadeuzagallo wants to add a native module loader)

Test Plan:
* ./runJestTests.sh react-packager
* ./runJestTests.sh PackagerIntegration
* Export open source and run the e2e test
* reset cache
* ./fbrnios.sh run and click around
2015-06-19 18:05:18 -08:00
Amjad Masad 0fec355076 [react-packager] Cache based on options, not url
Summary:
@public

We cached based on url, which wasn't unique becuase some options would be defaulted. This was obvious when starting the server via fbrnios which tries to warmup the bundle.
And then when the device woke up it will send a request (that is identical in reality) but would miss the cache.

This changes the cache key into a JSON stringification of the options.

Test Plan:
* ./runJestTests.sh
* ./fbrnios.sh run
2015-06-19 15:14:31 -08:00
Alex Kotliarskyi 4d97c01f4b [ReactNative] Don't activate Chrome when debugger is already open
Summary:
Before this diff every time you reload in debug mode Chrome window
is actiavated. Looks like that behaviour is pretty annoying.

Fixes #689

@public

Test Plan:
```
$ ./packager/launchChromeDevTools.applescript 'https://www.facebook.com/'
```

First time it opens a new tab and activates Chrome, running this again does
not activate Chrome if the tab already exists.
2015-06-19 13:26:29 -08:00
Amjad Masad 9998337220 [react-packager] Add tests to ensure we return all dependency types 2015-06-18 21:27:55 -08:00
Tadeu Zagallo 92d98533f1 [ReactNative] Refactor BatchedBridge and MessageQueue
Summary:
@public

The current implementation of `MessageQueue` is huge, over-complicated and spread
across `MethodQueue`, `MethodQueueMixin`, `BatchedBridge` and `BatchedBridgeFactory`

Refactored in a simpler way, were it's just a `MessageQueue` class and `BatchedBridge`
is only an instance of it.

Test Plan:
I had to make some updates to the tests, but no real update to the native side.
There's also tests covering the `remoteAsync` methods, and more integration tests for UIExplorer.
Verified whats being used by Android, and it should be safe, also tests Android tests have been pretty reliable.

Manually testing: Create a big hierarchy, like `<ListView>` example. Use the `TimerMixin` example to generate multiple calls.
Test the failure callback on the `Geolocation` example.

All the calls go through this entry point, so it's hard to miss if it's broken.
2015-06-17 07:49:33 -08:00
Amjad Masad 477360b8c9 [react-packager] Make it safe to include files without a newline at the end
Summary:
@public
Fixes #1431
Fixes #1005
Files with no newlines and a comment at the end of the file would've caused a syntax error in the bundle:

```js
__d('module', function() {
hi();
// wow })
```

This fixes the issue by inserting a new lines before `})`.

Test Plan:
* ./runJestTests.sh
* ./runJestTests.sh PackagerIntegration
* open app to the playground app
* add an error
* observe that the redbox has the correct lines
2015-06-16 12:02:49 -08:00
Tadeu Zagallo 8d6d0ec4a4 [ReactNative] Revert packager ignoring node_modules 2015-06-12 14:04:27 -07:00
Tadeu Zagallo ae9e4089fc [ReactNative] Revert packager ignoring node_modules 2015-06-11 10:45:32 -08:00
Spencer Ahrens 6c6b8bec7e [ReactNative] Fix require-time redboxes 2015-06-09 15:42:47 -08:00
Eric Vicenti f90fa53df9 Revert [react-packager] Add support for nested node_modules 2015-06-05 08:44:06 -08:00
Amjad Masad 30fc7389d1 [react-packager] Fix more node_modules resolution rules
Summary:
@public
Fixes #773
This fixes `.json` name resolution. And also reads `package.json` when doing a directory module resolution.
The algorithm can be found here: https://nodejs.org/api/modules.html
I'll probably start including the node (or browserify) modules test in later diffs to make sure we're fully compliant.

Test Plan:
* ./runJestTests.sh
* ./runJestTests.sh PackagerIntegration
* open playground and require a json file
* test redbox
2015-06-04 15:07:03 -08:00
Amjad Masad 856469a24b [react-packager] Support packages with '.' in the name
Summary:
@public
Fixes issue #1055
For some historical reason we used to strip the extension of the module name before passing it to `resolveDependency` which is completly capable of handling all kinds of names. The fix is one line, but added a few tests for this.

Test Plan:
* ./runJestTests.sh
* ./runJestTests.sh PacakgerIntegration
* Open app and click around
2015-06-03 14:07:31 -08:00
Amjad Masad 5a191dadfc [react-packager] Add support for nested node_modules
Summary:
@public
The packager's resolver started out imitating node-haste, which meant that we didn't support nested modules. Now this is a problem. Bigger projects are bound to have versions of different versions of the same package at different levels of the dependency tree. This
makes loading dependencies lazy for node_modules and implements the node resolution algorithm. However, it also mantains that some
modules are still "haste" format, which currently defaults to "react-native" and "react-tools".

Finally, this means ~5 seconds speed up on every server start. This should also have a big impact on open source users with projects with big node_modules.

Test Plan:
1- test the app with --reset-cache
2- click around test and production apps
3- update the OSS library
4- create a new project
5- npm install multiple modules
6- create some version conflict in your project
7- make sure we do the "right" thing
8- test file changes to make sure it works
2015-06-03 11:35:48 -08:00
Tyler McGinnis ca7a764c8c [Cosmetic] Fix typo in packager README
Summary:

Closes https://github.com/facebook/react-native/pull/693
Github Author: Tyler McGinnis <tylermcginnis33@gmail.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-06-03 10:57:01 -08:00
rickyc 78f83acdc2 Debugger won't start due to spaces in directory path
Summary:
Similar issue to #214. When I attempt to do command + D in the simulator, I get the following issue.

```
Launching Dev Tools...
Failed to run launchChromeDevTools.applescript { [Error: Command failed: /bin/sh -c /Users/ricky/Dropbox (Personal)/Sites/AwesomeProject/node_modules/react-native/packager/launchChromeDevTools.applescript http://localhost:8081/debugger-ui
/bin/sh: -c: line 0: syntax error near unexpected token `Personal'
/bin/sh: -c: line 0: `/Users/ricky/Dropbox (Personal)/Sites/AwesomeProject/node_modules/react-native/packager/launchChromeDevTools.applescript http://localhost:8081/debugger-ui'
]
  killed: false,
  code: 2,
  signal: null,
  cmd: '/bin/sh -c /Users/ricky/Dropbox (Personal)/Sites/AwesomeProject/node_modules/react-native/packager/launchChromeDevTools.applescript http://localhost:8081/debugger-ui' }

/bin/sh: -c: line 0: syntax error near unexpected token `Personal'
/bin/sh: -c: line 0: `/Users/ricky/Dropbox (Personal)/Sites/AwesomeProject/node_modules/react-native/packa
Closes https://github.com/facebook/react-native/pull/348
Github Author: rickyc <rickyc.us@gmail.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-06-02 15:13:55 -08:00
Tadeu Zagallo ebae151f24 [ReactNative] Update sane fork + FileWatcher config 2015-05-28 07:12:41 -08:00
Tadeu Zagallo 21b3304a95 [ReactNative] Add option to file watcher to ignore node_modules 2015-05-28 01:18:47 -08:00
James Ide 769efdfcef [Packager] Fix the --root, --assetRoots, and --platform options
Summary:
Looks like these options were handled as booleans when they should be handled as strings. Explicitly specify them as strings.

Closes https://github.com/facebook/react-native/pull/1377
Github Author: James Ide <ide@jameside.com>

Test Plan:
 `packager/packager.sh --root A --root B` works. Also tested `packager/packager.sh --root A,B`.
2015-05-26 14:19:22 -08:00
Amjad Masad 82a082a794 [react-packager] Introduce buildPackage API 2015-05-22 17:28:27 -08:00
Amjad Masad 56d6ee3f0f [react-native] Replace jstransform with Babel in the OSS repo
Summary:
@public
Replaces jstransform with Babel. Additionally, stops (using the deprecated) passing an error property
back from the transformer, and instead passes an error in the first argument. This is because we were
able to update node-worker-farm to handle custom properties on errors.

Test Plan:
1. Export the oss project
2. npm install
3. Start the movies app
4. Make sure it works
5. Add a syntax error
6. Make sure the message is correct
2015-05-22 12:16:11 -08:00
Amjad Masad bd11de1b51 [react-packager] Use actual error types
Summary:
@public
Previously, we had to use errors as a property on the result object because there was no way to pass custom props between
the child worker and the parent. This has been fixed in node-worker-farm (D2092153) and now we can use regular errors.
This also adapts the transformer to babel-specific errors. Generic errors, however, should still work and render readable
info.

Additionally, I deprecated, but maintained backwards compatiblity for people in OSS that are using custom transformers.

Test Plan:
1. `./runJestTests.sh`
2. `./runJestTests.sh PackagerIntegration`
3. open the playground app
4. Add a syntax error. Say `1=x` somewhere in the file
5. Reload and see error message 'SyntaxError <filename> description (line:col)'
6. Make sure that the stack trace is clickable and it attempts to open the editor to the location
2015-05-22 10:21:26 -08:00
Hedger Wang b46c94aaf9 Unbreak RN JS server for Android. 2015-05-20 18:38:34 -08:00
Amjad Masad 9a76f224af [react-packager] Add first class support to popular image formats
Summary:
@public
1. Default to first class support of popular image formats
2. Add tests to make sure we support other than png

Test Plan:
1. ./runJestTests.sh
2. Add test.png and test.jpg images in the Playground app dir
3. require both images and render then in the playground app
4. they render
2015-05-20 15:28:29 -08:00
Amjad Masad 8bb65215b1 [react-packager] Implement getJSModulePaths API 2015-05-20 13:38:46 -08:00
Alex Kotliarskyi 1b2975803b [ReactNative] Cleanup _build_bundle script 2015-05-20 10:31:28 -08:00
Amjad Masad 407d8d4cf6 [react-native] Update jest to get perf bugfix 2015-05-17 02:51:35 -08:00
Dmitry Soshnikov 545edba913 [jest] Update to v0.4.4 2015-05-17 00:20:42 -08:00
Amjad Masad 64c0bb0bd4 [react-native] Fix source map issue with virtual modules 2015-05-15 15:49:11 -08:00
Amjad Masad d9b7e63e47 [react-native] Use trailing commas transform
Summary:
@public
Apparently trailing commas transform isn't exported by react-tools. We need to pull it out manually. This is not so clean but we're swtching to babel very shortly.

Test Plan:
* npm start
* write `foo(a,b,c,)` in some file
* request that file in the browser and make sure that trailing comma is gone
2015-05-15 14:11:55 -08:00
Christopher Chedeau 766983f69b [react native] Bump jest-cli version to 0.4.3 in RN packages 2015-05-14 10:32:44 -08:00
Amjad Masad 9fde7d2828 [react-native] Make document.js into a polyfill. Fixes #1149
Summary:
@public
document shimming must run before anything else. However, we don't currently guarantee that. This moves the document shimming into `document.js` which is used as a polyfill.

Test Plan:
* start server
* go to playground app
* require `NativeModules` as the first thing
* open chrome debugger
* no error
2015-05-13 17:50:21 -08:00
Amjad Masad 5429b5f9cc [react-packager] Use transformer name in cache name
Summary:
@public
Shouldn't confuse the cache from files transformed by different transformers. This takes into account the transformer in the cache hash name.

Test Plan:
* start server with --babel
* generate bundle
* start server with --jstransform
* generate bundle
* compare them and they're different
2015-05-13 14:49:28 -08:00
Spencer Ahrens 81ad810186 [ReactNative] differentiate fatal and soft exceptions 2015-05-13 13:24:37 -07:00
Nick Lockwood 6b2c88feec decode pathName when extracting from url 2015-05-13 13:24:36 -07:00
Dmitry Soshnikov 792b2db23c [jest] Update to v0.4.2 2015-05-13 13:24:35 -07:00
Alex Kotliarskyi 320208f4f7 Updates from Fri 8 May 2015-05-08 10:29:59 -07:00
Alex Kotliarskyi c76fb40ec4 [ReactNative] Register assets with AssetRegistry 2015-05-07 17:27:42 -08:00
Alex Kotliarskyi cad5cdef42 Updates from Wed 6 May 2015-05-06 16:08:10 -07:00
Amjad Masad 7362f11c22 [react-packager] Use gracful-fs to avoid EMFILE errors
Summary:
@public
Currently, every time we call into the packager we have to change the ulimit to make sure
we don't hit the EMFILE error (the packager uses as much concurrency as possible).

Using graceful-fs, the fs module -- with monkey patching -- becomes intelligent enough to recover
from EMFILE errors.

Test Plan:
* set `ulimit -n 256*
* start server
* request from your browser: http://localhost:8081/RKJSModules/MainBundle/CatalystBundle.includeRequire.bundle
* it works
2015-05-05 14:30:43 -08:00
Evgen Filatov 57348a4028 Fixed name of Chome window, Connects to #297
Summary:
Hi!

I have the same problem as described here https://github.com/facebook/react-native/issues/297
It could occurs after restarting `packager.sh` or `debuger-ui` page.

I found simple solution that works for me, but I am not 100% sure it will works for any user with this problem.

How could this be tested automatically?
Closes https://github.com/facebook/react-native/pull/1101
Github Author: Evgen Filatov <evgen.filatov@gmail.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-05-05 14:10:13 -08:00
Alex Kotliarskyi 5df5602f1a Updates from Tue 5 May 2015-05-05 14:15:51 -07:00
Spencer Ahrens 66d2f600dd [ReactNative] improve console logging a little bit 2015-05-04 18:57:03 -08:00
Amjad Masad 43e038887d [react-packager] Combine source maps coming from transformer
Summary:
@public
Fixes [#393](https://github.com/facebook/react-native/issues/393). Currently the transformer assumes line-preserving compilers and defaults to a super-fast source map generation process. However, we need to support compilers that aren't preserving lines.
I had feared this wuold slow down the server but I came about a little known peace of the spec that defines an "indexed source map" just for the purpose of concating files: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit

Test Plan:
1. runJestTests.sh
2. run server and click around example apps
3. add a custom transporter like babel
4. add a custom file and a debugger statement
5. debug in chrome and make sure it works

redbox still works
2015-05-01 16:59:14 -08:00
Ben Alpert d8ab648fce Updates from Wed 29 Apr 2015-04-29 18:55:07 -07:00
Tim Yung 43e7e69841 JS: Use Object.defineProperty for Array Polyfills 2015-04-28 15:56:40 -08:00
Alex Kotliarskyi 282a2071ad [ReactNative] Bump watchman timeout to 25s 2015-04-27 19:30:02 -08:00
Spencer Ahrens b94610887c [ReactNative] temp disable flow check in packager for OSS 2015-04-27 19:13:33 -08:00
Spencer Ahrens 469ae1f2ca temporarily disable flow check in packager while we figure out versioning issues.
cc @gabelevi, @bhosmer
2015-04-27 16:13:47 -07:00
Alex Kotliarskyi a1a15bda06 [ReactNative] Fix reloading in debug mode sometimes crashes packager 2015-04-24 15:07:57 -08:00
Alex Kotliarskyi 861c66e587 [ReactNative] Fix launchEditor script 2015-04-24 10:31:56 -08:00
Kevin Gozali 4c9ed22ff6 [ReactNative][madman] Reverted D2014357 2015-04-23 16:04:16 -08:00
Philipp von Weitershausen e88ba1a6a3 [ReactNative] Back out D2014163 entirely 2015-04-23 12:02:47 -08:00
Amjad Masad 24095fcc2d [react-packager] Change uri to name 2015-04-23 11:52:00 -08:00
Amjad Masad 4f89d1f76c [react-packager] Fix jest tests 2015-04-23 11:39:41 -08:00
Philipp von Weitershausen d2dbf4e0ed [ReactNative] Disable console.error => redboxes to unwedge Android 2015-04-23 09:56:15 -08:00
Alex Kotliarskyi b2e8dc9834 [ReactNative] Backport packager logs redirect 2015-04-22 16:28:54 -08:00
Spencer Ahrens e63bfae8f6 [ReactNative] console.error shows RedBox with pretty stack trace 2015-04-22 15:51:41 -08:00
Amjad Masad b4c82a4089 [react-packager] Additional data to asset modules 2015-04-22 10:59:37 -08:00
Amjad Masad 173615ae26 [react-packager] Add jpe?g to asset extensions 2015-04-21 11:06:01 -08:00
Amjad Masad c46c4a0ad4 [react-packager] bump watchman watch timeout to 10 seconds 2015-04-21 10:59:29 -08:00
Amjad Masad 77d908b975 [react-packager] Allow json files as modules 2015-04-21 10:51:15 -08:00
Amjad Masad 82704adead [react-packager] Implement Packager::getAssets 2015-04-20 16:01:15 -08:00
Alex Kotliarskyi a8a1798449 [ReactNative] Fix Chrome debugger 2015-04-20 14:37:24 -08:00
Tadeu Zagallo 0e8bc08d3f [ReactNative] Update method name on chrome debugger 2015-04-20 12:04:52 -08:00
Alex Kotliarskyi 5e2f90a73e [ReactNative] Skip flow checks for URLs that are not bundles 2015-04-20 11:52:07 -08:00
Alex Kotliarskyi f3e7511d2b [ReactNative] Dim packager output 2015-04-17 16:12:25 -08:00
Amjad Masad f1174836d7 [react-packager] Add more information to deprecated asset requires 2015-04-17 15:14:13 -08:00
James Ide 0b6dbdb827 [Errors] Fix Red Box by fixing providesModule parsing
Summary:
cc @amasad

An error occurred while trying to display the Red Box since loadSourceMap was not included in the JS
bundle. This is because node-haste was treating its docblock as a multiline directive which doesn't make sense for `@providesModule`.

In loadSourceMap.js's case, the directive's value was parsed as "loadSourceMap -- disabled flow due to mysterious validation errors --".

There are two fixes: add a newline under the `@providesModule` directive, and change the module ID code to look at only the first token of the directive. I opted for the latter so we avoid this class of bugs entirely and AFAIK it's nonsensical to have multiple `@providesModule` values anyway.

Closes https://github.com/facebook/react-native/pull/866
Github Author: James Ide <ide@jameside.com>

Test Plan:  Run the packager, trigger an error in an app, see the red box now show up again.
2015-04-17 09:45:35 -08:00
Peter Cottle 691297ab0d [ReactNative|Easy] Change watchman too-long error message
Summary:
@wez Mentioned this in Issue #239 -- right now when watchman takes too long we recommend you run `watchman` from your terminal which actually expects some arguments, so it prints out the following:

```
[pcottle:~/Desktop/react-native:changeErrorMessage]$ watchman
{
    "error": "invalid command (expected an array with some elements!)",
    "cli_validated": true,
    "version": "3.0.0"
}
```

basically this ends up being more confusing since the command we recommend you run errors out, so lets change it to `watchman version` which at least exists cleanly.

I kept the troubleshooting link as https://facebook.github.io/watchman/docs/troubleshooting.html since it sounds like we will update that with the issue people run into in #239
Closes https://github.com/facebook/react-native/pull/825
Github Author: Peter Cottle <pcottle@fb.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-04-17 09:16:22 -08:00
Amjad Masad 2975f26e80 [react-packager] Add asset extensions to file watch glob in the project root 2015-04-17 09:03:41 -08:00
Tadeu Zagallo 1883ba535c [ReactNative] Send batched calls from objc to js every frame + add bridge profiling 2015-04-17 04:01:02 -08:00
Amjad Masad 642d6cf483 [react-packager] Remove links to internal wiki 2015-04-16 13:14:41 -08:00
Amjad Masad fb7036eaac [react-packager] implement /assets endpoint to serve assets 2015-04-16 13:00:48 -08:00
Amjad Masad 758dd0d376 [react-packager] Add Array.prototype.es6 polyfill 2015-04-14 15:15:53 -08:00
Amjad Masad 5bbb351816 [react-packager] Support @nx resolution postfix for assets 2015-04-14 10:43:39 -08:00
Philipp von Weitershausen 62d7cd643d [ReactNative] allow running JS app server for Android from fbobjc 2015-04-14 10:28:07 -08:00
Tim Yung d135da9193 React Native: Add String.prototyp.es6 Polyfill 2015-04-13 13:25:35 -08:00
Spencer Ahrens 7f9ee949ee [ReactNative] Don't redbox on flow config errors 2015-04-09 17:37:13 -08:00
Amjad Masad 21f45e8899 [react-packager] Correct module extension regexp 2015-04-09 12:07:23 -08:00
Amjad Masad e3ce3d0d84 [react-packager] Implement the browser field package.json spec 2015-04-09 11:59:48 -08:00
Ben Alpert 7a8d39e09c [react-native] Listen on all IPv6 interfaces 2015-04-08 14:23:52 -08:00
Amjad Masad 3d2413a38a [react-packager] Don't depend on error.stack being available 2015-04-08 14:23:18 -08:00
Amjad Masad bd7b9da64a [react-packager] Implement new style asset packaging (with dimensions) 2015-04-08 13:11:21 -08:00
Spencer Ahrens a1ec752019 [ReactNative] Do flow check when running packager 2015-04-07 21:40:05 -08:00
Alex Kotliarskyi f2d08f599b [ReactNative] Better error message for EADDRINUSE 2015-04-07 15:39:36 -08:00
Amjad Masad b6eeb61024 [react-packager] Deprecate global image namespace in favor of CommonJS resolution 2015-04-03 17:19:10 -08:00
Amjad Masad 749f6a69cd [react-packager] Don't cache rejected promise 2015-04-03 15:47:26 -08:00
Pilwon Huh a9af05f8ac react-packager: Add ES6 import statement support to DependencyGraph.
Summary:
This PR teaches packager's `DependencyGraph` how to extract dependencies written with ES6 `import` statements.

It fixes the issue where you are not able to write your app with ES6 `import` statements when your custom transformer (replacing the default [JSTransform](https://github.com/facebook/jstransform), for example, [babel](http://babeljs.io/)) already supports the ES6 `import` syntax.

It will also be useful for [JSTransform](https://github.com/facebook/jstransform) later on once it implements `import` feature too.
Closes https://github.com/facebook/react-native/pull/386
Github Author: Pilwon Huh <pilwon@gmail.com>

Test Plan: runJestTests.sh
2015-04-03 11:40:54 -08:00
Steve Lacy 811a7aa492 Update deps order - core modules first
Summary:
**packager/packager.js**

- Update deps order - node core modules first

The core deps do not get installed, and do not need to be after the dep check.
Closes https://github.com/facebook/react-native/pull/224
Github Author: Steve Lacy <me@slacy.me>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-04-02 17:05:40 -08:00
Amjad Masad b1e502a083 [react-packager] Ignore dotfiles in file watching 2015-04-02 06:11:16 -08:00
Justin Carmony b6503ba431 Packager status page & build validating against it.
Summary:
Creating a packager status page so React can validate a proper packager instance is running on 8081.

See #257 for details on this bug.

The biggest thing in this PR is I have it perform an exit 2 in the build script if the check fails. This will cause the build to fail, they can click on the error and see a nice message. Not sure if there is a way to throw a warning instead.

Also, I broke the bash script into several lines, in the Xcode editor it looks fine but in the source code it looks less than ideal. We might want to break that out into it's own bash script that is called. Let me know if you want to do that.
Closes https://github.com/facebook/react-native/pull/308
Github Author: Justin Carmony <justin@justincarmony.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-03-31 23:01:04 -08:00
Jacob Gable 63c2f80a7c Do not expose define references in require polyfill
Summary:
See #406

Made sure the jest tests pass but didn't know a good unit test to add for this.
Closes https://github.com/facebook/react-native/pull/427
Github Author: Jacob Gable <jacob.gable@gmail.com>

Test Plan:
* ./runJestTests
* start app and click around
2015-03-31 22:32:39 -08:00
Pilwon Huh 87599bfcd1 [react-packager] Switch from Q to Bluebird as promises library
Summary:
This PR improves performance of `react-packager` by switching the promises library from the [Q](https://github.com/kriskowal/q) to [Bluebird](https://github.com/petkaantonov/bluebird).

[Here is the test result](https://github.com/facebook/react-native/issues/361#issuecomment-87829808) showing a noticeable difference. (2x speed improvement)

Please refer to [this issue](https://github.com/facebook/react-native/issues/361) for more details.
Closes https://github.com/facebook/react-native/pull/516
Github Author: Pilwon Huh <pilwon@gmail.com>

Test Plan:
./runJestTests
start app and click around
2015-03-31 21:24:13 -08:00
Amjad Masad 92a6c3e004 [react-packager] Fix EISDIR error 2015-03-31 19:49:05 -08:00
daviskoh 0ca3136371 Bugfix/require module regexp
Summary:
Resolves https://github.com/facebook/react-native/issues/316. Also updated the spec for the Haste Dependency Resolver. Not sure if these changes are the ones desired so feedback would be welcome!
Closes https://github.com/facebook/react-native/pull/368
Github Author: daviskoh <koh.davis.0@gmail.com>

Test Plan: ./runJestTests
2015-03-31 17:37:39 -08:00
Alex Kotliarskyi 9e931e9d36 [ReactNative] Add few hints in the UI 2015-03-31 16:15:40 -08:00
Amjad Masad c94f7c3656 [React Native] Sync from github 2015-03-27 22:09:11 -08:00
Amjad Masad c2b2d45b79 [react-packager] Inherit from Error correctly 2015-03-27 21:47:19 -08:00
Amjad Masad 7dc411b162 [react-packager] Fix assetRoots when starting in node_modules 2015-03-27 19:08:24 -08:00
Ben Alpert e2b2186aa8 Bump packager version to match GitHub 2015-03-27 11:54:16 -08:00
Amjad Masad a925082d2e [react-packager] Watch asset roots for changes to update dependency graph 2015-03-27 09:18:00 -08:00
Amjad Masad 35589d6f09 [react-packager] move dependencies to root package.json 2015-03-26 21:45:55 -08:00
Amjad Masad 39fe5ec266 [react-packager] Fix node v0.11.14 query parse bug 2015-03-26 14:33:33 -08:00
Kevin Kwok 4a6bcc34eb [CLI] react-native start won't run from dir with spaces
Summary:
Running "react-native start" from /Users/kevin/Dropbox (Personal)/Projects/AwesomeProject/ produces the following error

Error: Cannot find module '/Users/kevin/Dropbox'
    at Function.Module._resolveFilename (module.js:322:15)
    at Function.Module._load (module.js:264:25)
    at Function.Module.runMain (module.js:487:10)
    at startup (node.js:111:16)
    at node.js:809:3
Closes https://github.com/facebook/react-native/pull/214
Github Author: Kevin Kwok <antimatter15@gmail.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-03-26 12:37:27 -08:00
Amjad Masad 031adabd18 [react-packager] better error when main file not found 2015-03-26 10:38:50 -08:00
James Ide d2206d492d [Assets] Allow scripts to override assetRoots
Summary:
The CLI parse was accepting a string but assetRoots should be an array, so split on commas. Tested by specifying a root directory that was at least two folders up (../../stuff).
Closes https://github.com/facebook/react-native/pull/189
Github Author: James Ide <ide@jameside.com>

Test Plan:
* export to open source
* started server passing --assetRoots array
2015-03-26 01:24:08 -08:00
Christopher Chedeau 546d03d8ed [ReactNative] Update package.json to be npm-ready 2015-03-25 18:08:07 -08:00
Amjad Masad 7d8020751d [react-packager] Readme 2015-03-25 15:35:10 -08:00
Amjad Masad 909e393f26 [react-packager] kill non-standard RAW_SOURCE_MAP 2015-03-24 17:17:02 -08:00
Amjad Masad 8b79808a90 [react-packager] Fix more issues with node modules 2015-03-24 16:07:56 -08:00
Amjad Masad bc921916ed [react-packager] Fix regression with transform errors 2015-03-23 18:55:36 -08:00
Alex Kotliarskyi 463a5bc9a4 [ReactNative] Remove `arc build` instructions from require 2015-03-23 17:18:19 -08:00
Amjad Masad 540cb4bb8e [react-packager] Default to index.js from main if it's a dir 2015-03-23 14:55:52 -08:00
Christopher Chedeau f67a36733f [ReactNative] Expanded license on js packager files 2015-03-23 11:28:51 -08:00
Amjad Masad a6b154332b [react-packager] Pick up package changes while running 2015-03-23 11:15:52 -08:00
Alex Kotliarskyi 5023931272 [ReactNative] Print directories packager is serving files from 2015-03-22 22:37:55 -08:00
Alex Kotliarskyi b612741b21 [ReactNative] Move packager/init.sh to GitHub 2015-03-22 20:17:39 -08:00
Amjad Masad ce6354604c [react-packager] Allow entry point extensions like .ios.js 2015-03-20 17:24:51 -08:00
Alex Kotliarskyi 33b46c3ba9 [ReactNative] Adjust packager default root when running from within node_modules 2015-03-20 16:12:57 -08:00
Amjad Masad 258a81388e [react-packager] Make sure projectRoots is converted to an array 2015-03-20 14:09:31 -08:00
Alex Kotliarskyi 6d88898404 [ReactNative] Init script that bootstraps new Xcode project 2015-03-20 13:41:50 -08:00
Amjad Masad c68fc1a976 [react-packager] Hash cache file name information to avoid long names 2015-03-19 16:40:35 -08:00
Amjad Masad 115ad71831 [react-packager] Fix OOM 2015-03-19 11:50:27 -08:00
Alex Kotliarskyi 8dea55618d [ReactNative] Bring Chrome debugger to OSS. Part 2 2015-03-19 11:48:51 -08:00
Christopher Chedeau 737cae8f19 [ReactNative] Remove duplicate package.json with the same name 2015-03-19 09:04:39 -08:00
Amjad Masad 319ea3242a [react-packager] Add assetRoots option 2015-03-18 18:26:35 -08:00
Martin Kosiba 8b2e79dc68 [react_native] JS files from D1919491: Improve JS logging 2015-03-18 07:30:18 -08:00
Amjad Masad d3054788da [react-packager] small fixes to image loader 2015-03-16 14:45:40 -08:00
Christopher Chedeau 8694330d42 [ReactNative] Add website to blacklist 2015-03-15 19:24:56 -08:00
Christopher Chedeau 7fb8bff66b [ReactNative] Fix File Watcher test 2015-03-14 16:50:54 -08:00
Amjad Masad 9249545047 [react-packager] Implement image loading i.e. ix('img') -> require('image!img'); 2015-03-13 16:10:58 -08:00
Amjad Masad eabe9f43c8 [react-packager] package.json cleanup (seperate packager into it's own package) 2015-03-11 17:42:46 -08:00
Ben Alpert b335f88efd [React Native] Update core modules for React 0.13 2015-03-06 17:12:53 -08:00
Amjad Masad c99284bfdf [react-packager] onchange endpoint that informs of changes 2015-03-06 15:28:32 -08:00
Amjad Masad b9207a3095 [react-packager] dev option needs to default to true for backwards compat 2015-03-06 14:45:23 -08:00
Amjad Masad ab2537816f [react-packager] Add minify option as query param 2015-03-05 12:12:42 -08:00
Amjad Masad 78d03b89b7 [react-packager] Make dev a query param option 2015-03-04 21:24:08 -08:00
Amjad Masad 4f2c336ac3 [react-packager] Start converting options to query params 2015-03-04 19:06:51 -08:00
Amjad Masad 535bdfcf87 [react-packager] Recover and warn from corrupted cache file 2015-03-03 17:49:42 -08:00
Amjad Masad ab43dd9813 [react-packager] check-in node_modules and update tests 2015-03-03 02:02:51 -08:00
Amjad Masad 666a46830c [react-packager] Implement bundle minification 2015-03-02 23:19:41 -08:00
James Ide e5d86aeb5b [react-packager] Add dev option to CLI | James Ide
Summary:
Exposes the dev option that is already there to the CLI so that you can turn off invariant checks, etc. I also made it omit the inlined source map when dev=false which made it a lot faster to run on a phone, both due to smaller download size and fewer bytes to copy from Obj-C to JS and evaluate.
Closes https://github.com/facebook/react-native/pull/112
Github Author: James Ide <ide@jameside.com>

Test Plan:
* ./runJestTests.sh
* test bundle creation with `bundle.sh`
* test `load_dependencies.js` script
* start the server and click around shell app
2015-03-02 21:11:07 -08:00
Amjad Masad c9af9963be [react-packager] Better transform errors 2015-02-28 17:13:23 -08:00
Amjad Masad a9c8b13e6e [React Native][react-packager] Fix test runner and fialing tests 2015-02-28 14:55:00 -08:00
Amjad Masad 68fcfc3050 [react-packager] transformModulePath option is not actually required 2015-02-27 10:51:07 -08:00
Amjad Masad 96312af117 [react-packager] Fix lint errors 2015-02-25 20:29:42 -08:00
Chengyin Liu 929cfc9dd5 [react-packager] fix a typo s/pacakge/package
Summary:
Closes https://github.com/facebook/react-native/pull/83
Github Author: Chengyin Liu <chengyin.liu@gmail.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-02-25 16:07:13 -08:00
Amjad Masad cf7d196c45 [react-packager] Fix jest tests 2015-02-25 14:17:42 -08:00
Amjad Masad f426ec8d7d [react-packager] Cleanup option passing and validation 2015-02-24 15:17:40 -08:00
Amjad Masad 00553c6d06 [react-packager][cleanup options 1/2] add npm installed joi validation library 2015-02-23 13:11:35 -08:00
Christoph Pojer 987d1ef3d7 [React-Native] Update jstransform/esprima 2015-02-20 15:06:21 -08:00
Spencer Ahrens efae175a8e [react-packager][streamline oss] Move open sourced JS source to react-native-github 2015-02-19 21:25:11 -08:00