Module svelte-ast-print - v0.6.0
svelte-ast-print

Print (serialize) Svelte AST nodes into stringified code syntax.
A.k.a. parse()
in reverse.
Usage
See documentation.
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:
import { parse } from "svelte/compiler";
parse(code, { modern: true });
// 👆 Don't forget about this!
You can omit it from Svelte v6
- source.
How does it work under the hood?
- It determines whether the provided AST node
type
is related to Svelte syntax only.
- Based on node's
type
check from above:
- it uses either this package's printer to print AST node related to Svelte syntax,
- otherwise it uses
esrap
to print ESTree specification-complaint AST node.
Author
Mateusz "xeho91" Kadlubowski
Acknowledgements
Modules
- _internal/char
- _internal/html
- _internal/js
- _internal/option
- _internal/shared
- _internal/template/attribute
- _internal/template/block
- _internal/template/element
- _internal/template/fragment
- _internal/wrapper
- svelte-ast-print
- svelte-ast-print/attribute
- svelte-ast-print/block
- svelte-ast-print/css
- svelte-ast-print/css/rule
- svelte-ast-print/css/seletor
- svelte-ast-print/element
- svelte-ast-print/fragment
- svelte-ast-print/html
- svelte-ast-print/root
- svelte-ast-print/tag
- svelte-ast-print/template