From f9f012528249fd92774fd9e247f045832b3a8ebc Mon Sep 17 00:00:00 2001 From: Luca Casonato Date: Mon, 23 May 2022 15:52:29 +0200 Subject: [PATCH] chore: rename `PageConfig` to `RouteConfig` (#202) --- src/runtime/types.ts | 4 ++-- src/server/types.ts | 8 ++++---- tests/fixture/routes/books/[id].tsx | 4 ++-- tests/fixture/routes/params.tsx | 4 ++-- tests/fixture/routes/wildcard.tsx | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/runtime/types.ts b/src/runtime/types.ts index 31c0c235..a2aec7cd 100644 --- a/src/runtime/types.ts +++ b/src/runtime/types.ts @@ -51,7 +51,7 @@ export interface ErrorPageProps { error: unknown; } -export interface PageConfig { +export interface RouteConfig { /** * A route override for the page. This is useful for pages where the route * 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 * 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 - * using `useCSP` hook. + * using the `useCSP` hook. */ csp?: boolean; } diff --git a/src/server/types.ts b/src/server/types.ts index c98145b6..fc3f7793 100644 --- a/src/server/types.ts +++ b/src/server/types.ts @@ -3,8 +3,8 @@ import { ConnInfo, router, ServeInit } from "./deps.ts"; import { AppProps, ErrorPageProps, - PageConfig, PageProps, + RouteConfig, UnknownPageProps, } from "../runtime/types.ts"; import { RenderContext, RenderFn } from "./render.tsx"; @@ -19,19 +19,19 @@ export interface PageModule { default?: ComponentType; // deno-lint-ignore no-explicit-any handler?: Handler | Handlers; - config?: PageConfig; + config?: RouteConfig; } export interface UnknownPageModule { default?: ComponentType; handler?: UnknownHandler; - config?: PageConfig; + config?: RouteConfig; } export interface ErrorPageModule { default?: ComponentType; handler?: ErrorHandler; - config?: PageConfig; + config?: RouteConfig; } export interface IslandModule { diff --git a/tests/fixture/routes/books/[id].tsx b/tests/fixture/routes/books/[id].tsx index b8cf6064..f20dc527 100644 --- a/tests/fixture/routes/books/[id].tsx +++ b/tests/fixture/routes/books/[id].tsx @@ -1,11 +1,11 @@ /** @jsx h */ -import { h, PageConfig, PageProps } from "../../client_deps.ts"; +import { h, PageProps, RouteConfig } from "../../client_deps.ts"; export default function Page(props: PageProps) { return
Book {props.params.id}
; } -export const config: PageConfig = { +export const config: RouteConfig = { routeOverride: "/books/:id(\\d+)", }; diff --git a/tests/fixture/routes/params.tsx b/tests/fixture/routes/params.tsx index c6481406..c624fc5b 100644 --- a/tests/fixture/routes/params.tsx +++ b/tests/fixture/routes/params.tsx @@ -1,6 +1,6 @@ /** @jsx h */ -import { h, PageConfig } from "../client_deps.ts"; +import { h, RouteConfig } from "../client_deps.ts"; import { HandlerContext } from "../../../server.ts"; export const handler = { @@ -9,6 +9,6 @@ export const handler = { }, }; -export const config: PageConfig = { +export const config: RouteConfig = { routeOverride: "/params/:path*", }; diff --git a/tests/fixture/routes/wildcard.tsx b/tests/fixture/routes/wildcard.tsx index 81cf6865..7c898da2 100644 --- a/tests/fixture/routes/wildcard.tsx +++ b/tests/fixture/routes/wildcard.tsx @@ -1,6 +1,6 @@ /** @jsx h */ -import { h, PageConfig, PageProps } from "../client_deps.ts"; +import { h, PageProps, RouteConfig } from "../client_deps.ts"; export default function WildcardPage({ params }: PageProps) { 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*", };