import { Node } from 'estree'; import { walk } from 'estree-walker'; import { TemplateNode } from 'svelte/types/compiler/interfaces'; export interface SvelteNode { start: number; end: number; type: string; parent?: SvelteNode; [key: string]: any; } export interface AwaitBlock extends SvelteNode { type: 'AwaitBlock'; expression: SvelteNode & Node; value: (SvelteNode & Node) | null; error: (SvelteNode & Node) | null; pending: AwaitSubBlock; then: AwaitSubBlock; catch: AwaitSubBlock; } export interface AwaitSubBlock extends SvelteNode { skip: boolean; children: SvelteNode[]; } export interface EachBlock extends SvelteNode { type: 'EachBlock'; expression: SvelteNode & Node; context: SvelteNode & Node; key?: SvelteNode & Node; else?: SvelteNode; children: SvelteNode[]; } /** * Returns true if given node is a component or html element, or if the offset is at the end of the node * and its parent is a component or html element. */ export declare function isInTag(node: SvelteNode | null | undefined, offset: number): boolean; /** * Returns when given node represents an HTML Attribute. * Example: The `class` in `
[1]; type ESTreeEnterFunc = NonNullable; type ESTreeLeaveFunc = NonNullable; export interface SvelteNodeWalker { enter?: (this: { skip: () => void; remove: () => void; replace: (node: SvelteNode) => void; }, node: SvelteNode, parent: SvelteNode, key: Parameters[2], index: Parameters[3]) => void; leave?: (this: { skip: () => void; remove: () => void; replace: (node: SvelteNode) => void; }, node: SvelteNode, parent: SvelteNode, key: Parameters[2], index: Parameters[3]) => void; } export declare function walkSvelteAst(htmlAst: TemplateNode, walker: SvelteNodeWalker): void; export declare function isAwaitBlock(node: SvelteNode): node is AwaitBlock; export declare function isEachBlock(node: SvelteNode): node is EachBlock; export {};