@vue/compiler-core 3.3.0-alpha.2 → 3.3.0-alpha.4

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.
@@ -513,16 +513,16 @@ function hasDynamicKeyVBind(node) {
513
513
  );
514
514
  }
515
515
  function isText$1(node) {
516
- return node.type === 5 || node.type === "text";
516
+ return node.type === 5 || node.type === 2;
517
517
  }
518
518
  function isVSlot(p) {
519
519
  return p.type === 7 && p.name === "slot";
520
520
  }
521
521
  function isTemplateNode(node) {
522
- return node.type === "element" && node.tagType === 3;
522
+ return node.type === 1 && node.tagType === 3;
523
523
  }
524
524
  function isSlotOutlet(node) {
525
- return node.type === "element" && node.tagType === 2;
525
+ return node.type === 1 && node.tagType === 2;
526
526
  }
527
527
  function getVNodeHelper(ssr, isComponent) {
528
528
  return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE;
@@ -621,7 +621,7 @@ function hasScopeRef(node, ids) {
621
621
  return false;
622
622
  }
623
623
  switch (node.type) {
624
- case "element":
624
+ case 1:
625
625
  for (let i = 0; i < node.props.length; i++) {
626
626
  const p = node.props[i];
627
627
  if (p.type === 7 && (hasScopeRef(p.arg, ids) || hasScopeRef(p.exp, ids))) {
@@ -648,8 +648,8 @@ function hasScopeRef(node, ids) {
648
648
  case 5:
649
649
  case 12:
650
650
  return hasScopeRef(node.content, ids);
651
- case "text":
652
- case "comment":
651
+ case 2:
652
+ case 3:
653
653
  return false;
654
654
  default:
655
655
  return false;
@@ -880,12 +880,12 @@ function parseChildren(context, mode, ancestors) {
880
880
  const shouldCondense = context.options.whitespace !== "preserve";
881
881
  for (let i = 0; i < nodes.length; i++) {
882
882
  const node = nodes[i];
883
- if (node.type === "text") {
883
+ if (node.type === 2) {
884
884
  if (!context.inPre) {
885
885
  if (!/[^\t\r\n\f ]/.test(node.content)) {
886
886
  const prev = nodes[i - 1];
887
887
  const next = nodes[i + 1];
888
- 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))) {
888
+ 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))) {
889
889
  removedWhitespace = true;
890
890
  nodes[i] = null;
891
891
  } else {
@@ -897,14 +897,14 @@ function parseChildren(context, mode, ancestors) {
897
897
  } else {
898
898
  node.content = node.content.replace(/\r\n/g, "\n");
899
899
  }
900
- } else if (node.type === "comment" && !context.options.comments) {
900
+ } else if (node.type === 3 && !context.options.comments) {
901
901
  removedWhitespace = true;
902
902
  nodes[i] = null;
903
903
  }
904
904
  }
905
905
  if (context.inPre && parent && context.options.isPreTag(parent.tag)) {
906
906
  const first = nodes[0];
907
- if (first && first.type === "text") {
907
+ if (first && first.type === 2) {
908
908
  first.content = first.content.replace(/^\r?\n/, "");
909
909
  }
910
910
  }
@@ -912,9 +912,9 @@ function parseChildren(context, mode, ancestors) {
912
912
  return removedWhitespace ? nodes.filter(Boolean) : nodes;
913
913
  }
914
914
  function pushNode(nodes, node) {
915
- if (node.type === "text") {
915
+ if (node.type === 2) {
916
916
  const prev = last(nodes);
917
- if (prev && prev.type === "text" && prev.loc.end.offset === node.loc.start.offset) {
917
+ if (prev && prev.type === 2 && prev.loc.end.offset === node.loc.start.offset) {
918
918
  prev.content += node.content;
919
919
  prev.loc.end = node.loc.end;
920
920
  prev.loc.source += node.loc.source;
@@ -961,7 +961,7 @@ function parseComment(context) {
961
961
  advanceBy(context, match.index + match[0].length - prevIndex + 1);
962
962
  }
963
963
  return {
964
- type: "comment",
964
+ type: 3,
965
965
  content,
966
966
  loc: getSelection(context, start)
967
967
  };
@@ -979,7 +979,7 @@ function parseBogusComment(context) {
979
979
  advanceBy(context, closeIndex + 1);
980
980
  }
981
981
  return {
982
- type: "comment",
982
+ type: 3,
983
983
  content,
984
984
  loc: getSelection(context, start)
985
985
  };
@@ -1015,7 +1015,7 @@ function parseElement(context, ancestors) {
1015
1015
  )) {
1016
1016
  const loc = getSelection(context, element.loc.end);
1017
1017
  inlineTemplateProp.value = {
1018
- type: "text",
1018
+ type: 2,
1019
1019
  content: loc.source,
1020
1020
  loc
1021
1021
  };
@@ -1122,7 +1122,7 @@ function parseTag(context, type, parent) {
1122
1122
  }
1123
1123
  }
1124
1124
  return {
1125
- type: "element",
1125
+ type: 1,
1126
1126
  ns,
1127
1127
  tag,
1128
1128
  tagType,
@@ -1328,7 +1328,7 @@ function parseAttribute(context, nameSet) {
1328
1328
  type: 6,
1329
1329
  name,
1330
1330
  value: value && {
1331
- type: "text",
1331
+ type: 2,
1332
1332
  content: value.content,
1333
1333
  loc: value.loc
1334
1334
  },
@@ -1418,7 +1418,7 @@ function parseText(context, mode) {
1418
1418
  const start = getCursor(context);
1419
1419
  const content = parseTextData(context, endIndex, mode);
1420
1420
  return {
1421
- type: "text",
1421
+ type: 2,
1422
1422
  content,
1423
1423
  loc: getSelection(context, start)
1424
1424
  };
@@ -1527,7 +1527,7 @@ function hoistStatic(root, context) {
1527
1527
  }
1528
1528
  function isSingleElementRoot(root, child) {
1529
1529
  const { children } = root;
1530
- return children.length === 1 && child.type === "element" && !isSlotOutlet(child);
1530
+ return children.length === 1 && child.type === 1 && !isSlotOutlet(child);
1531
1531
  }
1532
1532
  function walk(node, context, doNotHoistNode = false) {
1533
1533
  const { children } = node;
@@ -1535,7 +1535,7 @@ function walk(node, context, doNotHoistNode = false) {
1535
1535
  let hoistedCount = 0;
1536
1536
  for (let i = 0; i < children.length; i++) {
1537
1537
  const child = children[i];
1538
- if (child.type === "element" && child.tagType === 0) {
1538
+ if (child.type === 1 && child.tagType === 0) {
1539
1539
  const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
1540
1540
  if (constantType > 0) {
1541
1541
  if (constantType >= 2) {
@@ -1560,7 +1560,7 @@ function walk(node, context, doNotHoistNode = false) {
1560
1560
  }
1561
1561
  }
1562
1562
  }
1563
- if (child.type === "element") {
1563
+ if (child.type === 1) {
1564
1564
  const isComponent = child.tagType === 1;
1565
1565
  if (isComponent) {
1566
1566
  context.scopes.vSlot++;
@@ -1584,7 +1584,7 @@ function walk(node, context, doNotHoistNode = false) {
1584
1584
  if (hoistedCount && context.transformHoist) {
1585
1585
  context.transformHoist(children, context, node);
1586
1586
  }
1587
- if (hoistedCount && hoistedCount === originalCount && node.type === "element" && node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && shared.isArray(node.codegenNode.children)) {
1587
+ if (hoistedCount && hoistedCount === originalCount && node.type === 1 && node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && shared.isArray(node.codegenNode.children)) {
1588
1588
  node.codegenNode.children = context.hoist(
1589
1589
  createArrayExpression(node.codegenNode.children)
1590
1590
  );
@@ -1593,7 +1593,7 @@ function walk(node, context, doNotHoistNode = false) {
1593
1593
  function getConstantType(node, context) {
1594
1594
  const { constantCache } = context;
1595
1595
  switch (node.type) {
1596
- case "element":
1596
+ case 1:
1597
1597
  if (node.tagType !== 0) {
1598
1598
  return 0;
1599
1599
  }
@@ -1665,8 +1665,8 @@ function getConstantType(node, context) {
1665
1665
  constantCache.set(node, 0);
1666
1666
  return 0;
1667
1667
  }
1668
- case "text":
1669
- case "comment":
1668
+ case 2:
1669
+ case 3:
1670
1670
  return 3;
1671
1671
  case 9:
1672
1672
  case 11:
@@ -1968,7 +1968,7 @@ function createRootCodegen(root, context) {
1968
1968
  } else if (children.length > 1) {
1969
1969
  let patchFlag = 64;
1970
1970
  let patchFlagText = shared.PatchFlagNames[64];
1971
- if (children.filter((c) => c.type !== "comment").length === 1) {
1971
+ if (children.filter((c) => c.type !== 3).length === 1) {
1972
1972
  patchFlag |= 2048;
1973
1973
  patchFlagText += `, ${shared.PatchFlagNames[2048]}`;
1974
1974
  }
@@ -2022,7 +2022,7 @@ function traverseNode(node, context) {
2022
2022
  }
2023
2023
  }
2024
2024
  switch (node.type) {
2025
- case "comment":
2025
+ case 3:
2026
2026
  if (!context.ssr) {
2027
2027
  context.helper(CREATE_COMMENT);
2028
2028
  }
@@ -2039,7 +2039,7 @@ function traverseNode(node, context) {
2039
2039
  break;
2040
2040
  case 10:
2041
2041
  case 11:
2042
- case "element":
2042
+ case 1:
2043
2043
  case 0:
2044
2044
  traverseChildren(node, context);
2045
2045
  break;
@@ -2053,7 +2053,7 @@ function traverseNode(node, context) {
2053
2053
  function createStructuralDirectiveTransform(name, fn) {
2054
2054
  const matches = shared.isString(name) ? (n) => n === name : (n) => name.test(n);
2055
2055
  return (node, context) => {
2056
- if (node.type === "element") {
2056
+ if (node.type === 1) {
2057
2057
  const { props } = node;
2058
2058
  if (node.tagType === 3 && props.some(isVSlot)) {
2059
2059
  return;
@@ -2420,7 +2420,7 @@ function genImports(importsOptions, context) {
2420
2420
  });
2421
2421
  }
2422
2422
  function isText(n) {
2423
- return shared.isString(n) || n.type === 4 || n.type === "text" || n.type === 5 || n.type === 8;
2423
+ return shared.isString(n) || n.type === 4 || n.type === 2 || n.type === 5 || n.type === 8;
2424
2424
  }
2425
2425
  function genNodeListAsArray(nodes, context) {
2426
2426
  const multilines = nodes.length > 3 || nodes.some((n) => shared.isArray(n) || !isText(n));
@@ -2461,7 +2461,7 @@ function genNode(node, context) {
2461
2461
  return;
2462
2462
  }
2463
2463
  switch (node.type) {
2464
- case "element":
2464
+ case 1:
2465
2465
  case 9:
2466
2466
  case 11:
2467
2467
  assert(
@@ -2470,7 +2470,7 @@ function genNode(node, context) {
2470
2470
  );
2471
2471
  genNode(node.codegenNode, context);
2472
2472
  break;
2473
- case "text":
2473
+ case 2:
2474
2474
  genText(node, context);
2475
2475
  break;
2476
2476
  case 4:
@@ -2485,7 +2485,7 @@ function genNode(node, context) {
2485
2485
  case 8:
2486
2486
  genCompoundExpression(node, context);
2487
2487
  break;
2488
- case "comment":
2488
+ case 3:
2489
2489
  genComment(node, context);
2490
2490
  break;
2491
2491
  case 13:
@@ -3066,7 +3066,7 @@ const transformExpression = (node, context) => {
3066
3066
  node.content,
3067
3067
  context
3068
3068
  );
3069
- } else if (node.type === "element") {
3069
+ } else if (node.type === 1) {
3070
3070
  for (let i = 0; i < node.props.length; i++) {
3071
3071
  const dir = node.props[i];
3072
3072
  if (dir.type === 7 && dir.name !== "for") {
@@ -3332,12 +3332,12 @@ function processIf(node, dir, context, processCodegen) {
3332
3332
  let i = siblings.indexOf(node);
3333
3333
  while (i-- >= -1) {
3334
3334
  const sibling = siblings[i];
3335
- if (sibling && sibling.type === "comment") {
3335
+ if (sibling && sibling.type === 3) {
3336
3336
  context.removeNode(sibling);
3337
3337
  comments.unshift(sibling);
3338
3338
  continue;
3339
3339
  }
3340
- if (sibling && sibling.type === "text" && !sibling.content.trim().length) {
3340
+ if (sibling && sibling.type === 2 && !sibling.content.trim().length) {
3341
3341
  context.removeNode(sibling);
3342
3342
  continue;
3343
3343
  }
@@ -3350,7 +3350,7 @@ function processIf(node, dir, context, processCodegen) {
3350
3350
  context.removeNode();
3351
3351
  const branch = createIfBranch(node, dir);
3352
3352
  if (comments.length && // #3619 ignore comments if the v-if is direct child of <transition>
3353
- !(context.parent && context.parent.type === "element" && isBuiltInType(context.parent.tag, "transition"))) {
3353
+ !(context.parent && context.parent.type === 1 && isBuiltInType(context.parent.tag, "transition"))) {
3354
3354
  branch.children = [...comments, ...branch.children];
3355
3355
  }
3356
3356
  {
@@ -3423,7 +3423,7 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
3423
3423
  );
3424
3424
  const { children } = branch;
3425
3425
  const firstChild = children[0];
3426
- const needFragmentWrapper = children.length !== 1 || firstChild.type !== "element";
3426
+ const needFragmentWrapper = children.length !== 1 || firstChild.type !== 1;
3427
3427
  if (needFragmentWrapper) {
3428
3428
  if (children.length === 1 && firstChild.type === 11) {
3429
3429
  const vnodeCall = firstChild.codegenNode;
@@ -3432,7 +3432,7 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
3432
3432
  } else {
3433
3433
  let patchFlag = 64;
3434
3434
  let patchFlagText = shared.PatchFlagNames[64];
3435
- if (!branch.isTemplateIf && children.filter((c) => c.type !== "comment").length === 1) {
3435
+ if (!branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) {
3436
3436
  patchFlag |= 2048;
3437
3437
  patchFlagText += `, ${shared.PatchFlagNames[2048]}`;
3438
3438
  }
@@ -3541,7 +3541,7 @@ const transformFor = createStructuralDirectiveTransform(
3541
3541
  const { children } = forNode;
3542
3542
  if (isTemplate) {
3543
3543
  node.children.some((c) => {
3544
- if (c.type === "element") {
3544
+ if (c.type === 1) {
3545
3545
  const key = findProp(c, "key");
3546
3546
  if (key) {
3547
3547
  context.onError(
@@ -3555,7 +3555,7 @@ const transformFor = createStructuralDirectiveTransform(
3555
3555
  }
3556
3556
  });
3557
3557
  }
3558
- const needFragmentWrapper = children.length !== 1 || children[0].type !== "element";
3558
+ const needFragmentWrapper = children.length !== 1 || children[0].type !== 1;
3559
3559
  const slotOutlet = isSlotOutlet(node) ? node : isTemplate && node.children.length === 1 && isSlotOutlet(node.children[0]) ? node.children[0] : null;
3560
3560
  if (slotOutlet) {
3561
3561
  childBlock = slotOutlet.codegenNode;
@@ -3775,7 +3775,7 @@ function createParamsList(args) {
3775
3775
 
3776
3776
  const defaultFallback = createSimpleExpression(`undefined`, false);
3777
3777
  const trackSlotScopes = (node, context) => {
3778
- if (node.type === "element" && (node.tagType === 1 || node.tagType === 3)) {
3778
+ if (node.type === 1 && (node.tagType === 1 || node.tagType === 3)) {
3779
3779
  const vSlot = findDir(node, "slot");
3780
3780
  if (vSlot) {
3781
3781
  const slotProps = vSlot.exp;
@@ -3851,7 +3851,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
3851
3851
  const slotElement = children[i];
3852
3852
  let slotDir;
3853
3853
  if (!isTemplateNode(slotElement) || !(slotDir = findDir(slotElement, "slot", true))) {
3854
- if (slotElement.type !== "comment") {
3854
+ if (slotElement.type !== 3) {
3855
3855
  implicitDefaultChildren.push(slotElement);
3856
3856
  }
3857
3857
  continue;
@@ -3898,7 +3898,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
3898
3898
  let prev;
3899
3899
  while (j--) {
3900
3900
  prev = children[j];
3901
- if (prev.type !== "comment") {
3901
+ if (prev.type !== 3) {
3902
3902
  break;
3903
3903
  }
3904
3904
  }
@@ -4032,7 +4032,7 @@ function hasForwardedSlots(children) {
4032
4032
  for (let i = 0; i < children.length; i++) {
4033
4033
  const child = children[i];
4034
4034
  switch (child.type) {
4035
- case "element":
4035
+ case 1:
4036
4036
  if (child.tagType === 2 || hasForwardedSlots(child.children)) {
4037
4037
  return true;
4038
4038
  }
@@ -4051,16 +4051,16 @@ function hasForwardedSlots(children) {
4051
4051
  return false;
4052
4052
  }
4053
4053
  function isNonWhitespaceContent(node) {
4054
- if (node.type !== "text" && node.type !== 12)
4054
+ if (node.type !== 2 && node.type !== 12)
4055
4055
  return true;
4056
- return node.type === "text" ? !!node.content.trim() : isNonWhitespaceContent(node.content);
4056
+ return node.type === 2 ? !!node.content.trim() : isNonWhitespaceContent(node.content);
4057
4057
  }
4058
4058
 
4059
4059
  const directiveImportMap = /* @__PURE__ */ new WeakMap();
4060
4060
  const transformElement = (node, context) => {
4061
4061
  return function postTransformElement() {
4062
4062
  node = context.currentNode;
4063
- if (!(node.type === "element" && (node.tagType === 0 || node.tagType === 1))) {
4063
+ if (!(node.type === 1 && (node.tagType === 0 || node.tagType === 1))) {
4064
4064
  return;
4065
4065
  }
4066
4066
  const { tag, props } = node;
@@ -4131,7 +4131,7 @@ const transformElement = (node, context) => {
4131
4131
  if (hasDynamicTextChild && getConstantType(child, context) === 0) {
4132
4132
  patchFlag |= 1;
4133
4133
  }
4134
- if (hasDynamicTextChild || type === "text") {
4134
+ if (hasDynamicTextChild || type === 2) {
4135
4135
  vnodeChildren = child;
4136
4136
  } else {
4137
4137
  vnodeChildren = node.children;
@@ -4903,7 +4903,7 @@ const injectPrefix = (arg, prefix) => {
4903
4903
  };
4904
4904
 
4905
4905
  const transformText = (node, context) => {
4906
- if (node.type === 0 || node.type === "element" || node.type === 11 || node.type === 10) {
4906
+ if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
4907
4907
  return () => {
4908
4908
  const children = node.children;
4909
4909
  let currentContainer = void 0;
@@ -4935,7 +4935,7 @@ const transformText = (node, context) => {
4935
4935
  // as-is since the runtime has dedicated fast path for this by directly
4936
4936
  // setting textContent of the element.
4937
4937
  // for component root it's always normalized anyway.
4938
- children.length === 1 && (node.type === 0 || node.type === "element" && node.tagType === 0 && // #3756
4938
+ children.length === 1 && (node.type === 0 || node.type === 1 && node.tagType === 0 && // #3756
4939
4939
  // custom directives can potentially add DOM elements arbitrarily,
4940
4940
  // we need to avoid setting textContent of the element at runtime
4941
4941
  // to avoid accidentally overwriting the DOM elements added
@@ -4952,7 +4952,7 @@ const transformText = (node, context) => {
4952
4952
  const child = children[i];
4953
4953
  if (isText$1(child) || child.type === 8) {
4954
4954
  const callArgs = [];
4955
- if (child.type !== "text" || child.content !== " ") {
4955
+ if (child.type !== 2 || child.content !== " ") {
4956
4956
  callArgs.push(child);
4957
4957
  }
4958
4958
  if (!context.ssr && getConstantType(child, context) === 0) {
@@ -4977,7 +4977,7 @@ const transformText = (node, context) => {
4977
4977
 
4978
4978
  const seen$1 = /* @__PURE__ */ new WeakSet();
4979
4979
  const transformOnce = (node, context) => {
4980
- if (node.type === "element" && findDir(node, "once", true)) {
4980
+ if (node.type === 1 && findDir(node, "once", true)) {
4981
4981
  if (seen$1.has(node) || context.inVOnce) {
4982
4982
  return;
4983
4983
  }
@@ -5090,7 +5090,7 @@ const transformFilter = (node, context) => {
5090
5090
  if (node.type === 5) {
5091
5091
  rewriteFilter(node.content, context);
5092
5092
  }
5093
- if (node.type === "element") {
5093
+ if (node.type === 1) {
5094
5094
  node.props.forEach((prop) => {
5095
5095
  if (prop.type === 7 && prop.name !== "for" && prop.exp) {
5096
5096
  rewriteFilter(prop.exp, context);
@@ -5231,7 +5231,7 @@ function wrapFilter(exp, filter, context) {
5231
5231
 
5232
5232
  const seen = /* @__PURE__ */ new WeakSet();
5233
5233
  const transformMemo = (node, context) => {
5234
- if (node.type === "element") {
5234
+ if (node.type === 1) {
5235
5235
  const dir = findDir(node, "memo");
5236
5236
  if (!dir || seen.has(node)) {
5237
5237
  return;
@@ -512,16 +512,16 @@ function hasDynamicKeyVBind(node) {
512
512
  );
513
513
  }
514
514
  function isText$1(node) {
515
- return node.type === 5 || node.type === "text";
515
+ return node.type === 5 || node.type === 2;
516
516
  }
517
517
  function isVSlot(p) {
518
518
  return p.type === 7 && p.name === "slot";
519
519
  }
520
520
  function isTemplateNode(node) {
521
- return node.type === "element" && node.tagType === 3;
521
+ return node.type === 1 && node.tagType === 3;
522
522
  }
523
523
  function isSlotOutlet(node) {
524
- return node.type === "element" && node.tagType === 2;
524
+ return node.type === 1 && node.tagType === 2;
525
525
  }
526
526
  function getVNodeHelper(ssr, isComponent) {
527
527
  return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE;
@@ -620,7 +620,7 @@ function hasScopeRef(node, ids) {
620
620
  return false;
621
621
  }
622
622
  switch (node.type) {
623
- case "element":
623
+ case 1:
624
624
  for (let i = 0; i < node.props.length; i++) {
625
625
  const p = node.props[i];
626
626
  if (p.type === 7 && (hasScopeRef(p.arg, ids) || hasScopeRef(p.exp, ids))) {
@@ -647,8 +647,8 @@ function hasScopeRef(node, ids) {
647
647
  case 5:
648
648
  case 12:
649
649
  return hasScopeRef(node.content, ids);
650
- case "text":
651
- case "comment":
650
+ case 2:
651
+ case 3:
652
652
  return false;
653
653
  default:
654
654
  return false;
@@ -871,12 +871,12 @@ function parseChildren(context, mode, ancestors) {
871
871
  const shouldCondense = context.options.whitespace !== "preserve";
872
872
  for (let i = 0; i < nodes.length; i++) {
873
873
  const node = nodes[i];
874
- if (node.type === "text") {
874
+ if (node.type === 2) {
875
875
  if (!context.inPre) {
876
876
  if (!/[^\t\r\n\f ]/.test(node.content)) {
877
877
  const prev = nodes[i - 1];
878
878
  const next = nodes[i + 1];
879
- 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))) {
879
+ 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))) {
880
880
  removedWhitespace = true;
881
881
  nodes[i] = null;
882
882
  } else {
@@ -888,14 +888,14 @@ function parseChildren(context, mode, ancestors) {
888
888
  } else {
889
889
  node.content = node.content.replace(/\r\n/g, "\n");
890
890
  }
891
- } else if (node.type === "comment" && !context.options.comments) {
891
+ } else if (node.type === 3 && !context.options.comments) {
892
892
  removedWhitespace = true;
893
893
  nodes[i] = null;
894
894
  }
895
895
  }
896
896
  if (context.inPre && parent && context.options.isPreTag(parent.tag)) {
897
897
  const first = nodes[0];
898
- if (first && first.type === "text") {
898
+ if (first && first.type === 2) {
899
899
  first.content = first.content.replace(/^\r?\n/, "");
900
900
  }
901
901
  }
@@ -903,9 +903,9 @@ function parseChildren(context, mode, ancestors) {
903
903
  return removedWhitespace ? nodes.filter(Boolean) : nodes;
904
904
  }
905
905
  function pushNode(nodes, node) {
906
- if (node.type === "text") {
906
+ if (node.type === 2) {
907
907
  const prev = last(nodes);
908
- if (prev && prev.type === "text" && prev.loc.end.offset === node.loc.start.offset) {
908
+ if (prev && prev.type === 2 && prev.loc.end.offset === node.loc.start.offset) {
909
909
  prev.content += node.content;
910
910
  prev.loc.end = node.loc.end;
911
911
  prev.loc.source += node.loc.source;
@@ -952,7 +952,7 @@ function parseComment(context) {
952
952
  advanceBy(context, match.index + match[0].length - prevIndex + 1);
953
953
  }
954
954
  return {
955
- type: "comment",
955
+ type: 3,
956
956
  content,
957
957
  loc: getSelection(context, start)
958
958
  };
@@ -970,7 +970,7 @@ function parseBogusComment(context) {
970
970
  advanceBy(context, closeIndex + 1);
971
971
  }
972
972
  return {
973
- type: "comment",
973
+ type: 3,
974
974
  content,
975
975
  loc: getSelection(context, start)
976
976
  };
@@ -1006,7 +1006,7 @@ function parseElement(context, ancestors) {
1006
1006
  )) {
1007
1007
  const loc = getSelection(context, element.loc.end);
1008
1008
  inlineTemplateProp.value = {
1009
- type: "text",
1009
+ type: 2,
1010
1010
  content: loc.source,
1011
1011
  loc
1012
1012
  };
@@ -1088,7 +1088,7 @@ function parseTag(context, type, parent) {
1088
1088
  }
1089
1089
  }
1090
1090
  return {
1091
- type: "element",
1091
+ type: 1,
1092
1092
  ns,
1093
1093
  tag,
1094
1094
  tagType,
@@ -1287,7 +1287,7 @@ function parseAttribute(context, nameSet) {
1287
1287
  type: 6,
1288
1288
  name,
1289
1289
  value: value && {
1290
- type: "text",
1290
+ type: 2,
1291
1291
  content: value.content,
1292
1292
  loc: value.loc
1293
1293
  },
@@ -1377,7 +1377,7 @@ function parseText(context, mode) {
1377
1377
  const start = getCursor(context);
1378
1378
  const content = parseTextData(context, endIndex, mode);
1379
1379
  return {
1380
- type: "text",
1380
+ type: 2,
1381
1381
  content,
1382
1382
  loc: getSelection(context, start)
1383
1383
  };
@@ -1486,7 +1486,7 @@ function hoistStatic(root, context) {
1486
1486
  }
1487
1487
  function isSingleElementRoot(root, child) {
1488
1488
  const { children } = root;
1489
- return children.length === 1 && child.type === "element" && !isSlotOutlet(child);
1489
+ return children.length === 1 && child.type === 1 && !isSlotOutlet(child);
1490
1490
  }
1491
1491
  function walk(node, context, doNotHoistNode = false) {
1492
1492
  const { children } = node;
@@ -1494,7 +1494,7 @@ function walk(node, context, doNotHoistNode = false) {
1494
1494
  let hoistedCount = 0;
1495
1495
  for (let i = 0; i < children.length; i++) {
1496
1496
  const child = children[i];
1497
- if (child.type === "element" && child.tagType === 0) {
1497
+ if (child.type === 1 && child.tagType === 0) {
1498
1498
  const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
1499
1499
  if (constantType > 0) {
1500
1500
  if (constantType >= 2) {
@@ -1519,7 +1519,7 @@ function walk(node, context, doNotHoistNode = false) {
1519
1519
  }
1520
1520
  }
1521
1521
  }
1522
- if (child.type === "element") {
1522
+ if (child.type === 1) {
1523
1523
  const isComponent = child.tagType === 1;
1524
1524
  if (isComponent) {
1525
1525
  context.scopes.vSlot++;
@@ -1543,7 +1543,7 @@ function walk(node, context, doNotHoistNode = false) {
1543
1543
  if (hoistedCount && context.transformHoist) {
1544
1544
  context.transformHoist(children, context, node);
1545
1545
  }
1546
- if (hoistedCount && hoistedCount === originalCount && node.type === "element" && node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && shared.isArray(node.codegenNode.children)) {
1546
+ if (hoistedCount && hoistedCount === originalCount && node.type === 1 && node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && shared.isArray(node.codegenNode.children)) {
1547
1547
  node.codegenNode.children = context.hoist(
1548
1548
  createArrayExpression(node.codegenNode.children)
1549
1549
  );
@@ -1552,7 +1552,7 @@ function walk(node, context, doNotHoistNode = false) {
1552
1552
  function getConstantType(node, context) {
1553
1553
  const { constantCache } = context;
1554
1554
  switch (node.type) {
1555
- case "element":
1555
+ case 1:
1556
1556
  if (node.tagType !== 0) {
1557
1557
  return 0;
1558
1558
  }
@@ -1624,8 +1624,8 @@ function getConstantType(node, context) {
1624
1624
  constantCache.set(node, 0);
1625
1625
  return 0;
1626
1626
  }
1627
- case "text":
1628
- case "comment":
1627
+ case 2:
1628
+ case 3:
1629
1629
  return 3;
1630
1630
  case 9:
1631
1631
  case 11:
@@ -1963,7 +1963,7 @@ function traverseNode(node, context) {
1963
1963
  }
1964
1964
  }
1965
1965
  switch (node.type) {
1966
- case "comment":
1966
+ case 3:
1967
1967
  if (!context.ssr) {
1968
1968
  context.helper(CREATE_COMMENT);
1969
1969
  }
@@ -1980,7 +1980,7 @@ function traverseNode(node, context) {
1980
1980
  break;
1981
1981
  case 10:
1982
1982
  case 11:
1983
- case "element":
1983
+ case 1:
1984
1984
  case 0:
1985
1985
  traverseChildren(node, context);
1986
1986
  break;
@@ -1994,7 +1994,7 @@ function traverseNode(node, context) {
1994
1994
  function createStructuralDirectiveTransform(name, fn) {
1995
1995
  const matches = shared.isString(name) ? (n) => n === name : (n) => name.test(n);
1996
1996
  return (node, context) => {
1997
- if (node.type === "element") {
1997
+ if (node.type === 1) {
1998
1998
  const { props } = node;
1999
1999
  if (node.tagType === 3 && props.some(isVSlot)) {
2000
2000
  return;
@@ -2361,7 +2361,7 @@ function genImports(importsOptions, context) {
2361
2361
  });
2362
2362
  }
2363
2363
  function isText(n) {
2364
- return shared.isString(n) || n.type === 4 || n.type === "text" || n.type === 5 || n.type === 8;
2364
+ return shared.isString(n) || n.type === 4 || n.type === 2 || n.type === 5 || n.type === 8;
2365
2365
  }
2366
2366
  function genNodeListAsArray(nodes, context) {
2367
2367
  const multilines = nodes.length > 3 || nodes.some((n) => shared.isArray(n) || !isText(n));
@@ -2402,12 +2402,12 @@ function genNode(node, context) {
2402
2402
  return;
2403
2403
  }
2404
2404
  switch (node.type) {
2405
- case "element":
2405
+ case 1:
2406
2406
  case 9:
2407
2407
  case 11:
2408
2408
  genNode(node.codegenNode, context);
2409
2409
  break;
2410
- case "text":
2410
+ case 2:
2411
2411
  genText(node, context);
2412
2412
  break;
2413
2413
  case 4:
@@ -2422,7 +2422,7 @@ function genNode(node, context) {
2422
2422
  case 8:
2423
2423
  genCompoundExpression(node, context);
2424
2424
  break;
2425
- case "comment":
2425
+ case 3:
2426
2426
  genComment(node, context);
2427
2427
  break;
2428
2428
  case 13:
@@ -2995,7 +2995,7 @@ const transformExpression = (node, context) => {
2995
2995
  node.content,
2996
2996
  context
2997
2997
  );
2998
- } else if (node.type === "element") {
2998
+ } else if (node.type === 1) {
2999
2999
  for (let i = 0; i < node.props.length; i++) {
3000
3000
  const dir = node.props[i];
3001
3001
  if (dir.type === 7 && dir.name !== "for") {
@@ -3260,11 +3260,11 @@ function processIf(node, dir, context, processCodegen) {
3260
3260
  let i = siblings.indexOf(node);
3261
3261
  while (i-- >= -1) {
3262
3262
  const sibling = siblings[i];
3263
- if (sibling && sibling.type === "comment") {
3263
+ if (sibling && sibling.type === 3) {
3264
3264
  context.removeNode(sibling);
3265
3265
  continue;
3266
3266
  }
3267
- if (sibling && sibling.type === "text" && !sibling.content.trim().length) {
3267
+ if (sibling && sibling.type === 2 && !sibling.content.trim().length) {
3268
3268
  context.removeNode(sibling);
3269
3269
  continue;
3270
3270
  }
@@ -3346,7 +3346,7 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
3346
3346
  );
3347
3347
  const { children } = branch;
3348
3348
  const firstChild = children[0];
3349
- const needFragmentWrapper = children.length !== 1 || firstChild.type !== "element";
3349
+ const needFragmentWrapper = children.length !== 1 || firstChild.type !== 1;
3350
3350
  if (needFragmentWrapper) {
3351
3351
  if (children.length === 1 && firstChild.type === 11) {
3352
3352
  const vnodeCall = firstChild.codegenNode;
@@ -3460,7 +3460,7 @@ const transformFor = createStructuralDirectiveTransform(
3460
3460
  const { children } = forNode;
3461
3461
  if (isTemplate) {
3462
3462
  node.children.some((c) => {
3463
- if (c.type === "element") {
3463
+ if (c.type === 1) {
3464
3464
  const key = findProp(c, "key");
3465
3465
  if (key) {
3466
3466
  context.onError(
@@ -3474,7 +3474,7 @@ const transformFor = createStructuralDirectiveTransform(
3474
3474
  }
3475
3475
  });
3476
3476
  }
3477
- const needFragmentWrapper = children.length !== 1 || children[0].type !== "element";
3477
+ const needFragmentWrapper = children.length !== 1 || children[0].type !== 1;
3478
3478
  const slotOutlet = isSlotOutlet(node) ? node : isTemplate && node.children.length === 1 && isSlotOutlet(node.children[0]) ? node.children[0] : null;
3479
3479
  if (slotOutlet) {
3480
3480
  childBlock = slotOutlet.codegenNode;
@@ -3694,7 +3694,7 @@ function createParamsList(args) {
3694
3694
 
3695
3695
  const defaultFallback = createSimpleExpression(`undefined`, false);
3696
3696
  const trackSlotScopes = (node, context) => {
3697
- if (node.type === "element" && (node.tagType === 1 || node.tagType === 3)) {
3697
+ if (node.type === 1 && (node.tagType === 1 || node.tagType === 3)) {
3698
3698
  const vSlot = findDir(node, "slot");
3699
3699
  if (vSlot) {
3700
3700
  const slotProps = vSlot.exp;
@@ -3770,7 +3770,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
3770
3770
  const slotElement = children[i];
3771
3771
  let slotDir;
3772
3772
  if (!isTemplateNode(slotElement) || !(slotDir = findDir(slotElement, "slot", true))) {
3773
- if (slotElement.type !== "comment") {
3773
+ if (slotElement.type !== 3) {
3774
3774
  implicitDefaultChildren.push(slotElement);
3775
3775
  }
3776
3776
  continue;
@@ -3817,7 +3817,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
3817
3817
  let prev;
3818
3818
  while (j--) {
3819
3819
  prev = children[j];
3820
- if (prev.type !== "comment") {
3820
+ if (prev.type !== 3) {
3821
3821
  break;
3822
3822
  }
3823
3823
  }
@@ -3951,7 +3951,7 @@ function hasForwardedSlots(children) {
3951
3951
  for (let i = 0; i < children.length; i++) {
3952
3952
  const child = children[i];
3953
3953
  switch (child.type) {
3954
- case "element":
3954
+ case 1:
3955
3955
  if (child.tagType === 2 || hasForwardedSlots(child.children)) {
3956
3956
  return true;
3957
3957
  }
@@ -3970,16 +3970,16 @@ function hasForwardedSlots(children) {
3970
3970
  return false;
3971
3971
  }
3972
3972
  function isNonWhitespaceContent(node) {
3973
- if (node.type !== "text" && node.type !== 12)
3973
+ if (node.type !== 2 && node.type !== 12)
3974
3974
  return true;
3975
- return node.type === "text" ? !!node.content.trim() : isNonWhitespaceContent(node.content);
3975
+ return node.type === 2 ? !!node.content.trim() : isNonWhitespaceContent(node.content);
3976
3976
  }
3977
3977
 
3978
3978
  const directiveImportMap = /* @__PURE__ */ new WeakMap();
3979
3979
  const transformElement = (node, context) => {
3980
3980
  return function postTransformElement() {
3981
3981
  node = context.currentNode;
3982
- if (!(node.type === "element" && (node.tagType === 0 || node.tagType === 1))) {
3982
+ if (!(node.type === 1 && (node.tagType === 0 || node.tagType === 1))) {
3983
3983
  return;
3984
3984
  }
3985
3985
  const { tag, props } = node;
@@ -4041,7 +4041,7 @@ const transformElement = (node, context) => {
4041
4041
  if (hasDynamicTextChild && getConstantType(child, context) === 0) {
4042
4042
  patchFlag |= 1;
4043
4043
  }
4044
- if (hasDynamicTextChild || type === "text") {
4044
+ if (hasDynamicTextChild || type === 2) {
4045
4045
  vnodeChildren = child;
4046
4046
  } else {
4047
4047
  vnodeChildren = node.children;
@@ -4787,7 +4787,7 @@ const injectPrefix = (arg, prefix) => {
4787
4787
  };
4788
4788
 
4789
4789
  const transformText = (node, context) => {
4790
- if (node.type === 0 || node.type === "element" || node.type === 11 || node.type === 10) {
4790
+ if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
4791
4791
  return () => {
4792
4792
  const children = node.children;
4793
4793
  let currentContainer = void 0;
@@ -4819,7 +4819,7 @@ const transformText = (node, context) => {
4819
4819
  // as-is since the runtime has dedicated fast path for this by directly
4820
4820
  // setting textContent of the element.
4821
4821
  // for component root it's always normalized anyway.
4822
- children.length === 1 && (node.type === 0 || node.type === "element" && node.tagType === 0 && // #3756
4822
+ children.length === 1 && (node.type === 0 || node.type === 1 && node.tagType === 0 && // #3756
4823
4823
  // custom directives can potentially add DOM elements arbitrarily,
4824
4824
  // we need to avoid setting textContent of the element at runtime
4825
4825
  // to avoid accidentally overwriting the DOM elements added
@@ -4836,7 +4836,7 @@ const transformText = (node, context) => {
4836
4836
  const child = children[i];
4837
4837
  if (isText$1(child) || child.type === 8) {
4838
4838
  const callArgs = [];
4839
- if (child.type !== "text" || child.content !== " ") {
4839
+ if (child.type !== 2 || child.content !== " ") {
4840
4840
  callArgs.push(child);
4841
4841
  }
4842
4842
  if (!context.ssr && getConstantType(child, context) === 0) {
@@ -4861,7 +4861,7 @@ const transformText = (node, context) => {
4861
4861
 
4862
4862
  const seen$1 = /* @__PURE__ */ new WeakSet();
4863
4863
  const transformOnce = (node, context) => {
4864
- if (node.type === "element" && findDir(node, "once", true)) {
4864
+ if (node.type === 1 && findDir(node, "once", true)) {
4865
4865
  if (seen$1.has(node) || context.inVOnce) {
4866
4866
  return;
4867
4867
  }
@@ -4974,7 +4974,7 @@ const transformFilter = (node, context) => {
4974
4974
  if (node.type === 5) {
4975
4975
  rewriteFilter(node.content, context);
4976
4976
  }
4977
- if (node.type === "element") {
4977
+ if (node.type === 1) {
4978
4978
  node.props.forEach((prop) => {
4979
4979
  if (prop.type === 7 && prop.name !== "for" && prop.exp) {
4980
4980
  rewriteFilter(prop.exp, context);
@@ -5110,7 +5110,7 @@ function wrapFilter(exp, filter, context) {
5110
5110
 
5111
5111
  const seen = /* @__PURE__ */ new WeakSet();
5112
5112
  const transformMemo = (node, context) => {
5113
- if (node.type === "element") {
5113
+ if (node.type === 1) {
5114
5114
  const dir = findDir(node, "memo");
5115
5115
  if (!dir || seen.has(node)) {
5116
5116
  return;
@@ -495,16 +495,16 @@ function hasDynamicKeyVBind(node) {
495
495
  );
496
496
  }
497
497
  function isText$1(node) {
498
- return node.type === 5 || node.type === "text";
498
+ return node.type === 5 || node.type === 2;
499
499
  }
500
500
  function isVSlot(p) {
501
501
  return p.type === 7 && p.name === "slot";
502
502
  }
503
503
  function isTemplateNode(node) {
504
- return node.type === "element" && node.tagType === 3;
504
+ return node.type === 1 && node.tagType === 3;
505
505
  }
506
506
  function isSlotOutlet(node) {
507
- return node.type === "element" && node.tagType === 2;
507
+ return node.type === 1 && node.tagType === 2;
508
508
  }
509
509
  function getVNodeHelper(ssr, isComponent) {
510
510
  return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE;
@@ -603,7 +603,7 @@ function hasScopeRef(node, ids) {
603
603
  return false;
604
604
  }
605
605
  switch (node.type) {
606
- case "element":
606
+ case 1:
607
607
  for (let i = 0; i < node.props.length; i++) {
608
608
  const p = node.props[i];
609
609
  if (p.type === 7 && (hasScopeRef(p.arg, ids) || hasScopeRef(p.exp, ids))) {
@@ -630,8 +630,8 @@ function hasScopeRef(node, ids) {
630
630
  case 5:
631
631
  case 12:
632
632
  return hasScopeRef(node.content, ids);
633
- case "text":
634
- case "comment":
633
+ case 2:
634
+ case 3:
635
635
  return false;
636
636
  default:
637
637
  if (process.env.NODE_ENV !== "production") ;
@@ -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:
@@ -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:
@@ -2713,7 +2713,7 @@ const transformExpression = (node, context) => {
2713
2713
  node.content,
2714
2714
  context
2715
2715
  );
2716
- } else if (node.type === "element") {
2716
+ } else if (node.type === 1) {
2717
2717
  for (let i = 0; i < node.props.length; i++) {
2718
2718
  const dir = node.props[i];
2719
2719
  if (dir.type === 7 && dir.name !== "for") {
@@ -2812,12 +2812,12 @@ function processIf(node, dir, context, processCodegen) {
2812
2812
  let i = siblings.indexOf(node);
2813
2813
  while (i-- >= -1) {
2814
2814
  const sibling = siblings[i];
2815
- if (sibling && sibling.type === "comment") {
2815
+ if (sibling && sibling.type === 3) {
2816
2816
  context.removeNode(sibling);
2817
2817
  process.env.NODE_ENV !== "production" && comments.unshift(sibling);
2818
2818
  continue;
2819
2819
  }
2820
- if (sibling && sibling.type === "text" && !sibling.content.trim().length) {
2820
+ if (sibling && sibling.type === 2 && !sibling.content.trim().length) {
2821
2821
  context.removeNode(sibling);
2822
2822
  continue;
2823
2823
  }
@@ -2830,7 +2830,7 @@ function processIf(node, dir, context, processCodegen) {
2830
2830
  context.removeNode();
2831
2831
  const branch = createIfBranch(node, dir);
2832
2832
  if (process.env.NODE_ENV !== "production" && comments.length && // #3619 ignore comments if the v-if is direct child of <transition>
2833
- !(context.parent && context.parent.type === "element" && isBuiltInType(context.parent.tag, "transition"))) {
2833
+ !(context.parent && context.parent.type === 1 && isBuiltInType(context.parent.tag, "transition"))) {
2834
2834
  branch.children = [...comments, ...branch.children];
2835
2835
  }
2836
2836
  if (process.env.NODE_ENV !== "production" || false) {
@@ -2903,7 +2903,7 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
2903
2903
  );
2904
2904
  const { children } = branch;
2905
2905
  const firstChild = children[0];
2906
- const needFragmentWrapper = children.length !== 1 || firstChild.type !== "element";
2906
+ const needFragmentWrapper = children.length !== 1 || firstChild.type !== 1;
2907
2907
  if (needFragmentWrapper) {
2908
2908
  if (children.length === 1 && firstChild.type === 11) {
2909
2909
  const vnodeCall = firstChild.codegenNode;
@@ -2912,7 +2912,7 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
2912
2912
  } else {
2913
2913
  let patchFlag = 64;
2914
2914
  let patchFlagText = PatchFlagNames[64];
2915
- if (process.env.NODE_ENV !== "production" && !branch.isTemplateIf && children.filter((c) => c.type !== "comment").length === 1) {
2915
+ if (process.env.NODE_ENV !== "production" && !branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) {
2916
2916
  patchFlag |= 2048;
2917
2917
  patchFlagText += `, ${PatchFlagNames[2048]}`;
2918
2918
  }
@@ -3007,7 +3007,7 @@ const transformFor = createStructuralDirectiveTransform(
3007
3007
  const { children } = forNode;
3008
3008
  if ((process.env.NODE_ENV !== "production" || false) && isTemplate) {
3009
3009
  node.children.some((c) => {
3010
- if (c.type === "element") {
3010
+ if (c.type === 1) {
3011
3011
  const key = findProp(c, "key");
3012
3012
  if (key) {
3013
3013
  context.onError(
@@ -3021,7 +3021,7 @@ const transformFor = createStructuralDirectiveTransform(
3021
3021
  }
3022
3022
  });
3023
3023
  }
3024
- const needFragmentWrapper = children.length !== 1 || children[0].type !== "element";
3024
+ const needFragmentWrapper = children.length !== 1 || children[0].type !== 1;
3025
3025
  const slotOutlet = isSlotOutlet(node) ? node : isTemplate && node.children.length === 1 && isSlotOutlet(node.children[0]) ? node.children[0] : null;
3026
3026
  if (slotOutlet) {
3027
3027
  childBlock = slotOutlet.codegenNode;
@@ -3240,7 +3240,7 @@ function createParamsList(args) {
3240
3240
 
3241
3241
  const defaultFallback = createSimpleExpression(`undefined`, false);
3242
3242
  const trackSlotScopes = (node, context) => {
3243
- if (node.type === "element" && (node.tagType === 1 || node.tagType === 3)) {
3243
+ if (node.type === 1 && (node.tagType === 1 || node.tagType === 3)) {
3244
3244
  const vSlot = findDir(node, "slot");
3245
3245
  if (vSlot) {
3246
3246
  vSlot.exp;
@@ -3307,7 +3307,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
3307
3307
  const slotElement = children[i];
3308
3308
  let slotDir;
3309
3309
  if (!isTemplateNode(slotElement) || !(slotDir = findDir(slotElement, "slot", true))) {
3310
- if (slotElement.type !== "comment") {
3310
+ if (slotElement.type !== 3) {
3311
3311
  implicitDefaultChildren.push(slotElement);
3312
3312
  }
3313
3313
  continue;
@@ -3354,7 +3354,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
3354
3354
  let prev;
3355
3355
  while (j--) {
3356
3356
  prev = children[j];
3357
- if (prev.type !== "comment") {
3357
+ if (prev.type !== 3) {
3358
3358
  break;
3359
3359
  }
3360
3360
  }
@@ -3488,7 +3488,7 @@ function hasForwardedSlots(children) {
3488
3488
  for (let i = 0; i < children.length; i++) {
3489
3489
  const child = children[i];
3490
3490
  switch (child.type) {
3491
- case "element":
3491
+ case 1:
3492
3492
  if (child.tagType === 2 || hasForwardedSlots(child.children)) {
3493
3493
  return true;
3494
3494
  }
@@ -3507,16 +3507,16 @@ function hasForwardedSlots(children) {
3507
3507
  return false;
3508
3508
  }
3509
3509
  function isNonWhitespaceContent(node) {
3510
- if (node.type !== "text" && node.type !== 12)
3510
+ if (node.type !== 2 && node.type !== 12)
3511
3511
  return true;
3512
- return node.type === "text" ? !!node.content.trim() : isNonWhitespaceContent(node.content);
3512
+ return node.type === 2 ? !!node.content.trim() : isNonWhitespaceContent(node.content);
3513
3513
  }
3514
3514
 
3515
3515
  const directiveImportMap = /* @__PURE__ */ new WeakMap();
3516
3516
  const transformElement = (node, context) => {
3517
3517
  return function postTransformElement() {
3518
3518
  node = context.currentNode;
3519
- if (!(node.type === "element" && (node.tagType === 0 || node.tagType === 1))) {
3519
+ if (!(node.type === 1 && (node.tagType === 0 || node.tagType === 1))) {
3520
3520
  return;
3521
3521
  }
3522
3522
  const { tag, props } = node;
@@ -3587,7 +3587,7 @@ const transformElement = (node, context) => {
3587
3587
  if (hasDynamicTextChild && getConstantType(child, context) === 0) {
3588
3588
  patchFlag |= 1;
3589
3589
  }
3590
- if (hasDynamicTextChild || type === "text") {
3590
+ if (hasDynamicTextChild || type === 2) {
3591
3591
  vnodeChildren = child;
3592
3592
  } else {
3593
3593
  vnodeChildren = node.children;
@@ -4273,7 +4273,7 @@ const injectPrefix = (arg, prefix) => {
4273
4273
  };
4274
4274
 
4275
4275
  const transformText = (node, context) => {
4276
- if (node.type === 0 || node.type === "element" || node.type === 11 || node.type === 10) {
4276
+ if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
4277
4277
  return () => {
4278
4278
  const children = node.children;
4279
4279
  let currentContainer = void 0;
@@ -4305,7 +4305,7 @@ const transformText = (node, context) => {
4305
4305
  // as-is since the runtime has dedicated fast path for this by directly
4306
4306
  // setting textContent of the element.
4307
4307
  // for component root it's always normalized anyway.
4308
- children.length === 1 && (node.type === 0 || node.type === "element" && node.tagType === 0 && // #3756
4308
+ children.length === 1 && (node.type === 0 || node.type === 1 && node.tagType === 0 && // #3756
4309
4309
  // custom directives can potentially add DOM elements arbitrarily,
4310
4310
  // we need to avoid setting textContent of the element at runtime
4311
4311
  // to avoid accidentally overwriting the DOM elements added
@@ -4322,7 +4322,7 @@ const transformText = (node, context) => {
4322
4322
  const child = children[i];
4323
4323
  if (isText$1(child) || child.type === 8) {
4324
4324
  const callArgs = [];
4325
- if (child.type !== "text" || child.content !== " ") {
4325
+ if (child.type !== 2 || child.content !== " ") {
4326
4326
  callArgs.push(child);
4327
4327
  }
4328
4328
  if (!context.ssr && getConstantType(child, context) === 0) {
@@ -4347,7 +4347,7 @@ const transformText = (node, context) => {
4347
4347
 
4348
4348
  const seen$1 = /* @__PURE__ */ new WeakSet();
4349
4349
  const transformOnce = (node, context) => {
4350
- if (node.type === "element" && findDir(node, "once", true)) {
4350
+ if (node.type === 1 && findDir(node, "once", true)) {
4351
4351
  if (seen$1.has(node) || context.inVOnce) {
4352
4352
  return;
4353
4353
  }
@@ -4436,7 +4436,7 @@ const transformFilter = (node, context) => {
4436
4436
  if (node.type === 5) {
4437
4437
  rewriteFilter(node.content, context);
4438
4438
  }
4439
- if (node.type === "element") {
4439
+ if (node.type === 1) {
4440
4440
  node.props.forEach((prop) => {
4441
4441
  if (prop.type === 7 && prop.name !== "for" && prop.exp) {
4442
4442
  rewriteFilter(prop.exp, context);
@@ -4577,7 +4577,7 @@ function wrapFilter(exp, filter, context) {
4577
4577
 
4578
4578
  const seen = /* @__PURE__ */ new WeakSet();
4579
4579
  const transformMemo = (node, context) => {
4580
- if (node.type === "element") {
4580
+ if (node.type === 1) {
4581
4581
  const dir = findDir(node, "memo");
4582
4582
  if (!dir || seen.has(node)) {
4583
4583
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/compiler-core",
3
- "version": "3.3.0-alpha.2",
3
+ "version": "3.3.0-alpha.4",
4
4
  "description": "@vue/compiler-core",
5
5
  "main": "index.js",
6
6
  "module": "dist/compiler-core.esm-bundler.js",
@@ -32,7 +32,7 @@
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.2",
35
+ "@vue/shared": "3.3.0-alpha.4",
36
36
  "@babel/parser": "^7.20.15",
37
37
  "estree-walker": "^2.0.2",
38
38
  "source-map": "^0.6.1"