vue-hook-optimizer 0.0.78 → 0.0.80
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 +5 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
@@ -1888,7 +1888,8 @@ let SuggestionType = /* @__PURE__ */ function(SuggestionType$1) {
|
|
1888
1888
|
SuggestionType$1["error"] = "error";
|
1889
1889
|
return SuggestionType$1;
|
1890
1890
|
}({});
|
1891
|
-
function gen(graph, nodesUsedInTemplate, nodesUsedInStyle = /* @__PURE__ */ new Set()) {
|
1891
|
+
function gen(graph, nodesUsedInTemplate, nodesUsedInStyle = /* @__PURE__ */ new Set(), options) {
|
1892
|
+
const { ellipsis = true } = options ?? {};
|
1892
1893
|
const usedNodes = new Set([...nodesUsedInTemplate, ...nodesUsedInStyle]);
|
1893
1894
|
const suggestions = [];
|
1894
1895
|
const splitedGraph = splitGraph(graph.edges);
|
@@ -1897,13 +1898,13 @@ function gen(graph, nodesUsedInTemplate, nodesUsedInStyle = /* @__PURE__ */ new
|
|
1897
1898
|
if (splitedGraph.length > 1) {
|
1898
1899
|
if (nodes.length > 2 && nodes.some((node) => !usedNodes.has(node.label))) suggestions.push({
|
1899
1900
|
type: SuggestionType.info,
|
1900
|
-
message: `Nodes [${nodes.length > 10 ? `${nodes.slice(0, 10).map((node) => node.label).join(",")}...(${nodes.length})` : nodes.map((node) => node.label).join(",")}] are isolated, perhaps you can refactor them to an isolated file.`,
|
1901
|
+
message: `Nodes [${ellipsis && nodes.length > 10 ? `${nodes.slice(0, 10).map((node) => node.label).join(",")}...(${nodes.length})` : nodes.map((node) => node.label).join(",")}] are isolated, perhaps you can refactor them to an isolated file.`,
|
1901
1902
|
nodeInfo: nodes
|
1902
1903
|
});
|
1903
1904
|
}
|
1904
1905
|
if (nodes.length > 1 && nodes.every((node) => !usedNodes.has(node.label) && !node.info?.used?.size)) suggestions.push({
|
1905
1906
|
type: SuggestionType.info,
|
1906
|
-
message: `Nodes [${nodes.length > 10 ? `${nodes.slice(0, 10).map((node) => node.label).join(",")}...` : nodes.map((node) => node.label).join(",")}] are not used, perhaps you can remove them.`,
|
1907
|
+
message: `Nodes [${ellipsis && nodes.length > 10 ? `${nodes.slice(0, 10).map((node) => node.label).join(",")}...` : nodes.map((node) => node.label).join(",")}] are not used, perhaps you can remove them.`,
|
1907
1908
|
nodeInfo: nodes
|
1908
1909
|
});
|
1909
1910
|
const hasCycleResult = hasCycle(g);
|
@@ -1919,7 +1920,7 @@ function gen(graph, nodesUsedInTemplate, nodesUsedInStyle = /* @__PURE__ */ new
|
|
1919
1920
|
const lastNotUsedNodeIndex = reverseLastNotUsedNodeIndex !== -1 ? path.length - 1 - reverseLastNotUsedNodeIndex : -1;
|
1920
1921
|
if (firstUsedNodeIndex > -1 && firstUsedNodeIndex < lastNotUsedNodeIndex) suggestions.push({
|
1921
1922
|
type: SuggestionType.warning,
|
1922
|
-
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.`,
|
1923
|
+
message: `Nodes [${ellipsis && 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.`,
|
1923
1924
|
nodeInfo: path
|
1924
1925
|
});
|
1925
1926
|
});
|