@vureact/compiler-core 1.8.3 → 1.8.4

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vureact/compiler-core v1.8.3
2
+ * @vureact/compiler-core v1.8.4
3
3
  * (c) 2025-present Ruihong Zhong (Ryan John)
4
4
  * @license MIT
5
5
  */
@@ -39,7 +39,7 @@ var RUNTIME_PACKAGES = {
39
39
  },
40
40
  runtime: {
41
41
  name: PACKAGE_NAME.runtime,
42
- version: "^1.1.0"
42
+ version: "^1.1.1"
43
43
  }
44
44
  };
45
45
  var STYLE_MODULE_NAME = "$style";
@@ -311,7 +311,8 @@ var ADAPTER_RULES = {
311
311
  type: "rename"
312
312
  },
313
313
  dirOn: {
314
- target: "dir.On",
314
+ // fix: https://github.com/vureact-js/core/issues/49
315
+ target: "dir.on",
315
316
  package: PACKAGE_NAME.runtime,
316
317
  type: "rename"
317
318
  },
@@ -568,7 +569,8 @@ function buildJsxChildrenProcessor(nodeIR, ctx, state) {
568
569
  }
569
570
  function buildJsxChildren(children, ctx) {
570
571
  const result = [];
571
- for (const childIR of children) {
572
+ const normalizedChildren = Array.isArray(children) ? children : [];
573
+ for (const childIR of normalizedChildren) {
572
574
  const jsxNode = buildJsxNode(childIR, ctx);
573
575
  if (!jsxNode) continue;
574
576
  result.push(jsxNode);
@@ -3220,8 +3222,51 @@ function resolveSfcCssImport(ctx) {
3220
3222
  scriptIR.imports.push(importDecl);
3221
3223
  }
3222
3224
 
3223
- // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-define-async-component.ts
3225
+ // src/core/transform/sfc/script/syntax-processor/postprocess/resolve-vue-type-as-any.ts
3224
3226
  import * as t25 from "@babel/types";
3227
+ function resolveVueTypeAsAny(ctx) {
3228
+ return {
3229
+ TSTypeReference(path8) {
3230
+ if (isVueTypeRef(path8)) {
3231
+ replaceNode(path8, t25.tsAnyKeyword(), path8.node);
3232
+ }
3233
+ }
3234
+ };
3235
+ }
3236
+ function isVueTypeRef(path8) {
3237
+ const id = resolveTypeNameId(path8.node.typeName);
3238
+ return id !== null && isVueImport(id, path8);
3239
+ }
3240
+ function resolveTypeNameId(typeName) {
3241
+ if (t25.isIdentifier(typeName)) {
3242
+ return typeName;
3243
+ }
3244
+ if (t25.isTSQualifiedName(typeName)) {
3245
+ let node = typeName;
3246
+ while (t25.isTSQualifiedName(node)) {
3247
+ node = node.left;
3248
+ }
3249
+ return t25.isIdentifier(node) ? node : null;
3250
+ }
3251
+ return null;
3252
+ }
3253
+ function isVueImport(id, path8) {
3254
+ const binding = path8.scope.getBinding(id.name);
3255
+ if (!binding) return false;
3256
+ const bp = binding.path;
3257
+ if (!bp.isImportSpecifier() && !bp.isImportDefaultSpecifier()) {
3258
+ return false;
3259
+ }
3260
+ const importDecl = bp.parentPath;
3261
+ if (!importDecl.isImportDeclaration()) {
3262
+ return false;
3263
+ }
3264
+ const moduleName = importDecl.node.source.value;
3265
+ return VUE_PACKAGES.some((pkg) => moduleName.includes(pkg));
3266
+ }
3267
+
3268
+ // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-define-async-component.ts
3269
+ import * as t26 from "@babel/types";
3225
3270
  function resolveDefineAsyncComponent(ctx) {
3226
3271
  return {
3227
3272
  CallExpression(path8) {
@@ -3230,11 +3275,11 @@ function resolveDefineAsyncComponent(ctx) {
3230
3275
  return;
3231
3276
  }
3232
3277
  const [arg] = node.arguments;
3233
- if (!t25.isObjectExpression(arg)) {
3278
+ if (!t26.isObjectExpression(arg)) {
3234
3279
  return;
3235
3280
  }
3236
3281
  for (const prop of arg.properties) {
3237
- if (!t25.isObjectProperty(prop) || !t25.isIdentifier(prop.key) || prop.key.name !== "hydrate") {
3282
+ if (!t26.isObjectProperty(prop) || !t26.isIdentifier(prop.key) || prop.key.name !== "hydrate") {
3238
3283
  continue;
3239
3284
  }
3240
3285
  logger.warn('Unsupported option "hydrate"', {
@@ -3249,24 +3294,24 @@ function resolveDefineAsyncComponent(ctx) {
3249
3294
  }
3250
3295
 
3251
3296
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-define-expose.ts
3252
- import * as t27 from "@babel/types";
3297
+ import * as t28 from "@babel/types";
3253
3298
 
3254
3299
  // src/core/transform/sfc/script/shared/hook-creator.ts
3255
- import * as t26 from "@babel/types";
3300
+ import * as t27 from "@babel/types";
3256
3301
  function createUseCallback(body, deps) {
3257
- return t26.callExpression(t26.identifier(REACT_API_MAP.useCallback), [
3302
+ return t27.callExpression(t27.identifier(REACT_API_MAP.useCallback), [
3258
3303
  body,
3259
- deps ?? t26.arrayExpression([])
3304
+ deps ?? t27.arrayExpression([])
3260
3305
  ]);
3261
3306
  }
3262
3307
  function createUseMemo(body, deps) {
3263
- return t26.callExpression(t26.identifier(REACT_API_MAP.useMemo), [
3264
- t26.arrowFunctionExpression([], body),
3265
- deps ?? t26.arrayExpression([])
3308
+ return t27.callExpression(t27.identifier(REACT_API_MAP.useMemo), [
3309
+ t27.arrowFunctionExpression([], body),
3310
+ deps ?? t27.arrayExpression([])
3266
3311
  ]);
3267
3312
  }
3268
3313
  function createUseImperativeHandle(refId, init) {
3269
- return t26.callExpression(t26.identifier(REACT_API_MAP.useImperativeHandle), [refId, init]);
3314
+ return t27.callExpression(t27.identifier(REACT_API_MAP.useImperativeHandle), [refId, init]);
3270
3315
  }
3271
3316
 
3272
3317
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-define-expose.ts
@@ -3287,16 +3332,16 @@ function resolveDefineExpose(ctx) {
3287
3332
  const adapter = ADAPTER_RULES.react[MACRO_API_NAMES.expose];
3288
3333
  recordImport(ctx, adapter.package, REACT_API_MAP.forwardRef);
3289
3334
  recordImport(ctx, adapter.package, adapter.target);
3290
- if (!t27.isObjectExpression(expose) && !t27.isFunction(expose)) {
3335
+ if (!t28.isObjectExpression(expose) && !t28.isFunction(expose)) {
3291
3336
  logger.warn("Non-deterministic object literal may cause unknown risks.", {
3292
3337
  file: filename,
3293
3338
  loc: expose.loc,
3294
3339
  source: scriptData.source
3295
3340
  });
3296
3341
  }
3297
- const init = !t27.isFunction(expose) ? t27.arrowFunctionExpression([], expose) : expose;
3342
+ const init = !t28.isFunction(expose) ? t28.arrowFunctionExpression([], expose) : expose;
3298
3343
  const { forwardRef } = scriptData;
3299
- const newNode = createUseImperativeHandle(t27.identifier(forwardRef.refField), init);
3344
+ const newNode = createUseImperativeHandle(t28.identifier(forwardRef.refField), init);
3300
3345
  forwardRef.enabled = true;
3301
3346
  replaceNode(path8, newNode, node);
3302
3347
  }
@@ -3317,7 +3362,7 @@ function resolveDefineOptions(ctx) {
3317
3362
  }
3318
3363
 
3319
3364
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-emit-calls.ts
3320
- import * as t28 from "@babel/types";
3365
+ import * as t29 from "@babel/types";
3321
3366
  function resolveEmitCalls(ctx) {
3322
3367
  const formatEmitEventName = (raw) => {
3323
3368
  if (raw.startsWith("update:")) {
@@ -3331,7 +3376,7 @@ function resolveEmitCalls(ctx) {
3331
3376
  CallExpression(path8) {
3332
3377
  const { node } = path8;
3333
3378
  const { filename, templateData, scriptData } = ctx;
3334
- if (!t28.isIdentifier(node.callee)) return;
3379
+ if (!t29.isIdentifier(node.callee)) return;
3335
3380
  const { name } = node.callee;
3336
3381
  const checkIfFromDefineEmits = () => {
3337
3382
  let result = false;
@@ -3343,7 +3388,7 @@ function resolveEmitCalls(ctx) {
3343
3388
  const binding = path8.scope.getBinding(name);
3344
3389
  if (binding) {
3345
3390
  const parent = binding.path.node;
3346
- if (t28.isVariableDeclarator(parent) && t28.isCallExpression(parent.init) && t28.isIdentifier(parent.init.callee)) {
3391
+ if (t29.isVariableDeclarator(parent) && t29.isCallExpression(parent.init) && t29.isIdentifier(parent.init.callee)) {
3347
3392
  result = parent.init.callee.name === MACRO_API_NAMES.emits;
3348
3393
  }
3349
3394
  }
@@ -3353,9 +3398,9 @@ function resolveEmitCalls(ctx) {
3353
3398
  if (!checkIfFromDefineEmits()) return;
3354
3399
  const [callee, ...args] = node.arguments;
3355
3400
  let propCall;
3356
- if (t28.isStringLiteral(callee)) {
3401
+ if (t29.isStringLiteral(callee)) {
3357
3402
  const eventName = formatEmitEventName(callee.value);
3358
- propCall = createPropCall(ctx.propField, t28.identifier(eventName), args);
3403
+ propCall = createPropCall(ctx.propField, t29.identifier(eventName), args);
3359
3404
  } else {
3360
3405
  propCall = createPropCall(ctx.propField, callee, args, true);
3361
3406
  logger.error(
@@ -3372,38 +3417,38 @@ function resolveEmitCalls(ctx) {
3372
3417
  };
3373
3418
  }
3374
3419
  function createPropCall(rootName, callee, args, computed = false) {
3375
- return t28.optionalCallExpression(
3376
- t28.memberExpression(t28.identifier(rootName), callee, computed),
3420
+ return t29.optionalCallExpression(
3421
+ t29.memberExpression(t29.identifier(rootName), callee, computed),
3377
3422
  args,
3378
3423
  true
3379
3424
  );
3380
3425
  }
3381
3426
 
3382
3427
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-props-interface/index.ts
3383
- import * as t36 from "@babel/types";
3428
+ import * as t37 from "@babel/types";
3384
3429
 
3385
3430
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-props-interface/resolve-emits.ts
3386
- import * as t30 from "@babel/types";
3431
+ import * as t31 from "@babel/types";
3387
3432
 
3388
3433
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-props-interface/shared.ts
3389
- import * as t29 from "@babel/types";
3434
+ import * as t30 from "@babel/types";
3390
3435
  function cloneCallableParams(params) {
3391
3436
  const cloneCallableParam = (param, index) => {
3392
- if (t29.isRestElement(param)) {
3437
+ if (t30.isRestElement(param)) {
3393
3438
  const arg = param.argument;
3394
- const name = t29.isIdentifier(arg) ? arg.name : `args${index}`;
3395
- const rest = t29.restElement(t29.identifier(name));
3396
- rest.typeAnnotation = param.typeAnnotation || (t29.isIdentifier(arg) ? arg.typeAnnotation : null) || t29.tsTypeAnnotation(t29.tsArrayType(t29.tsAnyKeyword()));
3439
+ const name = t30.isIdentifier(arg) ? arg.name : `args${index}`;
3440
+ const rest = t30.restElement(t30.identifier(name));
3441
+ rest.typeAnnotation = param.typeAnnotation || (t30.isIdentifier(arg) ? arg.typeAnnotation : null) || t30.tsTypeAnnotation(t30.tsArrayType(t30.tsAnyKeyword()));
3397
3442
  return rest;
3398
3443
  }
3399
- if (t29.isIdentifier(param)) {
3400
- const id = t29.identifier(param.name || `arg${index}`);
3444
+ if (t30.isIdentifier(param)) {
3445
+ const id = t30.identifier(param.name || `arg${index}`);
3401
3446
  id.optional = param.optional;
3402
- id.typeAnnotation = param.typeAnnotation || t29.tsTypeAnnotation(t29.tsAnyKeyword());
3447
+ id.typeAnnotation = param.typeAnnotation || t30.tsTypeAnnotation(t30.tsAnyKeyword());
3403
3448
  return id;
3404
3449
  }
3405
- const fallback = t29.identifier(`arg${index}`);
3406
- fallback.typeAnnotation = t29.tsTypeAnnotation(t29.tsAnyKeyword());
3450
+ const fallback = t30.identifier(`arg${index}`);
3451
+ fallback.typeAnnotation = t30.tsTypeAnnotation(t30.tsAnyKeyword());
3407
3452
  return fallback;
3408
3453
  };
3409
3454
  return params.map(cloneCallableParam);
@@ -3413,18 +3458,18 @@ function cloneCallableParams(params) {
3413
3458
  function resolveEmitsTopLevelTypes(ctx) {
3414
3459
  return {
3415
3460
  "TSInterfaceDeclaration|TSTypeAliasDeclaration"(path8) {
3416
- if (!t30.isProgram(path8.parent)) return;
3461
+ if (!t31.isProgram(path8.parent)) return;
3417
3462
  const { node } = path8;
3418
- if (t30.isTSInterfaceDeclaration(node)) {
3419
- const typeLiteral = t30.tsTypeLiteral(node.body.body);
3463
+ if (t31.isTSInterfaceDeclaration(node)) {
3464
+ const typeLiteral = t31.tsTypeLiteral(node.body.body);
3420
3465
  if (!hasEmitsSignatureInType(typeLiteral)) return;
3421
3466
  const resolved = resolveTopLevelEmitType(typeLiteral);
3422
- if (resolved && t30.isTSTypeLiteral(resolved)) {
3467
+ if (resolved && t31.isTSTypeLiteral(resolved)) {
3423
3468
  node.body.body = resolved.members;
3424
3469
  }
3425
3470
  return;
3426
3471
  }
3427
- if (t30.isTSTypeAliasDeclaration(node)) {
3472
+ if (t31.isTSTypeAliasDeclaration(node)) {
3428
3473
  if (!hasEmitsSignatureInType(node.typeAnnotation)) return;
3429
3474
  const resolved = resolveTopLevelEmitType(node.typeAnnotation);
3430
3475
  if (resolved) {
@@ -3435,47 +3480,47 @@ function resolveEmitsTopLevelTypes(ctx) {
3435
3480
  };
3436
3481
  }
3437
3482
  function resolveTopLevelEmitType(tsType) {
3438
- if (t30.isTSParenthesizedType(tsType)) {
3483
+ if (t31.isTSParenthesizedType(tsType)) {
3439
3484
  return resolveTopLevelEmitType(tsType.typeAnnotation);
3440
3485
  }
3441
- if (t30.isTSTypeReference(tsType)) {
3486
+ if (t31.isTSTypeReference(tsType)) {
3442
3487
  if (!tsType.typeParameters || !tsType.typeParameters.params.length) {
3443
3488
  return tsType;
3444
3489
  }
3445
3490
  const params = tsType.typeParameters.params.map((param) => resolveTopLevelEmitType(param)).filter(Boolean);
3446
- return t30.tsTypeReference(
3491
+ return t31.tsTypeReference(
3447
3492
  tsType.typeName,
3448
- t30.tsTypeParameterInstantiation(params.length ? params : tsType.typeParameters.params)
3493
+ t31.tsTypeParameterInstantiation(params.length ? params : tsType.typeParameters.params)
3449
3494
  );
3450
3495
  }
3451
- if (t30.isTSIntersectionType(tsType)) {
3496
+ if (t31.isTSIntersectionType(tsType)) {
3452
3497
  const types = tsType.types.map(resolveTopLevelEmitType).filter(Boolean);
3453
3498
  if (!types.length) return null;
3454
3499
  if (types.length === 1) return types[0];
3455
- return t30.tsIntersectionType(types);
3500
+ return t31.tsIntersectionType(types);
3456
3501
  }
3457
- if (t30.isTSUnionType(tsType)) {
3502
+ if (t31.isTSUnionType(tsType)) {
3458
3503
  const types = tsType.types.map(resolveTopLevelEmitType).filter(Boolean);
3459
3504
  if (!types.length) return null;
3460
3505
  if (types.length === 1) return types[0];
3461
- return t30.tsUnionType(types);
3506
+ return t31.tsUnionType(types);
3462
3507
  }
3463
- if (t30.isTSTypeLiteral(tsType)) {
3508
+ if (t31.isTSTypeLiteral(tsType)) {
3464
3509
  const members = [];
3465
3510
  for (const member of tsType.members) {
3466
- if (t30.isTSCallSignatureDeclaration(member)) {
3511
+ if (t31.isTSCallSignatureDeclaration(member)) {
3467
3512
  members.push(...resolveEmitPropsFromCallSignature(member));
3468
3513
  continue;
3469
3514
  }
3470
3515
  members.push(member);
3471
3516
  }
3472
3517
  if (!members.length) return null;
3473
- return t30.tsTypeLiteral(members);
3518
+ return t31.tsTypeLiteral(members);
3474
3519
  }
3475
- if (t30.isTSFunctionType(tsType)) {
3520
+ if (t31.isTSFunctionType(tsType)) {
3476
3521
  const props = resolveEmitPropsFromCallable(tsType.parameters, tsType.typeAnnotation);
3477
3522
  if (!props.length) return null;
3478
- return t30.tsTypeLiteral(props);
3523
+ return t31.tsTypeLiteral(props);
3479
3524
  }
3480
3525
  return tsType;
3481
3526
  }
@@ -3496,41 +3541,41 @@ function processInferredTypes(ctx, runtimeArg) {
3496
3541
  propsTSIface: { emitTypes }
3497
3542
  } = ctx.scriptData;
3498
3543
  const members = [];
3499
- if (t30.isArrayExpression(runtimeArg)) {
3544
+ if (t31.isArrayExpression(runtimeArg)) {
3500
3545
  for (const element of runtimeArg.elements) {
3501
- if (!element || !t30.isStringLiteral(element)) continue;
3546
+ if (!element || !t31.isStringLiteral(element)) continue;
3502
3547
  const handlerName = resolveEmitHandlerName(element.value);
3503
3548
  const key = buildKey(handlerName);
3504
- const fnType = t30.tsFunctionType(
3549
+ const fnType = t31.tsFunctionType(
3505
3550
  null,
3506
3551
  [createRestAnyParam("args")],
3507
- t30.tsTypeAnnotation(t30.tsAnyKeyword())
3552
+ t31.tsTypeAnnotation(t31.tsAnyKeyword())
3508
3553
  );
3509
- const prop = t30.tsPropertySignature(key, t30.tsTypeAnnotation(fnType));
3554
+ const prop = t31.tsPropertySignature(key, t31.tsTypeAnnotation(fnType));
3510
3555
  prop.optional = true;
3511
3556
  members.push(prop);
3512
3557
  }
3513
3558
  if (members.length) {
3514
- emitTypes.push(t30.tsTypeLiteral(members));
3559
+ emitTypes.push(t31.tsTypeLiteral(members));
3515
3560
  }
3516
3561
  return;
3517
3562
  }
3518
- if (t30.isObjectExpression(runtimeArg)) {
3563
+ if (t31.isObjectExpression(runtimeArg)) {
3519
3564
  for (const prop of runtimeArg.properties) {
3520
- if (!t30.isObjectProperty(prop)) continue;
3521
- if (t30.isSpreadElement(prop)) continue;
3565
+ if (!t31.isObjectProperty(prop)) continue;
3566
+ if (t31.isSpreadElement(prop)) continue;
3522
3567
  const rawName = resolvePropName(prop.key);
3523
3568
  if (!rawName) continue;
3524
3569
  const handlerName = resolveEmitHandlerName(rawName);
3525
3570
  const key = buildKey(handlerName);
3526
- const params = t30.isArrayExpression(prop.value) ? resolveRuntimeTupleParams(prop.value) : [createRestAnyParam("args")];
3527
- const fnType = t30.tsFunctionType(null, params, t30.tsTypeAnnotation(t30.tsAnyKeyword()));
3528
- const propSig = t30.tsPropertySignature(key, t30.tsTypeAnnotation(fnType));
3571
+ const params = t31.isArrayExpression(prop.value) ? resolveRuntimeTupleParams(prop.value) : [createRestAnyParam("args")];
3572
+ const fnType = t31.tsFunctionType(null, params, t31.tsTypeAnnotation(t31.tsAnyKeyword()));
3573
+ const propSig = t31.tsPropertySignature(key, t31.tsTypeAnnotation(fnType));
3529
3574
  propSig.optional = true;
3530
3575
  members.push(propSig);
3531
3576
  }
3532
3577
  if (members.length) {
3533
- emitTypes.push(t30.tsTypeLiteral(members));
3578
+ emitTypes.push(t31.tsTypeLiteral(members));
3534
3579
  }
3535
3580
  }
3536
3581
  }
@@ -3551,129 +3596,129 @@ function resolveEmitHandlerName(rawName) {
3551
3596
  return `on${name}`;
3552
3597
  }
3553
3598
  function resolvePropName(key) {
3554
- if (t30.isIdentifier(key)) return key.name;
3555
- if (t30.isStringLiteral(key)) return key.value;
3556
- if (t30.isNumericLiteral(key)) return String(key.value);
3599
+ if (t31.isIdentifier(key)) return key.name;
3600
+ if (t31.isStringLiteral(key)) return key.value;
3601
+ if (t31.isNumericLiteral(key)) return String(key.value);
3557
3602
  return null;
3558
3603
  }
3559
3604
  function buildKey(name) {
3560
- return t30.isValidIdentifier(name) ? t30.identifier(name) : t30.stringLiteral(name);
3605
+ return t31.isValidIdentifier(name) ? t31.identifier(name) : t31.stringLiteral(name);
3561
3606
  }
3562
3607
  function createRestAnyParam(name) {
3563
- const id = t30.identifier(name);
3564
- const rest = t30.restElement(id);
3565
- rest.typeAnnotation = t30.tsTypeAnnotation(t30.tsArrayType(t30.tsAnyKeyword()));
3608
+ const id = t31.identifier(name);
3609
+ const rest = t31.restElement(id);
3610
+ rest.typeAnnotation = t31.tsTypeAnnotation(t31.tsArrayType(t31.tsAnyKeyword()));
3566
3611
  return rest;
3567
3612
  }
3568
3613
  function resolveRuntimeTupleParams(value) {
3569
3614
  const params = [];
3570
3615
  value.elements.forEach((element, index) => {
3571
3616
  if (!element) return;
3572
- if (t30.isSpreadElement(element)) {
3617
+ if (t31.isSpreadElement(element)) {
3573
3618
  params.push(createRestAnyParam(`args${index}`));
3574
3619
  return;
3575
3620
  }
3576
- if (t30.isIdentifier(element)) {
3577
- const id = t30.identifier(element.name);
3578
- id.typeAnnotation = element.typeAnnotation || t30.tsTypeAnnotation(t30.tsAnyKeyword());
3621
+ if (t31.isIdentifier(element)) {
3622
+ const id = t31.identifier(element.name);
3623
+ id.typeAnnotation = element.typeAnnotation || t31.tsTypeAnnotation(t31.tsAnyKeyword());
3579
3624
  params.push(id);
3580
3625
  return;
3581
3626
  }
3582
- if (t30.isTSAsExpression(element)) {
3583
- const id = t30.identifier(`arg${index}`);
3584
- id.typeAnnotation = t30.tsTypeAnnotation(element.typeAnnotation);
3627
+ if (t31.isTSAsExpression(element)) {
3628
+ const id = t31.identifier(`arg${index}`);
3629
+ id.typeAnnotation = t31.tsTypeAnnotation(element.typeAnnotation);
3585
3630
  params.push(id);
3586
3631
  return;
3587
3632
  }
3588
- const fallback = t30.identifier(`arg${index}`);
3589
- fallback.typeAnnotation = t30.tsTypeAnnotation(t30.tsAnyKeyword());
3633
+ const fallback = t31.identifier(`arg${index}`);
3634
+ fallback.typeAnnotation = t31.tsTypeAnnotation(t31.tsAnyKeyword());
3590
3635
  params.push(fallback);
3591
3636
  });
3592
3637
  return params;
3593
3638
  }
3594
3639
  function resolveExplicitEmitType(tsType) {
3595
- if (t30.isTSParenthesizedType(tsType)) {
3640
+ if (t31.isTSParenthesizedType(tsType)) {
3596
3641
  return resolveExplicitEmitType(tsType.typeAnnotation);
3597
3642
  }
3598
- if (t30.isTSTypeReference(tsType)) {
3643
+ if (t31.isTSTypeReference(tsType)) {
3599
3644
  if (!tsType.typeParameters || !tsType.typeParameters.params.length) {
3600
3645
  return tsType;
3601
3646
  }
3602
3647
  const params = tsType.typeParameters.params.map((param) => resolveExplicitEmitType(param)).filter(Boolean);
3603
- return t30.tsTypeReference(
3648
+ return t31.tsTypeReference(
3604
3649
  tsType.typeName,
3605
- t30.tsTypeParameterInstantiation(params.length ? params : tsType.typeParameters.params)
3650
+ t31.tsTypeParameterInstantiation(params.length ? params : tsType.typeParameters.params)
3606
3651
  );
3607
3652
  }
3608
- if (t30.isTSIntersectionType(tsType)) {
3653
+ if (t31.isTSIntersectionType(tsType)) {
3609
3654
  const types = tsType.types.map(resolveExplicitEmitType).filter(Boolean);
3610
3655
  if (!types.length) return null;
3611
3656
  if (types.length === 1) return types[0];
3612
- return t30.tsIntersectionType(types);
3657
+ return t31.tsIntersectionType(types);
3613
3658
  }
3614
- if (t30.isTSUnionType(tsType)) {
3659
+ if (t31.isTSUnionType(tsType)) {
3615
3660
  const types = tsType.types.map(resolveExplicitEmitType).filter(Boolean);
3616
3661
  if (!types.length) return null;
3617
3662
  if (types.length === 1) return types[0];
3618
- return t30.tsUnionType(types);
3663
+ return t31.tsUnionType(types);
3619
3664
  }
3620
- if (t30.isTSTypeLiteral(tsType)) {
3665
+ if (t31.isTSTypeLiteral(tsType)) {
3621
3666
  const members = [];
3622
3667
  for (const member of tsType.members) {
3623
- if (t30.isTSPropertySignature(member)) {
3668
+ if (t31.isTSPropertySignature(member)) {
3624
3669
  const prop = resolveEmitPropFromPropertySignature(member);
3625
3670
  if (prop) members.push(prop);
3626
3671
  continue;
3627
3672
  }
3628
- if (t30.isTSCallSignatureDeclaration(member)) {
3673
+ if (t31.isTSCallSignatureDeclaration(member)) {
3629
3674
  members.push(...resolveEmitPropsFromCallSignature(member));
3630
3675
  continue;
3631
3676
  }
3632
3677
  }
3633
3678
  if (!members.length) return null;
3634
- return t30.tsTypeLiteral(members);
3679
+ return t31.tsTypeLiteral(members);
3635
3680
  }
3636
- if (t30.isTSFunctionType(tsType)) {
3681
+ if (t31.isTSFunctionType(tsType)) {
3637
3682
  const props = resolveEmitPropsFromCallable(tsType.parameters, tsType.typeAnnotation);
3638
3683
  if (!props.length) return null;
3639
- return t30.tsTypeLiteral(props);
3684
+ return t31.tsTypeLiteral(props);
3640
3685
  }
3641
3686
  return tsType;
3642
3687
  }
3643
3688
  function hasEmitsSignatureInType(tsType) {
3644
- if (t30.isTSParenthesizedType(tsType)) {
3689
+ if (t31.isTSParenthesizedType(tsType)) {
3645
3690
  return hasEmitsSignatureInType(tsType.typeAnnotation);
3646
3691
  }
3647
- if (t30.isTSTypeReference(tsType)) {
3692
+ if (t31.isTSTypeReference(tsType)) {
3648
3693
  if (!tsType.typeParameters || !tsType.typeParameters.params.length) {
3649
3694
  return false;
3650
3695
  }
3651
3696
  return tsType.typeParameters.params.some(hasEmitsSignatureInType);
3652
3697
  }
3653
- if (t30.isTSIntersectionType(tsType) || t30.isTSUnionType(tsType)) {
3698
+ if (t31.isTSIntersectionType(tsType) || t31.isTSUnionType(tsType)) {
3654
3699
  return tsType.types.some(hasEmitsSignatureInType);
3655
3700
  }
3656
- if (t30.isTSTypeLiteral(tsType)) {
3701
+ if (t31.isTSTypeLiteral(tsType)) {
3657
3702
  return tsType.members.some(hasEmitsSignatureInMember);
3658
3703
  }
3659
- if (t30.isTSFunctionType(tsType)) {
3704
+ if (t31.isTSFunctionType(tsType)) {
3660
3705
  return isEmitsCallable(tsType.parameters);
3661
3706
  }
3662
3707
  return false;
3663
3708
  }
3664
3709
  function hasEmitsSignatureInMember(member) {
3665
- if (t30.isTSCallSignatureDeclaration(member)) {
3710
+ if (t31.isTSCallSignatureDeclaration(member)) {
3666
3711
  return isEmitsCallable(member.parameters);
3667
3712
  }
3668
3713
  return false;
3669
3714
  }
3670
3715
  function isEmitsCallable(parameters) {
3671
3716
  const [eventParam] = parameters;
3672
- if (!eventParam || !t30.isIdentifier(eventParam) || !eventParam.typeAnnotation) {
3717
+ if (!eventParam || !t31.isIdentifier(eventParam) || !eventParam.typeAnnotation) {
3673
3718
  return false;
3674
3719
  }
3675
3720
  const { typeAnnotation } = eventParam;
3676
- if (t30.isNoop(typeAnnotation)) return false;
3721
+ if (t31.isNoop(typeAnnotation)) return false;
3677
3722
  return resolveEventNames(typeAnnotation.typeAnnotation).length > 0;
3678
3723
  }
3679
3724
  function resolveEmitPropFromPropertySignature(member) {
@@ -3683,19 +3728,19 @@ function resolveEmitPropFromPropertySignature(member) {
3683
3728
  const key = buildKey(handlerName);
3684
3729
  const typeAnnotation = member.typeAnnotation?.typeAnnotation;
3685
3730
  let params = [];
3686
- let returnType = t30.tsAnyKeyword();
3687
- if (typeAnnotation && t30.isTSFunctionType(typeAnnotation)) {
3731
+ let returnType = t31.tsAnyKeyword();
3732
+ if (typeAnnotation && t31.isTSFunctionType(typeAnnotation)) {
3688
3733
  params = cloneCallableParams(typeAnnotation.parameters);
3689
3734
  returnType = typeAnnotation.typeAnnotation?.typeAnnotation ?? returnType;
3690
- } else if (typeAnnotation && t30.isTSTupleType(typeAnnotation)) {
3735
+ } else if (typeAnnotation && t31.isTSTupleType(typeAnnotation)) {
3691
3736
  params = resolveTupleTypeParams(typeAnnotation);
3692
3737
  } else if (typeAnnotation) {
3693
- const id = t30.identifier("value");
3694
- id.typeAnnotation = t30.tsTypeAnnotation(typeAnnotation);
3738
+ const id = t31.identifier("value");
3739
+ id.typeAnnotation = t31.tsTypeAnnotation(typeAnnotation);
3695
3740
  params = [id];
3696
3741
  }
3697
- const fnType = t30.tsFunctionType(null, params, t30.tsTypeAnnotation(returnType));
3698
- const prop = t30.tsPropertySignature(key, t30.tsTypeAnnotation(fnType));
3742
+ const fnType = t31.tsFunctionType(null, params, t31.tsTypeAnnotation(returnType));
3743
+ const prop = t31.tsPropertySignature(key, t31.tsTypeAnnotation(fnType));
3699
3744
  prop.optional = !!member.optional;
3700
3745
  return prop;
3701
3746
  }
@@ -3704,32 +3749,32 @@ function resolveEmitPropsFromCallSignature(member) {
3704
3749
  }
3705
3750
  function resolveEmitPropsFromCallable(parameters, typeAnnotation) {
3706
3751
  const [eventParam, ...restParams] = parameters;
3707
- if (!eventParam || !t30.isIdentifier(eventParam) || !eventParam.typeAnnotation) {
3752
+ if (!eventParam || !t31.isIdentifier(eventParam) || !eventParam.typeAnnotation) {
3708
3753
  return [];
3709
3754
  }
3710
3755
  const { typeAnnotation: paramTypeAnnotation } = eventParam;
3711
- if (t30.isNoop(paramTypeAnnotation)) return [];
3756
+ if (t31.isNoop(paramTypeAnnotation)) return [];
3712
3757
  const eventNames = resolveEventNames(paramTypeAnnotation.typeAnnotation);
3713
3758
  if (!eventNames.length) return [];
3714
- const returnType = typeAnnotation?.typeAnnotation ?? t30.tsAnyKeyword();
3759
+ const returnType = typeAnnotation?.typeAnnotation ?? t31.tsAnyKeyword();
3715
3760
  return eventNames.map((eventName) => {
3716
3761
  const handlerName = resolveEmitHandlerName(eventName);
3717
3762
  const key = buildKey(handlerName);
3718
3763
  const params = cloneCallableParams(restParams);
3719
- const fnType = t30.tsFunctionType(null, params, t30.tsTypeAnnotation(returnType));
3720
- const prop = t30.tsPropertySignature(key, t30.tsTypeAnnotation(fnType));
3764
+ const fnType = t31.tsFunctionType(null, params, t31.tsTypeAnnotation(returnType));
3765
+ const prop = t31.tsPropertySignature(key, t31.tsTypeAnnotation(fnType));
3721
3766
  prop.optional = true;
3722
3767
  return prop;
3723
3768
  });
3724
3769
  }
3725
3770
  function resolveEventNames(type) {
3726
- if (t30.isTSLiteralType(type) && t30.isStringLiteral(type.literal)) {
3771
+ if (t31.isTSLiteralType(type) && t31.isStringLiteral(type.literal)) {
3727
3772
  return [type.literal.value];
3728
3773
  }
3729
- if (t30.isTSUnionType(type)) {
3774
+ if (t31.isTSUnionType(type)) {
3730
3775
  return type.types.flatMap(resolveEventNames);
3731
3776
  }
3732
- if (t30.isTSParenthesizedType(type)) {
3777
+ if (t31.isTSParenthesizedType(type)) {
3733
3778
  return resolveEventNames(type.typeAnnotation);
3734
3779
  }
3735
3780
  return [];
@@ -3742,44 +3787,44 @@ function resolveTupleTypeParams(tuple) {
3742
3787
  return params;
3743
3788
  }
3744
3789
  function resolveTupleElementParam(element, index) {
3745
- const isNamedTuple = typeof t30.isTSNamedTupleMember === "function" && t30.isTSNamedTupleMember(element);
3790
+ const isNamedTuple = typeof t31.isTSNamedTupleMember === "function" && t31.isTSNamedTupleMember(element);
3746
3791
  if (isNamedTuple) {
3747
3792
  const tupleMember = element;
3748
3793
  const name = tupleMember.label?.name || `arg${index}`;
3749
3794
  let innerType = tupleMember.elementType;
3750
3795
  let optional = tupleMember.optional;
3751
- if (t30.isTSOptionalType(innerType)) {
3796
+ if (t31.isTSOptionalType(innerType)) {
3752
3797
  optional = true;
3753
3798
  innerType = innerType.typeAnnotation;
3754
3799
  }
3755
- if (t30.isTSRestType(innerType)) {
3756
- const rest = t30.restElement(t30.identifier(name));
3757
- rest.typeAnnotation = t30.tsTypeAnnotation(innerType.typeAnnotation);
3800
+ if (t31.isTSRestType(innerType)) {
3801
+ const rest = t31.restElement(t31.identifier(name));
3802
+ rest.typeAnnotation = t31.tsTypeAnnotation(innerType.typeAnnotation);
3758
3803
  return rest;
3759
3804
  }
3760
- const id2 = t30.identifier(name);
3805
+ const id2 = t31.identifier(name);
3761
3806
  id2.optional = optional;
3762
- id2.typeAnnotation = t30.tsTypeAnnotation(innerType);
3807
+ id2.typeAnnotation = t31.tsTypeAnnotation(innerType);
3763
3808
  return id2;
3764
3809
  }
3765
- if (t30.isTSRestType(element)) {
3766
- const rest = t30.restElement(t30.identifier(`args${index}`));
3767
- rest.typeAnnotation = t30.tsTypeAnnotation(element.typeAnnotation);
3810
+ if (t31.isTSRestType(element)) {
3811
+ const rest = t31.restElement(t31.identifier(`args${index}`));
3812
+ rest.typeAnnotation = t31.tsTypeAnnotation(element.typeAnnotation);
3768
3813
  return rest;
3769
3814
  }
3770
- if (t30.isTSOptionalType(element)) {
3771
- const id2 = t30.identifier(`arg${index}`);
3815
+ if (t31.isTSOptionalType(element)) {
3816
+ const id2 = t31.identifier(`arg${index}`);
3772
3817
  id2.optional = true;
3773
- id2.typeAnnotation = t30.tsTypeAnnotation(element.typeAnnotation);
3818
+ id2.typeAnnotation = t31.tsTypeAnnotation(element.typeAnnotation);
3774
3819
  return id2;
3775
3820
  }
3776
- const id = t30.identifier(`arg${index}`);
3777
- id.typeAnnotation = t30.tsTypeAnnotation(element);
3821
+ const id = t31.identifier(`arg${index}`);
3822
+ id.typeAnnotation = t31.tsTypeAnnotation(element);
3778
3823
  return id;
3779
3824
  }
3780
3825
 
3781
3826
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-props-interface/resolve-props.ts
3782
- import * as t31 from "@babel/types";
3827
+ import * as t32 from "@babel/types";
3783
3828
  function resolveDefinePropsIface(path8, ctx) {
3784
3829
  const { node } = path8;
3785
3830
  const [runtimeArg] = node.arguments;
@@ -3799,38 +3844,38 @@ function processInferredTypes2(ctx, runtimeArg) {
3799
3844
  } = scriptData;
3800
3845
  if (!runtimeArg) return;
3801
3846
  const members = [];
3802
- if (t31.isArrayExpression(runtimeArg)) {
3847
+ if (t32.isArrayExpression(runtimeArg)) {
3803
3848
  for (const element of runtimeArg.elements) {
3804
- if (!element || !t31.isStringLiteral(element)) continue;
3805
- const key = t31.isValidIdentifier(element.value) ? t31.identifier(element.value) : t31.stringLiteral(element.value);
3806
- const prop = t31.tsPropertySignature(key, t31.tsTypeAnnotation(t31.tsAnyKeyword()));
3849
+ if (!element || !t32.isStringLiteral(element)) continue;
3850
+ const key = t32.isValidIdentifier(element.value) ? t32.identifier(element.value) : t32.stringLiteral(element.value);
3851
+ const prop = t32.tsPropertySignature(key, t32.tsTypeAnnotation(t32.tsAnyKeyword()));
3807
3852
  prop.optional = true;
3808
3853
  members.push(prop);
3809
3854
  }
3810
3855
  if (members.length) {
3811
- propsTypes.push(t31.tsTypeLiteral(members));
3856
+ propsTypes.push(t32.tsTypeLiteral(members));
3812
3857
  }
3813
3858
  return;
3814
3859
  }
3815
- if (t31.isObjectExpression(runtimeArg)) {
3860
+ if (t32.isObjectExpression(runtimeArg)) {
3816
3861
  for (const prop of runtimeArg.properties) {
3817
- if (!t31.isObjectProperty(prop)) continue;
3818
- if (t31.isSpreadElement(prop)) continue;
3862
+ if (!t32.isObjectProperty(prop)) continue;
3863
+ if (t32.isSpreadElement(prop)) continue;
3819
3864
  const key = prop.key;
3820
3865
  let propName = null;
3821
- if (t31.isIdentifier(key)) propName = key.name;
3822
- if (t31.isStringLiteral(key)) propName = key.value;
3823
- if (t31.isNumericLiteral(key)) propName = String(key.value);
3866
+ if (t32.isIdentifier(key)) propName = key.name;
3867
+ if (t32.isStringLiteral(key)) propName = key.value;
3868
+ if (t32.isNumericLiteral(key)) propName = String(key.value);
3824
3869
  if (!propName) continue;
3825
3870
  const { type, required } = resolveRuntimePropMeta(prop.value);
3826
- const tsType = type ?? t31.tsAnyKeyword();
3827
- const tsKey = t31.isValidIdentifier(propName) ? t31.identifier(propName) : t31.stringLiteral(propName);
3828
- const tsProp = t31.tsPropertySignature(tsKey, t31.tsTypeAnnotation(tsType));
3871
+ const tsType = type ?? t32.tsAnyKeyword();
3872
+ const tsKey = t32.isValidIdentifier(propName) ? t32.identifier(propName) : t32.stringLiteral(propName);
3873
+ const tsProp = t32.tsPropertySignature(tsKey, t32.tsTypeAnnotation(tsType));
3829
3874
  tsProp.optional = !required;
3830
3875
  members.push(tsProp);
3831
3876
  }
3832
3877
  if (members.length) {
3833
- propsTypes.push(t31.tsTypeLiteral(members));
3878
+ propsTypes.push(t32.tsTypeLiteral(members));
3834
3879
  }
3835
3880
  return;
3836
3881
  }
@@ -3844,42 +3889,42 @@ function processInferredTypes2(ctx, runtimeArg) {
3844
3889
  );
3845
3890
  }
3846
3891
  function resolveRuntimePropMeta(value) {
3847
- if (t31.isIdentifier(value)) {
3892
+ if (t32.isIdentifier(value)) {
3848
3893
  return {
3849
3894
  type: mapRuntimeTypeToTSType(value),
3850
3895
  required: false
3851
3896
  };
3852
3897
  }
3853
- if (t31.isArrayExpression(value)) {
3898
+ if (t32.isArrayExpression(value)) {
3854
3899
  return {
3855
3900
  type: resolveRuntimeUnionType(value),
3856
3901
  required: false
3857
3902
  };
3858
3903
  }
3859
- if (!t31.isObjectExpression(value)) {
3904
+ if (!t32.isObjectExpression(value)) {
3860
3905
  return { required: false };
3861
3906
  }
3862
3907
  let type;
3863
3908
  let required = false;
3864
3909
  for (const prop of value.properties) {
3865
- if (!t31.isObjectProperty(prop)) continue;
3866
- if (t31.isSpreadElement(prop)) continue;
3910
+ if (!t32.isObjectProperty(prop)) continue;
3911
+ if (t32.isSpreadElement(prop)) continue;
3867
3912
  const key = prop.key;
3868
- const propName = t31.isIdentifier(key) ? key.name : t31.isStringLiteral(key) ? key.value : null;
3913
+ const propName = t32.isIdentifier(key) ? key.name : t32.isStringLiteral(key) ? key.value : null;
3869
3914
  if (!propName) continue;
3870
3915
  if (propName === "type") {
3871
3916
  const valueNode = prop.value;
3872
- if (t31.isArrayExpression(valueNode)) {
3917
+ if (t32.isArrayExpression(valueNode)) {
3873
3918
  type = resolveRuntimeUnionType(valueNode);
3874
3919
  continue;
3875
3920
  }
3876
- if (t31.isIdentifier(valueNode)) {
3921
+ if (t32.isIdentifier(valueNode)) {
3877
3922
  type = mapRuntimeTypeToTSType(valueNode);
3878
3923
  continue;
3879
3924
  }
3880
3925
  }
3881
3926
  if (propName === "required") {
3882
- if (t31.isBooleanLiteral(prop.value)) {
3927
+ if (t32.isBooleanLiteral(prop.value)) {
3883
3928
  required = prop.value.value;
3884
3929
  }
3885
3930
  }
@@ -3889,80 +3934,80 @@ function resolveRuntimePropMeta(value) {
3889
3934
  function resolveRuntimeUnionType(value) {
3890
3935
  const types = [];
3891
3936
  for (const element of value.elements) {
3892
- if (!element || !t31.isIdentifier(element)) continue;
3937
+ if (!element || !t32.isIdentifier(element)) continue;
3893
3938
  const resolved = mapRuntimeTypeToTSType(element);
3894
3939
  if (resolved) types.push(resolved);
3895
3940
  }
3896
- if (!types.length) return t31.tsAnyKeyword();
3941
+ if (!types.length) return t32.tsAnyKeyword();
3897
3942
  if (types.length === 1) return types[0];
3898
- return t31.tsUnionType(types);
3943
+ return t32.tsUnionType(types);
3899
3944
  }
3900
3945
  function mapRuntimeTypeToTSType(value) {
3901
3946
  switch (value.name) {
3902
3947
  case "String":
3903
- return t31.tsStringKeyword();
3948
+ return t32.tsStringKeyword();
3904
3949
  case "Number":
3905
- return t31.tsNumberKeyword();
3950
+ return t32.tsNumberKeyword();
3906
3951
  case "Boolean":
3907
- return t31.tsBooleanKeyword();
3952
+ return t32.tsBooleanKeyword();
3908
3953
  case "Object":
3909
- return t31.tsTypeLiteral([]);
3954
+ return t32.tsTypeLiteral([]);
3910
3955
  case "Array":
3911
- return t31.tsArrayType(t31.tsAnyKeyword());
3956
+ return t32.tsArrayType(t32.tsAnyKeyword());
3912
3957
  case "Function":
3913
- return t31.tsFunctionType(null, [], t31.tsTypeAnnotation(t31.tsAnyKeyword()));
3958
+ return t32.tsFunctionType(null, [], t32.tsTypeAnnotation(t32.tsAnyKeyword()));
3914
3959
  case "Symbol":
3915
- return t31.tsSymbolKeyword();
3960
+ return t32.tsSymbolKeyword();
3916
3961
  case "BigInt":
3917
- return t31.tsBigIntKeyword();
3962
+ return t32.tsBigIntKeyword();
3918
3963
  default:
3919
- return t31.tsAnyKeyword();
3964
+ return t32.tsAnyKeyword();
3920
3965
  }
3921
3966
  }
3922
3967
 
3923
3968
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-props-interface/resolve-slot/type-resolver.ts
3924
- import * as t34 from "@babel/types";
3969
+ import * as t35 from "@babel/types";
3925
3970
 
3926
3971
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-props-interface/resolve-slot/slot-builder.ts
3927
- import * as t32 from "@babel/types";
3972
+ import * as t33 from "@babel/types";
3928
3973
  var SLOT_DEFAULT_NAME = "default";
3929
3974
  var SLOT_CHILDREN_NAME = "children";
3930
3975
  var SLOT_FN_PARAM_NAME = "props";
3931
3976
  function buildSlotPropSignature(rawName, params, optional) {
3932
3977
  const propName = rawName === SLOT_DEFAULT_NAME ? SLOT_CHILDREN_NAME : rawName;
3933
- const key = t32.isValidIdentifier(propName) ? t32.identifier(propName) : t32.stringLiteral(propName);
3934
- const reactNodeType = t32.tsTypeAnnotation(
3935
- t32.tsTypeReference(t32.identifier(REACT_API_MAP.ReactNode))
3978
+ const key = t33.isValidIdentifier(propName) ? t33.identifier(propName) : t33.stringLiteral(propName);
3979
+ const reactNodeType = t33.tsTypeAnnotation(
3980
+ t33.tsTypeReference(t33.identifier(REACT_API_MAP.ReactNode))
3936
3981
  );
3937
3982
  let typeAnnotation;
3938
3983
  if (rawName === SLOT_DEFAULT_NAME && params.length === 0 || params.length === 0) {
3939
3984
  typeAnnotation = reactNodeType;
3940
3985
  } else {
3941
- const fnType = t32.tsFunctionType(null, params, reactNodeType);
3942
- typeAnnotation = t32.tsTypeAnnotation(fnType);
3986
+ const fnType = t33.tsFunctionType(null, params, reactNodeType);
3987
+ typeAnnotation = t33.tsTypeAnnotation(fnType);
3943
3988
  }
3944
- const prop = t32.tsPropertySignature(key, typeAnnotation);
3989
+ const prop = t33.tsPropertySignature(key, typeAnnotation);
3945
3990
  prop.optional = optional;
3946
3991
  return prop;
3947
3992
  }
3948
3993
  function createSlotScopeParam(props, ctx) {
3949
- const paramId = t32.identifier(SLOT_FN_PARAM_NAME);
3994
+ const paramId = t33.identifier(SLOT_FN_PARAM_NAME);
3950
3995
  const propsSigns = [];
3951
3996
  const { reactiveBindings } = ctx.templateData;
3952
3997
  props.forEach(({ prop, tsType }) => {
3953
3998
  const foundBindingValue = reactiveBindings[prop]?.value;
3954
3999
  const foundBindingTypes = foundBindingValue ? expressionToTSType(foundBindingValue) : null;
3955
- const typeAnnotation = foundBindingTypes ? t32.tsTypeAnnotation(foundBindingTypes) : tsType;
3956
- const key = t32.isValidIdentifier(prop) ? t32.identifier(prop) : t32.stringLiteral(prop);
3957
- const propSign = t32.tsPropertySignature(key, typeAnnotation);
4000
+ const typeAnnotation = foundBindingTypes ? t33.tsTypeAnnotation(foundBindingTypes) : tsType;
4001
+ const key = t33.isValidIdentifier(prop) ? t33.identifier(prop) : t33.stringLiteral(prop);
4002
+ const propSign = t33.tsPropertySignature(key, typeAnnotation);
3958
4003
  propsSigns.push(propSign);
3959
4004
  });
3960
- paramId.typeAnnotation = t32.tsTypeAnnotation(t32.tsTypeLiteral(propsSigns));
4005
+ paramId.typeAnnotation = t33.tsTypeAnnotation(t33.tsTypeLiteral(propsSigns));
3961
4006
  return paramId;
3962
4007
  }
3963
4008
 
3964
4009
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-props-interface/resolve-slot/utils.ts
3965
- import * as t33 from "@babel/types";
4010
+ import * as t34 from "@babel/types";
3966
4011
  function recordReactNode(ctx) {
3967
4012
  if (!ctx.scriptData.lang.startsWith("ts")) {
3968
4013
  return;
@@ -3978,16 +4023,16 @@ function collectLocalTypeDeclarations(path8) {
3978
4023
  return declarations;
3979
4024
  }
3980
4025
  for (const statement of programPath.node.body) {
3981
- if (t33.isTSInterfaceDeclaration(statement)) {
4026
+ if (t34.isTSInterfaceDeclaration(statement)) {
3982
4027
  declarations.set(statement.id.name, {
3983
- type: t33.tsTypeLiteral(statement.body.body),
4028
+ type: t34.tsTypeLiteral(statement.body.body),
3984
4029
  // 将接口体转换为类型字面量
3985
4030
  hasTypeParameters: !!statement.typeParameters?.params.length
3986
4031
  // 检查是否有泛型参数
3987
4032
  });
3988
4033
  continue;
3989
4034
  }
3990
- if (t33.isTSTypeAliasDeclaration(statement)) {
4035
+ if (t34.isTSTypeAliasDeclaration(statement)) {
3991
4036
  declarations.set(statement.id.name, {
3992
4037
  type: statement.typeAnnotation,
3993
4038
  // 直接使用类型注解
@@ -3996,16 +4041,16 @@ function collectLocalTypeDeclarations(path8) {
3996
4041
  });
3997
4042
  continue;
3998
4043
  }
3999
- if (t33.isExportNamedDeclaration(statement) && statement.declaration) {
4044
+ if (t34.isExportNamedDeclaration(statement) && statement.declaration) {
4000
4045
  const declaration = statement.declaration;
4001
- if (t33.isTSInterfaceDeclaration(declaration)) {
4046
+ if (t34.isTSInterfaceDeclaration(declaration)) {
4002
4047
  declarations.set(declaration.id.name, {
4003
- type: t33.tsTypeLiteral(declaration.body.body),
4048
+ type: t34.tsTypeLiteral(declaration.body.body),
4004
4049
  // 将接口体转换为类型字面量
4005
4050
  hasTypeParameters: !!declaration.typeParameters?.params.length
4006
4051
  // 检查是否有泛型参数
4007
4052
  });
4008
- } else if (t33.isTSTypeAliasDeclaration(declaration)) {
4053
+ } else if (t34.isTSTypeAliasDeclaration(declaration)) {
4009
4054
  declarations.set(declaration.id.name, {
4010
4055
  type: declaration.typeAnnotation,
4011
4056
  // 直接使用类型注解
@@ -4018,22 +4063,22 @@ function collectLocalTypeDeclarations(path8) {
4018
4063
  return declarations;
4019
4064
  }
4020
4065
  function resolvePropName2(key) {
4021
- if (t33.isIdentifier(key)) {
4066
+ if (t34.isIdentifier(key)) {
4022
4067
  return key.name;
4023
4068
  }
4024
- if (t33.isStringLiteral(key)) {
4069
+ if (t34.isStringLiteral(key)) {
4025
4070
  return key.value;
4026
4071
  }
4027
- if (t33.isNumericLiteral(key)) {
4072
+ if (t34.isNumericLiteral(key)) {
4028
4073
  return String(key.value);
4029
4074
  }
4030
4075
  return null;
4031
4076
  }
4032
4077
  function resolveCallableType(tsType) {
4033
- if (t33.isTSFunctionType(tsType)) {
4078
+ if (t34.isTSFunctionType(tsType)) {
4034
4079
  return tsType;
4035
4080
  }
4036
- if (t33.isTSParenthesizedType(tsType)) {
4081
+ if (t34.isTSParenthesizedType(tsType)) {
4037
4082
  return resolveCallableType(tsType.typeAnnotation);
4038
4083
  }
4039
4084
  return null;
@@ -4042,10 +4087,10 @@ function resolveCallableType(tsType) {
4042
4087
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-props-interface/resolve-slot/type-resolver.ts
4043
4088
  var SLOT_DEFAULT_NAME2 = "default";
4044
4089
  function resolveSlotType(tsType, options) {
4045
- if (t34.isTSParenthesizedType(tsType)) {
4090
+ if (t35.isTSParenthesizedType(tsType)) {
4046
4091
  return resolveSlotType(tsType.typeAnnotation, options);
4047
4092
  }
4048
- if (t34.isTSTypeReference(tsType)) {
4093
+ if (t35.isTSTypeReference(tsType)) {
4049
4094
  let shouldRecordReactNode = false;
4050
4095
  if (tsType.typeParameters?.params.length) {
4051
4096
  const params = [];
@@ -4061,11 +4106,11 @@ function resolveSlotType(tsType, options) {
4061
4106
  };
4062
4107
  }
4063
4108
  return {
4064
- type: t34.tsTypeReference(tsType.typeName, t34.tsTypeParameterInstantiation(params)),
4109
+ type: t35.tsTypeReference(tsType.typeName, t35.tsTypeParameterInstantiation(params)),
4065
4110
  shouldRecordReactNode
4066
4111
  };
4067
4112
  }
4068
- if (!t34.isIdentifier(tsType.typeName)) {
4113
+ if (!t35.isIdentifier(tsType.typeName)) {
4069
4114
  return {
4070
4115
  type: tsType,
4071
4116
  shouldRecordReactNode: false
@@ -4096,7 +4141,7 @@ function resolveSlotType(tsType, options) {
4096
4141
  }
4097
4142
  return resolved;
4098
4143
  }
4099
- if (t34.isTSIntersectionType(tsType)) {
4144
+ if (t35.isTSIntersectionType(tsType)) {
4100
4145
  const types = [];
4101
4146
  let shouldRecordReactNode = false;
4102
4147
  for (const item of tsType.types) {
@@ -4119,11 +4164,11 @@ function resolveSlotType(tsType, options) {
4119
4164
  };
4120
4165
  }
4121
4166
  return {
4122
- type: t34.tsIntersectionType(types),
4167
+ type: t35.tsIntersectionType(types),
4123
4168
  shouldRecordReactNode
4124
4169
  };
4125
4170
  }
4126
- if (t34.isTSUnionType(tsType)) {
4171
+ if (t35.isTSUnionType(tsType)) {
4127
4172
  const types = [];
4128
4173
  let shouldRecordReactNode = false;
4129
4174
  for (const item of tsType.types) {
@@ -4146,11 +4191,11 @@ function resolveSlotType(tsType, options) {
4146
4191
  };
4147
4192
  }
4148
4193
  return {
4149
- type: t34.tsUnionType(types),
4194
+ type: t35.tsUnionType(types),
4150
4195
  shouldRecordReactNode
4151
4196
  };
4152
4197
  }
4153
- if (t34.isTSTypeLiteral(tsType)) {
4198
+ if (t35.isTSTypeLiteral(tsType)) {
4154
4199
  const members = [];
4155
4200
  let shouldRecordReactNode = false;
4156
4201
  for (const item of tsType.members) {
@@ -4165,11 +4210,11 @@ function resolveSlotType(tsType, options) {
4165
4210
  };
4166
4211
  }
4167
4212
  return {
4168
- type: t34.tsTypeLiteral(members),
4213
+ type: t35.tsTypeLiteral(members),
4169
4214
  shouldRecordReactNode
4170
4215
  };
4171
4216
  }
4172
- if (t34.isTSFunctionType(tsType)) {
4217
+ if (t35.isTSFunctionType(tsType)) {
4173
4218
  const props = buildSlotPropSignature(
4174
4219
  SLOT_DEFAULT_NAME2,
4175
4220
  cloneCallableParams(tsType.parameters),
@@ -4177,7 +4222,7 @@ function resolveSlotType(tsType, options) {
4177
4222
  // 默认插槽不是可选的
4178
4223
  );
4179
4224
  return {
4180
- type: t34.tsTypeLiteral([props]),
4225
+ type: t35.tsTypeLiteral([props]),
4181
4226
  shouldRecordReactNode: true
4182
4227
  // 函数类型总是需要记录 ReactNode
4183
4228
  };
@@ -4188,7 +4233,7 @@ function resolveSlotType(tsType, options) {
4188
4233
  };
4189
4234
  }
4190
4235
  function resolveSlotPropFromMember(member) {
4191
- if (t34.isTSMethodSignature(member)) {
4236
+ if (t35.isTSMethodSignature(member)) {
4192
4237
  const rawName = resolvePropName2(member.key);
4193
4238
  if (!rawName) {
4194
4239
  return {
@@ -4203,7 +4248,7 @@ function resolveSlotPropFromMember(member) {
4203
4248
  // 方法签名总是可调用,需要记录 ReactNode
4204
4249
  };
4205
4250
  }
4206
- if (t34.isTSPropertySignature(member)) {
4251
+ if (t35.isTSPropertySignature(member)) {
4207
4252
  const rawName = resolvePropName2(member.key);
4208
4253
  if (!rawName) {
4209
4254
  return {
@@ -4226,7 +4271,7 @@ function resolveSlotPropFromMember(member) {
4226
4271
  // 可调用属性需要记录 ReactNode
4227
4272
  };
4228
4273
  }
4229
- if (t34.isTSCallSignatureDeclaration(member)) {
4274
+ if (t35.isTSCallSignatureDeclaration(member)) {
4230
4275
  const params = cloneCallableParams(member.parameters);
4231
4276
  return {
4232
4277
  member: buildSlotPropSignature(SLOT_DEFAULT_NAME2, params, true),
@@ -4266,7 +4311,7 @@ function resolveDefineSlotsIface(path8, ctx) {
4266
4311
  }
4267
4312
 
4268
4313
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-props-interface/resolve-slot/template-slots.ts
4269
- import * as t35 from "@babel/types";
4314
+ import * as t36 from "@babel/types";
4270
4315
  function resolveTemplateSlotIface(ctx) {
4271
4316
  if (ctx.inputType !== "sfc") return;
4272
4317
  const {
@@ -4284,7 +4329,7 @@ function resolveTemplateSlotIface(ctx) {
4284
4329
  }
4285
4330
  if (tsMembers.length) {
4286
4331
  recordReactNode(ctx);
4287
- slotTypes.push(t35.tsTypeLiteral(tsMembers));
4332
+ slotTypes.push(t36.tsTypeLiteral(tsMembers));
4288
4333
  }
4289
4334
  }
4290
4335
 
@@ -4336,9 +4381,9 @@ function resolveCompIProps(ctx, ast) {
4336
4381
  }
4337
4382
  const n = declaredOptions.name || "Comp";
4338
4383
  const ns = `I${camelCase(capitalize(n))}Props`;
4339
- const typeNode = t36.tsIntersectionType(tsTypes);
4340
- const typeAliasDecl = t36.tsTypeAliasDeclaration(t36.identifier(ns), null, typeNode);
4341
- const exportDecl = t36.exportNamedDeclaration(typeAliasDecl);
4384
+ const typeNode = t37.tsIntersectionType(tsTypes);
4385
+ const typeAliasDecl = t37.tsTypeAliasDeclaration(t37.identifier(ns), null, typeNode);
4386
+ const exportDecl = t37.exportNamedDeclaration(typeAliasDecl);
4342
4387
  propsTSIface.name = ns;
4343
4388
  const scriptIR = getScriptIR(ctx);
4344
4389
  scriptIR.exports.push(exportDecl);
@@ -4346,15 +4391,15 @@ function resolveCompIProps(ctx, ast) {
4346
4391
  }
4347
4392
 
4348
4393
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-use-attrs.ts
4349
- import * as t37 from "@babel/types";
4394
+ import * as t38 from "@babel/types";
4350
4395
  function resolveUseAttrs(ctx) {
4351
4396
  return {
4352
4397
  VariableDeclarator(path8) {
4353
4398
  const { init, id } = path8.node;
4354
4399
  if (!init) return;
4355
4400
  const initPath = path8.get("init");
4356
- const propsIdentifier = t37.identifier(ctx.propField);
4357
- if (t37.isTSAsExpression(init) && isUseAttrsCall(init.expression)) {
4401
+ const propsIdentifier = t38.identifier(ctx.propField);
4402
+ if (t38.isTSAsExpression(init) && isUseAttrsCall(init.expression)) {
4358
4403
  const typeAssertion = createPropsTypeAssertion(propsIdentifier, init.typeAnnotation);
4359
4404
  replaceNode(initPath, typeAssertion, init);
4360
4405
  return;
@@ -4365,13 +4410,13 @@ function resolveUseAttrs(ctx) {
4365
4410
  const isTS = ctx.scriptData.lang.startsWith("ts");
4366
4411
  if (isTS) {
4367
4412
  let typeAnnotation = null;
4368
- if (t37.isIdentifier(id) && t37.isTSTypeAnnotation(id.typeAnnotation)) {
4413
+ if (t38.isIdentifier(id) && t38.isTSTypeAnnotation(id.typeAnnotation)) {
4369
4414
  typeAnnotation = id.typeAnnotation.typeAnnotation;
4370
4415
  id.typeAnnotation = null;
4371
4416
  } else {
4372
- typeAnnotation = t37.tsTypeReference(
4373
- t37.identifier("Record"),
4374
- t37.tsTypeParameterInstantiation([t37.tsStringKeyword(), t37.tsUnknownKeyword()])
4417
+ typeAnnotation = t38.tsTypeReference(
4418
+ t38.identifier("Record"),
4419
+ t38.tsTypeParameterInstantiation([t38.tsStringKeyword(), t38.tsUnknownKeyword()])
4375
4420
  );
4376
4421
  }
4377
4422
  const propsTypeAssertion = createPropsTypeAssertion(propsIdentifier, typeAnnotation);
@@ -4383,18 +4428,18 @@ function resolveUseAttrs(ctx) {
4383
4428
  };
4384
4429
  }
4385
4430
  function isUseAttrsCall(expr) {
4386
- return t37.isCallExpression(expr) && isCalleeNamed(expr, VUE_API_MAP.useAttrs);
4431
+ return t38.isCallExpression(expr) && isCalleeNamed(expr, VUE_API_MAP.useAttrs);
4387
4432
  }
4388
4433
  function createPropsTypeAssertion(propsIdentifier, typeAnnotation) {
4389
- return t37.tsAsExpression(propsIdentifier, typeAnnotation);
4434
+ return t38.tsAsExpression(propsIdentifier, typeAnnotation);
4390
4435
  }
4391
4436
 
4392
4437
  // src/core/transform/sfc/script/syntax-processor/process/resolve-analysis-only-adapter.ts
4393
- import * as t43 from "@babel/types";
4438
+ import * as t44 from "@babel/types";
4394
4439
 
4395
4440
  // src/core/transform/sfc/script/shared/dependency-analyzer/index.ts
4396
4441
  import { traverse as traverse2 } from "@babel/core";
4397
- import * as t42 from "@babel/types";
4442
+ import * as t43 from "@babel/types";
4398
4443
 
4399
4444
  // src/core/transform/sfc/script/shared/dependency-analyzer/binding-utils.ts
4400
4445
  function isBindingDeclaredInsideBoundary(binding, boundary) {
@@ -4413,7 +4458,7 @@ function isReactiveBinding(node) {
4413
4458
  }
4414
4459
 
4415
4460
  // src/core/transform/sfc/script/shared/dependency-analyzer/dep-checker.ts
4416
- import * as t38 from "@babel/types";
4461
+ import * as t39 from "@babel/types";
4417
4462
  function isEligibleBindingSource(binding) {
4418
4463
  if (binding.kind === "param") {
4419
4464
  return false;
@@ -4423,57 +4468,57 @@ function isEligibleBindingSource(binding) {
4423
4468
  const declaratorPath = getVariableDeclaratorPath(bindingPath);
4424
4469
  const isReactiveVarBinding = !!declaratorPath && isReactiveBinding(declaratorPath.node);
4425
4470
  const nodeInit = declaratorPath?.node.init;
4426
- const isReactiveApiCallVarBinding = !!declaratorPath && t38.isCallExpression(nodeInit) && t38.isIdentifier(nodeInit.callee) && reactiveStateApis.has(nodeInit.callee.name);
4427
- const isHookCallVarBinding = !!declaratorPath && t38.isCallExpression(nodeInit) && isHookLikeCallee(nodeInit.callee);
4428
- const isFunctionBinding = bindingPath.isFunctionDeclaration() || !!declaratorPath && !!nodeInit && (t38.isArrowFunctionExpression(nodeInit) || t38.isFunctionExpression(nodeInit));
4471
+ const isReactiveApiCallVarBinding = !!declaratorPath && t39.isCallExpression(nodeInit) && t39.isIdentifier(nodeInit.callee) && reactiveStateApis.has(nodeInit.callee.name);
4472
+ const isHookCallVarBinding = !!declaratorPath && t39.isCallExpression(nodeInit) && isHookLikeCallee(nodeInit.callee);
4473
+ const isFunctionBinding = bindingPath.isFunctionDeclaration() || !!declaratorPath && !!nodeInit && (t39.isArrowFunctionExpression(nodeInit) || t39.isFunctionExpression(nodeInit));
4429
4474
  const isReactiveFunctionBinding = isFunctionBinding && (isReactiveBinding(declaratorPath?.node) || isReactiveBinding(bindingPath.node));
4430
4475
  return isReactiveVarBinding || isReactiveApiCallVarBinding || isHookCallVarBinding || isReactiveFunctionBinding;
4431
4476
  }
4432
4477
  function isReactValidDependencyExpr(node) {
4433
- if (t38.isIdentifier(node)) {
4478
+ if (t39.isIdentifier(node)) {
4434
4479
  return true;
4435
4480
  }
4436
- if (t38.isMemberExpression(node) || t38.isOptionalMemberExpression(node)) {
4481
+ if (t39.isMemberExpression(node) || t39.isOptionalMemberExpression(node)) {
4437
4482
  return isStaticMemberChain(node);
4438
4483
  }
4439
4484
  return false;
4440
4485
  }
4441
4486
  function isStaticMemberChain(node) {
4442
4487
  let current = node;
4443
- while (t38.isMemberExpression(current) || t38.isOptionalMemberExpression(current)) {
4444
- if (!current.computed && !t38.isIdentifier(current.property)) {
4488
+ while (t39.isMemberExpression(current) || t39.isOptionalMemberExpression(current)) {
4489
+ if (!current.computed && !t39.isIdentifier(current.property)) {
4445
4490
  return false;
4446
4491
  }
4447
- if (current.computed && !t38.isStringLiteral(current.property) && !t38.isNumericLiteral(current.property)) {
4492
+ if (current.computed && !t39.isStringLiteral(current.property) && !t39.isNumericLiteral(current.property)) {
4448
4493
  return false;
4449
4494
  }
4450
4495
  current = current.object;
4451
4496
  }
4452
- return t38.isIdentifier(current);
4497
+ return t39.isIdentifier(current);
4453
4498
  }
4454
4499
  function isHookLikeCallee(callee) {
4455
- if (t38.isIdentifier(callee)) {
4500
+ if (t39.isIdentifier(callee)) {
4456
4501
  return callee.name.startsWith("use");
4457
4502
  }
4458
- if (t38.isMemberExpression(callee) && !callee.computed && t38.isIdentifier(callee.property)) {
4503
+ if (t39.isMemberExpression(callee) && !callee.computed && t39.isIdentifier(callee.property)) {
4459
4504
  return callee.property.name.startsWith("use");
4460
4505
  }
4461
4506
  return false;
4462
4507
  }
4463
4508
 
4464
4509
  // src/core/transform/sfc/script/shared/dependency-analyzer/dep-key.ts
4465
- import * as t39 from "@babel/types";
4510
+ import * as t40 from "@babel/types";
4466
4511
  function getDependencyKey(exp) {
4467
- if (t39.isIdentifier(exp)) {
4512
+ if (t40.isIdentifier(exp)) {
4468
4513
  return exp.name;
4469
4514
  }
4470
- if (t39.isMemberExpression(exp) || t39.isOptionalMemberExpression(exp)) {
4515
+ if (t40.isMemberExpression(exp) || t40.isOptionalMemberExpression(exp)) {
4471
4516
  const objectKey = getDependencyKey(exp.object);
4472
4517
  const opt = exp.optional ? "?" : "";
4473
- if (!exp.computed && t39.isIdentifier(exp.property)) {
4518
+ if (!exp.computed && t40.isIdentifier(exp.property)) {
4474
4519
  return `${objectKey}${opt}.${exp.property.name}`;
4475
4520
  }
4476
- if (t39.isStringLiteral(exp.property) || t39.isNumericLiteral(exp.property)) {
4521
+ if (t40.isStringLiteral(exp.property) || t40.isNumericLiteral(exp.property)) {
4477
4522
  return `${objectKey}${opt}[${JSON.stringify(exp.property.value)}]`;
4478
4523
  }
4479
4524
  return `${objectKey}${opt}[*]`;
@@ -4482,40 +4527,40 @@ function getDependencyKey(exp) {
4482
4527
  }
4483
4528
 
4484
4529
  // src/core/transform/sfc/script/shared/dependency-analyzer/dep-normalizer.ts
4485
- import * as t40 from "@babel/types";
4530
+ import * as t41 from "@babel/types";
4486
4531
  function normalizeDependencyExpr(path8, rootName, ctx) {
4487
- if (t40.isIdentifier(path8.node)) {
4488
- return t40.identifier(path8.node.name);
4532
+ if (t41.isIdentifier(path8.node)) {
4533
+ return t41.identifier(path8.node.name);
4489
4534
  }
4490
- if (t40.isMemberExpression(path8.node) || t40.isOptionalMemberExpression(path8.node)) {
4535
+ if (t41.isMemberExpression(path8.node) || t41.isOptionalMemberExpression(path8.node)) {
4491
4536
  if (rootName === ctx.propField) {
4492
4537
  const safePropsExp = ensureOptionalForMemberChain(path8.node);
4493
4538
  if (isReactValidDependencyExpr(safePropsExp)) {
4494
- return t40.cloneNode(safePropsExp, true);
4539
+ return t41.cloneNode(safePropsExp, true);
4495
4540
  }
4496
- return t40.identifier(rootName);
4541
+ return t41.identifier(rootName);
4497
4542
  }
4498
4543
  const normalizedExp = normalizeMemberForCallSite(path8, path8.node);
4499
- const safeExp = t40.isMemberExpression(normalizedExp) || t40.isOptionalMemberExpression(normalizedExp) ? ensureOptionalForMemberChain(normalizedExp) : normalizedExp;
4544
+ const safeExp = t41.isMemberExpression(normalizedExp) || t41.isOptionalMemberExpression(normalizedExp) ? ensureOptionalForMemberChain(normalizedExp) : normalizedExp;
4500
4545
  if (isReactValidDependencyExpr(safeExp)) {
4501
- return t40.cloneNode(safeExp, true);
4546
+ return t41.cloneNode(safeExp, true);
4502
4547
  }
4503
- return t40.identifier(rootName);
4548
+ return t41.identifier(rootName);
4504
4549
  }
4505
4550
  return null;
4506
4551
  }
4507
4552
  function normalizeSourcedDependency(exp) {
4508
- if (t40.isIdentifier(exp)) {
4509
- return t40.identifier(exp.name);
4553
+ if (t41.isIdentifier(exp)) {
4554
+ return t41.identifier(exp.name);
4510
4555
  }
4511
- if (t40.isMemberExpression(exp) || t40.isOptionalMemberExpression(exp)) {
4556
+ if (t41.isMemberExpression(exp) || t41.isOptionalMemberExpression(exp)) {
4512
4557
  const root = findRootIdentifier(exp);
4513
4558
  if (!root) return null;
4514
- const safeExp = t40.isMemberExpression(exp) || t40.isOptionalMemberExpression(exp) ? ensureOptionalForMemberChain(exp) : exp;
4559
+ const safeExp = t41.isMemberExpression(exp) || t41.isOptionalMemberExpression(exp) ? ensureOptionalForMemberChain(exp) : exp;
4515
4560
  if (isReactValidDependencyExpr(safeExp)) {
4516
- return t40.cloneNode(safeExp, true);
4561
+ return t41.cloneNode(safeExp, true);
4517
4562
  }
4518
- return t40.identifier(root.name);
4563
+ return t41.identifier(root.name);
4519
4564
  }
4520
4565
  return null;
4521
4566
  }
@@ -4525,7 +4570,7 @@ function normalizeMemberForCallSite(path8, node) {
4525
4570
  if (!isDirectCallee) {
4526
4571
  return node;
4527
4572
  }
4528
- if (!t40.isExpression(node.object)) {
4573
+ if (!t41.isExpression(node.object)) {
4529
4574
  return node;
4530
4575
  }
4531
4576
  return node.object;
@@ -4534,15 +4579,23 @@ function ensureOptionalForMemberChain(node) {
4534
4579
  if (!hasTrailingMemberAccess(node)) {
4535
4580
  return node;
4536
4581
  }
4537
- if (t40.isOptionalMemberExpression(node) && node.optional) {
4538
- return node;
4539
- }
4540
- const object = t40.cloneNode(node.object, true);
4541
- const property = t40.cloneNode(node.property, true);
4542
- return t40.optionalMemberExpression(object, property, node.computed, true);
4582
+ const rebuildWithOptionalChain = (node2) => {
4583
+ const safeObject = ensureOptionalForMemberChain(node2.object);
4584
+ if (safeObject !== node2.object) {
4585
+ const property = t41.cloneNode(node2.property, true);
4586
+ return t41.optionalMemberExpression(safeObject, property, node2.computed, true);
4587
+ }
4588
+ if (t41.isMemberExpression(node2)) {
4589
+ const object = t41.cloneNode(node2.object, true);
4590
+ const property = t41.cloneNode(node2.property, true);
4591
+ return t41.optionalMemberExpression(object, property, node2.computed, true);
4592
+ }
4593
+ return node2;
4594
+ };
4595
+ return rebuildWithOptionalChain(node);
4543
4596
  }
4544
4597
  function hasTrailingMemberAccess(node) {
4545
- return t40.isMemberExpression(node.object) || t40.isOptionalMemberExpression(node.object);
4598
+ return t41.isMemberExpression(node.object) || t41.isOptionalMemberExpression(node.object);
4546
4599
  }
4547
4600
 
4548
4601
  // src/core/transform/sfc/script/shared/dependency-analyzer/shared-utils.ts
@@ -4557,7 +4610,7 @@ function isNestedMemberObject(path8) {
4557
4610
  }
4558
4611
 
4559
4612
  // src/core/transform/sfc/script/shared/dependency-analyzer/trace-utils.ts
4560
- import * as t41 from "@babel/types";
4613
+ import * as t42 from "@babel/types";
4561
4614
  function traceBindingSource(binding, seen, depth) {
4562
4615
  if (depth <= 0) return null;
4563
4616
  const declaratorPath = getVariableDeclaratorPath(binding.path);
@@ -4569,7 +4622,7 @@ function traceBindingSource(binding, seen, depth) {
4569
4622
  }
4570
4623
  function isExpressionSourcedFromEligibleBinding(exp, scope, seen, depth) {
4571
4624
  if (depth <= 0) return null;
4572
- if (t41.isIdentifier(exp)) {
4625
+ if (t42.isIdentifier(exp)) {
4573
4626
  const sourceBinding = scope.getBinding(exp.name);
4574
4627
  if (!sourceBinding) return null;
4575
4628
  if (isEligibleBindingSource(sourceBinding)) {
@@ -4577,13 +4630,13 @@ function isExpressionSourcedFromEligibleBinding(exp, scope, seen, depth) {
4577
4630
  }
4578
4631
  return traceBindingSource(sourceBinding, seen, depth - 1);
4579
4632
  }
4580
- if (t41.isMemberExpression(exp) || t41.isOptionalMemberExpression(exp)) {
4633
+ if (t42.isMemberExpression(exp) || t42.isOptionalMemberExpression(exp)) {
4581
4634
  const root = findRootIdentifier(exp);
4582
4635
  if (!root) return null;
4583
4636
  const sourceBinding = scope.getBinding(root.name);
4584
4637
  if (!sourceBinding) return null;
4585
4638
  if (isEligibleBindingSource(sourceBinding)) {
4586
- return t41.cloneNode(exp);
4639
+ return t42.cloneNode(exp);
4587
4640
  }
4588
4641
  const sourcedRoot = traceBindingSource(sourceBinding, seen, depth - 1);
4589
4642
  if (sourcedRoot) {
@@ -4591,17 +4644,17 @@ function isExpressionSourcedFromEligibleBinding(exp, scope, seen, depth) {
4591
4644
  if (rebuilt) {
4592
4645
  return rebuilt;
4593
4646
  }
4594
- return t41.cloneNode(sourcedRoot, true);
4647
+ return t42.cloneNode(sourcedRoot, true);
4595
4648
  }
4596
4649
  }
4597
4650
  return null;
4598
4651
  }
4599
4652
  function rebuildMemberWithNewRoot(node, nextRoot) {
4600
4653
  const replacedObject = (() => {
4601
- if (t41.isIdentifier(node.object)) {
4602
- return t41.cloneNode(nextRoot, true);
4654
+ if (t42.isIdentifier(node.object)) {
4655
+ return t42.cloneNode(nextRoot, true);
4603
4656
  }
4604
- if (t41.isMemberExpression(node.object) || t41.isOptionalMemberExpression(node.object)) {
4657
+ if (t42.isMemberExpression(node.object) || t42.isOptionalMemberExpression(node.object)) {
4605
4658
  return rebuildMemberWithNewRoot(node.object, nextRoot);
4606
4659
  }
4607
4660
  return null;
@@ -4609,15 +4662,15 @@ function rebuildMemberWithNewRoot(node, nextRoot) {
4609
4662
  if (!replacedObject) {
4610
4663
  return null;
4611
4664
  }
4612
- const property = t41.cloneNode(node.property, true);
4613
- if (t41.isMemberExpression(node)) {
4614
- return t41.memberExpression(
4665
+ const property = t42.cloneNode(node.property, true);
4666
+ if (t42.isMemberExpression(node)) {
4667
+ return t42.memberExpression(
4615
4668
  replacedObject,
4616
4669
  property,
4617
4670
  node.computed
4618
4671
  );
4619
4672
  }
4620
- return t41.optionalMemberExpression(
4673
+ return t42.optionalMemberExpression(
4621
4674
  replacedObject,
4622
4675
  property,
4623
4676
  node.computed,
@@ -4628,9 +4681,9 @@ function rebuildMemberWithNewRoot(node, nextRoot) {
4628
4681
  // src/core/transform/sfc/script/shared/dependency-analyzer/index.ts
4629
4682
  function analyzeDeps(node, ctx, parentPath) {
4630
4683
  if (!parentPath) {
4631
- return t42.arrayExpression([]);
4684
+ return t43.arrayExpression([]);
4632
4685
  }
4633
- const isFnExpr = t42.isArrowFunctionExpression(node) || t42.isFunctionExpression(node);
4686
+ const isFnExpr = t43.isArrowFunctionExpression(node) || t43.isFunctionExpression(node);
4634
4687
  const analyzeTarget = isFnExpr ? node.body : node;
4635
4688
  const bindingLocalBoundary = isFnExpr ? node : analyzeTarget;
4636
4689
  const deps = /* @__PURE__ */ new Map();
@@ -4640,13 +4693,13 @@ function analyzeDeps(node, ctx, parentPath) {
4640
4693
  }
4641
4694
  const analyzeTargetPath = parentPath && parentPath.node === analyzeTarget ? parentPath : null;
4642
4695
  if (analyzeTargetPath) {
4643
- if (t42.isMemberExpression(analyzeTarget) || t42.isOptionalMemberExpression(analyzeTarget)) {
4696
+ if (t43.isMemberExpression(analyzeTarget) || t43.isOptionalMemberExpression(analyzeTarget)) {
4644
4697
  const rootId = findRootIdentifier(analyzeTarget);
4645
4698
  if (rootId) {
4646
4699
  tryAddDependency(analyzeTargetPath, rootId.name, analyzeTargetPath.scope);
4647
4700
  processedIdentifiers.add(rootId);
4648
4701
  }
4649
- } else if (t42.isIdentifier(analyzeTarget)) {
4702
+ } else if (t43.isIdentifier(analyzeTarget)) {
4650
4703
  tryAddDependency(analyzeTargetPath, analyzeTarget.name, analyzeTargetPath.scope);
4651
4704
  }
4652
4705
  }
@@ -4698,7 +4751,7 @@ function analyzeDeps(node, ctx, parentPath) {
4698
4751
  }
4699
4752
  }
4700
4753
  }
4701
- return t42.arrayExpression(Array.from(deps.values()));
4754
+ return t43.arrayExpression(Array.from(deps.values()));
4702
4755
  }
4703
4756
 
4704
4757
  // src/core/transform/sfc/script/syntax-processor/process/resolve-analysis-only-adapter.ts
@@ -4714,7 +4767,7 @@ function resolveAnalysisOnlyAdapter(ctx) {
4714
4767
  if (!isVueApiReference(path8, apiName)) {
4715
4768
  return;
4716
4769
  }
4717
- if (t43.isCallExpression(node)) {
4770
+ if (t44.isCallExpression(node)) {
4718
4771
  resolveCallNode(path8, adapter, ctx);
4719
4772
  } else {
4720
4773
  replaceIdName(node, adapter.target);
@@ -4724,11 +4777,11 @@ function resolveAnalysisOnlyAdapter(ctx) {
4724
4777
  };
4725
4778
  }
4726
4779
  function getApiName(node) {
4727
- const isCallNode = t43.isCallExpression(node);
4780
+ const isCallNode = t44.isCallExpression(node);
4728
4781
  let apiName = "";
4729
- if (t43.isIdentifier(node)) {
4782
+ if (t44.isIdentifier(node)) {
4730
4783
  apiName = node.name;
4731
- } else if (isCallNode && t43.isIdentifier(node.callee)) {
4784
+ } else if (isCallNode && t44.isIdentifier(node.callee)) {
4732
4785
  apiName = node.callee.name;
4733
4786
  }
4734
4787
  return apiName;
@@ -4738,7 +4791,7 @@ function resolveCallNode(path8, adapter, ctx) {
4738
4791
  const { arguments: args } = node;
4739
4792
  if (!args.length) return;
4740
4793
  const fn = args[0];
4741
- if (!t43.isArrowFunctionExpression(fn) && !t43.isFunctionExpression(fn)) {
4794
+ if (!t44.isArrowFunctionExpression(fn) && !t44.isFunctionExpression(fn)) {
4742
4795
  return;
4743
4796
  }
4744
4797
  const fnPath = path8.get("arguments")[0];
@@ -4770,7 +4823,7 @@ function isVueImportBinding(binding) {
4770
4823
  return false;
4771
4824
  }
4772
4825
  const parent = bindingPath.parentPath?.node;
4773
- if (!parent || !t43.isImportDeclaration(parent)) {
4826
+ if (!parent || !t44.isImportDeclaration(parent)) {
4774
4827
  return false;
4775
4828
  }
4776
4829
  const source = parent.source.value.toLowerCase();
@@ -4838,7 +4891,7 @@ function isSkip(path8) {
4838
4891
  }
4839
4892
 
4840
4893
  // src/core/transform/sfc/script/syntax-processor/process/resolve-element-ref.ts
4841
- import * as t44 from "@babel/types";
4894
+ import * as t45 from "@babel/types";
4842
4895
  function resolveElementRef(ctx) {
4843
4896
  return {
4844
4897
  CallExpression(path8) {
@@ -4856,14 +4909,14 @@ function resolveElementRef(ctx) {
4856
4909
  }
4857
4910
  if (isCompRefBindings) {
4858
4911
  const varDeclaratorPath = getVariableDeclaratorPath(path8)?.node;
4859
- if (!t44.isIdentifier(varDeclaratorPath?.id)) {
4912
+ if (!t45.isIdentifier(varDeclaratorPath?.id)) {
4860
4913
  return;
4861
4914
  }
4862
4915
  const varName = varDeclaratorPath.id.name;
4863
4916
  const compRef = refBindings.componentRefs[varName];
4864
4917
  if (!compRef) return;
4865
4918
  }
4866
- node.arguments[0] = t44.identifier("null");
4919
+ node.arguments[0] = t45.identifier("null");
4867
4920
  resolveTypeParameters(ctx, path8);
4868
4921
  replaceCallName(node, REACT_API_MAP.useRef);
4869
4922
  recordImport(ctx, PACKAGE_NAME.react, REACT_API_MAP.useRef);
@@ -4888,27 +4941,27 @@ function resolveTypeParameters(ctx, path8) {
4888
4941
  const compBindingMeta = refBindings.componentRefs[idName];
4889
4942
  if (!node.typeParameters && (domBindingMeta || compBindingMeta)) {
4890
4943
  const type = compBindingMeta ? "any" : domBindingMeta.htmlType;
4891
- node.typeParameters = t44.tsTypeParameterInstantiation([t44.tsTypeReference(t44.identifier(type))]);
4944
+ node.typeParameters = t45.tsTypeParameterInstantiation([t45.tsTypeReference(t45.identifier(type))]);
4892
4945
  }
4893
4946
  }
4894
4947
  function resolveRefValueToCurrent(path8) {
4895
4948
  const { node } = path8;
4896
- if (node.computed || !t44.isIdentifier(node.property) || node.property.name !== "value") {
4949
+ if (node.computed || !t45.isIdentifier(node.property) || node.property.name !== "value") {
4897
4950
  return;
4898
4951
  }
4899
4952
  const rootPath = findRootVariablePath(path8);
4900
- if (!rootPath?.node || !t44.isCallExpression(rootPath.node.init) || !isCalleeNamed(rootPath.node.init, REACT_API_MAP.useRef)) {
4953
+ if (!rootPath?.node || !t45.isCallExpression(rootPath.node.init) || !isCalleeNamed(rootPath.node.init, REACT_API_MAP.useRef)) {
4901
4954
  return;
4902
4955
  }
4903
4956
  const rootId = findRootIdentifier(node);
4904
- if (!t44.isIdentifier(node.object) || node.object.name !== rootId?.name) {
4957
+ if (!t45.isIdentifier(node.object) || node.object.name !== rootId?.name) {
4905
4958
  return;
4906
4959
  }
4907
4960
  node.property.name = "current";
4908
4961
  }
4909
4962
 
4910
4963
  // src/core/transform/sfc/script/syntax-processor/process/resolve-expression-memo.ts
4911
- import * as t45 from "@babel/types";
4964
+ import * as t46 from "@babel/types";
4912
4965
  function resolveExprMemo(ctx, ast) {
4913
4966
  const isScriptFile = ctx.inputType !== "sfc";
4914
4967
  return {
@@ -4920,11 +4973,11 @@ function resolveExprMemo(ctx, ast) {
4920
4973
  if (!atComponentOrHookRoot(path8, ast.program, isScriptFile)) {
4921
4974
  return false;
4922
4975
  }
4923
- if (!t45.isVariableDeclaration(path8.parent) || path8.parent.kind !== "const") {
4976
+ if (!t46.isVariableDeclaration(path8.parent) || path8.parent.kind !== "const") {
4924
4977
  return false;
4925
4978
  }
4926
- if (t45.isFunction(init)) return false;
4927
- if (t45.isCallExpression(init) && t45.isIdentifier(init.callee) && init.callee.name.startsWith("use")) {
4979
+ if (t46.isFunction(init)) return false;
4980
+ if (t46.isCallExpression(init) && t46.isIdentifier(init.callee) && init.callee.name.startsWith("use")) {
4928
4981
  return false;
4929
4982
  }
4930
4983
  return true;
@@ -4943,16 +4996,16 @@ function resolveExprMemo(ctx, ast) {
4943
4996
  }
4944
4997
 
4945
4998
  // src/core/transform/sfc/script/syntax-processor/process/resolve-lint-rules.ts
4946
- import * as t46 from "@babel/types";
4999
+ import * as t47 from "@babel/types";
4947
5000
  function resolveLintRules(ctx, ast) {
4948
5001
  const inScriptFile = ctx.inputType !== "sfc";
4949
5002
  return {
4950
5003
  CallExpression(path8) {
4951
5004
  const { node, parentPath } = path8;
4952
- if (!t46.isIdentifier(node.callee)) return;
5005
+ if (!t47.isIdentifier(node.callee)) return;
4953
5006
  const { name: callName } = node.callee;
4954
- const addLog = (t52) => {
4955
- logger.error(t52, {
5007
+ const addLog = (t53) => {
5008
+ logger.error(t53, {
4956
5009
  file: ctx.filename,
4957
5010
  source: ctx.scriptData.source,
4958
5011
  loc: node.loc
@@ -4997,7 +5050,7 @@ function resolveLintRules(ctx, ast) {
4997
5050
 
4998
5051
  // src/core/transform/sfc/script/syntax-processor/process/resolve-provide.ts
4999
5052
  import { generate as generate2 } from "@babel/generator";
5000
- import * as t47 from "@babel/types";
5053
+ import * as t48 from "@babel/types";
5001
5054
  function resolveProvide(ctx) {
5002
5055
  if (ctx.inputType === "style") return {};
5003
5056
  return {
@@ -5029,13 +5082,13 @@ function findOrCreateCtxProvider(root) {
5029
5082
  function assignProviderValue(target, key, value) {
5030
5083
  const getRawExp = (exp) => {
5031
5084
  if (!exp) return "''";
5032
- if (t47.isStringLiteral(exp)) {
5085
+ if (t48.isStringLiteral(exp)) {
5033
5086
  return JSON.stringify(exp.value);
5034
5087
  }
5035
- if (t47.isNumericLiteral(exp)) {
5088
+ if (t48.isNumericLiteral(exp)) {
5036
5089
  return exp.value.toString();
5037
5090
  }
5038
- if (t47.isIdentifier(exp)) {
5091
+ if (t48.isIdentifier(exp)) {
5039
5092
  return exp.name;
5040
5093
  }
5041
5094
  try {
@@ -5051,16 +5104,16 @@ function assignProviderValue(target, key, value) {
5051
5104
  }
5052
5105
 
5053
5106
  // src/core/transform/sfc/script/syntax-processor/process/resolve-rename-adapter.ts
5054
- import * as t48 from "@babel/types";
5107
+ import * as t49 from "@babel/types";
5055
5108
  function resolveRenameAdapter(ctx) {
5056
5109
  return {
5057
5110
  "CallExpression|Identifier"(path8) {
5058
5111
  const node = path8.node;
5059
- const isCallNode = t48.isCallExpression(node);
5112
+ const isCallNode = t49.isCallExpression(node);
5060
5113
  let apiName = "";
5061
- if (t48.isIdentifier(node)) {
5114
+ if (t49.isIdentifier(node)) {
5062
5115
  apiName = node.name;
5063
- } else if (isCallNode && t48.isIdentifier(node.callee)) {
5116
+ } else if (isCallNode && t49.isIdentifier(node.callee)) {
5064
5117
  apiName = node.callee.name;
5065
5118
  }
5066
5119
  if (!apiName) {
@@ -5122,7 +5175,7 @@ function isVueImportBinding2(binding) {
5122
5175
  return false;
5123
5176
  }
5124
5177
  const parent = bindingPath.parentPath?.node;
5125
- if (!parent || !t48.isImportDeclaration(parent)) {
5178
+ if (!parent || !t49.isImportDeclaration(parent)) {
5126
5179
  return false;
5127
5180
  }
5128
5181
  const source = parent.source.value.toLowerCase();
@@ -5166,7 +5219,12 @@ function processVueSyntax2(ast, ctx) {
5166
5219
  excludeBabel: [resolveTemplateSlotIface, resolveCompIProps]
5167
5220
  },
5168
5221
  postprocess: {
5169
- applyBabel: [resolveRuntimeImports, resolveASTChunks],
5222
+ applyBabel: [
5223
+ // 该 resolver 需确保放在所有类型处理之后,移除之前
5224
+ resolveVueTypeAsAny,
5225
+ resolveRuntimeImports,
5226
+ resolveASTChunks
5227
+ ],
5170
5228
  excludeBabel: [resolveSfcCssImport]
5171
5229
  }
5172
5230
  });
@@ -5259,13 +5317,13 @@ function isRouterLinkBooleanCustomProp(prop) {
5259
5317
  }
5260
5318
 
5261
5319
  // src/core/transform/sfc/template/shared/prop-ir-utils.ts
5262
- import * as t50 from "@babel/types";
5320
+ import * as t51 from "@babel/types";
5263
5321
 
5264
5322
  // src/shared/string-code-types.ts
5265
5323
  import { parseExpression as parseExpression3 } from "@babel/parser";
5266
- import * as t49 from "@babel/types";
5324
+ import * as t50 from "@babel/types";
5267
5325
  var strCodeTypes = {
5268
- isIdentifier: isIdentifier28,
5326
+ isIdentifier: isIdentifier29,
5269
5327
  isSimpleExpression,
5270
5328
  isStringLiteral: isStringLiteral13
5271
5329
  };
@@ -5276,30 +5334,30 @@ function isSimpleExpression(code, excludeVar = false) {
5276
5334
  } catch {
5277
5335
  return false;
5278
5336
  }
5279
- if (t49.isLiteral(node)) {
5337
+ if (t50.isLiteral(node)) {
5280
5338
  return true;
5281
5339
  }
5282
- if (!excludeVar && t49.isIdentifier(node)) {
5340
+ if (!excludeVar && t50.isIdentifier(node)) {
5283
5341
  return true;
5284
5342
  }
5285
- if (t49.isMemberExpression(node)) {
5286
- return isSimpleExpression(node.object) && t49.isIdentifier(node.property);
5343
+ if (t50.isMemberExpression(node)) {
5344
+ return isSimpleExpression(node.object) && t50.isIdentifier(node.property);
5287
5345
  }
5288
- if (t49.isObjectExpression(node) || t49.isArrayExpression(node)) {
5346
+ if (t50.isObjectExpression(node) || t50.isArrayExpression(node)) {
5289
5347
  return false;
5290
5348
  }
5291
- if (t49.isCallExpression(node) || t49.isAssignmentExpression(node)) {
5349
+ if (t50.isCallExpression(node) || t50.isAssignmentExpression(node)) {
5292
5350
  return false;
5293
5351
  }
5294
- if (t49.isBinaryExpression(node) || t49.isUnaryExpression(node)) {
5352
+ if (t50.isBinaryExpression(node) || t50.isUnaryExpression(node)) {
5295
5353
  return true;
5296
5354
  }
5297
5355
  return false;
5298
5356
  }
5299
- function isIdentifier28(code) {
5357
+ function isIdentifier29(code) {
5300
5358
  try {
5301
5359
  const node = parseExpression3(code);
5302
- return t49.isIdentifier(node);
5360
+ return t50.isIdentifier(node);
5303
5361
  } catch {
5304
5362
  return false;
5305
5363
  }
@@ -5307,7 +5365,7 @@ function isIdentifier28(code) {
5307
5365
  function isStringLiteral13(code) {
5308
5366
  try {
5309
5367
  const node = parseExpression3(code);
5310
- return t49.isStringLiteral(node);
5368
+ return t50.isStringLiteral(node);
5311
5369
  } catch {
5312
5370
  return false;
5313
5371
  }
@@ -5447,9 +5505,10 @@ function resolvePropAsBabelExp(ir, ctx) {
5447
5505
  const value = ir.value;
5448
5506
  const valueContent = value.content;
5449
5507
  const mergedItems = value.merge;
5508
+ const rule = ADAPTER_RULES.runtime;
5450
5509
  const setNameIdentifier = (target, valueName) => {
5451
5510
  target.content = valueName;
5452
- target.ast = t50.jsxIdentifier(valueName);
5511
+ target.ast = t51.jsxIdentifier(valueName);
5453
5512
  };
5454
5513
  const setValueExpression = (target, content, isStringLiteral14) => {
5455
5514
  target.content = content;
@@ -5457,38 +5516,41 @@ function resolvePropAsBabelExp(ir, ctx) {
5457
5516
  };
5458
5517
  const createRuntimeCall = (fnName, args) => {
5459
5518
  const fnArgs = args.filter(Boolean).join(",");
5460
- return `${fnName}(${fnArgs})`;
5519
+ const valIsUndef = fnName === rule.dirOn.target && args?.[1] === "undefined";
5520
+ const isTs = ctx.scriptData.lang.startsWith("ts");
5521
+ const safeTypeAssertion = isTs ? valIsUndef ? "as never" : "" : "";
5522
+ return `${fnName}(${fnArgs}) ${safeTypeAssertion}`;
5461
5523
  };
5462
5524
  const applyRuntimeExpression = (expression, setName = false, nameIdentifier, isStringLiteral14) => {
5463
5525
  if (setName && nameIdentifier) {
5464
5526
  setNameIdentifier(nameExp, nameIdentifier);
5465
5527
  }
5466
- const dir = ADAPTER_RULES.runtime.dir;
5528
+ const dir = rule.dir;
5467
5529
  recordImport(ctx, dir.package, dir.target);
5468
5530
  setValueExpression(value.babelExp, expression, isStringLiteral14);
5469
5531
  };
5470
5532
  if (ir.isKeyLessVBind) {
5471
- const dirKeyless = ADAPTER_RULES.runtime.dirKeyless;
5533
+ const dirKeyless = rule.dirKeyless;
5472
5534
  const expression = createRuntimeCall(dirKeyless.target, [valueContent]);
5473
5535
  applyRuntimeExpression(expression, false);
5474
5536
  return;
5475
5537
  }
5476
5538
  if (isClassAttr(name) && !value.isStringLiteral && !valueContent.startsWith(STYLE_MODULE_NAME)) {
5477
- const dirCls = ADAPTER_RULES.runtime.dirCls;
5539
+ const dirCls = rule.dirCls;
5478
5540
  const arg = mergedItems?.join(",") || wrapSingleQuotes(valueContent);
5479
5541
  const expression = createRuntimeCall(dirCls.target, [arg]);
5480
5542
  applyRuntimeExpression(expression, true, name);
5481
5543
  return;
5482
5544
  }
5483
5545
  if (isStyleAttr(name) && (!isSimpleStyle(valueContent) || mergedItems?.some((item) => !isSimpleStyle(item)))) {
5484
- const dirStyle = ADAPTER_RULES.runtime.dirStyle;
5546
+ const dirStyle = rule.dirStyle;
5485
5547
  const arg = mergedItems?.join(",") || valueContent;
5486
5548
  const expression = createRuntimeCall(dirStyle.target, [arg]);
5487
5549
  applyRuntimeExpression(expression, true, name);
5488
5550
  return;
5489
5551
  }
5490
5552
  if (ir.type === 3 /* EVENT */ && ir.modifiers?.length) {
5491
- const dirOn = ADAPTER_RULES.runtime.dirOn;
5553
+ const dirOn = rule.dirOn;
5492
5554
  const eventName = wrapSingleQuotes(ir.__vOnEvName || name, ir.isStatic);
5493
5555
  const expression = createRuntimeCall(dirOn.target, [eventName, valueContent]);
5494
5556
  applyRuntimeExpression(expression, true, name);
@@ -6196,14 +6258,15 @@ function applyValueModifiers(valueExp, modifiers) {
6196
6258
  }
6197
6259
 
6198
6260
  // src/core/transform/sfc/template/syntax-processor/process/props/resolve-v-on.ts
6199
- import * as t51 from "@babel/types";
6261
+ import * as t52 from "@babel/types";
6200
6262
  function resolveVOn(directive, ir, ctx, nodeIR) {
6201
6263
  const arg = directive.arg;
6202
6264
  const exp = directive.exp;
6203
6265
  const modifiers = directive.modifiers.map((item) => item.content);
6204
6266
  const captureIndex = resolveCaptureModifier(modifiers);
6205
6267
  const eventName = resolveEventName(arg.content, captureIndex);
6206
- const handler = resolveHandler(exp.content.trim(), ctx, modifiers);
6268
+ const handlerContent = exp?.content?.trim() || "undefined";
6269
+ const handler = resolveHandler(handlerContent, ctx, modifiers);
6207
6270
  const originalVueEventName = modifiers.length ? `${arg.content}.${modifiers.join(".")}` : "";
6208
6271
  const eventIR = createPropsIR(directive.rawName, eventName, handler);
6209
6272
  eventIR.type = 3 /* EVENT */;
@@ -6253,10 +6316,10 @@ function resolveHandler(handlerContent, ctx, modifiers) {
6253
6316
  return handler;
6254
6317
  }
6255
6318
  function isConsoleCall(expr) {
6256
- return t51.isCallExpression(expr) && t51.isMemberExpression(expr.callee) && t51.isIdentifier(expr.callee.object) && expr.callee.object.name === "console";
6319
+ return t52.isCallExpression(expr) && t52.isMemberExpression(expr.callee) && t52.isIdentifier(expr.callee.object) && expr.callee.object.name === "console";
6257
6320
  }
6258
6321
  function isFnReference(expr) {
6259
- return t51.isIdentifier(expr) || t51.isMemberExpression(expr) || t51.isFunction(expr);
6322
+ return t52.isIdentifier(expr) || t52.isMemberExpression(expr) || t52.isFunction(expr);
6260
6323
  }
6261
6324
 
6262
6325
  // src/core/transform/sfc/template/syntax-processor/process/props/resolve-v-show.ts
@@ -6488,11 +6551,8 @@ function resolveSlotOutletNode(node, nodeIR, ctx, parentIR, childrenIR) {
6488
6551
  function resolveSlotProps(node, ctx) {
6489
6552
  const result = {
6490
6553
  name: "children",
6491
- // 默认插槽名为'children'
6492
6554
  isScope: false,
6493
- // 默认非作用域插槽
6494
6555
  props: []
6495
- // 作用域参数列表
6496
6556
  };
6497
6557
  const { source, filename } = ctx;
6498
6558
  const addSlotProp = (key, value) => {
@@ -6516,9 +6576,12 @@ function resolveSlotProps(node, ctx) {
6516
6576
  continue;
6517
6577
  }
6518
6578
  if (prop.type === NodeTypes9.DIRECTIVE) {
6579
+ warnUnsupportedVueDollarVar(ctx, prop);
6580
+ if (!prop.arg) {
6581
+ continue;
6582
+ }
6519
6583
  const arg = prop.arg;
6520
6584
  const exp = prop.exp;
6521
- warnUnsupportedVueDollarVar(ctx, prop);
6522
6585
  if (!arg.isStatic) {
6523
6586
  logger.warn("Avoid using dynamic slot names, as they may lead to unexpected behavior.", {
6524
6587
  source,
@@ -6527,7 +6590,7 @@ function resolveSlotProps(node, ctx) {
6527
6590
  });
6528
6591
  }
6529
6592
  const key = arg.content;
6530
- const value = exp.content.trim();
6593
+ const value = exp?.content?.trim() || "undefined";
6531
6594
  if (key === "name") {
6532
6595
  result.name = camelCase(value);
6533
6596
  } else {
@@ -6609,7 +6672,7 @@ function transform(ast, ctx, options) {
6609
6672
  }
6610
6673
 
6611
6674
  // package.json
6612
- var version = "1.8.3";
6675
+ var version = "1.8.4";
6613
6676
  var bin = {
6614
6677
  vureact: "bin/vureact.js"
6615
6678
  };