vite-plugin-ai-perf-analyzer 1.0.0
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/LICENSE +21 -0
- package/README.md +63 -0
- package/dist/index.d.mts +30 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.js +42736 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +42722 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +62 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Your Name
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# vite-plugin-ai-perf-analyzer
|
|
2
|
+
|
|
3
|
+
AI-powered performance analyzer for Vite. Analyze bundle size and suggest optimizations.
|
|
4
|
+
|
|
5
|
+
## ✨ Features
|
|
6
|
+
|
|
7
|
+
- 📊 **Bundle Analysis** - Analyze bundle size and composition
|
|
8
|
+
- 🤖 **AI Suggestions** - Get AI-powered optimization suggestions
|
|
9
|
+
- 📈 **History Tracking** - Track performance over time
|
|
10
|
+
- 🎯 **Threshold Alerts** - Alert when bundle size exceeds limits
|
|
11
|
+
- 📄 **Reports** - Generate detailed performance reports
|
|
12
|
+
|
|
13
|
+
## 📦 Installation
|
|
14
|
+
|
|
15
|
+
::: code-group
|
|
16
|
+
|
|
17
|
+
```bash [npm]
|
|
18
|
+
npm install -D vite-plugin-ai-perf-analyzer
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
```bash [yarn]
|
|
22
|
+
yarn add -D vite-plugin-ai-perf-analyzer
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
```bash [pnpm]
|
|
26
|
+
pnpm add -D vite-plugin-ai-perf-analyzer
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
:::
|
|
30
|
+
|
|
31
|
+
## 🚀 Quick Start
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
// vite.config.ts
|
|
35
|
+
import { defineConfig } from "vite";
|
|
36
|
+
import { vitePluginAIPerfAnalyzer } from "vite-plugin-ai-perf-analyzer";
|
|
37
|
+
|
|
38
|
+
export default defineConfig({
|
|
39
|
+
plugins: [
|
|
40
|
+
vitePluginAIPerfAnalyzer({
|
|
41
|
+
apiKey: process.env.OPENAI_API_KEY,
|
|
42
|
+
enabled: true,
|
|
43
|
+
threshold: {
|
|
44
|
+
bundleSize: 500, // KB
|
|
45
|
+
totalSize: 5, // MB
|
|
46
|
+
chunkCount: 20,
|
|
47
|
+
},
|
|
48
|
+
output: {
|
|
49
|
+
console: true,
|
|
50
|
+
html: true,
|
|
51
|
+
},
|
|
52
|
+
}),
|
|
53
|
+
],
|
|
54
|
+
});
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## 📚 Documentation
|
|
58
|
+
|
|
59
|
+
Full documentation: https://mo520.github.io/vite-plugin-ai/plugins/ai-perf-analyzer
|
|
60
|
+
|
|
61
|
+
## 📄 License
|
|
62
|
+
|
|
63
|
+
MIT
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Plugin } from 'vite';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* AI 性能分析插件
|
|
5
|
+
*
|
|
6
|
+
* 功能:
|
|
7
|
+
* - 分析构建产物大小
|
|
8
|
+
* - 检测性能问题
|
|
9
|
+
* - 提供优化建议
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
interface PerfAnalyzerOptions {
|
|
13
|
+
apiKey?: string;
|
|
14
|
+
apiUrl?: string;
|
|
15
|
+
model?: string;
|
|
16
|
+
enabled?: boolean;
|
|
17
|
+
threshold?: {
|
|
18
|
+
bundleSize?: number;
|
|
19
|
+
totalSize?: number;
|
|
20
|
+
chunkCount?: number;
|
|
21
|
+
};
|
|
22
|
+
output?: {
|
|
23
|
+
console?: boolean;
|
|
24
|
+
html?: boolean;
|
|
25
|
+
json?: boolean;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
declare function vitePluginAIPerfAnalyzer(options?: PerfAnalyzerOptions): Plugin;
|
|
29
|
+
|
|
30
|
+
export { type PerfAnalyzerOptions, vitePluginAIPerfAnalyzer };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Plugin } from 'vite';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* AI 性能分析插件
|
|
5
|
+
*
|
|
6
|
+
* 功能:
|
|
7
|
+
* - 分析构建产物大小
|
|
8
|
+
* - 检测性能问题
|
|
9
|
+
* - 提供优化建议
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
interface PerfAnalyzerOptions {
|
|
13
|
+
apiKey?: string;
|
|
14
|
+
apiUrl?: string;
|
|
15
|
+
model?: string;
|
|
16
|
+
enabled?: boolean;
|
|
17
|
+
threshold?: {
|
|
18
|
+
bundleSize?: number;
|
|
19
|
+
totalSize?: number;
|
|
20
|
+
chunkCount?: number;
|
|
21
|
+
};
|
|
22
|
+
output?: {
|
|
23
|
+
console?: boolean;
|
|
24
|
+
html?: boolean;
|
|
25
|
+
json?: boolean;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
declare function vitePluginAIPerfAnalyzer(options?: PerfAnalyzerOptions): Plugin;
|
|
29
|
+
|
|
30
|
+
export { type PerfAnalyzerOptions, vitePluginAIPerfAnalyzer };
|