@kimesh/router-generator 0.2.29 → 0.2.30
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/dist/index.mjs +6 -7
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -871,12 +871,11 @@ var RouteTreeBuilder = class {
|
|
|
871
871
|
return null;
|
|
872
872
|
}
|
|
873
873
|
addPathlessLayoutRoutes(routes, pathlessPages) {
|
|
874
|
-
if (pathlessPages.size === 0) return;
|
|
875
874
|
const rootLayout = routes.find((r) => r.type === "layout" && r.routePath === "/");
|
|
876
|
-
for (const [layoutKey,
|
|
877
|
-
|
|
878
|
-
if (
|
|
879
|
-
layout.children =
|
|
875
|
+
for (const [layoutKey, layout] of this.layoutNodes) {
|
|
876
|
+
if (!Array.from(this.pathlessLayoutMap.values()).includes(layoutKey)) continue;
|
|
877
|
+
if (layout.parent) continue;
|
|
878
|
+
layout.children = (pathlessPages.get(layoutKey) || []).map((page) => {
|
|
880
879
|
page.parent = layout;
|
|
881
880
|
return page;
|
|
882
881
|
});
|
|
@@ -1785,7 +1784,7 @@ function buildLayoutRoutesMap(children) {
|
|
|
1785
1784
|
function collectRoutesRecursively(children, map, pathlessParent) {
|
|
1786
1785
|
for (const child of children) {
|
|
1787
1786
|
const normalizedPath = normalizeRoutePath(child.routePath);
|
|
1788
|
-
if (isPathlessLayout(child) && child.children
|
|
1787
|
+
if (isPathlessLayout(child) && child.children) collectRoutesRecursively(child.children, map, child);
|
|
1789
1788
|
if (child.routePath && !child.routePath.includes(":")) map.set(normalizedPath, {
|
|
1790
1789
|
route: child,
|
|
1791
1790
|
pathlessParent
|
|
@@ -1803,7 +1802,7 @@ function findPathlessLayoutForLayerRoute(children, _relativePath, layerRoute) {
|
|
|
1803
1802
|
if (layerRoute.filePath.startsWith(child.rawSegment + "/")) return child;
|
|
1804
1803
|
}
|
|
1805
1804
|
}
|
|
1806
|
-
for (const child of children) if (isPathlessLayout(child) && child.children
|
|
1805
|
+
for (const child of children) if (isPathlessLayout(child) && child.children) {
|
|
1807
1806
|
const nestedPathless = findPathlessLayoutForLayerRoute(child.children, _relativePath, layerRoute);
|
|
1808
1807
|
if (nestedPathless) return nestedPathless;
|
|
1809
1808
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kimesh/router-generator",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.30",
|
|
4
4
|
"description": "File-based route generator for Kimesh",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"test:watch": "vitest"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@kimesh/shared": "0.2.
|
|
29
|
+
"@kimesh/shared": "0.2.30",
|
|
30
30
|
"@vue/compiler-sfc": "^3.5.26",
|
|
31
31
|
"chokidar": "^5.0.0",
|
|
32
32
|
"consola": "^3.4.2",
|