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
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
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
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
Summary: This adds flow types to new code written for the Buck/Packager integration.
Reviewed By: cpojer
Differential Revision: D4175156
fbshipit-source-id: 38c3d2c9176c7b3cf22b8baed7d445a75d033d04
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
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
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
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
Summary:
This PR tells babel where the babelrc file is if it has been found in the project root. I know you guys are relying on babel to find it when you tell babel the filename and sourceFilename, this works fine in normal js/node projects, here is an example where this will not work.
We have a big repo that can contain a few react-native / js projects. Our build system is similar to BUCK and we keep our third party dependencies in a separate folder (having a global package.json at the project route is not feasible as everyone will have to install every apps dependencies even when they don't need them), the structure looks a bit like this:
`third_party/js/.` packages from node_modules
`common/js/` common code used by numerous apps, common components, services etc.
`my_app/native` the app
What's happening is something from `my_app/native` (where the .babelrc file is) is requiring something from `common/js` which is then requiring something from `third_party/js` and so babel has no idea what .babelrc file to use and
Closes https://github.com/facebook/react-native/pull/8131
Differential Revision: D4167844
Pulled By: hramos
fbshipit-source-id: 3569981e26ff8f8c632d8ae365a1f43a3483b13b
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
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
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
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
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
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