@vue/server-renderer 3.2.34-beta.1 → 3.2.34
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.
|
@@ -114,25 +114,24 @@ function ssrCompile(template, instance) {
|
|
|
114
114
|
|
|
115
115
|
function ssrRenderTeleport(parentPush, contentRenderFn, target, disabled, parentComponent) {
|
|
116
116
|
parentPush('<!--teleport start-->');
|
|
117
|
+
const context = parentComponent.appContext.provides[vue.ssrContextKey];
|
|
118
|
+
const teleportBuffers = context.__teleportBuffers || (context.__teleportBuffers = {});
|
|
119
|
+
const targetBuffer = teleportBuffers[target] || (teleportBuffers[target] = []);
|
|
120
|
+
// record current index of the target buffer to handle nested teleports
|
|
121
|
+
// since the parent needs to be rendered before the child
|
|
122
|
+
const bufferIndex = targetBuffer.length;
|
|
117
123
|
let teleportContent;
|
|
118
124
|
if (disabled) {
|
|
119
125
|
contentRenderFn(parentPush);
|
|
120
|
-
teleportContent =
|
|
126
|
+
teleportContent = `<!--teleport anchor-->`;
|
|
121
127
|
}
|
|
122
128
|
else {
|
|
123
129
|
const { getBuffer, push } = createBuffer();
|
|
124
130
|
contentRenderFn(push);
|
|
125
|
-
push(
|
|
131
|
+
push(`<!--teleport anchor-->`);
|
|
126
132
|
teleportContent = getBuffer();
|
|
127
133
|
}
|
|
128
|
-
|
|
129
|
-
const teleportBuffers = context.__teleportBuffers || (context.__teleportBuffers = {});
|
|
130
|
-
if (teleportBuffers[target]) {
|
|
131
|
-
teleportBuffers[target].push(teleportContent);
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
teleportBuffers[target] = [teleportContent];
|
|
135
|
-
}
|
|
134
|
+
targetBuffer.splice(bufferIndex, 0, teleportContent);
|
|
136
135
|
parentPush('<!--teleport end-->');
|
|
137
136
|
}
|
|
138
137
|
|
|
@@ -193,7 +192,17 @@ function renderComponentSubTree(instance, slotScopeId) {
|
|
|
193
192
|
const comp = instance.type;
|
|
194
193
|
const { getBuffer, push } = createBuffer();
|
|
195
194
|
if (shared.isFunction(comp)) {
|
|
196
|
-
|
|
195
|
+
let root = renderComponentRoot(instance);
|
|
196
|
+
// #5817 scope ID attrs not falling through if functional component doesn't
|
|
197
|
+
// have props
|
|
198
|
+
if (!comp.props) {
|
|
199
|
+
for (const key in instance.attrs) {
|
|
200
|
+
if (key.startsWith(`data-v-`)) {
|
|
201
|
+
(root.props || (root.props = {}))[key] = ``;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
renderVNode(push, (instance.subTree = root), instance, slotScopeId);
|
|
197
206
|
}
|
|
198
207
|
else {
|
|
199
208
|
if ((!instance.render || instance.render === shared.NOOP) &&
|
|
@@ -643,9 +652,11 @@ function ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push,
|
|
|
643
652
|
fallbackRenderFn();
|
|
644
653
|
}
|
|
645
654
|
}
|
|
646
|
-
const commentRE =
|
|
655
|
+
const commentRE = /<!--[^]*?-->/gm;
|
|
647
656
|
function isComment(item) {
|
|
648
|
-
return typeof item === 'string' &&
|
|
657
|
+
return (typeof item === 'string' &&
|
|
658
|
+
commentRE.test(item) &&
|
|
659
|
+
!item.replace(commentRE, '').trim());
|
|
649
660
|
}
|
|
650
661
|
|
|
651
662
|
function ssrInterpolate(value) {
|
|
@@ -111,25 +111,24 @@ function ssrCompile(template, instance) {
|
|
|
111
111
|
|
|
112
112
|
function ssrRenderTeleport(parentPush, contentRenderFn, target, disabled, parentComponent) {
|
|
113
113
|
parentPush('<!--teleport start-->');
|
|
114
|
+
const context = parentComponent.appContext.provides[vue.ssrContextKey];
|
|
115
|
+
const teleportBuffers = context.__teleportBuffers || (context.__teleportBuffers = {});
|
|
116
|
+
const targetBuffer = teleportBuffers[target] || (teleportBuffers[target] = []);
|
|
117
|
+
// record current index of the target buffer to handle nested teleports
|
|
118
|
+
// since the parent needs to be rendered before the child
|
|
119
|
+
const bufferIndex = targetBuffer.length;
|
|
114
120
|
let teleportContent;
|
|
115
121
|
if (disabled) {
|
|
116
122
|
contentRenderFn(parentPush);
|
|
117
|
-
teleportContent =
|
|
123
|
+
teleportContent = `<!--teleport anchor-->`;
|
|
118
124
|
}
|
|
119
125
|
else {
|
|
120
126
|
const { getBuffer, push } = createBuffer();
|
|
121
127
|
contentRenderFn(push);
|
|
122
|
-
push(
|
|
128
|
+
push(`<!--teleport anchor-->`);
|
|
123
129
|
teleportContent = getBuffer();
|
|
124
130
|
}
|
|
125
|
-
|
|
126
|
-
const teleportBuffers = context.__teleportBuffers || (context.__teleportBuffers = {});
|
|
127
|
-
if (teleportBuffers[target]) {
|
|
128
|
-
teleportBuffers[target].push(teleportContent);
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
teleportBuffers[target] = [teleportContent];
|
|
132
|
-
}
|
|
131
|
+
targetBuffer.splice(bufferIndex, 0, teleportContent);
|
|
133
132
|
parentPush('<!--teleport end-->');
|
|
134
133
|
}
|
|
135
134
|
|
|
@@ -190,7 +189,17 @@ function renderComponentSubTree(instance, slotScopeId) {
|
|
|
190
189
|
const comp = instance.type;
|
|
191
190
|
const { getBuffer, push } = createBuffer();
|
|
192
191
|
if (shared.isFunction(comp)) {
|
|
193
|
-
|
|
192
|
+
let root = renderComponentRoot(instance);
|
|
193
|
+
// #5817 scope ID attrs not falling through if functional component doesn't
|
|
194
|
+
// have props
|
|
195
|
+
if (!comp.props) {
|
|
196
|
+
for (const key in instance.attrs) {
|
|
197
|
+
if (key.startsWith(`data-v-`)) {
|
|
198
|
+
(root.props || (root.props = {}))[key] = ``;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
renderVNode(push, (instance.subTree = root), instance, slotScopeId);
|
|
194
203
|
}
|
|
195
204
|
else {
|
|
196
205
|
if ((!instance.render || instance.render === shared.NOOP) &&
|
|
@@ -640,9 +649,11 @@ function ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push,
|
|
|
640
649
|
fallbackRenderFn();
|
|
641
650
|
}
|
|
642
651
|
}
|
|
643
|
-
const commentRE =
|
|
652
|
+
const commentRE = /<!--[^]*?-->/gm;
|
|
644
653
|
function isComment(item) {
|
|
645
|
-
return typeof item === 'string' &&
|
|
654
|
+
return (typeof item === 'string' &&
|
|
655
|
+
commentRE.test(item) &&
|
|
656
|
+
!item.replace(commentRE, '').trim());
|
|
646
657
|
}
|
|
647
658
|
|
|
648
659
|
function ssrInterpolate(value) {
|
|
@@ -83,25 +83,24 @@ function ssrCompile(template, instance) {
|
|
|
83
83
|
|
|
84
84
|
function ssrRenderTeleport(parentPush, contentRenderFn, target, disabled, parentComponent) {
|
|
85
85
|
parentPush('<!--teleport start-->');
|
|
86
|
+
const context = parentComponent.appContext.provides[ssrContextKey];
|
|
87
|
+
const teleportBuffers = context.__teleportBuffers || (context.__teleportBuffers = {});
|
|
88
|
+
const targetBuffer = teleportBuffers[target] || (teleportBuffers[target] = []);
|
|
89
|
+
// record current index of the target buffer to handle nested teleports
|
|
90
|
+
// since the parent needs to be rendered before the child
|
|
91
|
+
const bufferIndex = targetBuffer.length;
|
|
86
92
|
let teleportContent;
|
|
87
93
|
if (disabled) {
|
|
88
94
|
contentRenderFn(parentPush);
|
|
89
|
-
teleportContent =
|
|
95
|
+
teleportContent = `<!--teleport anchor-->`;
|
|
90
96
|
}
|
|
91
97
|
else {
|
|
92
98
|
const { getBuffer, push } = createBuffer();
|
|
93
99
|
contentRenderFn(push);
|
|
94
|
-
push(
|
|
100
|
+
push(`<!--teleport anchor-->`);
|
|
95
101
|
teleportContent = getBuffer();
|
|
96
102
|
}
|
|
97
|
-
|
|
98
|
-
const teleportBuffers = context.__teleportBuffers || (context.__teleportBuffers = {});
|
|
99
|
-
if (teleportBuffers[target]) {
|
|
100
|
-
teleportBuffers[target].push(teleportContent);
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
teleportBuffers[target] = [teleportContent];
|
|
104
|
-
}
|
|
103
|
+
targetBuffer.splice(bufferIndex, 0, teleportContent);
|
|
105
104
|
parentPush('<!--teleport end-->');
|
|
106
105
|
}
|
|
107
106
|
|
|
@@ -162,7 +161,17 @@ function renderComponentSubTree(instance, slotScopeId) {
|
|
|
162
161
|
const comp = instance.type;
|
|
163
162
|
const { getBuffer, push } = createBuffer();
|
|
164
163
|
if (isFunction(comp)) {
|
|
165
|
-
|
|
164
|
+
let root = renderComponentRoot(instance);
|
|
165
|
+
// #5817 scope ID attrs not falling through if functional component doesn't
|
|
166
|
+
// have props
|
|
167
|
+
if (!comp.props) {
|
|
168
|
+
for (const key in instance.attrs) {
|
|
169
|
+
if (key.startsWith(`data-v-`)) {
|
|
170
|
+
(root.props || (root.props = {}))[key] = ``;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
renderVNode(push, (instance.subTree = root), instance, slotScopeId);
|
|
166
175
|
}
|
|
167
176
|
else {
|
|
168
177
|
if ((!instance.render || instance.render === NOOP) &&
|
|
@@ -610,9 +619,11 @@ function ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push,
|
|
|
610
619
|
fallbackRenderFn();
|
|
611
620
|
}
|
|
612
621
|
}
|
|
613
|
-
const commentRE =
|
|
622
|
+
const commentRE = /<!--[^]*?-->/gm;
|
|
614
623
|
function isComment(item) {
|
|
615
|
-
return typeof item === 'string' &&
|
|
624
|
+
return (typeof item === 'string' &&
|
|
625
|
+
commentRE.test(item) &&
|
|
626
|
+
!item.replace(commentRE, '').trim());
|
|
616
627
|
}
|
|
617
628
|
|
|
618
629
|
function ssrInterpolate(value) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/server-renderer",
|
|
3
|
-
"version": "3.2.34
|
|
3
|
+
"version": "3.2.34",
|
|
4
4
|
"description": "@vue/server-renderer",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/server-renderer.esm-bundler.js",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
},
|
|
32
32
|
"homepage": "https://github.com/vuejs/core/tree/main/packages/server-renderer#readme",
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"vue": "3.2.34
|
|
34
|
+
"vue": "3.2.34"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@vue/shared": "3.2.34
|
|
38
|
-
"@vue/compiler-ssr": "3.2.34
|
|
37
|
+
"@vue/shared": "3.2.34",
|
|
38
|
+
"@vue/compiler-ssr": "3.2.34"
|
|
39
39
|
}
|
|
40
40
|
}
|