@vue/compiler-core 3.3.0-alpha.1 → 3.3.0-alpha.11

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.
@@ -336,6 +336,20 @@ function createReturnStatement(returns) {
336
336
  loc: locStub
337
337
  };
338
338
  }
339
+ function getVNodeHelper(ssr, isComponent) {
340
+ return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE;
341
+ }
342
+ function getVNodeBlockHelper(ssr, isComponent) {
343
+ return ssr || isComponent ? CREATE_BLOCK : CREATE_ELEMENT_BLOCK;
344
+ }
345
+ function convertToBlock(node, { helper, removeHelper, inSSR }) {
346
+ if (!node.isBlock) {
347
+ node.isBlock = true;
348
+ removeHelper(getVNodeHelper(inSSR, node.isComponent));
349
+ helper(OPEN_BLOCK);
350
+ helper(getVNodeBlockHelper(inSSR, node.isComponent));
351
+ }
352
+ }
339
353
 
340
354
  const isStaticExp = (p) => p.type === 4 && p.isStatic;
341
355
  const isBuiltInType = (tag, expected) => tag === expected || tag === hyphenate(expected);
@@ -495,22 +509,16 @@ function hasDynamicKeyVBind(node) {
495
509
  );
496
510
  }
497
511
  function isText$1(node) {
498
- return node.type === 5 || node.type === "text";
512
+ return node.type === 5 || node.type === 2;
499
513
  }
500
514
  function isVSlot(p) {
501
515
  return p.type === 7 && p.name === "slot";
502
516
  }
503
517
  function isTemplateNode(node) {
504
- return node.type === "element" && node.tagType === 3;
518
+ return node.type === 1 && node.tagType === 3;
505
519
  }
506
520
  function isSlotOutlet(node) {
507
- return node.type === "element" && node.tagType === 2;
508
- }
509
- function getVNodeHelper(ssr, isComponent) {
510
- return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE;
511
- }
512
- function getVNodeBlockHelper(ssr, isComponent) {
513
- return ssr || isComponent ? CREATE_BLOCK : CREATE_ELEMENT_BLOCK;
521
+ return node.type === 1 && node.tagType === 2;
514
522
  }
515
523
  const propsHelperSet = /* @__PURE__ */ new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROPS]);
516
524
  function getUnnormalizedProps(props, callPath = []) {
@@ -603,7 +611,7 @@ function hasScopeRef(node, ids) {
603
611
  return false;
604
612
  }
605
613
  switch (node.type) {
606
- case "element":
614
+ case 1:
607
615
  for (let i = 0; i < node.props.length; i++) {
608
616
  const p = node.props[i];
609
617
  if (p.type === 7 && (hasScopeRef(p.arg, ids) || hasScopeRef(p.exp, ids))) {
@@ -630,8 +638,8 @@ function hasScopeRef(node, ids) {
630
638
  case 5:
631
639
  case 12:
632
640
  return hasScopeRef(node.content, ids);
633
- case "text":
634
- case "comment":
641
+ case 2:
642
+ case 3:
635
643
  return false;
636
644
  default:
637
645
  if (process.env.NODE_ENV !== "production") ;
@@ -645,14 +653,6 @@ function getMemoedVNodeCall(node) {
645
653
  return node;
646
654
  }
647
655
  }
648
- function makeBlock(node, { helper, removeHelper, inSSR }) {
649
- if (!node.isBlock) {
650
- node.isBlock = true;
651
- removeHelper(getVNodeHelper(inSSR, node.isComponent));
652
- helper(OPEN_BLOCK);
653
- helper(getVNodeBlockHelper(inSSR, node.isComponent));
654
- }
655
- }
656
656
 
657
657
  const deprecationData = {
658
658
  ["COMPILER_IS_ON_ELEMENT"]: {
@@ -863,12 +863,12 @@ function parseChildren(context, mode, ancestors) {
863
863
  const shouldCondense = context.options.whitespace !== "preserve";
864
864
  for (let i = 0; i < nodes.length; i++) {
865
865
  const node = nodes[i];
866
- if (node.type === "text") {
866
+ if (node.type === 2) {
867
867
  if (!context.inPre) {
868
868
  if (!/[^\t\r\n\f ]/.test(node.content)) {
869
869
  const prev = nodes[i - 1];
870
870
  const next = nodes[i + 1];
871
- if (!prev || !next || shouldCondense && (prev.type === "comment" && next.type === "comment" || prev.type === "comment" && next.type === "element" || prev.type === "element" && next.type === "comment" || prev.type === "element" && next.type === "element" && /[\r\n]/.test(node.content))) {
871
+ if (!prev || !next || shouldCondense && (prev.type === 3 && next.type === 3 || prev.type === 3 && next.type === 1 || prev.type === 1 && next.type === 3 || prev.type === 1 && next.type === 1 && /[\r\n]/.test(node.content))) {
872
872
  removedWhitespace = true;
873
873
  nodes[i] = null;
874
874
  } else {
@@ -880,14 +880,14 @@ function parseChildren(context, mode, ancestors) {
880
880
  } else {
881
881
  node.content = node.content.replace(/\r\n/g, "\n");
882
882
  }
883
- } else if (node.type === "comment" && !context.options.comments) {
883
+ } else if (node.type === 3 && !context.options.comments) {
884
884
  removedWhitespace = true;
885
885
  nodes[i] = null;
886
886
  }
887
887
  }
888
888
  if (context.inPre && parent && context.options.isPreTag(parent.tag)) {
889
889
  const first = nodes[0];
890
- if (first && first.type === "text") {
890
+ if (first && first.type === 2) {
891
891
  first.content = first.content.replace(/^\r?\n/, "");
892
892
  }
893
893
  }
@@ -895,9 +895,9 @@ function parseChildren(context, mode, ancestors) {
895
895
  return removedWhitespace ? nodes.filter(Boolean) : nodes;
896
896
  }
897
897
  function pushNode(nodes, node) {
898
- if (node.type === "text") {
898
+ if (node.type === 2) {
899
899
  const prev = last(nodes);
900
- if (prev && prev.type === "text" && prev.loc.end.offset === node.loc.start.offset) {
900
+ if (prev && prev.type === 2 && prev.loc.end.offset === node.loc.start.offset) {
901
901
  prev.content += node.content;
902
902
  prev.loc.end = node.loc.end;
903
903
  prev.loc.source += node.loc.source;
@@ -944,7 +944,7 @@ function parseComment(context) {
944
944
  advanceBy(context, match.index + match[0].length - prevIndex + 1);
945
945
  }
946
946
  return {
947
- type: "comment",
947
+ type: 3,
948
948
  content,
949
949
  loc: getSelection(context, start)
950
950
  };
@@ -962,7 +962,7 @@ function parseBogusComment(context) {
962
962
  advanceBy(context, closeIndex + 1);
963
963
  }
964
964
  return {
965
- type: "comment",
965
+ type: 3,
966
966
  content,
967
967
  loc: getSelection(context, start)
968
968
  };
@@ -998,7 +998,7 @@ function parseElement(context, ancestors) {
998
998
  )) {
999
999
  const loc = getSelection(context, element.loc.end);
1000
1000
  inlineTemplateProp.value = {
1001
- type: "text",
1001
+ type: 2,
1002
1002
  content: loc.source,
1003
1003
  loc
1004
1004
  };
@@ -1105,7 +1105,7 @@ function parseTag(context, type, parent) {
1105
1105
  }
1106
1106
  }
1107
1107
  return {
1108
- type: "element",
1108
+ type: 1,
1109
1109
  ns,
1110
1110
  tag,
1111
1111
  tagType,
@@ -1311,7 +1311,7 @@ function parseAttribute(context, nameSet) {
1311
1311
  type: 6,
1312
1312
  name,
1313
1313
  value: value && {
1314
- type: "text",
1314
+ type: 2,
1315
1315
  content: value.content,
1316
1316
  loc: value.loc
1317
1317
  },
@@ -1401,7 +1401,7 @@ function parseText(context, mode) {
1401
1401
  const start = getCursor(context);
1402
1402
  const content = parseTextData(context, endIndex, mode);
1403
1403
  return {
1404
- type: "text",
1404
+ type: 2,
1405
1405
  content,
1406
1406
  loc: getSelection(context, start)
1407
1407
  };
@@ -1510,7 +1510,7 @@ function hoistStatic(root, context) {
1510
1510
  }
1511
1511
  function isSingleElementRoot(root, child) {
1512
1512
  const { children } = root;
1513
- return children.length === 1 && child.type === "element" && !isSlotOutlet(child);
1513
+ return children.length === 1 && child.type === 1 && !isSlotOutlet(child);
1514
1514
  }
1515
1515
  function walk(node, context, doNotHoistNode = false) {
1516
1516
  const { children } = node;
@@ -1518,7 +1518,7 @@ function walk(node, context, doNotHoistNode = false) {
1518
1518
  let hoistedCount = 0;
1519
1519
  for (let i = 0; i < children.length; i++) {
1520
1520
  const child = children[i];
1521
- if (child.type === "element" && child.tagType === 0) {
1521
+ if (child.type === 1 && child.tagType === 0) {
1522
1522
  const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
1523
1523
  if (constantType > 0) {
1524
1524
  if (constantType >= 2) {
@@ -1543,7 +1543,7 @@ function walk(node, context, doNotHoistNode = false) {
1543
1543
  }
1544
1544
  }
1545
1545
  }
1546
- if (child.type === "element") {
1546
+ if (child.type === 1) {
1547
1547
  const isComponent = child.tagType === 1;
1548
1548
  if (isComponent) {
1549
1549
  context.scopes.vSlot++;
@@ -1567,7 +1567,7 @@ function walk(node, context, doNotHoistNode = false) {
1567
1567
  if (hoistedCount && context.transformHoist) {
1568
1568
  context.transformHoist(children, context, node);
1569
1569
  }
1570
- if (hoistedCount && hoistedCount === originalCount && node.type === "element" && node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
1570
+ if (hoistedCount && hoistedCount === originalCount && node.type === 1 && node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
1571
1571
  node.codegenNode.children = context.hoist(
1572
1572
  createArrayExpression(node.codegenNode.children)
1573
1573
  );
@@ -1576,7 +1576,7 @@ function walk(node, context, doNotHoistNode = false) {
1576
1576
  function getConstantType(node, context) {
1577
1577
  const { constantCache } = context;
1578
1578
  switch (node.type) {
1579
- case "element":
1579
+ case 1:
1580
1580
  if (node.tagType !== 0) {
1581
1581
  return 0;
1582
1582
  }
@@ -1648,8 +1648,8 @@ function getConstantType(node, context) {
1648
1648
  constantCache.set(node, 0);
1649
1649
  return 0;
1650
1650
  }
1651
- case "text":
1652
- case "comment":
1651
+ case 2:
1652
+ case 3:
1653
1653
  return 3;
1654
1654
  case 9:
1655
1655
  case 11:
@@ -1915,7 +1915,7 @@ function createRootCodegen(root, context) {
1915
1915
  if (isSingleElementRoot(root, child) && child.codegenNode) {
1916
1916
  const codegenNode = child.codegenNode;
1917
1917
  if (codegenNode.type === 13) {
1918
- makeBlock(codegenNode, context);
1918
+ convertToBlock(codegenNode, context);
1919
1919
  }
1920
1920
  root.codegenNode = codegenNode;
1921
1921
  } else {
@@ -1924,7 +1924,7 @@ function createRootCodegen(root, context) {
1924
1924
  } else if (children.length > 1) {
1925
1925
  let patchFlag = 64;
1926
1926
  let patchFlagText = PatchFlagNames[64];
1927
- if (process.env.NODE_ENV !== "production" && children.filter((c) => c.type !== "comment").length === 1) {
1927
+ if (process.env.NODE_ENV !== "production" && children.filter((c) => c.type !== 3).length === 1) {
1928
1928
  patchFlag |= 2048;
1929
1929
  patchFlagText += `, ${PatchFlagNames[2048]}`;
1930
1930
  }
@@ -1978,7 +1978,7 @@ function traverseNode(node, context) {
1978
1978
  }
1979
1979
  }
1980
1980
  switch (node.type) {
1981
- case "comment":
1981
+ case 3:
1982
1982
  if (!context.ssr) {
1983
1983
  context.helper(CREATE_COMMENT);
1984
1984
  }
@@ -1995,7 +1995,7 @@ function traverseNode(node, context) {
1995
1995
  break;
1996
1996
  case 10:
1997
1997
  case 11:
1998
- case "element":
1998
+ case 1:
1999
1999
  case 0:
2000
2000
  traverseChildren(node, context);
2001
2001
  break;
@@ -2009,7 +2009,7 @@ function traverseNode(node, context) {
2009
2009
  function createStructuralDirectiveTransform(name, fn) {
2010
2010
  const matches = isString(name) ? (n) => n === name : (n) => name.test(n);
2011
2011
  return (node, context) => {
2012
- if (node.type === "element") {
2012
+ if (node.type === 1) {
2013
2013
  const { props } = node;
2014
2014
  if (node.tagType === 3 && props.some(isVSlot)) {
2015
2015
  return;
@@ -2252,7 +2252,7 @@ function genHoists(hoists, context) {
2252
2252
  context.pure = false;
2253
2253
  }
2254
2254
  function isText(n) {
2255
- return isString(n) || n.type === 4 || n.type === "text" || n.type === 5 || n.type === 8;
2255
+ return isString(n) || n.type === 4 || n.type === 2 || n.type === 5 || n.type === 8;
2256
2256
  }
2257
2257
  function genNodeListAsArray(nodes, context) {
2258
2258
  const multilines = nodes.length > 3 || process.env.NODE_ENV !== "production" && nodes.some((n) => isArray(n) || !isText(n));
@@ -2293,7 +2293,7 @@ function genNode(node, context) {
2293
2293
  return;
2294
2294
  }
2295
2295
  switch (node.type) {
2296
- case "element":
2296
+ case 1:
2297
2297
  case 9:
2298
2298
  case 11:
2299
2299
  process.env.NODE_ENV !== "production" && assert(
@@ -2302,7 +2302,7 @@ function genNode(node, context) {
2302
2302
  );
2303
2303
  genNode(node.codegenNode, context);
2304
2304
  break;
2305
- case "text":
2305
+ case 2:
2306
2306
  genText(node, context);
2307
2307
  break;
2308
2308
  case 4:
@@ -2317,7 +2317,7 @@ function genNode(node, context) {
2317
2317
  case 8:
2318
2318
  genCompoundExpression(node, context);
2319
2319
  break;
2320
- case "comment":
2320
+ case 3:
2321
2321
  genComment(node, context);
2322
2322
  break;
2323
2323
  case 13:
@@ -2676,6 +2676,18 @@ const isFunctionType = (node) => {
2676
2676
  };
2677
2677
  const isStaticProperty = (node) => node && (node.type === "ObjectProperty" || node.type === "ObjectMethod") && !node.computed;
2678
2678
  const isStaticPropertyKey = (node, parent) => isStaticProperty(parent) && parent.key === node;
2679
+ const TS_NODE_TYPES = [
2680
+ "TSAsExpression",
2681
+ // foo as number
2682
+ "TSTypeAssertion",
2683
+ // (<number>foo)
2684
+ "TSNonNullExpression",
2685
+ // foo!
2686
+ "TSInstantiationExpression",
2687
+ // foo<string>
2688
+ "TSSatisfiesExpression"
2689
+ // foo satisfies T
2690
+ ];
2679
2691
 
2680
2692
  const prohibitedKeywordRE = new RegExp(
2681
2693
  "\\b" + "arguments,await,break,case,catch,class,const,continue,debugger,default,delete,do,else,export,extends,finally,for,function,if,import,let,new,return,super,switch,throw,try,var,void,while,with,yield".split(",").join("\\b|\\b") + "\\b"
@@ -2713,7 +2725,7 @@ const transformExpression = (node, context) => {
2713
2725
  node.content,
2714
2726
  context
2715
2727
  );
2716
- } else if (node.type === "element") {
2728
+ } else if (node.type === 1) {
2717
2729
  for (let i = 0; i < node.props.length; i++) {
2718
2730
  const dir = node.props[i];
2719
2731
  if (dir.type === 7 && dir.name !== "for") {
@@ -2812,11 +2824,12 @@ function processIf(node, dir, context, processCodegen) {
2812
2824
  let i = siblings.indexOf(node);
2813
2825
  while (i-- >= -1) {
2814
2826
  const sibling = siblings[i];
2815
- if (sibling && sibling.type === "comment") {
2816
- context.removeNode(sibling)(process.env.NODE_ENV !== "production") && comments.unshift(sibling);
2827
+ if (sibling && sibling.type === 3) {
2828
+ context.removeNode(sibling);
2829
+ process.env.NODE_ENV !== "production" && comments.unshift(sibling);
2817
2830
  continue;
2818
2831
  }
2819
- if (sibling && sibling.type === "text" && !sibling.content.trim().length) {
2832
+ if (sibling && sibling.type === 2 && !sibling.content.trim().length) {
2820
2833
  context.removeNode(sibling);
2821
2834
  continue;
2822
2835
  }
@@ -2829,7 +2842,7 @@ function processIf(node, dir, context, processCodegen) {
2829
2842
  context.removeNode();
2830
2843
  const branch = createIfBranch(node, dir);
2831
2844
  if (process.env.NODE_ENV !== "production" && comments.length && // #3619 ignore comments if the v-if is direct child of <transition>
2832
- !(context.parent && context.parent.type === "element" && isBuiltInType(context.parent.tag, "transition"))) {
2845
+ !(context.parent && context.parent.type === 1 && isBuiltInType(context.parent.tag, "transition"))) {
2833
2846
  branch.children = [...comments, ...branch.children];
2834
2847
  }
2835
2848
  if (process.env.NODE_ENV !== "production" || false) {
@@ -2902,7 +2915,7 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
2902
2915
  );
2903
2916
  const { children } = branch;
2904
2917
  const firstChild = children[0];
2905
- const needFragmentWrapper = children.length !== 1 || firstChild.type !== "element";
2918
+ const needFragmentWrapper = children.length !== 1 || firstChild.type !== 1;
2906
2919
  if (needFragmentWrapper) {
2907
2920
  if (children.length === 1 && firstChild.type === 11) {
2908
2921
  const vnodeCall = firstChild.codegenNode;
@@ -2911,7 +2924,7 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
2911
2924
  } else {
2912
2925
  let patchFlag = 64;
2913
2926
  let patchFlagText = PatchFlagNames[64];
2914
- if (process.env.NODE_ENV !== "production" && !branch.isTemplateIf && children.filter((c) => c.type !== "comment").length === 1) {
2927
+ if (process.env.NODE_ENV !== "production" && !branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) {
2915
2928
  patchFlag |= 2048;
2916
2929
  patchFlagText += `, ${PatchFlagNames[2048]}`;
2917
2930
  }
@@ -2933,7 +2946,7 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
2933
2946
  const ret = firstChild.codegenNode;
2934
2947
  const vnodeCall = getMemoedVNodeCall(ret);
2935
2948
  if (vnodeCall.type === 13) {
2936
- makeBlock(vnodeCall, context);
2949
+ convertToBlock(vnodeCall, context);
2937
2950
  }
2938
2951
  injectProp(vnodeCall, keyProperty, context);
2939
2952
  return ret;
@@ -3006,7 +3019,7 @@ const transformFor = createStructuralDirectiveTransform(
3006
3019
  const { children } = forNode;
3007
3020
  if ((process.env.NODE_ENV !== "production" || false) && isTemplate) {
3008
3021
  node.children.some((c) => {
3009
- if (c.type === "element") {
3022
+ if (c.type === 1) {
3010
3023
  const key = findProp(c, "key");
3011
3024
  if (key) {
3012
3025
  context.onError(
@@ -3020,7 +3033,7 @@ const transformFor = createStructuralDirectiveTransform(
3020
3033
  }
3021
3034
  });
3022
3035
  }
3023
- const needFragmentWrapper = children.length !== 1 || children[0].type !== "element";
3036
+ const needFragmentWrapper = children.length !== 1 || children[0].type !== 1;
3024
3037
  const slotOutlet = isSlotOutlet(node) ? node : isTemplate && node.children.length === 1 && isSlotOutlet(node.children[0]) ? node.children[0] : null;
3025
3038
  if (slotOutlet) {
3026
3039
  childBlock = slotOutlet.codegenNode;
@@ -3239,7 +3252,7 @@ function createParamsList(args) {
3239
3252
 
3240
3253
  const defaultFallback = createSimpleExpression(`undefined`, false);
3241
3254
  const trackSlotScopes = (node, context) => {
3242
- if (node.type === "element" && (node.tagType === 1 || node.tagType === 3)) {
3255
+ if (node.type === 1 && (node.tagType === 1 || node.tagType === 3)) {
3243
3256
  const vSlot = findDir(node, "slot");
3244
3257
  if (vSlot) {
3245
3258
  vSlot.exp;
@@ -3306,7 +3319,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
3306
3319
  const slotElement = children[i];
3307
3320
  let slotDir;
3308
3321
  if (!isTemplateNode(slotElement) || !(slotDir = findDir(slotElement, "slot", true))) {
3309
- if (slotElement.type !== "comment") {
3322
+ if (slotElement.type !== 3) {
3310
3323
  implicitDefaultChildren.push(slotElement);
3311
3324
  }
3312
3325
  continue;
@@ -3353,7 +3366,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
3353
3366
  let prev;
3354
3367
  while (j--) {
3355
3368
  prev = children[j];
3356
- if (prev.type !== "comment") {
3369
+ if (prev.type !== 3) {
3357
3370
  break;
3358
3371
  }
3359
3372
  }
@@ -3487,7 +3500,7 @@ function hasForwardedSlots(children) {
3487
3500
  for (let i = 0; i < children.length; i++) {
3488
3501
  const child = children[i];
3489
3502
  switch (child.type) {
3490
- case "element":
3503
+ case 1:
3491
3504
  if (child.tagType === 2 || hasForwardedSlots(child.children)) {
3492
3505
  return true;
3493
3506
  }
@@ -3506,16 +3519,16 @@ function hasForwardedSlots(children) {
3506
3519
  return false;
3507
3520
  }
3508
3521
  function isNonWhitespaceContent(node) {
3509
- if (node.type !== "text" && node.type !== 12)
3522
+ if (node.type !== 2 && node.type !== 12)
3510
3523
  return true;
3511
- return node.type === "text" ? !!node.content.trim() : isNonWhitespaceContent(node.content);
3524
+ return node.type === 2 ? !!node.content.trim() : isNonWhitespaceContent(node.content);
3512
3525
  }
3513
3526
 
3514
3527
  const directiveImportMap = /* @__PURE__ */ new WeakMap();
3515
3528
  const transformElement = (node, context) => {
3516
3529
  return function postTransformElement() {
3517
3530
  node = context.currentNode;
3518
- if (!(node.type === "element" && (node.tagType === 0 || node.tagType === 1))) {
3531
+ if (!(node.type === 1 && (node.tagType === 0 || node.tagType === 1))) {
3519
3532
  return;
3520
3533
  }
3521
3534
  const { tag, props } = node;
@@ -3586,7 +3599,7 @@ const transformElement = (node, context) => {
3586
3599
  if (hasDynamicTextChild && getConstantType(child, context) === 0) {
3587
3600
  patchFlag |= 1;
3588
3601
  }
3589
- if (hasDynamicTextChild || type === "text") {
3602
+ if (hasDynamicTextChild || type === 2) {
3590
3603
  vnodeChildren = child;
3591
3604
  } else {
3592
3605
  vnodeChildren = node.children;
@@ -4272,7 +4285,7 @@ const injectPrefix = (arg, prefix) => {
4272
4285
  };
4273
4286
 
4274
4287
  const transformText = (node, context) => {
4275
- if (node.type === 0 || node.type === "element" || node.type === 11 || node.type === 10) {
4288
+ if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
4276
4289
  return () => {
4277
4290
  const children = node.children;
4278
4291
  let currentContainer = void 0;
@@ -4304,7 +4317,7 @@ const transformText = (node, context) => {
4304
4317
  // as-is since the runtime has dedicated fast path for this by directly
4305
4318
  // setting textContent of the element.
4306
4319
  // for component root it's always normalized anyway.
4307
- children.length === 1 && (node.type === 0 || node.type === "element" && node.tagType === 0 && // #3756
4320
+ children.length === 1 && (node.type === 0 || node.type === 1 && node.tagType === 0 && // #3756
4308
4321
  // custom directives can potentially add DOM elements arbitrarily,
4309
4322
  // we need to avoid setting textContent of the element at runtime
4310
4323
  // to avoid accidentally overwriting the DOM elements added
@@ -4321,7 +4334,7 @@ const transformText = (node, context) => {
4321
4334
  const child = children[i];
4322
4335
  if (isText$1(child) || child.type === 8) {
4323
4336
  const callArgs = [];
4324
- if (child.type !== "text" || child.content !== " ") {
4337
+ if (child.type !== 2 || child.content !== " ") {
4325
4338
  callArgs.push(child);
4326
4339
  }
4327
4340
  if (!context.ssr && getConstantType(child, context) === 0) {
@@ -4346,8 +4359,8 @@ const transformText = (node, context) => {
4346
4359
 
4347
4360
  const seen$1 = /* @__PURE__ */ new WeakSet();
4348
4361
  const transformOnce = (node, context) => {
4349
- if (node.type === "element" && findDir(node, "once", true)) {
4350
- if (seen$1.has(node) || context.inVOnce) {
4362
+ if (node.type === 1 && findDir(node, "once", true)) {
4363
+ if (seen$1.has(node) || context.inVOnce || context.inSSR) {
4351
4364
  return;
4352
4365
  }
4353
4366
  seen$1.add(node);
@@ -4435,7 +4448,7 @@ const transformFilter = (node, context) => {
4435
4448
  if (node.type === 5) {
4436
4449
  rewriteFilter(node.content, context);
4437
4450
  }
4438
- if (node.type === "element") {
4451
+ if (node.type === 1) {
4439
4452
  node.props.forEach((prop) => {
4440
4453
  if (prop.type === 7 && prop.name !== "for" && prop.exp) {
4441
4454
  rewriteFilter(prop.exp, context);
@@ -4576,7 +4589,7 @@ function wrapFilter(exp, filter, context) {
4576
4589
 
4577
4590
  const seen = /* @__PURE__ */ new WeakSet();
4578
4591
  const transformMemo = (node, context) => {
4579
- if (node.type === "element") {
4592
+ if (node.type === 1) {
4580
4593
  const dir = findDir(node, "memo");
4581
4594
  if (!dir || seen.has(node)) {
4582
4595
  return;
@@ -4586,7 +4599,7 @@ const transformMemo = (node, context) => {
4586
4599
  const codegenNode = node.codegenNode || context.currentNode.codegenNode;
4587
4600
  if (codegenNode && codegenNode.type === 13) {
4588
4601
  if (node.tagType !== 1) {
4589
- makeBlock(codegenNode, context);
4602
+ convertToBlock(codegenNode, context);
4590
4603
  }
4591
4604
  node.codegenNode = createCallExpression(context.helper(WITH_MEMO), [
4592
4605
  dir.exp,
@@ -4666,4 +4679,4 @@ function baseCompile(template, options = {}) {
4666
4679
 
4667
4680
  const noopDirectiveTransform = () => ({ props: [] });
4668
4681
 
4669
- export { BASE_TRANSITION, CAMELIZE, CAPITALIZE, CREATE_BLOCK, CREATE_COMMENT, CREATE_ELEMENT_BLOCK, CREATE_ELEMENT_VNODE, CREATE_SLOTS, CREATE_STATIC, CREATE_TEXT, CREATE_VNODE, FRAGMENT, GUARD_REACTIVE_PROPS, IS_MEMO_SAME, IS_REF, KEEP_ALIVE, MERGE_PROPS, NORMALIZE_CLASS, NORMALIZE_PROPS, NORMALIZE_STYLE, OPEN_BLOCK, POP_SCOPE_ID, PUSH_SCOPE_ID, RENDER_LIST, RENDER_SLOT, RESOLVE_COMPONENT, RESOLVE_DIRECTIVE, RESOLVE_DYNAMIC_COMPONENT, RESOLVE_FILTER, SET_BLOCK_TRACKING, SUSPENSE, TELEPORT, TO_DISPLAY_STRING, TO_HANDLERS, TO_HANDLER_KEY, UNREF, WITH_CTX, WITH_DIRECTIVES, WITH_MEMO, advancePositionWithClone, advancePositionWithMutation, assert, baseCompile, baseParse, buildDirectiveArgs, buildProps, buildSlots, checkCompatEnabled, createArrayExpression, createAssignmentExpression, createBlockStatement, createCacheExpression, createCallExpression, createCompilerError, createCompoundExpression, createConditionalExpression, createForLoopParams, createFunctionExpression, createIfStatement, createInterpolation, createObjectExpression, createObjectProperty, createReturnStatement, createRoot, createSequenceExpression, createSimpleExpression, createStructuralDirectiveTransform, createTemplateLiteral, createTransformContext, createVNodeCall, extractIdentifiers, findDir, findProp, generate, getBaseTransformPreset, getConstantType, getInnerRange, getMemoedVNodeCall, getVNodeBlockHelper, getVNodeHelper, hasDynamicKeyVBind, hasScopeRef, helperNameMap, injectProp, isBuiltInType, isCoreComponent, isFunctionType, isInDestructureAssignment, isMemberExpression, isMemberExpressionBrowser, isMemberExpressionNode, isReferencedIdentifier, isSimpleIdentifier, isSlotOutlet, isStaticArgOf, isStaticExp, isStaticProperty, isStaticPropertyKey, isTemplateNode, isText$1 as isText, isVSlot, locStub, makeBlock, noopDirectiveTransform, processExpression, processFor, processIf, processSlotOutlet, registerRuntimeHelpers, resolveComponentType, stringifyExpression, toValidAssetId, trackSlotScopes, trackVForSlotScopes, transform, transformBind, transformElement, transformExpression, transformModel, transformOn, traverseNode, walkBlockDeclarations, walkFunctionParams, walkIdentifiers, warnDeprecation };
4682
+ export { BASE_TRANSITION, CAMELIZE, CAPITALIZE, CREATE_BLOCK, CREATE_COMMENT, CREATE_ELEMENT_BLOCK, CREATE_ELEMENT_VNODE, CREATE_SLOTS, CREATE_STATIC, CREATE_TEXT, CREATE_VNODE, FRAGMENT, GUARD_REACTIVE_PROPS, IS_MEMO_SAME, IS_REF, KEEP_ALIVE, MERGE_PROPS, NORMALIZE_CLASS, NORMALIZE_PROPS, NORMALIZE_STYLE, OPEN_BLOCK, POP_SCOPE_ID, PUSH_SCOPE_ID, RENDER_LIST, RENDER_SLOT, RESOLVE_COMPONENT, RESOLVE_DIRECTIVE, RESOLVE_DYNAMIC_COMPONENT, RESOLVE_FILTER, SET_BLOCK_TRACKING, SUSPENSE, TELEPORT, TO_DISPLAY_STRING, TO_HANDLERS, TO_HANDLER_KEY, TS_NODE_TYPES, UNREF, WITH_CTX, WITH_DIRECTIVES, WITH_MEMO, advancePositionWithClone, advancePositionWithMutation, assert, baseCompile, baseParse, buildDirectiveArgs, buildProps, buildSlots, checkCompatEnabled, convertToBlock, createArrayExpression, createAssignmentExpression, createBlockStatement, createCacheExpression, createCallExpression, createCompilerError, createCompoundExpression, createConditionalExpression, createForLoopParams, createFunctionExpression, createIfStatement, createInterpolation, createObjectExpression, createObjectProperty, createReturnStatement, createRoot, createSequenceExpression, createSimpleExpression, createStructuralDirectiveTransform, createTemplateLiteral, createTransformContext, createVNodeCall, extractIdentifiers, findDir, findProp, generate, getBaseTransformPreset, getConstantType, getInnerRange, getMemoedVNodeCall, getVNodeBlockHelper, getVNodeHelper, hasDynamicKeyVBind, hasScopeRef, helperNameMap, injectProp, isBuiltInType, isCoreComponent, isFunctionType, isInDestructureAssignment, isMemberExpression, isMemberExpressionBrowser, isMemberExpressionNode, isReferencedIdentifier, isSimpleIdentifier, isSlotOutlet, isStaticArgOf, isStaticExp, isStaticProperty, isStaticPropertyKey, isTemplateNode, isText$1 as isText, isVSlot, locStub, noopDirectiveTransform, processExpression, processFor, processIf, processSlotOutlet, registerRuntimeHelpers, resolveComponentType, stringifyExpression, toValidAssetId, trackSlotScopes, trackVForSlotScopes, transform, transformBind, transformElement, transformExpression, transformModel, transformOn, traverseNode, walkBlockDeclarations, walkFunctionParams, walkIdentifiers, warnDeprecation };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/compiler-core",
3
- "version": "3.3.0-alpha.1",
3
+ "version": "3.3.0-alpha.11",
4
4
  "description": "@vue/compiler-core",
5
5
  "main": "index.js",
6
6
  "module": "dist/compiler-core.esm-bundler.js",
@@ -32,12 +32,12 @@
32
32
  },
33
33
  "homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-core#readme",
34
34
  "dependencies": {
35
- "@vue/shared": "3.3.0-alpha.1",
36
- "@babel/parser": "^7.20.15",
35
+ "@babel/parser": "^7.21.3",
36
+ "@vue/shared": "3.3.0-alpha.11",
37
37
  "estree-walker": "^2.0.2",
38
- "source-map": "^0.6.1"
38
+ "source-map-js": "^1.0.2"
39
39
  },
40
40
  "devDependencies": {
41
- "@babel/types": "^7.16.0"
41
+ "@babel/types": "^7.21.3"
42
42
  }
43
43
  }