@vue/server-renderer 3.5.0-alpha.4 → 3.5.0-beta.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.
- package/README.md +8 -8
- package/dist/server-renderer.cjs.js +15 -3
- package/dist/server-renderer.cjs.prod.js +15 -3
- package/dist/server-renderer.d.ts +2 -5
- package/dist/server-renderer.esm-browser.js +298 -185
- package/dist/server-renderer.esm-browser.prod.js +2 -2
- package/dist/server-renderer.esm-bundler.js +25 -7
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
```ts
|
|
12
12
|
function renderToString(
|
|
13
13
|
input: App | VNode,
|
|
14
|
-
context?: SSRContext
|
|
14
|
+
context?: SSRContext,
|
|
15
15
|
): Promise<string>
|
|
16
16
|
```
|
|
17
17
|
|
|
@@ -23,7 +23,7 @@ const { renderToString } = require('@vue/server-renderer')
|
|
|
23
23
|
|
|
24
24
|
const app = createSSRApp({
|
|
25
25
|
data: () => ({ msg: 'hello' }),
|
|
26
|
-
template: `<div>{{ msg }}</div
|
|
26
|
+
template: `<div>{{ msg }}</div>`,
|
|
27
27
|
})
|
|
28
28
|
|
|
29
29
|
;(async () => {
|
|
@@ -74,7 +74,7 @@ Render and pipe to an existing [Node.js Writable stream](https://nodejs.org/api/
|
|
|
74
74
|
function pipeToNodeWritable(
|
|
75
75
|
input: App | VNode,
|
|
76
76
|
context: SSRContext = {},
|
|
77
|
-
writable: Writable
|
|
77
|
+
writable: Writable,
|
|
78
78
|
): void
|
|
79
79
|
```
|
|
80
80
|
|
|
@@ -94,7 +94,7 @@ Renders input as a [Web ReadableStream](https://developer.mozilla.org/en-US/docs
|
|
|
94
94
|
```ts
|
|
95
95
|
function renderToWebStream(
|
|
96
96
|
input: App | VNode,
|
|
97
|
-
context?: SSRContext
|
|
97
|
+
context?: SSRContext,
|
|
98
98
|
): ReadableStream
|
|
99
99
|
```
|
|
100
100
|
|
|
@@ -117,7 +117,7 @@ Render and pipe to an existing [Web WritableStream](https://developer.mozilla.or
|
|
|
117
117
|
function pipeToWebWritable(
|
|
118
118
|
input: App | VNode,
|
|
119
119
|
context: SSRContext = {},
|
|
120
|
-
writable: WritableStream
|
|
120
|
+
writable: WritableStream,
|
|
121
121
|
): void
|
|
122
122
|
```
|
|
123
123
|
|
|
@@ -144,7 +144,7 @@ Renders input in streaming mode using a simple readable interface.
|
|
|
144
144
|
function renderToSimpleStream(
|
|
145
145
|
input: App | VNode,
|
|
146
146
|
context: SSRContext,
|
|
147
|
-
options: SimpleReadable
|
|
147
|
+
options: SimpleReadable,
|
|
148
148
|
): SimpleReadable
|
|
149
149
|
|
|
150
150
|
interface SimpleReadable {
|
|
@@ -172,7 +172,7 @@ renderToSimpleStream(
|
|
|
172
172
|
},
|
|
173
173
|
destroy(err) {
|
|
174
174
|
// error encountered
|
|
175
|
-
}
|
|
176
|
-
}
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
177
|
)
|
|
178
178
|
```
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/server-renderer v3.5.0-
|
|
2
|
+
* @vue/server-renderer v3.5.0-beta.1
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -88,6 +88,7 @@ function ssrRenderComponent(comp, props = null, children = null, parentComponent
|
|
|
88
88
|
);
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
+
const { ensureValidVNode } = Vue.ssrUtils;
|
|
91
92
|
function ssrRenderSlot(slots, slotName, slotProps, fallbackRenderFn, push, parentComponent, slotScopeId) {
|
|
92
93
|
push(`<!--[-->`);
|
|
93
94
|
ssrRenderSlotInner(
|
|
@@ -115,7 +116,17 @@ function ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push,
|
|
|
115
116
|
slotScopeId ? " " + slotScopeId : ""
|
|
116
117
|
);
|
|
117
118
|
if (shared.isArray(ret)) {
|
|
118
|
-
|
|
119
|
+
const validSlotContent = ensureValidVNode(ret);
|
|
120
|
+
if (validSlotContent) {
|
|
121
|
+
renderVNodeChildren(
|
|
122
|
+
push,
|
|
123
|
+
validSlotContent,
|
|
124
|
+
parentComponent,
|
|
125
|
+
slotScopeId
|
|
126
|
+
);
|
|
127
|
+
} else if (fallbackRenderFn) {
|
|
128
|
+
fallbackRenderFn();
|
|
129
|
+
}
|
|
119
130
|
} else {
|
|
120
131
|
let isEmptySlot = true;
|
|
121
132
|
if (transition) {
|
|
@@ -165,9 +176,10 @@ function ssrRenderTeleport(parentPush, contentRenderFn, target, disabled, parent
|
|
|
165
176
|
let teleportContent;
|
|
166
177
|
if (disabled) {
|
|
167
178
|
contentRenderFn(parentPush);
|
|
168
|
-
teleportContent = `<!--teleport anchor-->`;
|
|
179
|
+
teleportContent = `<!--teleport start anchor--><!--teleport anchor-->`;
|
|
169
180
|
} else {
|
|
170
181
|
const { getBuffer, push } = createBuffer();
|
|
182
|
+
push(`<!--teleport start anchor-->`);
|
|
171
183
|
contentRenderFn(push);
|
|
172
184
|
push(`<!--teleport anchor-->`);
|
|
173
185
|
teleportContent = getBuffer();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/server-renderer v3.5.0-
|
|
2
|
+
* @vue/server-renderer v3.5.0-beta.1
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -88,6 +88,7 @@ function ssrRenderComponent(comp, props = null, children = null, parentComponent
|
|
|
88
88
|
);
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
+
const { ensureValidVNode } = Vue.ssrUtils;
|
|
91
92
|
function ssrRenderSlot(slots, slotName, slotProps, fallbackRenderFn, push, parentComponent, slotScopeId) {
|
|
92
93
|
push(`<!--[-->`);
|
|
93
94
|
ssrRenderSlotInner(
|
|
@@ -115,7 +116,17 @@ function ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push,
|
|
|
115
116
|
slotScopeId ? " " + slotScopeId : ""
|
|
116
117
|
);
|
|
117
118
|
if (shared.isArray(ret)) {
|
|
118
|
-
|
|
119
|
+
const validSlotContent = ensureValidVNode(ret);
|
|
120
|
+
if (validSlotContent) {
|
|
121
|
+
renderVNodeChildren(
|
|
122
|
+
push,
|
|
123
|
+
validSlotContent,
|
|
124
|
+
parentComponent,
|
|
125
|
+
slotScopeId
|
|
126
|
+
);
|
|
127
|
+
} else if (fallbackRenderFn) {
|
|
128
|
+
fallbackRenderFn();
|
|
129
|
+
}
|
|
119
130
|
} else {
|
|
120
131
|
let isEmptySlot = true;
|
|
121
132
|
if (transition) {
|
|
@@ -165,9 +176,10 @@ function ssrRenderTeleport(parentPush, contentRenderFn, target, disabled, parent
|
|
|
165
176
|
let teleportContent;
|
|
166
177
|
if (disabled) {
|
|
167
178
|
contentRenderFn(parentPush);
|
|
168
|
-
teleportContent = `<!--teleport anchor-->`;
|
|
179
|
+
teleportContent = `<!--teleport start anchor--><!--teleport anchor-->`;
|
|
169
180
|
} else {
|
|
170
181
|
const { getBuffer, push } = createBuffer();
|
|
182
|
+
push(`<!--teleport start anchor-->`);
|
|
171
183
|
contentRenderFn(push);
|
|
172
184
|
push(`<!--teleport anchor-->`);
|
|
173
185
|
teleportContent = getBuffer();
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { VNode, ComponentInternalInstance, App, Slots, Component, ComponentPublicInstance, Directive } from 'vue';
|
|
3
2
|
import { Readable, Writable } from 'node:stream';
|
|
4
3
|
export { includeBooleanAttr as ssrIncludeBooleanAttr } from '@vue/shared';
|
|
@@ -58,11 +57,9 @@ export declare const ssrLooseEqual: (a: unknown, b: unknown) => boolean;
|
|
|
58
57
|
export declare function ssrLooseContain(arr: unknown[], value: unknown): boolean;
|
|
59
58
|
export declare function ssrRenderDynamicModel(type: unknown, model: unknown, value: unknown): string;
|
|
60
59
|
export declare function ssrGetDynamicModelProps(existingProps: any, model: unknown): {
|
|
61
|
-
checked:
|
|
62
|
-
value?: undefined;
|
|
60
|
+
checked: true;
|
|
63
61
|
} | {
|
|
64
|
-
value:
|
|
65
|
-
checked?: undefined;
|
|
62
|
+
value: any;
|
|
66
63
|
} | null;
|
|
67
64
|
|
|
68
65
|
export { renderVNode as ssrRenderVNode };
|