@weapp-vite/volar 2.0.5 → 2.0.6

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.d.ts CHANGED
@@ -1,8 +1,6 @@
1
- import { VueLanguagePlugin } from '@vue/language-core';
2
-
1
+ import type { VueLanguagePlugin } from '@vue/language-core';
3
2
  /**
4
3
  * Volar 语言插件:为 weapp 配置块提供类型与 schema 提示。
5
4
  */
6
5
  declare const plugin: VueLanguagePlugin;
7
-
8
- export = plugin;
6
+ export default plugin;
package/dist/index.mjs CHANGED
@@ -1,355 +1,299 @@
1
- // src/index.ts
2
- import { createRequire } from "module";
3
- import path from "path";
4
- import process from "process";
5
-
6
- // package.json
7
- var name = "@weapp-vite/volar";
8
-
9
- // src/schema.ts
1
+ import { createRequire } from "node:module";
2
+ import path from "node:path";
3
+ import process from "node:process";
10
4
  import { JSON_SCHEMA_DEFINITIONS } from "@weapp-core/schematics";
5
+ //#region package.json
6
+ var name = "@weapp-vite/volar";
7
+ //#endregion
8
+ //#region src/schema.ts
9
+ /**
10
+ * 为小程序配置生成 JSON Schema
11
+ * 为支持 JSON Schema 的编辑器提供验证和自动补全
12
+ *
13
+ * 注意:JSON Schema 定义由 @weapp-core/schematics 统一维护
14
+ * 使用 Zod 定义并自动生成,确保单一数据源
15
+ */
16
+ /**
17
+ * 根据文件类型获取对应的 JSON Schema
18
+ * Schema 定义来自 @weapp-core/schematics,使用 Zod 维护单一数据源
19
+ */
11
20
  function getSchemaForType(type) {
12
- const definition = JSON_SCHEMA_DEFINITIONS.find((d) => d.typeName === type);
13
- if (!definition) {
14
- return null;
15
- }
16
- return definition.schema;
21
+ const definition = JSON_SCHEMA_DEFINITIONS.find((d) => d.typeName === type);
22
+ if (!definition) return null;
23
+ return definition.schema;
17
24
  }
18
-
19
- // src/index.ts
20
- var BLOCK_TYPE = "json";
21
- var JS_LANG = "js";
22
- var JSONC_LANG = "jsonc";
23
- var JSON_LANG = "json";
24
- var JSON5_LANG = "json5";
25
- var PLUGIN_VERSION = 2.2;
26
- var TS_LANG = "ts";
27
- var BACKSLASH_RE = /\\/g;
28
- var NON_SPACE_RE = /\S/;
29
- var WXS_MODULE_RE = /<wxs[\s\S]*?module\s*=\s*(?:"([^"]+)"|'([^']+)')[\s\S]*?\/?>/gi;
30
- var FULL_CAPABILITIES = {
31
- verification: true,
32
- completion: true,
33
- semantic: true,
34
- navigation: true,
35
- structure: true,
36
- format: true
25
+ //#endregion
26
+ //#region src/index.ts
27
+ const BLOCK_TYPE = "json";
28
+ const JS_LANG = "js";
29
+ const JSONC_LANG = "jsonc";
30
+ const JSON_LANG = "json";
31
+ const JSON5_LANG = "json5";
32
+ const PLUGIN_VERSION = 2.2;
33
+ const TS_LANG = "ts";
34
+ const BACKSLASH_RE = /\\/g;
35
+ const NON_SPACE_RE = /\S/;
36
+ const WXS_MODULE_RE = /<wxs[\s\S]*?module\s*=\s*(?:"([^"]+)"|'([^']+)')[\s\S]*?\/?>/gi;
37
+ const FULL_CAPABILITIES = {
38
+ verification: true,
39
+ completion: true,
40
+ semantic: true,
41
+ navigation: true,
42
+ structure: true,
43
+ format: true
37
44
  };
38
- var VOID_CAPABILITIES = {
39
- verification: false,
40
- completion: false,
41
- semantic: false,
42
- navigation: false,
43
- structure: false,
44
- format: false
45
+ const VOID_CAPABILITIES = {
46
+ verification: false,
47
+ completion: false,
48
+ semantic: false,
49
+ navigation: false,
50
+ structure: false,
51
+ format: false
45
52
  };
46
- var require2 = createRequire(
47
- typeof module !== "undefined" && module.filename ? module.filename : path.join(process.cwd(), "weapp-vite-volar.cjs")
48
- );
49
- var hasSchematicsTypes = false;
53
+ const require = createRequire(typeof module !== "undefined" && module.filename ? module.filename : path.join(process.cwd(), "weapp-vite-volar.cjs"));
54
+ let hasSchematicsTypes = false;
50
55
  try {
51
- require2.resolve("@weapp-core/schematics");
52
- hasSchematicsTypes = true;
56
+ require.resolve("@weapp-core/schematics");
57
+ hasSchematicsTypes = true;
53
58
  } catch {
54
- hasSchematicsTypes = false;
59
+ hasSchematicsTypes = false;
55
60
  }
56
61
  function parseVueSfc(content, filename = "component.vue") {
57
- try {
58
- const compilerSfc = require2("@vue/compiler-sfc");
59
- return compilerSfc.parse(content, { filename });
60
- } catch {
61
- return void 0;
62
- }
62
+ try {
63
+ return require("@vue/compiler-sfc").parse(content, { filename });
64
+ } catch {
65
+ return;
66
+ }
63
67
  }
64
68
  function collectWxsModuleNames(templateContent) {
65
- if (!templateContent) {
66
- return [];
67
- }
68
- const names = /* @__PURE__ */ new Set();
69
- for (const match of templateContent.matchAll(WXS_MODULE_RE)) {
70
- const name2 = match[1] ?? match[2];
71
- if (name2) {
72
- names.add(name2);
73
- }
74
- }
75
- return [...names];
69
+ if (!templateContent) return [];
70
+ const names = /* @__PURE__ */ new Set();
71
+ for (const match of templateContent.matchAll(WXS_MODULE_RE)) {
72
+ const name = match[1] ?? match[2];
73
+ if (name) names.add(name);
74
+ }
75
+ return [...names];
76
76
  }
77
77
  function createWxsModuleDeclarations(moduleNames) {
78
- if (!moduleNames.length) {
79
- return "";
80
- }
81
- return moduleNames.map((name2) => `const ${name2} = {} as Record<string, (...args: any[]) => any>`).join("\n");
78
+ if (!moduleNames.length) return "";
79
+ return moduleNames.map((name) => `const ${name} = {} as Record<string, (...args: any[]) => any>`).join("\n");
82
80
  }
83
81
  function appendWxsDeclarations(code, moduleNames) {
84
- const declarations = createWxsModuleDeclarations(moduleNames);
85
- if (!declarations) {
86
- return code;
87
- }
88
- return code ? `${code}
89
-
90
- ${declarations}
91
- ` : `${declarations}
92
- `;
82
+ const declarations = createWxsModuleDeclarations(moduleNames);
83
+ if (!declarations) return code;
84
+ return code ? `${code}\n\n${declarations}\n` : `${declarations}\n`;
93
85
  }
94
86
  function createSyntheticScriptSetup(moduleNames) {
95
- const content = createWxsModuleDeclarations(moduleNames);
96
- if (!content) {
97
- return void 0;
98
- }
99
- return {
100
- type: "script",
101
- content,
102
- loc: {
103
- source: `<script setup lang="ts">
104
- ${content}
105
- </script>`,
106
- start: { column: 1, line: 1, offset: 0 },
107
- end: { column: 1, line: 1, offset: 0 }
108
- },
109
- attrs: {
110
- setup: true,
111
- lang: "ts"
112
- },
113
- lang: "ts",
114
- setup: true,
115
- name: "scriptSetup"
116
- };
87
+ const content = createWxsModuleDeclarations(moduleNames);
88
+ if (!content) return;
89
+ return {
90
+ type: "script",
91
+ content,
92
+ loc: {
93
+ source: `<script setup lang="ts">\n${content}\n<\/script>`,
94
+ start: {
95
+ column: 1,
96
+ line: 1,
97
+ offset: 0
98
+ },
99
+ end: {
100
+ column: 1,
101
+ line: 1,
102
+ offset: 0
103
+ }
104
+ },
105
+ attrs: {
106
+ setup: true,
107
+ lang: "ts"
108
+ },
109
+ lang: "ts",
110
+ setup: true,
111
+ name: "scriptSetup"
112
+ };
117
113
  }
118
114
  function normalizeFilename(filename) {
119
- if (!filename) {
120
- return "";
121
- }
122
- return filename.replace(BACKSLASH_RE, "/");
115
+ if (!filename) return "";
116
+ return filename.replace(BACKSLASH_RE, "/");
123
117
  }
124
118
  function inferConfigType(filename) {
125
- const normalized = normalizeFilename(filename);
126
- if (normalized.endsWith("/app.vue")) {
127
- return "App";
128
- }
129
- if (normalized.includes("/plugin/")) {
130
- return "Plugin";
131
- }
132
- if (normalized.includes("/components/")) {
133
- return "Component";
134
- }
135
- if (normalized.includes("/theme/")) {
136
- return "Theme";
137
- }
138
- if (normalized.includes("/sitemap")) {
139
- return "Sitemap";
140
- }
141
- return "Page";
119
+ const normalized = normalizeFilename(filename);
120
+ if (normalized.endsWith("/app.vue")) return "App";
121
+ if (normalized.includes("/plugin/")) return "Plugin";
122
+ if (normalized.includes("/components/")) return "Component";
123
+ if (normalized.includes("/theme/")) return "Theme";
124
+ if (normalized.includes("/sitemap")) return "Sitemap";
125
+ return "Page";
142
126
  }
143
127
  function normalizeLang(lang) {
144
- if (!lang) {
145
- return JSON_LANG;
146
- }
147
- const lower = lang.toLowerCase();
148
- if (lower === "txt") {
149
- return JSON_LANG;
150
- }
151
- return lower;
128
+ if (!lang) return JSON_LANG;
129
+ const lower = lang.toLowerCase();
130
+ if (lower === "txt") return JSON_LANG;
131
+ return lower;
152
132
  }
153
133
  function findExportDefaultExpression(code, tsModule, lang) {
154
- const scriptKind = lang === TS_LANG ? tsModule.ScriptKind.TS : tsModule.ScriptKind.JS;
155
- const sourceFile = tsModule.createSourceFile(
156
- `config.${lang}`,
157
- code,
158
- tsModule.ScriptTarget.Latest,
159
- true,
160
- scriptKind
161
- );
162
- for (const statement of sourceFile.statements) {
163
- if (tsModule.isExportAssignment(statement)) {
164
- const expressionStart = statement.expression.getStart(sourceFile);
165
- const expressionEnd = statement.expression.getEnd();
166
- const leading = code.slice(0, statement.getStart(sourceFile));
167
- const expression = code.slice(expressionStart, expressionEnd);
168
- const trailing = code.slice(statement.getEnd());
169
- return {
170
- expression,
171
- expressionStart,
172
- expressionEnd,
173
- leading,
174
- trailing
175
- };
176
- }
177
- }
178
- return null;
134
+ const scriptKind = lang === TS_LANG ? tsModule.ScriptKind.TS : tsModule.ScriptKind.JS;
135
+ const sourceFile = tsModule.createSourceFile(`config.${lang}`, code, tsModule.ScriptTarget.Latest, true, scriptKind);
136
+ for (const statement of sourceFile.statements) if (tsModule.isExportAssignment(statement)) {
137
+ const expressionStart = statement.expression.getStart(sourceFile);
138
+ const expressionEnd = statement.expression.getEnd();
139
+ const leading = code.slice(0, statement.getStart(sourceFile));
140
+ return {
141
+ expression: code.slice(expressionStart, expressionEnd),
142
+ expressionStart,
143
+ expressionEnd,
144
+ leading,
145
+ trailing: code.slice(statement.getEnd())
146
+ };
147
+ }
148
+ return null;
179
149
  }
180
150
  function injectSchemaIntoJsonObject(content, schemaId) {
181
- const trimmed = content.trim();
182
- if (!trimmed.startsWith("{")) {
183
- return content;
184
- }
185
- const leftBraceIndex = content.indexOf("{");
186
- if (leftBraceIndex < 0) {
187
- return content;
188
- }
189
- const afterLeft = content.slice(leftBraceIndex + 1);
190
- const firstNonSpace = afterLeft.match(NON_SPACE_RE);
191
- const nextCharIndex = firstNonSpace ? leftBraceIndex + 1 + firstNonSpace.index : -1;
192
- const isEmptyObject = nextCharIndex >= 0 && content[nextCharIndex] === "}";
193
- const schemaLine = ` "$schema": "${schemaId}"`;
194
- const injected = isEmptyObject ? `{
195
- ${schemaLine}
196
- }` : `{
197
- ${schemaLine},${content.slice(leftBraceIndex + 1)}`;
198
- if (trimmed === content) {
199
- return injected;
200
- }
201
- const leading = content.slice(0, content.indexOf(trimmed));
202
- const trailing = content.slice(content.indexOf(trimmed) + trimmed.length);
203
- return `${leading}${injected}${trailing}`;
151
+ const trimmed = content.trim();
152
+ if (!trimmed.startsWith("{")) return content;
153
+ const leftBraceIndex = content.indexOf("{");
154
+ if (leftBraceIndex < 0) return content;
155
+ const firstNonSpace = content.slice(leftBraceIndex + 1).match(NON_SPACE_RE);
156
+ const nextCharIndex = firstNonSpace ? leftBraceIndex + 1 + firstNonSpace.index : -1;
157
+ const isEmptyObject = nextCharIndex >= 0 && content[nextCharIndex] === "}";
158
+ const schemaLine = ` "$schema": "${schemaId}"`;
159
+ const injected = isEmptyObject ? `{\n${schemaLine}\n}` : `{\n${schemaLine},${content.slice(leftBraceIndex + 1)}`;
160
+ if (trimmed === content) return injected;
161
+ return `${content.slice(0, content.indexOf(trimmed))}${injected}${content.slice(content.indexOf(trimmed) + trimmed.length)}`;
204
162
  }
205
- var plugin = (ctx) => {
206
- let tsModule = ctx?.modules?.typescript;
207
- if (!tsModule) {
208
- try {
209
- tsModule = require2("typescript");
210
- } catch {
211
- tsModule = void 0;
212
- }
213
- }
214
- return {
215
- name,
216
- version: PLUGIN_VERSION,
217
- order: -1,
218
- parseSFC2(fileName, languageId, content) {
219
- if (languageId !== "vue") {
220
- return;
221
- }
222
- const parsed = parseVueSfc(content, fileName);
223
- if (!parsed) {
224
- return;
225
- }
226
- const descriptor = parsed.descriptor;
227
- const wxsModuleNames = collectWxsModuleNames(descriptor.template?.content);
228
- if (!wxsModuleNames.length) {
229
- return parsed;
230
- }
231
- if (descriptor.scriptSetup) {
232
- descriptor.scriptSetup.content = appendWxsDeclarations(descriptor.scriptSetup.content, wxsModuleNames);
233
- } else {
234
- descriptor.scriptSetup = createSyntheticScriptSetup(wxsModuleNames);
235
- }
236
- return parsed;
237
- },
238
- getEmbeddedCodes(_, sfc) {
239
- const names = [];
240
- for (let i = 0; i < sfc.customBlocks.length; i++) {
241
- const block = sfc.customBlocks[i];
242
- if (block.type === BLOCK_TYPE) {
243
- const normalizedLang = normalizeLang(block.lang);
244
- const isJsLike = normalizedLang === JS_LANG || normalizedLang === TS_LANG;
245
- if (isJsLike) {
246
- names.push({ id: `${BLOCK_TYPE}_${i}`, lang: TS_LANG });
247
- continue;
248
- }
249
- const embeddedLang = normalizedLang === JSON_LANG || normalizedLang === JSONC_LANG || normalizedLang === JSON5_LANG ? JSONC_LANG : JSON_LANG;
250
- names.push({ id: `${BLOCK_TYPE}_${i}`, lang: embeddedLang });
251
- }
252
- }
253
- return names;
254
- },
255
- resolveEmbeddedCode(fileName, sfc, embeddedCode) {
256
- const match = embeddedCode.id.match(new RegExp(`^${BLOCK_TYPE}_(\\d+)$`));
257
- if (!match) {
258
- return;
259
- }
260
- const index = Number.parseInt(match[1]);
261
- const block = sfc.customBlocks[index];
262
- if (!block) {
263
- return;
264
- }
265
- const normalizedLang = normalizeLang(block.lang);
266
- const configType = inferConfigType(fileName);
267
- if (!hasSchematicsTypes) {
268
- embeddedCode.content.push([
269
- block.content,
270
- block.name,
271
- 0,
272
- FULL_CAPABILITIES
273
- ]);
274
- return;
275
- }
276
- const userWantsJs = normalizedLang === JS_LANG || normalizedLang === TS_LANG;
277
- if (userWantsJs) {
278
- const parsed = tsModule && findExportDefaultExpression(block.content, tsModule, normalizedLang);
279
- if (parsed && hasSchematicsTypes) {
280
- const typeImport = `import type { ${configType} as __WeappConfig } from '@weapp-core/schematics'
281
- `;
282
- const helper = "const __weapp_defineConfig = <T extends __WeappConfig>(config: T) => config\n\n";
283
- embeddedCode.content.push([
284
- `${typeImport}${helper}`,
285
- void 0,
286
- 0,
287
- VOID_CAPABILITIES
288
- ]);
289
- if (parsed.leading) {
290
- embeddedCode.content.push([
291
- parsed.leading,
292
- block.name,
293
- 0,
294
- FULL_CAPABILITIES
295
- ]);
296
- }
297
- embeddedCode.content.push([
298
- "export default __weapp_defineConfig(",
299
- void 0,
300
- parsed.expressionStart,
301
- VOID_CAPABILITIES
302
- ]);
303
- embeddedCode.content.push([
304
- parsed.expression,
305
- block.name,
306
- parsed.expressionStart,
307
- FULL_CAPABILITIES
308
- ]);
309
- embeddedCode.content.push([
310
- ")",
311
- void 0,
312
- parsed.expressionEnd,
313
- VOID_CAPABILITIES
314
- ]);
315
- if (parsed.trailing) {
316
- embeddedCode.content.push([
317
- parsed.trailing,
318
- block.name,
319
- parsed.expressionEnd,
320
- FULL_CAPABILITIES
321
- ]);
322
- }
323
- return;
324
- }
325
- embeddedCode.content.push([
326
- block.content,
327
- block.name,
328
- 0,
329
- FULL_CAPABILITIES
330
- ]);
331
- return;
332
- }
333
- const schema = getSchemaForType(configType);
334
- if (schema && schema.$id && !block.content.includes("$schema")) {
335
- embeddedCode.content.push([
336
- injectSchemaIntoJsonObject(block.content, schema.$id),
337
- block.name,
338
- 0,
339
- FULL_CAPABILITIES
340
- ]);
341
- return;
342
- }
343
- embeddedCode.content.push([
344
- block.content,
345
- block.name,
346
- 0,
347
- FULL_CAPABILITIES
348
- ]);
349
- }
350
- };
351
- };
352
- var index_default = plugin;
353
- export {
354
- index_default as default
163
+ /**
164
+ * Volar 语言插件:为 weapp 配置块提供类型与 schema 提示。
165
+ */
166
+ const plugin = (ctx) => {
167
+ let tsModule = ctx?.modules?.typescript;
168
+ if (!tsModule) try {
169
+ tsModule = require("typescript");
170
+ } catch {
171
+ tsModule = void 0;
172
+ }
173
+ return {
174
+ name,
175
+ version: PLUGIN_VERSION,
176
+ order: -1,
177
+ parseSFC2(fileName, languageId, content) {
178
+ if (languageId !== "vue") return;
179
+ const parsed = parseVueSfc(content, fileName);
180
+ if (!parsed) return;
181
+ const descriptor = parsed.descriptor;
182
+ const wxsModuleNames = collectWxsModuleNames(descriptor.template?.content);
183
+ if (!wxsModuleNames.length) return parsed;
184
+ if (descriptor.scriptSetup) descriptor.scriptSetup.content = appendWxsDeclarations(descriptor.scriptSetup.content, wxsModuleNames);
185
+ else descriptor.scriptSetup = createSyntheticScriptSetup(wxsModuleNames);
186
+ return parsed;
187
+ },
188
+ getEmbeddedCodes(_, sfc) {
189
+ const names = [];
190
+ for (let i = 0; i < sfc.customBlocks.length; i++) {
191
+ const block = sfc.customBlocks[i];
192
+ if (block.type === BLOCK_TYPE) {
193
+ const normalizedLang = normalizeLang(block.lang);
194
+ if (normalizedLang === JS_LANG || normalizedLang === TS_LANG) {
195
+ names.push({
196
+ id: `${BLOCK_TYPE}_${i}`,
197
+ lang: TS_LANG
198
+ });
199
+ continue;
200
+ }
201
+ const embeddedLang = normalizedLang === JSON_LANG || normalizedLang === JSONC_LANG || normalizedLang === JSON5_LANG ? JSONC_LANG : JSON_LANG;
202
+ names.push({
203
+ id: `${BLOCK_TYPE}_${i}`,
204
+ lang: embeddedLang
205
+ });
206
+ }
207
+ }
208
+ return names;
209
+ },
210
+ resolveEmbeddedCode(fileName, sfc, embeddedCode) {
211
+ const match = embeddedCode.id.match(new RegExp(`^${BLOCK_TYPE}_(\\d+)$`));
212
+ if (!match) return;
213
+ const index = Number.parseInt(match[1]);
214
+ const block = sfc.customBlocks[index];
215
+ if (!block) return;
216
+ const normalizedLang = normalizeLang(block.lang);
217
+ const configType = inferConfigType(fileName);
218
+ if (!hasSchematicsTypes) {
219
+ embeddedCode.content.push([
220
+ block.content,
221
+ block.name,
222
+ 0,
223
+ FULL_CAPABILITIES
224
+ ]);
225
+ return;
226
+ }
227
+ if (normalizedLang === JS_LANG || normalizedLang === TS_LANG) {
228
+ const parsed = tsModule && findExportDefaultExpression(block.content, tsModule, normalizedLang);
229
+ if (parsed && hasSchematicsTypes) {
230
+ const typeImport = `import type { ${configType} as __WeappConfig } from '@weapp-core/schematics'\n`;
231
+ embeddedCode.content.push([
232
+ `${typeImport}const __weapp_defineConfig = <T extends __WeappConfig>(config: T) => config
233
+
234
+ `,
235
+ void 0,
236
+ 0,
237
+ VOID_CAPABILITIES
238
+ ]);
239
+ if (parsed.leading) embeddedCode.content.push([
240
+ parsed.leading,
241
+ block.name,
242
+ 0,
243
+ FULL_CAPABILITIES
244
+ ]);
245
+ embeddedCode.content.push([
246
+ "export default __weapp_defineConfig(",
247
+ void 0,
248
+ parsed.expressionStart,
249
+ VOID_CAPABILITIES
250
+ ]);
251
+ embeddedCode.content.push([
252
+ parsed.expression,
253
+ block.name,
254
+ parsed.expressionStart,
255
+ FULL_CAPABILITIES
256
+ ]);
257
+ embeddedCode.content.push([
258
+ ")",
259
+ void 0,
260
+ parsed.expressionEnd,
261
+ VOID_CAPABILITIES
262
+ ]);
263
+ if (parsed.trailing) embeddedCode.content.push([
264
+ parsed.trailing,
265
+ block.name,
266
+ parsed.expressionEnd,
267
+ FULL_CAPABILITIES
268
+ ]);
269
+ return;
270
+ }
271
+ embeddedCode.content.push([
272
+ block.content,
273
+ block.name,
274
+ 0,
275
+ FULL_CAPABILITIES
276
+ ]);
277
+ return;
278
+ }
279
+ const schema = getSchemaForType(configType);
280
+ if (schema && schema.$id && !block.content.includes("$schema")) {
281
+ embeddedCode.content.push([
282
+ injectSchemaIntoJsonObject(block.content, schema.$id),
283
+ block.name,
284
+ 0,
285
+ FULL_CAPABILITIES
286
+ ]);
287
+ return;
288
+ }
289
+ embeddedCode.content.push([
290
+ block.content,
291
+ block.name,
292
+ 0,
293
+ FULL_CAPABILITIES
294
+ ]);
295
+ }
296
+ };
355
297
  };
298
+ //#endregion
299
+ export { plugin as default };
@@ -0,0 +1,26 @@
1
+ export interface JsonSchema {
2
+ $schema?: string;
3
+ $id?: string;
4
+ title?: string;
5
+ description?: string;
6
+ type: string;
7
+ properties?: Record<string, any>;
8
+ required?: string[];
9
+ additionalProperties?: boolean | any;
10
+ items?: any;
11
+ definitions?: Record<string, any>;
12
+ enum?: string[];
13
+ minimum?: number;
14
+ maximum?: number;
15
+ minItems?: number;
16
+ maxItems?: number;
17
+ }
18
+ /**
19
+ * 根据文件类型获取对应的 JSON Schema
20
+ * Schema 定义来自 @weapp-core/schematics,使用 Zod 维护单一数据源
21
+ */
22
+ export declare function getSchemaForType(type: 'App' | 'Page' | 'Component' | 'Plugin' | 'Sitemap' | 'Theme'): JsonSchema | null;
23
+ /**
24
+ * 为配置块生成 schema 注释
25
+ */
26
+ export declare function generateSchemaComment(type: 'App' | 'Page' | 'Component' | 'Plugin' | 'Sitemap' | 'Theme'): string;