import { APIContext, MiddlewareHandler } from "astro"; //#region src/index.d.ts type ExcludePattern = { pattern: RegExp; } | { prefix: string; } | { exact: string; }; /** * Vite/Astro dev server paths - only relevant in development. */ declare const DEV_EXCLUDES: ExcludePattern[]; /** * Astro internal paths for static assets and image optimization. */ declare const ASTRO_STATIC_EXCLUDES: ExcludePattern[]; /** * Common static asset paths. */ declare const STATIC_EXCLUDES: ExcludePattern[]; /** * Recommended excludes for middleware. * Includes dev paths and Astro internals. * * @example * ```ts * createPinoMiddleware({ * exclude: [ * ...RECOMMENDED_EXCLUDES, * { exact: "/health" }, // your health endpoint * ], * }) * ``` */ declare const RECOMMENDED_EXCLUDES: ExcludePattern[]; /** * Check if a request should be excluded based on patterns or function. */ declare function shouldExclude(ctx: APIContext, exclude: ExcludePattern[] | ((context: APIContext) => boolean) | undefined): boolean; /** * Serialize exclude patterns to JavaScript code for use in virtual modules. * Handles RegExp objects which JSON.stringify cannot serialize. */ declare function serializeExcludePatterns(patterns: ExcludePattern[]): string; /** * Wraps a middleware to skip execution for excluded paths. * Useful for third-party middlewares that don't have built-in exclude support. * * @example * ```ts * import { withExcluded, RECOMMENDED_EXCLUDES } from '@astroscope/excludes'; * import { someExternalMiddleware } from 'some-package'; * * export const onRequest = sequence( * withExcluded(someExternalMiddleware(), [ * ...RECOMMENDED_EXCLUDES, * { prefix: '/api/webhooks/' }, * ]), * ); * ``` */ declare function withExcluded(middleware: MiddlewareHandler, exclude: ExcludePattern[] | ((context: APIContext) => boolean)): MiddlewareHandler; //#endregion export { ASTRO_STATIC_EXCLUDES, DEV_EXCLUDES, ExcludePattern, RECOMMENDED_EXCLUDES, STATIC_EXCLUDES, serializeExcludePatterns, shouldExclude, withExcluded };