import type { NitroApp, NitroRuntimeHooks, ResolvedRouteRules } from "nitro/types"; import type { ServerRequest, ServerRequestContext } from "srvx"; import type { H3EventContext, Middleware, WebSocketHooks } from "h3"; import { HookableCore } from "hookable"; declare global { var __nitro__: Partial> | undefined; } export declare function useNitroApp(): NitroApp; export declare function useNitroHooks(): HookableCore; export declare function serverFetch(resource: string | URL | Request, init?: RequestInit, context?: ServerRequestContext | H3EventContext): Promise; export declare function resolveWebsocketHooks(req: ServerRequest): Promise>; export declare function fetch(resource: string | URL | Request, init?: RequestInit, context?: ServerRequestContext | H3EventContext): Promise; export declare function getRouteRules(method: string, pathname: string): { routeRules: ResolvedRouteRules; routeRuleMiddleware: Middleware[]; }; /** * Middleware that runs the route-rule middleware (`redirect`, `headers`, * `cors`, ...) matched for the current request. The composed chain is cached * per memoized match, so each distinct match is composed once. * * `event.context.routeRules` is assigned earlier, from `~findRoute`, so it is * populated for every middleware regardless of its position in the chain. */ export declare function createRouteRulesMiddleware(): Middleware; /** * Middleware that runs the routed (`server/middleware/**` with a route) * middleware matched for the current request. Chains are cached by the identity * of the matched handlers (a trie keyed on the router's stable data slots), so * the cache is bounded by the number of distinct match combinations rather than * by request pathnames. */ export declare function createRoutedMiddleware(findRoutedMiddleware: (method: string, pathname: string) => { data: Middleware; }[]): Middleware;