vue-hook-optimizer 0.0.5
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/README.md +54 -0
- package/dist/index.d.mts +19 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +86402 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +86392 -0
- package/dist/index.mjs.map +1 -0
- package/license +1 -0
- package/package.json +70 -0
package/README.md
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
[中文文档](./README_cn.md)
|
2
|
+
|
3
|
+
This is a tool to analyze your `vue` code.
|
4
|
+
|
5
|
+
## Install And Run Playground
|
6
|
+
|
7
|
+
```bash
|
8
|
+
# clone the repo then install the dependencies
|
9
|
+
pnpm install
|
10
|
+
# run the playground
|
11
|
+
pnpm run play
|
12
|
+
```
|
13
|
+
|
14
|
+
Open the browser and visit `http://localhost:3000/`.
|
15
|
+
|
16
|
+

|
17
|
+
|
18
|
+
## How To Use
|
19
|
+
|
20
|
+
1. paste your `vue` code into the editor
|
21
|
+
|
22
|
+
Up to now, it only supports the code with `<script setup>` syntax block.If your code use `options api`, it's not working at the moment.
|
23
|
+
|
24
|
+
2. click `Analyze` button
|
25
|
+
|
26
|
+
The tool will analyze the `setup block` and `template block`, and show the relations between the variables and the methods. This is a simple demo.
|
27
|
+
|
28
|
+

|
29
|
+
|
30
|
+
## Motive
|
31
|
+
|
32
|
+
Sometime we have to refactor the code, maybe there are thousands of lines of code in one file. And it is too complex and hard to understand.
|
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. We can find out some variables are isolated, and some methods are over-association, and then we can refactor them.
|
35
|
+
|
36
|
+
## Development Plan
|
37
|
+
|
38
|
+
- [ ] add node type and more info
|
39
|
+
- [ ] provide some suggestions for optimization
|
40
|
+
- [ ] maybe support `options api`
|
41
|
+
|
42
|
+
## Contribution
|
43
|
+
|
44
|
+
Any contributions are welcome.
|
45
|
+
|
46
|
+
## Sponsor Me
|
47
|
+
|
48
|
+
If you like this tool, please consider to sponsor me. I will keep working on this tool and add more features.
|
49
|
+
|
50
|
+

|
51
|
+
|
52
|
+
## License
|
53
|
+
|
54
|
+
MIT
|
package/dist/index.d.mts
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
export { parse } from '@vue/compiler-sfc';
|
2
|
+
import * as vis_network from 'vis-network';
|
3
|
+
|
4
|
+
declare function analyze$1(content: string): Set<string>;
|
5
|
+
|
6
|
+
declare function analyze(content: string): {
|
7
|
+
nodes: Set<string>;
|
8
|
+
edges: Map<string, Set<string>>;
|
9
|
+
};
|
10
|
+
|
11
|
+
declare function getVisData(graph: {
|
12
|
+
nodes: Set<string>;
|
13
|
+
edges: Map<string, Set<string>>;
|
14
|
+
}, usedNodes: Set<string>): {
|
15
|
+
nodes: vis_network.Node[];
|
16
|
+
edges: vis_network.Edge[];
|
17
|
+
};
|
18
|
+
|
19
|
+
export { analyze as analyzeSetupScript, analyze$1 as analyzeTemplate, getVisData };
|
package/dist/index.d.ts
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
export { parse } from '@vue/compiler-sfc';
|
2
|
+
import * as vis_network from 'vis-network';
|
3
|
+
|
4
|
+
declare function analyze$1(content: string): Set<string>;
|
5
|
+
|
6
|
+
declare function analyze(content: string): {
|
7
|
+
nodes: Set<string>;
|
8
|
+
edges: Map<string, Set<string>>;
|
9
|
+
};
|
10
|
+
|
11
|
+
declare function getVisData(graph: {
|
12
|
+
nodes: Set<string>;
|
13
|
+
edges: Map<string, Set<string>>;
|
14
|
+
}, usedNodes: Set<string>): {
|
15
|
+
nodes: vis_network.Node[];
|
16
|
+
edges: vis_network.Edge[];
|
17
|
+
};
|
18
|
+
|
19
|
+
export { analyze as analyzeSetupScript, analyze$1 as analyzeTemplate, getVisData };
|