@vureact/compiler-core 1.1.1 → 1.2.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.
@@ -24,95 +24,351 @@ function executePlugins(map, result, ctx) {
24
24
  }
25
25
 
26
26
  // src/core/codegen/component/jsx/syntax-processor/postprocess/build-ctx-provider.ts
27
- var _types = require('@babel/types'); var t10 = _interopRequireWildcard(_types); var t = _interopRequireWildcard(_types); var t9 = _interopRequireWildcard(_types); var t2 = _interopRequireWildcard(_types); var t4 = _interopRequireWildcard(_types); var t3 = _interopRequireWildcard(_types); var t5 = _interopRequireWildcard(_types); var t6 = _interopRequireWildcard(_types); var t8 = _interopRequireWildcard(_types); var t7 = _interopRequireWildcard(_types); var t13 = _interopRequireWildcard(_types); var t11 = _interopRequireWildcard(_types); var t12 = _interopRequireWildcard(_types); var t14 = _interopRequireWildcard(_types); var t15 = _interopRequireWildcard(_types); var t16 = _interopRequireWildcard(_types); var t17 = _interopRequireWildcard(_types); var t19 = _interopRequireWildcard(_types); var t18 = _interopRequireWildcard(_types); var t20 = _interopRequireWildcard(_types); var t21 = _interopRequireWildcard(_types); var t22 = _interopRequireWildcard(_types); var t23 = _interopRequireWildcard(_types); var t28 = _interopRequireWildcard(_types); var t25 = _interopRequireWildcard(_types); var t24 = _interopRequireWildcard(_types); var t26 = _interopRequireWildcard(_types); var t27 = _interopRequireWildcard(_types); var t29 = _interopRequireWildcard(_types); var t30 = _interopRequireWildcard(_types); var t31 = _interopRequireWildcard(_types); var t32 = _interopRequireWildcard(_types); var t33 = _interopRequireWildcard(_types); var t34 = _interopRequireWildcard(_types); var t35 = _interopRequireWildcard(_types); var t38 = _interopRequireWildcard(_types); var t36 = _interopRequireWildcard(_types); var t37 = _interopRequireWildcard(_types); var t39 = _interopRequireWildcard(_types);
27
+ var _types = require('@babel/types'); var t10 = _interopRequireWildcard(_types); var t = _interopRequireWildcard(_types); var t9 = _interopRequireWildcard(_types); var t2 = _interopRequireWildcard(_types); var t4 = _interopRequireWildcard(_types); var t3 = _interopRequireWildcard(_types); var t5 = _interopRequireWildcard(_types); var t6 = _interopRequireWildcard(_types); var t8 = _interopRequireWildcard(_types); var t7 = _interopRequireWildcard(_types); var t13 = _interopRequireWildcard(_types); var t11 = _interopRequireWildcard(_types); var t12 = _interopRequireWildcard(_types); var t14 = _interopRequireWildcard(_types); var t15 = _interopRequireWildcard(_types); var t16 = _interopRequireWildcard(_types); var t17 = _interopRequireWildcard(_types); var t19 = _interopRequireWildcard(_types); var t18 = _interopRequireWildcard(_types); var t20 = _interopRequireWildcard(_types); var t22 = _interopRequireWildcard(_types); var t21 = _interopRequireWildcard(_types); var t23 = _interopRequireWildcard(_types); var t24 = _interopRequireWildcard(_types); var t29 = _interopRequireWildcard(_types); var t26 = _interopRequireWildcard(_types); var t25 = _interopRequireWildcard(_types); var t27 = _interopRequireWildcard(_types); var t28 = _interopRequireWildcard(_types); var t31 = _interopRequireWildcard(_types); var t30 = _interopRequireWildcard(_types); var t32 = _interopRequireWildcard(_types); var t33 = _interopRequireWildcard(_types); var t34 = _interopRequireWildcard(_types); var t35 = _interopRequireWildcard(_types); var t36 = _interopRequireWildcard(_types); var t39 = _interopRequireWildcard(_types); var t37 = _interopRequireWildcard(_types); var t38 = _interopRequireWildcard(_types); var t40 = _interopRequireWildcard(_types);
28
28
 
29
- // src/consts/adapters-map.ts
30
- var ADAPTER_COMPS = {
31
- KeepAlive: "KeepAlive",
32
- Suspense: "Suspense",
33
- Teleport: "Teleport",
34
- Component: "Component",
35
- Provider: "Provider",
36
- // 实际是 Vue 的 provide 方法,为了命名统一采用 Provide
37
- Transition: "Transition",
38
- TransitionGroup: "TransitionGroup"
39
- };
40
- var ADAPTER_UTILS_MAP = {
41
- dir: "dir",
42
- dirCls: "dir.cls",
43
- dirKeyless: "dir.keyless",
44
- dirOn: "dir.on",
45
- dirStyle: "dir.style",
46
- nextTick: "nextTick"
29
+ // src/consts/other.ts
30
+ var PACKAGE_NAME = {
31
+ react: "react",
32
+ runtime: "@vureact/runtime-core",
33
+ router: "@vureact/router"
47
34
  };
48
- var ADAPTER_ROUTER_COMPS = {
49
- RouterLink: "RouterLink",
50
- RouterView: "RouterView"
35
+ var STYLE_MODULE_NAME = "$style";
36
+ var MACRO_API_NAMES = {
37
+ props: "defineProps",
38
+ emits: "defineEmits",
39
+ slots: "defineSlots",
40
+ options: "defineOptions",
41
+ expose: "defineExpose"
51
42
  };
52
- var ADAPTER_HOOKS = {
53
- renameOnly: {
54
- pure: {
55
- useActived: "useActived",
56
- useDeactivated: "useDeactivated",
57
- onBeforeMount: "useBeforeMount",
58
- onBeforeUnMount: "useBeforeUnMount",
59
- onMounted: "useMounted",
60
- onUnmounted: "useUnmounted"
43
+ var DOLLAR_IDENTIFIERS = [
44
+ "$data",
45
+ "$props",
46
+ "$el",
47
+ "$options",
48
+ "$parent",
49
+ "$root",
50
+ "$slots",
51
+ "$refs",
52
+ "$attrs",
53
+ "$emit",
54
+ "$watch",
55
+ "$forceUpdate",
56
+ "$nextTick",
57
+ "$router",
58
+ "$route",
59
+ "$store",
60
+ "$pinia",
61
+ "$event"
62
+ ];
63
+ var VUE_PACKAGES = [
64
+ "vue",
65
+ "vite",
66
+ "pinia",
67
+ "nuxt",
68
+ // 不需要带到 React 项目中
69
+ "@vureact/compiler-core"
70
+ ];
71
+
72
+ // src/consts/adapters-map.ts
73
+ var ADAPTER_RULES = {
74
+ // =============== [React] ===============
75
+ react: {
76
+ // =============== Hooks ===============
77
+ useTemplateRef: {
78
+ target: "useRef",
79
+ package: PACKAGE_NAME.react,
80
+ type: "none"
61
81
  },
62
- effectful: {
63
- ref: "useVRef",
64
- reactive: "useReactive",
65
- computed: "useComputed",
66
- readonly: "useReadonly",
67
- toRef: "useToVRef",
68
- toRefs: "useToVRefs",
69
- toRaw: "useToRaw",
70
- inject: "useInject",
71
- watch: "useWatch",
72
- shallowRef: "useShallowRef",
73
- shallowReactive: "useShallowReactive",
74
- shallowReadonly: "useShallowReadonly",
75
- isRef: "isRef",
76
- isProxy: "isProxy",
77
- isReactive: "isReactive"
82
+ defineExpose: {
83
+ target: "useImperativeHandle",
84
+ package: PACKAGE_NAME.react,
85
+ type: "none"
78
86
  }
79
87
  },
80
- transform: {
81
- pure: {
82
- useTemplateRef: "useRef",
83
- watchEffect: {
84
- watchEffect: "useWatchEffect",
85
- watchPostEffect: "useWatchPostEffect",
86
- watchSyncEffect: "useWatchSyncEffect"
87
- },
88
- lifecycle: {
89
- onBeforeUpdate: "useBeforeUpdate",
90
- onUpdated: "useUpdated"
91
- }
88
+ // ============== [VuReact Runtime Core] ===============
89
+ runtime: {
90
+ // =============== Components ===============
91
+ KeepAlive: {
92
+ target: "KeepAlive",
93
+ package: PACKAGE_NAME.runtime,
94
+ type: "rename"
92
95
  },
93
- effectful: {}
94
- }
95
- };
96
- var ADAPTER_ROUTER_APIS = {
97
- renameOnly: {
98
- pure: {
99
- createRouter: "createRouter",
100
- onBeforeRouteLeave: "useBeforeRouteLeave",
101
- onBeforeRouteUpdate: "useBeforeRouteUpdate",
102
- onBeforeRouteEnter: "useBeforeRouteEnter"
96
+ Suspense: {
97
+ target: "Suspense",
98
+ package: PACKAGE_NAME.runtime,
99
+ type: "rename"
100
+ },
101
+ Teleport: {
102
+ target: "Teleport",
103
+ package: PACKAGE_NAME.runtime,
104
+ type: "rename"
105
+ },
106
+ Component: {
107
+ target: "Component",
108
+ package: PACKAGE_NAME.runtime,
109
+ type: "rename"
110
+ },
111
+ provide: {
112
+ target: "Provider",
113
+ package: PACKAGE_NAME.runtime,
114
+ type: "rename"
115
+ },
116
+ Transition: {
117
+ target: "Transition",
118
+ package: PACKAGE_NAME.runtime,
119
+ type: "rename"
120
+ },
121
+ TransitionGroup: {
122
+ target: "TransitionGroup",
123
+ package: PACKAGE_NAME.runtime,
124
+ type: "rename"
125
+ },
126
+ // =============== Hooks ===============
127
+ useActived: {
128
+ target: "useActived",
129
+ package: PACKAGE_NAME.runtime,
130
+ type: "rename"
131
+ },
132
+ useDeactivated: {
133
+ target: "useDeactivated",
134
+ package: PACKAGE_NAME.runtime,
135
+ type: "rename"
136
+ },
137
+ onBeforeMount: {
138
+ target: "useBeforeMount",
139
+ package: PACKAGE_NAME.runtime,
140
+ type: "rename"
141
+ },
142
+ onBeforeUnMount: {
143
+ target: "useBeforeUnMount",
144
+ package: PACKAGE_NAME.runtime,
145
+ type: "rename"
146
+ },
147
+ onMounted: {
148
+ target: "useMounted",
149
+ package: PACKAGE_NAME.runtime,
150
+ type: "rename"
151
+ },
152
+ onUnmounted: {
153
+ target: "useUnmounted",
154
+ package: PACKAGE_NAME.runtime,
155
+ type: "rename"
156
+ },
157
+ onBeforeUpdate: {
158
+ target: "useBeforeUpdate",
159
+ package: PACKAGE_NAME.runtime,
160
+ type: "analyzed-deps"
161
+ },
162
+ onUpdated: {
163
+ target: "useUpdated",
164
+ package: PACKAGE_NAME.runtime,
165
+ type: "analyzed-deps"
166
+ },
167
+ ref: {
168
+ target: "useVRef",
169
+ package: PACKAGE_NAME.runtime,
170
+ type: "rename",
171
+ isTrackable: true
172
+ },
173
+ reactive: {
174
+ target: "useReactive",
175
+ package: PACKAGE_NAME.runtime,
176
+ type: "rename",
177
+ isTrackable: true
178
+ },
179
+ computed: {
180
+ target: "useComputed",
181
+ package: PACKAGE_NAME.runtime,
182
+ type: "rename",
183
+ isTrackable: true
184
+ },
185
+ readonly: {
186
+ target: "useReadonly",
187
+ package: PACKAGE_NAME.runtime,
188
+ type: "rename",
189
+ isTrackable: true
190
+ },
191
+ toRef: {
192
+ target: "useToVRef",
193
+ package: PACKAGE_NAME.runtime,
194
+ type: "rename",
195
+ isTrackable: true
196
+ },
197
+ toRefs: {
198
+ target: "useToVRefs",
199
+ package: PACKAGE_NAME.runtime,
200
+ type: "rename",
201
+ isTrackable: true
202
+ },
203
+ toRaw: {
204
+ target: "useToRaw",
205
+ package: PACKAGE_NAME.runtime,
206
+ type: "rename"
207
+ },
208
+ inject: {
209
+ target: "useInject",
210
+ package: PACKAGE_NAME.runtime,
211
+ type: "rename",
212
+ isTrackable: true
213
+ },
214
+ shallowRef: {
215
+ target: "useShallowRef",
216
+ package: PACKAGE_NAME.runtime,
217
+ type: "rename",
218
+ isTrackable: true
219
+ },
220
+ shallowReactive: {
221
+ target: "useShallowReactive",
222
+ package: PACKAGE_NAME.runtime,
223
+ type: "rename",
224
+ isTrackable: true
225
+ },
226
+ shallowReadonly: {
227
+ target: "useShallowReadonly",
228
+ package: PACKAGE_NAME.runtime,
229
+ type: "rename",
230
+ isTrackable: true
231
+ },
232
+ isRef: {
233
+ target: "isRef",
234
+ package: PACKAGE_NAME.runtime,
235
+ type: "rename",
236
+ isTrackable: true
237
+ },
238
+ isProxy: {
239
+ target: "isProxy",
240
+ package: PACKAGE_NAME.runtime,
241
+ type: "rename",
242
+ isTrackable: true
243
+ },
244
+ isReactive: {
245
+ target: "isReactive",
246
+ package: PACKAGE_NAME.runtime,
247
+ type: "rename",
248
+ isTrackable: true
249
+ },
250
+ watch: {
251
+ target: "useWatch",
252
+ package: PACKAGE_NAME.runtime,
253
+ type: "rename"
254
+ },
255
+ watchEffect: {
256
+ target: "useWatchEffect",
257
+ package: PACKAGE_NAME.runtime,
258
+ type: "analyzed-deps"
259
+ },
260
+ watchPostEffect: {
261
+ target: "useWatchPostEffect",
262
+ package: PACKAGE_NAME.runtime,
263
+ type: "analyzed-deps"
103
264
  },
104
- effectful: {
105
- useRoute: "useRoute",
106
- useRouter: "useRouter",
107
- useLink: "useLink"
265
+ watchSyncEffect: {
266
+ target: "useWatchSyncEffect",
267
+ package: PACKAGE_NAME.runtime,
268
+ type: "analyzed-deps"
269
+ },
270
+ // =============== Directive Utils ===============
271
+ dir: {
272
+ target: "dir",
273
+ package: PACKAGE_NAME.runtime,
274
+ type: "rename"
275
+ },
276
+ dirCls: {
277
+ target: "dir.cls",
278
+ package: PACKAGE_NAME.runtime,
279
+ type: "rename"
280
+ },
281
+ dirKeyless: {
282
+ target: "dir.keyless",
283
+ package: PACKAGE_NAME.runtime,
284
+ type: "rename"
285
+ },
286
+ dirOn: {
287
+ target: "dir.On",
288
+ package: PACKAGE_NAME.runtime,
289
+ type: "rename"
290
+ },
291
+ dirStyle: {
292
+ target: "dir.style",
293
+ package: PACKAGE_NAME.runtime,
294
+ type: "rename"
295
+ },
296
+ nextTick: {
297
+ target: "nextTick",
298
+ package: PACKAGE_NAME.runtime,
299
+ type: "rename"
108
300
  }
109
301
  },
110
- transform: {
111
- pure: {},
112
- effectful: {}
302
+ // =================== [VuReact Router] ===================
303
+ router: {
304
+ // =============== Components ===============
305
+ RouterLink: {
306
+ target: "RouterLink",
307
+ package: PACKAGE_NAME.router,
308
+ type: "rename"
309
+ },
310
+ RouterView: {
311
+ target: "RouterView",
312
+ package: PACKAGE_NAME.router,
313
+ type: "rename"
314
+ },
315
+ createRouter: {
316
+ target: "createRouter",
317
+ package: PACKAGE_NAME.router,
318
+ type: "rename"
319
+ },
320
+ // =============== Hooks ===============
321
+ useRoute: {
322
+ target: "useRoute",
323
+ package: PACKAGE_NAME.router,
324
+ type: "rename",
325
+ isTrackable: true
326
+ },
327
+ useRouter: {
328
+ target: "useRouter",
329
+ package: PACKAGE_NAME.router,
330
+ type: "rename",
331
+ isTrackable: true
332
+ },
333
+ useLink: {
334
+ target: "useLink",
335
+ package: PACKAGE_NAME.router,
336
+ type: "rename",
337
+ isTrackable: true
338
+ },
339
+ onBeforeRouteLeave: {
340
+ target: "useBeforeRouteLeave",
341
+ package: PACKAGE_NAME.router,
342
+ type: "rename"
343
+ },
344
+ onBeforeRouteUpdate: {
345
+ target: "useBeforeRouteUpdate",
346
+ package: PACKAGE_NAME.router,
347
+ type: "rename"
348
+ },
349
+ onBeforeRouteEnter: {
350
+ target: "useBeforeRouteEnter",
351
+ package: PACKAGE_NAME.router,
352
+ type: "rename"
353
+ }
113
354
  }
114
355
  };
115
356
 
357
+ // src/consts/vue-api-map.ts
358
+ var VUE_API_MAP = {
359
+ ref: "ref",
360
+ provide: "provide",
361
+ watch: "watch",
362
+ watchEffect: "watchEffect",
363
+ watchPostEffect: "watchPostEffect",
364
+ watchSyncEffect: "watchSyncEffect",
365
+ useTemplateRef: "useTemplateRef",
366
+ defineAsyncComponent: "defineAsyncComponent",
367
+ DynamicComponent: "Component",
368
+ Transition: "Transition",
369
+ RouterLink: "RouterLink"
370
+ };
371
+
116
372
  // src/core/codegen/component/jsx/utils/jsx-element-utils.ts
117
373
 
118
374
  function createJsxElement(tag, props, children, selfClosing) {
@@ -705,7 +961,8 @@ function buildCtxProviderNode(nodeIR, ctx, children) {
705
961
  buildJsxExpressionNode(t10.identifier(value))
706
962
  );
707
963
  void ctx;
708
- return createJsxElement(ADAPTER_COMPS.Provider, [keyProp, valueProp], childNodes);
964
+ const adpater = ADAPTER_RULES.runtime[VUE_API_MAP.provide];
965
+ return createJsxElement(adpater.target, [keyProp, valueProp], childNodes);
709
966
  }
710
967
 
711
968
  // src/core/codegen/component/jsx/syntax-processor/postprocess/build-root-jsx.ts
@@ -783,9 +1040,11 @@ var REACT_API_MAP = {
783
1040
  lazy: "lazy",
784
1041
  memo: "memo",
785
1042
  useRef: "useRef",
786
- useCallback: "useCallback",
787
1043
  useMemo: "useMemo",
788
- ReactNode: "ReactNode"
1044
+ ReactNode: "ReactNode",
1045
+ forwardRef: "forwardRef",
1046
+ useCallback: "useCallback",
1047
+ useImperativeHandle: "useImperativeHandle"
789
1048
  };
790
1049
 
791
1050
  // src/utils/camelCase.ts
@@ -825,10 +1084,13 @@ function buildComponent(scriptIR, ctx, state) {
825
1084
  const hasProps = getHasProps(propsTSIface.propsTypes) || getHasProps(propsTSIface.emitTypes) || getHasProps(propsTSIface.slotTypes);
826
1085
  const shouldMemo = scriptIR !== null || hasProps;
827
1086
  const jsxStatement = t12.returnStatement(state.jsx || t12.nullLiteral());
828
- const component = !shouldMemo ? resolveComponent(jsxStatement, ctx) : resolveMemoComponent(scriptIR.statement.local, jsxStatement, ctx);
1087
+ const component = !shouldMemo ? resolvePureUIComponent(jsxStatement, ctx) : resolveMemoComponent(scriptIR.statement.local, jsxStatement, ctx);
829
1088
  state.component = component;
830
1089
  }
831
- function resolveComponent(jsxStmt, ctx) {
1090
+ function getHasProps(list) {
1091
+ return list.length > 0;
1092
+ }
1093
+ function resolvePureUIComponent(jsxStmt, ctx) {
832
1094
  return t12.variableDeclaration("const", [
833
1095
  t12.variableDeclarator(
834
1096
  resolveComponentName(ctx),
@@ -838,12 +1100,14 @@ function resolveComponent(jsxStmt, ctx) {
838
1100
  }
839
1101
  function resolveMemoComponent(local, jsxStmt, ctx) {
840
1102
  const name = resolveComponentName(ctx);
841
- const param = resolveParam(ctx);
842
- const component = t12.arrowFunctionExpression(
843
- !param ? [] : [param],
844
- t12.blockStatement(resolveStatements(local, jsxStmt))
845
- );
846
- const memoCall = t12.callExpression(t12.identifier(REACT_API_MAP.memo), [component]);
1103
+ const param = resolvePropsParam(ctx);
1104
+ const body = t12.blockStatement(resolveLocalStatements(local, jsxStmt));
1105
+ const component = resolveComponent(param, body, ctx);
1106
+ let compFn = component;
1107
+ if (ctx.scriptData.forwardRef.enabled) {
1108
+ compFn = resolveForwardRef(body, ctx);
1109
+ }
1110
+ const memoCall = t12.callExpression(t12.identifier(REACT_API_MAP.memo), [compFn]);
847
1111
  return t12.variableDeclaration("const", [t12.variableDeclarator(name, memoCall)]);
848
1112
  }
849
1113
  function resolveComponentName(ctx) {
@@ -860,7 +1124,52 @@ function resolveComponentName(ctx) {
860
1124
  }
861
1125
  return t12.identifier(name);
862
1126
  }
863
- function resolveParam(ctx) {
1127
+ function resolveLocalStatements(local, jsx) {
1128
+ const stmts = [jsx];
1129
+ if (!local) return stmts;
1130
+ if (typeof local === "object" && "program" in local) {
1131
+ const program3 = local.program;
1132
+ if (_optionalChain([program3, 'optionalAccess', _28 => _28.body, 'optionalAccess', _29 => _29.length])) {
1133
+ return [...program3.body, jsx];
1134
+ }
1135
+ }
1136
+ return stmts;
1137
+ }
1138
+ function resolveComponent(param, body, ctx) {
1139
+ const {
1140
+ scriptData: { forwardRef }
1141
+ } = ctx;
1142
+ if (forwardRef.enabled) {
1143
+ return resolveForwardRef(body, ctx);
1144
+ }
1145
+ const baseComponent = t12.arrowFunctionExpression(!param ? [] : [param], body);
1146
+ return baseComponent;
1147
+ }
1148
+ function resolveForwardRef(body, ctx) {
1149
+ const {
1150
+ propField,
1151
+ scriptData: { forwardRef, lang }
1152
+ } = ctx;
1153
+ const params = [t12.identifier(forwardRef.refField)];
1154
+ const propsId = resolvePropsParam(ctx);
1155
+ const callExpr = t12.callExpression(t12.identifier(REACT_API_MAP.forwardRef), [
1156
+ t12.arrowFunctionExpression(params, body)
1157
+ ]);
1158
+ if (lang.startsWith("ts")) {
1159
+ const types = [t12.tsAnyKeyword()];
1160
+ if (propsId) {
1161
+ const propsType = _optionalChain([propsId, 'optionalAccess', _30 => _30.typeAnnotation, 'optionalAccess', _31 => _31.typeAnnotation]);
1162
+ types.push(propsType || t12.tsAnyKeyword());
1163
+ }
1164
+ callExpr.typeParameters = t12.tsTypeParameterInstantiation(types);
1165
+ }
1166
+ if (propsId) {
1167
+ propsId.typeAnnotation = null;
1168
+ params.unshift(propsId);
1169
+ }
1170
+ return callExpr;
1171
+ }
1172
+ function resolvePropsParam(ctx) {
864
1173
  const { propField, scriptData } = ctx;
865
1174
  const { propsTSIface } = scriptData;
866
1175
  const propsIdentifier = t12.identifier(propField);
@@ -877,24 +1186,10 @@ function resolveParam(ctx) {
877
1186
  propsIdentifier.typeAnnotation = t12.tsTypeAnnotation(t12.tsTypeReference(typeIdentifier));
878
1187
  return propsIdentifier;
879
1188
  }
880
- function resolveStatements(local, jsx) {
881
- const stmts = [jsx];
882
- if (!local) return stmts;
883
- if (typeof local === "object" && "program" in local) {
884
- const program3 = local.program;
885
- if (_optionalChain([program3, 'optionalAccess', _28 => _28.body, 'optionalAccess', _29 => _29.length])) {
886
- return [...program3.body, jsx];
887
- }
888
- }
889
- return stmts;
890
- }
891
- function getHasProps(list) {
892
- return list.length > 0;
893
- }
894
1189
 
895
1190
  // src/core/codegen/component/script/syntax-processor/process/build-program-preamble.ts
896
1191
  function buildProgramPreamble(nodeIR, ctx, state) {
897
- const statements = [_optionalChain([nodeIR, 'optionalAccess', _30 => _30.imports]), _optionalChain([nodeIR, 'optionalAccess', _31 => _31.tsTypes]), _optionalChain([nodeIR, 'optionalAccess', _32 => _32.exports]), _optionalChain([nodeIR, 'optionalAccess', _33 => _33.statement, 'access', _34 => _34.global])].flat().filter(Boolean);
1192
+ const statements = [_optionalChain([nodeIR, 'optionalAccess', _32 => _32.imports]), _optionalChain([nodeIR, 'optionalAccess', _33 => _33.tsTypes]), _optionalChain([nodeIR, 'optionalAccess', _34 => _34.exports]), _optionalChain([nodeIR, 'optionalAccess', _35 => _35.statement, 'access', _36 => _36.global])].flat().filter(Boolean);
898
1193
  state.preambleStatements = statements;
899
1194
  void ctx;
900
1195
  }
@@ -949,7 +1244,7 @@ function generateComponent(ir, ctx, options) {
949
1244
  code,
950
1245
  source: ctx.source
951
1246
  };
952
- executePlugins(_optionalChain([options, 'optionalAccess', _35 => _35.plugins]), result, ctx);
1247
+ executePlugins(_optionalChain([options, 'optionalAccess', _37 => _37.plugins]), result, ctx);
953
1248
  return result;
954
1249
  }
955
1250
 
@@ -963,7 +1258,7 @@ function generateOnlyScript(ir, ctx, options) {
963
1258
  code,
964
1259
  source: ctx.source
965
1260
  };
966
- executePlugins(_optionalChain([options, 'optionalAccess', _36 => _36.plugins]), result, ctx);
1261
+ executePlugins(_optionalChain([options, 'optionalAccess', _38 => _38.plugins]), result, ctx);
967
1262
  return result;
968
1263
  }
969
1264
 
@@ -1048,7 +1343,7 @@ function parseOnlyScript(source, ctx, options) {
1048
1343
  };
1049
1344
  ctx.scriptData.lang = lang;
1050
1345
  ctx.scriptData.source = source;
1051
- executePlugins(_optionalChain([options, 'optionalAccess', _37 => _37.plugins]), result, ctx);
1346
+ executePlugins(_optionalChain([options, 'optionalAccess', _39 => _39.plugins]), result, ctx);
1052
1347
  return result;
1053
1348
  }
1054
1349
 
@@ -1083,8 +1378,8 @@ function resolveScript(descriptor, ctx, pResult) {
1083
1378
  } else {
1084
1379
  result.ast = _parser.parse.call(void 0, result.source.content, options);
1085
1380
  }
1086
- if (_optionalChain([scriptBlock, 'optionalAccess', _38 => _38.warnings])) {
1087
- _optionalChain([scriptBlock, 'optionalAccess', _39 => _39.warnings, 'access', _40 => _40.forEach, 'call', _41 => _41((msg) => {
1381
+ if (_optionalChain([scriptBlock, 'optionalAccess', _40 => _40.warnings])) {
1382
+ _optionalChain([scriptBlock, 'optionalAccess', _41 => _41.warnings, 'access', _42 => _42.forEach, 'call', _43 => _43((msg) => {
1088
1383
  logger.warn(msg, { file: ctx.filename });
1089
1384
  })]);
1090
1385
  }
@@ -1159,7 +1454,7 @@ function extractSetupBodyToTopLevel(content, options) {
1159
1454
  }
1160
1455
  function extractCompName(source) {
1161
1456
  const nameMatch = source.match(/@vr-name:\s*(\w+)/);
1162
- return _optionalChain([nameMatch, 'optionalAccess', _42 => _42[1], 'optionalAccess', _43 => _43.trim, 'call', _44 => _44()]) || "";
1457
+ return _optionalChain([nameMatch, 'optionalAccess', _44 => _44[1], 'optionalAccess', _45 => _45.trim, 'call', _46 => _46()]) || "";
1163
1458
  }
1164
1459
 
1165
1460
  // src/core/parse/sfc/process/resolve-script-meta.ts
@@ -1234,11 +1529,6 @@ var HTML_TAG_TYPES = {
1234
1529
  frame: "HTMLFrameElement"
1235
1530
  };
1236
1531
 
1237
- // src/consts/vue-api-map.ts
1238
- var VUE_API_MAP = {
1239
- useTemplateRef: "useTemplateRef"
1240
- };
1241
-
1242
1532
  // src/consts/reactive-type-map.ts
1243
1533
  var REACTIVE_TYPE_MAP = {
1244
1534
  ref: "ref",
@@ -1270,7 +1560,7 @@ function getReactiveStateApis() {
1270
1560
 
1271
1561
  // src/core/parse/sfc/process/resolve-script-meta.ts
1272
1562
  function resolveScriptMeta(result, ctx) {
1273
- const scriptAST = _optionalChain([result, 'access', _45 => _45.script, 'optionalAccess', _46 => _46.ast]);
1563
+ const scriptAST = _optionalChain([result, 'access', _47 => _47.script, 'optionalAccess', _48 => _48.ast]);
1274
1564
  if (!scriptAST) return;
1275
1565
  _core.traverse.call(void 0, scriptAST, {
1276
1566
  VariableDeclarator(path7) {
@@ -1294,7 +1584,7 @@ function collectReactiveBindings(node, ctx) {
1294
1584
  if (!reactiveStateApis.has(source)) return;
1295
1585
  const varName = node.id.name;
1296
1586
  const value = init.arguments[0];
1297
- if (source === "defineProps") {
1587
+ if (source === MACRO_API_NAMES.props) {
1298
1588
  ctx.propField = varName;
1299
1589
  }
1300
1590
  reactiveBindings[varName] = {
@@ -1310,56 +1600,14 @@ function collectRefBindings(node, ctx) {
1310
1600
  const callee = init.callee;
1311
1601
  if (callee.name !== VUE_API_MAP.useTemplateRef) return;
1312
1602
  const idName = node.id.name;
1313
- const tag = _optionalChain([init, 'access', _47 => _47.arguments, 'access', _48 => _48[0], 'optionalAccess', _49 => _49.value]);
1314
- refBindings[idName] = {
1603
+ const tag = _optionalChain([init, 'access', _49 => _49.arguments, 'access', _50 => _50[0], 'optionalAccess', _51 => _51.value]);
1604
+ refBindings.domRefs[idName] = {
1315
1605
  tag,
1316
1606
  htmlType: HTML_TAG_TYPES[tag] || "HTMLElement",
1317
1607
  name: idName
1318
1608
  };
1319
1609
  }
1320
1610
 
1321
- // src/consts/other.ts
1322
- var PACKAGE_NAME = {
1323
- react: "react",
1324
- runtime: "@vureact/runtime-core",
1325
- router: "@vureact/router"
1326
- };
1327
- var STYLE_MODULE_NAME = "$style";
1328
- var MACRO_API_NAMES = {
1329
- props: "defineProps",
1330
- emits: "defineEmits",
1331
- slots: "defineSlots",
1332
- options: "defineOptions"
1333
- };
1334
- var DOLLAR_IDENTIFIERS = [
1335
- "$data",
1336
- "$props",
1337
- "$el",
1338
- "$options",
1339
- "$parent",
1340
- "$root",
1341
- "$slots",
1342
- "$refs",
1343
- "$attrs",
1344
- "$emit",
1345
- "$watch",
1346
- "$forceUpdate",
1347
- "$nextTick",
1348
- "$router",
1349
- "$route",
1350
- "$store",
1351
- "$pinia",
1352
- "$event"
1353
- ];
1354
- var VUE_PACKAGES = [
1355
- "vue",
1356
- "vite",
1357
- "pinia",
1358
- "nuxt",
1359
- // 不需要带到 React 项目中
1360
- "@vureact/compiler-core"
1361
- ];
1362
-
1363
1611
  // src/plugins/postcss.ts
1364
1612
  var _postcss = require('postcss'); var _postcss2 = _interopRequireDefault(_postcss);
1365
1613
  function processScopedWithPostCss(input, hash) {
@@ -1526,7 +1774,7 @@ function resolveStyles(descriptor, ctx, result) {
1526
1774
  var _compilercore = require('@vue/compiler-core');
1527
1775
  function resolveTemplate(descriptor, _, result) {
1528
1776
  const block = descriptor.template;
1529
- if (!_optionalChain([block, 'optionalAccess', _50 => _50.content])) return null;
1777
+ if (!_optionalChain([block, 'optionalAccess', _52 => _52.content])) return null;
1530
1778
  result.template = {
1531
1779
  ast: _compilercore.baseParse.call(void 0, block.content),
1532
1780
  source: block
@@ -1543,7 +1791,7 @@ function processVueSyntax(descriptor, ctx, result) {
1543
1791
  }
1544
1792
  function vueSyntaxProcessor(descriptor, ctx, result, options) {
1545
1793
  const run = (p, type) => {
1546
- _optionalChain([p, 'optionalAccess', _51 => _51.forEach, 'call', _52 => _52((handler) => {
1794
+ _optionalChain([p, 'optionalAccess', _53 => _53.forEach, 'call', _54 => _54((handler) => {
1547
1795
  if (type === "post") {
1548
1796
  handler(result, ctx);
1549
1797
  return;
@@ -1567,7 +1815,7 @@ function parseSFC(source, ctx, options) {
1567
1815
  };
1568
1816
  collectErrs(descriptor, errors);
1569
1817
  processVueSyntax(descriptor, ctx, result);
1570
- executePlugins(_optionalChain([options, 'optionalAccess', _53 => _53.plugins]), result, ctx);
1818
+ executePlugins(_optionalChain([options, 'optionalAccess', _55 => _55.plugins]), result, ctx);
1571
1819
  return result;
1572
1820
  }
1573
1821
  function collectErrs(descriptor, errors) {
@@ -1575,7 +1823,7 @@ function collectErrs(descriptor, errors) {
1575
1823
  logger.error(err.message, {
1576
1824
  source: descriptor.source,
1577
1825
  file: descriptor.filename,
1578
- loc: _optionalChain([err, 'optionalAccess', _54 => _54.loc])
1826
+ loc: _optionalChain([err, 'optionalAccess', _56 => _56.loc])
1579
1827
  });
1580
1828
  }
1581
1829
  if (descriptor.cssVars.length) {
@@ -1713,7 +1961,7 @@ function isVueEcosystemPackage(moduleName) {
1713
1961
  function mergeImports(currentNode, ctx) {
1714
1962
  const moduleName = currentNode.source.value.toLowerCase();
1715
1963
  const ctxImportItems = ctx.imports.get(moduleName);
1716
- if (!_optionalChain([ctxImportItems, 'optionalAccess', _55 => _55.length])) {
1964
+ if (!_optionalChain([ctxImportItems, 'optionalAccess', _57 => _57.length])) {
1717
1965
  return;
1718
1966
  }
1719
1967
  const currentImports = /* @__PURE__ */ new Set();
@@ -1767,7 +2015,7 @@ function createRequiredImports(ctx) {
1767
2015
 
1768
2016
  function findRootVariablePath(path7) {
1769
2017
  const rootId = findRootIdentifier(path7.node);
1770
- if (!_optionalChain([rootId, 'optionalAccess', _56 => _56.name])) return null;
2018
+ if (!_optionalChain([rootId, 'optionalAccess', _58 => _58.name])) return null;
1771
2019
  const binding = path7.scope.getBinding(rootId.name);
1772
2020
  if (!binding) return null;
1773
2021
  const rootPath = getVariableDeclaratorPath(binding.path);
@@ -1998,66 +2246,13 @@ function collectLocalStatements(ctx, ast) {
1998
2246
  scriptIR.statement.local = ast;
1999
2247
  }
2000
2248
 
2001
- // src/core/transform/sfc/script/syntax-processor/process/resolve-template-ref.ts
2002
-
2003
- function resolveTemplateRef(ctx) {
2004
- if (ctx.inputType !== "sfc") return {};
2005
- return {
2006
- CallExpression(path7) {
2007
- const { node } = path7;
2008
- if (!isCalleeNamed(node, VUE_API_MAP.useTemplateRef)) return;
2009
- addTypeParam(ctx, path7);
2010
- replaceValue(node);
2011
- replaceCallName(node, REACT_API_MAP.useRef);
2012
- recordImport(ctx, PACKAGE_NAME.react, REACT_API_MAP.useRef);
2013
- },
2014
- MemberExpression(path7) {
2015
- const { node } = path7;
2016
- if (node.computed || !t20.isIdentifier(node.property) || node.property.name !== "value") {
2017
- return;
2018
- }
2019
- const rootPath = findRootVariablePath(path7);
2020
- if (!_optionalChain([rootPath, 'optionalAccess', _57 => _57.node]) || !t20.isCallExpression(rootPath.node.init) || !isCalleeNamed(rootPath.node.init, REACT_API_MAP.useRef)) {
2021
- return;
2022
- }
2023
- const rootId = findRootIdentifier(node);
2024
- if (!t20.isIdentifier(node.object) || node.object.name !== _optionalChain([rootId, 'optionalAccess', _58 => _58.name])) {
2025
- return;
2026
- }
2027
- node.property.name = "current";
2028
- }
2029
- };
2030
- }
2031
- function replaceValue(node) {
2032
- const initVal = node.arguments[0];
2033
- const newVal = t20.identifier("null");
2034
- newVal.start = _optionalChain([initVal, 'optionalAccess', _59 => _59.start]);
2035
- newVal.end = _optionalChain([initVal, 'optionalAccess', _60 => _60.end]);
2036
- newVal.loc = _optionalChain([initVal, 'optionalAccess', _61 => _61.loc]);
2037
- node.arguments[0] = newVal;
2038
- }
2039
- function addTypeParam(ctx, path7) {
2040
- const { templateData, scriptData } = ctx;
2041
- const { node, parent } = path7;
2042
- if (!scriptData.lang.startsWith("ts") && !t20.isVariableDeclarator(parent)) {
2043
- return;
2044
- }
2045
- const idName = parent.id.name;
2046
- const bindingMeta = templateData.refBindings[idName];
2047
- if (!node.typeParameters && bindingMeta) {
2048
- node.typeParameters = t20.tsTypeParameterInstantiation([
2049
- t20.tsTypeReference(t20.identifier(bindingMeta.htmlType))
2050
- ]);
2051
- }
2052
- }
2053
-
2054
- // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-async-component.ts
2249
+ // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-define-async-component.ts
2055
2250
 
2056
- function resolveAsyncComponent(ctx) {
2251
+ function resolveDefineAsyncComponent(ctx) {
2057
2252
  return {
2058
2253
  CallExpression(path7) {
2059
2254
  const { node } = path7;
2060
- if (!isCalleeNamed(node, "defineAsyncComponent")) {
2255
+ if (!isCalleeNamed(node, VUE_API_MAP.defineAsyncComponent)) {
2061
2256
  return;
2062
2257
  }
2063
2258
  const [arg] = node.arguments;
@@ -2068,11 +2263,11 @@ function resolveAsyncComponent(ctx) {
2068
2263
  };
2069
2264
  }
2070
2265
  function checkIsUnsupported(ctx, arg) {
2071
- if (t21.isFunction(arg)) {
2266
+ if (t20.isFunction(arg)) {
2072
2267
  checkIsDynamicImport(ctx, arg);
2073
- } else if (t21.isObjectExpression(arg)) {
2268
+ } else if (t20.isObjectExpression(arg)) {
2074
2269
  const { value } = arg.properties.find(
2075
- (p) => t21.isObjectProperty(p) && t21.isIdentifier(p.key) && p.key.name === "loader"
2270
+ (p) => t20.isObjectProperty(p) && t20.isIdentifier(p.key) && p.key.name === "loader"
2076
2271
  );
2077
2272
  checkIsDynamicImport(ctx, value);
2078
2273
  if (arg.properties.length > 1) {
@@ -2083,31 +2278,31 @@ function checkIsUnsupported(ctx, arg) {
2083
2278
  function checkIsDynamicImport(ctx, node) {
2084
2279
  const { scriptData, filename } = ctx;
2085
2280
  const warnIsNotImport = (target) => {
2086
- if (!target || !t21.isImport(target)) {
2281
+ if (!target || !t20.isImport(target)) {
2087
2282
  logger.error(
2088
2283
  `Only ES module dynamic imports are supported. You must use and return import('...').`,
2089
2284
  {
2090
2285
  source: scriptData.source,
2091
2286
  file: filename,
2092
- loc: _optionalChain([target, 'optionalAccess', _62 => _62.loc]) || {}
2287
+ loc: _optionalChain([target, 'optionalAccess', _59 => _59.loc]) || {}
2093
2288
  }
2094
2289
  );
2095
2290
  }
2096
2291
  };
2097
- if (t21.isFunction(node)) {
2292
+ if (t20.isFunction(node)) {
2098
2293
  checkIsDynamicImport(ctx, node.body);
2099
2294
  return;
2100
2295
  }
2101
- if (t21.isBlockStatement(node)) {
2296
+ if (t20.isBlockStatement(node)) {
2102
2297
  const [returnSmt] = node.body;
2103
- if (t21.isReturnStatement(returnSmt)) {
2298
+ if (t20.isReturnStatement(returnSmt)) {
2104
2299
  warnIsNotImport(returnSmt.argument);
2105
2300
  }
2106
2301
  return;
2107
2302
  }
2108
- if (t21.isCallExpression(node)) {
2303
+ if (t20.isCallExpression(node)) {
2109
2304
  warnIsNotImport(node.callee);
2110
- if (t21.isStringLiteral(node.arguments[0])) {
2305
+ if (t20.isStringLiteral(node.arguments[0])) {
2111
2306
  replaceVueSuffix(ctx, node.arguments[0]);
2112
2307
  }
2113
2308
  return;
@@ -2141,7 +2336,7 @@ function pushToGlobalScope(path7, ctx) {
2141
2336
  declarationPath = declarationPath.parentPath;
2142
2337
  }
2143
2338
  let fullNode;
2144
- if (_optionalChain([declarationPath, 'optionalAccess', _63 => _63.isVariableDeclaration, 'call', _64 => _64()])) {
2339
+ if (_optionalChain([declarationPath, 'optionalAccess', _60 => _60.isVariableDeclaration, 'call', _61 => _61()])) {
2145
2340
  fullNode = declarationPath.node;
2146
2341
  declarationPath.remove();
2147
2342
  } else if (path7.parentPath.isVariableDeclarator()) {
@@ -2155,61 +2350,64 @@ function pushToGlobalScope(path7, ctx) {
2155
2350
  scriptIR.statement.global.push(fullNode);
2156
2351
  }
2157
2352
 
2158
- // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-emit-calls.ts
2353
+ // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-define-expose.ts
2159
2354
 
2160
- function resolveEmitCalls(ctx) {
2355
+
2356
+ // src/core/transform/sfc/script/shared/hook-creator.ts
2357
+
2358
+ function createUseCallback(body, deps) {
2359
+ return t21.callExpression(t21.identifier(REACT_API_MAP.useCallback), [
2360
+ body,
2361
+ _nullishCoalesce(deps, () => ( t21.arrayExpression([])))
2362
+ ]);
2363
+ }
2364
+ function createUseMemo(body, deps) {
2365
+ return t21.callExpression(t21.identifier(REACT_API_MAP.useMemo), [
2366
+ t21.arrowFunctionExpression([], body),
2367
+ _nullishCoalesce(deps, () => ( t21.arrayExpression([])))
2368
+ ]);
2369
+ }
2370
+ function createUseImperativeHandle(refId, init) {
2371
+ return t21.callExpression(t21.identifier(REACT_API_MAP.useImperativeHandle), [refId, init]);
2372
+ }
2373
+
2374
+ // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-define-expose.ts
2375
+ function resolveDefineExpose(ctx) {
2376
+ if (ctx.inputType !== "sfc") return {};
2161
2377
  return {
2162
2378
  CallExpression(path7) {
2163
2379
  const { node } = path7;
2164
- const { filename, templateData, scriptData } = ctx;
2165
- if (!t22.isIdentifier(node.callee)) return;
2166
- const { name } = node.callee;
2167
- const checkIfFromDefineEmits = () => {
2168
- let result = false;
2169
- const meta = templateData.reactiveBindings[name];
2170
- if (meta) {
2171
- result = meta.source === MACRO_API_NAMES.emits;
2172
- }
2173
- if (!result) {
2174
- const binding = path7.scope.getBinding(name);
2175
- if (binding) {
2176
- const parent = binding.path.node;
2177
- if (t22.isVariableDeclarator(parent) && t22.isCallExpression(parent.init) && t22.isIdentifier(parent.init.callee)) {
2178
- result = parent.init.callee.name === MACRO_API_NAMES.emits;
2179
- }
2180
- }
2181
- }
2182
- return result;
2183
- };
2184
- if (!checkIfFromDefineEmits()) return;
2185
- const [callee, ...args] = node.arguments;
2186
- const eventName = t22.isStringLiteral(callee) ? `on${capitalize(camelCase(callee.value))}` : void 0;
2187
- if (!eventName) {
2188
- logger.warn(`Expected String type but got ${_optionalChain([callee, 'optionalAccess', _65 => _65.type])}, expression will be removed`, {
2189
- file: filename,
2190
- source: scriptData.source,
2191
- loc: _optionalChain([callee, 'optionalAccess', _66 => _66.loc])
2192
- });
2380
+ const { filename, scriptData } = ctx;
2381
+ if (!isCalleeNamed(node, MACRO_API_NAMES.expose)) {
2382
+ return;
2383
+ }
2384
+ const [expose] = node.arguments;
2385
+ if (!expose) {
2193
2386
  path7.remove();
2194
2387
  return;
2195
2388
  }
2196
- const propCall = t22.callExpression(
2197
- t22.optionalMemberExpression(
2198
- t22.identifier(ctx.propField),
2199
- t22.identifier(eventName),
2200
- false,
2201
- true
2202
- ),
2203
- args
2204
- );
2205
- path7.replaceWith(propCall);
2389
+ const adapter = ADAPTER_RULES.react[MACRO_API_NAMES.expose];
2390
+ recordImport(ctx, adapter.package, REACT_API_MAP.forwardRef);
2391
+ recordImport(ctx, adapter.package, adapter.target);
2392
+ if (!t22.isObjectExpression(expose) && !t22.isFunction(expose)) {
2393
+ logger.warn("Non-deterministic object literal may cause unknown risks.", {
2394
+ file: filename,
2395
+ loc: expose.loc,
2396
+ source: scriptData.source
2397
+ });
2398
+ }
2399
+ const init = !t22.isFunction(expose) ? t22.arrowFunctionExpression([], expose) : expose;
2400
+ const { forwardRef } = scriptData;
2401
+ const newNode = createUseImperativeHandle(t22.identifier(forwardRef.refField), init);
2402
+ forwardRef.enabled = true;
2403
+ path7.replaceWith(newNode);
2206
2404
  }
2207
2405
  };
2208
2406
  }
2209
2407
 
2210
- // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-options.ts
2408
+ // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-define-options.ts
2211
2409
 
2212
- function resolveOptions(ctx) {
2410
+ function resolveDefineOptions(ctx) {
2213
2411
  return {
2214
2412
  CallExpression(path7) {
2215
2413
  const { node } = path7;
@@ -2222,7 +2420,7 @@ function resolveOptions(ctx) {
2222
2420
  logger.warn("defineOptions was found, but no options were provided.", {
2223
2421
  source: scriptData.source,
2224
2422
  file: filename,
2225
- loc: _optionalChain([node, 'optionalAccess', _67 => _67.loc])
2423
+ loc: _optionalChain([node, 'optionalAccess', _62 => _62.loc])
2226
2424
  });
2227
2425
  path7.remove();
2228
2426
  return;
@@ -2231,35 +2429,87 @@ function resolveOptions(ctx) {
2231
2429
  logger.warn("Argument for defineOptions must be an object expression.", {
2232
2430
  source: scriptData.source,
2233
2431
  file: filename,
2234
- loc: _optionalChain([options, 'optionalAccess', _68 => _68.loc])
2432
+ loc: _optionalChain([options, 'optionalAccess', _63 => _63.loc])
2235
2433
  });
2236
2434
  } else {
2237
2435
  for (const prop of options.properties) {
2238
2436
  if (!t23.isObjectProperty(prop) || !t23.isIdentifier(prop.key)) {
2239
2437
  continue;
2240
2438
  }
2241
- extractName(prop, ctx);
2439
+ extractName(prop, ctx);
2440
+ }
2441
+ }
2442
+ path7.remove();
2443
+ }
2444
+ };
2445
+ }
2446
+ function extractName(prop, ctx) {
2447
+ if (ctx.compName) return;
2448
+ const { filename, scriptData } = ctx;
2449
+ if (!prop.computed && prop.key.name === "name") {
2450
+ if (t23.isStringLiteral(prop.value)) {
2451
+ ctx.compName = prop.value.value;
2452
+ return;
2453
+ }
2454
+ logger.error(`name must be a string type, but got ${prop.value.type}`, {
2455
+ source: scriptData.source,
2456
+ file: filename,
2457
+ loc: _optionalChain([prop, 'access', _64 => _64.key, 'optionalAccess', _65 => _65.loc])
2458
+ });
2459
+ }
2460
+ }
2461
+
2462
+ // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-emit-calls.ts
2463
+
2464
+ function resolveEmitCalls(ctx) {
2465
+ return {
2466
+ CallExpression(path7) {
2467
+ const { node } = path7;
2468
+ const { filename, templateData, scriptData } = ctx;
2469
+ if (!t24.isIdentifier(node.callee)) return;
2470
+ const { name } = node.callee;
2471
+ const checkIfFromDefineEmits = () => {
2472
+ let result = false;
2473
+ const meta = templateData.reactiveBindings[name];
2474
+ if (meta) {
2475
+ result = meta.source === MACRO_API_NAMES.emits;
2476
+ }
2477
+ if (!result) {
2478
+ const binding = path7.scope.getBinding(name);
2479
+ if (binding) {
2480
+ const parent = binding.path.node;
2481
+ if (t24.isVariableDeclarator(parent) && t24.isCallExpression(parent.init) && t24.isIdentifier(parent.init.callee)) {
2482
+ result = parent.init.callee.name === MACRO_API_NAMES.emits;
2483
+ }
2484
+ }
2242
2485
  }
2486
+ return result;
2487
+ };
2488
+ if (!checkIfFromDefineEmits()) return;
2489
+ const [callee, ...args] = node.arguments;
2490
+ const eventName = t24.isStringLiteral(callee) ? `on${capitalize(camelCase(callee.value))}` : void 0;
2491
+ if (!eventName) {
2492
+ logger.warn(`Expected String type but got ${_optionalChain([callee, 'optionalAccess', _66 => _66.type])}, expression will be removed`, {
2493
+ file: filename,
2494
+ source: scriptData.source,
2495
+ loc: _optionalChain([callee, 'optionalAccess', _67 => _67.loc])
2496
+ });
2497
+ path7.remove();
2498
+ return;
2243
2499
  }
2244
- path7.remove();
2500
+ const propCall = t24.callExpression(
2501
+ t24.optionalMemberExpression(
2502
+ t24.identifier(ctx.propField),
2503
+ t24.identifier(eventName),
2504
+ false,
2505
+ true
2506
+ ),
2507
+ args
2508
+ );
2509
+ path7.replaceWith(propCall);
2245
2510
  }
2246
2511
  };
2247
2512
  }
2248
- function extractName(prop, ctx) {
2249
- if (ctx.compName) return;
2250
- const { filename, scriptData } = ctx;
2251
- if (!prop.computed && prop.key.name === "name") {
2252
- if (t23.isStringLiteral(prop.value)) {
2253
- ctx.compName = prop.value.value;
2254
- return;
2255
- }
2256
- logger.error(`name must be a string type, but got ${prop.value.type}`, {
2257
- source: scriptData.source,
2258
- file: filename,
2259
- loc: _optionalChain([prop, 'access', _69 => _69.key, 'optionalAccess', _70 => _70.loc])
2260
- });
2261
- }
2262
- }
2263
2513
 
2264
2514
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-props-interface/index.ts
2265
2515
 
@@ -2271,21 +2521,21 @@ function extractName(prop, ctx) {
2271
2521
 
2272
2522
  function cloneCallableParams(params) {
2273
2523
  const cloneCallableParam = (param, index) => {
2274
- if (t24.isRestElement(param)) {
2524
+ if (t25.isRestElement(param)) {
2275
2525
  const arg = param.argument;
2276
- const name = t24.isIdentifier(arg) ? arg.name : `args${index}`;
2277
- const rest = t24.restElement(t24.identifier(name));
2278
- rest.typeAnnotation = param.typeAnnotation || (t24.isIdentifier(arg) ? arg.typeAnnotation : null) || t24.tsTypeAnnotation(t24.tsArrayType(t24.tsAnyKeyword()));
2526
+ const name = t25.isIdentifier(arg) ? arg.name : `args${index}`;
2527
+ const rest = t25.restElement(t25.identifier(name));
2528
+ rest.typeAnnotation = param.typeAnnotation || (t25.isIdentifier(arg) ? arg.typeAnnotation : null) || t25.tsTypeAnnotation(t25.tsArrayType(t25.tsAnyKeyword()));
2279
2529
  return rest;
2280
2530
  }
2281
- if (t24.isIdentifier(param)) {
2282
- const id = t24.identifier(param.name || `arg${index}`);
2531
+ if (t25.isIdentifier(param)) {
2532
+ const id = t25.identifier(param.name || `arg${index}`);
2283
2533
  id.optional = param.optional;
2284
- id.typeAnnotation = param.typeAnnotation || t24.tsTypeAnnotation(t24.tsAnyKeyword());
2534
+ id.typeAnnotation = param.typeAnnotation || t25.tsTypeAnnotation(t25.tsAnyKeyword());
2285
2535
  return id;
2286
2536
  }
2287
- const fallback = t24.identifier(`arg${index}`);
2288
- fallback.typeAnnotation = t24.tsTypeAnnotation(t24.tsAnyKeyword());
2537
+ const fallback = t25.identifier(`arg${index}`);
2538
+ fallback.typeAnnotation = t25.tsTypeAnnotation(t25.tsAnyKeyword());
2289
2539
  return fallback;
2290
2540
  };
2291
2541
  return params.map(cloneCallableParam);
@@ -2295,18 +2545,18 @@ function cloneCallableParams(params) {
2295
2545
  function resolveEmitsTopLevelTypes(ctx) {
2296
2546
  return {
2297
2547
  "TSInterfaceDeclaration|TSTypeAliasDeclaration"(path7) {
2298
- if (!t25.isProgram(path7.parent)) return;
2548
+ if (!t26.isProgram(path7.parent)) return;
2299
2549
  const { node } = path7;
2300
- if (t25.isTSInterfaceDeclaration(node)) {
2301
- const typeLiteral = t25.tsTypeLiteral(node.body.body);
2550
+ if (t26.isTSInterfaceDeclaration(node)) {
2551
+ const typeLiteral = t26.tsTypeLiteral(node.body.body);
2302
2552
  if (!hasEmitsSignatureInType(typeLiteral)) return;
2303
2553
  const resolved = resolveTopLevelEmitType(typeLiteral);
2304
- if (resolved && t25.isTSTypeLiteral(resolved)) {
2554
+ if (resolved && t26.isTSTypeLiteral(resolved)) {
2305
2555
  node.body.body = resolved.members;
2306
2556
  }
2307
2557
  return;
2308
2558
  }
2309
- if (t25.isTSTypeAliasDeclaration(node)) {
2559
+ if (t26.isTSTypeAliasDeclaration(node)) {
2310
2560
  if (!hasEmitsSignatureInType(node.typeAnnotation)) return;
2311
2561
  const resolved = resolveTopLevelEmitType(node.typeAnnotation);
2312
2562
  if (resolved) {
@@ -2317,55 +2567,55 @@ function resolveEmitsTopLevelTypes(ctx) {
2317
2567
  };
2318
2568
  }
2319
2569
  function resolveTopLevelEmitType(tsType) {
2320
- if (t25.isTSParenthesizedType(tsType)) {
2570
+ if (t26.isTSParenthesizedType(tsType)) {
2321
2571
  return resolveTopLevelEmitType(tsType.typeAnnotation);
2322
2572
  }
2323
- if (t25.isTSTypeReference(tsType)) {
2573
+ if (t26.isTSTypeReference(tsType)) {
2324
2574
  if (!tsType.typeParameters || !tsType.typeParameters.params.length) {
2325
2575
  return tsType;
2326
2576
  }
2327
2577
  const params = tsType.typeParameters.params.map((param) => resolveTopLevelEmitType(param)).filter(Boolean);
2328
- return t25.tsTypeReference(
2578
+ return t26.tsTypeReference(
2329
2579
  tsType.typeName,
2330
- t25.tsTypeParameterInstantiation(params.length ? params : tsType.typeParameters.params)
2580
+ t26.tsTypeParameterInstantiation(params.length ? params : tsType.typeParameters.params)
2331
2581
  );
2332
2582
  }
2333
- if (t25.isTSIntersectionType(tsType)) {
2583
+ if (t26.isTSIntersectionType(tsType)) {
2334
2584
  const types = tsType.types.map(resolveTopLevelEmitType).filter(Boolean);
2335
2585
  if (!types.length) return null;
2336
2586
  if (types.length === 1) return types[0];
2337
- return t25.tsIntersectionType(types);
2587
+ return t26.tsIntersectionType(types);
2338
2588
  }
2339
- if (t25.isTSUnionType(tsType)) {
2589
+ if (t26.isTSUnionType(tsType)) {
2340
2590
  const types = tsType.types.map(resolveTopLevelEmitType).filter(Boolean);
2341
2591
  if (!types.length) return null;
2342
2592
  if (types.length === 1) return types[0];
2343
- return t25.tsUnionType(types);
2593
+ return t26.tsUnionType(types);
2344
2594
  }
2345
- if (t25.isTSTypeLiteral(tsType)) {
2595
+ if (t26.isTSTypeLiteral(tsType)) {
2346
2596
  const members = [];
2347
2597
  for (const member of tsType.members) {
2348
- if (t25.isTSCallSignatureDeclaration(member)) {
2598
+ if (t26.isTSCallSignatureDeclaration(member)) {
2349
2599
  members.push(...resolveEmitPropsFromCallSignature(member));
2350
2600
  continue;
2351
2601
  }
2352
2602
  members.push(member);
2353
2603
  }
2354
2604
  if (!members.length) return null;
2355
- return t25.tsTypeLiteral(members);
2605
+ return t26.tsTypeLiteral(members);
2356
2606
  }
2357
- if (t25.isTSFunctionType(tsType)) {
2607
+ if (t26.isTSFunctionType(tsType)) {
2358
2608
  const props = resolveEmitPropsFromCallable(tsType.parameters, tsType.typeAnnotation);
2359
2609
  if (!props.length) return null;
2360
- return t25.tsTypeLiteral(props);
2610
+ return t26.tsTypeLiteral(props);
2361
2611
  }
2362
2612
  return tsType;
2363
2613
  }
2364
2614
  function resolveDefineEmitsIface(path7, ctx) {
2365
2615
  const { node } = path7;
2366
2616
  const [runtimeArg] = node.arguments;
2367
- const tsParams = _optionalChain([node, 'access', _71 => _71.typeParameters, 'optionalAccess', _72 => _72.params]);
2368
- if (_optionalChain([tsParams, 'optionalAccess', _73 => _73.length])) {
2617
+ const tsParams = _optionalChain([node, 'access', _68 => _68.typeParameters, 'optionalAccess', _69 => _69.params]);
2618
+ if (_optionalChain([tsParams, 'optionalAccess', _70 => _70.length])) {
2369
2619
  processExplicitType(ctx, tsParams);
2370
2620
  return;
2371
2621
  }
@@ -2378,41 +2628,41 @@ function processInferredTypes(ctx, runtimeArg) {
2378
2628
  propsTSIface: { emitTypes }
2379
2629
  } = ctx.scriptData;
2380
2630
  const members = [];
2381
- if (t25.isArrayExpression(runtimeArg)) {
2631
+ if (t26.isArrayExpression(runtimeArg)) {
2382
2632
  for (const element of runtimeArg.elements) {
2383
- if (!element || !t25.isStringLiteral(element)) continue;
2633
+ if (!element || !t26.isStringLiteral(element)) continue;
2384
2634
  const handlerName = resolveEmitHandlerName(element.value);
2385
2635
  const key = buildKey(handlerName);
2386
- const fnType = t25.tsFunctionType(
2636
+ const fnType = t26.tsFunctionType(
2387
2637
  null,
2388
2638
  [createRestAnyParam("args")],
2389
- t25.tsTypeAnnotation(t25.tsAnyKeyword())
2639
+ t26.tsTypeAnnotation(t26.tsAnyKeyword())
2390
2640
  );
2391
- const prop = t25.tsPropertySignature(key, t25.tsTypeAnnotation(fnType));
2641
+ const prop = t26.tsPropertySignature(key, t26.tsTypeAnnotation(fnType));
2392
2642
  prop.optional = true;
2393
2643
  members.push(prop);
2394
2644
  }
2395
2645
  if (members.length) {
2396
- emitTypes.push(t25.tsTypeLiteral(members));
2646
+ emitTypes.push(t26.tsTypeLiteral(members));
2397
2647
  }
2398
2648
  return;
2399
2649
  }
2400
- if (t25.isObjectExpression(runtimeArg)) {
2650
+ if (t26.isObjectExpression(runtimeArg)) {
2401
2651
  for (const prop of runtimeArg.properties) {
2402
- if (!t25.isObjectProperty(prop)) continue;
2403
- if (t25.isSpreadElement(prop)) continue;
2652
+ if (!t26.isObjectProperty(prop)) continue;
2653
+ if (t26.isSpreadElement(prop)) continue;
2404
2654
  const rawName = resolvePropName(prop.key);
2405
2655
  if (!rawName) continue;
2406
2656
  const handlerName = resolveEmitHandlerName(rawName);
2407
2657
  const key = buildKey(handlerName);
2408
- const params = t25.isArrayExpression(prop.value) ? resolveRuntimeTupleParams(prop.value) : [createRestAnyParam("args")];
2409
- const fnType = t25.tsFunctionType(null, params, t25.tsTypeAnnotation(t25.tsAnyKeyword()));
2410
- const propSig = t25.tsPropertySignature(key, t25.tsTypeAnnotation(fnType));
2658
+ const params = t26.isArrayExpression(prop.value) ? resolveRuntimeTupleParams(prop.value) : [createRestAnyParam("args")];
2659
+ const fnType = t26.tsFunctionType(null, params, t26.tsTypeAnnotation(t26.tsAnyKeyword()));
2660
+ const propSig = t26.tsPropertySignature(key, t26.tsTypeAnnotation(fnType));
2411
2661
  propSig.optional = true;
2412
2662
  members.push(propSig);
2413
2663
  }
2414
2664
  if (members.length) {
2415
- emitTypes.push(t25.tsTypeLiteral(members));
2665
+ emitTypes.push(t26.tsTypeLiteral(members));
2416
2666
  }
2417
2667
  }
2418
2668
  }
@@ -2433,129 +2683,129 @@ function resolveEmitHandlerName(rawName) {
2433
2683
  return `on${name}`;
2434
2684
  }
2435
2685
  function resolvePropName(key) {
2436
- if (t25.isIdentifier(key)) return key.name;
2437
- if (t25.isStringLiteral(key)) return key.value;
2438
- if (t25.isNumericLiteral(key)) return String(key.value);
2686
+ if (t26.isIdentifier(key)) return key.name;
2687
+ if (t26.isStringLiteral(key)) return key.value;
2688
+ if (t26.isNumericLiteral(key)) return String(key.value);
2439
2689
  return null;
2440
2690
  }
2441
2691
  function buildKey(name) {
2442
- return t25.isValidIdentifier(name) ? t25.identifier(name) : t25.stringLiteral(name);
2692
+ return t26.isValidIdentifier(name) ? t26.identifier(name) : t26.stringLiteral(name);
2443
2693
  }
2444
2694
  function createRestAnyParam(name) {
2445
- const id = t25.identifier(name);
2446
- const rest = t25.restElement(id);
2447
- rest.typeAnnotation = t25.tsTypeAnnotation(t25.tsArrayType(t25.tsAnyKeyword()));
2695
+ const id = t26.identifier(name);
2696
+ const rest = t26.restElement(id);
2697
+ rest.typeAnnotation = t26.tsTypeAnnotation(t26.tsArrayType(t26.tsAnyKeyword()));
2448
2698
  return rest;
2449
2699
  }
2450
2700
  function resolveRuntimeTupleParams(value) {
2451
2701
  const params = [];
2452
2702
  value.elements.forEach((element, index) => {
2453
2703
  if (!element) return;
2454
- if (t25.isSpreadElement(element)) {
2704
+ if (t26.isSpreadElement(element)) {
2455
2705
  params.push(createRestAnyParam(`args${index}`));
2456
2706
  return;
2457
2707
  }
2458
- if (t25.isIdentifier(element)) {
2459
- const id = t25.identifier(element.name);
2460
- id.typeAnnotation = element.typeAnnotation || t25.tsTypeAnnotation(t25.tsAnyKeyword());
2708
+ if (t26.isIdentifier(element)) {
2709
+ const id = t26.identifier(element.name);
2710
+ id.typeAnnotation = element.typeAnnotation || t26.tsTypeAnnotation(t26.tsAnyKeyword());
2461
2711
  params.push(id);
2462
2712
  return;
2463
2713
  }
2464
- if (t25.isTSAsExpression(element)) {
2465
- const id = t25.identifier(`arg${index}`);
2466
- id.typeAnnotation = t25.tsTypeAnnotation(element.typeAnnotation);
2714
+ if (t26.isTSAsExpression(element)) {
2715
+ const id = t26.identifier(`arg${index}`);
2716
+ id.typeAnnotation = t26.tsTypeAnnotation(element.typeAnnotation);
2467
2717
  params.push(id);
2468
2718
  return;
2469
2719
  }
2470
- const fallback = t25.identifier(`arg${index}`);
2471
- fallback.typeAnnotation = t25.tsTypeAnnotation(t25.tsAnyKeyword());
2720
+ const fallback = t26.identifier(`arg${index}`);
2721
+ fallback.typeAnnotation = t26.tsTypeAnnotation(t26.tsAnyKeyword());
2472
2722
  params.push(fallback);
2473
2723
  });
2474
2724
  return params;
2475
2725
  }
2476
2726
  function resolveExplicitEmitType(tsType) {
2477
- if (t25.isTSParenthesizedType(tsType)) {
2727
+ if (t26.isTSParenthesizedType(tsType)) {
2478
2728
  return resolveExplicitEmitType(tsType.typeAnnotation);
2479
2729
  }
2480
- if (t25.isTSTypeReference(tsType)) {
2730
+ if (t26.isTSTypeReference(tsType)) {
2481
2731
  if (!tsType.typeParameters || !tsType.typeParameters.params.length) {
2482
2732
  return tsType;
2483
2733
  }
2484
2734
  const params = tsType.typeParameters.params.map((param) => resolveExplicitEmitType(param)).filter(Boolean);
2485
- return t25.tsTypeReference(
2735
+ return t26.tsTypeReference(
2486
2736
  tsType.typeName,
2487
- t25.tsTypeParameterInstantiation(params.length ? params : tsType.typeParameters.params)
2737
+ t26.tsTypeParameterInstantiation(params.length ? params : tsType.typeParameters.params)
2488
2738
  );
2489
2739
  }
2490
- if (t25.isTSIntersectionType(tsType)) {
2740
+ if (t26.isTSIntersectionType(tsType)) {
2491
2741
  const types = tsType.types.map(resolveExplicitEmitType).filter(Boolean);
2492
2742
  if (!types.length) return null;
2493
2743
  if (types.length === 1) return types[0];
2494
- return t25.tsIntersectionType(types);
2744
+ return t26.tsIntersectionType(types);
2495
2745
  }
2496
- if (t25.isTSUnionType(tsType)) {
2746
+ if (t26.isTSUnionType(tsType)) {
2497
2747
  const types = tsType.types.map(resolveExplicitEmitType).filter(Boolean);
2498
2748
  if (!types.length) return null;
2499
2749
  if (types.length === 1) return types[0];
2500
- return t25.tsUnionType(types);
2750
+ return t26.tsUnionType(types);
2501
2751
  }
2502
- if (t25.isTSTypeLiteral(tsType)) {
2752
+ if (t26.isTSTypeLiteral(tsType)) {
2503
2753
  const members = [];
2504
2754
  for (const member of tsType.members) {
2505
- if (t25.isTSPropertySignature(member)) {
2755
+ if (t26.isTSPropertySignature(member)) {
2506
2756
  const prop = resolveEmitPropFromPropertySignature(member);
2507
2757
  if (prop) members.push(prop);
2508
2758
  continue;
2509
2759
  }
2510
- if (t25.isTSCallSignatureDeclaration(member)) {
2760
+ if (t26.isTSCallSignatureDeclaration(member)) {
2511
2761
  members.push(...resolveEmitPropsFromCallSignature(member));
2512
2762
  continue;
2513
2763
  }
2514
2764
  }
2515
2765
  if (!members.length) return null;
2516
- return t25.tsTypeLiteral(members);
2766
+ return t26.tsTypeLiteral(members);
2517
2767
  }
2518
- if (t25.isTSFunctionType(tsType)) {
2768
+ if (t26.isTSFunctionType(tsType)) {
2519
2769
  const props = resolveEmitPropsFromCallable(tsType.parameters, tsType.typeAnnotation);
2520
2770
  if (!props.length) return null;
2521
- return t25.tsTypeLiteral(props);
2771
+ return t26.tsTypeLiteral(props);
2522
2772
  }
2523
2773
  return tsType;
2524
2774
  }
2525
2775
  function hasEmitsSignatureInType(tsType) {
2526
- if (t25.isTSParenthesizedType(tsType)) {
2776
+ if (t26.isTSParenthesizedType(tsType)) {
2527
2777
  return hasEmitsSignatureInType(tsType.typeAnnotation);
2528
2778
  }
2529
- if (t25.isTSTypeReference(tsType)) {
2779
+ if (t26.isTSTypeReference(tsType)) {
2530
2780
  if (!tsType.typeParameters || !tsType.typeParameters.params.length) {
2531
2781
  return false;
2532
2782
  }
2533
2783
  return tsType.typeParameters.params.some(hasEmitsSignatureInType);
2534
2784
  }
2535
- if (t25.isTSIntersectionType(tsType) || t25.isTSUnionType(tsType)) {
2785
+ if (t26.isTSIntersectionType(tsType) || t26.isTSUnionType(tsType)) {
2536
2786
  return tsType.types.some(hasEmitsSignatureInType);
2537
2787
  }
2538
- if (t25.isTSTypeLiteral(tsType)) {
2788
+ if (t26.isTSTypeLiteral(tsType)) {
2539
2789
  return tsType.members.some(hasEmitsSignatureInMember);
2540
2790
  }
2541
- if (t25.isTSFunctionType(tsType)) {
2791
+ if (t26.isTSFunctionType(tsType)) {
2542
2792
  return isEmitsCallable(tsType.parameters);
2543
2793
  }
2544
2794
  return false;
2545
2795
  }
2546
2796
  function hasEmitsSignatureInMember(member) {
2547
- if (t25.isTSCallSignatureDeclaration(member)) {
2797
+ if (t26.isTSCallSignatureDeclaration(member)) {
2548
2798
  return isEmitsCallable(member.parameters);
2549
2799
  }
2550
2800
  return false;
2551
2801
  }
2552
2802
  function isEmitsCallable(parameters) {
2553
2803
  const [eventParam] = parameters;
2554
- if (!eventParam || !t25.isIdentifier(eventParam) || !eventParam.typeAnnotation) {
2804
+ if (!eventParam || !t26.isIdentifier(eventParam) || !eventParam.typeAnnotation) {
2555
2805
  return false;
2556
2806
  }
2557
2807
  const { typeAnnotation } = eventParam;
2558
- if (t25.isNoop(typeAnnotation)) return false;
2808
+ if (t26.isNoop(typeAnnotation)) return false;
2559
2809
  return resolveEventNames(typeAnnotation.typeAnnotation).length > 0;
2560
2810
  }
2561
2811
  function resolveEmitPropFromPropertySignature(member) {
@@ -2563,21 +2813,21 @@ function resolveEmitPropFromPropertySignature(member) {
2563
2813
  if (!rawName) return null;
2564
2814
  const handlerName = resolveEmitHandlerName(rawName);
2565
2815
  const key = buildKey(handlerName);
2566
- const typeAnnotation = _optionalChain([member, 'access', _74 => _74.typeAnnotation, 'optionalAccess', _75 => _75.typeAnnotation]);
2816
+ const typeAnnotation = _optionalChain([member, 'access', _71 => _71.typeAnnotation, 'optionalAccess', _72 => _72.typeAnnotation]);
2567
2817
  let params = [];
2568
- let returnType = t25.tsAnyKeyword();
2569
- if (typeAnnotation && t25.isTSFunctionType(typeAnnotation)) {
2818
+ let returnType = t26.tsAnyKeyword();
2819
+ if (typeAnnotation && t26.isTSFunctionType(typeAnnotation)) {
2570
2820
  params = cloneCallableParams(typeAnnotation.parameters);
2571
- returnType = _nullishCoalesce(_optionalChain([typeAnnotation, 'access', _76 => _76.typeAnnotation, 'optionalAccess', _77 => _77.typeAnnotation]), () => ( returnType));
2572
- } else if (typeAnnotation && t25.isTSTupleType(typeAnnotation)) {
2821
+ returnType = _nullishCoalesce(_optionalChain([typeAnnotation, 'access', _73 => _73.typeAnnotation, 'optionalAccess', _74 => _74.typeAnnotation]), () => ( returnType));
2822
+ } else if (typeAnnotation && t26.isTSTupleType(typeAnnotation)) {
2573
2823
  params = resolveTupleTypeParams(typeAnnotation);
2574
2824
  } else if (typeAnnotation) {
2575
- const id = t25.identifier("value");
2576
- id.typeAnnotation = t25.tsTypeAnnotation(typeAnnotation);
2825
+ const id = t26.identifier("value");
2826
+ id.typeAnnotation = t26.tsTypeAnnotation(typeAnnotation);
2577
2827
  params = [id];
2578
2828
  }
2579
- const fnType = t25.tsFunctionType(null, params, t25.tsTypeAnnotation(returnType));
2580
- const prop = t25.tsPropertySignature(key, t25.tsTypeAnnotation(fnType));
2829
+ const fnType = t26.tsFunctionType(null, params, t26.tsTypeAnnotation(returnType));
2830
+ const prop = t26.tsPropertySignature(key, t26.tsTypeAnnotation(fnType));
2581
2831
  prop.optional = !!member.optional;
2582
2832
  return prop;
2583
2833
  }
@@ -2586,32 +2836,32 @@ function resolveEmitPropsFromCallSignature(member) {
2586
2836
  }
2587
2837
  function resolveEmitPropsFromCallable(parameters, typeAnnotation) {
2588
2838
  const [eventParam, ...restParams] = parameters;
2589
- if (!eventParam || !t25.isIdentifier(eventParam) || !eventParam.typeAnnotation) {
2839
+ if (!eventParam || !t26.isIdentifier(eventParam) || !eventParam.typeAnnotation) {
2590
2840
  return [];
2591
2841
  }
2592
2842
  const { typeAnnotation: paramTypeAnnotation } = eventParam;
2593
- if (t25.isNoop(paramTypeAnnotation)) return [];
2843
+ if (t26.isNoop(paramTypeAnnotation)) return [];
2594
2844
  const eventNames = resolveEventNames(paramTypeAnnotation.typeAnnotation);
2595
2845
  if (!eventNames.length) return [];
2596
- const returnType = _nullishCoalesce(_optionalChain([typeAnnotation, 'optionalAccess', _78 => _78.typeAnnotation]), () => ( t25.tsAnyKeyword()));
2846
+ const returnType = _nullishCoalesce(_optionalChain([typeAnnotation, 'optionalAccess', _75 => _75.typeAnnotation]), () => ( t26.tsAnyKeyword()));
2597
2847
  return eventNames.map((eventName) => {
2598
2848
  const handlerName = resolveEmitHandlerName(eventName);
2599
2849
  const key = buildKey(handlerName);
2600
2850
  const params = cloneCallableParams(restParams);
2601
- const fnType = t25.tsFunctionType(null, params, t25.tsTypeAnnotation(returnType));
2602
- const prop = t25.tsPropertySignature(key, t25.tsTypeAnnotation(fnType));
2851
+ const fnType = t26.tsFunctionType(null, params, t26.tsTypeAnnotation(returnType));
2852
+ const prop = t26.tsPropertySignature(key, t26.tsTypeAnnotation(fnType));
2603
2853
  prop.optional = true;
2604
2854
  return prop;
2605
2855
  });
2606
2856
  }
2607
2857
  function resolveEventNames(type) {
2608
- if (t25.isTSLiteralType(type) && t25.isStringLiteral(type.literal)) {
2858
+ if (t26.isTSLiteralType(type) && t26.isStringLiteral(type.literal)) {
2609
2859
  return [type.literal.value];
2610
2860
  }
2611
- if (t25.isTSUnionType(type)) {
2861
+ if (t26.isTSUnionType(type)) {
2612
2862
  return type.types.flatMap(resolveEventNames);
2613
2863
  }
2614
- if (t25.isTSParenthesizedType(type)) {
2864
+ if (t26.isTSParenthesizedType(type)) {
2615
2865
  return resolveEventNames(type.typeAnnotation);
2616
2866
  }
2617
2867
  return [];
@@ -2624,39 +2874,39 @@ function resolveTupleTypeParams(tuple) {
2624
2874
  return params;
2625
2875
  }
2626
2876
  function resolveTupleElementParam(element, index) {
2627
- const isNamedTuple = typeof t25.isTSNamedTupleMember === "function" && t25.isTSNamedTupleMember(element);
2877
+ const isNamedTuple = typeof t26.isTSNamedTupleMember === "function" && t26.isTSNamedTupleMember(element);
2628
2878
  if (isNamedTuple) {
2629
2879
  const tupleMember = element;
2630
- const name = _optionalChain([tupleMember, 'access', _79 => _79.label, 'optionalAccess', _80 => _80.name]) || `arg${index}`;
2880
+ const name = _optionalChain([tupleMember, 'access', _76 => _76.label, 'optionalAccess', _77 => _77.name]) || `arg${index}`;
2631
2881
  let innerType = tupleMember.elementType;
2632
2882
  let optional = tupleMember.optional;
2633
- if (t25.isTSOptionalType(innerType)) {
2883
+ if (t26.isTSOptionalType(innerType)) {
2634
2884
  optional = true;
2635
2885
  innerType = innerType.typeAnnotation;
2636
2886
  }
2637
- if (t25.isTSRestType(innerType)) {
2638
- const rest = t25.restElement(t25.identifier(name));
2639
- rest.typeAnnotation = t25.tsTypeAnnotation(innerType.typeAnnotation);
2887
+ if (t26.isTSRestType(innerType)) {
2888
+ const rest = t26.restElement(t26.identifier(name));
2889
+ rest.typeAnnotation = t26.tsTypeAnnotation(innerType.typeAnnotation);
2640
2890
  return rest;
2641
2891
  }
2642
- const id2 = t25.identifier(name);
2892
+ const id2 = t26.identifier(name);
2643
2893
  id2.optional = optional;
2644
- id2.typeAnnotation = t25.tsTypeAnnotation(innerType);
2894
+ id2.typeAnnotation = t26.tsTypeAnnotation(innerType);
2645
2895
  return id2;
2646
2896
  }
2647
- if (t25.isTSRestType(element)) {
2648
- const rest = t25.restElement(t25.identifier(`args${index}`));
2649
- rest.typeAnnotation = t25.tsTypeAnnotation(element.typeAnnotation);
2897
+ if (t26.isTSRestType(element)) {
2898
+ const rest = t26.restElement(t26.identifier(`args${index}`));
2899
+ rest.typeAnnotation = t26.tsTypeAnnotation(element.typeAnnotation);
2650
2900
  return rest;
2651
2901
  }
2652
- if (t25.isTSOptionalType(element)) {
2653
- const id2 = t25.identifier(`arg${index}`);
2902
+ if (t26.isTSOptionalType(element)) {
2903
+ const id2 = t26.identifier(`arg${index}`);
2654
2904
  id2.optional = true;
2655
- id2.typeAnnotation = t25.tsTypeAnnotation(element.typeAnnotation);
2905
+ id2.typeAnnotation = t26.tsTypeAnnotation(element.typeAnnotation);
2656
2906
  return id2;
2657
2907
  }
2658
- const id = t25.identifier(`arg${index}`);
2659
- id.typeAnnotation = t25.tsTypeAnnotation(element);
2908
+ const id = t26.identifier(`arg${index}`);
2909
+ id.typeAnnotation = t26.tsTypeAnnotation(element);
2660
2910
  return id;
2661
2911
  }
2662
2912
 
@@ -2665,8 +2915,8 @@ function resolveTupleElementParam(element, index) {
2665
2915
  function resolveDefinePropsIface(path7, ctx) {
2666
2916
  const { node } = path7;
2667
2917
  const [runtimeArg] = node.arguments;
2668
- const tsParams = _optionalChain([node, 'access', _81 => _81.typeParameters, 'optionalAccess', _82 => _82.params]);
2669
- if (_optionalChain([tsParams, 'optionalAccess', _83 => _83.length])) {
2918
+ const tsParams = _optionalChain([node, 'access', _78 => _78.typeParameters, 'optionalAccess', _79 => _79.params]);
2919
+ if (_optionalChain([tsParams, 'optionalAccess', _80 => _80.length])) {
2670
2920
  const { propsTSIface } = ctx.scriptData;
2671
2921
  propsTSIface.propsTypes = tsParams;
2672
2922
  return;
@@ -2681,38 +2931,38 @@ function processInferredTypes2(ctx, runtimeArg) {
2681
2931
  } = scriptData;
2682
2932
  if (!runtimeArg) return;
2683
2933
  const members = [];
2684
- if (t26.isArrayExpression(runtimeArg)) {
2934
+ if (t27.isArrayExpression(runtimeArg)) {
2685
2935
  for (const element of runtimeArg.elements) {
2686
- if (!element || !t26.isStringLiteral(element)) continue;
2687
- const key = t26.isValidIdentifier(element.value) ? t26.identifier(element.value) : t26.stringLiteral(element.value);
2688
- const prop = t26.tsPropertySignature(key, t26.tsTypeAnnotation(t26.tsAnyKeyword()));
2936
+ if (!element || !t27.isStringLiteral(element)) continue;
2937
+ const key = t27.isValidIdentifier(element.value) ? t27.identifier(element.value) : t27.stringLiteral(element.value);
2938
+ const prop = t27.tsPropertySignature(key, t27.tsTypeAnnotation(t27.tsAnyKeyword()));
2689
2939
  prop.optional = true;
2690
2940
  members.push(prop);
2691
2941
  }
2692
2942
  if (members.length) {
2693
- propsTypes.push(t26.tsTypeLiteral(members));
2943
+ propsTypes.push(t27.tsTypeLiteral(members));
2694
2944
  }
2695
2945
  return;
2696
2946
  }
2697
- if (t26.isObjectExpression(runtimeArg)) {
2947
+ if (t27.isObjectExpression(runtimeArg)) {
2698
2948
  for (const prop of runtimeArg.properties) {
2699
- if (!t26.isObjectProperty(prop)) continue;
2700
- if (t26.isSpreadElement(prop)) continue;
2949
+ if (!t27.isObjectProperty(prop)) continue;
2950
+ if (t27.isSpreadElement(prop)) continue;
2701
2951
  const key = prop.key;
2702
2952
  let propName = null;
2703
- if (t26.isIdentifier(key)) propName = key.name;
2704
- if (t26.isStringLiteral(key)) propName = key.value;
2705
- if (t26.isNumericLiteral(key)) propName = String(key.value);
2953
+ if (t27.isIdentifier(key)) propName = key.name;
2954
+ if (t27.isStringLiteral(key)) propName = key.value;
2955
+ if (t27.isNumericLiteral(key)) propName = String(key.value);
2706
2956
  if (!propName) continue;
2707
2957
  const { type, required } = resolveRuntimePropMeta(prop.value);
2708
- const tsType = _nullishCoalesce(type, () => ( t26.tsAnyKeyword()));
2709
- const tsKey = t26.isValidIdentifier(propName) ? t26.identifier(propName) : t26.stringLiteral(propName);
2710
- const tsProp = t26.tsPropertySignature(tsKey, t26.tsTypeAnnotation(tsType));
2958
+ const tsType = _nullishCoalesce(type, () => ( t27.tsAnyKeyword()));
2959
+ const tsKey = t27.isValidIdentifier(propName) ? t27.identifier(propName) : t27.stringLiteral(propName);
2960
+ const tsProp = t27.tsPropertySignature(tsKey, t27.tsTypeAnnotation(tsType));
2711
2961
  tsProp.optional = !required;
2712
2962
  members.push(tsProp);
2713
2963
  }
2714
2964
  if (members.length) {
2715
- propsTypes.push(t26.tsTypeLiteral(members));
2965
+ propsTypes.push(t27.tsTypeLiteral(members));
2716
2966
  }
2717
2967
  return;
2718
2968
  }
@@ -2721,47 +2971,47 @@ function processInferredTypes2(ctx, runtimeArg) {
2721
2971
  {
2722
2972
  source,
2723
2973
  file: filename,
2724
- loc: _optionalChain([runtimeArg, 'optionalAccess', _84 => _84.loc])
2974
+ loc: _optionalChain([runtimeArg, 'optionalAccess', _81 => _81.loc])
2725
2975
  }
2726
2976
  );
2727
2977
  }
2728
2978
  function resolveRuntimePropMeta(value) {
2729
- if (t26.isIdentifier(value)) {
2979
+ if (t27.isIdentifier(value)) {
2730
2980
  return {
2731
2981
  type: mapRuntimeTypeToTSType(value),
2732
2982
  required: false
2733
2983
  };
2734
2984
  }
2735
- if (t26.isArrayExpression(value)) {
2985
+ if (t27.isArrayExpression(value)) {
2736
2986
  return {
2737
2987
  type: resolveRuntimeUnionType(value),
2738
2988
  required: false
2739
2989
  };
2740
2990
  }
2741
- if (!t26.isObjectExpression(value)) {
2991
+ if (!t27.isObjectExpression(value)) {
2742
2992
  return { required: false };
2743
2993
  }
2744
2994
  let type;
2745
2995
  let required = false;
2746
2996
  for (const prop of value.properties) {
2747
- if (!t26.isObjectProperty(prop)) continue;
2748
- if (t26.isSpreadElement(prop)) continue;
2997
+ if (!t27.isObjectProperty(prop)) continue;
2998
+ if (t27.isSpreadElement(prop)) continue;
2749
2999
  const key = prop.key;
2750
- const propName = t26.isIdentifier(key) ? key.name : t26.isStringLiteral(key) ? key.value : null;
3000
+ const propName = t27.isIdentifier(key) ? key.name : t27.isStringLiteral(key) ? key.value : null;
2751
3001
  if (!propName) continue;
2752
3002
  if (propName === "type") {
2753
3003
  const valueNode = prop.value;
2754
- if (t26.isArrayExpression(valueNode)) {
3004
+ if (t27.isArrayExpression(valueNode)) {
2755
3005
  type = resolveRuntimeUnionType(valueNode);
2756
3006
  continue;
2757
3007
  }
2758
- if (t26.isIdentifier(valueNode)) {
3008
+ if (t27.isIdentifier(valueNode)) {
2759
3009
  type = mapRuntimeTypeToTSType(valueNode);
2760
3010
  continue;
2761
3011
  }
2762
3012
  }
2763
3013
  if (propName === "required") {
2764
- if (t26.isBooleanLiteral(prop.value)) {
3014
+ if (t27.isBooleanLiteral(prop.value)) {
2765
3015
  required = prop.value.value;
2766
3016
  }
2767
3017
  }
@@ -2771,34 +3021,34 @@ function resolveRuntimePropMeta(value) {
2771
3021
  function resolveRuntimeUnionType(value) {
2772
3022
  const types = [];
2773
3023
  for (const element of value.elements) {
2774
- if (!element || !t26.isIdentifier(element)) continue;
3024
+ if (!element || !t27.isIdentifier(element)) continue;
2775
3025
  const resolved = mapRuntimeTypeToTSType(element);
2776
3026
  if (resolved) types.push(resolved);
2777
3027
  }
2778
- if (!types.length) return t26.tsAnyKeyword();
3028
+ if (!types.length) return t27.tsAnyKeyword();
2779
3029
  if (types.length === 1) return types[0];
2780
- return t26.tsUnionType(types);
3030
+ return t27.tsUnionType(types);
2781
3031
  }
2782
3032
  function mapRuntimeTypeToTSType(value) {
2783
3033
  switch (value.name) {
2784
3034
  case "String":
2785
- return t26.tsStringKeyword();
3035
+ return t27.tsStringKeyword();
2786
3036
  case "Number":
2787
- return t26.tsNumberKeyword();
3037
+ return t27.tsNumberKeyword();
2788
3038
  case "Boolean":
2789
- return t26.tsBooleanKeyword();
3039
+ return t27.tsBooleanKeyword();
2790
3040
  case "Object":
2791
- return t26.tsTypeLiteral([]);
3041
+ return t27.tsTypeLiteral([]);
2792
3042
  case "Array":
2793
- return t26.tsArrayType(t26.tsAnyKeyword());
3043
+ return t27.tsArrayType(t27.tsAnyKeyword());
2794
3044
  case "Function":
2795
- return t26.tsFunctionType(null, [], t26.tsTypeAnnotation(t26.tsAnyKeyword()));
3045
+ return t27.tsFunctionType(null, [], t27.tsTypeAnnotation(t27.tsAnyKeyword()));
2796
3046
  case "Symbol":
2797
- return t26.tsSymbolKeyword();
3047
+ return t27.tsSymbolKeyword();
2798
3048
  case "BigInt":
2799
- return t26.tsBigIntKeyword();
3049
+ return t27.tsBigIntKeyword();
2800
3050
  default:
2801
- return t26.tsAnyKeyword();
3051
+ return t27.tsAnyKeyword();
2802
3052
  }
2803
3053
  }
2804
3054
 
@@ -2810,19 +3060,19 @@ var SLOT_FN_PARAM_NAME = "props";
2810
3060
  function resolveSlotsTopLevelTypes(ctx) {
2811
3061
  return {
2812
3062
  "TSInterfaceDeclaration|TSTypeAliasDeclaration"(path7) {
2813
- if (!t27.isProgram(path7.parent)) return;
3063
+ if (!t28.isProgram(path7.parent)) return;
2814
3064
  const { node } = path7;
2815
- if (t27.isTSInterfaceDeclaration(node)) {
2816
- const typeLiteral = t27.tsTypeLiteral(node.body.body);
3065
+ if (t28.isTSInterfaceDeclaration(node)) {
3066
+ const typeLiteral = t28.tsTypeLiteral(node.body.body);
2817
3067
  if (!hasSlotsSignatureInType(typeLiteral)) return;
2818
3068
  const resolved = resolveSlotType(typeLiteral);
2819
- if (resolved && t27.isTSTypeLiteral(resolved)) {
3069
+ if (resolved && t28.isTSTypeLiteral(resolved)) {
2820
3070
  node.body.body = resolved.members;
2821
3071
  recordReactNode(ctx);
2822
3072
  }
2823
3073
  return;
2824
3074
  }
2825
- if (t27.isTSTypeAliasDeclaration(node)) {
3075
+ if (t28.isTSTypeAliasDeclaration(node)) {
2826
3076
  if (!hasSlotsSignatureInType(node.typeAnnotation)) return;
2827
3077
  const resolved = resolveSlotType(node.typeAnnotation);
2828
3078
  if (resolved) {
@@ -2835,8 +3085,8 @@ function resolveSlotsTopLevelTypes(ctx) {
2835
3085
  }
2836
3086
  function resolveDefineSlotsIface(path7, ctx) {
2837
3087
  const { node } = path7;
2838
- const tsParams = _optionalChain([node, 'access', _85 => _85.typeParameters, 'optionalAccess', _86 => _86.params]);
2839
- if (!_optionalChain([tsParams, 'optionalAccess', _87 => _87.length])) return;
3088
+ const tsParams = _optionalChain([node, 'access', _82 => _82.typeParameters, 'optionalAccess', _83 => _83.params]);
3089
+ if (!_optionalChain([tsParams, 'optionalAccess', _84 => _84.length])) return;
2840
3090
  const {
2841
3091
  propsTSIface: { slotTypes }
2842
3092
  } = ctx.scriptData;
@@ -2867,7 +3117,7 @@ function resolveTemplateSlotIface(ctx) {
2867
3117
  }
2868
3118
  if (tsMembers.length) {
2869
3119
  recordReactNode(ctx);
2870
- slotTypes.push(t27.tsTypeLiteral(tsMembers));
3120
+ slotTypes.push(t28.tsTypeLiteral(tsMembers));
2871
3121
  }
2872
3122
  }
2873
3123
  function recordReactNode(ctx) {
@@ -2877,32 +3127,32 @@ function recordReactNode(ctx) {
2877
3127
  recordImport(ctx, PACKAGE_NAME.react, REACT_API_MAP.ReactNode);
2878
3128
  }
2879
3129
  function resolveSlotType(tsType) {
2880
- if (t27.isTSParenthesizedType(tsType)) {
3130
+ if (t28.isTSParenthesizedType(tsType)) {
2881
3131
  return resolveSlotType(tsType.typeAnnotation);
2882
3132
  }
2883
- if (t27.isTSTypeReference(tsType)) {
3133
+ if (t28.isTSTypeReference(tsType)) {
2884
3134
  if (!tsType.typeParameters || !tsType.typeParameters.params.length) {
2885
3135
  return tsType;
2886
3136
  }
2887
3137
  const params = tsType.typeParameters.params.map((param) => resolveSlotType(param)).filter(Boolean);
2888
- return t27.tsTypeReference(
3138
+ return t28.tsTypeReference(
2889
3139
  tsType.typeName,
2890
- t27.tsTypeParameterInstantiation(params.length ? params : tsType.typeParameters.params)
3140
+ t28.tsTypeParameterInstantiation(params.length ? params : tsType.typeParameters.params)
2891
3141
  );
2892
3142
  }
2893
- if (t27.isTSIntersectionType(tsType)) {
3143
+ if (t28.isTSIntersectionType(tsType)) {
2894
3144
  const types = tsType.types.map(resolveSlotType).filter(Boolean);
2895
3145
  if (!types.length) return null;
2896
3146
  if (types.length === 1) return types[0];
2897
- return t27.tsIntersectionType(types);
3147
+ return t28.tsIntersectionType(types);
2898
3148
  }
2899
- if (t27.isTSUnionType(tsType)) {
3149
+ if (t28.isTSUnionType(tsType)) {
2900
3150
  const types = tsType.types.map(resolveSlotType).filter(Boolean);
2901
3151
  if (!types.length) return null;
2902
3152
  if (types.length === 1) return types[0];
2903
- return t27.tsUnionType(types);
3153
+ return t28.tsUnionType(types);
2904
3154
  }
2905
- if (t27.isTSTypeLiteral(tsType)) {
3155
+ if (t28.isTSTypeLiteral(tsType)) {
2906
3156
  const members = [];
2907
3157
  for (const member of tsType.members) {
2908
3158
  const resolved = resolveSlotPropFromMember(member);
@@ -2913,110 +3163,110 @@ function resolveSlotType(tsType) {
2913
3163
  members.push(member);
2914
3164
  }
2915
3165
  if (!members.length) return null;
2916
- return t27.tsTypeLiteral(members);
3166
+ return t28.tsTypeLiteral(members);
2917
3167
  }
2918
- if (t27.isTSFunctionType(tsType)) {
3168
+ if (t28.isTSFunctionType(tsType)) {
2919
3169
  const props = buildSlotPropSignature(
2920
3170
  SLOT_DEFAULT_NAME,
2921
3171
  cloneCallableParams(tsType.parameters),
2922
3172
  false
2923
3173
  );
2924
- return t27.tsTypeLiteral([props]);
3174
+ return t28.tsTypeLiteral([props]);
2925
3175
  }
2926
3176
  return tsType;
2927
3177
  }
2928
3178
  function hasSlotsSignatureInType(tsType) {
2929
- if (t27.isTSParenthesizedType(tsType)) {
3179
+ if (t28.isTSParenthesizedType(tsType)) {
2930
3180
  return hasSlotsSignatureInType(tsType.typeAnnotation);
2931
3181
  }
2932
- if (t27.isTSTypeReference(tsType)) {
3182
+ if (t28.isTSTypeReference(tsType)) {
2933
3183
  if (!tsType.typeParameters || !tsType.typeParameters.params.length) {
2934
3184
  return false;
2935
3185
  }
2936
3186
  return tsType.typeParameters.params.some(hasSlotsSignatureInType);
2937
3187
  }
2938
- if (t27.isTSIntersectionType(tsType) || t27.isTSUnionType(tsType)) {
3188
+ if (t28.isTSIntersectionType(tsType) || t28.isTSUnionType(tsType)) {
2939
3189
  return tsType.types.some(hasSlotsSignatureInType);
2940
3190
  }
2941
- if (t27.isTSTypeLiteral(tsType)) {
3191
+ if (t28.isTSTypeLiteral(tsType)) {
2942
3192
  return tsType.members.some(hasSlotsSignatureInMember);
2943
3193
  }
2944
- if (t27.isTSFunctionType(tsType)) {
3194
+ if (t28.isTSFunctionType(tsType)) {
2945
3195
  return true;
2946
3196
  }
2947
3197
  return false;
2948
3198
  }
2949
3199
  function hasSlotsSignatureInMember(member) {
2950
- if (t27.isTSMethodSignature(member)) return true;
2951
- if (t27.isTSCallSignatureDeclaration(member)) return true;
2952
- if (t27.isTSPropertySignature(member)) {
2953
- const typeAnnotation = _optionalChain([member, 'access', _88 => _88.typeAnnotation, 'optionalAccess', _89 => _89.typeAnnotation]);
3200
+ if (t28.isTSMethodSignature(member)) return true;
3201
+ if (t28.isTSCallSignatureDeclaration(member)) return true;
3202
+ if (t28.isTSPropertySignature(member)) {
3203
+ const typeAnnotation = _optionalChain([member, 'access', _85 => _85.typeAnnotation, 'optionalAccess', _86 => _86.typeAnnotation]);
2954
3204
  return !!(typeAnnotation && resolveCallableType(typeAnnotation));
2955
3205
  }
2956
3206
  return false;
2957
3207
  }
2958
3208
  function resolveSlotPropFromMember(member) {
2959
- if (t27.isTSMethodSignature(member)) {
3209
+ if (t28.isTSMethodSignature(member)) {
2960
3210
  const rawName = resolvePropName2(member.key);
2961
3211
  if (!rawName) return null;
2962
3212
  const params = cloneCallableParams(member.parameters);
2963
3213
  return buildSlotPropSignature(rawName, params, !!member.optional);
2964
3214
  }
2965
- if (t27.isTSPropertySignature(member)) {
3215
+ if (t28.isTSPropertySignature(member)) {
2966
3216
  const rawName = resolvePropName2(member.key);
2967
3217
  if (!rawName) return null;
2968
- const typeAnnotation = _optionalChain([member, 'access', _90 => _90.typeAnnotation, 'optionalAccess', _91 => _91.typeAnnotation]);
3218
+ const typeAnnotation = _optionalChain([member, 'access', _87 => _87.typeAnnotation, 'optionalAccess', _88 => _88.typeAnnotation]);
2969
3219
  const callable = typeAnnotation ? resolveCallableType(typeAnnotation) : null;
2970
3220
  if (!callable) return null;
2971
3221
  const params = cloneCallableParams(callable.parameters);
2972
3222
  return buildSlotPropSignature(rawName, params, !!member.optional);
2973
3223
  }
2974
- if (t27.isTSCallSignatureDeclaration(member)) {
3224
+ if (t28.isTSCallSignatureDeclaration(member)) {
2975
3225
  const params = cloneCallableParams(member.parameters);
2976
3226
  return buildSlotPropSignature(SLOT_DEFAULT_NAME, params, true);
2977
3227
  }
2978
3228
  return null;
2979
3229
  }
2980
3230
  function resolveCallableType(tsType) {
2981
- if (t27.isTSFunctionType(tsType)) return tsType;
2982
- if (t27.isTSParenthesizedType(tsType)) return resolveCallableType(tsType.typeAnnotation);
3231
+ if (t28.isTSFunctionType(tsType)) return tsType;
3232
+ if (t28.isTSParenthesizedType(tsType)) return resolveCallableType(tsType.typeAnnotation);
2983
3233
  return null;
2984
3234
  }
2985
3235
  function buildSlotPropSignature(rawName, params, optional) {
2986
3236
  const propName = rawName === SLOT_DEFAULT_NAME ? SLOT_CHILDREN_NAME : rawName;
2987
- const key = t27.isValidIdentifier(propName) ? t27.identifier(propName) : t27.stringLiteral(propName);
2988
- const reactNodeType = t27.tsTypeAnnotation(
2989
- t27.tsTypeReference(t27.identifier(REACT_API_MAP.ReactNode))
3237
+ const key = t28.isValidIdentifier(propName) ? t28.identifier(propName) : t28.stringLiteral(propName);
3238
+ const reactNodeType = t28.tsTypeAnnotation(
3239
+ t28.tsTypeReference(t28.identifier(REACT_API_MAP.ReactNode))
2990
3240
  );
2991
3241
  let typeAnnotation;
2992
3242
  if (rawName === SLOT_DEFAULT_NAME && params.length === 0 || params.length === 0) {
2993
3243
  typeAnnotation = reactNodeType;
2994
3244
  } else {
2995
- const fnType = t27.tsFunctionType(null, params, reactNodeType);
2996
- typeAnnotation = t27.tsTypeAnnotation(fnType);
3245
+ const fnType = t28.tsFunctionType(null, params, reactNodeType);
3246
+ typeAnnotation = t28.tsTypeAnnotation(fnType);
2997
3247
  }
2998
- const prop = t27.tsPropertySignature(key, typeAnnotation);
3248
+ const prop = t28.tsPropertySignature(key, typeAnnotation);
2999
3249
  prop.optional = optional;
3000
3250
  return prop;
3001
3251
  }
3002
3252
  function createSlotScopeParam(props, ctx) {
3003
- const paramId = t27.identifier(SLOT_FN_PARAM_NAME);
3253
+ const paramId = t28.identifier(SLOT_FN_PARAM_NAME);
3004
3254
  const propsSigns = [];
3005
3255
  const { reactiveBindings } = ctx.templateData;
3006
3256
  props.forEach(({ prop, tsType }) => {
3007
- const foundBindingValue = _optionalChain([reactiveBindings, 'access', _92 => _92[prop], 'optionalAccess', _93 => _93.value]);
3257
+ const foundBindingValue = _optionalChain([reactiveBindings, 'access', _89 => _89[prop], 'optionalAccess', _90 => _90.value]);
3008
3258
  const foundBindingTypes = foundBindingValue ? expressionToTSType(foundBindingValue) : null;
3009
- const typeAnnotation = foundBindingTypes ? t27.tsTypeAnnotation(foundBindingTypes) : tsType;
3010
- const propSign = t27.tsPropertySignature(t27.identifier(prop), typeAnnotation);
3259
+ const typeAnnotation = foundBindingTypes ? t28.tsTypeAnnotation(foundBindingTypes) : tsType;
3260
+ const propSign = t28.tsPropertySignature(t28.identifier(prop), typeAnnotation);
3011
3261
  propsSigns.push(propSign);
3012
3262
  });
3013
- paramId.typeAnnotation = t27.tsTypeAnnotation(t27.tsTypeLiteral(propsSigns));
3263
+ paramId.typeAnnotation = t28.tsTypeAnnotation(t28.tsTypeLiteral(propsSigns));
3014
3264
  return paramId;
3015
3265
  }
3016
3266
  function resolvePropName2(key) {
3017
- if (t27.isIdentifier(key)) return key.name;
3018
- if (t27.isStringLiteral(key)) return key.value;
3019
- if (t27.isNumericLiteral(key)) return String(key.value);
3267
+ if (t28.isIdentifier(key)) return key.name;
3268
+ if (t28.isStringLiteral(key)) return key.value;
3269
+ if (t28.isNumericLiteral(key)) return String(key.value);
3020
3270
  return null;
3021
3271
  }
3022
3272
 
@@ -3068,65 +3318,17 @@ function resolveCompIProps(ctx, ast) {
3068
3318
  }
3069
3319
  const n = ctx.compName || "Comp";
3070
3320
  const ns = `I${camelCase(capitalize(n))}Props`;
3071
- const typeNode = t28.tsIntersectionType(tsTypes);
3072
- const typeAliasDecl = t28.tsTypeAliasDeclaration(t28.identifier(ns), null, typeNode);
3073
- const exportDecl = t28.exportNamedDeclaration(typeAliasDecl);
3321
+ const typeNode = t29.tsIntersectionType(tsTypes);
3322
+ const typeAliasDecl = t29.tsTypeAliasDeclaration(t29.identifier(ns), null, typeNode);
3323
+ const exportDecl = t29.exportNamedDeclaration(typeAliasDecl);
3074
3324
  propsTSIface.name = ns;
3075
3325
  const scriptIR = getScriptIR(ctx);
3076
3326
  scriptIR.exports.push(exportDecl);
3077
3327
  void ast;
3078
3328
  }
3079
3329
 
3080
- // src/core/transform/sfc/script/syntax-processor/process/lint-rules.ts
3330
+ // src/core/transform/sfc/script/syntax-processor/process/resolve-analysis-only-adapter.ts
3081
3331
 
3082
- function lintRules(ctx, ast) {
3083
- const inScriptFile = ctx.inputType !== "sfc";
3084
- return {
3085
- CallExpression(path7) {
3086
- const { node, parentPath } = path7;
3087
- if (!t29.isIdentifier(node.callee)) return;
3088
- const { name: callName } = node.callee;
3089
- const addLog = (t40) => {
3090
- logger.error(t40, {
3091
- file: ctx.filename,
3092
- source: ctx.scriptData.source,
3093
- loc: node.loc
3094
- });
3095
- };
3096
- const lintMacros = () => {
3097
- const macro = Object.values(MACRO_API_NAMES).find((v) => v === callName);
3098
- if (!macro) return;
3099
- if (inScriptFile) {
3100
- addLog(
3101
- `The ${macro} can only be used inside Vue SFC <script> blocks, not in separate script files.`
3102
- );
3103
- return;
3104
- }
3105
- if (!atComponentOrHookRoot(path7, ast.program)) {
3106
- addLog(
3107
- `The ${macro} must be defined at the top level of the component, not inside blocks or functions.`
3108
- );
3109
- return;
3110
- }
3111
- if (!parentPath.isVariableDeclarator()) {
3112
- addLog(
3113
- `The ${macro} macro must be assigned to a variable (e.g., const props = defineProps(...)).`
3114
- );
3115
- }
3116
- };
3117
- const lintHooks = () => {
3118
- if (!callName.startsWith("use")) return;
3119
- if (!atComponentOrHookRoot(path7, ast.program, inScriptFile)) {
3120
- addLog(
3121
- `The ${callName} hook must be called at the top level, not inside loops, conditions, or nested functions.`
3122
- );
3123
- }
3124
- };
3125
- lintMacros();
3126
- lintHooks();
3127
- }
3128
- };
3129
- }
3130
3332
 
3131
3333
  // src/core/transform/sfc/script/shared/dependency-analyzer.ts
3132
3334
 
@@ -3252,7 +3454,7 @@ function analyzeDeps(node, ctx, parentPath) {
3252
3454
  const declaratorPath = getVariableDeclaratorPath(bindingPath);
3253
3455
  const isImportBinding = bindingPath.isImportSpecifier() || bindingPath.isImportDefaultSpecifier() || bindingPath.isImportNamespaceSpecifier();
3254
3456
  const isReactiveVarBinding = !!declaratorPath && isReactiveBinding(declaratorPath.node);
3255
- const nodeInit = _optionalChain([declaratorPath, 'optionalAccess', _94 => _94.node, 'access', _95 => _95.init]);
3457
+ const nodeInit = _optionalChain([declaratorPath, 'optionalAccess', _91 => _91.node, 'access', _92 => _92.init]);
3256
3458
  const isReactiveApiCallVarBinding = !!declaratorPath && t30.isCallExpression(nodeInit) && t30.isIdentifier(nodeInit.callee) && reactiveStateApis.has(nodeInit.callee.name);
3257
3459
  const isHookCallVarBinding = !!declaratorPath && t30.isCallExpression(nodeInit) && isHookLikeCallee(nodeInit.callee);
3258
3460
  const isFunctionBinding = bindingPath.isFunctionDeclaration() || !!declaratorPath && !!nodeInit && (t30.isArrowFunctionExpression(nodeInit) || t30.isFunctionExpression(nodeInit));
@@ -3365,7 +3567,7 @@ function isNestedMemberObject(path7) {
3365
3567
  }
3366
3568
  function isReactiveBinding(node) {
3367
3569
  if (!node) return false;
3368
- return !!_optionalChain([getScriptNodeMeta, 'call', _96 => _96(node), 'optionalAccess', _97 => _97.is_reactive]);
3570
+ return !!_optionalChain([getScriptNodeMeta, 'call', _93 => _93(node), 'optionalAccess', _94 => _94.is_reactive]);
3369
3571
  }
3370
3572
  function markAsAnalyzed(node, flag = true) {
3371
3573
  const analyzed = getIsAnalyzed(node);
@@ -3373,22 +3575,51 @@ function markAsAnalyzed(node, flag = true) {
3373
3575
  setScriptNodeMeta(node, { is_deps_analyzed: flag });
3374
3576
  }
3375
3577
  function getIsAnalyzed(node) {
3376
- return _optionalChain([getScriptNodeMeta, 'call', _98 => _98(node), 'optionalAccess', _99 => _99.is_deps_analyzed]);
3578
+ return _optionalChain([getScriptNodeMeta, 'call', _95 => _95(node), 'optionalAccess', _96 => _96.is_deps_analyzed]);
3377
3579
  }
3378
3580
 
3379
- // src/core/transform/sfc/script/shared/hook-creator.ts
3380
-
3381
- function createUseCallback(body, deps) {
3382
- return t31.callExpression(t31.identifier(REACT_API_MAP.useCallback), [
3383
- body,
3384
- _nullishCoalesce(deps, () => ( t31.arrayExpression([])))
3385
- ]);
3581
+ // src/core/transform/sfc/script/syntax-processor/process/resolve-analysis-only-adapter.ts
3582
+ function resolveAnalysisOnlyAdapter(ctx) {
3583
+ return {
3584
+ "CallExpression|Identifier"(path7) {
3585
+ const node = path7.node;
3586
+ const apiName = getApiName(node);
3587
+ const adapter = ADAPTER_RULES.runtime[apiName];
3588
+ if (!adapter || adapter.type !== "analyzed-deps") {
3589
+ return;
3590
+ }
3591
+ if (t31.isCallExpression(node)) {
3592
+ resolveCallNode(path7, adapter, ctx);
3593
+ } else {
3594
+ replaceIdName(node, adapter.target);
3595
+ }
3596
+ recordImport(ctx, adapter.package, adapter.target);
3597
+ }
3598
+ };
3386
3599
  }
3387
- function createUseMemo(body, deps) {
3388
- return t31.callExpression(t31.identifier(REACT_API_MAP.useMemo), [
3389
- t31.arrowFunctionExpression([], body),
3390
- _nullishCoalesce(deps, () => ( t31.arrayExpression([])))
3391
- ]);
3600
+ function getApiName(node) {
3601
+ const isCallNode = t31.isCallExpression(node);
3602
+ let apiName = "";
3603
+ if (t31.isIdentifier(node)) {
3604
+ apiName = node.name;
3605
+ } else if (isCallNode && t31.isIdentifier(node.callee)) {
3606
+ apiName = node.callee.name;
3607
+ }
3608
+ return apiName;
3609
+ }
3610
+ function resolveCallNode(path7, adapter, ctx) {
3611
+ const { node } = path7;
3612
+ const { arguments: args } = node;
3613
+ if (!args.length) return;
3614
+ const fn = args[0];
3615
+ if (!t31.isArrowFunctionExpression(fn) && !t31.isFunctionExpression(fn)) {
3616
+ return;
3617
+ }
3618
+ const fnPath = path7.get("arguments")[0];
3619
+ const deps = analyzeDeps(fn, ctx, fnPath);
3620
+ args.push(deps);
3621
+ replaceCallName(node, adapter.target);
3622
+ recordImport(ctx, adapter.package, adapter.target);
3392
3623
  }
3393
3624
 
3394
3625
  // src/core/transform/sfc/script/syntax-processor/process/resolve-arrow-deps.ts
@@ -3405,7 +3636,7 @@ function resolveArrowFnDeps(ctx, ast) {
3405
3636
  const declaratorPath = getVariableDeclaratorPath(path7);
3406
3637
  markAsAnalyzed(newNode.arguments[0]);
3407
3638
  recordImport(ctx, PACKAGE_NAME.react, REACT_API_MAP.useCallback);
3408
- setScriptNodeMeta(_optionalChain([declaratorPath, 'optionalAccess', _100 => _100.node]), { is_reactive: true, reactive_type: "indirect" });
3639
+ setScriptNodeMeta(_optionalChain([declaratorPath, 'optionalAccess', _97 => _97.node]), { is_reactive: true, reactive_type: "indirect" });
3409
3640
  path7.replaceWith(newNode);
3410
3641
  }
3411
3642
  };
@@ -3418,7 +3649,7 @@ function resolveUnanalyzedArrow(ctx) {
3418
3649
  if (typeof analyzed === "undefined" || analyzed) return;
3419
3650
  const newNode = createUseCallback(node);
3420
3651
  const declaratorPath = getVariableDeclaratorPath(path7);
3421
- if (_optionalChain([declaratorPath, 'optionalAccess', _101 => _101.node])) {
3652
+ if (_optionalChain([declaratorPath, 'optionalAccess', _98 => _98.node])) {
3422
3653
  setScriptNodeMeta(declaratorPath.node, { is_reactive: true, reactive_type: "indirect" });
3423
3654
  }
3424
3655
  markAsAnalyzed(newNode.arguments[0]);
@@ -3462,6 +3693,76 @@ function isSkip(path7) {
3462
3693
  return (isCallback() || isMethod() || !isVariableDecl()) && !isReturnFunc();
3463
3694
  }
3464
3695
 
3696
+ // src/core/transform/sfc/script/syntax-processor/process/resolve-element-ref.ts
3697
+
3698
+ function resolveElementRef(ctx) {
3699
+ return {
3700
+ CallExpression(path7) {
3701
+ const {
3702
+ inputType,
3703
+ templateData: { refBindings }
3704
+ } = ctx;
3705
+ if (inputType !== "sfc") return;
3706
+ const { node } = path7;
3707
+ const isUseTemplateRef = isCalleeNamed(node, VUE_API_MAP.useTemplateRef);
3708
+ const isCompRefBindings = Object.keys(refBindings.componentRefs).length > 0 && isCalleeNamed(node, VUE_API_MAP.ref);
3709
+ const shouldProcess = isUseTemplateRef || isCompRefBindings;
3710
+ if (!shouldProcess) {
3711
+ return;
3712
+ }
3713
+ if (isCompRefBindings) {
3714
+ const varDeclaratorPath = _optionalChain([getVariableDeclaratorPath, 'call', _99 => _99(path7), 'optionalAccess', _100 => _100.node]);
3715
+ if (!t32.isIdentifier(_optionalChain([varDeclaratorPath, 'optionalAccess', _101 => _101.id]))) {
3716
+ return;
3717
+ }
3718
+ const varName = varDeclaratorPath.id.name;
3719
+ const compRef = refBindings.componentRefs[varName];
3720
+ if (!compRef) return;
3721
+ }
3722
+ node.arguments[0] = t32.identifier("null");
3723
+ resolveTypeParameters(ctx, path7);
3724
+ replaceCallName(node, REACT_API_MAP.useRef);
3725
+ recordImport(ctx, PACKAGE_NAME.react, REACT_API_MAP.useRef);
3726
+ },
3727
+ MemberExpression(path7) {
3728
+ resolveRefValueToCurrent(path7);
3729
+ }
3730
+ };
3731
+ }
3732
+ function resolveTypeParameters(ctx, path7) {
3733
+ const {
3734
+ templateData: { refBindings },
3735
+ scriptData
3736
+ } = ctx;
3737
+ const { node } = path7;
3738
+ const varDeclaratorNode = _optionalChain([getVariableDeclaratorPath, 'call', _102 => _102(path7), 'optionalAccess', _103 => _103.node]);
3739
+ if (!scriptData.lang.startsWith("ts") || !varDeclaratorNode) {
3740
+ return;
3741
+ }
3742
+ const idName = varDeclaratorNode.id.name;
3743
+ const domBindingMeta = refBindings.domRefs[idName];
3744
+ const compBindingMeta = refBindings.componentRefs[idName];
3745
+ if (!node.typeParameters && (domBindingMeta || compBindingMeta)) {
3746
+ const type = compBindingMeta ? "any" : domBindingMeta.htmlType;
3747
+ node.typeParameters = t32.tsTypeParameterInstantiation([t32.tsTypeReference(t32.identifier(type))]);
3748
+ }
3749
+ }
3750
+ function resolveRefValueToCurrent(path7) {
3751
+ const { node } = path7;
3752
+ if (node.computed || !t32.isIdentifier(node.property) || node.property.name !== "value") {
3753
+ return;
3754
+ }
3755
+ const rootPath = findRootVariablePath(path7);
3756
+ if (!_optionalChain([rootPath, 'optionalAccess', _104 => _104.node]) || !t32.isCallExpression(rootPath.node.init) || !isCalleeNamed(rootPath.node.init, REACT_API_MAP.useRef)) {
3757
+ return;
3758
+ }
3759
+ const rootId = findRootIdentifier(node);
3760
+ if (!t32.isIdentifier(node.object) || node.object.name !== _optionalChain([rootId, 'optionalAccess', _105 => _105.name])) {
3761
+ return;
3762
+ }
3763
+ node.property.name = "current";
3764
+ }
3765
+
3465
3766
  // src/core/transform/sfc/script/syntax-processor/process/resolve-expression-memo.ts
3466
3767
 
3467
3768
  function resolveExprMemo(ctx, ast) {
@@ -3475,7 +3776,7 @@ function resolveExprMemo(ctx, ast) {
3475
3776
  if (!atComponentOrHookRoot(path7, ast.program, isScriptFile)) {
3476
3777
  return false;
3477
3778
  }
3478
- if (t32.isCallExpression(init) && t32.isIdentifier(init.callee) && init.callee.name.startsWith("use")) {
3779
+ if (t33.isCallExpression(init) && t33.isIdentifier(init.callee) && init.callee.name.startsWith("use")) {
3479
3780
  return false;
3480
3781
  }
3481
3782
  return true;
@@ -3492,6 +3793,59 @@ function resolveExprMemo(ctx, ast) {
3492
3793
  };
3493
3794
  }
3494
3795
 
3796
+ // src/core/transform/sfc/script/syntax-processor/process/resolve-lint-rules.ts
3797
+
3798
+ function resolveLintRules(ctx, ast) {
3799
+ const inScriptFile = ctx.inputType !== "sfc";
3800
+ return {
3801
+ CallExpression(path7) {
3802
+ const { node, parentPath } = path7;
3803
+ if (!t34.isIdentifier(node.callee)) return;
3804
+ const { name: callName } = node.callee;
3805
+ const addLog = (t41) => {
3806
+ logger.error(t41, {
3807
+ file: ctx.filename,
3808
+ source: ctx.scriptData.source,
3809
+ loc: node.loc
3810
+ });
3811
+ };
3812
+ const lintMacros = () => {
3813
+ const macro = Object.values(MACRO_API_NAMES).find((v) => v === callName);
3814
+ if (!macro) return;
3815
+ if (inScriptFile) {
3816
+ addLog(
3817
+ `The ${macro} can only be used inside Vue SFC <script> blocks, not in separate script files.`
3818
+ );
3819
+ return;
3820
+ }
3821
+ if (!atComponentOrHookRoot(path7, ast.program)) {
3822
+ addLog(
3823
+ `The ${macro} must be defined at the top level of the component, not inside blocks or functions.`
3824
+ );
3825
+ return;
3826
+ }
3827
+ if (!parentPath.isVariableDeclarator()) {
3828
+ if (macro === MACRO_API_NAMES.props || macro === MACRO_API_NAMES.emits) {
3829
+ addLog(
3830
+ `The ${macro} macro must be assigned to a variable (e.g., const props = defineProps(...)).`
3831
+ );
3832
+ }
3833
+ }
3834
+ };
3835
+ const lintHooks = () => {
3836
+ if (!callName.startsWith("use")) return;
3837
+ if (!atComponentOrHookRoot(path7, ast.program, inScriptFile)) {
3838
+ addLog(
3839
+ `The ${callName} hook must be called at the top level, not inside loops, conditions, or nested functions.`
3840
+ );
3841
+ }
3842
+ };
3843
+ lintMacros();
3844
+ lintHooks();
3845
+ }
3846
+ };
3847
+ }
3848
+
3495
3849
  // src/core/transform/sfc/script/syntax-processor/process/resolve-provide.ts
3496
3850
 
3497
3851
 
@@ -3500,12 +3854,13 @@ function resolveProvide(ctx) {
3500
3854
  return {
3501
3855
  CallExpression(path7) {
3502
3856
  const { node } = path7;
3503
- if (!isCalleeNamed(node, "provide")) return;
3857
+ if (!isCalleeNamed(node, VUE_API_MAP.provide)) return;
3504
3858
  const { provide } = ctx.scriptData;
3505
3859
  const [key, value] = node.arguments;
3506
3860
  const target = findOrCreateCtxProvider(provide);
3861
+ const adapter = ADAPTER_RULES.runtime[VUE_API_MAP.provide];
3507
3862
  assignProviderValue(target, key, value);
3508
- recordImport(ctx, PACKAGE_NAME.runtime, ADAPTER_COMPS.Provider);
3863
+ recordImport(ctx, adapter.package, adapter.target);
3509
3864
  path7.parentPath.remove();
3510
3865
  }
3511
3866
  };
@@ -3515,7 +3870,7 @@ function findOrCreateCtxProvider(root) {
3515
3870
  return root;
3516
3871
  }
3517
3872
  let cur = root.provide;
3518
- while (_optionalChain([cur, 'optionalAccess', _102 => _102.isOccupied])) {
3873
+ while (_optionalChain([cur, 'optionalAccess', _106 => _106.isOccupied])) {
3519
3874
  cur = _nullishCoalesce(cur.provide, () => ( {}));
3520
3875
  }
3521
3876
  return cur || (root.provide = {});
@@ -3523,13 +3878,13 @@ function findOrCreateCtxProvider(root) {
3523
3878
  function assignProviderValue(target, key, value) {
3524
3879
  const getRawExp = (exp) => {
3525
3880
  if (!exp) return "''";
3526
- if (t33.isStringLiteral(exp)) {
3881
+ if (t35.isStringLiteral(exp)) {
3527
3882
  return `'${exp.value}'`;
3528
3883
  }
3529
- if (t33.isNumericLiteral(exp)) {
3884
+ if (t35.isNumericLiteral(exp)) {
3530
3885
  return exp.value.toString();
3531
3886
  }
3532
- if (t33.isIdentifier(exp)) {
3887
+ if (t35.isIdentifier(exp)) {
3533
3888
  return exp.name;
3534
3889
  }
3535
3890
  try {
@@ -3544,165 +3899,70 @@ function assignProviderValue(target, key, value) {
3544
3899
  target.provide = {};
3545
3900
  }
3546
3901
 
3547
- // src/core/transform/sfc/script/syntax-processor/process/resolve-rename-only-adapter.ts
3548
-
3549
- function resolveRenameOnlyAdapter(ctx) {
3550
- return {
3551
- "Identifier|CallExpression"(path7) {
3552
- resolveAdapterRules(PACKAGE_NAME.runtime, ADAPTER_HOOKS, path7, ctx);
3553
- resolveAdapterRules(PACKAGE_NAME.router, ADAPTER_ROUTER_APIS, path7, ctx);
3554
- }
3555
- };
3556
- }
3557
- function resolveAdapterRules(pkgName, rules, path7, ctx) {
3558
- const node = path7.node;
3559
- const isCallExpr = t34.isCallExpression(node);
3560
- let sourceName = "";
3561
- if (t34.isIdentifier(node)) {
3562
- sourceName = node.name;
3563
- } else if (isCallExpr && t34.isIdentifier(node.callee)) {
3564
- sourceName = node.callee.name;
3565
- }
3566
- const { pure, effectful } = rules.renameOnly;
3567
- const pureApi = pure[sourceName];
3568
- const effectfulApi = effectful[sourceName];
3569
- const adapter = pureApi || effectfulApi;
3570
- if (!adapter) return;
3571
- if (effectfulApi) {
3572
- const reactiveType = getReactiveType(sourceName);
3573
- const declaratorPath = getVariableDeclaratorPath(path7);
3574
- setScriptNodeMeta(_optionalChain([declaratorPath, 'optionalAccess', _103 => _103.node]), {
3575
- is_reactive: true,
3576
- reactive_type: reactiveType
3577
- });
3578
- }
3579
- if (isCallExpr) {
3580
- replaceCallName(node, adapter);
3581
- } else {
3582
- replaceIdName(node, adapter);
3583
- }
3584
- recordImport(ctx, pkgName, adapter);
3585
- if (pkgName === PACKAGE_NAME.router && !ctx.route) {
3586
- ctx.route = true;
3587
- }
3588
- }
3589
-
3590
- // src/core/transform/sfc/script/syntax-processor/process/resolve-transform-adapter.ts
3902
+ // src/core/transform/sfc/script/syntax-processor/process/resolve-rename-adapter.ts
3591
3903
 
3592
- function resolveTransformAdapter(ctx) {
3904
+ function resolveRenameAdapter(ctx) {
3593
3905
  return {
3594
- "Identifier|CallExpression"(path7) {
3595
- resolveTransformAdapterRules(PACKAGE_NAME.runtime, ADAPTER_HOOKS, path7, ctx);
3596
- resolveTransformAdapterRules(PACKAGE_NAME.router, ADAPTER_ROUTER_APIS, path7, ctx);
3906
+ "CallExpression|Identifier"(path7) {
3907
+ const node = path7.node;
3908
+ const isCallNode = t36.isCallExpression(node);
3909
+ let apiName = "";
3910
+ if (t36.isIdentifier(node)) {
3911
+ apiName = node.name;
3912
+ } else if (isCallNode && t36.isIdentifier(node.callee)) {
3913
+ apiName = node.callee.name;
3914
+ }
3915
+ const runtimeAdapter = ADAPTER_RULES.runtime[apiName];
3916
+ const routerAdapter = ADAPTER_RULES.router[apiName];
3917
+ const adapter = runtimeAdapter || routerAdapter;
3918
+ if (!adapter || adapter.type !== "rename") {
3919
+ return;
3920
+ }
3921
+ if (adapter.isTrackable) {
3922
+ const reactiveType = getReactiveType(apiName);
3923
+ const declaratorPath = getVariableDeclaratorPath(path7);
3924
+ setScriptNodeMeta(_optionalChain([declaratorPath, 'optionalAccess', _107 => _107.node]), {
3925
+ is_reactive: true,
3926
+ reactive_type: reactiveType
3927
+ });
3928
+ }
3929
+ if (isCallNode) {
3930
+ replaceCallName(node, adapter.target);
3931
+ } else {
3932
+ replaceIdName(node, adapter.target);
3933
+ }
3934
+ if (adapter.package === PACKAGE_NAME.router && !ctx.route) {
3935
+ ctx.route = true;
3936
+ }
3937
+ recordImport(ctx, adapter.package, adapter.target);
3597
3938
  }
3598
3939
  };
3599
3940
  }
3600
- function resolveTransformAdapterRules(pkgName, rules, path7, ctx) {
3601
- const node = path7.node;
3602
- const isCallExpr = t35.isCallExpression(node);
3603
- let sourceName = "";
3604
- if (t35.isIdentifier(node)) {
3605
- sourceName = node.name;
3606
- } else if (isCallExpr && t35.isIdentifier(node.callee)) {
3607
- sourceName = node.callee.name;
3608
- }
3609
- const { pure, effectful } = rules.transform;
3610
- const watchEffectAdapter = findNestedAdapter(sourceName, pure.watchEffect);
3611
- if (watchEffectAdapter) {
3612
- if (isCallExpr) {
3613
- handleDependencyAnalysisAPI(
3614
- path7,
3615
- ctx,
3616
- watchEffectAdapter,
3617
- pkgName
3618
- );
3619
- } else {
3620
- replaceIdName(node, watchEffectAdapter);
3621
- recordImport(ctx, pkgName, watchEffectAdapter);
3622
- }
3623
- return;
3624
- }
3625
- const lifecycleAdapter = findNestedAdapter(sourceName, pure.lifecycle);
3626
- if (lifecycleAdapter) {
3627
- if (isCallExpr) {
3628
- handleDependencyAnalysisAPI(
3629
- path7,
3630
- ctx,
3631
- lifecycleAdapter,
3632
- pkgName
3633
- );
3634
- } else {
3635
- replaceIdName(node, lifecycleAdapter);
3636
- recordImport(ctx, pkgName, lifecycleAdapter);
3637
- }
3638
- return;
3639
- }
3640
- const pureApi = pure[sourceName];
3641
- if (pureApi) {
3642
- if (isCallExpr) {
3643
- replaceCallName(node, pureApi);
3644
- } else {
3645
- replaceIdName(node, pureApi);
3646
- }
3647
- recordImport(ctx, pkgName, pureApi);
3648
- return;
3649
- }
3650
- const effectfulApi = effectful[sourceName];
3651
- if (effectfulApi) {
3652
- if (isCallExpr) {
3653
- replaceCallName(node, effectfulApi);
3654
- } else {
3655
- replaceIdName(node, effectfulApi);
3656
- }
3657
- recordImport(ctx, pkgName, effectfulApi);
3658
- return;
3659
- }
3660
- }
3661
- function findNestedAdapter(sourceName, nestedMap) {
3662
- if (!nestedMap) return void 0;
3663
- if (typeof nestedMap === "string") {
3664
- return nestedMap;
3665
- }
3666
- return nestedMap[sourceName];
3667
- }
3668
- function handleDependencyAnalysisAPI(path7, ctx, adapter, pkgName) {
3669
- const { node } = path7;
3670
- const { arguments: args } = node;
3671
- if (args.length === 0) return;
3672
- const fn = args[0];
3673
- if (!t35.isArrowFunctionExpression(fn) && !t35.isFunctionExpression(fn)) {
3674
- return;
3675
- }
3676
- const fnPath = path7.get("arguments")[0];
3677
- const deps = analyzeDeps(fn, ctx, fnPath);
3678
- args.push(deps);
3679
- replaceCallName(node, adapter);
3680
- recordImport(ctx, pkgName, adapter);
3681
- }
3682
3941
 
3683
3942
  // src/core/transform/sfc/script/syntax-processor/index.ts
3684
3943
  function processVueSyntax2(ast, ctx) {
3685
3944
  vueSyntaxProcessor2(ast, ctx, {
3686
3945
  preprocess: {
3687
3946
  applyBabel: [
3688
- resolveOptions,
3947
+ resolvePropsIface,
3689
3948
  resolveEmitsTopLevelTypes,
3690
3949
  resolveSlotsTopLevelTypes,
3691
- resolvePropsIface,
3692
- resolveAsyncComponent,
3950
+ resolveDefineOptions,
3951
+ resolveDefineExpose,
3952
+ resolveDefineAsyncComponent,
3693
3953
  resolveEmitCalls
3694
3954
  ]
3695
3955
  },
3696
3956
  process: {
3697
3957
  applyBabel: [
3698
- resolveRenameOnlyAdapter,
3958
+ resolveElementRef,
3959
+ resolveRenameAdapter,
3699
3960
  resolveArrowFnDeps,
3700
3961
  resolveUnanalyzedArrow,
3701
- resolveTransformAdapter,
3702
- resolveTemplateRef,
3962
+ resolveAnalysisOnlyAdapter,
3703
3963
  resolveProvide,
3704
3964
  resolveExprMemo,
3705
- lintRules
3965
+ resolveLintRules
3706
3966
  ],
3707
3967
  excludeBabel: [resolveTemplateSlotIface, resolveCompIProps]
3708
3968
  },
@@ -3714,12 +3974,12 @@ function processVueSyntax2(ast, ctx) {
3714
3974
  }
3715
3975
  function vueSyntaxProcessor2(ast, ctx, options) {
3716
3976
  const runExcludeThenApply = (cfg) => {
3717
- _optionalChain([cfg, 'access', _104 => _104.excludeBabel, 'optionalAccess', _105 => _105.forEach, 'call', _106 => _106((fn) => fn(ctx, ast))]);
3718
- _optionalChain([cfg, 'access', _107 => _107.applyBabel, 'optionalAccess', _108 => _108.forEach, 'call', _109 => _109((fn) => _core.traverse.call(void 0, ast, fn(ctx, ast)))]);
3977
+ _optionalChain([cfg, 'access', _108 => _108.excludeBabel, 'optionalAccess', _109 => _109.forEach, 'call', _110 => _110((fn) => fn(ctx, ast))]);
3978
+ _optionalChain([cfg, 'access', _111 => _111.applyBabel, 'optionalAccess', _112 => _112.forEach, 'call', _113 => _113((fn) => _core.traverse.call(void 0, ast, fn(ctx, ast)))]);
3719
3979
  };
3720
3980
  const runApplyThenExclude = (cfg) => {
3721
- _optionalChain([cfg, 'access', _110 => _110.applyBabel, 'optionalAccess', _111 => _111.forEach, 'call', _112 => _112((fn) => _core.traverse.call(void 0, ast, fn(ctx, ast)))]);
3722
- _optionalChain([cfg, 'access', _113 => _113.excludeBabel, 'optionalAccess', _114 => _114.forEach, 'call', _115 => _115((fn) => fn(ctx, ast))]);
3981
+ _optionalChain([cfg, 'access', _114 => _114.applyBabel, 'optionalAccess', _115 => _115.forEach, 'call', _116 => _116((fn) => _core.traverse.call(void 0, ast, fn(ctx, ast)))]);
3982
+ _optionalChain([cfg, 'access', _117 => _117.excludeBabel, 'optionalAccess', _118 => _118.forEach, 'call', _119 => _119((fn) => fn(ctx, ast))]);
3723
3983
  };
3724
3984
  runExcludeThenApply(options.preprocess);
3725
3985
  runExcludeThenApply(options.process);
@@ -3817,22 +4077,22 @@ function isSimpleExpression(code, excludeVar = false) {
3817
4077
  } catch (e5) {
3818
4078
  return false;
3819
4079
  }
3820
- if (t36.isLiteral(node)) {
4080
+ if (t37.isLiteral(node)) {
3821
4081
  return true;
3822
4082
  }
3823
- if (!excludeVar && t36.isIdentifier(node)) {
4083
+ if (!excludeVar && t37.isIdentifier(node)) {
3824
4084
  return true;
3825
4085
  }
3826
- if (t36.isMemberExpression(node)) {
3827
- return isSimpleExpression(node.object) && t36.isIdentifier(node.property);
4086
+ if (t37.isMemberExpression(node)) {
4087
+ return isSimpleExpression(node.object) && t37.isIdentifier(node.property);
3828
4088
  }
3829
- if (t36.isObjectExpression(node) || t36.isArrayExpression(node)) {
4089
+ if (t37.isObjectExpression(node) || t37.isArrayExpression(node)) {
3830
4090
  return false;
3831
4091
  }
3832
- if (t36.isCallExpression(node) || t36.isAssignmentExpression(node)) {
4092
+ if (t37.isCallExpression(node) || t37.isAssignmentExpression(node)) {
3833
4093
  return false;
3834
4094
  }
3835
- if (t36.isBinaryExpression(node) || t36.isUnaryExpression(node)) {
4095
+ if (t37.isBinaryExpression(node) || t37.isUnaryExpression(node)) {
3836
4096
  return true;
3837
4097
  }
3838
4098
  return false;
@@ -3840,7 +4100,7 @@ function isSimpleExpression(code, excludeVar = false) {
3840
4100
  function isIdentifier20(code) {
3841
4101
  try {
3842
4102
  const node = _parser.parseExpression.call(void 0, code);
3843
- return t36.isIdentifier(node);
4103
+ return t37.isIdentifier(node);
3844
4104
  } catch (e6) {
3845
4105
  return false;
3846
4106
  }
@@ -3848,7 +4108,7 @@ function isIdentifier20(code) {
3848
4108
  function isStringLiteral12(code) {
3849
4109
  try {
3850
4110
  const node = _parser.parseExpression.call(void 0, code);
3851
- return t36.isStringLiteral(node) || t36.isTemplateLiteral(node);
4111
+ return t37.isStringLiteral(node) || t37.isTemplateLiteral(node);
3852
4112
  } catch (e7) {
3853
4113
  return false;
3854
4114
  }
@@ -3893,7 +4153,7 @@ function resolveRefVariable(input, ctx) {
3893
4153
  };
3894
4154
  for (const name in reactiveBindings) {
3895
4155
  const binding = reactiveBindings[name];
3896
- if (_optionalChain([binding, 'optionalAccess', _116 => _116.reactiveType]) !== "ref") continue;
4156
+ if (_optionalChain([binding, 'optionalAccess', _120 => _120.reactiveType]) !== "ref") continue;
3897
4157
  input = addValueProperty(input, name);
3898
4158
  }
3899
4159
  return input;
@@ -3901,13 +4161,13 @@ function resolveRefVariable(input, ctx) {
3901
4161
 
3902
4162
  // src/core/transform/sfc/template/shared/resolve-string-expression/index.ts
3903
4163
  function resolveStringExpr(input, ctx, toStrLiteral = false) {
3904
- if (toStrLiteral) return t37.stringLiteral(input);
4164
+ if (toStrLiteral) return t38.stringLiteral(input);
3905
4165
  const { filename, scriptData } = ctx;
3906
4166
  const newContent = resolveSpecialExpressions(input, ctx);
3907
4167
  try {
3908
4168
  return stringToExpr(newContent, scriptData.lang, filename);
3909
4169
  } catch (e8) {
3910
- return t37.identifier(newContent);
4170
+ return t38.identifier(newContent);
3911
4171
  }
3912
4172
  }
3913
4173
 
@@ -4012,12 +4272,12 @@ function wrapSingleQuotes(content, condition) {
4012
4272
  return condition || strCodeTypes.isStringLiteral(content) ? `'${content}'` : content;
4013
4273
  }
4014
4274
  function checkPropIsDynamicKey(ctx, node) {
4015
- const isKeyStatic = _optionalChain([node, 'access', _117 => _117.arg, 'optionalAccess', _118 => _118.isStatic]);
4275
+ const isKeyStatic = _optionalChain([node, 'access', _121 => _121.arg, 'optionalAccess', _122 => _122.isStatic]);
4016
4276
  const { source, filename } = ctx;
4017
4277
  if (node.rawName === "v-bind" && !node.name) {
4018
4278
  logger.warn("Keyless v-bind will overwrite all previously declared props at runtime.", {
4019
4279
  source,
4020
- loc: _optionalChain([node, 'access', _119 => _119.arg, 'optionalAccess', _120 => _120.loc]),
4280
+ loc: _optionalChain([node, 'access', _123 => _123.arg, 'optionalAccess', _124 => _124.loc]),
4021
4281
  file: filename
4022
4282
  });
4023
4283
  return;
@@ -4025,7 +4285,7 @@ function checkPropIsDynamicKey(ctx, node) {
4025
4285
  if (isKeyStatic === false) {
4026
4286
  logger.warn("Avoid using dynamic slot names, as they generate complex JSX prop expressions.", {
4027
4287
  source,
4028
- loc: _optionalChain([node, 'access', _121 => _121.arg, 'optionalAccess', _122 => _122.loc]),
4288
+ loc: _optionalChain([node, 'access', _125 => _125.arg, 'optionalAccess', _126 => _126.loc]),
4029
4289
  file: filename
4030
4290
  });
4031
4291
  }
@@ -4044,7 +4304,7 @@ function resolvePropAsBabelExp(ir, ctx) {
4044
4304
  const mergedItems = value.merge;
4045
4305
  const setNameIdentifier = (target, valueName) => {
4046
4306
  target.content = valueName;
4047
- target.ast = t38.jsxIdentifier(valueName);
4307
+ target.ast = t39.jsxIdentifier(valueName);
4048
4308
  };
4049
4309
  const setValueExpression = (target, content, isStringLiteral13) => {
4050
4310
  target.content = content;
@@ -4058,29 +4318,34 @@ function resolvePropAsBabelExp(ir, ctx) {
4058
4318
  if (setName && nameIdentifier) {
4059
4319
  setNameIdentifier(nameExp, nameIdentifier);
4060
4320
  }
4321
+ const dir = ADAPTER_RULES.runtime.dir;
4322
+ recordImport(ctx, dir.package, dir.target);
4061
4323
  setValueExpression(value.babelExp, expression, isStringLiteral13);
4062
- recordImport(ctx, PACKAGE_NAME.runtime, ADAPTER_UTILS_MAP.dir);
4063
4324
  };
4064
4325
  if (ir.isKeyLessVBind) {
4065
- const expression = createRuntimeCall(ADAPTER_UTILS_MAP.dirKeyless, [valueContent]);
4326
+ const dirKeyless = ADAPTER_RULES.runtime.dirKeyless;
4327
+ const expression = createRuntimeCall(dirKeyless.target, [valueContent]);
4066
4328
  applyRuntimeExpression(expression, false);
4067
4329
  return;
4068
4330
  }
4069
4331
  if (isClassAttr(name) && !value.isStringLiteral && !valueContent.startsWith(STYLE_MODULE_NAME)) {
4070
- const arg = _optionalChain([mergedItems, 'optionalAccess', _123 => _123.join, 'call', _124 => _124(",")]) || wrapSingleQuotes(valueContent);
4071
- const expression = createRuntimeCall(ADAPTER_UTILS_MAP.dirCls, [arg]);
4332
+ const dirCls = ADAPTER_RULES.runtime.dirCls;
4333
+ const arg = _optionalChain([mergedItems, 'optionalAccess', _127 => _127.join, 'call', _128 => _128(",")]) || wrapSingleQuotes(valueContent);
4334
+ const expression = createRuntimeCall(dirCls.target, [arg]);
4072
4335
  applyRuntimeExpression(expression, true, name);
4073
4336
  return;
4074
4337
  }
4075
- if (isStyleAttr(name) && (!isSimpleStyle(valueContent) || _optionalChain([mergedItems, 'optionalAccess', _125 => _125.some, 'call', _126 => _126((item) => !isSimpleStyle(item))]))) {
4076
- const arg = _optionalChain([mergedItems, 'optionalAccess', _127 => _127.join, 'call', _128 => _128(",")]) || valueContent;
4077
- const expression = createRuntimeCall(ADAPTER_UTILS_MAP.dirStyle, [arg]);
4338
+ if (isStyleAttr(name) && (!isSimpleStyle(valueContent) || _optionalChain([mergedItems, 'optionalAccess', _129 => _129.some, 'call', _130 => _130((item) => !isSimpleStyle(item))]))) {
4339
+ const dirStyle = ADAPTER_RULES.runtime.dirStyle;
4340
+ const arg = _optionalChain([mergedItems, 'optionalAccess', _131 => _131.join, 'call', _132 => _132(",")]) || valueContent;
4341
+ const expression = createRuntimeCall(dirStyle.target, [arg]);
4078
4342
  applyRuntimeExpression(expression, true, name);
4079
4343
  return;
4080
4344
  }
4081
- if (ir.type === 3 /* EVENT */ && _optionalChain([ir, 'access', _129 => _129.modifiers, 'optionalAccess', _130 => _130.length])) {
4345
+ if (ir.type === 3 /* EVENT */ && _optionalChain([ir, 'access', _133 => _133.modifiers, 'optionalAccess', _134 => _134.length])) {
4346
+ const dirOn = ADAPTER_RULES.runtime.dirOn;
4082
4347
  const eventName = wrapSingleQuotes(ir.__vOnEvName || name, ir.isStatic);
4083
- const expression = createRuntimeCall(ADAPTER_UTILS_MAP.dirOn, [eventName, valueContent]);
4348
+ const expression = createRuntimeCall(dirOn.target, [eventName, valueContent]);
4084
4349
  applyRuntimeExpression(expression, true, name);
4085
4350
  return;
4086
4351
  }
@@ -4132,13 +4397,13 @@ function resolveElementChildrenRules(children, ctx, parentIR, ir) {
4132
4397
  continue;
4133
4398
  }
4134
4399
  const nodeIR = child;
4135
- if (_optionalChain([parentIR, 'optionalAccess', _131 => _131.isBuiltIn])) {
4136
- if (parentIR.tag == ADAPTER_COMPS.Transition) {
4400
+ if (_optionalChain([parentIR, 'optionalAccess', _135 => _135.isBuiltIn])) {
4401
+ if (parentIR.tag == VUE_API_MAP.Transition) {
4137
4402
  resolveTransitionRules(nodeIR, parentIR, ir, ctx);
4138
4403
  }
4139
4404
  }
4140
4405
  if (nodeIR.isRoute) {
4141
- if (nodeIR.tag === ADAPTER_ROUTER_COMPS.RouterLink) {
4406
+ if (nodeIR.tag === VUE_API_MAP.RouterLink) {
4142
4407
  resolveRouterLinkRules(nodeIR, ctx);
4143
4408
  }
4144
4409
  }
@@ -4173,7 +4438,7 @@ function walkElementNodes(node, onElement) {
4173
4438
  }
4174
4439
  function resolveDefaultStyleModuleName(node) {
4175
4440
  const { exp } = node;
4176
- if (_optionalChain([exp, 'optionalAccess', _132 => _132.type]) !== _compilercore.NodeTypes.SIMPLE_EXPRESSION) {
4441
+ if (_optionalChain([exp, 'optionalAccess', _136 => _136.type]) !== _compilercore.NodeTypes.SIMPLE_EXPRESSION) {
4177
4442
  return;
4178
4443
  }
4179
4444
  if (exp.content.includes("$style")) {
@@ -4209,7 +4474,7 @@ function injectStyleScopeAttribute(node, ctx) {
4209
4474
  return;
4210
4475
  }
4211
4476
  const hasDynamicIs = node.props.some((prop) => {
4212
- if (prop.type !== _compilercore.NodeTypes.DIRECTIVE || _optionalChain([prop, 'access', _133 => _133.arg, 'optionalAccess', _134 => _134.type]) !== _compilercore.NodeTypes.SIMPLE_EXPRESSION) {
4477
+ if (prop.type !== _compilercore.NodeTypes.DIRECTIVE || _optionalChain([prop, 'access', _137 => _137.arg, 'optionalAccess', _138 => _138.type]) !== _compilercore.NodeTypes.SIMPLE_EXPRESSION) {
4213
4478
  return false;
4214
4479
  }
4215
4480
  return prop.arg.content === "is";
@@ -4275,7 +4540,7 @@ function mergeStyleProps(oldAttr, newAttr) {
4275
4540
  const oldStyle = oldAttr.value.content;
4276
4541
  const newStyle = parseStyleString(newAttr.value.content);
4277
4542
  let merged = oldAttr.value.merge;
4278
- if (!_optionalChain([merged, 'optionalAccess', _135 => _135.length])) {
4543
+ if (!_optionalChain([merged, 'optionalAccess', _139 => _139.length])) {
4279
4544
  merged = oldAttr.value.merge = [oldStyle, newStyle];
4280
4545
  } else {
4281
4546
  merged.push(newStyle);
@@ -4305,7 +4570,7 @@ function warnUnsupportedVueDollarVar(ctx, node) {
4305
4570
  const { source, filename } = ctx;
4306
4571
  let value = "";
4307
4572
  let loc;
4308
- if (node.type === _compilercore.NodeTypes.DIRECTIVE && _optionalChain([node, 'access', _136 => _136.exp, 'optionalAccess', _137 => _137.type]) === _compilercore.NodeTypes.SIMPLE_EXPRESSION) {
4573
+ if (node.type === _compilercore.NodeTypes.DIRECTIVE && _optionalChain([node, 'access', _140 => _140.exp, 'optionalAccess', _141 => _141.type]) === _compilercore.NodeTypes.SIMPLE_EXPRESSION) {
4309
4574
  value = node.exp.content;
4310
4575
  loc = node.exp.loc;
4311
4576
  } else if (node.type === _compilercore.NodeTypes.INTERPOLATION && node.content.type === _compilercore.NodeTypes.SIMPLE_EXPRESSION) {
@@ -4345,7 +4610,7 @@ function resolveDynamicIsProp(node, ir, ctx, nodeIR) {
4345
4610
  }
4346
4611
  const propIR = createPropsIR("is", "is", content);
4347
4612
  resolvePropAsBabelExp(propIR, ctx);
4348
- nodeIR.tag = ADAPTER_COMPS.Component;
4613
+ nodeIR.tag = VUE_API_MAP.DynamicComponent;
4349
4614
  nodeIR.isComponent = true;
4350
4615
  nodeIR.props.push(propIR);
4351
4616
  recordImport(ctx, PACKAGE_NAME.runtime, nodeIR.tag);
@@ -4354,15 +4619,20 @@ function resolveDynamicIsProp(node, ir, ctx, nodeIR) {
4354
4619
  // src/core/transform/sfc/template/syntax-processor/process/props/resolve-ref-prop.ts
4355
4620
 
4356
4621
  function resolveRefProp(node, ctx, nodeIR) {
4357
- const { templateData } = ctx;
4622
+ const {
4623
+ templateData: { refBindings }
4624
+ } = ctx;
4358
4625
  let propIR;
4359
4626
  if (node.type === _compilercore.NodeTypes.ATTRIBUTE) {
4360
- const tagName = _optionalChain([node, 'access', _138 => _138.value, 'optionalAccess', _139 => _139.content]);
4361
- const binding = Object.values(templateData.refBindings).find((r) => r.tag === tagName);
4362
- propIR = createPropsIR("ref", "ref", _optionalChain([binding, 'optionalAccess', _140 => _140.name]) || "null");
4627
+ const tag = _optionalChain([node, 'access', _142 => _142.value, 'optionalAccess', _143 => _143.content]);
4628
+ if (!tag) return;
4629
+ collectComponentRef(tag, ctx);
4630
+ const domRefBinding = Object.values(refBindings.domRefs).find((r) => r.tag === tag);
4631
+ const refVar = _optionalChain([domRefBinding, 'optionalAccess', _144 => _144.name]) || _optionalChain([refBindings, 'access', _145 => _145.componentRefs, 'access', _146 => _146[tag], 'optionalAccess', _147 => _147.name]);
4632
+ propIR = createPropsIR("ref", "ref", refVar || "null");
4363
4633
  } else {
4364
4634
  const exp = node.exp;
4365
- for (const name in templateData.refBindings) {
4635
+ for (const name in refBindings.domRefs) {
4366
4636
  const newName = `${name}.current`;
4367
4637
  const regex = new RegExp(`${name}(?!\\.current)`, "g");
4368
4638
  exp.content = exp.content.replace(regex, newName);
@@ -4372,13 +4642,29 @@ function resolveRefProp(node, ctx, nodeIR) {
4372
4642
  resolvePropAsBabelExp(propIR, ctx);
4373
4643
  nodeIR.props.push(propIR);
4374
4644
  }
4645
+ function collectComponentRef(tag, ctx) {
4646
+ if (tag in HTML_TAG_TYPES) {
4647
+ return;
4648
+ }
4649
+ const { refBindings, reactiveBindings } = ctx.templateData;
4650
+ refBindings.componentRefs[tag] = {
4651
+ tag,
4652
+ // 对应的标签名(随便填,不影响)
4653
+ htmlType: "",
4654
+ name: tag
4655
+ // 对应的变量名(随便填,不影响)
4656
+ };
4657
+ if (reactiveBindings[tag]) {
4658
+ delete reactiveBindings[tag];
4659
+ }
4660
+ }
4375
4661
 
4376
4662
  // src/core/transform/sfc/template/syntax-processor/process/props/resolve-dynamic-attribute-prop.ts
4377
4663
  function resolveDynamicAttributeProp(node, ir, ctx, nodeIR) {
4378
4664
  const arg = node.arg;
4379
4665
  const exp = node.exp;
4380
- const name = _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _141 => _141.content]), () => ( ""));
4381
- const content = _nullishCoalesce(_optionalChain([exp, 'optionalAccess', _142 => _142.content]), () => ( "true"));
4666
+ const name = _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _148 => _148.content]), () => ( ""));
4667
+ const content = _nullishCoalesce(_optionalChain([exp, 'optionalAccess', _149 => _149.content]), () => ( "true"));
4382
4668
  warnUnsupportedVueDollarVar(ctx, node);
4383
4669
  if (name === "is") {
4384
4670
  resolveDynamicIsProp(node, ir, ctx, nodeIR);
@@ -4389,7 +4675,7 @@ function resolveDynamicAttributeProp(node, ir, ctx, nodeIR) {
4389
4675
  return;
4390
4676
  }
4391
4677
  const dynamicPropIR = createPropsIR(node.rawName, name, content);
4392
- dynamicPropIR.isStatic = _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _143 => _143.isStatic]), () => ( true));
4678
+ dynamicPropIR.isStatic = _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _150 => _150.isStatic]), () => ( true));
4393
4679
  checkPropIsDynamicKey(ctx, node);
4394
4680
  resolvePropertyIR(dynamicPropIR, ir, ctx, nodeIR, true);
4395
4681
  }
@@ -4417,7 +4703,7 @@ function resolvePropertyIR(node, ir, ctx, nodeIR, isDynamic = false) {
4417
4703
  // src/core/transform/sfc/template/syntax-processor/process/props/resolve-attribute-prop.ts
4418
4704
  function resolveAttributeProp(node, ir, ctx, nodeIR) {
4419
4705
  const name = node.name;
4420
- const content = _nullishCoalesce(_optionalChain([node, 'access', _144 => _144.value, 'optionalAccess', _145 => _145.content]), () => ( "true"));
4706
+ const content = _nullishCoalesce(_optionalChain([node, 'access', _151 => _151.value, 'optionalAccess', _152 => _152.content]), () => ( "true"));
4421
4707
  if (name === "is") {
4422
4708
  resolveStaticIsProp(content, ir, ctx, nodeIR);
4423
4709
  return;
@@ -4441,10 +4727,10 @@ function resolveRouterLinkVSlotProp(node, nodeIR, ctx) {
4441
4727
  type: 2 /* SLOT */,
4442
4728
  name: "customRender",
4443
4729
  rawName: _nullishCoalesce(node.rawName, () => ( "v-slot")),
4444
- isStatic: _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _146 => _146.isStatic]), () => ( true)),
4730
+ isStatic: _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _153 => _153.isStatic]), () => ( true)),
4445
4731
  isScoped: true,
4446
4732
  callback: {
4447
- arg: _nullishCoalesce(_optionalChain([exp, 'optionalAccess', _147 => _147.content, 'optionalAccess', _148 => _148.trim, 'call', _149 => _149()]), () => ( "")),
4733
+ arg: _nullishCoalesce(_optionalChain([exp, 'optionalAccess', _154 => _154.content, 'optionalAccess', _155 => _155.trim, 'call', _156 => _156()]), () => ( "")),
4448
4734
  exp: []
4449
4735
  }
4450
4736
  };
@@ -4460,10 +4746,10 @@ function resolveVFor(node, _ir, _ctx, nodeIR) {
4460
4746
  };
4461
4747
  }
4462
4748
  function resolveForResult(forParseResult) {
4463
- const source = _optionalChain([forParseResult, 'access', _150 => _150.source, 'optionalAccess', _151 => _151.content]);
4464
- const value = _optionalChain([forParseResult, 'access', _152 => _152.value, 'optionalAccess', _153 => _153.content]);
4465
- const index = _optionalChain([forParseResult, 'access', _154 => _154.index, 'optionalAccess', _155 => _155.content]);
4466
- const key = _optionalChain([forParseResult, 'access', _156 => _156.key, 'optionalAccess', _157 => _157.content]);
4749
+ const source = _optionalChain([forParseResult, 'access', _157 => _157.source, 'optionalAccess', _158 => _158.content]);
4750
+ const value = _optionalChain([forParseResult, 'access', _159 => _159.value, 'optionalAccess', _160 => _160.content]);
4751
+ const index = _optionalChain([forParseResult, 'access', _161 => _161.index, 'optionalAccess', _162 => _162.content]);
4752
+ const key = _optionalChain([forParseResult, 'access', _163 => _163.key, 'optionalAccess', _164 => _164.content]);
4467
4753
  return {
4468
4754
  source,
4469
4755
  value,
@@ -4483,7 +4769,7 @@ function resolveVHtml(node, ir, ctx, nodeIR) {
4483
4769
  // src/core/transform/sfc/template/syntax-processor/process/props/resolve-v-if.ts
4484
4770
  function resolveVIf(node, _ir, ctx, nodeIR, siblingNodesIR) {
4485
4771
  const name = node.name === "else-if" ? "elseIf" : node.name;
4486
- const value = _nullishCoalesce(_optionalChain([node, 'access', _158 => _158.exp, 'optionalAccess', _159 => _159.content]), () => ( "true"));
4772
+ const value = _nullishCoalesce(_optionalChain([node, 'access', _165 => _165.exp, 'optionalAccess', _166 => _166.content]), () => ( "true"));
4487
4773
  const prevNode = siblingNodesIR[siblingNodesIR.length - 1];
4488
4774
  const isElseBranch = name === "else" || name === "elseIf";
4489
4775
  let hasError = false;
@@ -4522,7 +4808,7 @@ function resolveVIf(node, _ir, ctx, nodeIR, siblingNodesIR) {
4522
4808
  // src/core/transform/sfc/template/syntax-processor/process/props/resolve-v-memo.ts
4523
4809
  function resolveVMemo(node, _ir, ctx, nodeIR) {
4524
4810
  const exp = node.exp;
4525
- let value = _optionalChain([exp, 'optionalAccess', _160 => _160.content]);
4811
+ let value = _optionalChain([exp, 'optionalAccess', _167 => _167.content]);
4526
4812
  if (value !== void 0) {
4527
4813
  if (!value.trim() || !value.startsWith("[") && !value.endsWith("]")) {
4528
4814
  const { source, filename } = ctx;
@@ -4562,7 +4848,7 @@ function resolveVModel(node, _ir, ctx, elementNode, nodeIR) {
4562
4848
  const getterName = exp.content;
4563
4849
  const isComponent = elementNode.tagType === _compilercore.ElementTypes.COMPONENT;
4564
4850
  const inputType = resolveHtmlInput(elementNode, isComponent);
4565
- const propName = _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _161 => _161.content]), () => ( resolveModelPropName(inputType, isComponent)));
4851
+ const propName = _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _168 => _168.content]), () => ( resolveModelPropName(inputType, isComponent)));
4566
4852
  let valuePropIR;
4567
4853
  let eventPropIR;
4568
4854
  if (isComponent) {
@@ -4570,7 +4856,7 @@ function resolveVModel(node, _ir, ctx, elementNode, nodeIR) {
4570
4856
  const getterNamespace = getRootIdName(getterName);
4571
4857
  const eventReactName = `onUpdate${capitalize(getterNamespace)}`;
4572
4858
  const eventVueName = `update:${getterNamespace}`;
4573
- const isTS = _optionalChain([ctx, 'access', _162 => _162.scriptData, 'optionalAccess', _163 => _163.lang, 'optionalAccess', _164 => _164.startsWith, 'call', _165 => _165("ts")]);
4859
+ const isTS = _optionalChain([ctx, 'access', _169 => _169.scriptData, 'optionalAccess', _170 => _170.lang, 'optionalAccess', _171 => _171.startsWith, 'call', _172 => _172("ts")]);
4574
4860
  const valueArg = isTS ? "value: any" : "value";
4575
4861
  const processedValue = applyValueModifiers("value", modifiers);
4576
4862
  const handlerBody = `(${valueArg}) => { ${getterName} = ${processedValue} }`;
@@ -4608,7 +4894,7 @@ function getRadioValue(elementNode) {
4608
4894
  const valueAttr = elementNode.props.find(
4609
4895
  (prop) => prop.type === _compilercore.NodeTypes.ATTRIBUTE && prop.name === "value"
4610
4896
  );
4611
- if (!_optionalChain([valueAttr, 'optionalAccess', _166 => _166.value, 'optionalAccess', _167 => _167.content])) return '""';
4897
+ if (!_optionalChain([valueAttr, 'optionalAccess', _173 => _173.value, 'optionalAccess', _174 => _174.content])) return '""';
4612
4898
  const content = valueAttr.value.content;
4613
4899
  return /^['"]/.test(content) ? content : `"${content}"`;
4614
4900
  }
@@ -4618,7 +4904,7 @@ function resolveHtmlInput(node, isComponent) {
4618
4904
  const typeProp = node.props.find(
4619
4905
  (prop) => prop.type === _compilercore.NodeTypes.ATTRIBUTE && prop.name === "type"
4620
4906
  );
4621
- return _optionalChain([typeProp, 'optionalAccess', _168 => _168.value, 'optionalAccess', _169 => _169.content, 'optionalAccess', _170 => _170.toLowerCase, 'call', _171 => _171()]);
4907
+ return _optionalChain([typeProp, 'optionalAccess', _175 => _175.value, 'optionalAccess', _176 => _176.content, 'optionalAccess', _177 => _177.toLowerCase, 'call', _178 => _178()]);
4622
4908
  }
4623
4909
  function applyValueModifiers(valueExp, modifiers) {
4624
4910
  let result = valueExp;
@@ -4634,7 +4920,7 @@ function getRootIdName(expr) {
4634
4920
  if (typeof expr !== "string") return;
4635
4921
  const pattern = /^([a-zA-Z_$][a-zA-Z0-9_$]*)(?:[\.\?\.\[\(].*)?$/;
4636
4922
  const match = pattern.exec(expr.trim());
4637
- return _optionalChain([match, 'optionalAccess', _172 => _172[1]]);
4923
+ return _optionalChain([match, 'optionalAccess', _179 => _179[1]]);
4638
4924
  }
4639
4925
 
4640
4926
  // src/core/transform/sfc/template/syntax-processor/process/props/resolve-v-on.ts
@@ -4655,7 +4941,7 @@ function resolveVOn(node, _ir, ctx, nodeIR) {
4655
4941
  originalVueEventName = `${arg.content}.${modifiers.join(".")}`;
4656
4942
  } else {
4657
4943
  const expr = stringToExpr(handler);
4658
- if (!t39.isFunctionExpression(expr) && !t39.isIdentifier(expr)) {
4944
+ if (!t40.isFunctionExpression(expr) && !t40.isIdentifier(expr)) {
4659
4945
  handler = `() => {${handler}}`;
4660
4946
  }
4661
4947
  }
@@ -4782,7 +5068,7 @@ function resolveDirectiveProp(node, ir, ctx, elementNode, nodeIR, siblingNodesIR
4782
5068
  return resolveVOn(node, ir, ctx, nodeIR);
4783
5069
  }
4784
5070
  if (isVSlot(rawName2)) {
4785
- if (nodeIR.tag === ADAPTER_ROUTER_COMPS.RouterLink) {
5071
+ if (nodeIR.tag === VUE_API_MAP.RouterLink) {
4786
5072
  resolveRouterLinkVSlotProp(node, nodeIR, ctx);
4787
5073
  }
4788
5074
  return true;
@@ -4823,7 +5109,7 @@ function resolveVSlotProp(node, _ir, ctx) {
4823
5109
  const name = !arg || arg.content === "default" ? "children" : arg.content;
4824
5110
  const content = !isScoped ? [] : void 0;
4825
5111
  const callback = isScoped ? {
4826
- arg: _nullishCoalesce(_optionalChain([exp, 'optionalAccess', _173 => _173.content, 'optionalAccess', _174 => _174.trim, 'call', _175 => _175()]), () => ( "")),
5112
+ arg: _nullishCoalesce(_optionalChain([exp, 'optionalAccess', _180 => _180.content, 'optionalAccess', _181 => _181.trim, 'call', _182 => _182()]), () => ( "")),
4827
5113
  exp: []
4828
5114
  } : void 0;
4829
5115
  checkPropIsDynamicKey(ctx, node);
@@ -4831,7 +5117,7 @@ function resolveVSlotProp(node, _ir, ctx) {
4831
5117
  type: 2 /* SLOT */,
4832
5118
  name,
4833
5119
  rawName: _nullishCoalesce(node.rawName, () => ( "default")),
4834
- isStatic: _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _176 => _176.isStatic]), () => ( true)),
5120
+ isStatic: _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _183 => _183.isStatic]), () => ( true)),
4835
5121
  isScoped,
4836
5122
  content,
4837
5123
  callback
@@ -4856,14 +5142,16 @@ function resolveElementNode(node, ir, ctx, siblingNodesIR) {
4856
5142
  isSelfClosing: node.isSelfClosing,
4857
5143
  loc: node.loc
4858
5144
  });
4859
- if (tag in ADAPTER_COMPS) {
5145
+ const routerAdapter = ADAPTER_RULES.router[tag];
5146
+ const runtimeAdapter = ADAPTER_RULES.runtime[tag];
5147
+ if (runtimeAdapter) {
4860
5148
  nodeIR.isBuiltIn = true;
4861
- recordImport(ctx, PACKAGE_NAME.runtime, tag);
5149
+ recordImport(ctx, runtimeAdapter.package, runtimeAdapter.target);
4862
5150
  }
4863
- if (tag in ADAPTER_ROUTER_COMPS) {
5151
+ if (routerAdapter) {
4864
5152
  if (!ctx.route) ctx.route = true;
4865
5153
  nodeIR.isRoute = true;
4866
- recordImport(ctx, PACKAGE_NAME.router, tag);
5154
+ recordImport(ctx, _optionalChain([routerAdapter, 'optionalAccess', _184 => _184.package]), routerAdapter.target);
4867
5155
  }
4868
5156
  resolveProps(node, ir, ctx, nodeIR, siblingNodesIR);
4869
5157
  return nodeIR;
@@ -4999,7 +5287,7 @@ function resolveSlotProps(node, ctx) {
4999
5287
  for (const prop of node.props) {
5000
5288
  if (prop.type === _compilercore.NodeTypes.ATTRIBUTE) {
5001
5289
  const attr = prop.name;
5002
- const value = _optionalChain([prop, 'access', _177 => _177.value, 'optionalAccess', _178 => _178.content, 'access', _179 => _179.trim, 'call', _180 => _180()]);
5290
+ const value = _optionalChain([prop, 'access', _185 => _185.value, 'optionalAccess', _186 => _186.content, 'access', _187 => _187.trim, 'call', _188 => _188()]);
5003
5291
  if (attr === "name" && value) {
5004
5292
  result.name = camelCase(value);
5005
5293
  } else {
@@ -5089,14 +5377,14 @@ function resolveTemplate2(root, ctx) {
5089
5377
  // src/core/transform/sfc/index.ts
5090
5378
  function transform(ast, ctx, options) {
5091
5379
  const { template, script, style } = ast;
5092
- const templateIR = resolveTemplate2(_optionalChain([template, 'optionalAccess', _181 => _181.ast]), ctx);
5093
- const scriptIR = resolveScript2(_optionalChain([script, 'optionalAccess', _182 => _182.ast]), ctx);
5380
+ const templateIR = resolveTemplate2(_optionalChain([template, 'optionalAccess', _189 => _189.ast]), ctx);
5381
+ const scriptIR = resolveScript2(_optionalChain([script, 'optionalAccess', _190 => _190.ast]), ctx);
5094
5382
  const result = {
5095
5383
  template: templateIR,
5096
5384
  script: scriptIR,
5097
- style: _optionalChain([style, 'optionalAccess', _183 => _183.source, 'optionalAccess', _184 => _184.content])
5385
+ style: _optionalChain([style, 'optionalAccess', _191 => _191.source, 'optionalAccess', _192 => _192.content])
5098
5386
  };
5099
- executePlugins(_optionalChain([options, 'optionalAccess', _185 => _185.plugins]), result, ctx);
5387
+ executePlugins(_optionalChain([options, 'optionalAccess', _193 => _193.plugins]), result, ctx);
5100
5388
  return result;
5101
5389
  }
5102
5390
 
@@ -5159,7 +5447,7 @@ var Helper = (_class3 = class {
5159
5447
  __init6() {this.outDir = "react-app"}
5160
5448
  constructor(opts) {;_class3.prototype.__init5.call(this);_class3.prototype.__init6.call(this);
5161
5449
  this.compilerOpts = opts;
5162
- if (_optionalChain([opts, 'access', _186 => _186.output, 'optionalAccess', _187 => _187.workspace])) {
5450
+ if (_optionalChain([opts, 'access', _194 => _194.output, 'optionalAccess', _195 => _195.workspace])) {
5163
5451
  this.workspaceDir = opts.output.workspace;
5164
5452
  }
5165
5453
  const excludePatterns = PathFilter.withDefaults(opts.exclude || []);
@@ -5194,7 +5482,7 @@ var Helper = (_class3 = class {
5194
5482
  }
5195
5483
  getOutDirName() {
5196
5484
  const { output } = this.compilerOpts;
5197
- return _optionalChain([output, 'optionalAccess', _188 => _188.outDir]) || this.outDir;
5485
+ return _optionalChain([output, 'optionalAccess', _196 => _196.outDir]) || this.outDir;
5198
5486
  }
5199
5487
  getWorkspaceDir() {
5200
5488
  return _path2.default.resolve(this.getProjectRoot(), this.workspaceDir);
@@ -5208,7 +5496,7 @@ var Helper = (_class3 = class {
5208
5496
  }
5209
5497
  getIgnoreAssets() {
5210
5498
  const { output } = this.compilerOpts;
5211
- if (_optionalChain([output, 'optionalAccess', _189 => _189.ignoreAssets])) {
5499
+ if (_optionalChain([output, 'optionalAccess', _197 => _197.ignoreAssets])) {
5212
5500
  return new Set(output.ignoreAssets.map(normalizePath));
5213
5501
  }
5214
5502
  return /* @__PURE__ */ new Set([
@@ -5289,12 +5577,12 @@ var Helper = (_class3 = class {
5289
5577
  */
5290
5578
  async formatCode({ code, fileInfo }) {
5291
5579
  const { format } = this.compilerOpts;
5292
- if (!_optionalChain([format, 'optionalAccess', _190 => _190.enabled])) return code;
5293
- if (_optionalChain([format, 'optionalAccess', _191 => _191.formatter]) === "builtin") {
5580
+ if (!_optionalChain([format, 'optionalAccess', _198 => _198.enabled])) return code;
5581
+ if (_optionalChain([format, 'optionalAccess', _199 => _199.formatter]) === "builtin") {
5294
5582
  return simpleFormat(code);
5295
5583
  }
5296
- const { lang } = _nullishCoalesce(_optionalChain([fileInfo, 'optionalAccess', _192 => _192.jsx]), () => ( _optionalChain([fileInfo, 'optionalAccess', _193 => _193.script])));
5297
- return await formatWithPrettier(code, lang, _optionalChain([format, 'optionalAccess', _194 => _194.prettierOptions]));
5584
+ const { lang } = _nullishCoalesce(_optionalChain([fileInfo, 'optionalAccess', _200 => _200.jsx]), () => ( _optionalChain([fileInfo, 'optionalAccess', _201 => _201.script])));
5585
+ return await formatWithPrettier(code, lang, _optionalChain([format, 'optionalAccess', _202 => _202.prettierOptions]));
5298
5586
  }
5299
5587
  /**
5300
5588
  * 通用的缓存校验工具函数
@@ -5427,7 +5715,7 @@ var Helper = (_class3 = class {
5427
5715
  }
5428
5716
  resolveViteCreateApp() {
5429
5717
  const { output } = this.compilerOpts;
5430
- const config = _optionalChain([output, 'optionalAccess', _195 => _195.bootstrapVite]);
5718
+ const config = _optionalChain([output, 'optionalAccess', _203 => _203.bootstrapVite]);
5431
5719
  const template = typeof config === "object" ? config.template : "react-ts";
5432
5720
  const outDirName = this.getOutDirName();
5433
5721
  const cmd = `npm create vite@latest ${outDirName} -- --template ${template}`;
@@ -5441,7 +5729,7 @@ var Helper = (_class3 = class {
5441
5729
  * 获取需要排除编译的文件
5442
5730
  */
5443
5731
  getExcludes() {
5444
- if (!_optionalChain([this, 'access', _196 => _196.compilerOpts, 'access', _197 => _197.exclude, 'optionalAccess', _198 => _198.length])) {
5732
+ if (!_optionalChain([this, 'access', _204 => _204.compilerOpts, 'access', _205 => _205.exclude, 'optionalAccess', _206 => _206.length])) {
5445
5733
  return PathFilter.withDefaults();
5446
5734
  }
5447
5735
  return this.compilerOpts.exclude;
@@ -5522,7 +5810,7 @@ function parseOnlyStyle(source, ctx, options) {
5522
5810
  ast: void 0
5523
5811
  }
5524
5812
  };
5525
- executePlugins(_optionalChain([options, 'optionalAccess', _199 => _199.plugins]), result, ctx);
5813
+ executePlugins(_optionalChain([options, 'optionalAccess', _207 => _207.plugins]), result, ctx);
5526
5814
  return result;
5527
5815
  }
5528
5816
 
@@ -5556,7 +5844,10 @@ var CompilationContext = (_class4 = class {constructor() { _class4.prototype.__i
5556
5844
  propField: "$props",
5557
5845
  templateData: {
5558
5846
  slots: {},
5559
- refBindings: {},
5847
+ refBindings: {
5848
+ domRefs: {},
5849
+ componentRefs: {}
5850
+ },
5560
5851
  reactiveBindings: {}
5561
5852
  },
5562
5853
  scriptData: {
@@ -5573,6 +5864,10 @@ var CompilationContext = (_class4 = class {constructor() { _class4.prototype.__i
5573
5864
  emitTypes: [],
5574
5865
  slotTypes: []
5575
5866
  },
5867
+ forwardRef: {
5868
+ enabled: false,
5869
+ refField: "expose"
5870
+ },
5576
5871
  source: ""
5577
5872
  },
5578
5873
  styleData: {
@@ -5701,16 +5996,16 @@ var BaseCompiler = (_class5 = class extends Helper {
5701
5996
  });
5702
5997
  const genOptions = this.prepareGenerateOptions(filename);
5703
5998
  const resolveSFCAndScriptFile = () => {
5704
- const ast = parse(source, ctx.data, { plugins: _optionalChain([plugins, 'optionalAccess', _200 => _200.parser]) });
5705
- const ir = transform(ast, ctx.data, { plugins: _optionalChain([plugins, 'optionalAccess', _201 => _201.transformer]) });
5999
+ const ast = parse(source, ctx.data, { plugins: _optionalChain([plugins, 'optionalAccess', _208 => _208.parser]) });
6000
+ const ir = transform(ast, ctx.data, { plugins: _optionalChain([plugins, 'optionalAccess', _209 => _209.transformer]) });
5706
6001
  const gen = generate(ir, ctx.data, {
5707
6002
  ...genOptions,
5708
- plugins: _optionalChain([plugins, 'optionalAccess', _202 => _202.codegen])
6003
+ plugins: _optionalChain([plugins, 'optionalAccess', _210 => _210.codegen])
5709
6004
  });
5710
6005
  return this.resolveMainResult(ir, gen, ctx.data);
5711
6006
  };
5712
6007
  const resolveStyleFile = () => {
5713
- const result = parseOnlyStyle(source, ctx.data, { plugins: _optionalChain([plugins, 'optionalAccess', _203 => _203.parser]) });
6008
+ const result = parseOnlyStyle(source, ctx.data, { plugins: _optionalChain([plugins, 'optionalAccess', _211 => _211.parser]) });
5714
6009
  return this.resolveStyleResult(result, ctx.data);
5715
6010
  };
5716
6011
  try {
@@ -5837,9 +6132,9 @@ var BaseCompiler = (_class5 = class extends Helper {
5837
6132
  lang
5838
6133
  },
5839
6134
  css: {
5840
- file: _optionalChain([styleData, 'optionalAccess', _204 => _204.filePath]),
5841
- hash: _optionalChain([styleData, 'optionalAccess', _205 => _205.scopeId]),
5842
- code: _optionalChain([ir, 'optionalAccess', _206 => _206.style])
6135
+ file: _optionalChain([styleData, 'optionalAccess', _212 => _212.filePath]),
6136
+ hash: _optionalChain([styleData, 'optionalAccess', _213 => _213.scopeId]),
6137
+ code: _optionalChain([ir, 'optionalAccess', _214 => _214.style])
5843
6138
  }
5844
6139
  },
5845
6140
  ...base
@@ -5913,7 +6208,7 @@ var AssetManager = (_class6 = class {
5913
6208
  const relativeToRoot = normalizePath(this.fileCompiler.relativePath(p));
5914
6209
  const filename = _path2.default.basename(p).toLowerCase();
5915
6210
  const ext = _path2.default.extname(p).toLowerCase();
5916
- if (!_optionalChain([this, 'access', _207 => _207.fileCompiler, 'access', _208 => _208.options, 'access', _209 => _209.output, 'optionalAccess', _210 => _210.ignoreAssets])) {
6211
+ if (!_optionalChain([this, 'access', _215 => _215.fileCompiler, 'access', _216 => _216.options, 'access', _217 => _217.output, 'optionalAccess', _218 => _218.ignoreAssets])) {
5917
6212
  const shouldExclude = Array.from(exclusions).some((pattern) => {
5918
6213
  if (pattern.endsWith(".")) {
5919
6214
  return filename.startsWith(pattern);
@@ -6050,10 +6345,10 @@ var CleanupManager = class {
6050
6345
  const removeFn = async (m) => {
6051
6346
  if (key === "sfc" /* SFC */) {
6052
6347
  const meta = m;
6053
- if (!_optionalChain([meta, 'optionalAccess', _211 => _211.output])) return;
6348
+ if (!_optionalChain([meta, 'optionalAccess', _219 => _219.output])) return;
6054
6349
  const { jsx, css } = meta.output;
6055
6350
  await this.fileCompiler.removeOutputFile(jsx.file);
6056
- if (_optionalChain([css, 'optionalAccess', _212 => _212.file])) {
6351
+ if (_optionalChain([css, 'optionalAccess', _220 => _220.file])) {
6057
6352
  await this.fileCompiler.removeOutputFile(css.file);
6058
6353
  }
6059
6354
  } else if (key === "script" /* SCRIPT */ || key === "copied" /* ASSET */) {
@@ -6097,7 +6392,7 @@ var CompilationUnitProcessor = class {
6097
6392
  const isScriptFile = key === "script" /* SCRIPT */;
6098
6393
  const isStyleFile = key === "style" /* STYLE */;
6099
6394
  if (isSFC || isScriptFile) {
6100
- unit.hasRoute = _optionalChain([result, 'optionalAccess', _213 => _213.hasRoute]);
6395
+ unit.hasRoute = _optionalChain([result, 'optionalAccess', _221 => _221.hasRoute]);
6101
6396
  }
6102
6397
  const resolveFileInfo = () => {
6103
6398
  if (isSFC) {
@@ -6117,7 +6412,7 @@ var CompilationUnitProcessor = class {
6117
6412
  const { script } = result.fileInfo;
6118
6413
  unit.output = {
6119
6414
  script: {
6120
- file: _optionalChain([script, 'optionalAccess', _214 => _214.file]),
6415
+ file: _optionalChain([script, 'optionalAccess', _222 => _222.file]),
6121
6416
  code
6122
6417
  }
6123
6418
  };
@@ -6197,7 +6492,7 @@ var FileProcessor = (_class7 = class {
6197
6492
  const absPath = this.fileCompiler.getAbsPath(filePath);
6198
6493
  const fileMeta = await this.fileCompiler.getFileMeta(absPath);
6199
6494
  const cache = (this.fileCompiler.getIsCache() ? existingCache : void 0) || await this.fileCompiler.loadCache(key);
6200
- const record = _optionalChain([cache, 'optionalAccess', _215 => _215.target, 'access', _216 => _216.find, 'call', _217 => _217((c) => c.file === absPath)]);
6495
+ const record = _optionalChain([cache, 'optionalAccess', _223 => _223.target, 'access', _224 => _224.find, 'call', _225 => _225((c) => c.file === absPath)]);
6201
6496
  const { shouldCompile, hash } = await this.fileCompiler.checkCacheStatus(
6202
6497
  fileMeta,
6203
6498
  record,
@@ -6216,10 +6511,10 @@ var FileProcessor = (_class7 = class {
6216
6511
  hash: hash || this.fileCompiler.genHash(source)
6217
6512
  };
6218
6513
  const processed = await this.compilationUnitProcessor.resolve(initUnit, key);
6219
- if (_optionalChain([processed, 'optionalAccess', _218 => _218.output])) {
6514
+ if (_optionalChain([processed, 'optionalAccess', _226 => _226.output])) {
6220
6515
  await this.compilationUnitProcessor.saveCompiledFiles(processed, key);
6221
6516
  if (key === "sfc" /* SFC */ || key === "script" /* SCRIPT */) {
6222
- if (_optionalChain([processed, 'optionalAccess', _219 => _219.hasRoute])) {
6517
+ if (_optionalChain([processed, 'optionalAccess', _227 => _227.hasRoute])) {
6223
6518
  await this.injectVuReactRouteDep();
6224
6519
  }
6225
6520
  }
@@ -6409,7 +6704,7 @@ var ViteBootstrapper = (_class9 = class {
6409
6704
  */
6410
6705
  resolveViteCreateApp() {
6411
6706
  const { output } = this.options;
6412
- const config = _optionalChain([output, 'optionalAccess', _220 => _220.bootstrapVite]);
6707
+ const config = _optionalChain([output, 'optionalAccess', _228 => _228.bootstrapVite]);
6413
6708
  const template = typeof config === "object" ? config.template : "react-ts";
6414
6709
  const outDirName = this.fileCompiler.getOutDirName();
6415
6710
  const cmd = `npm create vite@latest ${outDirName} -- --template ${template}`;
@@ -6497,7 +6792,7 @@ var FileCompiler = (_class10 = class extends BaseCompiler {
6497
6792
  this.spinner.start("Copying assets...");
6498
6793
  const assetCount = await this.assetManager.runAssetPipeline();
6499
6794
  this.spinner.stop();
6500
- await _optionalChain([this, 'access', _221 => _221.options, 'access', _222 => _222.onSuccess, 'optionalCall', _223 => _223()]);
6795
+ await _optionalChain([this, 'access', _229 => _229.options, 'access', _230 => _230.onSuccess, 'optionalCall', _231 => _231()]);
6501
6796
  const endTime = calcElapsedTime(startTime);
6502
6797
  this.printCoreLogs();
6503
6798
  this.showCompileStats(endTime, sfcCount, scriptCount, styleCount, assetCount);