@tramvai/module-router 7.26.9 → 7.27.3

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.
@@ -2,6 +2,7 @@ import { provide } from '@tramvai/core';
2
2
  import { ROUTE_TRANSFORM_TOKEN, ROUTER_TOKEN, PAGE_SERVICE_TOKEN, PAGE_REGISTRY_TOKEN } from '@tramvai/tokens-router';
3
3
  import { EXTEND_RENDER } from '@tramvai/tokens-render';
4
4
  import { COMPONENT_REGISTRY_TOKEN, BUNDLE_MANAGER_TOKEN, ACTION_REGISTRY_TOKEN, DISPATCHER_TOKEN, DISPATCHER_CONTEXT_TOKEN } from '@tramvai/tokens-common';
5
+ import { ROOT_DI_TOKEN } from '@tramvai/tokens-core';
5
6
  import { routeTransformToken } from '../../tokens.browser.js';
6
7
  import { routeTransform } from './routeTransform.browser.js';
7
8
  import { routeSetDefaults } from './routeSetDefaults.browser.js';
@@ -57,6 +58,7 @@ const commonTokens = [
57
58
  actionRegistry: ACTION_REGISTRY_TOKEN,
58
59
  dispatcher: DISPATCHER_TOKEN,
59
60
  dispatcherContext: DISPATCHER_CONTEXT_TOKEN,
61
+ rootDi: ROOT_DI_TOKEN,
60
62
  },
61
63
  }),
62
64
  ];
@@ -2,6 +2,7 @@ import { provide } from '@tramvai/core';
2
2
  import { ROUTE_TRANSFORM_TOKEN, ROUTER_TOKEN, PAGE_SERVICE_TOKEN, PAGE_REGISTRY_TOKEN } from '@tramvai/tokens-router';
3
3
  import { EXTEND_RENDER } from '@tramvai/tokens-render';
4
4
  import { COMPONENT_REGISTRY_TOKEN, BUNDLE_MANAGER_TOKEN, ACTION_REGISTRY_TOKEN, DISPATCHER_TOKEN, DISPATCHER_CONTEXT_TOKEN } from '@tramvai/tokens-common';
5
+ import { ROOT_DI_TOKEN } from '@tramvai/tokens-core';
5
6
  import { routeTransformToken } from '../../tokens.es.js';
6
7
  import { routeTransform } from './routeTransform.es.js';
7
8
  import { routeSetDefaults } from './routeSetDefaults.es.js';
@@ -57,6 +58,7 @@ const commonTokens = [
57
58
  actionRegistry: ACTION_REGISTRY_TOKEN,
58
59
  dispatcher: DISPATCHER_TOKEN,
59
60
  dispatcherContext: DISPATCHER_CONTEXT_TOKEN,
61
+ rootDi: ROOT_DI_TOKEN,
60
62
  },
61
63
  }),
62
64
  ];
@@ -6,6 +6,7 @@ var core = require('@tramvai/core');
6
6
  var tokensRouter = require('@tramvai/tokens-router');
7
7
  var tokensRender = require('@tramvai/tokens-render');
8
8
  var tokensCommon = require('@tramvai/tokens-common');
9
+ var tokensCore = require('@tramvai/tokens-core');
9
10
  var tokens = require('../../tokens.js');
10
11
  var routeTransform = require('./routeTransform.js');
11
12
  var routeSetDefaults = require('./routeSetDefaults.js');
@@ -61,6 +62,7 @@ const commonTokens = [
61
62
  actionRegistry: tokensCommon.ACTION_REGISTRY_TOKEN,
62
63
  dispatcher: tokensCommon.DISPATCHER_TOKEN,
63
64
  dispatcherContext: tokensCommon.DISPATCHER_CONTEXT_TOKEN,
65
+ rootDi: tokensCore.ROOT_DI_TOKEN,
64
66
  },
65
67
  }),
66
68
  ];
@@ -10,13 +10,15 @@ class PageRegistry {
10
10
  actionRegistry;
11
11
  dispatcher;
12
12
  dispatcherContext;
13
- constructor({ bundleManager, pageService, componentRegistry, actionRegistry, dispatcher, dispatcherContext, }) {
13
+ rootDi;
14
+ constructor({ bundleManager, pageService, componentRegistry, actionRegistry, dispatcher, dispatcherContext, rootDi, }) {
14
15
  this.bundleManager = bundleManager;
15
16
  this.pageService = pageService;
16
17
  this.componentRegistry = componentRegistry;
17
18
  this.actionRegistry = actionRegistry;
18
19
  this.dispatcher = dispatcher;
19
20
  this.dispatcherContext = dispatcherContext;
21
+ this.rootDi = rootDi;
20
22
  }
21
23
  async resolve(route) {
22
24
  const { bundle, pageComponent } = this.pageService.getConfig(route);
@@ -42,6 +44,9 @@ class PageRegistry {
42
44
  if ('load' in componentOrBundle) {
43
45
  await resolveLazyComponent(componentOrBundle);
44
46
  }
47
+ if ('modules' in componentOrBundle && isArray(componentOrBundle.modules)) {
48
+ this.rootDi.registerModules(componentOrBundle.modules);
49
+ }
45
50
  if ('components' in componentOrBundle && isObject(componentOrBundle.components)) {
46
51
  eachObj((cmp, name) => {
47
52
  this.componentRegistry.add(name, cmp, group);
@@ -1,6 +1,7 @@
1
1
  import type { Route } from '@tinkoff/router';
2
2
  import type { PageRegistry as Interface, PAGE_SERVICE_TOKEN } from '@tramvai/tokens-router';
3
3
  import type { COMPONENT_REGISTRY_TOKEN, ACTION_REGISTRY_TOKEN, DISPATCHER_CONTEXT_TOKEN, DISPATCHER_TOKEN, BUNDLE_MANAGER_TOKEN } from '@tramvai/tokens-common';
4
+ import type { ROOT_DI_TOKEN } from '@tramvai/core';
4
5
  interface Deps {
5
6
  bundleManager: typeof BUNDLE_MANAGER_TOKEN;
6
7
  pageService: typeof PAGE_SERVICE_TOKEN;
@@ -8,6 +9,7 @@ interface Deps {
8
9
  actionRegistry: typeof ACTION_REGISTRY_TOKEN;
9
10
  dispatcher: typeof DISPATCHER_TOKEN;
10
11
  dispatcherContext: typeof DISPATCHER_CONTEXT_TOKEN;
12
+ rootDi: typeof ROOT_DI_TOKEN;
11
13
  }
12
14
  export declare class PageRegistry implements Interface {
13
15
  private bundleManager;
@@ -16,7 +18,8 @@ export declare class PageRegistry implements Interface {
16
18
  private actionRegistry;
17
19
  private dispatcher;
18
20
  private dispatcherContext;
19
- constructor({ bundleManager, pageService, componentRegistry, actionRegistry, dispatcher, dispatcherContext, }: Deps);
21
+ private rootDi;
22
+ constructor({ bundleManager, pageService, componentRegistry, actionRegistry, dispatcher, dispatcherContext, rootDi, }: Deps);
20
23
  resolve(route: Route): Promise<void>;
21
24
  private registerComponent;
22
25
  }
@@ -10,13 +10,15 @@ class PageRegistry {
10
10
  actionRegistry;
11
11
  dispatcher;
12
12
  dispatcherContext;
13
- constructor({ bundleManager, pageService, componentRegistry, actionRegistry, dispatcher, dispatcherContext, }) {
13
+ rootDi;
14
+ constructor({ bundleManager, pageService, componentRegistry, actionRegistry, dispatcher, dispatcherContext, rootDi, }) {
14
15
  this.bundleManager = bundleManager;
15
16
  this.pageService = pageService;
16
17
  this.componentRegistry = componentRegistry;
17
18
  this.actionRegistry = actionRegistry;
18
19
  this.dispatcher = dispatcher;
19
20
  this.dispatcherContext = dispatcherContext;
21
+ this.rootDi = rootDi;
20
22
  }
21
23
  async resolve(route) {
22
24
  const { bundle, pageComponent } = this.pageService.getConfig(route);
@@ -42,6 +44,9 @@ class PageRegistry {
42
44
  if ('load' in componentOrBundle) {
43
45
  await resolveLazyComponent(componentOrBundle);
44
46
  }
47
+ if ('modules' in componentOrBundle && isArray(componentOrBundle.modules)) {
48
+ this.rootDi.registerModules(componentOrBundle.modules);
49
+ }
45
50
  if ('components' in componentOrBundle && isObject(componentOrBundle.components)) {
46
51
  eachObj((cmp, name) => {
47
52
  this.componentRegistry.add(name, cmp, group);
@@ -20,13 +20,15 @@ class PageRegistry {
20
20
  actionRegistry;
21
21
  dispatcher;
22
22
  dispatcherContext;
23
- constructor({ bundleManager, pageService, componentRegistry, actionRegistry, dispatcher, dispatcherContext, }) {
23
+ rootDi;
24
+ constructor({ bundleManager, pageService, componentRegistry, actionRegistry, dispatcher, dispatcherContext, rootDi, }) {
24
25
  this.bundleManager = bundleManager;
25
26
  this.pageService = pageService;
26
27
  this.componentRegistry = componentRegistry;
27
28
  this.actionRegistry = actionRegistry;
28
29
  this.dispatcher = dispatcher;
29
30
  this.dispatcherContext = dispatcherContext;
31
+ this.rootDi = rootDi;
30
32
  }
31
33
  async resolve(route) {
32
34
  const { bundle, pageComponent } = this.pageService.getConfig(route);
@@ -52,6 +54,9 @@ class PageRegistry {
52
54
  if ('load' in componentOrBundle) {
53
55
  await react.resolveLazyComponent(componentOrBundle);
54
56
  }
57
+ if ('modules' in componentOrBundle && isArray__default["default"](componentOrBundle.modules)) {
58
+ this.rootDi.registerModules(componentOrBundle.modules);
59
+ }
55
60
  if ('components' in componentOrBundle && isObject__default["default"](componentOrBundle.components)) {
56
61
  eachObj__default["default"]((cmp, name) => {
57
62
  this.componentRegistry.add(name, cmp, group);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/module-router",
3
- "version": "7.26.9",
3
+ "version": "7.27.3",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "browser": {
@@ -26,28 +26,29 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "@tinkoff/errors": "0.8.1",
29
- "@tinkoff/router": "0.7.107",
29
+ "@tinkoff/router": "0.7.112",
30
30
  "@tinkoff/url": "0.13.1",
31
- "@tramvai/experiments": "7.26.9",
32
- "@tramvai/react": "7.26.9",
31
+ "@tramvai/experiments": "7.27.3",
32
+ "@tramvai/react": "7.27.3",
33
33
  "@tramvai/safe-strings": "0.10.1",
34
- "@tramvai/tokens-child-app": "7.26.9",
35
- "@tramvai/tokens-render": "7.26.9",
36
- "@tramvai/tokens-router": "7.26.9",
37
- "@tramvai/tokens-server": "7.26.9"
34
+ "@tramvai/tokens-child-app": "7.27.3",
35
+ "@tramvai/tokens-core": "7.27.3",
36
+ "@tramvai/tokens-render": "7.27.3",
37
+ "@tramvai/tokens-router": "7.27.3",
38
+ "@tramvai/tokens-server": "7.27.3"
38
39
  },
39
40
  "peerDependencies": {
40
41
  "@tinkoff/dippy": "^1.0.0",
41
42
  "@tinkoff/utils": "^2.1.2",
42
- "@tramvai/cli": "7.26.9",
43
- "@tramvai/core": "7.26.9",
44
- "@tramvai/module-log": "7.26.9",
45
- "@tramvai/module-server": "7.26.9",
46
- "@tramvai/papi": "7.26.9",
47
- "@tramvai/state": "7.26.9",
48
- "@tramvai/test-helpers": "7.26.9",
49
- "@tramvai/test-mocks": "7.26.9",
50
- "@tramvai/tokens-common": "7.26.9",
43
+ "@tramvai/cli": "7.27.3",
44
+ "@tramvai/core": "7.27.3",
45
+ "@tramvai/module-log": "7.27.3",
46
+ "@tramvai/module-server": "7.27.3",
47
+ "@tramvai/papi": "7.27.3",
48
+ "@tramvai/state": "7.27.3",
49
+ "@tramvai/test-helpers": "7.27.3",
50
+ "@tramvai/test-mocks": "7.27.3",
51
+ "@tramvai/tokens-common": "7.27.3",
51
52
  "react": "*",
52
53
  "tslib": "^2.4.0"
53
54
  },