svelte-ast-print
Version:
Serialize Svelte AST nodes into stringified syntax. A.k.a parse in reverse.
44 lines • 880 B
JavaScript
import { Wrapper } from "../shared.js";
/**
* @internal
* @__NO_SIDE_EFFECTS__
*/
export class OpeningBlock extends Wrapper {
static START = "{#";
static END = "}";
}
/**
* @internal
* @__NO_SIDE_EFFECTS__
*/
export class MidBlock extends Wrapper {
static START = "{:";
static END = "}";
}
/**
* @internal
* @__NO_SIDE_EFFECTS__
*/
export class ClosingBlock extends Wrapper {
static START = "{/";
static END = "}";
}
/**
* @internal
* Checks if `alternate` contains `IfBlock` with `{:else if}`
* @__NO_SIDE_EFFECTS__
*/
export function get_if_block_alternate(n) {
return n?.nodes.find((n) => n.type === "IfBlock");
}
export function isBlock(n) {
return new Set([
//
"AwaitBlock",
"EachBlock",
"IfBlock",
"KeyBlock",
"SnippetBlock",
]).has(n.type);
}
//# sourceMappingURL=block.js.map