@tramvai/module-child-app 2.40.0 → 2.44.2
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.browser.js +6 -4
- package/lib/server.es.js +20 -18
- package/lib/server.js +20 -18
- package/lib/shared/providers.d.ts +3 -0
- package/lib/shared/resolutionConfigManager.d.ts +1 -1
- package/package.json +9 -9
package/lib/server.browser.js
CHANGED
|
@@ -550,14 +550,16 @@ const sharedProviders = [
|
|
|
550
550
|
provide: commandLineListTokens$1.resolvePageDeps,
|
|
551
551
|
useFactory: ({ pageService, preloadManager }) => {
|
|
552
552
|
return async function preloadChildAppByComponent() {
|
|
553
|
-
var _a, _b, _c, _d;
|
|
554
|
-
const [layoutComponent, pageComponent] = await Promise.all([
|
|
553
|
+
var _a, _b, _c, _d, _e, _f;
|
|
554
|
+
const [layoutComponent, nestedLayoutComponent, pageComponent] = await Promise.all([
|
|
555
555
|
resolveLazyComponent(pageService.resolveComponentFromConfig('layout')),
|
|
556
|
+
resolveLazyComponent(pageService.resolveComponentFromConfig('nestedLayout')),
|
|
556
557
|
resolveLazyComponent(pageService.resolveComponentFromConfig('page')),
|
|
557
558
|
]);
|
|
558
559
|
await Promise.all([
|
|
559
560
|
...((_b = (_a = layoutComponent === null || layoutComponent === void 0 ? void 0 : layoutComponent.childApps) === null || _a === void 0 ? void 0 : _a.map((request) => preloadManager.preload(request))) !== null && _b !== void 0 ? _b : []),
|
|
560
|
-
...((_d = (_c =
|
|
561
|
+
...((_d = (_c = nestedLayoutComponent === null || nestedLayoutComponent === void 0 ? void 0 : nestedLayoutComponent.childApps) === null || _c === void 0 ? void 0 : _c.map((request) => preloadManager.preload(request))) !== null && _d !== void 0 ? _d : []),
|
|
562
|
+
...((_f = (_e = pageComponent === null || pageComponent === void 0 ? void 0 : pageComponent.childApps) === null || _e === void 0 ? void 0 : _e.map((request) => preloadManager.preload(request))) !== null && _f !== void 0 ? _f : []),
|
|
561
563
|
]);
|
|
562
564
|
};
|
|
563
565
|
},
|
|
@@ -684,7 +686,7 @@ class BrowserLoader extends Loader {
|
|
|
684
686
|
event: 'load-failed',
|
|
685
687
|
moduleName,
|
|
686
688
|
});
|
|
687
|
-
return Promise.reject(new Error(`Error resolving
|
|
689
|
+
return Promise.reject(new Error(`Error resolving child-app ${moduleName}`));
|
|
688
690
|
}
|
|
689
691
|
async init(config) {
|
|
690
692
|
const container = getModuleFromGlobal(config.client.entry);
|
package/lib/server.es.js
CHANGED
|
@@ -488,14 +488,16 @@ const sharedProviders = [
|
|
|
488
488
|
provide: commandLineListTokens$1.resolvePageDeps,
|
|
489
489
|
useFactory: ({ pageService, preloadManager }) => {
|
|
490
490
|
return async function preloadChildAppByComponent() {
|
|
491
|
-
var _a, _b, _c, _d;
|
|
492
|
-
const [layoutComponent, pageComponent] = await Promise.all([
|
|
491
|
+
var _a, _b, _c, _d, _e, _f;
|
|
492
|
+
const [layoutComponent, nestedLayoutComponent, pageComponent] = await Promise.all([
|
|
493
493
|
resolveLazyComponent(pageService.resolveComponentFromConfig('layout')),
|
|
494
|
+
resolveLazyComponent(pageService.resolveComponentFromConfig('nestedLayout')),
|
|
494
495
|
resolveLazyComponent(pageService.resolveComponentFromConfig('page')),
|
|
495
496
|
]);
|
|
496
497
|
await Promise.all([
|
|
497
498
|
...((_b = (_a = layoutComponent === null || layoutComponent === void 0 ? void 0 : layoutComponent.childApps) === null || _a === void 0 ? void 0 : _a.map((request) => preloadManager.preload(request))) !== null && _b !== void 0 ? _b : []),
|
|
498
|
-
...((_d = (_c =
|
|
499
|
+
...((_d = (_c = nestedLayoutComponent === null || nestedLayoutComponent === void 0 ? void 0 : nestedLayoutComponent.childApps) === null || _c === void 0 ? void 0 : _c.map((request) => preloadManager.preload(request))) !== null && _d !== void 0 ? _d : []),
|
|
500
|
+
...((_f = (_e = pageComponent === null || pageComponent === void 0 ? void 0 : pageComponent.childApps) === null || _e === void 0 ? void 0 : _e.map((request) => preloadManager.preload(request))) !== null && _f !== void 0 ? _f : []),
|
|
499
501
|
]);
|
|
500
502
|
};
|
|
501
503
|
},
|
|
@@ -645,6 +647,9 @@ class PreloadManager {
|
|
|
645
647
|
}
|
|
646
648
|
const promise = this.loader
|
|
647
649
|
.load(config)
|
|
650
|
+
.catch(() => {
|
|
651
|
+
// Actual error will be logged by the internals of this.loader
|
|
652
|
+
})
|
|
648
653
|
.then(() => {
|
|
649
654
|
if (this.shouldRunImmediately) {
|
|
650
655
|
return this.run('customer', config);
|
|
@@ -798,21 +803,16 @@ const registerChildAppRenderSlots = ({ logger, diManager, resolveFullConfig, pre
|
|
|
798
803
|
preloadManager.getPreloadedList().forEach((requestConfig) => {
|
|
799
804
|
const config = resolveFullConfig(requestConfig);
|
|
800
805
|
const di = diManager.getChildDi(config);
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
{
|
|
806
|
-
|
|
807
|
-
slot: ResourceSlot.HEAD_CORE_SCRIPTS,
|
|
808
|
-
payload: config.client.entry,
|
|
809
|
-
attrs: {
|
|
810
|
-
'data-critical': 'true',
|
|
811
|
-
},
|
|
806
|
+
result.push({
|
|
807
|
+
type: ResourceType.script,
|
|
808
|
+
slot: ResourceSlot.HEAD_CORE_SCRIPTS,
|
|
809
|
+
payload: config.client.entry,
|
|
810
|
+
attrs: {
|
|
811
|
+
'data-critical': 'true',
|
|
812
812
|
},
|
|
813
|
-
|
|
813
|
+
});
|
|
814
814
|
if (config.css) {
|
|
815
|
-
|
|
815
|
+
result.push({
|
|
816
816
|
type: ResourceType.style,
|
|
817
817
|
slot: ResourceSlot.HEAD_CORE_STYLES,
|
|
818
818
|
payload: config.css.entry,
|
|
@@ -821,10 +821,13 @@ const registerChildAppRenderSlots = ({ logger, diManager, resolveFullConfig, pre
|
|
|
821
821
|
},
|
|
822
822
|
});
|
|
823
823
|
}
|
|
824
|
+
if (!di) {
|
|
825
|
+
return;
|
|
826
|
+
}
|
|
824
827
|
try {
|
|
825
828
|
const renderSlots = di.get({ token: RENDER_SLOTS, optional: true });
|
|
826
829
|
if (renderSlots) {
|
|
827
|
-
|
|
830
|
+
result.push(...renderSlots);
|
|
828
831
|
}
|
|
829
832
|
}
|
|
830
833
|
catch (error) {
|
|
@@ -833,7 +836,6 @@ const registerChildAppRenderSlots = ({ logger, diManager, resolveFullConfig, pre
|
|
|
833
836
|
config: requestConfig,
|
|
834
837
|
});
|
|
835
838
|
}
|
|
836
|
-
result.push(...slots);
|
|
837
839
|
});
|
|
838
840
|
return result;
|
|
839
841
|
};
|
package/lib/server.js
CHANGED
|
@@ -497,14 +497,16 @@ const sharedProviders = [
|
|
|
497
497
|
provide: core.commandLineListTokens.resolvePageDeps,
|
|
498
498
|
useFactory: ({ pageService, preloadManager }) => {
|
|
499
499
|
return async function preloadChildAppByComponent() {
|
|
500
|
-
var _a, _b, _c, _d;
|
|
501
|
-
const [layoutComponent, pageComponent] = await Promise.all([
|
|
500
|
+
var _a, _b, _c, _d, _e, _f;
|
|
501
|
+
const [layoutComponent, nestedLayoutComponent, pageComponent] = await Promise.all([
|
|
502
502
|
react$1.resolveLazyComponent(pageService.resolveComponentFromConfig('layout')),
|
|
503
|
+
react$1.resolveLazyComponent(pageService.resolveComponentFromConfig('nestedLayout')),
|
|
503
504
|
react$1.resolveLazyComponent(pageService.resolveComponentFromConfig('page')),
|
|
504
505
|
]);
|
|
505
506
|
await Promise.all([
|
|
506
507
|
...((_b = (_a = layoutComponent === null || layoutComponent === void 0 ? void 0 : layoutComponent.childApps) === null || _a === void 0 ? void 0 : _a.map((request) => preloadManager.preload(request))) !== null && _b !== void 0 ? _b : []),
|
|
507
|
-
...((_d = (_c =
|
|
508
|
+
...((_d = (_c = nestedLayoutComponent === null || nestedLayoutComponent === void 0 ? void 0 : nestedLayoutComponent.childApps) === null || _c === void 0 ? void 0 : _c.map((request) => preloadManager.preload(request))) !== null && _d !== void 0 ? _d : []),
|
|
509
|
+
...((_f = (_e = pageComponent === null || pageComponent === void 0 ? void 0 : pageComponent.childApps) === null || _e === void 0 ? void 0 : _e.map((request) => preloadManager.preload(request))) !== null && _f !== void 0 ? _f : []),
|
|
508
510
|
]);
|
|
509
511
|
};
|
|
510
512
|
},
|
|
@@ -654,6 +656,9 @@ class PreloadManager {
|
|
|
654
656
|
}
|
|
655
657
|
const promise = this.loader
|
|
656
658
|
.load(config)
|
|
659
|
+
.catch(() => {
|
|
660
|
+
// Actual error will be logged by the internals of this.loader
|
|
661
|
+
})
|
|
657
662
|
.then(() => {
|
|
658
663
|
if (this.shouldRunImmediately) {
|
|
659
664
|
return this.run('customer', config);
|
|
@@ -807,21 +812,16 @@ const registerChildAppRenderSlots = ({ logger, diManager, resolveFullConfig, pre
|
|
|
807
812
|
preloadManager.getPreloadedList().forEach((requestConfig) => {
|
|
808
813
|
const config = resolveFullConfig(requestConfig);
|
|
809
814
|
const di = diManager.getChildDi(config);
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
{
|
|
815
|
-
|
|
816
|
-
slot: tokensRender.ResourceSlot.HEAD_CORE_SCRIPTS,
|
|
817
|
-
payload: config.client.entry,
|
|
818
|
-
attrs: {
|
|
819
|
-
'data-critical': 'true',
|
|
820
|
-
},
|
|
815
|
+
result.push({
|
|
816
|
+
type: tokensRender.ResourceType.script,
|
|
817
|
+
slot: tokensRender.ResourceSlot.HEAD_CORE_SCRIPTS,
|
|
818
|
+
payload: config.client.entry,
|
|
819
|
+
attrs: {
|
|
820
|
+
'data-critical': 'true',
|
|
821
821
|
},
|
|
822
|
-
|
|
822
|
+
});
|
|
823
823
|
if (config.css) {
|
|
824
|
-
|
|
824
|
+
result.push({
|
|
825
825
|
type: tokensRender.ResourceType.style,
|
|
826
826
|
slot: tokensRender.ResourceSlot.HEAD_CORE_STYLES,
|
|
827
827
|
payload: config.css.entry,
|
|
@@ -830,10 +830,13 @@ const registerChildAppRenderSlots = ({ logger, diManager, resolveFullConfig, pre
|
|
|
830
830
|
},
|
|
831
831
|
});
|
|
832
832
|
}
|
|
833
|
+
if (!di) {
|
|
834
|
+
return;
|
|
835
|
+
}
|
|
833
836
|
try {
|
|
834
837
|
const renderSlots = di.get({ token: tokensRender.RENDER_SLOTS, optional: true });
|
|
835
838
|
if (renderSlots) {
|
|
836
|
-
|
|
839
|
+
result.push(...renderSlots);
|
|
837
840
|
}
|
|
838
841
|
}
|
|
839
842
|
catch (error) {
|
|
@@ -842,7 +845,6 @@ const registerChildAppRenderSlots = ({ logger, diManager, resolveFullConfig, pre
|
|
|
842
845
|
config: requestConfig,
|
|
843
846
|
});
|
|
844
847
|
}
|
|
845
|
-
result.push(...slots);
|
|
846
848
|
});
|
|
847
849
|
return result;
|
|
848
850
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ChildAppRequestConfig, CHILD_APP_RESOLUTION_CONFIGS_TOKEN, CHILD_APP_RESOLUTION_CONFIG_MANAGER_TOKEN, ResolutionConfig } from '@tramvai/tokens-child-app';
|
|
2
2
|
import type { ExtractDependencyType, ExtractTokenType } from '@tinkoff/dippy';
|
|
3
|
-
|
|
3
|
+
type Interface = ExtractTokenType<typeof CHILD_APP_RESOLUTION_CONFIG_MANAGER_TOKEN>;
|
|
4
4
|
export declare class ChildAppResolutionConfigManager implements Interface {
|
|
5
5
|
private rawConfigs;
|
|
6
6
|
private mapping;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/module-child-app",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.44.2",
|
|
4
4
|
"description": "Module for child apps",
|
|
5
5
|
"browser": {
|
|
6
6
|
"./lib/server.js": "./lib/browser.js",
|
|
@@ -31,20 +31,20 @@
|
|
|
31
31
|
"@tinkoff/env-validators": "0.1.4",
|
|
32
32
|
"@tinkoff/module-loader-client": "0.4.4",
|
|
33
33
|
"@tinkoff/module-loader-server": "0.5.5",
|
|
34
|
-
"@tramvai/child-app-core": "2.
|
|
34
|
+
"@tramvai/child-app-core": "2.44.2",
|
|
35
35
|
"@tramvai/safe-strings": "0.5.5",
|
|
36
|
-
"@tramvai/tokens-child-app": "2.
|
|
36
|
+
"@tramvai/tokens-child-app": "2.44.2"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"@tinkoff/dippy": "0.8.9",
|
|
41
41
|
"@tinkoff/utils": "^2.1.2",
|
|
42
|
-
"@tramvai/core": "2.
|
|
43
|
-
"@tramvai/state": "2.
|
|
44
|
-
"@tramvai/react": "2.
|
|
45
|
-
"@tramvai/tokens-common": "2.
|
|
46
|
-
"@tramvai/tokens-render": "2.
|
|
47
|
-
"@tramvai/tokens-router": "2.
|
|
42
|
+
"@tramvai/core": "2.44.2",
|
|
43
|
+
"@tramvai/state": "2.44.2",
|
|
44
|
+
"@tramvai/react": "2.44.2",
|
|
45
|
+
"@tramvai/tokens-common": "2.44.2",
|
|
46
|
+
"@tramvai/tokens-render": "2.44.2",
|
|
47
|
+
"@tramvai/tokens-router": "2.44.2",
|
|
48
48
|
"react": ">=16.14.0",
|
|
49
49
|
"react-dom": ">=16.14.0",
|
|
50
50
|
"object-assign": "^4.1.1",
|