feat: expose config in context + simplify page props (#2102)

This commit is contained in:
Marvin Hagemeister
2023-11-30 16:11:31 +01:00
committed by GitHub
parent aafe048243
commit 9e11c5c56b
11 changed files with 254 additions and 123 deletions
@@ -1,10 +1,16 @@
import { RouteContext } from "../../../../server.ts";
import { delay } from "../../../deps.ts";
import { delay, relative, SEP } from "../../../deps.ts";
export default async function Foo(_req: Request, context: RouteContext) {
await delay(1);
const value = JSON.stringify(context, (_key, value) => {
const value = JSON.stringify(context, (key, value) => {
if (key === "outDir" || key == "staticDir") {
return relative(Deno.cwd(), value).split(SEP).join("/");
} else if (key === "entrypoints") {
return {};
}
if (typeof value === "function") return value.constructor.name;
if (value === undefined) return "<undefined>";
return value;
}, 2);