vue-hook-optimizer 0.0.43 → 0.0.45
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +6 -5
- package/dist/index.d.mts +12 -10
- package/dist/index.d.ts +12 -10
- package/dist/index.js +672 -48084
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +641 -48081
- package/dist/index.mjs.map +1 -1
- package/package.json +38 -37
package/README.md
CHANGED
@@ -16,7 +16,6 @@ pnpm run play
|
|
16
16
|
|
17
17
|
Open the browser and visit `http://localhost:3000/`.
|
18
18
|
|
19
|
-
|
20
19
|
## How To Use
|
21
20
|
|
22
21
|
1. paste your component code into the editor
|
@@ -29,13 +28,15 @@ The tool will analyze the code, and show the relations between the variables and
|
|
29
28
|
|
30
29
|
## Motive
|
31
30
|
|
32
|
-
Sometime we have to refactor the code, maybe there are thousands of lines of code in one file.
|
31
|
+
Sometime we have to refactor the code, maybe there are thousands of lines of code in one file.
|
32
|
+
And it is too complex and hard to understand.
|
33
33
|
|
34
|
-
So I want to build a tool to help us analyze the code, and find the relations between the variables and the methods.
|
34
|
+
So I want to build a tool to help us analyze the code, and find the relations between the variables and the methods.
|
35
|
+
We can find out some variables are isolated, and some methods are over-association, and then we can refactor them.
|
35
36
|
|
36
37
|
## Development Plan
|
37
38
|
|
38
|
-
- [
|
39
|
+
- [x] add more info, including the variable type, comment, whether has been used in template or hook methods
|
39
40
|
- [x] provide some suggestions for optimization
|
40
41
|
- [x] support `options api`
|
41
42
|
- [x] [vscode extension](./packages/vscode)
|
@@ -43,7 +44,7 @@ So I want to build a tool to help us analyze the code, and find the relations be
|
|
43
44
|
|
44
45
|
## Contribution
|
45
46
|
|
46
|
-
Any contributions are welcome.
|
47
|
+
Any contributions are welcome.
|
47
48
|
|
48
49
|
## Sponsor Me
|
49
50
|
|
package/dist/index.d.mts
CHANGED
@@ -3,15 +3,16 @@ import { Edge, Node } from 'vis-network';
|
|
3
3
|
|
4
4
|
declare function analyze$3(content: string): Set<string>;
|
5
5
|
|
6
|
-
|
6
|
+
interface TypedNode {
|
7
7
|
label: string;
|
8
8
|
type: NodeType;
|
9
9
|
info?: Partial<{
|
10
10
|
line: number;
|
11
11
|
column: number;
|
12
12
|
comment: string;
|
13
|
+
used: Set<string>;
|
13
14
|
}>;
|
14
|
-
}
|
15
|
+
}
|
15
16
|
declare enum NodeType {
|
16
17
|
var = "var",
|
17
18
|
fun = "fun"
|
@@ -30,23 +31,24 @@ declare function analyze$1(content: string, lineOffset?: number, jsx?: boolean):
|
|
30
31
|
nodesUsedInTemplate: Set<string>;
|
31
32
|
};
|
32
33
|
|
33
|
-
declare function analyze(content: string, type?: "vue" | "react", lineOffset?: number, addInfo?: boolean):
|
34
|
+
declare function analyze(content: string, type?: "vue" | "react", lineOffset?: number, addInfo?: boolean): {
|
34
35
|
graph: {
|
35
36
|
nodes: Set<TypedNode>;
|
36
37
|
edges: Map<TypedNode, Set<TypedNode>>;
|
37
38
|
};
|
38
39
|
nodesUsedInTemplate: Set<string>;
|
39
|
-
}
|
40
|
+
};
|
40
41
|
|
41
42
|
declare enum SuggestionType {
|
42
|
-
|
43
|
-
|
44
|
-
|
43
|
+
info = "info",
|
44
|
+
warning = "warning",
|
45
|
+
error = "error"
|
45
46
|
}
|
46
|
-
|
47
|
+
interface Suggestion {
|
47
48
|
type: SuggestionType;
|
48
49
|
message: string;
|
49
|
-
|
50
|
+
nodeInfo?: TypedNode | Array<TypedNode>;
|
51
|
+
}
|
50
52
|
declare function gen(graph: {
|
51
53
|
nodes: Set<TypedNode>;
|
52
54
|
edges: Map<TypedNode, Set<TypedNode>>;
|
@@ -63,4 +65,4 @@ declare function getVisData(graph: {
|
|
63
65
|
edges: Edge[];
|
64
66
|
};
|
65
67
|
|
66
|
-
export { NodeType, Suggestion, SuggestionType, TypedNode, analyze$1 as analyzeOptions, analyze$2 as analyzeSetupScript, analyze$3 as analyzeTemplate, analyze as analyzeTsx, gen, getVisData };
|
68
|
+
export { NodeType, type Suggestion, SuggestionType, type TypedNode, analyze$1 as analyzeOptions, analyze$2 as analyzeSetupScript, analyze$3 as analyzeTemplate, analyze as analyzeTsx, gen, getVisData };
|
package/dist/index.d.ts
CHANGED
@@ -3,15 +3,16 @@ import { Edge, Node } from 'vis-network';
|
|
3
3
|
|
4
4
|
declare function analyze$3(content: string): Set<string>;
|
5
5
|
|
6
|
-
|
6
|
+
interface TypedNode {
|
7
7
|
label: string;
|
8
8
|
type: NodeType;
|
9
9
|
info?: Partial<{
|
10
10
|
line: number;
|
11
11
|
column: number;
|
12
12
|
comment: string;
|
13
|
+
used: Set<string>;
|
13
14
|
}>;
|
14
|
-
}
|
15
|
+
}
|
15
16
|
declare enum NodeType {
|
16
17
|
var = "var",
|
17
18
|
fun = "fun"
|
@@ -30,23 +31,24 @@ declare function analyze$1(content: string, lineOffset?: number, jsx?: boolean):
|
|
30
31
|
nodesUsedInTemplate: Set<string>;
|
31
32
|
};
|
32
33
|
|
33
|
-
declare function analyze(content: string, type?: "vue" | "react", lineOffset?: number, addInfo?: boolean):
|
34
|
+
declare function analyze(content: string, type?: "vue" | "react", lineOffset?: number, addInfo?: boolean): {
|
34
35
|
graph: {
|
35
36
|
nodes: Set<TypedNode>;
|
36
37
|
edges: Map<TypedNode, Set<TypedNode>>;
|
37
38
|
};
|
38
39
|
nodesUsedInTemplate: Set<string>;
|
39
|
-
}
|
40
|
+
};
|
40
41
|
|
41
42
|
declare enum SuggestionType {
|
42
|
-
|
43
|
-
|
44
|
-
|
43
|
+
info = "info",
|
44
|
+
warning = "warning",
|
45
|
+
error = "error"
|
45
46
|
}
|
46
|
-
|
47
|
+
interface Suggestion {
|
47
48
|
type: SuggestionType;
|
48
49
|
message: string;
|
49
|
-
|
50
|
+
nodeInfo?: TypedNode | Array<TypedNode>;
|
51
|
+
}
|
50
52
|
declare function gen(graph: {
|
51
53
|
nodes: Set<TypedNode>;
|
52
54
|
edges: Map<TypedNode, Set<TypedNode>>;
|
@@ -63,4 +65,4 @@ declare function getVisData(graph: {
|
|
63
65
|
edges: Edge[];
|
64
66
|
};
|
65
67
|
|
66
|
-
export { NodeType, Suggestion, SuggestionType, TypedNode, analyze$1 as analyzeOptions, analyze$2 as analyzeSetupScript, analyze$3 as analyzeTemplate, analyze as analyzeTsx, gen, getVisData };
|
68
|
+
export { NodeType, type Suggestion, SuggestionType, type TypedNode, analyze$1 as analyzeOptions, analyze$2 as analyzeSetupScript, analyze$3 as analyzeTemplate, analyze as analyzeTsx, gen, getVisData };
|