@vureact/compiler-core 1.8.4 → 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.4
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) => {
@@ -1180,26 +1181,38 @@ function buildCtxProviderNode(nodeIR, ctx, children) {
1180
1181
 
1181
1182
  // src/core/codegen/component/jsx/syntax-processor/postprocess/build-root-jsx.ts
1182
1183
  function buildRootJsxProcessor(nodeIR, ctx, state) {
1183
- if (!state.rootChildren.length) {
1184
- state.result = null;
1184
+ const { rootChildren } = state;
1185
+ const { provide } = ctx.scriptData;
1186
+ const hasProvide = provide.isOccupied;
1187
+ const hasChildren = rootChildren.length > 0;
1188
+ const setResult = (elem) => {
1189
+ state.result = _nullishCoalesce(elem, () => ( null));
1190
+ };
1191
+ if (hasProvide) {
1192
+ const provider = buildCtxProviderNode(provide, ctx, rootChildren);
1193
+ if (!hasChildren) {
1194
+ setResult(buildFragmentNode([provider]));
1195
+ } else {
1196
+ setResult(provider);
1197
+ }
1185
1198
  return;
1186
1199
  }
1187
- const { provide } = ctx.scriptData;
1188
- if (provide.isOccupied) {
1189
- state.result = buildCtxProviderNode(provide, ctx, state.rootChildren);
1200
+ if (!hasChildren) {
1201
+ setResult();
1190
1202
  return;
1191
1203
  }
1192
- state.result = buildFragmentNode(state.rootChildren);
1204
+ setResult(buildFragmentNode(rootChildren));
1193
1205
  void nodeIR;
1194
1206
  }
1195
1207
 
1196
1208
  // src/core/codegen/component/jsx/syntax-processor/index.ts
1197
1209
  function buildJSXChild(nodeIR, ctx) {
1210
+ const templateIR = nodeIR || { children: [] };
1198
1211
  const state = {
1199
1212
  rootChildren: [],
1200
1213
  result: null
1201
1214
  };
1202
- jsxBuilder(nodeIR, ctx, state, {
1215
+ jsxBuilder(templateIR, ctx, state, {
1203
1216
  preprocess: [],
1204
1217
  process: [buildJsxChildrenProcessor],
1205
1218
  postprocess: [buildRootJsxProcessor]
@@ -1217,7 +1230,7 @@ function jsxBuilder(nodeIR, ctx, state, options) {
1217
1230
 
1218
1231
  // src/core/codegen/component/jsx/index.ts
1219
1232
  function buildJSX(nodeIR, ctx) {
1220
- if (!_optionalChain([nodeIR, 'optionalAccess', _32 => _32.children, 'access', _33 => _33.length])) {
1233
+ if (!_optionalChain([nodeIR, 'optionalAccess', _36 => _36.children, 'access', _37 => _37.length]) && ctx.inputType !== "sfc") {
1221
1234
  return null;
1222
1235
  }
1223
1236
  return buildJSXChild(nodeIR, ctx);
@@ -1254,6 +1267,7 @@ var REACT_API_MAP = {
1254
1267
  memo: "memo",
1255
1268
  useRef: "useRef",
1256
1269
  useMemo: "useMemo",
1270
+ useEffect: "useEffect",
1257
1271
  ReactNode: "ReactNode",
1258
1272
  forwardRef: "forwardRef",
1259
1273
  useCallback: "useCallback",
@@ -1325,7 +1339,7 @@ function resolveLocalStatements(local, jsx) {
1325
1339
  if (!local) return stmts;
1326
1340
  if (typeof local === "object" && "program" in local) {
1327
1341
  const program3 = local.program;
1328
- if (_optionalChain([program3, 'optionalAccess', _34 => _34.body, 'optionalAccess', _35 => _35.length])) {
1342
+ if (_optionalChain([program3, 'optionalAccess', _38 => _38.body, 'optionalAccess', _39 => _39.length])) {
1329
1343
  return [...program3.body, jsx];
1330
1344
  }
1331
1345
  }
@@ -1354,7 +1368,7 @@ function resolveForwardRef(body, ctx) {
1354
1368
  if (lang.startsWith("ts")) {
1355
1369
  const types = [t13.tsAnyKeyword()];
1356
1370
  if (propsId) {
1357
- 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]);
1358
1372
  types.push(propsType || t13.tsAnyKeyword());
1359
1373
  }
1360
1374
  callExpr.typeParameters = t13.tsTypeParameterInstantiation(types);
@@ -1396,7 +1410,7 @@ function resolvePropsTypeName(name, hasUseAttrsCall) {
1396
1410
 
1397
1411
  // src/core/codegen/component/script/syntax-processor/process/build-program-preamble.ts
1398
1412
  function buildProgramPreamble(nodeIR, ctx, state) {
1399
- 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);
1400
1414
  state.preambleStatements = statements;
1401
1415
  void ctx;
1402
1416
  }
@@ -1456,7 +1470,7 @@ function generateComponent(ir, ctx, options) {
1456
1470
  code,
1457
1471
  source: ctx.source
1458
1472
  };
1459
- executePlugins(_optionalChain([options, 'optionalAccess', _43 => _43.plugins]), result, ctx);
1473
+ executePlugins(_optionalChain([options, 'optionalAccess', _47 => _47.plugins]), result, ctx);
1460
1474
  return result;
1461
1475
  }
1462
1476
 
@@ -1470,7 +1484,7 @@ function generateOnlyScript(ir, ctx, options) {
1470
1484
  code,
1471
1485
  source: ctx.source
1472
1486
  };
1473
- executePlugins(_optionalChain([options, 'optionalAccess', _44 => _44.plugins]), result, ctx);
1487
+ executePlugins(_optionalChain([options, 'optionalAccess', _48 => _48.plugins]), result, ctx);
1474
1488
  return result;
1475
1489
  }
1476
1490
 
@@ -1503,7 +1517,7 @@ function parseOnlyScript(source, ctx, options) {
1503
1517
  };
1504
1518
  ctx.scriptData.lang = lang;
1505
1519
  ctx.scriptData.source = source;
1506
- executePlugins(_optionalChain([options, 'optionalAccess', _45 => _45.plugins]), result, ctx);
1520
+ executePlugins(_optionalChain([options, 'optionalAccess', _49 => _49.plugins]), result, ctx);
1507
1521
  return result;
1508
1522
  }
1509
1523
 
@@ -1522,7 +1536,7 @@ var _core = require('@babel/core');
1522
1536
 
1523
1537
  function findRootVariablePath(path8) {
1524
1538
  const rootId = findRootIdentifier(path8.node);
1525
- if (!_optionalChain([rootId, 'optionalAccess', _46 => _46.name])) return null;
1539
+ if (!_optionalChain([rootId, 'optionalAccess', _50 => _50.name])) return null;
1526
1540
  const binding = path8.scope.getBinding(rootId.name);
1527
1541
  if (!binding) return null;
1528
1542
  const rootPath = getVariableDeclaratorPath(binding.path);
@@ -1630,11 +1644,11 @@ function replaceIdName(id, newName) {
1630
1644
  id.loc.identifierName = newName;
1631
1645
  }
1632
1646
  }
1633
- function stringValueToTSType(ctx, input, tsTypeAnnotation7) {
1647
+ function stringValueToTSType(ctx, input, tsTypeAnnotation8) {
1634
1648
  const { filename, scriptData } = ctx;
1635
1649
  const exp = stringToExpr(input, scriptData.lang, filename);
1636
1650
  const ts = expressionToTSType(exp);
1637
- return tsTypeAnnotation7 ? t15.tsTypeAnnotation(ts) : ts;
1651
+ return tsTypeAnnotation8 ? t15.tsTypeAnnotation(ts) : ts;
1638
1652
  }
1639
1653
  function expressionToTSType(exp) {
1640
1654
  if (t15.isStringLiteral(exp)) return t15.tsStringKeyword();
@@ -1728,6 +1742,28 @@ function cleanNodeComments(node) {
1728
1742
  node.innerComments = null;
1729
1743
  node.trailingComments = null;
1730
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
+ }
1731
1767
 
1732
1768
  // src/core/parse/sfc/postprocess/resolve-script-metadata/resolve-declared-options.ts
1733
1769
  function resolveDeclaredOptions(path8, ctx) {
@@ -1739,11 +1775,11 @@ function resolveDeclaredOptions(path8, ctx) {
1739
1775
  const [options] = node.arguments;
1740
1776
  if (!options || !t16.isObjectExpression(options)) {
1741
1777
  logger.warn(
1742
- `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])}".`,
1743
1779
  {
1744
1780
  file: filename,
1745
1781
  source: scriptData.source,
1746
- loc: _optionalChain([options, 'optionalAccess', _48 => _48.loc]) || node.loc
1782
+ loc: _optionalChain([options, 'optionalAccess', _52 => _52.loc]) || node.loc
1747
1783
  }
1748
1784
  );
1749
1785
  return;
@@ -1763,7 +1799,7 @@ function resolveDeclaredOptions(path8, ctx) {
1763
1799
  {
1764
1800
  source,
1765
1801
  file: filename,
1766
- loc: _optionalChain([propKey, 'optionalAccess', _49 => _49.loc])
1802
+ loc: _optionalChain([propKey, 'optionalAccess', _53 => _53.loc])
1767
1803
  }
1768
1804
  );
1769
1805
  continue;
@@ -1780,7 +1816,7 @@ function resolveDeclaredOptions(path8, ctx) {
1780
1816
  {
1781
1817
  source,
1782
1818
  file: filename,
1783
- loc: _optionalChain([propKey, 'optionalAccess', _50 => _50.loc])
1819
+ loc: _optionalChain([propKey, 'optionalAccess', _54 => _54.loc])
1784
1820
  }
1785
1821
  );
1786
1822
  continue;
@@ -1883,7 +1919,7 @@ function resolveLocalTypeFromReference(path8, typeRef, ctx, macroName, visitedTy
1883
1919
  }
1884
1920
  }
1885
1921
  const programPath = path8.findParent((p) => p.isProgram());
1886
- if (!_optionalChain([programPath, 'optionalAccess', _51 => _51.isProgram, 'call', _52 => _52()])) {
1922
+ if (!_optionalChain([programPath, 'optionalAccess', _55 => _55.isProgram, 'call', _56 => _56()])) {
1887
1923
  return null;
1888
1924
  }
1889
1925
  const declaration = resolveTypeDeclarationInProgram(programPath.node.body, refName);
@@ -2005,7 +2041,7 @@ function collectEmitsFromTsType(tsType, names, path8, ctx, visitedTypeRefs, warn
2005
2041
  return;
2006
2042
  }
2007
2043
  if (t18.isTSTypeReference(tsType)) {
2008
- 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]) || [];
2009
2045
  for (const type of innerTypes) {
2010
2046
  collectEmitsFromTsType(type, names, path8, ctx, visitedTypeRefs, warnedImportedTypeRefs);
2011
2047
  }
@@ -2141,7 +2177,7 @@ function collectPropsFromTsType(tsType, names, path8, ctx, visitedTypeRefs, warn
2141
2177
  return;
2142
2178
  }
2143
2179
  if (t19.isTSTypeReference(tsType)) {
2144
- 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]) || [];
2145
2181
  for (const type of innerTypes) {
2146
2182
  collectPropsFromTsType(type, names, path8, ctx, visitedTypeRefs, warnedImportedTypeRefs);
2147
2183
  }
@@ -2186,11 +2222,11 @@ function resolveUseAttrsExists(path8, ctx) {
2186
2222
  if (!isCalleeNamed(node, VUE_API_MAP.useAttrs)) {
2187
2223
  return;
2188
2224
  }
2189
- if (_optionalChain([scriptData, 'optionalAccess', _57 => _57.hasUseAttrsCall])) {
2225
+ if (_optionalChain([scriptData, 'optionalAccess', _61 => _61.hasUseAttrsCall])) {
2190
2226
  return;
2191
2227
  }
2192
2228
  scriptData.hasUseAttrsCall = true;
2193
- 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]);
2194
2230
  if (parent && t20.isVariableDeclarator(parent) && t20.isIdentifier(parent.id)) {
2195
2231
  templateData.declaredAttrs = parent.id.name;
2196
2232
  }
@@ -2206,6 +2242,7 @@ var REACTIVE_TYPE_MAP = {
2206
2242
  toRefs: "ref",
2207
2243
  customRef: "ref",
2208
2244
  shallowRef: "ref",
2245
+ defineModel: "ref",
2209
2246
  reactive: "reactive",
2210
2247
  shallowReactive: "reactive",
2211
2248
  computed: "ref",
@@ -2327,7 +2364,7 @@ function resolveTemplateRefBindings(node, ctx) {
2327
2364
  return;
2328
2365
  }
2329
2366
  const varName = node.id.name;
2330
- 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]);
2331
2368
  refBindings.domRefs[varName] = {
2332
2369
  tag: initValue,
2333
2370
  name: varName,
@@ -2350,7 +2387,7 @@ function resolveVarBindings(node, ctx) {
2350
2387
 
2351
2388
  // src/core/parse/sfc/postprocess/resolve-script-metadata/index.ts
2352
2389
  function resolveScriptMeta(result, ctx) {
2353
- 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]);
2354
2391
  if (ctx.inputType !== "sfc" || !scriptAst) {
2355
2392
  return;
2356
2393
  }
@@ -2380,8 +2417,8 @@ function resolveScript(descriptor, ctx, parseResult) {
2380
2417
  }
2381
2418
  const { scriptSetup } = descriptor;
2382
2419
  if (!scriptSetup) return null;
2383
- if (_optionalChain([scriptSetup, 'optionalAccess', _65 => _65.warnings])) {
2384
- _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) => {
2385
2422
  logger.warn(msg, { file: ctx.filename });
2386
2423
  })]);
2387
2424
  }
@@ -2399,7 +2436,7 @@ function resolveContext(scriptSetup, ctx) {
2399
2436
  const regx = /\/\/\s*@vr-name:\s*(\w+)/;
2400
2437
  const nameMatch = source.match(regx);
2401
2438
  content = content.replace(regx, "");
2402
- 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()]) || "";
2403
2440
  };
2404
2441
  scriptData.declaredOptions.name = resolveVRComment(content);
2405
2442
  scriptData.lang = lang || "js";
@@ -2419,7 +2456,7 @@ var _postcssselectorparser = require('postcss-selector-parser'); var _postcsssel
2419
2456
  // src/plugins/postcss/utils.ts
2420
2457
  function findFirstPseudoIndex(nodes, start, end) {
2421
2458
  for (let i = start; i <= end; i++) {
2422
- 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") {
2423
2460
  return i;
2424
2461
  }
2425
2462
  }
@@ -2431,7 +2468,7 @@ function hasScopeAttribute(nodes, start, end, scopeId) {
2431
2468
  }
2432
2469
  for (let i = start; i <= end; i++) {
2433
2470
  const node = nodes[i];
2434
- if (_optionalChain([node, 'optionalAccess', _74 => _74.type]) === "attribute" && node.attribute === scopeId) {
2471
+ if (_optionalChain([node, 'optionalAccess', _78 => _78.type]) === "attribute" && node.attribute === scopeId) {
2435
2472
  return true;
2436
2473
  }
2437
2474
  }
@@ -2442,7 +2479,7 @@ function hasNestingSelector(nodes, start, end) {
2442
2479
  return false;
2443
2480
  }
2444
2481
  for (let i = start; i <= end; i++) {
2445
- 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") {
2446
2483
  return true;
2447
2484
  }
2448
2485
  }
@@ -2456,18 +2493,18 @@ function findScopeTargetIndex(nodes, start, end) {
2456
2493
  let nestingFallback = -1;
2457
2494
  for (let i = start; i <= end; i++) {
2458
2495
  const node = nodes[i];
2459
- if (_optionalChain([node, 'optionalAccess', _77 => _77.type]) === "nesting") {
2496
+ if (_optionalChain([node, 'optionalAccess', _81 => _81.type]) === "nesting") {
2460
2497
  nestingFallback = i;
2461
2498
  continue;
2462
2499
  }
2463
- 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") {
2464
2501
  candidate = i;
2465
2502
  }
2466
2503
  }
2467
2504
  return candidate === -1 ? nestingFallback : candidate;
2468
2505
  }
2469
2506
  function isRuleIgnored(rule) {
2470
- 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";
2471
2508
  }
2472
2509
  function isNestedInRule(rule) {
2473
2510
  let current = rule.parent;
@@ -2491,7 +2528,7 @@ function resolveStandard(s, scopeId) {
2491
2528
  }
2492
2529
  let compoundStart = 0;
2493
2530
  for (let i = compoundEnd; i >= 0; i--) {
2494
- 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") {
2495
2532
  compoundStart = i + 1;
2496
2533
  break;
2497
2534
  }
@@ -2549,13 +2586,13 @@ function resolveSingleSelectorWithDeep(selector, scopeId, nestedInRule) {
2549
2586
  return [resolveStandard(selector.toString(), scopeId)];
2550
2587
  }
2551
2588
  const deepNode = selector.nodes[deepIndex];
2552
- if (_optionalChain([deepNode, 'optionalAccess', _86 => _86.type]) !== "pseudo") {
2589
+ if (_optionalChain([deepNode, 'optionalAccess', _90 => _90.type]) !== "pseudo") {
2553
2590
  return [resolveStandard(selector.toString(), scopeId)];
2554
2591
  }
2555
2592
  const leftRaw = selector.nodes.slice(0, deepIndex).map((node) => node.toString()).join("");
2556
2593
  const rightRaw = selector.nodes.slice(deepIndex + 1).map((node) => node.toString()).join("");
2557
2594
  const leftScoped = scopeDeepLeftSide(leftRaw, scopeId, nestedInRule);
2558
- 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 : [];
2559
2596
  if (!deepInnerSelectors.length) {
2560
2597
  return [leftScoped + rightRaw];
2561
2598
  }
@@ -2573,7 +2610,7 @@ function resolveSingleSelectorWithDeep(selector, scopeId, nestedInRule) {
2573
2610
  function findTopLevelDeepIndex(nodes) {
2574
2611
  for (let i = 0; i < nodes.length; i++) {
2575
2612
  const node = nodes[i];
2576
- 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")) {
2577
2614
  return i;
2578
2615
  }
2579
2616
  }
@@ -2600,7 +2637,7 @@ function injectScopeToRightMostCompound(selector, scopeId) {
2600
2637
  return;
2601
2638
  }
2602
2639
  let compoundEnd = nodes.length - 1;
2603
- 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") {
2604
2641
  compoundEnd--;
2605
2642
  }
2606
2643
  if (compoundEnd < 0) {
@@ -2608,7 +2645,7 @@ function injectScopeToRightMostCompound(selector, scopeId) {
2608
2645
  }
2609
2646
  let compoundStart = 0;
2610
2647
  for (let i = compoundEnd; i >= 0; i--) {
2611
- 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") {
2612
2649
  compoundStart = i + 1;
2613
2650
  break;
2614
2651
  }
@@ -2650,7 +2687,7 @@ function resolveSelector(s, scopeId, options) {
2650
2687
  return s.replace(/:global\(([^)]+)\)/g, (_, inner) => inner);
2651
2688
  }
2652
2689
  if (s.includes(":deep(")) {
2653
- 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)));
2654
2691
  }
2655
2692
  if (s.includes(":slotted(")) {
2656
2693
  return s.replace(/:slotted\((.*)\)/, "$1");
@@ -2804,7 +2841,7 @@ function resolveStyles(descriptor, ctx, result) {
2804
2841
  var _compilercore = require('@vue/compiler-core');
2805
2842
  function resolveTemplate(descriptor, _, result) {
2806
2843
  const block = descriptor.template;
2807
- if (!_optionalChain([block, 'optionalAccess', _95 => _95.content])) return null;
2844
+ if (!_optionalChain([block, 'optionalAccess', _99 => _99.content])) return null;
2808
2845
  result.template = {
2809
2846
  ast: _compilercore.baseParse.call(void 0, block.content),
2810
2847
  source: block
@@ -2821,7 +2858,7 @@ function processVueSyntax(descriptor, ctx, result) {
2821
2858
  }
2822
2859
  function vueSyntaxProcessor(descriptor, ctx, result, options) {
2823
2860
  const run = (p, type) => {
2824
- _optionalChain([p, 'optionalAccess', _96 => _96.forEach, 'call', _97 => _97((handler) => {
2861
+ _optionalChain([p, 'optionalAccess', _100 => _100.forEach, 'call', _101 => _101((handler) => {
2825
2862
  if (type === "post") {
2826
2863
  handler(result, ctx);
2827
2864
  return;
@@ -2845,7 +2882,7 @@ function parseSFC(source, ctx, options) {
2845
2882
  };
2846
2883
  collectErrs(descriptor, errors);
2847
2884
  processVueSyntax(descriptor, ctx, result);
2848
- executePlugins(_optionalChain([options, 'optionalAccess', _98 => _98.plugins]), result, ctx);
2885
+ executePlugins(_optionalChain([options, 'optionalAccess', _102 => _102.plugins]), result, ctx);
2849
2886
  return result;
2850
2887
  }
2851
2888
  function collectErrs(descriptor, errors) {
@@ -2853,7 +2890,7 @@ function collectErrs(descriptor, errors) {
2853
2890
  logger.error(err.message, {
2854
2891
  source: descriptor.source,
2855
2892
  file: descriptor.filename,
2856
- loc: _optionalChain([err, 'optionalAccess', _99 => _99.loc])
2893
+ loc: _optionalChain([err, 'optionalAccess', _103 => _103.loc])
2857
2894
  });
2858
2895
  }
2859
2896
  if (descriptor.cssVars.length) {
@@ -2877,7 +2914,7 @@ function parse(source, ctx, options) {
2877
2914
 
2878
2915
  // src/core/transform/sfc/script/syntax-processor/postprocess/resolve-ast-chunks/resolve-global-type-chunk.ts
2879
2916
  function resolveGlobalTypeChunks(path8, ir) {
2880
- 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()])) {
2881
2918
  return;
2882
2919
  }
2883
2920
  const forked = forkNode(path8.node);
@@ -3104,7 +3141,7 @@ function resolveRuntimeImports(ctx) {
3104
3141
  if (!hasImports) {
3105
3142
  const importNodes = createImportNodes(ctx);
3106
3143
  if (importNodes.length) {
3107
- if (_optionalChain([strategyResult, 'optionalAccess', _103 => _103.shouldInjectRuntimeImports])) {
3144
+ if (_optionalChain([strategyResult, 'optionalAccess', _107 => _107.shouldInjectRuntimeImports])) {
3108
3145
  path8.insertAfter(importNodes);
3109
3146
  } else if (finalModuleName === PACKAGE_NAME.react) {
3110
3147
  path8.insertAfter(importNodes);
@@ -3132,7 +3169,7 @@ function resolveRuntimeImports(ctx) {
3132
3169
  }
3133
3170
  function mergeImports(currentNode, ctx, moduleName) {
3134
3171
  const ctxImportItems = ctx.imports.get(moduleName);
3135
- if (!_optionalChain([ctxImportItems, 'optionalAccess', _104 => _104.length])) {
3172
+ if (!_optionalChain([ctxImportItems, 'optionalAccess', _108 => _108.length])) {
3136
3173
  return;
3137
3174
  }
3138
3175
  const currentImports = /* @__PURE__ */ new Set();
@@ -3182,7 +3219,7 @@ function forkProgramTopLeadingComments(target, program3) {
3182
3219
  }
3183
3220
  function forkFilePreambleLeadingComments(target, source) {
3184
3221
  const { leadingComments } = source;
3185
- if (!_optionalChain([leadingComments, 'optionalAccess', _105 => _105.length])) {
3222
+ if (!_optionalChain([leadingComments, 'optionalAccess', _109 => _109.length])) {
3186
3223
  return;
3187
3224
  }
3188
3225
  const commentsToMove = [];
@@ -3313,6 +3350,13 @@ function createUseMemo(body, deps) {
3313
3350
  function createUseImperativeHandle(refId, init) {
3314
3351
  return t27.callExpression(t27.identifier(REACT_API_MAP.useImperativeHandle), [refId, init]);
3315
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
+ }
3316
3360
 
3317
3361
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-define-expose.ts
3318
3362
  function resolveDefineExpose(ctx) {
@@ -3348,6 +3392,226 @@ function resolveDefineExpose(ctx) {
3348
3392
  };
3349
3393
  }
3350
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
+
3351
3615
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-define-options.ts
3352
3616
  function resolveDefineOptions(ctx) {
3353
3617
  return {
@@ -3376,7 +3640,7 @@ function resolveEmitCalls(ctx) {
3376
3640
  CallExpression(path8) {
3377
3641
  const { node } = path8;
3378
3642
  const { filename, templateData, scriptData } = ctx;
3379
- if (!t29.isIdentifier(node.callee)) return;
3643
+ if (!t30.isIdentifier(node.callee)) return;
3380
3644
  const { name } = node.callee;
3381
3645
  const checkIfFromDefineEmits = () => {
3382
3646
  let result = false;
@@ -3388,7 +3652,7 @@ function resolveEmitCalls(ctx) {
3388
3652
  const binding = path8.scope.getBinding(name);
3389
3653
  if (binding) {
3390
3654
  const parent = binding.path.node;
3391
- 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)) {
3392
3656
  result = parent.init.callee.name === MACRO_API_NAMES.emits;
3393
3657
  }
3394
3658
  }
@@ -3398,9 +3662,9 @@ function resolveEmitCalls(ctx) {
3398
3662
  if (!checkIfFromDefineEmits()) return;
3399
3663
  const [callee, ...args] = node.arguments;
3400
3664
  let propCall;
3401
- if (t29.isStringLiteral(callee)) {
3665
+ if (t30.isStringLiteral(callee)) {
3402
3666
  const eventName = formatEmitEventName(callee.value);
3403
- propCall = createPropCall(ctx.propField, t29.identifier(eventName), args);
3667
+ propCall = createPropCall(ctx.propField, t30.identifier(eventName), args);
3404
3668
  } else {
3405
3669
  propCall = createPropCall(ctx.propField, callee, args, true);
3406
3670
  logger.error(
@@ -3408,7 +3672,7 @@ function resolveEmitCalls(ctx) {
3408
3672
  {
3409
3673
  file: filename,
3410
3674
  source: scriptData.source,
3411
- loc: _optionalChain([callee, 'optionalAccess', _106 => _106.loc])
3675
+ loc: _optionalChain([callee, 'optionalAccess', _117 => _117.loc])
3412
3676
  }
3413
3677
  );
3414
3678
  }
@@ -3417,8 +3681,8 @@ function resolveEmitCalls(ctx) {
3417
3681
  };
3418
3682
  }
3419
3683
  function createPropCall(rootName, callee, args, computed = false) {
3420
- return t29.optionalCallExpression(
3421
- t29.memberExpression(t29.identifier(rootName), callee, computed),
3684
+ return t30.optionalCallExpression(
3685
+ t30.memberExpression(t30.identifier(rootName), callee, computed),
3422
3686
  args,
3423
3687
  true
3424
3688
  );
@@ -3434,21 +3698,21 @@ function createPropCall(rootName, callee, args, computed = false) {
3434
3698
 
3435
3699
  function cloneCallableParams(params) {
3436
3700
  const cloneCallableParam = (param, index) => {
3437
- if (t30.isRestElement(param)) {
3701
+ if (t31.isRestElement(param)) {
3438
3702
  const arg = param.argument;
3439
- const name = t30.isIdentifier(arg) ? arg.name : `args${index}`;
3440
- const rest = t30.restElement(t30.identifier(name));
3441
- rest.typeAnnotation = param.typeAnnotation || (t30.isIdentifier(arg) ? arg.typeAnnotation : null) || t30.tsTypeAnnotation(t30.tsArrayType(t30.tsAnyKeyword()));
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()));
3442
3706
  return rest;
3443
3707
  }
3444
- if (t30.isIdentifier(param)) {
3445
- const id = t30.identifier(param.name || `arg${index}`);
3708
+ if (t31.isIdentifier(param)) {
3709
+ const id = t31.identifier(param.name || `arg${index}`);
3446
3710
  id.optional = param.optional;
3447
- id.typeAnnotation = param.typeAnnotation || t30.tsTypeAnnotation(t30.tsAnyKeyword());
3711
+ id.typeAnnotation = param.typeAnnotation || t31.tsTypeAnnotation(t31.tsAnyKeyword());
3448
3712
  return id;
3449
3713
  }
3450
- const fallback = t30.identifier(`arg${index}`);
3451
- fallback.typeAnnotation = t30.tsTypeAnnotation(t30.tsAnyKeyword());
3714
+ const fallback = t31.identifier(`arg${index}`);
3715
+ fallback.typeAnnotation = t31.tsTypeAnnotation(t31.tsAnyKeyword());
3452
3716
  return fallback;
3453
3717
  };
3454
3718
  return params.map(cloneCallableParam);
@@ -3458,18 +3722,18 @@ function cloneCallableParams(params) {
3458
3722
  function resolveEmitsTopLevelTypes(ctx) {
3459
3723
  return {
3460
3724
  "TSInterfaceDeclaration|TSTypeAliasDeclaration"(path8) {
3461
- if (!t31.isProgram(path8.parent)) return;
3725
+ if (!t32.isProgram(path8.parent)) return;
3462
3726
  const { node } = path8;
3463
- if (t31.isTSInterfaceDeclaration(node)) {
3464
- const typeLiteral = t31.tsTypeLiteral(node.body.body);
3727
+ if (t32.isTSInterfaceDeclaration(node)) {
3728
+ const typeLiteral = t32.tsTypeLiteral(node.body.body);
3465
3729
  if (!hasEmitsSignatureInType(typeLiteral)) return;
3466
3730
  const resolved = resolveTopLevelEmitType(typeLiteral);
3467
- if (resolved && t31.isTSTypeLiteral(resolved)) {
3731
+ if (resolved && t32.isTSTypeLiteral(resolved)) {
3468
3732
  node.body.body = resolved.members;
3469
3733
  }
3470
3734
  return;
3471
3735
  }
3472
- if (t31.isTSTypeAliasDeclaration(node)) {
3736
+ if (t32.isTSTypeAliasDeclaration(node)) {
3473
3737
  if (!hasEmitsSignatureInType(node.typeAnnotation)) return;
3474
3738
  const resolved = resolveTopLevelEmitType(node.typeAnnotation);
3475
3739
  if (resolved) {
@@ -3480,55 +3744,55 @@ function resolveEmitsTopLevelTypes(ctx) {
3480
3744
  };
3481
3745
  }
3482
3746
  function resolveTopLevelEmitType(tsType) {
3483
- if (t31.isTSParenthesizedType(tsType)) {
3747
+ if (t32.isTSParenthesizedType(tsType)) {
3484
3748
  return resolveTopLevelEmitType(tsType.typeAnnotation);
3485
3749
  }
3486
- if (t31.isTSTypeReference(tsType)) {
3750
+ if (t32.isTSTypeReference(tsType)) {
3487
3751
  if (!tsType.typeParameters || !tsType.typeParameters.params.length) {
3488
3752
  return tsType;
3489
3753
  }
3490
3754
  const params = tsType.typeParameters.params.map((param) => resolveTopLevelEmitType(param)).filter(Boolean);
3491
- return t31.tsTypeReference(
3755
+ return t32.tsTypeReference(
3492
3756
  tsType.typeName,
3493
- t31.tsTypeParameterInstantiation(params.length ? params : tsType.typeParameters.params)
3757
+ t32.tsTypeParameterInstantiation(params.length ? params : tsType.typeParameters.params)
3494
3758
  );
3495
3759
  }
3496
- if (t31.isTSIntersectionType(tsType)) {
3760
+ if (t32.isTSIntersectionType(tsType)) {
3497
3761
  const types = tsType.types.map(resolveTopLevelEmitType).filter(Boolean);
3498
3762
  if (!types.length) return null;
3499
3763
  if (types.length === 1) return types[0];
3500
- return t31.tsIntersectionType(types);
3764
+ return t32.tsIntersectionType(types);
3501
3765
  }
3502
- if (t31.isTSUnionType(tsType)) {
3766
+ if (t32.isTSUnionType(tsType)) {
3503
3767
  const types = tsType.types.map(resolveTopLevelEmitType).filter(Boolean);
3504
3768
  if (!types.length) return null;
3505
3769
  if (types.length === 1) return types[0];
3506
- return t31.tsUnionType(types);
3770
+ return t32.tsUnionType(types);
3507
3771
  }
3508
- if (t31.isTSTypeLiteral(tsType)) {
3772
+ if (t32.isTSTypeLiteral(tsType)) {
3509
3773
  const members = [];
3510
3774
  for (const member of tsType.members) {
3511
- if (t31.isTSCallSignatureDeclaration(member)) {
3775
+ if (t32.isTSCallSignatureDeclaration(member)) {
3512
3776
  members.push(...resolveEmitPropsFromCallSignature(member));
3513
3777
  continue;
3514
3778
  }
3515
3779
  members.push(member);
3516
3780
  }
3517
3781
  if (!members.length) return null;
3518
- return t31.tsTypeLiteral(members);
3782
+ return t32.tsTypeLiteral(members);
3519
3783
  }
3520
- if (t31.isTSFunctionType(tsType)) {
3784
+ if (t32.isTSFunctionType(tsType)) {
3521
3785
  const props = resolveEmitPropsFromCallable(tsType.parameters, tsType.typeAnnotation);
3522
3786
  if (!props.length) return null;
3523
- return t31.tsTypeLiteral(props);
3787
+ return t32.tsTypeLiteral(props);
3524
3788
  }
3525
3789
  return tsType;
3526
3790
  }
3527
3791
  function resolveDefineEmitsIface(path8, ctx) {
3528
3792
  const { node } = path8;
3529
3793
  const [runtimeArg] = node.arguments;
3530
- const tsParams = _optionalChain([node, 'access', _107 => _107.typeParameters, 'optionalAccess', _108 => _108.params]);
3531
- 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])) {
3532
3796
  processExplicitType(ctx, tsParams);
3533
3797
  return;
3534
3798
  }
@@ -3541,41 +3805,41 @@ function processInferredTypes(ctx, runtimeArg) {
3541
3805
  propsTSIface: { emitTypes }
3542
3806
  } = ctx.scriptData;
3543
3807
  const members = [];
3544
- if (t31.isArrayExpression(runtimeArg)) {
3808
+ if (t32.isArrayExpression(runtimeArg)) {
3545
3809
  for (const element of runtimeArg.elements) {
3546
- if (!element || !t31.isStringLiteral(element)) continue;
3810
+ if (!element || !t32.isStringLiteral(element)) continue;
3547
3811
  const handlerName = resolveEmitHandlerName(element.value);
3548
3812
  const key = buildKey(handlerName);
3549
- const fnType = t31.tsFunctionType(
3813
+ const fnType = t32.tsFunctionType(
3550
3814
  null,
3551
3815
  [createRestAnyParam("args")],
3552
- t31.tsTypeAnnotation(t31.tsAnyKeyword())
3816
+ t32.tsTypeAnnotation(t32.tsAnyKeyword())
3553
3817
  );
3554
- const prop = t31.tsPropertySignature(key, t31.tsTypeAnnotation(fnType));
3818
+ const prop = t32.tsPropertySignature(key, t32.tsTypeAnnotation(fnType));
3555
3819
  prop.optional = true;
3556
3820
  members.push(prop);
3557
3821
  }
3558
3822
  if (members.length) {
3559
- emitTypes.push(t31.tsTypeLiteral(members));
3823
+ emitTypes.push(t32.tsTypeLiteral(members));
3560
3824
  }
3561
3825
  return;
3562
3826
  }
3563
- if (t31.isObjectExpression(runtimeArg)) {
3827
+ if (t32.isObjectExpression(runtimeArg)) {
3564
3828
  for (const prop of runtimeArg.properties) {
3565
- if (!t31.isObjectProperty(prop)) continue;
3566
- if (t31.isSpreadElement(prop)) continue;
3829
+ if (!t32.isObjectProperty(prop)) continue;
3830
+ if (t32.isSpreadElement(prop)) continue;
3567
3831
  const rawName = resolvePropName(prop.key);
3568
3832
  if (!rawName) continue;
3569
3833
  const handlerName = resolveEmitHandlerName(rawName);
3570
3834
  const key = buildKey(handlerName);
3571
- const params = t31.isArrayExpression(prop.value) ? resolveRuntimeTupleParams(prop.value) : [createRestAnyParam("args")];
3572
- const fnType = t31.tsFunctionType(null, params, t31.tsTypeAnnotation(t31.tsAnyKeyword()));
3573
- const propSig = t31.tsPropertySignature(key, t31.tsTypeAnnotation(fnType));
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));
3574
3838
  propSig.optional = true;
3575
3839
  members.push(propSig);
3576
3840
  }
3577
3841
  if (members.length) {
3578
- emitTypes.push(t31.tsTypeLiteral(members));
3842
+ emitTypes.push(t32.tsTypeLiteral(members));
3579
3843
  }
3580
3844
  }
3581
3845
  }
@@ -3596,129 +3860,129 @@ function resolveEmitHandlerName(rawName) {
3596
3860
  return `on${name}`;
3597
3861
  }
3598
3862
  function resolvePropName(key) {
3599
- if (t31.isIdentifier(key)) return key.name;
3600
- if (t31.isStringLiteral(key)) return key.value;
3601
- if (t31.isNumericLiteral(key)) return String(key.value);
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);
3602
3866
  return null;
3603
3867
  }
3604
3868
  function buildKey(name) {
3605
- return t31.isValidIdentifier(name) ? t31.identifier(name) : t31.stringLiteral(name);
3869
+ return t32.isValidIdentifier(name) ? t32.identifier(name) : t32.stringLiteral(name);
3606
3870
  }
3607
3871
  function createRestAnyParam(name) {
3608
- const id = t31.identifier(name);
3609
- const rest = t31.restElement(id);
3610
- 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()));
3611
3875
  return rest;
3612
3876
  }
3613
3877
  function resolveRuntimeTupleParams(value) {
3614
3878
  const params = [];
3615
3879
  value.elements.forEach((element, index) => {
3616
3880
  if (!element) return;
3617
- if (t31.isSpreadElement(element)) {
3881
+ if (t32.isSpreadElement(element)) {
3618
3882
  params.push(createRestAnyParam(`args${index}`));
3619
3883
  return;
3620
3884
  }
3621
- if (t31.isIdentifier(element)) {
3622
- const id = t31.identifier(element.name);
3623
- 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());
3624
3888
  params.push(id);
3625
3889
  return;
3626
3890
  }
3627
- if (t31.isTSAsExpression(element)) {
3628
- const id = t31.identifier(`arg${index}`);
3629
- 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);
3630
3894
  params.push(id);
3631
3895
  return;
3632
3896
  }
3633
- const fallback = t31.identifier(`arg${index}`);
3634
- fallback.typeAnnotation = t31.tsTypeAnnotation(t31.tsAnyKeyword());
3897
+ const fallback = t32.identifier(`arg${index}`);
3898
+ fallback.typeAnnotation = t32.tsTypeAnnotation(t32.tsAnyKeyword());
3635
3899
  params.push(fallback);
3636
3900
  });
3637
3901
  return params;
3638
3902
  }
3639
3903
  function resolveExplicitEmitType(tsType) {
3640
- if (t31.isTSParenthesizedType(tsType)) {
3904
+ if (t32.isTSParenthesizedType(tsType)) {
3641
3905
  return resolveExplicitEmitType(tsType.typeAnnotation);
3642
3906
  }
3643
- if (t31.isTSTypeReference(tsType)) {
3907
+ if (t32.isTSTypeReference(tsType)) {
3644
3908
  if (!tsType.typeParameters || !tsType.typeParameters.params.length) {
3645
3909
  return tsType;
3646
3910
  }
3647
3911
  const params = tsType.typeParameters.params.map((param) => resolveExplicitEmitType(param)).filter(Boolean);
3648
- return t31.tsTypeReference(
3912
+ return t32.tsTypeReference(
3649
3913
  tsType.typeName,
3650
- t31.tsTypeParameterInstantiation(params.length ? params : tsType.typeParameters.params)
3914
+ t32.tsTypeParameterInstantiation(params.length ? params : tsType.typeParameters.params)
3651
3915
  );
3652
3916
  }
3653
- if (t31.isTSIntersectionType(tsType)) {
3917
+ if (t32.isTSIntersectionType(tsType)) {
3654
3918
  const types = tsType.types.map(resolveExplicitEmitType).filter(Boolean);
3655
3919
  if (!types.length) return null;
3656
3920
  if (types.length === 1) return types[0];
3657
- return t31.tsIntersectionType(types);
3921
+ return t32.tsIntersectionType(types);
3658
3922
  }
3659
- if (t31.isTSUnionType(tsType)) {
3923
+ if (t32.isTSUnionType(tsType)) {
3660
3924
  const types = tsType.types.map(resolveExplicitEmitType).filter(Boolean);
3661
3925
  if (!types.length) return null;
3662
3926
  if (types.length === 1) return types[0];
3663
- return t31.tsUnionType(types);
3927
+ return t32.tsUnionType(types);
3664
3928
  }
3665
- if (t31.isTSTypeLiteral(tsType)) {
3929
+ if (t32.isTSTypeLiteral(tsType)) {
3666
3930
  const members = [];
3667
3931
  for (const member of tsType.members) {
3668
- if (t31.isTSPropertySignature(member)) {
3932
+ if (t32.isTSPropertySignature(member)) {
3669
3933
  const prop = resolveEmitPropFromPropertySignature(member);
3670
3934
  if (prop) members.push(prop);
3671
3935
  continue;
3672
3936
  }
3673
- if (t31.isTSCallSignatureDeclaration(member)) {
3937
+ if (t32.isTSCallSignatureDeclaration(member)) {
3674
3938
  members.push(...resolveEmitPropsFromCallSignature(member));
3675
3939
  continue;
3676
3940
  }
3677
3941
  }
3678
3942
  if (!members.length) return null;
3679
- return t31.tsTypeLiteral(members);
3943
+ return t32.tsTypeLiteral(members);
3680
3944
  }
3681
- if (t31.isTSFunctionType(tsType)) {
3945
+ if (t32.isTSFunctionType(tsType)) {
3682
3946
  const props = resolveEmitPropsFromCallable(tsType.parameters, tsType.typeAnnotation);
3683
3947
  if (!props.length) return null;
3684
- return t31.tsTypeLiteral(props);
3948
+ return t32.tsTypeLiteral(props);
3685
3949
  }
3686
3950
  return tsType;
3687
3951
  }
3688
3952
  function hasEmitsSignatureInType(tsType) {
3689
- if (t31.isTSParenthesizedType(tsType)) {
3953
+ if (t32.isTSParenthesizedType(tsType)) {
3690
3954
  return hasEmitsSignatureInType(tsType.typeAnnotation);
3691
3955
  }
3692
- if (t31.isTSTypeReference(tsType)) {
3956
+ if (t32.isTSTypeReference(tsType)) {
3693
3957
  if (!tsType.typeParameters || !tsType.typeParameters.params.length) {
3694
3958
  return false;
3695
3959
  }
3696
3960
  return tsType.typeParameters.params.some(hasEmitsSignatureInType);
3697
3961
  }
3698
- if (t31.isTSIntersectionType(tsType) || t31.isTSUnionType(tsType)) {
3962
+ if (t32.isTSIntersectionType(tsType) || t32.isTSUnionType(tsType)) {
3699
3963
  return tsType.types.some(hasEmitsSignatureInType);
3700
3964
  }
3701
- if (t31.isTSTypeLiteral(tsType)) {
3965
+ if (t32.isTSTypeLiteral(tsType)) {
3702
3966
  return tsType.members.some(hasEmitsSignatureInMember);
3703
3967
  }
3704
- if (t31.isTSFunctionType(tsType)) {
3968
+ if (t32.isTSFunctionType(tsType)) {
3705
3969
  return isEmitsCallable(tsType.parameters);
3706
3970
  }
3707
3971
  return false;
3708
3972
  }
3709
3973
  function hasEmitsSignatureInMember(member) {
3710
- if (t31.isTSCallSignatureDeclaration(member)) {
3974
+ if (t32.isTSCallSignatureDeclaration(member)) {
3711
3975
  return isEmitsCallable(member.parameters);
3712
3976
  }
3713
3977
  return false;
3714
3978
  }
3715
3979
  function isEmitsCallable(parameters) {
3716
3980
  const [eventParam] = parameters;
3717
- if (!eventParam || !t31.isIdentifier(eventParam) || !eventParam.typeAnnotation) {
3981
+ if (!eventParam || !t32.isIdentifier(eventParam) || !eventParam.typeAnnotation) {
3718
3982
  return false;
3719
3983
  }
3720
3984
  const { typeAnnotation } = eventParam;
3721
- if (t31.isNoop(typeAnnotation)) return false;
3985
+ if (t32.isNoop(typeAnnotation)) return false;
3722
3986
  return resolveEventNames(typeAnnotation.typeAnnotation).length > 0;
3723
3987
  }
3724
3988
  function resolveEmitPropFromPropertySignature(member) {
@@ -3726,21 +3990,21 @@ function resolveEmitPropFromPropertySignature(member) {
3726
3990
  if (!rawName) return null;
3727
3991
  const handlerName = resolveEmitHandlerName(rawName);
3728
3992
  const key = buildKey(handlerName);
3729
- 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]);
3730
3994
  let params = [];
3731
- let returnType = t31.tsAnyKeyword();
3732
- if (typeAnnotation && t31.isTSFunctionType(typeAnnotation)) {
3995
+ let returnType = t32.tsAnyKeyword();
3996
+ if (typeAnnotation && t32.isTSFunctionType(typeAnnotation)) {
3733
3997
  params = cloneCallableParams(typeAnnotation.parameters);
3734
- returnType = _nullishCoalesce(_optionalChain([typeAnnotation, 'access', _112 => _112.typeAnnotation, 'optionalAccess', _113 => _113.typeAnnotation]), () => ( returnType));
3735
- } 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)) {
3736
4000
  params = resolveTupleTypeParams(typeAnnotation);
3737
4001
  } else if (typeAnnotation) {
3738
- const id = t31.identifier("value");
3739
- id.typeAnnotation = t31.tsTypeAnnotation(typeAnnotation);
4002
+ const id = t32.identifier("value");
4003
+ id.typeAnnotation = t32.tsTypeAnnotation(typeAnnotation);
3740
4004
  params = [id];
3741
4005
  }
3742
- const fnType = t31.tsFunctionType(null, params, t31.tsTypeAnnotation(returnType));
3743
- 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));
3744
4008
  prop.optional = !!member.optional;
3745
4009
  return prop;
3746
4010
  }
@@ -3749,32 +4013,32 @@ function resolveEmitPropsFromCallSignature(member) {
3749
4013
  }
3750
4014
  function resolveEmitPropsFromCallable(parameters, typeAnnotation) {
3751
4015
  const [eventParam, ...restParams] = parameters;
3752
- if (!eventParam || !t31.isIdentifier(eventParam) || !eventParam.typeAnnotation) {
4016
+ if (!eventParam || !t32.isIdentifier(eventParam) || !eventParam.typeAnnotation) {
3753
4017
  return [];
3754
4018
  }
3755
4019
  const { typeAnnotation: paramTypeAnnotation } = eventParam;
3756
- if (t31.isNoop(paramTypeAnnotation)) return [];
4020
+ if (t32.isNoop(paramTypeAnnotation)) return [];
3757
4021
  const eventNames = resolveEventNames(paramTypeAnnotation.typeAnnotation);
3758
4022
  if (!eventNames.length) return [];
3759
- const returnType = _nullishCoalesce(_optionalChain([typeAnnotation, 'optionalAccess', _114 => _114.typeAnnotation]), () => ( t31.tsAnyKeyword()));
4023
+ const returnType = _nullishCoalesce(_optionalChain([typeAnnotation, 'optionalAccess', _125 => _125.typeAnnotation]), () => ( t32.tsAnyKeyword()));
3760
4024
  return eventNames.map((eventName) => {
3761
4025
  const handlerName = resolveEmitHandlerName(eventName);
3762
4026
  const key = buildKey(handlerName);
3763
4027
  const params = cloneCallableParams(restParams);
3764
- const fnType = t31.tsFunctionType(null, params, t31.tsTypeAnnotation(returnType));
3765
- 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));
3766
4030
  prop.optional = true;
3767
4031
  return prop;
3768
4032
  });
3769
4033
  }
3770
4034
  function resolveEventNames(type) {
3771
- if (t31.isTSLiteralType(type) && t31.isStringLiteral(type.literal)) {
4035
+ if (t32.isTSLiteralType(type) && t32.isStringLiteral(type.literal)) {
3772
4036
  return [type.literal.value];
3773
4037
  }
3774
- if (t31.isTSUnionType(type)) {
4038
+ if (t32.isTSUnionType(type)) {
3775
4039
  return type.types.flatMap(resolveEventNames);
3776
4040
  }
3777
- if (t31.isTSParenthesizedType(type)) {
4041
+ if (t32.isTSParenthesizedType(type)) {
3778
4042
  return resolveEventNames(type.typeAnnotation);
3779
4043
  }
3780
4044
  return [];
@@ -3787,39 +4051,39 @@ function resolveTupleTypeParams(tuple) {
3787
4051
  return params;
3788
4052
  }
3789
4053
  function resolveTupleElementParam(element, index) {
3790
- const isNamedTuple = typeof t31.isTSNamedTupleMember === "function" && t31.isTSNamedTupleMember(element);
4054
+ const isNamedTuple = typeof t32.isTSNamedTupleMember === "function" && t32.isTSNamedTupleMember(element);
3791
4055
  if (isNamedTuple) {
3792
4056
  const tupleMember = element;
3793
- 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}`;
3794
4058
  let innerType = tupleMember.elementType;
3795
4059
  let optional = tupleMember.optional;
3796
- if (t31.isTSOptionalType(innerType)) {
4060
+ if (t32.isTSOptionalType(innerType)) {
3797
4061
  optional = true;
3798
4062
  innerType = innerType.typeAnnotation;
3799
4063
  }
3800
- if (t31.isTSRestType(innerType)) {
3801
- const rest = t31.restElement(t31.identifier(name));
3802
- 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);
3803
4067
  return rest;
3804
4068
  }
3805
- const id2 = t31.identifier(name);
4069
+ const id2 = t32.identifier(name);
3806
4070
  id2.optional = optional;
3807
- id2.typeAnnotation = t31.tsTypeAnnotation(innerType);
4071
+ id2.typeAnnotation = t32.tsTypeAnnotation(innerType);
3808
4072
  return id2;
3809
4073
  }
3810
- if (t31.isTSRestType(element)) {
3811
- const rest = t31.restElement(t31.identifier(`args${index}`));
3812
- 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);
3813
4077
  return rest;
3814
4078
  }
3815
- if (t31.isTSOptionalType(element)) {
3816
- const id2 = t31.identifier(`arg${index}`);
4079
+ if (t32.isTSOptionalType(element)) {
4080
+ const id2 = t32.identifier(`arg${index}`);
3817
4081
  id2.optional = true;
3818
- id2.typeAnnotation = t31.tsTypeAnnotation(element.typeAnnotation);
4082
+ id2.typeAnnotation = t32.tsTypeAnnotation(element.typeAnnotation);
3819
4083
  return id2;
3820
4084
  }
3821
- const id = t31.identifier(`arg${index}`);
3822
- id.typeAnnotation = t31.tsTypeAnnotation(element);
4085
+ const id = t32.identifier(`arg${index}`);
4086
+ id.typeAnnotation = t32.tsTypeAnnotation(element);
3823
4087
  return id;
3824
4088
  }
3825
4089
 
@@ -3828,8 +4092,8 @@ function resolveTupleElementParam(element, index) {
3828
4092
  function resolveDefinePropsIface(path8, ctx) {
3829
4093
  const { node } = path8;
3830
4094
  const [runtimeArg] = node.arguments;
3831
- const tsParams = _optionalChain([node, 'access', _117 => _117.typeParameters, 'optionalAccess', _118 => _118.params]);
3832
- 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])) {
3833
4097
  const { propsTSIface } = ctx.scriptData;
3834
4098
  propsTSIface.propsTypes = tsParams;
3835
4099
  return;
@@ -3844,38 +4108,38 @@ function processInferredTypes2(ctx, runtimeArg) {
3844
4108
  } = scriptData;
3845
4109
  if (!runtimeArg) return;
3846
4110
  const members = [];
3847
- if (t32.isArrayExpression(runtimeArg)) {
4111
+ if (t33.isArrayExpression(runtimeArg)) {
3848
4112
  for (const element of runtimeArg.elements) {
3849
- if (!element || !t32.isStringLiteral(element)) continue;
3850
- const key = t32.isValidIdentifier(element.value) ? t32.identifier(element.value) : t32.stringLiteral(element.value);
3851
- const prop = t32.tsPropertySignature(key, t32.tsTypeAnnotation(t32.tsAnyKeyword()));
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()));
3852
4116
  prop.optional = true;
3853
4117
  members.push(prop);
3854
4118
  }
3855
4119
  if (members.length) {
3856
- propsTypes.push(t32.tsTypeLiteral(members));
4120
+ propsTypes.push(t33.tsTypeLiteral(members));
3857
4121
  }
3858
4122
  return;
3859
4123
  }
3860
- if (t32.isObjectExpression(runtimeArg)) {
4124
+ if (t33.isObjectExpression(runtimeArg)) {
3861
4125
  for (const prop of runtimeArg.properties) {
3862
- if (!t32.isObjectProperty(prop)) continue;
3863
- if (t32.isSpreadElement(prop)) continue;
4126
+ if (!t33.isObjectProperty(prop)) continue;
4127
+ if (t33.isSpreadElement(prop)) continue;
3864
4128
  const key = prop.key;
3865
4129
  let propName = null;
3866
- if (t32.isIdentifier(key)) propName = key.name;
3867
- if (t32.isStringLiteral(key)) propName = key.value;
3868
- if (t32.isNumericLiteral(key)) propName = String(key.value);
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);
3869
4133
  if (!propName) continue;
3870
4134
  const { type, required } = resolveRuntimePropMeta(prop.value);
3871
- const tsType = _nullishCoalesce(type, () => ( t32.tsAnyKeyword()));
3872
- const tsKey = t32.isValidIdentifier(propName) ? t32.identifier(propName) : t32.stringLiteral(propName);
3873
- const tsProp = t32.tsPropertySignature(tsKey, t32.tsTypeAnnotation(tsType));
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));
3874
4138
  tsProp.optional = !required;
3875
4139
  members.push(tsProp);
3876
4140
  }
3877
4141
  if (members.length) {
3878
- propsTypes.push(t32.tsTypeLiteral(members));
4142
+ propsTypes.push(t33.tsTypeLiteral(members));
3879
4143
  }
3880
4144
  return;
3881
4145
  }
@@ -3884,47 +4148,47 @@ function processInferredTypes2(ctx, runtimeArg) {
3884
4148
  {
3885
4149
  source,
3886
4150
  file: filename,
3887
- loc: _optionalChain([runtimeArg, 'optionalAccess', _120 => _120.loc])
4151
+ loc: _optionalChain([runtimeArg, 'optionalAccess', _131 => _131.loc])
3888
4152
  }
3889
4153
  );
3890
4154
  }
3891
4155
  function resolveRuntimePropMeta(value) {
3892
- if (t32.isIdentifier(value)) {
4156
+ if (t33.isIdentifier(value)) {
3893
4157
  return {
3894
4158
  type: mapRuntimeTypeToTSType(value),
3895
4159
  required: false
3896
4160
  };
3897
4161
  }
3898
- if (t32.isArrayExpression(value)) {
4162
+ if (t33.isArrayExpression(value)) {
3899
4163
  return {
3900
4164
  type: resolveRuntimeUnionType(value),
3901
4165
  required: false
3902
4166
  };
3903
4167
  }
3904
- if (!t32.isObjectExpression(value)) {
4168
+ if (!t33.isObjectExpression(value)) {
3905
4169
  return { required: false };
3906
4170
  }
3907
4171
  let type;
3908
4172
  let required = false;
3909
4173
  for (const prop of value.properties) {
3910
- if (!t32.isObjectProperty(prop)) continue;
3911
- if (t32.isSpreadElement(prop)) continue;
4174
+ if (!t33.isObjectProperty(prop)) continue;
4175
+ if (t33.isSpreadElement(prop)) continue;
3912
4176
  const key = prop.key;
3913
- 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;
3914
4178
  if (!propName) continue;
3915
4179
  if (propName === "type") {
3916
4180
  const valueNode = prop.value;
3917
- if (t32.isArrayExpression(valueNode)) {
4181
+ if (t33.isArrayExpression(valueNode)) {
3918
4182
  type = resolveRuntimeUnionType(valueNode);
3919
4183
  continue;
3920
4184
  }
3921
- if (t32.isIdentifier(valueNode)) {
4185
+ if (t33.isIdentifier(valueNode)) {
3922
4186
  type = mapRuntimeTypeToTSType(valueNode);
3923
4187
  continue;
3924
4188
  }
3925
4189
  }
3926
4190
  if (propName === "required") {
3927
- if (t32.isBooleanLiteral(prop.value)) {
4191
+ if (t33.isBooleanLiteral(prop.value)) {
3928
4192
  required = prop.value.value;
3929
4193
  }
3930
4194
  }
@@ -3934,35 +4198,13 @@ function resolveRuntimePropMeta(value) {
3934
4198
  function resolveRuntimeUnionType(value) {
3935
4199
  const types = [];
3936
4200
  for (const element of value.elements) {
3937
- if (!element || !t32.isIdentifier(element)) continue;
4201
+ if (!element || !t33.isIdentifier(element)) continue;
3938
4202
  const resolved = mapRuntimeTypeToTSType(element);
3939
4203
  if (resolved) types.push(resolved);
3940
4204
  }
3941
- if (!types.length) return t32.tsAnyKeyword();
4205
+ if (!types.length) return t33.tsAnyKeyword();
3942
4206
  if (types.length === 1) return types[0];
3943
- return t32.tsUnionType(types);
3944
- }
3945
- function mapRuntimeTypeToTSType(value) {
3946
- switch (value.name) {
3947
- case "String":
3948
- return t32.tsStringKeyword();
3949
- case "Number":
3950
- return t32.tsNumberKeyword();
3951
- case "Boolean":
3952
- return t32.tsBooleanKeyword();
3953
- case "Object":
3954
- return t32.tsTypeLiteral([]);
3955
- case "Array":
3956
- return t32.tsArrayType(t32.tsAnyKeyword());
3957
- case "Function":
3958
- return t32.tsFunctionType(null, [], t32.tsTypeAnnotation(t32.tsAnyKeyword()));
3959
- case "Symbol":
3960
- return t32.tsSymbolKeyword();
3961
- case "BigInt":
3962
- return t32.tsBigIntKeyword();
3963
- default:
3964
- return t32.tsAnyKeyword();
3965
- }
4207
+ return t33.tsUnionType(types);
3966
4208
  }
3967
4209
 
3968
4210
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-props-interface/resolve-slot/type-resolver.ts
@@ -3975,34 +4217,34 @@ var SLOT_CHILDREN_NAME = "children";
3975
4217
  var SLOT_FN_PARAM_NAME = "props";
3976
4218
  function buildSlotPropSignature(rawName, params, optional) {
3977
4219
  const propName = rawName === SLOT_DEFAULT_NAME ? SLOT_CHILDREN_NAME : rawName;
3978
- const key = t33.isValidIdentifier(propName) ? t33.identifier(propName) : t33.stringLiteral(propName);
3979
- const reactNodeType = t33.tsTypeAnnotation(
3980
- t33.tsTypeReference(t33.identifier(REACT_API_MAP.ReactNode))
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))
3981
4223
  );
3982
4224
  let typeAnnotation;
3983
4225
  if (rawName === SLOT_DEFAULT_NAME && params.length === 0 || params.length === 0) {
3984
4226
  typeAnnotation = reactNodeType;
3985
4227
  } else {
3986
- const fnType = t33.tsFunctionType(null, params, reactNodeType);
3987
- typeAnnotation = t33.tsTypeAnnotation(fnType);
4228
+ const fnType = t34.tsFunctionType(null, params, reactNodeType);
4229
+ typeAnnotation = t34.tsTypeAnnotation(fnType);
3988
4230
  }
3989
- const prop = t33.tsPropertySignature(key, typeAnnotation);
4231
+ const prop = t34.tsPropertySignature(key, typeAnnotation);
3990
4232
  prop.optional = optional;
3991
4233
  return prop;
3992
4234
  }
3993
4235
  function createSlotScopeParam(props, ctx) {
3994
- const paramId = t33.identifier(SLOT_FN_PARAM_NAME);
4236
+ const paramId = t34.identifier(SLOT_FN_PARAM_NAME);
3995
4237
  const propsSigns = [];
3996
4238
  const { reactiveBindings } = ctx.templateData;
3997
4239
  props.forEach(({ prop, tsType }) => {
3998
- 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]);
3999
4241
  const foundBindingTypes = foundBindingValue ? expressionToTSType(foundBindingValue) : null;
4000
- const typeAnnotation = foundBindingTypes ? t33.tsTypeAnnotation(foundBindingTypes) : tsType;
4001
- const key = t33.isValidIdentifier(prop) ? t33.identifier(prop) : t33.stringLiteral(prop);
4002
- const propSign = t33.tsPropertySignature(key, typeAnnotation);
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);
4003
4245
  propsSigns.push(propSign);
4004
4246
  });
4005
- paramId.typeAnnotation = t33.tsTypeAnnotation(t33.tsTypeLiteral(propsSigns));
4247
+ paramId.typeAnnotation = t34.tsTypeAnnotation(t34.tsTypeLiteral(propsSigns));
4006
4248
  return paramId;
4007
4249
  }
4008
4250
 
@@ -4023,38 +4265,38 @@ function collectLocalTypeDeclarations(path8) {
4023
4265
  return declarations;
4024
4266
  }
4025
4267
  for (const statement of programPath.node.body) {
4026
- if (t34.isTSInterfaceDeclaration(statement)) {
4268
+ if (t35.isTSInterfaceDeclaration(statement)) {
4027
4269
  declarations.set(statement.id.name, {
4028
- type: t34.tsTypeLiteral(statement.body.body),
4270
+ type: t35.tsTypeLiteral(statement.body.body),
4029
4271
  // 将接口体转换为类型字面量
4030
- 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])
4031
4273
  // 检查是否有泛型参数
4032
4274
  });
4033
4275
  continue;
4034
4276
  }
4035
- if (t34.isTSTypeAliasDeclaration(statement)) {
4277
+ if (t35.isTSTypeAliasDeclaration(statement)) {
4036
4278
  declarations.set(statement.id.name, {
4037
4279
  type: statement.typeAnnotation,
4038
4280
  // 直接使用类型注解
4039
- 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])
4040
4282
  // 检查是否有泛型参数
4041
4283
  });
4042
4284
  continue;
4043
4285
  }
4044
- if (t34.isExportNamedDeclaration(statement) && statement.declaration) {
4286
+ if (t35.isExportNamedDeclaration(statement) && statement.declaration) {
4045
4287
  const declaration = statement.declaration;
4046
- if (t34.isTSInterfaceDeclaration(declaration)) {
4288
+ if (t35.isTSInterfaceDeclaration(declaration)) {
4047
4289
  declarations.set(declaration.id.name, {
4048
- type: t34.tsTypeLiteral(declaration.body.body),
4290
+ type: t35.tsTypeLiteral(declaration.body.body),
4049
4291
  // 将接口体转换为类型字面量
4050
- 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])
4051
4293
  // 检查是否有泛型参数
4052
4294
  });
4053
- } else if (t34.isTSTypeAliasDeclaration(declaration)) {
4295
+ } else if (t35.isTSTypeAliasDeclaration(declaration)) {
4054
4296
  declarations.set(declaration.id.name, {
4055
4297
  type: declaration.typeAnnotation,
4056
4298
  // 直接使用类型注解
4057
- 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])
4058
4300
  // 检查是否有泛型参数
4059
4301
  });
4060
4302
  }
@@ -4063,22 +4305,22 @@ function collectLocalTypeDeclarations(path8) {
4063
4305
  return declarations;
4064
4306
  }
4065
4307
  function resolvePropName2(key) {
4066
- if (t34.isIdentifier(key)) {
4308
+ if (t35.isIdentifier(key)) {
4067
4309
  return key.name;
4068
4310
  }
4069
- if (t34.isStringLiteral(key)) {
4311
+ if (t35.isStringLiteral(key)) {
4070
4312
  return key.value;
4071
4313
  }
4072
- if (t34.isNumericLiteral(key)) {
4314
+ if (t35.isNumericLiteral(key)) {
4073
4315
  return String(key.value);
4074
4316
  }
4075
4317
  return null;
4076
4318
  }
4077
4319
  function resolveCallableType(tsType) {
4078
- if (t34.isTSFunctionType(tsType)) {
4320
+ if (t35.isTSFunctionType(tsType)) {
4079
4321
  return tsType;
4080
4322
  }
4081
- if (t34.isTSParenthesizedType(tsType)) {
4323
+ if (t35.isTSParenthesizedType(tsType)) {
4082
4324
  return resolveCallableType(tsType.typeAnnotation);
4083
4325
  }
4084
4326
  return null;
@@ -4087,12 +4329,12 @@ function resolveCallableType(tsType) {
4087
4329
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-props-interface/resolve-slot/type-resolver.ts
4088
4330
  var SLOT_DEFAULT_NAME2 = "default";
4089
4331
  function resolveSlotType(tsType, options) {
4090
- if (t35.isTSParenthesizedType(tsType)) {
4332
+ if (t36.isTSParenthesizedType(tsType)) {
4091
4333
  return resolveSlotType(tsType.typeAnnotation, options);
4092
4334
  }
4093
- if (t35.isTSTypeReference(tsType)) {
4335
+ if (t36.isTSTypeReference(tsType)) {
4094
4336
  let shouldRecordReactNode = false;
4095
- 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])) {
4096
4338
  const params = [];
4097
4339
  for (const param of tsType.typeParameters.params) {
4098
4340
  const resolved2 = resolveSlotType(param, options);
@@ -4106,11 +4348,11 @@ function resolveSlotType(tsType, options) {
4106
4348
  };
4107
4349
  }
4108
4350
  return {
4109
- type: t35.tsTypeReference(tsType.typeName, t35.tsTypeParameterInstantiation(params)),
4351
+ type: t36.tsTypeReference(tsType.typeName, t36.tsTypeParameterInstantiation(params)),
4110
4352
  shouldRecordReactNode
4111
4353
  };
4112
4354
  }
4113
- if (!t35.isIdentifier(tsType.typeName)) {
4355
+ if (!t36.isIdentifier(tsType.typeName)) {
4114
4356
  return {
4115
4357
  type: tsType,
4116
4358
  shouldRecordReactNode: false
@@ -4141,7 +4383,7 @@ function resolveSlotType(tsType, options) {
4141
4383
  }
4142
4384
  return resolved;
4143
4385
  }
4144
- if (t35.isTSIntersectionType(tsType)) {
4386
+ if (t36.isTSIntersectionType(tsType)) {
4145
4387
  const types = [];
4146
4388
  let shouldRecordReactNode = false;
4147
4389
  for (const item of tsType.types) {
@@ -4164,11 +4406,11 @@ function resolveSlotType(tsType, options) {
4164
4406
  };
4165
4407
  }
4166
4408
  return {
4167
- type: t35.tsIntersectionType(types),
4409
+ type: t36.tsIntersectionType(types),
4168
4410
  shouldRecordReactNode
4169
4411
  };
4170
4412
  }
4171
- if (t35.isTSUnionType(tsType)) {
4413
+ if (t36.isTSUnionType(tsType)) {
4172
4414
  const types = [];
4173
4415
  let shouldRecordReactNode = false;
4174
4416
  for (const item of tsType.types) {
@@ -4191,11 +4433,11 @@ function resolveSlotType(tsType, options) {
4191
4433
  };
4192
4434
  }
4193
4435
  return {
4194
- type: t35.tsUnionType(types),
4436
+ type: t36.tsUnionType(types),
4195
4437
  shouldRecordReactNode
4196
4438
  };
4197
4439
  }
4198
- if (t35.isTSTypeLiteral(tsType)) {
4440
+ if (t36.isTSTypeLiteral(tsType)) {
4199
4441
  const members = [];
4200
4442
  let shouldRecordReactNode = false;
4201
4443
  for (const item of tsType.members) {
@@ -4210,11 +4452,11 @@ function resolveSlotType(tsType, options) {
4210
4452
  };
4211
4453
  }
4212
4454
  return {
4213
- type: t35.tsTypeLiteral(members),
4455
+ type: t36.tsTypeLiteral(members),
4214
4456
  shouldRecordReactNode
4215
4457
  };
4216
4458
  }
4217
- if (t35.isTSFunctionType(tsType)) {
4459
+ if (t36.isTSFunctionType(tsType)) {
4218
4460
  const props = buildSlotPropSignature(
4219
4461
  SLOT_DEFAULT_NAME2,
4220
4462
  cloneCallableParams(tsType.parameters),
@@ -4222,7 +4464,7 @@ function resolveSlotType(tsType, options) {
4222
4464
  // 默认插槽不是可选的
4223
4465
  );
4224
4466
  return {
4225
- type: t35.tsTypeLiteral([props]),
4467
+ type: t36.tsTypeLiteral([props]),
4226
4468
  shouldRecordReactNode: true
4227
4469
  // 函数类型总是需要记录 ReactNode
4228
4470
  };
@@ -4233,7 +4475,7 @@ function resolveSlotType(tsType, options) {
4233
4475
  };
4234
4476
  }
4235
4477
  function resolveSlotPropFromMember(member) {
4236
- if (t35.isTSMethodSignature(member)) {
4478
+ if (t36.isTSMethodSignature(member)) {
4237
4479
  const rawName = resolvePropName2(member.key);
4238
4480
  if (!rawName) {
4239
4481
  return {
@@ -4248,7 +4490,7 @@ function resolveSlotPropFromMember(member) {
4248
4490
  // 方法签名总是可调用,需要记录 ReactNode
4249
4491
  };
4250
4492
  }
4251
- if (t35.isTSPropertySignature(member)) {
4493
+ if (t36.isTSPropertySignature(member)) {
4252
4494
  const rawName = resolvePropName2(member.key);
4253
4495
  if (!rawName) {
4254
4496
  return {
@@ -4256,7 +4498,7 @@ function resolveSlotPropFromMember(member) {
4256
4498
  shouldRecordReactNode: false
4257
4499
  };
4258
4500
  }
4259
- 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]);
4260
4502
  const callable = typeAnnotation ? resolveCallableType(typeAnnotation) : null;
4261
4503
  if (!callable) {
4262
4504
  return {
@@ -4271,7 +4513,7 @@ function resolveSlotPropFromMember(member) {
4271
4513
  // 可调用属性需要记录 ReactNode
4272
4514
  };
4273
4515
  }
4274
- if (t35.isTSCallSignatureDeclaration(member)) {
4516
+ if (t36.isTSCallSignatureDeclaration(member)) {
4275
4517
  const params = cloneCallableParams(member.parameters);
4276
4518
  return {
4277
4519
  member: buildSlotPropSignature(SLOT_DEFAULT_NAME2, params, true),
@@ -4288,8 +4530,8 @@ function resolveSlotPropFromMember(member) {
4288
4530
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-props-interface/resolve-slot/define-slots.ts
4289
4531
  function resolveDefineSlotsIface(path8, ctx) {
4290
4532
  const { node } = path8;
4291
- const tsParams = _optionalChain([node, 'access', _140 => _140.typeParameters, 'optionalAccess', _141 => _141.params]);
4292
- 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;
4293
4535
  const {
4294
4536
  propsTSIface: { slotTypes }
4295
4537
  } = ctx.scriptData;
@@ -4329,7 +4571,7 @@ function resolveTemplateSlotIface(ctx) {
4329
4571
  }
4330
4572
  if (tsMembers.length) {
4331
4573
  recordReactNode(ctx);
4332
- slotTypes.push(t36.tsTypeLiteral(tsMembers));
4574
+ slotTypes.push(t37.tsTypeLiteral(tsMembers));
4333
4575
  }
4334
4576
  }
4335
4577
 
@@ -4381,9 +4623,9 @@ function resolveCompIProps(ctx, ast) {
4381
4623
  }
4382
4624
  const n = declaredOptions.name || "Comp";
4383
4625
  const ns = `I${camelCase(capitalize(n))}Props`;
4384
- const typeNode = t37.tsIntersectionType(tsTypes);
4385
- const typeAliasDecl = t37.tsTypeAliasDeclaration(t37.identifier(ns), null, typeNode);
4386
- 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);
4387
4629
  propsTSIface.name = ns;
4388
4630
  const scriptIR = getScriptIR(ctx);
4389
4631
  scriptIR.exports.push(exportDecl);
@@ -4398,8 +4640,8 @@ function resolveUseAttrs(ctx) {
4398
4640
  const { init, id } = path8.node;
4399
4641
  if (!init) return;
4400
4642
  const initPath = path8.get("init");
4401
- const propsIdentifier = t38.identifier(ctx.propField);
4402
- if (t38.isTSAsExpression(init) && isUseAttrsCall(init.expression)) {
4643
+ const propsIdentifier = t39.identifier(ctx.propField);
4644
+ if (t39.isTSAsExpression(init) && isUseAttrsCall(init.expression)) {
4403
4645
  const typeAssertion = createPropsTypeAssertion(propsIdentifier, init.typeAnnotation);
4404
4646
  replaceNode(initPath, typeAssertion, init);
4405
4647
  return;
@@ -4410,13 +4652,13 @@ function resolveUseAttrs(ctx) {
4410
4652
  const isTS = ctx.scriptData.lang.startsWith("ts");
4411
4653
  if (isTS) {
4412
4654
  let typeAnnotation = null;
4413
- if (t38.isIdentifier(id) && t38.isTSTypeAnnotation(id.typeAnnotation)) {
4655
+ if (t39.isIdentifier(id) && t39.isTSTypeAnnotation(id.typeAnnotation)) {
4414
4656
  typeAnnotation = id.typeAnnotation.typeAnnotation;
4415
4657
  id.typeAnnotation = null;
4416
4658
  } else {
4417
- typeAnnotation = t38.tsTypeReference(
4418
- t38.identifier("Record"),
4419
- t38.tsTypeParameterInstantiation([t38.tsStringKeyword(), t38.tsUnknownKeyword()])
4659
+ typeAnnotation = t39.tsTypeReference(
4660
+ t39.identifier("Record"),
4661
+ t39.tsTypeParameterInstantiation([t39.tsStringKeyword(), t39.tsUnknownKeyword()])
4420
4662
  );
4421
4663
  }
4422
4664
  const propsTypeAssertion = createPropsTypeAssertion(propsIdentifier, typeAnnotation);
@@ -4428,10 +4670,10 @@ function resolveUseAttrs(ctx) {
4428
4670
  };
4429
4671
  }
4430
4672
  function isUseAttrsCall(expr) {
4431
- return t38.isCallExpression(expr) && isCalleeNamed(expr, VUE_API_MAP.useAttrs);
4673
+ return t39.isCallExpression(expr) && isCalleeNamed(expr, VUE_API_MAP.useAttrs);
4432
4674
  }
4433
4675
  function createPropsTypeAssertion(propsIdentifier, typeAnnotation) {
4434
- return t38.tsAsExpression(propsIdentifier, typeAnnotation);
4676
+ return t39.tsAsExpression(propsIdentifier, typeAnnotation);
4435
4677
  }
4436
4678
 
4437
4679
  // src/core/transform/sfc/script/syntax-processor/process/resolve-analysis-only-adapter.ts
@@ -4454,7 +4696,7 @@ function isBindingDeclaredInsideBoundary(binding, boundary) {
4454
4696
  }
4455
4697
  function isReactiveBinding(node) {
4456
4698
  if (!node) return false;
4457
- 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]);
4458
4700
  }
4459
4701
 
4460
4702
  // src/core/transform/sfc/script/shared/dependency-analyzer/dep-checker.ts
@@ -4467,40 +4709,40 @@ function isEligibleBindingSource(binding) {
4467
4709
  const bindingPath = binding.path;
4468
4710
  const declaratorPath = getVariableDeclaratorPath(bindingPath);
4469
4711
  const isReactiveVarBinding = !!declaratorPath && isReactiveBinding(declaratorPath.node);
4470
- const nodeInit = _optionalChain([declaratorPath, 'optionalAccess', _145 => _145.node, 'access', _146 => _146.init]);
4471
- const isReactiveApiCallVarBinding = !!declaratorPath && t39.isCallExpression(nodeInit) && t39.isIdentifier(nodeInit.callee) && reactiveStateApis.has(nodeInit.callee.name);
4472
- const isHookCallVarBinding = !!declaratorPath && t39.isCallExpression(nodeInit) && isHookLikeCallee(nodeInit.callee);
4473
- const isFunctionBinding = bindingPath.isFunctionDeclaration() || !!declaratorPath && !!nodeInit && (t39.isArrowFunctionExpression(nodeInit) || t39.isFunctionExpression(nodeInit));
4474
- 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));
4475
4717
  return isReactiveVarBinding || isReactiveApiCallVarBinding || isHookCallVarBinding || isReactiveFunctionBinding;
4476
4718
  }
4477
4719
  function isReactValidDependencyExpr(node) {
4478
- if (t39.isIdentifier(node)) {
4720
+ if (t40.isIdentifier(node)) {
4479
4721
  return true;
4480
4722
  }
4481
- if (t39.isMemberExpression(node) || t39.isOptionalMemberExpression(node)) {
4723
+ if (t40.isMemberExpression(node) || t40.isOptionalMemberExpression(node)) {
4482
4724
  return isStaticMemberChain(node);
4483
4725
  }
4484
4726
  return false;
4485
4727
  }
4486
4728
  function isStaticMemberChain(node) {
4487
4729
  let current = node;
4488
- while (t39.isMemberExpression(current) || t39.isOptionalMemberExpression(current)) {
4489
- if (!current.computed && !t39.isIdentifier(current.property)) {
4730
+ while (t40.isMemberExpression(current) || t40.isOptionalMemberExpression(current)) {
4731
+ if (!current.computed && !t40.isIdentifier(current.property)) {
4490
4732
  return false;
4491
4733
  }
4492
- if (current.computed && !t39.isStringLiteral(current.property) && !t39.isNumericLiteral(current.property)) {
4734
+ if (current.computed && !t40.isStringLiteral(current.property) && !t40.isNumericLiteral(current.property)) {
4493
4735
  return false;
4494
4736
  }
4495
4737
  current = current.object;
4496
4738
  }
4497
- return t39.isIdentifier(current);
4739
+ return t40.isIdentifier(current);
4498
4740
  }
4499
4741
  function isHookLikeCallee(callee) {
4500
- if (t39.isIdentifier(callee)) {
4742
+ if (t40.isIdentifier(callee)) {
4501
4743
  return callee.name.startsWith("use");
4502
4744
  }
4503
- if (t39.isMemberExpression(callee) && !callee.computed && t39.isIdentifier(callee.property)) {
4745
+ if (t40.isMemberExpression(callee) && !callee.computed && t40.isIdentifier(callee.property)) {
4504
4746
  return callee.property.name.startsWith("use");
4505
4747
  }
4506
4748
  return false;
@@ -4509,16 +4751,16 @@ function isHookLikeCallee(callee) {
4509
4751
  // src/core/transform/sfc/script/shared/dependency-analyzer/dep-key.ts
4510
4752
 
4511
4753
  function getDependencyKey(exp) {
4512
- if (t40.isIdentifier(exp)) {
4754
+ if (t41.isIdentifier(exp)) {
4513
4755
  return exp.name;
4514
4756
  }
4515
- if (t40.isMemberExpression(exp) || t40.isOptionalMemberExpression(exp)) {
4757
+ if (t41.isMemberExpression(exp) || t41.isOptionalMemberExpression(exp)) {
4516
4758
  const objectKey = getDependencyKey(exp.object);
4517
4759
  const opt = exp.optional ? "?" : "";
4518
- if (!exp.computed && t40.isIdentifier(exp.property)) {
4760
+ if (!exp.computed && t41.isIdentifier(exp.property)) {
4519
4761
  return `${objectKey}${opt}.${exp.property.name}`;
4520
4762
  }
4521
- if (t40.isStringLiteral(exp.property) || t40.isNumericLiteral(exp.property)) {
4763
+ if (t41.isStringLiteral(exp.property) || t41.isNumericLiteral(exp.property)) {
4522
4764
  return `${objectKey}${opt}[${JSON.stringify(exp.property.value)}]`;
4523
4765
  }
4524
4766
  return `${objectKey}${opt}[*]`;
@@ -4529,38 +4771,38 @@ function getDependencyKey(exp) {
4529
4771
  // src/core/transform/sfc/script/shared/dependency-analyzer/dep-normalizer.ts
4530
4772
 
4531
4773
  function normalizeDependencyExpr(path8, rootName, ctx) {
4532
- if (t41.isIdentifier(path8.node)) {
4533
- return t41.identifier(path8.node.name);
4774
+ if (t42.isIdentifier(path8.node)) {
4775
+ return t42.identifier(path8.node.name);
4534
4776
  }
4535
- if (t41.isMemberExpression(path8.node) || t41.isOptionalMemberExpression(path8.node)) {
4777
+ if (t42.isMemberExpression(path8.node) || t42.isOptionalMemberExpression(path8.node)) {
4536
4778
  if (rootName === ctx.propField) {
4537
4779
  const safePropsExp = ensureOptionalForMemberChain(path8.node);
4538
4780
  if (isReactValidDependencyExpr(safePropsExp)) {
4539
- return t41.cloneNode(safePropsExp, true);
4781
+ return t42.cloneNode(safePropsExp, true);
4540
4782
  }
4541
- return t41.identifier(rootName);
4783
+ return t42.identifier(rootName);
4542
4784
  }
4543
4785
  const normalizedExp = normalizeMemberForCallSite(path8, path8.node);
4544
- const safeExp = t41.isMemberExpression(normalizedExp) || t41.isOptionalMemberExpression(normalizedExp) ? ensureOptionalForMemberChain(normalizedExp) : normalizedExp;
4786
+ const safeExp = t42.isMemberExpression(normalizedExp) || t42.isOptionalMemberExpression(normalizedExp) ? ensureOptionalForMemberChain(normalizedExp) : normalizedExp;
4545
4787
  if (isReactValidDependencyExpr(safeExp)) {
4546
- return t41.cloneNode(safeExp, true);
4788
+ return t42.cloneNode(safeExp, true);
4547
4789
  }
4548
- return t41.identifier(rootName);
4790
+ return t42.identifier(rootName);
4549
4791
  }
4550
4792
  return null;
4551
4793
  }
4552
4794
  function normalizeSourcedDependency(exp) {
4553
- if (t41.isIdentifier(exp)) {
4554
- return t41.identifier(exp.name);
4795
+ if (t42.isIdentifier(exp)) {
4796
+ return t42.identifier(exp.name);
4555
4797
  }
4556
- if (t41.isMemberExpression(exp) || t41.isOptionalMemberExpression(exp)) {
4798
+ if (t42.isMemberExpression(exp) || t42.isOptionalMemberExpression(exp)) {
4557
4799
  const root = findRootIdentifier(exp);
4558
4800
  if (!root) return null;
4559
- const safeExp = t41.isMemberExpression(exp) || t41.isOptionalMemberExpression(exp) ? ensureOptionalForMemberChain(exp) : exp;
4801
+ const safeExp = t42.isMemberExpression(exp) || t42.isOptionalMemberExpression(exp) ? ensureOptionalForMemberChain(exp) : exp;
4560
4802
  if (isReactValidDependencyExpr(safeExp)) {
4561
- return t41.cloneNode(safeExp, true);
4803
+ return t42.cloneNode(safeExp, true);
4562
4804
  }
4563
- return t41.identifier(root.name);
4805
+ return t42.identifier(root.name);
4564
4806
  }
4565
4807
  return null;
4566
4808
  }
@@ -4570,7 +4812,7 @@ function normalizeMemberForCallSite(path8, node) {
4570
4812
  if (!isDirectCallee) {
4571
4813
  return node;
4572
4814
  }
4573
- if (!t41.isExpression(node.object)) {
4815
+ if (!t42.isExpression(node.object)) {
4574
4816
  return node;
4575
4817
  }
4576
4818
  return node.object;
@@ -4582,20 +4824,20 @@ function ensureOptionalForMemberChain(node) {
4582
4824
  const rebuildWithOptionalChain = (node2) => {
4583
4825
  const safeObject = ensureOptionalForMemberChain(node2.object);
4584
4826
  if (safeObject !== node2.object) {
4585
- const property = t41.cloneNode(node2.property, true);
4586
- 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);
4587
4829
  }
4588
- if (t41.isMemberExpression(node2)) {
4589
- const object = t41.cloneNode(node2.object, true);
4590
- const property = t41.cloneNode(node2.property, true);
4591
- return t41.optionalMemberExpression(object, property, node2.computed, true);
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);
4592
4834
  }
4593
4835
  return node2;
4594
4836
  };
4595
4837
  return rebuildWithOptionalChain(node);
4596
4838
  }
4597
4839
  function hasTrailingMemberAccess(node) {
4598
- return t41.isMemberExpression(node.object) || t41.isOptionalMemberExpression(node.object);
4840
+ return t42.isMemberExpression(node.object) || t42.isOptionalMemberExpression(node.object);
4599
4841
  }
4600
4842
 
4601
4843
  // src/core/transform/sfc/script/shared/dependency-analyzer/shared-utils.ts
@@ -4622,7 +4864,7 @@ function traceBindingSource(binding, seen, depth) {
4622
4864
  }
4623
4865
  function isExpressionSourcedFromEligibleBinding(exp, scope, seen, depth) {
4624
4866
  if (depth <= 0) return null;
4625
- if (t42.isIdentifier(exp)) {
4867
+ if (t43.isIdentifier(exp)) {
4626
4868
  const sourceBinding = scope.getBinding(exp.name);
4627
4869
  if (!sourceBinding) return null;
4628
4870
  if (isEligibleBindingSource(sourceBinding)) {
@@ -4630,13 +4872,13 @@ function isExpressionSourcedFromEligibleBinding(exp, scope, seen, depth) {
4630
4872
  }
4631
4873
  return traceBindingSource(sourceBinding, seen, depth - 1);
4632
4874
  }
4633
- if (t42.isMemberExpression(exp) || t42.isOptionalMemberExpression(exp)) {
4875
+ if (t43.isMemberExpression(exp) || t43.isOptionalMemberExpression(exp)) {
4634
4876
  const root = findRootIdentifier(exp);
4635
4877
  if (!root) return null;
4636
4878
  const sourceBinding = scope.getBinding(root.name);
4637
4879
  if (!sourceBinding) return null;
4638
4880
  if (isEligibleBindingSource(sourceBinding)) {
4639
- return t42.cloneNode(exp);
4881
+ return t43.cloneNode(exp);
4640
4882
  }
4641
4883
  const sourcedRoot = traceBindingSource(sourceBinding, seen, depth - 1);
4642
4884
  if (sourcedRoot) {
@@ -4644,17 +4886,17 @@ function isExpressionSourcedFromEligibleBinding(exp, scope, seen, depth) {
4644
4886
  if (rebuilt) {
4645
4887
  return rebuilt;
4646
4888
  }
4647
- return t42.cloneNode(sourcedRoot, true);
4889
+ return t43.cloneNode(sourcedRoot, true);
4648
4890
  }
4649
4891
  }
4650
4892
  return null;
4651
4893
  }
4652
4894
  function rebuildMemberWithNewRoot(node, nextRoot) {
4653
4895
  const replacedObject = (() => {
4654
- if (t42.isIdentifier(node.object)) {
4655
- return t42.cloneNode(nextRoot, true);
4896
+ if (t43.isIdentifier(node.object)) {
4897
+ return t43.cloneNode(nextRoot, true);
4656
4898
  }
4657
- if (t42.isMemberExpression(node.object) || t42.isOptionalMemberExpression(node.object)) {
4899
+ if (t43.isMemberExpression(node.object) || t43.isOptionalMemberExpression(node.object)) {
4658
4900
  return rebuildMemberWithNewRoot(node.object, nextRoot);
4659
4901
  }
4660
4902
  return null;
@@ -4662,15 +4904,15 @@ function rebuildMemberWithNewRoot(node, nextRoot) {
4662
4904
  if (!replacedObject) {
4663
4905
  return null;
4664
4906
  }
4665
- const property = t42.cloneNode(node.property, true);
4666
- if (t42.isMemberExpression(node)) {
4667
- return t42.memberExpression(
4907
+ const property = t43.cloneNode(node.property, true);
4908
+ if (t43.isMemberExpression(node)) {
4909
+ return t43.memberExpression(
4668
4910
  replacedObject,
4669
4911
  property,
4670
4912
  node.computed
4671
4913
  );
4672
4914
  }
4673
- return t42.optionalMemberExpression(
4915
+ return t43.optionalMemberExpression(
4674
4916
  replacedObject,
4675
4917
  property,
4676
4918
  node.computed,
@@ -4681,9 +4923,9 @@ function rebuildMemberWithNewRoot(node, nextRoot) {
4681
4923
  // src/core/transform/sfc/script/shared/dependency-analyzer/index.ts
4682
4924
  function analyzeDeps(node, ctx, parentPath) {
4683
4925
  if (!parentPath) {
4684
- return t43.arrayExpression([]);
4926
+ return t44.arrayExpression([]);
4685
4927
  }
4686
- const isFnExpr = t43.isArrowFunctionExpression(node) || t43.isFunctionExpression(node);
4928
+ const isFnExpr = t44.isArrowFunctionExpression(node) || t44.isFunctionExpression(node);
4687
4929
  const analyzeTarget = isFnExpr ? node.body : node;
4688
4930
  const bindingLocalBoundary = isFnExpr ? node : analyzeTarget;
4689
4931
  const deps = /* @__PURE__ */ new Map();
@@ -4693,13 +4935,13 @@ function analyzeDeps(node, ctx, parentPath) {
4693
4935
  }
4694
4936
  const analyzeTargetPath = parentPath && parentPath.node === analyzeTarget ? parentPath : null;
4695
4937
  if (analyzeTargetPath) {
4696
- if (t43.isMemberExpression(analyzeTarget) || t43.isOptionalMemberExpression(analyzeTarget)) {
4938
+ if (t44.isMemberExpression(analyzeTarget) || t44.isOptionalMemberExpression(analyzeTarget)) {
4697
4939
  const rootId = findRootIdentifier(analyzeTarget);
4698
4940
  if (rootId) {
4699
4941
  tryAddDependency(analyzeTargetPath, rootId.name, analyzeTargetPath.scope);
4700
4942
  processedIdentifiers.add(rootId);
4701
4943
  }
4702
- } else if (t43.isIdentifier(analyzeTarget)) {
4944
+ } else if (t44.isIdentifier(analyzeTarget)) {
4703
4945
  tryAddDependency(analyzeTargetPath, analyzeTarget.name, analyzeTargetPath.scope);
4704
4946
  }
4705
4947
  }
@@ -4751,7 +4993,7 @@ function analyzeDeps(node, ctx, parentPath) {
4751
4993
  }
4752
4994
  }
4753
4995
  }
4754
- return t43.arrayExpression(Array.from(deps.values()));
4996
+ return t44.arrayExpression(Array.from(deps.values()));
4755
4997
  }
4756
4998
 
4757
4999
  // src/core/transform/sfc/script/syntax-processor/process/resolve-analysis-only-adapter.ts
@@ -4767,7 +5009,7 @@ function resolveAnalysisOnlyAdapter(ctx) {
4767
5009
  if (!isVueApiReference(path8, apiName)) {
4768
5010
  return;
4769
5011
  }
4770
- if (t44.isCallExpression(node)) {
5012
+ if (t45.isCallExpression(node)) {
4771
5013
  resolveCallNode(path8, adapter, ctx);
4772
5014
  } else {
4773
5015
  replaceIdName(node, adapter.target);
@@ -4777,11 +5019,11 @@ function resolveAnalysisOnlyAdapter(ctx) {
4777
5019
  };
4778
5020
  }
4779
5021
  function getApiName(node) {
4780
- const isCallNode = t44.isCallExpression(node);
5022
+ const isCallNode = t45.isCallExpression(node);
4781
5023
  let apiName = "";
4782
- if (t44.isIdentifier(node)) {
5024
+ if (t45.isIdentifier(node)) {
4783
5025
  apiName = node.name;
4784
- } else if (isCallNode && t44.isIdentifier(node.callee)) {
5026
+ } else if (isCallNode && t45.isIdentifier(node.callee)) {
4785
5027
  apiName = node.callee.name;
4786
5028
  }
4787
5029
  return apiName;
@@ -4791,7 +5033,7 @@ function resolveCallNode(path8, adapter, ctx) {
4791
5033
  const { arguments: args } = node;
4792
5034
  if (!args.length) return;
4793
5035
  const fn = args[0];
4794
- if (!t44.isArrowFunctionExpression(fn) && !t44.isFunctionExpression(fn)) {
5036
+ if (!t45.isArrowFunctionExpression(fn) && !t45.isFunctionExpression(fn)) {
4795
5037
  return;
4796
5038
  }
4797
5039
  const fnPath = path8.get("arguments")[0];
@@ -4822,8 +5064,8 @@ function isVueImportBinding(binding) {
4822
5064
  if (!bindingPath.isImportSpecifier() && !bindingPath.isImportDefaultSpecifier() && !bindingPath.isImportNamespaceSpecifier()) {
4823
5065
  return false;
4824
5066
  }
4825
- const parent = _optionalChain([bindingPath, 'access', _148 => _148.parentPath, 'optionalAccess', _149 => _149.node]);
4826
- if (!parent || !t44.isImportDeclaration(parent)) {
5067
+ const parent = _optionalChain([bindingPath, 'access', _159 => _159.parentPath, 'optionalAccess', _160 => _160.node]);
5068
+ if (!parent || !t45.isImportDeclaration(parent)) {
4827
5069
  return false;
4828
5070
  }
4829
5071
  const source = parent.source.value.toLowerCase();
@@ -4849,7 +5091,7 @@ function resolveArrowFnDeps(ctx, ast) {
4849
5091
  const newNode = createUseCallback(node, deps);
4850
5092
  const declaratorPath = getVariableDeclaratorPath(path8);
4851
5093
  recordImport(ctx, PACKAGE_NAME.react, REACT_API_MAP.useCallback);
4852
- 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" });
4853
5095
  replaceNode(path8, newNode, node);
4854
5096
  }
4855
5097
  };
@@ -4908,15 +5150,15 @@ function resolveElementRef(ctx) {
4908
5150
  return;
4909
5151
  }
4910
5152
  if (isCompRefBindings) {
4911
- const varDeclaratorPath = _optionalChain([getVariableDeclaratorPath, 'call', _151 => _151(path8), 'optionalAccess', _152 => _152.node]);
4912
- 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]))) {
4913
5155
  return;
4914
5156
  }
4915
5157
  const varName = varDeclaratorPath.id.name;
4916
5158
  const compRef = refBindings.componentRefs[varName];
4917
5159
  if (!compRef) return;
4918
5160
  }
4919
- node.arguments[0] = t45.identifier("null");
5161
+ node.arguments[0] = t46.identifier("null");
4920
5162
  resolveTypeParameters(ctx, path8);
4921
5163
  replaceCallName(node, REACT_API_MAP.useRef);
4922
5164
  recordImport(ctx, PACKAGE_NAME.react, REACT_API_MAP.useRef);
@@ -4932,7 +5174,7 @@ function resolveTypeParameters(ctx, path8) {
4932
5174
  scriptData
4933
5175
  } = ctx;
4934
5176
  const { node } = path8;
4935
- 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]);
4936
5178
  if (!scriptData.lang.startsWith("ts") || !varDeclaratorNode) {
4937
5179
  return;
4938
5180
  }
@@ -4941,20 +5183,20 @@ function resolveTypeParameters(ctx, path8) {
4941
5183
  const compBindingMeta = refBindings.componentRefs[idName];
4942
5184
  if (!node.typeParameters && (domBindingMeta || compBindingMeta)) {
4943
5185
  const type = compBindingMeta ? "any" : domBindingMeta.htmlType;
4944
- node.typeParameters = t45.tsTypeParameterInstantiation([t45.tsTypeReference(t45.identifier(type))]);
5186
+ node.typeParameters = t46.tsTypeParameterInstantiation([t46.tsTypeReference(t46.identifier(type))]);
4945
5187
  }
4946
5188
  }
4947
5189
  function resolveRefValueToCurrent(path8) {
4948
5190
  const { node } = path8;
4949
- if (node.computed || !t45.isIdentifier(node.property) || node.property.name !== "value") {
5191
+ if (node.computed || !t46.isIdentifier(node.property) || node.property.name !== "value") {
4950
5192
  return;
4951
5193
  }
4952
5194
  const rootPath = findRootVariablePath(path8);
4953
- 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)) {
4954
5196
  return;
4955
5197
  }
4956
5198
  const rootId = findRootIdentifier(node);
4957
- 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])) {
4958
5200
  return;
4959
5201
  }
4960
5202
  node.property.name = "current";
@@ -4973,11 +5215,11 @@ function resolveExprMemo(ctx, ast) {
4973
5215
  if (!atComponentOrHookRoot(path8, ast.program, isScriptFile)) {
4974
5216
  return false;
4975
5217
  }
4976
- if (!t46.isVariableDeclaration(path8.parent) || path8.parent.kind !== "const") {
5218
+ if (!t47.isVariableDeclaration(path8.parent) || path8.parent.kind !== "const") {
4977
5219
  return false;
4978
5220
  }
4979
- if (t46.isFunction(init)) return false;
4980
- 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")) {
4981
5223
  return false;
4982
5224
  }
4983
5225
  return true;
@@ -5002,10 +5244,10 @@ function resolveLintRules(ctx, ast) {
5002
5244
  return {
5003
5245
  CallExpression(path8) {
5004
5246
  const { node, parentPath } = path8;
5005
- if (!t47.isIdentifier(node.callee)) return;
5247
+ if (!t48.isIdentifier(node.callee)) return;
5006
5248
  const { name: callName } = node.callee;
5007
- const addLog = (t53) => {
5008
- logger.error(t53, {
5249
+ const addLog = (t54) => {
5250
+ logger.error(t54, {
5009
5251
  file: ctx.filename,
5010
5252
  source: ctx.scriptData.source,
5011
5253
  loc: node.loc
@@ -5052,14 +5294,25 @@ function resolveLintRules(ctx, ast) {
5052
5294
 
5053
5295
 
5054
5296
  function resolveProvide(ctx) {
5055
- if (ctx.inputType === "style") return {};
5297
+ const { filename, scriptData, inputType } = ctx;
5298
+ if (inputType !== "sfc") {
5299
+ return {};
5300
+ }
5056
5301
  return {
5057
5302
  CallExpression(path8) {
5058
5303
  const { node } = path8;
5059
- const providerTarget = _optionalChain([ADAPTER_RULES, 'access', _158 => _158.runtime, 'access', _159 => _159[VUE_API_MAP.provide], 'optionalAccess', _160 => _160.target]);
5304
+ if (inputType.startsWith("script")) {
5305
+ logger.error("provide() call found outside of SFC <script setup> context.", {
5306
+ file: filename,
5307
+ source: scriptData.source,
5308
+ loc: node.loc
5309
+ });
5310
+ return;
5311
+ }
5312
+ const providerTarget = _optionalChain([ADAPTER_RULES, 'access', _169 => _169.runtime, 'access', _170 => _170[VUE_API_MAP.provide], 'optionalAccess', _171 => _171.target]);
5060
5313
  const isProvideCall = isCalleeNamed(node, VUE_API_MAP.provide) || providerTarget && isCalleeNamed(node, providerTarget);
5061
5314
  if (!isProvideCall) return;
5062
- const { provide } = ctx.scriptData;
5315
+ const { provide } = scriptData;
5063
5316
  const [key, value] = node.arguments;
5064
5317
  const target = findOrCreateCtxProvider(provide);
5065
5318
  const adapter = ADAPTER_RULES.runtime[VUE_API_MAP.provide];
@@ -5074,7 +5327,7 @@ function findOrCreateCtxProvider(root) {
5074
5327
  return root;
5075
5328
  }
5076
5329
  let cur = root.provide;
5077
- while (_optionalChain([cur, 'optionalAccess', _161 => _161.isOccupied])) {
5330
+ while (_optionalChain([cur, 'optionalAccess', _172 => _172.isOccupied])) {
5078
5331
  cur = _nullishCoalesce(cur.provide, () => ( {}));
5079
5332
  }
5080
5333
  return cur || (root.provide = {});
@@ -5082,13 +5335,13 @@ function findOrCreateCtxProvider(root) {
5082
5335
  function assignProviderValue(target, key, value) {
5083
5336
  const getRawExp = (exp) => {
5084
5337
  if (!exp) return "''";
5085
- if (t48.isStringLiteral(exp)) {
5338
+ if (t49.isStringLiteral(exp)) {
5086
5339
  return JSON.stringify(exp.value);
5087
5340
  }
5088
- if (t48.isNumericLiteral(exp)) {
5341
+ if (t49.isNumericLiteral(exp)) {
5089
5342
  return exp.value.toString();
5090
5343
  }
5091
- if (t48.isIdentifier(exp)) {
5344
+ if (t49.isIdentifier(exp)) {
5092
5345
  return exp.name;
5093
5346
  }
5094
5347
  try {
@@ -5109,11 +5362,11 @@ function resolveRenameAdapter(ctx) {
5109
5362
  return {
5110
5363
  "CallExpression|Identifier"(path8) {
5111
5364
  const node = path8.node;
5112
- const isCallNode = t49.isCallExpression(node);
5365
+ const isCallNode = t50.isCallExpression(node);
5113
5366
  let apiName = "";
5114
- if (t49.isIdentifier(node)) {
5367
+ if (t50.isIdentifier(node)) {
5115
5368
  apiName = node.name;
5116
- } else if (isCallNode && t49.isIdentifier(node.callee)) {
5369
+ } else if (isCallNode && t50.isIdentifier(node.callee)) {
5117
5370
  apiName = node.callee.name;
5118
5371
  }
5119
5372
  if (!apiName) {
@@ -5131,7 +5384,7 @@ function resolveRenameAdapter(ctx) {
5131
5384
  if (adapter.isTrackable) {
5132
5385
  const reactiveType = getReactiveType(apiName);
5133
5386
  const declaratorPath = getVariableDeclaratorPath(path8);
5134
- setScriptNodeMeta(_optionalChain([declaratorPath, 'optionalAccess', _162 => _162.node]), {
5387
+ setScriptNodeMeta(_optionalChain([declaratorPath, 'optionalAccess', _173 => _173.node]), {
5135
5388
  is_reactive: true,
5136
5389
  reactive_type: reactiveType
5137
5390
  });
@@ -5174,8 +5427,8 @@ function isVueImportBinding2(binding) {
5174
5427
  if (!bindingPath.isImportSpecifier() && !bindingPath.isImportDefaultSpecifier() && !bindingPath.isImportNamespaceSpecifier()) {
5175
5428
  return false;
5176
5429
  }
5177
- const parent = _optionalChain([bindingPath, 'access', _163 => _163.parentPath, 'optionalAccess', _164 => _164.node]);
5178
- if (!parent || !t49.isImportDeclaration(parent)) {
5430
+ const parent = _optionalChain([bindingPath, 'access', _174 => _174.parentPath, 'optionalAccess', _175 => _175.node]);
5431
+ if (!parent || !t50.isImportDeclaration(parent)) {
5179
5432
  return false;
5180
5433
  }
5181
5434
  const source = parent.source.value.toLowerCase();
@@ -5200,17 +5453,18 @@ function processVueSyntax2(ast, ctx) {
5200
5453
  resolveDefineAsyncComponent,
5201
5454
  resolveEmitCalls,
5202
5455
  // feature: https://github.com/vureact-js/core/issues/6
5203
- resolveUseAttrs
5456
+ resolveUseAttrs,
5457
+ // feature: https://github.com/vureact-js/core/issues/56
5458
+ resolveDefineModel
5204
5459
  ]
5205
5460
  },
5206
5461
  process: {
5207
5462
  applyBabel: [
5208
5463
  resolveElementRef,
5209
- // provide 需要在 rename 之前收集并移除原始调用,避免被重命名后失配
5210
- resolveProvide,
5211
5464
  resolveRenameAdapter,
5212
- // fix:在分析函数前分析可优化为 useMemo 的顶层变量声明,
5213
- // 使得后续能够被函数依赖分析
5465
+ // fix: https://github.com/vureact-js/core/issues/46
5466
+ resolveProvide,
5467
+ // fix:在分析函数前分析可优化为 useMemo 的顶层变量声明,使得后续能够被函数依赖分析
5214
5468
  resolveExprMemo,
5215
5469
  resolveArrowFnDeps,
5216
5470
  resolveAnalysisOnlyAdapter,
@@ -5231,12 +5485,12 @@ function processVueSyntax2(ast, ctx) {
5231
5485
  }
5232
5486
  function vueSyntaxProcessor2(ast, ctx, options) {
5233
5487
  const runExcludeThenApply = (cfg) => {
5234
- _optionalChain([cfg, 'access', _165 => _165.excludeBabel, 'optionalAccess', _166 => _166.forEach, 'call', _167 => _167((fn) => fn(ctx, ast))]);
5235
- _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)))]);
5236
5490
  };
5237
5491
  const runApplyThenExclude = (cfg) => {
5238
- _optionalChain([cfg, 'access', _171 => _171.applyBabel, 'optionalAccess', _172 => _172.forEach, 'call', _173 => _173((fn) => _core.traverse.call(void 0, ast, fn(ctx, ast)))]);
5239
- _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))]);
5240
5494
  };
5241
5495
  runExcludeThenApply(options.preprocess);
5242
5496
  runExcludeThenApply(options.process);
@@ -5244,7 +5498,6 @@ function vueSyntaxProcessor2(ast, ctx, options) {
5244
5498
  }
5245
5499
 
5246
5500
  // src/core/transform/sfc/script/index.ts
5247
- var SCRIPT_IR_KEY = "__vureact_script_block_ir";
5248
5501
  function resolveScript2(ast, ctx) {
5249
5502
  const scriptIR = createScriptIR();
5250
5503
  setScriptIR(ctx, scriptIR);
@@ -5258,14 +5511,14 @@ function resolveScript2(ast, ctx) {
5258
5511
  return scriptIR;
5259
5512
  }
5260
5513
  function getScriptIR(ctx) {
5261
- const ir = ctx.scriptData[SCRIPT_IR_KEY];
5514
+ const ir = ctx.scriptData.__vureact_script_block_ir;
5262
5515
  if (!ir) {
5263
5516
  throw new Error("Script IR is not initialized for current compilation context");
5264
5517
  }
5265
5518
  return ir;
5266
5519
  }
5267
5520
  function setScriptIR(ctx, ir) {
5268
- ctx.scriptData[SCRIPT_IR_KEY] = ir;
5521
+ ctx.scriptData.__vureact_script_block_ir = ir;
5269
5522
  }
5270
5523
  function createScriptIR() {
5271
5524
  return {
@@ -5323,9 +5576,9 @@ function isRouterLinkBooleanCustomProp(prop) {
5323
5576
 
5324
5577
 
5325
5578
  var strCodeTypes = {
5326
- isIdentifier: isIdentifier29,
5579
+ isIdentifier: isIdentifier30,
5327
5580
  isSimpleExpression,
5328
- isStringLiteral: isStringLiteral13
5581
+ isStringLiteral: isStringLiteral14
5329
5582
  };
5330
5583
  function isSimpleExpression(code, excludeVar = false) {
5331
5584
  let node;
@@ -5334,38 +5587,38 @@ function isSimpleExpression(code, excludeVar = false) {
5334
5587
  } catch (e7) {
5335
5588
  return false;
5336
5589
  }
5337
- if (t50.isLiteral(node)) {
5590
+ if (t51.isLiteral(node)) {
5338
5591
  return true;
5339
5592
  }
5340
- if (!excludeVar && t50.isIdentifier(node)) {
5593
+ if (!excludeVar && t51.isIdentifier(node)) {
5341
5594
  return true;
5342
5595
  }
5343
- if (t50.isMemberExpression(node)) {
5344
- return isSimpleExpression(node.object) && t50.isIdentifier(node.property);
5596
+ if (t51.isMemberExpression(node)) {
5597
+ return isSimpleExpression(node.object) && t51.isIdentifier(node.property);
5345
5598
  }
5346
- if (t50.isObjectExpression(node) || t50.isArrayExpression(node)) {
5599
+ if (t51.isObjectExpression(node) || t51.isArrayExpression(node)) {
5347
5600
  return false;
5348
5601
  }
5349
- if (t50.isCallExpression(node) || t50.isAssignmentExpression(node)) {
5602
+ if (t51.isCallExpression(node) || t51.isAssignmentExpression(node)) {
5350
5603
  return false;
5351
5604
  }
5352
- if (t50.isBinaryExpression(node) || t50.isUnaryExpression(node)) {
5605
+ if (t51.isBinaryExpression(node) || t51.isUnaryExpression(node)) {
5353
5606
  return true;
5354
5607
  }
5355
5608
  return false;
5356
5609
  }
5357
- function isIdentifier29(code) {
5610
+ function isIdentifier30(code) {
5358
5611
  try {
5359
5612
  const node = _parser.parseExpression.call(void 0, code);
5360
- return t50.isIdentifier(node);
5613
+ return t51.isIdentifier(node);
5361
5614
  } catch (e8) {
5362
5615
  return false;
5363
5616
  }
5364
5617
  }
5365
- function isStringLiteral13(code) {
5618
+ function isStringLiteral14(code) {
5366
5619
  try {
5367
5620
  const node = _parser.parseExpression.call(void 0, code);
5368
- return t50.isStringLiteral(node);
5621
+ return t51.isStringLiteral(node);
5369
5622
  } catch (e9) {
5370
5623
  return false;
5371
5624
  }
@@ -5475,12 +5728,12 @@ function wrapSingleQuotes(content, condition) {
5475
5728
  return condition || strCodeTypes.isStringLiteral(content) ? `'${content}'` : content;
5476
5729
  }
5477
5730
  function checkPropIsDynamicKey(ctx, node) {
5478
- 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]);
5479
5732
  const { source, filename } = ctx;
5480
5733
  if (node.rawName === "v-bind" && !node.name) {
5481
5734
  logger.warn("Keyless v-bind will overwrite all previously declared props at runtime.", {
5482
5735
  source,
5483
- loc: _optionalChain([node, 'access', _179 => _179.arg, 'optionalAccess', _180 => _180.loc]),
5736
+ loc: _optionalChain([node, 'access', _190 => _190.arg, 'optionalAccess', _191 => _191.loc]),
5484
5737
  file: filename
5485
5738
  });
5486
5739
  return;
@@ -5488,7 +5741,7 @@ function checkPropIsDynamicKey(ctx, node) {
5488
5741
  if (isKeyStatic === false) {
5489
5742
  logger.warn("Avoid using dynamic slot names, as they generate complex JSX prop expressions.", {
5490
5743
  source,
5491
- loc: _optionalChain([node, 'access', _181 => _181.arg, 'optionalAccess', _182 => _182.loc]),
5744
+ loc: _optionalChain([node, 'access', _192 => _192.arg, 'optionalAccess', _193 => _193.loc]),
5492
5745
  file: filename
5493
5746
  });
5494
5747
  }
@@ -5508,26 +5761,26 @@ function resolvePropAsBabelExp(ir, ctx) {
5508
5761
  const rule = ADAPTER_RULES.runtime;
5509
5762
  const setNameIdentifier = (target, valueName) => {
5510
5763
  target.content = valueName;
5511
- target.ast = t51.jsxIdentifier(valueName);
5764
+ target.ast = t52.jsxIdentifier(valueName);
5512
5765
  };
5513
- const setValueExpression = (target, content, isStringLiteral14) => {
5766
+ const setValueExpression = (target, content, isStringLiteral15) => {
5514
5767
  target.content = content;
5515
- target.ast = resolveStringExpr(content, ctx, isStringLiteral14);
5768
+ target.ast = resolveStringExpr(content, ctx, isStringLiteral15);
5516
5769
  };
5517
5770
  const createRuntimeCall = (fnName, args) => {
5518
5771
  const fnArgs = args.filter(Boolean).join(",");
5519
- 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";
5520
5773
  const isTs = ctx.scriptData.lang.startsWith("ts");
5521
5774
  const safeTypeAssertion = isTs ? valIsUndef ? "as never" : "" : "";
5522
5775
  return `${fnName}(${fnArgs}) ${safeTypeAssertion}`;
5523
5776
  };
5524
- const applyRuntimeExpression = (expression, setName = false, nameIdentifier, isStringLiteral14) => {
5777
+ const applyRuntimeExpression = (expression, setName = false, nameIdentifier, isStringLiteral15) => {
5525
5778
  if (setName && nameIdentifier) {
5526
5779
  setNameIdentifier(nameExp, nameIdentifier);
5527
5780
  }
5528
5781
  const dir = rule.dir;
5529
5782
  recordImport(ctx, dir.package, dir.target);
5530
- setValueExpression(value.babelExp, expression, isStringLiteral14);
5783
+ setValueExpression(value.babelExp, expression, isStringLiteral15);
5531
5784
  };
5532
5785
  if (ir.isKeyLessVBind) {
5533
5786
  const dirKeyless = rule.dirKeyless;
@@ -5537,19 +5790,19 @@ function resolvePropAsBabelExp(ir, ctx) {
5537
5790
  }
5538
5791
  if (isClassAttr(name) && !value.isStringLiteral && !valueContent.startsWith(STYLE_MODULE_NAME)) {
5539
5792
  const dirCls = rule.dirCls;
5540
- 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);
5541
5794
  const expression = createRuntimeCall(dirCls.target, [arg]);
5542
5795
  applyRuntimeExpression(expression, true, name);
5543
5796
  return;
5544
5797
  }
5545
- 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))]))) {
5546
5799
  const dirStyle = rule.dirStyle;
5547
- 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;
5548
5801
  const expression = createRuntimeCall(dirStyle.target, [arg]);
5549
5802
  applyRuntimeExpression(expression, true, name);
5550
5803
  return;
5551
5804
  }
5552
- 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])) {
5553
5806
  const dirOn = rule.dirOn;
5554
5807
  const eventName = wrapSingleQuotes(ir.__vOnEvName || name, ir.isStatic);
5555
5808
  const expression = createRuntimeCall(dirOn.target, [eventName, valueContent]);
@@ -5604,7 +5857,7 @@ function resolveElementChildrenRules(children, ctx, parentIR, ir) {
5604
5857
  continue;
5605
5858
  }
5606
5859
  const nodeIR = child;
5607
- if (_optionalChain([parentIR, 'optionalAccess', _192 => _192.isBuiltIn])) {
5860
+ if (_optionalChain([parentIR, 'optionalAccess', _203 => _203.isBuiltIn])) {
5608
5861
  if (parentIR.tag == VUE_API_MAP.Transition) {
5609
5862
  resolveTransitionRules(nodeIR, parentIR, ir, ctx);
5610
5863
  }
@@ -5645,7 +5898,7 @@ function walkElementNodes(node, onElement) {
5645
5898
  }
5646
5899
  function resolveDefaultStyleModuleName(node) {
5647
5900
  const { exp } = node;
5648
- if (_optionalChain([exp, 'optionalAccess', _193 => _193.type]) !== _compilercore.NodeTypes.SIMPLE_EXPRESSION) {
5901
+ if (_optionalChain([exp, 'optionalAccess', _204 => _204.type]) !== _compilercore.NodeTypes.SIMPLE_EXPRESSION) {
5649
5902
  return;
5650
5903
  }
5651
5904
  if (exp.content.includes("$style")) {
@@ -5741,7 +5994,7 @@ function mergeStyleProps(oldAttr, newAttr) {
5741
5994
  const oldStyle = oldAttr.value.content;
5742
5995
  const newStyle = parseStyleString(newAttr.value.content);
5743
5996
  let merged = oldAttr.value.merge;
5744
- if (!_optionalChain([merged, 'optionalAccess', _194 => _194.length])) {
5997
+ if (!_optionalChain([merged, 'optionalAccess', _205 => _205.length])) {
5745
5998
  merged = oldAttr.value.merge = [oldStyle, newStyle];
5746
5999
  } else {
5747
6000
  merged.push(newStyle);
@@ -5771,7 +6024,7 @@ function warnUnsupportedVueDollarVar(ctx, node) {
5771
6024
  const { source, filename } = ctx;
5772
6025
  let value = "";
5773
6026
  let loc;
5774
- 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) {
5775
6028
  value = node.exp.content;
5776
6029
  loc = node.exp.loc;
5777
6030
  } else if (node.type === _compilercore.NodeTypes.INTERPOLATION && node.content.type === _compilercore.NodeTypes.SIMPLE_EXPRESSION) {
@@ -5825,11 +6078,11 @@ function resolveRefProp(prop, ctx, nodeIR) {
5825
6078
  } = ctx;
5826
6079
  let propIR;
5827
6080
  if (prop.type === _compilercore.NodeTypes.ATTRIBUTE) {
5828
- 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]);
5829
6082
  if (!tag) return;
5830
6083
  collectComponentRef(tag, ctx);
5831
6084
  const domRefBinding = Object.values(refBindings.domRefs).find((r) => r.tag === tag);
5832
- 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]);
5833
6086
  propIR = createPropsIR("ref", "ref", refVar || "null");
5834
6087
  } else {
5835
6088
  const exp = prop.exp;
@@ -5881,7 +6134,7 @@ function resolveTemplateNodeKey(templNode, keyContent, ctx) {
5881
6134
  return;
5882
6135
  }
5883
6136
  const [firstChild] = children;
5884
- 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) {
5885
6138
  return;
5886
6139
  }
5887
6140
  const hasKeyProp = firstChild.props.some(
@@ -5918,8 +6171,8 @@ function createSimpleVueBind(name, value) {
5918
6171
  function resolveDynamicAttributeProp(directive, ir, ctx, vueNode, nodeIR) {
5919
6172
  const arg = directive.arg;
5920
6173
  const exp = directive.exp;
5921
- const name = _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _204 => _204.content]), () => ( ""));
5922
- 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"));
5923
6176
  warnUnsupportedVueDollarVar(ctx, directive);
5924
6177
  if (name === "is") {
5925
6178
  resolveDynamicIsProp(directive, ir, ctx, nodeIR);
@@ -5934,7 +6187,7 @@ function resolveDynamicAttributeProp(directive, ir, ctx, vueNode, nodeIR) {
5934
6187
  return;
5935
6188
  }
5936
6189
  const propIR = createPropsIR(directive.rawName, name, content);
5937
- propIR.isStatic = _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _206 => _206.isStatic]), () => ( true));
6190
+ propIR.isStatic = _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _217 => _217.isStatic]), () => ( true));
5938
6191
  checkPropIsDynamicKey(ctx, directive);
5939
6192
  resolvePropertyIR(propIR, ir, ctx, nodeIR, true);
5940
6193
  }
@@ -5948,12 +6201,12 @@ function resolvePropertyIR(propsIR, ir, ctx, nodeIR, isDynamic = false) {
5948
6201
  content = propsIR.value.content = parseStyleString(content);
5949
6202
  }
5950
6203
  if (isDynamic) {
5951
- const isStringLiteral14 = strCodeTypes.isStringLiteral(content);
5952
- if (isStringLiteral14) {
6204
+ const isStringLiteral15 = strCodeTypes.isStringLiteral(content);
6205
+ if (isStringLiteral15) {
5953
6206
  content = normalizeString(content);
5954
6207
  propsIR.value.content = content;
5955
6208
  }
5956
- propsIR.value.isStringLiteral = isStringLiteral14;
6209
+ propsIR.value.isStringLiteral = isStringLiteral15;
5957
6210
  }
5958
6211
  const existing = findSameProp(nodeIR.props, propsIR);
5959
6212
  if (existing) {
@@ -5973,7 +6226,7 @@ function normalizeString(s) {
5973
6226
  // src/core/transform/sfc/template/syntax-processor/process/props/resolve-attribute-prop.ts
5974
6227
  function resolveAttributeProp(attribute, ir, ctx, nodeIR) {
5975
6228
  const name = attribute.name;
5976
- 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"));
5977
6230
  if (name === "is") {
5978
6231
  resolveStaticIsProp(content, ir, ctx, nodeIR);
5979
6232
  return;
@@ -6068,10 +6321,10 @@ function resolveRouterLinkVSlotProp(directive, nodeIR, ctx) {
6068
6321
  type: 2 /* SLOT */,
6069
6322
  name: "customRender",
6070
6323
  rawName: _nullishCoalesce(directive.rawName, () => ( "v-slot")),
6071
- isStatic: _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _209 => _209.isStatic]), () => ( true)),
6324
+ isStatic: _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _220 => _220.isStatic]), () => ( true)),
6072
6325
  isScoped: true,
6073
6326
  callback: {
6074
- 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()]), () => ( "")),
6075
6328
  exp: []
6076
6329
  }
6077
6330
  };
@@ -6087,10 +6340,10 @@ function resolveVFor(directive, ir, ctx, nodeIR) {
6087
6340
  };
6088
6341
  }
6089
6342
  function resolveForResult(forParseResult) {
6090
- const source = _optionalChain([forParseResult, 'access', _213 => _213.source, 'optionalAccess', _214 => _214.content]);
6091
- const value = _optionalChain([forParseResult, 'access', _215 => _215.value, 'optionalAccess', _216 => _216.content]);
6092
- const index = _optionalChain([forParseResult, 'access', _217 => _217.index, 'optionalAccess', _218 => _218.content]);
6093
- const key = _optionalChain([forParseResult, 'access', _219 => _219.key, 'optionalAccess', _220 => _220.content]);
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]);
6094
6347
  return {
6095
6348
  source,
6096
6349
  value,
@@ -6110,7 +6363,7 @@ function resolveVHtml(directive, ir, ctx, nodeIR) {
6110
6363
  // src/core/transform/sfc/template/syntax-processor/process/props/resolve-v-if.ts
6111
6364
  function resolveVIf(directive, ir, ctx, nodeIR, siblingNodesIR) {
6112
6365
  const name = directive.name === "else-if" ? "elseIf" : directive.name;
6113
- 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"));
6114
6367
  const prevNode = siblingNodesIR[siblingNodesIR.length - 1];
6115
6368
  const isElseBranch = name === "else" || name === "elseIf";
6116
6369
  let hasError = false;
@@ -6149,7 +6402,7 @@ function resolveVIf(directive, ir, ctx, nodeIR, siblingNodesIR) {
6149
6402
  // src/core/transform/sfc/template/syntax-processor/process/props/resolve-v-memo.ts
6150
6403
  function resolveVMemo(directive, _ir, ctx, nodeIR) {
6151
6404
  const exp = directive.exp;
6152
- let value = _optionalChain([exp, 'optionalAccess', _223 => _223.content]);
6405
+ let value = _optionalChain([exp, 'optionalAccess', _234 => _234.content]);
6153
6406
  if (value !== void 0) {
6154
6407
  if (!value.trim() || !value.startsWith("[") && !value.endsWith("]")) {
6155
6408
  const { source, filename } = ctx;
@@ -6189,14 +6442,14 @@ function resolveVModel(directive, ir, ctx, vueNode, nodeIR) {
6189
6442
  const getterName = exp.content;
6190
6443
  const isComponent = vueNode.tagType === _compilercore.ElementTypes.COMPONENT;
6191
6444
  const inputType = resolveHtmlInput(vueNode, isComponent);
6192
- 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)));
6193
6446
  let valuePropIR;
6194
6447
  let eventPropIR;
6195
6448
  if (isComponent) {
6196
6449
  valuePropIR = createPropsIR("v-model", propName, getterName);
6197
6450
  const eventReactName = `onUpdate${capitalize(camelCase(propName))}`;
6198
6451
  const eventVueName = `update:${propName}`;
6199
- 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")]);
6200
6453
  const valueArg = isTS ? "value: any" : "value";
6201
6454
  const processedValue = applyValueModifiers("value", modifiers);
6202
6455
  const handlerBody = `(${valueArg}) => { ${getterName} = ${processedValue} }`;
@@ -6234,7 +6487,7 @@ function getRadioValue(vueNode) {
6234
6487
  const valueAttr = vueNode.props.find(
6235
6488
  (prop) => prop.type === _compilercore.NodeTypes.ATTRIBUTE && prop.name === "value"
6236
6489
  );
6237
- 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 '""';
6238
6491
  const content = valueAttr.value.content;
6239
6492
  return /^['"]/.test(content) ? content : `"${content}"`;
6240
6493
  }
@@ -6244,7 +6497,7 @@ function resolveHtmlInput(node, isComponent) {
6244
6497
  const typeProp = node.props.find(
6245
6498
  (prop) => prop.type === _compilercore.NodeTypes.ATTRIBUTE && prop.name === "type"
6246
6499
  );
6247
- 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()]);
6248
6501
  }
6249
6502
  function applyValueModifiers(valueExp, modifiers) {
6250
6503
  let result = valueExp;
@@ -6265,7 +6518,7 @@ function resolveVOn(directive, ir, ctx, nodeIR) {
6265
6518
  const modifiers = directive.modifiers.map((item) => item.content);
6266
6519
  const captureIndex = resolveCaptureModifier(modifiers);
6267
6520
  const eventName = resolveEventName(arg.content, captureIndex);
6268
- 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";
6269
6522
  const handler = resolveHandler(handlerContent, ctx, modifiers);
6270
6523
  const originalVueEventName = modifiers.length ? `${arg.content}.${modifiers.join(".")}` : "";
6271
6524
  const eventIR = createPropsIR(directive.rawName, eventName, handler);
@@ -6316,10 +6569,10 @@ function resolveHandler(handlerContent, ctx, modifiers) {
6316
6569
  return handler;
6317
6570
  }
6318
6571
  function isConsoleCall(expr) {
6319
- 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";
6320
6573
  }
6321
6574
  function isFnReference(expr) {
6322
- return t52.isIdentifier(expr) || t52.isMemberExpression(expr) || t52.isFunction(expr);
6575
+ return t53.isIdentifier(expr) || t53.isMemberExpression(expr) || t53.isFunction(expr);
6323
6576
  }
6324
6577
 
6325
6578
  // src/core/transform/sfc/template/syntax-processor/process/props/resolve-v-show.ts
@@ -6352,7 +6605,7 @@ function resolveVSlotProp(directive, ir, ctx) {
6352
6605
  const name = !arg || arg.content === "default" ? "children" : arg.content;
6353
6606
  const content = !isScoped ? [] : void 0;
6354
6607
  const callback = isScoped ? {
6355
- 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()]), () => ( "")),
6356
6609
  exp: []
6357
6610
  } : void 0;
6358
6611
  checkPropIsDynamicKey(ctx, directive);
@@ -6360,7 +6613,7 @@ function resolveVSlotProp(directive, ir, ctx) {
6360
6613
  type: 2 /* SLOT */,
6361
6614
  name,
6362
6615
  rawName: _nullishCoalesce(directive.rawName, () => ( "default")),
6363
- isStatic: _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _241 => _241.isStatic]), () => ( true)),
6616
+ isStatic: _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _252 => _252.isStatic]), () => ( true)),
6364
6617
  isScoped,
6365
6618
  content,
6366
6619
  callback
@@ -6423,7 +6676,7 @@ function resolveElementNode(node, ir, ctx, siblingNodesIR) {
6423
6676
  if (routerAdapter) {
6424
6677
  if (!ctx.route) ctx.route = true;
6425
6678
  nodeIR.isRoute = true;
6426
- recordImport(ctx, _optionalChain([routerAdapter, 'optionalAccess', _242 => _242.package]), routerAdapter.target);
6679
+ recordImport(ctx, _optionalChain([routerAdapter, 'optionalAccess', _253 => _253.package]), routerAdapter.target);
6427
6680
  }
6428
6681
  resolveProps(node, ir, ctx, nodeIR, siblingNodesIR);
6429
6682
  return nodeIR;
@@ -6567,7 +6820,7 @@ function resolveSlotProps(node, ctx) {
6567
6820
  for (const prop of node.props) {
6568
6821
  if (prop.type === _compilercore.NodeTypes.ATTRIBUTE) {
6569
6822
  const attr = prop.name;
6570
- 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()]);
6571
6824
  if (attr === "name" && value) {
6572
6825
  result.name = camelCase(value);
6573
6826
  } else {
@@ -6590,7 +6843,7 @@ function resolveSlotProps(node, ctx) {
6590
6843
  });
6591
6844
  }
6592
6845
  const key = arg.content;
6593
- 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";
6594
6847
  if (key === "name") {
6595
6848
  result.name = camelCase(value);
6596
6849
  } else {
@@ -6660,19 +6913,19 @@ function resolveTemplate2(root, ctx) {
6660
6913
  // src/core/transform/sfc/index.ts
6661
6914
  function transform(ast, ctx, options) {
6662
6915
  const { template, script, style } = ast;
6663
- const templateIR = resolveTemplate2(_optionalChain([template, 'optionalAccess', _250 => _250.ast]), ctx);
6664
- 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);
6665
6918
  const result = {
6666
6919
  template: templateIR,
6667
6920
  script: scriptIR,
6668
- style: _optionalChain([style, 'optionalAccess', _252 => _252.source, 'optionalAccess', _253 => _253.content])
6921
+ style: _optionalChain([style, 'optionalAccess', _263 => _263.source, 'optionalAccess', _264 => _264.content])
6669
6922
  };
6670
- executePlugins(_optionalChain([options, 'optionalAccess', _254 => _254.plugins]), result, ctx);
6923
+ executePlugins(_optionalChain([options, 'optionalAccess', _265 => _265.plugins]), result, ctx);
6671
6924
  return result;
6672
6925
  }
6673
6926
 
6674
6927
  // package.json
6675
- var version = "1.8.4";
6928
+ var version = "1.9.0";
6676
6929
  var bin = {
6677
6930
  vureact: "bin/vureact.js"
6678
6931
  };
@@ -6857,7 +7110,7 @@ var Helper = (_class5 = class {
6857
7110
  __init8() {this.outDir = "react-app"}
6858
7111
  constructor(opts) {;_class5.prototype.__init7.call(this);_class5.prototype.__init8.call(this);
6859
7112
  this.compilerOpts = opts;
6860
- if (_optionalChain([opts, 'access', _255 => _255.output, 'optionalAccess', _256 => _256.workspace])) {
7113
+ if (_optionalChain([opts, 'access', _266 => _266.output, 'optionalAccess', _267 => _267.workspace])) {
6861
7114
  this.workspaceDir = opts.output.workspace;
6862
7115
  }
6863
7116
  const excludePatterns = PathFilter.withDefaults(opts.exclude || []);
@@ -6887,7 +7140,7 @@ var Helper = (_class5 = class {
6887
7140
  }
6888
7141
  getOutDirName() {
6889
7142
  const { output } = this.compilerOpts;
6890
- return _optionalChain([output, 'optionalAccess', _257 => _257.outDir]) || this.outDir;
7143
+ return _optionalChain([output, 'optionalAccess', _268 => _268.outDir]) || this.outDir;
6891
7144
  }
6892
7145
  getWorkspaceDir() {
6893
7146
  return _path2.default.resolve(this.getProjectRoot(), this.workspaceDir);
@@ -6901,7 +7154,7 @@ var Helper = (_class5 = class {
6901
7154
  }
6902
7155
  getIgnoreAssets() {
6903
7156
  const { output } = this.compilerOpts;
6904
- if (_optionalChain([output, 'optionalAccess', _258 => _258.ignoreAssets])) {
7157
+ if (_optionalChain([output, 'optionalAccess', _269 => _269.ignoreAssets])) {
6905
7158
  return new Set(output.ignoreAssets.map(normalizePath));
6906
7159
  }
6907
7160
  return /* @__PURE__ */ new Set([
@@ -6991,12 +7244,12 @@ var Helper = (_class5 = class {
6991
7244
  */
6992
7245
  async formatCode({ code, fileInfo }) {
6993
7246
  const { format } = this.compilerOpts;
6994
- if (!_optionalChain([format, 'optionalAccess', _259 => _259.enabled])) return code;
6995
- 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") {
6996
7249
  return simpleFormat(code);
6997
7250
  }
6998
- const { lang } = _nullishCoalesce(_optionalChain([fileInfo, 'optionalAccess', _261 => _261.jsx]), () => ( _optionalChain([fileInfo, 'optionalAccess', _262 => _262.script])));
6999
- return await formatWithPrettier(code, lang, _optionalChain([format, 'optionalAccess', _263 => _263.prettierOptions]));
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]));
7000
7253
  }
7001
7254
  /**
7002
7255
  * 通用的缓存校验工具函数
@@ -7030,7 +7283,7 @@ var Helper = (_class5 = class {
7030
7283
  * @param options.lock - 是否启用文件锁(默认false)
7031
7284
  */
7032
7285
  async writeFileWithDir(filePath, content, options) {
7033
- if (_optionalChain([options, 'optionalAccess', _264 => _264.lock])) {
7286
+ if (_optionalChain([options, 'optionalAccess', _275 => _275.lock])) {
7034
7287
  await fileLock.updateFile(filePath, async () => content, options);
7035
7288
  } else {
7036
7289
  await _fs2.default.promises.mkdir(_path2.default.dirname(filePath), { recursive: true });
@@ -7075,7 +7328,7 @@ var Helper = (_class5 = class {
7075
7328
  * 获取需要排除编译的文件
7076
7329
  */
7077
7330
  getExcludes() {
7078
- 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])) {
7079
7332
  return PathFilter.withDefaults();
7080
7333
  }
7081
7334
  return this.compilerOpts.exclude;
@@ -7166,7 +7419,7 @@ function parseOnlyStyle(source, ctx, options) {
7166
7419
  ast: void 0
7167
7420
  }
7168
7421
  };
7169
- executePlugins(_optionalChain([options, 'optionalAccess', _268 => _268.plugins]), result, ctx);
7422
+ executePlugins(_optionalChain([options, 'optionalAccess', _279 => _279.plugins]), result, ctx);
7170
7423
  return result;
7171
7424
  }
7172
7425
 
@@ -7226,7 +7479,8 @@ var CompilationContext = (_class6 = class {constructor() { _class6.prototype.__i
7226
7479
  refField: "expose"
7227
7480
  },
7228
7481
  declaredOptions: {},
7229
- source: ""
7482
+ source: "",
7483
+ __vureact_script_block_ir: void 0
7230
7484
  },
7231
7485
  styleData: {
7232
7486
  filePath: ""
@@ -7300,16 +7554,16 @@ var BaseCompiler = (_class7 = class extends Helper {
7300
7554
  });
7301
7555
  const genOptions = this.prepareGenerateOptions(filename);
7302
7556
  const resolveSFCAndScriptFile = () => {
7303
- const ast = parse(source, ctx.data, { plugins: _optionalChain([plugins, 'optionalAccess', _269 => _269.parser]) });
7304
- const ir = transform(ast, ctx.data, { plugins: _optionalChain([plugins, 'optionalAccess', _270 => _270.transformer]) });
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]) });
7305
7559
  const gen = generate(ir, ctx.data, {
7306
7560
  ...genOptions,
7307
- plugins: _optionalChain([plugins, 'optionalAccess', _271 => _271.codegen])
7561
+ plugins: _optionalChain([plugins, 'optionalAccess', _282 => _282.codegen])
7308
7562
  });
7309
7563
  return this.resolveMainResult(ir, gen, ctx.data);
7310
7564
  };
7311
7565
  const resolveStyleFile = () => {
7312
- 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]) });
7313
7567
  return this.resolveStyleResult(result, ctx.data);
7314
7568
  };
7315
7569
  try {
@@ -7348,9 +7602,9 @@ var BaseCompiler = (_class7 = class extends Helper {
7348
7602
  lang
7349
7603
  },
7350
7604
  css: {
7351
- file: _optionalChain([styleData, 'optionalAccess', _273 => _273.filePath]),
7352
- hash: _optionalChain([styleData, 'optionalAccess', _274 => _274.scopeId]),
7353
- 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])
7354
7608
  }
7355
7609
  },
7356
7610
  ...base
@@ -7500,12 +7754,12 @@ var CacheManager = (_class9 = class {
7500
7754
  const meta = { ...unit };
7501
7755
  delete meta.source;
7502
7756
  if (key === "sfc" /* SFC */) {
7503
- _optionalChainDelete([meta, 'access', _276 => _276.output, 'optionalAccess', _277 => _277.jsx, 'access', _278 => delete _278.code]);
7504
- _optionalChainDelete([meta, 'access', _279 => _279.output, 'optionalAccess', _280 => _280.css, 'access', _281 => delete _281.code]);
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]);
7505
7759
  } else if (key === "script" /* SCRIPT */) {
7506
- _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]);
7507
7761
  } else if (key === "style" /* STYLE */) {
7508
- _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]);
7509
7763
  }
7510
7764
  if (!this.pendingUpdates.has(key)) {
7511
7765
  this.pendingUpdates.set(key, []);
@@ -7525,7 +7779,7 @@ var CacheManager = (_class9 = class {
7525
7779
  }
7526
7780
  for (const key of keys) {
7527
7781
  const updates = this.pendingUpdates.get(key);
7528
- if (!_optionalChain([updates, 'optionalAccess', _288 => _288.length])) continue;
7782
+ if (!_optionalChain([updates, 'optionalAccess', _299 => _299.length])) continue;
7529
7783
  const entries = [...this.cachedData[key] || []];
7530
7784
  updates.forEach(({ unit, meta }) => {
7531
7785
  const idx = entries.findIndex((c) => c.file === unit.file);
@@ -7686,7 +7940,7 @@ var CleanupManager = class {
7686
7940
  const sfcMeta = meta;
7687
7941
  const { jsx, css } = sfcMeta.output;
7688
7942
  await this.fileCompiler.removeOutputFile(jsx.file);
7689
- if (_optionalChain([css, 'optionalAccess', _289 => _289.file])) {
7943
+ if (_optionalChain([css, 'optionalAccess', _300 => _300.file])) {
7690
7944
  await this.fileCompiler.removeOutputFile(css.file);
7691
7945
  }
7692
7946
  break;
@@ -7742,7 +7996,7 @@ var CompilationUnitProcessor = class {
7742
7996
  const isScriptFile = key === "script" /* SCRIPT */;
7743
7997
  const isStyleFile = key === "style" /* STYLE */;
7744
7998
  if (isSFC || isScriptFile) {
7745
- unit.hasRoute = _optionalChain([result, 'optionalAccess', _290 => _290.hasRoute]);
7999
+ unit.hasRoute = _optionalChain([result, 'optionalAccess', _301 => _301.hasRoute]);
7746
8000
  }
7747
8001
  const resolveFileInfo = () => {
7748
8002
  if (isSFC) {
@@ -7762,7 +8016,7 @@ var CompilationUnitProcessor = class {
7762
8016
  const { script } = result.fileInfo;
7763
8017
  unit.output = {
7764
8018
  script: {
7765
- file: _optionalChain([script, 'optionalAccess', _291 => _291.file]),
8019
+ file: _optionalChain([script, 'optionalAccess', _302 => _302.file]),
7766
8020
  code
7767
8021
  }
7768
8022
  };
@@ -7839,7 +8093,7 @@ var FileProcessor = (_class10 = class {
7839
8093
  const absPath = this.fileCompiler.getAbsPath(filePath);
7840
8094
  const fileMeta = await this.fileCompiler.getFileMeta(absPath);
7841
8095
  const cache = (this.fileCompiler.getIsCache() ? existingCache : void 0) || await this.cacheManager.loadCache(key);
7842
- 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)]);
7843
8097
  const { shouldCompile, hash } = await this.fileCompiler.checkCacheStatus(
7844
8098
  fileMeta,
7845
8099
  record,
@@ -7861,10 +8115,10 @@ var FileProcessor = (_class10 = class {
7861
8115
  hash: hash || this.fileCompiler.genHash(source)
7862
8116
  };
7863
8117
  const processed = await this.compilationUnitProcessor.resolve(initUnit, key);
7864
- if (_optionalChain([processed, 'optionalAccess', _295 => _295.output])) {
8118
+ if (_optionalChain([processed, 'optionalAccess', _306 => _306.output])) {
7865
8119
  await this.compilationUnitProcessor.saveCompiledFiles(processed, key);
7866
8120
  if (key === "sfc" /* SFC */ || key === "script" /* SCRIPT */) {
7867
- if (_optionalChain([processed, 'optionalAccess', _296 => _296.hasRoute])) {
8121
+ if (_optionalChain([processed, 'optionalAccess', _307 => _307.hasRoute])) {
7868
8122
  await this.addRouterToPackageJson();
7869
8123
  await this.updateEntryWithRouterProvider();
7870
8124
  }
@@ -7881,13 +8135,13 @@ var FileProcessor = (_class10 = class {
7881
8135
  */
7882
8136
  async addRouterToPackageJson() {
7883
8137
  const { output } = this.fileCompiler.options;
7884
- if (_optionalChain([output, 'optionalAccess', _297 => _297.bootstrapVite]) === false) {
8138
+ if (_optionalChain([output, 'optionalAccess', _308 => _308.bootstrapVite]) === false) {
7885
8139
  return;
7886
8140
  }
7887
8141
  const { router } = RUNTIME_PACKAGES;
7888
8142
  const filePath = this.fileCompiler.getOutputPkgPath();
7889
8143
  const packageJson = await this.fileCompiler.resolvePackageFile(filePath);
7890
- 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]])) {
7891
8145
  return;
7892
8146
  }
7893
8147
  if (!packageJson.dependencies) {
@@ -7906,7 +8160,7 @@ var FileProcessor = (_class10 = class {
7906
8160
  const { exclude, output, router } = this.fileCompiler.options;
7907
8161
  const inputPath = this.fileCompiler.getInputPath();
7908
8162
  const outputPath = this.fileCompiler.getOuputPath(true);
7909
- 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])) {
7910
8164
  return;
7911
8165
  }
7912
8166
  const getMainFile = async (filename) => {
@@ -7927,7 +8181,7 @@ var FileProcessor = (_class10 = class {
7927
8181
  const prepareRouterEntry = () => {
7928
8182
  const importPath = this.fileCompiler.resolveRelativePath(inputPath, router.configFile);
7929
8183
  let content = fileData.content;
7930
- 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)])) {
7931
8185
  return content;
7932
8186
  }
7933
8187
  const routerModule = "RouterInstance";
@@ -8034,7 +8288,7 @@ ${routerImport}`);
8034
8288
  const resolvedPath = normalizePath(fileCompiler.relativePath(input));
8035
8289
  const baseName = _path2.default.basename(input).toLowerCase();
8036
8290
  const exclusions = fileCompiler.getIgnoreAssets();
8037
- 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])) {
8038
8292
  const shouldExclude = Array.from(exclusions).some((pattern) => {
8039
8293
  if (pattern.endsWith(".")) {
8040
8294
  return baseName.startsWith(pattern);
@@ -8170,7 +8424,7 @@ var ViteBootstrapper = (_class12 = class {
8170
8424
  const { output } = this.options;
8171
8425
  const workspaceDir = this.fileCompiler.getWorkspaceDir();
8172
8426
  await _fs2.default.promises.mkdir(workspaceDir, { recursive: true });
8173
- if (_optionalChain([output, 'optionalAccess', _310 => _310.bootstrapVite]) === false) {
8427
+ if (_optionalChain([output, 'optionalAccess', _321 => _321.bootstrapVite]) === false) {
8174
8428
  return false;
8175
8429
  }
8176
8430
  if (this.isSingleFile()) {
@@ -8210,7 +8464,7 @@ var ViteBootstrapper = (_class12 = class {
8210
8464
  const newDevDeps = resolveDeps(sourcePkg.devDependencies, newPkg.devDependencies, true);
8211
8465
  newPkg.dependencies = newDeps;
8212
8466
  newPkg.devDependencies = newDevDeps;
8213
- 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;
8214
8468
  await this.fileCompiler.writeFileWithDir(outputPkgPath, JSON.stringify(newPkg, null, 2));
8215
8469
  this.spinner.succeed("Vite React environment initialized");
8216
8470
  return true;
@@ -8221,12 +8475,12 @@ var ViteBootstrapper = (_class12 = class {
8221
8475
  async resolveViteCreateApp() {
8222
8476
  const { output } = this.options;
8223
8477
  const { viteVersion, template: tmpl } = this.defaultConfig;
8224
- const bootstrapVite = _optionalChain([output, 'optionalAccess', _313 => _313.bootstrapVite]);
8478
+ const bootstrapVite = _optionalChain([output, 'optionalAccess', _324 => _324.bootstrapVite]);
8225
8479
  const outDirName = this.fileCompiler.getOutDirName();
8226
8480
  const configObject = typeof bootstrapVite === "object" ? bootstrapVite : null;
8227
- const viteVer = _optionalChain([configObject, 'optionalAccess', _314 => _314.vite]) || viteVersion;
8228
- const reactVer = _optionalChain([configObject, 'optionalAccess', _315 => _315.react]);
8229
- const template = _optionalChain([configObject, 'optionalAccess', _316 => _316.template]) || tmpl;
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;
8230
8484
  const cmd = `npm create vite${viteVer} ${outDirName} -- --template ${template}`;
8231
8485
  _child_process.execSync.call(void 0, cmd, {
8232
8486
  cwd: this.fileCompiler.getWorkspaceDir(),
@@ -8362,7 +8616,7 @@ var FileCompiler = (_class13 = class extends BaseCompiler {
8362
8616
  const assetCount = await assetManager.runAsset(scanFiles.assets, cacheMap);
8363
8617
  this.updateSpinner("Almost done...");
8364
8618
  await cacheManager.flushAllCache();
8365
- 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()]);
8366
8620
  const endTime = calcElapsedTime(startTime);
8367
8621
  this.printCoreLogs();
8368
8622
  this.showCompileStats(endTime, sfcCount, scriptCount, styleCount, assetCount);