@wevu/compiler 7.0.3 → 7.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.d.mts +336 -125
- package/dist/index.mjs +14 -13
- package/package.json +7 -6
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { WevuBindingUpdateMode, WevuBindingUpdateMode as WevuBindingUpdateMode$1, WevuRuntimeBindingManifestV1, WevuRuntimeBindingRecordV1 } from "@weapp-core/constants";
|
|
1
2
|
import { MpPlatform } from "@weapp-core/shared";
|
|
2
3
|
import * as t from "@weapp-vite/ast/babelTypes";
|
|
3
4
|
import { Expression } from "@weapp-vite/ast/babelTypes";
|
|
@@ -9,14 +10,114 @@ import "@weapp-vite/ast/babelTraverse";
|
|
|
9
10
|
/**
|
|
10
11
|
* 内置组件集合(来自自动生成的组件列表)。
|
|
11
12
|
*/
|
|
12
|
-
declare const builtinComponentsSet: Set<string>;
|
|
13
|
+
export declare const builtinComponentsSet: Set<string>;
|
|
13
14
|
/**
|
|
14
15
|
* 判断标签是否为内置组件。
|
|
15
16
|
*/
|
|
16
|
-
declare function isBuiltinComponent(tag: string): boolean;
|
|
17
|
+
export declare function isBuiltinComponent(tag: string): boolean;
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/types/diagnostics.d.ts
|
|
20
|
+
type CompilerDiagnosticCode = 'WV1002' | 'WV1003' | 'WV2002' | 'WV2001' | 'WV1001';
|
|
21
|
+
type CompilerDiagnosticSeverity = 'error' | 'warning';
|
|
22
|
+
type CompilerDiagnosticSource = 'expression' | 'jsx' | 'script' | 'sfc' | 'style' | 'template';
|
|
23
|
+
/**
|
|
24
|
+
* 编译源码中的位置。行号和列号均从 1 开始,偏移量从 0 开始。
|
|
25
|
+
*/
|
|
26
|
+
interface SourcePosition {
|
|
27
|
+
offset: number;
|
|
28
|
+
line: number;
|
|
29
|
+
column: number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* 编译源码中的半开区间,结束位置不包含在范围内。
|
|
33
|
+
*/
|
|
34
|
+
interface SourceSpan {
|
|
35
|
+
start: SourcePosition;
|
|
36
|
+
end: SourcePosition;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* 可供构建工具和编辑器稳定消费的编译诊断。
|
|
40
|
+
*/
|
|
41
|
+
interface CompilerDiagnostic {
|
|
42
|
+
code: CompilerDiagnosticCode;
|
|
43
|
+
severity: CompilerDiagnosticSeverity;
|
|
44
|
+
message: string;
|
|
45
|
+
filename: string;
|
|
46
|
+
source: CompilerDiagnosticSource;
|
|
47
|
+
loc?: SourceSpan;
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region src/types/bindingManifest.d.ts
|
|
51
|
+
/**
|
|
52
|
+
* 模板绑定的语义类型。
|
|
53
|
+
*/
|
|
54
|
+
type WevuBindingKind = 'text' | 'attribute' | 'class' | 'style' | 'if' | 'for' | 'component-prop';
|
|
55
|
+
/**
|
|
56
|
+
* 单个源码依赖及其独立更新策略。
|
|
57
|
+
*/
|
|
58
|
+
interface WevuBindingDependencyV1 {
|
|
59
|
+
root: string;
|
|
60
|
+
path?: string;
|
|
61
|
+
updateMode: WevuBindingUpdateMode$1;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* 模板绑定所在的词法作用域。
|
|
65
|
+
*/
|
|
66
|
+
interface WevuBindingScopeV1 {
|
|
67
|
+
kind: 'root' | 'for' | 'slot-owner' | 'slot-props';
|
|
68
|
+
depth: number;
|
|
69
|
+
locals?: string[];
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* 单个模板输出与其源码依赖之间的稳定映射。
|
|
73
|
+
*/
|
|
74
|
+
interface WevuBindingRecordV1 {
|
|
75
|
+
id: string;
|
|
76
|
+
kind: WevuBindingKind;
|
|
77
|
+
outputPath: string;
|
|
78
|
+
/** 仅在绑定源码归属不同于清单默认文件时记录。 */
|
|
79
|
+
sourceFile?: string;
|
|
80
|
+
sourceRoots: string[];
|
|
81
|
+
sourcePaths?: string[];
|
|
82
|
+
dependencies: WevuBindingDependencyV1[];
|
|
83
|
+
scopes: WevuBindingScopeV1[];
|
|
84
|
+
updateMode: WevuBindingUpdateMode$1;
|
|
85
|
+
sourceLocation?: SourceSpan;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* 当前模板使用的按需编译能力。
|
|
89
|
+
*/
|
|
90
|
+
interface WevuBindingManifestFeaturesV1 {
|
|
91
|
+
inlineEvents?: true;
|
|
92
|
+
templateRefs?: true;
|
|
93
|
+
scopedSlots?: true;
|
|
94
|
+
model?: true;
|
|
95
|
+
layout?: true;
|
|
96
|
+
functionProps?: true;
|
|
97
|
+
jsxIslands?: true;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* 由编译器拥有的第一版完整模板绑定 IR。
|
|
101
|
+
*/
|
|
102
|
+
interface WevuBindingManifestV1 {
|
|
103
|
+
version: 1;
|
|
104
|
+
sourceFile: string;
|
|
105
|
+
bindings: WevuBindingRecordV1[];
|
|
106
|
+
features: WevuBindingManifestFeaturesV1;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* 注入运行时的 Binding Manifest 精简级别。
|
|
110
|
+
*/
|
|
111
|
+
type WevuRuntimeBindingManifestMode = 'compact' | 'diagnostic';
|
|
112
|
+
//#endregion
|
|
113
|
+
//#region src/bindingManifest.d.ts
|
|
114
|
+
/**
|
|
115
|
+
* 将编译期完整 IR 投影为运行时更新和诊断所需的最小元数据。
|
|
116
|
+
*/
|
|
117
|
+
export declare function createRuntimeBindingManifest(manifest: WevuBindingManifestV1, mode?: WevuRuntimeBindingManifestMode): WevuRuntimeBindingManifestV1;
|
|
17
118
|
//#endregion
|
|
18
119
|
//#region src/constants.d.ts
|
|
19
|
-
declare const WE_VU_PAGE_HOOK_TO_FEATURE: {
|
|
120
|
+
export declare const WE_VU_PAGE_HOOK_TO_FEATURE: {
|
|
20
121
|
readonly onPageScroll: "enableOnPageScroll";
|
|
21
122
|
readonly onPullDownRefresh: "enableOnPullDownRefresh";
|
|
22
123
|
readonly onReachBottom: "enableOnReachBottom";
|
|
@@ -31,43 +132,43 @@ declare const WE_VU_PAGE_HOOK_TO_FEATURE: {
|
|
|
31
132
|
/**
|
|
32
133
|
* wevu 运行时模块 ID。
|
|
33
134
|
*/
|
|
34
|
-
declare const WE_VU_MODULE_ID: "wevu";
|
|
135
|
+
export declare const WE_VU_MODULE_ID: "wevu";
|
|
35
136
|
/**
|
|
36
137
|
* wevu 编译产物内部运行时模块 ID。
|
|
37
138
|
*/
|
|
38
|
-
declare const WE_VU_INTERNAL_RUNTIME_MODULE_ID: "wevu/internal-runtime";
|
|
139
|
+
export declare const WE_VU_INTERNAL_RUNTIME_MODULE_ID: "wevu/internal-runtime";
|
|
39
140
|
/**
|
|
40
141
|
* wevu 编译产物内部响应式模块 ID。
|
|
41
142
|
*/
|
|
42
|
-
declare const WE_VU_INTERNAL_REACTIVITY_MODULE_ID: "wevu/internal-reactivity";
|
|
143
|
+
export declare const WE_VU_INTERNAL_REACTIVITY_MODULE_ID: "wevu/internal-reactivity";
|
|
43
144
|
/**
|
|
44
145
|
* wevu 编译产物内部模板工具模块 ID。
|
|
45
146
|
*/
|
|
46
|
-
declare const WE_VU_INTERNAL_TEMPLATE_MODULE_ID: "wevu/internal-template";
|
|
147
|
+
export declare const WE_VU_INTERNAL_TEMPLATE_MODULE_ID: "wevu/internal-template";
|
|
47
148
|
/**
|
|
48
149
|
* wevu 编译产物使用的稳定运行时虚拟模块 ID。
|
|
49
150
|
*/
|
|
50
|
-
declare const WE_VU_COMPILER_RUNTIME_MODULE_ID = "virtual:weapp-vite/runtime";
|
|
151
|
+
export declare const WE_VU_COMPILER_RUNTIME_MODULE_ID = "virtual:weapp-vite/runtime";
|
|
51
152
|
/**
|
|
52
153
|
* wevu 编译产物使用的稳定响应式虚拟模块 ID。
|
|
53
154
|
*/
|
|
54
|
-
declare const WE_VU_COMPILER_REACTIVITY_MODULE_ID = "virtual:weapp-vite/runtime/reactivity";
|
|
155
|
+
export declare const WE_VU_COMPILER_REACTIVITY_MODULE_ID = "virtual:weapp-vite/runtime/reactivity";
|
|
55
156
|
/**
|
|
56
157
|
* wevu 编译产物使用的稳定模板工具虚拟模块 ID。
|
|
57
158
|
*/
|
|
58
|
-
declare const WE_VU_COMPILER_TEMPLATE_MODULE_ID = "virtual:weapp-vite/runtime/template";
|
|
159
|
+
export declare const WE_VU_COMPILER_TEMPLATE_MODULE_ID = "virtual:weapp-vite/runtime/template";
|
|
59
160
|
/**
|
|
60
161
|
* wevu 运行时模块 ID 列表。
|
|
61
162
|
*/
|
|
62
|
-
declare const WE_VU_RUNTIME_MODULE_IDS: readonly ["wevu", "wevu/internal-runtime", "virtual:weapp-vite/runtime", "virtual:weapp-vite/runtime/reactivity", "virtual:weapp-vite/runtime/template"];
|
|
163
|
+
export declare const WE_VU_RUNTIME_MODULE_IDS: readonly ["wevu", "wevu/internal-runtime", "virtual:weapp-vite/runtime", "virtual:weapp-vite/runtime/reactivity", "virtual:weapp-vite/runtime/template"];
|
|
63
164
|
/**
|
|
64
165
|
* 判断模块 ID 是否为 wevu 运行时入口。
|
|
65
166
|
*/
|
|
66
|
-
declare function isWevuRuntimeModuleId(moduleId: string): boolean;
|
|
167
|
+
export declare function isWevuRuntimeModuleId(moduleId: string): boolean;
|
|
67
168
|
/**
|
|
68
169
|
* wevu 运行时 API 名称映射。
|
|
69
170
|
*/
|
|
70
|
-
declare const WE_VU_RUNTIME_APIS: {
|
|
171
|
+
export declare const WE_VU_RUNTIME_APIS: {
|
|
71
172
|
readonly createApp: "createApp";
|
|
72
173
|
readonly createWevuComponent: "createWevuComponent";
|
|
73
174
|
readonly createWevuScopedSlotComponent: "createWevuScopedSlotComponent";
|
|
@@ -78,49 +179,59 @@ declare const WE_VU_RUNTIME_APIS: {
|
|
|
78
179
|
/**
|
|
79
180
|
* wevu 运行时 API 名称类型。
|
|
80
181
|
*/
|
|
81
|
-
type WevuRuntimeApiName = (typeof WE_VU_RUNTIME_APIS)[keyof typeof WE_VU_RUNTIME_APIS];
|
|
182
|
+
export type WevuRuntimeApiName = (typeof WE_VU_RUNTIME_APIS)[keyof typeof WE_VU_RUNTIME_APIS];
|
|
82
183
|
/**
|
|
83
184
|
* wevu 内部响应式 API 名称。
|
|
84
185
|
*/
|
|
85
|
-
declare const WE_VU_INTERNAL_REACTIVITY_APIS: readonly ["addMutationRecorder", "batch", "computed", "customRef", "effect", "effectScope", "endBatch", "getCurrentScope", "getDeepWatchStrategy", "getReactiveVersion", "isProxy", "isRaw", "isReactive", "isReadonly", "isRef", "isShallowReactive", "isShallowRef", "markRaw", "nextTick", "onScopeDispose", "prelinkReactiveTree", "reactive", "readonly", "ref", "removeMutationRecorder", "setDeepWatchStrategy", "shallowReactive", "shallowReadonly", "shallowRef", "startBatch", "stop", "toRaw", "toRef", "toRefs", "toValue", "touchReactive", "traverse", "triggerRef", "unref", "watch", "watchEffect", "watchPostEffect", "watchSyncEffect"];
|
|
186
|
+
export declare const WE_VU_INTERNAL_REACTIVITY_APIS: readonly ["addMutationRecorder", "batch", "computed", "customRef", "effect", "effectScope", "endBatch", "getCurrentScope", "getDeepWatchStrategy", "getReactiveVersion", "isProxy", "isRaw", "isReactive", "isReadonly", "isRef", "isShallowReactive", "isShallowRef", "markRaw", "nextTick", "onScopeDispose", "prelinkReactiveTree", "reactive", "readonly", "ref", "removeMutationRecorder", "setDeepWatchStrategy", "shallowReactive", "shallowReadonly", "shallowRef", "startBatch", "stop", "toRaw", "toRef", "toRefs", "toValue", "touchReactive", "traverse", "triggerRef", "unref", "useAsyncDerivation", "watch", "watchEffect", "watchPostEffect", "watchSyncEffect"];
|
|
86
187
|
/**
|
|
87
188
|
* wevu 内部模板工具 API 名称。
|
|
88
189
|
*/
|
|
89
|
-
declare const WE_VU_INTERNAL_TEMPLATE_APIS: readonly ["normalizeClass", "normalizeStyle", "resolvePropValue"];
|
|
190
|
+
export declare const WE_VU_INTERNAL_TEMPLATE_APIS: readonly ["normalizeClass", "normalizeStyle", "resolvePropValue"];
|
|
90
191
|
/**
|
|
91
192
|
* 根据 wevu API 名称解析编译产物内部导入入口。
|
|
92
193
|
*/
|
|
93
|
-
declare function resolveWevuInternalImportModuleId(apiName: string): "virtual:weapp-vite/runtime" | "virtual:weapp-vite/runtime/reactivity" | "virtual:weapp-vite/runtime/template";
|
|
194
|
+
export declare function resolveWevuInternalImportModuleId(apiName: string): "virtual:weapp-vite/runtime" | "virtual:weapp-vite/runtime/reactivity" | "virtual:weapp-vite/runtime/template";
|
|
94
195
|
//#endregion
|
|
95
|
-
//#region src/
|
|
96
|
-
type CompilerDiagnosticCode = 'WV1002' | 'WV1003' | 'WV2002' | 'WV2001' | 'WV1001';
|
|
97
|
-
type CompilerDiagnosticSeverity = 'error' | 'warning';
|
|
98
|
-
type CompilerDiagnosticSource = 'expression' | 'jsx' | 'script' | 'sfc' | 'style' | 'template';
|
|
196
|
+
//#region src/runtimeCapabilities.d.ts
|
|
99
197
|
/**
|
|
100
|
-
*
|
|
198
|
+
* wevu 编译器内部使用的运行时能力规范顺序。
|
|
199
|
+
*
|
|
200
|
+
* @internal
|
|
101
201
|
*/
|
|
102
|
-
|
|
103
|
-
offset: number;
|
|
104
|
-
line: number;
|
|
105
|
-
column: number;
|
|
106
|
-
}
|
|
202
|
+
declare const WE_VU_RUNTIME_CAPABILITY_ORDER: readonly ["patchStrategy", "templateRefs", "inlineEvents", "setDataHighFrequencyWarning", "scopedSlots", "layout"];
|
|
107
203
|
/**
|
|
108
|
-
*
|
|
204
|
+
* wevu 编译器内部使用的运行时能力名称。
|
|
205
|
+
*
|
|
206
|
+
* @internal
|
|
109
207
|
*/
|
|
110
|
-
|
|
111
|
-
start: SourcePosition;
|
|
112
|
-
end: SourcePosition;
|
|
113
|
-
}
|
|
208
|
+
type WevuRuntimeCapabilityName = (typeof WE_VU_RUNTIME_CAPABILITY_ORDER)[number];
|
|
114
209
|
/**
|
|
115
|
-
*
|
|
210
|
+
* compiler 各阶段与 bundler 之间传递的内部运行时能力元数据。
|
|
211
|
+
*
|
|
212
|
+
* @internal
|
|
116
213
|
*/
|
|
117
|
-
interface
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
214
|
+
interface WevuRuntimeCapabilityMetadata {
|
|
215
|
+
required: WevuRuntimeCapabilityName[];
|
|
216
|
+
conservative?: WevuRuntimeCapabilityName[];
|
|
217
|
+
}
|
|
218
|
+
//#endregion
|
|
219
|
+
//#region src/types/componentStyleOptions.d.ts
|
|
220
|
+
/** 编译期可证明的静态原语;显式 undefined 与属性缺失分别保留。 */
|
|
221
|
+
type ComponentStylePrimitive = string | boolean | number | null | undefined;
|
|
222
|
+
/** 小程序组件样式选项的静态解析状态。 */
|
|
223
|
+
type StaticComponentStyleOption = {
|
|
224
|
+
kind: 'absent';
|
|
225
|
+
} | {
|
|
226
|
+
kind: 'unknown';
|
|
227
|
+
} | {
|
|
228
|
+
kind: 'known';
|
|
229
|
+
value: ComponentStylePrimitive;
|
|
230
|
+
};
|
|
231
|
+
/** Component 注册 options 的静态样式信息;定义过滤器等可能修改宿主配置时不产出此元数据。 */
|
|
232
|
+
interface ComponentStyleOptions {
|
|
233
|
+
styleIsolation: StaticComponentStyleOption;
|
|
234
|
+
addGlobalClass: StaticComponentStyleOption;
|
|
124
235
|
}
|
|
125
236
|
//#endregion
|
|
126
237
|
//#region src/types/json.d.ts
|
|
@@ -166,6 +277,40 @@ interface JsonConfig {
|
|
|
166
277
|
mergeStrategy?: JsonMergeStrategy;
|
|
167
278
|
}
|
|
168
279
|
//#endregion
|
|
280
|
+
//#region src/types/pageLayout.d.ts
|
|
281
|
+
/**
|
|
282
|
+
* 页面布局属性可序列化值。
|
|
283
|
+
*/
|
|
284
|
+
type CompilerLayoutPropValue = string | number | boolean | null | {
|
|
285
|
+
kind: 'expression';
|
|
286
|
+
expression: string;
|
|
287
|
+
};
|
|
288
|
+
/**
|
|
289
|
+
* 编译阶段需要的单个页面布局描述。
|
|
290
|
+
*/
|
|
291
|
+
interface CompilerPageLayout {
|
|
292
|
+
importPath: string;
|
|
293
|
+
layoutName: string;
|
|
294
|
+
tagName: string;
|
|
295
|
+
props?: Record<string, CompilerLayoutPropValue>;
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* 构建工具解析后传给编译器的页面布局计划。
|
|
299
|
+
*/
|
|
300
|
+
interface CompilerPageLayoutPlan {
|
|
301
|
+
currentLayout?: CompilerPageLayout;
|
|
302
|
+
dynamicSwitch: boolean;
|
|
303
|
+
layouts: CompilerPageLayout[];
|
|
304
|
+
dynamicPropKeys: string[];
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* 构建工具解析后传给编译器的应用外壳描述。
|
|
308
|
+
*/
|
|
309
|
+
interface CompilerAppShell {
|
|
310
|
+
importPath: string;
|
|
311
|
+
tagName: string;
|
|
312
|
+
}
|
|
313
|
+
//#endregion
|
|
169
314
|
//#region src/types/wevu.d.ts
|
|
170
315
|
/**
|
|
171
316
|
* wevu JSON 默认值配置(app/component)。
|
|
@@ -200,7 +345,7 @@ interface ResolveSfcBlockSrcOptions {
|
|
|
200
345
|
/**
|
|
201
346
|
* 解析 SFC 中带 `src` 的 block,并返回依赖列表。
|
|
202
347
|
*/
|
|
203
|
-
declare function resolveSfcBlockSrc(descriptor: SFCDescriptor, filename: string, options?: ResolveSfcBlockSrcOptions): Promise<{
|
|
348
|
+
export declare function resolveSfcBlockSrc(descriptor: SFCDescriptor, filename: string, options?: ResolveSfcBlockSrcOptions): Promise<{
|
|
204
349
|
descriptor: SFCDescriptor;
|
|
205
350
|
deps: string[];
|
|
206
351
|
templateResolvedId?: string;
|
|
@@ -235,23 +380,23 @@ interface ReadAndParseSfcOptions {
|
|
|
235
380
|
/**
|
|
236
381
|
* 预处理 `<script setup src>`,避免编译器丢失 src。
|
|
237
382
|
*/
|
|
238
|
-
declare function preprocessScriptSetupSrc(source: string): string;
|
|
383
|
+
export declare function preprocessScriptSetupSrc(source: string): string;
|
|
239
384
|
/**
|
|
240
385
|
* 预处理普通 `<script src>`,避免编译器丢失 src。
|
|
241
386
|
*/
|
|
242
|
-
declare function preprocessScriptSrc(source: string): string;
|
|
387
|
+
export declare function preprocessScriptSrc(source: string): string;
|
|
243
388
|
/**
|
|
244
389
|
* 将预处理的 `<script setup src>` 恢复为真实 src。
|
|
245
390
|
*/
|
|
246
|
-
declare function restoreScriptSetupSrc(descriptor: SFCDescriptor): void;
|
|
391
|
+
export declare function restoreScriptSetupSrc(descriptor: SFCDescriptor): void;
|
|
247
392
|
/**
|
|
248
393
|
* 将预处理的 `<script src>` 恢复为真实 src。
|
|
249
394
|
*/
|
|
250
|
-
declare function restoreScriptSrc(descriptor: SFCDescriptor): void;
|
|
395
|
+
export declare function restoreScriptSrc(descriptor: SFCDescriptor): void;
|
|
251
396
|
/**
|
|
252
397
|
* 读取并解析 SFC,支持缓存与 src 解析。
|
|
253
398
|
*/
|
|
254
|
-
declare function readAndParseSfc(filename: string, options?: ReadAndParseSfcOptions): Promise<{
|
|
399
|
+
export declare function readAndParseSfc(filename: string, options?: ReadAndParseSfcOptions): Promise<{
|
|
255
400
|
source: string;
|
|
256
401
|
descriptor: SFCDescriptor;
|
|
257
402
|
errors: SFCParseResult['errors'];
|
|
@@ -259,7 +404,7 @@ declare function readAndParseSfc(filename: string, options?: ReadAndParseSfcOpti
|
|
|
259
404
|
/**
|
|
260
405
|
* 获取 SFC 读取时是否检查 mtime 的策略。
|
|
261
406
|
*/
|
|
262
|
-
declare function getSfcCheckMtime(config?: {
|
|
407
|
+
export declare function getSfcCheckMtime(config?: {
|
|
263
408
|
isDev?: boolean;
|
|
264
409
|
}): boolean;
|
|
265
410
|
//#endregion
|
|
@@ -286,6 +431,7 @@ interface MiniProgramPlatform {
|
|
|
286
431
|
keyThisValue: string;
|
|
287
432
|
keyAttr: (value: string) => string;
|
|
288
433
|
mapEventName: (eventName: string) => string;
|
|
434
|
+
eventBindingAlias?: (eventName: string, tagName?: string) => string | undefined;
|
|
289
435
|
eventBindingAttr: (eventName: string) => string;
|
|
290
436
|
}
|
|
291
437
|
//#endregion
|
|
@@ -300,11 +446,16 @@ interface ScopedSlotComponentAsset {
|
|
|
300
446
|
hostComponentName?: string;
|
|
301
447
|
slotKey: string;
|
|
302
448
|
template: string;
|
|
449
|
+
script: string;
|
|
450
|
+
scriptMap?: EncodedSourceMapLike | null;
|
|
451
|
+
bindingManifest: WevuBindingManifestV1;
|
|
303
452
|
componentGenerics?: Record<string, true>;
|
|
304
|
-
classStyleBindings?: ClassStyleBinding[];
|
|
305
453
|
classStyleWxs?: boolean;
|
|
306
454
|
inlineExpressions?: InlineExpressionAsset[];
|
|
307
455
|
templateRefs?: TemplateRefBinding[];
|
|
456
|
+
layoutHosts?: LayoutHostBinding[];
|
|
457
|
+
/** @internal */
|
|
458
|
+
runtimeCapabilities?: WevuRuntimeCapabilityMetadata;
|
|
308
459
|
}
|
|
309
460
|
/**
|
|
310
461
|
* 内联表达式资源描述。
|
|
@@ -336,6 +487,7 @@ interface InlineExpressionAsset {
|
|
|
336
487
|
interface TemplateCompileResult {
|
|
337
488
|
code: string;
|
|
338
489
|
diagnostics: CompilerDiagnostic[];
|
|
490
|
+
bindingManifest: WevuBindingManifestV1;
|
|
339
491
|
scopedSlotComponents?: ScopedSlotComponentAsset[];
|
|
340
492
|
slotFallbackWrapperComponent?: SlotFallbackWrapperComponentAsset;
|
|
341
493
|
componentGenerics?: Record<string, true>;
|
|
@@ -345,7 +497,10 @@ interface TemplateCompileResult {
|
|
|
345
497
|
templateRefs?: TemplateRefBinding[];
|
|
346
498
|
layoutHosts?: LayoutHostBinding[];
|
|
347
499
|
inlineExpressions?: InlineExpressionAsset[];
|
|
500
|
+
/** @internal */
|
|
501
|
+
runtimeCapabilities?: WevuRuntimeCapabilityMetadata;
|
|
348
502
|
functionPropPaths?: string[];
|
|
503
|
+
hasSlotOutlet?: boolean;
|
|
349
504
|
}
|
|
350
505
|
/**
|
|
351
506
|
* v-for 解析结果。
|
|
@@ -354,6 +509,8 @@ interface ForParseResult {
|
|
|
354
509
|
listExp?: string;
|
|
355
510
|
rawListExp?: string;
|
|
356
511
|
listExpAst?: Expression;
|
|
512
|
+
/** 保留祖先循环原始项访问,供 key 投影计算遍历使用。 */
|
|
513
|
+
rawListExpAst?: Expression;
|
|
357
514
|
projectedListExp?: string;
|
|
358
515
|
projectedListExpAst?: Expression;
|
|
359
516
|
item?: string;
|
|
@@ -386,6 +543,7 @@ interface TemplateCompileOptions {
|
|
|
386
543
|
objectLiteralBindMode?: ObjectLiteralBindMode;
|
|
387
544
|
mustacheInterpolation?: MustacheInterpolationMode;
|
|
388
545
|
formatWxml?: boolean;
|
|
546
|
+
runtimeBindingManifest?: WevuRuntimeBindingManifestMode;
|
|
389
547
|
wxsExtension?: string;
|
|
390
548
|
classStyleWxsSrc?: string;
|
|
391
549
|
functionPropNames?: Iterable<FunctionPropNameMatcher>;
|
|
@@ -454,6 +612,16 @@ type ObjectLiteralBindMode = 'runtime' | 'inline';
|
|
|
454
612
|
* Mustache 输出风格。
|
|
455
613
|
*/
|
|
456
614
|
type MustacheInterpolationMode = 'compact' | 'spaced';
|
|
615
|
+
/**
|
|
616
|
+
* 运行时绑定的条件分支及其循环作用域。
|
|
617
|
+
*/
|
|
618
|
+
interface BindingCondition {
|
|
619
|
+
expAst: Expression;
|
|
620
|
+
/** 键投影遍历原始项时使用的条件。 */
|
|
621
|
+
rawExpAst?: Expression;
|
|
622
|
+
/** 条件必须在对应循环深度进入下一层列表之前求值。 */
|
|
623
|
+
forDepth: number;
|
|
624
|
+
}
|
|
457
625
|
/**
|
|
458
626
|
* class/style 绑定信息。
|
|
459
627
|
*/
|
|
@@ -464,6 +632,7 @@ interface ClassStyleBinding {
|
|
|
464
632
|
expAst?: Expression;
|
|
465
633
|
errorFallback?: string;
|
|
466
634
|
forStack: ForParseResult[];
|
|
635
|
+
conditions?: BindingCondition[];
|
|
467
636
|
}
|
|
468
637
|
/**
|
|
469
638
|
* template ref 绑定信息。
|
|
@@ -486,7 +655,7 @@ interface LayoutHostBinding {
|
|
|
486
655
|
}
|
|
487
656
|
//#endregion
|
|
488
657
|
//#region src/plugins/vue/compiler/template/platforms/alipay.d.ts
|
|
489
|
-
declare const alipayPlatform: MiniProgramPlatform;
|
|
658
|
+
export declare const alipayPlatform: MiniProgramPlatform;
|
|
490
659
|
//#endregion
|
|
491
660
|
//#region src/plugins/vue/compiler/template/platforms/default.d.ts
|
|
492
661
|
/**
|
|
@@ -495,47 +664,47 @@ declare const alipayPlatform: MiniProgramPlatform;
|
|
|
495
664
|
* 当前默认实现与微信模板语义保持一致,但应作为默认平台接入点使用,
|
|
496
665
|
* 以避免内部链路继续绑定具体宿主命名。
|
|
497
666
|
*/
|
|
498
|
-
declare const defaultMiniProgramPlatform: MiniProgramPlatform;
|
|
667
|
+
export declare const defaultMiniProgramPlatform: MiniProgramPlatform;
|
|
499
668
|
/**
|
|
500
669
|
* 默认模板平台对象的简写别名。
|
|
501
670
|
*/
|
|
502
|
-
declare const defaultPlatform: MiniProgramPlatform;
|
|
671
|
+
export declare const defaultPlatform: MiniProgramPlatform;
|
|
503
672
|
//#endregion
|
|
504
673
|
//#region src/plugins/vue/compiler/template/platforms/swan.d.ts
|
|
505
|
-
declare const swanPlatform: MiniProgramPlatform;
|
|
674
|
+
export declare const swanPlatform: MiniProgramPlatform;
|
|
506
675
|
//#endregion
|
|
507
676
|
//#region src/plugins/vue/compiler/template/platforms/tt.d.ts
|
|
508
|
-
declare const ttPlatform: MiniProgramPlatform;
|
|
677
|
+
export declare const ttPlatform: MiniProgramPlatform;
|
|
509
678
|
//#endregion
|
|
510
679
|
//#region src/plugins/vue/compiler/template/platforms/index.d.ts
|
|
511
680
|
/**
|
|
512
681
|
* 获取默认模板适配器。
|
|
513
682
|
*/
|
|
514
|
-
declare function getDefaultMiniProgramTemplatePlatform(): MiniProgramPlatform;
|
|
683
|
+
export declare function getDefaultMiniProgramTemplatePlatform(): MiniProgramPlatform;
|
|
515
684
|
/**
|
|
516
685
|
* 获取默认小程序平台适配器。
|
|
517
686
|
*/
|
|
518
|
-
declare const getDefaultMiniProgramPlatform: typeof getDefaultMiniProgramTemplatePlatform;
|
|
687
|
+
export declare const getDefaultMiniProgramPlatform: typeof getDefaultMiniProgramTemplatePlatform;
|
|
519
688
|
/**
|
|
520
689
|
* 默认模板平台对象别名,便于调用方避免继续依赖具体宿主命名。
|
|
521
690
|
*/
|
|
522
|
-
declare const defaultMiniProgramTemplatePlatform: MiniProgramPlatform;
|
|
691
|
+
export declare const defaultMiniProgramTemplatePlatform: MiniProgramPlatform;
|
|
523
692
|
/**
|
|
524
693
|
* 微信模板平台兼容别名。
|
|
525
694
|
*
|
|
526
695
|
* 新代码应优先使用 defaultMiniProgramPlatform/defaultPlatform。
|
|
527
696
|
*/
|
|
528
|
-
declare const wechatPlatform: MiniProgramPlatform;
|
|
697
|
+
export declare const wechatPlatform: MiniProgramPlatform;
|
|
529
698
|
/**
|
|
530
699
|
* 获取指定平台的模板适配器,默认回退到默认模板平台。
|
|
531
700
|
*/
|
|
532
|
-
declare function getMiniProgramTemplatePlatform(platform?: MpPlatform): MiniProgramPlatform;
|
|
701
|
+
export declare function getMiniProgramTemplatePlatform(platform?: MpPlatform): MiniProgramPlatform;
|
|
533
702
|
//#endregion
|
|
534
703
|
//#region src/plugins/vue/compiler/template.d.ts
|
|
535
704
|
/**
|
|
536
705
|
* 将 Vue 模板编译为 WXML。
|
|
537
706
|
*/
|
|
538
|
-
declare function compileVueTemplateToWxml(template: string, filename: string, options?: TemplateCompileOptions): TemplateCompileResult;
|
|
707
|
+
export declare function compileVueTemplateToWxml(template: string, filename: string, options?: TemplateCompileOptions): TemplateCompileResult;
|
|
539
708
|
//#endregion
|
|
540
709
|
//#region src/plugins/vue/transform/compileVueFile/types.d.ts
|
|
541
710
|
interface ResolvedUsingComponentInfo {
|
|
@@ -553,6 +722,7 @@ interface VueTransformResult {
|
|
|
553
722
|
template?: string;
|
|
554
723
|
style?: string;
|
|
555
724
|
config?: string;
|
|
725
|
+
bindingManifest?: WevuBindingManifestV1;
|
|
556
726
|
diagnostics?: CompilerDiagnostic[];
|
|
557
727
|
cssModules?: Record<string, Record<string, string>>;
|
|
558
728
|
scopedSlotComponents?: TemplateCompileResult['scopedSlotComponents'];
|
|
@@ -560,6 +730,10 @@ interface VueTransformResult {
|
|
|
560
730
|
componentGenerics?: TemplateCompileResult['componentGenerics'];
|
|
561
731
|
classStyleWxs?: boolean;
|
|
562
732
|
meta?: {
|
|
733
|
+
/** @internal */
|
|
734
|
+
componentStyleOptions?: ComponentStyleOptions;
|
|
735
|
+
/** @internal */
|
|
736
|
+
runtimeCapabilities?: WevuRuntimeCapabilityMetadata;
|
|
563
737
|
hasScriptSetup?: boolean;
|
|
564
738
|
hasSetupOption?: boolean;
|
|
565
739
|
jsonMacroHash?: string;
|
|
@@ -635,6 +809,26 @@ interface CompileVueFileOptions {
|
|
|
635
809
|
* 是否生成脚本 sourcemap。默认开启;构建工具可在未启用 sourcemap 时显式关闭以减少 codegen 成本。
|
|
636
810
|
*/
|
|
637
811
|
sourceMap?: boolean;
|
|
812
|
+
/**
|
|
813
|
+
* 是否根据绑定清单自动合并 setData.pick。
|
|
814
|
+
*/
|
|
815
|
+
autoSetDataPick?: boolean;
|
|
816
|
+
/**
|
|
817
|
+
* 绑定清单中记录的源码文件名;默认使用当前编译文件名。
|
|
818
|
+
*/
|
|
819
|
+
bindingManifestSourceFile?: string;
|
|
820
|
+
/**
|
|
821
|
+
* 注入组件脚本的 Binding Manifest 精简级别;默认仅保留运行时必要字段。
|
|
822
|
+
*/
|
|
823
|
+
runtimeBindingManifest?: WevuRuntimeBindingManifestMode;
|
|
824
|
+
/**
|
|
825
|
+
* 构建工具预先解析的可序列化页面布局计划。
|
|
826
|
+
*/
|
|
827
|
+
pageLayout?: CompilerPageLayoutPlan;
|
|
828
|
+
/**
|
|
829
|
+
* 页面布局外层的应用外壳。
|
|
830
|
+
*/
|
|
831
|
+
appShell?: CompilerAppShell;
|
|
638
832
|
warn?: (message: string) => void;
|
|
639
833
|
autoUsingComponents?: AutoUsingComponentsOptions;
|
|
640
834
|
autoImportTags?: AutoImportTagsOptions;
|
|
@@ -670,7 +864,7 @@ interface CompileVueFileOptions {
|
|
|
670
864
|
/**
|
|
671
865
|
* 编译 JSX/TSX 文件,输出 wevu 脚本与 WXML 模板。
|
|
672
866
|
*/
|
|
673
|
-
declare function compileJsxFile(source: string, filename: string, options?: CompileVueFileOptions): Promise<VueTransformResult>;
|
|
867
|
+
export declare function compileJsxFile(source: string, filename: string, options?: CompileVueFileOptions): Promise<VueTransformResult>;
|
|
674
868
|
//#endregion
|
|
675
869
|
//#region src/plugins/uniApp/index.d.ts
|
|
676
870
|
type UniAppCompatibilityTarget = 'h5' | 'mp-weixin';
|
|
@@ -682,60 +876,55 @@ interface TransformUniAppSourceOptions {
|
|
|
682
876
|
/**
|
|
683
877
|
* 按目标平台移除 uni-app 条件编译分支,并保留原始换行以稳定错误位置。
|
|
684
878
|
*/
|
|
685
|
-
declare function transformUniAppConditionalCode(source: string, options: TransformUniAppSourceOptions): {
|
|
879
|
+
export declare function transformUniAppConditionalCode(source: string, options: TransformUniAppSourceOptions): {
|
|
686
880
|
changed: boolean;
|
|
687
881
|
code: string;
|
|
688
882
|
};
|
|
689
883
|
/**
|
|
690
884
|
* 转换单个受控 uni-app 源文件;未命中语法时返回原文。
|
|
691
885
|
*/
|
|
692
|
-
declare function transformUniAppSource(source: string, options: TransformUniAppSourceOptions): {
|
|
886
|
+
export declare function transformUniAppSource(source: string, options: TransformUniAppSourceOptions): {
|
|
693
887
|
changed: boolean;
|
|
694
888
|
code: string;
|
|
695
889
|
};
|
|
696
890
|
/**
|
|
697
891
|
* 判断文件是否属于项目源码或显式允许的 npm 包。
|
|
698
892
|
*/
|
|
699
|
-
declare function isUniAppCompatibilityFile(filename: string, srcRoot: string, include: readonly string[]): boolean;
|
|
893
|
+
export declare function isUniAppCompatibilityFile(filename: string, srcRoot: string, include: readonly string[]): boolean;
|
|
700
894
|
//#endregion
|
|
701
895
|
//#region src/plugins/utils/cache.d.ts
|
|
702
|
-
|
|
896
|
+
interface FileSignature {
|
|
703
897
|
ctimeMs: number;
|
|
704
898
|
ino: number;
|
|
705
899
|
mtimeMs: number;
|
|
706
900
|
size: number;
|
|
707
|
-
}
|
|
708
|
-
declare const
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
*/
|
|
714
|
-
declare function isInvalidate(id: string): Promise<boolean>;
|
|
715
|
-
declare function readFile(id: string, options?: {
|
|
901
|
+
}
|
|
902
|
+
export declare const mtimeCache: Map<string, FileSignature>;
|
|
903
|
+
export declare const loadCache: LRUCache<string, string, unknown>;
|
|
904
|
+
/** 检查文件签名是否变化;签名观察不能单独证明缓存内容已更新。 */
|
|
905
|
+
export declare function isInvalidate(id: string): Promise<boolean>;
|
|
906
|
+
export declare function readFile(id: string, options?: {
|
|
716
907
|
checkMtime?: boolean;
|
|
717
908
|
encoding?: BufferEncoding;
|
|
718
909
|
}): Promise<string>;
|
|
719
910
|
/**
|
|
720
911
|
* 判断文件或路径是否存在,可选缓存。
|
|
721
912
|
*/
|
|
722
|
-
declare function pathExists(id: string, options?: {
|
|
913
|
+
export declare function pathExists(id: string, options?: {
|
|
723
914
|
ttlMs?: number;
|
|
724
915
|
}): Promise<boolean>;
|
|
725
916
|
/**
|
|
726
917
|
* 清理指定文件相关的缓存。
|
|
727
918
|
*/
|
|
728
|
-
declare function invalidateFileCache(id: string): void;
|
|
919
|
+
export declare function invalidateFileCache(id: string): void;
|
|
729
920
|
/**
|
|
730
921
|
* 清空所有文件缓存。
|
|
731
922
|
*/
|
|
732
|
-
declare function clearFileCaches(): void;
|
|
923
|
+
export declare function clearFileCaches(): void;
|
|
733
924
|
//#endregion
|
|
734
925
|
//#region src/plugins/vue/compiler/wxss.d.ts
|
|
735
|
-
/**
|
|
736
|
-
|
|
737
|
-
*/
|
|
738
|
-
declare function transformNestedWxssVars(source: string): string;
|
|
926
|
+
/** 保留兼容入口;WXSS 支持嵌套变量回退,不得丢弃依赖级联的内层变量。 */
|
|
927
|
+
export declare function transformNestedWxssVars(source: string): string;
|
|
739
928
|
//#endregion
|
|
740
929
|
//#region src/plugins/vue/compiler/style.d.ts
|
|
741
930
|
/**
|
|
@@ -764,32 +953,32 @@ interface StyleCompileOptions {
|
|
|
764
953
|
/**
|
|
765
954
|
* compiler-sfc 已在 scoped 插件中处理 deep 选择器,此函数保留为兼容入口。
|
|
766
955
|
*/
|
|
767
|
-
declare function transformVueDeepSelectors(source: string): string;
|
|
956
|
+
export declare function transformVueDeepSelectors(source: string): string;
|
|
768
957
|
/**
|
|
769
958
|
* 将 Vue SFC style 块编译为可交给 Vite CSS 管线的内容。
|
|
770
959
|
*/
|
|
771
|
-
declare function compileVueStyleToWxss(styleBlock: SFCStyleBlock, options: StyleCompileOptions): Promise<StyleCompileResult>;
|
|
960
|
+
export declare function compileVueStyleToWxss(styleBlock: SFCStyleBlock, options: StyleCompileOptions): Promise<StyleCompileResult>;
|
|
772
961
|
//#endregion
|
|
773
962
|
//#region src/plugins/vue/compiler/template/classStyleRuntime.d.ts
|
|
774
963
|
/**
|
|
775
964
|
* class/style WXS 模块名。
|
|
776
965
|
*/
|
|
777
|
-
declare const CLASS_STYLE_WXS_MODULE = "__weapp_vite";
|
|
966
|
+
export declare const CLASS_STYLE_WXS_MODULE = "__weapp_vite";
|
|
778
967
|
/**
|
|
779
968
|
* class/style WXS 文件名(不含扩展名)。
|
|
780
969
|
*/
|
|
781
|
-
declare const CLASS_STYLE_WXS_FILE = "__weapp_vite_class_style";
|
|
970
|
+
export declare const CLASS_STYLE_WXS_FILE = "__weapp_vite_class_style";
|
|
782
971
|
interface ClassStyleWxsSourceOptions {
|
|
783
972
|
extension?: string;
|
|
784
973
|
}
|
|
785
974
|
/**
|
|
786
975
|
* 构建 class/style WXS 引用标签。
|
|
787
976
|
*/
|
|
788
|
-
declare function buildClassStyleWxsTag(extension: string, src?: string): string;
|
|
977
|
+
export declare function buildClassStyleWxsTag(extension: string, src?: string): string;
|
|
789
978
|
/**
|
|
790
979
|
* 解析 class/style WXS 文件位置与引用路径。
|
|
791
980
|
*/
|
|
792
|
-
declare function resolveClassStyleWxsLocation(options: {
|
|
981
|
+
export declare function resolveClassStyleWxsLocation(options: {
|
|
793
982
|
relativeBase: string;
|
|
794
983
|
extension: string;
|
|
795
984
|
packageRoot?: string;
|
|
@@ -800,10 +989,10 @@ declare function resolveClassStyleWxsLocation(options: {
|
|
|
800
989
|
/**
|
|
801
990
|
* 获取内置 class/style WXS 运行时代码。
|
|
802
991
|
*/
|
|
803
|
-
declare function getClassStyleWxsSource(options?: ClassStyleWxsSourceOptions): string;
|
|
992
|
+
export declare function getClassStyleWxsSource(options?: ClassStyleWxsSourceOptions): string;
|
|
804
993
|
//#endregion
|
|
805
994
|
//#region src/plugins/vue/hmr/sfcSignature.d.ts
|
|
806
|
-
declare const VUE_SFC_BLOCK_TYPES: readonly ["script", "template", "style", "config"];
|
|
995
|
+
export declare const VUE_SFC_BLOCK_TYPES: readonly ["script", "template", "style", "config"];
|
|
807
996
|
type VueSfcBlockType = typeof VUE_SFC_BLOCK_TYPES[number];
|
|
808
997
|
type VueSfcBlockSignatures = Readonly<Record<VueSfcBlockType, string>>;
|
|
809
998
|
type VueSfcBlockChanges = VueSfcBlockType[];
|
|
@@ -817,13 +1006,13 @@ interface VueSfcHmrSignatures {
|
|
|
817
1006
|
readonly tailwindScriptContentSignature?: string;
|
|
818
1007
|
readonly tailwindTemplateContentSignature?: string;
|
|
819
1008
|
}
|
|
820
|
-
declare function resolveVueSfcHmrSignatures(source: string, filename: string): VueSfcHmrSignatures;
|
|
821
|
-
declare function classifyVueSfcBlockChanges(previous: VueSfcBlockSignatures, current: VueSfcBlockSignatures): VueSfcBlockChanges;
|
|
822
|
-
declare function resolveVueSfcNonJsonSignature(source: string, filename: string): string | undefined;
|
|
823
|
-
declare function resolveVueSfcScriptSignature(source: string, filename: string): string | undefined;
|
|
824
|
-
declare function resolveVueSfcStyleIndependentSignature(source: string, filename: string): string | undefined;
|
|
825
|
-
declare function resolveVueSfcTailwindContentSignature(source: string, filename: string): string | undefined;
|
|
826
|
-
declare function resolveVueSfcHasTemplate(source: string, filename: string): boolean | undefined;
|
|
1009
|
+
export declare function resolveVueSfcHmrSignatures(source: string, filename: string): VueSfcHmrSignatures;
|
|
1010
|
+
export declare function classifyVueSfcBlockChanges(previous: VueSfcBlockSignatures, current: VueSfcBlockSignatures): VueSfcBlockChanges;
|
|
1011
|
+
export declare function resolveVueSfcNonJsonSignature(source: string, filename: string): string | undefined;
|
|
1012
|
+
export declare function resolveVueSfcScriptSignature(source: string, filename: string): string | undefined;
|
|
1013
|
+
export declare function resolveVueSfcStyleIndependentSignature(source: string, filename: string): string | undefined;
|
|
1014
|
+
export declare function resolveVueSfcTailwindContentSignature(source: string, filename: string): string | undefined;
|
|
1015
|
+
export declare function resolveVueSfcHasTemplate(source: string, filename: string): boolean | undefined;
|
|
827
1016
|
//#endregion
|
|
828
1017
|
//#region src/plugins/vue/transform/classStyleComputed.d.ts
|
|
829
1018
|
interface ClassStyleHelperNames {
|
|
@@ -831,7 +1020,7 @@ interface ClassStyleHelperNames {
|
|
|
831
1020
|
normalizeStyleName: string;
|
|
832
1021
|
unrefName?: string;
|
|
833
1022
|
}
|
|
834
|
-
declare function buildClassStyleComputedCode(bindings: ClassStyleBinding[], helpers: ClassStyleHelperNames): string | null;
|
|
1023
|
+
export declare function buildClassStyleComputedCode(bindings: ClassStyleBinding[], helpers: ClassStyleHelperNames): string | null;
|
|
835
1024
|
//#endregion
|
|
836
1025
|
//#region src/plugins/vue/transform/compileVueFile/jsonOnly.d.ts
|
|
837
1026
|
/**
|
|
@@ -839,13 +1028,13 @@ declare function buildClassStyleComputedCode(bindings: ClassStyleBinding[], help
|
|
|
839
1028
|
*
|
|
840
1029
|
* @internal
|
|
841
1030
|
*/
|
|
842
|
-
declare function refreshVueFileJsonConfig(source: string, filename: string, cachedResult: VueTransformResult, options?: CompileVueFileOptions): Promise<VueTransformResult | undefined>;
|
|
1031
|
+
export declare function refreshVueFileJsonConfig(source: string, filename: string, cachedResult: VueTransformResult, options?: CompileVueFileOptions): Promise<VueTransformResult | undefined>;
|
|
843
1032
|
//#endregion
|
|
844
1033
|
//#region src/plugins/vue/transform/compileVueFile/index.d.ts
|
|
845
1034
|
/**
|
|
846
1035
|
* 编译 Vue 单文件组件,输出脚本、模板、样式与配置结果。
|
|
847
1036
|
*/
|
|
848
|
-
declare function compileVueFile(source: string, filename: string, options?: CompileVueFileOptions): Promise<VueTransformResult>;
|
|
1037
|
+
export declare function compileVueFile(source: string, filename: string, options?: CompileVueFileOptions): Promise<VueTransformResult>;
|
|
849
1038
|
//#endregion
|
|
850
1039
|
//#region src/plugins/vue/transform/config.d.ts
|
|
851
1040
|
/**
|
|
@@ -855,40 +1044,40 @@ type JsLikeLang = 'js' | 'ts';
|
|
|
855
1044
|
/**
|
|
856
1045
|
* 规范化配置块语言。
|
|
857
1046
|
*/
|
|
858
|
-
declare function normalizeConfigLang(lang?: string): string;
|
|
1047
|
+
export declare function normalizeConfigLang(lang?: string): string;
|
|
859
1048
|
/**
|
|
860
1049
|
* 判断是否为 JSON 类语言。
|
|
861
1050
|
*/
|
|
862
|
-
declare function isJsonLikeLang(lang: string): lang is "json" | "jsonc" | "json5";
|
|
1051
|
+
export declare function isJsonLikeLang(lang: string): lang is "json" | "jsonc" | "json5";
|
|
863
1052
|
/**
|
|
864
1053
|
* 将语言标识归一为 js/ts。
|
|
865
1054
|
*/
|
|
866
|
-
declare function resolveJsLikeLang(lang: string): JsLikeLang;
|
|
1055
|
+
export declare function resolveJsLikeLang(lang: string): JsLikeLang;
|
|
867
1056
|
/**
|
|
868
1057
|
* 执行 JS/TS 配置块并返回对象结果。
|
|
869
1058
|
*/
|
|
870
|
-
declare function evaluateJsLikeConfig(source: string, filename: string, lang: string): Promise<any>;
|
|
1059
|
+
export declare function evaluateJsLikeConfig(source: string, filename: string, lang: string): Promise<any>;
|
|
871
1060
|
/**
|
|
872
1061
|
* 编译 SFC 内的 <json> 配置块并返回 JSON 字符串。
|
|
873
1062
|
*/
|
|
874
|
-
declare function compileConfigBlocks(blocks: SFCBlock[], filename: string, options?: {
|
|
1063
|
+
export declare function compileConfigBlocks(blocks: SFCBlock[], filename: string, options?: {
|
|
875
1064
|
merge?: (target: Record<string, any>, source: Record<string, any>) => Record<string, any> | void;
|
|
876
1065
|
}): Promise<string | undefined>;
|
|
877
1066
|
//#endregion
|
|
878
1067
|
//#region src/plugins/vue/transform/jsonMacros/parse.d.ts
|
|
879
|
-
declare function mayContainJsonMacro(content: string): boolean;
|
|
1068
|
+
export declare function mayContainJsonMacro(content: string): boolean;
|
|
880
1069
|
//#endregion
|
|
881
1070
|
//#region src/plugins/vue/transform/jsonMacros/rewrite.d.ts
|
|
882
1071
|
/**
|
|
883
1072
|
* 从任意代码中剥离 JSON 宏调用。
|
|
884
1073
|
*/
|
|
885
|
-
declare function stripJsonMacroCallsFromCode(code: string, filename: string): string;
|
|
1074
|
+
export declare function stripJsonMacroCallsFromCode(code: string, filename: string): string;
|
|
886
1075
|
//#endregion
|
|
887
1076
|
//#region src/plugins/vue/transform/jsonMacros/index.d.ts
|
|
888
1077
|
/**
|
|
889
1078
|
* 从 `<script setup>` 中提取 JSON 宏配置并返回剥离后的代码。
|
|
890
1079
|
*/
|
|
891
|
-
declare function extractJsonMacroFromScriptSetup(content: string, filename: string, lang?: string, options?: {
|
|
1080
|
+
export declare function extractJsonMacroFromScriptSetup(content: string, filename: string, lang?: string, options?: {
|
|
892
1081
|
merge?: (target: Record<string, any>, source: Record<string, any>) => Record<string, any> | void;
|
|
893
1082
|
preambleContent?: string;
|
|
894
1083
|
}): Promise<{
|
|
@@ -902,17 +1091,17 @@ declare function extractJsonMacroFromScriptSetup(content: string, filename: stri
|
|
|
902
1091
|
/**
|
|
903
1092
|
* 按策略合并 JSON 配置对象。
|
|
904
1093
|
*/
|
|
905
|
-
declare function mergeJsonWithStrategy(target: Record<string, any>, source: Record<string, any>, strategy: JsonMergeStrategy | undefined, context: JsonMergeContext): Record<string, any>;
|
|
1094
|
+
export declare function mergeJsonWithStrategy(target: Record<string, any>, source: Record<string, any>, strategy: JsonMergeStrategy | undefined, context: JsonMergeContext): Record<string, any>;
|
|
906
1095
|
/**
|
|
907
1096
|
* 创建带上下文的 JSON 合并函数。
|
|
908
1097
|
*/
|
|
909
|
-
declare function createJsonMerger(strategy: JsonMergeStrategy | undefined, baseContext: Omit<JsonMergeContext, 'stage'>): (target: Record<string, any>, source: Record<string, any>, stage: JsonMergeContext["stage"]) => Record<string, any>;
|
|
1098
|
+
export declare function createJsonMerger(strategy: JsonMergeStrategy | undefined, baseContext: Omit<JsonMergeContext, 'stage'>): (target: Record<string, any>, source: Record<string, any>, stage: JsonMergeContext["stage"]) => Record<string, any>;
|
|
910
1099
|
//#endregion
|
|
911
1100
|
//#region src/plugins/vue/transform/scopedId.d.ts
|
|
912
1101
|
/**
|
|
913
1102
|
* 根据项目内相对路径生成跨机器稳定的 scoped ID。
|
|
914
1103
|
*/
|
|
915
|
-
declare function generateScopedId(filename: string): string;
|
|
1104
|
+
export declare function generateScopedId(filename: string): string;
|
|
916
1105
|
//#endregion
|
|
917
1106
|
//#region src/plugins/vue/transform/transformScript/utils.d.ts
|
|
918
1107
|
/**
|
|
@@ -923,6 +1112,10 @@ interface TransformResult {
|
|
|
923
1112
|
code: string;
|
|
924
1113
|
transformed: boolean;
|
|
925
1114
|
map?: EncodedSourceMapLike | null;
|
|
1115
|
+
/** @internal */
|
|
1116
|
+
runtimeCapabilities?: WevuRuntimeCapabilityMetadata;
|
|
1117
|
+
/** @internal */
|
|
1118
|
+
componentStyleOptions?: ComponentStyleOptions;
|
|
926
1119
|
}
|
|
927
1120
|
interface TransformScriptOptions {
|
|
928
1121
|
/**
|
|
@@ -985,6 +1178,24 @@ interface TransformScriptOptions {
|
|
|
985
1178
|
* 内联表达式元数据(用于事件处理)
|
|
986
1179
|
*/
|
|
987
1180
|
inlineExpressions?: InlineExpressionAsset[];
|
|
1181
|
+
/**
|
|
1182
|
+
* 模板遍历产生的版本化绑定清单。
|
|
1183
|
+
*/
|
|
1184
|
+
bindingManifest?: WevuBindingManifestV1;
|
|
1185
|
+
/**
|
|
1186
|
+
* 注入组件脚本的 Binding Manifest 精简级别。
|
|
1187
|
+
*/
|
|
1188
|
+
runtimeBindingManifest?: WevuRuntimeBindingManifestMode;
|
|
1189
|
+
/**
|
|
1190
|
+
* 是否根据绑定清单自动合并 setData.pick。
|
|
1191
|
+
*/
|
|
1192
|
+
autoSetDataPick?: boolean;
|
|
1193
|
+
/**
|
|
1194
|
+
* 当前页面的编译期布局计划。
|
|
1195
|
+
*/
|
|
1196
|
+
pageLayout?: CompilerPageLayoutPlan;
|
|
1197
|
+
/** @internal */
|
|
1198
|
+
runtimeCapabilities?: WevuRuntimeCapabilityMetadata;
|
|
988
1199
|
/**
|
|
989
1200
|
* 模板中作为组件 prop 传递的函数候选路径。
|
|
990
1201
|
*/
|
|
@@ -1016,17 +1227,17 @@ interface TransformScriptOptions {
|
|
|
1016
1227
|
/**
|
|
1017
1228
|
* 转换 Vue SFC 脚本:处理宏、导入、默认导出与 wevu 相关注入。
|
|
1018
1229
|
*/
|
|
1019
|
-
declare function transformScript(source: string, options?: TransformScriptOptions): TransformResult;
|
|
1230
|
+
export declare function transformScript(source: string, options?: TransformScriptOptions): TransformResult;
|
|
1020
1231
|
//#endregion
|
|
1021
1232
|
//#region src/plugins/wevu/pageFeatures/types.d.ts
|
|
1022
1233
|
/**
|
|
1023
1234
|
* wevu 页面特性标识(由钩子映射表推导)。
|
|
1024
1235
|
*/
|
|
1025
|
-
type WevuPageFeatureFlag = (typeof WE_VU_PAGE_HOOK_TO_FEATURE)[keyof typeof WE_VU_PAGE_HOOK_TO_FEATURE];
|
|
1236
|
+
export type WevuPageFeatureFlag = (typeof WE_VU_PAGE_HOOK_TO_FEATURE)[keyof typeof WE_VU_PAGE_HOOK_TO_FEATURE];
|
|
1026
1237
|
/**
|
|
1027
1238
|
* wevu 页面钩子名称。
|
|
1028
1239
|
*/
|
|
1029
|
-
type WevuPageHookName = keyof typeof WE_VU_PAGE_HOOK_TO_FEATURE;
|
|
1240
|
+
export type WevuPageHookName = keyof typeof WE_VU_PAGE_HOOK_TO_FEATURE;
|
|
1030
1241
|
/**
|
|
1031
1242
|
* 模块解析器,用于注入特性时按需解析模块与源码。
|
|
1032
1243
|
*/
|
|
@@ -1039,7 +1250,7 @@ interface ModuleResolver {
|
|
|
1039
1250
|
/**
|
|
1040
1251
|
* 从源码中收集 wevu 页面特性。
|
|
1041
1252
|
*/
|
|
1042
|
-
declare function collectWevuPageFeatureFlagsFromCode(code: string, options?: {
|
|
1253
|
+
export declare function collectWevuPageFeatureFlagsFromCode(code: string, options?: {
|
|
1043
1254
|
astEngine?: AstEngineName$1;
|
|
1044
1255
|
}): Set<WevuPageFeatureFlag>;
|
|
1045
1256
|
//#endregion
|
|
@@ -1091,7 +1302,7 @@ type OptionsObject = t.ObjectExpression | {
|
|
|
1091
1302
|
properties: any[];
|
|
1092
1303
|
[key: string]: any;
|
|
1093
1304
|
};
|
|
1094
|
-
declare function collectTargetOptionsObjectsFromCode(code: string, moduleId: string, options?: {
|
|
1305
|
+
export declare function collectTargetOptionsObjectsFromCode(code: string, moduleId: string, options?: {
|
|
1095
1306
|
astEngine?: AstEngineName$1;
|
|
1096
1307
|
}): {
|
|
1097
1308
|
optionsObjects: OptionsObject[];
|
|
@@ -1099,7 +1310,7 @@ declare function collectTargetOptionsObjectsFromCode(code: string, moduleId: str
|
|
|
1099
1310
|
};
|
|
1100
1311
|
//#endregion
|
|
1101
1312
|
//#region src/plugins/wevu/pageFeatures/reachability/index.d.ts
|
|
1102
|
-
declare function collectWevuFeaturesFromCodeReachableImports(code: string, options: {
|
|
1313
|
+
export declare function collectWevuFeaturesFromCodeReachableImports(code: string, options: {
|
|
1103
1314
|
id: string;
|
|
1104
1315
|
resolver: ModuleResolver;
|
|
1105
1316
|
astEngine?: AstEngineName$1;
|
|
@@ -1109,17 +1320,17 @@ declare function collectWevuFeaturesFromCodeReachableImports(code: string, optio
|
|
|
1109
1320
|
/**
|
|
1110
1321
|
* 扫描 AST,收集启用的 wevu 页面特性标识。
|
|
1111
1322
|
*/
|
|
1112
|
-
declare function collectWevuPageFeatureFlags(ast: t.File): Set<WevuPageFeatureFlag>;
|
|
1323
|
+
export declare function collectWevuPageFeatureFlags(ast: t.File): Set<WevuPageFeatureFlag>;
|
|
1113
1324
|
/**
|
|
1114
1325
|
* 将启用的页面特性注入到 options 对象中。
|
|
1115
1326
|
*/
|
|
1116
|
-
declare function injectWevuPageFeatureFlagsIntoOptionsObject(optionsObject: t.ObjectExpression, enabled: Set<WevuPageFeatureFlag>): boolean;
|
|
1327
|
+
export declare function injectWevuPageFeatureFlagsIntoOptionsObject(optionsObject: t.ObjectExpression, enabled: Set<WevuPageFeatureFlag>): boolean;
|
|
1117
1328
|
//#endregion
|
|
1118
1329
|
//#region src/plugins/wevu/pageFeatures/inject.d.ts
|
|
1119
1330
|
/**
|
|
1120
1331
|
* 在 JS 源码中注入 wevu 页面特性(基于本文件分析)。
|
|
1121
1332
|
*/
|
|
1122
|
-
declare function injectWevuPageFeaturesInJs(source: string, options?: {
|
|
1333
|
+
export declare function injectWevuPageFeaturesInJs(source: string, options?: {
|
|
1123
1334
|
astEngine?: AstEngineName$1;
|
|
1124
1335
|
minify?: boolean;
|
|
1125
1336
|
sourceMap?: boolean;
|
|
@@ -1131,7 +1342,7 @@ declare function injectWevuPageFeaturesInJs(source: string, options?: {
|
|
|
1131
1342
|
/**
|
|
1132
1343
|
* 在 JS 源码中注入 wevu 页面特性(支持跨模块解析)。
|
|
1133
1344
|
*/
|
|
1134
|
-
declare function injectWevuPageFeaturesInJsWithResolver(source: string, options: {
|
|
1345
|
+
export declare function injectWevuPageFeaturesInJsWithResolver(source: string, options: {
|
|
1135
1346
|
id: string;
|
|
1136
1347
|
resolver: ModuleResolver;
|
|
1137
1348
|
astEngine?: AstEngineName$1;
|
|
@@ -1162,18 +1373,18 @@ interface PageEntryMatcherSource {
|
|
|
1162
1373
|
/**
|
|
1163
1374
|
* 创建页面入口匹配器。
|
|
1164
1375
|
*/
|
|
1165
|
-
declare function createPageEntryMatcher(source: PageEntryMatcherSource): {
|
|
1376
|
+
export declare function createPageEntryMatcher(source: PageEntryMatcherSource): {
|
|
1166
1377
|
markDirty(): void;
|
|
1167
1378
|
isPageFile(filePath: string): Promise<boolean>;
|
|
1168
1379
|
};
|
|
1169
1380
|
//#endregion
|
|
1170
1381
|
//#region src/utils/vueTemplateTags.d.ts
|
|
1171
|
-
declare const RESERVED_VUE_COMPONENT_TAGS: Set<string>;
|
|
1172
|
-
declare const VUE_COMPONENT_TAG_RE: RegExp;
|
|
1382
|
+
export declare const RESERVED_VUE_COMPONENT_TAGS: Set<string>;
|
|
1383
|
+
export declare const VUE_COMPONENT_TAG_RE: RegExp;
|
|
1173
1384
|
/**
|
|
1174
1385
|
* 判断模板标签是否可能需要自动导入。
|
|
1175
1386
|
*/
|
|
1176
|
-
declare function isAutoImportCandidateTag(tag: string): boolean;
|
|
1387
|
+
export declare function isAutoImportCandidateTag(tag: string): boolean;
|
|
1177
1388
|
/**
|
|
1178
1389
|
* 模板标签收集配置。
|
|
1179
1390
|
*/
|
|
@@ -1186,6 +1397,6 @@ interface CollectVueTemplateTagsOptions {
|
|
|
1186
1397
|
/**
|
|
1187
1398
|
* 收集 Vue 模板中的自定义组件标签。
|
|
1188
1399
|
*/
|
|
1189
|
-
declare function collectVueTemplateTags(template: string, options: CollectVueTemplateTagsOptions): Set<string>;
|
|
1400
|
+
export declare function collectVueTemplateTags(template: string, options: CollectVueTemplateTagsOptions): Set<string>;
|
|
1190
1401
|
//#endregion
|
|
1191
|
-
export { type AstEngineName, type AutoImportTagsOptions, type AutoUsingComponentsOptions,
|
|
1402
|
+
export { type AstEngineName, type AutoImportTagsOptions, type AutoUsingComponentsOptions, type BindingCondition, type ClassStyleBinding, type ClassStyleRuntime, type CollectVueTemplateTagsOptions, type CompileVueFileOptions, type CompilerAppShell, type CompilerDiagnostic, type CompilerDiagnosticCode, type CompilerDiagnosticSeverity, type CompilerDiagnosticSource, type CompilerLayoutPropValue, type CompilerPageLayout, type CompilerPageLayoutPlan, type ComponentStyleOptions, type ComponentStylePrimitive, type ForParseResult, type InlineExpressionAsset, type JsLikeLang, type JsonConfig, type JsonMergeContext, type JsonMergeStage, type JsonMergeStrategy, type MiniProgramPlatform, type ModuleResolver, type MpPlatform, type ReadAndParseSfcOptions, type ResolveSfcBlockSrcOptions, type ResolvedUsingComponentInfo, type ResolvedUsingComponentPath, type ScopedSlotComponentAsset, type SlotFallbackWrapperComponentAsset, type SlotFallbackWrapperStrategy, type SourcePosition, type SourceSpan, type StaticComponentStyleOption, type StyleCompileOptions, type StyleCompileResult, type TemplateCompileOptions, type TemplateCompileResult, type TemplateRefBinding, type TransformResult, type TransformScriptOptions, type TransformUniAppSourceOptions, type UniAppCompatibilityTarget, type VueSfcBlockChanges, type VueSfcBlockSignatures, type VueSfcBlockType, type VueSfcHmrSignatures, type VueTransformResult, type WevuBindingDependencyV1, type WevuBindingKind, type WevuBindingManifestFeaturesV1, type WevuBindingManifestV1, type WevuBindingRecordV1, type WevuBindingScopeV1, type WevuBindingUpdateMode, type WevuDefaults, type WevuRuntimeBindingManifestMode, type WevuRuntimeBindingManifestV1, type WevuRuntimeBindingRecordV1, compileVueFile as compileSfc, compileVueStyleToWxss as compileStyle, compileVueTemplateToWxml as compileTemplate, transformScript as transformSfcScript };
|