@tramvai/module-common 1.105.6 → 1.106.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/bundleManager/bundleManager.d.ts +2 -4
- package/lib/cache/cacheFactory.d.ts +2 -3
- package/lib/index.browser.js +7 -13
- package/lib/index.es.js +8 -14
- package/lib/index.js +7 -13
- package/package.json +19 -19
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BUNDLE_MANAGER_TOKEN, DISPATCHER_TOKEN,
|
|
1
|
+
import type { BUNDLE_MANAGER_TOKEN, DISPATCHER_TOKEN, ActionsRegistry } from '@tramvai/tokens-common';
|
|
2
2
|
import type { Bundle } from '@tramvai/core';
|
|
3
3
|
import type { ComponentRegistry } from '../componentRegistry/componentRegistry';
|
|
4
4
|
declare type Interface = typeof BUNDLE_MANAGER_TOKEN;
|
|
@@ -9,13 +9,11 @@ export declare class BundleManager implements Interface {
|
|
|
9
9
|
actionRegistry: ActionsRegistry;
|
|
10
10
|
componentRegistry: ComponentRegistry;
|
|
11
11
|
dispatcher: typeof DISPATCHER_TOKEN;
|
|
12
|
-
|
|
13
|
-
constructor({ bundleList, componentRegistry, actionRegistry, dispatcher, dispatcherContext, logger, }: {
|
|
12
|
+
constructor({ bundleList, componentRegistry, actionRegistry, dispatcher, logger }: {
|
|
14
13
|
bundleList: any;
|
|
15
14
|
componentRegistry: any;
|
|
16
15
|
actionRegistry: any;
|
|
17
16
|
dispatcher: any;
|
|
18
|
-
dispatcherContext: any;
|
|
19
17
|
logger: any;
|
|
20
18
|
});
|
|
21
19
|
get(name: string, pageComponent: string): Promise<Bundle>;
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
export declare const cacheFactory: (type?: string, ...args: Options<unknown, undefined>[]) => Cache;
|
|
1
|
+
import type { CacheFactory } from '@tramvai/tokens-common';
|
|
2
|
+
export declare const cacheFactory: CacheFactory;
|
package/lib/index.browser.js
CHANGED
|
@@ -27,19 +27,18 @@ import objectMap from '@tinkoff/utils/object/map';
|
|
|
27
27
|
import uniq from '@tinkoff/utils/array/uniq';
|
|
28
28
|
import difference from '@tinkoff/utils/array/difference';
|
|
29
29
|
import toArray from '@tinkoff/utils/array/toArray';
|
|
30
|
-
import LRU from 'lru-cache';
|
|
30
|
+
import LRU from '@tinkoff/lru-cache-nano';
|
|
31
31
|
import { jsx } from 'react/jsx-runtime';
|
|
32
32
|
import { EXTEND_RENDER } from '@tramvai/tokens-render';
|
|
33
33
|
import { CHILD_APP_COMMON_INITIAL_STATE_TOKEN, CHILD_APP_INTERNAL_CONFIG_TOKEN, CHILD_APP_INTERNAL_ROOT_DI_BORROW_TOKEN, commandLineListTokens as commandLineListTokens$1 } from '@tramvai/tokens-child-app';
|
|
34
34
|
|
|
35
35
|
const FS_PAGES_DEFAULT_BUNDLE = '__default';
|
|
36
36
|
class BundleManager {
|
|
37
|
-
constructor({ bundleList, componentRegistry, actionRegistry, dispatcher,
|
|
37
|
+
constructor({ bundleList, componentRegistry, actionRegistry, dispatcher, logger }) {
|
|
38
38
|
this.bundles = bundleList;
|
|
39
39
|
this.componentRegistry = componentRegistry;
|
|
40
40
|
this.actionRegistry = actionRegistry;
|
|
41
41
|
this.dispatcher = dispatcher;
|
|
42
|
-
this.dispatcherContext = dispatcherContext;
|
|
43
42
|
if (fileSystemPagesEnabled()) {
|
|
44
43
|
const log = logger('file-system-pages:bundle-manager');
|
|
45
44
|
const components = getAllFileSystemPages();
|
|
@@ -96,7 +95,6 @@ class BundleManager {
|
|
|
96
95
|
if (component.reducers) {
|
|
97
96
|
component.reducers.forEach((reducer) => {
|
|
98
97
|
this.dispatcher.registerStore(reducer);
|
|
99
|
-
this.dispatcherContext.getStore(reducer);
|
|
100
98
|
});
|
|
101
99
|
}
|
|
102
100
|
}
|
|
@@ -109,7 +107,6 @@ class BundleManager {
|
|
|
109
107
|
if (bundle.reducers) {
|
|
110
108
|
bundle.reducers.forEach((reducer) => {
|
|
111
109
|
this.dispatcher.registerStore(reducer);
|
|
112
|
-
this.dispatcherContext.getStore(reducer);
|
|
113
110
|
});
|
|
114
111
|
}
|
|
115
112
|
return bundle;
|
|
@@ -912,10 +909,8 @@ StateModule = __decorate([
|
|
|
912
909
|
})
|
|
913
910
|
], StateModule);
|
|
914
911
|
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
const cacheFactory = (type, ...args) => {
|
|
918
|
-
return new LRU(...args);
|
|
912
|
+
const cacheFactory = (type, options = { max: 100 }) => {
|
|
913
|
+
return new LRU(options);
|
|
919
914
|
};
|
|
920
915
|
|
|
921
916
|
const providers$1 = [];
|
|
@@ -1025,7 +1020,6 @@ CommonModule = __decorate([
|
|
|
1025
1020
|
componentRegistry: COMPONENT_REGISTRY_TOKEN,
|
|
1026
1021
|
actionRegistry: ACTION_REGISTRY_TOKEN,
|
|
1027
1022
|
dispatcher: DISPATCHER_TOKEN,
|
|
1028
|
-
dispatcherContext: DISPATCHER_CONTEXT_TOKEN,
|
|
1029
1023
|
logger: LOGGER_TOKEN,
|
|
1030
1024
|
},
|
|
1031
1025
|
}),
|
|
@@ -1123,14 +1117,14 @@ CommonChildAppModule = __decorate([
|
|
|
1123
1117
|
provide({
|
|
1124
1118
|
provide: EXTEND_RENDER,
|
|
1125
1119
|
multi: true,
|
|
1126
|
-
useFactory: ({ context
|
|
1120
|
+
useFactory: ({ context }) => {
|
|
1121
|
+
const serverState = typeof window !== 'undefined' ? context.getState() : undefined;
|
|
1127
1122
|
return (render) => {
|
|
1128
|
-
return (jsx(Provider, Object.assign({ context: context, serverState:
|
|
1123
|
+
return (jsx(Provider, Object.assign({ context: context, serverState: serverState }, { children: render }), void 0));
|
|
1129
1124
|
};
|
|
1130
1125
|
},
|
|
1131
1126
|
deps: {
|
|
1132
1127
|
context: CONTEXT_TOKEN,
|
|
1133
|
-
initialState: { token: INITIAL_APP_STATE_TOKEN$1, optional: true },
|
|
1134
1128
|
},
|
|
1135
1129
|
}),
|
|
1136
1130
|
],
|
package/lib/index.es.js
CHANGED
|
@@ -6,7 +6,7 @@ import { CookieModule } from '@tramvai/module-cookie';
|
|
|
6
6
|
export { COOKIE_MANAGER_TOKEN } from '@tramvai/module-cookie';
|
|
7
7
|
import { LogModule } from '@tramvai/module-log';
|
|
8
8
|
import { Hooks } from '@tinkoff/hook-runner';
|
|
9
|
-
import { REQUEST_MANAGER_TOKEN, REQUEST, COMBINE_REDUCERS, CONTEXT_TOKEN, RESPONSE_MANAGER_TOKEN, RESPONSE, ACTION_EXECUTION_TOKEN, LOGGER_TOKEN, PUBSUB_FACTORY_TOKEN, PUBSUB_TOKEN, ROOT_PUBSUB_TOKEN, ACTION_REGISTRY_TOKEN, ACTION_CONDITIONALS, STORE_TOKEN, ACTION_PAGE_RUNNER_TOKEN, DISPATCHER_TOKEN, DISPATCHER_CONTEXT_TOKEN, STORE_MIDDLEWARE, CLEAR_CACHE_TOKEN, CREATE_CACHE_TOKEN, REGISTER_CLEAR_CACHE_TOKEN, HOOK_TOKEN, COMPONENT_REGISTRY_TOKEN, BUNDLE_MANAGER_TOKEN, ADDITIONAL_BUNDLE_TOKEN
|
|
9
|
+
import { REQUEST_MANAGER_TOKEN, REQUEST, COMBINE_REDUCERS, CONTEXT_TOKEN, RESPONSE_MANAGER_TOKEN, RESPONSE, ACTION_EXECUTION_TOKEN, LOGGER_TOKEN, PUBSUB_FACTORY_TOKEN, PUBSUB_TOKEN, ROOT_PUBSUB_TOKEN, ACTION_REGISTRY_TOKEN, ACTION_CONDITIONALS, STORE_TOKEN, ACTION_PAGE_RUNNER_TOKEN, DISPATCHER_TOKEN, DISPATCHER_CONTEXT_TOKEN, STORE_MIDDLEWARE, CLEAR_CACHE_TOKEN, CREATE_CACHE_TOKEN, REGISTER_CLEAR_CACHE_TOKEN, HOOK_TOKEN, COMPONENT_REGISTRY_TOKEN, BUNDLE_MANAGER_TOKEN, ADDITIONAL_BUNDLE_TOKEN } from '@tramvai/tokens-common';
|
|
10
10
|
export * from '@tramvai/tokens-common';
|
|
11
11
|
import { __lazyErrorHandler } from '@tramvai/react';
|
|
12
12
|
import { fileSystemPagesEnabled, getAllFileSystemPages, isFileSystemPageComponent } from '@tramvai/experiments';
|
|
@@ -27,7 +27,7 @@ import objectMap from '@tinkoff/utils/object/map';
|
|
|
27
27
|
import uniq from '@tinkoff/utils/array/uniq';
|
|
28
28
|
import difference from '@tinkoff/utils/array/difference';
|
|
29
29
|
import toArray from '@tinkoff/utils/array/toArray';
|
|
30
|
-
import LRU from 'lru-cache';
|
|
30
|
+
import LRU from '@tinkoff/lru-cache-nano';
|
|
31
31
|
import { SERVER_MODULE_PAPI_PRIVATE_ROUTE } from '@tramvai/tokens-server';
|
|
32
32
|
import { createPapiMethod } from '@tramvai/papi';
|
|
33
33
|
import { jsx } from 'react/jsx-runtime';
|
|
@@ -36,12 +36,11 @@ import { CHILD_APP_INTERNAL_ROOT_DI_BORROW_TOKEN, commandLineListTokens as comma
|
|
|
36
36
|
|
|
37
37
|
const FS_PAGES_DEFAULT_BUNDLE = '__default';
|
|
38
38
|
class BundleManager {
|
|
39
|
-
constructor({ bundleList, componentRegistry, actionRegistry, dispatcher,
|
|
39
|
+
constructor({ bundleList, componentRegistry, actionRegistry, dispatcher, logger }) {
|
|
40
40
|
this.bundles = bundleList;
|
|
41
41
|
this.componentRegistry = componentRegistry;
|
|
42
42
|
this.actionRegistry = actionRegistry;
|
|
43
43
|
this.dispatcher = dispatcher;
|
|
44
|
-
this.dispatcherContext = dispatcherContext;
|
|
45
44
|
if (fileSystemPagesEnabled()) {
|
|
46
45
|
const log = logger('file-system-pages:bundle-manager');
|
|
47
46
|
const components = getAllFileSystemPages();
|
|
@@ -98,7 +97,6 @@ class BundleManager {
|
|
|
98
97
|
if (component.reducers) {
|
|
99
98
|
component.reducers.forEach((reducer) => {
|
|
100
99
|
this.dispatcher.registerStore(reducer);
|
|
101
|
-
this.dispatcherContext.getStore(reducer);
|
|
102
100
|
});
|
|
103
101
|
}
|
|
104
102
|
}
|
|
@@ -111,7 +109,6 @@ class BundleManager {
|
|
|
111
109
|
if (bundle.reducers) {
|
|
112
110
|
bundle.reducers.forEach((reducer) => {
|
|
113
111
|
this.dispatcher.registerStore(reducer);
|
|
114
|
-
this.dispatcherContext.getStore(reducer);
|
|
115
112
|
});
|
|
116
113
|
}
|
|
117
114
|
return bundle;
|
|
@@ -920,10 +917,8 @@ StateModule = __decorate([
|
|
|
920
917
|
})
|
|
921
918
|
], StateModule);
|
|
922
919
|
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
const cacheFactory = (type, ...args) => {
|
|
926
|
-
return new LRU(...args);
|
|
920
|
+
const cacheFactory = (type, options = { max: 100 }) => {
|
|
921
|
+
return new LRU(options);
|
|
927
922
|
};
|
|
928
923
|
|
|
929
924
|
const papiClearCache = ({ clearCache, logger, }) => {
|
|
@@ -1058,7 +1053,6 @@ CommonModule = __decorate([
|
|
|
1058
1053
|
componentRegistry: COMPONENT_REGISTRY_TOKEN,
|
|
1059
1054
|
actionRegistry: ACTION_REGISTRY_TOKEN,
|
|
1060
1055
|
dispatcher: DISPATCHER_TOKEN,
|
|
1061
|
-
dispatcherContext: DISPATCHER_CONTEXT_TOKEN,
|
|
1062
1056
|
logger: LOGGER_TOKEN,
|
|
1063
1057
|
},
|
|
1064
1058
|
}),
|
|
@@ -1145,14 +1139,14 @@ CommonChildAppModule = __decorate([
|
|
|
1145
1139
|
provide({
|
|
1146
1140
|
provide: EXTEND_RENDER,
|
|
1147
1141
|
multi: true,
|
|
1148
|
-
useFactory: ({ context
|
|
1142
|
+
useFactory: ({ context }) => {
|
|
1143
|
+
const serverState = typeof window !== 'undefined' ? context.getState() : undefined;
|
|
1149
1144
|
return (render) => {
|
|
1150
|
-
return (jsx(Provider, Object.assign({ context: context, serverState:
|
|
1145
|
+
return (jsx(Provider, Object.assign({ context: context, serverState: serverState }, { children: render }), void 0));
|
|
1151
1146
|
};
|
|
1152
1147
|
},
|
|
1153
1148
|
deps: {
|
|
1154
1149
|
context: CONTEXT_TOKEN,
|
|
1155
|
-
initialState: { token: INITIAL_APP_STATE_TOKEN$1, optional: true },
|
|
1156
1150
|
},
|
|
1157
1151
|
}),
|
|
1158
1152
|
],
|
package/lib/index.js
CHANGED
|
@@ -29,7 +29,7 @@ var objectMap = require('@tinkoff/utils/object/map');
|
|
|
29
29
|
var uniq = require('@tinkoff/utils/array/uniq');
|
|
30
30
|
var difference = require('@tinkoff/utils/array/difference');
|
|
31
31
|
var toArray = require('@tinkoff/utils/array/toArray');
|
|
32
|
-
var LRU = require('lru-cache');
|
|
32
|
+
var LRU = require('@tinkoff/lru-cache-nano');
|
|
33
33
|
var tokensServer = require('@tramvai/tokens-server');
|
|
34
34
|
var papi = require('@tramvai/papi');
|
|
35
35
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -54,12 +54,11 @@ var LRU__default = /*#__PURE__*/_interopDefaultLegacy(LRU);
|
|
|
54
54
|
|
|
55
55
|
const FS_PAGES_DEFAULT_BUNDLE = '__default';
|
|
56
56
|
class BundleManager {
|
|
57
|
-
constructor({ bundleList, componentRegistry, actionRegistry, dispatcher,
|
|
57
|
+
constructor({ bundleList, componentRegistry, actionRegistry, dispatcher, logger }) {
|
|
58
58
|
this.bundles = bundleList;
|
|
59
59
|
this.componentRegistry = componentRegistry;
|
|
60
60
|
this.actionRegistry = actionRegistry;
|
|
61
61
|
this.dispatcher = dispatcher;
|
|
62
|
-
this.dispatcherContext = dispatcherContext;
|
|
63
62
|
if (experiments.fileSystemPagesEnabled()) {
|
|
64
63
|
const log = logger('file-system-pages:bundle-manager');
|
|
65
64
|
const components = experiments.getAllFileSystemPages();
|
|
@@ -116,7 +115,6 @@ class BundleManager {
|
|
|
116
115
|
if (component.reducers) {
|
|
117
116
|
component.reducers.forEach((reducer) => {
|
|
118
117
|
this.dispatcher.registerStore(reducer);
|
|
119
|
-
this.dispatcherContext.getStore(reducer);
|
|
120
118
|
});
|
|
121
119
|
}
|
|
122
120
|
}
|
|
@@ -129,7 +127,6 @@ class BundleManager {
|
|
|
129
127
|
if (bundle.reducers) {
|
|
130
128
|
bundle.reducers.forEach((reducer) => {
|
|
131
129
|
this.dispatcher.registerStore(reducer);
|
|
132
|
-
this.dispatcherContext.getStore(reducer);
|
|
133
130
|
});
|
|
134
131
|
}
|
|
135
132
|
return bundle;
|
|
@@ -938,10 +935,8 @@ StateModule = tslib.__decorate([
|
|
|
938
935
|
})
|
|
939
936
|
], StateModule);
|
|
940
937
|
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
const cacheFactory = (type, ...args) => {
|
|
944
|
-
return new LRU__default["default"](...args);
|
|
938
|
+
const cacheFactory = (type, options = { max: 100 }) => {
|
|
939
|
+
return new LRU__default["default"](options);
|
|
945
940
|
};
|
|
946
941
|
|
|
947
942
|
const papiClearCache = ({ clearCache, logger, }) => {
|
|
@@ -1076,7 +1071,6 @@ exports.CommonModule = tslib.__decorate([
|
|
|
1076
1071
|
componentRegistry: tokensCommon.COMPONENT_REGISTRY_TOKEN,
|
|
1077
1072
|
actionRegistry: tokensCommon.ACTION_REGISTRY_TOKEN,
|
|
1078
1073
|
dispatcher: tokensCommon.DISPATCHER_TOKEN,
|
|
1079
|
-
dispatcherContext: tokensCommon.DISPATCHER_CONTEXT_TOKEN,
|
|
1080
1074
|
logger: tokensCommon.LOGGER_TOKEN,
|
|
1081
1075
|
},
|
|
1082
1076
|
}),
|
|
@@ -1163,14 +1157,14 @@ exports.CommonChildAppModule = tslib.__decorate([
|
|
|
1163
1157
|
core.provide({
|
|
1164
1158
|
provide: tokensRender.EXTEND_RENDER,
|
|
1165
1159
|
multi: true,
|
|
1166
|
-
useFactory: ({ context
|
|
1160
|
+
useFactory: ({ context }) => {
|
|
1161
|
+
const serverState = typeof window !== 'undefined' ? context.getState() : undefined;
|
|
1167
1162
|
return (render) => {
|
|
1168
|
-
return (jsxRuntime.jsx(state.Provider, Object.assign({ context: context, serverState:
|
|
1163
|
+
return (jsxRuntime.jsx(state.Provider, Object.assign({ context: context, serverState: serverState }, { children: render }), void 0));
|
|
1169
1164
|
};
|
|
1170
1165
|
},
|
|
1171
1166
|
deps: {
|
|
1172
1167
|
context: tokensCommon.CONTEXT_TOKEN,
|
|
1173
|
-
initialState: { token: tokensCommon.INITIAL_APP_STATE_TOKEN, optional: true },
|
|
1174
1168
|
},
|
|
1175
1169
|
}),
|
|
1176
1170
|
],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/module-common",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.106.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -29,29 +29,29 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@tinkoff/errors": "0.2.21",
|
|
32
|
+
"@tinkoff/hook-runner": "0.3.22",
|
|
33
|
+
"@tinkoff/lru-cache-nano": "^7.8.1",
|
|
32
34
|
"@tinkoff/pubsub": "0.4.24",
|
|
33
35
|
"@tinkoff/url": "0.7.38",
|
|
34
|
-
"@tramvai/
|
|
35
|
-
"@tramvai/module-
|
|
36
|
-
"@tramvai/module-
|
|
37
|
-
"@tramvai/
|
|
38
|
-
"@tramvai/tokens-
|
|
39
|
-
"@tramvai/tokens-
|
|
40
|
-
"@tramvai/
|
|
41
|
-
"
|
|
42
|
-
"hoist-non-react-statics": "^3.3.1",
|
|
43
|
-
"lru-cache": "^6.0.0"
|
|
36
|
+
"@tramvai/experiments": "1.106.0",
|
|
37
|
+
"@tramvai/module-cookie": "1.106.0",
|
|
38
|
+
"@tramvai/module-environment": "1.106.0",
|
|
39
|
+
"@tramvai/module-log": "1.106.0",
|
|
40
|
+
"@tramvai/tokens-child-app": "1.106.0",
|
|
41
|
+
"@tramvai/tokens-common": "1.106.0",
|
|
42
|
+
"@tramvai/tokens-render": "1.106.0",
|
|
43
|
+
"hoist-non-react-statics": "^3.3.1"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"@tinkoff/utils": "^2.1.2",
|
|
47
|
-
"@tramvai/cli": "1.105.6",
|
|
48
|
-
"@tramvai/core": "1.105.6",
|
|
49
|
-
"@tramvai/react": "1.105.6",
|
|
50
|
-
"@tramvai/papi": "1.105.6",
|
|
51
|
-
"@tramvai/state": "1.105.6",
|
|
52
|
-
"@tramvai/tokens-metrics": "1.105.6",
|
|
53
|
-
"@tramvai/tokens-server": "1.105.6",
|
|
54
46
|
"@tinkoff/dippy": "0.7.41",
|
|
47
|
+
"@tinkoff/utils": "^2.1.2",
|
|
48
|
+
"@tramvai/cli": "1.106.0",
|
|
49
|
+
"@tramvai/core": "1.106.0",
|
|
50
|
+
"@tramvai/papi": "1.106.0",
|
|
51
|
+
"@tramvai/react": "1.106.0",
|
|
52
|
+
"@tramvai/state": "1.106.0",
|
|
53
|
+
"@tramvai/tokens-metrics": "1.106.0",
|
|
54
|
+
"@tramvai/tokens-server": "1.106.0",
|
|
55
55
|
"react": ">=16.14.0",
|
|
56
56
|
"tslib": "^2.0.3"
|
|
57
57
|
},
|