marko
Version:
Optimized runtime for Marko templates.
34 lines (33 loc) • 1.47 kB
TypeScript
import type { Boundary } from "./writer";
export declare const K_SCOPE_ID: unique symbol;
export type ScopeFlush = [scopeId: number, scope: object, props: object];
export interface SerializeChannel {
readyId?: string;
parent?: SerializeChannel;
}
interface Debug {
file: string;
loc: string | 0;
vars: Record<string, string | [name: string, loc?: string]> | undefined;
slots?: Record<string, string>;
}
export declare function setDebugInfo(obj: WeakKey, file: string, loc: string | 0, vars?: Debug["vars"]): void;
export declare function setDebugSlotName(obj: WeakKey, accessor: string, name: string): void;
export declare class Serializer {
#private;
pending(channel?: SerializeChannel): boolean;
pendingReadyChannel(): SerializeChannel | undefined;
stringifyScopes(flushes: ScopeFlush[], boundary: Boundary, channel?: SerializeChannel): string;
written(val: WeakKey): boolean;
takeChannelDeps(): Set<string> | null;
writeCall(value: unknown, object: unknown, property: string, channel?: SerializeChannel): void;
}
export declare function register<T extends WeakKey>(id: string, val: T, scope?: unknown): T;
export declare function getRegistered(val: WeakKey): {
id: string;
scope: unknown;
} | undefined;
export declare function toObjectKey(name: string): string;
export declare function toAccess(accessor: string): string;
export declare function quote(str: string, startPos: number): string;
export {};