@raketa-cloud/admin 1.8.11 → 1.8.12
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/package.json +1 -1
- package/src/HonoAdapter.js +21 -7
package/package.json
CHANGED
package/src/HonoAdapter.js
CHANGED
|
@@ -65,16 +65,30 @@ function putIn(result, key, value) {
|
|
|
65
65
|
const sanitizePath = (filePath) =>
|
|
66
66
|
path.normalize(path.join("/", ...filePath.split("/")));
|
|
67
67
|
|
|
68
|
-
// Find template path, preferring an app override over the package template
|
|
69
68
|
function getPartialPath(partialPath, views, viewsFallback) {
|
|
69
|
+
// First resolve the partial path relative to the views directory
|
|
70
|
+
// This normalizes "../_nav.ejs" relative to "page_revisions/codes"
|
|
71
|
+
// Result: "page_revisions/_nav.ejs"
|
|
72
|
+
const resolvedPartialPath = sanitizePath(`${views}/${partialPath}`);
|
|
73
|
+
|
|
70
74
|
const paths = [
|
|
71
|
-
sanitizePath(`${process.cwd()}/src/views/${
|
|
72
|
-
sanitizePath(`${currentPath}/views/${
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
75
|
+
sanitizePath(`${process.cwd()}/src/views/${resolvedPartialPath}`),
|
|
76
|
+
sanitizePath(`${currentPath}/views/${resolvedPartialPath}`),
|
|
77
|
+
];
|
|
78
|
+
|
|
79
|
+
// For fallback, replace the resource name with the fallback path
|
|
80
|
+
if (viewsFallback) {
|
|
81
|
+
// Extract base resource (e.g., "page_revisions" from "page_revisions/codes")
|
|
82
|
+
const resourceBase = views.split("/")[0];
|
|
83
|
+
// Replace resource base with fallback base
|
|
84
|
+
// "page_revisions/_nav.ejs" → "resource_revisions/_nav.ejs" ✓
|
|
85
|
+
const fallbackPath = resolvedPartialPath.replace(
|
|
86
|
+
resourceBase,
|
|
87
|
+
viewsFallback,
|
|
88
|
+
);
|
|
89
|
+
paths.push(sanitizePath(`${currentPath}/views/${fallbackPath}`));
|
|
90
|
+
}
|
|
76
91
|
|
|
77
|
-
// Return first existing path
|
|
78
92
|
const existingPath = paths.find((path) => existsSync(path));
|
|
79
93
|
|
|
80
94
|
if (existingPath) return existingPath;
|