UNPKG

wuchale

Version:

Protobuf-like i18n from plain code

45 lines (44 loc) 1.78 kB
import type MagicString from "magic-string"; import { IndexTracker, Message, type HeuristicDetails, type HeuristicDetailsBase, type HeuristicFunc, type MessageType } from "../adapters.js"; import { type RuntimeVars, type CommentDirectives } from "./index.js"; type NestedRanges = [number, number, boolean][]; type BasicNode = { start: number; end: number; }; type InitProps<NodeT> = { vars: () => RuntimeVars; mstr: MagicString; getRange: (node: NodeT) => BasicNode; isText: (node: NodeT) => boolean; isExpression: (node: NodeT) => boolean; isComment: (node: NodeT) => boolean; leaveInPlace: (node: NodeT) => boolean; canHaveChildren: (node: NodeT) => boolean; getTextContent: (node: NodeT) => string; getCommentData: (node: NodeT) => string; visitFunc: (node: NodeT, inCompoundText: boolean) => Message[]; visitExpressionTag: (node: NodeT) => Message[]; fullHeuristicDetails: (details: HeuristicDetailsBase) => HeuristicDetails; checkHeuristic: HeuristicFunc; wrapNested: (msgInfo: Message, hasExprs: boolean, nestedRanges: NestedRanges, lastChildEnd: number) => void; index: IndexTracker; }; export type MixedScope = 'markup' | 'attribute'; type VisitProps<NodeT> = { children: NodeT[]; commentDirectives: CommentDirectives; inCompoundText: boolean; scope: MixedScope; element: string; attribute?: string; useComponent?: boolean; }; export interface MixedVisitor<NodeT extends BasicNode> extends InitProps<NodeT> { } export declare class MixedVisitor<NodeT> { constructor(props: InitProps<NodeT>); separatelyVisitChildren: (props: VisitProps<NodeT>) => [boolean, boolean, boolean, MessageType, Message[]]; visit: (props: VisitProps<NodeT>) => Message[]; } export {};