@vue/server-renderer 3.2.26 → 3.2.30
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.
|
@@ -197,7 +197,7 @@ function renderComponentVNode(vnode, parentComponent = null, slotScopeId) {
|
|
|
197
197
|
const instance = createComponentInstance(vnode, parentComponent, null);
|
|
198
198
|
const res = setupComponent(instance, true /* isSSR */);
|
|
199
199
|
const hasAsyncSetup = shared.isPromise(res);
|
|
200
|
-
const prefetches = instance.sp;
|
|
200
|
+
const prefetches = instance.sp; /* LifecycleHooks.SERVER_PREFETCH */
|
|
201
201
|
if (hasAsyncSetup || prefetches) {
|
|
202
202
|
let p = hasAsyncSetup
|
|
203
203
|
? res
|
|
@@ -227,6 +227,12 @@ function renderComponentSubTree(instance, slotScopeId) {
|
|
|
227
227
|
shared.isString(comp.template)) {
|
|
228
228
|
comp.ssrRender = ssrCompile(comp.template, instance);
|
|
229
229
|
}
|
|
230
|
+
// perf: enable caching of computed getters during render
|
|
231
|
+
// since there cannot be state mutations during render.
|
|
232
|
+
for (const e of instance.scope.effects) {
|
|
233
|
+
if (e.computed)
|
|
234
|
+
e.computed._cacheable = true;
|
|
235
|
+
}
|
|
230
236
|
const ssrRender = instance.ssrRender || comp.ssrRender;
|
|
231
237
|
if (ssrRender) {
|
|
232
238
|
// optimized
|
|
@@ -679,39 +685,7 @@ function toRaw(observed) {
|
|
|
679
685
|
}
|
|
680
686
|
|
|
681
687
|
function isRef(r) {
|
|
682
|
-
return
|
|
683
|
-
}
|
|
684
|
-
|
|
685
|
-
const classifyRE = /(?:^|[-_])(\w)/g;
|
|
686
|
-
const classify = (str) => str.replace(classifyRE, c => c.toUpperCase()).replace(/[-_]/g, '');
|
|
687
|
-
function getComponentName(Component) {
|
|
688
|
-
return shared.isFunction(Component)
|
|
689
|
-
? Component.displayName || Component.name
|
|
690
|
-
: Component.name;
|
|
691
|
-
}
|
|
692
|
-
/* istanbul ignore next */
|
|
693
|
-
function formatComponentName(instance, Component, isRoot = false) {
|
|
694
|
-
let name = getComponentName(Component);
|
|
695
|
-
if (!name && Component.__file) {
|
|
696
|
-
const match = Component.__file.match(/([^/\\]+)\.\w+$/);
|
|
697
|
-
if (match) {
|
|
698
|
-
name = match[1];
|
|
699
|
-
}
|
|
700
|
-
}
|
|
701
|
-
if (!name && instance && instance.parent) {
|
|
702
|
-
// try to infer the name based on reverse resolution
|
|
703
|
-
const inferFromRegistry = (registry) => {
|
|
704
|
-
for (const key in registry) {
|
|
705
|
-
if (registry[key] === Component) {
|
|
706
|
-
return key;
|
|
707
|
-
}
|
|
708
|
-
}
|
|
709
|
-
};
|
|
710
|
-
name =
|
|
711
|
-
inferFromRegistry(instance.components ||
|
|
712
|
-
instance.parent.type.components) || inferFromRegistry(instance.appContext.components);
|
|
713
|
-
}
|
|
714
|
-
return name ? classify(name) : isRoot ? `App` : `Anonymous`;
|
|
688
|
+
return !!(r && r.__v_isRef === true);
|
|
715
689
|
}
|
|
716
690
|
|
|
717
691
|
const stack = [];
|
|
@@ -854,7 +828,7 @@ const ErrorTypeStrings = {
|
|
|
854
828
|
[12 /* FUNCTION_REF */]: 'ref function',
|
|
855
829
|
[13 /* ASYNC_COMPONENT_LOADER */]: 'async component loader',
|
|
856
830
|
[14 /* SCHEDULER */]: 'scheduler flush. This is likely a Vue internals bug. ' +
|
|
857
|
-
'Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/
|
|
831
|
+
'Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core'
|
|
858
832
|
};
|
|
859
833
|
function callWithErrorHandling(fn, instance, type, args) {
|
|
860
834
|
let res;
|
|
@@ -914,6 +888,38 @@ function logError(err, type, contextVNode, throwInDev = true) {
|
|
|
914
888
|
}
|
|
915
889
|
}
|
|
916
890
|
|
|
891
|
+
const classifyRE = /(?:^|[-_])(\w)/g;
|
|
892
|
+
const classify = (str) => str.replace(classifyRE, c => c.toUpperCase()).replace(/[-_]/g, '');
|
|
893
|
+
function getComponentName(Component) {
|
|
894
|
+
return shared.isFunction(Component)
|
|
895
|
+
? Component.displayName || Component.name
|
|
896
|
+
: Component.name;
|
|
897
|
+
}
|
|
898
|
+
/* istanbul ignore next */
|
|
899
|
+
function formatComponentName(instance, Component, isRoot = false) {
|
|
900
|
+
let name = getComponentName(Component);
|
|
901
|
+
if (!name && Component.__file) {
|
|
902
|
+
const match = Component.__file.match(/([^/\\]+)\.\w+$/);
|
|
903
|
+
if (match) {
|
|
904
|
+
name = match[1];
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
if (!name && instance && instance.parent) {
|
|
908
|
+
// try to infer the name based on reverse resolution
|
|
909
|
+
const inferFromRegistry = (registry) => {
|
|
910
|
+
for (const key in registry) {
|
|
911
|
+
if (registry[key] === Component) {
|
|
912
|
+
return key;
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
};
|
|
916
|
+
name =
|
|
917
|
+
inferFromRegistry(instance.components ||
|
|
918
|
+
instance.parent.type.components) || inferFromRegistry(instance.appContext.components);
|
|
919
|
+
}
|
|
920
|
+
return name ? classify(name) : isRoot ? `App` : `Anonymous`;
|
|
921
|
+
}
|
|
922
|
+
|
|
917
923
|
function ssrRenderList(source, renderItem) {
|
|
918
924
|
if (shared.isArray(source) || shared.isString(source)) {
|
|
919
925
|
for (let i = 0, l = source.length; i < l; i++) {
|
|
@@ -957,6 +963,20 @@ function ssrRenderSuspense(push, { default: renderContent }) {
|
|
|
957
963
|
});
|
|
958
964
|
}
|
|
959
965
|
|
|
966
|
+
function ssrGetDirectiveProps(instance, dir, value, arg, modifiers = {}) {
|
|
967
|
+
if (typeof dir !== 'function' && dir.getSSRProps) {
|
|
968
|
+
return (dir.getSSRProps({
|
|
969
|
+
dir,
|
|
970
|
+
instance,
|
|
971
|
+
value,
|
|
972
|
+
oldValue: undefined,
|
|
973
|
+
arg,
|
|
974
|
+
modifiers
|
|
975
|
+
}, null) || {});
|
|
976
|
+
}
|
|
977
|
+
return {};
|
|
978
|
+
}
|
|
979
|
+
|
|
960
980
|
const ssrLooseEqual = shared.looseEqual;
|
|
961
981
|
function ssrLooseContain(arr, value) {
|
|
962
982
|
return shared.looseIndexOf(arr, value) > -1;
|
|
@@ -1001,6 +1021,7 @@ exports.renderToSimpleStream = renderToSimpleStream;
|
|
|
1001
1021
|
exports.renderToStream = renderToStream;
|
|
1002
1022
|
exports.renderToString = renderToString;
|
|
1003
1023
|
exports.renderToWebStream = renderToWebStream;
|
|
1024
|
+
exports.ssrGetDirectiveProps = ssrGetDirectiveProps;
|
|
1004
1025
|
exports.ssrGetDynamicModelProps = ssrGetDynamicModelProps;
|
|
1005
1026
|
exports.ssrInterpolate = ssrInterpolate;
|
|
1006
1027
|
exports.ssrLooseContain = ssrLooseContain;
|
|
@@ -194,7 +194,7 @@ function renderComponentVNode(vnode, parentComponent = null, slotScopeId) {
|
|
|
194
194
|
const instance = createComponentInstance(vnode, parentComponent, null);
|
|
195
195
|
const res = setupComponent(instance, true /* isSSR */);
|
|
196
196
|
const hasAsyncSetup = shared.isPromise(res);
|
|
197
|
-
const prefetches = instance.sp;
|
|
197
|
+
const prefetches = instance.sp; /* LifecycleHooks.SERVER_PREFETCH */
|
|
198
198
|
if (hasAsyncSetup || prefetches) {
|
|
199
199
|
let p = hasAsyncSetup
|
|
200
200
|
? res
|
|
@@ -224,6 +224,12 @@ function renderComponentSubTree(instance, slotScopeId) {
|
|
|
224
224
|
shared.isString(comp.template)) {
|
|
225
225
|
comp.ssrRender = ssrCompile(comp.template, instance);
|
|
226
226
|
}
|
|
227
|
+
// perf: enable caching of computed getters during render
|
|
228
|
+
// since there cannot be state mutations during render.
|
|
229
|
+
for (const e of instance.scope.effects) {
|
|
230
|
+
if (e.computed)
|
|
231
|
+
e.computed._cacheable = true;
|
|
232
|
+
}
|
|
227
233
|
const ssrRender = instance.ssrRender || comp.ssrRender;
|
|
228
234
|
if (ssrRender) {
|
|
229
235
|
// optimized
|
|
@@ -709,6 +715,20 @@ function ssrRenderSuspense(push, { default: renderContent }) {
|
|
|
709
715
|
});
|
|
710
716
|
}
|
|
711
717
|
|
|
718
|
+
function ssrGetDirectiveProps(instance, dir, value, arg, modifiers = {}) {
|
|
719
|
+
if (typeof dir !== 'function' && dir.getSSRProps) {
|
|
720
|
+
return (dir.getSSRProps({
|
|
721
|
+
dir,
|
|
722
|
+
instance,
|
|
723
|
+
value,
|
|
724
|
+
oldValue: undefined,
|
|
725
|
+
arg,
|
|
726
|
+
modifiers
|
|
727
|
+
}, null) || {});
|
|
728
|
+
}
|
|
729
|
+
return {};
|
|
730
|
+
}
|
|
731
|
+
|
|
712
732
|
const ssrLooseEqual = shared.looseEqual;
|
|
713
733
|
function ssrLooseContain(arr, value) {
|
|
714
734
|
return shared.looseIndexOf(arr, value) > -1;
|
|
@@ -753,6 +773,7 @@ exports.renderToSimpleStream = renderToSimpleStream;
|
|
|
753
773
|
exports.renderToStream = renderToStream;
|
|
754
774
|
exports.renderToString = renderToString;
|
|
755
775
|
exports.renderToWebStream = renderToWebStream;
|
|
776
|
+
exports.ssrGetDirectiveProps = ssrGetDirectiveProps;
|
|
756
777
|
exports.ssrGetDynamicModelProps = ssrGetDynamicModelProps;
|
|
757
778
|
exports.ssrInterpolate = ssrInterpolate;
|
|
758
779
|
exports.ssrLooseContain = ssrLooseContain;
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
import { App } from 'vue';
|
|
4
4
|
import { Component } from 'vue';
|
|
5
5
|
import { ComponentInternalInstance } from 'vue';
|
|
6
|
+
import { ComponentPublicInstance } from '@vue/runtime-core';
|
|
7
|
+
import { Directive } from '@vue/runtime-core';
|
|
6
8
|
import { Readable } from 'stream';
|
|
7
9
|
import { Slots } from 'vue';
|
|
8
10
|
import { includeBooleanAttr as ssrIncludeBooleanAttr } from '@vue/shared';
|
|
@@ -47,6 +49,8 @@ export declare type SSRContext = {
|
|
|
47
49
|
__teleportBuffers?: Record<string, SSRBuffer>;
|
|
48
50
|
};
|
|
49
51
|
|
|
52
|
+
export declare function ssrGetDirectiveProps(instance: ComponentPublicInstance, dir: Directive, value?: any, arg?: string, modifiers?: Record<string, boolean>): Record<string, any>;
|
|
53
|
+
|
|
50
54
|
export declare function ssrGetDynamicModelProps(existingProps: any, model: unknown): {
|
|
51
55
|
checked: boolean;
|
|
52
56
|
value?: undefined;
|
|
@@ -166,7 +166,7 @@ function renderComponentVNode(vnode, parentComponent = null, slotScopeId) {
|
|
|
166
166
|
const instance = createComponentInstance(vnode, parentComponent, null);
|
|
167
167
|
const res = setupComponent(instance, true /* isSSR */);
|
|
168
168
|
const hasAsyncSetup = isPromise(res);
|
|
169
|
-
const prefetches = instance.sp;
|
|
169
|
+
const prefetches = instance.sp; /* LifecycleHooks.SERVER_PREFETCH */
|
|
170
170
|
if (hasAsyncSetup || prefetches) {
|
|
171
171
|
let p = hasAsyncSetup
|
|
172
172
|
? res
|
|
@@ -196,6 +196,12 @@ function renderComponentSubTree(instance, slotScopeId) {
|
|
|
196
196
|
isString(comp.template)) {
|
|
197
197
|
comp.ssrRender = ssrCompile(comp.template);
|
|
198
198
|
}
|
|
199
|
+
// perf: enable caching of computed getters during render
|
|
200
|
+
// since there cannot be state mutations during render.
|
|
201
|
+
for (const e of instance.scope.effects) {
|
|
202
|
+
if (e.computed)
|
|
203
|
+
e.computed._cacheable = true;
|
|
204
|
+
}
|
|
199
205
|
const ssrRender = instance.ssrRender || comp.ssrRender;
|
|
200
206
|
if (ssrRender) {
|
|
201
207
|
// optimized
|
|
@@ -646,39 +652,7 @@ function toRaw(observed) {
|
|
|
646
652
|
}
|
|
647
653
|
|
|
648
654
|
function isRef(r) {
|
|
649
|
-
return
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
const classifyRE = /(?:^|[-_])(\w)/g;
|
|
653
|
-
const classify = (str) => str.replace(classifyRE, c => c.toUpperCase()).replace(/[-_]/g, '');
|
|
654
|
-
function getComponentName(Component) {
|
|
655
|
-
return isFunction(Component)
|
|
656
|
-
? Component.displayName || Component.name
|
|
657
|
-
: Component.name;
|
|
658
|
-
}
|
|
659
|
-
/* istanbul ignore next */
|
|
660
|
-
function formatComponentName(instance, Component, isRoot = false) {
|
|
661
|
-
let name = getComponentName(Component);
|
|
662
|
-
if (!name && Component.__file) {
|
|
663
|
-
const match = Component.__file.match(/([^/\\]+)\.\w+$/);
|
|
664
|
-
if (match) {
|
|
665
|
-
name = match[1];
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
if (!name && instance && instance.parent) {
|
|
669
|
-
// try to infer the name based on reverse resolution
|
|
670
|
-
const inferFromRegistry = (registry) => {
|
|
671
|
-
for (const key in registry) {
|
|
672
|
-
if (registry[key] === Component) {
|
|
673
|
-
return key;
|
|
674
|
-
}
|
|
675
|
-
}
|
|
676
|
-
};
|
|
677
|
-
name =
|
|
678
|
-
inferFromRegistry(instance.components ||
|
|
679
|
-
instance.parent.type.components) || inferFromRegistry(instance.appContext.components);
|
|
680
|
-
}
|
|
681
|
-
return name ? classify(name) : isRoot ? `App` : `Anonymous`;
|
|
655
|
+
return !!(r && r.__v_isRef === true);
|
|
682
656
|
}
|
|
683
657
|
|
|
684
658
|
const stack = [];
|
|
@@ -821,7 +795,7 @@ const ErrorTypeStrings = {
|
|
|
821
795
|
[12 /* FUNCTION_REF */]: 'ref function',
|
|
822
796
|
[13 /* ASYNC_COMPONENT_LOADER */]: 'async component loader',
|
|
823
797
|
[14 /* SCHEDULER */]: 'scheduler flush. This is likely a Vue internals bug. ' +
|
|
824
|
-
'Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/
|
|
798
|
+
'Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core'
|
|
825
799
|
};
|
|
826
800
|
function callWithErrorHandling(fn, instance, type, args) {
|
|
827
801
|
let res;
|
|
@@ -885,6 +859,38 @@ function logError(err, type, contextVNode, throwInDev = true) {
|
|
|
885
859
|
}
|
|
886
860
|
}
|
|
887
861
|
|
|
862
|
+
const classifyRE = /(?:^|[-_])(\w)/g;
|
|
863
|
+
const classify = (str) => str.replace(classifyRE, c => c.toUpperCase()).replace(/[-_]/g, '');
|
|
864
|
+
function getComponentName(Component) {
|
|
865
|
+
return isFunction(Component)
|
|
866
|
+
? Component.displayName || Component.name
|
|
867
|
+
: Component.name;
|
|
868
|
+
}
|
|
869
|
+
/* istanbul ignore next */
|
|
870
|
+
function formatComponentName(instance, Component, isRoot = false) {
|
|
871
|
+
let name = getComponentName(Component);
|
|
872
|
+
if (!name && Component.__file) {
|
|
873
|
+
const match = Component.__file.match(/([^/\\]+)\.\w+$/);
|
|
874
|
+
if (match) {
|
|
875
|
+
name = match[1];
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
if (!name && instance && instance.parent) {
|
|
879
|
+
// try to infer the name based on reverse resolution
|
|
880
|
+
const inferFromRegistry = (registry) => {
|
|
881
|
+
for (const key in registry) {
|
|
882
|
+
if (registry[key] === Component) {
|
|
883
|
+
return key;
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
};
|
|
887
|
+
name =
|
|
888
|
+
inferFromRegistry(instance.components ||
|
|
889
|
+
instance.parent.type.components) || inferFromRegistry(instance.appContext.components);
|
|
890
|
+
}
|
|
891
|
+
return name ? classify(name) : isRoot ? `App` : `Anonymous`;
|
|
892
|
+
}
|
|
893
|
+
|
|
888
894
|
function ssrRenderList(source, renderItem) {
|
|
889
895
|
if (isArray(source) || isString(source)) {
|
|
890
896
|
for (let i = 0, l = source.length; i < l; i++) {
|
|
@@ -928,6 +934,20 @@ function ssrRenderSuspense(push, { default: renderContent }) {
|
|
|
928
934
|
});
|
|
929
935
|
}
|
|
930
936
|
|
|
937
|
+
function ssrGetDirectiveProps(instance, dir, value, arg, modifiers = {}) {
|
|
938
|
+
if (typeof dir !== 'function' && dir.getSSRProps) {
|
|
939
|
+
return (dir.getSSRProps({
|
|
940
|
+
dir,
|
|
941
|
+
instance,
|
|
942
|
+
value,
|
|
943
|
+
oldValue: undefined,
|
|
944
|
+
arg,
|
|
945
|
+
modifiers
|
|
946
|
+
}, null) || {});
|
|
947
|
+
}
|
|
948
|
+
return {};
|
|
949
|
+
}
|
|
950
|
+
|
|
931
951
|
const ssrLooseEqual = looseEqual;
|
|
932
952
|
function ssrLooseContain(arr, value) {
|
|
933
953
|
return looseIndexOf(arr, value) > -1;
|
|
@@ -964,4 +984,4 @@ function ssrGetDynamicModelProps(existingProps = {}, model) {
|
|
|
964
984
|
|
|
965
985
|
initDirectivesForSSR();
|
|
966
986
|
|
|
967
|
-
export { pipeToNodeWritable, pipeToWebWritable, renderToNodeStream, renderToSimpleStream, renderToStream, renderToString, renderToWebStream, ssrGetDynamicModelProps, ssrInterpolate, ssrLooseContain, ssrLooseEqual, ssrRenderAttr, ssrRenderAttrs, ssrRenderClass, ssrRenderComponent, ssrRenderDynamicAttr, ssrRenderDynamicModel, ssrRenderList, ssrRenderSlot, ssrRenderStyle, ssrRenderSuspense, ssrRenderTeleport, renderVNode as ssrRenderVNode };
|
|
987
|
+
export { pipeToNodeWritable, pipeToWebWritable, renderToNodeStream, renderToSimpleStream, renderToStream, renderToString, renderToWebStream, ssrGetDirectiveProps, ssrGetDynamicModelProps, ssrInterpolate, ssrLooseContain, ssrLooseEqual, ssrRenderAttr, ssrRenderAttrs, ssrRenderClass, ssrRenderComponent, ssrRenderDynamicAttr, ssrRenderDynamicModel, ssrRenderList, ssrRenderSlot, ssrRenderStyle, ssrRenderSuspense, ssrRenderTeleport, renderVNode as ssrRenderVNode };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/server-renderer",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.30",
|
|
4
4
|
"description": "@vue/server-renderer",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/server-renderer.esm-bundler.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
21
|
-
"url": "git+https://github.com/vuejs/
|
|
21
|
+
"url": "git+https://github.com/vuejs/core.git",
|
|
22
22
|
"directory": "packages/server-renderer"
|
|
23
23
|
},
|
|
24
24
|
"keywords": [
|
|
@@ -27,14 +27,14 @@
|
|
|
27
27
|
"author": "Evan You",
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"bugs": {
|
|
30
|
-
"url": "https://github.com/vuejs/
|
|
30
|
+
"url": "https://github.com/vuejs/core/issues"
|
|
31
31
|
},
|
|
32
|
-
"homepage": "https://github.com/vuejs/
|
|
32
|
+
"homepage": "https://github.com/vuejs/core/tree/main/packages/server-renderer#readme",
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"vue": "3.2.
|
|
34
|
+
"vue": "3.2.30"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@vue/shared": "3.2.
|
|
38
|
-
"@vue/compiler-ssr": "3.2.
|
|
37
|
+
"@vue/shared": "3.2.30",
|
|
38
|
+
"@vue/compiler-ssr": "3.2.30"
|
|
39
39
|
}
|
|
40
40
|
}
|