diff --git a/packages/angular/src/sdk.ts b/packages/angular/src/sdk.ts index 072045e635ad..f5bf79be2f59 100755 --- a/packages/angular/src/sdk.ts +++ b/packages/angular/src/sdk.ts @@ -4,17 +4,18 @@ import { breadcrumbsIntegration, globalHandlersIntegration, httpContextIntegration, + init as browserInit, linkedErrorsIntegration, + setContext, } from '@sentry/browser'; -import { init as browserInit, setContext } from '@sentry/browser'; +import type { Client, Integration } from '@sentry/core'; import { applySdkMetadata, dedupeIntegration, functionToStringIntegration, inboundFiltersIntegration, + logger, } from '@sentry/core'; -import { logger } from '@sentry/core'; -import type { Client, Integration } from '@sentry/core'; import { IS_DEBUG_BUILD } from './flags'; diff --git a/packages/aws-serverless/src/sdk.ts b/packages/aws-serverless/src/sdk.ts index ccb776a9e199..c9bd6ae6834d 100644 --- a/packages/aws-serverless/src/sdk.ts +++ b/packages/aws-serverless/src/sdk.ts @@ -2,8 +2,8 @@ import { existsSync } from 'fs'; import { hostname } from 'os'; import { basename, resolve } from 'path'; import { types } from 'util'; -import { logger } from '@sentry/core'; import type { Integration, Options, Scope, SdkMetadata, Span } from '@sentry/core'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, logger } from '@sentry/core'; import type { NodeClient, NodeOptions } from '@sentry/node'; import { SDK_VERSION, @@ -19,9 +19,6 @@ import { } from '@sentry/node'; import type { Context, Handler } from 'aws-lambda'; import { performance } from 'perf_hooks'; - -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core'; - import { DEBUG_BUILD } from './debug-build'; import { awsIntegration } from './integration/aws'; import { awsLambdaIntegration } from './integration/awslambda'; diff --git a/packages/browser-utils/src/instrument/dom.ts b/packages/browser-utils/src/instrument/dom.ts index d94a84360e52..633c29b45376 100644 --- a/packages/browser-utils/src/instrument/dom.ts +++ b/packages/browser-utils/src/instrument/dom.ts @@ -1,5 +1,4 @@ import type { HandlerDataDom } from '@sentry/core'; - import { addHandler, addNonEnumerableProperty, fill, maybeInstrument, triggerHandlers, uuid4 } from '@sentry/core'; import { WINDOW } from '../types'; diff --git a/packages/browser-utils/src/instrument/xhr.ts b/packages/browser-utils/src/instrument/xhr.ts index df67d1c1f1be..506cc59a7bbf 100644 --- a/packages/browser-utils/src/instrument/xhr.ts +++ b/packages/browser-utils/src/instrument/xhr.ts @@ -1,5 +1,4 @@ import type { HandlerDataXhr, SentryWrappedXMLHttpRequest } from '@sentry/core'; - import { addHandler, isString, maybeInstrument, timestampInSeconds, triggerHandlers } from '@sentry/core'; import { WINDOW } from '../types'; diff --git a/packages/browser-utils/src/metrics/browserMetrics.ts b/packages/browser-utils/src/metrics/browserMetrics.ts index 525ad701bd7d..cac52aba468d 100644 --- a/packages/browser-utils/src/metrics/browserMetrics.ts +++ b/packages/browser-utils/src/metrics/browserMetrics.ts @@ -1,10 +1,15 @@ /* eslint-disable max-lines */ -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, getActiveSpan } from '@sentry/core'; -import { setMeasurement } from '@sentry/core'; -import { browserPerformanceTimeOrigin, getComponentName, htmlTreeAsString, parseUrl } from '@sentry/core'; import type { Measurements, Span, SpanAttributes, StartSpanOptions } from '@sentry/core'; - -import { spanToJSON } from '@sentry/core'; +import { + SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, + browserPerformanceTimeOrigin, + getActiveSpan, + getComponentName, + htmlTreeAsString, + parseUrl, + setMeasurement, + spanToJSON, +} from '@sentry/core'; import { WINDOW } from '../types'; import { trackClsAsStandaloneSpan } from './cls'; import { @@ -228,7 +233,7 @@ export function startTrackingInteractions(): void { }); } -export { startTrackingINP, registerInpInteractionListener } from './inp'; +export { registerInpInteractionListener, startTrackingINP } from './inp'; /** * Starts tracking the Cumulative Layout Shift on the current page and collects the value and last entry diff --git a/packages/browser-utils/src/metrics/inp.ts b/packages/browser-utils/src/metrics/inp.ts index c8b517515eff..7ef99b4d32fd 100644 --- a/packages/browser-utils/src/metrics/inp.ts +++ b/packages/browser-utils/src/metrics/inp.ts @@ -1,16 +1,18 @@ +import type { Span, SpanAttributes } from '@sentry/core'; import { SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME, SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT, SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, + browserPerformanceTimeOrigin, + dropUndefinedKeys, getActiveSpan, getCurrentScope, getRootSpan, + htmlTreeAsString, spanToJSON, } from '@sentry/core'; -import { browserPerformanceTimeOrigin, dropUndefinedKeys, htmlTreeAsString } from '@sentry/core'; -import type { Span, SpanAttributes } from '@sentry/core'; import { addInpInstrumentationHandler, addPerformanceInstrumentationHandler, diff --git a/packages/browser-utils/src/metrics/utils.ts b/packages/browser-utils/src/metrics/utils.ts index 613c31f6b7b9..b6bc9fc54f2f 100644 --- a/packages/browser-utils/src/metrics/utils.ts +++ b/packages/browser-utils/src/metrics/utils.ts @@ -1,6 +1,5 @@ -import type { SentrySpan } from '@sentry/core'; +import type { Integration, SentrySpan, Span, SpanAttributes, SpanTimeInput, StartSpanOptions } from '@sentry/core'; import { getClient, getCurrentScope, spanToJSON, startInactiveSpan, withActiveSpan } from '@sentry/core'; -import type { Integration, Span, SpanAttributes, SpanTimeInput, StartSpanOptions } from '@sentry/core'; import { WINDOW } from '../types'; /** diff --git a/packages/browser/src/client.ts b/packages/browser/src/client.ts index 8d0056dbfb77..2ce5c7dfece6 100644 --- a/packages/browser/src/client.ts +++ b/packages/browser/src/client.ts @@ -1,7 +1,3 @@ -import type { Scope } from '@sentry/core'; -import { applySdkMetadata } from '@sentry/core'; -import { BaseClient } from '@sentry/core'; -import { getSDKSource, logger } from '@sentry/core'; import type { BrowserClientProfilingOptions, BrowserClientReplayOptions, @@ -10,10 +6,11 @@ import type { EventHint, Options, ParameterizedString, + Scope, SeverityLevel, UserFeedback, } from '@sentry/core'; - +import { BaseClient, applySdkMetadata, getSDKSource, logger } from '@sentry/core'; import { DEBUG_BUILD } from './debug-build'; import { eventFromException, eventFromMessage } from './eventbuilder'; import { WINDOW } from './helpers'; diff --git a/packages/browser/src/eventbuilder.ts b/packages/browser/src/eventbuilder.ts index ec3c9b95ef7d..7f7539f5cf5f 100644 --- a/packages/browser/src/eventbuilder.ts +++ b/packages/browser/src/eventbuilder.ts @@ -1,8 +1,17 @@ -import { getClient } from '@sentry/core'; +import type { + Event, + EventHint, + Exception, + ParameterizedString, + SeverityLevel, + StackFrame, + StackParser, +} from '@sentry/core'; import { addExceptionMechanism, addExceptionTypeValue, extractExceptionKeysForMessage, + getClient, isDOMError, isDOMException, isError, @@ -13,15 +22,6 @@ import { normalizeToSize, resolvedSyncPromise, } from '@sentry/core'; -import type { - Event, - EventHint, - Exception, - ParameterizedString, - SeverityLevel, - StackFrame, - StackParser, -} from '@sentry/core'; type Prototype = { constructor: (...args: unknown[]) => unknown }; diff --git a/packages/browser/src/helpers.ts b/packages/browser/src/helpers.ts index 50ce163062b8..cd0a734102e7 100644 --- a/packages/browser/src/helpers.ts +++ b/packages/browser/src/helpers.ts @@ -1,13 +1,14 @@ -import { captureException, withScope } from '@sentry/core'; +import type { Mechanism, WrappedFunction } from '@sentry/core'; import { GLOBAL_OBJ, addExceptionMechanism, addExceptionTypeValue, addNonEnumerableProperty, + captureException, getOriginalFunction, markFunctionWrapped, + withScope, } from '@sentry/core'; -import type { Mechanism, WrappedFunction } from '@sentry/core'; export const WINDOW = GLOBAL_OBJ as typeof GLOBAL_OBJ & Window; diff --git a/packages/browser/src/integrations/breadcrumbs.ts b/packages/browser/src/integrations/breadcrumbs.ts index ed2ceb8f462d..5e31f5abe2a3 100644 --- a/packages/browser/src/integrations/breadcrumbs.ts +++ b/packages/browser/src/integrations/breadcrumbs.ts @@ -1,22 +1,11 @@ +/* eslint-disable max-lines */ + import { SENTRY_XHR_DATA_KEY, addClickKeypressInstrumentationHandler, addHistoryInstrumentationHandler, addXhrInstrumentationHandler, } from '@sentry-internal/browser-utils'; -import { addBreadcrumb, defineIntegration, getClient } from '@sentry/core'; -import { - addConsoleInstrumentationHandler, - addFetchInstrumentationHandler, - getBreadcrumbLogLevelFromHttpStatusCode, - getComponentName, - getEventDescription, - htmlTreeAsString, - logger, - parseUrl, - safeJoin, - severityLevelFromString, -} from '@sentry/core'; import type { Breadcrumb, Client, @@ -32,7 +21,21 @@ import type { XhrBreadcrumbData, XhrBreadcrumbHint, } from '@sentry/core'; - +import { + addBreadcrumb, + addConsoleInstrumentationHandler, + addFetchInstrumentationHandler, + defineIntegration, + getBreadcrumbLogLevelFromHttpStatusCode, + getClient, + getComponentName, + getEventDescription, + htmlTreeAsString, + logger, + parseUrl, + safeJoin, + severityLevelFromString, +} from '@sentry/core'; import { DEBUG_BUILD } from '../debug-build'; import { WINDOW } from '../helpers'; diff --git a/packages/browser/src/integrations/browserapierrors.ts b/packages/browser/src/integrations/browserapierrors.ts index 0228a24ce0ed..e1328a90831e 100644 --- a/packages/browser/src/integrations/browserapierrors.ts +++ b/packages/browser/src/integrations/browserapierrors.ts @@ -1,6 +1,5 @@ -import { defineIntegration } from '@sentry/core'; -import { fill, getFunctionName, getOriginalFunction } from '@sentry/core'; import type { IntegrationFn, WrappedFunction } from '@sentry/core'; +import { defineIntegration, fill, getFunctionName, getOriginalFunction } from '@sentry/core'; import { WINDOW, wrap } from '../helpers'; diff --git a/packages/browser/src/integrations/contextlines.ts b/packages/browser/src/integrations/contextlines.ts index 8da7cfa024a1..66500e238614 100644 --- a/packages/browser/src/integrations/contextlines.ts +++ b/packages/browser/src/integrations/contextlines.ts @@ -1,6 +1,5 @@ -import { defineIntegration } from '@sentry/core'; -import { GLOBAL_OBJ, addContextToFrame, stripUrlQueryAndFragment } from '@sentry/core'; import type { Event, IntegrationFn, StackFrame } from '@sentry/core'; +import { GLOBAL_OBJ, addContextToFrame, defineIntegration, stripUrlQueryAndFragment } from '@sentry/core'; const WINDOW = GLOBAL_OBJ as typeof GLOBAL_OBJ & Window; diff --git a/packages/browser/src/integrations/globalhandlers.ts b/packages/browser/src/integrations/globalhandlers.ts index 13d89dd4eb69..1f0d0a4b35c1 100644 --- a/packages/browser/src/integrations/globalhandlers.ts +++ b/packages/browser/src/integrations/globalhandlers.ts @@ -1,14 +1,16 @@ -import { captureEvent, defineIntegration, getClient } from '@sentry/core'; +import type { Client, Event, IntegrationFn, Primitive, StackParser } from '@sentry/core'; import { UNKNOWN_FUNCTION, addGlobalErrorInstrumentationHandler, addGlobalUnhandledRejectionInstrumentationHandler, + captureEvent, + defineIntegration, + getClient, getLocationHref, isPrimitive, isString, logger, } from '@sentry/core'; -import type { Client, Event, IntegrationFn, Primitive, StackParser } from '@sentry/core'; import type { BrowserClient } from '../client'; import { DEBUG_BUILD } from '../debug-build'; diff --git a/packages/browser/src/integrations/httpclient.ts b/packages/browser/src/integrations/httpclient.ts index cf1dc6ab6896..eec0141bb97e 100644 --- a/packages/browser/src/integrations/httpclient.ts +++ b/packages/browser/src/integrations/httpclient.ts @@ -1,13 +1,16 @@ import { SENTRY_XHR_DATA_KEY, addXhrInstrumentationHandler } from '@sentry-internal/browser-utils'; -import { captureEvent, defineIntegration, getClient, isSentryRequestUrl } from '@sentry/core'; +import type { Client, Event as SentryEvent, IntegrationFn, SentryWrappedXMLHttpRequest } from '@sentry/core'; import { GLOBAL_OBJ, addExceptionMechanism, addFetchInstrumentationHandler, + captureEvent, + defineIntegration, + getClient, + isSentryRequestUrl, logger, supportsNativeFetch, } from '@sentry/core'; -import type { Client, Event as SentryEvent, IntegrationFn, SentryWrappedXMLHttpRequest } from '@sentry/core'; import { DEBUG_BUILD } from '../debug-build'; diff --git a/packages/browser/src/integrations/linkederrors.ts b/packages/browser/src/integrations/linkederrors.ts index efc56dfcb7bc..4b99ac876386 100644 --- a/packages/browser/src/integrations/linkederrors.ts +++ b/packages/browser/src/integrations/linkederrors.ts @@ -1,6 +1,5 @@ -import { defineIntegration } from '@sentry/core'; -import { applyAggregateErrorsToEvent } from '@sentry/core'; 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 022c12cf7abb..81db7d0932d1 100644 --- a/packages/browser/src/integrations/reportingobserver.ts +++ b/packages/browser/src/integrations/reportingobserver.ts @@ -1,6 +1,12 @@ -import { captureMessage, defineIntegration, getClient, withScope } from '@sentry/core'; -import { GLOBAL_OBJ, supportsReportingObserver } from '@sentry/core'; import type { Client, IntegrationFn } from '@sentry/core'; +import { + GLOBAL_OBJ, + captureMessage, + defineIntegration, + getClient, + supportsReportingObserver, + 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 eb8f64a5d0dc..7d3cc61d5015 100644 --- a/packages/browser/src/integrations/spotlight.ts +++ b/packages/browser/src/integrations/spotlight.ts @@ -1,10 +1,8 @@ import { getNativeImplementation } from '@sentry-internal/browser-utils'; -import { defineIntegration } from '@sentry/core'; -import { logger, serializeEnvelope } from '@sentry/core'; import type { Client, Envelope, Event, IntegrationFn } from '@sentry/core'; -import type { WINDOW } from '../helpers'; - +import { defineIntegration, logger, serializeEnvelope } from '@sentry/core'; import { DEBUG_BUILD } from '../debug-build'; +import type { WINDOW } from '../helpers'; export type SpotlightConnectionOptions = { /** diff --git a/packages/browser/src/profiling/utils.ts b/packages/browser/src/profiling/utils.ts index e088ed281152..21cbadb58176 100644 --- a/packages/browser/src/profiling/utils.ts +++ b/packages/browser/src/profiling/utils.ts @@ -1,16 +1,16 @@ /* eslint-disable max-lines */ - -import { DEFAULT_ENVIRONMENT, getClient, spanToJSON } from '@sentry/core'; +import type { DebugImage, Envelope, Event, EventEnvelope, Profile, Span, ThreadCpuProfile } from '@sentry/core'; import { + DEFAULT_ENVIRONMENT, browserPerformanceTimeOrigin, forEachEnvelopeItem, + getClient, getDebugImagesForResources, logger, + spanToJSON, timestampInSeconds, uuid4, } from '@sentry/core'; -import type { DebugImage, Envelope, Event, EventEnvelope, Profile, Span, ThreadCpuProfile } from '@sentry/core'; - import { DEBUG_BUILD } from '../debug-build'; import { WINDOW } from '../helpers'; import type { JSSelfProfile, JSSelfProfileStack, JSSelfProfiler, JSSelfProfilerConstructor } from './jsSelfProfiling'; diff --git a/packages/browser/src/sdk.ts b/packages/browser/src/sdk.ts index adf1d4da8d1a..70d21bfd3501 100644 --- a/packages/browser/src/sdk.ts +++ b/packages/browser/src/sdk.ts @@ -1,19 +1,22 @@ -import { getCurrentScope } from '@sentry/core'; -import { functionToStringIntegration, inboundFiltersIntegration } from '@sentry/core'; +import { addHistoryInstrumentationHandler } from '@sentry-internal/browser-utils'; import { captureSession, + consoleSandbox, + dedupeIntegration, + functionToStringIntegration, getClient, + getCurrentScope, getIntegrationsToSetup, getReportDialogEndpoint, + inboundFiltersIntegration, initAndBind, lastEventId, + logger, + stackParserFromStackParserOptions, startSession, + supportsFetch, } from '@sentry/core'; -import { consoleSandbox, logger, stackParserFromStackParserOptions, supportsFetch } from '@sentry/core'; import type { Client, DsnLike, Integration, Options, UserFeedback } from '@sentry/core'; - -import { addHistoryInstrumentationHandler } from '@sentry-internal/browser-utils'; -import { dedupeIntegration } from '@sentry/core'; import type { BrowserClientOptions, BrowserOptions } from './client'; import { BrowserClient } from './client'; import { DEBUG_BUILD } from './debug-build'; diff --git a/packages/browser/src/tracing/backgroundtab.ts b/packages/browser/src/tracing/backgroundtab.ts index 178a95ccb5a2..3a591bde2b8e 100644 --- a/packages/browser/src/tracing/backgroundtab.ts +++ b/packages/browser/src/tracing/backgroundtab.ts @@ -1,7 +1,4 @@ -import { SPAN_STATUS_ERROR, getActiveSpan, getRootSpan } from '@sentry/core'; -import { spanToJSON } from '@sentry/core'; -import { logger } from '@sentry/core'; - +import { SPAN_STATUS_ERROR, getActiveSpan, getRootSpan, logger, spanToJSON } from '@sentry/core'; import { DEBUG_BUILD } from '../debug-build'; import { WINDOW } from '../helpers'; diff --git a/packages/browser/src/tracing/browserTracingIntegration.ts b/packages/browser/src/tracing/browserTracingIntegration.ts index f13f44b22ffd..17030f2f4a43 100644 --- a/packages/browser/src/tracing/browserTracingIntegration.ts +++ b/packages/browser/src/tracing/browserTracingIntegration.ts @@ -9,33 +9,29 @@ import { startTrackingLongTasks, startTrackingWebVitals, } from '@sentry-internal/browser-utils'; +import type { Client, IntegrationFn, Span, StartSpanOptions, TransactionSource } from '@sentry/core'; import { + GLOBAL_OBJ, SEMANTIC_ATTRIBUTE_SENTRY_IDLE_SPAN_FINISH_REASON, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, TRACING_DEFAULTS, + browserPerformanceTimeOrigin, generateTraceId, getActiveSpan, getClient, getCurrentScope, + getDomElement, getDynamicSamplingContextFromSpan, getIsolationScope, getRootSpan, + logger, + propagationContextFromHeaders, registerSpanErrorInstrumentation, spanIsSampled, spanToJSON, startIdleSpan, } from '@sentry/core'; -import { - GLOBAL_OBJ, - browserPerformanceTimeOrigin, - getDomElement, - logger, - propagationContextFromHeaders, -} from '@sentry/core'; -import type { Client, IntegrationFn, StartSpanOptions, TransactionSource } from '@sentry/core'; -import type { Span } from '@sentry/core'; - import { DEBUG_BUILD } from '../debug-build'; import { WINDOW } from '../helpers'; import { registerBackgroundTabDetection } from './backgroundtab'; diff --git a/packages/browser/src/tracing/request.ts b/packages/browser/src/tracing/request.ts index ca47c7e28c34..5f32b227fa85 100644 --- a/packages/browser/src/tracing/request.ts +++ b/packages/browser/src/tracing/request.ts @@ -1,29 +1,26 @@ -/* eslint-disable max-lines */ import { SENTRY_XHR_DATA_KEY, addPerformanceInstrumentationHandler, addXhrInstrumentationHandler, } from '@sentry-internal/browser-utils'; +import type { Client, HandlerDataXhr, SentryWrappedXMLHttpRequest, Span } from '@sentry/core'; import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SentryNonRecordingSpan, + addFetchEndInstrumentationHandler, + addFetchInstrumentationHandler, + browserPerformanceTimeOrigin, getActiveSpan, getTraceData, hasTracingEnabled, instrumentFetchRequest, + parseUrl, setHttpStatus, spanToJSON, startInactiveSpan, -} from '@sentry/core'; -import { - addFetchEndInstrumentationHandler, - addFetchInstrumentationHandler, - browserPerformanceTimeOrigin, - parseUrl, stringMatchesSomePattern, } from '@sentry/core'; -import type { Client, HandlerDataXhr, SentryWrappedXMLHttpRequest, Span } from '@sentry/core'; import { WINDOW } from '../helpers'; /** Options for Request Instrumentation */ diff --git a/packages/browser/src/transports/fetch.ts b/packages/browser/src/transports/fetch.ts index e3af7976c18b..5712c78f0c18 100644 --- a/packages/browser/src/transports/fetch.ts +++ b/packages/browser/src/transports/fetch.ts @@ -1,9 +1,7 @@ import { clearCachedImplementation, getNativeImplementation } from '@sentry-internal/browser-utils'; -import { createTransport } from '@sentry/core'; -import { rejectedSyncPromise } from '@sentry/core'; import type { Transport, TransportMakeRequestResponse, TransportRequest } from '@sentry/core'; +import { createTransport, rejectedSyncPromise } from '@sentry/core'; 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 530d77046239..372c360194c7 100644 --- a/packages/browser/src/transports/offline.ts +++ b/packages/browser/src/transports/offline.ts @@ -1,7 +1,5 @@ -import type { OfflineStore, OfflineTransportOptions } from '@sentry/core'; -import { makeOfflineTransport } from '@sentry/core'; -import { parseEnvelope, serializeEnvelope } from '@sentry/core'; -import type { BaseTransportOptions, Envelope, Transport } from '@sentry/core'; +import type { BaseTransportOptions, Envelope, OfflineStore, OfflineTransportOptions, Transport } from '@sentry/core'; +import { makeOfflineTransport, parseEnvelope, serializeEnvelope } from '@sentry/core'; import { makeFetchTransport } from './fetch'; // 'Store', 'promisifyRequest' and 'createStore' were originally copied from the 'idb-keyval' package before being diff --git a/packages/bun/src/integrations/bunserver.ts b/packages/bun/src/integrations/bunserver.ts index cb24df548dce..862d5bd87212 100644 --- a/packages/bun/src/integrations/bunserver.ts +++ b/packages/bun/src/integrations/bunserver.ts @@ -1,3 +1,4 @@ +import type { IntegrationFn, RequestEventData, SpanAttributes } from '@sentry/core'; import { SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, @@ -5,12 +6,13 @@ import { captureException, continueTrace, defineIntegration, + extractQueryParamsFromUrl, + getSanitizedUrlString, + parseUrl, setHttpStatus, startSpan, withIsolationScope, } from '@sentry/core'; -import { extractQueryParamsFromUrl, getSanitizedUrlString, parseUrl } from '@sentry/core'; -import type { IntegrationFn, RequestEventData, SpanAttributes } from '@sentry/core'; const INTEGRATION_NAME = 'BunServer'; diff --git a/packages/bun/src/transports/index.ts b/packages/bun/src/transports/index.ts index 32ed837db668..efe10ab22646 100644 --- a/packages/bun/src/transports/index.ts +++ b/packages/bun/src/transports/index.ts @@ -1,6 +1,5 @@ -import { createTransport, suppressTracing } from '@sentry/core'; -import { rejectedSyncPromise } from '@sentry/core'; import type { BaseTransportOptions, Transport, TransportMakeRequestResponse, TransportRequest } from '@sentry/core'; +import { createTransport, rejectedSyncPromise, suppressTracing } from '@sentry/core'; export interface BunTransportOptions extends BaseTransportOptions { /** Custom headers for the transport. Used by the XHRTransport and FetchTransport */ diff --git a/packages/cloudflare/src/client.ts b/packages/cloudflare/src/client.ts index 3ef090953a62..dd8a0cccdec8 100644 --- a/packages/cloudflare/src/client.ts +++ b/packages/cloudflare/src/client.ts @@ -1,7 +1,5 @@ -import type { ServerRuntimeClientOptions } from '@sentry/core'; +import type { ClientOptions, Options, ServerRuntimeClientOptions } from '@sentry/core'; import { ServerRuntimeClient, applySdkMetadata } from '@sentry/core'; -import type { ClientOptions, Options } from '@sentry/core'; - import type { CloudflareTransportOptions } from './transport'; /** diff --git a/packages/cloudflare/src/integrations/fetch.ts b/packages/cloudflare/src/integrations/fetch.ts index 87e194846281..651d41f826a1 100644 --- a/packages/cloudflare/src/integrations/fetch.ts +++ b/packages/cloudflare/src/integrations/fetch.ts @@ -1,10 +1,3 @@ -import { addBreadcrumb, defineIntegration, getClient, instrumentFetchRequest, isSentryRequestUrl } from '@sentry/core'; -import { - LRUMap, - addFetchInstrumentationHandler, - getBreadcrumbLogLevelFromHttpStatusCode, - stringMatchesSomePattern, -} from '@sentry/core'; import type { Client, FetchBreadcrumbData, @@ -13,6 +6,17 @@ import type { IntegrationFn, Span, } from '@sentry/core'; +import { + LRUMap, + addBreadcrumb, + addFetchInstrumentationHandler, + defineIntegration, + getBreadcrumbLogLevelFromHttpStatusCode, + getClient, + instrumentFetchRequest, + isSentryRequestUrl, + stringMatchesSomePattern, +} from '@sentry/core'; const INTEGRATION_NAME = 'Fetch'; diff --git a/packages/cloudflare/src/request.ts b/packages/cloudflare/src/request.ts index b315651e620a..979b426ef5dc 100644 --- a/packages/cloudflare/src/request.ts +++ b/packages/cloudflare/src/request.ts @@ -1,5 +1,5 @@ import type { ExecutionContext, IncomingRequestCfProperties } from '@cloudflare/workers-types'; - +import type { SpanAttributes } from '@sentry/core'; import { SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD, SEMANTIC_ATTRIBUTE_SENTRY_OP, @@ -11,10 +11,9 @@ import { flush, setHttpStatus, startSpan, + stripUrlQueryAndFragment, withIsolationScope, } from '@sentry/core'; -import { stripUrlQueryAndFragment } from '@sentry/core'; -import type { SpanAttributes } from '@sentry/core'; import type { CloudflareOptions } from './client'; import { addCloudResourceContext, addCultureContext, addRequest } from './scope-utils'; import { init } from './sdk'; diff --git a/packages/cloudflare/src/sdk.ts b/packages/cloudflare/src/sdk.ts index 98d741473cb8..89f3fe99d050 100644 --- a/packages/cloudflare/src/sdk.ts +++ b/packages/cloudflare/src/sdk.ts @@ -1,3 +1,4 @@ +import type { Integration } from '@sentry/core'; import { dedupeIntegration, functionToStringIntegration, @@ -6,12 +7,10 @@ import { initAndBind, linkedErrorsIntegration, requestDataIntegration, + stackParserFromStackParserOptions, } from '@sentry/core'; -import { stackParserFromStackParserOptions } from '@sentry/core'; -import type { Integration } from '@sentry/core'; import type { CloudflareClientOptions, CloudflareOptions } from './client'; import { CloudflareClient } from './client'; - import { fetchIntegration } from './integrations/fetch'; import { makeCloudflareTransport } from './transport'; import { defaultStackParser } from './vendor/stacktrace'; diff --git a/packages/cloudflare/src/transport.ts b/packages/cloudflare/src/transport.ts index a525cb0192b9..40b8549df9cd 100644 --- a/packages/cloudflare/src/transport.ts +++ b/packages/cloudflare/src/transport.ts @@ -1,6 +1,5 @@ -import { createTransport, suppressTracing } from '@sentry/core'; -import { SentryError } from '@sentry/core'; import type { BaseTransportOptions, Transport, TransportMakeRequestResponse, TransportRequest } from '@sentry/core'; +import { SentryError, createTransport, suppressTracing } from '@sentry/core'; export interface CloudflareTransportOptions extends BaseTransportOptions { /** Fetch API init parameters. */ diff --git a/packages/core/src/asyncContext/stackStrategy.ts b/packages/core/src/asyncContext/stackStrategy.ts index 8879461c8fc3..0e1a84961f5a 100644 --- a/packages/core/src/asyncContext/stackStrategy.ts +++ b/packages/core/src/asyncContext/stackStrategy.ts @@ -1,8 +1,8 @@ import { getDefaultCurrentScope, getDefaultIsolationScope } from '../defaultScopes'; import { Scope } from '../scope'; import type { Client, Scope as ScopeInterface } from '../types-hoist'; +import { isThenable } from '../utils-hoist/is'; -import { isThenable } from '../utils-hoist'; import { getMainCarrier, getSentryCarrier } from './../carrier'; import type { AsyncContextStrategy } from './types'; diff --git a/packages/core/src/tracing/measurement.ts b/packages/core/src/tracing/measurement.ts index 80b6be8a26bc..1eed69b64333 100644 --- a/packages/core/src/tracing/measurement.ts +++ b/packages/core/src/tracing/measurement.ts @@ -4,7 +4,7 @@ import { SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE, } from '../semanticAttributes'; import type { MeasurementUnit, Measurements, TimedEvent } from '../types-hoist'; -import { logger } from '../utils-hoist'; +import { logger } from '../utils-hoist/logger'; import { getActiveSpan, getRootSpan } from '../utils/spanUtils'; /** diff --git a/packages/core/src/tracing/sentrySpan.ts b/packages/core/src/tracing/sentrySpan.ts index fb3e8f842244..fcc071c39603 100644 --- a/packages/core/src/tracing/sentrySpan.ts +++ b/packages/core/src/tracing/sentrySpan.ts @@ -1,5 +1,14 @@ import { getClient, getCurrentScope } from '../currentScopes'; import { DEBUG_BUILD } from '../debug-build'; +import { createSpanEnvelope } from '../envelope'; +import { getMetricSummaryJsonForSpan } from '../metrics/metric-summary'; +import { + SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME, + SEMANTIC_ATTRIBUTE_PROFILE_ID, + SEMANTIC_ATTRIBUTE_SENTRY_OP, + SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, + SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, +} from '../semanticAttributes'; import type { SentrySpanArguments, Span, @@ -15,16 +24,6 @@ import type { TransactionEvent, TransactionSource, } from '../types-hoist'; - -import { createSpanEnvelope } from '../envelope'; -import { getMetricSummaryJsonForSpan } from '../metrics/metric-summary'; -import { - SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME, - SEMANTIC_ATTRIBUTE_PROFILE_ID, - SEMANTIC_ATTRIBUTE_SENTRY_OP, - SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, - SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, -} from '../semanticAttributes'; import { logger } from '../utils-hoist/logger'; import { uuid4 } from '../utils-hoist/misc'; import { dropUndefinedKeys } from '../utils-hoist/object'; diff --git a/packages/core/src/utils/applyScopeDataToEvent.ts b/packages/core/src/utils/applyScopeDataToEvent.ts index 3984d9a44436..fccca13f87b9 100644 --- a/packages/core/src/utils/applyScopeDataToEvent.ts +++ b/packages/core/src/utils/applyScopeDataToEvent.ts @@ -1,6 +1,6 @@ import { getDynamicSamplingContextFromSpan } from '../tracing/dynamicSamplingContext'; import type { Breadcrumb, Event, ScopeData, Span } from '../types-hoist'; -import { dropUndefinedKeys } from '../utils-hoist'; +import { dropUndefinedKeys } from '../utils-hoist/object'; import { merge } from './merge'; import { getRootSpan, spanToJSON, spanToTraceContext } from './spanUtils'; diff --git a/packages/deno/src/integrations/breadcrumbs.ts b/packages/deno/src/integrations/breadcrumbs.ts index 923c57f99844..f826ed8310cb 100644 --- a/packages/deno/src/integrations/breadcrumbs.ts +++ b/packages/deno/src/integrations/breadcrumbs.ts @@ -1,12 +1,3 @@ -import { addBreadcrumb, defineIntegration, getClient } from '@sentry/core'; -import { - addConsoleInstrumentationHandler, - addFetchInstrumentationHandler, - getBreadcrumbLogLevelFromHttpStatusCode, - getEventDescription, - safeJoin, - severityLevelFromString, -} from '@sentry/core'; import type { Client, Event as SentryEvent, @@ -16,6 +7,17 @@ import type { HandlerDataFetch, IntegrationFn, } from '@sentry/core'; +import { + addBreadcrumb, + addConsoleInstrumentationHandler, + addFetchInstrumentationHandler, + defineIntegration, + getBreadcrumbLogLevelFromHttpStatusCode, + getClient, + getEventDescription, + safeJoin, + severityLevelFromString, +} from '@sentry/core'; interface BreadcrumbsOptions { console: boolean; diff --git a/packages/deno/src/integrations/contextlines.ts b/packages/deno/src/integrations/contextlines.ts index 3e7827fb98b2..d969ab001d7e 100644 --- a/packages/deno/src/integrations/contextlines.ts +++ b/packages/deno/src/integrations/contextlines.ts @@ -1,6 +1,5 @@ -import { defineIntegration } from '@sentry/core'; -import { LRUMap, addContextToFrame } from '@sentry/core'; import type { Event, IntegrationFn, StackFrame } from '@sentry/core'; +import { LRUMap, addContextToFrame, defineIntegration } from '@sentry/core'; const INTEGRATION_NAME = 'ContextLines'; const FILE_CONTENT_CACHE = new LRUMap(100); diff --git a/packages/deno/src/integrations/globalhandlers.ts b/packages/deno/src/integrations/globalhandlers.ts index 9c7960d85064..cb799b0be132 100644 --- a/packages/deno/src/integrations/globalhandlers.ts +++ b/packages/deno/src/integrations/globalhandlers.ts @@ -1,10 +1,5 @@ -import type { ServerRuntimeClient } from '@sentry/core'; -import { defineIntegration } from '@sentry/core'; -import { captureEvent } from '@sentry/core'; -import { getClient } from '@sentry/core'; -import { flush } from '@sentry/core'; -import { eventFromUnknownInput, isPrimitive } from '@sentry/core'; -import type { Client, Event, IntegrationFn, Primitive, StackParser } from '@sentry/core'; +import type { Client, Event, IntegrationFn, Primitive, ServerRuntimeClient, StackParser } from '@sentry/core'; +import { captureEvent, defineIntegration, eventFromUnknownInput, flush, getClient, isPrimitive } from '@sentry/core'; type GlobalHandlersIntegrationsOptionKeys = 'error' | 'unhandledrejection'; diff --git a/packages/deno/src/integrations/normalizepaths.ts b/packages/deno/src/integrations/normalizepaths.ts index 3576b387b54d..417fd139b545 100644 --- a/packages/deno/src/integrations/normalizepaths.ts +++ b/packages/deno/src/integrations/normalizepaths.ts @@ -1,6 +1,5 @@ -import { defineIntegration } from '@sentry/core'; -import { createStackParser, dirname, nodeStackLineParser } from '@sentry/core'; import type { IntegrationFn } from '@sentry/core'; +import { createStackParser, defineIntegration, dirname, nodeStackLineParser } from '@sentry/core'; const INTEGRATION_NAME = 'NormalizePaths'; diff --git a/packages/deno/src/sdk.ts b/packages/deno/src/sdk.ts index 1223c8351a4c..25dc550fc353 100644 --- a/packages/deno/src/sdk.ts +++ b/packages/deno/src/sdk.ts @@ -1,14 +1,15 @@ -import type { ServerRuntimeClientOptions } from '@sentry/core'; +import type { Client, Integration, Options, ServerRuntimeClientOptions, StackParser } from '@sentry/core'; import { + createStackParser, dedupeIntegration, functionToStringIntegration, + getIntegrationsToSetup, inboundFiltersIntegration, + initAndBind, linkedErrorsIntegration, + nodeStackLineParser, + stackParserFromStackParserOptions, } from '@sentry/core'; -import { getIntegrationsToSetup, initAndBind } from '@sentry/core'; -import { createStackParser, nodeStackLineParser, stackParserFromStackParserOptions } from '@sentry/core'; -import type { Client, Integration, Options, StackParser } from '@sentry/core'; - import { DenoClient } from './client'; import { breadcrumbsIntegration } from './integrations/breadcrumbs'; import { denoContextIntegration } from './integrations/context'; diff --git a/packages/deno/src/transports/index.ts b/packages/deno/src/transports/index.ts index 7690c1829714..3d4e26a9f805 100644 --- a/packages/deno/src/transports/index.ts +++ b/packages/deno/src/transports/index.ts @@ -1,6 +1,5 @@ -import { createTransport, suppressTracing } from '@sentry/core'; -import { consoleSandbox, logger, rejectedSyncPromise } from '@sentry/core'; import type { BaseTransportOptions, Transport, TransportMakeRequestResponse, TransportRequest } from '@sentry/core'; +import { consoleSandbox, createTransport, logger, rejectedSyncPromise, suppressTracing } from '@sentry/core'; export interface DenoTransportOptions extends BaseTransportOptions { /** Custom headers for the transport. Used by the XHRTransport and FetchTransport */ diff --git a/packages/deno/src/types.ts b/packages/deno/src/types.ts index f2444f7139b3..422e561bb644 100644 --- a/packages/deno/src/types.ts +++ b/packages/deno/src/types.ts @@ -1,5 +1,4 @@ import type { ClientOptions, Options, TracePropagationTargets } from '@sentry/core'; - import type { DenoTransportOptions } from './transports'; export interface BaseDenoOptions { diff --git a/packages/feedback/src/core/TestClient.ts b/packages/feedback/src/core/TestClient.ts index 3e128ff8d92f..f688cdb51a85 100644 --- a/packages/feedback/src/core/TestClient.ts +++ b/packages/feedback/src/core/TestClient.ts @@ -1,6 +1,5 @@ -import { BaseClient, createTransport, initAndBind } from '@sentry/core'; -import { resolvedSyncPromise } from '@sentry/core'; import type { BrowserClientReplayOptions, ClientOptions, Event, SeverityLevel } from '@sentry/core'; +import { BaseClient, createTransport, initAndBind, resolvedSyncPromise } from '@sentry/core'; export interface TestClientOptions extends ClientOptions, BrowserClientReplayOptions {} diff --git a/packages/feedback/src/core/integration.ts b/packages/feedback/src/core/integration.ts index 8cfcb2c8ea32..fb1bd1fc143e 100644 --- a/packages/feedback/src/core/integration.ts +++ b/packages/feedback/src/core/integration.ts @@ -1,5 +1,3 @@ -import { getClient } from '@sentry/core'; -import { isBrowser, logger } from '@sentry/core'; import type { FeedbackInternalOptions, FeedbackModalIntegration, @@ -7,6 +5,7 @@ import type { Integration, IntegrationFn, } from '@sentry/core'; +import { getClient, isBrowser, logger } from '@sentry/core'; import { ADD_SCREENSHOT_LABEL, CANCEL_BUTTON_LABEL, diff --git a/packages/feedback/src/core/sendFeedback.ts b/packages/feedback/src/core/sendFeedback.ts index 4f5e1e3629b3..8342a03a2f71 100644 --- a/packages/feedback/src/core/sendFeedback.ts +++ b/packages/feedback/src/core/sendFeedback.ts @@ -1,8 +1,5 @@ -import { captureFeedback } from '@sentry/core'; -import { getClient } from '@sentry/core'; -import { getCurrentScope } from '@sentry/core'; -import { getLocationHref } from '@sentry/core'; import type { Event, EventHint, SendFeedback, SendFeedbackParams, TransportMakeRequestResponse } from '@sentry/core'; +import { captureFeedback, getClient, getCurrentScope, getLocationHref } from '@sentry/core'; import { FEEDBACK_API_SOURCE } from '../constants'; /** diff --git a/packages/google-cloud-serverless/src/integrations/google-cloud-grpc.ts b/packages/google-cloud-serverless/src/integrations/google-cloud-grpc.ts index 0173e4d10442..4f658c6e92e5 100644 --- a/packages/google-cloud-serverless/src/integrations/google-cloud-grpc.ts +++ b/packages/google-cloud-serverless/src/integrations/google-cloud-grpc.ts @@ -1,7 +1,6 @@ import type { EventEmitter } from 'events'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, defineIntegration, getClient } from '@sentry/core'; -import { fill } from '@sentry/core'; import type { Client, IntegrationFn } from '@sentry/core'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, defineIntegration, fill, getClient } from '@sentry/core'; import { startInactiveSpan } from '@sentry/node'; interface GrpcFunction extends CallableFunction { diff --git a/packages/google-cloud-serverless/src/integrations/google-cloud-http.ts b/packages/google-cloud-serverless/src/integrations/google-cloud-http.ts index b00a583ecf02..820f2df49381 100644 --- a/packages/google-cloud-serverless/src/integrations/google-cloud-http.ts +++ b/packages/google-cloud-serverless/src/integrations/google-cloud-http.ts @@ -1,7 +1,12 @@ import type * as common from '@google-cloud/common'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SentryNonRecordingSpan, defineIntegration, getClient } from '@sentry/core'; -import { fill } from '@sentry/core'; import type { Client, IntegrationFn } from '@sentry/core'; +import { + SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, + SentryNonRecordingSpan, + defineIntegration, + fill, + getClient, +} from '@sentry/core'; import { startInactiveSpan } from '@sentry/node'; type RequestOptions = common.DecorateRequestOptions; diff --git a/packages/google-cloud-serverless/src/utils.ts b/packages/google-cloud-serverless/src/utils.ts index a4f5ae36fb90..cdefdb460ee3 100644 --- a/packages/google-cloud-serverless/src/utils.ts +++ b/packages/google-cloud-serverless/src/utils.ts @@ -1,6 +1,5 @@ -import { withIsolationScope } from '@sentry/core'; -import { addExceptionMechanism } from '@sentry/core'; import type { Scope } from '@sentry/core'; +import { addExceptionMechanism, withIsolationScope } from '@sentry/core'; /** * @param fn function to run diff --git a/packages/nestjs/src/setup.ts b/packages/nestjs/src/setup.ts index 55f7ddfef434..55e168c53963 100644 --- a/packages/nestjs/src/setup.ts +++ b/packages/nestjs/src/setup.ts @@ -3,12 +3,13 @@ import type { CallHandler, DynamicModule, ExecutionContext, + HttpServer, NestInterceptor, OnModuleInit, } from '@nestjs/common'; import { Catch, Global, HttpException, Injectable, Logger, Module } from '@nestjs/common'; -import type { HttpServer } from '@nestjs/common'; import { APP_INTERCEPTOR, BaseExceptionFilter } from '@nestjs/core'; +import type { Span } from '@sentry/core'; import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, @@ -16,10 +17,9 @@ import { getClient, getDefaultIsolationScope, getIsolationScope, + logger, spanToJSON, } from '@sentry/core'; -import { logger } from '@sentry/core'; -import type { Span } from '@sentry/core'; import type { Observable } from 'rxjs'; import { isExpectedError } from './helpers'; diff --git a/packages/nextjs/src/client/index.ts b/packages/nextjs/src/client/index.ts index a26844c07da3..163e29f0b9a7 100644 --- a/packages/nextjs/src/client/index.ts +++ b/packages/nextjs/src/client/index.ts @@ -1,9 +1,7 @@ -import { addEventProcessor, applySdkMetadata } from '@sentry/core'; -import { GLOBAL_OBJ } from '@sentry/core'; import type { Client, EventProcessor, Integration } from '@sentry/core'; +import { GLOBAL_OBJ, addEventProcessor, applySdkMetadata } from '@sentry/core'; import type { BrowserOptions } from '@sentry/react'; import { getDefaultIntegrations as getReactDefaultIntegrations, init as reactInit } from '@sentry/react'; - import { devErrorSymbolicationEventProcessor } from '../common/devErrorSymbolicationEventProcessor'; import { getVercelEnv } from '../common/getVercelEnv'; import { isRedirectNavigationError } from '../common/nextNavigationErrorUtils'; @@ -13,8 +11,9 @@ import { INCOMPLETE_APP_ROUTER_INSTRUMENTATION_TRANSACTION_NAME } from './routin import { applyTunnelRouteOption } from './tunnelRoute'; export * from '@sentry/react'; - +export * from '../common'; export { captureUnderscoreErrorException } from '../common/pages-router-instrumentation/_error'; +export { browserTracingIntegration } from './browserTracingIntegration'; const globalWithInjectedValues = GLOBAL_OBJ as typeof GLOBAL_OBJ & { _sentryRewriteFramesAssetPrefixPath: string; @@ -85,7 +84,3 @@ function getDefaultIntegrations(options: BrowserOptions): Integration[] { export function withSentryConfig(exportedUserNextConfig: T): T { return exportedUserNextConfig; } - -export { browserTracingIntegration } from './browserTracingIntegration'; - -export * from '../common'; diff --git a/packages/nextjs/src/client/routing/pagesRouterRoutingInstrumentation.ts b/packages/nextjs/src/client/routing/pagesRouterRoutingInstrumentation.ts index 43ea2a600e1d..cb583bb419e1 100644 --- a/packages/nextjs/src/client/routing/pagesRouterRoutingInstrumentation.ts +++ b/packages/nextjs/src/client/routing/pagesRouterRoutingInstrumentation.ts @@ -1,13 +1,15 @@ import type { ParsedUrlQuery } from 'querystring'; +import type { Client, TransactionSource } from '@sentry/core'; import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, + browserPerformanceTimeOrigin, + logger, + parseBaggageHeader, + stripUrlQueryAndFragment, } from '@sentry/core'; -import { browserPerformanceTimeOrigin, logger, parseBaggageHeader, stripUrlQueryAndFragment } from '@sentry/core'; -import type { Client, TransactionSource } from '@sentry/core'; import { WINDOW, startBrowserTracingNavigationSpan, startBrowserTracingPageLoadSpan } from '@sentry/react'; - import type { NEXT_DATA } from 'next/dist/shared/lib/utils'; import RouterImport from 'next/router'; diff --git a/packages/nextjs/src/common/captureRequestError.ts b/packages/nextjs/src/common/captureRequestError.ts index 857668cb36c6..6de33ad11a8e 100644 --- a/packages/nextjs/src/common/captureRequestError.ts +++ b/packages/nextjs/src/common/captureRequestError.ts @@ -1,6 +1,5 @@ -import { captureException, withScope } from '@sentry/core'; -import { headersToDict } from '@sentry/core'; import type { RequestEventData } from '@sentry/core'; +import { captureException, headersToDict, withScope } from '@sentry/core'; type RequestInfo = { path: string; diff --git a/packages/nextjs/src/common/devErrorSymbolicationEventProcessor.ts b/packages/nextjs/src/common/devErrorSymbolicationEventProcessor.ts index 8a896e543dde..61365b180d77 100644 --- a/packages/nextjs/src/common/devErrorSymbolicationEventProcessor.ts +++ b/packages/nextjs/src/common/devErrorSymbolicationEventProcessor.ts @@ -1,6 +1,5 @@ -import { suppressTracing } from '@sentry/core'; -import { GLOBAL_OBJ } from '@sentry/core'; import type { Event, EventHint } from '@sentry/core'; +import { GLOBAL_OBJ, suppressTracing } from '@sentry/core'; import type { StackFrame } from 'stacktrace-parser'; import * as stackTraceParser from 'stacktrace-parser'; diff --git a/packages/nextjs/src/common/pages-router-instrumentation/_error.ts b/packages/nextjs/src/common/pages-router-instrumentation/_error.ts index a96b3131a56f..68a3ef782688 100644 --- a/packages/nextjs/src/common/pages-router-instrumentation/_error.ts +++ b/packages/nextjs/src/common/pages-router-instrumentation/_error.ts @@ -1,5 +1,4 @@ -import { captureException, httpRequestToRequestData, withScope } from '@sentry/core'; -import { vercelWaitUntil } from '@sentry/core'; +import { captureException, httpRequestToRequestData, vercelWaitUntil, withScope } from '@sentry/core'; import type { NextPageContext } from 'next'; import { flushSafelyWithTimeout } from '../utils/responseEnd'; diff --git a/packages/nextjs/src/common/pages-router-instrumentation/wrapApiHandlerWithSentry.ts b/packages/nextjs/src/common/pages-router-instrumentation/wrapApiHandlerWithSentry.ts index 347ac9ffd7e9..3cc5b4d340e5 100644 --- a/packages/nextjs/src/common/pages-router-instrumentation/wrapApiHandlerWithSentry.ts +++ b/packages/nextjs/src/common/pages-router-instrumentation/wrapApiHandlerWithSentry.ts @@ -4,13 +4,14 @@ import { captureException, continueTrace, httpRequestToRequestData, + isString, + logger, + objectify, setHttpStatus, startSpanManual, + vercelWaitUntil, withIsolationScope, } from '@sentry/core'; -import { isString, logger, objectify } from '@sentry/core'; - -import { vercelWaitUntil } from '@sentry/core'; import type { NextApiRequest } from 'next'; import type { AugmentedNextApiResponse, NextApiHandler } from '../types'; import { flushSafelyWithTimeout } from '../utils/responseEnd'; diff --git a/packages/nextjs/src/common/pages-router-instrumentation/wrapPageComponentWithSentry.ts b/packages/nextjs/src/common/pages-router-instrumentation/wrapPageComponentWithSentry.ts index 3d481235be25..b08bdad5e9ab 100644 --- a/packages/nextjs/src/common/pages-router-instrumentation/wrapPageComponentWithSentry.ts +++ b/packages/nextjs/src/common/pages-router-instrumentation/wrapPageComponentWithSentry.ts @@ -1,5 +1,4 @@ -import { captureException, getCurrentScope, withIsolationScope } from '@sentry/core'; -import { extractTraceparentData } from '@sentry/core'; +import { captureException, extractTraceparentData, getCurrentScope, withIsolationScope } from '@sentry/core'; interface FunctionComponent { (...args: unknown[]): unknown; diff --git a/packages/nextjs/src/common/types.ts b/packages/nextjs/src/common/types.ts index 39ca6af602bb..ebf35c68c1ba 100644 --- a/packages/nextjs/src/common/types.ts +++ b/packages/nextjs/src/common/types.ts @@ -1,5 +1,4 @@ -import type { SentrySpan } from '@sentry/core'; -import type { WebFetchHeaders, WrappedFunction } from '@sentry/core'; +import type { SentrySpan, WebFetchHeaders, WrappedFunction } from '@sentry/core'; import type { NextApiRequest, NextApiResponse } from 'next'; import type { RequestAsyncStorage } from '../config/templates/requestAsyncStorageShim'; diff --git a/packages/nextjs/src/common/utils/responseEnd.ts b/packages/nextjs/src/common/utils/responseEnd.ts index e792554f799d..b35fd9022427 100644 --- a/packages/nextjs/src/common/utils/responseEnd.ts +++ b/packages/nextjs/src/common/utils/responseEnd.ts @@ -1,8 +1,6 @@ import type { ServerResponse } from 'http'; -import { flush, setHttpStatus } from '@sentry/core'; -import { fill, logger } from '@sentry/core'; import type { Span } from '@sentry/core'; - +import { fill, flush, logger, setHttpStatus } from '@sentry/core'; import { DEBUG_BUILD } from '../debug-build'; import type { ResponseEndMethod, WrappedResponseEndMethod } from '../types'; diff --git a/packages/nextjs/src/common/utils/tracingUtils.ts b/packages/nextjs/src/common/utils/tracingUtils.ts index a4e1e905fbc4..4f5e9c9fa5d3 100644 --- a/packages/nextjs/src/common/utils/tracingUtils.ts +++ b/packages/nextjs/src/common/utils/tracingUtils.ts @@ -1,6 +1,5 @@ -import { Scope, getActiveSpan, getRootSpan, spanToJSON, startNewTrace } from '@sentry/core'; -import { GLOBAL_OBJ, logger } from '@sentry/core'; import type { PropagationContext } from '@sentry/core'; +import { GLOBAL_OBJ, Scope, getActiveSpan, getRootSpan, logger, spanToJSON, startNewTrace } from '@sentry/core'; import { DEBUG_BUILD } from '../debug-build'; import { TRANSACTION_ATTR_SHOULD_DROP_TRANSACTION } from '../span-attributes-with-logic-attached'; diff --git a/packages/nextjs/src/common/withServerActionInstrumentation.ts b/packages/nextjs/src/common/withServerActionInstrumentation.ts index b065d3008baf..8d5ab14c77c3 100644 --- a/packages/nextjs/src/common/withServerActionInstrumentation.ts +++ b/packages/nextjs/src/common/withServerActionInstrumentation.ts @@ -1,3 +1,4 @@ +import type { RequestEventData } from '@sentry/core'; import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SPAN_STATUS_ERROR, @@ -6,12 +7,11 @@ import { getClient, getIsolationScope, handleCallbackErrors, + logger, startSpan, + vercelWaitUntil, withIsolationScope, } from '@sentry/core'; -import { logger, vercelWaitUntil } from '@sentry/core'; -import type { RequestEventData } from '@sentry/core'; - import { DEBUG_BUILD } from './debug-build'; import { isNotFoundNavigationError, isRedirectNavigationError } from './nextNavigationErrorUtils'; import { flushSafelyWithTimeout } from './utils/responseEnd'; diff --git a/packages/nextjs/src/common/wrapGenerationFunctionWithSentry.ts b/packages/nextjs/src/common/wrapGenerationFunctionWithSentry.ts index 5e17007af6c5..521e45df4e27 100644 --- a/packages/nextjs/src/common/wrapGenerationFunctionWithSentry.ts +++ b/packages/nextjs/src/common/wrapGenerationFunctionWithSentry.ts @@ -1,4 +1,6 @@ +import type { RequestEventData, WebFetchHeaders } from '@sentry/core'; import { + SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SPAN_STATUS_ERROR, SPAN_STATUS_OK, @@ -9,15 +11,14 @@ import { getClient, getRootSpan, handleCallbackErrors, + propagationContextFromHeaders, setCapturedScopesOnSpan, startSpanManual, + uuid4, + winterCGHeadersToDict, withIsolationScope, withScope, } from '@sentry/core'; -import { propagationContextFromHeaders, uuid4, winterCGHeadersToDict } from '@sentry/core'; -import type { RequestEventData, WebFetchHeaders } from '@sentry/core'; - -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import type { GenerationFunctionContext } from '../common/types'; import { isNotFoundNavigationError, isRedirectNavigationError } from './nextNavigationErrorUtils'; import { TRANSACTION_ATTR_SENTRY_TRACE_BACKFILL } from './span-attributes-with-logic-attached'; diff --git a/packages/nextjs/src/common/wrapRouteHandlerWithSentry.ts b/packages/nextjs/src/common/wrapRouteHandlerWithSentry.ts index b8fe38ba1635..8cf3e59205b2 100644 --- a/packages/nextjs/src/common/wrapRouteHandlerWithSentry.ts +++ b/packages/nextjs/src/common/wrapRouteHandlerWithSentry.ts @@ -1,3 +1,4 @@ +import type { RequestEventData } from '@sentry/core'; import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, @@ -8,16 +9,15 @@ import { getIsolationScope, getRootSpan, handleCallbackErrors, + propagationContextFromHeaders, setCapturedScopesOnSpan, setHttpStatus, + winterCGHeadersToDict, withIsolationScope, withScope, } from '@sentry/core'; -import type { RequestEventData } from '@sentry/core'; -import type { RouteHandlerContext } from './types'; - -import { propagationContextFromHeaders, winterCGHeadersToDict } from '@sentry/core'; import { isNotFoundNavigationError, isRedirectNavigationError } from './nextNavigationErrorUtils'; +import type { RouteHandlerContext } from './types'; import { commonObjectToIsolationScope } from './utils/tracingUtils'; /** diff --git a/packages/nextjs/src/common/wrapServerComponentWithSentry.ts b/packages/nextjs/src/common/wrapServerComponentWithSentry.ts index c6901bc374cc..ff91823faf43 100644 --- a/packages/nextjs/src/common/wrapServerComponentWithSentry.ts +++ b/packages/nextjs/src/common/wrapServerComponentWithSentry.ts @@ -1,4 +1,6 @@ +import type { RequestEventData } from '@sentry/core'; import { + SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SPAN_STATUS_ERROR, SPAN_STATUS_OK, @@ -8,15 +10,15 @@ import { getCapturedScopesOnSpan, getRootSpan, handleCallbackErrors, + propagationContextFromHeaders, setCapturedScopesOnSpan, startSpanManual, + uuid4, + vercelWaitUntil, + winterCGHeadersToDict, withIsolationScope, withScope, } from '@sentry/core'; -import { propagationContextFromHeaders, uuid4, vercelWaitUntil, winterCGHeadersToDict } from '@sentry/core'; -import type { RequestEventData } from '@sentry/core'; - -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { isNotFoundNavigationError, isRedirectNavigationError } from '../common/nextNavigationErrorUtils'; import type { ServerComponentContext } from '../common/types'; import { TRANSACTION_ATTR_SENTRY_TRACE_BACKFILL } from './span-attributes-with-logic-attached'; diff --git a/packages/nextjs/src/edge/distDirRewriteFramesIntegration.ts b/packages/nextjs/src/edge/distDirRewriteFramesIntegration.ts index b9a72d8d95b3..9691cce74782 100644 --- a/packages/nextjs/src/edge/distDirRewriteFramesIntegration.ts +++ b/packages/nextjs/src/edge/distDirRewriteFramesIntegration.ts @@ -1,5 +1,4 @@ -import { defineIntegration, rewriteFramesIntegration } from '@sentry/core'; -import { escapeStringForRegex } from '@sentry/core'; +import { defineIntegration, escapeStringForRegex, rewriteFramesIntegration } from '@sentry/core'; export const distDirRewriteFramesIntegration = defineIntegration(({ distDirName }: { distDirName: string }) => { const distDirAbsPath = distDirName.replace(/(\/|\\)$/, ''); // We strip trailing slashes because "app:///_next" also doesn't have one diff --git a/packages/nextjs/src/edge/index.ts b/packages/nextjs/src/edge/index.ts index ba66c0ba9560..24ec193df0d1 100644 --- a/packages/nextjs/src/edge/index.ts +++ b/packages/nextjs/src/edge/index.ts @@ -1,4 +1,5 @@ import { + GLOBAL_OBJ, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, @@ -6,17 +7,19 @@ import { getRootSpan, registerSpanErrorInstrumentation, spanToJSON, + stripUrlQueryAndFragment, + vercelWaitUntil, } from '@sentry/core'; - -import { GLOBAL_OBJ, stripUrlQueryAndFragment, vercelWaitUntil } from '@sentry/core'; import type { VercelEdgeOptions } from '@sentry/vercel-edge'; import { getDefaultIntegrations, init as vercelEdgeInit } from '@sentry/vercel-edge'; - import { isBuild } from '../common/utils/isBuild'; import { flushSafelyWithTimeout } from '../common/utils/responseEnd'; import { distDirRewriteFramesIntegration } from './distDirRewriteFramesIntegration'; +export * from '@sentry/vercel-edge'; +export * from '../common'; export { captureUnderscoreErrorException } from '../common/pages-router-instrumentation/_error'; +export { wrapApiHandlerWithSentry } from './wrapApiHandlerWithSentry'; export type EdgeOptions = VercelEdgeOptions; @@ -95,9 +98,3 @@ export function init(options: VercelEdgeOptions = {}): void { export function withSentryConfig(exportedUserNextConfig: T): T { return exportedUserNextConfig; } - -export * from '@sentry/vercel-edge'; - -export * from '../common'; - -export { wrapApiHandlerWithSentry } from './wrapApiHandlerWithSentry'; diff --git a/packages/nextjs/src/edge/rewriteFramesIntegration.ts b/packages/nextjs/src/edge/rewriteFramesIntegration.ts index cb904079d51d..db3aa26b7469 100644 --- a/packages/nextjs/src/edge/rewriteFramesIntegration.ts +++ b/packages/nextjs/src/edge/rewriteFramesIntegration.ts @@ -1,6 +1,10 @@ -import { defineIntegration, rewriteFramesIntegration as originalRewriteFramesIntegration } from '@sentry/core'; -import { GLOBAL_OBJ, escapeStringForRegex } from '@sentry/core'; import type { IntegrationFn, StackFrame } from '@sentry/core'; +import { + GLOBAL_OBJ, + defineIntegration, + escapeStringForRegex, + rewriteFramesIntegration as originalRewriteFramesIntegration, +} from '@sentry/core'; const globalWithInjectedValues = GLOBAL_OBJ as typeof GLOBAL_OBJ & { _sentryRewriteFramesDistDir?: string; diff --git a/packages/nextjs/src/edge/wrapApiHandlerWithSentry.ts b/packages/nextjs/src/edge/wrapApiHandlerWithSentry.ts index fa31511e4c28..90f03b547980 100644 --- a/packages/nextjs/src/edge/wrapApiHandlerWithSentry.ts +++ b/packages/nextjs/src/edge/wrapApiHandlerWithSentry.ts @@ -9,9 +9,10 @@ import { handleCallbackErrors, setCapturedScopesOnSpan, startSpan, + vercelWaitUntil, + winterCGRequestToRequestData, withIsolationScope, } from '@sentry/core'; -import { vercelWaitUntil, winterCGRequestToRequestData } from '@sentry/core'; import { flushSafelyWithTimeout } from '../common/utils/responseEnd'; import type { EdgeRouteHandler } from './types'; diff --git a/packages/nextjs/src/server/distDirRewriteFramesIntegration.ts b/packages/nextjs/src/server/distDirRewriteFramesIntegration.ts index dfa61ff44b98..6941fb60f19f 100644 --- a/packages/nextjs/src/server/distDirRewriteFramesIntegration.ts +++ b/packages/nextjs/src/server/distDirRewriteFramesIntegration.ts @@ -1,6 +1,5 @@ import * as path from 'path'; -import { defineIntegration, rewriteFramesIntegration } from '@sentry/core'; -import { escapeStringForRegex } from '@sentry/core'; +import { defineIntegration, escapeStringForRegex, rewriteFramesIntegration } from '@sentry/core'; export const distDirRewriteFramesIntegration = defineIntegration(({ distDirName }: { distDirName: string }) => { // nextjs always puts the build directory at the project root level, which is also where you run `next start` from, so diff --git a/packages/nextjs/src/server/index.ts b/packages/nextjs/src/server/index.ts index 78d8c29a3342..f6ea8cde141f 100644 --- a/packages/nextjs/src/server/index.ts +++ b/packages/nextjs/src/server/index.ts @@ -1,3 +1,11 @@ +import { context } from '@opentelemetry/api'; +import { + ATTR_HTTP_REQUEST_METHOD, + ATTR_HTTP_ROUTE, + ATTR_URL_QUERY, + SEMATTRS_HTTP_METHOD, + SEMATTRS_HTTP_TARGET, +} from '@opentelemetry/semantic-conventions'; import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, @@ -13,18 +21,9 @@ import { spanToJSON, } from '@sentry/core'; import { GLOBAL_OBJ, extractTraceparentData, logger, stripUrlQueryAndFragment } from '@sentry/core'; +import type { EventProcessor } from '@sentry/core'; import type { NodeClient, NodeOptions } from '@sentry/node'; import { getDefaultIntegrations, httpIntegration, init as nodeInit } from '@sentry/node'; - -import { context } from '@opentelemetry/api'; -import { - ATTR_HTTP_REQUEST_METHOD, - ATTR_HTTP_ROUTE, - ATTR_URL_QUERY, - SEMATTRS_HTTP_METHOD, - SEMATTRS_HTTP_TARGET, -} from '@opentelemetry/semantic-conventions'; -import type { EventProcessor } from '@sentry/core'; import { getScopesFromContext } from '@sentry/opentelemetry'; import { DEBUG_BUILD } from '../common/debug-build'; import { devErrorSymbolicationEventProcessor } from '../common/devErrorSymbolicationEventProcessor'; diff --git a/packages/nextjs/src/server/rewriteFramesIntegration.ts b/packages/nextjs/src/server/rewriteFramesIntegration.ts index 55652566710f..56d56587eabb 100644 --- a/packages/nextjs/src/server/rewriteFramesIntegration.ts +++ b/packages/nextjs/src/server/rewriteFramesIntegration.ts @@ -1,7 +1,10 @@ import * as path from 'path'; -import { defineIntegration, rewriteFramesIntegration as originalRewriteFramesIntegration } from '@sentry/core'; -import { escapeStringForRegex } from '@sentry/core'; import type { IntegrationFn, StackFrame } from '@sentry/core'; +import { + defineIntegration, + escapeStringForRegex, + rewriteFramesIntegration as originalRewriteFramesIntegration, +} from '@sentry/core'; const globalWithInjectedValues = global as typeof global & { _sentryRewriteFramesDistDir?: string; diff --git a/packages/node/src/integrations/anr/index.ts b/packages/node/src/integrations/anr/index.ts index 9f041f2e563f..9e979f64e5c3 100644 --- a/packages/node/src/integrations/anr/index.ts +++ b/packages/node/src/integrations/anr/index.ts @@ -1,7 +1,15 @@ import { Worker } from 'node:worker_threads'; -import { defineIntegration, getCurrentScope, getGlobalScope, getIsolationScope, mergeScopeData } from '@sentry/core'; -import { GLOBAL_OBJ, getFilenameToDebugIdMap, logger } from '@sentry/core'; import type { Contexts, Event, EventHint, Integration, IntegrationFn, ScopeData } from '@sentry/core'; +import { + GLOBAL_OBJ, + defineIntegration, + getCurrentScope, + getFilenameToDebugIdMap, + getGlobalScope, + getIsolationScope, + logger, + mergeScopeData, +} from '@sentry/core'; import { NODE_VERSION } from '../../nodeVersion'; import type { NodeClient } from '../../sdk/client'; import type { AnrIntegrationOptions, WorkerStartData } from './common'; diff --git a/packages/node/src/integrations/anr/worker.ts b/packages/node/src/integrations/anr/worker.ts index 4046f21bfe26..354cea514618 100644 --- a/packages/node/src/integrations/anr/worker.ts +++ b/packages/node/src/integrations/anr/worker.ts @@ -1,21 +1,19 @@ import { Session as InspectorSession } from 'node:inspector'; import { parentPort, workerData } from 'node:worker_threads'; +import type { DebugImage, Event, ScopeData, Session, StackFrame } from '@sentry/core'; import { applyScopeDataToEvent, + callFrameToStackFrame, createEventEnvelope, createSessionEnvelope, getEnvelopeEndpointWithUrlEncodedAuth, makeSession, - updateSession, -} from '@sentry/core'; -import { - callFrameToStackFrame, normalizeUrlToBase, stripSentryFramesAndReverse, + updateSession, uuid4, watchdogTimer, } from '@sentry/core'; -import type { DebugImage, Event, ScopeData, Session, StackFrame } from '@sentry/core'; import { makeNodeTransport } from '../../transports'; import { createGetModuleFromFilename } from '../../utils/module'; diff --git a/packages/node/src/integrations/console.ts b/packages/node/src/integrations/console.ts index 9413ed6da4bf..5e5e6ac414d9 100644 --- a/packages/node/src/integrations/console.ts +++ b/packages/node/src/integrations/console.ts @@ -1,6 +1,12 @@ import * as util from 'node:util'; -import { addBreadcrumb, defineIntegration, getClient } from '@sentry/core'; -import { addConsoleInstrumentationHandler, severityLevelFromString, truncate } from '@sentry/core'; +import { + addBreadcrumb, + addConsoleInstrumentationHandler, + defineIntegration, + getClient, + severityLevelFromString, + truncate, +} from '@sentry/core'; const INTEGRATION_NAME = 'Console'; diff --git a/packages/node/src/integrations/context.ts b/packages/node/src/integrations/context.ts index ec74064a5dff..5176a3a3348a 100644 --- a/packages/node/src/integrations/context.ts +++ b/packages/node/src/integrations/context.ts @@ -1,10 +1,10 @@ /* eslint-disable max-lines */ + import { execFile } from 'node:child_process'; import { readFile, readdir } from 'node:fs'; import * as os from 'node:os'; import { join } from 'node:path'; import { promisify } from 'node:util'; -import { defineIntegration } from '@sentry/core'; import type { AppContext, CloudResourceContext, @@ -15,6 +15,7 @@ import type { IntegrationFn, OsContext, } from '@sentry/core'; +import { defineIntegration } from '@sentry/core'; export const readFileAsync = promisify(readFile); export const readDirAsync = promisify(readdir); diff --git a/packages/node/src/integrations/contextlines.ts b/packages/node/src/integrations/contextlines.ts index 63243589016a..5e1bd75913c9 100644 --- a/packages/node/src/integrations/contextlines.ts +++ b/packages/node/src/integrations/contextlines.ts @@ -1,9 +1,7 @@ import { createReadStream } from 'node:fs'; import { createInterface } from 'node:readline'; -import { defineIntegration } from '@sentry/core'; -import { LRUMap, logger, snipLine } from '@sentry/core'; import type { Event, IntegrationFn, StackFrame } from '@sentry/core'; - +import { LRUMap, defineIntegration, logger, snipLine } from '@sentry/core'; import { DEBUG_BUILD } from '../debug-build'; const LRU_FILE_CONTENTS_CACHE = new LRUMap>(10); diff --git a/packages/node/src/integrations/http/SentryHttpInstrumentation.ts b/packages/node/src/integrations/http/SentryHttpInstrumentation.ts index cd575b4f6869..382e5bde8a0a 100644 --- a/packages/node/src/integrations/http/SentryHttpInstrumentation.ts +++ b/packages/node/src/integrations/http/SentryHttpInstrumentation.ts @@ -5,6 +5,7 @@ import { VERSION } from '@opentelemetry/core'; import type { InstrumentationConfig } from '@opentelemetry/instrumentation'; import { InstrumentationBase, InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation'; import { getRequestInfo } from '@opentelemetry/instrumentation-http'; +import type { RequestEventData, SanitizedRequestData, Scope } from '@sentry/core'; import { addBreadcrumb, getBreadcrumbLogLevelFromHttpStatusCode, @@ -17,7 +18,6 @@ import { stripUrlQueryAndFragment, withIsolationScope, } from '@sentry/core'; -import type { RequestEventData, SanitizedRequestData, Scope } from '@sentry/core'; import { DEBUG_BUILD } from '../../debug-build'; import type { NodeClient } from '../../sdk/client'; import { getRequestUrl } from '../../utils/getRequestUrl'; diff --git a/packages/node/src/integrations/http/index.ts b/packages/node/src/integrations/http/index.ts index 7af7716f0123..12b9564737a0 100644 --- a/packages/node/src/integrations/http/index.ts +++ b/packages/node/src/integrations/http/index.ts @@ -2,11 +2,9 @@ import type { ClientRequest, IncomingMessage, RequestOptions, ServerResponse } f import { diag } from '@opentelemetry/api'; import type { HttpInstrumentationConfig } from '@opentelemetry/instrumentation-http'; import { HttpInstrumentation } from '@opentelemetry/instrumentation-http'; - -import { defineIntegration } from '@sentry/core'; import type { IntegrationFn, Span } from '@sentry/core'; +import { defineIntegration } from '@sentry/core'; import { getClient } from '@sentry/opentelemetry'; - import { generateInstrumentOnce } from '../../otel/instrument'; import type { NodeClient } from '../../sdk/client'; import type { HTTPModuleRequestIncomingMessage } from '../../transports/http-module'; diff --git a/packages/node/src/integrations/local-variables/local-variables-async.ts b/packages/node/src/integrations/local-variables/local-variables-async.ts index a7e06470dbb3..89d92e46bd59 100644 --- a/packages/node/src/integrations/local-variables/local-variables-async.ts +++ b/packages/node/src/integrations/local-variables/local-variables-async.ts @@ -1,12 +1,9 @@ import { Worker } from 'node:worker_threads'; -import { defineIntegration } from '@sentry/core'; -import { logger } from '@sentry/core'; import type { Event, EventHint, Exception, IntegrationFn } from '@sentry/core'; - +import { defineIntegration, logger } from '@sentry/core'; import type { NodeClient } from '../../sdk/client'; import type { FrameVariables, LocalVariablesIntegrationOptions, LocalVariablesWorkerArgs } from './common'; -import { LOCAL_VARIABLES_KEY } from './common'; -import { functionNamesMatch } from './common'; +import { LOCAL_VARIABLES_KEY, functionNamesMatch } from './common'; // This string is a placeholder that gets overwritten with the worker code. export const base64WorkerScript = '###LocalVariablesWorkerScript###'; diff --git a/packages/node/src/integrations/local-variables/local-variables-sync.ts b/packages/node/src/integrations/local-variables/local-variables-sync.ts index 32ac146047b2..4de0fe8aa478 100644 --- a/packages/node/src/integrations/local-variables/local-variables-sync.ts +++ b/packages/node/src/integrations/local-variables/local-variables-sync.ts @@ -1,8 +1,6 @@ import type { Debugger, InspectorNotification, Runtime, Session } from 'node:inspector'; -import { defineIntegration, getClient } from '@sentry/core'; -import { LRUMap, logger } from '@sentry/core'; import type { Event, Exception, IntegrationFn, StackFrame, StackParser } from '@sentry/core'; - +import { LRUMap, defineIntegration, getClient, logger } from '@sentry/core'; import { NODE_MAJOR } from '../../nodeVersion'; import type { NodeClient } from '../../sdk/client'; import type { diff --git a/packages/node/src/integrations/modules.ts b/packages/node/src/integrations/modules.ts index 817190e7b4b3..f3c187589de1 100644 --- a/packages/node/src/integrations/modules.ts +++ b/packages/node/src/integrations/modules.ts @@ -1,8 +1,7 @@ import { existsSync, readFileSync } from 'node:fs'; import { dirname, join } from 'node:path'; -import { defineIntegration } from '@sentry/core'; -import { logger } from '@sentry/core'; import type { IntegrationFn } from '@sentry/core'; +import { defineIntegration, logger } from '@sentry/core'; import { DEBUG_BUILD } from '../debug-build'; import { isCjs } from '../utils/commonjs'; diff --git a/packages/node/src/integrations/node-fetch.ts b/packages/node/src/integrations/node-fetch.ts index 1dde23b18dcd..a4678be7239a 100644 --- a/packages/node/src/integrations/node-fetch.ts +++ b/packages/node/src/integrations/node-fetch.ts @@ -1,10 +1,19 @@ import { registerInstrumentations } from '@opentelemetry/instrumentation'; import type { UndiciRequest, UndiciResponse } from '@opentelemetry/instrumentation-undici'; import { UndiciInstrumentation } from '@opentelemetry/instrumentation-undici'; -import { LRUMap, getClient, getTraceData } from '@sentry/core'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, addBreadcrumb, defineIntegration, hasTracingEnabled } from '@sentry/core'; -import { getBreadcrumbLogLevelFromHttpStatusCode, getSanitizedUrlString, parseUrl } from '@sentry/core'; import type { IntegrationFn, SanitizedRequestData } from '@sentry/core'; +import { + LRUMap, + SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, + addBreadcrumb, + defineIntegration, + getBreadcrumbLogLevelFromHttpStatusCode, + getClient, + getSanitizedUrlString, + getTraceData, + hasTracingEnabled, + parseUrl, +} from '@sentry/core'; import { shouldPropagateTraceForUrl } from '@sentry/opentelemetry'; interface NodeFetchOptions { diff --git a/packages/node/src/integrations/onuncaughtexception.ts b/packages/node/src/integrations/onuncaughtexception.ts index d0e728119fc2..0634159338a6 100644 --- a/packages/node/src/integrations/onuncaughtexception.ts +++ b/packages/node/src/integrations/onuncaughtexception.ts @@ -1,7 +1,4 @@ -import { captureException, defineIntegration } from '@sentry/core'; -import { getClient } from '@sentry/core'; -import { logger } from '@sentry/core'; - +import { captureException, defineIntegration, getClient, logger } from '@sentry/core'; import { DEBUG_BUILD } from '../debug-build'; import type { NodeClient } from '../sdk/client'; import { logAndExitProcess } from '../utils/errorhandling'; diff --git a/packages/node/src/integrations/onunhandledrejection.ts b/packages/node/src/integrations/onunhandledrejection.ts index c18699d8374c..ecf89960cbd6 100644 --- a/packages/node/src/integrations/onunhandledrejection.ts +++ b/packages/node/src/integrations/onunhandledrejection.ts @@ -1,6 +1,5 @@ -import { captureException, defineIntegration, getClient } from '@sentry/core'; -import { consoleSandbox } from '@sentry/core'; import type { Client, IntegrationFn } from '@sentry/core'; +import { captureException, consoleSandbox, defineIntegration, getClient } from '@sentry/core'; import { logAndExitProcess } from '../utils/errorhandling'; type UnhandledRejectionMode = 'none' | 'warn' | 'strict'; diff --git a/packages/node/src/integrations/spotlight.ts b/packages/node/src/integrations/spotlight.ts index 629dc7f68409..49a169076798 100644 --- a/packages/node/src/integrations/spotlight.ts +++ b/packages/node/src/integrations/spotlight.ts @@ -1,7 +1,6 @@ import * as http from 'node:http'; -import { defineIntegration } from '@sentry/core'; -import { logger, serializeEnvelope } from '@sentry/core'; import type { Client, Envelope, IntegrationFn } from '@sentry/core'; +import { defineIntegration, logger, serializeEnvelope } from '@sentry/core'; type SpotlightConnectionOptions = { /** diff --git a/packages/node/src/integrations/tracing/amqplib.ts b/packages/node/src/integrations/tracing/amqplib.ts index e12f54f02c52..f6320406edaf 100644 --- a/packages/node/src/integrations/tracing/amqplib.ts +++ b/packages/node/src/integrations/tracing/amqplib.ts @@ -1,7 +1,7 @@ import type { Span } from '@opentelemetry/api'; import { AmqplibInstrumentation, type AmqplibInstrumentationConfig } from '@opentelemetry/instrumentation-amqplib'; -import { defineIntegration } from '@sentry/core'; import type { IntegrationFn } from '@sentry/core'; +import { defineIntegration } from '@sentry/core'; import { generateInstrumentOnce } from '../../otel/instrument'; import { addOriginToSpan } from '../../utils/addOriginToSpan'; diff --git a/packages/node/src/integrations/tracing/connect.ts b/packages/node/src/integrations/tracing/connect.ts index 0a97788352bb..30e12b245347 100644 --- a/packages/node/src/integrations/tracing/connect.ts +++ b/packages/node/src/integrations/tracing/connect.ts @@ -1,4 +1,5 @@ import { ConnectInstrumentation } from '@opentelemetry/instrumentation-connect'; +import type { IntegrationFn, Span } from '@sentry/core'; import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, @@ -7,7 +8,6 @@ import { getClient, spanToJSON, } from '@sentry/core'; -import type { IntegrationFn, Span } from '@sentry/core'; import { generateInstrumentOnce } from '../../otel/instrument'; import { ensureIsWrapped } from '../../utils/ensureIsWrapped'; diff --git a/packages/node/src/integrations/tracing/express.ts b/packages/node/src/integrations/tracing/express.ts index a9c66a9d0f2b..73312353da46 100644 --- a/packages/node/src/integrations/tracing/express.ts +++ b/packages/node/src/integrations/tracing/express.ts @@ -1,9 +1,16 @@ import type * as http from 'node:http'; import { ExpressInstrumentation } from '@opentelemetry/instrumentation-express'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, defineIntegration, getDefaultIsolationScope, spanToJSON } from '@sentry/core'; -import { captureException, getClient, getIsolationScope } from '@sentry/core'; -import { logger } from '@sentry/core'; import type { IntegrationFn } from '@sentry/core'; +import { + SEMANTIC_ATTRIBUTE_SENTRY_OP, + captureException, + defineIntegration, + getClient, + getDefaultIsolationScope, + getIsolationScope, + logger, + spanToJSON, +} from '@sentry/core'; import { DEBUG_BUILD } from '../../debug-build'; import { generateInstrumentOnce } from '../../otel/instrument'; import type { NodeClient } from '../../sdk/client'; diff --git a/packages/node/src/integrations/tracing/hapi/index.ts b/packages/node/src/integrations/tracing/hapi/index.ts index 7cd988bb334f..3fe5dd27c6d8 100644 --- a/packages/node/src/integrations/tracing/hapi/index.ts +++ b/packages/node/src/integrations/tracing/hapi/index.ts @@ -1,4 +1,5 @@ import { HapiInstrumentation } from '@opentelemetry/instrumentation-hapi'; +import type { IntegrationFn, Span } from '@sentry/core'; import { SDK_VERSION, SEMANTIC_ATTRIBUTE_SENTRY_OP, @@ -8,10 +9,9 @@ import { getClient, getDefaultIsolationScope, getIsolationScope, + logger, spanToJSON, } from '@sentry/core'; -import { logger } from '@sentry/core'; -import type { IntegrationFn, Span } from '@sentry/core'; import { DEBUG_BUILD } from '../../../debug-build'; import { generateInstrumentOnce } from '../../../otel/instrument'; import { ensureIsWrapped } from '../../../utils/ensureIsWrapped'; diff --git a/packages/node/src/integrations/tracing/kafka.ts b/packages/node/src/integrations/tracing/kafka.ts index f199487030c2..37d976f5d4e1 100644 --- a/packages/node/src/integrations/tracing/kafka.ts +++ b/packages/node/src/integrations/tracing/kafka.ts @@ -1,7 +1,6 @@ import { KafkaJsInstrumentation } from '@opentelemetry/instrumentation-kafkajs'; - -import { defineIntegration } from '@sentry/core'; import type { IntegrationFn } from '@sentry/core'; +import { defineIntegration } from '@sentry/core'; import { generateInstrumentOnce } from '../../otel/instrument'; import { addOriginToSpan } from '../../utils/addOriginToSpan'; diff --git a/packages/node/src/integrations/tracing/koa.ts b/packages/node/src/integrations/tracing/koa.ts index c97ba9e29183..469ab63a0d82 100644 --- a/packages/node/src/integrations/tracing/koa.ts +++ b/packages/node/src/integrations/tracing/koa.ts @@ -1,5 +1,6 @@ import { KoaInstrumentation } from '@opentelemetry/instrumentation-koa'; import { ATTR_HTTP_ROUTE } from '@opentelemetry/semantic-conventions'; +import type { IntegrationFn, Span } from '@sentry/core'; import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, @@ -7,10 +8,9 @@ import { defineIntegration, getDefaultIsolationScope, getIsolationScope, + logger, spanToJSON, } from '@sentry/core'; -import { logger } from '@sentry/core'; -import type { IntegrationFn, Span } from '@sentry/core'; import { DEBUG_BUILD } from '../../debug-build'; import { generateInstrumentOnce } from '../../otel/instrument'; import { ensureIsWrapped } from '../../utils/ensureIsWrapped'; diff --git a/packages/node/src/integrations/tracing/nest/helpers.ts b/packages/node/src/integrations/tracing/nest/helpers.ts index 464992549944..7e5e63db43e5 100644 --- a/packages/node/src/integrations/tracing/nest/helpers.ts +++ b/packages/node/src/integrations/tracing/nest/helpers.ts @@ -1,6 +1,10 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, withActiveSpan } from '@sentry/core'; -import { addNonEnumerableProperty } from '@sentry/core'; import type { Span } from '@sentry/core'; +import { + SEMANTIC_ATTRIBUTE_SENTRY_OP, + SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, + addNonEnumerableProperty, + withActiveSpan, +} from '@sentry/core'; import type { CatchTarget, InjectableTarget, NextFunction, Observable, Subscription } from './types'; const sentryPatched = 'sentryPatched'; diff --git a/packages/node/src/integrations/tracing/nest/nest.ts b/packages/node/src/integrations/tracing/nest/nest.ts index c886d9e319e9..1c63c22783aa 100644 --- a/packages/node/src/integrations/tracing/nest/nest.ts +++ b/packages/node/src/integrations/tracing/nest/nest.ts @@ -1,16 +1,17 @@ import { NestInstrumentation } from '@opentelemetry/instrumentation-nestjs-core'; +import type { Span } from '@sentry/core'; import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, captureException, + consoleSandbox, defineIntegration, getClient, getDefaultIsolationScope, getIsolationScope, + logger, spanToJSON, } from '@sentry/core'; -import { consoleSandbox, logger } from '@sentry/core'; -import type { Span } from '@sentry/core'; import { generateInstrumentOnce } from '../../../otel/instrument'; import { SentryNestEventInstrumentation } from './sentry-nest-event-instrumentation'; import { SentryNestInstrumentation } from './sentry-nest-instrumentation'; diff --git a/packages/node/src/integrations/tracing/nest/sentry-nest-event-instrumentation.ts b/packages/node/src/integrations/tracing/nest/sentry-nest-event-instrumentation.ts index 59dac31b8218..c9907945d1b5 100644 --- a/packages/node/src/integrations/tracing/nest/sentry-nest-event-instrumentation.ts +++ b/packages/node/src/integrations/tracing/nest/sentry-nest-event-instrumentation.ts @@ -5,8 +5,7 @@ import { InstrumentationNodeModuleDefinition, InstrumentationNodeModuleFile, } from '@opentelemetry/instrumentation'; -import { captureException, startSpan } from '@sentry/core'; -import { SDK_VERSION } from '@sentry/core'; +import { SDK_VERSION, captureException, startSpan } from '@sentry/core'; import { getEventSpanOptions } from './helpers'; import type { OnEventTarget } from './types'; diff --git a/packages/node/src/integrations/tracing/nest/sentry-nest-instrumentation.ts b/packages/node/src/integrations/tracing/nest/sentry-nest-instrumentation.ts index 1dc51dcf816c..91428a96c88d 100644 --- a/packages/node/src/integrations/tracing/nest/sentry-nest-instrumentation.ts +++ b/packages/node/src/integrations/tracing/nest/sentry-nest-instrumentation.ts @@ -5,9 +5,17 @@ import { InstrumentationNodeModuleDefinition, InstrumentationNodeModuleFile, } from '@opentelemetry/instrumentation'; -import { getActiveSpan, startInactiveSpan, startSpan, startSpanManual, withActiveSpan } from '@sentry/core'; -import { SDK_VERSION, addNonEnumerableProperty, isThenable } from '@sentry/core'; import type { Span } from '@sentry/core'; +import { + SDK_VERSION, + addNonEnumerableProperty, + getActiveSpan, + isThenable, + startInactiveSpan, + startSpan, + startSpanManual, + withActiveSpan, +} from '@sentry/core'; import { getMiddlewareSpanOptions, getNextProxy, instrumentObservable, isPatched } from './helpers'; import type { CallHandler, CatchTarget, InjectableTarget, MinimalNestJsExecutionContext, Observable } from './types'; diff --git a/packages/node/src/integrations/tracing/redis.ts b/packages/node/src/integrations/tracing/redis.ts index 524a209ece30..be788815c177 100644 --- a/packages/node/src/integrations/tracing/redis.ts +++ b/packages/node/src/integrations/tracing/redis.ts @@ -2,6 +2,7 @@ import type { Span } from '@opentelemetry/api'; import type { RedisResponseCustomAttributeFunction } from '@opentelemetry/instrumentation-ioredis'; import { IORedisInstrumentation } from '@opentelemetry/instrumentation-ioredis'; import { RedisInstrumentation } from '@opentelemetry/instrumentation-redis-4'; +import type { IntegrationFn } from '@sentry/core'; import { SEMANTIC_ATTRIBUTE_CACHE_HIT, SEMANTIC_ATTRIBUTE_CACHE_ITEM_SIZE, @@ -10,9 +11,8 @@ import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, defineIntegration, spanToJSON, + truncate, } from '@sentry/core'; -import { truncate } from '@sentry/core'; -import type { IntegrationFn } from '@sentry/core'; import { generateInstrumentOnce } from '../../otel/instrument'; import { GET_COMMANDS, diff --git a/packages/node/src/sdk/api.ts b/packages/node/src/sdk/api.ts index a293b303c20b..dd7ccc8ca75d 100644 --- a/packages/node/src/sdk/api.ts +++ b/packages/node/src/sdk/api.ts @@ -1,7 +1,7 @@ // PUBLIC APIS -import { GLOBAL_OBJ, createStackParser, nodeStackLineParser } from '@sentry/core'; import type { StackParser } from '@sentry/core'; +import { GLOBAL_OBJ, createStackParser, nodeStackLineParser } from '@sentry/core'; import { createGetModuleFromFilename } from '../utils/module'; /** diff --git a/packages/node/src/sdk/client.ts b/packages/node/src/sdk/client.ts index 50d130bdaac4..b51237a328ea 100644 --- a/packages/node/src/sdk/client.ts +++ b/packages/node/src/sdk/client.ts @@ -3,9 +3,8 @@ import type { Tracer } from '@opentelemetry/api'; import { trace } from '@opentelemetry/api'; import { registerInstrumentations } from '@opentelemetry/instrumentation'; import type { BasicTracerProvider } from '@opentelemetry/sdk-trace-base'; -import type { Scope, ServerRuntimeClientOptions } from '@sentry/core'; +import type { DynamicSamplingContext, Scope, ServerRuntimeClientOptions, TraceContext } from '@sentry/core'; import { SDK_VERSION, ServerRuntimeClient, applySdkMetadata, logger } from '@sentry/core'; -import type { DynamicSamplingContext, TraceContext } from '@sentry/core'; import { getTraceContextForScope } from '@sentry/opentelemetry'; import { isMainThread, threadId } from 'worker_threads'; import { DEBUG_BUILD } from '../debug-build'; diff --git a/packages/node/src/sdk/index.ts b/packages/node/src/sdk/index.ts index d27414b6daeb..1104386fb2ca 100644 --- a/packages/node/src/sdk/index.ts +++ b/packages/node/src/sdk/index.ts @@ -1,4 +1,7 @@ +import type { Integration, Options } from '@sentry/core'; import { + consoleSandbox, + dropUndefinedKeys, endSession, functionToStringIntegration, getClient, @@ -8,17 +11,12 @@ import { hasTracingEnabled, inboundFiltersIntegration, linkedErrorsIntegration, - requestDataIntegration, - startSession, -} from '@sentry/core'; -import { - consoleSandbox, - dropUndefinedKeys, logger, propagationContextFromHeaders, + requestDataIntegration, stackParserFromStackParserOptions, + startSession, } from '@sentry/core'; -import type { Integration, Options } from '@sentry/core'; import { enhanceDscWithOpenTelemetryRootSpanName, openTelemetrySetupCheck, @@ -26,11 +24,10 @@ import { setupEventContextTrace, } from '@sentry/opentelemetry'; import { DEBUG_BUILD } from '../debug-build'; +import { childProcessIntegration } from '../integrations/childProcess'; import { consoleIntegration } from '../integrations/console'; import { nodeContextIntegration } from '../integrations/context'; import { contextLinesIntegration } from '../integrations/contextlines'; - -import { childProcessIntegration } from '../integrations/childProcess'; import { httpIntegration } from '../integrations/http'; import { localVariablesIntegration } from '../integrations/local-variables'; import { modulesIntegration } from '../integrations/modules'; diff --git a/packages/node/src/sdk/initOtel.ts b/packages/node/src/sdk/initOtel.ts index b731ecd8a332..eb62cef6ac65 100644 --- a/packages/node/src/sdk/initOtel.ts +++ b/packages/node/src/sdk/initOtel.ts @@ -7,11 +7,9 @@ import { ATTR_SERVICE_VERSION, SEMRESATTRS_SERVICE_NAMESPACE, } from '@opentelemetry/semantic-conventions'; -import { SDK_VERSION } from '@sentry/core'; -import { GLOBAL_OBJ, consoleSandbox, logger } from '@sentry/core'; +import { GLOBAL_OBJ, SDK_VERSION, consoleSandbox, logger } from '@sentry/core'; import { SentryPropagator, SentrySampler, SentrySpanProcessor } from '@sentry/opentelemetry'; import { createAddHookMessageChannel } from 'import-in-the-middle'; - import { getOpenTelemetryInstrumentationToPreload } from '../integrations/tracing'; import { SentryContextManager } from '../otel/contextManager'; import type { EsmLoaderHookOptions } from '../types'; diff --git a/packages/node/src/transports/http.ts b/packages/node/src/transports/http.ts index 313e6496463d..39211c281d50 100644 --- a/packages/node/src/transports/http.ts +++ b/packages/node/src/transports/http.ts @@ -2,8 +2,6 @@ import * as http from 'node:http'; import * as https from 'node:https'; import { Readable } from 'node:stream'; import { createGzip } from 'node:zlib'; -import { createTransport, suppressTracing } from '@sentry/core'; -import { consoleSandbox } from '@sentry/core'; import type { BaseTransportOptions, Transport, @@ -11,6 +9,7 @@ import type { TransportRequest, TransportRequestExecutor, } from '@sentry/core'; +import { consoleSandbox, createTransport, suppressTracing } from '@sentry/core'; import { HttpsProxyAgent } from '../proxy'; import type { HTTPModule } from './http-module'; diff --git a/packages/node/src/utils/ensureIsWrapped.ts b/packages/node/src/utils/ensureIsWrapped.ts index 26bf8799fb42..0babb401d1f7 100644 --- a/packages/node/src/utils/ensureIsWrapped.ts +++ b/packages/node/src/utils/ensureIsWrapped.ts @@ -1,6 +1,5 @@ import { isWrapped } from '@opentelemetry/core'; -import { getClient, getGlobalScope, hasTracingEnabled, isEnabled } from '@sentry/core'; -import { consoleSandbox } from '@sentry/core'; +import { consoleSandbox, getClient, getGlobalScope, hasTracingEnabled, isEnabled } from '@sentry/core'; import type { NodeClient } from '../sdk/client'; import { isCjs } from './commonjs'; import { createMissingInstrumentationContext } from './createMissingInstrumentationContext'; diff --git a/packages/node/src/utils/errorhandling.ts b/packages/node/src/utils/errorhandling.ts index a6a255c53fd7..8eda429ba38e 100644 --- a/packages/node/src/utils/errorhandling.ts +++ b/packages/node/src/utils/errorhandling.ts @@ -1,5 +1,4 @@ -import { getClient } from '@sentry/core'; -import { consoleSandbox, logger } from '@sentry/core'; +import { consoleSandbox, getClient, logger } from '@sentry/core'; import { DEBUG_BUILD } from '../debug-build'; import type { NodeClient } from '../sdk/client'; diff --git a/packages/nuxt/src/client/piniaIntegration.ts b/packages/nuxt/src/client/piniaIntegration.ts index 33b02c1a85ec..b0a5936e9142 100644 --- a/packages/nuxt/src/client/piniaIntegration.ts +++ b/packages/nuxt/src/client/piniaIntegration.ts @@ -1,7 +1,5 @@ -import { defineIntegration } from '@sentry/core'; import type { IntegrationFn } from '@sentry/core'; - -import { consoleSandbox } from '@sentry/core'; +import { consoleSandbox, defineIntegration } from '@sentry/core'; import { createSentryPiniaPlugin } from '@sentry/vue'; const INTEGRATION_NAME = 'Pinia'; diff --git a/packages/nuxt/src/runtime/utils.ts b/packages/nuxt/src/runtime/utils.ts index 27a8ab11f202..3041ad58956c 100644 --- a/packages/nuxt/src/runtime/utils.ts +++ b/packages/nuxt/src/runtime/utils.ts @@ -1,6 +1,5 @@ -import { captureException, getClient, getTraceMetaTags } from '@sentry/core'; -import { dropUndefinedKeys } from '@sentry/core'; import type { ClientOptions, Context } from '@sentry/core'; +import { captureException, dropUndefinedKeys, getClient, getTraceMetaTags } from '@sentry/core'; import type { VueOptions } from '@sentry/vue/src/types'; import type { CapturedErrorContext } from 'nitropack'; import type { NuxtRenderHTMLContext } from 'nuxt/app'; diff --git a/packages/nuxt/src/server/sdk.ts b/packages/nuxt/src/server/sdk.ts index a543e3a81d4a..32d2b2bc6cac 100644 --- a/packages/nuxt/src/server/sdk.ts +++ b/packages/nuxt/src/server/sdk.ts @@ -1,7 +1,6 @@ import * as path from 'node:path'; -import { applySdkMetadata, flush, getGlobalScope } from '@sentry/core'; -import { logger, vercelWaitUntil } from '@sentry/core'; import type { Client, EventProcessor, Integration } from '@sentry/core'; +import { applySdkMetadata, flush, getGlobalScope, logger, vercelWaitUntil } from '@sentry/core'; import { type NodeOptions, getDefaultIntegrations as getDefaultNodeIntegrations, diff --git a/packages/opentelemetry/src/asyncContextStrategy.ts b/packages/opentelemetry/src/asyncContextStrategy.ts index 8b7b65e4ae23..cfc4254819d7 100644 --- a/packages/opentelemetry/src/asyncContextStrategy.ts +++ b/packages/opentelemetry/src/asyncContextStrategy.ts @@ -1,8 +1,6 @@ import * as api from '@opentelemetry/api'; +import type { Scope, withActiveSpan as defaultWithActiveSpan } from '@sentry/core'; import { getDefaultCurrentScope, getDefaultIsolationScope, setAsyncContextStrategy } from '@sentry/core'; -import type { withActiveSpan as defaultWithActiveSpan } from '@sentry/core'; -import type { Scope } from '@sentry/core'; - import { SENTRY_FORK_ISOLATION_SCOPE_CONTEXT_KEY, SENTRY_FORK_SET_ISOLATION_SCOPE_CONTEXT_KEY, diff --git a/packages/opentelemetry/src/custom/client.ts b/packages/opentelemetry/src/custom/client.ts index 223c22086848..18ec73825f7c 100644 --- a/packages/opentelemetry/src/custom/client.ts +++ b/packages/opentelemetry/src/custom/client.ts @@ -1,10 +1,8 @@ import type { Tracer } from '@opentelemetry/api'; import { trace } from '@opentelemetry/api'; import type { BasicTracerProvider } from '@opentelemetry/sdk-trace-base'; -import type { BaseClient } from '@sentry/core'; +import type { BaseClient, Client } from '@sentry/core'; import { SDK_VERSION } from '@sentry/core'; -import type { Client } from '@sentry/core'; - import type { OpenTelemetryClient as OpenTelemetryClientInterface } from '../types'; // Typescript complains if we do not use `...args: any[]` for the mixin, with: diff --git a/packages/opentelemetry/src/propagator.ts b/packages/opentelemetry/src/propagator.ts index 8d619a802f46..74f5452960df 100644 --- a/packages/opentelemetry/src/propagator.ts +++ b/packages/opentelemetry/src/propagator.ts @@ -1,27 +1,25 @@ import type { Baggage, Context, Span, SpanContext, TextMapGetter, TextMapSetter } from '@opentelemetry/api'; -import { TraceFlags } from '@opentelemetry/api'; -import { INVALID_TRACEID } from '@opentelemetry/api'; -import { context } from '@opentelemetry/api'; -import { propagation, trace } from '@opentelemetry/api'; +import { INVALID_TRACEID, TraceFlags, context, propagation, trace } from '@opentelemetry/api'; import { W3CBaggagePropagator, isTracingSuppressed } from '@opentelemetry/core'; import { ATTR_URL_FULL, SEMATTRS_HTTP_URL } from '@opentelemetry/semantic-conventions'; -import type { continueTrace } from '@sentry/core'; -import { getDynamicSamplingContextFromScope } from '@sentry/core'; -import { getRootSpan } from '@sentry/core'; -import { spanToJSON } from '@sentry/core'; -import { getClient, getCurrentScope, getDynamicSamplingContextFromSpan, getIsolationScope } from '@sentry/core'; +import type { DynamicSamplingContext, Options, PropagationContext, continueTrace } from '@sentry/core'; import { LRUMap, SENTRY_BAGGAGE_KEY_PREFIX, baggageHeaderToDynamicSamplingContext, generateSentryTraceHeader, + getClient, + getCurrentScope, + getDynamicSamplingContextFromScope, + getDynamicSamplingContextFromSpan, + getIsolationScope, + getRootSpan, logger, parseBaggageHeader, propagationContextFromHeaders, + spanToJSON, stringMatchesSomePattern, } from '@sentry/core'; -import type { DynamicSamplingContext, Options, PropagationContext } from '@sentry/core'; - import { SENTRY_BAGGAGE_HEADER, SENTRY_TRACE_HEADER, diff --git a/packages/opentelemetry/src/sampler.ts b/packages/opentelemetry/src/sampler.ts index d583addd451c..a561bb863561 100644 --- a/packages/opentelemetry/src/sampler.ts +++ b/packages/opentelemetry/src/sampler.ts @@ -1,25 +1,23 @@ import type { Attributes, Context, Span, TraceState as TraceStateInterface } from '@opentelemetry/api'; -import { SpanKind } from '@opentelemetry/api'; -import { isSpanContextValid, trace } from '@opentelemetry/api'; +import { SpanKind, isSpanContextValid, trace } from '@opentelemetry/api'; import { TraceState } from '@opentelemetry/core'; import type { Sampler, SamplingResult } from '@opentelemetry/sdk-trace-base'; import { SamplingDecision } from '@opentelemetry/sdk-trace-base'; +import { + ATTR_HTTP_REQUEST_METHOD, + ATTR_URL_FULL, + SEMATTRS_HTTP_METHOD, + SEMATTRS_HTTP_URL, +} from '@opentelemetry/semantic-conventions'; +import type { Client, SpanAttributes } from '@sentry/core'; import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, hasTracingEnabled, + logger, sampleSpan, } from '@sentry/core'; -import { logger } from '@sentry/core'; -import type { Client, SpanAttributes } from '@sentry/core'; import { SENTRY_TRACE_STATE_SAMPLED_NOT_RECORDING, SENTRY_TRACE_STATE_URL } from './constants'; - -import { - ATTR_HTTP_REQUEST_METHOD, - ATTR_URL_FULL, - SEMATTRS_HTTP_METHOD, - SEMATTRS_HTTP_URL, -} from '@opentelemetry/semantic-conventions'; import { DEBUG_BUILD } from './debug-build'; import { getPropagationContextFromSpan } from './propagator'; import { getSamplingDecision } from './utils/getSamplingDecision'; diff --git a/packages/opentelemetry/src/setupEventContextTrace.ts b/packages/opentelemetry/src/setupEventContextTrace.ts index b0c763c05960..43d4344a8ce7 100644 --- a/packages/opentelemetry/src/setupEventContextTrace.ts +++ b/packages/opentelemetry/src/setupEventContextTrace.ts @@ -1,6 +1,5 @@ -import { getDynamicSamplingContextFromSpan, getRootSpan } from '@sentry/core'; -import { dropUndefinedKeys } from '@sentry/core'; import type { Client } from '@sentry/core'; +import { dropUndefinedKeys, getDynamicSamplingContextFromSpan, getRootSpan } from '@sentry/core'; import { SENTRY_TRACE_STATE_PARENT_SPAN_ID } from './constants'; import { getActiveSpan } from './utils/getActiveSpan'; import { spanHasParentId } from './utils/spanTypes'; diff --git a/packages/opentelemetry/src/spanExporter.ts b/packages/opentelemetry/src/spanExporter.ts index 74e43de788e0..126efed460b6 100644 --- a/packages/opentelemetry/src/spanExporter.ts +++ b/packages/opentelemetry/src/spanExporter.ts @@ -2,31 +2,28 @@ import type { Span } from '@opentelemetry/api'; import { SpanKind } from '@opentelemetry/api'; import type { ReadableSpan } from '@opentelemetry/sdk-trace-base'; import { ATTR_HTTP_RESPONSE_STATUS_CODE, SEMATTRS_HTTP_STATUS_CODE } from '@opentelemetry/semantic-conventions'; -import { - captureEvent, - getCapturedScopesOnSpan, - getDynamicSamplingContextFromSpan, - getMetricSummaryJsonForSpan, - timedEventsToMeasurements, -} from '@sentry/core'; +import type { SpanJSON, SpanOrigin, TraceContext, TransactionEvent, TransactionSource } from '@sentry/core'; import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, + captureEvent, + dropUndefinedKeys, + getCapturedScopesOnSpan, + getDynamicSamplingContextFromSpan, + getMetricSummaryJsonForSpan, getStatusMessage, + logger, spanTimeInputToSeconds, + timedEventsToMeasurements, } from '@sentry/core'; -import { dropUndefinedKeys, logger } from '@sentry/core'; -import type { SpanJSON, SpanOrigin, TraceContext, TransactionEvent, TransactionSource } from '@sentry/core'; import { SENTRY_TRACE_STATE_PARENT_SPAN_ID } from './constants'; - import { DEBUG_BUILD } from './debug-build'; import { SEMANTIC_ATTRIBUTE_SENTRY_PARENT_IS_REMOTE } from './semanticAttributes'; import { getRequestSpanData } from './utils/getRequestSpanData'; import type { SpanNode } from './utils/groupSpansWithParents'; -import { getLocalParentId } from './utils/groupSpansWithParents'; -import { groupSpansWithParents } from './utils/groupSpansWithParents'; +import { getLocalParentId, groupSpansWithParents } from './utils/groupSpansWithParents'; import { mapStatus } from './utils/mapStatus'; import { parseSpanDescription } from './utils/parseSpanDescription'; diff --git a/packages/opentelemetry/src/trace.ts b/packages/opentelemetry/src/trace.ts index 5bd80986a277..1c1710b94793 100644 --- a/packages/opentelemetry/src/trace.ts +++ b/packages/opentelemetry/src/trace.ts @@ -1,6 +1,7 @@ import type { Context, Span, SpanContext, SpanOptions, Tracer } from '@opentelemetry/api'; import { INVALID_SPANID, SpanStatusCode, TraceFlags, context, trace } from '@opentelemetry/api'; import { suppressTracing } from '@opentelemetry/core'; +import type { Client, DynamicSamplingContext, Scope, Span as SentrySpan, TraceContext } from '@sentry/core'; import { SDK_VERSION, SEMANTIC_ATTRIBUTE_SENTRY_OP, @@ -15,9 +16,7 @@ import { spanToJSON, spanToTraceContext, } from '@sentry/core'; -import type { Client, DynamicSamplingContext, Scope, Span as SentrySpan, TraceContext } from '@sentry/core'; import { continueTraceAsRemoteSpan } from './propagator'; - import type { OpenTelemetryClient, OpenTelemetrySpanContext } from './types'; import { getContextFromScope, getScopesFromContext } from './utils/contextData'; import { getSamplingDecision } from './utils/getSamplingDecision'; diff --git a/packages/opentelemetry/src/utils/contextData.ts b/packages/opentelemetry/src/utils/contextData.ts index f7464793dbbe..389520ef5293 100644 --- a/packages/opentelemetry/src/utils/contextData.ts +++ b/packages/opentelemetry/src/utils/contextData.ts @@ -1,7 +1,6 @@ import type { Context } from '@opentelemetry/api'; -import { addNonEnumerableProperty } from '@sentry/core'; import type { Scope } from '@sentry/core'; - +import { addNonEnumerableProperty } from '@sentry/core'; import { SENTRY_SCOPES_CONTEXT_KEY } from '../constants'; import type { CurrentScopes } from '../types'; diff --git a/packages/opentelemetry/src/utils/parseSpanDescription.ts b/packages/opentelemetry/src/utils/parseSpanDescription.ts index 746261a6b9f6..a1aa47e5b6ce 100644 --- a/packages/opentelemetry/src/utils/parseSpanDescription.ts +++ b/packages/opentelemetry/src/utils/parseSpanDescription.ts @@ -13,10 +13,14 @@ import { SEMATTRS_MESSAGING_SYSTEM, SEMATTRS_RPC_SERVICE, } from '@opentelemetry/semantic-conventions'; -import { getSanitizedUrlString, parseUrl, stripUrlQueryAndFragment } from '@sentry/core'; import type { SpanAttributes, TransactionSource } from '@sentry/core'; - -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; +import { + SEMANTIC_ATTRIBUTE_SENTRY_OP, + SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, + getSanitizedUrlString, + parseUrl, + stripUrlQueryAndFragment, +} from '@sentry/core'; import { SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION } from '../semanticAttributes'; import type { AbstractSpan } from '../types'; import { getSpanKind } from './getSpanKind'; diff --git a/packages/profiling-node/src/integration.ts b/packages/profiling-node/src/integration.ts index bdba65607e5d..8aed8eb3a305 100644 --- a/packages/profiling-node/src/integration.ts +++ b/packages/profiling-node/src/integration.ts @@ -1,28 +1,28 @@ /* eslint-disable max-lines */ +import type { Event, IntegrationFn, Profile, ProfileChunk, ProfilingIntegration, Span } from '@sentry/core'; import { + LRUMap, + consoleSandbox, defineIntegration, getCurrentScope, getGlobalScope, getIsolationScope, getRootSpan, + logger, spanToJSON, + uuid4, } from '@sentry/core'; -import type { Event, IntegrationFn, Profile, ProfileChunk, ProfilingIntegration, Span } from '@sentry/core'; import type { NodeClient } from '@sentry/node'; - -import { LRUMap, consoleSandbox, logger, uuid4 } from '@sentry/core'; - import { CpuProfilerBindings } from './cpu_profiler'; import { DEBUG_BUILD } from './debug-build'; import { NODE_MAJOR, NODE_VERSION } from './nodeVersion'; import { MAX_PROFILE_DURATION_MS, maybeProfileSpan, stopSpanProfile } from './spanProfileUtils'; import type { RawThreadCpuProfile } from './types'; import { ProfileFormat } from './types'; -import { PROFILER_THREAD_NAME } from './utils'; - import { PROFILER_THREAD_ID_STRING, + PROFILER_THREAD_NAME, addProfilesToEnvelope, createProfilingChunkEvent, createProfilingEvent, diff --git a/packages/profiling-node/src/spanProfileUtils.ts b/packages/profiling-node/src/spanProfileUtils.ts index 3ab04f2a5f1b..39196578a9bc 100644 --- a/packages/profiling-node/src/spanProfileUtils.ts +++ b/packages/profiling-node/src/spanProfileUtils.ts @@ -1,8 +1,6 @@ -import { spanIsSampled, spanToJSON } from '@sentry/core'; -import { logger, uuid4 } from '@sentry/core'; import type { CustomSamplingContext, Span } from '@sentry/core'; +import { logger, spanIsSampled, spanToJSON, uuid4 } from '@sentry/core'; import type { NodeClient } from '@sentry/node'; - import { CpuProfilerBindings } from './cpu_profiler'; import { DEBUG_BUILD } from './debug-build'; import type { RawThreadCpuProfile } from './types'; diff --git a/packages/profiling-node/src/utils.ts b/packages/profiling-node/src/utils.ts index cb06658ba2d2..1c0828a5468c 100644 --- a/packages/profiling-node/src/utils.ts +++ b/packages/profiling-node/src/utils.ts @@ -1,13 +1,4 @@ -/* eslint-disable max-lines */ import * as os from 'os'; -import { - createEnvelope, - dsnToString, - forEachEnvelopeItem, - getDebugImagesForResources, - logger, - uuid4, -} from '@sentry/core'; import type { Client, Context, @@ -24,6 +15,14 @@ import type { SdkInfo, ThreadCpuProfile, } from '@sentry/core'; +import { + createEnvelope, + dsnToString, + forEachEnvelopeItem, + getDebugImagesForResources, + logger, + uuid4, +} from '@sentry/core'; import { env, versions } from 'process'; import { isMainThread, threadId } from 'worker_threads'; diff --git a/packages/react/src/profiler.tsx b/packages/react/src/profiler.tsx index ebcdf2237450..9804e497055a 100644 --- a/packages/react/src/profiler.tsx +++ b/packages/react/src/profiler.tsx @@ -1,7 +1,6 @@ import { startInactiveSpan } from '@sentry/browser'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, spanToJSON, withActiveSpan } from '@sentry/core'; -import { timestampInSeconds } from '@sentry/core'; import type { Span } from '@sentry/core'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, spanToJSON, timestampInSeconds, withActiveSpan } from '@sentry/core'; import hoistNonReactStatics from 'hoist-non-react-statics'; import * as React from 'react'; diff --git a/packages/react/src/reactrouterv6.tsx b/packages/react/src/reactrouterv6.tsx index f913612c99c7..81afc2933861 100644 --- a/packages/react/src/reactrouterv6.tsx +++ b/packages/react/src/reactrouterv6.tsx @@ -1,4 +1,5 @@ import type { browserTracingIntegration } from '@sentry/browser'; +import type { Integration } from '@sentry/core'; import type { ReactRouterOptions } from './reactrouterv6-compat-utils'; import { createReactRouterV6CompatibleTracingIntegration, @@ -6,8 +7,6 @@ import { createV6CompatibleWrapCreateBrowserRouter, createV6CompatibleWrapUseRoutes, } from './reactrouterv6-compat-utils'; - -import type { Integration } from '@sentry/core'; import type { CreateRouterFunction, Router, RouterState, UseRoutes } from './types'; /** diff --git a/packages/react/src/reactrouterv7.tsx b/packages/react/src/reactrouterv7.tsx index 2703a47d5428..df2badd35e44 100644 --- a/packages/react/src/reactrouterv7.tsx +++ b/packages/react/src/reactrouterv7.tsx @@ -1,6 +1,5 @@ // React Router v7 uses the same integration as v6 import type { browserTracingIntegration } from '@sentry/browser'; - import type { Integration } from '@sentry/core'; import type { ReactRouterOptions } from './reactrouterv6-compat-utils'; import { diff --git a/packages/react/src/redux.ts b/packages/react/src/redux.ts index bd69897b14ad..47830b384a15 100644 --- a/packages/react/src/redux.ts +++ b/packages/react/src/redux.ts @@ -1,7 +1,6 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ -import { addBreadcrumb, getClient, getCurrentScope, getGlobalScope } from '@sentry/core'; -import { addNonEnumerableProperty } from '@sentry/core'; import type { Scope } from '@sentry/core'; +import { addBreadcrumb, addNonEnumerableProperty, getClient, getCurrentScope, getGlobalScope } from '@sentry/core'; interface Action { type: T; diff --git a/packages/react/src/tanstackrouter.ts b/packages/react/src/tanstackrouter.ts index 2ddc3c9fa280..48c4ccb56888 100644 --- a/packages/react/src/tanstackrouter.ts +++ b/packages/react/src/tanstackrouter.ts @@ -1,12 +1,15 @@ -import { WINDOW, startBrowserTracingNavigationSpan, startBrowserTracingPageLoadSpan } from '@sentry/browser'; +import { + WINDOW, + browserTracingIntegration as originalBrowserTracingIntegration, + startBrowserTracingNavigationSpan, + startBrowserTracingPageLoadSpan, +} from '@sentry/browser'; +import type { Integration } from '@sentry/core'; import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, } from '@sentry/core'; - -import { browserTracingIntegration as originalBrowserTracingIntegration } from '@sentry/browser'; -import type { Integration } from '@sentry/core'; import type { VendoredTanstackRouter, VendoredTanstackRouterRouteMatch } from './vendor/tanstackrouter-types'; /** diff --git a/packages/remix/src/client/errors.tsx b/packages/remix/src/client/errors.tsx index 8aa5e2e85dfb..6005ba2cb480 100644 --- a/packages/remix/src/client/errors.tsx +++ b/packages/remix/src/client/errors.tsx @@ -1,6 +1,4 @@ -import { captureException } from '@sentry/core'; -import { isNodeEnv } from '@sentry/core'; - +import { captureException, isNodeEnv } from '@sentry/core'; import { isResponse } from '../utils/vendor/response'; /** diff --git a/packages/remix/src/client/performance.tsx b/packages/remix/src/client/performance.tsx index c2b7cfc329f2..c9518cdf5352 100644 --- a/packages/remix/src/client/performance.tsx +++ b/packages/remix/src/client/performance.tsx @@ -1,14 +1,18 @@ +import type { Client, StartSpanOptions } from '@sentry/core'; import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, getActiveSpan, getCurrentScope, getRootSpan, + isNodeEnv, + logger, } from '@sentry/core'; -import { isNodeEnv, logger } from '@sentry/core'; -import type { Client, StartSpanOptions } from '@sentry/core'; -import type { browserTracingIntegration as originalBrowserTracingIntegration } from '@sentry/react'; -import type { BrowserClient, ErrorBoundaryProps } from '@sentry/react'; +import type { + BrowserClient, + ErrorBoundaryProps, + browserTracingIntegration as originalBrowserTracingIntegration, +} from '@sentry/react'; import { WINDOW, getClient, @@ -17,7 +21,6 @@ import { withErrorBoundary, } from '@sentry/react'; import * as React from 'react'; - import { DEBUG_BUILD } from '../utils/debug-build'; import { getFutureFlagsBrowser, readRemixVersionFromLoader } from '../utils/futureFlags'; diff --git a/packages/remix/src/index.client.tsx b/packages/remix/src/index.client.tsx index 691365069c0c..846366c1d73c 100644 --- a/packages/remix/src/index.client.tsx +++ b/packages/remix/src/index.client.tsx @@ -1,13 +1,15 @@ -import { applySdkMetadata } from '@sentry/core'; -import { logger } from '@sentry/core'; +/* eslint-enable @typescript-eslint/no-unused-vars */ + import type { Client } from '@sentry/core'; +import { applySdkMetadata, logger } from '@sentry/core'; import { init as reactInit } from '@sentry/react'; import { DEBUG_BUILD } from './utils/debug-build'; import type { RemixOptions } from './utils/remixOptions'; -export { captureRemixErrorBoundaryError } from './client/errors'; -export { withSentry } from './client/performance'; export { browserTracingIntegration } from './client/browserTracingIntegration'; +export { captureRemixErrorBoundaryError } from './client/errors'; +export { withSentry } from './client/performance'; +export * from '@sentry/react'; // This is a no-op function that does nothing. It's here to make sure that the // function signature is the same as in the server SDK. @@ -25,9 +27,6 @@ export async function captureRemixServerException( 'This function is a no-op in the browser environment.', ); } -/* eslint-enable @typescript-eslint/no-unused-vars */ - -export * from '@sentry/react'; export function init(options: RemixOptions): Client | undefined { const opts = { diff --git a/packages/remix/src/index.server.ts b/packages/remix/src/index.server.ts index 1a9f56c5cdc9..a92d1d94ca08 100644 --- a/packages/remix/src/index.server.ts +++ b/packages/remix/src/index.server.ts @@ -1,5 +1,4 @@ -import { applySdkMetadata } from '@sentry/core'; -import { logger } from '@sentry/core'; +import { applySdkMetadata, logger } from '@sentry/core'; import type { Integration } from '@sentry/core'; import type { NodeClient, NodeOptions } from '@sentry/node'; import { getDefaultIntegrations as getDefaultNodeIntegrations, init as nodeInit, isInitialized } from '@sentry/node'; diff --git a/packages/remix/src/utils/instrumentServer.ts b/packages/remix/src/utils/instrumentServer.ts index 8f104b6108a1..797c295b0abf 100644 --- a/packages/remix/src/utils/instrumentServer.ts +++ b/packages/remix/src/utils/instrumentServer.ts @@ -1,24 +1,25 @@ /* eslint-disable max-lines */ +import type { RequestEventData, Span, TransactionSource, WrappedFunction } from '@sentry/core'; import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, + fill, getActiveSpan, getClient, getRootSpan, getTraceData, hasTracingEnabled, + isNodeEnv, + loadModule, + logger, setHttpStatus, spanToJSON, startSpan, winterCGRequestToRequestData, withIsolationScope, } from '@sentry/core'; -import { fill, isNodeEnv, loadModule, logger } from '@sentry/core'; -import type { RequestEventData, TransactionSource, WrappedFunction } from '@sentry/core'; -import type { Span } from '@sentry/core'; import { continueTrace } from '@sentry/opentelemetry'; - import { DEBUG_BUILD } from './debug-build'; import { captureRemixServerException, errorHandleDataFunction, errorHandleDocumentRequestFunction } from './errors'; import { getFutureFlagsServer, getRemixVersionFromBuild } from './futureFlags'; diff --git a/packages/replay-internal/src/coreHandlers/handleBreadcrumbs.ts b/packages/replay-internal/src/coreHandlers/handleBreadcrumbs.ts index 3dd661870c7f..f029fe0854fd 100644 --- a/packages/replay-internal/src/coreHandlers/handleBreadcrumbs.ts +++ b/packages/replay-internal/src/coreHandlers/handleBreadcrumbs.ts @@ -1,7 +1,5 @@ -import { getClient } from '@sentry/core'; -import { normalize } from '@sentry/core'; import type { Breadcrumb } from '@sentry/core'; - +import { getClient, normalize } from '@sentry/core'; import { CONSOLE_ARG_MAX_SIZE } from '../constants'; import type { ReplayContainer } from '../types'; import type { ReplayFrame } from '../types/replayFrame'; diff --git a/packages/replay-internal/src/integration.ts b/packages/replay-internal/src/integration.ts index c637c19c3f61..bd152f9bba48 100644 --- a/packages/replay-internal/src/integration.ts +++ b/packages/replay-internal/src/integration.ts @@ -1,7 +1,5 @@ -import { parseSampleRate } from '@sentry/core'; -import { consoleSandbox, dropUndefinedKeys, isBrowser } from '@sentry/core'; import type { BrowserClientReplayOptions, Client, Integration, IntegrationFn, ReplayRecordingMode } from '@sentry/core'; - +import { consoleSandbox, dropUndefinedKeys, isBrowser, parseSampleRate } from '@sentry/core'; import { DEFAULT_FLUSH_MAX_DELAY, DEFAULT_FLUSH_MIN_DELAY, diff --git a/packages/replay-internal/src/replay.ts b/packages/replay-internal/src/replay.ts index cb476ad5349d..f3169106d458 100644 --- a/packages/replay-internal/src/replay.ts +++ b/packages/replay-internal/src/replay.ts @@ -1,9 +1,7 @@ /* eslint-disable max-lines */ // TODO: We might want to split this file up import { EventType, record } from '@sentry-internal/rrweb'; -import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, getActiveSpan, getClient, getRootSpan, spanToJSON } from '@sentry/core'; import type { ReplayRecordingMode, Span } from '@sentry/core'; -import { logger } from './util/logger'; - +import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, getActiveSpan, getClient, getRootSpan, spanToJSON } from '@sentry/core'; import { BUFFER_CHECKOUT_TIME, SESSION_IDLE_EXPIRE_DURATION, @@ -21,7 +19,6 @@ import { clearSession } from './session/clearSession'; import { loadOrCreateSession } from './session/loadOrCreateSession'; import { saveSession } from './session/saveSession'; import { shouldRefreshSession } from './session/shouldRefreshSession'; - import type { AddEventResult, AddUpdateCallback, @@ -53,6 +50,7 @@ import { debounce } from './util/debounce'; import { getHandleRecordingEmit } from './util/handleRecordingEmit'; import { isExpired } from './util/isExpired'; import { isSessionExpired } from './util/isSessionExpired'; +import { logger } from './util/logger'; import { resetReplayIdOnDynamicSamplingContext } from './util/resetReplayIdOnDynamicSamplingContext'; import { sendReplay } from './util/sendReplay'; import { RateLimitError } from './util/sendReplayRequest'; diff --git a/packages/replay-internal/src/util/logger.ts b/packages/replay-internal/src/util/logger.ts index d8442973d8df..4ee45c44309c 100644 --- a/packages/replay-internal/src/util/logger.ts +++ b/packages/replay-internal/src/util/logger.ts @@ -1,7 +1,5 @@ -import { addBreadcrumb, captureException } from '@sentry/core'; -import { logger as coreLogger, severityLevelFromString } from '@sentry/core'; import type { ConsoleLevel, SeverityLevel } from '@sentry/core'; - +import { addBreadcrumb, captureException, logger as coreLogger, severityLevelFromString } from '@sentry/core'; import { DEBUG_BUILD } from '../debug-build'; type ReplayConsoleLevels = Extract; diff --git a/packages/replay-internal/src/util/sendReplayRequest.ts b/packages/replay-internal/src/util/sendReplayRequest.ts index 457e3b254a55..5ab25228b486 100644 --- a/packages/replay-internal/src/util/sendReplayRequest.ts +++ b/packages/replay-internal/src/util/sendReplayRequest.ts @@ -1,9 +1,5 @@ -import { getClient, getCurrentScope } from '@sentry/core'; -import type { RateLimits } from '@sentry/core'; -import { resolvedSyncPromise } from '@sentry/core'; -import { isRateLimited, updateRateLimits } from '@sentry/core'; -import type { ReplayEvent, TransportMakeRequestResponse } from '@sentry/core'; - +import type { RateLimits, ReplayEvent, TransportMakeRequestResponse } from '@sentry/core'; +import { getClient, getCurrentScope, isRateLimited, resolvedSyncPromise, updateRateLimits } from '@sentry/core'; import { REPLAY_EVENT_NAME, UNABLE_TO_SEND_REPLAY } from '../constants'; import { DEBUG_BUILD } from '../debug-build'; import type { SendReplayData } from '../types'; diff --git a/packages/svelte/src/sdk.ts b/packages/svelte/src/sdk.ts index 61fbd3ecf612..1d21b72ef59d 100644 --- a/packages/svelte/src/sdk.ts +++ b/packages/svelte/src/sdk.ts @@ -1,8 +1,7 @@ import type { BrowserOptions } from '@sentry/browser'; import { addEventProcessor, init as browserInit } from '@sentry/browser'; -import { applySdkMetadata } from '@sentry/core'; -import { getDomElement } from '@sentry/core'; import type { Client, EventProcessor } from '@sentry/core'; +import { applySdkMetadata, getDomElement } from '@sentry/core'; /** * Inits the Svelte SDK */ diff --git a/packages/sveltekit/src/client/browserTracingIntegration.ts b/packages/sveltekit/src/client/browserTracingIntegration.ts index ccfb416db5b9..800911118ec3 100644 --- a/packages/sveltekit/src/client/browserTracingIntegration.ts +++ b/packages/sveltekit/src/client/browserTracingIntegration.ts @@ -1,7 +1,6 @@ import { navigating, page } from '$app/stores'; -import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core'; -import { dropUndefinedKeys } from '@sentry/core'; import type { Client, Integration, Span } from '@sentry/core'; +import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, dropUndefinedKeys } from '@sentry/core'; import { WINDOW, browserTracingIntegration as originalBrowserTracingIntegration, diff --git a/packages/sveltekit/src/server/handle.ts b/packages/sveltekit/src/server/handle.ts index b06efc7c5991..19a0c2507da5 100644 --- a/packages/sveltekit/src/server/handle.ts +++ b/packages/sveltekit/src/server/handle.ts @@ -1,3 +1,4 @@ +import type { Span } from '@sentry/core'; import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, @@ -6,12 +7,12 @@ import { getDefaultIsolationScope, getIsolationScope, getTraceMetaTags, + logger, setHttpStatus, + startSpan, + winterCGRequestToRequestData, withIsolationScope, } from '@sentry/core'; -import { startSpan } from '@sentry/core'; -import { logger, winterCGRequestToRequestData } from '@sentry/core'; -import type { Span } from '@sentry/core'; import { continueTrace } from '@sentry/node'; import type { Handle, ResolveOptions } from '@sveltejs/kit'; diff --git a/packages/sveltekit/src/server/rewriteFramesIntegration.ts b/packages/sveltekit/src/server/rewriteFramesIntegration.ts index 8754e77c5dd4..44afbca2d6df 100644 --- a/packages/sveltekit/src/server/rewriteFramesIntegration.ts +++ b/packages/sveltekit/src/server/rewriteFramesIntegration.ts @@ -1,6 +1,12 @@ -import { defineIntegration, rewriteFramesIntegration as originalRewriteFramesIntegration } from '@sentry/core'; -import { GLOBAL_OBJ, basename, escapeStringForRegex, join } from '@sentry/core'; import type { IntegrationFn, StackFrame } from '@sentry/core'; +import { + GLOBAL_OBJ, + basename, + defineIntegration, + escapeStringForRegex, + join, + rewriteFramesIntegration as originalRewriteFramesIntegration, +} from '@sentry/core'; import { WRAPPED_MODULE_SUFFIX } from '../vite/autoInstrument'; import type { GlobalWithSentryValues } from '../vite/injectGlobalValues'; diff --git a/packages/vercel-edge/src/integrations/wintercg-fetch.ts b/packages/vercel-edge/src/integrations/wintercg-fetch.ts index db6848fa0c2e..da9e044945e2 100644 --- a/packages/vercel-edge/src/integrations/wintercg-fetch.ts +++ b/packages/vercel-edge/src/integrations/wintercg-fetch.ts @@ -1,10 +1,3 @@ -import { addBreadcrumb, defineIntegration, getClient, instrumentFetchRequest, isSentryRequestUrl } from '@sentry/core'; -import { - LRUMap, - addFetchInstrumentationHandler, - getBreadcrumbLogLevelFromHttpStatusCode, - stringMatchesSomePattern, -} from '@sentry/core'; import type { Client, FetchBreadcrumbData, @@ -13,6 +6,17 @@ import type { IntegrationFn, Span, } from '@sentry/core'; +import { + LRUMap, + addBreadcrumb, + addFetchInstrumentationHandler, + defineIntegration, + getBreadcrumbLogLevelFromHttpStatusCode, + getClient, + instrumentFetchRequest, + isSentryRequestUrl, + stringMatchesSomePattern, +} from '@sentry/core'; const INTEGRATION_NAME = 'WinterCGFetch'; diff --git a/packages/vercel-edge/src/sdk.ts b/packages/vercel-edge/src/sdk.ts index f62da1d8f705..2ddfa96fcd45 100644 --- a/packages/vercel-edge/src/sdk.ts +++ b/packages/vercel-edge/src/sdk.ts @@ -1,4 +1,16 @@ +import { DiagLogLevel, diag } from '@opentelemetry/api'; +import { Resource } from '@opentelemetry/resources'; +import { BasicTracerProvider } from '@opentelemetry/sdk-trace-base'; import { + ATTR_SERVICE_NAME, + ATTR_SERVICE_VERSION, + SEMRESATTRS_SERVICE_NAMESPACE, +} from '@opentelemetry/semantic-conventions'; +import type { Client, Integration, Options } from '@sentry/core'; +import { + GLOBAL_OBJ, + SDK_VERSION, + createStackParser, dedupeIntegration, functionToStringIntegration, getCurrentScope, @@ -6,26 +18,11 @@ import { hasTracingEnabled, inboundFiltersIntegration, linkedErrorsIntegration, - requestDataIntegration, -} from '@sentry/core'; -import { - GLOBAL_OBJ, - SDK_VERSION, - createStackParser, logger, nodeStackLineParser, + requestDataIntegration, stackParserFromStackParserOptions, } from '@sentry/core'; -import type { Client, Integration, Options } from '@sentry/core'; - -import { DiagLogLevel, diag } from '@opentelemetry/api'; -import { Resource } from '@opentelemetry/resources'; -import { BasicTracerProvider } from '@opentelemetry/sdk-trace-base'; -import { - ATTR_SERVICE_NAME, - ATTR_SERVICE_VERSION, - SEMRESATTRS_SERVICE_NAMESPACE, -} from '@opentelemetry/semantic-conventions'; import { SentryPropagator, SentrySampler, diff --git a/packages/vercel-edge/src/transports/index.ts b/packages/vercel-edge/src/transports/index.ts index f0b861b1882b..e938477b3003 100644 --- a/packages/vercel-edge/src/transports/index.ts +++ b/packages/vercel-edge/src/transports/index.ts @@ -1,6 +1,5 @@ -import { createTransport, suppressTracing } from '@sentry/core'; -import { SentryError } from '@sentry/core'; import type { BaseTransportOptions, Transport, TransportMakeRequestResponse, TransportRequest } from '@sentry/core'; +import { SentryError, createTransport, suppressTracing } from '@sentry/core'; export interface VercelEdgeTransportOptions extends BaseTransportOptions { /** Fetch API init parameters. */ diff --git a/packages/vue/src/errorhandler.ts b/packages/vue/src/errorhandler.ts index 95ca6ce483c0..6a3951cc1855 100644 --- a/packages/vue/src/errorhandler.ts +++ b/packages/vue/src/errorhandler.ts @@ -1,6 +1,4 @@ -import { captureException } from '@sentry/core'; -import { consoleSandbox } from '@sentry/core'; - +import { captureException, consoleSandbox } from '@sentry/core'; import type { ViewModel, Vue, VueOptions } from './types'; import { formatComponentName, generateComponentTrace } from './vendor/components'; diff --git a/packages/vue/src/pinia.ts b/packages/vue/src/pinia.ts index 56e38c33bad7..031f0f5f110b 100644 --- a/packages/vue/src/pinia.ts +++ b/packages/vue/src/pinia.ts @@ -1,5 +1,4 @@ -import { addBreadcrumb, getClient, getCurrentScope, getGlobalScope } from '@sentry/core'; -import { addNonEnumerableProperty } from '@sentry/core'; +import { addBreadcrumb, addNonEnumerableProperty, getClient, getCurrentScope, getGlobalScope } from '@sentry/core'; // Inline PiniaPlugin type type PiniaPlugin = (context: {