vue-hook-optimizer 0.0.83 → 0.0.84

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 CHANGED
@@ -1802,7 +1802,6 @@ function buildWeightedGraph(graph, options = {}) {
1802
1802
  const { semanticWeight = 1, similarityThreshold = .3 } = options;
1803
1803
  const weighted = /* @__PURE__ */ new Map();
1804
1804
  const allNodes = /* @__PURE__ */ new Set();
1805
- const connectedPairs = /* @__PURE__ */ new Set();
1806
1805
  for (const [node, edges] of graph) {
1807
1806
  allNodes.add(node);
1808
1807
  for (const edge of edges) allNodes.add(edge.node);
@@ -1814,8 +1813,6 @@ function buildWeightedGraph(graph, options = {}) {
1814
1813
  weighted.get(node).set(edge.node, Math.max(currentWeight, structuralWeight));
1815
1814
  const reverseWeight = weighted.get(edge.node).get(node) || 0;
1816
1815
  weighted.get(edge.node).set(node, Math.max(reverseWeight, structuralWeight));
1817
- const pairKey = [node.label, edge.node.label].sort().join("|");
1818
- connectedPairs.add(pairKey);
1819
1816
  }
1820
1817
  if (semanticWeight > 0) {
1821
1818
  const nodeWordsCache = /* @__PURE__ */ new Map();
@@ -1842,14 +1839,11 @@ function buildWeightedGraph(graph, options = {}) {
1842
1839
  const wordsB = nodeWordsCache.get(nodeB);
1843
1840
  const similarity = calculateSemanticSimilarityCached(nodeA.label, nodeB.label, wordsA, wordsB);
1844
1841
  if (similarity > similarityThreshold) {
1845
- const isConnected = connectedPairs.has(comparedKey);
1846
1842
  const semanticEdgeWeight = similarity * semanticWeight;
1847
- const currentAB = weighted.get(nodeA).get(nodeB) || 0;
1848
- const newWeightAB = isConnected ? Math.max(currentAB, semanticEdgeWeight) : currentAB + semanticEdgeWeight;
1849
- weighted.get(nodeA).set(nodeB, Math.min(newWeightAB, 2));
1850
- const currentBA = weighted.get(nodeB).get(nodeA) || 0;
1851
- const newWeightBA = isConnected ? Math.max(currentBA, semanticEdgeWeight) : currentBA + semanticEdgeWeight;
1852
- weighted.get(nodeB).set(nodeA, Math.min(newWeightBA, 2));
1843
+ const currentAB = weighted.get(nodeA).get(nodeB);
1844
+ if (typeof currentAB === "number") weighted.get(nodeA).set(nodeB, Math.min(Math.max(currentAB, semanticEdgeWeight), 2));
1845
+ const currentBA = weighted.get(nodeB).get(nodeA);
1846
+ if (typeof currentBA === "number") weighted.get(nodeB).set(nodeA, Math.min(Math.max(currentBA, semanticEdgeWeight), 2));
1853
1847
  }
1854
1848
  }
1855
1849
  }