-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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: SWC parser #13444
feat: SWC parser #13444
Conversation
|
Note - SWC also exposes |
Whilst this is super interesting, this isn't a route we plan on taking in the future. Given how stale and conflicted this PR is, I'm closing for now. |
@ottomated oxc looks promising but its very early days there still, and the change in AST format would be a huge change for us, so likely something for the far future rather than the near future. The benefits we'd get would only start to be beneficial with Rolldown too, and that's not stable yet. |
Very early look into using swc instead of acorn + acorn-typescript to parse (see #13439)
So far I've just implemented parse_expression_at, which was the main blocker keeping acorn necessary. 238 test failures right now, most due to error messages not being the same, some due to hacks put in place to appease acorn-typescript.
This is really just a proof-of-concept. Instead of using swc's estree compat layer, it would be better to use their AST representation (which has full types available at
@swc/types
and would be compatible with theirprint
function to avoid a dependency onesrap
).To run:
rustup default nightly
) - this is a requirement ofswc_estree_compat
which could be removed by using their AST as mentioned abovecargo install cargo-watch
) for dev modepackages/swc-svelte
and runpnpm dev
to build the rust crateBefore submitting the PR, please make sure you do the following
feat:
,fix:
,chore:
, ordocs:
.Tests and linting
pnpm test
and lint the project withpnpm lint