import { StringPattern } from "@entwico/dash/match"; import { APIContext, MiddlewareHandler } from "astro"; //#region src/excludes/serialize.d.ts /** * 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; //#endregion //#region src/excludes/index.d.ts /** * Patterns accepted by @astroscope/node exclude options. The serializable * subset of dash's `StringPattern` — no matcher functions, since integration * options cross a virtual-module boundary. */ type ExcludePattern = Exclude boolean>; /** * Vite/Astro dev server paths - only relevant in development. */ declare const DEV_EXCLUDES: ExcludePattern[]; /** * Astro internal paths for static assets and image optimization, plus the * platform's own asset routes (`/_i18n/` translation chunks). */ declare const ASTRO_STATIC_EXCLUDES: ExcludePattern[]; declare const STATIC_EXCLUDES: ExcludePattern[]; /** * Recommended excludes for middleware. * * @example * ```ts * i18n({ * exclude: [ * ...RECOMMENDED_EXCLUDES, * { exact: "/health" }, // your health endpoint * ], * }) * ``` */ declare const RECOMMENDED_EXCLUDES: ExcludePattern[]; declare function shouldExclude(ctx: APIContext, exclude: readonly StringPattern[] | ((context: APIContext) => boolean) | undefined): boolean; /** * 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 { RECOMMENDED_EXCLUDES, withExcluded } from '@astroscope/node/excludes'; * import { someExternalMiddleware } from 'some-package'; * * export const onRequest = sequence( * withExcluded(someExternalMiddleware(), [ * ...RECOMMENDED_EXCLUDES, * { prefix: '/api/webhooks/' }, * ]), * ); * ``` */ declare function withExcluded(middleware: MiddlewareHandler, exclude: readonly StringPattern[] | ((context: APIContext) => boolean)): MiddlewareHandler; //#endregion export { STATIC_EXCLUDES as a, serializeExcludePatterns as c, RECOMMENDED_EXCLUDES as i, DEV_EXCLUDES as n, shouldExclude as o, ExcludePattern as r, withExcluded as s, ASTRO_STATIC_EXCLUDES as t }; //# sourceMappingURL=index-BWZ_Xo1e.d.ts.map