@vue/language-core 3.3.0 → 3.3.1

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.
@@ -46,12 +46,19 @@ const transformElement = (node, context) => {
46
46
  }
47
47
  }
48
48
  if (isComponent) {
49
- let hasTemplateSlots = false;
50
49
  let hasNamedDefaultSlot = false;
51
50
  const implicitDefaultChildren = [];
52
51
  const seenSlotNames = new Set();
53
52
  const onComponentSlot = (0, compiler_dom_1.findDir)(node, 'slot', true);
54
- for (const child of node.children) {
53
+ for (let child of node.children) {
54
+ // <template v-for> -> for > template
55
+ if (child.type === compiler_dom_1.NodeTypes.FOR) {
56
+ child = child.children[0];
57
+ }
58
+ // <template v-if> -> if > branch > template
59
+ else if (child.type === compiler_dom_1.NodeTypes.IF) {
60
+ child = child.branches[0].children[0];
61
+ }
55
62
  let slotDir;
56
63
  if (!(0, compiler_dom_1.isTemplateNode)(child) || !(slotDir = (0, compiler_dom_1.findDir)(child, 'slot', true))) {
57
64
  if (child.type !== compiler_dom_1.NodeTypes.COMMENT) {
@@ -63,10 +70,6 @@ const transformElement = (node, context) => {
63
70
  context.onError((0, compiler_dom_1.createCompilerError)(compiler_dom_1.ErrorCodes.X_V_SLOT_MIXED_SLOT_USAGE, slotDir.loc));
64
71
  break;
65
72
  }
66
- if ((0, compiler_dom_1.findDir)(child, /^(?:if|else-if|else|for)$/, true)) {
67
- continue;
68
- }
69
- hasTemplateSlots = true;
70
73
  const staticSlotName = slotDir.arg
71
74
  ? (0, compiler_dom_1.isStaticExp)(slotDir.arg)
72
75
  ? slotDir.arg.content
@@ -83,7 +86,7 @@ const transformElement = (node, context) => {
83
86
  }
84
87
  }
85
88
  }
86
- if (hasTemplateSlots && hasNamedDefaultSlot
89
+ if (hasNamedDefaultSlot
87
90
  && implicitDefaultChildren.some(node => node.type !== compiler_dom_1.NodeTypes.TEXT || !!node.content.trim())) {
88
91
  context.onError((0, compiler_dom_1.createCompilerError)(compiler_dom_1.ErrorCodes.X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN, implicitDefaultChildren[0].loc));
89
92
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/language-core",
3
- "version": "3.3.0",
3
+ "version": "3.3.1",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "index.d.ts",
@@ -34,5 +34,5 @@
34
34
  "@volar/typescript": "2.4.28",
35
35
  "@vue/compiler-sfc": "^3.5.0"
36
36
  },
37
- "gitHead": "1088dce8ae6b937f7525fae4982e3b3ea99d3c64"
37
+ "gitHead": "9109bf31282c3d92ca0dd1825b0872a59b572b84"
38
38
  }