@weapp-core/schematics 6.2.9 → 6.3.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 CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- //#region \0rolldown/runtime.js
2
+ // \0rolldown/runtime.js
3
3
  var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -20,12 +20,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
20
20
  value: mod,
21
21
  enumerable: true
22
22
  }) : target, mod));
23
- //#endregion
24
23
  let node_process = require("node:process");
25
24
  node_process = __toESM(node_process, 1);
26
25
  let zod = require("zod");
27
26
  zod = __toESM(zod, 1);
28
- //#region src/constants.ts
27
+ // src/constants.ts
29
28
  const SCHEMA_BASE = (node_process.default.env.WEAPP_SCHEMA_BASE ?? "https://vite.weapp.dev").replace(/\/$/, "");
30
29
  function schemaUrl(filename) {
31
30
  return `${SCHEMA_BASE}/${filename}`;
@@ -63,24 +62,21 @@ const DEFAULT_JS_TEMPLATES = {
63
62
  page: "Page({})",
64
63
  component: "Component({})"
65
64
  };
66
- //#endregion
67
- //#region src/generators/js.ts
65
+ // src/generators/js.ts
68
66
  /**
69
67
  * @description 生成 JS 模板(app/page/component)
70
68
  */
71
69
  function generateJs$1(type) {
72
70
  return DEFAULT_JS_TEMPLATES[type ?? "component"];
73
71
  }
74
- //#endregion
75
- //#region src/utils/stringify.ts
72
+ // src/utils/stringify.ts
76
73
  /**
77
74
  * @description 以 2 空格缩进序列化 JSON
78
75
  */
79
76
  function toJsonString(value) {
80
77
  return JSON.stringify(value, void 0, 2);
81
78
  }
82
- //#endregion
83
- //#region src/generators/json.ts
79
+ // src/generators/json.ts
84
80
  const JSON_DEFAULTS = {
85
81
  app: toJsonString(DEFAULT_APP_JSON),
86
82
  page: toJsonString(DEFAULT_PAGE_JSON),
@@ -123,8 +119,7 @@ function generateJson$1(options = {}) {
123
119
  if (ext === "js" || ext === "ts") return MODULE_DEFAULTS[normalizedType];
124
120
  return JSON_DEFAULTS[normalizedType];
125
121
  }
126
- //#endregion
127
- //#region src/generators/wxml.ts
122
+ // src/generators/wxml.ts
128
123
  /**
129
124
  * @description 生成 WXML 模板
130
125
  */
@@ -133,16 +128,14 @@ function generateWxml$1(options = {}) {
133
128
  return `<view>hello weapp-vite!</view>
134
129
  ${filepath ? `<view>from ${filepath}</view>` : ""}`;
135
130
  }
136
- //#endregion
137
- //#region src/generators/wxss.ts
131
+ // src/generators/wxss.ts
138
132
  /**
139
133
  * @description 生成 WXSS 模板
140
134
  */
141
135
  function generateWxss$1() {
142
136
  return "";
143
137
  }
144
- //#endregion
145
- //#region scripts/config/app.json
138
+ // scripts/config/app.json
146
139
  var app_default = {
147
140
  source: "https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html",
148
141
  fields: {
@@ -323,8 +316,7 @@ var app_default = {
323
316
  }
324
317
  }
325
318
  };
326
- //#endregion
327
- //#region scripts/config/component.json
319
+ // scripts/config/component.json
328
320
  var component_default = {
329
321
  source: "https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/",
330
322
  fields: {
@@ -362,8 +354,7 @@ var component_default = {
362
354
  }
363
355
  }
364
356
  };
365
- //#endregion
366
- //#region scripts/config/page.json
357
+ // scripts/config/page.json
367
358
  var page_default = {
368
359
  source: "https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/page.html",
369
360
  fields: {
@@ -522,8 +513,7 @@ var page_default = {
522
513
  }
523
514
  }
524
515
  };
525
- //#endregion
526
- //#region scripts/config/plugin.json
516
+ // scripts/config/plugin.json
527
517
  var plugin_default = {
528
518
  source: "https://developers.weixin.qq.com/miniprogram/dev/framework/plugin/development.html",
529
519
  fields: {
@@ -551,8 +541,7 @@ var plugin_default = {
551
541
  }
552
542
  }
553
543
  };
554
- //#endregion
555
- //#region scripts/config/sitemap.json
544
+ // scripts/config/sitemap.json
556
545
  var sitemap_default = {
557
546
  source: "https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
558
547
  fields: { "rules": {
@@ -561,8 +550,7 @@ var sitemap_default = {
561
550
  "description": "sitemap 匹配规则列表。"
562
551
  } }
563
552
  };
564
- //#endregion
565
- //#region scripts/config/theme.json
553
+ // scripts/config/theme.json
566
554
  var theme_default = {
567
555
  source: "https://developers.weixin.qq.com/miniprogram/dev/framework/view/theme.html",
568
556
  fields: {
@@ -578,8 +566,7 @@ var theme_default = {
578
566
  }
579
567
  }
580
568
  };
581
- //#endregion
582
- //#region scripts/json.ts
569
+ // scripts/json.ts
583
570
  function metadataProperty(type) {
584
571
  const normalized = type.toLowerCase().replace(/\s+/g, "");
585
572
  if (normalized.includes("|")) return { anyOf: normalized.split("|").map(metadataProperty) };
@@ -788,8 +775,7 @@ const PluginJsonSchema = createJsonSchema(zod.looseObject({
788
775
  pages: zod.record(zod.string(), zod.string()),
789
776
  main: zod.string()
790
777
  }).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);
791
- //#endregion
792
- //#region src/json.ts
778
+ // src/json.ts
793
779
  /**
794
780
  * JSON Schema 定义
795
781
  * 从 Zod schemas 生成,用于编辑器自动补全和验证
@@ -828,8 +814,7 @@ const JSON_SCHEMA_DEFINITIONS = [
828
814
  schema: PluginJsonSchema
829
815
  }
830
816
  ];
831
- //#endregion
832
- //#region src/index.ts
817
+ // src/index.ts
833
818
  /**
834
819
  * @description 生成 JS 模板(app/page/component)
835
820
  */
@@ -857,7 +842,6 @@ function generateJson(type, ext = "json") {
857
842
  ext
858
843
  });
859
844
  }
860
- //#endregion
861
845
  exports.JSON_SCHEMA_DEFINITIONS = JSON_SCHEMA_DEFINITIONS;
862
846
  exports.generateJs = generateJs;
863
847
  exports.generateJson = generateJson;
package/dist/index.d.cts CHANGED
@@ -1,4 +1,3 @@
1
- //#region src/generator.d.ts
2
1
  /**
3
2
  * @description 生成模板的目标类型
4
3
  */
@@ -7,8 +6,6 @@ type GenerateType = 'app' | 'page' | 'component';
7
6
  * @description JSON 输出扩展名
8
7
  */
9
8
  type JsonExt = 'json' | 'js' | 'ts' | (string & {});
10
- //#endregion
11
- //#region src/type.auto.d.ts
12
9
  /**
13
10
  * This file was automatically generated by json-schema-to-typescript.
14
11
  * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
@@ -616,8 +613,6 @@ interface Plugin$1 {
616
613
  };
617
614
  [k: string]: unknown;
618
615
  }
619
- //#endregion
620
- //#region src/type.d.ts
621
616
  /**
622
617
  * @description app.json 类型定义
623
618
  */
@@ -642,8 +637,6 @@ type Theme = Theme$1;
642
637
  * @description plugin.json 类型定义
643
638
  */
644
639
  type Plugin = Plugin$1;
645
- //#endregion
646
- //#region src/json.d.ts
647
640
  export declare const JSON_SCHEMA_DEFINITIONS: readonly [{
648
641
  filename: "app.json";
649
642
  typeName: "App";
@@ -669,8 +662,6 @@ export declare const JSON_SCHEMA_DEFINITIONS: readonly [{
669
662
  typeName: "Plugin";
670
663
  schema: unknown;
671
664
  }];
672
- //#endregion
673
- //#region src/index.d.ts
674
665
  /**
675
666
  * @description 生成 JS 模板(app/page/component)
676
667
  */
@@ -687,5 +678,4 @@ export declare function generateWxml(filepath?: string): string;
687
678
  * @description 生成 JSON/JS/TS 模板
688
679
  */
689
680
  export declare function generateJson(type?: GenerateType, ext?: JsonExt): string;
690
- //#endregion
691
681
  export type { App, Component, GenerateType, Page, Plugin, Sitemap, Theme };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- //#region src/generator.d.ts
2
1
  /**
3
2
  * @description 生成模板的目标类型
4
3
  */
@@ -7,8 +6,6 @@ type GenerateType = 'app' | 'page' | 'component';
7
6
  * @description JSON 输出扩展名
8
7
  */
9
8
  type JsonExt = 'json' | 'js' | 'ts' | (string & {});
10
- //#endregion
11
- //#region src/type.auto.d.ts
12
9
  /**
13
10
  * This file was automatically generated by json-schema-to-typescript.
14
11
  * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
@@ -616,8 +613,6 @@ interface Plugin$1 {
616
613
  };
617
614
  [k: string]: unknown;
618
615
  }
619
- //#endregion
620
- //#region src/type.d.ts
621
616
  /**
622
617
  * @description app.json 类型定义
623
618
  */
@@ -642,8 +637,6 @@ type Theme = Theme$1;
642
637
  * @description plugin.json 类型定义
643
638
  */
644
639
  type Plugin = Plugin$1;
645
- //#endregion
646
- //#region src/json.d.ts
647
640
  export declare const JSON_SCHEMA_DEFINITIONS: readonly [{
648
641
  filename: "app.json";
649
642
  typeName: "App";
@@ -669,8 +662,6 @@ export declare const JSON_SCHEMA_DEFINITIONS: readonly [{
669
662
  typeName: "Plugin";
670
663
  schema: unknown;
671
664
  }];
672
- //#endregion
673
- //#region src/index.d.ts
674
665
  /**
675
666
  * @description 生成 JS 模板(app/page/component)
676
667
  */
@@ -687,5 +678,4 @@ export declare function generateWxml(filepath?: string): string;
687
678
  * @description 生成 JSON/JS/TS 模板
688
679
  */
689
680
  export declare function generateJson(type?: GenerateType, ext?: JsonExt): string;
690
- //#endregion
691
681
  export type { App, Component, GenerateType, Page, Plugin, Sitemap, Theme };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import process from "node:process";
2
2
  import * as z from "zod";
3
- //#region src/constants.ts
3
+ // src/constants.ts
4
4
  const SCHEMA_BASE = (process.env.WEAPP_SCHEMA_BASE ?? "https://vite.weapp.dev").replace(/\/$/, "");
5
5
  function schemaUrl(filename) {
6
6
  return `${SCHEMA_BASE}/${filename}`;
@@ -38,24 +38,21 @@ const DEFAULT_JS_TEMPLATES = {
38
38
  page: "Page({})",
39
39
  component: "Component({})"
40
40
  };
41
- //#endregion
42
- //#region src/generators/js.ts
41
+ // src/generators/js.ts
43
42
  /**
44
43
  * @description 生成 JS 模板(app/page/component)
45
44
  */
46
45
  function generateJs$1(type) {
47
46
  return DEFAULT_JS_TEMPLATES[type ?? "component"];
48
47
  }
49
- //#endregion
50
- //#region src/utils/stringify.ts
48
+ // src/utils/stringify.ts
51
49
  /**
52
50
  * @description 以 2 空格缩进序列化 JSON
53
51
  */
54
52
  function toJsonString(value) {
55
53
  return JSON.stringify(value, void 0, 2);
56
54
  }
57
- //#endregion
58
- //#region src/generators/json.ts
55
+ // src/generators/json.ts
59
56
  const JSON_DEFAULTS = {
60
57
  app: toJsonString(DEFAULT_APP_JSON),
61
58
  page: toJsonString(DEFAULT_PAGE_JSON),
@@ -98,8 +95,7 @@ function generateJson$1(options = {}) {
98
95
  if (ext === "js" || ext === "ts") return MODULE_DEFAULTS[normalizedType];
99
96
  return JSON_DEFAULTS[normalizedType];
100
97
  }
101
- //#endregion
102
- //#region src/generators/wxml.ts
98
+ // src/generators/wxml.ts
103
99
  /**
104
100
  * @description 生成 WXML 模板
105
101
  */
@@ -108,16 +104,14 @@ function generateWxml$1(options = {}) {
108
104
  return `<view>hello weapp-vite!</view>
109
105
  ${filepath ? `<view>from ${filepath}</view>` : ""}`;
110
106
  }
111
- //#endregion
112
- //#region src/generators/wxss.ts
107
+ // src/generators/wxss.ts
113
108
  /**
114
109
  * @description 生成 WXSS 模板
115
110
  */
116
111
  function generateWxss$1() {
117
112
  return "";
118
113
  }
119
- //#endregion
120
- //#region scripts/config/app.json
114
+ // scripts/config/app.json
121
115
  var app_default = {
122
116
  source: "https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html",
123
117
  fields: {
@@ -298,8 +292,7 @@ var app_default = {
298
292
  }
299
293
  }
300
294
  };
301
- //#endregion
302
- //#region scripts/config/component.json
295
+ // scripts/config/component.json
303
296
  var component_default = {
304
297
  source: "https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/",
305
298
  fields: {
@@ -337,8 +330,7 @@ var component_default = {
337
330
  }
338
331
  }
339
332
  };
340
- //#endregion
341
- //#region scripts/config/page.json
333
+ // scripts/config/page.json
342
334
  var page_default = {
343
335
  source: "https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/page.html",
344
336
  fields: {
@@ -497,8 +489,7 @@ var page_default = {
497
489
  }
498
490
  }
499
491
  };
500
- //#endregion
501
- //#region scripts/config/plugin.json
492
+ // scripts/config/plugin.json
502
493
  var plugin_default = {
503
494
  source: "https://developers.weixin.qq.com/miniprogram/dev/framework/plugin/development.html",
504
495
  fields: {
@@ -526,8 +517,7 @@ var plugin_default = {
526
517
  }
527
518
  }
528
519
  };
529
- //#endregion
530
- //#region scripts/config/sitemap.json
520
+ // scripts/config/sitemap.json
531
521
  var sitemap_default = {
532
522
  source: "https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
533
523
  fields: { "rules": {
@@ -536,8 +526,7 @@ var sitemap_default = {
536
526
  "description": "sitemap 匹配规则列表。"
537
527
  } }
538
528
  };
539
- //#endregion
540
- //#region scripts/config/theme.json
529
+ // scripts/config/theme.json
541
530
  var theme_default = {
542
531
  source: "https://developers.weixin.qq.com/miniprogram/dev/framework/view/theme.html",
543
532
  fields: {
@@ -553,8 +542,7 @@ var theme_default = {
553
542
  }
554
543
  }
555
544
  };
556
- //#endregion
557
- //#region scripts/json.ts
545
+ // scripts/json.ts
558
546
  function metadataProperty(type) {
559
547
  const normalized = type.toLowerCase().replace(/\s+/g, "");
560
548
  if (normalized.includes("|")) return { anyOf: normalized.split("|").map(metadataProperty) };
@@ -763,8 +751,7 @@ const PluginJsonSchema = createJsonSchema(z.looseObject({
763
751
  pages: z.record(z.string(), z.string()),
764
752
  main: z.string()
765
753
  }).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);
766
- //#endregion
767
- //#region src/json.ts
754
+ // src/json.ts
768
755
  /**
769
756
  * JSON Schema 定义
770
757
  * 从 Zod schemas 生成,用于编辑器自动补全和验证
@@ -803,8 +790,7 @@ const JSON_SCHEMA_DEFINITIONS = [
803
790
  schema: PluginJsonSchema
804
791
  }
805
792
  ];
806
- //#endregion
807
- //#region src/index.ts
793
+ // src/index.ts
808
794
  /**
809
795
  * @description 生成 JS 模板(app/page/component)
810
796
  */
@@ -832,5 +818,4 @@ function generateJson(type, ext = "json") {
832
818
  ext
833
819
  });
834
820
  }
835
- //#endregion
836
821
  export { JSON_SCHEMA_DEFINITIONS, generateJs, generateJson, generateWxml, generateWxss };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@weapp-core/schematics",
3
3
  "type": "module",
4
- "version": "6.2.9",
4
+ "version": "6.3.0",
5
5
  "description": "Project generation schematics for the weapp-vite mini-program toolchain.",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -43,14 +43,14 @@
43
43
  "schemas"
44
44
  ],
45
45
  "engines": {
46
- "node": "^20.19.0 || >=22.12.0"
46
+ "node": "^22.23.4 || ^24.22.1 || >=26.12.1"
47
47
  },
48
48
  "publishConfig": {
49
49
  "access": "public",
50
50
  "registry": "https://registry.npmjs.org"
51
51
  },
52
52
  "dependencies": {
53
- "zod": "^4.6.5"
53
+ "zod": "^4.6.7"
54
54
  },
55
55
  "devDependencies": {
56
56
  "cheerio": "^1.2.0"