@vue/compiler-ssr 3.6.0-alpha.4 → 3.6.0-alpha.5

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-ssr v3.6.0-alpha.4
2
+ * @vue/compiler-ssr v3.6.0-alpha.5
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1138,11 +1138,11 @@ const ssrTransformModel = (dir, node, context) => {
1138
1138
  }
1139
1139
  if (node.tagType === 0) {
1140
1140
  const res = { props: [] };
1141
- const defaultProps = [
1142
- // default value binding for text type inputs
1143
- compilerDom.createObjectProperty(`value`, model)
1144
- ];
1145
1141
  if (node.tag === "input") {
1142
+ const defaultProps = [
1143
+ // default value binding for text type inputs
1144
+ compilerDom.createObjectProperty(`value`, model)
1145
+ ];
1146
1146
  const type = compilerDom.findProp(node, "type");
1147
1147
  if (type) {
1148
1148
  const value = findValueBinding(node);
@@ -1263,16 +1263,14 @@ const ssrTransformShow = (dir, node, context) => {
1263
1263
  };
1264
1264
  };
1265
1265
 
1266
- const filterChild = (node) => node.children.filter((n) => n.type !== 3);
1267
- const hasSingleChild = (node) => filterChild(node).length === 1;
1268
1266
  const ssrInjectFallthroughAttrs = (node, context) => {
1269
1267
  if (node.type === 0) {
1270
1268
  context.identifiers._attrs = 1;
1271
1269
  }
1272
1270
  if (node.type === 1 && node.tagType === 1 && (node.tag === "transition" || node.tag === "Transition" || node.tag === "KeepAlive" || node.tag === "keep-alive")) {
1273
- const rootChildren = filterChild(context.root);
1271
+ const rootChildren = compilerDom.filterNonCommentChildren(context.root);
1274
1272
  if (rootChildren.length === 1 && rootChildren[0] === node) {
1275
- if (hasSingleChild(node)) {
1273
+ if (compilerDom.hasSingleChild(node)) {
1276
1274
  injectFallthroughAttrs(node.children[0]);
1277
1275
  }
1278
1276
  return;
@@ -1282,22 +1280,11 @@ const ssrInjectFallthroughAttrs = (node, context) => {
1282
1280
  if (!parent || parent.type !== 0) {
1283
1281
  return;
1284
1282
  }
1285
- if (node.type === 10 && hasSingleChild(node)) {
1286
- let hasEncounteredIf = false;
1287
- for (const c of filterChild(parent)) {
1288
- if (c.type === 9 || c.type === 1 && compilerDom.findDir(c, "if")) {
1289
- if (hasEncounteredIf) return;
1290
- hasEncounteredIf = true;
1291
- } else if (
1292
- // node before v-if
1293
- !hasEncounteredIf || // non else nodes
1294
- !(c.type === 1 && compilerDom.findDir(c, /else/, true))
1295
- ) {
1296
- return;
1297
- }
1283
+ if (node.type === 10 && compilerDom.hasSingleChild(node)) {
1284
+ if (compilerDom.isSingleIfBlock(parent)) {
1285
+ injectFallthroughAttrs(node.children[0]);
1298
1286
  }
1299
- injectFallthroughAttrs(node.children[0]);
1300
- } else if (hasSingleChild(parent)) {
1287
+ } else if (compilerDom.hasSingleChild(parent)) {
1301
1288
  injectFallthroughAttrs(node);
1302
1289
  }
1303
1290
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/compiler-ssr",
3
- "version": "3.6.0-alpha.4",
3
+ "version": "3.6.0-alpha.5",
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/compiler-dom": "3.6.0-alpha.4",
32
- "@vue/shared": "3.6.0-alpha.4"
31
+ "@vue/shared": "3.6.0-alpha.5",
32
+ "@vue/compiler-dom": "3.6.0-alpha.5"
33
33
  }
34
34
  }