Summary: I'd like to get rid of the function as blacklist, because it's impossible to process properly at the `jest-haste-map` level (https://github.com/facebook/jest/pull/4047). The reason we use a function in Metro bundler is because we excludes all the `__tests__` modules. However, I removed this exclusion completely, and I could build our package without any problem and with no difference in the final bundle. I can only assume, then, that this line is only here for slightly increasing performance. Therefore, I think it's reasonnable to move it as part of the default blacklist shipped with Metro bundler instead.
Reviewed By: cpojer
Differential Revision: D5434351
fbshipit-source-id: dea39f6299985143d25fcb3b7b365d793acd64a9
Summary: Now we have a nice specific error type for duplicates errors.
Reviewed By: cpojer
Differential Revision: D5433438
fbshipit-source-id: 47cad9ca6bf0bdec91a158ccb2807b6c5571966a
Summary: This put it on par with the version we use on other projects. This new version breaks assumptions about the way Promise/ticks/timers use to work, and I was not able to make it work properly synchronously. Since it's fragile anyway (because rely on Promise and feature internals), I propose the switch to async as done in this changeset. If `res.end` is not called, tests will just timeout instead.
Reviewed By: cpojer
Differential Revision: D5423823
fbshipit-source-id: 015e808a2cf2b8297a36b16feeb811a6e745a835
Summary: Going one step further, we can start working around the throwing version. To simply some code, I also piggybacked the addition of helper functions `resolvedAs` and `failedFor` in this changeset, hope it's okay. I can split if necessary.
Reviewed By: davidaurelio
Differential Revision: D5415196
fbshipit-source-id: 1bd5955b5733866af52fa873bcd1d9e4ce8215cf
Summary:
Adding a Babel plugin that will analyze the file looking for any potential candidate to use `regenerator-runtime`, and if so, will inject dynamically the module. The module is injected per file, so we avoid polluting the global environment. The plugin is also able to inject the `require` call beforehand, so that the inliner can pick them and inline them.
The Babel plugin is part of `react-native-babel-preset`, so as long as you are using this preset you are safe. If not, you should include the specific transformer into your list of plugins, as `react-native-babel-preset/transforms/transform-regenerator-runtime-insertion.js`.
Reviewed By: davidaurelio
Differential Revision: D5321193
fbshipit-source-id: fd4805b28c8a2b986842e23570a64003370d2067
Summary:
This fixes https://github.com/facebook/react-native/issues/14530 on my local repro. The reason the original problem appears is because when requiring the preset itself, what I think is a bug in babel-register kicks in and it starts transforming the presets themselves. That fails because these preset don't actually have the correct transforms plugins installed/specified in their `package.json` (they do it at prepublish time).
Closes https://github.com/facebook/metro-bundler/pull/21
Reviewed By: cpojer
Differential Revision: D5380795
Pulled By: jeanlauliac
fbshipit-source-id: 023fd6b36dc7ebd26961878edd71d423ea9856b5
Summary: Bump dependencies to the same version that react native uses
Reviewed By: jeanlauliac
Differential Revision: D5364009
fbshipit-source-id: 302db951a5509584da13a18a7fab6965e0b1e394
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