Commit Graph

47 Commits

Author SHA1 Message Date
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
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
Spencer Ahrens
81ad810186 [ReactNative] differentiate fatal and soft exceptions 2015-05-13 13:24:37 -07:00
Dmitry Soshnikov
792b2db23c [jest] Update to v0.4.2 2015-05-13 13:24:35 -07:00
Spencer Ahrens
66d2f600dd [ReactNative] improve console logging a little bit 2015-05-04 18:57:03 -08:00
Tim Yung
43e7e69841 JS: Use Object.defineProperty for Array Polyfills 2015-04-28 15:56:40 -08:00
Philipp von Weitershausen
e88ba1a6a3 [ReactNative] Back out D2014163 entirely 2015-04-23 12:02:47 -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
77d908b975 [react-packager] Allow json files as modules 2015-04-21 10:51:15 -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
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
bd7b9da64a [react-packager] Implement new style asset packaging (with dimensions) 2015-04-08 13:11:21 -08:00
Amjad Masad
b6eeb61024 [react-packager] Deprecate global image namespace in favor of CommonJS resolution 2015-04-03 17:19:10 -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
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
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
031adabd18 [react-packager] better error when main file not found 2015-03-26 10:38:50 -08:00
Amjad Masad
8b79808a90 [react-packager] Fix more issues with node modules 2015-03-24 16:07:56 -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
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
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
78d03b89b7 [react-packager] Make dev a query param option 2015-03-04 21:24:08 -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
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
f426ec8d7d [react-packager] Cleanup option passing and validation 2015-02-24 15:17:40 -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