@sentry/nextjs
Version:
Official Sentry SDK for Next.js
73 lines • 4.17 kB
TypeScript
import type { RouteManifest } from '../manifest/types';
import type { NextConfigObject, SentryBuildOptions, TurbopackOptions } from '../types';
import type { VercelCronsConfigResult } from './getFinalConfigObjectUtils';
/**
* Information about the active bundler and feature support based on Next.js version.
*/
export type BundlerInfo = {
isTurbopack: boolean;
isWebpack: boolean;
isTurbopackSupported: boolean;
};
/**
* Detects which bundler is active (webpack vs turbopack) and whether turbopack features are supported.
*/
export declare function getBundlerInfo(nextJsVersion: string | undefined): BundlerInfo;
/**
* Warns if turbopack is in use but the detected Next.js version is unsupported.
*/
export declare function maybeWarnAboutUnsupportedTurbopack(nextJsVersion: string | undefined, bundlerInfo: BundlerInfo): void;
/**
* Warns if `useRunAfterProductionCompileHook` is enabled in webpack mode but the Next.js version is unsupported.
*/
export declare function maybeWarnAboutUnsupportedRunAfterProductionCompileHook(nextJsVersion: string | undefined, userSentryOptions: SentryBuildOptions, bundlerInfo: BundlerInfo): void;
/**
* Constructs turbopack config when turbopack is active.
*/
export declare function maybeConstructTurbopackConfig(incomingUserNextConfigObject: NextConfigObject, userSentryOptions: SentryBuildOptions, routeManifest: RouteManifest | undefined, nextJsVersion: string | undefined, bundlerInfo: BundlerInfo, vercelCronsConfigResult: VercelCronsConfigResult): TurbopackOptions | undefined;
/**
* Resolves whether to use the `runAfterProductionCompile` hook based on options and bundler.
*/
export declare function resolveUseRunAfterProductionCompileHookOption(userSentryOptions: SentryBuildOptions, bundlerInfo: BundlerInfo): boolean;
/**
* Hooks into Next.js' `compiler.runAfterProductionCompile` to run Sentry release/sourcemap handling.
*
* Note: this mutates `incomingUserNextConfigObject`.
*/
export declare function maybeSetUpRunAfterProductionCompileHook({ incomingUserNextConfigObject, userSentryOptions, releaseName, nextJsVersion, bundlerInfo, turboPackConfig, shouldUseRunAfterProductionCompileHook, }: {
incomingUserNextConfigObject: NextConfigObject;
userSentryOptions: SentryBuildOptions;
releaseName: string | undefined;
nextJsVersion: string | undefined;
bundlerInfo: BundlerInfo;
turboPackConfig: TurbopackOptions | undefined;
shouldUseRunAfterProductionCompileHook: boolean;
}): void;
/**
* For supported turbopack builds, auto-enables browser sourcemaps and defaults to deleting them after upload.
*
* Note: this mutates both `incomingUserNextConfigObject` and `userSentryOptions`.
*/
export declare function maybeEnableTurbopackSourcemaps(incomingUserNextConfigObject: NextConfigObject, userSentryOptions: SentryBuildOptions, bundlerInfo: BundlerInfo): void;
/**
* Returns the patch which ensures server-side auto-instrumented packages are externalized.
*/
export declare function getServerExternalPackagesPatch(incomingUserNextConfigObject: NextConfigObject, nextMajor: number | undefined, useDiagnosticsChannelInjection?: boolean): Partial<NextConfigObject>;
/**
* Returns the patch for injecting Sentry's webpack config function (if enabled and applicable).
*/
export declare function getWebpackPatch({ incomingUserNextConfigObject, userSentryOptions, releaseName, routeManifest, nextJsVersion, shouldUseRunAfterProductionCompileHook, bundlerInfo, vercelCronsConfigResult, }: {
incomingUserNextConfigObject: NextConfigObject;
userSentryOptions: SentryBuildOptions;
releaseName: string | undefined;
routeManifest: RouteManifest | undefined;
nextJsVersion: string | undefined;
shouldUseRunAfterProductionCompileHook: boolean;
bundlerInfo: BundlerInfo;
vercelCronsConfigResult: VercelCronsConfigResult;
}): Partial<NextConfigObject>;
/**
* Returns the patch for adding turbopack config (if enabled and supported).
*/
export declare function getTurbopackPatch(bundlerInfo: BundlerInfo, turboPackConfig: TurbopackOptions | undefined): Partial<NextConfigObject>;
//# sourceMappingURL=getFinalConfigObjectBundlerUtils.d.ts.map