@vue/compiler-dom 3.4.26 → 3.4.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-dom v3.4.26
2
+ * @vue/compiler-dom v3.4.28
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -349,8 +349,7 @@ const transformClick = (key, event) => {
349
349
  const transformOn = (dir, node, context) => {
350
350
  return compilerCore.transformOn(dir, node, context, (baseResult) => {
351
351
  const { modifiers } = dir;
352
- if (!modifiers.length)
353
- return baseResult;
352
+ if (!modifiers.length) return baseResult;
354
353
  let { key, value: handlerExp } = baseResult.props[0];
355
354
  const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc);
356
355
  if (nonKeyModifiers.includes("right")) {
@@ -519,6 +518,7 @@ function analyzeNode(node) {
519
518
  return false;
520
519
  };
521
520
  function walk(node2) {
521
+ const isOptionTag = node2.tag === "option" && node2.ns === 0;
522
522
  for (let i = 0; i < node2.props.length; i++) {
523
523
  const p = node2.props[i];
524
524
  if (p.type === 6 && !isStringifiableAttr(p.name, node2.ns)) {
@@ -531,6 +531,9 @@ function analyzeNode(node) {
531
531
  if (p.exp && (p.exp.type === 8 || p.exp.constType < 3)) {
532
532
  return bail();
533
533
  }
534
+ if (isOptionTag && compilerCore.isStaticArgOf(p.arg, "value") && p.exp && p.exp.ast && p.exp.ast.type !== "StringLiteral") {
535
+ return bail();
536
+ }
534
537
  }
535
538
  }
536
539
  for (let i = 0; i < node2.children.length; i++) {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-dom v3.4.26
2
+ * @vue/compiler-dom v3.4.28
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -331,8 +331,7 @@ const transformClick = (key, event) => {
331
331
  const transformOn = (dir, node, context) => {
332
332
  return compilerCore.transformOn(dir, node, context, (baseResult) => {
333
333
  const { modifiers } = dir;
334
- if (!modifiers.length)
335
- return baseResult;
334
+ if (!modifiers.length) return baseResult;
336
335
  let { key, value: handlerExp } = baseResult.props[0];
337
336
  const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc);
338
337
  if (nonKeyModifiers.includes("right")) {
@@ -455,6 +454,7 @@ function analyzeNode(node) {
455
454
  return false;
456
455
  };
457
456
  function walk(node2) {
457
+ const isOptionTag = node2.tag === "option" && node2.ns === 0;
458
458
  for (let i = 0; i < node2.props.length; i++) {
459
459
  const p = node2.props[i];
460
460
  if (p.type === 6 && !isStringifiableAttr(p.name, node2.ns)) {
@@ -467,6 +467,9 @@ function analyzeNode(node) {
467
467
  if (p.exp && (p.exp.type === 8 || p.exp.constType < 3)) {
468
468
  return bail();
469
469
  }
470
+ if (isOptionTag && compilerCore.isStaticArgOf(p.arg, "value") && p.exp && p.exp.ast && p.exp.ast.type !== "StringLiteral") {
471
+ return bail();
472
+ }
470
473
  }
471
474
  }
472
475
  for (let i = 0; i < node2.children.length; i++) {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-dom v3.4.26
2
+ * @vue/compiler-dom v3.4.28
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -72,6 +72,9 @@ const slotFlagsText = {
72
72
 
73
73
  const range = 2;
74
74
  function generateCodeFrame(source, start = 0, end = source.length) {
75
+ start = Math.max(0, Math.min(start, source.length));
76
+ end = Math.max(0, Math.min(end, source.length));
77
+ if (start > end) return "";
75
78
  let lines = source.split(/(\r?\n)/);
76
79
  const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
77
80
  lines = lines.filter((_, idx) => idx % 2 === 0);
@@ -81,8 +84,7 @@ function generateCodeFrame(source, start = 0, end = source.length) {
81
84
  count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
82
85
  if (count >= start) {
83
86
  for (let j = i - range; j <= i + range || end > count; j++) {
84
- if (j < 0 || j >= lines.length)
85
- continue;
87
+ if (j < 0 || j >= lines.length) continue;
86
88
  const line = j + 1;
87
89
  res.push(
88
90
  `${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
@@ -1371,8 +1373,7 @@ function warnDeprecation(key, context, loc, ...args) {
1371
1373
  Details: ${link}` : ``}`;
1372
1374
  const err = new SyntaxError(msg);
1373
1375
  err.code = key;
1374
- if (loc)
1375
- err.loc = loc;
1376
+ if (loc) err.loc = loc;
1376
1377
  context.onWarn(err);
1377
1378
  }
1378
1379
 
@@ -1608,16 +1609,14 @@ function walkFunctionParams(node, onIdent) {
1608
1609
  function walkBlockDeclarations(block, onIdent) {
1609
1610
  for (const stmt of block.body) {
1610
1611
  if (stmt.type === "VariableDeclaration") {
1611
- if (stmt.declare)
1612
- continue;
1612
+ if (stmt.declare) continue;
1613
1613
  for (const decl of stmt.declarations) {
1614
1614
  for (const id of extractIdentifiers(decl.id)) {
1615
1615
  onIdent(id);
1616
1616
  }
1617
1617
  }
1618
1618
  } else if (stmt.type === "FunctionDeclaration" || stmt.type === "ClassDeclaration") {
1619
- if (stmt.declare || !stmt.id)
1620
- continue;
1619
+ if (stmt.declare || !stmt.id) continue;
1621
1620
  onIdent(stmt.id);
1622
1621
  } else if (stmt.type === "ForOfStatement" || stmt.type === "ForInStatement" || stmt.type === "ForStatement") {
1623
1622
  const variable = stmt.type === "ForStatement" ? stmt.init : stmt.left;
@@ -1654,8 +1653,7 @@ function extractIdentifiers(param, nodes = []) {
1654
1653
  break;
1655
1654
  case "ArrayPattern":
1656
1655
  param.elements.forEach((element) => {
1657
- if (element)
1658
- extractIdentifiers(element, nodes);
1656
+ if (element) extractIdentifiers(element, nodes);
1659
1657
  });
1660
1658
  break;
1661
1659
  case "RestElement":
@@ -1709,7 +1707,7 @@ function isCoreComponent(tag) {
1709
1707
  return BASE_TRANSITION;
1710
1708
  }
1711
1709
  }
1712
- const nonIdentifierRE = /^\d|[^\$\w]/;
1710
+ const nonIdentifierRE = /^\d|[^\$\w\xA0-\uFFFF]/;
1713
1711
  const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
1714
1712
  const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
1715
1713
  const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
@@ -1820,8 +1818,7 @@ function findProp(node, name, dynamicOnly = false, allowEmpty = false) {
1820
1818
  for (let i = 0; i < node.props.length; i++) {
1821
1819
  const p = node.props[i];
1822
1820
  if (p.type === 6) {
1823
- if (dynamicOnly)
1824
- continue;
1821
+ if (dynamicOnly) continue;
1825
1822
  if (p.name === name && (p.value || allowEmpty)) {
1826
1823
  return p;
1827
1824
  }
@@ -1985,7 +1982,7 @@ function getMemoedVNodeCall(node) {
1985
1982
  return node;
1986
1983
  }
1987
1984
  }
1988
- const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
1985
+ const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+(\S[\s\S]*)/;
1989
1986
 
1990
1987
  const defaultParserOptions = {
1991
1988
  parseMode: "base",
@@ -2138,8 +2135,7 @@ const tokenizer = new Tokenizer(stack, {
2138
2135
  }
2139
2136
  },
2140
2137
  ondirarg(start, end) {
2141
- if (start === end)
2142
- return;
2138
+ if (start === end) return;
2143
2139
  const arg = getSlice(start, end);
2144
2140
  if (inVPre) {
2145
2141
  currentProp.name += arg;
@@ -2171,14 +2167,12 @@ const tokenizer = new Tokenizer(stack, {
2171
2167
  },
2172
2168
  onattribdata(start, end) {
2173
2169
  currentAttrValue += getSlice(start, end);
2174
- if (currentAttrStartIndex < 0)
2175
- currentAttrStartIndex = start;
2170
+ if (currentAttrStartIndex < 0) currentAttrStartIndex = start;
2176
2171
  currentAttrEndIndex = end;
2177
2172
  },
2178
2173
  onattribentity(char, start, end) {
2179
2174
  currentAttrValue += char;
2180
- if (currentAttrStartIndex < 0)
2181
- currentAttrStartIndex = start;
2175
+ if (currentAttrStartIndex < 0) currentAttrStartIndex = start;
2182
2176
  currentAttrEndIndex = end;
2183
2177
  },
2184
2178
  onattribnameend(end) {
@@ -2325,8 +2319,7 @@ function parseForExpression(input) {
2325
2319
  const loc = input.loc;
2326
2320
  const exp = input.content;
2327
2321
  const inMatch = exp.match(forAliasRE);
2328
- if (!inMatch)
2329
- return;
2322
+ if (!inMatch) return;
2330
2323
  const [, LHS, RHS] = inMatch;
2331
2324
  const createAliasExpression = (content, offset, asParam = false) => {
2332
2325
  const start = loc.start.offset + offset;
@@ -2519,14 +2512,12 @@ function onCloseTag(el, end, isImplied = false) {
2519
2512
  }
2520
2513
  function lookAhead(index, c) {
2521
2514
  let i = index;
2522
- while (currentInput.charCodeAt(i) !== c && i < currentInput.length - 1)
2523
- i++;
2515
+ while (currentInput.charCodeAt(i) !== c && i < currentInput.length - 1) i++;
2524
2516
  return i;
2525
2517
  }
2526
2518
  function backTrack(index, c) {
2527
2519
  let i = index;
2528
- while (currentInput.charCodeAt(i) !== c && i >= 0)
2529
- i--;
2520
+ while (currentInput.charCodeAt(i) !== c && i >= 0) i--;
2530
2521
  return i;
2531
2522
  }
2532
2523
  const specialTemplateDir = /* @__PURE__ */ new Set(["if", "else", "else-if", "for", "slot"]);
@@ -2829,7 +2820,7 @@ function getConstantType(node, context) {
2829
2820
  if (codegenNode.type !== 13) {
2830
2821
  return 0;
2831
2822
  }
2832
- if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject") {
2823
+ if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject" && node.tag !== "math") {
2833
2824
  return 0;
2834
2825
  }
2835
2826
  const flag = getPatchFlag(codegenNode);
@@ -3109,8 +3100,7 @@ function createTransformContext(root, {
3109
3100
  removeIdentifiers(exp) {
3110
3101
  },
3111
3102
  hoist(exp) {
3112
- if (isString(exp))
3113
- exp = createSimpleExpression(exp);
3103
+ if (isString(exp)) exp = createSimpleExpression(exp);
3114
3104
  context.hoists.push(exp);
3115
3105
  const identifier = createSimpleExpression(
3116
3106
  `_hoisted_${context.hoists.length}`,
@@ -3193,8 +3183,7 @@ function traverseChildren(parent, context) {
3193
3183
  };
3194
3184
  for (; i < parent.children.length; i++) {
3195
3185
  const child = parent.children[i];
3196
- if (isString(child))
3197
- continue;
3186
+ if (isString(child)) continue;
3198
3187
  context.grandParent = context.parent;
3199
3188
  context.parent = parent;
3200
3189
  context.childIndex = i;
@@ -3265,8 +3254,7 @@ function createStructuralDirectiveTransform(name, fn) {
3265
3254
  props.splice(i, 1);
3266
3255
  i--;
3267
3256
  const onExit = fn(node, prop, context);
3268
- if (onExit)
3269
- exitFns.push(onExit);
3257
+ if (onExit) exitFns.push(onExit);
3270
3258
  }
3271
3259
  }
3272
3260
  return exitFns;
@@ -3338,8 +3326,7 @@ function createCodegenContext(ast, {
3338
3326
  }
3339
3327
  function generate(ast, options = {}) {
3340
3328
  const context = createCodegenContext(ast, options);
3341
- if (options.onContextCreated)
3342
- options.onContextCreated(context);
3329
+ if (options.onContextCreated) options.onContextCreated(context);
3343
3330
  const {
3344
3331
  mode,
3345
3332
  push,
@@ -3621,8 +3608,7 @@ function genExpression(node, context) {
3621
3608
  }
3622
3609
  function genInterpolation(node, context) {
3623
3610
  const { push, helper, pure } = context;
3624
- if (pure)
3625
- push(PURE_ANNOTATION);
3611
+ if (pure) push(PURE_ANNOTATION);
3626
3612
  push(`${helper(TO_DISPLAY_STRING)}(`);
3627
3613
  genNode(node.content, context);
3628
3614
  push(`)`);
@@ -3702,8 +3688,7 @@ function genVNodeCall(node, context) {
3702
3688
  function genNullableArgs(args) {
3703
3689
  let i = args.length;
3704
3690
  while (i--) {
3705
- if (args[i] != null)
3706
- break;
3691
+ if (args[i] != null) break;
3707
3692
  }
3708
3693
  return args.slice(0, i + 1).map((arg) => arg || `null`);
3709
3694
  }
@@ -4013,8 +3998,7 @@ function processIf(node, dir, context, processCodegen) {
4013
3998
  sibling.branches.push(branch);
4014
3999
  const onExit = processCodegen && processCodegen(sibling, branch, false);
4015
4000
  traverseNode(branch, context);
4016
- if (onExit)
4017
- onExit();
4001
+ if (onExit) onExit();
4018
4002
  context.currentNode = null;
4019
4003
  } else {
4020
4004
  context.onError(
@@ -4136,6 +4120,80 @@ function getParentCondition(node) {
4136
4120
  }
4137
4121
  }
4138
4122
 
4123
+ const transformBind = (dir, _node, context) => {
4124
+ const { modifiers, loc } = dir;
4125
+ const arg = dir.arg;
4126
+ let { exp } = dir;
4127
+ if (exp && exp.type === 4 && !exp.content.trim()) {
4128
+ {
4129
+ exp = void 0;
4130
+ }
4131
+ }
4132
+ if (!exp) {
4133
+ if (arg.type !== 4 || !arg.isStatic) {
4134
+ context.onError(
4135
+ createCompilerError(
4136
+ 52,
4137
+ arg.loc
4138
+ )
4139
+ );
4140
+ return {
4141
+ props: [
4142
+ createObjectProperty(arg, createSimpleExpression("", true, loc))
4143
+ ]
4144
+ };
4145
+ }
4146
+ transformBindShorthand(dir);
4147
+ exp = dir.exp;
4148
+ }
4149
+ if (arg.type !== 4) {
4150
+ arg.children.unshift(`(`);
4151
+ arg.children.push(`) || ""`);
4152
+ } else if (!arg.isStatic) {
4153
+ arg.content = `${arg.content} || ""`;
4154
+ }
4155
+ if (modifiers.includes("camel")) {
4156
+ if (arg.type === 4) {
4157
+ if (arg.isStatic) {
4158
+ arg.content = camelize(arg.content);
4159
+ } else {
4160
+ arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
4161
+ }
4162
+ } else {
4163
+ arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
4164
+ arg.children.push(`)`);
4165
+ }
4166
+ }
4167
+ if (!context.inSSR) {
4168
+ if (modifiers.includes("prop")) {
4169
+ injectPrefix(arg, ".");
4170
+ }
4171
+ if (modifiers.includes("attr")) {
4172
+ injectPrefix(arg, "^");
4173
+ }
4174
+ }
4175
+ return {
4176
+ props: [createObjectProperty(arg, exp)]
4177
+ };
4178
+ };
4179
+ const transformBindShorthand = (dir, context) => {
4180
+ const arg = dir.arg;
4181
+ const propName = camelize(arg.content);
4182
+ dir.exp = createSimpleExpression(propName, false, arg.loc);
4183
+ };
4184
+ const injectPrefix = (arg, prefix) => {
4185
+ if (arg.type === 4) {
4186
+ if (arg.isStatic) {
4187
+ arg.content = prefix + arg.content;
4188
+ } else {
4189
+ arg.content = `\`${prefix}\${${arg.content}}\``;
4190
+ }
4191
+ } else {
4192
+ arg.children.unshift(`'${prefix}' + (`);
4193
+ arg.children.push(`)`);
4194
+ }
4195
+ };
4196
+
4139
4197
  const transformFor = createStructuralDirectiveTransform(
4140
4198
  "for",
4141
4199
  (node, dir, context) => {
@@ -4146,9 +4204,12 @@ const transformFor = createStructuralDirectiveTransform(
4146
4204
  ]);
4147
4205
  const isTemplate = isTemplateNode(node);
4148
4206
  const memo = findDir(node, "memo");
4149
- const keyProp = findProp(node, `key`);
4150
- const keyExp = keyProp && (keyProp.type === 6 ? createSimpleExpression(keyProp.value.content, true) : keyProp.exp);
4151
- const keyProperty = keyProp ? createObjectProperty(`key`, keyExp) : null;
4207
+ const keyProp = findProp(node, `key`, false, true);
4208
+ if (keyProp && keyProp.type === 7 && !keyProp.exp) {
4209
+ transformBindShorthand(keyProp);
4210
+ }
4211
+ const keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
4212
+ const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
4152
4213
  const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
4153
4214
  const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
4154
4215
  forNode.codegenNode = createVNodeCall(
@@ -4297,13 +4358,11 @@ function processFor(node, dir, context, processCodegen) {
4297
4358
  const onExit = processCodegen && processCodegen(forNode);
4298
4359
  return () => {
4299
4360
  scopes.vFor--;
4300
- if (onExit)
4301
- onExit();
4361
+ if (onExit) onExit();
4302
4362
  };
4303
4363
  }
4304
4364
  function finalizeForParseResult(result, context) {
4305
- if (result.finalized)
4306
- return;
4365
+ if (result.finalized) return;
4307
4366
  {
4308
4367
  validateBrowserExpression(result.source, context);
4309
4368
  if (result.key) {
@@ -4336,8 +4395,7 @@ function createForLoopParams({ value, key, index }, memoArgs = []) {
4336
4395
  function createParamsList(args) {
4337
4396
  let i = args.length;
4338
4397
  while (i--) {
4339
- if (args[i])
4340
- break;
4398
+ if (args[i]) break;
4341
4399
  }
4342
4400
  return args.slice(0, i + 1).map((arg, i2) => arg || createSimpleExpression(`_`.repeat(i2 + 1), false));
4343
4401
  }
@@ -4599,13 +4657,11 @@ function hasForwardedSlots(children) {
4599
4657
  }
4600
4658
  break;
4601
4659
  case 9:
4602
- if (hasForwardedSlots(child.branches))
4603
- return true;
4660
+ if (hasForwardedSlots(child.branches)) return true;
4604
4661
  break;
4605
4662
  case 10:
4606
4663
  case 11:
4607
- if (hasForwardedSlots(child.children))
4608
- return true;
4664
+ if (hasForwardedSlots(child.children)) return true;
4609
4665
  break;
4610
4666
  }
4611
4667
  }
@@ -4641,7 +4697,7 @@ const transformElement = (node, context) => {
4641
4697
  // updates inside get proper isSVG flag at runtime. (#639, #643)
4642
4698
  // This is technically web-specific, but splitting the logic out of core
4643
4699
  // leads to too much unnecessary complexity.
4644
- (tag === "svg" || tag === "foreignObject")
4700
+ (tag === "svg" || tag === "foreignObject" || tag === "math")
4645
4701
  );
4646
4702
  if (props.length > 0) {
4647
4703
  const propsBuildResult = buildProps(
@@ -4764,8 +4820,7 @@ function resolveComponentType(node, context, ssr = false) {
4764
4820
  }
4765
4821
  const builtIn = isCoreComponent(tag) || context.isBuiltInComponent(tag);
4766
4822
  if (builtIn) {
4767
- if (!ssr)
4768
- context.helper(builtIn);
4823
+ if (!ssr) context.helper(builtIn);
4769
4824
  return builtIn;
4770
4825
  }
4771
4826
  context.helper(RESOLVE_COMPONENT);
@@ -4794,8 +4849,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
4794
4849
  );
4795
4850
  properties = [];
4796
4851
  }
4797
- if (arg)
4798
- mergeArgs.push(arg);
4852
+ if (arg) mergeArgs.push(arg);
4799
4853
  };
4800
4854
  const pushRefVForMarker = () => {
4801
4855
  if (context.scopes.vFor > 0) {
@@ -5132,8 +5186,7 @@ function buildDirectiveArgs(dir, context) {
5132
5186
  }
5133
5187
  }
5134
5188
  const { loc } = dir;
5135
- if (dir.exp)
5136
- dirArgs.push(dir.exp);
5189
+ if (dir.exp) dirArgs.push(dir.exp);
5137
5190
  if (dir.arg) {
5138
5191
  if (!dir.exp) {
5139
5192
  dirArgs.push(`void 0`);
@@ -5163,8 +5216,7 @@ function stringifyDynamicPropNames(props) {
5163
5216
  let propsNamesString = `[`;
5164
5217
  for (let i = 0, l = props.length; i < l; i++) {
5165
5218
  propsNamesString += JSON.stringify(props[i]);
5166
- if (i < l - 1)
5167
- propsNamesString += ", ";
5219
+ if (i < l - 1) propsNamesString += ", ";
5168
5220
  }
5169
5221
  return propsNamesString + `]`;
5170
5222
  }
@@ -5258,7 +5310,7 @@ function processSlotOutlet(node, context) {
5258
5310
  };
5259
5311
  }
5260
5312
 
5261
- const fnExpRE = /^\s*([\w$_]+|(async\s*)?\([^)]*?\))\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
5313
+ const fnExpRE = /^\s*(async\s*)?(\([^)]*?\)|[\w$_]+)\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
5262
5314
  const transformOn$1 = (dir, node, context, augmentor) => {
5263
5315
  const { loc, modifiers, arg } = dir;
5264
5316
  if (!dir.exp && !modifiers.length) {
@@ -5339,75 +5391,6 @@ const transformOn$1 = (dir, node, context, augmentor) => {
5339
5391
  return ret;
5340
5392
  };
5341
5393
 
5342
- const transformBind = (dir, _node, context) => {
5343
- const { modifiers, loc } = dir;
5344
- const arg = dir.arg;
5345
- let { exp } = dir;
5346
- if (exp && exp.type === 4 && !exp.content.trim()) {
5347
- {
5348
- exp = void 0;
5349
- }
5350
- }
5351
- if (!exp) {
5352
- if (arg.type !== 4 || !arg.isStatic) {
5353
- context.onError(
5354
- createCompilerError(
5355
- 52,
5356
- arg.loc
5357
- )
5358
- );
5359
- return {
5360
- props: [
5361
- createObjectProperty(arg, createSimpleExpression("", true, loc))
5362
- ]
5363
- };
5364
- }
5365
- const propName = camelize(arg.content);
5366
- exp = dir.exp = createSimpleExpression(propName, false, arg.loc);
5367
- }
5368
- if (arg.type !== 4) {
5369
- arg.children.unshift(`(`);
5370
- arg.children.push(`) || ""`);
5371
- } else if (!arg.isStatic) {
5372
- arg.content = `${arg.content} || ""`;
5373
- }
5374
- if (modifiers.includes("camel")) {
5375
- if (arg.type === 4) {
5376
- if (arg.isStatic) {
5377
- arg.content = camelize(arg.content);
5378
- } else {
5379
- arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
5380
- }
5381
- } else {
5382
- arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
5383
- arg.children.push(`)`);
5384
- }
5385
- }
5386
- if (!context.inSSR) {
5387
- if (modifiers.includes("prop")) {
5388
- injectPrefix(arg, ".");
5389
- }
5390
- if (modifiers.includes("attr")) {
5391
- injectPrefix(arg, "^");
5392
- }
5393
- }
5394
- return {
5395
- props: [createObjectProperty(arg, exp)]
5396
- };
5397
- };
5398
- const injectPrefix = (arg, prefix) => {
5399
- if (arg.type === 4) {
5400
- if (arg.isStatic) {
5401
- arg.content = prefix + arg.content;
5402
- } else {
5403
- arg.content = `\`${prefix}\${${arg.content}}\``;
5404
- }
5405
- } else {
5406
- arg.children.unshift(`'${prefix}' + (`);
5407
- arg.children.push(`)`);
5408
- }
5409
- };
5410
-
5411
5394
  const transformText = (node, context) => {
5412
5395
  if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
5413
5396
  return () => {
@@ -5586,8 +5569,7 @@ function rewriteFilter(node, context) {
5586
5569
  } else {
5587
5570
  for (let i = 0; i < node.children.length; i++) {
5588
5571
  const child = node.children[i];
5589
- if (typeof child !== "object")
5590
- continue;
5572
+ if (typeof child !== "object") continue;
5591
5573
  if (child.type === 4) {
5592
5574
  parseFilter(child, context);
5593
5575
  } else if (child.type === 8) {
@@ -5613,17 +5595,13 @@ function parseFilter(node, context) {
5613
5595
  prev = c;
5614
5596
  c = exp.charCodeAt(i);
5615
5597
  if (inSingle) {
5616
- if (c === 39 && prev !== 92)
5617
- inSingle = false;
5598
+ if (c === 39 && prev !== 92) inSingle = false;
5618
5599
  } else if (inDouble) {
5619
- if (c === 34 && prev !== 92)
5620
- inDouble = false;
5600
+ if (c === 34 && prev !== 92) inDouble = false;
5621
5601
  } else if (inTemplateString) {
5622
- if (c === 96 && prev !== 92)
5623
- inTemplateString = false;
5602
+ if (c === 96 && prev !== 92) inTemplateString = false;
5624
5603
  } else if (inRegex) {
5625
- if (c === 47 && prev !== 92)
5626
- inRegex = false;
5604
+ if (c === 47 && prev !== 92) inRegex = false;
5627
5605
  } else if (c === 124 && // pipe
5628
5606
  exp.charCodeAt(i + 1) !== 124 && exp.charCodeAt(i - 1) !== 124 && !curly && !square && !paren) {
5629
5607
  if (expression === void 0) {
@@ -5667,8 +5645,7 @@ function parseFilter(node, context) {
5667
5645
  let p;
5668
5646
  for (; j >= 0; j--) {
5669
5647
  p = exp.charAt(j);
5670
- if (p !== " ")
5671
- break;
5648
+ if (p !== " ") break;
5672
5649
  }
5673
5650
  if (!p || !validDivisionCharRE.test(p)) {
5674
5651
  inRegex = true;
@@ -5695,6 +5672,7 @@ function parseFilter(node, context) {
5695
5672
  expression = wrapFilter(expression, filters[i], context);
5696
5673
  }
5697
5674
  node.content = expression;
5675
+ node.ast = void 0;
5698
5676
  }
5699
5677
  }
5700
5678
  function wrapFilter(exp, filter, context) {
@@ -6166,8 +6144,7 @@ const transformClick = (key, event) => {
6166
6144
  const transformOn = (dir, node, context) => {
6167
6145
  return transformOn$1(dir, node, context, (baseResult) => {
6168
6146
  const { modifiers } = dir;
6169
- if (!modifiers.length)
6170
- return baseResult;
6147
+ if (!modifiers.length) return baseResult;
6171
6148
  let { key, value: handlerExp } = baseResult.props[0];
6172
6149
  const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc);
6173
6150
  if (nonKeyModifiers.includes("right")) {