UNPKG

marko

Version:

Optimized runtime for Marko templates.

22 lines (21 loc) • 1.7 kB
import { types as t } from "@marko/compiler"; import { type Binding } from "./bindings"; import { type AttrTagMeta, type AttrTagLookup } from "./nested-attribute-tags"; import { type SortedOpt } from "./optional"; import { type ParamsTree } from "./params-tree"; type ContentKey = "renderBody" | "content"; export declare function translateAttrs(tag: t.NodePath<t.MarkoTag>, paramsTree?: ParamsTree | true, skip?: SortedOpt<string>, statements?: t.Statement[], contentKey?: ContentKey): { properties: (t.ObjectMethod | t.ObjectProperty | t.SpreadElement)[]; statements: t.Statement[]; }; export declare function getTranslatedBodyContentProperty(props: t.ObjectExpression["properties"]): (t.ObjectProperty & { value: t.Expression; }) | undefined; export declare function addDynamicAttrTagStatements(attrTags: t.NodePath<t.MarkoTag["attributeTags"][number]>[], index: number, attrTagLookup: AttrTagLookup, statements: t.Statement[], paramsTree: ParamsTree | true, contentKey?: ContentKey): number; export declare function addAttrTag(properties: t.ObjectExpression["properties"], { name, repeated }: AttrTagMeta, props: t.ObjectExpression): void; export declare function appendAttrTag(prev: t.Expression | undefined | false, props: t.ObjectExpression): t.CallExpression; /** Unwraps a lone spread to the spread argument itself, so the result may alias * a caller binding; anything the runtime writes to needs its own object. */ export declare function propsToExpression(props: t.ObjectExpression["properties"]): t.Expression; export declare function getSingleKnownSpread(paramsTree: ParamsTree | true, attributes: (t.MarkoAttribute | t.MarkoSpreadAttribute)[]): Binding | undefined; export {};