CodeVetter · Repo Unpack · Extension points
honojs/hono
Hono extends chiefly through handlers, middleware, injectable routers and explicit exported modules. Runtime bindings and adapters keep platform concerns outside core dispatch. Factory and validator APIs preserve types while allowing application-specific behavior. SSG has an explicit ordered plugin interface, and build plugins enforce distribution conventions.
- Custom routers implement Router<T> with name, add() and match(), then enter the default Hono through options.router.
- Custom getPath(request, {env}) can alter routing boundaries; strict mode controls selection of normal versus non-strict path extraction.
- Handler and MiddlewareHandler define Context/Next extension contracts; use() registers middleware with the ALL method.
- Factory.createApp() merges default app options and invokes initApp; createMiddleware() preserves middleware typing and createHandlers() collects defined handlers.
- validator() accepts an application validation function rather than prescribing a schema library, with runtime transformation and early-response behavior.
- mount() supports custom optionHandler and replaceRequest functions to bridge other frameworks and runtime argument conventions.
- The static-serving base accepts getContent, join and isDir implementations plus path rewriting, MIME overrides and found/not-found hooks.
- SSGPlugin exposes beforeRequestHook, afterResponseHook and afterGenerateHook, with single or multiple functions; FileSystemModule abstracts mkdir and writeFile.
- SSG plugin order is observable: redirectPlugin must precede defaultPlugin because the latter filters non-200 responses.
- hc() accepts a custom query builder, per-request/base options and injected WebSocket factory; proxy() separately supports customFetch.
- New adapters are workspace-discovered, separately versioned packages; maintainer instructions require corresponding deprecated src/adapter exports.
- Packaging plugins validate npm/JSR export-map parity and transform emitted declarations, including removal of private fields and appendExportEmptyToDts.