marko
Version:
Optimized runtime for Marko templates.
29 lines (28 loc) • 2.67 kB
TypeScript
import { types as t } from "@marko/compiler";
import * as Step from "./constants/step";
import { type Section, type StructureRef, type StructureVisit } from "./sections";
export declare function enter(path: t.NodePath<any>): void;
export declare function exit(path: t.NodePath<any>): void;
export declare function enterShallow(path: t.NodePath<any>): void;
export declare function child(tag: t.NodePath<t.MarkoTag>, name: string, renderer?: StructureRef): void;
export declare function writeTo(path: t.NodePath<any>): (strs: TemplateStringsArray, ...exprs: string[]) => void;
export declare function visit(path: t.NodePath<t.MarkoTag | t.MarkoPlaceholder | t.Program>, code: StructureVisit["code"], claimed?: boolean): StructureVisit | undefined;
type ResolvedPart = string | t.Expression;
interface ResolvedStructure {
writes: ResolvedPart[];
walks: ResolvedPart[];
walkComment: string[];
steps: Step.Value[];
}
export declare function resolveStructure(section: Section): ResolvedStructure;
interface SectionMeta {
walks: t.Expression | undefined;
writes: t.Expression | undefined;
decls: t.VariableDeclarator[] | undefined;
}
export declare const getSectionMeta: (section: Section) => SectionMeta;
export declare function getSectionMetaIdentifiers(section: Section): SectionMeta;
/** `_content` strips trailing exit codes before it walks, so a renderer that
* reaches the runtime through it never needs them on the wire. */
export declare function trimTrailingExits(walks: t.Expression | undefined): t.ArrayExpression | t.ArrowFunctionExpression | t.AssignmentExpression | t.AwaitExpression | t.BigIntLiteral | t.BinaryExpression | t.BindExpression | t.BooleanLiteral | t.CallExpression | t.ClassExpression | t.ConditionalExpression | t.DecimalLiteral | t.DoExpression | t.FunctionExpression | t.Identifier | t.Import | t.ImportExpression | t.JSXElement | t.JSXFragment | t.LogicalExpression | t.MarkoParseError | t.MemberExpression | t.MetaProperty | t.ModuleExpression | t.NewExpression | t.NullLiteral | t.NumericLiteral | t.ObjectExpression | t.OptionalCallExpression | t.OptionalMemberExpression | t.ParenthesizedExpression | t.PipelineBareFunction | t.PipelinePrimaryTopicReference | t.PipelineTopicExpression | t.RecordExpression | t.RegExpLiteral | t.SequenceExpression | t.StringLiteral | t.Super | t.TSAsExpression | t.TSInstantiationExpression | t.TSNonNullExpression | t.TSSatisfiesExpression | t.TSTypeAssertion | t.TaggedTemplateExpression | t.TemplateLiteral | t.ThisExpression | t.TopicReference | t.TupleExpression | t.TypeCastExpression | t.UnaryExpression | t.UpdateExpression | t.YieldExpression | undefined;
export {};