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 files #71

Merged
merged 13 commits into from
Jul 18, 2023
Merged

feat: support jsx and tsx files #71

merged 13 commits into from
Jul 18, 2023

Conversation

liuyang0826
Copy link
Contributor

No description provided.

@codecov
Copy link

codecov bot commented Oct 28, 2022

Codecov Report

Merging #71 (ccc7eda) into main (ef11b0b) will increase coverage by 0.06%.
The diff coverage is 100.00%.

❗ Current head ccc7eda differs from pull request most recent head 478bfdb. Consider uploading reports for the commit 478bfdb to get more accurate results

@@            Coverage Diff             @@
##             main      #71      +/-   ##
==========================================
+ Coverage   96.44%   96.51%   +0.06%     
==========================================
  Files           8        8              
  Lines         535      545      +10     
  Branches       96       99       +3     
==========================================
+ Hits          516      526      +10     
  Misses         19       19              
Impacted Files Coverage Δ
src/loader.ts 100.00% <100.00%> (ø)
src/loaders/js.ts 94.11% <100.00%> (+0.56%) ⬆️
src/make.ts 90.84% <100.00%> (+0.12%) ⬆️
src/utils/dts.ts 100.00% <100.00%> (ø)

@dwightjack
Copy link
Contributor

@liuyang0826 instead of adding two options, what about adding a single esbuild option with all the configurable options for the transform API?

+ import type { TransformOptions } from "esbuild";

export interface LoaderOptions {
  ext?: 'mjs' | 'js' | 'ts'
  format?: 'cjs' | 'esm'
  declaration?: boolean
- jsxFactory?: string
- jsxFragment?: string
+ esbuild?: TransformOptions
}

In this way, we could pass those options to the ts loader as well and let the user set other useful options like the target:

mkdist({
  srcDir: 'src',
  format: 'esm',
  // ...
  esbuild: {
    target: ['es2018'],
    jsxFactory: 'h',
  }
})

@pi0 pi0 changed the title feat: support tsx files feat: support jsx and tsx files Jul 18, 2023
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!

@pi0 pi0 merged commit d2a6182 into unjs:main Jul 18, 2023
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.

3 participants