diff --git a/packages/nextjs/src/client/index.ts b/packages/nextjs/src/client/index.ts index c66f50a293f2..c50bbce37305 100644 --- a/packages/nextjs/src/client/index.ts +++ b/packages/nextjs/src/client/index.ts @@ -13,7 +13,7 @@ import { applyTunnelRouteOption } from './tunnelRoute'; export * from '@sentry/react'; -export { captureUnderscoreErrorException } from '../common/_error'; +export { captureUnderscoreErrorException } from '../common/pages-router-instrumentation/_error'; const globalWithInjectedValues = GLOBAL_OBJ as typeof GLOBAL_OBJ & { __rewriteFramesAssetPrefixPath__: string; diff --git a/packages/nextjs/src/common/index.ts b/packages/nextjs/src/common/index.ts index 354113637a30..7740c35c016c 100644 --- a/packages/nextjs/src/common/index.ts +++ b/packages/nextjs/src/common/index.ts @@ -1,14 +1,14 @@ -export { wrapGetStaticPropsWithSentry } from './wrapGetStaticPropsWithSentry'; -export { wrapGetInitialPropsWithSentry } from './wrapGetInitialPropsWithSentry'; -export { wrapAppGetInitialPropsWithSentry } from './wrapAppGetInitialPropsWithSentry'; -export { wrapDocumentGetInitialPropsWithSentry } from './wrapDocumentGetInitialPropsWithSentry'; -export { wrapErrorGetInitialPropsWithSentry } from './wrapErrorGetInitialPropsWithSentry'; -export { wrapGetServerSidePropsWithSentry } from './wrapGetServerSidePropsWithSentry'; +export { wrapGetStaticPropsWithSentry } from './pages-router-instrumentation/wrapGetStaticPropsWithSentry'; +export { wrapGetInitialPropsWithSentry } from './pages-router-instrumentation/wrapGetInitialPropsWithSentry'; +export { wrapAppGetInitialPropsWithSentry } from './pages-router-instrumentation/wrapAppGetInitialPropsWithSentry'; +export { wrapDocumentGetInitialPropsWithSentry } from './pages-router-instrumentation/wrapDocumentGetInitialPropsWithSentry'; +export { wrapErrorGetInitialPropsWithSentry } from './pages-router-instrumentation/wrapErrorGetInitialPropsWithSentry'; +export { wrapGetServerSidePropsWithSentry } from './pages-router-instrumentation/wrapGetServerSidePropsWithSentry'; export { wrapServerComponentWithSentry } from './wrapServerComponentWithSentry'; export { wrapRouteHandlerWithSentry } from './wrapRouteHandlerWithSentry'; -export { wrapApiHandlerWithSentryVercelCrons } from './wrapApiHandlerWithSentryVercelCrons'; +export { wrapApiHandlerWithSentryVercelCrons } from './pages-router-instrumentation/wrapApiHandlerWithSentryVercelCrons'; export { wrapMiddlewareWithSentry } from './wrapMiddlewareWithSentry'; -export { wrapPageComponentWithSentry } from './wrapPageComponentWithSentry'; +export { wrapPageComponentWithSentry } from './pages-router-instrumentation/wrapPageComponentWithSentry'; export { wrapGenerationFunctionWithSentry } from './wrapGenerationFunctionWithSentry'; export { withServerActionInstrumentation } from './withServerActionInstrumentation'; // eslint-disable-next-line deprecation/deprecation diff --git a/packages/nextjs/src/common/_error.ts b/packages/nextjs/src/common/pages-router-instrumentation/_error.ts similarity index 94% rename from packages/nextjs/src/common/_error.ts rename to packages/nextjs/src/common/pages-router-instrumentation/_error.ts index f3a198919a72..6148a6f0ae35 100644 --- a/packages/nextjs/src/common/_error.ts +++ b/packages/nextjs/src/common/pages-router-instrumentation/_error.ts @@ -1,7 +1,7 @@ import { captureException, withScope } from '@sentry/core'; import type { NextPageContext } from 'next'; -import { flushSafelyWithTimeout } from './utils/responseEnd'; -import { vercelWaitUntil } from './utils/vercelWaitUntil'; +import { flushSafelyWithTimeout } from '../utils/responseEnd'; +import { vercelWaitUntil } from '../utils/vercelWaitUntil'; type ContextOrProps = { req?: NextPageContext['req']; diff --git a/packages/nextjs/src/common/wrapApiHandlerWithSentry.ts b/packages/nextjs/src/common/pages-router-instrumentation/wrapApiHandlerWithSentry.ts similarity index 96% rename from packages/nextjs/src/common/wrapApiHandlerWithSentry.ts rename to packages/nextjs/src/common/pages-router-instrumentation/wrapApiHandlerWithSentry.ts index 09bca8d23d78..51afa404c113 100644 --- a/packages/nextjs/src/common/wrapApiHandlerWithSentry.ts +++ b/packages/nextjs/src/common/pages-router-instrumentation/wrapApiHandlerWithSentry.ts @@ -9,10 +9,10 @@ import { import { consoleSandbox, isString, logger, objectify } from '@sentry/utils'; import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; -import type { AugmentedNextApiRequest, AugmentedNextApiResponse, NextApiHandler } from './types'; -import { flushSafelyWithTimeout } from './utils/responseEnd'; -import { escapeNextjsTracing } from './utils/tracingUtils'; -import { vercelWaitUntil } from './utils/vercelWaitUntil'; +import type { AugmentedNextApiRequest, AugmentedNextApiResponse, NextApiHandler } from '../types'; +import { flushSafelyWithTimeout } from '../utils/responseEnd'; +import { escapeNextjsTracing } from '../utils/tracingUtils'; +import { vercelWaitUntil } from '../utils/vercelWaitUntil'; /** * Wrap the given API route handler for tracing and error capturing. Thin wrapper around `withSentry`, which only diff --git a/packages/nextjs/src/common/wrapApiHandlerWithSentryVercelCrons.ts b/packages/nextjs/src/common/pages-router-instrumentation/wrapApiHandlerWithSentryVercelCrons.ts similarity index 98% rename from packages/nextjs/src/common/wrapApiHandlerWithSentryVercelCrons.ts rename to packages/nextjs/src/common/pages-router-instrumentation/wrapApiHandlerWithSentryVercelCrons.ts index 4974cd827e9a..20ed01d51e94 100644 --- a/packages/nextjs/src/common/wrapApiHandlerWithSentryVercelCrons.ts +++ b/packages/nextjs/src/common/pages-router-instrumentation/wrapApiHandlerWithSentryVercelCrons.ts @@ -1,7 +1,7 @@ import { captureCheckIn } from '@sentry/core'; import type { NextApiRequest } from 'next'; -import type { VercelCronsConfig } from './types'; +import type { VercelCronsConfig } from '../types'; type EdgeRequest = { nextUrl: URL; diff --git a/packages/nextjs/src/common/wrapAppGetInitialPropsWithSentry.ts b/packages/nextjs/src/common/pages-router-instrumentation/wrapAppGetInitialPropsWithSentry.ts similarity index 97% rename from packages/nextjs/src/common/wrapAppGetInitialPropsWithSentry.ts rename to packages/nextjs/src/common/pages-router-instrumentation/wrapAppGetInitialPropsWithSentry.ts index 2c7b0adc7d7b..10f783b9e9e6 100644 --- a/packages/nextjs/src/common/wrapAppGetInitialPropsWithSentry.ts +++ b/packages/nextjs/src/common/pages-router-instrumentation/wrapAppGetInitialPropsWithSentry.ts @@ -1,7 +1,7 @@ import type App from 'next/app'; -import { isBuild } from './utils/isBuild'; -import { withErrorInstrumentation, withTracedServerSideDataFetcher } from './utils/wrapperUtils'; +import { isBuild } from '../utils/isBuild'; +import { withErrorInstrumentation, withTracedServerSideDataFetcher } from '../utils/wrapperUtils'; type AppGetInitialProps = (typeof App)['getInitialProps']; diff --git a/packages/nextjs/src/common/wrapDocumentGetInitialPropsWithSentry.ts b/packages/nextjs/src/common/pages-router-instrumentation/wrapDocumentGetInitialPropsWithSentry.ts similarity index 96% rename from packages/nextjs/src/common/wrapDocumentGetInitialPropsWithSentry.ts rename to packages/nextjs/src/common/pages-router-instrumentation/wrapDocumentGetInitialPropsWithSentry.ts index 192e70f093b1..d7f69c621132 100644 --- a/packages/nextjs/src/common/wrapDocumentGetInitialPropsWithSentry.ts +++ b/packages/nextjs/src/common/pages-router-instrumentation/wrapDocumentGetInitialPropsWithSentry.ts @@ -1,7 +1,7 @@ import type Document from 'next/document'; -import { isBuild } from './utils/isBuild'; -import { withErrorInstrumentation, withTracedServerSideDataFetcher } from './utils/wrapperUtils'; +import { isBuild } from '../utils/isBuild'; +import { withErrorInstrumentation, withTracedServerSideDataFetcher } from '../utils/wrapperUtils'; type DocumentGetInitialProps = typeof Document.getInitialProps; diff --git a/packages/nextjs/src/common/wrapErrorGetInitialPropsWithSentry.ts b/packages/nextjs/src/common/pages-router-instrumentation/wrapErrorGetInitialPropsWithSentry.ts similarity index 97% rename from packages/nextjs/src/common/wrapErrorGetInitialPropsWithSentry.ts rename to packages/nextjs/src/common/pages-router-instrumentation/wrapErrorGetInitialPropsWithSentry.ts index a2bd559342a4..731d3fe1e24a 100644 --- a/packages/nextjs/src/common/wrapErrorGetInitialPropsWithSentry.ts +++ b/packages/nextjs/src/common/pages-router-instrumentation/wrapErrorGetInitialPropsWithSentry.ts @@ -1,8 +1,8 @@ import type { NextPageContext } from 'next'; import type { ErrorProps } from 'next/error'; -import { isBuild } from './utils/isBuild'; -import { withErrorInstrumentation, withTracedServerSideDataFetcher } from './utils/wrapperUtils'; +import { isBuild } from '../utils/isBuild'; +import { withErrorInstrumentation, withTracedServerSideDataFetcher } from '../utils/wrapperUtils'; type ErrorGetInitialProps = (context: NextPageContext) => Promise; diff --git a/packages/nextjs/src/common/wrapGetInitialPropsWithSentry.ts b/packages/nextjs/src/common/pages-router-instrumentation/wrapGetInitialPropsWithSentry.ts similarity index 96% rename from packages/nextjs/src/common/wrapGetInitialPropsWithSentry.ts rename to packages/nextjs/src/common/pages-router-instrumentation/wrapGetInitialPropsWithSentry.ts index 2624aefb4d24..97246ec9d122 100644 --- a/packages/nextjs/src/common/wrapGetInitialPropsWithSentry.ts +++ b/packages/nextjs/src/common/pages-router-instrumentation/wrapGetInitialPropsWithSentry.ts @@ -1,7 +1,7 @@ import type { NextPage } from 'next'; -import { isBuild } from './utils/isBuild'; -import { withErrorInstrumentation, withTracedServerSideDataFetcher } from './utils/wrapperUtils'; +import { isBuild } from '../utils/isBuild'; +import { withErrorInstrumentation, withTracedServerSideDataFetcher } from '../utils/wrapperUtils'; type GetInitialProps = Required['getInitialProps']; diff --git a/packages/nextjs/src/common/wrapGetServerSidePropsWithSentry.ts b/packages/nextjs/src/common/pages-router-instrumentation/wrapGetServerSidePropsWithSentry.ts similarity index 96% rename from packages/nextjs/src/common/wrapGetServerSidePropsWithSentry.ts rename to packages/nextjs/src/common/pages-router-instrumentation/wrapGetServerSidePropsWithSentry.ts index 0037bad36300..7c4b4101d80e 100644 --- a/packages/nextjs/src/common/wrapGetServerSidePropsWithSentry.ts +++ b/packages/nextjs/src/common/pages-router-instrumentation/wrapGetServerSidePropsWithSentry.ts @@ -1,7 +1,7 @@ import type { GetServerSideProps } from 'next'; -import { isBuild } from './utils/isBuild'; -import { withErrorInstrumentation, withTracedServerSideDataFetcher } from './utils/wrapperUtils'; +import { isBuild } from '../utils/isBuild'; +import { withErrorInstrumentation, withTracedServerSideDataFetcher } from '../utils/wrapperUtils'; /** * Create a wrapped version of the user's exported `getServerSideProps` function diff --git a/packages/nextjs/src/common/wrapGetStaticPropsWithSentry.ts b/packages/nextjs/src/common/pages-router-instrumentation/wrapGetStaticPropsWithSentry.ts similarity index 93% rename from packages/nextjs/src/common/wrapGetStaticPropsWithSentry.ts rename to packages/nextjs/src/common/pages-router-instrumentation/wrapGetStaticPropsWithSentry.ts index aebbf42ac684..accf540f64ff 100644 --- a/packages/nextjs/src/common/wrapGetStaticPropsWithSentry.ts +++ b/packages/nextjs/src/common/pages-router-instrumentation/wrapGetStaticPropsWithSentry.ts @@ -1,7 +1,7 @@ import type { GetStaticProps } from 'next'; -import { isBuild } from './utils/isBuild'; -import { callDataFetcherTraced, withErrorInstrumentation } from './utils/wrapperUtils'; +import { isBuild } from '../utils/isBuild'; +import { callDataFetcherTraced, withErrorInstrumentation } from '../utils/wrapperUtils'; type Props = { [key: string]: unknown }; diff --git a/packages/nextjs/src/common/wrapPageComponentWithSentry.ts b/packages/nextjs/src/common/pages-router-instrumentation/wrapPageComponentWithSentry.ts similarity index 98% rename from packages/nextjs/src/common/wrapPageComponentWithSentry.ts rename to packages/nextjs/src/common/pages-router-instrumentation/wrapPageComponentWithSentry.ts index 8cd4a250ac14..75c176de8fac 100644 --- a/packages/nextjs/src/common/wrapPageComponentWithSentry.ts +++ b/packages/nextjs/src/common/pages-router-instrumentation/wrapPageComponentWithSentry.ts @@ -1,6 +1,6 @@ import { captureException, getCurrentScope, withIsolationScope } from '@sentry/core'; import { extractTraceparentData } from '@sentry/utils'; -import { escapeNextjsTracing } from './utils/tracingUtils'; +import { escapeNextjsTracing } from '../utils/tracingUtils'; interface FunctionComponent { (...args: unknown[]): unknown; diff --git a/packages/nextjs/src/edge/index.ts b/packages/nextjs/src/edge/index.ts index fcd0ec0e5932..adcee834e0d9 100644 --- a/packages/nextjs/src/edge/index.ts +++ b/packages/nextjs/src/edge/index.ts @@ -6,7 +6,7 @@ import { getDefaultIntegrations, init as vercelEdgeInit } from '@sentry/vercel-e import { isBuild } from '../common/utils/isBuild'; import { distDirRewriteFramesIntegration } from './distDirRewriteFramesIntegration'; -export { captureUnderscoreErrorException } from '../common/_error'; +export { captureUnderscoreErrorException } from '../common/pages-router-instrumentation/_error'; export type EdgeOptions = VercelEdgeOptions; diff --git a/packages/nextjs/src/server/index.ts b/packages/nextjs/src/server/index.ts index e787f978cf22..1bfc57b44418 100644 --- a/packages/nextjs/src/server/index.ts +++ b/packages/nextjs/src/server/index.ts @@ -26,7 +26,7 @@ import { distDirRewriteFramesIntegration } from './distDirRewriteFramesIntegrati export * from '@sentry/node'; -export { captureUnderscoreErrorException } from '../common/_error'; +export { captureUnderscoreErrorException } from '../common/pages-router-instrumentation/_error'; const globalWithInjectedValues = GLOBAL_OBJ as typeof GLOBAL_OBJ & { __rewriteFramesDistDir__?: string; @@ -325,4 +325,4 @@ function sdkAlreadyInitialized(): boolean { export * from '../common'; -export { wrapApiHandlerWithSentry } from '../common/wrapApiHandlerWithSentry'; +export { wrapApiHandlerWithSentry } from '../common/pages-router-instrumentation/wrapApiHandlerWithSentry';