@wevu/compiler 0.0.0 → 0.0.1
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.mts +459 -4
- package/dist/index.mjs +5026 -5
- package/package.json +17 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,460 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { LRUCache } from "lru-cache";
|
|
2
|
+
import { SFCBlock, SFCDescriptor, SFCParseResult, SFCStyleBlock } from "vue/compiler-sfc";
|
|
3
|
+
import * as t from "@babel/types";
|
|
4
|
+
import { Expression } from "@babel/types";
|
|
5
|
+
|
|
6
|
+
//#region src/auto-import-components/builtin.d.ts
|
|
7
|
+
declare const builtinComponentsSet: Set<string>;
|
|
8
|
+
declare function isBuiltinComponent(tag: string): boolean;
|
|
4
9
|
//#endregion
|
|
5
|
-
|
|
10
|
+
//#region src/constants.d.ts
|
|
11
|
+
declare const WE_VU_PAGE_HOOK_TO_FEATURE: {
|
|
12
|
+
readonly onPageScroll: "enableOnPageScroll";
|
|
13
|
+
readonly onPullDownRefresh: "enableOnPullDownRefresh";
|
|
14
|
+
readonly onReachBottom: "enableOnReachBottom";
|
|
15
|
+
readonly onRouteDone: "enableOnRouteDone";
|
|
16
|
+
readonly onTabItemTap: "enableOnTabItemTap";
|
|
17
|
+
readonly onResize: "enableOnResize";
|
|
18
|
+
readonly onShareAppMessage: "enableOnShareAppMessage";
|
|
19
|
+
readonly onShareTimeline: "enableOnShareTimeline";
|
|
20
|
+
readonly onAddToFavorites: "enableOnAddToFavorites";
|
|
21
|
+
readonly onSaveExitState: "enableOnSaveExitState";
|
|
22
|
+
};
|
|
23
|
+
declare const WE_VU_MODULE_ID: "wevu";
|
|
24
|
+
declare const WE_VU_RUNTIME_APIS: {
|
|
25
|
+
readonly createApp: "createApp";
|
|
26
|
+
readonly createWevuComponent: "createWevuComponent";
|
|
27
|
+
readonly createWevuScopedSlotComponent: "createWevuScopedSlotComponent";
|
|
28
|
+
readonly defineComponent: "defineComponent";
|
|
29
|
+
readonly setWevuDefaults: "setWevuDefaults";
|
|
30
|
+
};
|
|
31
|
+
type WevuRuntimeApiName = (typeof WE_VU_RUNTIME_APIS)[keyof typeof WE_VU_RUNTIME_APIS];
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/plugins/utils/cache.d.ts
|
|
34
|
+
declare const mtimeCache: Map<string, {
|
|
35
|
+
mtimeMs: number;
|
|
36
|
+
size: number;
|
|
37
|
+
}>;
|
|
38
|
+
declare const loadCache: LRUCache<string, string, unknown>;
|
|
39
|
+
/**
|
|
40
|
+
* 返回 true 的时候需要重新 fs 读取
|
|
41
|
+
* @param id 文件路径
|
|
42
|
+
* @returns {Promise<boolean>} 当文件需要重新读取时返回 true
|
|
43
|
+
*/
|
|
44
|
+
declare function isInvalidate(id: string): Promise<boolean>;
|
|
45
|
+
declare function readFile(id: string, options?: {
|
|
46
|
+
checkMtime?: boolean;
|
|
47
|
+
encoding?: BufferEncoding;
|
|
48
|
+
}): Promise<string>;
|
|
49
|
+
declare function pathExists(id: string, options?: {
|
|
50
|
+
ttlMs?: number;
|
|
51
|
+
}): Promise<boolean>;
|
|
52
|
+
declare function invalidateFileCache(id: string): void;
|
|
53
|
+
declare function clearFileCaches(): void;
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/plugins/utils/vueSfc.d.ts
|
|
56
|
+
interface ReadAndParseSfcOptions {
|
|
57
|
+
/**
|
|
58
|
+
* 直接传入源码以跳过文件读取。
|
|
59
|
+
*/
|
|
60
|
+
source?: string;
|
|
61
|
+
/**
|
|
62
|
+
* 是否按 mtime+size 检查文件变更(dev 推荐开启)。
|
|
63
|
+
*/
|
|
64
|
+
checkMtime?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* 解析 <template>/<script>/<style> 的 src 引用。
|
|
67
|
+
*/
|
|
68
|
+
resolveSrc?: ResolveSfcBlockSrcOptions;
|
|
69
|
+
}
|
|
70
|
+
interface ResolveSfcBlockSrcOptions {
|
|
71
|
+
resolveId?: (source: string, importer?: string) => Promise<string | undefined>;
|
|
72
|
+
readFile?: (id: string, options?: {
|
|
73
|
+
checkMtime?: boolean;
|
|
74
|
+
}) => Promise<string>;
|
|
75
|
+
checkMtime?: boolean;
|
|
76
|
+
}
|
|
77
|
+
declare function preprocessScriptSetupSrc(source: string): string;
|
|
78
|
+
declare function preprocessScriptSrc(source: string): string;
|
|
79
|
+
declare function restoreScriptSetupSrc(descriptor: SFCDescriptor): void;
|
|
80
|
+
declare function restoreScriptSrc(descriptor: SFCDescriptor): void;
|
|
81
|
+
declare function resolveSfcBlockSrc(descriptor: SFCDescriptor, filename: string, options?: ResolveSfcBlockSrcOptions): Promise<{
|
|
82
|
+
descriptor: SFCDescriptor;
|
|
83
|
+
deps: string[];
|
|
84
|
+
}>;
|
|
85
|
+
declare function readAndParseSfc(filename: string, options?: ReadAndParseSfcOptions): Promise<{
|
|
86
|
+
source: string;
|
|
87
|
+
descriptor: SFCDescriptor;
|
|
88
|
+
errors: SFCParseResult['errors'];
|
|
89
|
+
}>;
|
|
90
|
+
declare function getSfcCheckMtime(config?: {
|
|
91
|
+
isDev?: boolean;
|
|
92
|
+
}): boolean;
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region src/plugins/vue/compiler/style.d.ts
|
|
95
|
+
interface StyleCompileResult {
|
|
96
|
+
code: string;
|
|
97
|
+
map?: string;
|
|
98
|
+
scopedId?: string;
|
|
99
|
+
modules?: Record<string, Record<string, string>>;
|
|
100
|
+
}
|
|
101
|
+
interface StyleCompileOptions {
|
|
102
|
+
id: string;
|
|
103
|
+
scoped?: boolean;
|
|
104
|
+
modules?: boolean | string;
|
|
105
|
+
preprocessOptions?: Record<string, any>;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* 将 Vue SFC 的 style 块转换为 WXSS
|
|
109
|
+
*/
|
|
110
|
+
declare function compileVueStyleToWxss(styleBlock: SFCStyleBlock, options: StyleCompileOptions): StyleCompileResult;
|
|
111
|
+
//#endregion
|
|
112
|
+
//#region src/plugins/vue/compiler/template/platform.d.ts
|
|
113
|
+
interface MiniProgramPlatform {
|
|
114
|
+
name: string;
|
|
115
|
+
wrapIf: (exp: string, content: string) => string;
|
|
116
|
+
wrapElseIf: (exp: string, content: string) => string;
|
|
117
|
+
wrapElse: (content: string) => string;
|
|
118
|
+
forAttrs: (listExp: string, item?: string, index?: string) => string[];
|
|
119
|
+
keyThisValue: string;
|
|
120
|
+
keyAttr: (value: string) => string;
|
|
121
|
+
mapEventName: (eventName: string) => string;
|
|
122
|
+
eventBindingAttr: (eventName: string) => string;
|
|
123
|
+
}
|
|
124
|
+
//#endregion
|
|
125
|
+
//#region src/plugins/vue/compiler/template/types.d.ts
|
|
126
|
+
interface ScopedSlotComponentAsset {
|
|
127
|
+
id: string;
|
|
128
|
+
componentName: string;
|
|
129
|
+
slotKey: string;
|
|
130
|
+
template: string;
|
|
131
|
+
classStyleBindings?: ClassStyleBinding[];
|
|
132
|
+
classStyleWxs?: boolean;
|
|
133
|
+
inlineExpressions?: InlineExpressionAsset[];
|
|
134
|
+
}
|
|
135
|
+
interface InlineExpressionAsset {
|
|
136
|
+
id: string;
|
|
137
|
+
expression: string;
|
|
138
|
+
scopeKeys: string[];
|
|
139
|
+
}
|
|
140
|
+
interface TemplateCompileResult {
|
|
141
|
+
code: string;
|
|
142
|
+
warnings: string[];
|
|
143
|
+
scopedSlotComponents?: ScopedSlotComponentAsset[];
|
|
144
|
+
componentGenerics?: Record<string, true>;
|
|
145
|
+
classStyleRuntime?: ClassStyleRuntime;
|
|
146
|
+
classStyleBindings?: ClassStyleBinding[];
|
|
147
|
+
classStyleWxs?: boolean;
|
|
148
|
+
templateRefs?: TemplateRefBinding[];
|
|
149
|
+
inlineExpressions?: InlineExpressionAsset[];
|
|
150
|
+
}
|
|
151
|
+
interface ForParseResult {
|
|
152
|
+
listExp?: string;
|
|
153
|
+
listExpAst?: Expression;
|
|
154
|
+
item?: string;
|
|
155
|
+
index?: string;
|
|
156
|
+
key?: string;
|
|
157
|
+
}
|
|
158
|
+
interface TemplateCompileOptions {
|
|
159
|
+
platform?: MiniProgramPlatform;
|
|
160
|
+
scopedSlotsCompiler?: ScopedSlotsCompilerMode;
|
|
161
|
+
scopedSlotsRequireProps?: boolean;
|
|
162
|
+
slotMultipleInstance?: boolean;
|
|
163
|
+
classStyleRuntime?: ClassStyleRuntime | 'auto';
|
|
164
|
+
wxsExtension?: string;
|
|
165
|
+
classStyleWxsSrc?: string;
|
|
166
|
+
}
|
|
167
|
+
type ScopedSlotsCompilerMode = 'auto' | 'augmented' | 'off';
|
|
168
|
+
type ClassStyleRuntime = 'wxs' | 'js';
|
|
169
|
+
interface ClassStyleBinding {
|
|
170
|
+
name: string;
|
|
171
|
+
type: 'class' | 'style';
|
|
172
|
+
exp: string;
|
|
173
|
+
expAst?: Expression;
|
|
174
|
+
forStack: ForParseResult[];
|
|
175
|
+
}
|
|
176
|
+
interface TemplateRefBinding {
|
|
177
|
+
selector: string;
|
|
178
|
+
inFor: boolean;
|
|
179
|
+
name?: string;
|
|
180
|
+
expAst?: Expression;
|
|
181
|
+
kind?: 'component' | 'element';
|
|
182
|
+
}
|
|
183
|
+
//#endregion
|
|
184
|
+
//#region src/types/platform.d.ts
|
|
185
|
+
type MpPlatform = 'weapp' | 'alipay' | 'tt' | 'swan' | 'jd' | 'xhs';
|
|
186
|
+
//#endregion
|
|
187
|
+
//#region src/plugins/vue/compiler/template/platforms/alipay.d.ts
|
|
188
|
+
declare const alipayPlatform: MiniProgramPlatform;
|
|
189
|
+
//#endregion
|
|
190
|
+
//#region src/plugins/vue/compiler/template/platforms/swan.d.ts
|
|
191
|
+
declare const swanPlatform: MiniProgramPlatform;
|
|
192
|
+
//#endregion
|
|
193
|
+
//#region src/plugins/vue/compiler/template/platforms/tt.d.ts
|
|
194
|
+
declare const ttPlatform: MiniProgramPlatform;
|
|
195
|
+
//#endregion
|
|
196
|
+
//#region src/plugins/vue/compiler/template/platforms/wechat.d.ts
|
|
197
|
+
declare const wechatPlatform: MiniProgramPlatform;
|
|
198
|
+
//#endregion
|
|
199
|
+
//#region src/plugins/vue/compiler/template/platforms/index.d.ts
|
|
200
|
+
declare function getMiniProgramTemplatePlatform(platform?: MpPlatform): MiniProgramPlatform;
|
|
201
|
+
//#endregion
|
|
202
|
+
//#region src/plugins/vue/compiler/template.d.ts
|
|
203
|
+
declare function compileVueTemplateToWxml(template: string, filename: string, options?: TemplateCompileOptions): TemplateCompileResult;
|
|
204
|
+
//#endregion
|
|
205
|
+
//#region src/plugins/vue/compiler/template/classStyleRuntime.d.ts
|
|
206
|
+
declare const CLASS_STYLE_WXS_MODULE = "__weapp_vite";
|
|
207
|
+
declare const CLASS_STYLE_WXS_FILE = "__weapp_vite_class_style";
|
|
208
|
+
declare function buildClassStyleWxsTag(extension: string, src?: string): string;
|
|
209
|
+
declare function resolveClassStyleWxsLocation(options: {
|
|
210
|
+
relativeBase: string;
|
|
211
|
+
extension: string;
|
|
212
|
+
packageRoot?: string;
|
|
213
|
+
}): {
|
|
214
|
+
fileName: string;
|
|
215
|
+
src: string;
|
|
216
|
+
};
|
|
217
|
+
declare function getClassStyleWxsSource(): string;
|
|
218
|
+
//#endregion
|
|
219
|
+
//#region src/plugins/vue/transform/classStyleComputed.d.ts
|
|
220
|
+
interface ClassStyleHelperNames {
|
|
221
|
+
normalizeClassName: string;
|
|
222
|
+
normalizeStyleName: string;
|
|
223
|
+
}
|
|
224
|
+
declare function buildClassStyleComputedCode(bindings: ClassStyleBinding[], helpers: ClassStyleHelperNames): string | null;
|
|
225
|
+
//#endregion
|
|
226
|
+
//#region src/types/json.d.ts
|
|
227
|
+
type JsonMergeStage = 'defaults' | 'json-block' | 'auto-using-components' | 'component-generics' | 'macro' | 'emit' | 'merge-existing';
|
|
228
|
+
interface JsonMergeContext {
|
|
229
|
+
filename?: string;
|
|
230
|
+
kind?: 'app' | 'page' | 'component' | 'unknown';
|
|
231
|
+
stage: JsonMergeStage;
|
|
232
|
+
}
|
|
233
|
+
type JsonMergeFunction = (target: Record<string, any>, source: Record<string, any>, context: JsonMergeContext) => Record<string, any> | void;
|
|
234
|
+
type JsonMergeStrategy = 'deep' | 'assign' | 'replace' | JsonMergeFunction;
|
|
235
|
+
interface JsonConfig {
|
|
236
|
+
/**
|
|
237
|
+
* 产物 JSON 默认值(用于 app/page/component)
|
|
238
|
+
*/
|
|
239
|
+
defaults?: {
|
|
240
|
+
app?: Record<string, any>;
|
|
241
|
+
page?: Record<string, any>;
|
|
242
|
+
component?: Record<string, any>;
|
|
243
|
+
};
|
|
244
|
+
/**
|
|
245
|
+
* JSON 合并策略
|
|
246
|
+
* - `deep`: 深合并(默认)
|
|
247
|
+
* - `assign`: 浅合并(Object.assign)
|
|
248
|
+
* - `replace`: 直接替换
|
|
249
|
+
* - `function`: 自定义合并函数
|
|
250
|
+
*/
|
|
251
|
+
mergeStrategy?: JsonMergeStrategy;
|
|
252
|
+
}
|
|
253
|
+
//#endregion
|
|
254
|
+
//#region src/types/wevu.d.ts
|
|
255
|
+
interface WevuDefaults {
|
|
256
|
+
app?: Record<string, any>;
|
|
257
|
+
component?: Record<string, any>;
|
|
258
|
+
}
|
|
259
|
+
//#endregion
|
|
260
|
+
//#region src/plugins/vue/transform/compileVueFile/types.d.ts
|
|
261
|
+
interface VueTransformResult {
|
|
262
|
+
script?: string;
|
|
263
|
+
template?: string;
|
|
264
|
+
style?: string;
|
|
265
|
+
config?: string;
|
|
266
|
+
cssModules?: Record<string, Record<string, string>>;
|
|
267
|
+
scopedSlotComponents?: TemplateCompileResult['scopedSlotComponents'];
|
|
268
|
+
componentGenerics?: TemplateCompileResult['componentGenerics'];
|
|
269
|
+
classStyleWxs?: boolean;
|
|
270
|
+
meta?: {
|
|
271
|
+
hasScriptSetup?: boolean;
|
|
272
|
+
hasSetupOption?: boolean;
|
|
273
|
+
jsonMacroHash?: string;
|
|
274
|
+
defineOptionsHash?: string;
|
|
275
|
+
sfcSrcDeps?: string[];
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
interface AutoUsingComponentsOptions {
|
|
279
|
+
enabled?: boolean;
|
|
280
|
+
resolveUsingComponentPath?: (importSource: string, importerFilename: string, info?: {
|
|
281
|
+
localName: string;
|
|
282
|
+
importedName?: string;
|
|
283
|
+
kind: 'default' | 'named';
|
|
284
|
+
}) => Promise<string | undefined>;
|
|
285
|
+
warn?: (message: string) => void;
|
|
286
|
+
}
|
|
287
|
+
interface AutoImportTagsOptions {
|
|
288
|
+
enabled?: boolean;
|
|
289
|
+
resolveUsingComponent?: (tag: string, importerFilename: string) => Promise<{
|
|
290
|
+
name: string;
|
|
291
|
+
from: string;
|
|
292
|
+
} | undefined>;
|
|
293
|
+
warn?: (message: string) => void;
|
|
294
|
+
}
|
|
295
|
+
interface CompileVueFileOptions {
|
|
296
|
+
isPage?: boolean;
|
|
297
|
+
isApp?: boolean;
|
|
298
|
+
warn?: (message: string) => void;
|
|
299
|
+
autoUsingComponents?: AutoUsingComponentsOptions;
|
|
300
|
+
autoImportTags?: AutoImportTagsOptions;
|
|
301
|
+
template?: TemplateCompileOptions;
|
|
302
|
+
json?: {
|
|
303
|
+
kind?: 'app' | 'page' | 'component';
|
|
304
|
+
defaults?: JsonConfig['defaults'];
|
|
305
|
+
mergeStrategy?: JsonMergeStrategy;
|
|
306
|
+
};
|
|
307
|
+
sfcSrc?: ResolveSfcBlockSrcOptions;
|
|
308
|
+
wevuDefaults?: WevuDefaults;
|
|
309
|
+
}
|
|
310
|
+
//#endregion
|
|
311
|
+
//#region src/plugins/vue/transform/compileVueFile/index.d.ts
|
|
312
|
+
declare function compileVueFile(source: string, filename: string, options?: CompileVueFileOptions): Promise<VueTransformResult>;
|
|
313
|
+
//#endregion
|
|
314
|
+
//#region src/plugins/vue/transform/config.d.ts
|
|
315
|
+
type JsLikeLang = 'js' | 'ts';
|
|
316
|
+
declare function normalizeConfigLang(lang?: string): string;
|
|
317
|
+
declare function isJsonLikeLang(lang: string): lang is "json" | "jsonc" | "json5";
|
|
318
|
+
declare function resolveJsLikeLang(lang: string): JsLikeLang;
|
|
319
|
+
declare function evaluateJsLikeConfig(source: string, filename: string, lang: string): Promise<any>;
|
|
320
|
+
declare function compileConfigBlocks(blocks: SFCBlock[], filename: string, options?: {
|
|
321
|
+
merge?: (target: Record<string, any>, source: Record<string, any>) => Record<string, any> | void;
|
|
322
|
+
}): Promise<string | undefined>;
|
|
323
|
+
//#endregion
|
|
324
|
+
//#region src/plugins/vue/transform/jsonMacros/rewrite.d.ts
|
|
325
|
+
declare function stripJsonMacroCallsFromCode(code: string, filename: string): string;
|
|
326
|
+
//#endregion
|
|
327
|
+
//#region src/plugins/vue/transform/jsonMacros/index.d.ts
|
|
328
|
+
declare function extractJsonMacroFromScriptSetup(content: string, filename: string, lang?: string, options?: {
|
|
329
|
+
merge?: (target: Record<string, any>, source: Record<string, any>) => Record<string, any> | void;
|
|
330
|
+
}): Promise<{
|
|
331
|
+
stripped: string;
|
|
332
|
+
config?: Record<string, any>;
|
|
333
|
+
macroHash?: string;
|
|
334
|
+
dependencies?: string[];
|
|
335
|
+
}>;
|
|
336
|
+
//#endregion
|
|
337
|
+
//#region src/plugins/vue/transform/jsonMerge.d.ts
|
|
338
|
+
declare function mergeJsonWithStrategy(target: Record<string, any>, source: Record<string, any>, strategy: JsonMergeStrategy | undefined, context: JsonMergeContext): Record<string, any>;
|
|
339
|
+
declare function createJsonMerger(strategy: JsonMergeStrategy | undefined, baseContext: Omit<JsonMergeContext, 'stage'>): (target: Record<string, any>, source: Record<string, any>, stage: JsonMergeContext["stage"]) => Record<string, any>;
|
|
340
|
+
//#endregion
|
|
341
|
+
//#region src/plugins/vue/transform/scopedId.d.ts
|
|
342
|
+
/**
|
|
343
|
+
* 生成 scoped ID
|
|
344
|
+
*/
|
|
345
|
+
declare function generateScopedId(filename: string): string;
|
|
346
|
+
//#endregion
|
|
347
|
+
//#region src/plugins/vue/transform/transformScript/utils.d.ts
|
|
348
|
+
/**
|
|
349
|
+
* 使用 Babel AST 转换脚本
|
|
350
|
+
* 比正则替换更健壮,能处理复杂的代码结构
|
|
351
|
+
*/
|
|
352
|
+
interface TransformResult {
|
|
353
|
+
code: string;
|
|
354
|
+
transformed: boolean;
|
|
355
|
+
}
|
|
356
|
+
interface TransformScriptOptions {
|
|
357
|
+
/**
|
|
358
|
+
* 是否跳过组件转换(不添加 createWevuComponent 调用)
|
|
359
|
+
* 用于 app.vue 等入口文件
|
|
360
|
+
*/
|
|
361
|
+
skipComponentTransform?: boolean;
|
|
362
|
+
/**
|
|
363
|
+
* 是否是 App 入口(app.vue)
|
|
364
|
+
* App 需要调用 wevu 的 createApp() 来注册小程序 App 并挂载 app hooks。
|
|
365
|
+
*/
|
|
366
|
+
isApp?: boolean;
|
|
367
|
+
/**
|
|
368
|
+
* 是否是 Page 入口(仅 Page 才需要注入 features 以启用按需派发的页面事件)
|
|
369
|
+
*/
|
|
370
|
+
isPage?: boolean;
|
|
371
|
+
/**
|
|
372
|
+
* <script setup> 中引入的组件:编译时移除 import,并提供同名元信息对象占位,避免运行时访问时报错。
|
|
373
|
+
* key: 组件别名(需与模板标签一致),value: usingComponents 的 from(如 `/components/foo/index`)
|
|
374
|
+
*/
|
|
375
|
+
templateComponentMeta?: Record<string, string>;
|
|
376
|
+
/**
|
|
377
|
+
* wevu 默认值(仅用于 app.vue 注入)
|
|
378
|
+
*/
|
|
379
|
+
wevuDefaults?: WevuDefaults;
|
|
380
|
+
/**
|
|
381
|
+
* 编译期警告回调
|
|
382
|
+
*/
|
|
383
|
+
warn?: (message: string) => void;
|
|
384
|
+
/**
|
|
385
|
+
* class/style 运行时模式
|
|
386
|
+
*/
|
|
387
|
+
classStyleRuntime?: ClassStyleRuntime;
|
|
388
|
+
/**
|
|
389
|
+
* class/style 绑定元数据(JS 运行时)
|
|
390
|
+
*/
|
|
391
|
+
classStyleBindings?: ClassStyleBinding[];
|
|
392
|
+
/**
|
|
393
|
+
* template ref 元数据(用于运行时绑定)
|
|
394
|
+
*/
|
|
395
|
+
templateRefs?: TemplateRefBinding[];
|
|
396
|
+
/**
|
|
397
|
+
* 内联表达式元数据(用于事件处理)
|
|
398
|
+
*/
|
|
399
|
+
inlineExpressions?: InlineExpressionAsset[];
|
|
400
|
+
}
|
|
401
|
+
//#endregion
|
|
402
|
+
//#region src/plugins/vue/transform/transformScript/index.d.ts
|
|
403
|
+
declare function transformScript(source: string, options?: TransformScriptOptions): TransformResult;
|
|
404
|
+
//#endregion
|
|
405
|
+
//#region src/plugins/wevu/pageFeatures/types.d.ts
|
|
406
|
+
type WevuPageFeatureFlag = (typeof WE_VU_PAGE_HOOK_TO_FEATURE)[keyof typeof WE_VU_PAGE_HOOK_TO_FEATURE];
|
|
407
|
+
type WevuPageHookName = keyof typeof WE_VU_PAGE_HOOK_TO_FEATURE;
|
|
408
|
+
interface ModuleResolver {
|
|
409
|
+
resolveId: (source: string, importer: string) => Promise<string | undefined>;
|
|
410
|
+
loadCode: (id: string) => Promise<string | undefined>;
|
|
411
|
+
}
|
|
412
|
+
//#endregion
|
|
413
|
+
//#region src/plugins/wevu/pageFeatures/flags.d.ts
|
|
414
|
+
declare function collectWevuPageFeatureFlags(ast: t.File): Set<WevuPageFeatureFlag>;
|
|
415
|
+
declare function injectWevuPageFeatureFlagsIntoOptionsObject(optionsObject: t.ObjectExpression, enabled: Set<WevuPageFeatureFlag>): boolean;
|
|
416
|
+
//#endregion
|
|
417
|
+
//#region src/plugins/wevu/pageFeatures/inject.d.ts
|
|
418
|
+
declare function injectWevuPageFeaturesInJs(source: string): {
|
|
419
|
+
code: string;
|
|
420
|
+
transformed: boolean;
|
|
421
|
+
};
|
|
422
|
+
declare function injectWevuPageFeaturesInJsWithResolver(source: string, options: {
|
|
423
|
+
id: string;
|
|
424
|
+
resolver: ModuleResolver;
|
|
425
|
+
}): Promise<{
|
|
426
|
+
code: string;
|
|
427
|
+
transformed: boolean;
|
|
428
|
+
}>;
|
|
429
|
+
//#endregion
|
|
430
|
+
//#region src/plugins/wevu/pageFeatures/matcher.d.ts
|
|
431
|
+
interface PageEntryMatcherSource {
|
|
432
|
+
srcRoot: string;
|
|
433
|
+
loadEntries: () => Promise<{
|
|
434
|
+
pages?: string[];
|
|
435
|
+
subPackages?: Array<{
|
|
436
|
+
root?: string;
|
|
437
|
+
pages?: string[];
|
|
438
|
+
}>;
|
|
439
|
+
pluginPages?: string[];
|
|
440
|
+
}>;
|
|
441
|
+
warn?: (message: string) => void;
|
|
442
|
+
}
|
|
443
|
+
declare function createPageEntryMatcher(source: PageEntryMatcherSource): {
|
|
444
|
+
markDirty(): void;
|
|
445
|
+
isPageFile(filePath: string): Promise<boolean>;
|
|
446
|
+
};
|
|
447
|
+
//#endregion
|
|
448
|
+
//#region src/utils/vueTemplateTags.d.ts
|
|
449
|
+
declare const RESERVED_VUE_COMPONENT_TAGS: Set<string>;
|
|
450
|
+
declare const VUE_COMPONENT_TAG_RE: RegExp;
|
|
451
|
+
declare function isAutoImportCandidateTag(tag: string): boolean;
|
|
452
|
+
interface CollectVueTemplateTagsOptions {
|
|
453
|
+
filename?: string;
|
|
454
|
+
warnLabel?: string;
|
|
455
|
+
warn?: (message: string) => void;
|
|
456
|
+
shouldCollect: (tag: string) => boolean;
|
|
457
|
+
}
|
|
458
|
+
declare function collectVueTemplateTags(template: string, options: CollectVueTemplateTagsOptions): Set<string>;
|
|
459
|
+
//#endregion
|
|
460
|
+
export { type AutoImportTagsOptions, type AutoUsingComponentsOptions, CLASS_STYLE_WXS_FILE, CLASS_STYLE_WXS_MODULE, type ClassStyleBinding, type ClassStyleRuntime, type CollectVueTemplateTagsOptions, type CompileVueFileOptions, type ForParseResult, type InlineExpressionAsset, type JsLikeLang, type JsonConfig, type JsonMergeContext, type JsonMergeStage, type JsonMergeStrategy, type MiniProgramPlatform, type ModuleResolver, type MpPlatform, RESERVED_VUE_COMPONENT_TAGS, type ReadAndParseSfcOptions, type ResolveSfcBlockSrcOptions, type ScopedSlotComponentAsset, type StyleCompileOptions, type StyleCompileResult, type TemplateCompileOptions, type TemplateCompileResult, type TemplateRefBinding, type TransformResult, type TransformScriptOptions, VUE_COMPONENT_TAG_RE, type VueTransformResult, WE_VU_MODULE_ID, WE_VU_PAGE_HOOK_TO_FEATURE, WE_VU_RUNTIME_APIS, type WevuDefaults, type WevuPageFeatureFlag, type WevuPageHookName, WevuRuntimeApiName, alipayPlatform, buildClassStyleComputedCode, buildClassStyleWxsTag, builtinComponentsSet, clearFileCaches, collectVueTemplateTags, collectWevuPageFeatureFlags, compileConfigBlocks, compileVueFile as compileSfc, compileVueFile, compileVueStyleToWxss as compileStyle, compileVueStyleToWxss, compileVueTemplateToWxml as compileTemplate, compileVueTemplateToWxml, createJsonMerger, createPageEntryMatcher, evaluateJsLikeConfig, extractJsonMacroFromScriptSetup, generateScopedId, getClassStyleWxsSource, getMiniProgramTemplatePlatform, getSfcCheckMtime, injectWevuPageFeatureFlagsIntoOptionsObject, injectWevuPageFeaturesInJs, injectWevuPageFeaturesInJsWithResolver, invalidateFileCache, isAutoImportCandidateTag, isBuiltinComponent, isInvalidate, isJsonLikeLang, loadCache, mergeJsonWithStrategy, mtimeCache, normalizeConfigLang, pathExists, preprocessScriptSetupSrc, preprocessScriptSrc, readAndParseSfc, readFile, resolveClassStyleWxsLocation, resolveJsLikeLang, resolveSfcBlockSrc, restoreScriptSetupSrc, restoreScriptSrc, stripJsonMacroCallsFromCode, swanPlatform, transformScript, transformScript as transformSfcScript, ttPlatform, wechatPlatform };
|