@vureact/compiler-core 1.2.0 → 1.2.1

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; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7; var _class8; var _class9; var _class10;/**
2
- * @vureact/compiler-core v1.1.1
2
+ * @vureact/compiler-core v1.2.1
3
3
  * (c) 2025-present Ruihong Zhong (Ryan John)
4
4
  * @license MIT
5
5
  */
@@ -312,11 +312,27 @@ var ADAPTER_RULES = {
312
312
  package: PACKAGE_NAME.router,
313
313
  type: "rename"
314
314
  },
315
+ // =============== Methods ===============
315
316
  createRouter: {
316
317
  target: "createRouter",
317
318
  package: PACKAGE_NAME.router,
318
319
  type: "rename"
319
320
  },
321
+ createWebHistory: {
322
+ target: "createWebHistory",
323
+ package: PACKAGE_NAME.router,
324
+ type: "rename"
325
+ },
326
+ createWebHashHistory: {
327
+ target: "createWebHashHistory",
328
+ package: PACKAGE_NAME.router,
329
+ type: "rename"
330
+ },
331
+ createMemoryHistory: {
332
+ target: "createMemoryHistory",
333
+ package: PACKAGE_NAME.router,
334
+ type: "rename"
335
+ },
320
336
  // =============== Hooks ===============
321
337
  useRoute: {
322
338
  target: "useRoute",
@@ -369,6 +385,56 @@ var VUE_API_MAP = {
369
385
  RouterLink: "RouterLink"
370
386
  };
371
387
 
388
+ // src/shared/babel-utils.ts
389
+ var _parser = require('@babel/parser');
390
+ function getBabelParseOptions(lang = "js", context = "script", filename) {
391
+ const baseOptions = {
392
+ sourceType: "module",
393
+ sourceFilename: _nullishCoalesce(filename, () => ( "anonymous")),
394
+ errorRecovery: true
395
+ // 容错模式
396
+ };
397
+ const plugins = [];
398
+ if (lang.includes("ts")) {
399
+ plugins.push("typescript");
400
+ }
401
+ if (lang.endsWith("sx")) {
402
+ if (lang.startsWith("t")) plugins.push("typescript");
403
+ plugins.push("jsx");
404
+ }
405
+ if (context === "vueTemplate") {
406
+ plugins.push("decorators-legacy");
407
+ } else if (context === "expression") {
408
+ baseOptions.sourceType = "script";
409
+ baseOptions.allowReturnOutsideFunction = true;
410
+ baseOptions.allowSuperOutsideMethod = true;
411
+ }
412
+ plugins.push("classProperties", "objectRestSpread", "asyncGenerators");
413
+ return {
414
+ ...baseOptions,
415
+ plugins: [...new Set(plugins)]
416
+ };
417
+ }
418
+ function stringToExpr(input, lang, filename = "") {
419
+ return _parser.parseExpression.call(void 0, input, getBabelParseOptions(lang, "expression", filename));
420
+ }
421
+ function atComponentOrHookRoot(path7, rootScope, inScriptFile = false) {
422
+ const { parentPath, scope } = path7;
423
+ const parentBlock = scope.block;
424
+ if (!parentPath) return !inScriptFile;
425
+ if (parentBlock === rootScope) {
426
+ if (inScriptFile) return false;
427
+ if (parentPath.isBlockStatement() && parentPath.node !== rootScope) {
428
+ return false;
429
+ }
430
+ if (parentPath.isCallExpression() || parentPath.isNewExpression()) {
431
+ return false;
432
+ }
433
+ return true;
434
+ }
435
+ return false;
436
+ }
437
+
372
438
  // src/core/codegen/component/jsx/utils/jsx-element-utils.ts
373
439
 
374
440
  function createJsxElement(tag, props, children, selfClosing) {
@@ -548,7 +614,7 @@ function buildMemoNode(nodeIR, ctx) {
548
614
 
549
615
 
550
616
  // src/core/codegen/component/jsx/syntax-processor/process/build-slot-prop.ts
551
- var _parser = require('@babel/parser');
617
+
552
618
 
553
619
 
554
620
  // src/shared/logger.ts
@@ -952,17 +1018,25 @@ function buildCtxProviderNode(nodeIR, ctx, children) {
952
1018
  if (_optionalChain([nextProvide, 'optionalAccess', _25 => _25.isOccupied])) {
953
1019
  childNodes = [buildCtxProviderNode(nextProvide, ctx, children)];
954
1020
  }
955
- const keyProp = t10.jsxAttribute(
956
- t10.jsxIdentifier("key"),
957
- buildJsxExpressionNode(t10.identifier(name))
1021
+ const parseProviderExpr = (raw) => {
1022
+ if (!raw) return t10.stringLiteral("");
1023
+ try {
1024
+ return stringToExpr(raw, ctx.scriptData.lang, ctx.filename);
1025
+ } catch (e4) {
1026
+ return t10.stringLiteral(raw);
1027
+ }
1028
+ };
1029
+ const nameProp = t10.jsxAttribute(
1030
+ t10.jsxIdentifier("name"),
1031
+ buildJsxExpressionNode(parseProviderExpr(name))
958
1032
  );
959
1033
  const valueProp = t10.jsxAttribute(
960
1034
  t10.jsxIdentifier("value"),
961
- buildJsxExpressionNode(t10.identifier(value))
1035
+ buildJsxExpressionNode(parseProviderExpr(value))
962
1036
  );
963
1037
  void ctx;
964
1038
  const adpater = ADAPTER_RULES.runtime[VUE_API_MAP.provide];
965
- return createJsxElement(adpater.target, [keyProp, valueProp], childNodes);
1039
+ return createJsxElement(adpater.target, [nameProp, valueProp], childNodes);
966
1040
  }
967
1041
 
968
1042
  // src/core/codegen/component/jsx/syntax-processor/postprocess/build-root-jsx.ts
@@ -1270,58 +1344,6 @@ function generate(ir, ctx, options) {
1270
1344
 
1271
1345
  // src/core/parse/script-only.ts
1272
1346
 
1273
-
1274
- // src/shared/babel-utils.ts
1275
-
1276
- function getBabelParseOptions(lang = "js", context = "script", filename) {
1277
- const baseOptions = {
1278
- sourceType: "module",
1279
- sourceFilename: _nullishCoalesce(filename, () => ( "anonymous")),
1280
- errorRecovery: true
1281
- // 容错模式
1282
- };
1283
- const plugins = [];
1284
- if (lang.includes("ts")) {
1285
- plugins.push("typescript");
1286
- }
1287
- if (lang.endsWith("sx")) {
1288
- if (lang.startsWith("t")) plugins.push("typescript");
1289
- plugins.push("jsx");
1290
- }
1291
- if (context === "vueTemplate") {
1292
- plugins.push("decorators-legacy");
1293
- } else if (context === "expression") {
1294
- baseOptions.sourceType = "script";
1295
- baseOptions.allowReturnOutsideFunction = true;
1296
- baseOptions.allowSuperOutsideMethod = true;
1297
- }
1298
- plugins.push("classProperties", "objectRestSpread", "asyncGenerators");
1299
- return {
1300
- ...baseOptions,
1301
- plugins: [...new Set(plugins)]
1302
- };
1303
- }
1304
- function stringToExpr(input, lang, filename = "") {
1305
- return _parser.parseExpression.call(void 0, input, getBabelParseOptions(lang, "expression", filename));
1306
- }
1307
- function atComponentOrHookRoot(path7, rootScope, inScriptFile = false) {
1308
- const { parentPath, scope } = path7;
1309
- const parentBlock = scope.block;
1310
- if (!parentPath) return !inScriptFile;
1311
- if (parentBlock === rootScope) {
1312
- if (inScriptFile) return false;
1313
- if (parentPath.isBlockStatement() && parentPath.node !== rootScope) {
1314
- return false;
1315
- }
1316
- if (parentPath.isCallExpression() || parentPath.isNewExpression()) {
1317
- return false;
1318
- }
1319
- return true;
1320
- }
1321
- return false;
1322
- }
1323
-
1324
- // src/core/parse/script-only.ts
1325
1347
  function parseOnlyScript(source, ctx, options) {
1326
1348
  const lang = ctx.inputType.split("-")[1];
1327
1349
  const ast = _parser.parse.call(void 0, source, getBabelParseOptions(lang, "script", ctx.filename));
@@ -1868,6 +1890,9 @@ function insertCSSImport(ctx) {
1868
1890
  // src/core/transform/shared.ts
1869
1891
  function recordImport(ctx, pkg, name, onDemand = true) {
1870
1892
  const { imports } = ctx;
1893
+ if (isTypeOnlyImport(name)) {
1894
+ name = `type ${name}`;
1895
+ }
1871
1896
  if (imports.has(pkg)) {
1872
1897
  const list = imports.get(pkg);
1873
1898
  const foundItem = list.find((item) => item.name === name);
@@ -1878,6 +1903,10 @@ function recordImport(ctx, pkg, name, onDemand = true) {
1878
1903
  }
1879
1904
  imports.set(pkg, [{ name, onDemand }]);
1880
1905
  }
1906
+ function isTypeOnlyImport(name) {
1907
+ const arr = [REACT_API_MAP.ReactNode];
1908
+ return arr.includes(name);
1909
+ }
1881
1910
 
1882
1911
  // src/core/transform/sfc/script/shared/replace-vue-suffix.ts
1883
1912
  function replaceVueSuffix(ctx, node) {
@@ -2462,6 +2491,14 @@ function extractName(prop, ctx) {
2462
2491
  // src/core/transform/sfc/script/syntax-processor/preprocess/resolve-emit-calls.ts
2463
2492
 
2464
2493
  function resolveEmitCalls(ctx) {
2494
+ const formatEmitEventName = (raw) => {
2495
+ if (raw.startsWith("update:")) {
2496
+ const modelKey = raw.slice("update:".length);
2497
+ return `onUpdate${capitalize(camelCase(modelKey))}`;
2498
+ }
2499
+ const normalized = raw.includes(":") ? raw.replace(/:/g, "-") : raw;
2500
+ return `on${capitalize(camelCase(normalized))}`;
2501
+ };
2465
2502
  return {
2466
2503
  CallExpression(path7) {
2467
2504
  const { node } = path7;
@@ -2487,7 +2524,7 @@ function resolveEmitCalls(ctx) {
2487
2524
  };
2488
2525
  if (!checkIfFromDefineEmits()) return;
2489
2526
  const [callee, ...args] = node.arguments;
2490
- const eventName = t24.isStringLiteral(callee) ? `on${capitalize(camelCase(callee.value))}` : void 0;
2527
+ const eventName = t24.isStringLiteral(callee) ? formatEmitEventName(callee.value) : void 0;
2491
2528
  if (!eventName) {
2492
2529
  logger.warn(`Expected String type but got ${_optionalChain([callee, 'optionalAccess', _66 => _66.type])}, expression will be removed`, {
2493
2530
  file: filename,
@@ -3257,7 +3294,8 @@ function createSlotScopeParam(props, ctx) {
3257
3294
  const foundBindingValue = _optionalChain([reactiveBindings, 'access', _89 => _89[prop], 'optionalAccess', _90 => _90.value]);
3258
3295
  const foundBindingTypes = foundBindingValue ? expressionToTSType(foundBindingValue) : null;
3259
3296
  const typeAnnotation = foundBindingTypes ? t28.tsTypeAnnotation(foundBindingTypes) : tsType;
3260
- const propSign = t28.tsPropertySignature(t28.identifier(prop), typeAnnotation);
3297
+ const key = t28.isValidIdentifier(prop) ? t28.identifier(prop) : t28.stringLiteral(prop);
3298
+ const propSign = t28.tsPropertySignature(key, typeAnnotation);
3261
3299
  propsSigns.push(propSign);
3262
3300
  });
3263
3301
  paramId.typeAnnotation = t28.tsTypeAnnotation(t28.tsTypeLiteral(propsSigns));
@@ -3850,11 +3888,13 @@ function resolveLintRules(ctx, ast) {
3850
3888
 
3851
3889
 
3852
3890
  function resolveProvide(ctx) {
3853
- if (ctx.inputType !== "sfc") return {};
3891
+ if (ctx.inputType === "style") return {};
3854
3892
  return {
3855
3893
  CallExpression(path7) {
3856
3894
  const { node } = path7;
3857
- if (!isCalleeNamed(node, VUE_API_MAP.provide)) return;
3895
+ const providerTarget = _optionalChain([ADAPTER_RULES, 'access', _106 => _106.runtime, 'access', _107 => _107[VUE_API_MAP.provide], 'optionalAccess', _108 => _108.target]);
3896
+ const isProvideCall = isCalleeNamed(node, VUE_API_MAP.provide) || providerTarget && isCalleeNamed(node, providerTarget);
3897
+ if (!isProvideCall) return;
3858
3898
  const { provide } = ctx.scriptData;
3859
3899
  const [key, value] = node.arguments;
3860
3900
  const target = findOrCreateCtxProvider(provide);
@@ -3870,7 +3910,7 @@ function findOrCreateCtxProvider(root) {
3870
3910
  return root;
3871
3911
  }
3872
3912
  let cur = root.provide;
3873
- while (_optionalChain([cur, 'optionalAccess', _106 => _106.isOccupied])) {
3913
+ while (_optionalChain([cur, 'optionalAccess', _109 => _109.isOccupied])) {
3874
3914
  cur = _nullishCoalesce(cur.provide, () => ( {}));
3875
3915
  }
3876
3916
  return cur || (root.provide = {});
@@ -3879,7 +3919,7 @@ function assignProviderValue(target, key, value) {
3879
3919
  const getRawExp = (exp) => {
3880
3920
  if (!exp) return "''";
3881
3921
  if (t35.isStringLiteral(exp)) {
3882
- return `'${exp.value}'`;
3922
+ return JSON.stringify(exp.value);
3883
3923
  }
3884
3924
  if (t35.isNumericLiteral(exp)) {
3885
3925
  return exp.value.toString();
@@ -3889,7 +3929,7 @@ function assignProviderValue(target, key, value) {
3889
3929
  }
3890
3930
  try {
3891
3931
  return _generator.generate.call(void 0, exp).code;
3892
- } catch (e4) {
3932
+ } catch (e5) {
3893
3933
  return "null";
3894
3934
  }
3895
3935
  };
@@ -3921,7 +3961,7 @@ function resolveRenameAdapter(ctx) {
3921
3961
  if (adapter.isTrackable) {
3922
3962
  const reactiveType = getReactiveType(apiName);
3923
3963
  const declaratorPath = getVariableDeclaratorPath(path7);
3924
- setScriptNodeMeta(_optionalChain([declaratorPath, 'optionalAccess', _107 => _107.node]), {
3964
+ setScriptNodeMeta(_optionalChain([declaratorPath, 'optionalAccess', _110 => _110.node]), {
3925
3965
  is_reactive: true,
3926
3966
  reactive_type: reactiveType
3927
3967
  });
@@ -3956,11 +3996,12 @@ function processVueSyntax2(ast, ctx) {
3956
3996
  process: {
3957
3997
  applyBabel: [
3958
3998
  resolveElementRef,
3999
+ // provide 需要在 rename 之前收集并移除原始调用,避免被重命名后失配
4000
+ resolveProvide,
3959
4001
  resolveRenameAdapter,
3960
4002
  resolveArrowFnDeps,
3961
4003
  resolveUnanalyzedArrow,
3962
4004
  resolveAnalysisOnlyAdapter,
3963
- resolveProvide,
3964
4005
  resolveExprMemo,
3965
4006
  resolveLintRules
3966
4007
  ],
@@ -3974,12 +4015,12 @@ function processVueSyntax2(ast, ctx) {
3974
4015
  }
3975
4016
  function vueSyntaxProcessor2(ast, ctx, options) {
3976
4017
  const runExcludeThenApply = (cfg) => {
3977
- _optionalChain([cfg, 'access', _108 => _108.excludeBabel, 'optionalAccess', _109 => _109.forEach, 'call', _110 => _110((fn) => fn(ctx, ast))]);
3978
- _optionalChain([cfg, 'access', _111 => _111.applyBabel, 'optionalAccess', _112 => _112.forEach, 'call', _113 => _113((fn) => _core.traverse.call(void 0, ast, fn(ctx, ast)))]);
4018
+ _optionalChain([cfg, 'access', _111 => _111.excludeBabel, 'optionalAccess', _112 => _112.forEach, 'call', _113 => _113((fn) => fn(ctx, ast))]);
4019
+ _optionalChain([cfg, 'access', _114 => _114.applyBabel, 'optionalAccess', _115 => _115.forEach, 'call', _116 => _116((fn) => _core.traverse.call(void 0, ast, fn(ctx, ast)))]);
3979
4020
  };
3980
4021
  const runApplyThenExclude = (cfg) => {
3981
- _optionalChain([cfg, 'access', _114 => _114.applyBabel, 'optionalAccess', _115 => _115.forEach, 'call', _116 => _116((fn) => _core.traverse.call(void 0, ast, fn(ctx, ast)))]);
3982
- _optionalChain([cfg, 'access', _117 => _117.excludeBabel, 'optionalAccess', _118 => _118.forEach, 'call', _119 => _119((fn) => fn(ctx, ast))]);
4022
+ _optionalChain([cfg, 'access', _117 => _117.applyBabel, 'optionalAccess', _118 => _118.forEach, 'call', _119 => _119((fn) => _core.traverse.call(void 0, ast, fn(ctx, ast)))]);
4023
+ _optionalChain([cfg, 'access', _120 => _120.excludeBabel, 'optionalAccess', _121 => _121.forEach, 'call', _122 => _122((fn) => fn(ctx, ast))]);
3983
4024
  };
3984
4025
  runExcludeThenApply(options.preprocess);
3985
4026
  runExcludeThenApply(options.process);
@@ -4074,7 +4115,7 @@ function isSimpleExpression(code, excludeVar = false) {
4074
4115
  let node;
4075
4116
  try {
4076
4117
  node = _parser.parseExpression.call(void 0, code);
4077
- } catch (e5) {
4118
+ } catch (e6) {
4078
4119
  return false;
4079
4120
  }
4080
4121
  if (t37.isLiteral(node)) {
@@ -4101,7 +4142,7 @@ function isIdentifier20(code) {
4101
4142
  try {
4102
4143
  const node = _parser.parseExpression.call(void 0, code);
4103
4144
  return t37.isIdentifier(node);
4104
- } catch (e6) {
4145
+ } catch (e7) {
4105
4146
  return false;
4106
4147
  }
4107
4148
  }
@@ -4109,7 +4150,7 @@ function isStringLiteral12(code) {
4109
4150
  try {
4110
4151
  const node = _parser.parseExpression.call(void 0, code);
4111
4152
  return t37.isStringLiteral(node) || t37.isTemplateLiteral(node);
4112
- } catch (e7) {
4153
+ } catch (e8) {
4113
4154
  return false;
4114
4155
  }
4115
4156
  }
@@ -4128,7 +4169,7 @@ function resolveEmitsCalls(input, ctx) {
4128
4169
  if (!result) return input;
4129
4170
  const [, , eventName, args] = result;
4130
4171
  const callee = eventName.split(/[:\-]/).map((part) => capitalize(camelCase(part))).join("");
4131
- const event = args ? `on${callee}(${args})` : `on${callee}()`;
4172
+ const event = args ? `on${callee}?.(${args})` : `on${callee}?.()`;
4132
4173
  return `${ctx.propField}?.${event}`;
4133
4174
  }
4134
4175
  function matchEmitCalls(input, ctx) {
@@ -4153,7 +4194,7 @@ function resolveRefVariable(input, ctx) {
4153
4194
  };
4154
4195
  for (const name in reactiveBindings) {
4155
4196
  const binding = reactiveBindings[name];
4156
- if (_optionalChain([binding, 'optionalAccess', _120 => _120.reactiveType]) !== "ref") continue;
4197
+ if (_optionalChain([binding, 'optionalAccess', _123 => _123.reactiveType]) !== "ref") continue;
4157
4198
  input = addValueProperty(input, name);
4158
4199
  }
4159
4200
  return input;
@@ -4166,7 +4207,7 @@ function resolveStringExpr(input, ctx, toStrLiteral = false) {
4166
4207
  const newContent = resolveSpecialExpressions(input, ctx);
4167
4208
  try {
4168
4209
  return stringToExpr(newContent, scriptData.lang, filename);
4169
- } catch (e8) {
4210
+ } catch (e9) {
4170
4211
  return t38.identifier(newContent);
4171
4212
  }
4172
4213
  }
@@ -4272,12 +4313,12 @@ function wrapSingleQuotes(content, condition) {
4272
4313
  return condition || strCodeTypes.isStringLiteral(content) ? `'${content}'` : content;
4273
4314
  }
4274
4315
  function checkPropIsDynamicKey(ctx, node) {
4275
- const isKeyStatic = _optionalChain([node, 'access', _121 => _121.arg, 'optionalAccess', _122 => _122.isStatic]);
4316
+ const isKeyStatic = _optionalChain([node, 'access', _124 => _124.arg, 'optionalAccess', _125 => _125.isStatic]);
4276
4317
  const { source, filename } = ctx;
4277
4318
  if (node.rawName === "v-bind" && !node.name) {
4278
4319
  logger.warn("Keyless v-bind will overwrite all previously declared props at runtime.", {
4279
4320
  source,
4280
- loc: _optionalChain([node, 'access', _123 => _123.arg, 'optionalAccess', _124 => _124.loc]),
4321
+ loc: _optionalChain([node, 'access', _126 => _126.arg, 'optionalAccess', _127 => _127.loc]),
4281
4322
  file: filename
4282
4323
  });
4283
4324
  return;
@@ -4285,7 +4326,7 @@ function checkPropIsDynamicKey(ctx, node) {
4285
4326
  if (isKeyStatic === false) {
4286
4327
  logger.warn("Avoid using dynamic slot names, as they generate complex JSX prop expressions.", {
4287
4328
  source,
4288
- loc: _optionalChain([node, 'access', _125 => _125.arg, 'optionalAccess', _126 => _126.loc]),
4329
+ loc: _optionalChain([node, 'access', _128 => _128.arg, 'optionalAccess', _129 => _129.loc]),
4289
4330
  file: filename
4290
4331
  });
4291
4332
  }
@@ -4330,19 +4371,19 @@ function resolvePropAsBabelExp(ir, ctx) {
4330
4371
  }
4331
4372
  if (isClassAttr(name) && !value.isStringLiteral && !valueContent.startsWith(STYLE_MODULE_NAME)) {
4332
4373
  const dirCls = ADAPTER_RULES.runtime.dirCls;
4333
- const arg = _optionalChain([mergedItems, 'optionalAccess', _127 => _127.join, 'call', _128 => _128(",")]) || wrapSingleQuotes(valueContent);
4374
+ const arg = _optionalChain([mergedItems, 'optionalAccess', _130 => _130.join, 'call', _131 => _131(",")]) || wrapSingleQuotes(valueContent);
4334
4375
  const expression = createRuntimeCall(dirCls.target, [arg]);
4335
4376
  applyRuntimeExpression(expression, true, name);
4336
4377
  return;
4337
4378
  }
4338
- if (isStyleAttr(name) && (!isSimpleStyle(valueContent) || _optionalChain([mergedItems, 'optionalAccess', _129 => _129.some, 'call', _130 => _130((item) => !isSimpleStyle(item))]))) {
4379
+ if (isStyleAttr(name) && (!isSimpleStyle(valueContent) || _optionalChain([mergedItems, 'optionalAccess', _132 => _132.some, 'call', _133 => _133((item) => !isSimpleStyle(item))]))) {
4339
4380
  const dirStyle = ADAPTER_RULES.runtime.dirStyle;
4340
- const arg = _optionalChain([mergedItems, 'optionalAccess', _131 => _131.join, 'call', _132 => _132(",")]) || valueContent;
4381
+ const arg = _optionalChain([mergedItems, 'optionalAccess', _134 => _134.join, 'call', _135 => _135(",")]) || valueContent;
4341
4382
  const expression = createRuntimeCall(dirStyle.target, [arg]);
4342
4383
  applyRuntimeExpression(expression, true, name);
4343
4384
  return;
4344
4385
  }
4345
- if (ir.type === 3 /* EVENT */ && _optionalChain([ir, 'access', _133 => _133.modifiers, 'optionalAccess', _134 => _134.length])) {
4386
+ if (ir.type === 3 /* EVENT */ && _optionalChain([ir, 'access', _136 => _136.modifiers, 'optionalAccess', _137 => _137.length])) {
4346
4387
  const dirOn = ADAPTER_RULES.runtime.dirOn;
4347
4388
  const eventName = wrapSingleQuotes(ir.__vOnEvName || name, ir.isStatic);
4348
4389
  const expression = createRuntimeCall(dirOn.target, [eventName, valueContent]);
@@ -4397,7 +4438,7 @@ function resolveElementChildrenRules(children, ctx, parentIR, ir) {
4397
4438
  continue;
4398
4439
  }
4399
4440
  const nodeIR = child;
4400
- if (_optionalChain([parentIR, 'optionalAccess', _135 => _135.isBuiltIn])) {
4441
+ if (_optionalChain([parentIR, 'optionalAccess', _138 => _138.isBuiltIn])) {
4401
4442
  if (parentIR.tag == VUE_API_MAP.Transition) {
4402
4443
  resolveTransitionRules(nodeIR, parentIR, ir, ctx);
4403
4444
  }
@@ -4438,7 +4479,7 @@ function walkElementNodes(node, onElement) {
4438
4479
  }
4439
4480
  function resolveDefaultStyleModuleName(node) {
4440
4481
  const { exp } = node;
4441
- if (_optionalChain([exp, 'optionalAccess', _136 => _136.type]) !== _compilercore.NodeTypes.SIMPLE_EXPRESSION) {
4482
+ if (_optionalChain([exp, 'optionalAccess', _139 => _139.type]) !== _compilercore.NodeTypes.SIMPLE_EXPRESSION) {
4442
4483
  return;
4443
4484
  }
4444
4485
  if (exp.content.includes("$style")) {
@@ -4451,6 +4492,8 @@ function resolveDefaultStyleModuleName(node) {
4451
4492
 
4452
4493
 
4453
4494
 
4495
+
4496
+
4454
4497
  function resolveStyleScopeAttribute(node, _ir, ctx) {
4455
4498
  if (!ctx.styleData.scopeId) {
4456
4499
  return;
@@ -4470,11 +4513,11 @@ function walkElementNodes2(node, onElement) {
4470
4513
  }
4471
4514
  function injectStyleScopeAttribute(node, ctx) {
4472
4515
  const { scopeId } = ctx.styleData;
4473
- if (!scopeId || isComponentElement(node)) {
4516
+ if (!scopeId || isComponentElement(node) || _compilercore.isSlotOutlet.call(void 0, node) || _compilercore.isTemplateNode.call(void 0, node)) {
4474
4517
  return;
4475
4518
  }
4476
4519
  const hasDynamicIs = node.props.some((prop) => {
4477
- if (prop.type !== _compilercore.NodeTypes.DIRECTIVE || _optionalChain([prop, 'access', _137 => _137.arg, 'optionalAccess', _138 => _138.type]) !== _compilercore.NodeTypes.SIMPLE_EXPRESSION) {
4520
+ if (prop.type !== _compilercore.NodeTypes.DIRECTIVE || _optionalChain([prop, 'access', _140 => _140.arg, 'optionalAccess', _141 => _141.type]) !== _compilercore.NodeTypes.SIMPLE_EXPRESSION) {
4478
4521
  return false;
4479
4522
  }
4480
4523
  return prop.arg.content === "is";
@@ -4540,7 +4583,7 @@ function mergeStyleProps(oldAttr, newAttr) {
4540
4583
  const oldStyle = oldAttr.value.content;
4541
4584
  const newStyle = parseStyleString(newAttr.value.content);
4542
4585
  let merged = oldAttr.value.merge;
4543
- if (!_optionalChain([merged, 'optionalAccess', _139 => _139.length])) {
4586
+ if (!_optionalChain([merged, 'optionalAccess', _142 => _142.length])) {
4544
4587
  merged = oldAttr.value.merge = [oldStyle, newStyle];
4545
4588
  } else {
4546
4589
  merged.push(newStyle);
@@ -4570,7 +4613,7 @@ function warnUnsupportedVueDollarVar(ctx, node) {
4570
4613
  const { source, filename } = ctx;
4571
4614
  let value = "";
4572
4615
  let loc;
4573
- if (node.type === _compilercore.NodeTypes.DIRECTIVE && _optionalChain([node, 'access', _140 => _140.exp, 'optionalAccess', _141 => _141.type]) === _compilercore.NodeTypes.SIMPLE_EXPRESSION) {
4616
+ if (node.type === _compilercore.NodeTypes.DIRECTIVE && _optionalChain([node, 'access', _143 => _143.exp, 'optionalAccess', _144 => _144.type]) === _compilercore.NodeTypes.SIMPLE_EXPRESSION) {
4574
4617
  value = node.exp.content;
4575
4618
  loc = node.exp.loc;
4576
4619
  } else if (node.type === _compilercore.NodeTypes.INTERPOLATION && node.content.type === _compilercore.NodeTypes.SIMPLE_EXPRESSION) {
@@ -4624,11 +4667,11 @@ function resolveRefProp(node, ctx, nodeIR) {
4624
4667
  } = ctx;
4625
4668
  let propIR;
4626
4669
  if (node.type === _compilercore.NodeTypes.ATTRIBUTE) {
4627
- const tag = _optionalChain([node, 'access', _142 => _142.value, 'optionalAccess', _143 => _143.content]);
4670
+ const tag = _optionalChain([node, 'access', _145 => _145.value, 'optionalAccess', _146 => _146.content]);
4628
4671
  if (!tag) return;
4629
4672
  collectComponentRef(tag, ctx);
4630
4673
  const domRefBinding = Object.values(refBindings.domRefs).find((r) => r.tag === tag);
4631
- const refVar = _optionalChain([domRefBinding, 'optionalAccess', _144 => _144.name]) || _optionalChain([refBindings, 'access', _145 => _145.componentRefs, 'access', _146 => _146[tag], 'optionalAccess', _147 => _147.name]);
4674
+ const refVar = _optionalChain([domRefBinding, 'optionalAccess', _147 => _147.name]) || _optionalChain([refBindings, 'access', _148 => _148.componentRefs, 'access', _149 => _149[tag], 'optionalAccess', _150 => _150.name]);
4632
4675
  propIR = createPropsIR("ref", "ref", refVar || "null");
4633
4676
  } else {
4634
4677
  const exp = node.exp;
@@ -4663,8 +4706,8 @@ function collectComponentRef(tag, ctx) {
4663
4706
  function resolveDynamicAttributeProp(node, ir, ctx, nodeIR) {
4664
4707
  const arg = node.arg;
4665
4708
  const exp = node.exp;
4666
- const name = _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _148 => _148.content]), () => ( ""));
4667
- const content = _nullishCoalesce(_optionalChain([exp, 'optionalAccess', _149 => _149.content]), () => ( "true"));
4709
+ const name = _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _151 => _151.content]), () => ( ""));
4710
+ const content = _nullishCoalesce(_optionalChain([exp, 'optionalAccess', _152 => _152.content]), () => ( "true"));
4668
4711
  warnUnsupportedVueDollarVar(ctx, node);
4669
4712
  if (name === "is") {
4670
4713
  resolveDynamicIsProp(node, ir, ctx, nodeIR);
@@ -4675,7 +4718,7 @@ function resolveDynamicAttributeProp(node, ir, ctx, nodeIR) {
4675
4718
  return;
4676
4719
  }
4677
4720
  const dynamicPropIR = createPropsIR(node.rawName, name, content);
4678
- dynamicPropIR.isStatic = _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _150 => _150.isStatic]), () => ( true));
4721
+ dynamicPropIR.isStatic = _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _153 => _153.isStatic]), () => ( true));
4679
4722
  checkPropIsDynamicKey(ctx, node);
4680
4723
  resolvePropertyIR(dynamicPropIR, ir, ctx, nodeIR, true);
4681
4724
  }
@@ -4703,7 +4746,7 @@ function resolvePropertyIR(node, ir, ctx, nodeIR, isDynamic = false) {
4703
4746
  // src/core/transform/sfc/template/syntax-processor/process/props/resolve-attribute-prop.ts
4704
4747
  function resolveAttributeProp(node, ir, ctx, nodeIR) {
4705
4748
  const name = node.name;
4706
- const content = _nullishCoalesce(_optionalChain([node, 'access', _151 => _151.value, 'optionalAccess', _152 => _152.content]), () => ( "true"));
4749
+ const content = _nullishCoalesce(_optionalChain([node, 'access', _154 => _154.value, 'optionalAccess', _155 => _155.content]), () => ( "true"));
4707
4750
  if (name === "is") {
4708
4751
  resolveStaticIsProp(content, ir, ctx, nodeIR);
4709
4752
  return;
@@ -4727,10 +4770,10 @@ function resolveRouterLinkVSlotProp(node, nodeIR, ctx) {
4727
4770
  type: 2 /* SLOT */,
4728
4771
  name: "customRender",
4729
4772
  rawName: _nullishCoalesce(node.rawName, () => ( "v-slot")),
4730
- isStatic: _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _153 => _153.isStatic]), () => ( true)),
4773
+ isStatic: _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _156 => _156.isStatic]), () => ( true)),
4731
4774
  isScoped: true,
4732
4775
  callback: {
4733
- arg: _nullishCoalesce(_optionalChain([exp, 'optionalAccess', _154 => _154.content, 'optionalAccess', _155 => _155.trim, 'call', _156 => _156()]), () => ( "")),
4776
+ arg: _nullishCoalesce(_optionalChain([exp, 'optionalAccess', _157 => _157.content, 'optionalAccess', _158 => _158.trim, 'call', _159 => _159()]), () => ( "")),
4734
4777
  exp: []
4735
4778
  }
4736
4779
  };
@@ -4746,10 +4789,10 @@ function resolveVFor(node, _ir, _ctx, nodeIR) {
4746
4789
  };
4747
4790
  }
4748
4791
  function resolveForResult(forParseResult) {
4749
- const source = _optionalChain([forParseResult, 'access', _157 => _157.source, 'optionalAccess', _158 => _158.content]);
4750
- const value = _optionalChain([forParseResult, 'access', _159 => _159.value, 'optionalAccess', _160 => _160.content]);
4751
- const index = _optionalChain([forParseResult, 'access', _161 => _161.index, 'optionalAccess', _162 => _162.content]);
4752
- const key = _optionalChain([forParseResult, 'access', _163 => _163.key, 'optionalAccess', _164 => _164.content]);
4792
+ const source = _optionalChain([forParseResult, 'access', _160 => _160.source, 'optionalAccess', _161 => _161.content]);
4793
+ const value = _optionalChain([forParseResult, 'access', _162 => _162.value, 'optionalAccess', _163 => _163.content]);
4794
+ const index = _optionalChain([forParseResult, 'access', _164 => _164.index, 'optionalAccess', _165 => _165.content]);
4795
+ const key = _optionalChain([forParseResult, 'access', _166 => _166.key, 'optionalAccess', _167 => _167.content]);
4753
4796
  return {
4754
4797
  source,
4755
4798
  value,
@@ -4769,7 +4812,7 @@ function resolveVHtml(node, ir, ctx, nodeIR) {
4769
4812
  // src/core/transform/sfc/template/syntax-processor/process/props/resolve-v-if.ts
4770
4813
  function resolveVIf(node, _ir, ctx, nodeIR, siblingNodesIR) {
4771
4814
  const name = node.name === "else-if" ? "elseIf" : node.name;
4772
- const value = _nullishCoalesce(_optionalChain([node, 'access', _165 => _165.exp, 'optionalAccess', _166 => _166.content]), () => ( "true"));
4815
+ const value = _nullishCoalesce(_optionalChain([node, 'access', _168 => _168.exp, 'optionalAccess', _169 => _169.content]), () => ( "true"));
4773
4816
  const prevNode = siblingNodesIR[siblingNodesIR.length - 1];
4774
4817
  const isElseBranch = name === "else" || name === "elseIf";
4775
4818
  let hasError = false;
@@ -4808,7 +4851,7 @@ function resolveVIf(node, _ir, ctx, nodeIR, siblingNodesIR) {
4808
4851
  // src/core/transform/sfc/template/syntax-processor/process/props/resolve-v-memo.ts
4809
4852
  function resolveVMemo(node, _ir, ctx, nodeIR) {
4810
4853
  const exp = node.exp;
4811
- let value = _optionalChain([exp, 'optionalAccess', _167 => _167.content]);
4854
+ let value = _optionalChain([exp, 'optionalAccess', _170 => _170.content]);
4812
4855
  if (value !== void 0) {
4813
4856
  if (!value.trim() || !value.startsWith("[") && !value.endsWith("]")) {
4814
4857
  const { source, filename } = ctx;
@@ -4848,15 +4891,14 @@ function resolveVModel(node, _ir, ctx, elementNode, nodeIR) {
4848
4891
  const getterName = exp.content;
4849
4892
  const isComponent = elementNode.tagType === _compilercore.ElementTypes.COMPONENT;
4850
4893
  const inputType = resolveHtmlInput(elementNode, isComponent);
4851
- const propName = _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _168 => _168.content]), () => ( resolveModelPropName(inputType, isComponent)));
4894
+ const propName = _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _171 => _171.content]), () => ( resolveModelPropName(inputType, isComponent)));
4852
4895
  let valuePropIR;
4853
4896
  let eventPropIR;
4854
4897
  if (isComponent) {
4855
4898
  valuePropIR = createPropsIR("v-model", propName, getterName);
4856
- const getterNamespace = getRootIdName(getterName);
4857
- const eventReactName = `onUpdate${capitalize(getterNamespace)}`;
4858
- const eventVueName = `update:${getterNamespace}`;
4859
- const isTS = _optionalChain([ctx, 'access', _169 => _169.scriptData, 'optionalAccess', _170 => _170.lang, 'optionalAccess', _171 => _171.startsWith, 'call', _172 => _172("ts")]);
4899
+ const eventReactName = `onUpdate${capitalize(camelCase(propName))}`;
4900
+ const eventVueName = `update:${propName}`;
4901
+ const isTS = _optionalChain([ctx, 'access', _172 => _172.scriptData, 'optionalAccess', _173 => _173.lang, 'optionalAccess', _174 => _174.startsWith, 'call', _175 => _175("ts")]);
4860
4902
  const valueArg = isTS ? "value: any" : "value";
4861
4903
  const processedValue = applyValueModifiers("value", modifiers);
4862
4904
  const handlerBody = `(${valueArg}) => { ${getterName} = ${processedValue} }`;
@@ -4894,7 +4936,7 @@ function getRadioValue(elementNode) {
4894
4936
  const valueAttr = elementNode.props.find(
4895
4937
  (prop) => prop.type === _compilercore.NodeTypes.ATTRIBUTE && prop.name === "value"
4896
4938
  );
4897
- if (!_optionalChain([valueAttr, 'optionalAccess', _173 => _173.value, 'optionalAccess', _174 => _174.content])) return '""';
4939
+ if (!_optionalChain([valueAttr, 'optionalAccess', _176 => _176.value, 'optionalAccess', _177 => _177.content])) return '""';
4898
4940
  const content = valueAttr.value.content;
4899
4941
  return /^['"]/.test(content) ? content : `"${content}"`;
4900
4942
  }
@@ -4904,7 +4946,7 @@ function resolveHtmlInput(node, isComponent) {
4904
4946
  const typeProp = node.props.find(
4905
4947
  (prop) => prop.type === _compilercore.NodeTypes.ATTRIBUTE && prop.name === "type"
4906
4948
  );
4907
- return _optionalChain([typeProp, 'optionalAccess', _175 => _175.value, 'optionalAccess', _176 => _176.content, 'optionalAccess', _177 => _177.toLowerCase, 'call', _178 => _178()]);
4949
+ return _optionalChain([typeProp, 'optionalAccess', _178 => _178.value, 'optionalAccess', _179 => _179.content, 'optionalAccess', _180 => _180.toLowerCase, 'call', _181 => _181()]);
4908
4950
  }
4909
4951
  function applyValueModifiers(valueExp, modifiers) {
4910
4952
  let result = valueExp;
@@ -4916,12 +4958,6 @@ function applyValueModifiers(valueExp, modifiers) {
4916
4958
  }
4917
4959
  return result;
4918
4960
  }
4919
- function getRootIdName(expr) {
4920
- if (typeof expr !== "string") return;
4921
- const pattern = /^([a-zA-Z_$][a-zA-Z0-9_$]*)(?:[\.\?\.\[\(].*)?$/;
4922
- const match = pattern.exec(expr.trim());
4923
- return _optionalChain([match, 'optionalAccess', _179 => _179[1]]);
4924
- }
4925
4961
 
4926
4962
  // src/core/transform/sfc/template/syntax-processor/process/props/resolve-v-on.ts
4927
4963
 
@@ -5109,7 +5145,7 @@ function resolveVSlotProp(node, _ir, ctx) {
5109
5145
  const name = !arg || arg.content === "default" ? "children" : arg.content;
5110
5146
  const content = !isScoped ? [] : void 0;
5111
5147
  const callback = isScoped ? {
5112
- arg: _nullishCoalesce(_optionalChain([exp, 'optionalAccess', _180 => _180.content, 'optionalAccess', _181 => _181.trim, 'call', _182 => _182()]), () => ( "")),
5148
+ arg: _nullishCoalesce(_optionalChain([exp, 'optionalAccess', _182 => _182.content, 'optionalAccess', _183 => _183.trim, 'call', _184 => _184()]), () => ( "")),
5113
5149
  exp: []
5114
5150
  } : void 0;
5115
5151
  checkPropIsDynamicKey(ctx, node);
@@ -5117,7 +5153,7 @@ function resolveVSlotProp(node, _ir, ctx) {
5117
5153
  type: 2 /* SLOT */,
5118
5154
  name,
5119
5155
  rawName: _nullishCoalesce(node.rawName, () => ( "default")),
5120
- isStatic: _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _183 => _183.isStatic]), () => ( true)),
5156
+ isStatic: _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _185 => _185.isStatic]), () => ( true)),
5121
5157
  isScoped,
5122
5158
  content,
5123
5159
  callback
@@ -5151,7 +5187,7 @@ function resolveElementNode(node, ir, ctx, siblingNodesIR) {
5151
5187
  if (routerAdapter) {
5152
5188
  if (!ctx.route) ctx.route = true;
5153
5189
  nodeIR.isRoute = true;
5154
- recordImport(ctx, _optionalChain([routerAdapter, 'optionalAccess', _184 => _184.package]), routerAdapter.target);
5190
+ recordImport(ctx, _optionalChain([routerAdapter, 'optionalAccess', _186 => _186.package]), routerAdapter.target);
5155
5191
  }
5156
5192
  resolveProps(node, ir, ctx, nodeIR, siblingNodesIR);
5157
5193
  return nodeIR;
@@ -5287,7 +5323,7 @@ function resolveSlotProps(node, ctx) {
5287
5323
  for (const prop of node.props) {
5288
5324
  if (prop.type === _compilercore.NodeTypes.ATTRIBUTE) {
5289
5325
  const attr = prop.name;
5290
- const value = _optionalChain([prop, 'access', _185 => _185.value, 'optionalAccess', _186 => _186.content, 'access', _187 => _187.trim, 'call', _188 => _188()]);
5326
+ const value = _optionalChain([prop, 'access', _187 => _187.value, 'optionalAccess', _188 => _188.content, 'access', _189 => _189.trim, 'call', _190 => _190()]);
5291
5327
  if (attr === "name" && value) {
5292
5328
  result.name = camelCase(value);
5293
5329
  } else {
@@ -5377,19 +5413,19 @@ function resolveTemplate2(root, ctx) {
5377
5413
  // src/core/transform/sfc/index.ts
5378
5414
  function transform(ast, ctx, options) {
5379
5415
  const { template, script, style } = ast;
5380
- const templateIR = resolveTemplate2(_optionalChain([template, 'optionalAccess', _189 => _189.ast]), ctx);
5381
- const scriptIR = resolveScript2(_optionalChain([script, 'optionalAccess', _190 => _190.ast]), ctx);
5416
+ const templateIR = resolveTemplate2(_optionalChain([template, 'optionalAccess', _191 => _191.ast]), ctx);
5417
+ const scriptIR = resolveScript2(_optionalChain([script, 'optionalAccess', _192 => _192.ast]), ctx);
5382
5418
  const result = {
5383
5419
  template: templateIR,
5384
5420
  script: scriptIR,
5385
- style: _optionalChain([style, 'optionalAccess', _191 => _191.source, 'optionalAccess', _192 => _192.content])
5421
+ style: _optionalChain([style, 'optionalAccess', _193 => _193.source, 'optionalAccess', _194 => _194.content])
5386
5422
  };
5387
- executePlugins(_optionalChain([options, 'optionalAccess', _193 => _193.plugins]), result, ctx);
5423
+ executePlugins(_optionalChain([options, 'optionalAccess', _195 => _195.plugins]), result, ctx);
5388
5424
  return result;
5389
5425
  }
5390
5426
 
5391
5427
  // package.json
5392
- var version = "1.1.1";
5428
+ var version = "1.2.1";
5393
5429
  var bin = {
5394
5430
  vureact: "./bin/vureact.js"
5395
5431
  };
@@ -5422,7 +5458,7 @@ async function formatWithPrettier(code, lang, opts) {
5422
5458
  ...opts,
5423
5459
  parser
5424
5460
  });
5425
- } catch (e9) {
5461
+ } catch (e10) {
5426
5462
  logger.info("Prettier is unavailable; the built-in simple formatter is used.");
5427
5463
  return simpleFormat(code);
5428
5464
  }
@@ -5447,7 +5483,7 @@ var Helper = (_class3 = class {
5447
5483
  __init6() {this.outDir = "react-app"}
5448
5484
  constructor(opts) {;_class3.prototype.__init5.call(this);_class3.prototype.__init6.call(this);
5449
5485
  this.compilerOpts = opts;
5450
- if (_optionalChain([opts, 'access', _194 => _194.output, 'optionalAccess', _195 => _195.workspace])) {
5486
+ if (_optionalChain([opts, 'access', _196 => _196.output, 'optionalAccess', _197 => _197.workspace])) {
5451
5487
  this.workspaceDir = opts.output.workspace;
5452
5488
  }
5453
5489
  const excludePatterns = PathFilter.withDefaults(opts.exclude || []);
@@ -5482,7 +5518,7 @@ var Helper = (_class3 = class {
5482
5518
  }
5483
5519
  getOutDirName() {
5484
5520
  const { output } = this.compilerOpts;
5485
- return _optionalChain([output, 'optionalAccess', _196 => _196.outDir]) || this.outDir;
5521
+ return _optionalChain([output, 'optionalAccess', _198 => _198.outDir]) || this.outDir;
5486
5522
  }
5487
5523
  getWorkspaceDir() {
5488
5524
  return _path2.default.resolve(this.getProjectRoot(), this.workspaceDir);
@@ -5496,7 +5532,7 @@ var Helper = (_class3 = class {
5496
5532
  }
5497
5533
  getIgnoreAssets() {
5498
5534
  const { output } = this.compilerOpts;
5499
- if (_optionalChain([output, 'optionalAccess', _197 => _197.ignoreAssets])) {
5535
+ if (_optionalChain([output, 'optionalAccess', _199 => _199.ignoreAssets])) {
5500
5536
  return new Set(output.ignoreAssets.map(normalizePath));
5501
5537
  }
5502
5538
  return /* @__PURE__ */ new Set([
@@ -5577,12 +5613,12 @@ var Helper = (_class3 = class {
5577
5613
  */
5578
5614
  async formatCode({ code, fileInfo }) {
5579
5615
  const { format } = this.compilerOpts;
5580
- if (!_optionalChain([format, 'optionalAccess', _198 => _198.enabled])) return code;
5581
- if (_optionalChain([format, 'optionalAccess', _199 => _199.formatter]) === "builtin") {
5616
+ if (!_optionalChain([format, 'optionalAccess', _200 => _200.enabled])) return code;
5617
+ if (_optionalChain([format, 'optionalAccess', _201 => _201.formatter]) === "builtin") {
5582
5618
  return simpleFormat(code);
5583
5619
  }
5584
- const { lang } = _nullishCoalesce(_optionalChain([fileInfo, 'optionalAccess', _200 => _200.jsx]), () => ( _optionalChain([fileInfo, 'optionalAccess', _201 => _201.script])));
5585
- return await formatWithPrettier(code, lang, _optionalChain([format, 'optionalAccess', _202 => _202.prettierOptions]));
5620
+ const { lang } = _nullishCoalesce(_optionalChain([fileInfo, 'optionalAccess', _202 => _202.jsx]), () => ( _optionalChain([fileInfo, 'optionalAccess', _203 => _203.script])));
5621
+ return await formatWithPrettier(code, lang, _optionalChain([format, 'optionalAccess', _204 => _204.prettierOptions]));
5586
5622
  }
5587
5623
  /**
5588
5624
  * 通用的缓存校验工具函数
@@ -5629,7 +5665,7 @@ var Helper = (_class3 = class {
5629
5665
  target: data[key] || [],
5630
5666
  source: data
5631
5667
  };
5632
- } catch (e10) {
5668
+ } catch (e11) {
5633
5669
  return defaultData;
5634
5670
  }
5635
5671
  }
@@ -5715,7 +5751,7 @@ var Helper = (_class3 = class {
5715
5751
  }
5716
5752
  resolveViteCreateApp() {
5717
5753
  const { output } = this.compilerOpts;
5718
- const config = _optionalChain([output, 'optionalAccess', _203 => _203.bootstrapVite]);
5754
+ const config = _optionalChain([output, 'optionalAccess', _205 => _205.bootstrapVite]);
5719
5755
  const template = typeof config === "object" ? config.template : "react-ts";
5720
5756
  const outDirName = this.getOutDirName();
5721
5757
  const cmd = `npm create vite@latest ${outDirName} -- --template ${template}`;
@@ -5729,7 +5765,7 @@ var Helper = (_class3 = class {
5729
5765
  * 获取需要排除编译的文件
5730
5766
  */
5731
5767
  getExcludes() {
5732
- if (!_optionalChain([this, 'access', _204 => _204.compilerOpts, 'access', _205 => _205.exclude, 'optionalAccess', _206 => _206.length])) {
5768
+ if (!_optionalChain([this, 'access', _206 => _206.compilerOpts, 'access', _207 => _207.exclude, 'optionalAccess', _208 => _208.length])) {
5733
5769
  return PathFilter.withDefaults();
5734
5770
  }
5735
5771
  return this.compilerOpts.exclude;
@@ -5810,7 +5846,7 @@ function parseOnlyStyle(source, ctx, options) {
5810
5846
  ast: void 0
5811
5847
  }
5812
5848
  };
5813
- executePlugins(_optionalChain([options, 'optionalAccess', _207 => _207.plugins]), result, ctx);
5849
+ executePlugins(_optionalChain([options, 'optionalAccess', _209 => _209.plugins]), result, ctx);
5814
5850
  return result;
5815
5851
  }
5816
5852
 
@@ -5996,16 +6032,16 @@ var BaseCompiler = (_class5 = class extends Helper {
5996
6032
  });
5997
6033
  const genOptions = this.prepareGenerateOptions(filename);
5998
6034
  const resolveSFCAndScriptFile = () => {
5999
- const ast = parse(source, ctx.data, { plugins: _optionalChain([plugins, 'optionalAccess', _208 => _208.parser]) });
6000
- const ir = transform(ast, ctx.data, { plugins: _optionalChain([plugins, 'optionalAccess', _209 => _209.transformer]) });
6035
+ const ast = parse(source, ctx.data, { plugins: _optionalChain([plugins, 'optionalAccess', _210 => _210.parser]) });
6036
+ const ir = transform(ast, ctx.data, { plugins: _optionalChain([plugins, 'optionalAccess', _211 => _211.transformer]) });
6001
6037
  const gen = generate(ir, ctx.data, {
6002
6038
  ...genOptions,
6003
- plugins: _optionalChain([plugins, 'optionalAccess', _210 => _210.codegen])
6039
+ plugins: _optionalChain([plugins, 'optionalAccess', _212 => _212.codegen])
6004
6040
  });
6005
6041
  return this.resolveMainResult(ir, gen, ctx.data);
6006
6042
  };
6007
6043
  const resolveStyleFile = () => {
6008
- const result = parseOnlyStyle(source, ctx.data, { plugins: _optionalChain([plugins, 'optionalAccess', _211 => _211.parser]) });
6044
+ const result = parseOnlyStyle(source, ctx.data, { plugins: _optionalChain([plugins, 'optionalAccess', _213 => _213.parser]) });
6009
6045
  return this.resolveStyleResult(result, ctx.data);
6010
6046
  };
6011
6047
  try {
@@ -6132,9 +6168,9 @@ var BaseCompiler = (_class5 = class extends Helper {
6132
6168
  lang
6133
6169
  },
6134
6170
  css: {
6135
- file: _optionalChain([styleData, 'optionalAccess', _212 => _212.filePath]),
6136
- hash: _optionalChain([styleData, 'optionalAccess', _213 => _213.scopeId]),
6137
- code: _optionalChain([ir, 'optionalAccess', _214 => _214.style])
6171
+ file: _optionalChain([styleData, 'optionalAccess', _214 => _214.filePath]),
6172
+ hash: _optionalChain([styleData, 'optionalAccess', _215 => _215.scopeId]),
6173
+ code: _optionalChain([ir, 'optionalAccess', _216 => _216.style])
6138
6174
  }
6139
6175
  },
6140
6176
  ...base
@@ -6208,7 +6244,7 @@ var AssetManager = (_class6 = class {
6208
6244
  const relativeToRoot = normalizePath(this.fileCompiler.relativePath(p));
6209
6245
  const filename = _path2.default.basename(p).toLowerCase();
6210
6246
  const ext = _path2.default.extname(p).toLowerCase();
6211
- if (!_optionalChain([this, 'access', _215 => _215.fileCompiler, 'access', _216 => _216.options, 'access', _217 => _217.output, 'optionalAccess', _218 => _218.ignoreAssets])) {
6247
+ if (!_optionalChain([this, 'access', _217 => _217.fileCompiler, 'access', _218 => _218.options, 'access', _219 => _219.output, 'optionalAccess', _220 => _220.ignoreAssets])) {
6212
6248
  const shouldExclude = Array.from(exclusions).some((pattern) => {
6213
6249
  if (pattern.endsWith(".")) {
6214
6250
  return filename.startsWith(pattern);
@@ -6345,10 +6381,10 @@ var CleanupManager = class {
6345
6381
  const removeFn = async (m) => {
6346
6382
  if (key === "sfc" /* SFC */) {
6347
6383
  const meta = m;
6348
- if (!_optionalChain([meta, 'optionalAccess', _219 => _219.output])) return;
6384
+ if (!_optionalChain([meta, 'optionalAccess', _221 => _221.output])) return;
6349
6385
  const { jsx, css } = meta.output;
6350
6386
  await this.fileCompiler.removeOutputFile(jsx.file);
6351
- if (_optionalChain([css, 'optionalAccess', _220 => _220.file])) {
6387
+ if (_optionalChain([css, 'optionalAccess', _222 => _222.file])) {
6352
6388
  await this.fileCompiler.removeOutputFile(css.file);
6353
6389
  }
6354
6390
  } else if (key === "script" /* SCRIPT */ || key === "copied" /* ASSET */) {
@@ -6392,7 +6428,7 @@ var CompilationUnitProcessor = class {
6392
6428
  const isScriptFile = key === "script" /* SCRIPT */;
6393
6429
  const isStyleFile = key === "style" /* STYLE */;
6394
6430
  if (isSFC || isScriptFile) {
6395
- unit.hasRoute = _optionalChain([result, 'optionalAccess', _221 => _221.hasRoute]);
6431
+ unit.hasRoute = _optionalChain([result, 'optionalAccess', _223 => _223.hasRoute]);
6396
6432
  }
6397
6433
  const resolveFileInfo = () => {
6398
6434
  if (isSFC) {
@@ -6412,7 +6448,7 @@ var CompilationUnitProcessor = class {
6412
6448
  const { script } = result.fileInfo;
6413
6449
  unit.output = {
6414
6450
  script: {
6415
- file: _optionalChain([script, 'optionalAccess', _222 => _222.file]),
6451
+ file: _optionalChain([script, 'optionalAccess', _224 => _224.file]),
6416
6452
  code
6417
6453
  }
6418
6454
  };
@@ -6492,7 +6528,7 @@ var FileProcessor = (_class7 = class {
6492
6528
  const absPath = this.fileCompiler.getAbsPath(filePath);
6493
6529
  const fileMeta = await this.fileCompiler.getFileMeta(absPath);
6494
6530
  const cache = (this.fileCompiler.getIsCache() ? existingCache : void 0) || await this.fileCompiler.loadCache(key);
6495
- const record = _optionalChain([cache, 'optionalAccess', _223 => _223.target, 'access', _224 => _224.find, 'call', _225 => _225((c) => c.file === absPath)]);
6531
+ const record = _optionalChain([cache, 'optionalAccess', _225 => _225.target, 'access', _226 => _226.find, 'call', _227 => _227((c) => c.file === absPath)]);
6496
6532
  const { shouldCompile, hash } = await this.fileCompiler.checkCacheStatus(
6497
6533
  fileMeta,
6498
6534
  record,
@@ -6511,10 +6547,10 @@ var FileProcessor = (_class7 = class {
6511
6547
  hash: hash || this.fileCompiler.genHash(source)
6512
6548
  };
6513
6549
  const processed = await this.compilationUnitProcessor.resolve(initUnit, key);
6514
- if (_optionalChain([processed, 'optionalAccess', _226 => _226.output])) {
6550
+ if (_optionalChain([processed, 'optionalAccess', _228 => _228.output])) {
6515
6551
  await this.compilationUnitProcessor.saveCompiledFiles(processed, key);
6516
6552
  if (key === "sfc" /* SFC */ || key === "script" /* SCRIPT */) {
6517
- if (_optionalChain([processed, 'optionalAccess', _227 => _227.hasRoute])) {
6553
+ if (_optionalChain([processed, 'optionalAccess', _229 => _229.hasRoute])) {
6518
6554
  await this.injectVuReactRouteDep();
6519
6555
  }
6520
6556
  }
@@ -6704,7 +6740,7 @@ var ViteBootstrapper = (_class9 = class {
6704
6740
  */
6705
6741
  resolveViteCreateApp() {
6706
6742
  const { output } = this.options;
6707
- const config = _optionalChain([output, 'optionalAccess', _228 => _228.bootstrapVite]);
6743
+ const config = _optionalChain([output, 'optionalAccess', _230 => _230.bootstrapVite]);
6708
6744
  const template = typeof config === "object" ? config.template : "react-ts";
6709
6745
  const outDirName = this.fileCompiler.getOutDirName();
6710
6746
  const cmd = `npm create vite@latest ${outDirName} -- --template ${template}`;
@@ -6792,7 +6828,7 @@ var FileCompiler = (_class10 = class extends BaseCompiler {
6792
6828
  this.spinner.start("Copying assets...");
6793
6829
  const assetCount = await this.assetManager.runAssetPipeline();
6794
6830
  this.spinner.stop();
6795
- await _optionalChain([this, 'access', _229 => _229.options, 'access', _230 => _230.onSuccess, 'optionalCall', _231 => _231()]);
6831
+ await _optionalChain([this, 'access', _231 => _231.options, 'access', _232 => _232.onSuccess, 'optionalCall', _233 => _233()]);
6796
6832
  const endTime = calcElapsedTime(startTime);
6797
6833
  this.printCoreLogs();
6798
6834
  this.showCompileStats(endTime, sfcCount, scriptCount, styleCount, assetCount);