Skip to content

Commit d555fe9

Browse files
committed
ud
1 parent d68f164 commit d555fe9

File tree

4 files changed

+273
-512
lines changed

4 files changed

+273
-512
lines changed

apps/docs/package.json

+3-4
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@
1010
"preview": "vite preview"
1111
},
1212
"devDependencies": {
13-
"@robino/md": "^1.0.1",
14-
"domco": "^2.2.1",
13+
"@robino/md": "^1.0.3",
14+
"domco": "^2.3.0",
1515
"drab": "^5.4.2",
16-
"hono": "^4.6.15",
1716
"uico": "*",
18-
"vite": "^6.0.6"
17+
"vite": "^6.0.9"
1918
}
2019
}

apps/docs/src/server/+func.ts

+25-28
Original file line numberDiff line numberDiff line change
@@ -6,41 +6,38 @@ import theme from "@/content/theme.md?raw";
66
import { markdownProcessor } from "@/server/md";
77
import { html } from "client:page";
88
import { html as colorHtml } from "client:page/color-generator";
9-
import type { Prerender } from "domco";
9+
import type { Handler, Prerender } from "domco";
1010
import { Injector } from "domco/injector";
11-
import { Hono } from "hono";
1211

1312
export const prerender: Prerender = ["/", "/color-generator"];
1413

15-
const { html: baseHtml } = markdownProcessor.process(base);
16-
const { html: proseHtml } = markdownProcessor.process(prose);
17-
const { html: overviewHtml } = markdownProcessor.process(overview);
18-
const { html: themeHtml } = markdownProcessor.process(theme);
19-
const { html: colorMdHtml } = markdownProcessor.process(color);
14+
export const handler: Handler = (req) => {
15+
const { pathname } = new URL(req.url);
2016

21-
const app = new Hono();
17+
if (pathname === "/") {
18+
const { html: baseHtml } = markdownProcessor.process(base);
19+
const { html: proseHtml } = markdownProcessor.process(prose);
20+
const { html: overviewHtml } = markdownProcessor.process(overview);
21+
const { html: themeHtml } = markdownProcessor.process(theme);
2222

23-
app.get("/", async (c) => {
24-
const page = new Injector(html)
25-
.comment("prose", proseHtml)
26-
.comment("base", baseHtml)
27-
.comment("overview", overviewHtml)
28-
.comment("theme", themeHtml);
23+
const page = new Injector(html)
24+
.comment("prose", proseHtml)
25+
.comment("base", baseHtml)
26+
.comment("overview", overviewHtml)
27+
.comment("theme", themeHtml);
2928

30-
return c.html(page.toString());
31-
});
29+
return new Response(page.toString(), {
30+
headers: { "Content-Type": "text/html" },
31+
});
32+
} else if (pathname === "/color-generator") {
33+
const { html: colorMdHtml } = markdownProcessor.process(color);
3234

33-
app.get("/color-generator", async (c) => {
34-
const page = new Injector(colorHtml).comment("content", colorMdHtml);
35+
const page = new Injector(colorHtml).comment("content", colorMdHtml);
3536

36-
return c.html(page.toString());
37-
});
37+
return new Response(page.toString(), {
38+
headers: { "Content-Type": "text/html" },
39+
});
40+
}
3841

39-
// redirects from previous version
40-
app.get("/components/", (c) => c.redirect("/", 301));
41-
42-
app.get("/fonts/", (c) => c.redirect("/", 301));
43-
44-
app.get("/oklch/", (c) => c.redirect("/color-generator", 301));
45-
46-
export const handler = app.fetch;
42+
return new Response("Not found", { status: 404 });
43+
};

0 commit comments

Comments
 (0)