Commit Graph

1125 Commits

Author SHA1 Message Date
Amjad Masad 7664d5fb76 [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 a372af9956 [react-packager] Remove horribly outdated example_project
Summary:
Removes some old unused code.
2015-08-13 13:02:52 -08:00
Martín Bigio 8644bfd09c [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 1751d1c6fc [react-packager] Set a lifetime on workers to avoid memory leaks 2015-08-12 19:26:26 -08:00
Martín Bigio ce6acf1586 [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 3f1619b158 [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ă 6ed3ba3e41 [cli] convert project generation to use yeoman 2015-08-12 12:04:27 +01:00
Martín Bigio d1772eebe6 [react-packager] Fix Cache-test 2015-08-11 11:27:15 -08:00
Christopher Chedeau cf1a313d5c Bust jest caching and fix tests 2015-08-11 11:02:19 -07:00
Christopher Chedeau a457202f9b Updates from Tue 11 Aug 2015-08-11 08:42:07 -07:00
Evan Solomon d1dc802e20 [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 8c521f9749 [react-packager] Add more granular Activity logging 2015-08-10 16:25:04 -08:00
Martín Bigio 49fde903b8 [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 1d6f7c9cc7 Grammar 2015-08-10 14:34:27 +01:00
Alex Kotliarskyi cc87e5173f [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 06f508a55a [JSAppServer] Don't keep track of not found packages 2015-08-06 11:34:56 -08:00
Thomas Aylott f47a29f922 [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 7b1ffed4e7 [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 63a96af6c6 [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 ab23c251c3 [reactnative] add launchAndroidPackager.command 2015-07-30 03:35:29 -08:00
Ben Alpert 0c72825ef8 [ReactNative] Fix ResponderEventPlugin after React upgrade 2015-07-29 02:47:55 -08:00
Alex Kotliarskyi 3bdb3f0f98 Updates from 2015-07-27 2015-07-27 10:01:30 -07:00
James Ide 03b4050c6e [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 4b7f9c60c4 [ReactNative] Update core RN modules to work with React 0.14-beta1 2015-07-23 18:07:59 -08:00
Jared Forsyth c90d79fe01 [react-native] enable react devtools from JavascriptCore 2015-07-23 17:14:09 -08:00
Alex Kotliarskyi c2b311eeaa Updates from Thu, July 23 2015-07-23 13:09:48 -07:00
Daniel Brockman fa6c4dde65 #!/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 0e7ebfeec5 Updates from Fri July 17th 2015-07-17 14:14:30 +02:00
Sean Powell 0cc159ff66 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 2bc7fea417 Updates from Wed July 15th 2015-07-15 19:05:08 +02:00
Dave Sibiski f7d51c750f [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 efe870b667 Updates for Fri 10 Jul 2015-07-10 17:48:12 +01:00
James Ide 01d07a3eb6 [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 b158709e74 Update with test fixes 2015-07-02 11:19:17 +01:00
Amjad Masad 802ad3feb3 [react-packager] fix test 2015-07-01 17:37:51 -08:00
Alexsander Akers e6ce2c2c99 Merge branch 'iojs-tests' of https://github.com/ide/react-native into Update_Wed_1_Jul
Conflicts:
	package.json
2015-07-01 22:07:41 +01:00
Alexsander Akers 8938be4d5d Update with required PRs 2015-07-01 22:05:10 +01:00
James Ide 62431c7f62 [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
James Ide 5a0723cfba [Tests] Update tests to run on io.js with the latest version of jest
Updates the tests in small ways so they run on io.js with some 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.

Test Plan: Run `npm test` with the latest version of jest.
2015-07-01 11:38:17 -07:00
Alexsander Akers d8fc316032 Updates from Wed 1 Jul 2015-07-01 19:10:35 +01:00
Amjad Masad 70dde863ae [react-packager] Use latest babel-core in place of babel (40% perf improvement) 2015-06-30 03:55:21 -08:00
Dmitry Soshnikov b3d9bf6909 [react-native][jest] Sync to 0.5.x and update to io.js 2015-06-29 20:36:34 -08:00
Amjad Masad 6b2c12e300 [react-packager] Update sane to get a new version of fb-watchman (perf) 2015-06-26 17:48:39 -08:00
Joe Wood 157a77e48d [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 15a0f07c5f [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 d70ff04746 [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 4ef609192d Updates Thu, 25 Jun 2015-06-25 09:37:02 -07:00
Amjad Masad 737a32417f [react-packager] Injectible file crawlers (2x crawl speedup) 2015-06-24 18:04:57 -08:00
Jing Chen 693fd0bbe5 [events] Add JS require time and fix up some existing logs 2015-06-24 16:59:00 -08:00
Alex Kotliarskyi 6b2f239406 More updates from Wed, 24 Jun 2015-06-24 16:24:42 -07:00