Summary: Upgrades uglify to version 3 with (experimental) ES6 support turned on.
Reviewed By: cpojer
Differential Revision: D5227245
fbshipit-source-id: db8638eebe2daf40b60570cac34905e9a7288705
Summary: I wanted to settle #18056064 once and for all. This solution both uses (1) random generation of temp dir, and (2) minimal overhead in the repo. The reason random generation of temporary folder directory names should always be used is the same as why [`mktemp(3)` should never be used](http://man7.org/linux/man-pages/man3/mktemp.3.html#BUGS). The reason we don't want the cache to be fully stored locally (2) is because watchman would catch too many change events we don't care about, hitting performance. Additionally, (1) has the benefit that when one clones the repo from fresh, it'll also always start with a fresh cache. (1) uses a function equivalent to [`mkdtemp(3)`](http://man7.org/linux/man-pages/man3/mkdtemp.3.html), that we cannot use here because it's POSIX and not exposed by the Node.js API.
Reviewed By: davidaurelio
Differential Revision: D5199698
fbshipit-source-id: a660ebbc470e1fe90ed1ab9d0c9fda063b06f90c
Summary: Puts all invocations of `uglify.minify` into one place to facilitate the upgrade to Uglify 3
Reviewed By: cpojer
Differential Revision: D5218415
fbshipit-source-id: 8085255205f80bfda06e0092c9e268a85947763b
Summary: Moves type definitions for uglify and babel from React Native to Metro Bundler. We need it there.
Reviewed By: cpojer
Differential Revision: D5217795
fbshipit-source-id: 9ec349cd8caf077eaa3c6fa3d090ffd47893e967
Summary: Makes it so that flow ignores `build/` directories throughout the code base
Reviewed By: cpojer
Differential Revision: D5217522
fbshipit-source-id: 1f3f0363e21b8bf504d31380e4a63c895c600f55
Summary: The 'class' suffix was just to workaround case-insensitivity on macOS.
Reviewed By: cpojer
Differential Revision: D5208747
fbshipit-source-id: 46bff156145880b9a894ff70b0c3dff0895a6d6c
Summary:
The 'fs' mock was set up to require 'graceful-fs', which used to delegate to the corresponding mock. After turning off automocking, this no longer necessarily works.
This moves the mock to `fs.js` and makes the mock for graceful-fs require the fs mock via a relative path.
Reviewed By: cpojer
Differential Revision: D5209130
fbshipit-source-id: d468577e09d18382d0b9602ad0964dd880ec2366
Summary: That should improve the hit rate a little bit, notably for the cache-filling script. On OSS side, this changeset only adds the sleep() function as `FBGlobalTransformCache` is not exposed.
Reviewed By: cpojer
Differential Revision: D5201196
fbshipit-source-id: c2d8e1a1b03edd9e7747b3202c574b0783f4117d
Summary: We don't actually need this object anymore, just the function to test a file existence. This simplification allows us to phase out the 'old' HasteFS object easier, as well as adding retry logic using the real filesystem.
Reviewed By: cpojer
Differential Revision: D5208550
fbshipit-source-id: a03317e4385d793643e2dbee5d6782491d20e33c
Summary: We are flipping the switch all over Facebook, now that this part of the code is isolated we can do it in Metro as well.
Reviewed By: davidaurelio
Differential Revision: D5199449
fbshipit-source-id: 20c1bacc6dd2d314bd76bc5cc0ecd13266bf81c6
Summary: This is a basic README for the new repo. We'll eventually expand on this as more pieces get open sourced and we'll evolve the three identifying tags over time.
Reviewed By: jeanlauliac
Differential Revision: D5172314
fbshipit-source-id: 8e5dd8567eadbcb839ee9860a22929fd6a77ee2e
Summary:
The packager dependencies CLI command always operates on --dev=true today. This means any tooling that needs to get the production dependencies (--dev=false) will always get the dev-mode list instead. For instance:
```
if (__DEV__) {
require('Foobar');
}
```
Previously, `Foobar.js` will always be listed in the CLI output. With this change, setting `--dev false` option will correctly skip `Foobar.js` in the output.
Reviewed By: cpojer
Differential Revision: D5163184
fbshipit-source-id: 203221ee5d6ecb7df575442f12f6c4c489bfbd46
Summary: This should fix the e2e test for OSS.
Reviewed By: cpojer
Differential Revision: D5164267
fbshipit-source-id: d858b4811f0eb80ca7363177f4f384b66af13994
Summary: I want to untangle `ResolutionRequest` once and for all, that starts by pulling stuff out :-)
Reviewed By: cpojer
Differential Revision: D5155316
fbshipit-source-id: a46ee9b40c6705edcac169adcfdffe25058ec810
Summary: This fixes a longstanding bug that happens when 2 bundles with the same entry path but different options (dev, minify, etc.) get mixed up in the reporting. To prevent that we just use a unique build ID for each bundle that the Server handles separately.
Reviewed By: cpojer
Differential Revision: D5147049
fbshipit-source-id: da5c9cfe8c6a5d888b5be737947800d213081d86
Summary: By getting rid of callbacks, we get a code that's pretty halved in size, and much easier to read, but we also fix bugs! When some of the code of Module would throw, we wouldn't catch it, meaning that packager would crash entirely. That's the case for when we have a Haste name mistach, for example. This changeste fixes that by instead capturing exceptions through the Promise chain, that bubble up all the way to the `Server` and reasonnably handled. People can then fix the Haste nane mismatch and refresh right away, and it'll work as expected.
Reviewed By: davidaurelio
Differential Revision: D5137408
fbshipit-source-id: b9e938b93e8d23738af49106bbae1fce97d7a5db
Summary: I'd like us to start having some decent testing at the packager/bundler level to check that there are no major breakage hapenning. This changeset introduce a simple test that just test the `buildBundle` public API. On the same model, I'd like to test the server API and behavior, and things such as hot module reloading. I hope this will also highlight the gross inconsistencies of the API, for example the Bundle/BundleBase hierarchy, that we can proceed to fix later.
Reviewed By: davidaurelio, cpojer
Differential Revision: D5121817
fbshipit-source-id: e0f3758c7fbb7a85cf51fb3cbc34c12d5374b7d3
Summary:
Code generation for indexed RAM bundles did not append module ID and dependencies. This fixes that.
Eventually, we only want to have the call to `addModuleIdsToModuleWrapper` in one place.
Reviewed By: jeanlauliac
Differential Revision: D5129255
fbshipit-source-id: 7f6148dd607bbf7c97e9df7936a07bde3f05b3aa