Latest Results
refactor: convert handler classes to plain functions
Replaces the Astro handler classes with plain functions that take the
pieces they actually need. The class wrappers carried state that was
either re-derived on each call (pipeline) or only used once per app
(the inner handlers instantiated in constructors). Flattening them to
functions removes a layer of indirection on the hot path and keeps the
handler modules easier to consume from outside (no constructor + bound
method dance).
- TrailingSlashHandler class -> trailingSlashHandler(app, request)
- AstroMiddleware class -> astroMiddlewareHandler(pipeline, ...)
- PagesHandler class -> pagesHandler(pipeline, ...)
- Rewrites class -> rewriteHandler(pipeline, renderContext, payload)
- ActionHandler class -> actionHandler(apiContext)
- I18n class -> i18nFinalize(i18n, base, trailingSlash, format, request,
response, ctx), with a per-manifest router cache via WeakMap so we
don't rebuild the I18nRouter on every call
- AstroHandler class -> astroHandler(app, request) + private
astroRenderState helper. Redirect check stays inlined.
- DefaultFetchHandler class -> createDefaultFetchHandler(app) factory
RenderContext no longer owns a Rewrites instance. Its rewrite() method
and the rewrite closures in createAPIContext and the AstroGlobal
builder call rewriteHandler(this.pipeline, this, payload) directly.
All callers updated: BaseApp, DefaultErrorHandler, DevErrorHandler,
the container API (experimental_AstroContainer), the i18n middleware
shim for the manual routing strategy, and the renderThroughMiddleware
test helper.
All tests green: build, 2344 unit, 15 middleware, 13 rewrite, 4
redirects (+1 pre-existing skip), 26 actions, 10 container, 12
sessions, lint:ci. Latest Branches
-11%
-1%
gllmt:dev/fix-cache-provider-waituntil 0%
okxint:fix/style-case-sensitivity © 2026 CodSpeed Technology