@ijo-elaja/rev.js 0.6.3 → 0.7.0
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/index.ts +6 -6
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -59,12 +59,12 @@ declare global {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
type PageContext = {
|
|
62
|
-
params: Record<string,
|
|
62
|
+
params: Record<string, any>;
|
|
63
63
|
query: Record<string, string>;
|
|
64
64
|
request?: Request;
|
|
65
65
|
};
|
|
66
66
|
|
|
67
|
-
type PageProps<T extends Record<string,
|
|
67
|
+
type PageProps<T extends Record<string, any> = {}> = {
|
|
68
68
|
context?: PageContext & { params: T };
|
|
69
69
|
children?: VNode;
|
|
70
70
|
};
|
|
@@ -129,7 +129,7 @@ const urlToBasePath = (url: URL): string => {
|
|
|
129
129
|
* Creates a context object for passing data to layout/page components
|
|
130
130
|
*/
|
|
131
131
|
interface PageContext {
|
|
132
|
-
params: Record<string,
|
|
132
|
+
params: Record<string, any>;
|
|
133
133
|
query: Record<string, string>;
|
|
134
134
|
request?: Request;
|
|
135
135
|
}
|
|
@@ -168,11 +168,11 @@ const findRouteSegments = (entries: string[]): { [key: string]: string } => {
|
|
|
168
168
|
const resolvePath = async (
|
|
169
169
|
urlSegments: string[],
|
|
170
170
|
currentPath: string = PAGES_DIR,
|
|
171
|
-
params: Record<string,
|
|
171
|
+
params: Record<string, any> = {},
|
|
172
172
|
layouts: Array<{ path: string; component?: any }> = [],
|
|
173
173
|
): Promise<{
|
|
174
174
|
pagePath: string | null;
|
|
175
|
-
params: Record<string,
|
|
175
|
+
params: Record<string, any>;
|
|
176
176
|
layouts: Array<{ path: string }>;
|
|
177
177
|
} | null> => {
|
|
178
178
|
// Check for layout at current level
|
|
@@ -443,7 +443,7 @@ class Rev {
|
|
|
443
443
|
}
|
|
444
444
|
|
|
445
445
|
export default Rev;
|
|
446
|
-
export type { RevConfig, PageContext };
|
|
446
|
+
export type { RevConfig, PageContext, PageProps };
|
|
447
447
|
export { Fragment, h } from "preact";
|
|
448
448
|
|
|
449
449
|
//#endregion
|