@tramvai/experiments 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.
@@ -7,6 +7,7 @@ export declare const getAllFileSystemPages: () => {
7
7
  [x: string]: import("@tramvai/react").LazyComponentWrapper<import("@tramvai/react").PageComponent>;
8
8
  };
9
9
  export declare const getAllFileSystemLayouts: () => Record<string, import("@tramvai/react").LazyComponentWrapper<import("@tramvai/react").NestedLayoutComponent>>;
10
+ export declare const getAllFileSystemErrorBoundaries: () => Record<string, import("@tramvai/react").LazyComponentWrapper<import("@tramvai/react").ErrorBoundaryComponent>>;
10
11
  export declare const isFileSystemPageComponent: (pageComponent: string) => boolean;
11
12
  /**
12
13
  * @example
@@ -25,6 +26,11 @@ export declare const pathToExternalFileSystemPage: (path: string) => string;
25
26
  * @/routes/index to @/routes/index__layout
26
27
  */
27
28
  export declare const fileSystemPageToLayoutKey: (pageComponent: string) => string;
29
+ /**
30
+ * @example
31
+ * @/routes/index to @/routes/index__errorBoundary
32
+ */
33
+ export declare const fileSystemPageToErrorBoundaryKey: (pageComponent: string) => string;
28
34
  export declare const fileSystemPageToRoute: (pageComponent: string) => Route;
29
35
  export declare const fileSystemPageComponentExists: (pageComponent: string) => boolean;
30
36
  /**
package/lib/index.es.js CHANGED
@@ -15,6 +15,9 @@ const getAllFileSystemPages = () => {
15
15
  const getAllFileSystemLayouts = () => {
16
16
  return fsPagesAndRoutes.layouts;
17
17
  };
18
+ const getAllFileSystemErrorBoundaries = () => {
19
+ return fsPagesAndRoutes.errorBoundaries;
20
+ };
18
21
  const isFileSystemPageComponent = (pageComponent) => {
19
22
  return (fileSystemPagesEnabled() &&
20
23
  !!pageComponent &&
@@ -60,10 +63,18 @@ const pathToExternalFileSystemPage = (path) => {
60
63
  const fileSystemPageToLayoutKey = (pageComponent) => {
61
64
  return `${pageComponent}__layout`;
62
65
  };
66
+ /**
67
+ * @example
68
+ * @/routes/index to @/routes/index__errorBoundary
69
+ */
70
+ const fileSystemPageToErrorBoundaryKey = (pageComponent) => {
71
+ return `${pageComponent}__errorBoundary`;
72
+ };
63
73
  const fileSystemPageToRoute = (pageComponent) => {
64
74
  const name = pageComponent;
65
75
  const path = staticFileSystemPageToPath(pageComponent);
66
76
  const layouts = getAllFileSystemLayouts();
77
+ const errorBoundaries = getAllFileSystemErrorBoundaries();
67
78
  const route = {
68
79
  name,
69
80
  path,
@@ -74,6 +85,9 @@ const fileSystemPageToRoute = (pageComponent) => {
74
85
  if (pageComponent in layouts) {
75
86
  route.config.nestedLayoutComponent = fileSystemPageToLayoutKey(pageComponent);
76
87
  }
88
+ if (pageComponent in errorBoundaries) {
89
+ route.config.errorBoundaryComponent = fileSystemPageToErrorBoundaryKey(pageComponent);
90
+ }
77
91
  return route;
78
92
  };
79
93
  const fileSystemPageComponentExists = (pageComponent) => {
@@ -87,4 +101,4 @@ const fileSystemPageToWebpackChunkName = (pageComponent) => {
87
101
  return pageComponent.replace(/\//g, '_');
88
102
  };
89
103
 
90
- export { FILE_SYSTEM_PAGES_PREFIX, fileSystemPageComponentExists, fileSystemPageToLayoutKey, fileSystemPageToRoute, fileSystemPageToWebpackChunkName, fileSystemPagesEnabled, getAllFileSystemLayouts, getAllFileSystemPages, getExternalFileSystemPages, getStaticFileSystemPages, isFileSystemPageComponent, pathToExternalFileSystemPage, staticFileSystemPageToPath };
104
+ export { FILE_SYSTEM_PAGES_PREFIX, fileSystemPageComponentExists, fileSystemPageToErrorBoundaryKey, fileSystemPageToLayoutKey, fileSystemPageToRoute, fileSystemPageToWebpackChunkName, fileSystemPagesEnabled, getAllFileSystemErrorBoundaries, getAllFileSystemLayouts, getAllFileSystemPages, getExternalFileSystemPages, getStaticFileSystemPages, isFileSystemPageComponent, pathToExternalFileSystemPage, staticFileSystemPageToPath };
package/lib/index.js CHANGED
@@ -23,6 +23,9 @@ const getAllFileSystemPages = () => {
23
23
  const getAllFileSystemLayouts = () => {
24
24
  return fsPagesAndRoutes__default["default"].layouts;
25
25
  };
26
+ const getAllFileSystemErrorBoundaries = () => {
27
+ return fsPagesAndRoutes__default["default"].errorBoundaries;
28
+ };
26
29
  const isFileSystemPageComponent = (pageComponent) => {
27
30
  return (fileSystemPagesEnabled() &&
28
31
  !!pageComponent &&
@@ -68,10 +71,18 @@ const pathToExternalFileSystemPage = (path) => {
68
71
  const fileSystemPageToLayoutKey = (pageComponent) => {
69
72
  return `${pageComponent}__layout`;
70
73
  };
74
+ /**
75
+ * @example
76
+ * @/routes/index to @/routes/index__errorBoundary
77
+ */
78
+ const fileSystemPageToErrorBoundaryKey = (pageComponent) => {
79
+ return `${pageComponent}__errorBoundary`;
80
+ };
71
81
  const fileSystemPageToRoute = (pageComponent) => {
72
82
  const name = pageComponent;
73
83
  const path = staticFileSystemPageToPath(pageComponent);
74
84
  const layouts = getAllFileSystemLayouts();
85
+ const errorBoundaries = getAllFileSystemErrorBoundaries();
75
86
  const route = {
76
87
  name,
77
88
  path,
@@ -82,6 +93,9 @@ const fileSystemPageToRoute = (pageComponent) => {
82
93
  if (pageComponent in layouts) {
83
94
  route.config.nestedLayoutComponent = fileSystemPageToLayoutKey(pageComponent);
84
95
  }
96
+ if (pageComponent in errorBoundaries) {
97
+ route.config.errorBoundaryComponent = fileSystemPageToErrorBoundaryKey(pageComponent);
98
+ }
85
99
  return route;
86
100
  };
87
101
  const fileSystemPageComponentExists = (pageComponent) => {
@@ -97,10 +111,12 @@ const fileSystemPageToWebpackChunkName = (pageComponent) => {
97
111
 
98
112
  exports.FILE_SYSTEM_PAGES_PREFIX = FILE_SYSTEM_PAGES_PREFIX;
99
113
  exports.fileSystemPageComponentExists = fileSystemPageComponentExists;
114
+ exports.fileSystemPageToErrorBoundaryKey = fileSystemPageToErrorBoundaryKey;
100
115
  exports.fileSystemPageToLayoutKey = fileSystemPageToLayoutKey;
101
116
  exports.fileSystemPageToRoute = fileSystemPageToRoute;
102
117
  exports.fileSystemPageToWebpackChunkName = fileSystemPageToWebpackChunkName;
103
118
  exports.fileSystemPagesEnabled = fileSystemPagesEnabled;
119
+ exports.getAllFileSystemErrorBoundaries = getAllFileSystemErrorBoundaries;
104
120
  exports.getAllFileSystemLayouts = getAllFileSystemLayouts;
105
121
  exports.getAllFileSystemPages = getAllFileSystemPages;
106
122
  exports.getExternalFileSystemPages = getExternalFileSystemPages;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/experiments",
3
- "version": "2.59.3",
3
+ "version": "2.61.1",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.es.js",
@@ -20,8 +20,8 @@
20
20
  },
21
21
  "dependencies": {},
22
22
  "peerDependencies": {
23
- "@tinkoff/router": "0.2.6",
24
- "@tramvai/cli": "2.59.3",
23
+ "@tinkoff/router": "0.2.7",
24
+ "@tramvai/cli": "2.61.1",
25
25
  "tslib": "^2.4.0"
26
26
  },
27
27
  "license": "Apache-2.0"