@vue/compiler-sfc 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.
@@ -1075,7 +1075,7 @@ const createAssetUrlTransformWithOptions = (options) => {
1075
1075
  return (node, context) => transformAssetUrl(node, context, options);
1076
1076
  };
1077
1077
  const transformAssetUrl = (node, context, options = defaultAssetUrlOptions) => {
1078
- if (node.type === "element") {
1078
+ if (node.type === 1) {
1079
1079
  if (!node.props.length) {
1080
1080
  return;
1081
1081
  }
@@ -1165,7 +1165,7 @@ const createSrcsetTransformWithOptions = (options) => {
1165
1165
  return (node, context) => transformSrcset(node, context, options);
1166
1166
  };
1167
1167
  const transformSrcset = (node, context, options = defaultAssetUrlOptions) => {
1168
- if (node.type === "element") {
1168
+ if (node.type === 1) {
1169
1169
  if (srcsetTags.includes(node.tag) && node.props.length) {
1170
1170
  node.props.forEach((attr, index) => {
1171
1171
  if (attr.name === "srcset" && attr.type === 6) {
@@ -4879,7 +4879,7 @@ function resolveTemplateUsageCheckString(sfc) {
4879
4879
  CompilerDOM.transform(CompilerDOM.createRoot([ast]), {
4880
4880
  nodeTransforms: [
4881
4881
  (node) => {
4882
- if (node.type === "element") {
4882
+ if (node.type === 1) {
4883
4883
  if (!CompilerDOM.parserOptions.isNativeTag(node.tag) && !CompilerDOM.parserOptions.isBuiltInComponent(node.tag)) {
4884
4884
  code += `,${shared.camelize(node.tag)},${shared.capitalize(shared.camelize(node.tag))}`;
4885
4885
  }
@@ -5020,7 +5020,7 @@ function parse$2(source, {
5020
5020
  }
5021
5021
  });
5022
5022
  ast.children.forEach((node) => {
5023
- if (node.type !== "element") {
5023
+ if (node.type !== 1) {
5024
5024
  return;
5025
5025
  }
5026
5026
  if (ignoreEmpty && node.tag !== "template" && isEmpty(node) && !hasSrc(node)) {
@@ -5243,7 +5243,7 @@ function hasSrc(node) {
5243
5243
  function isEmpty(node) {
5244
5244
  for (let i = 0; i < node.children.length; i++) {
5245
5245
  const child = node.children[i];
5246
- if (child.type !== "text" || child.content.trim() !== "") {
5246
+ if (child.type !== 2 || child.content.trim() !== "") {
5247
5247
  return false;
5248
5248
  }
5249
5249
  }
@@ -15149,16 +15149,16 @@ function hasDynamicKeyVBind(node) {
15149
15149
  );
15150
15150
  }
15151
15151
  function isText$1(node) {
15152
- return node.type === 5 || node.type === "text";
15152
+ return node.type === 5 || node.type === 2;
15153
15153
  }
15154
15154
  function isVSlot(p) {
15155
15155
  return p.type === 7 && p.name === "slot";
15156
15156
  }
15157
15157
  function isTemplateNode(node) {
15158
- return node.type === "element" && node.tagType === 3;
15158
+ return node.type === 1 && node.tagType === 3;
15159
15159
  }
15160
15160
  function isSlotOutlet(node) {
15161
- return node.type === "element" && node.tagType === 2;
15161
+ return node.type === 1 && node.tagType === 2;
15162
15162
  }
15163
15163
  function getVNodeHelper(ssr, isComponent) {
15164
15164
  return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE;
@@ -15257,7 +15257,7 @@ function hasScopeRef(node, ids) {
15257
15257
  return false;
15258
15258
  }
15259
15259
  switch (node.type) {
15260
- case "element":
15260
+ case 1:
15261
15261
  for (let i = 0; i < node.props.length; i++) {
15262
15262
  const p = node.props[i];
15263
15263
  if (p.type === 7 && (hasScopeRef(p.arg, ids) || hasScopeRef(p.exp, ids))) {
@@ -15284,8 +15284,8 @@ function hasScopeRef(node, ids) {
15284
15284
  case 5:
15285
15285
  case 12:
15286
15286
  return hasScopeRef(node.content, ids);
15287
- case "text":
15288
- case "comment":
15287
+ case 2:
15288
+ case 3:
15289
15289
  return false;
15290
15290
  default:
15291
15291
  return false;
@@ -15503,12 +15503,12 @@ function parseChildren(context, mode, ancestors) {
15503
15503
  const shouldCondense = context.options.whitespace !== "preserve";
15504
15504
  for (let i = 0; i < nodes.length; i++) {
15505
15505
  const node = nodes[i];
15506
- if (node.type === "text") {
15506
+ if (node.type === 2) {
15507
15507
  if (!context.inPre) {
15508
15508
  if (!/[^\t\r\n\f ]/.test(node.content)) {
15509
15509
  const prev = nodes[i - 1];
15510
15510
  const next = nodes[i + 1];
15511
- 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))) {
15511
+ 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))) {
15512
15512
  removedWhitespace = true;
15513
15513
  nodes[i] = null;
15514
15514
  } else {
@@ -15520,14 +15520,14 @@ function parseChildren(context, mode, ancestors) {
15520
15520
  } else {
15521
15521
  node.content = node.content.replace(/\r\n/g, "\n");
15522
15522
  }
15523
- } else if (node.type === "comment" && !context.options.comments) {
15523
+ } else if (node.type === 3 && !context.options.comments) {
15524
15524
  removedWhitespace = true;
15525
15525
  nodes[i] = null;
15526
15526
  }
15527
15527
  }
15528
15528
  if (context.inPre && parent && context.options.isPreTag(parent.tag)) {
15529
15529
  const first = nodes[0];
15530
- if (first && first.type === "text") {
15530
+ if (first && first.type === 2) {
15531
15531
  first.content = first.content.replace(/^\r?\n/, "");
15532
15532
  }
15533
15533
  }
@@ -15535,9 +15535,9 @@ function parseChildren(context, mode, ancestors) {
15535
15535
  return removedWhitespace ? nodes.filter(Boolean) : nodes;
15536
15536
  }
15537
15537
  function pushNode(nodes, node) {
15538
- if (node.type === "text") {
15538
+ if (node.type === 2) {
15539
15539
  const prev = last(nodes);
15540
- if (prev && prev.type === "text" && prev.loc.end.offset === node.loc.start.offset) {
15540
+ if (prev && prev.type === 2 && prev.loc.end.offset === node.loc.start.offset) {
15541
15541
  prev.content += node.content;
15542
15542
  prev.loc.end = node.loc.end;
15543
15543
  prev.loc.source += node.loc.source;
@@ -15584,7 +15584,7 @@ function parseComment(context) {
15584
15584
  advanceBy(context, match.index + match[0].length - prevIndex + 1);
15585
15585
  }
15586
15586
  return {
15587
- type: "comment",
15587
+ type: 3,
15588
15588
  content,
15589
15589
  loc: getSelection(context, start)
15590
15590
  };
@@ -15602,7 +15602,7 @@ function parseBogusComment(context) {
15602
15602
  advanceBy(context, closeIndex + 1);
15603
15603
  }
15604
15604
  return {
15605
- type: "comment",
15605
+ type: 3,
15606
15606
  content,
15607
15607
  loc: getSelection(context, start)
15608
15608
  };
@@ -15703,7 +15703,7 @@ function parseTag(context, type, parent) {
15703
15703
  }
15704
15704
  }
15705
15705
  return {
15706
- type: "element",
15706
+ type: 1,
15707
15707
  ns,
15708
15708
  tag,
15709
15709
  tagType,
@@ -15881,7 +15881,7 @@ function parseAttribute(context, nameSet) {
15881
15881
  type: 6,
15882
15882
  name,
15883
15883
  value: value && {
15884
- type: "text",
15884
+ type: 2,
15885
15885
  content: value.content,
15886
15886
  loc: value.loc
15887
15887
  },
@@ -15971,7 +15971,7 @@ function parseText(context, mode) {
15971
15971
  const start = getCursor(context);
15972
15972
  const content = parseTextData(context, endIndex, mode);
15973
15973
  return {
15974
- type: "text",
15974
+ type: 2,
15975
15975
  content,
15976
15976
  loc: getSelection(context, start)
15977
15977
  };
@@ -16080,7 +16080,7 @@ function hoistStatic(root, context) {
16080
16080
  }
16081
16081
  function isSingleElementRoot(root, child) {
16082
16082
  const { children } = root;
16083
- return children.length === 1 && child.type === "element" && !isSlotOutlet(child);
16083
+ return children.length === 1 && child.type === 1 && !isSlotOutlet(child);
16084
16084
  }
16085
16085
  function walk$2(node, context, doNotHoistNode = false) {
16086
16086
  const { children } = node;
@@ -16088,7 +16088,7 @@ function walk$2(node, context, doNotHoistNode = false) {
16088
16088
  let hoistedCount = 0;
16089
16089
  for (let i = 0; i < children.length; i++) {
16090
16090
  const child = children[i];
16091
- if (child.type === "element" && child.tagType === 0) {
16091
+ if (child.type === 1 && child.tagType === 0) {
16092
16092
  const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
16093
16093
  if (constantType > 0) {
16094
16094
  if (constantType >= 2) {
@@ -16113,7 +16113,7 @@ function walk$2(node, context, doNotHoistNode = false) {
16113
16113
  }
16114
16114
  }
16115
16115
  }
16116
- if (child.type === "element") {
16116
+ if (child.type === 1) {
16117
16117
  const isComponent = child.tagType === 1;
16118
16118
  if (isComponent) {
16119
16119
  context.scopes.vSlot++;
@@ -16137,7 +16137,7 @@ function walk$2(node, context, doNotHoistNode = false) {
16137
16137
  if (hoistedCount && context.transformHoist) {
16138
16138
  context.transformHoist(children, context, node);
16139
16139
  }
16140
- if (hoistedCount && hoistedCount === originalCount && node.type === "element" && node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray$3(node.codegenNode.children)) {
16140
+ if (hoistedCount && hoistedCount === originalCount && node.type === 1 && node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray$3(node.codegenNode.children)) {
16141
16141
  node.codegenNode.children = context.hoist(
16142
16142
  createArrayExpression(node.codegenNode.children)
16143
16143
  );
@@ -16146,7 +16146,7 @@ function walk$2(node, context, doNotHoistNode = false) {
16146
16146
  function getConstantType(node, context) {
16147
16147
  const { constantCache } = context;
16148
16148
  switch (node.type) {
16149
- case "element":
16149
+ case 1:
16150
16150
  if (node.tagType !== 0) {
16151
16151
  return 0;
16152
16152
  }
@@ -16218,8 +16218,8 @@ function getConstantType(node, context) {
16218
16218
  constantCache.set(node, 0);
16219
16219
  return 0;
16220
16220
  }
16221
- case "text":
16222
- case "comment":
16221
+ case 2:
16222
+ case 3:
16223
16223
  return 3;
16224
16224
  case 9:
16225
16225
  case 11:
@@ -16515,7 +16515,7 @@ function createRootCodegen(root, context) {
16515
16515
  } else if (children.length > 1) {
16516
16516
  let patchFlag = 64;
16517
16517
  let patchFlagText = PatchFlagNames[64];
16518
- if (children.filter((c) => c.type !== "comment").length === 1) {
16518
+ if (children.filter((c) => c.type !== 3).length === 1) {
16519
16519
  patchFlag |= 2048;
16520
16520
  patchFlagText += `, ${PatchFlagNames[2048]}`;
16521
16521
  }
@@ -16569,7 +16569,7 @@ function traverseNode(node, context) {
16569
16569
  }
16570
16570
  }
16571
16571
  switch (node.type) {
16572
- case "comment":
16572
+ case 3:
16573
16573
  if (!context.ssr) {
16574
16574
  context.helper(CREATE_COMMENT);
16575
16575
  }
@@ -16586,7 +16586,7 @@ function traverseNode(node, context) {
16586
16586
  break;
16587
16587
  case 10:
16588
16588
  case 11:
16589
- case "element":
16589
+ case 1:
16590
16590
  case 0:
16591
16591
  traverseChildren(node, context);
16592
16592
  break;
@@ -16600,7 +16600,7 @@ function traverseNode(node, context) {
16600
16600
  function createStructuralDirectiveTransform(name, fn) {
16601
16601
  const matches = isString$2(name) ? (n) => n === name : (n) => name.test(n);
16602
16602
  return (node, context) => {
16603
- if (node.type === "element") {
16603
+ if (node.type === 1) {
16604
16604
  const { props } = node;
16605
16605
  if (node.tagType === 3 && props.some(isVSlot)) {
16606
16606
  return;
@@ -20121,7 +20121,7 @@ function genImports(importsOptions, context) {
20121
20121
  });
20122
20122
  }
20123
20123
  function isText(n) {
20124
- return isString$2(n) || n.type === 4 || n.type === "text" || n.type === 5 || n.type === 8;
20124
+ return isString$2(n) || n.type === 4 || n.type === 2 || n.type === 5 || n.type === 8;
20125
20125
  }
20126
20126
  function genNodeListAsArray(nodes, context) {
20127
20127
  const multilines = nodes.length > 3 || nodes.some((n) => isArray$3(n) || !isText(n));
@@ -20162,7 +20162,7 @@ function genNode(node, context) {
20162
20162
  return;
20163
20163
  }
20164
20164
  switch (node.type) {
20165
- case "element":
20165
+ case 1:
20166
20166
  case 9:
20167
20167
  case 11:
20168
20168
  assert(
@@ -20171,7 +20171,7 @@ function genNode(node, context) {
20171
20171
  );
20172
20172
  genNode(node.codegenNode, context);
20173
20173
  break;
20174
- case "text":
20174
+ case 2:
20175
20175
  genText(node, context);
20176
20176
  break;
20177
20177
  case 4:
@@ -20186,7 +20186,7 @@ function genNode(node, context) {
20186
20186
  case 8:
20187
20187
  genCompoundExpression(node, context);
20188
20188
  break;
20189
- case "comment":
20189
+ case 3:
20190
20190
  genComment(node, context);
20191
20191
  break;
20192
20192
  case 13:
@@ -20964,7 +20964,7 @@ const transformExpression = (node, context) => {
20964
20964
  node.content,
20965
20965
  context
20966
20966
  );
20967
- } else if (node.type === "element") {
20967
+ } else if (node.type === 1) {
20968
20968
  for (let i = 0; i < node.props.length; i++) {
20969
20969
  const dir = node.props[i];
20970
20970
  if (dir.type === 7 && dir.name !== "for") {
@@ -21227,12 +21227,12 @@ function processIf(node, dir, context, processCodegen) {
21227
21227
  let i = siblings.indexOf(node);
21228
21228
  while (i-- >= -1) {
21229
21229
  const sibling = siblings[i];
21230
- if (sibling && sibling.type === "comment") {
21230
+ if (sibling && sibling.type === 3) {
21231
21231
  context.removeNode(sibling);
21232
21232
  comments.unshift(sibling);
21233
21233
  continue;
21234
21234
  }
21235
- if (sibling && sibling.type === "text" && !sibling.content.trim().length) {
21235
+ if (sibling && sibling.type === 2 && !sibling.content.trim().length) {
21236
21236
  context.removeNode(sibling);
21237
21237
  continue;
21238
21238
  }
@@ -21245,7 +21245,7 @@ function processIf(node, dir, context, processCodegen) {
21245
21245
  context.removeNode();
21246
21246
  const branch = createIfBranch(node, dir);
21247
21247
  if (comments.length && // #3619 ignore comments if the v-if is direct child of <transition>
21248
- !(context.parent && context.parent.type === "element" && isBuiltInType(context.parent.tag, "transition"))) {
21248
+ !(context.parent && context.parent.type === 1 && isBuiltInType(context.parent.tag, "transition"))) {
21249
21249
  branch.children = [...comments, ...branch.children];
21250
21250
  }
21251
21251
  {
@@ -21318,7 +21318,7 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
21318
21318
  );
21319
21319
  const { children } = branch;
21320
21320
  const firstChild = children[0];
21321
- const needFragmentWrapper = children.length !== 1 || firstChild.type !== "element";
21321
+ const needFragmentWrapper = children.length !== 1 || firstChild.type !== 1;
21322
21322
  if (needFragmentWrapper) {
21323
21323
  if (children.length === 1 && firstChild.type === 11) {
21324
21324
  const vnodeCall = firstChild.codegenNode;
@@ -21327,7 +21327,7 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
21327
21327
  } else {
21328
21328
  let patchFlag = 64;
21329
21329
  let patchFlagText = PatchFlagNames[64];
21330
- if (!branch.isTemplateIf && children.filter((c) => c.type !== "comment").length === 1) {
21330
+ if (!branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) {
21331
21331
  patchFlag |= 2048;
21332
21332
  patchFlagText += `, ${PatchFlagNames[2048]}`;
21333
21333
  }
@@ -21436,7 +21436,7 @@ const transformFor = createStructuralDirectiveTransform(
21436
21436
  const { children } = forNode;
21437
21437
  if (isTemplate) {
21438
21438
  node.children.some((c) => {
21439
- if (c.type === "element") {
21439
+ if (c.type === 1) {
21440
21440
  const key = findProp(c, "key");
21441
21441
  if (key) {
21442
21442
  context.onError(
@@ -21450,7 +21450,7 @@ const transformFor = createStructuralDirectiveTransform(
21450
21450
  }
21451
21451
  });
21452
21452
  }
21453
- const needFragmentWrapper = children.length !== 1 || children[0].type !== "element";
21453
+ const needFragmentWrapper = children.length !== 1 || children[0].type !== 1;
21454
21454
  const slotOutlet = isSlotOutlet(node) ? node : isTemplate && node.children.length === 1 && isSlotOutlet(node.children[0]) ? node.children[0] : null;
21455
21455
  if (slotOutlet) {
21456
21456
  childBlock = slotOutlet.codegenNode;
@@ -21670,7 +21670,7 @@ function createParamsList(args) {
21670
21670
 
21671
21671
  const defaultFallback = createSimpleExpression(`undefined`, false);
21672
21672
  const trackSlotScopes = (node, context) => {
21673
- if (node.type === "element" && (node.tagType === 1 || node.tagType === 3)) {
21673
+ if (node.type === 1 && (node.tagType === 1 || node.tagType === 3)) {
21674
21674
  const vSlot = findDir(node, "slot");
21675
21675
  if (vSlot) {
21676
21676
  const slotProps = vSlot.exp;
@@ -21746,7 +21746,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
21746
21746
  const slotElement = children[i];
21747
21747
  let slotDir;
21748
21748
  if (!isTemplateNode(slotElement) || !(slotDir = findDir(slotElement, "slot", true))) {
21749
- if (slotElement.type !== "comment") {
21749
+ if (slotElement.type !== 3) {
21750
21750
  implicitDefaultChildren.push(slotElement);
21751
21751
  }
21752
21752
  continue;
@@ -21793,7 +21793,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
21793
21793
  let prev;
21794
21794
  while (j--) {
21795
21795
  prev = children[j];
21796
- if (prev.type !== "comment") {
21796
+ if (prev.type !== 3) {
21797
21797
  break;
21798
21798
  }
21799
21799
  }
@@ -21924,7 +21924,7 @@ function hasForwardedSlots(children) {
21924
21924
  for (let i = 0; i < children.length; i++) {
21925
21925
  const child = children[i];
21926
21926
  switch (child.type) {
21927
- case "element":
21927
+ case 1:
21928
21928
  if (child.tagType === 2 || hasForwardedSlots(child.children)) {
21929
21929
  return true;
21930
21930
  }
@@ -21943,16 +21943,16 @@ function hasForwardedSlots(children) {
21943
21943
  return false;
21944
21944
  }
21945
21945
  function isNonWhitespaceContent(node) {
21946
- if (node.type !== "text" && node.type !== 12)
21946
+ if (node.type !== 2 && node.type !== 12)
21947
21947
  return true;
21948
- return node.type === "text" ? !!node.content.trim() : isNonWhitespaceContent(node.content);
21948
+ return node.type === 2 ? !!node.content.trim() : isNonWhitespaceContent(node.content);
21949
21949
  }
21950
21950
 
21951
21951
  const directiveImportMap = /* @__PURE__ */ new WeakMap();
21952
21952
  const transformElement = (node, context) => {
21953
21953
  return function postTransformElement() {
21954
21954
  node = context.currentNode;
21955
- if (!(node.type === "element" && (node.tagType === 0 || node.tagType === 1))) {
21955
+ if (!(node.type === 1 && (node.tagType === 0 || node.tagType === 1))) {
21956
21956
  return;
21957
21957
  }
21958
21958
  const { tag, props } = node;
@@ -22023,7 +22023,7 @@ const transformElement = (node, context) => {
22023
22023
  if (hasDynamicTextChild && getConstantType(child, context) === 0) {
22024
22024
  patchFlag |= 1;
22025
22025
  }
22026
- if (hasDynamicTextChild || type === "text") {
22026
+ if (hasDynamicTextChild || type === 2) {
22027
22027
  vnodeChildren = child;
22028
22028
  } else {
22029
22029
  vnodeChildren = node.children;
@@ -22756,7 +22756,7 @@ const injectPrefix = (arg, prefix) => {
22756
22756
  };
22757
22757
 
22758
22758
  const transformText = (node, context) => {
22759
- if (node.type === 0 || node.type === "element" || node.type === 11 || node.type === 10) {
22759
+ if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
22760
22760
  return () => {
22761
22761
  const children = node.children;
22762
22762
  let currentContainer = void 0;
@@ -22788,7 +22788,7 @@ const transformText = (node, context) => {
22788
22788
  // as-is since the runtime has dedicated fast path for this by directly
22789
22789
  // setting textContent of the element.
22790
22790
  // for component root it's always normalized anyway.
22791
- children.length === 1 && (node.type === 0 || node.type === "element" && node.tagType === 0 && // #3756
22791
+ children.length === 1 && (node.type === 0 || node.type === 1 && node.tagType === 0 && // #3756
22792
22792
  // custom directives can potentially add DOM elements arbitrarily,
22793
22793
  // we need to avoid setting textContent of the element at runtime
22794
22794
  // to avoid accidentally overwriting the DOM elements added
@@ -22805,7 +22805,7 @@ const transformText = (node, context) => {
22805
22805
  const child = children[i];
22806
22806
  if (isText$1(child) || child.type === 8) {
22807
22807
  const callArgs = [];
22808
- if (child.type !== "text" || child.content !== " ") {
22808
+ if (child.type !== 2 || child.content !== " ") {
22809
22809
  callArgs.push(child);
22810
22810
  }
22811
22811
  if (!context.ssr && getConstantType(child, context) === 0) {
@@ -22830,7 +22830,7 @@ const transformText = (node, context) => {
22830
22830
 
22831
22831
  const seen$1 = /* @__PURE__ */ new WeakSet();
22832
22832
  const transformOnce = (node, context) => {
22833
- if (node.type === "element" && findDir(node, "once", true)) {
22833
+ if (node.type === 1 && findDir(node, "once", true)) {
22834
22834
  if (seen$1.has(node) || context.inVOnce) {
22835
22835
  return;
22836
22836
  }
@@ -22937,7 +22937,7 @@ function createTransformProps(props = []) {
22937
22937
 
22938
22938
  const seen = /* @__PURE__ */ new WeakSet();
22939
22939
  const transformMemo = (node, context) => {
22940
- if (node.type === "element") {
22940
+ if (node.type === 1) {
22941
22941
  const dir = findDir(node, "memo");
22942
22942
  if (!dir || seen.has(node)) {
22943
22943
  return;
@@ -25454,7 +25454,7 @@ const parserOptions = {
25454
25454
  };
25455
25455
 
25456
25456
  const transformStyle = (node) => {
25457
- if (node.type === "element") {
25457
+ if (node.type === 1) {
25458
25458
  node.props.forEach((p, i) => {
25459
25459
  if (p.type === 6 && p.name === "style" && p.value) {
25460
25460
  node.props[i] = {
@@ -25738,7 +25738,7 @@ const transformShow = (dir, node, context) => {
25738
25738
  };
25739
25739
 
25740
25740
  const transformTransition = (node, context) => {
25741
- if (node.type === "element" && node.tagType === 1) {
25741
+ if (node.type === 1 && node.tagType === 1) {
25742
25742
  const component = context.isBuiltInComponent(node.tag);
25743
25743
  if (component === TRANSITION) {
25744
25744
  return () => {
@@ -25758,7 +25758,7 @@ const transformTransition = (node, context) => {
25758
25758
  );
25759
25759
  }
25760
25760
  const child = node.children[0];
25761
- if (child.type === "element") {
25761
+ if (child.type === 1) {
25762
25762
  for (const p of child.props) {
25763
25763
  if (p.type === 7 && p.name === "show") {
25764
25764
  node.props.push({
@@ -25776,7 +25776,7 @@ const transformTransition = (node, context) => {
25776
25776
  };
25777
25777
  function hasMultipleChildren(node) {
25778
25778
  const children = node.children = node.children.filter(
25779
- (c) => c.type !== "comment" && !(c.type === "text" && !c.content.trim())
25779
+ (c) => c.type !== 3 && !(c.type === 2 && !c.content.trim())
25780
25780
  );
25781
25781
  const child = children[0];
25782
25782
  return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(hasMultipleChildren);
@@ -25833,7 +25833,7 @@ const stringifyStatic = (children, context, parent) => {
25833
25833
  }
25834
25834
  stringifyCurrentChunk(i);
25835
25835
  };
25836
- const getHoistedNode = (node) => (node.type === "element" && node.tagType === 0 || node.type == 12) && node.codegenNode && node.codegenNode.type === 4 && node.codegenNode.hoisted;
25836
+ const getHoistedNode = (node) => (node.type === 1 && node.tagType === 0 || node.type == 12) && node.codegenNode && node.codegenNode.type === 4 && node.codegenNode.hoisted;
25837
25837
  const dataAriaRE = /^(data|aria)-/;
25838
25838
  const isStringifiableAttr = (name, ns) => {
25839
25839
  return (ns === 0 ? isKnownHtmlAttr(name) : ns === 1 ? isKnownSvgAttr(name) : false) || dataAriaRE.test(name);
@@ -25846,7 +25846,7 @@ const isNonStringifiable = /* @__PURE__ */ makeMap(
25846
25846
  `caption,thead,tr,th,tbody,td,tfoot,colgroup,col`
25847
25847
  );
25848
25848
  function analyzeNode(node) {
25849
- if (node.type === "element" && isNonStringifiable(node.tag)) {
25849
+ if (node.type === 1 && isNonStringifiable(node.tag)) {
25850
25850
  return false;
25851
25851
  }
25852
25852
  if (node.type === 12) {
@@ -25877,7 +25877,7 @@ function analyzeNode(node) {
25877
25877
  for (let i = 0; i < node2.children.length; i++) {
25878
25878
  nc++;
25879
25879
  const child = node2.children[i];
25880
- if (child.type === "element") {
25880
+ if (child.type === 1) {
25881
25881
  if (child.props.length > 0) {
25882
25882
  ec++;
25883
25883
  }
@@ -25899,11 +25899,11 @@ function stringifyNode(node, context) {
25899
25899
  return ``;
25900
25900
  }
25901
25901
  switch (node.type) {
25902
- case "element":
25902
+ case 1:
25903
25903
  return stringifyElement(node, context);
25904
- case "text":
25904
+ case 2:
25905
25905
  return escapeHtml(node.content);
25906
- case "comment":
25906
+ case 3:
25907
25907
  return `<!--${escapeHtml(node.content)}-->`;
25908
25908
  case 5:
25909
25909
  return escapeHtml(toDisplayString(evaluateConstant(node.content)));
@@ -25981,7 +25981,7 @@ function evaluateConstant(exp) {
25981
25981
  if (isString$2(c) || isSymbol$1(c)) {
25982
25982
  return;
25983
25983
  }
25984
- if (c.type === "text") {
25984
+ if (c.type === 2) {
25985
25985
  res += c.content;
25986
25986
  } else if (c.type === 5) {
25987
25987
  res += toDisplayString(evaluateConstant(c.content));
@@ -25994,7 +25994,7 @@ function evaluateConstant(exp) {
25994
25994
  }
25995
25995
 
25996
25996
  const ignoreSideEffectTags = (node, context) => {
25997
- if (node.type === "element" && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) {
25997
+ if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) {
25998
25998
  context.onError(
25999
25999
  createDOMCompilerError(61, node.loc)
26000
26000
  );
@@ -31937,7 +31937,7 @@ const createAssetUrlTransformWithOptions = (options) => {
31937
31937
  return (node, context) => transformAssetUrl(node, context, options);
31938
31938
  };
31939
31939
  const transformAssetUrl = (node, context, options = defaultAssetUrlOptions) => {
31940
- if (node.type === "element") {
31940
+ if (node.type === 1) {
31941
31941
  if (!node.props.length) {
31942
31942
  return;
31943
31943
  }
@@ -32027,7 +32027,7 @@ const createSrcsetTransformWithOptions = (options) => {
32027
32027
  return (node, context) => transformSrcset(node, context, options);
32028
32028
  };
32029
32029
  const transformSrcset = (node, context, options = defaultAssetUrlOptions) => {
32030
- if (node.type === "element") {
32030
+ if (node.type === 1) {
32031
32031
  if (srcsetTags.includes(node.tag) && node.props.length) {
32032
32032
  node.props.forEach((attr, index) => {
32033
32033
  if (attr.name === "srcset" && attr.type === 6) {
@@ -32216,7 +32216,7 @@ function ssrProcessIf(node, context, disableNestedFragments = false) {
32216
32216
  }
32217
32217
  function processIfBranch(branch, context, disableNestedFragments = false) {
32218
32218
  const { children } = branch;
32219
- const needFragmentWrapper = !disableNestedFragments && (children.length !== 1 || children[0].type !== "element") && // optimize away nested fragments when the only child is a ForNode
32219
+ const needFragmentWrapper = !disableNestedFragments && (children.length !== 1 || children[0].type !== 1) && // optimize away nested fragments when the only child is a ForNode
32220
32220
  !(children.length === 1 && children[0].type === 11);
32221
32221
  return processChildrenAsStatement(branch, context, needFragmentWrapper);
32222
32222
  }
@@ -32226,7 +32226,7 @@ const ssrTransformFor = createStructuralDirectiveTransform(
32226
32226
  processFor
32227
32227
  );
32228
32228
  function ssrProcessFor(node, context, disableNestedFragments = false) {
32229
- const needFragmentWrapper = !disableNestedFragments && (node.children.length !== 1 || node.children[0].type !== "element");
32229
+ const needFragmentWrapper = !disableNestedFragments && (node.children.length !== 1 || node.children[0].type !== 1);
32230
32230
  const renderLoop = createFunctionExpression(
32231
32231
  createForLoopParams(node.parseResult)
32232
32232
  );
@@ -32266,7 +32266,7 @@ const ssrTransformSlotOutlet = (node, context) => {
32266
32266
  }
32267
32267
  let method = SSR_RENDER_SLOT;
32268
32268
  const parent = context.parent;
32269
- if (parent && parent.type === "element" && parent.tagType === 1 && resolveComponentType(parent, context, true) === TRANSITION && parent.children.filter((c) => c.type === "element").length === 1) {
32269
+ if (parent && parent.type === 1 && parent.tagType === 1 && resolveComponentType(parent, context, true) === TRANSITION && parent.children.filter((c) => c.type === 1).length === 1) {
32270
32270
  method = SSR_RENDER_SLOT_INNER;
32271
32271
  if (!(context.scopeId && context.slotted !== false)) {
32272
32272
  args.push("null");
@@ -32402,7 +32402,7 @@ function ssrProcessSuspense(node, context) {
32402
32402
 
32403
32403
  const rawChildrenMap = /* @__PURE__ */ new WeakMap();
32404
32404
  const ssrTransformElement = (node, context) => {
32405
- if (node.type !== "element" || node.tagType !== 0) {
32405
+ if (node.type !== 1 || node.tagType !== 0) {
32406
32406
  return;
32407
32407
  }
32408
32408
  return function ssrPostTransformElement() {
@@ -32780,7 +32780,7 @@ const wipMap = /* @__PURE__ */ new WeakMap();
32780
32780
  const WIP_SLOT = Symbol();
32781
32781
  const componentTypeMap = /* @__PURE__ */ new WeakMap();
32782
32782
  const ssrTransformComponent = (node, context) => {
32783
- if (node.type !== "element" || node.tagType !== 1) {
32783
+ if (node.type !== 1 || node.tagType !== 1) {
32784
32784
  return;
32785
32785
  }
32786
32786
  const component = resolveComponentType(
@@ -32881,7 +32881,7 @@ function ssrProcessComponent(node, context, parent) {
32881
32881
  context.pushStringPart(``);
32882
32882
  }
32883
32883
  if (component === TRANSITION) {
32884
- node.children = node.children.filter((c) => c.type !== "comment");
32884
+ node.children = node.children.filter((c) => c.type !== 3);
32885
32885
  }
32886
32886
  processChildren(node, context);
32887
32887
  }
@@ -32928,7 +32928,7 @@ function createVNodeSlotBranch(props, children, parentContext) {
32928
32928
  directiveTransforms: __spreadValues$7(__spreadValues$7({}, vnodeDirectiveTransforms), rawOptions.directiveTransforms || {})
32929
32929
  });
32930
32930
  const wrapperNode = {
32931
- type: "element",
32931
+ type: 1,
32932
32932
  ns: 0,
32933
32933
  tag: "template",
32934
32934
  tagType: 3,
@@ -33068,7 +33068,7 @@ function processChildren(parent, context, asFragment = false, disableNestedFragm
33068
33068
  for (let i = 0; i < children.length; i++) {
33069
33069
  const child = children[i];
33070
33070
  switch (child.type) {
33071
- case "element":
33071
+ case 1:
33072
33072
  switch (child.tagType) {
33073
33073
  case 0:
33074
33074
  ssrProcessElement(child, context);
@@ -33092,10 +33092,10 @@ function processChildren(parent, context, asFragment = false, disableNestedFragm
33092
33092
  return exhaustiveCheck2;
33093
33093
  }
33094
33094
  break;
33095
- case "text":
33095
+ case 2:
33096
33096
  context.pushStringPart(escapeHtml(child.content));
33097
33097
  break;
33098
- case "comment":
33098
+ case 3:
33099
33099
  context.pushStringPart(`<!--${child.content}-->`);
33100
33100
  break;
33101
33101
  case 5:
@@ -33274,13 +33274,13 @@ const ssrTransformShow = (dir, node, context) => {
33274
33274
  };
33275
33275
  };
33276
33276
 
33277
- const filterChild = (node) => node.children.filter((n) => n.type !== "comment");
33277
+ const filterChild = (node) => node.children.filter((n) => n.type !== 3);
33278
33278
  const hasSingleChild = (node) => filterChild(node).length === 1;
33279
33279
  const ssrInjectFallthroughAttrs = (node, context) => {
33280
33280
  if (node.type === 0) {
33281
33281
  context.identifiers._attrs = 1;
33282
33282
  }
33283
- if (node.type === "element" && node.tagType === 1 && (isBuiltInType(node.tag, "Transition") || isBuiltInType(node.tag, "KeepAlive"))) {
33283
+ if (node.type === 1 && node.tagType === 1 && (isBuiltInType(node.tag, "Transition") || isBuiltInType(node.tag, "KeepAlive"))) {
33284
33284
  const rootChildren = filterChild(context.root);
33285
33285
  if (rootChildren.length === 1 && rootChildren[0] === node) {
33286
33286
  if (hasSingleChild(node)) {
@@ -33296,14 +33296,14 @@ const ssrInjectFallthroughAttrs = (node, context) => {
33296
33296
  if (node.type === 10 && hasSingleChild(node)) {
33297
33297
  let hasEncounteredIf = false;
33298
33298
  for (const c of filterChild(parent)) {
33299
- if (c.type === 9 || c.type === "element" && findDir(c, "if")) {
33299
+ if (c.type === 9 || c.type === 1 && findDir(c, "if")) {
33300
33300
  if (hasEncounteredIf)
33301
33301
  return;
33302
33302
  hasEncounteredIf = true;
33303
33303
  } else if (
33304
33304
  // node before v-if
33305
33305
  !hasEncounteredIf || // non else nodes
33306
- !(c.type === "element" && findDir(c, /else/, true))
33306
+ !(c.type === 1 && findDir(c, /else/, true))
33307
33307
  ) {
33308
33308
  return;
33309
33309
  }
@@ -33314,7 +33314,7 @@ const ssrInjectFallthroughAttrs = (node, context) => {
33314
33314
  }
33315
33315
  };
33316
33316
  function injectFallthroughAttrs(node) {
33317
- if (node.type === "element" && (node.tagType === 0 || node.tagType === 1) && !findDir(node, "for")) {
33317
+ if (node.type === 1 && (node.tagType === 0 || node.tagType === 1) && !findDir(node, "for")) {
33318
33318
  node.props.push({
33319
33319
  type: 7,
33320
33320
  name: "bind",
@@ -33346,10 +33346,10 @@ const ssrInjectCssVars = (node, context) => {
33346
33346
  }
33347
33347
  };
33348
33348
  function injectCssVars(node) {
33349
- if (node.type === "element" && (node.tagType === 0 || node.tagType === 1) && !findDir(node, "for")) {
33349
+ if (node.type === 1 && (node.tagType === 0 || node.tagType === 1) && !findDir(node, "for")) {
33350
33350
  if (isBuiltInType(node.tag, "Suspense")) {
33351
33351
  for (const child of node.children) {
33352
- if (child.type === "element" && child.tagType === 3) {
33352
+ if (child.type === 1 && child.tagType === 3) {
33353
33353
  child.children.forEach(injectCssVars);
33354
33354
  } else {
33355
33355
  injectCssVars(child);
@@ -35841,7 +35841,7 @@ function resolveTemplateUsageCheckString(sfc) {
35841
35841
  transform$1(createRoot([ast]), {
35842
35842
  nodeTransforms: [
35843
35843
  (node) => {
35844
- if (node.type === "element") {
35844
+ if (node.type === 1) {
35845
35845
  if (!parserOptions.isNativeTag(node.tag) && !parserOptions.isBuiltInComponent(node.tag)) {
35846
35846
  code += `,${camelize(node.tag)},${capitalize$1(camelize(node.tag))}`;
35847
35847
  }
@@ -35998,7 +35998,7 @@ function parse$5(source, {
35998
35998
  }
35999
35999
  });
36000
36000
  ast.children.forEach((node) => {
36001
- if (node.type !== "element") {
36001
+ if (node.type !== 1) {
36002
36002
  return;
36003
36003
  }
36004
36004
  if (ignoreEmpty && node.tag !== "template" && isEmpty(node) && !hasSrc(node)) {
@@ -36221,7 +36221,7 @@ function hasSrc(node) {
36221
36221
  function isEmpty(node) {
36222
36222
  for (let i = 0; i < node.children.length; i++) {
36223
36223
  const child = node.children[i];
36224
- if (child.type !== "text" || child.content.trim() !== "") {
36224
+ if (child.type !== 2 || child.content.trim() !== "") {
36225
36225
  return false;
36226
36226
  }
36227
36227
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/compiler-sfc",
3
- "version": "3.3.0-alpha.2",
3
+ "version": "3.3.0-alpha.4",
4
4
  "description": "@vue/compiler-sfc",
5
5
  "main": "dist/compiler-sfc.cjs.js",
6
6
  "module": "dist/compiler-sfc.esm-browser.js",
@@ -33,11 +33,11 @@
33
33
  "homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-sfc#readme",
34
34
  "dependencies": {
35
35
  "@babel/parser": "^7.20.15",
36
- "@vue/compiler-core": "3.3.0-alpha.2",
37
- "@vue/compiler-dom": "3.3.0-alpha.2",
38
- "@vue/compiler-ssr": "3.3.0-alpha.2",
39
- "@vue/reactivity-transform": "3.3.0-alpha.2",
40
- "@vue/shared": "3.3.0-alpha.2",
36
+ "@vue/compiler-core": "3.3.0-alpha.4",
37
+ "@vue/compiler-dom": "3.3.0-alpha.4",
38
+ "@vue/compiler-ssr": "3.3.0-alpha.4",
39
+ "@vue/reactivity-transform": "3.3.0-alpha.4",
40
+ "@vue/shared": "3.3.0-alpha.4",
41
41
  "estree-walker": "^2.0.2",
42
42
  "magic-string": "^0.27.0",
43
43
  "source-map": "^0.6.1",