@tramvai/module-render 2.70.1 → 2.72.0
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/browser.js +9 -233
- package/lib/client/index.browser.js +48 -0
- package/lib/client/renderer.browser.js +50 -0
- package/lib/react/index.browser.js +11 -0
- package/lib/react/index.es.js +11 -0
- package/lib/react/index.js +15 -0
- package/lib/react/pageErrorBoundary.browser.js +23 -0
- package/lib/react/pageErrorBoundary.es.js +23 -0
- package/lib/react/pageErrorBoundary.js +27 -0
- package/lib/react/root.browser.js +58 -0
- package/lib/react/root.es.js +58 -0
- package/lib/react/root.js +62 -0
- package/lib/resourcesInliner/externalFilesHelper.es.js +17 -0
- package/lib/resourcesInliner/externalFilesHelper.js +26 -0
- package/lib/resourcesInliner/fileProcessor.es.js +31 -0
- package/lib/resourcesInliner/fileProcessor.js +40 -0
- package/lib/resourcesInliner/resourcesInliner.es.js +204 -0
- package/lib/resourcesInliner/resourcesInliner.js +213 -0
- package/lib/resourcesInliner/tokens.es.js +15 -0
- package/lib/resourcesInliner/tokens.js +20 -0
- package/lib/resourcesRegistry/index.es.js +28 -0
- package/lib/resourcesRegistry/index.js +36 -0
- package/lib/server/PageBuilder.es.js +93 -0
- package/lib/server/PageBuilder.js +102 -0
- package/lib/server/ReactRenderServer.es.js +90 -0
- package/lib/server/ReactRenderServer.js +98 -0
- package/lib/server/blocks/bundleResource/bundleResource.es.js +62 -0
- package/lib/server/blocks/bundleResource/bundleResource.js +71 -0
- package/lib/server/blocks/polyfill.es.js +35 -0
- package/lib/server/blocks/polyfill.js +39 -0
- package/lib/{server_inline.inline.es.js → server/blocks/preload/onload.inline.es.js} +1 -1
- package/lib/{server_inline.inline.js → server/blocks/preload/onload.inline.js} +2 -0
- package/lib/server/blocks/preload/preloadBlock.es.js +21 -0
- package/lib/server/blocks/preload/preloadBlock.js +30 -0
- package/lib/server/blocks/utils/fetchWebpackStats.es.js +88 -0
- package/lib/server/blocks/utils/fetchWebpackStats.js +115 -0
- package/lib/server/blocks/utils/flushFiles.es.js +33 -0
- package/lib/server/blocks/utils/flushFiles.js +44 -0
- package/lib/server/blocks/utils/requireFunc.es.js +5 -0
- package/lib/server/blocks/utils/requireFunc.js +9 -0
- package/lib/server/constants/performance.es.js +3 -0
- package/lib/server/constants/performance.js +7 -0
- package/lib/server/htmlPageSchema.es.js +33 -0
- package/lib/server/htmlPageSchema.js +37 -0
- package/lib/server/utils.es.js +16 -0
- package/lib/server/utils.js +20 -0
- package/lib/server.es.js +18 -859
- package/lib/server.js +33 -909
- package/lib/shared/LayoutModule.browser.js +40 -0
- package/lib/shared/LayoutModule.es.js +40 -0
- package/lib/shared/LayoutModule.js +42 -0
- package/lib/shared/pageErrorStore.browser.js +19 -0
- package/lib/shared/pageErrorStore.es.js +19 -0
- package/lib/shared/pageErrorStore.js +26 -0
- package/lib/shared/providers.browser.js +18 -0
- package/lib/shared/providers.es.js +18 -0
- package/lib/shared/providers.js +22 -0
- package/package.json +23 -24
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { __decorate } from 'tslib';
|
|
2
|
+
import { Module } from '@tramvai/core';
|
|
3
|
+
import { composeLayoutOptions, createLayout } from '@tinkoff/layout-factory';
|
|
4
|
+
import { DEFAULT_LAYOUT_COMPONENT, LAYOUT_OPTIONS, DEFAULT_FOOTER_COMPONENT, DEFAULT_HEADER_COMPONENT, DEFAULT_ERROR_BOUNDARY_COMPONENT } from '@tramvai/tokens-render';
|
|
5
|
+
|
|
6
|
+
const RenderChildrenComponent = ({ children }) => children;
|
|
7
|
+
let LayoutModule = class LayoutModule {
|
|
8
|
+
};
|
|
9
|
+
LayoutModule = __decorate([
|
|
10
|
+
Module({
|
|
11
|
+
providers: [
|
|
12
|
+
{
|
|
13
|
+
provide: DEFAULT_LAYOUT_COMPONENT,
|
|
14
|
+
useFactory: ({ layoutOptions }) => {
|
|
15
|
+
const options = composeLayoutOptions(layoutOptions);
|
|
16
|
+
return createLayout(options);
|
|
17
|
+
},
|
|
18
|
+
deps: {
|
|
19
|
+
layoutOptions: { token: LAYOUT_OPTIONS, optional: true },
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
provide: 'componentDefaultList',
|
|
24
|
+
multi: true,
|
|
25
|
+
useFactory: (components) => ({
|
|
26
|
+
...components,
|
|
27
|
+
nestedLayoutDefault: RenderChildrenComponent,
|
|
28
|
+
}),
|
|
29
|
+
deps: {
|
|
30
|
+
layoutDefault: DEFAULT_LAYOUT_COMPONENT,
|
|
31
|
+
footerDefault: { token: DEFAULT_FOOTER_COMPONENT, optional: true },
|
|
32
|
+
headerDefault: { token: DEFAULT_HEADER_COMPONENT, optional: true },
|
|
33
|
+
errorBoundaryDefault: { token: DEFAULT_ERROR_BOUNDARY_COMPONENT, optional: true },
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
})
|
|
38
|
+
], LayoutModule);
|
|
39
|
+
|
|
40
|
+
export { LayoutModule };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { __decorate } from 'tslib';
|
|
2
|
+
import { Module } from '@tramvai/core';
|
|
3
|
+
import { composeLayoutOptions, createLayout } from '@tinkoff/layout-factory';
|
|
4
|
+
import { DEFAULT_LAYOUT_COMPONENT, LAYOUT_OPTIONS, DEFAULT_FOOTER_COMPONENT, DEFAULT_HEADER_COMPONENT, DEFAULT_ERROR_BOUNDARY_COMPONENT } from '@tramvai/tokens-render';
|
|
5
|
+
|
|
6
|
+
const RenderChildrenComponent = ({ children }) => children;
|
|
7
|
+
let LayoutModule = class LayoutModule {
|
|
8
|
+
};
|
|
9
|
+
LayoutModule = __decorate([
|
|
10
|
+
Module({
|
|
11
|
+
providers: [
|
|
12
|
+
{
|
|
13
|
+
provide: DEFAULT_LAYOUT_COMPONENT,
|
|
14
|
+
useFactory: ({ layoutOptions }) => {
|
|
15
|
+
const options = composeLayoutOptions(layoutOptions);
|
|
16
|
+
return createLayout(options);
|
|
17
|
+
},
|
|
18
|
+
deps: {
|
|
19
|
+
layoutOptions: { token: LAYOUT_OPTIONS, optional: true },
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
provide: 'componentDefaultList',
|
|
24
|
+
multi: true,
|
|
25
|
+
useFactory: (components) => ({
|
|
26
|
+
...components,
|
|
27
|
+
nestedLayoutDefault: RenderChildrenComponent,
|
|
28
|
+
}),
|
|
29
|
+
deps: {
|
|
30
|
+
layoutDefault: DEFAULT_LAYOUT_COMPONENT,
|
|
31
|
+
footerDefault: { token: DEFAULT_FOOTER_COMPONENT, optional: true },
|
|
32
|
+
headerDefault: { token: DEFAULT_HEADER_COMPONENT, optional: true },
|
|
33
|
+
errorBoundaryDefault: { token: DEFAULT_ERROR_BOUNDARY_COMPONENT, optional: true },
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
})
|
|
38
|
+
], LayoutModule);
|
|
39
|
+
|
|
40
|
+
export { LayoutModule };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var tslib = require('tslib');
|
|
6
|
+
var core = require('@tramvai/core');
|
|
7
|
+
var layoutFactory = require('@tinkoff/layout-factory');
|
|
8
|
+
var tokensRender = require('@tramvai/tokens-render');
|
|
9
|
+
|
|
10
|
+
const RenderChildrenComponent = ({ children }) => children;
|
|
11
|
+
exports.LayoutModule = class LayoutModule {
|
|
12
|
+
};
|
|
13
|
+
exports.LayoutModule = tslib.__decorate([
|
|
14
|
+
core.Module({
|
|
15
|
+
providers: [
|
|
16
|
+
{
|
|
17
|
+
provide: tokensRender.DEFAULT_LAYOUT_COMPONENT,
|
|
18
|
+
useFactory: ({ layoutOptions }) => {
|
|
19
|
+
const options = layoutFactory.composeLayoutOptions(layoutOptions);
|
|
20
|
+
return layoutFactory.createLayout(options);
|
|
21
|
+
},
|
|
22
|
+
deps: {
|
|
23
|
+
layoutOptions: { token: tokensRender.LAYOUT_OPTIONS, optional: true },
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
provide: 'componentDefaultList',
|
|
28
|
+
multi: true,
|
|
29
|
+
useFactory: (components) => ({
|
|
30
|
+
...components,
|
|
31
|
+
nestedLayoutDefault: RenderChildrenComponent,
|
|
32
|
+
}),
|
|
33
|
+
deps: {
|
|
34
|
+
layoutDefault: tokensRender.DEFAULT_LAYOUT_COMPONENT,
|
|
35
|
+
footerDefault: { token: tokensRender.DEFAULT_FOOTER_COMPONENT, optional: true },
|
|
36
|
+
headerDefault: { token: tokensRender.DEFAULT_HEADER_COMPONENT, optional: true },
|
|
37
|
+
errorBoundaryDefault: { token: tokensRender.DEFAULT_ERROR_BOUNDARY_COMPONENT, optional: true },
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
})
|
|
42
|
+
], exports.LayoutModule);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createEvent, createReducer } from '@tramvai/state';
|
|
2
|
+
|
|
3
|
+
function serializeError(error) {
|
|
4
|
+
return {
|
|
5
|
+
...error,
|
|
6
|
+
message: error.message,
|
|
7
|
+
stack: error.stack,
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
function deserializeError(serializedError) {
|
|
11
|
+
const error = new Error(serializedError.message);
|
|
12
|
+
Object.assign(error, serializedError);
|
|
13
|
+
return error;
|
|
14
|
+
}
|
|
15
|
+
const setPageErrorEvent = createEvent('setPageError');
|
|
16
|
+
const initialState = null;
|
|
17
|
+
const PageErrorStore = createReducer('pageError', initialState).on(setPageErrorEvent, (state, error) => error && serializeError(error));
|
|
18
|
+
|
|
19
|
+
export { PageErrorStore, deserializeError, serializeError, setPageErrorEvent };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createEvent, createReducer } from '@tramvai/state';
|
|
2
|
+
|
|
3
|
+
function serializeError(error) {
|
|
4
|
+
return {
|
|
5
|
+
...error,
|
|
6
|
+
message: error.message,
|
|
7
|
+
stack: error.stack,
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
function deserializeError(serializedError) {
|
|
11
|
+
const error = new Error(serializedError.message);
|
|
12
|
+
Object.assign(error, serializedError);
|
|
13
|
+
return error;
|
|
14
|
+
}
|
|
15
|
+
const setPageErrorEvent = createEvent('setPageError');
|
|
16
|
+
const initialState = null;
|
|
17
|
+
const PageErrorStore = createReducer('pageError', initialState).on(setPageErrorEvent, (state, error) => error && serializeError(error));
|
|
18
|
+
|
|
19
|
+
export { PageErrorStore, deserializeError, serializeError, setPageErrorEvent };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var state = require('@tramvai/state');
|
|
6
|
+
|
|
7
|
+
function serializeError(error) {
|
|
8
|
+
return {
|
|
9
|
+
...error,
|
|
10
|
+
message: error.message,
|
|
11
|
+
stack: error.stack,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function deserializeError(serializedError) {
|
|
15
|
+
const error = new Error(serializedError.message);
|
|
16
|
+
Object.assign(error, serializedError);
|
|
17
|
+
return error;
|
|
18
|
+
}
|
|
19
|
+
const setPageErrorEvent = state.createEvent('setPageError');
|
|
20
|
+
const initialState = null;
|
|
21
|
+
const PageErrorStore = state.createReducer('pageError', initialState).on(setPageErrorEvent, (state, error) => error && serializeError(error));
|
|
22
|
+
|
|
23
|
+
exports.PageErrorStore = PageErrorStore;
|
|
24
|
+
exports.deserializeError = deserializeError;
|
|
25
|
+
exports.serializeError = serializeError;
|
|
26
|
+
exports.setPageErrorEvent = setPageErrorEvent;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { provide } from '@tramvai/core';
|
|
2
|
+
import { COMBINE_REDUCERS } from '@tramvai/tokens-common';
|
|
3
|
+
import { TRAMVAI_RENDER_MODE } from '@tramvai/tokens-render';
|
|
4
|
+
import { PageErrorStore } from './pageErrorStore.browser.js';
|
|
5
|
+
|
|
6
|
+
const providers = [
|
|
7
|
+
provide({
|
|
8
|
+
provide: COMBINE_REDUCERS,
|
|
9
|
+
multi: true,
|
|
10
|
+
useValue: PageErrorStore,
|
|
11
|
+
}),
|
|
12
|
+
provide({
|
|
13
|
+
provide: TRAMVAI_RENDER_MODE,
|
|
14
|
+
useValue: 'ssr',
|
|
15
|
+
}),
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
export { providers };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { provide } from '@tramvai/core';
|
|
2
|
+
import { COMBINE_REDUCERS } from '@tramvai/tokens-common';
|
|
3
|
+
import { TRAMVAI_RENDER_MODE } from '@tramvai/tokens-render';
|
|
4
|
+
import { PageErrorStore } from './pageErrorStore.es.js';
|
|
5
|
+
|
|
6
|
+
const providers = [
|
|
7
|
+
provide({
|
|
8
|
+
provide: COMBINE_REDUCERS,
|
|
9
|
+
multi: true,
|
|
10
|
+
useValue: PageErrorStore,
|
|
11
|
+
}),
|
|
12
|
+
provide({
|
|
13
|
+
provide: TRAMVAI_RENDER_MODE,
|
|
14
|
+
useValue: 'ssr',
|
|
15
|
+
}),
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
export { providers };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var core = require('@tramvai/core');
|
|
6
|
+
var tokensCommon = require('@tramvai/tokens-common');
|
|
7
|
+
var tokensRender = require('@tramvai/tokens-render');
|
|
8
|
+
var pageErrorStore = require('./pageErrorStore.js');
|
|
9
|
+
|
|
10
|
+
const providers = [
|
|
11
|
+
core.provide({
|
|
12
|
+
provide: tokensCommon.COMBINE_REDUCERS,
|
|
13
|
+
multi: true,
|
|
14
|
+
useValue: pageErrorStore.PageErrorStore,
|
|
15
|
+
}),
|
|
16
|
+
core.provide({
|
|
17
|
+
provide: tokensRender.TRAMVAI_RENDER_MODE,
|
|
18
|
+
useValue: 'ssr',
|
|
19
|
+
}),
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
exports.providers = providers;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/module-render",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.72.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"browser": "lib/browser.js",
|
|
6
6
|
"main": "lib/server.js",
|
|
@@ -17,37 +17,36 @@
|
|
|
17
17
|
"url": "git@github.com:Tinkoff/tramvai.git"
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
|
-
"build": "tramvai-build --
|
|
21
|
-
"watch": "tsc -w"
|
|
22
|
-
"build-for-publish": "true"
|
|
20
|
+
"build": "tramvai-build --forPublish --preserveModules",
|
|
21
|
+
"watch": "tsc -w"
|
|
23
22
|
},
|
|
24
23
|
"dependencies": {
|
|
25
24
|
"@loadable/server": "^5.15.0",
|
|
26
|
-
"@tinkoff/htmlpagebuilder": "0.5.
|
|
27
|
-
"@tinkoff/layout-factory": "0.3.
|
|
28
|
-
"@tinkoff/url": "0.8.
|
|
29
|
-
"@tinkoff/user-agent": "0.4.
|
|
30
|
-
"@tramvai/module-client-hints": "2.
|
|
31
|
-
"@tramvai/module-router": "2.
|
|
32
|
-
"@tramvai/react": "2.
|
|
33
|
-
"@tramvai/safe-strings": "0.5.
|
|
34
|
-
"@tramvai/tokens-render": "2.
|
|
35
|
-
"@tramvai/experiments": "2.
|
|
25
|
+
"@tinkoff/htmlpagebuilder": "0.5.6",
|
|
26
|
+
"@tinkoff/layout-factory": "0.3.7",
|
|
27
|
+
"@tinkoff/url": "0.8.5",
|
|
28
|
+
"@tinkoff/user-agent": "0.4.178",
|
|
29
|
+
"@tramvai/module-client-hints": "2.72.0",
|
|
30
|
+
"@tramvai/module-router": "2.72.0",
|
|
31
|
+
"@tramvai/react": "2.72.0",
|
|
32
|
+
"@tramvai/safe-strings": "0.5.7",
|
|
33
|
+
"@tramvai/tokens-render": "2.72.0",
|
|
34
|
+
"@tramvai/experiments": "2.72.0",
|
|
36
35
|
"@types/loadable__server": "^5.12.6",
|
|
37
36
|
"node-fetch": "^2.6.1"
|
|
38
37
|
},
|
|
39
38
|
"peerDependencies": {
|
|
40
|
-
"@tinkoff/dippy": "0.8.
|
|
39
|
+
"@tinkoff/dippy": "0.8.13",
|
|
41
40
|
"@tinkoff/utils": "^2.1.2",
|
|
42
|
-
"@tinkoff/react-hooks": "0.1.
|
|
43
|
-
"@tramvai/cli": "2.
|
|
44
|
-
"@tramvai/core": "2.
|
|
45
|
-
"@tramvai/module-common": "2.
|
|
46
|
-
"@tramvai/state": "2.
|
|
47
|
-
"@tramvai/test-helpers": "2.
|
|
48
|
-
"@tramvai/tokens-common": "2.
|
|
49
|
-
"@tramvai/tokens-router": "2.
|
|
50
|
-
"@tramvai/tokens-server-private": "2.
|
|
41
|
+
"@tinkoff/react-hooks": "0.1.5",
|
|
42
|
+
"@tramvai/cli": "2.72.0",
|
|
43
|
+
"@tramvai/core": "2.72.0",
|
|
44
|
+
"@tramvai/module-common": "2.72.0",
|
|
45
|
+
"@tramvai/state": "2.72.0",
|
|
46
|
+
"@tramvai/test-helpers": "2.72.0",
|
|
47
|
+
"@tramvai/tokens-common": "2.72.0",
|
|
48
|
+
"@tramvai/tokens-router": "2.72.0",
|
|
49
|
+
"@tramvai/tokens-server-private": "2.72.0",
|
|
51
50
|
"express": "^4.17.1",
|
|
52
51
|
"prop-types": "^15.6.2",
|
|
53
52
|
"react": ">=16.14.0",
|