weapp-vite 6.7.6 → 6.8.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/dist/auto-import-components/resolvers.mjs +1 -1
- package/dist/auto-routes.mjs +7 -7
- package/dist/{chunk-W3UG2WZQ.mjs → chunk-3BOPS2AF.mjs} +1 -1
- package/dist/{chunk-XQYQD5CM.mjs → chunk-6N2JYDJN.mjs} +1 -1
- package/dist/{chunk-6AH5XOPG.mjs → chunk-BKU4KQJE.mjs} +18 -14
- package/dist/{chunk-QD76G22N.mjs → chunk-EZOXN44U.mjs} +2 -2
- package/dist/{chunk-O2IN5LBB.mjs → chunk-FXWNWYDN.mjs} +1 -1
- package/dist/{chunk-ZHLTHMZA.mjs → chunk-GJOF3MJY.mjs} +1305 -938
- package/dist/{chunk-XSPLO6IT.mjs → chunk-JFV2DERD.mjs} +3 -6
- package/dist/{chunk-6YAZCQOZ.mjs → chunk-LDBSARE6.mjs} +2 -2
- package/dist/{chunk-XIEFUUA5.mjs → chunk-MIQZQK74.mjs} +1 -1
- package/dist/{chunk-BGBLJUWD.mjs → chunk-OU5WM7WT.mjs} +1 -1
- package/dist/{chunk-KV5GZOAZ.mjs → chunk-X4YQFGKK.mjs} +1 -1
- package/dist/cli.mjs +92 -8
- package/dist/{config-BngmcXkt.d.ts → config-D8v221vL.d.ts} +244 -671
- package/dist/config.d.ts +5 -5
- package/dist/config.mjs +4 -4
- package/dist/{file-OMYHHYLC.mjs → file-W4JJII65.mjs} +2 -2
- package/dist/{getInstance-W5DSUGSZ.mjs → getInstance-W65F2IS7.mjs} +5 -5
- package/dist/index.d.ts +6 -6
- package/dist/index.mjs +10 -10
- package/dist/json.d.ts +5 -5
- package/dist/json.mjs +2 -2
- package/dist/mcp.d.ts +5 -5
- package/dist/mcp.mjs +3 -3
- package/dist/runtime.mjs +2 -2
- package/dist/types.d.ts +4 -4
- package/dist/types.mjs +14 -2
- package/dist/volar.mjs +1 -1
- package/package.json +12 -12
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { InlineConfig, UserConfig as UserConfig$2, ViteDevServer, build, ConfigEnv } from 'vite';
|
|
2
2
|
import { GenerateType, Component, Theme, Sitemap, App, Page, Plugin } from '@weapp-core/schematics';
|
|
3
|
-
import { WeappWebPluginOptions } from '@weapp-vite/web';
|
|
4
|
-
import { InputOption, RolldownOutput, RolldownWatcher } from 'rolldown';
|
|
5
|
-
import { Options } from 'rolldown-plugin-dts';
|
|
6
|
-
import { CompilerOptions } from 'typescript';
|
|
7
3
|
import { WrapPluginOptions } from 'vite-plugin-performance';
|
|
8
4
|
import { PluginOptions } from 'vite-tsconfig-paths';
|
|
9
5
|
import { WevuDefaults } from 'wevu';
|
|
6
|
+
import { WeappWebPluginOptions } from '@weapp-vite/web/plugin';
|
|
7
|
+
import { InputOption, RolldownOutput, RolldownWatcher } from 'rolldown';
|
|
8
|
+
import { Options } from 'rolldown-plugin-dts';
|
|
9
|
+
import { CompilerOptions } from 'typescript';
|
|
10
10
|
import { R as Resolver, a as ResolvedValue } from './types-B6irZnLM.js';
|
|
11
11
|
import { LoggerConfig } from '@weapp-core/logger';
|
|
12
12
|
import PQueue from 'p-queue';
|
|
@@ -36,13 +36,28 @@ declare module 'vite' {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
type NpmBuildOptions = InlineConfig;
|
|
39
|
+
/**
|
|
40
|
+
* @description 支付宝平台本地 npm 输出模式
|
|
41
|
+
*/
|
|
39
42
|
type AlipayNpmMode = 'miniprogram_npm' | 'node_modules';
|
|
40
43
|
interface Alias {
|
|
44
|
+
/**
|
|
45
|
+
* @description 被匹配的原始路径或正则
|
|
46
|
+
*/
|
|
41
47
|
find: string | RegExp;
|
|
48
|
+
/**
|
|
49
|
+
* @description 命中后的替换路径
|
|
50
|
+
*/
|
|
42
51
|
replacement: string;
|
|
43
52
|
}
|
|
44
53
|
interface ResolvedAlias {
|
|
54
|
+
/**
|
|
55
|
+
* @description 解析后的匹配条件
|
|
56
|
+
*/
|
|
45
57
|
find: string | RegExp;
|
|
58
|
+
/**
|
|
59
|
+
* @description 解析后的替换路径
|
|
60
|
+
*/
|
|
46
61
|
replacement: string;
|
|
47
62
|
}
|
|
48
63
|
interface AliasOptions {
|
|
@@ -56,16 +71,6 @@ interface AliasOptions {
|
|
|
56
71
|
* },
|
|
57
72
|
* ]
|
|
58
73
|
* ```
|
|
59
|
-
* 这样你就可以在 json 里面使用:
|
|
60
|
-
* ```json
|
|
61
|
-
* {
|
|
62
|
-
* "usingComponents": {
|
|
63
|
-
* "navigation-bar": "@/navigation-bar/navigation-bar",
|
|
64
|
-
* "ice-avatar": "@/avatar/avatar"
|
|
65
|
-
* }
|
|
66
|
-
* }
|
|
67
|
-
* ```
|
|
68
|
-
* 详见[json别名](/guide/alias.html#json-别名)文档
|
|
69
74
|
*/
|
|
70
75
|
entries?: readonly Alias[] | {
|
|
71
76
|
[find: string]: string;
|
|
@@ -73,12 +78,33 @@ interface AliasOptions {
|
|
|
73
78
|
}
|
|
74
79
|
type MpPlatform = 'weapp' | 'alipay' | 'tt' | 'swan' | 'jd' | 'xhs';
|
|
75
80
|
interface SubPackage {
|
|
81
|
+
/**
|
|
82
|
+
* @description 分包内页面列表,路径相对于分包 root
|
|
83
|
+
*/
|
|
76
84
|
pages: string[];
|
|
85
|
+
/**
|
|
86
|
+
* @description 分包根目录
|
|
87
|
+
*/
|
|
77
88
|
root: string;
|
|
89
|
+
/**
|
|
90
|
+
* @description 是否为独立分包
|
|
91
|
+
*/
|
|
78
92
|
independent?: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* @description 分包入口文件,也基于 root 解析
|
|
95
|
+
*/
|
|
79
96
|
entry?: string;
|
|
97
|
+
/**
|
|
98
|
+
* @description 分包名称
|
|
99
|
+
*/
|
|
80
100
|
name?: string;
|
|
101
|
+
/**
|
|
102
|
+
* @description 分包依赖范围控制
|
|
103
|
+
*/
|
|
81
104
|
dependencies?: (string | RegExp)[];
|
|
105
|
+
/**
|
|
106
|
+
* @description 分包级额外 inline Vite 配置
|
|
107
|
+
*/
|
|
82
108
|
inlineConfig?: Partial<InlineConfig>;
|
|
83
109
|
}
|
|
84
110
|
type SubPackageStyleScope = 'all' | 'pages' | 'components';
|
|
@@ -86,13 +112,7 @@ interface SubPackageStyleConfigObject {
|
|
|
86
112
|
/** 样式文件路径,可以是相对分包 root、相对 `srcRoot` 或绝对路径 */
|
|
87
113
|
source: string;
|
|
88
114
|
/**
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
* - `all`: 默认值,分包内所有页面与组件都会引入
|
|
92
|
-
* - `pages`: 仅匹配分包 `pages/**`
|
|
93
|
-
* - `components`: 仅匹配分包 `components/**`
|
|
94
|
-
*
|
|
95
|
-
* 可结合 `include` / `exclude` 进一步细分范围
|
|
115
|
+
* @description 作用范围快捷配置
|
|
96
116
|
*/
|
|
97
117
|
scope?: SubPackageStyleScope;
|
|
98
118
|
/** 自定义包含路径,支持传入单个 glob 或数组,默认覆盖分包内所有文件 */
|
|
@@ -102,33 +122,12 @@ interface SubPackageStyleConfigObject {
|
|
|
102
122
|
}
|
|
103
123
|
type SubPackageStyleConfigEntry = string | SubPackageStyleConfigObject;
|
|
104
124
|
interface SubPackageStyleEntry {
|
|
105
|
-
/**
|
|
106
|
-
* 源配置字符串(便于诊断)
|
|
107
|
-
*/
|
|
108
125
|
source: string;
|
|
109
|
-
/**
|
|
110
|
-
* 原始样式文件的绝对路径
|
|
111
|
-
*/
|
|
112
126
|
absolutePath: string;
|
|
113
|
-
/**
|
|
114
|
-
* 相对于 `srcRoot` 的输出路径(已转换为目标平台样式后缀)
|
|
115
|
-
*/
|
|
116
127
|
outputRelativePath: string;
|
|
117
|
-
/**
|
|
118
|
-
* 源文件扩展名(包含 `.`)
|
|
119
|
-
*/
|
|
120
128
|
inputExtension: string;
|
|
121
|
-
/**
|
|
122
|
-
* 作用域快捷字段,便于诊断输出
|
|
123
|
-
*/
|
|
124
129
|
scope: SubPackageStyleScope;
|
|
125
|
-
/**
|
|
126
|
-
* 允许生效的 glob 列表(基于分包 root 的相对路径)
|
|
127
|
-
*/
|
|
128
130
|
include: string[];
|
|
129
|
-
/**
|
|
130
|
-
* 排除的 glob 列表(基于分包 root 的相对路径)
|
|
131
|
-
*/
|
|
132
131
|
exclude: string[];
|
|
133
132
|
}
|
|
134
133
|
type GenerateExtensionsOptions = Partial<{
|
|
@@ -169,21 +168,9 @@ type GenerateTemplateEntry = Partial<Record<GenerateFileType, GenerateTemplate>>
|
|
|
169
168
|
type GenerateTemplateScope = GenerateType | 'shared';
|
|
170
169
|
type GenerateTemplatesConfig = Partial<Record<GenerateTemplateScope, GenerateTemplateEntry>>;
|
|
171
170
|
interface GenerateOptions {
|
|
172
|
-
/**
|
|
173
|
-
* 生成文件的扩展名
|
|
174
|
-
*/
|
|
175
171
|
extensions?: GenerateExtensionsOptions;
|
|
176
|
-
/**
|
|
177
|
-
* 默认生成文件的相对路径
|
|
178
|
-
*/
|
|
179
172
|
dirs?: GenerateDirsOptions;
|
|
180
|
-
/**
|
|
181
|
-
* 默认生成文件的名称
|
|
182
|
-
*/
|
|
183
173
|
filenames?: GenerateFilenamesOptions;
|
|
184
|
-
/**
|
|
185
|
-
* 自定义模板
|
|
186
|
-
*/
|
|
187
174
|
templates?: GenerateTemplatesConfig;
|
|
188
175
|
}
|
|
189
176
|
interface CopyOptions {
|
|
@@ -191,46 +178,16 @@ interface CopyOptions {
|
|
|
191
178
|
exclude?: CopyGlobs;
|
|
192
179
|
filter?: (filePath: string, index: number, array: string[]) => boolean;
|
|
193
180
|
}
|
|
181
|
+
/**
|
|
182
|
+
* @description 资源复制使用的 glob 列表
|
|
183
|
+
*/
|
|
194
184
|
type CopyGlobs = string[];
|
|
195
185
|
interface WeappWebConfig {
|
|
196
|
-
/**
|
|
197
|
-
* @description 是否启用浏览器端运行时集成
|
|
198
|
-
* @default false
|
|
199
|
-
* @example
|
|
200
|
-
* enable: true
|
|
201
|
-
*/
|
|
202
186
|
enable?: boolean;
|
|
203
|
-
/**
|
|
204
|
-
* @description Web 侧项目根目录(即 index.html 所在目录)
|
|
205
|
-
* @default 项目根目录
|
|
206
|
-
* @example
|
|
207
|
-
* root: 'web'
|
|
208
|
-
*/
|
|
209
187
|
root?: string;
|
|
210
|
-
/**
|
|
211
|
-
* @description 小程序源码目录(相对于 `root`),默认与 `weapp.srcRoot` 保持一致
|
|
212
|
-
* @example
|
|
213
|
-
* srcDir: 'src'
|
|
214
|
-
*/
|
|
215
188
|
srcDir?: string;
|
|
216
|
-
/**
|
|
217
|
-
* @description Web 构建产物输出目录;相对路径基于 `root`
|
|
218
|
-
* @default "dist/web"
|
|
219
|
-
* @example
|
|
220
|
-
* outDir: 'dist/web'
|
|
221
|
-
*/
|
|
222
189
|
outDir?: string;
|
|
223
|
-
/**
|
|
224
|
-
* @description 传递给 `weappWebPlugin` 的额外参数(不包含 `srcDir`)
|
|
225
|
-
* @example
|
|
226
|
-
* pluginOptions: { runtime: { executionMode: 'safe' } }
|
|
227
|
-
*/
|
|
228
190
|
pluginOptions?: Partial<Omit<WeappWebPluginOptions, 'srcDir'>>;
|
|
229
|
-
/**
|
|
230
|
-
* @description 额外合并到 Web 构建中的 Vite 内联配置
|
|
231
|
-
* @example
|
|
232
|
-
* vite: { server: { host: true } }
|
|
233
|
-
*/
|
|
234
191
|
vite?: InlineConfig;
|
|
235
192
|
}
|
|
236
193
|
interface WeappLibEntryContext {
|
|
@@ -240,202 +197,39 @@ interface WeappLibEntryContext {
|
|
|
240
197
|
type WeappLibFileName = string | ((context: WeappLibEntryContext) => string);
|
|
241
198
|
type WeappLibComponentJson = boolean | 'auto' | ((context: WeappLibEntryContext) => Record<string, any>);
|
|
242
199
|
interface WeappLibInternalDtsOptions {
|
|
243
|
-
/**
|
|
244
|
-
* @description internal 方案使用的 tsconfig 路径(false 表示不加载)
|
|
245
|
-
*/
|
|
246
200
|
tsconfig?: string | false;
|
|
247
|
-
/**
|
|
248
|
-
* @description internal 方案的 compilerOptions
|
|
249
|
-
*/
|
|
250
201
|
compilerOptions?: CompilerOptions;
|
|
251
|
-
/**
|
|
252
|
-
* @description internal 方案的 vueCompilerOptions
|
|
253
|
-
*/
|
|
254
202
|
vueCompilerOptions?: Record<string, any>;
|
|
255
203
|
}
|
|
256
204
|
interface WeappLibVueTscOptions {
|
|
257
|
-
/**
|
|
258
|
-
* @description 额外合并到 vue-tsc 的 tsconfig(浅合并)
|
|
259
|
-
*/
|
|
260
205
|
tsconfig?: Record<string, any>;
|
|
261
|
-
/**
|
|
262
|
-
* @description 传递给 vue-tsc 的 compilerOptions
|
|
263
|
-
*/
|
|
264
206
|
compilerOptions?: CompilerOptions;
|
|
265
|
-
/**
|
|
266
|
-
* @description 传递给 vue-tsc 的 vueCompilerOptions
|
|
267
|
-
*/
|
|
268
207
|
vueCompilerOptions?: Record<string, any>;
|
|
269
208
|
}
|
|
270
209
|
interface WeappLibDtsOptions {
|
|
271
|
-
/**
|
|
272
|
-
* @description 是否启用 lib 产物的 dts
|
|
273
|
-
* @default true
|
|
274
|
-
*/
|
|
275
210
|
enabled?: boolean;
|
|
276
|
-
/**
|
|
277
|
-
* @description Vue SFC dts 生成方式
|
|
278
|
-
* @default 'internal'
|
|
279
|
-
*/
|
|
280
211
|
mode?: 'internal' | 'vue-tsc';
|
|
281
|
-
/**
|
|
282
|
-
* @description internal 方案的配置
|
|
283
|
-
*/
|
|
284
212
|
internal?: WeappLibInternalDtsOptions;
|
|
285
|
-
/**
|
|
286
|
-
* @description 透传给 rolldown-plugin-dts 的配置(内置字段会被覆盖)
|
|
287
|
-
*/
|
|
288
213
|
rolldown?: Options;
|
|
289
|
-
/**
|
|
290
|
-
* @description 透传给 vue-tsc 的配置(会合并到临时 tsconfig)
|
|
291
|
-
*/
|
|
292
214
|
vueTsc?: WeappLibVueTscOptions;
|
|
293
215
|
}
|
|
294
216
|
interface WeappLibConfig {
|
|
295
|
-
/**
|
|
296
|
-
* @description 入口配置,支持 string/array/record 形式
|
|
297
|
-
* @example
|
|
298
|
-
* entry: 'components/button/index.ts'
|
|
299
|
-
* @example
|
|
300
|
-
* entry: ['components/button/index.ts', 'utils/index.ts']
|
|
301
|
-
* @example
|
|
302
|
-
* entry: { button: 'components/button/index.ts' }
|
|
303
|
-
*/
|
|
304
217
|
entry: string | string[] | Record<string, string>;
|
|
305
|
-
/**
|
|
306
|
-
* @description 库源码根目录,默认沿用 `weapp.srcRoot`
|
|
307
|
-
*/
|
|
308
218
|
root?: string;
|
|
309
|
-
/**
|
|
310
|
-
* @description 输出目录,默认沿用 `build.outDir`
|
|
311
|
-
*/
|
|
312
219
|
outDir?: string;
|
|
313
|
-
/**
|
|
314
|
-
* @description 是否保持输出路径与源码路径一致
|
|
315
|
-
* @default true
|
|
316
|
-
*/
|
|
317
220
|
preservePath?: boolean;
|
|
318
|
-
/**
|
|
319
|
-
* @description 自定义 JS 产物路径(不含扩展名)
|
|
320
|
-
*/
|
|
321
221
|
fileName?: WeappLibFileName;
|
|
322
|
-
/**
|
|
323
|
-
* @description 自动生成组件 JSON 配置
|
|
324
|
-
* @default 'auto'
|
|
325
|
-
*/
|
|
326
222
|
componentJson?: WeappLibComponentJson;
|
|
327
|
-
/**
|
|
328
|
-
* @description 是否生成 lib 产物的 dts
|
|
329
|
-
* @default true
|
|
330
|
-
* @example
|
|
331
|
-
* dts: false
|
|
332
|
-
* @example
|
|
333
|
-
* dts: { enabled: false }
|
|
334
|
-
* @example
|
|
335
|
-
* dts: { mode: 'vue-tsc' }
|
|
336
|
-
* @example
|
|
337
|
-
* dts: { rolldown: { tsconfigRaw: { compilerOptions: { declarationMap: true } } } }
|
|
338
|
-
* @example
|
|
339
|
-
* dts: { vueTsc: { compilerOptions: { declarationMap: true } } }
|
|
340
|
-
* @example
|
|
341
|
-
* dts: { internal: { compilerOptions: { declarationMap: true } } }
|
|
342
|
-
*/
|
|
343
223
|
dts?: boolean | WeappLibDtsOptions;
|
|
344
224
|
}
|
|
345
|
-
interface AutoImportComponents {
|
|
346
|
-
/**
|
|
347
|
-
* 自动导入组件
|
|
348
|
-
*/
|
|
349
|
-
globs?: string[];
|
|
350
|
-
/**
|
|
351
|
-
* 自动导入组件解析器
|
|
352
|
-
*/
|
|
353
|
-
resolvers?: Resolver[];
|
|
354
|
-
/**
|
|
355
|
-
* 自动导入组件清单输出路径,默认输出到 `vite.config.ts` 同级目录的 `auto-import-components.json`
|
|
356
|
-
* - `true` 或未指定: 按默认路径输出
|
|
357
|
-
* - 传入字符串: 指定输出路径 (支持绝对/相对路径)
|
|
358
|
-
* - `false`: 不生成清单文件
|
|
359
|
-
*/
|
|
360
|
-
output?: string | boolean;
|
|
361
|
-
/**
|
|
362
|
-
* 生成 WXML 组件 props 类型声明文件。
|
|
363
|
-
* - `true`: 输出到 `vite.config.ts` 同级目录的 `typed-components.d.ts`
|
|
364
|
-
* - 传入字符串: 自定义输出路径 (支持绝对/相对路径)
|
|
365
|
-
* - `false` 或未配置: 不生成类型文件
|
|
366
|
-
*/
|
|
367
|
-
typedComponents?: boolean | string;
|
|
368
|
-
/**
|
|
369
|
-
* 生成 VS Code HTML customData 用于模板补全。
|
|
370
|
-
* - `true`: 输出到 `vite.config.ts` 同级目录的 `mini-program.html-data.json`
|
|
371
|
-
* - 传入字符串: 自定义输出路径 (支持绝对/相对路径)
|
|
372
|
-
* - `false` 或未配置: 不生成 customData
|
|
373
|
-
*/
|
|
374
|
-
htmlCustomData?: boolean | string;
|
|
375
|
-
/**
|
|
376
|
-
* 生成 Vue SFC 模板补全用的组件类型声明文件(`components.d.ts`)。
|
|
377
|
-
* - `true`: 输出到 `vite.config.ts` 同级目录的 `components.d.ts`
|
|
378
|
-
* - 传入字符串: 自定义输出路径 (支持绝对/相对路径)
|
|
379
|
-
* - `false` 或未配置: 不生成类型文件
|
|
380
|
-
*/
|
|
381
|
-
vueComponents?: boolean | string;
|
|
382
|
-
/**
|
|
383
|
-
* 生成 `components.d.ts` 时使用的运行时模块名(`declare module 'xxx'`)。
|
|
384
|
-
* - 默认 `'vue'`
|
|
385
|
-
* - 使用 wevu 并设置 `vueCompilerOptions.lib = "wevu"` 时请改为 `'wevu'`
|
|
386
|
-
*/
|
|
387
|
-
vueComponentsModule?: string;
|
|
388
|
-
}
|
|
389
|
-
type AutoImportComponentsOption = AutoImportComponents | false;
|
|
390
|
-
type EnhanceWxmlOptions = ScanWxmlOptions & HandleWxmlOptions;
|
|
391
|
-
interface ScanWxmlOptions {
|
|
392
|
-
excludeComponent?: (tagName: string) => boolean;
|
|
393
|
-
platform?: MpPlatform;
|
|
394
|
-
}
|
|
395
|
-
interface HandleWxmlOptions {
|
|
396
|
-
removeComment?: boolean;
|
|
397
|
-
transformEvent?: boolean;
|
|
398
|
-
scriptModuleExtension?: string;
|
|
399
|
-
scriptModuleTag?: string;
|
|
400
|
-
templateExtension?: string;
|
|
401
|
-
}
|
|
402
|
-
interface EnhanceOptions {
|
|
403
|
-
/**
|
|
404
|
-
* 增强:wxml
|
|
405
|
-
*/
|
|
406
|
-
wxml?: boolean | (Partial<Omit<EnhanceWxmlOptions, 'platform'>>);
|
|
407
|
-
/**
|
|
408
|
-
* 增强:wxs
|
|
409
|
-
*/
|
|
410
|
-
wxs?: boolean;
|
|
411
|
-
/**
|
|
412
|
-
* 自动导入小程序组件
|
|
413
|
-
*/
|
|
414
|
-
autoImportComponents?: AutoImportComponentsOption;
|
|
415
|
-
}
|
|
416
225
|
interface BuildNpmPackageMeta {
|
|
417
226
|
name: string;
|
|
418
227
|
entry: InputOption;
|
|
419
228
|
}
|
|
420
229
|
interface NpmSubPackageConfig {
|
|
421
|
-
/**
|
|
422
|
-
* @description 分包本地 npm 依赖范围
|
|
423
|
-
*
|
|
424
|
-
* 当声明该字段后,会为对应分包输出本地 `miniprogram_npm`,
|
|
425
|
-
* 并将分包内命中的 npm 引用本地化到该目录。
|
|
426
|
-
*/
|
|
427
230
|
dependencies?: (string | RegExp)[];
|
|
428
231
|
}
|
|
429
232
|
interface NpmMainPackageConfig {
|
|
430
|
-
/**
|
|
431
|
-
* @description 主包 `miniprogram_npm` 依赖输出范围
|
|
432
|
-
* - `undefined`: 默认行为,按根 `package.json.dependencies` 全量输出到主包
|
|
433
|
-
* - `false`: 禁止输出主包 `miniprogram_npm`
|
|
434
|
-
* - `string[] | RegExp[]`: 仅输出命中的依赖到主包
|
|
435
|
-
*
|
|
436
|
-
* 适用于依赖只希望落在特定分包 `miniprogram_npm` 的场景,
|
|
437
|
-
* 需配合 `weapp.npm.subPackages.<root>.dependencies` 显式声明各分包依赖集。
|
|
438
|
-
*/
|
|
439
233
|
dependencies?: false | (string | RegExp)[];
|
|
440
234
|
}
|
|
441
235
|
type JsFormat = 'cjs' | 'esm';
|
|
@@ -455,495 +249,280 @@ interface JsonMergeContext {
|
|
|
455
249
|
type JsonMergeFunction = (target: Record<string, any>, source: Record<string, any>, context: JsonMergeContext) => Record<string, any> | void;
|
|
456
250
|
type JsonMergeStrategy = 'deep' | 'assign' | 'replace' | JsonMergeFunction;
|
|
457
251
|
interface JsonConfig {
|
|
458
|
-
/**
|
|
459
|
-
* @description 产物 JSON 默认值(用于 app/page/component)
|
|
460
|
-
*/
|
|
461
252
|
defaults?: {
|
|
462
253
|
app?: Record<string, any>;
|
|
463
254
|
page?: Record<string, any>;
|
|
464
255
|
component?: Record<string, any>;
|
|
465
256
|
};
|
|
466
|
-
/**
|
|
467
|
-
* @description JSON 合并策略
|
|
468
|
-
* - `deep`: 深合并(默认)
|
|
469
|
-
* - `assign`: 浅合并(Object.assign)
|
|
470
|
-
* - `replace`: 直接替换
|
|
471
|
-
* - `function`: 自定义合并函数
|
|
472
|
-
*/
|
|
473
257
|
mergeStrategy?: JsonMergeStrategy;
|
|
474
258
|
}
|
|
475
259
|
interface ChunksConfig {
|
|
476
|
-
/**
|
|
477
|
-
* @description 控制跨分包共享代码的输出策略
|
|
478
|
-
* - `duplicate`: 默认策略,将共享代码复制到各自的分包中
|
|
479
|
-
* - `hoist`: 将共享代码提炼到主包中
|
|
480
|
-
* @default 'duplicate'
|
|
481
|
-
*/
|
|
482
260
|
sharedStrategy?: SharedChunkStrategy;
|
|
261
|
+
sharedMode?: SharedChunkMode;
|
|
262
|
+
sharedOverrides?: SharedChunkOverride[];
|
|
263
|
+
sharedPathRoot?: string;
|
|
264
|
+
dynamicImports?: SharedChunkDynamicImports;
|
|
265
|
+
logOptimization?: boolean;
|
|
266
|
+
forceDuplicatePatterns?: (string | RegExp)[];
|
|
267
|
+
duplicateWarningBytes?: number;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* @description 自动导入组件配置
|
|
272
|
+
*/
|
|
273
|
+
interface AutoImportComponents {
|
|
483
274
|
/**
|
|
484
|
-
* @description
|
|
485
|
-
* - `common`: 默认策略,复用模块会被抽到 common.js
|
|
486
|
-
* - `path`: 共享模块按源码相对路径输出(无 common.js)
|
|
487
|
-
* - `inline`: 禁用共享 chunk,复用模块将内联到引用方
|
|
488
|
-
* @default 'common'
|
|
275
|
+
* @description 组件扫描范围
|
|
489
276
|
*/
|
|
490
|
-
|
|
277
|
+
globs?: string[];
|
|
491
278
|
/**
|
|
492
|
-
* @description
|
|
493
|
-
* 匹配基于 srcRoot 的相对路径或绝对路径。
|
|
279
|
+
* @description 组件解析器列表
|
|
494
280
|
*/
|
|
495
|
-
|
|
281
|
+
resolvers?: Resolver[];
|
|
496
282
|
/**
|
|
497
|
-
* @description
|
|
498
|
-
* @default srcRoot
|
|
283
|
+
* @description 组件清单输出路径
|
|
499
284
|
*/
|
|
500
|
-
|
|
285
|
+
output?: string | boolean;
|
|
501
286
|
/**
|
|
502
|
-
* @description
|
|
503
|
-
* - `preserve`: 保持独立 chunk
|
|
504
|
-
* - `inline`: 尝试内联动态 import
|
|
505
|
-
* @default 'preserve'
|
|
287
|
+
* @description WXML 组件 props 类型声明输出路径
|
|
506
288
|
*/
|
|
507
|
-
|
|
289
|
+
typedComponents?: boolean | string;
|
|
508
290
|
/**
|
|
509
|
-
* @description
|
|
510
|
-
* @default true
|
|
291
|
+
* @description VS Code HTML customData 输出路径
|
|
511
292
|
*/
|
|
512
|
-
|
|
293
|
+
htmlCustomData?: boolean | string;
|
|
513
294
|
/**
|
|
514
|
-
* @description
|
|
515
|
-
* 其「主包」身份会被忽略,继续沿用 duplicate 策略。支持字符串或正则表达式,默认基于 srcRoot 的相对路径匹配。
|
|
295
|
+
* @description Vue SFC 组件声明输出路径
|
|
516
296
|
*/
|
|
517
|
-
|
|
297
|
+
vueComponents?: boolean | string;
|
|
518
298
|
/**
|
|
519
|
-
* @description
|
|
520
|
-
* @default 524288 (约 512 KB)
|
|
299
|
+
* @description 生成 `components.d.ts` 时使用的运行时模块名
|
|
521
300
|
*/
|
|
522
|
-
|
|
301
|
+
vueComponentsModule?: string;
|
|
302
|
+
}
|
|
303
|
+
type AutoImportComponentsOption = AutoImportComponents | boolean;
|
|
304
|
+
type EnhanceWxmlOptions = ScanWxmlOptions & HandleWxmlOptions;
|
|
305
|
+
/**
|
|
306
|
+
* @description WXML 扫描阶段配置
|
|
307
|
+
*/
|
|
308
|
+
interface ScanWxmlOptions {
|
|
309
|
+
excludeComponent?: (tagName: string) => boolean;
|
|
310
|
+
platform?: MpPlatform;
|
|
523
311
|
}
|
|
312
|
+
/**
|
|
313
|
+
* @description WXML 处理阶段配置
|
|
314
|
+
*/
|
|
315
|
+
interface HandleWxmlOptions {
|
|
316
|
+
removeComment?: boolean;
|
|
317
|
+
transformEvent?: boolean;
|
|
318
|
+
scriptModuleExtension?: string;
|
|
319
|
+
scriptModuleTag?: string;
|
|
320
|
+
templateExtension?: string;
|
|
321
|
+
}
|
|
322
|
+
interface EnhanceOptions {
|
|
323
|
+
wxml?: boolean | Partial<Omit<EnhanceWxmlOptions, 'platform'>>;
|
|
324
|
+
wxs?: boolean;
|
|
325
|
+
autoImportComponents?: AutoImportComponentsOption;
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* @description 多平台 project.config 配置
|
|
329
|
+
*/
|
|
524
330
|
interface MultiPlatformConfig {
|
|
525
|
-
/**
|
|
526
|
-
* @description 是否启用多平台 project.config 解析
|
|
527
|
-
* @default true
|
|
528
|
-
* @example
|
|
529
|
-
* enabled: true
|
|
530
|
-
*/
|
|
531
331
|
enabled?: boolean;
|
|
532
|
-
/**
|
|
533
|
-
* @description 平台 project.config 目录根(实际读取 `${root}/${platform}/<platformConfigFile>`)
|
|
534
|
-
* @default 'config'
|
|
535
|
-
* @example
|
|
536
|
-
* projectConfigRoot: 'config'
|
|
537
|
-
*/
|
|
538
332
|
projectConfigRoot?: string;
|
|
539
333
|
}
|
|
334
|
+
/**
|
|
335
|
+
* @description MCP 服务配置
|
|
336
|
+
*/
|
|
540
337
|
interface WeappMcpConfig {
|
|
541
|
-
/**
|
|
542
|
-
* @description 是否启用 MCP 能力
|
|
543
|
-
* @default true
|
|
544
|
-
*/
|
|
545
338
|
enabled?: boolean;
|
|
546
|
-
/**
|
|
547
|
-
* @description 是否在 weapp-vite CLI 启动时自动拉起 MCP HTTP 服务
|
|
548
|
-
* @default false
|
|
549
|
-
*/
|
|
550
339
|
autoStart?: boolean;
|
|
551
|
-
/**
|
|
552
|
-
* @description MCP HTTP 服务监听主机
|
|
553
|
-
* @default '127.0.0.1'
|
|
554
|
-
*/
|
|
555
340
|
host?: string;
|
|
341
|
+
port?: number;
|
|
342
|
+
endpoint?: string;
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* @description 自动路由配置
|
|
346
|
+
*/
|
|
347
|
+
type WeappAutoRoutesIncludePattern = string | RegExp;
|
|
348
|
+
/**
|
|
349
|
+
* @description 自动路由包含规则
|
|
350
|
+
*/
|
|
351
|
+
type WeappAutoRoutesInclude = WeappAutoRoutesIncludePattern | WeappAutoRoutesIncludePattern[];
|
|
352
|
+
/**
|
|
353
|
+
* @description 自动路由配置
|
|
354
|
+
*/
|
|
355
|
+
interface WeappAutoRoutesConfig {
|
|
356
|
+
enabled?: boolean;
|
|
357
|
+
typedRouter?: boolean;
|
|
556
358
|
/**
|
|
557
|
-
* @description
|
|
558
|
-
* @
|
|
359
|
+
* @description 自动路由扫描规则,支持字符串 glob、正则以及它们的数组
|
|
360
|
+
* @remarks 默认会扫描主包 `pages/**`,以及已声明分包 root 下的 `pages/**`
|
|
559
361
|
*/
|
|
560
|
-
|
|
362
|
+
include?: WeappAutoRoutesInclude;
|
|
561
363
|
/**
|
|
562
|
-
* @description
|
|
563
|
-
* @default
|
|
364
|
+
* @description 是否启用自动路由持久化缓存,或指定自定义缓存文件路径
|
|
365
|
+
* @default false
|
|
564
366
|
*/
|
|
565
|
-
|
|
367
|
+
persistentCache?: boolean | string;
|
|
368
|
+
watch?: boolean;
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* @description `@wevu/api` 注入配置
|
|
372
|
+
*/
|
|
373
|
+
interface WeappInjectWeapiConfig {
|
|
374
|
+
enabled?: boolean;
|
|
375
|
+
replaceWx?: boolean;
|
|
376
|
+
globalName?: string;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* @description 本地 npm 构建配置
|
|
380
|
+
*/
|
|
381
|
+
interface WeappNpmConfig {
|
|
382
|
+
enable?: boolean;
|
|
383
|
+
cache?: boolean;
|
|
384
|
+
mainPackage?: NpmMainPackageConfig;
|
|
385
|
+
subPackages?: Record<string, NpmSubPackageConfig>;
|
|
386
|
+
buildOptions?: (options: NpmBuildOptions, pkgMeta: BuildNpmPackageMeta) => NpmBuildOptions | undefined;
|
|
387
|
+
alipayNpmMode?: AlipayNpmMode;
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* @description 分包级额外配置
|
|
391
|
+
*/
|
|
392
|
+
interface WeappSubPackageConfig {
|
|
393
|
+
independent?: boolean;
|
|
394
|
+
inlineConfig?: Partial<InlineConfig>;
|
|
395
|
+
autoImportComponents?: AutoImportComponentsOption;
|
|
396
|
+
watchSharedStyles?: boolean;
|
|
397
|
+
styles?: SubPackageStyleConfigEntry | SubPackageStyleConfigEntry[];
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* @description HMR 配置
|
|
401
|
+
*/
|
|
402
|
+
interface WeappHmrConfig {
|
|
403
|
+
sharedChunks?: 'full' | 'auto' | 'off';
|
|
404
|
+
touchAppWxss?: boolean | 'auto';
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* @description worker 构建配置
|
|
408
|
+
*/
|
|
409
|
+
interface WeappWorkerConfig {
|
|
410
|
+
entry?: string | string[];
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* @description Vue 模板编译配置
|
|
414
|
+
*/
|
|
415
|
+
interface WeappVueTemplateConfig {
|
|
416
|
+
removeComments?: boolean;
|
|
417
|
+
simplifyWhitespace?: boolean;
|
|
418
|
+
scopedSlotsCompiler?: 'auto' | 'augmented' | 'off';
|
|
419
|
+
scopedSlotsRequireProps?: boolean;
|
|
420
|
+
slotMultipleInstance?: boolean;
|
|
421
|
+
classStyleRuntime?: 'auto' | 'wxs' | 'js';
|
|
422
|
+
objectLiteralBindMode?: 'runtime' | 'inline';
|
|
423
|
+
mustacheInterpolation?: 'compact' | 'spaced';
|
|
424
|
+
classStyleWxsShared?: boolean;
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* @description Vue 支持配置
|
|
428
|
+
*/
|
|
429
|
+
interface WeappVueConfig {
|
|
430
|
+
enable?: boolean;
|
|
431
|
+
template?: WeappVueTemplateConfig;
|
|
432
|
+
autoImport?: boolean;
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* @description wevu 编译期默认值配置
|
|
436
|
+
*/
|
|
437
|
+
interface WeappWevuConfig {
|
|
438
|
+
preset?: 'performance';
|
|
439
|
+
defaults?: WevuDefaults;
|
|
440
|
+
autoSetDataPick?: boolean;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* @description 分包元信息
|
|
445
|
+
*/
|
|
446
|
+
interface SubPackageMetaValue {
|
|
447
|
+
entries: string[];
|
|
448
|
+
subPackage: SubPackage;
|
|
449
|
+
autoImportComponents?: AutoImportComponentsOption;
|
|
450
|
+
styleEntries?: SubPackageStyleEntry[];
|
|
451
|
+
watchSharedStyles?: boolean;
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* @description 调试输出配置
|
|
455
|
+
*/
|
|
456
|
+
interface WeappDebugConfig {
|
|
457
|
+
watchFiles?: (watchFiles: string[], subPackageMeta?: SubPackageMetaValue) => void;
|
|
458
|
+
resolveId?: (id: string, subPackageMeta?: SubPackageMetaValue) => void;
|
|
459
|
+
load?: (id: string, subPackageMeta?: SubPackageMetaValue) => void;
|
|
460
|
+
inspect?: WrapPluginOptions;
|
|
566
461
|
}
|
|
462
|
+
/**
|
|
463
|
+
* @description weapp-vite 主配置
|
|
464
|
+
*/
|
|
567
465
|
interface WeappViteConfig {
|
|
568
466
|
/**
|
|
569
467
|
* 应用入口目录(`app.json` 所在目录)。
|
|
570
|
-
* 默认 js 模板在根目录 `.`,ts 模板在 `miniprogram` 目录;
|
|
571
|
-
* 你也可以把所有代码放在 `src` 目录下,并设置此选项为 `src`。
|
|
572
|
-
* @default '.'
|
|
573
|
-
* @example
|
|
574
|
-
* srcRoot: 'src'
|
|
575
468
|
*/
|
|
576
469
|
srcRoot?: string;
|
|
577
470
|
/**
|
|
578
|
-
*
|
|
579
|
-
*
|
|
580
|
-
*
|
|
581
|
-
*
|
|
582
|
-
* autoRoutes: true
|
|
471
|
+
* 自动路由模块配置。
|
|
472
|
+
* - `undefined` / `false`: 默认关闭
|
|
473
|
+
* - `true`: 启用默认自动路由配置
|
|
474
|
+
* - `object`: 启用自动路由并允许细粒度控制
|
|
583
475
|
*/
|
|
584
|
-
autoRoutes?: boolean;
|
|
476
|
+
autoRoutes?: boolean | WeappAutoRoutesConfig;
|
|
585
477
|
/**
|
|
586
|
-
*
|
|
587
|
-
* @default undefined
|
|
588
|
-
* @example
|
|
589
|
-
* pluginRoot: 'plugin'
|
|
478
|
+
* 插件入口目录(`plugin.json` 所在目录)。
|
|
590
479
|
*/
|
|
591
480
|
pluginRoot?: string;
|
|
592
481
|
/**
|
|
593
|
-
*
|
|
594
|
-
* @example
|
|
595
|
-
* logger: { level: 'info', tags: { build: true } }
|
|
482
|
+
* 日志输出配置。
|
|
596
483
|
*/
|
|
597
484
|
logger?: LoggerConfig;
|
|
598
485
|
/**
|
|
599
|
-
*
|
|
600
|
-
* 文件引入别名
|
|
601
|
-
* @example
|
|
602
|
-
* jsonAlias: {
|
|
603
|
-
* '@': '/src',
|
|
604
|
-
* }
|
|
486
|
+
* 主包/分包体积告警阈值(字节)。
|
|
605
487
|
*/
|
|
488
|
+
packageSizeWarningBytes?: number;
|
|
606
489
|
jsonAlias?: AliasOptions;
|
|
607
|
-
|
|
608
|
-
*
|
|
609
|
-
* @group 构建 npm
|
|
610
|
-
*/
|
|
611
|
-
npm?: {
|
|
612
|
-
/**
|
|
613
|
-
* @description 是否开启构建 npm 功能, 默认为 true
|
|
614
|
-
* @default true
|
|
615
|
-
* @example
|
|
616
|
-
* enable: true
|
|
617
|
-
*/
|
|
618
|
-
enable?: boolean;
|
|
619
|
-
/**
|
|
620
|
-
* @description 是否开启缓存,默认为 true
|
|
621
|
-
* @default true
|
|
622
|
-
* @example
|
|
623
|
-
* cache: true
|
|
624
|
-
*/
|
|
625
|
-
cache?: boolean;
|
|
626
|
-
/**
|
|
627
|
-
* @description 主包本地 npm 构建配置
|
|
628
|
-
*/
|
|
629
|
-
mainPackage?: NpmMainPackageConfig;
|
|
630
|
-
/**
|
|
631
|
-
* @description 分包本地 npm 构建配置
|
|
632
|
-
*
|
|
633
|
-
* 配置后,命中的分包会输出自己的 `miniprogram_npm`,
|
|
634
|
-
* 并将分包内命中的 npm 引用本地化到分包目录。
|
|
635
|
-
*/
|
|
636
|
-
subPackages?: Record<string, NpmSubPackageConfig>;
|
|
637
|
-
/**
|
|
638
|
-
* @description 构建 npm 的配置,可传入 Vite 的库模式配置,让不同的包走不同的配置
|
|
639
|
-
* - 返回值中的 `build.outDir` 同时影响二次 bundle 的依赖与直接复制 `miniprogram` 产物的依赖
|
|
640
|
-
* @example
|
|
641
|
-
* buildOptions: (options, pkg) => {
|
|
642
|
-
* if (pkg.name === 'my-lib') return { ...options, minify: false }
|
|
643
|
-
* }
|
|
644
|
-
*/
|
|
645
|
-
buildOptions?: (options: NpmBuildOptions, pkgMeta: BuildNpmPackageMeta) => NpmBuildOptions | undefined;
|
|
646
|
-
/**
|
|
647
|
-
* @description 支付宝平台 npm 依赖输出模式
|
|
648
|
-
* - `node_modules`: 输出到 dist/node_modules(默认,贴近支付宝 npm 管理语义)
|
|
649
|
-
* - `miniprogram_npm`: 输出到 dist/miniprogram_npm(兼容微信风格目录)
|
|
650
|
-
* @default 'node_modules'
|
|
651
|
-
*/
|
|
652
|
-
alipayNpmMode?: AlipayNpmMode;
|
|
653
|
-
};
|
|
654
|
-
/**
|
|
655
|
-
* @group 生成脚手架配置
|
|
656
|
-
* 生成器(weapp-vite generate)相关配置
|
|
657
|
-
* @example
|
|
658
|
-
* generate: { dirs: { page: 'src/pages' } }
|
|
659
|
-
*/
|
|
490
|
+
npm?: WeappNpmConfig;
|
|
660
491
|
generate?: GenerateOptions;
|
|
661
|
-
/**
|
|
662
|
-
* @group 插件集成
|
|
663
|
-
* 传递给内置 [`vite-tsconfig-paths`](https://www.npmjs.com/package/vite-tsconfig-paths) 插件的参数
|
|
664
|
-
* - 传入 `false` 可显式禁用该插件(当项目没有 `paths/baseUrl` 时建议关闭以提速)
|
|
665
|
-
* @example
|
|
666
|
-
* tsconfigPaths: { projects: ['tsconfig.json'] }
|
|
667
|
-
*/
|
|
668
492
|
tsconfigPaths?: PluginOptions | false;
|
|
669
|
-
|
|
670
|
-
* @group 分包配置
|
|
671
|
-
* 分包是否独立的 rollup 编译上下文
|
|
672
|
-
* 默认情况下,当一个分包设置了 independent: true 之后会默认启用
|
|
673
|
-
* 可以设置 key: 为 root, value: {independent:true} 来强制启用 独立的 rollup 编译上下文
|
|
674
|
-
*/
|
|
675
|
-
subPackages?: Record<string, Pick<SubPackage, 'independent' | 'inlineConfig'> & {
|
|
676
|
-
autoImportComponents?: AutoImportComponentsOption;
|
|
677
|
-
/** 分包文件变更时是否强制重新生成共享样式产物,默认启用 */
|
|
678
|
-
watchSharedStyles?: boolean;
|
|
679
|
-
/**
|
|
680
|
-
* 分包共享样式入口,支持传入一个或多个 `wxss`/`css` 文件路径
|
|
681
|
-
* - 相对路径默认基于当前分包的 `root`
|
|
682
|
-
* - 也可以传入绝对路径或相对 `srcRoot` 的路径
|
|
683
|
-
* - 支持传入对象配置 `scope`/`include`/`exclude` 精准控制注入范围
|
|
684
|
-
* @example
|
|
685
|
-
* styles: [
|
|
686
|
-
* 'styles/shared.wxss',
|
|
687
|
-
* { path: 'styles/sub.wxss', scope: 'page' },
|
|
688
|
-
* ]
|
|
689
|
-
*/
|
|
690
|
-
styles?: SubPackageStyleConfigEntry | SubPackageStyleConfigEntry[];
|
|
691
|
-
}>;
|
|
692
|
-
/**
|
|
693
|
-
* 需要被额外包括的资源
|
|
694
|
-
* 默认情况下包括大部分的图片资源格式
|
|
695
|
-
* @example
|
|
696
|
-
* copy: ['static/**\\/*']
|
|
697
|
-
*/
|
|
493
|
+
subPackages?: Record<string, WeappSubPackageConfig>;
|
|
698
494
|
copy?: CopyOptions;
|
|
699
|
-
/**
|
|
700
|
-
* @group Web 运行时
|
|
701
|
-
* 浏览器端运行时相关配置
|
|
702
|
-
* @example
|
|
703
|
-
* web: { enabled: true, srcDir: 'src', outDir: 'dist/web' }
|
|
704
|
-
*/
|
|
705
495
|
web?: WeappWebConfig;
|
|
706
|
-
/**
|
|
707
|
-
* @group 库模式
|
|
708
|
-
* 用于构建组件库或小程序模块的 lib 模式配置
|
|
709
|
-
*/
|
|
710
496
|
lib?: WeappLibConfig;
|
|
711
|
-
/**
|
|
712
|
-
* @description 额外的 wxml 文件
|
|
713
|
-
* 把这个方法,扫描到的 `wxml` 添加到额外的 `wxml` 文件列表, **处理** 之后输出到最终的产物中
|
|
714
|
-
* @param wxmlFilePath
|
|
715
|
-
* @returns boolean
|
|
716
|
-
* @example
|
|
717
|
-
* isAdditionalWxml: (file) => file.includes('custom')
|
|
718
|
-
*/
|
|
719
497
|
isAdditionalWxml?: (wxmlFilePath: string) => boolean;
|
|
720
|
-
/**
|
|
721
|
-
* @description 编译目标平台
|
|
722
|
-
* @ignore
|
|
723
|
-
*/
|
|
724
498
|
platform?: MpPlatform;
|
|
725
|
-
/**
|
|
726
|
-
* @description 多平台 project.config 支持
|
|
727
|
-
* - `true` 等价于 `{ enabled: true, projectConfigRoot: 'config' }`
|
|
728
|
-
* - 启用后必须通过 CLI `--platform` 指定目标小程序平台
|
|
729
|
-
* @example
|
|
730
|
-
* multiPlatform: true
|
|
731
|
-
* @example
|
|
732
|
-
* multiPlatform: { enabled: true, projectConfigRoot: 'config' }
|
|
733
|
-
*/
|
|
734
499
|
multiPlatform?: boolean | MultiPlatformConfig;
|
|
735
|
-
/**
|
|
736
|
-
* @description 生成的 JS 模块格式
|
|
737
|
-
* - `cjs`: 输出 CommonJS
|
|
738
|
-
* - `esm`: 输出 ESM,需要在微信开发者工具中启用「ES6 转 ES5」
|
|
739
|
-
* @default 'cjs'
|
|
740
|
-
* @example
|
|
741
|
-
* jsFormat: 'cjs'
|
|
742
|
-
*/
|
|
743
500
|
jsFormat?: JsFormat;
|
|
744
501
|
/**
|
|
745
|
-
* @
|
|
746
|
-
*
|
|
747
|
-
* @example
|
|
748
|
-
* es5: true
|
|
502
|
+
* @deprecated 已废弃,不建议继续使用。请改为保持 `build.target >= es2020`,并在开发者工具中开启“将 JS 编译成 ES5”功能。
|
|
503
|
+
* 该选项依赖 `@swc/core` 做额外 ES5 降级,后续版本将移除。
|
|
749
504
|
*/
|
|
750
505
|
es5?: boolean;
|
|
751
506
|
wxml?: EnhanceOptions['wxml'];
|
|
752
|
-
/**
|
|
753
|
-
* 增强:wxs
|
|
754
|
-
*/
|
|
755
507
|
wxs?: EnhanceOptions['wxs'];
|
|
756
|
-
/**
|
|
757
|
-
* 自动导入小程序组件
|
|
758
|
-
*/
|
|
759
508
|
autoImportComponents?: AutoImportComponentsOption;
|
|
760
|
-
/**
|
|
761
|
-
* @deprecated 请改用顶层的 `wxml`、`wxs` 与 `autoImportComponents`
|
|
762
|
-
* 增强配置
|
|
763
|
-
*/
|
|
764
509
|
enhance?: EnhanceOptions;
|
|
765
|
-
debug?:
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
/**
|
|
772
|
-
* @description 开发服务器相关配置
|
|
773
|
-
*/
|
|
774
|
-
hmr?: {
|
|
775
|
-
/**
|
|
776
|
-
* @description HMR 期间共享 chunk 的处理策略
|
|
777
|
-
* - `full`: 每次更新都重新产出全部 entry(最稳定,速度较慢)
|
|
778
|
-
* - `auto`: 仅在共享 chunk 可能被部分覆盖时回退到 full(稳定与速度折中)
|
|
779
|
-
* - `off`: 仅更新变更 entry(最快,但可能导致共享 chunk 导出不一致)
|
|
780
|
-
* @default 'auto'
|
|
781
|
-
*/
|
|
782
|
-
sharedChunks?: 'full' | 'auto' | 'off';
|
|
783
|
-
/**
|
|
784
|
-
* @description Dev 构建结束后触碰 app.wxss 以触发微信开发者工具热重载
|
|
785
|
-
* - `true`: 总是启用
|
|
786
|
-
* - `false`: 关闭
|
|
787
|
-
* - `auto`: 检测到安装 weapp-tailwindcss 时启用
|
|
788
|
-
* @default 'auto'
|
|
789
|
-
*/
|
|
790
|
-
touchAppWxss?: boolean | 'auto';
|
|
791
|
-
};
|
|
792
|
-
/**
|
|
793
|
-
* @description 构建 worker 配置
|
|
794
|
-
*/
|
|
795
|
-
worker?: {
|
|
796
|
-
/**
|
|
797
|
-
* @description 构建 worker 的入口
|
|
798
|
-
*/
|
|
799
|
-
entry?: string | string[];
|
|
800
|
-
};
|
|
801
|
-
/**
|
|
802
|
-
* @description Vue 单文件组件支持配置
|
|
803
|
-
*/
|
|
804
|
-
vue?: {
|
|
805
|
-
/**
|
|
806
|
-
* @description 是否启用 Vue 支持
|
|
807
|
-
* @default true
|
|
808
|
-
*/
|
|
809
|
-
enable?: boolean;
|
|
810
|
-
/**
|
|
811
|
-
* @description 模板编译选项
|
|
812
|
-
*/
|
|
813
|
-
template?: {
|
|
814
|
-
/**
|
|
815
|
-
* @description 是否移除注释
|
|
816
|
-
* @default true
|
|
817
|
-
*/
|
|
818
|
-
removeComments?: boolean;
|
|
819
|
-
/**
|
|
820
|
-
* @description 是否简化空白符
|
|
821
|
-
* @default true
|
|
822
|
-
*/
|
|
823
|
-
simplifyWhitespace?: boolean;
|
|
824
|
-
/**
|
|
825
|
-
* @description 作用域插槽编译策略
|
|
826
|
-
* - `auto`: 自动选择最小可用的 scoped slot 方案
|
|
827
|
-
* - `augmented`: 强制使用增强方案
|
|
828
|
-
* - `off`: 关闭 scoped slot 编译(仅保留原生 slot,不支持 slot props)
|
|
829
|
-
* @default 'auto'
|
|
830
|
-
*/
|
|
831
|
-
scopedSlotsCompiler?: 'auto' | 'augmented' | 'off';
|
|
832
|
-
/**
|
|
833
|
-
* @description 是否仅在 slot 传递作用域参数时生成 scoped slot 组件
|
|
834
|
-
* - `true`: 仅对带作用域参数的 v-slot 生成 scoped slot 组件
|
|
835
|
-
* - `false`: 所有 v-slot 都生成 scoped slot 组件(旧行为)
|
|
836
|
-
* @default true
|
|
837
|
-
*/
|
|
838
|
-
scopedSlotsRequireProps?: boolean;
|
|
839
|
-
/**
|
|
840
|
-
* @description v-for 下 scoped slot 多实例模式
|
|
841
|
-
* @default true
|
|
842
|
-
*/
|
|
843
|
-
slotMultipleInstance?: boolean;
|
|
844
|
-
/**
|
|
845
|
-
* @description class/style 绑定运行时
|
|
846
|
-
* - `auto`: 平台支持 WXS 时优先 WXS,否则回退 JS
|
|
847
|
-
* - `wxs`: 强制使用 WXS(不可用时回退 JS 并告警)
|
|
848
|
-
* - `js`: 强制使用 JS(默认;用于获得更稳定的一致性)
|
|
849
|
-
* @default 'js'
|
|
850
|
-
*/
|
|
851
|
-
classStyleRuntime?: 'auto' | 'wxs' | 'js';
|
|
852
|
-
/**
|
|
853
|
-
* @description 对象字面量 v-bind 编译模式
|
|
854
|
-
* - `runtime`: 通过运行时中间变量绑定(默认,当前行为)
|
|
855
|
-
* - `inline`: 直接内联输出对象字面量(会在插值两侧补空格以避免 `{{{`)
|
|
856
|
-
* @default 'runtime'
|
|
857
|
-
*/
|
|
858
|
-
objectLiteralBindMode?: 'runtime' | 'inline';
|
|
859
|
-
/**
|
|
860
|
-
* @description Mustache 插值输出风格
|
|
861
|
-
* - `compact`: 紧凑输出(`{{expr}}`,默认,当前行为)
|
|
862
|
-
* - `spaced`: 空格友好输出(`{{ expr }}`)
|
|
863
|
-
* @default 'compact'
|
|
864
|
-
*/
|
|
865
|
-
mustacheInterpolation?: 'compact' | 'spaced';
|
|
866
|
-
/**
|
|
867
|
-
* @description 是否复用 class/style WXS 运行时(主包与非独立分包共享,独立分包各自生成)
|
|
868
|
-
* @default true
|
|
869
|
-
*/
|
|
870
|
-
classStyleWxsShared?: boolean;
|
|
871
|
-
};
|
|
872
|
-
/**
|
|
873
|
-
* @description 是否自动导入 Vue 组件
|
|
874
|
-
*/
|
|
875
|
-
autoImport?: boolean;
|
|
876
|
-
};
|
|
877
|
-
/**
|
|
878
|
-
* @description wevu 运行时默认值(编译期注入)
|
|
879
|
-
*/
|
|
880
|
-
wevu?: {
|
|
881
|
-
/**
|
|
882
|
-
* @description wevu 预设配置
|
|
883
|
-
* - `performance`:开启性能向默认项(如 patch + suspendWhenHidden + diagnostics=fallback + dev 高频告警),并默认启用 autoSetDataPick(可显式覆盖)
|
|
884
|
-
*/
|
|
885
|
-
preset?: 'performance';
|
|
886
|
-
/**
|
|
887
|
-
* @description wevu createApp/defineComponent 默认值
|
|
888
|
-
*/
|
|
889
|
-
defaults?: WevuDefaults;
|
|
890
|
-
/**
|
|
891
|
-
* @description 自动从编译后的模板表达式推导渲染相关顶层 key,并注入到组件/页面的 `setData.pick`
|
|
892
|
-
* @default false
|
|
893
|
-
*/
|
|
894
|
-
autoSetDataPick?: boolean;
|
|
895
|
-
};
|
|
896
|
-
/**
|
|
897
|
-
* @description 全局注入 @wevu/api 的 wpi 实例
|
|
898
|
-
* - enabled 为 true 时会在 App 入口注入 wpi
|
|
899
|
-
* - replaceWx 为 true 时会用 wpi 替换全局 wx/my 以及当前平台全局对象
|
|
900
|
-
* @default { enabled: false, replaceWx: false, globalName: 'wpi' }
|
|
901
|
-
* @example
|
|
902
|
-
* injectWeapi: { enabled: true, replaceWx: false }
|
|
903
|
-
*/
|
|
904
|
-
injectWeapi?: boolean | {
|
|
905
|
-
/**
|
|
906
|
-
* @description 是否启用全局注入
|
|
907
|
-
* @default false
|
|
908
|
-
*/
|
|
909
|
-
enabled?: boolean;
|
|
910
|
-
/**
|
|
911
|
-
* @description 是否使用 wpi 替换全局 wx/my 以及当前平台全局对象
|
|
912
|
-
* @default false
|
|
913
|
-
*/
|
|
914
|
-
replaceWx?: boolean;
|
|
915
|
-
/**
|
|
916
|
-
* @description 全局变量名
|
|
917
|
-
* @default 'wpi'
|
|
918
|
-
*/
|
|
919
|
-
globalName?: string;
|
|
920
|
-
};
|
|
921
|
-
/**
|
|
922
|
-
* @description MCP 服务配置
|
|
923
|
-
* - `false`:完全关闭 MCP(包含自动启动)
|
|
924
|
-
* - `true`:启用默认 MCP 配置
|
|
925
|
-
* - `object`:细粒度配置
|
|
926
|
-
* @default { enabled: true, autoStart: false, host: '127.0.0.1', port: 3088, endpoint: '/mcp' }
|
|
927
|
-
* @example
|
|
928
|
-
* mcp: false
|
|
929
|
-
* @example
|
|
930
|
-
* mcp: { enabled: true, autoStart: false }
|
|
931
|
-
* @example
|
|
932
|
-
* mcp: { host: '127.0.0.1', port: 3199, endpoint: '/mcp' }
|
|
933
|
-
*/
|
|
510
|
+
debug?: WeappDebugConfig;
|
|
511
|
+
hmr?: WeappHmrConfig;
|
|
512
|
+
worker?: WeappWorkerConfig;
|
|
513
|
+
vue?: WeappVueConfig;
|
|
514
|
+
wevu?: WeappWevuConfig;
|
|
515
|
+
injectWeapi?: boolean | WeappInjectWeapiConfig;
|
|
934
516
|
mcp?: boolean | WeappMcpConfig;
|
|
935
|
-
/**
|
|
936
|
-
* @description 共享代码拆分策略配置
|
|
937
|
-
*/
|
|
938
517
|
chunks?: ChunksConfig;
|
|
939
|
-
/**
|
|
940
|
-
* @description JSON 产物合并配置
|
|
941
|
-
*/
|
|
942
518
|
json?: JsonConfig;
|
|
943
519
|
}
|
|
944
520
|
type UserConfig$1 = UserConfig$2 & {
|
|
945
521
|
weapp?: WeappViteConfig;
|
|
946
522
|
};
|
|
523
|
+
/**
|
|
524
|
+
* @description 小程序 project.config 结构
|
|
525
|
+
*/
|
|
947
526
|
interface ProjectConfig {
|
|
948
527
|
miniprogramRoot?: string;
|
|
949
528
|
srcMiniprogramRoot?: string;
|
|
@@ -956,13 +535,6 @@ interface ProjectConfig {
|
|
|
956
535
|
}[];
|
|
957
536
|
};
|
|
958
537
|
}
|
|
959
|
-
interface SubPackageMetaValue {
|
|
960
|
-
entries: string[];
|
|
961
|
-
subPackage: SubPackage;
|
|
962
|
-
autoImportComponents?: AutoImportComponentsOption;
|
|
963
|
-
styleEntries?: SubPackageStyleEntry[];
|
|
964
|
-
watchSharedStyles?: boolean;
|
|
965
|
-
}
|
|
966
538
|
|
|
967
539
|
interface WxmlDep {
|
|
968
540
|
tagName: string;
|
|
@@ -1267,6 +839,7 @@ interface RuntimeState {
|
|
|
1267
839
|
initialized: boolean;
|
|
1268
840
|
candidates: Map<string, AutoRoutesCandidateState>;
|
|
1269
841
|
needsFullRescan: boolean;
|
|
842
|
+
loadingAppConfig: boolean;
|
|
1270
843
|
};
|
|
1271
844
|
autoImport: {
|
|
1272
845
|
registry: Map<string, LocalAutoImportMatch>;
|
|
@@ -1475,4 +1048,4 @@ declare function defineConfig(config: UserConfigFnPromise): UserConfigFnPromise;
|
|
|
1475
1048
|
declare function defineConfig(config: UserConfigFn): UserConfigFn;
|
|
1476
1049
|
declare function defineConfig(config: UserConfigLoose): UserConfigLoose;
|
|
1477
1050
|
|
|
1478
|
-
export { type GenerateTemplateInlineSource as $, type Alias as A, type BaseEntry as B, type CompilerContext as C, type BuildNpmPackageMeta as D, type ChangeEvent as E, type ChunksConfig as F, type ComponentEntry as G, type ComponentsMap as H, type CopyGlobs as I, type CopyOptions as J, type EnhanceOptions as K, type LoadConfigOptions as L, type EnhanceWxmlOptions as M, type Entry as N, type EntryJsonFragment as O, type GenerateDirsOptions as P, type GenerateExtensionsOptions as Q, type GenerateFileType as R, type GenerateFilenamesOptions as S, type GenerateOptions as T, type UserConfig as U, type GenerateTemplate as V, WEAPP_VITE_HOST_NAME as W, type GenerateTemplateContext as X, type GenerateTemplateEntry as Y, type GenerateTemplateFactory as Z, type GenerateTemplateFileSource as _, type UserConfigExport as a, type GenerateTemplateScope as a0, type GenerateTemplatesConfig as a1, type HandleWxmlOptions as a2, type JsFormat as a3, type JsonConfig as a4, type JsonMergeContext as a5, type JsonMergeFunction as a6, type JsonMergeStage as a7, type JsonMergeStrategy as a8, type MpPlatform as a9, type
|
|
1051
|
+
export { type GenerateTemplateInlineSource as $, type Alias as A, type BaseEntry as B, type CompilerContext as C, type BuildNpmPackageMeta as D, type ChangeEvent as E, type ChunksConfig as F, type ComponentEntry as G, type ComponentsMap as H, type CopyGlobs as I, type CopyOptions as J, type EnhanceOptions as K, type LoadConfigOptions as L, type EnhanceWxmlOptions as M, type Entry as N, type EntryJsonFragment as O, type GenerateDirsOptions as P, type GenerateExtensionsOptions as Q, type GenerateFileType as R, type GenerateFilenamesOptions as S, type GenerateOptions as T, type UserConfig as U, type GenerateTemplate as V, WEAPP_VITE_HOST_NAME as W, type GenerateTemplateContext as X, type GenerateTemplateEntry as Y, type GenerateTemplateFactory as Z, type GenerateTemplateFileSource as _, type UserConfigExport as a, type GenerateTemplateScope as a0, type GenerateTemplatesConfig as a1, type HandleWxmlOptions as a2, type JsFormat as a3, type JsonConfig as a4, type JsonMergeContext as a5, type JsonMergeFunction as a6, type JsonMergeStage as a7, type JsonMergeStrategy as a8, type MpPlatform as a9, type WeappLibComponentJson as aA, type WeappLibConfig as aB, type WeappLibDtsOptions as aC, type WeappLibEntryContext as aD, type WeappLibFileName as aE, type WeappLibInternalDtsOptions as aF, type WeappLibVueTscOptions as aG, type WeappNpmConfig as aH, type WeappSubPackageConfig as aI, type WeappVitePluginApi as aJ, type WeappVueConfig as aK, type WeappVueTemplateConfig as aL, type WeappWebConfig as aM, type WeappWevuConfig as aN, type WeappWorkerConfig as aO, type WxmlDep as aP, type MultiPlatformConfig as aa, type NpmBuildOptions as ab, type NpmMainPackageConfig as ac, type NpmSubPackageConfig as ad, type PageEntry as ae, type ProjectConfig as af, type ResolvedAlias as ag, type ScanComponentItem as ah, type ScanWxmlOptions as ai, type SharedChunkDynamicImports as aj, type SharedChunkMode as ak, type SharedChunkOverride as al, type SharedChunkStrategy as am, type SubPackage as an, type SubPackageMetaValue as ao, type SubPackageStyleConfigEntry as ap, type SubPackageStyleConfigObject as aq, type SubPackageStyleEntry as ar, type SubPackageStyleScope as as, type UserConfig$1 as at, type WeappAutoRoutesConfig as au, type WeappAutoRoutesInclude as av, type WeappAutoRoutesIncludePattern as aw, type WeappDebugConfig as ax, type WeappHmrConfig as ay, type WeappInjectWeapiConfig as az, type UserConfigFn as b, type UserConfigFnNoEnv as c, type UserConfigFnNoEnvPlain as d, type UserConfigFnObject as e, type UserConfigFnObjectPlain as f, type UserConfigFnPromise as g, type WeappViteConfig as h, type WeappViteHostMeta as i, type WeappViteRuntime as j, applyWeappViteHostMeta as k, createWeappViteHostMeta as l, defineAppJson as m, defineComponentJson as n, defineConfig as o, definePageJson as p, defineSitemapJson as q, defineThemeJson as r, isWeappViteHost as s, resolveWeappViteHostMeta as t, type WeappMcpConfig as u, type AliasOptions as v, type AlipayNpmMode as w, type AppEntry as x, type AutoImportComponents as y, type AutoImportComponentsOption as z };
|