vue-hook-optimizer 0.0.62 → 0.0.64

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -2288,12 +2288,27 @@ function getVisData(graph, nodesUsedInTemplate, nodesUsedInStyle = /* @__PURE__
2288
2288
  const usedNodes = /* @__PURE__ */ new Set([...nodesUsedInTemplate, ...nodesUsedInStyle]);
2289
2289
  const nodes = [];
2290
2290
  const edges = [];
2291
+ const inDegreeMap = {};
2292
+ const outDegreeMap = {};
2293
+ graph.edges.forEach((edge) => {
2294
+ edge.forEach((to) => {
2295
+ if (to) {
2296
+ inDegreeMap[to.label] = (inDegreeMap[to.label] || 0) + 1;
2297
+ }
2298
+ });
2299
+ });
2300
+ graph.edges.forEach((edge, key) => {
2301
+ outDegreeMap[key.label] = edge.size;
2302
+ });
2291
2303
  graph.nodes.forEach((node) => {
2304
+ const inDegree = inDegreeMap[node.label] || 0;
2305
+ const outDegree = outDegreeMap[node.label] || 0;
2292
2306
  nodes.push({
2293
2307
  id: node.label,
2294
2308
  label: node.label,
2295
2309
  shape: node.type === "var" ? "dot" : "diamond",
2296
2310
  group: usedNodes.has(node.label) || node.info?.used?.size ? "used" : "normal",
2311
+ size: 20 + 1.6 ** (inDegree * 0.75 + outDegree * 0.25),
2297
2312
  title: `${filterNodeUserd(node.info?.used).size ? `used by ${Array.from(filterNodeUserd(node.info?.used))?.map((i) => `\`${i}\``).join(",")}
2298
2313
 
2299
2314
  ` : ""}${usedNodes.has(node.label) ? `used in ${[