@vue/compiler-ssr 3.5.44 → 3.5.45

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.5.44
2
+ * @vue/compiler-ssr v3.5.45
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -287,6 +287,11 @@ function ssrProcessSuspense(node, context) {
287
287
  }
288
288
 
289
289
  const rawChildrenMap = /* @__PURE__ */ new WeakMap();
290
+ const ssrTransformStyle = (node, context) => {
291
+ if (node.type === 1 && node.tagType !== 0) {
292
+ compilerDom.transformStyle(node, context);
293
+ }
294
+ };
290
295
  const ssrTransformElement = (node, context) => {
291
296
  if (node.type !== 1 || node.tagType !== 0) {
292
297
  return;
@@ -308,6 +313,7 @@ const ssrTransformElement = (node, context) => {
308
313
  }
309
314
  const needMergeProps = hasDynamicVBind || hasCustomDir;
310
315
  if (needMergeProps) {
316
+ compilerDom.transformStyle(node, context);
311
317
  const { props, directives } = compilerDom.buildProps(
312
318
  node,
313
319
  context,
@@ -401,6 +407,8 @@ const ssrTransformElement = (node, context) => {
401
407
  let dynamicClassBinding = void 0;
402
408
  let staticClassBinding = void 0;
403
409
  let dynamicStyleBinding = void 0;
410
+ let staticStyleBinding = void 0;
411
+ let staticStyleIndex = -1;
404
412
  for (let i = 0; i < node.props.length; i++) {
405
413
  const prop = node.props[i];
406
414
  if (node.tag === "input" && isTrueFalseValue(prop)) {
@@ -453,14 +461,18 @@ const ssrTransformElement = (node, context) => {
453
461
  if (dynamicStyleBinding) {
454
462
  mergeCall(dynamicStyleBinding, value);
455
463
  } else {
456
- openTag.push(
457
- ` style="`,
458
- dynamicStyleBinding = compilerDom.createCallExpression(
459
- context.helper(SSR_RENDER_STYLE),
460
- [value]
461
- ),
462
- `"`
464
+ dynamicStyleBinding = compilerDom.createCallExpression(
465
+ context.helper(SSR_RENDER_STYLE),
466
+ [
467
+ staticStyleBinding ? compilerDom.createArrayExpression([staticStyleBinding, value]) : value
468
+ ]
463
469
  );
470
+ const parts = [` style="`, dynamicStyleBinding, `"`];
471
+ if (staticStyleBinding) {
472
+ openTag.splice(staticStyleIndex, 1, ...parts);
473
+ } else {
474
+ openTag.push(...parts);
475
+ }
464
476
  }
465
477
  } else {
466
478
  attrName = node.tag.indexOf("-") > 0 ? attrName : shared.propsToAttrMap[attrName] || attrName.toLowerCase();
@@ -525,6 +537,17 @@ const ssrTransformElement = (node, context) => {
525
537
  if (name === "class" && prop.value) {
526
538
  staticClassBinding = JSON.stringify(prop.value.content);
527
539
  }
540
+ if (name === "style" && prop.value) {
541
+ const style = shared.parseStringStyle(prop.value.content);
542
+ if (dynamicStyleBinding) {
543
+ mergeCall(dynamicStyleBinding, JSON.stringify(style));
544
+ } else {
545
+ staticStyleBinding = JSON.stringify(style);
546
+ staticStyleIndex = openTag.length;
547
+ openTag.push(` style="${shared.escapeHtml(shared.stringifyStyle(style))}"`);
548
+ }
549
+ continue;
550
+ }
528
551
  openTag.push(
529
552
  ` ${prop.name}` + (prop.value ? `="${shared.escapeHtml(prop.value.content)}"` : ``)
530
553
  );
@@ -1393,7 +1416,7 @@ function compile(source, options = {}) {
1393
1416
  ssrTransformElement,
1394
1417
  ssrTransformComponent,
1395
1418
  compilerDom.trackSlotScopes,
1396
- compilerDom.transformStyle,
1419
+ ssrTransformStyle,
1397
1420
  ...options.nodeTransforms || []
1398
1421
  // user transforms
1399
1422
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/compiler-ssr",
3
- "version": "3.5.44",
3
+ "version": "3.5.45",
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.5.44",
32
- "@vue/compiler-dom": "3.5.44"
31
+ "@vue/shared": "3.5.45",
32
+ "@vue/compiler-dom": "3.5.45"
33
33
  }
34
34
  }