UNPKG

vue-hook-optimizer

Version:

a tool that helps refactor and optimize hook abstractions in Vue components

96 lines (85 loc) 2.7 kB
import { SFCStyleBlock } from '@vue/compiler-sfc'; export { parse } from '@vue/compiler-sfc'; import { Edge, Node } from 'vis-network'; interface TypedNode { label: string; type: NodeType; info?: Partial<{ line: number; column: number; comment: string; used: Set<string>; }>; } declare enum NodeType { var = "var", fun = "fun" } type RelationType = 'get' | 'set' | 'call'; declare function analyze$4(content: string, lineOffset?: number, jsx?: boolean): { graph: { nodes: Set<TypedNode>; edges: Map<TypedNode, Set<{ node: TypedNode; type: RelationType; }>>; }; nodesUsedInTemplate: Set<string>; }; declare function analyze$3(content: string, lineOffset?: number, jsx?: boolean): { nodes: Set<TypedNode>; edges: Map<TypedNode, Set<{ node: TypedNode; type: RelationType; }>>; }; declare function analyze$2(styles: SFCStyleBlock[]): Set<string>; declare function analyze$1(content: string): Set<string>; declare function analyze(content: string, type?: "vue" | "react", lineOffset?: number, addInfo?: boolean): { graph: { nodes: Set<TypedNode>; edges: Map<TypedNode, Set<{ node: TypedNode; type: RelationType; }>>; }; nodesUsedInTemplate: Set<string>; }; interface MermaidOptions { direction?: 'TB' | 'BT' | 'LR' | 'RL'; } declare function getMermaidText(graph: { nodes: Set<TypedNode>; edges: Map<TypedNode, Set<TypedNode>>; }, nodesUsedInTemplate: Set<string>, nodesUsedInStyle?: Set<string>, options?: MermaidOptions): string; declare enum SuggestionType { info = "info", warning = "warning", error = "error" } interface Suggestion { type: SuggestionType; message: string; nodeInfo?: TypedNode | Array<TypedNode>; } declare function gen(graph: { nodes: Set<TypedNode>; edges: Map<TypedNode, Set<{ node: TypedNode; type: RelationType; }>>; }, nodesUsedInTemplate: Set<string>, nodesUsedInStyle?: Set<string>): Suggestion[]; type CustomNode = Node & { info: TypedNode['info']; }; declare function getVisData(graph: { nodes: Set<TypedNode>; edges: Map<TypedNode, Set<{ node: TypedNode; type: RelationType; }>>; }, nodesUsedInTemplate: Set<string>, nodesUsedInStyle?: Set<string>): { nodes: CustomNode[]; edges: Edge[]; }; export { NodeType, type RelationType, type Suggestion, SuggestionType, type TypedNode, analyze$4 as analyzeOptions, analyze$3 as analyzeSetupScript, analyze$2 as analyzeStyle, analyze$1 as analyzeTemplate, analyze as analyzeTsx, gen, getMermaidText, getVisData };