@vue/compiler-core 3.5.0-alpha.1 → 3.5.0-alpha.3

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-core v3.5.0-alpha.1
2
+ * @vue/compiler-core v3.5.0-alpha.3
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -173,8 +173,8 @@ const ConstantTypes = {
173
173
  "0": "NOT_CONSTANT",
174
174
  "CAN_SKIP_PATCH": 1,
175
175
  "1": "CAN_SKIP_PATCH",
176
- "CAN_HOIST": 2,
177
- "2": "CAN_HOIST",
176
+ "CAN_CACHE": 2,
177
+ "2": "CAN_CACHE",
178
178
  "CAN_STRINGIFY": 3,
179
179
  "3": "CAN_STRINGIFY"
180
180
  };
@@ -193,7 +193,7 @@ function createRoot(children, source = "") {
193
193
  directives: [],
194
194
  hoists: [],
195
195
  imports: [],
196
- cached: 0,
196
+ cached: [],
197
197
  temps: 0,
198
198
  codegenNode: void 0,
199
199
  loc: locStub
@@ -298,12 +298,13 @@ function createConditionalExpression(test, consequent, alternate, newline = true
298
298
  loc: locStub
299
299
  };
300
300
  }
301
- function createCacheExpression(index, value, isVNode = false) {
301
+ function createCacheExpression(index, value, needPauseTracking = false) {
302
302
  return {
303
303
  type: 20,
304
304
  index,
305
305
  value,
306
- isVNode,
306
+ needPauseTracking,
307
+ needArraySpread: false,
307
308
  loc: locStub
308
309
  };
309
310
  }
@@ -1244,8 +1245,7 @@ function warnDeprecation(key, context, loc, ...args) {
1244
1245
  Details: ${link}` : ``}`;
1245
1246
  const err = new SyntaxError(msg);
1246
1247
  err.code = key;
1247
- if (loc)
1248
- err.loc = loc;
1248
+ if (loc) err.loc = loc;
1249
1249
  context.onWarn(err);
1250
1250
  }
1251
1251
 
@@ -1481,16 +1481,14 @@ function walkFunctionParams(node, onIdent) {
1481
1481
  function walkBlockDeclarations(block, onIdent) {
1482
1482
  for (const stmt of block.body) {
1483
1483
  if (stmt.type === "VariableDeclaration") {
1484
- if (stmt.declare)
1485
- continue;
1484
+ if (stmt.declare) continue;
1486
1485
  for (const decl of stmt.declarations) {
1487
1486
  for (const id of extractIdentifiers(decl.id)) {
1488
1487
  onIdent(id);
1489
1488
  }
1490
1489
  }
1491
1490
  } else if (stmt.type === "FunctionDeclaration" || stmt.type === "ClassDeclaration") {
1492
- if (stmt.declare || !stmt.id)
1493
- continue;
1491
+ if (stmt.declare || !stmt.id) continue;
1494
1492
  onIdent(stmt.id);
1495
1493
  } else if (stmt.type === "ForOfStatement" || stmt.type === "ForInStatement" || stmt.type === "ForStatement") {
1496
1494
  const variable = stmt.type === "ForStatement" ? stmt.init : stmt.left;
@@ -1527,8 +1525,7 @@ function extractIdentifiers(param, nodes = []) {
1527
1525
  break;
1528
1526
  case "ArrayPattern":
1529
1527
  param.elements.forEach((element) => {
1530
- if (element)
1531
- extractIdentifiers(element, nodes);
1528
+ if (element) extractIdentifiers(element, nodes);
1532
1529
  });
1533
1530
  break;
1534
1531
  case "RestElement":
@@ -1582,7 +1579,7 @@ function isCoreComponent(tag) {
1582
1579
  return BASE_TRANSITION;
1583
1580
  }
1584
1581
  }
1585
- const nonIdentifierRE = /^\d|[^\$\w]/;
1582
+ const nonIdentifierRE = /^\d|[^\$\w\xA0-\uFFFF]/;
1586
1583
  const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
1587
1584
  const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
1588
1585
  const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
@@ -1693,8 +1690,7 @@ function findProp(node, name, dynamicOnly = false, allowEmpty = false) {
1693
1690
  for (let i = 0; i < node.props.length; i++) {
1694
1691
  const p = node.props[i];
1695
1692
  if (p.type === 6) {
1696
- if (dynamicOnly)
1697
- continue;
1693
+ if (dynamicOnly) continue;
1698
1694
  if (p.name === name && (p.value || allowEmpty)) {
1699
1695
  return p;
1700
1696
  }
@@ -1846,6 +1842,7 @@ function hasScopeRef(node, ids) {
1846
1842
  return hasScopeRef(node.content, ids);
1847
1843
  case 2:
1848
1844
  case 3:
1845
+ case 20:
1849
1846
  return false;
1850
1847
  default:
1851
1848
  if (!!(process.env.NODE_ENV !== "production")) ;
@@ -1859,7 +1856,7 @@ function getMemoedVNodeCall(node) {
1859
1856
  return node;
1860
1857
  }
1861
1858
  }
1862
- const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
1859
+ const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+(\S[\s\S]*)/;
1863
1860
 
1864
1861
  const defaultParserOptions = {
1865
1862
  parseMode: "base",
@@ -1959,11 +1956,10 @@ const tokenizer = new Tokenizer(stack, {
1959
1956
  }
1960
1957
  },
1961
1958
  onselfclosingtag(end) {
1962
- var _a;
1963
1959
  const name = currentOpenTag.tag;
1964
1960
  currentOpenTag.isSelfClosing = true;
1965
1961
  endOpenTag(end);
1966
- if (((_a = stack[0]) == null ? void 0 : _a.tag) === name) {
1962
+ if (stack[0] && stack[0].tag === name) {
1967
1963
  onCloseTag(stack.shift(), end);
1968
1964
  }
1969
1965
  },
@@ -2013,8 +2009,7 @@ const tokenizer = new Tokenizer(stack, {
2013
2009
  }
2014
2010
  },
2015
2011
  ondirarg(start, end) {
2016
- if (start === end)
2017
- return;
2012
+ if (start === end) return;
2018
2013
  const arg = getSlice(start, end);
2019
2014
  if (inVPre) {
2020
2015
  currentProp.name += arg;
@@ -2046,14 +2041,12 @@ const tokenizer = new Tokenizer(stack, {
2046
2041
  },
2047
2042
  onattribdata(start, end) {
2048
2043
  currentAttrValue += getSlice(start, end);
2049
- if (currentAttrStartIndex < 0)
2050
- currentAttrStartIndex = start;
2044
+ if (currentAttrStartIndex < 0) currentAttrStartIndex = start;
2051
2045
  currentAttrEndIndex = end;
2052
2046
  },
2053
2047
  onattribentity(char, start, end) {
2054
2048
  currentAttrValue += char;
2055
- if (currentAttrStartIndex < 0)
2056
- currentAttrStartIndex = start;
2049
+ if (currentAttrStartIndex < 0) currentAttrStartIndex = start;
2057
2050
  currentAttrEndIndex = end;
2058
2051
  },
2059
2052
  onattribnameend(end) {
@@ -2200,8 +2193,7 @@ function parseForExpression(input) {
2200
2193
  const loc = input.loc;
2201
2194
  const exp = input.content;
2202
2195
  const inMatch = exp.match(forAliasRE);
2203
- if (!inMatch)
2204
- return;
2196
+ if (!inMatch) return;
2205
2197
  const [, LHS, RHS] = inMatch;
2206
2198
  const createAliasExpression = (content, offset, asParam = false) => {
2207
2199
  const start = loc.start.offset + offset;
@@ -2274,16 +2266,15 @@ function endOpenTag(end) {
2274
2266
  currentOpenTag = null;
2275
2267
  }
2276
2268
  function onText(content, start, end) {
2277
- var _a;
2278
2269
  {
2279
- const tag = (_a = stack[0]) == null ? void 0 : _a.tag;
2270
+ const tag = stack[0] && stack[0].tag;
2280
2271
  if (tag !== "script" && tag !== "style" && content.includes("&")) {
2281
2272
  content = currentOptions.decodeEntities(content, false);
2282
2273
  }
2283
2274
  }
2284
2275
  const parent = stack[0] || currentRoot;
2285
2276
  const lastNode = parent.children[parent.children.length - 1];
2286
- if ((lastNode == null ? void 0 : lastNode.type) === 2) {
2277
+ if (lastNode && lastNode.type === 2) {
2287
2278
  lastNode.content += content;
2288
2279
  setLocEnd(lastNode.loc, end);
2289
2280
  } else {
@@ -2395,14 +2386,12 @@ function onCloseTag(el, end, isImplied = false) {
2395
2386
  }
2396
2387
  function lookAhead(index, c) {
2397
2388
  let i = index;
2398
- while (currentInput.charCodeAt(i) !== c && i < currentInput.length - 1)
2399
- i++;
2389
+ while (currentInput.charCodeAt(i) !== c && i < currentInput.length - 1) i++;
2400
2390
  return i;
2401
2391
  }
2402
2392
  function backTrack(index, c) {
2403
2393
  let i = index;
2404
- while (currentInput.charCodeAt(i) !== c && i >= 0)
2405
- i--;
2394
+ while (currentInput.charCodeAt(i) !== c && i >= 0) i--;
2406
2395
  return i;
2407
2396
  }
2408
2397
  const specialTemplateDir = /* @__PURE__ */ new Set(["if", "else", "else-if", "for", "slot"]);
@@ -2417,11 +2406,10 @@ function isFragmentTemplate({ tag, props }) {
2417
2406
  return false;
2418
2407
  }
2419
2408
  function isComponent({ tag, props }) {
2420
- var _a;
2421
2409
  if (currentOptions.isCustomElement(tag)) {
2422
2410
  return false;
2423
2411
  }
2424
- if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || ((_a = currentOptions.isBuiltInComponent) == null ? void 0 : _a.call(currentOptions, tag)) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
2412
+ if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || currentOptions.isBuiltInComponent && currentOptions.isBuiltInComponent(tag) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
2425
2413
  return true;
2426
2414
  }
2427
2415
  for (let i = 0; i < props.length; i++) {
@@ -2454,7 +2442,6 @@ function isUpperCase(c) {
2454
2442
  }
2455
2443
  const windowsNewlineRE = /\r\n/g;
2456
2444
  function condenseWhitespace(nodes, tag) {
2457
- var _a, _b;
2458
2445
  const shouldCondense = currentOptions.whitespace !== "preserve";
2459
2446
  let removedWhitespace = false;
2460
2447
  for (let i = 0; i < nodes.length; i++) {
@@ -2462,8 +2449,8 @@ function condenseWhitespace(nodes, tag) {
2462
2449
  if (node.type === 2) {
2463
2450
  if (!inPre) {
2464
2451
  if (isAllWhitespace(node.content)) {
2465
- const prev = (_a = nodes[i - 1]) == null ? void 0 : _a.type;
2466
- const next = (_b = nodes[i + 1]) == null ? void 0 : _b.type;
2452
+ const prev = nodes[i - 1] && nodes[i - 1].type;
2453
+ const next = nodes[i + 1] && nodes[i + 1].type;
2467
2454
  if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) {
2468
2455
  removedWhitespace = true;
2469
2456
  nodes[i] = null;
@@ -2601,7 +2588,7 @@ function baseParse(input, options) {
2601
2588
  }
2602
2589
  tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
2603
2590
  tokenizer.inXML = currentOptions.ns === 1 || currentOptions.ns === 2;
2604
- const delimiters = options == null ? void 0 : options.delimiters;
2591
+ const delimiters = options && options.delimiters;
2605
2592
  if (delimiters) {
2606
2593
  tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
2607
2594
  tokenizer.delimiterClose = toCharCodes(delimiters[1]);
@@ -2614,9 +2601,10 @@ function baseParse(input, options) {
2614
2601
  return root;
2615
2602
  }
2616
2603
 
2617
- function hoistStatic(root, context) {
2604
+ function cacheStatic(root, context) {
2618
2605
  walk(
2619
2606
  root,
2607
+ void 0,
2620
2608
  context,
2621
2609
  // Root node is unfortunately non-hoistable due to potential parent
2622
2610
  // fallthrough attributes.
@@ -2627,26 +2615,24 @@ function isSingleElementRoot(root, child) {
2627
2615
  const { children } = root;
2628
2616
  return children.length === 1 && child.type === 1 && !isSlotOutlet(child);
2629
2617
  }
2630
- function walk(node, context, doNotHoistNode = false) {
2618
+ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
2631
2619
  const { children } = node;
2632
- const originalCount = children.length;
2633
- let hoistedCount = 0;
2620
+ const toCache = [];
2634
2621
  for (let i = 0; i < children.length; i++) {
2635
2622
  const child = children[i];
2636
2623
  if (child.type === 1 && child.tagType === 0) {
2637
2624
  const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
2638
2625
  if (constantType > 0) {
2639
2626
  if (constantType >= 2) {
2640
- child.codegenNode.patchFlag = -1 + (!!(process.env.NODE_ENV !== "production") ? ` /* HOISTED */` : ``);
2641
- child.codegenNode = context.hoist(child.codegenNode);
2642
- hoistedCount++;
2627
+ child.codegenNode.patchFlag = -1;
2628
+ toCache.push(child);
2643
2629
  continue;
2644
2630
  }
2645
2631
  } else {
2646
2632
  const codegenNode = child.codegenNode;
2647
2633
  if (codegenNode.type === 13) {
2648
- const flag = getPatchFlag(codegenNode);
2649
- if ((!flag || flag === 512 || flag === 1) && getGeneratedPropsConstantType(child, context) >= 2) {
2634
+ const flag = codegenNode.patchFlag;
2635
+ if ((flag === void 0 || flag === 512 || flag === 1) && getGeneratedPropsConstantType(child, context) >= 2) {
2650
2636
  const props = getNodeProps(child);
2651
2637
  if (props) {
2652
2638
  codegenNode.props = context.hoist(props);
@@ -2657,39 +2643,84 @@ function walk(node, context, doNotHoistNode = false) {
2657
2643
  }
2658
2644
  }
2659
2645
  }
2646
+ } else if (child.type === 12) {
2647
+ const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
2648
+ if (constantType >= 2) {
2649
+ toCache.push(child);
2650
+ continue;
2651
+ }
2660
2652
  }
2661
2653
  if (child.type === 1) {
2662
2654
  const isComponent = child.tagType === 1;
2663
2655
  if (isComponent) {
2664
2656
  context.scopes.vSlot++;
2665
2657
  }
2666
- walk(child, context);
2658
+ walk(child, node, context, false, inFor);
2667
2659
  if (isComponent) {
2668
2660
  context.scopes.vSlot--;
2669
2661
  }
2670
2662
  } else if (child.type === 11) {
2671
- walk(child, context, child.children.length === 1);
2663
+ walk(child, node, context, child.children.length === 1, true);
2672
2664
  } else if (child.type === 9) {
2673
2665
  for (let i2 = 0; i2 < child.branches.length; i2++) {
2674
2666
  walk(
2675
2667
  child.branches[i2],
2668
+ node,
2676
2669
  context,
2677
- child.branches[i2].children.length === 1
2670
+ child.branches[i2].children.length === 1,
2671
+ inFor
2678
2672
  );
2679
2673
  }
2680
2674
  }
2681
2675
  }
2682
- if (hoistedCount && context.transformHoist) {
2683
- context.transformHoist(children, context, node);
2676
+ let cachedAsArray = false;
2677
+ if (toCache.length === children.length && node.type === 1) {
2678
+ if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
2679
+ node.codegenNode.children = getCacheExpression(
2680
+ createArrayExpression(node.codegenNode.children)
2681
+ );
2682
+ cachedAsArray = true;
2683
+ } else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
2684
+ const slot = getSlotNode(node.codegenNode, "default");
2685
+ if (slot) {
2686
+ slot.returns = getCacheExpression(
2687
+ createArrayExpression(slot.returns)
2688
+ );
2689
+ cachedAsArray = true;
2690
+ }
2691
+ } else if (node.tagType === 3 && parent && parent.type === 1 && parent.tagType === 1 && parent.codegenNode && parent.codegenNode.type === 13 && parent.codegenNode.children && !isArray(parent.codegenNode.children) && parent.codegenNode.children.type === 15) {
2692
+ const slotName = findDir(node, "slot", true);
2693
+ const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg);
2694
+ if (slot) {
2695
+ slot.returns = getCacheExpression(
2696
+ createArrayExpression(slot.returns)
2697
+ );
2698
+ cachedAsArray = true;
2699
+ }
2700
+ }
2684
2701
  }
2685
- if (hoistedCount && hoistedCount === originalCount && node.type === 1 && node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
2686
- const hoisted = context.hoist(
2687
- createArrayExpression(node.codegenNode.children)
2688
- );
2689
- if (context.hmr) {
2690
- hoisted.content = `[...${hoisted.content}]`;
2702
+ if (!cachedAsArray) {
2703
+ for (const child of toCache) {
2704
+ child.codegenNode = context.cache(child.codegenNode);
2705
+ }
2706
+ }
2707
+ function getCacheExpression(value) {
2708
+ const exp = context.cache(value);
2709
+ if (inFor && context.hmr) {
2710
+ exp.needArraySpread = true;
2691
2711
  }
2692
- node.codegenNode.children = hoisted;
2712
+ return exp;
2713
+ }
2714
+ function getSlotNode(node2, name) {
2715
+ if (node2.children && !isArray(node2.children) && node2.children.type === 15) {
2716
+ const slot = node2.children.properties.find(
2717
+ (p) => p.key === name || p.key.content === name
2718
+ );
2719
+ return slot && slot.value;
2720
+ }
2721
+ }
2722
+ if (toCache.length && context.transformHoist) {
2723
+ context.transformHoist(children, context, node);
2693
2724
  }
2694
2725
  }
2695
2726
  function getConstantType(node, context) {
@@ -2707,11 +2738,10 @@ function getConstantType(node, context) {
2707
2738
  if (codegenNode.type !== 13) {
2708
2739
  return 0;
2709
2740
  }
2710
- if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject") {
2741
+ if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject" && node.tag !== "math") {
2711
2742
  return 0;
2712
2743
  }
2713
- const flag = getPatchFlag(codegenNode);
2714
- if (!flag) {
2744
+ if (codegenNode.patchFlag === void 0) {
2715
2745
  let returnType2 = 3;
2716
2746
  const generatedPropsType = getGeneratedPropsConstantType(node, context);
2717
2747
  if (generatedPropsType === 0) {
@@ -2794,6 +2824,8 @@ function getConstantType(node, context) {
2794
2824
  }
2795
2825
  }
2796
2826
  return returnType;
2827
+ case 20:
2828
+ return 2;
2797
2829
  default:
2798
2830
  if (!!(process.env.NODE_ENV !== "production")) ;
2799
2831
  return 0;
@@ -2854,15 +2886,11 @@ function getNodeProps(node) {
2854
2886
  return codegenNode.props;
2855
2887
  }
2856
2888
  }
2857
- function getPatchFlag(node) {
2858
- const flag = node.patchFlag;
2859
- return flag ? parseInt(flag, 10) : void 0;
2860
- }
2861
2889
 
2862
2890
  function createTransformContext(root, {
2863
2891
  filename = "",
2864
2892
  prefixIdentifiers = false,
2865
- hoistStatic: hoistStatic2 = false,
2893
+ hoistStatic = false,
2866
2894
  hmr = false,
2867
2895
  cacheHandlers = false,
2868
2896
  nodeTransforms = [],
@@ -2889,7 +2917,7 @@ function createTransformContext(root, {
2889
2917
  filename,
2890
2918
  selfName: nameMatch && capitalize(camelize(nameMatch[1])),
2891
2919
  prefixIdentifiers,
2892
- hoistStatic: hoistStatic2,
2920
+ hoistStatic,
2893
2921
  hmr,
2894
2922
  cacheHandlers,
2895
2923
  nodeTransforms,
@@ -2916,9 +2944,9 @@ function createTransformContext(root, {
2916
2944
  directives: /* @__PURE__ */ new Set(),
2917
2945
  hoists: [],
2918
2946
  imports: [],
2947
+ cached: [],
2919
2948
  constantCache: /* @__PURE__ */ new WeakMap(),
2920
2949
  temps: 0,
2921
- cached: 0,
2922
2950
  identifiers: /* @__PURE__ */ Object.create(null),
2923
2951
  scopes: {
2924
2952
  vFor: 0,
@@ -2988,8 +3016,7 @@ function createTransformContext(root, {
2988
3016
  removeIdentifiers(exp) {
2989
3017
  },
2990
3018
  hoist(exp) {
2991
- if (isString(exp))
2992
- exp = createSimpleExpression(exp);
3019
+ if (isString(exp)) exp = createSimpleExpression(exp);
2993
3020
  context.hoists.push(exp);
2994
3021
  const identifier = createSimpleExpression(
2995
3022
  `_hoisted_${context.hoists.length}`,
@@ -3001,7 +3028,13 @@ function createTransformContext(root, {
3001
3028
  return identifier;
3002
3029
  },
3003
3030
  cache(exp, isVNode = false) {
3004
- return createCacheExpression(context.cached++, exp, isVNode);
3031
+ const cacheExp = createCacheExpression(
3032
+ context.cached.length,
3033
+ exp,
3034
+ isVNode
3035
+ );
3036
+ context.cached.push(cacheExp);
3037
+ return cacheExp;
3005
3038
  }
3006
3039
  };
3007
3040
  {
@@ -3013,7 +3046,7 @@ function transform(root, options) {
3013
3046
  const context = createTransformContext(root, options);
3014
3047
  traverseNode(root, context);
3015
3048
  if (options.hoistStatic) {
3016
- hoistStatic(root, context);
3049
+ cacheStatic(root, context);
3017
3050
  }
3018
3051
  if (!options.ssr) {
3019
3052
  createRootCodegen(root, context);
@@ -3056,7 +3089,7 @@ function createRootCodegen(root, context) {
3056
3089
  helper(FRAGMENT),
3057
3090
  void 0,
3058
3091
  root.children,
3059
- patchFlag + (!!(process.env.NODE_ENV !== "production") ? ` /* ${patchFlagText} */` : ``),
3092
+ patchFlag,
3060
3093
  void 0,
3061
3094
  void 0,
3062
3095
  true,
@@ -3072,8 +3105,7 @@ function traverseChildren(parent, context) {
3072
3105
  };
3073
3106
  for (; i < parent.children.length; i++) {
3074
3107
  const child = parent.children[i];
3075
- if (isString(child))
3076
- continue;
3108
+ if (isString(child)) continue;
3077
3109
  context.grandParent = context.parent;
3078
3110
  context.parent = parent;
3079
3111
  context.childIndex = i;
@@ -3144,8 +3176,7 @@ function createStructuralDirectiveTransform(name, fn) {
3144
3176
  props.splice(i, 1);
3145
3177
  i--;
3146
3178
  const onExit = fn(node, prop, context);
3147
- if (onExit)
3148
- exitFns.push(onExit);
3179
+ if (onExit) exitFns.push(onExit);
3149
3180
  }
3150
3181
  }
3151
3182
  return exitFns;
@@ -3217,8 +3248,7 @@ function createCodegenContext(ast, {
3217
3248
  }
3218
3249
  function generate(ast, options = {}) {
3219
3250
  const context = createCodegenContext(ast, options);
3220
- if (options.onContextCreated)
3221
- options.onContextCreated(context);
3251
+ if (options.onContextCreated) options.onContextCreated(context);
3222
3252
  const {
3223
3253
  mode,
3224
3254
  push,
@@ -3360,14 +3390,12 @@ function genHoists(hoists, context) {
3360
3390
  return;
3361
3391
  }
3362
3392
  context.pure = true;
3363
- const { push, newline, helper, scopeId, mode } = context;
3393
+ const { push, newline } = context;
3364
3394
  newline();
3365
3395
  for (let i = 0; i < hoists.length; i++) {
3366
3396
  const exp = hoists[i];
3367
3397
  if (exp) {
3368
- push(
3369
- `const _hoisted_${i + 1} = ${``}`
3370
- );
3398
+ push(`const _hoisted_${i + 1} = `);
3371
3399
  genNode(exp, context);
3372
3400
  newline();
3373
3401
  }
@@ -3500,8 +3528,7 @@ function genExpression(node, context) {
3500
3528
  }
3501
3529
  function genInterpolation(node, context) {
3502
3530
  const { push, helper, pure } = context;
3503
- if (pure)
3504
- push(PURE_ANNOTATION);
3531
+ if (pure) push(PURE_ANNOTATION);
3505
3532
  push(`${helper(TO_DISPLAY_STRING)}(`);
3506
3533
  genNode(node.content, context);
3507
3534
  push(`)`);
@@ -3553,6 +3580,19 @@ function genVNodeCall(node, context) {
3553
3580
  disableTracking,
3554
3581
  isComponent
3555
3582
  } = node;
3583
+ let patchFlagString;
3584
+ if (patchFlag) {
3585
+ if (!!(process.env.NODE_ENV !== "production")) {
3586
+ if (patchFlag < 0) {
3587
+ patchFlagString = patchFlag + ` /* ${PatchFlagNames[patchFlag]} */`;
3588
+ } else {
3589
+ const flagNames = Object.keys(PatchFlagNames).map(Number).filter((n) => n > 0 && patchFlag & n).map((n) => PatchFlagNames[n]).join(`, `);
3590
+ patchFlagString = patchFlag + ` /* ${flagNames} */`;
3591
+ }
3592
+ } else {
3593
+ patchFlagString = String(patchFlag);
3594
+ }
3595
+ }
3556
3596
  if (directives) {
3557
3597
  push(helper(WITH_DIRECTIVES) + `(`);
3558
3598
  }
@@ -3565,7 +3605,7 @@ function genVNodeCall(node, context) {
3565
3605
  const callHelper = isBlock ? getVNodeBlockHelper(context.inSSR, isComponent) : getVNodeHelper(context.inSSR, isComponent);
3566
3606
  push(helper(callHelper) + `(`, -2 /* None */, node);
3567
3607
  genNodeList(
3568
- genNullableArgs([tag, props, children, patchFlag, dynamicProps]),
3608
+ genNullableArgs([tag, props, children, patchFlagString, dynamicProps]),
3569
3609
  context
3570
3610
  );
3571
3611
  push(`)`);
@@ -3581,8 +3621,7 @@ function genVNodeCall(node, context) {
3581
3621
  function genNullableArgs(args) {
3582
3622
  let i = args.length;
3583
3623
  while (i--) {
3584
- if (args[i] != null)
3585
- break;
3624
+ if (args[i] != null) break;
3586
3625
  }
3587
3626
  return args.slice(0, i + 1).map((arg) => arg || `null`);
3588
3627
  }
@@ -3699,16 +3738,21 @@ function genConditionalExpression(node, context) {
3699
3738
  }
3700
3739
  function genCacheExpression(node, context) {
3701
3740
  const { push, helper, indent, deindent, newline } = context;
3741
+ const { needPauseTracking, needArraySpread } = node;
3742
+ if (needArraySpread) {
3743
+ push(`[...(`);
3744
+ }
3702
3745
  push(`_cache[${node.index}] || (`);
3703
- if (node.isVNode) {
3746
+ if (needPauseTracking) {
3704
3747
  indent();
3705
3748
  push(`${helper(SET_BLOCK_TRACKING)}(-1),`);
3706
3749
  newline();
3750
+ push(`(`);
3707
3751
  }
3708
3752
  push(`_cache[${node.index}] = `);
3709
3753
  genNode(node.value, context);
3710
- if (node.isVNode) {
3711
- push(`,`);
3754
+ if (needPauseTracking) {
3755
+ push(`).cacheIndex = ${node.index},`);
3712
3756
  newline();
3713
3757
  push(`${helper(SET_BLOCK_TRACKING)}(1),`);
3714
3758
  newline();
@@ -3716,6 +3760,9 @@ function genCacheExpression(node, context) {
3716
3760
  deindent();
3717
3761
  }
3718
3762
  push(`)`);
3763
+ if (needArraySpread) {
3764
+ push(`)]`);
3765
+ }
3719
3766
  }
3720
3767
 
3721
3768
  const prohibitedKeywordRE = new RegExp(
@@ -3892,8 +3939,7 @@ function processIf(node, dir, context, processCodegen) {
3892
3939
  sibling.branches.push(branch);
3893
3940
  const onExit = processCodegen && processCodegen(sibling, branch, false);
3894
3941
  traverseNode(branch, context);
3895
- if (onExit)
3896
- onExit();
3942
+ if (onExit) onExit();
3897
3943
  context.currentNode = null;
3898
3944
  } else {
3899
3945
  context.onError(
@@ -3962,7 +4008,7 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
3962
4008
  helper(FRAGMENT),
3963
4009
  createObjectExpression([keyProperty]),
3964
4010
  children,
3965
- patchFlag + (!!(process.env.NODE_ENV !== "production") ? ` /* ${patchFlagText} */` : ``),
4011
+ patchFlag,
3966
4012
  void 0,
3967
4013
  void 0,
3968
4014
  true,
@@ -4015,6 +4061,80 @@ function getParentCondition(node) {
4015
4061
  }
4016
4062
  }
4017
4063
 
4064
+ const transformBind = (dir, _node, context) => {
4065
+ const { modifiers, loc } = dir;
4066
+ const arg = dir.arg;
4067
+ let { exp } = dir;
4068
+ if (exp && exp.type === 4 && !exp.content.trim()) {
4069
+ {
4070
+ exp = void 0;
4071
+ }
4072
+ }
4073
+ if (!exp) {
4074
+ if (arg.type !== 4 || !arg.isStatic) {
4075
+ context.onError(
4076
+ createCompilerError(
4077
+ 52,
4078
+ arg.loc
4079
+ )
4080
+ );
4081
+ return {
4082
+ props: [
4083
+ createObjectProperty(arg, createSimpleExpression("", true, loc))
4084
+ ]
4085
+ };
4086
+ }
4087
+ transformBindShorthand(dir);
4088
+ exp = dir.exp;
4089
+ }
4090
+ if (arg.type !== 4) {
4091
+ arg.children.unshift(`(`);
4092
+ arg.children.push(`) || ""`);
4093
+ } else if (!arg.isStatic) {
4094
+ arg.content = `${arg.content} || ""`;
4095
+ }
4096
+ if (modifiers.includes("camel")) {
4097
+ if (arg.type === 4) {
4098
+ if (arg.isStatic) {
4099
+ arg.content = camelize(arg.content);
4100
+ } else {
4101
+ arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
4102
+ }
4103
+ } else {
4104
+ arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
4105
+ arg.children.push(`)`);
4106
+ }
4107
+ }
4108
+ if (!context.inSSR) {
4109
+ if (modifiers.includes("prop")) {
4110
+ injectPrefix(arg, ".");
4111
+ }
4112
+ if (modifiers.includes("attr")) {
4113
+ injectPrefix(arg, "^");
4114
+ }
4115
+ }
4116
+ return {
4117
+ props: [createObjectProperty(arg, exp)]
4118
+ };
4119
+ };
4120
+ const transformBindShorthand = (dir, context) => {
4121
+ const arg = dir.arg;
4122
+ const propName = camelize(arg.content);
4123
+ dir.exp = createSimpleExpression(propName, false, arg.loc);
4124
+ };
4125
+ const injectPrefix = (arg, prefix) => {
4126
+ if (arg.type === 4) {
4127
+ if (arg.isStatic) {
4128
+ arg.content = prefix + arg.content;
4129
+ } else {
4130
+ arg.content = `\`${prefix}\${${arg.content}}\``;
4131
+ }
4132
+ } else {
4133
+ arg.children.unshift(`'${prefix}' + (`);
4134
+ arg.children.push(`)`);
4135
+ }
4136
+ };
4137
+
4018
4138
  const transformFor = createStructuralDirectiveTransform(
4019
4139
  "for",
4020
4140
  (node, dir, context) => {
@@ -4025,9 +4145,12 @@ const transformFor = createStructuralDirectiveTransform(
4025
4145
  ]);
4026
4146
  const isTemplate = isTemplateNode(node);
4027
4147
  const memo = findDir(node, "memo");
4028
- const keyProp = findProp(node, `key`);
4029
- const keyExp = keyProp && (keyProp.type === 6 ? createSimpleExpression(keyProp.value.content, true) : keyProp.exp);
4030
- const keyProperty = keyProp ? createObjectProperty(`key`, keyExp) : null;
4148
+ const keyProp = findProp(node, `key`, false, true);
4149
+ if (keyProp && keyProp.type === 7 && !keyProp.exp) {
4150
+ transformBindShorthand(keyProp);
4151
+ }
4152
+ const keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
4153
+ const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
4031
4154
  const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
4032
4155
  const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
4033
4156
  forNode.codegenNode = createVNodeCall(
@@ -4035,7 +4158,7 @@ const transformFor = createStructuralDirectiveTransform(
4035
4158
  helper(FRAGMENT),
4036
4159
  void 0,
4037
4160
  renderExp,
4038
- fragmentFlag + (!!(process.env.NODE_ENV !== "production") ? ` /* ${PatchFlagNames[fragmentFlag]} */` : ``),
4161
+ fragmentFlag,
4039
4162
  void 0,
4040
4163
  void 0,
4041
4164
  true,
@@ -4075,7 +4198,7 @@ const transformFor = createStructuralDirectiveTransform(
4075
4198
  helper(FRAGMENT),
4076
4199
  keyProperty ? createObjectExpression([keyProperty]) : void 0,
4077
4200
  node.children,
4078
- 64 + (!!(process.env.NODE_ENV !== "production") ? ` /* ${PatchFlagNames[64]} */` : ``),
4201
+ 64,
4079
4202
  void 0,
4080
4203
  void 0,
4081
4204
  true,
@@ -4129,8 +4252,9 @@ const transformFor = createStructuralDirectiveTransform(
4129
4252
  renderExp.arguments.push(
4130
4253
  loop,
4131
4254
  createSimpleExpression(`_cache`),
4132
- createSimpleExpression(String(context.cached++))
4255
+ createSimpleExpression(String(context.cached.length))
4133
4256
  );
4257
+ context.cached.push(null);
4134
4258
  } else {
4135
4259
  renderExp.arguments.push(
4136
4260
  createFunctionExpression(
@@ -4176,13 +4300,11 @@ function processFor(node, dir, context, processCodegen) {
4176
4300
  const onExit = processCodegen && processCodegen(forNode);
4177
4301
  return () => {
4178
4302
  scopes.vFor--;
4179
- if (onExit)
4180
- onExit();
4303
+ if (onExit) onExit();
4181
4304
  };
4182
4305
  }
4183
4306
  function finalizeForParseResult(result, context) {
4184
- if (result.finalized)
4185
- return;
4307
+ if (result.finalized) return;
4186
4308
  if (!!(process.env.NODE_ENV !== "production") && true) {
4187
4309
  validateBrowserExpression(result.source, context);
4188
4310
  if (result.key) {
@@ -4215,8 +4337,7 @@ function createForLoopParams({ value, key, index }, memoArgs = []) {
4215
4337
  function createParamsList(args) {
4216
4338
  let i = args.length;
4217
4339
  while (i--) {
4218
- if (args[i])
4219
- break;
4340
+ if (args[i]) break;
4220
4341
  }
4221
4342
  return args.slice(0, i + 1).map((arg, i2) => arg || createSimpleExpression(`_`.repeat(i2 + 1), false));
4222
4343
  }
@@ -4339,9 +4460,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
4339
4460
  break;
4340
4461
  }
4341
4462
  }
4342
- if (prev && isTemplateNode(prev) && findDir(prev, "if")) {
4343
- children.splice(i, 1);
4344
- i--;
4463
+ if (prev && isTemplateNode(prev) && findDir(prev, /^(else-)?if$/)) {
4345
4464
  let conditional = dynamicSlots[dynamicSlots.length - 1];
4346
4465
  while (conditional.alternate.type === 19) {
4347
4466
  conditional = conditional.alternate;
@@ -4478,13 +4597,11 @@ function hasForwardedSlots(children) {
4478
4597
  }
4479
4598
  break;
4480
4599
  case 9:
4481
- if (hasForwardedSlots(child.branches))
4482
- return true;
4600
+ if (hasForwardedSlots(child.branches)) return true;
4483
4601
  break;
4484
4602
  case 10:
4485
4603
  case 11:
4486
- if (hasForwardedSlots(child.children))
4487
- return true;
4604
+ if (hasForwardedSlots(child.children)) return true;
4488
4605
  break;
4489
4606
  }
4490
4607
  }
@@ -4509,7 +4626,6 @@ const transformElement = (node, context) => {
4509
4626
  const isDynamicComponent = isObject(vnodeTag) && vnodeTag.callee === RESOLVE_DYNAMIC_COMPONENT;
4510
4627
  let vnodeProps;
4511
4628
  let vnodeChildren;
4512
- let vnodePatchFlag;
4513
4629
  let patchFlag = 0;
4514
4630
  let vnodeDynamicProps;
4515
4631
  let dynamicPropNames;
@@ -4520,7 +4636,7 @@ const transformElement = (node, context) => {
4520
4636
  // updates inside get proper isSVG flag at runtime. (#639, #643)
4521
4637
  // This is technically web-specific, but splitting the logic out of core
4522
4638
  // leads to too much unnecessary complexity.
4523
- (tag === "svg" || tag === "foreignObject")
4639
+ (tag === "svg" || tag === "foreignObject" || tag === "math")
4524
4640
  );
4525
4641
  if (props.length > 0) {
4526
4642
  const propsBuildResult = buildProps(
@@ -4580,27 +4696,15 @@ const transformElement = (node, context) => {
4580
4696
  vnodeChildren = node.children;
4581
4697
  }
4582
4698
  }
4583
- if (patchFlag !== 0) {
4584
- if (!!(process.env.NODE_ENV !== "production")) {
4585
- if (patchFlag < 0) {
4586
- vnodePatchFlag = patchFlag + ` /* ${PatchFlagNames[patchFlag]} */`;
4587
- } else {
4588
- const flagNames = Object.keys(PatchFlagNames).map(Number).filter((n) => n > 0 && patchFlag & n).map((n) => PatchFlagNames[n]).join(`, `);
4589
- vnodePatchFlag = patchFlag + ` /* ${flagNames} */`;
4590
- }
4591
- } else {
4592
- vnodePatchFlag = String(patchFlag);
4593
- }
4594
- if (dynamicPropNames && dynamicPropNames.length) {
4595
- vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
4596
- }
4699
+ if (dynamicPropNames && dynamicPropNames.length) {
4700
+ vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
4597
4701
  }
4598
4702
  node.codegenNode = createVNodeCall(
4599
4703
  context,
4600
4704
  vnodeTag,
4601
4705
  vnodeProps,
4602
4706
  vnodeChildren,
4603
- vnodePatchFlag,
4707
+ patchFlag === 0 ? void 0 : patchFlag,
4604
4708
  vnodeDynamicProps,
4605
4709
  vnodeDirectives,
4606
4710
  !!shouldUseBlock,
@@ -4645,8 +4749,7 @@ function resolveComponentType(node, context, ssr = false) {
4645
4749
  }
4646
4750
  const builtIn = isCoreComponent(tag) || context.isBuiltInComponent(tag);
4647
4751
  if (builtIn) {
4648
- if (!ssr)
4649
- context.helper(builtIn);
4752
+ if (!ssr) context.helper(builtIn);
4650
4753
  return builtIn;
4651
4754
  }
4652
4755
  context.helper(RESOLVE_COMPONENT);
@@ -4675,8 +4778,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
4675
4778
  );
4676
4779
  properties = [];
4677
4780
  }
4678
- if (arg)
4679
- mergeArgs.push(arg);
4781
+ if (arg) mergeArgs.push(arg);
4680
4782
  };
4681
4783
  const pushRefVForMarker = () => {
4682
4784
  if (context.scopes.vFor > 0) {
@@ -5013,8 +5115,7 @@ function buildDirectiveArgs(dir, context) {
5013
5115
  }
5014
5116
  }
5015
5117
  const { loc } = dir;
5016
- if (dir.exp)
5017
- dirArgs.push(dir.exp);
5118
+ if (dir.exp) dirArgs.push(dir.exp);
5018
5119
  if (dir.arg) {
5019
5120
  if (!dir.exp) {
5020
5121
  dirArgs.push(`void 0`);
@@ -5044,8 +5145,7 @@ function stringifyDynamicPropNames(props) {
5044
5145
  let propsNamesString = `[`;
5045
5146
  for (let i = 0, l = props.length; i < l; i++) {
5046
5147
  propsNamesString += JSON.stringify(props[i]);
5047
- if (i < l - 1)
5048
- propsNamesString += ", ";
5148
+ if (i < l - 1) propsNamesString += ", ";
5049
5149
  }
5050
5150
  return propsNamesString + `]`;
5051
5151
  }
@@ -5139,7 +5239,7 @@ function processSlotOutlet(node, context) {
5139
5239
  };
5140
5240
  }
5141
5241
 
5142
- const fnExpRE = /^\s*([\w$_]+|(async\s*)?\([^)]*?\))\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
5242
+ const fnExpRE = /^\s*(async\s*)?(\([^)]*?\)|[\w$_]+)\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
5143
5243
  const transformOn = (dir, node, context, augmentor) => {
5144
5244
  const { loc, modifiers, arg } = dir;
5145
5245
  if (!dir.exp && !modifiers.length) {
@@ -5220,75 +5320,6 @@ const transformOn = (dir, node, context, augmentor) => {
5220
5320
  return ret;
5221
5321
  };
5222
5322
 
5223
- const transformBind = (dir, _node, context) => {
5224
- const { modifiers, loc } = dir;
5225
- const arg = dir.arg;
5226
- let { exp } = dir;
5227
- if (exp && exp.type === 4 && !exp.content.trim()) {
5228
- {
5229
- exp = void 0;
5230
- }
5231
- }
5232
- if (!exp) {
5233
- if (arg.type !== 4 || !arg.isStatic) {
5234
- context.onError(
5235
- createCompilerError(
5236
- 52,
5237
- arg.loc
5238
- )
5239
- );
5240
- return {
5241
- props: [
5242
- createObjectProperty(arg, createSimpleExpression("", true, loc))
5243
- ]
5244
- };
5245
- }
5246
- const propName = camelize(arg.content);
5247
- exp = dir.exp = createSimpleExpression(propName, false, arg.loc);
5248
- }
5249
- if (arg.type !== 4) {
5250
- arg.children.unshift(`(`);
5251
- arg.children.push(`) || ""`);
5252
- } else if (!arg.isStatic) {
5253
- arg.content = `${arg.content} || ""`;
5254
- }
5255
- if (modifiers.includes("camel")) {
5256
- if (arg.type === 4) {
5257
- if (arg.isStatic) {
5258
- arg.content = camelize(arg.content);
5259
- } else {
5260
- arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
5261
- }
5262
- } else {
5263
- arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
5264
- arg.children.push(`)`);
5265
- }
5266
- }
5267
- if (!context.inSSR) {
5268
- if (modifiers.includes("prop")) {
5269
- injectPrefix(arg, ".");
5270
- }
5271
- if (modifiers.includes("attr")) {
5272
- injectPrefix(arg, "^");
5273
- }
5274
- }
5275
- return {
5276
- props: [createObjectProperty(arg, exp)]
5277
- };
5278
- };
5279
- const injectPrefix = (arg, prefix) => {
5280
- if (arg.type === 4) {
5281
- if (arg.isStatic) {
5282
- arg.content = prefix + arg.content;
5283
- } else {
5284
- arg.content = `\`${prefix}\${${arg.content}}\``;
5285
- }
5286
- } else {
5287
- arg.children.unshift(`'${prefix}' + (`);
5288
- arg.children.push(`)`);
5289
- }
5290
- };
5291
-
5292
5323
  const transformText = (node, context) => {
5293
5324
  if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
5294
5325
  return () => {
@@ -5452,8 +5483,7 @@ const transformFilter = (node, context) => {
5452
5483
  }
5453
5484
  if (node.type === 5) {
5454
5485
  rewriteFilter(node.content, context);
5455
- }
5456
- if (node.type === 1) {
5486
+ } else if (node.type === 1) {
5457
5487
  node.props.forEach((prop) => {
5458
5488
  if (prop.type === 7 && prop.name !== "for" && prop.exp) {
5459
5489
  rewriteFilter(prop.exp, context);
@@ -5467,8 +5497,7 @@ function rewriteFilter(node, context) {
5467
5497
  } else {
5468
5498
  for (let i = 0; i < node.children.length; i++) {
5469
5499
  const child = node.children[i];
5470
- if (typeof child !== "object")
5471
- continue;
5500
+ if (typeof child !== "object") continue;
5472
5501
  if (child.type === 4) {
5473
5502
  parseFilter(child, context);
5474
5503
  } else if (child.type === 8) {
@@ -5494,17 +5523,13 @@ function parseFilter(node, context) {
5494
5523
  prev = c;
5495
5524
  c = exp.charCodeAt(i);
5496
5525
  if (inSingle) {
5497
- if (c === 39 && prev !== 92)
5498
- inSingle = false;
5526
+ if (c === 39 && prev !== 92) inSingle = false;
5499
5527
  } else if (inDouble) {
5500
- if (c === 34 && prev !== 92)
5501
- inDouble = false;
5528
+ if (c === 34 && prev !== 92) inDouble = false;
5502
5529
  } else if (inTemplateString) {
5503
- if (c === 96 && prev !== 92)
5504
- inTemplateString = false;
5530
+ if (c === 96 && prev !== 92) inTemplateString = false;
5505
5531
  } else if (inRegex) {
5506
- if (c === 47 && prev !== 92)
5507
- inRegex = false;
5532
+ if (c === 47 && prev !== 92) inRegex = false;
5508
5533
  } else if (c === 124 && // pipe
5509
5534
  exp.charCodeAt(i + 1) !== 124 && exp.charCodeAt(i - 1) !== 124 && !curly && !square && !paren) {
5510
5535
  if (expression === void 0) {
@@ -5548,8 +5573,7 @@ function parseFilter(node, context) {
5548
5573
  let p;
5549
5574
  for (; j >= 0; j--) {
5550
5575
  p = exp.charAt(j);
5551
- if (p !== " ")
5552
- break;
5576
+ if (p !== " ") break;
5553
5577
  }
5554
5578
  if (!p || !validDivisionCharRE.test(p)) {
5555
5579
  inRegex = true;
@@ -5576,6 +5600,7 @@ function parseFilter(node, context) {
5576
5600
  expression = wrapFilter(expression, filters[i], context);
5577
5601
  }
5578
5602
  node.content = expression;
5603
+ node.ast = void 0;
5579
5604
  }
5580
5605
  }
5581
5606
  function wrapFilter(exp, filter, context) {
@@ -5610,8 +5635,9 @@ const transformMemo = (node, context) => {
5610
5635
  dir.exp,
5611
5636
  createFunctionExpression(void 0, codegenNode),
5612
5637
  `_cache`,
5613
- String(context.cached++)
5638
+ String(context.cached.length)
5614
5639
  ]);
5640
+ context.cached.push(null);
5615
5641
  }
5616
5642
  };
5617
5643
  }