I skipped parse and preprocess to input svelte AST. To generate code I use astring because I can not use snip phase. I did not need formatter in this case.
For now there is no clean way to do this simply because this is not something that's built yet. I think for now your idea to reuse this formatting plugin is probably the fastest way to get going.
Svelte compiler has parser but no code printer. I need code printer for ast to svelte template.
related https://github.com/sveltejs/svelte/issues/5972
How to implementation
I created fork of this repo.
https://github.com/mizchi/svelte-printer
https://github.com/mizchi/svelte-printer/commit/dc8ddb20709e3cf4e3fb3a913d5ef0117d1f266a
I skipped parse and preprocess to input svelte AST. To generate code I use
astring
because I can not use snip phase. I did not need formatter in this case.davidbonnet/astring: 🌳 Tiny and fast JavaScript code generator from an ESTree-compliant AST.
Why
I'm creating Non Programmer's Form from svelte template. This tool needs bi-directional transform.
or other way
I created fork but is there other clean way?