76 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
Tim Yung
d135da9193 React Native: Add String.prototyp.es6 Polyfill 2015-04-13 13:25:35 -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
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
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
Amjad Masad
b1e502a083 [react-packager] Ignore dotfiles in file watching 2015-04-02 06:11:16 -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
Amjad Masad
c2b2d45b79 [react-packager] Inherit from Error correctly 2015-03-27 21:47:19 -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
39fe5ec266 [react-packager] Fix node v0.11.14 query parse bug 2015-03-26 14:33:33 -08:00
Amjad Masad
031adabd18 [react-packager] better error when main file not found 2015-03-26 10:38:50 -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