Serialize Svelte AST nodes into stringified syntax. A.k.a parse in reverse.
npm install svelte-ast-printsvelte-ast-printPrint _(serialize)_ [Svelte] [AST] nodes into stringified code syntax.\
A.k.a. [parse()] in reverse.
> [!IMPORTANT]
>
> When using [parse()] from "svelte/compiler"...\
> please remember about passing modern: true to options _(second argument)_.
>
> This option is only available starting svelte@5.
>
> Example:
>
> ``js`
> import { parse } from "svelte/compiler";
>
> parse(code, { modern: true });
> // 👆 Don't forget about this!
> v6
>
> You can omit it from [Svelte] - source.
---
1. It determines whether the provided AST node type is related to [Svelte] syntax only.type
1. Based on node's check from above:esrap
- it uses either this package's printer to print [AST] node related to [Svelte] syntax,
- otherwise it uses [] to print [ESTree] specification-complaint [AST] node.
---
Mateusz "xeho91" Kadlubowski
- @manuel3108 for bringing TypeScript support to [esrap]
[Svelte]: https://github.com/sveltejs/svelte
[esrap]: https://github.com/rich-harris/esrapzimmerframe
[]: https://github.com/rich-harris/zimmerframeparse()`]: https://svelte.dev/docs/svelte-compiler#parse
[ESTree]: https://github.com/estree/estree
[codemods]: https://codemod.com/blog/what-are-codemods#ill-find-replace-whats-the-issue-hint-a-lot
[
[AST]: https://en.wikipedia.org/wiki/Abstract_syntax_tree