Skip to content

Commit

Permalink
docs: add module doc (#2796)
Browse files Browse the repository at this point in the history
  • Loading branch information
yusukebe authored May 26, 2024
1 parent f53e3b2 commit 6d9f1f0
Show file tree
Hide file tree
Showing 77 changed files with 411 additions and 15 deletions.
5 changes: 5 additions & 0 deletions src/adapter/aws-lambda/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @module
* AWS Lambda Adapter for Hono.
*/

export { handle, streamHandle } from './handler'
export type { APIGatewayProxyResult, LambdaEvent } from './handler'
export type {
Expand Down
5 changes: 5 additions & 0 deletions src/adapter/bun/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @module
* Bun Adapter for Hono.
*/

export { serveStatic } from './serve-static'
export { bunFileSystemModule, toSSG } from './ssg'
export { createBunWebSocket } from './websocket'
Expand Down
5 changes: 5 additions & 0 deletions src/adapter/cloudflare-pages/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
/**
* @module
* Cloudflare Pages Adapter for Hono.
*/

export { handle, serveStatic } from './handler'
export type { EventContext } from './handler'
5 changes: 5 additions & 0 deletions src/adapter/cloudflare-workers/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
/**
* @module
* Cloudflare Workers Adapter for Hono.
*/

export { serveStatic } from './serve-static-module'
export { upgradeWebSocket } from './websocket'
5 changes: 5 additions & 0 deletions src/adapter/deno/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @module
* Deno Adapter for Hono.
*/

export { serveStatic } from './serve-static'
export { toSSG, denoFileSystemModule } from './ssg'
export { upgradeWebSocket } from './websocket'
Expand Down
5 changes: 5 additions & 0 deletions src/adapter/lambda-edge/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @module
* Lambda@Edge Adapter for Hono.
*/

export { handle } from './handler'
export type {
Callback,
Expand Down
5 changes: 5 additions & 0 deletions src/adapter/netlify/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
/**
* @module
* Netlify Adapter for Hono.
*/

export * from './mod'
5 changes: 5 additions & 0 deletions src/adapter/vercel/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
/**
* @module
* Vercel Adapter for Hono.
*/

export { handle } from './handler'
5 changes: 5 additions & 0 deletions src/client/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @module
* The HTTP Client for Hono.
*/

export { hc } from './client'
export type {
InferResponseType,
Expand Down
5 changes: 5 additions & 0 deletions src/helper/accepts/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
/**
* @module
* Accepts Helper for Hono.
*/

export { accepts } from './accepts'
5 changes: 5 additions & 0 deletions src/helper/adapter/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @module
* Adapter Helper for Hono.
*/

import type { Context } from '../../context'

export type Runtime = 'node' | 'deno' | 'bun' | 'workerd' | 'fastly' | 'edge-light' | 'other'
Expand Down
5 changes: 5 additions & 0 deletions src/helper/conninfo/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @module
* ConnInfo Helper for Hono.
*/

import type { Context } from '../../context'

export type AddressType = 'IPv6' | 'IPv4' | 'unknown'
Expand Down
5 changes: 5 additions & 0 deletions src/helper/cookie/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @module
* Cookie Helper for Hono.
*/

import type { Context } from '../../context'
import { parse, parseSigned, serialize, serializeSigned } from '../../utils/cookie'
import type { Cookie, CookieOptions, CookiePrefixOptions, SignedCookie } from '../../utils/cookie'
Expand Down
5 changes: 5 additions & 0 deletions src/helper/css/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @module
* css Helper for Hono.
*/

import { raw } from '../../helper/html'
import { DOM_RENDERER } from '../../jsx/constants'
import { createCssJsxDomObjects } from '../../jsx/dom/css'
Expand Down
5 changes: 5 additions & 0 deletions src/helper/dev/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @module
* Dev Helper for Hono.
*/

import type { Hono } from '../../hono'
import type { Env, RouterRoute } from '../../types'
import { getColorEnabled } from '../../utils/color'
Expand Down
5 changes: 5 additions & 0 deletions src/helper/factory/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @module
* Factory Helper for Hono.
*/

/* eslint-disable @typescript-eslint/no-explicit-any */
import { Hono } from '../../hono'
import type { Env, H, HandlerResponse, Input, MiddlewareHandler } from '../../types'
Expand Down
5 changes: 5 additions & 0 deletions src/helper/html/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @module
* html Helper for Hono.
*/

import { escapeToBuffer, raw, stringBufferToString } from '../../utils/html'
import type { HtmlEscaped, HtmlEscapedString, StringBuffer } from '../../utils/html'

Expand Down
5 changes: 5 additions & 0 deletions src/helper/ssg/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @module
* SSG Helper for Hono.
*/

export * from './ssg'
export {
X_HONO_DISABLE_SSG_HEADER_KEY,
Expand Down
5 changes: 5 additions & 0 deletions src/helper/streaming/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @module
* Streaming Helper for Hono.
*/

export { stream } from './stream'
export type { SSEMessage } from './sse'
export { streamSSE, SSEStreamingApi } from './sse'
Expand Down
5 changes: 5 additions & 0 deletions src/helper/testing/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @module
* Testing Helper for Hono.
*/

import { hc } from '../../client'
import type { Client } from '../../client/types'
import type { ExecutionContext } from '../../context'
Expand Down
5 changes: 5 additions & 0 deletions src/helper/websocket/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @module
* WebSocket Helper for Hono.
*/

/* eslint-disable @typescript-eslint/no-explicit-any */
import type { Context } from '../../context'
import type { MiddlewareHandler } from '../../types'
Expand Down
5 changes: 5 additions & 0 deletions src/hono-base.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @module
* This module is the base module for the Hono object.
*/

/* eslint-disable @typescript-eslint/no-explicit-any */
import { compose } from './compose'
import { Context } from './context'
Expand Down
5 changes: 5 additions & 0 deletions src/http-exception.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @module
* This module provides the `HTTPException` class.
*/

import type { StatusCode } from './utils/http-status'

type HTTPExceptionOptions = {
Expand Down
16 changes: 16 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/**
* @module
*
* Hono - Web Framework built on Web Standards
*
* @example
* ```ts
* import { Hono } from 'hono'
* const app = new Hono()
*
* app.get('/', (c) => c.text('Hono!'))
*
* export default app
* ```
*/

import { Hono } from './hono'
export type {
Env,
Expand Down
5 changes: 5 additions & 0 deletions src/jsx/dom/css.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @module
* This module provides APIs that enable `hono/jsx/dom` to support.
*/

import type { FC, PropsWithChildren } from '../'
import type { CssClassName, CssVariableType } from '../../helper/css/common'
import {
Expand Down
5 changes: 5 additions & 0 deletions src/jsx/dom/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @module
* This module provides APIs for `hono/jsx/dom`.
*/

import { isValidElement, memo } from '../base'
import type { Child, DOMAttributes, JSX, JSXNode, Props } from '../base'
import { Children } from '../children'
Expand Down
5 changes: 5 additions & 0 deletions src/jsx/dom/jsx-dev-runtime.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @module
* This module provides the `hono/jsx/dom` dev runtime.
*/

import type { JSXNode, Props } from '../base'
import { normalizeIntrinsicElementProps } from '../utils'
import { newJSXNode } from './utils'
Expand Down
5 changes: 5 additions & 0 deletions src/jsx/dom/jsx-runtime.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
/**
* @module
* This module provides the `hono/jsx/dom` runtime.
*/

export { jsxDEV as jsx, Fragment } from './jsx-dev-runtime'
export { jsxDEV as jsxs } from './jsx-dev-runtime'
5 changes: 5 additions & 0 deletions src/jsx/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @module
* JSX for Hono.
*/

import { Fragment, cloneElement, isValidElement, jsx, memo } from './base'
import type { DOMAttributes } from './base'
import { Children } from './children'
Expand Down
5 changes: 5 additions & 0 deletions src/jsx/jsx-dev-runtime.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @module
* This module provides Hono's JSX dev runtime.
*/

import type { HtmlEscapedString } from '../utils/html'
import { jsxFn } from './base'
import type { JSXNode } from './base'
Expand Down
5 changes: 5 additions & 0 deletions src/jsx/jsx-runtime.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @module
* This module provides Hono's JSX runtime.
*/

export { jsxDEV as jsx, Fragment } from './jsx-dev-runtime'
export { jsxDEV as jsxs } from './jsx-dev-runtime'
export type { JSX } from './jsx-dev-runtime'
Expand Down
5 changes: 5 additions & 0 deletions src/jsx/streaming.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @module
* This module enables JSX to supports streaming Response.
*/

import { raw } from '../helper/html'
import { HtmlEscapedCallbackPhase, resolveCallback } from '../utils/html'
import type { HtmlEscapedString } from '../utils/html'
Expand Down
7 changes: 6 additions & 1 deletion src/middleware/basic-auth/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @module
* Basic Auth Middleware for Hono.
*/

import type { Context } from '../../context'
import { HTTPException } from '../../http-exception'
import type { HonoRequest } from '../../request'
Expand Down Expand Up @@ -41,7 +46,7 @@ type BasicAuthOptions =
}

/**
* Basic authentication middleware for Hono.
* Basic Auth Middleware for Hono.
*
* @see {@link https://hono.dev/middleware/builtin/basic-auth}
*
Expand Down
7 changes: 6 additions & 1 deletion src/middleware/bearer-auth/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @module
* Bearer Auth Middleware for Hono.
*/

import type { Context } from '../../context'
import { HTTPException } from '../../http-exception'
import type { MiddlewareHandler } from '../../types'
Expand All @@ -24,7 +29,7 @@ type BearerAuthOptions =
}

/**
* Bearer authentication middleware for Hono.
* Bearer Auth Middleware for Hono.
*
* @see {@link https://hono.dev/middleware/builtin/bearer-auth}
*
Expand Down
7 changes: 6 additions & 1 deletion src/middleware/body-limit/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @module
* Body Limit Middleware for Hono.
*/

import type { Context } from '../../context'
import { HTTPException } from '../../http-exception'
import type { MiddlewareHandler } from '../../types'
Expand All @@ -18,7 +23,7 @@ class BodyLimitError extends Error {
}

/**
* Body limit middleware for Hono.
* Body Limit Middleware for Hono.
*
* @see {@link https://hono.dev/middleware/builtin/body-limit}
*
Expand Down
7 changes: 6 additions & 1 deletion src/middleware/cache/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
/**
* @module
* Cache Middleware for Hono.
*/

import type { Context } from '../../context'
import type { MiddlewareHandler } from '../../types'

/**
* cache middleware for Hono.
* Cache Middleware for Hono.
*
* @see {@link https://hono.dev/middleware/builtin/cache}
*
Expand Down
7 changes: 6 additions & 1 deletion src/middleware/compress/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @module
* Compress Middleware for Hono.
*/

import type { MiddlewareHandler } from '../../types'

const ENCODING_TYPES = ['gzip', 'deflate'] as const
Expand All @@ -7,7 +12,7 @@ interface CompressionOptions {
}

/**
* Compress middleware for Hono.
* Compress Middleware for Hono.
*
* @see {@link https://hono.dev/middleware/builtin/compress}
*
Expand Down
7 changes: 6 additions & 1 deletion src/middleware/cors/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @module
* CORS Middleware for Hono.
*/

import type { Context } from '../../context'
import type { MiddlewareHandler } from '../../types'

Expand All @@ -11,7 +16,7 @@ type CORSOptions = {
}

/**
* CORS middleware for Hono.
* CORS Middleware for Hono.
*
* @see {@link https://hono.dev/middleware/builtin/cors}
*
Expand Down
Loading

0 comments on commit 6d9f1f0

Please sign in to comment.