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 { count, desc, eq } from 'drizzle-orm' | |
import { createForm } from 'hono/action' | |
import { showRoutes } from 'hono/dev' | |
import { likes, posts } from '../db/schema' | |
import adminApp from './admin/index' | |
import { factory } from './factory' | |
import { useRequestContext } from 'hono/jsx-renderer' | |
const app = factory.createApp() | |
app.route('/', adminApp) |
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 { count, desc, eq } from 'drizzle-orm' | |
import { createAction } from 'hono/action' | |
import { showRoutes } from 'hono/dev' | |
import { likes, posts } from '../db/schema' | |
import adminApp from './admin/index' | |
import { factory } from './factory' | |
import { useRequestContext } from 'hono/jsx-renderer' | |
const app = factory.createApp() | |
app.route('/', adminApp) |
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 { createAction } from './types' | |
const app = new Hono() | |
const [action, Component] = createAction(app, (data) => { | |
if (data) { | |
return <p>Your name is {data.name}!</p> | |
} | |
return <p>Input your name</p> |
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 { defineConfig } from 'vite' | |
import glob from 'glob' | |
import { terser } from 'rollup-plugin-terser' | |
const entryPoints = glob.sync('./src/**/*.ts', { | |
ignore: ['./src/**/*.test.ts', './src/test-utils/**/*.ts', './src/deno/**/*.ts'], | |
}) | |
export default defineConfig({ | |
build: { |
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
{ | |
"name": "@hono/do-not-use-this", | |
"version": "0.0.1-1", | |
"compilerOptions": { | |
"lib": [ | |
"dom", | |
"dom.iterable", | |
"deno.ns" | |
], | |
"jsx": "react", |
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 { render } from 'hono/jsx/dom' | |
import { hc } from 'hono/client' | |
import api from './api' | |
import useSWR from 'swr' | |
const client = hc<typeof api>('/api') | |
function App() { | |
const $get = client.index.$get |
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
/* eslint-disable @typescript-eslint/no-explicit-any */ | |
import { Hono } from '../../hono' | |
import type { Env, H, HandlerResponse, Input, MiddlewareHandler } from '../../types' | |
type InitApp<E extends Env = Env> = (app: Hono<E>) => void | |
interface CreateHandlersInterface<E extends Env, P extends string> { | |
<I extends Input = {}, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>): [ | |
H<E, P, I, R> | |
] |
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 { Plugin } from 'vite' | |
import path from 'path' | |
import { parse } from '@babel/parser' | |
import _traverse, { NodePath } from '@babel/traverse' | |
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | |
// @ts-ignore | |
const traverse = (_traverse.default as typeof _traverse) ?? _traverse | |
import _generate from '@babel/generator' | |
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | |
// @ts-ignore |
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 { AsyncLocalStorage } from 'node:async_hooks' | |
const useStorage = <E extends unknown>() => { | |
const localStorage = new AsyncLocalStorage() | |
return { | |
store: <T>(env: E, callback: () => T): T => { | |
return localStorage.run(env, callback) | |
}, | |
get: (key: keyof E) => { | |
const store = localStorage.getStore() as E |
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 { getPlatformProxy } from 'wrangler' | |
const { env, dispose } = await getPlatformProxy() | |
console.log(env.AI) // undefined ! | |
await dispose() | |
// node ./get-platform-proxy-with-ai.mjs |
NewerOlder