@weapp-vite/volar 0.1.0-alpha.0 → 2.0.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/README.md +1 -1
- package/dist/index.mjs +54 -58
- package/package.json +9 -10
- package/dist/index.d.ts +0 -5
- package/dist/index.js +0 -275
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ yarn add -D @weapp-vite/volar
|
|
|
24
24
|
|
|
25
25
|
## 功能特性
|
|
26
26
|
|
|
27
|
-
- ✅ **配置文件智能提示** - 为 `<
|
|
27
|
+
- ✅ **配置文件智能提示** - 为 `<json>` 代码块提供完整的类型检查和自动补全
|
|
28
28
|
- ✅ **JSON Schema 支持** - 支持 JSON Schema 验证和自动补全
|
|
29
29
|
- ✅ **TypeScript 类型检查** - 利用 TypeScript 类型系统确保配置正确性
|
|
30
30
|
- ✅ **自动推断配置类型** - 根据文件路径自动推断是 App/Page/Component 配置
|
package/dist/index.mjs
CHANGED
|
@@ -15,11 +15,13 @@ function getSchemaForType(type) {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
// src/index.ts
|
|
18
|
-
var BLOCK_TYPE = "
|
|
18
|
+
var BLOCK_TYPE = "json";
|
|
19
19
|
var JS_LANG = "js";
|
|
20
|
+
var JSONC_LANG = "jsonc";
|
|
20
21
|
var JSON_LANG = "json";
|
|
21
|
-
var
|
|
22
|
+
var JSON5_LANG = "json5";
|
|
22
23
|
var PLUGIN_VERSION = 2.2;
|
|
24
|
+
var TS_LANG = "ts";
|
|
23
25
|
var FULL_CAPABILITIES = {
|
|
24
26
|
verification: true,
|
|
25
27
|
completion: true,
|
|
@@ -44,19 +46,6 @@ try {
|
|
|
44
46
|
} catch {
|
|
45
47
|
hasSchematicsTypes = false;
|
|
46
48
|
}
|
|
47
|
-
function normalizeLang(lang) {
|
|
48
|
-
if (!lang) {
|
|
49
|
-
return JSON_LANG;
|
|
50
|
-
}
|
|
51
|
-
const lower = lang.toLowerCase();
|
|
52
|
-
if (lower === "txt") {
|
|
53
|
-
return JSON_LANG;
|
|
54
|
-
}
|
|
55
|
-
if (lower === "jsonc") {
|
|
56
|
-
return JSON_LANG;
|
|
57
|
-
}
|
|
58
|
-
return lower;
|
|
59
|
-
}
|
|
60
49
|
function normalizeFilename(filename) {
|
|
61
50
|
if (!filename) {
|
|
62
51
|
return "";
|
|
@@ -82,6 +71,16 @@ function inferConfigType(filename) {
|
|
|
82
71
|
}
|
|
83
72
|
return "Page";
|
|
84
73
|
}
|
|
74
|
+
function normalizeLang(lang) {
|
|
75
|
+
if (!lang) {
|
|
76
|
+
return JSON_LANG;
|
|
77
|
+
}
|
|
78
|
+
const lower = lang.toLowerCase();
|
|
79
|
+
if (lower === "txt") {
|
|
80
|
+
return JSON_LANG;
|
|
81
|
+
}
|
|
82
|
+
return lower;
|
|
83
|
+
}
|
|
85
84
|
function findExportDefaultExpression(code, tsModule, lang) {
|
|
86
85
|
const scriptKind = lang === TS_LANG ? tsModule.ScriptKind.TS : tsModule.ScriptKind.JS;
|
|
87
86
|
const sourceFile = tsModule.createSourceFile(
|
|
@@ -109,6 +108,31 @@ function findExportDefaultExpression(code, tsModule, lang) {
|
|
|
109
108
|
}
|
|
110
109
|
return null;
|
|
111
110
|
}
|
|
111
|
+
function injectSchemaIntoJsonObject(content, schemaId) {
|
|
112
|
+
const trimmed = content.trim();
|
|
113
|
+
if (!trimmed.startsWith("{")) {
|
|
114
|
+
return content;
|
|
115
|
+
}
|
|
116
|
+
const leftBraceIndex = content.indexOf("{");
|
|
117
|
+
if (leftBraceIndex < 0) {
|
|
118
|
+
return content;
|
|
119
|
+
}
|
|
120
|
+
const afterLeft = content.slice(leftBraceIndex + 1);
|
|
121
|
+
const firstNonSpace = afterLeft.match(/\S/);
|
|
122
|
+
const nextCharIndex = firstNonSpace ? leftBraceIndex + 1 + firstNonSpace.index : -1;
|
|
123
|
+
const isEmptyObject = nextCharIndex >= 0 && content[nextCharIndex] === "}";
|
|
124
|
+
const schemaLine = ` "$schema": "${schemaId}"`;
|
|
125
|
+
const injected = isEmptyObject ? `{
|
|
126
|
+
${schemaLine}
|
|
127
|
+
}` : `{
|
|
128
|
+
${schemaLine},${content.slice(leftBraceIndex + 1)}`;
|
|
129
|
+
if (trimmed === content) {
|
|
130
|
+
return injected;
|
|
131
|
+
}
|
|
132
|
+
const leading = content.slice(0, content.indexOf(trimmed));
|
|
133
|
+
const trailing = content.slice(content.indexOf(trimmed) + trimmed.length);
|
|
134
|
+
return `${leading}${injected}${trailing}`;
|
|
135
|
+
}
|
|
112
136
|
var plugin = (ctx) => {
|
|
113
137
|
let tsModule = ctx?.modules?.typescript;
|
|
114
138
|
if (!tsModule) {
|
|
@@ -128,8 +152,12 @@ var plugin = (ctx) => {
|
|
|
128
152
|
if (block.type === BLOCK_TYPE) {
|
|
129
153
|
const normalizedLang = normalizeLang(block.lang);
|
|
130
154
|
const isJsLike = normalizedLang === JS_LANG || normalizedLang === TS_LANG;
|
|
131
|
-
|
|
132
|
-
|
|
155
|
+
if (isJsLike) {
|
|
156
|
+
names.push({ id: `${BLOCK_TYPE}_${i}`, lang: TS_LANG });
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
const embeddedLang = normalizedLang === JSON_LANG || normalizedLang === JSONC_LANG || normalizedLang === JSON5_LANG ? JSONC_LANG : JSON_LANG;
|
|
160
|
+
names.push({ id: `${BLOCK_TYPE}_${i}`, lang: embeddedLang });
|
|
133
161
|
}
|
|
134
162
|
}
|
|
135
163
|
return names;
|
|
@@ -155,8 +183,7 @@ var plugin = (ctx) => {
|
|
|
155
183
|
]);
|
|
156
184
|
return;
|
|
157
185
|
}
|
|
158
|
-
const
|
|
159
|
-
const userWantsJs = normalizedLang === "js" || normalizedLang === "ts";
|
|
186
|
+
const userWantsJs = normalizedLang === JS_LANG || normalizedLang === TS_LANG;
|
|
160
187
|
if (userWantsJs) {
|
|
161
188
|
const parsed = tsModule && findExportDefaultExpression(block.content, tsModule, normalizedLang);
|
|
162
189
|
if (parsed && hasSchematicsTypes) {
|
|
@@ -213,53 +240,22 @@ var plugin = (ctx) => {
|
|
|
213
240
|
]);
|
|
214
241
|
return;
|
|
215
242
|
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
${schemaComment}${content.slice(1)}` : block.content;
|
|
225
|
-
embeddedCode.content.push([
|
|
226
|
-
injected,
|
|
227
|
-
block.name,
|
|
228
|
-
0,
|
|
229
|
-
FULL_CAPABILITIES
|
|
230
|
-
]);
|
|
231
|
-
} else {
|
|
232
|
-
embeddedCode.content.push([
|
|
233
|
-
block.content,
|
|
234
|
-
block.name,
|
|
235
|
-
0,
|
|
236
|
-
FULL_CAPABILITIES
|
|
237
|
-
]);
|
|
238
|
-
}
|
|
243
|
+
const schema = getSchemaForType(configType);
|
|
244
|
+
if (schema && schema.$id && !block.content.includes("$schema")) {
|
|
245
|
+
embeddedCode.content.push([
|
|
246
|
+
injectSchemaIntoJsonObject(block.content, schema.$id),
|
|
247
|
+
block.name,
|
|
248
|
+
0,
|
|
249
|
+
FULL_CAPABILITIES
|
|
250
|
+
]);
|
|
239
251
|
return;
|
|
240
252
|
}
|
|
241
|
-
const prefix = `import type { ${configType} as __WeappConfig } from '@weapp-core/schematics'
|
|
242
|
-
|
|
243
|
-
export default `;
|
|
244
|
-
const suffix = " satisfies __WeappConfig\n";
|
|
245
|
-
embeddedCode.content.push([
|
|
246
|
-
prefix,
|
|
247
|
-
void 0,
|
|
248
|
-
0,
|
|
249
|
-
VOID_CAPABILITIES
|
|
250
|
-
]);
|
|
251
253
|
embeddedCode.content.push([
|
|
252
254
|
block.content,
|
|
253
255
|
block.name,
|
|
254
256
|
0,
|
|
255
257
|
FULL_CAPABILITIES
|
|
256
258
|
]);
|
|
257
|
-
embeddedCode.content.push([
|
|
258
|
-
suffix,
|
|
259
|
-
void 0,
|
|
260
|
-
block.content.length,
|
|
261
|
-
VOID_CAPABILITIES
|
|
262
|
-
]);
|
|
263
259
|
}
|
|
264
260
|
};
|
|
265
261
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weapp-vite/volar",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Volar plugin for weapp-vite - Provides IntelliSense and type checking for WeChat mini-program config blocks",
|
|
5
5
|
"author": "ice breaker <1324318532@qq.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,22 +25,21 @@
|
|
|
25
25
|
"sideEffects": false,
|
|
26
26
|
"exports": {
|
|
27
27
|
".": {
|
|
28
|
-
"types":
|
|
29
|
-
|
|
30
|
-
"require": "./dist/index.d.ts"
|
|
31
|
-
},
|
|
32
|
-
"import": "./dist/index.mjs",
|
|
33
|
-
"require": "./dist/index.js"
|
|
28
|
+
"types": "./dist/index.d.mts",
|
|
29
|
+
"import": "./dist/index.mjs"
|
|
34
30
|
}
|
|
35
31
|
},
|
|
36
|
-
"main": "./dist/index.
|
|
32
|
+
"main": "./dist/index.mjs",
|
|
37
33
|
"module": "./dist/index.mjs",
|
|
38
|
-
"types": "./dist/index.d.
|
|
34
|
+
"types": "./dist/index.d.mts",
|
|
39
35
|
"files": [
|
|
40
36
|
"dist"
|
|
41
37
|
],
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": "^20.19.0 || >=22.12.0"
|
|
40
|
+
},
|
|
42
41
|
"dependencies": {
|
|
43
|
-
"@weapp-core/schematics": "
|
|
42
|
+
"@weapp-core/schematics": "6.0.0"
|
|
44
43
|
},
|
|
45
44
|
"scripts": {
|
|
46
45
|
"dev": "tsup --watch --sourcemap",
|
package/dist/index.d.ts
DELETED
package/dist/index.js
DELETED
|
@@ -1,275 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// ../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.7_jiti@2.6.1_postcss@8.5.6_tsx@4.21.0_typescript@5.9.3_yaml@2.8.2/node_modules/tsup/assets/cjs_shims.js
|
|
2
|
-
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.tagName.toUpperCase() === "SCRIPT" ? document.currentScript.src : new URL("main.js", document.baseURI).href;
|
|
3
|
-
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
4
|
-
|
|
5
|
-
// src/index.ts
|
|
6
|
-
var _module = require('module');
|
|
7
|
-
|
|
8
|
-
// package.json
|
|
9
|
-
var name = "@weapp-vite/volar";
|
|
10
|
-
|
|
11
|
-
// src/schema.ts
|
|
12
|
-
var _schematics = require('@weapp-core/schematics');
|
|
13
|
-
function getSchemaForType(type) {
|
|
14
|
-
const definition = _schematics.JSON_SCHEMA_DEFINITIONS.find((d) => d.typeName === type);
|
|
15
|
-
if (!definition) {
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
return definition.schema;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// src/index.ts
|
|
22
|
-
var BLOCK_TYPE = "config";
|
|
23
|
-
var JS_LANG = "js";
|
|
24
|
-
var JSON_LANG = "json";
|
|
25
|
-
var TS_LANG = "ts";
|
|
26
|
-
var PLUGIN_VERSION = 2.2;
|
|
27
|
-
var FULL_CAPABILITIES = {
|
|
28
|
-
verification: true,
|
|
29
|
-
completion: true,
|
|
30
|
-
semantic: true,
|
|
31
|
-
navigation: true,
|
|
32
|
-
structure: true,
|
|
33
|
-
format: true
|
|
34
|
-
};
|
|
35
|
-
var VOID_CAPABILITIES = {
|
|
36
|
-
verification: false,
|
|
37
|
-
completion: false,
|
|
38
|
-
semantic: false,
|
|
39
|
-
navigation: false,
|
|
40
|
-
structure: false,
|
|
41
|
-
format: false
|
|
42
|
-
};
|
|
43
|
-
var require2 = _module.createRequire.call(void 0, importMetaUrl);
|
|
44
|
-
var hasSchematicsTypes = false;
|
|
45
|
-
try {
|
|
46
|
-
require2.resolve("@weapp-core/schematics");
|
|
47
|
-
hasSchematicsTypes = true;
|
|
48
|
-
} catch (e) {
|
|
49
|
-
hasSchematicsTypes = false;
|
|
50
|
-
}
|
|
51
|
-
function normalizeLang(lang) {
|
|
52
|
-
if (!lang) {
|
|
53
|
-
return JSON_LANG;
|
|
54
|
-
}
|
|
55
|
-
const lower = lang.toLowerCase();
|
|
56
|
-
if (lower === "txt") {
|
|
57
|
-
return JSON_LANG;
|
|
58
|
-
}
|
|
59
|
-
if (lower === "jsonc") {
|
|
60
|
-
return JSON_LANG;
|
|
61
|
-
}
|
|
62
|
-
return lower;
|
|
63
|
-
}
|
|
64
|
-
function normalizeFilename(filename) {
|
|
65
|
-
if (!filename) {
|
|
66
|
-
return "";
|
|
67
|
-
}
|
|
68
|
-
return filename.replace(/\\/g, "/");
|
|
69
|
-
}
|
|
70
|
-
function inferConfigType(filename) {
|
|
71
|
-
const normalized = normalizeFilename(filename);
|
|
72
|
-
if (normalized.endsWith("/app.vue")) {
|
|
73
|
-
return "App";
|
|
74
|
-
}
|
|
75
|
-
if (normalized.includes("/plugin/")) {
|
|
76
|
-
return "Plugin";
|
|
77
|
-
}
|
|
78
|
-
if (normalized.includes("/components/")) {
|
|
79
|
-
return "Component";
|
|
80
|
-
}
|
|
81
|
-
if (normalized.includes("/theme/")) {
|
|
82
|
-
return "Theme";
|
|
83
|
-
}
|
|
84
|
-
if (normalized.includes("/sitemap")) {
|
|
85
|
-
return "Sitemap";
|
|
86
|
-
}
|
|
87
|
-
return "Page";
|
|
88
|
-
}
|
|
89
|
-
function findExportDefaultExpression(code, tsModule, lang) {
|
|
90
|
-
const scriptKind = lang === TS_LANG ? tsModule.ScriptKind.TS : tsModule.ScriptKind.JS;
|
|
91
|
-
const sourceFile = tsModule.createSourceFile(
|
|
92
|
-
`config.${lang}`,
|
|
93
|
-
code,
|
|
94
|
-
tsModule.ScriptTarget.Latest,
|
|
95
|
-
true,
|
|
96
|
-
scriptKind
|
|
97
|
-
);
|
|
98
|
-
for (const statement of sourceFile.statements) {
|
|
99
|
-
if (tsModule.isExportAssignment(statement)) {
|
|
100
|
-
const expressionStart = statement.expression.getStart(sourceFile);
|
|
101
|
-
const expressionEnd = statement.expression.getEnd();
|
|
102
|
-
const leading = code.slice(0, statement.getStart(sourceFile));
|
|
103
|
-
const expression = code.slice(expressionStart, expressionEnd);
|
|
104
|
-
const trailing = code.slice(statement.getEnd());
|
|
105
|
-
return {
|
|
106
|
-
expression,
|
|
107
|
-
expressionStart,
|
|
108
|
-
expressionEnd,
|
|
109
|
-
leading,
|
|
110
|
-
trailing
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
return null;
|
|
115
|
-
}
|
|
116
|
-
var plugin = (ctx) => {
|
|
117
|
-
let tsModule = _optionalChain([ctx, 'optionalAccess', _2 => _2.modules, 'optionalAccess', _3 => _3.typescript]);
|
|
118
|
-
if (!tsModule) {
|
|
119
|
-
try {
|
|
120
|
-
tsModule = require2("typescript");
|
|
121
|
-
} catch (e2) {
|
|
122
|
-
tsModule = void 0;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
return {
|
|
126
|
-
name,
|
|
127
|
-
version: PLUGIN_VERSION,
|
|
128
|
-
getEmbeddedCodes(_, sfc) {
|
|
129
|
-
const names = [];
|
|
130
|
-
for (let i = 0; i < sfc.customBlocks.length; i++) {
|
|
131
|
-
const block = sfc.customBlocks[i];
|
|
132
|
-
if (block.type === BLOCK_TYPE) {
|
|
133
|
-
const normalizedLang = normalizeLang(block.lang);
|
|
134
|
-
const isJsLike = normalizedLang === JS_LANG || normalizedLang === TS_LANG;
|
|
135
|
-
const lang = isJsLike ? TS_LANG : normalizedLang;
|
|
136
|
-
names.push({ id: `${BLOCK_TYPE}_${i}`, lang });
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
return names;
|
|
140
|
-
},
|
|
141
|
-
resolveEmbeddedCode(fileName, sfc, embeddedCode) {
|
|
142
|
-
const match = embeddedCode.id.match(new RegExp(`^${BLOCK_TYPE}_(\\d+)$`));
|
|
143
|
-
if (!match) {
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
const index = Number.parseInt(match[1]);
|
|
147
|
-
const block = sfc.customBlocks[index];
|
|
148
|
-
if (!block) {
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
const normalizedLang = normalizeLang(block.lang);
|
|
152
|
-
const configType = inferConfigType(fileName);
|
|
153
|
-
if (!hasSchematicsTypes) {
|
|
154
|
-
embeddedCode.content.push([
|
|
155
|
-
block.content,
|
|
156
|
-
block.name,
|
|
157
|
-
0,
|
|
158
|
-
FULL_CAPABILITIES
|
|
159
|
-
]);
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
const userWantsJson = normalizedLang === "json" || normalizedLang === "jsonc" || block.content.includes("$schema");
|
|
163
|
-
const userWantsJs = normalizedLang === "js" || normalizedLang === "ts";
|
|
164
|
-
if (userWantsJs) {
|
|
165
|
-
const parsed = tsModule && findExportDefaultExpression(block.content, tsModule, normalizedLang);
|
|
166
|
-
if (parsed && hasSchematicsTypes) {
|
|
167
|
-
const typeImport = `import type { ${configType} as __WeappConfig } from '@weapp-core/schematics'
|
|
168
|
-
`;
|
|
169
|
-
const helper = "const __weapp_defineConfig = <T extends __WeappConfig>(config: T) => config\n\n";
|
|
170
|
-
embeddedCode.content.push([
|
|
171
|
-
`${typeImport}${helper}`,
|
|
172
|
-
void 0,
|
|
173
|
-
0,
|
|
174
|
-
VOID_CAPABILITIES
|
|
175
|
-
]);
|
|
176
|
-
if (parsed.leading) {
|
|
177
|
-
embeddedCode.content.push([
|
|
178
|
-
parsed.leading,
|
|
179
|
-
block.name,
|
|
180
|
-
0,
|
|
181
|
-
FULL_CAPABILITIES
|
|
182
|
-
]);
|
|
183
|
-
}
|
|
184
|
-
embeddedCode.content.push([
|
|
185
|
-
"export default __weapp_defineConfig(",
|
|
186
|
-
void 0,
|
|
187
|
-
parsed.expressionStart,
|
|
188
|
-
VOID_CAPABILITIES
|
|
189
|
-
]);
|
|
190
|
-
embeddedCode.content.push([
|
|
191
|
-
parsed.expression,
|
|
192
|
-
block.name,
|
|
193
|
-
parsed.expressionStart,
|
|
194
|
-
FULL_CAPABILITIES
|
|
195
|
-
]);
|
|
196
|
-
embeddedCode.content.push([
|
|
197
|
-
")",
|
|
198
|
-
void 0,
|
|
199
|
-
parsed.expressionEnd,
|
|
200
|
-
VOID_CAPABILITIES
|
|
201
|
-
]);
|
|
202
|
-
if (parsed.trailing) {
|
|
203
|
-
embeddedCode.content.push([
|
|
204
|
-
parsed.trailing,
|
|
205
|
-
block.name,
|
|
206
|
-
parsed.expressionEnd,
|
|
207
|
-
FULL_CAPABILITIES
|
|
208
|
-
]);
|
|
209
|
-
}
|
|
210
|
-
return;
|
|
211
|
-
}
|
|
212
|
-
embeddedCode.content.push([
|
|
213
|
-
block.content,
|
|
214
|
-
block.name,
|
|
215
|
-
0,
|
|
216
|
-
FULL_CAPABILITIES
|
|
217
|
-
]);
|
|
218
|
-
return;
|
|
219
|
-
}
|
|
220
|
-
if (userWantsJson) {
|
|
221
|
-
const schema = getSchemaForType(configType);
|
|
222
|
-
if (schema && schema.$id && !block.content.includes("$schema")) {
|
|
223
|
-
const schemaComment = ` "$schema": "${schema.$id}",
|
|
224
|
-
`;
|
|
225
|
-
const content = block.content.trim();
|
|
226
|
-
const hasOpeningBrace = content.startsWith("{");
|
|
227
|
-
const injected = hasOpeningBrace ? `${content.slice(0, 1)}
|
|
228
|
-
${schemaComment}${content.slice(1)}` : block.content;
|
|
229
|
-
embeddedCode.content.push([
|
|
230
|
-
injected,
|
|
231
|
-
block.name,
|
|
232
|
-
0,
|
|
233
|
-
FULL_CAPABILITIES
|
|
234
|
-
]);
|
|
235
|
-
} else {
|
|
236
|
-
embeddedCode.content.push([
|
|
237
|
-
block.content,
|
|
238
|
-
block.name,
|
|
239
|
-
0,
|
|
240
|
-
FULL_CAPABILITIES
|
|
241
|
-
]);
|
|
242
|
-
}
|
|
243
|
-
return;
|
|
244
|
-
}
|
|
245
|
-
const prefix = `import type { ${configType} as __WeappConfig } from '@weapp-core/schematics'
|
|
246
|
-
|
|
247
|
-
export default `;
|
|
248
|
-
const suffix = " satisfies __WeappConfig\n";
|
|
249
|
-
embeddedCode.content.push([
|
|
250
|
-
prefix,
|
|
251
|
-
void 0,
|
|
252
|
-
0,
|
|
253
|
-
VOID_CAPABILITIES
|
|
254
|
-
]);
|
|
255
|
-
embeddedCode.content.push([
|
|
256
|
-
block.content,
|
|
257
|
-
block.name,
|
|
258
|
-
0,
|
|
259
|
-
FULL_CAPABILITIES
|
|
260
|
-
]);
|
|
261
|
-
embeddedCode.content.push([
|
|
262
|
-
suffix,
|
|
263
|
-
void 0,
|
|
264
|
-
block.content.length,
|
|
265
|
-
VOID_CAPABILITIES
|
|
266
|
-
]);
|
|
267
|
-
}
|
|
268
|
-
};
|
|
269
|
-
};
|
|
270
|
-
var index_default = plugin;
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
exports.default = index_default;
|
|
274
|
-
|
|
275
|
-
module.exports = exports.default;
|