@live-change/server 0.7.2 → 0.7.3
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/lib/Renderer.js +2 -2
- package/lib/SsrServer.js +6 -5
- package/package.json +7 -7
package/lib/Renderer.js
CHANGED
|
@@ -45,7 +45,7 @@ class Renderer {
|
|
|
45
45
|
const { url, dao, clientIp, credentials, windowId, version } = params
|
|
46
46
|
|
|
47
47
|
const render = await this.getRenderFunction()
|
|
48
|
-
const { html: appHtml, modules, data, meta } = await render(params)
|
|
48
|
+
const { html: appHtml, modules, data, meta, response } = await render(params)
|
|
49
49
|
|
|
50
50
|
const preloadLinks = this.renderPreloadLinks(modules)
|
|
51
51
|
|
|
@@ -69,7 +69,7 @@ class Renderer {
|
|
|
69
69
|
'<!--app-data-->': (meta.bodyAppend || '') + '\n' + appDataScript
|
|
70
70
|
})
|
|
71
71
|
|
|
72
|
-
return html
|
|
72
|
+
return { html, response }
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
renderPreloadLink(file) {
|
package/lib/SsrServer.js
CHANGED
|
@@ -105,21 +105,22 @@ class SsrServer {
|
|
|
105
105
|
const dao = await this.createDao(credentials, clientIp)
|
|
106
106
|
const version = this.version
|
|
107
107
|
|
|
108
|
-
let
|
|
108
|
+
let result
|
|
109
109
|
let error
|
|
110
110
|
|
|
111
111
|
for(let retry = 0; retry < 3; retry ++) {
|
|
112
112
|
try {
|
|
113
|
-
|
|
113
|
+
result = await this.renderer.renderPage({ url, host, dao, clientIp, credentials, windowId, version })
|
|
114
114
|
break
|
|
115
115
|
} catch(e) {
|
|
116
116
|
error = e
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
|
-
if(
|
|
120
|
-
|
|
119
|
+
if(result) {
|
|
120
|
+
const { html, response } = result
|
|
121
|
+
res.status(response?.status || 200)
|
|
121
122
|
writeCredentials(res, credentials)
|
|
122
|
-
res.set({
|
|
123
|
+
res.set(response?.headers ?? {
|
|
123
124
|
'Content-Type': 'text/html'
|
|
124
125
|
})
|
|
125
126
|
res.end(html)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@live-change/server",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
4
4
|
"description": "Live Change Framework - server",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
},
|
|
22
22
|
"homepage": "https://github.com/live-change/live-change-framework",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@live-change/dao": "0.5.
|
|
25
|
-
"@live-change/dao-sockjs": "0.5.
|
|
26
|
-
"@live-change/db-server": "0.5.
|
|
27
|
-
"@live-change/framework": "^0.7.
|
|
24
|
+
"@live-change/dao": "0.5.7",
|
|
25
|
+
"@live-change/dao-sockjs": "0.5.7",
|
|
26
|
+
"@live-change/db-server": "0.5.19",
|
|
27
|
+
"@live-change/framework": "^0.7.3",
|
|
28
28
|
"@live-change/sockjs": "0.4.1",
|
|
29
|
-
"@live-change/uid": "^0.7.
|
|
29
|
+
"@live-change/uid": "^0.7.3",
|
|
30
30
|
"dotenv": "^16.0.1",
|
|
31
31
|
"express": "^4.18.1",
|
|
32
32
|
"express-static-gzip": "2.1.7",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"websocket": "^1.0.34",
|
|
40
40
|
"yargs": "^17.5.1"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "678a56933a707927dc21360670f47333159cc2f6"
|
|
43
43
|
}
|