UNPKG

wuchale

Version:

Protobuf-like i18n from plain code

97 lines (96 loc) 6.31 kB
import MagicString from "magic-string"; import type * as Estree from "acorn"; import { Message } from '../adapters.js'; import type { HeuristicDetailsBase, HeuristicFunc, IndexTracker, ScriptDeclType, TransformOutput, HeuristicDetails, RuntimeConf, CatalogExpr, CodePattern, UrlMatcher, HeuristicResultChecked, MessageType } from "../adapters.js"; import { type RuntimeVars, type CommentDirectives } from "../adapter-utils/index.js"; export declare const scriptParseOptions: Estree.Options; export declare function scriptParseOptionsWithComments(): [Estree.Options, Estree.Comment[][]]; export declare function parseScript(content: string): [Estree.Program, Estree.Comment[][]]; type InitRuntimeFunc = (file: string, funcName?: string, parentFunc?: string, additional?: object) => string | undefined; export declare class Transformer { index: IndexTracker; heuristic: HeuristicFunc; content: string; comments: Estree.Comment[][]; filename: string; mstr: MagicString; patterns: CodePattern[]; matchUrl: UrlMatcher; initRuntime: InitRuntimeFunc; currentRtVar: string; vars: () => RuntimeVars; commentDirectives: CommentDirectives; insideProgram: boolean; declaring?: ScriptDeclType; currentFuncNested: boolean; currentFuncDef?: string; currentCall: string; currentTopLevelCall?: string; /** .start of the first statements in their respective parents, to put the runtime init before */ realBodyStarts: Set<number>; /** for subclasses. right now for svelte, if in <script module> */ additionalState: object; constructor(content: string, filename: string, index: IndexTracker, heuristic: HeuristicFunc, patterns: CodePattern[], catalogExpr: CatalogExpr, rtConf: RuntimeConf, matchUrl: UrlMatcher, rtBaseVars?: string[]); fullHeuristicDetails: (detailsBase: HeuristicDetailsBase) => HeuristicDetails; getHeuristicMessageType: (msg: Message) => HeuristicResultChecked; checkHeuristic: (msgStr: string, detailsBase: HeuristicDetailsBase) => [MessageType, Message] | [false, null]; visitLiteral: (node: Estree.Literal, heuristicDetailsBase?: HeuristicDetailsBase) => Message[]; visitArrayExpression: (node: Estree.ArrayExpression) => Message[]; visitSequenceExpression: (node: Estree.SequenceExpression) => Message[]; visitObjectExpression: (node: Estree.ObjectExpression) => Message[]; visitObjectPattern: (node: Estree.ObjectPattern) => Message[]; visitRestElement: (node: Estree.RestElement) => Message[]; visitProperty: (node: Estree.Property) => Message[]; visitSpreadElement: (node: Estree.SpreadElement) => Message[]; visitMemberExpression: (node: Estree.MemberExpression) => Message[]; visitChainExpression: (node: Estree.ChainExpression) => Message[]; visitNewExpression: (node: Estree.NewExpression) => Message[]; defaultVisitCallExpression: (node: Estree.CallExpression) => Message[]; visitCallExpression: (node: Estree.CallExpression) => Message[]; visitBinaryExpression: (node: Estree.BinaryExpression) => Message[]; visitConditionalExpression: (node: Estree.ConditionalExpression) => Message[]; visitUnaryExpression: (node: Estree.UnaryExpression) => Message[]; visitLogicalExpression: (node: Estree.LogicalExpression) => Message[]; visitAwaitExpression: (node: Estree.AwaitExpression) => Message[]; visitAssignmentExpression: (node: Estree.BinaryExpression) => Message[]; visitAssignmentPattern: (node: Estree.AssignmentPattern) => Message[]; visitExpressionStatement: (node: Estree.ExpressionStatement) => Message[]; visitForOfStatement: (node: Estree.ForOfStatement) => Message[]; visitForInStatement: (node: Estree.ForInStatement) => Message[]; visitForStatement: (node: Estree.ForStatement) => Message[]; getMemberChainName: (node: Estree.MemberExpression) => string; getCalleeName: (callee: Estree.Expression | Estree.Super) => string; defaultVisitVariableDeclarator: (node: Estree.VariableDeclarator) => Message[]; visitVariableDeclarator: (node: Estree.VariableDeclarator) => Message[]; visitVariableDeclaration: (node: Estree.VariableDeclaration) => Message[]; visitExportNamedDeclaration: (node: Estree.ExportNamedDeclaration) => Message[]; visitExportDefaultDeclaration: (node: Estree.ExportNamedDeclaration) => Message[]; visitStatementsNSaveRealBodyStart: (nodes: (Estree.Statement | Estree.ModuleDeclaration)[]) => Message[]; getRealBodyStart: (nodes: (Estree.Statement | Estree.ModuleDeclaration)[]) => number | undefined; visitFunctionBody: (node: Estree.BlockStatement | Estree.Expression, name?: string, end?: number) => Message[]; visitFunctionDeclaration: (node: Estree.FunctionDeclaration) => Message[]; visitArrowFunctionExpression: (node: Estree.ArrowFunctionExpression) => Message[]; visitFunctionExpression: (node: Estree.FunctionExpression) => Message[]; visitBlockStatement: (node: Estree.BlockStatement) => Message[]; visitReturnStatement: (node: Estree.ReturnStatement) => Message[]; visitIfStatement: (node: Estree.IfStatement) => Message[]; visitClassDeclaration: (node: Estree.ClassDeclaration) => Message[]; checkHeuristicTemplateLiteral: (node: Estree.TemplateLiteral, heurDetails?: HeuristicDetailsBase) => HeuristicResultChecked; visitTemplateLiteralQuasis: (node: Estree.TemplateLiteral, msgTyp: MessageType) => [number, Message[]]; visitTemplateLiteral: (node: Estree.TemplateLiteral, heurDetails?: HeuristicDetailsBase | boolean) => Message[]; visitTaggedTemplateExpression: (node: Estree.TaggedTemplateExpression) => Message[]; visitSwitchStatement: (node: Estree.SwitchStatement) => Message[]; visitTryStatement: (node: Estree.TryStatement) => Message[]; visitTSAsExpression: (node: { expression: Estree.AnyNode; }) => Message[]; visitTSTypeAssertion: (node: { expression: Estree.AnyNode; }) => Message[]; visitProgram: (node: Estree.Program) => Message[]; visitWithCommentDirectives: (node: Estree.AnyNode, func: Function) => any; visit: (node: Estree.AnyNode) => Message[]; finalize: (msgs: Message[], hmrHeaderIndex: number, additionalHeader?: string) => TransformOutput; transform: () => TransformOutput; } export {};