@tramvai/module-child-app 4.18.5 → 4.19.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/browser/child/singletonProviders.browser.js +7 -9
- package/lib/browser/providers.browser.js +17 -2
- package/lib/contracts/contractManager.base.browser.js +46 -0
- package/lib/contracts/contractManager.base.d.ts +16 -0
- package/lib/contracts/contractManager.base.es.js +46 -0
- package/lib/contracts/contractManager.base.js +54 -0
- package/lib/contracts/contractManager.browser.browser.js +22 -0
- package/lib/contracts/contractManager.browser.d.ts +15 -0
- package/lib/contracts/contractManager.server.d.ts +24 -0
- package/lib/contracts/contractManager.server.es.js +25 -0
- package/lib/contracts/contractManager.server.js +33 -0
- package/lib/server/providers.es.js +14 -3
- package/lib/server/providers.js +11 -0
- package/lib/server/stateManager.es.js +5 -6
- package/lib/server/stateManager.js +5 -6
- package/lib/shared/child/extractorProviders.es.js +2 -1
- package/lib/shared/child/extractorProviders.js +1 -0
- package/lib/shared/child/singletonProviders.browser.js +79 -4
- package/lib/shared/child/singletonProviders.d.ts +2 -1
- package/lib/shared/child/singletonProviders.es.js +79 -4
- package/lib/shared/child/singletonProviders.js +76 -1
- package/lib/shared/di.browser.js +4 -7
- package/lib/shared/di.d.ts +1 -1
- package/lib/shared/di.es.js +4 -7
- package/lib/shared/di.js +4 -7
- package/lib/shared/providers.browser.js +18 -2
- package/lib/shared/providers.es.js +18 -2
- package/lib/shared/providers.js +16 -0
- package/lib/shared/singletonDi.browser.js +6 -7
- package/lib/shared/singletonDi.d.ts +5 -2
- package/lib/shared/singletonDi.es.js +7 -8
- package/lib/shared/singletonDi.js +7 -8
- package/package.json +13 -13
- package/lib/shared/child/providers.browser.js +0 -54
- package/lib/shared/child/providers.d.ts +0 -5
- package/lib/shared/child/providers.es.js +0 -54
- package/lib/shared/child/providers.js +0 -62
- package/lib/shared/child/stubs.browser.js +0 -18
- package/lib/shared/child/stubs.d.ts +0 -5
- package/lib/shared/child/stubs.es.js +0 -18
- package/lib/shared/child/stubs.js +0 -22
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import flatten from '@tinkoff/utils/array/flatten';
|
|
2
|
-
import { provide, Scope, optional } from '@tramvai/core';
|
|
3
|
-
import { ChildDispatcherContext } from '@tramvai/state';
|
|
4
|
-
import { CHILD_APP_INTERNAL_ROOT_STATE_ALLOWED_STORE_TOKEN, CHILD_APP_PAGE_SERVICE_TOKEN, CHILD_APP_ACTIONS_REGISTRY_TOKEN, CHILD_APP_INTERNAL_CONFIG_TOKEN, CHILD_APP_PAGE_COMPONENTS_TOKEN } from '@tramvai/tokens-child-app';
|
|
5
|
-
import { DISPATCHER_CONTEXT_TOKEN, DISPATCHER_TOKEN, STORE_MIDDLEWARE, INITIAL_APP_STATE_TOKEN, COMPONENT_REGISTRY_TOKEN } from '@tramvai/tokens-common';
|
|
6
|
-
import { PAGE_SERVICE_TOKEN } from '@tramvai/tokens-router';
|
|
7
|
-
import { extractorProviders } from './extractorProviders.browser.browser.js';
|
|
8
|
-
import { ChildAppPageService } from '../pageService.browser.js';
|
|
9
|
-
|
|
10
|
-
const getChildProviders = (appDi, loadableStats) => {
|
|
11
|
-
const parentDispatcherContext = appDi.get(DISPATCHER_CONTEXT_TOKEN);
|
|
12
|
-
return [
|
|
13
|
-
...extractorProviders(),
|
|
14
|
-
provide({
|
|
15
|
-
provide: DISPATCHER_CONTEXT_TOKEN,
|
|
16
|
-
useFactory: ({ dispatcher, middlewares, initialState, parentAllowedStores }) => {
|
|
17
|
-
return new ChildDispatcherContext({
|
|
18
|
-
dispatcher,
|
|
19
|
-
// context will be set later by the CONTEXT_TOKEN
|
|
20
|
-
context: {},
|
|
21
|
-
initialState: initialState !== null && initialState !== void 0 ? initialState : { stores: [] },
|
|
22
|
-
middlewares: flatten(middlewares || []),
|
|
23
|
-
parentDispatcherContext,
|
|
24
|
-
parentAllowedStores: flatten(parentAllowedStores || []),
|
|
25
|
-
});
|
|
26
|
-
},
|
|
27
|
-
deps: {
|
|
28
|
-
dispatcher: DISPATCHER_TOKEN,
|
|
29
|
-
middlewares: { token: STORE_MIDDLEWARE, optional: true },
|
|
30
|
-
initialState: { token: INITIAL_APP_STATE_TOKEN, optional: true },
|
|
31
|
-
parentAllowedStores: {
|
|
32
|
-
token: CHILD_APP_INTERNAL_ROOT_STATE_ALLOWED_STORE_TOKEN,
|
|
33
|
-
optional: true,
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
}),
|
|
37
|
-
provide({
|
|
38
|
-
provide: CHILD_APP_PAGE_SERVICE_TOKEN,
|
|
39
|
-
scope: Scope.REQUEST,
|
|
40
|
-
useFactory: (deps) => {
|
|
41
|
-
return new ChildAppPageService(deps);
|
|
42
|
-
},
|
|
43
|
-
deps: {
|
|
44
|
-
actionsRegistry: CHILD_APP_ACTIONS_REGISTRY_TOKEN,
|
|
45
|
-
config: CHILD_APP_INTERNAL_CONFIG_TOKEN,
|
|
46
|
-
componentRegistry: COMPONENT_REGISTRY_TOKEN,
|
|
47
|
-
pageService: PAGE_SERVICE_TOKEN,
|
|
48
|
-
pageComponents: optional(CHILD_APP_PAGE_COMPONENTS_TOKEN),
|
|
49
|
-
},
|
|
50
|
-
}),
|
|
51
|
-
];
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export { getChildProviders };
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { Container } from '@tinkoff/dippy';
|
|
2
|
-
import type { Provider } from '@tramvai/core';
|
|
3
|
-
import type { LoadableStats } from '../webpack/moduleFederation';
|
|
4
|
-
export declare const getChildProviders: (appDi: Container, loadableStats?: LoadableStats) => Provider[];
|
|
5
|
-
//# sourceMappingURL=providers.d.ts.map
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import flatten from '@tinkoff/utils/array/flatten';
|
|
2
|
-
import { provide, Scope, optional } from '@tramvai/core';
|
|
3
|
-
import { ChildDispatcherContext } from '@tramvai/state';
|
|
4
|
-
import { CHILD_APP_INTERNAL_ROOT_STATE_ALLOWED_STORE_TOKEN, CHILD_APP_PAGE_SERVICE_TOKEN, CHILD_APP_ACTIONS_REGISTRY_TOKEN, CHILD_APP_INTERNAL_CONFIG_TOKEN, CHILD_APP_PAGE_COMPONENTS_TOKEN } from '@tramvai/tokens-child-app';
|
|
5
|
-
import { DISPATCHER_CONTEXT_TOKEN, DISPATCHER_TOKEN, STORE_MIDDLEWARE, INITIAL_APP_STATE_TOKEN, COMPONENT_REGISTRY_TOKEN } from '@tramvai/tokens-common';
|
|
6
|
-
import { PAGE_SERVICE_TOKEN } from '@tramvai/tokens-router';
|
|
7
|
-
import { extractorProviders } from './extractorProviders.es.js';
|
|
8
|
-
import { ChildAppPageService } from '../pageService.es.js';
|
|
9
|
-
|
|
10
|
-
const getChildProviders = (appDi, loadableStats) => {
|
|
11
|
-
const parentDispatcherContext = appDi.get(DISPATCHER_CONTEXT_TOKEN);
|
|
12
|
-
return [
|
|
13
|
-
...extractorProviders(loadableStats),
|
|
14
|
-
provide({
|
|
15
|
-
provide: DISPATCHER_CONTEXT_TOKEN,
|
|
16
|
-
useFactory: ({ dispatcher, middlewares, initialState, parentAllowedStores }) => {
|
|
17
|
-
return new ChildDispatcherContext({
|
|
18
|
-
dispatcher,
|
|
19
|
-
// context will be set later by the CONTEXT_TOKEN
|
|
20
|
-
context: {},
|
|
21
|
-
initialState: initialState !== null && initialState !== void 0 ? initialState : { stores: [] },
|
|
22
|
-
middlewares: flatten(middlewares || []),
|
|
23
|
-
parentDispatcherContext,
|
|
24
|
-
parentAllowedStores: flatten(parentAllowedStores || []),
|
|
25
|
-
});
|
|
26
|
-
},
|
|
27
|
-
deps: {
|
|
28
|
-
dispatcher: DISPATCHER_TOKEN,
|
|
29
|
-
middlewares: { token: STORE_MIDDLEWARE, optional: true },
|
|
30
|
-
initialState: { token: INITIAL_APP_STATE_TOKEN, optional: true },
|
|
31
|
-
parentAllowedStores: {
|
|
32
|
-
token: CHILD_APP_INTERNAL_ROOT_STATE_ALLOWED_STORE_TOKEN,
|
|
33
|
-
optional: true,
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
}),
|
|
37
|
-
provide({
|
|
38
|
-
provide: CHILD_APP_PAGE_SERVICE_TOKEN,
|
|
39
|
-
scope: Scope.REQUEST,
|
|
40
|
-
useFactory: (deps) => {
|
|
41
|
-
return new ChildAppPageService(deps);
|
|
42
|
-
},
|
|
43
|
-
deps: {
|
|
44
|
-
actionsRegistry: CHILD_APP_ACTIONS_REGISTRY_TOKEN,
|
|
45
|
-
config: CHILD_APP_INTERNAL_CONFIG_TOKEN,
|
|
46
|
-
componentRegistry: COMPONENT_REGISTRY_TOKEN,
|
|
47
|
-
pageService: PAGE_SERVICE_TOKEN,
|
|
48
|
-
pageComponents: optional(CHILD_APP_PAGE_COMPONENTS_TOKEN),
|
|
49
|
-
},
|
|
50
|
-
}),
|
|
51
|
-
];
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export { getChildProviders };
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var flatten = require('@tinkoff/utils/array/flatten');
|
|
6
|
-
var core = require('@tramvai/core');
|
|
7
|
-
var state = require('@tramvai/state');
|
|
8
|
-
var tokensChildApp = require('@tramvai/tokens-child-app');
|
|
9
|
-
var tokensCommon = require('@tramvai/tokens-common');
|
|
10
|
-
var tokensRouter = require('@tramvai/tokens-router');
|
|
11
|
-
var extractorProviders = require('./extractorProviders.js');
|
|
12
|
-
var pageService = require('../pageService.js');
|
|
13
|
-
|
|
14
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
15
|
-
|
|
16
|
-
var flatten__default = /*#__PURE__*/_interopDefaultLegacy(flatten);
|
|
17
|
-
|
|
18
|
-
const getChildProviders = (appDi, loadableStats) => {
|
|
19
|
-
const parentDispatcherContext = appDi.get(tokensCommon.DISPATCHER_CONTEXT_TOKEN);
|
|
20
|
-
return [
|
|
21
|
-
...extractorProviders.extractorProviders(loadableStats),
|
|
22
|
-
core.provide({
|
|
23
|
-
provide: tokensCommon.DISPATCHER_CONTEXT_TOKEN,
|
|
24
|
-
useFactory: ({ dispatcher, middlewares, initialState, parentAllowedStores }) => {
|
|
25
|
-
return new state.ChildDispatcherContext({
|
|
26
|
-
dispatcher,
|
|
27
|
-
// context will be set later by the CONTEXT_TOKEN
|
|
28
|
-
context: {},
|
|
29
|
-
initialState: initialState !== null && initialState !== void 0 ? initialState : { stores: [] },
|
|
30
|
-
middlewares: flatten__default["default"](middlewares || []),
|
|
31
|
-
parentDispatcherContext,
|
|
32
|
-
parentAllowedStores: flatten__default["default"](parentAllowedStores || []),
|
|
33
|
-
});
|
|
34
|
-
},
|
|
35
|
-
deps: {
|
|
36
|
-
dispatcher: tokensCommon.DISPATCHER_TOKEN,
|
|
37
|
-
middlewares: { token: tokensCommon.STORE_MIDDLEWARE, optional: true },
|
|
38
|
-
initialState: { token: tokensCommon.INITIAL_APP_STATE_TOKEN, optional: true },
|
|
39
|
-
parentAllowedStores: {
|
|
40
|
-
token: tokensChildApp.CHILD_APP_INTERNAL_ROOT_STATE_ALLOWED_STORE_TOKEN,
|
|
41
|
-
optional: true,
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
}),
|
|
45
|
-
core.provide({
|
|
46
|
-
provide: tokensChildApp.CHILD_APP_PAGE_SERVICE_TOKEN,
|
|
47
|
-
scope: core.Scope.REQUEST,
|
|
48
|
-
useFactory: (deps) => {
|
|
49
|
-
return new pageService.ChildAppPageService(deps);
|
|
50
|
-
},
|
|
51
|
-
deps: {
|
|
52
|
-
actionsRegistry: tokensChildApp.CHILD_APP_ACTIONS_REGISTRY_TOKEN,
|
|
53
|
-
config: tokensChildApp.CHILD_APP_INTERNAL_CONFIG_TOKEN,
|
|
54
|
-
componentRegistry: tokensCommon.COMPONENT_REGISTRY_TOKEN,
|
|
55
|
-
pageService: tokensRouter.PAGE_SERVICE_TOKEN,
|
|
56
|
-
pageComponents: core.optional(tokensChildApp.CHILD_APP_PAGE_COMPONENTS_TOKEN),
|
|
57
|
-
},
|
|
58
|
-
}),
|
|
59
|
-
];
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
exports.getChildProviders = getChildProviders;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { COMMAND_LINE_RUNNER_TOKEN } from '@tramvai/core';
|
|
2
|
-
import { DISPATCHER_TOKEN, STORE_TOKEN, CONTEXT_TOKEN } from '@tramvai/tokens-common';
|
|
3
|
-
|
|
4
|
-
const commonModuleStubs = [
|
|
5
|
-
DISPATCHER_TOKEN,
|
|
6
|
-
STORE_TOKEN,
|
|
7
|
-
CONTEXT_TOKEN,
|
|
8
|
-
COMMAND_LINE_RUNNER_TOKEN,
|
|
9
|
-
].map((provide) => {
|
|
10
|
-
return {
|
|
11
|
-
provide,
|
|
12
|
-
useFactory: () => {
|
|
13
|
-
throw Object.assign(new Error('Pure usage of the token is not allowed inside ChildApp, please add `CommonChildAppModule` from module `@tramvai/module-common` to your ChildApp'), { code: 'E_STUB' });
|
|
14
|
-
},
|
|
15
|
-
};
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
export { commonModuleStubs };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { COMMAND_LINE_RUNNER_TOKEN } from '@tramvai/core';
|
|
2
|
-
import { DISPATCHER_TOKEN, STORE_TOKEN, CONTEXT_TOKEN } from '@tramvai/tokens-common';
|
|
3
|
-
|
|
4
|
-
const commonModuleStubs = [
|
|
5
|
-
DISPATCHER_TOKEN,
|
|
6
|
-
STORE_TOKEN,
|
|
7
|
-
CONTEXT_TOKEN,
|
|
8
|
-
COMMAND_LINE_RUNNER_TOKEN,
|
|
9
|
-
].map((provide) => {
|
|
10
|
-
return {
|
|
11
|
-
provide,
|
|
12
|
-
useFactory: () => {
|
|
13
|
-
throw Object.assign(new Error('Pure usage of the token is not allowed inside ChildApp, please add `CommonChildAppModule` from module `@tramvai/module-common` to your ChildApp'), { code: 'E_STUB' });
|
|
14
|
-
},
|
|
15
|
-
};
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
export { commonModuleStubs };
|
|
@@ -1,22 +0,0 @@
|
|
|
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
|
-
|
|
8
|
-
const commonModuleStubs = [
|
|
9
|
-
tokensCommon.DISPATCHER_TOKEN,
|
|
10
|
-
tokensCommon.STORE_TOKEN,
|
|
11
|
-
tokensCommon.CONTEXT_TOKEN,
|
|
12
|
-
core.COMMAND_LINE_RUNNER_TOKEN,
|
|
13
|
-
].map((provide) => {
|
|
14
|
-
return {
|
|
15
|
-
provide,
|
|
16
|
-
useFactory: () => {
|
|
17
|
-
throw Object.assign(new Error('Pure usage of the token is not allowed inside ChildApp, please add `CommonChildAppModule` from module `@tramvai/module-common` to your ChildApp'), { code: 'E_STUB' });
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
exports.commonModuleStubs = commonModuleStubs;
|