New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add transformOptions to each graph. Update tests. #679
Conversation
Hi @afoxman! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Instead of explicitly threading On that note, it's not ideal that we don't have an existing test for |
Plumbing work is done. I took a look at adding tests, but I couldn't find a place to easily add them. Looks like we'd need a new test suite under /metro/src/tests/IncrementalBundler-test.js, which means it would need to cover the full IncrementalBundler class. I'm not that much of a Metro expert yet. :) If you have advice on another place I can add a few experimentalSerializerHook tests, let me know. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm with one minor comment.
Co-authored-by: Moti Zilberman <motiz88@gmail.com>
@motiz88 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
Summary: Draft changelog: * **[Feature]** Add option to use the Hermes parser in the transformer. (6dae163) * **[Feature]** Update the list of default React Native lazy imports to match the [removal of Picker](facebook/react-native@ad0ccac), which was already deprecated. (7dcb20d) * **[Feature]** Make the input transform options (e.g. `platform`) available to `experimentalSerializerHook` and `customSerializer`. (#679) * **[Fix]** Avoid triggering Babel scope caching bugs. (4fea2bd, 1370b7a) * **[Fix]** Fix Hermes debugger proxy for IPv6. (#662) * **[Types]** Remove documentation and types for the `postMinifyProcess` option which has been broken since Metro v0.33.0. (5d778de) * **[Experimental]** Various unstable additions to the transformer config. *These are not covered by semver and can change at any time.* (6482241, 3390274, 5b913fa, #677) Reviewed By: GijsWeterings Differential Revision: D29514800 fbshipit-source-id: 89bd4b8a53a701ceaf18867e8e9379fd3401bbbe
Summary
Each graph is built using a specific set of transformOptions. Bind these to the graph, making them available to extensibility APIs such as
customSerializer
andexperimentalSerializerHook
. This data -- specifically,platform
-- makes it possible to perform TypeScript validation during bundle/serve scenarios.platform
is used to resolve types for platform-specific files.Test plan
I updated existing Metro tests to validate the transformOptions in a graph.
I also wrote a sample application which bundles using Metro, and uses
experimentalSerializerHook
. I had my app printplatform
to the console, verifying that it was the correct value.