@vureact/compiler-core 1.8.5 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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.5
2
+ * @vureact/compiler-core v1.10.0
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 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);
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 t28 = _interopRequireWildcard(_types); var t26 = _interopRequireWildcard(_types); var t27 = _interopRequireWildcard(_types); var t29 = _interopRequireWildcard(_types); var t30 = _interopRequireWildcard(_types); var t31 = _interopRequireWildcard(_types); var t32 = _interopRequireWildcard(_types); var t40 = _interopRequireWildcard(_types); var t34 = _interopRequireWildcard(_types); var t33 = _interopRequireWildcard(_types); var t35 = _interopRequireWildcard(_types); var t38 = _interopRequireWildcard(_types); var t36 = _interopRequireWildcard(_types); var t37 = _interopRequireWildcard(_types); var t39 = _interopRequireWildcard(_types); var t41 = _interopRequireWildcard(_types); var t48 = _interopRequireWildcard(_types); var t46 = _interopRequireWildcard(_types); var t42 = _interopRequireWildcard(_types); var t43 = _interopRequireWildcard(_types); var t44 = _interopRequireWildcard(_types); var t45 = _interopRequireWildcard(_types); var t47 = _interopRequireWildcard(_types); var t49 = _interopRequireWildcard(_types); var t50 = _interopRequireWildcard(_types); var t51 = _interopRequireWildcard(_types); var t52 = _interopRequireWildcard(_types); var t54 = _interopRequireWildcard(_types); var t53 = _interopRequireWildcard(_types); var t55 = _interopRequireWildcard(_types);
28
28
 
29
29
  // src/consts/other.ts
30
30
  var PACKAGE_NAME = {
@@ -48,7 +48,9 @@ var MACRO_API_NAMES = {
48
48
  emits: "defineEmits",
49
49
  slots: "defineSlots",
50
50
  options: "defineOptions",
51
- expose: "defineExpose"
51
+ expose: "defineExpose",
52
+ model: "defineModel",
53
+ defaults: "withDefaults"
52
54
  };
53
55
  var DOLLAR_IDENTIFIERS = [
54
56
  "$data",
@@ -402,6 +404,11 @@ var ADAPTER_RULES = {
402
404
  }
403
405
  }
404
406
  };
407
+ var AUTO_IMPORTED_APIS = new Set(
408
+ Object.entries(ADAPTER_RULES).flatMap(
409
+ ([_, rules]) => Object.keys(rules).filter((key) => !key.startsWith("dir"))
410
+ )
411
+ );
405
412
 
406
413
  // src/consts/vue-api-map.ts
407
414
  var VUE_API_MAP = {
@@ -950,21 +957,21 @@ var Logger = (_class2 = class {constructor() { _class2.prototype.__init2.call(th
950
957
  }
951
958
  printAll(opts) {
952
959
  if (this.logs.length === 0) {
953
- console.log("No logs to display.");
960
+ !_optionalChain([opts, 'optionalAccess', _14 => _14._testMode]) && console.log("No logs to display.");
954
961
  return;
955
962
  }
956
963
  const orderedLogs = this.getOrderedLogs(opts);
957
964
  for (const log of orderedLogs) {
958
- console.log();
965
+ !_optionalChain([opts, 'optionalAccess', _15 => _15._testMode]) && console.log();
959
966
  console.log(this.formatHeader(log));
960
967
  const context = this.formatContext(log);
961
968
  if (context) {
962
969
  console.log(context);
963
970
  }
964
- console.log();
971
+ !_optionalChain([opts, 'optionalAccess', _16 => _16._testMode]) && console.log();
965
972
  }
966
973
  this.printSummary();
967
- console.log();
974
+ !_optionalChain([opts, 'optionalAccess', _17 => _17._testMode]) && console.log();
968
975
  }
969
976
  clear() {
970
977
  this.logs = [];
@@ -984,8 +991,8 @@ var logger = new Logger();
984
991
  // src/core/codegen/component/jsx/syntax-processor/process/build-slot-prop.ts
985
992
  function buildSlotProp(nodeIR, ctx) {
986
993
  const slotKey = t8.jsxIdentifier(nodeIR.name);
987
- const childrenNodeIR = !nodeIR.isScoped ? nodeIR.content : _optionalChain([nodeIR, 'access', _14 => _14.callback, 'optionalAccess', _15 => _15.exp]);
988
- if (!_optionalChain([childrenNodeIR, 'optionalAccess', _16 => _16.length])) {
994
+ const childrenNodeIR = !nodeIR.isScoped ? nodeIR.content : _optionalChain([nodeIR, 'access', _18 => _18.callback, 'optionalAccess', _19 => _19.exp]);
995
+ if (!_optionalChain([childrenNodeIR, 'optionalAccess', _20 => _20.length])) {
989
996
  return null;
990
997
  }
991
998
  const jsxChild = childrenNodeIR.length > 1 ? buildFragmentNode(buildJsxChildren(childrenNodeIR, ctx)) : buildJsxNode(childrenNodeIR[0], ctx);
@@ -1015,7 +1022,7 @@ function convertSlotValueToExpression(nodeIR) {
1015
1022
  return convertJsxChildToExpression(nodeIR);
1016
1023
  }
1017
1024
  function buildSlotCallbackParams(nodeIR, ctx) {
1018
- const rawArg = _optionalChain([nodeIR, 'access', _17 => _17.callback, 'optionalAccess', _18 => _18.arg, 'optionalAccess', _19 => _19.trim, 'call', _20 => _20()]);
1025
+ const rawArg = _optionalChain([nodeIR, 'access', _21 => _21.callback, 'optionalAccess', _22 => _22.arg, 'optionalAccess', _23 => _23.trim, 'call', _24 => _24()]);
1019
1026
  if (!rawArg) {
1020
1027
  return [];
1021
1028
  }
@@ -1060,7 +1067,7 @@ function buildStandardProp(nodeIR) {
1060
1067
  babelExp: { ast: keyAST },
1061
1068
  value: {
1062
1069
  content,
1063
- isStringLiteral: isStringLiteral14,
1070
+ isStringLiteral: isStringLiteral16,
1064
1071
  babelExp: { ast: valueAST }
1065
1072
  }
1066
1073
  } = nodeIR;
@@ -1069,15 +1076,15 @@ function buildStandardProp(nodeIR) {
1069
1076
  }
1070
1077
  let value;
1071
1078
  if (content !== "true") {
1072
- value = isStringLiteral14 ? t9.stringLiteral(content) : buildJsxExpressionNode(valueAST);
1079
+ value = isStringLiteral16 ? t9.stringLiteral(content) : buildJsxExpressionNode(valueAST);
1073
1080
  }
1074
1081
  return t9.jsxAttribute(keyAST, value);
1075
1082
  }
1076
1083
 
1077
1084
  // src/core/codegen/component/jsx/syntax-processor/process/build-element-node/resolve-template-node.ts
1078
1085
  function resolveTemplateNode(nodeIR, children) {
1079
- const hasCondition = !!_optionalChain([nodeIR, 'access', _21 => _21.meta, 'optionalAccess', _22 => _22.condition]);
1080
- const hasLoop = !!_optionalChain([nodeIR, 'access', _23 => _23.meta, 'optionalAccess', _24 => _24.loop, 'optionalAccess', _25 => _25.isLoop]);
1086
+ const hasCondition = !!_optionalChain([nodeIR, 'access', _25 => _25.meta, 'optionalAccess', _26 => _26.condition]);
1087
+ const hasLoop = !!_optionalChain([nodeIR, 'access', _27 => _27.meta, 'optionalAccess', _28 => _28.loop, 'optionalAccess', _29 => _29.isLoop]);
1081
1088
  const hasSlot = nodeIR.props.some((p) => p.type === 2 /* SLOT */);
1082
1089
  if (hasCondition || hasLoop || hasSlot) {
1083
1090
  if (!children.length) {
@@ -1097,13 +1104,13 @@ function buildElementNode(nodeIR, ctx) {
1097
1104
  return null;
1098
1105
  }
1099
1106
  const { meta } = nodeIR;
1100
- if (_optionalChain([meta, 'optionalAccess', _26 => _26.condition]) && !meta.condition.isHandled) {
1107
+ if (_optionalChain([meta, 'optionalAccess', _30 => _30.condition]) && !meta.condition.isHandled) {
1101
1108
  return buildConditionNode(nodeIR, ctx);
1102
1109
  }
1103
- if (_optionalChain([meta, 'optionalAccess', _27 => _27.memo, 'optionalAccess', _28 => _28.isMemo]) && !meta.memo.isHandled) {
1110
+ if (_optionalChain([meta, 'optionalAccess', _31 => _31.memo, 'optionalAccess', _32 => _32.isMemo]) && !meta.memo.isHandled) {
1104
1111
  return buildMemoNode(nodeIR, ctx);
1105
1112
  }
1106
- if (_optionalChain([meta, 'optionalAccess', _29 => _29.loop, 'optionalAccess', _30 => _30.isLoop]) && !meta.loop.isHandled) {
1113
+ if (_optionalChain([meta, 'optionalAccess', _33 => _33.loop, 'optionalAccess', _34 => _34.isLoop]) && !meta.loop.isHandled) {
1107
1114
  return buildLoopNode(nodeIR, ctx);
1108
1115
  }
1109
1116
  const props = buildProps(nodeIR, ctx);
@@ -1154,7 +1161,7 @@ function buildConditionNode(nodeIR, ctx) {
1154
1161
  function buildCtxProviderNode(nodeIR, ctx, children) {
1155
1162
  const { name, value, provide: nextProvide } = nodeIR;
1156
1163
  let childNodes = children;
1157
- if (_optionalChain([nextProvide, 'optionalAccess', _31 => _31.isOccupied])) {
1164
+ if (_optionalChain([nextProvide, 'optionalAccess', _35 => _35.isOccupied])) {
1158
1165
  childNodes = [buildCtxProviderNode(nextProvide, ctx, children)];
1159
1166
  }
1160
1167
  const parseProviderExpr = (raw) => {
@@ -1229,7 +1236,7 @@ function jsxBuilder(nodeIR, ctx, state, options) {
1229
1236
 
1230
1237
  // src/core/codegen/component/jsx/index.ts
1231
1238
  function buildJSX(nodeIR, ctx) {
1232
- if (!_optionalChain([nodeIR, 'optionalAccess', _32 => _32.children, 'access', _33 => _33.length]) && ctx.inputType !== "sfc") {
1239
+ if (!_optionalChain([nodeIR, 'optionalAccess', _36 => _36.children, 'access', _37 => _37.length]) && ctx.inputType !== "sfc") {
1233
1240
  return null;
1234
1241
  }
1235
1242
  return buildJSXChild(nodeIR, ctx);
@@ -1266,6 +1273,7 @@ var REACT_API_MAP = {
1266
1273
  memo: "memo",
1267
1274
  useRef: "useRef",
1268
1275
  useMemo: "useMemo",
1276
+ useEffect: "useEffect",
1269
1277
  ReactNode: "ReactNode",
1270
1278
  forwardRef: "forwardRef",
1271
1279
  useCallback: "useCallback",
@@ -1337,7 +1345,7 @@ function resolveLocalStatements(local, jsx) {
1337
1345
  if (!local) return stmts;
1338
1346
  if (typeof local === "object" && "program" in local) {
1339
1347
  const program3 = local.program;
1340
- if (_optionalChain([program3, 'optionalAccess', _34 => _34.body, 'optionalAccess', _35 => _35.length])) {
1348
+ if (_optionalChain([program3, 'optionalAccess', _38 => _38.body, 'optionalAccess', _39 => _39.length])) {
1341
1349
  return [...program3.body, jsx];
1342
1350
  }
1343
1351
  }
@@ -1366,7 +1374,7 @@ function resolveForwardRef(body, ctx) {
1366
1374
  if (lang.startsWith("ts")) {
1367
1375
  const types = [t13.tsAnyKeyword()];
1368
1376
  if (propsId) {
1369
- const propsType = _optionalChain([propsId, 'optionalAccess', _36 => _36.typeAnnotation, 'optionalAccess', _37 => _37.typeAnnotation]);
1377
+ const propsType = _optionalChain([propsId, 'optionalAccess', _40 => _40.typeAnnotation, 'optionalAccess', _41 => _41.typeAnnotation]);
1370
1378
  types.push(propsType || t13.tsAnyKeyword());
1371
1379
  }
1372
1380
  callExpr.typeParameters = t13.tsTypeParameterInstantiation(types);
@@ -1408,7 +1416,7 @@ function resolvePropsTypeName(name, hasUseAttrsCall) {
1408
1416
 
1409
1417
  // src/core/codegen/component/script/syntax-processor/process/build-program-preamble.ts
1410
1418
  function buildProgramPreamble(nodeIR, ctx, state) {
1411
- const statements = [_optionalChain([nodeIR, 'optionalAccess', _38 => _38.imports]), _optionalChain([nodeIR, 'optionalAccess', _39 => _39.tsTypes]), _optionalChain([nodeIR, 'optionalAccess', _40 => _40.exports]), _optionalChain([nodeIR, 'optionalAccess', _41 => _41.statement, 'access', _42 => _42.global])].flat().filter(Boolean);
1419
+ const statements = [_optionalChain([nodeIR, 'optionalAccess', _42 => _42.imports]), _optionalChain([nodeIR, 'optionalAccess', _43 => _43.tsTypes]), _optionalChain([nodeIR, 'optionalAccess', _44 => _44.exports]), _optionalChain([nodeIR, 'optionalAccess', _45 => _45.statement, 'access', _46 => _46.global])].flat().filter(Boolean);
1412
1420
  state.preambleStatements = statements;
1413
1421
  void ctx;
1414
1422
  }
@@ -1468,7 +1476,7 @@ function generateComponent(ir, ctx, options) {
1468
1476
  code,
1469
1477
  source: ctx.source
1470
1478
  };
1471
- executePlugins(_optionalChain([options, 'optionalAccess', _43 => _43.plugins]), result, ctx);
1479
+ executePlugins(_optionalChain([options, 'optionalAccess', _47 => _47.plugins]), result, ctx);
1472
1480
  return result;
1473
1481
  }
1474
1482
 
@@ -1482,7 +1490,7 @@ function generateOnlyScript(ir, ctx, options) {
1482
1490
  code,
1483
1491
  source: ctx.source
1484
1492
  };
1485
- executePlugins(_optionalChain([options, 'optionalAccess', _44 => _44.plugins]), result, ctx);
1493
+ executePlugins(_optionalChain([options, 'optionalAccess', _48 => _48.plugins]), result, ctx);
1486
1494
  return result;
1487
1495
  }
1488
1496
 
@@ -1515,7 +1523,7 @@ function parseOnlyScript(source, ctx, options) {
1515
1523
  };
1516
1524
  ctx.scriptData.lang = lang;
1517
1525
  ctx.scriptData.source = source;
1518
- executePlugins(_optionalChain([options, 'optionalAccess', _45 => _45.plugins]), result, ctx);
1526
+ executePlugins(_optionalChain([options, 'optionalAccess', _49 => _49.plugins]), result, ctx);
1519
1527
  return result;
1520
1528
  }
1521
1529
 
@@ -1534,7 +1542,7 @@ var _core = require('@babel/core');
1534
1542
 
1535
1543
  function findRootVariablePath(path8) {
1536
1544
  const rootId = findRootIdentifier(path8.node);
1537
- if (!_optionalChain([rootId, 'optionalAccess', _46 => _46.name])) return null;
1545
+ if (!_optionalChain([rootId, 'optionalAccess', _50 => _50.name])) return null;
1538
1546
  const binding = path8.scope.getBinding(rootId.name);
1539
1547
  if (!binding) return null;
1540
1548
  const rootPath = getVariableDeclaratorPath(binding.path);
@@ -1642,11 +1650,11 @@ function replaceIdName(id, newName) {
1642
1650
  id.loc.identifierName = newName;
1643
1651
  }
1644
1652
  }
1645
- function stringValueToTSType(ctx, input, tsTypeAnnotation7) {
1653
+ function stringValueToTSType(ctx, input, tsTypeAnnotation8) {
1646
1654
  const { filename, scriptData } = ctx;
1647
1655
  const exp = stringToExpr(input, scriptData.lang, filename);
1648
1656
  const ts = expressionToTSType(exp);
1649
- return tsTypeAnnotation7 ? t15.tsTypeAnnotation(ts) : ts;
1657
+ return tsTypeAnnotation8 ? t15.tsTypeAnnotation(ts) : ts;
1650
1658
  }
1651
1659
  function expressionToTSType(exp) {
1652
1660
  if (t15.isStringLiteral(exp)) return t15.tsStringKeyword();
@@ -1740,6 +1748,28 @@ function cleanNodeComments(node) {
1740
1748
  node.innerComments = null;
1741
1749
  node.trailingComments = null;
1742
1750
  }
1751
+ function mapRuntimeTypeToTSType(value) {
1752
+ switch (value.name) {
1753
+ case "String":
1754
+ return t15.tsStringKeyword();
1755
+ case "Number":
1756
+ return t15.tsNumberKeyword();
1757
+ case "Boolean":
1758
+ return t15.tsBooleanKeyword();
1759
+ case "Object":
1760
+ return t15.tsTypeLiteral([]);
1761
+ case "Array":
1762
+ return t15.tsArrayType(t15.tsAnyKeyword());
1763
+ case "Function":
1764
+ return t15.tsFunctionType(null, [], t15.tsTypeAnnotation(t15.tsAnyKeyword()));
1765
+ case "Symbol":
1766
+ return t15.tsSymbolKeyword();
1767
+ case "BigInt":
1768
+ return t15.tsBigIntKeyword();
1769
+ default:
1770
+ return t15.tsAnyKeyword();
1771
+ }
1772
+ }
1743
1773
 
1744
1774
  // src/core/parse/sfc/postprocess/resolve-script-metadata/resolve-declared-options.ts
1745
1775
  function resolveDeclaredOptions(path8, ctx) {
@@ -1751,11 +1781,11 @@ function resolveDeclaredOptions(path8, ctx) {
1751
1781
  const [options] = node.arguments;
1752
1782
  if (!options || !t16.isObjectExpression(options)) {
1753
1783
  logger.warn(
1754
- `Expected argument to be of a type ["ObjectExpression"] but instead got "${_optionalChain([options, 'optionalAccess', _47 => _47.type])}".`,
1784
+ `Expected argument to be of a type ["ObjectExpression"] but instead got "${_optionalChain([options, 'optionalAccess', _51 => _51.type])}".`,
1755
1785
  {
1756
1786
  file: filename,
1757
1787
  source: scriptData.source,
1758
- loc: _optionalChain([options, 'optionalAccess', _48 => _48.loc]) || node.loc
1788
+ loc: _optionalChain([options, 'optionalAccess', _52 => _52.loc]) || node.loc
1759
1789
  }
1760
1790
  );
1761
1791
  return;
@@ -1775,7 +1805,7 @@ function resolveDeclaredOptions(path8, ctx) {
1775
1805
  {
1776
1806
  source,
1777
1807
  file: filename,
1778
- loc: _optionalChain([propKey, 'optionalAccess', _49 => _49.loc])
1808
+ loc: _optionalChain([propKey, 'optionalAccess', _53 => _53.loc])
1779
1809
  }
1780
1810
  );
1781
1811
  continue;
@@ -1792,7 +1822,7 @@ function resolveDeclaredOptions(path8, ctx) {
1792
1822
  {
1793
1823
  source,
1794
1824
  file: filename,
1795
- loc: _optionalChain([propKey, 'optionalAccess', _50 => _50.loc])
1825
+ loc: _optionalChain([propKey, 'optionalAccess', _54 => _54.loc])
1796
1826
  }
1797
1827
  );
1798
1828
  continue;
@@ -1895,7 +1925,7 @@ function resolveLocalTypeFromReference(path8, typeRef, ctx, macroName, visitedTy
1895
1925
  }
1896
1926
  }
1897
1927
  const programPath = path8.findParent((p) => p.isProgram());
1898
- if (!_optionalChain([programPath, 'optionalAccess', _51 => _51.isProgram, 'call', _52 => _52()])) {
1928
+ if (!_optionalChain([programPath, 'optionalAccess', _55 => _55.isProgram, 'call', _56 => _56()])) {
1899
1929
  return null;
1900
1930
  }
1901
1931
  const declaration = resolveTypeDeclarationInProgram(programPath.node.body, refName);
@@ -2017,7 +2047,7 @@ function collectEmitsFromTsType(tsType, names, path8, ctx, visitedTypeRefs, warn
2017
2047
  return;
2018
2048
  }
2019
2049
  if (t18.isTSTypeReference(tsType)) {
2020
- const innerTypes = _optionalChain([tsType, 'access', _53 => _53.typeParameters, 'optionalAccess', _54 => _54.params]) || [];
2050
+ const innerTypes = _optionalChain([tsType, 'access', _57 => _57.typeParameters, 'optionalAccess', _58 => _58.params]) || [];
2021
2051
  for (const type of innerTypes) {
2022
2052
  collectEmitsFromTsType(type, names, path8, ctx, visitedTypeRefs, warnedImportedTypeRefs);
2023
2053
  }
@@ -2153,7 +2183,7 @@ function collectPropsFromTsType(tsType, names, path8, ctx, visitedTypeRefs, warn
2153
2183
  return;
2154
2184
  }
2155
2185
  if (t19.isTSTypeReference(tsType)) {
2156
- const innerTypes = _optionalChain([tsType, 'access', _55 => _55.typeParameters, 'optionalAccess', _56 => _56.params]) || [];
2186
+ const innerTypes = _optionalChain([tsType, 'access', _59 => _59.typeParameters, 'optionalAccess', _60 => _60.params]) || [];
2157
2187
  for (const type of innerTypes) {
2158
2188
  collectPropsFromTsType(type, names, path8, ctx, visitedTypeRefs, warnedImportedTypeRefs);
2159
2189
  }
@@ -2198,11 +2228,11 @@ function resolveUseAttrsExists(path8, ctx) {
2198
2228
  if (!isCalleeNamed(node, VUE_API_MAP.useAttrs)) {
2199
2229
  return;
2200
2230
  }
2201
- if (_optionalChain([scriptData, 'optionalAccess', _57 => _57.hasUseAttrsCall])) {
2231
+ if (_optionalChain([scriptData, 'optionalAccess', _61 => _61.hasUseAttrsCall])) {
2202
2232
  return;
2203
2233
  }
2204
2234
  scriptData.hasUseAttrsCall = true;
2205
- const parent = _optionalChain([path8, 'access', _58 => _58.parentPath, 'optionalAccess', _59 => _59.node]);
2235
+ const parent = _optionalChain([path8, 'access', _62 => _62.parentPath, 'optionalAccess', _63 => _63.node]);
2206
2236
  if (parent && t20.isVariableDeclarator(parent) && t20.isIdentifier(parent.id)) {
2207
2237
  templateData.declaredAttrs = parent.id.name;
2208
2238
  }
@@ -2218,6 +2248,7 @@ var REACTIVE_TYPE_MAP = {
2218
2248
  toRefs: "ref",
2219
2249
  customRef: "ref",
2220
2250
  shallowRef: "ref",
2251
+ defineModel: "ref",
2221
2252
  reactive: "reactive",
2222
2253
  shallowReactive: "reactive",
2223
2254
  computed: "ref",
@@ -2257,7 +2288,7 @@ function resolveReactiveBindings(node, ctx) {
2257
2288
  source: callName,
2258
2289
  reactiveType: getReactiveType(callName)
2259
2290
  };
2260
- if (callName === MACRO_API_NAMES.props) {
2291
+ if (callName === MACRO_API_NAMES.props || callName === MACRO_API_NAMES.defaults) {
2261
2292
  ctx.propField = varName;
2262
2293
  }
2263
2294
  }
@@ -2339,7 +2370,7 @@ function resolveTemplateRefBindings(node, ctx) {
2339
2370
  return;
2340
2371
  }
2341
2372
  const varName = node.id.name;
2342
- const initValue = _optionalChain([init, 'access', _60 => _60.arguments, 'access', _61 => _61[0], 'optionalAccess', _62 => _62.value]);
2373
+ const initValue = _optionalChain([init, 'access', _64 => _64.arguments, 'access', _65 => _65[0], 'optionalAccess', _66 => _66.value]);
2343
2374
  refBindings.domRefs[varName] = {
2344
2375
  tag: initValue,
2345
2376
  name: varName,
@@ -2362,7 +2393,7 @@ function resolveVarBindings(node, ctx) {
2362
2393
 
2363
2394
  // src/core/parse/sfc/postprocess/resolve-script-metadata/index.ts
2364
2395
  function resolveScriptMeta(result, ctx) {
2365
- const scriptAst = _optionalChain([result, 'access', _63 => _63.script, 'optionalAccess', _64 => _64.ast]);
2396
+ const scriptAst = _optionalChain([result, 'access', _67 => _67.script, 'optionalAccess', _68 => _68.ast]);
2366
2397
  if (ctx.inputType !== "sfc" || !scriptAst) {
2367
2398
  return;
2368
2399
  }
@@ -2392,8 +2423,8 @@ function resolveScript(descriptor, ctx, parseResult) {
2392
2423
  }
2393
2424
  const { scriptSetup } = descriptor;
2394
2425
  if (!scriptSetup) return null;
2395
- if (_optionalChain([scriptSetup, 'optionalAccess', _65 => _65.warnings])) {
2396
- _optionalChain([scriptSetup, 'optionalAccess', _66 => _66.warnings, 'access', _67 => _67.forEach, 'call', _68 => _68((msg) => {
2426
+ if (_optionalChain([scriptSetup, 'optionalAccess', _69 => _69.warnings])) {
2427
+ _optionalChain([scriptSetup, 'optionalAccess', _70 => _70.warnings, 'access', _71 => _71.forEach, 'call', _72 => _72((msg) => {
2397
2428
  logger.warn(msg, { file: ctx.filename });
2398
2429
  })]);
2399
2430
  }
@@ -2411,7 +2442,7 @@ function resolveContext(scriptSetup, ctx) {
2411
2442
  const regx = /\/\/\s*@vr-name:\s*(\w+)/;
2412
2443
  const nameMatch = source.match(regx);
2413
2444
  content = content.replace(regx, "");
2414
- return _optionalChain([nameMatch, 'optionalAccess', _69 => _69[1], 'optionalAccess', _70 => _70.trim, 'call', _71 => _71()]) || "";
2445
+ return _optionalChain([nameMatch, 'optionalAccess', _73 => _73[1], 'optionalAccess', _74 => _74.trim, 'call', _75 => _75()]) || "";
2415
2446
  };
2416
2447
  scriptData.declaredOptions.name = resolveVRComment(content);
2417
2448
  scriptData.lang = lang || "js";
@@ -2431,7 +2462,7 @@ var _postcssselectorparser = require('postcss-selector-parser'); var _postcsssel
2431
2462
  // src/plugins/postcss/utils.ts
2432
2463
  function findFirstPseudoIndex(nodes, start, end) {
2433
2464
  for (let i = start; i <= end; i++) {
2434
- if (_optionalChain([nodes, 'access', _72 => _72[i], 'optionalAccess', _73 => _73.type]) === "pseudo") {
2465
+ if (_optionalChain([nodes, 'access', _76 => _76[i], 'optionalAccess', _77 => _77.type]) === "pseudo") {
2435
2466
  return i;
2436
2467
  }
2437
2468
  }
@@ -2443,7 +2474,7 @@ function hasScopeAttribute(nodes, start, end, scopeId) {
2443
2474
  }
2444
2475
  for (let i = start; i <= end; i++) {
2445
2476
  const node = nodes[i];
2446
- if (_optionalChain([node, 'optionalAccess', _74 => _74.type]) === "attribute" && node.attribute === scopeId) {
2477
+ if (_optionalChain([node, 'optionalAccess', _78 => _78.type]) === "attribute" && node.attribute === scopeId) {
2447
2478
  return true;
2448
2479
  }
2449
2480
  }
@@ -2454,7 +2485,7 @@ function hasNestingSelector(nodes, start, end) {
2454
2485
  return false;
2455
2486
  }
2456
2487
  for (let i = start; i <= end; i++) {
2457
- if (_optionalChain([nodes, 'access', _75 => _75[i], 'optionalAccess', _76 => _76.type]) === "nesting") {
2488
+ if (_optionalChain([nodes, 'access', _79 => _79[i], 'optionalAccess', _80 => _80.type]) === "nesting") {
2458
2489
  return true;
2459
2490
  }
2460
2491
  }
@@ -2468,18 +2499,18 @@ function findScopeTargetIndex(nodes, start, end) {
2468
2499
  let nestingFallback = -1;
2469
2500
  for (let i = start; i <= end; i++) {
2470
2501
  const node = nodes[i];
2471
- if (_optionalChain([node, 'optionalAccess', _77 => _77.type]) === "nesting") {
2502
+ if (_optionalChain([node, 'optionalAccess', _81 => _81.type]) === "nesting") {
2472
2503
  nestingFallback = i;
2473
2504
  continue;
2474
2505
  }
2475
- if (_optionalChain([node, 'optionalAccess', _78 => _78.type]) === "tag" || _optionalChain([node, 'optionalAccess', _79 => _79.type]) === "class" || _optionalChain([node, 'optionalAccess', _80 => _80.type]) === "id") {
2506
+ if (_optionalChain([node, 'optionalAccess', _82 => _82.type]) === "tag" || _optionalChain([node, 'optionalAccess', _83 => _83.type]) === "class" || _optionalChain([node, 'optionalAccess', _84 => _84.type]) === "id") {
2476
2507
  candidate = i;
2477
2508
  }
2478
2509
  }
2479
2510
  return candidate === -1 ? nestingFallback : candidate;
2480
2511
  }
2481
2512
  function isRuleIgnored(rule) {
2482
- return rule.parent != null && rule.parent.type === "atrule" && _optionalChain([rule, 'access', _81 => _81.parent, 'optionalAccess', _82 => _82.name]) === "keyframes";
2513
+ return rule.parent != null && rule.parent.type === "atrule" && _optionalChain([rule, 'access', _85 => _85.parent, 'optionalAccess', _86 => _86.name]) === "keyframes";
2483
2514
  }
2484
2515
  function isNestedInRule(rule) {
2485
2516
  let current = rule.parent;
@@ -2503,7 +2534,7 @@ function resolveStandard(s, scopeId) {
2503
2534
  }
2504
2535
  let compoundStart = 0;
2505
2536
  for (let i = compoundEnd; i >= 0; i--) {
2506
- if (_optionalChain([selector, 'access', _83 => _83.nodes, 'access', _84 => _84[i], 'optionalAccess', _85 => _85.type]) === "combinator") {
2537
+ if (_optionalChain([selector, 'access', _87 => _87.nodes, 'access', _88 => _88[i], 'optionalAccess', _89 => _89.type]) === "combinator") {
2507
2538
  compoundStart = i + 1;
2508
2539
  break;
2509
2540
  }
@@ -2561,13 +2592,13 @@ function resolveSingleSelectorWithDeep(selector, scopeId, nestedInRule) {
2561
2592
  return [resolveStandard(selector.toString(), scopeId)];
2562
2593
  }
2563
2594
  const deepNode = selector.nodes[deepIndex];
2564
- if (_optionalChain([deepNode, 'optionalAccess', _86 => _86.type]) !== "pseudo") {
2595
+ if (_optionalChain([deepNode, 'optionalAccess', _90 => _90.type]) !== "pseudo") {
2565
2596
  return [resolveStandard(selector.toString(), scopeId)];
2566
2597
  }
2567
2598
  const leftRaw = selector.nodes.slice(0, deepIndex).map((node) => node.toString()).join("");
2568
2599
  const rightRaw = selector.nodes.slice(deepIndex + 1).map((node) => node.toString()).join("");
2569
2600
  const leftScoped = scopeDeepLeftSide(leftRaw, scopeId, nestedInRule);
2570
- const deepInnerSelectors = _optionalChain([deepNode, 'access', _87 => _87.nodes, 'optionalAccess', _88 => _88.length]) ? deepNode.nodes : [];
2601
+ const deepInnerSelectors = _optionalChain([deepNode, 'access', _91 => _91.nodes, 'optionalAccess', _92 => _92.length]) ? deepNode.nodes : [];
2571
2602
  if (!deepInnerSelectors.length) {
2572
2603
  return [leftScoped + rightRaw];
2573
2604
  }
@@ -2585,7 +2616,7 @@ function resolveSingleSelectorWithDeep(selector, scopeId, nestedInRule) {
2585
2616
  function findTopLevelDeepIndex(nodes) {
2586
2617
  for (let i = 0; i < nodes.length; i++) {
2587
2618
  const node = nodes[i];
2588
- if (_optionalChain([node, 'optionalAccess', _89 => _89.type]) === "pseudo" && (node.value === ":deep" || node.value === "::v-deep")) {
2619
+ if (_optionalChain([node, 'optionalAccess', _93 => _93.type]) === "pseudo" && (node.value === ":deep" || node.value === "::v-deep")) {
2589
2620
  return i;
2590
2621
  }
2591
2622
  }
@@ -2612,7 +2643,7 @@ function injectScopeToRightMostCompound(selector, scopeId) {
2612
2643
  return;
2613
2644
  }
2614
2645
  let compoundEnd = nodes.length - 1;
2615
- while (compoundEnd >= 0 && _optionalChain([nodes, 'access', _90 => _90[compoundEnd], 'optionalAccess', _91 => _91.type]) === "combinator") {
2646
+ while (compoundEnd >= 0 && _optionalChain([nodes, 'access', _94 => _94[compoundEnd], 'optionalAccess', _95 => _95.type]) === "combinator") {
2616
2647
  compoundEnd--;
2617
2648
  }
2618
2649
  if (compoundEnd < 0) {
@@ -2620,7 +2651,7 @@ function injectScopeToRightMostCompound(selector, scopeId) {
2620
2651
  }
2621
2652
  let compoundStart = 0;
2622
2653
  for (let i = compoundEnd; i >= 0; i--) {
2623
- if (_optionalChain([nodes, 'access', _92 => _92[i], 'optionalAccess', _93 => _93.type]) === "combinator") {
2654
+ if (_optionalChain([nodes, 'access', _96 => _96[i], 'optionalAccess', _97 => _97.type]) === "combinator") {
2624
2655
  compoundStart = i + 1;
2625
2656
  break;
2626
2657
  }
@@ -2662,7 +2693,7 @@ function resolveSelector(s, scopeId, options) {
2662
2693
  return s.replace(/:global\(([^)]+)\)/g, (_, inner) => inner);
2663
2694
  }
2664
2695
  if (s.includes(":deep(")) {
2665
- return resolveDeep(s, scopeId, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _94 => _94.nestedInRule]), () => ( false)));
2696
+ return resolveDeep(s, scopeId, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _98 => _98.nestedInRule]), () => ( false)));
2666
2697
  }
2667
2698
  if (s.includes(":slotted(")) {
2668
2699
  return s.replace(/:slotted\((.*)\)/, "$1");
@@ -2816,7 +2847,7 @@ function resolveStyles(descriptor, ctx, result) {
2816
2847
  var _compilercore = require('@vue/compiler-core');
2817
2848
  function resolveTemplate(descriptor, _, result) {
2818
2849
  const block = descriptor.template;
2819
- if (!_optionalChain([block, 'optionalAccess', _95 => _95.content])) return null;
2850
+ if (!_optionalChain([block, 'optionalAccess', _99 => _99.content])) return null;
2820
2851
  result.template = {
2821
2852
  ast: _compilercore.baseParse.call(void 0, block.content),
2822
2853
  source: block
@@ -2833,7 +2864,7 @@ function processVueSyntax(descriptor, ctx, result) {
2833
2864
  }
2834
2865
  function vueSyntaxProcessor(descriptor, ctx, result, options) {
2835
2866
  const run = (p, type) => {
2836
- _optionalChain([p, 'optionalAccess', _96 => _96.forEach, 'call', _97 => _97((handler) => {
2867
+ _optionalChain([p, 'optionalAccess', _100 => _100.forEach, 'call', _101 => _101((handler) => {
2837
2868
  if (type === "post") {
2838
2869
  handler(result, ctx);
2839
2870
  return;
@@ -2857,7 +2888,7 @@ function parseSFC(source, ctx, options) {
2857
2888
  };
2858
2889
  collectErrs(descriptor, errors);
2859
2890
  processVueSyntax(descriptor, ctx, result);
2860
- executePlugins(_optionalChain([options, 'optionalAccess', _98 => _98.plugins]), result, ctx);
2891
+ executePlugins(_optionalChain([options, 'optionalAccess', _102 => _102.plugins]), result, ctx);
2861
2892
  return result;
2862
2893
  }
2863
2894
  function collectErrs(descriptor, errors) {
@@ -2865,7 +2896,7 @@ function collectErrs(descriptor, errors) {
2865
2896
  logger.error(err.message, {
2866
2897
  source: descriptor.source,
2867
2898
  file: descriptor.filename,
2868
- loc: _optionalChain([err, 'optionalAccess', _99 => _99.loc])
2899
+ loc: _optionalChain([err, 'optionalAccess', _103 => _103.loc])
2869
2900
  });
2870
2901
  }
2871
2902
  if (descriptor.cssVars.length) {
@@ -2889,7 +2920,7 @@ function parse(source, ctx, options) {
2889
2920
 
2890
2921
  // src/core/transform/sfc/script/syntax-processor/postprocess/resolve-ast-chunks/resolve-global-type-chunk.ts
2891
2922
  function resolveGlobalTypeChunks(path8, ir) {
2892
- if (!_optionalChain([path8, 'access', _100 => _100.parentPath, 'optionalAccess', _101 => _101.isProgram, 'call', _102 => _102()])) {
2923
+ if (!_optionalChain([path8, 'access', _104 => _104.parentPath, 'optionalAccess', _105 => _105.isProgram, 'call', _106 => _106()])) {
2893
2924
  return;
2894
2925
  }
2895
2926
  const forked = forkNode(path8.node);
@@ -3116,7 +3147,7 @@ function resolveRuntimeImports(ctx) {
3116
3147
  if (!hasImports) {
3117
3148
  const importNodes = createImportNodes(ctx);
3118
3149
  if (importNodes.length) {
3119
- if (_optionalChain([strategyResult, 'optionalAccess', _103 => _103.shouldInjectRuntimeImports])) {
3150
+ if (_optionalChain([strategyResult, 'optionalAccess', _107 => _107.shouldInjectRuntimeImports])) {
3120
3151
  path8.insertAfter(importNodes);
3121
3152
  } else if (finalModuleName === PACKAGE_NAME.react) {
3122
3153
  path8.insertAfter(importNodes);
@@ -3144,7 +3175,7 @@ function resolveRuntimeImports(ctx) {
3144
3175
  }
3145
3176
  function mergeImports(currentNode, ctx, moduleName) {
3146
3177
  const ctxImportItems = ctx.imports.get(moduleName);
3147
- if (!_optionalChain([ctxImportItems, 'optionalAccess', _104 => _104.length])) {
3178
+ if (!_optionalChain([ctxImportItems, 'optionalAccess', _108 => _108.length])) {
3148
3179
  return;
3149
3180
  }
3150
3181
  const currentImports = /* @__PURE__ */ new Set();
@@ -3194,7 +3225,7 @@ function forkProgramTopLeadingComments(target, program3) {
3194
3225
  }
3195
3226
  function forkFilePreambleLeadingComments(target, source) {
3196
3227
  const { leadingComments } = source;
3197
- if (!_optionalChain([leadingComments, 'optionalAccess', _105 => _105.length])) {
3228
+ if (!_optionalChain([leadingComments, 'optionalAccess', _109 => _109.length])) {
3198
3229
  return;
3199
3230
  }
3200
3231
  const commentsToMove = [];
@@ -3277,6 +3308,234 @@ function isVueImport(id, path8) {
3277
3308
  return VUE_PACKAGES.some((pkg) => moduleName.includes(pkg));
3278
3309
  }
3279
3310
 
3311
+ // src/core/transform/sfc/script/syntax-processor/postprocess/resolve-with-defaults.ts
3312
+
3313
+
3314
+ // src/core/transform/sfc/script/shared/hook-creator.ts
3315
+
3316
+ function createUseCallback(body, deps) {
3317
+ return t26.callExpression(t26.identifier(REACT_API_MAP.useCallback), [
3318
+ body,
3319
+ _nullishCoalesce(deps, () => ( t26.arrayExpression([])))
3320
+ ]);
3321
+ }
3322
+ function createUseMemo(body, deps) {
3323
+ return t26.callExpression(t26.identifier(REACT_API_MAP.useMemo), [
3324
+ t26.arrowFunctionExpression([], body),
3325
+ _nullishCoalesce(deps, () => ( t26.arrayExpression([])))
3326
+ ]);
3327
+ }
3328
+ function createUseImperativeHandle(refId, init) {
3329
+ return t26.callExpression(t26.identifier(REACT_API_MAP.useImperativeHandle), [refId, init]);
3330
+ }
3331
+ function createUseUpdated(body, deps) {
3332
+ const adapter = ADAPTER_RULES.runtime.onUpdated;
3333
+ return t26.callExpression(t26.identifier(adapter.target), [
3334
+ t26.arrowFunctionExpression([], body),
3335
+ _nullishCoalesce(deps, () => ( t26.identifier("undefined")))
3336
+ ]);
3337
+ }
3338
+
3339
+ // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-with-defaults.ts
3340
+
3341
+ var WITH_DEFAULTS_PLACEHOLDER = " from withDefaults ";
3342
+ function resolveWithDefaultsOptions(ctx, ast) {
3343
+ if (ctx.inputType !== "sfc") return {};
3344
+ return {
3345
+ CallExpression(path8) {
3346
+ const { node } = path8;
3347
+ const { filename, scriptData } = ctx;
3348
+ if (!isCalleeNamed(node, MACRO_API_NAMES.defaults)) {
3349
+ return;
3350
+ }
3351
+ const declaratorPath = getVariableDeclaratorPath(path8);
3352
+ if (!declaratorPath) {
3353
+ logger.error(
3354
+ `withDefaults() must be assigned to a variable (e.g., const props = withDefaults(...)).`,
3355
+ { file: filename, source: scriptData.source, loc: node.loc }
3356
+ );
3357
+ return;
3358
+ }
3359
+ const varName = t27.isIdentifier(declaratorPath.node.id) ? declaratorPath.node.id.name : void 0;
3360
+ if (!varName) {
3361
+ logger.error("withDefaults() could not determine the variable name from the declaration.", {
3362
+ file: filename,
3363
+ source: scriptData.source,
3364
+ loc: node.loc
3365
+ });
3366
+ return;
3367
+ }
3368
+ ctx.propField = `vr${capitalize(ctx.propField)}`;
3369
+ const [defineProps, defaults] = node.arguments;
3370
+ if (!node.arguments.length) {
3371
+ logger.error("withDefaults() requires at least one argument (defineProps call).", {
3372
+ file: filename,
3373
+ source: scriptData.source,
3374
+ loc: node.loc
3375
+ });
3376
+ return;
3377
+ }
3378
+ if (!t27.isCallExpression(defineProps)) {
3379
+ logger.error(
3380
+ "withDefaults() first argument must be a call to defineProps (e.g., defineProps({...})).",
3381
+ { file: filename, source: scriptData.source, loc: _optionalChain([defineProps, 'optionalAccess', _110 => _110.loc]) }
3382
+ );
3383
+ return;
3384
+ }
3385
+ if (defaults && !t27.isObjectExpression(defaults)) {
3386
+ logger.error(
3387
+ 'withDefaults() second argument must be an object literal (e.g., { msg: "hello" }).',
3388
+ { file: filename, source: scriptData.source, loc: _optionalChain([defaults, 'optionalAccess', _111 => _111.loc]) }
3389
+ );
3390
+ return;
3391
+ }
3392
+ recordPropsWithDefaults(ctx, varName, defineProps, defaults, node);
3393
+ declaratorPath.parentPath.insertAfter(createPlaceholder(node));
3394
+ replaceNode(path8, defineProps, node);
3395
+ }
3396
+ };
3397
+ }
3398
+ function recordPropsWithDefaults(ctx, varName, defineProps, defaults, withDefaults) {
3399
+ const { scriptData } = ctx;
3400
+ const { start, end, loc, leadingComments, innerComments, trailingComments } = withDefaults;
3401
+ const values = flattenDefaultValues(defaults);
3402
+ const getTypeParameters = () => {
3403
+ if (!scriptData.lang.startsWith("ts")) {
3404
+ return;
3405
+ }
3406
+ const { propsTypes } = scriptData.propsTSIface;
3407
+ const typeParameters = defineProps.typeParameters || (propsTypes.length ? t27.tSTypeParameterInstantiation(propsTypes) : void 0);
3408
+ if (typeParameters) {
3409
+ return t27.tsTypeParameterInstantiation([
3410
+ t27.tsTypeReference(t27.identifier("Readonly"), typeParameters)
3411
+ ]);
3412
+ }
3413
+ };
3414
+ scriptData.propsWithDefaults = {
3415
+ varName,
3416
+ values,
3417
+ start,
3418
+ end,
3419
+ loc,
3420
+ leadingComments,
3421
+ innerComments,
3422
+ trailingComments,
3423
+ typeParameters: getTypeParameters()
3424
+ };
3425
+ }
3426
+ function flattenDefaultValues(expr) {
3427
+ if (!expr) return;
3428
+ if (!t27.isObjectExpression(expr)) {
3429
+ return expr;
3430
+ }
3431
+ const properties = expr.properties.map((prop) => {
3432
+ if (!t27.isObjectProperty(prop)) {
3433
+ return prop;
3434
+ }
3435
+ const value = prop.value;
3436
+ if (t27.isArrowFunctionExpression(value) && t27.isBlockStatement(value.body)) {
3437
+ const returnStmt = value.body.body.find(
3438
+ (stmt) => t27.isReturnStatement(stmt)
3439
+ );
3440
+ if (_optionalChain([returnStmt, 'optionalAccess', _112 => _112.argument])) {
3441
+ return t27.objectProperty(prop.key, returnStmt.argument, prop.computed);
3442
+ }
3443
+ }
3444
+ if (t27.isArrowFunctionExpression(value) && !t27.isBlockStatement(value.body)) {
3445
+ return t27.objectProperty(prop.key, value.body, prop.computed);
3446
+ }
3447
+ return prop;
3448
+ });
3449
+ return t27.objectExpression(properties);
3450
+ }
3451
+ function createPlaceholder(node) {
3452
+ const placeholder = t27.emptyStatement();
3453
+ const leadingComments = [
3454
+ {
3455
+ type: "CommentBlock",
3456
+ value: WITH_DEFAULTS_PLACEHOLDER,
3457
+ start: node.start,
3458
+ end: node.end
3459
+ }
3460
+ ];
3461
+ placeholder.leadingComments = leadingComments;
3462
+ return placeholder;
3463
+ }
3464
+
3465
+ // src/core/transform/sfc/script/syntax-processor/postprocess/resolve-with-defaults.ts
3466
+ function resolveWithDefaults(ctx) {
3467
+ const { inputType, scriptData } = ctx;
3468
+ const propsWithDefaults = scriptData.propsWithDefaults;
3469
+ if (inputType !== "sfc" || !_optionalChain([propsWithDefaults, 'optionalAccess', _113 => _113.values])) return {};
3470
+ return {
3471
+ Program: {
3472
+ exit(programPath) {
3473
+ const { body } = programPath.node;
3474
+ const placeholderIndex = findPlaceholderIndex(body);
3475
+ if (placeholderIndex === -1) return;
3476
+ const placeholder = body[placeholderIndex];
3477
+ const { varName, values, typeParameters } = propsWithDefaults;
3478
+ const varDeclaration = createVarDeclaration(
3479
+ varName,
3480
+ values,
3481
+ typeParameters,
3482
+ ctx.propField,
3483
+ propsWithDefaults
3484
+ );
3485
+ varDeclaration.leadingComments = placeholder.leadingComments;
3486
+ body.splice(placeholderIndex, 0, varDeclaration);
3487
+ recordImport(ctx, PACKAGE_NAME.react, REACT_API_MAP.useMemo);
3488
+ }
3489
+ }
3490
+ };
3491
+ }
3492
+ function findPlaceholderIndex(body) {
3493
+ return body.findIndex((stmt) => {
3494
+ if (!t28.isEmptyStatement(stmt) || !stmt.leadingComments) {
3495
+ return false;
3496
+ }
3497
+ return stmt.leadingComments.some(
3498
+ (comment) => comment.type === "CommentBlock" && comment.value === WITH_DEFAULTS_PLACEHOLDER
3499
+ );
3500
+ });
3501
+ }
3502
+ function createVarDeclaration(varName, values, typeParameters, propField, sourceInfo) {
3503
+ const { mergeMembers } = buildMergeLogic(values, propField);
3504
+ const deps = t28.arrayExpression([t28.identifier(propField)]);
3505
+ const useMemoCall = createUseMemo(t28.objectExpression(mergeMembers), deps);
3506
+ if (typeParameters) {
3507
+ useMemoCall.typeParameters = typeParameters;
3508
+ }
3509
+ useMemoCall.start = sourceInfo.start;
3510
+ useMemoCall.end = sourceInfo.end;
3511
+ useMemoCall.loc = sourceInfo.loc;
3512
+ useMemoCall.leadingComments = sourceInfo.leadingComments;
3513
+ useMemoCall.innerComments = sourceInfo.innerComments;
3514
+ useMemoCall.trailingComments = sourceInfo.trailingComments;
3515
+ const varDeclarator = t28.variableDeclarator(t28.identifier(varName), useMemoCall);
3516
+ return t28.variableDeclaration("const", [varDeclarator]);
3517
+ }
3518
+ function buildMergeLogic(values, propField) {
3519
+ const mergeMembers = [];
3520
+ const propFieldIdent = t28.identifier(propField);
3521
+ mergeMembers.push(t28.spreadElement(propFieldIdent));
3522
+ for (const defaultProp of values.properties) {
3523
+ if (!t28.isObjectProperty(defaultProp)) continue;
3524
+ const key = defaultProp.key;
3525
+ if (!t28.isIdentifier(key) && !t28.isStringLiteral(key)) continue;
3526
+ const keyName = t28.isIdentifier(key) ? key.name : key.value;
3527
+ const propAccess = t28.memberExpression(propFieldIdent, t28.identifier(keyName), false);
3528
+ const logicalExpr = t28.logicalExpression("??", propAccess, defaultProp.value);
3529
+ mergeMembers.push(
3530
+ t28.objectProperty(
3531
+ t28.isIdentifier(key) ? t28.identifier(keyName) : t28.stringLiteral(keyName),
3532
+ logicalExpr
3533
+ )
3534
+ );
3535
+ }
3536
+ return { mergeMembers };
3537
+ }
3538
+
3280
3539
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-define-async-component.ts
3281
3540
 
3282
3541
  function resolveDefineAsyncComponent(ctx) {
@@ -3287,11 +3546,11 @@ function resolveDefineAsyncComponent(ctx) {
3287
3546
  return;
3288
3547
  }
3289
3548
  const [arg] = node.arguments;
3290
- if (!t26.isObjectExpression(arg)) {
3549
+ if (!t29.isObjectExpression(arg)) {
3291
3550
  return;
3292
3551
  }
3293
3552
  for (const prop of arg.properties) {
3294
- if (!t26.isObjectProperty(prop) || !t26.isIdentifier(prop.key) || prop.key.name !== "hydrate") {
3553
+ if (!t29.isObjectProperty(prop) || !t29.isIdentifier(prop.key) || prop.key.name !== "hydrate") {
3295
3554
  continue;
3296
3555
  }
3297
3556
  logger.warn('Unsupported option "hydrate"', {
@@ -3307,26 +3566,6 @@ function resolveDefineAsyncComponent(ctx) {
3307
3566
 
3308
3567
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-define-expose.ts
3309
3568
 
3310
-
3311
- // src/core/transform/sfc/script/shared/hook-creator.ts
3312
-
3313
- function createUseCallback(body, deps) {
3314
- return t27.callExpression(t27.identifier(REACT_API_MAP.useCallback), [
3315
- body,
3316
- _nullishCoalesce(deps, () => ( t27.arrayExpression([])))
3317
- ]);
3318
- }
3319
- function createUseMemo(body, deps) {
3320
- return t27.callExpression(t27.identifier(REACT_API_MAP.useMemo), [
3321
- t27.arrowFunctionExpression([], body),
3322
- _nullishCoalesce(deps, () => ( t27.arrayExpression([])))
3323
- ]);
3324
- }
3325
- function createUseImperativeHandle(refId, init) {
3326
- return t27.callExpression(t27.identifier(REACT_API_MAP.useImperativeHandle), [refId, init]);
3327
- }
3328
-
3329
- // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-define-expose.ts
3330
3569
  function resolveDefineExpose(ctx) {
3331
3570
  if (ctx.inputType !== "sfc") return {};
3332
3571
  return {
@@ -3344,22 +3583,242 @@ function resolveDefineExpose(ctx) {
3344
3583
  const adapter = ADAPTER_RULES.react[MACRO_API_NAMES.expose];
3345
3584
  recordImport(ctx, adapter.package, REACT_API_MAP.forwardRef);
3346
3585
  recordImport(ctx, adapter.package, adapter.target);
3347
- if (!t28.isObjectExpression(expose) && !t28.isFunction(expose)) {
3586
+ if (!t30.isObjectExpression(expose) && !t30.isFunction(expose)) {
3348
3587
  logger.warn("Non-deterministic object literal may cause unknown risks.", {
3349
3588
  file: filename,
3350
3589
  loc: expose.loc,
3351
3590
  source: scriptData.source
3352
3591
  });
3353
3592
  }
3354
- const init = !t28.isFunction(expose) ? t28.arrowFunctionExpression([], expose) : expose;
3593
+ const init = !t30.isFunction(expose) ? t30.arrowFunctionExpression([], expose) : expose;
3355
3594
  const { forwardRef } = scriptData;
3356
- const newNode = createUseImperativeHandle(t28.identifier(forwardRef.refField), init);
3595
+ const newNode = createUseImperativeHandle(t30.identifier(forwardRef.refField), init);
3357
3596
  forwardRef.enabled = true;
3358
3597
  replaceNode(path8, newNode, node);
3359
3598
  }
3360
3599
  };
3361
3600
  }
3362
3601
 
3602
+ // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-define-model.ts
3603
+
3604
+ function resolveDefineModel(ctx, ast) {
3605
+ if (ctx.inputType !== "sfc") return {};
3606
+ return {
3607
+ CallExpression(path8) {
3608
+ const { node } = path8;
3609
+ if (!isCalleeNamed(node, MACRO_API_NAMES.model)) {
3610
+ return;
3611
+ }
3612
+ if (!validateDefineModelUsage(path8, ctx)) {
3613
+ return;
3614
+ }
3615
+ const propInfo = extractPropInfo(node, ctx);
3616
+ replaceToUseVRef(node, propInfo, ctx);
3617
+ resolveAutoUpdate(ast, path8, propInfo, ctx);
3618
+ resolveInterface(propInfo, ctx);
3619
+ }
3620
+ };
3621
+ }
3622
+ function validateDefineModelUsage(path8, ctx) {
3623
+ const { node, parent } = path8;
3624
+ const { filename, scriptData } = ctx;
3625
+ const [arg1, arg2] = node.arguments;
3626
+ if (!t31.isObjectExpression(arg1) && !t31.isStringLiteral(arg1)) {
3627
+ logger.error(`Invalid argument type for defineModel. Expected a string.`, {
3628
+ file: filename,
3629
+ source: scriptData.source,
3630
+ loc: _optionalChain([arg1, 'optionalAccess', _114 => _114.loc])
3631
+ });
3632
+ return false;
3633
+ }
3634
+ const hasUnsupportedOption = (arg) => {
3635
+ if (!t31.isObjectExpression(arg)) {
3636
+ return false;
3637
+ }
3638
+ const result = arg.properties.some((prop) => {
3639
+ if ((t31.isObjectProperty(prop) || t31.isObjectMethod(prop)) && t31.isIdentifier(prop.key)) {
3640
+ const keyName = prop.key.name;
3641
+ if (keyName === "get" || keyName === "set" || keyName === "validator") {
3642
+ logger.error(`defineModel does not support '${keyName}' option.`, {
3643
+ file: filename,
3644
+ source: scriptData.source,
3645
+ loc: prop.key.loc
3646
+ });
3647
+ return true;
3648
+ }
3649
+ }
3650
+ });
3651
+ return !!result;
3652
+ };
3653
+ const isValidVariableAssignment = () => {
3654
+ const varDeclaration = path8.parentPath.parentPath;
3655
+ if (_optionalChain([varDeclaration, 'optionalAccess', _115 => _115.isVariableDeclaration, 'call', _116 => _116()]) && varDeclaration.node.declarations.length === 1 && t31.isArrayPattern(_optionalChain([varDeclaration, 'access', _117 => _117.node, 'access', _118 => _118.declarations, 'access', _119 => _119[0], 'optionalAccess', _120 => _120.id]))) {
3656
+ logger.error(
3657
+ `defineModel return value cannot be destructured with array pattern. Please use single variable assignment.`,
3658
+ {
3659
+ file: filename,
3660
+ source: scriptData.source,
3661
+ loc: varDeclaration.node.loc
3662
+ }
3663
+ );
3664
+ return false;
3665
+ }
3666
+ return true;
3667
+ };
3668
+ return !hasUnsupportedOption(arg1) && !hasUnsupportedOption(arg2) && isValidVariableAssignment();
3669
+ }
3670
+ function extractPropInfo(node, ctx) {
3671
+ const [arg1, arg2] = node.arguments;
3672
+ const propInfo = {
3673
+ name: "modelValue",
3674
+ updateEventName: "onUpdateModelValue",
3675
+ type: void 0,
3676
+ required: false,
3677
+ default: void 0
3678
+ };
3679
+ const findObjectProperty = (objExpr, propName) => {
3680
+ return objExpr.properties.find(
3681
+ (prop) => t31.isObjectProperty(prop) && t31.isIdentifier(prop.key) && prop.key.name === propName
3682
+ );
3683
+ };
3684
+ const setPropName = (info, value) => {
3685
+ if (!value.trim()) return;
3686
+ info.name = value;
3687
+ info.updateEventName = `onUpdate${capitalize(camelCase(value))}`;
3688
+ };
3689
+ const extractPropInfoFromObject = (objExpr) => {
3690
+ const result = {};
3691
+ const nameProp = findObjectProperty(objExpr, "name");
3692
+ const typeProp = findObjectProperty(objExpr, "type");
3693
+ const defaultProp = findObjectProperty(objExpr, "default");
3694
+ const requiredProp = findObjectProperty(objExpr, "required");
3695
+ if (nameProp && t31.isStringLiteral(nameProp.value)) {
3696
+ setPropName(result, nameProp.value.value);
3697
+ }
3698
+ if (defaultProp) {
3699
+ result.default = defaultProp.value;
3700
+ }
3701
+ if (requiredProp && t31.isBooleanLiteral(requiredProp.value)) {
3702
+ result.required = requiredProp.value.value;
3703
+ }
3704
+ if (typeProp && t31.isIdentifier(typeProp.value)) {
3705
+ result.type = mapRuntimeTypeToTSType(typeProp.value);
3706
+ } else if (node.typeParameters) {
3707
+ const [typeParam] = node.typeParameters.params;
3708
+ if (t31.isTSType(typeParam)) {
3709
+ result.type = typeParam;
3710
+ }
3711
+ } else if (defaultProp) {
3712
+ result.type = expressionToTSType(defaultProp.value);
3713
+ }
3714
+ return result;
3715
+ };
3716
+ const safeAssign = (target, source) => {
3717
+ if (source.name !== void 0) {
3718
+ target.name = source.name;
3719
+ }
3720
+ if (source.updateEventName !== void 0) {
3721
+ target.updateEventName = source.updateEventName;
3722
+ }
3723
+ if (source.type !== void 0) {
3724
+ target.type = source.type;
3725
+ }
3726
+ if (source.required !== void 0) {
3727
+ target.required = source.required;
3728
+ }
3729
+ if (source.default !== void 0) {
3730
+ target.default = source.default;
3731
+ }
3732
+ };
3733
+ const extractTypeFromTypeParams = (info) => {
3734
+ if (!node.typeParameters) return;
3735
+ const isDefaultAny = !info.type || t31.isTSAnyKeyword(info.type);
3736
+ if (!isDefaultAny) return;
3737
+ const [typeParam] = node.typeParameters.params;
3738
+ if (t31.isTSType(typeParam)) {
3739
+ info.type = typeParam;
3740
+ }
3741
+ };
3742
+ if (t31.isStringLiteral(arg1)) {
3743
+ setPropName(propInfo, arg1.value);
3744
+ extractTypeFromTypeParams(propInfo);
3745
+ } else if (t31.isObjectExpression(arg1)) {
3746
+ safeAssign(propInfo, extractPropInfoFromObject(arg1));
3747
+ }
3748
+ if (!t31.isObjectExpression(arg1) && t31.isObjectExpression(arg2)) {
3749
+ safeAssign(propInfo, extractPropInfoFromObject(arg2));
3750
+ }
3751
+ return propInfo;
3752
+ }
3753
+ function replaceToUseVRef(node, propInfo, ctx) {
3754
+ const refAdapter = ADAPTER_RULES.runtime.ref;
3755
+ replaceCallName(node, refAdapter.target);
3756
+ recordImport(ctx, refAdapter.package, refAdapter.target);
3757
+ const defaultValue = propInfo.default;
3758
+ const propRef = t31.identifier(`${ctx.propField}.${propInfo.name}`);
3759
+ if (!defaultValue) {
3760
+ node.arguments = [propRef];
3761
+ } else {
3762
+ node.arguments = [t31.logicalExpression("??", propRef, defaultValue)];
3763
+ }
3764
+ if (ctx.scriptData.lang.startsWith("ts") && !node.typeParameters && propInfo.type) {
3765
+ node.typeParameters = t31.tsTypeParameterInstantiation([propInfo.type]);
3766
+ }
3767
+ }
3768
+ function resolveAutoUpdate(ast, path8, propInfo, ctx) {
3769
+ const { parent } = path8;
3770
+ if (!t31.isVariableDeclarator(parent)) {
3771
+ return;
3772
+ }
3773
+ const modelId = parent.id;
3774
+ if (!t31.isIdentifier(modelId)) {
3775
+ return;
3776
+ }
3777
+ const memberAccess = t31.memberExpression(
3778
+ t31.identifier(ctx.propField),
3779
+ t31.identifier(propInfo.updateEventName)
3780
+ );
3781
+ const dep = t31.memberExpression(modelId, t31.identifier("value"));
3782
+ const updateCall = t31.optionalCallExpression(memberAccess, [dep], true);
3783
+ const callExpr = createUseUpdated(
3784
+ t31.blockStatement([t31.expressionStatement(updateCall)]),
3785
+ t31.arrayExpression([dep])
3786
+ );
3787
+ ast.program.body.push(t31.expressionStatement(callExpr));
3788
+ const adapter = ADAPTER_RULES.runtime.onUpdated;
3789
+ recordImport(ctx, adapter.package, adapter.target);
3790
+ }
3791
+ function resolveInterface(propInfo, ctx) {
3792
+ const { name, updateEventName, required } = propInfo;
3793
+ const { lang, propsTSIface } = ctx.scriptData;
3794
+ if (!lang.startsWith("ts")) {
3795
+ return;
3796
+ }
3797
+ const propType = propInfo.type || t31.tsAnyKeyword();
3798
+ const propSignature = t31.tsPropertySignature(
3799
+ t31.isValidIdentifier(name) ? t31.identifier(name) : t31.stringLiteral(name),
3800
+ t31.tsTypeAnnotation(propType)
3801
+ );
3802
+ propSignature.optional = !required;
3803
+ const emitArg = t31.identifier("arg");
3804
+ emitArg.typeAnnotation = t31.tsTypeAnnotation(propType);
3805
+ const emitSignature = t31.tsPropertySignature(
3806
+ t31.isValidIdentifier(updateEventName) ? t31.identifier(updateEventName) : t31.stringLiteral(updateEventName),
3807
+ t31.tsTypeAnnotation(t31.tsFunctionType(null, [emitArg], t31.tsTypeAnnotation(t31.tsVoidKeyword())))
3808
+ );
3809
+ emitSignature.optional = true;
3810
+ const appendToTypeLiteral = (list, member) => {
3811
+ const existing = list.find((item) => t31.isTSTypeLiteral(item));
3812
+ if (existing) {
3813
+ existing.members.push(member);
3814
+ } else {
3815
+ list.push(t31.tsTypeLiteral([member]));
3816
+ }
3817
+ };
3818
+ appendToTypeLiteral(propsTSIface.propsTypes, propSignature);
3819
+ appendToTypeLiteral(propsTSIface.emitTypes, emitSignature);
3820
+ }
3821
+
3363
3822
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-define-options.ts
3364
3823
  function resolveDefineOptions(ctx) {
3365
3824
  return {
@@ -3388,7 +3847,7 @@ function resolveEmitCalls(ctx) {
3388
3847
  CallExpression(path8) {
3389
3848
  const { node } = path8;
3390
3849
  const { filename, templateData, scriptData } = ctx;
3391
- if (!t29.isIdentifier(node.callee)) return;
3850
+ if (!t32.isIdentifier(node.callee)) return;
3392
3851
  const { name } = node.callee;
3393
3852
  const checkIfFromDefineEmits = () => {
3394
3853
  let result = false;
@@ -3400,7 +3859,7 @@ function resolveEmitCalls(ctx) {
3400
3859
  const binding = path8.scope.getBinding(name);
3401
3860
  if (binding) {
3402
3861
  const parent = binding.path.node;
3403
- if (t29.isVariableDeclarator(parent) && t29.isCallExpression(parent.init) && t29.isIdentifier(parent.init.callee)) {
3862
+ if (t32.isVariableDeclarator(parent) && t32.isCallExpression(parent.init) && t32.isIdentifier(parent.init.callee)) {
3404
3863
  result = parent.init.callee.name === MACRO_API_NAMES.emits;
3405
3864
  }
3406
3865
  }
@@ -3410,9 +3869,9 @@ function resolveEmitCalls(ctx) {
3410
3869
  if (!checkIfFromDefineEmits()) return;
3411
3870
  const [callee, ...args] = node.arguments;
3412
3871
  let propCall;
3413
- if (t29.isStringLiteral(callee)) {
3872
+ if (t32.isStringLiteral(callee)) {
3414
3873
  const eventName = formatEmitEventName(callee.value);
3415
- propCall = createPropCall(ctx.propField, t29.identifier(eventName), args);
3874
+ propCall = createPropCall(ctx.propField, t32.identifier(eventName), args);
3416
3875
  } else {
3417
3876
  propCall = createPropCall(ctx.propField, callee, args, true);
3418
3877
  logger.error(
@@ -3420,7 +3879,7 @@ function resolveEmitCalls(ctx) {
3420
3879
  {
3421
3880
  file: filename,
3422
3881
  source: scriptData.source,
3423
- loc: _optionalChain([callee, 'optionalAccess', _106 => _106.loc])
3882
+ loc: _optionalChain([callee, 'optionalAccess', _121 => _121.loc])
3424
3883
  }
3425
3884
  );
3426
3885
  }
@@ -3429,8 +3888,8 @@ function resolveEmitCalls(ctx) {
3429
3888
  };
3430
3889
  }
3431
3890
  function createPropCall(rootName, callee, args, computed = false) {
3432
- return t29.optionalCallExpression(
3433
- t29.memberExpression(t29.identifier(rootName), callee, computed),
3891
+ return t32.optionalCallExpression(
3892
+ t32.memberExpression(t32.identifier(rootName), callee, computed),
3434
3893
  args,
3435
3894
  true
3436
3895
  );
@@ -3446,21 +3905,21 @@ function createPropCall(rootName, callee, args, computed = false) {
3446
3905
 
3447
3906
  function cloneCallableParams(params) {
3448
3907
  const cloneCallableParam = (param, index) => {
3449
- if (t30.isRestElement(param)) {
3908
+ if (t33.isRestElement(param)) {
3450
3909
  const arg = param.argument;
3451
- const name = t30.isIdentifier(arg) ? arg.name : `args${index}`;
3452
- const rest = t30.restElement(t30.identifier(name));
3453
- rest.typeAnnotation = param.typeAnnotation || (t30.isIdentifier(arg) ? arg.typeAnnotation : null) || t30.tsTypeAnnotation(t30.tsArrayType(t30.tsAnyKeyword()));
3910
+ const name = t33.isIdentifier(arg) ? arg.name : `args${index}`;
3911
+ const rest = t33.restElement(t33.identifier(name));
3912
+ rest.typeAnnotation = param.typeAnnotation || (t33.isIdentifier(arg) ? arg.typeAnnotation : null) || t33.tsTypeAnnotation(t33.tsArrayType(t33.tsAnyKeyword()));
3454
3913
  return rest;
3455
3914
  }
3456
- if (t30.isIdentifier(param)) {
3457
- const id = t30.identifier(param.name || `arg${index}`);
3915
+ if (t33.isIdentifier(param)) {
3916
+ const id = t33.identifier(param.name || `arg${index}`);
3458
3917
  id.optional = param.optional;
3459
- id.typeAnnotation = param.typeAnnotation || t30.tsTypeAnnotation(t30.tsAnyKeyword());
3918
+ id.typeAnnotation = param.typeAnnotation || t33.tsTypeAnnotation(t33.tsAnyKeyword());
3460
3919
  return id;
3461
3920
  }
3462
- const fallback = t30.identifier(`arg${index}`);
3463
- fallback.typeAnnotation = t30.tsTypeAnnotation(t30.tsAnyKeyword());
3921
+ const fallback = t33.identifier(`arg${index}`);
3922
+ fallback.typeAnnotation = t33.tsTypeAnnotation(t33.tsAnyKeyword());
3464
3923
  return fallback;
3465
3924
  };
3466
3925
  return params.map(cloneCallableParam);
@@ -3470,18 +3929,18 @@ function cloneCallableParams(params) {
3470
3929
  function resolveEmitsTopLevelTypes(ctx) {
3471
3930
  return {
3472
3931
  "TSInterfaceDeclaration|TSTypeAliasDeclaration"(path8) {
3473
- if (!t31.isProgram(path8.parent)) return;
3932
+ if (!t34.isProgram(path8.parent)) return;
3474
3933
  const { node } = path8;
3475
- if (t31.isTSInterfaceDeclaration(node)) {
3476
- const typeLiteral = t31.tsTypeLiteral(node.body.body);
3934
+ if (t34.isTSInterfaceDeclaration(node)) {
3935
+ const typeLiteral = t34.tsTypeLiteral(node.body.body);
3477
3936
  if (!hasEmitsSignatureInType(typeLiteral)) return;
3478
3937
  const resolved = resolveTopLevelEmitType(typeLiteral);
3479
- if (resolved && t31.isTSTypeLiteral(resolved)) {
3938
+ if (resolved && t34.isTSTypeLiteral(resolved)) {
3480
3939
  node.body.body = resolved.members;
3481
3940
  }
3482
3941
  return;
3483
3942
  }
3484
- if (t31.isTSTypeAliasDeclaration(node)) {
3943
+ if (t34.isTSTypeAliasDeclaration(node)) {
3485
3944
  if (!hasEmitsSignatureInType(node.typeAnnotation)) return;
3486
3945
  const resolved = resolveTopLevelEmitType(node.typeAnnotation);
3487
3946
  if (resolved) {
@@ -3492,55 +3951,55 @@ function resolveEmitsTopLevelTypes(ctx) {
3492
3951
  };
3493
3952
  }
3494
3953
  function resolveTopLevelEmitType(tsType) {
3495
- if (t31.isTSParenthesizedType(tsType)) {
3954
+ if (t34.isTSParenthesizedType(tsType)) {
3496
3955
  return resolveTopLevelEmitType(tsType.typeAnnotation);
3497
3956
  }
3498
- if (t31.isTSTypeReference(tsType)) {
3957
+ if (t34.isTSTypeReference(tsType)) {
3499
3958
  if (!tsType.typeParameters || !tsType.typeParameters.params.length) {
3500
3959
  return tsType;
3501
3960
  }
3502
3961
  const params = tsType.typeParameters.params.map((param) => resolveTopLevelEmitType(param)).filter(Boolean);
3503
- return t31.tsTypeReference(
3962
+ return t34.tsTypeReference(
3504
3963
  tsType.typeName,
3505
- t31.tsTypeParameterInstantiation(params.length ? params : tsType.typeParameters.params)
3964
+ t34.tsTypeParameterInstantiation(params.length ? params : tsType.typeParameters.params)
3506
3965
  );
3507
3966
  }
3508
- if (t31.isTSIntersectionType(tsType)) {
3967
+ if (t34.isTSIntersectionType(tsType)) {
3509
3968
  const types = tsType.types.map(resolveTopLevelEmitType).filter(Boolean);
3510
3969
  if (!types.length) return null;
3511
3970
  if (types.length === 1) return types[0];
3512
- return t31.tsIntersectionType(types);
3971
+ return t34.tsIntersectionType(types);
3513
3972
  }
3514
- if (t31.isTSUnionType(tsType)) {
3973
+ if (t34.isTSUnionType(tsType)) {
3515
3974
  const types = tsType.types.map(resolveTopLevelEmitType).filter(Boolean);
3516
3975
  if (!types.length) return null;
3517
3976
  if (types.length === 1) return types[0];
3518
- return t31.tsUnionType(types);
3977
+ return t34.tsUnionType(types);
3519
3978
  }
3520
- if (t31.isTSTypeLiteral(tsType)) {
3979
+ if (t34.isTSTypeLiteral(tsType)) {
3521
3980
  const members = [];
3522
3981
  for (const member of tsType.members) {
3523
- if (t31.isTSCallSignatureDeclaration(member)) {
3982
+ if (t34.isTSCallSignatureDeclaration(member)) {
3524
3983
  members.push(...resolveEmitPropsFromCallSignature(member));
3525
3984
  continue;
3526
3985
  }
3527
3986
  members.push(member);
3528
3987
  }
3529
3988
  if (!members.length) return null;
3530
- return t31.tsTypeLiteral(members);
3989
+ return t34.tsTypeLiteral(members);
3531
3990
  }
3532
- if (t31.isTSFunctionType(tsType)) {
3991
+ if (t34.isTSFunctionType(tsType)) {
3533
3992
  const props = resolveEmitPropsFromCallable(tsType.parameters, tsType.typeAnnotation);
3534
3993
  if (!props.length) return null;
3535
- return t31.tsTypeLiteral(props);
3994
+ return t34.tsTypeLiteral(props);
3536
3995
  }
3537
3996
  return tsType;
3538
3997
  }
3539
3998
  function resolveDefineEmitsIface(path8, ctx) {
3540
3999
  const { node } = path8;
3541
4000
  const [runtimeArg] = node.arguments;
3542
- const tsParams = _optionalChain([node, 'access', _107 => _107.typeParameters, 'optionalAccess', _108 => _108.params]);
3543
- if (_optionalChain([tsParams, 'optionalAccess', _109 => _109.length])) {
4001
+ const tsParams = _optionalChain([node, 'access', _122 => _122.typeParameters, 'optionalAccess', _123 => _123.params]);
4002
+ if (_optionalChain([tsParams, 'optionalAccess', _124 => _124.length])) {
3544
4003
  processExplicitType(ctx, tsParams);
3545
4004
  return;
3546
4005
  }
@@ -3553,41 +4012,41 @@ function processInferredTypes(ctx, runtimeArg) {
3553
4012
  propsTSIface: { emitTypes }
3554
4013
  } = ctx.scriptData;
3555
4014
  const members = [];
3556
- if (t31.isArrayExpression(runtimeArg)) {
4015
+ if (t34.isArrayExpression(runtimeArg)) {
3557
4016
  for (const element of runtimeArg.elements) {
3558
- if (!element || !t31.isStringLiteral(element)) continue;
4017
+ if (!element || !t34.isStringLiteral(element)) continue;
3559
4018
  const handlerName = resolveEmitHandlerName(element.value);
3560
4019
  const key = buildKey(handlerName);
3561
- const fnType = t31.tsFunctionType(
4020
+ const fnType = t34.tsFunctionType(
3562
4021
  null,
3563
4022
  [createRestAnyParam("args")],
3564
- t31.tsTypeAnnotation(t31.tsAnyKeyword())
4023
+ t34.tsTypeAnnotation(t34.tsAnyKeyword())
3565
4024
  );
3566
- const prop = t31.tsPropertySignature(key, t31.tsTypeAnnotation(fnType));
4025
+ const prop = t34.tsPropertySignature(key, t34.tsTypeAnnotation(fnType));
3567
4026
  prop.optional = true;
3568
4027
  members.push(prop);
3569
4028
  }
3570
4029
  if (members.length) {
3571
- emitTypes.push(t31.tsTypeLiteral(members));
4030
+ emitTypes.push(t34.tsTypeLiteral(members));
3572
4031
  }
3573
4032
  return;
3574
4033
  }
3575
- if (t31.isObjectExpression(runtimeArg)) {
4034
+ if (t34.isObjectExpression(runtimeArg)) {
3576
4035
  for (const prop of runtimeArg.properties) {
3577
- if (!t31.isObjectProperty(prop)) continue;
3578
- if (t31.isSpreadElement(prop)) continue;
4036
+ if (!t34.isObjectProperty(prop)) continue;
4037
+ if (t34.isSpreadElement(prop)) continue;
3579
4038
  const rawName = resolvePropName(prop.key);
3580
4039
  if (!rawName) continue;
3581
4040
  const handlerName = resolveEmitHandlerName(rawName);
3582
4041
  const key = buildKey(handlerName);
3583
- const params = t31.isArrayExpression(prop.value) ? resolveRuntimeTupleParams(prop.value) : [createRestAnyParam("args")];
3584
- const fnType = t31.tsFunctionType(null, params, t31.tsTypeAnnotation(t31.tsAnyKeyword()));
3585
- const propSig = t31.tsPropertySignature(key, t31.tsTypeAnnotation(fnType));
4042
+ const params = t34.isArrayExpression(prop.value) ? resolveRuntimeTupleParams(prop.value) : [createRestAnyParam("args")];
4043
+ const fnType = t34.tsFunctionType(null, params, t34.tsTypeAnnotation(t34.tsAnyKeyword()));
4044
+ const propSig = t34.tsPropertySignature(key, t34.tsTypeAnnotation(fnType));
3586
4045
  propSig.optional = true;
3587
4046
  members.push(propSig);
3588
4047
  }
3589
4048
  if (members.length) {
3590
- emitTypes.push(t31.tsTypeLiteral(members));
4049
+ emitTypes.push(t34.tsTypeLiteral(members));
3591
4050
  }
3592
4051
  }
3593
4052
  }
@@ -3608,129 +4067,129 @@ function resolveEmitHandlerName(rawName) {
3608
4067
  return `on${name}`;
3609
4068
  }
3610
4069
  function resolvePropName(key) {
3611
- if (t31.isIdentifier(key)) return key.name;
3612
- if (t31.isStringLiteral(key)) return key.value;
3613
- if (t31.isNumericLiteral(key)) return String(key.value);
4070
+ if (t34.isIdentifier(key)) return key.name;
4071
+ if (t34.isStringLiteral(key)) return key.value;
4072
+ if (t34.isNumericLiteral(key)) return String(key.value);
3614
4073
  return null;
3615
4074
  }
3616
4075
  function buildKey(name) {
3617
- return t31.isValidIdentifier(name) ? t31.identifier(name) : t31.stringLiteral(name);
4076
+ return t34.isValidIdentifier(name) ? t34.identifier(name) : t34.stringLiteral(name);
3618
4077
  }
3619
4078
  function createRestAnyParam(name) {
3620
- const id = t31.identifier(name);
3621
- const rest = t31.restElement(id);
3622
- rest.typeAnnotation = t31.tsTypeAnnotation(t31.tsArrayType(t31.tsAnyKeyword()));
4079
+ const id = t34.identifier(name);
4080
+ const rest = t34.restElement(id);
4081
+ rest.typeAnnotation = t34.tsTypeAnnotation(t34.tsArrayType(t34.tsAnyKeyword()));
3623
4082
  return rest;
3624
4083
  }
3625
4084
  function resolveRuntimeTupleParams(value) {
3626
4085
  const params = [];
3627
4086
  value.elements.forEach((element, index) => {
3628
4087
  if (!element) return;
3629
- if (t31.isSpreadElement(element)) {
4088
+ if (t34.isSpreadElement(element)) {
3630
4089
  params.push(createRestAnyParam(`args${index}`));
3631
4090
  return;
3632
4091
  }
3633
- if (t31.isIdentifier(element)) {
3634
- const id = t31.identifier(element.name);
3635
- id.typeAnnotation = element.typeAnnotation || t31.tsTypeAnnotation(t31.tsAnyKeyword());
4092
+ if (t34.isIdentifier(element)) {
4093
+ const id = t34.identifier(element.name);
4094
+ id.typeAnnotation = element.typeAnnotation || t34.tsTypeAnnotation(t34.tsAnyKeyword());
3636
4095
  params.push(id);
3637
4096
  return;
3638
4097
  }
3639
- if (t31.isTSAsExpression(element)) {
3640
- const id = t31.identifier(`arg${index}`);
3641
- id.typeAnnotation = t31.tsTypeAnnotation(element.typeAnnotation);
4098
+ if (t34.isTSAsExpression(element)) {
4099
+ const id = t34.identifier(`arg${index}`);
4100
+ id.typeAnnotation = t34.tsTypeAnnotation(element.typeAnnotation);
3642
4101
  params.push(id);
3643
4102
  return;
3644
4103
  }
3645
- const fallback = t31.identifier(`arg${index}`);
3646
- fallback.typeAnnotation = t31.tsTypeAnnotation(t31.tsAnyKeyword());
4104
+ const fallback = t34.identifier(`arg${index}`);
4105
+ fallback.typeAnnotation = t34.tsTypeAnnotation(t34.tsAnyKeyword());
3647
4106
  params.push(fallback);
3648
4107
  });
3649
4108
  return params;
3650
4109
  }
3651
4110
  function resolveExplicitEmitType(tsType) {
3652
- if (t31.isTSParenthesizedType(tsType)) {
4111
+ if (t34.isTSParenthesizedType(tsType)) {
3653
4112
  return resolveExplicitEmitType(tsType.typeAnnotation);
3654
4113
  }
3655
- if (t31.isTSTypeReference(tsType)) {
4114
+ if (t34.isTSTypeReference(tsType)) {
3656
4115
  if (!tsType.typeParameters || !tsType.typeParameters.params.length) {
3657
4116
  return tsType;
3658
4117
  }
3659
4118
  const params = tsType.typeParameters.params.map((param) => resolveExplicitEmitType(param)).filter(Boolean);
3660
- return t31.tsTypeReference(
4119
+ return t34.tsTypeReference(
3661
4120
  tsType.typeName,
3662
- t31.tsTypeParameterInstantiation(params.length ? params : tsType.typeParameters.params)
4121
+ t34.tsTypeParameterInstantiation(params.length ? params : tsType.typeParameters.params)
3663
4122
  );
3664
4123
  }
3665
- if (t31.isTSIntersectionType(tsType)) {
4124
+ if (t34.isTSIntersectionType(tsType)) {
3666
4125
  const types = tsType.types.map(resolveExplicitEmitType).filter(Boolean);
3667
4126
  if (!types.length) return null;
3668
4127
  if (types.length === 1) return types[0];
3669
- return t31.tsIntersectionType(types);
4128
+ return t34.tsIntersectionType(types);
3670
4129
  }
3671
- if (t31.isTSUnionType(tsType)) {
4130
+ if (t34.isTSUnionType(tsType)) {
3672
4131
  const types = tsType.types.map(resolveExplicitEmitType).filter(Boolean);
3673
4132
  if (!types.length) return null;
3674
4133
  if (types.length === 1) return types[0];
3675
- return t31.tsUnionType(types);
4134
+ return t34.tsUnionType(types);
3676
4135
  }
3677
- if (t31.isTSTypeLiteral(tsType)) {
4136
+ if (t34.isTSTypeLiteral(tsType)) {
3678
4137
  const members = [];
3679
4138
  for (const member of tsType.members) {
3680
- if (t31.isTSPropertySignature(member)) {
4139
+ if (t34.isTSPropertySignature(member)) {
3681
4140
  const prop = resolveEmitPropFromPropertySignature(member);
3682
4141
  if (prop) members.push(prop);
3683
4142
  continue;
3684
4143
  }
3685
- if (t31.isTSCallSignatureDeclaration(member)) {
4144
+ if (t34.isTSCallSignatureDeclaration(member)) {
3686
4145
  members.push(...resolveEmitPropsFromCallSignature(member));
3687
4146
  continue;
3688
4147
  }
3689
4148
  }
3690
4149
  if (!members.length) return null;
3691
- return t31.tsTypeLiteral(members);
4150
+ return t34.tsTypeLiteral(members);
3692
4151
  }
3693
- if (t31.isTSFunctionType(tsType)) {
4152
+ if (t34.isTSFunctionType(tsType)) {
3694
4153
  const props = resolveEmitPropsFromCallable(tsType.parameters, tsType.typeAnnotation);
3695
4154
  if (!props.length) return null;
3696
- return t31.tsTypeLiteral(props);
4155
+ return t34.tsTypeLiteral(props);
3697
4156
  }
3698
4157
  return tsType;
3699
4158
  }
3700
4159
  function hasEmitsSignatureInType(tsType) {
3701
- if (t31.isTSParenthesizedType(tsType)) {
4160
+ if (t34.isTSParenthesizedType(tsType)) {
3702
4161
  return hasEmitsSignatureInType(tsType.typeAnnotation);
3703
4162
  }
3704
- if (t31.isTSTypeReference(tsType)) {
4163
+ if (t34.isTSTypeReference(tsType)) {
3705
4164
  if (!tsType.typeParameters || !tsType.typeParameters.params.length) {
3706
4165
  return false;
3707
4166
  }
3708
4167
  return tsType.typeParameters.params.some(hasEmitsSignatureInType);
3709
4168
  }
3710
- if (t31.isTSIntersectionType(tsType) || t31.isTSUnionType(tsType)) {
4169
+ if (t34.isTSIntersectionType(tsType) || t34.isTSUnionType(tsType)) {
3711
4170
  return tsType.types.some(hasEmitsSignatureInType);
3712
4171
  }
3713
- if (t31.isTSTypeLiteral(tsType)) {
4172
+ if (t34.isTSTypeLiteral(tsType)) {
3714
4173
  return tsType.members.some(hasEmitsSignatureInMember);
3715
4174
  }
3716
- if (t31.isTSFunctionType(tsType)) {
4175
+ if (t34.isTSFunctionType(tsType)) {
3717
4176
  return isEmitsCallable(tsType.parameters);
3718
4177
  }
3719
4178
  return false;
3720
4179
  }
3721
4180
  function hasEmitsSignatureInMember(member) {
3722
- if (t31.isTSCallSignatureDeclaration(member)) {
4181
+ if (t34.isTSCallSignatureDeclaration(member)) {
3723
4182
  return isEmitsCallable(member.parameters);
3724
4183
  }
3725
4184
  return false;
3726
4185
  }
3727
4186
  function isEmitsCallable(parameters) {
3728
4187
  const [eventParam] = parameters;
3729
- if (!eventParam || !t31.isIdentifier(eventParam) || !eventParam.typeAnnotation) {
4188
+ if (!eventParam || !t34.isIdentifier(eventParam) || !eventParam.typeAnnotation) {
3730
4189
  return false;
3731
4190
  }
3732
4191
  const { typeAnnotation } = eventParam;
3733
- if (t31.isNoop(typeAnnotation)) return false;
4192
+ if (t34.isNoop(typeAnnotation)) return false;
3734
4193
  return resolveEventNames(typeAnnotation.typeAnnotation).length > 0;
3735
4194
  }
3736
4195
  function resolveEmitPropFromPropertySignature(member) {
@@ -3738,21 +4197,21 @@ function resolveEmitPropFromPropertySignature(member) {
3738
4197
  if (!rawName) return null;
3739
4198
  const handlerName = resolveEmitHandlerName(rawName);
3740
4199
  const key = buildKey(handlerName);
3741
- const typeAnnotation = _optionalChain([member, 'access', _110 => _110.typeAnnotation, 'optionalAccess', _111 => _111.typeAnnotation]);
4200
+ const typeAnnotation = _optionalChain([member, 'access', _125 => _125.typeAnnotation, 'optionalAccess', _126 => _126.typeAnnotation]);
3742
4201
  let params = [];
3743
- let returnType = t31.tsAnyKeyword();
3744
- if (typeAnnotation && t31.isTSFunctionType(typeAnnotation)) {
4202
+ let returnType = t34.tsAnyKeyword();
4203
+ if (typeAnnotation && t34.isTSFunctionType(typeAnnotation)) {
3745
4204
  params = cloneCallableParams(typeAnnotation.parameters);
3746
- returnType = _nullishCoalesce(_optionalChain([typeAnnotation, 'access', _112 => _112.typeAnnotation, 'optionalAccess', _113 => _113.typeAnnotation]), () => ( returnType));
3747
- } else if (typeAnnotation && t31.isTSTupleType(typeAnnotation)) {
4205
+ returnType = _nullishCoalesce(_optionalChain([typeAnnotation, 'access', _127 => _127.typeAnnotation, 'optionalAccess', _128 => _128.typeAnnotation]), () => ( returnType));
4206
+ } else if (typeAnnotation && t34.isTSTupleType(typeAnnotation)) {
3748
4207
  params = resolveTupleTypeParams(typeAnnotation);
3749
4208
  } else if (typeAnnotation) {
3750
- const id = t31.identifier("value");
3751
- id.typeAnnotation = t31.tsTypeAnnotation(typeAnnotation);
4209
+ const id = t34.identifier("value");
4210
+ id.typeAnnotation = t34.tsTypeAnnotation(typeAnnotation);
3752
4211
  params = [id];
3753
4212
  }
3754
- const fnType = t31.tsFunctionType(null, params, t31.tsTypeAnnotation(returnType));
3755
- const prop = t31.tsPropertySignature(key, t31.tsTypeAnnotation(fnType));
4213
+ const fnType = t34.tsFunctionType(null, params, t34.tsTypeAnnotation(returnType));
4214
+ const prop = t34.tsPropertySignature(key, t34.tsTypeAnnotation(fnType));
3756
4215
  prop.optional = !!member.optional;
3757
4216
  return prop;
3758
4217
  }
@@ -3761,32 +4220,32 @@ function resolveEmitPropsFromCallSignature(member) {
3761
4220
  }
3762
4221
  function resolveEmitPropsFromCallable(parameters, typeAnnotation) {
3763
4222
  const [eventParam, ...restParams] = parameters;
3764
- if (!eventParam || !t31.isIdentifier(eventParam) || !eventParam.typeAnnotation) {
4223
+ if (!eventParam || !t34.isIdentifier(eventParam) || !eventParam.typeAnnotation) {
3765
4224
  return [];
3766
4225
  }
3767
4226
  const { typeAnnotation: paramTypeAnnotation } = eventParam;
3768
- if (t31.isNoop(paramTypeAnnotation)) return [];
4227
+ if (t34.isNoop(paramTypeAnnotation)) return [];
3769
4228
  const eventNames = resolveEventNames(paramTypeAnnotation.typeAnnotation);
3770
4229
  if (!eventNames.length) return [];
3771
- const returnType = _nullishCoalesce(_optionalChain([typeAnnotation, 'optionalAccess', _114 => _114.typeAnnotation]), () => ( t31.tsAnyKeyword()));
4230
+ const returnType = _nullishCoalesce(_optionalChain([typeAnnotation, 'optionalAccess', _129 => _129.typeAnnotation]), () => ( t34.tsAnyKeyword()));
3772
4231
  return eventNames.map((eventName) => {
3773
4232
  const handlerName = resolveEmitHandlerName(eventName);
3774
4233
  const key = buildKey(handlerName);
3775
4234
  const params = cloneCallableParams(restParams);
3776
- const fnType = t31.tsFunctionType(null, params, t31.tsTypeAnnotation(returnType));
3777
- const prop = t31.tsPropertySignature(key, t31.tsTypeAnnotation(fnType));
4235
+ const fnType = t34.tsFunctionType(null, params, t34.tsTypeAnnotation(returnType));
4236
+ const prop = t34.tsPropertySignature(key, t34.tsTypeAnnotation(fnType));
3778
4237
  prop.optional = true;
3779
4238
  return prop;
3780
4239
  });
3781
4240
  }
3782
4241
  function resolveEventNames(type) {
3783
- if (t31.isTSLiteralType(type) && t31.isStringLiteral(type.literal)) {
4242
+ if (t34.isTSLiteralType(type) && t34.isStringLiteral(type.literal)) {
3784
4243
  return [type.literal.value];
3785
4244
  }
3786
- if (t31.isTSUnionType(type)) {
4245
+ if (t34.isTSUnionType(type)) {
3787
4246
  return type.types.flatMap(resolveEventNames);
3788
4247
  }
3789
- if (t31.isTSParenthesizedType(type)) {
4248
+ if (t34.isTSParenthesizedType(type)) {
3790
4249
  return resolveEventNames(type.typeAnnotation);
3791
4250
  }
3792
4251
  return [];
@@ -3799,39 +4258,39 @@ function resolveTupleTypeParams(tuple) {
3799
4258
  return params;
3800
4259
  }
3801
4260
  function resolveTupleElementParam(element, index) {
3802
- const isNamedTuple = typeof t31.isTSNamedTupleMember === "function" && t31.isTSNamedTupleMember(element);
4261
+ const isNamedTuple = typeof t34.isTSNamedTupleMember === "function" && t34.isTSNamedTupleMember(element);
3803
4262
  if (isNamedTuple) {
3804
4263
  const tupleMember = element;
3805
- const name = _optionalChain([tupleMember, 'access', _115 => _115.label, 'optionalAccess', _116 => _116.name]) || `arg${index}`;
4264
+ const name = _optionalChain([tupleMember, 'access', _130 => _130.label, 'optionalAccess', _131 => _131.name]) || `arg${index}`;
3806
4265
  let innerType = tupleMember.elementType;
3807
4266
  let optional = tupleMember.optional;
3808
- if (t31.isTSOptionalType(innerType)) {
4267
+ if (t34.isTSOptionalType(innerType)) {
3809
4268
  optional = true;
3810
4269
  innerType = innerType.typeAnnotation;
3811
4270
  }
3812
- if (t31.isTSRestType(innerType)) {
3813
- const rest = t31.restElement(t31.identifier(name));
3814
- rest.typeAnnotation = t31.tsTypeAnnotation(innerType.typeAnnotation);
4271
+ if (t34.isTSRestType(innerType)) {
4272
+ const rest = t34.restElement(t34.identifier(name));
4273
+ rest.typeAnnotation = t34.tsTypeAnnotation(innerType.typeAnnotation);
3815
4274
  return rest;
3816
4275
  }
3817
- const id2 = t31.identifier(name);
4276
+ const id2 = t34.identifier(name);
3818
4277
  id2.optional = optional;
3819
- id2.typeAnnotation = t31.tsTypeAnnotation(innerType);
4278
+ id2.typeAnnotation = t34.tsTypeAnnotation(innerType);
3820
4279
  return id2;
3821
4280
  }
3822
- if (t31.isTSRestType(element)) {
3823
- const rest = t31.restElement(t31.identifier(`args${index}`));
3824
- rest.typeAnnotation = t31.tsTypeAnnotation(element.typeAnnotation);
4281
+ if (t34.isTSRestType(element)) {
4282
+ const rest = t34.restElement(t34.identifier(`args${index}`));
4283
+ rest.typeAnnotation = t34.tsTypeAnnotation(element.typeAnnotation);
3825
4284
  return rest;
3826
4285
  }
3827
- if (t31.isTSOptionalType(element)) {
3828
- const id2 = t31.identifier(`arg${index}`);
4286
+ if (t34.isTSOptionalType(element)) {
4287
+ const id2 = t34.identifier(`arg${index}`);
3829
4288
  id2.optional = true;
3830
- id2.typeAnnotation = t31.tsTypeAnnotation(element.typeAnnotation);
4289
+ id2.typeAnnotation = t34.tsTypeAnnotation(element.typeAnnotation);
3831
4290
  return id2;
3832
4291
  }
3833
- const id = t31.identifier(`arg${index}`);
3834
- id.typeAnnotation = t31.tsTypeAnnotation(element);
4292
+ const id = t34.identifier(`arg${index}`);
4293
+ id.typeAnnotation = t34.tsTypeAnnotation(element);
3835
4294
  return id;
3836
4295
  }
3837
4296
 
@@ -3840,8 +4299,8 @@ function resolveTupleElementParam(element, index) {
3840
4299
  function resolveDefinePropsIface(path8, ctx) {
3841
4300
  const { node } = path8;
3842
4301
  const [runtimeArg] = node.arguments;
3843
- const tsParams = _optionalChain([node, 'access', _117 => _117.typeParameters, 'optionalAccess', _118 => _118.params]);
3844
- if (_optionalChain([tsParams, 'optionalAccess', _119 => _119.length])) {
4302
+ const tsParams = _optionalChain([node, 'access', _132 => _132.typeParameters, 'optionalAccess', _133 => _133.params]);
4303
+ if (_optionalChain([tsParams, 'optionalAccess', _134 => _134.length])) {
3845
4304
  const { propsTSIface } = ctx.scriptData;
3846
4305
  propsTSIface.propsTypes = tsParams;
3847
4306
  return;
@@ -3856,38 +4315,38 @@ function processInferredTypes2(ctx, runtimeArg) {
3856
4315
  } = scriptData;
3857
4316
  if (!runtimeArg) return;
3858
4317
  const members = [];
3859
- if (t32.isArrayExpression(runtimeArg)) {
4318
+ if (t35.isArrayExpression(runtimeArg)) {
3860
4319
  for (const element of runtimeArg.elements) {
3861
- if (!element || !t32.isStringLiteral(element)) continue;
3862
- const key = t32.isValidIdentifier(element.value) ? t32.identifier(element.value) : t32.stringLiteral(element.value);
3863
- const prop = t32.tsPropertySignature(key, t32.tsTypeAnnotation(t32.tsAnyKeyword()));
4320
+ if (!element || !t35.isStringLiteral(element)) continue;
4321
+ const key = t35.isValidIdentifier(element.value) ? t35.identifier(element.value) : t35.stringLiteral(element.value);
4322
+ const prop = t35.tsPropertySignature(key, t35.tsTypeAnnotation(t35.tsAnyKeyword()));
3864
4323
  prop.optional = true;
3865
4324
  members.push(prop);
3866
4325
  }
3867
4326
  if (members.length) {
3868
- propsTypes.push(t32.tsTypeLiteral(members));
4327
+ propsTypes.push(t35.tsTypeLiteral(members));
3869
4328
  }
3870
4329
  return;
3871
4330
  }
3872
- if (t32.isObjectExpression(runtimeArg)) {
4331
+ if (t35.isObjectExpression(runtimeArg)) {
3873
4332
  for (const prop of runtimeArg.properties) {
3874
- if (!t32.isObjectProperty(prop)) continue;
3875
- if (t32.isSpreadElement(prop)) continue;
4333
+ if (!t35.isObjectProperty(prop)) continue;
4334
+ if (t35.isSpreadElement(prop)) continue;
3876
4335
  const key = prop.key;
3877
4336
  let propName = null;
3878
- if (t32.isIdentifier(key)) propName = key.name;
3879
- if (t32.isStringLiteral(key)) propName = key.value;
3880
- if (t32.isNumericLiteral(key)) propName = String(key.value);
4337
+ if (t35.isIdentifier(key)) propName = key.name;
4338
+ if (t35.isStringLiteral(key)) propName = key.value;
4339
+ if (t35.isNumericLiteral(key)) propName = String(key.value);
3881
4340
  if (!propName) continue;
3882
4341
  const { type, required } = resolveRuntimePropMeta(prop.value);
3883
- const tsType = _nullishCoalesce(type, () => ( t32.tsAnyKeyword()));
3884
- const tsKey = t32.isValidIdentifier(propName) ? t32.identifier(propName) : t32.stringLiteral(propName);
3885
- const tsProp = t32.tsPropertySignature(tsKey, t32.tsTypeAnnotation(tsType));
4342
+ const tsType = _nullishCoalesce(type, () => ( t35.tsAnyKeyword()));
4343
+ const tsKey = t35.isValidIdentifier(propName) ? t35.identifier(propName) : t35.stringLiteral(propName);
4344
+ const tsProp = t35.tsPropertySignature(tsKey, t35.tsTypeAnnotation(tsType));
3886
4345
  tsProp.optional = !required;
3887
4346
  members.push(tsProp);
3888
4347
  }
3889
4348
  if (members.length) {
3890
- propsTypes.push(t32.tsTypeLiteral(members));
4349
+ propsTypes.push(t35.tsTypeLiteral(members));
3891
4350
  }
3892
4351
  return;
3893
4352
  }
@@ -3896,47 +4355,47 @@ function processInferredTypes2(ctx, runtimeArg) {
3896
4355
  {
3897
4356
  source,
3898
4357
  file: filename,
3899
- loc: _optionalChain([runtimeArg, 'optionalAccess', _120 => _120.loc])
4358
+ loc: _optionalChain([runtimeArg, 'optionalAccess', _135 => _135.loc])
3900
4359
  }
3901
4360
  );
3902
4361
  }
3903
4362
  function resolveRuntimePropMeta(value) {
3904
- if (t32.isIdentifier(value)) {
4363
+ if (t35.isIdentifier(value)) {
3905
4364
  return {
3906
4365
  type: mapRuntimeTypeToTSType(value),
3907
4366
  required: false
3908
4367
  };
3909
4368
  }
3910
- if (t32.isArrayExpression(value)) {
4369
+ if (t35.isArrayExpression(value)) {
3911
4370
  return {
3912
4371
  type: resolveRuntimeUnionType(value),
3913
4372
  required: false
3914
4373
  };
3915
4374
  }
3916
- if (!t32.isObjectExpression(value)) {
4375
+ if (!t35.isObjectExpression(value)) {
3917
4376
  return { required: false };
3918
4377
  }
3919
4378
  let type;
3920
4379
  let required = false;
3921
4380
  for (const prop of value.properties) {
3922
- if (!t32.isObjectProperty(prop)) continue;
3923
- if (t32.isSpreadElement(prop)) continue;
4381
+ if (!t35.isObjectProperty(prop)) continue;
4382
+ if (t35.isSpreadElement(prop)) continue;
3924
4383
  const key = prop.key;
3925
- const propName = t32.isIdentifier(key) ? key.name : t32.isStringLiteral(key) ? key.value : null;
4384
+ const propName = t35.isIdentifier(key) ? key.name : t35.isStringLiteral(key) ? key.value : null;
3926
4385
  if (!propName) continue;
3927
4386
  if (propName === "type") {
3928
4387
  const valueNode = prop.value;
3929
- if (t32.isArrayExpression(valueNode)) {
4388
+ if (t35.isArrayExpression(valueNode)) {
3930
4389
  type = resolveRuntimeUnionType(valueNode);
3931
4390
  continue;
3932
4391
  }
3933
- if (t32.isIdentifier(valueNode)) {
4392
+ if (t35.isIdentifier(valueNode)) {
3934
4393
  type = mapRuntimeTypeToTSType(valueNode);
3935
4394
  continue;
3936
4395
  }
3937
4396
  }
3938
4397
  if (propName === "required") {
3939
- if (t32.isBooleanLiteral(prop.value)) {
4398
+ if (t35.isBooleanLiteral(prop.value)) {
3940
4399
  required = prop.value.value;
3941
4400
  }
3942
4401
  }
@@ -3946,35 +4405,13 @@ function resolveRuntimePropMeta(value) {
3946
4405
  function resolveRuntimeUnionType(value) {
3947
4406
  const types = [];
3948
4407
  for (const element of value.elements) {
3949
- if (!element || !t32.isIdentifier(element)) continue;
4408
+ if (!element || !t35.isIdentifier(element)) continue;
3950
4409
  const resolved = mapRuntimeTypeToTSType(element);
3951
4410
  if (resolved) types.push(resolved);
3952
4411
  }
3953
- if (!types.length) return t32.tsAnyKeyword();
4412
+ if (!types.length) return t35.tsAnyKeyword();
3954
4413
  if (types.length === 1) return types[0];
3955
- return t32.tsUnionType(types);
3956
- }
3957
- function mapRuntimeTypeToTSType(value) {
3958
- switch (value.name) {
3959
- case "String":
3960
- return t32.tsStringKeyword();
3961
- case "Number":
3962
- return t32.tsNumberKeyword();
3963
- case "Boolean":
3964
- return t32.tsBooleanKeyword();
3965
- case "Object":
3966
- return t32.tsTypeLiteral([]);
3967
- case "Array":
3968
- return t32.tsArrayType(t32.tsAnyKeyword());
3969
- case "Function":
3970
- return t32.tsFunctionType(null, [], t32.tsTypeAnnotation(t32.tsAnyKeyword()));
3971
- case "Symbol":
3972
- return t32.tsSymbolKeyword();
3973
- case "BigInt":
3974
- return t32.tsBigIntKeyword();
3975
- default:
3976
- return t32.tsAnyKeyword();
3977
- }
4414
+ return t35.tsUnionType(types);
3978
4415
  }
3979
4416
 
3980
4417
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-props-interface/resolve-slot/type-resolver.ts
@@ -3987,34 +4424,34 @@ var SLOT_CHILDREN_NAME = "children";
3987
4424
  var SLOT_FN_PARAM_NAME = "props";
3988
4425
  function buildSlotPropSignature(rawName, params, optional) {
3989
4426
  const propName = rawName === SLOT_DEFAULT_NAME ? SLOT_CHILDREN_NAME : rawName;
3990
- const key = t33.isValidIdentifier(propName) ? t33.identifier(propName) : t33.stringLiteral(propName);
3991
- const reactNodeType = t33.tsTypeAnnotation(
3992
- t33.tsTypeReference(t33.identifier(REACT_API_MAP.ReactNode))
4427
+ const key = t36.isValidIdentifier(propName) ? t36.identifier(propName) : t36.stringLiteral(propName);
4428
+ const reactNodeType = t36.tsTypeAnnotation(
4429
+ t36.tsTypeReference(t36.identifier(REACT_API_MAP.ReactNode))
3993
4430
  );
3994
4431
  let typeAnnotation;
3995
4432
  if (rawName === SLOT_DEFAULT_NAME && params.length === 0 || params.length === 0) {
3996
4433
  typeAnnotation = reactNodeType;
3997
4434
  } else {
3998
- const fnType = t33.tsFunctionType(null, params, reactNodeType);
3999
- typeAnnotation = t33.tsTypeAnnotation(fnType);
4435
+ const fnType = t36.tsFunctionType(null, params, reactNodeType);
4436
+ typeAnnotation = t36.tsTypeAnnotation(fnType);
4000
4437
  }
4001
- const prop = t33.tsPropertySignature(key, typeAnnotation);
4438
+ const prop = t36.tsPropertySignature(key, typeAnnotation);
4002
4439
  prop.optional = optional;
4003
4440
  return prop;
4004
4441
  }
4005
4442
  function createSlotScopeParam(props, ctx) {
4006
- const paramId = t33.identifier(SLOT_FN_PARAM_NAME);
4443
+ const paramId = t36.identifier(SLOT_FN_PARAM_NAME);
4007
4444
  const propsSigns = [];
4008
4445
  const { reactiveBindings } = ctx.templateData;
4009
4446
  props.forEach(({ prop, tsType }) => {
4010
- const foundBindingValue = _optionalChain([reactiveBindings, 'access', _121 => _121[prop], 'optionalAccess', _122 => _122.value]);
4447
+ const foundBindingValue = _optionalChain([reactiveBindings, 'access', _136 => _136[prop], 'optionalAccess', _137 => _137.value]);
4011
4448
  const foundBindingTypes = foundBindingValue ? expressionToTSType(foundBindingValue) : null;
4012
- const typeAnnotation = foundBindingTypes ? t33.tsTypeAnnotation(foundBindingTypes) : tsType;
4013
- const key = t33.isValidIdentifier(prop) ? t33.identifier(prop) : t33.stringLiteral(prop);
4014
- const propSign = t33.tsPropertySignature(key, typeAnnotation);
4449
+ const typeAnnotation = foundBindingTypes ? t36.tsTypeAnnotation(foundBindingTypes) : tsType;
4450
+ const key = t36.isValidIdentifier(prop) ? t36.identifier(prop) : t36.stringLiteral(prop);
4451
+ const propSign = t36.tsPropertySignature(key, typeAnnotation);
4015
4452
  propsSigns.push(propSign);
4016
4453
  });
4017
- paramId.typeAnnotation = t33.tsTypeAnnotation(t33.tsTypeLiteral(propsSigns));
4454
+ paramId.typeAnnotation = t36.tsTypeAnnotation(t36.tsTypeLiteral(propsSigns));
4018
4455
  return paramId;
4019
4456
  }
4020
4457
 
@@ -4035,38 +4472,38 @@ function collectLocalTypeDeclarations(path8) {
4035
4472
  return declarations;
4036
4473
  }
4037
4474
  for (const statement of programPath.node.body) {
4038
- if (t34.isTSInterfaceDeclaration(statement)) {
4475
+ if (t37.isTSInterfaceDeclaration(statement)) {
4039
4476
  declarations.set(statement.id.name, {
4040
- type: t34.tsTypeLiteral(statement.body.body),
4477
+ type: t37.tsTypeLiteral(statement.body.body),
4041
4478
  // 将接口体转换为类型字面量
4042
- hasTypeParameters: !!_optionalChain([statement, 'access', _123 => _123.typeParameters, 'optionalAccess', _124 => _124.params, 'access', _125 => _125.length])
4479
+ hasTypeParameters: !!_optionalChain([statement, 'access', _138 => _138.typeParameters, 'optionalAccess', _139 => _139.params, 'access', _140 => _140.length])
4043
4480
  // 检查是否有泛型参数
4044
4481
  });
4045
4482
  continue;
4046
4483
  }
4047
- if (t34.isTSTypeAliasDeclaration(statement)) {
4484
+ if (t37.isTSTypeAliasDeclaration(statement)) {
4048
4485
  declarations.set(statement.id.name, {
4049
4486
  type: statement.typeAnnotation,
4050
4487
  // 直接使用类型注解
4051
- hasTypeParameters: !!_optionalChain([statement, 'access', _126 => _126.typeParameters, 'optionalAccess', _127 => _127.params, 'access', _128 => _128.length])
4488
+ hasTypeParameters: !!_optionalChain([statement, 'access', _141 => _141.typeParameters, 'optionalAccess', _142 => _142.params, 'access', _143 => _143.length])
4052
4489
  // 检查是否有泛型参数
4053
4490
  });
4054
4491
  continue;
4055
4492
  }
4056
- if (t34.isExportNamedDeclaration(statement) && statement.declaration) {
4493
+ if (t37.isExportNamedDeclaration(statement) && statement.declaration) {
4057
4494
  const declaration = statement.declaration;
4058
- if (t34.isTSInterfaceDeclaration(declaration)) {
4495
+ if (t37.isTSInterfaceDeclaration(declaration)) {
4059
4496
  declarations.set(declaration.id.name, {
4060
- type: t34.tsTypeLiteral(declaration.body.body),
4497
+ type: t37.tsTypeLiteral(declaration.body.body),
4061
4498
  // 将接口体转换为类型字面量
4062
- hasTypeParameters: !!_optionalChain([declaration, 'access', _129 => _129.typeParameters, 'optionalAccess', _130 => _130.params, 'access', _131 => _131.length])
4499
+ hasTypeParameters: !!_optionalChain([declaration, 'access', _144 => _144.typeParameters, 'optionalAccess', _145 => _145.params, 'access', _146 => _146.length])
4063
4500
  // 检查是否有泛型参数
4064
4501
  });
4065
- } else if (t34.isTSTypeAliasDeclaration(declaration)) {
4502
+ } else if (t37.isTSTypeAliasDeclaration(declaration)) {
4066
4503
  declarations.set(declaration.id.name, {
4067
4504
  type: declaration.typeAnnotation,
4068
4505
  // 直接使用类型注解
4069
- hasTypeParameters: !!_optionalChain([declaration, 'access', _132 => _132.typeParameters, 'optionalAccess', _133 => _133.params, 'access', _134 => _134.length])
4506
+ hasTypeParameters: !!_optionalChain([declaration, 'access', _147 => _147.typeParameters, 'optionalAccess', _148 => _148.params, 'access', _149 => _149.length])
4070
4507
  // 检查是否有泛型参数
4071
4508
  });
4072
4509
  }
@@ -4075,22 +4512,22 @@ function collectLocalTypeDeclarations(path8) {
4075
4512
  return declarations;
4076
4513
  }
4077
4514
  function resolvePropName2(key) {
4078
- if (t34.isIdentifier(key)) {
4515
+ if (t37.isIdentifier(key)) {
4079
4516
  return key.name;
4080
4517
  }
4081
- if (t34.isStringLiteral(key)) {
4518
+ if (t37.isStringLiteral(key)) {
4082
4519
  return key.value;
4083
4520
  }
4084
- if (t34.isNumericLiteral(key)) {
4521
+ if (t37.isNumericLiteral(key)) {
4085
4522
  return String(key.value);
4086
4523
  }
4087
4524
  return null;
4088
4525
  }
4089
4526
  function resolveCallableType(tsType) {
4090
- if (t34.isTSFunctionType(tsType)) {
4527
+ if (t37.isTSFunctionType(tsType)) {
4091
4528
  return tsType;
4092
4529
  }
4093
- if (t34.isTSParenthesizedType(tsType)) {
4530
+ if (t37.isTSParenthesizedType(tsType)) {
4094
4531
  return resolveCallableType(tsType.typeAnnotation);
4095
4532
  }
4096
4533
  return null;
@@ -4099,12 +4536,12 @@ function resolveCallableType(tsType) {
4099
4536
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-props-interface/resolve-slot/type-resolver.ts
4100
4537
  var SLOT_DEFAULT_NAME2 = "default";
4101
4538
  function resolveSlotType(tsType, options) {
4102
- if (t35.isTSParenthesizedType(tsType)) {
4539
+ if (t38.isTSParenthesizedType(tsType)) {
4103
4540
  return resolveSlotType(tsType.typeAnnotation, options);
4104
4541
  }
4105
- if (t35.isTSTypeReference(tsType)) {
4542
+ if (t38.isTSTypeReference(tsType)) {
4106
4543
  let shouldRecordReactNode = false;
4107
- if (_optionalChain([tsType, 'access', _135 => _135.typeParameters, 'optionalAccess', _136 => _136.params, 'access', _137 => _137.length])) {
4544
+ if (_optionalChain([tsType, 'access', _150 => _150.typeParameters, 'optionalAccess', _151 => _151.params, 'access', _152 => _152.length])) {
4108
4545
  const params = [];
4109
4546
  for (const param of tsType.typeParameters.params) {
4110
4547
  const resolved2 = resolveSlotType(param, options);
@@ -4118,11 +4555,11 @@ function resolveSlotType(tsType, options) {
4118
4555
  };
4119
4556
  }
4120
4557
  return {
4121
- type: t35.tsTypeReference(tsType.typeName, t35.tsTypeParameterInstantiation(params)),
4558
+ type: t38.tsTypeReference(tsType.typeName, t38.tsTypeParameterInstantiation(params)),
4122
4559
  shouldRecordReactNode
4123
4560
  };
4124
4561
  }
4125
- if (!t35.isIdentifier(tsType.typeName)) {
4562
+ if (!t38.isIdentifier(tsType.typeName)) {
4126
4563
  return {
4127
4564
  type: tsType,
4128
4565
  shouldRecordReactNode: false
@@ -4153,7 +4590,7 @@ function resolveSlotType(tsType, options) {
4153
4590
  }
4154
4591
  return resolved;
4155
4592
  }
4156
- if (t35.isTSIntersectionType(tsType)) {
4593
+ if (t38.isTSIntersectionType(tsType)) {
4157
4594
  const types = [];
4158
4595
  let shouldRecordReactNode = false;
4159
4596
  for (const item of tsType.types) {
@@ -4176,11 +4613,11 @@ function resolveSlotType(tsType, options) {
4176
4613
  };
4177
4614
  }
4178
4615
  return {
4179
- type: t35.tsIntersectionType(types),
4616
+ type: t38.tsIntersectionType(types),
4180
4617
  shouldRecordReactNode
4181
4618
  };
4182
4619
  }
4183
- if (t35.isTSUnionType(tsType)) {
4620
+ if (t38.isTSUnionType(tsType)) {
4184
4621
  const types = [];
4185
4622
  let shouldRecordReactNode = false;
4186
4623
  for (const item of tsType.types) {
@@ -4203,11 +4640,11 @@ function resolveSlotType(tsType, options) {
4203
4640
  };
4204
4641
  }
4205
4642
  return {
4206
- type: t35.tsUnionType(types),
4643
+ type: t38.tsUnionType(types),
4207
4644
  shouldRecordReactNode
4208
4645
  };
4209
4646
  }
4210
- if (t35.isTSTypeLiteral(tsType)) {
4647
+ if (t38.isTSTypeLiteral(tsType)) {
4211
4648
  const members = [];
4212
4649
  let shouldRecordReactNode = false;
4213
4650
  for (const item of tsType.members) {
@@ -4222,11 +4659,11 @@ function resolveSlotType(tsType, options) {
4222
4659
  };
4223
4660
  }
4224
4661
  return {
4225
- type: t35.tsTypeLiteral(members),
4662
+ type: t38.tsTypeLiteral(members),
4226
4663
  shouldRecordReactNode
4227
4664
  };
4228
4665
  }
4229
- if (t35.isTSFunctionType(tsType)) {
4666
+ if (t38.isTSFunctionType(tsType)) {
4230
4667
  const props = buildSlotPropSignature(
4231
4668
  SLOT_DEFAULT_NAME2,
4232
4669
  cloneCallableParams(tsType.parameters),
@@ -4234,7 +4671,7 @@ function resolveSlotType(tsType, options) {
4234
4671
  // 默认插槽不是可选的
4235
4672
  );
4236
4673
  return {
4237
- type: t35.tsTypeLiteral([props]),
4674
+ type: t38.tsTypeLiteral([props]),
4238
4675
  shouldRecordReactNode: true
4239
4676
  // 函数类型总是需要记录 ReactNode
4240
4677
  };
@@ -4245,7 +4682,7 @@ function resolveSlotType(tsType, options) {
4245
4682
  };
4246
4683
  }
4247
4684
  function resolveSlotPropFromMember(member) {
4248
- if (t35.isTSMethodSignature(member)) {
4685
+ if (t38.isTSMethodSignature(member)) {
4249
4686
  const rawName = resolvePropName2(member.key);
4250
4687
  if (!rawName) {
4251
4688
  return {
@@ -4260,7 +4697,7 @@ function resolveSlotPropFromMember(member) {
4260
4697
  // 方法签名总是可调用,需要记录 ReactNode
4261
4698
  };
4262
4699
  }
4263
- if (t35.isTSPropertySignature(member)) {
4700
+ if (t38.isTSPropertySignature(member)) {
4264
4701
  const rawName = resolvePropName2(member.key);
4265
4702
  if (!rawName) {
4266
4703
  return {
@@ -4268,7 +4705,7 @@ function resolveSlotPropFromMember(member) {
4268
4705
  shouldRecordReactNode: false
4269
4706
  };
4270
4707
  }
4271
- const typeAnnotation = _optionalChain([member, 'access', _138 => _138.typeAnnotation, 'optionalAccess', _139 => _139.typeAnnotation]);
4708
+ const typeAnnotation = _optionalChain([member, 'access', _153 => _153.typeAnnotation, 'optionalAccess', _154 => _154.typeAnnotation]);
4272
4709
  const callable = typeAnnotation ? resolveCallableType(typeAnnotation) : null;
4273
4710
  if (!callable) {
4274
4711
  return {
@@ -4283,7 +4720,7 @@ function resolveSlotPropFromMember(member) {
4283
4720
  // 可调用属性需要记录 ReactNode
4284
4721
  };
4285
4722
  }
4286
- if (t35.isTSCallSignatureDeclaration(member)) {
4723
+ if (t38.isTSCallSignatureDeclaration(member)) {
4287
4724
  const params = cloneCallableParams(member.parameters);
4288
4725
  return {
4289
4726
  member: buildSlotPropSignature(SLOT_DEFAULT_NAME2, params, true),
@@ -4300,8 +4737,8 @@ function resolveSlotPropFromMember(member) {
4300
4737
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-props-interface/resolve-slot/define-slots.ts
4301
4738
  function resolveDefineSlotsIface(path8, ctx) {
4302
4739
  const { node } = path8;
4303
- const tsParams = _optionalChain([node, 'access', _140 => _140.typeParameters, 'optionalAccess', _141 => _141.params]);
4304
- if (!_optionalChain([tsParams, 'optionalAccess', _142 => _142.length])) return;
4740
+ const tsParams = _optionalChain([node, 'access', _155 => _155.typeParameters, 'optionalAccess', _156 => _156.params]);
4741
+ if (!_optionalChain([tsParams, 'optionalAccess', _157 => _157.length])) return;
4305
4742
  const {
4306
4743
  propsTSIface: { slotTypes }
4307
4744
  } = ctx.scriptData;
@@ -4341,7 +4778,7 @@ function resolveTemplateSlotIface(ctx) {
4341
4778
  }
4342
4779
  if (tsMembers.length) {
4343
4780
  recordReactNode(ctx);
4344
- slotTypes.push(t36.tsTypeLiteral(tsMembers));
4781
+ slotTypes.push(t39.tsTypeLiteral(tsMembers));
4345
4782
  }
4346
4783
  }
4347
4784
 
@@ -4393,9 +4830,9 @@ function resolveCompIProps(ctx, ast) {
4393
4830
  }
4394
4831
  const n = declaredOptions.name || "Comp";
4395
4832
  const ns = `I${camelCase(capitalize(n))}Props`;
4396
- const typeNode = t37.tsIntersectionType(tsTypes);
4397
- const typeAliasDecl = t37.tsTypeAliasDeclaration(t37.identifier(ns), null, typeNode);
4398
- const exportDecl = t37.exportNamedDeclaration(typeAliasDecl);
4833
+ const typeNode = t40.tsIntersectionType(tsTypes);
4834
+ const typeAliasDecl = t40.tsTypeAliasDeclaration(t40.identifier(ns), null, typeNode);
4835
+ const exportDecl = t40.exportNamedDeclaration(typeAliasDecl);
4399
4836
  propsTSIface.name = ns;
4400
4837
  const scriptIR = getScriptIR(ctx);
4401
4838
  scriptIR.exports.push(exportDecl);
@@ -4410,8 +4847,8 @@ function resolveUseAttrs(ctx) {
4410
4847
  const { init, id } = path8.node;
4411
4848
  if (!init) return;
4412
4849
  const initPath = path8.get("init");
4413
- const propsIdentifier = t38.identifier(ctx.propField);
4414
- if (t38.isTSAsExpression(init) && isUseAttrsCall(init.expression)) {
4850
+ const propsIdentifier = t41.identifier(ctx.propField);
4851
+ if (t41.isTSAsExpression(init) && isUseAttrsCall(init.expression)) {
4415
4852
  const typeAssertion = createPropsTypeAssertion(propsIdentifier, init.typeAnnotation);
4416
4853
  replaceNode(initPath, typeAssertion, init);
4417
4854
  return;
@@ -4422,13 +4859,13 @@ function resolveUseAttrs(ctx) {
4422
4859
  const isTS = ctx.scriptData.lang.startsWith("ts");
4423
4860
  if (isTS) {
4424
4861
  let typeAnnotation = null;
4425
- if (t38.isIdentifier(id) && t38.isTSTypeAnnotation(id.typeAnnotation)) {
4862
+ if (t41.isIdentifier(id) && t41.isTSTypeAnnotation(id.typeAnnotation)) {
4426
4863
  typeAnnotation = id.typeAnnotation.typeAnnotation;
4427
4864
  id.typeAnnotation = null;
4428
4865
  } else {
4429
- typeAnnotation = t38.tsTypeReference(
4430
- t38.identifier("Record"),
4431
- t38.tsTypeParameterInstantiation([t38.tsStringKeyword(), t38.tsUnknownKeyword()])
4866
+ typeAnnotation = t41.tsTypeReference(
4867
+ t41.identifier("Record"),
4868
+ t41.tsTypeParameterInstantiation([t41.tsStringKeyword(), t41.tsUnknownKeyword()])
4432
4869
  );
4433
4870
  }
4434
4871
  const propsTypeAssertion = createPropsTypeAssertion(propsIdentifier, typeAnnotation);
@@ -4440,10 +4877,10 @@ function resolveUseAttrs(ctx) {
4440
4877
  };
4441
4878
  }
4442
4879
  function isUseAttrsCall(expr) {
4443
- return t38.isCallExpression(expr) && isCalleeNamed(expr, VUE_API_MAP.useAttrs);
4880
+ return t41.isCallExpression(expr) && isCalleeNamed(expr, VUE_API_MAP.useAttrs);
4444
4881
  }
4445
4882
  function createPropsTypeAssertion(propsIdentifier, typeAnnotation) {
4446
- return t38.tsAsExpression(propsIdentifier, typeAnnotation);
4883
+ return t41.tsAsExpression(propsIdentifier, typeAnnotation);
4447
4884
  }
4448
4885
 
4449
4886
  // src/core/transform/sfc/script/syntax-processor/process/resolve-analysis-only-adapter.ts
@@ -4466,7 +4903,7 @@ function isBindingDeclaredInsideBoundary(binding, boundary) {
4466
4903
  }
4467
4904
  function isReactiveBinding(node) {
4468
4905
  if (!node) return false;
4469
- return !!_optionalChain([getScriptNodeMeta, 'call', _143 => _143(node), 'optionalAccess', _144 => _144.is_reactive]);
4906
+ return !!_optionalChain([getScriptNodeMeta, 'call', _158 => _158(node), 'optionalAccess', _159 => _159.is_reactive]);
4470
4907
  }
4471
4908
 
4472
4909
  // src/core/transform/sfc/script/shared/dependency-analyzer/dep-checker.ts
@@ -4479,40 +4916,40 @@ function isEligibleBindingSource(binding) {
4479
4916
  const bindingPath = binding.path;
4480
4917
  const declaratorPath = getVariableDeclaratorPath(bindingPath);
4481
4918
  const isReactiveVarBinding = !!declaratorPath && isReactiveBinding(declaratorPath.node);
4482
- const nodeInit = _optionalChain([declaratorPath, 'optionalAccess', _145 => _145.node, 'access', _146 => _146.init]);
4483
- const isReactiveApiCallVarBinding = !!declaratorPath && t39.isCallExpression(nodeInit) && t39.isIdentifier(nodeInit.callee) && reactiveStateApis.has(nodeInit.callee.name);
4484
- const isHookCallVarBinding = !!declaratorPath && t39.isCallExpression(nodeInit) && isHookLikeCallee(nodeInit.callee);
4485
- const isFunctionBinding = bindingPath.isFunctionDeclaration() || !!declaratorPath && !!nodeInit && (t39.isArrowFunctionExpression(nodeInit) || t39.isFunctionExpression(nodeInit));
4486
- const isReactiveFunctionBinding = isFunctionBinding && (isReactiveBinding(_optionalChain([declaratorPath, 'optionalAccess', _147 => _147.node])) || isReactiveBinding(bindingPath.node));
4919
+ const nodeInit = _optionalChain([declaratorPath, 'optionalAccess', _160 => _160.node, 'access', _161 => _161.init]);
4920
+ const isReactiveApiCallVarBinding = !!declaratorPath && t42.isCallExpression(nodeInit) && t42.isIdentifier(nodeInit.callee) && reactiveStateApis.has(nodeInit.callee.name);
4921
+ const isHookCallVarBinding = !!declaratorPath && t42.isCallExpression(nodeInit) && isHookLikeCallee(nodeInit.callee);
4922
+ const isFunctionBinding = bindingPath.isFunctionDeclaration() || !!declaratorPath && !!nodeInit && (t42.isArrowFunctionExpression(nodeInit) || t42.isFunctionExpression(nodeInit));
4923
+ const isReactiveFunctionBinding = isFunctionBinding && (isReactiveBinding(_optionalChain([declaratorPath, 'optionalAccess', _162 => _162.node])) || isReactiveBinding(bindingPath.node));
4487
4924
  return isReactiveVarBinding || isReactiveApiCallVarBinding || isHookCallVarBinding || isReactiveFunctionBinding;
4488
4925
  }
4489
4926
  function isReactValidDependencyExpr(node) {
4490
- if (t39.isIdentifier(node)) {
4927
+ if (t42.isIdentifier(node)) {
4491
4928
  return true;
4492
4929
  }
4493
- if (t39.isMemberExpression(node) || t39.isOptionalMemberExpression(node)) {
4930
+ if (t42.isMemberExpression(node) || t42.isOptionalMemberExpression(node)) {
4494
4931
  return isStaticMemberChain(node);
4495
4932
  }
4496
4933
  return false;
4497
4934
  }
4498
4935
  function isStaticMemberChain(node) {
4499
4936
  let current = node;
4500
- while (t39.isMemberExpression(current) || t39.isOptionalMemberExpression(current)) {
4501
- if (!current.computed && !t39.isIdentifier(current.property)) {
4937
+ while (t42.isMemberExpression(current) || t42.isOptionalMemberExpression(current)) {
4938
+ if (!current.computed && !t42.isIdentifier(current.property)) {
4502
4939
  return false;
4503
4940
  }
4504
- if (current.computed && !t39.isStringLiteral(current.property) && !t39.isNumericLiteral(current.property)) {
4941
+ if (current.computed && !t42.isStringLiteral(current.property) && !t42.isNumericLiteral(current.property)) {
4505
4942
  return false;
4506
4943
  }
4507
4944
  current = current.object;
4508
4945
  }
4509
- return t39.isIdentifier(current);
4946
+ return t42.isIdentifier(current);
4510
4947
  }
4511
4948
  function isHookLikeCallee(callee) {
4512
- if (t39.isIdentifier(callee)) {
4949
+ if (t42.isIdentifier(callee)) {
4513
4950
  return callee.name.startsWith("use");
4514
4951
  }
4515
- if (t39.isMemberExpression(callee) && !callee.computed && t39.isIdentifier(callee.property)) {
4952
+ if (t42.isMemberExpression(callee) && !callee.computed && t42.isIdentifier(callee.property)) {
4516
4953
  return callee.property.name.startsWith("use");
4517
4954
  }
4518
4955
  return false;
@@ -4521,16 +4958,16 @@ function isHookLikeCallee(callee) {
4521
4958
  // src/core/transform/sfc/script/shared/dependency-analyzer/dep-key.ts
4522
4959
 
4523
4960
  function getDependencyKey(exp) {
4524
- if (t40.isIdentifier(exp)) {
4961
+ if (t43.isIdentifier(exp)) {
4525
4962
  return exp.name;
4526
4963
  }
4527
- if (t40.isMemberExpression(exp) || t40.isOptionalMemberExpression(exp)) {
4964
+ if (t43.isMemberExpression(exp) || t43.isOptionalMemberExpression(exp)) {
4528
4965
  const objectKey = getDependencyKey(exp.object);
4529
4966
  const opt = exp.optional ? "?" : "";
4530
- if (!exp.computed && t40.isIdentifier(exp.property)) {
4967
+ if (!exp.computed && t43.isIdentifier(exp.property)) {
4531
4968
  return `${objectKey}${opt}.${exp.property.name}`;
4532
4969
  }
4533
- if (t40.isStringLiteral(exp.property) || t40.isNumericLiteral(exp.property)) {
4970
+ if (t43.isStringLiteral(exp.property) || t43.isNumericLiteral(exp.property)) {
4534
4971
  return `${objectKey}${opt}[${JSON.stringify(exp.property.value)}]`;
4535
4972
  }
4536
4973
  return `${objectKey}${opt}[*]`;
@@ -4541,38 +4978,38 @@ function getDependencyKey(exp) {
4541
4978
  // src/core/transform/sfc/script/shared/dependency-analyzer/dep-normalizer.ts
4542
4979
 
4543
4980
  function normalizeDependencyExpr(path8, rootName, ctx) {
4544
- if (t41.isIdentifier(path8.node)) {
4545
- return t41.identifier(path8.node.name);
4981
+ if (t44.isIdentifier(path8.node)) {
4982
+ return t44.identifier(path8.node.name);
4546
4983
  }
4547
- if (t41.isMemberExpression(path8.node) || t41.isOptionalMemberExpression(path8.node)) {
4984
+ if (t44.isMemberExpression(path8.node) || t44.isOptionalMemberExpression(path8.node)) {
4548
4985
  if (rootName === ctx.propField) {
4549
4986
  const safePropsExp = ensureOptionalForMemberChain(path8.node);
4550
4987
  if (isReactValidDependencyExpr(safePropsExp)) {
4551
- return t41.cloneNode(safePropsExp, true);
4988
+ return t44.cloneNode(safePropsExp, true);
4552
4989
  }
4553
- return t41.identifier(rootName);
4990
+ return t44.identifier(rootName);
4554
4991
  }
4555
4992
  const normalizedExp = normalizeMemberForCallSite(path8, path8.node);
4556
- const safeExp = t41.isMemberExpression(normalizedExp) || t41.isOptionalMemberExpression(normalizedExp) ? ensureOptionalForMemberChain(normalizedExp) : normalizedExp;
4993
+ const safeExp = t44.isMemberExpression(normalizedExp) || t44.isOptionalMemberExpression(normalizedExp) ? ensureOptionalForMemberChain(normalizedExp) : normalizedExp;
4557
4994
  if (isReactValidDependencyExpr(safeExp)) {
4558
- return t41.cloneNode(safeExp, true);
4995
+ return t44.cloneNode(safeExp, true);
4559
4996
  }
4560
- return t41.identifier(rootName);
4997
+ return t44.identifier(rootName);
4561
4998
  }
4562
4999
  return null;
4563
5000
  }
4564
5001
  function normalizeSourcedDependency(exp) {
4565
- if (t41.isIdentifier(exp)) {
4566
- return t41.identifier(exp.name);
5002
+ if (t44.isIdentifier(exp)) {
5003
+ return t44.identifier(exp.name);
4567
5004
  }
4568
- if (t41.isMemberExpression(exp) || t41.isOptionalMemberExpression(exp)) {
5005
+ if (t44.isMemberExpression(exp) || t44.isOptionalMemberExpression(exp)) {
4569
5006
  const root = findRootIdentifier(exp);
4570
5007
  if (!root) return null;
4571
- const safeExp = t41.isMemberExpression(exp) || t41.isOptionalMemberExpression(exp) ? ensureOptionalForMemberChain(exp) : exp;
5008
+ const safeExp = t44.isMemberExpression(exp) || t44.isOptionalMemberExpression(exp) ? ensureOptionalForMemberChain(exp) : exp;
4572
5009
  if (isReactValidDependencyExpr(safeExp)) {
4573
- return t41.cloneNode(safeExp, true);
5010
+ return t44.cloneNode(safeExp, true);
4574
5011
  }
4575
- return t41.identifier(root.name);
5012
+ return t44.identifier(root.name);
4576
5013
  }
4577
5014
  return null;
4578
5015
  }
@@ -4582,7 +5019,7 @@ function normalizeMemberForCallSite(path8, node) {
4582
5019
  if (!isDirectCallee) {
4583
5020
  return node;
4584
5021
  }
4585
- if (!t41.isExpression(node.object)) {
5022
+ if (!t44.isExpression(node.object)) {
4586
5023
  return node;
4587
5024
  }
4588
5025
  return node.object;
@@ -4594,20 +5031,20 @@ function ensureOptionalForMemberChain(node) {
4594
5031
  const rebuildWithOptionalChain = (node2) => {
4595
5032
  const safeObject = ensureOptionalForMemberChain(node2.object);
4596
5033
  if (safeObject !== node2.object) {
4597
- const property = t41.cloneNode(node2.property, true);
4598
- return t41.optionalMemberExpression(safeObject, property, node2.computed, true);
5034
+ const property = t44.cloneNode(node2.property, true);
5035
+ return t44.optionalMemberExpression(safeObject, property, node2.computed, true);
4599
5036
  }
4600
- if (t41.isMemberExpression(node2)) {
4601
- const object = t41.cloneNode(node2.object, true);
4602
- const property = t41.cloneNode(node2.property, true);
4603
- return t41.optionalMemberExpression(object, property, node2.computed, true);
5037
+ if (t44.isMemberExpression(node2)) {
5038
+ const object = t44.cloneNode(node2.object, true);
5039
+ const property = t44.cloneNode(node2.property, true);
5040
+ return t44.optionalMemberExpression(object, property, node2.computed, true);
4604
5041
  }
4605
5042
  return node2;
4606
5043
  };
4607
5044
  return rebuildWithOptionalChain(node);
4608
5045
  }
4609
5046
  function hasTrailingMemberAccess(node) {
4610
- return t41.isMemberExpression(node.object) || t41.isOptionalMemberExpression(node.object);
5047
+ return t44.isMemberExpression(node.object) || t44.isOptionalMemberExpression(node.object);
4611
5048
  }
4612
5049
 
4613
5050
  // src/core/transform/sfc/script/shared/dependency-analyzer/shared-utils.ts
@@ -4634,7 +5071,7 @@ function traceBindingSource(binding, seen, depth) {
4634
5071
  }
4635
5072
  function isExpressionSourcedFromEligibleBinding(exp, scope, seen, depth) {
4636
5073
  if (depth <= 0) return null;
4637
- if (t42.isIdentifier(exp)) {
5074
+ if (t45.isIdentifier(exp)) {
4638
5075
  const sourceBinding = scope.getBinding(exp.name);
4639
5076
  if (!sourceBinding) return null;
4640
5077
  if (isEligibleBindingSource(sourceBinding)) {
@@ -4642,13 +5079,13 @@ function isExpressionSourcedFromEligibleBinding(exp, scope, seen, depth) {
4642
5079
  }
4643
5080
  return traceBindingSource(sourceBinding, seen, depth - 1);
4644
5081
  }
4645
- if (t42.isMemberExpression(exp) || t42.isOptionalMemberExpression(exp)) {
5082
+ if (t45.isMemberExpression(exp) || t45.isOptionalMemberExpression(exp)) {
4646
5083
  const root = findRootIdentifier(exp);
4647
5084
  if (!root) return null;
4648
5085
  const sourceBinding = scope.getBinding(root.name);
4649
5086
  if (!sourceBinding) return null;
4650
5087
  if (isEligibleBindingSource(sourceBinding)) {
4651
- return t42.cloneNode(exp);
5088
+ return t45.cloneNode(exp);
4652
5089
  }
4653
5090
  const sourcedRoot = traceBindingSource(sourceBinding, seen, depth - 1);
4654
5091
  if (sourcedRoot) {
@@ -4656,17 +5093,17 @@ function isExpressionSourcedFromEligibleBinding(exp, scope, seen, depth) {
4656
5093
  if (rebuilt) {
4657
5094
  return rebuilt;
4658
5095
  }
4659
- return t42.cloneNode(sourcedRoot, true);
5096
+ return t45.cloneNode(sourcedRoot, true);
4660
5097
  }
4661
5098
  }
4662
5099
  return null;
4663
5100
  }
4664
5101
  function rebuildMemberWithNewRoot(node, nextRoot) {
4665
5102
  const replacedObject = (() => {
4666
- if (t42.isIdentifier(node.object)) {
4667
- return t42.cloneNode(nextRoot, true);
5103
+ if (t45.isIdentifier(node.object)) {
5104
+ return t45.cloneNode(nextRoot, true);
4668
5105
  }
4669
- if (t42.isMemberExpression(node.object) || t42.isOptionalMemberExpression(node.object)) {
5106
+ if (t45.isMemberExpression(node.object) || t45.isOptionalMemberExpression(node.object)) {
4670
5107
  return rebuildMemberWithNewRoot(node.object, nextRoot);
4671
5108
  }
4672
5109
  return null;
@@ -4674,15 +5111,15 @@ function rebuildMemberWithNewRoot(node, nextRoot) {
4674
5111
  if (!replacedObject) {
4675
5112
  return null;
4676
5113
  }
4677
- const property = t42.cloneNode(node.property, true);
4678
- if (t42.isMemberExpression(node)) {
4679
- return t42.memberExpression(
5114
+ const property = t45.cloneNode(node.property, true);
5115
+ if (t45.isMemberExpression(node)) {
5116
+ return t45.memberExpression(
4680
5117
  replacedObject,
4681
5118
  property,
4682
5119
  node.computed
4683
5120
  );
4684
5121
  }
4685
- return t42.optionalMemberExpression(
5122
+ return t45.optionalMemberExpression(
4686
5123
  replacedObject,
4687
5124
  property,
4688
5125
  node.computed,
@@ -4693,9 +5130,9 @@ function rebuildMemberWithNewRoot(node, nextRoot) {
4693
5130
  // src/core/transform/sfc/script/shared/dependency-analyzer/index.ts
4694
5131
  function analyzeDeps(node, ctx, parentPath) {
4695
5132
  if (!parentPath) {
4696
- return t43.arrayExpression([]);
5133
+ return t46.arrayExpression([]);
4697
5134
  }
4698
- const isFnExpr = t43.isArrowFunctionExpression(node) || t43.isFunctionExpression(node);
5135
+ const isFnExpr = t46.isArrowFunctionExpression(node) || t46.isFunctionExpression(node);
4699
5136
  const analyzeTarget = isFnExpr ? node.body : node;
4700
5137
  const bindingLocalBoundary = isFnExpr ? node : analyzeTarget;
4701
5138
  const deps = /* @__PURE__ */ new Map();
@@ -4705,13 +5142,13 @@ function analyzeDeps(node, ctx, parentPath) {
4705
5142
  }
4706
5143
  const analyzeTargetPath = parentPath && parentPath.node === analyzeTarget ? parentPath : null;
4707
5144
  if (analyzeTargetPath) {
4708
- if (t43.isMemberExpression(analyzeTarget) || t43.isOptionalMemberExpression(analyzeTarget)) {
5145
+ if (t46.isMemberExpression(analyzeTarget) || t46.isOptionalMemberExpression(analyzeTarget)) {
4709
5146
  const rootId = findRootIdentifier(analyzeTarget);
4710
5147
  if (rootId) {
4711
5148
  tryAddDependency(analyzeTargetPath, rootId.name, analyzeTargetPath.scope);
4712
5149
  processedIdentifiers.add(rootId);
4713
5150
  }
4714
- } else if (t43.isIdentifier(analyzeTarget)) {
5151
+ } else if (t46.isIdentifier(analyzeTarget)) {
4715
5152
  tryAddDependency(analyzeTargetPath, analyzeTarget.name, analyzeTargetPath.scope);
4716
5153
  }
4717
5154
  }
@@ -4763,55 +5200,54 @@ function analyzeDeps(node, ctx, parentPath) {
4763
5200
  }
4764
5201
  }
4765
5202
  }
4766
- return t43.arrayExpression(Array.from(deps.values()));
5203
+ return t46.arrayExpression(Array.from(deps.values()));
4767
5204
  }
4768
5205
 
4769
- // src/core/transform/sfc/script/syntax-processor/process/resolve-analysis-only-adapter.ts
4770
- function resolveAnalysisOnlyAdapter(ctx) {
5206
+ // src/core/transform/sfc/script/syntax-processor/process/resolve-rename-adapter.ts
5207
+
5208
+ function resolveRenameAdapter(ctx) {
4771
5209
  return {
4772
5210
  "CallExpression|Identifier"(path8) {
4773
5211
  const node = path8.node;
4774
- const apiName = getApiName(node);
4775
- const adapter = ADAPTER_RULES.runtime[apiName];
4776
- if (!adapter || adapter.type !== "analyzed-deps") {
5212
+ const isCallNode = t47.isCallExpression(node);
5213
+ let apiName = "";
5214
+ if (t47.isIdentifier(node)) {
5215
+ apiName = node.name;
5216
+ } else if (isCallNode && t47.isIdentifier(node.callee)) {
5217
+ apiName = node.callee.name;
5218
+ }
5219
+ if (!apiName) {
5220
+ return;
5221
+ }
5222
+ const runtimeAdapter = ADAPTER_RULES.runtime[apiName];
5223
+ const routerAdapter = ADAPTER_RULES.router[apiName];
5224
+ const adapter = runtimeAdapter || routerAdapter;
5225
+ if (!adapter || adapter.type !== "rename") {
4777
5226
  return;
4778
5227
  }
4779
5228
  if (!isVueApiReference(path8, apiName)) {
4780
5229
  return;
4781
5230
  }
4782
- if (t44.isCallExpression(node)) {
4783
- resolveCallNode(path8, adapter, ctx);
5231
+ if (adapter.isTrackable) {
5232
+ const reactiveType = getReactiveType(apiName);
5233
+ const declaratorPath = getVariableDeclaratorPath(path8);
5234
+ setScriptNodeMeta(_optionalChain([declaratorPath, 'optionalAccess', _163 => _163.node]), {
5235
+ is_reactive: true,
5236
+ reactive_type: reactiveType
5237
+ });
5238
+ }
5239
+ if (isCallNode) {
5240
+ replaceCallName(node, adapter.target);
4784
5241
  } else {
4785
5242
  replaceIdName(node, adapter.target);
4786
5243
  }
5244
+ if (adapter.package === PACKAGE_NAME.router && !ctx.route) {
5245
+ ctx.route = true;
5246
+ }
4787
5247
  recordImport(ctx, adapter.package, adapter.target);
4788
5248
  }
4789
5249
  };
4790
5250
  }
4791
- function getApiName(node) {
4792
- const isCallNode = t44.isCallExpression(node);
4793
- let apiName = "";
4794
- if (t44.isIdentifier(node)) {
4795
- apiName = node.name;
4796
- } else if (isCallNode && t44.isIdentifier(node.callee)) {
4797
- apiName = node.callee.name;
4798
- }
4799
- return apiName;
4800
- }
4801
- function resolveCallNode(path8, adapter, ctx) {
4802
- const { node } = path8;
4803
- const { arguments: args } = node;
4804
- if (!args.length) return;
4805
- const fn = args[0];
4806
- if (!t44.isArrowFunctionExpression(fn) && !t44.isFunctionExpression(fn)) {
4807
- return;
4808
- }
4809
- const fnPath = path8.get("arguments")[0];
4810
- const deps = analyzeDeps(fn, ctx, fnPath);
4811
- args.push(deps);
4812
- replaceCallName(node, adapter.target);
4813
- recordImport(ctx, adapter.package, adapter.target);
4814
- }
4815
5251
  function isVueApiReference(path8, apiName) {
4816
5252
  if (path8.isIdentifier()) {
4817
5253
  if (path8.parentPath.isCallExpression() && path8.parentPath.node.callee === path8.node) {
@@ -4821,12 +5257,11 @@ function isVueApiReference(path8, apiName) {
4821
5257
  return false;
4822
5258
  }
4823
5259
  }
4824
- if (path8.isCallExpression()) {
4825
- const callee = path8.get("callee");
4826
- if (!callee.isIdentifier()) return false;
4827
- return isVueImportBinding(callee.scope.getBinding(apiName));
5260
+ const binding = path8.isCallExpression() ? path8.get("callee").scope.getBinding(apiName) : path8.scope.getBinding(apiName);
5261
+ if (binding) {
5262
+ return isVueImportBinding(binding);
4828
5263
  }
4829
- return isVueImportBinding(path8.scope.getBinding(apiName));
5264
+ return AUTO_IMPORTED_APIS.has(apiName);
4830
5265
  }
4831
5266
  function isVueImportBinding(binding) {
4832
5267
  if (!binding) return false;
@@ -4834,8 +5269,8 @@ function isVueImportBinding(binding) {
4834
5269
  if (!bindingPath.isImportSpecifier() && !bindingPath.isImportDefaultSpecifier() && !bindingPath.isImportNamespaceSpecifier()) {
4835
5270
  return false;
4836
5271
  }
4837
- const parent = _optionalChain([bindingPath, 'access', _148 => _148.parentPath, 'optionalAccess', _149 => _149.node]);
4838
- if (!parent || !t44.isImportDeclaration(parent)) {
5272
+ const parent = _optionalChain([bindingPath, 'access', _164 => _164.parentPath, 'optionalAccess', _165 => _165.node]);
5273
+ if (!parent || !t47.isImportDeclaration(parent)) {
4839
5274
  return false;
4840
5275
  }
4841
5276
  const source = parent.source.value.toLowerCase();
@@ -4848,6 +5283,53 @@ function isVueImportBinding(binding) {
4848
5283
  return VUE_PACKAGES.some((name) => source === name || source.startsWith(`${name}/`));
4849
5284
  }
4850
5285
 
5286
+ // src/core/transform/sfc/script/syntax-processor/process/resolve-analysis-only-adapter.ts
5287
+ function resolveAnalysisOnlyAdapter(ctx) {
5288
+ return {
5289
+ "CallExpression|Identifier"(path8) {
5290
+ const node = path8.node;
5291
+ const apiName = getApiName(node);
5292
+ const adapter = ADAPTER_RULES.runtime[apiName];
5293
+ if (!adapter || adapter.type !== "analyzed-deps") {
5294
+ return;
5295
+ }
5296
+ if (!isVueApiReference(path8, apiName)) {
5297
+ return;
5298
+ }
5299
+ if (t48.isCallExpression(node)) {
5300
+ resolveCallNode(path8, adapter, ctx);
5301
+ } else {
5302
+ replaceIdName(node, adapter.target);
5303
+ }
5304
+ recordImport(ctx, adapter.package, adapter.target);
5305
+ }
5306
+ };
5307
+ }
5308
+ function getApiName(node) {
5309
+ const isCallNode = t48.isCallExpression(node);
5310
+ let apiName = "";
5311
+ if (t48.isIdentifier(node)) {
5312
+ apiName = node.name;
5313
+ } else if (isCallNode && t48.isIdentifier(node.callee)) {
5314
+ apiName = node.callee.name;
5315
+ }
5316
+ return apiName;
5317
+ }
5318
+ function resolveCallNode(path8, adapter, ctx) {
5319
+ const { node } = path8;
5320
+ const { arguments: args } = node;
5321
+ if (!args.length) return;
5322
+ const fn = args[0];
5323
+ if (!t48.isArrowFunctionExpression(fn) && !t48.isFunctionExpression(fn)) {
5324
+ return;
5325
+ }
5326
+ const fnPath = path8.get("arguments")[0];
5327
+ const deps = analyzeDeps(fn, ctx, fnPath);
5328
+ args.push(deps);
5329
+ replaceCallName(node, adapter.target);
5330
+ recordImport(ctx, adapter.package, adapter.target);
5331
+ }
5332
+
4851
5333
  // src/core/transform/sfc/script/syntax-processor/process/resolve-arrow-deps.ts
4852
5334
  function resolveArrowFnDeps(ctx, ast) {
4853
5335
  return {
@@ -4861,7 +5343,7 @@ function resolveArrowFnDeps(ctx, ast) {
4861
5343
  const newNode = createUseCallback(node, deps);
4862
5344
  const declaratorPath = getVariableDeclaratorPath(path8);
4863
5345
  recordImport(ctx, PACKAGE_NAME.react, REACT_API_MAP.useCallback);
4864
- setScriptNodeMeta(_optionalChain([declaratorPath, 'optionalAccess', _150 => _150.node]), { is_reactive: true, reactive_type: "indirect" });
5346
+ setScriptNodeMeta(_optionalChain([declaratorPath, 'optionalAccess', _166 => _166.node]), { is_reactive: true, reactive_type: "indirect" });
4865
5347
  replaceNode(path8, newNode, node);
4866
5348
  }
4867
5349
  };
@@ -4920,15 +5402,15 @@ function resolveElementRef(ctx) {
4920
5402
  return;
4921
5403
  }
4922
5404
  if (isCompRefBindings) {
4923
- const varDeclaratorPath = _optionalChain([getVariableDeclaratorPath, 'call', _151 => _151(path8), 'optionalAccess', _152 => _152.node]);
4924
- if (!t45.isIdentifier(_optionalChain([varDeclaratorPath, 'optionalAccess', _153 => _153.id]))) {
5405
+ const varDeclaratorPath = _optionalChain([getVariableDeclaratorPath, 'call', _167 => _167(path8), 'optionalAccess', _168 => _168.node]);
5406
+ if (!t49.isIdentifier(_optionalChain([varDeclaratorPath, 'optionalAccess', _169 => _169.id]))) {
4925
5407
  return;
4926
5408
  }
4927
5409
  const varName = varDeclaratorPath.id.name;
4928
5410
  const compRef = refBindings.componentRefs[varName];
4929
5411
  if (!compRef) return;
4930
5412
  }
4931
- node.arguments[0] = t45.identifier("null");
5413
+ node.arguments[0] = t49.identifier("null");
4932
5414
  resolveTypeParameters(ctx, path8);
4933
5415
  replaceCallName(node, REACT_API_MAP.useRef);
4934
5416
  recordImport(ctx, PACKAGE_NAME.react, REACT_API_MAP.useRef);
@@ -4944,7 +5426,7 @@ function resolveTypeParameters(ctx, path8) {
4944
5426
  scriptData
4945
5427
  } = ctx;
4946
5428
  const { node } = path8;
4947
- const varDeclaratorNode = _optionalChain([getVariableDeclaratorPath, 'call', _154 => _154(path8), 'optionalAccess', _155 => _155.node]);
5429
+ const varDeclaratorNode = _optionalChain([getVariableDeclaratorPath, 'call', _170 => _170(path8), 'optionalAccess', _171 => _171.node]);
4948
5430
  if (!scriptData.lang.startsWith("ts") || !varDeclaratorNode) {
4949
5431
  return;
4950
5432
  }
@@ -4953,20 +5435,20 @@ function resolveTypeParameters(ctx, path8) {
4953
5435
  const compBindingMeta = refBindings.componentRefs[idName];
4954
5436
  if (!node.typeParameters && (domBindingMeta || compBindingMeta)) {
4955
5437
  const type = compBindingMeta ? "any" : domBindingMeta.htmlType;
4956
- node.typeParameters = t45.tsTypeParameterInstantiation([t45.tsTypeReference(t45.identifier(type))]);
5438
+ node.typeParameters = t49.tsTypeParameterInstantiation([t49.tsTypeReference(t49.identifier(type))]);
4957
5439
  }
4958
5440
  }
4959
5441
  function resolveRefValueToCurrent(path8) {
4960
5442
  const { node } = path8;
4961
- if (node.computed || !t45.isIdentifier(node.property) || node.property.name !== "value") {
5443
+ if (node.computed || !t49.isIdentifier(node.property) || node.property.name !== "value") {
4962
5444
  return;
4963
5445
  }
4964
5446
  const rootPath = findRootVariablePath(path8);
4965
- if (!_optionalChain([rootPath, 'optionalAccess', _156 => _156.node]) || !t45.isCallExpression(rootPath.node.init) || !isCalleeNamed(rootPath.node.init, REACT_API_MAP.useRef)) {
5447
+ if (!_optionalChain([rootPath, 'optionalAccess', _172 => _172.node]) || !t49.isCallExpression(rootPath.node.init) || !isCalleeNamed(rootPath.node.init, REACT_API_MAP.useRef)) {
4966
5448
  return;
4967
5449
  }
4968
5450
  const rootId = findRootIdentifier(node);
4969
- if (!t45.isIdentifier(node.object) || node.object.name !== _optionalChain([rootId, 'optionalAccess', _157 => _157.name])) {
5451
+ if (!t49.isIdentifier(node.object) || node.object.name !== _optionalChain([rootId, 'optionalAccess', _173 => _173.name])) {
4970
5452
  return;
4971
5453
  }
4972
5454
  node.property.name = "current";
@@ -4985,11 +5467,11 @@ function resolveExprMemo(ctx, ast) {
4985
5467
  if (!atComponentOrHookRoot(path8, ast.program, isScriptFile)) {
4986
5468
  return false;
4987
5469
  }
4988
- if (!t46.isVariableDeclaration(path8.parent) || path8.parent.kind !== "const") {
5470
+ if (!t50.isVariableDeclaration(path8.parent) || path8.parent.kind !== "const") {
4989
5471
  return false;
4990
5472
  }
4991
- if (t46.isFunction(init)) return false;
4992
- if (t46.isCallExpression(init) && t46.isIdentifier(init.callee) && init.callee.name.startsWith("use")) {
5473
+ if (t50.isFunction(init)) return false;
5474
+ if (t50.isCallExpression(init) && t50.isIdentifier(init.callee) && init.callee.name.startsWith("use")) {
4993
5475
  return false;
4994
5476
  }
4995
5477
  return true;
@@ -5014,10 +5496,10 @@ function resolveLintRules(ctx, ast) {
5014
5496
  return {
5015
5497
  CallExpression(path8) {
5016
5498
  const { node, parentPath } = path8;
5017
- if (!t47.isIdentifier(node.callee)) return;
5499
+ if (!t51.isIdentifier(node.callee)) return;
5018
5500
  const { name: callName } = node.callee;
5019
- const addLog = (t53) => {
5020
- logger.error(t53, {
5501
+ const addLog = (t56) => {
5502
+ logger.error(t56, {
5021
5503
  file: ctx.filename,
5022
5504
  source: ctx.scriptData.source,
5023
5505
  loc: node.loc
@@ -5079,7 +5561,7 @@ function resolveProvide(ctx) {
5079
5561
  });
5080
5562
  return;
5081
5563
  }
5082
- const providerTarget = _optionalChain([ADAPTER_RULES, 'access', _158 => _158.runtime, 'access', _159 => _159[VUE_API_MAP.provide], 'optionalAccess', _160 => _160.target]);
5564
+ const providerTarget = _optionalChain([ADAPTER_RULES, 'access', _174 => _174.runtime, 'access', _175 => _175[VUE_API_MAP.provide], 'optionalAccess', _176 => _176.target]);
5083
5565
  const isProvideCall = isCalleeNamed(node, VUE_API_MAP.provide) || providerTarget && isCalleeNamed(node, providerTarget);
5084
5566
  if (!isProvideCall) return;
5085
5567
  const { provide } = scriptData;
@@ -5097,7 +5579,7 @@ function findOrCreateCtxProvider(root) {
5097
5579
  return root;
5098
5580
  }
5099
5581
  let cur = root.provide;
5100
- while (_optionalChain([cur, 'optionalAccess', _161 => _161.isOccupied])) {
5582
+ while (_optionalChain([cur, 'optionalAccess', _177 => _177.isOccupied])) {
5101
5583
  cur = _nullishCoalesce(cur.provide, () => ( {}));
5102
5584
  }
5103
5585
  return cur || (root.provide = {});
@@ -5105,13 +5587,13 @@ function findOrCreateCtxProvider(root) {
5105
5587
  function assignProviderValue(target, key, value) {
5106
5588
  const getRawExp = (exp) => {
5107
5589
  if (!exp) return "''";
5108
- if (t48.isStringLiteral(exp)) {
5590
+ if (t52.isStringLiteral(exp)) {
5109
5591
  return JSON.stringify(exp.value);
5110
5592
  }
5111
- if (t48.isNumericLiteral(exp)) {
5593
+ if (t52.isNumericLiteral(exp)) {
5112
5594
  return exp.value.toString();
5113
5595
  }
5114
- if (t48.isIdentifier(exp)) {
5596
+ if (t52.isIdentifier(exp)) {
5115
5597
  return exp.name;
5116
5598
  }
5117
5599
  try {
@@ -5126,96 +5608,13 @@ function assignProviderValue(target, key, value) {
5126
5608
  target.provide = {};
5127
5609
  }
5128
5610
 
5129
- // src/core/transform/sfc/script/syntax-processor/process/resolve-rename-adapter.ts
5130
-
5131
- function resolveRenameAdapter(ctx) {
5132
- return {
5133
- "CallExpression|Identifier"(path8) {
5134
- const node = path8.node;
5135
- const isCallNode = t49.isCallExpression(node);
5136
- let apiName = "";
5137
- if (t49.isIdentifier(node)) {
5138
- apiName = node.name;
5139
- } else if (isCallNode && t49.isIdentifier(node.callee)) {
5140
- apiName = node.callee.name;
5141
- }
5142
- if (!apiName) {
5143
- return;
5144
- }
5145
- const runtimeAdapter = ADAPTER_RULES.runtime[apiName];
5146
- const routerAdapter = ADAPTER_RULES.router[apiName];
5147
- const adapter = runtimeAdapter || routerAdapter;
5148
- if (!adapter || adapter.type !== "rename") {
5149
- return;
5150
- }
5151
- if (!isVueApiReference2(path8, apiName)) {
5152
- return;
5153
- }
5154
- if (adapter.isTrackable) {
5155
- const reactiveType = getReactiveType(apiName);
5156
- const declaratorPath = getVariableDeclaratorPath(path8);
5157
- setScriptNodeMeta(_optionalChain([declaratorPath, 'optionalAccess', _162 => _162.node]), {
5158
- is_reactive: true,
5159
- reactive_type: reactiveType
5160
- });
5161
- }
5162
- if (isCallNode) {
5163
- replaceCallName(node, adapter.target);
5164
- } else {
5165
- replaceIdName(node, adapter.target);
5166
- }
5167
- if (adapter.package === PACKAGE_NAME.router && !ctx.route) {
5168
- ctx.route = true;
5169
- }
5170
- recordImport(ctx, adapter.package, adapter.target);
5171
- }
5172
- };
5173
- }
5174
- function isVueApiReference2(path8, apiName) {
5175
- const whitelist = [VUE_API_MAP.defineAsyncComponent];
5176
- if (whitelist.includes(apiName)) {
5177
- return true;
5178
- }
5179
- if (path8.isIdentifier()) {
5180
- if (path8.parentPath.isCallExpression() && path8.parentPath.node.callee === path8.node) {
5181
- return false;
5182
- }
5183
- if (!path8.isReferencedIdentifier()) {
5184
- return false;
5185
- }
5186
- }
5187
- if (path8.isCallExpression()) {
5188
- const callee = path8.get("callee");
5189
- if (!callee.isIdentifier()) return false;
5190
- return isVueImportBinding2(callee.scope.getBinding(apiName));
5191
- }
5192
- return isVueImportBinding2(path8.scope.getBinding(apiName));
5193
- }
5194
- function isVueImportBinding2(binding) {
5195
- if (!binding) return false;
5196
- const bindingPath = binding.path;
5197
- if (!bindingPath.isImportSpecifier() && !bindingPath.isImportDefaultSpecifier() && !bindingPath.isImportNamespaceSpecifier()) {
5198
- return false;
5199
- }
5200
- const parent = _optionalChain([bindingPath, 'access', _163 => _163.parentPath, 'optionalAccess', _164 => _164.node]);
5201
- if (!parent || !t49.isImportDeclaration(parent)) {
5202
- return false;
5203
- }
5204
- const source = parent.source.value.toLowerCase();
5205
- if (source.startsWith("@vue/")) {
5206
- return true;
5207
- }
5208
- if (source === "vue-router" || source.startsWith("vue-router/")) {
5209
- return true;
5210
- }
5211
- return VUE_PACKAGES.some((name) => source === name || source.startsWith(`${name}/`));
5212
- }
5213
-
5214
5611
  // src/core/transform/sfc/script/syntax-processor/index.ts
5215
5612
  function processVueSyntax2(ast, ctx) {
5216
5613
  vueSyntaxProcessor2(ast, ctx, {
5217
5614
  preprocess: {
5218
5615
  applyBabel: [
5616
+ // feature: https://github.com/vureact-js/core/issues/63
5617
+ resolveWithDefaultsOptions,
5219
5618
  resolvePropsIface,
5220
5619
  resolveEmitsTopLevelTypes,
5221
5620
  resolveDefineOptions,
@@ -5223,7 +5622,9 @@ function processVueSyntax2(ast, ctx) {
5223
5622
  resolveDefineAsyncComponent,
5224
5623
  resolveEmitCalls,
5225
5624
  // feature: https://github.com/vureact-js/core/issues/6
5226
- resolveUseAttrs
5625
+ resolveUseAttrs,
5626
+ // feature: https://github.com/vureact-js/core/issues/56
5627
+ resolveDefineModel
5227
5628
  ]
5228
5629
  },
5229
5630
  process: {
@@ -5242,6 +5643,8 @@ function processVueSyntax2(ast, ctx) {
5242
5643
  },
5243
5644
  postprocess: {
5244
5645
  applyBabel: [
5646
+ // feature: https://github.com/vureact-js/core/issues/63
5647
+ resolveWithDefaults,
5245
5648
  // 该 resolver 需确保放在所有类型处理之后,移除之前
5246
5649
  resolveVueTypeAsAny,
5247
5650
  resolveRuntimeImports,
@@ -5253,12 +5656,12 @@ function processVueSyntax2(ast, ctx) {
5253
5656
  }
5254
5657
  function vueSyntaxProcessor2(ast, ctx, options) {
5255
5658
  const runExcludeThenApply = (cfg) => {
5256
- _optionalChain([cfg, 'access', _165 => _165.excludeBabel, 'optionalAccess', _166 => _166.forEach, 'call', _167 => _167((fn) => fn(ctx, ast))]);
5257
- _optionalChain([cfg, 'access', _168 => _168.applyBabel, 'optionalAccess', _169 => _169.forEach, 'call', _170 => _170((fn) => _core.traverse.call(void 0, ast, fn(ctx, ast)))]);
5659
+ _optionalChain([cfg, 'access', _178 => _178.excludeBabel, 'optionalAccess', _179 => _179.forEach, 'call', _180 => _180((fn) => fn(ctx, ast))]);
5660
+ _optionalChain([cfg, 'access', _181 => _181.applyBabel, 'optionalAccess', _182 => _182.forEach, 'call', _183 => _183((fn) => _core.traverse.call(void 0, ast, fn(ctx, ast)))]);
5258
5661
  };
5259
5662
  const runApplyThenExclude = (cfg) => {
5260
- _optionalChain([cfg, 'access', _171 => _171.applyBabel, 'optionalAccess', _172 => _172.forEach, 'call', _173 => _173((fn) => _core.traverse.call(void 0, ast, fn(ctx, ast)))]);
5261
- _optionalChain([cfg, 'access', _174 => _174.excludeBabel, 'optionalAccess', _175 => _175.forEach, 'call', _176 => _176((fn) => fn(ctx, ast))]);
5663
+ _optionalChain([cfg, 'access', _184 => _184.applyBabel, 'optionalAccess', _185 => _185.forEach, 'call', _186 => _186((fn) => _core.traverse.call(void 0, ast, fn(ctx, ast)))]);
5664
+ _optionalChain([cfg, 'access', _187 => _187.excludeBabel, 'optionalAccess', _188 => _188.forEach, 'call', _189 => _189((fn) => fn(ctx, ast))]);
5262
5665
  };
5263
5666
  runExcludeThenApply(options.preprocess);
5264
5667
  runExcludeThenApply(options.process);
@@ -5266,7 +5669,6 @@ function vueSyntaxProcessor2(ast, ctx, options) {
5266
5669
  }
5267
5670
 
5268
5671
  // src/core/transform/sfc/script/index.ts
5269
- var SCRIPT_IR_KEY = "__vureact_script_block_ir";
5270
5672
  function resolveScript2(ast, ctx) {
5271
5673
  const scriptIR = createScriptIR();
5272
5674
  setScriptIR(ctx, scriptIR);
@@ -5280,14 +5682,14 @@ function resolveScript2(ast, ctx) {
5280
5682
  return scriptIR;
5281
5683
  }
5282
5684
  function getScriptIR(ctx) {
5283
- const ir = ctx.scriptData[SCRIPT_IR_KEY];
5685
+ const ir = ctx.scriptData.__vureact_script_block_ir;
5284
5686
  if (!ir) {
5285
5687
  throw new Error("Script IR is not initialized for current compilation context");
5286
5688
  }
5287
5689
  return ir;
5288
5690
  }
5289
5691
  function setScriptIR(ctx, ir) {
5290
- ctx.scriptData[SCRIPT_IR_KEY] = ir;
5692
+ ctx.scriptData.__vureact_script_block_ir = ir;
5291
5693
  }
5292
5694
  function createScriptIR() {
5293
5695
  return {
@@ -5345,9 +5747,9 @@ function isRouterLinkBooleanCustomProp(prop) {
5345
5747
 
5346
5748
 
5347
5749
  var strCodeTypes = {
5348
- isIdentifier: isIdentifier29,
5750
+ isIdentifier: isIdentifier32,
5349
5751
  isSimpleExpression,
5350
- isStringLiteral: isStringLiteral13
5752
+ isStringLiteral: isStringLiteral15
5351
5753
  };
5352
5754
  function isSimpleExpression(code, excludeVar = false) {
5353
5755
  let node;
@@ -5356,38 +5758,38 @@ function isSimpleExpression(code, excludeVar = false) {
5356
5758
  } catch (e7) {
5357
5759
  return false;
5358
5760
  }
5359
- if (t50.isLiteral(node)) {
5761
+ if (t53.isLiteral(node)) {
5360
5762
  return true;
5361
5763
  }
5362
- if (!excludeVar && t50.isIdentifier(node)) {
5764
+ if (!excludeVar && t53.isIdentifier(node)) {
5363
5765
  return true;
5364
5766
  }
5365
- if (t50.isMemberExpression(node)) {
5366
- return isSimpleExpression(node.object) && t50.isIdentifier(node.property);
5767
+ if (t53.isMemberExpression(node)) {
5768
+ return isSimpleExpression(node.object) && t53.isIdentifier(node.property);
5367
5769
  }
5368
- if (t50.isObjectExpression(node) || t50.isArrayExpression(node)) {
5770
+ if (t53.isObjectExpression(node) || t53.isArrayExpression(node)) {
5369
5771
  return false;
5370
5772
  }
5371
- if (t50.isCallExpression(node) || t50.isAssignmentExpression(node)) {
5773
+ if (t53.isCallExpression(node) || t53.isAssignmentExpression(node)) {
5372
5774
  return false;
5373
5775
  }
5374
- if (t50.isBinaryExpression(node) || t50.isUnaryExpression(node)) {
5776
+ if (t53.isBinaryExpression(node) || t53.isUnaryExpression(node)) {
5375
5777
  return true;
5376
5778
  }
5377
5779
  return false;
5378
5780
  }
5379
- function isIdentifier29(code) {
5781
+ function isIdentifier32(code) {
5380
5782
  try {
5381
5783
  const node = _parser.parseExpression.call(void 0, code);
5382
- return t50.isIdentifier(node);
5784
+ return t53.isIdentifier(node);
5383
5785
  } catch (e8) {
5384
5786
  return false;
5385
5787
  }
5386
5788
  }
5387
- function isStringLiteral13(code) {
5789
+ function isStringLiteral15(code) {
5388
5790
  try {
5389
5791
  const node = _parser.parseExpression.call(void 0, code);
5390
- return t50.isStringLiteral(node);
5792
+ return t53.isStringLiteral(node);
5391
5793
  } catch (e9) {
5392
5794
  return false;
5393
5795
  }
@@ -5497,12 +5899,12 @@ function wrapSingleQuotes(content, condition) {
5497
5899
  return condition || strCodeTypes.isStringLiteral(content) ? `'${content}'` : content;
5498
5900
  }
5499
5901
  function checkPropIsDynamicKey(ctx, node) {
5500
- const isKeyStatic = _optionalChain([node, 'access', _177 => _177.arg, 'optionalAccess', _178 => _178.isStatic]);
5902
+ const isKeyStatic = _optionalChain([node, 'access', _190 => _190.arg, 'optionalAccess', _191 => _191.isStatic]);
5501
5903
  const { source, filename } = ctx;
5502
5904
  if (node.rawName === "v-bind" && !node.name) {
5503
5905
  logger.warn("Keyless v-bind will overwrite all previously declared props at runtime.", {
5504
5906
  source,
5505
- loc: _optionalChain([node, 'access', _179 => _179.arg, 'optionalAccess', _180 => _180.loc]),
5907
+ loc: _optionalChain([node, 'access', _192 => _192.arg, 'optionalAccess', _193 => _193.loc]),
5506
5908
  file: filename
5507
5909
  });
5508
5910
  return;
@@ -5510,7 +5912,7 @@ function checkPropIsDynamicKey(ctx, node) {
5510
5912
  if (isKeyStatic === false) {
5511
5913
  logger.warn("Avoid using dynamic slot names, as they generate complex JSX prop expressions.", {
5512
5914
  source,
5513
- loc: _optionalChain([node, 'access', _181 => _181.arg, 'optionalAccess', _182 => _182.loc]),
5915
+ loc: _optionalChain([node, 'access', _194 => _194.arg, 'optionalAccess', _195 => _195.loc]),
5514
5916
  file: filename
5515
5917
  });
5516
5918
  }
@@ -5530,26 +5932,26 @@ function resolvePropAsBabelExp(ir, ctx) {
5530
5932
  const rule = ADAPTER_RULES.runtime;
5531
5933
  const setNameIdentifier = (target, valueName) => {
5532
5934
  target.content = valueName;
5533
- target.ast = t51.jsxIdentifier(valueName);
5935
+ target.ast = t54.jsxIdentifier(valueName);
5534
5936
  };
5535
- const setValueExpression = (target, content, isStringLiteral14) => {
5937
+ const setValueExpression = (target, content, isStringLiteral16) => {
5536
5938
  target.content = content;
5537
- target.ast = resolveStringExpr(content, ctx, isStringLiteral14);
5939
+ target.ast = resolveStringExpr(content, ctx, isStringLiteral16);
5538
5940
  };
5539
5941
  const createRuntimeCall = (fnName, args) => {
5540
5942
  const fnArgs = args.filter(Boolean).join(",");
5541
- const valIsUndef = fnName === rule.dirOn.target && _optionalChain([args, 'optionalAccess', _183 => _183[1]]) === "undefined";
5943
+ const valIsUndef = fnName === rule.dirOn.target && _optionalChain([args, 'optionalAccess', _196 => _196[1]]) === "undefined";
5542
5944
  const isTs = ctx.scriptData.lang.startsWith("ts");
5543
5945
  const safeTypeAssertion = isTs ? valIsUndef ? "as never" : "" : "";
5544
5946
  return `${fnName}(${fnArgs}) ${safeTypeAssertion}`;
5545
5947
  };
5546
- const applyRuntimeExpression = (expression, setName = false, nameIdentifier, isStringLiteral14) => {
5948
+ const applyRuntimeExpression = (expression, setName = false, nameIdentifier, isStringLiteral16) => {
5547
5949
  if (setName && nameIdentifier) {
5548
5950
  setNameIdentifier(nameExp, nameIdentifier);
5549
5951
  }
5550
5952
  const dir = rule.dir;
5551
5953
  recordImport(ctx, dir.package, dir.target);
5552
- setValueExpression(value.babelExp, expression, isStringLiteral14);
5954
+ setValueExpression(value.babelExp, expression, isStringLiteral16);
5553
5955
  };
5554
5956
  if (ir.isKeyLessVBind) {
5555
5957
  const dirKeyless = rule.dirKeyless;
@@ -5559,19 +5961,19 @@ function resolvePropAsBabelExp(ir, ctx) {
5559
5961
  }
5560
5962
  if (isClassAttr(name) && !value.isStringLiteral && !valueContent.startsWith(STYLE_MODULE_NAME)) {
5561
5963
  const dirCls = rule.dirCls;
5562
- const arg = _optionalChain([mergedItems, 'optionalAccess', _184 => _184.join, 'call', _185 => _185(",")]) || wrapSingleQuotes(valueContent);
5964
+ const arg = _optionalChain([mergedItems, 'optionalAccess', _197 => _197.join, 'call', _198 => _198(",")]) || wrapSingleQuotes(valueContent);
5563
5965
  const expression = createRuntimeCall(dirCls.target, [arg]);
5564
5966
  applyRuntimeExpression(expression, true, name);
5565
5967
  return;
5566
5968
  }
5567
- if (isStyleAttr(name) && (!isSimpleStyle(valueContent) || _optionalChain([mergedItems, 'optionalAccess', _186 => _186.some, 'call', _187 => _187((item) => !isSimpleStyle(item))]))) {
5969
+ if (isStyleAttr(name) && (!isSimpleStyle(valueContent) || _optionalChain([mergedItems, 'optionalAccess', _199 => _199.some, 'call', _200 => _200((item) => !isSimpleStyle(item))]))) {
5568
5970
  const dirStyle = rule.dirStyle;
5569
- const arg = _optionalChain([mergedItems, 'optionalAccess', _188 => _188.join, 'call', _189 => _189(",")]) || valueContent;
5971
+ const arg = _optionalChain([mergedItems, 'optionalAccess', _201 => _201.join, 'call', _202 => _202(",")]) || valueContent;
5570
5972
  const expression = createRuntimeCall(dirStyle.target, [arg]);
5571
5973
  applyRuntimeExpression(expression, true, name);
5572
5974
  return;
5573
5975
  }
5574
- if (ir.type === 3 /* EVENT */ && _optionalChain([ir, 'access', _190 => _190.modifiers, 'optionalAccess', _191 => _191.length])) {
5976
+ if (ir.type === 3 /* EVENT */ && _optionalChain([ir, 'access', _203 => _203.modifiers, 'optionalAccess', _204 => _204.length])) {
5575
5977
  const dirOn = rule.dirOn;
5576
5978
  const eventName = wrapSingleQuotes(ir.__vOnEvName || name, ir.isStatic);
5577
5979
  const expression = createRuntimeCall(dirOn.target, [eventName, valueContent]);
@@ -5626,7 +6028,7 @@ function resolveElementChildrenRules(children, ctx, parentIR, ir) {
5626
6028
  continue;
5627
6029
  }
5628
6030
  const nodeIR = child;
5629
- if (_optionalChain([parentIR, 'optionalAccess', _192 => _192.isBuiltIn])) {
6031
+ if (_optionalChain([parentIR, 'optionalAccess', _205 => _205.isBuiltIn])) {
5630
6032
  if (parentIR.tag == VUE_API_MAP.Transition) {
5631
6033
  resolveTransitionRules(nodeIR, parentIR, ir, ctx);
5632
6034
  }
@@ -5667,7 +6069,7 @@ function walkElementNodes(node, onElement) {
5667
6069
  }
5668
6070
  function resolveDefaultStyleModuleName(node) {
5669
6071
  const { exp } = node;
5670
- if (_optionalChain([exp, 'optionalAccess', _193 => _193.type]) !== _compilercore.NodeTypes.SIMPLE_EXPRESSION) {
6072
+ if (_optionalChain([exp, 'optionalAccess', _206 => _206.type]) !== _compilercore.NodeTypes.SIMPLE_EXPRESSION) {
5671
6073
  return;
5672
6074
  }
5673
6075
  if (exp.content.includes("$style")) {
@@ -5763,7 +6165,7 @@ function mergeStyleProps(oldAttr, newAttr) {
5763
6165
  const oldStyle = oldAttr.value.content;
5764
6166
  const newStyle = parseStyleString(newAttr.value.content);
5765
6167
  let merged = oldAttr.value.merge;
5766
- if (!_optionalChain([merged, 'optionalAccess', _194 => _194.length])) {
6168
+ if (!_optionalChain([merged, 'optionalAccess', _207 => _207.length])) {
5767
6169
  merged = oldAttr.value.merge = [oldStyle, newStyle];
5768
6170
  } else {
5769
6171
  merged.push(newStyle);
@@ -5793,7 +6195,7 @@ function warnUnsupportedVueDollarVar(ctx, node) {
5793
6195
  const { source, filename } = ctx;
5794
6196
  let value = "";
5795
6197
  let loc;
5796
- if (node.type === _compilercore.NodeTypes.DIRECTIVE && _optionalChain([node, 'access', _195 => _195.exp, 'optionalAccess', _196 => _196.type]) === _compilercore.NodeTypes.SIMPLE_EXPRESSION) {
6198
+ if (node.type === _compilercore.NodeTypes.DIRECTIVE && _optionalChain([node, 'access', _208 => _208.exp, 'optionalAccess', _209 => _209.type]) === _compilercore.NodeTypes.SIMPLE_EXPRESSION) {
5797
6199
  value = node.exp.content;
5798
6200
  loc = node.exp.loc;
5799
6201
  } else if (node.type === _compilercore.NodeTypes.INTERPOLATION && node.content.type === _compilercore.NodeTypes.SIMPLE_EXPRESSION) {
@@ -5847,11 +6249,11 @@ function resolveRefProp(prop, ctx, nodeIR) {
5847
6249
  } = ctx;
5848
6250
  let propIR;
5849
6251
  if (prop.type === _compilercore.NodeTypes.ATTRIBUTE) {
5850
- const tag = _optionalChain([prop, 'access', _197 => _197.value, 'optionalAccess', _198 => _198.content]);
6252
+ const tag = _optionalChain([prop, 'access', _210 => _210.value, 'optionalAccess', _211 => _211.content]);
5851
6253
  if (!tag) return;
5852
6254
  collectComponentRef(tag, ctx);
5853
6255
  const domRefBinding = Object.values(refBindings.domRefs).find((r) => r.tag === tag);
5854
- const refVar = _optionalChain([domRefBinding, 'optionalAccess', _199 => _199.name]) || _optionalChain([refBindings, 'access', _200 => _200.componentRefs, 'access', _201 => _201[tag], 'optionalAccess', _202 => _202.name]);
6256
+ const refVar = _optionalChain([domRefBinding, 'optionalAccess', _212 => _212.name]) || _optionalChain([refBindings, 'access', _213 => _213.componentRefs, 'access', _214 => _214[tag], 'optionalAccess', _215 => _215.name]);
5855
6257
  propIR = createPropsIR("ref", "ref", refVar || "null");
5856
6258
  } else {
5857
6259
  const exp = prop.exp;
@@ -5903,7 +6305,7 @@ function resolveTemplateNodeKey(templNode, keyContent, ctx) {
5903
6305
  return;
5904
6306
  }
5905
6307
  const [firstChild] = children;
5906
- if (_optionalChain([firstChild, 'optionalAccess', _203 => _203.type]) !== _compilercore.NodeTypes.ELEMENT || firstChild.tagType === _compilercore.ElementTypes.TEMPLATE || firstChild.tagType === _compilercore.ElementTypes.SLOT) {
6308
+ if (_optionalChain([firstChild, 'optionalAccess', _216 => _216.type]) !== _compilercore.NodeTypes.ELEMENT || firstChild.tagType === _compilercore.ElementTypes.TEMPLATE || firstChild.tagType === _compilercore.ElementTypes.SLOT) {
5907
6309
  return;
5908
6310
  }
5909
6311
  const hasKeyProp = firstChild.props.some(
@@ -5940,8 +6342,8 @@ function createSimpleVueBind(name, value) {
5940
6342
  function resolveDynamicAttributeProp(directive, ir, ctx, vueNode, nodeIR) {
5941
6343
  const arg = directive.arg;
5942
6344
  const exp = directive.exp;
5943
- const name = _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _204 => _204.content]), () => ( ""));
5944
- const content = _nullishCoalesce(_optionalChain([exp, 'optionalAccess', _205 => _205.content]), () => ( "true"));
6345
+ const name = _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _217 => _217.content]), () => ( ""));
6346
+ const content = _nullishCoalesce(_optionalChain([exp, 'optionalAccess', _218 => _218.content]), () => ( "true"));
5945
6347
  warnUnsupportedVueDollarVar(ctx, directive);
5946
6348
  if (name === "is") {
5947
6349
  resolveDynamicIsProp(directive, ir, ctx, nodeIR);
@@ -5956,7 +6358,7 @@ function resolveDynamicAttributeProp(directive, ir, ctx, vueNode, nodeIR) {
5956
6358
  return;
5957
6359
  }
5958
6360
  const propIR = createPropsIR(directive.rawName, name, content);
5959
- propIR.isStatic = _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _206 => _206.isStatic]), () => ( true));
6361
+ propIR.isStatic = _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _219 => _219.isStatic]), () => ( true));
5960
6362
  checkPropIsDynamicKey(ctx, directive);
5961
6363
  resolvePropertyIR(propIR, ir, ctx, nodeIR, true);
5962
6364
  }
@@ -5970,12 +6372,12 @@ function resolvePropertyIR(propsIR, ir, ctx, nodeIR, isDynamic = false) {
5970
6372
  content = propsIR.value.content = parseStyleString(content);
5971
6373
  }
5972
6374
  if (isDynamic) {
5973
- const isStringLiteral14 = strCodeTypes.isStringLiteral(content);
5974
- if (isStringLiteral14) {
6375
+ const isStringLiteral16 = strCodeTypes.isStringLiteral(content);
6376
+ if (isStringLiteral16) {
5975
6377
  content = normalizeString(content);
5976
6378
  propsIR.value.content = content;
5977
6379
  }
5978
- propsIR.value.isStringLiteral = isStringLiteral14;
6380
+ propsIR.value.isStringLiteral = isStringLiteral16;
5979
6381
  }
5980
6382
  const existing = findSameProp(nodeIR.props, propsIR);
5981
6383
  if (existing) {
@@ -5995,7 +6397,7 @@ function normalizeString(s) {
5995
6397
  // src/core/transform/sfc/template/syntax-processor/process/props/resolve-attribute-prop.ts
5996
6398
  function resolveAttributeProp(attribute, ir, ctx, nodeIR) {
5997
6399
  const name = attribute.name;
5998
- const content = _nullishCoalesce(_optionalChain([attribute, 'access', _207 => _207.value, 'optionalAccess', _208 => _208.content]), () => ( "true"));
6400
+ const content = _nullishCoalesce(_optionalChain([attribute, 'access', _220 => _220.value, 'optionalAccess', _221 => _221.content]), () => ( "true"));
5999
6401
  if (name === "is") {
6000
6402
  resolveStaticIsProp(content, ir, ctx, nodeIR);
6001
6403
  return;
@@ -6090,10 +6492,10 @@ function resolveRouterLinkVSlotProp(directive, nodeIR, ctx) {
6090
6492
  type: 2 /* SLOT */,
6091
6493
  name: "customRender",
6092
6494
  rawName: _nullishCoalesce(directive.rawName, () => ( "v-slot")),
6093
- isStatic: _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _209 => _209.isStatic]), () => ( true)),
6495
+ isStatic: _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _222 => _222.isStatic]), () => ( true)),
6094
6496
  isScoped: true,
6095
6497
  callback: {
6096
- arg: _nullishCoalesce(_optionalChain([exp, 'optionalAccess', _210 => _210.content, 'optionalAccess', _211 => _211.trim, 'call', _212 => _212()]), () => ( "")),
6498
+ arg: _nullishCoalesce(_optionalChain([exp, 'optionalAccess', _223 => _223.content, 'optionalAccess', _224 => _224.trim, 'call', _225 => _225()]), () => ( "")),
6097
6499
  exp: []
6098
6500
  }
6099
6501
  };
@@ -6109,10 +6511,10 @@ function resolveVFor(directive, ir, ctx, nodeIR) {
6109
6511
  };
6110
6512
  }
6111
6513
  function resolveForResult(forParseResult) {
6112
- const source = _optionalChain([forParseResult, 'access', _213 => _213.source, 'optionalAccess', _214 => _214.content]);
6113
- const value = _optionalChain([forParseResult, 'access', _215 => _215.value, 'optionalAccess', _216 => _216.content]);
6114
- const index = _optionalChain([forParseResult, 'access', _217 => _217.index, 'optionalAccess', _218 => _218.content]);
6115
- const key = _optionalChain([forParseResult, 'access', _219 => _219.key, 'optionalAccess', _220 => _220.content]);
6514
+ const source = _optionalChain([forParseResult, 'access', _226 => _226.source, 'optionalAccess', _227 => _227.content]);
6515
+ const value = _optionalChain([forParseResult, 'access', _228 => _228.value, 'optionalAccess', _229 => _229.content]);
6516
+ const index = _optionalChain([forParseResult, 'access', _230 => _230.index, 'optionalAccess', _231 => _231.content]);
6517
+ const key = _optionalChain([forParseResult, 'access', _232 => _232.key, 'optionalAccess', _233 => _233.content]);
6116
6518
  return {
6117
6519
  source,
6118
6520
  value,
@@ -6132,7 +6534,7 @@ function resolveVHtml(directive, ir, ctx, nodeIR) {
6132
6534
  // src/core/transform/sfc/template/syntax-processor/process/props/resolve-v-if.ts
6133
6535
  function resolveVIf(directive, ir, ctx, nodeIR, siblingNodesIR) {
6134
6536
  const name = directive.name === "else-if" ? "elseIf" : directive.name;
6135
- const value = _nullishCoalesce(_optionalChain([directive, 'access', _221 => _221.exp, 'optionalAccess', _222 => _222.content]), () => ( "true"));
6537
+ const value = _nullishCoalesce(_optionalChain([directive, 'access', _234 => _234.exp, 'optionalAccess', _235 => _235.content]), () => ( "true"));
6136
6538
  const prevNode = siblingNodesIR[siblingNodesIR.length - 1];
6137
6539
  const isElseBranch = name === "else" || name === "elseIf";
6138
6540
  let hasError = false;
@@ -6171,7 +6573,7 @@ function resolveVIf(directive, ir, ctx, nodeIR, siblingNodesIR) {
6171
6573
  // src/core/transform/sfc/template/syntax-processor/process/props/resolve-v-memo.ts
6172
6574
  function resolveVMemo(directive, _ir, ctx, nodeIR) {
6173
6575
  const exp = directive.exp;
6174
- let value = _optionalChain([exp, 'optionalAccess', _223 => _223.content]);
6576
+ let value = _optionalChain([exp, 'optionalAccess', _236 => _236.content]);
6175
6577
  if (value !== void 0) {
6176
6578
  if (!value.trim() || !value.startsWith("[") && !value.endsWith("]")) {
6177
6579
  const { source, filename } = ctx;
@@ -6211,14 +6613,14 @@ function resolveVModel(directive, ir, ctx, vueNode, nodeIR) {
6211
6613
  const getterName = exp.content;
6212
6614
  const isComponent = vueNode.tagType === _compilercore.ElementTypes.COMPONENT;
6213
6615
  const inputType = resolveHtmlInput(vueNode, isComponent);
6214
- const propName = _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _224 => _224.content]), () => ( resolveModelPropName(inputType, isComponent)));
6616
+ const propName = _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _237 => _237.content]), () => ( resolveModelPropName(inputType, isComponent)));
6215
6617
  let valuePropIR;
6216
6618
  let eventPropIR;
6217
6619
  if (isComponent) {
6218
6620
  valuePropIR = createPropsIR("v-model", propName, getterName);
6219
6621
  const eventReactName = `onUpdate${capitalize(camelCase(propName))}`;
6220
6622
  const eventVueName = `update:${propName}`;
6221
- const isTS = _optionalChain([ctx, 'access', _225 => _225.scriptData, 'optionalAccess', _226 => _226.lang, 'optionalAccess', _227 => _227.startsWith, 'call', _228 => _228("ts")]);
6623
+ const isTS = _optionalChain([ctx, 'access', _238 => _238.scriptData, 'optionalAccess', _239 => _239.lang, 'optionalAccess', _240 => _240.startsWith, 'call', _241 => _241("ts")]);
6222
6624
  const valueArg = isTS ? "value: any" : "value";
6223
6625
  const processedValue = applyValueModifiers("value", modifiers);
6224
6626
  const handlerBody = `(${valueArg}) => { ${getterName} = ${processedValue} }`;
@@ -6256,7 +6658,7 @@ function getRadioValue(vueNode) {
6256
6658
  const valueAttr = vueNode.props.find(
6257
6659
  (prop) => prop.type === _compilercore.NodeTypes.ATTRIBUTE && prop.name === "value"
6258
6660
  );
6259
- if (!_optionalChain([valueAttr, 'optionalAccess', _229 => _229.value, 'optionalAccess', _230 => _230.content])) return '""';
6661
+ if (!_optionalChain([valueAttr, 'optionalAccess', _242 => _242.value, 'optionalAccess', _243 => _243.content])) return '""';
6260
6662
  const content = valueAttr.value.content;
6261
6663
  return /^['"]/.test(content) ? content : `"${content}"`;
6262
6664
  }
@@ -6266,7 +6668,7 @@ function resolveHtmlInput(node, isComponent) {
6266
6668
  const typeProp = node.props.find(
6267
6669
  (prop) => prop.type === _compilercore.NodeTypes.ATTRIBUTE && prop.name === "type"
6268
6670
  );
6269
- return _optionalChain([typeProp, 'optionalAccess', _231 => _231.value, 'optionalAccess', _232 => _232.content, 'optionalAccess', _233 => _233.toLowerCase, 'call', _234 => _234()]);
6671
+ return _optionalChain([typeProp, 'optionalAccess', _244 => _244.value, 'optionalAccess', _245 => _245.content, 'optionalAccess', _246 => _246.toLowerCase, 'call', _247 => _247()]);
6270
6672
  }
6271
6673
  function applyValueModifiers(valueExp, modifiers) {
6272
6674
  let result = valueExp;
@@ -6287,7 +6689,7 @@ function resolveVOn(directive, ir, ctx, nodeIR) {
6287
6689
  const modifiers = directive.modifiers.map((item) => item.content);
6288
6690
  const captureIndex = resolveCaptureModifier(modifiers);
6289
6691
  const eventName = resolveEventName(arg.content, captureIndex);
6290
- const handlerContent = _optionalChain([exp, 'optionalAccess', _235 => _235.content, 'optionalAccess', _236 => _236.trim, 'call', _237 => _237()]) || "undefined";
6692
+ const handlerContent = _optionalChain([exp, 'optionalAccess', _248 => _248.content, 'optionalAccess', _249 => _249.trim, 'call', _250 => _250()]) || "undefined";
6291
6693
  const handler = resolveHandler(handlerContent, ctx, modifiers);
6292
6694
  const originalVueEventName = modifiers.length ? `${arg.content}.${modifiers.join(".")}` : "";
6293
6695
  const eventIR = createPropsIR(directive.rawName, eventName, handler);
@@ -6338,10 +6740,10 @@ function resolveHandler(handlerContent, ctx, modifiers) {
6338
6740
  return handler;
6339
6741
  }
6340
6742
  function isConsoleCall(expr) {
6341
- return t52.isCallExpression(expr) && t52.isMemberExpression(expr.callee) && t52.isIdentifier(expr.callee.object) && expr.callee.object.name === "console";
6743
+ return t55.isCallExpression(expr) && t55.isMemberExpression(expr.callee) && t55.isIdentifier(expr.callee.object) && expr.callee.object.name === "console";
6342
6744
  }
6343
6745
  function isFnReference(expr) {
6344
- return t52.isIdentifier(expr) || t52.isMemberExpression(expr) || t52.isFunction(expr);
6746
+ return t55.isIdentifier(expr) || t55.isMemberExpression(expr) || t55.isFunction(expr);
6345
6747
  }
6346
6748
 
6347
6749
  // src/core/transform/sfc/template/syntax-processor/process/props/resolve-v-show.ts
@@ -6374,7 +6776,7 @@ function resolveVSlotProp(directive, ir, ctx) {
6374
6776
  const name = !arg || arg.content === "default" ? "children" : arg.content;
6375
6777
  const content = !isScoped ? [] : void 0;
6376
6778
  const callback = isScoped ? {
6377
- arg: _nullishCoalesce(_optionalChain([exp, 'optionalAccess', _238 => _238.content, 'optionalAccess', _239 => _239.trim, 'call', _240 => _240()]), () => ( "")),
6779
+ arg: _nullishCoalesce(_optionalChain([exp, 'optionalAccess', _251 => _251.content, 'optionalAccess', _252 => _252.trim, 'call', _253 => _253()]), () => ( "")),
6378
6780
  exp: []
6379
6781
  } : void 0;
6380
6782
  checkPropIsDynamicKey(ctx, directive);
@@ -6382,7 +6784,7 @@ function resolveVSlotProp(directive, ir, ctx) {
6382
6784
  type: 2 /* SLOT */,
6383
6785
  name,
6384
6786
  rawName: _nullishCoalesce(directive.rawName, () => ( "default")),
6385
- isStatic: _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _241 => _241.isStatic]), () => ( true)),
6787
+ isStatic: _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _254 => _254.isStatic]), () => ( true)),
6386
6788
  isScoped,
6387
6789
  content,
6388
6790
  callback
@@ -6445,7 +6847,7 @@ function resolveElementNode(node, ir, ctx, siblingNodesIR) {
6445
6847
  if (routerAdapter) {
6446
6848
  if (!ctx.route) ctx.route = true;
6447
6849
  nodeIR.isRoute = true;
6448
- recordImport(ctx, _optionalChain([routerAdapter, 'optionalAccess', _242 => _242.package]), routerAdapter.target);
6850
+ recordImport(ctx, _optionalChain([routerAdapter, 'optionalAccess', _255 => _255.package]), routerAdapter.target);
6449
6851
  }
6450
6852
  resolveProps(node, ir, ctx, nodeIR, siblingNodesIR);
6451
6853
  return nodeIR;
@@ -6589,7 +6991,7 @@ function resolveSlotProps(node, ctx) {
6589
6991
  for (const prop of node.props) {
6590
6992
  if (prop.type === _compilercore.NodeTypes.ATTRIBUTE) {
6591
6993
  const attr = prop.name;
6592
- const value = _optionalChain([prop, 'access', _243 => _243.value, 'optionalAccess', _244 => _244.content, 'access', _245 => _245.trim, 'call', _246 => _246()]);
6994
+ const value = _optionalChain([prop, 'access', _256 => _256.value, 'optionalAccess', _257 => _257.content, 'access', _258 => _258.trim, 'call', _259 => _259()]);
6593
6995
  if (attr === "name" && value) {
6594
6996
  result.name = camelCase(value);
6595
6997
  } else {
@@ -6612,7 +7014,7 @@ function resolveSlotProps(node, ctx) {
6612
7014
  });
6613
7015
  }
6614
7016
  const key = arg.content;
6615
- const value = _optionalChain([exp, 'optionalAccess', _247 => _247.content, 'optionalAccess', _248 => _248.trim, 'call', _249 => _249()]) || "undefined";
7017
+ const value = _optionalChain([exp, 'optionalAccess', _260 => _260.content, 'optionalAccess', _261 => _261.trim, 'call', _262 => _262()]) || "undefined";
6616
7018
  if (key === "name") {
6617
7019
  result.name = camelCase(value);
6618
7020
  } else {
@@ -6682,19 +7084,19 @@ function resolveTemplate2(root, ctx) {
6682
7084
  // src/core/transform/sfc/index.ts
6683
7085
  function transform(ast, ctx, options) {
6684
7086
  const { template, script, style } = ast;
6685
- const templateIR = resolveTemplate2(_optionalChain([template, 'optionalAccess', _250 => _250.ast]), ctx);
6686
- const scriptIR = resolveScript2(_optionalChain([script, 'optionalAccess', _251 => _251.ast]), ctx);
7087
+ const templateIR = resolveTemplate2(_optionalChain([template, 'optionalAccess', _263 => _263.ast]), ctx);
7088
+ const scriptIR = resolveScript2(_optionalChain([script, 'optionalAccess', _264 => _264.ast]), ctx);
6687
7089
  const result = {
6688
7090
  template: templateIR,
6689
7091
  script: scriptIR,
6690
- style: _optionalChain([style, 'optionalAccess', _252 => _252.source, 'optionalAccess', _253 => _253.content])
7092
+ style: _optionalChain([style, 'optionalAccess', _265 => _265.source, 'optionalAccess', _266 => _266.content])
6691
7093
  };
6692
- executePlugins(_optionalChain([options, 'optionalAccess', _254 => _254.plugins]), result, ctx);
7094
+ executePlugins(_optionalChain([options, 'optionalAccess', _267 => _267.plugins]), result, ctx);
6693
7095
  return result;
6694
7096
  }
6695
7097
 
6696
7098
  // package.json
6697
- var version = "1.8.5";
7099
+ var version = "1.10.0";
6698
7100
  var bin = {
6699
7101
  vureact: "bin/vureact.js"
6700
7102
  };
@@ -6879,7 +7281,7 @@ var Helper = (_class5 = class {
6879
7281
  __init8() {this.outDir = "react-app"}
6880
7282
  constructor(opts) {;_class5.prototype.__init7.call(this);_class5.prototype.__init8.call(this);
6881
7283
  this.compilerOpts = opts;
6882
- if (_optionalChain([opts, 'access', _255 => _255.output, 'optionalAccess', _256 => _256.workspace])) {
7284
+ if (_optionalChain([opts, 'access', _268 => _268.output, 'optionalAccess', _269 => _269.workspace])) {
6883
7285
  this.workspaceDir = opts.output.workspace;
6884
7286
  }
6885
7287
  const excludePatterns = PathFilter.withDefaults(opts.exclude || []);
@@ -6909,7 +7311,7 @@ var Helper = (_class5 = class {
6909
7311
  }
6910
7312
  getOutDirName() {
6911
7313
  const { output } = this.compilerOpts;
6912
- return _optionalChain([output, 'optionalAccess', _257 => _257.outDir]) || this.outDir;
7314
+ return _optionalChain([output, 'optionalAccess', _270 => _270.outDir]) || this.outDir;
6913
7315
  }
6914
7316
  getWorkspaceDir() {
6915
7317
  return _path2.default.resolve(this.getProjectRoot(), this.workspaceDir);
@@ -6923,7 +7325,7 @@ var Helper = (_class5 = class {
6923
7325
  }
6924
7326
  getIgnoreAssets() {
6925
7327
  const { output } = this.compilerOpts;
6926
- if (_optionalChain([output, 'optionalAccess', _258 => _258.ignoreAssets])) {
7328
+ if (_optionalChain([output, 'optionalAccess', _271 => _271.ignoreAssets])) {
6927
7329
  return new Set(output.ignoreAssets.map(normalizePath));
6928
7330
  }
6929
7331
  return /* @__PURE__ */ new Set([
@@ -7013,12 +7415,12 @@ var Helper = (_class5 = class {
7013
7415
  */
7014
7416
  async formatCode({ code, fileInfo }) {
7015
7417
  const { format } = this.compilerOpts;
7016
- if (!_optionalChain([format, 'optionalAccess', _259 => _259.enabled])) return code;
7017
- if (_optionalChain([format, 'optionalAccess', _260 => _260.formatter]) === "builtin") {
7418
+ if (!_optionalChain([format, 'optionalAccess', _272 => _272.enabled])) return code;
7419
+ if (_optionalChain([format, 'optionalAccess', _273 => _273.formatter]) === "builtin") {
7018
7420
  return simpleFormat(code);
7019
7421
  }
7020
- const { lang } = _nullishCoalesce(_optionalChain([fileInfo, 'optionalAccess', _261 => _261.jsx]), () => ( _optionalChain([fileInfo, 'optionalAccess', _262 => _262.script])));
7021
- return await formatWithPrettier(code, lang, _optionalChain([format, 'optionalAccess', _263 => _263.prettierOptions]));
7422
+ const { lang } = _nullishCoalesce(_optionalChain([fileInfo, 'optionalAccess', _274 => _274.jsx]), () => ( _optionalChain([fileInfo, 'optionalAccess', _275 => _275.script])));
7423
+ return await formatWithPrettier(code, lang, _optionalChain([format, 'optionalAccess', _276 => _276.prettierOptions]));
7022
7424
  }
7023
7425
  /**
7024
7426
  * 通用的缓存校验工具函数
@@ -7052,7 +7454,7 @@ var Helper = (_class5 = class {
7052
7454
  * @param options.lock - 是否启用文件锁(默认false)
7053
7455
  */
7054
7456
  async writeFileWithDir(filePath, content, options) {
7055
- if (_optionalChain([options, 'optionalAccess', _264 => _264.lock])) {
7457
+ if (_optionalChain([options, 'optionalAccess', _277 => _277.lock])) {
7056
7458
  await fileLock.updateFile(filePath, async () => content, options);
7057
7459
  } else {
7058
7460
  await _fs2.default.promises.mkdir(_path2.default.dirname(filePath), { recursive: true });
@@ -7097,7 +7499,7 @@ var Helper = (_class5 = class {
7097
7499
  * 获取需要排除编译的文件
7098
7500
  */
7099
7501
  getExcludes() {
7100
- if (!_optionalChain([this, 'access', _265 => _265.compilerOpts, 'access', _266 => _266.exclude, 'optionalAccess', _267 => _267.length])) {
7502
+ if (!_optionalChain([this, 'access', _278 => _278.compilerOpts, 'access', _279 => _279.exclude, 'optionalAccess', _280 => _280.length])) {
7101
7503
  return PathFilter.withDefaults();
7102
7504
  }
7103
7505
  return this.compilerOpts.exclude;
@@ -7188,7 +7590,7 @@ function parseOnlyStyle(source, ctx, options) {
7188
7590
  ast: void 0
7189
7591
  }
7190
7592
  };
7191
- executePlugins(_optionalChain([options, 'optionalAccess', _268 => _268.plugins]), result, ctx);
7593
+ executePlugins(_optionalChain([options, 'optionalAccess', _281 => _281.plugins]), result, ctx);
7192
7594
  return result;
7193
7595
  }
7194
7596
 
@@ -7248,7 +7650,8 @@ var CompilationContext = (_class6 = class {constructor() { _class6.prototype.__i
7248
7650
  refField: "expose"
7249
7651
  },
7250
7652
  declaredOptions: {},
7251
- source: ""
7653
+ source: "",
7654
+ __vureact_script_block_ir: void 0
7252
7655
  },
7253
7656
  styleData: {
7254
7657
  filePath: ""
@@ -7322,16 +7725,16 @@ var BaseCompiler = (_class7 = class extends Helper {
7322
7725
  });
7323
7726
  const genOptions = this.prepareGenerateOptions(filename);
7324
7727
  const resolveSFCAndScriptFile = () => {
7325
- const ast = parse(source, ctx.data, { plugins: _optionalChain([plugins, 'optionalAccess', _269 => _269.parser]) });
7326
- const ir = transform(ast, ctx.data, { plugins: _optionalChain([plugins, 'optionalAccess', _270 => _270.transformer]) });
7728
+ const ast = parse(source, ctx.data, { plugins: _optionalChain([plugins, 'optionalAccess', _282 => _282.parser]) });
7729
+ const ir = transform(ast, ctx.data, { plugins: _optionalChain([plugins, 'optionalAccess', _283 => _283.transformer]) });
7327
7730
  const gen = generate(ir, ctx.data, {
7328
7731
  ...genOptions,
7329
- plugins: _optionalChain([plugins, 'optionalAccess', _271 => _271.codegen])
7732
+ plugins: _optionalChain([plugins, 'optionalAccess', _284 => _284.codegen])
7330
7733
  });
7331
7734
  return this.resolveMainResult(ir, gen, ctx.data);
7332
7735
  };
7333
7736
  const resolveStyleFile = () => {
7334
- const result = parseOnlyStyle(source, ctx.data, { plugins: _optionalChain([plugins, 'optionalAccess', _272 => _272.parser]) });
7737
+ const result = parseOnlyStyle(source, ctx.data, { plugins: _optionalChain([plugins, 'optionalAccess', _285 => _285.parser]) });
7335
7738
  return this.resolveStyleResult(result, ctx.data);
7336
7739
  };
7337
7740
  try {
@@ -7370,9 +7773,9 @@ var BaseCompiler = (_class7 = class extends Helper {
7370
7773
  lang
7371
7774
  },
7372
7775
  css: {
7373
- file: _optionalChain([styleData, 'optionalAccess', _273 => _273.filePath]),
7374
- hash: _optionalChain([styleData, 'optionalAccess', _274 => _274.scopeId]),
7375
- code: _optionalChain([ir, 'optionalAccess', _275 => _275.style])
7776
+ file: _optionalChain([styleData, 'optionalAccess', _286 => _286.filePath]),
7777
+ hash: _optionalChain([styleData, 'optionalAccess', _287 => _287.scopeId]),
7778
+ code: _optionalChain([ir, 'optionalAccess', _288 => _288.style])
7376
7779
  }
7377
7780
  },
7378
7781
  ...base
@@ -7522,12 +7925,12 @@ var CacheManager = (_class9 = class {
7522
7925
  const meta = { ...unit };
7523
7926
  delete meta.source;
7524
7927
  if (key === "sfc" /* SFC */) {
7525
- _optionalChainDelete([meta, 'access', _276 => _276.output, 'optionalAccess', _277 => _277.jsx, 'access', _278 => delete _278.code]);
7526
- _optionalChainDelete([meta, 'access', _279 => _279.output, 'optionalAccess', _280 => _280.css, 'access', _281 => delete _281.code]);
7928
+ _optionalChainDelete([meta, 'access', _289 => _289.output, 'optionalAccess', _290 => _290.jsx, 'access', _291 => delete _291.code]);
7929
+ _optionalChainDelete([meta, 'access', _292 => _292.output, 'optionalAccess', _293 => _293.css, 'access', _294 => delete _294.code]);
7527
7930
  } else if (key === "script" /* SCRIPT */) {
7528
- _optionalChainDelete([meta, 'access', _282 => _282.output, 'optionalAccess', _283 => _283.script, 'access', _284 => delete _284.code]);
7931
+ _optionalChainDelete([meta, 'access', _295 => _295.output, 'optionalAccess', _296 => _296.script, 'access', _297 => delete _297.code]);
7529
7932
  } else if (key === "style" /* STYLE */) {
7530
- _optionalChainDelete([meta, 'access', _285 => _285.output, 'optionalAccess', _286 => _286.style, 'access', _287 => delete _287.code]);
7933
+ _optionalChainDelete([meta, 'access', _298 => _298.output, 'optionalAccess', _299 => _299.style, 'access', _300 => delete _300.code]);
7531
7934
  }
7532
7935
  if (!this.pendingUpdates.has(key)) {
7533
7936
  this.pendingUpdates.set(key, []);
@@ -7547,7 +7950,7 @@ var CacheManager = (_class9 = class {
7547
7950
  }
7548
7951
  for (const key of keys) {
7549
7952
  const updates = this.pendingUpdates.get(key);
7550
- if (!_optionalChain([updates, 'optionalAccess', _288 => _288.length])) continue;
7953
+ if (!_optionalChain([updates, 'optionalAccess', _301 => _301.length])) continue;
7551
7954
  const entries = [...this.cachedData[key] || []];
7552
7955
  updates.forEach(({ unit, meta }) => {
7553
7956
  const idx = entries.findIndex((c) => c.file === unit.file);
@@ -7708,7 +8111,7 @@ var CleanupManager = class {
7708
8111
  const sfcMeta = meta;
7709
8112
  const { jsx, css } = sfcMeta.output;
7710
8113
  await this.fileCompiler.removeOutputFile(jsx.file);
7711
- if (_optionalChain([css, 'optionalAccess', _289 => _289.file])) {
8114
+ if (_optionalChain([css, 'optionalAccess', _302 => _302.file])) {
7712
8115
  await this.fileCompiler.removeOutputFile(css.file);
7713
8116
  }
7714
8117
  break;
@@ -7764,7 +8167,7 @@ var CompilationUnitProcessor = class {
7764
8167
  const isScriptFile = key === "script" /* SCRIPT */;
7765
8168
  const isStyleFile = key === "style" /* STYLE */;
7766
8169
  if (isSFC || isScriptFile) {
7767
- unit.hasRoute = _optionalChain([result, 'optionalAccess', _290 => _290.hasRoute]);
8170
+ unit.hasRoute = _optionalChain([result, 'optionalAccess', _303 => _303.hasRoute]);
7768
8171
  }
7769
8172
  const resolveFileInfo = () => {
7770
8173
  if (isSFC) {
@@ -7784,7 +8187,7 @@ var CompilationUnitProcessor = class {
7784
8187
  const { script } = result.fileInfo;
7785
8188
  unit.output = {
7786
8189
  script: {
7787
- file: _optionalChain([script, 'optionalAccess', _291 => _291.file]),
8190
+ file: _optionalChain([script, 'optionalAccess', _304 => _304.file]),
7788
8191
  code
7789
8192
  }
7790
8193
  };
@@ -7861,7 +8264,7 @@ var FileProcessor = (_class10 = class {
7861
8264
  const absPath = this.fileCompiler.getAbsPath(filePath);
7862
8265
  const fileMeta = await this.fileCompiler.getFileMeta(absPath);
7863
8266
  const cache = (this.fileCompiler.getIsCache() ? existingCache : void 0) || await this.cacheManager.loadCache(key);
7864
- const record = _optionalChain([cache, 'optionalAccess', _292 => _292.target, 'access', _293 => _293.find, 'call', _294 => _294((c) => c.file === absPath)]);
8267
+ const record = _optionalChain([cache, 'optionalAccess', _305 => _305.target, 'access', _306 => _306.find, 'call', _307 => _307((c) => c.file === absPath)]);
7865
8268
  const { shouldCompile, hash } = await this.fileCompiler.checkCacheStatus(
7866
8269
  fileMeta,
7867
8270
  record,
@@ -7883,10 +8286,10 @@ var FileProcessor = (_class10 = class {
7883
8286
  hash: hash || this.fileCompiler.genHash(source)
7884
8287
  };
7885
8288
  const processed = await this.compilationUnitProcessor.resolve(initUnit, key);
7886
- if (_optionalChain([processed, 'optionalAccess', _295 => _295.output])) {
8289
+ if (_optionalChain([processed, 'optionalAccess', _308 => _308.output])) {
7887
8290
  await this.compilationUnitProcessor.saveCompiledFiles(processed, key);
7888
8291
  if (key === "sfc" /* SFC */ || key === "script" /* SCRIPT */) {
7889
- if (_optionalChain([processed, 'optionalAccess', _296 => _296.hasRoute])) {
8292
+ if (_optionalChain([processed, 'optionalAccess', _309 => _309.hasRoute])) {
7890
8293
  await this.addRouterToPackageJson();
7891
8294
  await this.updateEntryWithRouterProvider();
7892
8295
  }
@@ -7903,13 +8306,13 @@ var FileProcessor = (_class10 = class {
7903
8306
  */
7904
8307
  async addRouterToPackageJson() {
7905
8308
  const { output } = this.fileCompiler.options;
7906
- if (_optionalChain([output, 'optionalAccess', _297 => _297.bootstrapVite]) === false) {
8309
+ if (_optionalChain([output, 'optionalAccess', _310 => _310.bootstrapVite]) === false) {
7907
8310
  return;
7908
8311
  }
7909
8312
  const { router } = RUNTIME_PACKAGES;
7910
8313
  const filePath = this.fileCompiler.getOutputPkgPath();
7911
8314
  const packageJson = await this.fileCompiler.resolvePackageFile(filePath);
7912
- if (_optionalChain([packageJson, 'optionalAccess', _298 => _298.dependencies, 'optionalAccess', _299 => _299[router.name]])) {
8315
+ if (_optionalChain([packageJson, 'optionalAccess', _311 => _311.dependencies, 'optionalAccess', _312 => _312[router.name]])) {
7913
8316
  return;
7914
8317
  }
7915
8318
  if (!packageJson.dependencies) {
@@ -7928,7 +8331,7 @@ var FileProcessor = (_class10 = class {
7928
8331
  const { exclude, output, router } = this.fileCompiler.options;
7929
8332
  const inputPath = this.fileCompiler.getInputPath();
7930
8333
  const outputPath = this.fileCompiler.getOuputPath(true);
7931
- if (_optionalChain([output, 'optionalAccess', _300 => _300.bootstrapVite]) === false || _optionalChain([router, 'optionalAccess', _301 => _301.autoUpdateEntry]) === false || !_optionalChain([router, 'optionalAccess', _302 => _302.configFile])) {
8334
+ if (_optionalChain([output, 'optionalAccess', _313 => _313.bootstrapVite]) === false || _optionalChain([router, 'optionalAccess', _314 => _314.autoUpdateEntry]) === false || !_optionalChain([router, 'optionalAccess', _315 => _315.configFile])) {
7932
8335
  return;
7933
8336
  }
7934
8337
  const getMainFile = async (filename) => {
@@ -7949,7 +8352,7 @@ var FileProcessor = (_class10 = class {
7949
8352
  const prepareRouterEntry = () => {
7950
8353
  const importPath = this.fileCompiler.resolveRelativePath(inputPath, router.configFile);
7951
8354
  let content = fileData.content;
7952
- if (_optionalChain([exclude, 'optionalAccess', _303 => _303.includes, 'call', _304 => _304(router.configFile)]) || _optionalChain([exclude, 'optionalAccess', _305 => _305.includes, 'call', _306 => _306(importPath)])) {
8355
+ if (_optionalChain([exclude, 'optionalAccess', _316 => _316.includes, 'call', _317 => _317(router.configFile)]) || _optionalChain([exclude, 'optionalAccess', _318 => _318.includes, 'call', _319 => _319(importPath)])) {
7953
8356
  return content;
7954
8357
  }
7955
8358
  const routerModule = "RouterInstance";
@@ -8056,7 +8459,7 @@ ${routerImport}`);
8056
8459
  const resolvedPath = normalizePath(fileCompiler.relativePath(input));
8057
8460
  const baseName = _path2.default.basename(input).toLowerCase();
8058
8461
  const exclusions = fileCompiler.getIgnoreAssets();
8059
- if (!_optionalChain([fileCompiler, 'access', _307 => _307.options, 'access', _308 => _308.output, 'optionalAccess', _309 => _309.ignoreAssets])) {
8462
+ if (!_optionalChain([fileCompiler, 'access', _320 => _320.options, 'access', _321 => _321.output, 'optionalAccess', _322 => _322.ignoreAssets])) {
8060
8463
  const shouldExclude = Array.from(exclusions).some((pattern) => {
8061
8464
  if (pattern.endsWith(".")) {
8062
8465
  return baseName.startsWith(pattern);
@@ -8192,7 +8595,7 @@ var ViteBootstrapper = (_class12 = class {
8192
8595
  const { output } = this.options;
8193
8596
  const workspaceDir = this.fileCompiler.getWorkspaceDir();
8194
8597
  await _fs2.default.promises.mkdir(workspaceDir, { recursive: true });
8195
- if (_optionalChain([output, 'optionalAccess', _310 => _310.bootstrapVite]) === false) {
8598
+ if (_optionalChain([output, 'optionalAccess', _323 => _323.bootstrapVite]) === false) {
8196
8599
  return false;
8197
8600
  }
8198
8601
  if (this.isSingleFile()) {
@@ -8232,7 +8635,7 @@ var ViteBootstrapper = (_class12 = class {
8232
8635
  const newDevDeps = resolveDeps(sourcePkg.devDependencies, newPkg.devDependencies, true);
8233
8636
  newPkg.dependencies = newDeps;
8234
8637
  newPkg.devDependencies = newDevDeps;
8235
- newPkg = _optionalChain([output, 'optionalAccess', _311 => _311.packageJson, 'optionalCall', _312 => _312(newPkg)]) || newPkg;
8638
+ newPkg = _optionalChain([output, 'optionalAccess', _324 => _324.packageJson, 'optionalCall', _325 => _325(newPkg)]) || newPkg;
8236
8639
  await this.fileCompiler.writeFileWithDir(outputPkgPath, JSON.stringify(newPkg, null, 2));
8237
8640
  this.spinner.succeed("Vite React environment initialized");
8238
8641
  return true;
@@ -8243,12 +8646,12 @@ var ViteBootstrapper = (_class12 = class {
8243
8646
  async resolveViteCreateApp() {
8244
8647
  const { output } = this.options;
8245
8648
  const { viteVersion, template: tmpl } = this.defaultConfig;
8246
- const bootstrapVite = _optionalChain([output, 'optionalAccess', _313 => _313.bootstrapVite]);
8649
+ const bootstrapVite = _optionalChain([output, 'optionalAccess', _326 => _326.bootstrapVite]);
8247
8650
  const outDirName = this.fileCompiler.getOutDirName();
8248
8651
  const configObject = typeof bootstrapVite === "object" ? bootstrapVite : null;
8249
- const viteVer = _optionalChain([configObject, 'optionalAccess', _314 => _314.vite]) || viteVersion;
8250
- const reactVer = _optionalChain([configObject, 'optionalAccess', _315 => _315.react]);
8251
- const template = _optionalChain([configObject, 'optionalAccess', _316 => _316.template]) || tmpl;
8652
+ const viteVer = _optionalChain([configObject, 'optionalAccess', _327 => _327.vite]) || viteVersion;
8653
+ const reactVer = _optionalChain([configObject, 'optionalAccess', _328 => _328.react]);
8654
+ const template = _optionalChain([configObject, 'optionalAccess', _329 => _329.template]) || tmpl;
8252
8655
  const cmd = `npm create vite${viteVer} ${outDirName} -- --template ${template}`;
8253
8656
  _child_process.execSync.call(void 0, cmd, {
8254
8657
  cwd: this.fileCompiler.getWorkspaceDir(),
@@ -8376,15 +8779,17 @@ var FileCompiler = (_class13 = class extends BaseCompiler {
8376
8779
  startTime = performance.now();
8377
8780
  this.updateSpinner("Scanning files...");
8378
8781
  const scanFiles = fileProcessor.scanFiles();
8379
- this.updateSpinner("Compiling Vue to React...");
8782
+ this.updateSpinner("Compiling components...");
8380
8783
  const sfcCount = await pipelineManager.runSFC(scanFiles.vue, cacheMap);
8784
+ this.updateSpinner("Compiling scripts...");
8381
8785
  const scriptCount = await pipelineManager.runScript(scanFiles.script, cacheMap);
8786
+ this.updateSpinner("Compiling styles...");
8382
8787
  const styleCount = await pipelineManager.runStyle(scanFiles.style, cacheMap);
8383
8788
  this.updateSpinner("Copying assets...");
8384
8789
  const assetCount = await assetManager.runAsset(scanFiles.assets, cacheMap);
8385
8790
  this.updateSpinner("Almost done...");
8386
8791
  await cacheManager.flushAllCache();
8387
- await _optionalChain([this, 'access', _317 => _317.options, 'access', _318 => _318.onSuccess, 'optionalCall', _319 => _319()]);
8792
+ await _optionalChain([this, 'access', _330 => _330.options, 'access', _331 => _331.onSuccess, 'optionalCall', _332 => _332()]);
8388
8793
  const endTime = calcElapsedTime(startTime);
8389
8794
  this.printCoreLogs();
8390
8795
  this.showCompileStats(endTime, sfcCount, scriptCount, styleCount, assetCount);
@@ -8436,7 +8841,7 @@ var FileCompiler = (_class13 = class extends BaseCompiler {
8436
8841
  return await this.manager.cleanupManager.removeOutputPath(targetPath, type);
8437
8842
  }
8438
8843
  showCompileStats(endTime, sfcCount, scriptCount, styleCount, assetCount) {
8439
- this.spinner.succeed(`Build completed in ${endTime}`);
8844
+ this.spinner.succeed(`Vue compiled to React in ${endTime}`);
8440
8845
  if (sfcCount || scriptCount || styleCount || assetCount) {
8441
8846
  const stats = [];
8442
8847
  if (sfcCount) stats.push(`${sfcCount} ${_kleur2.default.dim("SFC(s)")}`);