vue-hook-optimizer 0.0.7 → 0.0.8

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/README.md CHANGED
@@ -39,8 +39,8 @@ So I want to build a tool to help us analyze the code, and find the relations be
39
39
 
40
40
  - [ ] add node type and more info
41
41
  - [ ] provide some suggestions for optimization
42
- - [ ] maybe support `options api`
43
- - [x] vscode extension
42
+ - [x] support `options api`
43
+ - [x] [vscode extension](./packages/vscode)
44
44
 
45
45
  ## Contribution
46
46
 
package/dist/index.js CHANGED
@@ -86321,9 +86321,10 @@ function analyze2(content) {
86321
86321
  const name = path2.node.id?.name;
86322
86322
  if (name && graph.nodes.has(name)) {
86323
86323
  path2.traverse({
86324
- Identifier(path3) {
86325
- if (graph.nodes.has(path3.node.name) && path3.node.name !== name) {
86326
- graph.edges.get(name)?.add(path3.node.name);
86324
+ Identifier(path1) {
86325
+ const binding2 = path1.scope.getBinding(path1.node.name);
86326
+ if (graph.nodes.has(path1.node.name) && path1.node.name !== name && binding2?.scope.block.type === "Program") {
86327
+ graph.edges.get(name)?.add(path1.node.name);
86327
86328
  }
86328
86329
  }
86329
86330
  });
@@ -86339,9 +86340,10 @@ function analyze2(content) {
86339
86340
  const name = path2.node.id?.name;
86340
86341
  if (name && graph.nodes.has(name)) {
86341
86342
  path2.traverse({
86342
- Identifier(path3) {
86343
- if (graph.nodes.has(path3.node.name) && path3.node.name !== name) {
86344
- graph.edges.get(name)?.add(path3.node.name);
86343
+ Identifier(path1) {
86344
+ const binding2 = path1.scope.getBinding(path1.node.name);
86345
+ if (graph.nodes.has(path1.node.name) && path1.node.name !== name && binding2?.scope.block.type === "Program") {
86346
+ graph.edges.get(name)?.add(path1.node.name);
86345
86347
  }
86346
86348
  }
86347
86349
  });
@@ -86589,7 +86591,6 @@ function analyze3(content) {
86589
86591
  process2(path2.node.declaration, path2);
86590
86592
  } else if (path2.node.declaration.type === "CallExpression" && path2.node.declaration.callee.type === "Identifier" && path2.node.declaration.callee.name === "defineComponent" && path2.node.declaration.arguments[0].type === "ObjectExpression") {
86591
86593
  process2(path2.node.declaration.arguments[0], path2);
86592
- console.log(graph);
86593
86594
  }
86594
86595
  }
86595
86596
  });