@tramvai/module-router 5.9.2 → 5.14.9
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/hooks/usePrefetch.browser.browser.js +1 -2
- package/lib/modules/child-app-render-children.browser.js +1 -1
- package/lib/modules/child-app-render-children.es.js +1 -1
- package/lib/modules/child-app-render-children.js +1 -1
- package/lib/modules/common.browser.js +9 -10
- package/lib/modules/common.es.js +9 -10
- package/lib/modules/common.js +9 -10
- package/lib/modules/hooks/runActions.browser.js +2 -2
- package/lib/modules/hooks/server/httpStatus.es.js +1 -1
- package/lib/modules/hooks/server/httpStatus.js +1 -1
- package/lib/modules/tokens/browser/index.browser.js +2 -3
- package/lib/modules/tokens/common/pageRegistry.browser.js +1 -2
- package/lib/modules/tokens/common/pageRegistry.es.js +1 -2
- package/lib/modules/tokens/common/pageRegistry.js +1 -2
- package/lib/modules/tokens/common/pageService.browser.js +4 -8
- package/lib/modules/tokens/common/pageService.es.js +4 -8
- package/lib/modules/tokens/common/pageService.js +4 -8
- package/lib/modules/tokens/server/bundleInfo.es.js +2 -3
- package/lib/modules/tokens/server/bundleInfo.js +2 -3
- package/lib/modules/tokens/server/routerOptions.es.js +1 -1
- package/lib/modules/tokens/server/routerOptions.js +1 -1
- package/package.json +18 -18
|
@@ -5,8 +5,7 @@ import { optional } from '@tinkoff/dippy';
|
|
|
5
5
|
import { requestIdleCallback, cancelIdleCallback } from '../utils/requestIdleCallback.browser.js';
|
|
6
6
|
|
|
7
7
|
const isUserNetworkConditionsSuitableForPrefetch = () => {
|
|
8
|
-
|
|
9
|
-
const { saveData, effectiveType = '' } = (_a = navigator.connection) !== null && _a !== void 0 ? _a : {};
|
|
8
|
+
const { saveData, effectiveType = '' } = navigator.connection ?? {};
|
|
10
9
|
return !saveData && !(effectiveType === '2g' || effectiveType === 'slow-2g');
|
|
11
10
|
};
|
|
12
11
|
const usePrefetch = ({ url, target, prefetch, }) => {
|
|
@@ -8,7 +8,7 @@ const ChildAppRenderChildren = ({ di, ...props }) => {
|
|
|
8
8
|
token: CHILD_APP_PAGE_SERVICE_TOKEN,
|
|
9
9
|
optional: true,
|
|
10
10
|
});
|
|
11
|
-
const PageComponent = childAppPageService
|
|
11
|
+
const PageComponent = childAppPageService?.getComponent();
|
|
12
12
|
if (PageComponent) {
|
|
13
13
|
return jsx(PageComponent, { ...props });
|
|
14
14
|
}
|
|
@@ -8,7 +8,7 @@ const ChildAppRenderChildren = ({ di, ...props }) => {
|
|
|
8
8
|
token: CHILD_APP_PAGE_SERVICE_TOKEN,
|
|
9
9
|
optional: true,
|
|
10
10
|
});
|
|
11
|
-
const PageComponent = childAppPageService
|
|
11
|
+
const PageComponent = childAppPageService?.getComponent();
|
|
12
12
|
if (PageComponent) {
|
|
13
13
|
return jsx(PageComponent, { ...props });
|
|
14
14
|
}
|
|
@@ -12,7 +12,7 @@ const ChildAppRenderChildren = ({ di, ...props }) => {
|
|
|
12
12
|
token: tokensChildApp.CHILD_APP_PAGE_SERVICE_TOKEN,
|
|
13
13
|
optional: true,
|
|
14
14
|
});
|
|
15
|
-
const PageComponent = childAppPageService
|
|
15
|
+
const PageComponent = childAppPageService?.getComponent();
|
|
16
16
|
if (PageComponent) {
|
|
17
17
|
return jsxRuntime.jsx(PageComponent, { ...props });
|
|
18
18
|
}
|
|
@@ -24,15 +24,14 @@ const providers = [
|
|
|
24
24
|
trailingSlash: true,
|
|
25
25
|
mergeSlashes: true,
|
|
26
26
|
enableViewTransitions: process.env.__TRAMVAI_VIEW_TRANSITIONS === 'true',
|
|
27
|
-
routes: flatten(routes
|
|
27
|
+
routes: flatten(routes ?? []).map(routeTransform),
|
|
28
28
|
});
|
|
29
29
|
if (routeResolve) {
|
|
30
30
|
router.registerHook('beforeResolve', async (navigation) => {
|
|
31
|
-
var _a;
|
|
32
31
|
const existingRoute = router.resolve(navigation.url.href);
|
|
33
32
|
// forceRouteResolve exists as a fallback property in case we have any conflicts
|
|
34
33
|
// in external routes definition and we need to force route resolving is some cases
|
|
35
|
-
if (!existingRoute ||
|
|
34
|
+
if (!existingRoute || existingRoute.config?.forceRouteResolve) {
|
|
36
35
|
const route = await routeResolve(navigation);
|
|
37
36
|
if (route) {
|
|
38
37
|
router.addRoute(routeTransform(route));
|
|
@@ -64,13 +63,13 @@ const providers = [
|
|
|
64
63
|
multi: true,
|
|
65
64
|
useFactory: ({ router, guards, onChange, beforeResolve, beforeNavigate, afterNavigate, beforeUpdateCurrent, afterUpdateCurrent, }) => {
|
|
66
65
|
return function routerInit() {
|
|
67
|
-
flatten(guards
|
|
68
|
-
flatten(onChange
|
|
69
|
-
flatten(beforeResolve
|
|
70
|
-
flatten(beforeNavigate
|
|
71
|
-
flatten(afterNavigate
|
|
72
|
-
flatten(beforeUpdateCurrent
|
|
73
|
-
flatten(afterUpdateCurrent
|
|
66
|
+
flatten(guards ?? []).forEach((guard) => router.registerGuard(guard));
|
|
67
|
+
flatten(onChange ?? []).forEach((hook) => router.registerSyncHook('change', hook));
|
|
68
|
+
flatten(beforeResolve ?? []).forEach((hook) => router.registerHook('beforeResolve', hook));
|
|
69
|
+
flatten(beforeNavigate ?? []).forEach((hook) => router.registerHook('beforeNavigate', hook));
|
|
70
|
+
flatten(afterNavigate ?? []).forEach((hook) => router.registerHook('afterNavigate', hook));
|
|
71
|
+
flatten(beforeUpdateCurrent ?? []).forEach((hook) => router.registerHook('beforeUpdateCurrent', hook));
|
|
72
|
+
flatten(afterUpdateCurrent ?? []).forEach((hook) => router.registerHook('afterUpdateCurrent', hook));
|
|
74
73
|
};
|
|
75
74
|
},
|
|
76
75
|
deps: {
|
package/lib/modules/common.es.js
CHANGED
|
@@ -24,15 +24,14 @@ const providers = [
|
|
|
24
24
|
trailingSlash: true,
|
|
25
25
|
mergeSlashes: true,
|
|
26
26
|
enableViewTransitions: process.env.__TRAMVAI_VIEW_TRANSITIONS === 'true',
|
|
27
|
-
routes: flatten(routes
|
|
27
|
+
routes: flatten(routes ?? []).map(routeTransform),
|
|
28
28
|
});
|
|
29
29
|
if (routeResolve) {
|
|
30
30
|
router.registerHook('beforeResolve', async (navigation) => {
|
|
31
|
-
var _a;
|
|
32
31
|
const existingRoute = router.resolve(navigation.url.href);
|
|
33
32
|
// forceRouteResolve exists as a fallback property in case we have any conflicts
|
|
34
33
|
// in external routes definition and we need to force route resolving is some cases
|
|
35
|
-
if (!existingRoute ||
|
|
34
|
+
if (!existingRoute || existingRoute.config?.forceRouteResolve) {
|
|
36
35
|
const route = await routeResolve(navigation);
|
|
37
36
|
if (route) {
|
|
38
37
|
router.addRoute(routeTransform(route));
|
|
@@ -64,13 +63,13 @@ const providers = [
|
|
|
64
63
|
multi: true,
|
|
65
64
|
useFactory: ({ router, guards, onChange, beforeResolve, beforeNavigate, afterNavigate, beforeUpdateCurrent, afterUpdateCurrent, }) => {
|
|
66
65
|
return function routerInit() {
|
|
67
|
-
flatten(guards
|
|
68
|
-
flatten(onChange
|
|
69
|
-
flatten(beforeResolve
|
|
70
|
-
flatten(beforeNavigate
|
|
71
|
-
flatten(afterNavigate
|
|
72
|
-
flatten(beforeUpdateCurrent
|
|
73
|
-
flatten(afterUpdateCurrent
|
|
66
|
+
flatten(guards ?? []).forEach((guard) => router.registerGuard(guard));
|
|
67
|
+
flatten(onChange ?? []).forEach((hook) => router.registerSyncHook('change', hook));
|
|
68
|
+
flatten(beforeResolve ?? []).forEach((hook) => router.registerHook('beforeResolve', hook));
|
|
69
|
+
flatten(beforeNavigate ?? []).forEach((hook) => router.registerHook('beforeNavigate', hook));
|
|
70
|
+
flatten(afterNavigate ?? []).forEach((hook) => router.registerHook('afterNavigate', hook));
|
|
71
|
+
flatten(beforeUpdateCurrent ?? []).forEach((hook) => router.registerHook('beforeUpdateCurrent', hook));
|
|
72
|
+
flatten(afterUpdateCurrent ?? []).forEach((hook) => router.registerHook('afterUpdateCurrent', hook));
|
|
74
73
|
};
|
|
75
74
|
},
|
|
76
75
|
deps: {
|
package/lib/modules/common.js
CHANGED
|
@@ -32,15 +32,14 @@ const providers = [
|
|
|
32
32
|
trailingSlash: true,
|
|
33
33
|
mergeSlashes: true,
|
|
34
34
|
enableViewTransitions: process.env.__TRAMVAI_VIEW_TRANSITIONS === 'true',
|
|
35
|
-
routes: flatten__default["default"](routes
|
|
35
|
+
routes: flatten__default["default"](routes ?? []).map(routeTransform),
|
|
36
36
|
});
|
|
37
37
|
if (routeResolve) {
|
|
38
38
|
router.registerHook('beforeResolve', async (navigation) => {
|
|
39
|
-
var _a;
|
|
40
39
|
const existingRoute = router.resolve(navigation.url.href);
|
|
41
40
|
// forceRouteResolve exists as a fallback property in case we have any conflicts
|
|
42
41
|
// in external routes definition and we need to force route resolving is some cases
|
|
43
|
-
if (!existingRoute ||
|
|
42
|
+
if (!existingRoute || existingRoute.config?.forceRouteResolve) {
|
|
44
43
|
const route = await routeResolve(navigation);
|
|
45
44
|
if (route) {
|
|
46
45
|
router.addRoute(routeTransform(route));
|
|
@@ -72,13 +71,13 @@ const providers = [
|
|
|
72
71
|
multi: true,
|
|
73
72
|
useFactory: ({ router, guards, onChange, beforeResolve, beforeNavigate, afterNavigate, beforeUpdateCurrent, afterUpdateCurrent, }) => {
|
|
74
73
|
return function routerInit() {
|
|
75
|
-
flatten__default["default"](guards
|
|
76
|
-
flatten__default["default"](onChange
|
|
77
|
-
flatten__default["default"](beforeResolve
|
|
78
|
-
flatten__default["default"](beforeNavigate
|
|
79
|
-
flatten__default["default"](afterNavigate
|
|
80
|
-
flatten__default["default"](beforeUpdateCurrent
|
|
81
|
-
flatten__default["default"](afterUpdateCurrent
|
|
74
|
+
flatten__default["default"](guards ?? []).forEach((guard) => router.registerGuard(guard));
|
|
75
|
+
flatten__default["default"](onChange ?? []).forEach((hook) => router.registerSyncHook('change', hook));
|
|
76
|
+
flatten__default["default"](beforeResolve ?? []).forEach((hook) => router.registerHook('beforeResolve', hook));
|
|
77
|
+
flatten__default["default"](beforeNavigate ?? []).forEach((hook) => router.registerHook('beforeNavigate', hook));
|
|
78
|
+
flatten__default["default"](afterNavigate ?? []).forEach((hook) => router.registerHook('afterNavigate', hook));
|
|
79
|
+
flatten__default["default"](beforeUpdateCurrent ?? []).forEach((hook) => router.registerHook('beforeUpdateCurrent', hook));
|
|
80
|
+
flatten__default["default"](afterUpdateCurrent ?? []).forEach((hook) => router.registerHook('afterUpdateCurrent', hook));
|
|
82
81
|
};
|
|
83
82
|
},
|
|
84
83
|
deps: {
|
|
@@ -38,8 +38,8 @@ const resetDeferredActions = (deps) => {
|
|
|
38
38
|
const actions = getActions(deps);
|
|
39
39
|
actions.forEach((action) => {
|
|
40
40
|
const parameters = action[ACTION_PARAMETERS];
|
|
41
|
-
const isDeferredAction = parameters
|
|
42
|
-
const deferred = deps.deferredActionsMap.get(parameters
|
|
41
|
+
const isDeferredAction = parameters?.deferred;
|
|
42
|
+
const deferred = deps.deferredActionsMap.get(parameters?.name);
|
|
43
43
|
// here only deferred actions with always or dynamic conditions will be refreshed
|
|
44
44
|
if (isDeferredAction && deferred && deps.actionExecution.canExecute(action)) {
|
|
45
45
|
deferred.reset();
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const httpStatus = ({ responseManager }) => async ({ to }) => {
|
|
6
|
-
if (to
|
|
6
|
+
if (to?.config.httpStatus) {
|
|
7
7
|
responseManager.setStatus(to.config.httpStatus);
|
|
8
8
|
}
|
|
9
9
|
};
|
|
@@ -11,10 +11,9 @@ const clientTokens = [
|
|
|
11
11
|
useFactory: ({ store }) => {
|
|
12
12
|
return {
|
|
13
13
|
onBlock: async (navigation) => {
|
|
14
|
-
var _a, _b, _c;
|
|
15
14
|
let error = new BlockError({
|
|
16
|
-
message: `Url ${
|
|
17
|
-
prevUrl:
|
|
15
|
+
message: `Url ${navigation.to?.actualPath} is blocked`,
|
|
16
|
+
prevUrl: navigation.fromUrl?.href ?? window.location.href,
|
|
18
17
|
nextUrl: navigation.url.href,
|
|
19
18
|
});
|
|
20
19
|
error = makeErrorSilent(error);
|
|
@@ -13,13 +13,12 @@ class PageRegistry {
|
|
|
13
13
|
this.dispatcherContext = dispatcherContext;
|
|
14
14
|
}
|
|
15
15
|
async resolve(route) {
|
|
16
|
-
var _a;
|
|
17
16
|
const { bundle, pageComponent } = this.pageService.getConfig(route);
|
|
18
17
|
const nestedLayoutComponent = this.pageService.resolveComponentFromConfig('nestedLayout', route);
|
|
19
18
|
const resolvedBundle = await this.bundleManager.get(bundle, pageComponent);
|
|
20
19
|
// register bundle first to be able to load other components later
|
|
21
20
|
await this.registerComponent(bundle, resolvedBundle);
|
|
22
|
-
const resolvedPageComponent =
|
|
21
|
+
const resolvedPageComponent = resolvedBundle.components?.[pageComponent];
|
|
23
22
|
// for file-system pages bundle is virtual, so it will be loaded in parallel with nested layout
|
|
24
23
|
// for classic bundles, page component will be loaded after bundle loading
|
|
25
24
|
const promises = [];
|
|
@@ -13,13 +13,12 @@ class PageRegistry {
|
|
|
13
13
|
this.dispatcherContext = dispatcherContext;
|
|
14
14
|
}
|
|
15
15
|
async resolve(route) {
|
|
16
|
-
var _a;
|
|
17
16
|
const { bundle, pageComponent } = this.pageService.getConfig(route);
|
|
18
17
|
const nestedLayoutComponent = this.pageService.resolveComponentFromConfig('nestedLayout', route);
|
|
19
18
|
const resolvedBundle = await this.bundleManager.get(bundle, pageComponent);
|
|
20
19
|
// register bundle first to be able to load other components later
|
|
21
20
|
await this.registerComponent(bundle, resolvedBundle);
|
|
22
|
-
const resolvedPageComponent =
|
|
21
|
+
const resolvedPageComponent = resolvedBundle.components?.[pageComponent];
|
|
23
22
|
// for file-system pages bundle is virtual, so it will be loaded in parallel with nested layout
|
|
24
23
|
// for classic bundles, page component will be loaded after bundle loading
|
|
25
24
|
const promises = [];
|
|
@@ -23,13 +23,12 @@ class PageRegistry {
|
|
|
23
23
|
this.dispatcherContext = dispatcherContext;
|
|
24
24
|
}
|
|
25
25
|
async resolve(route) {
|
|
26
|
-
var _a;
|
|
27
26
|
const { bundle, pageComponent } = this.pageService.getConfig(route);
|
|
28
27
|
const nestedLayoutComponent = this.pageService.resolveComponentFromConfig('nestedLayout', route);
|
|
29
28
|
const resolvedBundle = await this.bundleManager.get(bundle, pageComponent);
|
|
30
29
|
// register bundle first to be able to load other components later
|
|
31
30
|
await this.registerComponent(bundle, resolvedBundle);
|
|
32
|
-
const resolvedPageComponent =
|
|
31
|
+
const resolvedPageComponent = resolvedBundle.components?.[pageComponent];
|
|
33
32
|
// for file-system pages bundle is virtual, so it will be loaded in parallel with nested layout
|
|
34
33
|
// for classic bundles, page component will be loaded after bundle loading
|
|
35
34
|
const promises = [];
|
|
@@ -12,16 +12,13 @@ class PageService {
|
|
|
12
12
|
return this.router.getCurrentUrl();
|
|
13
13
|
}
|
|
14
14
|
getConfig(route = this.getCurrentRoute()) {
|
|
15
|
-
|
|
16
|
-
return (_a = route === null || route === void 0 ? void 0 : route.config) !== null && _a !== void 0 ? _a : {};
|
|
15
|
+
return route?.config ?? {};
|
|
17
16
|
}
|
|
18
17
|
getContent(route) {
|
|
19
|
-
|
|
20
|
-
return (_a = this.getConfig(route).content) !== null && _a !== void 0 ? _a : {};
|
|
18
|
+
return this.getConfig(route).content ?? {};
|
|
21
19
|
}
|
|
22
20
|
getMeta(route) {
|
|
23
|
-
|
|
24
|
-
return (_a = this.getConfig(route).meta) !== null && _a !== void 0 ? _a : {};
|
|
21
|
+
return this.getConfig(route).meta ?? {};
|
|
25
22
|
}
|
|
26
23
|
navigate(options) {
|
|
27
24
|
return this.router.navigate(options);
|
|
@@ -47,10 +44,9 @@ class PageService {
|
|
|
47
44
|
return this.componentRegistry.get(name, group);
|
|
48
45
|
}
|
|
49
46
|
resolveComponentFromConfig(property, route) {
|
|
50
|
-
var _a;
|
|
51
47
|
const configName = `${property}Component`;
|
|
52
48
|
const defaultComponent = `${property}Default`;
|
|
53
|
-
const componentName =
|
|
49
|
+
const componentName = this.getConfig(route)[configName] ?? defaultComponent;
|
|
54
50
|
return this.getComponent(componentName, route) || this.getComponent(defaultComponent, route);
|
|
55
51
|
}
|
|
56
52
|
getComponentsGroupName(route) {
|
|
@@ -12,16 +12,13 @@ class PageService {
|
|
|
12
12
|
return this.router.getCurrentUrl();
|
|
13
13
|
}
|
|
14
14
|
getConfig(route = this.getCurrentRoute()) {
|
|
15
|
-
|
|
16
|
-
return (_a = route === null || route === void 0 ? void 0 : route.config) !== null && _a !== void 0 ? _a : {};
|
|
15
|
+
return route?.config ?? {};
|
|
17
16
|
}
|
|
18
17
|
getContent(route) {
|
|
19
|
-
|
|
20
|
-
return (_a = this.getConfig(route).content) !== null && _a !== void 0 ? _a : {};
|
|
18
|
+
return this.getConfig(route).content ?? {};
|
|
21
19
|
}
|
|
22
20
|
getMeta(route) {
|
|
23
|
-
|
|
24
|
-
return (_a = this.getConfig(route).meta) !== null && _a !== void 0 ? _a : {};
|
|
21
|
+
return this.getConfig(route).meta ?? {};
|
|
25
22
|
}
|
|
26
23
|
navigate(options) {
|
|
27
24
|
return this.router.navigate(options);
|
|
@@ -47,10 +44,9 @@ class PageService {
|
|
|
47
44
|
return this.componentRegistry.get(name, group);
|
|
48
45
|
}
|
|
49
46
|
resolveComponentFromConfig(property, route) {
|
|
50
|
-
var _a;
|
|
51
47
|
const configName = `${property}Component`;
|
|
52
48
|
const defaultComponent = `${property}Default`;
|
|
53
|
-
const componentName =
|
|
49
|
+
const componentName = this.getConfig(route)[configName] ?? defaultComponent;
|
|
54
50
|
return this.getComponent(componentName, route) || this.getComponent(defaultComponent, route);
|
|
55
51
|
}
|
|
56
52
|
getComponentsGroupName(route) {
|
|
@@ -16,16 +16,13 @@ class PageService {
|
|
|
16
16
|
return this.router.getCurrentUrl();
|
|
17
17
|
}
|
|
18
18
|
getConfig(route = this.getCurrentRoute()) {
|
|
19
|
-
|
|
20
|
-
return (_a = route === null || route === void 0 ? void 0 : route.config) !== null && _a !== void 0 ? _a : {};
|
|
19
|
+
return route?.config ?? {};
|
|
21
20
|
}
|
|
22
21
|
getContent(route) {
|
|
23
|
-
|
|
24
|
-
return (_a = this.getConfig(route).content) !== null && _a !== void 0 ? _a : {};
|
|
22
|
+
return this.getConfig(route).content ?? {};
|
|
25
23
|
}
|
|
26
24
|
getMeta(route) {
|
|
27
|
-
|
|
28
|
-
return (_a = this.getConfig(route).meta) !== null && _a !== void 0 ? _a : {};
|
|
25
|
+
return this.getConfig(route).meta ?? {};
|
|
29
26
|
}
|
|
30
27
|
navigate(options) {
|
|
31
28
|
return this.router.navigate(options);
|
|
@@ -51,10 +48,9 @@ class PageService {
|
|
|
51
48
|
return this.componentRegistry.get(name, group);
|
|
52
49
|
}
|
|
53
50
|
resolveComponentFromConfig(property, route) {
|
|
54
|
-
var _a;
|
|
55
51
|
const configName = `${property}Component`;
|
|
56
52
|
const defaultComponent = `${property}Default`;
|
|
57
|
-
const componentName =
|
|
53
|
+
const componentName = this.getConfig(route)[configName] ?? defaultComponent;
|
|
58
54
|
return this.getComponent(componentName, route) || this.getComponent(defaultComponent, route);
|
|
59
55
|
}
|
|
60
56
|
getComponentsGroupName(route) {
|
|
@@ -12,11 +12,10 @@ const bundleInfoPapi = createPapiMethod({
|
|
|
12
12
|
method: 'get',
|
|
13
13
|
path: '/bundleInfo',
|
|
14
14
|
async handler() {
|
|
15
|
-
var _a;
|
|
16
15
|
const { getAdditionalRoutes, routes, routeTransform } = this.deps;
|
|
17
|
-
const loadAdditional = getAdditionalRoutes
|
|
16
|
+
const loadAdditional = getAdditionalRoutes ?? (() => []);
|
|
18
17
|
return deduplicateArray(flatten(routes || [])
|
|
19
|
-
.concat((
|
|
18
|
+
.concat((await loadAdditional()) ?? [])
|
|
20
19
|
.map(routeTransform)
|
|
21
20
|
.map(prop('path'))
|
|
22
21
|
.filter((path) => !isWildcard(path) && !isHistoryFallback(path))
|
|
@@ -21,11 +21,10 @@ const bundleInfoPapi = papi.createPapiMethod({
|
|
|
21
21
|
method: 'get',
|
|
22
22
|
path: '/bundleInfo',
|
|
23
23
|
async handler() {
|
|
24
|
-
var _a;
|
|
25
24
|
const { getAdditionalRoutes, routes, routeTransform } = this.deps;
|
|
26
|
-
const loadAdditional = getAdditionalRoutes
|
|
25
|
+
const loadAdditional = getAdditionalRoutes ?? (() => []);
|
|
27
26
|
return deduplicateArray(flatten__default["default"](routes || [])
|
|
28
|
-
.concat((
|
|
27
|
+
.concat((await loadAdditional()) ?? [])
|
|
29
28
|
.map(routeTransform)
|
|
30
29
|
.map(prop__default["default"]('path'))
|
|
31
30
|
.filter((path) => !router.isWildcard(path) && !router.isHistoryFallback(path))
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RedirectFoundError, makeErrorSilent, HttpError } from '@tinkoff/errors';
|
|
2
2
|
|
|
3
3
|
const routerOptions = ({ requestManager, responseManager, }) => {
|
|
4
|
-
const getUrl = (navigation) =>
|
|
4
|
+
const getUrl = (navigation) => navigation.url?.path ?? requestManager.getUrl();
|
|
5
5
|
const throwError = ({ defaultStatus, url }) => {
|
|
6
6
|
const error = new HttpError({
|
|
7
7
|
url,
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var errors = require('@tinkoff/errors');
|
|
6
6
|
|
|
7
7
|
const routerOptions = ({ requestManager, responseManager, }) => {
|
|
8
|
-
const getUrl = (navigation) =>
|
|
8
|
+
const getUrl = (navigation) => navigation.url?.path ?? requestManager.getUrl();
|
|
9
9
|
const throwError = ({ defaultStatus, url }) => {
|
|
10
10
|
const error = new errors.HttpError({
|
|
11
11
|
url,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/module-router",
|
|
3
|
-
"version": "5.9
|
|
3
|
+
"version": "5.14.9",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"browser": {
|
|
@@ -26,27 +26,27 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@tinkoff/errors": "0.6.2",
|
|
29
|
-
"@tinkoff/router": "0.5.
|
|
29
|
+
"@tinkoff/router": "0.5.46",
|
|
30
30
|
"@tinkoff/url": "0.11.2",
|
|
31
|
-
"@tramvai/react": "5.9
|
|
32
|
-
"@tramvai/safe-strings": "0.8.
|
|
33
|
-
"@tramvai/tokens-child-app": "5.9
|
|
34
|
-
"@tramvai/tokens-render": "5.9
|
|
35
|
-
"@tramvai/tokens-router": "5.9
|
|
36
|
-
"@tramvai/tokens-server": "5.9
|
|
37
|
-
"@tramvai/experiments": "5.9
|
|
31
|
+
"@tramvai/react": "5.14.9",
|
|
32
|
+
"@tramvai/safe-strings": "0.8.4",
|
|
33
|
+
"@tramvai/tokens-child-app": "5.14.9",
|
|
34
|
+
"@tramvai/tokens-render": "5.14.9",
|
|
35
|
+
"@tramvai/tokens-router": "5.14.9",
|
|
36
|
+
"@tramvai/tokens-server": "5.14.9",
|
|
37
|
+
"@tramvai/experiments": "5.14.9"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"@tinkoff/utils": "^2.1.2",
|
|
41
|
-
"@tramvai/cli": "5.9
|
|
42
|
-
"@tramvai/core": "5.9
|
|
43
|
-
"@tramvai/module-log": "5.9
|
|
44
|
-
"@tramvai/module-server": "5.9
|
|
45
|
-
"@tramvai/papi": "5.9
|
|
46
|
-
"@tramvai/state": "5.9
|
|
47
|
-
"@tramvai/test-helpers": "5.9
|
|
48
|
-
"@tramvai/test-mocks": "5.9
|
|
49
|
-
"@tramvai/tokens-common": "5.9
|
|
41
|
+
"@tramvai/cli": "5.14.9",
|
|
42
|
+
"@tramvai/core": "5.14.9",
|
|
43
|
+
"@tramvai/module-log": "5.14.9",
|
|
44
|
+
"@tramvai/module-server": "5.14.9",
|
|
45
|
+
"@tramvai/papi": "5.14.9",
|
|
46
|
+
"@tramvai/state": "5.14.9",
|
|
47
|
+
"@tramvai/test-helpers": "5.14.9",
|
|
48
|
+
"@tramvai/test-mocks": "5.14.9",
|
|
49
|
+
"@tramvai/tokens-common": "5.14.9",
|
|
50
50
|
"@tinkoff/dippy": "0.11.3",
|
|
51
51
|
"react": "*",
|
|
52
52
|
"tslib": "^2.4.0"
|