@vureact/compiler-core 1.5.1 → 1.5.2

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.5.1
2
+ * @vureact/compiler-core v1.5.2
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 t15 = _interopRequireWildcard(_types); var t16 = _interopRequireWildcard(_types); var t17 = _interopRequireWildcard(_types); var t18 = _interopRequireWildcard(_types); var t19 = _interopRequireWildcard(_types); var t20 = _interopRequireWildcard(_types); var t21 = _interopRequireWildcard(_types); var t23 = _interopRequireWildcard(_types); var t22 = _interopRequireWildcard(_types); var t24 = _interopRequireWildcard(_types); var t25 = _interopRequireWildcard(_types); var t30 = _interopRequireWildcard(_types); var t27 = _interopRequireWildcard(_types); var t26 = _interopRequireWildcard(_types); var t28 = _interopRequireWildcard(_types); var t29 = _interopRequireWildcard(_types); var t32 = _interopRequireWildcard(_types); var t31 = _interopRequireWildcard(_types); var t33 = _interopRequireWildcard(_types); var t34 = _interopRequireWildcard(_types); var t35 = _interopRequireWildcard(_types); var t36 = _interopRequireWildcard(_types); var t37 = _interopRequireWildcard(_types); var t39 = _interopRequireWildcard(_types); var t38 = _interopRequireWildcard(_types); var t40 = _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 t15 = _interopRequireWildcard(_types); var t16 = _interopRequireWildcard(_types); var t17 = _interopRequireWildcard(_types); var t18 = _interopRequireWildcard(_types); var t19 = _interopRequireWildcard(_types); var t20 = _interopRequireWildcard(_types); var t22 = _interopRequireWildcard(_types); var t21 = _interopRequireWildcard(_types); var t23 = _interopRequireWildcard(_types); var t24 = _interopRequireWildcard(_types); var t29 = _interopRequireWildcard(_types); var t26 = _interopRequireWildcard(_types); var t25 = _interopRequireWildcard(_types); var t27 = _interopRequireWildcard(_types); var t28 = _interopRequireWildcard(_types); var t31 = _interopRequireWildcard(_types); var t30 = _interopRequireWildcard(_types); var t32 = _interopRequireWildcard(_types); var t33 = _interopRequireWildcard(_types); var t34 = _interopRequireWildcard(_types); var t35 = _interopRequireWildcard(_types); var t36 = _interopRequireWildcard(_types); var t38 = _interopRequireWildcard(_types); var t37 = _interopRequireWildcard(_types); var t39 = _interopRequireWildcard(_types);
28
28
 
29
29
  // src/consts/other.ts
30
30
  var PACKAGE_NAME = {
@@ -624,7 +624,7 @@ function resolveStringExpr(input, ctx, toStrLiteral = false) {
624
624
  const newContent = resolveSpecialExpressions(input, ctx);
625
625
  try {
626
626
  return stringToExpr(newContent, scriptData.lang, filename);
627
- } catch (e2) {
627
+ } catch (e) {
628
628
  return t5.identifier(newContent);
629
629
  }
630
630
  }
@@ -780,7 +780,7 @@ function normalizePath(filePath) {
780
780
  if (fp.startsWith("file:")) {
781
781
  fp = _url.fileURLToPath.call(void 0, fp);
782
782
  }
783
- } catch (e3) {
783
+ } catch (e2) {
784
784
  }
785
785
  fp = fp.replace(/\\/g, "/").replace(/\/\/+/, "/");
786
786
  return fp;
@@ -995,7 +995,7 @@ function buildSlotCallbackParams(nodeIR, ctx) {
995
995
  return [];
996
996
  }
997
997
  return expression.params;
998
- } catch (e4) {
998
+ } catch (e3) {
999
999
  logger.warn(`Failed to parse slot params "${rawArg}". Falling back to no-arg slot function.`, {
1000
1000
  file: ctx.filename
1001
1001
  });
@@ -1029,7 +1029,7 @@ function buildStandardProp(nodeIR) {
1029
1029
  babelExp: { ast: keyAST },
1030
1030
  value: {
1031
1031
  content,
1032
- isStringLiteral: isStringLiteral13,
1032
+ isStringLiteral: isStringLiteral12,
1033
1033
  babelExp: { ast: valueAST }
1034
1034
  }
1035
1035
  } = nodeIR;
@@ -1038,7 +1038,7 @@ function buildStandardProp(nodeIR) {
1038
1038
  }
1039
1039
  let value;
1040
1040
  if (content !== "true") {
1041
- value = isStringLiteral13 ? t9.stringLiteral(content) : buildJsxExpressionNode(valueAST);
1041
+ value = isStringLiteral12 ? t9.stringLiteral(content) : buildJsxExpressionNode(valueAST);
1042
1042
  }
1043
1043
  return t9.jsxAttribute(keyAST, value);
1044
1044
  }
@@ -1110,7 +1110,7 @@ function buildCtxProviderNode(nodeIR, ctx, children) {
1110
1110
  if (!raw) return t11.stringLiteral("");
1111
1111
  try {
1112
1112
  return stringToExpr(raw, ctx.scriptData.lang, ctx.filename);
1113
- } catch (e5) {
1113
+ } catch (e4) {
1114
1114
  return t11.stringLiteral(raw);
1115
1115
  }
1116
1116
  };
@@ -1456,40 +1456,29 @@ var _compilersfc = require('@vue/compiler-sfc');
1456
1456
 
1457
1457
  // src/core/parse/sfc/process/resolve-script.ts
1458
1458
 
1459
-
1460
-
1461
- function resolveScript(descriptor, ctx, pResult) {
1462
- const scriptBlock = descriptor.scriptSetup || descriptor.script;
1463
- if (!scriptBlock) return null;
1464
- const result = {
1465
- ast: {},
1466
- source: scriptBlock
1467
- };
1468
- const options = getBabelParseOptions(scriptBlock.lang, "script", ctx.filename);
1469
- resolveCtxData(scriptBlock, ctx);
1459
+ function resolveScript(descriptor, ctx, parseResult) {
1470
1460
  if (descriptor.script) {
1471
- const { code, ast, name } = extractSetupBodyToTopLevel(scriptBlock.content, options);
1472
- if (ast) {
1473
- result.source.content = code;
1474
- result.ast = ast;
1475
- ctx.compName = name;
1476
- }
1477
- logger.warn(
1478
- "Using traditional script (instead of <script setup>) may result in unstable or non-functional React code. It is recommended to use <script setup> instead.",
1479
- { file: ctx.filename }
1461
+ throw new Error(
1462
+ `Traditional Vue <script> syntax is not supported. Please migrate to <script setup>.
1463
+ at <anonymous> (${ctx.filename})`
1480
1464
  );
1481
- } else {
1482
- result.ast = _parser.parse.call(void 0, result.source.content, options);
1483
1465
  }
1484
- if (_optionalChain([scriptBlock, 'optionalAccess', _41 => _41.warnings])) {
1485
- _optionalChain([scriptBlock, 'optionalAccess', _42 => _42.warnings, 'access', _43 => _43.forEach, 'call', _44 => _44((msg) => {
1466
+ const { scriptSetup } = descriptor;
1467
+ if (!scriptSetup) return null;
1468
+ if (_optionalChain([scriptSetup, 'optionalAccess', _41 => _41.warnings])) {
1469
+ _optionalChain([scriptSetup, 'optionalAccess', _42 => _42.warnings, 'access', _43 => _43.forEach, 'call', _44 => _44((msg) => {
1486
1470
  logger.warn(msg, { file: ctx.filename });
1487
1471
  })]);
1488
1472
  }
1489
- pResult.script = result;
1473
+ resolveContext(scriptSetup, ctx);
1474
+ const parseOpts = getBabelParseOptions(scriptSetup.lang, "script", ctx.filename);
1475
+ parseResult.script = {
1476
+ ast: _parser.parse.call(void 0, scriptSetup.content, parseOpts),
1477
+ source: scriptSetup
1478
+ };
1490
1479
  }
1491
- function resolveCtxData(scriptBlock, ctx) {
1492
- let { content, lang } = scriptBlock;
1480
+ function resolveContext(scriptSetup, ctx) {
1481
+ let { content, lang } = scriptSetup;
1493
1482
  const resolveVRComment = (source) => {
1494
1483
  const regx = /\/\/\s*@vr-name:\s*(\w+)/;
1495
1484
  const nameMatch = source.match(regx);
@@ -1499,70 +1488,7 @@ function resolveCtxData(scriptBlock, ctx) {
1499
1488
  ctx.compName = resolveVRComment(content);
1500
1489
  ctx.scriptData.source = content;
1501
1490
  ctx.scriptData.lang = lang || "js";
1502
- scriptBlock.content = content;
1503
- }
1504
- function extractSetupBodyToTopLevel(content, options) {
1505
- let name = "";
1506
- try {
1507
- const ast = _parser.parse.call(void 0, content, options);
1508
- const importNodes = [];
1509
- const otherTopLevel = [];
1510
- let setupStatements = [];
1511
- for (const node of ast.program.body) {
1512
- if (t15.isImportDeclaration(node)) {
1513
- importNodes.push(node);
1514
- continue;
1515
- }
1516
- if (t15.isExportDefaultDeclaration(node)) {
1517
- const decl = node.declaration;
1518
- if (decl && t15.isObjectExpression(decl)) {
1519
- const nameProp = decl.properties.find((p) => {
1520
- if (t15.isObjectProperty(p)) {
1521
- const key = p.key;
1522
- return t15.isIdentifier(key) && key.name === "name" || t15.isStringLiteral(key) && key.value === "name";
1523
- }
1524
- return false;
1525
- });
1526
- if (nameProp && t15.isObjectProperty(nameProp)) {
1527
- if (t15.isStringLiteral(nameProp.value)) {
1528
- name = nameProp.value.value;
1529
- }
1530
- }
1531
- const setupProp = decl.properties.find((p) => {
1532
- if (t15.isObjectMethod(p)) {
1533
- return p.key && p.key.name === "setup";
1534
- }
1535
- if (t15.isObjectProperty(p)) {
1536
- const key = p.key;
1537
- return t15.isIdentifier(key) && key.name === "setup" || t15.isStringLiteral(key) && key.value === "setup";
1538
- }
1539
- return false;
1540
- });
1541
- if (setupProp) {
1542
- const value = t15.isObjectMethod(setupProp) ? setupProp : t15.isObjectProperty(setupProp) ? setupProp.value : null;
1543
- if (value && (t15.isFunction(value) || t15.isObjectMethod(value))) {
1544
- const fnBody = t15.isBlockStatement(value.body) ? value.body.body : [];
1545
- for (const stmt of fnBody) {
1546
- if (t15.isReturnStatement(stmt)) continue;
1547
- setupStatements.push(stmt);
1548
- }
1549
- }
1550
- }
1551
- }
1552
- continue;
1553
- }
1554
- otherTopLevel.push(node);
1555
- }
1556
- const parts = [];
1557
- const stmts = importNodes.concat(otherTopLevel, setupStatements);
1558
- for (const n of stmts) {
1559
- parts.push(_generator.generate.call(void 0, n).code);
1560
- }
1561
- return { name, ast, code: parts.join("\n\n") };
1562
- } catch (e) {
1563
- console.error(e);
1564
- return { name, code: content };
1565
- }
1491
+ scriptSetup.content = content;
1566
1492
  }
1567
1493
 
1568
1494
  // src/core/parse/sfc/process/resolve-script-meta.ts
@@ -1673,10 +1599,10 @@ function resolveScriptMeta(result, ctx) {
1673
1599
  _core.traverse.call(void 0, scriptAST, {
1674
1600
  VariableDeclarator(path9) {
1675
1601
  const { node } = path9;
1676
- if (!atComponentOrHookRoot(path9, scriptAST.program) || !t16.isIdentifier(node.id)) {
1602
+ if (!atComponentOrHookRoot(path9, scriptAST.program) || !t15.isIdentifier(node.id)) {
1677
1603
  return;
1678
1604
  }
1679
- if (node.init && t16.isCallExpression(node.init) && t16.isIdentifier(node.init.callee)) {
1605
+ if (node.init && t15.isCallExpression(node.init) && t15.isIdentifier(node.init.callee)) {
1680
1606
  collectReactiveBindings(node, ctx);
1681
1607
  collectRefBindings(node, ctx);
1682
1608
  }
@@ -1959,10 +1885,10 @@ function findRootVariablePath(path9) {
1959
1885
  }
1960
1886
  function findRootIdentifier(node) {
1961
1887
  let current = node.object;
1962
- while (t17.isMemberExpression(current) || t17.isOptionalMemberExpression(current)) {
1888
+ while (t16.isMemberExpression(current) || t16.isOptionalMemberExpression(current)) {
1963
1889
  current = current.object;
1964
1890
  }
1965
- return t17.isIdentifier(current) ? current : null;
1891
+ return t16.isIdentifier(current) ? current : null;
1966
1892
  }
1967
1893
  function getVariableDeclaratorPath(path9) {
1968
1894
  if (path9.isVariableDeclarator()) {
@@ -2046,14 +1972,14 @@ function isPropertyName(path9) {
2046
1972
  }
2047
1973
  function replaceCallName(callExp, identifierName) {
2048
1974
  const { callee } = callExp;
2049
- if (!t17.isIdentifier(callee)) return;
1975
+ if (!t16.isIdentifier(callee)) return;
2050
1976
  callee.name = identifierName;
2051
1977
  if (callee.loc) {
2052
1978
  callee.loc.identifierName = identifierName;
2053
1979
  }
2054
1980
  }
2055
1981
  function replaceIdName(id, newName) {
2056
- if (!t17.isIdentifier(id)) return;
1982
+ if (!t16.isIdentifier(id)) return;
2057
1983
  id.name = newName;
2058
1984
  if (id.loc) {
2059
1985
  id.loc.identifierName = newName;
@@ -2063,71 +1989,71 @@ function stringValueToTSType(ctx, input, tsTypeAnnotation7) {
2063
1989
  const { filename, scriptData } = ctx;
2064
1990
  const exp = stringToExpr(input, scriptData.lang, filename);
2065
1991
  const ts = expressionToTSType(exp);
2066
- return tsTypeAnnotation7 ? t17.tsTypeAnnotation(ts) : ts;
1992
+ return tsTypeAnnotation7 ? t16.tsTypeAnnotation(ts) : ts;
2067
1993
  }
2068
1994
  function expressionToTSType(exp) {
2069
- if (t17.isStringLiteral(exp)) return t17.tsStringKeyword();
2070
- if (t17.isNumericLiteral(exp)) return t17.tsNumberKeyword();
2071
- if (t17.isBooleanLiteral(exp)) return t17.tsBooleanKeyword();
2072
- if (t17.isArrayExpression(exp)) return t17.tsArrayType(t17.tsAnyKeyword());
2073
- if (t17.isObjectExpression(exp)) {
1995
+ if (t16.isStringLiteral(exp)) return t16.tsStringKeyword();
1996
+ if (t16.isNumericLiteral(exp)) return t16.tsNumberKeyword();
1997
+ if (t16.isBooleanLiteral(exp)) return t16.tsBooleanKeyword();
1998
+ if (t16.isArrayExpression(exp)) return t16.tsArrayType(t16.tsAnyKeyword());
1999
+ if (t16.isObjectExpression(exp)) {
2074
2000
  const members = [];
2075
2001
  for (const p of exp.properties) {
2076
- if (!t17.isObjectProperty(p)) continue;
2002
+ if (!t16.isObjectProperty(p)) continue;
2077
2003
  let key;
2078
- if (t17.isIdentifier(p.key)) key = p.key.name;
2079
- else if (t17.isStringLiteral(p.key)) key = p.key.value;
2004
+ if (t16.isIdentifier(p.key)) key = p.key.name;
2005
+ else if (t16.isStringLiteral(p.key)) key = p.key.value;
2080
2006
  if (!key) continue;
2081
- if (t17.isExpression(p.value)) {
2007
+ if (t16.isExpression(p.value)) {
2082
2008
  members.push(
2083
- t17.tsPropertySignature(t17.identifier(key), t17.tsTypeAnnotation(expressionToTSType(p.value)))
2009
+ t16.tsPropertySignature(t16.identifier(key), t16.tsTypeAnnotation(expressionToTSType(p.value)))
2084
2010
  );
2085
2011
  } else {
2086
2012
  members.push(
2087
- t17.tsPropertySignature(t17.identifier(key), t17.tsTypeAnnotation(t17.tsAnyKeyword()))
2013
+ t16.tsPropertySignature(t16.identifier(key), t16.tsTypeAnnotation(t16.tsAnyKeyword()))
2088
2014
  );
2089
2015
  }
2090
2016
  }
2091
- return t17.tsTypeLiteral(members);
2017
+ return t16.tsTypeLiteral(members);
2092
2018
  }
2093
- if (t17.isArrowFunctionExpression(exp) || t17.isFunctionExpression(exp)) {
2019
+ if (t16.isArrowFunctionExpression(exp) || t16.isFunctionExpression(exp)) {
2094
2020
  const params = exp.params.map((p, i) => {
2095
- const id = t17.isIdentifier(p) ? t17.identifier(p.name) : t17.identifier(`arg${i}`);
2096
- id.typeAnnotation = t17.tsTypeAnnotation(t17.tsAnyKeyword());
2021
+ const id = t16.isIdentifier(p) ? t16.identifier(p.name) : t16.identifier(`arg${i}`);
2022
+ id.typeAnnotation = t16.tsTypeAnnotation(t16.tsAnyKeyword());
2097
2023
  return id;
2098
2024
  });
2099
- let returnType = t17.tsAnyKeyword();
2100
- if (t17.isBlockStatement(exp.body)) {
2025
+ let returnType = t16.tsAnyKeyword();
2026
+ if (t16.isBlockStatement(exp.body)) {
2101
2027
  for (const stmt of exp.body.body) {
2102
- if (t17.isReturnStatement(stmt) && stmt.argument) {
2103
- if (t17.isExpression(stmt.argument)) {
2028
+ if (t16.isReturnStatement(stmt) && stmt.argument) {
2029
+ if (t16.isExpression(stmt.argument)) {
2104
2030
  returnType = expressionToTSType(stmt.argument);
2105
2031
  break;
2106
2032
  }
2107
2033
  }
2108
2034
  }
2109
- } else if (t17.isExpression(exp.body)) {
2035
+ } else if (t16.isExpression(exp.body)) {
2110
2036
  returnType = expressionToTSType(exp.body);
2111
2037
  }
2112
- return t17.tsFunctionType(null, params, t17.tsTypeAnnotation(returnType));
2038
+ return t16.tsFunctionType(null, params, t16.tsTypeAnnotation(returnType));
2113
2039
  }
2114
- return t17.tsAnyKeyword();
2040
+ return t16.tsAnyKeyword();
2115
2041
  }
2116
2042
  function isCalleeNamed(node, name) {
2117
- if (!t17.isIdentifier(node.callee)) {
2043
+ if (!t16.isIdentifier(node.callee)) {
2118
2044
  return false;
2119
2045
  }
2120
2046
  return node.callee.name === name;
2121
2047
  }
2122
2048
  function isSimpleLiteral(node) {
2123
2049
  if (!node) return false;
2124
- if (t17.isStringLiteral(node) || t17.isNumericLiteral(node) || t17.isBooleanLiteral(node) || t17.isNullLiteral(node) || t17.isRegExpLiteral(node) || t17.isBigIntLiteral(node) || t17.isDecimalLiteral(node)) {
2050
+ if (t16.isStringLiteral(node) || t16.isNumericLiteral(node) || t16.isBooleanLiteral(node) || t16.isNullLiteral(node) || t16.isRegExpLiteral(node) || t16.isBigIntLiteral(node) || t16.isDecimalLiteral(node)) {
2125
2051
  return true;
2126
2052
  }
2127
2053
  return false;
2128
2054
  }
2129
2055
  function forkNode(node, deep = true) {
2130
- const newNode = t17.cloneNode(node, deep);
2056
+ const newNode = t16.cloneNode(node, deep);
2131
2057
  newNode.leadingComments = node.leadingComments;
2132
2058
  newNode.innerComments = node.innerComments;
2133
2059
  newNode.trailingComments = null;
@@ -2160,9 +2086,9 @@ function resolveGlobalTypeChunks(path9, ir) {
2160
2086
 
2161
2087
  function resolveModuleChunks(path9, ir) {
2162
2088
  const forked = forkNode(path9.node);
2163
- if (t18.isImportDeclaration(forked)) {
2089
+ if (t17.isImportDeclaration(forked)) {
2164
2090
  ir.imports.push(forked);
2165
- } else if (t18.isExportDeclaration(forked)) {
2091
+ } else if (t17.isExportDeclaration(forked)) {
2166
2092
  ir.exports.push(forked);
2167
2093
  }
2168
2094
  path9.remove();
@@ -2408,10 +2334,10 @@ function mergeImports(currentNode, ctx, moduleName) {
2408
2334
  }
2409
2335
  const currentImports = /* @__PURE__ */ new Set();
2410
2336
  for (const spec of currentNode.specifiers) {
2411
- if (t19.isImportSpecifier(spec) && t19.isIdentifier(spec.imported)) {
2337
+ if (t18.isImportSpecifier(spec) && t18.isIdentifier(spec.imported)) {
2412
2338
  currentImports.add(spec.imported.name);
2413
2339
  }
2414
- if (t19.isImportDefaultSpecifier(spec) && t19.isIdentifier(spec.local)) {
2340
+ if (t18.isImportDefaultSpecifier(spec) && t18.isIdentifier(spec.local)) {
2415
2341
  currentImports.add(spec.local.name);
2416
2342
  }
2417
2343
  }
@@ -2419,8 +2345,8 @@ function mergeImports(currentNode, ctx, moduleName) {
2419
2345
  if (currentImports.has(item.name)) {
2420
2346
  continue;
2421
2347
  }
2422
- const local = t19.identifier(item.name);
2423
- const newNode = !item.onDemand ? t19.importDefaultSpecifier(local) : t19.importSpecifier(local, local);
2348
+ const local = t18.identifier(item.name);
2349
+ const newNode = !item.onDemand ? t18.importDefaultSpecifier(local) : t18.importSpecifier(local, local);
2424
2350
  currentNode.specifiers.push(newNode);
2425
2351
  }
2426
2352
  ctx.imports.delete(moduleName);
@@ -2429,10 +2355,10 @@ function createImportNodes(ctx) {
2429
2355
  const result = [];
2430
2356
  const importDeclarations = Array.from(ctx.imports).map(([moduleName, items]) => {
2431
2357
  const specifiers = items.map((item) => {
2432
- const local = t19.identifier(item.name);
2433
- return item.onDemand ? t19.importSpecifier(local, local) : t19.importDefaultSpecifier(local);
2358
+ const local = t18.identifier(item.name);
2359
+ return item.onDemand ? t18.importSpecifier(local, local) : t18.importDefaultSpecifier(local);
2434
2360
  });
2435
- return t19.importDeclaration(specifiers, t19.stringLiteral(moduleName));
2361
+ return t18.importDeclaration(specifiers, t18.stringLiteral(moduleName));
2436
2362
  });
2437
2363
  for (const decl of importDeclarations) {
2438
2364
  const name = decl.source.value;
@@ -2462,9 +2388,9 @@ function resolveSfcCssImport(ctx) {
2462
2388
  const { filePath, moduleName } = ctx.styleData;
2463
2389
  if (!filePath) return;
2464
2390
  const styleFilename = normalizePath(filePath).split("/").pop();
2465
- const importDecl = t20.importDeclaration(
2466
- !moduleName ? [] : [t20.importDefaultSpecifier(t20.identifier(moduleName))],
2467
- t20.stringLiteral(`./${styleFilename}`)
2391
+ const importDecl = t19.importDeclaration(
2392
+ !moduleName ? [] : [t19.importDefaultSpecifier(t19.identifier(moduleName))],
2393
+ t19.stringLiteral(`./${styleFilename}`)
2468
2394
  );
2469
2395
  scriptIR.imports.push(importDecl);
2470
2396
  }
@@ -2486,11 +2412,11 @@ function resolveDefineAsyncComponent(ctx) {
2486
2412
  };
2487
2413
  }
2488
2414
  function checkIsUnsupported(ctx, arg) {
2489
- if (t21.isFunction(arg)) {
2415
+ if (t20.isFunction(arg)) {
2490
2416
  checkIsDynamicImport(ctx, arg);
2491
- } else if (t21.isObjectExpression(arg)) {
2417
+ } else if (t20.isObjectExpression(arg)) {
2492
2418
  const { value } = arg.properties.find(
2493
- (p) => t21.isObjectProperty(p) && t21.isIdentifier(p.key) && p.key.name === "loader"
2419
+ (p) => t20.isObjectProperty(p) && t20.isIdentifier(p.key) && p.key.name === "loader"
2494
2420
  );
2495
2421
  checkIsDynamicImport(ctx, value);
2496
2422
  if (arg.properties.length > 1) {
@@ -2501,7 +2427,7 @@ function checkIsUnsupported(ctx, arg) {
2501
2427
  function checkIsDynamicImport(ctx, node) {
2502
2428
  const { scriptData, filename } = ctx;
2503
2429
  const warnIsNotImport = (target) => {
2504
- if (!target || !t21.isImport(target)) {
2430
+ if (!target || !t20.isImport(target)) {
2505
2431
  logger.error(
2506
2432
  `Only ES module dynamic imports are supported. You must use and return import('...').`,
2507
2433
  {
@@ -2512,20 +2438,20 @@ function checkIsDynamicImport(ctx, node) {
2512
2438
  );
2513
2439
  }
2514
2440
  };
2515
- if (t21.isFunction(node)) {
2441
+ if (t20.isFunction(node)) {
2516
2442
  checkIsDynamicImport(ctx, node.body);
2517
2443
  return;
2518
2444
  }
2519
- if (t21.isBlockStatement(node)) {
2445
+ if (t20.isBlockStatement(node)) {
2520
2446
  const [returnSmt] = node.body;
2521
- if (t21.isReturnStatement(returnSmt)) {
2447
+ if (t20.isReturnStatement(returnSmt)) {
2522
2448
  warnIsNotImport(returnSmt.argument);
2523
2449
  }
2524
2450
  return;
2525
2451
  }
2526
- if (t21.isCallExpression(node)) {
2452
+ if (t20.isCallExpression(node)) {
2527
2453
  warnIsNotImport(node.callee);
2528
- if (t21.isStringLiteral(node.arguments[0])) {
2454
+ if (t20.isStringLiteral(node.arguments[0])) {
2529
2455
  replaceVueSuffix(node.arguments[0]);
2530
2456
  }
2531
2457
  return;
@@ -2579,19 +2505,19 @@ function pushToGlobalScope(path9, ctx) {
2579
2505
  // src/core/transform/sfc/script/shared/hook-creator.ts
2580
2506
 
2581
2507
  function createUseCallback(body, deps) {
2582
- return t22.callExpression(t22.identifier(REACT_API_MAP.useCallback), [
2508
+ return t21.callExpression(t21.identifier(REACT_API_MAP.useCallback), [
2583
2509
  body,
2584
- _nullishCoalesce(deps, () => ( t22.arrayExpression([])))
2510
+ _nullishCoalesce(deps, () => ( t21.arrayExpression([])))
2585
2511
  ]);
2586
2512
  }
2587
2513
  function createUseMemo(body, deps) {
2588
- return t22.callExpression(t22.identifier(REACT_API_MAP.useMemo), [
2589
- t22.arrowFunctionExpression([], body),
2590
- _nullishCoalesce(deps, () => ( t22.arrayExpression([])))
2514
+ return t21.callExpression(t21.identifier(REACT_API_MAP.useMemo), [
2515
+ t21.arrowFunctionExpression([], body),
2516
+ _nullishCoalesce(deps, () => ( t21.arrayExpression([])))
2591
2517
  ]);
2592
2518
  }
2593
2519
  function createUseImperativeHandle(refId, init) {
2594
- return t22.callExpression(t22.identifier(REACT_API_MAP.useImperativeHandle), [refId, init]);
2520
+ return t21.callExpression(t21.identifier(REACT_API_MAP.useImperativeHandle), [refId, init]);
2595
2521
  }
2596
2522
 
2597
2523
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-define-expose.ts
@@ -2612,16 +2538,16 @@ function resolveDefineExpose(ctx) {
2612
2538
  const adapter = ADAPTER_RULES.react[MACRO_API_NAMES.expose];
2613
2539
  recordImport(ctx, adapter.package, REACT_API_MAP.forwardRef);
2614
2540
  recordImport(ctx, adapter.package, adapter.target);
2615
- if (!t23.isObjectExpression(expose) && !t23.isFunction(expose)) {
2541
+ if (!t22.isObjectExpression(expose) && !t22.isFunction(expose)) {
2616
2542
  logger.warn("Non-deterministic object literal may cause unknown risks.", {
2617
2543
  file: filename,
2618
2544
  loc: expose.loc,
2619
2545
  source: scriptData.source
2620
2546
  });
2621
2547
  }
2622
- const init = !t23.isFunction(expose) ? t23.arrowFunctionExpression([], expose) : expose;
2548
+ const init = !t22.isFunction(expose) ? t22.arrowFunctionExpression([], expose) : expose;
2623
2549
  const { forwardRef } = scriptData;
2624
- const newNode = createUseImperativeHandle(t23.identifier(forwardRef.refField), init);
2550
+ const newNode = createUseImperativeHandle(t22.identifier(forwardRef.refField), init);
2625
2551
  forwardRef.enabled = true;
2626
2552
  path9.replaceWith(newNode);
2627
2553
  }
@@ -2648,7 +2574,7 @@ function resolveDefineOptions(ctx) {
2648
2574
  path9.remove();
2649
2575
  return;
2650
2576
  }
2651
- if (!t24.isObjectExpression(options)) {
2577
+ if (!t23.isObjectExpression(options)) {
2652
2578
  logger.warn("Argument for defineOptions must be an object expression.", {
2653
2579
  source: scriptData.source,
2654
2580
  file: filename,
@@ -2656,7 +2582,7 @@ function resolveDefineOptions(ctx) {
2656
2582
  });
2657
2583
  } else {
2658
2584
  for (const prop of options.properties) {
2659
- if (!t24.isObjectProperty(prop) || !t24.isIdentifier(prop.key)) {
2585
+ if (!t23.isObjectProperty(prop) || !t23.isIdentifier(prop.key)) {
2660
2586
  continue;
2661
2587
  }
2662
2588
  extractName(prop, ctx);
@@ -2670,7 +2596,7 @@ function extractName(prop, ctx) {
2670
2596
  if (ctx.compName) return;
2671
2597
  const { filename, scriptData } = ctx;
2672
2598
  if (!prop.computed && prop.key.name === "name") {
2673
- if (t24.isStringLiteral(prop.value)) {
2599
+ if (t23.isStringLiteral(prop.value)) {
2674
2600
  ctx.compName = prop.value.value;
2675
2601
  return;
2676
2602
  }
@@ -2697,7 +2623,7 @@ function resolveEmitCalls(ctx) {
2697
2623
  CallExpression(path9) {
2698
2624
  const { node } = path9;
2699
2625
  const { filename, templateData, scriptData } = ctx;
2700
- if (!t25.isIdentifier(node.callee)) return;
2626
+ if (!t24.isIdentifier(node.callee)) return;
2701
2627
  const { name } = node.callee;
2702
2628
  const checkIfFromDefineEmits = () => {
2703
2629
  let result = false;
@@ -2709,7 +2635,7 @@ function resolveEmitCalls(ctx) {
2709
2635
  const binding = path9.scope.getBinding(name);
2710
2636
  if (binding) {
2711
2637
  const parent = binding.path.node;
2712
- if (t25.isVariableDeclarator(parent) && t25.isCallExpression(parent.init) && t25.isIdentifier(parent.init.callee)) {
2638
+ if (t24.isVariableDeclarator(parent) && t24.isCallExpression(parent.init) && t24.isIdentifier(parent.init.callee)) {
2713
2639
  result = parent.init.callee.name === MACRO_API_NAMES.emits;
2714
2640
  }
2715
2641
  }
@@ -2718,7 +2644,7 @@ function resolveEmitCalls(ctx) {
2718
2644
  };
2719
2645
  if (!checkIfFromDefineEmits()) return;
2720
2646
  const [callee, ...args] = node.arguments;
2721
- const eventName = t25.isStringLiteral(callee) ? formatEmitEventName(callee.value) : void 0;
2647
+ const eventName = t24.isStringLiteral(callee) ? formatEmitEventName(callee.value) : void 0;
2722
2648
  if (!eventName) {
2723
2649
  logger.warn(`Expected String type but got ${_optionalChain([callee, 'optionalAccess', _72 => _72.type])}, expression will be removed`, {
2724
2650
  file: filename,
@@ -2728,10 +2654,10 @@ function resolveEmitCalls(ctx) {
2728
2654
  path9.remove();
2729
2655
  return;
2730
2656
  }
2731
- const propCall = t25.optionalCallExpression(
2732
- t25.optionalMemberExpression(
2733
- t25.identifier(ctx.propField),
2734
- t25.identifier(eventName),
2657
+ const propCall = t24.optionalCallExpression(
2658
+ t24.optionalMemberExpression(
2659
+ t24.identifier(ctx.propField),
2660
+ t24.identifier(eventName),
2735
2661
  false,
2736
2662
  true
2737
2663
  ),
@@ -2753,21 +2679,21 @@ function resolveEmitCalls(ctx) {
2753
2679
 
2754
2680
  function cloneCallableParams(params) {
2755
2681
  const cloneCallableParam = (param, index) => {
2756
- if (t26.isRestElement(param)) {
2682
+ if (t25.isRestElement(param)) {
2757
2683
  const arg = param.argument;
2758
- const name = t26.isIdentifier(arg) ? arg.name : `args${index}`;
2759
- const rest = t26.restElement(t26.identifier(name));
2760
- rest.typeAnnotation = param.typeAnnotation || (t26.isIdentifier(arg) ? arg.typeAnnotation : null) || t26.tsTypeAnnotation(t26.tsArrayType(t26.tsAnyKeyword()));
2684
+ const name = t25.isIdentifier(arg) ? arg.name : `args${index}`;
2685
+ const rest = t25.restElement(t25.identifier(name));
2686
+ rest.typeAnnotation = param.typeAnnotation || (t25.isIdentifier(arg) ? arg.typeAnnotation : null) || t25.tsTypeAnnotation(t25.tsArrayType(t25.tsAnyKeyword()));
2761
2687
  return rest;
2762
2688
  }
2763
- if (t26.isIdentifier(param)) {
2764
- const id = t26.identifier(param.name || `arg${index}`);
2689
+ if (t25.isIdentifier(param)) {
2690
+ const id = t25.identifier(param.name || `arg${index}`);
2765
2691
  id.optional = param.optional;
2766
- id.typeAnnotation = param.typeAnnotation || t26.tsTypeAnnotation(t26.tsAnyKeyword());
2692
+ id.typeAnnotation = param.typeAnnotation || t25.tsTypeAnnotation(t25.tsAnyKeyword());
2767
2693
  return id;
2768
2694
  }
2769
- const fallback = t26.identifier(`arg${index}`);
2770
- fallback.typeAnnotation = t26.tsTypeAnnotation(t26.tsAnyKeyword());
2695
+ const fallback = t25.identifier(`arg${index}`);
2696
+ fallback.typeAnnotation = t25.tsTypeAnnotation(t25.tsAnyKeyword());
2771
2697
  return fallback;
2772
2698
  };
2773
2699
  return params.map(cloneCallableParam);
@@ -2777,18 +2703,18 @@ function cloneCallableParams(params) {
2777
2703
  function resolveEmitsTopLevelTypes(ctx) {
2778
2704
  return {
2779
2705
  "TSInterfaceDeclaration|TSTypeAliasDeclaration"(path9) {
2780
- if (!t27.isProgram(path9.parent)) return;
2706
+ if (!t26.isProgram(path9.parent)) return;
2781
2707
  const { node } = path9;
2782
- if (t27.isTSInterfaceDeclaration(node)) {
2783
- const typeLiteral = t27.tsTypeLiteral(node.body.body);
2708
+ if (t26.isTSInterfaceDeclaration(node)) {
2709
+ const typeLiteral = t26.tsTypeLiteral(node.body.body);
2784
2710
  if (!hasEmitsSignatureInType(typeLiteral)) return;
2785
2711
  const resolved = resolveTopLevelEmitType(typeLiteral);
2786
- if (resolved && t27.isTSTypeLiteral(resolved)) {
2712
+ if (resolved && t26.isTSTypeLiteral(resolved)) {
2787
2713
  node.body.body = resolved.members;
2788
2714
  }
2789
2715
  return;
2790
2716
  }
2791
- if (t27.isTSTypeAliasDeclaration(node)) {
2717
+ if (t26.isTSTypeAliasDeclaration(node)) {
2792
2718
  if (!hasEmitsSignatureInType(node.typeAnnotation)) return;
2793
2719
  const resolved = resolveTopLevelEmitType(node.typeAnnotation);
2794
2720
  if (resolved) {
@@ -2799,47 +2725,47 @@ function resolveEmitsTopLevelTypes(ctx) {
2799
2725
  };
2800
2726
  }
2801
2727
  function resolveTopLevelEmitType(tsType) {
2802
- if (t27.isTSParenthesizedType(tsType)) {
2728
+ if (t26.isTSParenthesizedType(tsType)) {
2803
2729
  return resolveTopLevelEmitType(tsType.typeAnnotation);
2804
2730
  }
2805
- if (t27.isTSTypeReference(tsType)) {
2731
+ if (t26.isTSTypeReference(tsType)) {
2806
2732
  if (!tsType.typeParameters || !tsType.typeParameters.params.length) {
2807
2733
  return tsType;
2808
2734
  }
2809
2735
  const params = tsType.typeParameters.params.map((param) => resolveTopLevelEmitType(param)).filter(Boolean);
2810
- return t27.tsTypeReference(
2736
+ return t26.tsTypeReference(
2811
2737
  tsType.typeName,
2812
- t27.tsTypeParameterInstantiation(params.length ? params : tsType.typeParameters.params)
2738
+ t26.tsTypeParameterInstantiation(params.length ? params : tsType.typeParameters.params)
2813
2739
  );
2814
2740
  }
2815
- if (t27.isTSIntersectionType(tsType)) {
2741
+ if (t26.isTSIntersectionType(tsType)) {
2816
2742
  const types = tsType.types.map(resolveTopLevelEmitType).filter(Boolean);
2817
2743
  if (!types.length) return null;
2818
2744
  if (types.length === 1) return types[0];
2819
- return t27.tsIntersectionType(types);
2745
+ return t26.tsIntersectionType(types);
2820
2746
  }
2821
- if (t27.isTSUnionType(tsType)) {
2747
+ if (t26.isTSUnionType(tsType)) {
2822
2748
  const types = tsType.types.map(resolveTopLevelEmitType).filter(Boolean);
2823
2749
  if (!types.length) return null;
2824
2750
  if (types.length === 1) return types[0];
2825
- return t27.tsUnionType(types);
2751
+ return t26.tsUnionType(types);
2826
2752
  }
2827
- if (t27.isTSTypeLiteral(tsType)) {
2753
+ if (t26.isTSTypeLiteral(tsType)) {
2828
2754
  const members = [];
2829
2755
  for (const member of tsType.members) {
2830
- if (t27.isTSCallSignatureDeclaration(member)) {
2756
+ if (t26.isTSCallSignatureDeclaration(member)) {
2831
2757
  members.push(...resolveEmitPropsFromCallSignature(member));
2832
2758
  continue;
2833
2759
  }
2834
2760
  members.push(member);
2835
2761
  }
2836
2762
  if (!members.length) return null;
2837
- return t27.tsTypeLiteral(members);
2763
+ return t26.tsTypeLiteral(members);
2838
2764
  }
2839
- if (t27.isTSFunctionType(tsType)) {
2765
+ if (t26.isTSFunctionType(tsType)) {
2840
2766
  const props = resolveEmitPropsFromCallable(tsType.parameters, tsType.typeAnnotation);
2841
2767
  if (!props.length) return null;
2842
- return t27.tsTypeLiteral(props);
2768
+ return t26.tsTypeLiteral(props);
2843
2769
  }
2844
2770
  return tsType;
2845
2771
  }
@@ -2860,41 +2786,41 @@ function processInferredTypes(ctx, runtimeArg) {
2860
2786
  propsTSIface: { emitTypes }
2861
2787
  } = ctx.scriptData;
2862
2788
  const members = [];
2863
- if (t27.isArrayExpression(runtimeArg)) {
2789
+ if (t26.isArrayExpression(runtimeArg)) {
2864
2790
  for (const element of runtimeArg.elements) {
2865
- if (!element || !t27.isStringLiteral(element)) continue;
2791
+ if (!element || !t26.isStringLiteral(element)) continue;
2866
2792
  const handlerName = resolveEmitHandlerName(element.value);
2867
2793
  const key = buildKey(handlerName);
2868
- const fnType = t27.tsFunctionType(
2794
+ const fnType = t26.tsFunctionType(
2869
2795
  null,
2870
2796
  [createRestAnyParam("args")],
2871
- t27.tsTypeAnnotation(t27.tsAnyKeyword())
2797
+ t26.tsTypeAnnotation(t26.tsAnyKeyword())
2872
2798
  );
2873
- const prop = t27.tsPropertySignature(key, t27.tsTypeAnnotation(fnType));
2799
+ const prop = t26.tsPropertySignature(key, t26.tsTypeAnnotation(fnType));
2874
2800
  prop.optional = true;
2875
2801
  members.push(prop);
2876
2802
  }
2877
2803
  if (members.length) {
2878
- emitTypes.push(t27.tsTypeLiteral(members));
2804
+ emitTypes.push(t26.tsTypeLiteral(members));
2879
2805
  }
2880
2806
  return;
2881
2807
  }
2882
- if (t27.isObjectExpression(runtimeArg)) {
2808
+ if (t26.isObjectExpression(runtimeArg)) {
2883
2809
  for (const prop of runtimeArg.properties) {
2884
- if (!t27.isObjectProperty(prop)) continue;
2885
- if (t27.isSpreadElement(prop)) continue;
2810
+ if (!t26.isObjectProperty(prop)) continue;
2811
+ if (t26.isSpreadElement(prop)) continue;
2886
2812
  const rawName = resolvePropName(prop.key);
2887
2813
  if (!rawName) continue;
2888
2814
  const handlerName = resolveEmitHandlerName(rawName);
2889
2815
  const key = buildKey(handlerName);
2890
- const params = t27.isArrayExpression(prop.value) ? resolveRuntimeTupleParams(prop.value) : [createRestAnyParam("args")];
2891
- const fnType = t27.tsFunctionType(null, params, t27.tsTypeAnnotation(t27.tsAnyKeyword()));
2892
- const propSig = t27.tsPropertySignature(key, t27.tsTypeAnnotation(fnType));
2816
+ const params = t26.isArrayExpression(prop.value) ? resolveRuntimeTupleParams(prop.value) : [createRestAnyParam("args")];
2817
+ const fnType = t26.tsFunctionType(null, params, t26.tsTypeAnnotation(t26.tsAnyKeyword()));
2818
+ const propSig = t26.tsPropertySignature(key, t26.tsTypeAnnotation(fnType));
2893
2819
  propSig.optional = true;
2894
2820
  members.push(propSig);
2895
2821
  }
2896
2822
  if (members.length) {
2897
- emitTypes.push(t27.tsTypeLiteral(members));
2823
+ emitTypes.push(t26.tsTypeLiteral(members));
2898
2824
  }
2899
2825
  }
2900
2826
  }
@@ -2915,129 +2841,129 @@ function resolveEmitHandlerName(rawName) {
2915
2841
  return `on${name}`;
2916
2842
  }
2917
2843
  function resolvePropName(key) {
2918
- if (t27.isIdentifier(key)) return key.name;
2919
- if (t27.isStringLiteral(key)) return key.value;
2920
- if (t27.isNumericLiteral(key)) return String(key.value);
2844
+ if (t26.isIdentifier(key)) return key.name;
2845
+ if (t26.isStringLiteral(key)) return key.value;
2846
+ if (t26.isNumericLiteral(key)) return String(key.value);
2921
2847
  return null;
2922
2848
  }
2923
2849
  function buildKey(name) {
2924
- return t27.isValidIdentifier(name) ? t27.identifier(name) : t27.stringLiteral(name);
2850
+ return t26.isValidIdentifier(name) ? t26.identifier(name) : t26.stringLiteral(name);
2925
2851
  }
2926
2852
  function createRestAnyParam(name) {
2927
- const id = t27.identifier(name);
2928
- const rest = t27.restElement(id);
2929
- rest.typeAnnotation = t27.tsTypeAnnotation(t27.tsArrayType(t27.tsAnyKeyword()));
2853
+ const id = t26.identifier(name);
2854
+ const rest = t26.restElement(id);
2855
+ rest.typeAnnotation = t26.tsTypeAnnotation(t26.tsArrayType(t26.tsAnyKeyword()));
2930
2856
  return rest;
2931
2857
  }
2932
2858
  function resolveRuntimeTupleParams(value) {
2933
2859
  const params = [];
2934
2860
  value.elements.forEach((element, index) => {
2935
2861
  if (!element) return;
2936
- if (t27.isSpreadElement(element)) {
2862
+ if (t26.isSpreadElement(element)) {
2937
2863
  params.push(createRestAnyParam(`args${index}`));
2938
2864
  return;
2939
2865
  }
2940
- if (t27.isIdentifier(element)) {
2941
- const id = t27.identifier(element.name);
2942
- id.typeAnnotation = element.typeAnnotation || t27.tsTypeAnnotation(t27.tsAnyKeyword());
2866
+ if (t26.isIdentifier(element)) {
2867
+ const id = t26.identifier(element.name);
2868
+ id.typeAnnotation = element.typeAnnotation || t26.tsTypeAnnotation(t26.tsAnyKeyword());
2943
2869
  params.push(id);
2944
2870
  return;
2945
2871
  }
2946
- if (t27.isTSAsExpression(element)) {
2947
- const id = t27.identifier(`arg${index}`);
2948
- id.typeAnnotation = t27.tsTypeAnnotation(element.typeAnnotation);
2872
+ if (t26.isTSAsExpression(element)) {
2873
+ const id = t26.identifier(`arg${index}`);
2874
+ id.typeAnnotation = t26.tsTypeAnnotation(element.typeAnnotation);
2949
2875
  params.push(id);
2950
2876
  return;
2951
2877
  }
2952
- const fallback = t27.identifier(`arg${index}`);
2953
- fallback.typeAnnotation = t27.tsTypeAnnotation(t27.tsAnyKeyword());
2878
+ const fallback = t26.identifier(`arg${index}`);
2879
+ fallback.typeAnnotation = t26.tsTypeAnnotation(t26.tsAnyKeyword());
2954
2880
  params.push(fallback);
2955
2881
  });
2956
2882
  return params;
2957
2883
  }
2958
2884
  function resolveExplicitEmitType(tsType) {
2959
- if (t27.isTSParenthesizedType(tsType)) {
2885
+ if (t26.isTSParenthesizedType(tsType)) {
2960
2886
  return resolveExplicitEmitType(tsType.typeAnnotation);
2961
2887
  }
2962
- if (t27.isTSTypeReference(tsType)) {
2888
+ if (t26.isTSTypeReference(tsType)) {
2963
2889
  if (!tsType.typeParameters || !tsType.typeParameters.params.length) {
2964
2890
  return tsType;
2965
2891
  }
2966
2892
  const params = tsType.typeParameters.params.map((param) => resolveExplicitEmitType(param)).filter(Boolean);
2967
- return t27.tsTypeReference(
2893
+ return t26.tsTypeReference(
2968
2894
  tsType.typeName,
2969
- t27.tsTypeParameterInstantiation(params.length ? params : tsType.typeParameters.params)
2895
+ t26.tsTypeParameterInstantiation(params.length ? params : tsType.typeParameters.params)
2970
2896
  );
2971
2897
  }
2972
- if (t27.isTSIntersectionType(tsType)) {
2898
+ if (t26.isTSIntersectionType(tsType)) {
2973
2899
  const types = tsType.types.map(resolveExplicitEmitType).filter(Boolean);
2974
2900
  if (!types.length) return null;
2975
2901
  if (types.length === 1) return types[0];
2976
- return t27.tsIntersectionType(types);
2902
+ return t26.tsIntersectionType(types);
2977
2903
  }
2978
- if (t27.isTSUnionType(tsType)) {
2904
+ if (t26.isTSUnionType(tsType)) {
2979
2905
  const types = tsType.types.map(resolveExplicitEmitType).filter(Boolean);
2980
2906
  if (!types.length) return null;
2981
2907
  if (types.length === 1) return types[0];
2982
- return t27.tsUnionType(types);
2908
+ return t26.tsUnionType(types);
2983
2909
  }
2984
- if (t27.isTSTypeLiteral(tsType)) {
2910
+ if (t26.isTSTypeLiteral(tsType)) {
2985
2911
  const members = [];
2986
2912
  for (const member of tsType.members) {
2987
- if (t27.isTSPropertySignature(member)) {
2913
+ if (t26.isTSPropertySignature(member)) {
2988
2914
  const prop = resolveEmitPropFromPropertySignature(member);
2989
2915
  if (prop) members.push(prop);
2990
2916
  continue;
2991
2917
  }
2992
- if (t27.isTSCallSignatureDeclaration(member)) {
2918
+ if (t26.isTSCallSignatureDeclaration(member)) {
2993
2919
  members.push(...resolveEmitPropsFromCallSignature(member));
2994
2920
  continue;
2995
2921
  }
2996
2922
  }
2997
2923
  if (!members.length) return null;
2998
- return t27.tsTypeLiteral(members);
2924
+ return t26.tsTypeLiteral(members);
2999
2925
  }
3000
- if (t27.isTSFunctionType(tsType)) {
2926
+ if (t26.isTSFunctionType(tsType)) {
3001
2927
  const props = resolveEmitPropsFromCallable(tsType.parameters, tsType.typeAnnotation);
3002
2928
  if (!props.length) return null;
3003
- return t27.tsTypeLiteral(props);
2929
+ return t26.tsTypeLiteral(props);
3004
2930
  }
3005
2931
  return tsType;
3006
2932
  }
3007
2933
  function hasEmitsSignatureInType(tsType) {
3008
- if (t27.isTSParenthesizedType(tsType)) {
2934
+ if (t26.isTSParenthesizedType(tsType)) {
3009
2935
  return hasEmitsSignatureInType(tsType.typeAnnotation);
3010
2936
  }
3011
- if (t27.isTSTypeReference(tsType)) {
2937
+ if (t26.isTSTypeReference(tsType)) {
3012
2938
  if (!tsType.typeParameters || !tsType.typeParameters.params.length) {
3013
2939
  return false;
3014
2940
  }
3015
2941
  return tsType.typeParameters.params.some(hasEmitsSignatureInType);
3016
2942
  }
3017
- if (t27.isTSIntersectionType(tsType) || t27.isTSUnionType(tsType)) {
2943
+ if (t26.isTSIntersectionType(tsType) || t26.isTSUnionType(tsType)) {
3018
2944
  return tsType.types.some(hasEmitsSignatureInType);
3019
2945
  }
3020
- if (t27.isTSTypeLiteral(tsType)) {
2946
+ if (t26.isTSTypeLiteral(tsType)) {
3021
2947
  return tsType.members.some(hasEmitsSignatureInMember);
3022
2948
  }
3023
- if (t27.isTSFunctionType(tsType)) {
2949
+ if (t26.isTSFunctionType(tsType)) {
3024
2950
  return isEmitsCallable(tsType.parameters);
3025
2951
  }
3026
2952
  return false;
3027
2953
  }
3028
2954
  function hasEmitsSignatureInMember(member) {
3029
- if (t27.isTSCallSignatureDeclaration(member)) {
2955
+ if (t26.isTSCallSignatureDeclaration(member)) {
3030
2956
  return isEmitsCallable(member.parameters);
3031
2957
  }
3032
2958
  return false;
3033
2959
  }
3034
2960
  function isEmitsCallable(parameters) {
3035
2961
  const [eventParam] = parameters;
3036
- if (!eventParam || !t27.isIdentifier(eventParam) || !eventParam.typeAnnotation) {
2962
+ if (!eventParam || !t26.isIdentifier(eventParam) || !eventParam.typeAnnotation) {
3037
2963
  return false;
3038
2964
  }
3039
2965
  const { typeAnnotation } = eventParam;
3040
- if (t27.isNoop(typeAnnotation)) return false;
2966
+ if (t26.isNoop(typeAnnotation)) return false;
3041
2967
  return resolveEventNames(typeAnnotation.typeAnnotation).length > 0;
3042
2968
  }
3043
2969
  function resolveEmitPropFromPropertySignature(member) {
@@ -3047,19 +2973,19 @@ function resolveEmitPropFromPropertySignature(member) {
3047
2973
  const key = buildKey(handlerName);
3048
2974
  const typeAnnotation = _optionalChain([member, 'access', _77 => _77.typeAnnotation, 'optionalAccess', _78 => _78.typeAnnotation]);
3049
2975
  let params = [];
3050
- let returnType = t27.tsAnyKeyword();
3051
- if (typeAnnotation && t27.isTSFunctionType(typeAnnotation)) {
2976
+ let returnType = t26.tsAnyKeyword();
2977
+ if (typeAnnotation && t26.isTSFunctionType(typeAnnotation)) {
3052
2978
  params = cloneCallableParams(typeAnnotation.parameters);
3053
2979
  returnType = _nullishCoalesce(_optionalChain([typeAnnotation, 'access', _79 => _79.typeAnnotation, 'optionalAccess', _80 => _80.typeAnnotation]), () => ( returnType));
3054
- } else if (typeAnnotation && t27.isTSTupleType(typeAnnotation)) {
2980
+ } else if (typeAnnotation && t26.isTSTupleType(typeAnnotation)) {
3055
2981
  params = resolveTupleTypeParams(typeAnnotation);
3056
2982
  } else if (typeAnnotation) {
3057
- const id = t27.identifier("value");
3058
- id.typeAnnotation = t27.tsTypeAnnotation(typeAnnotation);
2983
+ const id = t26.identifier("value");
2984
+ id.typeAnnotation = t26.tsTypeAnnotation(typeAnnotation);
3059
2985
  params = [id];
3060
2986
  }
3061
- const fnType = t27.tsFunctionType(null, params, t27.tsTypeAnnotation(returnType));
3062
- const prop = t27.tsPropertySignature(key, t27.tsTypeAnnotation(fnType));
2987
+ const fnType = t26.tsFunctionType(null, params, t26.tsTypeAnnotation(returnType));
2988
+ const prop = t26.tsPropertySignature(key, t26.tsTypeAnnotation(fnType));
3063
2989
  prop.optional = !!member.optional;
3064
2990
  return prop;
3065
2991
  }
@@ -3068,32 +2994,32 @@ function resolveEmitPropsFromCallSignature(member) {
3068
2994
  }
3069
2995
  function resolveEmitPropsFromCallable(parameters, typeAnnotation) {
3070
2996
  const [eventParam, ...restParams] = parameters;
3071
- if (!eventParam || !t27.isIdentifier(eventParam) || !eventParam.typeAnnotation) {
2997
+ if (!eventParam || !t26.isIdentifier(eventParam) || !eventParam.typeAnnotation) {
3072
2998
  return [];
3073
2999
  }
3074
3000
  const { typeAnnotation: paramTypeAnnotation } = eventParam;
3075
- if (t27.isNoop(paramTypeAnnotation)) return [];
3001
+ if (t26.isNoop(paramTypeAnnotation)) return [];
3076
3002
  const eventNames = resolveEventNames(paramTypeAnnotation.typeAnnotation);
3077
3003
  if (!eventNames.length) return [];
3078
- const returnType = _nullishCoalesce(_optionalChain([typeAnnotation, 'optionalAccess', _81 => _81.typeAnnotation]), () => ( t27.tsAnyKeyword()));
3004
+ const returnType = _nullishCoalesce(_optionalChain([typeAnnotation, 'optionalAccess', _81 => _81.typeAnnotation]), () => ( t26.tsAnyKeyword()));
3079
3005
  return eventNames.map((eventName) => {
3080
3006
  const handlerName = resolveEmitHandlerName(eventName);
3081
3007
  const key = buildKey(handlerName);
3082
3008
  const params = cloneCallableParams(restParams);
3083
- const fnType = t27.tsFunctionType(null, params, t27.tsTypeAnnotation(returnType));
3084
- const prop = t27.tsPropertySignature(key, t27.tsTypeAnnotation(fnType));
3009
+ const fnType = t26.tsFunctionType(null, params, t26.tsTypeAnnotation(returnType));
3010
+ const prop = t26.tsPropertySignature(key, t26.tsTypeAnnotation(fnType));
3085
3011
  prop.optional = true;
3086
3012
  return prop;
3087
3013
  });
3088
3014
  }
3089
3015
  function resolveEventNames(type) {
3090
- if (t27.isTSLiteralType(type) && t27.isStringLiteral(type.literal)) {
3016
+ if (t26.isTSLiteralType(type) && t26.isStringLiteral(type.literal)) {
3091
3017
  return [type.literal.value];
3092
3018
  }
3093
- if (t27.isTSUnionType(type)) {
3019
+ if (t26.isTSUnionType(type)) {
3094
3020
  return type.types.flatMap(resolveEventNames);
3095
3021
  }
3096
- if (t27.isTSParenthesizedType(type)) {
3022
+ if (t26.isTSParenthesizedType(type)) {
3097
3023
  return resolveEventNames(type.typeAnnotation);
3098
3024
  }
3099
3025
  return [];
@@ -3106,39 +3032,39 @@ function resolveTupleTypeParams(tuple) {
3106
3032
  return params;
3107
3033
  }
3108
3034
  function resolveTupleElementParam(element, index) {
3109
- const isNamedTuple = typeof t27.isTSNamedTupleMember === "function" && t27.isTSNamedTupleMember(element);
3035
+ const isNamedTuple = typeof t26.isTSNamedTupleMember === "function" && t26.isTSNamedTupleMember(element);
3110
3036
  if (isNamedTuple) {
3111
3037
  const tupleMember = element;
3112
3038
  const name = _optionalChain([tupleMember, 'access', _82 => _82.label, 'optionalAccess', _83 => _83.name]) || `arg${index}`;
3113
3039
  let innerType = tupleMember.elementType;
3114
3040
  let optional = tupleMember.optional;
3115
- if (t27.isTSOptionalType(innerType)) {
3041
+ if (t26.isTSOptionalType(innerType)) {
3116
3042
  optional = true;
3117
3043
  innerType = innerType.typeAnnotation;
3118
3044
  }
3119
- if (t27.isTSRestType(innerType)) {
3120
- const rest = t27.restElement(t27.identifier(name));
3121
- rest.typeAnnotation = t27.tsTypeAnnotation(innerType.typeAnnotation);
3045
+ if (t26.isTSRestType(innerType)) {
3046
+ const rest = t26.restElement(t26.identifier(name));
3047
+ rest.typeAnnotation = t26.tsTypeAnnotation(innerType.typeAnnotation);
3122
3048
  return rest;
3123
3049
  }
3124
- const id2 = t27.identifier(name);
3050
+ const id2 = t26.identifier(name);
3125
3051
  id2.optional = optional;
3126
- id2.typeAnnotation = t27.tsTypeAnnotation(innerType);
3052
+ id2.typeAnnotation = t26.tsTypeAnnotation(innerType);
3127
3053
  return id2;
3128
3054
  }
3129
- if (t27.isTSRestType(element)) {
3130
- const rest = t27.restElement(t27.identifier(`args${index}`));
3131
- rest.typeAnnotation = t27.tsTypeAnnotation(element.typeAnnotation);
3055
+ if (t26.isTSRestType(element)) {
3056
+ const rest = t26.restElement(t26.identifier(`args${index}`));
3057
+ rest.typeAnnotation = t26.tsTypeAnnotation(element.typeAnnotation);
3132
3058
  return rest;
3133
3059
  }
3134
- if (t27.isTSOptionalType(element)) {
3135
- const id2 = t27.identifier(`arg${index}`);
3060
+ if (t26.isTSOptionalType(element)) {
3061
+ const id2 = t26.identifier(`arg${index}`);
3136
3062
  id2.optional = true;
3137
- id2.typeAnnotation = t27.tsTypeAnnotation(element.typeAnnotation);
3063
+ id2.typeAnnotation = t26.tsTypeAnnotation(element.typeAnnotation);
3138
3064
  return id2;
3139
3065
  }
3140
- const id = t27.identifier(`arg${index}`);
3141
- id.typeAnnotation = t27.tsTypeAnnotation(element);
3066
+ const id = t26.identifier(`arg${index}`);
3067
+ id.typeAnnotation = t26.tsTypeAnnotation(element);
3142
3068
  return id;
3143
3069
  }
3144
3070
 
@@ -3163,38 +3089,38 @@ function processInferredTypes2(ctx, runtimeArg) {
3163
3089
  } = scriptData;
3164
3090
  if (!runtimeArg) return;
3165
3091
  const members = [];
3166
- if (t28.isArrayExpression(runtimeArg)) {
3092
+ if (t27.isArrayExpression(runtimeArg)) {
3167
3093
  for (const element of runtimeArg.elements) {
3168
- if (!element || !t28.isStringLiteral(element)) continue;
3169
- const key = t28.isValidIdentifier(element.value) ? t28.identifier(element.value) : t28.stringLiteral(element.value);
3170
- const prop = t28.tsPropertySignature(key, t28.tsTypeAnnotation(t28.tsAnyKeyword()));
3094
+ if (!element || !t27.isStringLiteral(element)) continue;
3095
+ const key = t27.isValidIdentifier(element.value) ? t27.identifier(element.value) : t27.stringLiteral(element.value);
3096
+ const prop = t27.tsPropertySignature(key, t27.tsTypeAnnotation(t27.tsAnyKeyword()));
3171
3097
  prop.optional = true;
3172
3098
  members.push(prop);
3173
3099
  }
3174
3100
  if (members.length) {
3175
- propsTypes.push(t28.tsTypeLiteral(members));
3101
+ propsTypes.push(t27.tsTypeLiteral(members));
3176
3102
  }
3177
3103
  return;
3178
3104
  }
3179
- if (t28.isObjectExpression(runtimeArg)) {
3105
+ if (t27.isObjectExpression(runtimeArg)) {
3180
3106
  for (const prop of runtimeArg.properties) {
3181
- if (!t28.isObjectProperty(prop)) continue;
3182
- if (t28.isSpreadElement(prop)) continue;
3107
+ if (!t27.isObjectProperty(prop)) continue;
3108
+ if (t27.isSpreadElement(prop)) continue;
3183
3109
  const key = prop.key;
3184
3110
  let propName = null;
3185
- if (t28.isIdentifier(key)) propName = key.name;
3186
- if (t28.isStringLiteral(key)) propName = key.value;
3187
- if (t28.isNumericLiteral(key)) propName = String(key.value);
3111
+ if (t27.isIdentifier(key)) propName = key.name;
3112
+ if (t27.isStringLiteral(key)) propName = key.value;
3113
+ if (t27.isNumericLiteral(key)) propName = String(key.value);
3188
3114
  if (!propName) continue;
3189
3115
  const { type, required } = resolveRuntimePropMeta(prop.value);
3190
- const tsType = _nullishCoalesce(type, () => ( t28.tsAnyKeyword()));
3191
- const tsKey = t28.isValidIdentifier(propName) ? t28.identifier(propName) : t28.stringLiteral(propName);
3192
- const tsProp = t28.tsPropertySignature(tsKey, t28.tsTypeAnnotation(tsType));
3116
+ const tsType = _nullishCoalesce(type, () => ( t27.tsAnyKeyword()));
3117
+ const tsKey = t27.isValidIdentifier(propName) ? t27.identifier(propName) : t27.stringLiteral(propName);
3118
+ const tsProp = t27.tsPropertySignature(tsKey, t27.tsTypeAnnotation(tsType));
3193
3119
  tsProp.optional = !required;
3194
3120
  members.push(tsProp);
3195
3121
  }
3196
3122
  if (members.length) {
3197
- propsTypes.push(t28.tsTypeLiteral(members));
3123
+ propsTypes.push(t27.tsTypeLiteral(members));
3198
3124
  }
3199
3125
  return;
3200
3126
  }
@@ -3208,42 +3134,42 @@ function processInferredTypes2(ctx, runtimeArg) {
3208
3134
  );
3209
3135
  }
3210
3136
  function resolveRuntimePropMeta(value) {
3211
- if (t28.isIdentifier(value)) {
3137
+ if (t27.isIdentifier(value)) {
3212
3138
  return {
3213
3139
  type: mapRuntimeTypeToTSType(value),
3214
3140
  required: false
3215
3141
  };
3216
3142
  }
3217
- if (t28.isArrayExpression(value)) {
3143
+ if (t27.isArrayExpression(value)) {
3218
3144
  return {
3219
3145
  type: resolveRuntimeUnionType(value),
3220
3146
  required: false
3221
3147
  };
3222
3148
  }
3223
- if (!t28.isObjectExpression(value)) {
3149
+ if (!t27.isObjectExpression(value)) {
3224
3150
  return { required: false };
3225
3151
  }
3226
3152
  let type;
3227
3153
  let required = false;
3228
3154
  for (const prop of value.properties) {
3229
- if (!t28.isObjectProperty(prop)) continue;
3230
- if (t28.isSpreadElement(prop)) continue;
3155
+ if (!t27.isObjectProperty(prop)) continue;
3156
+ if (t27.isSpreadElement(prop)) continue;
3231
3157
  const key = prop.key;
3232
- const propName = t28.isIdentifier(key) ? key.name : t28.isStringLiteral(key) ? key.value : null;
3158
+ const propName = t27.isIdentifier(key) ? key.name : t27.isStringLiteral(key) ? key.value : null;
3233
3159
  if (!propName) continue;
3234
3160
  if (propName === "type") {
3235
3161
  const valueNode = prop.value;
3236
- if (t28.isArrayExpression(valueNode)) {
3162
+ if (t27.isArrayExpression(valueNode)) {
3237
3163
  type = resolveRuntimeUnionType(valueNode);
3238
3164
  continue;
3239
3165
  }
3240
- if (t28.isIdentifier(valueNode)) {
3166
+ if (t27.isIdentifier(valueNode)) {
3241
3167
  type = mapRuntimeTypeToTSType(valueNode);
3242
3168
  continue;
3243
3169
  }
3244
3170
  }
3245
3171
  if (propName === "required") {
3246
- if (t28.isBooleanLiteral(prop.value)) {
3172
+ if (t27.isBooleanLiteral(prop.value)) {
3247
3173
  required = prop.value.value;
3248
3174
  }
3249
3175
  }
@@ -3253,34 +3179,34 @@ function resolveRuntimePropMeta(value) {
3253
3179
  function resolveRuntimeUnionType(value) {
3254
3180
  const types = [];
3255
3181
  for (const element of value.elements) {
3256
- if (!element || !t28.isIdentifier(element)) continue;
3182
+ if (!element || !t27.isIdentifier(element)) continue;
3257
3183
  const resolved = mapRuntimeTypeToTSType(element);
3258
3184
  if (resolved) types.push(resolved);
3259
3185
  }
3260
- if (!types.length) return t28.tsAnyKeyword();
3186
+ if (!types.length) return t27.tsAnyKeyword();
3261
3187
  if (types.length === 1) return types[0];
3262
- return t28.tsUnionType(types);
3188
+ return t27.tsUnionType(types);
3263
3189
  }
3264
3190
  function mapRuntimeTypeToTSType(value) {
3265
3191
  switch (value.name) {
3266
3192
  case "String":
3267
- return t28.tsStringKeyword();
3193
+ return t27.tsStringKeyword();
3268
3194
  case "Number":
3269
- return t28.tsNumberKeyword();
3195
+ return t27.tsNumberKeyword();
3270
3196
  case "Boolean":
3271
- return t28.tsBooleanKeyword();
3197
+ return t27.tsBooleanKeyword();
3272
3198
  case "Object":
3273
- return t28.tsTypeLiteral([]);
3199
+ return t27.tsTypeLiteral([]);
3274
3200
  case "Array":
3275
- return t28.tsArrayType(t28.tsAnyKeyword());
3201
+ return t27.tsArrayType(t27.tsAnyKeyword());
3276
3202
  case "Function":
3277
- return t28.tsFunctionType(null, [], t28.tsTypeAnnotation(t28.tsAnyKeyword()));
3203
+ return t27.tsFunctionType(null, [], t27.tsTypeAnnotation(t27.tsAnyKeyword()));
3278
3204
  case "Symbol":
3279
- return t28.tsSymbolKeyword();
3205
+ return t27.tsSymbolKeyword();
3280
3206
  case "BigInt":
3281
- return t28.tsBigIntKeyword();
3207
+ return t27.tsBigIntKeyword();
3282
3208
  default:
3283
- return t28.tsAnyKeyword();
3209
+ return t27.tsAnyKeyword();
3284
3210
  }
3285
3211
  }
3286
3212
 
@@ -3295,19 +3221,19 @@ function resolveSlotsTopLevelTypes(ctx) {
3295
3221
  }
3296
3222
  return {
3297
3223
  "TSInterfaceDeclaration|TSTypeAliasDeclaration"(path9) {
3298
- if (!t29.isProgram(path9.parent)) return;
3224
+ if (!t28.isProgram(path9.parent)) return;
3299
3225
  const { node } = path9;
3300
- if (t29.isTSInterfaceDeclaration(node)) {
3301
- const typeLiteral = t29.tsTypeLiteral(node.body.body);
3226
+ if (t28.isTSInterfaceDeclaration(node)) {
3227
+ const typeLiteral = t28.tsTypeLiteral(node.body.body);
3302
3228
  if (!hasSlotsSignatureInType(typeLiteral)) return;
3303
3229
  const resolved = resolveSlotType(typeLiteral);
3304
- if (resolved && t29.isTSTypeLiteral(resolved)) {
3230
+ if (resolved && t28.isTSTypeLiteral(resolved)) {
3305
3231
  node.body.body = resolved.members;
3306
3232
  recordReactNode(ctx);
3307
3233
  }
3308
3234
  return;
3309
3235
  }
3310
- if (t29.isTSTypeAliasDeclaration(node)) {
3236
+ if (t28.isTSTypeAliasDeclaration(node)) {
3311
3237
  if (!hasSlotsSignatureInType(node.typeAnnotation)) return;
3312
3238
  const resolved = resolveSlotType(node.typeAnnotation);
3313
3239
  if (resolved) {
@@ -3352,7 +3278,7 @@ function resolveTemplateSlotIface(ctx) {
3352
3278
  }
3353
3279
  if (tsMembers.length) {
3354
3280
  recordReactNode(ctx);
3355
- slotTypes.push(t29.tsTypeLiteral(tsMembers));
3281
+ slotTypes.push(t28.tsTypeLiteral(tsMembers));
3356
3282
  }
3357
3283
  }
3358
3284
  function recordReactNode(ctx) {
@@ -3362,32 +3288,32 @@ function recordReactNode(ctx) {
3362
3288
  recordImport(ctx, PACKAGE_NAME.react, REACT_API_MAP.ReactNode);
3363
3289
  }
3364
3290
  function resolveSlotType(tsType) {
3365
- if (t29.isTSParenthesizedType(tsType)) {
3291
+ if (t28.isTSParenthesizedType(tsType)) {
3366
3292
  return resolveSlotType(tsType.typeAnnotation);
3367
3293
  }
3368
- if (t29.isTSTypeReference(tsType)) {
3294
+ if (t28.isTSTypeReference(tsType)) {
3369
3295
  if (!tsType.typeParameters || !tsType.typeParameters.params.length) {
3370
3296
  return tsType;
3371
3297
  }
3372
3298
  const params = tsType.typeParameters.params.map((param) => resolveSlotType(param)).filter(Boolean);
3373
- return t29.tsTypeReference(
3299
+ return t28.tsTypeReference(
3374
3300
  tsType.typeName,
3375
- t29.tsTypeParameterInstantiation(params.length ? params : tsType.typeParameters.params)
3301
+ t28.tsTypeParameterInstantiation(params.length ? params : tsType.typeParameters.params)
3376
3302
  );
3377
3303
  }
3378
- if (t29.isTSIntersectionType(tsType)) {
3304
+ if (t28.isTSIntersectionType(tsType)) {
3379
3305
  const types = tsType.types.map(resolveSlotType).filter(Boolean);
3380
3306
  if (!types.length) return null;
3381
3307
  if (types.length === 1) return types[0];
3382
- return t29.tsIntersectionType(types);
3308
+ return t28.tsIntersectionType(types);
3383
3309
  }
3384
- if (t29.isTSUnionType(tsType)) {
3310
+ if (t28.isTSUnionType(tsType)) {
3385
3311
  const types = tsType.types.map(resolveSlotType).filter(Boolean);
3386
3312
  if (!types.length) return null;
3387
3313
  if (types.length === 1) return types[0];
3388
- return t29.tsUnionType(types);
3314
+ return t28.tsUnionType(types);
3389
3315
  }
3390
- if (t29.isTSTypeLiteral(tsType)) {
3316
+ if (t28.isTSTypeLiteral(tsType)) {
3391
3317
  const members = [];
3392
3318
  for (const member of tsType.members) {
3393
3319
  const resolved = resolveSlotPropFromMember(member);
@@ -3398,56 +3324,56 @@ function resolveSlotType(tsType) {
3398
3324
  members.push(member);
3399
3325
  }
3400
3326
  if (!members.length) return null;
3401
- return t29.tsTypeLiteral(members);
3327
+ return t28.tsTypeLiteral(members);
3402
3328
  }
3403
- if (t29.isTSFunctionType(tsType)) {
3329
+ if (t28.isTSFunctionType(tsType)) {
3404
3330
  const props = buildSlotPropSignature(
3405
3331
  SLOT_DEFAULT_NAME,
3406
3332
  cloneCallableParams(tsType.parameters),
3407
3333
  false
3408
3334
  );
3409
- return t29.tsTypeLiteral([props]);
3335
+ return t28.tsTypeLiteral([props]);
3410
3336
  }
3411
3337
  return tsType;
3412
3338
  }
3413
3339
  function hasSlotsSignatureInType(tsType) {
3414
- if (t29.isTSParenthesizedType(tsType)) {
3340
+ if (t28.isTSParenthesizedType(tsType)) {
3415
3341
  return hasSlotsSignatureInType(tsType.typeAnnotation);
3416
3342
  }
3417
- if (t29.isTSTypeReference(tsType)) {
3343
+ if (t28.isTSTypeReference(tsType)) {
3418
3344
  if (!tsType.typeParameters || !tsType.typeParameters.params.length) {
3419
3345
  return false;
3420
3346
  }
3421
3347
  return tsType.typeParameters.params.some(hasSlotsSignatureInType);
3422
3348
  }
3423
- if (t29.isTSIntersectionType(tsType) || t29.isTSUnionType(tsType)) {
3349
+ if (t28.isTSIntersectionType(tsType) || t28.isTSUnionType(tsType)) {
3424
3350
  return tsType.types.some(hasSlotsSignatureInType);
3425
3351
  }
3426
- if (t29.isTSTypeLiteral(tsType)) {
3352
+ if (t28.isTSTypeLiteral(tsType)) {
3427
3353
  return tsType.members.some(hasSlotsSignatureInMember);
3428
3354
  }
3429
- if (t29.isTSFunctionType(tsType)) {
3355
+ if (t28.isTSFunctionType(tsType)) {
3430
3356
  return true;
3431
3357
  }
3432
3358
  return false;
3433
3359
  }
3434
3360
  function hasSlotsSignatureInMember(member) {
3435
- if (t29.isTSMethodSignature(member)) return true;
3436
- if (t29.isTSCallSignatureDeclaration(member)) return true;
3437
- if (t29.isTSPropertySignature(member)) {
3361
+ if (t28.isTSMethodSignature(member)) return true;
3362
+ if (t28.isTSCallSignatureDeclaration(member)) return true;
3363
+ if (t28.isTSPropertySignature(member)) {
3438
3364
  const typeAnnotation = _optionalChain([member, 'access', _91 => _91.typeAnnotation, 'optionalAccess', _92 => _92.typeAnnotation]);
3439
3365
  return !!(typeAnnotation && resolveCallableType(typeAnnotation));
3440
3366
  }
3441
3367
  return false;
3442
3368
  }
3443
3369
  function resolveSlotPropFromMember(member) {
3444
- if (t29.isTSMethodSignature(member)) {
3370
+ if (t28.isTSMethodSignature(member)) {
3445
3371
  const rawName = resolvePropName2(member.key);
3446
3372
  if (!rawName) return null;
3447
3373
  const params = cloneCallableParams(member.parameters);
3448
3374
  return buildSlotPropSignature(rawName, params, !!member.optional);
3449
3375
  }
3450
- if (t29.isTSPropertySignature(member)) {
3376
+ if (t28.isTSPropertySignature(member)) {
3451
3377
  const rawName = resolvePropName2(member.key);
3452
3378
  if (!rawName) return null;
3453
3379
  const typeAnnotation = _optionalChain([member, 'access', _93 => _93.typeAnnotation, 'optionalAccess', _94 => _94.typeAnnotation]);
@@ -3456,53 +3382,53 @@ function resolveSlotPropFromMember(member) {
3456
3382
  const params = cloneCallableParams(callable.parameters);
3457
3383
  return buildSlotPropSignature(rawName, params, !!member.optional);
3458
3384
  }
3459
- if (t29.isTSCallSignatureDeclaration(member)) {
3385
+ if (t28.isTSCallSignatureDeclaration(member)) {
3460
3386
  const params = cloneCallableParams(member.parameters);
3461
3387
  return buildSlotPropSignature(SLOT_DEFAULT_NAME, params, true);
3462
3388
  }
3463
3389
  return null;
3464
3390
  }
3465
3391
  function resolveCallableType(tsType) {
3466
- if (t29.isTSFunctionType(tsType)) return tsType;
3467
- if (t29.isTSParenthesizedType(tsType)) return resolveCallableType(tsType.typeAnnotation);
3392
+ if (t28.isTSFunctionType(tsType)) return tsType;
3393
+ if (t28.isTSParenthesizedType(tsType)) return resolveCallableType(tsType.typeAnnotation);
3468
3394
  return null;
3469
3395
  }
3470
3396
  function buildSlotPropSignature(rawName, params, optional) {
3471
3397
  const propName = rawName === SLOT_DEFAULT_NAME ? SLOT_CHILDREN_NAME : rawName;
3472
- const key = t29.isValidIdentifier(propName) ? t29.identifier(propName) : t29.stringLiteral(propName);
3473
- const reactNodeType = t29.tsTypeAnnotation(
3474
- t29.tsTypeReference(t29.identifier(REACT_API_MAP.ReactNode))
3398
+ const key = t28.isValidIdentifier(propName) ? t28.identifier(propName) : t28.stringLiteral(propName);
3399
+ const reactNodeType = t28.tsTypeAnnotation(
3400
+ t28.tsTypeReference(t28.identifier(REACT_API_MAP.ReactNode))
3475
3401
  );
3476
3402
  let typeAnnotation;
3477
3403
  if (rawName === SLOT_DEFAULT_NAME && params.length === 0 || params.length === 0) {
3478
3404
  typeAnnotation = reactNodeType;
3479
3405
  } else {
3480
- const fnType = t29.tsFunctionType(null, params, reactNodeType);
3481
- typeAnnotation = t29.tsTypeAnnotation(fnType);
3406
+ const fnType = t28.tsFunctionType(null, params, reactNodeType);
3407
+ typeAnnotation = t28.tsTypeAnnotation(fnType);
3482
3408
  }
3483
- const prop = t29.tsPropertySignature(key, typeAnnotation);
3409
+ const prop = t28.tsPropertySignature(key, typeAnnotation);
3484
3410
  prop.optional = optional;
3485
3411
  return prop;
3486
3412
  }
3487
3413
  function createSlotScopeParam(props, ctx) {
3488
- const paramId = t29.identifier(SLOT_FN_PARAM_NAME);
3414
+ const paramId = t28.identifier(SLOT_FN_PARAM_NAME);
3489
3415
  const propsSigns = [];
3490
3416
  const { reactiveBindings } = ctx.templateData;
3491
3417
  props.forEach(({ prop, tsType }) => {
3492
3418
  const foundBindingValue = _optionalChain([reactiveBindings, 'access', _95 => _95[prop], 'optionalAccess', _96 => _96.value]);
3493
3419
  const foundBindingTypes = foundBindingValue ? expressionToTSType(foundBindingValue) : null;
3494
- const typeAnnotation = foundBindingTypes ? t29.tsTypeAnnotation(foundBindingTypes) : tsType;
3495
- const key = t29.isValidIdentifier(prop) ? t29.identifier(prop) : t29.stringLiteral(prop);
3496
- const propSign = t29.tsPropertySignature(key, typeAnnotation);
3420
+ const typeAnnotation = foundBindingTypes ? t28.tsTypeAnnotation(foundBindingTypes) : tsType;
3421
+ const key = t28.isValidIdentifier(prop) ? t28.identifier(prop) : t28.stringLiteral(prop);
3422
+ const propSign = t28.tsPropertySignature(key, typeAnnotation);
3497
3423
  propsSigns.push(propSign);
3498
3424
  });
3499
- paramId.typeAnnotation = t29.tsTypeAnnotation(t29.tsTypeLiteral(propsSigns));
3425
+ paramId.typeAnnotation = t28.tsTypeAnnotation(t28.tsTypeLiteral(propsSigns));
3500
3426
  return paramId;
3501
3427
  }
3502
3428
  function resolvePropName2(key) {
3503
- if (t29.isIdentifier(key)) return key.name;
3504
- if (t29.isStringLiteral(key)) return key.value;
3505
- if (t29.isNumericLiteral(key)) return String(key.value);
3429
+ if (t28.isIdentifier(key)) return key.name;
3430
+ if (t28.isStringLiteral(key)) return key.value;
3431
+ if (t28.isNumericLiteral(key)) return String(key.value);
3506
3432
  return null;
3507
3433
  }
3508
3434
 
@@ -3554,9 +3480,9 @@ function resolveCompIProps(ctx, ast) {
3554
3480
  }
3555
3481
  const n = ctx.compName || "Comp";
3556
3482
  const ns = `I${camelCase(capitalize(n))}Props`;
3557
- const typeNode = t30.tsIntersectionType(tsTypes);
3558
- const typeAliasDecl = t30.tsTypeAliasDeclaration(t30.identifier(ns), null, typeNode);
3559
- const exportDecl = t30.exportNamedDeclaration(typeAliasDecl);
3483
+ const typeNode = t29.tsIntersectionType(tsTypes);
3484
+ const typeAliasDecl = t29.tsTypeAliasDeclaration(t29.identifier(ns), null, typeNode);
3485
+ const exportDecl = t29.exportNamedDeclaration(typeAliasDecl);
3560
3486
  propsTSIface.name = ns;
3561
3487
  const scriptIR = getScriptIR(ctx);
3562
3488
  scriptIR.exports.push(exportDecl);
@@ -3572,9 +3498,9 @@ function resolveCompIProps(ctx, ast) {
3572
3498
  var TRACE_MAX_DEPTH = 20;
3573
3499
  function analyzeDeps(node, ctx, parentPath) {
3574
3500
  if (!parentPath) {
3575
- return t31.arrayExpression([]);
3501
+ return t30.arrayExpression([]);
3576
3502
  }
3577
- const isFnExpr = t31.isArrowFunctionExpression(node) || t31.isFunctionExpression(node);
3503
+ const isFnExpr = t30.isArrowFunctionExpression(node) || t30.isFunctionExpression(node);
3578
3504
  const analyzeTarget = isFnExpr ? node.body : node;
3579
3505
  const bindingLocalBoundary = isFnExpr ? node : analyzeTarget;
3580
3506
  const reactiveStateApis = getReactiveStateApis();
@@ -3585,13 +3511,13 @@ function analyzeDeps(node, ctx, parentPath) {
3585
3511
  }
3586
3512
  const analyzeTargetPath = parentPath && parentPath.node === analyzeTarget ? parentPath : null;
3587
3513
  if (analyzeTargetPath) {
3588
- if (t31.isMemberExpression(analyzeTarget) || t31.isOptionalMemberExpression(analyzeTarget)) {
3514
+ if (t30.isMemberExpression(analyzeTarget) || t30.isOptionalMemberExpression(analyzeTarget)) {
3589
3515
  const rootId = findRootIdentifier(analyzeTarget);
3590
3516
  if (rootId) {
3591
3517
  tryAddDependency(analyzeTargetPath, rootId.name, analyzeTargetPath.scope);
3592
3518
  processedIdentifiers.add(rootId);
3593
3519
  }
3594
- } else if (t31.isIdentifier(analyzeTarget)) {
3520
+ } else if (t30.isIdentifier(analyzeTarget)) {
3595
3521
  tryAddDependency(analyzeTargetPath, analyzeTarget.name, analyzeTargetPath.scope);
3596
3522
  }
3597
3523
  }
@@ -3642,55 +3568,55 @@ function analyzeDeps(node, ctx, parentPath) {
3642
3568
  }
3643
3569
  }
3644
3570
  function normalizeDependencyExpr(path9, rootName) {
3645
- if (t31.isIdentifier(path9.node)) {
3646
- return t31.identifier(path9.node.name);
3571
+ if (t30.isIdentifier(path9.node)) {
3572
+ return t30.identifier(path9.node.name);
3647
3573
  }
3648
- if (t31.isMemberExpression(path9.node) || t31.isOptionalMemberExpression(path9.node)) {
3574
+ if (t30.isMemberExpression(path9.node) || t30.isOptionalMemberExpression(path9.node)) {
3649
3575
  const normalizedExp = normalizeMemberForCallSite(path9, path9.node);
3650
- const safeExp = t31.isMemberExpression(normalizedExp) || t31.isOptionalMemberExpression(normalizedExp) ? ensureOptionalForMemberChain(normalizedExp) : normalizedExp;
3576
+ const safeExp = t30.isMemberExpression(normalizedExp) || t30.isOptionalMemberExpression(normalizedExp) ? ensureOptionalForMemberChain(normalizedExp) : normalizedExp;
3651
3577
  if (isReactValidDependencyExpr(safeExp)) {
3652
- return t31.cloneNode(safeExp, true);
3578
+ return t30.cloneNode(safeExp, true);
3653
3579
  }
3654
- return t31.identifier(rootName);
3580
+ return t30.identifier(rootName);
3655
3581
  }
3656
3582
  return null;
3657
3583
  }
3658
3584
  function normalizeSourcedDependency(exp) {
3659
- if (t31.isIdentifier(exp)) {
3660
- return t31.identifier(exp.name);
3585
+ if (t30.isIdentifier(exp)) {
3586
+ return t30.identifier(exp.name);
3661
3587
  }
3662
- if (t31.isMemberExpression(exp) || t31.isOptionalMemberExpression(exp)) {
3588
+ if (t30.isMemberExpression(exp) || t30.isOptionalMemberExpression(exp)) {
3663
3589
  const root = findRootIdentifier(exp);
3664
3590
  if (!root) return null;
3665
- const safeExp = t31.isMemberExpression(exp) || t31.isOptionalMemberExpression(exp) ? ensureOptionalForMemberChain(exp) : exp;
3591
+ const safeExp = t30.isMemberExpression(exp) || t30.isOptionalMemberExpression(exp) ? ensureOptionalForMemberChain(exp) : exp;
3666
3592
  if (isReactValidDependencyExpr(safeExp)) {
3667
- return t31.cloneNode(safeExp, true);
3593
+ return t30.cloneNode(safeExp, true);
3668
3594
  }
3669
- return t31.identifier(root.name);
3595
+ return t30.identifier(root.name);
3670
3596
  }
3671
3597
  return null;
3672
3598
  }
3673
3599
  function isReactValidDependencyExpr(node2) {
3674
- if (t31.isIdentifier(node2)) {
3600
+ if (t30.isIdentifier(node2)) {
3675
3601
  return true;
3676
3602
  }
3677
- if (t31.isMemberExpression(node2) || t31.isOptionalMemberExpression(node2)) {
3603
+ if (t30.isMemberExpression(node2) || t30.isOptionalMemberExpression(node2)) {
3678
3604
  return isStaticMemberChain(node2);
3679
3605
  }
3680
3606
  return false;
3681
3607
  }
3682
3608
  function isStaticMemberChain(node2) {
3683
3609
  let current = node2;
3684
- while (t31.isMemberExpression(current) || t31.isOptionalMemberExpression(current)) {
3685
- if (!current.computed && !t31.isIdentifier(current.property)) {
3610
+ while (t30.isMemberExpression(current) || t30.isOptionalMemberExpression(current)) {
3611
+ if (!current.computed && !t30.isIdentifier(current.property)) {
3686
3612
  return false;
3687
3613
  }
3688
- if (current.computed && !t31.isStringLiteral(current.property) && !t31.isNumericLiteral(current.property)) {
3614
+ if (current.computed && !t30.isStringLiteral(current.property) && !t30.isNumericLiteral(current.property)) {
3689
3615
  return false;
3690
3616
  }
3691
3617
  current = current.object;
3692
3618
  }
3693
- return t31.isIdentifier(current);
3619
+ return t30.isIdentifier(current);
3694
3620
  }
3695
3621
  function isBindingDeclaredInsideBoundary(binding, boundary) {
3696
3622
  let current = binding.path;
@@ -3708,7 +3634,7 @@ function analyzeDeps(node, ctx, parentPath) {
3708
3634
  if (!isDirectCallee) {
3709
3635
  return node2;
3710
3636
  }
3711
- if (!t31.isExpression(node2.object)) {
3637
+ if (!t30.isExpression(node2.object)) {
3712
3638
  return node2;
3713
3639
  }
3714
3640
  return node2.object;
@@ -3717,15 +3643,15 @@ function analyzeDeps(node, ctx, parentPath) {
3717
3643
  if (!hasTrailingMemberAccess(node2)) {
3718
3644
  return node2;
3719
3645
  }
3720
- if (t31.isOptionalMemberExpression(node2) && node2.optional) {
3646
+ if (t30.isOptionalMemberExpression(node2) && node2.optional) {
3721
3647
  return node2;
3722
3648
  }
3723
- const object = t31.cloneNode(node2.object, true);
3724
- const property = t31.cloneNode(node2.property, true);
3725
- return t31.optionalMemberExpression(object, property, node2.computed, true);
3649
+ const object = t30.cloneNode(node2.object, true);
3650
+ const property = t30.cloneNode(node2.property, true);
3651
+ return t30.optionalMemberExpression(object, property, node2.computed, true);
3726
3652
  }
3727
3653
  function hasTrailingMemberAccess(node2) {
3728
- return t31.isMemberExpression(node2.object) || t31.isOptionalMemberExpression(node2.object);
3654
+ return t30.isMemberExpression(node2.object) || t30.isOptionalMemberExpression(node2.object);
3729
3655
  }
3730
3656
  function isEligibleBindingSource(binding) {
3731
3657
  if (binding.kind === "param") {
@@ -3735,17 +3661,17 @@ function analyzeDeps(node, ctx, parentPath) {
3735
3661
  const declaratorPath = getVariableDeclaratorPath(bindingPath);
3736
3662
  const isReactiveVarBinding = !!declaratorPath && isReactiveBinding(declaratorPath.node);
3737
3663
  const nodeInit = _optionalChain([declaratorPath, 'optionalAccess', _97 => _97.node, 'access', _98 => _98.init]);
3738
- const isReactiveApiCallVarBinding = !!declaratorPath && t31.isCallExpression(nodeInit) && t31.isIdentifier(nodeInit.callee) && reactiveStateApis.has(nodeInit.callee.name);
3739
- const isHookCallVarBinding = !!declaratorPath && t31.isCallExpression(nodeInit) && isHookLikeCallee(nodeInit.callee);
3740
- const isFunctionBinding = bindingPath.isFunctionDeclaration() || !!declaratorPath && !!nodeInit && (t31.isArrowFunctionExpression(nodeInit) || t31.isFunctionExpression(nodeInit));
3664
+ const isReactiveApiCallVarBinding = !!declaratorPath && t30.isCallExpression(nodeInit) && t30.isIdentifier(nodeInit.callee) && reactiveStateApis.has(nodeInit.callee.name);
3665
+ const isHookCallVarBinding = !!declaratorPath && t30.isCallExpression(nodeInit) && isHookLikeCallee(nodeInit.callee);
3666
+ const isFunctionBinding = bindingPath.isFunctionDeclaration() || !!declaratorPath && !!nodeInit && (t30.isArrowFunctionExpression(nodeInit) || t30.isFunctionExpression(nodeInit));
3741
3667
  const isReactiveFunctionBinding = isFunctionBinding && (isReactiveBinding(_optionalChain([declaratorPath, 'optionalAccess', _99 => _99.node])) || isReactiveBinding(bindingPath.node));
3742
3668
  return isReactiveVarBinding || isReactiveApiCallVarBinding || isHookCallVarBinding || isReactiveFunctionBinding;
3743
3669
  }
3744
3670
  function isHookLikeCallee(callee) {
3745
- if (t31.isIdentifier(callee)) {
3671
+ if (t30.isIdentifier(callee)) {
3746
3672
  return callee.name.startsWith("use");
3747
3673
  }
3748
- if (t31.isMemberExpression(callee) && !callee.computed && t31.isIdentifier(callee.property)) {
3674
+ if (t30.isMemberExpression(callee) && !callee.computed && t30.isIdentifier(callee.property)) {
3749
3675
  return callee.property.name.startsWith("use");
3750
3676
  }
3751
3677
  return false;
@@ -3761,7 +3687,7 @@ function analyzeDeps(node, ctx, parentPath) {
3761
3687
  }
3762
3688
  function isExpressionSourcedFromEligibleBinding(exp, scope, seen, depth) {
3763
3689
  if (depth <= 0) return null;
3764
- if (t31.isIdentifier(exp)) {
3690
+ if (t30.isIdentifier(exp)) {
3765
3691
  const sourceBinding = scope.getBinding(exp.name);
3766
3692
  if (!sourceBinding) return null;
3767
3693
  if (isEligibleBindingSource(sourceBinding)) {
@@ -3769,13 +3695,13 @@ function analyzeDeps(node, ctx, parentPath) {
3769
3695
  }
3770
3696
  return traceBindingSource(sourceBinding, seen, depth - 1);
3771
3697
  }
3772
- if (t31.isMemberExpression(exp) || t31.isOptionalMemberExpression(exp)) {
3698
+ if (t30.isMemberExpression(exp) || t30.isOptionalMemberExpression(exp)) {
3773
3699
  const root = findRootIdentifier(exp);
3774
3700
  if (!root) return null;
3775
3701
  const sourceBinding = scope.getBinding(root.name);
3776
3702
  if (!sourceBinding) return null;
3777
3703
  if (isEligibleBindingSource(sourceBinding)) {
3778
- return t31.cloneNode(exp);
3704
+ return t30.cloneNode(exp);
3779
3705
  }
3780
3706
  const sourcedRoot = traceBindingSource(sourceBinding, seen, depth - 1);
3781
3707
  if (sourcedRoot) {
@@ -3783,17 +3709,17 @@ function analyzeDeps(node, ctx, parentPath) {
3783
3709
  if (rebuilt) {
3784
3710
  return rebuilt;
3785
3711
  }
3786
- return t31.cloneNode(sourcedRoot, true);
3712
+ return t30.cloneNode(sourcedRoot, true);
3787
3713
  }
3788
3714
  }
3789
3715
  return null;
3790
3716
  }
3791
3717
  function rebuildMemberWithNewRoot(node2, nextRoot) {
3792
3718
  const replacedObject = (() => {
3793
- if (t31.isIdentifier(node2.object)) {
3794
- return t31.cloneNode(nextRoot, true);
3719
+ if (t30.isIdentifier(node2.object)) {
3720
+ return t30.cloneNode(nextRoot, true);
3795
3721
  }
3796
- if (t31.isMemberExpression(node2.object) || t31.isOptionalMemberExpression(node2.object)) {
3722
+ if (t30.isMemberExpression(node2.object) || t30.isOptionalMemberExpression(node2.object)) {
3797
3723
  return rebuildMemberWithNewRoot(node2.object, nextRoot);
3798
3724
  }
3799
3725
  return null;
@@ -3801,34 +3727,34 @@ function analyzeDeps(node, ctx, parentPath) {
3801
3727
  if (!replacedObject) {
3802
3728
  return null;
3803
3729
  }
3804
- const property = t31.cloneNode(node2.property, true);
3805
- if (t31.isMemberExpression(node2)) {
3806
- return t31.memberExpression(
3730
+ const property = t30.cloneNode(node2.property, true);
3731
+ if (t30.isMemberExpression(node2)) {
3732
+ return t30.memberExpression(
3807
3733
  replacedObject,
3808
3734
  property,
3809
3735
  node2.computed
3810
3736
  );
3811
3737
  }
3812
- return t31.optionalMemberExpression(
3738
+ return t30.optionalMemberExpression(
3813
3739
  replacedObject,
3814
3740
  property,
3815
3741
  node2.computed,
3816
3742
  node2.optional
3817
3743
  );
3818
3744
  }
3819
- return t31.arrayExpression(Array.from(deps.values()));
3745
+ return t30.arrayExpression(Array.from(deps.values()));
3820
3746
  }
3821
3747
  function getDependencyKey(exp) {
3822
- if (t31.isIdentifier(exp)) {
3748
+ if (t30.isIdentifier(exp)) {
3823
3749
  return exp.name;
3824
3750
  }
3825
- if (t31.isMemberExpression(exp) || t31.isOptionalMemberExpression(exp)) {
3751
+ if (t30.isMemberExpression(exp) || t30.isOptionalMemberExpression(exp)) {
3826
3752
  const objectKey = getDependencyKey(exp.object);
3827
3753
  const opt = exp.optional ? "?" : "";
3828
- if (!exp.computed && t31.isIdentifier(exp.property)) {
3754
+ if (!exp.computed && t30.isIdentifier(exp.property)) {
3829
3755
  return `${objectKey}${opt}.${exp.property.name}`;
3830
3756
  }
3831
- if (t31.isStringLiteral(exp.property) || t31.isNumericLiteral(exp.property)) {
3757
+ if (t30.isStringLiteral(exp.property) || t30.isNumericLiteral(exp.property)) {
3832
3758
  return `${objectKey}${opt}[${JSON.stringify(exp.property.value)}]`;
3833
3759
  }
3834
3760
  return `${objectKey}${opt}[*]`;
@@ -3861,7 +3787,7 @@ function resolveAnalysisOnlyAdapter(ctx) {
3861
3787
  if (!isVueApiReference(path9, apiName)) {
3862
3788
  return;
3863
3789
  }
3864
- if (t32.isCallExpression(node)) {
3790
+ if (t31.isCallExpression(node)) {
3865
3791
  resolveCallNode(path9, adapter, ctx);
3866
3792
  } else {
3867
3793
  replaceIdName(node, adapter.target);
@@ -3871,11 +3797,11 @@ function resolveAnalysisOnlyAdapter(ctx) {
3871
3797
  };
3872
3798
  }
3873
3799
  function getApiName(node) {
3874
- const isCallNode = t32.isCallExpression(node);
3800
+ const isCallNode = t31.isCallExpression(node);
3875
3801
  let apiName = "";
3876
- if (t32.isIdentifier(node)) {
3802
+ if (t31.isIdentifier(node)) {
3877
3803
  apiName = node.name;
3878
- } else if (isCallNode && t32.isIdentifier(node.callee)) {
3804
+ } else if (isCallNode && t31.isIdentifier(node.callee)) {
3879
3805
  apiName = node.callee.name;
3880
3806
  }
3881
3807
  return apiName;
@@ -3885,7 +3811,7 @@ function resolveCallNode(path9, adapter, ctx) {
3885
3811
  const { arguments: args } = node;
3886
3812
  if (!args.length) return;
3887
3813
  const fn = args[0];
3888
- if (!t32.isArrowFunctionExpression(fn) && !t32.isFunctionExpression(fn)) {
3814
+ if (!t31.isArrowFunctionExpression(fn) && !t31.isFunctionExpression(fn)) {
3889
3815
  return;
3890
3816
  }
3891
3817
  const fnPath = path9.get("arguments")[0];
@@ -3917,7 +3843,7 @@ function isVueImportBinding(binding) {
3917
3843
  return false;
3918
3844
  }
3919
3845
  const parent = _optionalChain([bindingPath, 'access', _102 => _102.parentPath, 'optionalAccess', _103 => _103.node]);
3920
- if (!parent || !t32.isImportDeclaration(parent)) {
3846
+ if (!parent || !t31.isImportDeclaration(parent)) {
3921
3847
  return false;
3922
3848
  }
3923
3849
  const source = parent.source.value.toLowerCase();
@@ -4003,14 +3929,14 @@ function resolveElementRef(ctx) {
4003
3929
  }
4004
3930
  if (isCompRefBindings) {
4005
3931
  const varDeclaratorPath = _optionalChain([getVariableDeclaratorPath, 'call', _105 => _105(path9), 'optionalAccess', _106 => _106.node]);
4006
- if (!t33.isIdentifier(_optionalChain([varDeclaratorPath, 'optionalAccess', _107 => _107.id]))) {
3932
+ if (!t32.isIdentifier(_optionalChain([varDeclaratorPath, 'optionalAccess', _107 => _107.id]))) {
4007
3933
  return;
4008
3934
  }
4009
3935
  const varName = varDeclaratorPath.id.name;
4010
3936
  const compRef = refBindings.componentRefs[varName];
4011
3937
  if (!compRef) return;
4012
3938
  }
4013
- node.arguments[0] = t33.identifier("null");
3939
+ node.arguments[0] = t32.identifier("null");
4014
3940
  resolveTypeParameters(ctx, path9);
4015
3941
  replaceCallName(node, REACT_API_MAP.useRef);
4016
3942
  recordImport(ctx, PACKAGE_NAME.react, REACT_API_MAP.useRef);
@@ -4035,20 +3961,20 @@ function resolveTypeParameters(ctx, path9) {
4035
3961
  const compBindingMeta = refBindings.componentRefs[idName];
4036
3962
  if (!node.typeParameters && (domBindingMeta || compBindingMeta)) {
4037
3963
  const type = compBindingMeta ? "any" : domBindingMeta.htmlType;
4038
- node.typeParameters = t33.tsTypeParameterInstantiation([t33.tsTypeReference(t33.identifier(type))]);
3964
+ node.typeParameters = t32.tsTypeParameterInstantiation([t32.tsTypeReference(t32.identifier(type))]);
4039
3965
  }
4040
3966
  }
4041
3967
  function resolveRefValueToCurrent(path9) {
4042
3968
  const { node } = path9;
4043
- if (node.computed || !t33.isIdentifier(node.property) || node.property.name !== "value") {
3969
+ if (node.computed || !t32.isIdentifier(node.property) || node.property.name !== "value") {
4044
3970
  return;
4045
3971
  }
4046
3972
  const rootPath = findRootVariablePath(path9);
4047
- if (!_optionalChain([rootPath, 'optionalAccess', _110 => _110.node]) || !t33.isCallExpression(rootPath.node.init) || !isCalleeNamed(rootPath.node.init, REACT_API_MAP.useRef)) {
3973
+ if (!_optionalChain([rootPath, 'optionalAccess', _110 => _110.node]) || !t32.isCallExpression(rootPath.node.init) || !isCalleeNamed(rootPath.node.init, REACT_API_MAP.useRef)) {
4048
3974
  return;
4049
3975
  }
4050
3976
  const rootId = findRootIdentifier(node);
4051
- if (!t33.isIdentifier(node.object) || node.object.name !== _optionalChain([rootId, 'optionalAccess', _111 => _111.name])) {
3977
+ if (!t32.isIdentifier(node.object) || node.object.name !== _optionalChain([rootId, 'optionalAccess', _111 => _111.name])) {
4052
3978
  return;
4053
3979
  }
4054
3980
  node.property.name = "current";
@@ -4067,11 +3993,11 @@ function resolveExprMemo(ctx, ast) {
4067
3993
  if (!atComponentOrHookRoot(path9, ast.program, isScriptFile)) {
4068
3994
  return false;
4069
3995
  }
4070
- if (!t34.isVariableDeclaration(path9.parent) || path9.parent.kind !== "const") {
3996
+ if (!t33.isVariableDeclaration(path9.parent) || path9.parent.kind !== "const") {
4071
3997
  return false;
4072
3998
  }
4073
- if (t34.isFunction(init)) return false;
4074
- if (t34.isCallExpression(init) && t34.isIdentifier(init.callee) && init.callee.name.startsWith("use")) {
3999
+ if (t33.isFunction(init)) return false;
4000
+ if (t33.isCallExpression(init) && t33.isIdentifier(init.callee) && init.callee.name.startsWith("use")) {
4075
4001
  return false;
4076
4002
  }
4077
4003
  return true;
@@ -4095,10 +4021,10 @@ function resolveLintRules(ctx, ast) {
4095
4021
  return {
4096
4022
  CallExpression(path9) {
4097
4023
  const { node, parentPath } = path9;
4098
- if (!t35.isIdentifier(node.callee)) return;
4024
+ if (!t34.isIdentifier(node.callee)) return;
4099
4025
  const { name: callName } = node.callee;
4100
- const addLog = (t41) => {
4101
- logger.error(t41, {
4026
+ const addLog = (t40) => {
4027
+ logger.error(t40, {
4102
4028
  file: ctx.filename,
4103
4029
  source: ctx.scriptData.source,
4104
4030
  loc: node.loc
@@ -4175,18 +4101,18 @@ function findOrCreateCtxProvider(root) {
4175
4101
  function assignProviderValue(target, key, value) {
4176
4102
  const getRawExp = (exp) => {
4177
4103
  if (!exp) return "''";
4178
- if (t36.isStringLiteral(exp)) {
4104
+ if (t35.isStringLiteral(exp)) {
4179
4105
  return JSON.stringify(exp.value);
4180
4106
  }
4181
- if (t36.isNumericLiteral(exp)) {
4107
+ if (t35.isNumericLiteral(exp)) {
4182
4108
  return exp.value.toString();
4183
4109
  }
4184
- if (t36.isIdentifier(exp)) {
4110
+ if (t35.isIdentifier(exp)) {
4185
4111
  return exp.name;
4186
4112
  }
4187
4113
  try {
4188
4114
  return _generator.generate.call(void 0, exp).code;
4189
- } catch (e6) {
4115
+ } catch (e5) {
4190
4116
  return "null";
4191
4117
  }
4192
4118
  };
@@ -4202,11 +4128,11 @@ function resolveRenameAdapter(ctx) {
4202
4128
  return {
4203
4129
  "CallExpression|Identifier"(path9) {
4204
4130
  const node = path9.node;
4205
- const isCallNode = t37.isCallExpression(node);
4131
+ const isCallNode = t36.isCallExpression(node);
4206
4132
  let apiName = "";
4207
- if (t37.isIdentifier(node)) {
4133
+ if (t36.isIdentifier(node)) {
4208
4134
  apiName = node.name;
4209
- } else if (isCallNode && t37.isIdentifier(node.callee)) {
4135
+ } else if (isCallNode && t36.isIdentifier(node.callee)) {
4210
4136
  apiName = node.callee.name;
4211
4137
  }
4212
4138
  if (!apiName) {
@@ -4264,7 +4190,7 @@ function isVueImportBinding2(binding) {
4264
4190
  return false;
4265
4191
  }
4266
4192
  const parent = _optionalChain([bindingPath, 'access', _117 => _117.parentPath, 'optionalAccess', _118 => _118.node]);
4267
- if (!parent || !t37.isImportDeclaration(parent)) {
4193
+ if (!parent || !t36.isImportDeclaration(parent)) {
4268
4194
  return false;
4269
4195
  }
4270
4196
  const source = parent.source.value.toLowerCase();
@@ -4406,50 +4332,50 @@ function isRouterLinkBooleanCustomProp(prop) {
4406
4332
 
4407
4333
 
4408
4334
  var strCodeTypes = {
4409
- isIdentifier: isIdentifier20,
4335
+ isIdentifier: isIdentifier19,
4410
4336
  isSimpleExpression,
4411
- isStringLiteral: isStringLiteral12
4337
+ isStringLiteral: isStringLiteral11
4412
4338
  };
4413
4339
  function isSimpleExpression(code, excludeVar = false) {
4414
4340
  let node;
4415
4341
  try {
4416
4342
  node = _parser.parseExpression.call(void 0, code);
4417
- } catch (e7) {
4343
+ } catch (e6) {
4418
4344
  return false;
4419
4345
  }
4420
- if (t38.isLiteral(node)) {
4346
+ if (t37.isLiteral(node)) {
4421
4347
  return true;
4422
4348
  }
4423
- if (!excludeVar && t38.isIdentifier(node)) {
4349
+ if (!excludeVar && t37.isIdentifier(node)) {
4424
4350
  return true;
4425
4351
  }
4426
- if (t38.isMemberExpression(node)) {
4427
- return isSimpleExpression(node.object) && t38.isIdentifier(node.property);
4352
+ if (t37.isMemberExpression(node)) {
4353
+ return isSimpleExpression(node.object) && t37.isIdentifier(node.property);
4428
4354
  }
4429
- if (t38.isObjectExpression(node) || t38.isArrayExpression(node)) {
4355
+ if (t37.isObjectExpression(node) || t37.isArrayExpression(node)) {
4430
4356
  return false;
4431
4357
  }
4432
- if (t38.isCallExpression(node) || t38.isAssignmentExpression(node)) {
4358
+ if (t37.isCallExpression(node) || t37.isAssignmentExpression(node)) {
4433
4359
  return false;
4434
4360
  }
4435
- if (t38.isBinaryExpression(node) || t38.isUnaryExpression(node)) {
4361
+ if (t37.isBinaryExpression(node) || t37.isUnaryExpression(node)) {
4436
4362
  return true;
4437
4363
  }
4438
4364
  return false;
4439
4365
  }
4440
- function isIdentifier20(code) {
4366
+ function isIdentifier19(code) {
4441
4367
  try {
4442
4368
  const node = _parser.parseExpression.call(void 0, code);
4443
- return t38.isIdentifier(node);
4444
- } catch (e8) {
4369
+ return t37.isIdentifier(node);
4370
+ } catch (e7) {
4445
4371
  return false;
4446
4372
  }
4447
4373
  }
4448
- function isStringLiteral12(code) {
4374
+ function isStringLiteral11(code) {
4449
4375
  try {
4450
4376
  const node = _parser.parseExpression.call(void 0, code);
4451
- return t38.isStringLiteral(node);
4452
- } catch (e9) {
4377
+ return t37.isStringLiteral(node);
4378
+ } catch (e8) {
4453
4379
  return false;
4454
4380
  }
4455
4381
  }
@@ -4590,23 +4516,23 @@ function resolvePropAsBabelExp(ir, ctx) {
4590
4516
  const mergedItems = value.merge;
4591
4517
  const setNameIdentifier = (target, valueName) => {
4592
4518
  target.content = valueName;
4593
- target.ast = t39.jsxIdentifier(valueName);
4519
+ target.ast = t38.jsxIdentifier(valueName);
4594
4520
  };
4595
- const setValueExpression = (target, content, isStringLiteral13) => {
4521
+ const setValueExpression = (target, content, isStringLiteral12) => {
4596
4522
  target.content = content;
4597
- target.ast = resolveStringExpr(content, ctx, isStringLiteral13);
4523
+ target.ast = resolveStringExpr(content, ctx, isStringLiteral12);
4598
4524
  };
4599
4525
  const createRuntimeCall = (fnName, args) => {
4600
4526
  const fnArgs = args.filter(Boolean).join(",");
4601
4527
  return `${fnName}(${fnArgs})`;
4602
4528
  };
4603
- const applyRuntimeExpression = (expression, setName = false, nameIdentifier, isStringLiteral13) => {
4529
+ const applyRuntimeExpression = (expression, setName = false, nameIdentifier, isStringLiteral12) => {
4604
4530
  if (setName && nameIdentifier) {
4605
4531
  setNameIdentifier(nameExp, nameIdentifier);
4606
4532
  }
4607
4533
  const dir = ADAPTER_RULES.runtime.dir;
4608
4534
  recordImport(ctx, dir.package, dir.target);
4609
- setValueExpression(value.babelExp, expression, isStringLiteral13);
4535
+ setValueExpression(value.babelExp, expression, isStringLiteral12);
4610
4536
  };
4611
4537
  if (ir.isKeyLessVBind) {
4612
4538
  const dirKeyless = ADAPTER_RULES.runtime.dirKeyless;
@@ -4982,12 +4908,12 @@ function resolvePropertyIR(node, ir, ctx, nodeIR, isDynamic = false) {
4982
4908
  content = node.value.content = parseStyleString(content);
4983
4909
  }
4984
4910
  if (isDynamic) {
4985
- const isStringLiteral13 = strCodeTypes.isStringLiteral(content);
4986
- if (isStringLiteral13) {
4911
+ const isStringLiteral12 = strCodeTypes.isStringLiteral(content);
4912
+ if (isStringLiteral12) {
4987
4913
  content = normalizeString(content);
4988
4914
  node.value.content = content;
4989
4915
  }
4990
- node.value.isStringLiteral = isStringLiteral13;
4916
+ node.value.isStringLiteral = isStringLiteral12;
4991
4917
  }
4992
4918
  const existing = findSameProp(nodeIR.props, node);
4993
4919
  if (existing) {
@@ -5238,7 +5164,7 @@ function resolveVOn(node, _ir, ctx, nodeIR) {
5238
5164
  originalVueEventName = `${arg.content}.${modifiers.join(".")}`;
5239
5165
  } else {
5240
5166
  const expr = stringToExpr(handler);
5241
- if (!t40.isFunctionExpression(expr) && !t40.isArrowFunctionExpression(expr) && !t40.isIdentifier(expr)) {
5167
+ if (!t39.isFunctionExpression(expr) && !t39.isArrowFunctionExpression(expr) && !t39.isIdentifier(expr)) {
5242
5168
  handler = `() => {${handler}}`;
5243
5169
  }
5244
5170
  }
@@ -5691,7 +5617,7 @@ function transform(ast, ctx, options) {
5691
5617
  }
5692
5618
 
5693
5619
  // package.json
5694
- var version = "1.5.1";
5620
+ var version = "1.5.2";
5695
5621
  var bin = {
5696
5622
  vureact: "./bin/vureact.js"
5697
5623
  };
@@ -5724,7 +5650,7 @@ async function formatWithPrettier(code, lang, opts) {
5724
5650
  ...opts,
5725
5651
  parser
5726
5652
  });
5727
- } catch (e10) {
5653
+ } catch (e9) {
5728
5654
  logger.info("Prettier is unavailable; the built-in simple formatter is used.");
5729
5655
  return simpleFormat(code);
5730
5656
  }
@@ -5774,7 +5700,7 @@ var FileLockManager = class _FileLockManager {
5774
5700
  if (content.trim()) {
5775
5701
  try {
5776
5702
  current = JSON.parse(content);
5777
- } catch (e11) {
5703
+ } catch (e10) {
5778
5704
  current = content;
5779
5705
  }
5780
5706
  }
@@ -5807,7 +5733,7 @@ var FileLockManager = class _FileLockManager {
5807
5733
  await _fs2.default.promises.mkdir(_path2.default.dirname(filePath), { recursive: true });
5808
5734
  try {
5809
5735
  await _fs2.default.promises.access(filePath);
5810
- } catch (e12) {
5736
+ } catch (e11) {
5811
5737
  await this.writeFile(filePath, "");
5812
5738
  }
5813
5739
  const release = await _properlockfile2.default.lock(filePath, {
@@ -5832,7 +5758,7 @@ var FileLockManager = class _FileLockManager {
5832
5758
  const { stale = 1e4, realpath = true, lockfilePath } = options;
5833
5759
  try {
5834
5760
  return await _properlockfile2.default.check(filePath, { stale, realpath, lockfilePath });
5835
- } catch (e13) {
5761
+ } catch (e12) {
5836
5762
  return false;
5837
5763
  }
5838
5764
  }
@@ -5854,7 +5780,7 @@ var FileLockManager = class _FileLockManager {
5854
5780
  lockfilePath
5855
5781
  });
5856
5782
  return release;
5857
- } catch (e14) {
5783
+ } catch (e13) {
5858
5784
  return null;
5859
5785
  }
5860
5786
  }
@@ -5867,7 +5793,7 @@ var FileLockManager = class _FileLockManager {
5867
5793
  const { realpath = true, lockfilePath } = options;
5868
5794
  try {
5869
5795
  await _properlockfile2.default.unlock(filePath, { realpath, lockfilePath });
5870
- } catch (e15) {
5796
+ } catch (e14) {
5871
5797
  }
5872
5798
  }
5873
5799
  async writeFile(filePath, content) {
@@ -6068,7 +5994,7 @@ var Helper = (_class5 = class {
6068
5994
  async rmFile(filePath) {
6069
5995
  try {
6070
5996
  await _fs2.default.promises.rm(filePath, { recursive: true, force: true });
6071
- } catch (e16) {
5997
+ } catch (e15) {
6072
5998
  }
6073
5999
  }
6074
6000
  async loadCache(key) {
@@ -6085,7 +6011,7 @@ var Helper = (_class5 = class {
6085
6011
  target: data[key] || [],
6086
6012
  source: data
6087
6013
  };
6088
- } catch (e17) {
6014
+ } catch (e16) {
6089
6015
  return defaultData;
6090
6016
  }
6091
6017
  }
@@ -6934,7 +6860,7 @@ var FileProcessor = (_class10 = class {
6934
6860
  const filePath = _path2.default.resolve(outputPath, filename);
6935
6861
  try {
6936
6862
  return { filePath, content: await _fs2.default.promises.readFile(filePath, "utf-8") };
6937
- } catch (e18) {
6863
+ } catch (e17) {
6938
6864
  return;
6939
6865
  }
6940
6866
  };