@tramvai/module-render 4.19.3 → 4.19.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/lib/server/PageBuilder.es.js +10 -0
- package/lib/server/PageBuilder.js +10 -0
- package/lib/server/htmlPageSchema.es.js +0 -1
- package/lib/server/htmlPageSchema.js +0 -1
- package/package.json +15 -15
- package/tests.js +0 -1
|
@@ -57,12 +57,22 @@ class PageBuilder {
|
|
|
57
57
|
// for streaming we need to have initial state before application scripts,
|
|
58
58
|
// body end will be sent after suspended components will be resolved, but hydration will starl earlier
|
|
59
59
|
const slot = this.renderMode === 'streaming' ? ResourceSlot.HEAD_DYNAMIC_SCRIPTS : ResourceSlot.BODY_END;
|
|
60
|
+
this.resourcesRegistry.register({
|
|
61
|
+
type: ResourceType.asIs,
|
|
62
|
+
slot: ResourceSlot.HEAD_PERFORMANCE,
|
|
63
|
+
payload: `<script>window.__TRAMVAI_HTML_READY_PROMISE__ = new Promise((resolve) => { window.__TRAMVAI_HTML_READY_RESOLVE__ = resolve; });</script>`,
|
|
64
|
+
});
|
|
60
65
|
this.resourcesRegistry.register({
|
|
61
66
|
type: ResourceType.asIs,
|
|
62
67
|
slot,
|
|
63
68
|
// String much better than big object, source https://v8.dev/blog/cost-of-javascript-2019#json
|
|
64
69
|
payload: `<script id="__TRAMVAI_STATE__" type="application/json">${safeStringify(this.context.dehydrate().dispatcher)}</script>`,
|
|
65
70
|
});
|
|
71
|
+
this.resourcesRegistry.register({
|
|
72
|
+
type: ResourceType.asIs,
|
|
73
|
+
slot,
|
|
74
|
+
payload: `<script>window.__TRAMVAI_HTML_READY__ = true; window.__TRAMVAI_HTML_READY_RESOLVE__();</script>`,
|
|
75
|
+
});
|
|
66
76
|
}
|
|
67
77
|
async fetchChunksInfo(extractor) {
|
|
68
78
|
const { modern, renderMode } = this;
|
|
@@ -65,12 +65,22 @@ class PageBuilder {
|
|
|
65
65
|
// for streaming we need to have initial state before application scripts,
|
|
66
66
|
// body end will be sent after suspended components will be resolved, but hydration will starl earlier
|
|
67
67
|
const slot = this.renderMode === 'streaming' ? tokensRender.ResourceSlot.HEAD_DYNAMIC_SCRIPTS : tokensRender.ResourceSlot.BODY_END;
|
|
68
|
+
this.resourcesRegistry.register({
|
|
69
|
+
type: tokensRender.ResourceType.asIs,
|
|
70
|
+
slot: tokensRender.ResourceSlot.HEAD_PERFORMANCE,
|
|
71
|
+
payload: `<script>window.__TRAMVAI_HTML_READY_PROMISE__ = new Promise((resolve) => { window.__TRAMVAI_HTML_READY_RESOLVE__ = resolve; });</script>`,
|
|
72
|
+
});
|
|
68
73
|
this.resourcesRegistry.register({
|
|
69
74
|
type: tokensRender.ResourceType.asIs,
|
|
70
75
|
slot,
|
|
71
76
|
// String much better than big object, source https://v8.dev/blog/cost-of-javascript-2019#json
|
|
72
77
|
payload: `<script id="__TRAMVAI_STATE__" type="application/json">${safeStrings.safeStringify(this.context.dehydrate().dispatcher)}</script>`,
|
|
73
78
|
});
|
|
79
|
+
this.resourcesRegistry.register({
|
|
80
|
+
type: tokensRender.ResourceType.asIs,
|
|
81
|
+
slot,
|
|
82
|
+
payload: `<script>window.__TRAMVAI_HTML_READY__ = true; window.__TRAMVAI_HTML_READY_RESOLVE__();</script>`,
|
|
83
|
+
});
|
|
74
84
|
}
|
|
75
85
|
async fetchChunksInfo(extractor) {
|
|
76
86
|
const { modern, renderMode } = this;
|
|
@@ -25,7 +25,6 @@ const htmlPageSchemaFactory = ({ htmlAttrs, }) => {
|
|
|
25
25
|
dynamicRender(BODY_END),
|
|
26
26
|
dynamicRender(BODY_TAIL_ANALYTICS),
|
|
27
27
|
dynamicRender(BODY_TAIL),
|
|
28
|
-
staticRender('<script id="__TRAMVAI_BODY_TAIL__"></script>'),
|
|
29
28
|
staticRender('</body>'),
|
|
30
29
|
staticRender('</html>'),
|
|
31
30
|
];
|
|
@@ -29,7 +29,6 @@ const htmlPageSchemaFactory = ({ htmlAttrs, }) => {
|
|
|
29
29
|
htmlpagebuilder.dynamicRender(BODY_END),
|
|
30
30
|
htmlpagebuilder.dynamicRender(BODY_TAIL_ANALYTICS),
|
|
31
31
|
htmlpagebuilder.dynamicRender(BODY_TAIL),
|
|
32
|
-
htmlpagebuilder.staticRender('<script id="__TRAMVAI_BODY_TAIL__"></script>'),
|
|
33
32
|
htmlpagebuilder.staticRender('</body>'),
|
|
34
33
|
htmlpagebuilder.staticRender('</html>'),
|
|
35
34
|
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/module-render",
|
|
3
|
-
"version": "4.19.
|
|
3
|
+
"version": "4.19.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"browser": "lib/browser.js",
|
|
6
6
|
"main": "lib/server.js",
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
"@tinkoff/layout-factory": "0.5.1",
|
|
27
27
|
"@tinkoff/errors": "0.5.1",
|
|
28
28
|
"@tinkoff/url": "0.10.1",
|
|
29
|
-
"@tinkoff/user-agent": "0.6.
|
|
30
|
-
"@tramvai/module-client-hints": "4.19.
|
|
31
|
-
"@tramvai/module-router": "4.19.
|
|
32
|
-
"@tramvai/react": "4.19.
|
|
29
|
+
"@tinkoff/user-agent": "0.6.62",
|
|
30
|
+
"@tramvai/module-client-hints": "4.19.4",
|
|
31
|
+
"@tramvai/module-router": "4.19.4",
|
|
32
|
+
"@tramvai/react": "4.19.4",
|
|
33
33
|
"@tramvai/safe-strings": "0.7.1",
|
|
34
|
-
"@tramvai/tokens-render": "4.19.
|
|
35
|
-
"@tramvai/experiments": "4.19.
|
|
34
|
+
"@tramvai/tokens-render": "4.19.4",
|
|
35
|
+
"@tramvai/experiments": "4.19.4",
|
|
36
36
|
"@types/loadable__server": "^5.12.6",
|
|
37
37
|
"node-fetch": "^2.6.1"
|
|
38
38
|
},
|
|
@@ -40,14 +40,14 @@
|
|
|
40
40
|
"@tinkoff/dippy": "0.10.7",
|
|
41
41
|
"@tinkoff/utils": "^2.1.2",
|
|
42
42
|
"@tinkoff/react-hooks": "0.3.1",
|
|
43
|
-
"@tramvai/cli": "4.19.
|
|
44
|
-
"@tramvai/core": "4.19.
|
|
45
|
-
"@tramvai/module-common": "4.19.
|
|
46
|
-
"@tramvai/state": "4.19.
|
|
47
|
-
"@tramvai/test-helpers": "4.19.
|
|
48
|
-
"@tramvai/tokens-common": "4.19.
|
|
49
|
-
"@tramvai/tokens-router": "4.19.
|
|
50
|
-
"@tramvai/tokens-server-private": "4.19.
|
|
43
|
+
"@tramvai/cli": "4.19.4",
|
|
44
|
+
"@tramvai/core": "4.19.4",
|
|
45
|
+
"@tramvai/module-common": "4.19.4",
|
|
46
|
+
"@tramvai/state": "4.19.4",
|
|
47
|
+
"@tramvai/test-helpers": "4.19.4",
|
|
48
|
+
"@tramvai/tokens-common": "4.19.4",
|
|
49
|
+
"@tramvai/tokens-router": "4.19.4",
|
|
50
|
+
"@tramvai/tokens-server-private": "4.19.4",
|
|
51
51
|
"express": "^4.17.1",
|
|
52
52
|
"prop-types": "^15.6.2",
|
|
53
53
|
"react": ">=16.14.0",
|
package/tests.js
CHANGED
|
@@ -138,7 +138,6 @@ const htmlPageSchemaFactory = ({ htmlAttrs, }) => {
|
|
|
138
138
|
htmlpagebuilder.dynamicRender(BODY_END),
|
|
139
139
|
htmlpagebuilder.dynamicRender(BODY_TAIL_ANALYTICS),
|
|
140
140
|
htmlpagebuilder.dynamicRender(BODY_TAIL),
|
|
141
|
-
htmlpagebuilder.staticRender('<script id="__TRAMVAI_BODY_TAIL__"></script>'),
|
|
142
141
|
htmlpagebuilder.staticRender('</body>'),
|
|
143
142
|
htmlpagebuilder.staticRender('</html>'),
|
|
144
143
|
];
|