UNPKG

marko

Version:

Optimized runtime for Marko templates.

18 lines (17 loc) • 1.74 kB
import { types as t } from "@marko/compiler"; import { type Binding } from "./bindings"; import { type Reasons } from "./reasons"; import { type Section } from "./sections"; export declare function initBranchSection(bodySection: Section, branchExpr: Section["branchExpr"], branch: NonNullable<Section["branch"]>): void; export declare function resumeOwnerByMarkerWhenUnconditional(bodySection: Section, nodeBinding: Binding): void; export declare function getBranchResumeArgs(tag: t.NodePath<t.MarkoTag>, branchReasons: Reasons, singleNode: boolean): (t.Expression | undefined)[]; export declare function buildBranchEndArgs(tagSection: Section, nodeBinding: Binding, onlyChildParentTagName: string | false | undefined, singleNode: boolean | undefined): (t.Expression | undefined)[]; export declare function isEndTagWrittenByBranch(nodeBinding: Binding | undefined): boolean; export declare function isSingleNodeBranch(bodySection: Section | undefined): boolean; export type ForType = "in" | "of" | "to" | "until"; export declare function buildForRuntimeCall(type: ForType, attrs: Record<string, t.Expression>, params: t.ArrowFunctionExpression["params"], statements: t.Statement[]): t.ExpressionStatement; export declare function getForType(tag: t.MarkoTag): ForType | undefined; export declare function forTypeToRuntime(type: ForType): "forIn" | "forOf" | "forTo" | "forUntil"; export declare function forTypeToBranchRuntime(type: ForType): "_for_in" | "_for_of" | "_for_to" | "_for_until"; export declare function forTypeToUnkeyedBranchRuntime(type: ForType): "_for_of_unkeyed" | "_for_to_unkeyed" | "_for_until_unkeyed"; export declare function getBaseArgsInForTag(type: ForType, attrs: Record<string, t.Expression>): t.Expression[];