@vue/compiler-ssr 3.3.5 → 3.3.7

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.
@@ -219,7 +219,7 @@ function ssrProcessTeleport(node, context) {
219
219
  );
220
220
  }
221
221
 
222
- const wipMap$2 = /* @__PURE__ */ new WeakMap();
222
+ const wipMap$3 = /* @__PURE__ */ new WeakMap();
223
223
  function ssrTransformSuspense(node, context) {
224
224
  return () => {
225
225
  if (node.children.length) {
@@ -228,29 +228,33 @@ function ssrTransformSuspense(node, context) {
228
228
  // to be immediately set
229
229
  wipSlots: []
230
230
  };
231
- wipMap$2.set(node, wipEntry);
232
- wipEntry.slotsExp = compilerDom.buildSlots(node, context, (_props, children, loc) => {
233
- const fn = compilerDom.createFunctionExpression(
234
- [],
235
- void 0,
236
- // no return, assign body later
237
- true,
238
- // newline
239
- false,
240
- // suspense slots are not treated as normal slots
241
- loc
242
- );
243
- wipEntry.wipSlots.push({
244
- fn,
245
- children
246
- });
247
- return fn;
248
- }).slots;
231
+ wipMap$3.set(node, wipEntry);
232
+ wipEntry.slotsExp = compilerDom.buildSlots(
233
+ node,
234
+ context,
235
+ (_props, _vForExp, children, loc) => {
236
+ const fn = compilerDom.createFunctionExpression(
237
+ [],
238
+ void 0,
239
+ // no return, assign body later
240
+ true,
241
+ // newline
242
+ false,
243
+ // suspense slots are not treated as normal slots
244
+ loc
245
+ );
246
+ wipEntry.wipSlots.push({
247
+ fn,
248
+ children
249
+ });
250
+ return fn;
251
+ }
252
+ ).slots;
249
253
  }
250
254
  };
251
255
  }
252
256
  function ssrProcessSuspense(node, context) {
253
- const wipEntry = wipMap$2.get(node);
257
+ const wipEntry = wipMap$3.get(node);
254
258
  if (!wipEntry) {
255
259
  return;
256
260
  }
@@ -556,7 +560,7 @@ function ssrProcessElement(node, context) {
556
560
  }
557
561
  }
558
562
 
559
- const wipMap$1 = /* @__PURE__ */ new WeakMap();
563
+ const wipMap$2 = /* @__PURE__ */ new WeakMap();
560
564
  function ssrTransformTransitionGroup(node, context) {
561
565
  return () => {
562
566
  const tag = compilerDom.findProp(node, "tag");
@@ -577,23 +581,27 @@ function ssrTransformTransitionGroup(node, context) {
577
581
  buildSSRProps(props, directives, context)
578
582
  ]);
579
583
  }
580
- wipMap$1.set(node, {
584
+ wipMap$2.set(node, {
581
585
  tag,
582
- propsExp
586
+ propsExp,
587
+ scopeId: context.scopeId || null
583
588
  });
584
589
  }
585
590
  };
586
591
  }
587
592
  function ssrProcessTransitionGroup(node, context) {
588
- const entry = wipMap$1.get(node);
593
+ const entry = wipMap$2.get(node);
589
594
  if (entry) {
590
- const { tag, propsExp } = entry;
595
+ const { tag, propsExp, scopeId } = entry;
591
596
  if (tag.type === 7) {
592
597
  context.pushStringPart(`<`);
593
598
  context.pushStringPart(tag.exp);
594
599
  if (propsExp) {
595
600
  context.pushStringPart(propsExp);
596
601
  }
602
+ if (scopeId) {
603
+ context.pushStringPart(` ${scopeId}`);
604
+ }
597
605
  context.pushStringPart(`>`);
598
606
  processChildren(
599
607
  node,
@@ -615,6 +623,9 @@ function ssrProcessTransitionGroup(node, context) {
615
623
  if (propsExp) {
616
624
  context.pushStringPart(propsExp);
617
625
  }
626
+ if (scopeId) {
627
+ context.pushStringPart(` ${scopeId}`);
628
+ }
618
629
  context.pushStringPart(`>`);
619
630
  processChildren(node, context, false, true);
620
631
  context.pushStringPart(`</${tag.value.content}>`);
@@ -624,6 +635,25 @@ function ssrProcessTransitionGroup(node, context) {
624
635
  }
625
636
  }
626
637
 
638
+ const wipMap$1 = /* @__PURE__ */ new WeakMap();
639
+ function ssrTransformTransition(node, context) {
640
+ return () => {
641
+ const appear = compilerDom.findProp(node, "appear", false, true);
642
+ wipMap$1.set(node, !!appear);
643
+ };
644
+ }
645
+ function ssrProcessTransition(node, context) {
646
+ node.children = node.children.filter((c) => c.type !== 3);
647
+ const appear = wipMap$1.get(node);
648
+ if (appear) {
649
+ context.pushStringPart(`<template>`);
650
+ processChildren(node, context, false, true);
651
+ context.pushStringPart(`</template>`);
652
+ } else {
653
+ processChildren(node, context, false, true);
654
+ }
655
+ }
656
+
627
657
  const wipMap = /* @__PURE__ */ new WeakMap();
628
658
  const WIP_SLOT = Symbol();
629
659
  const componentTypeMap = /* @__PURE__ */ new WeakMap();
@@ -642,9 +672,10 @@ const ssrTransformComponent = (node, context) => {
642
672
  if (shared.isSymbol(component)) {
643
673
  if (component === compilerDom.SUSPENSE) {
644
674
  return ssrTransformSuspense(node, context);
645
- }
646
- if (component === compilerDom.TRANSITION_GROUP) {
675
+ } else if (component === compilerDom.TRANSITION_GROUP) {
647
676
  return ssrTransformTransitionGroup(node, context);
677
+ } else if (component === compilerDom.TRANSITION) {
678
+ return ssrTransformTransition(node);
648
679
  }
649
680
  return;
650
681
  }
@@ -652,8 +683,10 @@ const ssrTransformComponent = (node, context) => {
652
683
  const clonedNode = clone(node);
653
684
  return function ssrPostTransformComponent() {
654
685
  if (clonedNode.children.length) {
655
- compilerDom.buildSlots(clonedNode, context, (props, children) => {
656
- vnodeBranches.push(createVNodeSlotBranch(props, children, context));
686
+ compilerDom.buildSlots(clonedNode, context, (props, vFor, children) => {
687
+ vnodeBranches.push(
688
+ createVNodeSlotBranch(props, vFor, children, context)
689
+ );
657
690
  return compilerDom.createFunctionExpression(void 0);
658
691
  });
659
692
  }
@@ -672,7 +705,7 @@ const ssrTransformComponent = (node, context) => {
672
705
  }
673
706
  const wipEntries = [];
674
707
  wipMap.set(node, wipEntries);
675
- const buildSSRSlotFn = (props, children, loc) => {
708
+ const buildSSRSlotFn = (props, _vForExp, children, loc) => {
676
709
  const param0 = props && compilerDom.stringifyExpression(props) || `_`;
677
710
  const fn = compilerDom.createFunctionExpression(
678
711
  [param0, `_push`, `_parent`, `_scopeId`],
@@ -729,7 +762,7 @@ function ssrProcessComponent(node, context, parent) {
729
762
  context.pushStringPart(``);
730
763
  }
731
764
  if (component === compilerDom.TRANSITION) {
732
- node.children = node.children.filter((c) => c.type !== 3);
765
+ return ssrProcessTransition(node, context);
733
766
  }
734
767
  processChildren(node, context);
735
768
  }
@@ -768,7 +801,7 @@ const vnodeDirectiveTransforms = {
768
801
  ...baseDirectiveTransforms,
769
802
  ...compilerDom.DOMDirectiveTransforms
770
803
  };
771
- function createVNodeSlotBranch(props, children, parentContext) {
804
+ function createVNodeSlotBranch(props, vForExp, children, parentContext) {
772
805
  const rawOptions = rawOptionsMap.get(parentContext.root);
773
806
  const subOptions = {
774
807
  ...rawOptions,
@@ -788,8 +821,8 @@ function createVNodeSlotBranch(props, children, parentContext) {
788
821
  tag: "template",
789
822
  tagType: 3,
790
823
  isSelfClosing: false,
791
- // important: provide v-slot="props" on the wrapper for proper
792
- // scope analysis
824
+ // important: provide v-slot="props" and v-for="exp" on the wrapper for
825
+ // proper scope analysis
793
826
  props: [
794
827
  {
795
828
  type: 7,
@@ -798,6 +831,14 @@ function createVNodeSlotBranch(props, children, parentContext) {
798
831
  arg: void 0,
799
832
  modifiers: [],
800
833
  loc: compilerDom.locStub
834
+ },
835
+ {
836
+ type: 7,
837
+ name: "for",
838
+ exp: vForExp,
839
+ arg: void 0,
840
+ modifiers: [],
841
+ loc: compilerDom.locStub
801
842
  }
802
843
  ],
803
844
  children,
@@ -1003,6 +1044,38 @@ const ssrTransformModel = (dir, node, context) => {
1003
1044
  );
1004
1045
  }
1005
1046
  }
1047
+ function processOption(plainNode) {
1048
+ if (plainNode.tag === "option") {
1049
+ if (plainNode.props.findIndex((p) => p.name === "selected") === -1) {
1050
+ const value = findValueBinding(plainNode);
1051
+ plainNode.ssrCodegenNode.elements.push(
1052
+ compilerDom.createConditionalExpression(
1053
+ compilerDom.createCallExpression(context.helper(SSR_INCLUDE_BOOLEAN_ATTR), [
1054
+ compilerDom.createConditionalExpression(
1055
+ compilerDom.createCallExpression(`Array.isArray`, [model]),
1056
+ compilerDom.createCallExpression(context.helper(SSR_LOOSE_CONTAIN), [
1057
+ model,
1058
+ value
1059
+ ]),
1060
+ compilerDom.createCallExpression(context.helper(SSR_LOOSE_EQUAL), [
1061
+ model,
1062
+ value
1063
+ ])
1064
+ )
1065
+ ]),
1066
+ compilerDom.createSimpleExpression(" selected", true),
1067
+ compilerDom.createSimpleExpression("", true),
1068
+ false
1069
+ /* no newline */
1070
+ )
1071
+ );
1072
+ }
1073
+ } else if (plainNode.tag === "optgroup") {
1074
+ plainNode.children.forEach(
1075
+ (option) => processOption(option)
1076
+ );
1077
+ }
1078
+ }
1006
1079
  if (node.tagType === 0) {
1007
1080
  const res = { props: [] };
1008
1081
  const defaultProps = [
@@ -1085,33 +1158,9 @@ const ssrTransformModel = (dir, node, context) => {
1085
1158
  checkDuplicatedValue();
1086
1159
  node.children = [compilerDom.createInterpolation(model, model.loc)];
1087
1160
  } else if (node.tag === "select") {
1088
- node.children.forEach((option) => {
1089
- if (option.type === 1) {
1090
- const plainNode = option;
1091
- if (plainNode.props.findIndex((p) => p.name === "selected") === -1) {
1092
- const value = findValueBinding(plainNode);
1093
- plainNode.ssrCodegenNode.elements.push(
1094
- compilerDom.createConditionalExpression(
1095
- compilerDom.createCallExpression(context.helper(SSR_INCLUDE_BOOLEAN_ATTR), [
1096
- compilerDom.createConditionalExpression(
1097
- compilerDom.createCallExpression(`Array.isArray`, [model]),
1098
- compilerDom.createCallExpression(context.helper(SSR_LOOSE_CONTAIN), [
1099
- model,
1100
- value
1101
- ]),
1102
- compilerDom.createCallExpression(context.helper(SSR_LOOSE_EQUAL), [
1103
- model,
1104
- value
1105
- ])
1106
- )
1107
- ]),
1108
- compilerDom.createSimpleExpression(" selected", true),
1109
- compilerDom.createSimpleExpression("", true),
1110
- false
1111
- /* no newline */
1112
- )
1113
- );
1114
- }
1161
+ node.children.forEach((child) => {
1162
+ if (child.type === 1) {
1163
+ processOption(child);
1115
1164
  }
1116
1165
  });
1117
1166
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/compiler-ssr",
3
- "version": "3.3.5",
3
+ "version": "3.3.7",
4
4
  "description": "@vue/compiler-ssr",
5
5
  "main": "dist/compiler-ssr.cjs.js",
6
6
  "types": "dist/compiler-ssr.d.ts",
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-ssr#readme",
30
30
  "dependencies": {
31
- "@vue/shared": "3.3.5",
32
- "@vue/compiler-dom": "3.3.5"
31
+ "@vue/shared": "3.3.7",
32
+ "@vue/compiler-dom": "3.3.7"
33
33
  }
34
34
  }