vue-hook-optimizer 0.0.58 → 0.0.59

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.mjs CHANGED
@@ -1981,6 +1981,9 @@ function findLinearPaths(graph) {
1981
1981
  const visitedNodes = /* @__PURE__ */ new Set();
1982
1982
  const nodeInDegrees = /* @__PURE__ */ new Map();
1983
1983
  for (const [node, edges] of graph.entries()) {
1984
+ if (!nodeInDegrees.has(node)) {
1985
+ nodeInDegrees.set(node, 0);
1986
+ }
1984
1987
  for (const edge of edges) {
1985
1988
  const inDegree = nodeInDegrees.get(edge) || 0;
1986
1989
  nodeInDegrees.set(edge, inDegree + 1);
@@ -2158,11 +2161,16 @@ function gen(graph, nodesUsedInTemplate, nodesUsedInStyle = /* @__PURE__ */ new
2158
2161
  }
2159
2162
  const paths = findLinearPaths(g);
2160
2163
  paths.forEach((path) => {
2161
- suggestions.push({
2162
- type: "warning" /* warning */,
2163
- message: `Nodes [${path.length > 10 ? `${path.slice(0, 10).map((node) => node.label).join(",")}...(${path.length})` : path.map((node) => node.label).join(",")}] are have function chain calls, perhaps you can refactor it.`,
2164
- nodeInfo: path
2165
- });
2164
+ const firstUsedNodeIndex = path.findIndex((node) => usedNodes.has(node.label));
2165
+ const reverseLastNotUsedNodeIndex = path.slice().reverse().findIndex((node) => !usedNodes.has(node.label));
2166
+ const lastNotUsedNodeIndex = reverseLastNotUsedNodeIndex !== -1 ? path.length - 1 - reverseLastNotUsedNodeIndex : -1;
2167
+ if (firstUsedNodeIndex > -1 && firstUsedNodeIndex < lastNotUsedNodeIndex) {
2168
+ suggestions.push({
2169
+ type: "warning" /* warning */,
2170
+ message: `Nodes [${path.length > 10 ? `${path.slice(0, 10).map((node) => node.label).join(",")}...(${path.length})` : path.map((node) => node.label).join(",")}] are have function chain calls, perhaps you can refactor it.`,
2171
+ nodeInfo: path
2172
+ });
2173
+ }
2166
2174
  });
2167
2175
  if (g.size > 5) {
2168
2176
  const ap = findArticulationPoints(g);