svelte-ast-print
Version:
Serialize Svelte AST nodes into stringified syntax. A.k.a parse in reverse.
37 lines • 1.12 kB
TypeScript
import type { AST as SV } from "svelte/compiler";
export interface PrintOptions {
format?: Partial<FormatOptions>;
root?: Partial<RootOptions>;
}
/**
* Name _(alias)_ for indentation type. This package will automatically determine a desired indent.
*/
type IndentName = typeof Options.INDENT extends Map<infer K, infer _V> ? K : never;
/**
* Provided for building a stable API - gives an space for expansion on future improvements/features.
*/
interface FormatOptions {
indent?: IndentName;
}
type RootNode = Extract<keyof SV.Root, "css" | "fragment" | "instance" | "module" | "options">;
/**
* ## Legend
*
* - `"options"` - {@link SV.SvelteOptions}
* - `"module"` - {@link SV.Script}
* - `"instance"` - {@link SV.Script}
* - `"fragment"` - {@link SV.Fragment}
* - `"css"` - {@link SV.CSS.StyleSheet}
*/
type RootOrder = [RootNode, RootNode, RootNode, RootNode, RootNode];
/**
* Options related to {@link SV.Root} Svelte SV node.
*/
interface RootOptions {
/**
* defaults to {@link Options.DEFAULT_ORDER}
*/
order?: RootOrder;
}
export {};
//# sourceMappingURL=option.d.ts.map