@vue/server-renderer 3.2.17 → 3.2.21
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 +27 -13
- package/dist/server-renderer.cjs.prod.js +24 -10
- package/package.json +4 -4
|
@@ -104,23 +104,37 @@ function ssrRenderStyle(raw) {
|
|
|
104
104
|
|
|
105
105
|
const compileCache = Object.create(null);
|
|
106
106
|
function ssrCompile(template, instance) {
|
|
107
|
-
|
|
107
|
+
// TODO: This is copied from runtime-core/src/component.ts and should probably be refactored
|
|
108
|
+
const Component = instance.type;
|
|
109
|
+
const { isCustomElement, compilerOptions } = instance.appContext.config;
|
|
110
|
+
const { delimiters, compilerOptions: componentCompilerOptions } = Component;
|
|
111
|
+
const finalCompilerOptions = shared.extend(shared.extend({
|
|
112
|
+
isCustomElement,
|
|
113
|
+
delimiters
|
|
114
|
+
}, compilerOptions), componentCompilerOptions);
|
|
115
|
+
finalCompilerOptions.isCustomElement =
|
|
116
|
+
finalCompilerOptions.isCustomElement || shared.NO;
|
|
117
|
+
finalCompilerOptions.isNativeTag = finalCompilerOptions.isNativeTag || shared.NO;
|
|
118
|
+
const cacheKey = JSON.stringify({
|
|
119
|
+
template,
|
|
120
|
+
compilerOptions: finalCompilerOptions
|
|
121
|
+
}, (key, value) => {
|
|
122
|
+
return shared.isFunction(value) ? value.toString() : value;
|
|
123
|
+
});
|
|
124
|
+
const cached = compileCache[cacheKey];
|
|
108
125
|
if (cached) {
|
|
109
126
|
return cached;
|
|
110
127
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
const codeFrame = err.loc &&
|
|
118
|
-
shared.generateCodeFrame(template, err.loc.start.offset, err.loc.end.offset);
|
|
119
|
-
vue.warn(codeFrame ? `${message}\n${codeFrame}` : message);
|
|
120
|
-
}
|
|
128
|
+
finalCompilerOptions.onError = (err) => {
|
|
129
|
+
{
|
|
130
|
+
const message = `[@vue/server-renderer] Template compilation error: ${err.message}`;
|
|
131
|
+
const codeFrame = err.loc &&
|
|
132
|
+
shared.generateCodeFrame(template, err.loc.start.offset, err.loc.end.offset);
|
|
133
|
+
vue.warn(codeFrame ? `${message}\n${codeFrame}` : message);
|
|
121
134
|
}
|
|
122
|
-
}
|
|
123
|
-
|
|
135
|
+
};
|
|
136
|
+
const { code } = compilerSsr.compile(template, finalCompilerOptions);
|
|
137
|
+
return (compileCache[cacheKey] = Function('require', code)(require));
|
|
124
138
|
}
|
|
125
139
|
|
|
126
140
|
function ssrRenderTeleport(parentPush, contentRenderFn, target, disabled, parentComponent) {
|
|
@@ -104,20 +104,34 @@ function ssrRenderStyle(raw) {
|
|
|
104
104
|
|
|
105
105
|
const compileCache = Object.create(null);
|
|
106
106
|
function ssrCompile(template, instance) {
|
|
107
|
-
|
|
107
|
+
// TODO: This is copied from runtime-core/src/component.ts and should probably be refactored
|
|
108
|
+
const Component = instance.type;
|
|
109
|
+
const { isCustomElement, compilerOptions } = instance.appContext.config;
|
|
110
|
+
const { delimiters, compilerOptions: componentCompilerOptions } = Component;
|
|
111
|
+
const finalCompilerOptions = shared.extend(shared.extend({
|
|
112
|
+
isCustomElement,
|
|
113
|
+
delimiters
|
|
114
|
+
}, compilerOptions), componentCompilerOptions);
|
|
115
|
+
finalCompilerOptions.isCustomElement =
|
|
116
|
+
finalCompilerOptions.isCustomElement || shared.NO;
|
|
117
|
+
finalCompilerOptions.isNativeTag = finalCompilerOptions.isNativeTag || shared.NO;
|
|
118
|
+
const cacheKey = JSON.stringify({
|
|
119
|
+
template,
|
|
120
|
+
compilerOptions: finalCompilerOptions
|
|
121
|
+
}, (key, value) => {
|
|
122
|
+
return shared.isFunction(value) ? value.toString() : value;
|
|
123
|
+
});
|
|
124
|
+
const cached = compileCache[cacheKey];
|
|
108
125
|
if (cached) {
|
|
109
126
|
return cached;
|
|
110
127
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
onError(err) {
|
|
115
|
-
{
|
|
116
|
-
throw err;
|
|
117
|
-
}
|
|
128
|
+
finalCompilerOptions.onError = (err) => {
|
|
129
|
+
{
|
|
130
|
+
throw err;
|
|
118
131
|
}
|
|
119
|
-
}
|
|
120
|
-
|
|
132
|
+
};
|
|
133
|
+
const { code } = compilerSsr.compile(template, finalCompilerOptions);
|
|
134
|
+
return (compileCache[cacheKey] = Function('require', code)(require));
|
|
121
135
|
}
|
|
122
136
|
|
|
123
137
|
function ssrRenderTeleport(parentPush, contentRenderFn, target, disabled, parentComponent) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/server-renderer",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.21",
|
|
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/vue-next/tree/master/packages/server-renderer#readme",
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"vue": "3.2.
|
|
34
|
+
"vue": "3.2.21"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@vue/shared": "3.2.
|
|
38
|
-
"@vue/compiler-ssr": "3.2.
|
|
37
|
+
"@vue/shared": "3.2.21",
|
|
38
|
+
"@vue/compiler-ssr": "3.2.21"
|
|
39
39
|
}
|
|
40
40
|
}
|