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

Use { parse } from 'svelte/compiler' #94

Open
benmccann opened this issue Oct 11, 2024 · 4 comments · May be fixed by #100
Open

Use { parse } from 'svelte/compiler' #94

benmccann opened this issue Oct 11, 2024 · 4 comments · May be fixed by #100

Comments

@benmccann
Copy link
Member

recast is using babel, which is much less used in the Svelte ecosystem, so folks wouldn't generally be as familiar with it

@manuel3108
Copy link
Member

Same problem as with using acorn-typescript directly. The discussion about this started in Rich-Harris/esrap#13 and continued in TyrealHu/acorn-typescript#60.

Also this would likely require different handling for "native" js / ts, or a workaround. The workaround seems quite reasonable on the other hand.

@manuel3108
Copy link
Member

manuel3108 commented Oct 12, 2024

Actually, a similar workaround could also be used for html. This would probably significantly bring down our bundle size and make @sveltejs/ast-tooling useless.

But once we have the ast, we will still need to do some serialization afterwards. And then we land on svelte-ast-print which brings us back up Rich-Harris/esrap#13 closing the circle 😆

@AdrianGonz97
Copy link
Member

AdrianGonz97 commented Oct 12, 2024

i've never used recast before this project (only used acorn) and i've really come to hate it. it has many stupid quirks like this: #96 (comment), along with inadequate types (like for loc), so it would be great if we can switch off of it

@benmccann
Copy link
Member Author

Yeah, there are shortcomings of { parse } from 'svelte/compiler' from acorn-typescript for sure. There's an issue open in the Svelte repo about this: sveltejs/svelte#13439

I think the lack of types might not be too much of an issue for finding nodes as we'll mostly be looking for JS nodes?

For serialization, maybe we can do a more surgical approach like svelte-migrate? (I started to prototype this in #74)

@manuel3108 manuel3108 linked a pull request Oct 13, 2024 that will close this issue
6 tasks
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 a pull request may close this issue.

3 participants