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
+16
View File
@@ -0,0 +1,16 @@
{
"lock": false,
"compilerOptions": {
"jsx": "precompile",
"jsxImportSource": "preact",
"jsxPrecompileSkipElements": ["a", "img", "source", "body", "html", "head"]
},
"imports": {
"@std/encoding": "jsr:@std/encoding@^0.224.0",
"@std/fmt": "jsr:@std/fmt@^0.224.0",
"@std/html": "jsr:@std/html@^0.224.0",
"@std/path": "jsr:@std/path@^0.224.0",
"preact": "npm:preact@^10.20.2",
"preact-render-to-string": "npm:preact-render-to-string@^6.4.2"
}
}
+30
View File
@@ -0,0 +1,30 @@
import { App } from "../../../src/app.ts";
const app = new App({ staticDir: "./static" }).get(
"/",
(ctx) =>
ctx.render(
<html>
<head>
<meta charset="utf-8" />
<title>foo</title>
</head>
<body>
<div f-client-nav>
<span f-client-nav={false}>
<p>false</p>
</span>
<a href="/">Home</a>
<img src="/foo.jpg" alt="" />
<picture>
<source src="/bar.jpg" />
</picture>
</div>
</body>
</html>,
),
);
const handler = await app.handler();
const res = await handler(new Request("http://localhost/"));
console.log(await res.text());