@vureact/compiler-core 1.8.3 → 1.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } function _optionalChainDelete(ops) { const result = _optionalChain(ops); return result == null ? true : result; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7; var _class8; var _class9; var _class10; var _class11; var _class12; var _class13;/**
2
- * @vureact/compiler-core v1.8.3
2
+ * @vureact/compiler-core v1.8.5
3
3
  * (c) 2025-present Ruihong Zhong (Ryan John)
4
4
  * @license MIT
5
5
  */
@@ -24,7 +24,7 @@ function executePlugins(map, result, ctx) {
24
24
  }
25
25
 
26
26
  // src/core/codegen/component/jsx/syntax-processor/postprocess/build-ctx-provider.ts
27
- var _types = require('@babel/types'); var t11 = _interopRequireWildcard(_types); var t = _interopRequireWildcard(_types); var t10 = _interopRequireWildcard(_types); var t2 = _interopRequireWildcard(_types); var t4 = _interopRequireWildcard(_types); var t3 = _interopRequireWildcard(_types); var t6 = _interopRequireWildcard(_types); var t5 = _interopRequireWildcard(_types); var t7 = _interopRequireWildcard(_types); var t9 = _interopRequireWildcard(_types); var t8 = _interopRequireWildcard(_types); var t14 = _interopRequireWildcard(_types); var t12 = _interopRequireWildcard(_types); var t13 = _interopRequireWildcard(_types); var t16 = _interopRequireWildcard(_types); var t15 = _interopRequireWildcard(_types); var t18 = _interopRequireWildcard(_types); var t17 = _interopRequireWildcard(_types); var t19 = _interopRequireWildcard(_types); var t20 = _interopRequireWildcard(_types); var t21 = _interopRequireWildcard(_types); var t22 = _interopRequireWildcard(_types); var t23 = _interopRequireWildcard(_types); var t24 = _interopRequireWildcard(_types); var t25 = _interopRequireWildcard(_types); var t27 = _interopRequireWildcard(_types); var t26 = _interopRequireWildcard(_types); var t28 = _interopRequireWildcard(_types); var t36 = _interopRequireWildcard(_types); var t30 = _interopRequireWildcard(_types); var t29 = _interopRequireWildcard(_types); var t31 = _interopRequireWildcard(_types); var t34 = _interopRequireWildcard(_types); var t32 = _interopRequireWildcard(_types); var t33 = _interopRequireWildcard(_types); var t35 = _interopRequireWildcard(_types); var t37 = _interopRequireWildcard(_types); var t43 = _interopRequireWildcard(_types); var t42 = _interopRequireWildcard(_types); var t38 = _interopRequireWildcard(_types); var t39 = _interopRequireWildcard(_types); var t40 = _interopRequireWildcard(_types); var t41 = _interopRequireWildcard(_types); var t44 = _interopRequireWildcard(_types); var t45 = _interopRequireWildcard(_types); var t46 = _interopRequireWildcard(_types); var t47 = _interopRequireWildcard(_types); var t48 = _interopRequireWildcard(_types); var t50 = _interopRequireWildcard(_types); var t49 = _interopRequireWildcard(_types); var t51 = _interopRequireWildcard(_types);
27
+ var _types = require('@babel/types'); var t11 = _interopRequireWildcard(_types); var t = _interopRequireWildcard(_types); var t10 = _interopRequireWildcard(_types); var t2 = _interopRequireWildcard(_types); var t4 = _interopRequireWildcard(_types); var t3 = _interopRequireWildcard(_types); var t6 = _interopRequireWildcard(_types); var t5 = _interopRequireWildcard(_types); var t7 = _interopRequireWildcard(_types); var t9 = _interopRequireWildcard(_types); var t8 = _interopRequireWildcard(_types); var t14 = _interopRequireWildcard(_types); var t12 = _interopRequireWildcard(_types); var t13 = _interopRequireWildcard(_types); var t16 = _interopRequireWildcard(_types); var t15 = _interopRequireWildcard(_types); var t18 = _interopRequireWildcard(_types); var t17 = _interopRequireWildcard(_types); var t19 = _interopRequireWildcard(_types); var t20 = _interopRequireWildcard(_types); var t21 = _interopRequireWildcard(_types); var t22 = _interopRequireWildcard(_types); var t23 = _interopRequireWildcard(_types); var t24 = _interopRequireWildcard(_types); var t25 = _interopRequireWildcard(_types); var t26 = _interopRequireWildcard(_types); var t28 = _interopRequireWildcard(_types); var t27 = _interopRequireWildcard(_types); var t29 = _interopRequireWildcard(_types); var t37 = _interopRequireWildcard(_types); var t31 = _interopRequireWildcard(_types); var t30 = _interopRequireWildcard(_types); var t32 = _interopRequireWildcard(_types); var t35 = _interopRequireWildcard(_types); var t33 = _interopRequireWildcard(_types); var t34 = _interopRequireWildcard(_types); var t36 = _interopRequireWildcard(_types); var t38 = _interopRequireWildcard(_types); var t44 = _interopRequireWildcard(_types); var t43 = _interopRequireWildcard(_types); var t39 = _interopRequireWildcard(_types); var t40 = _interopRequireWildcard(_types); var t41 = _interopRequireWildcard(_types); var t42 = _interopRequireWildcard(_types); var t45 = _interopRequireWildcard(_types); var t46 = _interopRequireWildcard(_types); var t47 = _interopRequireWildcard(_types); var t48 = _interopRequireWildcard(_types); var t49 = _interopRequireWildcard(_types); var t51 = _interopRequireWildcard(_types); var t50 = _interopRequireWildcard(_types); var t52 = _interopRequireWildcard(_types);
28
28
 
29
29
  // src/consts/other.ts
30
30
  var PACKAGE_NAME = {
@@ -39,7 +39,7 @@ var RUNTIME_PACKAGES = {
39
39
  },
40
40
  runtime: {
41
41
  name: PACKAGE_NAME.runtime,
42
- version: "^1.1.0"
42
+ version: "^1.1.1"
43
43
  }
44
44
  };
45
45
  var STYLE_MODULE_NAME = "$style";
@@ -311,7 +311,8 @@ var ADAPTER_RULES = {
311
311
  type: "rename"
312
312
  },
313
313
  dirOn: {
314
- target: "dir.On",
314
+ // fix: https://github.com/vureact-js/core/issues/49
315
+ target: "dir.on",
315
316
  package: PACKAGE_NAME.runtime,
316
317
  type: "rename"
317
318
  },
@@ -568,7 +569,8 @@ function buildJsxChildrenProcessor(nodeIR, ctx, state) {
568
569
  }
569
570
  function buildJsxChildren(children, ctx) {
570
571
  const result = [];
571
- for (const childIR of children) {
572
+ const normalizedChildren = Array.isArray(children) ? children : [];
573
+ for (const childIR of normalizedChildren) {
572
574
  const jsxNode = buildJsxNode(childIR, ctx);
573
575
  if (!jsxNode) continue;
574
576
  result.push(jsxNode);
@@ -1178,26 +1180,38 @@ function buildCtxProviderNode(nodeIR, ctx, children) {
1178
1180
 
1179
1181
  // src/core/codegen/component/jsx/syntax-processor/postprocess/build-root-jsx.ts
1180
1182
  function buildRootJsxProcessor(nodeIR, ctx, state) {
1181
- if (!state.rootChildren.length) {
1182
- state.result = null;
1183
+ const { rootChildren } = state;
1184
+ const { provide } = ctx.scriptData;
1185
+ const hasProvide = provide.isOccupied;
1186
+ const hasChildren = rootChildren.length > 0;
1187
+ const setResult = (elem) => {
1188
+ state.result = _nullishCoalesce(elem, () => ( null));
1189
+ };
1190
+ if (hasProvide) {
1191
+ const provider = buildCtxProviderNode(provide, ctx, rootChildren);
1192
+ if (!hasChildren) {
1193
+ setResult(buildFragmentNode([provider]));
1194
+ } else {
1195
+ setResult(provider);
1196
+ }
1183
1197
  return;
1184
1198
  }
1185
- const { provide } = ctx.scriptData;
1186
- if (provide.isOccupied) {
1187
- state.result = buildCtxProviderNode(provide, ctx, state.rootChildren);
1199
+ if (!hasChildren) {
1200
+ setResult();
1188
1201
  return;
1189
1202
  }
1190
- state.result = buildFragmentNode(state.rootChildren);
1203
+ setResult(buildFragmentNode(rootChildren));
1191
1204
  void nodeIR;
1192
1205
  }
1193
1206
 
1194
1207
  // src/core/codegen/component/jsx/syntax-processor/index.ts
1195
1208
  function buildJSXChild(nodeIR, ctx) {
1209
+ const templateIR = nodeIR || { children: [] };
1196
1210
  const state = {
1197
1211
  rootChildren: [],
1198
1212
  result: null
1199
1213
  };
1200
- jsxBuilder(nodeIR, ctx, state, {
1214
+ jsxBuilder(templateIR, ctx, state, {
1201
1215
  preprocess: [],
1202
1216
  process: [buildJsxChildrenProcessor],
1203
1217
  postprocess: [buildRootJsxProcessor]
@@ -1215,7 +1229,7 @@ function jsxBuilder(nodeIR, ctx, state, options) {
1215
1229
 
1216
1230
  // src/core/codegen/component/jsx/index.ts
1217
1231
  function buildJSX(nodeIR, ctx) {
1218
- if (!_optionalChain([nodeIR, 'optionalAccess', _32 => _32.children, 'access', _33 => _33.length])) {
1232
+ if (!_optionalChain([nodeIR, 'optionalAccess', _32 => _32.children, 'access', _33 => _33.length]) && ctx.inputType !== "sfc") {
1219
1233
  return null;
1220
1234
  }
1221
1235
  return buildJSXChild(nodeIR, ctx);
@@ -3220,6 +3234,49 @@ function resolveSfcCssImport(ctx) {
3220
3234
  scriptIR.imports.push(importDecl);
3221
3235
  }
3222
3236
 
3237
+ // src/core/transform/sfc/script/syntax-processor/postprocess/resolve-vue-type-as-any.ts
3238
+
3239
+ function resolveVueTypeAsAny(ctx) {
3240
+ return {
3241
+ TSTypeReference(path8) {
3242
+ if (isVueTypeRef(path8)) {
3243
+ replaceNode(path8, t25.tsAnyKeyword(), path8.node);
3244
+ }
3245
+ }
3246
+ };
3247
+ }
3248
+ function isVueTypeRef(path8) {
3249
+ const id = resolveTypeNameId(path8.node.typeName);
3250
+ return id !== null && isVueImport(id, path8);
3251
+ }
3252
+ function resolveTypeNameId(typeName) {
3253
+ if (t25.isIdentifier(typeName)) {
3254
+ return typeName;
3255
+ }
3256
+ if (t25.isTSQualifiedName(typeName)) {
3257
+ let node = typeName;
3258
+ while (t25.isTSQualifiedName(node)) {
3259
+ node = node.left;
3260
+ }
3261
+ return t25.isIdentifier(node) ? node : null;
3262
+ }
3263
+ return null;
3264
+ }
3265
+ function isVueImport(id, path8) {
3266
+ const binding = path8.scope.getBinding(id.name);
3267
+ if (!binding) return false;
3268
+ const bp = binding.path;
3269
+ if (!bp.isImportSpecifier() && !bp.isImportDefaultSpecifier()) {
3270
+ return false;
3271
+ }
3272
+ const importDecl = bp.parentPath;
3273
+ if (!importDecl.isImportDeclaration()) {
3274
+ return false;
3275
+ }
3276
+ const moduleName = importDecl.node.source.value;
3277
+ return VUE_PACKAGES.some((pkg) => moduleName.includes(pkg));
3278
+ }
3279
+
3223
3280
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-define-async-component.ts
3224
3281
 
3225
3282
  function resolveDefineAsyncComponent(ctx) {
@@ -3230,11 +3287,11 @@ function resolveDefineAsyncComponent(ctx) {
3230
3287
  return;
3231
3288
  }
3232
3289
  const [arg] = node.arguments;
3233
- if (!t25.isObjectExpression(arg)) {
3290
+ if (!t26.isObjectExpression(arg)) {
3234
3291
  return;
3235
3292
  }
3236
3293
  for (const prop of arg.properties) {
3237
- if (!t25.isObjectProperty(prop) || !t25.isIdentifier(prop.key) || prop.key.name !== "hydrate") {
3294
+ if (!t26.isObjectProperty(prop) || !t26.isIdentifier(prop.key) || prop.key.name !== "hydrate") {
3238
3295
  continue;
3239
3296
  }
3240
3297
  logger.warn('Unsupported option "hydrate"', {
@@ -3254,19 +3311,19 @@ function resolveDefineAsyncComponent(ctx) {
3254
3311
  // src/core/transform/sfc/script/shared/hook-creator.ts
3255
3312
 
3256
3313
  function createUseCallback(body, deps) {
3257
- return t26.callExpression(t26.identifier(REACT_API_MAP.useCallback), [
3314
+ return t27.callExpression(t27.identifier(REACT_API_MAP.useCallback), [
3258
3315
  body,
3259
- _nullishCoalesce(deps, () => ( t26.arrayExpression([])))
3316
+ _nullishCoalesce(deps, () => ( t27.arrayExpression([])))
3260
3317
  ]);
3261
3318
  }
3262
3319
  function createUseMemo(body, deps) {
3263
- return t26.callExpression(t26.identifier(REACT_API_MAP.useMemo), [
3264
- t26.arrowFunctionExpression([], body),
3265
- _nullishCoalesce(deps, () => ( t26.arrayExpression([])))
3320
+ return t27.callExpression(t27.identifier(REACT_API_MAP.useMemo), [
3321
+ t27.arrowFunctionExpression([], body),
3322
+ _nullishCoalesce(deps, () => ( t27.arrayExpression([])))
3266
3323
  ]);
3267
3324
  }
3268
3325
  function createUseImperativeHandle(refId, init) {
3269
- return t26.callExpression(t26.identifier(REACT_API_MAP.useImperativeHandle), [refId, init]);
3326
+ return t27.callExpression(t27.identifier(REACT_API_MAP.useImperativeHandle), [refId, init]);
3270
3327
  }
3271
3328
 
3272
3329
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-define-expose.ts
@@ -3287,16 +3344,16 @@ function resolveDefineExpose(ctx) {
3287
3344
  const adapter = ADAPTER_RULES.react[MACRO_API_NAMES.expose];
3288
3345
  recordImport(ctx, adapter.package, REACT_API_MAP.forwardRef);
3289
3346
  recordImport(ctx, adapter.package, adapter.target);
3290
- if (!t27.isObjectExpression(expose) && !t27.isFunction(expose)) {
3347
+ if (!t28.isObjectExpression(expose) && !t28.isFunction(expose)) {
3291
3348
  logger.warn("Non-deterministic object literal may cause unknown risks.", {
3292
3349
  file: filename,
3293
3350
  loc: expose.loc,
3294
3351
  source: scriptData.source
3295
3352
  });
3296
3353
  }
3297
- const init = !t27.isFunction(expose) ? t27.arrowFunctionExpression([], expose) : expose;
3354
+ const init = !t28.isFunction(expose) ? t28.arrowFunctionExpression([], expose) : expose;
3298
3355
  const { forwardRef } = scriptData;
3299
- const newNode = createUseImperativeHandle(t27.identifier(forwardRef.refField), init);
3356
+ const newNode = createUseImperativeHandle(t28.identifier(forwardRef.refField), init);
3300
3357
  forwardRef.enabled = true;
3301
3358
  replaceNode(path8, newNode, node);
3302
3359
  }
@@ -3331,7 +3388,7 @@ function resolveEmitCalls(ctx) {
3331
3388
  CallExpression(path8) {
3332
3389
  const { node } = path8;
3333
3390
  const { filename, templateData, scriptData } = ctx;
3334
- if (!t28.isIdentifier(node.callee)) return;
3391
+ if (!t29.isIdentifier(node.callee)) return;
3335
3392
  const { name } = node.callee;
3336
3393
  const checkIfFromDefineEmits = () => {
3337
3394
  let result = false;
@@ -3343,7 +3400,7 @@ function resolveEmitCalls(ctx) {
3343
3400
  const binding = path8.scope.getBinding(name);
3344
3401
  if (binding) {
3345
3402
  const parent = binding.path.node;
3346
- if (t28.isVariableDeclarator(parent) && t28.isCallExpression(parent.init) && t28.isIdentifier(parent.init.callee)) {
3403
+ if (t29.isVariableDeclarator(parent) && t29.isCallExpression(parent.init) && t29.isIdentifier(parent.init.callee)) {
3347
3404
  result = parent.init.callee.name === MACRO_API_NAMES.emits;
3348
3405
  }
3349
3406
  }
@@ -3353,9 +3410,9 @@ function resolveEmitCalls(ctx) {
3353
3410
  if (!checkIfFromDefineEmits()) return;
3354
3411
  const [callee, ...args] = node.arguments;
3355
3412
  let propCall;
3356
- if (t28.isStringLiteral(callee)) {
3413
+ if (t29.isStringLiteral(callee)) {
3357
3414
  const eventName = formatEmitEventName(callee.value);
3358
- propCall = createPropCall(ctx.propField, t28.identifier(eventName), args);
3415
+ propCall = createPropCall(ctx.propField, t29.identifier(eventName), args);
3359
3416
  } else {
3360
3417
  propCall = createPropCall(ctx.propField, callee, args, true);
3361
3418
  logger.error(
@@ -3372,8 +3429,8 @@ function resolveEmitCalls(ctx) {
3372
3429
  };
3373
3430
  }
3374
3431
  function createPropCall(rootName, callee, args, computed = false) {
3375
- return t28.optionalCallExpression(
3376
- t28.memberExpression(t28.identifier(rootName), callee, computed),
3432
+ return t29.optionalCallExpression(
3433
+ t29.memberExpression(t29.identifier(rootName), callee, computed),
3377
3434
  args,
3378
3435
  true
3379
3436
  );
@@ -3389,21 +3446,21 @@ function createPropCall(rootName, callee, args, computed = false) {
3389
3446
 
3390
3447
  function cloneCallableParams(params) {
3391
3448
  const cloneCallableParam = (param, index) => {
3392
- if (t29.isRestElement(param)) {
3449
+ if (t30.isRestElement(param)) {
3393
3450
  const arg = param.argument;
3394
- const name = t29.isIdentifier(arg) ? arg.name : `args${index}`;
3395
- const rest = t29.restElement(t29.identifier(name));
3396
- rest.typeAnnotation = param.typeAnnotation || (t29.isIdentifier(arg) ? arg.typeAnnotation : null) || t29.tsTypeAnnotation(t29.tsArrayType(t29.tsAnyKeyword()));
3451
+ const name = t30.isIdentifier(arg) ? arg.name : `args${index}`;
3452
+ const rest = t30.restElement(t30.identifier(name));
3453
+ rest.typeAnnotation = param.typeAnnotation || (t30.isIdentifier(arg) ? arg.typeAnnotation : null) || t30.tsTypeAnnotation(t30.tsArrayType(t30.tsAnyKeyword()));
3397
3454
  return rest;
3398
3455
  }
3399
- if (t29.isIdentifier(param)) {
3400
- const id = t29.identifier(param.name || `arg${index}`);
3456
+ if (t30.isIdentifier(param)) {
3457
+ const id = t30.identifier(param.name || `arg${index}`);
3401
3458
  id.optional = param.optional;
3402
- id.typeAnnotation = param.typeAnnotation || t29.tsTypeAnnotation(t29.tsAnyKeyword());
3459
+ id.typeAnnotation = param.typeAnnotation || t30.tsTypeAnnotation(t30.tsAnyKeyword());
3403
3460
  return id;
3404
3461
  }
3405
- const fallback = t29.identifier(`arg${index}`);
3406
- fallback.typeAnnotation = t29.tsTypeAnnotation(t29.tsAnyKeyword());
3462
+ const fallback = t30.identifier(`arg${index}`);
3463
+ fallback.typeAnnotation = t30.tsTypeAnnotation(t30.tsAnyKeyword());
3407
3464
  return fallback;
3408
3465
  };
3409
3466
  return params.map(cloneCallableParam);
@@ -3413,18 +3470,18 @@ function cloneCallableParams(params) {
3413
3470
  function resolveEmitsTopLevelTypes(ctx) {
3414
3471
  return {
3415
3472
  "TSInterfaceDeclaration|TSTypeAliasDeclaration"(path8) {
3416
- if (!t30.isProgram(path8.parent)) return;
3473
+ if (!t31.isProgram(path8.parent)) return;
3417
3474
  const { node } = path8;
3418
- if (t30.isTSInterfaceDeclaration(node)) {
3419
- const typeLiteral = t30.tsTypeLiteral(node.body.body);
3475
+ if (t31.isTSInterfaceDeclaration(node)) {
3476
+ const typeLiteral = t31.tsTypeLiteral(node.body.body);
3420
3477
  if (!hasEmitsSignatureInType(typeLiteral)) return;
3421
3478
  const resolved = resolveTopLevelEmitType(typeLiteral);
3422
- if (resolved && t30.isTSTypeLiteral(resolved)) {
3479
+ if (resolved && t31.isTSTypeLiteral(resolved)) {
3423
3480
  node.body.body = resolved.members;
3424
3481
  }
3425
3482
  return;
3426
3483
  }
3427
- if (t30.isTSTypeAliasDeclaration(node)) {
3484
+ if (t31.isTSTypeAliasDeclaration(node)) {
3428
3485
  if (!hasEmitsSignatureInType(node.typeAnnotation)) return;
3429
3486
  const resolved = resolveTopLevelEmitType(node.typeAnnotation);
3430
3487
  if (resolved) {
@@ -3435,47 +3492,47 @@ function resolveEmitsTopLevelTypes(ctx) {
3435
3492
  };
3436
3493
  }
3437
3494
  function resolveTopLevelEmitType(tsType) {
3438
- if (t30.isTSParenthesizedType(tsType)) {
3495
+ if (t31.isTSParenthesizedType(tsType)) {
3439
3496
  return resolveTopLevelEmitType(tsType.typeAnnotation);
3440
3497
  }
3441
- if (t30.isTSTypeReference(tsType)) {
3498
+ if (t31.isTSTypeReference(tsType)) {
3442
3499
  if (!tsType.typeParameters || !tsType.typeParameters.params.length) {
3443
3500
  return tsType;
3444
3501
  }
3445
3502
  const params = tsType.typeParameters.params.map((param) => resolveTopLevelEmitType(param)).filter(Boolean);
3446
- return t30.tsTypeReference(
3503
+ return t31.tsTypeReference(
3447
3504
  tsType.typeName,
3448
- t30.tsTypeParameterInstantiation(params.length ? params : tsType.typeParameters.params)
3505
+ t31.tsTypeParameterInstantiation(params.length ? params : tsType.typeParameters.params)
3449
3506
  );
3450
3507
  }
3451
- if (t30.isTSIntersectionType(tsType)) {
3508
+ if (t31.isTSIntersectionType(tsType)) {
3452
3509
  const types = tsType.types.map(resolveTopLevelEmitType).filter(Boolean);
3453
3510
  if (!types.length) return null;
3454
3511
  if (types.length === 1) return types[0];
3455
- return t30.tsIntersectionType(types);
3512
+ return t31.tsIntersectionType(types);
3456
3513
  }
3457
- if (t30.isTSUnionType(tsType)) {
3514
+ if (t31.isTSUnionType(tsType)) {
3458
3515
  const types = tsType.types.map(resolveTopLevelEmitType).filter(Boolean);
3459
3516
  if (!types.length) return null;
3460
3517
  if (types.length === 1) return types[0];
3461
- return t30.tsUnionType(types);
3518
+ return t31.tsUnionType(types);
3462
3519
  }
3463
- if (t30.isTSTypeLiteral(tsType)) {
3520
+ if (t31.isTSTypeLiteral(tsType)) {
3464
3521
  const members = [];
3465
3522
  for (const member of tsType.members) {
3466
- if (t30.isTSCallSignatureDeclaration(member)) {
3523
+ if (t31.isTSCallSignatureDeclaration(member)) {
3467
3524
  members.push(...resolveEmitPropsFromCallSignature(member));
3468
3525
  continue;
3469
3526
  }
3470
3527
  members.push(member);
3471
3528
  }
3472
3529
  if (!members.length) return null;
3473
- return t30.tsTypeLiteral(members);
3530
+ return t31.tsTypeLiteral(members);
3474
3531
  }
3475
- if (t30.isTSFunctionType(tsType)) {
3532
+ if (t31.isTSFunctionType(tsType)) {
3476
3533
  const props = resolveEmitPropsFromCallable(tsType.parameters, tsType.typeAnnotation);
3477
3534
  if (!props.length) return null;
3478
- return t30.tsTypeLiteral(props);
3535
+ return t31.tsTypeLiteral(props);
3479
3536
  }
3480
3537
  return tsType;
3481
3538
  }
@@ -3496,41 +3553,41 @@ function processInferredTypes(ctx, runtimeArg) {
3496
3553
  propsTSIface: { emitTypes }
3497
3554
  } = ctx.scriptData;
3498
3555
  const members = [];
3499
- if (t30.isArrayExpression(runtimeArg)) {
3556
+ if (t31.isArrayExpression(runtimeArg)) {
3500
3557
  for (const element of runtimeArg.elements) {
3501
- if (!element || !t30.isStringLiteral(element)) continue;
3558
+ if (!element || !t31.isStringLiteral(element)) continue;
3502
3559
  const handlerName = resolveEmitHandlerName(element.value);
3503
3560
  const key = buildKey(handlerName);
3504
- const fnType = t30.tsFunctionType(
3561
+ const fnType = t31.tsFunctionType(
3505
3562
  null,
3506
3563
  [createRestAnyParam("args")],
3507
- t30.tsTypeAnnotation(t30.tsAnyKeyword())
3564
+ t31.tsTypeAnnotation(t31.tsAnyKeyword())
3508
3565
  );
3509
- const prop = t30.tsPropertySignature(key, t30.tsTypeAnnotation(fnType));
3566
+ const prop = t31.tsPropertySignature(key, t31.tsTypeAnnotation(fnType));
3510
3567
  prop.optional = true;
3511
3568
  members.push(prop);
3512
3569
  }
3513
3570
  if (members.length) {
3514
- emitTypes.push(t30.tsTypeLiteral(members));
3571
+ emitTypes.push(t31.tsTypeLiteral(members));
3515
3572
  }
3516
3573
  return;
3517
3574
  }
3518
- if (t30.isObjectExpression(runtimeArg)) {
3575
+ if (t31.isObjectExpression(runtimeArg)) {
3519
3576
  for (const prop of runtimeArg.properties) {
3520
- if (!t30.isObjectProperty(prop)) continue;
3521
- if (t30.isSpreadElement(prop)) continue;
3577
+ if (!t31.isObjectProperty(prop)) continue;
3578
+ if (t31.isSpreadElement(prop)) continue;
3522
3579
  const rawName = resolvePropName(prop.key);
3523
3580
  if (!rawName) continue;
3524
3581
  const handlerName = resolveEmitHandlerName(rawName);
3525
3582
  const key = buildKey(handlerName);
3526
- const params = t30.isArrayExpression(prop.value) ? resolveRuntimeTupleParams(prop.value) : [createRestAnyParam("args")];
3527
- const fnType = t30.tsFunctionType(null, params, t30.tsTypeAnnotation(t30.tsAnyKeyword()));
3528
- const propSig = t30.tsPropertySignature(key, t30.tsTypeAnnotation(fnType));
3583
+ const params = t31.isArrayExpression(prop.value) ? resolveRuntimeTupleParams(prop.value) : [createRestAnyParam("args")];
3584
+ const fnType = t31.tsFunctionType(null, params, t31.tsTypeAnnotation(t31.tsAnyKeyword()));
3585
+ const propSig = t31.tsPropertySignature(key, t31.tsTypeAnnotation(fnType));
3529
3586
  propSig.optional = true;
3530
3587
  members.push(propSig);
3531
3588
  }
3532
3589
  if (members.length) {
3533
- emitTypes.push(t30.tsTypeLiteral(members));
3590
+ emitTypes.push(t31.tsTypeLiteral(members));
3534
3591
  }
3535
3592
  }
3536
3593
  }
@@ -3551,129 +3608,129 @@ function resolveEmitHandlerName(rawName) {
3551
3608
  return `on${name}`;
3552
3609
  }
3553
3610
  function resolvePropName(key) {
3554
- if (t30.isIdentifier(key)) return key.name;
3555
- if (t30.isStringLiteral(key)) return key.value;
3556
- if (t30.isNumericLiteral(key)) return String(key.value);
3611
+ if (t31.isIdentifier(key)) return key.name;
3612
+ if (t31.isStringLiteral(key)) return key.value;
3613
+ if (t31.isNumericLiteral(key)) return String(key.value);
3557
3614
  return null;
3558
3615
  }
3559
3616
  function buildKey(name) {
3560
- return t30.isValidIdentifier(name) ? t30.identifier(name) : t30.stringLiteral(name);
3617
+ return t31.isValidIdentifier(name) ? t31.identifier(name) : t31.stringLiteral(name);
3561
3618
  }
3562
3619
  function createRestAnyParam(name) {
3563
- const id = t30.identifier(name);
3564
- const rest = t30.restElement(id);
3565
- rest.typeAnnotation = t30.tsTypeAnnotation(t30.tsArrayType(t30.tsAnyKeyword()));
3620
+ const id = t31.identifier(name);
3621
+ const rest = t31.restElement(id);
3622
+ rest.typeAnnotation = t31.tsTypeAnnotation(t31.tsArrayType(t31.tsAnyKeyword()));
3566
3623
  return rest;
3567
3624
  }
3568
3625
  function resolveRuntimeTupleParams(value) {
3569
3626
  const params = [];
3570
3627
  value.elements.forEach((element, index) => {
3571
3628
  if (!element) return;
3572
- if (t30.isSpreadElement(element)) {
3629
+ if (t31.isSpreadElement(element)) {
3573
3630
  params.push(createRestAnyParam(`args${index}`));
3574
3631
  return;
3575
3632
  }
3576
- if (t30.isIdentifier(element)) {
3577
- const id = t30.identifier(element.name);
3578
- id.typeAnnotation = element.typeAnnotation || t30.tsTypeAnnotation(t30.tsAnyKeyword());
3633
+ if (t31.isIdentifier(element)) {
3634
+ const id = t31.identifier(element.name);
3635
+ id.typeAnnotation = element.typeAnnotation || t31.tsTypeAnnotation(t31.tsAnyKeyword());
3579
3636
  params.push(id);
3580
3637
  return;
3581
3638
  }
3582
- if (t30.isTSAsExpression(element)) {
3583
- const id = t30.identifier(`arg${index}`);
3584
- id.typeAnnotation = t30.tsTypeAnnotation(element.typeAnnotation);
3639
+ if (t31.isTSAsExpression(element)) {
3640
+ const id = t31.identifier(`arg${index}`);
3641
+ id.typeAnnotation = t31.tsTypeAnnotation(element.typeAnnotation);
3585
3642
  params.push(id);
3586
3643
  return;
3587
3644
  }
3588
- const fallback = t30.identifier(`arg${index}`);
3589
- fallback.typeAnnotation = t30.tsTypeAnnotation(t30.tsAnyKeyword());
3645
+ const fallback = t31.identifier(`arg${index}`);
3646
+ fallback.typeAnnotation = t31.tsTypeAnnotation(t31.tsAnyKeyword());
3590
3647
  params.push(fallback);
3591
3648
  });
3592
3649
  return params;
3593
3650
  }
3594
3651
  function resolveExplicitEmitType(tsType) {
3595
- if (t30.isTSParenthesizedType(tsType)) {
3652
+ if (t31.isTSParenthesizedType(tsType)) {
3596
3653
  return resolveExplicitEmitType(tsType.typeAnnotation);
3597
3654
  }
3598
- if (t30.isTSTypeReference(tsType)) {
3655
+ if (t31.isTSTypeReference(tsType)) {
3599
3656
  if (!tsType.typeParameters || !tsType.typeParameters.params.length) {
3600
3657
  return tsType;
3601
3658
  }
3602
3659
  const params = tsType.typeParameters.params.map((param) => resolveExplicitEmitType(param)).filter(Boolean);
3603
- return t30.tsTypeReference(
3660
+ return t31.tsTypeReference(
3604
3661
  tsType.typeName,
3605
- t30.tsTypeParameterInstantiation(params.length ? params : tsType.typeParameters.params)
3662
+ t31.tsTypeParameterInstantiation(params.length ? params : tsType.typeParameters.params)
3606
3663
  );
3607
3664
  }
3608
- if (t30.isTSIntersectionType(tsType)) {
3665
+ if (t31.isTSIntersectionType(tsType)) {
3609
3666
  const types = tsType.types.map(resolveExplicitEmitType).filter(Boolean);
3610
3667
  if (!types.length) return null;
3611
3668
  if (types.length === 1) return types[0];
3612
- return t30.tsIntersectionType(types);
3669
+ return t31.tsIntersectionType(types);
3613
3670
  }
3614
- if (t30.isTSUnionType(tsType)) {
3671
+ if (t31.isTSUnionType(tsType)) {
3615
3672
  const types = tsType.types.map(resolveExplicitEmitType).filter(Boolean);
3616
3673
  if (!types.length) return null;
3617
3674
  if (types.length === 1) return types[0];
3618
- return t30.tsUnionType(types);
3675
+ return t31.tsUnionType(types);
3619
3676
  }
3620
- if (t30.isTSTypeLiteral(tsType)) {
3677
+ if (t31.isTSTypeLiteral(tsType)) {
3621
3678
  const members = [];
3622
3679
  for (const member of tsType.members) {
3623
- if (t30.isTSPropertySignature(member)) {
3680
+ if (t31.isTSPropertySignature(member)) {
3624
3681
  const prop = resolveEmitPropFromPropertySignature(member);
3625
3682
  if (prop) members.push(prop);
3626
3683
  continue;
3627
3684
  }
3628
- if (t30.isTSCallSignatureDeclaration(member)) {
3685
+ if (t31.isTSCallSignatureDeclaration(member)) {
3629
3686
  members.push(...resolveEmitPropsFromCallSignature(member));
3630
3687
  continue;
3631
3688
  }
3632
3689
  }
3633
3690
  if (!members.length) return null;
3634
- return t30.tsTypeLiteral(members);
3691
+ return t31.tsTypeLiteral(members);
3635
3692
  }
3636
- if (t30.isTSFunctionType(tsType)) {
3693
+ if (t31.isTSFunctionType(tsType)) {
3637
3694
  const props = resolveEmitPropsFromCallable(tsType.parameters, tsType.typeAnnotation);
3638
3695
  if (!props.length) return null;
3639
- return t30.tsTypeLiteral(props);
3696
+ return t31.tsTypeLiteral(props);
3640
3697
  }
3641
3698
  return tsType;
3642
3699
  }
3643
3700
  function hasEmitsSignatureInType(tsType) {
3644
- if (t30.isTSParenthesizedType(tsType)) {
3701
+ if (t31.isTSParenthesizedType(tsType)) {
3645
3702
  return hasEmitsSignatureInType(tsType.typeAnnotation);
3646
3703
  }
3647
- if (t30.isTSTypeReference(tsType)) {
3704
+ if (t31.isTSTypeReference(tsType)) {
3648
3705
  if (!tsType.typeParameters || !tsType.typeParameters.params.length) {
3649
3706
  return false;
3650
3707
  }
3651
3708
  return tsType.typeParameters.params.some(hasEmitsSignatureInType);
3652
3709
  }
3653
- if (t30.isTSIntersectionType(tsType) || t30.isTSUnionType(tsType)) {
3710
+ if (t31.isTSIntersectionType(tsType) || t31.isTSUnionType(tsType)) {
3654
3711
  return tsType.types.some(hasEmitsSignatureInType);
3655
3712
  }
3656
- if (t30.isTSTypeLiteral(tsType)) {
3713
+ if (t31.isTSTypeLiteral(tsType)) {
3657
3714
  return tsType.members.some(hasEmitsSignatureInMember);
3658
3715
  }
3659
- if (t30.isTSFunctionType(tsType)) {
3716
+ if (t31.isTSFunctionType(tsType)) {
3660
3717
  return isEmitsCallable(tsType.parameters);
3661
3718
  }
3662
3719
  return false;
3663
3720
  }
3664
3721
  function hasEmitsSignatureInMember(member) {
3665
- if (t30.isTSCallSignatureDeclaration(member)) {
3722
+ if (t31.isTSCallSignatureDeclaration(member)) {
3666
3723
  return isEmitsCallable(member.parameters);
3667
3724
  }
3668
3725
  return false;
3669
3726
  }
3670
3727
  function isEmitsCallable(parameters) {
3671
3728
  const [eventParam] = parameters;
3672
- if (!eventParam || !t30.isIdentifier(eventParam) || !eventParam.typeAnnotation) {
3729
+ if (!eventParam || !t31.isIdentifier(eventParam) || !eventParam.typeAnnotation) {
3673
3730
  return false;
3674
3731
  }
3675
3732
  const { typeAnnotation } = eventParam;
3676
- if (t30.isNoop(typeAnnotation)) return false;
3733
+ if (t31.isNoop(typeAnnotation)) return false;
3677
3734
  return resolveEventNames(typeAnnotation.typeAnnotation).length > 0;
3678
3735
  }
3679
3736
  function resolveEmitPropFromPropertySignature(member) {
@@ -3683,19 +3740,19 @@ function resolveEmitPropFromPropertySignature(member) {
3683
3740
  const key = buildKey(handlerName);
3684
3741
  const typeAnnotation = _optionalChain([member, 'access', _110 => _110.typeAnnotation, 'optionalAccess', _111 => _111.typeAnnotation]);
3685
3742
  let params = [];
3686
- let returnType = t30.tsAnyKeyword();
3687
- if (typeAnnotation && t30.isTSFunctionType(typeAnnotation)) {
3743
+ let returnType = t31.tsAnyKeyword();
3744
+ if (typeAnnotation && t31.isTSFunctionType(typeAnnotation)) {
3688
3745
  params = cloneCallableParams(typeAnnotation.parameters);
3689
3746
  returnType = _nullishCoalesce(_optionalChain([typeAnnotation, 'access', _112 => _112.typeAnnotation, 'optionalAccess', _113 => _113.typeAnnotation]), () => ( returnType));
3690
- } else if (typeAnnotation && t30.isTSTupleType(typeAnnotation)) {
3747
+ } else if (typeAnnotation && t31.isTSTupleType(typeAnnotation)) {
3691
3748
  params = resolveTupleTypeParams(typeAnnotation);
3692
3749
  } else if (typeAnnotation) {
3693
- const id = t30.identifier("value");
3694
- id.typeAnnotation = t30.tsTypeAnnotation(typeAnnotation);
3750
+ const id = t31.identifier("value");
3751
+ id.typeAnnotation = t31.tsTypeAnnotation(typeAnnotation);
3695
3752
  params = [id];
3696
3753
  }
3697
- const fnType = t30.tsFunctionType(null, params, t30.tsTypeAnnotation(returnType));
3698
- const prop = t30.tsPropertySignature(key, t30.tsTypeAnnotation(fnType));
3754
+ const fnType = t31.tsFunctionType(null, params, t31.tsTypeAnnotation(returnType));
3755
+ const prop = t31.tsPropertySignature(key, t31.tsTypeAnnotation(fnType));
3699
3756
  prop.optional = !!member.optional;
3700
3757
  return prop;
3701
3758
  }
@@ -3704,32 +3761,32 @@ function resolveEmitPropsFromCallSignature(member) {
3704
3761
  }
3705
3762
  function resolveEmitPropsFromCallable(parameters, typeAnnotation) {
3706
3763
  const [eventParam, ...restParams] = parameters;
3707
- if (!eventParam || !t30.isIdentifier(eventParam) || !eventParam.typeAnnotation) {
3764
+ if (!eventParam || !t31.isIdentifier(eventParam) || !eventParam.typeAnnotation) {
3708
3765
  return [];
3709
3766
  }
3710
3767
  const { typeAnnotation: paramTypeAnnotation } = eventParam;
3711
- if (t30.isNoop(paramTypeAnnotation)) return [];
3768
+ if (t31.isNoop(paramTypeAnnotation)) return [];
3712
3769
  const eventNames = resolveEventNames(paramTypeAnnotation.typeAnnotation);
3713
3770
  if (!eventNames.length) return [];
3714
- const returnType = _nullishCoalesce(_optionalChain([typeAnnotation, 'optionalAccess', _114 => _114.typeAnnotation]), () => ( t30.tsAnyKeyword()));
3771
+ const returnType = _nullishCoalesce(_optionalChain([typeAnnotation, 'optionalAccess', _114 => _114.typeAnnotation]), () => ( t31.tsAnyKeyword()));
3715
3772
  return eventNames.map((eventName) => {
3716
3773
  const handlerName = resolveEmitHandlerName(eventName);
3717
3774
  const key = buildKey(handlerName);
3718
3775
  const params = cloneCallableParams(restParams);
3719
- const fnType = t30.tsFunctionType(null, params, t30.tsTypeAnnotation(returnType));
3720
- const prop = t30.tsPropertySignature(key, t30.tsTypeAnnotation(fnType));
3776
+ const fnType = t31.tsFunctionType(null, params, t31.tsTypeAnnotation(returnType));
3777
+ const prop = t31.tsPropertySignature(key, t31.tsTypeAnnotation(fnType));
3721
3778
  prop.optional = true;
3722
3779
  return prop;
3723
3780
  });
3724
3781
  }
3725
3782
  function resolveEventNames(type) {
3726
- if (t30.isTSLiteralType(type) && t30.isStringLiteral(type.literal)) {
3783
+ if (t31.isTSLiteralType(type) && t31.isStringLiteral(type.literal)) {
3727
3784
  return [type.literal.value];
3728
3785
  }
3729
- if (t30.isTSUnionType(type)) {
3786
+ if (t31.isTSUnionType(type)) {
3730
3787
  return type.types.flatMap(resolveEventNames);
3731
3788
  }
3732
- if (t30.isTSParenthesizedType(type)) {
3789
+ if (t31.isTSParenthesizedType(type)) {
3733
3790
  return resolveEventNames(type.typeAnnotation);
3734
3791
  }
3735
3792
  return [];
@@ -3742,39 +3799,39 @@ function resolveTupleTypeParams(tuple) {
3742
3799
  return params;
3743
3800
  }
3744
3801
  function resolveTupleElementParam(element, index) {
3745
- const isNamedTuple = typeof t30.isTSNamedTupleMember === "function" && t30.isTSNamedTupleMember(element);
3802
+ const isNamedTuple = typeof t31.isTSNamedTupleMember === "function" && t31.isTSNamedTupleMember(element);
3746
3803
  if (isNamedTuple) {
3747
3804
  const tupleMember = element;
3748
3805
  const name = _optionalChain([tupleMember, 'access', _115 => _115.label, 'optionalAccess', _116 => _116.name]) || `arg${index}`;
3749
3806
  let innerType = tupleMember.elementType;
3750
3807
  let optional = tupleMember.optional;
3751
- if (t30.isTSOptionalType(innerType)) {
3808
+ if (t31.isTSOptionalType(innerType)) {
3752
3809
  optional = true;
3753
3810
  innerType = innerType.typeAnnotation;
3754
3811
  }
3755
- if (t30.isTSRestType(innerType)) {
3756
- const rest = t30.restElement(t30.identifier(name));
3757
- rest.typeAnnotation = t30.tsTypeAnnotation(innerType.typeAnnotation);
3812
+ if (t31.isTSRestType(innerType)) {
3813
+ const rest = t31.restElement(t31.identifier(name));
3814
+ rest.typeAnnotation = t31.tsTypeAnnotation(innerType.typeAnnotation);
3758
3815
  return rest;
3759
3816
  }
3760
- const id2 = t30.identifier(name);
3817
+ const id2 = t31.identifier(name);
3761
3818
  id2.optional = optional;
3762
- id2.typeAnnotation = t30.tsTypeAnnotation(innerType);
3819
+ id2.typeAnnotation = t31.tsTypeAnnotation(innerType);
3763
3820
  return id2;
3764
3821
  }
3765
- if (t30.isTSRestType(element)) {
3766
- const rest = t30.restElement(t30.identifier(`args${index}`));
3767
- rest.typeAnnotation = t30.tsTypeAnnotation(element.typeAnnotation);
3822
+ if (t31.isTSRestType(element)) {
3823
+ const rest = t31.restElement(t31.identifier(`args${index}`));
3824
+ rest.typeAnnotation = t31.tsTypeAnnotation(element.typeAnnotation);
3768
3825
  return rest;
3769
3826
  }
3770
- if (t30.isTSOptionalType(element)) {
3771
- const id2 = t30.identifier(`arg${index}`);
3827
+ if (t31.isTSOptionalType(element)) {
3828
+ const id2 = t31.identifier(`arg${index}`);
3772
3829
  id2.optional = true;
3773
- id2.typeAnnotation = t30.tsTypeAnnotation(element.typeAnnotation);
3830
+ id2.typeAnnotation = t31.tsTypeAnnotation(element.typeAnnotation);
3774
3831
  return id2;
3775
3832
  }
3776
- const id = t30.identifier(`arg${index}`);
3777
- id.typeAnnotation = t30.tsTypeAnnotation(element);
3833
+ const id = t31.identifier(`arg${index}`);
3834
+ id.typeAnnotation = t31.tsTypeAnnotation(element);
3778
3835
  return id;
3779
3836
  }
3780
3837
 
@@ -3799,38 +3856,38 @@ function processInferredTypes2(ctx, runtimeArg) {
3799
3856
  } = scriptData;
3800
3857
  if (!runtimeArg) return;
3801
3858
  const members = [];
3802
- if (t31.isArrayExpression(runtimeArg)) {
3859
+ if (t32.isArrayExpression(runtimeArg)) {
3803
3860
  for (const element of runtimeArg.elements) {
3804
- if (!element || !t31.isStringLiteral(element)) continue;
3805
- const key = t31.isValidIdentifier(element.value) ? t31.identifier(element.value) : t31.stringLiteral(element.value);
3806
- const prop = t31.tsPropertySignature(key, t31.tsTypeAnnotation(t31.tsAnyKeyword()));
3861
+ if (!element || !t32.isStringLiteral(element)) continue;
3862
+ const key = t32.isValidIdentifier(element.value) ? t32.identifier(element.value) : t32.stringLiteral(element.value);
3863
+ const prop = t32.tsPropertySignature(key, t32.tsTypeAnnotation(t32.tsAnyKeyword()));
3807
3864
  prop.optional = true;
3808
3865
  members.push(prop);
3809
3866
  }
3810
3867
  if (members.length) {
3811
- propsTypes.push(t31.tsTypeLiteral(members));
3868
+ propsTypes.push(t32.tsTypeLiteral(members));
3812
3869
  }
3813
3870
  return;
3814
3871
  }
3815
- if (t31.isObjectExpression(runtimeArg)) {
3872
+ if (t32.isObjectExpression(runtimeArg)) {
3816
3873
  for (const prop of runtimeArg.properties) {
3817
- if (!t31.isObjectProperty(prop)) continue;
3818
- if (t31.isSpreadElement(prop)) continue;
3874
+ if (!t32.isObjectProperty(prop)) continue;
3875
+ if (t32.isSpreadElement(prop)) continue;
3819
3876
  const key = prop.key;
3820
3877
  let propName = null;
3821
- if (t31.isIdentifier(key)) propName = key.name;
3822
- if (t31.isStringLiteral(key)) propName = key.value;
3823
- if (t31.isNumericLiteral(key)) propName = String(key.value);
3878
+ if (t32.isIdentifier(key)) propName = key.name;
3879
+ if (t32.isStringLiteral(key)) propName = key.value;
3880
+ if (t32.isNumericLiteral(key)) propName = String(key.value);
3824
3881
  if (!propName) continue;
3825
3882
  const { type, required } = resolveRuntimePropMeta(prop.value);
3826
- const tsType = _nullishCoalesce(type, () => ( t31.tsAnyKeyword()));
3827
- const tsKey = t31.isValidIdentifier(propName) ? t31.identifier(propName) : t31.stringLiteral(propName);
3828
- const tsProp = t31.tsPropertySignature(tsKey, t31.tsTypeAnnotation(tsType));
3883
+ const tsType = _nullishCoalesce(type, () => ( t32.tsAnyKeyword()));
3884
+ const tsKey = t32.isValidIdentifier(propName) ? t32.identifier(propName) : t32.stringLiteral(propName);
3885
+ const tsProp = t32.tsPropertySignature(tsKey, t32.tsTypeAnnotation(tsType));
3829
3886
  tsProp.optional = !required;
3830
3887
  members.push(tsProp);
3831
3888
  }
3832
3889
  if (members.length) {
3833
- propsTypes.push(t31.tsTypeLiteral(members));
3890
+ propsTypes.push(t32.tsTypeLiteral(members));
3834
3891
  }
3835
3892
  return;
3836
3893
  }
@@ -3844,42 +3901,42 @@ function processInferredTypes2(ctx, runtimeArg) {
3844
3901
  );
3845
3902
  }
3846
3903
  function resolveRuntimePropMeta(value) {
3847
- if (t31.isIdentifier(value)) {
3904
+ if (t32.isIdentifier(value)) {
3848
3905
  return {
3849
3906
  type: mapRuntimeTypeToTSType(value),
3850
3907
  required: false
3851
3908
  };
3852
3909
  }
3853
- if (t31.isArrayExpression(value)) {
3910
+ if (t32.isArrayExpression(value)) {
3854
3911
  return {
3855
3912
  type: resolveRuntimeUnionType(value),
3856
3913
  required: false
3857
3914
  };
3858
3915
  }
3859
- if (!t31.isObjectExpression(value)) {
3916
+ if (!t32.isObjectExpression(value)) {
3860
3917
  return { required: false };
3861
3918
  }
3862
3919
  let type;
3863
3920
  let required = false;
3864
3921
  for (const prop of value.properties) {
3865
- if (!t31.isObjectProperty(prop)) continue;
3866
- if (t31.isSpreadElement(prop)) continue;
3922
+ if (!t32.isObjectProperty(prop)) continue;
3923
+ if (t32.isSpreadElement(prop)) continue;
3867
3924
  const key = prop.key;
3868
- const propName = t31.isIdentifier(key) ? key.name : t31.isStringLiteral(key) ? key.value : null;
3925
+ const propName = t32.isIdentifier(key) ? key.name : t32.isStringLiteral(key) ? key.value : null;
3869
3926
  if (!propName) continue;
3870
3927
  if (propName === "type") {
3871
3928
  const valueNode = prop.value;
3872
- if (t31.isArrayExpression(valueNode)) {
3929
+ if (t32.isArrayExpression(valueNode)) {
3873
3930
  type = resolveRuntimeUnionType(valueNode);
3874
3931
  continue;
3875
3932
  }
3876
- if (t31.isIdentifier(valueNode)) {
3933
+ if (t32.isIdentifier(valueNode)) {
3877
3934
  type = mapRuntimeTypeToTSType(valueNode);
3878
3935
  continue;
3879
3936
  }
3880
3937
  }
3881
3938
  if (propName === "required") {
3882
- if (t31.isBooleanLiteral(prop.value)) {
3939
+ if (t32.isBooleanLiteral(prop.value)) {
3883
3940
  required = prop.value.value;
3884
3941
  }
3885
3942
  }
@@ -3889,34 +3946,34 @@ function resolveRuntimePropMeta(value) {
3889
3946
  function resolveRuntimeUnionType(value) {
3890
3947
  const types = [];
3891
3948
  for (const element of value.elements) {
3892
- if (!element || !t31.isIdentifier(element)) continue;
3949
+ if (!element || !t32.isIdentifier(element)) continue;
3893
3950
  const resolved = mapRuntimeTypeToTSType(element);
3894
3951
  if (resolved) types.push(resolved);
3895
3952
  }
3896
- if (!types.length) return t31.tsAnyKeyword();
3953
+ if (!types.length) return t32.tsAnyKeyword();
3897
3954
  if (types.length === 1) return types[0];
3898
- return t31.tsUnionType(types);
3955
+ return t32.tsUnionType(types);
3899
3956
  }
3900
3957
  function mapRuntimeTypeToTSType(value) {
3901
3958
  switch (value.name) {
3902
3959
  case "String":
3903
- return t31.tsStringKeyword();
3960
+ return t32.tsStringKeyword();
3904
3961
  case "Number":
3905
- return t31.tsNumberKeyword();
3962
+ return t32.tsNumberKeyword();
3906
3963
  case "Boolean":
3907
- return t31.tsBooleanKeyword();
3964
+ return t32.tsBooleanKeyword();
3908
3965
  case "Object":
3909
- return t31.tsTypeLiteral([]);
3966
+ return t32.tsTypeLiteral([]);
3910
3967
  case "Array":
3911
- return t31.tsArrayType(t31.tsAnyKeyword());
3968
+ return t32.tsArrayType(t32.tsAnyKeyword());
3912
3969
  case "Function":
3913
- return t31.tsFunctionType(null, [], t31.tsTypeAnnotation(t31.tsAnyKeyword()));
3970
+ return t32.tsFunctionType(null, [], t32.tsTypeAnnotation(t32.tsAnyKeyword()));
3914
3971
  case "Symbol":
3915
- return t31.tsSymbolKeyword();
3972
+ return t32.tsSymbolKeyword();
3916
3973
  case "BigInt":
3917
- return t31.tsBigIntKeyword();
3974
+ return t32.tsBigIntKeyword();
3918
3975
  default:
3919
- return t31.tsAnyKeyword();
3976
+ return t32.tsAnyKeyword();
3920
3977
  }
3921
3978
  }
3922
3979
 
@@ -3930,34 +3987,34 @@ var SLOT_CHILDREN_NAME = "children";
3930
3987
  var SLOT_FN_PARAM_NAME = "props";
3931
3988
  function buildSlotPropSignature(rawName, params, optional) {
3932
3989
  const propName = rawName === SLOT_DEFAULT_NAME ? SLOT_CHILDREN_NAME : rawName;
3933
- const key = t32.isValidIdentifier(propName) ? t32.identifier(propName) : t32.stringLiteral(propName);
3934
- const reactNodeType = t32.tsTypeAnnotation(
3935
- t32.tsTypeReference(t32.identifier(REACT_API_MAP.ReactNode))
3990
+ const key = t33.isValidIdentifier(propName) ? t33.identifier(propName) : t33.stringLiteral(propName);
3991
+ const reactNodeType = t33.tsTypeAnnotation(
3992
+ t33.tsTypeReference(t33.identifier(REACT_API_MAP.ReactNode))
3936
3993
  );
3937
3994
  let typeAnnotation;
3938
3995
  if (rawName === SLOT_DEFAULT_NAME && params.length === 0 || params.length === 0) {
3939
3996
  typeAnnotation = reactNodeType;
3940
3997
  } else {
3941
- const fnType = t32.tsFunctionType(null, params, reactNodeType);
3942
- typeAnnotation = t32.tsTypeAnnotation(fnType);
3998
+ const fnType = t33.tsFunctionType(null, params, reactNodeType);
3999
+ typeAnnotation = t33.tsTypeAnnotation(fnType);
3943
4000
  }
3944
- const prop = t32.tsPropertySignature(key, typeAnnotation);
4001
+ const prop = t33.tsPropertySignature(key, typeAnnotation);
3945
4002
  prop.optional = optional;
3946
4003
  return prop;
3947
4004
  }
3948
4005
  function createSlotScopeParam(props, ctx) {
3949
- const paramId = t32.identifier(SLOT_FN_PARAM_NAME);
4006
+ const paramId = t33.identifier(SLOT_FN_PARAM_NAME);
3950
4007
  const propsSigns = [];
3951
4008
  const { reactiveBindings } = ctx.templateData;
3952
4009
  props.forEach(({ prop, tsType }) => {
3953
4010
  const foundBindingValue = _optionalChain([reactiveBindings, 'access', _121 => _121[prop], 'optionalAccess', _122 => _122.value]);
3954
4011
  const foundBindingTypes = foundBindingValue ? expressionToTSType(foundBindingValue) : null;
3955
- const typeAnnotation = foundBindingTypes ? t32.tsTypeAnnotation(foundBindingTypes) : tsType;
3956
- const key = t32.isValidIdentifier(prop) ? t32.identifier(prop) : t32.stringLiteral(prop);
3957
- const propSign = t32.tsPropertySignature(key, typeAnnotation);
4012
+ const typeAnnotation = foundBindingTypes ? t33.tsTypeAnnotation(foundBindingTypes) : tsType;
4013
+ const key = t33.isValidIdentifier(prop) ? t33.identifier(prop) : t33.stringLiteral(prop);
4014
+ const propSign = t33.tsPropertySignature(key, typeAnnotation);
3958
4015
  propsSigns.push(propSign);
3959
4016
  });
3960
- paramId.typeAnnotation = t32.tsTypeAnnotation(t32.tsTypeLiteral(propsSigns));
4017
+ paramId.typeAnnotation = t33.tsTypeAnnotation(t33.tsTypeLiteral(propsSigns));
3961
4018
  return paramId;
3962
4019
  }
3963
4020
 
@@ -3978,16 +4035,16 @@ function collectLocalTypeDeclarations(path8) {
3978
4035
  return declarations;
3979
4036
  }
3980
4037
  for (const statement of programPath.node.body) {
3981
- if (t33.isTSInterfaceDeclaration(statement)) {
4038
+ if (t34.isTSInterfaceDeclaration(statement)) {
3982
4039
  declarations.set(statement.id.name, {
3983
- type: t33.tsTypeLiteral(statement.body.body),
4040
+ type: t34.tsTypeLiteral(statement.body.body),
3984
4041
  // 将接口体转换为类型字面量
3985
4042
  hasTypeParameters: !!_optionalChain([statement, 'access', _123 => _123.typeParameters, 'optionalAccess', _124 => _124.params, 'access', _125 => _125.length])
3986
4043
  // 检查是否有泛型参数
3987
4044
  });
3988
4045
  continue;
3989
4046
  }
3990
- if (t33.isTSTypeAliasDeclaration(statement)) {
4047
+ if (t34.isTSTypeAliasDeclaration(statement)) {
3991
4048
  declarations.set(statement.id.name, {
3992
4049
  type: statement.typeAnnotation,
3993
4050
  // 直接使用类型注解
@@ -3996,16 +4053,16 @@ function collectLocalTypeDeclarations(path8) {
3996
4053
  });
3997
4054
  continue;
3998
4055
  }
3999
- if (t33.isExportNamedDeclaration(statement) && statement.declaration) {
4056
+ if (t34.isExportNamedDeclaration(statement) && statement.declaration) {
4000
4057
  const declaration = statement.declaration;
4001
- if (t33.isTSInterfaceDeclaration(declaration)) {
4058
+ if (t34.isTSInterfaceDeclaration(declaration)) {
4002
4059
  declarations.set(declaration.id.name, {
4003
- type: t33.tsTypeLiteral(declaration.body.body),
4060
+ type: t34.tsTypeLiteral(declaration.body.body),
4004
4061
  // 将接口体转换为类型字面量
4005
4062
  hasTypeParameters: !!_optionalChain([declaration, 'access', _129 => _129.typeParameters, 'optionalAccess', _130 => _130.params, 'access', _131 => _131.length])
4006
4063
  // 检查是否有泛型参数
4007
4064
  });
4008
- } else if (t33.isTSTypeAliasDeclaration(declaration)) {
4065
+ } else if (t34.isTSTypeAliasDeclaration(declaration)) {
4009
4066
  declarations.set(declaration.id.name, {
4010
4067
  type: declaration.typeAnnotation,
4011
4068
  // 直接使用类型注解
@@ -4018,22 +4075,22 @@ function collectLocalTypeDeclarations(path8) {
4018
4075
  return declarations;
4019
4076
  }
4020
4077
  function resolvePropName2(key) {
4021
- if (t33.isIdentifier(key)) {
4078
+ if (t34.isIdentifier(key)) {
4022
4079
  return key.name;
4023
4080
  }
4024
- if (t33.isStringLiteral(key)) {
4081
+ if (t34.isStringLiteral(key)) {
4025
4082
  return key.value;
4026
4083
  }
4027
- if (t33.isNumericLiteral(key)) {
4084
+ if (t34.isNumericLiteral(key)) {
4028
4085
  return String(key.value);
4029
4086
  }
4030
4087
  return null;
4031
4088
  }
4032
4089
  function resolveCallableType(tsType) {
4033
- if (t33.isTSFunctionType(tsType)) {
4090
+ if (t34.isTSFunctionType(tsType)) {
4034
4091
  return tsType;
4035
4092
  }
4036
- if (t33.isTSParenthesizedType(tsType)) {
4093
+ if (t34.isTSParenthesizedType(tsType)) {
4037
4094
  return resolveCallableType(tsType.typeAnnotation);
4038
4095
  }
4039
4096
  return null;
@@ -4042,10 +4099,10 @@ function resolveCallableType(tsType) {
4042
4099
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-props-interface/resolve-slot/type-resolver.ts
4043
4100
  var SLOT_DEFAULT_NAME2 = "default";
4044
4101
  function resolveSlotType(tsType, options) {
4045
- if (t34.isTSParenthesizedType(tsType)) {
4102
+ if (t35.isTSParenthesizedType(tsType)) {
4046
4103
  return resolveSlotType(tsType.typeAnnotation, options);
4047
4104
  }
4048
- if (t34.isTSTypeReference(tsType)) {
4105
+ if (t35.isTSTypeReference(tsType)) {
4049
4106
  let shouldRecordReactNode = false;
4050
4107
  if (_optionalChain([tsType, 'access', _135 => _135.typeParameters, 'optionalAccess', _136 => _136.params, 'access', _137 => _137.length])) {
4051
4108
  const params = [];
@@ -4061,11 +4118,11 @@ function resolveSlotType(tsType, options) {
4061
4118
  };
4062
4119
  }
4063
4120
  return {
4064
- type: t34.tsTypeReference(tsType.typeName, t34.tsTypeParameterInstantiation(params)),
4121
+ type: t35.tsTypeReference(tsType.typeName, t35.tsTypeParameterInstantiation(params)),
4065
4122
  shouldRecordReactNode
4066
4123
  };
4067
4124
  }
4068
- if (!t34.isIdentifier(tsType.typeName)) {
4125
+ if (!t35.isIdentifier(tsType.typeName)) {
4069
4126
  return {
4070
4127
  type: tsType,
4071
4128
  shouldRecordReactNode: false
@@ -4096,7 +4153,7 @@ function resolveSlotType(tsType, options) {
4096
4153
  }
4097
4154
  return resolved;
4098
4155
  }
4099
- if (t34.isTSIntersectionType(tsType)) {
4156
+ if (t35.isTSIntersectionType(tsType)) {
4100
4157
  const types = [];
4101
4158
  let shouldRecordReactNode = false;
4102
4159
  for (const item of tsType.types) {
@@ -4119,11 +4176,11 @@ function resolveSlotType(tsType, options) {
4119
4176
  };
4120
4177
  }
4121
4178
  return {
4122
- type: t34.tsIntersectionType(types),
4179
+ type: t35.tsIntersectionType(types),
4123
4180
  shouldRecordReactNode
4124
4181
  };
4125
4182
  }
4126
- if (t34.isTSUnionType(tsType)) {
4183
+ if (t35.isTSUnionType(tsType)) {
4127
4184
  const types = [];
4128
4185
  let shouldRecordReactNode = false;
4129
4186
  for (const item of tsType.types) {
@@ -4146,11 +4203,11 @@ function resolveSlotType(tsType, options) {
4146
4203
  };
4147
4204
  }
4148
4205
  return {
4149
- type: t34.tsUnionType(types),
4206
+ type: t35.tsUnionType(types),
4150
4207
  shouldRecordReactNode
4151
4208
  };
4152
4209
  }
4153
- if (t34.isTSTypeLiteral(tsType)) {
4210
+ if (t35.isTSTypeLiteral(tsType)) {
4154
4211
  const members = [];
4155
4212
  let shouldRecordReactNode = false;
4156
4213
  for (const item of tsType.members) {
@@ -4165,11 +4222,11 @@ function resolveSlotType(tsType, options) {
4165
4222
  };
4166
4223
  }
4167
4224
  return {
4168
- type: t34.tsTypeLiteral(members),
4225
+ type: t35.tsTypeLiteral(members),
4169
4226
  shouldRecordReactNode
4170
4227
  };
4171
4228
  }
4172
- if (t34.isTSFunctionType(tsType)) {
4229
+ if (t35.isTSFunctionType(tsType)) {
4173
4230
  const props = buildSlotPropSignature(
4174
4231
  SLOT_DEFAULT_NAME2,
4175
4232
  cloneCallableParams(tsType.parameters),
@@ -4177,7 +4234,7 @@ function resolveSlotType(tsType, options) {
4177
4234
  // 默认插槽不是可选的
4178
4235
  );
4179
4236
  return {
4180
- type: t34.tsTypeLiteral([props]),
4237
+ type: t35.tsTypeLiteral([props]),
4181
4238
  shouldRecordReactNode: true
4182
4239
  // 函数类型总是需要记录 ReactNode
4183
4240
  };
@@ -4188,7 +4245,7 @@ function resolveSlotType(tsType, options) {
4188
4245
  };
4189
4246
  }
4190
4247
  function resolveSlotPropFromMember(member) {
4191
- if (t34.isTSMethodSignature(member)) {
4248
+ if (t35.isTSMethodSignature(member)) {
4192
4249
  const rawName = resolvePropName2(member.key);
4193
4250
  if (!rawName) {
4194
4251
  return {
@@ -4203,7 +4260,7 @@ function resolveSlotPropFromMember(member) {
4203
4260
  // 方法签名总是可调用,需要记录 ReactNode
4204
4261
  };
4205
4262
  }
4206
- if (t34.isTSPropertySignature(member)) {
4263
+ if (t35.isTSPropertySignature(member)) {
4207
4264
  const rawName = resolvePropName2(member.key);
4208
4265
  if (!rawName) {
4209
4266
  return {
@@ -4226,7 +4283,7 @@ function resolveSlotPropFromMember(member) {
4226
4283
  // 可调用属性需要记录 ReactNode
4227
4284
  };
4228
4285
  }
4229
- if (t34.isTSCallSignatureDeclaration(member)) {
4286
+ if (t35.isTSCallSignatureDeclaration(member)) {
4230
4287
  const params = cloneCallableParams(member.parameters);
4231
4288
  return {
4232
4289
  member: buildSlotPropSignature(SLOT_DEFAULT_NAME2, params, true),
@@ -4284,7 +4341,7 @@ function resolveTemplateSlotIface(ctx) {
4284
4341
  }
4285
4342
  if (tsMembers.length) {
4286
4343
  recordReactNode(ctx);
4287
- slotTypes.push(t35.tsTypeLiteral(tsMembers));
4344
+ slotTypes.push(t36.tsTypeLiteral(tsMembers));
4288
4345
  }
4289
4346
  }
4290
4347
 
@@ -4336,9 +4393,9 @@ function resolveCompIProps(ctx, ast) {
4336
4393
  }
4337
4394
  const n = declaredOptions.name || "Comp";
4338
4395
  const ns = `I${camelCase(capitalize(n))}Props`;
4339
- const typeNode = t36.tsIntersectionType(tsTypes);
4340
- const typeAliasDecl = t36.tsTypeAliasDeclaration(t36.identifier(ns), null, typeNode);
4341
- const exportDecl = t36.exportNamedDeclaration(typeAliasDecl);
4396
+ const typeNode = t37.tsIntersectionType(tsTypes);
4397
+ const typeAliasDecl = t37.tsTypeAliasDeclaration(t37.identifier(ns), null, typeNode);
4398
+ const exportDecl = t37.exportNamedDeclaration(typeAliasDecl);
4342
4399
  propsTSIface.name = ns;
4343
4400
  const scriptIR = getScriptIR(ctx);
4344
4401
  scriptIR.exports.push(exportDecl);
@@ -4353,8 +4410,8 @@ function resolveUseAttrs(ctx) {
4353
4410
  const { init, id } = path8.node;
4354
4411
  if (!init) return;
4355
4412
  const initPath = path8.get("init");
4356
- const propsIdentifier = t37.identifier(ctx.propField);
4357
- if (t37.isTSAsExpression(init) && isUseAttrsCall(init.expression)) {
4413
+ const propsIdentifier = t38.identifier(ctx.propField);
4414
+ if (t38.isTSAsExpression(init) && isUseAttrsCall(init.expression)) {
4358
4415
  const typeAssertion = createPropsTypeAssertion(propsIdentifier, init.typeAnnotation);
4359
4416
  replaceNode(initPath, typeAssertion, init);
4360
4417
  return;
@@ -4365,13 +4422,13 @@ function resolveUseAttrs(ctx) {
4365
4422
  const isTS = ctx.scriptData.lang.startsWith("ts");
4366
4423
  if (isTS) {
4367
4424
  let typeAnnotation = null;
4368
- if (t37.isIdentifier(id) && t37.isTSTypeAnnotation(id.typeAnnotation)) {
4425
+ if (t38.isIdentifier(id) && t38.isTSTypeAnnotation(id.typeAnnotation)) {
4369
4426
  typeAnnotation = id.typeAnnotation.typeAnnotation;
4370
4427
  id.typeAnnotation = null;
4371
4428
  } else {
4372
- typeAnnotation = t37.tsTypeReference(
4373
- t37.identifier("Record"),
4374
- t37.tsTypeParameterInstantiation([t37.tsStringKeyword(), t37.tsUnknownKeyword()])
4429
+ typeAnnotation = t38.tsTypeReference(
4430
+ t38.identifier("Record"),
4431
+ t38.tsTypeParameterInstantiation([t38.tsStringKeyword(), t38.tsUnknownKeyword()])
4375
4432
  );
4376
4433
  }
4377
4434
  const propsTypeAssertion = createPropsTypeAssertion(propsIdentifier, typeAnnotation);
@@ -4383,10 +4440,10 @@ function resolveUseAttrs(ctx) {
4383
4440
  };
4384
4441
  }
4385
4442
  function isUseAttrsCall(expr) {
4386
- return t37.isCallExpression(expr) && isCalleeNamed(expr, VUE_API_MAP.useAttrs);
4443
+ return t38.isCallExpression(expr) && isCalleeNamed(expr, VUE_API_MAP.useAttrs);
4387
4444
  }
4388
4445
  function createPropsTypeAssertion(propsIdentifier, typeAnnotation) {
4389
- return t37.tsAsExpression(propsIdentifier, typeAnnotation);
4446
+ return t38.tsAsExpression(propsIdentifier, typeAnnotation);
4390
4447
  }
4391
4448
 
4392
4449
  // src/core/transform/sfc/script/syntax-processor/process/resolve-analysis-only-adapter.ts
@@ -4423,39 +4480,39 @@ function isEligibleBindingSource(binding) {
4423
4480
  const declaratorPath = getVariableDeclaratorPath(bindingPath);
4424
4481
  const isReactiveVarBinding = !!declaratorPath && isReactiveBinding(declaratorPath.node);
4425
4482
  const nodeInit = _optionalChain([declaratorPath, 'optionalAccess', _145 => _145.node, 'access', _146 => _146.init]);
4426
- const isReactiveApiCallVarBinding = !!declaratorPath && t38.isCallExpression(nodeInit) && t38.isIdentifier(nodeInit.callee) && reactiveStateApis.has(nodeInit.callee.name);
4427
- const isHookCallVarBinding = !!declaratorPath && t38.isCallExpression(nodeInit) && isHookLikeCallee(nodeInit.callee);
4428
- const isFunctionBinding = bindingPath.isFunctionDeclaration() || !!declaratorPath && !!nodeInit && (t38.isArrowFunctionExpression(nodeInit) || t38.isFunctionExpression(nodeInit));
4483
+ const isReactiveApiCallVarBinding = !!declaratorPath && t39.isCallExpression(nodeInit) && t39.isIdentifier(nodeInit.callee) && reactiveStateApis.has(nodeInit.callee.name);
4484
+ const isHookCallVarBinding = !!declaratorPath && t39.isCallExpression(nodeInit) && isHookLikeCallee(nodeInit.callee);
4485
+ const isFunctionBinding = bindingPath.isFunctionDeclaration() || !!declaratorPath && !!nodeInit && (t39.isArrowFunctionExpression(nodeInit) || t39.isFunctionExpression(nodeInit));
4429
4486
  const isReactiveFunctionBinding = isFunctionBinding && (isReactiveBinding(_optionalChain([declaratorPath, 'optionalAccess', _147 => _147.node])) || isReactiveBinding(bindingPath.node));
4430
4487
  return isReactiveVarBinding || isReactiveApiCallVarBinding || isHookCallVarBinding || isReactiveFunctionBinding;
4431
4488
  }
4432
4489
  function isReactValidDependencyExpr(node) {
4433
- if (t38.isIdentifier(node)) {
4490
+ if (t39.isIdentifier(node)) {
4434
4491
  return true;
4435
4492
  }
4436
- if (t38.isMemberExpression(node) || t38.isOptionalMemberExpression(node)) {
4493
+ if (t39.isMemberExpression(node) || t39.isOptionalMemberExpression(node)) {
4437
4494
  return isStaticMemberChain(node);
4438
4495
  }
4439
4496
  return false;
4440
4497
  }
4441
4498
  function isStaticMemberChain(node) {
4442
4499
  let current = node;
4443
- while (t38.isMemberExpression(current) || t38.isOptionalMemberExpression(current)) {
4444
- if (!current.computed && !t38.isIdentifier(current.property)) {
4500
+ while (t39.isMemberExpression(current) || t39.isOptionalMemberExpression(current)) {
4501
+ if (!current.computed && !t39.isIdentifier(current.property)) {
4445
4502
  return false;
4446
4503
  }
4447
- if (current.computed && !t38.isStringLiteral(current.property) && !t38.isNumericLiteral(current.property)) {
4504
+ if (current.computed && !t39.isStringLiteral(current.property) && !t39.isNumericLiteral(current.property)) {
4448
4505
  return false;
4449
4506
  }
4450
4507
  current = current.object;
4451
4508
  }
4452
- return t38.isIdentifier(current);
4509
+ return t39.isIdentifier(current);
4453
4510
  }
4454
4511
  function isHookLikeCallee(callee) {
4455
- if (t38.isIdentifier(callee)) {
4512
+ if (t39.isIdentifier(callee)) {
4456
4513
  return callee.name.startsWith("use");
4457
4514
  }
4458
- if (t38.isMemberExpression(callee) && !callee.computed && t38.isIdentifier(callee.property)) {
4515
+ if (t39.isMemberExpression(callee) && !callee.computed && t39.isIdentifier(callee.property)) {
4459
4516
  return callee.property.name.startsWith("use");
4460
4517
  }
4461
4518
  return false;
@@ -4464,16 +4521,16 @@ function isHookLikeCallee(callee) {
4464
4521
  // src/core/transform/sfc/script/shared/dependency-analyzer/dep-key.ts
4465
4522
 
4466
4523
  function getDependencyKey(exp) {
4467
- if (t39.isIdentifier(exp)) {
4524
+ if (t40.isIdentifier(exp)) {
4468
4525
  return exp.name;
4469
4526
  }
4470
- if (t39.isMemberExpression(exp) || t39.isOptionalMemberExpression(exp)) {
4527
+ if (t40.isMemberExpression(exp) || t40.isOptionalMemberExpression(exp)) {
4471
4528
  const objectKey = getDependencyKey(exp.object);
4472
4529
  const opt = exp.optional ? "?" : "";
4473
- if (!exp.computed && t39.isIdentifier(exp.property)) {
4530
+ if (!exp.computed && t40.isIdentifier(exp.property)) {
4474
4531
  return `${objectKey}${opt}.${exp.property.name}`;
4475
4532
  }
4476
- if (t39.isStringLiteral(exp.property) || t39.isNumericLiteral(exp.property)) {
4533
+ if (t40.isStringLiteral(exp.property) || t40.isNumericLiteral(exp.property)) {
4477
4534
  return `${objectKey}${opt}[${JSON.stringify(exp.property.value)}]`;
4478
4535
  }
4479
4536
  return `${objectKey}${opt}[*]`;
@@ -4484,38 +4541,38 @@ function getDependencyKey(exp) {
4484
4541
  // src/core/transform/sfc/script/shared/dependency-analyzer/dep-normalizer.ts
4485
4542
 
4486
4543
  function normalizeDependencyExpr(path8, rootName, ctx) {
4487
- if (t40.isIdentifier(path8.node)) {
4488
- return t40.identifier(path8.node.name);
4544
+ if (t41.isIdentifier(path8.node)) {
4545
+ return t41.identifier(path8.node.name);
4489
4546
  }
4490
- if (t40.isMemberExpression(path8.node) || t40.isOptionalMemberExpression(path8.node)) {
4547
+ if (t41.isMemberExpression(path8.node) || t41.isOptionalMemberExpression(path8.node)) {
4491
4548
  if (rootName === ctx.propField) {
4492
4549
  const safePropsExp = ensureOptionalForMemberChain(path8.node);
4493
4550
  if (isReactValidDependencyExpr(safePropsExp)) {
4494
- return t40.cloneNode(safePropsExp, true);
4551
+ return t41.cloneNode(safePropsExp, true);
4495
4552
  }
4496
- return t40.identifier(rootName);
4553
+ return t41.identifier(rootName);
4497
4554
  }
4498
4555
  const normalizedExp = normalizeMemberForCallSite(path8, path8.node);
4499
- const safeExp = t40.isMemberExpression(normalizedExp) || t40.isOptionalMemberExpression(normalizedExp) ? ensureOptionalForMemberChain(normalizedExp) : normalizedExp;
4556
+ const safeExp = t41.isMemberExpression(normalizedExp) || t41.isOptionalMemberExpression(normalizedExp) ? ensureOptionalForMemberChain(normalizedExp) : normalizedExp;
4500
4557
  if (isReactValidDependencyExpr(safeExp)) {
4501
- return t40.cloneNode(safeExp, true);
4558
+ return t41.cloneNode(safeExp, true);
4502
4559
  }
4503
- return t40.identifier(rootName);
4560
+ return t41.identifier(rootName);
4504
4561
  }
4505
4562
  return null;
4506
4563
  }
4507
4564
  function normalizeSourcedDependency(exp) {
4508
- if (t40.isIdentifier(exp)) {
4509
- return t40.identifier(exp.name);
4565
+ if (t41.isIdentifier(exp)) {
4566
+ return t41.identifier(exp.name);
4510
4567
  }
4511
- if (t40.isMemberExpression(exp) || t40.isOptionalMemberExpression(exp)) {
4568
+ if (t41.isMemberExpression(exp) || t41.isOptionalMemberExpression(exp)) {
4512
4569
  const root = findRootIdentifier(exp);
4513
4570
  if (!root) return null;
4514
- const safeExp = t40.isMemberExpression(exp) || t40.isOptionalMemberExpression(exp) ? ensureOptionalForMemberChain(exp) : exp;
4571
+ const safeExp = t41.isMemberExpression(exp) || t41.isOptionalMemberExpression(exp) ? ensureOptionalForMemberChain(exp) : exp;
4515
4572
  if (isReactValidDependencyExpr(safeExp)) {
4516
- return t40.cloneNode(safeExp, true);
4573
+ return t41.cloneNode(safeExp, true);
4517
4574
  }
4518
- return t40.identifier(root.name);
4575
+ return t41.identifier(root.name);
4519
4576
  }
4520
4577
  return null;
4521
4578
  }
@@ -4525,7 +4582,7 @@ function normalizeMemberForCallSite(path8, node) {
4525
4582
  if (!isDirectCallee) {
4526
4583
  return node;
4527
4584
  }
4528
- if (!t40.isExpression(node.object)) {
4585
+ if (!t41.isExpression(node.object)) {
4529
4586
  return node;
4530
4587
  }
4531
4588
  return node.object;
@@ -4534,15 +4591,23 @@ function ensureOptionalForMemberChain(node) {
4534
4591
  if (!hasTrailingMemberAccess(node)) {
4535
4592
  return node;
4536
4593
  }
4537
- if (t40.isOptionalMemberExpression(node) && node.optional) {
4538
- return node;
4539
- }
4540
- const object = t40.cloneNode(node.object, true);
4541
- const property = t40.cloneNode(node.property, true);
4542
- return t40.optionalMemberExpression(object, property, node.computed, true);
4594
+ const rebuildWithOptionalChain = (node2) => {
4595
+ const safeObject = ensureOptionalForMemberChain(node2.object);
4596
+ if (safeObject !== node2.object) {
4597
+ const property = t41.cloneNode(node2.property, true);
4598
+ return t41.optionalMemberExpression(safeObject, property, node2.computed, true);
4599
+ }
4600
+ if (t41.isMemberExpression(node2)) {
4601
+ const object = t41.cloneNode(node2.object, true);
4602
+ const property = t41.cloneNode(node2.property, true);
4603
+ return t41.optionalMemberExpression(object, property, node2.computed, true);
4604
+ }
4605
+ return node2;
4606
+ };
4607
+ return rebuildWithOptionalChain(node);
4543
4608
  }
4544
4609
  function hasTrailingMemberAccess(node) {
4545
- return t40.isMemberExpression(node.object) || t40.isOptionalMemberExpression(node.object);
4610
+ return t41.isMemberExpression(node.object) || t41.isOptionalMemberExpression(node.object);
4546
4611
  }
4547
4612
 
4548
4613
  // src/core/transform/sfc/script/shared/dependency-analyzer/shared-utils.ts
@@ -4569,7 +4634,7 @@ function traceBindingSource(binding, seen, depth) {
4569
4634
  }
4570
4635
  function isExpressionSourcedFromEligibleBinding(exp, scope, seen, depth) {
4571
4636
  if (depth <= 0) return null;
4572
- if (t41.isIdentifier(exp)) {
4637
+ if (t42.isIdentifier(exp)) {
4573
4638
  const sourceBinding = scope.getBinding(exp.name);
4574
4639
  if (!sourceBinding) return null;
4575
4640
  if (isEligibleBindingSource(sourceBinding)) {
@@ -4577,13 +4642,13 @@ function isExpressionSourcedFromEligibleBinding(exp, scope, seen, depth) {
4577
4642
  }
4578
4643
  return traceBindingSource(sourceBinding, seen, depth - 1);
4579
4644
  }
4580
- if (t41.isMemberExpression(exp) || t41.isOptionalMemberExpression(exp)) {
4645
+ if (t42.isMemberExpression(exp) || t42.isOptionalMemberExpression(exp)) {
4581
4646
  const root = findRootIdentifier(exp);
4582
4647
  if (!root) return null;
4583
4648
  const sourceBinding = scope.getBinding(root.name);
4584
4649
  if (!sourceBinding) return null;
4585
4650
  if (isEligibleBindingSource(sourceBinding)) {
4586
- return t41.cloneNode(exp);
4651
+ return t42.cloneNode(exp);
4587
4652
  }
4588
4653
  const sourcedRoot = traceBindingSource(sourceBinding, seen, depth - 1);
4589
4654
  if (sourcedRoot) {
@@ -4591,17 +4656,17 @@ function isExpressionSourcedFromEligibleBinding(exp, scope, seen, depth) {
4591
4656
  if (rebuilt) {
4592
4657
  return rebuilt;
4593
4658
  }
4594
- return t41.cloneNode(sourcedRoot, true);
4659
+ return t42.cloneNode(sourcedRoot, true);
4595
4660
  }
4596
4661
  }
4597
4662
  return null;
4598
4663
  }
4599
4664
  function rebuildMemberWithNewRoot(node, nextRoot) {
4600
4665
  const replacedObject = (() => {
4601
- if (t41.isIdentifier(node.object)) {
4602
- return t41.cloneNode(nextRoot, true);
4666
+ if (t42.isIdentifier(node.object)) {
4667
+ return t42.cloneNode(nextRoot, true);
4603
4668
  }
4604
- if (t41.isMemberExpression(node.object) || t41.isOptionalMemberExpression(node.object)) {
4669
+ if (t42.isMemberExpression(node.object) || t42.isOptionalMemberExpression(node.object)) {
4605
4670
  return rebuildMemberWithNewRoot(node.object, nextRoot);
4606
4671
  }
4607
4672
  return null;
@@ -4609,15 +4674,15 @@ function rebuildMemberWithNewRoot(node, nextRoot) {
4609
4674
  if (!replacedObject) {
4610
4675
  return null;
4611
4676
  }
4612
- const property = t41.cloneNode(node.property, true);
4613
- if (t41.isMemberExpression(node)) {
4614
- return t41.memberExpression(
4677
+ const property = t42.cloneNode(node.property, true);
4678
+ if (t42.isMemberExpression(node)) {
4679
+ return t42.memberExpression(
4615
4680
  replacedObject,
4616
4681
  property,
4617
4682
  node.computed
4618
4683
  );
4619
4684
  }
4620
- return t41.optionalMemberExpression(
4685
+ return t42.optionalMemberExpression(
4621
4686
  replacedObject,
4622
4687
  property,
4623
4688
  node.computed,
@@ -4628,9 +4693,9 @@ function rebuildMemberWithNewRoot(node, nextRoot) {
4628
4693
  // src/core/transform/sfc/script/shared/dependency-analyzer/index.ts
4629
4694
  function analyzeDeps(node, ctx, parentPath) {
4630
4695
  if (!parentPath) {
4631
- return t42.arrayExpression([]);
4696
+ return t43.arrayExpression([]);
4632
4697
  }
4633
- const isFnExpr = t42.isArrowFunctionExpression(node) || t42.isFunctionExpression(node);
4698
+ const isFnExpr = t43.isArrowFunctionExpression(node) || t43.isFunctionExpression(node);
4634
4699
  const analyzeTarget = isFnExpr ? node.body : node;
4635
4700
  const bindingLocalBoundary = isFnExpr ? node : analyzeTarget;
4636
4701
  const deps = /* @__PURE__ */ new Map();
@@ -4640,13 +4705,13 @@ function analyzeDeps(node, ctx, parentPath) {
4640
4705
  }
4641
4706
  const analyzeTargetPath = parentPath && parentPath.node === analyzeTarget ? parentPath : null;
4642
4707
  if (analyzeTargetPath) {
4643
- if (t42.isMemberExpression(analyzeTarget) || t42.isOptionalMemberExpression(analyzeTarget)) {
4708
+ if (t43.isMemberExpression(analyzeTarget) || t43.isOptionalMemberExpression(analyzeTarget)) {
4644
4709
  const rootId = findRootIdentifier(analyzeTarget);
4645
4710
  if (rootId) {
4646
4711
  tryAddDependency(analyzeTargetPath, rootId.name, analyzeTargetPath.scope);
4647
4712
  processedIdentifiers.add(rootId);
4648
4713
  }
4649
- } else if (t42.isIdentifier(analyzeTarget)) {
4714
+ } else if (t43.isIdentifier(analyzeTarget)) {
4650
4715
  tryAddDependency(analyzeTargetPath, analyzeTarget.name, analyzeTargetPath.scope);
4651
4716
  }
4652
4717
  }
@@ -4698,7 +4763,7 @@ function analyzeDeps(node, ctx, parentPath) {
4698
4763
  }
4699
4764
  }
4700
4765
  }
4701
- return t42.arrayExpression(Array.from(deps.values()));
4766
+ return t43.arrayExpression(Array.from(deps.values()));
4702
4767
  }
4703
4768
 
4704
4769
  // src/core/transform/sfc/script/syntax-processor/process/resolve-analysis-only-adapter.ts
@@ -4714,7 +4779,7 @@ function resolveAnalysisOnlyAdapter(ctx) {
4714
4779
  if (!isVueApiReference(path8, apiName)) {
4715
4780
  return;
4716
4781
  }
4717
- if (t43.isCallExpression(node)) {
4782
+ if (t44.isCallExpression(node)) {
4718
4783
  resolveCallNode(path8, adapter, ctx);
4719
4784
  } else {
4720
4785
  replaceIdName(node, adapter.target);
@@ -4724,11 +4789,11 @@ function resolveAnalysisOnlyAdapter(ctx) {
4724
4789
  };
4725
4790
  }
4726
4791
  function getApiName(node) {
4727
- const isCallNode = t43.isCallExpression(node);
4792
+ const isCallNode = t44.isCallExpression(node);
4728
4793
  let apiName = "";
4729
- if (t43.isIdentifier(node)) {
4794
+ if (t44.isIdentifier(node)) {
4730
4795
  apiName = node.name;
4731
- } else if (isCallNode && t43.isIdentifier(node.callee)) {
4796
+ } else if (isCallNode && t44.isIdentifier(node.callee)) {
4732
4797
  apiName = node.callee.name;
4733
4798
  }
4734
4799
  return apiName;
@@ -4738,7 +4803,7 @@ function resolveCallNode(path8, adapter, ctx) {
4738
4803
  const { arguments: args } = node;
4739
4804
  if (!args.length) return;
4740
4805
  const fn = args[0];
4741
- if (!t43.isArrowFunctionExpression(fn) && !t43.isFunctionExpression(fn)) {
4806
+ if (!t44.isArrowFunctionExpression(fn) && !t44.isFunctionExpression(fn)) {
4742
4807
  return;
4743
4808
  }
4744
4809
  const fnPath = path8.get("arguments")[0];
@@ -4770,7 +4835,7 @@ function isVueImportBinding(binding) {
4770
4835
  return false;
4771
4836
  }
4772
4837
  const parent = _optionalChain([bindingPath, 'access', _148 => _148.parentPath, 'optionalAccess', _149 => _149.node]);
4773
- if (!parent || !t43.isImportDeclaration(parent)) {
4838
+ if (!parent || !t44.isImportDeclaration(parent)) {
4774
4839
  return false;
4775
4840
  }
4776
4841
  const source = parent.source.value.toLowerCase();
@@ -4856,14 +4921,14 @@ function resolveElementRef(ctx) {
4856
4921
  }
4857
4922
  if (isCompRefBindings) {
4858
4923
  const varDeclaratorPath = _optionalChain([getVariableDeclaratorPath, 'call', _151 => _151(path8), 'optionalAccess', _152 => _152.node]);
4859
- if (!t44.isIdentifier(_optionalChain([varDeclaratorPath, 'optionalAccess', _153 => _153.id]))) {
4924
+ if (!t45.isIdentifier(_optionalChain([varDeclaratorPath, 'optionalAccess', _153 => _153.id]))) {
4860
4925
  return;
4861
4926
  }
4862
4927
  const varName = varDeclaratorPath.id.name;
4863
4928
  const compRef = refBindings.componentRefs[varName];
4864
4929
  if (!compRef) return;
4865
4930
  }
4866
- node.arguments[0] = t44.identifier("null");
4931
+ node.arguments[0] = t45.identifier("null");
4867
4932
  resolveTypeParameters(ctx, path8);
4868
4933
  replaceCallName(node, REACT_API_MAP.useRef);
4869
4934
  recordImport(ctx, PACKAGE_NAME.react, REACT_API_MAP.useRef);
@@ -4888,20 +4953,20 @@ function resolveTypeParameters(ctx, path8) {
4888
4953
  const compBindingMeta = refBindings.componentRefs[idName];
4889
4954
  if (!node.typeParameters && (domBindingMeta || compBindingMeta)) {
4890
4955
  const type = compBindingMeta ? "any" : domBindingMeta.htmlType;
4891
- node.typeParameters = t44.tsTypeParameterInstantiation([t44.tsTypeReference(t44.identifier(type))]);
4956
+ node.typeParameters = t45.tsTypeParameterInstantiation([t45.tsTypeReference(t45.identifier(type))]);
4892
4957
  }
4893
4958
  }
4894
4959
  function resolveRefValueToCurrent(path8) {
4895
4960
  const { node } = path8;
4896
- if (node.computed || !t44.isIdentifier(node.property) || node.property.name !== "value") {
4961
+ if (node.computed || !t45.isIdentifier(node.property) || node.property.name !== "value") {
4897
4962
  return;
4898
4963
  }
4899
4964
  const rootPath = findRootVariablePath(path8);
4900
- if (!_optionalChain([rootPath, 'optionalAccess', _156 => _156.node]) || !t44.isCallExpression(rootPath.node.init) || !isCalleeNamed(rootPath.node.init, REACT_API_MAP.useRef)) {
4965
+ if (!_optionalChain([rootPath, 'optionalAccess', _156 => _156.node]) || !t45.isCallExpression(rootPath.node.init) || !isCalleeNamed(rootPath.node.init, REACT_API_MAP.useRef)) {
4901
4966
  return;
4902
4967
  }
4903
4968
  const rootId = findRootIdentifier(node);
4904
- if (!t44.isIdentifier(node.object) || node.object.name !== _optionalChain([rootId, 'optionalAccess', _157 => _157.name])) {
4969
+ if (!t45.isIdentifier(node.object) || node.object.name !== _optionalChain([rootId, 'optionalAccess', _157 => _157.name])) {
4905
4970
  return;
4906
4971
  }
4907
4972
  node.property.name = "current";
@@ -4920,11 +4985,11 @@ function resolveExprMemo(ctx, ast) {
4920
4985
  if (!atComponentOrHookRoot(path8, ast.program, isScriptFile)) {
4921
4986
  return false;
4922
4987
  }
4923
- if (!t45.isVariableDeclaration(path8.parent) || path8.parent.kind !== "const") {
4988
+ if (!t46.isVariableDeclaration(path8.parent) || path8.parent.kind !== "const") {
4924
4989
  return false;
4925
4990
  }
4926
- if (t45.isFunction(init)) return false;
4927
- if (t45.isCallExpression(init) && t45.isIdentifier(init.callee) && init.callee.name.startsWith("use")) {
4991
+ if (t46.isFunction(init)) return false;
4992
+ if (t46.isCallExpression(init) && t46.isIdentifier(init.callee) && init.callee.name.startsWith("use")) {
4928
4993
  return false;
4929
4994
  }
4930
4995
  return true;
@@ -4949,10 +5014,10 @@ function resolveLintRules(ctx, ast) {
4949
5014
  return {
4950
5015
  CallExpression(path8) {
4951
5016
  const { node, parentPath } = path8;
4952
- if (!t46.isIdentifier(node.callee)) return;
5017
+ if (!t47.isIdentifier(node.callee)) return;
4953
5018
  const { name: callName } = node.callee;
4954
- const addLog = (t52) => {
4955
- logger.error(t52, {
5019
+ const addLog = (t53) => {
5020
+ logger.error(t53, {
4956
5021
  file: ctx.filename,
4957
5022
  source: ctx.scriptData.source,
4958
5023
  loc: node.loc
@@ -4999,14 +5064,25 @@ function resolveLintRules(ctx, ast) {
4999
5064
 
5000
5065
 
5001
5066
  function resolveProvide(ctx) {
5002
- if (ctx.inputType === "style") return {};
5067
+ const { filename, scriptData, inputType } = ctx;
5068
+ if (inputType !== "sfc") {
5069
+ return {};
5070
+ }
5003
5071
  return {
5004
5072
  CallExpression(path8) {
5005
5073
  const { node } = path8;
5074
+ if (inputType.startsWith("script")) {
5075
+ logger.error("provide() call found outside of SFC <script setup> context.", {
5076
+ file: filename,
5077
+ source: scriptData.source,
5078
+ loc: node.loc
5079
+ });
5080
+ return;
5081
+ }
5006
5082
  const providerTarget = _optionalChain([ADAPTER_RULES, 'access', _158 => _158.runtime, 'access', _159 => _159[VUE_API_MAP.provide], 'optionalAccess', _160 => _160.target]);
5007
5083
  const isProvideCall = isCalleeNamed(node, VUE_API_MAP.provide) || providerTarget && isCalleeNamed(node, providerTarget);
5008
5084
  if (!isProvideCall) return;
5009
- const { provide } = ctx.scriptData;
5085
+ const { provide } = scriptData;
5010
5086
  const [key, value] = node.arguments;
5011
5087
  const target = findOrCreateCtxProvider(provide);
5012
5088
  const adapter = ADAPTER_RULES.runtime[VUE_API_MAP.provide];
@@ -5029,13 +5105,13 @@ function findOrCreateCtxProvider(root) {
5029
5105
  function assignProviderValue(target, key, value) {
5030
5106
  const getRawExp = (exp) => {
5031
5107
  if (!exp) return "''";
5032
- if (t47.isStringLiteral(exp)) {
5108
+ if (t48.isStringLiteral(exp)) {
5033
5109
  return JSON.stringify(exp.value);
5034
5110
  }
5035
- if (t47.isNumericLiteral(exp)) {
5111
+ if (t48.isNumericLiteral(exp)) {
5036
5112
  return exp.value.toString();
5037
5113
  }
5038
- if (t47.isIdentifier(exp)) {
5114
+ if (t48.isIdentifier(exp)) {
5039
5115
  return exp.name;
5040
5116
  }
5041
5117
  try {
@@ -5056,11 +5132,11 @@ function resolveRenameAdapter(ctx) {
5056
5132
  return {
5057
5133
  "CallExpression|Identifier"(path8) {
5058
5134
  const node = path8.node;
5059
- const isCallNode = t48.isCallExpression(node);
5135
+ const isCallNode = t49.isCallExpression(node);
5060
5136
  let apiName = "";
5061
- if (t48.isIdentifier(node)) {
5137
+ if (t49.isIdentifier(node)) {
5062
5138
  apiName = node.name;
5063
- } else if (isCallNode && t48.isIdentifier(node.callee)) {
5139
+ } else if (isCallNode && t49.isIdentifier(node.callee)) {
5064
5140
  apiName = node.callee.name;
5065
5141
  }
5066
5142
  if (!apiName) {
@@ -5122,7 +5198,7 @@ function isVueImportBinding2(binding) {
5122
5198
  return false;
5123
5199
  }
5124
5200
  const parent = _optionalChain([bindingPath, 'access', _163 => _163.parentPath, 'optionalAccess', _164 => _164.node]);
5125
- if (!parent || !t48.isImportDeclaration(parent)) {
5201
+ if (!parent || !t49.isImportDeclaration(parent)) {
5126
5202
  return false;
5127
5203
  }
5128
5204
  const source = parent.source.value.toLowerCase();
@@ -5153,11 +5229,10 @@ function processVueSyntax2(ast, ctx) {
5153
5229
  process: {
5154
5230
  applyBabel: [
5155
5231
  resolveElementRef,
5156
- // provide 需要在 rename 之前收集并移除原始调用,避免被重命名后失配
5157
- resolveProvide,
5158
5232
  resolveRenameAdapter,
5159
- // fix:在分析函数前分析可优化为 useMemo 的顶层变量声明,
5160
- // 使得后续能够被函数依赖分析
5233
+ // fix: https://github.com/vureact-js/core/issues/46
5234
+ resolveProvide,
5235
+ // fix:在分析函数前分析可优化为 useMemo 的顶层变量声明,使得后续能够被函数依赖分析
5161
5236
  resolveExprMemo,
5162
5237
  resolveArrowFnDeps,
5163
5238
  resolveAnalysisOnlyAdapter,
@@ -5166,7 +5241,12 @@ function processVueSyntax2(ast, ctx) {
5166
5241
  excludeBabel: [resolveTemplateSlotIface, resolveCompIProps]
5167
5242
  },
5168
5243
  postprocess: {
5169
- applyBabel: [resolveRuntimeImports, resolveASTChunks],
5244
+ applyBabel: [
5245
+ // 该 resolver 需确保放在所有类型处理之后,移除之前
5246
+ resolveVueTypeAsAny,
5247
+ resolveRuntimeImports,
5248
+ resolveASTChunks
5249
+ ],
5170
5250
  excludeBabel: [resolveSfcCssImport]
5171
5251
  }
5172
5252
  });
@@ -5265,7 +5345,7 @@ function isRouterLinkBooleanCustomProp(prop) {
5265
5345
 
5266
5346
 
5267
5347
  var strCodeTypes = {
5268
- isIdentifier: isIdentifier28,
5348
+ isIdentifier: isIdentifier29,
5269
5349
  isSimpleExpression,
5270
5350
  isStringLiteral: isStringLiteral13
5271
5351
  };
@@ -5276,30 +5356,30 @@ function isSimpleExpression(code, excludeVar = false) {
5276
5356
  } catch (e7) {
5277
5357
  return false;
5278
5358
  }
5279
- if (t49.isLiteral(node)) {
5359
+ if (t50.isLiteral(node)) {
5280
5360
  return true;
5281
5361
  }
5282
- if (!excludeVar && t49.isIdentifier(node)) {
5362
+ if (!excludeVar && t50.isIdentifier(node)) {
5283
5363
  return true;
5284
5364
  }
5285
- if (t49.isMemberExpression(node)) {
5286
- return isSimpleExpression(node.object) && t49.isIdentifier(node.property);
5365
+ if (t50.isMemberExpression(node)) {
5366
+ return isSimpleExpression(node.object) && t50.isIdentifier(node.property);
5287
5367
  }
5288
- if (t49.isObjectExpression(node) || t49.isArrayExpression(node)) {
5368
+ if (t50.isObjectExpression(node) || t50.isArrayExpression(node)) {
5289
5369
  return false;
5290
5370
  }
5291
- if (t49.isCallExpression(node) || t49.isAssignmentExpression(node)) {
5371
+ if (t50.isCallExpression(node) || t50.isAssignmentExpression(node)) {
5292
5372
  return false;
5293
5373
  }
5294
- if (t49.isBinaryExpression(node) || t49.isUnaryExpression(node)) {
5374
+ if (t50.isBinaryExpression(node) || t50.isUnaryExpression(node)) {
5295
5375
  return true;
5296
5376
  }
5297
5377
  return false;
5298
5378
  }
5299
- function isIdentifier28(code) {
5379
+ function isIdentifier29(code) {
5300
5380
  try {
5301
5381
  const node = _parser.parseExpression.call(void 0, code);
5302
- return t49.isIdentifier(node);
5382
+ return t50.isIdentifier(node);
5303
5383
  } catch (e8) {
5304
5384
  return false;
5305
5385
  }
@@ -5307,7 +5387,7 @@ function isIdentifier28(code) {
5307
5387
  function isStringLiteral13(code) {
5308
5388
  try {
5309
5389
  const node = _parser.parseExpression.call(void 0, code);
5310
- return t49.isStringLiteral(node);
5390
+ return t50.isStringLiteral(node);
5311
5391
  } catch (e9) {
5312
5392
  return false;
5313
5393
  }
@@ -5447,9 +5527,10 @@ function resolvePropAsBabelExp(ir, ctx) {
5447
5527
  const value = ir.value;
5448
5528
  const valueContent = value.content;
5449
5529
  const mergedItems = value.merge;
5530
+ const rule = ADAPTER_RULES.runtime;
5450
5531
  const setNameIdentifier = (target, valueName) => {
5451
5532
  target.content = valueName;
5452
- target.ast = t50.jsxIdentifier(valueName);
5533
+ target.ast = t51.jsxIdentifier(valueName);
5453
5534
  };
5454
5535
  const setValueExpression = (target, content, isStringLiteral14) => {
5455
5536
  target.content = content;
@@ -5457,38 +5538,41 @@ function resolvePropAsBabelExp(ir, ctx) {
5457
5538
  };
5458
5539
  const createRuntimeCall = (fnName, args) => {
5459
5540
  const fnArgs = args.filter(Boolean).join(",");
5460
- return `${fnName}(${fnArgs})`;
5541
+ const valIsUndef = fnName === rule.dirOn.target && _optionalChain([args, 'optionalAccess', _183 => _183[1]]) === "undefined";
5542
+ const isTs = ctx.scriptData.lang.startsWith("ts");
5543
+ const safeTypeAssertion = isTs ? valIsUndef ? "as never" : "" : "";
5544
+ return `${fnName}(${fnArgs}) ${safeTypeAssertion}`;
5461
5545
  };
5462
5546
  const applyRuntimeExpression = (expression, setName = false, nameIdentifier, isStringLiteral14) => {
5463
5547
  if (setName && nameIdentifier) {
5464
5548
  setNameIdentifier(nameExp, nameIdentifier);
5465
5549
  }
5466
- const dir = ADAPTER_RULES.runtime.dir;
5550
+ const dir = rule.dir;
5467
5551
  recordImport(ctx, dir.package, dir.target);
5468
5552
  setValueExpression(value.babelExp, expression, isStringLiteral14);
5469
5553
  };
5470
5554
  if (ir.isKeyLessVBind) {
5471
- const dirKeyless = ADAPTER_RULES.runtime.dirKeyless;
5555
+ const dirKeyless = rule.dirKeyless;
5472
5556
  const expression = createRuntimeCall(dirKeyless.target, [valueContent]);
5473
5557
  applyRuntimeExpression(expression, false);
5474
5558
  return;
5475
5559
  }
5476
5560
  if (isClassAttr(name) && !value.isStringLiteral && !valueContent.startsWith(STYLE_MODULE_NAME)) {
5477
- const dirCls = ADAPTER_RULES.runtime.dirCls;
5478
- const arg = _optionalChain([mergedItems, 'optionalAccess', _183 => _183.join, 'call', _184 => _184(",")]) || wrapSingleQuotes(valueContent);
5561
+ const dirCls = rule.dirCls;
5562
+ const arg = _optionalChain([mergedItems, 'optionalAccess', _184 => _184.join, 'call', _185 => _185(",")]) || wrapSingleQuotes(valueContent);
5479
5563
  const expression = createRuntimeCall(dirCls.target, [arg]);
5480
5564
  applyRuntimeExpression(expression, true, name);
5481
5565
  return;
5482
5566
  }
5483
- if (isStyleAttr(name) && (!isSimpleStyle(valueContent) || _optionalChain([mergedItems, 'optionalAccess', _185 => _185.some, 'call', _186 => _186((item) => !isSimpleStyle(item))]))) {
5484
- const dirStyle = ADAPTER_RULES.runtime.dirStyle;
5485
- const arg = _optionalChain([mergedItems, 'optionalAccess', _187 => _187.join, 'call', _188 => _188(",")]) || valueContent;
5567
+ if (isStyleAttr(name) && (!isSimpleStyle(valueContent) || _optionalChain([mergedItems, 'optionalAccess', _186 => _186.some, 'call', _187 => _187((item) => !isSimpleStyle(item))]))) {
5568
+ const dirStyle = rule.dirStyle;
5569
+ const arg = _optionalChain([mergedItems, 'optionalAccess', _188 => _188.join, 'call', _189 => _189(",")]) || valueContent;
5486
5570
  const expression = createRuntimeCall(dirStyle.target, [arg]);
5487
5571
  applyRuntimeExpression(expression, true, name);
5488
5572
  return;
5489
5573
  }
5490
- if (ir.type === 3 /* EVENT */ && _optionalChain([ir, 'access', _189 => _189.modifiers, 'optionalAccess', _190 => _190.length])) {
5491
- const dirOn = ADAPTER_RULES.runtime.dirOn;
5574
+ if (ir.type === 3 /* EVENT */ && _optionalChain([ir, 'access', _190 => _190.modifiers, 'optionalAccess', _191 => _191.length])) {
5575
+ const dirOn = rule.dirOn;
5492
5576
  const eventName = wrapSingleQuotes(ir.__vOnEvName || name, ir.isStatic);
5493
5577
  const expression = createRuntimeCall(dirOn.target, [eventName, valueContent]);
5494
5578
  applyRuntimeExpression(expression, true, name);
@@ -5542,7 +5626,7 @@ function resolveElementChildrenRules(children, ctx, parentIR, ir) {
5542
5626
  continue;
5543
5627
  }
5544
5628
  const nodeIR = child;
5545
- if (_optionalChain([parentIR, 'optionalAccess', _191 => _191.isBuiltIn])) {
5629
+ if (_optionalChain([parentIR, 'optionalAccess', _192 => _192.isBuiltIn])) {
5546
5630
  if (parentIR.tag == VUE_API_MAP.Transition) {
5547
5631
  resolveTransitionRules(nodeIR, parentIR, ir, ctx);
5548
5632
  }
@@ -5583,7 +5667,7 @@ function walkElementNodes(node, onElement) {
5583
5667
  }
5584
5668
  function resolveDefaultStyleModuleName(node) {
5585
5669
  const { exp } = node;
5586
- if (_optionalChain([exp, 'optionalAccess', _192 => _192.type]) !== _compilercore.NodeTypes.SIMPLE_EXPRESSION) {
5670
+ if (_optionalChain([exp, 'optionalAccess', _193 => _193.type]) !== _compilercore.NodeTypes.SIMPLE_EXPRESSION) {
5587
5671
  return;
5588
5672
  }
5589
5673
  if (exp.content.includes("$style")) {
@@ -5679,7 +5763,7 @@ function mergeStyleProps(oldAttr, newAttr) {
5679
5763
  const oldStyle = oldAttr.value.content;
5680
5764
  const newStyle = parseStyleString(newAttr.value.content);
5681
5765
  let merged = oldAttr.value.merge;
5682
- if (!_optionalChain([merged, 'optionalAccess', _193 => _193.length])) {
5766
+ if (!_optionalChain([merged, 'optionalAccess', _194 => _194.length])) {
5683
5767
  merged = oldAttr.value.merge = [oldStyle, newStyle];
5684
5768
  } else {
5685
5769
  merged.push(newStyle);
@@ -5709,7 +5793,7 @@ function warnUnsupportedVueDollarVar(ctx, node) {
5709
5793
  const { source, filename } = ctx;
5710
5794
  let value = "";
5711
5795
  let loc;
5712
- if (node.type === _compilercore.NodeTypes.DIRECTIVE && _optionalChain([node, 'access', _194 => _194.exp, 'optionalAccess', _195 => _195.type]) === _compilercore.NodeTypes.SIMPLE_EXPRESSION) {
5796
+ if (node.type === _compilercore.NodeTypes.DIRECTIVE && _optionalChain([node, 'access', _195 => _195.exp, 'optionalAccess', _196 => _196.type]) === _compilercore.NodeTypes.SIMPLE_EXPRESSION) {
5713
5797
  value = node.exp.content;
5714
5798
  loc = node.exp.loc;
5715
5799
  } else if (node.type === _compilercore.NodeTypes.INTERPOLATION && node.content.type === _compilercore.NodeTypes.SIMPLE_EXPRESSION) {
@@ -5763,11 +5847,11 @@ function resolveRefProp(prop, ctx, nodeIR) {
5763
5847
  } = ctx;
5764
5848
  let propIR;
5765
5849
  if (prop.type === _compilercore.NodeTypes.ATTRIBUTE) {
5766
- const tag = _optionalChain([prop, 'access', _196 => _196.value, 'optionalAccess', _197 => _197.content]);
5850
+ const tag = _optionalChain([prop, 'access', _197 => _197.value, 'optionalAccess', _198 => _198.content]);
5767
5851
  if (!tag) return;
5768
5852
  collectComponentRef(tag, ctx);
5769
5853
  const domRefBinding = Object.values(refBindings.domRefs).find((r) => r.tag === tag);
5770
- const refVar = _optionalChain([domRefBinding, 'optionalAccess', _198 => _198.name]) || _optionalChain([refBindings, 'access', _199 => _199.componentRefs, 'access', _200 => _200[tag], 'optionalAccess', _201 => _201.name]);
5854
+ const refVar = _optionalChain([domRefBinding, 'optionalAccess', _199 => _199.name]) || _optionalChain([refBindings, 'access', _200 => _200.componentRefs, 'access', _201 => _201[tag], 'optionalAccess', _202 => _202.name]);
5771
5855
  propIR = createPropsIR("ref", "ref", refVar || "null");
5772
5856
  } else {
5773
5857
  const exp = prop.exp;
@@ -5819,7 +5903,7 @@ function resolveTemplateNodeKey(templNode, keyContent, ctx) {
5819
5903
  return;
5820
5904
  }
5821
5905
  const [firstChild] = children;
5822
- if (_optionalChain([firstChild, 'optionalAccess', _202 => _202.type]) !== _compilercore.NodeTypes.ELEMENT || firstChild.tagType === _compilercore.ElementTypes.TEMPLATE || firstChild.tagType === _compilercore.ElementTypes.SLOT) {
5906
+ if (_optionalChain([firstChild, 'optionalAccess', _203 => _203.type]) !== _compilercore.NodeTypes.ELEMENT || firstChild.tagType === _compilercore.ElementTypes.TEMPLATE || firstChild.tagType === _compilercore.ElementTypes.SLOT) {
5823
5907
  return;
5824
5908
  }
5825
5909
  const hasKeyProp = firstChild.props.some(
@@ -5856,8 +5940,8 @@ function createSimpleVueBind(name, value) {
5856
5940
  function resolveDynamicAttributeProp(directive, ir, ctx, vueNode, nodeIR) {
5857
5941
  const arg = directive.arg;
5858
5942
  const exp = directive.exp;
5859
- const name = _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _203 => _203.content]), () => ( ""));
5860
- const content = _nullishCoalesce(_optionalChain([exp, 'optionalAccess', _204 => _204.content]), () => ( "true"));
5943
+ const name = _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _204 => _204.content]), () => ( ""));
5944
+ const content = _nullishCoalesce(_optionalChain([exp, 'optionalAccess', _205 => _205.content]), () => ( "true"));
5861
5945
  warnUnsupportedVueDollarVar(ctx, directive);
5862
5946
  if (name === "is") {
5863
5947
  resolveDynamicIsProp(directive, ir, ctx, nodeIR);
@@ -5872,7 +5956,7 @@ function resolveDynamicAttributeProp(directive, ir, ctx, vueNode, nodeIR) {
5872
5956
  return;
5873
5957
  }
5874
5958
  const propIR = createPropsIR(directive.rawName, name, content);
5875
- propIR.isStatic = _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _205 => _205.isStatic]), () => ( true));
5959
+ propIR.isStatic = _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _206 => _206.isStatic]), () => ( true));
5876
5960
  checkPropIsDynamicKey(ctx, directive);
5877
5961
  resolvePropertyIR(propIR, ir, ctx, nodeIR, true);
5878
5962
  }
@@ -5911,7 +5995,7 @@ function normalizeString(s) {
5911
5995
  // src/core/transform/sfc/template/syntax-processor/process/props/resolve-attribute-prop.ts
5912
5996
  function resolveAttributeProp(attribute, ir, ctx, nodeIR) {
5913
5997
  const name = attribute.name;
5914
- const content = _nullishCoalesce(_optionalChain([attribute, 'access', _206 => _206.value, 'optionalAccess', _207 => _207.content]), () => ( "true"));
5998
+ const content = _nullishCoalesce(_optionalChain([attribute, 'access', _207 => _207.value, 'optionalAccess', _208 => _208.content]), () => ( "true"));
5915
5999
  if (name === "is") {
5916
6000
  resolveStaticIsProp(content, ir, ctx, nodeIR);
5917
6001
  return;
@@ -6006,10 +6090,10 @@ function resolveRouterLinkVSlotProp(directive, nodeIR, ctx) {
6006
6090
  type: 2 /* SLOT */,
6007
6091
  name: "customRender",
6008
6092
  rawName: _nullishCoalesce(directive.rawName, () => ( "v-slot")),
6009
- isStatic: _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _208 => _208.isStatic]), () => ( true)),
6093
+ isStatic: _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _209 => _209.isStatic]), () => ( true)),
6010
6094
  isScoped: true,
6011
6095
  callback: {
6012
- arg: _nullishCoalesce(_optionalChain([exp, 'optionalAccess', _209 => _209.content, 'optionalAccess', _210 => _210.trim, 'call', _211 => _211()]), () => ( "")),
6096
+ arg: _nullishCoalesce(_optionalChain([exp, 'optionalAccess', _210 => _210.content, 'optionalAccess', _211 => _211.trim, 'call', _212 => _212()]), () => ( "")),
6013
6097
  exp: []
6014
6098
  }
6015
6099
  };
@@ -6025,10 +6109,10 @@ function resolveVFor(directive, ir, ctx, nodeIR) {
6025
6109
  };
6026
6110
  }
6027
6111
  function resolveForResult(forParseResult) {
6028
- const source = _optionalChain([forParseResult, 'access', _212 => _212.source, 'optionalAccess', _213 => _213.content]);
6029
- const value = _optionalChain([forParseResult, 'access', _214 => _214.value, 'optionalAccess', _215 => _215.content]);
6030
- const index = _optionalChain([forParseResult, 'access', _216 => _216.index, 'optionalAccess', _217 => _217.content]);
6031
- const key = _optionalChain([forParseResult, 'access', _218 => _218.key, 'optionalAccess', _219 => _219.content]);
6112
+ const source = _optionalChain([forParseResult, 'access', _213 => _213.source, 'optionalAccess', _214 => _214.content]);
6113
+ const value = _optionalChain([forParseResult, 'access', _215 => _215.value, 'optionalAccess', _216 => _216.content]);
6114
+ const index = _optionalChain([forParseResult, 'access', _217 => _217.index, 'optionalAccess', _218 => _218.content]);
6115
+ const key = _optionalChain([forParseResult, 'access', _219 => _219.key, 'optionalAccess', _220 => _220.content]);
6032
6116
  return {
6033
6117
  source,
6034
6118
  value,
@@ -6048,7 +6132,7 @@ function resolveVHtml(directive, ir, ctx, nodeIR) {
6048
6132
  // src/core/transform/sfc/template/syntax-processor/process/props/resolve-v-if.ts
6049
6133
  function resolveVIf(directive, ir, ctx, nodeIR, siblingNodesIR) {
6050
6134
  const name = directive.name === "else-if" ? "elseIf" : directive.name;
6051
- const value = _nullishCoalesce(_optionalChain([directive, 'access', _220 => _220.exp, 'optionalAccess', _221 => _221.content]), () => ( "true"));
6135
+ const value = _nullishCoalesce(_optionalChain([directive, 'access', _221 => _221.exp, 'optionalAccess', _222 => _222.content]), () => ( "true"));
6052
6136
  const prevNode = siblingNodesIR[siblingNodesIR.length - 1];
6053
6137
  const isElseBranch = name === "else" || name === "elseIf";
6054
6138
  let hasError = false;
@@ -6087,7 +6171,7 @@ function resolveVIf(directive, ir, ctx, nodeIR, siblingNodesIR) {
6087
6171
  // src/core/transform/sfc/template/syntax-processor/process/props/resolve-v-memo.ts
6088
6172
  function resolveVMemo(directive, _ir, ctx, nodeIR) {
6089
6173
  const exp = directive.exp;
6090
- let value = _optionalChain([exp, 'optionalAccess', _222 => _222.content]);
6174
+ let value = _optionalChain([exp, 'optionalAccess', _223 => _223.content]);
6091
6175
  if (value !== void 0) {
6092
6176
  if (!value.trim() || !value.startsWith("[") && !value.endsWith("]")) {
6093
6177
  const { source, filename } = ctx;
@@ -6127,14 +6211,14 @@ function resolveVModel(directive, ir, ctx, vueNode, nodeIR) {
6127
6211
  const getterName = exp.content;
6128
6212
  const isComponent = vueNode.tagType === _compilercore.ElementTypes.COMPONENT;
6129
6213
  const inputType = resolveHtmlInput(vueNode, isComponent);
6130
- const propName = _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _223 => _223.content]), () => ( resolveModelPropName(inputType, isComponent)));
6214
+ const propName = _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _224 => _224.content]), () => ( resolveModelPropName(inputType, isComponent)));
6131
6215
  let valuePropIR;
6132
6216
  let eventPropIR;
6133
6217
  if (isComponent) {
6134
6218
  valuePropIR = createPropsIR("v-model", propName, getterName);
6135
6219
  const eventReactName = `onUpdate${capitalize(camelCase(propName))}`;
6136
6220
  const eventVueName = `update:${propName}`;
6137
- const isTS = _optionalChain([ctx, 'access', _224 => _224.scriptData, 'optionalAccess', _225 => _225.lang, 'optionalAccess', _226 => _226.startsWith, 'call', _227 => _227("ts")]);
6221
+ const isTS = _optionalChain([ctx, 'access', _225 => _225.scriptData, 'optionalAccess', _226 => _226.lang, 'optionalAccess', _227 => _227.startsWith, 'call', _228 => _228("ts")]);
6138
6222
  const valueArg = isTS ? "value: any" : "value";
6139
6223
  const processedValue = applyValueModifiers("value", modifiers);
6140
6224
  const handlerBody = `(${valueArg}) => { ${getterName} = ${processedValue} }`;
@@ -6172,7 +6256,7 @@ function getRadioValue(vueNode) {
6172
6256
  const valueAttr = vueNode.props.find(
6173
6257
  (prop) => prop.type === _compilercore.NodeTypes.ATTRIBUTE && prop.name === "value"
6174
6258
  );
6175
- if (!_optionalChain([valueAttr, 'optionalAccess', _228 => _228.value, 'optionalAccess', _229 => _229.content])) return '""';
6259
+ if (!_optionalChain([valueAttr, 'optionalAccess', _229 => _229.value, 'optionalAccess', _230 => _230.content])) return '""';
6176
6260
  const content = valueAttr.value.content;
6177
6261
  return /^['"]/.test(content) ? content : `"${content}"`;
6178
6262
  }
@@ -6182,7 +6266,7 @@ function resolveHtmlInput(node, isComponent) {
6182
6266
  const typeProp = node.props.find(
6183
6267
  (prop) => prop.type === _compilercore.NodeTypes.ATTRIBUTE && prop.name === "type"
6184
6268
  );
6185
- return _optionalChain([typeProp, 'optionalAccess', _230 => _230.value, 'optionalAccess', _231 => _231.content, 'optionalAccess', _232 => _232.toLowerCase, 'call', _233 => _233()]);
6269
+ return _optionalChain([typeProp, 'optionalAccess', _231 => _231.value, 'optionalAccess', _232 => _232.content, 'optionalAccess', _233 => _233.toLowerCase, 'call', _234 => _234()]);
6186
6270
  }
6187
6271
  function applyValueModifiers(valueExp, modifiers) {
6188
6272
  let result = valueExp;
@@ -6203,7 +6287,8 @@ function resolveVOn(directive, ir, ctx, nodeIR) {
6203
6287
  const modifiers = directive.modifiers.map((item) => item.content);
6204
6288
  const captureIndex = resolveCaptureModifier(modifiers);
6205
6289
  const eventName = resolveEventName(arg.content, captureIndex);
6206
- const handler = resolveHandler(exp.content.trim(), ctx, modifiers);
6290
+ const handlerContent = _optionalChain([exp, 'optionalAccess', _235 => _235.content, 'optionalAccess', _236 => _236.trim, 'call', _237 => _237()]) || "undefined";
6291
+ const handler = resolveHandler(handlerContent, ctx, modifiers);
6207
6292
  const originalVueEventName = modifiers.length ? `${arg.content}.${modifiers.join(".")}` : "";
6208
6293
  const eventIR = createPropsIR(directive.rawName, eventName, handler);
6209
6294
  eventIR.type = 3 /* EVENT */;
@@ -6253,10 +6338,10 @@ function resolveHandler(handlerContent, ctx, modifiers) {
6253
6338
  return handler;
6254
6339
  }
6255
6340
  function isConsoleCall(expr) {
6256
- return t51.isCallExpression(expr) && t51.isMemberExpression(expr.callee) && t51.isIdentifier(expr.callee.object) && expr.callee.object.name === "console";
6341
+ return t52.isCallExpression(expr) && t52.isMemberExpression(expr.callee) && t52.isIdentifier(expr.callee.object) && expr.callee.object.name === "console";
6257
6342
  }
6258
6343
  function isFnReference(expr) {
6259
- return t51.isIdentifier(expr) || t51.isMemberExpression(expr) || t51.isFunction(expr);
6344
+ return t52.isIdentifier(expr) || t52.isMemberExpression(expr) || t52.isFunction(expr);
6260
6345
  }
6261
6346
 
6262
6347
  // src/core/transform/sfc/template/syntax-processor/process/props/resolve-v-show.ts
@@ -6289,7 +6374,7 @@ function resolveVSlotProp(directive, ir, ctx) {
6289
6374
  const name = !arg || arg.content === "default" ? "children" : arg.content;
6290
6375
  const content = !isScoped ? [] : void 0;
6291
6376
  const callback = isScoped ? {
6292
- arg: _nullishCoalesce(_optionalChain([exp, 'optionalAccess', _234 => _234.content, 'optionalAccess', _235 => _235.trim, 'call', _236 => _236()]), () => ( "")),
6377
+ arg: _nullishCoalesce(_optionalChain([exp, 'optionalAccess', _238 => _238.content, 'optionalAccess', _239 => _239.trim, 'call', _240 => _240()]), () => ( "")),
6293
6378
  exp: []
6294
6379
  } : void 0;
6295
6380
  checkPropIsDynamicKey(ctx, directive);
@@ -6297,7 +6382,7 @@ function resolveVSlotProp(directive, ir, ctx) {
6297
6382
  type: 2 /* SLOT */,
6298
6383
  name,
6299
6384
  rawName: _nullishCoalesce(directive.rawName, () => ( "default")),
6300
- isStatic: _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _237 => _237.isStatic]), () => ( true)),
6385
+ isStatic: _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _241 => _241.isStatic]), () => ( true)),
6301
6386
  isScoped,
6302
6387
  content,
6303
6388
  callback
@@ -6360,7 +6445,7 @@ function resolveElementNode(node, ir, ctx, siblingNodesIR) {
6360
6445
  if (routerAdapter) {
6361
6446
  if (!ctx.route) ctx.route = true;
6362
6447
  nodeIR.isRoute = true;
6363
- recordImport(ctx, _optionalChain([routerAdapter, 'optionalAccess', _238 => _238.package]), routerAdapter.target);
6448
+ recordImport(ctx, _optionalChain([routerAdapter, 'optionalAccess', _242 => _242.package]), routerAdapter.target);
6364
6449
  }
6365
6450
  resolveProps(node, ir, ctx, nodeIR, siblingNodesIR);
6366
6451
  return nodeIR;
@@ -6488,11 +6573,8 @@ function resolveSlotOutletNode(node, nodeIR, ctx, parentIR, childrenIR) {
6488
6573
  function resolveSlotProps(node, ctx) {
6489
6574
  const result = {
6490
6575
  name: "children",
6491
- // 默认插槽名为'children'
6492
6576
  isScope: false,
6493
- // 默认非作用域插槽
6494
6577
  props: []
6495
- // 作用域参数列表
6496
6578
  };
6497
6579
  const { source, filename } = ctx;
6498
6580
  const addSlotProp = (key, value) => {
@@ -6507,7 +6589,7 @@ function resolveSlotProps(node, ctx) {
6507
6589
  for (const prop of node.props) {
6508
6590
  if (prop.type === _compilercore.NodeTypes.ATTRIBUTE) {
6509
6591
  const attr = prop.name;
6510
- const value = _optionalChain([prop, 'access', _239 => _239.value, 'optionalAccess', _240 => _240.content, 'access', _241 => _241.trim, 'call', _242 => _242()]);
6592
+ const value = _optionalChain([prop, 'access', _243 => _243.value, 'optionalAccess', _244 => _244.content, 'access', _245 => _245.trim, 'call', _246 => _246()]);
6511
6593
  if (attr === "name" && value) {
6512
6594
  result.name = camelCase(value);
6513
6595
  } else {
@@ -6516,9 +6598,12 @@ function resolveSlotProps(node, ctx) {
6516
6598
  continue;
6517
6599
  }
6518
6600
  if (prop.type === _compilercore.NodeTypes.DIRECTIVE) {
6601
+ warnUnsupportedVueDollarVar(ctx, prop);
6602
+ if (!prop.arg) {
6603
+ continue;
6604
+ }
6519
6605
  const arg = prop.arg;
6520
6606
  const exp = prop.exp;
6521
- warnUnsupportedVueDollarVar(ctx, prop);
6522
6607
  if (!arg.isStatic) {
6523
6608
  logger.warn("Avoid using dynamic slot names, as they may lead to unexpected behavior.", {
6524
6609
  source,
@@ -6527,7 +6612,7 @@ function resolveSlotProps(node, ctx) {
6527
6612
  });
6528
6613
  }
6529
6614
  const key = arg.content;
6530
- const value = exp.content.trim();
6615
+ const value = _optionalChain([exp, 'optionalAccess', _247 => _247.content, 'optionalAccess', _248 => _248.trim, 'call', _249 => _249()]) || "undefined";
6531
6616
  if (key === "name") {
6532
6617
  result.name = camelCase(value);
6533
6618
  } else {
@@ -6597,19 +6682,19 @@ function resolveTemplate2(root, ctx) {
6597
6682
  // src/core/transform/sfc/index.ts
6598
6683
  function transform(ast, ctx, options) {
6599
6684
  const { template, script, style } = ast;
6600
- const templateIR = resolveTemplate2(_optionalChain([template, 'optionalAccess', _243 => _243.ast]), ctx);
6601
- const scriptIR = resolveScript2(_optionalChain([script, 'optionalAccess', _244 => _244.ast]), ctx);
6685
+ const templateIR = resolveTemplate2(_optionalChain([template, 'optionalAccess', _250 => _250.ast]), ctx);
6686
+ const scriptIR = resolveScript2(_optionalChain([script, 'optionalAccess', _251 => _251.ast]), ctx);
6602
6687
  const result = {
6603
6688
  template: templateIR,
6604
6689
  script: scriptIR,
6605
- style: _optionalChain([style, 'optionalAccess', _245 => _245.source, 'optionalAccess', _246 => _246.content])
6690
+ style: _optionalChain([style, 'optionalAccess', _252 => _252.source, 'optionalAccess', _253 => _253.content])
6606
6691
  };
6607
- executePlugins(_optionalChain([options, 'optionalAccess', _247 => _247.plugins]), result, ctx);
6692
+ executePlugins(_optionalChain([options, 'optionalAccess', _254 => _254.plugins]), result, ctx);
6608
6693
  return result;
6609
6694
  }
6610
6695
 
6611
6696
  // package.json
6612
- var version = "1.8.3";
6697
+ var version = "1.8.5";
6613
6698
  var bin = {
6614
6699
  vureact: "bin/vureact.js"
6615
6700
  };
@@ -6794,7 +6879,7 @@ var Helper = (_class5 = class {
6794
6879
  __init8() {this.outDir = "react-app"}
6795
6880
  constructor(opts) {;_class5.prototype.__init7.call(this);_class5.prototype.__init8.call(this);
6796
6881
  this.compilerOpts = opts;
6797
- if (_optionalChain([opts, 'access', _248 => _248.output, 'optionalAccess', _249 => _249.workspace])) {
6882
+ if (_optionalChain([opts, 'access', _255 => _255.output, 'optionalAccess', _256 => _256.workspace])) {
6798
6883
  this.workspaceDir = opts.output.workspace;
6799
6884
  }
6800
6885
  const excludePatterns = PathFilter.withDefaults(opts.exclude || []);
@@ -6824,7 +6909,7 @@ var Helper = (_class5 = class {
6824
6909
  }
6825
6910
  getOutDirName() {
6826
6911
  const { output } = this.compilerOpts;
6827
- return _optionalChain([output, 'optionalAccess', _250 => _250.outDir]) || this.outDir;
6912
+ return _optionalChain([output, 'optionalAccess', _257 => _257.outDir]) || this.outDir;
6828
6913
  }
6829
6914
  getWorkspaceDir() {
6830
6915
  return _path2.default.resolve(this.getProjectRoot(), this.workspaceDir);
@@ -6838,7 +6923,7 @@ var Helper = (_class5 = class {
6838
6923
  }
6839
6924
  getIgnoreAssets() {
6840
6925
  const { output } = this.compilerOpts;
6841
- if (_optionalChain([output, 'optionalAccess', _251 => _251.ignoreAssets])) {
6926
+ if (_optionalChain([output, 'optionalAccess', _258 => _258.ignoreAssets])) {
6842
6927
  return new Set(output.ignoreAssets.map(normalizePath));
6843
6928
  }
6844
6929
  return /* @__PURE__ */ new Set([
@@ -6928,12 +7013,12 @@ var Helper = (_class5 = class {
6928
7013
  */
6929
7014
  async formatCode({ code, fileInfo }) {
6930
7015
  const { format } = this.compilerOpts;
6931
- if (!_optionalChain([format, 'optionalAccess', _252 => _252.enabled])) return code;
6932
- if (_optionalChain([format, 'optionalAccess', _253 => _253.formatter]) === "builtin") {
7016
+ if (!_optionalChain([format, 'optionalAccess', _259 => _259.enabled])) return code;
7017
+ if (_optionalChain([format, 'optionalAccess', _260 => _260.formatter]) === "builtin") {
6933
7018
  return simpleFormat(code);
6934
7019
  }
6935
- const { lang } = _nullishCoalesce(_optionalChain([fileInfo, 'optionalAccess', _254 => _254.jsx]), () => ( _optionalChain([fileInfo, 'optionalAccess', _255 => _255.script])));
6936
- return await formatWithPrettier(code, lang, _optionalChain([format, 'optionalAccess', _256 => _256.prettierOptions]));
7020
+ const { lang } = _nullishCoalesce(_optionalChain([fileInfo, 'optionalAccess', _261 => _261.jsx]), () => ( _optionalChain([fileInfo, 'optionalAccess', _262 => _262.script])));
7021
+ return await formatWithPrettier(code, lang, _optionalChain([format, 'optionalAccess', _263 => _263.prettierOptions]));
6937
7022
  }
6938
7023
  /**
6939
7024
  * 通用的缓存校验工具函数
@@ -6967,7 +7052,7 @@ var Helper = (_class5 = class {
6967
7052
  * @param options.lock - 是否启用文件锁(默认false)
6968
7053
  */
6969
7054
  async writeFileWithDir(filePath, content, options) {
6970
- if (_optionalChain([options, 'optionalAccess', _257 => _257.lock])) {
7055
+ if (_optionalChain([options, 'optionalAccess', _264 => _264.lock])) {
6971
7056
  await fileLock.updateFile(filePath, async () => content, options);
6972
7057
  } else {
6973
7058
  await _fs2.default.promises.mkdir(_path2.default.dirname(filePath), { recursive: true });
@@ -7012,7 +7097,7 @@ var Helper = (_class5 = class {
7012
7097
  * 获取需要排除编译的文件
7013
7098
  */
7014
7099
  getExcludes() {
7015
- if (!_optionalChain([this, 'access', _258 => _258.compilerOpts, 'access', _259 => _259.exclude, 'optionalAccess', _260 => _260.length])) {
7100
+ if (!_optionalChain([this, 'access', _265 => _265.compilerOpts, 'access', _266 => _266.exclude, 'optionalAccess', _267 => _267.length])) {
7016
7101
  return PathFilter.withDefaults();
7017
7102
  }
7018
7103
  return this.compilerOpts.exclude;
@@ -7103,7 +7188,7 @@ function parseOnlyStyle(source, ctx, options) {
7103
7188
  ast: void 0
7104
7189
  }
7105
7190
  };
7106
- executePlugins(_optionalChain([options, 'optionalAccess', _261 => _261.plugins]), result, ctx);
7191
+ executePlugins(_optionalChain([options, 'optionalAccess', _268 => _268.plugins]), result, ctx);
7107
7192
  return result;
7108
7193
  }
7109
7194
 
@@ -7237,16 +7322,16 @@ var BaseCompiler = (_class7 = class extends Helper {
7237
7322
  });
7238
7323
  const genOptions = this.prepareGenerateOptions(filename);
7239
7324
  const resolveSFCAndScriptFile = () => {
7240
- const ast = parse(source, ctx.data, { plugins: _optionalChain([plugins, 'optionalAccess', _262 => _262.parser]) });
7241
- const ir = transform(ast, ctx.data, { plugins: _optionalChain([plugins, 'optionalAccess', _263 => _263.transformer]) });
7325
+ const ast = parse(source, ctx.data, { plugins: _optionalChain([plugins, 'optionalAccess', _269 => _269.parser]) });
7326
+ const ir = transform(ast, ctx.data, { plugins: _optionalChain([plugins, 'optionalAccess', _270 => _270.transformer]) });
7242
7327
  const gen = generate(ir, ctx.data, {
7243
7328
  ...genOptions,
7244
- plugins: _optionalChain([plugins, 'optionalAccess', _264 => _264.codegen])
7329
+ plugins: _optionalChain([plugins, 'optionalAccess', _271 => _271.codegen])
7245
7330
  });
7246
7331
  return this.resolveMainResult(ir, gen, ctx.data);
7247
7332
  };
7248
7333
  const resolveStyleFile = () => {
7249
- const result = parseOnlyStyle(source, ctx.data, { plugins: _optionalChain([plugins, 'optionalAccess', _265 => _265.parser]) });
7334
+ const result = parseOnlyStyle(source, ctx.data, { plugins: _optionalChain([plugins, 'optionalAccess', _272 => _272.parser]) });
7250
7335
  return this.resolveStyleResult(result, ctx.data);
7251
7336
  };
7252
7337
  try {
@@ -7285,9 +7370,9 @@ var BaseCompiler = (_class7 = class extends Helper {
7285
7370
  lang
7286
7371
  },
7287
7372
  css: {
7288
- file: _optionalChain([styleData, 'optionalAccess', _266 => _266.filePath]),
7289
- hash: _optionalChain([styleData, 'optionalAccess', _267 => _267.scopeId]),
7290
- code: _optionalChain([ir, 'optionalAccess', _268 => _268.style])
7373
+ file: _optionalChain([styleData, 'optionalAccess', _273 => _273.filePath]),
7374
+ hash: _optionalChain([styleData, 'optionalAccess', _274 => _274.scopeId]),
7375
+ code: _optionalChain([ir, 'optionalAccess', _275 => _275.style])
7291
7376
  }
7292
7377
  },
7293
7378
  ...base
@@ -7437,12 +7522,12 @@ var CacheManager = (_class9 = class {
7437
7522
  const meta = { ...unit };
7438
7523
  delete meta.source;
7439
7524
  if (key === "sfc" /* SFC */) {
7440
- _optionalChainDelete([meta, 'access', _269 => _269.output, 'optionalAccess', _270 => _270.jsx, 'access', _271 => delete _271.code]);
7441
- _optionalChainDelete([meta, 'access', _272 => _272.output, 'optionalAccess', _273 => _273.css, 'access', _274 => delete _274.code]);
7525
+ _optionalChainDelete([meta, 'access', _276 => _276.output, 'optionalAccess', _277 => _277.jsx, 'access', _278 => delete _278.code]);
7526
+ _optionalChainDelete([meta, 'access', _279 => _279.output, 'optionalAccess', _280 => _280.css, 'access', _281 => delete _281.code]);
7442
7527
  } else if (key === "script" /* SCRIPT */) {
7443
- _optionalChainDelete([meta, 'access', _275 => _275.output, 'optionalAccess', _276 => _276.script, 'access', _277 => delete _277.code]);
7528
+ _optionalChainDelete([meta, 'access', _282 => _282.output, 'optionalAccess', _283 => _283.script, 'access', _284 => delete _284.code]);
7444
7529
  } else if (key === "style" /* STYLE */) {
7445
- _optionalChainDelete([meta, 'access', _278 => _278.output, 'optionalAccess', _279 => _279.style, 'access', _280 => delete _280.code]);
7530
+ _optionalChainDelete([meta, 'access', _285 => _285.output, 'optionalAccess', _286 => _286.style, 'access', _287 => delete _287.code]);
7446
7531
  }
7447
7532
  if (!this.pendingUpdates.has(key)) {
7448
7533
  this.pendingUpdates.set(key, []);
@@ -7462,7 +7547,7 @@ var CacheManager = (_class9 = class {
7462
7547
  }
7463
7548
  for (const key of keys) {
7464
7549
  const updates = this.pendingUpdates.get(key);
7465
- if (!_optionalChain([updates, 'optionalAccess', _281 => _281.length])) continue;
7550
+ if (!_optionalChain([updates, 'optionalAccess', _288 => _288.length])) continue;
7466
7551
  const entries = [...this.cachedData[key] || []];
7467
7552
  updates.forEach(({ unit, meta }) => {
7468
7553
  const idx = entries.findIndex((c) => c.file === unit.file);
@@ -7623,7 +7708,7 @@ var CleanupManager = class {
7623
7708
  const sfcMeta = meta;
7624
7709
  const { jsx, css } = sfcMeta.output;
7625
7710
  await this.fileCompiler.removeOutputFile(jsx.file);
7626
- if (_optionalChain([css, 'optionalAccess', _282 => _282.file])) {
7711
+ if (_optionalChain([css, 'optionalAccess', _289 => _289.file])) {
7627
7712
  await this.fileCompiler.removeOutputFile(css.file);
7628
7713
  }
7629
7714
  break;
@@ -7679,7 +7764,7 @@ var CompilationUnitProcessor = class {
7679
7764
  const isScriptFile = key === "script" /* SCRIPT */;
7680
7765
  const isStyleFile = key === "style" /* STYLE */;
7681
7766
  if (isSFC || isScriptFile) {
7682
- unit.hasRoute = _optionalChain([result, 'optionalAccess', _283 => _283.hasRoute]);
7767
+ unit.hasRoute = _optionalChain([result, 'optionalAccess', _290 => _290.hasRoute]);
7683
7768
  }
7684
7769
  const resolveFileInfo = () => {
7685
7770
  if (isSFC) {
@@ -7699,7 +7784,7 @@ var CompilationUnitProcessor = class {
7699
7784
  const { script } = result.fileInfo;
7700
7785
  unit.output = {
7701
7786
  script: {
7702
- file: _optionalChain([script, 'optionalAccess', _284 => _284.file]),
7787
+ file: _optionalChain([script, 'optionalAccess', _291 => _291.file]),
7703
7788
  code
7704
7789
  }
7705
7790
  };
@@ -7776,7 +7861,7 @@ var FileProcessor = (_class10 = class {
7776
7861
  const absPath = this.fileCompiler.getAbsPath(filePath);
7777
7862
  const fileMeta = await this.fileCompiler.getFileMeta(absPath);
7778
7863
  const cache = (this.fileCompiler.getIsCache() ? existingCache : void 0) || await this.cacheManager.loadCache(key);
7779
- const record = _optionalChain([cache, 'optionalAccess', _285 => _285.target, 'access', _286 => _286.find, 'call', _287 => _287((c) => c.file === absPath)]);
7864
+ const record = _optionalChain([cache, 'optionalAccess', _292 => _292.target, 'access', _293 => _293.find, 'call', _294 => _294((c) => c.file === absPath)]);
7780
7865
  const { shouldCompile, hash } = await this.fileCompiler.checkCacheStatus(
7781
7866
  fileMeta,
7782
7867
  record,
@@ -7798,10 +7883,10 @@ var FileProcessor = (_class10 = class {
7798
7883
  hash: hash || this.fileCompiler.genHash(source)
7799
7884
  };
7800
7885
  const processed = await this.compilationUnitProcessor.resolve(initUnit, key);
7801
- if (_optionalChain([processed, 'optionalAccess', _288 => _288.output])) {
7886
+ if (_optionalChain([processed, 'optionalAccess', _295 => _295.output])) {
7802
7887
  await this.compilationUnitProcessor.saveCompiledFiles(processed, key);
7803
7888
  if (key === "sfc" /* SFC */ || key === "script" /* SCRIPT */) {
7804
- if (_optionalChain([processed, 'optionalAccess', _289 => _289.hasRoute])) {
7889
+ if (_optionalChain([processed, 'optionalAccess', _296 => _296.hasRoute])) {
7805
7890
  await this.addRouterToPackageJson();
7806
7891
  await this.updateEntryWithRouterProvider();
7807
7892
  }
@@ -7818,13 +7903,13 @@ var FileProcessor = (_class10 = class {
7818
7903
  */
7819
7904
  async addRouterToPackageJson() {
7820
7905
  const { output } = this.fileCompiler.options;
7821
- if (_optionalChain([output, 'optionalAccess', _290 => _290.bootstrapVite]) === false) {
7906
+ if (_optionalChain([output, 'optionalAccess', _297 => _297.bootstrapVite]) === false) {
7822
7907
  return;
7823
7908
  }
7824
7909
  const { router } = RUNTIME_PACKAGES;
7825
7910
  const filePath = this.fileCompiler.getOutputPkgPath();
7826
7911
  const packageJson = await this.fileCompiler.resolvePackageFile(filePath);
7827
- if (_optionalChain([packageJson, 'optionalAccess', _291 => _291.dependencies, 'optionalAccess', _292 => _292[router.name]])) {
7912
+ if (_optionalChain([packageJson, 'optionalAccess', _298 => _298.dependencies, 'optionalAccess', _299 => _299[router.name]])) {
7828
7913
  return;
7829
7914
  }
7830
7915
  if (!packageJson.dependencies) {
@@ -7843,7 +7928,7 @@ var FileProcessor = (_class10 = class {
7843
7928
  const { exclude, output, router } = this.fileCompiler.options;
7844
7929
  const inputPath = this.fileCompiler.getInputPath();
7845
7930
  const outputPath = this.fileCompiler.getOuputPath(true);
7846
- if (_optionalChain([output, 'optionalAccess', _293 => _293.bootstrapVite]) === false || _optionalChain([router, 'optionalAccess', _294 => _294.autoUpdateEntry]) === false || !_optionalChain([router, 'optionalAccess', _295 => _295.configFile])) {
7931
+ if (_optionalChain([output, 'optionalAccess', _300 => _300.bootstrapVite]) === false || _optionalChain([router, 'optionalAccess', _301 => _301.autoUpdateEntry]) === false || !_optionalChain([router, 'optionalAccess', _302 => _302.configFile])) {
7847
7932
  return;
7848
7933
  }
7849
7934
  const getMainFile = async (filename) => {
@@ -7864,7 +7949,7 @@ var FileProcessor = (_class10 = class {
7864
7949
  const prepareRouterEntry = () => {
7865
7950
  const importPath = this.fileCompiler.resolveRelativePath(inputPath, router.configFile);
7866
7951
  let content = fileData.content;
7867
- if (_optionalChain([exclude, 'optionalAccess', _296 => _296.includes, 'call', _297 => _297(router.configFile)]) || _optionalChain([exclude, 'optionalAccess', _298 => _298.includes, 'call', _299 => _299(importPath)])) {
7952
+ if (_optionalChain([exclude, 'optionalAccess', _303 => _303.includes, 'call', _304 => _304(router.configFile)]) || _optionalChain([exclude, 'optionalAccess', _305 => _305.includes, 'call', _306 => _306(importPath)])) {
7868
7953
  return content;
7869
7954
  }
7870
7955
  const routerModule = "RouterInstance";
@@ -7971,7 +8056,7 @@ ${routerImport}`);
7971
8056
  const resolvedPath = normalizePath(fileCompiler.relativePath(input));
7972
8057
  const baseName = _path2.default.basename(input).toLowerCase();
7973
8058
  const exclusions = fileCompiler.getIgnoreAssets();
7974
- if (!_optionalChain([fileCompiler, 'access', _300 => _300.options, 'access', _301 => _301.output, 'optionalAccess', _302 => _302.ignoreAssets])) {
8059
+ if (!_optionalChain([fileCompiler, 'access', _307 => _307.options, 'access', _308 => _308.output, 'optionalAccess', _309 => _309.ignoreAssets])) {
7975
8060
  const shouldExclude = Array.from(exclusions).some((pattern) => {
7976
8061
  if (pattern.endsWith(".")) {
7977
8062
  return baseName.startsWith(pattern);
@@ -8107,7 +8192,7 @@ var ViteBootstrapper = (_class12 = class {
8107
8192
  const { output } = this.options;
8108
8193
  const workspaceDir = this.fileCompiler.getWorkspaceDir();
8109
8194
  await _fs2.default.promises.mkdir(workspaceDir, { recursive: true });
8110
- if (_optionalChain([output, 'optionalAccess', _303 => _303.bootstrapVite]) === false) {
8195
+ if (_optionalChain([output, 'optionalAccess', _310 => _310.bootstrapVite]) === false) {
8111
8196
  return false;
8112
8197
  }
8113
8198
  if (this.isSingleFile()) {
@@ -8147,7 +8232,7 @@ var ViteBootstrapper = (_class12 = class {
8147
8232
  const newDevDeps = resolveDeps(sourcePkg.devDependencies, newPkg.devDependencies, true);
8148
8233
  newPkg.dependencies = newDeps;
8149
8234
  newPkg.devDependencies = newDevDeps;
8150
- newPkg = _optionalChain([output, 'optionalAccess', _304 => _304.packageJson, 'optionalCall', _305 => _305(newPkg)]) || newPkg;
8235
+ newPkg = _optionalChain([output, 'optionalAccess', _311 => _311.packageJson, 'optionalCall', _312 => _312(newPkg)]) || newPkg;
8151
8236
  await this.fileCompiler.writeFileWithDir(outputPkgPath, JSON.stringify(newPkg, null, 2));
8152
8237
  this.spinner.succeed("Vite React environment initialized");
8153
8238
  return true;
@@ -8158,12 +8243,12 @@ var ViteBootstrapper = (_class12 = class {
8158
8243
  async resolveViteCreateApp() {
8159
8244
  const { output } = this.options;
8160
8245
  const { viteVersion, template: tmpl } = this.defaultConfig;
8161
- const bootstrapVite = _optionalChain([output, 'optionalAccess', _306 => _306.bootstrapVite]);
8246
+ const bootstrapVite = _optionalChain([output, 'optionalAccess', _313 => _313.bootstrapVite]);
8162
8247
  const outDirName = this.fileCompiler.getOutDirName();
8163
8248
  const configObject = typeof bootstrapVite === "object" ? bootstrapVite : null;
8164
- const viteVer = _optionalChain([configObject, 'optionalAccess', _307 => _307.vite]) || viteVersion;
8165
- const reactVer = _optionalChain([configObject, 'optionalAccess', _308 => _308.react]);
8166
- const template = _optionalChain([configObject, 'optionalAccess', _309 => _309.template]) || tmpl;
8249
+ const viteVer = _optionalChain([configObject, 'optionalAccess', _314 => _314.vite]) || viteVersion;
8250
+ const reactVer = _optionalChain([configObject, 'optionalAccess', _315 => _315.react]);
8251
+ const template = _optionalChain([configObject, 'optionalAccess', _316 => _316.template]) || tmpl;
8167
8252
  const cmd = `npm create vite${viteVer} ${outDirName} -- --template ${template}`;
8168
8253
  _child_process.execSync.call(void 0, cmd, {
8169
8254
  cwd: this.fileCompiler.getWorkspaceDir(),
@@ -8299,7 +8384,7 @@ var FileCompiler = (_class13 = class extends BaseCompiler {
8299
8384
  const assetCount = await assetManager.runAsset(scanFiles.assets, cacheMap);
8300
8385
  this.updateSpinner("Almost done...");
8301
8386
  await cacheManager.flushAllCache();
8302
- await _optionalChain([this, 'access', _310 => _310.options, 'access', _311 => _311.onSuccess, 'optionalCall', _312 => _312()]);
8387
+ await _optionalChain([this, 'access', _317 => _317.options, 'access', _318 => _318.onSuccess, 'optionalCall', _319 => _319()]);
8303
8388
  const endTime = calcElapsedTime(startTime);
8304
8389
  this.printCoreLogs();
8305
8390
  this.showCompileStats(endTime, sfcCount, scriptCount, styleCount, assetCount);