diff --git a/dev-packages/deno-integration-tests/suites/direct-client-acs/scenario.mjs b/dev-packages/deno-integration-tests/suites/direct-client-acs/scenario.mjs index 584867c1b69c..31ad355c989e 100644 --- a/dev-packages/deno-integration-tests/suites/direct-client-acs/scenario.mjs +++ b/dev-packages/deno-integration-tests/suites/direct-client-acs/scenario.mjs @@ -7,7 +7,8 @@ // (it waits for the tracing-channel binding), so a nested db span here proves // `DenoClient.init()` installs that strategy on the direct-construction path. // Without it, the subscriber never binds and no span is produced. -import { createStackParser, nodeStackLineParser } from '@sentry/core'; +import { createStackParser } from '@sentry/core'; +import { nodeStackLineParser } from '@sentry/core/server'; import { DenoClient, getCurrentScope, getDefaultIntegrations, startSpan } from '@sentry/deno'; import { tracingChannel } from 'node:diagnostics_channel'; diff --git a/dev-packages/e2e-tests/test-applications/nuxt-3/server/plugins/customNitroErrorHandler.ts b/dev-packages/e2e-tests/test-applications/nuxt-3/server/plugins/customNitroErrorHandler.ts index 8f6ef4516fab..650b69215830 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-3/server/plugins/customNitroErrorHandler.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-3/server/plugins/customNitroErrorHandler.ts @@ -1,4 +1,5 @@ -import { Context, flushIfServerless } from '@sentry/core'; +import { Context } from '@sentry/core'; +import { flushIfServerless } from '@sentry/core/server'; import * as SentryNode from '@sentry/node'; import { H3Error } from 'h3'; import type { CapturedErrorContext } from 'nitropack'; diff --git a/dev-packages/e2e-tests/test-applications/tsx-express/src/mcp.ts b/dev-packages/e2e-tests/test-applications/tsx-express/src/mcp.ts index 71a3d810dc1c..a6da51a2ee04 100644 --- a/dev-packages/e2e-tests/test-applications/tsx-express/src/mcp.ts +++ b/dev-packages/e2e-tests/test-applications/tsx-express/src/mcp.ts @@ -4,7 +4,7 @@ import { McpServer, ResourceTemplate } from '@modelcontextprotocol/sdk/server/mc import { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js'; import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js'; import { z } from 'zod'; -import { wrapMcpServerWithSentry } from '@sentry/core'; +import { wrapMcpServerWithSentry } from '@sentry/node'; // Helper to check if request is an initialize request (compatible with all MCP SDK versions) function isInitializeRequest(body: unknown): boolean { diff --git a/dev-packages/node-integration-tests/suites/tracing/postgres-streamed/scenario-native.mjs b/dev-packages/node-integration-tests/suites/tracing/postgres-streamed/scenario-native.mjs index 3456d84bea8d..bb229c2eb729 100644 --- a/dev-packages/node-integration-tests/suites/tracing/postgres-streamed/scenario-native.mjs +++ b/dev-packages/node-integration-tests/suites/tracing/postgres-streamed/scenario-native.mjs @@ -1,5 +1,5 @@ import * as Sentry from '@sentry/node'; -import { uuid4 } from '@sentry/core/server'; +import { uuid4 } from '@sentry/core'; import { waitForConnection } from '@sentry-internal/node-integration-tests'; import pg from 'pg'; diff --git a/dev-packages/node-integration-tests/suites/tracing/postgres-streamed/scenario.mjs b/dev-packages/node-integration-tests/suites/tracing/postgres-streamed/scenario.mjs index 5f13c25b5c07..81b9e08f910c 100644 --- a/dev-packages/node-integration-tests/suites/tracing/postgres-streamed/scenario.mjs +++ b/dev-packages/node-integration-tests/suites/tracing/postgres-streamed/scenario.mjs @@ -1,5 +1,5 @@ import * as Sentry from '@sentry/node'; -import { uuid4 } from '@sentry/core/server'; +import { uuid4 } from '@sentry/core'; import { waitForConnection } from '@sentry-internal/node-integration-tests'; import { Client } from 'pg'; diff --git a/dev-packages/node-integration-tests/suites/tracing/postgres/scenario-native.mjs b/dev-packages/node-integration-tests/suites/tracing/postgres/scenario-native.mjs index 1cea5bdc1261..e9eb339fb828 100644 --- a/dev-packages/node-integration-tests/suites/tracing/postgres/scenario-native.mjs +++ b/dev-packages/node-integration-tests/suites/tracing/postgres/scenario-native.mjs @@ -1,5 +1,5 @@ import * as Sentry from '@sentry/node'; -import { uuid4 } from '@sentry/core/server'; +import { uuid4 } from '@sentry/core'; import { waitForConnection } from '@sentry-internal/node-integration-tests'; import pg from 'pg'; diff --git a/dev-packages/node-integration-tests/suites/tracing/postgres/scenario.mjs b/dev-packages/node-integration-tests/suites/tracing/postgres/scenario.mjs index 30dec0ded24e..2c92fcdb7ac4 100644 --- a/dev-packages/node-integration-tests/suites/tracing/postgres/scenario.mjs +++ b/dev-packages/node-integration-tests/suites/tracing/postgres/scenario.mjs @@ -1,5 +1,5 @@ import * as Sentry from '@sentry/node'; -import { uuid4 } from '@sentry/core/server'; +import { uuid4 } from '@sentry/core'; import { waitForConnection } from '@sentry-internal/node-integration-tests'; import { Client } from 'pg'; diff --git a/dev-packages/node-integration-tests/suites/tracing/postgresjs-streamed/scenario-requestHook.mjs b/dev-packages/node-integration-tests/suites/tracing/postgresjs-streamed/scenario-requestHook.mjs index d6c2afe40e13..05f359f2b57f 100644 --- a/dev-packages/node-integration-tests/suites/tracing/postgresjs-streamed/scenario-requestHook.mjs +++ b/dev-packages/node-integration-tests/suites/tracing/postgresjs-streamed/scenario-requestHook.mjs @@ -1,5 +1,5 @@ import * as Sentry from '@sentry/node'; -import { uuid4 } from '@sentry/core/server'; +import { uuid4 } from '@sentry/core'; import postgres from 'postgres'; import { waitForConnection } from '@sentry-internal/node-integration-tests'; diff --git a/dev-packages/node-integration-tests/suites/tracing/postgresjs-streamed/scenario-unsafe.mjs b/dev-packages/node-integration-tests/suites/tracing/postgresjs-streamed/scenario-unsafe.mjs index 84e65e911b20..7d75758804b3 100644 --- a/dev-packages/node-integration-tests/suites/tracing/postgresjs-streamed/scenario-unsafe.mjs +++ b/dev-packages/node-integration-tests/suites/tracing/postgresjs-streamed/scenario-unsafe.mjs @@ -1,5 +1,5 @@ import * as Sentry from '@sentry/node'; -import { uuid4 } from '@sentry/core/server'; +import { uuid4 } from '@sentry/core'; import postgres from 'postgres'; import { waitForConnection } from '@sentry-internal/node-integration-tests'; diff --git a/dev-packages/node-integration-tests/suites/tracing/postgresjs-streamed/scenario-url.mjs b/dev-packages/node-integration-tests/suites/tracing/postgresjs-streamed/scenario-url.mjs index 6df0f104e215..34301871ce16 100644 --- a/dev-packages/node-integration-tests/suites/tracing/postgresjs-streamed/scenario-url.mjs +++ b/dev-packages/node-integration-tests/suites/tracing/postgresjs-streamed/scenario-url.mjs @@ -1,5 +1,5 @@ import * as Sentry from '@sentry/node'; -import { uuid4 } from '@sentry/core/server'; +import { uuid4 } from '@sentry/core'; import postgres from 'postgres'; import { waitForConnection } from '@sentry-internal/node-integration-tests'; diff --git a/dev-packages/node-integration-tests/suites/tracing/postgresjs-streamed/scenario.mjs b/dev-packages/node-integration-tests/suites/tracing/postgresjs-streamed/scenario.mjs index f011356e1710..12dafe97300a 100644 --- a/dev-packages/node-integration-tests/suites/tracing/postgresjs-streamed/scenario.mjs +++ b/dev-packages/node-integration-tests/suites/tracing/postgresjs-streamed/scenario.mjs @@ -1,5 +1,5 @@ import * as Sentry from '@sentry/node'; -import { uuid4 } from '@sentry/core/server'; +import { uuid4 } from '@sentry/core'; import postgres from 'postgres'; import { waitForConnection } from '@sentry-internal/node-integration-tests'; diff --git a/dev-packages/node-integration-tests/suites/tracing/postgresjs/scenario-requestHook.mjs b/dev-packages/node-integration-tests/suites/tracing/postgresjs/scenario-requestHook.mjs index 7435146e2312..56d2d8a0c889 100644 --- a/dev-packages/node-integration-tests/suites/tracing/postgresjs/scenario-requestHook.mjs +++ b/dev-packages/node-integration-tests/suites/tracing/postgresjs/scenario-requestHook.mjs @@ -1,5 +1,5 @@ import * as Sentry from '@sentry/node'; -import { uuid4 } from '@sentry/core/server'; +import { uuid4 } from '@sentry/core'; import postgres from 'postgres'; import { waitForConnection } from '@sentry-internal/node-integration-tests'; diff --git a/dev-packages/node-integration-tests/suites/tracing/postgresjs/scenario-unsafe.mjs b/dev-packages/node-integration-tests/suites/tracing/postgresjs/scenario-unsafe.mjs index fe6d5126a3c6..73f17df87136 100644 --- a/dev-packages/node-integration-tests/suites/tracing/postgresjs/scenario-unsafe.mjs +++ b/dev-packages/node-integration-tests/suites/tracing/postgresjs/scenario-unsafe.mjs @@ -1,5 +1,5 @@ import * as Sentry from '@sentry/node'; -import { uuid4 } from '@sentry/core/server'; +import { uuid4 } from '@sentry/core'; import postgres from 'postgres'; import { waitForConnection } from '@sentry-internal/node-integration-tests'; diff --git a/dev-packages/node-integration-tests/suites/tracing/postgresjs/scenario-url.mjs b/dev-packages/node-integration-tests/suites/tracing/postgresjs/scenario-url.mjs index 227daada3be1..f4cb4b2b0717 100644 --- a/dev-packages/node-integration-tests/suites/tracing/postgresjs/scenario-url.mjs +++ b/dev-packages/node-integration-tests/suites/tracing/postgresjs/scenario-url.mjs @@ -1,5 +1,5 @@ import * as Sentry from '@sentry/node'; -import { uuid4 } from '@sentry/core/server'; +import { uuid4 } from '@sentry/core'; import postgres from 'postgres'; import { waitForConnection } from '@sentry-internal/node-integration-tests'; diff --git a/dev-packages/node-integration-tests/suites/tracing/postgresjs/scenario.mjs b/dev-packages/node-integration-tests/suites/tracing/postgresjs/scenario.mjs index a975bc518272..e3dcaee00cdc 100644 --- a/dev-packages/node-integration-tests/suites/tracing/postgresjs/scenario.mjs +++ b/dev-packages/node-integration-tests/suites/tracing/postgresjs/scenario.mjs @@ -1,5 +1,5 @@ import * as Sentry from '@sentry/node'; -import { uuid4 } from '@sentry/core/server'; +import { uuid4 } from '@sentry/core'; import postgres from 'postgres'; import { waitForConnection } from '@sentry-internal/node-integration-tests'; diff --git a/packages/astro/src/server/middleware.ts b/packages/astro/src/server/middleware.ts index d22d0c35be88..c75ffd6ed968 100644 --- a/packages/astro/src/server/middleware.ts +++ b/packages/astro/src/server/middleware.ts @@ -12,7 +12,6 @@ import { HTTP_SERVER } from '@sentry/conventions/op'; import type { Span, SpanAttributes } from '@sentry/core'; import { addNonEnumerableProperty, - flushIfServerless, getIsolationScope, getRootSpan, getUrlFragment, @@ -26,6 +25,7 @@ import { filterCollectedUrl, filterCollectedUrlQuery, } from '@sentry/core'; +import { flushIfServerless } from '@sentry/core/server'; import { captureException, continueTrace, diff --git a/packages/browser-utils/src/performance/utils.ts b/packages/browser-utils/src/performance/utils.ts index 6ab5e011672c..a9a9759e7ed5 100644 --- a/packages/browser-utils/src/performance/utils.ts +++ b/packages/browser-utils/src/performance/utils.ts @@ -1,5 +1,6 @@ import type { SentrySpan, Span, SpanTimeInput, StartSpanOptions } from '@sentry/core'; -import { spanToStaticSpanJSON, withActiveSpan, startInactiveSpan } from '@sentry/core/browser'; +import { spanToStaticSpanJSON, withActiveSpan } from '@sentry/core'; +import { startInactiveSpan } from '@sentry/core/browser'; import { WINDOW } from '../types'; /** diff --git a/packages/browser-utils/src/types.ts b/packages/browser-utils/src/types.ts index 4639a40fedb6..79a3517110d0 100644 --- a/packages/browser-utils/src/types.ts +++ b/packages/browser-utils/src/types.ts @@ -1,4 +1,5 @@ -import type { FetchBreadcrumbHint, HandlerDataFetch, XhrBreadcrumbHint } from '@sentry/core'; +import type { FetchBreadcrumbHint, HandlerDataFetch } from '@sentry/core'; +import type { XhrBreadcrumbHint } from '@sentry/core/browser'; import { GLOBAL_OBJ } from '@sentry/core'; export const WINDOW = GLOBAL_OBJ as typeof GLOBAL_OBJ & diff --git a/packages/browser/src/client.ts b/packages/browser/src/client.ts index 72cba459b0c1..0221ca2d30ce 100644 --- a/packages/browser/src/client.ts +++ b/packages/browser/src/client.ts @@ -1,5 +1,4 @@ import type { - BrowserClientReplayOptions, ClientOptions, Event, EventHint, @@ -7,8 +6,9 @@ import type { ParameterizedString, Scope, SeverityLevel, -} from '@sentry/core/browser'; -import { addAutoIpAddressToSession, applySdkMetadata, Client, getSDKSource } from '@sentry/core/browser'; +} from '@sentry/core'; +import type { BrowserClientReplayOptions } from '@sentry/core/browser'; +import { addAutoIpAddressToSession, applySdkMetadata, Client, getSDKSource } from '@sentry/core'; import { eventFromException, eventFromMessage } from './eventbuilder'; import { WINDOW } from './helpers'; import type { BrowserTransportOptions } from './transports/types'; diff --git a/packages/browser/src/diagnose-sdk.ts b/packages/browser/src/diagnose-sdk.ts index 0be386ce6d32..0a5fdd0da05b 100644 --- a/packages/browser/src/diagnose-sdk.ts +++ b/packages/browser/src/diagnose-sdk.ts @@ -1,4 +1,4 @@ -import { getClient, suppressTracing } from '@sentry/core/browser'; +import { getClient, suppressTracing } from '@sentry/core'; /** * A function to diagnose why the SDK might not be successfully sending data. diff --git a/packages/browser/src/eventbuilder.ts b/packages/browser/src/eventbuilder.ts index 824dd225d247..1708cd29a301 100644 --- a/packages/browser/src/eventbuilder.ts +++ b/packages/browser/src/eventbuilder.ts @@ -6,7 +6,7 @@ import type { SeverityLevel, StackFrame, StackParser, -} from '@sentry/core/browser'; +} from '@sentry/core'; import { _INTERNAL_enhanceErrorWithSentryInfo, addExceptionMechanism, @@ -22,7 +22,7 @@ import { isPlainObject, normalizeToSize, resolvedSyncPromise, -} from '@sentry/core/browser'; +} from '@sentry/core'; type Prototype = { constructor: (...args: unknown[]) => unknown }; diff --git a/packages/browser/src/exports.ts b/packages/browser/src/exports.ts index d6d5b78f25f4..84c4f6f44784 100644 --- a/packages/browser/src/exports.ts +++ b/packages/browser/src/exports.ts @@ -20,7 +20,7 @@ export type { ExclusiveEventHintOrCaptureContext, Log, LogSeverityLevel, -} from '@sentry/core/browser'; +} from '@sentry/core'; export type { BrowserOptions } from './client'; @@ -74,14 +74,14 @@ export { withStaticSpan, // oxlint-disable-next-line typescript/no-deprecated withStreamedSpan, -} from '@sentry/core/browser'; +} from '@sentry/core'; export { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SENTRY_SEGMENT_NAME_SOURCE, -} from '@sentry/core/browser'; +} from '@sentry/core'; export { WINDOW } from './helpers'; export { BrowserClient } from './client'; diff --git a/packages/browser/src/helpers.ts b/packages/browser/src/helpers.ts index 32007ad33954..c961534df2fd 100644 --- a/packages/browser/src/helpers.ts +++ b/packages/browser/src/helpers.ts @@ -1,4 +1,4 @@ -import type { Mechanism, WrappedFunction } from '@sentry/core/browser'; +import type { Mechanism, WrappedFunction } from '@sentry/core'; import { addExceptionMechanism, addExceptionTypeValue, @@ -8,7 +8,7 @@ import { GLOBAL_OBJ, markFunctionWrapped, withScope, -} from '@sentry/core/browser'; +} from '@sentry/core'; import { getLocationHref } from '@sentry/browser-utils'; export const WINDOW = GLOBAL_OBJ as typeof GLOBAL_OBJ & Window; diff --git a/packages/browser/src/index.bundle.logs.metrics.ts b/packages/browser/src/index.bundle.logs.metrics.ts index aa15383e24c4..2a5db34d2503 100644 --- a/packages/browser/src/index.bundle.logs.metrics.ts +++ b/packages/browser/src/index.bundle.logs.metrics.ts @@ -8,7 +8,7 @@ import { export * from './index.bundle.base'; -export { logger, consoleLoggingIntegration, metrics } from '@sentry/core/browser'; +export { logger, consoleLoggingIntegration, metrics } from '@sentry/core'; export { elementTimingIntegration } from '@sentry/browser-utils'; diff --git a/packages/browser/src/index.bundle.replay.logs.metrics.ts b/packages/browser/src/index.bundle.replay.logs.metrics.ts index db50710db841..cb481337da9f 100644 --- a/packages/browser/src/index.bundle.replay.logs.metrics.ts +++ b/packages/browser/src/index.bundle.replay.logs.metrics.ts @@ -7,7 +7,7 @@ import { export * from './index.bundle.base'; -export { logger, consoleLoggingIntegration, metrics } from '@sentry/core/browser'; +export { logger, consoleLoggingIntegration, metrics } from '@sentry/core'; export { replayIntegration, getReplay } from '@sentry/replay'; diff --git a/packages/browser/src/index.bundle.tracing.logs.metrics.ts b/packages/browser/src/index.bundle.tracing.logs.metrics.ts index ef86a63b4a1e..477fa381f93c 100644 --- a/packages/browser/src/index.bundle.tracing.logs.metrics.ts +++ b/packages/browser/src/index.bundle.tracing.logs.metrics.ts @@ -1,25 +1,23 @@ -import { registerSpanErrorInstrumentation } from '@sentry/core/browser'; +import { registerSpanErrorInstrumentation } from '@sentry/core'; import { feedbackIntegrationShim, replayIntegrationShim } from '@sentry-internal/integration-shims'; registerSpanErrorInstrumentation(); export * from './index.bundle.base'; -export { logger, consoleLoggingIntegration, metrics } from '@sentry/core/browser'; +export { logger, consoleLoggingIntegration, metrics } from '@sentry/core'; export { getActiveSpan, getRootSpan, getSpanDescendants, setMeasurement, - startInactiveSpan, startNewTrace, - startSpan, - startSpanManual, withActiveSpan, spanStreamingIntegration, -} from '@sentry/core/browser'; +} from '@sentry/core'; +export { startSpan, startInactiveSpan, startSpanManual } from '@sentry/core/browser'; export { browserTracingIntegration, startBrowserTracingNavigationSpan, diff --git a/packages/browser/src/index.bundle.tracing.replay.feedback.logs.metrics.ts b/packages/browser/src/index.bundle.tracing.replay.feedback.logs.metrics.ts index 5811a3ac6eab..57127dbee2ac 100644 --- a/packages/browser/src/index.bundle.tracing.replay.feedback.logs.metrics.ts +++ b/packages/browser/src/index.bundle.tracing.replay.feedback.logs.metrics.ts @@ -1,4 +1,4 @@ -import { registerSpanErrorInstrumentation } from '@sentry/core/browser'; +import { registerSpanErrorInstrumentation } from '@sentry/core'; import { feedbackAsyncIntegration } from './feedbackAsync'; registerSpanErrorInstrumentation(); @@ -10,16 +10,14 @@ export { getRootSpan, getSpanDescendants, setMeasurement, - startInactiveSpan, startNewTrace, - startSpan, - startSpanManual, withActiveSpan, logger, consoleLoggingIntegration, metrics, spanStreamingIntegration, -} from '@sentry/core/browser'; +} from '@sentry/core'; +export { startSpan, startInactiveSpan, startSpanManual } from '@sentry/core/browser'; export { browserTracingIntegration, diff --git a/packages/browser/src/index.bundle.tracing.replay.feedback.ts b/packages/browser/src/index.bundle.tracing.replay.feedback.ts index 99c2fd3eb5b0..4bae50e0fe49 100644 --- a/packages/browser/src/index.bundle.tracing.replay.feedback.ts +++ b/packages/browser/src/index.bundle.tracing.replay.feedback.ts @@ -1,4 +1,4 @@ -import { registerSpanErrorInstrumentation } from '@sentry/core/browser'; +import { registerSpanErrorInstrumentation } from '@sentry/core'; import { consoleLoggingIntegrationShim, elementTimingIntegrationShim, @@ -16,15 +16,13 @@ export { consoleLoggingIntegrationShim as consoleLoggingIntegration, loggerShim export { getActiveSpan, getRootSpan, - startSpan, - startInactiveSpan, - startSpanManual, startNewTrace, withActiveSpan, getSpanDescendants, setMeasurement, spanStreamingIntegration, -} from '@sentry/core/browser'; +} from '@sentry/core'; +export { startSpan, startInactiveSpan, startSpanManual } from '@sentry/core/browser'; export { browserTracingIntegration, diff --git a/packages/browser/src/index.bundle.tracing.replay.logs.metrics.ts b/packages/browser/src/index.bundle.tracing.replay.logs.metrics.ts index bd505ecbd4ca..29dc32ac035b 100644 --- a/packages/browser/src/index.bundle.tracing.replay.logs.metrics.ts +++ b/packages/browser/src/index.bundle.tracing.replay.logs.metrics.ts @@ -1,24 +1,22 @@ -import { registerSpanErrorInstrumentation } from '@sentry/core/browser'; +import { registerSpanErrorInstrumentation } from '@sentry/core'; import { feedbackIntegrationShim } from '@sentry-internal/integration-shims'; registerSpanErrorInstrumentation(); export * from './index.bundle.base'; -export { logger, consoleLoggingIntegration, metrics } from '@sentry/core/browser'; +export { logger, consoleLoggingIntegration, metrics } from '@sentry/core'; export { getActiveSpan, getRootSpan, getSpanDescendants, setMeasurement, - startInactiveSpan, startNewTrace, - startSpan, - startSpanManual, withActiveSpan, spanStreamingIntegration, -} from '@sentry/core/browser'; +} from '@sentry/core'; +export { startSpan, startInactiveSpan, startSpanManual } from '@sentry/core/browser'; export { browserTracingIntegration, diff --git a/packages/browser/src/index.bundle.tracing.replay.ts b/packages/browser/src/index.bundle.tracing.replay.ts index 132965196ef9..b1dd10ced028 100644 --- a/packages/browser/src/index.bundle.tracing.replay.ts +++ b/packages/browser/src/index.bundle.tracing.replay.ts @@ -1,4 +1,4 @@ -import { registerSpanErrorInstrumentation } from '@sentry/core/browser'; +import { registerSpanErrorInstrumentation } from '@sentry/core'; import { consoleLoggingIntegrationShim, elementTimingIntegrationShim, @@ -16,15 +16,13 @@ export { consoleLoggingIntegrationShim as consoleLoggingIntegration, loggerShim export { getActiveSpan, getRootSpan, - startSpan, - startInactiveSpan, - startSpanManual, startNewTrace, withActiveSpan, getSpanDescendants, setMeasurement, spanStreamingIntegration, -} from '@sentry/core/browser'; +} from '@sentry/core'; +export { startSpan, startInactiveSpan, startSpanManual } from '@sentry/core/browser'; export { browserTracingIntegration, diff --git a/packages/browser/src/index.bundle.tracing.ts b/packages/browser/src/index.bundle.tracing.ts index 31296862d4d8..ad4082623859 100644 --- a/packages/browser/src/index.bundle.tracing.ts +++ b/packages/browser/src/index.bundle.tracing.ts @@ -1,4 +1,4 @@ -import { registerSpanErrorInstrumentation } from '@sentry/core/browser'; +import { registerSpanErrorInstrumentation } from '@sentry/core'; import { consoleLoggingIntegrationShim, elementTimingIntegrationShim, @@ -17,15 +17,13 @@ export { consoleLoggingIntegrationShim as consoleLoggingIntegration, loggerShim export { getActiveSpan, getRootSpan, - startSpan, - startInactiveSpan, - startSpanManual, startNewTrace, withActiveSpan, getSpanDescendants, setMeasurement, spanStreamingIntegration, -} from '@sentry/core/browser'; +} from '@sentry/core'; +export { startSpan, startInactiveSpan, startSpanManual } from '@sentry/core/browser'; export { browserTracingIntegration, diff --git a/packages/browser/src/index.ts b/packages/browser/src/index.ts index 86a58bbc9be6..d6ee777fb402 100644 --- a/packages/browser/src/index.ts +++ b/packages/browser/src/index.ts @@ -52,9 +52,6 @@ export { registerSpanErrorInstrumentation, getActiveSpan, getRootSpan, - startSpan, - startInactiveSpan, - startSpanManual, withActiveSpan, startNewTrace, bindScopeToEmitter, @@ -73,8 +70,9 @@ export { logger, metrics, spanStreamingIntegration, -} from '@sentry/core/browser'; -export type { Span, FeatureFlagsIntegration } from '@sentry/core/browser'; +} from '@sentry/core'; +export { startSpan, startInactiveSpan, startSpanManual } from '@sentry/core/browser'; +export type { Span, FeatureFlagsIntegration } from '@sentry/core'; export { makeBrowserOfflineTransport } from './transports/offline'; export { browserProfilingIntegration } from './profiling/integration'; export { spotlightBrowserIntegration } from './integrations/spotlight'; diff --git a/packages/browser/src/integrations-bundle/index.captureconsole.ts b/packages/browser/src/integrations-bundle/index.captureconsole.ts index 3d25bf4edaf5..a2187ae98798 100644 --- a/packages/browser/src/integrations-bundle/index.captureconsole.ts +++ b/packages/browser/src/integrations-bundle/index.captureconsole.ts @@ -1 +1 @@ -export { captureConsoleIntegration } from '@sentry/core/browser'; +export { captureConsoleIntegration } from '@sentry/core'; diff --git a/packages/browser/src/integrations-bundle/index.dedupe.ts b/packages/browser/src/integrations-bundle/index.dedupe.ts index 19ba1ad738d4..776d967c31a9 100644 --- a/packages/browser/src/integrations-bundle/index.dedupe.ts +++ b/packages/browser/src/integrations-bundle/index.dedupe.ts @@ -1 +1 @@ -export { dedupeIntegration } from '@sentry/core/browser'; +export { dedupeIntegration } from '@sentry/core'; diff --git a/packages/browser/src/integrations-bundle/index.extraerrordata.ts b/packages/browser/src/integrations-bundle/index.extraerrordata.ts index 7df49cf87be6..4306f9694902 100644 --- a/packages/browser/src/integrations-bundle/index.extraerrordata.ts +++ b/packages/browser/src/integrations-bundle/index.extraerrordata.ts @@ -1 +1 @@ -export { extraErrorDataIntegration } from '@sentry/core/browser'; +export { extraErrorDataIntegration } from '@sentry/core'; diff --git a/packages/browser/src/integrations-bundle/index.feedback.ts b/packages/browser/src/integrations-bundle/index.feedback.ts index 3cd7fc6c7d3f..4f24444b8591 100644 --- a/packages/browser/src/integrations-bundle/index.feedback.ts +++ b/packages/browser/src/integrations-bundle/index.feedback.ts @@ -4,4 +4,4 @@ export { getFeedback } from '@sentry/feedback'; export { feedbackAsyncIntegration, feedbackAsyncIntegration as feedbackIntegration }; -export { captureFeedback } from '@sentry/core/browser'; +export { captureFeedback } from '@sentry/core'; diff --git a/packages/browser/src/integrations-bundle/index.modulemetadata.ts b/packages/browser/src/integrations-bundle/index.modulemetadata.ts index b63da0e5a49d..c4f4a2b9cf75 100644 --- a/packages/browser/src/integrations-bundle/index.modulemetadata.ts +++ b/packages/browser/src/integrations-bundle/index.modulemetadata.ts @@ -1 +1 @@ -export { moduleMetadataIntegration } from '@sentry/core/browser'; +export { moduleMetadataIntegration } from '@sentry/core'; diff --git a/packages/browser/src/integrations-bundle/index.rewriteframes.ts b/packages/browser/src/integrations-bundle/index.rewriteframes.ts index fbdc2d071d3e..07ebaf6666f5 100644 --- a/packages/browser/src/integrations-bundle/index.rewriteframes.ts +++ b/packages/browser/src/integrations-bundle/index.rewriteframes.ts @@ -1 +1 @@ -export { rewriteFramesIntegration } from '@sentry/core/browser'; +export { rewriteFramesIntegration } from '@sentry/core'; diff --git a/packages/browser/src/integrations/bfcacheMetrics.ts b/packages/browser/src/integrations/bfcacheMetrics.ts index 82b1deac4852..5dd076c2783a 100644 --- a/packages/browser/src/integrations/bfcacheMetrics.ts +++ b/packages/browser/src/integrations/bfcacheMetrics.ts @@ -6,8 +6,8 @@ import { BROWSER_BFCACHE_REASON, SENTRY_ORIGIN, } from '@sentry/conventions/attributes'; -import type { IntegrationFn, SpanAttributes } from '@sentry/core/browser'; -import { debug, defineIntegration, getCurrentScope, metrics } from '@sentry/core/browser'; +import type { IntegrationFn, SpanAttributes } from '@sentry/core'; +import { debug, defineIntegration, getCurrentScope, metrics } from '@sentry/core'; import { DEBUG_BUILD } from '../debug-build'; import { WINDOW } from '../helpers'; diff --git a/packages/browser/src/integrations/breadcrumbs.ts b/packages/browser/src/integrations/breadcrumbs.ts index f627ea10d31e..0ba5f4230e74 100644 --- a/packages/browser/src/integrations/breadcrumbs.ts +++ b/packages/browser/src/integrations/breadcrumbs.ts @@ -9,9 +9,7 @@ import type { HandlerDataConsole, HandlerDataFetch, IntegrationFn, - XhrBreadcrumbData, - XhrBreadcrumbHint, -} from '@sentry/core/browser'; +} from '@sentry/core'; import { addBreadcrumb, addConsoleInstrumentationHandler, @@ -24,8 +22,8 @@ import { parseUrl, safeJoin, severityLevelFromString, -} from '@sentry/core/browser'; -import type { FetchHint, HandlerDataDom, HandlerDataHistory, HandlerDataXhr, XhrHint } from '@sentry/browser-utils'; +} from '@sentry/core'; +import type { FetchHint, HandlerDataDom, HandlerDataHistory, HandlerDataXhr } from '@sentry/browser-utils'; import { addClickKeypressInstrumentationHandler, addHistoryInstrumentationHandler, @@ -34,6 +32,7 @@ import { getComponentName, SENTRY_XHR_DATA_KEY, } from '@sentry/browser-utils'; +import type { XhrBreadcrumbData, XhrBreadcrumbHint } from '@sentry/core/browser'; import { DEBUG_BUILD } from '../debug-build'; import { WINDOW } from '../helpers'; @@ -257,7 +256,7 @@ function _getXhrBreadcrumbHandler(client: Client): (handlerData: HandlerDataXhr) level: getBreadcrumbLogLevelFromHttpStatusCode(status_code), }; - client.emit('beforeOutgoingRequestBreadcrumb', breadcrumb, hint as XhrHint); + client.emit('beforeOutgoingRequestBreadcrumb', breadcrumb, hint); addBreadcrumb(breadcrumb, hint); }; diff --git a/packages/browser/src/integrations/browserapierrors.ts b/packages/browser/src/integrations/browserapierrors.ts index 2b8d3faf8bca..6137b9015505 100644 --- a/packages/browser/src/integrations/browserapierrors.ts +++ b/packages/browser/src/integrations/browserapierrors.ts @@ -1,5 +1,5 @@ -import type { IntegrationFn, WrappedFunction } from '@sentry/core/browser'; -import { defineIntegration, fill, getFunctionName, getOriginalFunction } from '@sentry/core/browser'; +import type { IntegrationFn, WrappedFunction } from '@sentry/core'; +import { defineIntegration, fill, getFunctionName, getOriginalFunction } from '@sentry/core'; import { WINDOW, wrap } from '../helpers'; // Using a comma-separated string and split for smaller bundle size vs an array literal diff --git a/packages/browser/src/integrations/browsersession.ts b/packages/browser/src/integrations/browsersession.ts index 247c64dfe7ba..f3b3debd081d 100644 --- a/packages/browser/src/integrations/browsersession.ts +++ b/packages/browser/src/integrations/browsersession.ts @@ -1,4 +1,4 @@ -import { captureSession, debug, defineIntegration, getIsolationScope, startSession } from '@sentry/core/browser'; +import { captureSession, debug, defineIntegration, getIsolationScope, startSession } from '@sentry/core'; import { addHistoryInstrumentationHandler, whenIdleOrHidden } from '@sentry/browser-utils'; import { DEBUG_BUILD } from '../debug-build'; import { WINDOW } from '../helpers'; diff --git a/packages/browser/src/integrations/contextlines.ts b/packages/browser/src/integrations/contextlines.ts index 330a223ff62d..cb08ed0be35e 100644 --- a/packages/browser/src/integrations/contextlines.ts +++ b/packages/browser/src/integrations/contextlines.ts @@ -1,5 +1,5 @@ -import type { Event, IntegrationFn, StackFrame } from '@sentry/core/browser'; -import { addContextToFrame, defineIntegration, GLOBAL_OBJ, stripUrlQueryAndFragment } from '@sentry/core/browser'; +import type { Event, IntegrationFn, StackFrame } from '@sentry/core'; +import { addContextToFrame, defineIntegration, GLOBAL_OBJ, stripUrlQueryAndFragment } from '@sentry/core'; const WINDOW = GLOBAL_OBJ as typeof GLOBAL_OBJ & Window; diff --git a/packages/browser/src/integrations/culturecontext.ts b/packages/browser/src/integrations/culturecontext.ts index 491cc8cf86bb..294f52402371 100644 --- a/packages/browser/src/integrations/culturecontext.ts +++ b/packages/browser/src/integrations/culturecontext.ts @@ -1,5 +1,5 @@ -import type { CultureContext, IntegrationFn } from '@sentry/core/browser'; -import { defineIntegration, safeSetSpanJSONAttributes } from '@sentry/core/browser'; +import type { CultureContext, IntegrationFn } from '@sentry/core'; +import { defineIntegration, safeSetSpanJSONAttributes } from '@sentry/core'; import { WINDOW } from '../helpers'; const INTEGRATION_NAME = 'CultureContext' as const; diff --git a/packages/browser/src/integrations/featureFlags/growthbook/integration.ts b/packages/browser/src/integrations/featureFlags/growthbook/integration.ts index 38ae92009063..560918535cce 100644 --- a/packages/browser/src/integrations/featureFlags/growthbook/integration.ts +++ b/packages/browser/src/integrations/featureFlags/growthbook/integration.ts @@ -1,5 +1,5 @@ -import type { IntegrationFn } from '@sentry/core/browser'; -import { growthbookIntegration as coreGrowthbookIntegration } from '@sentry/core/browser'; +import type { IntegrationFn } from '@sentry/core'; +import { growthbookIntegration as coreGrowthbookIntegration } from '@sentry/core'; import type { GrowthBookClass } from './types'; /** diff --git a/packages/browser/src/integrations/featureFlags/launchdarkly/integration.ts b/packages/browser/src/integrations/featureFlags/launchdarkly/integration.ts index 52d6baf45617..76487ff2cc5b 100644 --- a/packages/browser/src/integrations/featureFlags/launchdarkly/integration.ts +++ b/packages/browser/src/integrations/featureFlags/launchdarkly/integration.ts @@ -1,10 +1,10 @@ -import type { Client, Event, EventHint, IntegrationFn } from '@sentry/core/browser'; +import type { Client, Event, EventHint, IntegrationFn } from '@sentry/core'; import { _INTERNAL_addFeatureFlagToActiveSpan, _INTERNAL_copyFlagsFromScopeToEvent, _INTERNAL_insertFlagToScope, defineIntegration, -} from '@sentry/core/browser'; +} from '@sentry/core'; import type { LDContext, LDEvaluationDetail, LDInspectionFlagUsedHandler } from './types'; /** diff --git a/packages/browser/src/integrations/featureFlags/openfeature/integration.ts b/packages/browser/src/integrations/featureFlags/openfeature/integration.ts index cbb2d0d0df44..c60f63939d88 100644 --- a/packages/browser/src/integrations/featureFlags/openfeature/integration.ts +++ b/packages/browser/src/integrations/featureFlags/openfeature/integration.ts @@ -13,13 +13,13 @@ * OpenFeature.addHooks(new Sentry.OpenFeatureIntegrationHook()); * ``` */ -import type { Client, Event, EventHint, IntegrationFn } from '@sentry/core/browser'; +import type { Client, Event, EventHint, IntegrationFn } from '@sentry/core'; import { _INTERNAL_addFeatureFlagToActiveSpan, _INTERNAL_copyFlagsFromScopeToEvent, _INTERNAL_insertFlagToScope, defineIntegration, -} from '@sentry/core/browser'; +} from '@sentry/core'; import type { EvaluationDetails, HookContext, HookHints, JsonValue, OpenFeatureHook } from './types'; export const openFeatureIntegration = defineIntegration(() => { diff --git a/packages/browser/src/integrations/featureFlags/statsig/integration.ts b/packages/browser/src/integrations/featureFlags/statsig/integration.ts index 2dd28cc6f691..19bd5df2764e 100644 --- a/packages/browser/src/integrations/featureFlags/statsig/integration.ts +++ b/packages/browser/src/integrations/featureFlags/statsig/integration.ts @@ -1,10 +1,10 @@ -import type { Client, Event, EventHint, IntegrationFn } from '@sentry/core/browser'; +import type { Client, Event, EventHint, IntegrationFn } from '@sentry/core'; import { _INTERNAL_addFeatureFlagToActiveSpan, _INTERNAL_copyFlagsFromScopeToEvent, _INTERNAL_insertFlagToScope, defineIntegration, -} from '@sentry/core/browser'; +} from '@sentry/core'; import type { FeatureGate, StatsigClient } from './types'; /** diff --git a/packages/browser/src/integrations/featureFlags/unleash/integration.ts b/packages/browser/src/integrations/featureFlags/unleash/integration.ts index 08fb93e3474b..07319ed6735d 100644 --- a/packages/browser/src/integrations/featureFlags/unleash/integration.ts +++ b/packages/browser/src/integrations/featureFlags/unleash/integration.ts @@ -1,4 +1,4 @@ -import type { Client, Event, EventHint, IntegrationFn } from '@sentry/core/browser'; +import type { Client, Event, EventHint, IntegrationFn } from '@sentry/core'; import { _INTERNAL_addFeatureFlagToActiveSpan, _INTERNAL_copyFlagsFromScopeToEvent, @@ -6,7 +6,7 @@ import { debug, defineIntegration, fill, -} from '@sentry/core/browser'; +} from '@sentry/core'; import { DEBUG_BUILD } from '../../../debug-build'; import type { UnleashClient, UnleashClientClass } from './types'; diff --git a/packages/browser/src/integrations/fetchStreamPerformance.ts b/packages/browser/src/integrations/fetchStreamPerformance.ts index 1ce28cd46a5d..2a5c0dc9c103 100644 --- a/packages/browser/src/integrations/fetchStreamPerformance.ts +++ b/packages/browser/src/integrations/fetchStreamPerformance.ts @@ -12,8 +12,8 @@ import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, stripDataUrlContent, filterCollectedUrl, - startInactiveSpan, -} from '@sentry/core/browser'; +} from '@sentry/core'; +import { startInactiveSpan } from '@sentry/core/browser'; import { WINDOW } from '../helpers'; const responseToStreamSpan = new WeakMap(); diff --git a/packages/browser/src/integrations/globalhandlers.ts b/packages/browser/src/integrations/globalhandlers.ts index 106f859326bf..0dbeb46a0fce 100644 --- a/packages/browser/src/integrations/globalhandlers.ts +++ b/packages/browser/src/integrations/globalhandlers.ts @@ -1,4 +1,4 @@ -import type { Client, Event, IntegrationFn, Primitive, StackParser } from '@sentry/core/browser'; +import type { Client, Event, IntegrationFn, Primitive, StackParser } from '@sentry/core'; import { addGlobalErrorInstrumentationHandler, addGlobalUnhandledRejectionInstrumentationHandler, @@ -10,7 +10,7 @@ import { isString, stripDataUrlContent, UNKNOWN_FUNCTION, -} from '@sentry/core/browser'; +} from '@sentry/core'; import type { BrowserClient } from '../client'; import { DEBUG_BUILD } from '../debug-build'; import { getLocationHref } from '@sentry/browser-utils'; diff --git a/packages/browser/src/integrations/graphqlClient.ts b/packages/browser/src/integrations/graphqlClient.ts index 42f64ff02a66..643ced098f0f 100644 --- a/packages/browser/src/integrations/graphqlClient.ts +++ b/packages/browser/src/integrations/graphqlClient.ts @@ -1,4 +1,4 @@ -import type { Client, IntegrationFn } from '@sentry/core/browser'; +import type { Client, IntegrationFn } from '@sentry/core'; import { defineIntegration, hasSpanStreamingEnabled, @@ -7,7 +7,7 @@ import { SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD, spanToJSON, stringMatchesSomePattern, -} from '@sentry/core/browser'; +} from '@sentry/core'; import type { FetchHint, XhrHint } from '@sentry/browser-utils'; import { getBodyString, getFetchRequestArgBody, SENTRY_XHR_DATA_KEY } from '@sentry/browser-utils'; import { diff --git a/packages/browser/src/integrations/httpclient.ts b/packages/browser/src/integrations/httpclient.ts index cc07b9ecddab..f9d01c5719b5 100644 --- a/packages/browser/src/integrations/httpclient.ts +++ b/packages/browser/src/integrations/httpclient.ts @@ -1,4 +1,4 @@ -import type { Client, Event as SentryEvent, IntegrationFn } from '@sentry/core/browser'; +import type { Client, Event as SentryEvent, IntegrationFn } from '@sentry/core'; import { _INTERNAL_filterCookies, _INTERNAL_filterKeyValueData, @@ -10,7 +10,7 @@ import { getClient, GLOBAL_OBJ, isSentryRequestUrl, -} from '@sentry/core/browser'; +} from '@sentry/core'; import type { SentryWrappedXMLHttpRequest } from '@sentry/browser-utils'; import { addXhrInstrumentationHandler, SENTRY_XHR_DATA_KEY } from '@sentry/browser-utils'; import { DEBUG_BUILD } from '../debug-build'; diff --git a/packages/browser/src/integrations/httpcontext.ts b/packages/browser/src/integrations/httpcontext.ts index 8c7f249a8a94..c45f9235793e 100644 --- a/packages/browser/src/integrations/httpcontext.ts +++ b/packages/browser/src/integrations/httpcontext.ts @@ -3,7 +3,7 @@ import { defineIntegration, safeSetSpanJSONAttributes, SEMANTIC_ATTRIBUTE_SENTRY_OP, -} from '@sentry/core/browser'; +} from '@sentry/core'; import { getHttpRequestData, WINDOW } from '../helpers'; import { filterCollectedUrl } from '@sentry/core'; import { URL_FULL } from '@sentry/conventions/attributes'; diff --git a/packages/browser/src/integrations/linkederrors.ts b/packages/browser/src/integrations/linkederrors.ts index 7664f6c62da5..e6a0cafaf52d 100644 --- a/packages/browser/src/integrations/linkederrors.ts +++ b/packages/browser/src/integrations/linkederrors.ts @@ -1,5 +1,5 @@ -import type { IntegrationFn } from '@sentry/core/browser'; -import { applyAggregateErrorsToEvent, defineIntegration } from '@sentry/core/browser'; +import type { IntegrationFn } from '@sentry/core'; +import { applyAggregateErrorsToEvent, defineIntegration } from '@sentry/core'; import { exceptionFromError } from '../eventbuilder'; interface LinkedErrorsOptions { diff --git a/packages/browser/src/integrations/reportingobserver.ts b/packages/browser/src/integrations/reportingobserver.ts index 91ad2a06e6b0..21ca1307f255 100644 --- a/packages/browser/src/integrations/reportingobserver.ts +++ b/packages/browser/src/integrations/reportingobserver.ts @@ -1,5 +1,5 @@ -import type { Client, IntegrationFn } from '@sentry/core/browser'; -import { captureMessage, defineIntegration, getClient, GLOBAL_OBJ, withScope } from '@sentry/core/browser'; +import type { Client, IntegrationFn } from '@sentry/core'; +import { captureMessage, defineIntegration, getClient, GLOBAL_OBJ, withScope } from '@sentry/core'; const WINDOW = GLOBAL_OBJ as typeof GLOBAL_OBJ & Window; diff --git a/packages/browser/src/integrations/spotlight.ts b/packages/browser/src/integrations/spotlight.ts index b8e069771da4..0a2ec3f85ed5 100644 --- a/packages/browser/src/integrations/spotlight.ts +++ b/packages/browser/src/integrations/spotlight.ts @@ -1,5 +1,5 @@ -import type { Client, Envelope, IntegrationFn } from '@sentry/core/browser'; -import { debug, defineIntegration, serializeEnvelope } from '@sentry/core/browser'; +import type { Client, Envelope, IntegrationFn } from '@sentry/core'; +import { debug, defineIntegration, serializeEnvelope } from '@sentry/core'; import { getNativeImplementation } from '@sentry/browser-utils'; import { UI_INTERACTION_CLICK } from '@sentry/conventions/op'; import { DEBUG_BUILD } from '../debug-build'; diff --git a/packages/browser/src/integrations/view-hierarchy.ts b/packages/browser/src/integrations/view-hierarchy.ts index 11be97b4d108..da4015470b9a 100644 --- a/packages/browser/src/integrations/view-hierarchy.ts +++ b/packages/browser/src/integrations/view-hierarchy.ts @@ -1,5 +1,5 @@ -import type { Attachment, Event, EventHint, ViewHierarchyData, ViewHierarchyWindow } from '@sentry/core/browser'; -import { defineIntegration } from '@sentry/core/browser'; +import type { Attachment, Event, EventHint, ViewHierarchyData, ViewHierarchyWindow } from '@sentry/core'; +import { defineIntegration } from '@sentry/core'; import { getComponentName } from '@sentry/browser-utils'; import { WINDOW } from '../helpers'; diff --git a/packages/browser/src/integrations/webVitals.ts b/packages/browser/src/integrations/webVitals.ts index a8b969a0ff6e..33a99cb29e43 100644 --- a/packages/browser/src/integrations/webVitals.ts +++ b/packages/browser/src/integrations/webVitals.ts @@ -1,5 +1,5 @@ -import type { IntegrationFn, Span } from '@sentry/core/browser'; -import { defineIntegration, hasSpanStreamingEnabled } from '@sentry/core/browser'; +import type { IntegrationFn, Span } from '@sentry/core'; +import { defineIntegration, hasSpanStreamingEnabled } from '@sentry/core'; import { addWebVitalsToSpan, registerInpInteractionListener, diff --git a/packages/browser/src/integrations/webWorker.ts b/packages/browser/src/integrations/webWorker.ts index 87ed7f6deedd..e9a8e338d287 100644 --- a/packages/browser/src/integrations/webWorker.ts +++ b/packages/browser/src/integrations/webWorker.ts @@ -1,5 +1,5 @@ -import type { DebugImage, Integration, IntegrationFn } from '@sentry/core/browser'; -import { captureEvent, debug, defineIntegration, getClient, isPlainObject, isPrimitive } from '@sentry/core/browser'; +import type { DebugImage, Integration, IntegrationFn } from '@sentry/core'; +import { captureEvent, debug, defineIntegration, getClient, isPlainObject, isPrimitive } from '@sentry/core'; import { DEBUG_BUILD } from '../debug-build'; import { eventFromUnknownInput } from '../eventbuilder'; import { WINDOW } from '../helpers'; diff --git a/packages/browser/src/pluggable-exports-bundle/index.multiplexedtransport.ts b/packages/browser/src/pluggable-exports-bundle/index.multiplexedtransport.ts index a0b137cb1a53..a7d637d9e62f 100644 --- a/packages/browser/src/pluggable-exports-bundle/index.multiplexedtransport.ts +++ b/packages/browser/src/pluggable-exports-bundle/index.multiplexedtransport.ts @@ -1 +1 @@ -export { makeMultiplexedTransport } from '@sentry/core/browser'; +export { makeMultiplexedTransport } from '@sentry/core'; diff --git a/packages/browser/src/profiling/UIProfiler.ts b/packages/browser/src/profiling/UIProfiler.ts index e64f7720710b..c14201b8297c 100644 --- a/packages/browser/src/profiling/UIProfiler.ts +++ b/packages/browser/src/profiling/UIProfiler.ts @@ -1,4 +1,4 @@ -import type { Client, ContinuousProfiler, ProfileChunk, ProfileChunkEnvelope, Span } from '@sentry/core/browser'; +import type { Client, ContinuousProfiler, ProfileChunk, ProfileChunkEnvelope, Span } from '@sentry/core'; import { createEnvelope, debug, @@ -7,7 +7,7 @@ import { getRootSpan, getSdkMetadataForEnvelopeHeader, uuid4, -} from '@sentry/core/browser'; +} from '@sentry/core'; import type { BrowserOptions } from '../client'; import { DEBUG_BUILD } from './../debug-build'; import type { JSSelfProfiler } from './jsSelfProfiling'; diff --git a/packages/browser/src/profiling/index.ts b/packages/browser/src/profiling/index.ts index 477532821ed6..411365ebe677 100644 --- a/packages/browser/src/profiling/index.ts +++ b/packages/browser/src/profiling/index.ts @@ -1,5 +1,5 @@ -import type { Profiler } from '@sentry/core/browser'; -import { debug, getClient } from '@sentry/core/browser'; +import type { Profiler } from '@sentry/core'; +import { debug, getClient } from '@sentry/core'; import { DEBUG_BUILD } from '../debug-build'; /** diff --git a/packages/browser/src/profiling/integration.ts b/packages/browser/src/profiling/integration.ts index 50965380c4c5..eba0cf24aea8 100644 --- a/packages/browser/src/profiling/integration.ts +++ b/packages/browser/src/profiling/integration.ts @@ -1,5 +1,5 @@ -import type { IntegrationFn } from '@sentry/core/browser'; -import { debug, defineIntegration, getActiveSpan, getRootSpan, hasSpansEnabled } from '@sentry/core/browser'; +import type { IntegrationFn } from '@sentry/core'; +import { debug, defineIntegration, getActiveSpan, getRootSpan, hasSpansEnabled } from '@sentry/core'; import type { BrowserOptions } from '../client'; import { DEBUG_BUILD } from '../debug-build'; import { WINDOW } from '../helpers'; diff --git a/packages/browser/src/profiling/utils.ts b/packages/browser/src/profiling/utils.ts index 5e1acccff83a..2669e121ac97 100644 --- a/packages/browser/src/profiling/utils.ts +++ b/packages/browser/src/profiling/utils.ts @@ -1,5 +1,5 @@ /* eslint-disable max-lines */ -import type { Client, ContinuousThreadCpuProfile, DebugImage, ProfileChunk, Span } from '@sentry/core/browser'; +import type { Client, ContinuousThreadCpuProfile, DebugImage, ProfileChunk, Span } from '@sentry/core'; import { browserPerformanceTimeOrigin, debug, @@ -7,7 +7,7 @@ import { getDebugImagesForResources, GLOBAL_OBJ, uuid4, -} from '@sentry/core/browser'; +} from '@sentry/core'; import type { BrowserOptions } from '../client'; import { DEBUG_BUILD } from '../debug-build'; import { WINDOW } from '../helpers'; diff --git a/packages/browser/src/report-dialog.ts b/packages/browser/src/report-dialog.ts index beb6f7ec9c08..03255a7db91d 100644 --- a/packages/browser/src/report-dialog.ts +++ b/packages/browser/src/report-dialog.ts @@ -1,5 +1,5 @@ -import type { ReportDialogOptions } from '@sentry/core/browser'; -import { debug, getClient, getCurrentScope, getReportDialogEndpoint, lastEventId } from '@sentry/core/browser'; +import type { ReportDialogOptions } from '@sentry/core'; +import { debug, getClient, getCurrentScope, getReportDialogEndpoint, lastEventId } from '@sentry/core'; import { DEBUG_BUILD } from './debug-build'; import { WINDOW } from './helpers'; diff --git a/packages/browser/src/sdk.ts b/packages/browser/src/sdk.ts index 9384e53821c6..970976ff4f9d 100644 --- a/packages/browser/src/sdk.ts +++ b/packages/browser/src/sdk.ts @@ -1,4 +1,4 @@ -import type { Client, Integration, Options } from '@sentry/core/browser'; +import type { Client, Integration, Options } from '@sentry/core'; import { conversationIdIntegration, dedupeIntegration, @@ -8,7 +8,7 @@ import { initAndBind, setNormalizeStringifier, stackParserFromStackParserOptions, -} from '@sentry/core/browser'; +} from '@sentry/core'; import type { BrowserClientOptions, BrowserOptions } from './client'; import { BrowserClient } from './client'; import { breadcrumbsIntegration } from './integrations/breadcrumbs'; diff --git a/packages/browser/src/stack-parsers.ts b/packages/browser/src/stack-parsers.ts index 9214dac42707..cb74bc1e6ce6 100644 --- a/packages/browser/src/stack-parsers.ts +++ b/packages/browser/src/stack-parsers.ts @@ -23,8 +23,8 @@ // CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE // OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -import type { StackFrame, StackLineParser, StackLineParserFn } from '@sentry/core/browser'; -import { createStackParser, UNKNOWN_FUNCTION } from '@sentry/core/browser'; +import type { StackFrame, StackLineParser, StackLineParserFn } from '@sentry/core'; +import { createStackParser, UNKNOWN_FUNCTION } from '@sentry/core'; const OPERA10_PRIORITY = 10; const OPERA11_PRIORITY = 20; diff --git a/packages/browser/src/tracing/backgroundtab.ts b/packages/browser/src/tracing/backgroundtab.ts index a0e518c977e7..5867a4e07997 100644 --- a/packages/browser/src/tracing/backgroundtab.ts +++ b/packages/browser/src/tracing/backgroundtab.ts @@ -1,4 +1,4 @@ -import { debug, getActiveSpan, getRootSpan, SPAN_STATUS_ERROR, spanToJSON } from '@sentry/core/browser'; +import { debug, getActiveSpan, getRootSpan, SPAN_STATUS_ERROR, spanToJSON } from '@sentry/core'; import { DEBUG_BUILD } from '../debug-build'; import { WINDOW } from '../helpers'; import { SENTRY_OP } from '@sentry/conventions/attributes'; diff --git a/packages/browser/src/tracing/browserTracingIntegration.ts b/packages/browser/src/tracing/browserTracingIntegration.ts index 49e6abf319c5..271556e7e61a 100644 --- a/packages/browser/src/tracing/browserTracingIntegration.ts +++ b/packages/browser/src/tracing/browserTracingIntegration.ts @@ -1,14 +1,6 @@ /* eslint-disable max-lines */ -import type { - Client, - IntegrationFn, - RequestHookInfo, - ResponseHookInfo, - Span, - StartSpanOptions, -} from '@sentry/core/browser'; +import type { Client, IntegrationFn, RequestHookInfo, ResponseHookInfo, Span, StartSpanOptions } from '@sentry/core'; import { - _INTERNAL_ensureBrowserSpanStreaming, addNonEnumerableProperty, consoleSandbox, dateTimestampInSeconds, @@ -31,12 +23,11 @@ import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, spanIsSampled, spanToJSON, - startIdleSpan, - startInactiveSpan, timestampInSeconds, TRACING_DEFAULTS, browserPerformanceTimeOrigin, -} from '@sentry/core/browser'; +} from '@sentry/core'; +import { _INTERNAL_ensureBrowserSpanStreaming, startIdleSpan, startInactiveSpan } from '@sentry/core/browser'; import { addHistoryInstrumentationHandler, addPerformanceEntries, diff --git a/packages/browser/src/tracing/linkedTraces.ts b/packages/browser/src/tracing/linkedTraces.ts index 867a08a800e9..ccd4eae2a767 100644 --- a/packages/browser/src/tracing/linkedTraces.ts +++ b/packages/browser/src/tracing/linkedTraces.ts @@ -1,4 +1,4 @@ -import type { Client, PropagationContext, Span, SpanContextData } from '@sentry/core/browser'; +import type { Client, PropagationContext, Span, SpanContextData } from '@sentry/core'; import { debug, getCurrentScope, @@ -7,7 +7,7 @@ import { SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_LINK_ATTRIBUTE_LINK_TYPE, spanToJSON, -} from '@sentry/core/browser'; +} from '@sentry/core'; import { DEBUG_BUILD } from '../debug-build'; import { WINDOW } from '../exports'; import { SENTRY_OP } from '@sentry/conventions/attributes'; @@ -233,7 +233,7 @@ export function getPreviousTraceFromSessionStorage(): PreviousTraceInfo | undefi } /** - * see {@link import('@sentry/core/browser').spanIsSampled} + * see {@link import('@sentry/core').spanIsSampled} */ export function spanContextSampled(ctx: SpanContextData): boolean { return ctx.traceFlags === 0x1; diff --git a/packages/browser/src/tracing/reportPageLoaded.ts b/packages/browser/src/tracing/reportPageLoaded.ts index fbd5e3a49933..2d3d4a4991a4 100644 --- a/packages/browser/src/tracing/reportPageLoaded.ts +++ b/packages/browser/src/tracing/reportPageLoaded.ts @@ -1,5 +1,5 @@ -import type { Client } from '@sentry/core/browser'; -import { getClient } from '@sentry/core/browser'; +import type { Client } from '@sentry/core'; +import { getClient } from '@sentry/core'; /** * Manually report the end of the page load, resulting in the SDK ending the pageload span. diff --git a/packages/browser/src/tracing/request.ts b/packages/browser/src/tracing/request.ts index ffc548512a56..2320f12cba6f 100644 --- a/packages/browser/src/tracing/request.ts +++ b/packages/browser/src/tracing/request.ts @@ -1,5 +1,5 @@ /* eslint-disable max-lines */ -import type { Client, RequestHookInfo, ResponseHookInfo, Span, SpanTimeInput } from '@sentry/core/browser'; +import type { Client, RequestHookInfo, ResponseHookInfo, Span, SpanTimeInput } from '@sentry/core'; import { addFetchInstrumentationHandler, getActiveSpan, @@ -18,11 +18,11 @@ import { setHttpStatus, spanIsIgnored, spanToJSON, - startInactiveSpan, stripDataUrlContent, stripUrlQueryAndFragment, timestampInSeconds, -} from '@sentry/core/browser'; +} from '@sentry/core'; +import { startInactiveSpan } from '@sentry/core/browser'; import type { HandlerDataXhr, SentryWrappedXMLHttpRequest, XhrHint } from '@sentry/browser-utils'; import { filterCollectedUrl, filterCollectedUrlQuery } from '@sentry/core'; import { diff --git a/packages/browser/src/tracing/setActiveSpan.ts b/packages/browser/src/tracing/setActiveSpan.ts index be1cb52adc06..5e3b537d4b6d 100644 --- a/packages/browser/src/tracing/setActiveSpan.ts +++ b/packages/browser/src/tracing/setActiveSpan.ts @@ -1,5 +1,5 @@ -import type { Span } from '@sentry/core/browser'; -import { _INTERNAL_setSpanForScope, getActiveSpan, getCurrentScope } from '@sentry/core/browser'; +import type { Span } from '@sentry/core'; +import { _INTERNAL_setSpanForScope, getActiveSpan, getCurrentScope } from '@sentry/core'; /** * Sets an inactive span active on the current scope. diff --git a/packages/browser/src/transports/fetch.ts b/packages/browser/src/transports/fetch.ts index be4d80314f00..83e3905de35c 100644 --- a/packages/browser/src/transports/fetch.ts +++ b/packages/browser/src/transports/fetch.ts @@ -1,5 +1,5 @@ -import type { Transport, TransportMakeRequestResponse, TransportRequest } from '@sentry/core/browser'; -import { createTransport, makePromiseBuffer } from '@sentry/core/browser'; +import type { Transport, TransportMakeRequestResponse, TransportRequest } from '@sentry/core'; +import { createTransport, makePromiseBuffer } from '@sentry/core'; import { clearCachedImplementation, getNativeImplementation } from '@sentry/browser-utils'; import type { WINDOW } from '../helpers'; import type { BrowserTransportOptions } from './types'; diff --git a/packages/browser/src/transports/offline.ts b/packages/browser/src/transports/offline.ts index c965e3aa5c15..c644e72fbf39 100644 --- a/packages/browser/src/transports/offline.ts +++ b/packages/browser/src/transports/offline.ts @@ -1,11 +1,5 @@ -import type { - BaseTransportOptions, - Envelope, - OfflineStore, - OfflineTransportOptions, - Transport, -} from '@sentry/core/browser'; -import { makeOfflineTransport, parseEnvelope, serializeEnvelope } from '@sentry/core/browser'; +import type { BaseTransportOptions, Envelope, OfflineStore, OfflineTransportOptions, Transport } from '@sentry/core'; +import { makeOfflineTransport, parseEnvelope, serializeEnvelope } from '@sentry/core'; import { WINDOW } from '../helpers'; import { makeFetchTransport } from './fetch'; diff --git a/packages/browser/src/transports/types.ts b/packages/browser/src/transports/types.ts index e2a00e9a12d8..a304e9f93d66 100644 --- a/packages/browser/src/transports/types.ts +++ b/packages/browser/src/transports/types.ts @@ -1,4 +1,4 @@ -import type { BaseTransportOptions } from '@sentry/core/browser'; +import type { BaseTransportOptions } from '@sentry/core'; export interface BrowserTransportOptions extends BaseTransportOptions { /** Fetch API init parameters. Used by the FetchTransport */ diff --git a/packages/browser/src/userfeedback.ts b/packages/browser/src/userfeedback.ts index f77699dd1c75..bc6fd248b480 100644 --- a/packages/browser/src/userfeedback.ts +++ b/packages/browser/src/userfeedback.ts @@ -1,5 +1,5 @@ -import type { DsnComponents, EventEnvelope, SdkMetadata, UserFeedback, UserFeedbackItem } from '@sentry/core/browser'; -import { createEnvelope, dsnToString } from '@sentry/core/browser'; +import type { DsnComponents, EventEnvelope, SdkMetadata, UserFeedback, UserFeedbackItem } from '@sentry/core'; +import { createEnvelope, dsnToString } from '@sentry/core'; /** * Creates an envelope from a user feedback. diff --git a/packages/browser/src/utils/detectBrowserExtension.ts b/packages/browser/src/utils/detectBrowserExtension.ts index 9851adc2225a..7bc29d6c4e7f 100644 --- a/packages/browser/src/utils/detectBrowserExtension.ts +++ b/packages/browser/src/utils/detectBrowserExtension.ts @@ -1,5 +1,5 @@ import { getLocationHref } from '@sentry/browser-utils'; -import { consoleSandbox } from '@sentry/core/browser'; +import { consoleSandbox } from '@sentry/core'; import { DEBUG_BUILD } from '../debug-build'; import { WINDOW } from '../helpers'; diff --git a/packages/browser/src/utils/lazyLoadIntegration.ts b/packages/browser/src/utils/lazyLoadIntegration.ts index fec5bbcd9e5e..6b260caeb2a7 100644 --- a/packages/browser/src/utils/lazyLoadIntegration.ts +++ b/packages/browser/src/utils/lazyLoadIntegration.ts @@ -1,5 +1,5 @@ -import type { IntegrationFn } from '@sentry/core/browser'; -import { getClient, SDK_VERSION } from '@sentry/core/browser'; +import type { IntegrationFn } from '@sentry/core'; +import { getClient, SDK_VERSION } from '@sentry/core'; import type { BrowserClient } from '../client'; import { WINDOW } from '../helpers'; diff --git a/packages/browser/test/client.test.ts b/packages/browser/test/client.test.ts index 2eeaef540aa3..cc7a6cbbafc9 100644 --- a/packages/browser/test/client.test.ts +++ b/packages/browser/test/client.test.ts @@ -2,7 +2,7 @@ * @vitest-environment jsdom */ -import { getCurrentScope, makeSession, setCurrentClient } from '@sentry/core/browser'; +import { getCurrentScope, makeSession, setCurrentClient } from '@sentry/core'; import { afterEach, describe, expect, it, vi } from 'vitest'; import { applyDefaultOptions, BrowserClient } from '../src/client'; import { WINDOW } from '../src/helpers'; diff --git a/packages/browser/test/diagnose-sdk.test.ts b/packages/browser/test/diagnose-sdk.test.ts index 6161891424b2..85b60047361e 100644 --- a/packages/browser/test/diagnose-sdk.test.ts +++ b/packages/browser/test/diagnose-sdk.test.ts @@ -2,13 +2,13 @@ * @vitest-environment jsdom */ -import type { Client } from '@sentry/core/browser'; -import * as sentryCore from '@sentry/core/browser'; +import type { Client } from '@sentry/core'; +import * as sentryCore from '@sentry/core'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { diagnoseSdkConnectivity } from '../src/diagnose-sdk'; // Mock the @sentry/core module -vi.mock('@sentry/core/browser', async requireActual => { +vi.mock('@sentry/core', async requireActual => { return { ...((await requireActual()) as any), getClient: vi.fn(), diff --git a/packages/browser/test/eventbuilder.test.ts b/packages/browser/test/eventbuilder.test.ts index 408f6e60a658..651cb8342f47 100644 --- a/packages/browser/test/eventbuilder.test.ts +++ b/packages/browser/test/eventbuilder.test.ts @@ -3,12 +3,12 @@ */ import { runInNewContext } from 'node:vm'; -import { addNonEnumerableProperty } from '@sentry/core/browser'; +import { addNonEnumerableProperty } from '@sentry/core'; import { afterEach, describe, expect, it, vi } from 'vitest'; import { defaultStackParser } from '../src'; import { eventFromMessage, eventFromUnknownInput, extractMessage, extractType } from '../src/eventbuilder'; -vi.mock('@sentry/core/browser', async requireActual => { +vi.mock('@sentry/core', async requireActual => { return { ...((await requireActual()) as any), getClient() { diff --git a/packages/browser/test/helper/browser-client-options.ts b/packages/browser/test/helper/browser-client-options.ts index 825bfb47a672..237f3cec0e05 100644 --- a/packages/browser/test/helper/browser-client-options.ts +++ b/packages/browser/test/helper/browser-client-options.ts @@ -1,4 +1,4 @@ -import { createTransport, resolvedSyncPromise } from '@sentry/core/browser'; +import { createTransport, resolvedSyncPromise } from '@sentry/core'; import type { BrowserClientOptions } from '../../src/client'; export function getDefaultBrowserClientOptions(options: Partial = {}): BrowserClientOptions { diff --git a/packages/browser/test/helpers.test.ts b/packages/browser/test/helpers.test.ts index 0d095b737e56..740ff2ecd7e6 100644 --- a/packages/browser/test/helpers.test.ts +++ b/packages/browser/test/helpers.test.ts @@ -1,4 +1,4 @@ -import type { WrappedFunction } from '@sentry/core/browser'; +import type { WrappedFunction } from '@sentry/core'; import { describe, expect, it, vi } from 'vitest'; import { wrap } from '../src/helpers'; diff --git a/packages/browser/test/index.bundle.logs.metrics.test.ts b/packages/browser/test/index.bundle.logs.metrics.test.ts index 31d4254b9433..7d450dc1ced0 100644 --- a/packages/browser/test/index.bundle.logs.metrics.test.ts +++ b/packages/browser/test/index.bundle.logs.metrics.test.ts @@ -1,4 +1,4 @@ -import { logger as coreLogger, metrics as coreMetrics } from '@sentry/core/browser'; +import { logger as coreLogger, metrics as coreMetrics } from '@sentry/core'; import { spanStreamingIntegrationShim } from '@sentry-internal/integration-shims'; import { describe, expect, it } from 'vitest'; import * as LogsMetricsBundle from '../src/index.bundle.logs.metrics'; diff --git a/packages/browser/test/index.bundle.replay.logs.metrics.test.ts b/packages/browser/test/index.bundle.replay.logs.metrics.test.ts index 5e39b4111b63..d6bb995fae09 100644 --- a/packages/browser/test/index.bundle.replay.logs.metrics.test.ts +++ b/packages/browser/test/index.bundle.replay.logs.metrics.test.ts @@ -1,4 +1,4 @@ -import { logger as coreLogger, metrics as coreMetrics } from '@sentry/core/browser'; +import { logger as coreLogger, metrics as coreMetrics } from '@sentry/core'; import { browserTracingIntegrationShim, feedbackIntegrationShim, diff --git a/packages/browser/test/index.bundle.tracing.logs.metrics.test.ts b/packages/browser/test/index.bundle.tracing.logs.metrics.test.ts index 81d239c8ff2d..05f143f1f553 100644 --- a/packages/browser/test/index.bundle.tracing.logs.metrics.test.ts +++ b/packages/browser/test/index.bundle.tracing.logs.metrics.test.ts @@ -1,4 +1,4 @@ -import { logger as coreLogger, metrics as coreMetrics } from '@sentry/core/browser'; +import { logger as coreLogger, metrics as coreMetrics } from '@sentry/core'; import { feedbackIntegrationShim, replayIntegrationShim } from '@sentry-internal/integration-shims'; import { describe, expect, it } from 'vitest'; import { browserTracingIntegration, spanStreamingIntegration, webVitalsIntegration } from '../src'; diff --git a/packages/browser/test/index.bundle.tracing.replay.feedback.logs.metrics.test.ts b/packages/browser/test/index.bundle.tracing.replay.feedback.logs.metrics.test.ts index dcb7b869aa4d..a7b36563b1a3 100644 --- a/packages/browser/test/index.bundle.tracing.replay.feedback.logs.metrics.test.ts +++ b/packages/browser/test/index.bundle.tracing.replay.feedback.logs.metrics.test.ts @@ -1,4 +1,4 @@ -import { logger as coreLogger, metrics as coreMetrics } from '@sentry/core/browser'; +import { logger as coreLogger, metrics as coreMetrics } from '@sentry/core'; import { describe, expect, it } from 'vitest'; import { browserTracingIntegration, diff --git a/packages/browser/test/index.bundle.tracing.replay.logs.metrics.test.ts b/packages/browser/test/index.bundle.tracing.replay.logs.metrics.test.ts index aecd1c995dda..610534f5602f 100644 --- a/packages/browser/test/index.bundle.tracing.replay.logs.metrics.test.ts +++ b/packages/browser/test/index.bundle.tracing.replay.logs.metrics.test.ts @@ -1,4 +1,4 @@ -import { logger as coreLogger, metrics as coreMetrics } from '@sentry/core/browser'; +import { logger as coreLogger, metrics as coreMetrics } from '@sentry/core'; import { feedbackIntegrationShim } from '@sentry-internal/integration-shims'; import { describe, expect, it } from 'vitest'; import { browserTracingIntegration, replayIntegration, spanStreamingIntegration, webVitalsIntegration } from '../src'; diff --git a/packages/browser/test/index.test.ts b/packages/browser/test/index.test.ts index a2281f3d97b1..4a0986048cf1 100644 --- a/packages/browser/test/index.test.ts +++ b/packages/browser/test/index.test.ts @@ -8,8 +8,8 @@ import { getReportDialogEndpoint, lastEventId, SDK_VERSION, -} from '@sentry/core/browser'; -import * as utils from '@sentry/core/browser'; +} from '@sentry/core'; +import * as utils from '@sentry/core'; import type { Mock } from 'vitest'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { @@ -37,7 +37,7 @@ const dsn = 'https://53039209a22b4ec1bcc296a3c9fdecd6@sentry.io/4291'; // eslint-disable-next-line no-var declare var global: any; -vi.mock('@sentry/core/browser', async requireActual => { +vi.mock('@sentry/core', async requireActual => { return { ...((await requireActual()) as any), getReportDialogEndpoint: vi.fn(), diff --git a/packages/browser/test/integrations/bfcacheMetrics.test.ts b/packages/browser/test/integrations/bfcacheMetrics.test.ts index 6f04081f948e..42b51dd58d14 100644 --- a/packages/browser/test/integrations/bfcacheMetrics.test.ts +++ b/packages/browser/test/integrations/bfcacheMetrics.test.ts @@ -1,5 +1,5 @@ import { afterEach, describe, expect, it, vi } from 'vitest'; -import { debug } from '@sentry/core/browser'; +import { debug } from '@sentry/core'; import { _collectNotRestoredReasons, _resolveMaxReasons } from '../../src/integrations/bfcacheMetrics'; describe('bfcacheMetricsIntegration', () => { diff --git a/packages/browser/test/integrations/breadcrumbs.test.ts b/packages/browser/test/integrations/breadcrumbs.test.ts index 3ee91da9be13..56df65c3a6ae 100644 --- a/packages/browser/test/integrations/breadcrumbs.test.ts +++ b/packages/browser/test/integrations/breadcrumbs.test.ts @@ -1,4 +1,4 @@ -import * as SentryCore from '@sentry/core/browser'; +import * as SentryCore from '@sentry/core'; import { describe, expect, it, vi } from 'vitest'; import { breadcrumbsIntegration, BrowserClient, flush } from '../../src'; import { getDefaultBrowserClientOptions } from '../helper/browser-client-options'; diff --git a/packages/browser/test/integrations/browsersession.test.ts b/packages/browser/test/integrations/browsersession.test.ts index 4c7e487ad785..fbb4dc0f05f1 100644 --- a/packages/browser/test/integrations/browsersession.test.ts +++ b/packages/browser/test/integrations/browsersession.test.ts @@ -3,8 +3,8 @@ */ import type * as BrowserUtils from '@sentry/browser-utils'; -import type { Scope, User } from '@sentry/core/browser'; -import * as SentryCore from '@sentry/core/browser'; +import type { Scope, User } from '@sentry/core'; +import * as SentryCore from '@sentry/core'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { browserSessionIntegration } from '../../src/integrations/browsersession'; @@ -12,7 +12,7 @@ const scopeHolder = vi.hoisted(() => ({ current: undefined as unknown as FakeIso const historyHandlers = vi.hoisted(() => ({ current: [] as Array<(data: { from?: string; to?: string }) => void> })); -vi.mock('@sentry/core/browser', async importActual => { +vi.mock('@sentry/core', async importActual => { const actual = (await importActual()) as typeof SentryCore; return { ...actual, diff --git a/packages/browser/test/integrations/contextlines.test.ts b/packages/browser/test/integrations/contextlines.test.ts index ffb062759d9c..e34479cd644e 100644 --- a/packages/browser/test/integrations/contextlines.test.ts +++ b/packages/browser/test/integrations/contextlines.test.ts @@ -1,4 +1,4 @@ -import type { StackFrame } from '@sentry/core/browser'; +import type { StackFrame } from '@sentry/core'; import { describe, expect, it } from 'vitest'; import { applySourceContextToFrame } from '../../src/integrations/contextlines'; diff --git a/packages/browser/test/integrations/featureFlags/growthbook/integration.test.ts b/packages/browser/test/integrations/featureFlags/growthbook/integration.test.ts index eba3f2777e4d..5b9e0b3281c5 100644 --- a/packages/browser/test/integrations/featureFlags/growthbook/integration.test.ts +++ b/packages/browser/test/integrations/featureFlags/growthbook/integration.test.ts @@ -1,4 +1,4 @@ -import { getCurrentScope, getMainCarrier } from '@sentry/core/browser'; +import { getCurrentScope, getMainCarrier } from '@sentry/core'; import { afterEach, describe, expect, it } from 'vitest'; import { growthbookIntegration } from '../../../../src/integrations/featureFlags/growthbook'; diff --git a/packages/browser/test/integrations/fetchStreamPerformance.test.ts b/packages/browser/test/integrations/fetchStreamPerformance.test.ts index 8dcf1cba3242..b74919be9430 100644 --- a/packages/browser/test/integrations/fetchStreamPerformance.test.ts +++ b/packages/browser/test/integrations/fetchStreamPerformance.test.ts @@ -1,5 +1,6 @@ -import type { Client, HandlerDataFetch } from '@sentry/core/browser'; -import * as utils from '@sentry/core/browser'; +import type { Client, HandlerDataFetch } from '@sentry/core'; +import * as utils from '@sentry/core'; +import * as coreBrowser from '@sentry/core/browser'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { fetchStreamPerformanceIntegration } from '../../src/integrations/fetchStreamPerformance'; @@ -23,7 +24,7 @@ describe('fetchStreamPerformanceIntegration', () => { }); vi.spyOn(utils, 'addFetchEndInstrumentationHandler').mockImplementation(() => () => {}); const startInactiveSpanSpy = vi - .spyOn(utils, 'startInactiveSpan') + .spyOn(coreBrowser, 'startInactiveSpan') .mockReturnValue(new utils.SentryNonRecordingSpan()); fetchStreamPerformanceIntegration().setup?.({ diff --git a/packages/browser/test/integrations/graphqlClient.test.ts b/packages/browser/test/integrations/graphqlClient.test.ts index 97bc06f93449..92dabd9adf53 100644 --- a/packages/browser/test/integrations/graphqlClient.test.ts +++ b/packages/browser/test/integrations/graphqlClient.test.ts @@ -2,8 +2,8 @@ * @vitest-environment jsdom */ -import type { Client } from '@sentry/core/browser'; -import { SentrySpan, spanToJSON } from '@sentry/core/browser'; +import type { Client } from '@sentry/core'; +import { SentrySpan, spanToJSON } from '@sentry/core'; import type { FetchHint, XhrHint } from '@sentry/browser-utils'; import { SENTRY_XHR_DATA_KEY } from '@sentry/browser-utils'; import { URL_FULL } from '@sentry/conventions/attributes'; diff --git a/packages/browser/test/integrations/httpclient.test.ts b/packages/browser/test/integrations/httpclient.test.ts index 63117eef9928..651e51b24d86 100644 --- a/packages/browser/test/integrations/httpclient.test.ts +++ b/packages/browser/test/integrations/httpclient.test.ts @@ -4,8 +4,8 @@ import * as BrowserUtils from '@sentry/browser-utils'; import { SENTRY_XHR_DATA_KEY } from '@sentry/browser-utils'; -import type { Event } from '@sentry/core/browser'; -import * as SentryCore from '@sentry/core/browser'; +import type { Event } from '@sentry/core'; +import * as SentryCore from '@sentry/core'; import type { MockInstance } from 'vitest'; import { afterEach, describe, expect, it, vi } from 'vitest'; import { BrowserClient } from '../../src'; diff --git a/packages/browser/test/integrations/reportingobserver.test.ts b/packages/browser/test/integrations/reportingobserver.test.ts index 18ef38b7a097..4376977a1b1a 100644 --- a/packages/browser/test/integrations/reportingobserver.test.ts +++ b/packages/browser/test/integrations/reportingobserver.test.ts @@ -1,5 +1,5 @@ -import type { Client } from '@sentry/core/browser'; -import * as SentryCore from '@sentry/core/browser'; +import type { Client } from '@sentry/core'; +import * as SentryCore from '@sentry/core'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { reportingObserverIntegration } from '../../src/integrations/reportingobserver'; diff --git a/packages/browser/test/integrations/webWorker.test.ts b/packages/browser/test/integrations/webWorker.test.ts index e824486456da..c239e31bd638 100644 --- a/packages/browser/test/integrations/webWorker.test.ts +++ b/packages/browser/test/integrations/webWorker.test.ts @@ -2,13 +2,13 @@ * @vitest-environment jsdom */ -import * as SentryCore from '@sentry/core/browser'; +import * as SentryCore from '@sentry/core'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import * as helpers from '../../src/helpers'; import { INTEGRATION_NAME, registerWebWorker, webWorkerIntegration } from '../../src/integrations/webWorker'; // Mock @sentry/core -vi.mock('@sentry/core/browser', async importActual => { +vi.mock('@sentry/core', async importActual => { return { ...((await importActual()) as any), debug: { diff --git a/packages/browser/test/mocks/simpletransport.ts b/packages/browser/test/mocks/simpletransport.ts index 9f2f527fba7d..515b0f9c0865 100644 --- a/packages/browser/test/mocks/simpletransport.ts +++ b/packages/browser/test/mocks/simpletransport.ts @@ -1,4 +1,4 @@ -import { createTransport, resolvedSyncPromise } from '@sentry/core/browser'; +import { createTransport, resolvedSyncPromise } from '@sentry/core'; export function makeSimpleTransport() { return createTransport({ recordDroppedEvent: () => undefined }, () => resolvedSyncPromise({})); diff --git a/packages/browser/test/profiling/UIProfiler.test.ts b/packages/browser/test/profiling/UIProfiler.test.ts index 410203816d13..ede606a6eb6a 100644 --- a/packages/browser/test/profiling/UIProfiler.test.ts +++ b/packages/browser/test/profiling/UIProfiler.test.ts @@ -3,7 +3,7 @@ */ import * as Sentry from '@sentry/browser'; -import { debug, type Span } from '@sentry/core/browser'; +import { debug, type Span } from '@sentry/core'; import { afterEach, beforeEach, describe, expect, it, type Mock, vi } from 'vitest'; import type { BrowserOptions } from '../../src/index'; diff --git a/packages/browser/test/profiling/integration.test.ts b/packages/browser/test/profiling/integration.test.ts index 2d5bb25bd843..729157ca08cd 100644 --- a/packages/browser/test/profiling/integration.test.ts +++ b/packages/browser/test/profiling/integration.test.ts @@ -10,7 +10,7 @@ import { browserTracingIntegration, browserProfilingIntegration, } from '../../src/index'; -import { debug } from '@sentry/core/browser'; +import { debug } from '@sentry/core'; import { describe, expect, it, vi } from 'vitest'; import type { BrowserClient } from '../../src/index'; diff --git a/packages/browser/test/sdk.test.ts b/packages/browser/test/sdk.test.ts index 7834285dd2e4..7b983af3635e 100644 --- a/packages/browser/test/sdk.test.ts +++ b/packages/browser/test/sdk.test.ts @@ -3,9 +3,9 @@ */ /* eslint-disable @typescript-eslint/unbound-method */ -import type { Integration } from '@sentry/core/browser'; -import * as SentryCore from '@sentry/core/browser'; -import { createTransport, resolvedSyncPromise } from '@sentry/core/browser'; +import type { Integration } from '@sentry/core'; +import * as SentryCore from '@sentry/core'; +import { createTransport, resolvedSyncPromise } from '@sentry/core'; import type { Mock } from 'vitest'; import { afterEach, describe, expect, it, test, vi } from 'vitest'; import type { BrowserOptions } from '../src'; diff --git a/packages/browser/test/tracekit/ie.test.ts b/packages/browser/test/tracekit/ie.test.ts index ad2328ac6e26..7bf463d39f33 100644 --- a/packages/browser/test/tracekit/ie.test.ts +++ b/packages/browser/test/tracekit/ie.test.ts @@ -1,4 +1,4 @@ -import { createStackParser } from '@sentry/core/browser'; +import { createStackParser } from '@sentry/core'; import { describe, expect, it } from 'vitest'; import { exceptionFromError } from '../../src/eventbuilder'; import { chromeStackLineParser, geckoStackLineParser, winjsStackLineParser } from '../../src/stack-parsers'; diff --git a/packages/browser/test/tracekit/opera.test.ts b/packages/browser/test/tracekit/opera.test.ts index 5c85ebe8efec..d109fb39ac9c 100644 --- a/packages/browser/test/tracekit/opera.test.ts +++ b/packages/browser/test/tracekit/opera.test.ts @@ -1,4 +1,4 @@ -import { createStackParser } from '@sentry/core/browser'; +import { createStackParser } from '@sentry/core'; import { describe, expect, it } from 'vitest'; import { exceptionFromError } from '../../src/eventbuilder'; import { defaultStackParser, opera10StackLineParser, opera11StackLineParser } from '../../src/stack-parsers'; diff --git a/packages/browser/test/tracing/backgroundtab.test.ts b/packages/browser/test/tracing/backgroundtab.test.ts index 35cde51809ec..cc22b4a1cf91 100644 --- a/packages/browser/test/tracing/backgroundtab.test.ts +++ b/packages/browser/test/tracing/backgroundtab.test.ts @@ -2,7 +2,7 @@ * @vitest-environment jsdom */ -import { getMainCarrier, setCurrentClient } from '@sentry/core/browser'; +import { getMainCarrier, setCurrentClient } from '@sentry/core'; import { JSDOM } from 'jsdom'; import { TextDecoder, TextEncoder } from 'util'; import { afterAll, afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; diff --git a/packages/browser/test/tracing/browserTracingIntegration.test.ts b/packages/browser/test/tracing/browserTracingIntegration.test.ts index 5ef5172f16d4..a7cc1985cbd6 100644 --- a/packages/browser/test/tracing/browserTracingIntegration.test.ts +++ b/packages/browser/test/tracing/browserTracingIntegration.test.ts @@ -2,7 +2,7 @@ * @vitest-environment jsdom */ -import type { Span, StartSpanOptions } from '@sentry/core/browser'; +import type { Span, StartSpanOptions } from '@sentry/core'; import { getActiveSpan, getCurrentScope, @@ -14,11 +14,11 @@ import { setCurrentClient, spanIsSampled, spanToJSON, - startInactiveSpan, TRACING_DEFAULTS, browserPerformanceTimeOrigin, getSpanDescendants, -} from '@sentry/core/browser'; +} from '@sentry/core'; +import { startInactiveSpan } from '@sentry/core/browser'; import { JSDOM } from 'jsdom'; import { TextDecoder, TextEncoder } from 'util'; import { afterAll, afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; diff --git a/packages/browser/test/tracing/linkedTraces.test.ts b/packages/browser/test/tracing/linkedTraces.test.ts index 7a93474e0c4e..f7e06f0aace6 100644 --- a/packages/browser/test/tracing/linkedTraces.test.ts +++ b/packages/browser/test/tracing/linkedTraces.test.ts @@ -1,4 +1,4 @@ -import type { PropagationContext, Span } from '@sentry/core/browser'; +import type { PropagationContext, Span } from '@sentry/core'; import { addChildSpanToSpan, debug, @@ -6,7 +6,7 @@ import { SentrySpan, spanToJSON, timestampInSeconds, -} from '@sentry/core/browser'; +} from '@sentry/core'; import { beforeEach, describe, expect, it, vi } from 'vitest'; import { BrowserClient } from '../../src'; import type { PreviousTraceInfo } from '../../src/tracing/linkedTraces'; diff --git a/packages/browser/test/tracing/request.test.ts b/packages/browser/test/tracing/request.test.ts index de6481751c36..6db5493e742a 100644 --- a/packages/browser/test/tracing/request.test.ts +++ b/packages/browser/test/tracing/request.test.ts @@ -1,5 +1,6 @@ -import type { Client } from '@sentry/core/browser'; -import * as utils from '@sentry/core/browser'; +import type { Client } from '@sentry/core'; +import * as utils from '@sentry/core'; +import * as coreBrowser from '@sentry/core/browser'; import * as browserUtils from '@sentry/browser-utils'; import { HTTP_REQUEST_METHOD } from '@sentry/conventions/attributes'; import type { MockInstance } from 'vitest'; @@ -344,7 +345,7 @@ describe('instrumentOutgoingRequests', () => { vi.spyOn(utils, 'getActiveSpan').mockReturnValue(activeSpan); vi.spyOn(utils, 'hasSpansEnabled').mockReturnValue(true); vi.spyOn(utils, 'hasSpanStreamingEnabled').mockReturnValue(true); - vi.spyOn(utils, 'startInactiveSpan').mockReturnValue(ignoredSpan); + vi.spyOn(coreBrowser, 'startInactiveSpan').mockReturnValue(ignoredSpan); const getTraceDataSpy = vi.spyOn(utils, 'getTraceData').mockReturnValue({ 'sentry-trace': '12345678901234567890123456789012-1234567890123456-1', }); diff --git a/packages/browser/test/tracing/setActiveSpan.test.ts b/packages/browser/test/tracing/setActiveSpan.test.ts index ed9926a01c62..d3c7ea79cf67 100644 --- a/packages/browser/test/tracing/setActiveSpan.test.ts +++ b/packages/browser/test/tracing/setActiveSpan.test.ts @@ -1,4 +1,4 @@ -import { getActiveSpan, SentrySpan } from '@sentry/core/browser'; +import { getActiveSpan, SentrySpan } from '@sentry/core'; import { describe, expect, it } from 'vitest'; import { setActiveSpanInBrowser } from '../../src'; diff --git a/packages/browser/test/tracing/spanStreamingSetup.test.ts b/packages/browser/test/tracing/spanStreamingSetup.test.ts index ad30caa397d9..04edc46b2dad 100644 --- a/packages/browser/test/tracing/spanStreamingSetup.test.ts +++ b/packages/browser/test/tracing/spanStreamingSetup.test.ts @@ -1,13 +1,6 @@ -import type { Client } from '@sentry/core/browser'; -import { - createTransport, - getMainCarrier, - resolvedSyncPromise, - startIdleSpan, - startInactiveSpan, - startSpan, - startSpanManual, -} from '@sentry/core/browser'; +import type { Client } from '@sentry/core'; +import { createTransport, getMainCarrier, resolvedSyncPromise } from '@sentry/core'; +import { startIdleSpan, startInactiveSpan, startSpan, startSpanManual } from '@sentry/core/browser'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import type { BrowserOptions } from '../../src'; import { browserTracingIntegration, init } from '../../src'; diff --git a/packages/browser/test/transports/fetch.test.ts b/packages/browser/test/transports/fetch.test.ts index 4a5650f76eac..1c1dee2c7f90 100644 --- a/packages/browser/test/transports/fetch.test.ts +++ b/packages/browser/test/transports/fetch.test.ts @@ -1,5 +1,5 @@ -import type { EventEnvelope, EventItem } from '@sentry/core/browser'; -import { createEnvelope, serializeEnvelope } from '@sentry/core/browser'; +import type { EventEnvelope, EventItem } from '@sentry/core'; +import { createEnvelope, serializeEnvelope } from '@sentry/core'; import type { Mock } from 'vitest'; import { afterEach, describe, expect, it, vi } from 'vitest'; import { makeFetchTransport } from '../../src/transports/fetch'; diff --git a/packages/browser/test/transports/offline.test.ts b/packages/browser/test/transports/offline.test.ts index f007c553f1af..993d4977ac21 100644 --- a/packages/browser/test/transports/offline.test.ts +++ b/packages/browser/test/transports/offline.test.ts @@ -4,8 +4,8 @@ import type { EventItem, InternalBaseTransportOptions, TransportMakeRequestResponse, -} from '@sentry/core/browser'; -import { createEnvelope, createTransport } from '@sentry/core/browser'; +} from '@sentry/core'; +import { createEnvelope, createTransport } from '@sentry/core'; import { TextDecoder, TextEncoder } from 'util'; import { beforeAll, describe, expect, it } from 'vitest'; import { createStore, makeBrowserOfflineTransport, push, shift, unshift } from '../../src/transports/offline'; diff --git a/packages/bun/src/client.ts b/packages/bun/src/client.ts index fceef3e472bc..03d301f05f95 100644 --- a/packages/bun/src/client.ts +++ b/packages/bun/src/client.ts @@ -1,5 +1,6 @@ -import type { ServerRuntimeClientOptions } from '@sentry/core'; -import { applySdkMetadata, ServerRuntimeClient } from '@sentry/core'; +import type { ServerRuntimeClientOptions } from '@sentry/core/server'; +import { ServerRuntimeClient } from '@sentry/core/server'; +import { applySdkMetadata } from '@sentry/core'; import * as os from 'os'; import type { BunClientOptions } from './types'; diff --git a/packages/bun/src/integrations/bunHttpServer.ts b/packages/bun/src/integrations/bunHttpServer.ts index 6cf95b37ab35..f3a671ed4fab 100644 --- a/packages/bun/src/integrations/bunHttpServer.ts +++ b/packages/bun/src/integrations/bunHttpServer.ts @@ -1,8 +1,10 @@ import { errorMonitor } from 'node:events'; import http from 'node:http'; import https from 'node:https'; -import type { HttpIncomingMessage, HttpServerResponse, IntegrationFn, Span } from '@sentry/core'; -import { defineIntegration, getHttpServerSubscriptions, HTTP_ON_SERVER_REQUEST } from '@sentry/core'; +import type { IntegrationFn, Span } from '@sentry/core'; +import { defineIntegration } from '@sentry/core'; +import type { HttpIncomingMessage, HttpServerResponse } from '@sentry/core/server'; +import { getHttpServerSubscriptions, HTTP_ON_SERVER_REQUEST } from '@sentry/core/server'; const INTEGRATION_NAME = 'BunHttpServer' as const; diff --git a/packages/bun/src/integrations/bunRuntimeMetrics.ts b/packages/bun/src/integrations/bunRuntimeMetrics.ts index afe05b978fac..beb079473b99 100644 --- a/packages/bun/src/integrations/bunRuntimeMetrics.ts +++ b/packages/bun/src/integrations/bunRuntimeMetrics.ts @@ -1,5 +1,6 @@ import { performance } from 'perf_hooks'; -import { _INTERNAL_safeDateNow, _INTERNAL_safeUnref, defineIntegration, metrics } from '@sentry/core'; +import { _INTERNAL_safeDateNow, defineIntegration, metrics } from '@sentry/core'; +import { _INTERNAL_safeUnref } from '@sentry/core/server'; import { _INTERNAL_normalizeCollectionInterval, type NodeRuntimeMetricsOptions } from '@sentry/node'; const INTEGRATION_NAME = 'BunRuntimeMetrics' as const; diff --git a/packages/bun/src/types.ts b/packages/bun/src/types.ts index c253c19c1ca7..34643a995ab1 100644 --- a/packages/bun/src/types.ts +++ b/packages/bun/src/types.ts @@ -1,4 +1,5 @@ -import type { BaseTransportOptions, ClientOptions, Options, ServerRuntimeOptions } from '@sentry/core'; +import type { BaseTransportOptions, ClientOptions, Options } from '@sentry/core'; +import type { ServerRuntimeOptions } from '@sentry/core/server'; /** * Base options for the Sentry Bun SDK. diff --git a/packages/bundler-plugins/src/core/sentry/telemetry.ts b/packages/bundler-plugins/src/core/sentry/telemetry.ts index 60f59e7e0ff4..a68f106e07b9 100644 --- a/packages/bundler-plugins/src/core/sentry/telemetry.ts +++ b/packages/bundler-plugins/src/core/sentry/telemetry.ts @@ -1,10 +1,12 @@ import type { Client } from '@sentry/core'; -import type { ServerRuntimeClientOptions } from '@sentry/core'; -import { applySdkMetadata, ServerRuntimeClient } from '@sentry/core'; +import type { ServerRuntimeClientOptions } from '@sentry/core/server'; +import { applySdkMetadata } from '@sentry/core'; +import { ServerRuntimeClient } from '@sentry/core/server'; import type { NormalizedOptions } from '../options-mapping'; import { SENTRY_SAAS_URL } from '../options-mapping'; import { Scope } from '@sentry/core'; -import { createStackParser, nodeStackLineParser } from '@sentry/core'; +import { createStackParser } from '@sentry/core'; +import { nodeStackLineParser } from '@sentry/core/server'; import { makeOptionallyEnabledNodeTransport } from './transports'; import { SentryCliAdapter } from '../cli'; import { LIB_VERSION } from '../version'; diff --git a/packages/cloudflare/src/client.ts b/packages/cloudflare/src/client.ts index 291b8c5629df..a71445b03f92 100644 --- a/packages/cloudflare/src/client.ts +++ b/packages/cloudflare/src/client.ts @@ -1,13 +1,14 @@ -import type { ClientOptions, Options, ServerRuntimeClientOptions, TracePropagationTargets } from '@sentry/core'; +import type { ClientOptions, Options, TracePropagationTargets } from '@sentry/core'; import { _INTERNAL_clearAiProviderSkips, _INTERNAL_flushLogsBuffer, _INTERNAL_flushMetricsBuffer, applySdkMetadata, debug, - ServerRuntimeClient, spanIsSampled, } from '@sentry/core'; +import type { ServerRuntimeClientOptions } from '@sentry/core/server'; +import { ServerRuntimeClient } from '@sentry/core/server'; import { DEBUG_BUILD } from './debug-build'; import type { ExecutionContextCompat } from './executionContext'; import type { makeFlushLock } from './flush'; diff --git a/packages/cloudflare/src/index.ts b/packages/cloudflare/src/index.ts index d0d3a603b9ac..d114590262bf 100644 --- a/packages/cloudflare/src/index.ts +++ b/packages/cloudflare/src/index.ts @@ -84,20 +84,17 @@ export { moduleMetadataIntegration, supabaseIntegration, instrumentSupabaseClient, - instrumentPostgresJsSql, zodErrorsIntegration, consoleIntegration, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SENTRY_SEGMENT_NAME_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, - trpcMiddleware, spanToStaticSpanJSON, spanToJSON, spanToTraceHeader, spanToBaggageHeader, updateSpanName, - wrapMcpServerWithSentry, consoleLoggingIntegration, createConsolaReporter, featureFlagsIntegration, @@ -109,6 +106,7 @@ export { withStreamedSpan, spanStreamingIntegration, } from '@sentry/core'; +export { instrumentPostgresJsSql, trpcMiddleware, wrapMcpServerWithSentry } from '@sentry/core/server'; export { withSentry } from './withSentry'; export { defineCloudflareOptions } from './defineCloudflareOptions'; diff --git a/packages/cloudflare/src/instrumentations/instrumentSqlStorage.ts b/packages/cloudflare/src/instrumentations/instrumentSqlStorage.ts index e2bd0721117f..092074c371f6 100644 --- a/packages/cloudflare/src/instrumentations/instrumentSqlStorage.ts +++ b/packages/cloudflare/src/instrumentations/instrumentSqlStorage.ts @@ -1,13 +1,8 @@ import type { SqlStorage } from '@cloudflare/workers-types'; import { SENTRY_OP } from '@sentry/conventions/attributes'; import { DB_QUERY } from '@sentry/conventions/op'; -import { - _INTERNAL_getSqlQuerySummary, - _INTERNAL_sanitizeSqlQuery, - getClient, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - startSpan, -} from '@sentry/core'; +import { getClient, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan } from '@sentry/core'; +import { _INTERNAL_getSqlQuerySummary, _INTERNAL_sanitizeSqlQuery } from '@sentry/core/server'; import type { CloudflareClientOptions } from '../client'; import { targetsCloudflareInternalTable } from '../utils/internalSqlQuery'; diff --git a/packages/cloudflare/src/instrumentations/worker/instrumentD1.ts b/packages/cloudflare/src/instrumentations/worker/instrumentD1.ts index 9a1b2581cdc6..322ffa4c4e4b 100644 --- a/packages/cloudflare/src/instrumentations/worker/instrumentD1.ts +++ b/packages/cloudflare/src/instrumentations/worker/instrumentD1.ts @@ -4,8 +4,6 @@ import { SENTRY_OP } from '@sentry/conventions/attributes'; import { DB_QUERY } from '@sentry/conventions/op'; import type { Span, SpanAttributes, StartSpanOptions } from '@sentry/core'; import { - _INTERNAL_getSqlQuerySummary, - _INTERNAL_sanitizeSqlQuery, addBreadcrumb, getClient, hasSpanStreamingEnabled, @@ -13,6 +11,7 @@ import { SPAN_STATUS_ERROR, startSpan, } from '@sentry/core'; +import { _INTERNAL_getSqlQuerySummary, _INTERNAL_sanitizeSqlQuery } from '@sentry/core/server'; import { ensureInstrumented } from '../../instrument'; // Patching is based on internal Cloudflare D1 API diff --git a/packages/cloudflare/src/vendor/stacktrace.ts b/packages/cloudflare/src/vendor/stacktrace.ts index 4427e109cf74..d57ed8a7dacb 100644 --- a/packages/cloudflare/src/vendor/stacktrace.ts +++ b/packages/cloudflare/src/vendor/stacktrace.ts @@ -3,7 +3,8 @@ // SPDX-License-Identifier: MIT import type { StackLineParser, StackLineParserFn, StackParser } from '@sentry/core'; -import { basename, createStackParser, nodeStackLineParser } from '@sentry/core'; +import { basename, createStackParser } from '@sentry/core'; +import { nodeStackLineParser } from '@sentry/core/server'; type GetModuleFn = (filename: string | undefined) => string | undefined; diff --git a/packages/core/src/browser-exports.ts b/packages/core/src/browser-exports.ts deleted file mode 100644 index 450a20d1b38c..000000000000 --- a/packages/core/src/browser-exports.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Browser-specific utilities for Sentry SDKs - * - * @module - */ - -export { - startSpan, - startInactiveSpan, - startSpanManual, - _INTERNAL_ensureBrowserSpanStreaming, -} from './tracing/browserSpanApi'; - -export { startIdleSpan } from './tracing/idleSpan'; - -export type { XhrBreadcrumbData, XhrBreadcrumbHint } from './types/breadcrumb'; -export type { BrowserClientReplayOptions } from './types/browseroptions'; diff --git a/packages/core/src/browser.ts b/packages/core/src/browser.ts index 22f34ce95a81..450a20d1b38c 100644 --- a/packages/core/src/browser.ts +++ b/packages/core/src/browser.ts @@ -1,6 +1,17 @@ -/* eslint-disable max-lines */ +/** + * Browser-specific utilities for Sentry SDKs + * + * @module + */ -export * from './shared-exports'; -export * from './browser-exports'; +export { + startSpan, + startInactiveSpan, + startSpanManual, + _INTERNAL_ensureBrowserSpanStreaming, +} from './tracing/browserSpanApi'; -export { startIdleSpan, startSpan, startInactiveSpan, startSpanManual } from './browser-exports'; +export { startIdleSpan } from './tracing/idleSpan'; + +export type { XhrBreadcrumbData, XhrBreadcrumbHint } from './types/breadcrumb'; +export type { BrowserClientReplayOptions } from './types/browseroptions'; diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index ef84d9312185..afdeac10921a 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -1,13 +1,539 @@ -export * from './shared-exports'; +/** + * Utilites shared between server and browser SDKs. + */ +/* eslint-disable max-lines */ -// Build-time only: kept off `shared-exports` so it stays out of the `@sentry/core/browser` and -// `@sentry/core/server` entry points, which no build-time code imports. -// TODO(v12): Remove together with the warning itself. +export type { ClientClass as SentryCoreCurrentScopes } from './sdk'; +export type { AsyncContextStrategy, TracingChannelBinding } from './asyncContext/types'; +export type { Carrier } from './carrier'; +export type { OfflineStore, OfflineTransportOptions } from './transports/offline'; +export type { IntegrationIndex } from './integration'; +export * from './tracing'; +export * from './semanticAttributes'; +export { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; +export * from './tracing/spans/spanNames'; +export type { RawAttributes } from './attributes'; +export { createEventEnvelope, createSessionEnvelope } from './envelope'; +export { + captureException, + captureEvent, + captureMessage, + lastEventId, + close, + flush, + setContext, + setExtra, + setExtras, + setTag, + setTags, + setAttribute, + setAttributes, + setUser, + setConversationId, + isInitialized, + isEnabled, + startSession, + endSession, + captureSession, + addEventProcessor, +} from './exports'; +export { withMonitor, captureCheckIn } from './monitor'; +export { + getCurrentScope, + getIsolationScope, + getGlobalScope, + withScope, + withIsolationScope, + getClient, + getTraceContextFromScope, + registerExternalPropagationContext, + getExternalPropagationContext, + hasExternalPropagationContext, +} from './currentScopes'; +export { getDefaultCurrentScope, getDefaultIsolationScope } from './defaultScopes'; +export { setAsyncContextStrategy, getAsyncContextStrategy } from './asyncContext'; +export { waitForTracingChannelBinding } from './asyncContext/tracing-channel-binding'; +export { getGlobalSingleton, getMainCarrier } from './carrier'; +export { makeSession, closeSession, updateSession } from './session'; +export { Scope } from './scope'; +export type { CaptureContext, ScopeContext, ScopeData } from './scope'; +export { notifyEventProcessors } from './eventProcessors'; +export { getEnvelopeEndpointWithUrlEncodedAuth, getReportDialogEndpoint, SENTRY_API_VERSION } from './api'; +export { Client } from './client'; +export { initAndBind, setCurrentClient } from './sdk'; +export { createTransport } from './transports/base'; +export { makeOfflineTransport } from './transports/offline'; +export { makeMultiplexedTransport, MULTIPLEXED_TRANSPORT_EXTRA_KEY } from './transports/multiplexed'; +export { + getIntegrationsToSetup, + addIntegration, + defineIntegration, + extendIntegration, + installedIntegrations, +} from './integration'; +export { + _INTERNAL_skipAiProviderWrapping, + _INTERNAL_shouldSkipAiProviderWrapping, + _INTERNAL_clearAiProviderSkips, +} from './utils/ai/providerSkip'; +export { filterKeyValueData as _INTERNAL_filterKeyValueData } from './utils/data-collection/filterKeyValueData'; +export { filterCookies as _INTERNAL_filterCookies } from './utils/data-collection/filterCookies'; +export { filterQueryParams as _INTERNAL_filterQueryParams } from './utils/data-collection/filterQueryParams'; +export { filterCollectedUrl, filterCollectedUrlQuery } from './utils/data-collection/filterCollectedUrl'; +export { envToBool } from './utils/envToBool'; +export { applyScopeDataToEvent, mergeScopeData, getCombinedScopeData } from './utils/scopeData'; +export { prepareEvent } from './utils/prepareEvent'; +export type { ExclusiveEventHintOrCaptureContext } from './utils/prepareEvent'; +export { createCheckInEnvelope } from './checkin'; +export { hasSpansEnabled } from './utils/hasSpansEnabled'; +export { + withStaticSpan, + // oxlint-disable-next-line typescript/no-deprecated + withStreamedSpan, +} from './tracing/spans/beforeSendSpan'; +export { safeSetSpanJSONAttributes } from './tracing/spans/captureSpan'; +export { isSentryRequestUrl } from './utils/isSentryRequestUrl'; +export { handleCallbackErrors } from './utils/handleCallbackErrors'; +export { parameterize, fmt } from './utils/parameterize'; +export type { HandleTunnelRequestOptions } from './utils/tunnel'; +export { handleTunnelRequest } from './utils/tunnel'; +export { addAutoIpAddressToSession } from './utils/ipAddress'; +export { + convertSpanLinksForEnvelope, + spanToTraceHeader, + spanToStaticSpanJSON, + spanToJSON, + spanIsSampled, + spanIsSentrySpan, + spanToTraceContext, + getSpanDescendants, + getStatusMessage, + getRootSpan, + INTERNAL_getSegmentSpan, + getActiveSpan, + addChildSpanToSpan, + spanTimeInputToSeconds, + updateSpanName, + INTERNAL_setSegmentNameSourceIfSegment, +} from './utils/spanUtils'; +export { _setSpanForScope as _INTERNAL_setSpanForScope } from './utils/spanOnScope'; +export { parseSampleRate } from './utils/parseSampleRate'; +export { applySdkMetadata } from './utils/sdkMetadata'; +export { getTraceData } from './utils/traceData'; +export { matchesTracePropagationTargets, shouldPropagateTraceForUrl } from './utils/tracePropagationTargets'; +export { getTraceMetaTags } from './utils/meta'; +export { debounce } from './utils/debounce'; +export { uniq } from './utils/array'; +export { makeWeakRef, derefWeakRef } from './utils/weakRef'; +export type { MaybeWeakRef } from './utils/weakRef'; +export { shouldIgnoreSpan } from './utils/should-ignore-span'; +export { + winterCGHeadersToDict, + winterCGRequestToRequestData, + captureBodyFromWinterCGRequest, + httpRequestToRequestData, + extractQueryParamsFromUrl, + headersToDict, + httpHeadersToSpanAttributes, + getContentLengthFromHeaders, + getMaxBodyByteLength, + MAX_BODY_BYTE_LENGTH, +} from './utils/request'; +export type { MaxRequestBodySize } from './utils/request'; +export { DEFAULT_ENVIRONMENT, DEV_ENVIRONMENT } from './constants'; +export { spanKindToName } from './spanKind'; +export type { SpanKind, SpanKindNumber } from './spanKind'; +export { addBreadcrumb } from './breadcrumbs'; +export { functionToStringIntegration } from './integrations/functiontostring'; +export { eventFiltersIntegration } from './integrations/eventFilters'; +export { linkedErrorsIntegration } from './integrations/linkederrors'; +export { moduleMetadataIntegration } from './integrations/moduleMetadata'; +export { requestDataIntegration } from './integrations/requestdata'; +export { captureConsoleIntegration } from './integrations/captureconsole'; +export { dedupeIntegration } from './integrations/dedupe'; +export { extraErrorDataIntegration } from './integrations/extraerrordata'; +export { rewriteFramesIntegration } from './integrations/rewriteframes'; +export { supabaseIntegration, instrumentSupabaseClient } from './integrations/supabase'; +export { zodErrorsIntegration } from './integrations/zoderrors'; +export { thirdPartyErrorFilterIntegration } from './integrations/third-party-errors-filter'; +export { consoleIntegration } from './integrations/console'; +export type { FeatureFlagsIntegration } from './integrations/featureFlags'; +export { featureFlagsIntegration } from './integrations/featureFlags'; +export { growthbookIntegration } from './integrations/featureFlags'; +export { conversationIdIntegration } from './integrations/conversationId'; +export { spanStreamingIntegration } from './integrations/spanStreaming'; +export { profiler } from './profiling'; +// eslint thinks the entire function is deprecated (while only one overload is actually deprecated) +// Therefore: +// eslint-disable-next-line typescript/no-deprecated +export { instrumentFetchRequest, _INTERNAL_getTracingHeadersForFetchRequest } from './fetch'; +export { captureFeedback } from './feedback'; +export type { ReportDialogOptions } from './report-dialog'; +export { _INTERNAL_captureLog, _INTERNAL_flushLogsBuffer, _INTERNAL_captureSerializedLog } from './logs/internal'; +export * as logger from './logs/public-api'; +export { consoleLoggingIntegration } from './logs/console-integration'; +export { + _INTERNAL_captureMetric, + _INTERNAL_flushMetricsBuffer, + _INTERNAL_captureSerializedMetric, +} from './metrics/internal'; +export * as metrics from './metrics/public-api'; +export type { MetricOptions } from './metrics/public-api'; +export { createConsolaReporter } from './integrations/consola'; +export { SpanBuffer } from './tracing/spans/spanBuffer'; +export { hasSpanStreamingEnabled } from './tracing/spans/hasSpanStreamingEnabled'; +export type { FeatureFlag } from './utils/featureFlags'; +export { + _INTERNAL_copyFlagsFromScopeToEvent, + _INTERNAL_insertFlagToScope, + _INTERNAL_addFeatureFlagToActiveSpan, + _INTERNAL_FLAG_BUFFER_SIZE, + _INTERNAL_MAX_FLAGS_PER_SPAN, +} from './utils/featureFlags'; +export { applyAggregateErrorsToEvent } from './utils/aggregate-errors'; +export { getBreadcrumbLogLevelFromHttpStatusCode } from './utils/breadcrumb-log-level'; +export { dsnFromString, dsnToString, makeDsn } from './utils/dsn'; +// eslint-disable-next-line typescript/no-deprecated +export { SentryError } from './utils/error'; +export { GLOBAL_OBJ } from './utils/worldwide'; +export type { InternalGlobal } from './utils/worldwide'; +export { addConsoleInstrumentationHandler, addConsoleInstrumentationFilter } from './instrument/console'; +export { addFetchEndInstrumentationHandler, addFetchInstrumentationHandler } from './instrument/fetch'; +export { addGlobalErrorInstrumentationHandler } from './instrument/globalError'; +export { addGlobalUnhandledRejectionInstrumentationHandler } from './instrument/globalUnhandledRejection'; +export { addHandler, maybeInstrument, resetInstrumentationHandlers, triggerHandlers } from './instrument/handlers'; +export { + isDOMError, + isDOMException, + // eslint-disable-next-line typescript/no-deprecated + isElement, + isError, + isErrorEvent, + isEvent, + isInstanceOf, + isObjectLike, + isParameterizedString, + isPlainObject, + isPrimitive, + isRegExp, + isString, + // eslint-disable-next-line typescript/no-deprecated + isSyntheticEvent, + isThenable, + // eslint-disable-next-line typescript/no-deprecated + isVueViewModel, +} from './utils/is'; +export { isBrowser } from './utils/isBrowser'; +export { CONSOLE_LEVELS, consoleSandbox, debug, originalConsoleMethods } from './utils/debug-logger'; +export type { SentryDebugLogger } from './utils/debug-logger'; +export { + addContextToFrame, + addExceptionMechanism, + addExceptionTypeValue, + checkOrSetAlreadyCaught, + isAlreadyCaptured, + getEventDescription, + parseSemver, + uuid4, +} from './utils/misc'; +export { normalize, normalizeToSize, normalizeUrlToBase, setNormalizeStringifier } from './utils/normalize'; +export { setNormalizationDepthOverrideHint, setSkipNormalizationHint } from './utils/normalizationHints'; +export { + addNonEnumerableProperty, + convertToPlainObject, + // eslint-disable-next-line typescript/no-deprecated + dropUndefinedKeys, + extractExceptionKeysForMessage, + fill, + getOriginalFunction, + markFunctionWrapped, + objectify, +} from './utils/object'; +export { basename, dirname, isAbsolute, join, normalizePath, relative, resolve } from './utils/path'; +export { makePromiseBuffer, SENTRY_BUFFER_FULL_ERROR } from './utils/promisebuffer'; +export type { PromiseBuffer } from './utils/promisebuffer'; +export { severityLevelFromString } from './utils/severity'; +export { replaceExports } from './utils/exports'; +export { + UNKNOWN_FUNCTION, + createStackParser, + getFramesFromEvent, + getFunctionName, + stackParserFromStackParserOptions, + stripSentryFramesAndReverse, +} from './utils/stacktrace'; +export { isMatchingPattern, safeJoin, stringify, snipLine, stringMatchesSomePattern, truncate } from './utils/string'; +export { + isNativeFunction, + supportsDOMException, + supportsErrorEvent, + // eslint-disable-next-line typescript/no-deprecated + supportsFetch, + // eslint-disable-next-line typescript/no-deprecated + supportsReferrerPolicy, +} from './utils/supports'; +export { SyncPromise, rejectedSyncPromise, resolvedSyncPromise } from './utils/syncpromise'; +export { browserPerformanceTimeOrigin, dateTimestampInSeconds, timestampInSeconds } from './utils/time'; +export { + TRACEPARENT_REGEXP, + extractTraceparentData, + generateSentryTraceHeader, + isContinuingTrace, + propagationContextFromHeaders, + shouldContinueTrace, + generateTraceparentHeader, +} from './utils/tracing'; +export { getSDKSource, isBrowserBundle } from './utils/env'; +export type { SdkSource } from './utils/env'; +export { + addItemToEnvelope, + createAttachmentEnvelopeItem, + createEnvelope, + createEventEnvelopeHeaders, + envelopeContainsItemType, + envelopeItemTypeToDataCategory, + forEachEnvelopeItem, + getSdkMetadataForEnvelopeHeader, + parseEnvelope, + serializeEnvelope, +} from './utils/envelope'; +export { createClientReportEnvelope } from './utils/clientreport'; +export { + DEFAULT_RETRY_AFTER, + disabledUntil, + isRateLimited, + parseRetryAfterHeader, + updateRateLimits, +} from './utils/ratelimit'; +export type { RateLimits } from './utils/ratelimit'; +export { + MAX_BAGGAGE_STRING_LENGTH, + SENTRY_BAGGAGE_KEY_PREFIX, + SENTRY_BAGGAGE_KEY_PREFIX_REGEX, + baggageHeaderToDynamicSamplingContext, + dynamicSamplingContextToSentryBaggageHeader, + parseBaggageHeader, + objectToBaggageHeader, + mergeBaggageHeaders, +} from './utils/baggage'; +export { + getSanitizedUrlString, + parseUrl, + stripUrlQueryAndFragment, + parseStringToURLObject, + getHttpSpanDetailsFromUrlObject, + isURLObjectRelative, + getSanitizedUrlStringFromUrlObject, + stripDataUrlContent, + getUrlQuery, + getUrlFragment, + getUrlDomain, +} from './utils/url'; +export { + eventFromMessage, + eventFromUnknownInput, + exceptionFromError, + parseStackFrames, + _enhanceErrorWithSentryInfo as _INTERNAL_enhanceErrorWithSentryInfo, +} from './utils/eventbuilder'; +export { LRUMap } from './utils/lru'; +export { generateTraceId, generateSpanId } from './utils/propagationContext'; +export { SDK_VERSION } from './utils/version'; +export { getDebugImagesForResources, getFilenameToDebugIdMap } from './utils/debug-ids'; +export { getFilenameToMetadataMap } from './metadata'; +export { escapeStringForRegex } from './vendor/escapeStringForRegex'; +export type { Attachment } from './types/attachment'; +export type { Breadcrumb, BreadcrumbHint, FetchBreadcrumbData, FetchBreadcrumbHint } from './types/breadcrumb'; +export type { ClientReport, Outcome, EventDropReason } from './types/clientreport'; +export type { + Context, + Contexts, + DeviceContext, + OsContext, + AppContext, + CultureContext, + TraceContext, + CloudResourceContext, +} from './types/context'; +export type { DataCategory } from './types/datacategory'; +export type { DsnComponents, DsnLike, DsnProtocol } from './types/dsn'; +export type { DebugImage, DebugMeta } from './types/debugMeta'; +export type { + AttachmentItem, + BaseEnvelopeHeaders, + BaseEnvelopeItemHeaders, + ClientReportEnvelope, + ClientReportItem, + DynamicSamplingContext, + Envelope, + EnvelopeItemType, + EnvelopeItem, + EventEnvelope, + EventEnvelopeHeaders, + EventItem, + ReplayEnvelope, + FeedbackItem, + SessionEnvelope, + SessionItem, + UserFeedbackItem, + CheckInItem, + CheckInEnvelope, + RawSecurityEnvelope, + RawSecurityItem, + ProfileItem, + ProfileChunkEnvelope, + ProfileChunkItem, + StreamedSpanEnvelope, + LogEnvelope, + MetricEnvelope, +} from './types/envelope'; +export type { ExtendedError } from './types/error'; +export type { Event, EventHint, EventType, ErrorEvent, TransactionEvent } from './types/event'; +export type { EventProcessor } from './types/eventprocessor'; +export type { Exception } from './types/exception'; +export type { Extra, Extras } from './types/extra'; +export type { Integration, IntegrationFn } from './types/integration'; +export type { Mechanism } from './types/mechanism'; +export type { ExtractedNodeRequestData, HttpHeaderValue, Primitive, WorkerLocation } from './types/misc'; +export type { + CollectBehavior, + DataCollection, + HttpBodyCollectionTarget, + ResolvedDataCollection, +} from './types/datacollection'; +export type { ClientOptions, CoreOptions as Options } from './types/options'; +export type { Package } from './types/package'; +export type { PolymorphicEvent, PolymorphicRequest } from './types/polymorphics'; +export type { + ThreadId, + FrameId, + StackId, + ThreadCpuSample, + ThreadCpuStack, + ThreadCpuFrame, + ThreadCpuProfile, + ContinuousThreadCpuProfile, + Profile, + ProfileChunk, +} from './types/profiling'; +export type { + ReplayEndEvent, + ReplayEvent, + ReplayRecordingData, + ReplayRecordingMode, + ReplayStartEvent, + ReplayStopReason, +} from './types/replay'; +export type { + FeedbackErrorCode, + FeedbackErrorMessages, + FeedbackEvent, + FeedbackFormData, + FeedbackInternalOptions, + FeedbackModalIntegration, + FeedbackScreenshotIntegration, + SendFeedback, + SendFeedbackParams, + UserFeedback, +} from './types/feedback'; +export type { + QueryParams, + RequestEventData, + RequestHookInfo, + ResponseHookInfo, + SanitizedRequestData, +} from './types/request'; +export type { Runtime } from './types/runtime'; +export type { SdkInfo } from './types/sdkinfo'; +export type { SdkMetadata } from './types/sdkmetadata'; +export type { + SessionAggregates, + AggregationCounts, + Session, + SessionContext, + SessionStatus, + SerializedSession, +} from './types/session'; +export type { SeverityLevel } from './types/severity'; +export type { + Span, + SentrySpanArguments, + SpanOrigin, + SpanAttributeValue, + SpanAttributes, + SpanTimeInput, + SpanJSON, + SpanContextData, + TraceFlag, + SerializedStreamedSpan, + SerializedStreamedSpanContainer, + StreamedSpanJSON, +} from './types/span'; +export type { SpanStatus, SpanStatusType } from './types/spanStatus'; +export type { Log, LogSeverityLevel } from './types/log'; +export type { SpanLink } from './types/link'; +export type { + Metric, + MetricType, + SerializedMetric, + SerializedMetricContainer, + // eslint-disable-next-line typescript/no-deprecated + SerializedMetricAttributeValue, +} from './types/metric'; +export type { TimedEvent } from './types/timedEvent'; +export type { StackFrame } from './types/stackframe'; +export type { Stacktrace, StackParser, StackLineParser, StackLineParserFn } from './types/stacktrace'; +export type { PropagationContext, TracePropagationTargets, SerializedTraceData } from './types/tracing'; +export type { StartSpanOptions } from './types/startSpanOptions'; +export type { TraceparentData, TransactionSource } from './types/transaction'; +export type { TracesSamplerSamplingContext, CustomSamplingContext, SamplingContext } from './types/samplingcontext'; +export type { + DurationUnit, + InformationUnit, + FractionUnit, + MeasurementUnit, + MetricUnit, + NoneUnit, + Measurements, +} from './types/measurement'; +export type { Thread } from './types/thread'; +export type { + Transport, + TransportRequest, + TransportMakeRequestResponse, + InternalBaseTransportOptions, + BaseTransportOptions, + TransportRequestExecutor, +} from './types/transport'; +export type { User } from './types/user'; +export type { WebFetchHeaders, WebFetchRequest } from './types/webfetchapi'; +export type { WrappedFunction } from './types/wrappedfunction'; +export type { + HandlerDataFetch, + HandlerDataConsole, + HandlerDataError, + HandlerDataUnhandledRejection, + ConsoleLevel, +} from './types/instrument'; +export type { CheckIn, MonitorConfig, FinishedCheckIn, InProgressCheckIn, SerializedCheckIn } from './types/checkin'; +export type { ParameterizedString } from './types/parameterize'; +export type { ContinuousProfiler, ProfilingIntegration, Profiler } from './types/profiling'; +export type { ViewHierarchyData, ViewHierarchyWindow } from './types/view-hierarchy'; +export type { LegacyCSPReport } from './types/csp'; +export type { SerializedLog, SerializedLogContainer } from './types/log'; +export type { + BuildTimeOptionsBase, + ModuleMetadata, + ModuleMetadataCallback, + ModuleMetadataCallbackArgs, + ReactComponentAnnotationOptions, + ResolveSourceMapHook, +} from './build-time-plugins/buildTimeOptionsBase'; +export type { RandomSafeContextRunner as _INTERNAL_RandomSafeContextRunner } from './utils/randomSafeContext'; +export { + withRandomSafeContext as _INTERNAL_withRandomSafeContext, + safeMathRandom as _INTERNAL_safeMathRandom, + safeDateNow as _INTERNAL_safeDateNow, +} from './utils/randomSafeContext'; export { warnOnRemovedBuildOptions } from './build-time-plugins/warnOnRemovedBuildOptions'; -export * from './server-exports'; -export * from './browser-exports'; - -// `server-exports` and `browser-exports` both export these APIs. -// We need to re-export them here to disambiguate the exports for anyone importing -// from `@sentry/core`. Server exports win over browser exports. -export { startSpan, startInactiveSpan, startSpanManual } from './server-exports'; +export { startSpan, startInactiveSpan, startSpanManual } from './tracing/trace'; diff --git a/packages/core/src/server-exports.ts b/packages/core/src/server-exports.ts deleted file mode 100644 index 7df98fc3a756..000000000000 --- a/packages/core/src/server-exports.ts +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Server-only utilities for Sentry SDKs. - * - * @module - */ - -export { startSpan, startInactiveSpan, startSpanManual } from './tracing/trace'; - -export type { ServerRuntimeClientOptions } from './server-runtime-client'; -export { ServerRuntimeClient } from './server-runtime-client'; -export type { ServerRuntimeOptions } from './types/options'; -export { trpcMiddleware } from './trpc'; -export { wrapMcpServerWithSentry } from './integrations/mcp-server'; -export { isNodeEnv, loadModule } from './utils/node'; -export { filenameIsInApp, node, nodeStackLineParser } from './utils/node-stack-trace'; -export { vercelWaitUntil } from './utils/vercelWaitUntil'; -export { flushIfServerless } from './utils/flushIfServerless'; -export { callFrameToStackFrame, watchdogTimer } from './utils/anr'; -export { safeUnref as _INTERNAL_safeUnref } from './utils/timer'; -/* oxlint-disable typescript/no-deprecated -- deprecated Express exports, kept until the next major */ -export { patchExpressModule } from './integrations/express/index'; -export type { - ExpressIntegrationOptions, - ExpressMiddleware, - ExpressErrorMiddleware, -} from './integrations/express/types'; -/* oxlint-enable typescript/no-deprecated */ -export { - instrumentPostgresJsSql, - _reconstructQuery as _INTERNAL_reconstructPostgresQuery, - _buildConnectionContext as _INTERNAL_buildPostgresConnectionContext, - _getConnectionAttributes as _INTERNAL_getConnectionAttributes, - _getOperationName as _INTERNAL_getPostgresOperationName, -} from './integrations/postgresjs'; -export type { PostgresConnectionContext } from './integrations/postgresjs'; -export { - getSqlQuerySummary as _INTERNAL_getSqlQuerySummary, - sanitizeSqlQuery as _INTERNAL_sanitizeSqlQuery, -} from './utils/sql'; -export type { SqlDialect } from './utils/sql'; - -export { patchHttpModuleClient } from './integrations/http/client-patch'; -export { getHttpClientSubscriptions } from './integrations/http/client-subscriptions'; -export { getHttpServerSubscriptions, isStaticAssetRequest } from './integrations/http/server-subscription'; -export { - DEFAULT_IGNORE_STATUS_CODES, - processHttpServerTransactionEvent, -} from './integrations/http/server-transaction-event'; -export { recordRequestSession } from './integrations/http/record-request-session'; -export { addOutgoingRequestBreadcrumb } from './integrations/http/add-outgoing-request-breadcrumb'; -export { - getRequestUrl, - getRequestUrlObject, - getRequestUrlFromClientRequest, - getRequestOptions, -} from './integrations/http/get-request-url'; -export { HTTP_ON_CLIENT_REQUEST, HTTP_ON_SERVER_REQUEST } from './integrations/http/constants'; -export type { - HttpInstrumentationOptions, - HttpClientRequest, - HttpIncomingMessage, - HttpServerResponse, - HttpModuleExport, -} from './integrations/http/types'; diff --git a/packages/core/src/server.ts b/packages/core/src/server.ts index c2d93b7af980..0accf0ad69ce 100644 --- a/packages/core/src/server.ts +++ b/packages/core/src/server.ts @@ -1,11 +1,62 @@ /** - * The Sentry core SDK and integrations used by node, cloudflare, - * bun, deno, aws lambda, and other server-side platforms, where bundle size - * is less of an issue. + * Server-only utilities for Sentry SDKs. * - * This export should not contain anything strictly browser-specific. + * @module */ -/* eslint-disable max-lines */ -export * from './shared-exports'; -export * from './server-exports'; +export type { ServerRuntimeClientOptions } from './server-runtime-client'; +export { ServerRuntimeClient } from './server-runtime-client'; +export type { ServerRuntimeOptions } from './types/options'; +export { trpcMiddleware } from './trpc'; +export { wrapMcpServerWithSentry } from './integrations/mcp-server'; +export { isNodeEnv, loadModule } from './utils/node'; +export { filenameIsInApp, node, nodeStackLineParser } from './utils/node-stack-trace'; +export { vercelWaitUntil } from './utils/vercelWaitUntil'; +export { flushIfServerless } from './utils/flushIfServerless'; +export { callFrameToStackFrame, watchdogTimer } from './utils/anr'; +export { safeUnref as _INTERNAL_safeUnref } from './utils/timer'; +/* oxlint-disable typescript/no-deprecated -- deprecated Express exports, kept until the next major */ +export { patchExpressModule } from './integrations/express/index'; +export type { + ExpressIntegrationOptions, + ExpressMiddleware, + ExpressErrorMiddleware, +} from './integrations/express/types'; +/* oxlint-enable typescript/no-deprecated */ +export { + instrumentPostgresJsSql, + _reconstructQuery as _INTERNAL_reconstructPostgresQuery, + _buildConnectionContext as _INTERNAL_buildPostgresConnectionContext, + _getConnectionAttributes as _INTERNAL_getConnectionAttributes, + _getOperationName as _INTERNAL_getPostgresOperationName, +} from './integrations/postgresjs'; +export type { PostgresConnectionContext } from './integrations/postgresjs'; +export { + getSqlQuerySummary as _INTERNAL_getSqlQuerySummary, + sanitizeSqlQuery as _INTERNAL_sanitizeSqlQuery, +} from './utils/sql'; +export type { SqlDialect } from './utils/sql'; + +export { patchHttpModuleClient } from './integrations/http/client-patch'; +export { getHttpClientSubscriptions } from './integrations/http/client-subscriptions'; +export { getHttpServerSubscriptions, isStaticAssetRequest } from './integrations/http/server-subscription'; +export { + DEFAULT_IGNORE_STATUS_CODES, + processHttpServerTransactionEvent, +} from './integrations/http/server-transaction-event'; +export { recordRequestSession } from './integrations/http/record-request-session'; +export { addOutgoingRequestBreadcrumb } from './integrations/http/add-outgoing-request-breadcrumb'; +export { + getRequestUrl, + getRequestUrlObject, + getRequestUrlFromClientRequest, + getRequestOptions, +} from './integrations/http/get-request-url'; +export { HTTP_ON_CLIENT_REQUEST, HTTP_ON_SERVER_REQUEST } from './integrations/http/constants'; +export type { + HttpInstrumentationOptions, + HttpClientRequest, + HttpIncomingMessage, + HttpServerResponse, + HttpModuleExport, +} from './integrations/http/types'; diff --git a/packages/core/src/shared-exports.ts b/packages/core/src/shared-exports.ts deleted file mode 100644 index 82ae31c5cdb9..000000000000 --- a/packages/core/src/shared-exports.ts +++ /dev/null @@ -1,537 +0,0 @@ -/** - * Utilites shared between server and browser SDKs. - */ -/* eslint-disable max-lines */ - -export type { ClientClass as SentryCoreCurrentScopes } from './sdk'; -export type { AsyncContextStrategy, TracingChannelBinding } from './asyncContext/types'; -export type { Carrier } from './carrier'; -export type { OfflineStore, OfflineTransportOptions } from './transports/offline'; -export type { IntegrationIndex } from './integration'; -export * from './tracing'; -export * from './semanticAttributes'; -export { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; -export * from './tracing/spans/spanNames'; -export type { RawAttributes } from './attributes'; -export { createEventEnvelope, createSessionEnvelope } from './envelope'; -export { - captureException, - captureEvent, - captureMessage, - lastEventId, - close, - flush, - setContext, - setExtra, - setExtras, - setTag, - setTags, - setAttribute, - setAttributes, - setUser, - setConversationId, - isInitialized, - isEnabled, - startSession, - endSession, - captureSession, - addEventProcessor, -} from './exports'; -export { withMonitor, captureCheckIn } from './monitor'; -export { - getCurrentScope, - getIsolationScope, - getGlobalScope, - withScope, - withIsolationScope, - getClient, - getTraceContextFromScope, - registerExternalPropagationContext, - getExternalPropagationContext, - hasExternalPropagationContext, -} from './currentScopes'; -export { getDefaultCurrentScope, getDefaultIsolationScope } from './defaultScopes'; -export { setAsyncContextStrategy, getAsyncContextStrategy } from './asyncContext'; -export { waitForTracingChannelBinding } from './asyncContext/tracing-channel-binding'; -export { getGlobalSingleton, getMainCarrier } from './carrier'; -export { makeSession, closeSession, updateSession } from './session'; -export { Scope } from './scope'; -export type { CaptureContext, ScopeContext, ScopeData } from './scope'; -export { notifyEventProcessors } from './eventProcessors'; -export { getEnvelopeEndpointWithUrlEncodedAuth, getReportDialogEndpoint, SENTRY_API_VERSION } from './api'; -export { Client } from './client'; -export { initAndBind, setCurrentClient } from './sdk'; -export { createTransport } from './transports/base'; -export { makeOfflineTransport } from './transports/offline'; -export { makeMultiplexedTransport, MULTIPLEXED_TRANSPORT_EXTRA_KEY } from './transports/multiplexed'; -export { - getIntegrationsToSetup, - addIntegration, - defineIntegration, - extendIntegration, - installedIntegrations, -} from './integration'; -export { - _INTERNAL_skipAiProviderWrapping, - _INTERNAL_shouldSkipAiProviderWrapping, - _INTERNAL_clearAiProviderSkips, -} from './utils/ai/providerSkip'; -export { filterKeyValueData as _INTERNAL_filterKeyValueData } from './utils/data-collection/filterKeyValueData'; -export { filterCookies as _INTERNAL_filterCookies } from './utils/data-collection/filterCookies'; -export { filterQueryParams as _INTERNAL_filterQueryParams } from './utils/data-collection/filterQueryParams'; -export { filterCollectedUrl, filterCollectedUrlQuery } from './utils/data-collection/filterCollectedUrl'; -export { envToBool } from './utils/envToBool'; -export { applyScopeDataToEvent, mergeScopeData, getCombinedScopeData } from './utils/scopeData'; -export { prepareEvent } from './utils/prepareEvent'; -export type { ExclusiveEventHintOrCaptureContext } from './utils/prepareEvent'; -export { createCheckInEnvelope } from './checkin'; -export { hasSpansEnabled } from './utils/hasSpansEnabled'; -export { - withStaticSpan, - // oxlint-disable-next-line typescript/no-deprecated - withStreamedSpan, -} from './tracing/spans/beforeSendSpan'; -export { safeSetSpanJSONAttributes } from './tracing/spans/captureSpan'; -export { isSentryRequestUrl } from './utils/isSentryRequestUrl'; -export { handleCallbackErrors } from './utils/handleCallbackErrors'; -export { parameterize, fmt } from './utils/parameterize'; -export type { HandleTunnelRequestOptions } from './utils/tunnel'; -export { handleTunnelRequest } from './utils/tunnel'; -export { addAutoIpAddressToSession } from './utils/ipAddress'; -export { - convertSpanLinksForEnvelope, - spanToTraceHeader, - spanToStaticSpanJSON, - spanToJSON, - spanIsSampled, - spanIsSentrySpan, - spanToTraceContext, - getSpanDescendants, - getStatusMessage, - getRootSpan, - INTERNAL_getSegmentSpan, - getActiveSpan, - addChildSpanToSpan, - spanTimeInputToSeconds, - updateSpanName, - INTERNAL_setSegmentNameSourceIfSegment, -} from './utils/spanUtils'; -export { _setSpanForScope as _INTERNAL_setSpanForScope } from './utils/spanOnScope'; -export { parseSampleRate } from './utils/parseSampleRate'; -export { applySdkMetadata } from './utils/sdkMetadata'; -export { getTraceData } from './utils/traceData'; -export { matchesTracePropagationTargets, shouldPropagateTraceForUrl } from './utils/tracePropagationTargets'; -export { getTraceMetaTags } from './utils/meta'; -export { debounce } from './utils/debounce'; -export { uniq } from './utils/array'; -export { makeWeakRef, derefWeakRef } from './utils/weakRef'; -export type { MaybeWeakRef } from './utils/weakRef'; -export { shouldIgnoreSpan } from './utils/should-ignore-span'; -export { - winterCGHeadersToDict, - winterCGRequestToRequestData, - captureBodyFromWinterCGRequest, - httpRequestToRequestData, - extractQueryParamsFromUrl, - headersToDict, - httpHeadersToSpanAttributes, - getContentLengthFromHeaders, - getMaxBodyByteLength, - MAX_BODY_BYTE_LENGTH, -} from './utils/request'; -export type { MaxRequestBodySize } from './utils/request'; -export { DEFAULT_ENVIRONMENT, DEV_ENVIRONMENT } from './constants'; -export { spanKindToName } from './spanKind'; -export type { SpanKind, SpanKindNumber } from './spanKind'; -export { addBreadcrumb } from './breadcrumbs'; -export { functionToStringIntegration } from './integrations/functiontostring'; -export { eventFiltersIntegration } from './integrations/eventFilters'; -export { linkedErrorsIntegration } from './integrations/linkederrors'; -export { moduleMetadataIntegration } from './integrations/moduleMetadata'; -export { requestDataIntegration } from './integrations/requestdata'; -export { captureConsoleIntegration } from './integrations/captureconsole'; -export { dedupeIntegration } from './integrations/dedupe'; -export { extraErrorDataIntegration } from './integrations/extraerrordata'; -export { rewriteFramesIntegration } from './integrations/rewriteframes'; -export { supabaseIntegration, instrumentSupabaseClient } from './integrations/supabase'; -export { zodErrorsIntegration } from './integrations/zoderrors'; -export { thirdPartyErrorFilterIntegration } from './integrations/third-party-errors-filter'; -export { consoleIntegration } from './integrations/console'; -export type { FeatureFlagsIntegration } from './integrations/featureFlags'; -export { featureFlagsIntegration } from './integrations/featureFlags'; -export { growthbookIntegration } from './integrations/featureFlags'; -export { conversationIdIntegration } from './integrations/conversationId'; -export { spanStreamingIntegration } from './integrations/spanStreaming'; -export { profiler } from './profiling'; -// eslint thinks the entire function is deprecated (while only one overload is actually deprecated) -// Therefore: -// eslint-disable-next-line typescript/no-deprecated -export { instrumentFetchRequest, _INTERNAL_getTracingHeadersForFetchRequest } from './fetch'; -export { captureFeedback } from './feedback'; -export type { ReportDialogOptions } from './report-dialog'; -export { _INTERNAL_captureLog, _INTERNAL_flushLogsBuffer, _INTERNAL_captureSerializedLog } from './logs/internal'; -export * as logger from './logs/public-api'; -export { consoleLoggingIntegration } from './logs/console-integration'; -export { - _INTERNAL_captureMetric, - _INTERNAL_flushMetricsBuffer, - _INTERNAL_captureSerializedMetric, -} from './metrics/internal'; -export * as metrics from './metrics/public-api'; -export type { MetricOptions } from './metrics/public-api'; -export { createConsolaReporter } from './integrations/consola'; -export { SpanBuffer } from './tracing/spans/spanBuffer'; -export { hasSpanStreamingEnabled } from './tracing/spans/hasSpanStreamingEnabled'; -export type { FeatureFlag } from './utils/featureFlags'; -export { - _INTERNAL_copyFlagsFromScopeToEvent, - _INTERNAL_insertFlagToScope, - _INTERNAL_addFeatureFlagToActiveSpan, - _INTERNAL_FLAG_BUFFER_SIZE, - _INTERNAL_MAX_FLAGS_PER_SPAN, -} from './utils/featureFlags'; -export { applyAggregateErrorsToEvent } from './utils/aggregate-errors'; -export { getBreadcrumbLogLevelFromHttpStatusCode } from './utils/breadcrumb-log-level'; -export { dsnFromString, dsnToString, makeDsn } from './utils/dsn'; -// eslint-disable-next-line typescript/no-deprecated -export { SentryError } from './utils/error'; -export { GLOBAL_OBJ } from './utils/worldwide'; -export type { InternalGlobal } from './utils/worldwide'; -export { addConsoleInstrumentationHandler, addConsoleInstrumentationFilter } from './instrument/console'; -export { addFetchEndInstrumentationHandler, addFetchInstrumentationHandler } from './instrument/fetch'; -export { addGlobalErrorInstrumentationHandler } from './instrument/globalError'; -export { addGlobalUnhandledRejectionInstrumentationHandler } from './instrument/globalUnhandledRejection'; -export { addHandler, maybeInstrument, resetInstrumentationHandlers, triggerHandlers } from './instrument/handlers'; -export { - isDOMError, - isDOMException, - // eslint-disable-next-line typescript/no-deprecated - isElement, - isError, - isErrorEvent, - isEvent, - isInstanceOf, - isObjectLike, - isParameterizedString, - isPlainObject, - isPrimitive, - isRegExp, - isString, - // eslint-disable-next-line typescript/no-deprecated - isSyntheticEvent, - isThenable, - // eslint-disable-next-line typescript/no-deprecated - isVueViewModel, -} from './utils/is'; -export { isBrowser } from './utils/isBrowser'; -export { CONSOLE_LEVELS, consoleSandbox, debug, originalConsoleMethods } from './utils/debug-logger'; -export type { SentryDebugLogger } from './utils/debug-logger'; -export { - addContextToFrame, - addExceptionMechanism, - addExceptionTypeValue, - checkOrSetAlreadyCaught, - isAlreadyCaptured, - getEventDescription, - parseSemver, - uuid4, -} from './utils/misc'; -export { normalize, normalizeToSize, normalizeUrlToBase, setNormalizeStringifier } from './utils/normalize'; -export { setNormalizationDepthOverrideHint, setSkipNormalizationHint } from './utils/normalizationHints'; -export { - addNonEnumerableProperty, - convertToPlainObject, - // eslint-disable-next-line typescript/no-deprecated - dropUndefinedKeys, - extractExceptionKeysForMessage, - fill, - getOriginalFunction, - markFunctionWrapped, - objectify, -} from './utils/object'; -export { basename, dirname, isAbsolute, join, normalizePath, relative, resolve } from './utils/path'; -export { makePromiseBuffer, SENTRY_BUFFER_FULL_ERROR } from './utils/promisebuffer'; -export type { PromiseBuffer } from './utils/promisebuffer'; -export { severityLevelFromString } from './utils/severity'; -export { replaceExports } from './utils/exports'; -export { - UNKNOWN_FUNCTION, - createStackParser, - getFramesFromEvent, - getFunctionName, - stackParserFromStackParserOptions, - stripSentryFramesAndReverse, -} from './utils/stacktrace'; -export { isMatchingPattern, safeJoin, stringify, snipLine, stringMatchesSomePattern, truncate } from './utils/string'; -export { - isNativeFunction, - supportsDOMException, - supportsErrorEvent, - // eslint-disable-next-line typescript/no-deprecated - supportsFetch, - // eslint-disable-next-line typescript/no-deprecated - supportsReferrerPolicy, -} from './utils/supports'; -export { SyncPromise, rejectedSyncPromise, resolvedSyncPromise } from './utils/syncpromise'; -export { browserPerformanceTimeOrigin, dateTimestampInSeconds, timestampInSeconds } from './utils/time'; -export { - TRACEPARENT_REGEXP, - extractTraceparentData, - generateSentryTraceHeader, - isContinuingTrace, - propagationContextFromHeaders, - shouldContinueTrace, - generateTraceparentHeader, -} from './utils/tracing'; -export { getSDKSource, isBrowserBundle } from './utils/env'; -export type { SdkSource } from './utils/env'; -export { - addItemToEnvelope, - createAttachmentEnvelopeItem, - createEnvelope, - createEventEnvelopeHeaders, - envelopeContainsItemType, - envelopeItemTypeToDataCategory, - forEachEnvelopeItem, - getSdkMetadataForEnvelopeHeader, - parseEnvelope, - serializeEnvelope, -} from './utils/envelope'; -export { createClientReportEnvelope } from './utils/clientreport'; -export { - DEFAULT_RETRY_AFTER, - disabledUntil, - isRateLimited, - parseRetryAfterHeader, - updateRateLimits, -} from './utils/ratelimit'; -export type { RateLimits } from './utils/ratelimit'; -export { - MAX_BAGGAGE_STRING_LENGTH, - SENTRY_BAGGAGE_KEY_PREFIX, - SENTRY_BAGGAGE_KEY_PREFIX_REGEX, - baggageHeaderToDynamicSamplingContext, - dynamicSamplingContextToSentryBaggageHeader, - parseBaggageHeader, - objectToBaggageHeader, - mergeBaggageHeaders, -} from './utils/baggage'; -export { - getSanitizedUrlString, - parseUrl, - stripUrlQueryAndFragment, - parseStringToURLObject, - getHttpSpanDetailsFromUrlObject, - isURLObjectRelative, - getSanitizedUrlStringFromUrlObject, - stripDataUrlContent, - getUrlQuery, - getUrlFragment, - getUrlDomain, -} from './utils/url'; -export { - eventFromMessage, - eventFromUnknownInput, - exceptionFromError, - parseStackFrames, - _enhanceErrorWithSentryInfo as _INTERNAL_enhanceErrorWithSentryInfo, -} from './utils/eventbuilder'; -export { LRUMap } from './utils/lru'; -export { generateTraceId, generateSpanId } from './utils/propagationContext'; -export { SDK_VERSION } from './utils/version'; -export { getDebugImagesForResources, getFilenameToDebugIdMap } from './utils/debug-ids'; -export { getFilenameToMetadataMap } from './metadata'; -export { escapeStringForRegex } from './vendor/escapeStringForRegex'; -export type { Attachment } from './types/attachment'; -export type { Breadcrumb, BreadcrumbHint, FetchBreadcrumbData, FetchBreadcrumbHint } from './types/breadcrumb'; -export type { ClientReport, Outcome, EventDropReason } from './types/clientreport'; -export type { - Context, - Contexts, - DeviceContext, - OsContext, - AppContext, - CultureContext, - TraceContext, - CloudResourceContext, -} from './types/context'; -export type { DataCategory } from './types/datacategory'; -export type { DsnComponents, DsnLike, DsnProtocol } from './types/dsn'; -export type { DebugImage, DebugMeta } from './types/debugMeta'; -export type { - AttachmentItem, - BaseEnvelopeHeaders, - BaseEnvelopeItemHeaders, - ClientReportEnvelope, - ClientReportItem, - DynamicSamplingContext, - Envelope, - EnvelopeItemType, - EnvelopeItem, - EventEnvelope, - EventEnvelopeHeaders, - EventItem, - ReplayEnvelope, - FeedbackItem, - SessionEnvelope, - SessionItem, - UserFeedbackItem, - CheckInItem, - CheckInEnvelope, - RawSecurityEnvelope, - RawSecurityItem, - ProfileItem, - ProfileChunkEnvelope, - ProfileChunkItem, - StreamedSpanEnvelope, - LogEnvelope, - MetricEnvelope, -} from './types/envelope'; -export type { ExtendedError } from './types/error'; -export type { Event, EventHint, EventType, ErrorEvent, TransactionEvent } from './types/event'; -export type { EventProcessor } from './types/eventprocessor'; -export type { Exception } from './types/exception'; -export type { Extra, Extras } from './types/extra'; -export type { Integration, IntegrationFn } from './types/integration'; -export type { Mechanism } from './types/mechanism'; -export type { ExtractedNodeRequestData, HttpHeaderValue, Primitive, WorkerLocation } from './types/misc'; -export type { - CollectBehavior, - DataCollection, - HttpBodyCollectionTarget, - ResolvedDataCollection, -} from './types/datacollection'; -export type { ClientOptions, CoreOptions as Options } from './types/options'; -export type { Package } from './types/package'; -export type { PolymorphicEvent, PolymorphicRequest } from './types/polymorphics'; -export type { - ThreadId, - FrameId, - StackId, - ThreadCpuSample, - ThreadCpuStack, - ThreadCpuFrame, - ThreadCpuProfile, - ContinuousThreadCpuProfile, - Profile, - ProfileChunk, -} from './types/profiling'; -export type { - ReplayEndEvent, - ReplayEvent, - ReplayRecordingData, - ReplayRecordingMode, - ReplayStartEvent, - ReplayStopReason, -} from './types/replay'; -export type { - FeedbackErrorCode, - FeedbackErrorMessages, - FeedbackEvent, - FeedbackFormData, - FeedbackInternalOptions, - FeedbackModalIntegration, - FeedbackScreenshotIntegration, - SendFeedback, - SendFeedbackParams, - UserFeedback, -} from './types/feedback'; -export type { - QueryParams, - RequestEventData, - RequestHookInfo, - ResponseHookInfo, - SanitizedRequestData, -} from './types/request'; -export type { Runtime } from './types/runtime'; -export type { SdkInfo } from './types/sdkinfo'; -export type { SdkMetadata } from './types/sdkmetadata'; -export type { - SessionAggregates, - AggregationCounts, - Session, - SessionContext, - SessionStatus, - SerializedSession, -} from './types/session'; -export type { SeverityLevel } from './types/severity'; -export type { - Span, - SentrySpanArguments, - SpanOrigin, - SpanAttributeValue, - SpanAttributes, - SpanTimeInput, - SpanJSON, - SpanContextData, - TraceFlag, - SerializedStreamedSpan, - SerializedStreamedSpanContainer, - StreamedSpanJSON, -} from './types/span'; -export type { SpanStatus, SpanStatusType } from './types/spanStatus'; -export type { Log, LogSeverityLevel } from './types/log'; -export type { SpanLink } from './types/link'; -export type { - Metric, - MetricType, - SerializedMetric, - SerializedMetricContainer, - // eslint-disable-next-line typescript/no-deprecated - SerializedMetricAttributeValue, -} from './types/metric'; -export type { TimedEvent } from './types/timedEvent'; -export type { StackFrame } from './types/stackframe'; -export type { Stacktrace, StackParser, StackLineParser, StackLineParserFn } from './types/stacktrace'; -export type { PropagationContext, TracePropagationTargets, SerializedTraceData } from './types/tracing'; -export type { StartSpanOptions } from './types/startSpanOptions'; -export type { TraceparentData, TransactionSource } from './types/transaction'; -export type { TracesSamplerSamplingContext, CustomSamplingContext, SamplingContext } from './types/samplingcontext'; -export type { - DurationUnit, - InformationUnit, - FractionUnit, - MeasurementUnit, - MetricUnit, - NoneUnit, - Measurements, -} from './types/measurement'; -export type { Thread } from './types/thread'; -export type { - Transport, - TransportRequest, - TransportMakeRequestResponse, - InternalBaseTransportOptions, - BaseTransportOptions, - TransportRequestExecutor, -} from './types/transport'; -export type { User } from './types/user'; -export type { WebFetchHeaders, WebFetchRequest } from './types/webfetchapi'; -export type { WrappedFunction } from './types/wrappedfunction'; -export type { - HandlerDataFetch, - HandlerDataConsole, - HandlerDataError, - HandlerDataUnhandledRejection, - ConsoleLevel, -} from './types/instrument'; -export type { CheckIn, MonitorConfig, FinishedCheckIn, InProgressCheckIn, SerializedCheckIn } from './types/checkin'; -export type { ParameterizedString } from './types/parameterize'; -export type { ContinuousProfiler, ProfilingIntegration, Profiler } from './types/profiling'; -export type { ViewHierarchyData, ViewHierarchyWindow } from './types/view-hierarchy'; -export type { LegacyCSPReport } from './types/csp'; -export type { SerializedLog, SerializedLogContainer } from './types/log'; -export type { - BuildTimeOptionsBase, - ModuleMetadata, - ModuleMetadataCallback, - ModuleMetadataCallbackArgs, - ReactComponentAnnotationOptions, - ResolveSourceMapHook, -} from './build-time-plugins/buildTimeOptionsBase'; -export type { RandomSafeContextRunner as _INTERNAL_RandomSafeContextRunner } from './utils/randomSafeContext'; -export { - withRandomSafeContext as _INTERNAL_withRandomSafeContext, - safeMathRandom as _INTERNAL_safeMathRandom, - safeDateNow as _INTERNAL_safeDateNow, -} from './utils/randomSafeContext'; diff --git a/packages/core/test/exports.test.ts b/packages/core/test/exports.test.ts index 0936e59c5808..297696feddb3 100644 --- a/packages/core/test/exports.test.ts +++ b/packages/core/test/exports.test.ts @@ -10,10 +10,13 @@ import { startSpanManual as plainStartSpanManual, } from '../src/tracing/trace'; -// `server-exports` and `browser-exports` export these names with different implementations, which -// makes them ambiguous star exports at the root entry. `index.ts` disambiguates them with explicit +// The span-start APIs exist in two variants under the same name: the plain ones (`./tracing/trace`) +// and the browser ones (`./tracing/browserSpanApi`) that install `spanStreamingIntegration` before +// starting the span. The isomorphic root entry disambiguates to the plain variant with explicit // re-exports — if someone adds another `export *` that also carries one of these names, or drops the -// explicit re-export, the root entry silently flips to the wrong variant (or fails to link). +// explicit re-export, the root entry silently flips to the wrong variant (or fails to link). The +// browser entry serves the guarded variant, and the server entry is disjoint from the isomorphic +// surface, so it deliberately does not re-export these APIs at all. describe('entry point resolution', () => { const cases = [ ['startSpan', plainStartSpan, browserSpanApi.startSpan], @@ -25,21 +28,23 @@ describe('entry point resolution', () => { expect(rootEntry[name]).toBe(plain); }); - it.each(cases)('`%s`: the server entry serves the plain variant', (name, plain) => { - expect(serverEntry[name]).toBe(plain); - }); - it.each(cases)('`%s`: the browser entry serves the browser variant', (name, plain, browser) => { expect(browserEntry[name]).toBe(browser); expect(browserEntry[name]).not.toBe(plain); }); - // `spanStreamingIntegration` is a single shared implementation, exported from both - // `browser-exports` and `server-exports`. Because both re-export the identical binding, it is not - // an ambiguous star export and needs no explicit disambiguation in `index.ts` — every entry - // resolves to the exact same function. - it.each(['index', 'server', 'browser'] as const)('`spanStreamingIntegration`: the %s entry serves it', entry => { - const entries = { index: rootEntry, server: serverEntry, browser: browserEntry }; - expect(entries[entry].spanStreamingIntegration).toBe(spanStreamingIntegration); + it.each(cases)('`%s`: the server entry does not re-export the isomorphic API', name => { + expect(serverEntry).not.toHaveProperty(name); + }); + + // `spanStreamingIntegration` is isomorphic and lives only on the root entry. The platform entries + // are disjoint from the isomorphic surface, so they deliberately do not re-export it. + it('`spanStreamingIntegration`: the root entry serves it', () => { + expect(rootEntry.spanStreamingIntegration).toBe(spanStreamingIntegration); + }); + + it.each(['server', 'browser'] as const)('`spanStreamingIntegration`: the %s entry does not re-export it', entry => { + const entries = { server: serverEntry, browser: browserEntry }; + expect(entries[entry]).not.toHaveProperty('spanStreamingIntegration'); }); }); diff --git a/packages/core/test/lib/integrations/metadata.test.ts b/packages/core/test/lib/integrations/metadata.test.ts index 4063662de9f4..21f9f950e207 100644 --- a/packages/core/test/lib/integrations/metadata.test.ts +++ b/packages/core/test/lib/integrations/metadata.test.ts @@ -5,10 +5,10 @@ import { createTransport, GLOBAL_OBJ, moduleMetadataIntegration, - nodeStackLineParser, parseEnvelope, setCurrentClient, } from '../../../src'; +import { nodeStackLineParser } from '../../../src/server'; import type { Event } from '../../../src/types/event'; import { getDefaultTestClientOptions, TestClient } from '../../mocks/client'; diff --git a/packages/core/test/lib/trpc.test.ts b/packages/core/test/lib/trpc.test.ts index 1df5f45957a5..ecd0382bbdbe 100644 --- a/packages/core/test/lib/trpc.test.ts +++ b/packages/core/test/lib/trpc.test.ts @@ -1,5 +1,6 @@ import { beforeEach, describe, expect, test, vi } from 'vitest'; -import { type Client, setCurrentClient, type Span, trpcMiddleware } from '../../src'; +import { type Client, setCurrentClient, type Span } from '../../src'; +import { trpcMiddleware } from '../../src/server'; import * as currentScopes from '../../src/currentScopes'; import * as exports from '../../src/exports'; import * as tracing from '../../src/tracing/trace'; diff --git a/packages/core/test/lib/utils/debug-ids.test.ts b/packages/core/test/lib/utils/debug-ids.test.ts index 45ff58c82565..4917ac233569 100644 --- a/packages/core/test/lib/utils/debug-ids.test.ts +++ b/packages/core/test/lib/utils/debug-ids.test.ts @@ -1,5 +1,5 @@ import { beforeEach, describe, expect, it } from 'vitest'; -import { nodeStackLineParser } from '../../../src'; +import { nodeStackLineParser } from '../../../src/server'; import { clearDebugIdCache, getDebugImagesForResources, getFilenameToDebugIdMap } from '../../../src/utils/debug-ids'; import { createStackParser } from '../../../src/utils/stacktrace'; diff --git a/packages/deno/src/client.ts b/packages/deno/src/client.ts index f26dc527773c..160396df57af 100644 --- a/packages/deno/src/client.ts +++ b/packages/deno/src/client.ts @@ -1,5 +1,6 @@ -import type { ServerRuntimeClientOptions } from '@sentry/core'; -import { _INTERNAL_flushLogsBuffer, SDK_VERSION, ServerRuntimeClient } from '@sentry/core'; +import type { ServerRuntimeClientOptions } from '@sentry/core/server'; +import { _INTERNAL_flushLogsBuffer, SDK_VERSION } from '@sentry/core'; +import { ServerRuntimeClient } from '@sentry/core/server'; import { setAsyncLocalStorageAsyncContextStrategy } from '@sentry/server-utils'; import type { DenoClientOptions } from './types'; diff --git a/packages/deno/src/index.ts b/packages/deno/src/index.ts index 202f5b3c62c7..aa3fa1babba8 100644 --- a/packages/deno/src/index.ts +++ b/packages/deno/src/index.ts @@ -79,7 +79,6 @@ export { rewriteFramesIntegration, supabaseIntegration, instrumentSupabaseClient, - instrumentPostgresJsSql, zodErrorsIntegration, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, @@ -93,7 +92,6 @@ export { spanToTraceHeader, spanToBaggageHeader, updateSpanName, - wrapMcpServerWithSentry, featureFlagsIntegration, metrics, withStaticSpan, @@ -103,6 +101,7 @@ export { consoleLoggingIntegration, spanStreamingIntegration, } from '@sentry/core'; +export { instrumentPostgresJsSql, wrapMcpServerWithSentry } from '@sentry/core/server'; export { DenoClient } from './client'; diff --git a/packages/deno/src/integrations/deno-serve.ts b/packages/deno/src/integrations/deno-serve.ts index 5c973cc82239..527bb1f062fe 100644 --- a/packages/deno/src/integrations/deno-serve.ts +++ b/packages/deno/src/integrations/deno-serve.ts @@ -1,5 +1,6 @@ import type { Event, IntegrationFn, MaxRequestBodySize } from '@sentry/core'; -import { debug, DEFAULT_IGNORE_STATUS_CODES, defineIntegration, processHttpServerTransactionEvent } from '@sentry/core'; +import { debug, defineIntegration } from '@sentry/core'; +import { DEFAULT_IGNORE_STATUS_CODES, processHttpServerTransactionEvent } from '@sentry/core/server'; import type { RequestHandlerWrapperOptions } from '../wrap-deno-request-handler'; import { wrapDenoRequestHandler } from '../wrap-deno-request-handler'; diff --git a/packages/deno/src/integrations/globalhandlers.ts b/packages/deno/src/integrations/globalhandlers.ts index 0a503b592848..868591e35059 100644 --- a/packages/deno/src/integrations/globalhandlers.ts +++ b/packages/deno/src/integrations/globalhandlers.ts @@ -1,4 +1,5 @@ -import type { Client, Event, IntegrationFn, Primitive, ServerRuntimeClient, StackParser } from '@sentry/core'; +import type { Client, Event, IntegrationFn, Primitive, StackParser } from '@sentry/core'; +import type { ServerRuntimeClient } from '@sentry/core/server'; import { captureEvent, defineIntegration, eventFromUnknownInput, flush, getClient, isPrimitive } from '@sentry/core'; type GlobalHandlersIntegrationsOptionKeys = 'error' | 'unhandledrejection'; diff --git a/packages/deno/src/integrations/http.ts b/packages/deno/src/integrations/http.ts index 2b3174e5b636..f696186b9261 100644 --- a/packages/deno/src/integrations/http.ts +++ b/packages/deno/src/integrations/http.ts @@ -1,25 +1,18 @@ import { subscribe } from 'node:diagnostics_channel'; import { errorMonitor } from 'node:events'; import type { RequestOptions } from 'node:http'; -import type { - Event, - HttpClientRequest, - HttpIncomingMessage, - HttpServerResponse, - Integration, - IntegrationFn, - Span, -} from '@sentry/core'; +import type { Event, Integration, IntegrationFn, Span } from '@sentry/core'; +import { defineIntegration } from '@sentry/core'; +import type { HttpClientRequest, HttpIncomingMessage, HttpServerResponse } from '@sentry/core/server'; import { DEFAULT_IGNORE_STATUS_CODES, - defineIntegration, getHttpClientSubscriptions, getHttpServerSubscriptions, getRequestOptions, HTTP_ON_CLIENT_REQUEST, HTTP_ON_SERVER_REQUEST, processHttpServerTransactionEvent, -} from '@sentry/core'; +} from '@sentry/core/server'; const INTEGRATION_NAME = 'DenoHttp' as const; diff --git a/packages/deno/src/integrations/normalizepaths.ts b/packages/deno/src/integrations/normalizepaths.ts index aa2fc757a6a1..408f524c9ee9 100644 --- a/packages/deno/src/integrations/normalizepaths.ts +++ b/packages/deno/src/integrations/normalizepaths.ts @@ -1,5 +1,6 @@ import type { IntegrationFn } from '@sentry/core'; -import { createStackParser, defineIntegration, dirname, nodeStackLineParser } from '@sentry/core'; +import { createStackParser, defineIntegration, dirname } from '@sentry/core'; +import { nodeStackLineParser } from '@sentry/core/server'; const INTEGRATION_NAME = 'NormalizePaths' as const; diff --git a/packages/deno/src/sdk.ts b/packages/deno/src/sdk.ts index 0b33f933e337..07d5e8366184 100644 --- a/packages/deno/src/sdk.ts +++ b/packages/deno/src/sdk.ts @@ -1,4 +1,5 @@ -import type { Client, Integration, Options, ServerRuntimeClientOptions, StackParser } from '@sentry/core'; +import type { Client, Integration, Options, StackParser } from '@sentry/core'; +import type { ServerRuntimeClientOptions } from '@sentry/core/server'; import { createStackParser, dedupeIntegration, @@ -7,12 +8,12 @@ import { getIntegrationsToSetup, initAndBind, linkedErrorsIntegration, - nodeStackLineParser, requestDataIntegration, stackParserFromStackParserOptions, } from '@sentry/core'; import { getTracingIntegrations, getErrorIntegrations } from '@sentry/server-utils'; import { DenoClient } from './client'; +import { nodeStackLineParser } from '@sentry/core/server'; import { breadcrumbsIntegration } from './integrations/breadcrumbs'; import { denoContextIntegration } from './integrations/context'; import { contextLinesIntegration } from './integrations/contextlines'; diff --git a/packages/deno/test/deno-runtime-metrics.test.ts b/packages/deno/test/deno-runtime-metrics.test.ts index 48435279a954..0dfdc5d35d6a 100644 --- a/packages/deno/test/deno-runtime-metrics.test.ts +++ b/packages/deno/test/deno-runtime-metrics.test.ts @@ -1,7 +1,8 @@ // import type { Envelope } from '@sentry/core'; -import { createStackParser, forEachEnvelopeItem, nodeStackLineParser } from '@sentry/core'; +import { createStackParser, forEachEnvelopeItem } from '@sentry/core'; +import { nodeStackLineParser } from '@sentry/core/server'; import { assertEquals, assertNotEquals, assertStringIncludes } from 'https://deno.land/std@0.212.0/assert/mod.ts'; import { DenoClient, diff --git a/packages/deno/test/mod.test.ts b/packages/deno/test/mod.test.ts index 8178e40ea9c9..8e860c931e41 100644 --- a/packages/deno/test/mod.test.ts +++ b/packages/deno/test/mod.test.ts @@ -1,5 +1,6 @@ import type { Envelope, Event, Log } from '@sentry/core'; -import { createStackParser, forEachEnvelopeItem, nodeStackLineParser } from '@sentry/core'; +import { createStackParser, forEachEnvelopeItem } from '@sentry/core'; +import { nodeStackLineParser } from '@sentry/core/server'; import { assertEquals } from 'https://deno.land/std@0.202.0/assert/assert_equals.ts'; import { assertSnapshot } from 'https://deno.land/std@0.202.0/testing/snapshot.ts'; import { DenoClient, getCurrentScope, getDefaultIntegrations, logger, metrics, Scope } from '../build/esm/index.js'; @@ -68,7 +69,7 @@ function expectCaptureExceptionEvent(event: Event | undefined): void { filename: 'app:///test/mod.test.ts', function: '?', in_app: true, - lineno: 44, + lineno: 45, }, { colno: 12, @@ -76,7 +77,7 @@ function expectCaptureExceptionEvent(event: Event | undefined): void { filename: 'app:///test/mod.test.ts', function: 'something', in_app: true, - lineno: 41, + lineno: 42, }, ], ); diff --git a/packages/effect/src/tracer.ts b/packages/effect/src/tracer.ts index 84efcf766cf4..31ac0be35c29 100644 --- a/packages/effect/src/tracer.ts +++ b/packages/effect/src/tracer.ts @@ -172,7 +172,7 @@ class SentrySpanWrapper implements SentrySpanLike { /** * The client and the server entry differ only in which `startInactiveSpan` they hand to - * {@link makeSentryTracer}: the browser one from `@sentry/core/browser`, which installs the span + * {@link makeSentryTracer}: the browser one from `@sentry/core`, which installs the span * streaming integration on first use, and the plain one from `@sentry/core`, which does not. Nothing * else about the tracer is platform-specific. */ diff --git a/packages/eslint-plugin-sdk/src/rules/no-unguarded-span-apis.js b/packages/eslint-plugin-sdk/src/rules/no-unguarded-span-apis.js index 76af668b9538..fd7c9bda3f30 100644 --- a/packages/eslint-plugin-sdk/src/rules/no-unguarded-span-apis.js +++ b/packages/eslint-plugin-sdk/src/rules/no-unguarded-span-apis.js @@ -1,11 +1,11 @@ 'use strict'; /** - * @fileoverview Rule to keep browser-facing code on the `@sentry/core/browser` span-start APIs. + * @fileoverview Rule to keep browser-facing code on the `@sentry/core` span-start APIs. * * `startSpan`, `startInactiveSpan`, `startSpanManual` and `startIdleSpan` exist in two variants * under the same name: the plain ones at `@sentry/core` / `@sentry/core/server`, and guarded ones at - * `@sentry/core/browser` that install `spanStreamingIntegration` on the client before starting the + * `@sentry/core` that install `spanStreamingIntegration` on the client before starting the * span. The browser SDK's `init()` deliberately does not reference that integration - that reference * alone would keep the whole span streaming graph in every bundle, including error-only ones. * @@ -78,7 +78,7 @@ module.exports = { meta: { type: 'problem', docs: { - description: 'Enforce importing span-start APIs from `@sentry/core/browser` in browser-facing code', + description: 'Enforce importing span-start APIs from `@sentry/core` in browser-facing code', category: 'Possible Errors', recommended: true, }, @@ -86,7 +86,7 @@ module.exports = { schema: [], messages: { unguardedSpanApi: - '`{{name}}` must be imported from `@sentry/core/browser` (or `@sentry/browser`) in browser-facing code. The `{{source}}` variant does not install `spanStreamingIntegration`, so spans it starts are created but never sent.', + '`{{name}}` must be imported from `@sentry/core` (or `@sentry/browser`) in browser-facing code. The `{{source}}` variant does not install `spanStreamingIntegration`, so spans it starts are created but never sent.', }, }, create: function (context) { diff --git a/packages/feedback/src/core/TestClient.ts b/packages/feedback/src/core/TestClient.ts index 6ff745dcb4e4..b1acd13dcba2 100644 --- a/packages/feedback/src/core/TestClient.ts +++ b/packages/feedback/src/core/TestClient.ts @@ -1,4 +1,5 @@ -import type { BrowserClientReplayOptions, ClientOptions, Event, SeverityLevel } from '@sentry/core'; +import type { ClientOptions, Event, SeverityLevel } from '@sentry/core'; +import type { BrowserClientReplayOptions } from '@sentry/core/browser'; import { Client, createTransport, initAndBind, resolvedSyncPromise } from '@sentry/core'; export interface TestClientOptions extends ClientOptions, BrowserClientReplayOptions {} diff --git a/packages/integration-shims/src/BrowserTracing.ts b/packages/integration-shims/src/BrowserTracing.ts index aaafbd537ec8..f92f3a63d6d8 100644 --- a/packages/integration-shims/src/BrowserTracing.ts +++ b/packages/integration-shims/src/BrowserTracing.ts @@ -1,4 +1,4 @@ -import { consoleSandbox, defineIntegration } from '@sentry/core/browser'; +import { consoleSandbox, defineIntegration } from '@sentry/core'; /** * This is a shim for the BrowserTracing integration. diff --git a/packages/integration-shims/src/ElementTiming.ts b/packages/integration-shims/src/ElementTiming.ts index 1eb43d9cf682..8a521163f7e1 100644 --- a/packages/integration-shims/src/ElementTiming.ts +++ b/packages/integration-shims/src/ElementTiming.ts @@ -1,4 +1,4 @@ -import { consoleSandbox, defineIntegration } from '@sentry/core/browser'; +import { consoleSandbox, defineIntegration } from '@sentry/core'; /** * This is a shim for the ElementTiming integration. diff --git a/packages/integration-shims/src/Feedback.ts b/packages/integration-shims/src/Feedback.ts index aa21f81494e7..dd56bd273717 100644 --- a/packages/integration-shims/src/Feedback.ts +++ b/packages/integration-shims/src/Feedback.ts @@ -1,5 +1,5 @@ -import type { Integration } from '@sentry/core/browser'; -import { consoleSandbox } from '@sentry/core/browser'; +import type { Integration } from '@sentry/core'; +import { consoleSandbox } from '@sentry/core'; import { FAKE_FUNCTION } from './common'; const FEEDBACK_INTEGRATION_METHODS = ['attachTo', 'createForm', 'createWidget', 'remove'] as const; diff --git a/packages/integration-shims/src/Replay.ts b/packages/integration-shims/src/Replay.ts index e532c49bf276..eee5cfbb2ef7 100644 --- a/packages/integration-shims/src/Replay.ts +++ b/packages/integration-shims/src/Replay.ts @@ -1,5 +1,5 @@ -import type { Integration } from '@sentry/core/browser'; -import { consoleSandbox } from '@sentry/core/browser'; +import type { Integration } from '@sentry/core'; +import { consoleSandbox } from '@sentry/core'; import { FAKE_FUNCTION } from './common'; const REPLAY_INTEGRATION_METHODS = ['start', 'stop', 'flush'] as const; diff --git a/packages/integration-shims/src/SpanStreaming.ts b/packages/integration-shims/src/SpanStreaming.ts index 269770b9ab21..7b445f086145 100644 --- a/packages/integration-shims/src/SpanStreaming.ts +++ b/packages/integration-shims/src/SpanStreaming.ts @@ -1,4 +1,4 @@ -import { consoleSandbox, defineIntegration } from '@sentry/core/browser'; +import { consoleSandbox, defineIntegration } from '@sentry/core'; /** * This is a shim for the SpanStreaming integration. diff --git a/packages/integration-shims/src/launchDarkly.ts b/packages/integration-shims/src/launchDarkly.ts index 08203b6a74ad..76750f5c863c 100644 --- a/packages/integration-shims/src/launchDarkly.ts +++ b/packages/integration-shims/src/launchDarkly.ts @@ -1,4 +1,4 @@ -import { consoleSandbox, defineIntegration, isBrowser } from '@sentry/core/browser'; +import { consoleSandbox, defineIntegration, isBrowser } from '@sentry/core'; import { FAKE_FUNCTION } from './common'; /** diff --git a/packages/integration-shims/src/logs.ts b/packages/integration-shims/src/logs.ts index aca7b0775490..bbbd940c401f 100644 --- a/packages/integration-shims/src/logs.ts +++ b/packages/integration-shims/src/logs.ts @@ -1,5 +1,5 @@ -import type { ParameterizedString } from '@sentry/core/browser'; -import { consoleSandbox, defineIntegration } from '@sentry/core/browser'; +import type { ParameterizedString } from '@sentry/core'; +import { consoleSandbox, defineIntegration } from '@sentry/core'; import { FAKE_FUNCTION } from './common'; import { DEBUG_BUILD } from './debug-build'; diff --git a/packages/integration-shims/src/metrics.ts b/packages/integration-shims/src/metrics.ts index 6f021fdcdc26..dba65ca3ec30 100644 --- a/packages/integration-shims/src/metrics.ts +++ b/packages/integration-shims/src/metrics.ts @@ -1,4 +1,4 @@ -import { consoleSandbox } from '@sentry/core/browser'; +import { consoleSandbox } from '@sentry/core'; import { DEBUG_BUILD } from './debug-build'; /** diff --git a/packages/nextjs/src/common/utils/responseEnd.ts b/packages/nextjs/src/common/utils/responseEnd.ts index 5159897f076e..31e3fa698433 100644 --- a/packages/nextjs/src/common/utils/responseEnd.ts +++ b/packages/nextjs/src/common/utils/responseEnd.ts @@ -1,5 +1,6 @@ import type { Span } from '@sentry/core'; -import { debug, fill, flush, GLOBAL_OBJ, setHttpStatus, vercelWaitUntil } from '@sentry/core'; +import { debug, fill, flush, GLOBAL_OBJ, setHttpStatus } from '@sentry/core'; +import { vercelWaitUntil } from '@sentry/core/server'; import type { ServerResponse } from 'http'; import { DEBUG_BUILD } from '../debug-build'; import type { ResponseEndMethod, WrappedResponseEndMethod } from '../types'; diff --git a/packages/nextjs/src/config/handleRunAfterProductionCompile.ts b/packages/nextjs/src/config/handleRunAfterProductionCompile.ts index 51591f8cfc50..ae4b0a91d84a 100644 --- a/packages/nextjs/src/config/handleRunAfterProductionCompile.ts +++ b/packages/nextjs/src/config/handleRunAfterProductionCompile.ts @@ -1,5 +1,5 @@ import type { createSentryBuildPluginManager as createSentryBuildPluginManagerType } from '@sentry/bundler-plugins/core'; -import { loadModule } from '@sentry/core'; +import { loadModule } from '@sentry/core/server'; import * as fs from 'fs'; import * as path from 'path'; import { getBuildLogger } from './buildLogger'; diff --git a/packages/nextjs/src/config/webpack.ts b/packages/nextjs/src/config/webpack.ts index 4076c062fbc1..9f594973b41c 100644 --- a/packages/nextjs/src/config/webpack.ts +++ b/packages/nextjs/src/config/webpack.ts @@ -1,7 +1,8 @@ /* eslint-disable complexity */ /* eslint-disable max-lines */ -import { debug, escapeStringForRegex, loadModule, parseSemver } from '@sentry/core'; +import { debug, escapeStringForRegex, parseSemver } from '@sentry/core'; +import { loadModule } from '@sentry/core/server'; import * as fs from 'fs'; import { createRequire } from 'module'; import * as path from 'path'; diff --git a/packages/nextjs/src/index.types.ts b/packages/nextjs/src/index.types.ts index c9a4eaa8980a..baaed91053d2 100644 --- a/packages/nextjs/src/index.types.ts +++ b/packages/nextjs/src/index.types.ts @@ -25,7 +25,7 @@ export declare const contextLinesIntegration: typeof clientSdk.contextLinesInteg export declare const consoleIntegration: typeof serverSdk.consoleIntegration; // Node-only at runtime; the edge build exports an inert shim so named imports resolve in edge-compiled modules. export declare const pinoIntegration: typeof serverSdk.pinoIntegration; -// The client uses the `@sentry/core/browser` span-start APIs while server and edge use the Cache +// The client uses the `@sentry/core` span-start APIs while server and edge use the Cache // Components-aware ones from `common/utils/nextSpan`. Same signatures, but the star exports above // are ambiguous without these. export declare const startSpan: typeof clientSdk.startSpan; diff --git a/packages/nextjs/test/common/utils/responseEnd.test.ts b/packages/nextjs/test/common/utils/responseEnd.test.ts index 77755e605c85..8b5c7a98dc19 100644 --- a/packages/nextjs/test/common/utils/responseEnd.test.ts +++ b/packages/nextjs/test/common/utils/responseEnd.test.ts @@ -10,6 +10,13 @@ vi.mock('@sentry/core', async () => { log: vi.fn(), }, flush: vi.fn(), + }; +}); + +vi.mock('@sentry/core/server', async () => { + const actual = await vi.importActual('@sentry/core/server'); + return { + ...actual, vercelWaitUntil: vi.fn(), }; }); @@ -42,12 +49,12 @@ describe('responseEnd utils', () => { expect(cfWaitUntilMock).toHaveBeenCalledTimes(1); // Should not call vercelWaitUntil when Cloudflare is available - const { vercelWaitUntil } = await import('@sentry/core'); + const { vercelWaitUntil } = await import('@sentry/core/server'); expect(vercelWaitUntil).not.toHaveBeenCalled(); }); it('should use vercelWaitUntil when Cloudflare context is not available', async () => { - const { vercelWaitUntil } = await import('@sentry/core'); + const { vercelWaitUntil } = await import('@sentry/core/server'); const testTask = Promise.resolve('test'); waitUntil(testTask); @@ -80,12 +87,12 @@ describe('responseEnd utils', () => { expect(cfWaitUntilMock).toHaveBeenCalledTimes(1); // Should not use Vercel - const { vercelWaitUntil } = await import('@sentry/core'); + const { vercelWaitUntil } = await import('@sentry/core/server'); expect(vercelWaitUntil).not.toHaveBeenCalled(); }); it('should handle errors gracefully when waitUntil is called with a rejected promise', async () => { - const { vercelWaitUntil } = await import('@sentry/core'); + const { vercelWaitUntil } = await import('@sentry/core/server'); const testTask = Promise.reject(new Error('test error')); // Should not throw synchronously diff --git a/packages/nextjs/test/config/handleRunAfterProductionCompile.test.ts b/packages/nextjs/test/config/handleRunAfterProductionCompile.test.ts index dd3f23343878..ebff37a09c5a 100644 --- a/packages/nextjs/test/config/handleRunAfterProductionCompile.test.ts +++ b/packages/nextjs/test/config/handleRunAfterProductionCompile.test.ts @@ -1,4 +1,4 @@ -import { loadModule } from '@sentry/core'; +import { loadModule } from '@sentry/core/server'; import * as fs from 'fs'; import * as os from 'os'; import * as path from 'path'; @@ -11,7 +11,7 @@ import { } from '../../src/config/handleRunAfterProductionCompile'; import type { SentryBuildOptions } from '../../src/config/types'; -vi.mock('@sentry/core', () => ({ +vi.mock('@sentry/core/server', () => ({ loadModule: vi.fn(), })); diff --git a/packages/nextjs/test/config/webpack/constructWebpackConfig.test.ts b/packages/nextjs/test/config/webpack/constructWebpackConfig.test.ts index 96eb751bc697..2fc626c67e46 100644 --- a/packages/nextjs/test/config/webpack/constructWebpackConfig.test.ts +++ b/packages/nextjs/test/config/webpack/constructWebpackConfig.test.ts @@ -1,6 +1,6 @@ // mock helper functions not tested directly in this file import '../mocks'; -import * as core from '@sentry/core'; +import * as coreServer from '@sentry/core/server'; import { describe, expect, it, vi } from 'vitest'; import * as getBuildPluginOptionsModule from '../../../src/config/getBuildPluginOptions'; import { @@ -24,7 +24,7 @@ vi.mock('@sentry/server-utils/orchestrion/webpack', async importOriginal => ({ describe('constructWebpackConfigFunction()', () => { it('includes expected properties', async () => { - vi.spyOn(core, 'loadModule').mockImplementation(() => ({ + vi.spyOn(coreServer, 'loadModule').mockImplementation(() => ({ sentryWebpackPlugin: () => ({ _name: 'sentry-webpack-plugin', }), @@ -62,7 +62,7 @@ describe('constructWebpackConfigFunction()', () => { it('automatically enables deleteSourcemapsAfterUpload for client builds when not explicitly set', async () => { const getBuildPluginOptionsSpy = vi.spyOn(getBuildPluginOptionsModule, 'getBuildPluginOptions'); - vi.spyOn(core, 'loadModule').mockImplementation(() => ({ + vi.spyOn(coreServer, 'loadModule').mockImplementation(() => ({ sentryWebpackPlugin: () => ({ _name: 'sentry-webpack-plugin', }), @@ -116,7 +116,7 @@ describe('constructWebpackConfigFunction()', () => { it('passes useRunAfterProductionCompileHook to getBuildPluginOptions when enabled', async () => { const getBuildPluginOptionsSpy = vi.spyOn(getBuildPluginOptionsModule, 'getBuildPluginOptions'); - vi.spyOn(core, 'loadModule').mockImplementation(() => ({ + vi.spyOn(coreServer, 'loadModule').mockImplementation(() => ({ sentryWebpackPlugin: () => ({ _name: 'sentry-webpack-plugin', }), @@ -142,7 +142,7 @@ describe('constructWebpackConfigFunction()', () => { it('passes useRunAfterProductionCompileHook to getBuildPluginOptions when disabled', async () => { const getBuildPluginOptionsSpy = vi.spyOn(getBuildPluginOptionsModule, 'getBuildPluginOptions'); - vi.spyOn(core, 'loadModule').mockImplementation(() => ({ + vi.spyOn(coreServer, 'loadModule').mockImplementation(() => ({ sentryWebpackPlugin: () => ({ _name: 'sentry-webpack-plugin', }), @@ -168,7 +168,7 @@ describe('constructWebpackConfigFunction()', () => { it('passes useRunAfterProductionCompileHook as undefined when not specified', async () => { const getBuildPluginOptionsSpy = vi.spyOn(getBuildPluginOptionsModule, 'getBuildPluginOptions'); - vi.spyOn(core, 'loadModule').mockImplementation(() => ({ + vi.spyOn(coreServer, 'loadModule').mockImplementation(() => ({ sentryWebpackPlugin: () => ({ _name: 'sentry-webpack-plugin', }), @@ -230,7 +230,7 @@ describe('constructWebpackConfigFunction()', () => { }); it('uses `hidden-source-map` as `devtool` value for client-side builds', async () => { - vi.spyOn(core, 'loadModule').mockImplementation(() => ({ + vi.spyOn(coreServer, 'loadModule').mockImplementation(() => ({ sentryWebpackPlugin: () => ({ _name: 'sentry-webpack-plugin', }), @@ -294,7 +294,7 @@ describe('constructWebpackConfigFunction()', () => { describe('treeshaking flags', () => { it('does not add DefinePlugin when treeshake option is not set', async () => { - vi.spyOn(core, 'loadModule').mockImplementation(() => ({ + vi.spyOn(coreServer, 'loadModule').mockImplementation(() => ({ sentryWebpackPlugin: () => ({ _name: 'sentry-webpack-plugin', }), @@ -322,7 +322,7 @@ describe('constructWebpackConfigFunction()', () => { }); it('does not add DefinePlugin when treeshake option is empty object', async () => { - vi.spyOn(core, 'loadModule').mockImplementation(() => ({ + vi.spyOn(coreServer, 'loadModule').mockImplementation(() => ({ sentryWebpackPlugin: () => ({ _name: 'sentry-webpack-plugin', }), @@ -354,7 +354,7 @@ describe('constructWebpackConfigFunction()', () => { }); it('adds __SENTRY_DEBUG__ flag when debugLogging is true', async () => { - vi.spyOn(core, 'loadModule').mockImplementation(() => ({ + vi.spyOn(coreServer, 'loadModule').mockImplementation(() => ({ sentryWebpackPlugin: () => ({ _name: 'sentry-webpack-plugin', }), @@ -382,7 +382,7 @@ describe('constructWebpackConfigFunction()', () => { }); it('adds __SENTRY_TRACING__ flag when tracing is true', async () => { - vi.spyOn(core, 'loadModule').mockImplementation(() => ({ + vi.spyOn(coreServer, 'loadModule').mockImplementation(() => ({ sentryWebpackPlugin: () => ({ _name: 'sentry-webpack-plugin', }), @@ -410,7 +410,7 @@ describe('constructWebpackConfigFunction()', () => { }); it('adds __RRWEB_EXCLUDE_IFRAME__ flag when excludeReplayIframe is true', async () => { - vi.spyOn(core, 'loadModule').mockImplementation(() => ({ + vi.spyOn(coreServer, 'loadModule').mockImplementation(() => ({ sentryWebpackPlugin: () => ({ _name: 'sentry-webpack-plugin', }), @@ -439,7 +439,7 @@ describe('constructWebpackConfigFunction()', () => { }); it('adds __RRWEB_EXCLUDE_SHADOW_DOM__ flag when excludeReplayShadowDOM is true', async () => { - vi.spyOn(core, 'loadModule').mockImplementation(() => ({ + vi.spyOn(coreServer, 'loadModule').mockImplementation(() => ({ sentryWebpackPlugin: () => ({ _name: 'sentry-webpack-plugin', }), @@ -468,7 +468,7 @@ describe('constructWebpackConfigFunction()', () => { }); it('adds __SENTRY_EXCLUDE_REPLAY_WORKER__ flag when excludeReplayCompressionWorker is true', async () => { - vi.spyOn(core, 'loadModule').mockImplementation(() => ({ + vi.spyOn(coreServer, 'loadModule').mockImplementation(() => ({ sentryWebpackPlugin: () => ({ _name: 'sentry-webpack-plugin', }), @@ -498,7 +498,7 @@ describe('constructWebpackConfigFunction()', () => { }); it('adds all flags when all treeshake options are enabled', async () => { - vi.spyOn(core, 'loadModule').mockImplementation(() => ({ + vi.spyOn(coreServer, 'loadModule').mockImplementation(() => ({ sentryWebpackPlugin: () => ({ _name: 'sentry-webpack-plugin', }), @@ -544,7 +544,7 @@ describe('constructWebpackConfigFunction()', () => { }); it('does not add flags when treeshake options are false', async () => { - vi.spyOn(core, 'loadModule').mockImplementation(() => ({ + vi.spyOn(coreServer, 'loadModule').mockImplementation(() => ({ sentryWebpackPlugin: () => ({ _name: 'sentry-webpack-plugin', }), @@ -582,7 +582,7 @@ describe('constructWebpackConfigFunction()', () => { }); it('works for client builds', async () => { - vi.spyOn(core, 'loadModule').mockImplementation(() => ({ + vi.spyOn(coreServer, 'loadModule').mockImplementation(() => ({ sentryWebpackPlugin: () => ({ _name: 'sentry-webpack-plugin', }), @@ -617,7 +617,7 @@ describe('constructWebpackConfigFunction()', () => { }); it('works for edge builds', async () => { - vi.spyOn(core, 'loadModule').mockImplementation(() => ({ + vi.spyOn(coreServer, 'loadModule').mockImplementation(() => ({ sentryWebpackPlugin: () => ({ _name: 'sentry-webpack-plugin', }), @@ -653,7 +653,7 @@ describe('constructWebpackConfigFunction()', () => { }); it('only adds flags for enabled options', async () => { - vi.spyOn(core, 'loadModule').mockImplementation(() => ({ + vi.spyOn(coreServer, 'loadModule').mockImplementation(() => ({ sentryWebpackPlugin: () => ({ _name: 'sentry-webpack-plugin', }), diff --git a/packages/nitro/src/runtime/hooks/captureErrorHook.ts b/packages/nitro/src/runtime/hooks/captureErrorHook.ts index 1e0918a4c4e8..2f7a602f3af1 100644 --- a/packages/nitro/src/runtime/hooks/captureErrorHook.ts +++ b/packages/nitro/src/runtime/hooks/captureErrorHook.ts @@ -1,4 +1,5 @@ -import { captureException, flushIfServerless, getClient, parseUrl } from '@sentry/core'; +import { captureException, getClient, parseUrl } from '@sentry/core'; +import { flushIfServerless } from '@sentry/core/server'; import { HTTPError } from 'h3'; import type { CapturedErrorContext } from 'nitro/types'; diff --git a/packages/nitro/src/runtime/hooks/captureStorageEvents.ts b/packages/nitro/src/runtime/hooks/captureStorageEvents.ts index a042eb52ea8d..a47ef1a30b6a 100644 --- a/packages/nitro/src/runtime/hooks/captureStorageEvents.ts +++ b/packages/nitro/src/runtime/hooks/captureStorageEvents.ts @@ -2,7 +2,6 @@ import * as dc from 'node:diagnostics_channel'; import { SENTRY_OP } from '@sentry/conventions/attributes'; import { CACHE_GET, CACHE_PUT, CACHE_REMOVE } from '@sentry/conventions/op'; import { - flushIfServerless, GLOBAL_OBJ, isObjectLike, SEMANTIC_ATTRIBUTE_CACHE_HIT, @@ -10,6 +9,7 @@ import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan, } from '@sentry/core'; +import { flushIfServerless } from '@sentry/core/server'; import { bindTracingChannelToSpan } from '@sentry/server-utils'; import type { TraceContext } from 'unstorage/tracing'; diff --git a/packages/nitro/test/runtime/hooks/captureErrorHook.test.ts b/packages/nitro/test/runtime/hooks/captureErrorHook.test.ts index 1041e2725527..f83395b6c7db 100644 --- a/packages/nitro/test/runtime/hooks/captureErrorHook.test.ts +++ b/packages/nitro/test/runtime/hooks/captureErrorHook.test.ts @@ -1,4 +1,5 @@ import * as SentryCore from '@sentry/core'; +import * as SentryCoreServer from '@sentry/core/server'; import { HTTPError } from 'h3'; import { beforeEach, describe, expect, it, vi } from 'vitest'; import { captureErrorHook } from '../../../src/runtime/hooks/captureErrorHook'; @@ -8,7 +9,6 @@ vi.mock('@sentry/core', async importOriginal => { return { ...(mod as any), captureException: vi.fn(), - flushIfServerless: vi.fn(), getClient: vi.fn(), getCurrentScope: vi.fn(() => ({ setTransactionName: vi.fn(), @@ -16,6 +16,14 @@ vi.mock('@sentry/core', async importOriginal => { }; }); +vi.mock('@sentry/core/server', async importOriginal => { + const mod = await importOriginal(); + return { + ...(mod as any), + flushIfServerless: vi.fn(), + }; +}); + describe('captureErrorHook', () => { const mockErrorContext = { event: { @@ -28,7 +36,7 @@ describe('captureErrorHook', () => { (SentryCore.getClient as any).mockReturnValue({ getOptions: () => ({}), }); - (SentryCore.flushIfServerless as any).mockResolvedValue(undefined); + (SentryCoreServer.flushIfServerless as any).mockResolvedValue(undefined); }); it('should capture regular errors', async () => { @@ -107,7 +115,7 @@ describe('captureErrorHook', () => { await captureErrorHook(error, mockErrorContext); - expect(SentryCore.flushIfServerless).toHaveBeenCalled(); + expect(SentryCoreServer.flushIfServerless).toHaveBeenCalled(); }); it('should handle missing event in error context', async () => { diff --git a/packages/node-native/src/event-loop-block-watchdog.ts b/packages/node-native/src/event-loop-block-watchdog.ts index 853bcbf35a6e..0145a1ff7809 100644 --- a/packages/node-native/src/event-loop-block-watchdog.ts +++ b/packages/node-native/src/event-loop-block-watchdog.ts @@ -4,7 +4,6 @@ import { applyScopeDataToEvent, createEventEnvelope, createSessionEnvelope, - filenameIsInApp, generateSpanId, getEnvelopeEndpointWithUrlEncodedAuth, makeSession, @@ -15,6 +14,7 @@ import { updateSession, uuid4, } from '@sentry/core'; +import { filenameIsInApp } from '@sentry/core/server'; import { makeNodeTransport } from '@sentry/node'; import { captureStackTrace, getThreadsLastSeen } from '@sentry/node-native-stacktrace'; import type { ThreadState, WorkerStartData } from './common'; diff --git a/packages/node/src/index.ts b/packages/node/src/index.ts index 810e290df15c..d98bf3ed9ce7 100644 --- a/packages/node/src/index.ts +++ b/packages/node/src/index.ts @@ -143,7 +143,6 @@ export { spanToJSON, spanToTraceHeader, spanToBaggageHeader, - trpcMiddleware, updateSpanName, supabaseIntegration, instrumentSupabaseClient, @@ -151,10 +150,10 @@ export { profiler, consoleLoggingIntegration, createConsolaReporter, - wrapMcpServerWithSentry, featureFlagsIntegration, spanStreamingIntegration, } from '@sentry/core'; +export { trpcMiddleware, wrapMcpServerWithSentry } from '@sentry/core/server'; export type { Breadcrumb, diff --git a/packages/node/src/integrations/anr/worker.ts b/packages/node/src/integrations/anr/worker.ts index 3ae9e009625c..fa6054c850e6 100644 --- a/packages/node/src/integrations/anr/worker.ts +++ b/packages/node/src/integrations/anr/worker.ts @@ -3,7 +3,6 @@ import { parentPort, workerData } from 'node:worker_threads'; import type { DebugImage, Event, ScopeData, Session, StackFrame } from '@sentry/core'; import { applyScopeDataToEvent, - callFrameToStackFrame, createEventEnvelope, createSessionEnvelope, generateSpanId, @@ -13,8 +12,8 @@ import { stripSentryFramesAndReverse, updateSession, uuid4, - watchdogTimer, } from '@sentry/core'; +import { callFrameToStackFrame, watchdogTimer } from '@sentry/core/server'; import { makeNodeTransport } from '../../transports'; import { createGetModuleFromFilename } from '../../utils/module'; import type { WorkerStartData } from './common'; diff --git a/packages/node/src/integrations/http/SentryHttpInstrumentation.ts b/packages/node/src/integrations/http/SentryHttpInstrumentation.ts index d1afb8e141cb..a0d38f50043c 100644 --- a/packages/node/src/integrations/http/SentryHttpInstrumentation.ts +++ b/packages/node/src/integrations/http/SentryHttpInstrumentation.ts @@ -1,14 +1,15 @@ import { subscribe } from 'node:diagnostics_channel'; import { context, trace } from '@opentelemetry/api'; import type { ClientRequest, IncomingMessage } from 'node:http'; -import type { HttpClientRequest, HttpIncomingMessage, HttpInstrumentationOptions, Span } from '@sentry/core'; +import type { Span } from '@sentry/core'; +import { isTracingSuppressed } from '@sentry/core'; +import type { HttpClientRequest, HttpIncomingMessage, HttpInstrumentationOptions } from '@sentry/core/server'; import { getHttpClientSubscriptions, - patchHttpModuleClient, getRequestOptions, - isTracingSuppressed, -} from '@sentry/core'; -import { HTTP_ON_CLIENT_REQUEST } from '@sentry/core'; + HTTP_ON_CLIENT_REQUEST, + patchHttpModuleClient, +} from '@sentry/core/server'; import { NODE_VERSION } from '../../nodeVersion'; import { errorMonitor } from 'node:events'; import * as http from 'node:http'; diff --git a/packages/node/src/integrations/http/httpServerIntegration.ts b/packages/node/src/integrations/http/httpServerIntegration.ts index 3d5610a5cfa4..68de63aeecdb 100644 --- a/packages/node/src/integrations/http/httpServerIntegration.ts +++ b/packages/node/src/integrations/http/httpServerIntegration.ts @@ -1,15 +1,10 @@ import { subscribe } from 'node:diagnostics_channel'; import type { RequestOptions } from 'node:http'; import { context, createContextKey, propagation } from '@opentelemetry/api'; -import type { HttpIncomingMessage, HttpServerResponse, Integration, IntegrationFn } from '@sentry/core'; -import { - addNonEnumerableProperty, - debug, - getClient, - getHttpServerSubscriptions, - HTTP_ON_SERVER_REQUEST, - recordRequestSession, -} from '@sentry/core'; +import type { Integration, IntegrationFn } from '@sentry/core'; +import { addNonEnumerableProperty, debug, getClient } from '@sentry/core'; +import type { HttpIncomingMessage, HttpServerResponse } from '@sentry/core/server'; +import { getHttpServerSubscriptions, HTTP_ON_SERVER_REQUEST, recordRequestSession } from '@sentry/core/server'; import type { RequestEventData } from '@sentry/core'; import { DEBUG_BUILD } from '../../debug-build'; diff --git a/packages/node/src/integrations/http/httpServerSpansIntegration.ts b/packages/node/src/integrations/http/httpServerSpansIntegration.ts index 9ad0f8fee63d..cb9de82677b0 100644 --- a/packages/node/src/integrations/http/httpServerSpansIntegration.ts +++ b/packages/node/src/integrations/http/httpServerSpansIntegration.ts @@ -26,20 +26,11 @@ import { USER_AGENT_ORIGINAL, } from '@sentry/conventions/attributes'; import { HTTP_SERVER } from '@sentry/conventions/op'; -import type { - Event, - HttpIncomingMessage, - HttpServerResponse, - Integration, - IntegrationFn, - Span, - SpanAttributes, - SpanStatus, -} from '@sentry/core'; +import type { Event, Integration, IntegrationFn, Span, SpanAttributes, SpanStatus } from '@sentry/core'; +import type { HttpIncomingMessage, HttpServerResponse } from '@sentry/core/server'; +import { DEFAULT_IGNORE_STATUS_CODES, processHttpServerTransactionEvent } from '@sentry/core/server'; import { debug, - DEFAULT_IGNORE_STATUS_CODES, - processHttpServerTransactionEvent, getSpanStatusFromHttpCode, httpHeadersToSpanAttributes, getContentLengthFromHeaders, diff --git a/packages/node/src/integrations/http/index.ts b/packages/node/src/integrations/http/index.ts index 57a7b013c4a5..f0cfc28cdc87 100644 --- a/packages/node/src/integrations/http/index.ts +++ b/packages/node/src/integrations/http/index.ts @@ -4,11 +4,11 @@ import { URL_FULL } from '@sentry/conventions/attributes'; import { defineIntegration, getClient, - getRequestUrlFromClientRequest, hasSpansEnabled, hasSpanStreamingEnabled, stripDataUrlContent, } from '@sentry/core'; +import { getRequestUrlFromClientRequest } from '@sentry/core/server'; import type { NodeClient } from '../../sdk/client'; import type { HttpServerIntegrationOptions } from './httpServerIntegration'; import { httpServerIntegration } from './httpServerIntegration'; diff --git a/packages/node/src/integrations/nodeRuntimeMetrics.ts b/packages/node/src/integrations/nodeRuntimeMetrics.ts index 72e7d05e43e4..0c2b92307778 100644 --- a/packages/node/src/integrations/nodeRuntimeMetrics.ts +++ b/packages/node/src/integrations/nodeRuntimeMetrics.ts @@ -1,5 +1,6 @@ import { monitorEventLoopDelay, performance } from 'perf_hooks'; -import { _INTERNAL_safeDateNow, _INTERNAL_safeUnref, defineIntegration, metrics } from '@sentry/core'; +import { _INTERNAL_safeDateNow, defineIntegration, metrics } from '@sentry/core'; +import { _INTERNAL_safeUnref } from '@sentry/core/server'; const INTEGRATION_NAME = 'NodeRuntimeMetrics' as const; const DEFAULT_INTERVAL_MS = 30_000; diff --git a/packages/node/src/sdk/api.ts b/packages/node/src/sdk/api.ts index 1ccb630f8b32..f3d02265ea4d 100644 --- a/packages/node/src/sdk/api.ts +++ b/packages/node/src/sdk/api.ts @@ -1,7 +1,8 @@ // PUBLIC APIS import type { StackParser } from '@sentry/core'; -import { createStackParser, GLOBAL_OBJ, nodeStackLineParser } from '@sentry/core'; +import { createStackParser, GLOBAL_OBJ } from '@sentry/core'; +import { nodeStackLineParser } from '@sentry/core/server'; import { createGetModuleFromFilename } from '../utils/module'; /** diff --git a/packages/node/src/sdk/client.ts b/packages/node/src/sdk/client.ts index 0f35938114bc..76a4323f3f75 100644 --- a/packages/node/src/sdk/client.ts +++ b/packages/node/src/sdk/client.ts @@ -1,7 +1,7 @@ import * as os from 'node:os'; import type { Tracer } from '@opentelemetry/api'; import { trace } from '@opentelemetry/api'; -import type { ServerRuntimeClientOptions } from '@sentry/core'; +import type { ServerRuntimeClientOptions } from '@sentry/core/server'; import { _INTERNAL_clearAiProviderSkips, _INTERNAL_flushLogsBuffer, @@ -9,8 +9,8 @@ import { applySdkMetadata, debug, SDK_VERSION, - ServerRuntimeClient, } from '@sentry/core'; +import { ServerRuntimeClient } from '@sentry/core/server'; import { type AsyncLocalStorageLookup, registerPrepareSpanScope, diff --git a/packages/node/src/types.ts b/packages/node/src/types.ts index 42c78ea5b556..220c194c6546 100644 --- a/packages/node/src/types.ts +++ b/packages/node/src/types.ts @@ -1,4 +1,5 @@ -import type { ClientOptions, Options, Scope, ServerRuntimeOptions } from '@sentry/core'; +import type { ClientOptions, Options, Scope } from '@sentry/core'; +import type { ServerRuntimeOptions } from '@sentry/core/server'; import type { NodeTransportOptions } from './transports'; /** diff --git a/packages/node/test/integrations/httpServerIntegration.test.ts b/packages/node/test/integrations/httpServerIntegration.test.ts index 54ae8e2ba653..0a677246773b 100644 --- a/packages/node/test/integrations/httpServerIntegration.test.ts +++ b/packages/node/test/integrations/httpServerIntegration.test.ts @@ -1,5 +1,6 @@ import type { Client } from '@sentry/core'; -import { createTransport, Scope, ServerRuntimeClient, withScope } from '@sentry/core'; +import { createTransport, Scope, withScope } from '@sentry/core'; +import { ServerRuntimeClient } from '@sentry/core/server'; import { EventEmitter } from 'stream'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { recordRequestSession } from '../../src/integrations/http/httpServerIntegration'; diff --git a/packages/nuxt/src/runtime/hooks/captureErrorHook.ts b/packages/nuxt/src/runtime/hooks/captureErrorHook.ts index b8e53f0ca0c3..50d5a61a2828 100644 --- a/packages/nuxt/src/runtime/hooks/captureErrorHook.ts +++ b/packages/nuxt/src/runtime/hooks/captureErrorHook.ts @@ -1,4 +1,5 @@ -import { captureException, flushIfServerless, getClient, getCurrentScope } from '@sentry/core'; +import { captureException, getClient, getCurrentScope } from '@sentry/core'; +import { flushIfServerless } from '@sentry/core/server'; // eslint-disable-next-line import/no-extraneous-dependencies import { H3Error } from 'h3'; import type { CapturedErrorContext } from 'nitropack/types'; diff --git a/packages/nuxt/src/runtime/hooks/wrapMiddlewareHandler.ts b/packages/nuxt/src/runtime/hooks/wrapMiddlewareHandler.ts index 730e49b42860..f5adf02ea0eb 100644 --- a/packages/nuxt/src/runtime/hooks/wrapMiddlewareHandler.ts +++ b/packages/nuxt/src/runtime/hooks/wrapMiddlewareHandler.ts @@ -3,7 +3,6 @@ import { MIDDLEWARE } from '@sentry/conventions/op'; import { captureException, debug, - flushIfServerless, getClient, httpHeadersToSpanAttributes, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, @@ -12,6 +11,7 @@ import { type SpanAttributes, startSpan, } from '@sentry/core'; +import { flushIfServerless } from '@sentry/core/server'; import type { _ResponseMiddleware as ResponseMiddleware, EventHandler, diff --git a/packages/nuxt/src/runtime/utils/instrumentDatabase.ts b/packages/nuxt/src/runtime/utils/instrumentDatabase.ts index 09e091696467..b4c928a3945f 100644 --- a/packages/nuxt/src/runtime/utils/instrumentDatabase.ts +++ b/packages/nuxt/src/runtime/utils/instrumentDatabase.ts @@ -4,13 +4,13 @@ import { addBreadcrumb, captureException, debug, - flushIfServerless, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, type Span, SPAN_STATUS_ERROR, startSpan, type StartSpanOptions, } from '@sentry/core'; +import { flushIfServerless } from '@sentry/core/server'; import type { Database, PreparedStatement } from 'db0'; import { type DatabaseConnectionConfig, type DatabaseSpanData, getDatabaseSpanData } from './database-span-data'; diff --git a/packages/nuxt/src/runtime/utils/instrumentStorage.ts b/packages/nuxt/src/runtime/utils/instrumentStorage.ts index 127a7e6d897d..e44f4699b9af 100644 --- a/packages/nuxt/src/runtime/utils/instrumentStorage.ts +++ b/packages/nuxt/src/runtime/utils/instrumentStorage.ts @@ -4,7 +4,6 @@ import { isObjectLike, captureException, debug, - flushIfServerless, SEMANTIC_ATTRIBUTE_CACHE_HIT, SEMANTIC_ATTRIBUTE_CACHE_KEY, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, @@ -14,6 +13,7 @@ import { startSpan, type StartSpanOptions, } from '@sentry/core'; +import { flushIfServerless } from '@sentry/core/server'; import type { Driver, Storage } from 'unstorage'; /** diff --git a/packages/nuxt/src/runtime/utils/patchEventHandler.ts b/packages/nuxt/src/runtime/utils/patchEventHandler.ts index 41625012c10c..9349e29d1add 100644 --- a/packages/nuxt/src/runtime/utils/patchEventHandler.ts +++ b/packages/nuxt/src/runtime/utils/patchEventHandler.ts @@ -1,10 +1,5 @@ -import { - debug, - flushIfServerless, - getDefaultIsolationScope, - getIsolationScope, - withIsolationScope, -} from '@sentry/core'; +import { debug, getDefaultIsolationScope, getIsolationScope, withIsolationScope } from '@sentry/core'; +import { flushIfServerless } from '@sentry/core/server'; /** * Patches the H3 event handler of Nitro. diff --git a/packages/nuxt/test/runtime/hooks/captureErrorHook.test.ts b/packages/nuxt/test/runtime/hooks/captureErrorHook.test.ts index 30776c4d932c..8e166a5ff4cc 100644 --- a/packages/nuxt/test/runtime/hooks/captureErrorHook.test.ts +++ b/packages/nuxt/test/runtime/hooks/captureErrorHook.test.ts @@ -1,4 +1,5 @@ import * as SentryCore from '@sentry/core'; +import * as SentryCoreServer from '@sentry/core/server'; import { H3Error } from 'h3'; import type { CapturedErrorContext } from 'nitropack/types'; import { beforeEach, describe, expect, it, vi } from 'vitest'; @@ -9,7 +10,6 @@ vi.mock('@sentry/core', async importOriginal => { return { ...(mod as any), captureException: vi.fn(), - flushIfServerless: vi.fn(), getClient: vi.fn(), getCurrentScope: vi.fn(() => ({ setTransactionName: vi.fn(), @@ -17,6 +17,14 @@ vi.mock('@sentry/core', async importOriginal => { }; }); +vi.mock('@sentry/core/server', async importOriginal => { + const mod = await importOriginal(); + return { + ...(mod as any), + flushIfServerless: vi.fn(), + }; +}); + vi.mock('../../../src/runtime/utils', () => ({ extractErrorContext: vi.fn(() => ({ test: 'context' })), })); @@ -34,7 +42,7 @@ describe('sentryCaptureErrorHook', () => { (SentryCore.getClient as any).mockReturnValue({ getOptions: () => ({}), }); - (SentryCore.flushIfServerless as any).mockResolvedValue(undefined); + (SentryCoreServer.flushIfServerless as any).mockResolvedValue(undefined); }); it('should capture regular errors', async () => { diff --git a/packages/nuxt/test/runtime/hooks/wrapMiddlewareHandler.test.ts b/packages/nuxt/test/runtime/hooks/wrapMiddlewareHandler.test.ts index 96621d1e442d..04d61994579e 100644 --- a/packages/nuxt/test/runtime/hooks/wrapMiddlewareHandler.test.ts +++ b/packages/nuxt/test/runtime/hooks/wrapMiddlewareHandler.test.ts @@ -1,4 +1,5 @@ import * as SentryCore from '@sentry/core'; +import * as SentryCoreServer from '@sentry/core/server'; import type { EventHandler, EventHandlerRequest, H3Event } from 'h3'; import { beforeEach, describe, expect, it, vi } from 'vitest'; import { wrapMiddlewareHandlerWithSentry } from '../../../src/runtime/hooks/wrapMiddlewareHandler'; @@ -13,6 +14,13 @@ vi.mock('@sentry/core', async importOriginal => { getClient: vi.fn(), httpHeadersToSpanAttributes: vi.fn(), captureException: vi.fn(), + }; +}); + +vi.mock('@sentry/core/server', async importOriginal => { + const mod = await importOriginal(); + return { + ...(mod as any), flushIfServerless: vi.fn(), }; }); @@ -55,7 +63,7 @@ describe('wrapMiddlewareHandlerWithSentry', () => { }), }); (SentryCore.httpHeadersToSpanAttributes as any).mockReturnValue({ 'http.request.header.user_agent': 'test-agent' }); - (SentryCore.flushIfServerless as any).mockResolvedValue(undefined); + (SentryCoreServer.flushIfServerless as any).mockResolvedValue(undefined); }); describe('function handler wrapping', () => { diff --git a/packages/react-router/src/server/createSentryHandleError.ts b/packages/react-router/src/server/createSentryHandleError.ts index c8d1dbc6118e..481cbfab1b92 100644 --- a/packages/react-router/src/server/createSentryHandleError.ts +++ b/packages/react-router/src/server/createSentryHandleError.ts @@ -1,4 +1,5 @@ -import { captureException, flushIfServerless } from '@sentry/core'; +import { captureException } from '@sentry/core'; +import { flushIfServerless } from '@sentry/core/server'; import type { HandleErrorFunction } from 'react-router'; export type SentryHandleErrorOptions = { diff --git a/packages/react-router/src/server/createServerInstrumentation.ts b/packages/react-router/src/server/createServerInstrumentation.ts index 4ca18b21d1c8..436ade2dd6d9 100644 --- a/packages/react-router/src/server/createServerInstrumentation.ts +++ b/packages/react-router/src/server/createServerInstrumentation.ts @@ -10,7 +10,6 @@ import { import { FUNCTION, HTTP_SERVER, MIDDLEWARE } from '@sentry/conventions/op'; import { debug, - flushIfServerless, getActiveSpan, getClient, getCurrentScope, @@ -23,6 +22,7 @@ import { updateSpanName, filterCollectedUrl, } from '@sentry/core'; +import { flushIfServerless } from '@sentry/core/server'; import type { ServerInstrumentation } from 'react-router'; import { DEBUG_BUILD } from '../common/debug-build'; import { captureInstrumentationError, getPathFromRequest, getPattern, normalizeRoutePath } from '../common/utils'; diff --git a/packages/react-router/src/server/wrapSentryHandleRequest.ts b/packages/react-router/src/server/wrapSentryHandleRequest.ts index 6227c0693902..8a4af55ce62e 100644 --- a/packages/react-router/src/server/wrapSentryHandleRequest.ts +++ b/packages/react-router/src/server/wrapSentryHandleRequest.ts @@ -1,12 +1,12 @@ import { SENTRY_SEGMENT_NAME_SOURCE, HTTP_ROUTE } from '@sentry/conventions/attributes'; import { - flushIfServerless, getActiveSpan, getCurrentScope, getRootSpan, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, updateSpanName, } from '@sentry/core'; +import { flushIfServerless } from '@sentry/core/server'; import type { AppLoadContext, EntryContext, RouterContextProvider } from 'react-router'; import { isInstrumentationApiUsed } from './serverGlobals'; diff --git a/packages/react-router/test/server/createSentryHandleError.test.ts b/packages/react-router/test/server/createSentryHandleError.test.ts index dddcf2eba86c..e93e60228684 100644 --- a/packages/react-router/test/server/createSentryHandleError.test.ts +++ b/packages/react-router/test/server/createSentryHandleError.test.ts @@ -1,10 +1,14 @@ import * as core from '@sentry/core'; +import * as coreServer from '@sentry/core/server'; import type { ActionFunctionArgs, LoaderFunctionArgs } from 'react-router'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { createSentryHandleError } from '../../src/server/createSentryHandleError'; vi.mock('@sentry/core', () => ({ captureException: vi.fn(), +})); + +vi.mock('@sentry/core/server', () => ({ flushIfServerless: vi.fn().mockResolvedValue(undefined), })); @@ -15,7 +19,7 @@ const mechanism = { describe('createSentryHandleError', () => { const mockCaptureException = vi.mocked(core.captureException); - const mockFlushIfServerless = vi.mocked(core.flushIfServerless); + const mockFlushIfServerless = vi.mocked(coreServer.flushIfServerless); const mockConsoleError = vi.spyOn(console, 'error').mockImplementation(() => {}); const mockError = new Error('Test error'); diff --git a/packages/react-router/test/server/createServerInstrumentation.test.ts b/packages/react-router/test/server/createServerInstrumentation.test.ts index 9ac0ad924277..c7b82679430e 100644 --- a/packages/react-router/test/server/createServerInstrumentation.test.ts +++ b/packages/react-router/test/server/createServerInstrumentation.test.ts @@ -1,5 +1,6 @@ import { URL_FULL, URL_PATH } from '@sentry/conventions/attributes'; import * as core from '@sentry/core'; +import * as coreServer from '@sentry/core/server'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { createSentryServerInstrumentation, @@ -13,7 +14,6 @@ vi.mock('@sentry/core', async () => { ...actual, startSpan: vi.fn(), captureException: vi.fn(), - flushIfServerless: vi.fn(), getActiveSpan: vi.fn(), getRootSpan: vi.fn(), getClient: vi.fn(), @@ -24,6 +24,10 @@ vi.mock('@sentry/core', async () => { }; }); +vi.mock('@sentry/core/server', () => ({ + flushIfServerless: vi.fn(), +})); + vi.mock('../../src/server/serverBuild', () => ({ getMiddlewareName: vi.fn(), })); @@ -146,7 +150,7 @@ describe('createSentryServerInstrumentation', () => { [URL_PATH]: '/test-path', }); expect(mockHandleRequest).toHaveBeenCalled(); - expect(core.flushIfServerless).toHaveBeenCalled(); + expect(coreServer.flushIfServerless).toHaveBeenCalled(); }); it('should create own root span when no active span exists', async () => { @@ -181,7 +185,7 @@ describe('createSentryServerInstrumentation', () => { expect.any(Function), ); expect(mockHandleRequest).toHaveBeenCalled(); - expect(core.flushIfServerless).toHaveBeenCalled(); + expect(coreServer.flushIfServerless).toHaveBeenCalled(); }); it('should capture errors and set span status when root span exists', async () => { @@ -254,7 +258,7 @@ describe('createSentryServerInstrumentation', () => { // Handler should still be called even if URL parsing fails expect(mockHandleRequest).toHaveBeenCalled(); - expect(core.flushIfServerless).toHaveBeenCalled(); + expect(coreServer.flushIfServerless).toHaveBeenCalled(); }); it('should handle relative URLs by using a dummy base', async () => { diff --git a/packages/react-router/test/server/wrapSentryHandleRequest.test.ts b/packages/react-router/test/server/wrapSentryHandleRequest.test.ts index 462917d15dfc..c48bedef8181 100644 --- a/packages/react-router/test/server/wrapSentryHandleRequest.test.ts +++ b/packages/react-router/test/server/wrapSentryHandleRequest.test.ts @@ -1,12 +1,7 @@ import { PassThrough } from 'node:stream'; import { SENTRY_SEGMENT_NAME_SOURCE, HTTP_ROUTE } from '@sentry/conventions/attributes'; -import { - flushIfServerless, - getActiveSpan, - getRootSpan, - getTraceMetaTags, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, -} from '@sentry/core'; +import { getActiveSpan, getRootSpan, getTraceMetaTags, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; +import { flushIfServerless } from '@sentry/core/server'; import { beforeEach, describe, expect, test, vi } from 'vitest'; import { getMetaTagTransformer } from '../../src/server/getMetaTagTransformer'; import { wrapSentryHandleRequest } from '../../src/server/wrapSentryHandleRequest'; @@ -16,12 +11,15 @@ vi.mock('@sentry/core', () => ({ getActiveSpan: vi.fn(), getRootSpan: vi.fn(), getTraceMetaTags: vi.fn(), - flushIfServerless: vi.fn(), updateSpanName: vi.fn(), getCurrentScope: vi.fn(() => ({ setTransactionName: vi.fn() })), GLOBAL_OBJ: globalThis, })); +vi.mock('@sentry/core/server', () => ({ + flushIfServerless: vi.fn(), +})); + describe('wrapSentryHandleRequest', () => { beforeEach(() => { vi.clearAllMocks(); diff --git a/packages/react/src/error.ts b/packages/react/src/error.ts index d85f9b947ab4..e290a2baf4c9 100644 --- a/packages/react/src/error.ts +++ b/packages/react/src/error.ts @@ -1,5 +1,5 @@ import { captureException } from '@sentry/browser'; -import { isError } from '@sentry/core/browser'; +import { isError } from '@sentry/core'; import type { ErrorInfo } from 'react'; /** diff --git a/packages/react/src/reactrouter-compat-utils/route-manifest.ts b/packages/react/src/reactrouter-compat-utils/route-manifest.ts index 3f8c83a27c94..bdc49f76705e 100644 --- a/packages/react/src/reactrouter-compat-utils/route-manifest.ts +++ b/packages/react/src/reactrouter-compat-utils/route-manifest.ts @@ -1,4 +1,4 @@ -import { debug } from '@sentry/core/browser'; +import { debug } from '@sentry/core'; import { DEBUG_BUILD } from '../debug-build'; /** diff --git a/packages/react/src/reactrouter-compat-utils/utils.ts b/packages/react/src/reactrouter-compat-utils/utils.ts index c3d47f3cc6e0..c983e6f76dfb 100644 --- a/packages/react/src/reactrouter-compat-utils/utils.ts +++ b/packages/react/src/reactrouter-compat-utils/utils.ts @@ -1,5 +1,5 @@ -import type { Span, TransactionSource } from '@sentry/core/browser'; -import { debug, getActiveSpan, getRootSpan, spanToJSON } from '@sentry/core/browser'; +import type { Span, TransactionSource } from '@sentry/core'; +import { debug, getActiveSpan, getRootSpan, spanToJSON } from '@sentry/core'; import { DEBUG_BUILD } from '../debug-build'; import type { Location, MatchRoutes, RouteMatch, RouteObject } from '../types'; import { matchRouteManifest, stripBasenameFromPathname } from './route-manifest'; diff --git a/packages/react/src/reactrouterv3.ts b/packages/react/src/reactrouterv3.ts index d4863c81ba19..7e799b742aea 100644 --- a/packages/react/src/reactrouterv3.ts +++ b/packages/react/src/reactrouterv3.ts @@ -4,13 +4,13 @@ import { startBrowserTracingPageLoadSpan, WINDOW, } from '@sentry/browser'; -import type { Integration, TransactionSource } from '@sentry/core/browser'; +import type { Integration, TransactionSource } from '@sentry/core'; import { hasSpanStreamingEnabled, NAVIGATION_SPAN_NAME_FALLBACK, PAGELOAD_SPAN_NAME_FALLBACK, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, -} from '@sentry/core/browser'; +} from '@sentry/core'; import type { Location } from './types'; import { SENTRY_OP, SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE } from '@sentry/conventions/attributes'; import { NAVIGATION, PAGELOAD } from '@sentry/conventions/op'; diff --git a/packages/react/src/redux.ts b/packages/react/src/redux.ts index 00f556f52cd7..b04510a68cc9 100644 --- a/packages/react/src/redux.ts +++ b/packages/react/src/redux.ts @@ -1,12 +1,12 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ -import type { Scope } from '@sentry/core/browser'; +import type { Scope } from '@sentry/core'; import { addBreadcrumb, getClient, getCurrentScope, getGlobalScope, setNormalizationDepthOverrideHint, -} from '@sentry/core/browser'; +} from '@sentry/core'; interface Action { type: T; diff --git a/packages/react/src/sdk.ts b/packages/react/src/sdk.ts index fdba3538c921..3e4768ae42ed 100644 --- a/packages/react/src/sdk.ts +++ b/packages/react/src/sdk.ts @@ -4,8 +4,8 @@ import { normalizeStringifyValue as browserNormalizeStringifyValue, setContext, } from '@sentry/browser'; -import type { Client } from '@sentry/core/browser'; -import { applySdkMetadata, setNormalizeStringifier } from '@sentry/core/browser'; +import type { Client } from '@sentry/core'; +import { applySdkMetadata, setNormalizeStringifier } from '@sentry/core'; import { version } from 'react'; import { isSyntheticEvent } from './isSyntheticEvent'; diff --git a/packages/react/src/tanstackrouter.ts b/packages/react/src/tanstackrouter.ts index e6d1a1e0e681..3d4007d7d155 100644 --- a/packages/react/src/tanstackrouter.ts +++ b/packages/react/src/tanstackrouter.ts @@ -5,14 +5,14 @@ import { startBrowserTracingPageLoadSpan, WINDOW, } from '@sentry/browser'; -import type { Integration } from '@sentry/core/browser'; +import type { Integration } from '@sentry/core'; import { filterCollectedUrl, hasSpanStreamingEnabled, NAVIGATION_SPAN_NAME_FALLBACK, PAGELOAD_SPAN_NAME_FALLBACK, } from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core/browser'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import type { VendoredTanstackRouter, VendoredTanstackRouterRouteMatch } from './vendor/tanstackrouter-types'; import { PARAMS_KEY_BASE, diff --git a/packages/react/test/profiler.test.tsx b/packages/react/test/profiler.test.tsx index c03f87efc860..56e783fb0ab5 100644 --- a/packages/react/test/profiler.test.tsx +++ b/packages/react/test/profiler.test.tsx @@ -1,8 +1,8 @@ /** * @vitest-environment jsdom */ -import type { StartSpanOptions } from '@sentry/core/browser'; -import { SentrySpan } from '@sentry/core/browser'; +import type { StartSpanOptions } from '@sentry/core'; +import { SentrySpan } from '@sentry/core'; import { render } from '@testing-library/react'; import { renderHook } from '@testing-library/react-hooks'; import * as React from 'react'; diff --git a/packages/react/test/redux.test.ts b/packages/react/test/redux.test.ts index 09bcfd6ec9c2..60411418ca6a 100644 --- a/packages/react/test/redux.test.ts +++ b/packages/react/test/redux.test.ts @@ -1,5 +1,5 @@ import * as Sentry from '@sentry/browser'; -import * as SentryCore from '@sentry/core/browser'; +import * as SentryCore from '@sentry/core'; import * as Redux from 'redux'; import type { Mock } from 'vitest'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; @@ -8,7 +8,7 @@ import { createReduxEnhancer } from '../src/redux'; const mockSetContext = vi.fn(); const mockGlobalScopeAddEventProcessor = vi.fn(); -vi.mock('@sentry/core/browser', async requireActual => ({ +vi.mock('@sentry/core', async requireActual => ({ ...(await requireActual()), getCurrentScope() { return { diff --git a/packages/react/test/tanstackrouter.test.ts b/packages/react/test/tanstackrouter.test.ts index 3be33a3168f5..5ae27a3550c9 100644 --- a/packages/react/test/tanstackrouter.test.ts +++ b/packages/react/test/tanstackrouter.test.ts @@ -1,6 +1,6 @@ import * as SentryBrowser from '@sentry/browser'; import { SENTRY_SEGMENT_NAME_SOURCE, URL_TEMPLATE } from '@sentry/conventions/attributes'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core/browser'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { tanstackRouterBrowserTracingIntegration } from '../src/tanstackrouter'; diff --git a/packages/remix/src/client/errors.tsx b/packages/remix/src/client/errors.tsx index 6005ba2cb480..e8dabb1eddd3 100644 --- a/packages/remix/src/client/errors.tsx +++ b/packages/remix/src/client/errors.tsx @@ -1,4 +1,5 @@ -import { captureException, isNodeEnv } from '@sentry/core'; +import { captureException } from '@sentry/core'; +import { isNodeEnv } from '@sentry/core/server'; import { isResponse } from '../utils/vendor/response'; /** diff --git a/packages/remix/src/client/performance.tsx b/packages/remix/src/client/performance.tsx index 1e8e09dc7d81..7ee7d7654025 100644 --- a/packages/remix/src/client/performance.tsx +++ b/packages/remix/src/client/performance.tsx @@ -7,9 +7,9 @@ import { hasSpanStreamingEnabled, NAVIGATION_SPAN_NAME_FALLBACK, PAGELOAD_SPAN_NAME_FALLBACK, - isNodeEnv, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, } from '@sentry/core'; +import { isNodeEnv } from '@sentry/core/server'; import type { BrowserClient, browserTracingIntegration as originalBrowserTracingIntegration } from '@sentry/react'; import { getClient, startBrowserTracingNavigationSpan, startBrowserTracingPageLoadSpan, WINDOW } from '@sentry/react'; import * as React from 'react'; diff --git a/packages/remix/src/cloudflare/index.ts b/packages/remix/src/cloudflare/index.ts index 76f36d25b4e5..3436abae61f2 100644 --- a/packages/remix/src/cloudflare/index.ts +++ b/packages/remix/src/cloudflare/index.ts @@ -110,7 +110,6 @@ export { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SENTRY_SEGMENT_NAME_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, - trpcMiddleware, spanToStaticSpanJSON, spanToJSON, spanToTraceHeader, @@ -121,3 +120,4 @@ export { withStreamedSpan, featureFlagsIntegration, } from '@sentry/core'; +export { trpcMiddleware } from '@sentry/core/server'; diff --git a/packages/remix/src/server/instrumentServer.ts b/packages/remix/src/server/instrumentServer.ts index 382770110d53..a336a7f72c2a 100644 --- a/packages/remix/src/server/instrumentServer.ts +++ b/packages/remix/src/server/instrumentServer.ts @@ -25,8 +25,6 @@ import { hasSpanStreamingEnabled, HTTP_SPAN_NAME_FALLBACK, httpHeadersToSpanAttributes, - isNodeEnv, - loadModule, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, setHttpStatus, spanToJSON, @@ -36,6 +34,7 @@ import { withIsolationScope, filterCollectedUrl, } from '@sentry/core'; +import { isNodeEnv, loadModule } from '@sentry/core/server'; import { DEBUG_BUILD } from '../utils/debug-build'; import { createRoutes, getTransactionName, isCloudflareEnv } from '../utils/utils'; import { extractData, isResponse, json } from '../utils/vendor/response'; diff --git a/packages/remix/src/server/serverTimingTracePropagation.ts b/packages/remix/src/server/serverTimingTracePropagation.ts index d9197c3315bb..8ed0832f9587 100644 --- a/packages/remix/src/server/serverTimingTracePropagation.ts +++ b/packages/remix/src/server/serverTimingTracePropagation.ts @@ -1,4 +1,5 @@ -import { debug, getTraceData, isNodeEnv } from '@sentry/core'; +import { debug, getTraceData } from '@sentry/core'; +import { isNodeEnv } from '@sentry/core/server'; import { DEBUG_BUILD } from '../utils/debug-build'; import { isCloudflareEnv } from '../utils/utils'; diff --git a/packages/remix/test/server/serverTimingTracePropagation.test.ts b/packages/remix/test/server/serverTimingTracePropagation.test.ts index 0543146277df..6aace48645eb 100644 --- a/packages/remix/test/server/serverTimingTracePropagation.test.ts +++ b/packages/remix/test/server/serverTimingTracePropagation.test.ts @@ -1,4 +1,5 @@ -import { getActiveSpan, getTraceData, isNodeEnv } from '@sentry/core'; +import { getActiveSpan, getTraceData } from '@sentry/core'; +import { isNodeEnv } from '@sentry/core/server'; import { beforeEach, describe, expect, it, vi } from 'vitest'; import { generateSentryServerTimingHeader, @@ -28,6 +29,9 @@ vi.mock('@sentry/core', () => ({ })), spanToTraceHeader: vi.fn(() => '12345678901234567890123456789012-1234567890123456-1'), spanToBaggageHeader: vi.fn(() => 'sentry-environment=production,sentry-release=1.0.0'), +})); + +vi.mock('@sentry/core/server', () => ({ isNodeEnv: vi.fn(() => true), })); diff --git a/packages/replay-internal/src/coreHandlers/handleNetworkBreadcrumbs.ts b/packages/replay-internal/src/coreHandlers/handleNetworkBreadcrumbs.ts index 0625d5d5f377..8a9419828827 100644 --- a/packages/replay-internal/src/coreHandlers/handleNetworkBreadcrumbs.ts +++ b/packages/replay-internal/src/coreHandlers/handleNetworkBreadcrumbs.ts @@ -1,4 +1,5 @@ -import type { Breadcrumb, BreadcrumbHint, FetchBreadcrumbData, XhrBreadcrumbData } from '@sentry/core'; +import type { Breadcrumb, BreadcrumbHint, FetchBreadcrumbData } from '@sentry/core'; +import type { XhrBreadcrumbData } from '@sentry/core/browser'; import { getClient } from '@sentry/core'; import type { FetchHint, XhrHint } from '@sentry/browser-utils'; import { DEBUG_BUILD } from '../debug-build'; diff --git a/packages/replay-internal/src/coreHandlers/util/xhrUtils.ts b/packages/replay-internal/src/coreHandlers/util/xhrUtils.ts index 99d36b96edf9..6338f07fcefc 100644 --- a/packages/replay-internal/src/coreHandlers/util/xhrUtils.ts +++ b/packages/replay-internal/src/coreHandlers/util/xhrUtils.ts @@ -1,4 +1,5 @@ -import type { Breadcrumb, XhrBreadcrumbData } from '@sentry/core'; +import type { Breadcrumb } from '@sentry/core'; +import type { XhrBreadcrumbData } from '@sentry/core/browser'; import { isObjectLike } from '@sentry/core'; import type { NetworkMetaWarning, XhrHint } from '@sentry/browser-utils'; import { getBodyString, parseXhrResponseHeaders, SENTRY_XHR_DATA_KEY } from '@sentry/browser-utils'; diff --git a/packages/replay-internal/src/integration.ts b/packages/replay-internal/src/integration.ts index ed5c062f21c7..547b2417090e 100644 --- a/packages/replay-internal/src/integration.ts +++ b/packages/replay-internal/src/integration.ts @@ -1,11 +1,5 @@ -import type { - BrowserClientReplayOptions, - Client, - Integration, - IntegrationFn, - ReplayRecordingMode, - StreamedSpanJSON, -} from '@sentry/core'; +import type { Client, Integration, IntegrationFn, ReplayRecordingMode, StreamedSpanJSON } from '@sentry/core'; +import type { BrowserClientReplayOptions } from '@sentry/core/browser'; import { consoleSandbox, GLOBAL_OBJ, isBrowser, parseSampleRate, safeSetSpanJSONAttributes } from '@sentry/core'; import { DEFAULT_FLUSH_MAX_DELAY, diff --git a/packages/server-utils/src/integrations/mysql.ts b/packages/server-utils/src/integrations/mysql.ts index fa91abe14eee..3876df576a0a 100644 --- a/packages/server-utils/src/integrations/mysql.ts +++ b/packages/server-utils/src/integrations/mysql.ts @@ -13,8 +13,6 @@ import { import { DB } from '@sentry/conventions/op'; import type { IntegrationFn, Scope } from '@sentry/core'; import { - _INTERNAL_getSqlQuerySummary, - _INTERNAL_sanitizeSqlQuery, isObjectLike, bindScopeToEmitter, defineIntegration, @@ -24,6 +22,7 @@ import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan, } from '@sentry/core'; +import { _INTERNAL_getSqlQuerySummary, _INTERNAL_sanitizeSqlQuery } from '@sentry/core/server'; import { CHANNELS } from '../orchestrion/channels'; import { bindTracingChannelToSpan } from '../tracing-channel'; import { mysqlModuleNames } from '../orchestrion/config/mysql'; diff --git a/packages/server-utils/src/integrations/mysql2/index.ts b/packages/server-utils/src/integrations/mysql2/index.ts index c8c80ed00b7c..e00783fc27bb 100644 --- a/packages/server-utils/src/integrations/mysql2/index.ts +++ b/packages/server-utils/src/integrations/mysql2/index.ts @@ -1,8 +1,6 @@ import * as diagnosticsChannel from 'node:diagnostics_channel'; import type { IntegrationFn, SpanAttributes } from '@sentry/core'; import { - _INTERNAL_getSqlQuerySummary, - _INTERNAL_sanitizeSqlQuery, defineIntegration, getClient, hasSpanStreamingEnabled, @@ -11,6 +9,7 @@ import { startInactiveSpan, waitForTracingChannelBinding, } from '@sentry/core'; +import { _INTERNAL_getSqlQuerySummary, _INTERNAL_sanitizeSqlQuery } from '@sentry/core/server'; import { subscribeMysql2DiagnosticChannels } from './mysql2-dc-subscriber'; import type { ChannelName } from '../../orchestrion/channels'; import { CHANNELS } from '../../orchestrion/channels'; diff --git a/packages/server-utils/src/integrations/mysql2/mysql2-dc-subscriber.ts b/packages/server-utils/src/integrations/mysql2/mysql2-dc-subscriber.ts index d2b90f1f2864..b1a31e31746b 100644 --- a/packages/server-utils/src/integrations/mysql2/mysql2-dc-subscriber.ts +++ b/packages/server-utils/src/integrations/mysql2/mysql2-dc-subscriber.ts @@ -10,15 +10,9 @@ import { SERVER_PORT, } from '@sentry/conventions/attributes'; import { DB } from '@sentry/conventions/op'; -import { - _INTERNAL_getSqlQuerySummary, - _INTERNAL_sanitizeSqlQuery, - getClient, - hasSpanStreamingEnabled, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - startInactiveSpan, -} from '@sentry/core'; +import { getClient, hasSpanStreamingEnabled, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan } from '@sentry/core'; import { bindTracingChannelToSpan } from '../../tracing-channel'; +import { _INTERNAL_getSqlQuerySummary, _INTERNAL_sanitizeSqlQuery } from '@sentry/core/server'; // Channel names published by mysql2 >= 3.20.0 (see mysql2 `lib/tracing.js`). // Hardcoded so the subscriber does not have to import mysql2 — the channels diff --git a/packages/server-utils/src/integrations/postgres-js.ts b/packages/server-utils/src/integrations/postgres-js.ts index eb31bf7e7620..f0eb4ee9da1f 100644 --- a/packages/server-utils/src/integrations/postgres-js.ts +++ b/packages/server-utils/src/integrations/postgres-js.ts @@ -9,14 +9,9 @@ import { SENTRY_OP, } from '@sentry/conventions/attributes'; import { DB } from '@sentry/conventions/op'; -import type { IntegrationFn, PostgresConnectionContext, Span } from '@sentry/core'; +import type { IntegrationFn, Span } from '@sentry/core'; +import type { PostgresConnectionContext } from '@sentry/core/server'; import { - _INTERNAL_buildPostgresConnectionContext, - _INTERNAL_getSqlQuerySummary, - _INTERNAL_reconstructPostgresQuery, - _INTERNAL_sanitizeSqlQuery, - _INTERNAL_getConnectionAttributes, - _INTERNAL_getPostgresOperationName, debug, defineIntegration, getClient, @@ -25,6 +20,14 @@ import { SPAN_STATUS_ERROR, startInactiveSpan, } from '@sentry/core'; +import { + _INTERNAL_buildPostgresConnectionContext, + _INTERNAL_getConnectionAttributes, + _INTERNAL_getPostgresOperationName, + _INTERNAL_getSqlQuerySummary, + _INTERNAL_reconstructPostgresQuery, + _INTERNAL_sanitizeSqlQuery, +} from '@sentry/core/server'; import { DEBUG_BUILD } from '../debug-build'; import { CHANNELS } from '../orchestrion/channels'; import { bindTracingChannelToSpan } from '../tracing-channel'; diff --git a/packages/server-utils/src/integrations/postgres.ts b/packages/server-utils/src/integrations/postgres.ts index 3c890a72dc86..49ee295249a1 100644 --- a/packages/server-utils/src/integrations/postgres.ts +++ b/packages/server-utils/src/integrations/postgres.ts @@ -13,8 +13,6 @@ import { import { DB } from '@sentry/conventions/op'; import type { IntegrationFn, Scope, SpanAttributes } from '@sentry/core'; import { - _INTERNAL_getSqlQuerySummary, - _INTERNAL_sanitizeSqlQuery, isObjectLike, bindScopeToEmitter, defineIntegration, @@ -24,6 +22,7 @@ import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan, } from '@sentry/core'; +import { _INTERNAL_getSqlQuerySummary, _INTERNAL_sanitizeSqlQuery } from '@sentry/core/server'; import { CHANNELS } from '../orchestrion/channels'; import { bindTracingChannelToSpan } from '../tracing-channel'; import { pgModuleNames } from '../orchestrion/config/pg'; diff --git a/packages/solidstart/src/server/withServerActionInstrumentation.ts b/packages/solidstart/src/server/withServerActionInstrumentation.ts index 5f1a2693c4d1..8951d440637d 100644 --- a/packages/solidstart/src/server/withServerActionInstrumentation.ts +++ b/packages/solidstart/src/server/withServerActionInstrumentation.ts @@ -1,9 +1,5 @@ -import { - flushIfServerless, - handleCallbackErrors, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SPAN_STATUS_ERROR, -} from '@sentry/core'; +import { handleCallbackErrors, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR } from '@sentry/core'; +import { flushIfServerless } from '@sentry/core/server'; import { captureException, getActiveSpan, spanToJSON, startSpan } from '@sentry/node'; import { isRedirect } from './utils'; import { diff --git a/packages/solidstart/test/server/withServerActionInstrumentation.test.ts b/packages/solidstart/test/server/withServerActionInstrumentation.test.ts index 3d3b17dbcfe0..32d197d1bba1 100644 --- a/packages/solidstart/test/server/withServerActionInstrumentation.test.ts +++ b/packages/solidstart/test/server/withServerActionInstrumentation.test.ts @@ -1,5 +1,6 @@ import { SENTRY_SEGMENT_NAME_SOURCE } from '@sentry/conventions/attributes'; import * as SentryCore from '@sentry/core'; +import * as SentryCoreServer from '@sentry/core/server'; import * as SentryNode from '@sentry/node'; import { createTransport, @@ -14,7 +15,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { withServerActionInstrumentation } from '../../src/server'; const mockCaptureException = vi.spyOn(SentryNode, 'captureException').mockImplementation(() => ''); -const mockFlush = vi.spyOn(SentryCore, 'flushIfServerless').mockImplementation(async () => {}); +const mockFlush = vi.spyOn(SentryCoreServer, 'flushIfServerless').mockImplementation(async () => {}); const mockGetActiveSpan = vi.spyOn(SentryCore, 'getActiveSpan'); const mockGetRequestEvent = vi.fn(); diff --git a/packages/sveltekit/src/server-common/handle.ts b/packages/sveltekit/src/server-common/handle.ts index 484ac69d5040..a7f5645c2747 100644 --- a/packages/sveltekit/src/server-common/handle.ts +++ b/packages/sveltekit/src/server-common/handle.ts @@ -2,7 +2,6 @@ import type { Span } from '@sentry/core'; import { continueTrace, debug, - flushIfServerless, getClient, getCurrentScope, getDefaultIsolationScope, @@ -21,6 +20,7 @@ import { withIsolationScope, filterCollectedUrl, } from '@sentry/core'; +import { flushIfServerless } from '@sentry/core/server'; import type { Handle, ResolveOptions } from '@sveltejs/kit'; import { DEBUG_BUILD } from '../common/debug-build'; import { getTracePropagationData, sendErrorToSentry } from './utils'; diff --git a/packages/sveltekit/src/server-common/handleError.ts b/packages/sveltekit/src/server-common/handleError.ts index c1a9be07f3bc..ddf18dd80396 100644 --- a/packages/sveltekit/src/server-common/handleError.ts +++ b/packages/sveltekit/src/server-common/handleError.ts @@ -1,4 +1,5 @@ -import { captureException, consoleSandbox, flushIfServerless } from '@sentry/core'; +import { captureException, consoleSandbox } from '@sentry/core'; +import { flushIfServerless } from '@sentry/core/server'; import type { AnyErrorHandler, SentryHandleServerErrorInput } from '../common/handleErrorTypes'; import { shouldCaptureError } from '../common/handleErrorTypes'; import { getCloudflareExecutionContext } from './utils'; diff --git a/packages/sveltekit/src/server-common/load.ts b/packages/sveltekit/src/server-common/load.ts index 93af6ba989dc..64106c47d157 100644 --- a/packages/sveltekit/src/server-common/load.ts +++ b/packages/sveltekit/src/server-common/load.ts @@ -1,4 +1,5 @@ -import { addNonEnumerableProperty, flushIfServerless, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan } from '@sentry/core'; +import { addNonEnumerableProperty, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan } from '@sentry/core'; +import { flushIfServerless } from '@sentry/core/server'; import { SENTRY_SEGMENT_NAME_SOURCE, CODE_FUNCTION_NAME, diff --git a/packages/sveltekit/src/server-common/serverRoute.ts b/packages/sveltekit/src/server-common/serverRoute.ts index d0340f8297c3..268556d0b96b 100644 --- a/packages/sveltekit/src/server-common/serverRoute.ts +++ b/packages/sveltekit/src/server-common/serverRoute.ts @@ -1,4 +1,5 @@ -import { addNonEnumerableProperty, flushIfServerless, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan } from '@sentry/core'; +import { addNonEnumerableProperty, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan } from '@sentry/core'; +import { flushIfServerless } from '@sentry/core/server'; import { CODE_FUNCTION_NAME, HTTP_REQUEST_METHOD, SENTRY_OP } from '@sentry/conventions/attributes'; import { FUNCTION } from '@sentry/conventions/op'; import type { RequestEvent } from '@sveltejs/kit'; diff --git a/packages/tanstackstart-react/src/server/wrapFetchWithSentry.ts b/packages/tanstackstart-react/src/server/wrapFetchWithSentry.ts index beddd0c20d48..935c03fb76e0 100644 --- a/packages/tanstackstart-react/src/server/wrapFetchWithSentry.ts +++ b/packages/tanstackstart-react/src/server/wrapFetchWithSentry.ts @@ -1,4 +1,5 @@ -import { flushIfServerless, getTraceMetaTags } from '@sentry/core'; +import { getTraceMetaTags } from '@sentry/core'; +import { flushIfServerless } from '@sentry/core/server'; import { captureException, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan } from '@sentry/node'; import { SENTRY_OP } from '@sentry/conventions/attributes'; import { FUNCTION } from '@sentry/conventions/op'; diff --git a/packages/tanstackstart-react/test/server/wrapFetchWithSentry.test.ts b/packages/tanstackstart-react/test/server/wrapFetchWithSentry.test.ts index 5928cefeb9b7..cb1a809cafb2 100644 --- a/packages/tanstackstart-react/test/server/wrapFetchWithSentry.test.ts +++ b/packages/tanstackstart-react/test/server/wrapFetchWithSentry.test.ts @@ -24,11 +24,18 @@ vi.mock('@sentry/core', async importOriginal => { const original = await importOriginal(); return { ...original, - flushIfServerless: (...args: unknown[]) => flushIfServerlessSpy(...args), getTraceMetaTags: () => getTraceMetaTagsSpy(), }; }); +vi.mock('@sentry/core/server', async importOriginal => { + const original = await importOriginal(); + return { + ...original, + flushIfServerless: (...args: unknown[]) => flushIfServerlessSpy(...args), + }; +}); + // Import after mocks are set up const { wrapFetchWithSentry } = await import('../../src/server/wrapFetchWithSentry'); diff --git a/packages/vercel-edge/src/client.ts b/packages/vercel-edge/src/client.ts index ad588b35682f..f5ca5aa1948b 100644 --- a/packages/vercel-edge/src/client.ts +++ b/packages/vercel-edge/src/client.ts @@ -1,5 +1,6 @@ -import type { ServerRuntimeClientOptions } from '@sentry/core'; -import { applySdkMetadata, ServerRuntimeClient } from '@sentry/core'; +import type { ServerRuntimeClientOptions } from '@sentry/core/server'; +import { applySdkMetadata } from '@sentry/core'; +import { ServerRuntimeClient } from '@sentry/core/server'; import type { VercelEdgeClientOptions } from './types'; import { registerPrepareSpanScope, type SentryTracerProvider } from '@sentry/opentelemetry'; diff --git a/packages/vercel-edge/src/index.ts b/packages/vercel-edge/src/index.ts index 61e7baec6acc..4a38cd639cc4 100644 --- a/packages/vercel-edge/src/index.ts +++ b/packages/vercel-edge/src/index.ts @@ -87,12 +87,10 @@ export { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SENTRY_SEGMENT_NAME_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, - trpcMiddleware, spanToStaticSpanJSON, spanToJSON, spanToTraceHeader, spanToBaggageHeader, - wrapMcpServerWithSentry, consoleLoggingIntegration, createConsolaReporter, featureFlagsIntegration, @@ -103,6 +101,7 @@ export { withStreamedSpan, spanStreamingIntegration, } from '@sentry/core'; +export { trpcMiddleware, wrapMcpServerWithSentry } from '@sentry/core/server'; export { otlpIntegration, getOtlpTracesEndpoint, diff --git a/packages/vercel-edge/src/sdk.ts b/packages/vercel-edge/src/sdk.ts index 09f87e992579..5e6c2926ccbb 100644 --- a/packages/vercel-edge/src/sdk.ts +++ b/packages/vercel-edge/src/sdk.ts @@ -12,10 +12,10 @@ import { getIntegrationsToSetup, GLOBAL_OBJ, linkedErrorsIntegration, - nodeStackLineParser, requestDataIntegration, stackParserFromStackParserOptions, } from '@sentry/core'; +import { nodeStackLineParser } from '@sentry/core/server'; import { SentryPropagator, SentryTracerProvider, diff --git a/packages/vue/src/sdk.ts b/packages/vue/src/sdk.ts index 6fd44baf5266..b6ce9ff99b89 100644 --- a/packages/vue/src/sdk.ts +++ b/packages/vue/src/sdk.ts @@ -1,6 +1,6 @@ import { getDefaultIntegrations, init as browserInit } from '@sentry/browser'; import type { Client } from '@sentry/core'; -import { applySdkMetadata, setNormalizeStringifier } from '@sentry/core/browser'; +import { applySdkMetadata, setNormalizeStringifier } from '@sentry/core'; import { vueIntegration } from './integration'; import type { Options } from './types';