chore: rename PageConfig to RouteConfig (#202)
This commit is contained in:
@@ -51,7 +51,7 @@ export interface ErrorPageProps {
|
|||||||
error: unknown;
|
error: unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PageConfig {
|
export interface RouteConfig {
|
||||||
/**
|
/**
|
||||||
* A route override for the page. This is useful for pages where the route
|
* A route override for the page. This is useful for pages where the route
|
||||||
* can not be expressed through the filesystem routing capabilities.
|
* can not be expressed through the filesystem routing capabilities.
|
||||||
@@ -64,7 +64,7 @@ export interface PageConfig {
|
|||||||
* If Content-Security-Policy should be enabled for this page. If 'true', a
|
* If Content-Security-Policy should be enabled for this page. If 'true', a
|
||||||
* locked down policy will be used that allows only the scripts and styles
|
* locked down policy will be used that allows only the scripts and styles
|
||||||
* that are generated by fresh. Additional scripts and styles can be added
|
* that are generated by fresh. Additional scripts and styles can be added
|
||||||
* using `useCSP` hook.
|
* using the `useCSP` hook.
|
||||||
*/
|
*/
|
||||||
csp?: boolean;
|
csp?: boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -3,8 +3,8 @@ import { ConnInfo, router, ServeInit } from "./deps.ts";
|
|||||||
import {
|
import {
|
||||||
AppProps,
|
AppProps,
|
||||||
ErrorPageProps,
|
ErrorPageProps,
|
||||||
PageConfig,
|
|
||||||
PageProps,
|
PageProps,
|
||||||
|
RouteConfig,
|
||||||
UnknownPageProps,
|
UnknownPageProps,
|
||||||
} from "../runtime/types.ts";
|
} from "../runtime/types.ts";
|
||||||
import { RenderContext, RenderFn } from "./render.tsx";
|
import { RenderContext, RenderFn } from "./render.tsx";
|
||||||
@@ -19,19 +19,19 @@ export interface PageModule {
|
|||||||
default?: ComponentType<PageProps>;
|
default?: ComponentType<PageProps>;
|
||||||
// deno-lint-ignore no-explicit-any
|
// deno-lint-ignore no-explicit-any
|
||||||
handler?: Handler<any, any> | Handlers<any, any>;
|
handler?: Handler<any, any> | Handlers<any, any>;
|
||||||
config?: PageConfig;
|
config?: RouteConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface UnknownPageModule {
|
export interface UnknownPageModule {
|
||||||
default?: ComponentType<UnknownPageProps>;
|
default?: ComponentType<UnknownPageProps>;
|
||||||
handler?: UnknownHandler;
|
handler?: UnknownHandler;
|
||||||
config?: PageConfig;
|
config?: RouteConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ErrorPageModule {
|
export interface ErrorPageModule {
|
||||||
default?: ComponentType<ErrorPageProps>;
|
default?: ComponentType<ErrorPageProps>;
|
||||||
handler?: ErrorHandler;
|
handler?: ErrorHandler;
|
||||||
config?: PageConfig;
|
config?: RouteConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IslandModule {
|
export interface IslandModule {
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
/** @jsx h */
|
/** @jsx h */
|
||||||
|
|
||||||
import { h, PageConfig, PageProps } from "../../client_deps.ts";
|
import { h, PageProps, RouteConfig } from "../../client_deps.ts";
|
||||||
|
|
||||||
export default function Page(props: PageProps) {
|
export default function Page(props: PageProps) {
|
||||||
return <div>Book {props.params.id}</div>;
|
return <div>Book {props.params.id}</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const config: PageConfig = {
|
export const config: RouteConfig = {
|
||||||
routeOverride: "/books/:id(\\d+)",
|
routeOverride: "/books/:id(\\d+)",
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/** @jsx h */
|
/** @jsx h */
|
||||||
|
|
||||||
import { h, PageConfig } from "../client_deps.ts";
|
import { h, RouteConfig } from "../client_deps.ts";
|
||||||
import { HandlerContext } from "../../../server.ts";
|
import { HandlerContext } from "../../../server.ts";
|
||||||
|
|
||||||
export const handler = {
|
export const handler = {
|
||||||
@@ -9,6 +9,6 @@ export const handler = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const config: PageConfig = {
|
export const config: RouteConfig = {
|
||||||
routeOverride: "/params/:path*",
|
routeOverride: "/params/:path*",
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/** @jsx h */
|
/** @jsx h */
|
||||||
|
|
||||||
import { h, PageConfig, PageProps } from "../client_deps.ts";
|
import { h, PageProps, RouteConfig } from "../client_deps.ts";
|
||||||
|
|
||||||
export default function WildcardPage({ params }: PageProps) {
|
export default function WildcardPage({ params }: PageProps) {
|
||||||
if (typeof params.path === "string") {
|
if (typeof params.path === "string") {
|
||||||
@@ -10,6 +10,6 @@ export default function WildcardPage({ params }: PageProps) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const config: PageConfig = {
|
export const config: RouteConfig = {
|
||||||
routeOverride: "/foo/:path*",
|
routeOverride: "/foo/:path*",
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user