Skip to content

Commit bb864e2

Browse files
committed
docs(uni-helper): 添加uni-helper和uniapp的文档及技能参考文件
1 parent 2424f3c commit bb864e2

33 files changed

Lines changed: 7058 additions & 0 deletions

skills/uni-helper/GENERATION.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Generation Info
2+
3+
- **Source:** `sources/uni-helper`
4+
- **Git SHA:** `286d8656dc077a7d9d6a50e647284ff1ea48ac6b`
5+
- **Generated:** 2026-01-30

skills/uni-helper/SKILL.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
---
2+
name: uni-helper
3+
description: Comprehensive skill reference for uni-helper ecosystem - AI-powered development tools for uni-app
4+
metadata:
5+
author: FlippeDround
6+
version: "2026.1.30"
7+
source: Generated from https://github.com/uni-helper/website, skills located at https://github.com/uni-helper/ai-tools
8+
---
9+
10+
> The skill is based on uni-helper documentation, generated at 2026-01-30.
11+
12+
uni-helper is an ecosystem of AI-powered development tools for uni-app, providing Vite plugins, utility libraries, TypeScript support, and development tools to enhance the uni-app development experience.
13+
14+
## Vite Plugins
15+
16+
| Topic | Description | Reference |
17+
|-------|-------------|-----------|
18+
| vite-plugin-uni-pages | File-based routing system for uni-app with auto page discovery | [plugin-pages](references/plugin-pages.md) |
19+
| vite-plugin-uni-layouts | Nuxt-like layouts system for uni-app | [plugin-layouts](references/plugin-layouts.md) |
20+
| vite-plugin-uni-components | On-demand automatic component imports | [plugin-components](references/plugin-components.md) |
21+
| vite-plugin-uni-manifest | Write manifest.json in TypeScript | [plugin-manifest](references/plugin-manifest.md) |
22+
| vite-plugin-uni-platform | File-based platform compilation (*.h5|mp-weixin|app.*) | [plugin-platform](references/plugin-platform.md) |
23+
| vite-plugin-uni-platform-modifier | Platform modifiers for attributes/directives | [plugin-platform-modifier](references/plugin-platform-modifier.md) |
24+
| vite-plugin-uni-middleware | Middleware support for uni-app routing | [plugin-middleware](references/plugin-middleware.md) |
25+
26+
## Libraries
27+
28+
| Topic | Description | Reference |
29+
|-------|-------------|-----------|
30+
| uni-use | VueUse-style composable utilities for uni-app | [lib-uni-use](references/lib-uni-use.md) |
31+
| uni-network | Promise-based HTTP client for uni-app | [lib-uni-network](references/lib-uni-network.md) |
32+
| uni-promises | Promise wrappers for uni-app APIs | [lib-uni-promises](references/lib-uni-promises.md) |
33+
| uni-typed | TypeScript type definitions for uni-app templates | [lib-uni-typed](references/lib-uni-typed.md) |
34+
35+
## Utilities
36+
37+
| Topic | Description | Reference |
38+
|-------|-------------|-----------|
39+
| uni-env | Environment detection utilities for uni-app | [util-uni-env](references/util-uni-env.md) |
40+
| unocss-preset-uni | UnoCSS preset for uni-app | [util-unocss-preset](references/util-unocss-preset.md) |
41+
42+
## Project Starters
43+
44+
| Topic | Description | Reference |
45+
|-------|-------------|-----------|
46+
| create-uni | CLI scaffolding tool for uni-app projects | [starter-create-uni](references/starter-create-uni.md) |
47+
| vitesse-uni-app | Vite-powered uni-app starter template | [starter-vitesse](references/starter-vitesse.md) |
48+
49+
## Plugin Order Best Practices
50+
51+
When using multiple uni-helper Vite plugins, the recommended order is:
52+
53+
```ts
54+
// vite.config.ts
55+
export default defineConfig({
56+
plugins: [
57+
UniComponents(), // 1. Component auto-import
58+
UniPages(), // 2. File-based routing
59+
UniLayouts(), // 3. Layout system
60+
UniManifest(), // 4. Manifest generation
61+
UniPlatform(), // 5. Platform-specific files
62+
UniPlatformModifier(), // 6. Platform modifiers
63+
UniMiddleware(), // 7. Route middleware
64+
Uni(), // 8. Official uni-app plugin (always last)
65+
],
66+
})
67+
```
68+
69+
## Quick Start
70+
71+
Create a new uni-app project with create-uni:
72+
73+
```bash
74+
# npm 7+, extra double-dash is needed
75+
npm create uni@latest
76+
77+
# pnpm
78+
pnpm create uni
79+
80+
# yarn
81+
yarn create uni
82+
```
83+
84+
## Official Resources
85+
86+
- Website: https://uni-helper.js.org
87+
- GitHub: https://github.com/uni-helper
88+
- NPM Scope: @uni-helper
Lines changed: 221 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,221 @@
1+
---
2+
name: uni-network
3+
description: Promise-based HTTP client for uni-app - axios-inspired API with uni.request as default transport
4+
---
5+
6+
# uni-network
7+
8+
Promise-based HTTP client for uni-app, inspired by axios@0.27.2. Uses uni.request/uni.uploadFile/uni.downloadFile as the underlying transport.
9+
10+
## Installation
11+
12+
```bash
13+
npm i @uni-helper/uni-network
14+
```
15+
16+
## Features
17+
18+
- Promise-based API
19+
- Request/response interceptors
20+
- Request cancellation
21+
- TypeScript support
22+
- Composition API integration
23+
- Upload/download support
24+
25+
## Basic Usage
26+
27+
```ts
28+
import { un } from '@uni-helper/uni-network'
29+
30+
// GET request
31+
un('/user/123')
32+
33+
// POST request
34+
un({
35+
method: 'POST',
36+
url: '/user/123',
37+
data: {
38+
firstName: 'Fred',
39+
lastName: 'Flintstone',
40+
},
41+
})
42+
```
43+
44+
## Request Aliases
45+
46+
```ts
47+
import { un } from '@uni-helper/uni-network'
48+
49+
// HTTP verbs
50+
un.get('/users')
51+
un.post('/users', { name: 'John' })
52+
un.put('/users/1', { name: 'Jane' })
53+
un.patch('/users/1', { age: 30 })
54+
un.delete('/users/1')
55+
56+
// Upload/download
57+
un.upload({
58+
url: '/upload',
59+
filePath: tempFilePath,
60+
name: 'file',
61+
})
62+
63+
un.download({
64+
url: '/files/report.pdf',
65+
})
66+
```
67+
68+
## Creating an Instance
69+
70+
```ts
71+
import { createUniNetwork } from '@uni-helper/uni-network'
72+
73+
const http = createUniNetwork({
74+
baseURL: 'https://api.example.com',
75+
timeout: 10000,
76+
headers: {
77+
'Content-Type': 'application/json',
78+
},
79+
})
80+
81+
// Use the instance
82+
http.get('/users')
83+
```
84+
85+
## Interceptors
86+
87+
```ts
88+
import { un } from '@uni-helper/uni-network'
89+
90+
// Request interceptor
91+
un.interceptors.request.use(
92+
(config) => {
93+
// Add auth token
94+
const token = uni.getStorageSync('token')
95+
if (token) {
96+
config.headers = config.headers || {}
97+
config.headers.Authorization = `Bearer ${token}`
98+
}
99+
return config
100+
},
101+
(error) => {
102+
return Promise.reject(error)
103+
}
104+
)
105+
106+
// Response interceptor
107+
un.interceptors.response.use(
108+
(response) => {
109+
// Transform response data
110+
return response.data
111+
},
112+
(error) => {
113+
// Handle errors globally
114+
if (error.statusCode === 401) {
115+
uni.redirectTo({ url: '/pages/login/index' })
116+
}
117+
return Promise.reject(error)
118+
}
119+
)
120+
```
121+
122+
## Configuration
123+
124+
```ts
125+
interface UniNetworkConfig {
126+
// URL
127+
url?: string
128+
// Base URL
129+
baseURL?: string
130+
// Method
131+
method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | ...
132+
// Headers
133+
headers?: Record<string, string>
134+
// Request data
135+
data?: any
136+
// Query params
137+
params?: Record<string, any>
138+
// Timeout in ms
139+
timeout?: number
140+
// Response type
141+
responseType?: 'text' | 'arraybuffer'
142+
// Data type
143+
dataType?: 'json' | 'string'
144+
// Enable http2
145+
enableHttp2?: boolean
146+
// Enable quic
147+
enableQuic?: boolean
148+
// Enable cache
149+
enableCache?: boolean
150+
// SSL verify
151+
sslVerify?: boolean
152+
}
153+
```
154+
155+
## Request Cancellation
156+
157+
```ts
158+
import { un } from '@uni-helper/uni-network'
159+
160+
const controller = new AbortController()
161+
162+
un.get('/long-request', {
163+
signal: controller.signal,
164+
})
165+
166+
// Cancel after 5 seconds
167+
setTimeout(() => {
168+
controller.abort()
169+
}, 5000)
170+
```
171+
172+
## Error Handling
173+
174+
```ts
175+
import { un, UniNetworkError } from '@uni-helper/uni-network'
176+
177+
try {
178+
const response = await un.get('/users')
179+
} catch (error) {
180+
if (error instanceof UniNetworkError) {
181+
console.log('Request failed:', error.message)
182+
console.log('Status:', error.statusCode)
183+
}
184+
}
185+
```
186+
187+
## Composition API
188+
189+
```ts
190+
import { useUniNetwork } from '@uni-helper/uni-network'
191+
192+
const { data, error, loading, execute } = useUniNetwork({
193+
url: '/users',
194+
method: 'GET',
195+
})
196+
197+
// Execute manually
198+
await execute()
199+
```
200+
201+
## TypeScript Support
202+
203+
```ts
204+
import { un } from '@uni-helper/uni-network'
205+
206+
interface User {
207+
id: number
208+
name: string
209+
email: string
210+
}
211+
212+
// Typed response
213+
const { data } = await un.get<User>('/users/1')
214+
console.log(data.name) // Type-safe access
215+
```
216+
217+
<!--
218+
Source references:
219+
- https://github.com/uni-helper/uni-network
220+
- https://uni-helper.js.org/uni-network
221+
-->

0 commit comments

Comments
 (0)