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

feat: support jsx and tsx out of the box #1303

Merged
merged 8 commits into from
Jun 20, 2023
Merged

feat: support jsx and tsx out of the box #1303

merged 8 commits into from
Jun 20, 2023

Conversation

MarvinMiles
Copy link
Contributor

πŸ”— Linked issue

Related to #1299

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Nitro esbuild options presents with type definitions of jsxFactory and jsxFragment, but they never used anywhere at codebase really. This PR adds those missing options to esbuild transform method. This will allow use jsx syntax with other libraries/frameworks besides React. As an example: Vue with jsx, Preact, nano-jsx and others.
I also committed nano-jsx SSR example.

Resolves #1299

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@pi0 pi0 changed the title fix(esbuild): add missing jsxFactory and jsxFragment options feat: support jsx Jun 20, 2023
@pi0 pi0 changed the title feat: support jsx feat: support jsx and tsx Jun 20, 2023
@codecov
Copy link

codecov bot commented Jun 20, 2023

Codecov Report

Merging #1303 (8205c89) into main (58cde15) will increase coverage by 0.06%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #1303      +/-   ##
==========================================
+ Coverage   76.62%   76.69%   +0.06%     
==========================================
  Files          69       70       +1     
  Lines        7081     7100      +19     
  Branches      706      705       -1     
==========================================
+ Hits         5426     5445      +19     
  Misses       1654     1654              
  Partials        1        1              
Impacted Files Coverage Ξ”
src/build.ts 85.22% <100.00%> (+0.10%) ⬆️
src/options.ts 94.41% <100.00%> (+0.07%) ⬆️
src/rollup/plugins/esbuild.ts 77.85% <100.00%> (+0.65%) ⬆️
src/scan.ts 100.00% <100.00%> (ΓΈ)

... and 2 files with indirect coverage changes

Copy link
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

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

Thanks for the PR and great idea! I have made few more changes to make it working out of the box preconfigured.

@pi0 pi0 changed the title feat: support jsx and tsx feat: support jsx and tsx out of the box Jun 20, 2023
@pi0 pi0 merged commit d71898b into unjs:main Jun 20, 2023
4 of 5 checks passed
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.

Support for "jsxImportSource" compile options.
2 participants