vue-hook-optimizer 0.0.83 → 0.0.85

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["traverse: typeof _traverse","_traverse","analyze","traverse: typeof _traverse","_traverse","spread: string[]","state: LexerState","analyze","traverse: typeof _traverse","_traverse","analyze","traverse: typeof _traverse","_traverse","res: t.Identifier[]","path: NodePath<t.ObjectMethod>","spread: string[]","node","parentPath","params","result: IReturnData | undefined","analyze","direction: 'TB' | 'BT' | 'LR' | 'RL'","usedNodes: Set<string>","mermaidText: string","shape: string","closeShape: string","unusedSuffix: string","maxLabels: number[]","communities: Community[]","reindexedCommunities: Community[]","colors: string[]","colors: Array<{ background: string, foreground: string, border: string }>","r: number","g: number","b: number","p","q","dfs","graph","result: Set<TypedNode>[]","visited: Set<TypedNode>","onStack: Set<TypedNode>","stack: TypedNode[]","cycleNodes: TypedNode[]","dfs","suggestions: Suggestion[]","nodes: CustomNode[]","edges: Edge[]","inDegreeMap: Record<string, number>","outDegreeMap: Record<string, number>"],"sources":["../src/analyze/utils.ts","../src/analyze/setupScript.ts","../src/analyze/options.ts","../src/analyze/style.ts","../src/analyze/template.ts","../src/utils/traverse.ts","../src/analyze/tsx.ts","../src/mermaid.ts","../src/suggest/community.ts","../src/suggest/filter.ts","../src/suggest/split.ts","../src/suggest/utils.ts","../src/suggest/index.ts","../src/vis.ts"],"sourcesContent":["import type { NodePath } from '@babel/traverse';\nimport type * as t from '@babel/types';\n\nexport interface TypedNode {\n label: string\n type: NodeType\n info?: Partial<{\n line: number\n column: number\n comment: string\n used: Set<string>\n }>\n};\n\nexport enum NodeType {\n var = 'var',\n fun = 'fun',\n}\n\ninterface Options {\n isComputed: boolean\n isMethod: boolean\n comment: string\n};\n\nexport type RelationType = 'get' | 'set' | 'call';\n\nexport class NodeCollection {\n lineOffset = 0;\n addInfo = true;\n constructor(_lineOffset = 0, _addInfo = true) {\n this.lineOffset = _lineOffset;\n this.addInfo = _addInfo;\n }\n\n nodes = new Map<string, TypedNode>();\n\n addNode(\n label: string,\n node: t.Node,\n options: Partial<Options> = { isComputed: false, isMethod: false, comment: '' },\n ) {\n if (this.nodes.has(label)) {\n return;\n }\n if (\n (!options.isComputed && (\n (node.type === 'VariableDeclarator' && [\n 'ArrowFunctionExpression',\n 'FunctionDeclaration',\n 'FunctionExpression',\n ].includes(node.init?.type || ''))\n || (node.type === 'ObjectProperty' && [\n 'ArrowFunctionExpression',\n 'FunctionDeclaration',\n 'FunctionExpression',\n ].includes(node.value?.type || ''))\n || node.type === 'FunctionDeclaration'\n || node.type === 'ObjectMethod'\n || node.type === 'ArrowFunctionExpression'\n || node.type === 'FunctionExpression'\n ))\n || options.isMethod\n ) {\n this.nodes.set(label, {\n label,\n type: NodeType.fun,\n ...(this.addInfo\n ? {\n info: {\n line: (node.loc?.start.line || 1) - 1 + this.lineOffset,\n column: node.loc?.start.column || 0,\n ...options.comment\n ? { comment: options.comment }\n : {},\n },\n }\n : {}),\n });\n }\n else {\n this.nodes.set(label, {\n label,\n type: NodeType.var,\n ...(this.addInfo\n ? {\n info: {\n line: (node.loc?.start.line || 1) - 1 + this.lineOffset,\n column: node.loc?.start.column || 0,\n ...options.comment\n ? { comment: options.comment }\n : {},\n },\n }\n : {}),\n });\n }\n }\n\n addTypedNode(label: string, node: TypedNode) {\n this.nodes.set(label, {\n label,\n type: node.type,\n ...(this.addInfo\n ? {\n info: {\n ...(node.info || {}),\n },\n }\n : {}),\n });\n }\n\n getNode(label: string) {\n return this.nodes.get(label);\n }\n\n map(graph: {\n nodes: Set<string>\n edges: Map<string, Set<{ label: string, type: RelationType }>>\n }) {\n const nodes = new Set(Array.from(graph.nodes).map((node) => {\n return this.nodes.get(node)!;\n }).filter(node => !!node));\n\n const edges = new Map(Array.from(graph.edges).map(([from, to]) => {\n // dedupe by node label, preferring 'set' over 'get'\n const labelMap = new Map<string, { node: TypedNode, type: RelationType }>();\n for (const item of to) {\n const node = this.nodes.get(item.label)!;\n if (!node) {\n continue;\n }\n const existing = labelMap.get(item.label);\n if (!existing || (existing.type === 'get' && item.type === 'set')) {\n labelMap.set(item.label, { node, type: item.type });\n }\n }\n const items = Array.from(labelMap.values());\n return [this.nodes.get(from)!, new Set(items)];\n }));\n\n return {\n nodes,\n edges,\n };\n }\n}\n\nexport function getComment(node: t.Node) {\n let comment = '';\n\n node.leadingComments?.forEach((_comment) => {\n if (_comment.loc!.end.line > node.loc!.start.line) {\n return;\n }\n if (_comment.value.trim().startsWith('*')) {\n comment += `${_comment.value.trim().replace(/^\\s*\\*+\\s*\\**/gm, '').trim()}\\n`;\n }\n });\n\n node.trailingComments?.forEach((_comment) => {\n if (_comment.loc!.end.line > node.loc!.start.line) {\n return;\n }\n if (_comment.value.trim().startsWith('*')) {\n comment += `${_comment.value.trim().replace(/^\\s*\\*+\\s*\\**/gm, '').trim()}\\n`;\n }\n else {\n comment += `${_comment.value.trim()}\\n`;\n }\n });\n\n return comment.trim();\n}\n\nexport function isWritingNode(path: NodePath<t.Node>) {\n // Check if the current node is inside an assignment expression (including nested MemberExpression)\n const assignParent = path.findParent(p => p.isAssignmentExpression()) as NodePath<t.AssignmentExpression> | null;\n if (assignParent) {\n const leftNode = assignParent.node.left;\n if (\n leftNode.start != null\n && path.node.start! >= leftNode.start\n && path.node.end! <= (leftNode.end as number)\n ) {\n return true;\n }\n }\n\n // Check if the current node is inside an update expression (including nested MemberExpression)\n const updateParent = path.findParent(p => p.isUpdateExpression()) as NodePath<t.UpdateExpression> | null;\n if (updateParent) {\n const argNode = updateParent.node.argument as t.Node;\n if (\n argNode.start != null\n && path.node.start! >= argNode.start\n && path.node.end! <= (argNode.end as number)\n ) {\n return true;\n }\n }\n\n return false;\n}\n\nexport function isCallingNode(path: NodePath<t.Identifier>) {\n const parent = path.parentPath;\n // 判断父节点是否为 CallExpression,并且当前节点是 callee\n if (parent && parent.isCallExpression()) {\n return parent.node.callee === path.node;\n }\n return false;\n}\n\nexport function getRelationType(path: NodePath<t.Node>) {\n if (path.node.type === 'Identifier' && isCallingNode(path as NodePath<t.Identifier>)) {\n return 'call';\n }\n if (isWritingNode(path)) {\n return 'set';\n }\n return 'get';\n}\n","import type { NodePath, Scope, VisitNode } from '@babel/traverse';\nimport type * as t from '@babel/types';\nimport type { RelationType } from './utils';\nimport _traverse from '@babel/traverse';\nimport { babelParse } from '@vue/compiler-sfc';\nimport { getComment, getRelationType, NodeCollection, NodeType } from './utils';\n\nconst traverse: typeof _traverse\n // @ts-expect-error unwarp default\n = _traverse.default?.default || _traverse.default || _traverse;\n\nconst ignoreFunctionsName = ['defineProps', 'defineEmits', 'withDefaults'];\n\nexport const watchHooks = [\n 'watch',\n\n // from `@vueuse/core`\n 'watchArray',\n 'watchAtMost',\n 'watchDebounced',\n 'watchDeep',\n 'watchIgnorable',\n 'watchImmediate',\n 'watchOnce',\n 'watchPausable',\n 'watchThrottled',\n 'watchTriggerable',\n 'watchWithFilter',\n];\n\nexport function processSetup(\n ast: t.Node,\n parentScope?: Scope,\n parentPath?: t.Node,\n _spread?: string[],\n _lineOffset = 0,\n) {\n const spread = _spread || [];\n\n const nodeCollection = new NodeCollection(_lineOffset);\n\n const graph = {\n nodes: new Set<string>(),\n edges: new Map<string, Set<{ label: string, type: RelationType }>>(),\n spread: new Map<string, Set<string>>(),\n };\n\n traverse(ast, {\n VariableDeclaration(path) {\n path.node.declarations.forEach((declaration) => {\n if (declaration.id.type === 'ArrayPattern') {\n declaration.id.elements.forEach((element) => {\n if (element?.type === 'Identifier') {\n const name = element.name;\n const binding = path.scope.getBinding(name);\n\n if (\n binding\n && (path.parent.type === 'Program'\n || (parentPath?.type === 'ObjectMethod' && parentPath.body === path.parent)\n )\n && !(declaration.init?.type === 'CallExpression'\n && declaration.init?.callee.type === 'Identifier'\n && ignoreFunctionsName.includes(declaration.init?.callee.name)\n )\n ) {\n graph.nodes.add(name);\n nodeCollection.addNode(name, element, {\n comment: getComment(path.node),\n });\n if (!graph.edges.get(name)) {\n graph.edges.set(name, new Set());\n }\n }\n }\n if (element?.type === 'RestElement' && element.argument.type === 'Identifier') {\n const name = element.argument.name;\n const binding = path.scope.getBinding(name);\n\n if (\n binding\n && (path.parent.type === 'Program'\n || (parentPath?.type === 'ObjectMethod' && parentPath.body === path.parent)\n )\n && !(declaration.init?.type === 'CallExpression'\n && declaration.init?.callee.type === 'Identifier'\n && ignoreFunctionsName.includes(declaration.init?.callee.name)\n )\n ) {\n graph.nodes.add(name);\n nodeCollection.addNode(name, element.argument, {\n comment: getComment(path.node),\n });\n if (!graph.edges.get(name)) {\n graph.edges.set(name, new Set());\n }\n }\n }\n });\n }\n if (declaration.id.type === 'ObjectPattern') {\n declaration.id.properties.forEach((property) => {\n if (property.type === 'ObjectProperty' && property.value.type === 'Identifier') {\n const name = property.value.name;\n const binding = path.scope.getBinding(name);\n if (\n binding\n && (path.parent.type === 'Program'\n || (parentPath?.type === 'ObjectMethod' && parentPath.body === path.parent)\n )\n && !(declaration.init?.type === 'CallExpression'\n && declaration.init?.callee.type === 'Identifier'\n && ignoreFunctionsName.includes(declaration.init?.callee.name)\n )\n ) {\n graph.nodes.add(name);\n nodeCollection.addNode(name, property.value, {\n comment: getComment(property),\n });\n if (!graph.edges.get(name)) {\n graph.edges.set(name, new Set());\n }\n }\n }\n\n if (property.type === 'RestElement' && property.argument.type === 'Identifier') {\n const name = property.argument.name;\n const binding = path.scope.getBinding(name);\n if (\n binding\n && (path.parent.type === 'Program'\n || (parentPath?.type === 'ObjectMethod' && parentPath.body === path.parent)\n )\n && !(declaration.init?.type === 'CallExpression'\n && declaration.init?.callee.type === 'Identifier'\n && ignoreFunctionsName.includes(declaration.init?.callee.name)\n )\n ) {\n graph.nodes.add(name);\n nodeCollection.addNode(name, property.argument, {\n comment: getComment(property),\n });\n if (!graph.edges.get(name)) {\n graph.edges.set(name, new Set());\n }\n }\n }\n });\n }\n if (declaration.id?.type === 'Identifier') {\n const name = declaration.id.name;\n const binding = path.scope.getBinding(name);\n if (\n binding\n && (path.parent.type === 'Program'\n || (parentPath?.type === 'ObjectMethod' && parentPath.body === path.parent)\n )\n && !(declaration.init?.type === 'CallExpression'\n && declaration.init?.callee.type === 'Identifier'\n && ignoreFunctionsName.includes(declaration.init?.callee.name)\n )\n ) {\n graph.nodes.add(name);\n nodeCollection.addNode(name, declaration, {\n comment: getComment(path.node),\n });\n if (!graph.edges.get(name)) {\n graph.edges.set(name, new Set());\n }\n\n if (spread.includes(name)) {\n if (declaration.init?.type === 'ObjectExpression') {\n declaration.init?.properties.forEach((prop) => {\n if (\n (prop.type === 'ObjectProperty' || prop.type === 'ObjectMethod')\n && prop.key.type === 'Identifier'\n ) {\n const keyName = prop.key.name;\n graph.nodes.add(keyName);\n nodeCollection.addNode(keyName, prop, {\n comment: getComment(prop),\n });\n if (!graph.edges.get(keyName)) {\n graph.edges.set(keyName, new Set());\n }\n if (graph.spread.has(name)) {\n graph.spread.get(name)?.add(keyName);\n }\n else {\n graph.spread.set(name, new Set([keyName]));\n }\n }\n else if (prop.type === 'SpreadElement') {\n console.warn('not support spread in spread');\n }\n });\n }\n if (\n declaration.init?.type === 'CallExpression'\n && declaration.init?.callee.type === 'Identifier'\n && declaration.init?.callee.name === 'reactive'\n ) {\n const arg = declaration.init?.arguments[0];\n if (arg.type === 'ObjectExpression') {\n arg.properties.forEach((prop) => {\n if (\n (prop.type === 'ObjectProperty' || prop.type === 'ObjectMethod')\n && prop.key.type === 'Identifier'\n ) {\n const keyName = prop.key.name;\n graph.nodes.add(keyName);\n nodeCollection.addNode(keyName, prop, {\n comment: getComment(prop),\n });\n if (!graph.edges.get(keyName)) {\n graph.edges.set(keyName, new Set());\n }\n if (graph.spread.has(name)) {\n graph.spread.get(name)?.add(keyName);\n }\n else {\n graph.spread.set(name, new Set([keyName]));\n }\n }\n else if (prop.type === 'SpreadElement') {\n console.warn('not support spread in spread');\n }\n });\n }\n }\n }\n }\n }\n });\n },\n FunctionDeclaration(path) {\n const name = path.node.id?.name;\n if (name) {\n const binding = path.scope.getBinding(name);\n if (binding && (path.parent.type === 'Program'\n || (parentPath?.type === 'ObjectMethod' && parentPath.body === path.parent)\n )) {\n graph.nodes.add(name);\n nodeCollection.addNode(name, path.node.id!, {\n isMethod: true,\n comment: getComment(path.node),\n });\n if (!graph.edges.get(name)) {\n graph.edges.set(name, new Set());\n }\n }\n }\n },\n }, parentScope, parentPath);\n\n function traverseHooks(node: t.ExpressionStatement | t.CallExpression, patentScope: Scope) {\n if (\n (\n node.type === 'ExpressionStatement'\n && node.expression.type === 'CallExpression'\n && node.expression.callee.type === 'Identifier'\n ) || (\n node.type === 'CallExpression'\n && node.callee.type === 'Identifier'\n )\n ) {\n const hookName = (() => {\n if (node.type === 'ExpressionStatement'\n && node.expression.type === 'CallExpression'\n && node.expression.callee.type === 'Identifier') {\n return node.expression.callee.name;\n }\n if (node.type === 'CallExpression'\n && node.callee.type === 'Identifier') {\n return node.callee.name;\n }\n })() || '';\n\n if (!hookName) {\n return;\n }\n\n const hookBinding = patentScope.getBinding(hookName);\n if (!(hookBinding === undefined || hookBinding?.scope.block.type === 'Program'\n || parentScope === hookBinding?.scope)) {\n return;\n }\n\n const expression = (node.type === 'ExpressionStatement'\n ? node.expression\n : node) as t.CallExpression;\n\n const watchArgs = new Set<t.Identifier>();\n\n if (hookName === 'provide') {\n traverse(expression, {\n Identifier(path1) {\n const binding = path1.scope.getBinding(path1.node.name);\n if (\n graph.nodes.has(path1.node.name)\n && (\n (path1.parent.type !== 'MemberExpression'\n && path1.parent.type !== 'OptionalMemberExpression')\n || path1.parent.object === path1.node\n )\n && (binding?.scope.block.type === 'Program'\n || parentScope === binding?.scope)\n ) {\n const _node = nodeCollection.getNode(path1.node.name);\n if (_node?.info?.used) {\n _node?.info?.used?.add(hookName);\n }\n else if (_node) {\n _node.info = {\n ..._node?.info,\n used: new Set([hookName]),\n };\n }\n }\n },\n }, patentScope, node);\n }\n else if (watchHooks.includes(hookName)) {\n if (expression.arguments[0].type === 'Identifier') {\n const binding = patentScope.getBinding(expression.arguments[0].name);\n if (\n graph.nodes.has(expression.arguments[0].name)\n && (binding?.scope.block.type === 'Program'\n || parentScope === binding?.scope)\n ) {\n watchArgs.add(expression.arguments[0]);\n }\n }\n else {\n traverse(expression.arguments[0], {\n Identifier(path1) {\n const binding = path1.scope.getBinding(path1.node.name);\n if (\n graph.nodes.has(path1.node.name)\n && (\n (path1.parent.type !== 'MemberExpression'\n && path1.parent.type !== 'OptionalMemberExpression')\n || path1.parent.object === path1.node\n )\n && (binding?.scope.block.type === 'Program'\n || parentScope === binding?.scope)\n ) {\n watchArgs.add(path1.node);\n }\n },\n }, patentScope, node);\n }\n }\n else if (hookName === 'useEffect' && expression.arguments[1].type === 'ArrayExpression') {\n traverse(expression.arguments[1], {\n Identifier(path1) {\n const binding = path1.scope.getBinding(path1.node.name);\n if (\n graph.nodes.has(path1.node.name)\n && (\n (path1.parent.type !== 'MemberExpression'\n && path1.parent.type !== 'OptionalMemberExpression')\n || path1.parent.object === path1.node\n )\n && (binding?.scope.block.type === 'Program'\n || parentScope === binding?.scope)\n ) {\n watchArgs.add(path1.node);\n }\n },\n }, patentScope, node);\n }\n expression.arguments.forEach((argNode, index) => {\n if (watchHooks.includes(hookName) && index === 0 && argNode.type === 'Identifier') {\n const _node = nodeCollection.getNode(argNode.name);\n if (_node?.info?.used) {\n _node?.info?.used?.add(hookName);\n }\n else if (_node) {\n _node.info = {\n ..._node?.info,\n used: new Set([hookName]),\n };\n }\n return;\n }\n if (argNode.type === 'Identifier') {\n const binding = patentScope.getBinding(argNode.name);\n if (\n graph.nodes.has(argNode.name)\n && (binding?.scope.block.type === 'Program'\n || parentScope === binding?.scope)\n ) {\n const _node = nodeCollection.getNode(argNode.name);\n if (_node?.info?.used) {\n _node?.info?.used?.add(hookName);\n }\n else if (_node) {\n _node.info = {\n ..._node?.info,\n used: new Set([hookName]),\n };\n }\n }\n }\n else {\n traverse(argNode, {\n Identifier(path1) {\n const binding = path1.scope.getBinding(path1.node.name);\n if (\n graph.nodes.has(path1.node.name)\n && (\n (path1.parent.type !== 'MemberExpression'\n && path1.parent.type !== 'OptionalMemberExpression')\n || path1.parent.object === path1.node\n )\n && (binding?.scope.block.type === 'Program'\n || parentScope === binding?.scope)\n ) {\n if ([...watchHooks, 'useEffect'].includes(hookName) && watchArgs.size > 0) {\n const watchArgsNames = Array.from(watchArgs).map(arg => arg.name);\n watchArgs.forEach((watchArg) => {\n if (!watchArgsNames.includes(path1.node.name)) {\n graph.edges.get(watchArg.name)?.add({\n label: path1.node.name,\n type: getRelationType(path1),\n });\n }\n });\n }\n const _node = nodeCollection.getNode(path1.node.name);\n if (_node?.info?.used) {\n _node?.info?.used?.add(hookName);\n }\n else if (_node) {\n _node.info = {\n ..._node?.info,\n used: new Set([hookName]),\n };\n }\n }\n },\n }, patentScope, node);\n }\n });\n }\n }\n\n // get the relation between the variable and the function\n traverse(ast, {\n FunctionDeclaration(path) {\n const name = path.node.id?.name;\n if (name && graph.nodes.has(name)) {\n traverse(path.node.body, {\n Identifier(path1) {\n const binding = path1.scope.getBinding(path1.node.name);\n if (\n graph.nodes.has(path1.node.name)\n && (\n (path1.parent.type !== 'MemberExpression'\n && path1.parent.type !== 'OptionalMemberExpression')\n || path1.parent.object === path1.node\n )\n && (binding?.scope.block.type === 'Program'\n || (parentScope === binding?.scope)\n )\n ) {\n graph.edges.get(name)?.add({\n label: path1.node.name,\n type: getRelationType(path1),\n });\n }\n },\n MemberExpression(path1) {\n if (\n path1.node.object.type === 'Identifier'\n && spread.includes(path1.node.object.name)\n ) {\n const binding = path1.scope.getBinding(path1.node.object.name);\n if (\n spread.includes(path1.node.object.name)\n && path1.node.property.type === 'Identifier'\n && (binding?.scope.block.type === 'Program'\n || (parentScope === binding?.scope)\n )\n ) {\n graph.edges.get(name)?.add({\n label: path1.node.property.name,\n type: getRelationType(path1),\n });\n }\n }\n },\n }, path.scope, path);\n }\n },\n\n VariableDeclarator(path) {\n if (path.node.init) {\n if (path.node.id.type === 'ArrayPattern') {\n path.node.id.elements.forEach((element) => {\n if (element?.type === 'Identifier') {\n const name = element.name;\n if (name && graph.nodes.has(name) && path.node.init?.type === 'CallExpression') {\n traverse(path.node.init, {\n Identifier(path1) {\n const binding = path1.scope.getBinding(path1.node.name);\n if (\n graph.nodes.has(path1.node.name)\n && (\n (path1.parent.type !== 'MemberExpression'\n && path1.parent.type !== 'OptionalMemberExpression')\n || path1.parent.object === path1.node\n )\n && (binding?.scope.block.type === 'Program'\n || (parentScope === binding?.scope)\n )\n ) {\n graph.edges.get(name)?.add({\n label: path1.node.name,\n type: getRelationType(path1),\n });\n }\n },\n MemberExpression(path1) {\n if (\n path1.node.object.type === 'Identifier'\n && spread.includes(path1.node.object.name)\n ) {\n const binding = path1.scope.getBinding(path1.node.object.name);\n if (\n spread.includes(path1.node.object.name)\n && path1.node.property.type === 'Identifier'\n && (binding?.scope.block.type === 'Program'\n || (parentScope === binding?.scope)\n )\n ) {\n graph.edges.get(name)?.add({\n label: path1.node.property.name,\n type: getRelationType(path1),\n });\n }\n }\n },\n }, path.scope, path);\n }\n }\n });\n }\n else if (path.node.id.type === 'ObjectPattern') {\n path.node.id.properties.forEach((property) => {\n if (property.type === 'ObjectProperty' && property.value.type === 'Identifier') {\n const name = property.value.name;\n if (name && graph.nodes.has(name) && path.node.init) {\n traverse(path.node.init, {\n Identifier(path1) {\n const binding = path1.scope.getBinding(path1.node.name);\n if (\n graph.nodes.has(path1.node.name)\n && (\n (path1.parent.type !== 'MemberExpression'\n && path1.parent.type !== 'OptionalMemberExpression')\n || path1.parent.object === path1.node\n )\n && (binding?.scope.block.type === 'Program'\n || (parentScope === binding?.scope)\n )\n ) {\n graph.edges.get(name)?.add({\n label: path1.node.name,\n type: getRelationType(path1),\n });\n }\n },\n MemberExpression(path1) {\n if (\n path1.node.object.type === 'Identifier'\n && spread.includes(path1.node.object.name)\n ) {\n const binding = path1.scope.getBinding(path1.node.object.name);\n if (\n spread.includes(path1.node.object.name)\n && path1.node.property.type === 'Identifier'\n && (binding?.scope.block.type === 'Program'\n || (parentScope === binding?.scope)\n )\n ) {\n graph.edges.get(name)?.add({\n label: path1.node.property.name,\n type: getRelationType(path1),\n });\n }\n }\n },\n }, path.scope, path);\n }\n }\n });\n }\n else if ([\n 'CallExpression',\n 'ArrowFunctionExpression',\n 'FunctionDeclaration',\n ].includes(path.node.init.type)\n && path.node.id.type === 'Identifier'\n ) {\n if (path.node.init.type === 'CallExpression' && path.node.init.callee.type === 'Identifier' && [...watchHooks, 'watchEffect'].includes(path.node.init.callee.name)) {\n traverseHooks(path.node.init, path.scope);\n }\n const name = path.node.id?.name;\n if (name && graph.nodes.has(name)) {\n traverse(path.node.init, {\n Identifier(path1) {\n const binding = path1.scope.getBinding(path1.node.name);\n if (\n graph.nodes.has(path1.node.name)\n && (\n (path1.parent.type !== 'MemberExpression'\n && path1.parent.type !== 'OptionalMemberExpression')\n || path1.parent.object === path1.node\n )\n && (binding?.scope.block.type === 'Program'\n || (parentScope === binding?.scope)\n )\n ) {\n graph.edges.get(name)?.add({\n label: path1.node.name,\n type: getRelationType(path1),\n });\n }\n },\n MemberExpression(path1) {\n if (\n path1.node.object.type === 'Identifier'\n && spread.includes(path1.node.object.name)\n ) {\n const binding = path1.scope.getBinding(path1.node.object.name);\n if (\n spread.includes(path1.node.object.name)\n && path1.node.property.type === 'Identifier'\n && (binding?.scope.block.type === 'Program'\n || (parentScope === binding?.scope)\n )\n ) {\n graph.edges.get(name)?.add({\n label: path1.node.property.name,\n type: getRelationType(path1),\n });\n }\n }\n },\n }, path.scope, path);\n }\n }\n else if (path.node.id.type === 'Identifier') {\n const name = path.node.id.name;\n if (path.node.init.type === 'Identifier') {\n const binding = path.scope.getBinding(path.node.init.name);\n if (\n graph.nodes.has(path.node.init.name)\n && (binding?.scope.block.type === 'Program'\n || (parentScope === binding?.scope)\n )\n ) {\n graph.edges.get(name)?.add({\n label: path.node.init.name,\n type: getRelationType(path),\n });\n }\n }\n else {\n traverse(path.node.init, {\n Identifier(path1) {\n const binding = path1.scope.getBinding(path1.node.name);\n if (\n graph.nodes.has(path1.node.name)\n && (\n (path1.parent.type !== 'MemberExpression'\n && path1.parent.type !== 'OptionalMemberExpression')\n || path1.parent.object === path1.node\n )\n && (binding?.scope.block.type === 'Program'\n || (parentScope === binding?.scope)\n )\n ) {\n graph.edges.get(name)?.add({\n label: path1.node.name,\n type: getRelationType(path1),\n });\n }\n },\n }, path.scope, path);\n }\n }\n }\n },\n\n ObjectMethod(path) {\n if (path.node.key.type === 'Identifier' && graph.nodes.has(path.node.key.name)) {\n const name = path.node.key.name;\n\n traverse(path.node.body, {\n Identifier(path1) {\n const binding = path1.scope.getBinding(path1.node.name);\n if (\n graph.nodes.has(path1.node.name)\n && (\n (path1.parent.type !== 'MemberExpression'\n && path1.parent.type !== 'OptionalMemberExpression')\n || path1.parent.object === path1.node\n )\n && (binding?.scope.block.type === 'Program'\n || (parentScope === binding?.scope)\n )\n ) {\n graph.edges.get(name)?.add({\n label: path1.node.name,\n type: getRelationType(path1),\n });\n }\n },\n MemberExpression(path1) {\n if (\n path1.node.object.type === 'Identifier'\n && spread.includes(path1.node.object.name)\n ) {\n const binding = path1.scope.getBinding(path1.node.object.name);\n if (\n spread.includes(path1.node.object.name)\n && path1.node.property.type === 'Identifier'\n && (binding?.scope.block.type === 'Program'\n || (parentScope === binding?.scope)\n )\n ) {\n graph.edges.get(name)?.add({\n label: path1.node.property.name,\n type: getRelationType(path1),\n });\n }\n }\n },\n }, path.scope, path);\n }\n },\n\n ObjectProperty(path) {\n if (path.node.key.type === 'Identifier' && graph.nodes.has(path.node.key.name)) {\n const name = path.node.key.name;\n\n traverse(path.node.value, {\n MemberExpression(path1) {\n if (\n path1.node.object.type === 'Identifier'\n && spread.includes(path1.node.object.name)\n ) {\n const binding = path1.scope.getBinding(path1.node.object.name);\n if (\n spread.includes(path1.node.object.name)\n && path1.node.property.type === 'Identifier'\n && (binding?.scope.block.type === 'Program'\n || (parentScope === binding?.scope)\n )\n ) {\n graph.edges.get(name)?.add({\n label: path1.node.property.name,\n type: getRelationType(path1),\n });\n }\n }\n },\n }, path.scope, path);\n }\n },\n ExpressionStatement(path) {\n if (path.type === 'ExpressionStatement'\n && path.node.expression.type === 'CallExpression'\n && path.node.expression.callee.type === 'Identifier'\n ) {\n const name = path.node.expression.callee.name;\n if (\n graph.nodes.has(name)\n && (path.scope.block.type === 'Program')\n ) {\n const _node = nodeCollection.getNode(name);\n if (_node?.info?.used) {\n _node?.info?.used?.add('Call Expression');\n }\n else if (_node) {\n _node.info = {\n ..._node?.info,\n used: new Set(['Call Expression']),\n };\n }\n }\n else {\n traverseHooks(path.node.expression, path.scope);\n }\n }\n if (path.type === 'ExpressionStatement'\n && path.node.expression.type === 'AssignmentExpression'\n && path.node.expression.right.type === 'CallExpression'\n && path.node.expression.right.callee.type === 'Identifier'\n ) {\n traverseHooks(path.node.expression.right, path.scope);\n }\n },\n }, parentScope, parentPath);\n\n return {\n graph,\n nodeCollection,\n };\n}\n\nexport function analyze(\n content: string,\n lineOffset = 0,\n jsx = false,\n) {\n // console.log(content);\n const ast = babelParse(content, { sourceType: 'module', plugins: [\n 'typescript',\n ...jsx\n ? ['jsx' as const]\n : [],\n ] });\n\n // ---\n const { graph, nodeCollection } = processSetup(ast, undefined, undefined, undefined, lineOffset);\n return nodeCollection.map(graph);\n}\n","import type { NodePath } from '@babel/traverse';\nimport type * as t from '@babel/types';\nimport type { RelationType } from './utils';\nimport _traverse from '@babel/traverse';\nimport { babelParse } from '@vue/compiler-sfc';\nimport { processSetup, watchHooks } from './setupScript';\nimport { getComment, getRelationType, NodeCollection } from './utils';\n\nconst traverse: typeof _traverse\n // @ts-expect-error unwarp default\n = _traverse.default?.default || _traverse.default || _traverse;\n\nconst vueLifeCycleHooks = [\n 'beforeCreate',\n 'created',\n 'beforeMount',\n 'mounted',\n 'beforeUpdate',\n 'updated',\n 'beforeDestroy',\n 'destroyed',\n 'activated',\n 'deactivated',\n 'errorCaptured',\n 'renderTracked',\n 'renderTriggered',\n 'provide',\n];\n\nexport function analyze(\n content: string,\n lineOffset = 0,\n jsx = false,\n) {\n // console.log({lineOffset});\n // console.log(content);\n const ast = babelParse(content, { sourceType: 'module', plugins: [\n 'typescript',\n ...jsx\n ? ['jsx' as const]\n : [],\n ] });\n\n // ---\n\n let nodeCollection = new NodeCollection(lineOffset);\n\n const tNodes = new Map<string, t.Identifier>();\n const graph = {\n nodes: new Set<string>(),\n edges: new Map<string, Set<{ label: string, type: RelationType }>>(),\n };\n\n /** used in render block or setup return */\n const nodesUsedInTemplate = new Set<string>();\n\n function process(node: t.ObjectExpression, path: NodePath<t.ExportDefaultDeclaration>) {\n traverse(node, {\n ObjectProperty(path1) {\n if (\n (\n path.node.declaration.type === 'ObjectExpression'\n && path1.parent === path.node.declaration\n ) || (\n path.node.declaration.type === 'CallExpression'\n && path1.parent === path.node.declaration.arguments[0]\n )\n ) {\n // data\n if (\n path1.node.key.type === 'Identifier'\n && path1.node.key.name === 'data'\n && (\n path1.node.value.type === 'ArrowFunctionExpression'\n || path1.node.value.type === 'FunctionExpression'\n )\n ) {\n const dataNode = path1.node.value;\n\n traverse(dataNode, {\n ReturnStatement(path2) {\n if (path2.parent === dataNode.body) {\n if (path2.node.argument?.type === 'ObjectExpression') {\n path2.node.argument.properties.forEach((prop) => {\n if (prop.type === 'ObjectProperty') {\n if (prop.key.type === 'Identifier') {\n const name = prop.key.name;\n graph.nodes.add(name);\n tNodes.set(name, prop.key);\n nodeCollection.addNode(name, prop, {\n comment: getComment(prop),\n });\n if (!graph.edges.get(name)) {\n graph.edges.set(name, new Set());\n }\n }\n }\n });\n }\n }\n },\n }, path1.scope, path1);\n }\n\n // computed\n if (path1.node.key.type === 'Identifier' && path1.node.key.name === 'computed') {\n const computedNode = path1.node;\n if (computedNode.value.type === 'ObjectExpression') {\n computedNode.value.properties.forEach((prop) => {\n if (prop.type === 'ObjectProperty' || prop.type === 'ObjectMethod') {\n if (prop.key.type === 'Identifier') {\n const name = prop.key.name;\n graph.nodes.add(name);\n tNodes.set(name, prop.key);\n nodeCollection.addNode(name, prop, {\n isComputed: true,\n comment: getComment(prop),\n });\n if (!graph.edges.get(name)) {\n graph.edges.set(name, new Set());\n }\n }\n }\n });\n }\n }\n\n // methods\n if (path1.node.key.type === 'Identifier' && path1.node.key.name === 'methods') {\n const methodsNode = path1.node;\n if (methodsNode.value.type === 'ObjectExpression') {\n methodsNode.value.properties.forEach((prop) => {\n if (prop.type === 'ObjectProperty' || prop.type === 'ObjectMethod') {\n if (prop.key.type === 'Identifier') {\n const name = prop.key.name;\n graph.nodes.add(name);\n tNodes.set(name, prop.key);\n nodeCollection.addNode(name, prop, {\n isMethod: true,\n comment: getComment(prop),\n });\n if (!graph.edges.get(name)) {\n graph.edges.set(name, new Set());\n }\n }\n }\n });\n }\n }\n\n if (\n path1.node.key.type === 'Identifier'\n && path1.node.key.name === 'render'\n && (\n path1.node.value.type === 'ArrowFunctionExpression'\n || path1.node.value.type === 'FunctionExpression'\n )\n ) {\n traverse(path1.node.value, {\n ReturnStatement(path2) {\n const templateNode = path2.node;\n traverse(templateNode, {\n MemberExpression(path3) {\n if (path3.node.object && path3.node.object.type === 'ThisExpression') {\n if (path3.node.property && path3.node.property.type === 'Identifier') {\n nodesUsedInTemplate.add(path3.node.property.name);\n }\n }\n },\n }, path2.scope, path2);\n },\n }, path1.scope, path1);\n }\n }\n },\n ObjectMethod(path1) {\n if (\n (\n path.node.declaration.type === 'ObjectExpression'\n && path1.parent === path.node.declaration\n ) || (\n path.node.declaration.type === 'CallExpression'\n && path1.parent === path.node.declaration.arguments[0]\n )\n ) {\n // setup\n if (path1.node.key.type === 'Identifier' && path1.node.key.name === 'setup') {\n const setupNode = path1.node;\n\n const spread: string[] = [];\n\n traverse(setupNode, {\n ReturnStatement(path2) {\n if (path2.node.argument?.type === 'ObjectExpression') {\n const returnNode = path2.node.argument;\n traverse(returnNode, {\n SpreadElement(path3) {\n // ...toRefs(xxx)\n if (\n path3.node.argument.type === 'CallExpression'\n && path3.node.argument.callee.type === 'Identifier'\n && path3.node.argument.callee.name === 'toRefs'\n && path3.node.argument.arguments[0].type === 'Identifier'\n ) {\n spread.push(path3.node.argument.arguments[0].name);\n }\n // ...xxx\n else if (\n path3.node.argument.type === 'Identifier'\n ) {\n spread.push(path3.node.argument.name);\n }\n },\n }, path2.scope, path2);\n }\n if (\n path2.node.argument?.type === 'FunctionExpression'\n || path2.node.argument?.type === 'ArrowFunctionExpression'\n ) {\n const templateNode = path2.node.argument.body;\n traverse(templateNode, {\n Identifier(path3) {\n const binding = path3.scope.getBinding(path3.node.name);\n if (binding?.scope === path1.scope) {\n nodesUsedInTemplate.add(path3.node.name);\n }\n },\n JSXIdentifier(path3) {\n const binding = path3.scope.getBinding(path3.node.name);\n if (binding?.scope === path1.scope) {\n nodesUsedInTemplate.add(path3.node.name);\n }\n },\n }, path2.scope, path2);\n }\n },\n }, path1.scope, path1);\n\n const {\n graph: {\n nodes: tempNodes,\n edges: tempEdges,\n spread: tempSpread,\n },\n nodeCollection: tempNodeCollection,\n } = processSetup(setupNode, path1.scope, setupNode, spread, lineOffset);\n\n // 3 filter data by return\n traverse(setupNode, {\n ReturnStatement(path2) {\n // only process return in setupNode scope\n if (path2.scope !== path1.scope) {\n return;\n }\n\n if (path2.node.argument?.type === 'ObjectExpression') {\n const returnNode = path2.node.argument;\n traverse(returnNode, {\n ObjectProperty(path3) {\n if (path3.parent === returnNode) {\n if (\n path3.node.key.type === 'Identifier'\n && path3.node.value.type === 'Identifier'\n && tempNodes.has(path3.node.value.name)\n ) {\n const valName = path3.node.value.name;\n if (!graph.nodes.has(valName)) {\n graph.nodes.add(valName);\n tNodes.set(valName, path3.node.value);\n nodeCollection.addTypedNode(\n valName,\n tempNodeCollection.nodes.get(valName)!,\n );\n }\n if (!graph.edges.has(valName)) {\n graph.edges.set(valName, new Set([...Array.from(\n tempEdges.get(valName) || new Set<{ label: string, type: RelationType }>(),\n )]));\n }\n\n const name = path3.node.key.name;\n if (name !== valName) {\n graph.nodes.add(name);\n tNodes.set(name, path3.node.key);\n nodeCollection.addNode(name, path3.node.key, {\n comment: getComment(path3.node),\n });\n graph.edges.set(name, new Set([{\n label: valName,\n type: getRelationType(path3),\n }]));\n }\n }\n }\n },\n SpreadElement(path3) {\n // ...toRefs(xxx)\n if (\n path3.node.argument.type === 'CallExpression'\n && path3.node.argument.callee.type === 'Identifier'\n && path3.node.argument.callee.name === 'toRefs'\n && path3.node.argument.arguments[0].type === 'Identifier'\n && tempSpread.get(path3.node.argument.arguments[0].name)\n ) {\n tempSpread.get(path3.node.argument.arguments[0].name)?.forEach((name) => {\n graph.nodes.add(name);\n // @ts-expect-error Identifier\n tNodes.set(name, path3.node.argument.arguments[0]);\n nodeCollection.addTypedNode(name, tempNodeCollection.nodes.get(name)!);\n if (!graph.edges.get(name)) {\n graph.edges.set(name, new Set());\n tempEdges.get(name)?.forEach((edge) => {\n graph.edges.get(name)?.add(edge);\n });\n }\n });\n }\n // ...xxx\n else if (\n path3.node.argument.type === 'Identifier'\n && tempSpread.get(path3.node.argument.name)\n ) {\n tempSpread.get(path3.node.argument.name)?.forEach((name) => {\n graph.nodes.add(name);\n // @ts-expect-error Identifier\n tNodes.set(name, path3.node.argument);\n nodeCollection.addTypedNode(name, tempNodeCollection.nodes.get(name)!);\n if (!graph.edges.get(name)) {\n graph.edges.set(name, new Set());\n tempEdges.get(name)?.forEach((edge) => {\n graph.edges.get(name)?.add(edge);\n });\n }\n });\n }\n },\n }, path2.scope, path2);\n }\n else {\n graph.edges = tempEdges;\n graph.nodes = tempNodes;\n nodeCollection = tempNodeCollection;\n }\n },\n }, path1.scope, path1);\n }\n\n // data\n if (path1.node.key.type === 'Identifier' && path1.node.key.name === 'data') {\n const dataNode = path1.node;\n\n traverse(dataNode, {\n ReturnStatement(path2) {\n if (path2.parent === dataNode.body) {\n if (path2.node.argument?.type === 'ObjectExpression') {\n path2.node.argument.properties.forEach((prop) => {\n if (prop.type === 'ObjectProperty') {\n if (prop.key.type === 'Identifier') {\n const name = prop.key.name;\n graph.nodes.add(name);\n tNodes.set(name, prop.key);\n nodeCollection.addNode(name, prop, {\n comment: getComment(prop),\n });\n if (!graph.edges.get(name)) {\n graph.edges.set(name, new Set());\n }\n }\n }\n });\n }\n }\n },\n }, path1.scope, path1);\n }\n\n // render\n if (path1.node.key.type === 'Identifier' && path1.node.key.name === 'render') {\n traverse(path1.node, {\n ReturnStatement(path2) {\n const templateNode = path2.node;\n traverse(templateNode, {\n MemberExpression(path3) {\n if (path3.node.object && path3.node.object.type === 'ThisExpression') {\n if (path3.node.property && path3.node.property.type === 'Identifier') {\n nodesUsedInTemplate.add(path3.node.property.name);\n }\n }\n },\n }, path2.scope, path2);\n },\n }, path1.scope, path1);\n }\n }\n },\n }, path.scope, path);\n\n traverse(node, {\n ObjectMethod(path1) {\n if (\n (\n path.node.declaration.type === 'ObjectExpression'\n && path1.parent === path.node.declaration\n ) || (\n path.node.declaration.type === 'CallExpression'\n && path1.parent === path.node.declaration.arguments[0]\n )\n ) {\n if (path1.node.key.type === 'Identifier' && vueLifeCycleHooks.includes(path1.node.key.name)) {\n const hookName = path1.node.key.name;\n\n traverse(path1.node.body, {\n MemberExpression(path2) {\n if (path2.node.object.type === 'ThisExpression' && path2.node.property.type === 'Identifier') {\n const _node = nodeCollection.getNode(path2.node.property.name);\n if (_node?.info?.used) {\n _node?.info?.used?.add(hookName);\n }\n else if (_node) {\n _node.info = {\n ..._node?.info,\n used: new Set([hookName]),\n };\n }\n }\n },\n }, path1.scope, path1);\n }\n }\n },\n ObjectProperty(path1) {\n if (\n (\n path.node.declaration.type === 'ObjectExpression'\n && path1.parent === path.node.declaration\n ) || (\n path.node.declaration.type === 'CallExpression'\n && path1.parent === path.node.declaration.arguments[0]\n )\n ) {\n if (path1.node.key.type === 'Identifier' && path1.node.key.name === 'computed') {\n const computedNode = path1.node;\n if (computedNode.value.type === 'ObjectExpression') {\n computedNode.value.properties.forEach((prop) => {\n if (prop.type === 'ObjectMethod' && prop.key.type === 'Identifier') {\n const name = prop.key.name;\n traverse(prop, {\n MemberExpression(path2) {\n if (path2.node.object.type === 'ThisExpression' && path2.node.property.type === 'Identifier') {\n graph.edges.get(name)?.add({\n label: path2.node.property.name,\n type: getRelationType(path2),\n });\n }\n },\n }, path1.scope, path1);\n }\n\n if (\n prop.type === 'ObjectProperty'\n && prop.key.type === 'Identifier'\n && prop.value.type === 'ObjectExpression'\n ) {\n const name = prop.key.name;\n prop.value.properties.forEach((prop1) => {\n if (\n prop1.type === 'ObjectProperty'\n && prop1.key.type === 'Identifier'\n && prop1.key.name === 'get'\n ) {\n traverse(prop1, {\n MemberExpression(path2) {\n if (\n path2.node.object.type === 'ThisExpression'\n && path2.node.property.type === 'Identifier'\n ) {\n graph.edges.get(name)?.add({\n label: path2.node.property.name,\n type: getRelationType(path2),\n });\n }\n },\n }, path1.scope, path1);\n }\n });\n }\n });\n }\n }\n\n if (path1.node.key.type === 'Identifier' && path1.node.key.name === 'methods') {\n const methodsNode = path1.node;\n if (methodsNode.value.type === 'ObjectExpression') {\n methodsNode.value.properties.forEach((prop) => {\n if (\n (prop.type === 'ObjectMethod'\n || prop.type === 'ObjectProperty')\n && prop.key.type === 'Identifier'\n ) {\n const name = prop.key.name;\n traverse(prop, {\n MemberExpression(path2) {\n if (path2.node.object.type === 'ThisExpression' && path2.node.property.type === 'Identifier') {\n graph.edges.get(name)?.add({\n label: path2.node.property.name,\n type: getRelationType(path2),\n });\n }\n },\n }, path1.scope, path1);\n }\n });\n }\n }\n\n if (path1.node.key.type === 'Identifier' && [...watchHooks, ...vueLifeCycleHooks].includes(path1.node.key.name)) {\n const hookName = path1.node.key.name;\n\n if (watchHooks.includes(hookName) && path1.node.value.type === 'ObjectExpression') {\n path1.node.value.properties.forEach((prop) => {\n if ((prop.type === 'ObjectProperty' || prop.type === 'ObjectMethod') && (\n prop.key.type === 'Identifier' || prop.key.type === 'StringLiteral'\n )) {\n const keyName = prop.key.type === 'Identifier'\n ? prop.key.name\n : prop.key.type === 'StringLiteral'\n ? prop.key.value.split('.')[0]\n : '';\n const watchArg = tNodes.get(keyName);\n\n const _node = nodeCollection.getNode(keyName);\n if (_node?.info?.used) {\n _node?.info?.used?.add(hookName);\n }\n else if (_node) {\n _node.info = {\n ..._node?.info,\n used: new Set([hookName]),\n };\n }\n\n traverse(path1.node.value, {\n MemberExpression(path2) {\n if (path2.node.object.type === 'ThisExpression' && path2.node.property.type === 'Identifier') {\n if (watchArg && watchArg.name !== path2.node.property.name) {\n graph.edges.get(watchArg.name)?.add({\n label: path2.node.property.name,\n type: getRelationType(path2),\n });\n }\n }\n },\n }, path1.scope, path1);\n }\n });\n }\n else {\n traverse(path1.node.value, {\n MemberExpression(path2) {\n if (path2.node.object.type === 'ThisExpression' && path2.node.property.type === 'Identifier') {\n const _node = nodeCollection.getNode(path2.node.property.name);\n if (_node?.info?.used) {\n _node?.info?.used?.add(hookName);\n }\n else if (_node) {\n _node.info = {\n ..._node?.info,\n used: new Set([hookName]),\n };\n }\n }\n },\n }, path1.scope, path1);\n }\n }\n }\n },\n }, path.scope, path);\n }\n\n traverse(ast, {\n ExportDefaultDeclaration(path) {\n // export default {}\n if (path.node.declaration.type === 'ObjectExpression') {\n process(path.node.declaration, path);\n }\n // export default defineComponent({})\n else if (path.node.declaration.type === 'CallExpression'\n && path.node.declaration.callee.type === 'Identifier'\n && path.node.declaration.callee.name === 'defineComponent'\n && path.node.declaration.arguments[0].type === 'ObjectExpression'\n ) {\n process(path.node.declaration.arguments[0], path);\n }\n },\n });\n\n return {\n graph: nodeCollection.map(graph),\n nodesUsedInTemplate,\n };\n}\n","// https://github.com/vuejs/core/blob/main/packages/compiler-sfc/src/style/cssVars.ts\n\nimport type { SFCStyleBlock } from '@vue/compiler-sfc';\n\nenum LexerState {\n inParens,\n inSingleQuoteString,\n inDoubleQuoteString,\n}\n\nfunction lexBinding(content: string, start: number): number | null {\n let state: LexerState = LexerState.inParens;\n let parenDepth = 0;\n\n for (let i = start; i < content.length; i++) {\n const char = content.charAt(i);\n switch (state) {\n case LexerState.inParens:\n if (char === '\\'') {\n state = LexerState.inSingleQuoteString;\n }\n else if (char === '\"') {\n state = LexerState.inDoubleQuoteString;\n }\n else if (char === '(') {\n parenDepth++;\n }\n else if (char === ')') {\n if (parenDepth > 0) {\n parenDepth--;\n }\n else {\n return i;\n }\n }\n break;\n case LexerState.inSingleQuoteString:\n if (char === '\\'') {\n state = LexerState.inParens;\n }\n break;\n case LexerState.inDoubleQuoteString:\n if (char === '\"') {\n state = LexerState.inParens;\n }\n break;\n }\n }\n return null;\n}\n\nfunction normalizeExpression(exp: string) {\n exp = exp.trim();\n if (\n (exp[0] === '\\'' && exp[exp.length - 1] === '\\'')\n || (exp[0] === '\"' && exp[exp.length - 1] === '\"')\n ) {\n return exp.slice(1, -1);\n }\n return exp;\n}\n\nconst vBindRE = /v-bind\\s*\\(/g;\n\nexport function analyze(\n styles: SFCStyleBlock[],\n) {\n const nodes = new Set<string>();\n\n styles.forEach((style) => {\n let match;\n const content = style.content.replace(/\\/\\*([\\s\\S]*?)\\*\\/|\\/\\/.*/g, '');\n // eslint-disable-next-line no-cond-assign\n while ((match = vBindRE.exec(content))) {\n const start = match.index + match[0].length;\n const end = lexBinding(content, start);\n if (end !== null) {\n const variable = normalizeExpression(content.slice(start, end));\n nodes.add(variable);\n }\n }\n });\n\n return nodes;\n}\n","import _traverse from '@babel/traverse';\nimport { babelParse, compileTemplate } from '@vue/compiler-sfc';\n\nconst traverse: typeof _traverse\n // @ts-expect-error unwarp default\n = _traverse.default?.default || _traverse.default || _traverse;\n\nexport function analyze(\n content: string,\n) {\n const id = 'template';\n const { code } = compileTemplate({\n id,\n source: content,\n filename: `${id}.js`,\n });\n\n // console.log(code);\n const ast = babelParse(code, { sourceType: 'module', plugins: [\n 'typescript',\n ] });\n\n // ----\n\n const nodes = new Set<string>();\n\n traverse(ast, {\n MemberExpression(path) {\n if (path.type === 'MemberExpression') {\n if (path.node.object && path.node.object.type === 'Identifier' && path.node.object.name === '_ctx') {\n if (path.node.property && path.node.property.type === 'Identifier') {\n nodes.add(path.node.property.name);\n }\n }\n }\n },\n ObjectProperty(path) {\n if (path.node.key.type === 'Identifier' && path.node.key.name === 'ref') {\n if (path.node.value.type === 'StringLiteral') {\n const name = path.node.value.value;\n if (name) {\n nodes.add(name);\n }\n }\n }\n },\n // component\n CallExpression(path) {\n if (path.node.callee.type === 'Identifier' && path.node.callee.name === '_resolveComponent') {\n if (path.node.arguments[0].type === 'StringLiteral') {\n const name = path.node.arguments[0].value;\n if (name) {\n nodes.add(name);\n }\n }\n }\n },\n });\n\n return nodes;\n}\n","import type { NodePath, Scope } from '@babel/traverse';\nimport type * as t from '@babel/types';\nimport type { NodeCollection, RelationType } from '../analyze/utils';\nimport _traverse from '@babel/traverse';\nimport { getComment, getRelationType } from '../analyze/utils';\n\nexport const traverse: typeof _traverse\n // @ts-expect-error unwarp default\n = _traverse.default?.default || _traverse.default || _traverse;\n\nexport interface IReturnData {\n graph: {\n nodes: Set<string>\n edges: Map<string, Set<{ label: string, type: RelationType }>>\n spread?: Map<string, Set<string>>\n }\n nodeCollection: NodeCollection\n nodesUsedInTemplate: Set<string>\n}\n\nexport interface IAddNode {\n name: string\n node: t.Node\n path: NodePath<t.VariableDeclarator | t.FunctionDeclaration>\n scope: Scope\n}\n\nexport interface IUsedNode {\n name: string\n path: NodePath<t.Identifier>\n parentPath: NodePath<t.Node>\n}\n\nexport interface IAddEdge {\n fromName: string\n toName: string\n path: NodePath<t.Identifier | t.MemberExpression>\n scope: Scope\n toScope?: Scope\n collectionNodes: Set<string>\n}\n\nexport interface IParseVariable {\n path: NodePath<t.VariableDeclarator>\n rootScope: Scope\n}\n\nexport interface IParseNodeBase extends IParseVariable {\n cb?: (params: IAddNode) => void\n}\n\nexport interface IParseEdgeBase extends IParseVariable {\n cb?: (params: IAddEdge) => void\n collectionNodes: Set<string>\n spread?: string[]\n}\n\nexport interface IRescureObject {\n node: t.ObjectPattern\n rootScope: Scope\n res: t.Identifier[]\n parentScope: Scope\n parentPath: NodePath<t.VariableDeclarator | t.ObjectProperty>\n}\n\nexport interface IRescureArray {\n node: t.ArrayPattern\n rootScope: Scope\n res: t.Identifier[]\n parentScope: Scope\n parentPath: NodePath<t.VariableDeclarator | t.ArrayPattern>\n}\n\nexport interface IParseNodeFunction {\n path: NodePath<t.FunctionDeclaration>\n rootScope: Scope\n cb?: (params: IAddNode) => void\n}\n\nexport interface IParseEdgeFunction {\n path: NodePath<t.FunctionDeclaration>\n rootScope: Scope\n cb?: (params: IAddEdge) => void\n collectionNodes: Set<string>\n}\n\nexport interface IParseReturnJSX {\n path: NodePath<t.ReturnStatement>\n parentPath: NodePath<t.Node>\n cb?: (params: IUsedNode) => void\n}\n\nexport interface IParseSetup {\n node: t.ObjectExpression\n parentScope: Scope\n parentPath: NodePath<t.ExportDefaultDeclaration>\n}\n\nexport interface ICollectSpread {\n path: NodePath<t.ObjectMethod>\n spread: string[]\n}\n\nexport interface IAddIdentifiesToGraphByScanReturn {\n path: NodePath<t.ObjectMethod>\n graph: IReturnData['graph']\n nodeCollection: IReturnData['nodeCollection']\n tempNodeCollection: IReturnData['nodeCollection']\n tempEdges: IReturnData['graph']['edges']\n}\n\nexport interface IAddSpreadToGraphByScanReturn {\n path: NodePath<t.ObjectMethod>\n graph: IReturnData['graph']\n nodeCollection: IReturnData['nodeCollection']\n tempNodeCollection: IReturnData['nodeCollection']\n tempEdges: IReturnData['graph']['edges']\n tempSpread: Map<string, Set<string>>\n}\n\nexport interface IAddGraphBySpreadIdentifier {\n path: NodePath<t.VariableDeclarator>\n graph: IReturnData['graph'] & {\n spread: Map<string, Set<string>>\n }\n nodeCollection: IReturnData['nodeCollection']\n iname: string\n}\n\n/**\n * 递归遍历如下结构:\n * let { loc, loc: locd, loc: { start, end }, loc: { start: { line: { deep } }} } = node;\n * 解出 loc, locd, start, end, deep\n */\nexport function rescureObjectPattern({ node, rootScope, res, parentScope, parentPath }: IRescureObject) {\n traverse(node, {\n ObjectProperty(path1) {\n if (path1.node.type === 'ObjectProperty'\n && path1.node.key.type === 'Identifier' && path1.node.value.type === 'Identifier') {\n const name = path1.node.value.name;\n const _scope = path1.scope.getBinding(name)?.scope;\n if (_scope && _scope === rootScope) {\n res.push(path1.node.value);\n }\n }\n else if (path1.node.type === 'ObjectProperty'\n && path1.node.key.type === 'Identifier' && path1.node.value.type === 'ObjectPattern') {\n rescureObjectPattern({\n node: path1.node.value,\n rootScope,\n res,\n parentScope: path1.scope,\n parentPath: path1,\n });\n }\n },\n RestElement(path1) {\n if (path1.node.argument.type === 'Identifier') {\n const name = path1.node.argument.name;\n const _scope = path1.scope.getBinding(name)?.scope;\n if (_scope && _scope === rootScope) {\n res.push(path1.node.argument);\n }\n }\n },\n }, parentScope, parentPath);\n}\n\n/**\n * 递归遍历如下结构:\n * let [foo, [bar, baz]] = [1, [[2], 3]];\n * 解出 foo, bar, baz\n */\nexport function rescureArrayPattern({ node, rootScope, res, parentScope, parentPath }: IRescureArray) {\n traverse(node, {\n Identifier(path1) {\n if (path1.node.type === 'Identifier') {\n const name = path1.node.name;\n const _scope = path1.scope.getBinding(name)?.scope;\n if (_scope && _scope === rootScope) {\n res.push(path1.node);\n }\n }\n },\n ArrayPattern(path1) {\n if (path1.node.type === 'ArrayPattern') {\n rescureArrayPattern({\n node: path1.node,\n rootScope,\n res,\n parentScope: path1.scope,\n parentPath: path1,\n });\n }\n },\n }, parentScope, parentPath);\n}\n\nexport function parseNodeIdentifierPattern({\n path,\n rootScope,\n cb,\n}: IParseNodeBase) {\n if (path.node.id.type !== 'Identifier') {\n return;\n }\n\n if (path.node.init?.type === 'ArrowFunctionExpression' || path.node.init?.type === 'FunctionExpression') {\n // const speak = () => {}\n cb?.({\n name: path.node.id.name,\n node: path.node,\n path,\n scope: rootScope,\n });\n }\n else {\n // const open = 22\n cb?.({\n name: path.node.id.name,\n node: path.node,\n path,\n scope: rootScope,\n });\n }\n}\n\nexport function parseNodeObjectPattern({ path, rootScope, cb }: IParseNodeBase) {\n if (path.node.id.type !== 'ObjectPattern') {\n return;\n }\n\n path.node.id.properties.forEach((property) => {\n if (property.type === 'ObjectProperty'\n && property.key.type === 'Identifier' && property.value.type === 'Identifier') {\n // const { x } = obj\n cb?.({\n name: property.value.name,\n node: property,\n path,\n scope: rootScope,\n });\n }\n else if (property.type === 'ObjectProperty'\n && property.key.type === 'Identifier' && property.value.type === 'AssignmentPattern') {\n // const { x = 3 } = obj\n cb?.({\n name: property.key.name,\n node: property,\n path,\n scope: rootScope,\n });\n }\n else if (property.type === 'RestElement' && property.argument.type === 'Identifier') {\n // const { ...rest } = obj\n cb?.({\n name: property.argument.name,\n node: property,\n path,\n scope: rootScope,\n });\n }\n else if (property.type === 'ObjectProperty'\n && property.key.type === 'Identifier' && property.value.type === 'ObjectPattern') {\n // let { loc, loc: locd, loc: { start, end } } = node;\n const res: t.Identifier[] = [];\n rescureObjectPattern({\n node: property.value,\n rootScope,\n res,\n parentScope: path.scope,\n parentPath: path,\n });\n res.forEach(r => cb?.({\n name: r.name,\n node: r,\n path,\n scope: rootScope,\n }));\n }\n });\n}\n\nexport function parseNodeArrayPattern({ path, rootScope, cb }: IParseNodeBase) {\n if (path.node.id.type !== 'ArrayPattern') {\n return;\n }\n\n path.node.id.elements.forEach((ele) => {\n if (ele?.type === 'Identifier') {\n // const [arr, brr] = array\n cb?.({\n name: ele.name,\n node: ele,\n path,\n scope: rootScope,\n });\n }\n else if (ele?.type === 'ArrayPattern') {\n // let [foo, [bar, baz]] = array;\n const res: t.Identifier[] = [];\n rescureArrayPattern({\n node: ele,\n rootScope,\n res,\n parentScope: path.scope,\n parentPath: path,\n });\n res.forEach(r => cb?.({\n name: r.name,\n node: r,\n path,\n scope: rootScope,\n }));\n }\n else if (ele?.type === 'AssignmentPattern') {\n if (ele.left.type === 'Identifier') {\n // let [yy = 'b'] = array;\n cb?.({\n name: ele.left.name,\n node: ele,\n path,\n scope: rootScope,\n });\n }\n }\n else if (ele?.type === 'RestElement') {\n if (ele.argument.type === 'Identifier') {\n // const [arr2, ...rest2] = array\n cb?.({\n name: ele.argument.name,\n node: ele,\n path,\n scope: rootScope,\n });\n }\n }\n });\n}\n\nexport function parseNodeFunctionPattern({ path, rootScope, cb }: IParseNodeFunction) {\n if (path.node.type !== 'FunctionDeclaration') {\n return;\n }\n if (path.node.id?.type === 'Identifier') {\n // function abc () {}\n cb?.({\n name: path.node.id.name,\n node: path.node,\n path,\n scope: rootScope,\n });\n }\n}\n\nexport function parseEdgeLeftIdentifierPattern({ path, rootScope, cb, collectionNodes, spread }: IParseEdgeBase) {\n if (!path.node.id || path.node.id.type !== 'Identifier') {\n return;\n }\n\n if (path.node.init?.type\n && [\n 'ArrowFunctionExpression',\n 'FunctionExpression',\n 'CallExpression',\n 'ObjectExpression',\n 'ArrayExpression',\n ].includes(path.node.init.type)\n ) {\n // if (graph.nodes.has(path.node.id.name) && path.scope.getBinding(path.node.id.name)?.scope === rootScope) {\n if (collectionNodes.has(path.node.id.name) && path.scope.getBinding(path.node.id.name)?.scope === rootScope) {\n const name = path.node.id.name;\n traverse(path.node.init, {\n Identifier(path1) {\n // graph.edges.get(name)?.add(path1.node.name);\n\n const binding = path1.scope.getBinding(path1.node.name);\n if (\n binding?.scope === rootScope\n && collectionNodes.has(path1.node.name)\n && (\n (path1.parent.type !== 'MemberExpression'\n && path1.parent.type !== 'OptionalMemberExpression')\n || path1.parent.object === path1.node\n )\n ) {\n cb?.({\n fromName: name,\n toName: path1.node.name,\n path: path1,\n scope: rootScope,\n collectionNodes,\n });\n }\n },\n MemberExpression(path1) {\n if (spread?.length && path1.node.object.type === 'Identifier'\n && spread.includes(path1.node.object.name)\n && path1.node.property.type === 'Identifier') {\n cb?.({\n fromName: name,\n toName: path1.node.property.name,\n toScope: path1.scope.getBinding(path1.node.object.name)?.scope,\n path: path1,\n scope: rootScope,\n collectionNodes,\n });\n }\n },\n }, path.scope, path);\n }\n }\n}\n\nexport function parseEdgeLeftObjectPattern({ path, rootScope, cb, collectionNodes }: IParseEdgeBase) {\n if (!path.node.id || path.node.id.type !== 'ObjectPattern') {\n return;\n }\n if (path.node.init?.type\n && [\n 'ArrowFunctionExpression',\n 'FunctionExpression',\n 'CallExpression',\n 'ObjectExpression',\n 'ArrayExpression',\n ].includes(path.node.init.type)\n ) {\n const res: t.Identifier[] = [];\n rescureObjectPattern({\n node: path.node.id,\n rootScope,\n res,\n parentScope: path.scope,\n parentPath: path,\n });\n\n // res.filter(r => (graph.nodes.has(r.name) && path.scope.getBinding(r.name)?.scope === rootScope));\n res.filter(r => (collectionNodes.has(r.name) && path.scope.getBinding(r.name)?.scope === rootScope));\n\n traverse(path.node.init, {\n Identifier(path1) {\n const binding = path1.scope.getBinding(path1.node.name);\n if (\n binding?.scope === rootScope\n && collectionNodes.has(path1.node.name)\n && (\n (path1.parent.type !== 'MemberExpression'\n && path1.parent.type !== 'OptionalMemberExpression')\n || path1.parent.object === path1.node\n )\n ) {\n res.forEach((r) => {\n cb?.({\n fromName: r.name,\n toName: path1.node.name,\n path: path1,\n scope: rootScope,\n collectionNodes,\n });\n });\n }\n },\n }, path.scope, path);\n }\n}\n\nexport function parseEdgeLeftArrayPattern({ path, rootScope, cb, collectionNodes }: IParseEdgeBase) {\n if (!path.node.id || path.node.id.type !== 'ArrayPattern') {\n return;\n }\n if (path.node.init?.type\n && [\n 'ArrowFunctionExpression',\n 'FunctionExpression',\n 'CallExpression',\n 'ObjectExpression',\n 'ArrayExpression',\n ].includes(path.node.init.type)\n ) {\n const res: t.Identifier[] = [];\n rescureArrayPattern({\n node: path.node.id,\n rootScope,\n res,\n parentScope: path.scope,\n parentPath: path,\n });\n\n res.filter(r => (collectionNodes.has(r.name) && path.scope.getBinding(r.name)?.scope === rootScope));\n\n traverse(path.node.init, {\n Identifier(path1) {\n const binding = path1.scope.getBinding(path1.node.name);\n if (\n binding?.scope === rootScope\n && collectionNodes.has(path1.node.name)\n && (\n (path1.parent.type !== 'MemberExpression'\n && path1.parent.type !== 'OptionalMemberExpression')\n || path1.parent.object === path1.node\n )\n ) {\n res.forEach((r) => {\n cb?.({\n fromName: r.name,\n toName: path1.node.name,\n path: path1,\n scope: rootScope,\n collectionNodes,\n });\n });\n }\n },\n }, path.scope, path);\n }\n}\n\nexport function parseEdgeFunctionPattern({ path, rootScope, cb, collectionNodes }: IParseEdgeFunction) {\n if (!path.node.id) {\n return;\n }\n if (collectionNodes.has(path.node.id.name) && path.scope.getBinding(path.node.id.name)?.scope === rootScope) {\n const name = path.node.id.name;\n traverse(path.node.body, {\n Identifier(path1) {\n const binding = path1.scope.getBinding(path1.node.name);\n if (binding?.scope === rootScope && collectionNodes.has(path1.node.name)) {\n cb?.({\n fromName: name,\n toName: path1.node.name,\n path: path1,\n scope: rootScope,\n collectionNodes,\n });\n }\n },\n }, path.scope, path);\n }\n}\n\nexport function parseReturnJsxPattern({ path, parentPath, cb }: IParseReturnJSX) {\n if (\n path.node.argument\n && (\n // return () => (<div></div>)\n // return function() (<div></div>)\n (\n (\n path.node.argument.type === 'ArrowFunctionExpression'\n || path.node.argument.type === 'FunctionExpression'\n ) && (\n path.node.argument.body.type === 'JSXElement'\n || path.node.argument.body.type === 'JSXFragment'\n )\n )\n // return (<div></div>)\n || (\n path.node.argument.type === 'JSXElement'\n || path.node.argument.type === 'JSXFragment'\n )\n )\n ) {\n path.traverse({\n Identifier(path1) {\n // if (path1.scope.getBinding(path1.node.name)?.scope === parentPath.scope) {\n // nodesUsedInTemplate.add(path1.node.name);\n // }\n cb?.({\n name: path1.node.name,\n path: path1,\n parentPath,\n });\n },\n });\n }\n}\n\nexport function traverseSetup({ node, parentScope, parentPath }: IParseSetup) {\n let path: NodePath<t.ObjectMethod>;\n\n traverse(node, {\n ObjectMethod(path1) {\n if (\n (\n parentPath.node.declaration.type === 'ObjectExpression'\n && path1.parent === parentPath.node.declaration\n ) || (\n parentPath.node.declaration.type === 'CallExpression'\n && path1.parent === parentPath.node.declaration.arguments[0]\n )\n ) {\n if (path1.node.key.type === 'Identifier' && path1.node.key.name === 'setup') {\n path = path1;\n }\n }\n },\n }, parentScope, parentPath);\n\n return path!;\n}\n\nexport function collectionSpread({ path: path1, spread }: ICollectSpread) {\n path1.traverse({\n ReturnStatement(path2) {\n // get setup return obj spread\n if (path2.node.argument?.type === 'ObjectExpression') {\n const returnNode = path2.node.argument;\n traverse(returnNode, {\n SpreadElement(path3) {\n // ...toRefs(xxx)\n if (\n path3.node.argument.type === 'CallExpression'\n && path3.node.argument.callee.type === 'Identifier'\n && path3.node.argument.callee.name === 'toRefs'\n && path3.node.argument.arguments[0].type === 'Identifier'\n ) {\n spread.push(path3.node.argument.arguments[0].name);\n }\n // ...xxx\n else if (\n path3.node.argument.type === 'Identifier'\n ) {\n spread.push(path3.node.argument.name);\n }\n },\n }, path2.scope, path2);\n }\n },\n });\n}\n\nexport function addIdentifiesToGraphByScanReturn(\n { path: path1, graph, nodeCollection, tempNodeCollection, tempEdges }: IAddIdentifiesToGraphByScanReturn,\n) {\n path1.traverse({\n ReturnStatement(path2) {\n // get setup return obj spread\n if (path2.node.argument?.type === 'ObjectExpression') {\n const returnNode = path2.node.argument;\n traverse(returnNode, {\n ObjectProperty(path3) {\n // not spread node\n if (path3.parent === returnNode) {\n if (path3.node.key.type === 'Identifier' && path3.node.value.type === 'Identifier') {\n const valName = path3.node.value.name;\n if (!graph.nodes.has(valName)) {\n graph.nodes.add(valName);\n nodeCollection.addTypedNode(\n valName,\n tempNodeCollection.nodes.get(valName)!,\n );\n }\n if (!graph.edges.has(valName)) {\n graph.edges.set(valName, new Set([...Array.from(\n tempEdges.get(valName) || new Set<{ label: string, type: RelationType }>(),\n )]));\n }\n\n const name = path3.node.key.name;\n if (name !== valName) {\n graph.nodes.add(name);\n nodeCollection.addNode(name, path3.node.key, {\n comment: getComment(path3.node),\n });\n graph.edges.set(name, new Set([{\n label: valName,\n type: getRelationType(path3),\n }]));\n }\n }\n }\n },\n }, path2.scope, path2);\n }\n },\n });\n}\n\nexport function addSpreadToGraphByScanReturn(\n { path: path1, graph, nodeCollection, tempNodeCollection, tempEdges, tempSpread }: IAddSpreadToGraphByScanReturn,\n) {\n path1.traverse({\n ReturnStatement(path2) {\n // get setup return obj spread\n if (path2.node.argument?.type === 'ObjectExpression') {\n const returnNode = path2.node.argument;\n traverse(returnNode, {\n SpreadElement(path3) {\n // ...toRefs(xxx)\n if (\n path3.node.argument.type === 'CallExpression'\n && path3.node.argument.callee.type === 'Identifier'\n && path3.node.argument.callee.name === 'toRefs'\n && path3.node.argument.arguments[0].type === 'Identifier'\n && tempSpread.get(path3.node.argument.arguments[0].name)\n ) {\n tempSpread.get(path3.node.argument.arguments[0].name)?.forEach((name) => {\n graph.nodes.add(name);\n nodeCollection.addTypedNode(name, tempNodeCollection.nodes.get(name)!);\n if (!graph.edges.get(name)) {\n graph.edges.set(name, new Set());\n tempEdges.get(name)?.forEach((edge) => {\n graph.edges.get(name)?.add(edge);\n });\n }\n });\n }\n // ...xxx\n else if (\n path3.node.argument.type === 'Identifier'\n && tempSpread.get(path3.node.argument.name)\n ) {\n tempSpread.get(path3.node.argument.name)?.forEach((name) => {\n graph.nodes.add(name);\n nodeCollection.addTypedNode(name, tempNodeCollection.nodes.get(name)!);\n if (!graph.edges.get(name)) {\n graph.edges.set(name, new Set());\n tempEdges.get(name)?.forEach((edge) => {\n graph.edges.get(name)?.add(edge);\n });\n }\n });\n }\n },\n }, path2.scope, path2);\n }\n },\n });\n}\n\nexport function addGraphBySpreadIdentifier({ path: path1, graph, nodeCollection, iname }: IAddGraphBySpreadIdentifier) {\n if (path1.node.init?.type === 'ObjectExpression') {\n path1.node.init?.properties.forEach((prop) => {\n if (\n (prop.type === 'ObjectProperty' || prop.type === 'ObjectMethod')\n && prop.key.type === 'Identifier'\n ) {\n const keyName = prop.key.name;\n graph.nodes.add(keyName);\n nodeCollection.addNode(keyName, prop, {\n comment: getComment(prop),\n });\n if (!graph.edges.get(keyName)) {\n graph.edges.set(keyName, new Set());\n }\n if (graph.spread.has(iname)) {\n graph.spread.get(iname)?.add(keyName);\n }\n else {\n graph.spread.set(iname, new Set([keyName]));\n }\n }\n else if (prop.type === 'SpreadElement') {\n console.warn('not support spread in spread');\n }\n });\n }\n\n if (\n path1.node.init?.type === 'CallExpression'\n && path1.node.init?.callee.type === 'Identifier'\n && path1.node.init?.callee.name === 'reactive'\n ) {\n const arg = path1.node.init?.arguments[0];\n if (arg.type === 'ObjectExpression') {\n arg.properties.forEach((prop) => {\n if (\n (prop.type === 'ObjectProperty' || prop.type === 'ObjectMethod')\n && prop.key.type === 'Identifier'\n ) {\n const keyName = prop.key.name;\n graph.nodes.add(keyName);\n nodeCollection.addNode(keyName, prop, {\n comment: getComment(prop),\n });\n if (!graph.edges.get(keyName)) {\n graph.edges.set(keyName, new Set());\n }\n if (graph.spread.has(iname)) {\n graph.spread.get(iname)?.add(keyName);\n }\n else {\n graph.spread.set(iname, new Set([keyName]));\n }\n }\n else if (prop.type === 'SpreadElement') {\n console.warn('not support spread in spread');\n }\n });\n }\n }\n}\n","import type { NodePath, Scope } from '@babel/traverse';\nimport type * as t from '@babel/types';\nimport type {\n IAddEdge,\n IAddNode,\n IReturnData,\n IUsedNode,\n} from '../utils/traverse';\nimport type { RelationType } from './utils';\nimport _traverse from '@babel/traverse';\nimport { babelParse } from '@vue/compiler-sfc';\nimport {\n addGraphBySpreadIdentifier,\n addIdentifiesToGraphByScanReturn,\n addSpreadToGraphByScanReturn,\n collectionSpread,\n parseEdgeFunctionPattern,\n parseEdgeLeftArrayPattern,\n parseEdgeLeftIdentifierPattern,\n parseEdgeLeftObjectPattern,\n parseNodeArrayPattern,\n parseNodeFunctionPattern,\n parseNodeIdentifierPattern,\n parseNodeObjectPattern,\n parseReturnJsxPattern,\n traverse,\n traverseSetup,\n} from '../utils/traverse';\nimport { getComment, getRelationType, NodeCollection } from './utils';\n\ninterface IProcessMain {\n node: t.Node\n type: 'vue' | 'react'\n lineOffset?: number\n addInfo?: boolean\n}\n\ninterface IProcessBranch {\n node: t.ObjectExpression\n lineOffset?: number\n addInfo?: boolean\n parentScope?: Scope\n parentNode?: t.ExportDefaultDeclaration\n parentPath: NodePath<t.ExportDefaultDeclaration>\n spread?: string[]\n}\n\ntype IProcessReact = {\n node: t.BlockStatement\n lineOffset?: number\n addInfo?: boolean\n parentScope: Scope\n parentNode: t.FunctionDeclaration\n parentPath: NodePath<t.FunctionDeclaration>\n} | {\n node: t.BlockStatement\n lineOffset?: number\n addInfo?: boolean\n parentScope: Scope\n parentNode: t.ClassMethod\n parentPath: NodePath<t.ClassMethod>\n};\n\n// deal when setup return object\nfunction processByReturnNotJSX(params: IProcessBranch) {\n const { node, parentPath, lineOffset, addInfo } = params;\n const spread: string[] = [];\n\n const nodeCollection = new NodeCollection(lineOffset, addInfo);\n\n const graph = {\n nodes: new Set<string>(),\n edges: new Map<string, Set<{ label: string, type: RelationType }>>(),\n };\n\n // 解析return, 收集spread\n const setupPath = traverseSetup({ node, parentScope: parentPath.scope, parentPath });\n\n // setup return\n collectionSpread({ path: setupPath, spread });\n\n // 收集除return之外的所有节点和边\n const {\n graph: {\n nodes: tempNodes,\n edges: tempEdges,\n spread: tempSpread,\n },\n nodeCollection: tempNodeCollection,\n nodesUsedInTemplate,\n } = processByReturnJSX({ node, parentPath, spread, lineOffset, addInfo });\n\n // 根据return信息添加必要节点\n addIdentifiesToGraphByScanReturn({\n path: setupPath,\n graph,\n nodeCollection,\n tempNodeCollection,\n tempEdges,\n });\n\n // 根据return信息添加必要节点\n addSpreadToGraphByScanReturn({\n path: setupPath,\n graph,\n nodeCollection,\n tempNodeCollection,\n tempEdges,\n tempSpread,\n });\n\n return {\n graph,\n nodeCollection,\n nodesUsedInTemplate,\n };\n}\n\n// deal when setup return jsx\nfunction processByReturnJSX(params: IProcessBranch) {\n const { node, parentPath, spread = [], lineOffset, addInfo } = params;\n\n const nodeCollection = new NodeCollection(lineOffset, addInfo);\n const nodesUsedInTemplate = new Set<string>();\n\n const graph = {\n nodes: new Set<string>(),\n edges: new Map<string, Set<{ label: string, type: RelationType }>>(),\n spread: new Map<string, Set<string>>(),\n };\n\n function addNode({ name, node, path, scope }: IAddNode, commentParentNode?: t.Node) {\n const binding = path.scope.getBinding(name);\n if (scope === binding?.scope) {\n graph.nodes.add(name);\n nodeCollection.addNode(name, node, {\n comment: commentParentNode\n ? getComment(commentParentNode)\n : '',\n });\n if (!graph.edges.get(name)) {\n graph.edges.set(name, new Set());\n }\n }\n }\n\n function addEdge({ fromName, toName, path, scope, toScope, collectionNodes }: IAddEdge) {\n const bindingScope = toScope || path.scope.getBinding(toName)?.scope;\n if (scope === bindingScope && collectionNodes.has(toName)) {\n graph.edges.get(fromName)?.add({\n label: toName,\n type: getRelationType(path),\n });\n }\n }\n\n function addUsed({ name, path, parentPath }: IUsedNode) {\n const binding = path.scope.getBinding(name);\n if (binding?.scope === parentPath.scope) {\n nodesUsedInTemplate.add(name);\n }\n }\n\n const setupPath = traverseSetup({ node, parentScope: parentPath.scope, parentPath });\n const setupScope = setupPath.scope;\n const setupNode = setupPath.node;\n\n // 收集节点, 并收集spread依赖\n traverse(setupNode, {\n VariableDeclarator(path1) {\n parseNodeIdentifierPattern({\n path: path1,\n rootScope: setupScope,\n cb: (params) => {\n if (!spread.includes(params.name)) {\n addNode(params, path1.node);\n }\n else {\n addGraphBySpreadIdentifier({\n path: path1,\n graph,\n nodeCollection,\n iname: params.name,\n });\n }\n },\n });\n\n parseNodeObjectPattern({\n path: path1,\n rootScope: setupScope,\n cb: addNode,\n });\n\n parseNodeArrayPattern({\n path: path1,\n rootScope: setupScope,\n cb: addNode,\n });\n },\n FunctionDeclaration(path1) {\n parseNodeFunctionPattern({\n path: path1,\n rootScope: setupScope,\n cb: addNode,\n });\n },\n }, setupScope, setupPath);\n\n // 搜集jsx模版使用节点\n setupPath.traverse({\n ReturnStatement(path2) {\n // setup return jsx\n parseReturnJsxPattern({\n path: path2,\n parentPath: setupPath,\n cb: addUsed,\n });\n },\n });\n\n // 收集边\n traverse(setupNode, {\n VariableDeclarator(path1) {\n parseEdgeLeftIdentifierPattern({\n path: path1,\n rootScope: setupScope,\n collectionNodes: graph.nodes,\n cb: addEdge,\n spread,\n });\n\n parseEdgeLeftObjectPattern({\n path: path1,\n rootScope: setupScope,\n collectionNodes: graph.nodes,\n cb: addEdge,\n });\n\n parseEdgeLeftArrayPattern({\n path: path1,\n rootScope: setupScope,\n collectionNodes: graph.nodes,\n cb: addEdge,\n });\n },\n FunctionDeclaration(path1) {\n parseEdgeFunctionPattern({\n path: path1,\n rootScope: setupScope,\n collectionNodes: graph.nodes,\n cb: addEdge,\n });\n },\n }, setupScope, setupPath);\n\n return {\n graph,\n nodeCollection,\n nodesUsedInTemplate,\n };\n}\n\nfunction processByReact(params: IProcessReact) {\n const { node, parentScope, parentPath, lineOffset, addInfo } = params;\n\n const nodeCollection = new NodeCollection(lineOffset, addInfo);\n const nodesUsedInTemplate = new Set<string>();\n\n const graph = {\n nodes: new Set<string>(),\n edges: new Map<string, Set<{ label: string, type: RelationType }>>(),\n spread: new Map<string, Set<string>>(),\n };\n\n function addNode({ name, node, path, scope }: IAddNode, commentParentNode?: t.Node) {\n const binding = path.scope.getBinding(name);\n if (scope === binding?.scope) {\n graph.nodes.add(name);\n nodeCollection.addNode(name, node, {\n comment: commentParentNode\n ? getComment(commentParentNode)\n : '',\n });\n if (!graph.edges.get(name)) {\n graph.edges.set(name, new Set());\n }\n }\n }\n\n function addEdge({ fromName, toName, path, scope, toScope, collectionNodes }: IAddEdge) {\n const bindingScope = toScope || path.scope.getBinding(toName)?.scope;\n if (scope === bindingScope && collectionNodes.has(toName)) {\n graph.edges.get(fromName)?.add({\n label: toName,\n type: getRelationType(path),\n });\n }\n }\n\n function addUsed({ name, path, parentPath }: IUsedNode) {\n const binding = path.scope.getBinding(name);\n if (binding?.scope === parentPath.scope) {\n nodesUsedInTemplate.add(name);\n }\n }\n\n // 收集节点依赖\n traverse(node, {\n VariableDeclarator(path1) {\n parseNodeIdentifierPattern({\n path: path1,\n rootScope: parentScope!,\n cb: (params) => {\n addNode(params, path1.node);\n },\n });\n\n parseNodeObjectPattern({\n path: path1,\n rootScope: parentScope!,\n cb: addNode,\n });\n\n parseNodeArrayPattern({\n path: path1,\n rootScope: parentScope!,\n cb: addNode,\n });\n },\n FunctionDeclaration(path1) {\n parseNodeFunctionPattern({\n path: path1,\n rootScope: parentScope!,\n cb: addNode,\n });\n },\n }, parentScope, parentPath);\n\n // 搜集jsx模版使用节点\n traverse(node, {\n ReturnStatement(path2) {\n // setup return jsx\n parseReturnJsxPattern({\n path: path2,\n parentPath,\n cb: addUsed,\n });\n },\n }, parentScope, parentPath);\n\n // 收集边\n traverse(node, {\n VariableDeclarator(path1) {\n parseEdgeLeftIdentifierPattern({\n path: path1,\n rootScope: parentScope!,\n collectionNodes: graph.nodes,\n cb: addEdge,\n });\n\n parseEdgeLeftObjectPattern({\n path: path1,\n rootScope: parentScope!,\n collectionNodes: graph.nodes,\n cb: addEdge,\n });\n\n parseEdgeLeftArrayPattern({\n path: path1,\n rootScope: parentScope!,\n collectionNodes: graph.nodes,\n cb: addEdge,\n });\n },\n FunctionDeclaration(path1) {\n parseEdgeFunctionPattern({\n path: path1,\n rootScope: parentScope!,\n collectionNodes: graph.nodes,\n cb: addEdge,\n });\n },\n }, parentScope, parentPath);\n\n return {\n graph,\n nodeCollection,\n nodesUsedInTemplate,\n };\n}\n\nexport function processTsx(params: IProcessMain) {\n let result: IReturnData | undefined;\n\n function process(params: IProcessBranch) {\n const { node, parentPath } = params;\n // resolve `return` then determine use processByReturnJSX or processByReturnNotJSX\n const setupPath = traverseSetup({ node, parentScope: parentPath.scope, parentPath });\n\n setupPath.traverse({\n ReturnStatement(path) {\n if (path.node.argument\n && (path.node.argument.type === 'ArrowFunctionExpression'\n || path.node.argument.type === 'FunctionExpression')\n && (path.node.argument.body.type === 'JSXElement'\n || path.node.argument.body.type === 'JSXFragment')\n ) {\n result = processByReturnJSX(params);\n }\n else {\n result = processByReturnNotJSX(params);\n }\n },\n });\n }\n\n traverse(params.node, {\n ExportDefaultDeclaration(path) {\n if (params.type === 'vue') {\n if (path.node.declaration.type === 'ObjectExpression') {\n // export default {}\n process({\n ...params,\n node: path.node.declaration,\n parentNode: path.node,\n parentPath: path,\n });\n }\n else if (\n path.node.declaration.type === 'CallExpression'\n && path.node.declaration.callee.type === 'Identifier'\n && path.node.declaration.callee.name === 'defineComponent'\n && path.node.declaration.arguments[0].type === 'ObjectExpression'\n ) {\n // export default defineComponent({})\n process({\n ...params,\n node: path.node.declaration.arguments[0],\n parentNode: path.node,\n parentPath: path,\n });\n }\n }\n if (params.type === 'react') {\n if (\n (path.node.declaration.type === 'FunctionDeclaration'\n || path.node.declaration.type === 'ArrowFunctionExpression')\n && path.node.declaration.body.type === 'BlockStatement'\n ) {\n // export default function () {}\n\n const functionPath = path.get('declaration') as NodePath<t.FunctionDeclaration>;\n\n result = processByReact({\n ...params,\n node: path.node.declaration.body,\n parentNode: functionPath.node,\n parentPath: functionPath,\n parentScope: functionPath.scope,\n });\n }\n if (path.node.declaration.type === 'ClassDeclaration') {\n // export default class Index {}\n\n const renderFunction = path.node.declaration.body.body.find((node) => {\n if (node.type === 'ClassMethod' && node.key.type === 'Identifier' && node.key.name === 'render') {\n return node;\n }\n return undefined;\n }) as t.ClassMethod;\n if (!renderFunction) {\n return;\n }\n\n const renderPath = path.get(`declaration.body.body.${\n path.node.declaration.body.body.indexOf(renderFunction)\n }`) as NodePath<t.ClassMethod>;\n\n result = processByReact({\n ...params,\n node: renderFunction.body,\n parentNode: renderFunction,\n parentPath: renderPath,\n parentScope: renderPath.scope,\n });\n }\n }\n },\n });\n\n return result!;\n}\n\nexport function analyze(\n content: string,\n type = 'vue' as 'vue' | 'react',\n lineOffset = 0,\n addInfo = true,\n) {\n const ast = babelParse(content, { sourceType: 'module', plugins: [\n 'typescript',\n 'jsx',\n ] });\n\n const { graph, nodeCollection, nodesUsedInTemplate } = processTsx({\n node: ast,\n type,\n lineOffset,\n addInfo,\n });\n\n return {\n graph: nodeCollection.map(graph),\n nodesUsedInTemplate,\n };\n}\n","import type { RelationType, TypedNode } from './analyze/utils';\n\ninterface MermaidOptions {\n direction?: 'TB' | 'BT' | 'LR' | 'RL'\n}\n\nexport function getMermaidText(\n graph: {\n nodes: Set<TypedNode>\n edges: Map<TypedNode, Set<{ node: TypedNode, type: RelationType }>>\n },\n nodesUsedInTemplate: Set<string>,\n nodesUsedInStyle: Set<string> = new Set(),\n options: MermaidOptions = {},\n): string {\n const direction: 'TB' | 'BT' | 'LR' | 'RL' = options.direction || 'TB';\n const usedNodes: Set<string> = new Set([...nodesUsedInTemplate, ...nodesUsedInStyle]);\n\n let mermaidText: string = `flowchart ${direction}\n %% Legend:\n %% () = variable node\n %% [] = function node\n %% * suffix = unused in template/style\n %% A --> B means A depends on B\\n`;\n\n graph.nodes.forEach((node: TypedNode) => {\n const shape: string = node.type === 'var'\n ? '('\n : '[';\n const closeShape: string = node.type === 'var'\n ? ')'\n : ']';\n const unusedSuffix: string = !(usedNodes.has(node.label) || node.info?.used?.size)\n ? '*'\n : '';\n mermaidText += ` ${node.label}${shape}${node.label}${unusedSuffix}${closeShape}\\n`;\n });\n\n graph.edges.forEach((edge, key) => {\n edge.forEach((to) => {\n if (!to || !to.node.label) {\n return;\n }\n mermaidText += ` ${key.label} --> ${to.node.label}\\n`;\n });\n });\n\n return mermaidText;\n}\n","import type { RelationType, TypedNode } from '../analyze/utils';\n\nexport interface Community {\n id: number\n nodes: Set<TypedNode>\n}\n\nexport interface CommunityResult {\n communities: Community[]\n nodeToCommuntiy: Map<TypedNode, number>\n}\n\nconst COMMON_PREFIXES = ['handle', 'on', 'is', 'has', 'can', 'should', 'get', 'set', 'update', 'toggle', 'reset', 'clear', 'init', 'fetch', 'load', 'save', 'delete', 'remove', 'add', 'create', 'show', 'hide', 'open', 'close', 'enable', 'disable', 'validate', 'check', 'use'];\nconst COMMON_SUFFIXES = ['change', 'changed', 'handler', 'callback', 'listener', 'state', 'value', 'data', 'list', 'items', 'count', 'index', 'id', 'name', 'type', 'status', 'error', 'loading', 'visible', 'disabled', 'enabled', 'active', 'selected', 'checked', 'open', 'closed'];\n\n/**\n * Extract the base/root word from an identifier by removing common prefixes/suffixes.\n * Only removes prefixes at the start and suffixes at the end.\n * e.g., \"handleOpenChange\" -> [\"open\"]\n * \"isVisible\" -> [\"visible\"]\n * \"userName\" -> [\"user\", \"name\"]\n */\nexport function extractBaseWords(identifier: string): string[] {\n const tokens = identifier\n .replace(/([a-z])([A-Z])/g, '$1_$2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2')\n .toLowerCase()\n .split(/[_\\-\\s]+/)\n .filter(Boolean);\n\n if (tokens.length === 0) {\n return [];\n }\n\n if (tokens.length === 1) {\n return tokens;\n }\n\n let start = 0;\n if (COMMON_PREFIXES.includes(tokens[0])) {\n start = 1;\n }\n\n let end = tokens.length;\n if (COMMON_SUFFIXES.includes(tokens[tokens.length - 1])) {\n end = tokens.length - 1;\n }\n\n const words = tokens.slice(start, end);\n\n if (words.length === 0) {\n return tokens.slice(start > 0\n ? start\n : 0);\n }\n\n return words;\n}\n\n/**\n * Calculate semantic similarity between two identifiers.\n * Returns a value between 0 and 1.\n *\n * Considers:\n * 1. Shared base words (e.g., \"open\" in \"isOpen\" and \"handleOpenChange\")\n * 2. One identifier contains the other as a substring\n * 3. Common naming patterns (handler/state pairs)\n */\nexport function calculateSemanticSimilarity(labelA: string, labelB: string): number {\n if (labelA === labelB) {\n return 1;\n }\n\n const lowerA = labelA.toLowerCase();\n const lowerB = labelB.toLowerCase();\n\n if (lowerA.includes(lowerB) || lowerB.includes(lowerA)) {\n const shorter = lowerA.length < lowerB.length\n ? lowerA\n : lowerB;\n const longer = lowerA.length < lowerB.length\n ? lowerB\n : lowerA;\n return shorter.length / longer.length;\n }\n\n const wordsA = extractBaseWords(labelA);\n const wordsB = extractBaseWords(labelB);\n\n if (wordsA.length === 0 || wordsB.length === 0) {\n return 0;\n }\n\n const setA = new Set(wordsA);\n const setB = new Set(wordsB);\n\n let sharedCount = 0;\n for (const word of setA) {\n if (setB.has(word)) {\n sharedCount++;\n }\n }\n\n if (sharedCount === 0) {\n return 0;\n }\n\n const jaccardSimilarity = sharedCount / (setA.size + setB.size - sharedCount);\n\n return jaccardSimilarity;\n}\n\ninterface BuildWeightedGraphOptions {\n semanticWeight?: number\n similarityThreshold?: number\n}\n\n/**\n * Calculate semantic similarity using cached base words.\n * Returns a value between 0 and 1.\n */\nfunction calculateSemanticSimilarityCached(\n labelA: string,\n labelB: string,\n wordsA: string[],\n wordsB: string[],\n): number {\n if (labelA === labelB) {\n return 1;\n }\n\n const lowerA = labelA.toLowerCase();\n const lowerB = labelB.toLowerCase();\n\n if (lowerA.includes(lowerB) || lowerB.includes(lowerA)) {\n const shorter = lowerA.length < lowerB.length\n ? lowerA\n : lowerB;\n const longer = lowerA.length < lowerB.length\n ? lowerB\n : lowerA;\n return shorter.length / longer.length;\n }\n\n if (wordsA.length === 0 || wordsB.length === 0) {\n return 0;\n }\n\n const setA = new Set(wordsA);\n const setB = new Set(wordsB);\n\n let sharedCount = 0;\n for (const word of setA) {\n if (setB.has(word)) {\n sharedCount++;\n }\n }\n\n if (sharedCount === 0) {\n return 0;\n }\n\n return sharedCount / (setA.size + setB.size - sharedCount);\n}\n\n/**\n * Build a weighted graph that combines structural connections with semantic similarity.\n *\n * Optimized algorithm:\n * 1. Cache extractBaseWords results to avoid repeated computation\n * 2. Build word-to-nodes bucket map, only compare nodes within same bucket\n * This reduces O(N²) to O(B × K²) where B = number of buckets, K = avg nodes per bucket\n */\nfunction buildWeightedGraph(\n graph: Map<TypedNode, Set<{ node: TypedNode, type: RelationType }>>,\n options: BuildWeightedGraphOptions = {},\n): Map<TypedNode, Map<TypedNode, number>> {\n const { semanticWeight = 1.0, similarityThreshold = 0.3 } = options;\n\n const weighted = new Map<TypedNode, Map<TypedNode, number>>();\n const allNodes = new Set<TypedNode>();\n const connectedPairs = new Set<string>();\n\n for (const [node, edges] of graph) {\n allNodes.add(node);\n for (const edge of edges) {\n allNodes.add(edge.node);\n }\n }\n\n for (const node of allNodes) {\n weighted.set(node, new Map());\n }\n\n const structuralWeight = 0.85;\n\n for (const [node, edges] of graph) {\n for (const edge of edges) {\n const currentWeight = weighted.get(node)!.get(edge.node) || 0;\n weighted.get(node)!.set(edge.node, Math.max(currentWeight, structuralWeight));\n\n const reverseWeight = weighted.get(edge.node)!.get(node) || 0;\n weighted.get(edge.node)!.set(node, Math.max(reverseWeight, structuralWeight));\n\n const pairKey = [node.label, edge.node.label].sort().join('|');\n connectedPairs.add(pairKey);\n }\n }\n\n if (semanticWeight > 0) {\n const nodeWordsCache = new Map<TypedNode, string[]>();\n const wordToBucket = new Map<string, Set<TypedNode>>();\n\n for (const node of allNodes) {\n const words = extractBaseWords(node.label);\n nodeWordsCache.set(node, words);\n\n for (const word of words) {\n if (!wordToBucket.has(word)) {\n wordToBucket.set(word, new Set());\n }\n wordToBucket.get(word)!.add(node);\n }\n }\n\n const comparedPairs = new Set<string>();\n\n for (const [_, bucket] of wordToBucket) {\n if (bucket.size < 2) {\n continue;\n }\n\n const bucketNodes = Array.from(bucket);\n for (let i = 0; i < bucketNodes.length; i++) {\n for (let j = i + 1; j < bucketNodes.length; j++) {\n const nodeA = bucketNodes[i];\n const nodeB = bucketNodes[j];\n\n const comparedKey = [nodeA.label, nodeB.label].sort().join('|');\n if (comparedPairs.has(comparedKey)) {\n continue;\n }\n comparedPairs.add(comparedKey);\n\n const wordsA = nodeWordsCache.get(nodeA)!;\n const wordsB = nodeWordsCache.get(nodeB)!;\n const similarity = calculateSemanticSimilarityCached(\n nodeA.label,\n nodeB.label,\n wordsA,\n wordsB,\n );\n\n if (similarity > similarityThreshold) {\n const isConnected = connectedPairs.has(comparedKey);\n const semanticEdgeWeight = similarity * semanticWeight;\n\n const currentAB = weighted.get(nodeA)!.get(nodeB) || 0;\n const newWeightAB = isConnected\n ? Math.max(currentAB, semanticEdgeWeight)\n : currentAB + semanticEdgeWeight;\n weighted.get(nodeA)!.set(nodeB, Math.min(newWeightAB, 2.0));\n\n const currentBA = weighted.get(nodeB)!.get(nodeA) || 0;\n const newWeightBA = isConnected\n ? Math.max(currentBA, semanticEdgeWeight)\n : currentBA + semanticEdgeWeight;\n weighted.get(nodeB)!.set(nodeA, Math.min(newWeightBA, 2.0));\n }\n }\n }\n }\n }\n\n return weighted;\n}\n\nfunction buildUndirectedGraph(\n graph: Map<TypedNode, Set<{ node: TypedNode, type: RelationType }>>,\n): Map<TypedNode, Set<TypedNode>> {\n const undirected = new Map<TypedNode, Set<TypedNode>>();\n\n for (const [node, edges] of graph) {\n if (!undirected.has(node)) {\n undirected.set(node, new Set());\n }\n for (const edge of edges) {\n undirected.get(node)!.add(edge.node);\n if (!undirected.has(edge.node)) {\n undirected.set(edge.node, new Set());\n }\n undirected.get(edge.node)!.add(node);\n }\n }\n\n return undirected;\n}\n\nfunction createSeededRandom(seed?: number): () => number {\n if (seed === undefined) {\n return Math.random;\n }\n let state = seed;\n return () => {\n state = (state * 1103515245 + 12345) & 0x7FFFFFFF;\n return state / 0x7FFFFFFF;\n };\n}\n\nfunction shuffleArray<T>(array: T[], random: () => number = Math.random): T[] {\n const result = [...array];\n for (let i = result.length - 1; i > 0; i--) {\n const j = Math.floor(random() * (i + 1));\n [result[i], result[j]] = [result[j], result[i]];\n }\n return result;\n}\n\nexport interface DetectCommunitiesOptions {\n maxIterations?: number\n seed?: number\n /**\n * Weight for semantic similarity (0-1).\n * Higher values give more importance to naming patterns.\n * Default: 1.0\n */\n semanticWeight?: number\n /**\n * Minimum semantic similarity threshold to create an edge (0-1).\n * Only node pairs with similarity above this threshold will be connected.\n * Default: 0.3\n */\n similarityThreshold?: number\n}\n\n/**\n * Label Propagation Algorithm for community detection with semantic awareness.\n *\n * Each node starts with its own unique label. In each iteration,\n * nodes adopt the most frequent label among their neighbors,\n * weighted by both structural connections and semantic similarity.\n *\n * Semantic similarity considers:\n * - Shared base words (e.g., \"open\" in \"isOpen\" and \"handleOpenChange\")\n * - Substring relationships\n * - Common naming patterns (handler/state pairs)\n *\n * This helps identify groups of nodes that are tightly connected\n * and could potentially be extracted into separate hooks.\n */\nexport function detectCommunities(\n graph: Map<TypedNode, Set<{ node: TypedNode, type: RelationType }>>,\n options: DetectCommunitiesOptions = {},\n): CommunityResult {\n const { maxIterations = 100, semanticWeight = 1.0, similarityThreshold = 0.3 } = options;\n const random = createSeededRandom(options.seed);\n const weightedGraph = buildWeightedGraph(graph, { semanticWeight, similarityThreshold });\n const nodes = Array.from(weightedGraph.keys());\n\n if (nodes.length === 0) {\n return { communities: [], nodeToCommuntiy: new Map() };\n }\n\n const labels = new Map<TypedNode, number>();\n nodes.forEach((node, index) => {\n labels.set(node, index);\n });\n\n let changed = true;\n let iterations = 0;\n\n while (changed && iterations < maxIterations) {\n changed = false;\n iterations++;\n\n const shuffledNodes = shuffleArray(nodes, random);\n\n for (const node of shuffledNodes) {\n const neighbors = weightedGraph.get(node);\n if (!neighbors || neighbors.size === 0) {\n continue;\n }\n\n const labelWeights = new Map<number, number>();\n for (const [neighbor, weight] of neighbors) {\n const neighborLabel = labels.get(neighbor)!;\n labelWeights.set(neighborLabel, (labelWeights.get(neighborLabel) || 0) + weight);\n }\n\n let maxWeight = 0;\n let maxLabels: number[] = [];\n for (const [label, weight] of labelWeights) {\n if (weight > maxWeight) {\n maxWeight = weight;\n maxLabels = [label];\n }\n else if (weight === maxWeight) {\n maxLabels.push(label);\n }\n }\n\n const currentLabel = labels.get(node)!;\n if (maxLabels.includes(currentLabel)) {\n continue;\n }\n\n const newLabel = maxLabels[Math.floor(random() * maxLabels.length)];\n if (newLabel !== currentLabel) {\n labels.set(node, newLabel);\n changed = true;\n }\n }\n }\n\n const communityMap = new Map<number, Set<TypedNode>>();\n for (const [node, label] of labels) {\n if (!communityMap.has(label)) {\n communityMap.set(label, new Set());\n }\n communityMap.get(label)!.add(node);\n }\n\n const communities: Community[] = [];\n const nodeToCommuntiy = new Map<TypedNode, number>();\n let communityId = 0;\n\n for (const [_, nodeSet] of communityMap) {\n communities.push({\n id: communityId,\n nodes: nodeSet,\n });\n for (const node of nodeSet) {\n nodeToCommuntiy.set(node, communityId);\n }\n communityId++;\n }\n\n communities.sort((a, b) => b.nodes.size - a.nodes.size);\n\n const reindexedCommunities: Community[] = [];\n const newNodeToCommunity = new Map<TypedNode, number>();\n\n communities.forEach((community, newId) => {\n reindexedCommunities.push({\n id: newId,\n nodes: community.nodes,\n });\n for (const node of community.nodes) {\n newNodeToCommunity.set(node, newId);\n }\n });\n\n return {\n communities: reindexedCommunities,\n nodeToCommuntiy: newNodeToCommunity,\n };\n}\n\n/**\n * Generate HSL colors for communities.\n * Uses golden ratio to distribute hues evenly.\n */\nexport function generateCommunityColors(communityCount: number): string[] {\n const colors: string[] = [];\n const goldenRatio = 0.618033988749895;\n let hue = 0.1;\n\n for (let i = 0; i < communityCount; i++) {\n hue = (hue + goldenRatio) % 1;\n const h = Math.floor(hue * 360);\n const s = 65 + (i % 3) * 10;\n const l = 45 + (i % 2) * 10;\n colors.push(`hsl(${h}, ${s}%, ${l}%)`);\n }\n\n return colors;\n}\n\n/**\n * Generate RGBA colors for VS Code decorations.\n * Returns both background (low opacity) and foreground (high opacity) colors.\n */\nexport function generateCommunityColorsRGBA(communityCount: number): Array<{\n background: string\n foreground: string\n border: string\n}> {\n const colors: Array<{ background: string, foreground: string, border: string }> = [];\n const goldenRatio = 0.618033988749895;\n let hue = 0.1;\n\n for (let i = 0; i < communityCount; i++) {\n hue = (hue + goldenRatio) % 1;\n const h = hue * 360;\n const s = 0.45;\n const l = 0.55;\n\n const { r, g, b } = hslToRgb(h, s, l);\n\n colors.push({\n background: `rgba(${r}, ${g}, ${b}, 0.15)`,\n foreground: `rgba(${r}, ${g}, ${b}, 0.9)`,\n border: `rgba(${r}, ${g}, ${b}, 0.5)`,\n });\n }\n\n return colors;\n}\n\nfunction hslToRgb(h: number, s: number, l: number): { r: number, g: number, b: number } {\n h = h / 360;\n\n let r: number, g: number, b: number;\n\n if (s === 0) {\n r = g = b = l;\n }\n else {\n const hue2rgb = (p: number, q: number, t: number) => {\n if (t < 0) { t += 1; }\n if (t > 1) { t -= 1; }\n if (t < 1 / 6) { return p + (q - p) * 6 * t; }\n if (t < 1 / 2) { return q; }\n if (t < 2 / 3) { return p + (q - p) * (2 / 3 - t) * 6; }\n return p;\n };\n\n const q = l < 0.5\n ? l * (1 + s)\n : l + s - l * s;\n const p = 2 * l - q;\n r = hue2rgb(p, q, h + 1 / 3);\n g = hue2rgb(p, q, h);\n b = hue2rgb(p, q, h - 1 / 3);\n }\n\n return {\n r: Math.round(r * 255),\n g: Math.round(g * 255),\n b: Math.round(b * 255),\n };\n}\n","import type { RelationType, TypedNode } from '../analyze/utils';\nimport { NodeType } from '../analyze/utils';\n\n/**\n * Filter out nodes that have no indegree.\n */\nexport function noIndegreeFilter(\n graph: Map<TypedNode, Set<{ node: TypedNode, type: RelationType }>>,\n) {\n const nodes = Array.from(graph.keys());\n const indegree = new Map<TypedNode, number>();\n nodes.forEach((node) => {\n indegree.set(node, 0);\n });\n graph.forEach((targets, node) => {\n targets.forEach((target) => {\n indegree.set(target.node, (indegree.get(target.node) || 0) + 1);\n });\n });\n return nodes.filter(node => indegree.get(node) === 0);\n}\n\n/**\n * Filter out nodes that have no outdegree.\n */\nexport function noOutdegreeFilter(\n graph: Map<TypedNode, Set<TypedNode>>,\n) {\n const zeroOutdegreeNodes = [];\n\n for (const [node, edges] of graph.entries()) {\n if (edges.size === 0) {\n zeroOutdegreeNodes.push(node);\n }\n }\n\n return zeroOutdegreeNodes;\n}\n\n// ---\n\nfunction removeVariable(\n graph: Map<TypedNode, Set<TypedNode>>,\n targets: Set<TypedNode>,\n) {\n const newTarget = new Set<TypedNode>();\n targets.forEach((target) => {\n if (target.type === NodeType.var) {\n const nodes = graph.get(target);\n nodes?.forEach((node) => {\n newTarget.add(node);\n });\n }\n if (target.type === NodeType.fun) {\n newTarget.add(target);\n }\n });\n return newTarget;\n}\n\n/**\n * only save function nodes\n */\nexport function onlyFunctions(\n graph: Map<TypedNode, Set<TypedNode>>,\n): Map<TypedNode, Set<TypedNode>> {\n const result = new Map<TypedNode, Set<TypedNode>>();\n graph.forEach((targets, node) => {\n if (node.type === NodeType.fun) {\n const nodes = removeVariable(graph, targets);\n result.set(node, nodes);\n }\n });\n return result;\n}\n\n// ---\n\nexport function findLinearPaths(graph: Map<TypedNode, Set<{ node: TypedNode, type: RelationType }>>) {\n const linearPaths = [] as TypedNode[][];\n const visitedNodes = new Set<TypedNode>();\n const nodeInDegrees = new Map<TypedNode, number>();\n\n // 计算每个节点的入度\n for (const [node, edges] of graph.entries()) {\n if (!nodeInDegrees.has(node)) {\n nodeInDegrees.set(node, 0); // 确保每个节点都在入度映射中\n }\n for (const edge of edges) {\n const inDegree = nodeInDegrees.get(edge.node) || 0;\n nodeInDegrees.set(edge.node, inDegree + 1);\n }\n }\n\n function dfs(node: TypedNode, path: TypedNode[]) {\n if (visitedNodes.has(node)) {\n return;\n }\n\n path.push(node);\n visitedNodes.add(node);\n\n const edges = graph.get(node) || new Set();\n\n if (edges.size === 0 || edges.size > 1) {\n if (path.length > 1) {\n addOrUpdatePath([...path]);\n }\n }\n else {\n const nextNode = Array.from(edges)[0].node;\n const nextNodeInDegree = nodeInDegrees.get(nextNode) || 0;\n\n // 确保下一个节点只有一个入度\n if (nextNodeInDegree === 1) {\n dfs(nextNode, path);\n }\n }\n\n path.pop();\n visitedNodes.delete(node);\n }\n\n function addOrUpdatePath(newPath: TypedNode[]) {\n let shouldAddNewPath = true;\n\n for (let i = linearPaths.length - 1; i >= 0; i--) {\n const existingPath = linearPaths[i];\n if (isSubpath(existingPath, newPath)) {\n linearPaths.splice(i, 1); // remove the shorter path\n }\n else if (isSubpath(newPath, existingPath)) {\n shouldAddNewPath = false;\n break;\n }\n }\n\n if (shouldAddNewPath && newPath.length > 2) {\n linearPaths.push(newPath);\n }\n }\n\n function isSubpath(shortPath: TypedNode[], longPath: TypedNode[]) {\n if (shortPath.length >= longPath.length) {\n return false;\n }\n\n for (let i = 0; i <= longPath.length - shortPath.length; i++) {\n let isSub = true;\n for (let j = 0; j < shortPath.length; j++) {\n if (shortPath[j] !== longPath[i + j]) {\n isSub = false;\n break;\n }\n }\n if (isSub) {\n return true;\n }\n }\n return false;\n }\n\n for (const node of graph.keys()) {\n dfs(node, []);\n }\n\n return linearPaths;\n}\n\n// ---\n\nexport function findArticulationPoints(graph: Map<TypedNode, Set<{ node: TypedNode, type: RelationType }>>) {\n const noIndegreeNodes = noIndegreeFilter(graph);\n let time = 0;\n const low = new Map<TypedNode, number>();\n const disc = new Map<TypedNode, number>();\n const parent = new Map<TypedNode, TypedNode | null>();\n const ap = new Set<TypedNode>();\n const visited = new Set<TypedNode>();\n\n function APUtil(graph: Map<TypedNode, Set<{ node: TypedNode, type: RelationType }>>, node: TypedNode) {\n let children = 0;\n disc.set(node, time);\n low.set(node, time);\n time++;\n visited.add(node);\n\n for (const neighbor of graph.get(node) || []) {\n if (!visited.has(neighbor.node)) {\n children++;\n parent.set(neighbor.node, node);\n APUtil(graph, neighbor.node);\n low.set(node, Math.min(low.get(node)!, low.get(neighbor.node)!));\n if (parent.get(node) === null && children > 1) {\n ap.add(node);\n }\n if (parent.get(node) !== null && low.get(neighbor.node)! >= disc.get(node)!) {\n ap.add(node);\n }\n }\n else if (neighbor.node !== parent.get(node)) {\n low.set(node, Math.min(low.get(node)!, disc.get(neighbor.node)!));\n }\n }\n }\n\n for (const node of graph.keys()) {\n if (!visited.has(node) && !noIndegreeNodes.includes(node)) {\n APUtil(graph, node);\n }\n }\n return ap;\n}\n","import type { RelationType, TypedNode } from '../analyze/utils';\n\nfunction dfs(\n graph: Map<TypedNode, Set<{ node: TypedNode, type: RelationType }>>,\n node: TypedNode,\n targets: Set<{ node: TypedNode, type: RelationType }>,\n visited: Set<TypedNode>,\n component: Set<TypedNode>,\n) {\n component.add(node);\n visited.add(node);\n targets.forEach((target) => {\n if (!visited.has(target.node)) {\n dfs(graph, target.node, graph.get(target.node) || new Set(), visited, component);\n }\n });\n}\n\nfunction haveIntersection(setA: Set<TypedNode>, setB: Set<TypedNode>): boolean {\n for (const item of setA) {\n if (setB.has(item)) {\n return true;\n }\n }\n return false;\n}\n\nfunction mergeSets(arr: Set<TypedNode>[]): Set<TypedNode>[] {\n let result: Set<TypedNode>[] = [...arr];\n for (let i = 0; i < result.length; i++) {\n for (let j = i + 1; j < result.length; j++) {\n if (haveIntersection(result[i], result[j])) {\n const newSet = new Set([...result[i], ...result[j]]);\n result.splice(j, 1);\n result.splice(i, 1);\n result = [...result, newSet];\n return mergeSets(result);\n }\n }\n }\n return result;\n}\n\nexport function splitGraph(\n graph: Map<TypedNode, Set<{ node: TypedNode, type: RelationType }>>,\n) {\n const components = [] as Set<TypedNode>[];\n\n const sorted = Array.from(graph).sort((a, b) => b[1].size - a[1].size);\n\n (new Map(sorted)).forEach((targets, node) => {\n const visited = new Set<TypedNode>();\n if (!visited.has(node)) {\n const component = new Set<TypedNode>();\n dfs(graph, node, targets, visited, component);\n components.push(component);\n }\n });\n\n return mergeSets(components).map((component) => {\n const subGraph = new Map<TypedNode, Set<{ node: TypedNode, type: RelationType }>>();\n component.forEach((node) => {\n const targets = graph.get(node);\n if (targets) {\n subGraph.set(node, targets);\n }\n });\n return subGraph;\n });\n}\n","import type { RelationType, TypedNode } from '../analyze/utils';\n\nexport function hasCycle(\n graph: Map<TypedNode, Set<{ node: TypedNode, type: RelationType }>>,\n): { hasCycle: boolean, cycleNodes: TypedNode[] } {\n const visited: Set<TypedNode> = new Set();\n const onStack: Set<TypedNode> = new Set();\n const stack: TypedNode[] = [];\n let cycleNodes: TypedNode[] = [];\n\n function dfs(node: TypedNode): boolean {\n if (visited.has(node)) {\n if (onStack.has(node)) {\n // 只有当环中所有边都是写(set) 或全是 调用(call) 才算循环\n const idx = stack.indexOf(node);\n const cycle = stack.slice(idx);\n const allNotGet = cycle.every((curr, i) => {\n const next = cycle[(i + 1) % cycle.length];\n return Array.from(graph.get(curr) || []).some(\n edge => edge.node === next && edge.type !== 'get',\n );\n });\n\n if (allNotGet) {\n cycleNodes = cycle;\n return true;\n }\n return false;\n }\n return false;\n }\n\n visited.add(node);\n onStack.add(node);\n stack.push(node);\n\n for (const neighbor of (graph.get(node) || new Set())) {\n // 检查自环:自己依赖自己且 type 为 'set' 也算环\n if (neighbor.node === node && neighbor.type !== 'get') {\n cycleNodes = [node];\n return true;\n }\n if (dfs(neighbor.node)) {\n return true;\n }\n }\n\n onStack.delete(node);\n stack.pop();\n return false;\n }\n\n for (const [node, targets] of graph) {\n if (dfs(node)) {\n return { hasCycle: true, cycleNodes };\n }\n }\n\n return { hasCycle: false, cycleNodes: [] };\n}\n","import type { RelationType, TypedNode } from '../analyze/utils';\nimport { NodeType } from '../analyze/utils';\nimport { detectCommunities } from './community';\nimport { findArticulationPoints, findLinearPaths, noIndegreeFilter } from './filter';\nimport { splitGraph } from './split';\nimport { hasCycle } from './utils';\n\nexport enum SuggestionType {\n info = 'info',\n warning = 'warning',\n error = 'error',\n}\n\nexport interface Suggestion {\n type: SuggestionType\n message: string\n nodeInfo?: TypedNode | Array<TypedNode>\n};\n\nexport function gen(\n graph: {\n nodes: Set<TypedNode>\n edges: Map<TypedNode, Set<{ node: TypedNode, type: RelationType }>>\n },\n nodesUsedInTemplate: Set<string>,\n nodesUsedInStyle: Set<string> = new Set(),\n options?: Partial<{\n ellipsis: boolean\n communitySeed: number\n }>,\n) {\n const {\n ellipsis = true,\n communitySeed,\n } = options ?? {};\n\n const usedNodes = new Set([...nodesUsedInTemplate, ...nodesUsedInStyle]);\n\n const suggestions: Suggestion[] = [];\n const splitedGraph = splitGraph(graph.edges);\n splitedGraph.forEach((g) => {\n const nodes = Array.from(g.keys());\n\n if (splitedGraph.length > 1) {\n if (nodes.length > 2 && nodes.some(node => !usedNodes.has(node.label))) {\n suggestions.push({\n type: SuggestionType.info,\n message: `Nodes [${\n (ellipsis && nodes.length > 10)\n ? `${nodes.slice(0, 10).map(node => node.label).join(',')}...(${nodes.length})`\n : nodes.map(node => node.label).join(',')\n }] are isolated, perhaps you can refactor them to an isolated file.`,\n nodeInfo: nodes,\n });\n }\n }\n\n if (nodes.length > 1 && nodes.every(node => !usedNodes.has(node.label) && !node.info?.used?.size)) {\n suggestions.push({\n type: SuggestionType.info,\n message: `Nodes [${\n (ellipsis && nodes.length > 10)\n ? `${nodes.slice(0, 10).map(node => node.label).join(',')}...`\n : nodes.map(node => node.label).join(',')\n }] are not used, perhaps you can remove them.`,\n nodeInfo: nodes,\n });\n }\n const hasCycleResult = hasCycle(g);\n if (hasCycleResult.hasCycle) {\n suggestions.push({\n type: SuggestionType.error,\n message: `There is a loop call in nodes [${\n hasCycleResult.cycleNodes.map(node => node.label).join(',')\n }], perhaps you can refactor it.`,\n nodeInfo: hasCycleResult.cycleNodes,\n });\n }\n\n const paths = findLinearPaths(g);\n paths.forEach((path) => {\n const firstUsedNodeIndex = path.findIndex(node => usedNodes.has(node.label));\n const reverseLastNotUsedNodeIndex = path.slice().reverse().findIndex(node => !usedNodes.has(node.label));\n const lastNotUsedNodeIndex = reverseLastNotUsedNodeIndex !== -1\n ? path.length - 1 - reverseLastNotUsedNodeIndex\n : -1;\n\n if (firstUsedNodeIndex > -1 && firstUsedNodeIndex < lastNotUsedNodeIndex) {\n suggestions.push({\n type: SuggestionType.warning,\n message: `Nodes [${\n (ellipsis && path.length > 10)\n ? `${path.slice(0, 10).map(node => node.label).join(',')}...(${path.length})`\n : path.map(node => node.label).join(',')\n }] are have function chain calls, perhaps you can refactor it.`,\n nodeInfo: path,\n });\n }\n });\n\n if (g.size > 5) {\n const ap = findArticulationPoints(g);\n ap.forEach((node) => {\n if (node.type === NodeType.fun) {\n suggestions.push({\n type: SuggestionType.info,\n\n message: `Node [${\n node.label\n }] is an articulation point, perhaps you need to pay special attention to this node.`,\n nodeInfo: node,\n });\n }\n });\n }\n });\n\n const noIndegreeNodes = noIndegreeFilter(graph.edges);\n noIndegreeNodes.forEach((node) => {\n if (!usedNodes.has(node.label) && !node.info?.used?.size) {\n suggestions.push({\n type: SuggestionType.info,\n message: `Node [${node.label}] is not used, perhaps you can remove it.`,\n nodeInfo: node,\n });\n }\n });\n\n const communityResult = detectCommunities(graph.edges, { seed: communitySeed });\n const { communities } = communityResult;\n\n const extractableCommunities = communities.filter((community) => {\n const nodes = Array.from(community.nodes);\n if (nodes.length < 3 || nodes.length > 15) {\n return false;\n }\n\n const hasUsedNode = nodes.some(node => usedNodes.has(node.label));\n const hasUnusedNode = nodes.some(node => !usedNodes.has(node.label));\n\n return hasUsedNode && hasUnusedNode;\n });\n\n extractableCommunities.forEach((community) => {\n const nodes = Array.from(community.nodes);\n const unusedNodes = nodes.filter(node => !usedNodes.has(node.label));\n\n if (unusedNodes.length >= 2) {\n suggestions.push({\n type: SuggestionType.info,\n message: `Nodes [${\n (ellipsis && nodes.length > 10)\n ? `${nodes.slice(0, 10).map(node => node.label).join(',')}...(${nodes.length})`\n : nodes.map(node => node.label).join(',')\n }] form a tightly coupled group, consider extracting them into a composable/hook.`,\n nodeInfo: nodes,\n });\n }\n });\n\n if (communities.length > 3) {\n const independentCommunities = communities.filter((community) => {\n const nodes = Array.from(community.nodes);\n return nodes.length >= 2 && nodes.every(node => !usedNodes.has(node.label) && !node.info?.used?.size);\n });\n\n if (independentCommunities.length >= 2) {\n const allNodes = independentCommunities.flatMap(c => Array.from(c.nodes));\n suggestions.push({\n type: SuggestionType.info,\n message: `Found ${independentCommunities.length} independent variable groups that are not used in template. Consider removing or extracting them.`,\n nodeInfo: allNodes,\n });\n }\n }\n\n const largeCommunities = communities.filter(c => c.nodes.size > 10);\n largeCommunities.forEach((community) => {\n const nodes = Array.from(community.nodes);\n const functionNodes = nodes.filter(n => n.type === NodeType.fun);\n\n if (functionNodes.length > 5) {\n suggestions.push({\n type: SuggestionType.warning,\n message: `Community with ${nodes.length} nodes has ${functionNodes.length} functions. This group is complex, consider splitting into smaller composables.`,\n nodeInfo: nodes,\n });\n }\n });\n\n return suggestions;\n}\n","import type { Data, Edge, Node } from 'vis-network';\nimport type { RelationType, TypedNode } from './analyze/utils';\n\ntype CustomNode = Node & {\n info: TypedNode['info']\n};\n\nfunction filterNodeUserd(used: Set<string> | undefined) {\n const usedArray = Array.from(used || []);\n return new Set(usedArray.filter(u => ![\n 'Assignment Expression',\n 'Call Expression',\n ].includes(u)));\n}\n\nexport function getVisData(\n graph: {\n nodes: Set<TypedNode>\n edges: Map<TypedNode, Set<{ node: TypedNode, type: RelationType }>>\n },\n nodesUsedInTemplate: Set<string>,\n nodesUsedInStyle: Set<string> = new Set(),\n) {\n const usedNodes = new Set([...nodesUsedInTemplate, ...nodesUsedInStyle]);\n\n const nodes: CustomNode[] = [];\n const edges: Edge[] = [];\n\n const inDegreeMap: Record<string, number> = {};\n const outDegreeMap: Record<string, number> = {};\n graph.edges.forEach((edge) => {\n edge.forEach((to) => {\n if (to) {\n inDegreeMap[to.node.label] = (inDegreeMap[to.node.label] || 0) + 1;\n }\n });\n });\n graph.edges.forEach((edge, key) => {\n outDegreeMap[key.label] = edge.size;\n });\n\n graph.nodes.forEach((node) => {\n const inDegree = inDegreeMap[node.label] || 0;\n const outDegree = outDegreeMap[node.label] || 0;\n\n nodes.push({\n id: node.label,\n label: node.label,\n shape: node.type === 'var'\n ? 'dot'\n : 'diamond',\n group: usedNodes.has(node.label) || node.info?.used?.size\n ? 'used'\n : 'normal',\n size: 20 + 1.6 ** ((inDegree * 0.75 + outDegree * 0.25)),\n title: `${\n filterNodeUserd(node.info?.used).size\n ? `used by ${Array.from(filterNodeUserd(node.info?.used))?.map(i => `\\`${i}\\``).join(',')}\\n\\n`\n : ''\n }${\n usedNodes.has(node.label)\n ? `used in ${\n [\n nodesUsedInStyle.has(node.label)\n ? 'style'\n : '',\n nodesUsedInTemplate.has(node.label)\n ? 'template'\n : '',\n ].filter(Boolean).join(' and ')\n }\\n\\n`\n : ''\n }${node.info?.comment || ''}`.trim() || undefined,\n info: node.info,\n });\n });\n\n graph.edges.forEach((edge, key) => {\n edge.forEach((to) => {\n if (!to) {\n return;\n }\n edges.push({\n from: key.label,\n to: to.node.label,\n arrows: {\n to: {\n enabled: true,\n scaleFactor: 0.8,\n },\n },\n });\n });\n });\n\n return {\n nodes,\n edges,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,IAAY,gDAAL;AACL;AACA;;;AAWF,IAAa,iBAAb,MAA4B;CAG1B,YAAY,cAAc,GAAG,WAAW,MAAM;oBAFjC;iBACH;+BAMF,IAAI;AAJV,OAAK,aAAa;AAClB,OAAK,UAAU;;CAKjB,QACE,OACA,MACA,UAA4B;EAAE,YAAY;EAAO,UAAU;EAAO,SAAS;IAC3E;AACA,MAAI,KAAK,MAAM,IAAI,OACjB;AAEF,MACG,CAAC,QAAQ,eACP,KAAK,SAAS,wBAAwB;GACrC;GACA;GACA;IACA,SAAS,KAAK,MAAM,QAAQ,OAC1B,KAAK,SAAS,oBAAoB;GACpC;GACA;GACA;IACA,SAAS,KAAK,OAAO,QAAQ,OAC5B,KAAK,SAAS,yBACd,KAAK,SAAS,kBACd,KAAK,SAAS,6BACd,KAAK,SAAS,yBAEhB,QAAQ,SAEX,MAAK,MAAM,IAAI,OAAO;GACpB;GACA,MAAM,SAAS;GACf,GAAI,KAAK,UACL,EACA,MAAM;IACJ,OAAO,KAAK,KAAK,MAAM,QAAQ,KAAK,IAAI,KAAK;IAC7C,QAAQ,KAAK,KAAK,MAAM,UAAU;IAClC,GAAG,QAAQ,UACP,EAAE,SAAS,QAAQ,YACnB;SAGN;;MAIN,MAAK,MAAM,IAAI,OAAO;GACpB;GACA,MAAM,SAAS;GACf,GAAI,KAAK,UACL,EACA,MAAM;IACJ,OAAO,KAAK,KAAK,MAAM,QAAQ,KAAK,IAAI,KAAK;IAC7C,QAAQ,KAAK,KAAK,MAAM,U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AiB,IAAI,KAAK,SACtB,UACA,IACJ,oBAAoB,IAAI,KAAK,SACzB,aACA,IACJ,OAAO,SAAS,KAAK,SACxB,QACC,KACH,KAAK,MAAM,WAAW,KAAK,UAAU;GACxC,MAAM,KAAK;;;AAIf,OAAM,MAAM,SAAS,MAAM,QAAQ;AACjC,OAAK,SAAS,OAAO;AACnB,OAAI,CAAC,GACH;AAEF,SAAM,KAAK;IACT,MAAM,IAAI;IACV,IAAI,GAAG,KAAK;IACZ,QAAQ,EACN,IAAI;KACF,SAAS;KACT,aAAa;;;;;AAOvB,QAAO;EACL;EACA"}
1
+ {"version":3,"file":"index.cjs","names":["traverse: typeof _traverse","_traverse","watchHooks","hookName","results: HookAnalysisResult[]","traverse: typeof _traverse","_traverse","analyze","traverse: typeof _traverse","_traverse","spread: string[]","state: LexerState","analyze","traverse: typeof _traverse","_traverse","analyze","traverse: typeof _traverse","_traverse","res: t.Identifier[]","path: NodePath<t.ObjectMethod>","spread: string[]","node","parentPath","params","result: IReturnData | undefined","analyze","direction: 'TB' | 'BT' | 'LR' | 'RL'","usedNodes: Set<string>","mermaidText: string","shape: string","closeShape: string","unusedSuffix: string","maxLabels: number[]","communities: Community[]","reindexedCommunities: Community[]","colors: string[]","colors: Array<{ background: string, foreground: string, border: string }>","r: number","g: number","b: number","p","q","dfs","graph","result: Set<TypedNode>[]","visited: Set<TypedNode>","onStack: Set<TypedNode>","stack: TypedNode[]","cycleNodes: TypedNode[]","dfs","suggestions: Suggestion[]","nodes: CustomNode[]","edges: Edge[]","inDegreeMap: Record<string, number>","outDegreeMap: Record<string, number>"],"sources":["../src/analyze/utils.ts","../src/analyze/hook.ts","../src/analyze/setupScript.ts","../src/analyze/options.ts","../src/analyze/style.ts","../src/analyze/template.ts","../src/utils/traverse.ts","../src/analyze/tsx.ts","../src/mermaid.ts","../src/suggest/community.ts","../src/suggest/filter.ts","../src/suggest/split.ts","../src/suggest/utils.ts","../src/suggest/index.ts","../src/vis.ts"],"sourcesContent":["import type { NodePath } from '@babel/traverse';\nimport type * as t from '@babel/types';\n\nexport interface TypedNode {\n label: string\n type: NodeType\n info?: Partial<{\n line: number\n column: number\n comment: string\n used: Set<string>\n }>\n};\n\nexport enum NodeType {\n var = 'var',\n fun = 'fun',\n}\n\ninterface Options {\n isComputed: boolean\n isMethod: boolean\n comment: string\n};\n\nexport type RelationType = 'get' | 'set' | 'call';\n\nexport class NodeCollection {\n lineOffset = 0;\n addInfo = true;\n constructor(_lineOffset = 0, _addInfo = true) {\n this.lineOffset = _lineOffset;\n this.addInfo = _addInfo;\n }\n\n nodes = new Map<string, TypedNode>();\n\n addNode(\n label: string,\n node: t.Node,\n options: Partial<Options> = { isComputed: false, isMethod: false, comment: '' },\n ) {\n if (this.nodes.has(label)) {\n return;\n }\n if (\n (!options.isComputed && (\n (node.type === 'VariableDeclarator' && [\n 'ArrowFunctionExpression',\n 'FunctionDeclaration',\n 'FunctionExpression',\n ].includes(node.init?.type || ''))\n || (node.type === 'ObjectProperty' && [\n 'ArrowFunctionExpression',\n 'FunctionDeclaration',\n 'FunctionExpression',\n ].includes(node.value?.type || ''))\n || node.type === 'FunctionDeclaration'\n || node.type === 'ObjectMethod'\n || node.type === 'ArrowFunctionExpression'\n || node.type === 'FunctionExpression'\n ))\n || options.isMethod\n ) {\n this.nodes.set(label, {\n label,\n type: NodeType.fun,\n ...(this.addInfo\n ? {\n info: {\n line: (node.loc?.start.line || 1) - 1 + this.lineOffset,\n column: node.loc?.start.column || 0,\n ...options.comment\n ? { comment: options.comment }\n : {},\n },\n }\n : {}),\n });\n }\n else {\n this.nodes.set(label, {\n label,\n type: NodeType.var,\n ...(this.addInfo\n ? {\n info: {\n line: (node.loc?.start.line || 1) - 1 + this.lineOffset,\n column: node.loc?.start.column || 0,\n ...options.comment\n ? { comment: options.comment }\n : {},\n },\n }\n : {}),\n });\n }\n }\n\n addTypedNode(label: string, node: TypedNode) {\n this.nodes.set(label, {\n label,\n type: node.type,\n ...(this.addInfo\n ? {\n info: {\n ...(node.info || {}),\n },\n }\n : {}),\n });\n }\n\n getNode(label: string) {\n return this.nodes.get(label);\n }\n\n map(graph: {\n nodes: Set<string>\n edges: Map<string, Set<{ label: string, type: RelationType }>>\n }) {\n const nodes = new Set(Array.from(graph.nodes).map((node) => {\n return this.nodes.get(node)!;\n }).filter(node => !!node));\n\n const edges = new Map(Array.from(graph.edges).map(([from, to]) => {\n // dedupe by node label, preferring 'set' over 'get'\n const labelMap = new Map<string, { node: TypedNode, type: RelationType }>();\n for (const item of to) {\n const node = this.nodes.get(item.label)!;\n if (!node) {\n continue;\n }\n const existing = labelMap.get(item.label);\n if (!existing || (existing.type === 'get' && item.type === 'set')) {\n labelMap.set(item.label, { node, type: item.type });\n }\n }\n const items = Array.from(labelMap.values());\n return [this.nodes.get(from)!, new Set(items)];\n }));\n\n return {\n nodes,\n edges,\n };\n }\n}\n\nexport function getComment(node: t.Node) {\n let comment = '';\n\n node.leadingComments?.forEach((_comment) => {\n if (_comment.loc!.end.line > node.loc!.start.line) {\n return;\n }\n if (_comment.value.trim().startsWith('*')) {\n comment += `${_comment.value.trim().replace(/^\\s*\\*+\\s*\\**/gm, '').trim()}\\n`;\n }\n });\n\n node.trailingComments?.forEach((_comment) => {\n if (_comment.loc!.end.line > node.loc!.start.line) {\n return;\n }\n if (_comment.value.trim().startsWith('*')) {\n comment += `${_comment.value.trim().replace(/^\\s*\\*+\\s*\\**/gm, '').trim()}\\n`;\n }\n else {\n comment += `${_comment.value.trim()}\\n`;\n }\n });\n\n return comment.trim();\n}\n\nexport function isWritingNode(path: NodePath<t.Node>) {\n // Check if the current node is inside an assignment expression (including nested MemberExpression)\n const assignParent = path.findParent(p => p.isAssignmentExpression()) as NodePath<t.AssignmentExpression> | null;\n if (assignParent) {\n const leftNode = assignParent.node.left;\n if (\n leftNode.start != null\n && path.node.start! >= leftNode.start\n && path.node.end! <= (leftNode.end as number)\n ) {\n return true;\n }\n }\n\n // Check if the current node is inside an update expression (including nested MemberExpression)\n const updateParent = path.findParent(p => p.isUpdateExpression()) as NodePath<t.UpdateExpression> | null;\n if (updateParent) {\n const argNode = updateParent.node.argument as t.Node;\n if (\n argNode.start != null\n && path.node.start! >= argNode.start\n && path.node.end! <= (argNode.end as number)\n ) {\n return true;\n }\n }\n\n return false;\n}\n\nexport function isCallingNode(path: NodePath<t.Identifier>) {\n const parent = path.parentPath;\n // 判断父节点是否为 CallExpression,并且当前节点是 callee\n if (parent && parent.isCallExpression()) {\n return parent.node.callee === path.node;\n }\n return false;\n}\n\nexport function getRelationType(path: NodePath<t.Node>) {\n if (path.node.type === 'Identifier' && isCallingNode(path as NodePath<t.Identifier>)) {\n return 'call';\n }\n if (isWritingNode(path)) {\n return 'set';\n }\n return 'get';\n}\n","import type { NodePath, Scope } from '@babel/traverse';\nimport type * as t from '@babel/types';\nimport type { RelationType } from './utils';\nimport _traverse from '@babel/traverse';\nimport { babelParse } from '@vue/compiler-sfc';\nimport { getComment, getRelationType, NodeCollection } from './utils';\n\nconst traverse: typeof _traverse\n // @ts-expect-error unwarp default\n = _traverse.default?.default || _traverse.default || _traverse;\n\nconst watchHooks = [\n 'watch',\n 'watchArray',\n 'watchAtMost',\n 'watchDebounced',\n 'watchDeep',\n 'watchIgnorable',\n 'watchImmediate',\n 'watchOnce',\n 'watchPausable',\n 'watchThrottled',\n 'watchTriggerable',\n 'watchWithFilter',\n];\n\nconst reactEffects = [\n 'useEffect',\n 'useLayoutEffect',\n 'useInsertionEffect',\n 'useMemo',\n 'useCallback',\n];\n\nconst allEffectHooks = [...watchHooks, 'watchEffect', ...reactEffects];\n\ninterface HookAnalysisResult {\n graph: {\n nodes: Set<string>\n edges: Map<string, Set<{ label: string, type: RelationType }>>\n }\n nodeCollection: NodeCollection\n nodesUsedInReturn: Set<string>\n hookName: string\n}\n\nfunction processHookFunction(\n functionPath: NodePath<t.FunctionDeclaration | t.ArrowFunctionExpression | t.FunctionExpression>,\n lineOffset = 0,\n externalHookName = '',\n framework: 'vue' | 'react' = 'vue',\n): HookAnalysisResult {\n const nodeCollection = new NodeCollection(lineOffset);\n const nodesUsedInReturn = new Set<string>();\n\n const graph = {\n nodes: new Set<string>(),\n edges: new Map<string, Set<{ label: string, type: RelationType }>>(),\n };\n\n const functionNode = functionPath.node;\n const hookName = externalHookName\n || (functionNode.type === 'FunctionDeclaration' && functionNode.id\n ? functionNode.id.name\n : '');\n\n const bodyNode = functionNode.body;\n if (bodyNode.type !== 'BlockStatement') {\n return { graph, nodeCollection, nodesUsedInReturn, hookName };\n }\n\n const functionScope = functionPath.scope;\n\n // Collect function parameters as graph nodes (they are the \"inputs\" like props in setup)\n if (functionNode.params) {\n functionNode.params.forEach((param) => {\n if (param.type === 'Identifier') {\n graph.nodes.add(param.name);\n nodeCollection.addNode(param.name, param, { comment: '' });\n if (!graph.edges.get(param.name)) {\n graph.edges.set(param.name, new Set());\n }\n }\n else if (param.type === 'AssignmentPattern' && param.left.type === 'Identifier') {\n graph.nodes.add(param.left.name);\n nodeCollection.addNode(param.left.name, param.left, { comment: '' });\n if (!graph.edges.get(param.left.name)) {\n graph.edges.set(param.left.name, new Set());\n }\n }\n else if (param.type === 'ObjectPattern') {\n param.properties.forEach((prop) => {\n if (prop.type === 'ObjectProperty' && prop.value.type === 'Identifier') {\n graph.nodes.add(prop.value.name);\n nodeCollection.addNode(prop.value.name, prop.value, { comment: '' });\n if (!graph.edges.get(prop.value.name)) {\n graph.edges.set(prop.value.name, new Set());\n }\n }\n else if (prop.type === 'RestElement' && prop.argument.type === 'Identifier') {\n graph.nodes.add(prop.argument.name);\n nodeCollection.addNode(prop.argument.name, prop.argument, { comment: '' });\n if (!graph.edges.get(prop.argument.name)) {\n graph.edges.set(prop.argument.name, new Set());\n }\n }\n });\n }\n else if (param.type === 'ArrayPattern') {\n param.elements.forEach((element) => {\n if (element?.type === 'Identifier') {\n graph.nodes.add(element.name);\n nodeCollection.addNode(element.name, element, { comment: '' });\n if (!graph.edges.get(element.name)) {\n graph.edges.set(element.name, new Set());\n }\n }\n });\n }\n });\n }\n\n // First pass: collect all variable and function declarations as nodes\n traverse(bodyNode, {\n VariableDeclaration(path) {\n path.node.declarations.forEach((declaration) => {\n if (declaration.id.type === 'Identifier') {\n const name = declaration.id.name;\n const binding = path.scope.getBinding(name);\n if (binding && binding.scope === functionScope) {\n graph.nodes.add(name);\n nodeCollection.addNode(name, declaration, {\n comment: getComment(path.node),\n });\n if (!graph.edges.get(name)) {\n graph.edges.set(name, new Set());\n }\n }\n }\n else if (declaration.id.type === 'ObjectPattern') {\n declaration.id.properties.forEach((property) => {\n if (property.type === 'ObjectProperty' && property.value.type === 'Identifier') {\n const name = property.value.name;\n const binding = path.scope.getBinding(name);\n if (binding && binding.scope === functionScope) {\n graph.nodes.add(name);\n nodeCollection.addNode(name, property.value, {\n comment: getComment(property),\n });\n if (!graph.edges.get(name)) {\n graph.edges.set(name, new Set());\n }\n }\n }\n else if (property.type === 'RestElement' && property.argument.type === 'Identifier') {\n const name = property.argument.name;\n const binding = path.scope.getBinding(name);\n if (binding && binding.scope === functionScope) {\n graph.nodes.add(name);\n nodeCollection.addNode(name, property.argument, {\n comment: getComment(property),\n });\n if (!graph.edges.get(name)) {\n graph.edges.set(name, new Set());\n }\n }\n }\n });\n }\n else if (declaration.id.type === 'ArrayPattern') {\n declaration.id.elements.forEach((element) => {\n if (element?.type === 'Identifier') {\n const name = element.name;\n const binding = path.scope.getBinding(name);\n if (binding && binding.scope === functionScope) {\n graph.nodes.add(name);\n nodeCollection.addNode(name, element, {\n comment: getComment(path.node),\n });\n if (!graph.edges.get(name)) {\n graph.edges.set(name, new Set());\n }\n }\n }\n });\n }\n });\n },\n FunctionDeclaration(path) {\n const name = path.node.id?.name;\n if (name) {\n const binding = path.scope.getBinding(name);\n if (binding && binding.scope === functionScope) {\n graph.nodes.add(name);\n nodeCollection.addNode(name, path.node.id!, {\n isMethod: true,\n comment: getComment(path.node),\n });\n if (!graph.edges.get(name)) {\n graph.edges.set(name, new Set());\n }\n }\n }\n },\n }, functionScope, functionPath);\n\n // Helper to traverse hooks (watch, watchEffect, etc.)\n function traverseHooks(node: t.ExpressionStatement | t.CallExpression, parentScope: Scope) {\n if (\n (\n node.type === 'ExpressionStatement'\n && node.expression.type === 'CallExpression'\n && node.expression.callee.type === 'Identifier'\n ) || (\n node.type === 'CallExpression'\n && node.callee.type === 'Identifier'\n )\n ) {\n const hookName = (() => {\n if (node.type === 'ExpressionStatement'\n && node.expression.type === 'CallExpression'\n && node.expression.callee.type === 'Identifier') {\n return node.expression.callee.name;\n }\n if (node.type === 'CallExpression'\n && node.callee.type === 'Identifier') {\n return node.callee.name;\n }\n })() || '';\n\n if (!hookName) {\n return;\n }\n\n const hookBinding = parentScope.getBinding(hookName);\n if (!(hookBinding === undefined || hookBinding?.scope === functionScope)) {\n return;\n }\n\n const expression = (node.type === 'ExpressionStatement'\n ? node.expression\n : node) as t.CallExpression;\n\n const watchArgs = new Set<t.Identifier>();\n\n if (watchHooks.includes(hookName)) {\n if (expression.arguments[0]?.type === 'Identifier') {\n const binding = parentScope.getBinding(expression.arguments[0].name);\n if (binding && graph.nodes.has(expression.arguments[0].name) && binding.scope === functionScope) {\n watchArgs.add(expression.arguments[0]);\n }\n }\n else if (expression.arguments[0]) {\n traverse(expression.arguments[0], {\n Identifier(path1) {\n const binding = path1.scope.getBinding(path1.node.name);\n if (\n graph.nodes.has(path1.node.name)\n && (\n (path1.parent.type !== 'MemberExpression'\n && path1.parent.type !== 'OptionalMemberExpression')\n || path1.parent.object === path1.node\n )\n && binding?.scope === functionScope\n ) {\n watchArgs.add(path1.node);\n }\n },\n }, parentScope, node);\n }\n }\n\n expression.arguments.forEach((argNode, index) => {\n if (watchHooks.includes(hookName) && index === 0 && argNode.type === 'Identifier') {\n const _node = nodeCollection.getNode(argNode.name);\n if (_node?.info?.used) {\n _node?.info?.used?.add(hookName);\n }\n else if (_node) {\n _node.info = {\n ..._node?.info,\n used: new Set([hookName]),\n };\n }\n return;\n }\n if (argNode.type === 'Identifier') {\n const binding = parentScope.getBinding(argNode.name);\n if (binding && graph.nodes.has(argNode.name) && binding.scope === functionScope) {\n const _node = nodeCollection.getNode(argNode.name);\n if (_node?.info?.used) {\n _node?.info?.used?.add(hookName);\n }\n else if (_node) {\n _node.info = {\n ..._node?.info,\n used: new Set([hookName]),\n };\n }\n }\n }\n else {\n traverse(argNode, {\n Identifier(path1) {\n const binding = path1.scope.getBinding(path1.node.name);\n if (\n graph.nodes.has(path1.node.name)\n && (\n (path1.parent.type !== 'MemberExpression'\n && path1.parent.type !== 'OptionalMemberExpression')\n || path1.parent.object === path1.node\n )\n && binding?.scope === functionScope\n ) {\n if ([...watchHooks].includes(hookName) && watchArgs.size > 0) {\n const watchArgsNames = Array.from(watchArgs).map(arg => arg.name);\n watchArgs.forEach((watchArg) => {\n if (!watchArgsNames.includes(path1.node.name)) {\n graph.edges.get(watchArg.name)?.add({\n label: path1.node.name,\n type: getRelationType(path1),\n });\n }\n });\n }\n const _node = nodeCollection.getNode(path1.node.name);\n if (_node?.info?.used) {\n _node?.info?.used?.add(hookName);\n }\n else if (_node) {\n _node.info = {\n ..._node?.info,\n used: new Set([hookName]),\n };\n }\n }\n },\n }, parentScope, node);\n }\n });\n }\n }\n\n // Second pass: collect edges (dependencies between nodes)\n traverse(bodyNode, {\n FunctionDeclaration(path) {\n const name = path.node.id?.name;\n if (name && graph.nodes.has(name) && path.scope.getBinding(name)?.scope === functionScope) {\n traverse(path.node.body, {\n Identifier(path1) {\n const binding = path1.scope.getBinding(path1.node.name);\n if (\n graph.nodes.has(path1.node.name)\n && (\n (path1.parent.type !== 'MemberExpression'\n && path1.parent.type !== 'OptionalMemberExpression')\n || path1.parent.object === path1.node\n )\n && binding?.scope === functionScope\n ) {\n graph.edges.get(name)?.add({\n label: path1.node.name,\n type: getRelationType(path1),\n });\n }\n },\n }, path.scope, path);\n }\n },\n\n VariableDeclarator(path) {\n if (path.node.init) {\n if (path.node.id.type === 'Identifier') {\n const name = path.node.id.name;\n if (name && graph.nodes.has(name) && path.scope.getBinding(name)?.scope === functionScope) {\n if (path.node.init.type === 'CallExpression' && path.node.init.callee.type === 'Identifier' && allEffectHooks.includes(path.node.init.callee.name)) {\n traverseHooks(path.node.init, path.scope);\n }\n traverse(path.node.init, {\n Identifier(path1) {\n const binding = path1.scope.getBinding(path1.node.name);\n if (\n graph.nodes.has(path1.node.name)\n && (\n (path1.parent.type !== 'MemberExpression'\n && path1.parent.type !== 'OptionalMemberExpression')\n || path1.parent.object === path1.node\n )\n && binding?.scope === functionScope\n ) {\n graph.edges.get(name)?.add({\n label: path1.node.name,\n type: getRelationType(path1),\n });\n }\n },\n }, path.scope, path);\n }\n }\n else if (path.node.id.type === 'ObjectPattern') {\n path.node.id.properties.forEach((property) => {\n if (property.type === 'ObjectProperty' && property.value.type === 'Identifier') {\n const name = property.value.name;\n const isValidNode = name && graph.nodes.has(name) && path.node.init\n && path.scope.getBinding(name)?.scope === functionScope;\n if (isValidNode) {\n traverse(path.node.init!, {\n Identifier(path1) {\n const binding = path1.scope.getBinding(path1.node.name);\n if (\n graph.nodes.has(path1.node.name)\n && (\n (path1.parent.type !== 'MemberExpression'\n && path1.parent.type !== 'OptionalMemberExpression')\n || path1.parent.object === path1.node\n )\n && binding?.scope === functionScope\n ) {\n graph.edges.get(name)?.add({\n label: path1.node.name,\n type: getRelationType(path1),\n });\n }\n },\n }, path.scope, path);\n }\n }\n });\n }\n else if (path.node.id.type === 'ArrayPattern') {\n path.node.id.elements.forEach((element) => {\n if (element?.type === 'Identifier') {\n const name = element.name;\n const isValidNode = name && graph.nodes.has(name) && path.node.init\n && path.scope.getBinding(name)?.scope === functionScope;\n if (isValidNode) {\n traverse(path.node.init!, {\n Identifier(path1) {\n const binding = path1.scope.getBinding(path1.node.name);\n if (\n graph.nodes.has(path1.node.name)\n && (\n (path1.parent.type !== 'MemberExpression'\n && path1.parent.type !== 'OptionalMemberExpression')\n || path1.parent.object === path1.node\n )\n && binding?.scope === functionScope\n ) {\n graph.edges.get(name)?.add({\n label: path1.node.name,\n type: getRelationType(path1),\n });\n }\n },\n }, path.scope, path);\n }\n }\n });\n }\n }\n },\n\n ObjectMethod(path) {\n if (path.node.key.type === 'Identifier' && graph.nodes.has(path.node.key.name)) {\n const name = path.node.key.name;\n traverse(path.node.body, {\n Identifier(path1) {\n const binding = path1.scope.getBinding(path1.node.name);\n if (\n graph.nodes.has(path1.node.name)\n && (\n (path1.parent.type !== 'MemberExpression'\n && path1.parent.type !== 'OptionalMemberExpression')\n || path1.parent.object === path1.node\n )\n && binding?.scope === functionScope\n ) {\n graph.edges.get(name)?.add({\n label: path1.node.name,\n type: getRelationType(path1),\n });\n }\n },\n }, path.scope, path);\n }\n },\n\n ObjectProperty(path) {\n if (path.node.key.type === 'Identifier' && graph.nodes.has(path.node.key.name)) {\n const name = path.node.key.name;\n traverse(path.node.value, {\n Identifier(path1) {\n if (path1.node.name === name) {\n return;\n }\n const binding = path1.scope.getBinding(path1.node.name);\n if (\n graph.nodes.has(path1.node.name)\n && (\n (path1.parent.type !== 'MemberExpression'\n && path1.parent.type !== 'OptionalMemberExpression')\n || path1.parent.object === path1.node\n )\n && binding?.scope === functionScope\n ) {\n graph.edges.get(name)?.add({\n label: path1.node.name,\n type: getRelationType(path1),\n });\n }\n },\n }, path.scope, path);\n }\n },\n\n ExpressionStatement(path) {\n if (path.node.expression.type === 'CallExpression'\n && path.node.expression.callee.type === 'Identifier'\n ) {\n const name = path.node.expression.callee.name;\n if (graph.nodes.has(name) && path.scope.getBinding(name)?.scope === functionScope) {\n const _node = nodeCollection.getNode(name);\n if (_node?.info?.used) {\n _node?.info?.used?.add('Call Expression');\n }\n else if (_node) {\n _node.info = {\n ..._node?.info,\n used: new Set(['Call Expression']),\n };\n }\n }\n else {\n traverseHooks(path.node.expression, path.scope);\n }\n }\n if (path.node.expression.type === 'AssignmentExpression'\n && path.node.expression.right.type === 'CallExpression'\n && path.node.expression.right.callee.type === 'Identifier'\n ) {\n traverseHooks(path.node.expression.right, path.scope);\n }\n },\n }, functionScope, functionPath);\n\n // Third pass: collect return statement nodes (public API)\n traverse(bodyNode, {\n ReturnStatement(path) {\n // Skip ReturnStatements inside nested functions\n const fnParent = path.findParent(p => p.isFunction());\n if (fnParent && fnParent.node !== functionNode) {\n return;\n }\n\n if (path.node.argument?.type === 'ObjectExpression') {\n const returnNode = path.node.argument;\n traverse(returnNode, {\n ObjectProperty(path3) {\n if (path3.parent === returnNode) {\n if (path3.node.key.type === 'Identifier' && path3.node.value.type === 'Identifier') {\n nodesUsedInReturn.add(path3.node.value.name);\n }\n }\n },\n SpreadElement(path3) {\n if (path3.node.argument.type === 'Identifier') {\n nodesUsedInReturn.add(path3.node.argument.name);\n }\n },\n }, path.scope, path);\n }\n else if (path.node.argument?.type === 'ArrayExpression') {\n path.node.argument.elements.forEach((element) => {\n if (element?.type === 'Identifier') {\n nodesUsedInReturn.add(element.name);\n }\n });\n }\n else if (path.node.argument?.type === 'Identifier') {\n nodesUsedInReturn.add(path.node.argument.name);\n }\n },\n }, functionScope, functionPath);\n\n return { graph, nodeCollection, nodesUsedInReturn, hookName };\n}\n\nexport function analyzeHook(\n content: string,\n lineOffset = 0,\n framework: 'vue' | 'react' = 'vue',\n) {\n const ast = babelParse(content, { sourceType: 'module', plugins: [\n 'typescript',\n 'jsx',\n ] });\n\n const results: HookAnalysisResult[] = [];\n\n function walkCallExpressionChain(\n node: t.Expression,\n path: NodePath<t.VariableDeclarator>,\n pathSegments: (string | number)[],\n ): NodePath<t.ArrowFunctionExpression | t.FunctionExpression> | undefined {\n if (node.type === 'ArrowFunctionExpression' || node.type === 'FunctionExpression') {\n try {\n return path.get(pathSegments.join('.')) as any;\n }\n catch {\n return undefined;\n }\n }\n if (node.type === 'CallExpression') {\n for (let i = 0; i < node.arguments.length; i++) {\n const arg = node.arguments[i];\n if (arg.type === 'ArrowFunctionExpression' || arg.type === 'FunctionExpression') {\n try {\n return path.get([...pathSegments, 'arguments', i].join('.')) as any;\n }\n catch {\n }\n }\n else if (arg.type === 'CallExpression') {\n const result = walkCallExpressionChain(arg, path, [...pathSegments, 'arguments', i]);\n if (result) {\n return result;\n }\n }\n }\n }\n return undefined;\n }\n\n function extractHookFromDeclarator(decl: t.VariableDeclarator, varPath: NodePath<t.VariableDeclarator>) {\n const init = decl.init;\n const hookName = decl.id.type === 'Identifier'\n ? decl.id.name\n : '';\n if (!init) {\n return;\n }\n\n const funcPath = walkCallExpressionChain(init, varPath, ['init']);\n if (funcPath) {\n results.push(processHookFunction(funcPath, lineOffset, hookName, framework));\n }\n }\n\n traverse(ast, {\n ExportDefaultDeclaration(path) {\n const declaration = path.node.declaration;\n if (declaration.type === 'FunctionDeclaration' && declaration.id?.name.startsWith('use')) {\n const funcPath = path.get('declaration') as NodePath<t.FunctionDeclaration>;\n results.push(processHookFunction(funcPath, lineOffset, '', framework));\n }\n },\n ExportNamedDeclaration(path) {\n const declaration = path.node.declaration;\n if (declaration?.type === 'FunctionDeclaration' && declaration.id?.name.startsWith('use')) {\n const funcPath = path.get('declaration') as NodePath<t.FunctionDeclaration>;\n results.push(processHookFunction(funcPath, lineOffset, '', framework));\n }\n else if (declaration?.type === 'VariableDeclaration') {\n declaration.declarations.forEach((decl) => {\n if (decl.id.type === 'Identifier' && decl.id.name.startsWith('use')) {\n const varPath = path.get('declaration.declarations').find((p) => {\n const node = p.node as t.VariableDeclarator;\n const nodeId = node.id as t.Identifier;\n return nodeId.type === 'Identifier' && nodeId.name === (decl.id as t.Identifier).name;\n }) as NodePath<t.VariableDeclarator> | undefined;\n if (varPath) {\n extractHookFromDeclarator(decl, varPath);\n }\n }\n });\n }\n },\n FunctionDeclaration(path) {\n if (path.node.id?.name.startsWith('use') && path.parent.type === 'Program') {\n results.push(processHookFunction(path, lineOffset, '', framework));\n }\n },\n VariableDeclaration(path) {\n if (path.parent.type === 'Program') {\n path.node.declarations.forEach((decl) => {\n if (decl.id.type === 'Identifier' && decl.id.name.startsWith('use')) {\n const declName = (decl.id as t.Identifier).name;\n const varPath = path.get('declarations').find((p) => {\n const node = p.node as t.VariableDeclarator;\n const nodeId = node.id as t.Identifier;\n return nodeId.type === 'Identifier' && nodeId.name === declName;\n }) as NodePath<t.VariableDeclarator> | undefined;\n if (varPath) {\n extractHookFromDeclarator(decl, varPath);\n }\n }\n });\n }\n },\n });\n\n return results.map(result => ({\n graph: result.nodeCollection.map(result.graph),\n nodesUsedInReturn: result.nodesUsedInReturn,\n hookName: result.hookName,\n }));\n}\n","import type { NodePath, Scope, VisitNode } from '@babel/traverse';\nimport type * as t from '@babel/types';\nimport type { RelationType } from './utils';\nimport _traverse from '@babel/traverse';\nimport { babelParse } from '@vue/compiler-sfc';\nimport { getComment, getRelationType, NodeCollection, NodeType } from './utils';\n\nconst traverse: typeof _traverse\n // @ts-expect-error unwarp default\n = _traverse.default?.default || _traverse.default || _traverse;\n\nconst ignoreFunctionsName = ['defineProps', 'defineEmits', 'withDefaults'];\n\nexport const watchHooks = [\n 'watch',\n\n // from `@vueuse/core`\n 'watchArray',\n 'watchAtMost',\n 'watchDebounced',\n 'watchDeep',\n 'watchIgnorable',\n 'watchImmediate',\n 'watchOnce',\n 'watchPausable',\n 'watchThrottled',\n 'watchTriggerable',\n 'watchWithFilter',\n];\n\nexport function processSetup(\n ast: t.Node,\n parentScope?: Scope,\n parentPath?: t.Node,\n _spread?: string[],\n _lineOffset = 0,\n) {\n const spread = _spread || [];\n\n const nodeCollection = new NodeCollection(_lineOffset);\n\n const graph = {\n nodes: new Set<string>(),\n edges: new Map<string, Set<{ label: string, type: RelationType }>>(),\n spread: new Map<string, Set<string>>(),\n };\n\n traverse(ast, {\n VariableDeclaration(path) {\n path.node.declarations.forEach((declaration) => {\n if (declaration.id.type === 'ArrayPattern') {\n declaration.id.elements.forEach((element) => {\n if (element?.type === 'Identifier') {\n const name = element.name;\n const binding = path.scope.getBinding(name);\n\n if (\n binding\n && (path.parent.type === 'Program'\n || (parentPath?.type === 'ObjectMethod' && parentPath.body === path.parent)\n )\n && !(declaration.init?.type === 'CallExpression'\n && declaration.init?.callee.type === 'Identifier'\n && ignoreFunctionsName.includes(declaration.init?.callee.name)\n )\n ) {\n graph.nodes.add(name);\n nodeCollection.addNode(name, element, {\n comment: getComment(path.node),\n });\n if (!graph.edges.get(name)) {\n graph.edges.set(name, new Set());\n }\n }\n }\n if (element?.type === 'RestElement' && element.argument.type === 'Identifier') {\n const name = element.argument.name;\n const binding = path.scope.getBinding(name);\n\n if (\n binding\n && (path.parent.type === 'Program'\n || (parentPath?.type === 'ObjectMethod' && parentPath.body === path.parent)\n )\n && !(declaration.init?.type === 'CallExpression'\n && declaration.init?.callee.type === 'Identifier'\n && ignoreFunctionsName.includes(declaration.init?.callee.name)\n )\n ) {\n graph.nodes.add(name);\n nodeCollection.addNode(name, element.argument, {\n comment: getComment(path.node),\n });\n if (!graph.edges.get(name)) {\n graph.edges.set(name, new Set());\n }\n }\n }\n });\n }\n if (declaration.id.type === 'ObjectPattern') {\n declaration.id.properties.forEach((property) => {\n if (property.type === 'ObjectProperty' && property.value.type === 'Identifier') {\n const name = property.value.name;\n const binding = path.scope.getBinding(name);\n if (\n binding\n && (path.parent.type === 'Program'\n || (parentPath?.type === 'ObjectMethod' && parentPath.body === path.parent)\n )\n && !(declaration.init?.type === 'CallExpression'\n && declaration.init?.callee.type === 'Identifier'\n && ignoreFunctionsName.includes(declaration.init?.callee.name)\n )\n ) {\n graph.nodes.add(name);\n nodeCollection.addNode(name, property.value, {\n comment: getComment(property),\n });\n if (!graph.edges.get(name)) {\n graph.edges.set(name, new Set());\n }\n }\n }\n\n if (property.type === 'RestElement' && property.argument.type === 'Identifier') {\n const name = property.argument.name;\n const binding = path.scope.getBinding(name);\n if (\n binding\n && (path.parent.type === 'Program'\n || (parentPath?.type === 'ObjectMethod' && parentPath.body === path.parent)\n )\n && !(declaration.init?.type === 'CallExpression'\n && declaration.init?.callee.type === 'Identifier'\n && ignoreFunctionsName.includes(declaration.init?.callee.name)\n )\n ) {\n graph.nodes.add(name);\n nodeCollection.addNode(name, property.argument, {\n comment: getComment(property),\n });\n if (!graph.edges.get(name)) {\n graph.edges.set(name, new Set());\n }\n }\n }\n });\n }\n if (declaration.id?.type === 'Identifier') {\n const name = declaration.id.name;\n const binding = path.scope.getBinding(name);\n if (\n binding\n && (path.parent.type === 'Program'\n || (parentPath?.type === 'ObjectMethod' && parentPath.body === path.parent)\n )\n && !(declaration.init?.type === 'CallExpression'\n && declaration.init?.callee.type === 'Identifier'\n && ignoreFunctionsName.includes(declaration.init?.callee.name)\n )\n ) {\n graph.nodes.add(name);\n nodeCollection.addNode(name, declaration, {\n comment: getComment(path.node),\n });\n if (!graph.edges.get(name)) {\n graph.edges.set(name, new Set());\n }\n\n if (spread.includes(name)) {\n if (declaration.init?.type === 'ObjectExpression') {\n declaration.init?.properties.forEach((prop) => {\n if (\n (prop.type === 'ObjectProperty' || prop.type === 'ObjectMethod')\n && prop.key.type === 'Identifier'\n ) {\n const keyName = prop.key.name;\n graph.nodes.add(keyName);\n nodeCollection.addNode(keyName, prop, {\n comment: getComment(prop),\n });\n if (!graph.edges.get(keyName)) {\n graph.edges.set(keyName, new Set());\n }\n if (graph.spread.has(name)) {\n graph.spread.get(name)?.add(keyName);\n }\n else {\n graph.spread.set(name, new Set([keyName]));\n }\n }\n else if (prop.type === 'SpreadElement') {\n console.warn('not support spread in spread');\n }\n });\n }\n if (\n declaration.init?.type === 'CallExpression'\n && declaration.init?.callee.type === 'Identifier'\n && declaration.init?.callee.name === 'reactive'\n ) {\n const arg = declaration.init?.arguments[0];\n if (arg.type === 'ObjectExpression') {\n arg.properties.forEach((prop) => {\n if (\n (prop.type === 'ObjectProperty' || prop.type === 'ObjectMethod')\n && prop.key.type === 'Identifier'\n ) {\n const keyName = prop.key.name;\n graph.nodes.add(keyName);\n nodeCollection.addNode(keyName, prop, {\n comment: getComment(prop),\n });\n if (!graph.edges.get(keyName)) {\n graph.edges.set(keyName, new Set());\n }\n if (graph.spread.has(name)) {\n graph.spread.get(name)?.add(keyName);\n }\n else {\n graph.spread.set(name, new Set([keyName]));\n }\n }\n else if (prop.type === 'SpreadElement') {\n console.warn('not support spread in spread');\n }\n });\n }\n }\n }\n }\n }\n });\n },\n FunctionDeclaration(path) {\n const name = path.node.id?.name;\n if (name) {\n const binding = path.scope.getBinding(name);\n if (binding && (path.parent.type === 'Program'\n || (parentPath?.type === 'ObjectMethod' && parentPath.body === path.parent)\n )) {\n graph.nodes.add(name);\n nodeCollection.addNode(name, path.node.id!, {\n isMethod: true,\n comment: getComment(path.node),\n });\n if (!graph.edges.get(name)) {\n graph.edges.set(name, new Set());\n }\n }\n }\n },\n }, parentScope, parentPath);\n\n function traverseHooks(node: t.ExpressionStatement | t.CallExpression, patentScope: Scope) {\n if (\n (\n node.type === 'ExpressionStatement'\n && node.expression.type === 'CallExpression'\n && node.expression.callee.type === 'Identifier'\n ) || (\n node.type === 'CallExpression'\n && node.callee.type === 'Identifier'\n )\n ) {\n const hookName = (() => {\n if (node.type === 'ExpressionStatement'\n && node.expression.type === 'CallExpression'\n && node.expression.callee.type === 'Identifier') {\n return node.expression.callee.name;\n }\n if (node.type === 'CallExpression'\n && node.callee.type === 'Identifier') {\n return node.callee.name;\n }\n })() || '';\n\n if (!hookName) {\n return;\n }\n\n const hookBinding = patentScope.getBinding(hookName);\n if (!(hookBinding === undefined || hookBinding?.scope.block.type === 'Program'\n || parentScope === hookBinding?.scope)) {\n return;\n }\n\n const expression = (node.type === 'ExpressionStatement'\n ? node.expression\n : node) as t.CallExpression;\n\n const watchArgs = new Set<t.Identifier>();\n\n if (hookName === 'provide') {\n traverse(expression, {\n Identifier(path1) {\n const binding = path1.scope.getBinding(path1.node.name);\n if (\n graph.nodes.has(path1.node.name)\n && (\n (path1.parent.type !== 'MemberExpression'\n && path1.parent.type !== 'OptionalMemberExpression')\n || path1.parent.object === path1.node\n )\n && (binding?.scope.block.type === 'Program'\n || parentScope === binding?.scope)\n ) {\n const _node = nodeCollection.getNode(path1.node.name);\n if (_node?.info?.used) {\n _node?.info?.used?.add(hookName);\n }\n else if (_node) {\n _node.info = {\n ..._node?.info,\n used: new Set([hookName]),\n };\n }\n }\n },\n }, patentScope, node);\n }\n else if (watchHooks.includes(hookName)) {\n if (expression.arguments[0].type === 'Identifier') {\n const binding = patentScope.getBinding(expression.arguments[0].name);\n if (\n graph.nodes.has(expression.arguments[0].name)\n && (binding?.scope.block.type === 'Program'\n || parentScope === binding?.scope)\n ) {\n watchArgs.add(expression.arguments[0]);\n }\n }\n else {\n traverse(expression.arguments[0], {\n Identifier(path1) {\n const binding = path1.scope.getBinding(path1.node.name);\n if (\n graph.nodes.has(path1.node.name)\n && (\n (path1.parent.type !== 'MemberExpression'\n && path1.parent.type !== 'OptionalMemberExpression')\n || path1.parent.object === path1.node\n )\n && (binding?.scope.block.type === 'Program'\n || parentScope === binding?.scope)\n ) {\n watchArgs.add(path1.node);\n }\n },\n }, patentScope, node);\n }\n }\n else if (hookName === 'useEffect' && expression.arguments[1].type === 'ArrayExpression') {\n traverse(expression.arguments[1], {\n Identifier(path1) {\n const binding = path1.scope.getBinding(path1.node.name);\n if (\n graph.nodes.has(path1.node.name)\n && (\n (path1.parent.type !== 'MemberExpression'\n && path1.parent.type !== 'OptionalMemberExpression')\n || path1.parent.object === path1.node\n )\n && (binding?.scope.block.type === 'Program'\n || parentScope === binding?.scope)\n ) {\n watchArgs.add(path1.node);\n }\n },\n }, patentScope, node);\n }\n expression.arguments.forEach((argNode, index) => {\n if (watchHooks.includes(hookName) && index === 0 && argNode.type === 'Identifier') {\n const _node = nodeCollection.getNode(argNode.name);\n if (_node?.info?.used) {\n _node?.info?.used?.add(hookName);\n }\n else if (_node) {\n _node.info = {\n ..._node?.info,\n used: new Set([hookName]),\n };\n }\n return;\n }\n if (argNode.type === 'Identifier') {\n const binding = patentScope.getBinding(argNode.name);\n if (\n graph.nodes.has(argNode.name)\n && (binding?.scope.block.type === 'Program'\n || parentScope === binding?.scope)\n ) {\n const _node = nodeCollection.getNode(argNode.name);\n if (_node?.info?.used) {\n _node?.info?.used?.add(hookName);\n }\n else if (_node) {\n _node.info = {\n ..._node?.info,\n used: new Set([hookName]),\n };\n }\n }\n }\n else {\n traverse(argNode, {\n Identifier(path1) {\n const binding = path1.scope.getBinding(path1.node.name);\n if (\n graph.nodes.has(path1.node.name)\n && (\n (path1.parent.type !== 'MemberExpression'\n && path1.parent.type !== 'OptionalMemberExpression')\n || path1.parent.object === path1.node\n )\n && (binding?.scope.block.type === 'Program'\n || parentScope === binding?.scope)\n ) {\n if ([...watchHooks, 'useEffect'].includes(hookName) && watchArgs.size > 0) {\n const watchArgsNames = Array.from(watchArgs).map(arg => arg.name);\n watchArgs.forEach((watchArg) => {\n if (!watchArgsNames.includes(path1.node.name)) {\n graph.edges.get(watchArg.name)?.add({\n label: path1.node.name,\n type: getRelationType(path1),\n });\n }\n });\n }\n const _node = nodeCollection.getNode(path1.node.name);\n if (_node?.info?.used) {\n _node?.info?.used?.add(hookName);\n }\n else if (_node) {\n _node.info = {\n ..._node?.info,\n used: new Set([hookName]),\n };\n }\n }\n },\n }, patentScope, node);\n }\n });\n }\n }\n\n // get the relation between the variable and the function\n traverse(ast, {\n FunctionDeclaration(path) {\n const name = path.node.id?.name;\n if (name && graph.nodes.has(name)) {\n traverse(path.node.body, {\n Identifier(path1) {\n const binding = path1.scope.getBinding(path1.node.name);\n if (\n graph.nodes.has(path1.node.name)\n && (\n (path1.parent.type !== 'MemberExpression'\n && path1.parent.type !== 'OptionalMemberExpression')\n || path1.parent.object === path1.node\n )\n && (binding?.scope.block.type === 'Program'\n || (parentScope === binding?.scope)\n )\n ) {\n graph.edges.get(name)?.add({\n label: path1.node.name,\n type: getRelationType(path1),\n });\n }\n },\n MemberExpression(path1) {\n if (\n path1.node.object.type === 'Identifier'\n && spread.includes(path1.node.object.name)\n ) {\n const binding = path1.scope.getBinding(path1.node.object.name);\n if (\n spread.includes(path1.node.object.name)\n && path1.node.property.type === 'Identifier'\n && (binding?.scope.block.type === 'Program'\n || (parentScope === binding?.scope)\n )\n ) {\n graph.edges.get(name)?.add({\n label: path1.node.property.name,\n type: getRelationType(path1),\n });\n }\n }\n },\n }, path.scope, path);\n }\n },\n\n VariableDeclarator(path) {\n if (path.node.init) {\n if (path.node.id.type === 'ArrayPattern') {\n path.node.id.elements.forEach((element) => {\n if (element?.type === 'Identifier') {\n const name = element.name;\n if (name && graph.nodes.has(name) && path.node.init?.type === 'CallExpression') {\n traverse(path.node.init, {\n Identifier(path1) {\n const binding = path1.scope.getBinding(path1.node.name);\n if (\n graph.nodes.has(path1.node.name)\n && (\n (path1.parent.type !== 'MemberExpression'\n && path1.parent.type !== 'OptionalMemberExpression')\n || path1.parent.object === path1.node\n )\n && (binding?.scope.block.type === 'Program'\n || (parentScope === binding?.scope)\n )\n ) {\n graph.edges.get(name)?.add({\n label: path1.node.name,\n type: getRelationType(path1),\n });\n }\n },\n MemberExpression(path1) {\n if (\n path1.node.object.type === 'Identifier'\n && spread.includes(path1.node.object.name)\n ) {\n const binding = path1.scope.getBinding(path1.node.object.name);\n if (\n spread.includes(path1.node.object.name)\n && path1.node.property.type === 'Identifier'\n && (binding?.scope.block.type === 'Program'\n || (parentScope === binding?.scope)\n )\n ) {\n graph.edges.get(name)?.add({\n label: path1.node.property.name,\n type: getRelationType(path1),\n });\n }\n }\n },\n }, path.scope, path);\n }\n }\n });\n }\n else if (path.node.id.type === 'ObjectPattern') {\n path.node.id.properties.forEach((property) => {\n if (property.type === 'ObjectProperty' && property.value.type === 'Identifier') {\n const name = property.value.name;\n if (name && graph.nodes.has(name) && path.node.init) {\n traverse(path.node.init, {\n Identifier(path1) {\n const binding = path1.scope.getBinding(path1.node.name);\n if (\n graph.nodes.has(path1.node.name)\n && (\n (path1.parent.type !== 'MemberExpression'\n && path1.parent.type !== 'OptionalMemberExpression')\n || path1.parent.object === path1.node\n )\n && (binding?.scope.block.type === 'Program'\n || (parentScope === binding?.scope)\n )\n ) {\n graph.edges.get(name)?.add({\n label: path1.node.name,\n type: getRelationType(path1),\n });\n }\n },\n MemberExpression(path1) {\n if (\n path1.node.object.type === 'Identifier'\n && spread.includes(path1.node.object.name)\n ) {\n const binding = path1.scope.getBinding(path1.node.object.name);\n if (\n spread.includes(path1.node.object.name)\n && path1.node.property.type === 'Identifier'\n && (binding?.scope.block.type === 'Program'\n || (parentScope === binding?.scope)\n )\n ) {\n graph.edges.get(name)?.add({\n label: path1.node.property.name,\n type: getRelationType(path1),\n });\n }\n }\n },\n }, path.scope, path);\n }\n }\n });\n }\n else if ([\n 'CallExpression',\n 'ArrowFunctionExpression',\n 'FunctionDeclaration',\n ].includes(path.node.init.type)\n && path.node.id.type === 'Identifier'\n ) {\n if (path.node.init.type === 'CallExpression' && path.node.init.callee.type === 'Identifier' && [...watchHooks, 'watchEffect'].includes(path.node.init.callee.name)) {\n traverseHooks(path.node.init, path.scope);\n }\n const name = path.node.id?.name;\n if (name && graph.nodes.has(name)) {\n traverse(path.node.init, {\n Identifier(path1) {\n const binding = path1.scope.getBinding(path1.node.name);\n if (\n graph.nodes.has(path1.node.name)\n && (\n (path1.parent.type !== 'MemberExpression'\n && path1.parent.type !== 'OptionalMemberExpression')\n || path1.parent.object === path1.node\n )\n && (binding?.scope.block.type === 'Program'\n || (parentScope === binding?.scope)\n )\n ) {\n graph.edges.get(name)?.add({\n label: path1.node.name,\n type: getRelationType(path1),\n });\n }\n },\n MemberExpression(path1) {\n if (\n path1.node.object.type === 'Identifier'\n && spread.includes(path1.node.object.name)\n ) {\n const binding = path1.scope.getBinding(path1.node.object.name);\n if (\n spread.includes(path1.node.object.name)\n && path1.node.property.type === 'Identifier'\n && (binding?.scope.block.type === 'Program'\n || (parentScope === binding?.scope)\n )\n ) {\n graph.edges.get(name)?.add({\n label: path1.node.property.name,\n type: getRelationType(path1),\n });\n }\n }\n },\n }, path.scope, path);\n }\n }\n else if (path.node.id.type === 'Identifier') {\n const name = path.node.id.name;\n if (path.node.init.type === 'Identifier') {\n const binding = path.scope.getBinding(path.node.init.name);\n if (\n graph.nodes.has(path.node.init.name)\n && (binding?.scope.block.type === 'Program'\n || (parentScope === binding?.scope)\n )\n ) {\n graph.edges.get(name)?.add({\n label: path.node.init.name,\n type: getRelationType(path),\n });\n }\n }\n else {\n traverse(path.node.init, {\n Identifier(path1) {\n const binding = path1.scope.getBinding(path1.node.name);\n if (\n graph.nodes.has(path1.node.name)\n && (\n (path1.parent.type !== 'MemberExpression'\n && path1.parent.type !== 'OptionalMemberExpression')\n || path1.parent.object === path1.node\n )\n && (binding?.scope.block.type === 'Program'\n || (parentScope === binding?.scope)\n )\n ) {\n graph.edges.get(name)?.add({\n label: path1.node.name,\n type: getRelationType(path1),\n });\n }\n },\n }, path.scope, path);\n }\n }\n }\n },\n\n ObjectMethod(path) {\n if (path.node.key.type === 'Identifier' && graph.nodes.has(path.node.key.name)) {\n const name = path.node.key.name;\n\n traverse(path.node.body, {\n Identifier(path1) {\n const binding = path1.scope.getBinding(path1.node.name);\n if (\n graph.nodes.has(path1.node.name)\n && (\n (path1.parent.type !== 'MemberExpression'\n && path1.parent.type !== 'OptionalMemberExpression')\n || path1.parent.object === path1.node\n )\n && (binding?.scope.block.type === 'Program'\n || (parentScope === binding?.scope)\n )\n ) {\n graph.edges.get(name)?.add({\n label: path1.node.name,\n type: getRelationType(path1),\n });\n }\n },\n MemberExpression(path1) {\n if (\n path1.node.object.type === 'Identifier'\n && spread.includes(path1.node.object.name)\n ) {\n const binding = path1.scope.getBinding(path1.node.object.name);\n if (\n spread.includes(path1.node.object.name)\n && path1.node.property.type === 'Identifier'\n && (binding?.scope.block.type === 'Program'\n || (parentScope === binding?.scope)\n )\n ) {\n graph.edges.get(name)?.add({\n label: path1.node.property.name,\n type: getRelationType(path1),\n });\n }\n }\n },\n }, path.scope, path);\n }\n },\n\n ObjectProperty(path) {\n if (path.node.key.type === 'Identifier' && graph.nodes.has(path.node.key.name)) {\n const name = path.node.key.name;\n\n traverse(path.node.value, {\n MemberExpression(path1) {\n if (\n path1.node.object.type === 'Identifier'\n && spread.includes(path1.node.object.name)\n ) {\n const binding = path1.scope.getBinding(path1.node.object.name);\n if (\n spread.includes(path1.node.object.name)\n && path1.node.property.type === 'Identifier'\n && (binding?.scope.block.type === 'Program'\n || (parentScope === binding?.scope)\n )\n ) {\n graph.edges.get(name)?.add({\n label: path1.node.property.name,\n type: getRelationType(path1),\n });\n }\n }\n },\n }, path.scope, path);\n }\n },\n ExpressionStatement(path) {\n if (path.type === 'ExpressionStatement'\n && path.node.expression.type === 'CallExpression'\n && path.node.expression.callee.type === 'Identifier'\n ) {\n const name = path.node.expression.callee.name;\n if (\n graph.nodes.has(name)\n && (path.scope.block.type === 'Program')\n ) {\n const _node = nodeCollection.getNode(name);\n if (_node?.info?.used) {\n _node?.info?.used?.add('Call Expression');\n }\n else if (_node) {\n _node.info = {\n ..._node?.info,\n used: new Set(['Call Expression']),\n };\n }\n }\n else {\n traverseHooks(path.node.expression, path.scope);\n }\n }\n if (path.type === 'ExpressionStatement'\n && path.node.expression.type === 'AssignmentExpression'\n && path.node.expression.right.type === 'CallExpression'\n && path.node.expression.right.callee.type === 'Identifier'\n ) {\n traverseHooks(path.node.expression.right, path.scope);\n }\n },\n }, parentScope, parentPath);\n\n return {\n graph,\n nodeCollection,\n };\n}\n\nexport function analyze(\n content: string,\n lineOffset = 0,\n jsx = false,\n) {\n // console.log(content);\n const ast = babelParse(content, { sourceType: 'module', plugins: [\n 'typescript',\n ...jsx\n ? ['jsx' as const]\n : [],\n ] });\n\n // ---\n const { graph, nodeCollection } = processSetup(ast, undefined, undefined, undefined, lineOffset);\n return nodeCollection.map(graph);\n}\n","import type { NodePath } from '@babel/traverse';\nimport type * as t from '@babel/types';\nimport type { RelationType } from './utils';\nimport _traverse from '@babel/traverse';\nimport { babelParse } from '@vue/compiler-sfc';\nimport { processSetup, watchHooks } from './setupScript';\nimport { getComment, getRelationType, NodeCollection } from './utils';\n\nconst traverse: typeof _traverse\n // @ts-expect-error unwarp default\n = _traverse.default?.default || _traverse.default || _traverse;\n\nconst vueLifeCycleHooks = [\n 'beforeCreate',\n 'created',\n 'beforeMount',\n 'mounted',\n 'beforeUpdate',\n 'updated',\n 'beforeDestroy',\n 'destroyed',\n 'activated',\n 'deactivated',\n 'errorCaptured',\n 'renderTracked',\n 'renderTriggered',\n 'provide',\n];\n\nexport function analyze(\n content: string,\n lineOffset = 0,\n jsx = false,\n) {\n // console.log({lineOffset});\n // console.log(content);\n const ast = babelParse(content, { sourceType: 'module', plugins: [\n 'typescript',\n ...jsx\n ? ['jsx' as const]\n : [],\n ] });\n\n // ---\n\n let nodeCollection = new NodeCollection(lineOffset);\n\n const tNodes = new Map<string, t.Identifier>();\n const graph = {\n nodes: new Set<string>(),\n edges: new Map<string, Set<{ label: string, type: RelationType }>>(),\n };\n\n /** used in render block or setup return */\n const nodesUsedInTemplate = new Set<string>();\n\n function process(node: t.ObjectExpression, path: NodePath<t.ExportDefaultDeclaration>) {\n traverse(node, {\n ObjectProperty(path1) {\n if (\n (\n path.node.declaration.type === 'ObjectExpression'\n && path1.parent === path.node.declaration\n ) || (\n path.node.declaration.type === 'CallExpression'\n && path1.parent === path.node.declaration.arguments[0]\n )\n ) {\n // data\n if (\n path1.node.key.type === 'Identifier'\n && path1.node.key.name === 'data'\n && (\n path1.node.value.type === 'ArrowFunctionExpression'\n || path1.node.value.type === 'FunctionExpression'\n )\n ) {\n const dataNode = path1.node.value;\n\n traverse(dataNode, {\n ReturnStatement(path2) {\n if (path2.parent === dataNode.body) {\n if (path2.node.argument?.type === 'ObjectExpression') {\n path2.node.argument.properties.forEach((prop) => {\n if (prop.type === 'ObjectProperty') {\n if (prop.key.type === 'Identifier') {\n const name = prop.key.name;\n graph.nodes.add(name);\n tNodes.set(name, prop.key);\n nodeCollection.addNode(name, prop, {\n comment: getComment(prop),\n });\n if (!graph.edges.get(name)) {\n graph.edges.set(name, new Set());\n }\n }\n }\n });\n }\n }\n },\n }, path1.scope, path1);\n }\n\n // computed\n if (path1.node.key.type === 'Identifier' && path1.node.key.name === 'computed') {\n const computedNode = path1.node;\n if (computedNode.value.type === 'ObjectExpression') {\n computedNode.value.properties.forEach((prop) => {\n if (prop.type === 'ObjectProperty' || prop.type === 'ObjectMethod') {\n if (prop.key.type === 'Identifier') {\n const name = prop.key.name;\n graph.nodes.add(name);\n tNodes.set(name, prop.key);\n nodeCollection.addNode(name, prop, {\n isComputed: true,\n comment: getComment(prop),\n });\n if (!graph.edges.get(name)) {\n graph.edges.set(name, new Set());\n }\n }\n }\n });\n }\n }\n\n // methods\n if (path1.node.key.type === 'Identifier' && path1.node.key.name === 'methods') {\n const methodsNode = path1.node;\n if (methodsNode.value.type === 'ObjectExpression') {\n methodsNode.value.properties.forEach((prop) => {\n if (prop.type === 'ObjectProperty' || prop.type === 'ObjectMethod') {\n if (prop.key.type === 'Identifier') {\n const name = prop.key.name;\n graph.nodes.add(name);\n tNodes.set(name, prop.key);\n nodeCollection.addNode(name, prop, {\n isMethod: true,\n comment: getComment(prop),\n });\n if (!graph.edges.get(name)) {\n graph.edges.set(name, new Set());\n }\n }\n }\n });\n }\n }\n\n if (\n path1.node.key.type === 'Identifier'\n && path1.node.key.name === 'render'\n && (\n path1.node.value.type === 'ArrowFunctionExpression'\n || path1.node.value.type === 'FunctionExpression'\n )\n ) {\n traverse(path1.node.value, {\n ReturnStatement(path2) {\n const templateNode = path2.node;\n traverse(templateNode, {\n MemberExpression(path3) {\n if (path3.node.object && path3.node.object.type === 'ThisExpression') {\n if (path3.node.property && path3.node.property.type === 'Identifier') {\n nodesUsedInTemplate.add(path3.node.property.name);\n }\n }\n },\n }, path2.scope, path2);\n },\n }, path1.scope, path1);\n }\n }\n },\n ObjectMethod(path1) {\n if (\n (\n path.node.declaration.type === 'ObjectExpression'\n && path1.parent === path.node.declaration\n ) || (\n path.node.declaration.type === 'CallExpression'\n && path1.parent === path.node.declaration.arguments[0]\n )\n ) {\n // setup\n if (path1.node.key.type === 'Identifier' && path1.node.key.name === 'setup') {\n const setupNode = path1.node;\n\n const spread: string[] = [];\n\n traverse(setupNode, {\n ReturnStatement(path2) {\n if (path2.node.argument?.type === 'ObjectExpression') {\n const returnNode = path2.node.argument;\n traverse(returnNode, {\n SpreadElement(path3) {\n // ...toRefs(xxx)\n if (\n path3.node.argument.type === 'CallExpression'\n && path3.node.argument.callee.type === 'Identifier'\n && path3.node.argument.callee.name === 'toRefs'\n && path3.node.argument.arguments[0].type === 'Identifier'\n ) {\n spread.push(path3.node.argument.arguments[0].name);\n }\n // ...xxx\n else if (\n path3.node.argument.type === 'Identifier'\n ) {\n spread.push(path3.node.argument.name);\n }\n },\n }, path2.scope, path2);\n }\n if (\n path2.node.argument?.type === 'FunctionExpression'\n || path2.node.argument?.type === 'ArrowFunctionExpression'\n ) {\n const templateNode = path2.node.argument.body;\n traverse(templateNode, {\n Identifier(path3) {\n const binding = path3.scope.getBinding(path3.node.name);\n if (binding?.scope === path1.scope) {\n nodesUsedInTemplate.add(path3.node.name);\n }\n },\n JSXIdentifier(path3) {\n const binding = path3.scope.getBinding(path3.node.name);\n if (binding?.scope === path1.scope) {\n nodesUsedInTemplate.add(path3.node.name);\n }\n },\n }, path2.scope, path2);\n }\n },\n }, path1.scope, path1);\n\n const {\n graph: {\n nodes: tempNodes,\n edges: tempEdges,\n spread: tempSpread,\n },\n nodeCollection: tempNodeCollection,\n } = processSetup(setupNode, path1.scope, setupNode, spread, lineOffset);\n\n // 3 filter data by return\n traverse(setupNode, {\n ReturnStatement(path2) {\n // only process return in setupNode scope\n if (path2.scope !== path1.scope) {\n return;\n }\n\n if (path2.node.argument?.type === 'ObjectExpression') {\n const returnNode = path2.node.argument;\n traverse(returnNode, {\n ObjectProperty(path3) {\n if (path3.parent === returnNode) {\n if (\n path3.node.key.type === 'Identifier'\n && path3.node.value.type === 'Identifier'\n && tempNodes.has(path3.node.value.name)\n ) {\n const valName = path3.node.value.name;\n if (!graph.nodes.has(valName)) {\n graph.nodes.add(valName);\n tNodes.set(valName, path3.node.value);\n nodeCollection.addTypedNode(\n valName,\n tempNodeCollection.nodes.get(valName)!,\n );\n }\n if (!graph.edges.has(valName)) {\n graph.edges.set(valName, new Set([...Array.from(\n tempEdges.get(valName) || new Set<{ label: string, type: RelationType }>(),\n )]));\n }\n\n const name = path3.node.key.name;\n if (name !== valName) {\n graph.nodes.add(name);\n tNodes.set(name, path3.node.key);\n nodeCollection.addNode(name, path3.node.key, {\n comment: getComment(path3.node),\n });\n graph.edges.set(name, new Set([{\n label: valName,\n type: getRelationType(path3),\n }]));\n }\n }\n }\n },\n SpreadElement(path3) {\n // ...toRefs(xxx)\n if (\n path3.node.argument.type === 'CallExpression'\n && path3.node.argument.callee.type === 'Identifier'\n && path3.node.argument.callee.name === 'toRefs'\n && path3.node.argument.arguments[0].type === 'Identifier'\n && tempSpread.get(path3.node.argument.arguments[0].name)\n ) {\n tempSpread.get(path3.node.argument.arguments[0].name)?.forEach((name) => {\n graph.nodes.add(name);\n // @ts-expect-error Identifier\n tNodes.set(name, path3.node.argument.arguments[0]);\n nodeCollection.addTypedNode(name, tempNodeCollection.nodes.get(name)!);\n if (!graph.edges.get(name)) {\n graph.edges.set(name, new Set());\n tempEdges.get(name)?.forEach((edge) => {\n graph.edges.get(name)?.add(edge);\n });\n }\n });\n }\n // ...xxx\n else if (\n path3.node.argument.type === 'Identifier'\n && tempSpread.get(path3.node.argument.name)\n ) {\n tempSpread.get(path3.node.argument.name)?.forEach((name) => {\n graph.nodes.add(name);\n // @ts-expect-error Identifier\n tNodes.set(name, path3.node.argument);\n nodeCollection.addTypedNode(name, tempNodeCollection.nodes.get(name)!);\n if (!graph.edges.get(name)) {\n graph.edges.set(name, new Set());\n tempEdges.get(name)?.forEach((edge) => {\n graph.edges.get(name)?.add(edge);\n });\n }\n });\n }\n },\n }, path2.scope, path2);\n }\n else {\n graph.edges = tempEdges;\n graph.nodes = tempNodes;\n nodeCollection = tempNodeCollection;\n }\n },\n }, path1.scope, path1);\n }\n\n // data\n if (path1.node.key.type === 'Identifier' && path1.node.key.name === 'data') {\n const dataNode = path1.node;\n\n traverse(dataNode, {\n ReturnStatement(path2) {\n if (path2.parent === dataNode.body) {\n if (path2.node.argument?.type === 'ObjectExpression') {\n path2.node.argument.properties.forEach((prop) => {\n if (prop.type === 'ObjectProperty') {\n if (prop.key.type === 'Identifier') {\n const name = prop.key.name;\n graph.nodes.add(name);\n tNodes.set(name, prop.key);\n nodeCollection.addNode(name, prop, {\n comment: getComment(prop),\n });\n if (!graph.edges.get(name)) {\n graph.edges.set(name, new Set());\n }\n }\n }\n });\n }\n }\n },\n }, path1.scope, path1);\n }\n\n // render\n if (path1.node.key.type === 'Identifier' && path1.node.key.name === 'render') {\n traverse(path1.node, {\n ReturnStatement(path2) {\n const templateNode = path2.node;\n traverse(templateNode, {\n MemberExpression(path3) {\n if (path3.node.object && path3.node.object.type === 'ThisExpression') {\n if (path3.node.property && path3.node.property.type === 'Identifier') {\n nodesUsedInTemplate.add(path3.node.property.name);\n }\n }\n },\n }, path2.scope, path2);\n },\n }, path1.scope, path1);\n }\n }\n },\n }, path.scope, path);\n\n traverse(node, {\n ObjectMethod(path1) {\n if (\n (\n path.node.declaration.type === 'ObjectExpression'\n && path1.parent === path.node.declaration\n ) || (\n path.node.declaration.type === 'CallExpression'\n && path1.parent === path.node.declaration.arguments[0]\n )\n ) {\n if (path1.node.key.type === 'Identifier' && vueLifeCycleHooks.includes(path1.node.key.name)) {\n const hookName = path1.node.key.name;\n\n traverse(path1.node.body, {\n MemberExpression(path2) {\n if (path2.node.object.type === 'ThisExpression' && path2.node.property.type === 'Identifier') {\n const _node = nodeCollection.getNode(path2.node.property.name);\n if (_node?.info?.used) {\n _node?.info?.used?.add(hookName);\n }\n else if (_node) {\n _node.info = {\n ..._node?.info,\n used: new Set([hookName]),\n };\n }\n }\n },\n }, path1.scope, path1);\n }\n }\n },\n ObjectProperty(path1) {\n if (\n (\n path.node.declaration.type === 'ObjectExpression'\n && path1.parent === path.node.declaration\n ) || (\n path.node.declaration.type === 'CallExpression'\n && path1.parent === path.node.declaration.arguments[0]\n )\n ) {\n if (path1.node.key.type === 'Identifier' && path1.node.key.name === 'computed') {\n const computedNode = path1.node;\n if (computedNode.value.type === 'ObjectExpression') {\n computedNode.value.properties.forEach((prop) => {\n if (prop.type === 'ObjectMethod' && prop.key.type === 'Identifier') {\n const name = prop.key.name;\n traverse(prop, {\n MemberExpression(path2) {\n if (path2.node.object.type === 'ThisExpression' && path2.node.property.type === 'Identifier') {\n graph.edges.get(name)?.add({\n label: path2.node.property.name,\n type: getRelationType(path2),\n });\n }\n },\n }, path1.scope, path1);\n }\n\n if (\n prop.type === 'ObjectProperty'\n && prop.key.type === 'Identifier'\n && prop.value.type === 'ObjectExpression'\n ) {\n const name = prop.key.name;\n prop.value.properties.forEach((prop1) => {\n if (\n prop1.type === 'ObjectProperty'\n && prop1.key.type === 'Identifier'\n && prop1.key.name === 'get'\n ) {\n traverse(prop1, {\n MemberExpression(path2) {\n if (\n path2.node.object.type === 'ThisExpression'\n && path2.node.property.type === 'Identifier'\n ) {\n graph.edges.get(name)?.add({\n label: path2.node.property.name,\n type: getRelationType(path2),\n });\n }\n },\n }, path1.scope, path1);\n }\n });\n }\n });\n }\n }\n\n if (path1.node.key.type === 'Identifier' && path1.node.key.name === 'methods') {\n const methodsNode = path1.node;\n if (methodsNode.value.type === 'ObjectExpression') {\n methodsNode.value.properties.forEach((prop) => {\n if (\n (prop.type === 'ObjectMethod'\n || prop.type === 'ObjectProperty')\n && prop.key.type === 'Identifier'\n ) {\n const name = prop.key.name;\n traverse(prop, {\n MemberExpression(path2) {\n if (path2.node.object.type === 'ThisExpression' && path2.node.property.type === 'Identifier') {\n graph.edges.get(name)?.add({\n label: path2.node.property.name,\n type: getRelationType(path2),\n });\n }\n },\n }, path1.scope, path1);\n }\n });\n }\n }\n\n if (path1.node.key.type === 'Identifier' && [...watchHooks, ...vueLifeCycleHooks].includes(path1.node.key.name)) {\n const hookName = path1.node.key.name;\n\n if (watchHooks.includes(hookName) && path1.node.value.type === 'ObjectExpression') {\n path1.node.value.properties.forEach((prop) => {\n if ((prop.type === 'ObjectProperty' || prop.type === 'ObjectMethod') && (\n prop.key.type === 'Identifier' || prop.key.type === 'StringLiteral'\n )) {\n const keyName = prop.key.type === 'Identifier'\n ? prop.key.name\n : prop.key.type === 'StringLiteral'\n ? prop.key.value.split('.')[0]\n : '';\n const watchArg = tNodes.get(keyName);\n\n const _node = nodeCollection.getNode(keyName);\n if (_node?.info?.used) {\n _node?.info?.used?.add(hookName);\n }\n else if (_node) {\n _node.info = {\n ..._node?.info,\n used: new Set([hookName]),\n };\n }\n\n traverse(path1.node.value, {\n MemberExpression(path2) {\n if (path2.node.object.type === 'ThisExpression' && path2.node.property.type === 'Identifier') {\n if (watchArg && watchArg.name !== path2.node.property.name) {\n graph.edges.get(watchArg.name)?.add({\n label: path2.node.property.name,\n type: getRelationType(path2),\n });\n }\n }\n },\n }, path1.scope, path1);\n }\n });\n }\n else {\n traverse(path1.node.value, {\n MemberExpression(path2) {\n if (path2.node.object.type === 'ThisExpression' && path2.node.property.type === 'Identifier') {\n const _node = nodeCollection.getNode(path2.node.property.name);\n if (_node?.info?.used) {\n _node?.info?.used?.add(hookName);\n }\n else if (_node) {\n _node.info = {\n ..._node?.info,\n used: new Set([hookName]),\n };\n }\n }\n },\n }, path1.scope, path1);\n }\n }\n }\n },\n }, path.scope, path);\n }\n\n traverse(ast, {\n ExportDefaultDeclaration(path) {\n // export default {}\n if (path.node.declaration.type === 'ObjectExpression') {\n process(path.node.declaration, path);\n }\n // export default defineComponent({})\n else if (path.node.declaration.type === 'CallExpression'\n && path.node.declaration.callee.type === 'Identifier'\n && path.node.declaration.callee.name === 'defineComponent'\n && path.node.declaration.arguments[0].type === 'ObjectExpression'\n ) {\n process(path.node.declaration.arguments[0], path);\n }\n },\n });\n\n return {\n graph: nodeCollection.map(graph),\n nodesUsedInTemplate,\n };\n}\n","// https://github.com/vuejs/core/blob/main/packages/compiler-sfc/src/style/cssVars.ts\n\nimport type { SFCStyleBlock } from '@vue/compiler-sfc';\n\nenum LexerState {\n inParens,\n inSingleQuoteString,\n inDoubleQuoteString,\n}\n\nfunction lexBinding(content: string, start: number): number | null {\n let state: LexerState = LexerState.inParens;\n let parenDepth = 0;\n\n for (let i = start; i < content.length; i++) {\n const char = content.charAt(i);\n switch (state) {\n case LexerState.inParens:\n if (char === '\\'') {\n state = LexerState.inSingleQuoteString;\n }\n else if (char === '\"') {\n state = LexerState.inDoubleQuoteString;\n }\n else if (char === '(') {\n parenDepth++;\n }\n else if (char === ')') {\n if (parenDepth > 0) {\n parenDepth--;\n }\n else {\n return i;\n }\n }\n break;\n case LexerState.inSingleQuoteString:\n if (char === '\\'') {\n state = LexerState.inParens;\n }\n break;\n case LexerState.inDoubleQuoteString:\n if (char === '\"') {\n state = LexerState.inParens;\n }\n break;\n }\n }\n return null;\n}\n\nfunction normalizeExpression(exp: string) {\n exp = exp.trim();\n if (\n (exp[0] === '\\'' && exp[exp.length - 1] === '\\'')\n || (exp[0] === '\"' && exp[exp.length - 1] === '\"')\n ) {\n return exp.slice(1, -1);\n }\n return exp;\n}\n\nconst vBindRE = /v-bind\\s*\\(/g;\n\nexport function analyze(\n styles: SFCStyleBlock[],\n) {\n const nodes = new Set<string>();\n\n styles.forEach((style) => {\n let match;\n const content = style.content.replace(/\\/\\*([\\s\\S]*?)\\*\\/|\\/\\/.*/g, '');\n // eslint-disable-next-line no-cond-assign\n while ((match = vBindRE.exec(content))) {\n const start = match.index + match[0].length;\n const end = lexBinding(content, start);\n if (end !== null) {\n const variable = normalizeExpression(content.slice(start, end));\n nodes.add(variable);\n }\n }\n });\n\n return nodes;\n}\n","import _traverse from '@babel/traverse';\nimport { babelParse, compileTemplate } from '@vue/compiler-sfc';\n\nconst traverse: typeof _traverse\n // @ts-expect-error unwarp default\n = _traverse.default?.default || _traverse.default || _traverse;\n\nexport function analyze(\n content: string,\n) {\n const id = 'template';\n const { code } = compileTemplate({\n id,\n source: content,\n filename: `${id}.js`,\n });\n\n // console.log(code);\n const ast = babelParse(code, { sourceType: 'module', plugins: [\n 'typescript',\n ] });\n\n // ----\n\n const nodes = new Set<string>();\n\n traverse(ast, {\n MemberExpression(path) {\n if (path.type === 'MemberExpression') {\n if (path.node.object && path.node.object.type === 'Identifier' && path.node.object.name === '_ctx') {\n if (path.node.property && path.node.property.type === 'Identifier') {\n nodes.add(path.node.property.name);\n }\n }\n }\n },\n ObjectProperty(path) {\n if (path.node.key.type === 'Identifier' && path.node.key.name === 'ref') {\n if (path.node.value.type === 'StringLiteral') {\n const name = path.node.value.value;\n if (name) {\n nodes.add(name);\n }\n }\n }\n },\n // component\n CallExpression(path) {\n if (path.node.callee.type === 'Identifier' && path.node.callee.name === '_resolveComponent') {\n if (path.node.arguments[0].type === 'StringLiteral') {\n const name = path.node.arguments[0].value;\n if (name) {\n nodes.add(name);\n }\n }\n }\n },\n });\n\n return nodes;\n}\n","import type { NodePath, Scope } from '@babel/traverse';\nimport type * as t from '@babel/types';\nimport type { NodeCollection, RelationType } from '../analyze/utils';\nimport _traverse from '@babel/traverse';\nimport { getComment, getRelationType } from '../analyze/utils';\n\nexport const traverse: typeof _traverse\n // @ts-expect-error unwarp default\n = _traverse.default?.default || _traverse.default || _traverse;\n\nexport interface IReturnData {\n graph: {\n nodes: Set<string>\n edges: Map<string, Set<{ label: string, type: RelationType }>>\n spread?: Map<string, Set<string>>\n }\n nodeCollection: NodeCollection\n nodesUsedInTemplate: Set<string>\n}\n\nexport interface IAddNode {\n name: string\n node: t.Node\n path: NodePath<t.VariableDeclarator | t.FunctionDeclaration>\n scope: Scope\n}\n\nexport interface IUsedNode {\n name: string\n path: NodePath<t.Identifier>\n parentPath: NodePath<t.Node>\n}\n\nexport interface IAddEdge {\n fromName: string\n toName: string\n path: NodePath<t.Identifier | t.MemberExpression>\n scope: Scope\n toScope?: Scope\n collectionNodes: Set<string>\n}\n\nexport interface IParseVariable {\n path: NodePath<t.VariableDeclarator>\n rootScope: Scope\n}\n\nexport interface IParseNodeBase extends IParseVariable {\n cb?: (params: IAddNode) => void\n}\n\nexport interface IParseEdgeBase extends IParseVariable {\n cb?: (params: IAddEdge) => void\n collectionNodes: Set<string>\n spread?: string[]\n}\n\nexport interface IRescureObject {\n node: t.ObjectPattern\n rootScope: Scope\n res: t.Identifier[]\n parentScope: Scope\n parentPath: NodePath<t.VariableDeclarator | t.ObjectProperty>\n}\n\nexport interface IRescureArray {\n node: t.ArrayPattern\n rootScope: Scope\n res: t.Identifier[]\n parentScope: Scope\n parentPath: NodePath<t.VariableDeclarator | t.ArrayPattern>\n}\n\nexport interface IParseNodeFunction {\n path: NodePath<t.FunctionDeclaration>\n rootScope: Scope\n cb?: (params: IAddNode) => void\n}\n\nexport interface IParseEdgeFunction {\n path: NodePath<t.FunctionDeclaration>\n rootScope: Scope\n cb?: (params: IAddEdge) => void\n collectionNodes: Set<string>\n}\n\nexport interface IParseReturnJSX {\n path: NodePath<t.ReturnStatement>\n parentPath: NodePath<t.Node>\n cb?: (params: IUsedNode) => void\n}\n\nexport interface IParseSetup {\n node: t.ObjectExpression\n parentScope: Scope\n parentPath: NodePath<t.ExportDefaultDeclaration>\n}\n\nexport interface ICollectSpread {\n path: NodePath<t.ObjectMethod>\n spread: string[]\n}\n\nexport interface IAddIdentifiesToGraphByScanReturn {\n path: NodePath<t.ObjectMethod>\n graph: IReturnData['graph']\n nodeCollection: IReturnData['nodeCollection']\n tempNodeCollection: IReturnData['nodeCollection']\n tempEdges: IReturnData['graph']['edges']\n}\n\nexport interface IAddSpreadToGraphByScanReturn {\n path: NodePath<t.ObjectMethod>\n graph: IReturnData['graph']\n nodeCollection: IReturnData['nodeCollection']\n tempNodeCollection: IReturnData['nodeCollection']\n tempEdges: IReturnData['graph']['edges']\n tempSpread: Map<string, Set<string>>\n}\n\nexport interface IAddGraphBySpreadIdentifier {\n path: NodePath<t.VariableDeclarator>\n graph: IReturnData['graph'] & {\n spread: Map<string, Set<string>>\n }\n nodeCollection: IReturnData['nodeCollection']\n iname: string\n}\n\n/**\n * 递归遍历如下结构:\n * let { loc, loc: locd, loc: { start, end }, loc: { start: { line: { deep } }} } = node;\n * 解出 loc, locd, start, end, deep\n */\nexport function rescureObjectPattern({ node, rootScope, res, parentScope, parentPath }: IRescureObject) {\n traverse(node, {\n ObjectProperty(path1) {\n if (path1.node.type === 'ObjectProperty'\n && path1.node.key.type === 'Identifier' && path1.node.value.type === 'Identifier') {\n const name = path1.node.value.name;\n const _scope = path1.scope.getBinding(name)?.scope;\n if (_scope && _scope === rootScope) {\n res.push(path1.node.value);\n }\n }\n else if (path1.node.type === 'ObjectProperty'\n && path1.node.key.type === 'Identifier' && path1.node.value.type === 'ObjectPattern') {\n rescureObjectPattern({\n node: path1.node.value,\n rootScope,\n res,\n parentScope: path1.scope,\n parentPath: path1,\n });\n }\n },\n RestElement(path1) {\n if (path1.node.argument.type === 'Identifier') {\n const name = path1.node.argument.name;\n const _scope = path1.scope.getBinding(name)?.scope;\n if (_scope && _scope === rootScope) {\n res.push(path1.node.argument);\n }\n }\n },\n }, parentScope, parentPath);\n}\n\n/**\n * 递归遍历如下结构:\n * let [foo, [bar, baz]] = [1, [[2], 3]];\n * 解出 foo, bar, baz\n */\nexport function rescureArrayPattern({ node, rootScope, res, parentScope, parentPath }: IRescureArray) {\n traverse(node, {\n Identifier(path1) {\n if (path1.node.type === 'Identifier') {\n const name = path1.node.name;\n const _scope = path1.scope.getBinding(name)?.scope;\n if (_scope && _scope === rootScope) {\n res.push(path1.node);\n }\n }\n },\n ArrayPattern(path1) {\n if (path1.node.type === 'ArrayPattern') {\n rescureArrayPattern({\n node: path1.node,\n rootScope,\n res,\n parentScope: path1.scope,\n parentPath: path1,\n });\n }\n },\n }, parentScope, parentPath);\n}\n\nexport function parseNodeIdentifierPattern({\n path,\n rootScope,\n cb,\n}: IParseNodeBase) {\n if (path.node.id.type !== 'Identifier') {\n return;\n }\n\n if (path.node.init?.type === 'ArrowFunctionExpression' || path.node.init?.type === 'FunctionExpression') {\n // const speak = () => {}\n cb?.({\n name: path.node.id.name,\n node: path.node,\n path,\n scope: rootScope,\n });\n }\n else {\n // const open = 22\n cb?.({\n name: path.node.id.name,\n node: path.node,\n path,\n scope: rootScope,\n });\n }\n}\n\nexport function parseNodeObjectPattern({ path, rootScope, cb }: IParseNodeBase) {\n if (path.node.id.type !== 'ObjectPattern') {\n return;\n }\n\n path.node.id.properties.forEach((property) => {\n if (property.type === 'ObjectProperty'\n && property.key.type === 'Identifier' && property.value.type === 'Identifier') {\n // const { x } = obj\n cb?.({\n name: property.value.name,\n node: property,\n path,\n scope: rootScope,\n });\n }\n else if (property.type === 'ObjectProperty'\n && property.key.type === 'Identifier' && property.value.type === 'AssignmentPattern') {\n // const { x = 3 } = obj\n cb?.({\n name: property.key.name,\n node: property,\n path,\n scope: rootScope,\n });\n }\n else if (property.type === 'RestElement' && property.argument.type === 'Identifier') {\n // const { ...rest } = obj\n cb?.({\n name: property.argument.name,\n node: property,\n path,\n scope: rootScope,\n });\n }\n else if (property.type === 'ObjectProperty'\n && property.key.type === 'Identifier' && property.value.type === 'ObjectPattern') {\n // let { loc, loc: locd, loc: { start, end } } = node;\n const res: t.Identifier[] = [];\n rescureObjectPattern({\n node: property.value,\n rootScope,\n res,\n parentScope: path.scope,\n parentPath: path,\n });\n res.forEach(r => cb?.({\n name: r.name,\n node: r,\n path,\n scope: rootScope,\n }));\n }\n });\n}\n\nexport function parseNodeArrayPattern({ path, rootScope, cb }: IParseNodeBase) {\n if (path.node.id.type !== 'ArrayPattern') {\n return;\n }\n\n path.node.id.elements.forEach((ele) => {\n if (ele?.type === 'Identifier') {\n // const [arr, brr] = array\n cb?.({\n name: ele.name,\n node: ele,\n path,\n scope: rootScope,\n });\n }\n else if (ele?.type === 'ArrayPattern') {\n // let [foo, [bar, baz]] = array;\n const res: t.Identifier[] = [];\n rescureArrayPattern({\n node: ele,\n rootScope,\n res,\n parentScope: path.scope,\n parentPath: path,\n });\n res.forEach(r => cb?.({\n name: r.name,\n node: r,\n path,\n scope: rootScope,\n }));\n }\n else if (ele?.type === 'AssignmentPattern') {\n if (ele.left.type === 'Identifier') {\n // let [yy = 'b'] = array;\n cb?.({\n name: ele.left.name,\n node: ele,\n path,\n scope: rootScope,\n });\n }\n }\n else if (ele?.type === 'RestElement') {\n if (ele.argument.type === 'Identifier') {\n // const [arr2, ...rest2] = array\n cb?.({\n name: ele.argument.name,\n node: ele,\n path,\n scope: rootScope,\n });\n }\n }\n });\n}\n\nexport function parseNodeFunctionPattern({ path, rootScope, cb }: IParseNodeFunction) {\n if (path.node.type !== 'FunctionDeclaration') {\n return;\n }\n if (path.node.id?.type === 'Identifier') {\n // function abc () {}\n cb?.({\n name: path.node.id.name,\n node: path.node,\n path,\n scope: rootScope,\n });\n }\n}\n\nexport function parseEdgeLeftIdentifierPattern({ path, rootScope, cb, collectionNodes, spread }: IParseEdgeBase) {\n if (!path.node.id || path.node.id.type !== 'Identifier') {\n return;\n }\n\n if (path.node.init?.type\n && [\n 'ArrowFunctionExpression',\n 'FunctionExpression',\n 'CallExpression',\n 'ObjectExpression',\n 'ArrayExpression',\n ].includes(path.node.init.type)\n ) {\n // if (graph.nodes.has(path.node.id.name) && path.scope.getBinding(path.node.id.name)?.scope === rootScope) {\n if (collectionNodes.has(path.node.id.name) && path.scope.getBinding(path.node.id.name)?.scope === rootScope) {\n const name = path.node.id.name;\n traverse(path.node.init, {\n Identifier(path1) {\n // graph.edges.get(name)?.add(path1.node.name);\n\n const binding = path1.scope.getBinding(path1.node.name);\n if (\n binding?.scope === rootScope\n && collectionNodes.has(path1.node.name)\n && (\n (path1.parent.type !== 'MemberExpression'\n && path1.parent.type !== 'OptionalMemberExpression')\n || path1.parent.object === path1.node\n )\n ) {\n cb?.({\n fromName: name,\n toName: path1.node.name,\n path: path1,\n scope: rootScope,\n collectionNodes,\n });\n }\n },\n MemberExpression(path1) {\n if (spread?.length && path1.node.object.type === 'Identifier'\n && spread.includes(path1.node.object.name)\n && path1.node.property.type === 'Identifier') {\n cb?.({\n fromName: name,\n toName: path1.node.property.name,\n toScope: path1.scope.getBinding(path1.node.object.name)?.scope,\n path: path1,\n scope: rootScope,\n collectionNodes,\n });\n }\n },\n }, path.scope, path);\n }\n }\n}\n\nexport function parseEdgeLeftObjectPattern({ path, rootScope, cb, collectionNodes }: IParseEdgeBase) {\n if (!path.node.id || path.node.id.type !== 'ObjectPattern') {\n return;\n }\n if (path.node.init?.type\n && [\n 'ArrowFunctionExpression',\n 'FunctionExpression',\n 'CallExpression',\n 'ObjectExpression',\n 'ArrayExpression',\n ].includes(path.node.init.type)\n ) {\n const res: t.Identifier[] = [];\n rescureObjectPattern({\n node: path.node.id,\n rootScope,\n res,\n parentScope: path.scope,\n parentPath: path,\n });\n\n // res.filter(r => (graph.nodes.has(r.name) && path.scope.getBinding(r.name)?.scope === rootScope));\n res.filter(r => (collectionNodes.has(r.name) && path.scope.getBinding(r.name)?.scope === rootScope));\n\n traverse(path.node.init, {\n Identifier(path1) {\n const binding = path1.scope.getBinding(path1.node.name);\n if (\n binding?.scope === rootScope\n && collectionNodes.has(path1.node.name)\n && (\n (path1.parent.type !== 'MemberExpression'\n && path1.parent.type !== 'OptionalMemberExpression')\n || path1.parent.object === path1.node\n )\n ) {\n res.forEach((r) => {\n cb?.({\n fromName: r.name,\n toName: path1.node.name,\n path: path1,\n scope: rootScope,\n collectionNodes,\n });\n });\n }\n },\n }, path.scope, path);\n }\n}\n\nexport function parseEdgeLeftArrayPattern({ path, rootScope, cb, collectionNodes }: IParseEdgeBase) {\n if (!path.node.id || path.node.id.type !== 'ArrayPattern') {\n return;\n }\n if (path.node.init?.type\n && [\n 'ArrowFunctionExpression',\n 'FunctionExpression',\n 'CallExpression',\n 'ObjectExpression',\n 'ArrayExpression',\n ].includes(path.node.init.type)\n ) {\n const res: t.Identifier[] = [];\n rescureArrayPattern({\n node: path.node.id,\n rootScope,\n res,\n parentScope: path.scope,\n parentPath: path,\n });\n\n res.filter(r => (collectionNodes.has(r.name) && path.scope.getBinding(r.name)?.scope === rootScope));\n\n traverse(path.node.init, {\n Identifier(path1) {\n const binding = path1.scope.getBinding(path1.node.name);\n if (\n binding?.scope === rootScope\n && collectionNodes.has(path1.node.name)\n && (\n (path1.parent.type !== 'MemberExpression'\n && path1.parent.type !== 'OptionalMemberExpression')\n || path1.parent.object === path1.node\n )\n ) {\n res.forEach((r) => {\n cb?.({\n fromName: r.name,\n toName: path1.node.name,\n path: path1,\n scope: rootScope,\n collectionNodes,\n });\n });\n }\n },\n }, path.scope, path);\n }\n}\n\nexport function parseEdgeFunctionPattern({ path, rootScope, cb, collectionNodes }: IParseEdgeFunction) {\n if (!path.node.id) {\n return;\n }\n if (collectionNodes.has(path.node.id.name) && path.scope.getBinding(path.node.id.name)?.scope === rootScope) {\n const name = path.node.id.name;\n traverse(path.node.body, {\n Identifier(path1) {\n const binding = path1.scope.getBinding(path1.node.name);\n if (binding?.scope === rootScope && collectionNodes.has(path1.node.name)) {\n cb?.({\n fromName: name,\n toName: path1.node.name,\n path: path1,\n scope: rootScope,\n collectionNodes,\n });\n }\n },\n }, path.scope, path);\n }\n}\n\nexport function parseReturnJsxPattern({ path, parentPath, cb }: IParseReturnJSX) {\n if (\n path.node.argument\n && (\n // return () => (<div></div>)\n // return function() (<div></div>)\n (\n (\n path.node.argument.type === 'ArrowFunctionExpression'\n || path.node.argument.type === 'FunctionExpression'\n ) && (\n path.node.argument.body.type === 'JSXElement'\n || path.node.argument.body.type === 'JSXFragment'\n )\n )\n // return (<div></div>)\n || (\n path.node.argument.type === 'JSXElement'\n || path.node.argument.type === 'JSXFragment'\n )\n )\n ) {\n path.traverse({\n Identifier(path1) {\n // if (path1.scope.getBinding(path1.node.name)?.scope === parentPath.scope) {\n // nodesUsedInTemplate.add(path1.node.name);\n // }\n cb?.({\n name: path1.node.name,\n path: path1,\n parentPath,\n });\n },\n });\n }\n}\n\nexport function traverseSetup({ node, parentScope, parentPath }: IParseSetup) {\n let path: NodePath<t.ObjectMethod>;\n\n traverse(node, {\n ObjectMethod(path1) {\n if (\n (\n parentPath.node.declaration.type === 'ObjectExpression'\n && path1.parent === parentPath.node.declaration\n ) || (\n parentPath.node.declaration.type === 'CallExpression'\n && path1.parent === parentPath.node.declaration.arguments[0]\n )\n ) {\n if (path1.node.key.type === 'Identifier' && path1.node.key.name === 'setup') {\n path = path1;\n }\n }\n },\n }, parentScope, parentPath);\n\n return path!;\n}\n\nexport function collectionSpread({ path: path1, spread }: ICollectSpread) {\n path1.traverse({\n ReturnStatement(path2) {\n // get setup return obj spread\n if (path2.node.argument?.type === 'ObjectExpression') {\n const returnNode = path2.node.argument;\n traverse(returnNode, {\n SpreadElement(path3) {\n // ...toRefs(xxx)\n if (\n path3.node.argument.type === 'CallExpression'\n && path3.node.argument.callee.type === 'Identifier'\n && path3.node.argument.callee.name === 'toRefs'\n && path3.node.argument.arguments[0].type === 'Identifier'\n ) {\n spread.push(path3.node.argument.arguments[0].name);\n }\n // ...xxx\n else if (\n path3.node.argument.type === 'Identifier'\n ) {\n spread.push(path3.node.argument.name);\n }\n },\n }, path2.scope, path2);\n }\n },\n });\n}\n\nexport function addIdentifiesToGraphByScanReturn(\n { path: path1, graph, nodeCollection, tempNodeCollection, tempEdges }: IAddIdentifiesToGraphByScanReturn,\n) {\n path1.traverse({\n ReturnStatement(path2) {\n // get setup return obj spread\n if (path2.node.argument?.type === 'ObjectExpression') {\n const returnNode = path2.node.argument;\n traverse(returnNode, {\n ObjectProperty(path3) {\n // not spread node\n if (path3.parent === returnNode) {\n if (path3.node.key.type === 'Identifier' && path3.node.value.type === 'Identifier') {\n const valName = path3.node.value.name;\n if (!graph.nodes.has(valName)) {\n graph.nodes.add(valName);\n nodeCollection.addTypedNode(\n valName,\n tempNodeCollection.nodes.get(valName)!,\n );\n }\n if (!graph.edges.has(valName)) {\n graph.edges.set(valName, new Set([...Array.from(\n tempEdges.get(valName) || new Set<{ label: string, type: RelationType }>(),\n )]));\n }\n\n const name = path3.node.key.name;\n if (name !== valName) {\n graph.nodes.add(name);\n nodeCollection.addNode(name, path3.node.key, {\n comment: getComment(path3.node),\n });\n graph.edges.set(name, new Set([{\n label: valName,\n type: getRelationType(path3),\n }]));\n }\n }\n }\n },\n }, path2.scope, path2);\n }\n },\n });\n}\n\nexport function addSpreadToGraphByScanReturn(\n { path: path1, graph, nodeCollection, tempNodeCollection, tempEdges, tempSpread }: IAddSpreadToGraphByScanReturn,\n) {\n path1.traverse({\n ReturnStatement(path2) {\n // get setup return obj spread\n if (path2.node.argument?.type === 'ObjectExpression') {\n const returnNode = path2.node.argument;\n traverse(returnNode, {\n SpreadElement(path3) {\n // ...toRefs(xxx)\n if (\n path3.node.argument.type === 'CallExpression'\n && path3.node.argument.callee.type === 'Identifier'\n && path3.node.argument.callee.name === 'toRefs'\n && path3.node.argument.arguments[0].type === 'Identifier'\n && tempSpread.get(path3.node.argument.arguments[0].name)\n ) {\n tempSpread.get(path3.node.argument.arguments[0].name)?.forEach((name) => {\n graph.nodes.add(name);\n nodeCollection.addTypedNode(name, tempNodeCollection.nodes.get(name)!);\n if (!graph.edges.get(name)) {\n graph.edges.set(name, new Set());\n tempEdges.get(name)?.forEach((edge) => {\n graph.edges.get(name)?.add(edge);\n });\n }\n });\n }\n // ...xxx\n else if (\n path3.node.argument.type === 'Identifier'\n && tempSpread.get(path3.node.argument.name)\n ) {\n tempSpread.get(path3.node.argument.name)?.forEach((name) => {\n graph.nodes.add(name);\n nodeCollection.addTypedNode(name, tempNodeCollection.nodes.get(name)!);\n if (!graph.edges.get(name)) {\n graph.edges.set(name, new Set());\n tempEdges.get(name)?.forEach((edge) => {\n graph.edges.get(name)?.add(edge);\n });\n }\n });\n }\n },\n }, path2.scope, path2);\n }\n },\n });\n}\n\nexport function addGraphBySpreadIdentifier({ path: path1, graph, nodeCollection, iname }: IAddGraphBySpreadIdentifier) {\n if (path1.node.init?.type === 'ObjectExpression') {\n path1.node.init?.properties.forEach((prop) => {\n if (\n (prop.type === 'ObjectProperty' || prop.type === 'ObjectMethod')\n && prop.key.type === 'Identifier'\n ) {\n const keyName = prop.key.name;\n graph.nodes.add(keyName);\n nodeCollection.addNode(keyName, prop, {\n comment: getComment(prop),\n });\n if (!graph.edges.get(keyName)) {\n graph.edges.set(keyName, new Set());\n }\n if (graph.spread.has(iname)) {\n graph.spread.get(iname)?.add(keyName);\n }\n else {\n graph.spread.set(iname, new Set([keyName]));\n }\n }\n else if (prop.type === 'SpreadElement') {\n console.warn('not support spread in spread');\n }\n });\n }\n\n if (\n path1.node.init?.type === 'CallExpression'\n && path1.node.init?.callee.type === 'Identifier'\n && path1.node.init?.callee.name === 'reactive'\n ) {\n const arg = path1.node.init?.arguments[0];\n if (arg.type === 'ObjectExpression') {\n arg.properties.forEach((prop) => {\n if (\n (prop.type === 'ObjectProperty' || prop.type === 'ObjectMethod')\n && prop.key.type === 'Identifier'\n ) {\n const keyName = prop.key.name;\n graph.nodes.add(keyName);\n nodeCollection.addNode(keyName, prop, {\n comment: getComment(prop),\n });\n if (!graph.edges.get(keyName)) {\n graph.edges.set(keyName, new Set());\n }\n if (graph.spread.has(iname)) {\n graph.spread.get(iname)?.add(keyName);\n }\n else {\n graph.spread.set(iname, new Set([keyName]));\n }\n }\n else if (prop.type === 'SpreadElement') {\n console.warn('not support spread in spread');\n }\n });\n }\n }\n}\n","import type { NodePath, Scope } from '@babel/traverse';\nimport type * as t from '@babel/types';\nimport type {\n IAddEdge,\n IAddNode,\n IReturnData,\n IUsedNode,\n} from '../utils/traverse';\nimport type { RelationType } from './utils';\nimport _traverse from '@babel/traverse';\nimport { babelParse } from '@vue/compiler-sfc';\nimport {\n addGraphBySpreadIdentifier,\n addIdentifiesToGraphByScanReturn,\n addSpreadToGraphByScanReturn,\n collectionSpread,\n parseEdgeFunctionPattern,\n parseEdgeLeftArrayPattern,\n parseEdgeLeftIdentifierPattern,\n parseEdgeLeftObjectPattern,\n parseNodeArrayPattern,\n parseNodeFunctionPattern,\n parseNodeIdentifierPattern,\n parseNodeObjectPattern,\n parseReturnJsxPattern,\n traverse,\n traverseSetup,\n} from '../utils/traverse';\nimport { getComment, getRelationType, NodeCollection } from './utils';\n\ninterface IProcessMain {\n node: t.Node\n type: 'vue' | 'react'\n lineOffset?: number\n addInfo?: boolean\n}\n\ninterface IProcessBranch {\n node: t.ObjectExpression\n lineOffset?: number\n addInfo?: boolean\n parentScope?: Scope\n parentNode?: t.ExportDefaultDeclaration\n parentPath: NodePath<t.ExportDefaultDeclaration>\n spread?: string[]\n}\n\ntype IProcessReact = {\n node: t.BlockStatement\n lineOffset?: number\n addInfo?: boolean\n parentScope: Scope\n parentNode: t.FunctionDeclaration\n parentPath: NodePath<t.FunctionDeclaration>\n} | {\n node: t.BlockStatement\n lineOffset?: number\n addInfo?: boolean\n parentScope: Scope\n parentNode: t.ClassMethod\n parentPath: NodePath<t.ClassMethod>\n};\n\n// deal when setup return object\nfunction processByReturnNotJSX(params: IProcessBranch) {\n const { node, parentPath, lineOffset, addInfo } = params;\n const spread: string[] = [];\n\n const nodeCollection = new NodeCollection(lineOffset, addInfo);\n\n const graph = {\n nodes: new Set<string>(),\n edges: new Map<string, Set<{ label: string, type: RelationType }>>(),\n };\n\n // 解析return, 收集spread\n const setupPath = traverseSetup({ node, parentScope: parentPath.scope, parentPath });\n\n // setup return\n collectionSpread({ path: setupPath, spread });\n\n // 收集除return之外的所有节点和边\n const {\n graph: {\n nodes: tempNodes,\n edges: tempEdges,\n spread: tempSpread,\n },\n nodeCollection: tempNodeCollection,\n nodesUsedInTemplate,\n } = processByReturnJSX({ node, parentPath, spread, lineOffset, addInfo });\n\n // 根据return信息添加必要节点\n addIdentifiesToGraphByScanReturn({\n path: setupPath,\n graph,\n nodeCollection,\n tempNodeCollection,\n tempEdges,\n });\n\n // 根据return信息添加必要节点\n addSpreadToGraphByScanReturn({\n path: setupPath,\n graph,\n nodeCollection,\n tempNodeCollection,\n tempEdges,\n tempSpread,\n });\n\n return {\n graph,\n nodeCollection,\n nodesUsedInTemplate,\n };\n}\n\n// deal when setup return jsx\nfunction processByReturnJSX(params: IProcessBranch) {\n const { node, parentPath, spread = [], lineOffset, addInfo } = params;\n\n const nodeCollection = new NodeCollection(lineOffset, addInfo);\n const nodesUsedInTemplate = new Set<string>();\n\n const graph = {\n nodes: new Set<string>(),\n edges: new Map<string, Set<{ label: string, type: RelationType }>>(),\n spread: new Map<string, Set<string>>(),\n };\n\n function addNode({ name, node, path, scope }: IAddNode, commentParentNode?: t.Node) {\n const binding = path.scope.getBinding(name);\n if (scope === binding?.scope) {\n graph.nodes.add(name);\n nodeCollection.addNode(name, node, {\n comment: commentParentNode\n ? getComment(commentParentNode)\n : '',\n });\n if (!graph.edges.get(name)) {\n graph.edges.set(name, new Set());\n }\n }\n }\n\n function addEdge({ fromName, toName, path, scope, toScope, collectionNodes }: IAddEdge) {\n const bindingScope = toScope || path.scope.getBinding(toName)?.scope;\n if (scope === bindingScope && collectionNodes.has(toName)) {\n graph.edges.get(fromName)?.add({\n label: toName,\n type: getRelationType(path),\n });\n }\n }\n\n function addUsed({ name, path, parentPath }: IUsedNode) {\n const binding = path.scope.getBinding(name);\n if (binding?.scope === parentPath.scope) {\n nodesUsedInTemplate.add(name);\n }\n }\n\n const setupPath = traverseSetup({ node, parentScope: parentPath.scope, parentPath });\n const setupScope = setupPath.scope;\n const setupNode = setupPath.node;\n\n // 收集节点, 并收集spread依赖\n traverse(setupNode, {\n VariableDeclarator(path1) {\n parseNodeIdentifierPattern({\n path: path1,\n rootScope: setupScope,\n cb: (params) => {\n if (!spread.includes(params.name)) {\n addNode(params, path1.node);\n }\n else {\n addGraphBySpreadIdentifier({\n path: path1,\n graph,\n nodeCollection,\n iname: params.name,\n });\n }\n },\n });\n\n parseNodeObjectPattern({\n path: path1,\n rootScope: setupScope,\n cb: addNode,\n });\n\n parseNodeArrayPattern({\n path: path1,\n rootScope: setupScope,\n cb: addNode,\n });\n },\n FunctionDeclaration(path1) {\n parseNodeFunctionPattern({\n path: path1,\n rootScope: setupScope,\n cb: addNode,\n });\n },\n }, setupScope, setupPath);\n\n // 搜集jsx模版使用节点\n setupPath.traverse({\n ReturnStatement(path2) {\n // setup return jsx\n parseReturnJsxPattern({\n path: path2,\n parentPath: setupPath,\n cb: addUsed,\n });\n },\n });\n\n // 收集边\n traverse(setupNode, {\n VariableDeclarator(path1) {\n parseEdgeLeftIdentifierPattern({\n path: path1,\n rootScope: setupScope,\n collectionNodes: graph.nodes,\n cb: addEdge,\n spread,\n });\n\n parseEdgeLeftObjectPattern({\n path: path1,\n rootScope: setupScope,\n collectionNodes: graph.nodes,\n cb: addEdge,\n });\n\n parseEdgeLeftArrayPattern({\n path: path1,\n rootScope: setupScope,\n collectionNodes: graph.nodes,\n cb: addEdge,\n });\n },\n FunctionDeclaration(path1) {\n parseEdgeFunctionPattern({\n path: path1,\n rootScope: setupScope,\n collectionNodes: graph.nodes,\n cb: addEdge,\n });\n },\n }, setupScope, setupPath);\n\n return {\n graph,\n nodeCollection,\n nodesUsedInTemplate,\n };\n}\n\nfunction processByReact(params: IProcessReact) {\n const { node, parentScope, parentPath, lineOffset, addInfo } = params;\n\n const nodeCollection = new NodeCollection(lineOffset, addInfo);\n const nodesUsedInTemplate = new Set<string>();\n\n const graph = {\n nodes: new Set<string>(),\n edges: new Map<string, Set<{ label: string, type: RelationType }>>(),\n spread: new Map<string, Set<string>>(),\n };\n\n function addNode({ name, node, path, scope }: IAddNode, commentParentNode?: t.Node) {\n const binding = path.scope.getBinding(name);\n if (scope === binding?.scope) {\n graph.nodes.add(name);\n nodeCollection.addNode(name, node, {\n comment: commentParentNode\n ? getComment(commentParentNode)\n : '',\n });\n if (!graph.edges.get(name)) {\n graph.edges.set(name, new Set());\n }\n }\n }\n\n function addEdge({ fromName, toName, path, scope, toScope, collectionNodes }: IAddEdge) {\n const bindingScope = toScope || path.scope.getBinding(toName)?.scope;\n if (scope === bindingScope && collectionNodes.has(toName)) {\n graph.edges.get(fromName)?.add({\n label: toName,\n type: getRelationType(path),\n });\n }\n }\n\n function addUsed({ name, path, parentPath }: IUsedNode) {\n const binding = path.scope.getBinding(name);\n if (binding?.scope === parentPath.scope) {\n nodesUsedInTemplate.add(name);\n }\n }\n\n // 收集节点依赖\n traverse(node, {\n VariableDeclarator(path1) {\n parseNodeIdentifierPattern({\n path: path1,\n rootScope: parentScope!,\n cb: (params) => {\n addNode(params, path1.node);\n },\n });\n\n parseNodeObjectPattern({\n path: path1,\n rootScope: parentScope!,\n cb: addNode,\n });\n\n parseNodeArrayPattern({\n path: path1,\n rootScope: parentScope!,\n cb: addNode,\n });\n },\n FunctionDeclaration(path1) {\n parseNodeFunctionPattern({\n path: path1,\n rootScope: parentScope!,\n cb: addNode,\n });\n },\n }, parentScope, parentPath);\n\n // 搜集jsx模版使用节点\n traverse(node, {\n ReturnStatement(path2) {\n // setup return jsx\n parseReturnJsxPattern({\n path: path2,\n parentPath,\n cb: addUsed,\n });\n },\n }, parentScope, parentPath);\n\n // 收集边\n traverse(node, {\n VariableDeclarator(path1) {\n parseEdgeLeftIdentifierPattern({\n path: path1,\n rootScope: parentScope!,\n collectionNodes: graph.nodes,\n cb: addEdge,\n });\n\n parseEdgeLeftObjectPattern({\n path: path1,\n rootScope: parentScope!,\n collectionNodes: graph.nodes,\n cb: addEdge,\n });\n\n parseEdgeLeftArrayPattern({\n path: path1,\n rootScope: parentScope!,\n collectionNodes: graph.nodes,\n cb: addEdge,\n });\n },\n FunctionDeclaration(path1) {\n parseEdgeFunctionPattern({\n path: path1,\n rootScope: parentScope!,\n collectionNodes: graph.nodes,\n cb: addEdge,\n });\n },\n }, parentScope, parentPath);\n\n return {\n graph,\n nodeCollection,\n nodesUsedInTemplate,\n };\n}\n\nexport function processTsx(params: IProcessMain) {\n let result: IReturnData | undefined;\n\n function process(params: IProcessBranch) {\n const { node, parentPath } = params;\n // resolve `return` then determine use processByReturnJSX or processByReturnNotJSX\n const setupPath = traverseSetup({ node, parentScope: parentPath.scope, parentPath });\n\n setupPath.traverse({\n ReturnStatement(path) {\n if (path.node.argument\n && (path.node.argument.type === 'ArrowFunctionExpression'\n || path.node.argument.type === 'FunctionExpression')\n && (path.node.argument.body.type === 'JSXElement'\n || path.node.argument.body.type === 'JSXFragment')\n ) {\n result = processByReturnJSX(params);\n }\n else {\n result = processByReturnNotJSX(params);\n }\n },\n });\n }\n\n traverse(params.node, {\n ExportDefaultDeclaration(path) {\n if (params.type === 'vue') {\n if (path.node.declaration.type === 'ObjectExpression') {\n // export default {}\n process({\n ...params,\n node: path.node.declaration,\n parentNode: path.node,\n parentPath: path,\n });\n }\n else if (\n path.node.declaration.type === 'CallExpression'\n && path.node.declaration.callee.type === 'Identifier'\n && path.node.declaration.callee.name === 'defineComponent'\n && path.node.declaration.arguments[0].type === 'ObjectExpression'\n ) {\n // export default defineComponent({})\n process({\n ...params,\n node: path.node.declaration.arguments[0],\n parentNode: path.node,\n parentPath: path,\n });\n }\n }\n if (params.type === 'react') {\n if (\n (path.node.declaration.type === 'FunctionDeclaration'\n || path.node.declaration.type === 'ArrowFunctionExpression')\n && path.node.declaration.body.type === 'BlockStatement'\n ) {\n // export default function () {}\n\n const functionPath = path.get('declaration') as NodePath<t.FunctionDeclaration>;\n\n result = processByReact({\n ...params,\n node: path.node.declaration.body,\n parentNode: functionPath.node,\n parentPath: functionPath,\n parentScope: functionPath.scope,\n });\n }\n if (path.node.declaration.type === 'ClassDeclaration') {\n // export default class Index {}\n\n const renderFunction = path.node.declaration.body.body.find((node) => {\n if (node.type === 'ClassMethod' && node.key.type === 'Identifier' && node.key.name === 'render') {\n return node;\n }\n return undefined;\n }) as t.ClassMethod;\n if (!renderFunction) {\n return;\n }\n\n const renderPath = path.get(`declaration.body.body.${\n path.node.declaration.body.body.indexOf(renderFunction)\n }`) as NodePath<t.ClassMethod>;\n\n result = processByReact({\n ...params,\n node: renderFunction.body,\n parentNode: renderFunction,\n parentPath: renderPath,\n parentScope: renderPath.scope,\n });\n }\n }\n },\n });\n\n return result!;\n}\n\nexport function analyze(\n content: string,\n type = 'vue' as 'vue' | 'react',\n lineOffset = 0,\n addInfo = true,\n) {\n const ast = babelParse(content, { sourceType: 'module', plugins: [\n 'typescript',\n 'jsx',\n ] });\n\n const { graph, nodeCollection, nodesUsedInTemplate } = processTsx({\n node: ast,\n type,\n lineOffset,\n addInfo,\n });\n\n return {\n graph: nodeCollection.map(graph),\n nodesUsedInTemplate,\n };\n}\n","import type { RelationType, TypedNode } from './analyze/utils';\n\ninterface MermaidOptions {\n direction?: 'TB' | 'BT' | 'LR' | 'RL'\n}\n\nexport function getMermaidText(\n graph: {\n nodes: Set<TypedNode>\n edges: Map<TypedNode, Set<{ node: TypedNode, type: RelationType }>>\n },\n nodesUsedInTemplate: Set<string>,\n nodesUsedInStyle: Set<string> = new Set(),\n options: MermaidOptions = {},\n): string {\n const direction: 'TB' | 'BT' | 'LR' | 'RL' = options.direction || 'TB';\n const usedNodes: Set<string> = new Set([...nodesUsedInTemplate, ...nodesUsedInStyle]);\n\n let mermaidText: string = `flowchart ${direction}\n %% Legend:\n %% () = variable node\n %% [] = function node\n %% * suffix = unused in template/style\n %% A --> B means A depends on B\\n`;\n\n graph.nodes.forEach((node: TypedNode) => {\n const shape: string = node.type === 'var'\n ? '('\n : '[';\n const closeShape: string = node.type === 'var'\n ? ')'\n : ']';\n const unusedSuffix: string = !(usedNodes.has(node.label) || node.info?.used?.size)\n ? '*'\n : '';\n mermaidText += ` ${node.label}${shape}${node.label}${unusedSuffix}${closeShape}\\n`;\n });\n\n graph.edges.forEach((edge, key) => {\n edge.forEach((to) => {\n if (!to || !to.node.label) {\n return;\n }\n mermaidText += ` ${key.label} --> ${to.node.label}\\n`;\n });\n });\n\n return mermaidText;\n}\n","import type { RelationType, TypedNode } from '../analyze/utils';\n\nexport interface Community {\n id: number\n nodes: Set<TypedNode>\n}\n\nexport interface CommunityResult {\n communities: Community[]\n nodeToCommuntiy: Map<TypedNode, number>\n}\n\nconst COMMON_PREFIXES = ['handle', 'on', 'is', 'has', 'can', 'should', 'get', 'set', 'update', 'toggle', 'reset', 'clear', 'init', 'fetch', 'load', 'save', 'delete', 'remove', 'add', 'create', 'show', 'hide', 'open', 'close', 'enable', 'disable', 'validate', 'check', 'use'];\nconst COMMON_SUFFIXES = ['change', 'changed', 'handler', 'callback', 'listener', 'state', 'value', 'data', 'list', 'items', 'count', 'index', 'id', 'name', 'type', 'status', 'error', 'loading', 'visible', 'disabled', 'enabled', 'active', 'selected', 'checked', 'open', 'closed'];\n\n/**\n * Extract the base/root word from an identifier by removing common prefixes/suffixes.\n * Only removes prefixes at the start and suffixes at the end.\n * e.g., \"handleOpenChange\" -> [\"open\"]\n * \"isVisible\" -> [\"visible\"]\n * \"userName\" -> [\"user\", \"name\"]\n */\nexport function extractBaseWords(identifier: string): string[] {\n const tokens = identifier\n .replace(/([a-z])([A-Z])/g, '$1_$2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2')\n .toLowerCase()\n .split(/[_\\-\\s]+/)\n .filter(Boolean);\n\n if (tokens.length === 0) {\n return [];\n }\n\n if (tokens.length === 1) {\n return tokens;\n }\n\n let start = 0;\n if (COMMON_PREFIXES.includes(tokens[0])) {\n start = 1;\n }\n\n let end = tokens.length;\n if (COMMON_SUFFIXES.includes(tokens[tokens.length - 1])) {\n end = tokens.length - 1;\n }\n\n const words = tokens.slice(start, end);\n\n if (words.length === 0) {\n return tokens.slice(start > 0\n ? start\n : 0);\n }\n\n return words;\n}\n\n/**\n * Calculate semantic similarity between two identifiers.\n * Returns a value between 0 and 1.\n *\n * Considers:\n * 1. Shared base words (e.g., \"open\" in \"isOpen\" and \"handleOpenChange\")\n * 2. One identifier contains the other as a substring\n * 3. Common naming patterns (handler/state pairs)\n */\nexport function calculateSemanticSimilarity(labelA: string, labelB: string): number {\n if (labelA === labelB) {\n return 1;\n }\n\n const lowerA = labelA.toLowerCase();\n const lowerB = labelB.toLowerCase();\n\n if (lowerA.includes(lowerB) || lowerB.includes(lowerA)) {\n const shorter = lowerA.length < lowerB.length\n ? lowerA\n : lowerB;\n const longer = lowerA.length < lowerB.length\n ? lowerB\n : lowerA;\n return shorter.length / longer.length;\n }\n\n const wordsA = extractBaseWords(labelA);\n const wordsB = extractBaseWords(labelB);\n\n if (wordsA.length === 0 || wordsB.length === 0) {\n return 0;\n }\n\n const setA = new Set(wordsA);\n const setB = new Set(wordsB);\n\n let sharedCount = 0;\n for (const word of setA) {\n if (setB.has(word)) {\n sharedCount++;\n }\n }\n\n if (sharedCount === 0) {\n return 0;\n }\n\n const jaccardSimilarity = sharedCount / (setA.size + setB.size - sharedCount);\n\n return jaccardSimilarity;\n}\n\ninterface BuildWeightedGraphOptions {\n semanticWeight?: number\n similarityThreshold?: number\n}\n\n/**\n * Calculate semantic similarity using cached base words.\n * Returns a value between 0 and 1.\n */\nfunction calculateSemanticSimilarityCached(\n labelA: string,\n labelB: string,\n wordsA: string[],\n wordsB: string[],\n): number {\n if (labelA === labelB) {\n return 1;\n }\n\n const lowerA = labelA.toLowerCase();\n const lowerB = labelB.toLowerCase();\n\n if (lowerA.includes(lowerB) || lowerB.includes(lowerA)) {\n const shorter = lowerA.length < lowerB.length\n ? lowerA\n : lowerB;\n const longer = lowerA.length < lowerB.length\n ? lowerB\n : lowerA;\n return shorter.length / longer.length;\n }\n\n if (wordsA.length === 0 || wordsB.length === 0) {\n return 0;\n }\n\n const setA = new Set(wordsA);\n const setB = new Set(wordsB);\n\n let sharedCount = 0;\n for (const word of setA) {\n if (setB.has(word)) {\n sharedCount++;\n }\n }\n\n if (sharedCount === 0) {\n return 0;\n }\n\n return sharedCount / (setA.size + setB.size - sharedCount);\n}\n\n/**\n * Build a weighted graph that combines structural connections with semantic similarity.\n *\n * Optimized algorithm:\n * 1. Cache extractBaseWords results to avoid repeated computation\n * 2. Build word-to-nodes bucket map, only compare nodes within same bucket\n * This reduces O(N²) to O(B × K²) where B = number of buckets, K = avg nodes per bucket\n */\nfunction buildWeightedGraph(\n graph: Map<TypedNode, Set<{ node: TypedNode, type: RelationType }>>,\n options: BuildWeightedGraphOptions = {},\n): Map<TypedNode, Map<TypedNode, number>> {\n const { semanticWeight = 1.0, similarityThreshold = 0.3 } = options;\n\n const weighted = new Map<TypedNode, Map<TypedNode, number>>();\n const allNodes = new Set<TypedNode>();\n\n for (const [node, edges] of graph) {\n allNodes.add(node);\n for (const edge of edges) {\n allNodes.add(edge.node);\n }\n }\n\n for (const node of allNodes) {\n weighted.set(node, new Map());\n }\n\n const structuralWeight = 0.85;\n\n for (const [node, edges] of graph) {\n for (const edge of edges) {\n const currentWeight = weighted.get(node)!.get(edge.node) || 0;\n weighted.get(node)!.set(edge.node, Math.max(currentWeight, structuralWeight));\n\n const reverseWeight = weighted.get(edge.node)!.get(node) || 0;\n weighted.get(edge.node)!.set(node, Math.max(reverseWeight, structuralWeight));\n }\n }\n\n if (semanticWeight > 0) {\n const nodeWordsCache = new Map<TypedNode, string[]>();\n const wordToBucket = new Map<string, Set<TypedNode>>();\n\n for (const node of allNodes) {\n const words = extractBaseWords(node.label);\n nodeWordsCache.set(node, words);\n\n for (const word of words) {\n if (!wordToBucket.has(word)) {\n wordToBucket.set(word, new Set());\n }\n wordToBucket.get(word)!.add(node);\n }\n }\n\n const comparedPairs = new Set<string>();\n\n for (const [_, bucket] of wordToBucket) {\n if (bucket.size < 2) {\n continue;\n }\n\n const bucketNodes = Array.from(bucket);\n for (let i = 0; i < bucketNodes.length; i++) {\n for (let j = i + 1; j < bucketNodes.length; j++) {\n const nodeA = bucketNodes[i];\n const nodeB = bucketNodes[j];\n\n const comparedKey = [nodeA.label, nodeB.label].sort().join('|');\n if (comparedPairs.has(comparedKey)) {\n continue;\n }\n comparedPairs.add(comparedKey);\n\n const wordsA = nodeWordsCache.get(nodeA)!;\n const wordsB = nodeWordsCache.get(nodeB)!;\n const similarity = calculateSemanticSimilarityCached(\n nodeA.label,\n nodeB.label,\n wordsA,\n wordsB,\n );\n\n if (similarity > similarityThreshold) {\n const semanticEdgeWeight = similarity * semanticWeight;\n\n // Only enhance existing structural connections with semantic weight\n // Check actual edge existence in weighted graph, not by label\n const currentAB = weighted.get(nodeA)!.get(nodeB);\n if (typeof currentAB === 'number') {\n weighted.get(nodeA)!.set(nodeB, Math.min(Math.max(currentAB, semanticEdgeWeight), 2.0));\n }\n\n const currentBA = weighted.get(nodeB)!.get(nodeA);\n if (typeof currentBA === 'number') {\n weighted.get(nodeB)!.set(nodeA, Math.min(Math.max(currentBA, semanticEdgeWeight), 2.0));\n }\n }\n }\n }\n }\n }\n\n return weighted;\n}\n\nfunction buildUndirectedGraph(\n graph: Map<TypedNode, Set<{ node: TypedNode, type: RelationType }>>,\n): Map<TypedNode, Set<TypedNode>> {\n const undirected = new Map<TypedNode, Set<TypedNode>>();\n\n for (const [node, edges] of graph) {\n if (!undirected.has(node)) {\n undirected.set(node, new Set());\n }\n for (const edge of edges) {\n undirected.get(node)!.add(edge.node);\n if (!undirected.has(edge.node)) {\n undirected.set(edge.node, new Set());\n }\n undirected.get(edge.node)!.add(node);\n }\n }\n\n return undirected;\n}\n\nfunction createSeededRandom(seed?: number): () => number {\n if (seed === undefined) {\n return Math.random;\n }\n let state = seed;\n return () => {\n state = (state * 1103515245 + 12345) & 0x7FFFFFFF;\n return state / 0x7FFFFFFF;\n };\n}\n\nfunction shuffleArray<T>(array: T[], random: () => number = Math.random): T[] {\n const result = [...array];\n for (let i = result.length - 1; i > 0; i--) {\n const j = Math.floor(random() * (i + 1));\n [result[i], result[j]] = [result[j], result[i]];\n }\n return result;\n}\n\nexport interface DetectCommunitiesOptions {\n maxIterations?: number\n seed?: number\n /**\n * Weight for semantic similarity (0-1).\n * Higher values give more importance to naming patterns.\n * Default: 1.0\n */\n semanticWeight?: number\n /**\n * Minimum semantic similarity threshold for enhancing existing edges (0-1).\n * Only structurally connected node pairs with similarity above this threshold\n * will have their edge weight enhanced by semantic similarity.\n * Note: Semantic similarity alone does not create new edges.\n * Default: 0.3\n */\n similarityThreshold?: number\n}\n\n/**\n * Label Propagation Algorithm for community detection with semantic awareness.\n *\n * Each node starts with its own unique label. In each iteration,\n * nodes adopt the most frequent label among their neighbors,\n * weighted by both structural connections and semantic similarity.\n *\n * Semantic similarity considers:\n * - Shared base words (e.g., \"open\" in \"isOpen\" and \"handleOpenChange\")\n * - Substring relationships\n * - Common naming patterns (handler/state pairs)\n *\n * This helps identify groups of nodes that are tightly connected\n * and could potentially be extracted into separate hooks.\n */\nexport function detectCommunities(\n graph: Map<TypedNode, Set<{ node: TypedNode, type: RelationType }>>,\n options: DetectCommunitiesOptions = {},\n): CommunityResult {\n const { maxIterations = 100, semanticWeight = 1.0, similarityThreshold = 0.3 } = options;\n const random = createSeededRandom(options.seed);\n const weightedGraph = buildWeightedGraph(graph, { semanticWeight, similarityThreshold });\n const nodes = Array.from(weightedGraph.keys());\n\n if (nodes.length === 0) {\n return { communities: [], nodeToCommuntiy: new Map() };\n }\n\n const labels = new Map<TypedNode, number>();\n nodes.forEach((node, index) => {\n labels.set(node, index);\n });\n\n let changed = true;\n let iterations = 0;\n\n while (changed && iterations < maxIterations) {\n changed = false;\n iterations++;\n\n const shuffledNodes = shuffleArray(nodes, random);\n\n for (const node of shuffledNodes) {\n const neighbors = weightedGraph.get(node);\n if (!neighbors || neighbors.size === 0) {\n continue;\n }\n\n const labelWeights = new Map<number, number>();\n for (const [neighbor, weight] of neighbors) {\n const neighborLabel = labels.get(neighbor)!;\n labelWeights.set(neighborLabel, (labelWeights.get(neighborLabel) || 0) + weight);\n }\n\n let maxWeight = 0;\n let maxLabels: number[] = [];\n for (const [label, weight] of labelWeights) {\n if (weight > maxWeight) {\n maxWeight = weight;\n maxLabels = [label];\n }\n else if (weight === maxWeight) {\n maxLabels.push(label);\n }\n }\n\n const currentLabel = labels.get(node)!;\n if (maxLabels.includes(currentLabel)) {\n continue;\n }\n\n const newLabel = maxLabels[Math.floor(random() * maxLabels.length)];\n if (newLabel !== currentLabel) {\n labels.set(node, newLabel);\n changed = true;\n }\n }\n }\n\n const communityMap = new Map<number, Set<TypedNode>>();\n for (const [node, label] of labels) {\n if (!communityMap.has(label)) {\n communityMap.set(label, new Set());\n }\n communityMap.get(label)!.add(node);\n }\n\n const communities: Community[] = [];\n const nodeToCommuntiy = new Map<TypedNode, number>();\n let communityId = 0;\n\n for (const [_, nodeSet] of communityMap) {\n communities.push({\n id: communityId,\n nodes: nodeSet,\n });\n for (const node of nodeSet) {\n nodeToCommuntiy.set(node, communityId);\n }\n communityId++;\n }\n\n communities.sort((a, b) => b.nodes.size - a.nodes.size);\n\n const reindexedCommunities: Community[] = [];\n const newNodeToCommunity = new Map<TypedNode, number>();\n\n communities.forEach((community, newId) => {\n reindexedCommunities.push({\n id: newId,\n nodes: community.nodes,\n });\n for (const node of community.nodes) {\n newNodeToCommunity.set(node, newId);\n }\n });\n\n return {\n communities: reindexedCommunities,\n nodeToCommuntiy: newNodeToCommunity,\n };\n}\n\n/**\n * Generate HSL colors for communities.\n * Uses golden ratio to distribute hues evenly.\n */\nexport function generateCommunityColors(communityCount: number): string[] {\n const colors: string[] = [];\n const goldenRatio = 0.618033988749895;\n let hue = 0.1;\n\n for (let i = 0; i < communityCount; i++) {\n hue = (hue + goldenRatio) % 1;\n const h = Math.floor(hue * 360);\n const s = 65 + (i % 3) * 10;\n const l = 45 + (i % 2) * 10;\n colors.push(`hsl(${h}, ${s}%, ${l}%)`);\n }\n\n return colors;\n}\n\n/**\n * Generate RGBA colors for VS Code decorations.\n * Returns both background (low opacity) and foreground (high opacity) colors.\n */\nexport function generateCommunityColorsRGBA(communityCount: number): Array<{\n background: string\n foreground: string\n border: string\n}> {\n const colors: Array<{ background: string, foreground: string, border: string }> = [];\n const goldenRatio = 0.618033988749895;\n let hue = 0.1;\n\n for (let i = 0; i < communityCount; i++) {\n hue = (hue + goldenRatio) % 1;\n const h = hue * 360;\n const s = 0.45;\n const l = 0.55;\n\n const { r, g, b } = hslToRgb(h, s, l);\n\n colors.push({\n background: `rgba(${r}, ${g}, ${b}, 0.15)`,\n foreground: `rgba(${r}, ${g}, ${b}, 0.9)`,\n border: `rgba(${r}, ${g}, ${b}, 0.5)`,\n });\n }\n\n return colors;\n}\n\nfunction hslToRgb(h: number, s: number, l: number): { r: number, g: number, b: number } {\n h = h / 360;\n\n let r: number, g: number, b: number;\n\n if (s === 0) {\n r = g = b = l;\n }\n else {\n const hue2rgb = (p: number, q: number, t: number) => {\n if (t < 0) { t += 1; }\n if (t > 1) { t -= 1; }\n if (t < 1 / 6) { return p + (q - p) * 6 * t; }\n if (t < 1 / 2) { return q; }\n if (t < 2 / 3) { return p + (q - p) * (2 / 3 - t) * 6; }\n return p;\n };\n\n const q = l < 0.5\n ? l * (1 + s)\n : l + s - l * s;\n const p = 2 * l - q;\n r = hue2rgb(p, q, h + 1 / 3);\n g = hue2rgb(p, q, h);\n b = hue2rgb(p, q, h - 1 / 3);\n }\n\n return {\n r: Math.round(r * 255),\n g: Math.round(g * 255),\n b: Math.round(b * 255),\n };\n}\n","import type { RelationType, TypedNode } from '../analyze/utils';\nimport { NodeType } from '../analyze/utils';\n\n/**\n * Filter out nodes that have no indegree.\n */\nexport function noIndegreeFilter(\n graph: Map<TypedNode, Set<{ node: TypedNode, type: RelationType }>>,\n) {\n const nodes = Array.from(graph.keys());\n const indegree = new Map<TypedNode, number>();\n nodes.forEach((node) => {\n indegree.set(node, 0);\n });\n graph.forEach((targets, node) => {\n targets.forEach((target) => {\n indegree.set(target.node, (indegree.get(target.node) || 0) + 1);\n });\n });\n return nodes.filter(node => indegree.get(node) === 0);\n}\n\n/**\n * Filter out nodes that have no outdegree.\n */\nexport function noOutdegreeFilter(\n graph: Map<TypedNode, Set<TypedNode>>,\n) {\n const zeroOutdegreeNodes = [];\n\n for (const [node, edges] of graph.entries()) {\n if (edges.size === 0) {\n zeroOutdegreeNodes.push(node);\n }\n }\n\n return zeroOutdegreeNodes;\n}\n\n// ---\n\nfunction removeVariable(\n graph: Map<TypedNode, Set<TypedNode>>,\n targets: Set<TypedNode>,\n) {\n const newTarget = new Set<TypedNode>();\n targets.forEach((target) => {\n if (target.type === NodeType.var) {\n const nodes = graph.get(target);\n nodes?.forEach((node) => {\n newTarget.add(node);\n });\n }\n if (target.type === NodeType.fun) {\n newTarget.add(target);\n }\n });\n return newTarget;\n}\n\n/**\n * only save function nodes\n */\nexport function onlyFunctions(\n graph: Map<TypedNode, Set<TypedNode>>,\n): Map<TypedNode, Set<TypedNode>> {\n const result = new Map<TypedNode, Set<TypedNode>>();\n graph.forEach((targets, node) => {\n if (node.type === NodeType.fun) {\n const nodes = removeVariable(graph, targets);\n result.set(node, nodes);\n }\n });\n return result;\n}\n\n// ---\n\nexport function findLinearPaths(graph: Map<TypedNode, Set<{ node: TypedNode, type: RelationType }>>) {\n const linearPaths = [] as TypedNode[][];\n const visitedNodes = new Set<TypedNode>();\n const nodeInDegrees = new Map<TypedNode, number>();\n\n // 计算每个节点的入度\n for (const [node, edges] of graph.entries()) {\n if (!nodeInDegrees.has(node)) {\n nodeInDegrees.set(node, 0); // 确保每个节点都在入度映射中\n }\n for (const edge of edges) {\n const inDegree = nodeInDegrees.get(edge.node) || 0;\n nodeInDegrees.set(edge.node, inDegree + 1);\n }\n }\n\n function dfs(node: TypedNode, path: TypedNode[]) {\n if (visitedNodes.has(node)) {\n return;\n }\n\n path.push(node);\n visitedNodes.add(node);\n\n const edges = graph.get(node) || new Set();\n\n if (edges.size === 0 || edges.size > 1) {\n if (path.length > 1) {\n addOrUpdatePath([...path]);\n }\n }\n else {\n const nextNode = Array.from(edges)[0].node;\n const nextNodeInDegree = nodeInDegrees.get(nextNode) || 0;\n\n // 确保下一个节点只有一个入度\n if (nextNodeInDegree === 1) {\n dfs(nextNode, path);\n }\n }\n\n path.pop();\n visitedNodes.delete(node);\n }\n\n function addOrUpdatePath(newPath: TypedNode[]) {\n let shouldAddNewPath = true;\n\n for (let i = linearPaths.length - 1; i >= 0; i--) {\n const existingPath = linearPaths[i];\n if (isSubpath(existingPath, newPath)) {\n linearPaths.splice(i, 1); // remove the shorter path\n }\n else if (isSubpath(newPath, existingPath)) {\n shouldAddNewPath = false;\n break;\n }\n }\n\n if (shouldAddNewPath && newPath.length > 2) {\n linearPaths.push(newPath);\n }\n }\n\n function isSubpath(shortPath: TypedNode[], longPath: TypedNode[]) {\n if (shortPath.length >= longPath.length) {\n return false;\n }\n\n for (let i = 0; i <= longPath.length - shortPath.length; i++) {\n let isSub = true;\n for (let j = 0; j < shortPath.length; j++) {\n if (shortPath[j] !== longPath[i + j]) {\n isSub = false;\n break;\n }\n }\n if (isSub) {\n return true;\n }\n }\n return false;\n }\n\n for (const node of graph.keys()) {\n dfs(node, []);\n }\n\n return linearPaths;\n}\n\n// ---\n\nexport function findArticulationPoints(graph: Map<TypedNode, Set<{ node: TypedNode, type: RelationType }>>) {\n const noIndegreeNodes = noIndegreeFilter(graph);\n let time = 0;\n const low = new Map<TypedNode, number>();\n const disc = new Map<TypedNode, number>();\n const parent = new Map<TypedNode, TypedNode | null>();\n const ap = new Set<TypedNode>();\n const visited = new Set<TypedNode>();\n\n function APUtil(graph: Map<TypedNode, Set<{ node: TypedNode, type: RelationType }>>, node: TypedNode) {\n let children = 0;\n disc.set(node, time);\n low.set(node, time);\n time++;\n visited.add(node);\n\n for (const neighbor of graph.get(node) || []) {\n if (!visited.has(neighbor.node)) {\n children++;\n parent.set(neighbor.node, node);\n APUtil(graph, neighbor.node);\n low.set(node, Math.min(low.get(node)!, low.get(neighbor.node)!));\n if (parent.get(node) === null && children > 1) {\n ap.add(node);\n }\n if (parent.get(node) !== null && low.get(neighbor.node)! >= disc.get(node)!) {\n ap.add(node);\n }\n }\n else if (neighbor.node !== parent.get(node)) {\n low.set(node, Math.min(low.get(node)!, disc.get(neighbor.node)!));\n }\n }\n }\n\n for (const node of graph.keys()) {\n if (!visited.has(node) && !noIndegreeNodes.includes(node)) {\n APUtil(graph, node);\n }\n }\n return ap;\n}\n","import type { RelationType, TypedNode } from '../analyze/utils';\n\nfunction dfs(\n graph: Map<TypedNode, Set<{ node: TypedNode, type: RelationType }>>,\n node: TypedNode,\n targets: Set<{ node: TypedNode, type: RelationType }>,\n visited: Set<TypedNode>,\n component: Set<TypedNode>,\n) {\n component.add(node);\n visited.add(node);\n targets.forEach((target) => {\n if (!visited.has(target.node)) {\n dfs(graph, target.node, graph.get(target.node) || new Set(), visited, component);\n }\n });\n}\n\nfunction haveIntersection(setA: Set<TypedNode>, setB: Set<TypedNode>): boolean {\n for (const item of setA) {\n if (setB.has(item)) {\n return true;\n }\n }\n return false;\n}\n\nfunction mergeSets(arr: Set<TypedNode>[]): Set<TypedNode>[] {\n let result: Set<TypedNode>[] = [...arr];\n for (let i = 0; i < result.length; i++) {\n for (let j = i + 1; j < result.length; j++) {\n if (haveIntersection(result[i], result[j])) {\n const newSet = new Set([...result[i], ...result[j]]);\n result.splice(j, 1);\n result.splice(i, 1);\n result = [...result, newSet];\n return mergeSets(result);\n }\n }\n }\n return result;\n}\n\nexport function splitGraph(\n graph: Map<TypedNode, Set<{ node: TypedNode, type: RelationType }>>,\n) {\n const components = [] as Set<TypedNode>[];\n\n const sorted = Array.from(graph).sort((a, b) => b[1].size - a[1].size);\n\n (new Map(sorted)).forEach((targets, node) => {\n const visited = new Set<TypedNode>();\n if (!visited.has(node)) {\n const component = new Set<TypedNode>();\n dfs(graph, node, targets, visited, component);\n components.push(component);\n }\n });\n\n return mergeSets(components).map((component) => {\n const subGraph = new Map<TypedNode, Set<{ node: TypedNode, type: RelationType }>>();\n component.forEach((node) => {\n const targets = graph.get(node);\n if (targets) {\n subGraph.set(node, targets);\n }\n });\n return subGraph;\n });\n}\n","import type { RelationType, TypedNode } from '../analyze/utils';\n\nexport function hasCycle(\n graph: Map<TypedNode, Set<{ node: TypedNode, type: RelationType }>>,\n): { hasCycle: boolean, cycleNodes: TypedNode[] } {\n const visited: Set<TypedNode> = new Set();\n const onStack: Set<TypedNode> = new Set();\n const stack: TypedNode[] = [];\n let cycleNodes: TypedNode[] = [];\n\n function dfs(node: TypedNode): boolean {\n if (visited.has(node)) {\n if (onStack.has(node)) {\n // 只有当环中所有边都是写(set) 或全是 调用(call) 才算循环\n const idx = stack.indexOf(node);\n const cycle = stack.slice(idx);\n const allNotGet = cycle.every((curr, i) => {\n const next = cycle[(i + 1) % cycle.length];\n return Array.from(graph.get(curr) || []).some(\n edge => edge.node === next && edge.type !== 'get',\n );\n });\n\n if (allNotGet) {\n cycleNodes = cycle;\n return true;\n }\n return false;\n }\n return false;\n }\n\n visited.add(node);\n onStack.add(node);\n stack.push(node);\n\n for (const neighbor of (graph.get(node) || new Set())) {\n // 检查自环:自己依赖自己且 type 为 'set' 也算环\n if (neighbor.node === node && neighbor.type !== 'get') {\n cycleNodes = [node];\n return true;\n }\n if (dfs(neighbor.node)) {\n return true;\n }\n }\n\n onStack.delete(node);\n stack.pop();\n return false;\n }\n\n for (const [node, targets] of graph) {\n if (dfs(node)) {\n return { hasCycle: true, cycleNodes };\n }\n }\n\n return { hasCycle: false, cycleNodes: [] };\n}\n","import type { RelationType, TypedNode } from '../analyze/utils';\nimport { NodeType } from '../analyze/utils';\nimport { detectCommunities } from './community';\nimport { findArticulationPoints, findLinearPaths, noIndegreeFilter } from './filter';\nimport { splitGraph } from './split';\nimport { hasCycle } from './utils';\n\nexport enum SuggestionType {\n info = 'info',\n warning = 'warning',\n error = 'error',\n}\n\nexport interface Suggestion {\n type: SuggestionType\n message: string\n nodeInfo?: TypedNode | Array<TypedNode>\n};\n\nexport function gen(\n graph: {\n nodes: Set<TypedNode>\n edges: Map<TypedNode, Set<{ node: TypedNode, type: RelationType }>>\n },\n nodesUsedInTemplate: Set<string>,\n nodesUsedInStyle: Set<string> = new Set(),\n options?: Partial<{\n ellipsis: boolean\n communitySeed: number\n }>,\n) {\n const {\n ellipsis = true,\n communitySeed,\n } = options ?? {};\n\n const usedNodes = new Set([...nodesUsedInTemplate, ...nodesUsedInStyle]);\n\n const suggestions: Suggestion[] = [];\n const splitedGraph = splitGraph(graph.edges);\n splitedGraph.forEach((g) => {\n const nodes = Array.from(g.keys());\n\n if (splitedGraph.length > 1) {\n if (nodes.length > 2 && nodes.some(node => !usedNodes.has(node.label))) {\n suggestions.push({\n type: SuggestionType.info,\n message: `Nodes [${\n (ellipsis && nodes.length > 10)\n ? `${nodes.slice(0, 10).map(node => node.label).join(',')}...(${nodes.length})`\n : nodes.map(node => node.label).join(',')\n }] are isolated, perhaps you can refactor them to an isolated file.`,\n nodeInfo: nodes,\n });\n }\n }\n\n if (nodes.length > 1 && nodes.every(node => !usedNodes.has(node.label) && !node.info?.used?.size)) {\n suggestions.push({\n type: SuggestionType.info,\n message: `Nodes [${\n (ellipsis && nodes.length > 10)\n ? `${nodes.slice(0, 10).map(node => node.label).join(',')}...`\n : nodes.map(node => node.label).join(',')\n }] are not used, perhaps you can remove them.`,\n nodeInfo: nodes,\n });\n }\n const hasCycleResult = hasCycle(g);\n if (hasCycleResult.hasCycle) {\n suggestions.push({\n type: SuggestionType.error,\n message: `There is a loop call in nodes [${\n hasCycleResult.cycleNodes.map(node => node.label).join(',')\n }], perhaps you can refactor it.`,\n nodeInfo: hasCycleResult.cycleNodes,\n });\n }\n\n const paths = findLinearPaths(g);\n paths.forEach((path) => {\n const firstUsedNodeIndex = path.findIndex(node => usedNodes.has(node.label));\n const reverseLastNotUsedNodeIndex = path.slice().reverse().findIndex(node => !usedNodes.has(node.label));\n const lastNotUsedNodeIndex = reverseLastNotUsedNodeIndex !== -1\n ? path.length - 1 - reverseLastNotUsedNodeIndex\n : -1;\n\n if (firstUsedNodeIndex > -1 && firstUsedNodeIndex < lastNotUsedNodeIndex) {\n suggestions.push({\n type: SuggestionType.warning,\n message: `Nodes [${\n (ellipsis && path.length > 10)\n ? `${path.slice(0, 10).map(node => node.label).join(',')}...(${path.length})`\n : path.map(node => node.label).join(',')\n }] are have function chain calls, perhaps you can refactor it.`,\n nodeInfo: path,\n });\n }\n });\n\n if (g.size > 5) {\n const ap = findArticulationPoints(g);\n ap.forEach((node) => {\n if (node.type === NodeType.fun) {\n suggestions.push({\n type: SuggestionType.info,\n\n message: `Node [${\n node.label\n }] is an articulation point, perhaps you need to pay special attention to this node.`,\n nodeInfo: node,\n });\n }\n });\n }\n });\n\n const noIndegreeNodes = noIndegreeFilter(graph.edges);\n noIndegreeNodes.forEach((node) => {\n if (!usedNodes.has(node.label) && !node.info?.used?.size) {\n suggestions.push({\n type: SuggestionType.info,\n message: `Node [${node.label}] is not used, perhaps you can remove it.`,\n nodeInfo: node,\n });\n }\n });\n\n const communityResult = detectCommunities(graph.edges, { seed: communitySeed });\n const { communities } = communityResult;\n\n const extractableCommunities = communities.filter((community) => {\n const nodes = Array.from(community.nodes);\n if (nodes.length < 3 || nodes.length > 15) {\n return false;\n }\n\n const hasUsedNode = nodes.some(node => usedNodes.has(node.label));\n const hasUnusedNode = nodes.some(node => !usedNodes.has(node.label));\n\n return hasUsedNode && hasUnusedNode;\n });\n\n extractableCommunities.forEach((community) => {\n const nodes = Array.from(community.nodes);\n const unusedNodes = nodes.filter(node => !usedNodes.has(node.label));\n\n if (unusedNodes.length >= 2) {\n suggestions.push({\n type: SuggestionType.info,\n message: `Nodes [${\n (ellipsis && nodes.length > 10)\n ? `${nodes.slice(0, 10).map(node => node.label).join(',')}...(${nodes.length})`\n : nodes.map(node => node.label).join(',')\n }] form a tightly coupled group, consider extracting them into a composable/hook.`,\n nodeInfo: nodes,\n });\n }\n });\n\n if (communities.length > 3) {\n const independentCommunities = communities.filter((community) => {\n const nodes = Array.from(community.nodes);\n return nodes.length >= 2 && nodes.every(node => !usedNodes.has(node.label) && !node.info?.used?.size);\n });\n\n if (independentCommunities.length >= 2) {\n const allNodes = independentCommunities.flatMap(c => Array.from(c.nodes));\n suggestions.push({\n type: SuggestionType.info,\n message: `Found ${independentCommunities.length} independent variable groups that are not used in template. Consider removing or extracting them.`,\n nodeInfo: allNodes,\n });\n }\n }\n\n const largeCommunities = communities.filter(c => c.nodes.size > 10);\n largeCommunities.forEach((community) => {\n const nodes = Array.from(community.nodes);\n const functionNodes = nodes.filter(n => n.type === NodeType.fun);\n\n if (functionNodes.length > 5) {\n suggestions.push({\n type: SuggestionType.warning,\n message: `Community with ${nodes.length} nodes has ${functionNodes.length} functions. This group is complex, consider splitting into smaller composables.`,\n nodeInfo: nodes,\n });\n }\n });\n\n return suggestions;\n}\n","import type { Data, Edge, Node } from 'vis-network';\nimport type { RelationType, TypedNode } from './analyze/utils';\n\ntype CustomNode = Node & {\n info: TypedNode['info']\n};\n\nfunction filterNodeUserd(used: Set<string> | undefined) {\n const usedArray = Array.from(used || []);\n return new Set(usedArray.filter(u => ![\n 'Assignment Expression',\n 'Call Expression',\n ].includes(u)));\n}\n\nexport function getVisData(\n graph: {\n nodes: Set<TypedNode>\n edges: Map<TypedNode, Set<{ node: TypedNode, type: RelationType }>>\n },\n nodesUsedInTemplate: Set<string>,\n nodesUsedInStyle: Set<string> = new Set(),\n usedLabel?: string,\n) {\n const usedNodes = new Set([...nodesUsedInTemplate, ...nodesUsedInStyle]);\n\n const nodes: CustomNode[] = [];\n const edges: Edge[] = [];\n\n const inDegreeMap: Record<string, number> = {};\n const outDegreeMap: Record<string, number> = {};\n graph.edges.forEach((edge) => {\n edge.forEach((to) => {\n if (to) {\n inDegreeMap[to.node.label] = (inDegreeMap[to.node.label] || 0) + 1;\n }\n });\n });\n graph.edges.forEach((edge, key) => {\n outDegreeMap[key.label] = edge.size;\n });\n\n graph.nodes.forEach((node) => {\n const inDegree = inDegreeMap[node.label] || 0;\n const outDegree = outDegreeMap[node.label] || 0;\n\n nodes.push({\n id: node.label,\n label: node.label,\n shape: node.type === 'var'\n ? 'dot'\n : 'diamond',\n group: usedNodes.has(node.label) || node.info?.used?.size\n ? 'used'\n : 'normal',\n size: 20 + 1.6 ** ((inDegree * 0.75 + outDegree * 0.25)),\n title: `${\n filterNodeUserd(node.info?.used).size\n ? `used by ${Array.from(filterNodeUserd(node.info?.used))?.map(i => `\\`${i}\\``).join(',')}\\n\\n`\n : ''\n }${\n usedNodes.has(node.label)\n ? `used in ${\n [\n nodesUsedInStyle.has(node.label)\n ? 'style'\n : '',\n nodesUsedInTemplate.has(node.label)\n ? usedLabel || 'template'\n : '',\n ].filter(Boolean).join(' and ')\n }\\n\\n`\n : ''\n }${node.info?.comment || ''}`.trim() || undefined,\n info: node.info,\n });\n });\n\n graph.edges.forEach((edge, key) => {\n edge.forEach((to) => {\n if (!to) {\n return;\n }\n edges.push({\n from: key.label,\n to: to.node.label,\n arrows: {\n to: {\n enabled: true,\n scaleFactor: 0.8,\n },\n },\n });\n });\n });\n\n return {\n nodes,\n edges,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,IAAY,gDAAL;AACL;AACA;;;AAWF,IAAa,iBAAb,MAA4B;CAG1B,YAAY,cAAc,GAAG,WAAW,MAAM;oBAFjC;iBACH;+BAMF,IAAI;AAJV,OAAK,aAAa;AAClB,OAAK,UAAU;;CAKjB,QACE,OACA,MACA,UAA4B;EAAE,YAAY;EAAO,UAAU;EAAO,SAAS;IAC3E;AACA,MAAI,KAAK,MAAM,IAAI,OACjB;AAEF,MACG,CAAC,QAAQ,eACP,KAAK,SAAS,wBAAwB;GACrC;GACA;GACA;IACA,SAAS,KAAK,MAAM,QAAQ,OAC1B,KAAK,SAAS,oBAAoB;GACpC;GACA;GACA;IACA,SAAS,KAAK,OAAO,QAAQ,OAC5B,KAAK,SAAS,yBACd,KAAK,SAAS,kBACd,KAAK,SAAS,6BACd,KAAK,SAAS,yBAEhB,QAAQ,SAEX,MAAK,MAAM,IAAI,OAAO;GACpB;GACA,MAAM,SAAS;GACf,GAAI,KAAK,UACL,EACA,MAAM;IACJ,OAAO,KAAK,KAAK,MAAM,QAAQ,KAAK,IAAI,KAAK;IAC7C,QAAQ,KAAK,KAAK,MAAM,UAAU;IAClC,GAAG,QAAQ,UACP,EAAE,SAAS,QAAQ,YACnB;SAGN;;MAIN,MAAK,MAAM,IAAI,OAAO;GACpB;GACA,MAAM,SAAS;GACf,GAAI,KAAK,UACL,EACA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