vue-hook-optimizer 0.0.6 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
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
- - [ ] vscode extension
42
+ - [x] support `options api`
43
+ - [x] [vscode extension](./packages/vscode)
44
44
 
45
45
  ## Contribution
46
46
 
package/dist/index.d.mts CHANGED
@@ -1,7 +1,12 @@
1
1
  export { parse } from '@vue/compiler-sfc';
2
2
  import * as vis_network from 'vis-network';
3
3
 
4
- declare function analyze$1(content: string): Set<string>;
4
+ declare function analyze$2(content: string): Set<string>;
5
+
6
+ declare function analyze$1(content: string): {
7
+ nodes: Set<string>;
8
+ edges: Map<string, Set<string>>;
9
+ };
5
10
 
6
11
  declare function analyze(content: string): {
7
12
  nodes: Set<string>;
@@ -16,4 +21,4 @@ declare function getVisData(graph: {
16
21
  edges: vis_network.Edge[];
17
22
  };
18
23
 
19
- export { analyze as analyzeSetupScript, analyze$1 as analyzeTemplate, getVisData };
24
+ export { analyze as analyzeOptions, analyze$1 as analyzeSetupScript, analyze$2 as analyzeTemplate, getVisData };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,12 @@
1
1
  export { parse } from '@vue/compiler-sfc';
2
2
  import * as vis_network from 'vis-network';
3
3
 
4
- declare function analyze$1(content: string): Set<string>;
4
+ declare function analyze$2(content: string): Set<string>;
5
+
6
+ declare function analyze$1(content: string): {
7
+ nodes: Set<string>;
8
+ edges: Map<string, Set<string>>;
9
+ };
5
10
 
6
11
  declare function analyze(content: string): {
7
12
  nodes: Set<string>;
@@ -16,4 +21,4 @@ declare function getVisData(graph: {
16
21
  edges: vis_network.Edge[];
17
22
  };
18
23
 
19
- export { analyze as analyzeSetupScript, analyze$1 as analyzeTemplate, getVisData };
24
+ export { analyze as analyzeOptions, analyze$1 as analyzeSetupScript, analyze$2 as analyzeTemplate, getVisData };
package/dist/index.js CHANGED
@@ -13887,9 +13887,9 @@ var require_traverse = __commonJS({
13887
13887
  Object.defineProperty(exports, "__esModule", {
13888
13888
  value: true
13889
13889
  });
13890
- exports.default = traverse3;
13890
+ exports.default = traverse4;
13891
13891
  var _definitions = require_definitions();
13892
- function traverse3(node2, handlers, state) {
13892
+ function traverse4(node2, handlers, state) {
13893
13893
  if (typeof handlers === "function") {
13894
13894
  handlers = {
13895
13895
  enter: handlers
@@ -14646,7 +14646,7 @@ var require_lib3 = __commonJS({
14646
14646
  Object.defineProperty(exports, "traverse", {
14647
14647
  enumerable: true,
14648
14648
  get: function() {
14649
- return _traverse3.default;
14649
+ return _traverse4.default;
14650
14650
  }
14651
14651
  });
14652
14652
  Object.defineProperty(exports, "traverseFast", {
@@ -14794,18 +14794,18 @@ var require_lib3 = __commonJS({
14794
14794
  var _removeTypeDuplicates = require_removeTypeDuplicates();
14795
14795
  var _getBindingIdentifiers = require_getBindingIdentifiers();
14796
14796
  var _getOuterBindingIdentifiers = require_getOuterBindingIdentifiers();
14797
- var _traverse3 = require_traverse();
14798
- Object.keys(_traverse3).forEach(function(key) {
14797
+ var _traverse4 = require_traverse();
14798
+ Object.keys(_traverse4).forEach(function(key) {
14799
14799
  if (key === "default" || key === "__esModule")
14800
14800
  return;
14801
14801
  if (Object.prototype.hasOwnProperty.call(_exportNames, key))
14802
14802
  return;
14803
- if (key in exports && exports[key] === _traverse3[key])
14803
+ if (key in exports && exports[key] === _traverse4[key])
14804
14804
  return;
14805
14805
  Object.defineProperty(exports, key, {
14806
14806
  enumerable: true,
14807
14807
  get: function() {
14808
- return _traverse3[key];
14808
+ return _traverse4[key];
14809
14809
  }
14810
14810
  });
14811
14811
  });
@@ -42952,7 +42952,7 @@ var require_parse = __commonJS({
42952
42952
  isStatement,
42953
42953
  isStringLiteral,
42954
42954
  removePropertiesDeep,
42955
- traverse: traverse3
42955
+ traverse: traverse4
42956
42956
  } = _t;
42957
42957
  var PATTERN = /^[_$A-Z0-9]+$/;
42958
42958
  function parseAndBuildMetadata(formatter2, code, opts) {
@@ -42980,7 +42980,7 @@ var require_parse = __commonJS({
42980
42980
  placeholderPattern,
42981
42981
  syntacticPlaceholders
42982
42982
  };
42983
- traverse3(ast, placeholderVisitorHandler, state);
42983
+ traverse4(ast, placeholderVisitorHandler, state);
42984
42984
  return Object.assign({
42985
42985
  ast
42986
42986
  }, state.syntactic.placeholders.length ? state.syntactic : state.legacy);
@@ -45871,7 +45871,7 @@ var require_path = __commonJS({
45871
45871
  exports.SHOULD_STOP = SHOULD_STOP;
45872
45872
  var SHOULD_SKIP = 1 << 2;
45873
45873
  exports.SHOULD_SKIP = SHOULD_SKIP;
45874
- var NodePath = class _NodePath {
45874
+ var NodePath2 = class _NodePath {
45875
45875
  constructor(hub, parent) {
45876
45876
  this.contexts = [];
45877
45877
  this.state = null;
@@ -46011,30 +46011,30 @@ var require_path = __commonJS({
46011
46011
  }
46012
46012
  }
46013
46013
  };
46014
- Object.assign(NodePath.prototype, NodePath_ancestry, NodePath_inference, NodePath_replacement, NodePath_evaluation, NodePath_conversion, NodePath_introspection, NodePath_context, NodePath_removal, NodePath_modification, NodePath_family, NodePath_comments);
46014
+ Object.assign(NodePath2.prototype, NodePath_ancestry, NodePath_inference, NodePath_replacement, NodePath_evaluation, NodePath_conversion, NodePath_introspection, NodePath_context, NodePath_removal, NodePath_modification, NodePath_family, NodePath_comments);
46015
46015
  {
46016
- NodePath.prototype._guessExecutionStatusRelativeToDifferentFunctions = NodePath_introspection._guessExecutionStatusRelativeTo;
46016
+ NodePath2.prototype._guessExecutionStatusRelativeToDifferentFunctions = NodePath_introspection._guessExecutionStatusRelativeTo;
46017
46017
  }
46018
46018
  for (const type of t.TYPES) {
46019
46019
  const typeKey = `is${type}`;
46020
46020
  const fn = t[typeKey];
46021
- NodePath.prototype[typeKey] = function(opts) {
46021
+ NodePath2.prototype[typeKey] = function(opts) {
46022
46022
  return fn(this.node, opts);
46023
46023
  };
46024
- NodePath.prototype[`assert${type}`] = function(opts) {
46024
+ NodePath2.prototype[`assert${type}`] = function(opts) {
46025
46025
  if (!fn(this.node, opts)) {
46026
46026
  throw new TypeError(`Expected node path of type ${type}`);
46027
46027
  }
46028
46028
  };
46029
46029
  }
46030
- Object.assign(NodePath.prototype, NodePath_virtual_types_validator);
46030
+ Object.assign(NodePath2.prototype, NodePath_virtual_types_validator);
46031
46031
  for (const type of Object.keys(virtualTypes)) {
46032
46032
  if (type[0] === "_")
46033
46033
  continue;
46034
46034
  if (!t.TYPES.includes(type))
46035
46035
  t.TYPES.push(type);
46036
46036
  }
46037
- var _default = NodePath;
46037
+ var _default = NodePath2;
46038
46038
  exports.default = _default;
46039
46039
  }
46040
46040
  });
@@ -46259,7 +46259,7 @@ var require_lib13 = __commonJS({
46259
46259
  removeProperties,
46260
46260
  traverseFast
46261
46261
  } = _t;
46262
- function traverse3(parent, opts = {}, scope, state, parentPath) {
46262
+ function traverse4(parent, opts = {}, scope, state, parentPath) {
46263
46263
  if (!parent)
46264
46264
  return;
46265
46265
  if (!opts.noScope && !scope) {
@@ -46273,24 +46273,24 @@ var require_lib13 = __commonJS({
46273
46273
  visitors.explode(opts);
46274
46274
  (0, _traverseNode.traverseNode)(parent, opts, scope, state, parentPath);
46275
46275
  }
46276
- var _default = traverse3;
46276
+ var _default = traverse4;
46277
46277
  exports.default = _default;
46278
- traverse3.visitors = visitors;
46279
- traverse3.verify = visitors.verify;
46280
- traverse3.explode = visitors.explode;
46281
- traverse3.cheap = function(node2, enter) {
46278
+ traverse4.visitors = visitors;
46279
+ traverse4.verify = visitors.verify;
46280
+ traverse4.explode = visitors.explode;
46281
+ traverse4.cheap = function(node2, enter) {
46282
46282
  traverseFast(node2, enter);
46283
46283
  return;
46284
46284
  };
46285
- traverse3.node = function(node2, opts, scope, state, path2, skipKeys) {
46285
+ traverse4.node = function(node2, opts, scope, state, path2, skipKeys) {
46286
46286
  (0, _traverseNode.traverseNode)(node2, opts, scope, state, path2, skipKeys);
46287
46287
  };
46288
- traverse3.clearNode = function(node2, opts) {
46288
+ traverse4.clearNode = function(node2, opts) {
46289
46289
  removeProperties(node2, opts);
46290
46290
  cache.path.delete(node2);
46291
46291
  };
46292
- traverse3.removeProperties = function(tree, opts) {
46293
- traverseFast(tree, traverse3.clearNode, opts);
46292
+ traverse4.removeProperties = function(tree, opts) {
46293
+ traverseFast(tree, traverse4.clearNode, opts);
46294
46294
  return tree;
46295
46295
  };
46296
46296
  function hasDenylistedType(path2, state) {
@@ -46299,7 +46299,7 @@ var require_lib13 = __commonJS({
46299
46299
  path2.stop();
46300
46300
  }
46301
46301
  }
46302
- traverse3.hasType = function(tree, type, denylistTypes) {
46302
+ traverse4.hasType = function(tree, type, denylistTypes) {
46303
46303
  if (denylistTypes != null && denylistTypes.includes(tree.type))
46304
46304
  return false;
46305
46305
  if (tree.type === type)
@@ -46308,20 +46308,21 @@ var require_lib13 = __commonJS({
46308
46308
  has: false,
46309
46309
  type
46310
46310
  };
46311
- traverse3(tree, {
46311
+ traverse4(tree, {
46312
46312
  noScope: true,
46313
46313
  denylist: denylistTypes,
46314
46314
  enter: hasDenylistedType
46315
46315
  }, null, state);
46316
46316
  return state.has;
46317
46317
  };
46318
- traverse3.cache = cache;
46318
+ traverse4.cache = cache;
46319
46319
  }
46320
46320
  });
46321
46321
 
46322
46322
  // src/index.ts
46323
46323
  var src_exports = {};
46324
46324
  __export(src_exports, {
46325
+ analyzeOptions: () => analyze3,
46325
46326
  analyzeSetupScript: () => analyze2,
46326
46327
  analyzeTemplate: () => analyze,
46327
46328
  getVisData: () => getVisData,
@@ -86288,18 +86289,19 @@ function analyze2(content) {
86288
86289
  edges: /* @__PURE__ */ new Map()
86289
86290
  };
86290
86291
  traverse2(ast, {
86291
- Identifier(path2) {
86292
- const name = path2.node.name;
86293
- const scopeParent = path2.scope.parent;
86294
- const binding2 = path2.scope.getBinding(name);
86295
- if (binding2) {
86296
- if (!scopeParent && ["const", "let", "var"].includes(binding2.kind)) {
86297
- graph.nodes.add(name);
86298
- if (!graph.edges.get(name)) {
86299
- graph.edges.set(name, /* @__PURE__ */ new Set());
86292
+ VariableDeclaration(path2) {
86293
+ path2.node.declarations.forEach((declaration2) => {
86294
+ if (declaration2.id?.type === "Identifier") {
86295
+ const name = declaration2.id.name;
86296
+ const binding2 = path2.scope.getBinding(name);
86297
+ if (binding2 && path2.parent.type === "Program" && !(declaration2.init?.type === "CallExpression" && declaration2.init?.callee.type === "Identifier" && ["defineProps", "defineEmits"].includes(declaration2.init?.callee.name))) {
86298
+ graph.nodes.add(name);
86299
+ if (!graph.edges.get(name)) {
86300
+ graph.edges.set(name, /* @__PURE__ */ new Set());
86301
+ }
86300
86302
  }
86301
86303
  }
86302
- }
86304
+ });
86303
86305
  },
86304
86306
  FunctionDeclaration(path2) {
86305
86307
  const name = path2.node.id?.name;
@@ -86319,24 +86321,29 @@ function analyze2(content) {
86319
86321
  const name = path2.node.id?.name;
86320
86322
  if (name && graph.nodes.has(name)) {
86321
86323
  path2.traverse({
86322
- Identifier(path3) {
86323
- if (graph.nodes.has(path3.node.name) && path3.node.name !== name) {
86324
- 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);
86325
86328
  }
86326
86329
  }
86327
86330
  });
86328
86331
  }
86329
86332
  },
86330
- // get the relation between the variable and the function
86331
86333
  VariableDeclarator(path2) {
86332
86334
  if (path2.node.init) {
86333
- if (["CallExpression", "ArrowFunctionExpression", "FunctionDeclaration"].includes(path2.node.init.type)) {
86335
+ if ([
86336
+ "CallExpression",
86337
+ "ArrowFunctionExpression",
86338
+ "FunctionDeclaration"
86339
+ ].includes(path2.node.init.type) && path2.node.id.type === "Identifier") {
86334
86340
  const name = path2.node.id?.name;
86335
86341
  if (name && graph.nodes.has(name)) {
86336
86342
  path2.traverse({
86337
- Identifier(path3) {
86338
- if (graph.nodes.has(path3.node.name) && path3.node.name !== name) {
86339
- 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);
86340
86347
  }
86341
86348
  }
86342
86349
  });
@@ -86348,6 +86355,248 @@ function analyze2(content) {
86348
86355
  return graph;
86349
86356
  }
86350
86357
 
86358
+ // src/analyze/options.ts
86359
+ var import_traverse3 = __toESM(require_lib13());
86360
+ var traverse3 = (
86361
+ //@ts-ignore
86362
+ import_traverse3.default.default?.default || import_traverse3.default.default || import_traverse3.default
86363
+ );
86364
+ function analyze3(content) {
86365
+ const ast = parse_1$1(content, {
86366
+ sourceType: "module",
86367
+ plugins: [
86368
+ "typescript"
86369
+ ]
86370
+ });
86371
+ const graph = {
86372
+ nodes: /* @__PURE__ */ new Set(),
86373
+ edges: /* @__PURE__ */ new Map()
86374
+ };
86375
+ function process2(node2, path2) {
86376
+ traverse3(node2, {
86377
+ ObjectProperty(path1) {
86378
+ if (path2.node.declaration.type === "ObjectExpression" && path1.parent === path2.node.declaration || path2.node.declaration.type === "CallExpression" && path1.parent === path2.node.declaration.arguments[0]) {
86379
+ if (path1.node.key.type === "Identifier" && path1.node.key.name === "computed") {
86380
+ const computedNode = path1.node;
86381
+ if (computedNode.value.type === "ObjectExpression") {
86382
+ computedNode.value.properties.forEach((prop) => {
86383
+ if (prop.type === "ObjectProperty" || prop.type === "ObjectMethod") {
86384
+ if (prop.key.type === "Identifier") {
86385
+ const name = prop.key.name;
86386
+ graph.nodes.add(name);
86387
+ if (!graph.edges.get(name)) {
86388
+ graph.edges.set(name, /* @__PURE__ */ new Set());
86389
+ }
86390
+ }
86391
+ }
86392
+ });
86393
+ }
86394
+ }
86395
+ if (path1.node.key.type === "Identifier" && path1.node.key.name === "methods") {
86396
+ const methodsNode = path1.node;
86397
+ if (methodsNode.value.type === "ObjectExpression") {
86398
+ methodsNode.value.properties.forEach((prop) => {
86399
+ if (prop.type === "ObjectMethod") {
86400
+ if (prop.key.type === "Identifier") {
86401
+ const name = prop.key.name;
86402
+ graph.nodes.add(name);
86403
+ if (!graph.edges.get(name)) {
86404
+ graph.edges.set(name, /* @__PURE__ */ new Set());
86405
+ }
86406
+ }
86407
+ }
86408
+ });
86409
+ }
86410
+ }
86411
+ }
86412
+ },
86413
+ ObjectMethod(path1) {
86414
+ if (path2.node.declaration.type === "ObjectExpression" && path1.parent === path2.node.declaration || path2.node.declaration.type === "CallExpression" && path1.parent === path2.node.declaration.arguments[0]) {
86415
+ if (path1.node.key.type === "Identifier" && path1.node.key.name === "setup") {
86416
+ const setupNode = path1.node;
86417
+ const tempNodes = /* @__PURE__ */ new Set();
86418
+ const tempEdges = /* @__PURE__ */ new Map();
86419
+ traverse3(setupNode, {
86420
+ VariableDeclaration(path22) {
86421
+ path22.node.declarations.forEach((declaration2) => {
86422
+ if (declaration2.id?.type === "Identifier") {
86423
+ const name = declaration2.id.name;
86424
+ if (path22.parent == setupNode.body) {
86425
+ tempNodes.add(name);
86426
+ if (!tempEdges.get(name)) {
86427
+ tempEdges.set(name, /* @__PURE__ */ new Set());
86428
+ }
86429
+ }
86430
+ }
86431
+ });
86432
+ },
86433
+ FunctionDeclaration(path22) {
86434
+ const name = path22.node.id?.name;
86435
+ if (name) {
86436
+ if (path22.parent == setupNode.body) {
86437
+ tempNodes.add(name);
86438
+ if (!tempEdges.get(name)) {
86439
+ tempEdges.set(name, /* @__PURE__ */ new Set());
86440
+ }
86441
+ }
86442
+ }
86443
+ }
86444
+ }, path1.scope, path1);
86445
+ traverse3(setupNode, {
86446
+ FunctionDeclaration(path3) {
86447
+ const name = path3.node.id?.name;
86448
+ if (name && tempNodes.has(name)) {
86449
+ path3.traverse({
86450
+ Identifier(path4) {
86451
+ if (tempNodes.has(path4.node.name) && path4.node.name !== name) {
86452
+ tempEdges.get(name)?.add(path4.node.name);
86453
+ }
86454
+ }
86455
+ });
86456
+ }
86457
+ },
86458
+ VariableDeclarator(path3) {
86459
+ if (path3.node.init) {
86460
+ if ([
86461
+ "CallExpression",
86462
+ "ArrowFunctionExpression",
86463
+ "FunctionDeclaration"
86464
+ ].includes(path3.node.init.type) && path3.node.id.type === "Identifier") {
86465
+ const name = path3.node.id?.name;
86466
+ if (name && tempNodes.has(name)) {
86467
+ path3.traverse({
86468
+ Identifier(path4) {
86469
+ if (tempNodes.has(path4.node.name) && path4.node.name !== name) {
86470
+ tempEdges.get(name)?.add(path4.node.name);
86471
+ }
86472
+ }
86473
+ });
86474
+ }
86475
+ }
86476
+ }
86477
+ }
86478
+ }, path1.scope, path1);
86479
+ traverse3(setupNode, {
86480
+ ReturnStatement(path22) {
86481
+ if (path22.node.argument?.type === "ObjectExpression") {
86482
+ const returnNode = path22.node.argument;
86483
+ traverse3(returnNode, {
86484
+ ObjectProperty(path3) {
86485
+ if (path3.parent === returnNode) {
86486
+ if (path3.node.key.type === "Identifier") {
86487
+ const name = path3.node.key.name;
86488
+ const valName = path3.node.value.type === "Identifier" ? path3.node.value.name : "";
86489
+ if (valName && tempNodes.has(valName)) {
86490
+ graph.nodes.add(name);
86491
+ if (!graph.edges.get(name)) {
86492
+ graph.edges.set(name, /* @__PURE__ */ new Set());
86493
+ tempEdges.get(valName)?.forEach((edge) => {
86494
+ graph.edges.get(name)?.add(edge);
86495
+ });
86496
+ }
86497
+ }
86498
+ }
86499
+ }
86500
+ }
86501
+ }, path22.scope, path22);
86502
+ } else {
86503
+ console.warn("setup return type is not ObjectExpression");
86504
+ }
86505
+ }
86506
+ }, path1.scope, path1);
86507
+ }
86508
+ if (path1.node.key.type === "Identifier" && path1.node.key.name === "data") {
86509
+ const dataNode = path1.node;
86510
+ traverse3(dataNode, {
86511
+ ReturnStatement(path22) {
86512
+ if (path22.parent == dataNode.body) {
86513
+ if (path22.node.argument?.type === "ObjectExpression") {
86514
+ path22.node.argument.properties.forEach((prop) => {
86515
+ if (prop.type === "ObjectProperty") {
86516
+ if (prop.key.type === "Identifier") {
86517
+ const name = prop.key.name;
86518
+ graph.nodes.add(name);
86519
+ if (!graph.edges.get(name)) {
86520
+ graph.edges.set(name, /* @__PURE__ */ new Set());
86521
+ }
86522
+ }
86523
+ }
86524
+ });
86525
+ }
86526
+ }
86527
+ }
86528
+ }, path1.scope, path1);
86529
+ }
86530
+ }
86531
+ }
86532
+ }, path2.scope, path2);
86533
+ traverse3(node2, {
86534
+ ObjectProperty(path1) {
86535
+ if (path2.node.declaration.type === "ObjectExpression" && path1.parent === path2.node.declaration || path2.node.declaration.type === "CallExpression" && path1.parent === path2.node.declaration.arguments[0]) {
86536
+ if (path1.node.key.type === "Identifier" && path1.node.key.name === "computed") {
86537
+ const computedNode = path1.node;
86538
+ if (computedNode.value.type === "ObjectExpression") {
86539
+ computedNode.value.properties.forEach((prop) => {
86540
+ if (prop.type === "ObjectMethod" && prop.key.type === "Identifier") {
86541
+ const name = prop.key.name;
86542
+ traverse3(prop, {
86543
+ MemberExpression(path22) {
86544
+ if (path22.node.object.type === "ThisExpression" && path22.node.property.type === "Identifier") {
86545
+ graph.edges.get(name)?.add(path22.node.property.name);
86546
+ }
86547
+ }
86548
+ }, path1.scope, path1);
86549
+ }
86550
+ if (prop.type === "ObjectProperty" && prop.key.type === "Identifier" && prop.value.type === "ObjectExpression") {
86551
+ const name = prop.key.name;
86552
+ prop.value.properties.forEach((prop1) => {
86553
+ if (prop1.type === "ObjectProperty" && prop1.key.type === "Identifier" && prop1.key.name === "get") {
86554
+ traverse3(prop1, {
86555
+ MemberExpression(path22) {
86556
+ if (path22.node.object.type === "ThisExpression" && path22.node.property.type === "Identifier") {
86557
+ graph.edges.get(name)?.add(path22.node.property.name);
86558
+ }
86559
+ }
86560
+ }, path1.scope, path1);
86561
+ }
86562
+ });
86563
+ }
86564
+ });
86565
+ }
86566
+ }
86567
+ if (path1.node.key.type === "Identifier" && path1.node.key.name === "methods") {
86568
+ const methodsNode = path1.node;
86569
+ if (methodsNode.value.type === "ObjectExpression") {
86570
+ methodsNode.value.properties.forEach((prop) => {
86571
+ if (prop.type === "ObjectMethod" && prop.key.type === "Identifier") {
86572
+ const name = prop.key.name;
86573
+ traverse3(prop, {
86574
+ MemberExpression(path22) {
86575
+ if (path22.node.object.type === "ThisExpression" && path22.node.property.type === "Identifier") {
86576
+ graph.edges.get(name)?.add(path22.node.property.name);
86577
+ }
86578
+ }
86579
+ }, path1.scope, path1);
86580
+ }
86581
+ });
86582
+ }
86583
+ }
86584
+ }
86585
+ }
86586
+ }, path2.scope, path2);
86587
+ }
86588
+ traverse3(ast, {
86589
+ ExportDefaultDeclaration(path2) {
86590
+ if (path2.node.declaration.type === "ObjectExpression") {
86591
+ process2(path2.node.declaration, path2);
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") {
86593
+ process2(path2.node.declaration.arguments[0], path2);
86594
+ }
86595
+ }
86596
+ });
86597
+ return graph;
86598
+ }
86599
+
86351
86600
  // src/vis.ts
86352
86601
  function getVisData(graph, usedNodes) {
86353
86602
  const nodes = [];
@@ -86380,6 +86629,7 @@ function getVisData(graph, usedNodes) {
86380
86629
  }
86381
86630
  // Annotate the CommonJS export names for ESM import in node:
86382
86631
  0 && (module.exports = {
86632
+ analyzeOptions,
86383
86633
  analyzeSetupScript,
86384
86634
  analyzeTemplate,
86385
86635
  getVisData,