@vureact/compiler-core 1.8.5 → 1.9.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.9.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 t26 = _interopRequireWildcard(_types); var t28 = _interopRequireWildcard(_types); var t27 = _interopRequireWildcard(_types); var t29 = _interopRequireWildcard(_types); var t30 = _interopRequireWildcard(_types); var t38 = _interopRequireWildcard(_types); var t32 = _interopRequireWildcard(_types); var t31 = _interopRequireWildcard(_types); var t33 = _interopRequireWildcard(_types); var t36 = _interopRequireWildcard(_types); var t34 = _interopRequireWildcard(_types); var t35 = _interopRequireWildcard(_types); var t37 = _interopRequireWildcard(_types); var t39 = _interopRequireWildcard(_types); var t45 = _interopRequireWildcard(_types); var t44 = _interopRequireWildcard(_types); var t40 = _interopRequireWildcard(_types); var t41 = _interopRequireWildcard(_types); var t42 = _interopRequireWildcard(_types); var t43 = _interopRequireWildcard(_types); var t46 = _interopRequireWildcard(_types); var t47 = _interopRequireWildcard(_types); var t48 = _interopRequireWildcard(_types); var t49 = _interopRequireWildcard(_types); var t50 = _interopRequireWildcard(_types); var t52 = _interopRequireWildcard(_types); var t51 = _interopRequireWildcard(_types); var t53 = _interopRequireWildcard(_types);
28
28
 
29
29
  // src/consts/other.ts
30
30
  var PACKAGE_NAME = {
@@ -48,7 +48,8 @@ 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"
52
53
  };
53
54
  var DOLLAR_IDENTIFIERS = [
54
55
  "$data",
@@ -950,21 +951,21 @@ var Logger = (_class2 = class {constructor() { _class2.prototype.__init2.call(th
950
951
  }
951
952
  printAll(opts) {
952
953
  if (this.logs.length === 0) {
953
- console.log("No logs to display.");
954
+ !_optionalChain([opts, 'optionalAccess', _14 => _14._testMode]) && console.log("No logs to display.");
954
955
  return;
955
956
  }
956
957
  const orderedLogs = this.getOrderedLogs(opts);
957
958
  for (const log of orderedLogs) {
958
- console.log();
959
+ !_optionalChain([opts, 'optionalAccess', _15 => _15._testMode]) && console.log();
959
960
  console.log(this.formatHeader(log));
960
961
  const context = this.formatContext(log);
961
962
  if (context) {
962
963
  console.log(context);
963
964
  }
964
- console.log();
965
+ !_optionalChain([opts, 'optionalAccess', _16 => _16._testMode]) && console.log();
965
966
  }
966
967
  this.printSummary();
967
- console.log();
968
+ !_optionalChain([opts, 'optionalAccess', _17 => _17._testMode]) && console.log();
968
969
  }
969
970
  clear() {
970
971
  this.logs = [];
@@ -984,8 +985,8 @@ var logger = new Logger();
984
985
  // src/core/codegen/component/jsx/syntax-processor/process/build-slot-prop.ts
985
986
  function buildSlotProp(nodeIR, ctx) {
986
987
  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])) {
988
+ const childrenNodeIR = !nodeIR.isScoped ? nodeIR.content : _optionalChain([nodeIR, 'access', _18 => _18.callback, 'optionalAccess', _19 => _19.exp]);
989
+ if (!_optionalChain([childrenNodeIR, 'optionalAccess', _20 => _20.length])) {
989
990
  return null;
990
991
  }
991
992
  const jsxChild = childrenNodeIR.length > 1 ? buildFragmentNode(buildJsxChildren(childrenNodeIR, ctx)) : buildJsxNode(childrenNodeIR[0], ctx);
@@ -1015,7 +1016,7 @@ function convertSlotValueToExpression(nodeIR) {
1015
1016
  return convertJsxChildToExpression(nodeIR);
1016
1017
  }
1017
1018
  function buildSlotCallbackParams(nodeIR, ctx) {
1018
- const rawArg = _optionalChain([nodeIR, 'access', _17 => _17.callback, 'optionalAccess', _18 => _18.arg, 'optionalAccess', _19 => _19.trim, 'call', _20 => _20()]);
1019
+ const rawArg = _optionalChain([nodeIR, 'access', _21 => _21.callback, 'optionalAccess', _22 => _22.arg, 'optionalAccess', _23 => _23.trim, 'call', _24 => _24()]);
1019
1020
  if (!rawArg) {
1020
1021
  return [];
1021
1022
  }
@@ -1060,7 +1061,7 @@ function buildStandardProp(nodeIR) {
1060
1061
  babelExp: { ast: keyAST },
1061
1062
  value: {
1062
1063
  content,
1063
- isStringLiteral: isStringLiteral14,
1064
+ isStringLiteral: isStringLiteral15,
1064
1065
  babelExp: { ast: valueAST }
1065
1066
  }
1066
1067
  } = nodeIR;
@@ -1069,15 +1070,15 @@ function buildStandardProp(nodeIR) {
1069
1070
  }
1070
1071
  let value;
1071
1072
  if (content !== "true") {
1072
- value = isStringLiteral14 ? t9.stringLiteral(content) : buildJsxExpressionNode(valueAST);
1073
+ value = isStringLiteral15 ? t9.stringLiteral(content) : buildJsxExpressionNode(valueAST);
1073
1074
  }
1074
1075
  return t9.jsxAttribute(keyAST, value);
1075
1076
  }
1076
1077
 
1077
1078
  // src/core/codegen/component/jsx/syntax-processor/process/build-element-node/resolve-template-node.ts
1078
1079
  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]);
1080
+ const hasCondition = !!_optionalChain([nodeIR, 'access', _25 => _25.meta, 'optionalAccess', _26 => _26.condition]);
1081
+ const hasLoop = !!_optionalChain([nodeIR, 'access', _27 => _27.meta, 'optionalAccess', _28 => _28.loop, 'optionalAccess', _29 => _29.isLoop]);
1081
1082
  const hasSlot = nodeIR.props.some((p) => p.type === 2 /* SLOT */);
1082
1083
  if (hasCondition || hasLoop || hasSlot) {
1083
1084
  if (!children.length) {
@@ -1097,13 +1098,13 @@ function buildElementNode(nodeIR, ctx) {
1097
1098
  return null;
1098
1099
  }
1099
1100
  const { meta } = nodeIR;
1100
- if (_optionalChain([meta, 'optionalAccess', _26 => _26.condition]) && !meta.condition.isHandled) {
1101
+ if (_optionalChain([meta, 'optionalAccess', _30 => _30.condition]) && !meta.condition.isHandled) {
1101
1102
  return buildConditionNode(nodeIR, ctx);
1102
1103
  }
1103
- if (_optionalChain([meta, 'optionalAccess', _27 => _27.memo, 'optionalAccess', _28 => _28.isMemo]) && !meta.memo.isHandled) {
1104
+ if (_optionalChain([meta, 'optionalAccess', _31 => _31.memo, 'optionalAccess', _32 => _32.isMemo]) && !meta.memo.isHandled) {
1104
1105
  return buildMemoNode(nodeIR, ctx);
1105
1106
  }
1106
- if (_optionalChain([meta, 'optionalAccess', _29 => _29.loop, 'optionalAccess', _30 => _30.isLoop]) && !meta.loop.isHandled) {
1107
+ if (_optionalChain([meta, 'optionalAccess', _33 => _33.loop, 'optionalAccess', _34 => _34.isLoop]) && !meta.loop.isHandled) {
1107
1108
  return buildLoopNode(nodeIR, ctx);
1108
1109
  }
1109
1110
  const props = buildProps(nodeIR, ctx);
@@ -1154,7 +1155,7 @@ function buildConditionNode(nodeIR, ctx) {
1154
1155
  function buildCtxProviderNode(nodeIR, ctx, children) {
1155
1156
  const { name, value, provide: nextProvide } = nodeIR;
1156
1157
  let childNodes = children;
1157
- if (_optionalChain([nextProvide, 'optionalAccess', _31 => _31.isOccupied])) {
1158
+ if (_optionalChain([nextProvide, 'optionalAccess', _35 => _35.isOccupied])) {
1158
1159
  childNodes = [buildCtxProviderNode(nextProvide, ctx, children)];
1159
1160
  }
1160
1161
  const parseProviderExpr = (raw) => {
@@ -1229,7 +1230,7 @@ function jsxBuilder(nodeIR, ctx, state, options) {
1229
1230
 
1230
1231
  // src/core/codegen/component/jsx/index.ts
1231
1232
  function buildJSX(nodeIR, ctx) {
1232
- if (!_optionalChain([nodeIR, 'optionalAccess', _32 => _32.children, 'access', _33 => _33.length]) && ctx.inputType !== "sfc") {
1233
+ if (!_optionalChain([nodeIR, 'optionalAccess', _36 => _36.children, 'access', _37 => _37.length]) && ctx.inputType !== "sfc") {
1233
1234
  return null;
1234
1235
  }
1235
1236
  return buildJSXChild(nodeIR, ctx);
@@ -1266,6 +1267,7 @@ var REACT_API_MAP = {
1266
1267
  memo: "memo",
1267
1268
  useRef: "useRef",
1268
1269
  useMemo: "useMemo",
1270
+ useEffect: "useEffect",
1269
1271
  ReactNode: "ReactNode",
1270
1272
  forwardRef: "forwardRef",
1271
1273
  useCallback: "useCallback",
@@ -1337,7 +1339,7 @@ function resolveLocalStatements(local, jsx) {
1337
1339
  if (!local) return stmts;
1338
1340
  if (typeof local === "object" && "program" in local) {
1339
1341
  const program3 = local.program;
1340
- if (_optionalChain([program3, 'optionalAccess', _34 => _34.body, 'optionalAccess', _35 => _35.length])) {
1342
+ if (_optionalChain([program3, 'optionalAccess', _38 => _38.body, 'optionalAccess', _39 => _39.length])) {
1341
1343
  return [...program3.body, jsx];
1342
1344
  }
1343
1345
  }
@@ -1366,7 +1368,7 @@ function resolveForwardRef(body, ctx) {
1366
1368
  if (lang.startsWith("ts")) {
1367
1369
  const types = [t13.tsAnyKeyword()];
1368
1370
  if (propsId) {
1369
- const propsType = _optionalChain([propsId, 'optionalAccess', _36 => _36.typeAnnotation, 'optionalAccess', _37 => _37.typeAnnotation]);
1371
+ const propsType = _optionalChain([propsId, 'optionalAccess', _40 => _40.typeAnnotation, 'optionalAccess', _41 => _41.typeAnnotation]);
1370
1372
  types.push(propsType || t13.tsAnyKeyword());
1371
1373
  }
1372
1374
  callExpr.typeParameters = t13.tsTypeParameterInstantiation(types);
@@ -1408,7 +1410,7 @@ function resolvePropsTypeName(name, hasUseAttrsCall) {
1408
1410
 
1409
1411
  // src/core/codegen/component/script/syntax-processor/process/build-program-preamble.ts
1410
1412
  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);
1413
+ 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
1414
  state.preambleStatements = statements;
1413
1415
  void ctx;
1414
1416
  }
@@ -1468,7 +1470,7 @@ function generateComponent(ir, ctx, options) {
1468
1470
  code,
1469
1471
  source: ctx.source
1470
1472
  };
1471
- executePlugins(_optionalChain([options, 'optionalAccess', _43 => _43.plugins]), result, ctx);
1473
+ executePlugins(_optionalChain([options, 'optionalAccess', _47 => _47.plugins]), result, ctx);
1472
1474
  return result;
1473
1475
  }
1474
1476
 
@@ -1482,7 +1484,7 @@ function generateOnlyScript(ir, ctx, options) {
1482
1484
  code,
1483
1485
  source: ctx.source
1484
1486
  };
1485
- executePlugins(_optionalChain([options, 'optionalAccess', _44 => _44.plugins]), result, ctx);
1487
+ executePlugins(_optionalChain([options, 'optionalAccess', _48 => _48.plugins]), result, ctx);
1486
1488
  return result;
1487
1489
  }
1488
1490
 
@@ -1515,7 +1517,7 @@ function parseOnlyScript(source, ctx, options) {
1515
1517
  };
1516
1518
  ctx.scriptData.lang = lang;
1517
1519
  ctx.scriptData.source = source;
1518
- executePlugins(_optionalChain([options, 'optionalAccess', _45 => _45.plugins]), result, ctx);
1520
+ executePlugins(_optionalChain([options, 'optionalAccess', _49 => _49.plugins]), result, ctx);
1519
1521
  return result;
1520
1522
  }
1521
1523
 
@@ -1534,7 +1536,7 @@ var _core = require('@babel/core');
1534
1536
 
1535
1537
  function findRootVariablePath(path8) {
1536
1538
  const rootId = findRootIdentifier(path8.node);
1537
- if (!_optionalChain([rootId, 'optionalAccess', _46 => _46.name])) return null;
1539
+ if (!_optionalChain([rootId, 'optionalAccess', _50 => _50.name])) return null;
1538
1540
  const binding = path8.scope.getBinding(rootId.name);
1539
1541
  if (!binding) return null;
1540
1542
  const rootPath = getVariableDeclaratorPath(binding.path);
@@ -1642,11 +1644,11 @@ function replaceIdName(id, newName) {
1642
1644
  id.loc.identifierName = newName;
1643
1645
  }
1644
1646
  }
1645
- function stringValueToTSType(ctx, input, tsTypeAnnotation7) {
1647
+ function stringValueToTSType(ctx, input, tsTypeAnnotation8) {
1646
1648
  const { filename, scriptData } = ctx;
1647
1649
  const exp = stringToExpr(input, scriptData.lang, filename);
1648
1650
  const ts = expressionToTSType(exp);
1649
- return tsTypeAnnotation7 ? t15.tsTypeAnnotation(ts) : ts;
1651
+ return tsTypeAnnotation8 ? t15.tsTypeAnnotation(ts) : ts;
1650
1652
  }
1651
1653
  function expressionToTSType(exp) {
1652
1654
  if (t15.isStringLiteral(exp)) return t15.tsStringKeyword();
@@ -1740,6 +1742,28 @@ function cleanNodeComments(node) {
1740
1742
  node.innerComments = null;
1741
1743
  node.trailingComments = null;
1742
1744
  }
1745
+ function mapRuntimeTypeToTSType(value) {
1746
+ switch (value.name) {
1747
+ case "String":
1748
+ return t15.tsStringKeyword();
1749
+ case "Number":
1750
+ return t15.tsNumberKeyword();
1751
+ case "Boolean":
1752
+ return t15.tsBooleanKeyword();
1753
+ case "Object":
1754
+ return t15.tsTypeLiteral([]);
1755
+ case "Array":
1756
+ return t15.tsArrayType(t15.tsAnyKeyword());
1757
+ case "Function":
1758
+ return t15.tsFunctionType(null, [], t15.tsTypeAnnotation(t15.tsAnyKeyword()));
1759
+ case "Symbol":
1760
+ return t15.tsSymbolKeyword();
1761
+ case "BigInt":
1762
+ return t15.tsBigIntKeyword();
1763
+ default:
1764
+ return t15.tsAnyKeyword();
1765
+ }
1766
+ }
1743
1767
 
1744
1768
  // src/core/parse/sfc/postprocess/resolve-script-metadata/resolve-declared-options.ts
1745
1769
  function resolveDeclaredOptions(path8, ctx) {
@@ -1751,11 +1775,11 @@ function resolveDeclaredOptions(path8, ctx) {
1751
1775
  const [options] = node.arguments;
1752
1776
  if (!options || !t16.isObjectExpression(options)) {
1753
1777
  logger.warn(
1754
- `Expected argument to be of a type ["ObjectExpression"] but instead got "${_optionalChain([options, 'optionalAccess', _47 => _47.type])}".`,
1778
+ `Expected argument to be of a type ["ObjectExpression"] but instead got "${_optionalChain([options, 'optionalAccess', _51 => _51.type])}".`,
1755
1779
  {
1756
1780
  file: filename,
1757
1781
  source: scriptData.source,
1758
- loc: _optionalChain([options, 'optionalAccess', _48 => _48.loc]) || node.loc
1782
+ loc: _optionalChain([options, 'optionalAccess', _52 => _52.loc]) || node.loc
1759
1783
  }
1760
1784
  );
1761
1785
  return;
@@ -1775,7 +1799,7 @@ function resolveDeclaredOptions(path8, ctx) {
1775
1799
  {
1776
1800
  source,
1777
1801
  file: filename,
1778
- loc: _optionalChain([propKey, 'optionalAccess', _49 => _49.loc])
1802
+ loc: _optionalChain([propKey, 'optionalAccess', _53 => _53.loc])
1779
1803
  }
1780
1804
  );
1781
1805
  continue;
@@ -1792,7 +1816,7 @@ function resolveDeclaredOptions(path8, ctx) {
1792
1816
  {
1793
1817
  source,
1794
1818
  file: filename,
1795
- loc: _optionalChain([propKey, 'optionalAccess', _50 => _50.loc])
1819
+ loc: _optionalChain([propKey, 'optionalAccess', _54 => _54.loc])
1796
1820
  }
1797
1821
  );
1798
1822
  continue;
@@ -1895,7 +1919,7 @@ function resolveLocalTypeFromReference(path8, typeRef, ctx, macroName, visitedTy
1895
1919
  }
1896
1920
  }
1897
1921
  const programPath = path8.findParent((p) => p.isProgram());
1898
- if (!_optionalChain([programPath, 'optionalAccess', _51 => _51.isProgram, 'call', _52 => _52()])) {
1922
+ if (!_optionalChain([programPath, 'optionalAccess', _55 => _55.isProgram, 'call', _56 => _56()])) {
1899
1923
  return null;
1900
1924
  }
1901
1925
  const declaration = resolveTypeDeclarationInProgram(programPath.node.body, refName);
@@ -2017,7 +2041,7 @@ function collectEmitsFromTsType(tsType, names, path8, ctx, visitedTypeRefs, warn
2017
2041
  return;
2018
2042
  }
2019
2043
  if (t18.isTSTypeReference(tsType)) {
2020
- const innerTypes = _optionalChain([tsType, 'access', _53 => _53.typeParameters, 'optionalAccess', _54 => _54.params]) || [];
2044
+ const innerTypes = _optionalChain([tsType, 'access', _57 => _57.typeParameters, 'optionalAccess', _58 => _58.params]) || [];
2021
2045
  for (const type of innerTypes) {
2022
2046
  collectEmitsFromTsType(type, names, path8, ctx, visitedTypeRefs, warnedImportedTypeRefs);
2023
2047
  }
@@ -2153,7 +2177,7 @@ function collectPropsFromTsType(tsType, names, path8, ctx, visitedTypeRefs, warn
2153
2177
  return;
2154
2178
  }
2155
2179
  if (t19.isTSTypeReference(tsType)) {
2156
- const innerTypes = _optionalChain([tsType, 'access', _55 => _55.typeParameters, 'optionalAccess', _56 => _56.params]) || [];
2180
+ const innerTypes = _optionalChain([tsType, 'access', _59 => _59.typeParameters, 'optionalAccess', _60 => _60.params]) || [];
2157
2181
  for (const type of innerTypes) {
2158
2182
  collectPropsFromTsType(type, names, path8, ctx, visitedTypeRefs, warnedImportedTypeRefs);
2159
2183
  }
@@ -2198,11 +2222,11 @@ function resolveUseAttrsExists(path8, ctx) {
2198
2222
  if (!isCalleeNamed(node, VUE_API_MAP.useAttrs)) {
2199
2223
  return;
2200
2224
  }
2201
- if (_optionalChain([scriptData, 'optionalAccess', _57 => _57.hasUseAttrsCall])) {
2225
+ if (_optionalChain([scriptData, 'optionalAccess', _61 => _61.hasUseAttrsCall])) {
2202
2226
  return;
2203
2227
  }
2204
2228
  scriptData.hasUseAttrsCall = true;
2205
- const parent = _optionalChain([path8, 'access', _58 => _58.parentPath, 'optionalAccess', _59 => _59.node]);
2229
+ const parent = _optionalChain([path8, 'access', _62 => _62.parentPath, 'optionalAccess', _63 => _63.node]);
2206
2230
  if (parent && t20.isVariableDeclarator(parent) && t20.isIdentifier(parent.id)) {
2207
2231
  templateData.declaredAttrs = parent.id.name;
2208
2232
  }
@@ -2218,6 +2242,7 @@ var REACTIVE_TYPE_MAP = {
2218
2242
  toRefs: "ref",
2219
2243
  customRef: "ref",
2220
2244
  shallowRef: "ref",
2245
+ defineModel: "ref",
2221
2246
  reactive: "reactive",
2222
2247
  shallowReactive: "reactive",
2223
2248
  computed: "ref",
@@ -2339,7 +2364,7 @@ function resolveTemplateRefBindings(node, ctx) {
2339
2364
  return;
2340
2365
  }
2341
2366
  const varName = node.id.name;
2342
- const initValue = _optionalChain([init, 'access', _60 => _60.arguments, 'access', _61 => _61[0], 'optionalAccess', _62 => _62.value]);
2367
+ const initValue = _optionalChain([init, 'access', _64 => _64.arguments, 'access', _65 => _65[0], 'optionalAccess', _66 => _66.value]);
2343
2368
  refBindings.domRefs[varName] = {
2344
2369
  tag: initValue,
2345
2370
  name: varName,
@@ -2362,7 +2387,7 @@ function resolveVarBindings(node, ctx) {
2362
2387
 
2363
2388
  // src/core/parse/sfc/postprocess/resolve-script-metadata/index.ts
2364
2389
  function resolveScriptMeta(result, ctx) {
2365
- const scriptAst = _optionalChain([result, 'access', _63 => _63.script, 'optionalAccess', _64 => _64.ast]);
2390
+ const scriptAst = _optionalChain([result, 'access', _67 => _67.script, 'optionalAccess', _68 => _68.ast]);
2366
2391
  if (ctx.inputType !== "sfc" || !scriptAst) {
2367
2392
  return;
2368
2393
  }
@@ -2392,8 +2417,8 @@ function resolveScript(descriptor, ctx, parseResult) {
2392
2417
  }
2393
2418
  const { scriptSetup } = descriptor;
2394
2419
  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) => {
2420
+ if (_optionalChain([scriptSetup, 'optionalAccess', _69 => _69.warnings])) {
2421
+ _optionalChain([scriptSetup, 'optionalAccess', _70 => _70.warnings, 'access', _71 => _71.forEach, 'call', _72 => _72((msg) => {
2397
2422
  logger.warn(msg, { file: ctx.filename });
2398
2423
  })]);
2399
2424
  }
@@ -2411,7 +2436,7 @@ function resolveContext(scriptSetup, ctx) {
2411
2436
  const regx = /\/\/\s*@vr-name:\s*(\w+)/;
2412
2437
  const nameMatch = source.match(regx);
2413
2438
  content = content.replace(regx, "");
2414
- return _optionalChain([nameMatch, 'optionalAccess', _69 => _69[1], 'optionalAccess', _70 => _70.trim, 'call', _71 => _71()]) || "";
2439
+ return _optionalChain([nameMatch, 'optionalAccess', _73 => _73[1], 'optionalAccess', _74 => _74.trim, 'call', _75 => _75()]) || "";
2415
2440
  };
2416
2441
  scriptData.declaredOptions.name = resolveVRComment(content);
2417
2442
  scriptData.lang = lang || "js";
@@ -2431,7 +2456,7 @@ var _postcssselectorparser = require('postcss-selector-parser'); var _postcsssel
2431
2456
  // src/plugins/postcss/utils.ts
2432
2457
  function findFirstPseudoIndex(nodes, start, end) {
2433
2458
  for (let i = start; i <= end; i++) {
2434
- if (_optionalChain([nodes, 'access', _72 => _72[i], 'optionalAccess', _73 => _73.type]) === "pseudo") {
2459
+ if (_optionalChain([nodes, 'access', _76 => _76[i], 'optionalAccess', _77 => _77.type]) === "pseudo") {
2435
2460
  return i;
2436
2461
  }
2437
2462
  }
@@ -2443,7 +2468,7 @@ function hasScopeAttribute(nodes, start, end, scopeId) {
2443
2468
  }
2444
2469
  for (let i = start; i <= end; i++) {
2445
2470
  const node = nodes[i];
2446
- if (_optionalChain([node, 'optionalAccess', _74 => _74.type]) === "attribute" && node.attribute === scopeId) {
2471
+ if (_optionalChain([node, 'optionalAccess', _78 => _78.type]) === "attribute" && node.attribute === scopeId) {
2447
2472
  return true;
2448
2473
  }
2449
2474
  }
@@ -2454,7 +2479,7 @@ function hasNestingSelector(nodes, start, end) {
2454
2479
  return false;
2455
2480
  }
2456
2481
  for (let i = start; i <= end; i++) {
2457
- if (_optionalChain([nodes, 'access', _75 => _75[i], 'optionalAccess', _76 => _76.type]) === "nesting") {
2482
+ if (_optionalChain([nodes, 'access', _79 => _79[i], 'optionalAccess', _80 => _80.type]) === "nesting") {
2458
2483
  return true;
2459
2484
  }
2460
2485
  }
@@ -2468,18 +2493,18 @@ function findScopeTargetIndex(nodes, start, end) {
2468
2493
  let nestingFallback = -1;
2469
2494
  for (let i = start; i <= end; i++) {
2470
2495
  const node = nodes[i];
2471
- if (_optionalChain([node, 'optionalAccess', _77 => _77.type]) === "nesting") {
2496
+ if (_optionalChain([node, 'optionalAccess', _81 => _81.type]) === "nesting") {
2472
2497
  nestingFallback = i;
2473
2498
  continue;
2474
2499
  }
2475
- if (_optionalChain([node, 'optionalAccess', _78 => _78.type]) === "tag" || _optionalChain([node, 'optionalAccess', _79 => _79.type]) === "class" || _optionalChain([node, 'optionalAccess', _80 => _80.type]) === "id") {
2500
+ if (_optionalChain([node, 'optionalAccess', _82 => _82.type]) === "tag" || _optionalChain([node, 'optionalAccess', _83 => _83.type]) === "class" || _optionalChain([node, 'optionalAccess', _84 => _84.type]) === "id") {
2476
2501
  candidate = i;
2477
2502
  }
2478
2503
  }
2479
2504
  return candidate === -1 ? nestingFallback : candidate;
2480
2505
  }
2481
2506
  function isRuleIgnored(rule) {
2482
- return rule.parent != null && rule.parent.type === "atrule" && _optionalChain([rule, 'access', _81 => _81.parent, 'optionalAccess', _82 => _82.name]) === "keyframes";
2507
+ return rule.parent != null && rule.parent.type === "atrule" && _optionalChain([rule, 'access', _85 => _85.parent, 'optionalAccess', _86 => _86.name]) === "keyframes";
2483
2508
  }
2484
2509
  function isNestedInRule(rule) {
2485
2510
  let current = rule.parent;
@@ -2503,7 +2528,7 @@ function resolveStandard(s, scopeId) {
2503
2528
  }
2504
2529
  let compoundStart = 0;
2505
2530
  for (let i = compoundEnd; i >= 0; i--) {
2506
- if (_optionalChain([selector, 'access', _83 => _83.nodes, 'access', _84 => _84[i], 'optionalAccess', _85 => _85.type]) === "combinator") {
2531
+ if (_optionalChain([selector, 'access', _87 => _87.nodes, 'access', _88 => _88[i], 'optionalAccess', _89 => _89.type]) === "combinator") {
2507
2532
  compoundStart = i + 1;
2508
2533
  break;
2509
2534
  }
@@ -2561,13 +2586,13 @@ function resolveSingleSelectorWithDeep(selector, scopeId, nestedInRule) {
2561
2586
  return [resolveStandard(selector.toString(), scopeId)];
2562
2587
  }
2563
2588
  const deepNode = selector.nodes[deepIndex];
2564
- if (_optionalChain([deepNode, 'optionalAccess', _86 => _86.type]) !== "pseudo") {
2589
+ if (_optionalChain([deepNode, 'optionalAccess', _90 => _90.type]) !== "pseudo") {
2565
2590
  return [resolveStandard(selector.toString(), scopeId)];
2566
2591
  }
2567
2592
  const leftRaw = selector.nodes.slice(0, deepIndex).map((node) => node.toString()).join("");
2568
2593
  const rightRaw = selector.nodes.slice(deepIndex + 1).map((node) => node.toString()).join("");
2569
2594
  const leftScoped = scopeDeepLeftSide(leftRaw, scopeId, nestedInRule);
2570
- const deepInnerSelectors = _optionalChain([deepNode, 'access', _87 => _87.nodes, 'optionalAccess', _88 => _88.length]) ? deepNode.nodes : [];
2595
+ const deepInnerSelectors = _optionalChain([deepNode, 'access', _91 => _91.nodes, 'optionalAccess', _92 => _92.length]) ? deepNode.nodes : [];
2571
2596
  if (!deepInnerSelectors.length) {
2572
2597
  return [leftScoped + rightRaw];
2573
2598
  }
@@ -2585,7 +2610,7 @@ function resolveSingleSelectorWithDeep(selector, scopeId, nestedInRule) {
2585
2610
  function findTopLevelDeepIndex(nodes) {
2586
2611
  for (let i = 0; i < nodes.length; i++) {
2587
2612
  const node = nodes[i];
2588
- if (_optionalChain([node, 'optionalAccess', _89 => _89.type]) === "pseudo" && (node.value === ":deep" || node.value === "::v-deep")) {
2613
+ if (_optionalChain([node, 'optionalAccess', _93 => _93.type]) === "pseudo" && (node.value === ":deep" || node.value === "::v-deep")) {
2589
2614
  return i;
2590
2615
  }
2591
2616
  }
@@ -2612,7 +2637,7 @@ function injectScopeToRightMostCompound(selector, scopeId) {
2612
2637
  return;
2613
2638
  }
2614
2639
  let compoundEnd = nodes.length - 1;
2615
- while (compoundEnd >= 0 && _optionalChain([nodes, 'access', _90 => _90[compoundEnd], 'optionalAccess', _91 => _91.type]) === "combinator") {
2640
+ while (compoundEnd >= 0 && _optionalChain([nodes, 'access', _94 => _94[compoundEnd], 'optionalAccess', _95 => _95.type]) === "combinator") {
2616
2641
  compoundEnd--;
2617
2642
  }
2618
2643
  if (compoundEnd < 0) {
@@ -2620,7 +2645,7 @@ function injectScopeToRightMostCompound(selector, scopeId) {
2620
2645
  }
2621
2646
  let compoundStart = 0;
2622
2647
  for (let i = compoundEnd; i >= 0; i--) {
2623
- if (_optionalChain([nodes, 'access', _92 => _92[i], 'optionalAccess', _93 => _93.type]) === "combinator") {
2648
+ if (_optionalChain([nodes, 'access', _96 => _96[i], 'optionalAccess', _97 => _97.type]) === "combinator") {
2624
2649
  compoundStart = i + 1;
2625
2650
  break;
2626
2651
  }
@@ -2662,7 +2687,7 @@ function resolveSelector(s, scopeId, options) {
2662
2687
  return s.replace(/:global\(([^)]+)\)/g, (_, inner) => inner);
2663
2688
  }
2664
2689
  if (s.includes(":deep(")) {
2665
- return resolveDeep(s, scopeId, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _94 => _94.nestedInRule]), () => ( false)));
2690
+ return resolveDeep(s, scopeId, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _98 => _98.nestedInRule]), () => ( false)));
2666
2691
  }
2667
2692
  if (s.includes(":slotted(")) {
2668
2693
  return s.replace(/:slotted\((.*)\)/, "$1");
@@ -2816,7 +2841,7 @@ function resolveStyles(descriptor, ctx, result) {
2816
2841
  var _compilercore = require('@vue/compiler-core');
2817
2842
  function resolveTemplate(descriptor, _, result) {
2818
2843
  const block = descriptor.template;
2819
- if (!_optionalChain([block, 'optionalAccess', _95 => _95.content])) return null;
2844
+ if (!_optionalChain([block, 'optionalAccess', _99 => _99.content])) return null;
2820
2845
  result.template = {
2821
2846
  ast: _compilercore.baseParse.call(void 0, block.content),
2822
2847
  source: block
@@ -2833,7 +2858,7 @@ function processVueSyntax(descriptor, ctx, result) {
2833
2858
  }
2834
2859
  function vueSyntaxProcessor(descriptor, ctx, result, options) {
2835
2860
  const run = (p, type) => {
2836
- _optionalChain([p, 'optionalAccess', _96 => _96.forEach, 'call', _97 => _97((handler) => {
2861
+ _optionalChain([p, 'optionalAccess', _100 => _100.forEach, 'call', _101 => _101((handler) => {
2837
2862
  if (type === "post") {
2838
2863
  handler(result, ctx);
2839
2864
  return;
@@ -2857,7 +2882,7 @@ function parseSFC(source, ctx, options) {
2857
2882
  };
2858
2883
  collectErrs(descriptor, errors);
2859
2884
  processVueSyntax(descriptor, ctx, result);
2860
- executePlugins(_optionalChain([options, 'optionalAccess', _98 => _98.plugins]), result, ctx);
2885
+ executePlugins(_optionalChain([options, 'optionalAccess', _102 => _102.plugins]), result, ctx);
2861
2886
  return result;
2862
2887
  }
2863
2888
  function collectErrs(descriptor, errors) {
@@ -2865,7 +2890,7 @@ function collectErrs(descriptor, errors) {
2865
2890
  logger.error(err.message, {
2866
2891
  source: descriptor.source,
2867
2892
  file: descriptor.filename,
2868
- loc: _optionalChain([err, 'optionalAccess', _99 => _99.loc])
2893
+ loc: _optionalChain([err, 'optionalAccess', _103 => _103.loc])
2869
2894
  });
2870
2895
  }
2871
2896
  if (descriptor.cssVars.length) {
@@ -2889,7 +2914,7 @@ function parse(source, ctx, options) {
2889
2914
 
2890
2915
  // src/core/transform/sfc/script/syntax-processor/postprocess/resolve-ast-chunks/resolve-global-type-chunk.ts
2891
2916
  function resolveGlobalTypeChunks(path8, ir) {
2892
- if (!_optionalChain([path8, 'access', _100 => _100.parentPath, 'optionalAccess', _101 => _101.isProgram, 'call', _102 => _102()])) {
2917
+ if (!_optionalChain([path8, 'access', _104 => _104.parentPath, 'optionalAccess', _105 => _105.isProgram, 'call', _106 => _106()])) {
2893
2918
  return;
2894
2919
  }
2895
2920
  const forked = forkNode(path8.node);
@@ -3116,7 +3141,7 @@ function resolveRuntimeImports(ctx) {
3116
3141
  if (!hasImports) {
3117
3142
  const importNodes = createImportNodes(ctx);
3118
3143
  if (importNodes.length) {
3119
- if (_optionalChain([strategyResult, 'optionalAccess', _103 => _103.shouldInjectRuntimeImports])) {
3144
+ if (_optionalChain([strategyResult, 'optionalAccess', _107 => _107.shouldInjectRuntimeImports])) {
3120
3145
  path8.insertAfter(importNodes);
3121
3146
  } else if (finalModuleName === PACKAGE_NAME.react) {
3122
3147
  path8.insertAfter(importNodes);
@@ -3144,7 +3169,7 @@ function resolveRuntimeImports(ctx) {
3144
3169
  }
3145
3170
  function mergeImports(currentNode, ctx, moduleName) {
3146
3171
  const ctxImportItems = ctx.imports.get(moduleName);
3147
- if (!_optionalChain([ctxImportItems, 'optionalAccess', _104 => _104.length])) {
3172
+ if (!_optionalChain([ctxImportItems, 'optionalAccess', _108 => _108.length])) {
3148
3173
  return;
3149
3174
  }
3150
3175
  const currentImports = /* @__PURE__ */ new Set();
@@ -3194,7 +3219,7 @@ function forkProgramTopLeadingComments(target, program3) {
3194
3219
  }
3195
3220
  function forkFilePreambleLeadingComments(target, source) {
3196
3221
  const { leadingComments } = source;
3197
- if (!_optionalChain([leadingComments, 'optionalAccess', _105 => _105.length])) {
3222
+ if (!_optionalChain([leadingComments, 'optionalAccess', _109 => _109.length])) {
3198
3223
  return;
3199
3224
  }
3200
3225
  const commentsToMove = [];
@@ -3325,6 +3350,13 @@ function createUseMemo(body, deps) {
3325
3350
  function createUseImperativeHandle(refId, init) {
3326
3351
  return t27.callExpression(t27.identifier(REACT_API_MAP.useImperativeHandle), [refId, init]);
3327
3352
  }
3353
+ function createUseUpdated(body, deps) {
3354
+ const adapter = ADAPTER_RULES.runtime.onUpdated;
3355
+ return t27.callExpression(t27.identifier(adapter.target), [
3356
+ t27.arrowFunctionExpression([], body),
3357
+ _nullishCoalesce(deps, () => ( t27.identifier("undefined")))
3358
+ ]);
3359
+ }
3328
3360
 
3329
3361
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-define-expose.ts
3330
3362
  function resolveDefineExpose(ctx) {
@@ -3360,6 +3392,226 @@ function resolveDefineExpose(ctx) {
3360
3392
  };
3361
3393
  }
3362
3394
 
3395
+ // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-define-model.ts
3396
+
3397
+ function resolveDefineModel(ctx, ast) {
3398
+ if (ctx.inputType !== "sfc") return {};
3399
+ return {
3400
+ CallExpression(path8) {
3401
+ const { node } = path8;
3402
+ if (!isCalleeNamed(node, MACRO_API_NAMES.model)) {
3403
+ return;
3404
+ }
3405
+ if (!validateDefineModelUsage(path8, ctx)) {
3406
+ return;
3407
+ }
3408
+ const propInfo = extractPropInfo(node, ctx);
3409
+ replaceToUseVRef(node, propInfo, ctx);
3410
+ resolveAutoUpdate(ast, path8, propInfo, ctx);
3411
+ resolveInterface(propInfo, ctx);
3412
+ }
3413
+ };
3414
+ }
3415
+ function validateDefineModelUsage(path8, ctx) {
3416
+ const { node, parent } = path8;
3417
+ const { filename, scriptData } = ctx;
3418
+ const [arg1, arg2] = node.arguments;
3419
+ if (!t29.isObjectExpression(arg1) && !t29.isStringLiteral(arg1)) {
3420
+ logger.error(`Invalid argument type for defineModel. Expected a string.`, {
3421
+ file: filename,
3422
+ source: scriptData.source,
3423
+ loc: _optionalChain([arg1, 'optionalAccess', _110 => _110.loc])
3424
+ });
3425
+ return false;
3426
+ }
3427
+ const hasUnsupportedOption = (arg) => {
3428
+ if (!t29.isObjectExpression(arg)) {
3429
+ return false;
3430
+ }
3431
+ const result = arg.properties.some((prop) => {
3432
+ if ((t29.isObjectProperty(prop) || t29.isObjectMethod(prop)) && t29.isIdentifier(prop.key)) {
3433
+ const keyName = prop.key.name;
3434
+ if (keyName === "get" || keyName === "set" || keyName === "validator") {
3435
+ logger.error(`defineModel does not support '${keyName}' option.`, {
3436
+ file: filename,
3437
+ source: scriptData.source,
3438
+ loc: prop.key.loc
3439
+ });
3440
+ return true;
3441
+ }
3442
+ }
3443
+ });
3444
+ return !!result;
3445
+ };
3446
+ const isValidVariableAssignment = () => {
3447
+ const varDeclaration = path8.parentPath.parentPath;
3448
+ if (_optionalChain([varDeclaration, 'optionalAccess', _111 => _111.isVariableDeclaration, 'call', _112 => _112()]) && varDeclaration.node.declarations.length === 1 && t29.isArrayPattern(_optionalChain([varDeclaration, 'access', _113 => _113.node, 'access', _114 => _114.declarations, 'access', _115 => _115[0], 'optionalAccess', _116 => _116.id]))) {
3449
+ logger.error(
3450
+ `defineModel return value cannot be destructured with array pattern. Please use single variable assignment.`,
3451
+ {
3452
+ file: filename,
3453
+ source: scriptData.source,
3454
+ loc: varDeclaration.node.loc
3455
+ }
3456
+ );
3457
+ return false;
3458
+ }
3459
+ return true;
3460
+ };
3461
+ return !hasUnsupportedOption(arg1) && !hasUnsupportedOption(arg2) && isValidVariableAssignment();
3462
+ }
3463
+ function extractPropInfo(node, ctx) {
3464
+ const [arg1, arg2] = node.arguments;
3465
+ const propInfo = {
3466
+ name: "modelValue",
3467
+ updateEventName: "onUpdateModelValue",
3468
+ type: void 0,
3469
+ required: false,
3470
+ default: void 0
3471
+ };
3472
+ const findObjectProperty = (objExpr, propName) => {
3473
+ return objExpr.properties.find(
3474
+ (prop) => t29.isObjectProperty(prop) && t29.isIdentifier(prop.key) && prop.key.name === propName
3475
+ );
3476
+ };
3477
+ const setPropName = (info, value) => {
3478
+ if (!value.trim()) return;
3479
+ info.name = value;
3480
+ info.updateEventName = `onUpdate${capitalize(camelCase(value))}`;
3481
+ };
3482
+ const extractPropInfoFromObject = (objExpr) => {
3483
+ const result = {};
3484
+ const nameProp = findObjectProperty(objExpr, "name");
3485
+ const typeProp = findObjectProperty(objExpr, "type");
3486
+ const defaultProp = findObjectProperty(objExpr, "default");
3487
+ const requiredProp = findObjectProperty(objExpr, "required");
3488
+ if (nameProp && t29.isStringLiteral(nameProp.value)) {
3489
+ setPropName(result, nameProp.value.value);
3490
+ }
3491
+ if (defaultProp) {
3492
+ result.default = defaultProp.value;
3493
+ }
3494
+ if (requiredProp && t29.isBooleanLiteral(requiredProp.value)) {
3495
+ result.required = requiredProp.value.value;
3496
+ }
3497
+ if (typeProp && t29.isIdentifier(typeProp.value)) {
3498
+ result.type = mapRuntimeTypeToTSType(typeProp.value);
3499
+ } else if (node.typeParameters) {
3500
+ const [typeParam] = node.typeParameters.params;
3501
+ if (t29.isTSType(typeParam)) {
3502
+ result.type = typeParam;
3503
+ }
3504
+ } else if (defaultProp) {
3505
+ result.type = expressionToTSType(defaultProp.value);
3506
+ }
3507
+ return result;
3508
+ };
3509
+ const safeAssign = (target, source) => {
3510
+ if (source.name !== void 0) {
3511
+ target.name = source.name;
3512
+ }
3513
+ if (source.updateEventName !== void 0) {
3514
+ target.updateEventName = source.updateEventName;
3515
+ }
3516
+ if (source.type !== void 0) {
3517
+ target.type = source.type;
3518
+ }
3519
+ if (source.required !== void 0) {
3520
+ target.required = source.required;
3521
+ }
3522
+ if (source.default !== void 0) {
3523
+ target.default = source.default;
3524
+ }
3525
+ };
3526
+ const extractTypeFromTypeParams = (info) => {
3527
+ if (!node.typeParameters) return;
3528
+ const isDefaultAny = !info.type || t29.isTSAnyKeyword(info.type);
3529
+ if (!isDefaultAny) return;
3530
+ const [typeParam] = node.typeParameters.params;
3531
+ if (t29.isTSType(typeParam)) {
3532
+ info.type = typeParam;
3533
+ }
3534
+ };
3535
+ if (t29.isStringLiteral(arg1)) {
3536
+ setPropName(propInfo, arg1.value);
3537
+ extractTypeFromTypeParams(propInfo);
3538
+ } else if (t29.isObjectExpression(arg1)) {
3539
+ safeAssign(propInfo, extractPropInfoFromObject(arg1));
3540
+ }
3541
+ if (!t29.isObjectExpression(arg1) && t29.isObjectExpression(arg2)) {
3542
+ safeAssign(propInfo, extractPropInfoFromObject(arg2));
3543
+ }
3544
+ return propInfo;
3545
+ }
3546
+ function replaceToUseVRef(node, propInfo, ctx) {
3547
+ const refAdapter = ADAPTER_RULES.runtime.ref;
3548
+ replaceCallName(node, refAdapter.target);
3549
+ recordImport(ctx, refAdapter.package, refAdapter.target);
3550
+ const defaultValue = propInfo.default;
3551
+ const propRef = t29.identifier(`${ctx.propField}.${propInfo.name}`);
3552
+ if (!defaultValue) {
3553
+ node.arguments = [propRef];
3554
+ } else {
3555
+ node.arguments = [t29.logicalExpression("??", propRef, defaultValue)];
3556
+ }
3557
+ if (ctx.scriptData.lang.startsWith("ts") && !node.typeParameters && propInfo.type) {
3558
+ node.typeParameters = t29.tsTypeParameterInstantiation([propInfo.type]);
3559
+ }
3560
+ }
3561
+ function resolveAutoUpdate(ast, path8, propInfo, ctx) {
3562
+ const { parent } = path8;
3563
+ if (!t29.isVariableDeclarator(parent)) {
3564
+ return;
3565
+ }
3566
+ const modelId = parent.id;
3567
+ if (!t29.isIdentifier(modelId)) {
3568
+ return;
3569
+ }
3570
+ const memberAccess = t29.memberExpression(
3571
+ t29.identifier(ctx.propField),
3572
+ t29.identifier(propInfo.updateEventName)
3573
+ );
3574
+ const dep = t29.memberExpression(modelId, t29.identifier("value"));
3575
+ const updateCall = t29.optionalCallExpression(memberAccess, [dep], true);
3576
+ const callExpr = createUseUpdated(
3577
+ t29.blockStatement([t29.expressionStatement(updateCall)]),
3578
+ t29.arrayExpression([dep])
3579
+ );
3580
+ ast.program.body.push(t29.expressionStatement(callExpr));
3581
+ const adapter = ADAPTER_RULES.runtime.onUpdated;
3582
+ recordImport(ctx, adapter.package, adapter.target);
3583
+ }
3584
+ function resolveInterface(propInfo, ctx) {
3585
+ const { name, updateEventName, required } = propInfo;
3586
+ const { lang, propsTSIface } = ctx.scriptData;
3587
+ if (!lang.startsWith("ts")) {
3588
+ return;
3589
+ }
3590
+ const propType = propInfo.type || t29.tsAnyKeyword();
3591
+ const propSignature = t29.tsPropertySignature(
3592
+ t29.isValidIdentifier(name) ? t29.identifier(name) : t29.stringLiteral(name),
3593
+ t29.tsTypeAnnotation(propType)
3594
+ );
3595
+ propSignature.optional = !required;
3596
+ const emitArg = t29.identifier("arg");
3597
+ emitArg.typeAnnotation = t29.tsTypeAnnotation(propType);
3598
+ const emitSignature = t29.tsPropertySignature(
3599
+ t29.isValidIdentifier(updateEventName) ? t29.identifier(updateEventName) : t29.stringLiteral(updateEventName),
3600
+ t29.tsTypeAnnotation(t29.tsFunctionType(null, [emitArg], t29.tsTypeAnnotation(t29.tsVoidKeyword())))
3601
+ );
3602
+ emitSignature.optional = true;
3603
+ const appendToTypeLiteral = (list, member) => {
3604
+ const existing = list.find((item) => t29.isTSTypeLiteral(item));
3605
+ if (existing) {
3606
+ existing.members.push(member);
3607
+ } else {
3608
+ list.push(t29.tsTypeLiteral([member]));
3609
+ }
3610
+ };
3611
+ appendToTypeLiteral(propsTSIface.propsTypes, propSignature);
3612
+ appendToTypeLiteral(propsTSIface.emitTypes, emitSignature);
3613
+ }
3614
+
3363
3615
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-define-options.ts
3364
3616
  function resolveDefineOptions(ctx) {
3365
3617
  return {
@@ -3388,7 +3640,7 @@ function resolveEmitCalls(ctx) {
3388
3640
  CallExpression(path8) {
3389
3641
  const { node } = path8;
3390
3642
  const { filename, templateData, scriptData } = ctx;
3391
- if (!t29.isIdentifier(node.callee)) return;
3643
+ if (!t30.isIdentifier(node.callee)) return;
3392
3644
  const { name } = node.callee;
3393
3645
  const checkIfFromDefineEmits = () => {
3394
3646
  let result = false;
@@ -3400,7 +3652,7 @@ function resolveEmitCalls(ctx) {
3400
3652
  const binding = path8.scope.getBinding(name);
3401
3653
  if (binding) {
3402
3654
  const parent = binding.path.node;
3403
- if (t29.isVariableDeclarator(parent) && t29.isCallExpression(parent.init) && t29.isIdentifier(parent.init.callee)) {
3655
+ if (t30.isVariableDeclarator(parent) && t30.isCallExpression(parent.init) && t30.isIdentifier(parent.init.callee)) {
3404
3656
  result = parent.init.callee.name === MACRO_API_NAMES.emits;
3405
3657
  }
3406
3658
  }
@@ -3410,9 +3662,9 @@ function resolveEmitCalls(ctx) {
3410
3662
  if (!checkIfFromDefineEmits()) return;
3411
3663
  const [callee, ...args] = node.arguments;
3412
3664
  let propCall;
3413
- if (t29.isStringLiteral(callee)) {
3665
+ if (t30.isStringLiteral(callee)) {
3414
3666
  const eventName = formatEmitEventName(callee.value);
3415
- propCall = createPropCall(ctx.propField, t29.identifier(eventName), args);
3667
+ propCall = createPropCall(ctx.propField, t30.identifier(eventName), args);
3416
3668
  } else {
3417
3669
  propCall = createPropCall(ctx.propField, callee, args, true);
3418
3670
  logger.error(
@@ -3420,7 +3672,7 @@ function resolveEmitCalls(ctx) {
3420
3672
  {
3421
3673
  file: filename,
3422
3674
  source: scriptData.source,
3423
- loc: _optionalChain([callee, 'optionalAccess', _106 => _106.loc])
3675
+ loc: _optionalChain([callee, 'optionalAccess', _117 => _117.loc])
3424
3676
  }
3425
3677
  );
3426
3678
  }
@@ -3429,8 +3681,8 @@ function resolveEmitCalls(ctx) {
3429
3681
  };
3430
3682
  }
3431
3683
  function createPropCall(rootName, callee, args, computed = false) {
3432
- return t29.optionalCallExpression(
3433
- t29.memberExpression(t29.identifier(rootName), callee, computed),
3684
+ return t30.optionalCallExpression(
3685
+ t30.memberExpression(t30.identifier(rootName), callee, computed),
3434
3686
  args,
3435
3687
  true
3436
3688
  );
@@ -3446,21 +3698,21 @@ function createPropCall(rootName, callee, args, computed = false) {
3446
3698
 
3447
3699
  function cloneCallableParams(params) {
3448
3700
  const cloneCallableParam = (param, index) => {
3449
- if (t30.isRestElement(param)) {
3701
+ if (t31.isRestElement(param)) {
3450
3702
  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()));
3703
+ const name = t31.isIdentifier(arg) ? arg.name : `args${index}`;
3704
+ const rest = t31.restElement(t31.identifier(name));
3705
+ rest.typeAnnotation = param.typeAnnotation || (t31.isIdentifier(arg) ? arg.typeAnnotation : null) || t31.tsTypeAnnotation(t31.tsArrayType(t31.tsAnyKeyword()));
3454
3706
  return rest;
3455
3707
  }
3456
- if (t30.isIdentifier(param)) {
3457
- const id = t30.identifier(param.name || `arg${index}`);
3708
+ if (t31.isIdentifier(param)) {
3709
+ const id = t31.identifier(param.name || `arg${index}`);
3458
3710
  id.optional = param.optional;
3459
- id.typeAnnotation = param.typeAnnotation || t30.tsTypeAnnotation(t30.tsAnyKeyword());
3711
+ id.typeAnnotation = param.typeAnnotation || t31.tsTypeAnnotation(t31.tsAnyKeyword());
3460
3712
  return id;
3461
3713
  }
3462
- const fallback = t30.identifier(`arg${index}`);
3463
- fallback.typeAnnotation = t30.tsTypeAnnotation(t30.tsAnyKeyword());
3714
+ const fallback = t31.identifier(`arg${index}`);
3715
+ fallback.typeAnnotation = t31.tsTypeAnnotation(t31.tsAnyKeyword());
3464
3716
  return fallback;
3465
3717
  };
3466
3718
  return params.map(cloneCallableParam);
@@ -3470,18 +3722,18 @@ function cloneCallableParams(params) {
3470
3722
  function resolveEmitsTopLevelTypes(ctx) {
3471
3723
  return {
3472
3724
  "TSInterfaceDeclaration|TSTypeAliasDeclaration"(path8) {
3473
- if (!t31.isProgram(path8.parent)) return;
3725
+ if (!t32.isProgram(path8.parent)) return;
3474
3726
  const { node } = path8;
3475
- if (t31.isTSInterfaceDeclaration(node)) {
3476
- const typeLiteral = t31.tsTypeLiteral(node.body.body);
3727
+ if (t32.isTSInterfaceDeclaration(node)) {
3728
+ const typeLiteral = t32.tsTypeLiteral(node.body.body);
3477
3729
  if (!hasEmitsSignatureInType(typeLiteral)) return;
3478
3730
  const resolved = resolveTopLevelEmitType(typeLiteral);
3479
- if (resolved && t31.isTSTypeLiteral(resolved)) {
3731
+ if (resolved && t32.isTSTypeLiteral(resolved)) {
3480
3732
  node.body.body = resolved.members;
3481
3733
  }
3482
3734
  return;
3483
3735
  }
3484
- if (t31.isTSTypeAliasDeclaration(node)) {
3736
+ if (t32.isTSTypeAliasDeclaration(node)) {
3485
3737
  if (!hasEmitsSignatureInType(node.typeAnnotation)) return;
3486
3738
  const resolved = resolveTopLevelEmitType(node.typeAnnotation);
3487
3739
  if (resolved) {
@@ -3492,55 +3744,55 @@ function resolveEmitsTopLevelTypes(ctx) {
3492
3744
  };
3493
3745
  }
3494
3746
  function resolveTopLevelEmitType(tsType) {
3495
- if (t31.isTSParenthesizedType(tsType)) {
3747
+ if (t32.isTSParenthesizedType(tsType)) {
3496
3748
  return resolveTopLevelEmitType(tsType.typeAnnotation);
3497
3749
  }
3498
- if (t31.isTSTypeReference(tsType)) {
3750
+ if (t32.isTSTypeReference(tsType)) {
3499
3751
  if (!tsType.typeParameters || !tsType.typeParameters.params.length) {
3500
3752
  return tsType;
3501
3753
  }
3502
3754
  const params = tsType.typeParameters.params.map((param) => resolveTopLevelEmitType(param)).filter(Boolean);
3503
- return t31.tsTypeReference(
3755
+ return t32.tsTypeReference(
3504
3756
  tsType.typeName,
3505
- t31.tsTypeParameterInstantiation(params.length ? params : tsType.typeParameters.params)
3757
+ t32.tsTypeParameterInstantiation(params.length ? params : tsType.typeParameters.params)
3506
3758
  );
3507
3759
  }
3508
- if (t31.isTSIntersectionType(tsType)) {
3760
+ if (t32.isTSIntersectionType(tsType)) {
3509
3761
  const types = tsType.types.map(resolveTopLevelEmitType).filter(Boolean);
3510
3762
  if (!types.length) return null;
3511
3763
  if (types.length === 1) return types[0];
3512
- return t31.tsIntersectionType(types);
3764
+ return t32.tsIntersectionType(types);
3513
3765
  }
3514
- if (t31.isTSUnionType(tsType)) {
3766
+ if (t32.isTSUnionType(tsType)) {
3515
3767
  const types = tsType.types.map(resolveTopLevelEmitType).filter(Boolean);
3516
3768
  if (!types.length) return null;
3517
3769
  if (types.length === 1) return types[0];
3518
- return t31.tsUnionType(types);
3770
+ return t32.tsUnionType(types);
3519
3771
  }
3520
- if (t31.isTSTypeLiteral(tsType)) {
3772
+ if (t32.isTSTypeLiteral(tsType)) {
3521
3773
  const members = [];
3522
3774
  for (const member of tsType.members) {
3523
- if (t31.isTSCallSignatureDeclaration(member)) {
3775
+ if (t32.isTSCallSignatureDeclaration(member)) {
3524
3776
  members.push(...resolveEmitPropsFromCallSignature(member));
3525
3777
  continue;
3526
3778
  }
3527
3779
  members.push(member);
3528
3780
  }
3529
3781
  if (!members.length) return null;
3530
- return t31.tsTypeLiteral(members);
3782
+ return t32.tsTypeLiteral(members);
3531
3783
  }
3532
- if (t31.isTSFunctionType(tsType)) {
3784
+ if (t32.isTSFunctionType(tsType)) {
3533
3785
  const props = resolveEmitPropsFromCallable(tsType.parameters, tsType.typeAnnotation);
3534
3786
  if (!props.length) return null;
3535
- return t31.tsTypeLiteral(props);
3787
+ return t32.tsTypeLiteral(props);
3536
3788
  }
3537
3789
  return tsType;
3538
3790
  }
3539
3791
  function resolveDefineEmitsIface(path8, ctx) {
3540
3792
  const { node } = path8;
3541
3793
  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])) {
3794
+ const tsParams = _optionalChain([node, 'access', _118 => _118.typeParameters, 'optionalAccess', _119 => _119.params]);
3795
+ if (_optionalChain([tsParams, 'optionalAccess', _120 => _120.length])) {
3544
3796
  processExplicitType(ctx, tsParams);
3545
3797
  return;
3546
3798
  }
@@ -3553,41 +3805,41 @@ function processInferredTypes(ctx, runtimeArg) {
3553
3805
  propsTSIface: { emitTypes }
3554
3806
  } = ctx.scriptData;
3555
3807
  const members = [];
3556
- if (t31.isArrayExpression(runtimeArg)) {
3808
+ if (t32.isArrayExpression(runtimeArg)) {
3557
3809
  for (const element of runtimeArg.elements) {
3558
- if (!element || !t31.isStringLiteral(element)) continue;
3810
+ if (!element || !t32.isStringLiteral(element)) continue;
3559
3811
  const handlerName = resolveEmitHandlerName(element.value);
3560
3812
  const key = buildKey(handlerName);
3561
- const fnType = t31.tsFunctionType(
3813
+ const fnType = t32.tsFunctionType(
3562
3814
  null,
3563
3815
  [createRestAnyParam("args")],
3564
- t31.tsTypeAnnotation(t31.tsAnyKeyword())
3816
+ t32.tsTypeAnnotation(t32.tsAnyKeyword())
3565
3817
  );
3566
- const prop = t31.tsPropertySignature(key, t31.tsTypeAnnotation(fnType));
3818
+ const prop = t32.tsPropertySignature(key, t32.tsTypeAnnotation(fnType));
3567
3819
  prop.optional = true;
3568
3820
  members.push(prop);
3569
3821
  }
3570
3822
  if (members.length) {
3571
- emitTypes.push(t31.tsTypeLiteral(members));
3823
+ emitTypes.push(t32.tsTypeLiteral(members));
3572
3824
  }
3573
3825
  return;
3574
3826
  }
3575
- if (t31.isObjectExpression(runtimeArg)) {
3827
+ if (t32.isObjectExpression(runtimeArg)) {
3576
3828
  for (const prop of runtimeArg.properties) {
3577
- if (!t31.isObjectProperty(prop)) continue;
3578
- if (t31.isSpreadElement(prop)) continue;
3829
+ if (!t32.isObjectProperty(prop)) continue;
3830
+ if (t32.isSpreadElement(prop)) continue;
3579
3831
  const rawName = resolvePropName(prop.key);
3580
3832
  if (!rawName) continue;
3581
3833
  const handlerName = resolveEmitHandlerName(rawName);
3582
3834
  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));
3835
+ const params = t32.isArrayExpression(prop.value) ? resolveRuntimeTupleParams(prop.value) : [createRestAnyParam("args")];
3836
+ const fnType = t32.tsFunctionType(null, params, t32.tsTypeAnnotation(t32.tsAnyKeyword()));
3837
+ const propSig = t32.tsPropertySignature(key, t32.tsTypeAnnotation(fnType));
3586
3838
  propSig.optional = true;
3587
3839
  members.push(propSig);
3588
3840
  }
3589
3841
  if (members.length) {
3590
- emitTypes.push(t31.tsTypeLiteral(members));
3842
+ emitTypes.push(t32.tsTypeLiteral(members));
3591
3843
  }
3592
3844
  }
3593
3845
  }
@@ -3608,129 +3860,129 @@ function resolveEmitHandlerName(rawName) {
3608
3860
  return `on${name}`;
3609
3861
  }
3610
3862
  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);
3863
+ if (t32.isIdentifier(key)) return key.name;
3864
+ if (t32.isStringLiteral(key)) return key.value;
3865
+ if (t32.isNumericLiteral(key)) return String(key.value);
3614
3866
  return null;
3615
3867
  }
3616
3868
  function buildKey(name) {
3617
- return t31.isValidIdentifier(name) ? t31.identifier(name) : t31.stringLiteral(name);
3869
+ return t32.isValidIdentifier(name) ? t32.identifier(name) : t32.stringLiteral(name);
3618
3870
  }
3619
3871
  function createRestAnyParam(name) {
3620
- const id = t31.identifier(name);
3621
- const rest = t31.restElement(id);
3622
- rest.typeAnnotation = t31.tsTypeAnnotation(t31.tsArrayType(t31.tsAnyKeyword()));
3872
+ const id = t32.identifier(name);
3873
+ const rest = t32.restElement(id);
3874
+ rest.typeAnnotation = t32.tsTypeAnnotation(t32.tsArrayType(t32.tsAnyKeyword()));
3623
3875
  return rest;
3624
3876
  }
3625
3877
  function resolveRuntimeTupleParams(value) {
3626
3878
  const params = [];
3627
3879
  value.elements.forEach((element, index) => {
3628
3880
  if (!element) return;
3629
- if (t31.isSpreadElement(element)) {
3881
+ if (t32.isSpreadElement(element)) {
3630
3882
  params.push(createRestAnyParam(`args${index}`));
3631
3883
  return;
3632
3884
  }
3633
- if (t31.isIdentifier(element)) {
3634
- const id = t31.identifier(element.name);
3635
- id.typeAnnotation = element.typeAnnotation || t31.tsTypeAnnotation(t31.tsAnyKeyword());
3885
+ if (t32.isIdentifier(element)) {
3886
+ const id = t32.identifier(element.name);
3887
+ id.typeAnnotation = element.typeAnnotation || t32.tsTypeAnnotation(t32.tsAnyKeyword());
3636
3888
  params.push(id);
3637
3889
  return;
3638
3890
  }
3639
- if (t31.isTSAsExpression(element)) {
3640
- const id = t31.identifier(`arg${index}`);
3641
- id.typeAnnotation = t31.tsTypeAnnotation(element.typeAnnotation);
3891
+ if (t32.isTSAsExpression(element)) {
3892
+ const id = t32.identifier(`arg${index}`);
3893
+ id.typeAnnotation = t32.tsTypeAnnotation(element.typeAnnotation);
3642
3894
  params.push(id);
3643
3895
  return;
3644
3896
  }
3645
- const fallback = t31.identifier(`arg${index}`);
3646
- fallback.typeAnnotation = t31.tsTypeAnnotation(t31.tsAnyKeyword());
3897
+ const fallback = t32.identifier(`arg${index}`);
3898
+ fallback.typeAnnotation = t32.tsTypeAnnotation(t32.tsAnyKeyword());
3647
3899
  params.push(fallback);
3648
3900
  });
3649
3901
  return params;
3650
3902
  }
3651
3903
  function resolveExplicitEmitType(tsType) {
3652
- if (t31.isTSParenthesizedType(tsType)) {
3904
+ if (t32.isTSParenthesizedType(tsType)) {
3653
3905
  return resolveExplicitEmitType(tsType.typeAnnotation);
3654
3906
  }
3655
- if (t31.isTSTypeReference(tsType)) {
3907
+ if (t32.isTSTypeReference(tsType)) {
3656
3908
  if (!tsType.typeParameters || !tsType.typeParameters.params.length) {
3657
3909
  return tsType;
3658
3910
  }
3659
3911
  const params = tsType.typeParameters.params.map((param) => resolveExplicitEmitType(param)).filter(Boolean);
3660
- return t31.tsTypeReference(
3912
+ return t32.tsTypeReference(
3661
3913
  tsType.typeName,
3662
- t31.tsTypeParameterInstantiation(params.length ? params : tsType.typeParameters.params)
3914
+ t32.tsTypeParameterInstantiation(params.length ? params : tsType.typeParameters.params)
3663
3915
  );
3664
3916
  }
3665
- if (t31.isTSIntersectionType(tsType)) {
3917
+ if (t32.isTSIntersectionType(tsType)) {
3666
3918
  const types = tsType.types.map(resolveExplicitEmitType).filter(Boolean);
3667
3919
  if (!types.length) return null;
3668
3920
  if (types.length === 1) return types[0];
3669
- return t31.tsIntersectionType(types);
3921
+ return t32.tsIntersectionType(types);
3670
3922
  }
3671
- if (t31.isTSUnionType(tsType)) {
3923
+ if (t32.isTSUnionType(tsType)) {
3672
3924
  const types = tsType.types.map(resolveExplicitEmitType).filter(Boolean);
3673
3925
  if (!types.length) return null;
3674
3926
  if (types.length === 1) return types[0];
3675
- return t31.tsUnionType(types);
3927
+ return t32.tsUnionType(types);
3676
3928
  }
3677
- if (t31.isTSTypeLiteral(tsType)) {
3929
+ if (t32.isTSTypeLiteral(tsType)) {
3678
3930
  const members = [];
3679
3931
  for (const member of tsType.members) {
3680
- if (t31.isTSPropertySignature(member)) {
3932
+ if (t32.isTSPropertySignature(member)) {
3681
3933
  const prop = resolveEmitPropFromPropertySignature(member);
3682
3934
  if (prop) members.push(prop);
3683
3935
  continue;
3684
3936
  }
3685
- if (t31.isTSCallSignatureDeclaration(member)) {
3937
+ if (t32.isTSCallSignatureDeclaration(member)) {
3686
3938
  members.push(...resolveEmitPropsFromCallSignature(member));
3687
3939
  continue;
3688
3940
  }
3689
3941
  }
3690
3942
  if (!members.length) return null;
3691
- return t31.tsTypeLiteral(members);
3943
+ return t32.tsTypeLiteral(members);
3692
3944
  }
3693
- if (t31.isTSFunctionType(tsType)) {
3945
+ if (t32.isTSFunctionType(tsType)) {
3694
3946
  const props = resolveEmitPropsFromCallable(tsType.parameters, tsType.typeAnnotation);
3695
3947
  if (!props.length) return null;
3696
- return t31.tsTypeLiteral(props);
3948
+ return t32.tsTypeLiteral(props);
3697
3949
  }
3698
3950
  return tsType;
3699
3951
  }
3700
3952
  function hasEmitsSignatureInType(tsType) {
3701
- if (t31.isTSParenthesizedType(tsType)) {
3953
+ if (t32.isTSParenthesizedType(tsType)) {
3702
3954
  return hasEmitsSignatureInType(tsType.typeAnnotation);
3703
3955
  }
3704
- if (t31.isTSTypeReference(tsType)) {
3956
+ if (t32.isTSTypeReference(tsType)) {
3705
3957
  if (!tsType.typeParameters || !tsType.typeParameters.params.length) {
3706
3958
  return false;
3707
3959
  }
3708
3960
  return tsType.typeParameters.params.some(hasEmitsSignatureInType);
3709
3961
  }
3710
- if (t31.isTSIntersectionType(tsType) || t31.isTSUnionType(tsType)) {
3962
+ if (t32.isTSIntersectionType(tsType) || t32.isTSUnionType(tsType)) {
3711
3963
  return tsType.types.some(hasEmitsSignatureInType);
3712
3964
  }
3713
- if (t31.isTSTypeLiteral(tsType)) {
3965
+ if (t32.isTSTypeLiteral(tsType)) {
3714
3966
  return tsType.members.some(hasEmitsSignatureInMember);
3715
3967
  }
3716
- if (t31.isTSFunctionType(tsType)) {
3968
+ if (t32.isTSFunctionType(tsType)) {
3717
3969
  return isEmitsCallable(tsType.parameters);
3718
3970
  }
3719
3971
  return false;
3720
3972
  }
3721
3973
  function hasEmitsSignatureInMember(member) {
3722
- if (t31.isTSCallSignatureDeclaration(member)) {
3974
+ if (t32.isTSCallSignatureDeclaration(member)) {
3723
3975
  return isEmitsCallable(member.parameters);
3724
3976
  }
3725
3977
  return false;
3726
3978
  }
3727
3979
  function isEmitsCallable(parameters) {
3728
3980
  const [eventParam] = parameters;
3729
- if (!eventParam || !t31.isIdentifier(eventParam) || !eventParam.typeAnnotation) {
3981
+ if (!eventParam || !t32.isIdentifier(eventParam) || !eventParam.typeAnnotation) {
3730
3982
  return false;
3731
3983
  }
3732
3984
  const { typeAnnotation } = eventParam;
3733
- if (t31.isNoop(typeAnnotation)) return false;
3985
+ if (t32.isNoop(typeAnnotation)) return false;
3734
3986
  return resolveEventNames(typeAnnotation.typeAnnotation).length > 0;
3735
3987
  }
3736
3988
  function resolveEmitPropFromPropertySignature(member) {
@@ -3738,21 +3990,21 @@ function resolveEmitPropFromPropertySignature(member) {
3738
3990
  if (!rawName) return null;
3739
3991
  const handlerName = resolveEmitHandlerName(rawName);
3740
3992
  const key = buildKey(handlerName);
3741
- const typeAnnotation = _optionalChain([member, 'access', _110 => _110.typeAnnotation, 'optionalAccess', _111 => _111.typeAnnotation]);
3993
+ const typeAnnotation = _optionalChain([member, 'access', _121 => _121.typeAnnotation, 'optionalAccess', _122 => _122.typeAnnotation]);
3742
3994
  let params = [];
3743
- let returnType = t31.tsAnyKeyword();
3744
- if (typeAnnotation && t31.isTSFunctionType(typeAnnotation)) {
3995
+ let returnType = t32.tsAnyKeyword();
3996
+ if (typeAnnotation && t32.isTSFunctionType(typeAnnotation)) {
3745
3997
  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)) {
3998
+ returnType = _nullishCoalesce(_optionalChain([typeAnnotation, 'access', _123 => _123.typeAnnotation, 'optionalAccess', _124 => _124.typeAnnotation]), () => ( returnType));
3999
+ } else if (typeAnnotation && t32.isTSTupleType(typeAnnotation)) {
3748
4000
  params = resolveTupleTypeParams(typeAnnotation);
3749
4001
  } else if (typeAnnotation) {
3750
- const id = t31.identifier("value");
3751
- id.typeAnnotation = t31.tsTypeAnnotation(typeAnnotation);
4002
+ const id = t32.identifier("value");
4003
+ id.typeAnnotation = t32.tsTypeAnnotation(typeAnnotation);
3752
4004
  params = [id];
3753
4005
  }
3754
- const fnType = t31.tsFunctionType(null, params, t31.tsTypeAnnotation(returnType));
3755
- const prop = t31.tsPropertySignature(key, t31.tsTypeAnnotation(fnType));
4006
+ const fnType = t32.tsFunctionType(null, params, t32.tsTypeAnnotation(returnType));
4007
+ const prop = t32.tsPropertySignature(key, t32.tsTypeAnnotation(fnType));
3756
4008
  prop.optional = !!member.optional;
3757
4009
  return prop;
3758
4010
  }
@@ -3761,32 +4013,32 @@ function resolveEmitPropsFromCallSignature(member) {
3761
4013
  }
3762
4014
  function resolveEmitPropsFromCallable(parameters, typeAnnotation) {
3763
4015
  const [eventParam, ...restParams] = parameters;
3764
- if (!eventParam || !t31.isIdentifier(eventParam) || !eventParam.typeAnnotation) {
4016
+ if (!eventParam || !t32.isIdentifier(eventParam) || !eventParam.typeAnnotation) {
3765
4017
  return [];
3766
4018
  }
3767
4019
  const { typeAnnotation: paramTypeAnnotation } = eventParam;
3768
- if (t31.isNoop(paramTypeAnnotation)) return [];
4020
+ if (t32.isNoop(paramTypeAnnotation)) return [];
3769
4021
  const eventNames = resolveEventNames(paramTypeAnnotation.typeAnnotation);
3770
4022
  if (!eventNames.length) return [];
3771
- const returnType = _nullishCoalesce(_optionalChain([typeAnnotation, 'optionalAccess', _114 => _114.typeAnnotation]), () => ( t31.tsAnyKeyword()));
4023
+ const returnType = _nullishCoalesce(_optionalChain([typeAnnotation, 'optionalAccess', _125 => _125.typeAnnotation]), () => ( t32.tsAnyKeyword()));
3772
4024
  return eventNames.map((eventName) => {
3773
4025
  const handlerName = resolveEmitHandlerName(eventName);
3774
4026
  const key = buildKey(handlerName);
3775
4027
  const params = cloneCallableParams(restParams);
3776
- const fnType = t31.tsFunctionType(null, params, t31.tsTypeAnnotation(returnType));
3777
- const prop = t31.tsPropertySignature(key, t31.tsTypeAnnotation(fnType));
4028
+ const fnType = t32.tsFunctionType(null, params, t32.tsTypeAnnotation(returnType));
4029
+ const prop = t32.tsPropertySignature(key, t32.tsTypeAnnotation(fnType));
3778
4030
  prop.optional = true;
3779
4031
  return prop;
3780
4032
  });
3781
4033
  }
3782
4034
  function resolveEventNames(type) {
3783
- if (t31.isTSLiteralType(type) && t31.isStringLiteral(type.literal)) {
4035
+ if (t32.isTSLiteralType(type) && t32.isStringLiteral(type.literal)) {
3784
4036
  return [type.literal.value];
3785
4037
  }
3786
- if (t31.isTSUnionType(type)) {
4038
+ if (t32.isTSUnionType(type)) {
3787
4039
  return type.types.flatMap(resolveEventNames);
3788
4040
  }
3789
- if (t31.isTSParenthesizedType(type)) {
4041
+ if (t32.isTSParenthesizedType(type)) {
3790
4042
  return resolveEventNames(type.typeAnnotation);
3791
4043
  }
3792
4044
  return [];
@@ -3799,39 +4051,39 @@ function resolveTupleTypeParams(tuple) {
3799
4051
  return params;
3800
4052
  }
3801
4053
  function resolveTupleElementParam(element, index) {
3802
- const isNamedTuple = typeof t31.isTSNamedTupleMember === "function" && t31.isTSNamedTupleMember(element);
4054
+ const isNamedTuple = typeof t32.isTSNamedTupleMember === "function" && t32.isTSNamedTupleMember(element);
3803
4055
  if (isNamedTuple) {
3804
4056
  const tupleMember = element;
3805
- const name = _optionalChain([tupleMember, 'access', _115 => _115.label, 'optionalAccess', _116 => _116.name]) || `arg${index}`;
4057
+ const name = _optionalChain([tupleMember, 'access', _126 => _126.label, 'optionalAccess', _127 => _127.name]) || `arg${index}`;
3806
4058
  let innerType = tupleMember.elementType;
3807
4059
  let optional = tupleMember.optional;
3808
- if (t31.isTSOptionalType(innerType)) {
4060
+ if (t32.isTSOptionalType(innerType)) {
3809
4061
  optional = true;
3810
4062
  innerType = innerType.typeAnnotation;
3811
4063
  }
3812
- if (t31.isTSRestType(innerType)) {
3813
- const rest = t31.restElement(t31.identifier(name));
3814
- rest.typeAnnotation = t31.tsTypeAnnotation(innerType.typeAnnotation);
4064
+ if (t32.isTSRestType(innerType)) {
4065
+ const rest = t32.restElement(t32.identifier(name));
4066
+ rest.typeAnnotation = t32.tsTypeAnnotation(innerType.typeAnnotation);
3815
4067
  return rest;
3816
4068
  }
3817
- const id2 = t31.identifier(name);
4069
+ const id2 = t32.identifier(name);
3818
4070
  id2.optional = optional;
3819
- id2.typeAnnotation = t31.tsTypeAnnotation(innerType);
4071
+ id2.typeAnnotation = t32.tsTypeAnnotation(innerType);
3820
4072
  return id2;
3821
4073
  }
3822
- if (t31.isTSRestType(element)) {
3823
- const rest = t31.restElement(t31.identifier(`args${index}`));
3824
- rest.typeAnnotation = t31.tsTypeAnnotation(element.typeAnnotation);
4074
+ if (t32.isTSRestType(element)) {
4075
+ const rest = t32.restElement(t32.identifier(`args${index}`));
4076
+ rest.typeAnnotation = t32.tsTypeAnnotation(element.typeAnnotation);
3825
4077
  return rest;
3826
4078
  }
3827
- if (t31.isTSOptionalType(element)) {
3828
- const id2 = t31.identifier(`arg${index}`);
4079
+ if (t32.isTSOptionalType(element)) {
4080
+ const id2 = t32.identifier(`arg${index}`);
3829
4081
  id2.optional = true;
3830
- id2.typeAnnotation = t31.tsTypeAnnotation(element.typeAnnotation);
4082
+ id2.typeAnnotation = t32.tsTypeAnnotation(element.typeAnnotation);
3831
4083
  return id2;
3832
4084
  }
3833
- const id = t31.identifier(`arg${index}`);
3834
- id.typeAnnotation = t31.tsTypeAnnotation(element);
4085
+ const id = t32.identifier(`arg${index}`);
4086
+ id.typeAnnotation = t32.tsTypeAnnotation(element);
3835
4087
  return id;
3836
4088
  }
3837
4089
 
@@ -3840,8 +4092,8 @@ function resolveTupleElementParam(element, index) {
3840
4092
  function resolveDefinePropsIface(path8, ctx) {
3841
4093
  const { node } = path8;
3842
4094
  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])) {
4095
+ const tsParams = _optionalChain([node, 'access', _128 => _128.typeParameters, 'optionalAccess', _129 => _129.params]);
4096
+ if (_optionalChain([tsParams, 'optionalAccess', _130 => _130.length])) {
3845
4097
  const { propsTSIface } = ctx.scriptData;
3846
4098
  propsTSIface.propsTypes = tsParams;
3847
4099
  return;
@@ -3856,38 +4108,38 @@ function processInferredTypes2(ctx, runtimeArg) {
3856
4108
  } = scriptData;
3857
4109
  if (!runtimeArg) return;
3858
4110
  const members = [];
3859
- if (t32.isArrayExpression(runtimeArg)) {
4111
+ if (t33.isArrayExpression(runtimeArg)) {
3860
4112
  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()));
4113
+ if (!element || !t33.isStringLiteral(element)) continue;
4114
+ const key = t33.isValidIdentifier(element.value) ? t33.identifier(element.value) : t33.stringLiteral(element.value);
4115
+ const prop = t33.tsPropertySignature(key, t33.tsTypeAnnotation(t33.tsAnyKeyword()));
3864
4116
  prop.optional = true;
3865
4117
  members.push(prop);
3866
4118
  }
3867
4119
  if (members.length) {
3868
- propsTypes.push(t32.tsTypeLiteral(members));
4120
+ propsTypes.push(t33.tsTypeLiteral(members));
3869
4121
  }
3870
4122
  return;
3871
4123
  }
3872
- if (t32.isObjectExpression(runtimeArg)) {
4124
+ if (t33.isObjectExpression(runtimeArg)) {
3873
4125
  for (const prop of runtimeArg.properties) {
3874
- if (!t32.isObjectProperty(prop)) continue;
3875
- if (t32.isSpreadElement(prop)) continue;
4126
+ if (!t33.isObjectProperty(prop)) continue;
4127
+ if (t33.isSpreadElement(prop)) continue;
3876
4128
  const key = prop.key;
3877
4129
  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);
4130
+ if (t33.isIdentifier(key)) propName = key.name;
4131
+ if (t33.isStringLiteral(key)) propName = key.value;
4132
+ if (t33.isNumericLiteral(key)) propName = String(key.value);
3881
4133
  if (!propName) continue;
3882
4134
  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));
4135
+ const tsType = _nullishCoalesce(type, () => ( t33.tsAnyKeyword()));
4136
+ const tsKey = t33.isValidIdentifier(propName) ? t33.identifier(propName) : t33.stringLiteral(propName);
4137
+ const tsProp = t33.tsPropertySignature(tsKey, t33.tsTypeAnnotation(tsType));
3886
4138
  tsProp.optional = !required;
3887
4139
  members.push(tsProp);
3888
4140
  }
3889
4141
  if (members.length) {
3890
- propsTypes.push(t32.tsTypeLiteral(members));
4142
+ propsTypes.push(t33.tsTypeLiteral(members));
3891
4143
  }
3892
4144
  return;
3893
4145
  }
@@ -3896,47 +4148,47 @@ function processInferredTypes2(ctx, runtimeArg) {
3896
4148
  {
3897
4149
  source,
3898
4150
  file: filename,
3899
- loc: _optionalChain([runtimeArg, 'optionalAccess', _120 => _120.loc])
4151
+ loc: _optionalChain([runtimeArg, 'optionalAccess', _131 => _131.loc])
3900
4152
  }
3901
4153
  );
3902
4154
  }
3903
4155
  function resolveRuntimePropMeta(value) {
3904
- if (t32.isIdentifier(value)) {
4156
+ if (t33.isIdentifier(value)) {
3905
4157
  return {
3906
4158
  type: mapRuntimeTypeToTSType(value),
3907
4159
  required: false
3908
4160
  };
3909
4161
  }
3910
- if (t32.isArrayExpression(value)) {
4162
+ if (t33.isArrayExpression(value)) {
3911
4163
  return {
3912
4164
  type: resolveRuntimeUnionType(value),
3913
4165
  required: false
3914
4166
  };
3915
4167
  }
3916
- if (!t32.isObjectExpression(value)) {
4168
+ if (!t33.isObjectExpression(value)) {
3917
4169
  return { required: false };
3918
4170
  }
3919
4171
  let type;
3920
4172
  let required = false;
3921
4173
  for (const prop of value.properties) {
3922
- if (!t32.isObjectProperty(prop)) continue;
3923
- if (t32.isSpreadElement(prop)) continue;
4174
+ if (!t33.isObjectProperty(prop)) continue;
4175
+ if (t33.isSpreadElement(prop)) continue;
3924
4176
  const key = prop.key;
3925
- const propName = t32.isIdentifier(key) ? key.name : t32.isStringLiteral(key) ? key.value : null;
4177
+ const propName = t33.isIdentifier(key) ? key.name : t33.isStringLiteral(key) ? key.value : null;
3926
4178
  if (!propName) continue;
3927
4179
  if (propName === "type") {
3928
4180
  const valueNode = prop.value;
3929
- if (t32.isArrayExpression(valueNode)) {
4181
+ if (t33.isArrayExpression(valueNode)) {
3930
4182
  type = resolveRuntimeUnionType(valueNode);
3931
4183
  continue;
3932
4184
  }
3933
- if (t32.isIdentifier(valueNode)) {
4185
+ if (t33.isIdentifier(valueNode)) {
3934
4186
  type = mapRuntimeTypeToTSType(valueNode);
3935
4187
  continue;
3936
4188
  }
3937
4189
  }
3938
4190
  if (propName === "required") {
3939
- if (t32.isBooleanLiteral(prop.value)) {
4191
+ if (t33.isBooleanLiteral(prop.value)) {
3940
4192
  required = prop.value.value;
3941
4193
  }
3942
4194
  }
@@ -3946,35 +4198,13 @@ function resolveRuntimePropMeta(value) {
3946
4198
  function resolveRuntimeUnionType(value) {
3947
4199
  const types = [];
3948
4200
  for (const element of value.elements) {
3949
- if (!element || !t32.isIdentifier(element)) continue;
4201
+ if (!element || !t33.isIdentifier(element)) continue;
3950
4202
  const resolved = mapRuntimeTypeToTSType(element);
3951
4203
  if (resolved) types.push(resolved);
3952
4204
  }
3953
- if (!types.length) return t32.tsAnyKeyword();
4205
+ if (!types.length) return t33.tsAnyKeyword();
3954
4206
  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
- }
4207
+ return t33.tsUnionType(types);
3978
4208
  }
3979
4209
 
3980
4210
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-props-interface/resolve-slot/type-resolver.ts
@@ -3987,34 +4217,34 @@ var SLOT_CHILDREN_NAME = "children";
3987
4217
  var SLOT_FN_PARAM_NAME = "props";
3988
4218
  function buildSlotPropSignature(rawName, params, optional) {
3989
4219
  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))
4220
+ const key = t34.isValidIdentifier(propName) ? t34.identifier(propName) : t34.stringLiteral(propName);
4221
+ const reactNodeType = t34.tsTypeAnnotation(
4222
+ t34.tsTypeReference(t34.identifier(REACT_API_MAP.ReactNode))
3993
4223
  );
3994
4224
  let typeAnnotation;
3995
4225
  if (rawName === SLOT_DEFAULT_NAME && params.length === 0 || params.length === 0) {
3996
4226
  typeAnnotation = reactNodeType;
3997
4227
  } else {
3998
- const fnType = t33.tsFunctionType(null, params, reactNodeType);
3999
- typeAnnotation = t33.tsTypeAnnotation(fnType);
4228
+ const fnType = t34.tsFunctionType(null, params, reactNodeType);
4229
+ typeAnnotation = t34.tsTypeAnnotation(fnType);
4000
4230
  }
4001
- const prop = t33.tsPropertySignature(key, typeAnnotation);
4231
+ const prop = t34.tsPropertySignature(key, typeAnnotation);
4002
4232
  prop.optional = optional;
4003
4233
  return prop;
4004
4234
  }
4005
4235
  function createSlotScopeParam(props, ctx) {
4006
- const paramId = t33.identifier(SLOT_FN_PARAM_NAME);
4236
+ const paramId = t34.identifier(SLOT_FN_PARAM_NAME);
4007
4237
  const propsSigns = [];
4008
4238
  const { reactiveBindings } = ctx.templateData;
4009
4239
  props.forEach(({ prop, tsType }) => {
4010
- const foundBindingValue = _optionalChain([reactiveBindings, 'access', _121 => _121[prop], 'optionalAccess', _122 => _122.value]);
4240
+ const foundBindingValue = _optionalChain([reactiveBindings, 'access', _132 => _132[prop], 'optionalAccess', _133 => _133.value]);
4011
4241
  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);
4242
+ const typeAnnotation = foundBindingTypes ? t34.tsTypeAnnotation(foundBindingTypes) : tsType;
4243
+ const key = t34.isValidIdentifier(prop) ? t34.identifier(prop) : t34.stringLiteral(prop);
4244
+ const propSign = t34.tsPropertySignature(key, typeAnnotation);
4015
4245
  propsSigns.push(propSign);
4016
4246
  });
4017
- paramId.typeAnnotation = t33.tsTypeAnnotation(t33.tsTypeLiteral(propsSigns));
4247
+ paramId.typeAnnotation = t34.tsTypeAnnotation(t34.tsTypeLiteral(propsSigns));
4018
4248
  return paramId;
4019
4249
  }
4020
4250
 
@@ -4035,38 +4265,38 @@ function collectLocalTypeDeclarations(path8) {
4035
4265
  return declarations;
4036
4266
  }
4037
4267
  for (const statement of programPath.node.body) {
4038
- if (t34.isTSInterfaceDeclaration(statement)) {
4268
+ if (t35.isTSInterfaceDeclaration(statement)) {
4039
4269
  declarations.set(statement.id.name, {
4040
- type: t34.tsTypeLiteral(statement.body.body),
4270
+ type: t35.tsTypeLiteral(statement.body.body),
4041
4271
  // 将接口体转换为类型字面量
4042
- hasTypeParameters: !!_optionalChain([statement, 'access', _123 => _123.typeParameters, 'optionalAccess', _124 => _124.params, 'access', _125 => _125.length])
4272
+ hasTypeParameters: !!_optionalChain([statement, 'access', _134 => _134.typeParameters, 'optionalAccess', _135 => _135.params, 'access', _136 => _136.length])
4043
4273
  // 检查是否有泛型参数
4044
4274
  });
4045
4275
  continue;
4046
4276
  }
4047
- if (t34.isTSTypeAliasDeclaration(statement)) {
4277
+ if (t35.isTSTypeAliasDeclaration(statement)) {
4048
4278
  declarations.set(statement.id.name, {
4049
4279
  type: statement.typeAnnotation,
4050
4280
  // 直接使用类型注解
4051
- hasTypeParameters: !!_optionalChain([statement, 'access', _126 => _126.typeParameters, 'optionalAccess', _127 => _127.params, 'access', _128 => _128.length])
4281
+ hasTypeParameters: !!_optionalChain([statement, 'access', _137 => _137.typeParameters, 'optionalAccess', _138 => _138.params, 'access', _139 => _139.length])
4052
4282
  // 检查是否有泛型参数
4053
4283
  });
4054
4284
  continue;
4055
4285
  }
4056
- if (t34.isExportNamedDeclaration(statement) && statement.declaration) {
4286
+ if (t35.isExportNamedDeclaration(statement) && statement.declaration) {
4057
4287
  const declaration = statement.declaration;
4058
- if (t34.isTSInterfaceDeclaration(declaration)) {
4288
+ if (t35.isTSInterfaceDeclaration(declaration)) {
4059
4289
  declarations.set(declaration.id.name, {
4060
- type: t34.tsTypeLiteral(declaration.body.body),
4290
+ type: t35.tsTypeLiteral(declaration.body.body),
4061
4291
  // 将接口体转换为类型字面量
4062
- hasTypeParameters: !!_optionalChain([declaration, 'access', _129 => _129.typeParameters, 'optionalAccess', _130 => _130.params, 'access', _131 => _131.length])
4292
+ hasTypeParameters: !!_optionalChain([declaration, 'access', _140 => _140.typeParameters, 'optionalAccess', _141 => _141.params, 'access', _142 => _142.length])
4063
4293
  // 检查是否有泛型参数
4064
4294
  });
4065
- } else if (t34.isTSTypeAliasDeclaration(declaration)) {
4295
+ } else if (t35.isTSTypeAliasDeclaration(declaration)) {
4066
4296
  declarations.set(declaration.id.name, {
4067
4297
  type: declaration.typeAnnotation,
4068
4298
  // 直接使用类型注解
4069
- hasTypeParameters: !!_optionalChain([declaration, 'access', _132 => _132.typeParameters, 'optionalAccess', _133 => _133.params, 'access', _134 => _134.length])
4299
+ hasTypeParameters: !!_optionalChain([declaration, 'access', _143 => _143.typeParameters, 'optionalAccess', _144 => _144.params, 'access', _145 => _145.length])
4070
4300
  // 检查是否有泛型参数
4071
4301
  });
4072
4302
  }
@@ -4075,22 +4305,22 @@ function collectLocalTypeDeclarations(path8) {
4075
4305
  return declarations;
4076
4306
  }
4077
4307
  function resolvePropName2(key) {
4078
- if (t34.isIdentifier(key)) {
4308
+ if (t35.isIdentifier(key)) {
4079
4309
  return key.name;
4080
4310
  }
4081
- if (t34.isStringLiteral(key)) {
4311
+ if (t35.isStringLiteral(key)) {
4082
4312
  return key.value;
4083
4313
  }
4084
- if (t34.isNumericLiteral(key)) {
4314
+ if (t35.isNumericLiteral(key)) {
4085
4315
  return String(key.value);
4086
4316
  }
4087
4317
  return null;
4088
4318
  }
4089
4319
  function resolveCallableType(tsType) {
4090
- if (t34.isTSFunctionType(tsType)) {
4320
+ if (t35.isTSFunctionType(tsType)) {
4091
4321
  return tsType;
4092
4322
  }
4093
- if (t34.isTSParenthesizedType(tsType)) {
4323
+ if (t35.isTSParenthesizedType(tsType)) {
4094
4324
  return resolveCallableType(tsType.typeAnnotation);
4095
4325
  }
4096
4326
  return null;
@@ -4099,12 +4329,12 @@ function resolveCallableType(tsType) {
4099
4329
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-props-interface/resolve-slot/type-resolver.ts
4100
4330
  var SLOT_DEFAULT_NAME2 = "default";
4101
4331
  function resolveSlotType(tsType, options) {
4102
- if (t35.isTSParenthesizedType(tsType)) {
4332
+ if (t36.isTSParenthesizedType(tsType)) {
4103
4333
  return resolveSlotType(tsType.typeAnnotation, options);
4104
4334
  }
4105
- if (t35.isTSTypeReference(tsType)) {
4335
+ if (t36.isTSTypeReference(tsType)) {
4106
4336
  let shouldRecordReactNode = false;
4107
- if (_optionalChain([tsType, 'access', _135 => _135.typeParameters, 'optionalAccess', _136 => _136.params, 'access', _137 => _137.length])) {
4337
+ if (_optionalChain([tsType, 'access', _146 => _146.typeParameters, 'optionalAccess', _147 => _147.params, 'access', _148 => _148.length])) {
4108
4338
  const params = [];
4109
4339
  for (const param of tsType.typeParameters.params) {
4110
4340
  const resolved2 = resolveSlotType(param, options);
@@ -4118,11 +4348,11 @@ function resolveSlotType(tsType, options) {
4118
4348
  };
4119
4349
  }
4120
4350
  return {
4121
- type: t35.tsTypeReference(tsType.typeName, t35.tsTypeParameterInstantiation(params)),
4351
+ type: t36.tsTypeReference(tsType.typeName, t36.tsTypeParameterInstantiation(params)),
4122
4352
  shouldRecordReactNode
4123
4353
  };
4124
4354
  }
4125
- if (!t35.isIdentifier(tsType.typeName)) {
4355
+ if (!t36.isIdentifier(tsType.typeName)) {
4126
4356
  return {
4127
4357
  type: tsType,
4128
4358
  shouldRecordReactNode: false
@@ -4153,7 +4383,7 @@ function resolveSlotType(tsType, options) {
4153
4383
  }
4154
4384
  return resolved;
4155
4385
  }
4156
- if (t35.isTSIntersectionType(tsType)) {
4386
+ if (t36.isTSIntersectionType(tsType)) {
4157
4387
  const types = [];
4158
4388
  let shouldRecordReactNode = false;
4159
4389
  for (const item of tsType.types) {
@@ -4176,11 +4406,11 @@ function resolveSlotType(tsType, options) {
4176
4406
  };
4177
4407
  }
4178
4408
  return {
4179
- type: t35.tsIntersectionType(types),
4409
+ type: t36.tsIntersectionType(types),
4180
4410
  shouldRecordReactNode
4181
4411
  };
4182
4412
  }
4183
- if (t35.isTSUnionType(tsType)) {
4413
+ if (t36.isTSUnionType(tsType)) {
4184
4414
  const types = [];
4185
4415
  let shouldRecordReactNode = false;
4186
4416
  for (const item of tsType.types) {
@@ -4203,11 +4433,11 @@ function resolveSlotType(tsType, options) {
4203
4433
  };
4204
4434
  }
4205
4435
  return {
4206
- type: t35.tsUnionType(types),
4436
+ type: t36.tsUnionType(types),
4207
4437
  shouldRecordReactNode
4208
4438
  };
4209
4439
  }
4210
- if (t35.isTSTypeLiteral(tsType)) {
4440
+ if (t36.isTSTypeLiteral(tsType)) {
4211
4441
  const members = [];
4212
4442
  let shouldRecordReactNode = false;
4213
4443
  for (const item of tsType.members) {
@@ -4222,11 +4452,11 @@ function resolveSlotType(tsType, options) {
4222
4452
  };
4223
4453
  }
4224
4454
  return {
4225
- type: t35.tsTypeLiteral(members),
4455
+ type: t36.tsTypeLiteral(members),
4226
4456
  shouldRecordReactNode
4227
4457
  };
4228
4458
  }
4229
- if (t35.isTSFunctionType(tsType)) {
4459
+ if (t36.isTSFunctionType(tsType)) {
4230
4460
  const props = buildSlotPropSignature(
4231
4461
  SLOT_DEFAULT_NAME2,
4232
4462
  cloneCallableParams(tsType.parameters),
@@ -4234,7 +4464,7 @@ function resolveSlotType(tsType, options) {
4234
4464
  // 默认插槽不是可选的
4235
4465
  );
4236
4466
  return {
4237
- type: t35.tsTypeLiteral([props]),
4467
+ type: t36.tsTypeLiteral([props]),
4238
4468
  shouldRecordReactNode: true
4239
4469
  // 函数类型总是需要记录 ReactNode
4240
4470
  };
@@ -4245,7 +4475,7 @@ function resolveSlotType(tsType, options) {
4245
4475
  };
4246
4476
  }
4247
4477
  function resolveSlotPropFromMember(member) {
4248
- if (t35.isTSMethodSignature(member)) {
4478
+ if (t36.isTSMethodSignature(member)) {
4249
4479
  const rawName = resolvePropName2(member.key);
4250
4480
  if (!rawName) {
4251
4481
  return {
@@ -4260,7 +4490,7 @@ function resolveSlotPropFromMember(member) {
4260
4490
  // 方法签名总是可调用,需要记录 ReactNode
4261
4491
  };
4262
4492
  }
4263
- if (t35.isTSPropertySignature(member)) {
4493
+ if (t36.isTSPropertySignature(member)) {
4264
4494
  const rawName = resolvePropName2(member.key);
4265
4495
  if (!rawName) {
4266
4496
  return {
@@ -4268,7 +4498,7 @@ function resolveSlotPropFromMember(member) {
4268
4498
  shouldRecordReactNode: false
4269
4499
  };
4270
4500
  }
4271
- const typeAnnotation = _optionalChain([member, 'access', _138 => _138.typeAnnotation, 'optionalAccess', _139 => _139.typeAnnotation]);
4501
+ const typeAnnotation = _optionalChain([member, 'access', _149 => _149.typeAnnotation, 'optionalAccess', _150 => _150.typeAnnotation]);
4272
4502
  const callable = typeAnnotation ? resolveCallableType(typeAnnotation) : null;
4273
4503
  if (!callable) {
4274
4504
  return {
@@ -4283,7 +4513,7 @@ function resolveSlotPropFromMember(member) {
4283
4513
  // 可调用属性需要记录 ReactNode
4284
4514
  };
4285
4515
  }
4286
- if (t35.isTSCallSignatureDeclaration(member)) {
4516
+ if (t36.isTSCallSignatureDeclaration(member)) {
4287
4517
  const params = cloneCallableParams(member.parameters);
4288
4518
  return {
4289
4519
  member: buildSlotPropSignature(SLOT_DEFAULT_NAME2, params, true),
@@ -4300,8 +4530,8 @@ function resolveSlotPropFromMember(member) {
4300
4530
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-props-interface/resolve-slot/define-slots.ts
4301
4531
  function resolveDefineSlotsIface(path8, ctx) {
4302
4532
  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;
4533
+ const tsParams = _optionalChain([node, 'access', _151 => _151.typeParameters, 'optionalAccess', _152 => _152.params]);
4534
+ if (!_optionalChain([tsParams, 'optionalAccess', _153 => _153.length])) return;
4305
4535
  const {
4306
4536
  propsTSIface: { slotTypes }
4307
4537
  } = ctx.scriptData;
@@ -4341,7 +4571,7 @@ function resolveTemplateSlotIface(ctx) {
4341
4571
  }
4342
4572
  if (tsMembers.length) {
4343
4573
  recordReactNode(ctx);
4344
- slotTypes.push(t36.tsTypeLiteral(tsMembers));
4574
+ slotTypes.push(t37.tsTypeLiteral(tsMembers));
4345
4575
  }
4346
4576
  }
4347
4577
 
@@ -4393,9 +4623,9 @@ function resolveCompIProps(ctx, ast) {
4393
4623
  }
4394
4624
  const n = declaredOptions.name || "Comp";
4395
4625
  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);
4626
+ const typeNode = t38.tsIntersectionType(tsTypes);
4627
+ const typeAliasDecl = t38.tsTypeAliasDeclaration(t38.identifier(ns), null, typeNode);
4628
+ const exportDecl = t38.exportNamedDeclaration(typeAliasDecl);
4399
4629
  propsTSIface.name = ns;
4400
4630
  const scriptIR = getScriptIR(ctx);
4401
4631
  scriptIR.exports.push(exportDecl);
@@ -4410,8 +4640,8 @@ function resolveUseAttrs(ctx) {
4410
4640
  const { init, id } = path8.node;
4411
4641
  if (!init) return;
4412
4642
  const initPath = path8.get("init");
4413
- const propsIdentifier = t38.identifier(ctx.propField);
4414
- if (t38.isTSAsExpression(init) && isUseAttrsCall(init.expression)) {
4643
+ const propsIdentifier = t39.identifier(ctx.propField);
4644
+ if (t39.isTSAsExpression(init) && isUseAttrsCall(init.expression)) {
4415
4645
  const typeAssertion = createPropsTypeAssertion(propsIdentifier, init.typeAnnotation);
4416
4646
  replaceNode(initPath, typeAssertion, init);
4417
4647
  return;
@@ -4422,13 +4652,13 @@ function resolveUseAttrs(ctx) {
4422
4652
  const isTS = ctx.scriptData.lang.startsWith("ts");
4423
4653
  if (isTS) {
4424
4654
  let typeAnnotation = null;
4425
- if (t38.isIdentifier(id) && t38.isTSTypeAnnotation(id.typeAnnotation)) {
4655
+ if (t39.isIdentifier(id) && t39.isTSTypeAnnotation(id.typeAnnotation)) {
4426
4656
  typeAnnotation = id.typeAnnotation.typeAnnotation;
4427
4657
  id.typeAnnotation = null;
4428
4658
  } else {
4429
- typeAnnotation = t38.tsTypeReference(
4430
- t38.identifier("Record"),
4431
- t38.tsTypeParameterInstantiation([t38.tsStringKeyword(), t38.tsUnknownKeyword()])
4659
+ typeAnnotation = t39.tsTypeReference(
4660
+ t39.identifier("Record"),
4661
+ t39.tsTypeParameterInstantiation([t39.tsStringKeyword(), t39.tsUnknownKeyword()])
4432
4662
  );
4433
4663
  }
4434
4664
  const propsTypeAssertion = createPropsTypeAssertion(propsIdentifier, typeAnnotation);
@@ -4440,10 +4670,10 @@ function resolveUseAttrs(ctx) {
4440
4670
  };
4441
4671
  }
4442
4672
  function isUseAttrsCall(expr) {
4443
- return t38.isCallExpression(expr) && isCalleeNamed(expr, VUE_API_MAP.useAttrs);
4673
+ return t39.isCallExpression(expr) && isCalleeNamed(expr, VUE_API_MAP.useAttrs);
4444
4674
  }
4445
4675
  function createPropsTypeAssertion(propsIdentifier, typeAnnotation) {
4446
- return t38.tsAsExpression(propsIdentifier, typeAnnotation);
4676
+ return t39.tsAsExpression(propsIdentifier, typeAnnotation);
4447
4677
  }
4448
4678
 
4449
4679
  // src/core/transform/sfc/script/syntax-processor/process/resolve-analysis-only-adapter.ts
@@ -4466,7 +4696,7 @@ function isBindingDeclaredInsideBoundary(binding, boundary) {
4466
4696
  }
4467
4697
  function isReactiveBinding(node) {
4468
4698
  if (!node) return false;
4469
- return !!_optionalChain([getScriptNodeMeta, 'call', _143 => _143(node), 'optionalAccess', _144 => _144.is_reactive]);
4699
+ return !!_optionalChain([getScriptNodeMeta, 'call', _154 => _154(node), 'optionalAccess', _155 => _155.is_reactive]);
4470
4700
  }
4471
4701
 
4472
4702
  // src/core/transform/sfc/script/shared/dependency-analyzer/dep-checker.ts
@@ -4479,40 +4709,40 @@ function isEligibleBindingSource(binding) {
4479
4709
  const bindingPath = binding.path;
4480
4710
  const declaratorPath = getVariableDeclaratorPath(bindingPath);
4481
4711
  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));
4712
+ const nodeInit = _optionalChain([declaratorPath, 'optionalAccess', _156 => _156.node, 'access', _157 => _157.init]);
4713
+ const isReactiveApiCallVarBinding = !!declaratorPath && t40.isCallExpression(nodeInit) && t40.isIdentifier(nodeInit.callee) && reactiveStateApis.has(nodeInit.callee.name);
4714
+ const isHookCallVarBinding = !!declaratorPath && t40.isCallExpression(nodeInit) && isHookLikeCallee(nodeInit.callee);
4715
+ const isFunctionBinding = bindingPath.isFunctionDeclaration() || !!declaratorPath && !!nodeInit && (t40.isArrowFunctionExpression(nodeInit) || t40.isFunctionExpression(nodeInit));
4716
+ const isReactiveFunctionBinding = isFunctionBinding && (isReactiveBinding(_optionalChain([declaratorPath, 'optionalAccess', _158 => _158.node])) || isReactiveBinding(bindingPath.node));
4487
4717
  return isReactiveVarBinding || isReactiveApiCallVarBinding || isHookCallVarBinding || isReactiveFunctionBinding;
4488
4718
  }
4489
4719
  function isReactValidDependencyExpr(node) {
4490
- if (t39.isIdentifier(node)) {
4720
+ if (t40.isIdentifier(node)) {
4491
4721
  return true;
4492
4722
  }
4493
- if (t39.isMemberExpression(node) || t39.isOptionalMemberExpression(node)) {
4723
+ if (t40.isMemberExpression(node) || t40.isOptionalMemberExpression(node)) {
4494
4724
  return isStaticMemberChain(node);
4495
4725
  }
4496
4726
  return false;
4497
4727
  }
4498
4728
  function isStaticMemberChain(node) {
4499
4729
  let current = node;
4500
- while (t39.isMemberExpression(current) || t39.isOptionalMemberExpression(current)) {
4501
- if (!current.computed && !t39.isIdentifier(current.property)) {
4730
+ while (t40.isMemberExpression(current) || t40.isOptionalMemberExpression(current)) {
4731
+ if (!current.computed && !t40.isIdentifier(current.property)) {
4502
4732
  return false;
4503
4733
  }
4504
- if (current.computed && !t39.isStringLiteral(current.property) && !t39.isNumericLiteral(current.property)) {
4734
+ if (current.computed && !t40.isStringLiteral(current.property) && !t40.isNumericLiteral(current.property)) {
4505
4735
  return false;
4506
4736
  }
4507
4737
  current = current.object;
4508
4738
  }
4509
- return t39.isIdentifier(current);
4739
+ return t40.isIdentifier(current);
4510
4740
  }
4511
4741
  function isHookLikeCallee(callee) {
4512
- if (t39.isIdentifier(callee)) {
4742
+ if (t40.isIdentifier(callee)) {
4513
4743
  return callee.name.startsWith("use");
4514
4744
  }
4515
- if (t39.isMemberExpression(callee) && !callee.computed && t39.isIdentifier(callee.property)) {
4745
+ if (t40.isMemberExpression(callee) && !callee.computed && t40.isIdentifier(callee.property)) {
4516
4746
  return callee.property.name.startsWith("use");
4517
4747
  }
4518
4748
  return false;
@@ -4521,16 +4751,16 @@ function isHookLikeCallee(callee) {
4521
4751
  // src/core/transform/sfc/script/shared/dependency-analyzer/dep-key.ts
4522
4752
 
4523
4753
  function getDependencyKey(exp) {
4524
- if (t40.isIdentifier(exp)) {
4754
+ if (t41.isIdentifier(exp)) {
4525
4755
  return exp.name;
4526
4756
  }
4527
- if (t40.isMemberExpression(exp) || t40.isOptionalMemberExpression(exp)) {
4757
+ if (t41.isMemberExpression(exp) || t41.isOptionalMemberExpression(exp)) {
4528
4758
  const objectKey = getDependencyKey(exp.object);
4529
4759
  const opt = exp.optional ? "?" : "";
4530
- if (!exp.computed && t40.isIdentifier(exp.property)) {
4760
+ if (!exp.computed && t41.isIdentifier(exp.property)) {
4531
4761
  return `${objectKey}${opt}.${exp.property.name}`;
4532
4762
  }
4533
- if (t40.isStringLiteral(exp.property) || t40.isNumericLiteral(exp.property)) {
4763
+ if (t41.isStringLiteral(exp.property) || t41.isNumericLiteral(exp.property)) {
4534
4764
  return `${objectKey}${opt}[${JSON.stringify(exp.property.value)}]`;
4535
4765
  }
4536
4766
  return `${objectKey}${opt}[*]`;
@@ -4541,38 +4771,38 @@ function getDependencyKey(exp) {
4541
4771
  // src/core/transform/sfc/script/shared/dependency-analyzer/dep-normalizer.ts
4542
4772
 
4543
4773
  function normalizeDependencyExpr(path8, rootName, ctx) {
4544
- if (t41.isIdentifier(path8.node)) {
4545
- return t41.identifier(path8.node.name);
4774
+ if (t42.isIdentifier(path8.node)) {
4775
+ return t42.identifier(path8.node.name);
4546
4776
  }
4547
- if (t41.isMemberExpression(path8.node) || t41.isOptionalMemberExpression(path8.node)) {
4777
+ if (t42.isMemberExpression(path8.node) || t42.isOptionalMemberExpression(path8.node)) {
4548
4778
  if (rootName === ctx.propField) {
4549
4779
  const safePropsExp = ensureOptionalForMemberChain(path8.node);
4550
4780
  if (isReactValidDependencyExpr(safePropsExp)) {
4551
- return t41.cloneNode(safePropsExp, true);
4781
+ return t42.cloneNode(safePropsExp, true);
4552
4782
  }
4553
- return t41.identifier(rootName);
4783
+ return t42.identifier(rootName);
4554
4784
  }
4555
4785
  const normalizedExp = normalizeMemberForCallSite(path8, path8.node);
4556
- const safeExp = t41.isMemberExpression(normalizedExp) || t41.isOptionalMemberExpression(normalizedExp) ? ensureOptionalForMemberChain(normalizedExp) : normalizedExp;
4786
+ const safeExp = t42.isMemberExpression(normalizedExp) || t42.isOptionalMemberExpression(normalizedExp) ? ensureOptionalForMemberChain(normalizedExp) : normalizedExp;
4557
4787
  if (isReactValidDependencyExpr(safeExp)) {
4558
- return t41.cloneNode(safeExp, true);
4788
+ return t42.cloneNode(safeExp, true);
4559
4789
  }
4560
- return t41.identifier(rootName);
4790
+ return t42.identifier(rootName);
4561
4791
  }
4562
4792
  return null;
4563
4793
  }
4564
4794
  function normalizeSourcedDependency(exp) {
4565
- if (t41.isIdentifier(exp)) {
4566
- return t41.identifier(exp.name);
4795
+ if (t42.isIdentifier(exp)) {
4796
+ return t42.identifier(exp.name);
4567
4797
  }
4568
- if (t41.isMemberExpression(exp) || t41.isOptionalMemberExpression(exp)) {
4798
+ if (t42.isMemberExpression(exp) || t42.isOptionalMemberExpression(exp)) {
4569
4799
  const root = findRootIdentifier(exp);
4570
4800
  if (!root) return null;
4571
- const safeExp = t41.isMemberExpression(exp) || t41.isOptionalMemberExpression(exp) ? ensureOptionalForMemberChain(exp) : exp;
4801
+ const safeExp = t42.isMemberExpression(exp) || t42.isOptionalMemberExpression(exp) ? ensureOptionalForMemberChain(exp) : exp;
4572
4802
  if (isReactValidDependencyExpr(safeExp)) {
4573
- return t41.cloneNode(safeExp, true);
4803
+ return t42.cloneNode(safeExp, true);
4574
4804
  }
4575
- return t41.identifier(root.name);
4805
+ return t42.identifier(root.name);
4576
4806
  }
4577
4807
  return null;
4578
4808
  }
@@ -4582,7 +4812,7 @@ function normalizeMemberForCallSite(path8, node) {
4582
4812
  if (!isDirectCallee) {
4583
4813
  return node;
4584
4814
  }
4585
- if (!t41.isExpression(node.object)) {
4815
+ if (!t42.isExpression(node.object)) {
4586
4816
  return node;
4587
4817
  }
4588
4818
  return node.object;
@@ -4594,20 +4824,20 @@ function ensureOptionalForMemberChain(node) {
4594
4824
  const rebuildWithOptionalChain = (node2) => {
4595
4825
  const safeObject = ensureOptionalForMemberChain(node2.object);
4596
4826
  if (safeObject !== node2.object) {
4597
- const property = t41.cloneNode(node2.property, true);
4598
- return t41.optionalMemberExpression(safeObject, property, node2.computed, true);
4827
+ const property = t42.cloneNode(node2.property, true);
4828
+ return t42.optionalMemberExpression(safeObject, property, node2.computed, true);
4599
4829
  }
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);
4830
+ if (t42.isMemberExpression(node2)) {
4831
+ const object = t42.cloneNode(node2.object, true);
4832
+ const property = t42.cloneNode(node2.property, true);
4833
+ return t42.optionalMemberExpression(object, property, node2.computed, true);
4604
4834
  }
4605
4835
  return node2;
4606
4836
  };
4607
4837
  return rebuildWithOptionalChain(node);
4608
4838
  }
4609
4839
  function hasTrailingMemberAccess(node) {
4610
- return t41.isMemberExpression(node.object) || t41.isOptionalMemberExpression(node.object);
4840
+ return t42.isMemberExpression(node.object) || t42.isOptionalMemberExpression(node.object);
4611
4841
  }
4612
4842
 
4613
4843
  // src/core/transform/sfc/script/shared/dependency-analyzer/shared-utils.ts
@@ -4634,7 +4864,7 @@ function traceBindingSource(binding, seen, depth) {
4634
4864
  }
4635
4865
  function isExpressionSourcedFromEligibleBinding(exp, scope, seen, depth) {
4636
4866
  if (depth <= 0) return null;
4637
- if (t42.isIdentifier(exp)) {
4867
+ if (t43.isIdentifier(exp)) {
4638
4868
  const sourceBinding = scope.getBinding(exp.name);
4639
4869
  if (!sourceBinding) return null;
4640
4870
  if (isEligibleBindingSource(sourceBinding)) {
@@ -4642,13 +4872,13 @@ function isExpressionSourcedFromEligibleBinding(exp, scope, seen, depth) {
4642
4872
  }
4643
4873
  return traceBindingSource(sourceBinding, seen, depth - 1);
4644
4874
  }
4645
- if (t42.isMemberExpression(exp) || t42.isOptionalMemberExpression(exp)) {
4875
+ if (t43.isMemberExpression(exp) || t43.isOptionalMemberExpression(exp)) {
4646
4876
  const root = findRootIdentifier(exp);
4647
4877
  if (!root) return null;
4648
4878
  const sourceBinding = scope.getBinding(root.name);
4649
4879
  if (!sourceBinding) return null;
4650
4880
  if (isEligibleBindingSource(sourceBinding)) {
4651
- return t42.cloneNode(exp);
4881
+ return t43.cloneNode(exp);
4652
4882
  }
4653
4883
  const sourcedRoot = traceBindingSource(sourceBinding, seen, depth - 1);
4654
4884
  if (sourcedRoot) {
@@ -4656,17 +4886,17 @@ function isExpressionSourcedFromEligibleBinding(exp, scope, seen, depth) {
4656
4886
  if (rebuilt) {
4657
4887
  return rebuilt;
4658
4888
  }
4659
- return t42.cloneNode(sourcedRoot, true);
4889
+ return t43.cloneNode(sourcedRoot, true);
4660
4890
  }
4661
4891
  }
4662
4892
  return null;
4663
4893
  }
4664
4894
  function rebuildMemberWithNewRoot(node, nextRoot) {
4665
4895
  const replacedObject = (() => {
4666
- if (t42.isIdentifier(node.object)) {
4667
- return t42.cloneNode(nextRoot, true);
4896
+ if (t43.isIdentifier(node.object)) {
4897
+ return t43.cloneNode(nextRoot, true);
4668
4898
  }
4669
- if (t42.isMemberExpression(node.object) || t42.isOptionalMemberExpression(node.object)) {
4899
+ if (t43.isMemberExpression(node.object) || t43.isOptionalMemberExpression(node.object)) {
4670
4900
  return rebuildMemberWithNewRoot(node.object, nextRoot);
4671
4901
  }
4672
4902
  return null;
@@ -4674,15 +4904,15 @@ function rebuildMemberWithNewRoot(node, nextRoot) {
4674
4904
  if (!replacedObject) {
4675
4905
  return null;
4676
4906
  }
4677
- const property = t42.cloneNode(node.property, true);
4678
- if (t42.isMemberExpression(node)) {
4679
- return t42.memberExpression(
4907
+ const property = t43.cloneNode(node.property, true);
4908
+ if (t43.isMemberExpression(node)) {
4909
+ return t43.memberExpression(
4680
4910
  replacedObject,
4681
4911
  property,
4682
4912
  node.computed
4683
4913
  );
4684
4914
  }
4685
- return t42.optionalMemberExpression(
4915
+ return t43.optionalMemberExpression(
4686
4916
  replacedObject,
4687
4917
  property,
4688
4918
  node.computed,
@@ -4693,9 +4923,9 @@ function rebuildMemberWithNewRoot(node, nextRoot) {
4693
4923
  // src/core/transform/sfc/script/shared/dependency-analyzer/index.ts
4694
4924
  function analyzeDeps(node, ctx, parentPath) {
4695
4925
  if (!parentPath) {
4696
- return t43.arrayExpression([]);
4926
+ return t44.arrayExpression([]);
4697
4927
  }
4698
- const isFnExpr = t43.isArrowFunctionExpression(node) || t43.isFunctionExpression(node);
4928
+ const isFnExpr = t44.isArrowFunctionExpression(node) || t44.isFunctionExpression(node);
4699
4929
  const analyzeTarget = isFnExpr ? node.body : node;
4700
4930
  const bindingLocalBoundary = isFnExpr ? node : analyzeTarget;
4701
4931
  const deps = /* @__PURE__ */ new Map();
@@ -4705,13 +4935,13 @@ function analyzeDeps(node, ctx, parentPath) {
4705
4935
  }
4706
4936
  const analyzeTargetPath = parentPath && parentPath.node === analyzeTarget ? parentPath : null;
4707
4937
  if (analyzeTargetPath) {
4708
- if (t43.isMemberExpression(analyzeTarget) || t43.isOptionalMemberExpression(analyzeTarget)) {
4938
+ if (t44.isMemberExpression(analyzeTarget) || t44.isOptionalMemberExpression(analyzeTarget)) {
4709
4939
  const rootId = findRootIdentifier(analyzeTarget);
4710
4940
  if (rootId) {
4711
4941
  tryAddDependency(analyzeTargetPath, rootId.name, analyzeTargetPath.scope);
4712
4942
  processedIdentifiers.add(rootId);
4713
4943
  }
4714
- } else if (t43.isIdentifier(analyzeTarget)) {
4944
+ } else if (t44.isIdentifier(analyzeTarget)) {
4715
4945
  tryAddDependency(analyzeTargetPath, analyzeTarget.name, analyzeTargetPath.scope);
4716
4946
  }
4717
4947
  }
@@ -4763,7 +4993,7 @@ function analyzeDeps(node, ctx, parentPath) {
4763
4993
  }
4764
4994
  }
4765
4995
  }
4766
- return t43.arrayExpression(Array.from(deps.values()));
4996
+ return t44.arrayExpression(Array.from(deps.values()));
4767
4997
  }
4768
4998
 
4769
4999
  // src/core/transform/sfc/script/syntax-processor/process/resolve-analysis-only-adapter.ts
@@ -4779,7 +5009,7 @@ function resolveAnalysisOnlyAdapter(ctx) {
4779
5009
  if (!isVueApiReference(path8, apiName)) {
4780
5010
  return;
4781
5011
  }
4782
- if (t44.isCallExpression(node)) {
5012
+ if (t45.isCallExpression(node)) {
4783
5013
  resolveCallNode(path8, adapter, ctx);
4784
5014
  } else {
4785
5015
  replaceIdName(node, adapter.target);
@@ -4789,11 +5019,11 @@ function resolveAnalysisOnlyAdapter(ctx) {
4789
5019
  };
4790
5020
  }
4791
5021
  function getApiName(node) {
4792
- const isCallNode = t44.isCallExpression(node);
5022
+ const isCallNode = t45.isCallExpression(node);
4793
5023
  let apiName = "";
4794
- if (t44.isIdentifier(node)) {
5024
+ if (t45.isIdentifier(node)) {
4795
5025
  apiName = node.name;
4796
- } else if (isCallNode && t44.isIdentifier(node.callee)) {
5026
+ } else if (isCallNode && t45.isIdentifier(node.callee)) {
4797
5027
  apiName = node.callee.name;
4798
5028
  }
4799
5029
  return apiName;
@@ -4803,7 +5033,7 @@ function resolveCallNode(path8, adapter, ctx) {
4803
5033
  const { arguments: args } = node;
4804
5034
  if (!args.length) return;
4805
5035
  const fn = args[0];
4806
- if (!t44.isArrowFunctionExpression(fn) && !t44.isFunctionExpression(fn)) {
5036
+ if (!t45.isArrowFunctionExpression(fn) && !t45.isFunctionExpression(fn)) {
4807
5037
  return;
4808
5038
  }
4809
5039
  const fnPath = path8.get("arguments")[0];
@@ -4834,8 +5064,8 @@ function isVueImportBinding(binding) {
4834
5064
  if (!bindingPath.isImportSpecifier() && !bindingPath.isImportDefaultSpecifier() && !bindingPath.isImportNamespaceSpecifier()) {
4835
5065
  return false;
4836
5066
  }
4837
- const parent = _optionalChain([bindingPath, 'access', _148 => _148.parentPath, 'optionalAccess', _149 => _149.node]);
4838
- if (!parent || !t44.isImportDeclaration(parent)) {
5067
+ const parent = _optionalChain([bindingPath, 'access', _159 => _159.parentPath, 'optionalAccess', _160 => _160.node]);
5068
+ if (!parent || !t45.isImportDeclaration(parent)) {
4839
5069
  return false;
4840
5070
  }
4841
5071
  const source = parent.source.value.toLowerCase();
@@ -4861,7 +5091,7 @@ function resolveArrowFnDeps(ctx, ast) {
4861
5091
  const newNode = createUseCallback(node, deps);
4862
5092
  const declaratorPath = getVariableDeclaratorPath(path8);
4863
5093
  recordImport(ctx, PACKAGE_NAME.react, REACT_API_MAP.useCallback);
4864
- setScriptNodeMeta(_optionalChain([declaratorPath, 'optionalAccess', _150 => _150.node]), { is_reactive: true, reactive_type: "indirect" });
5094
+ setScriptNodeMeta(_optionalChain([declaratorPath, 'optionalAccess', _161 => _161.node]), { is_reactive: true, reactive_type: "indirect" });
4865
5095
  replaceNode(path8, newNode, node);
4866
5096
  }
4867
5097
  };
@@ -4920,15 +5150,15 @@ function resolveElementRef(ctx) {
4920
5150
  return;
4921
5151
  }
4922
5152
  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]))) {
5153
+ const varDeclaratorPath = _optionalChain([getVariableDeclaratorPath, 'call', _162 => _162(path8), 'optionalAccess', _163 => _163.node]);
5154
+ if (!t46.isIdentifier(_optionalChain([varDeclaratorPath, 'optionalAccess', _164 => _164.id]))) {
4925
5155
  return;
4926
5156
  }
4927
5157
  const varName = varDeclaratorPath.id.name;
4928
5158
  const compRef = refBindings.componentRefs[varName];
4929
5159
  if (!compRef) return;
4930
5160
  }
4931
- node.arguments[0] = t45.identifier("null");
5161
+ node.arguments[0] = t46.identifier("null");
4932
5162
  resolveTypeParameters(ctx, path8);
4933
5163
  replaceCallName(node, REACT_API_MAP.useRef);
4934
5164
  recordImport(ctx, PACKAGE_NAME.react, REACT_API_MAP.useRef);
@@ -4944,7 +5174,7 @@ function resolveTypeParameters(ctx, path8) {
4944
5174
  scriptData
4945
5175
  } = ctx;
4946
5176
  const { node } = path8;
4947
- const varDeclaratorNode = _optionalChain([getVariableDeclaratorPath, 'call', _154 => _154(path8), 'optionalAccess', _155 => _155.node]);
5177
+ const varDeclaratorNode = _optionalChain([getVariableDeclaratorPath, 'call', _165 => _165(path8), 'optionalAccess', _166 => _166.node]);
4948
5178
  if (!scriptData.lang.startsWith("ts") || !varDeclaratorNode) {
4949
5179
  return;
4950
5180
  }
@@ -4953,20 +5183,20 @@ function resolveTypeParameters(ctx, path8) {
4953
5183
  const compBindingMeta = refBindings.componentRefs[idName];
4954
5184
  if (!node.typeParameters && (domBindingMeta || compBindingMeta)) {
4955
5185
  const type = compBindingMeta ? "any" : domBindingMeta.htmlType;
4956
- node.typeParameters = t45.tsTypeParameterInstantiation([t45.tsTypeReference(t45.identifier(type))]);
5186
+ node.typeParameters = t46.tsTypeParameterInstantiation([t46.tsTypeReference(t46.identifier(type))]);
4957
5187
  }
4958
5188
  }
4959
5189
  function resolveRefValueToCurrent(path8) {
4960
5190
  const { node } = path8;
4961
- if (node.computed || !t45.isIdentifier(node.property) || node.property.name !== "value") {
5191
+ if (node.computed || !t46.isIdentifier(node.property) || node.property.name !== "value") {
4962
5192
  return;
4963
5193
  }
4964
5194
  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)) {
5195
+ if (!_optionalChain([rootPath, 'optionalAccess', _167 => _167.node]) || !t46.isCallExpression(rootPath.node.init) || !isCalleeNamed(rootPath.node.init, REACT_API_MAP.useRef)) {
4966
5196
  return;
4967
5197
  }
4968
5198
  const rootId = findRootIdentifier(node);
4969
- if (!t45.isIdentifier(node.object) || node.object.name !== _optionalChain([rootId, 'optionalAccess', _157 => _157.name])) {
5199
+ if (!t46.isIdentifier(node.object) || node.object.name !== _optionalChain([rootId, 'optionalAccess', _168 => _168.name])) {
4970
5200
  return;
4971
5201
  }
4972
5202
  node.property.name = "current";
@@ -4985,11 +5215,11 @@ function resolveExprMemo(ctx, ast) {
4985
5215
  if (!atComponentOrHookRoot(path8, ast.program, isScriptFile)) {
4986
5216
  return false;
4987
5217
  }
4988
- if (!t46.isVariableDeclaration(path8.parent) || path8.parent.kind !== "const") {
5218
+ if (!t47.isVariableDeclaration(path8.parent) || path8.parent.kind !== "const") {
4989
5219
  return false;
4990
5220
  }
4991
- if (t46.isFunction(init)) return false;
4992
- if (t46.isCallExpression(init) && t46.isIdentifier(init.callee) && init.callee.name.startsWith("use")) {
5221
+ if (t47.isFunction(init)) return false;
5222
+ if (t47.isCallExpression(init) && t47.isIdentifier(init.callee) && init.callee.name.startsWith("use")) {
4993
5223
  return false;
4994
5224
  }
4995
5225
  return true;
@@ -5014,10 +5244,10 @@ function resolveLintRules(ctx, ast) {
5014
5244
  return {
5015
5245
  CallExpression(path8) {
5016
5246
  const { node, parentPath } = path8;
5017
- if (!t47.isIdentifier(node.callee)) return;
5247
+ if (!t48.isIdentifier(node.callee)) return;
5018
5248
  const { name: callName } = node.callee;
5019
- const addLog = (t53) => {
5020
- logger.error(t53, {
5249
+ const addLog = (t54) => {
5250
+ logger.error(t54, {
5021
5251
  file: ctx.filename,
5022
5252
  source: ctx.scriptData.source,
5023
5253
  loc: node.loc
@@ -5079,7 +5309,7 @@ function resolveProvide(ctx) {
5079
5309
  });
5080
5310
  return;
5081
5311
  }
5082
- const providerTarget = _optionalChain([ADAPTER_RULES, 'access', _158 => _158.runtime, 'access', _159 => _159[VUE_API_MAP.provide], 'optionalAccess', _160 => _160.target]);
5312
+ const providerTarget = _optionalChain([ADAPTER_RULES, 'access', _169 => _169.runtime, 'access', _170 => _170[VUE_API_MAP.provide], 'optionalAccess', _171 => _171.target]);
5083
5313
  const isProvideCall = isCalleeNamed(node, VUE_API_MAP.provide) || providerTarget && isCalleeNamed(node, providerTarget);
5084
5314
  if (!isProvideCall) return;
5085
5315
  const { provide } = scriptData;
@@ -5097,7 +5327,7 @@ function findOrCreateCtxProvider(root) {
5097
5327
  return root;
5098
5328
  }
5099
5329
  let cur = root.provide;
5100
- while (_optionalChain([cur, 'optionalAccess', _161 => _161.isOccupied])) {
5330
+ while (_optionalChain([cur, 'optionalAccess', _172 => _172.isOccupied])) {
5101
5331
  cur = _nullishCoalesce(cur.provide, () => ( {}));
5102
5332
  }
5103
5333
  return cur || (root.provide = {});
@@ -5105,13 +5335,13 @@ function findOrCreateCtxProvider(root) {
5105
5335
  function assignProviderValue(target, key, value) {
5106
5336
  const getRawExp = (exp) => {
5107
5337
  if (!exp) return "''";
5108
- if (t48.isStringLiteral(exp)) {
5338
+ if (t49.isStringLiteral(exp)) {
5109
5339
  return JSON.stringify(exp.value);
5110
5340
  }
5111
- if (t48.isNumericLiteral(exp)) {
5341
+ if (t49.isNumericLiteral(exp)) {
5112
5342
  return exp.value.toString();
5113
5343
  }
5114
- if (t48.isIdentifier(exp)) {
5344
+ if (t49.isIdentifier(exp)) {
5115
5345
  return exp.name;
5116
5346
  }
5117
5347
  try {
@@ -5132,11 +5362,11 @@ function resolveRenameAdapter(ctx) {
5132
5362
  return {
5133
5363
  "CallExpression|Identifier"(path8) {
5134
5364
  const node = path8.node;
5135
- const isCallNode = t49.isCallExpression(node);
5365
+ const isCallNode = t50.isCallExpression(node);
5136
5366
  let apiName = "";
5137
- if (t49.isIdentifier(node)) {
5367
+ if (t50.isIdentifier(node)) {
5138
5368
  apiName = node.name;
5139
- } else if (isCallNode && t49.isIdentifier(node.callee)) {
5369
+ } else if (isCallNode && t50.isIdentifier(node.callee)) {
5140
5370
  apiName = node.callee.name;
5141
5371
  }
5142
5372
  if (!apiName) {
@@ -5154,7 +5384,7 @@ function resolveRenameAdapter(ctx) {
5154
5384
  if (adapter.isTrackable) {
5155
5385
  const reactiveType = getReactiveType(apiName);
5156
5386
  const declaratorPath = getVariableDeclaratorPath(path8);
5157
- setScriptNodeMeta(_optionalChain([declaratorPath, 'optionalAccess', _162 => _162.node]), {
5387
+ setScriptNodeMeta(_optionalChain([declaratorPath, 'optionalAccess', _173 => _173.node]), {
5158
5388
  is_reactive: true,
5159
5389
  reactive_type: reactiveType
5160
5390
  });
@@ -5197,8 +5427,8 @@ function isVueImportBinding2(binding) {
5197
5427
  if (!bindingPath.isImportSpecifier() && !bindingPath.isImportDefaultSpecifier() && !bindingPath.isImportNamespaceSpecifier()) {
5198
5428
  return false;
5199
5429
  }
5200
- const parent = _optionalChain([bindingPath, 'access', _163 => _163.parentPath, 'optionalAccess', _164 => _164.node]);
5201
- if (!parent || !t49.isImportDeclaration(parent)) {
5430
+ const parent = _optionalChain([bindingPath, 'access', _174 => _174.parentPath, 'optionalAccess', _175 => _175.node]);
5431
+ if (!parent || !t50.isImportDeclaration(parent)) {
5202
5432
  return false;
5203
5433
  }
5204
5434
  const source = parent.source.value.toLowerCase();
@@ -5223,7 +5453,9 @@ function processVueSyntax2(ast, ctx) {
5223
5453
  resolveDefineAsyncComponent,
5224
5454
  resolveEmitCalls,
5225
5455
  // feature: https://github.com/vureact-js/core/issues/6
5226
- resolveUseAttrs
5456
+ resolveUseAttrs,
5457
+ // feature: https://github.com/vureact-js/core/issues/56
5458
+ resolveDefineModel
5227
5459
  ]
5228
5460
  },
5229
5461
  process: {
@@ -5253,12 +5485,12 @@ function processVueSyntax2(ast, ctx) {
5253
5485
  }
5254
5486
  function vueSyntaxProcessor2(ast, ctx, options) {
5255
5487
  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)))]);
5488
+ _optionalChain([cfg, 'access', _176 => _176.excludeBabel, 'optionalAccess', _177 => _177.forEach, 'call', _178 => _178((fn) => fn(ctx, ast))]);
5489
+ _optionalChain([cfg, 'access', _179 => _179.applyBabel, 'optionalAccess', _180 => _180.forEach, 'call', _181 => _181((fn) => _core.traverse.call(void 0, ast, fn(ctx, ast)))]);
5258
5490
  };
5259
5491
  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))]);
5492
+ _optionalChain([cfg, 'access', _182 => _182.applyBabel, 'optionalAccess', _183 => _183.forEach, 'call', _184 => _184((fn) => _core.traverse.call(void 0, ast, fn(ctx, ast)))]);
5493
+ _optionalChain([cfg, 'access', _185 => _185.excludeBabel, 'optionalAccess', _186 => _186.forEach, 'call', _187 => _187((fn) => fn(ctx, ast))]);
5262
5494
  };
5263
5495
  runExcludeThenApply(options.preprocess);
5264
5496
  runExcludeThenApply(options.process);
@@ -5266,7 +5498,6 @@ function vueSyntaxProcessor2(ast, ctx, options) {
5266
5498
  }
5267
5499
 
5268
5500
  // src/core/transform/sfc/script/index.ts
5269
- var SCRIPT_IR_KEY = "__vureact_script_block_ir";
5270
5501
  function resolveScript2(ast, ctx) {
5271
5502
  const scriptIR = createScriptIR();
5272
5503
  setScriptIR(ctx, scriptIR);
@@ -5280,14 +5511,14 @@ function resolveScript2(ast, ctx) {
5280
5511
  return scriptIR;
5281
5512
  }
5282
5513
  function getScriptIR(ctx) {
5283
- const ir = ctx.scriptData[SCRIPT_IR_KEY];
5514
+ const ir = ctx.scriptData.__vureact_script_block_ir;
5284
5515
  if (!ir) {
5285
5516
  throw new Error("Script IR is not initialized for current compilation context");
5286
5517
  }
5287
5518
  return ir;
5288
5519
  }
5289
5520
  function setScriptIR(ctx, ir) {
5290
- ctx.scriptData[SCRIPT_IR_KEY] = ir;
5521
+ ctx.scriptData.__vureact_script_block_ir = ir;
5291
5522
  }
5292
5523
  function createScriptIR() {
5293
5524
  return {
@@ -5345,9 +5576,9 @@ function isRouterLinkBooleanCustomProp(prop) {
5345
5576
 
5346
5577
 
5347
5578
  var strCodeTypes = {
5348
- isIdentifier: isIdentifier29,
5579
+ isIdentifier: isIdentifier30,
5349
5580
  isSimpleExpression,
5350
- isStringLiteral: isStringLiteral13
5581
+ isStringLiteral: isStringLiteral14
5351
5582
  };
5352
5583
  function isSimpleExpression(code, excludeVar = false) {
5353
5584
  let node;
@@ -5356,38 +5587,38 @@ function isSimpleExpression(code, excludeVar = false) {
5356
5587
  } catch (e7) {
5357
5588
  return false;
5358
5589
  }
5359
- if (t50.isLiteral(node)) {
5590
+ if (t51.isLiteral(node)) {
5360
5591
  return true;
5361
5592
  }
5362
- if (!excludeVar && t50.isIdentifier(node)) {
5593
+ if (!excludeVar && t51.isIdentifier(node)) {
5363
5594
  return true;
5364
5595
  }
5365
- if (t50.isMemberExpression(node)) {
5366
- return isSimpleExpression(node.object) && t50.isIdentifier(node.property);
5596
+ if (t51.isMemberExpression(node)) {
5597
+ return isSimpleExpression(node.object) && t51.isIdentifier(node.property);
5367
5598
  }
5368
- if (t50.isObjectExpression(node) || t50.isArrayExpression(node)) {
5599
+ if (t51.isObjectExpression(node) || t51.isArrayExpression(node)) {
5369
5600
  return false;
5370
5601
  }
5371
- if (t50.isCallExpression(node) || t50.isAssignmentExpression(node)) {
5602
+ if (t51.isCallExpression(node) || t51.isAssignmentExpression(node)) {
5372
5603
  return false;
5373
5604
  }
5374
- if (t50.isBinaryExpression(node) || t50.isUnaryExpression(node)) {
5605
+ if (t51.isBinaryExpression(node) || t51.isUnaryExpression(node)) {
5375
5606
  return true;
5376
5607
  }
5377
5608
  return false;
5378
5609
  }
5379
- function isIdentifier29(code) {
5610
+ function isIdentifier30(code) {
5380
5611
  try {
5381
5612
  const node = _parser.parseExpression.call(void 0, code);
5382
- return t50.isIdentifier(node);
5613
+ return t51.isIdentifier(node);
5383
5614
  } catch (e8) {
5384
5615
  return false;
5385
5616
  }
5386
5617
  }
5387
- function isStringLiteral13(code) {
5618
+ function isStringLiteral14(code) {
5388
5619
  try {
5389
5620
  const node = _parser.parseExpression.call(void 0, code);
5390
- return t50.isStringLiteral(node);
5621
+ return t51.isStringLiteral(node);
5391
5622
  } catch (e9) {
5392
5623
  return false;
5393
5624
  }
@@ -5497,12 +5728,12 @@ function wrapSingleQuotes(content, condition) {
5497
5728
  return condition || strCodeTypes.isStringLiteral(content) ? `'${content}'` : content;
5498
5729
  }
5499
5730
  function checkPropIsDynamicKey(ctx, node) {
5500
- const isKeyStatic = _optionalChain([node, 'access', _177 => _177.arg, 'optionalAccess', _178 => _178.isStatic]);
5731
+ const isKeyStatic = _optionalChain([node, 'access', _188 => _188.arg, 'optionalAccess', _189 => _189.isStatic]);
5501
5732
  const { source, filename } = ctx;
5502
5733
  if (node.rawName === "v-bind" && !node.name) {
5503
5734
  logger.warn("Keyless v-bind will overwrite all previously declared props at runtime.", {
5504
5735
  source,
5505
- loc: _optionalChain([node, 'access', _179 => _179.arg, 'optionalAccess', _180 => _180.loc]),
5736
+ loc: _optionalChain([node, 'access', _190 => _190.arg, 'optionalAccess', _191 => _191.loc]),
5506
5737
  file: filename
5507
5738
  });
5508
5739
  return;
@@ -5510,7 +5741,7 @@ function checkPropIsDynamicKey(ctx, node) {
5510
5741
  if (isKeyStatic === false) {
5511
5742
  logger.warn("Avoid using dynamic slot names, as they generate complex JSX prop expressions.", {
5512
5743
  source,
5513
- loc: _optionalChain([node, 'access', _181 => _181.arg, 'optionalAccess', _182 => _182.loc]),
5744
+ loc: _optionalChain([node, 'access', _192 => _192.arg, 'optionalAccess', _193 => _193.loc]),
5514
5745
  file: filename
5515
5746
  });
5516
5747
  }
@@ -5530,26 +5761,26 @@ function resolvePropAsBabelExp(ir, ctx) {
5530
5761
  const rule = ADAPTER_RULES.runtime;
5531
5762
  const setNameIdentifier = (target, valueName) => {
5532
5763
  target.content = valueName;
5533
- target.ast = t51.jsxIdentifier(valueName);
5764
+ target.ast = t52.jsxIdentifier(valueName);
5534
5765
  };
5535
- const setValueExpression = (target, content, isStringLiteral14) => {
5766
+ const setValueExpression = (target, content, isStringLiteral15) => {
5536
5767
  target.content = content;
5537
- target.ast = resolveStringExpr(content, ctx, isStringLiteral14);
5768
+ target.ast = resolveStringExpr(content, ctx, isStringLiteral15);
5538
5769
  };
5539
5770
  const createRuntimeCall = (fnName, args) => {
5540
5771
  const fnArgs = args.filter(Boolean).join(",");
5541
- const valIsUndef = fnName === rule.dirOn.target && _optionalChain([args, 'optionalAccess', _183 => _183[1]]) === "undefined";
5772
+ const valIsUndef = fnName === rule.dirOn.target && _optionalChain([args, 'optionalAccess', _194 => _194[1]]) === "undefined";
5542
5773
  const isTs = ctx.scriptData.lang.startsWith("ts");
5543
5774
  const safeTypeAssertion = isTs ? valIsUndef ? "as never" : "" : "";
5544
5775
  return `${fnName}(${fnArgs}) ${safeTypeAssertion}`;
5545
5776
  };
5546
- const applyRuntimeExpression = (expression, setName = false, nameIdentifier, isStringLiteral14) => {
5777
+ const applyRuntimeExpression = (expression, setName = false, nameIdentifier, isStringLiteral15) => {
5547
5778
  if (setName && nameIdentifier) {
5548
5779
  setNameIdentifier(nameExp, nameIdentifier);
5549
5780
  }
5550
5781
  const dir = rule.dir;
5551
5782
  recordImport(ctx, dir.package, dir.target);
5552
- setValueExpression(value.babelExp, expression, isStringLiteral14);
5783
+ setValueExpression(value.babelExp, expression, isStringLiteral15);
5553
5784
  };
5554
5785
  if (ir.isKeyLessVBind) {
5555
5786
  const dirKeyless = rule.dirKeyless;
@@ -5559,19 +5790,19 @@ function resolvePropAsBabelExp(ir, ctx) {
5559
5790
  }
5560
5791
  if (isClassAttr(name) && !value.isStringLiteral && !valueContent.startsWith(STYLE_MODULE_NAME)) {
5561
5792
  const dirCls = rule.dirCls;
5562
- const arg = _optionalChain([mergedItems, 'optionalAccess', _184 => _184.join, 'call', _185 => _185(",")]) || wrapSingleQuotes(valueContent);
5793
+ const arg = _optionalChain([mergedItems, 'optionalAccess', _195 => _195.join, 'call', _196 => _196(",")]) || wrapSingleQuotes(valueContent);
5563
5794
  const expression = createRuntimeCall(dirCls.target, [arg]);
5564
5795
  applyRuntimeExpression(expression, true, name);
5565
5796
  return;
5566
5797
  }
5567
- if (isStyleAttr(name) && (!isSimpleStyle(valueContent) || _optionalChain([mergedItems, 'optionalAccess', _186 => _186.some, 'call', _187 => _187((item) => !isSimpleStyle(item))]))) {
5798
+ if (isStyleAttr(name) && (!isSimpleStyle(valueContent) || _optionalChain([mergedItems, 'optionalAccess', _197 => _197.some, 'call', _198 => _198((item) => !isSimpleStyle(item))]))) {
5568
5799
  const dirStyle = rule.dirStyle;
5569
- const arg = _optionalChain([mergedItems, 'optionalAccess', _188 => _188.join, 'call', _189 => _189(",")]) || valueContent;
5800
+ const arg = _optionalChain([mergedItems, 'optionalAccess', _199 => _199.join, 'call', _200 => _200(",")]) || valueContent;
5570
5801
  const expression = createRuntimeCall(dirStyle.target, [arg]);
5571
5802
  applyRuntimeExpression(expression, true, name);
5572
5803
  return;
5573
5804
  }
5574
- if (ir.type === 3 /* EVENT */ && _optionalChain([ir, 'access', _190 => _190.modifiers, 'optionalAccess', _191 => _191.length])) {
5805
+ if (ir.type === 3 /* EVENT */ && _optionalChain([ir, 'access', _201 => _201.modifiers, 'optionalAccess', _202 => _202.length])) {
5575
5806
  const dirOn = rule.dirOn;
5576
5807
  const eventName = wrapSingleQuotes(ir.__vOnEvName || name, ir.isStatic);
5577
5808
  const expression = createRuntimeCall(dirOn.target, [eventName, valueContent]);
@@ -5626,7 +5857,7 @@ function resolveElementChildrenRules(children, ctx, parentIR, ir) {
5626
5857
  continue;
5627
5858
  }
5628
5859
  const nodeIR = child;
5629
- if (_optionalChain([parentIR, 'optionalAccess', _192 => _192.isBuiltIn])) {
5860
+ if (_optionalChain([parentIR, 'optionalAccess', _203 => _203.isBuiltIn])) {
5630
5861
  if (parentIR.tag == VUE_API_MAP.Transition) {
5631
5862
  resolveTransitionRules(nodeIR, parentIR, ir, ctx);
5632
5863
  }
@@ -5667,7 +5898,7 @@ function walkElementNodes(node, onElement) {
5667
5898
  }
5668
5899
  function resolveDefaultStyleModuleName(node) {
5669
5900
  const { exp } = node;
5670
- if (_optionalChain([exp, 'optionalAccess', _193 => _193.type]) !== _compilercore.NodeTypes.SIMPLE_EXPRESSION) {
5901
+ if (_optionalChain([exp, 'optionalAccess', _204 => _204.type]) !== _compilercore.NodeTypes.SIMPLE_EXPRESSION) {
5671
5902
  return;
5672
5903
  }
5673
5904
  if (exp.content.includes("$style")) {
@@ -5763,7 +5994,7 @@ function mergeStyleProps(oldAttr, newAttr) {
5763
5994
  const oldStyle = oldAttr.value.content;
5764
5995
  const newStyle = parseStyleString(newAttr.value.content);
5765
5996
  let merged = oldAttr.value.merge;
5766
- if (!_optionalChain([merged, 'optionalAccess', _194 => _194.length])) {
5997
+ if (!_optionalChain([merged, 'optionalAccess', _205 => _205.length])) {
5767
5998
  merged = oldAttr.value.merge = [oldStyle, newStyle];
5768
5999
  } else {
5769
6000
  merged.push(newStyle);
@@ -5793,7 +6024,7 @@ function warnUnsupportedVueDollarVar(ctx, node) {
5793
6024
  const { source, filename } = ctx;
5794
6025
  let value = "";
5795
6026
  let loc;
5796
- if (node.type === _compilercore.NodeTypes.DIRECTIVE && _optionalChain([node, 'access', _195 => _195.exp, 'optionalAccess', _196 => _196.type]) === _compilercore.NodeTypes.SIMPLE_EXPRESSION) {
6027
+ if (node.type === _compilercore.NodeTypes.DIRECTIVE && _optionalChain([node, 'access', _206 => _206.exp, 'optionalAccess', _207 => _207.type]) === _compilercore.NodeTypes.SIMPLE_EXPRESSION) {
5797
6028
  value = node.exp.content;
5798
6029
  loc = node.exp.loc;
5799
6030
  } else if (node.type === _compilercore.NodeTypes.INTERPOLATION && node.content.type === _compilercore.NodeTypes.SIMPLE_EXPRESSION) {
@@ -5847,11 +6078,11 @@ function resolveRefProp(prop, ctx, nodeIR) {
5847
6078
  } = ctx;
5848
6079
  let propIR;
5849
6080
  if (prop.type === _compilercore.NodeTypes.ATTRIBUTE) {
5850
- const tag = _optionalChain([prop, 'access', _197 => _197.value, 'optionalAccess', _198 => _198.content]);
6081
+ const tag = _optionalChain([prop, 'access', _208 => _208.value, 'optionalAccess', _209 => _209.content]);
5851
6082
  if (!tag) return;
5852
6083
  collectComponentRef(tag, ctx);
5853
6084
  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]);
6085
+ const refVar = _optionalChain([domRefBinding, 'optionalAccess', _210 => _210.name]) || _optionalChain([refBindings, 'access', _211 => _211.componentRefs, 'access', _212 => _212[tag], 'optionalAccess', _213 => _213.name]);
5855
6086
  propIR = createPropsIR("ref", "ref", refVar || "null");
5856
6087
  } else {
5857
6088
  const exp = prop.exp;
@@ -5903,7 +6134,7 @@ function resolveTemplateNodeKey(templNode, keyContent, ctx) {
5903
6134
  return;
5904
6135
  }
5905
6136
  const [firstChild] = children;
5906
- if (_optionalChain([firstChild, 'optionalAccess', _203 => _203.type]) !== _compilercore.NodeTypes.ELEMENT || firstChild.tagType === _compilercore.ElementTypes.TEMPLATE || firstChild.tagType === _compilercore.ElementTypes.SLOT) {
6137
+ if (_optionalChain([firstChild, 'optionalAccess', _214 => _214.type]) !== _compilercore.NodeTypes.ELEMENT || firstChild.tagType === _compilercore.ElementTypes.TEMPLATE || firstChild.tagType === _compilercore.ElementTypes.SLOT) {
5907
6138
  return;
5908
6139
  }
5909
6140
  const hasKeyProp = firstChild.props.some(
@@ -5940,8 +6171,8 @@ function createSimpleVueBind(name, value) {
5940
6171
  function resolveDynamicAttributeProp(directive, ir, ctx, vueNode, nodeIR) {
5941
6172
  const arg = directive.arg;
5942
6173
  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"));
6174
+ const name = _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _215 => _215.content]), () => ( ""));
6175
+ const content = _nullishCoalesce(_optionalChain([exp, 'optionalAccess', _216 => _216.content]), () => ( "true"));
5945
6176
  warnUnsupportedVueDollarVar(ctx, directive);
5946
6177
  if (name === "is") {
5947
6178
  resolveDynamicIsProp(directive, ir, ctx, nodeIR);
@@ -5956,7 +6187,7 @@ function resolveDynamicAttributeProp(directive, ir, ctx, vueNode, nodeIR) {
5956
6187
  return;
5957
6188
  }
5958
6189
  const propIR = createPropsIR(directive.rawName, name, content);
5959
- propIR.isStatic = _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _206 => _206.isStatic]), () => ( true));
6190
+ propIR.isStatic = _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _217 => _217.isStatic]), () => ( true));
5960
6191
  checkPropIsDynamicKey(ctx, directive);
5961
6192
  resolvePropertyIR(propIR, ir, ctx, nodeIR, true);
5962
6193
  }
@@ -5970,12 +6201,12 @@ function resolvePropertyIR(propsIR, ir, ctx, nodeIR, isDynamic = false) {
5970
6201
  content = propsIR.value.content = parseStyleString(content);
5971
6202
  }
5972
6203
  if (isDynamic) {
5973
- const isStringLiteral14 = strCodeTypes.isStringLiteral(content);
5974
- if (isStringLiteral14) {
6204
+ const isStringLiteral15 = strCodeTypes.isStringLiteral(content);
6205
+ if (isStringLiteral15) {
5975
6206
  content = normalizeString(content);
5976
6207
  propsIR.value.content = content;
5977
6208
  }
5978
- propsIR.value.isStringLiteral = isStringLiteral14;
6209
+ propsIR.value.isStringLiteral = isStringLiteral15;
5979
6210
  }
5980
6211
  const existing = findSameProp(nodeIR.props, propsIR);
5981
6212
  if (existing) {
@@ -5995,7 +6226,7 @@ function normalizeString(s) {
5995
6226
  // src/core/transform/sfc/template/syntax-processor/process/props/resolve-attribute-prop.ts
5996
6227
  function resolveAttributeProp(attribute, ir, ctx, nodeIR) {
5997
6228
  const name = attribute.name;
5998
- const content = _nullishCoalesce(_optionalChain([attribute, 'access', _207 => _207.value, 'optionalAccess', _208 => _208.content]), () => ( "true"));
6229
+ const content = _nullishCoalesce(_optionalChain([attribute, 'access', _218 => _218.value, 'optionalAccess', _219 => _219.content]), () => ( "true"));
5999
6230
  if (name === "is") {
6000
6231
  resolveStaticIsProp(content, ir, ctx, nodeIR);
6001
6232
  return;
@@ -6090,10 +6321,10 @@ function resolveRouterLinkVSlotProp(directive, nodeIR, ctx) {
6090
6321
  type: 2 /* SLOT */,
6091
6322
  name: "customRender",
6092
6323
  rawName: _nullishCoalesce(directive.rawName, () => ( "v-slot")),
6093
- isStatic: _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _209 => _209.isStatic]), () => ( true)),
6324
+ isStatic: _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _220 => _220.isStatic]), () => ( true)),
6094
6325
  isScoped: true,
6095
6326
  callback: {
6096
- arg: _nullishCoalesce(_optionalChain([exp, 'optionalAccess', _210 => _210.content, 'optionalAccess', _211 => _211.trim, 'call', _212 => _212()]), () => ( "")),
6327
+ arg: _nullishCoalesce(_optionalChain([exp, 'optionalAccess', _221 => _221.content, 'optionalAccess', _222 => _222.trim, 'call', _223 => _223()]), () => ( "")),
6097
6328
  exp: []
6098
6329
  }
6099
6330
  };
@@ -6109,10 +6340,10 @@ function resolveVFor(directive, ir, ctx, nodeIR) {
6109
6340
  };
6110
6341
  }
6111
6342
  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]);
6343
+ const source = _optionalChain([forParseResult, 'access', _224 => _224.source, 'optionalAccess', _225 => _225.content]);
6344
+ const value = _optionalChain([forParseResult, 'access', _226 => _226.value, 'optionalAccess', _227 => _227.content]);
6345
+ const index = _optionalChain([forParseResult, 'access', _228 => _228.index, 'optionalAccess', _229 => _229.content]);
6346
+ const key = _optionalChain([forParseResult, 'access', _230 => _230.key, 'optionalAccess', _231 => _231.content]);
6116
6347
  return {
6117
6348
  source,
6118
6349
  value,
@@ -6132,7 +6363,7 @@ function resolveVHtml(directive, ir, ctx, nodeIR) {
6132
6363
  // src/core/transform/sfc/template/syntax-processor/process/props/resolve-v-if.ts
6133
6364
  function resolveVIf(directive, ir, ctx, nodeIR, siblingNodesIR) {
6134
6365
  const name = directive.name === "else-if" ? "elseIf" : directive.name;
6135
- const value = _nullishCoalesce(_optionalChain([directive, 'access', _221 => _221.exp, 'optionalAccess', _222 => _222.content]), () => ( "true"));
6366
+ const value = _nullishCoalesce(_optionalChain([directive, 'access', _232 => _232.exp, 'optionalAccess', _233 => _233.content]), () => ( "true"));
6136
6367
  const prevNode = siblingNodesIR[siblingNodesIR.length - 1];
6137
6368
  const isElseBranch = name === "else" || name === "elseIf";
6138
6369
  let hasError = false;
@@ -6171,7 +6402,7 @@ function resolveVIf(directive, ir, ctx, nodeIR, siblingNodesIR) {
6171
6402
  // src/core/transform/sfc/template/syntax-processor/process/props/resolve-v-memo.ts
6172
6403
  function resolveVMemo(directive, _ir, ctx, nodeIR) {
6173
6404
  const exp = directive.exp;
6174
- let value = _optionalChain([exp, 'optionalAccess', _223 => _223.content]);
6405
+ let value = _optionalChain([exp, 'optionalAccess', _234 => _234.content]);
6175
6406
  if (value !== void 0) {
6176
6407
  if (!value.trim() || !value.startsWith("[") && !value.endsWith("]")) {
6177
6408
  const { source, filename } = ctx;
@@ -6211,14 +6442,14 @@ function resolveVModel(directive, ir, ctx, vueNode, nodeIR) {
6211
6442
  const getterName = exp.content;
6212
6443
  const isComponent = vueNode.tagType === _compilercore.ElementTypes.COMPONENT;
6213
6444
  const inputType = resolveHtmlInput(vueNode, isComponent);
6214
- const propName = _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _224 => _224.content]), () => ( resolveModelPropName(inputType, isComponent)));
6445
+ const propName = _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _235 => _235.content]), () => ( resolveModelPropName(inputType, isComponent)));
6215
6446
  let valuePropIR;
6216
6447
  let eventPropIR;
6217
6448
  if (isComponent) {
6218
6449
  valuePropIR = createPropsIR("v-model", propName, getterName);
6219
6450
  const eventReactName = `onUpdate${capitalize(camelCase(propName))}`;
6220
6451
  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")]);
6452
+ const isTS = _optionalChain([ctx, 'access', _236 => _236.scriptData, 'optionalAccess', _237 => _237.lang, 'optionalAccess', _238 => _238.startsWith, 'call', _239 => _239("ts")]);
6222
6453
  const valueArg = isTS ? "value: any" : "value";
6223
6454
  const processedValue = applyValueModifiers("value", modifiers);
6224
6455
  const handlerBody = `(${valueArg}) => { ${getterName} = ${processedValue} }`;
@@ -6256,7 +6487,7 @@ function getRadioValue(vueNode) {
6256
6487
  const valueAttr = vueNode.props.find(
6257
6488
  (prop) => prop.type === _compilercore.NodeTypes.ATTRIBUTE && prop.name === "value"
6258
6489
  );
6259
- if (!_optionalChain([valueAttr, 'optionalAccess', _229 => _229.value, 'optionalAccess', _230 => _230.content])) return '""';
6490
+ if (!_optionalChain([valueAttr, 'optionalAccess', _240 => _240.value, 'optionalAccess', _241 => _241.content])) return '""';
6260
6491
  const content = valueAttr.value.content;
6261
6492
  return /^['"]/.test(content) ? content : `"${content}"`;
6262
6493
  }
@@ -6266,7 +6497,7 @@ function resolveHtmlInput(node, isComponent) {
6266
6497
  const typeProp = node.props.find(
6267
6498
  (prop) => prop.type === _compilercore.NodeTypes.ATTRIBUTE && prop.name === "type"
6268
6499
  );
6269
- return _optionalChain([typeProp, 'optionalAccess', _231 => _231.value, 'optionalAccess', _232 => _232.content, 'optionalAccess', _233 => _233.toLowerCase, 'call', _234 => _234()]);
6500
+ return _optionalChain([typeProp, 'optionalAccess', _242 => _242.value, 'optionalAccess', _243 => _243.content, 'optionalAccess', _244 => _244.toLowerCase, 'call', _245 => _245()]);
6270
6501
  }
6271
6502
  function applyValueModifiers(valueExp, modifiers) {
6272
6503
  let result = valueExp;
@@ -6287,7 +6518,7 @@ function resolveVOn(directive, ir, ctx, nodeIR) {
6287
6518
  const modifiers = directive.modifiers.map((item) => item.content);
6288
6519
  const captureIndex = resolveCaptureModifier(modifiers);
6289
6520
  const eventName = resolveEventName(arg.content, captureIndex);
6290
- const handlerContent = _optionalChain([exp, 'optionalAccess', _235 => _235.content, 'optionalAccess', _236 => _236.trim, 'call', _237 => _237()]) || "undefined";
6521
+ const handlerContent = _optionalChain([exp, 'optionalAccess', _246 => _246.content, 'optionalAccess', _247 => _247.trim, 'call', _248 => _248()]) || "undefined";
6291
6522
  const handler = resolveHandler(handlerContent, ctx, modifiers);
6292
6523
  const originalVueEventName = modifiers.length ? `${arg.content}.${modifiers.join(".")}` : "";
6293
6524
  const eventIR = createPropsIR(directive.rawName, eventName, handler);
@@ -6338,10 +6569,10 @@ function resolveHandler(handlerContent, ctx, modifiers) {
6338
6569
  return handler;
6339
6570
  }
6340
6571
  function isConsoleCall(expr) {
6341
- return t52.isCallExpression(expr) && t52.isMemberExpression(expr.callee) && t52.isIdentifier(expr.callee.object) && expr.callee.object.name === "console";
6572
+ return t53.isCallExpression(expr) && t53.isMemberExpression(expr.callee) && t53.isIdentifier(expr.callee.object) && expr.callee.object.name === "console";
6342
6573
  }
6343
6574
  function isFnReference(expr) {
6344
- return t52.isIdentifier(expr) || t52.isMemberExpression(expr) || t52.isFunction(expr);
6575
+ return t53.isIdentifier(expr) || t53.isMemberExpression(expr) || t53.isFunction(expr);
6345
6576
  }
6346
6577
 
6347
6578
  // src/core/transform/sfc/template/syntax-processor/process/props/resolve-v-show.ts
@@ -6374,7 +6605,7 @@ function resolveVSlotProp(directive, ir, ctx) {
6374
6605
  const name = !arg || arg.content === "default" ? "children" : arg.content;
6375
6606
  const content = !isScoped ? [] : void 0;
6376
6607
  const callback = isScoped ? {
6377
- arg: _nullishCoalesce(_optionalChain([exp, 'optionalAccess', _238 => _238.content, 'optionalAccess', _239 => _239.trim, 'call', _240 => _240()]), () => ( "")),
6608
+ arg: _nullishCoalesce(_optionalChain([exp, 'optionalAccess', _249 => _249.content, 'optionalAccess', _250 => _250.trim, 'call', _251 => _251()]), () => ( "")),
6378
6609
  exp: []
6379
6610
  } : void 0;
6380
6611
  checkPropIsDynamicKey(ctx, directive);
@@ -6382,7 +6613,7 @@ function resolveVSlotProp(directive, ir, ctx) {
6382
6613
  type: 2 /* SLOT */,
6383
6614
  name,
6384
6615
  rawName: _nullishCoalesce(directive.rawName, () => ( "default")),
6385
- isStatic: _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _241 => _241.isStatic]), () => ( true)),
6616
+ isStatic: _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _252 => _252.isStatic]), () => ( true)),
6386
6617
  isScoped,
6387
6618
  content,
6388
6619
  callback
@@ -6445,7 +6676,7 @@ function resolveElementNode(node, ir, ctx, siblingNodesIR) {
6445
6676
  if (routerAdapter) {
6446
6677
  if (!ctx.route) ctx.route = true;
6447
6678
  nodeIR.isRoute = true;
6448
- recordImport(ctx, _optionalChain([routerAdapter, 'optionalAccess', _242 => _242.package]), routerAdapter.target);
6679
+ recordImport(ctx, _optionalChain([routerAdapter, 'optionalAccess', _253 => _253.package]), routerAdapter.target);
6449
6680
  }
6450
6681
  resolveProps(node, ir, ctx, nodeIR, siblingNodesIR);
6451
6682
  return nodeIR;
@@ -6589,7 +6820,7 @@ function resolveSlotProps(node, ctx) {
6589
6820
  for (const prop of node.props) {
6590
6821
  if (prop.type === _compilercore.NodeTypes.ATTRIBUTE) {
6591
6822
  const attr = prop.name;
6592
- const value = _optionalChain([prop, 'access', _243 => _243.value, 'optionalAccess', _244 => _244.content, 'access', _245 => _245.trim, 'call', _246 => _246()]);
6823
+ const value = _optionalChain([prop, 'access', _254 => _254.value, 'optionalAccess', _255 => _255.content, 'access', _256 => _256.trim, 'call', _257 => _257()]);
6593
6824
  if (attr === "name" && value) {
6594
6825
  result.name = camelCase(value);
6595
6826
  } else {
@@ -6612,7 +6843,7 @@ function resolveSlotProps(node, ctx) {
6612
6843
  });
6613
6844
  }
6614
6845
  const key = arg.content;
6615
- const value = _optionalChain([exp, 'optionalAccess', _247 => _247.content, 'optionalAccess', _248 => _248.trim, 'call', _249 => _249()]) || "undefined";
6846
+ const value = _optionalChain([exp, 'optionalAccess', _258 => _258.content, 'optionalAccess', _259 => _259.trim, 'call', _260 => _260()]) || "undefined";
6616
6847
  if (key === "name") {
6617
6848
  result.name = camelCase(value);
6618
6849
  } else {
@@ -6682,19 +6913,19 @@ function resolveTemplate2(root, ctx) {
6682
6913
  // src/core/transform/sfc/index.ts
6683
6914
  function transform(ast, ctx, options) {
6684
6915
  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);
6916
+ const templateIR = resolveTemplate2(_optionalChain([template, 'optionalAccess', _261 => _261.ast]), ctx);
6917
+ const scriptIR = resolveScript2(_optionalChain([script, 'optionalAccess', _262 => _262.ast]), ctx);
6687
6918
  const result = {
6688
6919
  template: templateIR,
6689
6920
  script: scriptIR,
6690
- style: _optionalChain([style, 'optionalAccess', _252 => _252.source, 'optionalAccess', _253 => _253.content])
6921
+ style: _optionalChain([style, 'optionalAccess', _263 => _263.source, 'optionalAccess', _264 => _264.content])
6691
6922
  };
6692
- executePlugins(_optionalChain([options, 'optionalAccess', _254 => _254.plugins]), result, ctx);
6923
+ executePlugins(_optionalChain([options, 'optionalAccess', _265 => _265.plugins]), result, ctx);
6693
6924
  return result;
6694
6925
  }
6695
6926
 
6696
6927
  // package.json
6697
- var version = "1.8.5";
6928
+ var version = "1.9.0";
6698
6929
  var bin = {
6699
6930
  vureact: "bin/vureact.js"
6700
6931
  };
@@ -6879,7 +7110,7 @@ var Helper = (_class5 = class {
6879
7110
  __init8() {this.outDir = "react-app"}
6880
7111
  constructor(opts) {;_class5.prototype.__init7.call(this);_class5.prototype.__init8.call(this);
6881
7112
  this.compilerOpts = opts;
6882
- if (_optionalChain([opts, 'access', _255 => _255.output, 'optionalAccess', _256 => _256.workspace])) {
7113
+ if (_optionalChain([opts, 'access', _266 => _266.output, 'optionalAccess', _267 => _267.workspace])) {
6883
7114
  this.workspaceDir = opts.output.workspace;
6884
7115
  }
6885
7116
  const excludePatterns = PathFilter.withDefaults(opts.exclude || []);
@@ -6909,7 +7140,7 @@ var Helper = (_class5 = class {
6909
7140
  }
6910
7141
  getOutDirName() {
6911
7142
  const { output } = this.compilerOpts;
6912
- return _optionalChain([output, 'optionalAccess', _257 => _257.outDir]) || this.outDir;
7143
+ return _optionalChain([output, 'optionalAccess', _268 => _268.outDir]) || this.outDir;
6913
7144
  }
6914
7145
  getWorkspaceDir() {
6915
7146
  return _path2.default.resolve(this.getProjectRoot(), this.workspaceDir);
@@ -6923,7 +7154,7 @@ var Helper = (_class5 = class {
6923
7154
  }
6924
7155
  getIgnoreAssets() {
6925
7156
  const { output } = this.compilerOpts;
6926
- if (_optionalChain([output, 'optionalAccess', _258 => _258.ignoreAssets])) {
7157
+ if (_optionalChain([output, 'optionalAccess', _269 => _269.ignoreAssets])) {
6927
7158
  return new Set(output.ignoreAssets.map(normalizePath));
6928
7159
  }
6929
7160
  return /* @__PURE__ */ new Set([
@@ -7013,12 +7244,12 @@ var Helper = (_class5 = class {
7013
7244
  */
7014
7245
  async formatCode({ code, fileInfo }) {
7015
7246
  const { format } = this.compilerOpts;
7016
- if (!_optionalChain([format, 'optionalAccess', _259 => _259.enabled])) return code;
7017
- if (_optionalChain([format, 'optionalAccess', _260 => _260.formatter]) === "builtin") {
7247
+ if (!_optionalChain([format, 'optionalAccess', _270 => _270.enabled])) return code;
7248
+ if (_optionalChain([format, 'optionalAccess', _271 => _271.formatter]) === "builtin") {
7018
7249
  return simpleFormat(code);
7019
7250
  }
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]));
7251
+ const { lang } = _nullishCoalesce(_optionalChain([fileInfo, 'optionalAccess', _272 => _272.jsx]), () => ( _optionalChain([fileInfo, 'optionalAccess', _273 => _273.script])));
7252
+ return await formatWithPrettier(code, lang, _optionalChain([format, 'optionalAccess', _274 => _274.prettierOptions]));
7022
7253
  }
7023
7254
  /**
7024
7255
  * 通用的缓存校验工具函数
@@ -7052,7 +7283,7 @@ var Helper = (_class5 = class {
7052
7283
  * @param options.lock - 是否启用文件锁(默认false)
7053
7284
  */
7054
7285
  async writeFileWithDir(filePath, content, options) {
7055
- if (_optionalChain([options, 'optionalAccess', _264 => _264.lock])) {
7286
+ if (_optionalChain([options, 'optionalAccess', _275 => _275.lock])) {
7056
7287
  await fileLock.updateFile(filePath, async () => content, options);
7057
7288
  } else {
7058
7289
  await _fs2.default.promises.mkdir(_path2.default.dirname(filePath), { recursive: true });
@@ -7097,7 +7328,7 @@ var Helper = (_class5 = class {
7097
7328
  * 获取需要排除编译的文件
7098
7329
  */
7099
7330
  getExcludes() {
7100
- if (!_optionalChain([this, 'access', _265 => _265.compilerOpts, 'access', _266 => _266.exclude, 'optionalAccess', _267 => _267.length])) {
7331
+ if (!_optionalChain([this, 'access', _276 => _276.compilerOpts, 'access', _277 => _277.exclude, 'optionalAccess', _278 => _278.length])) {
7101
7332
  return PathFilter.withDefaults();
7102
7333
  }
7103
7334
  return this.compilerOpts.exclude;
@@ -7188,7 +7419,7 @@ function parseOnlyStyle(source, ctx, options) {
7188
7419
  ast: void 0
7189
7420
  }
7190
7421
  };
7191
- executePlugins(_optionalChain([options, 'optionalAccess', _268 => _268.plugins]), result, ctx);
7422
+ executePlugins(_optionalChain([options, 'optionalAccess', _279 => _279.plugins]), result, ctx);
7192
7423
  return result;
7193
7424
  }
7194
7425
 
@@ -7248,7 +7479,8 @@ var CompilationContext = (_class6 = class {constructor() { _class6.prototype.__i
7248
7479
  refField: "expose"
7249
7480
  },
7250
7481
  declaredOptions: {},
7251
- source: ""
7482
+ source: "",
7483
+ __vureact_script_block_ir: void 0
7252
7484
  },
7253
7485
  styleData: {
7254
7486
  filePath: ""
@@ -7322,16 +7554,16 @@ var BaseCompiler = (_class7 = class extends Helper {
7322
7554
  });
7323
7555
  const genOptions = this.prepareGenerateOptions(filename);
7324
7556
  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]) });
7557
+ const ast = parse(source, ctx.data, { plugins: _optionalChain([plugins, 'optionalAccess', _280 => _280.parser]) });
7558
+ const ir = transform(ast, ctx.data, { plugins: _optionalChain([plugins, 'optionalAccess', _281 => _281.transformer]) });
7327
7559
  const gen = generate(ir, ctx.data, {
7328
7560
  ...genOptions,
7329
- plugins: _optionalChain([plugins, 'optionalAccess', _271 => _271.codegen])
7561
+ plugins: _optionalChain([plugins, 'optionalAccess', _282 => _282.codegen])
7330
7562
  });
7331
7563
  return this.resolveMainResult(ir, gen, ctx.data);
7332
7564
  };
7333
7565
  const resolveStyleFile = () => {
7334
- const result = parseOnlyStyle(source, ctx.data, { plugins: _optionalChain([plugins, 'optionalAccess', _272 => _272.parser]) });
7566
+ const result = parseOnlyStyle(source, ctx.data, { plugins: _optionalChain([plugins, 'optionalAccess', _283 => _283.parser]) });
7335
7567
  return this.resolveStyleResult(result, ctx.data);
7336
7568
  };
7337
7569
  try {
@@ -7370,9 +7602,9 @@ var BaseCompiler = (_class7 = class extends Helper {
7370
7602
  lang
7371
7603
  },
7372
7604
  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])
7605
+ file: _optionalChain([styleData, 'optionalAccess', _284 => _284.filePath]),
7606
+ hash: _optionalChain([styleData, 'optionalAccess', _285 => _285.scopeId]),
7607
+ code: _optionalChain([ir, 'optionalAccess', _286 => _286.style])
7376
7608
  }
7377
7609
  },
7378
7610
  ...base
@@ -7522,12 +7754,12 @@ var CacheManager = (_class9 = class {
7522
7754
  const meta = { ...unit };
7523
7755
  delete meta.source;
7524
7756
  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]);
7757
+ _optionalChainDelete([meta, 'access', _287 => _287.output, 'optionalAccess', _288 => _288.jsx, 'access', _289 => delete _289.code]);
7758
+ _optionalChainDelete([meta, 'access', _290 => _290.output, 'optionalAccess', _291 => _291.css, 'access', _292 => delete _292.code]);
7527
7759
  } else if (key === "script" /* SCRIPT */) {
7528
- _optionalChainDelete([meta, 'access', _282 => _282.output, 'optionalAccess', _283 => _283.script, 'access', _284 => delete _284.code]);
7760
+ _optionalChainDelete([meta, 'access', _293 => _293.output, 'optionalAccess', _294 => _294.script, 'access', _295 => delete _295.code]);
7529
7761
  } else if (key === "style" /* STYLE */) {
7530
- _optionalChainDelete([meta, 'access', _285 => _285.output, 'optionalAccess', _286 => _286.style, 'access', _287 => delete _287.code]);
7762
+ _optionalChainDelete([meta, 'access', _296 => _296.output, 'optionalAccess', _297 => _297.style, 'access', _298 => delete _298.code]);
7531
7763
  }
7532
7764
  if (!this.pendingUpdates.has(key)) {
7533
7765
  this.pendingUpdates.set(key, []);
@@ -7547,7 +7779,7 @@ var CacheManager = (_class9 = class {
7547
7779
  }
7548
7780
  for (const key of keys) {
7549
7781
  const updates = this.pendingUpdates.get(key);
7550
- if (!_optionalChain([updates, 'optionalAccess', _288 => _288.length])) continue;
7782
+ if (!_optionalChain([updates, 'optionalAccess', _299 => _299.length])) continue;
7551
7783
  const entries = [...this.cachedData[key] || []];
7552
7784
  updates.forEach(({ unit, meta }) => {
7553
7785
  const idx = entries.findIndex((c) => c.file === unit.file);
@@ -7708,7 +7940,7 @@ var CleanupManager = class {
7708
7940
  const sfcMeta = meta;
7709
7941
  const { jsx, css } = sfcMeta.output;
7710
7942
  await this.fileCompiler.removeOutputFile(jsx.file);
7711
- if (_optionalChain([css, 'optionalAccess', _289 => _289.file])) {
7943
+ if (_optionalChain([css, 'optionalAccess', _300 => _300.file])) {
7712
7944
  await this.fileCompiler.removeOutputFile(css.file);
7713
7945
  }
7714
7946
  break;
@@ -7764,7 +7996,7 @@ var CompilationUnitProcessor = class {
7764
7996
  const isScriptFile = key === "script" /* SCRIPT */;
7765
7997
  const isStyleFile = key === "style" /* STYLE */;
7766
7998
  if (isSFC || isScriptFile) {
7767
- unit.hasRoute = _optionalChain([result, 'optionalAccess', _290 => _290.hasRoute]);
7999
+ unit.hasRoute = _optionalChain([result, 'optionalAccess', _301 => _301.hasRoute]);
7768
8000
  }
7769
8001
  const resolveFileInfo = () => {
7770
8002
  if (isSFC) {
@@ -7784,7 +8016,7 @@ var CompilationUnitProcessor = class {
7784
8016
  const { script } = result.fileInfo;
7785
8017
  unit.output = {
7786
8018
  script: {
7787
- file: _optionalChain([script, 'optionalAccess', _291 => _291.file]),
8019
+ file: _optionalChain([script, 'optionalAccess', _302 => _302.file]),
7788
8020
  code
7789
8021
  }
7790
8022
  };
@@ -7861,7 +8093,7 @@ var FileProcessor = (_class10 = class {
7861
8093
  const absPath = this.fileCompiler.getAbsPath(filePath);
7862
8094
  const fileMeta = await this.fileCompiler.getFileMeta(absPath);
7863
8095
  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)]);
8096
+ const record = _optionalChain([cache, 'optionalAccess', _303 => _303.target, 'access', _304 => _304.find, 'call', _305 => _305((c) => c.file === absPath)]);
7865
8097
  const { shouldCompile, hash } = await this.fileCompiler.checkCacheStatus(
7866
8098
  fileMeta,
7867
8099
  record,
@@ -7883,10 +8115,10 @@ var FileProcessor = (_class10 = class {
7883
8115
  hash: hash || this.fileCompiler.genHash(source)
7884
8116
  };
7885
8117
  const processed = await this.compilationUnitProcessor.resolve(initUnit, key);
7886
- if (_optionalChain([processed, 'optionalAccess', _295 => _295.output])) {
8118
+ if (_optionalChain([processed, 'optionalAccess', _306 => _306.output])) {
7887
8119
  await this.compilationUnitProcessor.saveCompiledFiles(processed, key);
7888
8120
  if (key === "sfc" /* SFC */ || key === "script" /* SCRIPT */) {
7889
- if (_optionalChain([processed, 'optionalAccess', _296 => _296.hasRoute])) {
8121
+ if (_optionalChain([processed, 'optionalAccess', _307 => _307.hasRoute])) {
7890
8122
  await this.addRouterToPackageJson();
7891
8123
  await this.updateEntryWithRouterProvider();
7892
8124
  }
@@ -7903,13 +8135,13 @@ var FileProcessor = (_class10 = class {
7903
8135
  */
7904
8136
  async addRouterToPackageJson() {
7905
8137
  const { output } = this.fileCompiler.options;
7906
- if (_optionalChain([output, 'optionalAccess', _297 => _297.bootstrapVite]) === false) {
8138
+ if (_optionalChain([output, 'optionalAccess', _308 => _308.bootstrapVite]) === false) {
7907
8139
  return;
7908
8140
  }
7909
8141
  const { router } = RUNTIME_PACKAGES;
7910
8142
  const filePath = this.fileCompiler.getOutputPkgPath();
7911
8143
  const packageJson = await this.fileCompiler.resolvePackageFile(filePath);
7912
- if (_optionalChain([packageJson, 'optionalAccess', _298 => _298.dependencies, 'optionalAccess', _299 => _299[router.name]])) {
8144
+ if (_optionalChain([packageJson, 'optionalAccess', _309 => _309.dependencies, 'optionalAccess', _310 => _310[router.name]])) {
7913
8145
  return;
7914
8146
  }
7915
8147
  if (!packageJson.dependencies) {
@@ -7928,7 +8160,7 @@ var FileProcessor = (_class10 = class {
7928
8160
  const { exclude, output, router } = this.fileCompiler.options;
7929
8161
  const inputPath = this.fileCompiler.getInputPath();
7930
8162
  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])) {
8163
+ if (_optionalChain([output, 'optionalAccess', _311 => _311.bootstrapVite]) === false || _optionalChain([router, 'optionalAccess', _312 => _312.autoUpdateEntry]) === false || !_optionalChain([router, 'optionalAccess', _313 => _313.configFile])) {
7932
8164
  return;
7933
8165
  }
7934
8166
  const getMainFile = async (filename) => {
@@ -7949,7 +8181,7 @@ var FileProcessor = (_class10 = class {
7949
8181
  const prepareRouterEntry = () => {
7950
8182
  const importPath = this.fileCompiler.resolveRelativePath(inputPath, router.configFile);
7951
8183
  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)])) {
8184
+ if (_optionalChain([exclude, 'optionalAccess', _314 => _314.includes, 'call', _315 => _315(router.configFile)]) || _optionalChain([exclude, 'optionalAccess', _316 => _316.includes, 'call', _317 => _317(importPath)])) {
7953
8185
  return content;
7954
8186
  }
7955
8187
  const routerModule = "RouterInstance";
@@ -8056,7 +8288,7 @@ ${routerImport}`);
8056
8288
  const resolvedPath = normalizePath(fileCompiler.relativePath(input));
8057
8289
  const baseName = _path2.default.basename(input).toLowerCase();
8058
8290
  const exclusions = fileCompiler.getIgnoreAssets();
8059
- if (!_optionalChain([fileCompiler, 'access', _307 => _307.options, 'access', _308 => _308.output, 'optionalAccess', _309 => _309.ignoreAssets])) {
8291
+ if (!_optionalChain([fileCompiler, 'access', _318 => _318.options, 'access', _319 => _319.output, 'optionalAccess', _320 => _320.ignoreAssets])) {
8060
8292
  const shouldExclude = Array.from(exclusions).some((pattern) => {
8061
8293
  if (pattern.endsWith(".")) {
8062
8294
  return baseName.startsWith(pattern);
@@ -8192,7 +8424,7 @@ var ViteBootstrapper = (_class12 = class {
8192
8424
  const { output } = this.options;
8193
8425
  const workspaceDir = this.fileCompiler.getWorkspaceDir();
8194
8426
  await _fs2.default.promises.mkdir(workspaceDir, { recursive: true });
8195
- if (_optionalChain([output, 'optionalAccess', _310 => _310.bootstrapVite]) === false) {
8427
+ if (_optionalChain([output, 'optionalAccess', _321 => _321.bootstrapVite]) === false) {
8196
8428
  return false;
8197
8429
  }
8198
8430
  if (this.isSingleFile()) {
@@ -8232,7 +8464,7 @@ var ViteBootstrapper = (_class12 = class {
8232
8464
  const newDevDeps = resolveDeps(sourcePkg.devDependencies, newPkg.devDependencies, true);
8233
8465
  newPkg.dependencies = newDeps;
8234
8466
  newPkg.devDependencies = newDevDeps;
8235
- newPkg = _optionalChain([output, 'optionalAccess', _311 => _311.packageJson, 'optionalCall', _312 => _312(newPkg)]) || newPkg;
8467
+ newPkg = _optionalChain([output, 'optionalAccess', _322 => _322.packageJson, 'optionalCall', _323 => _323(newPkg)]) || newPkg;
8236
8468
  await this.fileCompiler.writeFileWithDir(outputPkgPath, JSON.stringify(newPkg, null, 2));
8237
8469
  this.spinner.succeed("Vite React environment initialized");
8238
8470
  return true;
@@ -8243,12 +8475,12 @@ var ViteBootstrapper = (_class12 = class {
8243
8475
  async resolveViteCreateApp() {
8244
8476
  const { output } = this.options;
8245
8477
  const { viteVersion, template: tmpl } = this.defaultConfig;
8246
- const bootstrapVite = _optionalChain([output, 'optionalAccess', _313 => _313.bootstrapVite]);
8478
+ const bootstrapVite = _optionalChain([output, 'optionalAccess', _324 => _324.bootstrapVite]);
8247
8479
  const outDirName = this.fileCompiler.getOutDirName();
8248
8480
  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;
8481
+ const viteVer = _optionalChain([configObject, 'optionalAccess', _325 => _325.vite]) || viteVersion;
8482
+ const reactVer = _optionalChain([configObject, 'optionalAccess', _326 => _326.react]);
8483
+ const template = _optionalChain([configObject, 'optionalAccess', _327 => _327.template]) || tmpl;
8252
8484
  const cmd = `npm create vite${viteVer} ${outDirName} -- --template ${template}`;
8253
8485
  _child_process.execSync.call(void 0, cmd, {
8254
8486
  cwd: this.fileCompiler.getWorkspaceDir(),
@@ -8384,7 +8616,7 @@ var FileCompiler = (_class13 = class extends BaseCompiler {
8384
8616
  const assetCount = await assetManager.runAsset(scanFiles.assets, cacheMap);
8385
8617
  this.updateSpinner("Almost done...");
8386
8618
  await cacheManager.flushAllCache();
8387
- await _optionalChain([this, 'access', _317 => _317.options, 'access', _318 => _318.onSuccess, 'optionalCall', _319 => _319()]);
8619
+ await _optionalChain([this, 'access', _328 => _328.options, 'access', _329 => _329.onSuccess, 'optionalCall', _330 => _330()]);
8388
8620
  const endTime = calcElapsedTime(startTime);
8389
8621
  this.printCoreLogs();
8390
8622
  this.showCompileStats(endTime, sfcCount, scriptCount, styleCount, assetCount);