@weapp-core/schematics 6.0.4 → 6.1.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/index.cjs +465 -13
- package/dist/index.d.cts +237 -16
- package/dist/index.d.ts +237 -16
- package/dist/index.js +462 -10
- package/package.json +7 -3
- package/schemas/app.json +63 -11
- package/schemas/component.json +8 -1
- package/schemas/page.json +58 -14
- package/schemas/plugin.json +5 -1
- package/schemas/sitemap.json +3 -1
- package/schemas/theme.json +4 -1
package/dist/index.cjs
CHANGED
|
@@ -16,15 +16,15 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
}
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
20
20
|
value: mod,
|
|
21
21
|
enumerable: true
|
|
22
22
|
}) : target, mod));
|
|
23
23
|
//#endregion
|
|
24
24
|
let node_process = require("node:process");
|
|
25
|
-
node_process = __toESM(node_process);
|
|
25
|
+
node_process = __toESM(node_process, 1);
|
|
26
26
|
let zod = require("zod");
|
|
27
|
-
zod = __toESM(zod);
|
|
27
|
+
zod = __toESM(zod, 1);
|
|
28
28
|
//#region src/constants.ts
|
|
29
29
|
const SCHEMA_BASE = (node_process.default.env.WEAPP_SCHEMA_BASE ?? "https://vite.icebreaker.top").replace(/\/$/, "");
|
|
30
30
|
function schemaUrl(filename) {
|
|
@@ -142,7 +142,455 @@ function generateWxss$1() {
|
|
|
142
142
|
return "";
|
|
143
143
|
}
|
|
144
144
|
//#endregion
|
|
145
|
+
//#region scripts/config/app.json
|
|
146
|
+
var app_default = {
|
|
147
|
+
source: "https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html",
|
|
148
|
+
fields: {
|
|
149
|
+
"entryPagePath": {
|
|
150
|
+
"type": "string",
|
|
151
|
+
"description": "小程序默认启动首页。"
|
|
152
|
+
},
|
|
153
|
+
"pages": {
|
|
154
|
+
"type": "string[]",
|
|
155
|
+
"required": true,
|
|
156
|
+
"description": "页面路径列表。"
|
|
157
|
+
},
|
|
158
|
+
"window": {
|
|
159
|
+
"type": "object",
|
|
160
|
+
"description": "全局的默认窗口表现。"
|
|
161
|
+
},
|
|
162
|
+
"tabBar": {
|
|
163
|
+
"type": "object",
|
|
164
|
+
"description": "底部 tab 栏的表现。"
|
|
165
|
+
},
|
|
166
|
+
"networkTimeout": {
|
|
167
|
+
"type": "object",
|
|
168
|
+
"description": "网络超时时间。"
|
|
169
|
+
},
|
|
170
|
+
"debug": {
|
|
171
|
+
"type": "boolean",
|
|
172
|
+
"description": "是否开启 debug 模式。"
|
|
173
|
+
},
|
|
174
|
+
"functionalPages": {
|
|
175
|
+
"type": "boolean",
|
|
176
|
+
"description": "是否启用插件功能页。",
|
|
177
|
+
"x-wechat-min-version": "2.1.0"
|
|
178
|
+
},
|
|
179
|
+
"subpackages": {
|
|
180
|
+
"type": "object[]",
|
|
181
|
+
"description": "分包结构配置。",
|
|
182
|
+
"x-wechat-min-version": "1.7.3"
|
|
183
|
+
},
|
|
184
|
+
"workers": {
|
|
185
|
+
"type": "string | object",
|
|
186
|
+
"description": "Worker 代码放置的目录。"
|
|
187
|
+
},
|
|
188
|
+
"requiredBackgroundModes": {
|
|
189
|
+
"type": "string[]",
|
|
190
|
+
"description": "需要在后台使用的能力。"
|
|
191
|
+
},
|
|
192
|
+
"requiredPrivateInfos": {
|
|
193
|
+
"type": "string[]",
|
|
194
|
+
"description": "调用的地理位置相关隐私接口。"
|
|
195
|
+
},
|
|
196
|
+
"plugins": {
|
|
197
|
+
"type": "object",
|
|
198
|
+
"description": "使用到的插件。"
|
|
199
|
+
},
|
|
200
|
+
"preloadRule": {
|
|
201
|
+
"type": "object",
|
|
202
|
+
"description": "分包预下载规则。"
|
|
203
|
+
},
|
|
204
|
+
"resizable": {
|
|
205
|
+
"type": "boolean",
|
|
206
|
+
"description": "PC 小程序是否支持用户任意改变窗口大小(包括最大化窗口);iPad 小程序是否支持屏幕旋转。默认关闭",
|
|
207
|
+
"x-wechat-min-version": "2.3.0"
|
|
208
|
+
},
|
|
209
|
+
"usingComponents": {
|
|
210
|
+
"type": "object",
|
|
211
|
+
"description": "全局自定义组件配置。"
|
|
212
|
+
},
|
|
213
|
+
"permission": {
|
|
214
|
+
"type": "object",
|
|
215
|
+
"description": "小程序接口权限相关设置。"
|
|
216
|
+
},
|
|
217
|
+
"sitemapLocation": {
|
|
218
|
+
"type": "string",
|
|
219
|
+
"description": "指明 sitemap.json 的位置。"
|
|
220
|
+
},
|
|
221
|
+
"style": {
|
|
222
|
+
"type": "string",
|
|
223
|
+
"description": "指定使用升级后的weui样式",
|
|
224
|
+
"x-wechat-min-version": "2.8.0"
|
|
225
|
+
},
|
|
226
|
+
"useExtendedLib": {
|
|
227
|
+
"type": "object",
|
|
228
|
+
"description": "指定需要引用的扩展库。"
|
|
229
|
+
},
|
|
230
|
+
"entranceDeclare": {
|
|
231
|
+
"type": "object",
|
|
232
|
+
"description": "微信消息用小程序打开。"
|
|
233
|
+
},
|
|
234
|
+
"darkmode": {
|
|
235
|
+
"type": "boolean",
|
|
236
|
+
"description": "小程序支持 DarkMode。"
|
|
237
|
+
},
|
|
238
|
+
"themeLocation": {
|
|
239
|
+
"type": "string",
|
|
240
|
+
"description": "指明 theme.json 的位置。"
|
|
241
|
+
},
|
|
242
|
+
"lazyCodeLoading": {
|
|
243
|
+
"type": "string",
|
|
244
|
+
"description": "配置自定义组件代码按需注入。"
|
|
245
|
+
},
|
|
246
|
+
"singlePage": {
|
|
247
|
+
"type": "object",
|
|
248
|
+
"description": "单页模式相关配置",
|
|
249
|
+
"x-wechat-min-version": "2.12.0"
|
|
250
|
+
},
|
|
251
|
+
"supportedMaterials": {
|
|
252
|
+
"type": "object",
|
|
253
|
+
"description": "聊天素材小程序打开相关配置。"
|
|
254
|
+
},
|
|
255
|
+
"serviceProviderTicket": {
|
|
256
|
+
"type": "string",
|
|
257
|
+
"description": "定制化型服务商票据"
|
|
258
|
+
},
|
|
259
|
+
"embeddedAppIdList": {
|
|
260
|
+
"type": "string[]",
|
|
261
|
+
"description": "半屏小程序 appId 列表。"
|
|
262
|
+
},
|
|
263
|
+
"halfPage": {
|
|
264
|
+
"type": "object",
|
|
265
|
+
"description": "视频号直播半屏场景设置。"
|
|
266
|
+
},
|
|
267
|
+
"debugOptions": {
|
|
268
|
+
"type": "object",
|
|
269
|
+
"description": "调试相关配置。"
|
|
270
|
+
},
|
|
271
|
+
"enablePassiveEvent": {
|
|
272
|
+
"type": "object | boolean",
|
|
273
|
+
"description": "touch 事件监听是否为 passive",
|
|
274
|
+
"x-wechat-min-version": "2.24.1"
|
|
275
|
+
},
|
|
276
|
+
"resolveAlias": {
|
|
277
|
+
"type": "object",
|
|
278
|
+
"description": "自定义模块映射规则。"
|
|
279
|
+
},
|
|
280
|
+
"renderer": {
|
|
281
|
+
"type": "string",
|
|
282
|
+
"description": "全局默认的渲染后端。",
|
|
283
|
+
"enum": ["webview", "skyline"]
|
|
284
|
+
},
|
|
285
|
+
"rendererOptions": {
|
|
286
|
+
"type": "object",
|
|
287
|
+
"description": "渲染后端选项。"
|
|
288
|
+
},
|
|
289
|
+
"componentFramework": {
|
|
290
|
+
"type": "string",
|
|
291
|
+
"description": "组件框架。"
|
|
292
|
+
},
|
|
293
|
+
"miniApp": {
|
|
294
|
+
"type": "object",
|
|
295
|
+
"description": "多端模式场景接入身份管理服务时开启小程序授权页相关配置,详见相关文档"
|
|
296
|
+
},
|
|
297
|
+
"static": {
|
|
298
|
+
"type": "object",
|
|
299
|
+
"description": "正常情况下默认所有资源文件都被打包发布到所有平台,可以通过 static 字段配置特定每个目录/文件只能发布到特定的平台(多端场景) 相关文档"
|
|
300
|
+
},
|
|
301
|
+
"convertRpxToVw": {
|
|
302
|
+
"type": "boolean",
|
|
303
|
+
"description": "是否将 rpx 单位转换为 vw 单位。"
|
|
304
|
+
},
|
|
305
|
+
"chatTools": {
|
|
306
|
+
"type": "object",
|
|
307
|
+
"description": "聊天工具分包配置",
|
|
308
|
+
"x-wechat-min-version": "3.7.8"
|
|
309
|
+
},
|
|
310
|
+
"subPackages": {
|
|
311
|
+
"type": "object[]",
|
|
312
|
+
"description": "分包结构配置(兼容别名)。"
|
|
313
|
+
},
|
|
314
|
+
"appBar": {
|
|
315
|
+
"type": "object",
|
|
316
|
+
"description": "AppBar 配置。"
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
//#endregion
|
|
321
|
+
//#region scripts/config/component.json
|
|
322
|
+
var component_default = {
|
|
323
|
+
source: "https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/",
|
|
324
|
+
fields: {
|
|
325
|
+
"component": {
|
|
326
|
+
"type": "boolean",
|
|
327
|
+
"default": true,
|
|
328
|
+
"description": "声明当前配置对应自定义组件。"
|
|
329
|
+
},
|
|
330
|
+
"styleIsolation": {
|
|
331
|
+
"type": "string",
|
|
332
|
+
"enum": [
|
|
333
|
+
"isolated",
|
|
334
|
+
"apply-shared",
|
|
335
|
+
"shared"
|
|
336
|
+
],
|
|
337
|
+
"default": "isolated",
|
|
338
|
+
"description": "组件样式隔离策略。"
|
|
339
|
+
},
|
|
340
|
+
"componentGenerics": {
|
|
341
|
+
"type": "object",
|
|
342
|
+
"description": "组件泛型配置。"
|
|
343
|
+
},
|
|
344
|
+
"componentPlaceholder": {
|
|
345
|
+
"type": "object",
|
|
346
|
+
"description": "组件占位配置。"
|
|
347
|
+
},
|
|
348
|
+
"componentFramework": {
|
|
349
|
+
"type": "string",
|
|
350
|
+
"description": "组件框架。"
|
|
351
|
+
},
|
|
352
|
+
"usingComponents": {
|
|
353
|
+
"type": "object",
|
|
354
|
+
"description": "组件依赖的自定义组件配置。"
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
};
|
|
358
|
+
//#endregion
|
|
359
|
+
//#region scripts/config/page.json
|
|
360
|
+
var page_default = {
|
|
361
|
+
source: "https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/page.html",
|
|
362
|
+
fields: {
|
|
363
|
+
"navigationBarBackgroundColor": {
|
|
364
|
+
"type": "HexColor",
|
|
365
|
+
"default": "#000000",
|
|
366
|
+
"description": "导航栏背景颜色,如 #000000"
|
|
367
|
+
},
|
|
368
|
+
"navigationBarTextStyle": {
|
|
369
|
+
"type": "string",
|
|
370
|
+
"default": "white",
|
|
371
|
+
"description": "导航栏标题、状态栏颜色,仅支持 black / white"
|
|
372
|
+
},
|
|
373
|
+
"navigationBarTitleText": {
|
|
374
|
+
"type": "string",
|
|
375
|
+
"description": "导航栏标题文字内容"
|
|
376
|
+
},
|
|
377
|
+
"navigationStyle": {
|
|
378
|
+
"type": "string",
|
|
379
|
+
"default": "default",
|
|
380
|
+
"description": "导航栏样式,仅支持以下值:default 默认样式 custom 自定义导航栏,只保留右上角胶囊按钮。",
|
|
381
|
+
"x-wechat-min-version": "7.0.0"
|
|
382
|
+
},
|
|
383
|
+
"homeButton": {
|
|
384
|
+
"type": "boolean",
|
|
385
|
+
"default": "false",
|
|
386
|
+
"description": "在非首页、非页面栈最底层页面或非tabbar内页面中的导航栏展示home键",
|
|
387
|
+
"x-wechat-min-version": "8.0.24"
|
|
388
|
+
},
|
|
389
|
+
"backgroundColor": {
|
|
390
|
+
"type": "HexColor",
|
|
391
|
+
"default": "#ffffff",
|
|
392
|
+
"description": "窗口的背景色"
|
|
393
|
+
},
|
|
394
|
+
"backgroundColorContent": {
|
|
395
|
+
"type": "HexColor",
|
|
396
|
+
"default": "#RRGGBBAA",
|
|
397
|
+
"description": "页面容器背景色。"
|
|
398
|
+
},
|
|
399
|
+
"backgroundTextStyle": {
|
|
400
|
+
"type": "string",
|
|
401
|
+
"default": "dark",
|
|
402
|
+
"description": "下拉 loading 的样式,仅支持 dark / light"
|
|
403
|
+
},
|
|
404
|
+
"backgroundColorTop": {
|
|
405
|
+
"type": "string",
|
|
406
|
+
"default": "#ffffff",
|
|
407
|
+
"description": "顶部窗口的背景色,仅 iOS 支持",
|
|
408
|
+
"x-wechat-min-version": "6.5.16"
|
|
409
|
+
},
|
|
410
|
+
"backgroundColorBottom": {
|
|
411
|
+
"type": "string",
|
|
412
|
+
"default": "#ffffff",
|
|
413
|
+
"description": "底部窗口的背景色,仅 iOS 支持",
|
|
414
|
+
"x-wechat-min-version": "6.5.16"
|
|
415
|
+
},
|
|
416
|
+
"enablePullDownRefresh": {
|
|
417
|
+
"type": "boolean",
|
|
418
|
+
"default": "false",
|
|
419
|
+
"description": "是否开启当前页面下拉刷新。详见 Page.onPullDownRefresh"
|
|
420
|
+
},
|
|
421
|
+
"onReachBottomDistance": {
|
|
422
|
+
"type": "number",
|
|
423
|
+
"default": "50",
|
|
424
|
+
"description": "页面上拉触底事件触发时距页面底部距离,单位为px。详见 Page.onReachBottom"
|
|
425
|
+
},
|
|
426
|
+
"pageOrientation": {
|
|
427
|
+
"type": "string",
|
|
428
|
+
"default": "portrait",
|
|
429
|
+
"description": "屏幕旋转设置,支持 auto / portrait / landscape 详见 响应显示区域变化",
|
|
430
|
+
"x-wechat-min-version": "2.4.0"
|
|
431
|
+
},
|
|
432
|
+
"disableScroll": {
|
|
433
|
+
"type": "boolean",
|
|
434
|
+
"default": false,
|
|
435
|
+
"description": "设置为 true 时页面整体不能上下滚动。"
|
|
436
|
+
},
|
|
437
|
+
"usingComponents": {
|
|
438
|
+
"type": "object",
|
|
439
|
+
"description": "页面自定义组件配置。"
|
|
440
|
+
},
|
|
441
|
+
"initialRenderingCache": {
|
|
442
|
+
"type": "string",
|
|
443
|
+
"enum": [
|
|
444
|
+
"static",
|
|
445
|
+
"dynamic",
|
|
446
|
+
"capture"
|
|
447
|
+
],
|
|
448
|
+
"description": "页面初始渲染缓存配置。"
|
|
449
|
+
},
|
|
450
|
+
"style": {
|
|
451
|
+
"type": "string",
|
|
452
|
+
"default": "default",
|
|
453
|
+
"description": "启用新版的组件样式",
|
|
454
|
+
"x-wechat-min-version": "2.10.2"
|
|
455
|
+
},
|
|
456
|
+
"singlePage": {
|
|
457
|
+
"type": "object",
|
|
458
|
+
"default": "否",
|
|
459
|
+
"description": "单页模式相关配置",
|
|
460
|
+
"x-wechat-min-version": "2.12.0"
|
|
461
|
+
},
|
|
462
|
+
"restartStrategy": {
|
|
463
|
+
"type": "string",
|
|
464
|
+
"default": "homePage",
|
|
465
|
+
"description": "重新启动策略配置",
|
|
466
|
+
"x-wechat-min-version": "2.8.0"
|
|
467
|
+
},
|
|
468
|
+
"handleWebviewPreload": {
|
|
469
|
+
"type": "string",
|
|
470
|
+
"default": "static",
|
|
471
|
+
"description": "控制预加载下个页面的时机。支持 static / manual / auto",
|
|
472
|
+
"x-wechat-min-version": "2.15.0"
|
|
473
|
+
},
|
|
474
|
+
"visualEffectInBackground": {
|
|
475
|
+
"type": "string",
|
|
476
|
+
"default": "否",
|
|
477
|
+
"description": "切入系统后台时,隐藏页面内容,保护用户隐私。支持 hidden / none,若对页面单独设置则会覆盖全局的配置,详见 全局配置",
|
|
478
|
+
"x-wechat-min-version": "2.15.0"
|
|
479
|
+
},
|
|
480
|
+
"enablePassiveEvent": {
|
|
481
|
+
"type": "object | boolean",
|
|
482
|
+
"default": "否",
|
|
483
|
+
"description": "事件监听是否为 passive,若对页面单独设置则会覆盖全局的配置,详见 全局配置",
|
|
484
|
+
"x-wechat-min-version": "2.24.1"
|
|
485
|
+
},
|
|
486
|
+
"renderer": {
|
|
487
|
+
"type": "string",
|
|
488
|
+
"enum": ["webview", "skyline"],
|
|
489
|
+
"description": "页面渲染后端。"
|
|
490
|
+
},
|
|
491
|
+
"rendererOptions": {
|
|
492
|
+
"type": "object",
|
|
493
|
+
"default": "否",
|
|
494
|
+
"description": "渲染后端选项,详情相关文档",
|
|
495
|
+
"x-wechat-min-version": "3.1.0"
|
|
496
|
+
},
|
|
497
|
+
"componentFramework": {
|
|
498
|
+
"type": "string",
|
|
499
|
+
"description": "组件框架。"
|
|
500
|
+
},
|
|
501
|
+
"styleIsolation": {
|
|
502
|
+
"type": "string",
|
|
503
|
+
"enum": [
|
|
504
|
+
"page-isolated",
|
|
505
|
+
"page-apply-shared",
|
|
506
|
+
"page-shared"
|
|
507
|
+
],
|
|
508
|
+
"description": "页面样式隔离策略。"
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
};
|
|
512
|
+
//#endregion
|
|
513
|
+
//#region scripts/config/plugin.json
|
|
514
|
+
var plugin_default = {
|
|
515
|
+
source: "https://developers.weixin.qq.com/miniprogram/dev/framework/plugin/development.html",
|
|
516
|
+
fields: {
|
|
517
|
+
"publicComponents": {
|
|
518
|
+
"type": "object",
|
|
519
|
+
"description": "插件对外提供的自定义组件。"
|
|
520
|
+
},
|
|
521
|
+
"pages": {
|
|
522
|
+
"type": "object",
|
|
523
|
+
"description": "插件页面映射。"
|
|
524
|
+
},
|
|
525
|
+
"main": {
|
|
526
|
+
"type": "string",
|
|
527
|
+
"description": "插件主入口文件。"
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
};
|
|
531
|
+
//#endregion
|
|
532
|
+
//#region scripts/config/sitemap.json
|
|
533
|
+
var sitemap_default = {
|
|
534
|
+
source: "https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
|
|
535
|
+
fields: { "rules": {
|
|
536
|
+
"type": "object[]",
|
|
537
|
+
"required": true,
|
|
538
|
+
"description": "sitemap 匹配规则列表。"
|
|
539
|
+
} }
|
|
540
|
+
};
|
|
541
|
+
//#endregion
|
|
542
|
+
//#region scripts/config/theme.json
|
|
543
|
+
var theme_default = {
|
|
544
|
+
source: "https://developers.weixin.qq.com/miniprogram/dev/framework/view/theme.html",
|
|
545
|
+
fields: {
|
|
546
|
+
"light": {
|
|
547
|
+
"type": "object",
|
|
548
|
+
"required": true,
|
|
549
|
+
"description": "浅色主题配置。"
|
|
550
|
+
},
|
|
551
|
+
"dark": {
|
|
552
|
+
"type": "object",
|
|
553
|
+
"required": true,
|
|
554
|
+
"description": "深色主题配置。"
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
};
|
|
558
|
+
//#endregion
|
|
145
559
|
//#region scripts/json.ts
|
|
560
|
+
function metadataProperty(type) {
|
|
561
|
+
const normalized = type.toLowerCase().replace(/\s+/g, "");
|
|
562
|
+
if (normalized.includes("|")) return { anyOf: normalized.split("|").map(metadataProperty) };
|
|
563
|
+
if (normalized.endsWith("[]")) return {
|
|
564
|
+
type: "array",
|
|
565
|
+
items: metadataProperty(normalized.slice(0, -2))
|
|
566
|
+
};
|
|
567
|
+
if (normalized === "boolean") return { type: "boolean" };
|
|
568
|
+
if (normalized === "number") return { type: "number" };
|
|
569
|
+
if (normalized === "hexcolor" || normalized === "string") return { type: "string" };
|
|
570
|
+
return {
|
|
571
|
+
type: "object",
|
|
572
|
+
additionalProperties: true
|
|
573
|
+
};
|
|
574
|
+
}
|
|
575
|
+
function enrichJsonSchema(schema, metadata) {
|
|
576
|
+
const properties = schema.properties ?? {};
|
|
577
|
+
for (const [name, field] of Object.entries(metadata.fields)) {
|
|
578
|
+
if (name.includes(".")) continue;
|
|
579
|
+
const property = properties[name] ?? metadataProperty(field.type);
|
|
580
|
+
if (field.description) property.description = field.description;
|
|
581
|
+
if (field.default !== void 0 && property.default === void 0) property.default = field.default;
|
|
582
|
+
if (field.enum?.length) property.enum = field.enum;
|
|
583
|
+
if (field["x-wechat-min-version"]) property["x-wechat-min-version"] = field["x-wechat-min-version"];
|
|
584
|
+
properties[name] = property;
|
|
585
|
+
if (field.required && !schema.required?.includes(name)) schema.required = [...schema.required ?? [], name];
|
|
586
|
+
}
|
|
587
|
+
schema.properties = properties;
|
|
588
|
+
schema["x-wechat-doc"] = metadata.source;
|
|
589
|
+
return schema;
|
|
590
|
+
}
|
|
591
|
+
function createJsonSchema(schema, metadata) {
|
|
592
|
+
return enrichJsonSchema(zod.toJSONSchema(schema), metadata);
|
|
593
|
+
}
|
|
146
594
|
const metaSchema = zod.object({ $schema: zod.string() }).partial();
|
|
147
595
|
const sharedSchema = zod.object({
|
|
148
596
|
usingComponents: zod.record(zod.string(), zod.string()),
|
|
@@ -178,7 +626,11 @@ const windowSchema = zod.looseObject({
|
|
|
178
626
|
"landscape"
|
|
179
627
|
]).default("portrait"),
|
|
180
628
|
restartStrategy: zod.enum(["homePage", "homePageAndLatestPage"]).default("homePage"),
|
|
181
|
-
initialRenderingCache: zod.enum([
|
|
629
|
+
initialRenderingCache: zod.enum([
|
|
630
|
+
"static",
|
|
631
|
+
"dynamic",
|
|
632
|
+
"capture"
|
|
633
|
+
]),
|
|
182
634
|
visualEffectInBackground: zod.enum(["none", "hidden"]).default("none"),
|
|
183
635
|
handleWebviewPreload: zod.enum([
|
|
184
636
|
"static",
|
|
@@ -257,7 +709,8 @@ const AppSchema = zod.looseObject({
|
|
|
257
709
|
miniApp: zod.looseObject({}),
|
|
258
710
|
static: zod.looseObject({}),
|
|
259
711
|
convertRpxToVw: zod.boolean(),
|
|
260
|
-
appBar: zod.looseObject({})
|
|
712
|
+
appBar: zod.looseObject({}),
|
|
713
|
+
chatTools: zod.looseObject({})
|
|
261
714
|
}).partial().required({ pages: true }).extend(appAndPageSharedSchema.shape).describe("全局配置, 小程序根目录下的 app.json 文件用来对微信小程序进行全局配置。");
|
|
262
715
|
const PageSchema = zod.looseObject({
|
|
263
716
|
backgroundColorContent: zod.string().default("#RRGGBBAA"),
|
|
@@ -277,9 +730,9 @@ const ComponentSchema = zod.looseObject({
|
|
|
277
730
|
]).default("isolated"),
|
|
278
731
|
componentGenerics: zod.looseObject({})
|
|
279
732
|
}).partial().extend(pageAndComponentSharedSchema.shape).describe("自定义组件配置");
|
|
280
|
-
const AppJsonSchema =
|
|
281
|
-
const PageJsonSchema =
|
|
282
|
-
const ComponentJsonSchema =
|
|
733
|
+
const AppJsonSchema = createJsonSchema(AppSchema, app_default);
|
|
734
|
+
const PageJsonSchema = createJsonSchema(PageSchema, page_default);
|
|
735
|
+
const ComponentJsonSchema = createJsonSchema(ComponentSchema, component_default);
|
|
283
736
|
const ThemeSchema = zod.looseObject({
|
|
284
737
|
light: zod.looseObject({}),
|
|
285
738
|
dark: zod.looseObject({})
|
|
@@ -301,14 +754,13 @@ const SitemapSchema = zod.looseObject({ rules: zod.object({
|
|
|
301
754
|
matching: true,
|
|
302
755
|
priority: true
|
|
303
756
|
}).array() }).extend(metaSchema.shape).describe("https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/sitemap.html");
|
|
304
|
-
const ThemeJsonSchema =
|
|
305
|
-
const SitemapJsonSchema =
|
|
306
|
-
const
|
|
757
|
+
const ThemeJsonSchema = createJsonSchema(ThemeSchema, theme_default);
|
|
758
|
+
const SitemapJsonSchema = createJsonSchema(SitemapSchema, sitemap_default);
|
|
759
|
+
const PluginJsonSchema = createJsonSchema(zod.looseObject({
|
|
307
760
|
publicComponents: zod.record(zod.string(), zod.string()),
|
|
308
761
|
pages: zod.record(zod.string(), zod.string()),
|
|
309
762
|
main: zod.string()
|
|
310
|
-
}).partial().describe("https://developers.weixin.qq.com/miniprogram/dev/framework/plugin/development.html#%E6%8F%92%E4%BB%B6%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6");
|
|
311
|
-
const PluginJsonSchema = zod.toJSONSchema(PluginSchema);
|
|
763
|
+
}).partial().describe("https://developers.weixin.qq.com/miniprogram/dev/framework/plugin/development.html#%E6%8F%92%E4%BB%B6%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6"), plugin_default);
|
|
312
764
|
//#endregion
|
|
313
765
|
//#region src/json.ts
|
|
314
766
|
/**
|