@vue/server-renderer 3.5.0-alpha.2 → 3.5.0-alpha.4
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/dist/server-renderer.cjs.js +63 -51
- package/dist/server-renderer.cjs.prod.js +42 -32
- package/dist/server-renderer.d.ts +1 -2
- package/dist/server-renderer.esm-browser.js +2059 -2046
- package/dist/server-renderer.esm-browser.prod.js +2 -4
- package/dist/server-renderer.esm-bundler.js +70 -57
- package/package.json +4 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/server-renderer v3.5.0-alpha.
|
|
2
|
+
* @vue/server-renderer v3.5.0-alpha.4
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -148,13 +148,11 @@ function ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push,
|
|
|
148
148
|
fallbackRenderFn();
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
|
-
const commentTestRE =
|
|
151
|
+
const commentTestRE = /^<!--[\s\S]*-->$/;
|
|
152
152
|
const commentRE = /<!--[^]*?-->/gm;
|
|
153
153
|
function isComment(item) {
|
|
154
|
-
if (typeof item !== "string" || !commentTestRE.test(item))
|
|
155
|
-
|
|
156
|
-
if (item.length <= 8)
|
|
157
|
-
return true;
|
|
154
|
+
if (typeof item !== "string" || !commentTestRE.test(item)) return false;
|
|
155
|
+
if (item.length <= 8) return true;
|
|
158
156
|
return !item.replace(commentRE, "").trim();
|
|
159
157
|
}
|
|
160
158
|
|
|
@@ -188,7 +186,7 @@ function toRaw(observed) {
|
|
|
188
186
|
}
|
|
189
187
|
|
|
190
188
|
function isRef(r) {
|
|
191
|
-
return r ? r
|
|
189
|
+
return r ? r["__v_isRef"] === true : false;
|
|
192
190
|
}
|
|
193
191
|
|
|
194
192
|
const stack = [];
|
|
@@ -198,7 +196,10 @@ function pushWarningContext(vnode) {
|
|
|
198
196
|
function popWarningContext() {
|
|
199
197
|
stack.pop();
|
|
200
198
|
}
|
|
199
|
+
let isWarning = false;
|
|
201
200
|
function warn$1(msg, ...args) {
|
|
201
|
+
if (isWarning) return;
|
|
202
|
+
isWarning = true;
|
|
202
203
|
const instance = stack.length ? stack[stack.length - 1].component : null;
|
|
203
204
|
const appWarnHandler = instance && instance.appContext.config.warnHandler;
|
|
204
205
|
const trace = getComponentTrace();
|
|
@@ -208,6 +209,7 @@ function warn$1(msg, ...args) {
|
|
|
208
209
|
instance,
|
|
209
210
|
11,
|
|
210
211
|
[
|
|
212
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
211
213
|
msg + args.map((a) => {
|
|
212
214
|
var _a, _b;
|
|
213
215
|
return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
|
|
@@ -228,6 +230,7 @@ function warn$1(msg, ...args) {
|
|
|
228
230
|
}
|
|
229
231
|
console.warn(...warnArgs);
|
|
230
232
|
}
|
|
233
|
+
isWarning = false;
|
|
231
234
|
}
|
|
232
235
|
function getComponentTrace() {
|
|
233
236
|
let currentVNode = stack[stack.length - 1];
|
|
@@ -326,8 +329,9 @@ const ErrorTypeStrings = {
|
|
|
326
329
|
[11]: "app warnHandler",
|
|
327
330
|
[12]: "ref function",
|
|
328
331
|
[13]: "async component loader",
|
|
329
|
-
[14]: "scheduler flush
|
|
330
|
-
[15]: "
|
|
332
|
+
[14]: "scheduler flush",
|
|
333
|
+
[15]: "component update",
|
|
334
|
+
[16]: "app unmount cleanup function"
|
|
331
335
|
};
|
|
332
336
|
function callWithErrorHandling(fn, instance, type, args) {
|
|
333
337
|
try {
|
|
@@ -338,6 +342,7 @@ function callWithErrorHandling(fn, instance, type, args) {
|
|
|
338
342
|
}
|
|
339
343
|
function handleError(err, instance, type, throwInDev = true) {
|
|
340
344
|
const contextVNode = instance ? instance.vnode : null;
|
|
345
|
+
const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || shared.EMPTY_OBJ;
|
|
341
346
|
if (instance) {
|
|
342
347
|
let cur = instance.parent;
|
|
343
348
|
const exposedInstance = instance.proxy;
|
|
@@ -353,20 +358,18 @@ function handleError(err, instance, type, throwInDev = true) {
|
|
|
353
358
|
}
|
|
354
359
|
cur = cur.parent;
|
|
355
360
|
}
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
[err, exposedInstance, errorInfo]
|
|
363
|
-
);
|
|
361
|
+
if (errorHandler) {
|
|
362
|
+
callWithErrorHandling(errorHandler, null, 10, [
|
|
363
|
+
err,
|
|
364
|
+
exposedInstance,
|
|
365
|
+
errorInfo
|
|
366
|
+
]);
|
|
364
367
|
return;
|
|
365
368
|
}
|
|
366
369
|
}
|
|
367
|
-
logError(err, type, contextVNode, throwInDev);
|
|
370
|
+
logError(err, type, contextVNode, throwInDev, throwUnhandledErrorInProduction);
|
|
368
371
|
}
|
|
369
|
-
function logError(err, type, contextVNode, throwInDev = true) {
|
|
372
|
+
function logError(err, type, contextVNode, throwInDev = true, throwInProd = false) {
|
|
370
373
|
{
|
|
371
374
|
const info = ErrorTypeStrings[type];
|
|
372
375
|
if (contextVNode) {
|
|
@@ -388,14 +391,11 @@ function logError(err, type, contextVNode, throwInDev = true) {
|
|
|
388
391
|
const g = shared.getGlobalThis();
|
|
389
392
|
const registerGlobalSetter = (key, setter) => {
|
|
390
393
|
let setters;
|
|
391
|
-
if (!(setters = g[key]))
|
|
392
|
-
setters = g[key] = [];
|
|
394
|
+
if (!(setters = g[key])) setters = g[key] = [];
|
|
393
395
|
setters.push(setter);
|
|
394
396
|
return (v) => {
|
|
395
|
-
if (setters.length > 1)
|
|
396
|
-
|
|
397
|
-
else
|
|
398
|
-
setters[0](v);
|
|
397
|
+
if (setters.length > 1) setters.forEach((set) => set(v));
|
|
398
|
+
else setters[0](v);
|
|
399
399
|
};
|
|
400
400
|
};
|
|
401
401
|
registerGlobalSetter(
|
|
@@ -479,7 +479,7 @@ function ssrGetDirectiveProps(instance, dir, value, arg, modifiers = {}) {
|
|
|
479
479
|
return dir.getSSRProps(
|
|
480
480
|
{
|
|
481
481
|
dir,
|
|
482
|
-
instance,
|
|
482
|
+
instance: Vue.ssrUtils.getComponentPublicInstance(instance.$),
|
|
483
483
|
value,
|
|
484
484
|
oldValue: void 0,
|
|
485
485
|
arg,
|
|
@@ -609,9 +609,9 @@ function createBuffer() {
|
|
|
609
609
|
const isStringItem = shared.isString(item);
|
|
610
610
|
if (appendable && isStringItem) {
|
|
611
611
|
buffer[buffer.length - 1] += item;
|
|
612
|
-
|
|
613
|
-
buffer.push(item);
|
|
612
|
+
return;
|
|
614
613
|
}
|
|
614
|
+
buffer.push(item);
|
|
615
615
|
appendable = isStringItem;
|
|
616
616
|
if (shared.isPromise(item) || shared.isArray(item) && item.hasAsync) {
|
|
617
617
|
buffer.hasAsync = true;
|
|
@@ -681,9 +681,11 @@ function renderComponentSubTree(instance, slotScopeId) {
|
|
|
681
681
|
}
|
|
682
682
|
}
|
|
683
683
|
if (slotScopeId) {
|
|
684
|
-
if (!hasCloned)
|
|
685
|
-
|
|
686
|
-
|
|
684
|
+
if (!hasCloned) attrs = { ...attrs };
|
|
685
|
+
const slotScopeIdList = slotScopeId.trim().split(" ");
|
|
686
|
+
for (let i = 0; i < slotScopeIdList.length; i++) {
|
|
687
|
+
attrs[slotScopeIdList[i]] = "";
|
|
688
|
+
}
|
|
687
689
|
}
|
|
688
690
|
const prev = setCurrentRenderingInstance(instance);
|
|
689
691
|
try {
|
|
@@ -830,8 +832,7 @@ function applySSRDirectives(vnode, rawProps, dirs) {
|
|
|
830
832
|
} = binding;
|
|
831
833
|
if (getSSRProps) {
|
|
832
834
|
const props = getSSRProps(binding, vnode);
|
|
833
|
-
if (props)
|
|
834
|
-
toMerge.push(props);
|
|
835
|
+
if (props) toMerge.push(props);
|
|
835
836
|
}
|
|
836
837
|
}
|
|
837
838
|
return Vue.mergeProps(rawProps || {}, ...toMerge);
|
|
@@ -868,24 +869,36 @@ function renderTeleportVNode(push, vnode, parentComponent, slotScopeId) {
|
|
|
868
869
|
}
|
|
869
870
|
|
|
870
871
|
const { isVNode: isVNode$1 } = Vue.ssrUtils;
|
|
871
|
-
|
|
872
|
-
if (buffer.hasAsync) {
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
} else {
|
|
882
|
-
ret += await unrollBuffer$1(item);
|
|
883
|
-
}
|
|
872
|
+
function nestedUnrollBuffer(buffer, parentRet, startIndex) {
|
|
873
|
+
if (!buffer.hasAsync) {
|
|
874
|
+
return parentRet + unrollBufferSync$1(buffer);
|
|
875
|
+
}
|
|
876
|
+
let ret = parentRet;
|
|
877
|
+
for (let i = startIndex; i < buffer.length; i += 1) {
|
|
878
|
+
const item = buffer[i];
|
|
879
|
+
if (shared.isString(item)) {
|
|
880
|
+
ret += item;
|
|
881
|
+
continue;
|
|
884
882
|
}
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
883
|
+
if (shared.isPromise(item)) {
|
|
884
|
+
return item.then((nestedItem) => {
|
|
885
|
+
buffer[i] = nestedItem;
|
|
886
|
+
return nestedUnrollBuffer(buffer, ret, i);
|
|
887
|
+
});
|
|
888
|
+
}
|
|
889
|
+
const result = nestedUnrollBuffer(item, ret, 0);
|
|
890
|
+
if (shared.isPromise(result)) {
|
|
891
|
+
return result.then((nestedItem) => {
|
|
892
|
+
buffer[i] = nestedItem;
|
|
893
|
+
return nestedUnrollBuffer(buffer, "", i);
|
|
894
|
+
});
|
|
895
|
+
}
|
|
896
|
+
ret = result;
|
|
888
897
|
}
|
|
898
|
+
return ret;
|
|
899
|
+
}
|
|
900
|
+
function unrollBuffer$1(buffer) {
|
|
901
|
+
return nestedUnrollBuffer(buffer, "", 0);
|
|
889
902
|
}
|
|
890
903
|
function unrollBufferSync$1(buffer) {
|
|
891
904
|
let ret = "";
|
|
@@ -1019,8 +1032,7 @@ function renderToWebStream(input, context = {}) {
|
|
|
1019
1032
|
start(controller) {
|
|
1020
1033
|
renderToSimpleStream(input, context, {
|
|
1021
1034
|
push(content) {
|
|
1022
|
-
if (cancelled)
|
|
1023
|
-
return;
|
|
1035
|
+
if (cancelled) return;
|
|
1024
1036
|
if (content != null) {
|
|
1025
1037
|
controller.enqueue(encoder.encode(content));
|
|
1026
1038
|
} else {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/server-renderer v3.5.0-alpha.
|
|
2
|
+
* @vue/server-renderer v3.5.0-alpha.4
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -148,13 +148,11 @@ function ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push,
|
|
|
148
148
|
fallbackRenderFn();
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
|
-
const commentTestRE =
|
|
151
|
+
const commentTestRE = /^<!--[\s\S]*-->$/;
|
|
152
152
|
const commentRE = /<!--[^]*?-->/gm;
|
|
153
153
|
function isComment(item) {
|
|
154
|
-
if (typeof item !== "string" || !commentTestRE.test(item))
|
|
155
|
-
|
|
156
|
-
if (item.length <= 8)
|
|
157
|
-
return true;
|
|
154
|
+
if (typeof item !== "string" || !commentTestRE.test(item)) return false;
|
|
155
|
+
if (item.length <= 8) return true;
|
|
158
156
|
return !item.replace(commentRE, "").trim();
|
|
159
157
|
}
|
|
160
158
|
|
|
@@ -220,7 +218,7 @@ function ssrGetDirectiveProps(instance, dir, value, arg, modifiers = {}) {
|
|
|
220
218
|
return dir.getSSRProps(
|
|
221
219
|
{
|
|
222
220
|
dir,
|
|
223
|
-
instance,
|
|
221
|
+
instance: Vue.ssrUtils.getComponentPublicInstance(instance.$),
|
|
224
222
|
value,
|
|
225
223
|
oldValue: void 0,
|
|
226
224
|
arg,
|
|
@@ -343,9 +341,9 @@ function createBuffer() {
|
|
|
343
341
|
const isStringItem = shared.isString(item);
|
|
344
342
|
if (appendable && isStringItem) {
|
|
345
343
|
buffer[buffer.length - 1] += item;
|
|
346
|
-
|
|
347
|
-
buffer.push(item);
|
|
344
|
+
return;
|
|
348
345
|
}
|
|
346
|
+
buffer.push(item);
|
|
349
347
|
appendable = isStringItem;
|
|
350
348
|
if (shared.isPromise(item) || shared.isArray(item) && item.hasAsync) {
|
|
351
349
|
buffer.hasAsync = true;
|
|
@@ -415,9 +413,11 @@ function renderComponentSubTree(instance, slotScopeId) {
|
|
|
415
413
|
}
|
|
416
414
|
}
|
|
417
415
|
if (slotScopeId) {
|
|
418
|
-
if (!hasCloned)
|
|
419
|
-
|
|
420
|
-
|
|
416
|
+
if (!hasCloned) attrs = { ...attrs };
|
|
417
|
+
const slotScopeIdList = slotScopeId.trim().split(" ");
|
|
418
|
+
for (let i = 0; i < slotScopeIdList.length; i++) {
|
|
419
|
+
attrs[slotScopeIdList[i]] = "";
|
|
420
|
+
}
|
|
421
421
|
}
|
|
422
422
|
const prev = setCurrentRenderingInstance(instance);
|
|
423
423
|
try {
|
|
@@ -564,8 +564,7 @@ function applySSRDirectives(vnode, rawProps, dirs) {
|
|
|
564
564
|
} = binding;
|
|
565
565
|
if (getSSRProps) {
|
|
566
566
|
const props = getSSRProps(binding, vnode);
|
|
567
|
-
if (props)
|
|
568
|
-
toMerge.push(props);
|
|
567
|
+
if (props) toMerge.push(props);
|
|
569
568
|
}
|
|
570
569
|
}
|
|
571
570
|
return Vue.mergeProps(rawProps || {}, ...toMerge);
|
|
@@ -602,24 +601,36 @@ function renderTeleportVNode(push, vnode, parentComponent, slotScopeId) {
|
|
|
602
601
|
}
|
|
603
602
|
|
|
604
603
|
const { isVNode: isVNode$1 } = Vue.ssrUtils;
|
|
605
|
-
|
|
606
|
-
if (buffer.hasAsync) {
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
} else {
|
|
616
|
-
ret += await unrollBuffer$1(item);
|
|
617
|
-
}
|
|
604
|
+
function nestedUnrollBuffer(buffer, parentRet, startIndex) {
|
|
605
|
+
if (!buffer.hasAsync) {
|
|
606
|
+
return parentRet + unrollBufferSync$1(buffer);
|
|
607
|
+
}
|
|
608
|
+
let ret = parentRet;
|
|
609
|
+
for (let i = startIndex; i < buffer.length; i += 1) {
|
|
610
|
+
const item = buffer[i];
|
|
611
|
+
if (shared.isString(item)) {
|
|
612
|
+
ret += item;
|
|
613
|
+
continue;
|
|
618
614
|
}
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
615
|
+
if (shared.isPromise(item)) {
|
|
616
|
+
return item.then((nestedItem) => {
|
|
617
|
+
buffer[i] = nestedItem;
|
|
618
|
+
return nestedUnrollBuffer(buffer, ret, i);
|
|
619
|
+
});
|
|
620
|
+
}
|
|
621
|
+
const result = nestedUnrollBuffer(item, ret, 0);
|
|
622
|
+
if (shared.isPromise(result)) {
|
|
623
|
+
return result.then((nestedItem) => {
|
|
624
|
+
buffer[i] = nestedItem;
|
|
625
|
+
return nestedUnrollBuffer(buffer, "", i);
|
|
626
|
+
});
|
|
627
|
+
}
|
|
628
|
+
ret = result;
|
|
622
629
|
}
|
|
630
|
+
return ret;
|
|
631
|
+
}
|
|
632
|
+
function unrollBuffer$1(buffer) {
|
|
633
|
+
return nestedUnrollBuffer(buffer, "", 0);
|
|
623
634
|
}
|
|
624
635
|
function unrollBufferSync$1(buffer) {
|
|
625
636
|
let ret = "";
|
|
@@ -753,8 +764,7 @@ function renderToWebStream(input, context = {}) {
|
|
|
753
764
|
start(controller) {
|
|
754
765
|
renderToSimpleStream(input, context, {
|
|
755
766
|
push(content) {
|
|
756
|
-
if (cancelled)
|
|
757
|
-
return;
|
|
767
|
+
if (cancelled) return;
|
|
758
768
|
if (content != null) {
|
|
759
769
|
controller.enqueue(encoder.encode(content));
|
|
760
770
|
} else {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { VNode, ComponentInternalInstance, App, Slots, Component } from 'vue';
|
|
2
|
+
import { VNode, ComponentInternalInstance, App, Slots, Component, ComponentPublicInstance, Directive } from 'vue';
|
|
3
3
|
import { Readable, Writable } from 'node:stream';
|
|
4
|
-
import { ComponentPublicInstance, Directive } from '@vue/runtime-core';
|
|
5
4
|
export { includeBooleanAttr as ssrIncludeBooleanAttr } from '@vue/shared';
|
|
6
5
|
|
|
7
6
|
type SSRBuffer = SSRBufferItem[] & {
|