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(es/parser): Support stripping flow with ES parser #9114

Draft
wants to merge 242 commits into
base: main
Choose a base branch
from

Conversation

kdy1
Copy link
Member

@kdy1 kdy1 commented Jun 29, 2024

Description:

This PR adds support for flow syntax without a feature to construct AST. The parser strips out extra syntax, and the returned AST is identical to ECMAScript AST.

@rtrembecky
Copy link

hello, last week I found out I can't switch to @swc/jest for a React Native project, where react-native and expo dependencies need to be transformed, because they include the Flow types. do you think this will be merged in the foreseeable future? thanks.

@rtrembecky
Copy link

BTW I found https://github.com/changwoolab/flow-aware-swc-jest and tried it but also got some error. just sharing for visibility/reference

@rtrembecky
Copy link

@kdy1 hi, any update on this effort?

@kdy1
Copy link
Member Author

kdy1 commented Oct 30, 2024

@rtrembecky Is there any concrete use plan?

@kdy1
Copy link
Member Author

kdy1 commented Oct 30, 2024

Ah you want to use swc/jest for a RN project

@rtrembecky
Copy link

well it's simple, our RN tests take too long to spin and one of the issues I identified is babel transpilation of RN modules, which are being shipped with Flow. I'd like to switch to a faster engine (SWC) but still support Flow-stripping.

@jbroma
Copy link

jbroma commented Oct 30, 2024

In Re.Pack 5 we're using swc through Rspack and right now we're stripping flow types with flow-remove-types utility.

It would be amazing to have a builtin support for doing this with swc 🙌

Copy link

changeset-bot bot commented Nov 1, 2024

⚠️ No Changeset found

Latest commit: 61ff623

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

codspeed-hq bot commented Nov 4, 2024

CodSpeed Performance Report

Merging #9114 will improve performances by 3.43%

Comparing kdy1:flow-parser (61ff623) with main (c135f71)

Summary

⚡ 1 improvements
✅ 193 untouched benchmarks

Benchmarks breakdown

Benchmark main kdy1:flow-parser Change
es/visitor/base-perf/boxing_unboxed_clone 2.6 µs 2.6 µs +3.43%

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

Successfully merging this pull request may close these issues.

3 participants