major: import Fresh 2.0 code (#2449)

🎉
This commit is contained in:
Marvin Hagemeister
2024-05-24 09:40:08 +02:00
committed by GitHub
parent 990357629e
commit 287929e4d2
958 changed files with 15794 additions and 28287 deletions
+59
View File
@@ -0,0 +1,59 @@
import type { VNode } from "preact";
import type { FreshContext } from "../context.ts";
import type { HandlerByMethod } from "../handlers.ts";
/**
* @deprecated Use {@link FreshContext} instead
*/
export type AppProps<Data = unknown, T = unknown> = FreshContext<Data, T>;
/**
* @deprecated Use {@link FreshContext} instead
*/
export type LayoutProps<Data = unknown, T = unknown> = FreshContext<Data, T>;
/**
* @deprecated Use {@link FreshContext} instead
*/
export type UnknownPageProps<Data = unknown, T = unknown> = FreshContext<
Data,
T
>;
/**
* @deprecated Use {@link FreshContext} instead
*/
export type ErrorPageProps<Data = unknown, T = unknown> = FreshContext<Data, T>;
/**
* @deprecated Use {@link FreshContext} instead
*/
// deno-lint-ignore no-explicit-any
export type RouteContext<T = any, S = Record<string, unknown>> = FreshContext<
T,
S
>;
// deno-lint-ignore no-explicit-any
export type Handlers<T = any, State = Record<string, unknown>> =
HandlerByMethod<T, State>;
function defineFn<State>(
fn: (
ctx: FreshContext<unknown, State>,
) => Request | VNode | null | Promise<Request | VNode | null>,
): (
ctx: FreshContext<unknown, State>,
) => Request | VNode | null | Promise<Request | VNode | null> {
return fn;
}
/**
* @deprecated Use {@link definePage} instead
*/
export const defineApp = defineFn;
/**
* @deprecated Use {@link definePage} instead
*/
export const defineRoute = defineFn;
/**
* @deprecated Use {@link definePage} instead
*/
export const defineLayout = defineFn;