vue 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.
@@ -8944,7 +8944,7 @@ function isMemoSame(cached, memo) {
8944
8944
  return true;
8945
8945
  }
8946
8946
 
8947
- const version = "3.3.0-alpha.2";
8947
+ const version = "3.3.0-alpha.4";
8948
8948
  const ssrUtils = null;
8949
8949
  const resolveFilter = null;
8950
8950
  const compatUtils = null;
@@ -11023,16 +11023,16 @@ function hasDynamicKeyVBind(node) {
11023
11023
  );
11024
11024
  }
11025
11025
  function isText$1(node) {
11026
- return node.type === 5 || node.type === "text";
11026
+ return node.type === 5 || node.type === 2;
11027
11027
  }
11028
11028
  function isVSlot(p) {
11029
11029
  return p.type === 7 && p.name === "slot";
11030
11030
  }
11031
11031
  function isTemplateNode(node) {
11032
- return node.type === "element" && node.tagType === 3;
11032
+ return node.type === 1 && node.tagType === 3;
11033
11033
  }
11034
11034
  function isSlotOutlet(node) {
11035
- return node.type === "element" && node.tagType === 2;
11035
+ return node.type === 1 && node.tagType === 2;
11036
11036
  }
11037
11037
  function getVNodeHelper(ssr, isComponent) {
11038
11038
  return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE;
@@ -11266,12 +11266,12 @@ function parseChildren(context, mode, ancestors) {
11266
11266
  const shouldCondense = context.options.whitespace !== "preserve";
11267
11267
  for (let i = 0; i < nodes.length; i++) {
11268
11268
  const node = nodes[i];
11269
- if (node.type === "text") {
11269
+ if (node.type === 2) {
11270
11270
  if (!context.inPre) {
11271
11271
  if (!/[^\t\r\n\f ]/.test(node.content)) {
11272
11272
  const prev = nodes[i - 1];
11273
11273
  const next = nodes[i + 1];
11274
- 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))) {
11274
+ 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))) {
11275
11275
  removedWhitespace = true;
11276
11276
  nodes[i] = null;
11277
11277
  } else {
@@ -11283,14 +11283,14 @@ function parseChildren(context, mode, ancestors) {
11283
11283
  } else {
11284
11284
  node.content = node.content.replace(/\r\n/g, "\n");
11285
11285
  }
11286
- } else if (node.type === "comment" && !context.options.comments) {
11286
+ } else if (node.type === 3 && !context.options.comments) {
11287
11287
  removedWhitespace = true;
11288
11288
  nodes[i] = null;
11289
11289
  }
11290
11290
  }
11291
11291
  if (context.inPre && parent && context.options.isPreTag(parent.tag)) {
11292
11292
  const first = nodes[0];
11293
- if (first && first.type === "text") {
11293
+ if (first && first.type === 2) {
11294
11294
  first.content = first.content.replace(/^\r?\n/, "");
11295
11295
  }
11296
11296
  }
@@ -11298,9 +11298,9 @@ function parseChildren(context, mode, ancestors) {
11298
11298
  return removedWhitespace ? nodes.filter(Boolean) : nodes;
11299
11299
  }
11300
11300
  function pushNode(nodes, node) {
11301
- if (node.type === "text") {
11301
+ if (node.type === 2) {
11302
11302
  const prev = last(nodes);
11303
- if (prev && prev.type === "text" && prev.loc.end.offset === node.loc.start.offset) {
11303
+ if (prev && prev.type === 2 && prev.loc.end.offset === node.loc.start.offset) {
11304
11304
  prev.content += node.content;
11305
11305
  prev.loc.end = node.loc.end;
11306
11306
  prev.loc.source += node.loc.source;
@@ -11347,7 +11347,7 @@ function parseComment(context) {
11347
11347
  advanceBy(context, match.index + match[0].length - prevIndex + 1);
11348
11348
  }
11349
11349
  return {
11350
- type: "comment",
11350
+ type: 3,
11351
11351
  content,
11352
11352
  loc: getSelection(context, start)
11353
11353
  };
@@ -11365,7 +11365,7 @@ function parseBogusComment(context) {
11365
11365
  advanceBy(context, closeIndex + 1);
11366
11366
  }
11367
11367
  return {
11368
- type: "comment",
11368
+ type: 3,
11369
11369
  content,
11370
11370
  loc: getSelection(context, start)
11371
11371
  };
@@ -11466,7 +11466,7 @@ function parseTag(context, type, parent) {
11466
11466
  }
11467
11467
  }
11468
11468
  return {
11469
- type: "element",
11469
+ type: 1,
11470
11470
  ns,
11471
11471
  tag,
11472
11472
  tagType,
@@ -11644,7 +11644,7 @@ function parseAttribute(context, nameSet) {
11644
11644
  type: 6,
11645
11645
  name,
11646
11646
  value: value && {
11647
- type: "text",
11647
+ type: 2,
11648
11648
  content: value.content,
11649
11649
  loc: value.loc
11650
11650
  },
@@ -11734,7 +11734,7 @@ function parseText(context, mode) {
11734
11734
  const start = getCursor(context);
11735
11735
  const content = parseTextData(context, endIndex, mode);
11736
11736
  return {
11737
- type: "text",
11737
+ type: 2,
11738
11738
  content,
11739
11739
  loc: getSelection(context, start)
11740
11740
  };
@@ -11843,7 +11843,7 @@ function hoistStatic(root, context) {
11843
11843
  }
11844
11844
  function isSingleElementRoot(root, child) {
11845
11845
  const { children } = root;
11846
- return children.length === 1 && child.type === "element" && !isSlotOutlet(child);
11846
+ return children.length === 1 && child.type === 1 && !isSlotOutlet(child);
11847
11847
  }
11848
11848
  function walk(node, context, doNotHoistNode = false) {
11849
11849
  const { children } = node;
@@ -11851,7 +11851,7 @@ function walk(node, context, doNotHoistNode = false) {
11851
11851
  let hoistedCount = 0;
11852
11852
  for (let i = 0; i < children.length; i++) {
11853
11853
  const child = children[i];
11854
- if (child.type === "element" && child.tagType === 0) {
11854
+ if (child.type === 1 && child.tagType === 0) {
11855
11855
  const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
11856
11856
  if (constantType > 0) {
11857
11857
  if (constantType >= 2) {
@@ -11876,7 +11876,7 @@ function walk(node, context, doNotHoistNode = false) {
11876
11876
  }
11877
11877
  }
11878
11878
  }
11879
- if (child.type === "element") {
11879
+ if (child.type === 1) {
11880
11880
  const isComponent = child.tagType === 1;
11881
11881
  if (isComponent) {
11882
11882
  context.scopes.vSlot++;
@@ -11900,7 +11900,7 @@ function walk(node, context, doNotHoistNode = false) {
11900
11900
  if (hoistedCount && context.transformHoist) {
11901
11901
  context.transformHoist(children, context, node);
11902
11902
  }
11903
- if (hoistedCount && hoistedCount === originalCount && node.type === "element" && node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
11903
+ if (hoistedCount && hoistedCount === originalCount && node.type === 1 && node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
11904
11904
  node.codegenNode.children = context.hoist(
11905
11905
  createArrayExpression(node.codegenNode.children)
11906
11906
  );
@@ -11909,7 +11909,7 @@ function walk(node, context, doNotHoistNode = false) {
11909
11909
  function getConstantType(node, context) {
11910
11910
  const { constantCache } = context;
11911
11911
  switch (node.type) {
11912
- case "element":
11912
+ case 1:
11913
11913
  if (node.tagType !== 0) {
11914
11914
  return 0;
11915
11915
  }
@@ -11981,8 +11981,8 @@ function getConstantType(node, context) {
11981
11981
  constantCache.set(node, 0);
11982
11982
  return 0;
11983
11983
  }
11984
- case "text":
11985
- case "comment":
11984
+ case 2:
11985
+ case 3:
11986
11986
  return 3;
11987
11987
  case 9:
11988
11988
  case 11:
@@ -12250,7 +12250,7 @@ function createRootCodegen(root, context) {
12250
12250
  } else if (children.length > 1) {
12251
12251
  let patchFlag = 64;
12252
12252
  let patchFlagText = PatchFlagNames[64];
12253
- if (children.filter((c) => c.type !== "comment").length === 1) {
12253
+ if (children.filter((c) => c.type !== 3).length === 1) {
12254
12254
  patchFlag |= 2048;
12255
12255
  patchFlagText += `, ${PatchFlagNames[2048]}`;
12256
12256
  }
@@ -12304,7 +12304,7 @@ function traverseNode(node, context) {
12304
12304
  }
12305
12305
  }
12306
12306
  switch (node.type) {
12307
- case "comment":
12307
+ case 3:
12308
12308
  if (!context.ssr) {
12309
12309
  context.helper(CREATE_COMMENT);
12310
12310
  }
@@ -12321,7 +12321,7 @@ function traverseNode(node, context) {
12321
12321
  break;
12322
12322
  case 10:
12323
12323
  case 11:
12324
- case "element":
12324
+ case 1:
12325
12325
  case 0:
12326
12326
  traverseChildren(node, context);
12327
12327
  break;
@@ -12335,7 +12335,7 @@ function traverseNode(node, context) {
12335
12335
  function createStructuralDirectiveTransform(name, fn) {
12336
12336
  const matches = isString(name) ? (n) => n === name : (n) => name.test(n);
12337
12337
  return (node, context) => {
12338
- if (node.type === "element") {
12338
+ if (node.type === 1) {
12339
12339
  const { props } = node;
12340
12340
  if (node.tagType === 3 && props.some(isVSlot)) {
12341
12341
  return;
@@ -12573,7 +12573,7 @@ function genHoists(hoists, context) {
12573
12573
  context.pure = false;
12574
12574
  }
12575
12575
  function isText(n) {
12576
- return isString(n) || n.type === 4 || n.type === "text" || n.type === 5 || n.type === 8;
12576
+ return isString(n) || n.type === 4 || n.type === 2 || n.type === 5 || n.type === 8;
12577
12577
  }
12578
12578
  function genNodeListAsArray(nodes, context) {
12579
12579
  const multilines = nodes.length > 3 || nodes.some((n) => isArray(n) || !isText(n));
@@ -12614,7 +12614,7 @@ function genNode(node, context) {
12614
12614
  return;
12615
12615
  }
12616
12616
  switch (node.type) {
12617
- case "element":
12617
+ case 1:
12618
12618
  case 9:
12619
12619
  case 11:
12620
12620
  assert(
@@ -12623,7 +12623,7 @@ function genNode(node, context) {
12623
12623
  );
12624
12624
  genNode(node.codegenNode, context);
12625
12625
  break;
12626
- case "text":
12626
+ case 2:
12627
12627
  genText(node, context);
12628
12628
  break;
12629
12629
  case 4:
@@ -12638,7 +12638,7 @@ function genNode(node, context) {
12638
12638
  case 8:
12639
12639
  genCompoundExpression(node, context);
12640
12640
  break;
12641
- case "comment":
12641
+ case 3:
12642
12642
  genComment(node, context);
12643
12643
  break;
12644
12644
  case 13:
@@ -12941,7 +12941,7 @@ const transformExpression = (node, context) => {
12941
12941
  node.content,
12942
12942
  context
12943
12943
  );
12944
- } else if (node.type === "element") {
12944
+ } else if (node.type === 1) {
12945
12945
  for (let i = 0; i < node.props.length; i++) {
12946
12946
  const dir = node.props[i];
12947
12947
  if (dir.type === 7 && dir.name !== "for") {
@@ -13031,12 +13031,12 @@ function processIf(node, dir, context, processCodegen) {
13031
13031
  let i = siblings.indexOf(node);
13032
13032
  while (i-- >= -1) {
13033
13033
  const sibling = siblings[i];
13034
- if (sibling && sibling.type === "comment") {
13034
+ if (sibling && sibling.type === 3) {
13035
13035
  context.removeNode(sibling);
13036
13036
  comments.unshift(sibling);
13037
13037
  continue;
13038
13038
  }
13039
- if (sibling && sibling.type === "text" && !sibling.content.trim().length) {
13039
+ if (sibling && sibling.type === 2 && !sibling.content.trim().length) {
13040
13040
  context.removeNode(sibling);
13041
13041
  continue;
13042
13042
  }
@@ -13049,7 +13049,7 @@ function processIf(node, dir, context, processCodegen) {
13049
13049
  context.removeNode();
13050
13050
  const branch = createIfBranch(node, dir);
13051
13051
  if (comments.length && // #3619 ignore comments if the v-if is direct child of <transition>
13052
- !(context.parent && context.parent.type === "element" && isBuiltInType(context.parent.tag, "transition"))) {
13052
+ !(context.parent && context.parent.type === 1 && isBuiltInType(context.parent.tag, "transition"))) {
13053
13053
  branch.children = [...comments, ...branch.children];
13054
13054
  }
13055
13055
  {
@@ -13122,7 +13122,7 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
13122
13122
  );
13123
13123
  const { children } = branch;
13124
13124
  const firstChild = children[0];
13125
- const needFragmentWrapper = children.length !== 1 || firstChild.type !== "element";
13125
+ const needFragmentWrapper = children.length !== 1 || firstChild.type !== 1;
13126
13126
  if (needFragmentWrapper) {
13127
13127
  if (children.length === 1 && firstChild.type === 11) {
13128
13128
  const vnodeCall = firstChild.codegenNode;
@@ -13131,7 +13131,7 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
13131
13131
  } else {
13132
13132
  let patchFlag = 64;
13133
13133
  let patchFlagText = PatchFlagNames[64];
13134
- if (!branch.isTemplateIf && children.filter((c) => c.type !== "comment").length === 1) {
13134
+ if (!branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) {
13135
13135
  patchFlag |= 2048;
13136
13136
  patchFlagText += `, ${PatchFlagNames[2048]}`;
13137
13137
  }
@@ -13226,7 +13226,7 @@ const transformFor = createStructuralDirectiveTransform(
13226
13226
  const { children } = forNode;
13227
13227
  if (isTemplate) {
13228
13228
  node.children.some((c) => {
13229
- if (c.type === "element") {
13229
+ if (c.type === 1) {
13230
13230
  const key = findProp(c, "key");
13231
13231
  if (key) {
13232
13232
  context.onError(
@@ -13240,7 +13240,7 @@ const transformFor = createStructuralDirectiveTransform(
13240
13240
  }
13241
13241
  });
13242
13242
  }
13243
- const needFragmentWrapper = children.length !== 1 || children[0].type !== "element";
13243
+ const needFragmentWrapper = children.length !== 1 || children[0].type !== 1;
13244
13244
  const slotOutlet = isSlotOutlet(node) ? node : isTemplate && node.children.length === 1 && isSlotOutlet(node.children[0]) ? node.children[0] : null;
13245
13245
  if (slotOutlet) {
13246
13246
  childBlock = slotOutlet.codegenNode;
@@ -13459,7 +13459,7 @@ function createParamsList(args) {
13459
13459
 
13460
13460
  const defaultFallback = createSimpleExpression(`undefined`, false);
13461
13461
  const trackSlotScopes = (node, context) => {
13462
- if (node.type === "element" && (node.tagType === 1 || node.tagType === 3)) {
13462
+ if (node.type === 1 && (node.tagType === 1 || node.tagType === 3)) {
13463
13463
  const vSlot = findDir(node, "slot");
13464
13464
  if (vSlot) {
13465
13465
  vSlot.exp;
@@ -13505,7 +13505,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
13505
13505
  const slotElement = children[i];
13506
13506
  let slotDir;
13507
13507
  if (!isTemplateNode(slotElement) || !(slotDir = findDir(slotElement, "slot", true))) {
13508
- if (slotElement.type !== "comment") {
13508
+ if (slotElement.type !== 3) {
13509
13509
  implicitDefaultChildren.push(slotElement);
13510
13510
  }
13511
13511
  continue;
@@ -13552,7 +13552,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
13552
13552
  let prev;
13553
13553
  while (j--) {
13554
13554
  prev = children[j];
13555
- if (prev.type !== "comment") {
13555
+ if (prev.type !== 3) {
13556
13556
  break;
13557
13557
  }
13558
13558
  }
@@ -13683,7 +13683,7 @@ function hasForwardedSlots(children) {
13683
13683
  for (let i = 0; i < children.length; i++) {
13684
13684
  const child = children[i];
13685
13685
  switch (child.type) {
13686
- case "element":
13686
+ case 1:
13687
13687
  if (child.tagType === 2 || hasForwardedSlots(child.children)) {
13688
13688
  return true;
13689
13689
  }
@@ -13702,16 +13702,16 @@ function hasForwardedSlots(children) {
13702
13702
  return false;
13703
13703
  }
13704
13704
  function isNonWhitespaceContent(node) {
13705
- if (node.type !== "text" && node.type !== 12)
13705
+ if (node.type !== 2 && node.type !== 12)
13706
13706
  return true;
13707
- return node.type === "text" ? !!node.content.trim() : isNonWhitespaceContent(node.content);
13707
+ return node.type === 2 ? !!node.content.trim() : isNonWhitespaceContent(node.content);
13708
13708
  }
13709
13709
 
13710
13710
  const directiveImportMap = /* @__PURE__ */ new WeakMap();
13711
13711
  const transformElement = (node, context) => {
13712
13712
  return function postTransformElement() {
13713
13713
  node = context.currentNode;
13714
- if (!(node.type === "element" && (node.tagType === 0 || node.tagType === 1))) {
13714
+ if (!(node.type === 1 && (node.tagType === 0 || node.tagType === 1))) {
13715
13715
  return;
13716
13716
  }
13717
13717
  const { tag, props } = node;
@@ -13782,7 +13782,7 @@ const transformElement = (node, context) => {
13782
13782
  if (hasDynamicTextChild && getConstantType(child, context) === 0) {
13783
13783
  patchFlag |= 1;
13784
13784
  }
13785
- if (hasDynamicTextChild || type === "text") {
13785
+ if (hasDynamicTextChild || type === 2) {
13786
13786
  vnodeChildren = child;
13787
13787
  } else {
13788
13788
  vnodeChildren = node.children;
@@ -14427,7 +14427,7 @@ const injectPrefix = (arg, prefix) => {
14427
14427
  };
14428
14428
 
14429
14429
  const transformText = (node, context) => {
14430
- if (node.type === 0 || node.type === "element" || node.type === 11 || node.type === 10) {
14430
+ if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
14431
14431
  return () => {
14432
14432
  const children = node.children;
14433
14433
  let currentContainer = void 0;
@@ -14459,7 +14459,7 @@ const transformText = (node, context) => {
14459
14459
  // as-is since the runtime has dedicated fast path for this by directly
14460
14460
  // setting textContent of the element.
14461
14461
  // for component root it's always normalized anyway.
14462
- children.length === 1 && (node.type === 0 || node.type === "element" && node.tagType === 0 && // #3756
14462
+ children.length === 1 && (node.type === 0 || node.type === 1 && node.tagType === 0 && // #3756
14463
14463
  // custom directives can potentially add DOM elements arbitrarily,
14464
14464
  // we need to avoid setting textContent of the element at runtime
14465
14465
  // to avoid accidentally overwriting the DOM elements added
@@ -14476,7 +14476,7 @@ const transformText = (node, context) => {
14476
14476
  const child = children[i];
14477
14477
  if (isText$1(child) || child.type === 8) {
14478
14478
  const callArgs = [];
14479
- if (child.type !== "text" || child.content !== " ") {
14479
+ if (child.type !== 2 || child.content !== " ") {
14480
14480
  callArgs.push(child);
14481
14481
  }
14482
14482
  if (!context.ssr && getConstantType(child, context) === 0) {
@@ -14501,7 +14501,7 @@ const transformText = (node, context) => {
14501
14501
 
14502
14502
  const seen$1 = /* @__PURE__ */ new WeakSet();
14503
14503
  const transformOnce = (node, context) => {
14504
- if (node.type === "element" && findDir(node, "once", true)) {
14504
+ if (node.type === 1 && findDir(node, "once", true)) {
14505
14505
  if (seen$1.has(node) || context.inVOnce) {
14506
14506
  return;
14507
14507
  }
@@ -14584,7 +14584,7 @@ function createTransformProps(props = []) {
14584
14584
 
14585
14585
  const seen = /* @__PURE__ */ new WeakSet();
14586
14586
  const transformMemo = (node, context) => {
14587
- if (node.type === "element") {
14587
+ if (node.type === 1) {
14588
14588
  const dir = findDir(node, "memo");
14589
14589
  if (!dir || seen.has(node)) {
14590
14590
  return;
@@ -14773,7 +14773,7 @@ const parserOptions = {
14773
14773
  };
14774
14774
 
14775
14775
  const transformStyle = (node) => {
14776
- if (node.type === "element") {
14776
+ if (node.type === 1) {
14777
14777
  node.props.forEach((p, i) => {
14778
14778
  if (p.type === 6 && p.name === "style" && p.value) {
14779
14779
  node.props[i] = {
@@ -15057,7 +15057,7 @@ const transformShow = (dir, node, context) => {
15057
15057
  };
15058
15058
 
15059
15059
  const transformTransition = (node, context) => {
15060
- if (node.type === "element" && node.tagType === 1) {
15060
+ if (node.type === 1 && node.tagType === 1) {
15061
15061
  const component = context.isBuiltInComponent(node.tag);
15062
15062
  if (component === TRANSITION) {
15063
15063
  return () => {
@@ -15077,7 +15077,7 @@ const transformTransition = (node, context) => {
15077
15077
  );
15078
15078
  }
15079
15079
  const child = node.children[0];
15080
- if (child.type === "element") {
15080
+ if (child.type === 1) {
15081
15081
  for (const p of child.props) {
15082
15082
  if (p.type === 7 && p.name === "show") {
15083
15083
  node.props.push({
@@ -15095,14 +15095,14 @@ const transformTransition = (node, context) => {
15095
15095
  };
15096
15096
  function hasMultipleChildren(node) {
15097
15097
  const children = node.children = node.children.filter(
15098
- (c) => c.type !== "comment" && !(c.type === "text" && !c.content.trim())
15098
+ (c) => c.type !== 3 && !(c.type === 2 && !c.content.trim())
15099
15099
  );
15100
15100
  const child = children[0];
15101
15101
  return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(hasMultipleChildren);
15102
15102
  }
15103
15103
 
15104
15104
  const ignoreSideEffectTags = (node, context) => {
15105
- if (node.type === "element" && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) {
15105
+ if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) {
15106
15106
  context.onError(
15107
15107
  createDOMCompilerError(61, node.loc)
15108
15108
  );