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 esbuild options #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cdaringe
Copy link

@cdaringe cdaringe commented Apr 1, 2021

Problem

Current implementation:

  • does not support all esbuild options
  • reimplements some esbuild types

Solution

  • Support esbuild options to be passed thru, so users can use more esbuild APIs to suit their needs
  • Dedupe types
  • Update docs

Discussion

  • the project has prettier in it, my editor picked it up, ...and ran it 😬 . hopefully that's ok? i didn't mean to send a bulk change, but ...editors... and prettier
  • yarn test outside of CI yields:
$ jest --clearCache && jest --detectOpenHandles                                                                                                                                   
Cleared /private/var/folders/b2/_t0w_hyn6jz28xm301k2qp81c9b83j/T/jest_okufzl
jest-haste-map: Haste module naming collision: esbuild-jest
  The following files share their name; please adjust your hasteImpl:
    * <rootDir>/package.json
    * <rootDir>/dist/package.json

this is because the build step symlinks the dist folder. there's certainly ways around that, but FYI, I had to test like CI tests :)

@@ -1,6 +1,7 @@
# esbuild-jest

### A Jest transformer using esbuild

Copy link
Author

Choose a reason for hiding this comment

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

prettier 🤦

}
```

```js
{
"transform": {
"^.+\\.tsx?$": [
Copy link
Author

Choose a reason for hiding this comment

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

prettier 🤦

loaders?: {
[ext: string]: Loader;
};
}
Copy link
Author

Choose a reason for hiding this comment

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

actual change! ^^

...sourcemaps
})

...esbuildOptions,
Copy link
Author

Choose a reason for hiding this comment

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

👀 👀 👀 this is the "big" change. i'm really sorry about the big diff.

@aelbore
Copy link
Owner

aelbore commented Apr 1, 2021

@cdaringe thanks for the PR, it would be good if you could add tests for this PR, to make sure it will not break.

@silverwind
Copy link

silverwind commented Apr 10, 2021

Would this support the inject option? I need it to inject a JSX tranformer global h into every transformed module as outlined here. Not sure if there are other ways to achieve this.

@cdaringe
Copy link
Author

Ya, @silverwind , iirc it should. Feel free to pick up the PR. I hit a roadblock with esbuild, thus probably won't be pursuing this further

@silverwind
Copy link

Not really interested, sorry. I ended up writing my own jest transformer in place of this module (it's actually trivial) but am blocked by jest's ESM bugs currently to proceed.

@bravely
Copy link

bravely commented Dec 30, 2021

For anyone investigating: This approach is unlikely to be able to support build-only options like inject since it still uses only the transformSync API.

@dst0
Copy link

dst0 commented Nov 13, 2022

@aelbore
So how is it going, esbuild-jest is dead?

@adcorduneanu
Copy link

Any updates regarding this one? This PR is what I need to fix some nasty bugs regarding numbered names.

@etroynov
Copy link

etroynov commented Mar 1, 2024

@adcorduneanu, @dst0, @bravely, @cdaringe
I'm sry to say but this repo is abbadoned the work will be continue here: etroynov/esbuild-jest#1

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.

7 participants