vue-hook-optimizer 0.0.77 → 0.0.78
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.
- package/dist/index.cjs +2016 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +109 -0
- package/dist/index.d.ts +82 -71
- package/dist/index.js +1874 -2442
- package/dist/index.js.map +1 -1
- package/package.json +11 -23
- package/README.md +0 -59
- package/dist/index.d.mts +0 -98
- package/dist/index.mjs +0 -2500
- package/dist/index.mjs.map +0 -1
- package/license +0 -1
@@ -0,0 +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","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/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';\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 { 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) {\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 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 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 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 noOutdegreeNodes = noOutdegreeFilter(graph.edges);\n // noOutdegreeNodes.forEach(node => {\n // if(!usedNodes.has(node.label)) {\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 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;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C7C,OAAM,MAAM,SAAS,SAAS;AAC5B,OAAK,SAAS,OAAO;AACnB,OAAI,GACF,aAAY,GAAG,KAAK,UAAU,YAAY,GAAG,KAAK,UAAU,KAAK;;;AAIvE,OAAM,MAAM,SAAS,MAAM,QAAQ;AACjC,eAAa,IAAI,SAAS,KAAK;;AAGjC,OAAM,MAAM,SAAS,SAAS;EAC5B,MAAM,WAAW,YAAY,KAAK,UAAU;EAC5C,MAAM,YAAY,aAAa,KAAK,UAAU;AAE9C,QAAM,KAAK;GACT,IAAI,KAAK;GACT,OAAO,KAAK;GACZ,OAAO,KAAK,SAAS,QACjB,QACA;GACJ,OAAO,UAAU,IAAI,KAAK,UAAU,KAAK,MAAM,MAAM,OACjD,SACA;GACJ,MAAM,KAAK,QAAS,WAAW,MAAO,YAAY;GAClD,OAAO,GACL,gBAAgB,KAAK,MAAM,MAAM,OAC7B,WAAW,MAAM,KAAK,gBAAgB,KAAK,MAAM,QAAQ,KAAI,MAAK,KAAK,EAAE,KAAK,KAAK,KAAK,QACxF,KAEJ,UAAU,IAAI,KAAK,SACf,WACA,CACE,iBAAiB,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"}
|
package/dist/index.d.cts
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
import "@babel/traverse";
|
2
|
+
import "@babel/types";
|
3
|
+
import { SFCStyleBlock, parse } from "@vue/compiler-sfc";
|
4
|
+
import { Edge, Node } from "vis-network";
|
5
|
+
|
6
|
+
//#region src/analyze/utils.d.ts
|
7
|
+
interface TypedNode {
|
8
|
+
label: string;
|
9
|
+
type: NodeType;
|
10
|
+
info?: Partial<{
|
11
|
+
line: number;
|
12
|
+
column: number;
|
13
|
+
comment: string;
|
14
|
+
used: Set<string>;
|
15
|
+
}>;
|
16
|
+
}
|
17
|
+
declare enum NodeType {
|
18
|
+
var = "var",
|
19
|
+
fun = "fun",
|
20
|
+
}
|
21
|
+
type RelationType = 'get' | 'set' | 'call';
|
22
|
+
//#endregion
|
23
|
+
//#region src/analyze/options.d.ts
|
24
|
+
declare function analyze(content: string, lineOffset?: number, jsx?: boolean): {
|
25
|
+
graph: {
|
26
|
+
nodes: Set<TypedNode>;
|
27
|
+
edges: Map<TypedNode, Set<{
|
28
|
+
node: TypedNode;
|
29
|
+
type: RelationType;
|
30
|
+
}>>;
|
31
|
+
};
|
32
|
+
nodesUsedInTemplate: Set<string>;
|
33
|
+
};
|
34
|
+
//#endregion
|
35
|
+
//#region src/analyze/setupScript.d.ts
|
36
|
+
declare function analyze$1(content: string, lineOffset?: number, jsx?: boolean): {
|
37
|
+
nodes: Set<TypedNode>;
|
38
|
+
edges: Map<TypedNode, Set<{
|
39
|
+
node: TypedNode;
|
40
|
+
type: RelationType;
|
41
|
+
}>>;
|
42
|
+
};
|
43
|
+
//#endregion
|
44
|
+
//#region src/analyze/style.d.ts
|
45
|
+
declare function analyze$2(styles: SFCStyleBlock[]): Set<string>;
|
46
|
+
//#endregion
|
47
|
+
//#region src/analyze/template.d.ts
|
48
|
+
declare function analyze$3(content: string): Set<string>;
|
49
|
+
//#endregion
|
50
|
+
//#region src/analyze/tsx.d.ts
|
51
|
+
declare function analyze$4(content: string, type?: "vue" | "react", lineOffset?: number, addInfo?: boolean): {
|
52
|
+
graph: {
|
53
|
+
nodes: Set<TypedNode>;
|
54
|
+
edges: Map<TypedNode, Set<{
|
55
|
+
node: TypedNode;
|
56
|
+
type: RelationType;
|
57
|
+
}>>;
|
58
|
+
};
|
59
|
+
nodesUsedInTemplate: Set<string>;
|
60
|
+
};
|
61
|
+
//#endregion
|
62
|
+
//#region src/mermaid.d.ts
|
63
|
+
interface MermaidOptions {
|
64
|
+
direction?: 'TB' | 'BT' | 'LR' | 'RL';
|
65
|
+
}
|
66
|
+
declare function getMermaidText(graph: {
|
67
|
+
nodes: Set<TypedNode>;
|
68
|
+
edges: Map<TypedNode, Set<{
|
69
|
+
node: TypedNode;
|
70
|
+
type: RelationType;
|
71
|
+
}>>;
|
72
|
+
}, nodesUsedInTemplate: Set<string>, nodesUsedInStyle?: Set<string>, options?: MermaidOptions): string;
|
73
|
+
//#endregion
|
74
|
+
//#region src/suggest/index.d.ts
|
75
|
+
declare enum SuggestionType {
|
76
|
+
info = "info",
|
77
|
+
warning = "warning",
|
78
|
+
error = "error",
|
79
|
+
}
|
80
|
+
interface Suggestion {
|
81
|
+
type: SuggestionType;
|
82
|
+
message: string;
|
83
|
+
nodeInfo?: TypedNode | Array<TypedNode>;
|
84
|
+
}
|
85
|
+
declare function gen(graph: {
|
86
|
+
nodes: Set<TypedNode>;
|
87
|
+
edges: Map<TypedNode, Set<{
|
88
|
+
node: TypedNode;
|
89
|
+
type: RelationType;
|
90
|
+
}>>;
|
91
|
+
}, nodesUsedInTemplate: Set<string>, nodesUsedInStyle?: Set<string>): Suggestion[];
|
92
|
+
//#endregion
|
93
|
+
//#region src/vis.d.ts
|
94
|
+
type CustomNode = Node & {
|
95
|
+
info: TypedNode['info'];
|
96
|
+
};
|
97
|
+
declare function getVisData(graph: {
|
98
|
+
nodes: Set<TypedNode>;
|
99
|
+
edges: Map<TypedNode, Set<{
|
100
|
+
node: TypedNode;
|
101
|
+
type: RelationType;
|
102
|
+
}>>;
|
103
|
+
}, nodesUsedInTemplate: Set<string>, nodesUsedInStyle?: Set<string>): {
|
104
|
+
nodes: CustomNode[];
|
105
|
+
edges: Edge[];
|
106
|
+
};
|
107
|
+
//#endregion
|
108
|
+
export { type NodeType, type RelationType, Suggestion, SuggestionType, type TypedNode, analyze as analyzeOptions, analyze$1 as analyzeSetupScript, analyze$2 as analyzeStyle, analyze$3 as analyzeTemplate, analyze$4 as analyzeTsx, gen, getMermaidText, getVisData, parse };
|
109
|
+
//# sourceMappingURL=index.d.cts.map
|