Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
".": "./src/mod.ts",
"./runtime": "./src/runtime/shared.ts",
"./dev": "./src/dev/mod.ts",
"./compat": "./src/compat/mod.ts"
"./compat": "./src/compat.ts"
},
"tasks": {
"test": "deno test -A --parallel src/ init/ update/ && deno test -A tests/ www/main_test.ts",
Expand Down
4 changes: 4 additions & 0 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 12 additions & 12 deletions src/compat/server.ts → src/compat.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
import type { VNode } from "preact";
import type { FreshContext } from "../context.ts";
import type { HandlerFn, RouteHandler } from "../handlers.ts";
import type { FreshContext } from "./context.ts";
import type { HandlerFn, RouteHandler } from "./handlers.ts";

/**
* @deprecated Use {@link PageProps} instead.
* @deprecated Use {@linkcode PageProps} instead.
*/
export type AppProps<_Data = unknown, T = unknown> = FreshContext<T>;
/**
* @deprecated Use {@link PageProps} instead.
* @deprecated Use {@linkcode PageProps} instead.
*/
export type LayoutProps<_Data = unknown, T = unknown> = FreshContext<T>;
/**
* @deprecated Use {@link PageProps} instead.
* @deprecated Use {@linkcode PageProps} instead.
*/
export type UnknownPageProps<_Data = unknown, T = unknown> = FreshContext<T>;
/**
* @deprecated Use {@link PageProps} instead.
* @deprecated Use {@linkcode PageProps} instead.
*/
export type ErrorPageProps<_Data = unknown, T = unknown> = FreshContext<T>;

/**
* @deprecated Use {@link FreshContext} instead.
* @deprecated Use {@linkcode FreshContext} instead.
*/
export type RouteContext<_T = never, S = Record<string, unknown>> =
FreshContext<S>;

/**
* @deprecated Use {@link RouteHandler} instead.
* @deprecated Use {@linkcode RouteHandler} instead.
*/
// deno-lint-ignore no-explicit-any
export type Handlers<T = any, State = Record<string, unknown>> = RouteHandler<
Expand All @@ -35,7 +35,7 @@ export type Handlers<T = any, State = Record<string, unknown>> = RouteHandler<
>;

/**
* @deprecated Use {@link HandlerFn} instead.
* @deprecated Use {@linkcode HandlerFn} instead.
*/
// deno-lint-ignore no-explicit-any
export type Handler<T = any, State = Record<string, unknown>> = HandlerFn<
Expand All @@ -54,14 +54,14 @@ function defineFn<State>(
}

/**
* @deprecated Use {@link [../mod.ts].Define.page|define.page} instead.
* @deprecated Use {@linkcode [./mod.ts].Define.page|define.page} instead.
*/
export const defineApp = defineFn;
/**
* @deprecated Use {@link [../mod.ts].Define.page|define.page} instead.
* @deprecated Use {@linkcode [./mod.ts].Define.page|define.page} instead.
*/
export const defineRoute = defineFn;
/**
* @deprecated Use {@link [../mod.ts].Define.page|define.page} instead.
* @deprecated Use {@linkcode [./mod.ts].Define.page|define.page} instead.
*/
export const defineLayout = defineFn;
13 changes: 0 additions & 13 deletions src/compat/mod.ts

This file was deleted.

22 changes: 6 additions & 16 deletions www/routes/docs/index.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
import type { Handlers } from "fresh/compat";
import { define } from "../../utils/state.ts";

export const handler: Handlers<void> = {
export const handler = define.handlers({
GET(ctx) {
const slug = ctx.params.slug;

if (slug === "concepts/architechture") {
return new Response("", {
status: 307,
headers: { location: "/docs/concepts/architecture" },
});
}

return new Response("", {
status: 307,
headers: { location: "/docs/introduction" },
});
return ctx.url.pathname === "/concepts/architechture"
? ctx.redirect("/docs/concepts/architecture")
: ctx.redirect("/docs/introduction");
},
};
});
Loading