@vue/server-renderer 3.5.42 → 3.5.44
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/server-renderer v3.5.
|
|
2
|
+
* @vue/server-renderer v3.5.44
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -232,9 +232,11 @@ function ssrRenderList(source, renderItem) {
|
|
|
232
232
|
}
|
|
233
233
|
} else if (typeof source === "number") {
|
|
234
234
|
if (!Number.isInteger(source) || source < 0) {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
235
|
+
{
|
|
236
|
+
Vue.warn(
|
|
237
|
+
`The v-for range expects a positive integer value but got ${source}.`
|
|
238
|
+
);
|
|
239
|
+
}
|
|
238
240
|
return;
|
|
239
241
|
}
|
|
240
242
|
for (let i = 0; i < source; i++) {
|
|
@@ -426,23 +428,28 @@ function renderComponentVNode(vnode, parentComponent = null, slotScopeId) {
|
|
|
426
428
|
popWarningContext();
|
|
427
429
|
const hasAsyncSetup = shared.isPromise(res);
|
|
428
430
|
let prefetches = instance.sp;
|
|
431
|
+
let p;
|
|
429
432
|
if (hasAsyncSetup || prefetches) {
|
|
430
|
-
|
|
433
|
+
p = Promise.resolve(res).then(() => {
|
|
431
434
|
if (hasAsyncSetup) prefetches = instance.sp;
|
|
432
435
|
if (prefetches) {
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
+
try {
|
|
437
|
+
return Promise.all(
|
|
438
|
+
prefetches.map((prefetch) => prefetch.call(instance.proxy))
|
|
439
|
+
).catch(shared.NOOP);
|
|
440
|
+
} catch {
|
|
441
|
+
}
|
|
436
442
|
}
|
|
437
|
-
}).
|
|
438
|
-
return p.then(() => renderComponentSubTree(instance, slotScopeId));
|
|
443
|
+
}).then(() => renderComponentSubTree(instance, slotScopeId));
|
|
439
444
|
} else {
|
|
440
445
|
try {
|
|
441
446
|
return renderComponentSubTree(instance, slotScopeId);
|
|
442
447
|
} catch (err) {
|
|
443
|
-
|
|
448
|
+
p = Promise.reject(err);
|
|
444
449
|
}
|
|
445
450
|
}
|
|
451
|
+
p.catch(shared.NOOP);
|
|
452
|
+
return p;
|
|
446
453
|
}
|
|
447
454
|
function renderComponentSubTree(instance, slotScopeId) {
|
|
448
455
|
pushWarningContext(instance.vnode);
|
|
@@ -613,13 +620,13 @@ function renderElementVNode(push, vnode, parentComponent, slotScopeId) {
|
|
|
613
620
|
if (!shared.isVoidTag(tag)) {
|
|
614
621
|
let hasChildrenOverride = false;
|
|
615
622
|
if (props) {
|
|
616
|
-
if (props.innerHTML) {
|
|
623
|
+
if (props.innerHTML != null) {
|
|
617
624
|
hasChildrenOverride = true;
|
|
618
|
-
push(props.innerHTML);
|
|
619
|
-
} else if (props.textContent) {
|
|
625
|
+
push(String(props.innerHTML));
|
|
626
|
+
} else if (props.textContent != null) {
|
|
620
627
|
hasChildrenOverride = true;
|
|
621
628
|
push(shared.escapeHtml(props.textContent));
|
|
622
|
-
} else if (tag === "textarea" && props.value) {
|
|
629
|
+
} else if (tag === "textarea" && props.value != null) {
|
|
623
630
|
hasChildrenOverride = true;
|
|
624
631
|
push(shared.escapeHtml(props.value));
|
|
625
632
|
}
|
|
@@ -735,15 +742,50 @@ async function renderToString(input, context = {}) {
|
|
|
735
742
|
const vnode = Vue.createVNode(input._component, input._props);
|
|
736
743
|
vnode.appContext = input._context;
|
|
737
744
|
input.provide(Vue.ssrContextKey, context);
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
745
|
+
let buffer;
|
|
746
|
+
let result;
|
|
747
|
+
try {
|
|
748
|
+
buffer = await renderComponentVNode(vnode);
|
|
749
|
+
result = await unrollBuffer$1(buffer);
|
|
750
|
+
await resolveTeleports(context);
|
|
751
|
+
} catch (err) {
|
|
752
|
+
cleanupFailedRender(buffer, context);
|
|
753
|
+
throw err;
|
|
754
|
+
}
|
|
755
|
+
stopWatchers(context);
|
|
756
|
+
return result;
|
|
757
|
+
}
|
|
758
|
+
function stopWatchers(context, start = 0) {
|
|
759
|
+
const handles = context.__watcherHandles;
|
|
760
|
+
if (handles) {
|
|
761
|
+
for (let i = start; i < handles.length; i++) {
|
|
762
|
+
handles[i]();
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
function cleanupFailedRender(buffer, context) {
|
|
767
|
+
const stopped = context.__watcherHandles ? context.__watcherHandles.length : 0;
|
|
768
|
+
try {
|
|
769
|
+
stopWatchers(context);
|
|
770
|
+
} catch {
|
|
771
|
+
}
|
|
772
|
+
(async () => {
|
|
773
|
+
if (buffer) await settleBuffer(buffer);
|
|
774
|
+
for (const key in context.__teleportBuffers) {
|
|
775
|
+
await settleBuffer(context.__teleportBuffers[key]);
|
|
776
|
+
}
|
|
777
|
+
stopWatchers(context, stopped);
|
|
778
|
+
})().catch(shared.NOOP);
|
|
779
|
+
}
|
|
780
|
+
async function settleBuffer(buffer) {
|
|
781
|
+
if (!buffer.hasAsync) return;
|
|
782
|
+
for (let item of buffer) {
|
|
783
|
+
try {
|
|
784
|
+
if (shared.isPromise(item)) item = await item;
|
|
785
|
+
if (!shared.isString(item)) await settleBuffer(item);
|
|
786
|
+
} catch {
|
|
744
787
|
}
|
|
745
788
|
}
|
|
746
|
-
return result;
|
|
747
789
|
}
|
|
748
790
|
async function resolveTeleports(context) {
|
|
749
791
|
if (context.__teleportBuffers) {
|
|
@@ -795,13 +837,17 @@ function renderToSimpleStream(input, context, stream) {
|
|
|
795
837
|
const vnode = Vue.createVNode(input._component, input._props);
|
|
796
838
|
vnode.appContext = input._context;
|
|
797
839
|
input.provide(Vue.ssrContextKey, context);
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
840
|
+
let buffer;
|
|
841
|
+
Promise.resolve(renderComponentVNode(vnode)).then((b) => unrollBuffer(buffer = b, stream)).then(() => resolveTeleports(context)).then(
|
|
842
|
+
() => {
|
|
843
|
+
stopWatchers(context);
|
|
844
|
+
stream.push(null);
|
|
845
|
+
},
|
|
846
|
+
(error) => {
|
|
847
|
+
cleanupFailedRender(buffer, context);
|
|
848
|
+
throw error;
|
|
803
849
|
}
|
|
804
|
-
|
|
850
|
+
).catch((error) => {
|
|
805
851
|
stream.destroy(error);
|
|
806
852
|
});
|
|
807
853
|
return stream;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/server-renderer v3.5.
|
|
2
|
+
* @vue/server-renderer v3.5.44
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -231,6 +231,9 @@ function ssrRenderList(source, renderItem) {
|
|
|
231
231
|
renderItem(source[i], i);
|
|
232
232
|
}
|
|
233
233
|
} else if (typeof source === "number") {
|
|
234
|
+
if (!Number.isInteger(source) || source < 0) {
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
234
237
|
for (let i = 0; i < source; i++) {
|
|
235
238
|
renderItem(i + 1, i);
|
|
236
239
|
}
|
|
@@ -411,23 +414,28 @@ function renderComponentVNode(vnode, parentComponent = null, slotScopeId) {
|
|
|
411
414
|
);
|
|
412
415
|
const hasAsyncSetup = shared.isPromise(res);
|
|
413
416
|
let prefetches = instance.sp;
|
|
417
|
+
let p;
|
|
414
418
|
if (hasAsyncSetup || prefetches) {
|
|
415
|
-
|
|
419
|
+
p = Promise.resolve(res).then(() => {
|
|
416
420
|
if (hasAsyncSetup) prefetches = instance.sp;
|
|
417
421
|
if (prefetches) {
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
422
|
+
try {
|
|
423
|
+
return Promise.all(
|
|
424
|
+
prefetches.map((prefetch) => prefetch.call(instance.proxy))
|
|
425
|
+
).catch(shared.NOOP);
|
|
426
|
+
} catch {
|
|
427
|
+
}
|
|
421
428
|
}
|
|
422
|
-
}).
|
|
423
|
-
return p.then(() => renderComponentSubTree(instance, slotScopeId));
|
|
429
|
+
}).then(() => renderComponentSubTree(instance, slotScopeId));
|
|
424
430
|
} else {
|
|
425
431
|
try {
|
|
426
432
|
return renderComponentSubTree(instance, slotScopeId);
|
|
427
433
|
} catch (err) {
|
|
428
|
-
|
|
434
|
+
p = Promise.reject(err);
|
|
429
435
|
}
|
|
430
436
|
}
|
|
437
|
+
p.catch(shared.NOOP);
|
|
438
|
+
return p;
|
|
431
439
|
}
|
|
432
440
|
function renderComponentSubTree(instance, slotScopeId) {
|
|
433
441
|
const comp = instance.type;
|
|
@@ -596,13 +604,13 @@ function renderElementVNode(push, vnode, parentComponent, slotScopeId) {
|
|
|
596
604
|
if (!shared.isVoidTag(tag)) {
|
|
597
605
|
let hasChildrenOverride = false;
|
|
598
606
|
if (props) {
|
|
599
|
-
if (props.innerHTML) {
|
|
607
|
+
if (props.innerHTML != null) {
|
|
600
608
|
hasChildrenOverride = true;
|
|
601
|
-
push(props.innerHTML);
|
|
602
|
-
} else if (props.textContent) {
|
|
609
|
+
push(String(props.innerHTML));
|
|
610
|
+
} else if (props.textContent != null) {
|
|
603
611
|
hasChildrenOverride = true;
|
|
604
612
|
push(shared.escapeHtml(props.textContent));
|
|
605
|
-
} else if (tag === "textarea" && props.value) {
|
|
613
|
+
} else if (tag === "textarea" && props.value != null) {
|
|
606
614
|
hasChildrenOverride = true;
|
|
607
615
|
push(shared.escapeHtml(props.value));
|
|
608
616
|
}
|
|
@@ -718,15 +726,50 @@ async function renderToString(input, context = {}) {
|
|
|
718
726
|
const vnode = Vue.createVNode(input._component, input._props);
|
|
719
727
|
vnode.appContext = input._context;
|
|
720
728
|
input.provide(Vue.ssrContextKey, context);
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
729
|
+
let buffer;
|
|
730
|
+
let result;
|
|
731
|
+
try {
|
|
732
|
+
buffer = await renderComponentVNode(vnode);
|
|
733
|
+
result = await unrollBuffer$1(buffer);
|
|
734
|
+
await resolveTeleports(context);
|
|
735
|
+
} catch (err) {
|
|
736
|
+
cleanupFailedRender(buffer, context);
|
|
737
|
+
throw err;
|
|
738
|
+
}
|
|
739
|
+
stopWatchers(context);
|
|
740
|
+
return result;
|
|
741
|
+
}
|
|
742
|
+
function stopWatchers(context, start = 0) {
|
|
743
|
+
const handles = context.__watcherHandles;
|
|
744
|
+
if (handles) {
|
|
745
|
+
for (let i = start; i < handles.length; i++) {
|
|
746
|
+
handles[i]();
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
function cleanupFailedRender(buffer, context) {
|
|
751
|
+
const stopped = context.__watcherHandles ? context.__watcherHandles.length : 0;
|
|
752
|
+
try {
|
|
753
|
+
stopWatchers(context);
|
|
754
|
+
} catch {
|
|
755
|
+
}
|
|
756
|
+
(async () => {
|
|
757
|
+
if (buffer) await settleBuffer(buffer);
|
|
758
|
+
for (const key in context.__teleportBuffers) {
|
|
759
|
+
await settleBuffer(context.__teleportBuffers[key]);
|
|
760
|
+
}
|
|
761
|
+
stopWatchers(context, stopped);
|
|
762
|
+
})().catch(shared.NOOP);
|
|
763
|
+
}
|
|
764
|
+
async function settleBuffer(buffer) {
|
|
765
|
+
if (!buffer.hasAsync) return;
|
|
766
|
+
for (let item of buffer) {
|
|
767
|
+
try {
|
|
768
|
+
if (shared.isPromise(item)) item = await item;
|
|
769
|
+
if (!shared.isString(item)) await settleBuffer(item);
|
|
770
|
+
} catch {
|
|
727
771
|
}
|
|
728
772
|
}
|
|
729
|
-
return result;
|
|
730
773
|
}
|
|
731
774
|
async function resolveTeleports(context) {
|
|
732
775
|
if (context.__teleportBuffers) {
|
|
@@ -778,13 +821,17 @@ function renderToSimpleStream(input, context, stream) {
|
|
|
778
821
|
const vnode = Vue.createVNode(input._component, input._props);
|
|
779
822
|
vnode.appContext = input._context;
|
|
780
823
|
input.provide(Vue.ssrContextKey, context);
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
824
|
+
let buffer;
|
|
825
|
+
Promise.resolve(renderComponentVNode(vnode)).then((b) => unrollBuffer(buffer = b, stream)).then(() => resolveTeleports(context)).then(
|
|
826
|
+
() => {
|
|
827
|
+
stopWatchers(context);
|
|
828
|
+
stream.push(null);
|
|
829
|
+
},
|
|
830
|
+
(error) => {
|
|
831
|
+
cleanupFailedRender(buffer, context);
|
|
832
|
+
throw error;
|
|
786
833
|
}
|
|
787
|
-
|
|
834
|
+
).catch((error) => {
|
|
788
835
|
stream.destroy(error);
|
|
789
836
|
});
|
|
790
837
|
return stream;
|