Changelog - 2026-11-08
A worker without controllers no longer bundles zod
Enhancement Breaking ChangeIn one line. A browser worker that declares no controller, and so no validated or OpenAPI route, no longer carries zod, zod-to-openapi or @hono/zod-openapi.
What changed
- Smaller worker. A minimal
WorkerApplicationbundles to 136,953 B (44,828 B gzipped) instead of 568,535 B (145,890 B gzipped), measured withbun build --target=browser --minify. - Routers are plain
Honountil the REST controller layer loads.RestApplicationno longer imports@hono/zod-openapi. Loading a REST controller (BaseRestController,AbstractRestController) registersOpenAPIHono, and from then on the application's two routers areOpenAPIHono, as before. A worker with controllers bundles the same as before and validates the same way. ServerApplicationis unchanged at run time. It overrides the new protectedcreateRouter({ strict })and always buildsOpenAPIHono, so the API reference keeps its registry.- A size limit.
worker-bundle-budget.test.tsin@venizia/ignis-workerfails when a minimal worker bundles zod, zod-to-openapi or@hono/zod-openapi, or grows past 56 KB gzipped or 170 KB raw.
Who is affected
- Server apps (
BaseApplication). No action needed. - Workers with controllers. No action needed: their routers are still
OpenAPIHonoat run time. - Code that calls
getServer()orgetRootRouter()on aRestApplicationorWorkerApplicationand uses.openapi(),.doc()or.openAPIRegistry. The return type is nowHono. See below.
Breaking changes
WARNING
The type of getServer() and getRootRouter() on RestApplication, WorkerApplication and IApplication is Hono, not OpenAPIHono.
Before:
typescript
class App extends WorkerApplication {
override setupMiddlewares(): void {
this.getRootRouter().doc('/doc', { openapi: '3.0.0', info: { title: 'x', version: '1' } });
}
}After:
typescript
import { OpenAPIHono } from '@hono/zod-openapi';
class App extends WorkerApplication {
declare protected rootRouter: OpenAPIHono;
// Always an OpenAPIHono, whether or not a controller is in the program.
protected override createRouter(opts: { strict: boolean }): OpenAPIHono {
return new OpenAPIHono({ strict: opts.strict });
}
override getRootRouter(): OpenAPIHono {
return this.rootRouter;
}
override setupMiddlewares(): void {
this.getRootRouter().doc('/doc', {
openapi: '3.0.0',
info: { title: 'x', version: '1' },
});
}
}Details
- A worker that never loads a REST controller but mounts its own
OpenAPIHonoongetServer()still works: Hono mounts any router. Only the root's own OpenAPI registry is missing. RouterFactoriesis internal and not exported.
| File | Package |
|---|---|
src/base/applications/rest.ts | kernel |
src/base/applications/router-factory.ts | kernel |
src/base/controllers/rest/abstract.ts | kernel |
src/base/applications/server.ts | core |