@sentry/nextjs
Version:
Official Sentry SDK for Next.js
38 lines • 2.07 kB
TypeScript
import { type TunnelRouteMode } from '../../common/utils/tunnelPathnameMatch';
import type { NextConfigObject, SentryBuildOptions } from '../types';
/** The values that the client, server and edge bundles read to find the tunnel route. */
export type TunnelRouteInjectedValues = {
_sentryRewritesTunnelPath: string;
_sentryTunnelRouteMode: TunnelRouteMode;
} | Record<string, never>;
/**
* Resolves the tunnel route based on the user's configuration and the environment.
* @param tunnelRoute - The user-provided tunnel route option
*/
export declare function resolveTunnelRoute(tunnelRoute: string | true): string;
/**
* Injects rewrite rules into the Next.js config provided by the user to tunnel
* requests from the `tunnelPath` to Sentry.
*
* See https://nextjs.org/docs/api-reference/next.config.js/rewrites.
*/
export declare function setUpTunnelRewriteRules(userNextConfig: NextConfigObject, tunnelPath: string): void;
/**
* Injects a rewrite rule that sends requests from the `tunnelPath` to the tunnel route handler.
*/
export declare function setUpTunnelHandlerRewrite(userNextConfig: NextConfigObject, tunnelPath: string): void;
/**
* Returns the tunnel route handler file relative to `projectDir` (for example `app/sentry-tunnel/route.ts`), or
* `undefined` if the project has none.
*
* Route groups are not searched: the file must be directly in `app/sentry-tunnel/` or `src/app/sentry-tunnel/`.
*/
export declare function findTunnelRouteHandlerFile(pageExtensions?: string[], projectDir?: string): string | undefined;
/**
* Returns the tunnel path that the client sends envelopes to, and the tunnel route mode.
* Returns no values if there is no tunnel route, or if it cannot work (static export).
*
* Call it after `maybeSetUpTunnelRouteRewriteRules`, which resolves `tunnelRoute: true` to a path.
*/
export declare function getTunnelRouteInjectedValues(userNextConfig: NextConfigObject, userSentryOptions: SentryBuildOptions | undefined, projectDir?: string): TunnelRouteInjectedValues;
//# sourceMappingURL=tunnel.d.ts.map