Summary:
It appears this is not needed to build or anything, only for metro-bundler itself.
Closes https://github.com/facebook/metro-bundler/issues/20.
Reviewed By: cpojer
Differential Revision: D5370513
fbshipit-source-id: 563b5716ca9ab1b58fc7ae1f757efc61cf946168
Summary: Restores the ability to write the expected header for indexed RAM bundles by avoiding to stringify buffers as utf8. Some minor cleanups included
Reviewed By: javache
Differential Revision: D5351839
fbshipit-source-id: 056661b064336ff74571b9f44c16d709fc59145b
Summary:
Remove our internal docbloc module and use `jest-docblock` instead.
The development server is using `jest-haste-map` exclusively, which in turn relies on `jest-docblock`, which differs slightly from our own docblock module.
Depending on only one version greatly reduces the number of edge cases
Reviewed By: cpojer
Differential Revision: D5328472
fbshipit-source-id: 4a31d8159519e01a83fda04b76e8f14f0beb16af
Summary:
Trims doc block annotations. This mitigates problems with leading and trailing spaces in `providesModule` annotations.
This module doesn’t have tests, but it is exclusively used for `providesModule` annotations right now.
Reviewed By: mjesun
Differential Revision: D5319814
fbshipit-source-id: de55df5b4b199738f9b01151eb86f3c863485b15
Summary:
Node v4 support has been broken for some time, with CircleCI failing tests. That's because it needs an additional transform for the spread operator in call position. Ex `foo(...smth)` expanding to `foo.apply(null, smth)`. Also, the build script was using syntax not supported by Node v4.
This changeset fixes the build script, and adds the missing transform. This will be used both for jest test and for the produced production output. This is needed for prod output since we want it to be able to be ran on Node v4 out-of-the-box.
CircleCI will confirm these changes work properly on all supported versions of Node.
Closes https://github.com/facebook/metro-bundler/pull/16
Differential Revision: D5319746
Pulled By: davidaurelio
fbshipit-source-id: 6c001b562b43da0625d1ac15d018117524970431
Summary: Upgrade metro-bundler to v0.9.0. This version has no functional change. The only change is that the structure of the npm package reflects the structure of the source code.
Reviewed By: bestander
Differential Revision: D5315651
fbshipit-source-id: 3a69337106d4ccf708823c80d304941973360e8e
Summary: Given a file `test.android.png`, this allows it to be found as `test.android` for arbitrary platforms.
Reviewed By: bestander
Differential Revision: D5305807
fbshipit-source-id: d869a1da0cc502f853314790385734897f269d6a
Summary:
We use custom npm scripts (`prepare-release`, `cleanup-release`) to
- move `src` to `src.orig`, and `build` to `src` before creating the tarball
- move everything back afterwards
We run these scripts with lerna before and after publishing. Custom hooks avoid problems with `prepublishOnly` and `postpublish` not being run at opportune times, `prepack` and `postpack` not being supported by npm v4 and yarn, and using `lerna run prepublishOnly` resulting in duplicated execution of the command.
This ensures that development is closer to what is pulled in from npm.
Reviewed By: jeanlauliac
Differential Revision: D5310133
fbshipit-source-id: 6b9885c88b936ef3fe5f1858738ad63d581a8731
Summary:
This makes it a little more convenient to dynamically load font files. We currently do with help from the "assetExts" config flag and find that we specify it a lot. Would you be interested in taking this PR?
Closes https://github.com/facebook/metro-bundler/pull/14
Differential Revision: D5284158
Pulled By: jeanlauliac
fbshipit-source-id: d102cf4776b9e3659c33e15d9d72f7ea0ea52d57
Summary:
With these last fixes, the test is now finishing properly instead of hanging up forever! This means tests should now hopefully pass on CircleCI, amazing!
I had to disable a test that was actually broken, I'd like to fix that in a separate changeset.
Reviewed By: davidaurelio
Differential Revision: D5282917
fbshipit-source-id: d61b13ed40da7cd43a542ad916158a2aefecda18
Summary:
We use a custom rn-cli.config.js file that specifies a custom blacklist. In addition to blacklisting some of our own directories, we still want to keep RN's default rules for what to blacklist so we also call into the packager's blacklist.
Closes https://github.com/facebook/metro-bundler/pull/13
Differential Revision: D5275117
Pulled By: davidaurelio
fbshipit-source-id: 0ad79fa47b8730af5a2c4e9ecbedf02b7d673b6c
Summary: Use `processDgraph` so that the instance is properly ended. Tested using `yarn jest DependencyGraph-test`
Reviewed By: davidaurelio
Differential Revision: D5274139
fbshipit-source-id: 82e919e0f7248ddd01de9c8fa3908c3943184016
Summary: Use `processDgraph` so that the instance is properly ended. Tested using `yarn jest DependencyGraph-test`
Reviewed By: davidaurelio
Differential Revision: D5274137
fbshipit-source-id: d4f46d9b2c02622c81bd178c2b76c9cea89b6dd0
Summary: Use `processDgraph` so that the instance is properly ended. Tested using `yarn jest DependencyGraph-test`
Reviewed By: davidaurelio
Differential Revision: D5274132
fbshipit-source-id: 9a19482f969f105d4e2ec6dffc5ae901a5a7da32
Summary:
**Summary**
fixes edge case for replacing browser "main" field, when "main" field value is a file name rather than a file path
**Test plan**
added breaking test in 1st commit, fix in 2nd commit
Closes https://github.com/facebook/metro-bundler/pull/3
Reviewed By: cpojer
Differential Revision: D5255292
Pulled By: jeanlauliac
fbshipit-source-id: 65764144adfcda9f6dbdf8f5f754186b05e1a8bb
Summary: Makes `babel-preset-react-native` a factory function that allows to include/exclude dev tool transforms per transform.
Reviewed By: jeanlauliac
Differential Revision: D5237158
fbshipit-source-id: aa7be0fc0f471575b4ee1c5a0e266e2ed2477fc6
Summary:
`retainLines` is no longer necessary with the much improved source map generation.
`sourceMaps` is handled by the transformer itself.
Reviewed By: cpojer
Differential Revision: D5237103
fbshipit-source-id: e5c6bf5aa9d553fce9c3f4d59b3ea0057d45cfdc
Summary: The `DependencyGraph-test` hangs forever if run in isolation because the watch mode is not properly ended. I propose we just wrap each test in a function that does the correct thing, and also migrate tests to `async`/`await`.
Reviewed By: cpojer
Differential Revision: D5245477
fbshipit-source-id: ea30c0e637e0c7b85afe4c76c5e985846ae9b243
Summary: `worker.transformCode` is a callback-taking function, but did not properly guard against errors thrown in its body.
Reviewed By: cpojer
Differential Revision: D5245253
fbshipit-source-id: 3fd08b68dd8605f664b316652ebd1f9497b2dac9
Summary: That happens after a reboot on macOS for example, because temp dir is wiped.
Reviewed By: davidaurelio
Differential Revision: D5236249
fbshipit-source-id: be19cd97a7488850e3195b3fc419779ed0df2c38
Summary:
This diff cleans up some cruft and adds some features:
* It removes the usage of an env variable to control workers.
* It removes the lazy and handwavy calculation on how many workers to use for jest-haste-map. Jest itself uses the maximum amount of workers available and it has never been reported as an issue – especially since it is a one-time startup cost of about 3 seconds on a cold cache only.
* It adds a `--max-workers` flag to replace the env variable. This one is able to control both the number of workers for `jest-haste-map` as well as the transformers.
* It makes the transformers run in the parent process if 1 or fewer workers are are specified. This should help with debugging.
Once you approve this diff, I will publish a new version of metro to npm and update the version used in RN and remove the use of the env variable altogether: https://our.intern.facebook.com/intern/biggrep/?corpus=xplat&filename=&case=false&view=default&extre=&s=REACT_NATIVE_MAX_WORKERS&engine=apr_strmatch&context=false&filter[uninteresting]=false&filter[intern]=false&filter[test]=false&grep_regex=
Note: the process of adding a CLI option is really broken. Commander also has a weird API. We should consider building a better public API for Metro and then consider how to build a new CLI on top of it and simplify our internal integration. I really don't like how Metro is integrated across pieces of the RN cli in ways that is hard to manage. But that is a larger task for another time :)
Reviewed By: jeanlauliac
Differential Revision: D5217726
fbshipit-source-id: 74efddbb87755a9e744c816fbc62efa21f6a79bf
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