@vureact/compiler-core 1.8.1 → 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
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } function _optionalChainDelete(ops) { const result = _optionalChain(ops); return result == null ? true : result; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7; var _class8; var _class9; var _class10; var _class11; var _class12; var _class13;/**
2
- * @vureact/compiler-core v1.8.1
2
+ * @vureact/compiler-core v1.8.4
3
3
  * (c) 2025-present Ruihong Zhong (Ryan John)
4
4
  * @license MIT
5
5
  */
@@ -24,7 +24,7 @@ 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 t11 = _interopRequireWildcard(_types); var t = _interopRequireWildcard(_types); var t10 = _interopRequireWildcard(_types); var t2 = _interopRequireWildcard(_types); var t4 = _interopRequireWildcard(_types); var t3 = _interopRequireWildcard(_types); var t6 = _interopRequireWildcard(_types); var t5 = _interopRequireWildcard(_types); var t7 = _interopRequireWildcard(_types); var t9 = _interopRequireWildcard(_types); var t8 = _interopRequireWildcard(_types); var t14 = _interopRequireWildcard(_types); var t12 = _interopRequireWildcard(_types); var t13 = _interopRequireWildcard(_types); var t16 = _interopRequireWildcard(_types); var t15 = _interopRequireWildcard(_types); var t18 = _interopRequireWildcard(_types); var t17 = _interopRequireWildcard(_types); var t19 = _interopRequireWildcard(_types); var t20 = _interopRequireWildcard(_types); var t21 = _interopRequireWildcard(_types); var t22 = _interopRequireWildcard(_types); var t23 = _interopRequireWildcard(_types); var t24 = _interopRequireWildcard(_types); var t25 = _interopRequireWildcard(_types); var t27 = _interopRequireWildcard(_types); var t26 = _interopRequireWildcard(_types); var t28 = _interopRequireWildcard(_types); var t36 = _interopRequireWildcard(_types); var t30 = _interopRequireWildcard(_types); var t29 = _interopRequireWildcard(_types); var t31 = _interopRequireWildcard(_types); var t34 = _interopRequireWildcard(_types); var t32 = _interopRequireWildcard(_types); var t33 = _interopRequireWildcard(_types); var t35 = _interopRequireWildcard(_types); var t37 = _interopRequireWildcard(_types); var t43 = _interopRequireWildcard(_types); var t42 = _interopRequireWildcard(_types); var t38 = _interopRequireWildcard(_types); var t39 = _interopRequireWildcard(_types); var t40 = _interopRequireWildcard(_types); var t41 = _interopRequireWildcard(_types); var t44 = _interopRequireWildcard(_types); var t45 = _interopRequireWildcard(_types); var t46 = _interopRequireWildcard(_types); var t47 = _interopRequireWildcard(_types); var t48 = _interopRequireWildcard(_types); var t50 = _interopRequireWildcard(_types); var t49 = _interopRequireWildcard(_types); var t51 = _interopRequireWildcard(_types);
27
+ var _types = require('@babel/types'); var t11 = _interopRequireWildcard(_types); var t = _interopRequireWildcard(_types); var t10 = _interopRequireWildcard(_types); var t2 = _interopRequireWildcard(_types); var t4 = _interopRequireWildcard(_types); var t3 = _interopRequireWildcard(_types); var t6 = _interopRequireWildcard(_types); var t5 = _interopRequireWildcard(_types); var t7 = _interopRequireWildcard(_types); var t9 = _interopRequireWildcard(_types); var t8 = _interopRequireWildcard(_types); var t14 = _interopRequireWildcard(_types); var t12 = _interopRequireWildcard(_types); var t13 = _interopRequireWildcard(_types); var t16 = _interopRequireWildcard(_types); var t15 = _interopRequireWildcard(_types); var t18 = _interopRequireWildcard(_types); var t17 = _interopRequireWildcard(_types); var t19 = _interopRequireWildcard(_types); var t20 = _interopRequireWildcard(_types); var t21 = _interopRequireWildcard(_types); var t22 = _interopRequireWildcard(_types); var t23 = _interopRequireWildcard(_types); var t24 = _interopRequireWildcard(_types); var t25 = _interopRequireWildcard(_types); var t26 = _interopRequireWildcard(_types); var t28 = _interopRequireWildcard(_types); var t27 = _interopRequireWildcard(_types); var t29 = _interopRequireWildcard(_types); var t37 = _interopRequireWildcard(_types); var t31 = _interopRequireWildcard(_types); var t30 = _interopRequireWildcard(_types); var t32 = _interopRequireWildcard(_types); var t35 = _interopRequireWildcard(_types); var t33 = _interopRequireWildcard(_types); var t34 = _interopRequireWildcard(_types); var t36 = _interopRequireWildcard(_types); var t38 = _interopRequireWildcard(_types); var t44 = _interopRequireWildcard(_types); var t43 = _interopRequireWildcard(_types); var t39 = _interopRequireWildcard(_types); var t40 = _interopRequireWildcard(_types); var t41 = _interopRequireWildcard(_types); var t42 = _interopRequireWildcard(_types); var t45 = _interopRequireWildcard(_types); var t46 = _interopRequireWildcard(_types); var t47 = _interopRequireWildcard(_types); var t48 = _interopRequireWildcard(_types); var t49 = _interopRequireWildcard(_types); var t51 = _interopRequireWildcard(_types); var t50 = _interopRequireWildcard(_types); var t52 = _interopRequireWildcard(_types);
28
28
 
29
29
  // src/consts/other.ts
30
30
  var PACKAGE_NAME = {
@@ -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);
@@ -1314,9 +1316,6 @@ function resolveComponentName(ctx) {
1314
1316
  if (!name) {
1315
1317
  const defaultName = _path.basename.call(void 0, filename).split(".")[0] || `FC${genHashByXXH(filename)}`;
1316
1318
  name = capitalize(camelCase(defaultName));
1317
- logger.warn(`Unnamed component detected. Using file name: <${name}>`, {
1318
- file: filename
1319
- });
1320
1319
  }
1321
1320
  scriptData.declaredOptions.name = name;
1322
1321
  return t13.identifier(name);
@@ -3223,6 +3222,49 @@ function resolveSfcCssImport(ctx) {
3223
3222
  scriptIR.imports.push(importDecl);
3224
3223
  }
3225
3224
 
3225
+ // src/core/transform/sfc/script/syntax-processor/postprocess/resolve-vue-type-as-any.ts
3226
+
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
+
3226
3268
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-define-async-component.ts
3227
3269
 
3228
3270
  function resolveDefineAsyncComponent(ctx) {
@@ -3233,11 +3275,11 @@ function resolveDefineAsyncComponent(ctx) {
3233
3275
  return;
3234
3276
  }
3235
3277
  const [arg] = node.arguments;
3236
- if (!t25.isObjectExpression(arg)) {
3278
+ if (!t26.isObjectExpression(arg)) {
3237
3279
  return;
3238
3280
  }
3239
3281
  for (const prop of arg.properties) {
3240
- 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") {
3241
3283
  continue;
3242
3284
  }
3243
3285
  logger.warn('Unsupported option "hydrate"', {
@@ -3257,19 +3299,19 @@ function resolveDefineAsyncComponent(ctx) {
3257
3299
  // src/core/transform/sfc/script/shared/hook-creator.ts
3258
3300
 
3259
3301
  function createUseCallback(body, deps) {
3260
- return t26.callExpression(t26.identifier(REACT_API_MAP.useCallback), [
3302
+ return t27.callExpression(t27.identifier(REACT_API_MAP.useCallback), [
3261
3303
  body,
3262
- _nullishCoalesce(deps, () => ( t26.arrayExpression([])))
3304
+ _nullishCoalesce(deps, () => ( t27.arrayExpression([])))
3263
3305
  ]);
3264
3306
  }
3265
3307
  function createUseMemo(body, deps) {
3266
- return t26.callExpression(t26.identifier(REACT_API_MAP.useMemo), [
3267
- t26.arrowFunctionExpression([], body),
3268
- _nullishCoalesce(deps, () => ( t26.arrayExpression([])))
3308
+ return t27.callExpression(t27.identifier(REACT_API_MAP.useMemo), [
3309
+ t27.arrowFunctionExpression([], body),
3310
+ _nullishCoalesce(deps, () => ( t27.arrayExpression([])))
3269
3311
  ]);
3270
3312
  }
3271
3313
  function createUseImperativeHandle(refId, init) {
3272
- return t26.callExpression(t26.identifier(REACT_API_MAP.useImperativeHandle), [refId, init]);
3314
+ return t27.callExpression(t27.identifier(REACT_API_MAP.useImperativeHandle), [refId, init]);
3273
3315
  }
3274
3316
 
3275
3317
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-define-expose.ts
@@ -3290,16 +3332,16 @@ function resolveDefineExpose(ctx) {
3290
3332
  const adapter = ADAPTER_RULES.react[MACRO_API_NAMES.expose];
3291
3333
  recordImport(ctx, adapter.package, REACT_API_MAP.forwardRef);
3292
3334
  recordImport(ctx, adapter.package, adapter.target);
3293
- if (!t27.isObjectExpression(expose) && !t27.isFunction(expose)) {
3335
+ if (!t28.isObjectExpression(expose) && !t28.isFunction(expose)) {
3294
3336
  logger.warn("Non-deterministic object literal may cause unknown risks.", {
3295
3337
  file: filename,
3296
3338
  loc: expose.loc,
3297
3339
  source: scriptData.source
3298
3340
  });
3299
3341
  }
3300
- const init = !t27.isFunction(expose) ? t27.arrowFunctionExpression([], expose) : expose;
3342
+ const init = !t28.isFunction(expose) ? t28.arrowFunctionExpression([], expose) : expose;
3301
3343
  const { forwardRef } = scriptData;
3302
- const newNode = createUseImperativeHandle(t27.identifier(forwardRef.refField), init);
3344
+ const newNode = createUseImperativeHandle(t28.identifier(forwardRef.refField), init);
3303
3345
  forwardRef.enabled = true;
3304
3346
  replaceNode(path8, newNode, node);
3305
3347
  }
@@ -3334,7 +3376,7 @@ function resolveEmitCalls(ctx) {
3334
3376
  CallExpression(path8) {
3335
3377
  const { node } = path8;
3336
3378
  const { filename, templateData, scriptData } = ctx;
3337
- if (!t28.isIdentifier(node.callee)) return;
3379
+ if (!t29.isIdentifier(node.callee)) return;
3338
3380
  const { name } = node.callee;
3339
3381
  const checkIfFromDefineEmits = () => {
3340
3382
  let result = false;
@@ -3346,7 +3388,7 @@ function resolveEmitCalls(ctx) {
3346
3388
  const binding = path8.scope.getBinding(name);
3347
3389
  if (binding) {
3348
3390
  const parent = binding.path.node;
3349
- 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)) {
3350
3392
  result = parent.init.callee.name === MACRO_API_NAMES.emits;
3351
3393
  }
3352
3394
  }
@@ -3356,9 +3398,9 @@ function resolveEmitCalls(ctx) {
3356
3398
  if (!checkIfFromDefineEmits()) return;
3357
3399
  const [callee, ...args] = node.arguments;
3358
3400
  let propCall;
3359
- if (t28.isStringLiteral(callee)) {
3401
+ if (t29.isStringLiteral(callee)) {
3360
3402
  const eventName = formatEmitEventName(callee.value);
3361
- propCall = createPropCall(ctx.propField, t28.identifier(eventName), args);
3403
+ propCall = createPropCall(ctx.propField, t29.identifier(eventName), args);
3362
3404
  } else {
3363
3405
  propCall = createPropCall(ctx.propField, callee, args, true);
3364
3406
  logger.error(
@@ -3375,8 +3417,8 @@ function resolveEmitCalls(ctx) {
3375
3417
  };
3376
3418
  }
3377
3419
  function createPropCall(rootName, callee, args, computed = false) {
3378
- return t28.optionalCallExpression(
3379
- t28.memberExpression(t28.identifier(rootName), callee, computed),
3420
+ return t29.optionalCallExpression(
3421
+ t29.memberExpression(t29.identifier(rootName), callee, computed),
3380
3422
  args,
3381
3423
  true
3382
3424
  );
@@ -3392,21 +3434,21 @@ function createPropCall(rootName, callee, args, computed = false) {
3392
3434
 
3393
3435
  function cloneCallableParams(params) {
3394
3436
  const cloneCallableParam = (param, index) => {
3395
- if (t29.isRestElement(param)) {
3437
+ if (t30.isRestElement(param)) {
3396
3438
  const arg = param.argument;
3397
- const name = t29.isIdentifier(arg) ? arg.name : `args${index}`;
3398
- const rest = t29.restElement(t29.identifier(name));
3399
- 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()));
3400
3442
  return rest;
3401
3443
  }
3402
- if (t29.isIdentifier(param)) {
3403
- const id = t29.identifier(param.name || `arg${index}`);
3444
+ if (t30.isIdentifier(param)) {
3445
+ const id = t30.identifier(param.name || `arg${index}`);
3404
3446
  id.optional = param.optional;
3405
- id.typeAnnotation = param.typeAnnotation || t29.tsTypeAnnotation(t29.tsAnyKeyword());
3447
+ id.typeAnnotation = param.typeAnnotation || t30.tsTypeAnnotation(t30.tsAnyKeyword());
3406
3448
  return id;
3407
3449
  }
3408
- const fallback = t29.identifier(`arg${index}`);
3409
- fallback.typeAnnotation = t29.tsTypeAnnotation(t29.tsAnyKeyword());
3450
+ const fallback = t30.identifier(`arg${index}`);
3451
+ fallback.typeAnnotation = t30.tsTypeAnnotation(t30.tsAnyKeyword());
3410
3452
  return fallback;
3411
3453
  };
3412
3454
  return params.map(cloneCallableParam);
@@ -3416,18 +3458,18 @@ function cloneCallableParams(params) {
3416
3458
  function resolveEmitsTopLevelTypes(ctx) {
3417
3459
  return {
3418
3460
  "TSInterfaceDeclaration|TSTypeAliasDeclaration"(path8) {
3419
- if (!t30.isProgram(path8.parent)) return;
3461
+ if (!t31.isProgram(path8.parent)) return;
3420
3462
  const { node } = path8;
3421
- if (t30.isTSInterfaceDeclaration(node)) {
3422
- const typeLiteral = t30.tsTypeLiteral(node.body.body);
3463
+ if (t31.isTSInterfaceDeclaration(node)) {
3464
+ const typeLiteral = t31.tsTypeLiteral(node.body.body);
3423
3465
  if (!hasEmitsSignatureInType(typeLiteral)) return;
3424
3466
  const resolved = resolveTopLevelEmitType(typeLiteral);
3425
- if (resolved && t30.isTSTypeLiteral(resolved)) {
3467
+ if (resolved && t31.isTSTypeLiteral(resolved)) {
3426
3468
  node.body.body = resolved.members;
3427
3469
  }
3428
3470
  return;
3429
3471
  }
3430
- if (t30.isTSTypeAliasDeclaration(node)) {
3472
+ if (t31.isTSTypeAliasDeclaration(node)) {
3431
3473
  if (!hasEmitsSignatureInType(node.typeAnnotation)) return;
3432
3474
  const resolved = resolveTopLevelEmitType(node.typeAnnotation);
3433
3475
  if (resolved) {
@@ -3438,47 +3480,47 @@ function resolveEmitsTopLevelTypes(ctx) {
3438
3480
  };
3439
3481
  }
3440
3482
  function resolveTopLevelEmitType(tsType) {
3441
- if (t30.isTSParenthesizedType(tsType)) {
3483
+ if (t31.isTSParenthesizedType(tsType)) {
3442
3484
  return resolveTopLevelEmitType(tsType.typeAnnotation);
3443
3485
  }
3444
- if (t30.isTSTypeReference(tsType)) {
3486
+ if (t31.isTSTypeReference(tsType)) {
3445
3487
  if (!tsType.typeParameters || !tsType.typeParameters.params.length) {
3446
3488
  return tsType;
3447
3489
  }
3448
3490
  const params = tsType.typeParameters.params.map((param) => resolveTopLevelEmitType(param)).filter(Boolean);
3449
- return t30.tsTypeReference(
3491
+ return t31.tsTypeReference(
3450
3492
  tsType.typeName,
3451
- t30.tsTypeParameterInstantiation(params.length ? params : tsType.typeParameters.params)
3493
+ t31.tsTypeParameterInstantiation(params.length ? params : tsType.typeParameters.params)
3452
3494
  );
3453
3495
  }
3454
- if (t30.isTSIntersectionType(tsType)) {
3496
+ if (t31.isTSIntersectionType(tsType)) {
3455
3497
  const types = tsType.types.map(resolveTopLevelEmitType).filter(Boolean);
3456
3498
  if (!types.length) return null;
3457
3499
  if (types.length === 1) return types[0];
3458
- return t30.tsIntersectionType(types);
3500
+ return t31.tsIntersectionType(types);
3459
3501
  }
3460
- if (t30.isTSUnionType(tsType)) {
3502
+ if (t31.isTSUnionType(tsType)) {
3461
3503
  const types = tsType.types.map(resolveTopLevelEmitType).filter(Boolean);
3462
3504
  if (!types.length) return null;
3463
3505
  if (types.length === 1) return types[0];
3464
- return t30.tsUnionType(types);
3506
+ return t31.tsUnionType(types);
3465
3507
  }
3466
- if (t30.isTSTypeLiteral(tsType)) {
3508
+ if (t31.isTSTypeLiteral(tsType)) {
3467
3509
  const members = [];
3468
3510
  for (const member of tsType.members) {
3469
- if (t30.isTSCallSignatureDeclaration(member)) {
3511
+ if (t31.isTSCallSignatureDeclaration(member)) {
3470
3512
  members.push(...resolveEmitPropsFromCallSignature(member));
3471
3513
  continue;
3472
3514
  }
3473
3515
  members.push(member);
3474
3516
  }
3475
3517
  if (!members.length) return null;
3476
- return t30.tsTypeLiteral(members);
3518
+ return t31.tsTypeLiteral(members);
3477
3519
  }
3478
- if (t30.isTSFunctionType(tsType)) {
3520
+ if (t31.isTSFunctionType(tsType)) {
3479
3521
  const props = resolveEmitPropsFromCallable(tsType.parameters, tsType.typeAnnotation);
3480
3522
  if (!props.length) return null;
3481
- return t30.tsTypeLiteral(props);
3523
+ return t31.tsTypeLiteral(props);
3482
3524
  }
3483
3525
  return tsType;
3484
3526
  }
@@ -3499,41 +3541,41 @@ function processInferredTypes(ctx, runtimeArg) {
3499
3541
  propsTSIface: { emitTypes }
3500
3542
  } = ctx.scriptData;
3501
3543
  const members = [];
3502
- if (t30.isArrayExpression(runtimeArg)) {
3544
+ if (t31.isArrayExpression(runtimeArg)) {
3503
3545
  for (const element of runtimeArg.elements) {
3504
- if (!element || !t30.isStringLiteral(element)) continue;
3546
+ if (!element || !t31.isStringLiteral(element)) continue;
3505
3547
  const handlerName = resolveEmitHandlerName(element.value);
3506
3548
  const key = buildKey(handlerName);
3507
- const fnType = t30.tsFunctionType(
3549
+ const fnType = t31.tsFunctionType(
3508
3550
  null,
3509
3551
  [createRestAnyParam("args")],
3510
- t30.tsTypeAnnotation(t30.tsAnyKeyword())
3552
+ t31.tsTypeAnnotation(t31.tsAnyKeyword())
3511
3553
  );
3512
- const prop = t30.tsPropertySignature(key, t30.tsTypeAnnotation(fnType));
3554
+ const prop = t31.tsPropertySignature(key, t31.tsTypeAnnotation(fnType));
3513
3555
  prop.optional = true;
3514
3556
  members.push(prop);
3515
3557
  }
3516
3558
  if (members.length) {
3517
- emitTypes.push(t30.tsTypeLiteral(members));
3559
+ emitTypes.push(t31.tsTypeLiteral(members));
3518
3560
  }
3519
3561
  return;
3520
3562
  }
3521
- if (t30.isObjectExpression(runtimeArg)) {
3563
+ if (t31.isObjectExpression(runtimeArg)) {
3522
3564
  for (const prop of runtimeArg.properties) {
3523
- if (!t30.isObjectProperty(prop)) continue;
3524
- if (t30.isSpreadElement(prop)) continue;
3565
+ if (!t31.isObjectProperty(prop)) continue;
3566
+ if (t31.isSpreadElement(prop)) continue;
3525
3567
  const rawName = resolvePropName(prop.key);
3526
3568
  if (!rawName) continue;
3527
3569
  const handlerName = resolveEmitHandlerName(rawName);
3528
3570
  const key = buildKey(handlerName);
3529
- const params = t30.isArrayExpression(prop.value) ? resolveRuntimeTupleParams(prop.value) : [createRestAnyParam("args")];
3530
- const fnType = t30.tsFunctionType(null, params, t30.tsTypeAnnotation(t30.tsAnyKeyword()));
3531
- 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));
3532
3574
  propSig.optional = true;
3533
3575
  members.push(propSig);
3534
3576
  }
3535
3577
  if (members.length) {
3536
- emitTypes.push(t30.tsTypeLiteral(members));
3578
+ emitTypes.push(t31.tsTypeLiteral(members));
3537
3579
  }
3538
3580
  }
3539
3581
  }
@@ -3554,129 +3596,129 @@ function resolveEmitHandlerName(rawName) {
3554
3596
  return `on${name}`;
3555
3597
  }
3556
3598
  function resolvePropName(key) {
3557
- if (t30.isIdentifier(key)) return key.name;
3558
- if (t30.isStringLiteral(key)) return key.value;
3559
- 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);
3560
3602
  return null;
3561
3603
  }
3562
3604
  function buildKey(name) {
3563
- return t30.isValidIdentifier(name) ? t30.identifier(name) : t30.stringLiteral(name);
3605
+ return t31.isValidIdentifier(name) ? t31.identifier(name) : t31.stringLiteral(name);
3564
3606
  }
3565
3607
  function createRestAnyParam(name) {
3566
- const id = t30.identifier(name);
3567
- const rest = t30.restElement(id);
3568
- 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()));
3569
3611
  return rest;
3570
3612
  }
3571
3613
  function resolveRuntimeTupleParams(value) {
3572
3614
  const params = [];
3573
3615
  value.elements.forEach((element, index) => {
3574
3616
  if (!element) return;
3575
- if (t30.isSpreadElement(element)) {
3617
+ if (t31.isSpreadElement(element)) {
3576
3618
  params.push(createRestAnyParam(`args${index}`));
3577
3619
  return;
3578
3620
  }
3579
- if (t30.isIdentifier(element)) {
3580
- const id = t30.identifier(element.name);
3581
- 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());
3582
3624
  params.push(id);
3583
3625
  return;
3584
3626
  }
3585
- if (t30.isTSAsExpression(element)) {
3586
- const id = t30.identifier(`arg${index}`);
3587
- 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);
3588
3630
  params.push(id);
3589
3631
  return;
3590
3632
  }
3591
- const fallback = t30.identifier(`arg${index}`);
3592
- fallback.typeAnnotation = t30.tsTypeAnnotation(t30.tsAnyKeyword());
3633
+ const fallback = t31.identifier(`arg${index}`);
3634
+ fallback.typeAnnotation = t31.tsTypeAnnotation(t31.tsAnyKeyword());
3593
3635
  params.push(fallback);
3594
3636
  });
3595
3637
  return params;
3596
3638
  }
3597
3639
  function resolveExplicitEmitType(tsType) {
3598
- if (t30.isTSParenthesizedType(tsType)) {
3640
+ if (t31.isTSParenthesizedType(tsType)) {
3599
3641
  return resolveExplicitEmitType(tsType.typeAnnotation);
3600
3642
  }
3601
- if (t30.isTSTypeReference(tsType)) {
3643
+ if (t31.isTSTypeReference(tsType)) {
3602
3644
  if (!tsType.typeParameters || !tsType.typeParameters.params.length) {
3603
3645
  return tsType;
3604
3646
  }
3605
3647
  const params = tsType.typeParameters.params.map((param) => resolveExplicitEmitType(param)).filter(Boolean);
3606
- return t30.tsTypeReference(
3648
+ return t31.tsTypeReference(
3607
3649
  tsType.typeName,
3608
- t30.tsTypeParameterInstantiation(params.length ? params : tsType.typeParameters.params)
3650
+ t31.tsTypeParameterInstantiation(params.length ? params : tsType.typeParameters.params)
3609
3651
  );
3610
3652
  }
3611
- if (t30.isTSIntersectionType(tsType)) {
3653
+ if (t31.isTSIntersectionType(tsType)) {
3612
3654
  const types = tsType.types.map(resolveExplicitEmitType).filter(Boolean);
3613
3655
  if (!types.length) return null;
3614
3656
  if (types.length === 1) return types[0];
3615
- return t30.tsIntersectionType(types);
3657
+ return t31.tsIntersectionType(types);
3616
3658
  }
3617
- if (t30.isTSUnionType(tsType)) {
3659
+ if (t31.isTSUnionType(tsType)) {
3618
3660
  const types = tsType.types.map(resolveExplicitEmitType).filter(Boolean);
3619
3661
  if (!types.length) return null;
3620
3662
  if (types.length === 1) return types[0];
3621
- return t30.tsUnionType(types);
3663
+ return t31.tsUnionType(types);
3622
3664
  }
3623
- if (t30.isTSTypeLiteral(tsType)) {
3665
+ if (t31.isTSTypeLiteral(tsType)) {
3624
3666
  const members = [];
3625
3667
  for (const member of tsType.members) {
3626
- if (t30.isTSPropertySignature(member)) {
3668
+ if (t31.isTSPropertySignature(member)) {
3627
3669
  const prop = resolveEmitPropFromPropertySignature(member);
3628
3670
  if (prop) members.push(prop);
3629
3671
  continue;
3630
3672
  }
3631
- if (t30.isTSCallSignatureDeclaration(member)) {
3673
+ if (t31.isTSCallSignatureDeclaration(member)) {
3632
3674
  members.push(...resolveEmitPropsFromCallSignature(member));
3633
3675
  continue;
3634
3676
  }
3635
3677
  }
3636
3678
  if (!members.length) return null;
3637
- return t30.tsTypeLiteral(members);
3679
+ return t31.tsTypeLiteral(members);
3638
3680
  }
3639
- if (t30.isTSFunctionType(tsType)) {
3681
+ if (t31.isTSFunctionType(tsType)) {
3640
3682
  const props = resolveEmitPropsFromCallable(tsType.parameters, tsType.typeAnnotation);
3641
3683
  if (!props.length) return null;
3642
- return t30.tsTypeLiteral(props);
3684
+ return t31.tsTypeLiteral(props);
3643
3685
  }
3644
3686
  return tsType;
3645
3687
  }
3646
3688
  function hasEmitsSignatureInType(tsType) {
3647
- if (t30.isTSParenthesizedType(tsType)) {
3689
+ if (t31.isTSParenthesizedType(tsType)) {
3648
3690
  return hasEmitsSignatureInType(tsType.typeAnnotation);
3649
3691
  }
3650
- if (t30.isTSTypeReference(tsType)) {
3692
+ if (t31.isTSTypeReference(tsType)) {
3651
3693
  if (!tsType.typeParameters || !tsType.typeParameters.params.length) {
3652
3694
  return false;
3653
3695
  }
3654
3696
  return tsType.typeParameters.params.some(hasEmitsSignatureInType);
3655
3697
  }
3656
- if (t30.isTSIntersectionType(tsType) || t30.isTSUnionType(tsType)) {
3698
+ if (t31.isTSIntersectionType(tsType) || t31.isTSUnionType(tsType)) {
3657
3699
  return tsType.types.some(hasEmitsSignatureInType);
3658
3700
  }
3659
- if (t30.isTSTypeLiteral(tsType)) {
3701
+ if (t31.isTSTypeLiteral(tsType)) {
3660
3702
  return tsType.members.some(hasEmitsSignatureInMember);
3661
3703
  }
3662
- if (t30.isTSFunctionType(tsType)) {
3704
+ if (t31.isTSFunctionType(tsType)) {
3663
3705
  return isEmitsCallable(tsType.parameters);
3664
3706
  }
3665
3707
  return false;
3666
3708
  }
3667
3709
  function hasEmitsSignatureInMember(member) {
3668
- if (t30.isTSCallSignatureDeclaration(member)) {
3710
+ if (t31.isTSCallSignatureDeclaration(member)) {
3669
3711
  return isEmitsCallable(member.parameters);
3670
3712
  }
3671
3713
  return false;
3672
3714
  }
3673
3715
  function isEmitsCallable(parameters) {
3674
3716
  const [eventParam] = parameters;
3675
- if (!eventParam || !t30.isIdentifier(eventParam) || !eventParam.typeAnnotation) {
3717
+ if (!eventParam || !t31.isIdentifier(eventParam) || !eventParam.typeAnnotation) {
3676
3718
  return false;
3677
3719
  }
3678
3720
  const { typeAnnotation } = eventParam;
3679
- if (t30.isNoop(typeAnnotation)) return false;
3721
+ if (t31.isNoop(typeAnnotation)) return false;
3680
3722
  return resolveEventNames(typeAnnotation.typeAnnotation).length > 0;
3681
3723
  }
3682
3724
  function resolveEmitPropFromPropertySignature(member) {
@@ -3686,19 +3728,19 @@ function resolveEmitPropFromPropertySignature(member) {
3686
3728
  const key = buildKey(handlerName);
3687
3729
  const typeAnnotation = _optionalChain([member, 'access', _110 => _110.typeAnnotation, 'optionalAccess', _111 => _111.typeAnnotation]);
3688
3730
  let params = [];
3689
- let returnType = t30.tsAnyKeyword();
3690
- if (typeAnnotation && t30.isTSFunctionType(typeAnnotation)) {
3731
+ let returnType = t31.tsAnyKeyword();
3732
+ if (typeAnnotation && t31.isTSFunctionType(typeAnnotation)) {
3691
3733
  params = cloneCallableParams(typeAnnotation.parameters);
3692
3734
  returnType = _nullishCoalesce(_optionalChain([typeAnnotation, 'access', _112 => _112.typeAnnotation, 'optionalAccess', _113 => _113.typeAnnotation]), () => ( returnType));
3693
- } else if (typeAnnotation && t30.isTSTupleType(typeAnnotation)) {
3735
+ } else if (typeAnnotation && t31.isTSTupleType(typeAnnotation)) {
3694
3736
  params = resolveTupleTypeParams(typeAnnotation);
3695
3737
  } else if (typeAnnotation) {
3696
- const id = t30.identifier("value");
3697
- id.typeAnnotation = t30.tsTypeAnnotation(typeAnnotation);
3738
+ const id = t31.identifier("value");
3739
+ id.typeAnnotation = t31.tsTypeAnnotation(typeAnnotation);
3698
3740
  params = [id];
3699
3741
  }
3700
- const fnType = t30.tsFunctionType(null, params, t30.tsTypeAnnotation(returnType));
3701
- 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));
3702
3744
  prop.optional = !!member.optional;
3703
3745
  return prop;
3704
3746
  }
@@ -3707,32 +3749,32 @@ function resolveEmitPropsFromCallSignature(member) {
3707
3749
  }
3708
3750
  function resolveEmitPropsFromCallable(parameters, typeAnnotation) {
3709
3751
  const [eventParam, ...restParams] = parameters;
3710
- if (!eventParam || !t30.isIdentifier(eventParam) || !eventParam.typeAnnotation) {
3752
+ if (!eventParam || !t31.isIdentifier(eventParam) || !eventParam.typeAnnotation) {
3711
3753
  return [];
3712
3754
  }
3713
3755
  const { typeAnnotation: paramTypeAnnotation } = eventParam;
3714
- if (t30.isNoop(paramTypeAnnotation)) return [];
3756
+ if (t31.isNoop(paramTypeAnnotation)) return [];
3715
3757
  const eventNames = resolveEventNames(paramTypeAnnotation.typeAnnotation);
3716
3758
  if (!eventNames.length) return [];
3717
- const returnType = _nullishCoalesce(_optionalChain([typeAnnotation, 'optionalAccess', _114 => _114.typeAnnotation]), () => ( t30.tsAnyKeyword()));
3759
+ const returnType = _nullishCoalesce(_optionalChain([typeAnnotation, 'optionalAccess', _114 => _114.typeAnnotation]), () => ( t31.tsAnyKeyword()));
3718
3760
  return eventNames.map((eventName) => {
3719
3761
  const handlerName = resolveEmitHandlerName(eventName);
3720
3762
  const key = buildKey(handlerName);
3721
3763
  const params = cloneCallableParams(restParams);
3722
- const fnType = t30.tsFunctionType(null, params, t30.tsTypeAnnotation(returnType));
3723
- 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));
3724
3766
  prop.optional = true;
3725
3767
  return prop;
3726
3768
  });
3727
3769
  }
3728
3770
  function resolveEventNames(type) {
3729
- if (t30.isTSLiteralType(type) && t30.isStringLiteral(type.literal)) {
3771
+ if (t31.isTSLiteralType(type) && t31.isStringLiteral(type.literal)) {
3730
3772
  return [type.literal.value];
3731
3773
  }
3732
- if (t30.isTSUnionType(type)) {
3774
+ if (t31.isTSUnionType(type)) {
3733
3775
  return type.types.flatMap(resolveEventNames);
3734
3776
  }
3735
- if (t30.isTSParenthesizedType(type)) {
3777
+ if (t31.isTSParenthesizedType(type)) {
3736
3778
  return resolveEventNames(type.typeAnnotation);
3737
3779
  }
3738
3780
  return [];
@@ -3745,39 +3787,39 @@ function resolveTupleTypeParams(tuple) {
3745
3787
  return params;
3746
3788
  }
3747
3789
  function resolveTupleElementParam(element, index) {
3748
- const isNamedTuple = typeof t30.isTSNamedTupleMember === "function" && t30.isTSNamedTupleMember(element);
3790
+ const isNamedTuple = typeof t31.isTSNamedTupleMember === "function" && t31.isTSNamedTupleMember(element);
3749
3791
  if (isNamedTuple) {
3750
3792
  const tupleMember = element;
3751
3793
  const name = _optionalChain([tupleMember, 'access', _115 => _115.label, 'optionalAccess', _116 => _116.name]) || `arg${index}`;
3752
3794
  let innerType = tupleMember.elementType;
3753
3795
  let optional = tupleMember.optional;
3754
- if (t30.isTSOptionalType(innerType)) {
3796
+ if (t31.isTSOptionalType(innerType)) {
3755
3797
  optional = true;
3756
3798
  innerType = innerType.typeAnnotation;
3757
3799
  }
3758
- if (t30.isTSRestType(innerType)) {
3759
- const rest = t30.restElement(t30.identifier(name));
3760
- 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);
3761
3803
  return rest;
3762
3804
  }
3763
- const id2 = t30.identifier(name);
3805
+ const id2 = t31.identifier(name);
3764
3806
  id2.optional = optional;
3765
- id2.typeAnnotation = t30.tsTypeAnnotation(innerType);
3807
+ id2.typeAnnotation = t31.tsTypeAnnotation(innerType);
3766
3808
  return id2;
3767
3809
  }
3768
- if (t30.isTSRestType(element)) {
3769
- const rest = t30.restElement(t30.identifier(`args${index}`));
3770
- 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);
3771
3813
  return rest;
3772
3814
  }
3773
- if (t30.isTSOptionalType(element)) {
3774
- const id2 = t30.identifier(`arg${index}`);
3815
+ if (t31.isTSOptionalType(element)) {
3816
+ const id2 = t31.identifier(`arg${index}`);
3775
3817
  id2.optional = true;
3776
- id2.typeAnnotation = t30.tsTypeAnnotation(element.typeAnnotation);
3818
+ id2.typeAnnotation = t31.tsTypeAnnotation(element.typeAnnotation);
3777
3819
  return id2;
3778
3820
  }
3779
- const id = t30.identifier(`arg${index}`);
3780
- id.typeAnnotation = t30.tsTypeAnnotation(element);
3821
+ const id = t31.identifier(`arg${index}`);
3822
+ id.typeAnnotation = t31.tsTypeAnnotation(element);
3781
3823
  return id;
3782
3824
  }
3783
3825
 
@@ -3802,38 +3844,38 @@ function processInferredTypes2(ctx, runtimeArg) {
3802
3844
  } = scriptData;
3803
3845
  if (!runtimeArg) return;
3804
3846
  const members = [];
3805
- if (t31.isArrayExpression(runtimeArg)) {
3847
+ if (t32.isArrayExpression(runtimeArg)) {
3806
3848
  for (const element of runtimeArg.elements) {
3807
- if (!element || !t31.isStringLiteral(element)) continue;
3808
- const key = t31.isValidIdentifier(element.value) ? t31.identifier(element.value) : t31.stringLiteral(element.value);
3809
- 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()));
3810
3852
  prop.optional = true;
3811
3853
  members.push(prop);
3812
3854
  }
3813
3855
  if (members.length) {
3814
- propsTypes.push(t31.tsTypeLiteral(members));
3856
+ propsTypes.push(t32.tsTypeLiteral(members));
3815
3857
  }
3816
3858
  return;
3817
3859
  }
3818
- if (t31.isObjectExpression(runtimeArg)) {
3860
+ if (t32.isObjectExpression(runtimeArg)) {
3819
3861
  for (const prop of runtimeArg.properties) {
3820
- if (!t31.isObjectProperty(prop)) continue;
3821
- if (t31.isSpreadElement(prop)) continue;
3862
+ if (!t32.isObjectProperty(prop)) continue;
3863
+ if (t32.isSpreadElement(prop)) continue;
3822
3864
  const key = prop.key;
3823
3865
  let propName = null;
3824
- if (t31.isIdentifier(key)) propName = key.name;
3825
- if (t31.isStringLiteral(key)) propName = key.value;
3826
- 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);
3827
3869
  if (!propName) continue;
3828
3870
  const { type, required } = resolveRuntimePropMeta(prop.value);
3829
- const tsType = _nullishCoalesce(type, () => ( t31.tsAnyKeyword()));
3830
- const tsKey = t31.isValidIdentifier(propName) ? t31.identifier(propName) : t31.stringLiteral(propName);
3831
- const tsProp = t31.tsPropertySignature(tsKey, t31.tsTypeAnnotation(tsType));
3871
+ const tsType = _nullishCoalesce(type, () => ( t32.tsAnyKeyword()));
3872
+ const tsKey = t32.isValidIdentifier(propName) ? t32.identifier(propName) : t32.stringLiteral(propName);
3873
+ const tsProp = t32.tsPropertySignature(tsKey, t32.tsTypeAnnotation(tsType));
3832
3874
  tsProp.optional = !required;
3833
3875
  members.push(tsProp);
3834
3876
  }
3835
3877
  if (members.length) {
3836
- propsTypes.push(t31.tsTypeLiteral(members));
3878
+ propsTypes.push(t32.tsTypeLiteral(members));
3837
3879
  }
3838
3880
  return;
3839
3881
  }
@@ -3847,42 +3889,42 @@ function processInferredTypes2(ctx, runtimeArg) {
3847
3889
  );
3848
3890
  }
3849
3891
  function resolveRuntimePropMeta(value) {
3850
- if (t31.isIdentifier(value)) {
3892
+ if (t32.isIdentifier(value)) {
3851
3893
  return {
3852
3894
  type: mapRuntimeTypeToTSType(value),
3853
3895
  required: false
3854
3896
  };
3855
3897
  }
3856
- if (t31.isArrayExpression(value)) {
3898
+ if (t32.isArrayExpression(value)) {
3857
3899
  return {
3858
3900
  type: resolveRuntimeUnionType(value),
3859
3901
  required: false
3860
3902
  };
3861
3903
  }
3862
- if (!t31.isObjectExpression(value)) {
3904
+ if (!t32.isObjectExpression(value)) {
3863
3905
  return { required: false };
3864
3906
  }
3865
3907
  let type;
3866
3908
  let required = false;
3867
3909
  for (const prop of value.properties) {
3868
- if (!t31.isObjectProperty(prop)) continue;
3869
- if (t31.isSpreadElement(prop)) continue;
3910
+ if (!t32.isObjectProperty(prop)) continue;
3911
+ if (t32.isSpreadElement(prop)) continue;
3870
3912
  const key = prop.key;
3871
- 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;
3872
3914
  if (!propName) continue;
3873
3915
  if (propName === "type") {
3874
3916
  const valueNode = prop.value;
3875
- if (t31.isArrayExpression(valueNode)) {
3917
+ if (t32.isArrayExpression(valueNode)) {
3876
3918
  type = resolveRuntimeUnionType(valueNode);
3877
3919
  continue;
3878
3920
  }
3879
- if (t31.isIdentifier(valueNode)) {
3921
+ if (t32.isIdentifier(valueNode)) {
3880
3922
  type = mapRuntimeTypeToTSType(valueNode);
3881
3923
  continue;
3882
3924
  }
3883
3925
  }
3884
3926
  if (propName === "required") {
3885
- if (t31.isBooleanLiteral(prop.value)) {
3927
+ if (t32.isBooleanLiteral(prop.value)) {
3886
3928
  required = prop.value.value;
3887
3929
  }
3888
3930
  }
@@ -3892,34 +3934,34 @@ function resolveRuntimePropMeta(value) {
3892
3934
  function resolveRuntimeUnionType(value) {
3893
3935
  const types = [];
3894
3936
  for (const element of value.elements) {
3895
- if (!element || !t31.isIdentifier(element)) continue;
3937
+ if (!element || !t32.isIdentifier(element)) continue;
3896
3938
  const resolved = mapRuntimeTypeToTSType(element);
3897
3939
  if (resolved) types.push(resolved);
3898
3940
  }
3899
- if (!types.length) return t31.tsAnyKeyword();
3941
+ if (!types.length) return t32.tsAnyKeyword();
3900
3942
  if (types.length === 1) return types[0];
3901
- return t31.tsUnionType(types);
3943
+ return t32.tsUnionType(types);
3902
3944
  }
3903
3945
  function mapRuntimeTypeToTSType(value) {
3904
3946
  switch (value.name) {
3905
3947
  case "String":
3906
- return t31.tsStringKeyword();
3948
+ return t32.tsStringKeyword();
3907
3949
  case "Number":
3908
- return t31.tsNumberKeyword();
3950
+ return t32.tsNumberKeyword();
3909
3951
  case "Boolean":
3910
- return t31.tsBooleanKeyword();
3952
+ return t32.tsBooleanKeyword();
3911
3953
  case "Object":
3912
- return t31.tsTypeLiteral([]);
3954
+ return t32.tsTypeLiteral([]);
3913
3955
  case "Array":
3914
- return t31.tsArrayType(t31.tsAnyKeyword());
3956
+ return t32.tsArrayType(t32.tsAnyKeyword());
3915
3957
  case "Function":
3916
- return t31.tsFunctionType(null, [], t31.tsTypeAnnotation(t31.tsAnyKeyword()));
3958
+ return t32.tsFunctionType(null, [], t32.tsTypeAnnotation(t32.tsAnyKeyword()));
3917
3959
  case "Symbol":
3918
- return t31.tsSymbolKeyword();
3960
+ return t32.tsSymbolKeyword();
3919
3961
  case "BigInt":
3920
- return t31.tsBigIntKeyword();
3962
+ return t32.tsBigIntKeyword();
3921
3963
  default:
3922
- return t31.tsAnyKeyword();
3964
+ return t32.tsAnyKeyword();
3923
3965
  }
3924
3966
  }
3925
3967
 
@@ -3933,34 +3975,34 @@ var SLOT_CHILDREN_NAME = "children";
3933
3975
  var SLOT_FN_PARAM_NAME = "props";
3934
3976
  function buildSlotPropSignature(rawName, params, optional) {
3935
3977
  const propName = rawName === SLOT_DEFAULT_NAME ? SLOT_CHILDREN_NAME : rawName;
3936
- const key = t32.isValidIdentifier(propName) ? t32.identifier(propName) : t32.stringLiteral(propName);
3937
- const reactNodeType = t32.tsTypeAnnotation(
3938
- 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))
3939
3981
  );
3940
3982
  let typeAnnotation;
3941
3983
  if (rawName === SLOT_DEFAULT_NAME && params.length === 0 || params.length === 0) {
3942
3984
  typeAnnotation = reactNodeType;
3943
3985
  } else {
3944
- const fnType = t32.tsFunctionType(null, params, reactNodeType);
3945
- typeAnnotation = t32.tsTypeAnnotation(fnType);
3986
+ const fnType = t33.tsFunctionType(null, params, reactNodeType);
3987
+ typeAnnotation = t33.tsTypeAnnotation(fnType);
3946
3988
  }
3947
- const prop = t32.tsPropertySignature(key, typeAnnotation);
3989
+ const prop = t33.tsPropertySignature(key, typeAnnotation);
3948
3990
  prop.optional = optional;
3949
3991
  return prop;
3950
3992
  }
3951
3993
  function createSlotScopeParam(props, ctx) {
3952
- const paramId = t32.identifier(SLOT_FN_PARAM_NAME);
3994
+ const paramId = t33.identifier(SLOT_FN_PARAM_NAME);
3953
3995
  const propsSigns = [];
3954
3996
  const { reactiveBindings } = ctx.templateData;
3955
3997
  props.forEach(({ prop, tsType }) => {
3956
3998
  const foundBindingValue = _optionalChain([reactiveBindings, 'access', _121 => _121[prop], 'optionalAccess', _122 => _122.value]);
3957
3999
  const foundBindingTypes = foundBindingValue ? expressionToTSType(foundBindingValue) : null;
3958
- const typeAnnotation = foundBindingTypes ? t32.tsTypeAnnotation(foundBindingTypes) : tsType;
3959
- const key = t32.isValidIdentifier(prop) ? t32.identifier(prop) : t32.stringLiteral(prop);
3960
- 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);
3961
4003
  propsSigns.push(propSign);
3962
4004
  });
3963
- paramId.typeAnnotation = t32.tsTypeAnnotation(t32.tsTypeLiteral(propsSigns));
4005
+ paramId.typeAnnotation = t33.tsTypeAnnotation(t33.tsTypeLiteral(propsSigns));
3964
4006
  return paramId;
3965
4007
  }
3966
4008
 
@@ -3981,16 +4023,16 @@ function collectLocalTypeDeclarations(path8) {
3981
4023
  return declarations;
3982
4024
  }
3983
4025
  for (const statement of programPath.node.body) {
3984
- if (t33.isTSInterfaceDeclaration(statement)) {
4026
+ if (t34.isTSInterfaceDeclaration(statement)) {
3985
4027
  declarations.set(statement.id.name, {
3986
- type: t33.tsTypeLiteral(statement.body.body),
4028
+ type: t34.tsTypeLiteral(statement.body.body),
3987
4029
  // 将接口体转换为类型字面量
3988
4030
  hasTypeParameters: !!_optionalChain([statement, 'access', _123 => _123.typeParameters, 'optionalAccess', _124 => _124.params, 'access', _125 => _125.length])
3989
4031
  // 检查是否有泛型参数
3990
4032
  });
3991
4033
  continue;
3992
4034
  }
3993
- if (t33.isTSTypeAliasDeclaration(statement)) {
4035
+ if (t34.isTSTypeAliasDeclaration(statement)) {
3994
4036
  declarations.set(statement.id.name, {
3995
4037
  type: statement.typeAnnotation,
3996
4038
  // 直接使用类型注解
@@ -3999,16 +4041,16 @@ function collectLocalTypeDeclarations(path8) {
3999
4041
  });
4000
4042
  continue;
4001
4043
  }
4002
- if (t33.isExportNamedDeclaration(statement) && statement.declaration) {
4044
+ if (t34.isExportNamedDeclaration(statement) && statement.declaration) {
4003
4045
  const declaration = statement.declaration;
4004
- if (t33.isTSInterfaceDeclaration(declaration)) {
4046
+ if (t34.isTSInterfaceDeclaration(declaration)) {
4005
4047
  declarations.set(declaration.id.name, {
4006
- type: t33.tsTypeLiteral(declaration.body.body),
4048
+ type: t34.tsTypeLiteral(declaration.body.body),
4007
4049
  // 将接口体转换为类型字面量
4008
4050
  hasTypeParameters: !!_optionalChain([declaration, 'access', _129 => _129.typeParameters, 'optionalAccess', _130 => _130.params, 'access', _131 => _131.length])
4009
4051
  // 检查是否有泛型参数
4010
4052
  });
4011
- } else if (t33.isTSTypeAliasDeclaration(declaration)) {
4053
+ } else if (t34.isTSTypeAliasDeclaration(declaration)) {
4012
4054
  declarations.set(declaration.id.name, {
4013
4055
  type: declaration.typeAnnotation,
4014
4056
  // 直接使用类型注解
@@ -4021,22 +4063,22 @@ function collectLocalTypeDeclarations(path8) {
4021
4063
  return declarations;
4022
4064
  }
4023
4065
  function resolvePropName2(key) {
4024
- if (t33.isIdentifier(key)) {
4066
+ if (t34.isIdentifier(key)) {
4025
4067
  return key.name;
4026
4068
  }
4027
- if (t33.isStringLiteral(key)) {
4069
+ if (t34.isStringLiteral(key)) {
4028
4070
  return key.value;
4029
4071
  }
4030
- if (t33.isNumericLiteral(key)) {
4072
+ if (t34.isNumericLiteral(key)) {
4031
4073
  return String(key.value);
4032
4074
  }
4033
4075
  return null;
4034
4076
  }
4035
4077
  function resolveCallableType(tsType) {
4036
- if (t33.isTSFunctionType(tsType)) {
4078
+ if (t34.isTSFunctionType(tsType)) {
4037
4079
  return tsType;
4038
4080
  }
4039
- if (t33.isTSParenthesizedType(tsType)) {
4081
+ if (t34.isTSParenthesizedType(tsType)) {
4040
4082
  return resolveCallableType(tsType.typeAnnotation);
4041
4083
  }
4042
4084
  return null;
@@ -4045,10 +4087,10 @@ function resolveCallableType(tsType) {
4045
4087
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-props-interface/resolve-slot/type-resolver.ts
4046
4088
  var SLOT_DEFAULT_NAME2 = "default";
4047
4089
  function resolveSlotType(tsType, options) {
4048
- if (t34.isTSParenthesizedType(tsType)) {
4090
+ if (t35.isTSParenthesizedType(tsType)) {
4049
4091
  return resolveSlotType(tsType.typeAnnotation, options);
4050
4092
  }
4051
- if (t34.isTSTypeReference(tsType)) {
4093
+ if (t35.isTSTypeReference(tsType)) {
4052
4094
  let shouldRecordReactNode = false;
4053
4095
  if (_optionalChain([tsType, 'access', _135 => _135.typeParameters, 'optionalAccess', _136 => _136.params, 'access', _137 => _137.length])) {
4054
4096
  const params = [];
@@ -4064,11 +4106,11 @@ function resolveSlotType(tsType, options) {
4064
4106
  };
4065
4107
  }
4066
4108
  return {
4067
- type: t34.tsTypeReference(tsType.typeName, t34.tsTypeParameterInstantiation(params)),
4109
+ type: t35.tsTypeReference(tsType.typeName, t35.tsTypeParameterInstantiation(params)),
4068
4110
  shouldRecordReactNode
4069
4111
  };
4070
4112
  }
4071
- if (!t34.isIdentifier(tsType.typeName)) {
4113
+ if (!t35.isIdentifier(tsType.typeName)) {
4072
4114
  return {
4073
4115
  type: tsType,
4074
4116
  shouldRecordReactNode: false
@@ -4099,7 +4141,7 @@ function resolveSlotType(tsType, options) {
4099
4141
  }
4100
4142
  return resolved;
4101
4143
  }
4102
- if (t34.isTSIntersectionType(tsType)) {
4144
+ if (t35.isTSIntersectionType(tsType)) {
4103
4145
  const types = [];
4104
4146
  let shouldRecordReactNode = false;
4105
4147
  for (const item of tsType.types) {
@@ -4122,11 +4164,11 @@ function resolveSlotType(tsType, options) {
4122
4164
  };
4123
4165
  }
4124
4166
  return {
4125
- type: t34.tsIntersectionType(types),
4167
+ type: t35.tsIntersectionType(types),
4126
4168
  shouldRecordReactNode
4127
4169
  };
4128
4170
  }
4129
- if (t34.isTSUnionType(tsType)) {
4171
+ if (t35.isTSUnionType(tsType)) {
4130
4172
  const types = [];
4131
4173
  let shouldRecordReactNode = false;
4132
4174
  for (const item of tsType.types) {
@@ -4149,11 +4191,11 @@ function resolveSlotType(tsType, options) {
4149
4191
  };
4150
4192
  }
4151
4193
  return {
4152
- type: t34.tsUnionType(types),
4194
+ type: t35.tsUnionType(types),
4153
4195
  shouldRecordReactNode
4154
4196
  };
4155
4197
  }
4156
- if (t34.isTSTypeLiteral(tsType)) {
4198
+ if (t35.isTSTypeLiteral(tsType)) {
4157
4199
  const members = [];
4158
4200
  let shouldRecordReactNode = false;
4159
4201
  for (const item of tsType.members) {
@@ -4168,11 +4210,11 @@ function resolveSlotType(tsType, options) {
4168
4210
  };
4169
4211
  }
4170
4212
  return {
4171
- type: t34.tsTypeLiteral(members),
4213
+ type: t35.tsTypeLiteral(members),
4172
4214
  shouldRecordReactNode
4173
4215
  };
4174
4216
  }
4175
- if (t34.isTSFunctionType(tsType)) {
4217
+ if (t35.isTSFunctionType(tsType)) {
4176
4218
  const props = buildSlotPropSignature(
4177
4219
  SLOT_DEFAULT_NAME2,
4178
4220
  cloneCallableParams(tsType.parameters),
@@ -4180,7 +4222,7 @@ function resolveSlotType(tsType, options) {
4180
4222
  // 默认插槽不是可选的
4181
4223
  );
4182
4224
  return {
4183
- type: t34.tsTypeLiteral([props]),
4225
+ type: t35.tsTypeLiteral([props]),
4184
4226
  shouldRecordReactNode: true
4185
4227
  // 函数类型总是需要记录 ReactNode
4186
4228
  };
@@ -4191,7 +4233,7 @@ function resolveSlotType(tsType, options) {
4191
4233
  };
4192
4234
  }
4193
4235
  function resolveSlotPropFromMember(member) {
4194
- if (t34.isTSMethodSignature(member)) {
4236
+ if (t35.isTSMethodSignature(member)) {
4195
4237
  const rawName = resolvePropName2(member.key);
4196
4238
  if (!rawName) {
4197
4239
  return {
@@ -4206,7 +4248,7 @@ function resolveSlotPropFromMember(member) {
4206
4248
  // 方法签名总是可调用,需要记录 ReactNode
4207
4249
  };
4208
4250
  }
4209
- if (t34.isTSPropertySignature(member)) {
4251
+ if (t35.isTSPropertySignature(member)) {
4210
4252
  const rawName = resolvePropName2(member.key);
4211
4253
  if (!rawName) {
4212
4254
  return {
@@ -4229,7 +4271,7 @@ function resolveSlotPropFromMember(member) {
4229
4271
  // 可调用属性需要记录 ReactNode
4230
4272
  };
4231
4273
  }
4232
- if (t34.isTSCallSignatureDeclaration(member)) {
4274
+ if (t35.isTSCallSignatureDeclaration(member)) {
4233
4275
  const params = cloneCallableParams(member.parameters);
4234
4276
  return {
4235
4277
  member: buildSlotPropSignature(SLOT_DEFAULT_NAME2, params, true),
@@ -4287,7 +4329,7 @@ function resolveTemplateSlotIface(ctx) {
4287
4329
  }
4288
4330
  if (tsMembers.length) {
4289
4331
  recordReactNode(ctx);
4290
- slotTypes.push(t35.tsTypeLiteral(tsMembers));
4332
+ slotTypes.push(t36.tsTypeLiteral(tsMembers));
4291
4333
  }
4292
4334
  }
4293
4335
 
@@ -4339,9 +4381,9 @@ function resolveCompIProps(ctx, ast) {
4339
4381
  }
4340
4382
  const n = declaredOptions.name || "Comp";
4341
4383
  const ns = `I${camelCase(capitalize(n))}Props`;
4342
- const typeNode = t36.tsIntersectionType(tsTypes);
4343
- const typeAliasDecl = t36.tsTypeAliasDeclaration(t36.identifier(ns), null, typeNode);
4344
- 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);
4345
4387
  propsTSIface.name = ns;
4346
4388
  const scriptIR = getScriptIR(ctx);
4347
4389
  scriptIR.exports.push(exportDecl);
@@ -4356,8 +4398,8 @@ function resolveUseAttrs(ctx) {
4356
4398
  const { init, id } = path8.node;
4357
4399
  if (!init) return;
4358
4400
  const initPath = path8.get("init");
4359
- const propsIdentifier = t37.identifier(ctx.propField);
4360
- if (t37.isTSAsExpression(init) && isUseAttrsCall(init.expression)) {
4401
+ const propsIdentifier = t38.identifier(ctx.propField);
4402
+ if (t38.isTSAsExpression(init) && isUseAttrsCall(init.expression)) {
4361
4403
  const typeAssertion = createPropsTypeAssertion(propsIdentifier, init.typeAnnotation);
4362
4404
  replaceNode(initPath, typeAssertion, init);
4363
4405
  return;
@@ -4368,13 +4410,13 @@ function resolveUseAttrs(ctx) {
4368
4410
  const isTS = ctx.scriptData.lang.startsWith("ts");
4369
4411
  if (isTS) {
4370
4412
  let typeAnnotation = null;
4371
- if (t37.isIdentifier(id) && t37.isTSTypeAnnotation(id.typeAnnotation)) {
4413
+ if (t38.isIdentifier(id) && t38.isTSTypeAnnotation(id.typeAnnotation)) {
4372
4414
  typeAnnotation = id.typeAnnotation.typeAnnotation;
4373
4415
  id.typeAnnotation = null;
4374
4416
  } else {
4375
- typeAnnotation = t37.tsTypeReference(
4376
- t37.identifier("Record"),
4377
- t37.tsTypeParameterInstantiation([t37.tsStringKeyword(), t37.tsUnknownKeyword()])
4417
+ typeAnnotation = t38.tsTypeReference(
4418
+ t38.identifier("Record"),
4419
+ t38.tsTypeParameterInstantiation([t38.tsStringKeyword(), t38.tsUnknownKeyword()])
4378
4420
  );
4379
4421
  }
4380
4422
  const propsTypeAssertion = createPropsTypeAssertion(propsIdentifier, typeAnnotation);
@@ -4386,10 +4428,10 @@ function resolveUseAttrs(ctx) {
4386
4428
  };
4387
4429
  }
4388
4430
  function isUseAttrsCall(expr) {
4389
- return t37.isCallExpression(expr) && isCalleeNamed(expr, VUE_API_MAP.useAttrs);
4431
+ return t38.isCallExpression(expr) && isCalleeNamed(expr, VUE_API_MAP.useAttrs);
4390
4432
  }
4391
4433
  function createPropsTypeAssertion(propsIdentifier, typeAnnotation) {
4392
- return t37.tsAsExpression(propsIdentifier, typeAnnotation);
4434
+ return t38.tsAsExpression(propsIdentifier, typeAnnotation);
4393
4435
  }
4394
4436
 
4395
4437
  // src/core/transform/sfc/script/syntax-processor/process/resolve-analysis-only-adapter.ts
@@ -4426,39 +4468,39 @@ function isEligibleBindingSource(binding) {
4426
4468
  const declaratorPath = getVariableDeclaratorPath(bindingPath);
4427
4469
  const isReactiveVarBinding = !!declaratorPath && isReactiveBinding(declaratorPath.node);
4428
4470
  const nodeInit = _optionalChain([declaratorPath, 'optionalAccess', _145 => _145.node, 'access', _146 => _146.init]);
4429
- const isReactiveApiCallVarBinding = !!declaratorPath && t38.isCallExpression(nodeInit) && t38.isIdentifier(nodeInit.callee) && reactiveStateApis.has(nodeInit.callee.name);
4430
- const isHookCallVarBinding = !!declaratorPath && t38.isCallExpression(nodeInit) && isHookLikeCallee(nodeInit.callee);
4431
- 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));
4432
4474
  const isReactiveFunctionBinding = isFunctionBinding && (isReactiveBinding(_optionalChain([declaratorPath, 'optionalAccess', _147 => _147.node])) || isReactiveBinding(bindingPath.node));
4433
4475
  return isReactiveVarBinding || isReactiveApiCallVarBinding || isHookCallVarBinding || isReactiveFunctionBinding;
4434
4476
  }
4435
4477
  function isReactValidDependencyExpr(node) {
4436
- if (t38.isIdentifier(node)) {
4478
+ if (t39.isIdentifier(node)) {
4437
4479
  return true;
4438
4480
  }
4439
- if (t38.isMemberExpression(node) || t38.isOptionalMemberExpression(node)) {
4481
+ if (t39.isMemberExpression(node) || t39.isOptionalMemberExpression(node)) {
4440
4482
  return isStaticMemberChain(node);
4441
4483
  }
4442
4484
  return false;
4443
4485
  }
4444
4486
  function isStaticMemberChain(node) {
4445
4487
  let current = node;
4446
- while (t38.isMemberExpression(current) || t38.isOptionalMemberExpression(current)) {
4447
- if (!current.computed && !t38.isIdentifier(current.property)) {
4488
+ while (t39.isMemberExpression(current) || t39.isOptionalMemberExpression(current)) {
4489
+ if (!current.computed && !t39.isIdentifier(current.property)) {
4448
4490
  return false;
4449
4491
  }
4450
- if (current.computed && !t38.isStringLiteral(current.property) && !t38.isNumericLiteral(current.property)) {
4492
+ if (current.computed && !t39.isStringLiteral(current.property) && !t39.isNumericLiteral(current.property)) {
4451
4493
  return false;
4452
4494
  }
4453
4495
  current = current.object;
4454
4496
  }
4455
- return t38.isIdentifier(current);
4497
+ return t39.isIdentifier(current);
4456
4498
  }
4457
4499
  function isHookLikeCallee(callee) {
4458
- if (t38.isIdentifier(callee)) {
4500
+ if (t39.isIdentifier(callee)) {
4459
4501
  return callee.name.startsWith("use");
4460
4502
  }
4461
- if (t38.isMemberExpression(callee) && !callee.computed && t38.isIdentifier(callee.property)) {
4503
+ if (t39.isMemberExpression(callee) && !callee.computed && t39.isIdentifier(callee.property)) {
4462
4504
  return callee.property.name.startsWith("use");
4463
4505
  }
4464
4506
  return false;
@@ -4467,16 +4509,16 @@ function isHookLikeCallee(callee) {
4467
4509
  // src/core/transform/sfc/script/shared/dependency-analyzer/dep-key.ts
4468
4510
 
4469
4511
  function getDependencyKey(exp) {
4470
- if (t39.isIdentifier(exp)) {
4512
+ if (t40.isIdentifier(exp)) {
4471
4513
  return exp.name;
4472
4514
  }
4473
- if (t39.isMemberExpression(exp) || t39.isOptionalMemberExpression(exp)) {
4515
+ if (t40.isMemberExpression(exp) || t40.isOptionalMemberExpression(exp)) {
4474
4516
  const objectKey = getDependencyKey(exp.object);
4475
4517
  const opt = exp.optional ? "?" : "";
4476
- if (!exp.computed && t39.isIdentifier(exp.property)) {
4518
+ if (!exp.computed && t40.isIdentifier(exp.property)) {
4477
4519
  return `${objectKey}${opt}.${exp.property.name}`;
4478
4520
  }
4479
- if (t39.isStringLiteral(exp.property) || t39.isNumericLiteral(exp.property)) {
4521
+ if (t40.isStringLiteral(exp.property) || t40.isNumericLiteral(exp.property)) {
4480
4522
  return `${objectKey}${opt}[${JSON.stringify(exp.property.value)}]`;
4481
4523
  }
4482
4524
  return `${objectKey}${opt}[*]`;
@@ -4487,38 +4529,38 @@ function getDependencyKey(exp) {
4487
4529
  // src/core/transform/sfc/script/shared/dependency-analyzer/dep-normalizer.ts
4488
4530
 
4489
4531
  function normalizeDependencyExpr(path8, rootName, ctx) {
4490
- if (t40.isIdentifier(path8.node)) {
4491
- return t40.identifier(path8.node.name);
4532
+ if (t41.isIdentifier(path8.node)) {
4533
+ return t41.identifier(path8.node.name);
4492
4534
  }
4493
- if (t40.isMemberExpression(path8.node) || t40.isOptionalMemberExpression(path8.node)) {
4535
+ if (t41.isMemberExpression(path8.node) || t41.isOptionalMemberExpression(path8.node)) {
4494
4536
  if (rootName === ctx.propField) {
4495
4537
  const safePropsExp = ensureOptionalForMemberChain(path8.node);
4496
4538
  if (isReactValidDependencyExpr(safePropsExp)) {
4497
- return t40.cloneNode(safePropsExp, true);
4539
+ return t41.cloneNode(safePropsExp, true);
4498
4540
  }
4499
- return t40.identifier(rootName);
4541
+ return t41.identifier(rootName);
4500
4542
  }
4501
4543
  const normalizedExp = normalizeMemberForCallSite(path8, path8.node);
4502
- const safeExp = t40.isMemberExpression(normalizedExp) || t40.isOptionalMemberExpression(normalizedExp) ? ensureOptionalForMemberChain(normalizedExp) : normalizedExp;
4544
+ const safeExp = t41.isMemberExpression(normalizedExp) || t41.isOptionalMemberExpression(normalizedExp) ? ensureOptionalForMemberChain(normalizedExp) : normalizedExp;
4503
4545
  if (isReactValidDependencyExpr(safeExp)) {
4504
- return t40.cloneNode(safeExp, true);
4546
+ return t41.cloneNode(safeExp, true);
4505
4547
  }
4506
- return t40.identifier(rootName);
4548
+ return t41.identifier(rootName);
4507
4549
  }
4508
4550
  return null;
4509
4551
  }
4510
4552
  function normalizeSourcedDependency(exp) {
4511
- if (t40.isIdentifier(exp)) {
4512
- return t40.identifier(exp.name);
4553
+ if (t41.isIdentifier(exp)) {
4554
+ return t41.identifier(exp.name);
4513
4555
  }
4514
- if (t40.isMemberExpression(exp) || t40.isOptionalMemberExpression(exp)) {
4556
+ if (t41.isMemberExpression(exp) || t41.isOptionalMemberExpression(exp)) {
4515
4557
  const root = findRootIdentifier(exp);
4516
4558
  if (!root) return null;
4517
- const safeExp = t40.isMemberExpression(exp) || t40.isOptionalMemberExpression(exp) ? ensureOptionalForMemberChain(exp) : exp;
4559
+ const safeExp = t41.isMemberExpression(exp) || t41.isOptionalMemberExpression(exp) ? ensureOptionalForMemberChain(exp) : exp;
4518
4560
  if (isReactValidDependencyExpr(safeExp)) {
4519
- return t40.cloneNode(safeExp, true);
4561
+ return t41.cloneNode(safeExp, true);
4520
4562
  }
4521
- return t40.identifier(root.name);
4563
+ return t41.identifier(root.name);
4522
4564
  }
4523
4565
  return null;
4524
4566
  }
@@ -4528,7 +4570,7 @@ function normalizeMemberForCallSite(path8, node) {
4528
4570
  if (!isDirectCallee) {
4529
4571
  return node;
4530
4572
  }
4531
- if (!t40.isExpression(node.object)) {
4573
+ if (!t41.isExpression(node.object)) {
4532
4574
  return node;
4533
4575
  }
4534
4576
  return node.object;
@@ -4537,15 +4579,23 @@ function ensureOptionalForMemberChain(node) {
4537
4579
  if (!hasTrailingMemberAccess(node)) {
4538
4580
  return node;
4539
4581
  }
4540
- if (t40.isOptionalMemberExpression(node) && node.optional) {
4541
- return node;
4542
- }
4543
- const object = t40.cloneNode(node.object, true);
4544
- const property = t40.cloneNode(node.property, true);
4545
- 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);
4546
4596
  }
4547
4597
  function hasTrailingMemberAccess(node) {
4548
- return t40.isMemberExpression(node.object) || t40.isOptionalMemberExpression(node.object);
4598
+ return t41.isMemberExpression(node.object) || t41.isOptionalMemberExpression(node.object);
4549
4599
  }
4550
4600
 
4551
4601
  // src/core/transform/sfc/script/shared/dependency-analyzer/shared-utils.ts
@@ -4572,7 +4622,7 @@ function traceBindingSource(binding, seen, depth) {
4572
4622
  }
4573
4623
  function isExpressionSourcedFromEligibleBinding(exp, scope, seen, depth) {
4574
4624
  if (depth <= 0) return null;
4575
- if (t41.isIdentifier(exp)) {
4625
+ if (t42.isIdentifier(exp)) {
4576
4626
  const sourceBinding = scope.getBinding(exp.name);
4577
4627
  if (!sourceBinding) return null;
4578
4628
  if (isEligibleBindingSource(sourceBinding)) {
@@ -4580,13 +4630,13 @@ function isExpressionSourcedFromEligibleBinding(exp, scope, seen, depth) {
4580
4630
  }
4581
4631
  return traceBindingSource(sourceBinding, seen, depth - 1);
4582
4632
  }
4583
- if (t41.isMemberExpression(exp) || t41.isOptionalMemberExpression(exp)) {
4633
+ if (t42.isMemberExpression(exp) || t42.isOptionalMemberExpression(exp)) {
4584
4634
  const root = findRootIdentifier(exp);
4585
4635
  if (!root) return null;
4586
4636
  const sourceBinding = scope.getBinding(root.name);
4587
4637
  if (!sourceBinding) return null;
4588
4638
  if (isEligibleBindingSource(sourceBinding)) {
4589
- return t41.cloneNode(exp);
4639
+ return t42.cloneNode(exp);
4590
4640
  }
4591
4641
  const sourcedRoot = traceBindingSource(sourceBinding, seen, depth - 1);
4592
4642
  if (sourcedRoot) {
@@ -4594,17 +4644,17 @@ function isExpressionSourcedFromEligibleBinding(exp, scope, seen, depth) {
4594
4644
  if (rebuilt) {
4595
4645
  return rebuilt;
4596
4646
  }
4597
- return t41.cloneNode(sourcedRoot, true);
4647
+ return t42.cloneNode(sourcedRoot, true);
4598
4648
  }
4599
4649
  }
4600
4650
  return null;
4601
4651
  }
4602
4652
  function rebuildMemberWithNewRoot(node, nextRoot) {
4603
4653
  const replacedObject = (() => {
4604
- if (t41.isIdentifier(node.object)) {
4605
- return t41.cloneNode(nextRoot, true);
4654
+ if (t42.isIdentifier(node.object)) {
4655
+ return t42.cloneNode(nextRoot, true);
4606
4656
  }
4607
- if (t41.isMemberExpression(node.object) || t41.isOptionalMemberExpression(node.object)) {
4657
+ if (t42.isMemberExpression(node.object) || t42.isOptionalMemberExpression(node.object)) {
4608
4658
  return rebuildMemberWithNewRoot(node.object, nextRoot);
4609
4659
  }
4610
4660
  return null;
@@ -4612,15 +4662,15 @@ function rebuildMemberWithNewRoot(node, nextRoot) {
4612
4662
  if (!replacedObject) {
4613
4663
  return null;
4614
4664
  }
4615
- const property = t41.cloneNode(node.property, true);
4616
- if (t41.isMemberExpression(node)) {
4617
- return t41.memberExpression(
4665
+ const property = t42.cloneNode(node.property, true);
4666
+ if (t42.isMemberExpression(node)) {
4667
+ return t42.memberExpression(
4618
4668
  replacedObject,
4619
4669
  property,
4620
4670
  node.computed
4621
4671
  );
4622
4672
  }
4623
- return t41.optionalMemberExpression(
4673
+ return t42.optionalMemberExpression(
4624
4674
  replacedObject,
4625
4675
  property,
4626
4676
  node.computed,
@@ -4631,9 +4681,9 @@ function rebuildMemberWithNewRoot(node, nextRoot) {
4631
4681
  // src/core/transform/sfc/script/shared/dependency-analyzer/index.ts
4632
4682
  function analyzeDeps(node, ctx, parentPath) {
4633
4683
  if (!parentPath) {
4634
- return t42.arrayExpression([]);
4684
+ return t43.arrayExpression([]);
4635
4685
  }
4636
- const isFnExpr = t42.isArrowFunctionExpression(node) || t42.isFunctionExpression(node);
4686
+ const isFnExpr = t43.isArrowFunctionExpression(node) || t43.isFunctionExpression(node);
4637
4687
  const analyzeTarget = isFnExpr ? node.body : node;
4638
4688
  const bindingLocalBoundary = isFnExpr ? node : analyzeTarget;
4639
4689
  const deps = /* @__PURE__ */ new Map();
@@ -4643,13 +4693,13 @@ function analyzeDeps(node, ctx, parentPath) {
4643
4693
  }
4644
4694
  const analyzeTargetPath = parentPath && parentPath.node === analyzeTarget ? parentPath : null;
4645
4695
  if (analyzeTargetPath) {
4646
- if (t42.isMemberExpression(analyzeTarget) || t42.isOptionalMemberExpression(analyzeTarget)) {
4696
+ if (t43.isMemberExpression(analyzeTarget) || t43.isOptionalMemberExpression(analyzeTarget)) {
4647
4697
  const rootId = findRootIdentifier(analyzeTarget);
4648
4698
  if (rootId) {
4649
4699
  tryAddDependency(analyzeTargetPath, rootId.name, analyzeTargetPath.scope);
4650
4700
  processedIdentifiers.add(rootId);
4651
4701
  }
4652
- } else if (t42.isIdentifier(analyzeTarget)) {
4702
+ } else if (t43.isIdentifier(analyzeTarget)) {
4653
4703
  tryAddDependency(analyzeTargetPath, analyzeTarget.name, analyzeTargetPath.scope);
4654
4704
  }
4655
4705
  }
@@ -4701,7 +4751,7 @@ function analyzeDeps(node, ctx, parentPath) {
4701
4751
  }
4702
4752
  }
4703
4753
  }
4704
- return t42.arrayExpression(Array.from(deps.values()));
4754
+ return t43.arrayExpression(Array.from(deps.values()));
4705
4755
  }
4706
4756
 
4707
4757
  // src/core/transform/sfc/script/syntax-processor/process/resolve-analysis-only-adapter.ts
@@ -4717,7 +4767,7 @@ function resolveAnalysisOnlyAdapter(ctx) {
4717
4767
  if (!isVueApiReference(path8, apiName)) {
4718
4768
  return;
4719
4769
  }
4720
- if (t43.isCallExpression(node)) {
4770
+ if (t44.isCallExpression(node)) {
4721
4771
  resolveCallNode(path8, adapter, ctx);
4722
4772
  } else {
4723
4773
  replaceIdName(node, adapter.target);
@@ -4727,11 +4777,11 @@ function resolveAnalysisOnlyAdapter(ctx) {
4727
4777
  };
4728
4778
  }
4729
4779
  function getApiName(node) {
4730
- const isCallNode = t43.isCallExpression(node);
4780
+ const isCallNode = t44.isCallExpression(node);
4731
4781
  let apiName = "";
4732
- if (t43.isIdentifier(node)) {
4782
+ if (t44.isIdentifier(node)) {
4733
4783
  apiName = node.name;
4734
- } else if (isCallNode && t43.isIdentifier(node.callee)) {
4784
+ } else if (isCallNode && t44.isIdentifier(node.callee)) {
4735
4785
  apiName = node.callee.name;
4736
4786
  }
4737
4787
  return apiName;
@@ -4741,7 +4791,7 @@ function resolveCallNode(path8, adapter, ctx) {
4741
4791
  const { arguments: args } = node;
4742
4792
  if (!args.length) return;
4743
4793
  const fn = args[0];
4744
- if (!t43.isArrowFunctionExpression(fn) && !t43.isFunctionExpression(fn)) {
4794
+ if (!t44.isArrowFunctionExpression(fn) && !t44.isFunctionExpression(fn)) {
4745
4795
  return;
4746
4796
  }
4747
4797
  const fnPath = path8.get("arguments")[0];
@@ -4773,7 +4823,7 @@ function isVueImportBinding(binding) {
4773
4823
  return false;
4774
4824
  }
4775
4825
  const parent = _optionalChain([bindingPath, 'access', _148 => _148.parentPath, 'optionalAccess', _149 => _149.node]);
4776
- if (!parent || !t43.isImportDeclaration(parent)) {
4826
+ if (!parent || !t44.isImportDeclaration(parent)) {
4777
4827
  return false;
4778
4828
  }
4779
4829
  const source = parent.source.value.toLowerCase();
@@ -4859,14 +4909,14 @@ function resolveElementRef(ctx) {
4859
4909
  }
4860
4910
  if (isCompRefBindings) {
4861
4911
  const varDeclaratorPath = _optionalChain([getVariableDeclaratorPath, 'call', _151 => _151(path8), 'optionalAccess', _152 => _152.node]);
4862
- if (!t44.isIdentifier(_optionalChain([varDeclaratorPath, 'optionalAccess', _153 => _153.id]))) {
4912
+ if (!t45.isIdentifier(_optionalChain([varDeclaratorPath, 'optionalAccess', _153 => _153.id]))) {
4863
4913
  return;
4864
4914
  }
4865
4915
  const varName = varDeclaratorPath.id.name;
4866
4916
  const compRef = refBindings.componentRefs[varName];
4867
4917
  if (!compRef) return;
4868
4918
  }
4869
- node.arguments[0] = t44.identifier("null");
4919
+ node.arguments[0] = t45.identifier("null");
4870
4920
  resolveTypeParameters(ctx, path8);
4871
4921
  replaceCallName(node, REACT_API_MAP.useRef);
4872
4922
  recordImport(ctx, PACKAGE_NAME.react, REACT_API_MAP.useRef);
@@ -4891,20 +4941,20 @@ function resolveTypeParameters(ctx, path8) {
4891
4941
  const compBindingMeta = refBindings.componentRefs[idName];
4892
4942
  if (!node.typeParameters && (domBindingMeta || compBindingMeta)) {
4893
4943
  const type = compBindingMeta ? "any" : domBindingMeta.htmlType;
4894
- node.typeParameters = t44.tsTypeParameterInstantiation([t44.tsTypeReference(t44.identifier(type))]);
4944
+ node.typeParameters = t45.tsTypeParameterInstantiation([t45.tsTypeReference(t45.identifier(type))]);
4895
4945
  }
4896
4946
  }
4897
4947
  function resolveRefValueToCurrent(path8) {
4898
4948
  const { node } = path8;
4899
- if (node.computed || !t44.isIdentifier(node.property) || node.property.name !== "value") {
4949
+ if (node.computed || !t45.isIdentifier(node.property) || node.property.name !== "value") {
4900
4950
  return;
4901
4951
  }
4902
4952
  const rootPath = findRootVariablePath(path8);
4903
- if (!_optionalChain([rootPath, 'optionalAccess', _156 => _156.node]) || !t44.isCallExpression(rootPath.node.init) || !isCalleeNamed(rootPath.node.init, REACT_API_MAP.useRef)) {
4953
+ if (!_optionalChain([rootPath, 'optionalAccess', _156 => _156.node]) || !t45.isCallExpression(rootPath.node.init) || !isCalleeNamed(rootPath.node.init, REACT_API_MAP.useRef)) {
4904
4954
  return;
4905
4955
  }
4906
4956
  const rootId = findRootIdentifier(node);
4907
- if (!t44.isIdentifier(node.object) || node.object.name !== _optionalChain([rootId, 'optionalAccess', _157 => _157.name])) {
4957
+ if (!t45.isIdentifier(node.object) || node.object.name !== _optionalChain([rootId, 'optionalAccess', _157 => _157.name])) {
4908
4958
  return;
4909
4959
  }
4910
4960
  node.property.name = "current";
@@ -4923,11 +4973,11 @@ function resolveExprMemo(ctx, ast) {
4923
4973
  if (!atComponentOrHookRoot(path8, ast.program, isScriptFile)) {
4924
4974
  return false;
4925
4975
  }
4926
- if (!t45.isVariableDeclaration(path8.parent) || path8.parent.kind !== "const") {
4976
+ if (!t46.isVariableDeclaration(path8.parent) || path8.parent.kind !== "const") {
4927
4977
  return false;
4928
4978
  }
4929
- if (t45.isFunction(init)) return false;
4930
- 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")) {
4931
4981
  return false;
4932
4982
  }
4933
4983
  return true;
@@ -4952,10 +5002,10 @@ function resolveLintRules(ctx, ast) {
4952
5002
  return {
4953
5003
  CallExpression(path8) {
4954
5004
  const { node, parentPath } = path8;
4955
- if (!t46.isIdentifier(node.callee)) return;
5005
+ if (!t47.isIdentifier(node.callee)) return;
4956
5006
  const { name: callName } = node.callee;
4957
- const addLog = (t52) => {
4958
- logger.error(t52, {
5007
+ const addLog = (t53) => {
5008
+ logger.error(t53, {
4959
5009
  file: ctx.filename,
4960
5010
  source: ctx.scriptData.source,
4961
5011
  loc: node.loc
@@ -5032,13 +5082,13 @@ function findOrCreateCtxProvider(root) {
5032
5082
  function assignProviderValue(target, key, value) {
5033
5083
  const getRawExp = (exp) => {
5034
5084
  if (!exp) return "''";
5035
- if (t47.isStringLiteral(exp)) {
5085
+ if (t48.isStringLiteral(exp)) {
5036
5086
  return JSON.stringify(exp.value);
5037
5087
  }
5038
- if (t47.isNumericLiteral(exp)) {
5088
+ if (t48.isNumericLiteral(exp)) {
5039
5089
  return exp.value.toString();
5040
5090
  }
5041
- if (t47.isIdentifier(exp)) {
5091
+ if (t48.isIdentifier(exp)) {
5042
5092
  return exp.name;
5043
5093
  }
5044
5094
  try {
@@ -5059,11 +5109,11 @@ function resolveRenameAdapter(ctx) {
5059
5109
  return {
5060
5110
  "CallExpression|Identifier"(path8) {
5061
5111
  const node = path8.node;
5062
- const isCallNode = t48.isCallExpression(node);
5112
+ const isCallNode = t49.isCallExpression(node);
5063
5113
  let apiName = "";
5064
- if (t48.isIdentifier(node)) {
5114
+ if (t49.isIdentifier(node)) {
5065
5115
  apiName = node.name;
5066
- } else if (isCallNode && t48.isIdentifier(node.callee)) {
5116
+ } else if (isCallNode && t49.isIdentifier(node.callee)) {
5067
5117
  apiName = node.callee.name;
5068
5118
  }
5069
5119
  if (!apiName) {
@@ -5125,7 +5175,7 @@ function isVueImportBinding2(binding) {
5125
5175
  return false;
5126
5176
  }
5127
5177
  const parent = _optionalChain([bindingPath, 'access', _163 => _163.parentPath, 'optionalAccess', _164 => _164.node]);
5128
- if (!parent || !t48.isImportDeclaration(parent)) {
5178
+ if (!parent || !t49.isImportDeclaration(parent)) {
5129
5179
  return false;
5130
5180
  }
5131
5181
  const source = parent.source.value.toLowerCase();
@@ -5169,7 +5219,12 @@ function processVueSyntax2(ast, ctx) {
5169
5219
  excludeBabel: [resolveTemplateSlotIface, resolveCompIProps]
5170
5220
  },
5171
5221
  postprocess: {
5172
- applyBabel: [resolveRuntimeImports, resolveASTChunks],
5222
+ applyBabel: [
5223
+ // 该 resolver 需确保放在所有类型处理之后,移除之前
5224
+ resolveVueTypeAsAny,
5225
+ resolveRuntimeImports,
5226
+ resolveASTChunks
5227
+ ],
5173
5228
  excludeBabel: [resolveSfcCssImport]
5174
5229
  }
5175
5230
  });
@@ -5268,7 +5323,7 @@ function isRouterLinkBooleanCustomProp(prop) {
5268
5323
 
5269
5324
 
5270
5325
  var strCodeTypes = {
5271
- isIdentifier: isIdentifier28,
5326
+ isIdentifier: isIdentifier29,
5272
5327
  isSimpleExpression,
5273
5328
  isStringLiteral: isStringLiteral13
5274
5329
  };
@@ -5279,30 +5334,30 @@ function isSimpleExpression(code, excludeVar = false) {
5279
5334
  } catch (e7) {
5280
5335
  return false;
5281
5336
  }
5282
- if (t49.isLiteral(node)) {
5337
+ if (t50.isLiteral(node)) {
5283
5338
  return true;
5284
5339
  }
5285
- if (!excludeVar && t49.isIdentifier(node)) {
5340
+ if (!excludeVar && t50.isIdentifier(node)) {
5286
5341
  return true;
5287
5342
  }
5288
- if (t49.isMemberExpression(node)) {
5289
- return isSimpleExpression(node.object) && t49.isIdentifier(node.property);
5343
+ if (t50.isMemberExpression(node)) {
5344
+ return isSimpleExpression(node.object) && t50.isIdentifier(node.property);
5290
5345
  }
5291
- if (t49.isObjectExpression(node) || t49.isArrayExpression(node)) {
5346
+ if (t50.isObjectExpression(node) || t50.isArrayExpression(node)) {
5292
5347
  return false;
5293
5348
  }
5294
- if (t49.isCallExpression(node) || t49.isAssignmentExpression(node)) {
5349
+ if (t50.isCallExpression(node) || t50.isAssignmentExpression(node)) {
5295
5350
  return false;
5296
5351
  }
5297
- if (t49.isBinaryExpression(node) || t49.isUnaryExpression(node)) {
5352
+ if (t50.isBinaryExpression(node) || t50.isUnaryExpression(node)) {
5298
5353
  return true;
5299
5354
  }
5300
5355
  return false;
5301
5356
  }
5302
- function isIdentifier28(code) {
5357
+ function isIdentifier29(code) {
5303
5358
  try {
5304
5359
  const node = _parser.parseExpression.call(void 0, code);
5305
- return t49.isIdentifier(node);
5360
+ return t50.isIdentifier(node);
5306
5361
  } catch (e8) {
5307
5362
  return false;
5308
5363
  }
@@ -5310,7 +5365,7 @@ function isIdentifier28(code) {
5310
5365
  function isStringLiteral13(code) {
5311
5366
  try {
5312
5367
  const node = _parser.parseExpression.call(void 0, code);
5313
- return t49.isStringLiteral(node);
5368
+ return t50.isStringLiteral(node);
5314
5369
  } catch (e9) {
5315
5370
  return false;
5316
5371
  }
@@ -5450,9 +5505,10 @@ function resolvePropAsBabelExp(ir, ctx) {
5450
5505
  const value = ir.value;
5451
5506
  const valueContent = value.content;
5452
5507
  const mergedItems = value.merge;
5508
+ const rule = ADAPTER_RULES.runtime;
5453
5509
  const setNameIdentifier = (target, valueName) => {
5454
5510
  target.content = valueName;
5455
- target.ast = t50.jsxIdentifier(valueName);
5511
+ target.ast = t51.jsxIdentifier(valueName);
5456
5512
  };
5457
5513
  const setValueExpression = (target, content, isStringLiteral14) => {
5458
5514
  target.content = content;
@@ -5460,38 +5516,41 @@ function resolvePropAsBabelExp(ir, ctx) {
5460
5516
  };
5461
5517
  const createRuntimeCall = (fnName, args) => {
5462
5518
  const fnArgs = args.filter(Boolean).join(",");
5463
- return `${fnName}(${fnArgs})`;
5519
+ const valIsUndef = fnName === rule.dirOn.target && _optionalChain([args, 'optionalAccess', _183 => _183[1]]) === "undefined";
5520
+ const isTs = ctx.scriptData.lang.startsWith("ts");
5521
+ const safeTypeAssertion = isTs ? valIsUndef ? "as never" : "" : "";
5522
+ return `${fnName}(${fnArgs}) ${safeTypeAssertion}`;
5464
5523
  };
5465
5524
  const applyRuntimeExpression = (expression, setName = false, nameIdentifier, isStringLiteral14) => {
5466
5525
  if (setName && nameIdentifier) {
5467
5526
  setNameIdentifier(nameExp, nameIdentifier);
5468
5527
  }
5469
- const dir = ADAPTER_RULES.runtime.dir;
5528
+ const dir = rule.dir;
5470
5529
  recordImport(ctx, dir.package, dir.target);
5471
5530
  setValueExpression(value.babelExp, expression, isStringLiteral14);
5472
5531
  };
5473
5532
  if (ir.isKeyLessVBind) {
5474
- const dirKeyless = ADAPTER_RULES.runtime.dirKeyless;
5533
+ const dirKeyless = rule.dirKeyless;
5475
5534
  const expression = createRuntimeCall(dirKeyless.target, [valueContent]);
5476
5535
  applyRuntimeExpression(expression, false);
5477
5536
  return;
5478
5537
  }
5479
5538
  if (isClassAttr(name) && !value.isStringLiteral && !valueContent.startsWith(STYLE_MODULE_NAME)) {
5480
- const dirCls = ADAPTER_RULES.runtime.dirCls;
5481
- const arg = _optionalChain([mergedItems, 'optionalAccess', _183 => _183.join, 'call', _184 => _184(",")]) || wrapSingleQuotes(valueContent);
5539
+ const dirCls = rule.dirCls;
5540
+ const arg = _optionalChain([mergedItems, 'optionalAccess', _184 => _184.join, 'call', _185 => _185(",")]) || wrapSingleQuotes(valueContent);
5482
5541
  const expression = createRuntimeCall(dirCls.target, [arg]);
5483
5542
  applyRuntimeExpression(expression, true, name);
5484
5543
  return;
5485
5544
  }
5486
- if (isStyleAttr(name) && (!isSimpleStyle(valueContent) || _optionalChain([mergedItems, 'optionalAccess', _185 => _185.some, 'call', _186 => _186((item) => !isSimpleStyle(item))]))) {
5487
- const dirStyle = ADAPTER_RULES.runtime.dirStyle;
5488
- const arg = _optionalChain([mergedItems, 'optionalAccess', _187 => _187.join, 'call', _188 => _188(",")]) || valueContent;
5545
+ if (isStyleAttr(name) && (!isSimpleStyle(valueContent) || _optionalChain([mergedItems, 'optionalAccess', _186 => _186.some, 'call', _187 => _187((item) => !isSimpleStyle(item))]))) {
5546
+ const dirStyle = rule.dirStyle;
5547
+ const arg = _optionalChain([mergedItems, 'optionalAccess', _188 => _188.join, 'call', _189 => _189(",")]) || valueContent;
5489
5548
  const expression = createRuntimeCall(dirStyle.target, [arg]);
5490
5549
  applyRuntimeExpression(expression, true, name);
5491
5550
  return;
5492
5551
  }
5493
- if (ir.type === 3 /* EVENT */ && _optionalChain([ir, 'access', _189 => _189.modifiers, 'optionalAccess', _190 => _190.length])) {
5494
- const dirOn = ADAPTER_RULES.runtime.dirOn;
5552
+ if (ir.type === 3 /* EVENT */ && _optionalChain([ir, 'access', _190 => _190.modifiers, 'optionalAccess', _191 => _191.length])) {
5553
+ const dirOn = rule.dirOn;
5495
5554
  const eventName = wrapSingleQuotes(ir.__vOnEvName || name, ir.isStatic);
5496
5555
  const expression = createRuntimeCall(dirOn.target, [eventName, valueContent]);
5497
5556
  applyRuntimeExpression(expression, true, name);
@@ -5545,7 +5604,7 @@ function resolveElementChildrenRules(children, ctx, parentIR, ir) {
5545
5604
  continue;
5546
5605
  }
5547
5606
  const nodeIR = child;
5548
- if (_optionalChain([parentIR, 'optionalAccess', _191 => _191.isBuiltIn])) {
5607
+ if (_optionalChain([parentIR, 'optionalAccess', _192 => _192.isBuiltIn])) {
5549
5608
  if (parentIR.tag == VUE_API_MAP.Transition) {
5550
5609
  resolveTransitionRules(nodeIR, parentIR, ir, ctx);
5551
5610
  }
@@ -5586,7 +5645,7 @@ function walkElementNodes(node, onElement) {
5586
5645
  }
5587
5646
  function resolveDefaultStyleModuleName(node) {
5588
5647
  const { exp } = node;
5589
- if (_optionalChain([exp, 'optionalAccess', _192 => _192.type]) !== _compilercore.NodeTypes.SIMPLE_EXPRESSION) {
5648
+ if (_optionalChain([exp, 'optionalAccess', _193 => _193.type]) !== _compilercore.NodeTypes.SIMPLE_EXPRESSION) {
5590
5649
  return;
5591
5650
  }
5592
5651
  if (exp.content.includes("$style")) {
@@ -5682,7 +5741,7 @@ function mergeStyleProps(oldAttr, newAttr) {
5682
5741
  const oldStyle = oldAttr.value.content;
5683
5742
  const newStyle = parseStyleString(newAttr.value.content);
5684
5743
  let merged = oldAttr.value.merge;
5685
- if (!_optionalChain([merged, 'optionalAccess', _193 => _193.length])) {
5744
+ if (!_optionalChain([merged, 'optionalAccess', _194 => _194.length])) {
5686
5745
  merged = oldAttr.value.merge = [oldStyle, newStyle];
5687
5746
  } else {
5688
5747
  merged.push(newStyle);
@@ -5712,7 +5771,7 @@ function warnUnsupportedVueDollarVar(ctx, node) {
5712
5771
  const { source, filename } = ctx;
5713
5772
  let value = "";
5714
5773
  let loc;
5715
- if (node.type === _compilercore.NodeTypes.DIRECTIVE && _optionalChain([node, 'access', _194 => _194.exp, 'optionalAccess', _195 => _195.type]) === _compilercore.NodeTypes.SIMPLE_EXPRESSION) {
5774
+ if (node.type === _compilercore.NodeTypes.DIRECTIVE && _optionalChain([node, 'access', _195 => _195.exp, 'optionalAccess', _196 => _196.type]) === _compilercore.NodeTypes.SIMPLE_EXPRESSION) {
5716
5775
  value = node.exp.content;
5717
5776
  loc = node.exp.loc;
5718
5777
  } else if (node.type === _compilercore.NodeTypes.INTERPOLATION && node.content.type === _compilercore.NodeTypes.SIMPLE_EXPRESSION) {
@@ -5766,11 +5825,11 @@ function resolveRefProp(prop, ctx, nodeIR) {
5766
5825
  } = ctx;
5767
5826
  let propIR;
5768
5827
  if (prop.type === _compilercore.NodeTypes.ATTRIBUTE) {
5769
- const tag = _optionalChain([prop, 'access', _196 => _196.value, 'optionalAccess', _197 => _197.content]);
5828
+ const tag = _optionalChain([prop, 'access', _197 => _197.value, 'optionalAccess', _198 => _198.content]);
5770
5829
  if (!tag) return;
5771
5830
  collectComponentRef(tag, ctx);
5772
5831
  const domRefBinding = Object.values(refBindings.domRefs).find((r) => r.tag === tag);
5773
- const refVar = _optionalChain([domRefBinding, 'optionalAccess', _198 => _198.name]) || _optionalChain([refBindings, 'access', _199 => _199.componentRefs, 'access', _200 => _200[tag], 'optionalAccess', _201 => _201.name]);
5832
+ const refVar = _optionalChain([domRefBinding, 'optionalAccess', _199 => _199.name]) || _optionalChain([refBindings, 'access', _200 => _200.componentRefs, 'access', _201 => _201[tag], 'optionalAccess', _202 => _202.name]);
5774
5833
  propIR = createPropsIR("ref", "ref", refVar || "null");
5775
5834
  } else {
5776
5835
  const exp = prop.exp;
@@ -5822,7 +5881,7 @@ function resolveTemplateNodeKey(templNode, keyContent, ctx) {
5822
5881
  return;
5823
5882
  }
5824
5883
  const [firstChild] = children;
5825
- if (_optionalChain([firstChild, 'optionalAccess', _202 => _202.type]) !== _compilercore.NodeTypes.ELEMENT || firstChild.tagType === _compilercore.ElementTypes.TEMPLATE || firstChild.tagType === _compilercore.ElementTypes.SLOT) {
5884
+ if (_optionalChain([firstChild, 'optionalAccess', _203 => _203.type]) !== _compilercore.NodeTypes.ELEMENT || firstChild.tagType === _compilercore.ElementTypes.TEMPLATE || firstChild.tagType === _compilercore.ElementTypes.SLOT) {
5826
5885
  return;
5827
5886
  }
5828
5887
  const hasKeyProp = firstChild.props.some(
@@ -5859,8 +5918,8 @@ function createSimpleVueBind(name, value) {
5859
5918
  function resolveDynamicAttributeProp(directive, ir, ctx, vueNode, nodeIR) {
5860
5919
  const arg = directive.arg;
5861
5920
  const exp = directive.exp;
5862
- const name = _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _203 => _203.content]), () => ( ""));
5863
- const content = _nullishCoalesce(_optionalChain([exp, 'optionalAccess', _204 => _204.content]), () => ( "true"));
5921
+ const name = _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _204 => _204.content]), () => ( ""));
5922
+ const content = _nullishCoalesce(_optionalChain([exp, 'optionalAccess', _205 => _205.content]), () => ( "true"));
5864
5923
  warnUnsupportedVueDollarVar(ctx, directive);
5865
5924
  if (name === "is") {
5866
5925
  resolveDynamicIsProp(directive, ir, ctx, nodeIR);
@@ -5875,7 +5934,7 @@ function resolveDynamicAttributeProp(directive, ir, ctx, vueNode, nodeIR) {
5875
5934
  return;
5876
5935
  }
5877
5936
  const propIR = createPropsIR(directive.rawName, name, content);
5878
- propIR.isStatic = _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _205 => _205.isStatic]), () => ( true));
5937
+ propIR.isStatic = _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _206 => _206.isStatic]), () => ( true));
5879
5938
  checkPropIsDynamicKey(ctx, directive);
5880
5939
  resolvePropertyIR(propIR, ir, ctx, nodeIR, true);
5881
5940
  }
@@ -5914,7 +5973,7 @@ function normalizeString(s) {
5914
5973
  // src/core/transform/sfc/template/syntax-processor/process/props/resolve-attribute-prop.ts
5915
5974
  function resolveAttributeProp(attribute, ir, ctx, nodeIR) {
5916
5975
  const name = attribute.name;
5917
- const content = _nullishCoalesce(_optionalChain([attribute, 'access', _206 => _206.value, 'optionalAccess', _207 => _207.content]), () => ( "true"));
5976
+ const content = _nullishCoalesce(_optionalChain([attribute, 'access', _207 => _207.value, 'optionalAccess', _208 => _208.content]), () => ( "true"));
5918
5977
  if (name === "is") {
5919
5978
  resolveStaticIsProp(content, ir, ctx, nodeIR);
5920
5979
  return;
@@ -6009,10 +6068,10 @@ function resolveRouterLinkVSlotProp(directive, nodeIR, ctx) {
6009
6068
  type: 2 /* SLOT */,
6010
6069
  name: "customRender",
6011
6070
  rawName: _nullishCoalesce(directive.rawName, () => ( "v-slot")),
6012
- isStatic: _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _208 => _208.isStatic]), () => ( true)),
6071
+ isStatic: _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _209 => _209.isStatic]), () => ( true)),
6013
6072
  isScoped: true,
6014
6073
  callback: {
6015
- arg: _nullishCoalesce(_optionalChain([exp, 'optionalAccess', _209 => _209.content, 'optionalAccess', _210 => _210.trim, 'call', _211 => _211()]), () => ( "")),
6074
+ arg: _nullishCoalesce(_optionalChain([exp, 'optionalAccess', _210 => _210.content, 'optionalAccess', _211 => _211.trim, 'call', _212 => _212()]), () => ( "")),
6016
6075
  exp: []
6017
6076
  }
6018
6077
  };
@@ -6028,10 +6087,10 @@ function resolveVFor(directive, ir, ctx, nodeIR) {
6028
6087
  };
6029
6088
  }
6030
6089
  function resolveForResult(forParseResult) {
6031
- const source = _optionalChain([forParseResult, 'access', _212 => _212.source, 'optionalAccess', _213 => _213.content]);
6032
- const value = _optionalChain([forParseResult, 'access', _214 => _214.value, 'optionalAccess', _215 => _215.content]);
6033
- const index = _optionalChain([forParseResult, 'access', _216 => _216.index, 'optionalAccess', _217 => _217.content]);
6034
- const key = _optionalChain([forParseResult, 'access', _218 => _218.key, 'optionalAccess', _219 => _219.content]);
6090
+ const source = _optionalChain([forParseResult, 'access', _213 => _213.source, 'optionalAccess', _214 => _214.content]);
6091
+ const value = _optionalChain([forParseResult, 'access', _215 => _215.value, 'optionalAccess', _216 => _216.content]);
6092
+ const index = _optionalChain([forParseResult, 'access', _217 => _217.index, 'optionalAccess', _218 => _218.content]);
6093
+ const key = _optionalChain([forParseResult, 'access', _219 => _219.key, 'optionalAccess', _220 => _220.content]);
6035
6094
  return {
6036
6095
  source,
6037
6096
  value,
@@ -6051,7 +6110,7 @@ function resolveVHtml(directive, ir, ctx, nodeIR) {
6051
6110
  // src/core/transform/sfc/template/syntax-processor/process/props/resolve-v-if.ts
6052
6111
  function resolveVIf(directive, ir, ctx, nodeIR, siblingNodesIR) {
6053
6112
  const name = directive.name === "else-if" ? "elseIf" : directive.name;
6054
- const value = _nullishCoalesce(_optionalChain([directive, 'access', _220 => _220.exp, 'optionalAccess', _221 => _221.content]), () => ( "true"));
6113
+ const value = _nullishCoalesce(_optionalChain([directive, 'access', _221 => _221.exp, 'optionalAccess', _222 => _222.content]), () => ( "true"));
6055
6114
  const prevNode = siblingNodesIR[siblingNodesIR.length - 1];
6056
6115
  const isElseBranch = name === "else" || name === "elseIf";
6057
6116
  let hasError = false;
@@ -6090,7 +6149,7 @@ function resolveVIf(directive, ir, ctx, nodeIR, siblingNodesIR) {
6090
6149
  // src/core/transform/sfc/template/syntax-processor/process/props/resolve-v-memo.ts
6091
6150
  function resolveVMemo(directive, _ir, ctx, nodeIR) {
6092
6151
  const exp = directive.exp;
6093
- let value = _optionalChain([exp, 'optionalAccess', _222 => _222.content]);
6152
+ let value = _optionalChain([exp, 'optionalAccess', _223 => _223.content]);
6094
6153
  if (value !== void 0) {
6095
6154
  if (!value.trim() || !value.startsWith("[") && !value.endsWith("]")) {
6096
6155
  const { source, filename } = ctx;
@@ -6130,14 +6189,14 @@ function resolveVModel(directive, ir, ctx, vueNode, nodeIR) {
6130
6189
  const getterName = exp.content;
6131
6190
  const isComponent = vueNode.tagType === _compilercore.ElementTypes.COMPONENT;
6132
6191
  const inputType = resolveHtmlInput(vueNode, isComponent);
6133
- const propName = _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _223 => _223.content]), () => ( resolveModelPropName(inputType, isComponent)));
6192
+ const propName = _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _224 => _224.content]), () => ( resolveModelPropName(inputType, isComponent)));
6134
6193
  let valuePropIR;
6135
6194
  let eventPropIR;
6136
6195
  if (isComponent) {
6137
6196
  valuePropIR = createPropsIR("v-model", propName, getterName);
6138
6197
  const eventReactName = `onUpdate${capitalize(camelCase(propName))}`;
6139
6198
  const eventVueName = `update:${propName}`;
6140
- const isTS = _optionalChain([ctx, 'access', _224 => _224.scriptData, 'optionalAccess', _225 => _225.lang, 'optionalAccess', _226 => _226.startsWith, 'call', _227 => _227("ts")]);
6199
+ const isTS = _optionalChain([ctx, 'access', _225 => _225.scriptData, 'optionalAccess', _226 => _226.lang, 'optionalAccess', _227 => _227.startsWith, 'call', _228 => _228("ts")]);
6141
6200
  const valueArg = isTS ? "value: any" : "value";
6142
6201
  const processedValue = applyValueModifiers("value", modifiers);
6143
6202
  const handlerBody = `(${valueArg}) => { ${getterName} = ${processedValue} }`;
@@ -6175,7 +6234,7 @@ function getRadioValue(vueNode) {
6175
6234
  const valueAttr = vueNode.props.find(
6176
6235
  (prop) => prop.type === _compilercore.NodeTypes.ATTRIBUTE && prop.name === "value"
6177
6236
  );
6178
- if (!_optionalChain([valueAttr, 'optionalAccess', _228 => _228.value, 'optionalAccess', _229 => _229.content])) return '""';
6237
+ if (!_optionalChain([valueAttr, 'optionalAccess', _229 => _229.value, 'optionalAccess', _230 => _230.content])) return '""';
6179
6238
  const content = valueAttr.value.content;
6180
6239
  return /^['"]/.test(content) ? content : `"${content}"`;
6181
6240
  }
@@ -6185,7 +6244,7 @@ function resolveHtmlInput(node, isComponent) {
6185
6244
  const typeProp = node.props.find(
6186
6245
  (prop) => prop.type === _compilercore.NodeTypes.ATTRIBUTE && prop.name === "type"
6187
6246
  );
6188
- return _optionalChain([typeProp, 'optionalAccess', _230 => _230.value, 'optionalAccess', _231 => _231.content, 'optionalAccess', _232 => _232.toLowerCase, 'call', _233 => _233()]);
6247
+ return _optionalChain([typeProp, 'optionalAccess', _231 => _231.value, 'optionalAccess', _232 => _232.content, 'optionalAccess', _233 => _233.toLowerCase, 'call', _234 => _234()]);
6189
6248
  }
6190
6249
  function applyValueModifiers(valueExp, modifiers) {
6191
6250
  let result = valueExp;
@@ -6206,7 +6265,8 @@ function resolveVOn(directive, ir, ctx, nodeIR) {
6206
6265
  const modifiers = directive.modifiers.map((item) => item.content);
6207
6266
  const captureIndex = resolveCaptureModifier(modifiers);
6208
6267
  const eventName = resolveEventName(arg.content, captureIndex);
6209
- const handler = resolveHandler(exp.content.trim(), ctx, modifiers);
6268
+ const handlerContent = _optionalChain([exp, 'optionalAccess', _235 => _235.content, 'optionalAccess', _236 => _236.trim, 'call', _237 => _237()]) || "undefined";
6269
+ const handler = resolveHandler(handlerContent, ctx, modifiers);
6210
6270
  const originalVueEventName = modifiers.length ? `${arg.content}.${modifiers.join(".")}` : "";
6211
6271
  const eventIR = createPropsIR(directive.rawName, eventName, handler);
6212
6272
  eventIR.type = 3 /* EVENT */;
@@ -6256,10 +6316,10 @@ function resolveHandler(handlerContent, ctx, modifiers) {
6256
6316
  return handler;
6257
6317
  }
6258
6318
  function isConsoleCall(expr) {
6259
- 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";
6260
6320
  }
6261
6321
  function isFnReference(expr) {
6262
- return t51.isIdentifier(expr) || t51.isMemberExpression(expr) || t51.isFunction(expr);
6322
+ return t52.isIdentifier(expr) || t52.isMemberExpression(expr) || t52.isFunction(expr);
6263
6323
  }
6264
6324
 
6265
6325
  // src/core/transform/sfc/template/syntax-processor/process/props/resolve-v-show.ts
@@ -6292,7 +6352,7 @@ function resolveVSlotProp(directive, ir, ctx) {
6292
6352
  const name = !arg || arg.content === "default" ? "children" : arg.content;
6293
6353
  const content = !isScoped ? [] : void 0;
6294
6354
  const callback = isScoped ? {
6295
- arg: _nullishCoalesce(_optionalChain([exp, 'optionalAccess', _234 => _234.content, 'optionalAccess', _235 => _235.trim, 'call', _236 => _236()]), () => ( "")),
6355
+ arg: _nullishCoalesce(_optionalChain([exp, 'optionalAccess', _238 => _238.content, 'optionalAccess', _239 => _239.trim, 'call', _240 => _240()]), () => ( "")),
6296
6356
  exp: []
6297
6357
  } : void 0;
6298
6358
  checkPropIsDynamicKey(ctx, directive);
@@ -6300,7 +6360,7 @@ function resolveVSlotProp(directive, ir, ctx) {
6300
6360
  type: 2 /* SLOT */,
6301
6361
  name,
6302
6362
  rawName: _nullishCoalesce(directive.rawName, () => ( "default")),
6303
- isStatic: _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _237 => _237.isStatic]), () => ( true)),
6363
+ isStatic: _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _241 => _241.isStatic]), () => ( true)),
6304
6364
  isScoped,
6305
6365
  content,
6306
6366
  callback
@@ -6363,7 +6423,7 @@ function resolveElementNode(node, ir, ctx, siblingNodesIR) {
6363
6423
  if (routerAdapter) {
6364
6424
  if (!ctx.route) ctx.route = true;
6365
6425
  nodeIR.isRoute = true;
6366
- recordImport(ctx, _optionalChain([routerAdapter, 'optionalAccess', _238 => _238.package]), routerAdapter.target);
6426
+ recordImport(ctx, _optionalChain([routerAdapter, 'optionalAccess', _242 => _242.package]), routerAdapter.target);
6367
6427
  }
6368
6428
  resolveProps(node, ir, ctx, nodeIR, siblingNodesIR);
6369
6429
  return nodeIR;
@@ -6491,11 +6551,8 @@ function resolveSlotOutletNode(node, nodeIR, ctx, parentIR, childrenIR) {
6491
6551
  function resolveSlotProps(node, ctx) {
6492
6552
  const result = {
6493
6553
  name: "children",
6494
- // 默认插槽名为'children'
6495
6554
  isScope: false,
6496
- // 默认非作用域插槽
6497
6555
  props: []
6498
- // 作用域参数列表
6499
6556
  };
6500
6557
  const { source, filename } = ctx;
6501
6558
  const addSlotProp = (key, value) => {
@@ -6510,7 +6567,7 @@ function resolveSlotProps(node, ctx) {
6510
6567
  for (const prop of node.props) {
6511
6568
  if (prop.type === _compilercore.NodeTypes.ATTRIBUTE) {
6512
6569
  const attr = prop.name;
6513
- const value = _optionalChain([prop, 'access', _239 => _239.value, 'optionalAccess', _240 => _240.content, 'access', _241 => _241.trim, 'call', _242 => _242()]);
6570
+ const value = _optionalChain([prop, 'access', _243 => _243.value, 'optionalAccess', _244 => _244.content, 'access', _245 => _245.trim, 'call', _246 => _246()]);
6514
6571
  if (attr === "name" && value) {
6515
6572
  result.name = camelCase(value);
6516
6573
  } else {
@@ -6519,9 +6576,12 @@ function resolveSlotProps(node, ctx) {
6519
6576
  continue;
6520
6577
  }
6521
6578
  if (prop.type === _compilercore.NodeTypes.DIRECTIVE) {
6579
+ warnUnsupportedVueDollarVar(ctx, prop);
6580
+ if (!prop.arg) {
6581
+ continue;
6582
+ }
6522
6583
  const arg = prop.arg;
6523
6584
  const exp = prop.exp;
6524
- warnUnsupportedVueDollarVar(ctx, prop);
6525
6585
  if (!arg.isStatic) {
6526
6586
  logger.warn("Avoid using dynamic slot names, as they may lead to unexpected behavior.", {
6527
6587
  source,
@@ -6530,7 +6590,7 @@ function resolveSlotProps(node, ctx) {
6530
6590
  });
6531
6591
  }
6532
6592
  const key = arg.content;
6533
- const value = exp.content.trim();
6593
+ const value = _optionalChain([exp, 'optionalAccess', _247 => _247.content, 'optionalAccess', _248 => _248.trim, 'call', _249 => _249()]) || "undefined";
6534
6594
  if (key === "name") {
6535
6595
  result.name = camelCase(value);
6536
6596
  } else {
@@ -6600,19 +6660,19 @@ function resolveTemplate2(root, ctx) {
6600
6660
  // src/core/transform/sfc/index.ts
6601
6661
  function transform(ast, ctx, options) {
6602
6662
  const { template, script, style } = ast;
6603
- const templateIR = resolveTemplate2(_optionalChain([template, 'optionalAccess', _243 => _243.ast]), ctx);
6604
- const scriptIR = resolveScript2(_optionalChain([script, 'optionalAccess', _244 => _244.ast]), ctx);
6663
+ const templateIR = resolveTemplate2(_optionalChain([template, 'optionalAccess', _250 => _250.ast]), ctx);
6664
+ const scriptIR = resolveScript2(_optionalChain([script, 'optionalAccess', _251 => _251.ast]), ctx);
6605
6665
  const result = {
6606
6666
  template: templateIR,
6607
6667
  script: scriptIR,
6608
- style: _optionalChain([style, 'optionalAccess', _245 => _245.source, 'optionalAccess', _246 => _246.content])
6668
+ style: _optionalChain([style, 'optionalAccess', _252 => _252.source, 'optionalAccess', _253 => _253.content])
6609
6669
  };
6610
- executePlugins(_optionalChain([options, 'optionalAccess', _247 => _247.plugins]), result, ctx);
6670
+ executePlugins(_optionalChain([options, 'optionalAccess', _254 => _254.plugins]), result, ctx);
6611
6671
  return result;
6612
6672
  }
6613
6673
 
6614
6674
  // package.json
6615
- var version = "1.8.1";
6675
+ var version = "1.8.4";
6616
6676
  var bin = {
6617
6677
  vureact: "bin/vureact.js"
6618
6678
  };
@@ -6797,7 +6857,7 @@ var Helper = (_class5 = class {
6797
6857
  __init8() {this.outDir = "react-app"}
6798
6858
  constructor(opts) {;_class5.prototype.__init7.call(this);_class5.prototype.__init8.call(this);
6799
6859
  this.compilerOpts = opts;
6800
- if (_optionalChain([opts, 'access', _248 => _248.output, 'optionalAccess', _249 => _249.workspace])) {
6860
+ if (_optionalChain([opts, 'access', _255 => _255.output, 'optionalAccess', _256 => _256.workspace])) {
6801
6861
  this.workspaceDir = opts.output.workspace;
6802
6862
  }
6803
6863
  const excludePatterns = PathFilter.withDefaults(opts.exclude || []);
@@ -6827,7 +6887,7 @@ var Helper = (_class5 = class {
6827
6887
  }
6828
6888
  getOutDirName() {
6829
6889
  const { output } = this.compilerOpts;
6830
- return _optionalChain([output, 'optionalAccess', _250 => _250.outDir]) || this.outDir;
6890
+ return _optionalChain([output, 'optionalAccess', _257 => _257.outDir]) || this.outDir;
6831
6891
  }
6832
6892
  getWorkspaceDir() {
6833
6893
  return _path2.default.resolve(this.getProjectRoot(), this.workspaceDir);
@@ -6841,7 +6901,7 @@ var Helper = (_class5 = class {
6841
6901
  }
6842
6902
  getIgnoreAssets() {
6843
6903
  const { output } = this.compilerOpts;
6844
- if (_optionalChain([output, 'optionalAccess', _251 => _251.ignoreAssets])) {
6904
+ if (_optionalChain([output, 'optionalAccess', _258 => _258.ignoreAssets])) {
6845
6905
  return new Set(output.ignoreAssets.map(normalizePath));
6846
6906
  }
6847
6907
  return /* @__PURE__ */ new Set([
@@ -6931,12 +6991,12 @@ var Helper = (_class5 = class {
6931
6991
  */
6932
6992
  async formatCode({ code, fileInfo }) {
6933
6993
  const { format } = this.compilerOpts;
6934
- if (!_optionalChain([format, 'optionalAccess', _252 => _252.enabled])) return code;
6935
- if (_optionalChain([format, 'optionalAccess', _253 => _253.formatter]) === "builtin") {
6994
+ if (!_optionalChain([format, 'optionalAccess', _259 => _259.enabled])) return code;
6995
+ if (_optionalChain([format, 'optionalAccess', _260 => _260.formatter]) === "builtin") {
6936
6996
  return simpleFormat(code);
6937
6997
  }
6938
- const { lang } = _nullishCoalesce(_optionalChain([fileInfo, 'optionalAccess', _254 => _254.jsx]), () => ( _optionalChain([fileInfo, 'optionalAccess', _255 => _255.script])));
6939
- return await formatWithPrettier(code, lang, _optionalChain([format, 'optionalAccess', _256 => _256.prettierOptions]));
6998
+ const { lang } = _nullishCoalesce(_optionalChain([fileInfo, 'optionalAccess', _261 => _261.jsx]), () => ( _optionalChain([fileInfo, 'optionalAccess', _262 => _262.script])));
6999
+ return await formatWithPrettier(code, lang, _optionalChain([format, 'optionalAccess', _263 => _263.prettierOptions]));
6940
7000
  }
6941
7001
  /**
6942
7002
  * 通用的缓存校验工具函数
@@ -6970,7 +7030,7 @@ var Helper = (_class5 = class {
6970
7030
  * @param options.lock - 是否启用文件锁(默认false)
6971
7031
  */
6972
7032
  async writeFileWithDir(filePath, content, options) {
6973
- if (_optionalChain([options, 'optionalAccess', _257 => _257.lock])) {
7033
+ if (_optionalChain([options, 'optionalAccess', _264 => _264.lock])) {
6974
7034
  await fileLock.updateFile(filePath, async () => content, options);
6975
7035
  } else {
6976
7036
  await _fs2.default.promises.mkdir(_path2.default.dirname(filePath), { recursive: true });
@@ -7015,7 +7075,7 @@ var Helper = (_class5 = class {
7015
7075
  * 获取需要排除编译的文件
7016
7076
  */
7017
7077
  getExcludes() {
7018
- if (!_optionalChain([this, 'access', _258 => _258.compilerOpts, 'access', _259 => _259.exclude, 'optionalAccess', _260 => _260.length])) {
7078
+ if (!_optionalChain([this, 'access', _265 => _265.compilerOpts, 'access', _266 => _266.exclude, 'optionalAccess', _267 => _267.length])) {
7019
7079
  return PathFilter.withDefaults();
7020
7080
  }
7021
7081
  return this.compilerOpts.exclude;
@@ -7036,13 +7096,6 @@ var Helper = (_class5 = class {
7036
7096
  }
7037
7097
  logger.clear();
7038
7098
  }
7039
- printCompileInfo(file, duration) {
7040
- this.print(
7041
- _kleur2.default.green("Compiled"),
7042
- _kleur2.default.dim(normalizePath(this.relativePath(file))),
7043
- _kleur2.default.gray(`(${duration})`)
7044
- );
7045
- }
7046
7099
  print(...message) {
7047
7100
  if (this.compilerOpts.watch) {
7048
7101
  const time = (/* @__PURE__ */ new Date()).toLocaleTimeString();
@@ -7113,7 +7166,7 @@ function parseOnlyStyle(source, ctx, options) {
7113
7166
  ast: void 0
7114
7167
  }
7115
7168
  };
7116
- executePlugins(_optionalChain([options, 'optionalAccess', _261 => _261.plugins]), result, ctx);
7169
+ executePlugins(_optionalChain([options, 'optionalAccess', _268 => _268.plugins]), result, ctx);
7117
7170
  return result;
7118
7171
  }
7119
7172
 
@@ -7247,16 +7300,16 @@ var BaseCompiler = (_class7 = class extends Helper {
7247
7300
  });
7248
7301
  const genOptions = this.prepareGenerateOptions(filename);
7249
7302
  const resolveSFCAndScriptFile = () => {
7250
- const ast = parse(source, ctx.data, { plugins: _optionalChain([plugins, 'optionalAccess', _262 => _262.parser]) });
7251
- const ir = transform(ast, ctx.data, { plugins: _optionalChain([plugins, 'optionalAccess', _263 => _263.transformer]) });
7303
+ const ast = parse(source, ctx.data, { plugins: _optionalChain([plugins, 'optionalAccess', _269 => _269.parser]) });
7304
+ const ir = transform(ast, ctx.data, { plugins: _optionalChain([plugins, 'optionalAccess', _270 => _270.transformer]) });
7252
7305
  const gen = generate(ir, ctx.data, {
7253
7306
  ...genOptions,
7254
- plugins: _optionalChain([plugins, 'optionalAccess', _264 => _264.codegen])
7307
+ plugins: _optionalChain([plugins, 'optionalAccess', _271 => _271.codegen])
7255
7308
  });
7256
7309
  return this.resolveMainResult(ir, gen, ctx.data);
7257
7310
  };
7258
7311
  const resolveStyleFile = () => {
7259
- const result = parseOnlyStyle(source, ctx.data, { plugins: _optionalChain([plugins, 'optionalAccess', _265 => _265.parser]) });
7312
+ const result = parseOnlyStyle(source, ctx.data, { plugins: _optionalChain([plugins, 'optionalAccess', _272 => _272.parser]) });
7260
7313
  return this.resolveStyleResult(result, ctx.data);
7261
7314
  };
7262
7315
  try {
@@ -7295,9 +7348,9 @@ var BaseCompiler = (_class7 = class extends Helper {
7295
7348
  lang
7296
7349
  },
7297
7350
  css: {
7298
- file: _optionalChain([styleData, 'optionalAccess', _266 => _266.filePath]),
7299
- hash: _optionalChain([styleData, 'optionalAccess', _267 => _267.scopeId]),
7300
- code: _optionalChain([ir, 'optionalAccess', _268 => _268.style])
7351
+ file: _optionalChain([styleData, 'optionalAccess', _273 => _273.filePath]),
7352
+ hash: _optionalChain([styleData, 'optionalAccess', _274 => _274.scopeId]),
7353
+ code: _optionalChain([ir, 'optionalAccess', _275 => _275.style])
7301
7354
  }
7302
7355
  },
7303
7356
  ...base
@@ -7447,12 +7500,12 @@ var CacheManager = (_class9 = class {
7447
7500
  const meta = { ...unit };
7448
7501
  delete meta.source;
7449
7502
  if (key === "sfc" /* SFC */) {
7450
- _optionalChainDelete([meta, 'access', _269 => _269.output, 'optionalAccess', _270 => _270.jsx, 'access', _271 => delete _271.code]);
7451
- _optionalChainDelete([meta, 'access', _272 => _272.output, 'optionalAccess', _273 => _273.css, 'access', _274 => delete _274.code]);
7503
+ _optionalChainDelete([meta, 'access', _276 => _276.output, 'optionalAccess', _277 => _277.jsx, 'access', _278 => delete _278.code]);
7504
+ _optionalChainDelete([meta, 'access', _279 => _279.output, 'optionalAccess', _280 => _280.css, 'access', _281 => delete _281.code]);
7452
7505
  } else if (key === "script" /* SCRIPT */) {
7453
- _optionalChainDelete([meta, 'access', _275 => _275.output, 'optionalAccess', _276 => _276.script, 'access', _277 => delete _277.code]);
7506
+ _optionalChainDelete([meta, 'access', _282 => _282.output, 'optionalAccess', _283 => _283.script, 'access', _284 => delete _284.code]);
7454
7507
  } else if (key === "style" /* STYLE */) {
7455
- _optionalChainDelete([meta, 'access', _278 => _278.output, 'optionalAccess', _279 => _279.style, 'access', _280 => delete _280.code]);
7508
+ _optionalChainDelete([meta, 'access', _285 => _285.output, 'optionalAccess', _286 => _286.style, 'access', _287 => delete _287.code]);
7456
7509
  }
7457
7510
  if (!this.pendingUpdates.has(key)) {
7458
7511
  this.pendingUpdates.set(key, []);
@@ -7472,7 +7525,7 @@ var CacheManager = (_class9 = class {
7472
7525
  }
7473
7526
  for (const key of keys) {
7474
7527
  const updates = this.pendingUpdates.get(key);
7475
- if (!_optionalChain([updates, 'optionalAccess', _281 => _281.length])) continue;
7528
+ if (!_optionalChain([updates, 'optionalAccess', _288 => _288.length])) continue;
7476
7529
  const entries = [...this.cachedData[key] || []];
7477
7530
  updates.forEach(({ unit, meta }) => {
7478
7531
  const idx = entries.findIndex((c) => c.file === unit.file);
@@ -7633,7 +7686,7 @@ var CleanupManager = class {
7633
7686
  const sfcMeta = meta;
7634
7687
  const { jsx, css } = sfcMeta.output;
7635
7688
  await this.fileCompiler.removeOutputFile(jsx.file);
7636
- if (_optionalChain([css, 'optionalAccess', _282 => _282.file])) {
7689
+ if (_optionalChain([css, 'optionalAccess', _289 => _289.file])) {
7637
7690
  await this.fileCompiler.removeOutputFile(css.file);
7638
7691
  }
7639
7692
  break;
@@ -7689,7 +7742,7 @@ var CompilationUnitProcessor = class {
7689
7742
  const isScriptFile = key === "script" /* SCRIPT */;
7690
7743
  const isStyleFile = key === "style" /* STYLE */;
7691
7744
  if (isSFC || isScriptFile) {
7692
- unit.hasRoute = _optionalChain([result, 'optionalAccess', _283 => _283.hasRoute]);
7745
+ unit.hasRoute = _optionalChain([result, 'optionalAccess', _290 => _290.hasRoute]);
7693
7746
  }
7694
7747
  const resolveFileInfo = () => {
7695
7748
  if (isSFC) {
@@ -7709,7 +7762,7 @@ var CompilationUnitProcessor = class {
7709
7762
  const { script } = result.fileInfo;
7710
7763
  unit.output = {
7711
7764
  script: {
7712
- file: _optionalChain([script, 'optionalAccess', _284 => _284.file]),
7765
+ file: _optionalChain([script, 'optionalAccess', _291 => _291.file]),
7713
7766
  code
7714
7767
  }
7715
7768
  };
@@ -7786,7 +7839,7 @@ var FileProcessor = (_class10 = class {
7786
7839
  const absPath = this.fileCompiler.getAbsPath(filePath);
7787
7840
  const fileMeta = await this.fileCompiler.getFileMeta(absPath);
7788
7841
  const cache = (this.fileCompiler.getIsCache() ? existingCache : void 0) || await this.cacheManager.loadCache(key);
7789
- const record = _optionalChain([cache, 'optionalAccess', _285 => _285.target, 'access', _286 => _286.find, 'call', _287 => _287((c) => c.file === absPath)]);
7842
+ const record = _optionalChain([cache, 'optionalAccess', _292 => _292.target, 'access', _293 => _293.find, 'call', _294 => _294((c) => c.file === absPath)]);
7790
7843
  const { shouldCompile, hash } = await this.fileCompiler.checkCacheStatus(
7791
7844
  fileMeta,
7792
7845
  record,
@@ -7808,15 +7861,18 @@ var FileProcessor = (_class10 = class {
7808
7861
  hash: hash || this.fileCompiler.genHash(source)
7809
7862
  };
7810
7863
  const processed = await this.compilationUnitProcessor.resolve(initUnit, key);
7811
- if (_optionalChain([processed, 'optionalAccess', _288 => _288.output])) {
7864
+ if (_optionalChain([processed, 'optionalAccess', _295 => _295.output])) {
7812
7865
  await this.compilationUnitProcessor.saveCompiledFiles(processed, key);
7813
7866
  if (key === "sfc" /* SFC */ || key === "script" /* SCRIPT */) {
7814
- if (_optionalChain([processed, 'optionalAccess', _289 => _289.hasRoute])) {
7867
+ if (_optionalChain([processed, 'optionalAccess', _296 => _296.hasRoute])) {
7815
7868
  await this.addRouterToPackageJson();
7816
7869
  await this.updateEntryWithRouterProvider();
7817
7870
  }
7818
7871
  }
7819
7872
  await this.cacheManager.updateCacheIncrementally(processed, key);
7873
+ if (this.fileCompiler.getIsCache() && !existingCache) {
7874
+ await this.cacheManager.flushCache(key);
7875
+ }
7820
7876
  }
7821
7877
  return processed;
7822
7878
  }
@@ -7825,13 +7881,13 @@ var FileProcessor = (_class10 = class {
7825
7881
  */
7826
7882
  async addRouterToPackageJson() {
7827
7883
  const { output } = this.fileCompiler.options;
7828
- if (_optionalChain([output, 'optionalAccess', _290 => _290.bootstrapVite]) === false) {
7884
+ if (_optionalChain([output, 'optionalAccess', _297 => _297.bootstrapVite]) === false) {
7829
7885
  return;
7830
7886
  }
7831
7887
  const { router } = RUNTIME_PACKAGES;
7832
7888
  const filePath = this.fileCompiler.getOutputPkgPath();
7833
7889
  const packageJson = await this.fileCompiler.resolvePackageFile(filePath);
7834
- if (_optionalChain([packageJson, 'optionalAccess', _291 => _291.dependencies, 'optionalAccess', _292 => _292[router.name]])) {
7890
+ if (_optionalChain([packageJson, 'optionalAccess', _298 => _298.dependencies, 'optionalAccess', _299 => _299[router.name]])) {
7835
7891
  return;
7836
7892
  }
7837
7893
  if (!packageJson.dependencies) {
@@ -7850,7 +7906,7 @@ var FileProcessor = (_class10 = class {
7850
7906
  const { exclude, output, router } = this.fileCompiler.options;
7851
7907
  const inputPath = this.fileCompiler.getInputPath();
7852
7908
  const outputPath = this.fileCompiler.getOuputPath(true);
7853
- if (_optionalChain([output, 'optionalAccess', _293 => _293.bootstrapVite]) === false || _optionalChain([router, 'optionalAccess', _294 => _294.autoUpdateEntry]) === false || !_optionalChain([router, 'optionalAccess', _295 => _295.configFile])) {
7909
+ if (_optionalChain([output, 'optionalAccess', _300 => _300.bootstrapVite]) === false || _optionalChain([router, 'optionalAccess', _301 => _301.autoUpdateEntry]) === false || !_optionalChain([router, 'optionalAccess', _302 => _302.configFile])) {
7854
7910
  return;
7855
7911
  }
7856
7912
  const getMainFile = async (filename) => {
@@ -7871,7 +7927,7 @@ var FileProcessor = (_class10 = class {
7871
7927
  const prepareRouterEntry = () => {
7872
7928
  const importPath = this.fileCompiler.resolveRelativePath(inputPath, router.configFile);
7873
7929
  let content = fileData.content;
7874
- if (_optionalChain([exclude, 'optionalAccess', _296 => _296.includes, 'call', _297 => _297(router.configFile)]) || _optionalChain([exclude, 'optionalAccess', _298 => _298.includes, 'call', _299 => _299(importPath)])) {
7930
+ if (_optionalChain([exclude, 'optionalAccess', _303 => _303.includes, 'call', _304 => _304(router.configFile)]) || _optionalChain([exclude, 'optionalAccess', _305 => _305.includes, 'call', _306 => _306(importPath)])) {
7875
7931
  return content;
7876
7932
  }
7877
7933
  const routerModule = "RouterInstance";
@@ -7978,7 +8034,7 @@ ${routerImport}`);
7978
8034
  const resolvedPath = normalizePath(fileCompiler.relativePath(input));
7979
8035
  const baseName = _path2.default.basename(input).toLowerCase();
7980
8036
  const exclusions = fileCompiler.getIgnoreAssets();
7981
- if (!_optionalChain([fileCompiler, 'access', _300 => _300.options, 'access', _301 => _301.output, 'optionalAccess', _302 => _302.ignoreAssets])) {
8037
+ if (!_optionalChain([fileCompiler, 'access', _307 => _307.options, 'access', _308 => _308.output, 'optionalAccess', _309 => _309.ignoreAssets])) {
7982
8038
  const shouldExclude = Array.from(exclusions).some((pattern) => {
7983
8039
  if (pattern.endsWith(".")) {
7984
8040
  return baseName.startsWith(pattern);
@@ -8114,7 +8170,7 @@ var ViteBootstrapper = (_class12 = class {
8114
8170
  const { output } = this.options;
8115
8171
  const workspaceDir = this.fileCompiler.getWorkspaceDir();
8116
8172
  await _fs2.default.promises.mkdir(workspaceDir, { recursive: true });
8117
- if (_optionalChain([output, 'optionalAccess', _303 => _303.bootstrapVite]) === false) {
8173
+ if (_optionalChain([output, 'optionalAccess', _310 => _310.bootstrapVite]) === false) {
8118
8174
  return false;
8119
8175
  }
8120
8176
  if (this.isSingleFile()) {
@@ -8154,9 +8210,9 @@ var ViteBootstrapper = (_class12 = class {
8154
8210
  const newDevDeps = resolveDeps(sourcePkg.devDependencies, newPkg.devDependencies, true);
8155
8211
  newPkg.dependencies = newDeps;
8156
8212
  newPkg.devDependencies = newDevDeps;
8157
- newPkg = _optionalChain([output, 'optionalAccess', _304 => _304.packageJson, 'optionalCall', _305 => _305(newPkg)]) || newPkg;
8213
+ newPkg = _optionalChain([output, 'optionalAccess', _311 => _311.packageJson, 'optionalCall', _312 => _312(newPkg)]) || newPkg;
8158
8214
  await this.fileCompiler.writeFileWithDir(outputPkgPath, JSON.stringify(newPkg, null, 2));
8159
- this.spinner.succeed("Initialized Vite React environment");
8215
+ this.spinner.succeed("Vite React environment initialized");
8160
8216
  return true;
8161
8217
  }
8162
8218
  /**
@@ -8165,12 +8221,12 @@ var ViteBootstrapper = (_class12 = class {
8165
8221
  async resolveViteCreateApp() {
8166
8222
  const { output } = this.options;
8167
8223
  const { viteVersion, template: tmpl } = this.defaultConfig;
8168
- const bootstrapVite = _optionalChain([output, 'optionalAccess', _306 => _306.bootstrapVite]);
8224
+ const bootstrapVite = _optionalChain([output, 'optionalAccess', _313 => _313.bootstrapVite]);
8169
8225
  const outDirName = this.fileCompiler.getOutDirName();
8170
8226
  const configObject = typeof bootstrapVite === "object" ? bootstrapVite : null;
8171
- const viteVer = _optionalChain([configObject, 'optionalAccess', _307 => _307.vite]) || viteVersion;
8172
- const reactVer = _optionalChain([configObject, 'optionalAccess', _308 => _308.react]);
8173
- const template = _optionalChain([configObject, 'optionalAccess', _309 => _309.template]) || tmpl;
8227
+ const viteVer = _optionalChain([configObject, 'optionalAccess', _314 => _314.vite]) || viteVersion;
8228
+ const reactVer = _optionalChain([configObject, 'optionalAccess', _315 => _315.react]);
8229
+ const template = _optionalChain([configObject, 'optionalAccess', _316 => _316.template]) || tmpl;
8174
8230
  const cmd = `npm create vite${viteVer} ${outDirName} -- --template ${template}`;
8175
8231
  _child_process.execSync.call(void 0, cmd, {
8176
8232
  cwd: this.fileCompiler.getWorkspaceDir(),
@@ -8292,7 +8348,7 @@ var FileCompiler = (_class13 = class extends BaseCompiler {
8292
8348
  const { viteBootstrapper, fileProcessor, cacheManager, pipelineManager, assetManager } = this.manager;
8293
8349
  let startTime = 0;
8294
8350
  try {
8295
- this.updateSpinner("Initializing Vite React env...");
8351
+ this.updateSpinner("Initializing environment...");
8296
8352
  await viteBootstrapper.bootstrapIfNeeded();
8297
8353
  const cacheMap = await cacheManager.loadAllCache();
8298
8354
  startTime = performance.now();
@@ -8306,7 +8362,7 @@ var FileCompiler = (_class13 = class extends BaseCompiler {
8306
8362
  const assetCount = await assetManager.runAsset(scanFiles.assets, cacheMap);
8307
8363
  this.updateSpinner("Almost done...");
8308
8364
  await cacheManager.flushAllCache();
8309
- await _optionalChain([this, 'access', _310 => _310.options, 'access', _311 => _311.onSuccess, 'optionalCall', _312 => _312()]);
8365
+ await _optionalChain([this, 'access', _317 => _317.options, 'access', _318 => _318.onSuccess, 'optionalCall', _319 => _319()]);
8310
8366
  const endTime = calcElapsedTime(startTime);
8311
8367
  this.printCoreLogs();
8312
8368
  this.showCompileStats(endTime, sfcCount, scriptCount, styleCount, assetCount);