@squide/firefly 3.0.1 → 3.0.2
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/CHANGELOG.md +9 -0
- package/dist/AppRouter.js +1 -1
- package/dist/{chunk-GSHD4LQA.js → chunk-MKFAFYJH.js} +17 -6
- package/dist/index.js +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @squide/firefly
|
|
2
2
|
|
|
3
|
+
## 3.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#122](https://github.com/gsoft-inc/wl-squide/pull/122) [`cda7873`](https://github.com/gsoft-inc/wl-squide/commit/cda7873dcffbf424a625cf40c56a12eacbb2632e) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Internal minor changes
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`cda7873`](https://github.com/gsoft-inc/wl-squide/commit/cda7873dcffbf424a625cf40c56a12eacbb2632e)]:
|
|
10
|
+
- @squide/msw@2.0.6
|
|
11
|
+
|
|
3
12
|
## 3.0.1
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
package/dist/AppRouter.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { AppRouter, BootstrappingRoute } from './chunk-
|
|
1
|
+
export { AppRouter, BootstrappingRoute } from './chunk-MKFAFYJH.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useLogger } from '@squide/core';
|
|
1
|
+
import { useLogger, isNil } from '@squide/core';
|
|
2
2
|
import { useIsMswStarted } from '@squide/msw';
|
|
3
3
|
import { useIsRouteMatchProtected, useRoutes } from '@squide/react-router';
|
|
4
4
|
import { useAreModulesRegistered, useAreModulesReady } from '@squide/webpack-module-federation';
|
|
@@ -8,6 +8,9 @@ import { useLocation, Outlet, createBrowserRouter, RouterProvider } from 'react-
|
|
|
8
8
|
import { jsx } from 'react/jsx-runtime';
|
|
9
9
|
|
|
10
10
|
// src/AppRouter.tsx
|
|
11
|
+
function isPromise(value) {
|
|
12
|
+
return !isNil(value) && !isNil(value.then) && !isNil(value.catch);
|
|
13
|
+
}
|
|
11
14
|
function BootstrappingRoute(props) {
|
|
12
15
|
const {
|
|
13
16
|
fallbackElement,
|
|
@@ -38,7 +41,11 @@ function BootstrappingRoute(props) {
|
|
|
38
41
|
if ((areModulesRegistered || areModulesReady) && isMswStarted) {
|
|
39
42
|
if (!isPublicDataLoaded) {
|
|
40
43
|
logger.debug("[shell] Loading public data.");
|
|
41
|
-
onLoadPublicData()
|
|
44
|
+
const result = onLoadPublicData();
|
|
45
|
+
if (!isPromise(result)) {
|
|
46
|
+
throw Error("[squide] An AppRouter onLoadPublicData handler must return a promise object.");
|
|
47
|
+
}
|
|
48
|
+
result.then(() => {
|
|
42
49
|
setIsPublicDataLoaded(true);
|
|
43
50
|
logger.debug("[shell] Public data has been loaded.");
|
|
44
51
|
}).catch((error) => {
|
|
@@ -47,7 +54,7 @@ function BootstrappingRoute(props) {
|
|
|
47
54
|
}
|
|
48
55
|
}
|
|
49
56
|
}
|
|
50
|
-
}, [logger, areModulesRegistered, areModulesReady, isMswStarted, isPublicDataLoaded, onLoadPublicData]);
|
|
57
|
+
}, [logger, areModulesRegistered, areModulesReady, isMswStarted, isPublicDataLoaded, showBoundary, onLoadPublicData]);
|
|
51
58
|
const isActiveRouteProtected = useIsRouteMatchProtected(location, { throwWhenThereIsNoMatch: areModulesReady });
|
|
52
59
|
useEffect(() => {
|
|
53
60
|
if (onLoadProtectedData) {
|
|
@@ -55,7 +62,11 @@ function BootstrappingRoute(props) {
|
|
|
55
62
|
if (isActiveRouteProtected) {
|
|
56
63
|
if (!isProtectedDataLoaded) {
|
|
57
64
|
logger.debug(`[shell] Loading protected data as "${location.pathname}" is a protected route.`);
|
|
58
|
-
onLoadProtectedData()
|
|
65
|
+
const result = onLoadProtectedData();
|
|
66
|
+
if (!isPromise(result)) {
|
|
67
|
+
throw Error("[squide] An AppRouter onLoadProtectedData handler must return a promise object.");
|
|
68
|
+
}
|
|
69
|
+
result.then(() => {
|
|
59
70
|
setIsProtectedDataLoaded(true);
|
|
60
71
|
logger.debug("[shell] Protected data has been loaded.");
|
|
61
72
|
}).catch((error) => {
|
|
@@ -67,7 +78,7 @@ function BootstrappingRoute(props) {
|
|
|
67
78
|
}
|
|
68
79
|
}
|
|
69
80
|
}
|
|
70
|
-
}, [logger, location, areModulesRegistered, areModulesReady, isMswStarted, isActiveRouteProtected, isProtectedDataLoaded, onLoadProtectedData]);
|
|
81
|
+
}, [logger, location, areModulesRegistered, areModulesReady, isMswStarted, isActiveRouteProtected, isProtectedDataLoaded, showBoundary, onLoadProtectedData]);
|
|
71
82
|
useEffect(() => {
|
|
72
83
|
if (onCompleteRegistrations) {
|
|
73
84
|
if (areModulesRegistered && isMswStarted && isPublicDataLoaded) {
|
|
@@ -118,7 +129,7 @@ function AppRouter(props) {
|
|
|
118
129
|
children: routes
|
|
119
130
|
}
|
|
120
131
|
]);
|
|
121
|
-
}, [areModulesRegistered, areModulesReady, routes, onLoadPublicData, onLoadProtectedData, onCompleteRegistrations, waitForMsw]);
|
|
132
|
+
}, [areModulesRegistered, areModulesReady, routes, onLoadPublicData, onLoadProtectedData, onCompleteRegistrations, waitForMsw, errorRenderer, fallbackElement]);
|
|
122
133
|
return /* @__PURE__ */ jsx(RouterProvider, { ...routerProvidersProps, router });
|
|
123
134
|
}
|
|
124
135
|
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@squide/firefly",
|
|
3
3
|
"author": "Workleap",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.2",
|
|
5
5
|
"description": "Helpers to facilitate the creation of a shell package with Squide firefly technology stack.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": {
|
|
@@ -92,9 +92,9 @@
|
|
|
92
92
|
},
|
|
93
93
|
"dependencies": {
|
|
94
94
|
"@squide/core": "3.1.0",
|
|
95
|
+
"@squide/msw": "2.0.6",
|
|
95
96
|
"@squide/react-router": "3.0.1",
|
|
96
|
-
"@squide/webpack-module-federation": "3.0.1"
|
|
97
|
-
"@squide/msw": "2.0.5"
|
|
97
|
+
"@squide/webpack-module-federation": "3.0.1"
|
|
98
98
|
},
|
|
99
99
|
"sideEffects": false,
|
|
100
100
|
"engines": {
|