@vureact/compiler-core 1.5.0 → 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
  /**
2
- * @vureact/compiler-core v1.5.0
2
+ * @vureact/compiler-core v1.5.2
3
3
  * (c) 2025-present Ruihong Zhong (Ryan John)
4
4
  * @license MIT
5
5
  */
@@ -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
  }
@@ -1385,7 +1385,12 @@ function generateComponent(ir, ctx, options) {
1385
1385
  quotes: "single"
1386
1386
  // 使用单引号
1387
1387
  },
1388
- minified: true,
1388
+ minified: false,
1389
+ // 不压缩输出内容
1390
+ retainLines: false,
1391
+ // 不保留行号
1392
+ retainFunctionParens: true,
1393
+ // 保留函数括号
1389
1394
  ...options
1390
1395
  });
1391
1396
  const result = {
@@ -1450,113 +1455,45 @@ import {
1450
1455
  } from "@vue/compiler-sfc";
1451
1456
 
1452
1457
  // src/core/parse/sfc/process/resolve-script.ts
1453
- import { generate as generate2 } from "@babel/generator";
1454
1458
  import { parse as babelParse2 } from "@babel/parser";
1455
- import * as t15 from "@babel/types";
1456
- function resolveScript(descriptor, ctx, pResult) {
1457
- const scriptBlock = descriptor.scriptSetup || descriptor.script;
1458
- if (!scriptBlock) return null;
1459
- const result = {
1460
- ast: {},
1461
- source: scriptBlock
1462
- };
1463
- const options = getBabelParseOptions(scriptBlock.lang, "script", ctx.filename);
1459
+ function resolveScript(descriptor, ctx, parseResult) {
1464
1460
  if (descriptor.script) {
1465
- const { code, ast, name } = extractSetupBodyToTopLevel(scriptBlock.content, options);
1466
- if (ast) {
1467
- result.source.content = code;
1468
- result.ast = ast;
1469
- ctx.compName = name;
1470
- }
1471
- logger.warn(
1472
- "Using traditional script (instead of <script setup>) may result in unstable or non-functional React code. It is recommended to use <script setup> instead.",
1473
- { 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})`
1474
1464
  );
1475
- } else {
1476
- result.ast = babelParse2(result.source.content, options);
1477
1465
  }
1478
- if (scriptBlock?.warnings) {
1479
- scriptBlock?.warnings.forEach((msg) => {
1466
+ const { scriptSetup } = descriptor;
1467
+ if (!scriptSetup) return null;
1468
+ if (scriptSetup?.warnings) {
1469
+ scriptSetup?.warnings.forEach((msg) => {
1480
1470
  logger.warn(msg, { file: ctx.filename });
1481
1471
  });
1482
1472
  }
1483
- const source = scriptBlock.content;
1484
- ctx.scriptData.source = source;
1485
- ctx.compName = extractCompName(source);
1486
- ctx.scriptData.lang = scriptBlock.lang || "js";
1487
- pResult.script = result;
1488
- }
1489
- function extractSetupBodyToTopLevel(content, options) {
1490
- let name = "";
1491
- try {
1492
- const ast = babelParse2(content, options);
1493
- const importNodes = [];
1494
- const otherTopLevel = [];
1495
- let setupStatements = [];
1496
- for (const node of ast.program.body) {
1497
- if (t15.isImportDeclaration(node)) {
1498
- importNodes.push(node);
1499
- continue;
1500
- }
1501
- if (t15.isExportDefaultDeclaration(node)) {
1502
- const decl = node.declaration;
1503
- if (decl && t15.isObjectExpression(decl)) {
1504
- const nameProp = decl.properties.find((p) => {
1505
- if (t15.isObjectProperty(p)) {
1506
- const key = p.key;
1507
- return t15.isIdentifier(key) && key.name === "name" || t15.isStringLiteral(key) && key.value === "name";
1508
- }
1509
- return false;
1510
- });
1511
- if (nameProp && t15.isObjectProperty(nameProp)) {
1512
- if (t15.isStringLiteral(nameProp.value)) {
1513
- name = nameProp.value.value;
1514
- }
1515
- }
1516
- const setupProp = decl.properties.find((p) => {
1517
- if (t15.isObjectMethod(p)) {
1518
- return p.key && p.key.name === "setup";
1519
- }
1520
- if (t15.isObjectProperty(p)) {
1521
- const key = p.key;
1522
- return t15.isIdentifier(key) && key.name === "setup" || t15.isStringLiteral(key) && key.value === "setup";
1523
- }
1524
- return false;
1525
- });
1526
- if (setupProp) {
1527
- const value = t15.isObjectMethod(setupProp) ? setupProp : t15.isObjectProperty(setupProp) ? setupProp.value : null;
1528
- if (value && (t15.isFunction(value) || t15.isObjectMethod(value))) {
1529
- const fnBody = t15.isBlockStatement(value.body) ? value.body.body : [];
1530
- for (const stmt of fnBody) {
1531
- if (t15.isReturnStatement(stmt)) continue;
1532
- setupStatements.push(stmt);
1533
- }
1534
- }
1535
- }
1536
- }
1537
- continue;
1538
- }
1539
- otherTopLevel.push(node);
1540
- }
1541
- const parts = [];
1542
- const stmts = importNodes.concat(otherTopLevel, setupStatements);
1543
- for (const n of stmts) {
1544
- parts.push(generate2(n).code);
1545
- }
1546
- return { name, ast, code: parts.join("\n\n") };
1547
- } catch (e) {
1548
- console.error(e);
1549
- return { name, code: content };
1550
- }
1473
+ resolveContext(scriptSetup, ctx);
1474
+ const parseOpts = getBabelParseOptions(scriptSetup.lang, "script", ctx.filename);
1475
+ parseResult.script = {
1476
+ ast: babelParse2(scriptSetup.content, parseOpts),
1477
+ source: scriptSetup
1478
+ };
1551
1479
  }
1552
- function extractCompName(source) {
1553
- const nameMatch = source.match(/@vr-name:\s*(\w+)/);
1554
- return nameMatch?.[1]?.trim() || "";
1480
+ function resolveContext(scriptSetup, ctx) {
1481
+ let { content, lang } = scriptSetup;
1482
+ const resolveVRComment = (source) => {
1483
+ const regx = /\/\/\s*@vr-name:\s*(\w+)/;
1484
+ const nameMatch = source.match(regx);
1485
+ content = content.replace(regx, "");
1486
+ return nameMatch?.[1]?.trim() || "";
1487
+ };
1488
+ ctx.compName = resolveVRComment(content);
1489
+ ctx.scriptData.source = content;
1490
+ ctx.scriptData.lang = lang || "js";
1491
+ scriptSetup.content = content;
1555
1492
  }
1556
1493
 
1557
1494
  // src/core/parse/sfc/process/resolve-script-meta.ts
1558
1495
  import { traverse } from "@babel/core";
1559
- import * as t16 from "@babel/types";
1496
+ import * as t15 from "@babel/types";
1560
1497
 
1561
1498
  // src/consts/html-tag-types.ts
1562
1499
  var HTML_TAG_TYPES = {
@@ -1662,10 +1599,10 @@ function resolveScriptMeta(result, ctx) {
1662
1599
  traverse(scriptAST, {
1663
1600
  VariableDeclarator(path9) {
1664
1601
  const { node } = path9;
1665
- if (!atComponentOrHookRoot(path9, scriptAST.program) || !t16.isIdentifier(node.id)) {
1602
+ if (!atComponentOrHookRoot(path9, scriptAST.program) || !t15.isIdentifier(node.id)) {
1666
1603
  return;
1667
1604
  }
1668
- 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)) {
1669
1606
  collectReactiveBindings(node, ctx);
1670
1607
  collectRefBindings(node, ctx);
1671
1608
  }
@@ -1936,265 +1873,8 @@ import { parse as babelParse3 } from "@babel/parser";
1936
1873
  // src/core/transform/sfc/script/syntax-processor/index.ts
1937
1874
  import { traverse as traverse3 } from "@babel/core";
1938
1875
 
1939
- // src/core/transform/sfc/script/syntax-processor/postprocess/insert-css-import.ts
1940
- import * as t17 from "@babel/types";
1941
- function insertCSSImport(ctx) {
1942
- const { inputType } = ctx;
1943
- if (inputType !== "sfc") return;
1944
- const { filePath, moduleName } = ctx.styleData;
1945
- if (!filePath) return;
1946
- const scriptIR = getScriptIR(ctx);
1947
- const filename = normalizePath(filePath).split("/").pop();
1948
- const importPath = `./${filename}`;
1949
- const importDecl = t17.importDeclaration(
1950
- !moduleName ? [] : [t17.importDefaultSpecifier(t17.identifier(moduleName))],
1951
- t17.stringLiteral(importPath)
1952
- );
1953
- scriptIR.imports.push(importDecl);
1954
- }
1955
-
1956
- // src/core/transform/sfc/script/syntax-processor/postprocess/resolve-required-imports/index.ts
1957
- import * as t18 from "@babel/types";
1958
-
1959
- // src/core/transform/shared.ts
1960
- function recordImport(ctx, pkg, name, onDemand = true) {
1961
- const { imports } = ctx;
1962
- if (isTypeOnlyImport(name)) {
1963
- name = `type ${name}`;
1964
- }
1965
- if (imports.has(pkg)) {
1966
- const list = imports.get(pkg);
1967
- const foundItem = list.find((item) => item.name === name);
1968
- if (!foundItem) {
1969
- list.push({ name, onDemand });
1970
- }
1971
- return;
1972
- }
1973
- imports.set(pkg, [{ name, onDemand }]);
1974
- }
1975
- function isTypeOnlyImport(name) {
1976
- const arr = [REACT_API_MAP.ReactNode];
1977
- return arr.includes(name);
1978
- }
1979
-
1980
- // src/core/transform/sfc/script/shared/replace-vue-suffix.ts
1981
- function replaceVueSuffix(ctx, node) {
1982
- if (!node.value.endsWith(".vue")) return;
1983
- const jsxFile = node.value.replace(/.vue$/, "");
1984
- node.value = jsxFile;
1985
- node.extra = { rawValue: jsxFile, raw: jsxFile };
1986
- }
1987
-
1988
- // src/core/transform/sfc/script/syntax-processor/postprocess/resolve-required-imports/import-strategies.ts
1989
- var VueRouterStrategy = class {
1990
- matches(moduleName) {
1991
- return moduleName === "vue-router" || moduleName.startsWith("vue-router/");
1992
- }
1993
- process() {
1994
- return {
1995
- shouldReplaceSource: true,
1996
- newSource: PACKAGE_NAME.router,
1997
- shouldRemove: false,
1998
- shouldInjectRuntimeImports: false
1999
- };
2000
- }
2001
- };
2002
- var VueEcosystemStrategy = class {
2003
- matches(moduleName) {
2004
- if (moduleName.startsWith(".") || moduleName.startsWith("/") || moduleName.startsWith("file:")) {
2005
- return false;
2006
- }
2007
- if (moduleName === "vue-router" || moduleName.startsWith("vue-router/")) {
2008
- return false;
2009
- }
2010
- if (moduleName.startsWith("@vue/")) {
2011
- return true;
2012
- }
2013
- for (const pkg of VUE_PACKAGES) {
2014
- if (moduleName === pkg || moduleName.startsWith(`${pkg}/`)) {
2015
- return true;
2016
- }
2017
- }
2018
- return false;
2019
- }
2020
- process() {
2021
- return {
2022
- shouldReplaceSource: false,
2023
- shouldRemove: true,
2024
- shouldInjectRuntimeImports: true
2025
- };
2026
- }
2027
- };
2028
- var StyleFileStrategy = class {
2029
- regExp = /\.(less|sass|scss)$/i;
2030
- matches(moduleName) {
2031
- return this.regExp.test(moduleName);
2032
- }
2033
- process(path9, ctx) {
2034
- if (!ctx.preprocessStyles) {
2035
- return {};
2036
- }
2037
- const importSource = path9.node.source.value;
2038
- if (typeof importSource !== "string") {
2039
- return {};
2040
- }
2041
- return {
2042
- shouldReplaceSource: true,
2043
- newSource: importSource.replace(this.regExp, ".css"),
2044
- shouldRemove: false,
2045
- shouldInjectRuntimeImports: false
2046
- };
2047
- }
2048
- };
2049
-
2050
- // src/core/transform/sfc/script/syntax-processor/postprocess/resolve-required-imports/import-strategy-manager.ts
2051
- var ImportStrategyManager = class {
2052
- strategies = [];
2053
- constructor() {
2054
- this.strategies.push(new VueRouterStrategy());
2055
- this.strategies.push(new VueEcosystemStrategy());
2056
- this.strategies.push(new StyleFileStrategy());
2057
- }
2058
- /** 添加自定义策略 */
2059
- addStrategy(strategy) {
2060
- this.strategies.push(strategy);
2061
- }
2062
- /** 查找匹配的策略 */
2063
- findStrategy(moduleName) {
2064
- for (const strategy of this.strategies) {
2065
- if (strategy.matches(moduleName)) {
2066
- return strategy;
2067
- }
2068
- }
2069
- return null;
2070
- }
2071
- };
2072
-
2073
- // src/core/transform/sfc/script/syntax-processor/postprocess/resolve-required-imports/index.ts
2074
- function resolveRequiredImports(ctx) {
2075
- const processedModules = /* @__PURE__ */ new Set();
2076
- let hasProcessedImports = false;
2077
- const strategyManager = new ImportStrategyManager();
2078
- if (ctx.inputType === "sfc") {
2079
- recordImport(ctx, PACKAGE_NAME.react, REACT_API_MAP.memo);
2080
- }
2081
- function resolveRequiredImport(path9) {
2082
- const { node } = path9;
2083
- const originalModuleName = node.source.value.toLowerCase();
2084
- const strategy = strategyManager.findStrategy(originalModuleName);
2085
- if (strategy) {
2086
- const result = strategy.process(path9, ctx, originalModuleName);
2087
- if (result.shouldReplaceSource && result.newSource) {
2088
- node.source.value = result.newSource;
2089
- }
2090
- }
2091
- const normalizedModuleName = node.source.value.toLowerCase();
2092
- mergeImports(node, ctx, normalizedModuleName);
2093
- if (processedModules.has(normalizedModuleName) && !path9.removed) {
2094
- path9.remove();
2095
- return;
2096
- }
2097
- processedModules.add(normalizedModuleName);
2098
- if (!hasProcessedImports) {
2099
- const required = createRequiredImports(ctx);
2100
- if (strategy) {
2101
- const result = strategy.process(path9, ctx, originalModuleName);
2102
- if (result.shouldRemove) {
2103
- path9.replaceWithMultiple(required);
2104
- } else if (normalizedModuleName === PACKAGE_NAME.react) {
2105
- path9.insertAfter(required);
2106
- } else {
2107
- path9.insertBefore(required);
2108
- }
2109
- } else {
2110
- if (normalizedModuleName === PACKAGE_NAME.react) {
2111
- path9.insertAfter(required);
2112
- } else {
2113
- path9.insertBefore(required);
2114
- }
2115
- }
2116
- hasProcessedImports = true;
2117
- }
2118
- if (strategy) {
2119
- const result = strategy.process(path9, ctx, originalModuleName);
2120
- if (result.shouldRemove && !path9.removed) {
2121
- path9.remove();
2122
- return;
2123
- }
2124
- }
2125
- replaceVueSuffix(ctx, node.source);
2126
- }
2127
- return {
2128
- // 兜底:无 ImportDeclaration 的文件也要能注入必需依赖。
2129
- Program: {
2130
- exit(path9) {
2131
- if (hasProcessedImports) return;
2132
- const required = createRequiredImports(ctx);
2133
- path9.unshiftContainer("body", required);
2134
- hasProcessedImports = true;
2135
- }
2136
- },
2137
- ImportDeclaration(path9) {
2138
- resolveRequiredImport(path9);
2139
- }
2140
- };
2141
- }
2142
- function mergeImports(currentNode, ctx, moduleName) {
2143
- const ctxImportItems = ctx.imports.get(moduleName);
2144
- if (!ctxImportItems?.length) {
2145
- return;
2146
- }
2147
- const currentImports = /* @__PURE__ */ new Set();
2148
- for (const spec of currentNode.specifiers) {
2149
- if (t18.isImportSpecifier(spec) && t18.isIdentifier(spec.imported)) {
2150
- currentImports.add(spec.imported.name);
2151
- }
2152
- if (t18.isImportDefaultSpecifier(spec) && t18.isIdentifier(spec.local)) {
2153
- currentImports.add(spec.local.name);
2154
- }
2155
- }
2156
- for (const item of ctxImportItems) {
2157
- if (currentImports.has(item.name)) {
2158
- continue;
2159
- }
2160
- const local = t18.identifier(item.name);
2161
- const newNode = !item.onDemand ? t18.importDefaultSpecifier(local) : t18.importSpecifier(local, local);
2162
- currentNode.specifiers.push(newNode);
2163
- }
2164
- ctx.imports.delete(moduleName);
2165
- }
2166
- function createRequiredImports(ctx) {
2167
- const result = [];
2168
- const importMap = {};
2169
- ctx.imports.forEach((items, moduleName) => {
2170
- const specifier = [];
2171
- for (const item of items) {
2172
- const local = t18.identifier(item.name);
2173
- if (!item.onDemand) {
2174
- specifier.push(t18.importDefaultSpecifier(local));
2175
- } else {
2176
- specifier.push(t18.importSpecifier(local, local));
2177
- }
2178
- }
2179
- importMap[moduleName] = specifier;
2180
- });
2181
- for (const name in importMap) {
2182
- const specifiers = importMap[name];
2183
- const importDecl = t18.importDeclaration(specifiers, t18.stringLiteral(name));
2184
- if (name === PACKAGE_NAME.react) {
2185
- result.unshift(importDecl);
2186
- } else {
2187
- result.push(importDecl);
2188
- }
2189
- }
2190
- return result;
2191
- }
2192
-
2193
- // src/core/transform/sfc/script/syntax-processor/postprocess/resolve-static-hoisting.ts
2194
- import * as t20 from "@babel/types";
2195
-
2196
1876
  // src/core/transform/sfc/script/shared/babel-utils.ts
2197
- import * as t19 from "@babel/types";
1877
+ import * as t16 from "@babel/types";
2198
1878
  function findRootVariablePath(path9) {
2199
1879
  const rootId = findRootIdentifier(path9.node);
2200
1880
  if (!rootId?.name) return null;
@@ -2205,10 +1885,10 @@ function findRootVariablePath(path9) {
2205
1885
  }
2206
1886
  function findRootIdentifier(node) {
2207
1887
  let current = node.object;
2208
- while (t19.isMemberExpression(current) || t19.isOptionalMemberExpression(current)) {
1888
+ while (t16.isMemberExpression(current) || t16.isOptionalMemberExpression(current)) {
2209
1889
  current = current.object;
2210
1890
  }
2211
- return t19.isIdentifier(current) ? current : null;
1891
+ return t16.isIdentifier(current) ? current : null;
2212
1892
  }
2213
1893
  function getVariableDeclaratorPath(path9) {
2214
1894
  if (path9.isVariableDeclarator()) {
@@ -2292,14 +1972,14 @@ function isPropertyName(path9) {
2292
1972
  }
2293
1973
  function replaceCallName(callExp, identifierName) {
2294
1974
  const { callee } = callExp;
2295
- if (!t19.isIdentifier(callee)) return;
1975
+ if (!t16.isIdentifier(callee)) return;
2296
1976
  callee.name = identifierName;
2297
1977
  if (callee.loc) {
2298
1978
  callee.loc.identifierName = identifierName;
2299
1979
  }
2300
1980
  }
2301
1981
  function replaceIdName(id, newName) {
2302
- if (!t19.isIdentifier(id)) return;
1982
+ if (!t16.isIdentifier(id)) return;
2303
1983
  id.name = newName;
2304
1984
  if (id.loc) {
2305
1985
  id.loc.identifierName = newName;
@@ -2309,69 +1989,110 @@ function stringValueToTSType(ctx, input, tsTypeAnnotation7) {
2309
1989
  const { filename, scriptData } = ctx;
2310
1990
  const exp = stringToExpr(input, scriptData.lang, filename);
2311
1991
  const ts = expressionToTSType(exp);
2312
- return tsTypeAnnotation7 ? t19.tsTypeAnnotation(ts) : ts;
1992
+ return tsTypeAnnotation7 ? t16.tsTypeAnnotation(ts) : ts;
2313
1993
  }
2314
1994
  function expressionToTSType(exp) {
2315
- if (t19.isStringLiteral(exp)) return t19.tsStringKeyword();
2316
- if (t19.isNumericLiteral(exp)) return t19.tsNumberKeyword();
2317
- if (t19.isBooleanLiteral(exp)) return t19.tsBooleanKeyword();
2318
- if (t19.isArrayExpression(exp)) return t19.tsArrayType(t19.tsAnyKeyword());
2319
- if (t19.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)) {
2320
2000
  const members = [];
2321
2001
  for (const p of exp.properties) {
2322
- if (!t19.isObjectProperty(p)) continue;
2002
+ if (!t16.isObjectProperty(p)) continue;
2323
2003
  let key;
2324
- if (t19.isIdentifier(p.key)) key = p.key.name;
2325
- else if (t19.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;
2326
2006
  if (!key) continue;
2327
- if (t19.isExpression(p.value)) {
2007
+ if (t16.isExpression(p.value)) {
2328
2008
  members.push(
2329
- t19.tsPropertySignature(t19.identifier(key), t19.tsTypeAnnotation(expressionToTSType(p.value)))
2009
+ t16.tsPropertySignature(t16.identifier(key), t16.tsTypeAnnotation(expressionToTSType(p.value)))
2330
2010
  );
2331
2011
  } else {
2332
2012
  members.push(
2333
- t19.tsPropertySignature(t19.identifier(key), t19.tsTypeAnnotation(t19.tsAnyKeyword()))
2013
+ t16.tsPropertySignature(t16.identifier(key), t16.tsTypeAnnotation(t16.tsAnyKeyword()))
2334
2014
  );
2335
2015
  }
2336
2016
  }
2337
- return t19.tsTypeLiteral(members);
2017
+ return t16.tsTypeLiteral(members);
2338
2018
  }
2339
- if (t19.isArrowFunctionExpression(exp) || t19.isFunctionExpression(exp)) {
2019
+ if (t16.isArrowFunctionExpression(exp) || t16.isFunctionExpression(exp)) {
2340
2020
  const params = exp.params.map((p, i) => {
2341
- const id = t19.isIdentifier(p) ? t19.identifier(p.name) : t19.identifier(`arg${i}`);
2342
- id.typeAnnotation = t19.tsTypeAnnotation(t19.tsAnyKeyword());
2021
+ const id = t16.isIdentifier(p) ? t16.identifier(p.name) : t16.identifier(`arg${i}`);
2022
+ id.typeAnnotation = t16.tsTypeAnnotation(t16.tsAnyKeyword());
2343
2023
  return id;
2344
2024
  });
2345
- let returnType = t19.tsAnyKeyword();
2346
- if (t19.isBlockStatement(exp.body)) {
2025
+ let returnType = t16.tsAnyKeyword();
2026
+ if (t16.isBlockStatement(exp.body)) {
2347
2027
  for (const stmt of exp.body.body) {
2348
- if (t19.isReturnStatement(stmt) && stmt.argument) {
2349
- if (t19.isExpression(stmt.argument)) {
2028
+ if (t16.isReturnStatement(stmt) && stmt.argument) {
2029
+ if (t16.isExpression(stmt.argument)) {
2350
2030
  returnType = expressionToTSType(stmt.argument);
2351
2031
  break;
2352
2032
  }
2353
2033
  }
2354
2034
  }
2355
- } else if (t19.isExpression(exp.body)) {
2035
+ } else if (t16.isExpression(exp.body)) {
2356
2036
  returnType = expressionToTSType(exp.body);
2357
2037
  }
2358
- return t19.tsFunctionType(null, params, t19.tsTypeAnnotation(returnType));
2038
+ return t16.tsFunctionType(null, params, t16.tsTypeAnnotation(returnType));
2359
2039
  }
2360
- return t19.tsAnyKeyword();
2040
+ return t16.tsAnyKeyword();
2361
2041
  }
2362
2042
  function isCalleeNamed(node, name) {
2363
- if (!t19.isIdentifier(node.callee)) {
2043
+ if (!t16.isIdentifier(node.callee)) {
2364
2044
  return false;
2365
2045
  }
2366
2046
  return node.callee.name === name;
2367
2047
  }
2368
2048
  function isSimpleLiteral(node) {
2369
2049
  if (!node) return false;
2370
- if (t19.isStringLiteral(node) || t19.isNumericLiteral(node) || t19.isBooleanLiteral(node) || t19.isNullLiteral(node) || t19.isRegExpLiteral(node) || t19.isBigIntLiteral(node) || t19.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)) {
2371
2051
  return true;
2372
2052
  }
2373
2053
  return false;
2374
2054
  }
2055
+ function forkNode(node, deep = true) {
2056
+ const newNode = t16.cloneNode(node, deep);
2057
+ newNode.leadingComments = node.leadingComments;
2058
+ newNode.innerComments = node.innerComments;
2059
+ newNode.trailingComments = null;
2060
+ cleanNodeLoc(node);
2061
+ cleanNodeComments(node);
2062
+ return newNode;
2063
+ }
2064
+ function cleanNodeLoc(node) {
2065
+ node.start = null;
2066
+ node.end = null;
2067
+ node.loc = null;
2068
+ }
2069
+ function cleanNodeComments(node) {
2070
+ node.leadingComments = null;
2071
+ node.innerComments = null;
2072
+ node.trailingComments = null;
2073
+ }
2074
+
2075
+ // src/core/transform/sfc/script/syntax-processor/postprocess/resolve-ast-chunks/resolve-global-type-chunk.ts
2076
+ function resolveGlobalTypeChunks(path9, ir) {
2077
+ if (!path9.parentPath?.isProgram()) {
2078
+ return;
2079
+ }
2080
+ const forked = forkNode(path9.node);
2081
+ ir.tsTypes.push(forked);
2082
+ path9.remove();
2083
+ }
2084
+
2085
+ // src/core/transform/sfc/script/syntax-processor/postprocess/resolve-ast-chunks/resolve-module-chunk.ts
2086
+ import * as t17 from "@babel/types";
2087
+ function resolveModuleChunks(path9, ir) {
2088
+ const forked = forkNode(path9.node);
2089
+ if (t17.isImportDeclaration(forked)) {
2090
+ ir.imports.push(forked);
2091
+ } else if (t17.isExportDeclaration(forked)) {
2092
+ ir.exports.push(forked);
2093
+ }
2094
+ path9.remove();
2095
+ }
2375
2096
 
2376
2097
  // src/core/transform/sfc/script/shared/metadata-utils.ts
2377
2098
  var META_KEY = "__vureact_metadata";
@@ -2389,47 +2110,293 @@ function setScriptNodeMeta(node, opts) {
2389
2110
  node[META_KEY] = opts;
2390
2111
  }
2391
2112
 
2392
- // src/core/transform/sfc/script/syntax-processor/postprocess/resolve-static-hoisting.ts
2393
- function resolveStaticHoisting(ctx) {
2113
+ // src/core/transform/sfc/script/syntax-processor/postprocess/resolve-ast-chunks/resolve-static-const-chunk.ts
2114
+ function resolveStaticConstChunks(path9, ir) {
2115
+ const { node, parentPath } = path9;
2116
+ const parent = parentPath.node;
2117
+ if (!isVariableDeclTopLevel(path9) || !parentPath.isVariableDeclaration() || parent.kind !== "const" || !isSimpleLiteral(node.init) || getScriptNodeMeta(node)) {
2118
+ return;
2119
+ }
2120
+ const forked = forkNode(parent);
2121
+ ir.statement.global.push(forked);
2122
+ parentPath.remove();
2123
+ }
2124
+
2125
+ // src/core/transform/sfc/script/syntax-processor/postprocess/resolve-ast-chunks/index.ts
2126
+ function resolveASTChunks(ctx, ast) {
2394
2127
  const scriptIR = getScriptIR(ctx);
2395
2128
  if (ctx.inputType !== "sfc") {
2396
2129
  return {};
2397
2130
  }
2131
+ scriptIR.statement.local = ast;
2398
2132
  return {
2133
+ // 提取 import/export
2399
2134
  "ImportDeclaration|ExportDeclaration"(path9) {
2400
- if (t20.isImportDeclaration(path9.node)) {
2401
- scriptIR.imports.push(path9.node);
2402
- } else if (t20.isExportDeclaration(path9.node)) {
2403
- scriptIR.exports.push(path9.node);
2404
- }
2405
- path9.remove();
2135
+ resolveModuleChunks(path9, scriptIR);
2406
2136
  },
2137
+ // 提取全局类型声明
2407
2138
  "TSInterfaceDeclaration|TSTypeAliasDeclaration|TSEnumDeclaration|TSModuleDeclaration|TSModuleDeclaration"(path9) {
2408
- if (t20.isProgram(path9.parent)) {
2409
- scriptIR.tsTypes.push(path9.node);
2410
- path9.remove();
2411
- }
2139
+ resolveGlobalTypeChunks(path9, scriptIR);
2412
2140
  },
2141
+ // 提升顶层常量声明
2413
2142
  VariableDeclarator(path9) {
2143
+ resolveStaticConstChunks(path9, scriptIR);
2144
+ }
2145
+ };
2146
+ }
2147
+
2148
+ // src/core/transform/sfc/script/syntax-processor/postprocess/resolve-runtime-imports/index.ts
2149
+ import * as t18 from "@babel/types";
2150
+
2151
+ // src/core/transform/shared.ts
2152
+ function recordImport(ctx, pkg, name, onDemand = true) {
2153
+ const { imports } = ctx;
2154
+ if (isTypeOnlyImport(name)) {
2155
+ name = `type ${name}`;
2156
+ }
2157
+ if (imports.has(pkg)) {
2158
+ const list = imports.get(pkg);
2159
+ const foundItem = list.find((item) => item.name === name);
2160
+ if (!foundItem) {
2161
+ list.push({ name, onDemand });
2162
+ }
2163
+ return;
2164
+ }
2165
+ imports.set(pkg, [{ name, onDemand }]);
2166
+ }
2167
+ function isTypeOnlyImport(name) {
2168
+ const arr = [REACT_API_MAP.ReactNode];
2169
+ return arr.includes(name);
2170
+ }
2171
+
2172
+ // src/core/transform/sfc/script/shared/replace-vue-suffix.ts
2173
+ function replaceVueSuffix(node) {
2174
+ if (!node.value.endsWith(".vue")) return;
2175
+ const replaced = node.value.replace(/.vue$/, "");
2176
+ node.value = replaced;
2177
+ node.extra = {
2178
+ rawValue: replaced,
2179
+ // fix: 当 minified: true 的情况下,输出内容丢失引号
2180
+ raw: `'${replaced}'`
2181
+ };
2182
+ }
2183
+
2184
+ // src/core/transform/sfc/script/syntax-processor/postprocess/resolve-runtime-imports/import-strategies.ts
2185
+ var VueRouterStrategy = class {
2186
+ matches(moduleName) {
2187
+ return moduleName === "vue-router" || moduleName.startsWith("vue-router/");
2188
+ }
2189
+ process() {
2190
+ return {
2191
+ shouldReplaceSource: true,
2192
+ newSource: PACKAGE_NAME.router,
2193
+ shouldRemove: false,
2194
+ shouldInjectRuntimeImports: false
2195
+ };
2196
+ }
2197
+ };
2198
+ var VueEcosystemStrategy = class {
2199
+ matches(moduleName) {
2200
+ if (moduleName.startsWith(".") || moduleName.startsWith("/") || moduleName.startsWith("file:")) {
2201
+ return false;
2202
+ }
2203
+ if (moduleName === "vue-router" || moduleName.startsWith("vue-router/")) {
2204
+ return false;
2205
+ }
2206
+ if (moduleName.startsWith("@vue/")) {
2207
+ return true;
2208
+ }
2209
+ for (const pkg of VUE_PACKAGES) {
2210
+ if (moduleName === pkg || moduleName.startsWith(`${pkg}/`)) {
2211
+ return true;
2212
+ }
2213
+ }
2214
+ return false;
2215
+ }
2216
+ process() {
2217
+ return {
2218
+ shouldReplaceSource: false,
2219
+ shouldRemove: true,
2220
+ shouldInjectRuntimeImports: true
2221
+ };
2222
+ }
2223
+ };
2224
+ var StyleFileStrategy = class {
2225
+ regExp = /\.(less|sass|scss)$/i;
2226
+ matches(moduleName) {
2227
+ return this.regExp.test(moduleName);
2228
+ }
2229
+ process(path9, ctx) {
2230
+ if (!ctx.preprocessStyles) {
2231
+ return {};
2232
+ }
2233
+ const importSource = path9.node.source.value;
2234
+ if (typeof importSource !== "string") {
2235
+ return {};
2236
+ }
2237
+ return {
2238
+ shouldReplaceSource: true,
2239
+ newSource: importSource.replace(this.regExp, ".css"),
2240
+ shouldRemove: false,
2241
+ shouldInjectRuntimeImports: false
2242
+ };
2243
+ }
2244
+ };
2245
+
2246
+ // src/core/transform/sfc/script/syntax-processor/postprocess/resolve-runtime-imports/import-strategy-manager.ts
2247
+ var ImportStrategyManager = class {
2248
+ strategies = [];
2249
+ constructor() {
2250
+ this.strategies.push(new VueRouterStrategy());
2251
+ this.strategies.push(new VueEcosystemStrategy());
2252
+ this.strategies.push(new StyleFileStrategy());
2253
+ }
2254
+ /** 添加自定义策略 */
2255
+ addStrategy(strategy) {
2256
+ this.strategies.push(strategy);
2257
+ }
2258
+ /** 查找匹配的策略 */
2259
+ findStrategy(moduleName) {
2260
+ for (const strategy of this.strategies) {
2261
+ if (strategy.matches(moduleName)) {
2262
+ return strategy;
2263
+ }
2264
+ }
2265
+ return null;
2266
+ }
2267
+ };
2268
+
2269
+ // src/core/transform/sfc/script/syntax-processor/postprocess/resolve-runtime-imports/index.ts
2270
+ function resolveRuntimeImports(ctx) {
2271
+ if (ctx.inputType === "sfc") {
2272
+ recordImport(ctx, PACKAGE_NAME.react, REACT_API_MAP.memo);
2273
+ }
2274
+ const strategyManager = new ImportStrategyManager();
2275
+ const processedModules = /* @__PURE__ */ new Set();
2276
+ let hasImports = false;
2277
+ return {
2278
+ ImportDeclaration(path9) {
2414
2279
  const { node } = path9;
2415
- if (!isVariableDeclTopLevel(path9) || !isSimpleLiteral(node.init) || getScriptNodeMeta(node)) {
2280
+ const originalModuleName = node.source.value.toLowerCase();
2281
+ const strategy = strategyManager.findStrategy(originalModuleName);
2282
+ let strategyResult = null;
2283
+ if (strategy) {
2284
+ strategyResult = strategy.process(path9, ctx, originalModuleName);
2285
+ if (strategyResult.shouldReplaceSource && strategyResult.newSource) {
2286
+ node.source.value = strategyResult.newSource;
2287
+ }
2288
+ if (strategyResult.shouldRemove && !path9.removed) {
2289
+ path9.remove();
2290
+ return;
2291
+ }
2292
+ }
2293
+ replaceVueSuffix(node.source);
2294
+ const finalModuleName = node.source.value.toLowerCase();
2295
+ if (processedModules.has(finalModuleName) && !path9.removed) {
2296
+ path9.remove();
2416
2297
  return;
2417
2298
  }
2418
- const declarationPath = path9.findParent((p) => p.isVariableDeclaration());
2419
- if (!declarationPath) return;
2420
- scriptIR.statement.global.push(declarationPath.node);
2421
- declarationPath.remove();
2299
+ processedModules.add(finalModuleName);
2300
+ mergeImports(node, ctx, finalModuleName);
2301
+ if (!hasImports) {
2302
+ const importNodes = createImportNodes(ctx);
2303
+ if (importNodes.length) {
2304
+ if (strategyResult?.shouldInjectRuntimeImports) {
2305
+ path9.insertAfter(importNodes);
2306
+ } else if (finalModuleName === PACKAGE_NAME.react) {
2307
+ path9.insertAfter(importNodes);
2308
+ } else {
2309
+ forkLeadingComments(importNodes[0], node);
2310
+ path9.insertBefore(importNodes);
2311
+ }
2312
+ }
2313
+ hasImports = true;
2314
+ }
2315
+ },
2316
+ // 兜底:无 ImportDeclaration 的文件也要能注入必需依赖。
2317
+ Program: {
2318
+ exit(path9) {
2319
+ if (hasImports) return;
2320
+ hasImports = true;
2321
+ const { node } = path9;
2322
+ const importNodes = createImportNodes(ctx);
2323
+ if (!importNodes.length) return;
2324
+ forkLeadingComments(importNodes[0], node);
2325
+ path9.unshiftContainer("body", importNodes);
2326
+ }
2422
2327
  }
2423
2328
  };
2424
2329
  }
2425
- function collectLocalStatements(ctx, ast) {
2330
+ function mergeImports(currentNode, ctx, moduleName) {
2331
+ const ctxImportItems = ctx.imports.get(moduleName);
2332
+ if (!ctxImportItems?.length) {
2333
+ return;
2334
+ }
2335
+ const currentImports = /* @__PURE__ */ new Set();
2336
+ for (const spec of currentNode.specifiers) {
2337
+ if (t18.isImportSpecifier(spec) && t18.isIdentifier(spec.imported)) {
2338
+ currentImports.add(spec.imported.name);
2339
+ }
2340
+ if (t18.isImportDefaultSpecifier(spec) && t18.isIdentifier(spec.local)) {
2341
+ currentImports.add(spec.local.name);
2342
+ }
2343
+ }
2344
+ for (const item of ctxImportItems) {
2345
+ if (currentImports.has(item.name)) {
2346
+ continue;
2347
+ }
2348
+ const local = t18.identifier(item.name);
2349
+ const newNode = !item.onDemand ? t18.importDefaultSpecifier(local) : t18.importSpecifier(local, local);
2350
+ currentNode.specifiers.push(newNode);
2351
+ }
2352
+ ctx.imports.delete(moduleName);
2353
+ }
2354
+ function createImportNodes(ctx) {
2355
+ const result = [];
2356
+ const importDeclarations = Array.from(ctx.imports).map(([moduleName, items]) => {
2357
+ const specifiers = items.map((item) => {
2358
+ const local = t18.identifier(item.name);
2359
+ return item.onDemand ? t18.importSpecifier(local, local) : t18.importDefaultSpecifier(local);
2360
+ });
2361
+ return t18.importDeclaration(specifiers, t18.stringLiteral(moduleName));
2362
+ });
2363
+ for (const decl of importDeclarations) {
2364
+ const name = decl.source.value;
2365
+ if (name === PACKAGE_NAME.react) {
2366
+ result.unshift(decl);
2367
+ } else {
2368
+ result.push(decl);
2369
+ }
2370
+ }
2371
+ return result;
2372
+ }
2373
+ function forkLeadingComments(target, source) {
2374
+ const { leadingComments } = source;
2375
+ if (!leadingComments?.length) {
2376
+ return;
2377
+ }
2378
+ const newComments = [...leadingComments];
2379
+ source.leadingComments = null;
2380
+ target.leadingComments = newComments;
2381
+ }
2382
+
2383
+ // src/core/transform/sfc/script/syntax-processor/postprocess/resolve-sfc-css-import.ts
2384
+ import * as t19 from "@babel/types";
2385
+ function resolveSfcCssImport(ctx) {
2426
2386
  if (ctx.inputType !== "sfc") return;
2427
2387
  const scriptIR = getScriptIR(ctx);
2428
- scriptIR.statement.local = ast;
2388
+ const { filePath, moduleName } = ctx.styleData;
2389
+ if (!filePath) return;
2390
+ const styleFilename = normalizePath(filePath).split("/").pop();
2391
+ const importDecl = t19.importDeclaration(
2392
+ !moduleName ? [] : [t19.importDefaultSpecifier(t19.identifier(moduleName))],
2393
+ t19.stringLiteral(`./${styleFilename}`)
2394
+ );
2395
+ scriptIR.imports.push(importDecl);
2429
2396
  }
2430
2397
 
2431
2398
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-define-async-component.ts
2432
- import * as t21 from "@babel/types";
2399
+ import * as t20 from "@babel/types";
2433
2400
  function resolveDefineAsyncComponent(ctx) {
2434
2401
  return {
2435
2402
  CallExpression(path9) {
@@ -2445,11 +2412,11 @@ function resolveDefineAsyncComponent(ctx) {
2445
2412
  };
2446
2413
  }
2447
2414
  function checkIsUnsupported(ctx, arg) {
2448
- if (t21.isFunction(arg)) {
2415
+ if (t20.isFunction(arg)) {
2449
2416
  checkIsDynamicImport(ctx, arg);
2450
- } else if (t21.isObjectExpression(arg)) {
2417
+ } else if (t20.isObjectExpression(arg)) {
2451
2418
  const { value } = arg.properties.find(
2452
- (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"
2453
2420
  );
2454
2421
  checkIsDynamicImport(ctx, value);
2455
2422
  if (arg.properties.length > 1) {
@@ -2460,7 +2427,7 @@ function checkIsUnsupported(ctx, arg) {
2460
2427
  function checkIsDynamicImport(ctx, node) {
2461
2428
  const { scriptData, filename } = ctx;
2462
2429
  const warnIsNotImport = (target) => {
2463
- if (!target || !t21.isImport(target)) {
2430
+ if (!target || !t20.isImport(target)) {
2464
2431
  logger.error(
2465
2432
  `Only ES module dynamic imports are supported. You must use and return import('...').`,
2466
2433
  {
@@ -2471,21 +2438,21 @@ function checkIsDynamicImport(ctx, node) {
2471
2438
  );
2472
2439
  }
2473
2440
  };
2474
- if (t21.isFunction(node)) {
2441
+ if (t20.isFunction(node)) {
2475
2442
  checkIsDynamicImport(ctx, node.body);
2476
2443
  return;
2477
2444
  }
2478
- if (t21.isBlockStatement(node)) {
2445
+ if (t20.isBlockStatement(node)) {
2479
2446
  const [returnSmt] = node.body;
2480
- if (t21.isReturnStatement(returnSmt)) {
2447
+ if (t20.isReturnStatement(returnSmt)) {
2481
2448
  warnIsNotImport(returnSmt.argument);
2482
2449
  }
2483
2450
  return;
2484
2451
  }
2485
- if (t21.isCallExpression(node)) {
2452
+ if (t20.isCallExpression(node)) {
2486
2453
  warnIsNotImport(node.callee);
2487
- if (t21.isStringLiteral(node.arguments[0])) {
2488
- replaceVueSuffix(ctx, node.arguments[0]);
2454
+ if (t20.isStringLiteral(node.arguments[0])) {
2455
+ replaceVueSuffix(node.arguments[0]);
2489
2456
  }
2490
2457
  return;
2491
2458
  }
@@ -2533,24 +2500,24 @@ function pushToGlobalScope(path9, ctx) {
2533
2500
  }
2534
2501
 
2535
2502
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-define-expose.ts
2536
- import * as t23 from "@babel/types";
2503
+ import * as t22 from "@babel/types";
2537
2504
 
2538
2505
  // src/core/transform/sfc/script/shared/hook-creator.ts
2539
- import * as t22 from "@babel/types";
2506
+ import * as t21 from "@babel/types";
2540
2507
  function createUseCallback(body, deps) {
2541
- return t22.callExpression(t22.identifier(REACT_API_MAP.useCallback), [
2508
+ return t21.callExpression(t21.identifier(REACT_API_MAP.useCallback), [
2542
2509
  body,
2543
- deps ?? t22.arrayExpression([])
2510
+ deps ?? t21.arrayExpression([])
2544
2511
  ]);
2545
2512
  }
2546
2513
  function createUseMemo(body, deps) {
2547
- return t22.callExpression(t22.identifier(REACT_API_MAP.useMemo), [
2548
- t22.arrowFunctionExpression([], body),
2549
- deps ?? t22.arrayExpression([])
2514
+ return t21.callExpression(t21.identifier(REACT_API_MAP.useMemo), [
2515
+ t21.arrowFunctionExpression([], body),
2516
+ deps ?? t21.arrayExpression([])
2550
2517
  ]);
2551
2518
  }
2552
2519
  function createUseImperativeHandle(refId, init) {
2553
- return t22.callExpression(t22.identifier(REACT_API_MAP.useImperativeHandle), [refId, init]);
2520
+ return t21.callExpression(t21.identifier(REACT_API_MAP.useImperativeHandle), [refId, init]);
2554
2521
  }
2555
2522
 
2556
2523
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-define-expose.ts
@@ -2571,16 +2538,16 @@ function resolveDefineExpose(ctx) {
2571
2538
  const adapter = ADAPTER_RULES.react[MACRO_API_NAMES.expose];
2572
2539
  recordImport(ctx, adapter.package, REACT_API_MAP.forwardRef);
2573
2540
  recordImport(ctx, adapter.package, adapter.target);
2574
- if (!t23.isObjectExpression(expose) && !t23.isFunction(expose)) {
2541
+ if (!t22.isObjectExpression(expose) && !t22.isFunction(expose)) {
2575
2542
  logger.warn("Non-deterministic object literal may cause unknown risks.", {
2576
2543
  file: filename,
2577
2544
  loc: expose.loc,
2578
2545
  source: scriptData.source
2579
2546
  });
2580
2547
  }
2581
- const init = !t23.isFunction(expose) ? t23.arrowFunctionExpression([], expose) : expose;
2548
+ const init = !t22.isFunction(expose) ? t22.arrowFunctionExpression([], expose) : expose;
2582
2549
  const { forwardRef } = scriptData;
2583
- const newNode = createUseImperativeHandle(t23.identifier(forwardRef.refField), init);
2550
+ const newNode = createUseImperativeHandle(t22.identifier(forwardRef.refField), init);
2584
2551
  forwardRef.enabled = true;
2585
2552
  path9.replaceWith(newNode);
2586
2553
  }
@@ -2588,7 +2555,7 @@ function resolveDefineExpose(ctx) {
2588
2555
  }
2589
2556
 
2590
2557
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-define-options.ts
2591
- import * as t24 from "@babel/types";
2558
+ import * as t23 from "@babel/types";
2592
2559
  function resolveDefineOptions(ctx) {
2593
2560
  return {
2594
2561
  CallExpression(path9) {
@@ -2607,7 +2574,7 @@ function resolveDefineOptions(ctx) {
2607
2574
  path9.remove();
2608
2575
  return;
2609
2576
  }
2610
- if (!t24.isObjectExpression(options)) {
2577
+ if (!t23.isObjectExpression(options)) {
2611
2578
  logger.warn("Argument for defineOptions must be an object expression.", {
2612
2579
  source: scriptData.source,
2613
2580
  file: filename,
@@ -2615,7 +2582,7 @@ function resolveDefineOptions(ctx) {
2615
2582
  });
2616
2583
  } else {
2617
2584
  for (const prop of options.properties) {
2618
- if (!t24.isObjectProperty(prop) || !t24.isIdentifier(prop.key)) {
2585
+ if (!t23.isObjectProperty(prop) || !t23.isIdentifier(prop.key)) {
2619
2586
  continue;
2620
2587
  }
2621
2588
  extractName(prop, ctx);
@@ -2629,7 +2596,7 @@ function extractName(prop, ctx) {
2629
2596
  if (ctx.compName) return;
2630
2597
  const { filename, scriptData } = ctx;
2631
2598
  if (!prop.computed && prop.key.name === "name") {
2632
- if (t24.isStringLiteral(prop.value)) {
2599
+ if (t23.isStringLiteral(prop.value)) {
2633
2600
  ctx.compName = prop.value.value;
2634
2601
  return;
2635
2602
  }
@@ -2642,7 +2609,7 @@ function extractName(prop, ctx) {
2642
2609
  }
2643
2610
 
2644
2611
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-emit-calls.ts
2645
- import * as t25 from "@babel/types";
2612
+ import * as t24 from "@babel/types";
2646
2613
  function resolveEmitCalls(ctx) {
2647
2614
  const formatEmitEventName = (raw) => {
2648
2615
  if (raw.startsWith("update:")) {
@@ -2656,7 +2623,7 @@ function resolveEmitCalls(ctx) {
2656
2623
  CallExpression(path9) {
2657
2624
  const { node } = path9;
2658
2625
  const { filename, templateData, scriptData } = ctx;
2659
- if (!t25.isIdentifier(node.callee)) return;
2626
+ if (!t24.isIdentifier(node.callee)) return;
2660
2627
  const { name } = node.callee;
2661
2628
  const checkIfFromDefineEmits = () => {
2662
2629
  let result = false;
@@ -2668,7 +2635,7 @@ function resolveEmitCalls(ctx) {
2668
2635
  const binding = path9.scope.getBinding(name);
2669
2636
  if (binding) {
2670
2637
  const parent = binding.path.node;
2671
- 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)) {
2672
2639
  result = parent.init.callee.name === MACRO_API_NAMES.emits;
2673
2640
  }
2674
2641
  }
@@ -2677,7 +2644,7 @@ function resolveEmitCalls(ctx) {
2677
2644
  };
2678
2645
  if (!checkIfFromDefineEmits()) return;
2679
2646
  const [callee, ...args] = node.arguments;
2680
- const eventName = t25.isStringLiteral(callee) ? formatEmitEventName(callee.value) : void 0;
2647
+ const eventName = t24.isStringLiteral(callee) ? formatEmitEventName(callee.value) : void 0;
2681
2648
  if (!eventName) {
2682
2649
  logger.warn(`Expected String type but got ${callee?.type}, expression will be removed`, {
2683
2650
  file: filename,
@@ -2687,10 +2654,10 @@ function resolveEmitCalls(ctx) {
2687
2654
  path9.remove();
2688
2655
  return;
2689
2656
  }
2690
- const propCall = t25.optionalCallExpression(
2691
- t25.optionalMemberExpression(
2692
- t25.identifier(ctx.propField),
2693
- t25.identifier(eventName),
2657
+ const propCall = t24.optionalCallExpression(
2658
+ t24.optionalMemberExpression(
2659
+ t24.identifier(ctx.propField),
2660
+ t24.identifier(eventName),
2694
2661
  false,
2695
2662
  true
2696
2663
  ),
@@ -2703,30 +2670,30 @@ function resolveEmitCalls(ctx) {
2703
2670
  }
2704
2671
 
2705
2672
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-props-interface/index.ts
2706
- import * as t30 from "@babel/types";
2673
+ import * as t29 from "@babel/types";
2707
2674
 
2708
2675
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-props-interface/resolve-emits.ts
2709
- import * as t27 from "@babel/types";
2676
+ import * as t26 from "@babel/types";
2710
2677
 
2711
2678
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-props-interface/shared.ts
2712
- import * as t26 from "@babel/types";
2679
+ import * as t25 from "@babel/types";
2713
2680
  function cloneCallableParams(params) {
2714
2681
  const cloneCallableParam = (param, index) => {
2715
- if (t26.isRestElement(param)) {
2682
+ if (t25.isRestElement(param)) {
2716
2683
  const arg = param.argument;
2717
- const name = t26.isIdentifier(arg) ? arg.name : `args${index}`;
2718
- const rest = t26.restElement(t26.identifier(name));
2719
- 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()));
2720
2687
  return rest;
2721
2688
  }
2722
- if (t26.isIdentifier(param)) {
2723
- const id = t26.identifier(param.name || `arg${index}`);
2689
+ if (t25.isIdentifier(param)) {
2690
+ const id = t25.identifier(param.name || `arg${index}`);
2724
2691
  id.optional = param.optional;
2725
- id.typeAnnotation = param.typeAnnotation || t26.tsTypeAnnotation(t26.tsAnyKeyword());
2692
+ id.typeAnnotation = param.typeAnnotation || t25.tsTypeAnnotation(t25.tsAnyKeyword());
2726
2693
  return id;
2727
2694
  }
2728
- const fallback = t26.identifier(`arg${index}`);
2729
- fallback.typeAnnotation = t26.tsTypeAnnotation(t26.tsAnyKeyword());
2695
+ const fallback = t25.identifier(`arg${index}`);
2696
+ fallback.typeAnnotation = t25.tsTypeAnnotation(t25.tsAnyKeyword());
2730
2697
  return fallback;
2731
2698
  };
2732
2699
  return params.map(cloneCallableParam);
@@ -2736,18 +2703,18 @@ function cloneCallableParams(params) {
2736
2703
  function resolveEmitsTopLevelTypes(ctx) {
2737
2704
  return {
2738
2705
  "TSInterfaceDeclaration|TSTypeAliasDeclaration"(path9) {
2739
- if (!t27.isProgram(path9.parent)) return;
2706
+ if (!t26.isProgram(path9.parent)) return;
2740
2707
  const { node } = path9;
2741
- if (t27.isTSInterfaceDeclaration(node)) {
2742
- const typeLiteral = t27.tsTypeLiteral(node.body.body);
2708
+ if (t26.isTSInterfaceDeclaration(node)) {
2709
+ const typeLiteral = t26.tsTypeLiteral(node.body.body);
2743
2710
  if (!hasEmitsSignatureInType(typeLiteral)) return;
2744
2711
  const resolved = resolveTopLevelEmitType(typeLiteral);
2745
- if (resolved && t27.isTSTypeLiteral(resolved)) {
2712
+ if (resolved && t26.isTSTypeLiteral(resolved)) {
2746
2713
  node.body.body = resolved.members;
2747
2714
  }
2748
2715
  return;
2749
2716
  }
2750
- if (t27.isTSTypeAliasDeclaration(node)) {
2717
+ if (t26.isTSTypeAliasDeclaration(node)) {
2751
2718
  if (!hasEmitsSignatureInType(node.typeAnnotation)) return;
2752
2719
  const resolved = resolveTopLevelEmitType(node.typeAnnotation);
2753
2720
  if (resolved) {
@@ -2758,47 +2725,47 @@ function resolveEmitsTopLevelTypes(ctx) {
2758
2725
  };
2759
2726
  }
2760
2727
  function resolveTopLevelEmitType(tsType) {
2761
- if (t27.isTSParenthesizedType(tsType)) {
2728
+ if (t26.isTSParenthesizedType(tsType)) {
2762
2729
  return resolveTopLevelEmitType(tsType.typeAnnotation);
2763
2730
  }
2764
- if (t27.isTSTypeReference(tsType)) {
2731
+ if (t26.isTSTypeReference(tsType)) {
2765
2732
  if (!tsType.typeParameters || !tsType.typeParameters.params.length) {
2766
2733
  return tsType;
2767
2734
  }
2768
2735
  const params = tsType.typeParameters.params.map((param) => resolveTopLevelEmitType(param)).filter(Boolean);
2769
- return t27.tsTypeReference(
2736
+ return t26.tsTypeReference(
2770
2737
  tsType.typeName,
2771
- t27.tsTypeParameterInstantiation(params.length ? params : tsType.typeParameters.params)
2738
+ t26.tsTypeParameterInstantiation(params.length ? params : tsType.typeParameters.params)
2772
2739
  );
2773
2740
  }
2774
- if (t27.isTSIntersectionType(tsType)) {
2741
+ if (t26.isTSIntersectionType(tsType)) {
2775
2742
  const types = tsType.types.map(resolveTopLevelEmitType).filter(Boolean);
2776
2743
  if (!types.length) return null;
2777
2744
  if (types.length === 1) return types[0];
2778
- return t27.tsIntersectionType(types);
2745
+ return t26.tsIntersectionType(types);
2779
2746
  }
2780
- if (t27.isTSUnionType(tsType)) {
2747
+ if (t26.isTSUnionType(tsType)) {
2781
2748
  const types = tsType.types.map(resolveTopLevelEmitType).filter(Boolean);
2782
2749
  if (!types.length) return null;
2783
2750
  if (types.length === 1) return types[0];
2784
- return t27.tsUnionType(types);
2751
+ return t26.tsUnionType(types);
2785
2752
  }
2786
- if (t27.isTSTypeLiteral(tsType)) {
2753
+ if (t26.isTSTypeLiteral(tsType)) {
2787
2754
  const members = [];
2788
2755
  for (const member of tsType.members) {
2789
- if (t27.isTSCallSignatureDeclaration(member)) {
2756
+ if (t26.isTSCallSignatureDeclaration(member)) {
2790
2757
  members.push(...resolveEmitPropsFromCallSignature(member));
2791
2758
  continue;
2792
2759
  }
2793
2760
  members.push(member);
2794
2761
  }
2795
2762
  if (!members.length) return null;
2796
- return t27.tsTypeLiteral(members);
2763
+ return t26.tsTypeLiteral(members);
2797
2764
  }
2798
- if (t27.isTSFunctionType(tsType)) {
2765
+ if (t26.isTSFunctionType(tsType)) {
2799
2766
  const props = resolveEmitPropsFromCallable(tsType.parameters, tsType.typeAnnotation);
2800
2767
  if (!props.length) return null;
2801
- return t27.tsTypeLiteral(props);
2768
+ return t26.tsTypeLiteral(props);
2802
2769
  }
2803
2770
  return tsType;
2804
2771
  }
@@ -2819,41 +2786,41 @@ function processInferredTypes(ctx, runtimeArg) {
2819
2786
  propsTSIface: { emitTypes }
2820
2787
  } = ctx.scriptData;
2821
2788
  const members = [];
2822
- if (t27.isArrayExpression(runtimeArg)) {
2789
+ if (t26.isArrayExpression(runtimeArg)) {
2823
2790
  for (const element of runtimeArg.elements) {
2824
- if (!element || !t27.isStringLiteral(element)) continue;
2791
+ if (!element || !t26.isStringLiteral(element)) continue;
2825
2792
  const handlerName = resolveEmitHandlerName(element.value);
2826
2793
  const key = buildKey(handlerName);
2827
- const fnType = t27.tsFunctionType(
2794
+ const fnType = t26.tsFunctionType(
2828
2795
  null,
2829
2796
  [createRestAnyParam("args")],
2830
- t27.tsTypeAnnotation(t27.tsAnyKeyword())
2797
+ t26.tsTypeAnnotation(t26.tsAnyKeyword())
2831
2798
  );
2832
- const prop = t27.tsPropertySignature(key, t27.tsTypeAnnotation(fnType));
2799
+ const prop = t26.tsPropertySignature(key, t26.tsTypeAnnotation(fnType));
2833
2800
  prop.optional = true;
2834
2801
  members.push(prop);
2835
2802
  }
2836
2803
  if (members.length) {
2837
- emitTypes.push(t27.tsTypeLiteral(members));
2804
+ emitTypes.push(t26.tsTypeLiteral(members));
2838
2805
  }
2839
2806
  return;
2840
2807
  }
2841
- if (t27.isObjectExpression(runtimeArg)) {
2808
+ if (t26.isObjectExpression(runtimeArg)) {
2842
2809
  for (const prop of runtimeArg.properties) {
2843
- if (!t27.isObjectProperty(prop)) continue;
2844
- if (t27.isSpreadElement(prop)) continue;
2810
+ if (!t26.isObjectProperty(prop)) continue;
2811
+ if (t26.isSpreadElement(prop)) continue;
2845
2812
  const rawName = resolvePropName(prop.key);
2846
2813
  if (!rawName) continue;
2847
2814
  const handlerName = resolveEmitHandlerName(rawName);
2848
2815
  const key = buildKey(handlerName);
2849
- const params = t27.isArrayExpression(prop.value) ? resolveRuntimeTupleParams(prop.value) : [createRestAnyParam("args")];
2850
- const fnType = t27.tsFunctionType(null, params, t27.tsTypeAnnotation(t27.tsAnyKeyword()));
2851
- 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));
2852
2819
  propSig.optional = true;
2853
2820
  members.push(propSig);
2854
2821
  }
2855
2822
  if (members.length) {
2856
- emitTypes.push(t27.tsTypeLiteral(members));
2823
+ emitTypes.push(t26.tsTypeLiteral(members));
2857
2824
  }
2858
2825
  }
2859
2826
  }
@@ -2874,129 +2841,129 @@ function resolveEmitHandlerName(rawName) {
2874
2841
  return `on${name}`;
2875
2842
  }
2876
2843
  function resolvePropName(key) {
2877
- if (t27.isIdentifier(key)) return key.name;
2878
- if (t27.isStringLiteral(key)) return key.value;
2879
- 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);
2880
2847
  return null;
2881
2848
  }
2882
2849
  function buildKey(name) {
2883
- return t27.isValidIdentifier(name) ? t27.identifier(name) : t27.stringLiteral(name);
2850
+ return t26.isValidIdentifier(name) ? t26.identifier(name) : t26.stringLiteral(name);
2884
2851
  }
2885
2852
  function createRestAnyParam(name) {
2886
- const id = t27.identifier(name);
2887
- const rest = t27.restElement(id);
2888
- 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()));
2889
2856
  return rest;
2890
2857
  }
2891
2858
  function resolveRuntimeTupleParams(value) {
2892
2859
  const params = [];
2893
2860
  value.elements.forEach((element, index) => {
2894
2861
  if (!element) return;
2895
- if (t27.isSpreadElement(element)) {
2862
+ if (t26.isSpreadElement(element)) {
2896
2863
  params.push(createRestAnyParam(`args${index}`));
2897
2864
  return;
2898
2865
  }
2899
- if (t27.isIdentifier(element)) {
2900
- const id = t27.identifier(element.name);
2901
- 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());
2902
2869
  params.push(id);
2903
2870
  return;
2904
2871
  }
2905
- if (t27.isTSAsExpression(element)) {
2906
- const id = t27.identifier(`arg${index}`);
2907
- 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);
2908
2875
  params.push(id);
2909
2876
  return;
2910
2877
  }
2911
- const fallback = t27.identifier(`arg${index}`);
2912
- fallback.typeAnnotation = t27.tsTypeAnnotation(t27.tsAnyKeyword());
2878
+ const fallback = t26.identifier(`arg${index}`);
2879
+ fallback.typeAnnotation = t26.tsTypeAnnotation(t26.tsAnyKeyword());
2913
2880
  params.push(fallback);
2914
2881
  });
2915
2882
  return params;
2916
2883
  }
2917
2884
  function resolveExplicitEmitType(tsType) {
2918
- if (t27.isTSParenthesizedType(tsType)) {
2885
+ if (t26.isTSParenthesizedType(tsType)) {
2919
2886
  return resolveExplicitEmitType(tsType.typeAnnotation);
2920
2887
  }
2921
- if (t27.isTSTypeReference(tsType)) {
2888
+ if (t26.isTSTypeReference(tsType)) {
2922
2889
  if (!tsType.typeParameters || !tsType.typeParameters.params.length) {
2923
2890
  return tsType;
2924
2891
  }
2925
2892
  const params = tsType.typeParameters.params.map((param) => resolveExplicitEmitType(param)).filter(Boolean);
2926
- return t27.tsTypeReference(
2893
+ return t26.tsTypeReference(
2927
2894
  tsType.typeName,
2928
- t27.tsTypeParameterInstantiation(params.length ? params : tsType.typeParameters.params)
2895
+ t26.tsTypeParameterInstantiation(params.length ? params : tsType.typeParameters.params)
2929
2896
  );
2930
2897
  }
2931
- if (t27.isTSIntersectionType(tsType)) {
2898
+ if (t26.isTSIntersectionType(tsType)) {
2932
2899
  const types = tsType.types.map(resolveExplicitEmitType).filter(Boolean);
2933
2900
  if (!types.length) return null;
2934
2901
  if (types.length === 1) return types[0];
2935
- return t27.tsIntersectionType(types);
2902
+ return t26.tsIntersectionType(types);
2936
2903
  }
2937
- if (t27.isTSUnionType(tsType)) {
2904
+ if (t26.isTSUnionType(tsType)) {
2938
2905
  const types = tsType.types.map(resolveExplicitEmitType).filter(Boolean);
2939
2906
  if (!types.length) return null;
2940
2907
  if (types.length === 1) return types[0];
2941
- return t27.tsUnionType(types);
2908
+ return t26.tsUnionType(types);
2942
2909
  }
2943
- if (t27.isTSTypeLiteral(tsType)) {
2910
+ if (t26.isTSTypeLiteral(tsType)) {
2944
2911
  const members = [];
2945
2912
  for (const member of tsType.members) {
2946
- if (t27.isTSPropertySignature(member)) {
2913
+ if (t26.isTSPropertySignature(member)) {
2947
2914
  const prop = resolveEmitPropFromPropertySignature(member);
2948
2915
  if (prop) members.push(prop);
2949
2916
  continue;
2950
2917
  }
2951
- if (t27.isTSCallSignatureDeclaration(member)) {
2918
+ if (t26.isTSCallSignatureDeclaration(member)) {
2952
2919
  members.push(...resolveEmitPropsFromCallSignature(member));
2953
2920
  continue;
2954
2921
  }
2955
2922
  }
2956
2923
  if (!members.length) return null;
2957
- return t27.tsTypeLiteral(members);
2924
+ return t26.tsTypeLiteral(members);
2958
2925
  }
2959
- if (t27.isTSFunctionType(tsType)) {
2926
+ if (t26.isTSFunctionType(tsType)) {
2960
2927
  const props = resolveEmitPropsFromCallable(tsType.parameters, tsType.typeAnnotation);
2961
2928
  if (!props.length) return null;
2962
- return t27.tsTypeLiteral(props);
2929
+ return t26.tsTypeLiteral(props);
2963
2930
  }
2964
2931
  return tsType;
2965
2932
  }
2966
2933
  function hasEmitsSignatureInType(tsType) {
2967
- if (t27.isTSParenthesizedType(tsType)) {
2934
+ if (t26.isTSParenthesizedType(tsType)) {
2968
2935
  return hasEmitsSignatureInType(tsType.typeAnnotation);
2969
2936
  }
2970
- if (t27.isTSTypeReference(tsType)) {
2937
+ if (t26.isTSTypeReference(tsType)) {
2971
2938
  if (!tsType.typeParameters || !tsType.typeParameters.params.length) {
2972
2939
  return false;
2973
2940
  }
2974
2941
  return tsType.typeParameters.params.some(hasEmitsSignatureInType);
2975
2942
  }
2976
- if (t27.isTSIntersectionType(tsType) || t27.isTSUnionType(tsType)) {
2943
+ if (t26.isTSIntersectionType(tsType) || t26.isTSUnionType(tsType)) {
2977
2944
  return tsType.types.some(hasEmitsSignatureInType);
2978
2945
  }
2979
- if (t27.isTSTypeLiteral(tsType)) {
2946
+ if (t26.isTSTypeLiteral(tsType)) {
2980
2947
  return tsType.members.some(hasEmitsSignatureInMember);
2981
2948
  }
2982
- if (t27.isTSFunctionType(tsType)) {
2949
+ if (t26.isTSFunctionType(tsType)) {
2983
2950
  return isEmitsCallable(tsType.parameters);
2984
2951
  }
2985
2952
  return false;
2986
2953
  }
2987
2954
  function hasEmitsSignatureInMember(member) {
2988
- if (t27.isTSCallSignatureDeclaration(member)) {
2955
+ if (t26.isTSCallSignatureDeclaration(member)) {
2989
2956
  return isEmitsCallable(member.parameters);
2990
2957
  }
2991
2958
  return false;
2992
2959
  }
2993
2960
  function isEmitsCallable(parameters) {
2994
2961
  const [eventParam] = parameters;
2995
- if (!eventParam || !t27.isIdentifier(eventParam) || !eventParam.typeAnnotation) {
2962
+ if (!eventParam || !t26.isIdentifier(eventParam) || !eventParam.typeAnnotation) {
2996
2963
  return false;
2997
2964
  }
2998
2965
  const { typeAnnotation } = eventParam;
2999
- if (t27.isNoop(typeAnnotation)) return false;
2966
+ if (t26.isNoop(typeAnnotation)) return false;
3000
2967
  return resolveEventNames(typeAnnotation.typeAnnotation).length > 0;
3001
2968
  }
3002
2969
  function resolveEmitPropFromPropertySignature(member) {
@@ -3006,19 +2973,19 @@ function resolveEmitPropFromPropertySignature(member) {
3006
2973
  const key = buildKey(handlerName);
3007
2974
  const typeAnnotation = member.typeAnnotation?.typeAnnotation;
3008
2975
  let params = [];
3009
- let returnType = t27.tsAnyKeyword();
3010
- if (typeAnnotation && t27.isTSFunctionType(typeAnnotation)) {
2976
+ let returnType = t26.tsAnyKeyword();
2977
+ if (typeAnnotation && t26.isTSFunctionType(typeAnnotation)) {
3011
2978
  params = cloneCallableParams(typeAnnotation.parameters);
3012
2979
  returnType = typeAnnotation.typeAnnotation?.typeAnnotation ?? returnType;
3013
- } else if (typeAnnotation && t27.isTSTupleType(typeAnnotation)) {
2980
+ } else if (typeAnnotation && t26.isTSTupleType(typeAnnotation)) {
3014
2981
  params = resolveTupleTypeParams(typeAnnotation);
3015
2982
  } else if (typeAnnotation) {
3016
- const id = t27.identifier("value");
3017
- id.typeAnnotation = t27.tsTypeAnnotation(typeAnnotation);
2983
+ const id = t26.identifier("value");
2984
+ id.typeAnnotation = t26.tsTypeAnnotation(typeAnnotation);
3018
2985
  params = [id];
3019
2986
  }
3020
- const fnType = t27.tsFunctionType(null, params, t27.tsTypeAnnotation(returnType));
3021
- 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));
3022
2989
  prop.optional = !!member.optional;
3023
2990
  return prop;
3024
2991
  }
@@ -3027,32 +2994,32 @@ function resolveEmitPropsFromCallSignature(member) {
3027
2994
  }
3028
2995
  function resolveEmitPropsFromCallable(parameters, typeAnnotation) {
3029
2996
  const [eventParam, ...restParams] = parameters;
3030
- if (!eventParam || !t27.isIdentifier(eventParam) || !eventParam.typeAnnotation) {
2997
+ if (!eventParam || !t26.isIdentifier(eventParam) || !eventParam.typeAnnotation) {
3031
2998
  return [];
3032
2999
  }
3033
3000
  const { typeAnnotation: paramTypeAnnotation } = eventParam;
3034
- if (t27.isNoop(paramTypeAnnotation)) return [];
3001
+ if (t26.isNoop(paramTypeAnnotation)) return [];
3035
3002
  const eventNames = resolveEventNames(paramTypeAnnotation.typeAnnotation);
3036
3003
  if (!eventNames.length) return [];
3037
- const returnType = typeAnnotation?.typeAnnotation ?? t27.tsAnyKeyword();
3004
+ const returnType = typeAnnotation?.typeAnnotation ?? t26.tsAnyKeyword();
3038
3005
  return eventNames.map((eventName) => {
3039
3006
  const handlerName = resolveEmitHandlerName(eventName);
3040
3007
  const key = buildKey(handlerName);
3041
3008
  const params = cloneCallableParams(restParams);
3042
- const fnType = t27.tsFunctionType(null, params, t27.tsTypeAnnotation(returnType));
3043
- 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));
3044
3011
  prop.optional = true;
3045
3012
  return prop;
3046
3013
  });
3047
3014
  }
3048
3015
  function resolveEventNames(type) {
3049
- if (t27.isTSLiteralType(type) && t27.isStringLiteral(type.literal)) {
3016
+ if (t26.isTSLiteralType(type) && t26.isStringLiteral(type.literal)) {
3050
3017
  return [type.literal.value];
3051
3018
  }
3052
- if (t27.isTSUnionType(type)) {
3019
+ if (t26.isTSUnionType(type)) {
3053
3020
  return type.types.flatMap(resolveEventNames);
3054
3021
  }
3055
- if (t27.isTSParenthesizedType(type)) {
3022
+ if (t26.isTSParenthesizedType(type)) {
3056
3023
  return resolveEventNames(type.typeAnnotation);
3057
3024
  }
3058
3025
  return [];
@@ -3065,44 +3032,44 @@ function resolveTupleTypeParams(tuple) {
3065
3032
  return params;
3066
3033
  }
3067
3034
  function resolveTupleElementParam(element, index) {
3068
- const isNamedTuple = typeof t27.isTSNamedTupleMember === "function" && t27.isTSNamedTupleMember(element);
3035
+ const isNamedTuple = typeof t26.isTSNamedTupleMember === "function" && t26.isTSNamedTupleMember(element);
3069
3036
  if (isNamedTuple) {
3070
3037
  const tupleMember = element;
3071
3038
  const name = tupleMember.label?.name || `arg${index}`;
3072
3039
  let innerType = tupleMember.elementType;
3073
3040
  let optional = tupleMember.optional;
3074
- if (t27.isTSOptionalType(innerType)) {
3041
+ if (t26.isTSOptionalType(innerType)) {
3075
3042
  optional = true;
3076
3043
  innerType = innerType.typeAnnotation;
3077
3044
  }
3078
- if (t27.isTSRestType(innerType)) {
3079
- const rest = t27.restElement(t27.identifier(name));
3080
- 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);
3081
3048
  return rest;
3082
3049
  }
3083
- const id2 = t27.identifier(name);
3050
+ const id2 = t26.identifier(name);
3084
3051
  id2.optional = optional;
3085
- id2.typeAnnotation = t27.tsTypeAnnotation(innerType);
3052
+ id2.typeAnnotation = t26.tsTypeAnnotation(innerType);
3086
3053
  return id2;
3087
3054
  }
3088
- if (t27.isTSRestType(element)) {
3089
- const rest = t27.restElement(t27.identifier(`args${index}`));
3090
- 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);
3091
3058
  return rest;
3092
3059
  }
3093
- if (t27.isTSOptionalType(element)) {
3094
- const id2 = t27.identifier(`arg${index}`);
3060
+ if (t26.isTSOptionalType(element)) {
3061
+ const id2 = t26.identifier(`arg${index}`);
3095
3062
  id2.optional = true;
3096
- id2.typeAnnotation = t27.tsTypeAnnotation(element.typeAnnotation);
3063
+ id2.typeAnnotation = t26.tsTypeAnnotation(element.typeAnnotation);
3097
3064
  return id2;
3098
3065
  }
3099
- const id = t27.identifier(`arg${index}`);
3100
- id.typeAnnotation = t27.tsTypeAnnotation(element);
3066
+ const id = t26.identifier(`arg${index}`);
3067
+ id.typeAnnotation = t26.tsTypeAnnotation(element);
3101
3068
  return id;
3102
3069
  }
3103
3070
 
3104
3071
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-props-interface/resolve-props.ts
3105
- import * as t28 from "@babel/types";
3072
+ import * as t27 from "@babel/types";
3106
3073
  function resolveDefinePropsIface(path9, ctx) {
3107
3074
  const { node } = path9;
3108
3075
  const [runtimeArg] = node.arguments;
@@ -3122,38 +3089,38 @@ function processInferredTypes2(ctx, runtimeArg) {
3122
3089
  } = scriptData;
3123
3090
  if (!runtimeArg) return;
3124
3091
  const members = [];
3125
- if (t28.isArrayExpression(runtimeArg)) {
3092
+ if (t27.isArrayExpression(runtimeArg)) {
3126
3093
  for (const element of runtimeArg.elements) {
3127
- if (!element || !t28.isStringLiteral(element)) continue;
3128
- const key = t28.isValidIdentifier(element.value) ? t28.identifier(element.value) : t28.stringLiteral(element.value);
3129
- 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()));
3130
3097
  prop.optional = true;
3131
3098
  members.push(prop);
3132
3099
  }
3133
3100
  if (members.length) {
3134
- propsTypes.push(t28.tsTypeLiteral(members));
3101
+ propsTypes.push(t27.tsTypeLiteral(members));
3135
3102
  }
3136
3103
  return;
3137
3104
  }
3138
- if (t28.isObjectExpression(runtimeArg)) {
3105
+ if (t27.isObjectExpression(runtimeArg)) {
3139
3106
  for (const prop of runtimeArg.properties) {
3140
- if (!t28.isObjectProperty(prop)) continue;
3141
- if (t28.isSpreadElement(prop)) continue;
3107
+ if (!t27.isObjectProperty(prop)) continue;
3108
+ if (t27.isSpreadElement(prop)) continue;
3142
3109
  const key = prop.key;
3143
3110
  let propName = null;
3144
- if (t28.isIdentifier(key)) propName = key.name;
3145
- if (t28.isStringLiteral(key)) propName = key.value;
3146
- 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);
3147
3114
  if (!propName) continue;
3148
3115
  const { type, required } = resolveRuntimePropMeta(prop.value);
3149
- const tsType = type ?? t28.tsAnyKeyword();
3150
- const tsKey = t28.isValidIdentifier(propName) ? t28.identifier(propName) : t28.stringLiteral(propName);
3151
- const tsProp = t28.tsPropertySignature(tsKey, t28.tsTypeAnnotation(tsType));
3116
+ const tsType = type ?? t27.tsAnyKeyword();
3117
+ const tsKey = t27.isValidIdentifier(propName) ? t27.identifier(propName) : t27.stringLiteral(propName);
3118
+ const tsProp = t27.tsPropertySignature(tsKey, t27.tsTypeAnnotation(tsType));
3152
3119
  tsProp.optional = !required;
3153
3120
  members.push(tsProp);
3154
3121
  }
3155
3122
  if (members.length) {
3156
- propsTypes.push(t28.tsTypeLiteral(members));
3123
+ propsTypes.push(t27.tsTypeLiteral(members));
3157
3124
  }
3158
3125
  return;
3159
3126
  }
@@ -3167,42 +3134,42 @@ function processInferredTypes2(ctx, runtimeArg) {
3167
3134
  );
3168
3135
  }
3169
3136
  function resolveRuntimePropMeta(value) {
3170
- if (t28.isIdentifier(value)) {
3137
+ if (t27.isIdentifier(value)) {
3171
3138
  return {
3172
3139
  type: mapRuntimeTypeToTSType(value),
3173
3140
  required: false
3174
3141
  };
3175
3142
  }
3176
- if (t28.isArrayExpression(value)) {
3143
+ if (t27.isArrayExpression(value)) {
3177
3144
  return {
3178
3145
  type: resolveRuntimeUnionType(value),
3179
3146
  required: false
3180
3147
  };
3181
3148
  }
3182
- if (!t28.isObjectExpression(value)) {
3149
+ if (!t27.isObjectExpression(value)) {
3183
3150
  return { required: false };
3184
3151
  }
3185
3152
  let type;
3186
3153
  let required = false;
3187
3154
  for (const prop of value.properties) {
3188
- if (!t28.isObjectProperty(prop)) continue;
3189
- if (t28.isSpreadElement(prop)) continue;
3155
+ if (!t27.isObjectProperty(prop)) continue;
3156
+ if (t27.isSpreadElement(prop)) continue;
3190
3157
  const key = prop.key;
3191
- 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;
3192
3159
  if (!propName) continue;
3193
3160
  if (propName === "type") {
3194
3161
  const valueNode = prop.value;
3195
- if (t28.isArrayExpression(valueNode)) {
3162
+ if (t27.isArrayExpression(valueNode)) {
3196
3163
  type = resolveRuntimeUnionType(valueNode);
3197
3164
  continue;
3198
3165
  }
3199
- if (t28.isIdentifier(valueNode)) {
3166
+ if (t27.isIdentifier(valueNode)) {
3200
3167
  type = mapRuntimeTypeToTSType(valueNode);
3201
3168
  continue;
3202
3169
  }
3203
3170
  }
3204
3171
  if (propName === "required") {
3205
- if (t28.isBooleanLiteral(prop.value)) {
3172
+ if (t27.isBooleanLiteral(prop.value)) {
3206
3173
  required = prop.value.value;
3207
3174
  }
3208
3175
  }
@@ -3212,39 +3179,39 @@ function resolveRuntimePropMeta(value) {
3212
3179
  function resolveRuntimeUnionType(value) {
3213
3180
  const types = [];
3214
3181
  for (const element of value.elements) {
3215
- if (!element || !t28.isIdentifier(element)) continue;
3182
+ if (!element || !t27.isIdentifier(element)) continue;
3216
3183
  const resolved = mapRuntimeTypeToTSType(element);
3217
3184
  if (resolved) types.push(resolved);
3218
3185
  }
3219
- if (!types.length) return t28.tsAnyKeyword();
3186
+ if (!types.length) return t27.tsAnyKeyword();
3220
3187
  if (types.length === 1) return types[0];
3221
- return t28.tsUnionType(types);
3188
+ return t27.tsUnionType(types);
3222
3189
  }
3223
3190
  function mapRuntimeTypeToTSType(value) {
3224
3191
  switch (value.name) {
3225
3192
  case "String":
3226
- return t28.tsStringKeyword();
3193
+ return t27.tsStringKeyword();
3227
3194
  case "Number":
3228
- return t28.tsNumberKeyword();
3195
+ return t27.tsNumberKeyword();
3229
3196
  case "Boolean":
3230
- return t28.tsBooleanKeyword();
3197
+ return t27.tsBooleanKeyword();
3231
3198
  case "Object":
3232
- return t28.tsTypeLiteral([]);
3199
+ return t27.tsTypeLiteral([]);
3233
3200
  case "Array":
3234
- return t28.tsArrayType(t28.tsAnyKeyword());
3201
+ return t27.tsArrayType(t27.tsAnyKeyword());
3235
3202
  case "Function":
3236
- return t28.tsFunctionType(null, [], t28.tsTypeAnnotation(t28.tsAnyKeyword()));
3203
+ return t27.tsFunctionType(null, [], t27.tsTypeAnnotation(t27.tsAnyKeyword()));
3237
3204
  case "Symbol":
3238
- return t28.tsSymbolKeyword();
3205
+ return t27.tsSymbolKeyword();
3239
3206
  case "BigInt":
3240
- return t28.tsBigIntKeyword();
3207
+ return t27.tsBigIntKeyword();
3241
3208
  default:
3242
- return t28.tsAnyKeyword();
3209
+ return t27.tsAnyKeyword();
3243
3210
  }
3244
3211
  }
3245
3212
 
3246
3213
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-props-interface/resolve-slot.ts
3247
- import * as t29 from "@babel/types";
3214
+ import * as t28 from "@babel/types";
3248
3215
  var SLOT_DEFAULT_NAME = "default";
3249
3216
  var SLOT_CHILDREN_NAME = "children";
3250
3217
  var SLOT_FN_PARAM_NAME = "props";
@@ -3254,19 +3221,19 @@ function resolveSlotsTopLevelTypes(ctx) {
3254
3221
  }
3255
3222
  return {
3256
3223
  "TSInterfaceDeclaration|TSTypeAliasDeclaration"(path9) {
3257
- if (!t29.isProgram(path9.parent)) return;
3224
+ if (!t28.isProgram(path9.parent)) return;
3258
3225
  const { node } = path9;
3259
- if (t29.isTSInterfaceDeclaration(node)) {
3260
- const typeLiteral = t29.tsTypeLiteral(node.body.body);
3226
+ if (t28.isTSInterfaceDeclaration(node)) {
3227
+ const typeLiteral = t28.tsTypeLiteral(node.body.body);
3261
3228
  if (!hasSlotsSignatureInType(typeLiteral)) return;
3262
3229
  const resolved = resolveSlotType(typeLiteral);
3263
- if (resolved && t29.isTSTypeLiteral(resolved)) {
3230
+ if (resolved && t28.isTSTypeLiteral(resolved)) {
3264
3231
  node.body.body = resolved.members;
3265
3232
  recordReactNode(ctx);
3266
3233
  }
3267
3234
  return;
3268
3235
  }
3269
- if (t29.isTSTypeAliasDeclaration(node)) {
3236
+ if (t28.isTSTypeAliasDeclaration(node)) {
3270
3237
  if (!hasSlotsSignatureInType(node.typeAnnotation)) return;
3271
3238
  const resolved = resolveSlotType(node.typeAnnotation);
3272
3239
  if (resolved) {
@@ -3311,7 +3278,7 @@ function resolveTemplateSlotIface(ctx) {
3311
3278
  }
3312
3279
  if (tsMembers.length) {
3313
3280
  recordReactNode(ctx);
3314
- slotTypes.push(t29.tsTypeLiteral(tsMembers));
3281
+ slotTypes.push(t28.tsTypeLiteral(tsMembers));
3315
3282
  }
3316
3283
  }
3317
3284
  function recordReactNode(ctx) {
@@ -3321,32 +3288,32 @@ function recordReactNode(ctx) {
3321
3288
  recordImport(ctx, PACKAGE_NAME.react, REACT_API_MAP.ReactNode);
3322
3289
  }
3323
3290
  function resolveSlotType(tsType) {
3324
- if (t29.isTSParenthesizedType(tsType)) {
3291
+ if (t28.isTSParenthesizedType(tsType)) {
3325
3292
  return resolveSlotType(tsType.typeAnnotation);
3326
3293
  }
3327
- if (t29.isTSTypeReference(tsType)) {
3294
+ if (t28.isTSTypeReference(tsType)) {
3328
3295
  if (!tsType.typeParameters || !tsType.typeParameters.params.length) {
3329
3296
  return tsType;
3330
3297
  }
3331
3298
  const params = tsType.typeParameters.params.map((param) => resolveSlotType(param)).filter(Boolean);
3332
- return t29.tsTypeReference(
3299
+ return t28.tsTypeReference(
3333
3300
  tsType.typeName,
3334
- t29.tsTypeParameterInstantiation(params.length ? params : tsType.typeParameters.params)
3301
+ t28.tsTypeParameterInstantiation(params.length ? params : tsType.typeParameters.params)
3335
3302
  );
3336
3303
  }
3337
- if (t29.isTSIntersectionType(tsType)) {
3304
+ if (t28.isTSIntersectionType(tsType)) {
3338
3305
  const types = tsType.types.map(resolveSlotType).filter(Boolean);
3339
3306
  if (!types.length) return null;
3340
3307
  if (types.length === 1) return types[0];
3341
- return t29.tsIntersectionType(types);
3308
+ return t28.tsIntersectionType(types);
3342
3309
  }
3343
- if (t29.isTSUnionType(tsType)) {
3310
+ if (t28.isTSUnionType(tsType)) {
3344
3311
  const types = tsType.types.map(resolveSlotType).filter(Boolean);
3345
3312
  if (!types.length) return null;
3346
3313
  if (types.length === 1) return types[0];
3347
- return t29.tsUnionType(types);
3314
+ return t28.tsUnionType(types);
3348
3315
  }
3349
- if (t29.isTSTypeLiteral(tsType)) {
3316
+ if (t28.isTSTypeLiteral(tsType)) {
3350
3317
  const members = [];
3351
3318
  for (const member of tsType.members) {
3352
3319
  const resolved = resolveSlotPropFromMember(member);
@@ -3357,56 +3324,56 @@ function resolveSlotType(tsType) {
3357
3324
  members.push(member);
3358
3325
  }
3359
3326
  if (!members.length) return null;
3360
- return t29.tsTypeLiteral(members);
3327
+ return t28.tsTypeLiteral(members);
3361
3328
  }
3362
- if (t29.isTSFunctionType(tsType)) {
3329
+ if (t28.isTSFunctionType(tsType)) {
3363
3330
  const props = buildSlotPropSignature(
3364
3331
  SLOT_DEFAULT_NAME,
3365
3332
  cloneCallableParams(tsType.parameters),
3366
3333
  false
3367
3334
  );
3368
- return t29.tsTypeLiteral([props]);
3335
+ return t28.tsTypeLiteral([props]);
3369
3336
  }
3370
3337
  return tsType;
3371
3338
  }
3372
3339
  function hasSlotsSignatureInType(tsType) {
3373
- if (t29.isTSParenthesizedType(tsType)) {
3340
+ if (t28.isTSParenthesizedType(tsType)) {
3374
3341
  return hasSlotsSignatureInType(tsType.typeAnnotation);
3375
3342
  }
3376
- if (t29.isTSTypeReference(tsType)) {
3343
+ if (t28.isTSTypeReference(tsType)) {
3377
3344
  if (!tsType.typeParameters || !tsType.typeParameters.params.length) {
3378
3345
  return false;
3379
3346
  }
3380
3347
  return tsType.typeParameters.params.some(hasSlotsSignatureInType);
3381
3348
  }
3382
- if (t29.isTSIntersectionType(tsType) || t29.isTSUnionType(tsType)) {
3349
+ if (t28.isTSIntersectionType(tsType) || t28.isTSUnionType(tsType)) {
3383
3350
  return tsType.types.some(hasSlotsSignatureInType);
3384
3351
  }
3385
- if (t29.isTSTypeLiteral(tsType)) {
3352
+ if (t28.isTSTypeLiteral(tsType)) {
3386
3353
  return tsType.members.some(hasSlotsSignatureInMember);
3387
3354
  }
3388
- if (t29.isTSFunctionType(tsType)) {
3355
+ if (t28.isTSFunctionType(tsType)) {
3389
3356
  return true;
3390
3357
  }
3391
3358
  return false;
3392
3359
  }
3393
3360
  function hasSlotsSignatureInMember(member) {
3394
- if (t29.isTSMethodSignature(member)) return true;
3395
- if (t29.isTSCallSignatureDeclaration(member)) return true;
3396
- if (t29.isTSPropertySignature(member)) {
3361
+ if (t28.isTSMethodSignature(member)) return true;
3362
+ if (t28.isTSCallSignatureDeclaration(member)) return true;
3363
+ if (t28.isTSPropertySignature(member)) {
3397
3364
  const typeAnnotation = member.typeAnnotation?.typeAnnotation;
3398
3365
  return !!(typeAnnotation && resolveCallableType(typeAnnotation));
3399
3366
  }
3400
3367
  return false;
3401
3368
  }
3402
3369
  function resolveSlotPropFromMember(member) {
3403
- if (t29.isTSMethodSignature(member)) {
3370
+ if (t28.isTSMethodSignature(member)) {
3404
3371
  const rawName = resolvePropName2(member.key);
3405
3372
  if (!rawName) return null;
3406
3373
  const params = cloneCallableParams(member.parameters);
3407
3374
  return buildSlotPropSignature(rawName, params, !!member.optional);
3408
3375
  }
3409
- if (t29.isTSPropertySignature(member)) {
3376
+ if (t28.isTSPropertySignature(member)) {
3410
3377
  const rawName = resolvePropName2(member.key);
3411
3378
  if (!rawName) return null;
3412
3379
  const typeAnnotation = member.typeAnnotation?.typeAnnotation;
@@ -3415,53 +3382,53 @@ function resolveSlotPropFromMember(member) {
3415
3382
  const params = cloneCallableParams(callable.parameters);
3416
3383
  return buildSlotPropSignature(rawName, params, !!member.optional);
3417
3384
  }
3418
- if (t29.isTSCallSignatureDeclaration(member)) {
3385
+ if (t28.isTSCallSignatureDeclaration(member)) {
3419
3386
  const params = cloneCallableParams(member.parameters);
3420
3387
  return buildSlotPropSignature(SLOT_DEFAULT_NAME, params, true);
3421
3388
  }
3422
3389
  return null;
3423
3390
  }
3424
3391
  function resolveCallableType(tsType) {
3425
- if (t29.isTSFunctionType(tsType)) return tsType;
3426
- if (t29.isTSParenthesizedType(tsType)) return resolveCallableType(tsType.typeAnnotation);
3392
+ if (t28.isTSFunctionType(tsType)) return tsType;
3393
+ if (t28.isTSParenthesizedType(tsType)) return resolveCallableType(tsType.typeAnnotation);
3427
3394
  return null;
3428
3395
  }
3429
3396
  function buildSlotPropSignature(rawName, params, optional) {
3430
3397
  const propName = rawName === SLOT_DEFAULT_NAME ? SLOT_CHILDREN_NAME : rawName;
3431
- const key = t29.isValidIdentifier(propName) ? t29.identifier(propName) : t29.stringLiteral(propName);
3432
- const reactNodeType = t29.tsTypeAnnotation(
3433
- 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))
3434
3401
  );
3435
3402
  let typeAnnotation;
3436
3403
  if (rawName === SLOT_DEFAULT_NAME && params.length === 0 || params.length === 0) {
3437
3404
  typeAnnotation = reactNodeType;
3438
3405
  } else {
3439
- const fnType = t29.tsFunctionType(null, params, reactNodeType);
3440
- typeAnnotation = t29.tsTypeAnnotation(fnType);
3406
+ const fnType = t28.tsFunctionType(null, params, reactNodeType);
3407
+ typeAnnotation = t28.tsTypeAnnotation(fnType);
3441
3408
  }
3442
- const prop = t29.tsPropertySignature(key, typeAnnotation);
3409
+ const prop = t28.tsPropertySignature(key, typeAnnotation);
3443
3410
  prop.optional = optional;
3444
3411
  return prop;
3445
3412
  }
3446
3413
  function createSlotScopeParam(props, ctx) {
3447
- const paramId = t29.identifier(SLOT_FN_PARAM_NAME);
3414
+ const paramId = t28.identifier(SLOT_FN_PARAM_NAME);
3448
3415
  const propsSigns = [];
3449
3416
  const { reactiveBindings } = ctx.templateData;
3450
3417
  props.forEach(({ prop, tsType }) => {
3451
3418
  const foundBindingValue = reactiveBindings[prop]?.value;
3452
3419
  const foundBindingTypes = foundBindingValue ? expressionToTSType(foundBindingValue) : null;
3453
- const typeAnnotation = foundBindingTypes ? t29.tsTypeAnnotation(foundBindingTypes) : tsType;
3454
- const key = t29.isValidIdentifier(prop) ? t29.identifier(prop) : t29.stringLiteral(prop);
3455
- 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);
3456
3423
  propsSigns.push(propSign);
3457
3424
  });
3458
- paramId.typeAnnotation = t29.tsTypeAnnotation(t29.tsTypeLiteral(propsSigns));
3425
+ paramId.typeAnnotation = t28.tsTypeAnnotation(t28.tsTypeLiteral(propsSigns));
3459
3426
  return paramId;
3460
3427
  }
3461
3428
  function resolvePropName2(key) {
3462
- if (t29.isIdentifier(key)) return key.name;
3463
- if (t29.isStringLiteral(key)) return key.value;
3464
- 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);
3465
3432
  return null;
3466
3433
  }
3467
3434
 
@@ -3513,9 +3480,9 @@ function resolveCompIProps(ctx, ast) {
3513
3480
  }
3514
3481
  const n = ctx.compName || "Comp";
3515
3482
  const ns = `I${camelCase(capitalize(n))}Props`;
3516
- const typeNode = t30.tsIntersectionType(tsTypes);
3517
- const typeAliasDecl = t30.tsTypeAliasDeclaration(t30.identifier(ns), null, typeNode);
3518
- 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);
3519
3486
  propsTSIface.name = ns;
3520
3487
  const scriptIR = getScriptIR(ctx);
3521
3488
  scriptIR.exports.push(exportDecl);
@@ -3523,17 +3490,17 @@ function resolveCompIProps(ctx, ast) {
3523
3490
  }
3524
3491
 
3525
3492
  // src/core/transform/sfc/script/syntax-processor/process/resolve-analysis-only-adapter.ts
3526
- import * as t32 from "@babel/types";
3493
+ import * as t31 from "@babel/types";
3527
3494
 
3528
3495
  // src/core/transform/sfc/script/shared/dependency-analyzer.ts
3529
3496
  import { traverse as traverse2 } from "@babel/core";
3530
- import * as t31 from "@babel/types";
3497
+ import * as t30 from "@babel/types";
3531
3498
  var TRACE_MAX_DEPTH = 20;
3532
3499
  function analyzeDeps(node, ctx, parentPath) {
3533
3500
  if (!parentPath) {
3534
- return t31.arrayExpression([]);
3501
+ return t30.arrayExpression([]);
3535
3502
  }
3536
- const isFnExpr = t31.isArrowFunctionExpression(node) || t31.isFunctionExpression(node);
3503
+ const isFnExpr = t30.isArrowFunctionExpression(node) || t30.isFunctionExpression(node);
3537
3504
  const analyzeTarget = isFnExpr ? node.body : node;
3538
3505
  const bindingLocalBoundary = isFnExpr ? node : analyzeTarget;
3539
3506
  const reactiveStateApis = getReactiveStateApis();
@@ -3544,13 +3511,13 @@ function analyzeDeps(node, ctx, parentPath) {
3544
3511
  }
3545
3512
  const analyzeTargetPath = parentPath && parentPath.node === analyzeTarget ? parentPath : null;
3546
3513
  if (analyzeTargetPath) {
3547
- if (t31.isMemberExpression(analyzeTarget) || t31.isOptionalMemberExpression(analyzeTarget)) {
3514
+ if (t30.isMemberExpression(analyzeTarget) || t30.isOptionalMemberExpression(analyzeTarget)) {
3548
3515
  const rootId = findRootIdentifier(analyzeTarget);
3549
3516
  if (rootId) {
3550
3517
  tryAddDependency(analyzeTargetPath, rootId.name, analyzeTargetPath.scope);
3551
3518
  processedIdentifiers.add(rootId);
3552
3519
  }
3553
- } else if (t31.isIdentifier(analyzeTarget)) {
3520
+ } else if (t30.isIdentifier(analyzeTarget)) {
3554
3521
  tryAddDependency(analyzeTargetPath, analyzeTarget.name, analyzeTargetPath.scope);
3555
3522
  }
3556
3523
  }
@@ -3601,55 +3568,55 @@ function analyzeDeps(node, ctx, parentPath) {
3601
3568
  }
3602
3569
  }
3603
3570
  function normalizeDependencyExpr(path9, rootName) {
3604
- if (t31.isIdentifier(path9.node)) {
3605
- return t31.identifier(path9.node.name);
3571
+ if (t30.isIdentifier(path9.node)) {
3572
+ return t30.identifier(path9.node.name);
3606
3573
  }
3607
- if (t31.isMemberExpression(path9.node) || t31.isOptionalMemberExpression(path9.node)) {
3574
+ if (t30.isMemberExpression(path9.node) || t30.isOptionalMemberExpression(path9.node)) {
3608
3575
  const normalizedExp = normalizeMemberForCallSite(path9, path9.node);
3609
- const safeExp = t31.isMemberExpression(normalizedExp) || t31.isOptionalMemberExpression(normalizedExp) ? ensureOptionalForMemberChain(normalizedExp) : normalizedExp;
3576
+ const safeExp = t30.isMemberExpression(normalizedExp) || t30.isOptionalMemberExpression(normalizedExp) ? ensureOptionalForMemberChain(normalizedExp) : normalizedExp;
3610
3577
  if (isReactValidDependencyExpr(safeExp)) {
3611
- return t31.cloneNode(safeExp, true);
3578
+ return t30.cloneNode(safeExp, true);
3612
3579
  }
3613
- return t31.identifier(rootName);
3580
+ return t30.identifier(rootName);
3614
3581
  }
3615
3582
  return null;
3616
3583
  }
3617
3584
  function normalizeSourcedDependency(exp) {
3618
- if (t31.isIdentifier(exp)) {
3619
- return t31.identifier(exp.name);
3585
+ if (t30.isIdentifier(exp)) {
3586
+ return t30.identifier(exp.name);
3620
3587
  }
3621
- if (t31.isMemberExpression(exp) || t31.isOptionalMemberExpression(exp)) {
3588
+ if (t30.isMemberExpression(exp) || t30.isOptionalMemberExpression(exp)) {
3622
3589
  const root = findRootIdentifier(exp);
3623
3590
  if (!root) return null;
3624
- const safeExp = t31.isMemberExpression(exp) || t31.isOptionalMemberExpression(exp) ? ensureOptionalForMemberChain(exp) : exp;
3591
+ const safeExp = t30.isMemberExpression(exp) || t30.isOptionalMemberExpression(exp) ? ensureOptionalForMemberChain(exp) : exp;
3625
3592
  if (isReactValidDependencyExpr(safeExp)) {
3626
- return t31.cloneNode(safeExp, true);
3593
+ return t30.cloneNode(safeExp, true);
3627
3594
  }
3628
- return t31.identifier(root.name);
3595
+ return t30.identifier(root.name);
3629
3596
  }
3630
3597
  return null;
3631
3598
  }
3632
3599
  function isReactValidDependencyExpr(node2) {
3633
- if (t31.isIdentifier(node2)) {
3600
+ if (t30.isIdentifier(node2)) {
3634
3601
  return true;
3635
3602
  }
3636
- if (t31.isMemberExpression(node2) || t31.isOptionalMemberExpression(node2)) {
3603
+ if (t30.isMemberExpression(node2) || t30.isOptionalMemberExpression(node2)) {
3637
3604
  return isStaticMemberChain(node2);
3638
3605
  }
3639
3606
  return false;
3640
3607
  }
3641
3608
  function isStaticMemberChain(node2) {
3642
3609
  let current = node2;
3643
- while (t31.isMemberExpression(current) || t31.isOptionalMemberExpression(current)) {
3644
- if (!current.computed && !t31.isIdentifier(current.property)) {
3610
+ while (t30.isMemberExpression(current) || t30.isOptionalMemberExpression(current)) {
3611
+ if (!current.computed && !t30.isIdentifier(current.property)) {
3645
3612
  return false;
3646
3613
  }
3647
- if (current.computed && !t31.isStringLiteral(current.property) && !t31.isNumericLiteral(current.property)) {
3614
+ if (current.computed && !t30.isStringLiteral(current.property) && !t30.isNumericLiteral(current.property)) {
3648
3615
  return false;
3649
3616
  }
3650
3617
  current = current.object;
3651
3618
  }
3652
- return t31.isIdentifier(current);
3619
+ return t30.isIdentifier(current);
3653
3620
  }
3654
3621
  function isBindingDeclaredInsideBoundary(binding, boundary) {
3655
3622
  let current = binding.path;
@@ -3667,7 +3634,7 @@ function analyzeDeps(node, ctx, parentPath) {
3667
3634
  if (!isDirectCallee) {
3668
3635
  return node2;
3669
3636
  }
3670
- if (!t31.isExpression(node2.object)) {
3637
+ if (!t30.isExpression(node2.object)) {
3671
3638
  return node2;
3672
3639
  }
3673
3640
  return node2.object;
@@ -3676,15 +3643,15 @@ function analyzeDeps(node, ctx, parentPath) {
3676
3643
  if (!hasTrailingMemberAccess(node2)) {
3677
3644
  return node2;
3678
3645
  }
3679
- if (t31.isOptionalMemberExpression(node2) && node2.optional) {
3646
+ if (t30.isOptionalMemberExpression(node2) && node2.optional) {
3680
3647
  return node2;
3681
3648
  }
3682
- const object = t31.cloneNode(node2.object, true);
3683
- const property = t31.cloneNode(node2.property, true);
3684
- 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);
3685
3652
  }
3686
3653
  function hasTrailingMemberAccess(node2) {
3687
- return t31.isMemberExpression(node2.object) || t31.isOptionalMemberExpression(node2.object);
3654
+ return t30.isMemberExpression(node2.object) || t30.isOptionalMemberExpression(node2.object);
3688
3655
  }
3689
3656
  function isEligibleBindingSource(binding) {
3690
3657
  if (binding.kind === "param") {
@@ -3694,17 +3661,17 @@ function analyzeDeps(node, ctx, parentPath) {
3694
3661
  const declaratorPath = getVariableDeclaratorPath(bindingPath);
3695
3662
  const isReactiveVarBinding = !!declaratorPath && isReactiveBinding(declaratorPath.node);
3696
3663
  const nodeInit = declaratorPath?.node.init;
3697
- const isReactiveApiCallVarBinding = !!declaratorPath && t31.isCallExpression(nodeInit) && t31.isIdentifier(nodeInit.callee) && reactiveStateApis.has(nodeInit.callee.name);
3698
- const isHookCallVarBinding = !!declaratorPath && t31.isCallExpression(nodeInit) && isHookLikeCallee(nodeInit.callee);
3699
- 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));
3700
3667
  const isReactiveFunctionBinding = isFunctionBinding && (isReactiveBinding(declaratorPath?.node) || isReactiveBinding(bindingPath.node));
3701
3668
  return isReactiveVarBinding || isReactiveApiCallVarBinding || isHookCallVarBinding || isReactiveFunctionBinding;
3702
3669
  }
3703
3670
  function isHookLikeCallee(callee) {
3704
- if (t31.isIdentifier(callee)) {
3671
+ if (t30.isIdentifier(callee)) {
3705
3672
  return callee.name.startsWith("use");
3706
3673
  }
3707
- if (t31.isMemberExpression(callee) && !callee.computed && t31.isIdentifier(callee.property)) {
3674
+ if (t30.isMemberExpression(callee) && !callee.computed && t30.isIdentifier(callee.property)) {
3708
3675
  return callee.property.name.startsWith("use");
3709
3676
  }
3710
3677
  return false;
@@ -3720,7 +3687,7 @@ function analyzeDeps(node, ctx, parentPath) {
3720
3687
  }
3721
3688
  function isExpressionSourcedFromEligibleBinding(exp, scope, seen, depth) {
3722
3689
  if (depth <= 0) return null;
3723
- if (t31.isIdentifier(exp)) {
3690
+ if (t30.isIdentifier(exp)) {
3724
3691
  const sourceBinding = scope.getBinding(exp.name);
3725
3692
  if (!sourceBinding) return null;
3726
3693
  if (isEligibleBindingSource(sourceBinding)) {
@@ -3728,13 +3695,13 @@ function analyzeDeps(node, ctx, parentPath) {
3728
3695
  }
3729
3696
  return traceBindingSource(sourceBinding, seen, depth - 1);
3730
3697
  }
3731
- if (t31.isMemberExpression(exp) || t31.isOptionalMemberExpression(exp)) {
3698
+ if (t30.isMemberExpression(exp) || t30.isOptionalMemberExpression(exp)) {
3732
3699
  const root = findRootIdentifier(exp);
3733
3700
  if (!root) return null;
3734
3701
  const sourceBinding = scope.getBinding(root.name);
3735
3702
  if (!sourceBinding) return null;
3736
3703
  if (isEligibleBindingSource(sourceBinding)) {
3737
- return t31.cloneNode(exp);
3704
+ return t30.cloneNode(exp);
3738
3705
  }
3739
3706
  const sourcedRoot = traceBindingSource(sourceBinding, seen, depth - 1);
3740
3707
  if (sourcedRoot) {
@@ -3742,17 +3709,17 @@ function analyzeDeps(node, ctx, parentPath) {
3742
3709
  if (rebuilt) {
3743
3710
  return rebuilt;
3744
3711
  }
3745
- return t31.cloneNode(sourcedRoot, true);
3712
+ return t30.cloneNode(sourcedRoot, true);
3746
3713
  }
3747
3714
  }
3748
3715
  return null;
3749
3716
  }
3750
3717
  function rebuildMemberWithNewRoot(node2, nextRoot) {
3751
3718
  const replacedObject = (() => {
3752
- if (t31.isIdentifier(node2.object)) {
3753
- return t31.cloneNode(nextRoot, true);
3719
+ if (t30.isIdentifier(node2.object)) {
3720
+ return t30.cloneNode(nextRoot, true);
3754
3721
  }
3755
- if (t31.isMemberExpression(node2.object) || t31.isOptionalMemberExpression(node2.object)) {
3722
+ if (t30.isMemberExpression(node2.object) || t30.isOptionalMemberExpression(node2.object)) {
3756
3723
  return rebuildMemberWithNewRoot(node2.object, nextRoot);
3757
3724
  }
3758
3725
  return null;
@@ -3760,34 +3727,34 @@ function analyzeDeps(node, ctx, parentPath) {
3760
3727
  if (!replacedObject) {
3761
3728
  return null;
3762
3729
  }
3763
- const property = t31.cloneNode(node2.property, true);
3764
- if (t31.isMemberExpression(node2)) {
3765
- return t31.memberExpression(
3730
+ const property = t30.cloneNode(node2.property, true);
3731
+ if (t30.isMemberExpression(node2)) {
3732
+ return t30.memberExpression(
3766
3733
  replacedObject,
3767
3734
  property,
3768
3735
  node2.computed
3769
3736
  );
3770
3737
  }
3771
- return t31.optionalMemberExpression(
3738
+ return t30.optionalMemberExpression(
3772
3739
  replacedObject,
3773
3740
  property,
3774
3741
  node2.computed,
3775
3742
  node2.optional
3776
3743
  );
3777
3744
  }
3778
- return t31.arrayExpression(Array.from(deps.values()));
3745
+ return t30.arrayExpression(Array.from(deps.values()));
3779
3746
  }
3780
3747
  function getDependencyKey(exp) {
3781
- if (t31.isIdentifier(exp)) {
3748
+ if (t30.isIdentifier(exp)) {
3782
3749
  return exp.name;
3783
3750
  }
3784
- if (t31.isMemberExpression(exp) || t31.isOptionalMemberExpression(exp)) {
3751
+ if (t30.isMemberExpression(exp) || t30.isOptionalMemberExpression(exp)) {
3785
3752
  const objectKey = getDependencyKey(exp.object);
3786
3753
  const opt = exp.optional ? "?" : "";
3787
- if (!exp.computed && t31.isIdentifier(exp.property)) {
3754
+ if (!exp.computed && t30.isIdentifier(exp.property)) {
3788
3755
  return `${objectKey}${opt}.${exp.property.name}`;
3789
3756
  }
3790
- if (t31.isStringLiteral(exp.property) || t31.isNumericLiteral(exp.property)) {
3757
+ if (t30.isStringLiteral(exp.property) || t30.isNumericLiteral(exp.property)) {
3791
3758
  return `${objectKey}${opt}[${JSON.stringify(exp.property.value)}]`;
3792
3759
  }
3793
3760
  return `${objectKey}${opt}[*]`;
@@ -3820,7 +3787,7 @@ function resolveAnalysisOnlyAdapter(ctx) {
3820
3787
  if (!isVueApiReference(path9, apiName)) {
3821
3788
  return;
3822
3789
  }
3823
- if (t32.isCallExpression(node)) {
3790
+ if (t31.isCallExpression(node)) {
3824
3791
  resolveCallNode(path9, adapter, ctx);
3825
3792
  } else {
3826
3793
  replaceIdName(node, adapter.target);
@@ -3830,11 +3797,11 @@ function resolveAnalysisOnlyAdapter(ctx) {
3830
3797
  };
3831
3798
  }
3832
3799
  function getApiName(node) {
3833
- const isCallNode = t32.isCallExpression(node);
3800
+ const isCallNode = t31.isCallExpression(node);
3834
3801
  let apiName = "";
3835
- if (t32.isIdentifier(node)) {
3802
+ if (t31.isIdentifier(node)) {
3836
3803
  apiName = node.name;
3837
- } else if (isCallNode && t32.isIdentifier(node.callee)) {
3804
+ } else if (isCallNode && t31.isIdentifier(node.callee)) {
3838
3805
  apiName = node.callee.name;
3839
3806
  }
3840
3807
  return apiName;
@@ -3844,7 +3811,7 @@ function resolveCallNode(path9, adapter, ctx) {
3844
3811
  const { arguments: args } = node;
3845
3812
  if (!args.length) return;
3846
3813
  const fn = args[0];
3847
- if (!t32.isArrowFunctionExpression(fn) && !t32.isFunctionExpression(fn)) {
3814
+ if (!t31.isArrowFunctionExpression(fn) && !t31.isFunctionExpression(fn)) {
3848
3815
  return;
3849
3816
  }
3850
3817
  const fnPath = path9.get("arguments")[0];
@@ -3876,7 +3843,7 @@ function isVueImportBinding(binding) {
3876
3843
  return false;
3877
3844
  }
3878
3845
  const parent = bindingPath.parentPath?.node;
3879
- if (!parent || !t32.isImportDeclaration(parent)) {
3846
+ if (!parent || !t31.isImportDeclaration(parent)) {
3880
3847
  return false;
3881
3848
  }
3882
3849
  const source = parent.source.value.toLowerCase();
@@ -3944,7 +3911,7 @@ function isSkip(path9) {
3944
3911
  }
3945
3912
 
3946
3913
  // src/core/transform/sfc/script/syntax-processor/process/resolve-element-ref.ts
3947
- import * as t33 from "@babel/types";
3914
+ import * as t32 from "@babel/types";
3948
3915
  function resolveElementRef(ctx) {
3949
3916
  return {
3950
3917
  CallExpression(path9) {
@@ -3962,14 +3929,14 @@ function resolveElementRef(ctx) {
3962
3929
  }
3963
3930
  if (isCompRefBindings) {
3964
3931
  const varDeclaratorPath = getVariableDeclaratorPath(path9)?.node;
3965
- if (!t33.isIdentifier(varDeclaratorPath?.id)) {
3932
+ if (!t32.isIdentifier(varDeclaratorPath?.id)) {
3966
3933
  return;
3967
3934
  }
3968
3935
  const varName = varDeclaratorPath.id.name;
3969
3936
  const compRef = refBindings.componentRefs[varName];
3970
3937
  if (!compRef) return;
3971
3938
  }
3972
- node.arguments[0] = t33.identifier("null");
3939
+ node.arguments[0] = t32.identifier("null");
3973
3940
  resolveTypeParameters(ctx, path9);
3974
3941
  replaceCallName(node, REACT_API_MAP.useRef);
3975
3942
  recordImport(ctx, PACKAGE_NAME.react, REACT_API_MAP.useRef);
@@ -3994,27 +3961,27 @@ function resolveTypeParameters(ctx, path9) {
3994
3961
  const compBindingMeta = refBindings.componentRefs[idName];
3995
3962
  if (!node.typeParameters && (domBindingMeta || compBindingMeta)) {
3996
3963
  const type = compBindingMeta ? "any" : domBindingMeta.htmlType;
3997
- node.typeParameters = t33.tsTypeParameterInstantiation([t33.tsTypeReference(t33.identifier(type))]);
3964
+ node.typeParameters = t32.tsTypeParameterInstantiation([t32.tsTypeReference(t32.identifier(type))]);
3998
3965
  }
3999
3966
  }
4000
3967
  function resolveRefValueToCurrent(path9) {
4001
3968
  const { node } = path9;
4002
- if (node.computed || !t33.isIdentifier(node.property) || node.property.name !== "value") {
3969
+ if (node.computed || !t32.isIdentifier(node.property) || node.property.name !== "value") {
4003
3970
  return;
4004
3971
  }
4005
3972
  const rootPath = findRootVariablePath(path9);
4006
- if (!rootPath?.node || !t33.isCallExpression(rootPath.node.init) || !isCalleeNamed(rootPath.node.init, REACT_API_MAP.useRef)) {
3973
+ if (!rootPath?.node || !t32.isCallExpression(rootPath.node.init) || !isCalleeNamed(rootPath.node.init, REACT_API_MAP.useRef)) {
4007
3974
  return;
4008
3975
  }
4009
3976
  const rootId = findRootIdentifier(node);
4010
- if (!t33.isIdentifier(node.object) || node.object.name !== rootId?.name) {
3977
+ if (!t32.isIdentifier(node.object) || node.object.name !== rootId?.name) {
4011
3978
  return;
4012
3979
  }
4013
3980
  node.property.name = "current";
4014
3981
  }
4015
3982
 
4016
3983
  // src/core/transform/sfc/script/syntax-processor/process/resolve-expression-memo.ts
4017
- import * as t34 from "@babel/types";
3984
+ import * as t33 from "@babel/types";
4018
3985
  function resolveExprMemo(ctx, ast) {
4019
3986
  const isScriptFile = ctx.inputType !== "sfc";
4020
3987
  return {
@@ -4026,11 +3993,11 @@ function resolveExprMemo(ctx, ast) {
4026
3993
  if (!atComponentOrHookRoot(path9, ast.program, isScriptFile)) {
4027
3994
  return false;
4028
3995
  }
4029
- if (!t34.isVariableDeclaration(path9.parent) || path9.parent.kind !== "const") {
3996
+ if (!t33.isVariableDeclaration(path9.parent) || path9.parent.kind !== "const") {
4030
3997
  return false;
4031
3998
  }
4032
- if (t34.isFunction(init)) return false;
4033
- 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")) {
4034
4001
  return false;
4035
4002
  }
4036
4003
  return true;
@@ -4048,16 +4015,16 @@ function resolveExprMemo(ctx, ast) {
4048
4015
  }
4049
4016
 
4050
4017
  // src/core/transform/sfc/script/syntax-processor/process/resolve-lint-rules.ts
4051
- import * as t35 from "@babel/types";
4018
+ import * as t34 from "@babel/types";
4052
4019
  function resolveLintRules(ctx, ast) {
4053
4020
  const inScriptFile = ctx.inputType !== "sfc";
4054
4021
  return {
4055
4022
  CallExpression(path9) {
4056
4023
  const { node, parentPath } = path9;
4057
- if (!t35.isIdentifier(node.callee)) return;
4024
+ if (!t34.isIdentifier(node.callee)) return;
4058
4025
  const { name: callName } = node.callee;
4059
- const addLog = (t41) => {
4060
- logger.error(t41, {
4026
+ const addLog = (t40) => {
4027
+ logger.error(t40, {
4061
4028
  file: ctx.filename,
4062
4029
  source: ctx.scriptData.source,
4063
4030
  loc: node.loc
@@ -4101,8 +4068,8 @@ function resolveLintRules(ctx, ast) {
4101
4068
  }
4102
4069
 
4103
4070
  // src/core/transform/sfc/script/syntax-processor/process/resolve-provide.ts
4104
- import { generate as generate3 } from "@babel/generator";
4105
- import * as t36 from "@babel/types";
4071
+ import { generate as generate2 } from "@babel/generator";
4072
+ import * as t35 from "@babel/types";
4106
4073
  function resolveProvide(ctx) {
4107
4074
  if (ctx.inputType === "style") return {};
4108
4075
  return {
@@ -4134,17 +4101,17 @@ function findOrCreateCtxProvider(root) {
4134
4101
  function assignProviderValue(target, key, value) {
4135
4102
  const getRawExp = (exp) => {
4136
4103
  if (!exp) return "''";
4137
- if (t36.isStringLiteral(exp)) {
4104
+ if (t35.isStringLiteral(exp)) {
4138
4105
  return JSON.stringify(exp.value);
4139
4106
  }
4140
- if (t36.isNumericLiteral(exp)) {
4107
+ if (t35.isNumericLiteral(exp)) {
4141
4108
  return exp.value.toString();
4142
4109
  }
4143
- if (t36.isIdentifier(exp)) {
4110
+ if (t35.isIdentifier(exp)) {
4144
4111
  return exp.name;
4145
4112
  }
4146
4113
  try {
4147
- return generate3(exp).code;
4114
+ return generate2(exp).code;
4148
4115
  } catch {
4149
4116
  return "null";
4150
4117
  }
@@ -4156,16 +4123,16 @@ function assignProviderValue(target, key, value) {
4156
4123
  }
4157
4124
 
4158
4125
  // src/core/transform/sfc/script/syntax-processor/process/resolve-rename-adapter.ts
4159
- import * as t37 from "@babel/types";
4126
+ import * as t36 from "@babel/types";
4160
4127
  function resolveRenameAdapter(ctx) {
4161
4128
  return {
4162
4129
  "CallExpression|Identifier"(path9) {
4163
4130
  const node = path9.node;
4164
- const isCallNode = t37.isCallExpression(node);
4131
+ const isCallNode = t36.isCallExpression(node);
4165
4132
  let apiName = "";
4166
- if (t37.isIdentifier(node)) {
4133
+ if (t36.isIdentifier(node)) {
4167
4134
  apiName = node.name;
4168
- } else if (isCallNode && t37.isIdentifier(node.callee)) {
4135
+ } else if (isCallNode && t36.isIdentifier(node.callee)) {
4169
4136
  apiName = node.callee.name;
4170
4137
  }
4171
4138
  if (!apiName) {
@@ -4223,7 +4190,7 @@ function isVueImportBinding2(binding) {
4223
4190
  return false;
4224
4191
  }
4225
4192
  const parent = bindingPath.parentPath?.node;
4226
- if (!parent || !t37.isImportDeclaration(parent)) {
4193
+ if (!parent || !t36.isImportDeclaration(parent)) {
4227
4194
  return false;
4228
4195
  }
4229
4196
  const source = parent.source.value.toLowerCase();
@@ -4266,8 +4233,8 @@ function processVueSyntax2(ast, ctx) {
4266
4233
  excludeBabel: [resolveTemplateSlotIface, resolveCompIProps]
4267
4234
  },
4268
4235
  postprocess: {
4269
- applyBabel: [resolveRequiredImports, resolveStaticHoisting],
4270
- excludeBabel: [insertCSSImport, collectLocalStatements]
4236
+ applyBabel: [resolveRuntimeImports, resolveASTChunks],
4237
+ excludeBabel: [resolveSfcCssImport]
4271
4238
  }
4272
4239
  });
4273
4240
  }
@@ -4359,15 +4326,15 @@ function isRouterLinkBooleanCustomProp(prop) {
4359
4326
  }
4360
4327
 
4361
4328
  // src/core/transform/sfc/template/shared/prop-ir-utils.ts
4362
- import * as t39 from "@babel/types";
4329
+ import * as t38 from "@babel/types";
4363
4330
 
4364
4331
  // src/shared/string-code-types.ts
4365
4332
  import { parseExpression as parseExpression3 } from "@babel/parser";
4366
- import * as t38 from "@babel/types";
4333
+ import * as t37 from "@babel/types";
4367
4334
  var strCodeTypes = {
4368
- isIdentifier: isIdentifier20,
4335
+ isIdentifier: isIdentifier19,
4369
4336
  isSimpleExpression,
4370
- isStringLiteral: isStringLiteral12
4337
+ isStringLiteral: isStringLiteral11
4371
4338
  };
4372
4339
  function isSimpleExpression(code, excludeVar = false) {
4373
4340
  let node;
@@ -4376,38 +4343,38 @@ function isSimpleExpression(code, excludeVar = false) {
4376
4343
  } catch {
4377
4344
  return false;
4378
4345
  }
4379
- if (t38.isLiteral(node)) {
4346
+ if (t37.isLiteral(node)) {
4380
4347
  return true;
4381
4348
  }
4382
- if (!excludeVar && t38.isIdentifier(node)) {
4349
+ if (!excludeVar && t37.isIdentifier(node)) {
4383
4350
  return true;
4384
4351
  }
4385
- if (t38.isMemberExpression(node)) {
4386
- return isSimpleExpression(node.object) && t38.isIdentifier(node.property);
4352
+ if (t37.isMemberExpression(node)) {
4353
+ return isSimpleExpression(node.object) && t37.isIdentifier(node.property);
4387
4354
  }
4388
- if (t38.isObjectExpression(node) || t38.isArrayExpression(node)) {
4355
+ if (t37.isObjectExpression(node) || t37.isArrayExpression(node)) {
4389
4356
  return false;
4390
4357
  }
4391
- if (t38.isCallExpression(node) || t38.isAssignmentExpression(node)) {
4358
+ if (t37.isCallExpression(node) || t37.isAssignmentExpression(node)) {
4392
4359
  return false;
4393
4360
  }
4394
- if (t38.isBinaryExpression(node) || t38.isUnaryExpression(node)) {
4361
+ if (t37.isBinaryExpression(node) || t37.isUnaryExpression(node)) {
4395
4362
  return true;
4396
4363
  }
4397
4364
  return false;
4398
4365
  }
4399
- function isIdentifier20(code) {
4366
+ function isIdentifier19(code) {
4400
4367
  try {
4401
4368
  const node = parseExpression3(code);
4402
- return t38.isIdentifier(node);
4369
+ return t37.isIdentifier(node);
4403
4370
  } catch {
4404
4371
  return false;
4405
4372
  }
4406
4373
  }
4407
- function isStringLiteral12(code) {
4374
+ function isStringLiteral11(code) {
4408
4375
  try {
4409
4376
  const node = parseExpression3(code);
4410
- return t38.isStringLiteral(node);
4377
+ return t37.isStringLiteral(node);
4411
4378
  } catch {
4412
4379
  return false;
4413
4380
  }
@@ -4549,23 +4516,23 @@ function resolvePropAsBabelExp(ir, ctx) {
4549
4516
  const mergedItems = value.merge;
4550
4517
  const setNameIdentifier = (target, valueName) => {
4551
4518
  target.content = valueName;
4552
- target.ast = t39.jsxIdentifier(valueName);
4519
+ target.ast = t38.jsxIdentifier(valueName);
4553
4520
  };
4554
- const setValueExpression = (target, content, isStringLiteral13) => {
4521
+ const setValueExpression = (target, content, isStringLiteral12) => {
4555
4522
  target.content = content;
4556
- target.ast = resolveStringExpr(content, ctx, isStringLiteral13);
4523
+ target.ast = resolveStringExpr(content, ctx, isStringLiteral12);
4557
4524
  };
4558
4525
  const createRuntimeCall = (fnName, args) => {
4559
4526
  const fnArgs = args.filter(Boolean).join(",");
4560
4527
  return `${fnName}(${fnArgs})`;
4561
4528
  };
4562
- const applyRuntimeExpression = (expression, setName = false, nameIdentifier, isStringLiteral13) => {
4529
+ const applyRuntimeExpression = (expression, setName = false, nameIdentifier, isStringLiteral12) => {
4563
4530
  if (setName && nameIdentifier) {
4564
4531
  setNameIdentifier(nameExp, nameIdentifier);
4565
4532
  }
4566
4533
  const dir = ADAPTER_RULES.runtime.dir;
4567
4534
  recordImport(ctx, dir.package, dir.target);
4568
- setValueExpression(value.babelExp, expression, isStringLiteral13);
4535
+ setValueExpression(value.babelExp, expression, isStringLiteral12);
4569
4536
  };
4570
4537
  if (ir.isKeyLessVBind) {
4571
4538
  const dirKeyless = ADAPTER_RULES.runtime.dirKeyless;
@@ -4941,12 +4908,12 @@ function resolvePropertyIR(node, ir, ctx, nodeIR, isDynamic = false) {
4941
4908
  content = node.value.content = parseStyleString(content);
4942
4909
  }
4943
4910
  if (isDynamic) {
4944
- const isStringLiteral13 = strCodeTypes.isStringLiteral(content);
4945
- if (isStringLiteral13) {
4911
+ const isStringLiteral12 = strCodeTypes.isStringLiteral(content);
4912
+ if (isStringLiteral12) {
4946
4913
  content = normalizeString(content);
4947
4914
  node.value.content = content;
4948
4915
  }
4949
- node.value.isStringLiteral = isStringLiteral13;
4916
+ node.value.isStringLiteral = isStringLiteral12;
4950
4917
  }
4951
4918
  const existing = findSameProp(nodeIR.props, node);
4952
4919
  if (existing) {
@@ -5180,7 +5147,7 @@ function applyValueModifiers(valueExp, modifiers) {
5180
5147
  }
5181
5148
 
5182
5149
  // src/core/transform/sfc/template/syntax-processor/process/props/resolve-v-on.ts
5183
- import * as t40 from "@babel/types";
5150
+ import * as t39 from "@babel/types";
5184
5151
  function resolveVOn(node, _ir, ctx, nodeIR) {
5185
5152
  const arg = node.arg;
5186
5153
  const exp = node.exp;
@@ -5197,7 +5164,7 @@ function resolveVOn(node, _ir, ctx, nodeIR) {
5197
5164
  originalVueEventName = `${arg.content}.${modifiers.join(".")}`;
5198
5165
  } else {
5199
5166
  const expr = stringToExpr(handler);
5200
- if (!t40.isFunctionExpression(expr) && !t40.isArrowFunctionExpression(expr) && !t40.isIdentifier(expr)) {
5167
+ if (!t39.isFunctionExpression(expr) && !t39.isArrowFunctionExpression(expr) && !t39.isIdentifier(expr)) {
5201
5168
  handler = `() => {${handler}}`;
5202
5169
  }
5203
5170
  }
@@ -5650,7 +5617,7 @@ function transform(ast, ctx, options) {
5650
5617
  }
5651
5618
 
5652
5619
  // package.json
5653
- var version = "1.5.0";
5620
+ var version = "1.5.2";
5654
5621
  var bin = {
5655
5622
  vureact: "./bin/vureact.js"
5656
5623
  };
@@ -6398,18 +6365,10 @@ var BaseCompiler = class extends Helper {
6398
6365
  }
6399
6366
  prepareGenerateOptions(filename) {
6400
6367
  const userOptions = this.options.generate || {};
6401
- const mergedOptions = {
6402
- jsescOption: {
6403
- minimal: true,
6404
- quotes: "single"
6405
- },
6406
- minified: true,
6407
- ...userOptions
6408
- };
6409
- if (mergedOptions.sourceMaps && filename) {
6410
- mergedOptions.sourceFileName = mergedOptions.sourceFileName || filename;
6368
+ if (userOptions.sourceMaps && filename) {
6369
+ userOptions.sourceFileName = userOptions.sourceFileName || filename;
6411
6370
  }
6412
- return mergedOptions;
6371
+ return userOptions;
6413
6372
  }
6414
6373
  resolveMainResult(ir, gen, ctxData) {
6415
6374
  const { fileId, filename, scriptData, styleData, inputType } = ctxData;