@vue/compiler-ssr 3.3.4 → 3.3.6

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.
@@ -579,7 +579,8 @@ function ssrTransformTransitionGroup(node, context) {
579
579
  }
580
580
  wipMap$1.set(node, {
581
581
  tag,
582
- propsExp
582
+ propsExp,
583
+ scopeId: context.scopeId || null
583
584
  });
584
585
  }
585
586
  };
@@ -587,13 +588,16 @@ function ssrTransformTransitionGroup(node, context) {
587
588
  function ssrProcessTransitionGroup(node, context) {
588
589
  const entry = wipMap$1.get(node);
589
590
  if (entry) {
590
- const { tag, propsExp } = entry;
591
+ const { tag, propsExp, scopeId } = entry;
591
592
  if (tag.type === 7) {
592
593
  context.pushStringPart(`<`);
593
594
  context.pushStringPart(tag.exp);
594
595
  if (propsExp) {
595
596
  context.pushStringPart(propsExp);
596
597
  }
598
+ if (scopeId) {
599
+ context.pushStringPart(` ${scopeId}`);
600
+ }
597
601
  context.pushStringPart(`>`);
598
602
  processChildren(
599
603
  node,
@@ -615,6 +619,9 @@ function ssrProcessTransitionGroup(node, context) {
615
619
  if (propsExp) {
616
620
  context.pushStringPart(propsExp);
617
621
  }
622
+ if (scopeId) {
623
+ context.pushStringPart(` ${scopeId}`);
624
+ }
618
625
  context.pushStringPart(`>`);
619
626
  processChildren(node, context, false, true);
620
627
  context.pushStringPart(`</${tag.value.content}>`);
@@ -1003,6 +1010,38 @@ const ssrTransformModel = (dir, node, context) => {
1003
1010
  );
1004
1011
  }
1005
1012
  }
1013
+ function processOption(plainNode) {
1014
+ if (plainNode.tag === "option") {
1015
+ if (plainNode.props.findIndex((p) => p.name === "selected") === -1) {
1016
+ const value = findValueBinding(plainNode);
1017
+ plainNode.ssrCodegenNode.elements.push(
1018
+ compilerDom.createConditionalExpression(
1019
+ compilerDom.createCallExpression(context.helper(SSR_INCLUDE_BOOLEAN_ATTR), [
1020
+ compilerDom.createConditionalExpression(
1021
+ compilerDom.createCallExpression(`Array.isArray`, [model]),
1022
+ compilerDom.createCallExpression(context.helper(SSR_LOOSE_CONTAIN), [
1023
+ model,
1024
+ value
1025
+ ]),
1026
+ compilerDom.createCallExpression(context.helper(SSR_LOOSE_EQUAL), [
1027
+ model,
1028
+ value
1029
+ ])
1030
+ )
1031
+ ]),
1032
+ compilerDom.createSimpleExpression(" selected", true),
1033
+ compilerDom.createSimpleExpression("", true),
1034
+ false
1035
+ /* no newline */
1036
+ )
1037
+ );
1038
+ }
1039
+ } else if (plainNode.tag === "optgroup") {
1040
+ plainNode.children.forEach(
1041
+ (option) => processOption(option)
1042
+ );
1043
+ }
1044
+ }
1006
1045
  if (node.tagType === 0) {
1007
1046
  const res = { props: [] };
1008
1047
  const defaultProps = [
@@ -1084,7 +1123,13 @@ const ssrTransformModel = (dir, node, context) => {
1084
1123
  } else if (node.tag === "textarea") {
1085
1124
  checkDuplicatedValue();
1086
1125
  node.children = [compilerDom.createInterpolation(model, model.loc)];
1087
- } else if (node.tag === "select") ; else {
1126
+ } else if (node.tag === "select") {
1127
+ node.children.forEach((child) => {
1128
+ if (child.type === 1) {
1129
+ processOption(child);
1130
+ }
1131
+ });
1132
+ } else {
1088
1133
  context.onError(
1089
1134
  compilerDom.createDOMCompilerError(
1090
1135
  57,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/compiler-ssr",
3
- "version": "3.3.4",
3
+ "version": "3.3.6",
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.4",
32
- "@vue/compiler-dom": "3.3.4"
31
+ "@vue/shared": "3.3.6",
32
+ "@vue/compiler-dom": "3.3.6"
33
33
  }
34
34
  }