Skip to content

Commit 4391616

Browse files
committed
updated libs; simplifications
1 parent c4e788a commit 4391616

File tree

8 files changed

+66
-48
lines changed

8 files changed

+66
-48
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ deno task test
2929

3030
## Other platforms
3131

32-
Examples for Bun runtime: https://github.com/fullsoak/bun-example
32+
Examples for Bun runtime: https://github.com/fullsoak/bun-examples

deno.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"imports": {
3-
"fullsoak": "jsr:@fullsoak/fullsoak@0.6.0",
3+
"fullsoak": "jsr:@fullsoak/fullsoak@0.7.0",
44
"preact": "npm:[email protected]",
55
"preact-iso": "npm:[email protected]",
66
"@std/testing": "jsr:@std/testing@^1.0.9"

deno.lock

Lines changed: 29 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import {
22
type Context,
33
Controller,
4-
ControllerMethodArgs,
54
Get,
6-
getComponentJs,
75
setupDefaultFullsoakLogger,
86
ssr,
97
useFullSoak,
@@ -18,7 +16,7 @@ const GLOBAL_COMPONENTS_DIR: string = Deno.cwd() + "/src/components";
1816
@Controller()
1917
class MyController {
2018
@Get("/")
21-
renderDynamicallyImportedComponent() {
19+
simpleExample() {
2220
return ssr(MyComponent, { foo: "bar" });
2321
}
2422

@@ -28,19 +26,6 @@ class MyController {
2826
renderMyRouteAwareComponent(ctx: Context) {
2927
return ssr(MyRouteAwareComponent, { url: ctx.request.url.href });
3028
}
31-
32-
@Get("/components/:parentComponent/routes/:routeComponent")
33-
@ControllerMethodArgs("param")
34-
renderRouteComponent(
35-
param: { parentComponent: string; routeComponent: string },
36-
ctx: Context,
37-
) {
38-
ctx.response.headers.set("content-type", "text/javascript");
39-
const { parentComponent, routeComponent } = param;
40-
return getComponentJs(
41-
`${GLOBAL_COMPONENTS_DIR}/${parentComponent}/routes/${routeComponent}`,
42-
);
43-
}
4429
}
4530

4631
const port = Number(Deno.env.get("PORT") || 0) ?? 3991;

tests/MyTsxComponent.test.ts renamed to tests/MyComponent.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { ssr } from "fullsoak";
22
import { MyComponent } from "../src/components/MyComponent/index.tsx";
33
import { assertSnapshot } from "@std/testing/snapshot";
44

5-
Deno.test("MyTsxComponent", async (t) => {
5+
Deno.test("MyComponent", async (t) => {
66
const output = await ssr(MyComponent, { foo: "bar" });
77
await assertSnapshot(t, output);
88
});
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { ssr } from "fullsoak";
2+
import { assertSnapshot } from "@std/testing/snapshot";
3+
import { MyRouteAwareComponent } from "../src/components/MyRouteAwareComponent/index.tsx";
4+
5+
Deno.test("MyRouteAwareComponent", async (t) => {
6+
const output = await ssr(MyRouteAwareComponent, {
7+
url: "http://localhost/bar",
8+
});
9+
await assertSnapshot(t, output);
10+
});

tests/__snapshots__/MyTsxComponent.test.ts.snap renamed to tests/__snapshots__/MyComponent.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export const snapshot = {};
22

3-
snapshot[`MyTsxComponent 1`] = `
3+
snapshot[`MyComponent 1`] = `
44
'<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0"><title></title><script type="importmap">
55
{
66
"imports": {
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
export const snapshot = {};
2+
3+
snapshot[`MyRouteAwareComponent 1`] = `
4+
'<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0"><title></title><script type="importmap">
5+
{
6+
"imports": {
7+
"preact": "https://esm.sh/[email protected]",
8+
"preact/hooks": "https://esm.sh/[email protected]/hooks",
9+
"react": "https://esm.sh/[email protected]",
10+
"react/jsx-runtime": "https://esm.sh/[email protected]/jsx-runtime",
11+
"react-dom": "https://esm.sh/[email protected]/compat/",
12+
"react-dom/*": "https://esm.sh/[email protected]/compat/*",
13+
"htm/preact": "https://esm.sh/[email protected]/preact?external=preact",
14+
"preact-iso": "https://esm.sh/preact-iso?external=preact",
15+
"fullsoak/preact-iso": "https://esm.sh/preact-iso?external=preact",
16+
"@fullsoak/fullsoak/preact-iso": "https://esm.sh/preact-iso?external=preact",
17+
"fullsoak": "/fullsoak",
18+
"@fullsoak/fullsoak": "/fullsoak"
19+
}
20+
}
21+
</script><script type="text/javascript"></script><style></style></head><body><main id="main">,,[object Promise]</main><script type="text/javascript">window.preloadedProps = {"url":"http://localhost/bar"}</script><script type="module" src="/js/MyRouteAwareComponent/mount.js"></script></body></html>'
22+
`;

0 commit comments

Comments
 (0)