Skip to content
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 JSX support. #1

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Add JSX support. #1

wants to merge 3 commits into from

Conversation

jeresig
Copy link
Member

@jeresig jeresig commented Jul 15, 2024

Summary:

This adds in JSX support to the explicit-exports-references babel plugin. When attempting to replace a JSXMemberExpression with a plain MemberExpression there was an error generated by Babel. This fixes that by explicitly creating a JSXMemberExpression when replacing a JSXIdentifier or the name of the openingElement of a JSXElement.

In the process I noticed that there was no ability to generate a production build, there is no Webpack config. So I changed the logic so that the build is generated by TypeScript now, no Webpack needed.

Issue: FEI-5709

Test plan:

The tests pass! This required updating a bunch of infrastructure to support React.

@jeresig jeresig self-assigned this Jul 15, 2024
@jeresig jeresig requested a review from a team July 15, 2024 16:05
Copy link

@kevinb-khan kevinb-khan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. 🚀

Comment on lines +73 to +76
const jsxElement = template.expression.ast(
`<module.exports.${mode == 'default' ? mode : exportedName} />`,
{ plugins: ['jsx'] }
) as util.JSXElement;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Being able to write AST snippets like this is so nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants