feat(sucrase): add support for jsxRuntime and other missing Sucrase options#1961
Open
vinny-silveira wants to merge 4 commits intorollup:masterfrom
Open
feat(sucrase): add support for jsxRuntime and other missing Sucrase options#1961vinny-silveira wants to merge 4 commits intorollup:masterfrom
vinny-silveira wants to merge 4 commits intorollup:masterfrom
Conversation
Co-authored-by: vinny-silveira <13592890+vinny-silveira@users.noreply.github.com>
Remove redundant ternary in resolveId (importer is always truthy), extract common rollup setup into getBundle helper function and add tests for plugin initialization and exclude filter
…port Add support for jsxRuntime and other missing Sucrase transform options
Collaborator
|
Sorry about the copilot noise. I have no idea how that got turned on. But please disregard it. |
Author
|
No worries at all, @shellscape! Totally understand, thanks for the heads-up. Happy to make any changes if needed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rollup Plugin Name:
sucraseThis PR contains:
Are tests included?
Breaking Changes?
List any relevant issue numbers:
(No specific issues found, but this PR adds support for options that already exist in Sucrase but were not exposed in the plugin.)
Description
This PR adds support for missing Sucrase options that were not being passed through to the
transformfunction:jsxRuntime- Enables the automatic JSX runtime (React 17+);jsxImportSource- Custom JSX import source (e.g.,preact);preserveDynamicImport- Preserve dynamic import expressions;injectCreateRequireForImportRequire- Inject createRequire for import.meta.Additionally, this PR includes:
resolveIdfunction by removing a redundant ternary operator (theimportercheck guarantees it's always truthy at that point);getBundlehelper function to reduce boilerplate in tests, plus new tests for plugin initialization and the exclude filter;