UNPKG

marko

Version:

Optimized runtime for Marko templates.

15 lines (14 loc) • 934 B
import { types as t } from "@marko/compiler"; import type { Plugin } from "@marko/compiler/babel-utils"; export type VisitorType = "migrate" | "transform" | "analyze" | "translate"; export type TemplateVisitor<T extends t.Node> = Partial<Record<VisitorType, t.VisitNode<unknown, T>>>; export declare function extractVisitors<Visitors extends Partial<Record<keyof t.Visitor, TemplateVisitor<any>>>>(visitors: Visitors): Record<VisitorType, t.Visitor<unknown>>; export declare function translateByTarget<T extends t.Node>({ html, dom, }: { dom: t.VisitNode<unknown, T>; html: t.VisitNode<unknown, T>; }): { readonly enter: (path: t.NodePath<T>) => void; readonly exit: (path: t.NodePath<T>) => void; }; export declare function enterHook<T extends t.Node>(modulePlugin: Plugin | void, path: t.NodePath<T>): void; export declare function exitHook<T extends t.Node>(modulePlugin: Plugin | void, path: t.NodePath<T>): void;