@tramvai/module-common 2.59.3 → 2.61.1

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.
@@ -11,7 +11,7 @@ export * from '@tramvai/tokens-common';
11
11
  import isObject from '@tinkoff/utils/is/object';
12
12
  import isArray from '@tinkoff/utils/is/array';
13
13
  import { resolveLazyComponent, __lazyErrorHandler } from '@tramvai/react';
14
- import { fileSystemPagesEnabled, getAllFileSystemPages, getAllFileSystemLayouts, fileSystemPageToLayoutKey, isFileSystemPageComponent } from '@tramvai/experiments';
14
+ import { fileSystemPagesEnabled, getAllFileSystemPages, getAllFileSystemLayouts, getAllFileSystemErrorBoundaries, isFileSystemPageComponent, fileSystemPageToLayoutKey, fileSystemPageToErrorBoundaryKey } from '@tramvai/experiments';
15
15
  import pathOr from '@tinkoff/utils/object/pathOr';
16
16
  import flatten from '@tinkoff/utils/array/flatten';
17
17
  import { FASTIFY_REQUEST, FASTIFY_RESPONSE } from '@tramvai/tokens-server-private';
@@ -45,14 +45,17 @@ class BundleManager {
45
45
  const log = logger('file-system-pages:bundle-manager');
46
46
  const components = getAllFileSystemPages();
47
47
  const layouts = getAllFileSystemLayouts();
48
+ const errorBoundaries = getAllFileSystemErrorBoundaries();
49
+ const getComponentsFor = (mapping, getKey) => Object.keys(mapping).reduce((result, key) => {
50
+ // eslint-disable-next-line no-param-reassign
51
+ result[getKey(key)] = mapping[key];
52
+ return result;
53
+ }, {});
48
54
  const componentsDefaultBundle = createBundle({
49
55
  name: FS_PAGES_DEFAULT_BUNDLE,
50
56
  components: {
51
- ...Object.keys(layouts).reduce((result, key) => {
52
- // eslint-disable-next-line no-param-reassign
53
- result[fileSystemPageToLayoutKey(key)] = layouts[key];
54
- return result;
55
- }, {}),
57
+ ...getComponentsFor(layouts, fileSystemPageToLayoutKey),
58
+ ...getComponentsFor(errorBoundaries, fileSystemPageToErrorBoundaryKey),
56
59
  ...components,
57
60
  },
58
61
  });
package/lib/index.es.js CHANGED
@@ -11,7 +11,7 @@ export * from '@tramvai/tokens-common';
11
11
  import isObject from '@tinkoff/utils/is/object';
12
12
  import isArray from '@tinkoff/utils/is/array';
13
13
  import { resolveLazyComponent, __lazyErrorHandler } from '@tramvai/react';
14
- import { fileSystemPagesEnabled, getAllFileSystemPages, getAllFileSystemLayouts, fileSystemPageToLayoutKey, isFileSystemPageComponent } from '@tramvai/experiments';
14
+ import { fileSystemPagesEnabled, getAllFileSystemPages, getAllFileSystemLayouts, getAllFileSystemErrorBoundaries, isFileSystemPageComponent, fileSystemPageToLayoutKey, fileSystemPageToErrorBoundaryKey } from '@tramvai/experiments';
15
15
  import pathOr from '@tinkoff/utils/object/pathOr';
16
16
  import flatten from '@tinkoff/utils/array/flatten';
17
17
  import { createEvent, createReducer, convertAction, createDispatcher, devTools, Provider } from '@tramvai/state';
@@ -47,14 +47,17 @@ class BundleManager {
47
47
  const log = logger('file-system-pages:bundle-manager');
48
48
  const components = getAllFileSystemPages();
49
49
  const layouts = getAllFileSystemLayouts();
50
+ const errorBoundaries = getAllFileSystemErrorBoundaries();
51
+ const getComponentsFor = (mapping, getKey) => Object.keys(mapping).reduce((result, key) => {
52
+ // eslint-disable-next-line no-param-reassign
53
+ result[getKey(key)] = mapping[key];
54
+ return result;
55
+ }, {});
50
56
  const componentsDefaultBundle = createBundle({
51
57
  name: FS_PAGES_DEFAULT_BUNDLE,
52
58
  components: {
53
- ...Object.keys(layouts).reduce((result, key) => {
54
- // eslint-disable-next-line no-param-reassign
55
- result[fileSystemPageToLayoutKey(key)] = layouts[key];
56
- return result;
57
- }, {}),
59
+ ...getComponentsFor(layouts, fileSystemPageToLayoutKey),
60
+ ...getComponentsFor(errorBoundaries, fileSystemPageToErrorBoundaryKey),
58
61
  ...components,
59
62
  },
60
63
  });
package/lib/index.js CHANGED
@@ -65,14 +65,17 @@ class BundleManager {
65
65
  const log = logger('file-system-pages:bundle-manager');
66
66
  const components = experiments.getAllFileSystemPages();
67
67
  const layouts = experiments.getAllFileSystemLayouts();
68
+ const errorBoundaries = experiments.getAllFileSystemErrorBoundaries();
69
+ const getComponentsFor = (mapping, getKey) => Object.keys(mapping).reduce((result, key) => {
70
+ // eslint-disable-next-line no-param-reassign
71
+ result[getKey(key)] = mapping[key];
72
+ return result;
73
+ }, {});
68
74
  const componentsDefaultBundle = core.createBundle({
69
75
  name: FS_PAGES_DEFAULT_BUNDLE,
70
76
  components: {
71
- ...Object.keys(layouts).reduce((result, key) => {
72
- // eslint-disable-next-line no-param-reassign
73
- result[experiments.fileSystemPageToLayoutKey(key)] = layouts[key];
74
- return result;
75
- }, {}),
77
+ ...getComponentsFor(layouts, experiments.fileSystemPageToLayoutKey),
78
+ ...getComponentsFor(errorBoundaries, experiments.fileSystemPageToErrorBoundaryKey),
76
79
  ...components,
77
80
  },
78
81
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/module-common",
3
- "version": "2.59.3",
3
+ "version": "2.61.1",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -33,28 +33,28 @@
33
33
  "@tinkoff/lru-cache-nano": "^7.8.1",
34
34
  "@tinkoff/pubsub": "0.5.5",
35
35
  "@tinkoff/url": "0.8.4",
36
- "@tramvai/experiments": "2.59.3",
37
- "@tramvai/module-cookie": "2.59.3",
38
- "@tramvai/module-environment": "2.59.3",
39
- "@tramvai/module-log": "2.59.3",
40
- "@tramvai/tokens-child-app": "2.59.3",
41
- "@tramvai/tokens-core-private": "2.59.3",
42
- "@tramvai/tokens-common": "2.59.3",
43
- "@tramvai/tokens-render": "2.59.3",
44
- "@tramvai/tokens-server-private": "2.59.3",
45
- "@tramvai/types-actions-state-context": "2.59.3",
36
+ "@tramvai/experiments": "2.61.1",
37
+ "@tramvai/module-cookie": "2.61.1",
38
+ "@tramvai/module-environment": "2.61.1",
39
+ "@tramvai/module-log": "2.61.1",
40
+ "@tramvai/tokens-child-app": "2.61.1",
41
+ "@tramvai/tokens-core-private": "2.61.1",
42
+ "@tramvai/tokens-common": "2.61.1",
43
+ "@tramvai/tokens-render": "2.61.1",
44
+ "@tramvai/tokens-server-private": "2.61.1",
45
+ "@tramvai/types-actions-state-context": "2.61.1",
46
46
  "hoist-non-react-statics": "^3.3.1",
47
47
  "node-abort-controller": "^3.0.1"
48
48
  },
49
49
  "peerDependencies": {
50
50
  "@tinkoff/dippy": "0.8.11",
51
51
  "@tinkoff/utils": "^2.1.2",
52
- "@tramvai/cli": "2.59.3",
53
- "@tramvai/core": "2.59.3",
54
- "@tramvai/papi": "2.59.3",
55
- "@tramvai/react": "2.59.3",
56
- "@tramvai/state": "2.59.3",
57
- "@tramvai/tokens-server": "2.59.3",
52
+ "@tramvai/cli": "2.61.1",
53
+ "@tramvai/core": "2.61.1",
54
+ "@tramvai/papi": "2.61.1",
55
+ "@tramvai/react": "2.61.1",
56
+ "@tramvai/state": "2.61.1",
57
+ "@tramvai/tokens-server": "2.61.1",
58
58
  "react": ">=16.14.0",
59
59
  "tslib": "^2.4.0"
60
60
  },