Print (serialize) Svelte AST nodes into stringified code syntax.
A.k.a. parse()
in reverse.
[!IMPORTANT]
When using
parse()
from"svelte/compiler"
...
please remember about passingmodern: true
to options (second argument).This option is only available starting
svelte@5
.Example:
import { parse } from "svelte/compiler"; parse(code, { modern: true }); // 👆 Don't forget about this!
- It determines whether the provided AST node
type
is related to Svelte syntax only. - Based on node's
type
check from above:
Mateusz "xeho91" Kadlubowski
-
@manuel3108 for bringing TypeScript support to
esrap