@tramvai/module-child-app 5.14.9 → 5.15.1
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/render.browser.js +2 -1
- package/lib/browser/runCommand.browser.js +1 -1
- package/lib/server/loader.es.js +7 -3
- package/lib/server/loader.js +7 -3
- package/lib/server/render-slots.es.js +5 -1
- package/lib/server/render-slots.js +5 -1
- package/lib/server/render.es.js +2 -1
- package/lib/server/render.js +2 -1
- package/lib/server/stateManager.es.js +1 -1
- package/lib/server/stateManager.js +1 -1
- package/lib/shared/command.browser.js +1 -1
- package/lib/shared/command.es.js +1 -1
- package/lib/shared/command.js +1 -1
- package/lib/shared/pagePreload.browser.js +38 -22
- package/lib/shared/pagePreload.es.js +38 -22
- package/lib/shared/pagePreload.js +36 -20
- package/lib/shared/providers.browser.js +5 -1
- package/lib/shared/providers.es.js +5 -1
- package/lib/shared/providers.js +5 -1
- package/lib/shared/react/component.browser.js +10 -13
- package/lib/shared/react/component.es.js +10 -13
- package/lib/shared/react/component.js +10 -13
- package/lib/shared/resolutionConfigManager.browser.js +5 -1
- package/lib/shared/resolutionConfigManager.es.js +5 -1
- package/lib/shared/resolutionConfigManager.js +5 -1
- package/lib/shared/singletonDi.browser.js +1 -1
- package/lib/shared/singletonDi.es.js +1 -1
- package/lib/shared/singletonDi.js +1 -1
- package/package.json +12 -12
|
@@ -16,8 +16,9 @@ class RenderManager {
|
|
|
16
16
|
// for SPA-navigation, if Child App is preloaded first time, it is valid case
|
|
17
17
|
if (!this.preloadManager.isNotPreloadedForSpaNavigation(request)) {
|
|
18
18
|
this.log.warn({
|
|
19
|
+
event: 'not-preloaded',
|
|
19
20
|
message: 'Child-app has been used but not preloaded before React render',
|
|
20
|
-
request,
|
|
21
|
+
childApp: request,
|
|
21
22
|
});
|
|
22
23
|
}
|
|
23
24
|
const promiseDi = this.preloadManager.preload(request).then(() => {
|
|
@@ -12,7 +12,7 @@ const runCommand = async ({ status, forcePreload, runner, preloader, diManager,
|
|
|
12
12
|
if (status === 'spa') {
|
|
13
13
|
log.info({
|
|
14
14
|
message: 'Child App has been preloaded first time, current SPA-transition will not be blocked, Child App `spa` and `afterSpa` lines will be skipped',
|
|
15
|
-
config,
|
|
15
|
+
childApp: config,
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
return;
|
package/lib/server/loader.es.js
CHANGED
|
@@ -74,9 +74,13 @@ class ServerLoader extends Loader {
|
|
|
74
74
|
const entry = factory();
|
|
75
75
|
this.initializedMap.set(container, entry);
|
|
76
76
|
}
|
|
77
|
-
catch (
|
|
78
|
-
this.log.error(
|
|
79
|
-
|
|
77
|
+
catch (error) {
|
|
78
|
+
this.log.error({
|
|
79
|
+
event: 'init-mf-failed',
|
|
80
|
+
error,
|
|
81
|
+
childApp: { name: config.name, version: config.version, tag: config.tag },
|
|
82
|
+
});
|
|
83
|
+
throw error;
|
|
80
84
|
}
|
|
81
85
|
}
|
|
82
86
|
get(config) {
|
package/lib/server/loader.js
CHANGED
|
@@ -82,9 +82,13 @@ class ServerLoader extends loader.Loader {
|
|
|
82
82
|
const entry = factory();
|
|
83
83
|
this.initializedMap.set(container, entry);
|
|
84
84
|
}
|
|
85
|
-
catch (
|
|
86
|
-
this.log.error(
|
|
87
|
-
|
|
85
|
+
catch (error) {
|
|
86
|
+
this.log.error({
|
|
87
|
+
event: 'init-mf-failed',
|
|
88
|
+
error,
|
|
89
|
+
childApp: { name: config.name, version: config.version, tag: config.tag },
|
|
90
|
+
});
|
|
91
|
+
throw error;
|
|
88
92
|
}
|
|
89
93
|
}
|
|
90
94
|
get(config) {
|
|
@@ -152,7 +152,11 @@ const registerChildAppRenderSlots = ({ logger, diManager, resolveFullConfig, pre
|
|
|
152
152
|
catch (error) {
|
|
153
153
|
log.error({
|
|
154
154
|
event: 'get-slots-failed',
|
|
155
|
-
|
|
155
|
+
childApp: {
|
|
156
|
+
name: requestConfig.name,
|
|
157
|
+
version: requestConfig.version,
|
|
158
|
+
tag: requestConfig.tag,
|
|
159
|
+
},
|
|
156
160
|
});
|
|
157
161
|
}
|
|
158
162
|
});
|
|
@@ -160,7 +160,11 @@ const registerChildAppRenderSlots = ({ logger, diManager, resolveFullConfig, pre
|
|
|
160
160
|
catch (error) {
|
|
161
161
|
log.error({
|
|
162
162
|
event: 'get-slots-failed',
|
|
163
|
-
|
|
163
|
+
childApp: {
|
|
164
|
+
name: requestConfig.name,
|
|
165
|
+
version: requestConfig.version,
|
|
166
|
+
tag: requestConfig.tag,
|
|
167
|
+
},
|
|
164
168
|
});
|
|
165
169
|
}
|
|
166
170
|
});
|
package/lib/server/render.es.js
CHANGED
|
@@ -16,8 +16,9 @@ class RenderManager {
|
|
|
16
16
|
return [this.diManager.getChildDi(config), undefined];
|
|
17
17
|
}
|
|
18
18
|
this.log.warn({
|
|
19
|
+
event: 'not-preloaded',
|
|
19
20
|
message: 'Child-app has been used but not preloaded before React render',
|
|
20
|
-
request,
|
|
21
|
+
childApp: request,
|
|
21
22
|
});
|
|
22
23
|
return [undefined, undefined];
|
|
23
24
|
}
|
package/lib/server/render.js
CHANGED
|
@@ -20,8 +20,9 @@ class RenderManager {
|
|
|
20
20
|
return [this.diManager.getChildDi(config), undefined];
|
|
21
21
|
}
|
|
22
22
|
this.log.warn({
|
|
23
|
+
event: 'not-preloaded',
|
|
23
24
|
message: 'Child-app has been used but not preloaded before React render',
|
|
24
|
-
request,
|
|
25
|
+
childApp: request,
|
|
25
26
|
});
|
|
26
27
|
return [undefined, undefined];
|
|
27
28
|
}
|
package/lib/shared/command.es.js
CHANGED
package/lib/shared/command.js
CHANGED
|
@@ -1,30 +1,46 @@
|
|
|
1
1
|
import { provide, commandLineListTokens } from '@tramvai/core';
|
|
2
2
|
import { resolveLazyComponent } from '@tramvai/react';
|
|
3
|
-
import { CHILD_APP_PRELOAD_MANAGER_TOKEN } from '@tramvai/tokens-child-app';
|
|
4
|
-
import {
|
|
3
|
+
import { CHILD_APP_PRELOAD_SOURCE_LIST_TOKEN, CHILD_APP_PRELOAD_MANAGER_TOKEN } from '@tramvai/tokens-child-app';
|
|
4
|
+
import { PAGE_SERVICE_TOKEN, LINK_PREFETCH_HANDLER_TOKEN } from '@tramvai/tokens-router';
|
|
5
5
|
|
|
6
|
-
const pagePreload = async ({
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (
|
|
14
|
-
|
|
15
|
-
// for first preload on SPA-navigation, we need to prevent double action execution,
|
|
16
|
-
// and need to mark this Child App as not preloaded, to prevent running `spa` and `afterSpa` commands for it
|
|
17
|
-
if (mode === 'preload' && isSpaNavigation && !preloadManager.isPreloaded(request)) {
|
|
18
|
-
preloadManager.saveNotPreloadedForSpaNavigation(request);
|
|
19
|
-
}
|
|
20
|
-
return preloadManager[mode](request, route).catch(() => {
|
|
21
|
-
// actual error will be logged internally
|
|
22
|
-
});
|
|
23
|
-
}));
|
|
6
|
+
const pagePreload = async ({ preloadManager, preloadSourceList, }, mode, isSpaNavigation = false, route) => {
|
|
7
|
+
const childApps = (await Promise.all(preloadSourceList.map((source) => {
|
|
8
|
+
return source({ route });
|
|
9
|
+
}))).reduce((acc, source) => acc.concat(source), []);
|
|
10
|
+
await Promise.all(childApps.map((request) => {
|
|
11
|
+
// for first preload on SPA-navigation, we need to prevent double action execution,
|
|
12
|
+
// and need to mark this Child App as not preloaded, to prevent running `spa` and `afterSpa` commands for it
|
|
13
|
+
if (mode === 'preload' && isSpaNavigation && !preloadManager.isPreloaded(request)) {
|
|
14
|
+
preloadManager.saveNotPreloadedForSpaNavigation(request);
|
|
24
15
|
}
|
|
16
|
+
return preloadManager[mode](request, route).catch(() => {
|
|
17
|
+
// actual error will be logged internally
|
|
18
|
+
});
|
|
25
19
|
}));
|
|
26
20
|
};
|
|
27
21
|
const pagePreloadProviders = [
|
|
22
|
+
provide({
|
|
23
|
+
provide: CHILD_APP_PRELOAD_SOURCE_LIST_TOKEN,
|
|
24
|
+
useFactory: ({ pageService }) => {
|
|
25
|
+
return async function resolveChildAppsFromRouteComponents({ route }) {
|
|
26
|
+
const childApps = [];
|
|
27
|
+
const components = await Promise.all([
|
|
28
|
+
resolveLazyComponent(pageService.resolveComponentFromConfig('layout', route)),
|
|
29
|
+
resolveLazyComponent(pageService.resolveComponentFromConfig('nestedLayout', route)),
|
|
30
|
+
resolveLazyComponent(pageService.resolveComponentFromConfig('page', route)),
|
|
31
|
+
]);
|
|
32
|
+
components.forEach((component) => {
|
|
33
|
+
if (component?.childApps) {
|
|
34
|
+
childApps.push(...component.childApps);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
return childApps;
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
deps: {
|
|
41
|
+
pageService: PAGE_SERVICE_TOKEN,
|
|
42
|
+
},
|
|
43
|
+
}),
|
|
28
44
|
provide({
|
|
29
45
|
provide: LINK_PREFETCH_HANDLER_TOKEN,
|
|
30
46
|
useFactory: (deps) => {
|
|
@@ -34,8 +50,8 @@ const pagePreloadProviders = [
|
|
|
34
50
|
},
|
|
35
51
|
multi: true,
|
|
36
52
|
deps: {
|
|
37
|
-
pageService: PAGE_SERVICE_TOKEN,
|
|
38
53
|
preloadManager: CHILD_APP_PRELOAD_MANAGER_TOKEN,
|
|
54
|
+
preloadSourceList: CHILD_APP_PRELOAD_SOURCE_LIST_TOKEN,
|
|
39
55
|
},
|
|
40
56
|
}),
|
|
41
57
|
provide({
|
|
@@ -52,8 +68,8 @@ const pagePreloadProviders = [
|
|
|
52
68
|
},
|
|
53
69
|
multi: true,
|
|
54
70
|
deps: {
|
|
55
|
-
pageService: PAGE_SERVICE_TOKEN,
|
|
56
71
|
preloadManager: CHILD_APP_PRELOAD_MANAGER_TOKEN,
|
|
72
|
+
preloadSourceList: CHILD_APP_PRELOAD_SOURCE_LIST_TOKEN,
|
|
57
73
|
},
|
|
58
74
|
}),
|
|
59
75
|
];
|
|
@@ -1,30 +1,46 @@
|
|
|
1
1
|
import { provide, commandLineListTokens } from '@tramvai/core';
|
|
2
2
|
import { resolveLazyComponent } from '@tramvai/react';
|
|
3
|
-
import { CHILD_APP_PRELOAD_MANAGER_TOKEN } from '@tramvai/tokens-child-app';
|
|
4
|
-
import {
|
|
3
|
+
import { CHILD_APP_PRELOAD_SOURCE_LIST_TOKEN, CHILD_APP_PRELOAD_MANAGER_TOKEN } from '@tramvai/tokens-child-app';
|
|
4
|
+
import { PAGE_SERVICE_TOKEN, LINK_PREFETCH_HANDLER_TOKEN } from '@tramvai/tokens-router';
|
|
5
5
|
|
|
6
|
-
const pagePreload = async ({
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (
|
|
14
|
-
|
|
15
|
-
// for first preload on SPA-navigation, we need to prevent double action execution,
|
|
16
|
-
// and need to mark this Child App as not preloaded, to prevent running `spa` and `afterSpa` commands for it
|
|
17
|
-
if (mode === 'preload' && isSpaNavigation && !preloadManager.isPreloaded(request)) {
|
|
18
|
-
preloadManager.saveNotPreloadedForSpaNavigation(request);
|
|
19
|
-
}
|
|
20
|
-
return preloadManager[mode](request, route).catch(() => {
|
|
21
|
-
// actual error will be logged internally
|
|
22
|
-
});
|
|
23
|
-
}));
|
|
6
|
+
const pagePreload = async ({ preloadManager, preloadSourceList, }, mode, isSpaNavigation = false, route) => {
|
|
7
|
+
const childApps = (await Promise.all(preloadSourceList.map((source) => {
|
|
8
|
+
return source({ route });
|
|
9
|
+
}))).reduce((acc, source) => acc.concat(source), []);
|
|
10
|
+
await Promise.all(childApps.map((request) => {
|
|
11
|
+
// for first preload on SPA-navigation, we need to prevent double action execution,
|
|
12
|
+
// and need to mark this Child App as not preloaded, to prevent running `spa` and `afterSpa` commands for it
|
|
13
|
+
if (mode === 'preload' && isSpaNavigation && !preloadManager.isPreloaded(request)) {
|
|
14
|
+
preloadManager.saveNotPreloadedForSpaNavigation(request);
|
|
24
15
|
}
|
|
16
|
+
return preloadManager[mode](request, route).catch(() => {
|
|
17
|
+
// actual error will be logged internally
|
|
18
|
+
});
|
|
25
19
|
}));
|
|
26
20
|
};
|
|
27
21
|
const pagePreloadProviders = [
|
|
22
|
+
provide({
|
|
23
|
+
provide: CHILD_APP_PRELOAD_SOURCE_LIST_TOKEN,
|
|
24
|
+
useFactory: ({ pageService }) => {
|
|
25
|
+
return async function resolveChildAppsFromRouteComponents({ route }) {
|
|
26
|
+
const childApps = [];
|
|
27
|
+
const components = await Promise.all([
|
|
28
|
+
resolveLazyComponent(pageService.resolveComponentFromConfig('layout', route)),
|
|
29
|
+
resolveLazyComponent(pageService.resolveComponentFromConfig('nestedLayout', route)),
|
|
30
|
+
resolveLazyComponent(pageService.resolveComponentFromConfig('page', route)),
|
|
31
|
+
]);
|
|
32
|
+
components.forEach((component) => {
|
|
33
|
+
if (component?.childApps) {
|
|
34
|
+
childApps.push(...component.childApps);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
return childApps;
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
deps: {
|
|
41
|
+
pageService: PAGE_SERVICE_TOKEN,
|
|
42
|
+
},
|
|
43
|
+
}),
|
|
28
44
|
provide({
|
|
29
45
|
provide: LINK_PREFETCH_HANDLER_TOKEN,
|
|
30
46
|
useFactory: (deps) => {
|
|
@@ -34,8 +50,8 @@ const pagePreloadProviders = [
|
|
|
34
50
|
},
|
|
35
51
|
multi: true,
|
|
36
52
|
deps: {
|
|
37
|
-
pageService: PAGE_SERVICE_TOKEN,
|
|
38
53
|
preloadManager: CHILD_APP_PRELOAD_MANAGER_TOKEN,
|
|
54
|
+
preloadSourceList: CHILD_APP_PRELOAD_SOURCE_LIST_TOKEN,
|
|
39
55
|
},
|
|
40
56
|
}),
|
|
41
57
|
provide({
|
|
@@ -52,8 +68,8 @@ const pagePreloadProviders = [
|
|
|
52
68
|
},
|
|
53
69
|
multi: true,
|
|
54
70
|
deps: {
|
|
55
|
-
pageService: PAGE_SERVICE_TOKEN,
|
|
56
71
|
preloadManager: CHILD_APP_PRELOAD_MANAGER_TOKEN,
|
|
72
|
+
preloadSourceList: CHILD_APP_PRELOAD_SOURCE_LIST_TOKEN,
|
|
57
73
|
},
|
|
58
74
|
}),
|
|
59
75
|
];
|
|
@@ -7,28 +7,44 @@ var react = require('@tramvai/react');
|
|
|
7
7
|
var tokensChildApp = require('@tramvai/tokens-child-app');
|
|
8
8
|
var tokensRouter = require('@tramvai/tokens-router');
|
|
9
9
|
|
|
10
|
-
const pagePreload = async ({
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
if (
|
|
18
|
-
|
|
19
|
-
// for first preload on SPA-navigation, we need to prevent double action execution,
|
|
20
|
-
// and need to mark this Child App as not preloaded, to prevent running `spa` and `afterSpa` commands for it
|
|
21
|
-
if (mode === 'preload' && isSpaNavigation && !preloadManager.isPreloaded(request)) {
|
|
22
|
-
preloadManager.saveNotPreloadedForSpaNavigation(request);
|
|
23
|
-
}
|
|
24
|
-
return preloadManager[mode](request, route).catch(() => {
|
|
25
|
-
// actual error will be logged internally
|
|
26
|
-
});
|
|
27
|
-
}));
|
|
10
|
+
const pagePreload = async ({ preloadManager, preloadSourceList, }, mode, isSpaNavigation = false, route) => {
|
|
11
|
+
const childApps = (await Promise.all(preloadSourceList.map((source) => {
|
|
12
|
+
return source({ route });
|
|
13
|
+
}))).reduce((acc, source) => acc.concat(source), []);
|
|
14
|
+
await Promise.all(childApps.map((request) => {
|
|
15
|
+
// for first preload on SPA-navigation, we need to prevent double action execution,
|
|
16
|
+
// and need to mark this Child App as not preloaded, to prevent running `spa` and `afterSpa` commands for it
|
|
17
|
+
if (mode === 'preload' && isSpaNavigation && !preloadManager.isPreloaded(request)) {
|
|
18
|
+
preloadManager.saveNotPreloadedForSpaNavigation(request);
|
|
28
19
|
}
|
|
20
|
+
return preloadManager[mode](request, route).catch(() => {
|
|
21
|
+
// actual error will be logged internally
|
|
22
|
+
});
|
|
29
23
|
}));
|
|
30
24
|
};
|
|
31
25
|
const pagePreloadProviders = [
|
|
26
|
+
core.provide({
|
|
27
|
+
provide: tokensChildApp.CHILD_APP_PRELOAD_SOURCE_LIST_TOKEN,
|
|
28
|
+
useFactory: ({ pageService }) => {
|
|
29
|
+
return async function resolveChildAppsFromRouteComponents({ route }) {
|
|
30
|
+
const childApps = [];
|
|
31
|
+
const components = await Promise.all([
|
|
32
|
+
react.resolveLazyComponent(pageService.resolveComponentFromConfig('layout', route)),
|
|
33
|
+
react.resolveLazyComponent(pageService.resolveComponentFromConfig('nestedLayout', route)),
|
|
34
|
+
react.resolveLazyComponent(pageService.resolveComponentFromConfig('page', route)),
|
|
35
|
+
]);
|
|
36
|
+
components.forEach((component) => {
|
|
37
|
+
if (component?.childApps) {
|
|
38
|
+
childApps.push(...component.childApps);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
return childApps;
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
deps: {
|
|
45
|
+
pageService: tokensRouter.PAGE_SERVICE_TOKEN,
|
|
46
|
+
},
|
|
47
|
+
}),
|
|
32
48
|
core.provide({
|
|
33
49
|
provide: tokensRouter.LINK_PREFETCH_HANDLER_TOKEN,
|
|
34
50
|
useFactory: (deps) => {
|
|
@@ -38,8 +54,8 @@ const pagePreloadProviders = [
|
|
|
38
54
|
},
|
|
39
55
|
multi: true,
|
|
40
56
|
deps: {
|
|
41
|
-
pageService: tokensRouter.PAGE_SERVICE_TOKEN,
|
|
42
57
|
preloadManager: tokensChildApp.CHILD_APP_PRELOAD_MANAGER_TOKEN,
|
|
58
|
+
preloadSourceList: tokensChildApp.CHILD_APP_PRELOAD_SOURCE_LIST_TOKEN,
|
|
43
59
|
},
|
|
44
60
|
}),
|
|
45
61
|
core.provide({
|
|
@@ -56,8 +72,8 @@ const pagePreloadProviders = [
|
|
|
56
72
|
},
|
|
57
73
|
multi: true,
|
|
58
74
|
deps: {
|
|
59
|
-
pageService: tokensRouter.PAGE_SERVICE_TOKEN,
|
|
60
75
|
preloadManager: tokensChildApp.CHILD_APP_PRELOAD_MANAGER_TOKEN,
|
|
76
|
+
preloadSourceList: tokensChildApp.CHILD_APP_PRELOAD_SOURCE_LIST_TOKEN,
|
|
61
77
|
},
|
|
62
78
|
}),
|
|
63
79
|
];
|
|
@@ -60,7 +60,11 @@ const sharedProviders = [
|
|
|
60
60
|
const req = { name, tag, version: request.version };
|
|
61
61
|
const config = resolutionConfigManager.resolve(req);
|
|
62
62
|
if (!config) {
|
|
63
|
-
log.error(
|
|
63
|
+
log.error({
|
|
64
|
+
event: 'config-not-found',
|
|
65
|
+
message: `Child-app "${name}" with tag "${tag}" has not found`,
|
|
66
|
+
childApp: req,
|
|
67
|
+
});
|
|
64
68
|
return;
|
|
65
69
|
}
|
|
66
70
|
const { version, baseUrl: configBaseUrl, client, server, css, withoutCss } = config;
|
|
@@ -60,7 +60,11 @@ const sharedProviders = [
|
|
|
60
60
|
const req = { name, tag, version: request.version };
|
|
61
61
|
const config = resolutionConfigManager.resolve(req);
|
|
62
62
|
if (!config) {
|
|
63
|
-
log.error(
|
|
63
|
+
log.error({
|
|
64
|
+
event: 'config-not-found',
|
|
65
|
+
message: `Child-app "${name}" with tag "${tag}" has not found`,
|
|
66
|
+
childApp: req,
|
|
67
|
+
});
|
|
64
68
|
return;
|
|
65
69
|
}
|
|
66
70
|
const { version, baseUrl: configBaseUrl, client, server, css, withoutCss } = config;
|
package/lib/shared/providers.js
CHANGED
|
@@ -64,7 +64,11 @@ const sharedProviders = [
|
|
|
64
64
|
const req = { name, tag, version: request.version };
|
|
65
65
|
const config = resolutionConfigManager.resolve(req);
|
|
66
66
|
if (!config) {
|
|
67
|
-
log.error(
|
|
67
|
+
log.error({
|
|
68
|
+
event: 'config-not-found',
|
|
69
|
+
message: `Child-app "${name}" with tag "${tag}" has not found`,
|
|
70
|
+
childApp: req,
|
|
71
|
+
});
|
|
68
72
|
return;
|
|
69
73
|
}
|
|
70
74
|
const { version, baseUrl: configBaseUrl, client, server, css, withoutCss } = config;
|
|
@@ -8,7 +8,8 @@ import { RenderContext } from './render-context.browser.js';
|
|
|
8
8
|
import { Extractor } from './extractor.browser.browser.js';
|
|
9
9
|
import { ChildAppErrorBoundary } from './childAppErrorBoundary.browser.js';
|
|
10
10
|
|
|
11
|
-
const FailedChildAppFallback = ({ config
|
|
11
|
+
const FailedChildAppFallback = ({ config }) => {
|
|
12
|
+
const { name, version, tag, fallback: Fallback } = config;
|
|
12
13
|
const logger = useDi(LOGGER_TOKEN);
|
|
13
14
|
const log = logger('child-app:render');
|
|
14
15
|
// On client-side hydration errors will be handled in `hydrateRoot` `onRecoverableError` property,
|
|
@@ -23,9 +24,7 @@ const FailedChildAppFallback = ({ config: { name, version, tag, fallback: Fallba
|
|
|
23
24
|
log.error({
|
|
24
25
|
event: 'failed-render',
|
|
25
26
|
message: 'child-app failed to render, will try to recover during hydration',
|
|
26
|
-
name,
|
|
27
|
-
version,
|
|
28
|
-
tag,
|
|
27
|
+
childApp: { name, version, tag },
|
|
29
28
|
});
|
|
30
29
|
}
|
|
31
30
|
return Fallback ? jsx(Fallback, {}) : null;
|
|
@@ -57,10 +56,8 @@ const ChildAppWrapper = ({ name, version, tag, props, fallback: Fallback, }) =>
|
|
|
57
56
|
if (!di) {
|
|
58
57
|
log.error({
|
|
59
58
|
event: 'not-found',
|
|
60
|
-
name,
|
|
61
|
-
version,
|
|
62
|
-
tag,
|
|
63
59
|
message: 'child-app was not initialized',
|
|
60
|
+
childApp: { name, version, tag },
|
|
64
61
|
});
|
|
65
62
|
if (process.env.__TRAMVAI_CONCURRENT_FEATURES || typeof window !== 'undefined') {
|
|
66
63
|
throw new Error(`Child-app was not initialized, check the loading error for child-app "${name}"`);
|
|
@@ -73,9 +70,7 @@ const ChildAppWrapper = ({ name, version, tag, props, fallback: Fallback, }) =>
|
|
|
73
70
|
log.error({
|
|
74
71
|
event: 'empty-render',
|
|
75
72
|
message: 'Child-app does not provide render token',
|
|
76
|
-
name,
|
|
77
|
-
version,
|
|
78
|
-
tag,
|
|
73
|
+
childApp: { name, version, tag },
|
|
79
74
|
});
|
|
80
75
|
return null;
|
|
81
76
|
}
|
|
@@ -85,10 +80,12 @@ const ChildAppWrapper = ({ name, version, tag, props, fallback: Fallback, }) =>
|
|
|
85
80
|
log.error({
|
|
86
81
|
event: 'get-render',
|
|
87
82
|
message: 'Cannot get render token from child-app',
|
|
83
|
+
childApp: {
|
|
84
|
+
name,
|
|
85
|
+
version,
|
|
86
|
+
tag,
|
|
87
|
+
},
|
|
88
88
|
error,
|
|
89
|
-
name,
|
|
90
|
-
version,
|
|
91
|
-
tag,
|
|
92
89
|
});
|
|
93
90
|
return null;
|
|
94
91
|
}
|
|
@@ -8,7 +8,8 @@ import { RenderContext } from './render-context.es.js';
|
|
|
8
8
|
import { Extractor } from './extractor.es.js';
|
|
9
9
|
import { ChildAppErrorBoundary } from './childAppErrorBoundary.es.js';
|
|
10
10
|
|
|
11
|
-
const FailedChildAppFallback = ({ config
|
|
11
|
+
const FailedChildAppFallback = ({ config }) => {
|
|
12
|
+
const { name, version, tag, fallback: Fallback } = config;
|
|
12
13
|
const logger = useDi(LOGGER_TOKEN);
|
|
13
14
|
const log = logger('child-app:render');
|
|
14
15
|
// On client-side hydration errors will be handled in `hydrateRoot` `onRecoverableError` property,
|
|
@@ -23,9 +24,7 @@ const FailedChildAppFallback = ({ config: { name, version, tag, fallback: Fallba
|
|
|
23
24
|
log.error({
|
|
24
25
|
event: 'failed-render',
|
|
25
26
|
message: 'child-app failed to render, will try to recover during hydration',
|
|
26
|
-
name,
|
|
27
|
-
version,
|
|
28
|
-
tag,
|
|
27
|
+
childApp: { name, version, tag },
|
|
29
28
|
});
|
|
30
29
|
}
|
|
31
30
|
return Fallback ? jsx(Fallback, {}) : null;
|
|
@@ -57,10 +56,8 @@ const ChildAppWrapper = ({ name, version, tag, props, fallback: Fallback, }) =>
|
|
|
57
56
|
if (!di) {
|
|
58
57
|
log.error({
|
|
59
58
|
event: 'not-found',
|
|
60
|
-
name,
|
|
61
|
-
version,
|
|
62
|
-
tag,
|
|
63
59
|
message: 'child-app was not initialized',
|
|
60
|
+
childApp: { name, version, tag },
|
|
64
61
|
});
|
|
65
62
|
if (process.env.__TRAMVAI_CONCURRENT_FEATURES || typeof window !== 'undefined') {
|
|
66
63
|
throw new Error(`Child-app was not initialized, check the loading error for child-app "${name}"`);
|
|
@@ -73,9 +70,7 @@ const ChildAppWrapper = ({ name, version, tag, props, fallback: Fallback, }) =>
|
|
|
73
70
|
log.error({
|
|
74
71
|
event: 'empty-render',
|
|
75
72
|
message: 'Child-app does not provide render token',
|
|
76
|
-
name,
|
|
77
|
-
version,
|
|
78
|
-
tag,
|
|
73
|
+
childApp: { name, version, tag },
|
|
79
74
|
});
|
|
80
75
|
return null;
|
|
81
76
|
}
|
|
@@ -85,10 +80,12 @@ const ChildAppWrapper = ({ name, version, tag, props, fallback: Fallback, }) =>
|
|
|
85
80
|
log.error({
|
|
86
81
|
event: 'get-render',
|
|
87
82
|
message: 'Cannot get render token from child-app',
|
|
83
|
+
childApp: {
|
|
84
|
+
name,
|
|
85
|
+
version,
|
|
86
|
+
tag,
|
|
87
|
+
},
|
|
88
88
|
error,
|
|
89
|
-
name,
|
|
90
|
-
version,
|
|
91
|
-
tag,
|
|
92
89
|
});
|
|
93
90
|
return null;
|
|
94
91
|
}
|
|
@@ -16,7 +16,8 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
16
16
|
|
|
17
17
|
var noop__default = /*#__PURE__*/_interopDefaultLegacy(noop);
|
|
18
18
|
|
|
19
|
-
const FailedChildAppFallback = ({ config
|
|
19
|
+
const FailedChildAppFallback = ({ config }) => {
|
|
20
|
+
const { name, version, tag, fallback: Fallback } = config;
|
|
20
21
|
const logger = react$1.useDi(tokensCommon.LOGGER_TOKEN);
|
|
21
22
|
const log = logger('child-app:render');
|
|
22
23
|
// On client-side hydration errors will be handled in `hydrateRoot` `onRecoverableError` property,
|
|
@@ -31,9 +32,7 @@ const FailedChildAppFallback = ({ config: { name, version, tag, fallback: Fallba
|
|
|
31
32
|
log.error({
|
|
32
33
|
event: 'failed-render',
|
|
33
34
|
message: 'child-app failed to render, will try to recover during hydration',
|
|
34
|
-
name,
|
|
35
|
-
version,
|
|
36
|
-
tag,
|
|
35
|
+
childApp: { name, version, tag },
|
|
37
36
|
});
|
|
38
37
|
}
|
|
39
38
|
return Fallback ? jsxRuntime.jsx(Fallback, {}) : null;
|
|
@@ -65,10 +64,8 @@ const ChildAppWrapper = ({ name, version, tag, props, fallback: Fallback, }) =>
|
|
|
65
64
|
if (!di) {
|
|
66
65
|
log.error({
|
|
67
66
|
event: 'not-found',
|
|
68
|
-
name,
|
|
69
|
-
version,
|
|
70
|
-
tag,
|
|
71
67
|
message: 'child-app was not initialized',
|
|
68
|
+
childApp: { name, version, tag },
|
|
72
69
|
});
|
|
73
70
|
if (process.env.__TRAMVAI_CONCURRENT_FEATURES || typeof window !== 'undefined') {
|
|
74
71
|
throw new Error(`Child-app was not initialized, check the loading error for child-app "${name}"`);
|
|
@@ -81,9 +78,7 @@ const ChildAppWrapper = ({ name, version, tag, props, fallback: Fallback, }) =>
|
|
|
81
78
|
log.error({
|
|
82
79
|
event: 'empty-render',
|
|
83
80
|
message: 'Child-app does not provide render token',
|
|
84
|
-
name,
|
|
85
|
-
version,
|
|
86
|
-
tag,
|
|
81
|
+
childApp: { name, version, tag },
|
|
87
82
|
});
|
|
88
83
|
return null;
|
|
89
84
|
}
|
|
@@ -93,10 +88,12 @@ const ChildAppWrapper = ({ name, version, tag, props, fallback: Fallback, }) =>
|
|
|
93
88
|
log.error({
|
|
94
89
|
event: 'get-render',
|
|
95
90
|
message: 'Cannot get render token from child-app',
|
|
91
|
+
childApp: {
|
|
92
|
+
name,
|
|
93
|
+
version,
|
|
94
|
+
tag,
|
|
95
|
+
},
|
|
96
96
|
error,
|
|
97
|
-
name,
|
|
98
|
-
version,
|
|
99
|
-
tag,
|
|
100
97
|
});
|
|
101
98
|
return null;
|
|
102
99
|
}
|
|
@@ -22,7 +22,11 @@ class ChildAppResolutionConfigManager {
|
|
|
22
22
|
return applyOrReturn([], rawConfig);
|
|
23
23
|
})
|
|
24
24
|
.catch((error) => {
|
|
25
|
-
this.log.error(
|
|
25
|
+
this.log.error({
|
|
26
|
+
event: 'config-resolve-failed',
|
|
27
|
+
message: 'Failed while resolving resolution config',
|
|
28
|
+
error,
|
|
29
|
+
});
|
|
26
30
|
});
|
|
27
31
|
}));
|
|
28
32
|
flatten(configs).forEach((config) => {
|
|
@@ -22,7 +22,11 @@ class ChildAppResolutionConfigManager {
|
|
|
22
22
|
return applyOrReturn([], rawConfig);
|
|
23
23
|
})
|
|
24
24
|
.catch((error) => {
|
|
25
|
-
this.log.error(
|
|
25
|
+
this.log.error({
|
|
26
|
+
event: 'config-resolve-failed',
|
|
27
|
+
message: 'Failed while resolving resolution config',
|
|
28
|
+
error,
|
|
29
|
+
});
|
|
26
30
|
});
|
|
27
31
|
}));
|
|
28
32
|
flatten(configs).forEach((config) => {
|
|
@@ -31,7 +31,11 @@ class ChildAppResolutionConfigManager {
|
|
|
31
31
|
return applyOrReturn__default["default"]([], rawConfig);
|
|
32
32
|
})
|
|
33
33
|
.catch((error) => {
|
|
34
|
-
this.log.error(
|
|
34
|
+
this.log.error({
|
|
35
|
+
event: 'config-resolve-failed',
|
|
36
|
+
message: 'Failed while resolving resolution config',
|
|
37
|
+
error,
|
|
38
|
+
});
|
|
35
39
|
});
|
|
36
40
|
}));
|
|
37
41
|
flatten__default["default"](configs).forEach((config) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/module-child-app",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.15.1",
|
|
4
4
|
"description": "Module for child apps",
|
|
5
5
|
"browser": {
|
|
6
6
|
"./lib/server.js": "./lib/browser.js",
|
|
@@ -32,24 +32,24 @@
|
|
|
32
32
|
"@loadable/server": "^5.15.0",
|
|
33
33
|
"@tinkoff/env-validators": "0.4.2",
|
|
34
34
|
"@tinkoff/module-loader-client": "0.7.3",
|
|
35
|
-
"@tinkoff/module-loader-server": "0.8.
|
|
36
|
-
"@tramvai/module-common": "5.
|
|
35
|
+
"@tinkoff/module-loader-server": "0.8.4",
|
|
36
|
+
"@tramvai/module-common": "5.15.1",
|
|
37
37
|
"@tinkoff/url": "0.11.2",
|
|
38
|
-
"@tramvai/child-app-core": "5.
|
|
38
|
+
"@tramvai/child-app-core": "5.15.1",
|
|
39
39
|
"@tramvai/safe-strings": "0.8.4",
|
|
40
|
-
"@tramvai/tokens-child-app": "5.
|
|
40
|
+
"@tramvai/tokens-child-app": "5.15.1"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"@tinkoff/dippy": "0.11.3",
|
|
45
|
-
"@tinkoff/router": "0.5.
|
|
45
|
+
"@tinkoff/router": "0.5.49",
|
|
46
46
|
"@tinkoff/utils": "^2.1.2",
|
|
47
|
-
"@tramvai/core": "5.
|
|
48
|
-
"@tramvai/state": "5.
|
|
49
|
-
"@tramvai/react": "5.
|
|
50
|
-
"@tramvai/tokens-common": "5.
|
|
51
|
-
"@tramvai/tokens-render": "5.
|
|
52
|
-
"@tramvai/tokens-router": "5.
|
|
47
|
+
"@tramvai/core": "5.15.1",
|
|
48
|
+
"@tramvai/state": "5.15.1",
|
|
49
|
+
"@tramvai/react": "5.15.1",
|
|
50
|
+
"@tramvai/tokens-common": "5.15.1",
|
|
51
|
+
"@tramvai/tokens-render": "5.15.1",
|
|
52
|
+
"@tramvai/tokens-router": "5.15.1",
|
|
53
53
|
"react": ">=16.14.0",
|
|
54
54
|
"react-dom": ">=16.14.0",
|
|
55
55
|
"object-assign": "^4.1.1",
|