@univa/core 0.0.6 → 0.0.8

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 CHANGED
@@ -1,340 +1,435 @@
1
1
  # @univa/core
2
2
 
3
- > 🚀 开箱即用的 uni-app Vite 插件集,提供完整的开发体验
3
+ > 🚀 开箱即用的 uni-app Vite 插件集,以「约定优于配置」理念整合 uni-app 生态最佳实践。
4
4
 
5
- [![npm](https://img.shields.io/npm/v/@univa/core)](https://www.npmjs.com/package/@univa/core)
6
- [![downloads](https://img.shields.io/npm/dm/@univa/core)](https://www.npmjs.com/package/@univa/core)
7
- [![bundle size](https://img.shields.io/bundlephobia/minzip/@univa/core)](https://bundlephobia.com/package/@univa/core)
8
- [![license](https://img.shields.io/badge/license-MIT-blue)](LICENSE)
5
+ [![NPM version](https://img.shields.io/npm/v/@univa/core?color=92DCD2&labelColor=18181B&label=npm)](https://www.npmjs.com/package/@univa/core)
6
+ [![License](https://img.shields.io/github/license/libre1103/univa?color=92DCD2&labelColor=18181B&label=license)](./LICENSE)
9
7
 
10
- ## 特性
8
+ ## 为什么选择 Univa?
11
9
 
12
- - 📦 **开箱即用** - 零配置即可开始开发
13
- - 🎯 **自动导入** - 自动导入 Vue、uni-app API
14
- - 🧩 **组件自动注册** - 自动注册组件,无需手动 import
15
- - 📄 **页面管理** - 增强的页面配置和管理
16
- - 🎨 **布局系统** - 灵活的布局系统
17
- - 🎭 **UnoCSS** - 即时按需原子化 CSS 引擎
18
- - 📱 **自定义 TabBar** - 支持自定义 tabBar 配置
19
- - 🌳 **根组件** - 自动创建和管理根组件
10
+ 在 uni-app + Vite 生态中,一个完整项目通常需要集成 5~7 个插件:`@dcloudio/vite-plugin-uni`、`unplugin-auto-import`、`@uni-helper/vite-plugin-uni-components`、`@uni-helper/vite-plugin-uni-pages`、`@uni-helper/vite-plugin-uni-layouts`、`@uni-ku/root`、`unocss/vite`……每个插件都有自己的配置项,分散在 `vite.config.ts` 中,维护成本高、心智负担重。
11
+
12
+ Univa 将这些插件整合为**单一入口** `Univa()`,通过一份 `univa.config.ts` 声明工程约定,其余全部自动装配。
13
+
14
+ ### 核心特性
15
+
16
+ - **零参数入口**:`vite.config.ts` 只需 `plugins: [...Univa()]`,无需传任何配置
17
+ - **约定式目录**:`pages/`、`layouts/`、`components/` 等目录自动识别
18
+ - **统一自动导入**:`imports.apis` 一个字段同时管理预设导入与目录扫描
19
+ - **应用级配置**:`pages.json` 的 `globalStyle`/`tabBar` 等直接写在 `univa.config.ts`
20
+ - **逃生口设计**:`overrides` 字段可直接覆盖任意底层插件选项
21
+ - **自动产物集中**:所有生成文件统一输出到 `.univa/` 目录,便于 `.gitignore`
20
22
 
21
23
  ## 安装
22
24
 
23
25
  ```bash
24
- # npm
25
- npm install @univa/core
26
-
27
26
  # pnpm
28
- pnpm add @univa/core
27
+ pnpm add -D @univa/core
29
28
 
30
29
  # yarn
31
- yarn add @univa/core
30
+ yarn add -D @univa/core
31
+
32
+ # npm
33
+ npm install -D @univa/core
32
34
  ```
33
35
 
34
- ## 快速开始
36
+ > 前置依赖:项目需已安装 `vite` 与 `@dcloudio/uni-app` 相关依赖。
35
37
 
36
- ### 1. 配置 Vite
38
+ ## 快速开始
37
39
 
38
- `vite.config.ts` 中使用:
40
+ ### 1. 配置 `vite.config.ts`
39
41
 
40
- ```typescript
42
+ ```ts
43
+ // vite.config.ts
41
44
  import { Univa } from '@univa/core'
42
45
  import { defineConfig } from 'vite'
43
46
 
44
47
  export default defineConfig({
45
48
  plugins: [
46
- Univa(),
49
+ // 零参数,所有约定走 univa.config.ts
50
+ ...Univa(),
47
51
  ],
48
52
  })
49
53
  ```
50
54
 
51
- ### 2. 配置 TypeScript
52
-
53
- 在 `tsconfig.json` 中添加类型支持:
55
+ ### 2. 创建 `univa.config.ts`
54
56
 
55
- ```json
56
- {
57
- "compilerOptions": {
58
- "types": [
59
- "@univa/core/client"
60
- ]
61
- }
62
- }
63
- ```
57
+ 在项目根目录创建 `univa.config.ts`(或 `univa.config.mts`):
64
58
 
65
- ## 功能详解
59
+ ```ts
60
+ // univa.config.ts
61
+ import { defineConfig } from '@univa/core'
66
62
 
67
- ### 自动导入
63
+ export default defineConfig({
64
+ // 应用级 pages.json 配置
65
+ pages: {
66
+ globalStyle: {
67
+ navigationBarTitleText: '我的应用',
68
+ },
69
+ },
70
+ })
71
+ ```
68
72
 
69
- 自动导入 Vue、Pinia、uni-app 等 API,无需手动 import:
73
+ ### 3. 开始开发
70
74
 
71
- ```typescript
72
- // 无需 import,直接使用
73
- const count = ref(0)
74
- const router = useRouter()
75
- const store = useStore()
75
+ ```bash
76
+ pnpm dev
76
77
  ```
77
78
 
78
- **自动扫描目录**:
79
- - `src/hooks/**` - 自动导入 hooks
80
- - `src/store/**` - 自动导入 store
81
- - `src/constants/**` - 自动导入常量
79
+ Univa 会自动:
80
+ - 扫描 `src/pages/` 生成 `pages.json`
81
+ - 扫描 `src/pages-sub/*/` 生成分包配置
82
+ - 自动导入 `vue`、`uni-app` 及 `src/composables/`、`src/hooks/`、`src/stores/` 等目录的导出
83
+ - 自动注册 `src/components/` 下的组件
84
+ - 生成虚拟根组件 `src/App.ku.vue`(若不存在)
85
+ - 输出类型声明到 `.univa/` 目录
82
86
 
83
- ### 组件自动注册
87
+ ## 目录约定
84
88
 
85
- 自动注册 `components` 目录下的组件,无需手动 import:
89
+ 默认目录结构(均相对 `srcDir`,默认 `src`):
86
90
 
87
- ```text
91
+ ```
88
92
  src/
89
- ├── components/
90
- ├── MyButton.vue
91
- │ └── common/
92
- │ └── Icon.vue
93
- └── components-biz/
94
- └── Card.vue
93
+ ├── pages/ # 主包页面(自动扫描)
94
+ ├── pages-sub/ # 分包根目录(默认扫描 pages-sub/* 下第一层)
95
+ │ └── demo/
96
+ ├── layouts/ # 布局组件
97
+ ├── components/ # 全局组件(自动注册)
98
+ ├── components-biz/ # 业务组件(自动注册)
99
+ ├── composables/ # 组合式 API(自动导入)
100
+ ├── hooks/ # 自定义 Hooks(自动导入)
101
+ ├── stores/ # 状态管理(自动导入)
102
+ ├── constants/ # 常量(自动导入)
103
+ └── App.ku.vue # 虚拟根组件(自动生成)
95
104
  ```
96
105
 
97
- 在页面中直接使用:
106
+ 自定义目录约定:
98
107
 
99
- ```vue
100
- <template>
101
- <MyButton />
102
- <Icon />
103
- <BizCard />
104
- </template>
108
+ ```ts
109
+ // univa.config.ts
110
+ import { defineConfig } from '@univa/core'
111
+
112
+ export default defineConfig({
113
+ dirs: {
114
+ pages: 'views', // 主包页面目录
115
+ subPackages: ['subpkgs/*'], // 分包目录
116
+ layouts: 'layouts', // 布局目录
117
+ },
118
+ })
105
119
  ```
106
120
 
107
- **特性**:
108
- - `components/` 和 `common/` 是全局命名空间,不添加前缀
109
- - `components-biz/` 会自动添加 `Biz` 命名空间前缀
110
- - 自动生成类型声明文件
121
+ ## 自动导入
111
122
 
112
- ### 页面管理
123
+ ### `imports.apis` 统一字段
113
124
 
114
- #### 定义页面配置
125
+ `apis` 支持三种形式,Univa 内部自动区分:
115
126
 
116
- **方式 1:在 pages.config.ts 中定义**
127
+ | 形式 | 示例 | 说明 |
128
+ |------|------|------|
129
+ | 预设名 | `'vue'`、`'uni-app'`、`'pinia'` | 识别为 unplugin-auto-import 预设 |
130
+ | 目录 glob | `'composables/**'`、`'hooks/**'` | 识别为目录扫描(相对 srcDir) |
131
+ | inline preset | `{ from: 'wot-design-uni', imports: ['useToast'] }` | 直接传给 unplugin-auto-import |
117
132
 
118
- ```typescript
119
- // pages.config.ts
120
- import { definePagesConfig } from '@univa/core'
133
+ **识别规则**:含 glob 字符(`*?[{}]`)或路径分隔符(`/`)的字符串 → 目录扫描;否则 → 预设名。scope 包名(如 `@vueuse/core`)也算预设名。
121
134
 
122
- export default definePagesConfig({
123
- tabBarMode: 'CUSTOM', // 'NONE' | 'NATIVE' | 'CUSTOM'
124
- tabBar: {
125
- list: [
126
- {
127
- pagePath: 'pages/index',
128
- text: '首页',
129
- iconPath: 'images/tabbar/home.png',
130
- selectedIconPath: 'images/tabbar/home_selected.png',
131
- },
132
- ],
133
- },
134
- })
135
+ 默认值:
136
+
137
+ ```ts
138
+ apis: ['vue', 'uni-app', 'composables/**', 'stores/**', 'hooks/**', 'constants/**']
135
139
  ```
136
140
 
137
- **方式 2:在 vite.config.ts 中直接定义**
141
+ 自定义示例:
138
142
 
139
- ```typescript
140
- // vite.config.ts
141
- import { Univa } from '@univa/core'
142
- import { defineConfig } from 'vite'
143
+ ```ts
144
+ // univa.config.ts
145
+ import { defineConfig } from '@univa/core'
143
146
 
144
147
  export default defineConfig({
145
- plugins: [
146
- Univa({
147
- pages: {
148
- config: {
149
- tabBarMode: 'CUSTOM',
150
- tabBar: {
151
- list: [
152
- {
153
- pagePath: 'pages/index',
154
- text: '首页',
155
- },
156
- ],
157
- },
158
- },
159
- },
160
- }),
161
- ],
148
+ imports: {
149
+ apis: [
150
+ // 预设名
151
+ 'vue',
152
+ 'uni-app',
153
+ 'pinia',
154
+ '@vueuse/core',
155
+ // 目录扫描(相对 srcDir)
156
+ 'composables/**',
157
+ 'stores/**',
158
+ // negation 排除
159
+ '!hooks/**/_internal/**',
160
+ // inline preset
161
+ { from: 'wot-design-uni', imports: ['useToast', 'useMessage'] },
162
+ // 命名导入映射
163
+ { '@fun-design/use': ['useState', 'useVModel'] },
164
+ ],
165
+ // 组件自动注册目录(glob,相对 srcDir)
166
+ components: ['components/**', 'components-biz/**'],
167
+ },
162
168
  })
163
169
  ```
164
170
 
165
- #### 获取 Pages 配置
171
+ ### 类型声明
172
+
173
+ 类型声明文件自动生成到 `.univa/` 目录:
166
174
 
167
- 在组件中获取 Pages 配置:
175
+ - `.univa/auto-imports.d.ts` — API 自动导入类型
176
+ - `.univa/components.d.ts` — 组件自动注册类型
177
+ - `.univa/uni-pages.d.ts` — 页面路由类型
168
178
 
169
- ```typescript
170
- import { pages, subPackages, tabBar } from 'virtual:univa-pages'
179
+ 在 `tsconfig.json` 中引入:
171
180
 
172
- if (tabBar) {
173
- console.log(tabBar.list) // TabBar 列表
181
+ ```json
182
+ {
183
+ "include": [".univa/**/*.d.ts"]
174
184
  }
175
185
  ```
176
186
 
177
- **类型支持**:确保在 `tsconfig.json` 中添加了 `@univa/core/client` 类型,以获得 `virtual:univa-pages` 的类型提示。
187
+ ## 应用级配置(pages
188
+
189
+ `pages.json` 的应用级内容(`globalStyle`、`tabBar`、`easycom` 等)可直接写在 `univa.config.ts`:
190
+
191
+ ```ts
192
+ // univa.config.ts
193
+ import { defineConfig } from '@univa/core'
194
+
195
+ export default defineConfig({
196
+ pages: {
197
+ globalStyle: {
198
+ navigationBarTextStyle: 'black',
199
+ navigationBarTitleText: '我的应用',
200
+ navigationBarBackgroundColor: '#FFFFFF',
201
+ backgroundColor: '#F8F8F8',
202
+ },
203
+ tabBar: {
204
+ color: '#7A7E83',
205
+ selectedColor: '#3CC51F',
206
+ backgroundColor: '#FFFFFF',
207
+ list: [
208
+ { pagePath: 'pages/index/index', text: '首页' },
209
+ { pagePath: 'pages/user/index', text: '我的' },
210
+ ],
211
+ },
212
+ },
213
+ })
214
+ ```
178
215
 
179
- ### UnoCSS 预设
216
+ Univa 会读取 `pages` 字段,自动生成 `.univa/pages-config.ts`,供 `@uni-helper/vite-plugin-uni-pages` 消费。
180
217
 
181
- 内置 UnoCSS 预设,提供开箱即用的原子化 CSS:
218
+ > **注意**:`pages`(页面列表)和 `subPackages`(分包列表)由目录扫描自动填充,请勿在配置中手写。
182
219
 
183
- **内置预设**:
184
- - `presetUni()` - uni-app 专属预设
185
- - `presetIcons()` - 图标预设(scale: 1.2)
186
- - `presetLegacyCompat()` - 兼容性预设(处理低端安卓机)
220
+ ### 页面内配置(definePage)
187
221
 
188
- **内置快捷方式**:
222
+ 在页面文件中使用 `definePage` 宏声明页面级配置:
189
223
 
190
- | 快捷方式 | 展开后 |
191
- |---------|--------|
192
- | `border-s` | `border border-solid` |
193
- | `wh-full` | `w-full h-full` |
194
- | `f-c-c` | `flex justify-center items-center` |
195
- | `f-col-c` | `flex-col justify-center items-center` |
196
- | `flex-items` | `flex items-center` |
197
- | `flex-justify` | `flex justify-center` |
198
- | `flex-col` | `flex flex-col` |
224
+ ```vue
225
+ <!-- src/pages/about.vue -->
226
+ <script setup lang="ts">
227
+ definePage({
228
+ style: {
229
+ navigationBarTitleText: '关于',
230
+ },
231
+ })
232
+ </script>
199
233
 
200
- **安全区域规则**:
201
- ```html
202
- <div class="p-safe">安全区域内边距</div>
203
- <div class="pt-safe">顶部安全区域</div>
204
- <div class="pb-safe">底部安全区域</div>
234
+ <template>
235
+ <view>About</view>
236
+ </template>
205
237
  ```
206
238
 
207
- ### 根组件
239
+ ## 虚拟根组件(App.ku.vue)
240
+
241
+ Univa 集成了 `@uni-ku/root` 插件,提供全局共享组件能力(如全局 Toast、ConfigProvider 等)。
242
+
243
+ 若 `src/App.ku.vue` 不存在,Univa 会在首次启动时自动生成最小模板:
208
244
 
209
- 自动创建和管理 `App.univa.vue` 根组件:
245
+ ```vue
246
+ <!-- Auto-generated by @univa/core -->
247
+ <!-- UniKuRoot 虚拟根组件,可在此添加全局组件(如 Toast、ConfigProvider 等) -->
248
+ <template>
249
+ <KuRootView />
250
+ </template>
251
+ ```
252
+
253
+ 你可以在此基础上添加全局组件:
210
254
 
211
255
  ```vue
256
+ <!-- src/App.ku.vue -->
212
257
  <script setup lang="ts">
258
+ import GlobalToast from '@/components/GlobalToast.vue'
213
259
  </script>
214
260
 
215
261
  <template>
216
- <UnivaPageMeta background-color="#ff0000" page-style="color: green" />
217
- <view class="container">
218
- <UnivaRootView />
219
- </view>
262
+ <KuRootView />
263
+ <GlobalToast />
220
264
  </template>
221
265
  ```
222
266
 
223
- **特性**:
224
- - 自动创建根组件文件
225
- - 支持虚拟节点(`virtualHost`)
226
- - 支持全局 ref
227
- - 支持 `<UnivaPageMeta>` 组件配置页面元信息
228
- - 支持 `<UnivaRootView />` 组件作为根视图
267
+ 自定义根组件文件名(通过 `overrides.root.rootFileName`):
268
+
269
+ ```ts
270
+ // univa.config.ts
271
+ import { defineConfig } from '@univa/core'
272
+
273
+ export default defineConfig({
274
+ overrides: {
275
+ root: {
276
+ rootFileName: 'KuRoot.vue', // 默认 App.ku.vue
277
+ },
278
+ },
279
+ })
280
+ ```
229
281
 
230
- ### Manifest 配置
282
+ ## overrides 逃生口
231
283
 
232
- `vite.config.ts` 中直接配置 manifest:
284
+ 对于 90% 的场景,使用上层约定(`dirs`、`imports`、`pages`)即可。当需要覆盖底层插件选项时,使用 `overrides`:
233
285
 
234
- ```typescript
235
- import { Univa } from '@univa/core'
236
- import { defineConfig } from 'vite'
286
+ ```ts
287
+ // univa.config.ts
288
+ import { defineConfig } from '@univa/core'
237
289
 
238
290
  export default defineConfig({
239
- plugins: [
240
- Univa({
241
- manifest: {
242
- name: 'my-app',
243
- appid: '__UNI__XXXXXX',
244
- description: 'My Application',
245
- versionName: '1.0.0',
246
- versionCode: '100',
247
- },
248
- }),
249
- ],
291
+ overrides: {
292
+ // 覆盖 @uni-helper/vite-plugin-uni-pages 选项
293
+ pages: {
294
+ exclude: ['**/components/**/*.*'],
295
+ },
296
+ // 覆盖 @uni-helper/vite-plugin-uni-components 选项
297
+ components: {
298
+ globalNamespaces: ['components', 'common'],
299
+ directoryAsNamespace: true,
300
+ },
301
+ // 覆盖 unplugin-auto-import 选项
302
+ autoImport: {
303
+ eslintrc: { enabled: true },
304
+ },
305
+ // 覆盖 @uni-ku/root 选项
306
+ root: {
307
+ enabledGlobalRef: true,
308
+ excludePages: ['components-async/**/*.*'],
309
+ },
310
+ // 覆盖 @uni-helper/vite-plugin-uni-layouts 选项
311
+ layouts: {
312
+ layoutDir: 'src/layouts',
313
+ },
314
+ // 覆盖 unocss/vite 选项
315
+ unocss: {
316
+ presets: [],
317
+ },
318
+ },
250
319
  })
251
320
  ```
252
321
 
253
- ## 配置选项
322
+ `overrides` 的优先级最高,会与上层约定合并后传给底层插件。
323
+
324
+ ## 自动生成的文件
325
+
326
+ 所有自动生成的文件统一输出到 `.univa/` 目录:
327
+
328
+ ```
329
+ .univa/
330
+ ├── pages-config.ts # 应用级 pages 配置(来源:univa.config.ts 的 pages 字段)
331
+ ├── auto-imports.d.ts # API 自动导入类型声明
332
+ ├── components.d.ts # 组件自动注册类型声明
333
+ └── uni-pages.d.ts # 页面路由类型声明
334
+ ```
335
+
336
+ 建议在 `.gitignore` 中忽略:
337
+
338
+ ```gitignore
339
+ .univa/
340
+ ```
341
+
342
+ `pages.json` 仍由 `@uni-helper/vite-plugin-uni-pages` 输出到默认位置(`src/pages.json`),保持 uni-app 标准结构。
343
+
344
+ ## 配置文件支持
345
+
346
+ `univa.config.ts` 支持以下扩展名(自动识别):
347
+
348
+ - `univa.config.ts`
349
+ - `univa.config.mts`
350
+ - `univa.config.js`
351
+ - `univa.config.mjs`
352
+ - `univa.config.cjs`
353
+ - `univa.config.json`
254
354
 
255
- ```typescript
256
- import type { UnivaUserConfig } from '@univa/core'
355
+ 配置文件不存在时使用默认配置。
257
356
 
258
- const config: UnivaUserConfig = {
259
- // 自动导入配置(默认 true)
260
- autoImport: true,
357
+ ## 完整配置示例
261
358
 
262
- // 组件自动注册配置(默认 true)
263
- components: true,
359
+ ```ts
360
+ // univa.config.ts
361
+ import { defineConfig } from '@univa/core'
264
362
 
265
- // 页面配置
363
+ export default defineConfig({
364
+ // 源码目录,相对 Vite root,默认 'src'
365
+ srcDir: 'src',
366
+
367
+ // 目录约定
368
+ dirs: {
369
+ pages: 'pages',
370
+ subPackages: ['pages-sub/*'],
371
+ layouts: 'layouts',
372
+ },
373
+
374
+ // 自动导入
375
+ imports: {
376
+ apis: [
377
+ 'vue',
378
+ 'uni-app',
379
+ 'pinia',
380
+ '@vueuse/core',
381
+ 'composables/**',
382
+ 'stores/**',
383
+ 'hooks/**',
384
+ 'constants/**',
385
+ { from: 'wot-design-uni', imports: ['useToast'] },
386
+ ],
387
+ components: ['components/**', 'components-biz/**'],
388
+ },
389
+
390
+ // 应用级 pages.json 配置
266
391
  pages: {
267
- config: {
268
- // TabBar 模式:'NONE' | 'NATIVE' | 'CUSTOM'
269
- tabBarMode: 'NATIVE',
270
- tabBar: {
271
- color: '#A6A6A6',
272
- selectedColor: '#003594',
273
- list: [
274
- {
275
- pagePath: 'pages/index',
276
- text: '首页',
277
- iconPath: 'images/tabbar/home.png',
278
- selectedIconPath: 'images/tabbar/home_selected.png',
279
- },
280
- ],
281
- },
282
- // 全局样式配置
283
- globalStyle: {
284
- navigationBarBackgroundColor: '#000000',
285
- navigationBarTextStyle: 'black',
286
- navigationBarTitleText: 'My App',
287
- navigationStyle: 'custom',
288
- enablePullDownRefresh: false,
289
- onReachBottomDistance: 50,
290
- animationType: 'pop-in',
291
- animationDuration: 300,
292
- },
392
+ globalStyle: {
393
+ navigationBarTitleText: '我的应用',
394
+ navigationBarBackgroundColor: '#FFFFFF',
395
+ },
396
+ tabBar: {
397
+ list: [
398
+ { pagePath: 'pages/index/index', text: '首页' },
399
+ ],
293
400
  },
294
- // 排除的页面
295
- exclude: ['pages/exclude/**'],
296
- // 分包配置
297
- subPackages: ['pages-sub'],
298
401
  },
299
402
 
300
- // 根组件配置(默认 true)
301
- appRoot: true,
302
-
303
- // Manifest 配置
304
- manifest: {
305
- name: 'my-app',
306
- appid: '__UNI__XXXXXX',
307
- description: 'My Application',
308
- versionName: '1.0.0',
309
- versionCode: '100',
403
+ // 底层插件逃生口(可选)
404
+ overrides: {
405
+ root: {
406
+ enabledGlobalRef: true,
407
+ },
310
408
  },
311
- }
409
+ })
312
410
  ```
313
411
 
314
- ## 依赖
412
+ ## 集成的插件
315
413
 
316
- 本包集成了以下优秀的插件:
414
+ | 插件 | 说明 | overrides 键 |
415
+ |------|------|-------------|
416
+ | `@dcloudio/vite-plugin-uni` | uni-app 核心 | — |
417
+ | `@uni-helper/vite-plugin-uni-pages` | 文件式路由 | `pages` |
418
+ | `@uni-helper/vite-plugin-uni-layouts` | 布局系统 | `layouts` |
419
+ | `@uni-helper/vite-plugin-uni-components` | 组件自动注册 | `components` |
420
+ | `@uni-ku/root` | 虚拟根组件 | `root` |
421
+ | `unplugin-auto-import` | API 自动导入 | `autoImport` |
422
+ | `unocss/vite` | 原子化 CSS | `unocss` |
317
423
 
318
- - `@uni-helper/plugin-uni` - uni-app Vite 插件
319
- - `@uni-helper/vite-plugin-uni-components` - 组件自动注册
320
- - `@uni-helper/vite-plugin-uni-pages` - 页面管理
321
- - `@uni-helper/vite-plugin-uni-layouts` - 布局系统
322
- - `unplugin-auto-import` - 自动导入
323
- - `unocss` - 原子化 CSS 引擎
324
- - `@univa/root` - 根组件管理
325
- - `@univa/manifest` - manifest 配置
326
- - `@uni-ku/bundle-optimizer` - 打包优化
327
- - `vite-plugin-uni-polyfill` - Polyfill
424
+ ## 设计哲学
328
425
 
329
- ## 致谢
426
+ Univa 采用**融合约定 + 逃生口**的分层设计:
330
427
 
331
- - 感谢 [uni-helper](https://github.com/uni-helper) 社区提供的优秀插件
332
- - 感谢 [uni-ku](https://github.com/uni-ku) 提供的优秀插件
428
+ - **高层字段**(`dirs`/`imports`/`pages`):面向 90% 用户,降低心智成本,一个字段替代多个底层配置
429
+ - **逃生口**(`overrides`):面向 10% 高级用户,可下沉到底层插件选项,优先级最高
333
430
 
334
- ## License
335
-
336
- MIT
431
+ 这不是简单的插件包装,而是将底层插件的配置项重新组织为符合工程直觉的高层概念。
337
432
 
338
- ## Contact
433
+ ## License
339
434
 
340
- 📧 Email: libre1103@163.com
435
+ [MIT](./LICENSE)
@@ -0,0 +1,4 @@
1
+ /// <reference types="@dcloudio/types" />
2
+ /// <reference types="vite/client" />
3
+ /// <reference types="@uni-helper/vite-plugin-uni-pages/client" />
4
+ /// <reference types="@uni-helper/uni-types" />