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

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.
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var shared = require('@vue/shared');
6
6
  var parser = require('@babel/parser');
7
- var sourceMap = require('source-map');
7
+ var sourceMapJs = require('source-map-js');
8
8
  var estreeWalker = require('estree-walker');
9
9
 
10
10
  function defaultOnError(error) {
@@ -342,6 +342,20 @@ function createReturnStatement(returns) {
342
342
  loc: locStub
343
343
  };
344
344
  }
345
+ function getVNodeHelper(ssr, isComponent) {
346
+ return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE;
347
+ }
348
+ function getVNodeBlockHelper(ssr, isComponent) {
349
+ return ssr || isComponent ? CREATE_BLOCK : CREATE_ELEMENT_BLOCK;
350
+ }
351
+ function convertToBlock(node, { helper, removeHelper, inSSR }) {
352
+ if (!node.isBlock) {
353
+ node.isBlock = true;
354
+ removeHelper(getVNodeHelper(inSSR, node.isComponent));
355
+ helper(OPEN_BLOCK);
356
+ helper(getVNodeBlockHelper(inSSR, node.isComponent));
357
+ }
358
+ }
345
359
 
346
360
  const isStaticExp = (p) => p.type === 4 && p.isStatic;
347
361
  const isBuiltInType = (tag, expected) => tag === expected || tag === shared.hyphenate(expected);
@@ -513,22 +527,16 @@ function hasDynamicKeyVBind(node) {
513
527
  );
514
528
  }
515
529
  function isText$1(node) {
516
- return node.type === 5 || node.type === "text";
530
+ return node.type === 5 || node.type === 2;
517
531
  }
518
532
  function isVSlot(p) {
519
533
  return p.type === 7 && p.name === "slot";
520
534
  }
521
535
  function isTemplateNode(node) {
522
- return node.type === "element" && node.tagType === 3;
536
+ return node.type === 1 && node.tagType === 3;
523
537
  }
524
538
  function isSlotOutlet(node) {
525
- return node.type === "element" && node.tagType === 2;
526
- }
527
- function getVNodeHelper(ssr, isComponent) {
528
- return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE;
529
- }
530
- function getVNodeBlockHelper(ssr, isComponent) {
531
- return ssr || isComponent ? CREATE_BLOCK : CREATE_ELEMENT_BLOCK;
539
+ return node.type === 1 && node.tagType === 2;
532
540
  }
533
541
  const propsHelperSet = /* @__PURE__ */ new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROPS]);
534
542
  function getUnnormalizedProps(props, callPath = []) {
@@ -621,7 +629,7 @@ function hasScopeRef(node, ids) {
621
629
  return false;
622
630
  }
623
631
  switch (node.type) {
624
- case "element":
632
+ case 1:
625
633
  for (let i = 0; i < node.props.length; i++) {
626
634
  const p = node.props[i];
627
635
  if (p.type === 7 && (hasScopeRef(p.arg, ids) || hasScopeRef(p.exp, ids))) {
@@ -648,8 +656,8 @@ function hasScopeRef(node, ids) {
648
656
  case 5:
649
657
  case 12:
650
658
  return hasScopeRef(node.content, ids);
651
- case "text":
652
- case "comment":
659
+ case 2:
660
+ case 3:
653
661
  return false;
654
662
  default:
655
663
  return false;
@@ -662,14 +670,6 @@ function getMemoedVNodeCall(node) {
662
670
  return node;
663
671
  }
664
672
  }
665
- function makeBlock(node, { helper, removeHelper, inSSR }) {
666
- if (!node.isBlock) {
667
- node.isBlock = true;
668
- removeHelper(getVNodeHelper(inSSR, node.isComponent));
669
- helper(OPEN_BLOCK);
670
- helper(getVNodeBlockHelper(inSSR, node.isComponent));
671
- }
672
- }
673
673
 
674
674
  const deprecationData = {
675
675
  ["COMPILER_IS_ON_ELEMENT"]: {
@@ -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:
@@ -1959,7 +1959,7 @@ function createRootCodegen(root, context) {
1959
1959
  if (isSingleElementRoot(root, child) && child.codegenNode) {
1960
1960
  const codegenNode = child.codegenNode;
1961
1961
  if (codegenNode.type === 13) {
1962
- makeBlock(codegenNode, context);
1962
+ convertToBlock(codegenNode, context);
1963
1963
  }
1964
1964
  root.codegenNode = codegenNode;
1965
1965
  } else {
@@ -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;
@@ -2079,7 +2079,7 @@ const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
2079
2079
  function createCodegenContext(ast, {
2080
2080
  mode = "function",
2081
2081
  prefixIdentifiers = mode === "module",
2082
- sourceMap: sourceMap$1 = false,
2082
+ sourceMap = false,
2083
2083
  filename = `template.vue.html`,
2084
2084
  scopeId = null,
2085
2085
  optimizeImports = false,
@@ -2093,7 +2093,7 @@ function createCodegenContext(ast, {
2093
2093
  const context = {
2094
2094
  mode,
2095
2095
  prefixIdentifiers,
2096
- sourceMap: sourceMap$1,
2096
+ sourceMap,
2097
2097
  filename,
2098
2098
  scopeId,
2099
2099
  optimizeImports,
@@ -2165,8 +2165,8 @@ function createCodegenContext(ast, {
2165
2165
  }
2166
2166
  });
2167
2167
  }
2168
- if (sourceMap$1) {
2169
- context.map = new sourceMap.SourceMapGenerator();
2168
+ if (sourceMap) {
2169
+ context.map = new sourceMapJs.SourceMapGenerator();
2170
2170
  context.map.setSourceContent(filename, context.source);
2171
2171
  }
2172
2172
  return context;
@@ -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:
@@ -2827,7 +2827,7 @@ function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [
2827
2827
  estreeWalker.walk(root, {
2828
2828
  enter(node, parent) {
2829
2829
  parent && parentStack.push(parent);
2830
- if (parent && parent.type.startsWith("TS") && parent.type !== "TSAsExpression" && parent.type !== "TSNonNullExpression" && parent.type !== "TSTypeAssertion") {
2830
+ if (parent && parent.type.startsWith("TS") && !TS_NODE_TYPES.includes(parent.type)) {
2831
2831
  return this.skip();
2832
2832
  }
2833
2833
  if (node.type === "Identifier") {
@@ -3058,6 +3058,18 @@ function isReferenced(node, parent, grandparent) {
3058
3058
  }
3059
3059
  return true;
3060
3060
  }
3061
+ const TS_NODE_TYPES = [
3062
+ "TSAsExpression",
3063
+ // foo as number
3064
+ "TSTypeAssertion",
3065
+ // (<number>foo)
3066
+ "TSNonNullExpression",
3067
+ // foo!
3068
+ "TSInstantiationExpression",
3069
+ // foo<string>
3070
+ "TSSatisfiesExpression"
3071
+ // foo satisfies T
3072
+ ];
3061
3073
 
3062
3074
  const isLiteralWhitelisted = /* @__PURE__ */ shared.makeMap("true,false,null,this");
3063
3075
  const transformExpression = (node, context) => {
@@ -3066,7 +3078,7 @@ const transformExpression = (node, context) => {
3066
3078
  node.content,
3067
3079
  context
3068
3080
  );
3069
- } else if (node.type === "element") {
3081
+ } else if (node.type === 1) {
3070
3082
  for (let i = 0; i < node.props.length; i++) {
3071
3083
  const dir = node.props[i];
3072
3084
  if (dir.type === 7 && dir.name !== "for") {
@@ -3098,7 +3110,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
3098
3110
  const isAssignmentLVal = parent && parent.type === "AssignmentExpression" && parent.left === id;
3099
3111
  const isUpdateArg = parent && parent.type === "UpdateExpression" && parent.argument === id;
3100
3112
  const isDestructureAssignment = parent && isInDestructureAssignment(parent, parentStack);
3101
- if (type === "setup-const" || type === "setup-reactive-const" || localVars[raw]) {
3113
+ if (isConst(type) || type === "setup-reactive-const" || localVars[raw]) {
3102
3114
  return raw;
3103
3115
  } else if (type === "setup-ref") {
3104
3116
  return `${raw}.value`;
@@ -3142,6 +3154,8 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
3142
3154
  return `$setup.${raw}`;
3143
3155
  } else if (type === "props-aliased") {
3144
3156
  return `$props['${bindingMetadata.__propsAliases[raw]}']`;
3157
+ } else if (type === "literal-const") {
3158
+ return raw;
3145
3159
  } else if (type) {
3146
3160
  return `$${type}.${raw}`;
3147
3161
  }
@@ -3155,7 +3169,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
3155
3169
  const isAllowedGlobal = shared.isGloballyWhitelisted(rawExp);
3156
3170
  const isLiteral = isLiteralWhitelisted(rawExp);
3157
3171
  if (!asParams && !isScopeVarReference && !isAllowedGlobal && !isLiteral) {
3158
- if (bindingMetadata[node.content] === "setup-const") {
3172
+ if (isConst(bindingMetadata[node.content])) {
3159
3173
  node.constType = 1;
3160
3174
  }
3161
3175
  node.content = rewriteIdentifier(rawExp);
@@ -3271,6 +3285,9 @@ function stringifyExpression(exp) {
3271
3285
  return exp.children.map(stringifyExpression).join("");
3272
3286
  }
3273
3287
  }
3288
+ function isConst(type) {
3289
+ return type === "setup-const" || type === "literal-const";
3290
+ }
3274
3291
 
3275
3292
  const transformIf = createStructuralDirectiveTransform(
3276
3293
  /^(if|else|else-if)$/,
@@ -3332,12 +3349,12 @@ function processIf(node, dir, context, processCodegen) {
3332
3349
  let i = siblings.indexOf(node);
3333
3350
  while (i-- >= -1) {
3334
3351
  const sibling = siblings[i];
3335
- if (sibling && sibling.type === "comment") {
3352
+ if (sibling && sibling.type === 3) {
3336
3353
  context.removeNode(sibling);
3337
3354
  comments.unshift(sibling);
3338
3355
  continue;
3339
3356
  }
3340
- if (sibling && sibling.type === "text" && !sibling.content.trim().length) {
3357
+ if (sibling && sibling.type === 2 && !sibling.content.trim().length) {
3341
3358
  context.removeNode(sibling);
3342
3359
  continue;
3343
3360
  }
@@ -3350,7 +3367,7 @@ function processIf(node, dir, context, processCodegen) {
3350
3367
  context.removeNode();
3351
3368
  const branch = createIfBranch(node, dir);
3352
3369
  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"))) {
3370
+ !(context.parent && context.parent.type === 1 && isBuiltInType(context.parent.tag, "transition"))) {
3354
3371
  branch.children = [...comments, ...branch.children];
3355
3372
  }
3356
3373
  {
@@ -3423,7 +3440,7 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
3423
3440
  );
3424
3441
  const { children } = branch;
3425
3442
  const firstChild = children[0];
3426
- const needFragmentWrapper = children.length !== 1 || firstChild.type !== "element";
3443
+ const needFragmentWrapper = children.length !== 1 || firstChild.type !== 1;
3427
3444
  if (needFragmentWrapper) {
3428
3445
  if (children.length === 1 && firstChild.type === 11) {
3429
3446
  const vnodeCall = firstChild.codegenNode;
@@ -3432,7 +3449,7 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
3432
3449
  } else {
3433
3450
  let patchFlag = 64;
3434
3451
  let patchFlagText = shared.PatchFlagNames[64];
3435
- if (!branch.isTemplateIf && children.filter((c) => c.type !== "comment").length === 1) {
3452
+ if (!branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) {
3436
3453
  patchFlag |= 2048;
3437
3454
  patchFlagText += `, ${shared.PatchFlagNames[2048]}`;
3438
3455
  }
@@ -3454,7 +3471,7 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
3454
3471
  const ret = firstChild.codegenNode;
3455
3472
  const vnodeCall = getMemoedVNodeCall(ret);
3456
3473
  if (vnodeCall.type === 13) {
3457
- makeBlock(vnodeCall, context);
3474
+ convertToBlock(vnodeCall, context);
3458
3475
  }
3459
3476
  injectProp(vnodeCall, keyProperty, context);
3460
3477
  return ret;
@@ -3541,7 +3558,7 @@ const transformFor = createStructuralDirectiveTransform(
3541
3558
  const { children } = forNode;
3542
3559
  if (isTemplate) {
3543
3560
  node.children.some((c) => {
3544
- if (c.type === "element") {
3561
+ if (c.type === 1) {
3545
3562
  const key = findProp(c, "key");
3546
3563
  if (key) {
3547
3564
  context.onError(
@@ -3555,7 +3572,7 @@ const transformFor = createStructuralDirectiveTransform(
3555
3572
  }
3556
3573
  });
3557
3574
  }
3558
- const needFragmentWrapper = children.length !== 1 || children[0].type !== "element";
3575
+ const needFragmentWrapper = children.length !== 1 || children[0].type !== 1;
3559
3576
  const slotOutlet = isSlotOutlet(node) ? node : isTemplate && node.children.length === 1 && isSlotOutlet(node.children[0]) ? node.children[0] : null;
3560
3577
  if (slotOutlet) {
3561
3578
  childBlock = slotOutlet.codegenNode;
@@ -3775,7 +3792,7 @@ function createParamsList(args) {
3775
3792
 
3776
3793
  const defaultFallback = createSimpleExpression(`undefined`, false);
3777
3794
  const trackSlotScopes = (node, context) => {
3778
- if (node.type === "element" && (node.tagType === 1 || node.tagType === 3)) {
3795
+ if (node.type === 1 && (node.tagType === 1 || node.tagType === 3)) {
3779
3796
  const vSlot = findDir(node, "slot");
3780
3797
  if (vSlot) {
3781
3798
  const slotProps = vSlot.exp;
@@ -3851,7 +3868,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
3851
3868
  const slotElement = children[i];
3852
3869
  let slotDir;
3853
3870
  if (!isTemplateNode(slotElement) || !(slotDir = findDir(slotElement, "slot", true))) {
3854
- if (slotElement.type !== "comment") {
3871
+ if (slotElement.type !== 3) {
3855
3872
  implicitDefaultChildren.push(slotElement);
3856
3873
  }
3857
3874
  continue;
@@ -3898,7 +3915,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
3898
3915
  let prev;
3899
3916
  while (j--) {
3900
3917
  prev = children[j];
3901
- if (prev.type !== "comment") {
3918
+ if (prev.type !== 3) {
3902
3919
  break;
3903
3920
  }
3904
3921
  }
@@ -4032,7 +4049,7 @@ function hasForwardedSlots(children) {
4032
4049
  for (let i = 0; i < children.length; i++) {
4033
4050
  const child = children[i];
4034
4051
  switch (child.type) {
4035
- case "element":
4052
+ case 1:
4036
4053
  if (child.tagType === 2 || hasForwardedSlots(child.children)) {
4037
4054
  return true;
4038
4055
  }
@@ -4051,16 +4068,16 @@ function hasForwardedSlots(children) {
4051
4068
  return false;
4052
4069
  }
4053
4070
  function isNonWhitespaceContent(node) {
4054
- if (node.type !== "text" && node.type !== 12)
4071
+ if (node.type !== 2 && node.type !== 12)
4055
4072
  return true;
4056
- return node.type === "text" ? !!node.content.trim() : isNonWhitespaceContent(node.content);
4073
+ return node.type === 2 ? !!node.content.trim() : isNonWhitespaceContent(node.content);
4057
4074
  }
4058
4075
 
4059
4076
  const directiveImportMap = /* @__PURE__ */ new WeakMap();
4060
4077
  const transformElement = (node, context) => {
4061
4078
  return function postTransformElement() {
4062
4079
  node = context.currentNode;
4063
- if (!(node.type === "element" && (node.tagType === 0 || node.tagType === 1))) {
4080
+ if (!(node.type === 1 && (node.tagType === 0 || node.tagType === 1))) {
4064
4081
  return;
4065
4082
  }
4066
4083
  const { tag, props } = node;
@@ -4131,7 +4148,7 @@ const transformElement = (node, context) => {
4131
4148
  if (hasDynamicTextChild && getConstantType(child, context) === 0) {
4132
4149
  patchFlag |= 1;
4133
4150
  }
4134
- if (hasDynamicTextChild || type === "text") {
4151
+ if (hasDynamicTextChild || type === 2) {
4135
4152
  vnodeChildren = child;
4136
4153
  } else {
4137
4154
  vnodeChildren = node.children;
@@ -4239,7 +4256,7 @@ function resolveSetupReference(name, context) {
4239
4256
  return PascalName;
4240
4257
  }
4241
4258
  };
4242
- const fromConst = checkType("setup-const") || checkType("setup-reactive-const");
4259
+ const fromConst = checkType("setup-const") || checkType("setup-reactive-const") || checkType("literal-const");
4243
4260
  if (fromConst) {
4244
4261
  return context.inline ? (
4245
4262
  // in inline mode, const setup bindings (e.g. imports) can be used as-is
@@ -4903,7 +4920,7 @@ const injectPrefix = (arg, prefix) => {
4903
4920
  };
4904
4921
 
4905
4922
  const transformText = (node, context) => {
4906
- if (node.type === 0 || node.type === "element" || node.type === 11 || node.type === 10) {
4923
+ if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
4907
4924
  return () => {
4908
4925
  const children = node.children;
4909
4926
  let currentContainer = void 0;
@@ -4935,7 +4952,7 @@ const transformText = (node, context) => {
4935
4952
  // as-is since the runtime has dedicated fast path for this by directly
4936
4953
  // setting textContent of the element.
4937
4954
  // for component root it's always normalized anyway.
4938
- children.length === 1 && (node.type === 0 || node.type === "element" && node.tagType === 0 && // #3756
4955
+ children.length === 1 && (node.type === 0 || node.type === 1 && node.tagType === 0 && // #3756
4939
4956
  // custom directives can potentially add DOM elements arbitrarily,
4940
4957
  // we need to avoid setting textContent of the element at runtime
4941
4958
  // to avoid accidentally overwriting the DOM elements added
@@ -4952,7 +4969,7 @@ const transformText = (node, context) => {
4952
4969
  const child = children[i];
4953
4970
  if (isText$1(child) || child.type === 8) {
4954
4971
  const callArgs = [];
4955
- if (child.type !== "text" || child.content !== " ") {
4972
+ if (child.type !== 2 || child.content !== " ") {
4956
4973
  callArgs.push(child);
4957
4974
  }
4958
4975
  if (!context.ssr && getConstantType(child, context) === 0) {
@@ -4977,8 +4994,8 @@ const transformText = (node, context) => {
4977
4994
 
4978
4995
  const seen$1 = /* @__PURE__ */ new WeakSet();
4979
4996
  const transformOnce = (node, context) => {
4980
- if (node.type === "element" && findDir(node, "once", true)) {
4981
- if (seen$1.has(node) || context.inVOnce) {
4997
+ if (node.type === 1 && findDir(node, "once", true)) {
4998
+ if (seen$1.has(node) || context.inVOnce || context.inSSR) {
4982
4999
  return;
4983
5000
  }
4984
5001
  seen$1.add(node);
@@ -5090,7 +5107,7 @@ const transformFilter = (node, context) => {
5090
5107
  if (node.type === 5) {
5091
5108
  rewriteFilter(node.content, context);
5092
5109
  }
5093
- if (node.type === "element") {
5110
+ if (node.type === 1) {
5094
5111
  node.props.forEach((prop) => {
5095
5112
  if (prop.type === 7 && prop.name !== "for" && prop.exp) {
5096
5113
  rewriteFilter(prop.exp, context);
@@ -5231,7 +5248,7 @@ function wrapFilter(exp, filter, context) {
5231
5248
 
5232
5249
  const seen = /* @__PURE__ */ new WeakSet();
5233
5250
  const transformMemo = (node, context) => {
5234
- if (node.type === "element") {
5251
+ if (node.type === 1) {
5235
5252
  const dir = findDir(node, "memo");
5236
5253
  if (!dir || seen.has(node)) {
5237
5254
  return;
@@ -5241,7 +5258,7 @@ const transformMemo = (node, context) => {
5241
5258
  const codegenNode = node.codegenNode || context.currentNode.codegenNode;
5242
5259
  if (codegenNode && codegenNode.type === 13) {
5243
5260
  if (node.tagType !== 1) {
5244
- makeBlock(codegenNode, context);
5261
+ convertToBlock(codegenNode, context);
5245
5262
  }
5246
5263
  node.codegenNode = createCallExpression(context.helper(WITH_MEMO), [
5247
5264
  dir.exp,
@@ -5360,6 +5377,7 @@ exports.TELEPORT = TELEPORT;
5360
5377
  exports.TO_DISPLAY_STRING = TO_DISPLAY_STRING;
5361
5378
  exports.TO_HANDLERS = TO_HANDLERS;
5362
5379
  exports.TO_HANDLER_KEY = TO_HANDLER_KEY;
5380
+ exports.TS_NODE_TYPES = TS_NODE_TYPES;
5363
5381
  exports.UNREF = UNREF;
5364
5382
  exports.WITH_CTX = WITH_CTX;
5365
5383
  exports.WITH_DIRECTIVES = WITH_DIRECTIVES;
@@ -5373,6 +5391,7 @@ exports.buildDirectiveArgs = buildDirectiveArgs;
5373
5391
  exports.buildProps = buildProps;
5374
5392
  exports.buildSlots = buildSlots;
5375
5393
  exports.checkCompatEnabled = checkCompatEnabled;
5394
+ exports.convertToBlock = convertToBlock;
5376
5395
  exports.createArrayExpression = createArrayExpression;
5377
5396
  exports.createAssignmentExpression = createAssignmentExpression;
5378
5397
  exports.createBlockStatement = createBlockStatement;
@@ -5427,7 +5446,6 @@ exports.isTemplateNode = isTemplateNode;
5427
5446
  exports.isText = isText$1;
5428
5447
  exports.isVSlot = isVSlot;
5429
5448
  exports.locStub = locStub;
5430
- exports.makeBlock = makeBlock;
5431
5449
  exports.noopDirectiveTransform = noopDirectiveTransform;
5432
5450
  exports.processExpression = processExpression;
5433
5451
  exports.processFor = processFor;