Skip to content

Commit

Permalink
chore: update preact
Browse files Browse the repository at this point in the history
  • Loading branch information
ynwd committed Nov 29, 2024
1 parent 56cded2 commit d6307d1
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
- uses: denoland/setup-deno@v2
with:
deno-version: 2.1.1
deno-version: 2.1.2

- name: Install Oha
uses: baptiste0928/cargo-install@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

- uses: denoland/setup-deno@v2
with:
deno-version: 2.1.1
deno-version: 2.1.2

- name: Run tests
run: GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} deno task test
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

- uses: denoland/setup-deno@v2
with:
deno-version: 2.1.1
deno-version: 2.1.2

- run: deno lint --unstable-kv core
- run: deno lint --unstable-kv examples
Expand Down
7 changes: 4 additions & 3 deletions core/render/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
h,
JSX,
renderToString,
renderToStringAsync,
// renderToStringAsync,
VNode,
} from "../server/deps.ts";
Expand Down Expand Up @@ -118,7 +119,7 @@ es.onmessage = function(e) {
return layout;
};

render = <T = any>(
render = async <T = any>(
key: string,
p: Page,
data: T,
Expand All @@ -143,10 +144,10 @@ es.onmessage = function(e) {
nonce,
);
}
const html = "<!DOCTYPE html>" + renderToString(app);
const html = "<!DOCTYPE html>" + await renderToStringAsync(app);
const headers = hdr ? hdr : new Headers({
"content-type": "text/html",
"x-request-id": new Date().getTime().toString(),
"x-request-id": Date.now().toString(),
"Content-Security-Policy":
`script-src 'self' 'unsafe-inline' 'nonce-${nonce}' https: http: ; object-src 'none'; base-uri 'none';`,
});
Expand Down
6 changes: 3 additions & 3 deletions core/server/deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ export * from "jsr:@std/path@^1.0.1";
export { encodeHex } from "jsr:@std/encoding@^1.0.5/hex";
export { assert, assertEquals, assertExists } from "jsr:@std/assert@^1.0.6";

export { h } from "https://esm.sh/preact@10.24.3";
export { h } from "https://esm.sh/preact@10.25.0";
export type {
ComponentChild,
ComponentChildren,
JSX,
VNode,
} from "https://esm.sh/preact@10.24.3";
} from "https://esm.sh/preact@10.25.0";
export {
renderToString,
renderToStringAsync,
} from "https://esm.sh/[email protected].9?deps=preact@10.24.3";
} from "https://esm.sh/[email protected].11?deps=preact@10.25.0";
4 changes: 2 additions & 2 deletions core/server/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -399,11 +399,11 @@ if (root) fetchProps(root);
ctx.kv = this.serverOptions["kv"];
ctx.options = this.serverOptions;
ctx.stores = this.stores;
ctx.render = <T>(data: T, headers?: Headers) => {
ctx.render = async <T>(data: T, headers?: Headers) => {
const r = new Render(this);
key = key === "/" ? "" : key;
key = url.origin + "/__/props" + key;
return r.render(key, page, data, this.getNonce(), headers);
return await r.render(key, page, data, this.getNonce(), headers);
};
ctx.send = <T>(data: T, status = 200, headers?: Headers) => {
return createResponse(data, status, headers);
Expand Down
4 changes: 2 additions & 2 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
},
"imports": {
"@app/": "./",
"preact": "https://esm.sh/preact@10.24.3",
"preact/": "https://esm.sh/preact@10.24.3/"
"preact": "https://esm.sh/preact@10.25.0",
"preact/": "https://esm.sh/preact@10.25.0/"
},
"compilerOptions": {
"jsx": "react-jsx",
Expand Down

0 comments on commit d6307d1

Please sign in to comment.