Commit Graph

676 Commits

Author SHA1 Message Date
Gabe Levi 368ef3ef4b Deploy v0.36.0
Reviewed By: zertosh

Differential Revision: D4237912

fbshipit-source-id: cc251884350ffa3c8715a4920f90bd301e8a9b7f
2016-11-28 10:13:31 -08:00
David Aurelio 64c1205838 BREAKING: expose `getTransformOptions` directly in configuration
Summary:
Instead of exposing a `getTransformOptionsModulePath` function in configurations, we can simply expose a `getTransformOptions` *function*. The necessity of exposing a path comes from the olden days, where we had a server listening on a socket, and a client, talking to that server.

Since that architectural gem no longer exists, we can use functions directly, rather than passing paths to modules around.

Reviewed By: cpojer

Differential Revision: D4233551

fbshipit-source-id: ec1acef8e6495a2f1fd0911a5613c144e8ffd7c3
2016-11-28 07:28:33 -08:00
David Aurelio fb9d114861 Simplify contract of `getTransformOptionsModulePath`
Summary:
instead of passing the `Bundler` instance, the transform options module now receives a `getDependencies()` function.
The idea is to make the contract stricter, to integrate more easily with the new `ModuleGraph` system.

Reviewed By: cpojer

Differential Revision: D4233529

fbshipit-source-id: 1c6d462c7dae1c61cbf45fd13989ce77f76e7384
2016-11-28 07:28:33 -08:00
Pieter De Baets 2be362b017 Stop silently failing for requires on Android
Reviewed By: bestander

Differential Revision: D4237195

fbshipit-source-id: 51266664a3693d8e942e97ffd0b0ddc7ada74819
2016-11-28 05:58:27 -08:00
penx 59f870b0f6 Fix to spelling in error message
Summary: Closes https://github.com/facebook/react-native/pull/11149

Differential Revision: D4234240

fbshipit-source-id: 8664f9950d4ab78a87f1d23c84073e74b21a5126
2016-11-26 14:58:26 -08:00
Jean Lauliac 158da01d26 packager: add GlobalTransformCache
Reviewed By: davidaurelio

Differential Revision: D4175938

fbshipit-source-id: 1f57d594b4c8c8189feb2ea6d4d4011870ffd85f
2016-11-24 09:58:31 -08:00
David Aurelio a810087624 BREAKING kill deprecated asset support
Summary:
This removes support for `require('image!…')`, which has been deprecated for a long time.

It is still possible to use images that are already bundled by the native app using the `nativeImageSource` module.
Check http://facebook.github.io/react-native/docs/images.html for detailed documentation.

Reviewed By: matryoshcow

Differential Revision: D4231208

fbshipit-source-id: 05ec4c1ca0fabdc3fbb652f8ad1acdf240a67955
2016-11-24 05:43:38 -08:00
Ovidiu Viorel Iepure 1b8582a2d1 Packager version in logs
Summary: Add Packager version to log entries.

Reviewed By: davidaurelio

Differential Revision: D4212961

fbshipit-source-id: 96036eb2dc70d959108ef5a3a14c58643aba5349
2016-11-24 04:43:26 -08:00
David Aurelio bb1279694b Bring back programmatic packager API
Summary:
Brings back parts of the programmatic API removed in 7762f374d50d3b1df8513c826862c2056e8718f9. This is used by a few people. Also updates the docs accordingly.

cc akaila

Reviewed By: jeanlauliac

Differential Revision: D4226348

fbshipit-source-id: e5c0794f9c5415f14b54d16c6f35f902eafc3064
2016-11-23 06:28:28 -08:00
alex 719126bae2 Caching assets only for production environment
Summary:
**Motivation**

In the context of a webview, one may extract assets (javascript or any types really), and relates to them through the html.

The packager `Server` serves this files correctly but also applies a cache based on time (a year). During development, this cache is actually bad as we need to re-iterate the process of editing/testing quickly.

I don't believe it is necessary to cache, and still wanted to make sure we would if process.env.NODE_ENV is 'production'.

**Test plan**

Run jest on impacted files:
```
node_modules/.bin/jest packager/react-packager/src/Server/__tests__/Server-test.js
```
Closes https://github.com/facebook/react-native/pull/10919

Differential Revision: D4226350

Pulled By: davidaurelio

fbshipit-source-id: d4bbff5b1a5b691aab197bcddb8fa9d2e43caa16
2016-11-23 04:58:31 -08:00
David Aurelio 7d998e6f58 Add flow types for output modules
Summary: Adds flow types for output functionality for easier maintenance and interop with new code

Reviewed By: matryoshcow

Differential Revision: D4211863

fbshipit-source-id: 591407d3a6d49536054ae94ba31125c18a1e1fa1
2016-11-21 13:28:30 -08:00
Ovidiu Viorel Iepure 038cfa8ebe Logger API error handling improvement
Summary: Defer Logger calls to the next tick queue so as to avoid potential Logger errors from falling under the purview of Promise error handling, which would degrade development experience by "swallowing" legitimate runtime errors within rejected promises, to the infuriation of us all :D

Reviewed By: davidaurelio

Differential Revision: D4197869

fbshipit-source-id: 10a44904be1404ad2534d06ddc56048c1c24f32b
2016-11-21 05:58:27 -08:00
Tim Yung 40c3857d23 RN: Cleanup OSS JS & Flow Declarations
Reviewed By: vjeux

Differential Revision: D4210763

fbshipit-source-id: 5abaa547100b8badd13bcf311ceffc5b4098d252
2016-11-20 17:58:29 -08:00
David Aurelio 4c74a3fe2e Handle transform problems correctly
Summary: This fixes a piece of promise code that didn’t handle nested rejections. This caused the packager not to recover from transform errors, as the server was waiting for an in-limbo promise forever.

Reviewed By: cpojer

Differential Revision: D4207138

fbshipit-source-id: 8e94ddebd033073f90b79b1c4820c09ac98a4932
2016-11-18 20:43:28 -08:00
David Aurelio 2c0a1e1f00 Updates to node-haste adapter
Reviewed By: matryoshcow

Differential Revision: D4197864

fbshipit-source-id: 31bc4b0fb51ea77fac09fdd0f8180e984e05087a
2016-11-17 11:13:30 -08:00
David Aurelio 1c16124e1c Add tests for worker code
Summary: This adds unit tests for the new buck worker code, including a test for source map generation.

Reviewed By: cpojer

Differential Revision: D4193657

fbshipit-source-id: 06f7bfb5efa4f411178543a728ac7e42511caa3c
2016-11-17 08:58:55 -08:00
David Aurelio 7181a2d436 add flow
Summary: This adds flow types to new code written for the Buck/Packager integration.

Reviewed By: cpojer

Differential Revision: D4175156

fbshipit-source-id: 38c3d2c9176c7b3cf22b8baed7d445a75d033d04
2016-11-17 08:58:55 -08:00
David Aurelio 907f08a794 Use array lookup for localized dependency IDs
Summary:
The current transform for require calls replaces strings with module-local IDs. That means that each module would need a local require function.
To save hundreds of closure allocations, we can just use an array that maps local IDs to global IDs.

This diff changes the dependency collection and replacement transform to change a call like `require('React')` to something like `require(_dependencyMap[0])` rather than `require(0)`.

Reviewed By: cpojer

Differential Revision: D4153714

fbshipit-source-id: a63455834c6c2a75da6977cacb9aac9f2cb1b3aa
2016-11-17 08:58:55 -08:00
Jean Lauliac 06de9b9a93 packager: DependencyGraphHelpers: @flow
Reviewed By: cpojer

Differential Revision: D4190148

fbshipit-source-id: 320496bb683288a19605bd667de1472c7fc9c6b4
2016-11-17 05:13:27 -08:00
Christoph Pojer d96e125d39 New file watching implementation
Summary:
This is the next incremental step to rewrite node-haste. I apologize for the size of this diff but there is really no smaller way to do this. The current architecture passes a single file watcher instance into many classes that each subscribe to file changes. It's really hard to keep track of this. The new implementation reduces the listeners to two (will eventually be just one!) - one in DependencyGraph and one in it's parent's parent's parent (ugh! This doesn't make any sense). This should make it much more straightforward to understand what happens when a file changes.

I was able to remove a bunch of tests because jest's watcher takes care of things like ignore patterns. Some of the tests were specifically testing for whether the change events were invoked and they are now much more straightforward as well by manually invoking the `processFileChange` methods.

(Relanding a fixed version of D4161662)

Reviewed By: kentaromiura

Differential Revision: D4194378

fbshipit-source-id: 8c008247a911573f6b5f6b0b374d50d38f62a4f5
2016-11-16 20:13:26 -08:00
Jean Lauliac dfd9713fce packager worker: more @flow
Reviewed By: matryoshcow

Differential Revision: D4160528

fbshipit-source-id: 5f43cb47717288c5344c1204cf435ec727ca752e
2016-11-16 10:43:25 -08:00
Martin Konicek 855a74d2b1 Revert D4161662: [RNP] New file watching implementation
Differential Revision: D4161662

fbshipit-source-id: 00604387b4f4b808f95275458f1c653981f91b86
2016-11-16 10:28:31 -08:00
Christoph Pojer f50b4d7876 New file watching implementation
Reviewed By: davidaurelio

Differential Revision: D4161662

fbshipit-source-id: 9a2a399304c83b411a8b0b74ea015c18b599fbaf
2016-11-16 01:13:40 -08:00
Christoph Pojer d207bc32ec Update Jest + jest-haste-map
Reviewed By: voideanvalue

Differential Revision: D4180887

fbshipit-source-id: f6ee6901e63206824f0639c81b64167b66da2168
2016-11-15 06:58:45 -08:00
Andres Suarez 91a409afe6 Remove parse
Reviewed By: davidaurelio

Differential Revision: D4174312

fbshipit-source-id: 024ae3da56c1afd882f808c15a3b90db35627587
2016-11-15 04:59:48 -08:00
Jean Lauliac 77d1ca470d packager: JSTransformer/index.js: @flow
Reviewed By: cpojer

Differential Revision: D4167006

fbshipit-source-id: db0deb2262fe2c53735cb46d9de6e6da1b375180
2016-11-15 04:28:53 -08:00
Jean Lauliac ece4a18d7c packager: DependencyGraph-test: require extractDependencies only once
Reviewed By: davidaurelio

Differential Revision: D4182071

fbshipit-source-id: 622cb3e011b67c2a7df0c6308fbcb7a9ea1ebb96
2016-11-15 03:43:42 -08:00
Jean Lauliac 1afa045dea packager: DependencyGraph-test: mock child_process
Reviewed By: cpojer

Differential Revision: D4182064

fbshipit-source-id: e645e6d952e3aeaadaf35e29d6fcaf6395e590a7
2016-11-15 03:43:42 -08:00
Martin Hernan Giachetti 170ae0a520 Update error-guard.js
Summary:
This vars should be let instead of const because they are reassigned.
Closes https://github.com/facebook/react-native/pull/10818

Differential Revision: D4179219

Pulled By: javache

fbshipit-source-id: b09959c5ff31ad1a896d454011dffd915a0a44c4
2016-11-15 00:13:42 -08:00
Gabe Levi 4fafef79cb Deploy v0.35.0
Reviewed By: davidaurelio

Differential Revision: D4177391

fbshipit-source-id: c02cf98ed275b7032103b11eab6d0e189f8d8f24
2016-11-14 20:45:17 -08:00
Konstantin Raev b64f892210 Revert D4149694: [RN] Update Jest + jest-haste-map
Differential Revision: D4149694

fbshipit-source-id: 65a39bc1d0a0f9e7094ebc8dec9233e432a5e14d
2016-11-14 12:43:51 -08:00
Alexander Paterson 475a0c20f6 Decode URI in asset server
Summary:
Solving this issue https://github.com/facebook/react-native/issues/10364

In development when assets are requested from AssetServer, it tries to find them with URI-friendly filenames. I added a single line to decode these filenames.

Tests are passing. Couldn't find any discussion regarding whether this is a good idea. This was causing some members of my team a bit of grief earlier.
Closes https://github.com/facebook/react-native/pull/10365

Differential Revision: D4168401

Pulled By: hramos

fbshipit-source-id: 9ed3606392d8a6f170998caaf0f9254ba4879b49
2016-11-14 11:43:49 -08:00
Jean Lauliac 6e3e0ff6d7 packager ModuleTransport.js: @flow
Reviewed By: cpojer

Differential Revision: D4166900

fbshipit-source-id: 0b8c1730f00f9a9d4a17586967edae8cbd4f296b
2016-11-11 09:43:48 -08:00
Jean Lauliac 2bf0c037ec packager worker: enable possibility to add Flow annotations
Reviewed By: matryoshcow

Differential Revision: D4160456

fbshipit-source-id: bbc2420126d8e8b725c0b7b359b35f09dfe8c8d6
2016-11-11 05:29:30 -08:00
Jean Lauliac cedf70f702 packager: fix lint
Reviewed By: matryoshcow

Differential Revision: D4160163

fbshipit-source-id: 8eeb7dd83c0d80c1c62b760039615ce97782bd3e
2016-11-11 05:29:30 -08:00
Jean Lauliac f13c4e3d78 packager TransformCache.js: use directory specific to project
Reviewed By: davidaurelio

Differential Revision: D4159761

fbshipit-source-id: 1f4b1bbcf4c4fbb834a672e38cb2cf55f425b28b
2016-11-11 05:13:42 -08:00
Jean Lauliac ee637ee0eb packager worker/index.js: do not write to cache directly
Reviewed By: davidaurelio

Differential Revision: D4159970

fbshipit-source-id: 133ce5797e94a39fe60cbb9983edd561ce7d818e
2016-11-10 09:13:54 -08:00
Jean Lauliac ea8c7ec385 packager Module.js: make transformCode function required
Reviewed By: davidaurelio

Differential Revision: D4147343

fbshipit-source-id: 4c00a5905e698a9d257a632f3b02b63587b4644a
2016-11-10 09:13:54 -08:00
Jean Lauliac 163633a0b6 packager Module.js: remove extractRequires
Reviewed By: davidaurelio

Differential Revision: D4147275

fbshipit-source-id: 7c1d7d16f6b8164d7031963618aeab2857f5d497
2016-11-10 09:13:54 -08:00
David Aurelio 0493002fa3 Various cleanups around polyfill transformation
Summary:
- Put `isPolyfill` parameter into `options` object
- Save information whether a file is a polyfill
- Sort properties alphabetically
- Rename parameters

Reviewed By: cpojer

Differential Revision: D4153203

fbshipit-source-id: 67da97546a15c899112b74da6072acdea18d10e8
2016-11-10 08:13:57 -08:00
Christoph Pojer 5dab7599d3 Update Jest + jest-haste-map
Reviewed By: matryoshcow

Differential Revision: D4149694

fbshipit-source-id: 4f8378c419ddc7978e05dfcf2112e833775391be
2016-11-10 06:28:38 -08:00
Jean Lauliac 31c7108806 packager Module.js: fix concurrency issues
Reviewed By: matryoshcow

Differential Revision: D4159743

fbshipit-source-id: 41515f2a29344b648c4c52100056d2054e3edff7
2016-11-10 05:58:41 -08:00
Wojciech Ogrodowczyk 9773229227 Disallow object assign explanation
Summary:
> Explain the **motivation** for making this change. What existing problem does the pull request solve?

Provides better documentation for a confusing (and common) error message. Solves https://github.com/facebook/react-native/issues/3634

> **Test plan (required)**

This is just an error message shown in dev environment. I ran the tests and they pass.
Closes https://github.com/facebook/react-native/pull/10472

Differential Revision: D4053818

Pulled By: hramos

fbshipit-source-id: e80dc6ab787a8d8cabbcb442c438c07269401ff7
2016-11-10 00:28:31 -08:00
Tim Yung 1fdb99efac RN: Fix Broken Symbolication
Reviewed By: fkgozali

Differential Revision: D4159009

fbshipit-source-id: 6f91428a769db820c49d7300138a06350f52e63e
2016-11-09 22:58:45 -08:00
Ovidiu Viorel Iepure b75dc61a46 Fix lint warnings in JSTransformer
Summary: Fix lint warnings throughout JSTransformer.

Reviewed By: bestander

Differential Revision: D4148161

fbshipit-source-id: ac73a9e3919b1c66fef0e447083b44039900f963
2016-11-09 09:31:12 -08:00
David Aurelio ef448d4fa1 Add support for wrapping polyfills
Summary: This adds support to wrap polyfills differently from regular modules (`(function(global){ ... }(this))` instead of `__d(function...)`.

Reviewed By: cpojer

Differential Revision: D4147031

fbshipit-source-id: c19e968c1498cac653ab2649e3089d8c29571926
2016-11-09 07:43:30 -08:00
Ovidiu Viorel Iepure 3064549bca Fix lint warnings in Bundler index
Summary: Fix lint warnings starting at Bundler index

Reviewed By: davidaurelio

Differential Revision: D4147587

fbshipit-source-id: 6d86bdd4d43a08661498c2bf8b6b21c8c3573d88
2016-11-08 12:28:47 -08:00
Ovidiu Viorel Iepure 5a6d3f99e2 Use native Promises
Summary: Use native Promises in React Native Packager. Remove all the non-standard `Promise.done()` calls throughout the codebase & replace `Promise.denodeify` with the stand-alone `denodeify` module.

Reviewed By: davidaurelio

Differential Revision: D4146965

fbshipit-source-id: 1730531c914863ac3c52626801d9f91c28eed717
2016-11-08 12:28:47 -08:00
Ovidiu Viorel Iepure 5c47289e92 Fix lint warning in Logger
Summary: Fix a lint warning in the Logger.

Reviewed By: davidaurelio

Differential Revision: D4147924

fbshipit-source-id: cd874ebd5f67d85e54c7dc3d9435df9ad672e9fe
2016-11-08 12:13:43 -08:00
Ovidiu Viorel Iepure 159c5d1afb Fix lint warnings in Server implementation
Reviewed By: davidaurelio

Differential Revision: D4148018

fbshipit-source-id: 051cba96b2c4ac74709d45c2b388632122009c84
2016-11-08 11:58:50 -08:00
David Aurelio 101977eb19 improve options parser
Reviewed By: jeanlauliac

Differential Revision: D4146832

fbshipit-source-id: a54284ccc3fa4d6e1628886b748b21b9b9af2cff
2016-11-08 10:13:40 -08:00
Jean Lauliac 3ae8e44f34 packager ResolutionResponse: @flow
Reviewed By: davidaurelio

Differential Revision: D4146739

fbshipit-source-id: 0b8e65dfaa2f28c4498fb17b8d980da9271fe8d6
2016-11-08 04:58:44 -08:00
Jean Lauliac d25047ebf1 declareOpts: @flow
Reviewed By: cpojer

Differential Revision: D4146711

fbshipit-source-id: edd360b3dd8444c7ec5be5c69db97e1e0906a730
2016-11-08 04:58:44 -08:00
Jean Lauliac f1aba3f63b react-packager/src/Bundler/index.js: @flow
Reviewed By: davidaurelio

Differential Revision: D4139968

fbshipit-source-id: dc77ea6f0971b5d378883d89290a773205f97c18
2016-11-08 04:58:44 -08:00
Jean Lauliac c18d46bd03 JSTransformer/worker: cache transformed code as separate files
Reviewed By: davidaurelio, cpojer

Differential Revision: D4051477

fbshipit-source-id: 0179ce18dd20c00083ae05b5cf5f925659e7c056
2016-11-08 03:43:37 -08:00
Andres Suarez 6212c223ec Remove prepack bundle functionality
Reviewed By: davidaurelio

Differential Revision: D4138495

fbshipit-source-id: 52793fc1a8ef8b2fc461156607c360f34c4cb362
2016-11-07 03:43:37 -08:00
Jean Lauliac 403d4ed721 RM node-haste DependencyGraph: @flow
Summary: In addition to adding flow in that file, I also had to fix `Module.js` and others to make everything compatible together.

Reviewed By: davidaurelio

Differential Revision: D4118829

fbshipit-source-id: 4f6dbc515741c38817cc4c9757e981fabb03915a
2016-11-04 10:43:39 -07:00
David Aurelio dee58678c6 Prepare `__d` fn for Buck integration
Summary:
The new Packager/Buck integration passes module factory functions as first argument, so that the complete call can be amended at the end safely at a later point in time.
The call expression as a whole is covered perfectly by the created source map. Appending to that code later won’t break mappings.

`__d` now also accepts an additional `dependencyMap` parameter, which so far is only used by the new Packager/Buck integration. It enables module-local dependency IDs, thus eliminating the need to insert `correct` module IDs when building a bundle. Advantages are that source maps are no longer affected, and that builds can be quicker.

Reviewed By: cpojer

Differential Revision: D4124333

fbshipit-source-id: 12eba15d0b9d8c6624280a2ba1e7e4bc654bc83d
2016-11-04 05:13:44 -07:00
Jing Chen c296a3ee25 Silently fail for requires on Android again until we can fix loading image assets from both repos
Reviewed By: blairvanderhoof

Differential Revision: D4128218

fbshipit-source-id: d743cdb7a73efc2f46c42217a49c6094fcd3808a
2016-11-04 00:58:48 -07:00
mike qin 957ce4baca increase MAX_WAIT_TIME
Summary:
increase the `MAX_WAIT_TIME` in FileWatcher since live reloading doesn't work for a lot of users on windows when developing android. There may be a better timeout than arbitrarily tripling it, I'm sure the original developer would be able to pick out a good one, but many of us have used this change to finally be able to use RN here on windows.

fixes https://github.com/facebook/react-native/issues/8784 https://github.com/facebook/react-native/issues/7257
Closes https://github.com/facebook/react-native/pull/10690

Differential Revision: D4126110

Pulled By: mkonicek

fbshipit-source-id: 9b6f188fe9d39bcdcc2b38392dfc644a518296b2
2016-11-03 18:13:41 -07:00
David Aurelio b184c45275 Make sure that write streams are closed
Reviewed By: jeanlauliac

Differential Revision: D4117716

fbshipit-source-id: c12f07c6a0e016ac14543878491a8b4160099e21
2016-11-03 13:29:10 -07:00
Ovidiu Viorel Iepure 1ac86b2304 File transform events
Summary: Correctly generate log entries for file transforms and ping telemetry using the new Logger API.

Reviewed By: bestander, cpojer

Differential Revision: D4081325

fbshipit-source-id: 7d50d54eb673a0276512db6ad5ff21c344495612
2016-11-03 07:44:10 -07:00
Ovidiu Viorel Iepure 4d23c1f423 Instrumentation API
Reviewed By: cpojer

Differential Revision: D4074413

fbshipit-source-id: fd2dff17168f426680fd9dc8456f8b1ae3f55318
2016-11-03 07:44:10 -07:00
David Aurelio cda4129dd3 Add flow to require implementation, always warn when modules are accepted by name
Reviewed By: matryoshcow

Differential Revision: D4124228

fbshipit-source-id: 461087caf4add07db376bb71ae5ba42bf3536cd3
2016-11-03 05:58:30 -07:00
Jean Lauliac 4ce09ce88a RM Polyfill.js: @flow
Reviewed By: davidaurelio

Differential Revision: D4118256

fbshipit-source-id: b9d906cd94c0548c28a62fa636c6da7bcf894ba9
2016-11-03 04:58:46 -07:00
Jean Lauliac 4fe80636fb RM fastfs.js: @flow
Reviewed By: cpojer

Differential Revision: D4118175

fbshipit-source-id: ad9d1f98bcde0c1be17d36c74c3662e6e55165f8
2016-11-03 04:58:46 -07:00
Jean Lauliac d730928b0c RN Package.js: @flow
Reviewed By: davidaurelio

Differential Revision: D4118006

fbshipit-source-id: ad8fdcb67351a9e53af0a7acbf16f269daf31f50
2016-11-02 13:43:43 -07:00
Jean Lauliac 1baa2ab893 RN ModuleCache.js: @flow
Reviewed By: davidaurelio

Differential Revision: D4117759

fbshipit-source-id: 158f6e50cb9211f87acce17047ed3e959e6c271f
2016-11-02 13:43:43 -07:00
Alexander Blom 94929b717c Add Console agent
Summary: Adds the Console agent which we hook from our console polyfill. It captures the stack and strips the frames of the polyfill.

Reviewed By: davidaurelio

Differential Revision: D4021502

fbshipit-source-id: 49cb700a139270485b7595e85e52d50c9a620db6
2016-11-02 12:29:15 -07:00
Pieter De Baets 5af2bf17bc Stop silently failing for requires on Android
Reviewed By: bestander

Differential Revision: D4117128

fbshipit-source-id: a11996a322d38e884aad2f095342c1ea723b0d89
2016-11-02 08:58:42 -07:00
David Aurelio 05d53084c1 buck worker tool: catch errors thrown from commands, and respond with errors.
Reviewed By: cpojer

Differential Revision: D4057884

fbshipit-source-id: acfe0cc57b541a534dd640380c69f591c1fb83c6
2016-11-01 05:58:43 -07:00
Jean Lauliac d60ac14fd0 extract-dependencies.js: fix out-of-date comment
Summary: We actually use the AST, not regexes. Fix comment.

Reviewed By: davidaurelio

Differential Revision: D4104797

fbshipit-source-id: e37d168bd541d9d222667d0d168aa6b6099c1275
2016-10-31 11:43:37 -07:00
Jean Lauliac d8aab602b2 Module.js: add @flow
Reviewed By: cpojer

Differential Revision: D4095611

fbshipit-source-id: d87509153eab3d8dbcd65b8c6c6ffb3e5746685f
2016-10-31 04:28:29 -07:00
Pooya Parsa be244f3a72 os.tmpDir() is deprecated
Summary:
According to [5e5ec2cd1e](https://github.com/nodejs/node/commit/5e5ec2cd1e) os.tmpDir() is now deprecated in node.js 7 and `os.tmpdir()` is preferred :)

Current status:
Bundler shows annoying warning every time it runs :)
Closes https://github.com/facebook/react-native/pull/10620

Differential Revision: D4101498

fbshipit-source-id: 0de8cc30f684f1f22191c64fa2c7ce73c5abf9ea
2016-10-29 13:59:01 -07:00
Jean Lauliac 3b0d4f4c33 node-haste/Cache: @flow
Reviewed By: davidaurelio

Differential Revision: D4043681

fbshipit-source-id: 8c82b394f4df9bb0d580f405ce472c69224485f5
2016-10-24 10:29:06 -07:00
Ovidiu Viorel Iepure c253a8ba39 Activity session
Summary: Add session ID to be appended to every event in the current Packager session.

Reviewed By: davidaurelio

Differential Revision: D4029580

fbshipit-source-id: 8c34c1f44ee63f845d15f8f89e491ab5c936fb21
2016-10-24 05:43:43 -07:00
David Aurelio f6f2c6259b Break out defaults, add flow for Config
Summary: In order to make `Config` and defaults available to our new code, I’ve added flow types and put default values into one shared modile

Reviewed By: cpojer

Differential Revision: D4044600

fbshipit-source-id: 875ed3ade69c5b22bb3c1b177e7bad732834d476
2016-10-22 06:13:42 -07:00
David Aurelio 74a5b35802 Add support for relative paths to ResolutionRequest
Summary:
This makes ResolutionRequest stop calling `dirname` when arriving at `"."`, not only at `parse(path).root`.
Needed for Buck integration, as we are using relative paths there

Reviewed By: cpojer

Differential Revision: D4058723

fbshipit-source-id: d1856043193cfad3f750577ba0f63f03f8effe7a
2016-10-22 06:13:42 -07:00
Christoph Pojer 18c4ae81e7 Remove fastpath
Summary: I originally added fastpath to node-haste to speed up `path` operations by an order of magnitude. Now we are exclusively using Node 6 at FB so we don't need to ship this thing any more.

Reviewed By: bestander

Differential Revision: D4029092

fbshipit-source-id: 064cf67f4f79ce4f2774fb4e430d22eef4a95434
2016-10-20 00:14:03 -07:00
David Aurelio c16465a582 Create integration types and code to use module resolution logic from node-haste
Summary:
This creates flow types for the module resolution code in node-haste, and implementations of types used by that code.

The idea is to use that code until we can replace it with something leaner, and provide objects that don’t touch the file system. These objects will be initialized with the static data provided by ModuleGraph/worker.

Reviewed By: cpojer

Differential Revision: D4037372

fbshipit-source-id: 2698dbb630f4122fc1d839d06e414d0963bd6ff2
2016-10-19 06:58:39 -07:00
Jean Lauliac 977e7209ac Bundler.js: @flow
Reviewed By: davidaurelio

Differential Revision: D4036964

fbshipit-source-id: dceb81299d076493d12b2ade13354e927c10ea7c
2016-10-19 04:43:41 -07:00
Konstantin Raev c803b69ce1 Reverted commit D4036668
Reviewed By: cpojer

Differential Revision: D4036668

fbshipit-source-id: 5b75709526c3e87774e0943a76d55cd729c6143d
2016-10-18 12:13:36 -07:00
Jean Lauliac f39821c088 BundleBase.js: @flow
Reviewed By: matryoshcow

Differential Revision: D4036938

fbshipit-source-id: 2c151d98f99ab1e325bb07050d0a2c59ee8f4761
2016-10-18 10:29:30 -07:00
Jean Lauliac 2a1c443a36 react-packager/index.js: @flow
Reviewed By: cpojer

Differential Revision: D4036668

fbshipit-source-id: 286963fd1f18f92389ec642c43dcf4c9d55f19f8
2016-10-18 09:28:45 -07:00
David Aurelio 6ac3ae73a3 entry point: remove unused code
Summary: Removes code that is no longer used

Reviewed By: matryoshcow

Differential Revision: D4021932

fbshipit-source-id: d73dc8450478288afd71eab451a30a505e7de945
2016-10-18 07:28:40 -07:00
Christoph Pojer bfc35d528c Synchronous file reading
Reviewed By: matryoshcow

Differential Revision: D4021460

fbshipit-source-id: 88e4846d4434468d68e6071d05b27e3b7d2ed325
2016-10-16 18:43:38 -07:00
Christoph Pojer f53d694120 Remove `fastfs.readWhile`
Reviewed By: davidaurelio

Differential Revision: D4021265

fbshipit-source-id: 578ad54ea5a81e5b091cecafcb2fe6d08746e7f6
2016-10-16 18:43:38 -07:00
Ovidiu Viorel Iepure 5fe2c32cfc Rate limit HasteMap
Reviewed By: davidaurelio

Differential Revision: D4021676

fbshipit-source-id: 383f9a17ac8ede72f41939192ec25a6277a36864
2016-10-14 12:13:41 -07:00
David Aurelio 9383f292aa Monkey-patch `fs` with graceful-fs before anything else runs
Reviewed By: matryoshcow, kentaromiura

Differential Revision: D4020645

fbshipit-source-id: a7985109476b78b588c3e2a75ae6f25ea8f09237
2016-10-14 11:13:54 -07:00
Konstantin Raev bd5f803982 switched fast-fs to use fs for API calls
Summary:
When debugging graceful-fs I noticed that I don't get close() calls https://github.com/isaacs/node-graceful-fs/blob/master/graceful-fs.js#L37.
This is because fastfs uses fs returned from graceful-fs https://github.com/facebook/react-native/blob/master/packager/react-packager/src/node-haste/fastfs.js#L14 and graceful-fs returns close() of a clone object https://github.com/isaacs/node-graceful-fs/blob/master/graceful-fs.js#L27 that is not patched by graceful-fs yet.

Reviewed By: cpojer

Differential Revision: D4021446

fbshipit-source-id: 87e50ff779dfea13b8db2b97575bff0bfd7778eb
2016-10-14 07:47:22 -07:00
David Aurelio 506604c5bb Add support for JSON files to `js_file` rule
Reviewed By: cpojer

Differential Revision: D3981152

fbshipit-source-id: 94b5018a1afa27c635ddff5e26c1ff2bed09baf9
2016-10-13 11:14:04 -07:00
Ovidiu Viorel Iepure dc0f7875c8 Add details to Activity events
Summary: Update Activity API to allow adding more details to events for telemetry purposes.

Reviewed By: davidaurelio

Differential Revision: D3982691

fbshipit-source-id: 07f3ed5d1ec4eddbbdeb00feb02ea75e1168705e
2016-10-12 10:43:59 -07:00
Pieter De Baets 308ab1001e Reorganize core JS files
Reviewed By: lexs

Differential Revision: D3987463

fbshipit-source-id: fa8f1d1bea7ed699120b9705ddc1c83767fcf8e4
2016-10-11 10:14:28 -07:00
Pieter De Baets 89d4f26846 Cleanup console and ErrorUtils
Reviewed By: davidaurelio

Differential Revision: D3981005

fbshipit-source-id: 3c95e62177f78785c7f971dd632126dbfb83746b
2016-10-11 06:58:55 -07:00
David Aurelio 47a7a9ee80 Add `js_file_prod` rule
Reviewed By: matryoshcow

Differential Revision: D3913439

fbshipit-source-id: fe3a30fddb4d8fcabfc88caf9b1b032189812b89
2016-10-05 09:28:50 -07:00
David Aurelio 85b74ab639 Add `js_file` rule
Reviewed By: matryoshcow

Differential Revision: D3900455

fbshipit-source-id: 61384ade035db978ef3ca258e4c0109bcb450692
2016-10-05 09:28:50 -07:00
David Aurelio 92fb9957b4 Implement proper command handling for new worker tool
Reviewed By: matryoshcow

Differential Revision: D3906818

fbshipit-source-id: a192723a16094d3901de40a9914428fd6ff119a2
2016-10-04 02:59:34 -07:00
Alex Kotliarskyi 3d23012d06 Send progress events via multipart response
Summary:
Context: I'm trying to add support for sending packager progress events to the client that is downloading the bundle over HTTP multipart response.

The idea is for the client to send `Accept: multipart/mixed` header, and if present the server will stream progress events to the client. This will ensure the change is backwards-compatible - the clients who don't know about progress events won't receive them.

In the future we can use this approach to download RAM bundle modules in one request.

Reviewed By: davidaurelio

Differential Revision: D3926984

fbshipit-source-id: 39a6e38e40a79f7a2f2cf40765a0655fb13b7918
2016-10-03 18:13:36 -07:00
Alex Kotliarskyi d9797e2de7 Move progress bar from Bundler to Server
Summary:
Context: I'm trying to add support for sending packager progress events to the client that is downloading the bundle over HTTP multipart response.

In order to do that I need the server to know about these events. Currently the bundler doesn't expose any hooks for monitoring the progress, so this diff introduces `onProgress` option for that.

Reviewed By: davidaurelio

Differential Revision: D3926806

fbshipit-source-id: b7d9c649df4f94ddf5082791209844610650325e
2016-10-03 18:13:36 -07:00
Ovidiu Viorel Iepure ecd933e73d Replacing node-haste with jest-haste-map
Summary: Modified `node-haste` implementation to use the much faster `jest-haste-map` under the hood. The underlying `fastfs` now gets passed the entire file list from the `jest-haste-map` rather than crawl the filesystem.

Reviewed By: cpojer

Differential Revision: D3724387

fbshipit-source-id: 447d58ea0edf283662ec23d1e2deee992cf8d240
2016-10-03 05:28:56 -07:00