Commit Graph

782 Commits

Author SHA1 Message Date
Janic Duplessis cfdd04f2d2 Launch the packager with `react-native run-android` on Windows
Summary:
Adds support for launching the packager in a new window on Windows.

**Test plan (required)**

Tested that the packager is launched in a completely independent process. This means that exiting the `react-native run-android` command should not close the packager window and it should exit properly when completed even if the packager window is still opened. Pretty much made sure it behaves exactly like on mac.

Also tested that an error in the packager will not close the window immediately to show the error stack trace.
Closes https://github.com/facebook/react-native/pull/7129

Differential Revision: D3240628

Pulled By: mkonicek

fb-gh-sync-id: 007582250536481d2b2376f9a201f8f415fc1080
fbshipit-source-id: 007582250536481d2b2376f9a201f8f415fc1080
2016-04-29 04:14:22 -07:00
David Aurelio 17726e1ae6 Improve constant inlining, add `process.platform`
Reviewed By: bestander

Differential Revision: D3235716

fb-gh-sync-id: f9019ec0042827e409fa84ba74f4c426ccad1519
fbshipit-source-id: f9019ec0042827e409fa84ba74f4c426ccad1519
2016-04-28 11:23:21 -07:00
Pieter De Baets cc538b9b35 Enable console.debug
Summary: Apparently what we're using for console.trace is not really the same as what Chrome does (we don't log a stacktrace). Add `console.debug` with the same functionality as `console.trace`, just so we don't crash between browser and local execution.

Reviewed By: davidaurelio

Differential Revision: D3235053

fb-gh-sync-id: 4bed17ac8aa4c8c100f15cf0aabbc25101c913c1
fbshipit-source-id: 4bed17ac8aa4c8c100f15cf0aabbc25101c913c1
2016-04-28 07:02:29 -07:00
David Aurelio 789978a9ec Upgrade to node-haste@2.10.0 and allow to specify extra node modules
Summary: This upgrades to node-haste@2.10.0 and allows to expose folders as additional node modules from rn-cli.config.js

Reviewed By: bestander

Differential Revision: D3232595

fb-gh-sync-id: dffca66fec55a79a2b3af1d6ec1b8799b2bbcf59
fbshipit-source-id: dffca66fec55a79a2b3af1d6ec1b8799b2bbcf59
2016-04-28 06:33:27 -07:00
Christoph Pojer d4e704be17 Update Jest APIs on fbsource
Reviewed By: javache

Differential Revision: D3229435

fb-gh-sync-id: b0e252d69e1f399a946fca6e98ef62ff44c2ef9c
fbshipit-source-id: b0e252d69e1f399a946fca6e98ef62ff44c2ef9c
2016-04-27 19:16:32 -07:00
Steven Luscher d07a52d887 Move `Number` polyfills into the `/polyfills/` directory
Reviewed By: vjeux

Differential Revision: D3223317

fb-gh-sync-id: a49a14f217b27d6542b65c4780c557e73da2443f
fbshipit-source-id: a49a14f217b27d6542b65c4780c557e73da2443f
2016-04-26 11:24:42 -07:00
Steven Luscher ca409964fc Add a `Number.isNaN` polyfill
Reviewed By: sahrens

Differential Revision: D3222299

fb-gh-sync-id: 601283fb0b140bb305181ea381907e62286f7a37
fbshipit-source-id: 601283fb0b140bb305181ea381907e62286f7a37
2016-04-25 23:15:18 -07:00
Alexander Micklewright 05871df2a9 Fix a bug in asset server when using relative project roots
Summary:This PR fixes a bug where when using relative roots for the packager server, asset paths would be deemed invalid by the recently introduced security check. Resolving the root to an absolute path fixes that problem.

I'd be happy to write a regression test for this but I had a hard time setting up a mock file system with relative paths. If it is required, some help would be appreciated...
Closes https://github.com/facebook/react-native/pull/7161

Differential Revision: D3214840

fb-gh-sync-id: 08e13fb9f94a98206fd2d090f74a8b63ba2bf80f
fbshipit-source-id: 08e13fb9f94a98206fd2d090f74a8b63ba2bf80f
2016-04-22 16:06:21 -07:00
Pieter De Baets bdc9749ba0 Improve error handling in require-unbundle
Reviewed By: davidaurelio

Differential Revision: D3207450

fb-gh-sync-id: 35247c265e35976dcee9fca4215403efa604479e
fbshipit-source-id: 35247c265e35976dcee9fca4215403efa604479e
2016-04-22 06:18:26 -07:00
Sebastian Markbage 071c175222 Move React Core Integration to a Dependency
Summary:Adding the react native renderer dependency and various fixes to support React 15.

Don't use dispatchID for touchableHandleResponderGrant

This callback argument was removed because "IDs" no longer exist. Instead, we'll
use the tag from the event target.

The corresponding PR on React Core is: https://github.com/facebook/react/pull/6338

Reviewed By: spicyj

Differential Revision: D3159788

fb-gh-sync-id: 60e5cd2aa0af69d83fcdac3dfde0a85a748cb7b9
fbshipit-source-id: 60e5cd2aa0af69d83fcdac3dfde0a85a748cb7b9
2016-04-21 09:28:23 -07:00
David Aurelio faa9adf2ab Allow for falsy module exports
Reviewed By: javache

Differential Revision: D3207353

fb-gh-sync-id: 3e23eb9cc9facea7993ce684f87ff4b7b0003a1c
fbshipit-source-id: 3e23eb9cc9facea7993ce684f87ff4b7b0003a1c
2016-04-21 06:49:20 -07:00
Mike Grabowski ae9f74e68d Strip shebang when present in JS files
Summary:Fixes #7034
Closes https://github.com/facebook/react-native/pull/7073

Differential Revision: D3199816

fb-gh-sync-id: 2099dd1f81b030933794be6a592a697cec3627d0
fbshipit-source-id: 2099dd1f81b030933794be6a592a697cec3627d0
2016-04-19 18:09:22 -07:00
Tadeu Zagallo f0e4826c46 Free modules' factories after caching module
Summary:The require functions will keep the generate bytecode + lexical environment in
memory unnecessarily, since we can be sure that it will be executed at most once

Reviewed By: davidaurelio

Differential Revision: D3168257

fb-gh-sync-id: 038e1bc08abea94ee52d0390b6aced5fb652f493
fbshipit-source-id: 038e1bc08abea94ee52d0390b6aced5fb652f493
2016-04-19 08:13:24 -07:00
Leland Richardson b7b8861b75 Whitelist the 'pdf' extension in the packager
Summary:The WebView component in iOS currently does not support displaying PDFs without providing a remote URI or manually including the assets in the xcodeproj itself. This is because the packager has not whitelisted the 'pdf' extension.

I've gone ahead and whitelisted the 'pdf extension according to the recommendation by nicklockwood

GH comment: https://github.com/facebook/react-native/issues/1846#issuecomment-199302488
Closes https://github.com/facebook/react-native/pull/7004

Differential Revision: D3196019

Pulled By: nicklockwood

fb-gh-sync-id: 10a86a9232095f98f277506141de0b8af5b21ab4
fbshipit-source-id: 10a86a9232095f98f277506141de0b8af5b21ab4
2016-04-19 03:52:27 -07:00
David Aurelio c16cfc694b Don't load 'babel-polyfill', only polyfill `Array#values`, `Object.values`, and `Object.entries`
Summary:Instead of loading `'babel-polyfill'` into packager, we only polyfill es6 methods that are unavailable in node 4, and es7 stage 4 proposals.
That makes sure that we are using native promises, and don't load unnecessary polyfills.

Reviewed By: vjeux

Differential Revision: D3168057

fb-gh-sync-id: 68b53795d9a1d7cfdc00fc31684da3ad21a7bb34
fbshipit-source-id: 68b53795d9a1d7cfdc00fc31684da3ad21a7bb34
2016-04-12 08:29:20 -07:00
Sam Swarr 43c5ed2be0 Delete SocketInterface code
Reviewed By: davidaurelio

Differential Revision: D3152105

fb-gh-sync-id: a6c13bb54c2164ebc063a1b14f00114738546c8c
fbshipit-source-id: a6c13bb54c2164ebc063a1b14f00114738546c8c
2016-04-11 14:38:26 -07:00
Sam Swarr 1d9df442a4 Remove socket interface from dependencies command
Reviewed By: davidaurelio

Differential Revision: D3136438

fb-gh-sync-id: 51fce2caf60fdf32a8cba180c79b1996834cda6e
fbshipit-source-id: 51fce2caf60fdf32a8cba180c79b1996834cda6e
2016-04-11 09:23:29 -07:00
Thomas Aylott f9a9cd6f25 Fixes hotcode reloading issue
Reviewed By: martinbigio

Differential Revision: D3136032

fb-gh-sync-id: 5666fd45ffa574d2156b03c7bfbda3fe97090f56
fbshipit-source-id: 5666fd45ffa574d2156b03c7bfbda3fe97090f56
2016-04-06 12:14:20 -07:00
Adam Miskiewicz 65b0f7c868 Pass transformOptions to getShallowDependencies.
Summary:We weren't passing `transformOptions` to `getShallowDependencies`, and therefore, when this method was called on a module, it would bust the cache and cause a retransform of the file. This was resulting in a complete retransforming of all files when the HMR Client connected to the packager.
Closes https://github.com/facebook/react-native/pull/6843

Differential Revision: D3145306

Pulled By: martinbigio

fb-gh-sync-id: 3619c27801b2fc07b758fafed47fcc892bb8e6db
fbshipit-source-id: 3619c27801b2fc07b758fafed47fcc892bb8e6db
2016-04-06 11:38:27 -07:00
Nick 27e79ff0c3 CHORE - Remove Trailing Spaces
Summary:Remove Trailing Spaces.

Why:
Sometimes there are conflicts with trailing spaces
Saves space
Those whose tools automatically delete them will have their pr watered down with trailing space removal
Closes https://github.com/facebook/react-native/pull/6787

Differential Revision: D3144704

fb-gh-sync-id: d8a62f115a3f8a8a49d5b07f56c540a02af38cf8
fbshipit-source-id: d8a62f115a3f8a8a49d5b07f56c540a02af38cf8
2016-04-06 09:21:53 -07:00
Konstantin Raev 6f9aad3641 Fixed images required from node_modules
Summary:This fixes https://github.com/facebook/react-native/issues/6638 by resolving AssetRegistry relatively.
Closes https://github.com/facebook/react-native/pull/6822

Reviewed By: davidaurelio

Differential Revision: D3144463

Pulled By: bestander

fb-gh-sync-id: d3eeb24ae9e08a32f742c50ae5f0314fd33d1b6b
fbshipit-source-id: d3eeb24ae9e08a32f742c50ae5f0314fd33d1b6b
2016-04-06 07:59:29 -07:00
Janic Duplessis 30bdfdd370 Fix HMR on Windows
Summary:Tested HMR on Windows and found 2 small issues related to paths that made it not work. Now it works nicely :)

**Test plan (required)**
Tested HMR in UIExplorer on Windows.
Closes https://github.com/facebook/react-native/pull/6678

Differential Revision: D3138379

fb-gh-sync-id: f27cd2fa21f95954685c8c6916d820f41bc187be
fbshipit-source-id: f27cd2fa21f95954685c8c6916d820f41bc187be
2016-04-05 01:13:18 -07:00
Mart?n Bigio 97e1db3e6c Avoid getting `entryFilePath` on HMR codepath
Summary: The HMR codepath is currently broken because of a recent change that tries to compute the absolute entryFile path (needed for RAM Bundling). HMR Bundler's bundles are special as they contains a single file (the file that was transformed). However, for performance reasons we recycle an existing resolution response which contains the polyfills and the module system modules.

Reviewed By: sam-swarr

Differential Revision: D3098069

fb-gh-sync-id: 23d61aa304cd6f59d4df4840965f5eedda05dc31
fbshipit-source-id: 23d61aa304cd6f59d4df4840965f5eedda05dc31
2016-03-25 08:45:21 -07:00
Satyajit Sahoo 7cf1c7f51f Fix fetching sourcemap in genymotion. Fixes #5338
Summary:Source maps are broken on Genymotion right now as they aren't being loaded from the correct URL. refer - https://github.com/facebook/react-native/issues/5338#issuecomment-188232402

**Test plan**

Build and install UIExplorer from master branch in genymotion and enable hot reload. When you change a file and save it, you'll see a Yellow box due to source map fetching failed, as per the referenced comment.

Doing the same for this branch doesn't produce any yellow boxes.
Closes https://github.com/facebook/react-native/pull/6594

Differential Revision: D3088218

Pulled By: martinbigio

fb-gh-sync-id: 0d1c19cc263de5c6c62061c399eef33fa4ac4a7b
shipit-source-id: 0d1c19cc263de5c6c62061c399eef33fa4ac4a7b
2016-03-24 12:06:45 -07:00
Steven Chaitoff 4ea783234b file change listener for relay fragments in packager server
Reviewed By: martinbigio

Differential Revision: D3011797

fb-gh-sync-id: 9f7ddc7b3c0c0e2a78db829343d9fa93a46b4ad6
shipit-source-id: 9f7ddc7b3c0c0e2a78db829343d9fa93a46b4ad6
2016-03-24 08:08:34 -07:00
Mart?n Bigio cccbb342a0 Fix OSS tests
Reviewed By: bestander

Differential Revision: D3088301

fb-gh-sync-id: 310d9c7c1956f21f3c8e5da6a1455c2a9fad2d04
shipit-source-id: 310d9c7c1956f21f3c8e5da6a1455c2a9fad2d04
2016-03-23 15:17:21 -07:00
Shayne Sweeney ed654c022e Use different tmpdir
Reviewed By: wez

Differential Revision: D3086091

fb-gh-sync-id: b26a792b80b523205ceafaa0e9d2299527bc8176
shipit-source-id: b26a792b80b523205ceafaa0e9d2299527bc8176
2016-03-23 12:36:21 -07:00
Martín Bigio c0f446d7e2 Move preloaded modules to startup code section
Summary:We found that moving the preloaded modules to the startup section of the RAM Bundle improves TTI quite a bit by saving lots of through the bridge calls and injecting multiple modules at once on JSC. However, doing this on a non hacky way required a lot of work. The main changes this diff does are:
  - Add to `BundleBase` additional bundling options. This options are fetched based on the entry file we're building by invoking a module that exports a function (`getBundleOptionsModulePath`).
  - Implement `BundleOptions` module to include the `numPreloadedModules` attribute as a bundle additional option. This value is computed by getting the dependencies the entry file has and looking for the first module that exports a module we don't want to preload. The `numPreloadedModules` attribute is then used to decide where to splice the array of modules.
- Additional kung fu to make sure sourcemaps work for both preloaded and non preloaded modules.

Reviewed By: davidaurelio

Differential Revision: D3046534

fb-gh-sync-id: 80b676222ca3bb8b9eecc912a7963be94d3dee1a
shipit-source-id: 80b676222ca3bb8b9eecc912a7963be94d3dee1a
2016-03-23 09:28:31 -07:00
Shayne Sweeney 18612273be Fix asset path-traversal outside of roots
Summary:`/assets/...` requests previously supported path-traversal potentially exposing and serving (private) files outside roots.

**Test plan**

Prior to patching perform the a path-traversal request to the server:
```
GET /assets/../../../../etc/hosts HTTP/1.1
Cache-Control: no-store
Host: 127.0.0.1:8081
Connection: close
Accept-Encoding: gzip
User-Agent: okhttp/2.5.0
```

Apply patch and verify a `404` response with body: `Asset not found`

Test normal asset requests work.
Closes https://github.com/facebook/react-native/pull/6398

Differential Revision: D3034857

Pulled By: shayne

fb-gh-sync-id: f0e6714e4e3c5a63a3a402634a1eb5f3186d3561
shipit-source-id: f0e6714e4e3c5a63a3a402634a1eb5f3186d3561
2016-03-21 21:58:22 -07:00
Martín Bigio ebfb4f738a Make HMR compatible with numeric IDs
Summary:We recently refactor the packager to transform the module names into numeric IDs but we forgot to update the HMR call site. As a consequence, HMR doesn't work the first time a file is saved but the second one.

This is affecting master as of 3/20. If we don't land this before v0.23 is cut we'll have to cherry pick it. This rev does *not* need to be picked on v0.22.

Reviewed By: bestander

Differential Revision: D3075192

fb-gh-sync-id: 410e4bf8f937c0cdb8f2b462dd36f928a24e8aa8
shipit-source-id: 410e4bf8f937c0cdb8f2b462dd36f928a24e8aa8
2016-03-21 15:51:24 -07:00
Shayne Sweeney abbc1a5157 Atomic install, remove locking, cache xz archives (for offline installs)
Reviewed By: martinbigio

Differential Revision: D3015398

fb-gh-sync-id: e0d987917b94ce541c8fa890930799aa8613737e
shipit-source-id: e0d987917b94ce541c8fa890930799aa8613737e
2016-03-21 12:58:22 -07:00
David Aurelio f361f99f53 Add sourcemap support for asset-based random access bundles
Summary:This adds support for source maps that can be used for “random access modules” / “unbundles”

- source maps contain an extra custom field: `x_facebook_offsets`
- this field maps module IDs to line offsets
- the source map is built as if all files were concatenated

Decoding/symbolication works as follows:
- when decoding a stack trace, and a stack frame comes from a filename that contains only numbers and ends with `.js`, look up the additionally needed line offset in the offset map and add it to the original line of the stack frame.
- consume the source map as usual

Reviewed By: martinbigio

Differential Revision: D3072426

fb-gh-sync-id: 827e6dc13b1959f02903baafa7f9e4fc2e0d4bb9
shipit-source-id: 827e6dc13b1959f02903baafa7f9e4fc2e0d4bb9
2016-03-21 12:32:22 -07:00
Konstantin Raev 8a860a01c5 Improved OSS flow and lint reporting
Summary:- lint bot is now managed by Circle CI
- checked that flow and lint errors are caught both by bot and CI
- flow fix for npm 3
- Travis is now using npm 2 and Circle CI npm 3
- Refactored Travis script to be able to be able to fail on multiple lines
Closes https://github.com/facebook/react-native/pull/6508

Differential Revision: D3069500

Pulled By: davidaurelio

fb-gh-sync-id: 02772bf1eae5f2c44489c2e3a01899428a9640cb
shipit-source-id: 02772bf1eae5f2c44489c2e3a01899428a9640cb
2016-03-18 08:10:26 -07:00
David Aurelio d533323781 Upgrade node-haste to v2.9.1 to make module order deterministic
Summary:Changing the order of transformation and extraction of dependencies made the order of modules dependent on the time when the worker pool returns a result.
node-haste v2.9.1 addresses this issue and makes the order of dependencies deterministic.

This also bumps the packager versions to enforce cache invalidation.

Reviewed By: martinbigio

Differential Revision: D3065063

fb-gh-sync-id: 1d45b066e45c3f64092f779c3fce3becf6739409
shipit-source-id: 1d45b066e45c3f64092f779c3fce3becf6739409
2016-03-17 14:59:52 -07:00
Sam Swarr 054642231b Add ability to silence packager logs to stdout
Summary:We use a few different modules to output logs to stdout when building a bundle with the packager:
- ##js/react-native-github/packager/react-packager/src/Activity/index.js##
- ##js/react-native-github/local-cli/util/log.js##
- ##https://www.npmjs.com/package/progress##

This diff also adds a ##silent## option to the packager ##Server##, which, when ##true##, will not create a ##progress## instance for the transformer.

Reviewed By: martinbigio

Differential Revision: D3048739

fb-gh-sync-id: a4c6caf36f5127946593f4a0a349fa145ad0d4e6
shipit-source-id: a4c6caf36f5127946593f4a0a349fa145ad0d4e6
2016-03-15 12:10:31 -07:00
David Aurelio 482e2fea0e Bring back "Use numeric identifiers when building a bundle"
Summary:This brings back "Use numeric identifiers when building a bundle", previously backed out.
This version passes on the correct entry module name to code that decides transform options.

Original Description:
Since the combination of node and haste modules (and modules that can be required as both node and haste module) can lead to situations where it’s impossible to decide an unambiguous module identifier, this diff switches all module ids to integers. Each integer maps to an absolute path to a JS file on disk.

We also had a problem, where haste modules outside and inside node_modules could end up with the same module identifier.

This problem has not manifested yet, because the last definition of a module wins. It becomes a problem when writing file-based unbundle modules to disk: the same file might be written to concurrently, leading to invalid code.

Using indexed modules will also help indexed file unbundles, as we can encode module IDs as integers rather than scanning string IDs.

Reviewed By: martinbigio

Differential Revision: D2855202

fb-gh-sync-id: 9a011bc403690e1522b723e5742bef148a9efb52
shipit-source-id: 9a011bc403690e1522b723e5742bef148a9efb52
2016-03-14 16:17:20 -07:00
Martín Bigio 44f7df4432 Sourcemaps support for RAM
Summary:This rev adds support for production sourcemaps on RAM.

When we inject a module into JSC we use the original `sourceURL` and specify the `startingLineNumber` of the module relative to a "regular" bundle. By doing so, when an error is thrown, JSC will include the provided `sourceURL` as the filename and will use the indicated `startingLineNumber` to figure out on which line the error actually occurred.

To make things a bit simpler and avoid having to deal with columns, we tweak the generated bundle so that each module starts on a new line. Since we cannot assure that each module's code will be on a single line as the minifier might break it on multiple (UglifyJS does so due to a bug on old versions of Chrome), we include on the index the line number that should be used when invoking `JSEvaluateScript`. Since the module length was not being used we replaced the placeholder we have there for the line number.

Reviewed By: javache

Differential Revision: D2997520

fb-gh-sync-id: 3243a489cbb5b48a963f4ccdd98ba63b30f53f3f
shipit-source-id: 3243a489cbb5b48a963f4ccdd98ba63b30f53f3f
2016-03-13 11:14:32 -07:00
Martín Bigio c46d6cc239 Avoid hardcoding platform on blacklist
Reviewed By: davidaurelio

Differential Revision: D3042906

fb-gh-sync-id: 4a424ef1012d75d06c830b284806aefd1556ff74
shipit-source-id: 4a424ef1012d75d06c830b284806aefd1556ff74
2016-03-12 10:59:26 -08:00
David Aurelio 0fe44bd1ab Remove debug code from tests + re-enable tests
Reviewed By: bestander

Differential Revision: D3040961

fb-gh-sync-id: 4e49334fb1d3f80f7a701b88088011f33cb9df6e
shipit-source-id: 4e49334fb1d3f80f7a701b88088011f33cb9df6e
2016-03-11 06:39:25 -08:00
Janic Duplessis ec24c63e86 Update node-haste and replace fast-path with node-haste's version to fix Windows compatibility
Summary:This is the last bits needed to fix Windows compatibility on master, most of the work was done in node-haste.

**Test plan**
Run npm test
Run the packager using Windows and Mac

cc cpojer davidaurelio
Closes https://github.com/facebook/react-native/pull/6260

Reviewed By: dmmiller, bestander

Differential Revision: D3005397

Pulled By: davidaurelio

fb-gh-sync-id: e16847808ebfa8b234315b2093dba204c9c1e869
shipit-source-id: e16847808ebfa8b234315b2093dba204c9c1e869
2016-03-11 06:00:30 -08:00
David Aurelio c17a8e48cf Make order of bundle transports deterministic
Summary:After starting to minify off the main process, the order of module transport objects in `Bundle` instances became less deterministic.
These changes guarantee that module transports appear in addition order, not in order of minification completion.

Reviewed By: bestander

Differential Revision: D3029588

fb-gh-sync-id: 80e83c05d7f78ed7e69583d7e3aa2831bd5ae4d0
shipit-source-id: 80e83c05d7f78ed7e69583d7e3aa2831bd5ae4d0
2016-03-09 08:30:21 -08:00
Kureev Alexey 4a5cbbbec8 Replace underscore by lodash
Summary:As far as we agreed to merge `rnpm` into react-native core, we need to align our dependencies to exclude duplications. One of the steps forward would be to use the same utilities library. According to the thread on fb, everybody is fine with replacing underscore by lodash (which we use internally for rnpm).

So, here we go!

cc mkonicek davidaurelio grabbou

**Test plan**
```
$ npm test
```
![image](https://cloud.githubusercontent.com/assets/2273613/13173972/ee34c922-d700-11e5-971b-68ff7322b6d6.png)

**Code formatting**

Changes are aligned with the current [style guide](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#style-guide).
Closes https://github.com/facebook/react-native/pull/6030

Differential Revision: D3016271

Pulled By: davidaurelio

fb-gh-sync-id: c4f6776a7de7470283d3ca5a8b56e423247f5e45
shipit-source-id: c4f6776a7de7470283d3ca5a8b56e423247f5e45
2016-03-09 03:09:44 -08:00
David Aurelio faaafd771e Make uglify not append //# sourceMappingURL=
Summary: We also need a more recent version of uglify that supports this

Reviewed By: martinbigio

Differential Revision: D3024959

fb-gh-sync-id: f9efdddceda4f726567c39884c844a8e74e6e09d
shipit-source-id: f9efdddceda4f726567c39884c844a8e74e6e09d
2016-03-08 12:22:31 -08:00
David Aurelio 3f072d22ea Don't rebuild bundles automatically on file changes
Summary: Don’t rebuild bundles automatically after they have been requested once. This helps to not lock developer machines.

Reviewed By: martinbigio

Differential Revision: D3019751

fb-gh-sync-id: 98367b4fb89c5ae22c00444eabc1194ba6832dba
shipit-source-id: 98367b4fb89c5ae22c00444eabc1194ba6832dba
2016-03-08 10:44:38 -08:00
David Aurelio 3e1708bcc3 transform before extracting dependencies
Summary:Make packager transform files before extracting their dependencies.

This allows us to extract dependencies added by transforms (and to avoid including them manually).

It also allows for better optimization and to get rid of the “whole program optimization” step:
This diff utilizes the new worker introduced in D2976677 / d94a567 – that means that minified builds inline the following variables:

- `__DEV__` → `false`
- `process.env.NODE_ENV` → `'production'`
- `Platform.OS` / `React.Platform.OS` → `'android'` / `'ios'`

and eliminates branches of conditionals with constant conditions. Dependency extraction happens only after that step, which means that production bundles don’t include any modules that are not used.

Fixes #4185

Reviewed By: martinbigio

Differential Revision: D2977169

fb-gh-sync-id: e6ce8dd29d1b49aec49b309201141f5b2709da1d
shipit-source-id: e6ce8dd29d1b49aec49b309201141f5b2709da1d
2016-03-08 09:51:26 -08:00
David Aurelio 0bdf452803 Un-blacklist fbjs
Summary: Blacklisting is no longer necessary, as fbjs is not used for haste module resolution any longer

Reviewed By: yungsters

Differential Revision: D3014257

fb-gh-sync-id: 39a0397e6b07bdff3dba9d48d58f4254c43eb6b6
shipit-source-id: 39a0397e6b07bdff3dba9d48d58f4254c43eb6b6
2016-03-04 17:05:40 -08:00
David Aurelio 41aeaec16f Use `invariant` from fbjs everywhere
Reviewed By: yungsters

Differential Revision: D3002422

fb-gh-sync-id: c7d308e6cfc717726dbbc43a2462fdabb052b2fe
shipit-source-id: c7d308e6cfc717726dbbc43a2462fdabb052b2fe
2016-03-02 17:14:30 -08:00
David Aurelio cbbe2a707e Fix breakages caused by switch to fbjs
Summary: This fixes a couple of breakages introduced by the switch to fbjs

Reviewed By: bestander

Differential Revision: D3000078

fb-gh-sync-id: 2971d049030f754d5001f6729716373a64078ddf
shipit-source-id: 2971d049030f754d5001f6729716373a64078ddf
2016-03-02 08:26:33 -08:00
David Aurelio d13b75794f limit number of workers
Summary:This limits the number of spawned transformation workers depending on the number of available cores (`n`):

```
n < 3   → n
n < 8   → floor(3/4 * n)
n < 24  → floor(3/8 * n + 3) // factor going from 3/4 to 1/2
n >= 24 → floor(n / 2)
```

Reviewed By: bestander

Differential Revision: D2999894

fb-gh-sync-id: 0163240b5f066432f9ba07161c0dfa2ec767ba58
shipit-source-id: 0163240b5f066432f9ba07161c0dfa2ec767ba58
2016-03-02 07:31:42 -08:00
David Aurelio a8a501b5cf Remove knowledge of fbjs from the packager
Summary:Follow-up to https://github.com/facebook/react-native/pull/5084

This…
- changes all requires within RN to `require('fbjs/lib/…')`
- updates `.flowconfig`
- updates `packager/blacklist.js`
- adapts tests
- removes things from `Libraries/vendor/{core,emitter}` that are also in fbjs
- removes knowledge of `fbjs` from the packager

Closes https://github.com/facebook/react-native/pull/5084

Reviewed By: bestander

Differential Revision: D2926835

fb-gh-sync-id: 2095e22b2f38e032599d1f2601722b3560e8b6e9
shipit-source-id: 2095e22b2f38e032599d1f2601722b3560e8b6e9
2016-03-02 04:28:38 -08:00