0no-co / gql.tada

🪄 Magical GraphQL query engine for TypeScript
https://gql-tada.0no.co
MIT License
2.45k stars 36 forks source link

feat(cli-utils): add experimental support for `.svelte` files #241

Closed kitten closed 3 months ago

kitten commented 3 months ago

Related: https://github.com/0no-co/gql.tada/pull/232 Related: https://github.com/0no-co/gql.tada/pull/236

Summary

This abstracts our usage of volar’s utilities down to VirtualCode wrappers and abstracts it to have parity with the Svelte file support. The Svelte2TSX compiler has been added to compile Svelte files to TSX as well.

Notably, this changes the approach slightly. To risk confusing external files with virtual files, we now create a SourceFile of the project file (svelte/vue file) outside of our TypeScript program and don't add it to the project.

Redirections to the virtual file and such still function as before. But the biggest change is that all commands will now iterate over the virtual files (e.g. .vue.ts and .vue.svelte) instead of the non-TS project files (.vue and .svelte), since those aren't loaded into TypeScript anymore. The output of the logger is hence mapped and getFilePosition now uses the position mapper as needed.

Set of changes

changeset-bot[bot] commented 3 months ago

🦋 Changeset detected

Latest commit: a12809040eaf29e5205ddf8ed5e3291da5089dbf

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

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