0
0
mirror of https://github.com/honojs/hono.git synced 2024-11-29 17:46:30 +01:00

chore: denoify

This commit is contained in:
Yusuke Wada 2022-07-10 18:50:36 +09:00
parent 8893e5c92c
commit 3f5c725435
3 changed files with 4 additions and 5 deletions

View File

@ -4,8 +4,7 @@ import { isAbsoluteURL } from './utils/url.ts'
type Headers = Record<string, string>
export type Data = string | ArrayBuffer | ReadableStream
export type Env = Record<string, any>
type Env = Record<string, any>
export class Context<RequestParamKeyType extends string = string, E = Env> {
req: Request<RequestParamKeyType>

View File

@ -1,12 +1,12 @@
import { compose } from './compose.ts'
import { Context } from './context.ts'
import type { Env } from './context.ts'
import { extendRequestPrototype } from './request.ts'
import type { Router } from './router.ts'
import { METHOD_NAME_ALL, METHOD_NAME_ALL_LOWERCASE } from './router.ts'
import { TrieRouter } from './router/trie-router/index.ts' // Default Router
import { getPathFromURL, mergePath } from './utils/url.ts'
type Env = Record<string, any>
export type Handler<RequestParamKeyType extends string = string, E = Env> = (
c: Context<RequestParamKeyType, E>,
next: Next

View File

@ -1,4 +1,4 @@
import type { Context, Env } from '../../context.ts'
import type { Context } from '../../context.ts'
import type { Handler, Next } from '../../hono.ts'
import { getContentFromKVAsset } from '../../utils/cloudflare.ts'
import { getFilePath } from '../../utils/filepath.ts'
@ -14,7 +14,7 @@ export type ServeStaticOptions = {
const DEFAULT_DOCUMENT = 'index.html'
// This middleware is available only on Cloudflare Workers.
export const serveStatic = (options: ServeStaticOptions = { root: '' }): Handler<string, Env> => {
export const serveStatic = (options: ServeStaticOptions = { root: '' }): Handler => {
return async (c: Context, next: Next): Promise<Response | undefined> => {
// Do nothing if Response is already set
if (c.res && c.finalized) {