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.d.cts
CHANGED
@@ -88,7 +88,9 @@ declare function gen(graph: {
|
|
88
88
|
node: TypedNode;
|
89
89
|
type: RelationType;
|
90
90
|
}>>;
|
91
|
-
}, nodesUsedInTemplate: Set<string>, nodesUsedInStyle?: Set<string
|
91
|
+
}, nodesUsedInTemplate: Set<string>, nodesUsedInStyle?: Set<string>, options?: Partial<{
|
92
|
+
ellipsis: boolean;
|
93
|
+
}>): Suggestion[];
|
92
94
|
//#endregion
|
93
95
|
//#region src/vis.d.ts
|
94
96
|
type CustomNode = Node & {
|
package/dist/index.d.ts
CHANGED
@@ -88,7 +88,9 @@ declare function gen(graph: {
|
|
88
88
|
node: TypedNode;
|
89
89
|
type: RelationType;
|
90
90
|
}>>;
|
91
|
-
}, nodesUsedInTemplate: Set<string>, nodesUsedInStyle?: Set<string
|
91
|
+
}, nodesUsedInTemplate: Set<string>, nodesUsedInStyle?: Set<string>, options?: Partial<{
|
92
|
+
ellipsis: boolean;
|
93
|
+
}>): Suggestion[];
|
92
94
|
//#endregion
|
93
95
|
//#region src/vis.d.ts
|
94
96
|
type CustomNode = Node & {
|
package/dist/index.js
CHANGED
@@ -1865,7 +1865,8 @@ let SuggestionType = /* @__PURE__ */ function(SuggestionType$1) {
|
|
1865
1865
|
SuggestionType$1["error"] = "error";
|
1866
1866
|
return SuggestionType$1;
|
1867
1867
|
}({});
|
1868
|
-
function gen(graph, nodesUsedInTemplate, nodesUsedInStyle = /* @__PURE__ */ new Set()) {
|
1868
|
+
function gen(graph, nodesUsedInTemplate, nodesUsedInStyle = /* @__PURE__ */ new Set(), options) {
|
1869
|
+
const { ellipsis = true } = options ?? {};
|
1869
1870
|
const usedNodes = new Set([...nodesUsedInTemplate, ...nodesUsedInStyle]);
|
1870
1871
|
const suggestions = [];
|
1871
1872
|
const splitedGraph = splitGraph(graph.edges);
|
@@ -1874,13 +1875,13 @@ function gen(graph, nodesUsedInTemplate, nodesUsedInStyle = /* @__PURE__ */ new
|
|
1874
1875
|
if (splitedGraph.length > 1) {
|
1875
1876
|
if (nodes.length > 2 && nodes.some((node) => !usedNodes.has(node.label))) suggestions.push({
|
1876
1877
|
type: SuggestionType.info,
|
1877
|
-
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.`,
|
1878
|
+
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.`,
|
1878
1879
|
nodeInfo: nodes
|
1879
1880
|
});
|
1880
1881
|
}
|
1881
1882
|
if (nodes.length > 1 && nodes.every((node) => !usedNodes.has(node.label) && !node.info?.used?.size)) suggestions.push({
|
1882
1883
|
type: SuggestionType.info,
|
1883
|
-
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.`,
|
1884
|
+
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.`,
|
1884
1885
|
nodeInfo: nodes
|
1885
1886
|
});
|
1886
1887
|
const hasCycleResult = hasCycle(g);
|
@@ -1896,7 +1897,7 @@ function gen(graph, nodesUsedInTemplate, nodesUsedInStyle = /* @__PURE__ */ new
|
|
1896
1897
|
const lastNotUsedNodeIndex = reverseLastNotUsedNodeIndex !== -1 ? path.length - 1 - reverseLastNotUsedNodeIndex : -1;
|
1897
1898
|
if (firstUsedNodeIndex > -1 && firstUsedNodeIndex < lastNotUsedNodeIndex) suggestions.push({
|
1898
1899
|
type: SuggestionType.warning,
|
1899
|
-
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.`,
|
1900
|
+
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.`,
|
1900
1901
|
nodeInfo: path
|
1901
1902
|
});
|
1902
1903
|
});
|