@sentry/nextjs
Version:
Official Sentry SDK for Next.js
93 lines • 5.08 kB
TypeScript
import type { VercelCronsConfig } from '../../common/types';
import type { RouteManifest } from '../manifest/types';
import type { NextConfigObject, SentryBuildOptions } from '../types';
/**
* Resolves the Sentry release name to use for build-time behavior.
*
* Note: if `release.create === false`, we avoid falling back to git to preserve build determinism.
*/
export declare function resolveReleaseName(userSentryOptions: SentryBuildOptions): string | undefined;
/**
* Applies tunnel-route rewrites, if configured.
*
* Note: this mutates `userSentryOptions` (to store the resolved tunnel route) and `incomingUserNextConfigObject`.
*/
export declare function maybeSetUpTunnelRouteRewriteRules(incomingUserNextConfigObject: NextConfigObject, userSentryOptions: SentryBuildOptions): void;
/**
* Handles Next's experimental build-mode warning/early return behavior.
*
* @returns `true` if Sentry config processing should be skipped for the current process invocation
*/
export declare function shouldReturnEarlyInExperimentalBuildMode(): boolean;
/**
* Creates the route manifest used for client-side route name normalization, unless disabled.
*/
export declare function maybeCreateRouteManifest(incomingUserNextConfigObject: NextConfigObject, userSentryOptions: SentryBuildOptions): RouteManifest | undefined;
type ExcludeFilter = ((route: string) => boolean) | (string | RegExp)[] | undefined;
/**
* Filters routes from the manifest based on the exclude filter.
* (Exported only for testing)
*/
export declare function filterRouteManifest(manifest: RouteManifest, excludeFilter: ExcludeFilter): RouteManifest;
/**
* Adds `experimental.clientTraceMetadata` for supported Next.js versions.
*/
export declare function maybeSetClientTraceMetadataOption(incomingUserNextConfigObject: NextConfigObject, nextJsVersion: string | undefined): void;
/**
* Ensures Next.js' `experimental.instrumentationHook` is set for versions which require it.
*/
export declare function maybeSetInstrumentationHookOption(incomingUserNextConfigObject: NextConfigObject, nextJsVersion: string | undefined): void;
/**
* Warns if the project has an `instrumentation-client` file but doesn't export `onRouterTransitionStart`.
*/
export declare function warnIfMissingOnRouterTransitionStartHook(userSentryOptions: SentryBuildOptions): void;
/**
* Parses the major Next.js version number from a semver string.
*/
export declare function getNextMajor(nextJsVersion: string | undefined): number | undefined;
/**
* Forces `meriyah`'s runtime files into Next.js' output file tracing.
*
* `meriyah` (a runtime dependency of `@sentry/server-utils`) declares its ESM build behind the
* `module-sync` export condition. Whether `@vercel/nft` traces that condition's target depends on
* the Node.js version running the build and on the nft version the installed Next.js bundles, so
* the traced file set can miss the file Node actually resolves at runtime. `output: 'standalone'`
* builds (and Vercel deployments) then crash on boot with `ERR_MODULE_NOT_FOUND` for
* `meriyah/dist/meriyah.mjs`. Force-including both build outputs makes the trace independent of
* the build environment. (https://github.com/vercel/nft/issues/603,
* https://github.com/getsentry/sentry-javascript/issues/23034)
*
* Only applied on Next.js >= 14.1: before that, `collectBuildTraces` receives
* `Object.entries(pageInfos)` of a `Map` (i.e. an empty array), so its "edge routes have no trace
* files" guard never matches and any include glob matching a pages-router edge route crashes the
* build with ENOENT on the route's missing `.nft.json` (fixed by
* https://github.com/vercel/next.js/pull/59157, released in 14.1.0).
*
* Note: this mutates `incomingUserNextConfigObject`.
*/
export declare function maybeAddOutputFileTracingIncludes(incomingUserNextConfigObject: NextConfigObject, nextJsVersion: string | undefined): void;
/** Strategy for Vercel cron monitoring instrumentation */
export type VercelCronsStrategy = 'spans' | 'wrapper';
export type VercelCronsConfigResult = {
/** The crons configuration from vercel.json, if available */
config: VercelCronsConfig;
/**
* The instrumentation strategy to use:
* - `spans`: New span-based approach (works for both App Router and Pages Router)
* - `wrapper`: Old wrapper-based approach (Pages Router only)
* - `undefined`: No cron monitoring enabled
*/
strategy: VercelCronsStrategy | undefined;
};
/**
* Reads and returns the Vercel crons configuration from vercel.json along with
* information about which instrumentation approach to use.
*
* - `_experimental.vercelCronsMonitoring`: New span-based approach (works for both App Router and Pages Router)
* - `automaticVercelMonitors`: Old wrapper-based approach (Pages Router only)
*
* If both are enabled, the new approach is preferred and a warning is logged.
*/
export declare function maybeGetVercelCronsConfig(userSentryOptions: SentryBuildOptions): VercelCronsConfigResult;
export {};
//# sourceMappingURL=getFinalConfigObjectUtils.d.ts.map