This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.use( | |
'/', | |
reactRenderer(({ children }) => { | |
return ( | |
<html lang="en"> | |
<head> | |
<meta charSet="UTF-8" /> | |
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Vite + React TS</title> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ServerResponse } from 'node:http' | |
function ssrHotReload(): Plugin { | |
return { | |
name: 'vite-plugin-ssr-hot-reload', | |
apply: 'serve', | |
configureServer(server) { | |
const injectScript = `<script type="module" src="/@vite/client"></script>` | |
server.middlewares.use((req, res, next) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createRoute } from 'honox/factory' | |
import { Suspense } from 'hono/jsx' | |
import { getContext } from 'hono/context-storage' | |
export const getData = async (userId: string | undefined) => { | |
await new Promise((resolve) => setTimeout(resolve, 1000)) | |
if (!userId) { | |
return undefined | |
} | |
const userData = getContext().var.db.getUser(userId) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Hono } from 'hono' | |
import { streamText } from 'hono/streaming' | |
type Env = { | |
Bindings: { | |
AI: Ai | |
} | |
} | |
const app = new Hono<Env>() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Hono } from 'hono' | |
import { streamText } from 'hono/streaming' | |
type Env = { | |
Bindings: { | |
AI: Ai | |
} | |
} | |
const app = new Hono<Env>() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/types.ts b/src/types.ts | |
index 193f73ad..4225be41 100644 | |
--- a/src/types.ts | |
+++ b/src/types.ts | |
@@ -1984,9 +1984,9 @@ export type ExtractSchema<T> = UnionToIntersection< | |
T extends HonoBase<infer _, infer S, any> ? S : never | |
> | |
-type EnvOrEmpty<T> = T extends Env ? (Env extends T ? {} : T) : T | |
+type ProcessHead<T> = IfAnyThenEmptyObject<T extends Env ? (Env extends T ? {} : T) : T> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Hono } from 'hono' | |
import type { Context } from 'hono' | |
interface ProxyFetch { | |
( | |
c: Context, | |
input: RequestInfo | URL, | |
modifyRequest: (req: Request) => void | undefined, | |
modifyResponse: (res: Response) => void | undefined | |
): Promise<Response> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import type { EntryContext } from "@remix-run/cloudflare"; | |
import { renderToReadableStream } from "react-dom/server"; | |
import { Hono } from "hono"; | |
import { RemixServer } from "@remix-run/react"; | |
export const handle = | |
(userApp?: Hono) => | |
( | |
request: Request, | |
responseStatusCode: number, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Hono } from 'hono' | |
import { Suspense } from 'hono/jsx' | |
import { jsxRenderer } from 'hono/jsx-renderer' | |
const app = new Hono() | |
app.get( | |
'*', | |
jsxRenderer( | |
({ children }) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { heapStats } from 'bun:jsc' | |
export default { | |
fetch: () => { | |
console.log(heapStats()['objectTypeCounts']['Error']) | |
return new Response('Hi') | |
} | |
} |
NewerOlder