vue-hook-optimizer 0.0.58 → 0.0.59
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.js +13 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
@@ -2024,6 +2024,9 @@ function findLinearPaths(graph) {
|
|
2024
2024
|
const visitedNodes = /* @__PURE__ */ new Set();
|
2025
2025
|
const nodeInDegrees = /* @__PURE__ */ new Map();
|
2026
2026
|
for (const [node, edges] of graph.entries()) {
|
2027
|
+
if (!nodeInDegrees.has(node)) {
|
2028
|
+
nodeInDegrees.set(node, 0);
|
2029
|
+
}
|
2027
2030
|
for (const edge of edges) {
|
2028
2031
|
const inDegree = nodeInDegrees.get(edge) || 0;
|
2029
2032
|
nodeInDegrees.set(edge, inDegree + 1);
|
@@ -2201,11 +2204,16 @@ function gen(graph, nodesUsedInTemplate, nodesUsedInStyle = /* @__PURE__ */ new
|
|
2201
2204
|
}
|
2202
2205
|
const paths = findLinearPaths(g);
|
2203
2206
|
paths.forEach((path) => {
|
2204
|
-
|
2205
|
-
|
2206
|
-
|
2207
|
-
|
2208
|
-
|
2207
|
+
const firstUsedNodeIndex = path.findIndex((node) => usedNodes.has(node.label));
|
2208
|
+
const reverseLastNotUsedNodeIndex = path.slice().reverse().findIndex((node) => !usedNodes.has(node.label));
|
2209
|
+
const lastNotUsedNodeIndex = reverseLastNotUsedNodeIndex !== -1 ? path.length - 1 - reverseLastNotUsedNodeIndex : -1;
|
2210
|
+
if (firstUsedNodeIndex > -1 && firstUsedNodeIndex < lastNotUsedNodeIndex) {
|
2211
|
+
suggestions.push({
|
2212
|
+
type: "warning" /* warning */,
|
2213
|
+
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.`,
|
2214
|
+
nodeInfo: path
|
2215
|
+
});
|
2216
|
+
}
|
2209
2217
|
});
|
2210
2218
|
if (g.size > 5) {
|
2211
2219
|
const ap = findArticulationPoints(g);
|