rasengan 1.0.0-beta.55 → 1.0.0-beta.56
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
CHANGED
|
@@ -38,8 +38,9 @@ export const defineRouter = (option) => {
|
|
|
38
38
|
pageComponentList.push(p);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
+
let routers = await Promise.all(imports ?? []);
|
|
41
42
|
// Set properties
|
|
42
|
-
router.routers =
|
|
43
|
+
router.routers = routers;
|
|
43
44
|
router.layout = layout || DefaultLayout;
|
|
44
45
|
router.pages = pageComponentList;
|
|
45
46
|
router.loaderComponent = loaderComponent || (() => null);
|
|
@@ -150,7 +150,7 @@ export const generateRoutes = (router, isRoot = true, parentLayout = undefined)
|
|
|
150
150
|
const route = {
|
|
151
151
|
path: !isRoot
|
|
152
152
|
? router.useParentLayout
|
|
153
|
-
? parentLayout.path + Layout.path
|
|
153
|
+
? parentLayout.path + (Layout.path === '/' ? '' : Layout.path)
|
|
154
154
|
: Layout.path
|
|
155
155
|
: Layout.path,
|
|
156
156
|
errorElement: _jsx(ErrorBoundary, {}),
|
|
@@ -232,17 +232,17 @@ export const generateRoutes = (router, isRoot = true, parentLayout = undefined)
|
|
|
232
232
|
pages.forEach((page) => {
|
|
233
233
|
route.children.push(page);
|
|
234
234
|
});
|
|
235
|
-
// Loop through imported routers in order to apply the same
|
|
235
|
+
// Loop through imported routers in order to apply the same logic like above.
|
|
236
236
|
for (const importedRouter of router.routers) {
|
|
237
237
|
const importedRoutes = generateRoutes(importedRouter, false, Layout);
|
|
238
|
-
importedRoutes
|
|
239
|
-
if (
|
|
240
|
-
route.children.push(
|
|
238
|
+
for (const importedRoute of importedRoutes) {
|
|
239
|
+
if (importedRoute.nested) {
|
|
240
|
+
route.children.push(importedRoute);
|
|
241
241
|
}
|
|
242
242
|
else {
|
|
243
|
-
routes.push(
|
|
243
|
+
routes.push(importedRoute);
|
|
244
244
|
}
|
|
245
|
-
}
|
|
245
|
+
}
|
|
246
246
|
}
|
|
247
247
|
// Make sure to add the route at the beginning of the list
|
|
248
248
|
routes.unshift(route);
|
|
@@ -27,6 +27,7 @@ async function devRequestHandler(req, res, viteDevServer, options) {
|
|
|
27
27
|
const AppRouter = await (await runner.import(join(`${options.rootPath}/src/app/app.router`))).default;
|
|
28
28
|
// Get static routes
|
|
29
29
|
const staticRoutes = generateRoutes(AppRouter);
|
|
30
|
+
console.log({ staticRoutes: JSON.stringify(staticRoutes) });
|
|
30
31
|
// Create static handler
|
|
31
32
|
let handler = createStaticHandler(staticRoutes);
|
|
32
33
|
if (isDataRequest(req)) {
|