From f5ca50fdb6bc544f210d6db62496eb671c0b914a Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Wed, 18 Jun 2025 12:00:46 +0200 Subject: [PATCH 1/5] move vendor --- packages/core/src/index.ts | 2 +- packages/core/src/utils-hoist/string.ts | 2 +- .../core/src/{utils-hoist => }/vendor/escapeStringForRegex.ts | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename packages/core/src/{utils-hoist => }/vendor/escapeStringForRegex.ts (100%) diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index fdbcd8bffbef..07916ab917a9 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -282,7 +282,7 @@ export { generateTraceId, generateSpanId } from './utils-hoist/propagationContex export { vercelWaitUntil } from './utils-hoist/vercelWaitUntil'; export { SDK_VERSION } from './utils-hoist/version'; export { getDebugImagesForResources, getFilenameToDebugIdMap } from './utils-hoist/debug-ids'; -export { escapeStringForRegex } from './utils-hoist/vendor/escapeStringForRegex'; +export { escapeStringForRegex } from './vendor/escapeStringForRegex'; export type { Attachment } from './types-hoist/attachment'; export type { diff --git a/packages/core/src/utils-hoist/string.ts b/packages/core/src/utils-hoist/string.ts index 4771023fa2f5..ab98c794f681 100644 --- a/packages/core/src/utils-hoist/string.ts +++ b/packages/core/src/utils-hoist/string.ts @@ -1,6 +1,6 @@ import { isRegExp, isString, isVueViewModel } from './is'; -export { escapeStringForRegex } from './vendor/escapeStringForRegex'; +export { escapeStringForRegex } from '../vendor/escapeStringForRegex'; /** * Truncates given string to the maximum characters count diff --git a/packages/core/src/utils-hoist/vendor/escapeStringForRegex.ts b/packages/core/src/vendor/escapeStringForRegex.ts similarity index 100% rename from packages/core/src/utils-hoist/vendor/escapeStringForRegex.ts rename to packages/core/src/vendor/escapeStringForRegex.ts From 5b39f1ca7c64e7ff8c8f1776cd69c1d159c00b41 Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Wed, 18 Jun 2025 12:02:19 +0200 Subject: [PATCH 2/5] move instrument --- packages/core/src/index.ts | 10 +++++----- .../src/{utils-hoist => }/instrument/console.ts | 8 ++++---- .../core/src/{utils-hoist => }/instrument/fetch.ts | 14 +++++++------- .../{utils-hoist => }/instrument/globalError.ts | 4 ++-- .../instrument/globalUnhandledRejection.ts | 4 ++-- .../src/{utils-hoist => }/instrument/handlers.ts | 6 +++--- packages/core/src/integrations/captureconsole.ts | 2 +- packages/core/src/integrations/console.ts | 2 +- packages/core/src/logs/console-integration.ts | 2 +- packages/core/src/tracing/errors.ts | 4 ++-- .../test/{utils-hoist => lib}/instrument.test.ts | 2 +- 11 files changed, 29 insertions(+), 29 deletions(-) rename packages/core/src/{utils-hoist => }/instrument/console.ts (82%) rename packages/core/src/{utils-hoist => }/instrument/fetch.ts (95%) rename packages/core/src/{utils-hoist => }/instrument/globalError.ts (91%) rename packages/core/src/{utils-hoist => }/instrument/globalUnhandledRejection.ts (91%) rename packages/core/src/{utils-hoist => }/instrument/handlers.ts (92%) rename packages/core/test/{utils-hoist => lib}/instrument.test.ts (81%) diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 07916ab917a9..c67f1d6603da 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -141,16 +141,16 @@ export { dsnFromString, dsnToString, makeDsn } from './utils-hoist/dsn'; export { SentryError } from './utils-hoist/error'; export { GLOBAL_OBJ } from './utils-hoist/worldwide'; export type { InternalGlobal } from './utils-hoist/worldwide'; -export { addConsoleInstrumentationHandler } from './utils-hoist/instrument/console'; -export { addFetchEndInstrumentationHandler, addFetchInstrumentationHandler } from './utils-hoist/instrument/fetch'; -export { addGlobalErrorInstrumentationHandler } from './utils-hoist/instrument/globalError'; -export { addGlobalUnhandledRejectionInstrumentationHandler } from './utils-hoist/instrument/globalUnhandledRejection'; +export { addConsoleInstrumentationHandler } from './instrument/console'; +export { addFetchEndInstrumentationHandler, addFetchInstrumentationHandler } from './instrument/fetch'; +export { addGlobalErrorInstrumentationHandler } from './instrument/globalError'; +export { addGlobalUnhandledRejectionInstrumentationHandler } from './instrument/globalUnhandledRejection'; export { addHandler, maybeInstrument, resetInstrumentationHandlers, triggerHandlers, -} from './utils-hoist/instrument/handlers'; +} from './instrument/handlers'; export { isDOMError, isDOMException, diff --git a/packages/core/src/utils-hoist/instrument/console.ts b/packages/core/src/instrument/console.ts similarity index 82% rename from packages/core/src/utils-hoist/instrument/console.ts rename to packages/core/src/instrument/console.ts index 90fad9fbde43..7c2326b1795b 100644 --- a/packages/core/src/utils-hoist/instrument/console.ts +++ b/packages/core/src/instrument/console.ts @@ -1,9 +1,9 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/ban-types */ -import type { ConsoleLevel, HandlerDataConsole } from '../../types-hoist/instrument'; -import { CONSOLE_LEVELS, originalConsoleMethods } from '../logger'; -import { fill } from '../object'; -import { GLOBAL_OBJ } from '../worldwide'; +import type { ConsoleLevel, HandlerDataConsole } from '../types-hoist/instrument'; +import { CONSOLE_LEVELS, originalConsoleMethods } from '../utils-hoist/logger'; +import { fill } from '../utils-hoist/object'; +import { GLOBAL_OBJ } from '../utils-hoist/worldwide'; import { addHandler, maybeInstrument, triggerHandlers } from './handlers'; /** diff --git a/packages/core/src/utils-hoist/instrument/fetch.ts b/packages/core/src/instrument/fetch.ts similarity index 95% rename from packages/core/src/utils-hoist/instrument/fetch.ts rename to packages/core/src/instrument/fetch.ts index 270219f80efb..ff4cee9d6669 100644 --- a/packages/core/src/utils-hoist/instrument/fetch.ts +++ b/packages/core/src/instrument/fetch.ts @@ -1,11 +1,11 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ -import type { HandlerDataFetch } from '../../types-hoist/instrument'; -import type { WebFetchHeaders } from '../../types-hoist/webfetchapi'; -import { isError, isRequest } from '../is'; -import { addNonEnumerableProperty, fill } from '../object'; -import { supportsNativeFetch } from '../supports'; -import { timestampInSeconds } from '../time'; -import { GLOBAL_OBJ } from '../worldwide'; +import type { HandlerDataFetch } from '../types-hoist/instrument'; +import type { WebFetchHeaders } from '../types-hoist/webfetchapi'; +import { isError, isRequest } from '../utils-hoist/is'; +import { addNonEnumerableProperty, fill } from '../utils-hoist/object'; +import { supportsNativeFetch } from '../utils-hoist/supports'; +import { timestampInSeconds } from '../utils-hoist/time'; +import { GLOBAL_OBJ } from '../utils-hoist/worldwide'; import { addHandler, maybeInstrument, triggerHandlers } from './handlers'; type FetchResource = string | { toString(): string } | { url: string }; diff --git a/packages/core/src/utils-hoist/instrument/globalError.ts b/packages/core/src/instrument/globalError.ts similarity index 91% rename from packages/core/src/utils-hoist/instrument/globalError.ts rename to packages/core/src/instrument/globalError.ts index 6f4f23cb65b7..a31e10bf7b12 100644 --- a/packages/core/src/utils-hoist/instrument/globalError.ts +++ b/packages/core/src/instrument/globalError.ts @@ -1,5 +1,5 @@ -import type { HandlerDataError } from '../../types-hoist/instrument'; -import { GLOBAL_OBJ } from '../worldwide'; +import type { HandlerDataError } from '../types-hoist/instrument'; +import { GLOBAL_OBJ } from '../utils-hoist/worldwide'; import { addHandler, maybeInstrument, triggerHandlers } from './handlers'; let _oldOnErrorHandler: (typeof GLOBAL_OBJ)['onerror'] | null = null; diff --git a/packages/core/src/utils-hoist/instrument/globalUnhandledRejection.ts b/packages/core/src/instrument/globalUnhandledRejection.ts similarity index 91% rename from packages/core/src/utils-hoist/instrument/globalUnhandledRejection.ts rename to packages/core/src/instrument/globalUnhandledRejection.ts index bbf43c949394..37995ec1fd5d 100644 --- a/packages/core/src/utils-hoist/instrument/globalUnhandledRejection.ts +++ b/packages/core/src/instrument/globalUnhandledRejection.ts @@ -1,5 +1,5 @@ -import type { HandlerDataUnhandledRejection } from '../../types-hoist/instrument'; -import { GLOBAL_OBJ } from '../worldwide'; +import type { HandlerDataUnhandledRejection } from '../types-hoist/instrument'; +import { GLOBAL_OBJ } from '../utils-hoist/worldwide'; import { addHandler, maybeInstrument, triggerHandlers } from './handlers'; let _oldOnUnhandledRejectionHandler: (typeof GLOBAL_OBJ)['onunhandledrejection'] | null = null; diff --git a/packages/core/src/utils-hoist/instrument/handlers.ts b/packages/core/src/instrument/handlers.ts similarity index 92% rename from packages/core/src/utils-hoist/instrument/handlers.ts rename to packages/core/src/instrument/handlers.ts index 9d6222662912..b7cd0cb905de 100644 --- a/packages/core/src/utils-hoist/instrument/handlers.ts +++ b/packages/core/src/instrument/handlers.ts @@ -1,6 +1,6 @@ -import { DEBUG_BUILD } from '../../debug-build'; -import { logger } from '../logger'; -import { getFunctionName } from '../stacktrace'; +import { DEBUG_BUILD } from '../debug-build'; +import { logger } from '../utils-hoist/logger'; +import { getFunctionName } from '../utils-hoist/stacktrace'; export type InstrumentHandlerType = | 'console' diff --git a/packages/core/src/integrations/captureconsole.ts b/packages/core/src/integrations/captureconsole.ts index e5dc43200dfe..c6e4c0d062dc 100644 --- a/packages/core/src/integrations/captureconsole.ts +++ b/packages/core/src/integrations/captureconsole.ts @@ -3,7 +3,7 @@ import { captureException, captureMessage } from '../exports'; import { defineIntegration } from '../integration'; import type { CaptureContext } from '../scope'; import type { IntegrationFn } from '../types-hoist/integration'; -import { addConsoleInstrumentationHandler } from '../utils-hoist/instrument/console'; +import { addConsoleInstrumentationHandler } from '../instrument/console'; import { CONSOLE_LEVELS } from '../utils-hoist/logger'; import { addExceptionMechanism } from '../utils-hoist/misc'; import { severityLevelFromString } from '../utils-hoist/severity'; diff --git a/packages/core/src/integrations/console.ts b/packages/core/src/integrations/console.ts index e995056a1f23..6e2da3c5691c 100644 --- a/packages/core/src/integrations/console.ts +++ b/packages/core/src/integrations/console.ts @@ -2,7 +2,7 @@ import { addBreadcrumb } from '../breadcrumbs'; import { getClient } from '../currentScopes'; import { defineIntegration } from '../integration'; import type { ConsoleLevel } from '../types-hoist/instrument'; -import { addConsoleInstrumentationHandler } from '../utils-hoist/instrument/console'; +import { addConsoleInstrumentationHandler } from '../instrument/console'; import { CONSOLE_LEVELS } from '../utils-hoist/logger'; import { severityLevelFromString } from '../utils-hoist/severity'; import { safeJoin } from '../utils-hoist/string'; diff --git a/packages/core/src/logs/console-integration.ts b/packages/core/src/logs/console-integration.ts index 9d64439e1786..d5c048d2bbfc 100644 --- a/packages/core/src/logs/console-integration.ts +++ b/packages/core/src/logs/console-integration.ts @@ -4,7 +4,7 @@ import { defineIntegration } from '../integration'; import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '../semanticAttributes'; import type { ConsoleLevel } from '../types-hoist/instrument'; import type { IntegrationFn } from '../types-hoist/integration'; -import { addConsoleInstrumentationHandler } from '../utils-hoist/instrument/console'; +import { addConsoleInstrumentationHandler } from '../instrument/console'; import { CONSOLE_LEVELS, logger } from '../utils-hoist/logger'; import { safeJoin } from '../utils-hoist/string'; import { GLOBAL_OBJ } from '../utils-hoist/worldwide'; diff --git a/packages/core/src/tracing/errors.ts b/packages/core/src/tracing/errors.ts index 34d2696da52d..6aaf81bdb2de 100644 --- a/packages/core/src/tracing/errors.ts +++ b/packages/core/src/tracing/errors.ts @@ -1,7 +1,7 @@ import { DEBUG_BUILD } from '../debug-build'; import { getActiveSpan, getRootSpan } from '../utils/spanUtils'; -import { addGlobalErrorInstrumentationHandler } from '../utils-hoist/instrument/globalError'; -import { addGlobalUnhandledRejectionInstrumentationHandler } from '../utils-hoist/instrument/globalUnhandledRejection'; +import { addGlobalErrorInstrumentationHandler } from '../instrument/globalError'; +import { addGlobalUnhandledRejectionInstrumentationHandler } from '../instrument/globalUnhandledRejection'; import { logger } from '../utils-hoist/logger'; import { SPAN_STATUS_ERROR } from './spanstatus'; diff --git a/packages/core/test/utils-hoist/instrument.test.ts b/packages/core/test/lib/instrument.test.ts similarity index 81% rename from packages/core/test/utils-hoist/instrument.test.ts rename to packages/core/test/lib/instrument.test.ts index b6917994c96b..458506517d01 100644 --- a/packages/core/test/utils-hoist/instrument.test.ts +++ b/packages/core/test/lib/instrument.test.ts @@ -1,5 +1,5 @@ import { describe, test } from 'vitest'; -import { maybeInstrument } from '../../src/utils-hoist/instrument/handlers'; +import { maybeInstrument } from '../../src/instrument/handlers'; describe('maybeInstrument', () => { test('does not throw when instrumenting fails', () => { From 72db80eb5fa61f55307955a72ae76912deae896c Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Wed, 18 Jun 2025 12:10:13 +0200 Subject: [PATCH 3/5] move utils-hoist to utils --- packages/core/.eslintrc.js | 2 +- packages/core/src/api.ts | 2 +- .../core/src/asyncContext/stackStrategy.ts | 2 +- packages/core/src/breadcrumbs.ts | 4 +- packages/core/src/carrier.ts | 6 +- packages/core/src/checkin.ts | 4 +- packages/core/src/client.ts | 14 ++-- packages/core/src/currentScopes.ts | 2 +- packages/core/src/envelope.ts | 8 +- packages/core/src/eventProcessors.ts | 6 +- packages/core/src/exports.ts | 10 +-- packages/core/src/fetch.ts | 6 +- packages/core/src/index.ts | 82 +++++++++---------- packages/core/src/instrument/console.ts | 6 +- packages/core/src/instrument/fetch.ts | 10 +-- packages/core/src/instrument/globalError.ts | 2 +- .../instrument/globalUnhandledRejection.ts | 2 +- packages/core/src/instrument/handlers.ts | 4 +- packages/core/src/integration.ts | 2 +- .../core/src/integrations/captureconsole.ts | 12 +-- packages/core/src/integrations/console.ts | 10 +-- packages/core/src/integrations/dedupe.ts | 4 +- .../core/src/integrations/eventFilters.ts | 6 +- .../core/src/integrations/extraerrordata.ts | 10 +-- .../core/src/integrations/functiontostring.ts | 2 +- .../core/src/integrations/linkederrors.ts | 4 +- packages/core/src/integrations/metadata.ts | 2 +- .../core/src/integrations/rewriteframes.ts | 4 +- packages/core/src/integrations/supabase.ts | 4 +- .../integrations/third-party-errors-filter.ts | 4 +- packages/core/src/integrations/zoderrors.ts | 4 +- packages/core/src/logs/console-integration.ts | 8 +- packages/core/src/logs/envelope.ts | 4 +- packages/core/src/logs/exports.ts | 8 +- packages/core/src/mcp-server.ts | 2 +- packages/core/src/metadata.ts | 2 +- packages/core/src/profiling.ts | 2 +- packages/core/src/scope.ts | 12 +-- packages/core/src/sdk.ts | 2 +- packages/core/src/server-runtime-client.ts | 10 +-- packages/core/src/session.ts | 4 +- .../src/tracing/dynamicSamplingContext.ts | 10 +-- packages/core/src/tracing/errors.ts | 4 +- packages/core/src/tracing/idleSpan.ts | 4 +- packages/core/src/tracing/logSpans.ts | 2 +- packages/core/src/tracing/measurement.ts | 2 +- packages/core/src/tracing/sampling.ts | 2 +- .../src/tracing/sentryNonRecordingSpan.ts | 2 +- packages/core/src/tracing/sentrySpan.ts | 6 +- packages/core/src/tracing/trace.ts | 6 +- packages/core/src/tracing/utils.ts | 2 +- packages/core/src/transports/base.ts | 10 +-- packages/core/src/transports/multiplexed.ts | 4 +- packages/core/src/transports/offline.ts | 6 +- packages/core/src/trpc.ts | 4 +- .../aggregate-errors.ts | 0 .../core/src/{utils-hoist => utils}/anr.ts | 0 .../src/{utils-hoist => utils}/baggage.ts | 2 +- .../breadcrumb-log-level.ts | 0 .../src/{utils-hoist => utils}/browser.ts | 0 .../{utils-hoist => utils}/clientreport.ts | 0 .../src/{utils-hoist => utils}/debug-ids.ts | 0 .../core/src/{utils-hoist => utils}/dsn.ts | 2 +- .../core/src/{utils-hoist => utils}/env.ts | 0 .../src/{utils-hoist => utils}/envelope.ts | 0 .../core/src/{utils-hoist => utils}/error.ts | 0 .../{utils-hoist => utils}/eventbuilder.ts | 0 packages/core/src/utils/featureFlags.ts | 4 +- .../core/src/utils/handleCallbackErrors.ts | 2 +- .../core/src/{utils-hoist => utils}/is.ts | 0 .../src/{utils-hoist => utils}/isBrowser.ts | 0 .../core/src/{utils-hoist => utils}/logger.ts | 2 +- .../core/src/{utils-hoist => utils}/lru.ts | 0 .../core/src/{utils-hoist => utils}/misc.ts | 0 .../node-stack-trace.ts | 0 .../core/src/{utils-hoist => utils}/node.ts | 0 .../src/{utils-hoist => utils}/normalize.ts | 0 .../core/src/{utils-hoist => utils}/object.ts | 2 +- .../core/src/{utils-hoist => utils}/path.ts | 0 packages/core/src/utils/prepareEvent.ts | 10 +-- .../{utils-hoist => utils}/promisebuffer.ts | 0 .../propagationContext.ts | 0 .../src/{utils-hoist => utils}/ratelimit.ts | 0 packages/core/src/utils/sdkMetadata.ts | 2 +- .../src/{utils-hoist => utils}/severity.ts | 0 packages/core/src/utils/spanOnScope.ts | 2 +- packages/core/src/utils/spanUtils.ts | 10 +-- .../src/{utils-hoist => utils}/stacktrace.ts | 0 .../core/src/{utils-hoist => utils}/string.ts | 0 .../src/{utils-hoist => utils}/supports.ts | 2 +- .../src/{utils-hoist => utils}/syncpromise.ts | 0 .../core/src/{utils-hoist => utils}/time.ts | 0 packages/core/src/utils/traceData.ts | 6 +- .../src/{utils-hoist => utils}/tracing.ts | 2 +- .../core/src/{utils-hoist => utils}/url.ts | 0 .../{utils-hoist => utils}/vercelWaitUntil.ts | 0 .../src/{utils-hoist => utils}/version.ts | 0 .../src/{utils-hoist => utils}/worldwide.ts | 0 packages/core/test/clear-global-scope.ts | 0 packages/core/test/lib/api.test.ts | 2 +- packages/core/test/lib/attachments.test.ts | 2 +- packages/core/test/lib/carrier.test.ts | 2 +- packages/core/test/lib/clear-global-scope.ts | 7 -- packages/core/test/lib/client.test.ts | 10 +-- .../instrument/fetch.test.ts | 2 +- .../handlers.test.ts} | 2 +- packages/core/test/lib/integration.test.ts | 2 +- .../lib/integrations/captureconsole.test.ts | 8 +- .../third-party-errors-filter.test.ts | 6 +- packages/core/test/lib/logs/envelope.test.ts | 10 +-- packages/core/test/lib/logs/exports.test.ts | 2 +- packages/core/test/lib/metadata.test.ts | 6 +- packages/core/test/lib/prepareEvent.test.ts | 2 +- packages/core/test/lib/scope.test.ts | 2 +- packages/core/test/lib/session.test.ts | 2 +- packages/core/test/lib/tracing/errors.test.ts | 4 +- .../core/test/lib/tracing/sentrySpan.test.ts | 2 +- .../core/test/lib/transports/base.test.ts | 6 +- .../utils}/aggregate-errors.test.ts | 12 +-- .../utils}/baggage.test.ts | 2 +- .../utils}/breadcrumb-log-level.test.ts | 2 +- .../utils}/browser.test.ts | 2 +- .../utils}/clientreport.test.ts | 6 +- .../{utils-hoist => lib/utils}/dsn.test.ts | 6 +- .../utils}/envelope.test.ts | 14 ++-- .../utils}/eventbuilder.test.ts | 8 +- .../core/test/lib/utils/featureFlags.test.ts | 2 +- .../{utils-hoist => lib/utils}/is.test.ts | 8 +- .../{utils-hoist => lib/utils}/lru.test.ts | 2 +- .../{utils-hoist => lib/utils}/misc.test.ts | 8 +- .../utils}/normalize-url.test.ts | 2 +- .../utils}/normalize.test.ts | 6 +- .../{utils-hoist => lib/utils}/object.test.ts | 6 +- .../{utils-hoist => lib/utils}/path.test.ts | 2 +- .../utils}/promisebuffer.test.ts | 4 +- .../utils}/ratelimit.test.ts | 4 +- .../utils}/severity.test.ts | 2 +- .../utils}/stacktrace.test.ts | 4 +- .../{utils-hoist => lib/utils}/string.test.ts | 2 +- .../utils}/supports.test.ts | 2 +- .../utils}/syncpromise.test.ts | 2 +- .../utils}/tracing.test.ts | 2 +- .../{utils-hoist => lib/utils}/url.test.ts | 2 +- .../utils}/vercelWaitUntil.test.ts | 4 +- .../utils}/worldwide.test.ts | 2 +- packages/core/test/mocks/client.ts | 2 +- packages/core/test/mocks/transport.ts | 2 +- .../core/test/{utils-hoist => }/testutils.ts | 7 ++ .../{utils-hoist => }/types/typedef.test.ts | 0 149 files changed, 307 insertions(+), 307 deletions(-) rename packages/core/src/{utils-hoist => utils}/aggregate-errors.ts (100%) rename packages/core/src/{utils-hoist => utils}/anr.ts (100%) rename packages/core/src/{utils-hoist => utils}/baggage.ts (99%) rename packages/core/src/{utils-hoist => utils}/breadcrumb-log-level.ts (100%) rename packages/core/src/{utils-hoist => utils}/browser.ts (100%) rename packages/core/src/{utils-hoist => utils}/clientreport.ts (100%) rename packages/core/src/{utils-hoist => utils}/debug-ids.ts (100%) rename packages/core/src/{utils-hoist => utils}/dsn.ts (98%) rename packages/core/src/{utils-hoist => utils}/env.ts (100%) rename packages/core/src/{utils-hoist => utils}/envelope.ts (100%) rename packages/core/src/{utils-hoist => utils}/error.ts (100%) rename packages/core/src/{utils-hoist => utils}/eventbuilder.ts (100%) rename packages/core/src/{utils-hoist => utils}/is.ts (100%) rename packages/core/src/{utils-hoist => utils}/isBrowser.ts (100%) rename packages/core/src/{utils-hoist => utils}/logger.ts (98%) rename packages/core/src/{utils-hoist => utils}/lru.ts (100%) rename packages/core/src/{utils-hoist => utils}/misc.ts (100%) rename packages/core/src/{utils-hoist => utils}/node-stack-trace.ts (100%) rename packages/core/src/{utils-hoist => utils}/node.ts (100%) rename packages/core/src/{utils-hoist => utils}/normalize.ts (100%) rename packages/core/src/{utils-hoist => utils}/object.ts (99%) rename packages/core/src/{utils-hoist => utils}/path.ts (100%) rename packages/core/src/{utils-hoist => utils}/promisebuffer.ts (100%) rename packages/core/src/{utils-hoist => utils}/propagationContext.ts (100%) rename packages/core/src/{utils-hoist => utils}/ratelimit.ts (100%) rename packages/core/src/{utils-hoist => utils}/severity.ts (100%) rename packages/core/src/{utils-hoist => utils}/stacktrace.ts (100%) rename packages/core/src/{utils-hoist => utils}/string.ts (100%) rename packages/core/src/{utils-hoist => utils}/supports.ts (98%) rename packages/core/src/{utils-hoist => utils}/syncpromise.ts (100%) rename packages/core/src/{utils-hoist => utils}/time.ts (100%) rename packages/core/src/{utils-hoist => utils}/tracing.ts (98%) rename packages/core/src/{utils-hoist => utils}/url.ts (100%) rename packages/core/src/{utils-hoist => utils}/vercelWaitUntil.ts (100%) rename packages/core/src/{utils-hoist => utils}/version.ts (100%) rename packages/core/src/{utils-hoist => utils}/worldwide.ts (100%) create mode 100644 packages/core/test/clear-global-scope.ts delete mode 100644 packages/core/test/lib/clear-global-scope.ts rename packages/core/test/{utils-hoist => lib}/instrument/fetch.test.ts (93%) rename packages/core/test/lib/{instrument.test.ts => instrument/handlers.test.ts} (83%) rename packages/core/test/{utils-hoist => lib/utils}/aggregate-errors.test.ts (95%) rename packages/core/test/{utils-hoist => lib/utils}/baggage.test.ts (98%) rename packages/core/test/{utils-hoist => lib/utils}/breadcrumb-log-level.test.ts (82%) rename packages/core/test/{utils-hoist => lib/utils}/browser.test.ts (97%) rename packages/core/test/{utils-hoist => lib/utils}/clientreport.test.ts (88%) rename packages/core/test/{utils-hoist => lib/utils}/dsn.test.ts (98%) rename packages/core/test/{utils-hoist => lib/utils}/envelope.test.ts (94%) rename packages/core/test/{utils-hoist => lib/utils}/eventbuilder.test.ts (96%) rename packages/core/test/{utils-hoist => lib/utils}/is.test.ts (95%) rename packages/core/test/{utils-hoist => lib/utils}/lru.test.ts (94%) rename packages/core/test/{utils-hoist => lib/utils}/misc.test.ts (97%) rename packages/core/test/{utils-hoist => lib/utils}/normalize-url.test.ts (97%) rename packages/core/test/{utils-hoist => lib/utils}/normalize.test.ts (99%) rename packages/core/test/{utils-hoist => lib/utils}/object.test.ts (98%) rename packages/core/test/{utils-hoist => lib/utils}/path.test.ts (95%) rename packages/core/test/{utils-hoist => lib/utils}/promisebuffer.test.ts (96%) rename packages/core/test/{utils-hoist => lib/utils}/ratelimit.test.ts (98%) rename packages/core/test/{utils-hoist => lib/utils}/severity.test.ts (87%) rename packages/core/test/{utils-hoist => lib/utils}/stacktrace.test.ts (98%) rename packages/core/test/{utils-hoist => lib/utils}/string.test.ts (99%) rename packages/core/test/{utils-hoist => lib/utils}/supports.test.ts (93%) rename packages/core/test/{utils-hoist => lib/utils}/syncpromise.test.ts (99%) rename packages/core/test/{utils-hoist => lib/utils}/tracing.test.ts (99%) rename packages/core/test/{utils-hoist => lib/utils}/url.test.ts (99%) rename packages/core/test/{utils-hoist => lib/utils}/vercelWaitUntil.test.ts (90%) rename packages/core/test/{utils-hoist => lib/utils}/worldwide.test.ts (85%) rename packages/core/test/{utils-hoist => }/testutils.ts (64%) rename packages/core/test/{utils-hoist => }/types/typedef.test.ts (100%) diff --git a/packages/core/.eslintrc.js b/packages/core/.eslintrc.js index 5c0b9f20f693..5a021c016763 100644 --- a/packages/core/.eslintrc.js +++ b/packages/core/.eslintrc.js @@ -1,4 +1,4 @@ module.exports = { extends: ['../../.eslintrc.js'], - ignorePatterns: ['rollup.npm.config.mjs', 'test/utils-hoist/buildPolyfills/originals.js'], + ignorePatterns: ['rollup.npm.config.mjs'], }; diff --git a/packages/core/src/api.ts b/packages/core/src/api.ts index 9a83e0667476..924c6a8e28ad 100644 --- a/packages/core/src/api.ts +++ b/packages/core/src/api.ts @@ -1,7 +1,7 @@ import type { ReportDialogOptions } from './report-dialog'; import type { DsnComponents, DsnLike } from './types-hoist/dsn'; import type { SdkInfo } from './types-hoist/sdkinfo'; -import { dsnToString, makeDsn } from './utils-hoist/dsn'; +import { dsnToString, makeDsn } from './utils/dsn'; const SENTRY_API_VERSION = '7'; diff --git a/packages/core/src/asyncContext/stackStrategy.ts b/packages/core/src/asyncContext/stackStrategy.ts index cb0bf878b39c..845605be731d 100644 --- a/packages/core/src/asyncContext/stackStrategy.ts +++ b/packages/core/src/asyncContext/stackStrategy.ts @@ -1,7 +1,7 @@ import type { Client } from '../client'; import { getDefaultCurrentScope, getDefaultIsolationScope } from '../defaultScopes'; import { Scope } from '../scope'; -import { isThenable } from '../utils-hoist/is'; +import { isThenable } from '../utils/is'; import { getMainCarrier, getSentryCarrier } from './../carrier'; import type { AsyncContextStrategy } from './types'; diff --git a/packages/core/src/breadcrumbs.ts b/packages/core/src/breadcrumbs.ts index 5724de09be0a..78157a40e2e3 100644 --- a/packages/core/src/breadcrumbs.ts +++ b/packages/core/src/breadcrumbs.ts @@ -1,7 +1,7 @@ import { getClient, getIsolationScope } from './currentScopes'; import type { Breadcrumb, BreadcrumbHint } from './types-hoist/breadcrumb'; -import { consoleSandbox } from './utils-hoist/logger'; -import { dateTimestampInSeconds } from './utils-hoist/time'; +import { consoleSandbox } from './utils/logger'; +import { dateTimestampInSeconds } from './utils/time'; /** * Default maximum number of breadcrumbs added to an event. Can be overwritten diff --git a/packages/core/src/carrier.ts b/packages/core/src/carrier.ts index 5136121cb8ae..d11ef2940d0c 100644 --- a/packages/core/src/carrier.ts +++ b/packages/core/src/carrier.ts @@ -1,9 +1,9 @@ import type { AsyncContextStack } from './asyncContext/stackStrategy'; import type { AsyncContextStrategy } from './asyncContext/types'; import type { Scope } from './scope'; -import type { Logger } from './utils-hoist/logger'; -import { SDK_VERSION } from './utils-hoist/version'; -import { GLOBAL_OBJ } from './utils-hoist/worldwide'; +import type { Logger } from './utils/logger'; +import { SDK_VERSION } from './utils/version'; +import { GLOBAL_OBJ } from './utils/worldwide'; /** * An object that contains globally accessible properties and maintains a scope stack. diff --git a/packages/core/src/checkin.ts b/packages/core/src/checkin.ts index 424dfb2badda..7037c9ebadb2 100644 --- a/packages/core/src/checkin.ts +++ b/packages/core/src/checkin.ts @@ -2,8 +2,8 @@ import type { SerializedCheckIn } from './types-hoist/checkin'; import type { DsnComponents } from './types-hoist/dsn'; import type { CheckInEnvelope, CheckInItem, DynamicSamplingContext } from './types-hoist/envelope'; import type { SdkMetadata } from './types-hoist/sdkmetadata'; -import { dsnToString } from './utils-hoist/dsn'; -import { createEnvelope } from './utils-hoist/envelope'; +import { dsnToString } from './utils/dsn'; +import { createEnvelope } from './utils/envelope'; /** * Create envelope from check in item. diff --git a/packages/core/src/client.ts b/packages/core/src/client.ts index d9abd8f5d0d2..3dd8bd66d023 100644 --- a/packages/core/src/client.ts +++ b/packages/core/src/client.ts @@ -32,19 +32,19 @@ import type { SeverityLevel } from './types-hoist/severity'; import type { Span, SpanAttributes, SpanContextData, SpanJSON } from './types-hoist/span'; import type { StartSpanOptions } from './types-hoist/startSpanOptions'; import type { Transport, TransportMakeRequestResponse } from './types-hoist/transport'; +import { createClientReportEnvelope } from './utils/clientreport'; +import { dsnToString, makeDsn } from './utils/dsn'; +import { addItemToEnvelope, createAttachmentEnvelopeItem } from './utils/envelope'; import { getPossibleEventMessages } from './utils/eventUtils'; +import { isParameterizedString, isPlainObject, isPrimitive, isThenable } from './utils/is'; +import { logger } from './utils/logger'; import { merge } from './utils/merge'; +import { checkOrSetAlreadyCaught, uuid4 } from './utils/misc'; import { parseSampleRate } from './utils/parseSampleRate'; import { prepareEvent } from './utils/prepareEvent'; import { getActiveSpan, showSpanDropWarning, spanToTraceContext } from './utils/spanUtils'; +import { rejectedSyncPromise, resolvedSyncPromise, SyncPromise } from './utils/syncpromise'; import { convertSpanJsonToTransactionEvent, convertTransactionEventToSpanJson } from './utils/transactionEvent'; -import { createClientReportEnvelope } from './utils-hoist/clientreport'; -import { dsnToString, makeDsn } from './utils-hoist/dsn'; -import { addItemToEnvelope, createAttachmentEnvelopeItem } from './utils-hoist/envelope'; -import { isParameterizedString, isPlainObject, isPrimitive, isThenable } from './utils-hoist/is'; -import { logger } from './utils-hoist/logger'; -import { checkOrSetAlreadyCaught, uuid4 } from './utils-hoist/misc'; -import { rejectedSyncPromise, resolvedSyncPromise, SyncPromise } from './utils-hoist/syncpromise'; const ALREADY_SEEN_ERROR = "Not capturing exception because it's already been captured."; const MISSING_RELEASE_FOR_SESSION_ERROR = 'Discarded session because of missing or non-string release'; diff --git a/packages/core/src/currentScopes.ts b/packages/core/src/currentScopes.ts index b8d719098e49..fc40051e56d8 100644 --- a/packages/core/src/currentScopes.ts +++ b/packages/core/src/currentScopes.ts @@ -3,7 +3,7 @@ import { getGlobalSingleton, getMainCarrier } from './carrier'; import type { Client } from './client'; import { Scope } from './scope'; import type { TraceContext } from './types-hoist/context'; -import { generateSpanId } from './utils-hoist/propagationContext'; +import { generateSpanId } from './utils/propagationContext'; /** * Get the currently active scope. diff --git a/packages/core/src/envelope.ts b/packages/core/src/envelope.ts index efec02eb7323..dc094d218812 100644 --- a/packages/core/src/envelope.ts +++ b/packages/core/src/envelope.ts @@ -18,15 +18,15 @@ import type { Event } from './types-hoist/event'; import type { SdkInfo } from './types-hoist/sdkinfo'; import type { SdkMetadata } from './types-hoist/sdkmetadata'; import type { Session, SessionAggregates } from './types-hoist/session'; -import { showSpanDropWarning, spanToJSON } from './utils/spanUtils'; -import { dsnToString } from './utils-hoist/dsn'; +import { dsnToString } from './utils/dsn'; import { createEnvelope, createEventEnvelopeHeaders, createSpanEnvelopeItem, getSdkMetadataForEnvelopeHeader, -} from './utils-hoist/envelope'; -import { uuid4 } from './utils-hoist/misc'; +} from './utils/envelope'; +import { uuid4 } from './utils/misc'; +import { showSpanDropWarning, spanToJSON } from './utils/spanUtils'; /** * Apply SdkInfo (name, version, packages, integrations) to the corresponding event key. diff --git a/packages/core/src/eventProcessors.ts b/packages/core/src/eventProcessors.ts index d2405a90032b..436f3e3c79ed 100644 --- a/packages/core/src/eventProcessors.ts +++ b/packages/core/src/eventProcessors.ts @@ -1,9 +1,9 @@ import { DEBUG_BUILD } from './debug-build'; import type { Event, EventHint } from './types-hoist/event'; import type { EventProcessor } from './types-hoist/eventprocessor'; -import { isThenable } from './utils-hoist/is'; -import { logger } from './utils-hoist/logger'; -import { SyncPromise } from './utils-hoist/syncpromise'; +import { isThenable } from './utils/is'; +import { logger } from './utils/logger'; +import { SyncPromise } from './utils/syncpromise'; /** * Process an array of event processors, returning the processed event (or `null` if the event was dropped). diff --git a/packages/core/src/exports.ts b/packages/core/src/exports.ts index d7e678b16edd..92e4d09d4d81 100644 --- a/packages/core/src/exports.ts +++ b/packages/core/src/exports.ts @@ -10,13 +10,13 @@ import type { Primitive } from './types-hoist/misc'; import type { Session, SessionContext } from './types-hoist/session'; import type { SeverityLevel } from './types-hoist/severity'; import type { User } from './types-hoist/user'; +import { isThenable } from './utils/is'; +import { logger } from './utils/logger'; +import { uuid4 } from './utils/misc'; import type { ExclusiveEventHintOrCaptureContext } from './utils/prepareEvent'; import { parseEventHintOrCaptureContext } from './utils/prepareEvent'; -import { isThenable } from './utils-hoist/is'; -import { logger } from './utils-hoist/logger'; -import { uuid4 } from './utils-hoist/misc'; -import { timestampInSeconds } from './utils-hoist/time'; -import { GLOBAL_OBJ } from './utils-hoist/worldwide'; +import { timestampInSeconds } from './utils/time'; +import { GLOBAL_OBJ } from './utils/worldwide'; /** * Captures an exception event and sends it to Sentry. diff --git a/packages/core/src/fetch.ts b/packages/core/src/fetch.ts index 65274d1e82a3..cf82eca1e6c1 100644 --- a/packages/core/src/fetch.ts +++ b/packages/core/src/fetch.ts @@ -5,12 +5,12 @@ import { SentryNonRecordingSpan } from './tracing/sentryNonRecordingSpan'; import type { FetchBreadcrumbHint } from './types-hoist/breadcrumb'; import type { HandlerDataFetch } from './types-hoist/instrument'; import type { Span, SpanAttributes, SpanOrigin } from './types-hoist/span'; +import { SENTRY_BAGGAGE_KEY_PREFIX } from './utils/baggage'; import { hasSpansEnabled } from './utils/hasSpansEnabled'; +import { isInstanceOf, isRequest } from './utils/is'; import { getActiveSpan } from './utils/spanUtils'; import { getTraceData } from './utils/traceData'; -import { SENTRY_BAGGAGE_KEY_PREFIX } from './utils-hoist/baggage'; -import { isInstanceOf, isRequest } from './utils-hoist/is'; -import { getSanitizedUrlStringFromUrlObject, isURLObjectRelative, parseStringToURLObject } from './utils-hoist/url'; +import { getSanitizedUrlStringFromUrlObject, isURLObjectRelative, parseStringToURLObject } from './utils/url'; type PolymorphicRequestHeaders = | Record diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index c67f1d6603da..cdde920ec3ca 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -133,14 +133,14 @@ export { _INTERNAL_MAX_FLAGS_PER_SPAN, } from './utils/featureFlags'; -export { applyAggregateErrorsToEvent } from './utils-hoist/aggregate-errors'; -export { getBreadcrumbLogLevelFromHttpStatusCode } from './utils-hoist/breadcrumb-log-level'; -export { getComponentName, getLocationHref, htmlTreeAsString } from './utils-hoist/browser'; -export { dsnFromString, dsnToString, makeDsn } from './utils-hoist/dsn'; +export { applyAggregateErrorsToEvent } from './utils/aggregate-errors'; +export { getBreadcrumbLogLevelFromHttpStatusCode } from './utils/breadcrumb-log-level'; +export { getComponentName, getLocationHref, htmlTreeAsString } from './utils/browser'; +export { dsnFromString, dsnToString, makeDsn } from './utils/dsn'; // eslint-disable-next-line deprecation/deprecation -export { SentryError } from './utils-hoist/error'; -export { GLOBAL_OBJ } from './utils-hoist/worldwide'; -export type { InternalGlobal } from './utils-hoist/worldwide'; +export { SentryError } from './utils/error'; +export { GLOBAL_OBJ } from './utils/worldwide'; +export type { InternalGlobal } from './utils/worldwide'; export { addConsoleInstrumentationHandler } from './instrument/console'; export { addFetchEndInstrumentationHandler, addFetchInstrumentationHandler } from './instrument/fetch'; export { addGlobalErrorInstrumentationHandler } from './instrument/globalError'; @@ -167,10 +167,10 @@ export { isSyntheticEvent, isThenable, isVueViewModel, -} from './utils-hoist/is'; -export { isBrowser } from './utils-hoist/isBrowser'; -export { CONSOLE_LEVELS, consoleSandbox, logger, originalConsoleMethods } from './utils-hoist/logger'; -export type { Logger } from './utils-hoist/logger'; +} from './utils/is'; +export { isBrowser } from './utils/isBrowser'; +export { CONSOLE_LEVELS, consoleSandbox, logger, originalConsoleMethods } from './utils/logger'; +export type { Logger } from './utils/logger'; export { addContextToFrame, addExceptionMechanism, @@ -179,9 +179,9 @@ export { getEventDescription, parseSemver, uuid4, -} from './utils-hoist/misc'; -export { isNodeEnv, loadModule } from './utils-hoist/node'; -export { normalize, normalizeToSize, normalizeUrlToBase } from './utils-hoist/normalize'; +} from './utils/misc'; +export { isNodeEnv, loadModule } from './utils/node'; +export { normalize, normalizeToSize, normalizeUrlToBase } from './utils/normalize'; export { addNonEnumerableProperty, convertToPlainObject, @@ -192,11 +192,11 @@ export { getOriginalFunction, markFunctionWrapped, objectify, -} from './utils-hoist/object'; -export { basename, dirname, isAbsolute, join, normalizePath, relative, resolve } from './utils-hoist/path'; -export { makePromiseBuffer, SENTRY_BUFFER_FULL_ERROR } from './utils-hoist/promisebuffer'; -export type { PromiseBuffer } from './utils-hoist/promisebuffer'; -export { severityLevelFromString } from './utils-hoist/severity'; +} from './utils/object'; +export { basename, dirname, isAbsolute, join, normalizePath, relative, resolve } from './utils/path'; +export { makePromiseBuffer, SENTRY_BUFFER_FULL_ERROR } from './utils/promisebuffer'; +export type { PromiseBuffer } from './utils/promisebuffer'; +export { severityLevelFromString } from './utils/severity'; export { UNKNOWN_FUNCTION, createStackParser, @@ -204,9 +204,9 @@ export { getFunctionName, stackParserFromStackParserOptions, stripSentryFramesAndReverse, -} from './utils-hoist/stacktrace'; -export { filenameIsInApp, node, nodeStackLineParser } from './utils-hoist/node-stack-trace'; -export { isMatchingPattern, safeJoin, snipLine, stringMatchesSomePattern, truncate } from './utils-hoist/string'; +} from './utils/stacktrace'; +export { filenameIsInApp, node, nodeStackLineParser } from './utils/node-stack-trace'; +export { isMatchingPattern, safeJoin, snipLine, stringMatchesSomePattern, truncate } from './utils/string'; export { isNativeFunction, supportsDOMError, @@ -219,17 +219,17 @@ export { // eslint-disable-next-line deprecation/deprecation supportsReferrerPolicy, supportsReportingObserver, -} from './utils-hoist/supports'; -export { SyncPromise, rejectedSyncPromise, resolvedSyncPromise } from './utils-hoist/syncpromise'; -export { browserPerformanceTimeOrigin, dateTimestampInSeconds, timestampInSeconds } from './utils-hoist/time'; +} from './utils/supports'; +export { SyncPromise, rejectedSyncPromise, resolvedSyncPromise } from './utils/syncpromise'; +export { browserPerformanceTimeOrigin, dateTimestampInSeconds, timestampInSeconds } from './utils/time'; export { TRACEPARENT_REGEXP, extractTraceparentData, generateSentryTraceHeader, propagationContextFromHeaders, -} from './utils-hoist/tracing'; -export { getSDKSource, isBrowserBundle } from './utils-hoist/env'; -export type { SdkSource } from './utils-hoist/env'; +} from './utils/tracing'; +export { getSDKSource, isBrowserBundle } from './utils/env'; +export type { SdkSource } from './utils/env'; export { addItemToEnvelope, createAttachmentEnvelopeItem, @@ -242,16 +242,16 @@ export { getSdkMetadataForEnvelopeHeader, parseEnvelope, serializeEnvelope, -} from './utils-hoist/envelope'; -export { createClientReportEnvelope } from './utils-hoist/clientreport'; +} from './utils/envelope'; +export { createClientReportEnvelope } from './utils/clientreport'; export { DEFAULT_RETRY_AFTER, disabledUntil, isRateLimited, parseRetryAfterHeader, updateRateLimits, -} from './utils-hoist/ratelimit'; -export type { RateLimits } from './utils-hoist/ratelimit'; +} from './utils/ratelimit'; +export type { RateLimits } from './utils/ratelimit'; export { MAX_BAGGAGE_STRING_LENGTH, SENTRY_BAGGAGE_KEY_PREFIX, @@ -260,7 +260,7 @@ export { dynamicSamplingContextToSentryBaggageHeader, parseBaggageHeader, objectToBaggageHeader, -} from './utils-hoist/baggage'; +} from './utils/baggage'; export { getSanitizedUrlString, parseUrl, @@ -269,19 +269,19 @@ export { getHttpSpanDetailsFromUrlObject, isURLObjectRelative, getSanitizedUrlStringFromUrlObject, -} from './utils-hoist/url'; +} from './utils/url'; export { eventFromMessage, eventFromUnknownInput, exceptionFromError, parseStackFrames, -} from './utils-hoist/eventbuilder'; -export { callFrameToStackFrame, watchdogTimer } from './utils-hoist/anr'; -export { LRUMap } from './utils-hoist/lru'; -export { generateTraceId, generateSpanId } from './utils-hoist/propagationContext'; -export { vercelWaitUntil } from './utils-hoist/vercelWaitUntil'; -export { SDK_VERSION } from './utils-hoist/version'; -export { getDebugImagesForResources, getFilenameToDebugIdMap } from './utils-hoist/debug-ids'; +} from './utils/eventbuilder'; +export { callFrameToStackFrame, watchdogTimer } from './utils/anr'; +export { LRUMap } from './utils/lru'; +export { generateTraceId, generateSpanId } from './utils/propagationContext'; +export { vercelWaitUntil } from './utils/vercelWaitUntil'; +export { SDK_VERSION } from './utils/version'; +export { getDebugImagesForResources, getFilenameToDebugIdMap } from './utils/debug-ids'; export { escapeStringForRegex } from './vendor/escapeStringForRegex'; export type { Attachment } from './types-hoist/attachment'; diff --git a/packages/core/src/instrument/console.ts b/packages/core/src/instrument/console.ts index 7c2326b1795b..141f3bcb33c9 100644 --- a/packages/core/src/instrument/console.ts +++ b/packages/core/src/instrument/console.ts @@ -1,9 +1,9 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/ban-types */ import type { ConsoleLevel, HandlerDataConsole } from '../types-hoist/instrument'; -import { CONSOLE_LEVELS, originalConsoleMethods } from '../utils-hoist/logger'; -import { fill } from '../utils-hoist/object'; -import { GLOBAL_OBJ } from '../utils-hoist/worldwide'; +import { CONSOLE_LEVELS, originalConsoleMethods } from '../utils/logger'; +import { fill } from '../utils/object'; +import { GLOBAL_OBJ } from '../utils/worldwide'; import { addHandler, maybeInstrument, triggerHandlers } from './handlers'; /** diff --git a/packages/core/src/instrument/fetch.ts b/packages/core/src/instrument/fetch.ts index ff4cee9d6669..be079280215a 100644 --- a/packages/core/src/instrument/fetch.ts +++ b/packages/core/src/instrument/fetch.ts @@ -1,11 +1,11 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import type { HandlerDataFetch } from '../types-hoist/instrument'; import type { WebFetchHeaders } from '../types-hoist/webfetchapi'; -import { isError, isRequest } from '../utils-hoist/is'; -import { addNonEnumerableProperty, fill } from '../utils-hoist/object'; -import { supportsNativeFetch } from '../utils-hoist/supports'; -import { timestampInSeconds } from '../utils-hoist/time'; -import { GLOBAL_OBJ } from '../utils-hoist/worldwide'; +import { isError, isRequest } from '../utils/is'; +import { addNonEnumerableProperty, fill } from '../utils/object'; +import { supportsNativeFetch } from '../utils/supports'; +import { timestampInSeconds } from '../utils/time'; +import { GLOBAL_OBJ } from '../utils/worldwide'; import { addHandler, maybeInstrument, triggerHandlers } from './handlers'; type FetchResource = string | { toString(): string } | { url: string }; diff --git a/packages/core/src/instrument/globalError.ts b/packages/core/src/instrument/globalError.ts index a31e10bf7b12..39e00ed816c4 100644 --- a/packages/core/src/instrument/globalError.ts +++ b/packages/core/src/instrument/globalError.ts @@ -1,5 +1,5 @@ import type { HandlerDataError } from '../types-hoist/instrument'; -import { GLOBAL_OBJ } from '../utils-hoist/worldwide'; +import { GLOBAL_OBJ } from '../utils/worldwide'; import { addHandler, maybeInstrument, triggerHandlers } from './handlers'; let _oldOnErrorHandler: (typeof GLOBAL_OBJ)['onerror'] | null = null; diff --git a/packages/core/src/instrument/globalUnhandledRejection.ts b/packages/core/src/instrument/globalUnhandledRejection.ts index 37995ec1fd5d..230146ae8646 100644 --- a/packages/core/src/instrument/globalUnhandledRejection.ts +++ b/packages/core/src/instrument/globalUnhandledRejection.ts @@ -1,5 +1,5 @@ import type { HandlerDataUnhandledRejection } from '../types-hoist/instrument'; -import { GLOBAL_OBJ } from '../utils-hoist/worldwide'; +import { GLOBAL_OBJ } from '../utils/worldwide'; import { addHandler, maybeInstrument, triggerHandlers } from './handlers'; let _oldOnUnhandledRejectionHandler: (typeof GLOBAL_OBJ)['onunhandledrejection'] | null = null; diff --git a/packages/core/src/instrument/handlers.ts b/packages/core/src/instrument/handlers.ts index b7cd0cb905de..2d88b3d8abe9 100644 --- a/packages/core/src/instrument/handlers.ts +++ b/packages/core/src/instrument/handlers.ts @@ -1,6 +1,6 @@ import { DEBUG_BUILD } from '../debug-build'; -import { logger } from '../utils-hoist/logger'; -import { getFunctionName } from '../utils-hoist/stacktrace'; +import { logger } from '../utils/logger'; +import { getFunctionName } from '../utils/stacktrace'; export type InstrumentHandlerType = | 'console' diff --git a/packages/core/src/integration.ts b/packages/core/src/integration.ts index c5636d002cc1..d8d741183287 100644 --- a/packages/core/src/integration.ts +++ b/packages/core/src/integration.ts @@ -4,7 +4,7 @@ import { DEBUG_BUILD } from './debug-build'; import type { Event, EventHint } from './types-hoist/event'; import type { Integration, IntegrationFn } from './types-hoist/integration'; import type { Options } from './types-hoist/options'; -import { logger } from './utils-hoist/logger'; +import { logger } from './utils/logger'; export const installedIntegrations: string[] = []; diff --git a/packages/core/src/integrations/captureconsole.ts b/packages/core/src/integrations/captureconsole.ts index c6e4c0d062dc..83863349e14a 100644 --- a/packages/core/src/integrations/captureconsole.ts +++ b/packages/core/src/integrations/captureconsole.ts @@ -1,14 +1,14 @@ import { getClient, withScope } from '../currentScopes'; import { captureException, captureMessage } from '../exports'; +import { addConsoleInstrumentationHandler } from '../instrument/console'; import { defineIntegration } from '../integration'; import type { CaptureContext } from '../scope'; import type { IntegrationFn } from '../types-hoist/integration'; -import { addConsoleInstrumentationHandler } from '../instrument/console'; -import { CONSOLE_LEVELS } from '../utils-hoist/logger'; -import { addExceptionMechanism } from '../utils-hoist/misc'; -import { severityLevelFromString } from '../utils-hoist/severity'; -import { safeJoin } from '../utils-hoist/string'; -import { GLOBAL_OBJ } from '../utils-hoist/worldwide'; +import { CONSOLE_LEVELS } from '../utils/logger'; +import { addExceptionMechanism } from '../utils/misc'; +import { severityLevelFromString } from '../utils/severity'; +import { safeJoin } from '../utils/string'; +import { GLOBAL_OBJ } from '../utils/worldwide'; interface CaptureConsoleOptions { levels?: string[]; diff --git a/packages/core/src/integrations/console.ts b/packages/core/src/integrations/console.ts index 6e2da3c5691c..3aa1cd8d9f3e 100644 --- a/packages/core/src/integrations/console.ts +++ b/packages/core/src/integrations/console.ts @@ -1,12 +1,12 @@ import { addBreadcrumb } from '../breadcrumbs'; import { getClient } from '../currentScopes'; +import { addConsoleInstrumentationHandler } from '../instrument/console'; import { defineIntegration } from '../integration'; import type { ConsoleLevel } from '../types-hoist/instrument'; -import { addConsoleInstrumentationHandler } from '../instrument/console'; -import { CONSOLE_LEVELS } from '../utils-hoist/logger'; -import { severityLevelFromString } from '../utils-hoist/severity'; -import { safeJoin } from '../utils-hoist/string'; -import { GLOBAL_OBJ } from '../utils-hoist/worldwide'; +import { CONSOLE_LEVELS } from '../utils/logger'; +import { severityLevelFromString } from '../utils/severity'; +import { safeJoin } from '../utils/string'; +import { GLOBAL_OBJ } from '../utils/worldwide'; interface ConsoleIntegrationOptions { levels: ConsoleLevel[]; diff --git a/packages/core/src/integrations/dedupe.ts b/packages/core/src/integrations/dedupe.ts index 9b2fae754e28..ab0e7eb41b25 100644 --- a/packages/core/src/integrations/dedupe.ts +++ b/packages/core/src/integrations/dedupe.ts @@ -4,8 +4,8 @@ import type { Event } from '../types-hoist/event'; import type { Exception } from '../types-hoist/exception'; import type { IntegrationFn } from '../types-hoist/integration'; import type { StackFrame } from '../types-hoist/stackframe'; -import { logger } from '../utils-hoist/logger'; -import { getFramesFromEvent } from '../utils-hoist/stacktrace'; +import { logger } from '../utils/logger'; +import { getFramesFromEvent } from '../utils/stacktrace'; const INTEGRATION_NAME = 'Dedupe'; diff --git a/packages/core/src/integrations/eventFilters.ts b/packages/core/src/integrations/eventFilters.ts index 7e254c16f0fa..c1818c8a46f8 100644 --- a/packages/core/src/integrations/eventFilters.ts +++ b/packages/core/src/integrations/eventFilters.ts @@ -4,9 +4,9 @@ import type { Event } from '../types-hoist/event'; import type { IntegrationFn } from '../types-hoist/integration'; import type { StackFrame } from '../types-hoist/stackframe'; import { getPossibleEventMessages } from '../utils/eventUtils'; -import { logger } from '../utils-hoist/logger'; -import { getEventDescription } from '../utils-hoist/misc'; -import { stringMatchesSomePattern } from '../utils-hoist/string'; +import { logger } from '../utils/logger'; +import { getEventDescription } from '../utils/misc'; +import { stringMatchesSomePattern } from '../utils/string'; // "Script error." is hard coded into browsers for errors that it can't read. // this is the result of a script being pulled in from an external domain and CORS. diff --git a/packages/core/src/integrations/extraerrordata.ts b/packages/core/src/integrations/extraerrordata.ts index d58d116783f3..3856699c9f68 100644 --- a/packages/core/src/integrations/extraerrordata.ts +++ b/packages/core/src/integrations/extraerrordata.ts @@ -4,11 +4,11 @@ import type { Contexts } from '../types-hoist/context'; import type { ExtendedError } from '../types-hoist/error'; import type { Event, EventHint } from '../types-hoist/event'; import type { IntegrationFn } from '../types-hoist/integration'; -import { isError, isPlainObject } from '../utils-hoist/is'; -import { logger } from '../utils-hoist/logger'; -import { normalize } from '../utils-hoist/normalize'; -import { addNonEnumerableProperty } from '../utils-hoist/object'; -import { truncate } from '../utils-hoist/string'; +import { isError, isPlainObject } from '../utils/is'; +import { logger } from '../utils/logger'; +import { normalize } from '../utils/normalize'; +import { addNonEnumerableProperty } from '../utils/object'; +import { truncate } from '../utils/string'; const INTEGRATION_NAME = 'ExtraErrorData'; diff --git a/packages/core/src/integrations/functiontostring.ts b/packages/core/src/integrations/functiontostring.ts index aef1b95795cd..5426e8291cb6 100644 --- a/packages/core/src/integrations/functiontostring.ts +++ b/packages/core/src/integrations/functiontostring.ts @@ -3,7 +3,7 @@ import { getClient } from '../currentScopes'; import { defineIntegration } from '../integration'; import type { IntegrationFn } from '../types-hoist/integration'; import type { WrappedFunction } from '../types-hoist/wrappedfunction'; -import { getOriginalFunction } from '../utils-hoist/object'; +import { getOriginalFunction } from '../utils/object'; let originalFunctionToString: () => void; diff --git a/packages/core/src/integrations/linkederrors.ts b/packages/core/src/integrations/linkederrors.ts index c9263eba744d..a45837be7548 100644 --- a/packages/core/src/integrations/linkederrors.ts +++ b/packages/core/src/integrations/linkederrors.ts @@ -1,7 +1,7 @@ import { defineIntegration } from '../integration'; import type { IntegrationFn } from '../types-hoist/integration'; -import { applyAggregateErrorsToEvent } from '../utils-hoist/aggregate-errors'; -import { exceptionFromError } from '../utils-hoist/eventbuilder'; +import { applyAggregateErrorsToEvent } from '../utils/aggregate-errors'; +import { exceptionFromError } from '../utils/eventbuilder'; interface LinkedErrorsOptions { key?: string; diff --git a/packages/core/src/integrations/metadata.ts b/packages/core/src/integrations/metadata.ts index 2a00d4d48137..1bbbbdfb9624 100644 --- a/packages/core/src/integrations/metadata.ts +++ b/packages/core/src/integrations/metadata.ts @@ -1,7 +1,7 @@ import { defineIntegration } from '../integration'; import { addMetadataToStackFrames, stripMetadataFromStackFrames } from '../metadata'; import type { EventItem } from '../types-hoist/envelope'; -import { forEachEnvelopeItem } from '../utils-hoist/envelope'; +import { forEachEnvelopeItem } from '../utils/envelope'; /** * Adds module metadata to stack frames. diff --git a/packages/core/src/integrations/rewriteframes.ts b/packages/core/src/integrations/rewriteframes.ts index 8b7361e40d94..c903016b0531 100644 --- a/packages/core/src/integrations/rewriteframes.ts +++ b/packages/core/src/integrations/rewriteframes.ts @@ -2,8 +2,8 @@ import { defineIntegration } from '../integration'; import type { Event } from '../types-hoist/event'; import type { StackFrame } from '../types-hoist/stackframe'; import type { Stacktrace } from '../types-hoist/stacktrace'; -import { basename, relative } from '../utils-hoist/path'; -import { GLOBAL_OBJ } from '../utils-hoist/worldwide'; +import { basename, relative } from '../utils/path'; +import { GLOBAL_OBJ } from '../utils/worldwide'; type StackFrameIteratee = (frame: StackFrame) => StackFrame; diff --git a/packages/core/src/integrations/supabase.ts b/packages/core/src/integrations/supabase.ts index 084d50356a83..ac781e95ece6 100644 --- a/packages/core/src/integrations/supabase.ts +++ b/packages/core/src/integrations/supabase.ts @@ -9,8 +9,8 @@ import { defineIntegration } from '../integration'; import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '../semanticAttributes'; import { setHttpStatus, SPAN_STATUS_ERROR, SPAN_STATUS_OK, startSpan } from '../tracing'; import type { IntegrationFn } from '../types-hoist/integration'; -import { isPlainObject } from '../utils-hoist/is'; -import { logger } from '../utils-hoist/logger'; +import { isPlainObject } from '../utils/is'; +import { logger } from '../utils/logger'; const AUTH_OPERATIONS_TO_INSTRUMENT = [ 'reauthenticate', diff --git a/packages/core/src/integrations/third-party-errors-filter.ts b/packages/core/src/integrations/third-party-errors-filter.ts index b61e6ccffb45..1a0628359f5b 100644 --- a/packages/core/src/integrations/third-party-errors-filter.ts +++ b/packages/core/src/integrations/third-party-errors-filter.ts @@ -2,8 +2,8 @@ import { defineIntegration } from '../integration'; import { addMetadataToStackFrames, stripMetadataFromStackFrames } from '../metadata'; import type { EventItem } from '../types-hoist/envelope'; import type { Event } from '../types-hoist/event'; -import { forEachEnvelopeItem } from '../utils-hoist/envelope'; -import { getFramesFromEvent } from '../utils-hoist/stacktrace'; +import { forEachEnvelopeItem } from '../utils/envelope'; +import { getFramesFromEvent } from '../utils/stacktrace'; interface Options { /** diff --git a/packages/core/src/integrations/zoderrors.ts b/packages/core/src/integrations/zoderrors.ts index 315b24592096..50c9c9e0237e 100644 --- a/packages/core/src/integrations/zoderrors.ts +++ b/packages/core/src/integrations/zoderrors.ts @@ -1,8 +1,8 @@ import { defineIntegration } from '../integration'; import type { Event, EventHint } from '../types-hoist/event'; import type { IntegrationFn } from '../types-hoist/integration'; -import { isError } from '../utils-hoist/is'; -import { truncate } from '../utils-hoist/string'; +import { isError } from '../utils/is'; +import { truncate } from '../utils/string'; interface ZodErrorsOptions { key?: string; diff --git a/packages/core/src/logs/console-integration.ts b/packages/core/src/logs/console-integration.ts index d5c048d2bbfc..58460f59d9ab 100644 --- a/packages/core/src/logs/console-integration.ts +++ b/packages/core/src/logs/console-integration.ts @@ -1,13 +1,13 @@ import { getClient } from '../currentScopes'; import { DEBUG_BUILD } from '../debug-build'; +import { addConsoleInstrumentationHandler } from '../instrument/console'; import { defineIntegration } from '../integration'; import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '../semanticAttributes'; import type { ConsoleLevel } from '../types-hoist/instrument'; import type { IntegrationFn } from '../types-hoist/integration'; -import { addConsoleInstrumentationHandler } from '../instrument/console'; -import { CONSOLE_LEVELS, logger } from '../utils-hoist/logger'; -import { safeJoin } from '../utils-hoist/string'; -import { GLOBAL_OBJ } from '../utils-hoist/worldwide'; +import { CONSOLE_LEVELS, logger } from '../utils/logger'; +import { safeJoin } from '../utils/string'; +import { GLOBAL_OBJ } from '../utils/worldwide'; import { _INTERNAL_captureLog } from './exports'; interface CaptureConsoleOptions { diff --git a/packages/core/src/logs/envelope.ts b/packages/core/src/logs/envelope.ts index c909a9140de1..c1d5b23e1575 100644 --- a/packages/core/src/logs/envelope.ts +++ b/packages/core/src/logs/envelope.ts @@ -2,8 +2,8 @@ import type { DsnComponents } from '../types-hoist/dsn'; import type { LogContainerItem, LogEnvelope } from '../types-hoist/envelope'; import type { SerializedLog } from '../types-hoist/log'; import type { SdkMetadata } from '../types-hoist/sdkmetadata'; -import { dsnToString } from '../utils-hoist/dsn'; -import { createEnvelope } from '../utils-hoist/envelope'; +import { dsnToString } from '../utils/dsn'; +import { createEnvelope } from '../utils/envelope'; /** * Creates a log container envelope item for a list of logs. diff --git a/packages/core/src/logs/exports.ts b/packages/core/src/logs/exports.ts index 176cdcd657b0..0ec4d960c66d 100644 --- a/packages/core/src/logs/exports.ts +++ b/packages/core/src/logs/exports.ts @@ -5,11 +5,11 @@ import { DEBUG_BUILD } from '../debug-build'; import type { Scope, ScopeData } from '../scope'; import type { Log, SerializedLog, SerializedLogAttributeValue } from '../types-hoist/log'; import { mergeScopeData } from '../utils/applyScopeDataToEvent'; +import { isParameterizedString } from '../utils/is'; +import { logger } from '../utils/logger'; import { _getSpanForScope } from '../utils/spanOnScope'; -import { isParameterizedString } from '../utils-hoist/is'; -import { logger } from '../utils-hoist/logger'; -import { timestampInSeconds } from '../utils-hoist/time'; -import { GLOBAL_OBJ } from '../utils-hoist/worldwide'; +import { timestampInSeconds } from '../utils/time'; +import { GLOBAL_OBJ } from '../utils/worldwide'; import { SEVERITY_TEXT_TO_SEVERITY_NUMBER } from './constants'; import { createLogEnvelope } from './envelope'; diff --git a/packages/core/src/mcp-server.ts b/packages/core/src/mcp-server.ts index bd3d83795d1c..1a6f626a83f2 100644 --- a/packages/core/src/mcp-server.ts +++ b/packages/core/src/mcp-server.ts @@ -6,8 +6,8 @@ import { } from './semanticAttributes'; import { startSpan, withActiveSpan } from './tracing'; import type { Span } from './types-hoist/span'; +import { logger } from './utils/logger'; import { getActiveSpan } from './utils/spanUtils'; -import { logger } from './utils-hoist/logger'; interface MCPTransport { // The first argument is a JSON RPC message diff --git a/packages/core/src/metadata.ts b/packages/core/src/metadata.ts index 8eec6542a7d4..c88d7a36406d 100644 --- a/packages/core/src/metadata.ts +++ b/packages/core/src/metadata.ts @@ -1,6 +1,6 @@ import type { Event } from './types-hoist/event'; import type { StackParser } from './types-hoist/stacktrace'; -import { GLOBAL_OBJ } from './utils-hoist/worldwide'; +import { GLOBAL_OBJ } from './utils/worldwide'; /** Keys are source filename/url, values are metadata objects. */ // eslint-disable-next-line @typescript-eslint/no-explicit-any diff --git a/packages/core/src/profiling.ts b/packages/core/src/profiling.ts index 8e7da5d8e946..956f37992f81 100644 --- a/packages/core/src/profiling.ts +++ b/packages/core/src/profiling.ts @@ -1,7 +1,7 @@ import { getClient } from './currentScopes'; import { DEBUG_BUILD } from './debug-build'; import type { Profiler, ProfilingIntegration } from './types-hoist/profiling'; -import { logger } from './utils-hoist/logger'; +import { logger } from './utils/logger'; function isProfilingIntegrationWithProfiler( integration: ProfilingIntegration | undefined, diff --git a/packages/core/src/scope.ts b/packages/core/src/scope.ts index 414f1e38a2df..6f9269faec78 100644 --- a/packages/core/src/scope.ts +++ b/packages/core/src/scope.ts @@ -15,14 +15,14 @@ import type { SeverityLevel } from './types-hoist/severity'; import type { Span } from './types-hoist/span'; import type { PropagationContext } from './types-hoist/tracing'; import type { User } from './types-hoist/user'; +import { isPlainObject } from './utils/is'; +import { logger } from './utils/logger'; import { merge } from './utils/merge'; +import { uuid4 } from './utils/misc'; +import { generateTraceId } from './utils/propagationContext'; import { _getSpanForScope, _setSpanForScope } from './utils/spanOnScope'; -import { isPlainObject } from './utils-hoist/is'; -import { logger } from './utils-hoist/logger'; -import { uuid4 } from './utils-hoist/misc'; -import { generateTraceId } from './utils-hoist/propagationContext'; -import { truncate } from './utils-hoist/string'; -import { dateTimestampInSeconds } from './utils-hoist/time'; +import { truncate } from './utils/string'; +import { dateTimestampInSeconds } from './utils/time'; /** * Default value for maximum number of breadcrumbs added to an event. diff --git a/packages/core/src/sdk.ts b/packages/core/src/sdk.ts index fa3194d1ebc5..3ebbcbd4b673 100644 --- a/packages/core/src/sdk.ts +++ b/packages/core/src/sdk.ts @@ -2,7 +2,7 @@ import type { Client } from './client'; import { getCurrentScope } from './currentScopes'; import { DEBUG_BUILD } from './debug-build'; import type { ClientOptions } from './types-hoist/options'; -import { consoleSandbox, logger } from './utils-hoist/logger'; +import { consoleSandbox, logger } from './utils/logger'; /** A class object that can instantiate Client objects. */ export type ClientClass = new (options: O) => F; diff --git a/packages/core/src/server-runtime-client.ts b/packages/core/src/server-runtime-client.ts index 261c5b582c23..9f41e6142c24 100644 --- a/packages/core/src/server-runtime-client.ts +++ b/packages/core/src/server-runtime-client.ts @@ -13,11 +13,11 @@ import type { ClientOptions } from './types-hoist/options'; import type { ParameterizedString } from './types-hoist/parameterize'; import type { SeverityLevel } from './types-hoist/severity'; import type { BaseTransportOptions } from './types-hoist/transport'; -import { eventFromMessage, eventFromUnknownInput } from './utils-hoist/eventbuilder'; -import { isPrimitive } from './utils-hoist/is'; -import { logger } from './utils-hoist/logger'; -import { uuid4 } from './utils-hoist/misc'; -import { resolvedSyncPromise } from './utils-hoist/syncpromise'; +import { eventFromMessage, eventFromUnknownInput } from './utils/eventbuilder'; +import { isPrimitive } from './utils/is'; +import { logger } from './utils/logger'; +import { uuid4 } from './utils/misc'; +import { resolvedSyncPromise } from './utils/syncpromise'; // TODO: Make this configurable const DEFAULT_LOG_FLUSH_INTERVAL = 5000; diff --git a/packages/core/src/session.ts b/packages/core/src/session.ts index 116a00a9adbe..492378279288 100644 --- a/packages/core/src/session.ts +++ b/packages/core/src/session.ts @@ -1,6 +1,6 @@ import type { SerializedSession, Session, SessionContext, SessionStatus } from './types-hoist/session'; -import { uuid4 } from './utils-hoist/misc'; -import { timestampInSeconds } from './utils-hoist/time'; +import { uuid4 } from './utils/misc'; +import { timestampInSeconds } from './utils/time'; /** * Creates a new `Session` object by setting certain default parameters. If optional @param context diff --git a/packages/core/src/tracing/dynamicSamplingContext.ts b/packages/core/src/tracing/dynamicSamplingContext.ts index 5f10f11db19c..4c7d0e15bd4e 100644 --- a/packages/core/src/tracing/dynamicSamplingContext.ts +++ b/packages/core/src/tracing/dynamicSamplingContext.ts @@ -9,14 +9,14 @@ import { } from '../semanticAttributes'; import type { DynamicSamplingContext } from '../types-hoist/envelope'; import type { Span } from '../types-hoist/span'; -import { hasSpansEnabled } from '../utils/hasSpansEnabled'; -import { getRootSpan, spanIsSampled, spanToJSON } from '../utils/spanUtils'; import { baggageHeaderToDynamicSamplingContext, dynamicSamplingContextToSentryBaggageHeader, -} from '../utils-hoist/baggage'; -import { extractOrgIdFromDsnHost } from '../utils-hoist/dsn'; -import { addNonEnumerableProperty } from '../utils-hoist/object'; +} from '../utils/baggage'; +import { extractOrgIdFromDsnHost } from '../utils/dsn'; +import { hasSpansEnabled } from '../utils/hasSpansEnabled'; +import { addNonEnumerableProperty } from '../utils/object'; +import { getRootSpan, spanIsSampled, spanToJSON } from '../utils/spanUtils'; import { getCapturedScopesOnSpan } from './utils'; /** diff --git a/packages/core/src/tracing/errors.ts b/packages/core/src/tracing/errors.ts index 6aaf81bdb2de..28f582f32309 100644 --- a/packages/core/src/tracing/errors.ts +++ b/packages/core/src/tracing/errors.ts @@ -1,8 +1,8 @@ import { DEBUG_BUILD } from '../debug-build'; -import { getActiveSpan, getRootSpan } from '../utils/spanUtils'; import { addGlobalErrorInstrumentationHandler } from '../instrument/globalError'; import { addGlobalUnhandledRejectionInstrumentationHandler } from '../instrument/globalUnhandledRejection'; -import { logger } from '../utils-hoist/logger'; +import { logger } from '../utils/logger'; +import { getActiveSpan, getRootSpan } from '../utils/spanUtils'; import { SPAN_STATUS_ERROR } from './spanstatus'; let errorsInstrumented = false; diff --git a/packages/core/src/tracing/idleSpan.ts b/packages/core/src/tracing/idleSpan.ts index e5667d27a5ec..be0f1b80fb47 100644 --- a/packages/core/src/tracing/idleSpan.ts +++ b/packages/core/src/tracing/idleSpan.ts @@ -5,6 +5,7 @@ import type { DynamicSamplingContext } from '../types-hoist/envelope'; import type { Span } from '../types-hoist/span'; import type { StartSpanOptions } from '../types-hoist/startSpanOptions'; import { hasSpansEnabled } from '../utils/hasSpansEnabled'; +import { logger } from '../utils/logger'; import { _setSpanForScope } from '../utils/spanOnScope'; import { getActiveSpan, @@ -13,8 +14,7 @@ import { spanTimeInputToSeconds, spanToJSON, } from '../utils/spanUtils'; -import { logger } from '../utils-hoist/logger'; -import { timestampInSeconds } from '../utils-hoist/time'; +import { timestampInSeconds } from '../utils/time'; import { freezeDscOnSpan, getDynamicSamplingContextFromSpan } from './dynamicSamplingContext'; import { SentryNonRecordingSpan } from './sentryNonRecordingSpan'; import { SPAN_STATUS_ERROR } from './spanstatus'; diff --git a/packages/core/src/tracing/logSpans.ts b/packages/core/src/tracing/logSpans.ts index c0bcb34266ae..9728ac6f3399 100644 --- a/packages/core/src/tracing/logSpans.ts +++ b/packages/core/src/tracing/logSpans.ts @@ -1,7 +1,7 @@ import { DEBUG_BUILD } from '../debug-build'; import type { Span } from '../types-hoist/span'; +import { logger } from '../utils/logger'; import { getRootSpan, spanIsSampled, spanToJSON } from '../utils/spanUtils'; -import { logger } from '../utils-hoist/logger'; /** * Print a log message for a started span. diff --git a/packages/core/src/tracing/measurement.ts b/packages/core/src/tracing/measurement.ts index b94cc6831009..5ee0397f8946 100644 --- a/packages/core/src/tracing/measurement.ts +++ b/packages/core/src/tracing/measurement.ts @@ -5,8 +5,8 @@ import { } from '../semanticAttributes'; import type { Measurements, MeasurementUnit } from '../types-hoist/measurement'; import type { TimedEvent } from '../types-hoist/timedEvent'; +import { logger } from '../utils/logger'; import { getActiveSpan, getRootSpan } from '../utils/spanUtils'; -import { logger } from '../utils-hoist/logger'; /** * Adds a measurement to the active transaction on the current global scope. You can optionally pass in a different span diff --git a/packages/core/src/tracing/sampling.ts b/packages/core/src/tracing/sampling.ts index 098a09baa4ad..8fec768c9d52 100644 --- a/packages/core/src/tracing/sampling.ts +++ b/packages/core/src/tracing/sampling.ts @@ -2,8 +2,8 @@ import { DEBUG_BUILD } from '../debug-build'; import type { Options } from '../types-hoist/options'; import type { SamplingContext } from '../types-hoist/samplingcontext'; import { hasSpansEnabled } from '../utils/hasSpansEnabled'; +import { logger } from '../utils/logger'; import { parseSampleRate } from '../utils/parseSampleRate'; -import { logger } from '../utils-hoist/logger'; /** * Makes a sampling decision for the given options. diff --git a/packages/core/src/tracing/sentryNonRecordingSpan.ts b/packages/core/src/tracing/sentryNonRecordingSpan.ts index 9ace30c4e70a..69d1aa2a85ba 100644 --- a/packages/core/src/tracing/sentryNonRecordingSpan.ts +++ b/packages/core/src/tracing/sentryNonRecordingSpan.ts @@ -7,8 +7,8 @@ import type { SpanTimeInput, } from '../types-hoist/span'; import type { SpanStatus } from '../types-hoist/spanStatus'; +import { generateSpanId, generateTraceId } from '../utils/propagationContext'; import { TRACE_FLAG_NONE } from '../utils/spanUtils'; -import { generateSpanId, generateTraceId } from '../utils-hoist/propagationContext'; /** * A Sentry Span that is non-recording, meaning it will not be sent to Sentry. diff --git a/packages/core/src/tracing/sentrySpan.ts b/packages/core/src/tracing/sentrySpan.ts index f0e2a6bb374a..74b59c655e83 100644 --- a/packages/core/src/tracing/sentrySpan.ts +++ b/packages/core/src/tracing/sentrySpan.ts @@ -25,6 +25,8 @@ import type { import type { SpanStatus } from '../types-hoist/spanStatus'; import type { TimedEvent } from '../types-hoist/timedEvent'; import type { TransactionSource } from '../types-hoist/transaction'; +import { logger } from '../utils/logger'; +import { generateSpanId, generateTraceId } from '../utils/propagationContext'; import { convertSpanLinksForEnvelope, getRootSpan, @@ -36,9 +38,7 @@ import { TRACE_FLAG_NONE, TRACE_FLAG_SAMPLED, } from '../utils/spanUtils'; -import { logger } from '../utils-hoist/logger'; -import { generateSpanId, generateTraceId } from '../utils-hoist/propagationContext'; -import { timestampInSeconds } from '../utils-hoist/time'; +import { timestampInSeconds } from '../utils/time'; import { getDynamicSamplingContextFromSpan } from './dynamicSamplingContext'; import { logSpanEnd } from './logSpans'; import { timedEventsToMeasurements } from './measurement'; diff --git a/packages/core/src/tracing/trace.ts b/packages/core/src/tracing/trace.ts index 427e4ebb0bf6..7a2229090e97 100644 --- a/packages/core/src/tracing/trace.ts +++ b/packages/core/src/tracing/trace.ts @@ -13,12 +13,12 @@ import type { SentrySpanArguments, Span, SpanTimeInput } from '../types-hoist/sp import type { StartSpanOptions } from '../types-hoist/startSpanOptions'; import { handleCallbackErrors } from '../utils/handleCallbackErrors'; import { hasSpansEnabled } from '../utils/hasSpansEnabled'; +import { logger } from '../utils/logger'; import { parseSampleRate } from '../utils/parseSampleRate'; +import { generateTraceId } from '../utils/propagationContext'; import { _getSpanForScope, _setSpanForScope } from '../utils/spanOnScope'; import { addChildSpanToSpan, getRootSpan, spanIsSampled, spanTimeInputToSeconds, spanToJSON } from '../utils/spanUtils'; -import { logger } from '../utils-hoist/logger'; -import { generateTraceId } from '../utils-hoist/propagationContext'; -import { propagationContextFromHeaders } from '../utils-hoist/tracing'; +import { propagationContextFromHeaders } from '../utils/tracing'; import { freezeDscOnSpan, getDynamicSamplingContextFromSpan } from './dynamicSamplingContext'; import { logSpanStart } from './logSpans'; import { sampleSpan } from './sampling'; diff --git a/packages/core/src/tracing/utils.ts b/packages/core/src/tracing/utils.ts index f7e3d4924b35..5fa0a4b34420 100644 --- a/packages/core/src/tracing/utils.ts +++ b/packages/core/src/tracing/utils.ts @@ -1,6 +1,6 @@ import type { Scope } from '../scope'; import type { Span } from '../types-hoist/span'; -import { addNonEnumerableProperty } from '../utils-hoist/object'; +import { addNonEnumerableProperty } from '../utils/object'; const SCOPE_ON_START_SPAN_FIELD = '_sentryScope'; const ISOLATION_SCOPE_ON_START_SPAN_FIELD = '_sentryIsolationScope'; diff --git a/packages/core/src/transports/base.ts b/packages/core/src/transports/base.ts index d5a4f83c1657..9c74bb4261db 100644 --- a/packages/core/src/transports/base.ts +++ b/packages/core/src/transports/base.ts @@ -12,11 +12,11 @@ import { envelopeItemTypeToDataCategory, forEachEnvelopeItem, serializeEnvelope, -} from '../utils-hoist/envelope'; -import { logger } from '../utils-hoist/logger'; -import { type PromiseBuffer, makePromiseBuffer, SENTRY_BUFFER_FULL_ERROR } from '../utils-hoist/promisebuffer'; -import { type RateLimits, isRateLimited, updateRateLimits } from '../utils-hoist/ratelimit'; -import { resolvedSyncPromise } from '../utils-hoist/syncpromise'; +} from '../utils/envelope'; +import { logger } from '../utils/logger'; +import { type PromiseBuffer, makePromiseBuffer, SENTRY_BUFFER_FULL_ERROR } from '../utils/promisebuffer'; +import { type RateLimits, isRateLimited, updateRateLimits } from '../utils/ratelimit'; +import { resolvedSyncPromise } from '../utils/syncpromise'; export const DEFAULT_TRANSPORT_BUFFER_SIZE = 64; diff --git a/packages/core/src/transports/multiplexed.ts b/packages/core/src/transports/multiplexed.ts index 8e93f5f81b53..1b6d53ab0ae8 100644 --- a/packages/core/src/transports/multiplexed.ts +++ b/packages/core/src/transports/multiplexed.ts @@ -2,8 +2,8 @@ import { getEnvelopeEndpointWithUrlEncodedAuth } from '../api'; import type { Envelope, EnvelopeItemType, EventItem } from '../types-hoist/envelope'; import type { Event } from '../types-hoist/event'; import type { BaseTransportOptions, Transport, TransportMakeRequestResponse } from '../types-hoist/transport'; -import { dsnFromString } from '../utils-hoist/dsn'; -import { createEnvelope, forEachEnvelopeItem } from '../utils-hoist/envelope'; +import { dsnFromString } from '../utils/dsn'; +import { createEnvelope, forEachEnvelopeItem } from '../utils/envelope'; interface MatchParam { /** The envelope to be sent */ diff --git a/packages/core/src/transports/offline.ts b/packages/core/src/transports/offline.ts index b5e584039d1a..b7713b12bb2b 100644 --- a/packages/core/src/transports/offline.ts +++ b/packages/core/src/transports/offline.ts @@ -1,9 +1,9 @@ import { DEBUG_BUILD } from '../debug-build'; import type { Envelope } from '../types-hoist/envelope'; import type { InternalBaseTransportOptions, Transport, TransportMakeRequestResponse } from '../types-hoist/transport'; -import { envelopeContainsItemType } from '../utils-hoist/envelope'; -import { logger } from '../utils-hoist/logger'; -import { parseRetryAfterHeader } from '../utils-hoist/ratelimit'; +import { envelopeContainsItemType } from '../utils/envelope'; +import { logger } from '../utils/logger'; +import { parseRetryAfterHeader } from '../utils/ratelimit'; export const MIN_DELAY = 100; // 100 ms export const START_DELAY = 5_000; // 5 seconds diff --git a/packages/core/src/trpc.ts b/packages/core/src/trpc.ts index 7e29a69903a1..611dded043b6 100644 --- a/packages/core/src/trpc.ts +++ b/packages/core/src/trpc.ts @@ -2,8 +2,8 @@ import { getClient, withIsolationScope } from './currentScopes'; import { captureException } from './exports'; import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from './semanticAttributes'; import { startSpanManual } from './tracing'; -import { normalize } from './utils-hoist/normalize'; -import { addNonEnumerableProperty } from './utils-hoist/object'; +import { normalize } from './utils/normalize'; +import { addNonEnumerableProperty } from './utils/object'; interface SentryTrpcMiddlewareOptions { /** Whether to include procedure inputs in reported events. Defaults to `false`. */ diff --git a/packages/core/src/utils-hoist/aggregate-errors.ts b/packages/core/src/utils/aggregate-errors.ts similarity index 100% rename from packages/core/src/utils-hoist/aggregate-errors.ts rename to packages/core/src/utils/aggregate-errors.ts diff --git a/packages/core/src/utils-hoist/anr.ts b/packages/core/src/utils/anr.ts similarity index 100% rename from packages/core/src/utils-hoist/anr.ts rename to packages/core/src/utils/anr.ts diff --git a/packages/core/src/utils-hoist/baggage.ts b/packages/core/src/utils/baggage.ts similarity index 99% rename from packages/core/src/utils-hoist/baggage.ts rename to packages/core/src/utils/baggage.ts index 4a44ee5c35b0..0e90457db97b 100644 --- a/packages/core/src/utils-hoist/baggage.ts +++ b/packages/core/src/utils/baggage.ts @@ -1,5 +1,5 @@ +import { DEBUG_BUILD } from '../debug-build'; import type { DynamicSamplingContext } from '../types-hoist/envelope'; -import { DEBUG_BUILD } from './../debug-build'; import { isString } from './is'; import { logger } from './logger'; diff --git a/packages/core/src/utils-hoist/breadcrumb-log-level.ts b/packages/core/src/utils/breadcrumb-log-level.ts similarity index 100% rename from packages/core/src/utils-hoist/breadcrumb-log-level.ts rename to packages/core/src/utils/breadcrumb-log-level.ts diff --git a/packages/core/src/utils-hoist/browser.ts b/packages/core/src/utils/browser.ts similarity index 100% rename from packages/core/src/utils-hoist/browser.ts rename to packages/core/src/utils/browser.ts diff --git a/packages/core/src/utils-hoist/clientreport.ts b/packages/core/src/utils/clientreport.ts similarity index 100% rename from packages/core/src/utils-hoist/clientreport.ts rename to packages/core/src/utils/clientreport.ts diff --git a/packages/core/src/utils-hoist/debug-ids.ts b/packages/core/src/utils/debug-ids.ts similarity index 100% rename from packages/core/src/utils-hoist/debug-ids.ts rename to packages/core/src/utils/debug-ids.ts diff --git a/packages/core/src/utils-hoist/dsn.ts b/packages/core/src/utils/dsn.ts similarity index 98% rename from packages/core/src/utils-hoist/dsn.ts rename to packages/core/src/utils/dsn.ts index e26cbb4c8bf1..b22e2baed1f8 100644 --- a/packages/core/src/utils-hoist/dsn.ts +++ b/packages/core/src/utils/dsn.ts @@ -1,5 +1,5 @@ +import { DEBUG_BUILD } from '../debug-build'; import type { DsnComponents, DsnLike, DsnProtocol } from '../types-hoist/dsn'; -import { DEBUG_BUILD } from './../debug-build'; import { consoleSandbox, logger } from './logger'; /** Regular expression used to extract org ID from a DSN host. */ diff --git a/packages/core/src/utils-hoist/env.ts b/packages/core/src/utils/env.ts similarity index 100% rename from packages/core/src/utils-hoist/env.ts rename to packages/core/src/utils/env.ts diff --git a/packages/core/src/utils-hoist/envelope.ts b/packages/core/src/utils/envelope.ts similarity index 100% rename from packages/core/src/utils-hoist/envelope.ts rename to packages/core/src/utils/envelope.ts diff --git a/packages/core/src/utils-hoist/error.ts b/packages/core/src/utils/error.ts similarity index 100% rename from packages/core/src/utils-hoist/error.ts rename to packages/core/src/utils/error.ts diff --git a/packages/core/src/utils-hoist/eventbuilder.ts b/packages/core/src/utils/eventbuilder.ts similarity index 100% rename from packages/core/src/utils-hoist/eventbuilder.ts rename to packages/core/src/utils/eventbuilder.ts diff --git a/packages/core/src/utils/featureFlags.ts b/packages/core/src/utils/featureFlags.ts index 388613394148..a055e8875c06 100644 --- a/packages/core/src/utils/featureFlags.ts +++ b/packages/core/src/utils/featureFlags.ts @@ -2,8 +2,8 @@ import { getCurrentScope } from '../currentScopes'; import { DEBUG_BUILD } from '../debug-build'; import { type Event } from '../types-hoist/event'; import { type Span } from '../types-hoist/span'; -import { logger } from '../utils-hoist/logger'; -import { GLOBAL_OBJ } from '../utils-hoist/worldwide'; +import { logger } from '../utils/logger'; +import { GLOBAL_OBJ } from '../utils/worldwide'; import { getActiveSpan } from './spanUtils'; /** diff --git a/packages/core/src/utils/handleCallbackErrors.ts b/packages/core/src/utils/handleCallbackErrors.ts index 7e281b6b7d1c..cf4d29766445 100644 --- a/packages/core/src/utils/handleCallbackErrors.ts +++ b/packages/core/src/utils/handleCallbackErrors.ts @@ -1,4 +1,4 @@ -import { isThenable } from '../utils-hoist/is'; +import { isThenable } from '../utils/is'; /** * Wrap a callback function with error handling. diff --git a/packages/core/src/utils-hoist/is.ts b/packages/core/src/utils/is.ts similarity index 100% rename from packages/core/src/utils-hoist/is.ts rename to packages/core/src/utils/is.ts diff --git a/packages/core/src/utils-hoist/isBrowser.ts b/packages/core/src/utils/isBrowser.ts similarity index 100% rename from packages/core/src/utils-hoist/isBrowser.ts rename to packages/core/src/utils/isBrowser.ts diff --git a/packages/core/src/utils-hoist/logger.ts b/packages/core/src/utils/logger.ts similarity index 98% rename from packages/core/src/utils-hoist/logger.ts rename to packages/core/src/utils/logger.ts index 0c1e8f4d169b..669917dfbadf 100644 --- a/packages/core/src/utils-hoist/logger.ts +++ b/packages/core/src/utils/logger.ts @@ -1,6 +1,6 @@ import { getGlobalSingleton } from '../carrier'; +import { DEBUG_BUILD } from '../debug-build'; import type { ConsoleLevel } from '../types-hoist/instrument'; -import { DEBUG_BUILD } from './../debug-build'; import { GLOBAL_OBJ } from './worldwide'; /** Prefix for logging strings */ diff --git a/packages/core/src/utils-hoist/lru.ts b/packages/core/src/utils/lru.ts similarity index 100% rename from packages/core/src/utils-hoist/lru.ts rename to packages/core/src/utils/lru.ts diff --git a/packages/core/src/utils-hoist/misc.ts b/packages/core/src/utils/misc.ts similarity index 100% rename from packages/core/src/utils-hoist/misc.ts rename to packages/core/src/utils/misc.ts diff --git a/packages/core/src/utils-hoist/node-stack-trace.ts b/packages/core/src/utils/node-stack-trace.ts similarity index 100% rename from packages/core/src/utils-hoist/node-stack-trace.ts rename to packages/core/src/utils/node-stack-trace.ts diff --git a/packages/core/src/utils-hoist/node.ts b/packages/core/src/utils/node.ts similarity index 100% rename from packages/core/src/utils-hoist/node.ts rename to packages/core/src/utils/node.ts diff --git a/packages/core/src/utils-hoist/normalize.ts b/packages/core/src/utils/normalize.ts similarity index 100% rename from packages/core/src/utils-hoist/normalize.ts rename to packages/core/src/utils/normalize.ts diff --git a/packages/core/src/utils-hoist/object.ts b/packages/core/src/utils/object.ts similarity index 99% rename from packages/core/src/utils-hoist/object.ts rename to packages/core/src/utils/object.ts index 366e3f2c5e98..c973ad056dee 100644 --- a/packages/core/src/utils-hoist/object.ts +++ b/packages/core/src/utils/object.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ +import { DEBUG_BUILD } from '../debug-build'; import type { WrappedFunction } from '../types-hoist/wrappedfunction'; -import { DEBUG_BUILD } from './../debug-build'; import { htmlTreeAsString } from './browser'; import { isElement, isError, isEvent, isInstanceOf, isPrimitive } from './is'; import { logger } from './logger'; diff --git a/packages/core/src/utils-hoist/path.ts b/packages/core/src/utils/path.ts similarity index 100% rename from packages/core/src/utils-hoist/path.ts rename to packages/core/src/utils/path.ts diff --git a/packages/core/src/utils/prepareEvent.ts b/packages/core/src/utils/prepareEvent.ts index 30ed787d4879..6bff4e8b3d50 100644 --- a/packages/core/src/utils/prepareEvent.ts +++ b/packages/core/src/utils/prepareEvent.ts @@ -7,12 +7,12 @@ import { Scope } from '../scope'; import type { Event, EventHint } from '../types-hoist/event'; import type { ClientOptions } from '../types-hoist/options'; import type { StackParser } from '../types-hoist/stacktrace'; -import { getFilenameToDebugIdMap } from '../utils-hoist/debug-ids'; -import { addExceptionMechanism, uuid4 } from '../utils-hoist/misc'; -import { normalize } from '../utils-hoist/normalize'; -import { truncate } from '../utils-hoist/string'; -import { dateTimestampInSeconds } from '../utils-hoist/time'; import { applyScopeDataToEvent, mergeScopeData } from './applyScopeDataToEvent'; +import { getFilenameToDebugIdMap } from './debug-ids'; +import { addExceptionMechanism, uuid4 } from './misc'; +import { normalize } from './normalize'; +import { truncate } from './string'; +import { dateTimestampInSeconds } from './time'; /** * This type makes sure that we get either a CaptureContext, OR an EventHint. diff --git a/packages/core/src/utils-hoist/promisebuffer.ts b/packages/core/src/utils/promisebuffer.ts similarity index 100% rename from packages/core/src/utils-hoist/promisebuffer.ts rename to packages/core/src/utils/promisebuffer.ts diff --git a/packages/core/src/utils-hoist/propagationContext.ts b/packages/core/src/utils/propagationContext.ts similarity index 100% rename from packages/core/src/utils-hoist/propagationContext.ts rename to packages/core/src/utils/propagationContext.ts diff --git a/packages/core/src/utils-hoist/ratelimit.ts b/packages/core/src/utils/ratelimit.ts similarity index 100% rename from packages/core/src/utils-hoist/ratelimit.ts rename to packages/core/src/utils/ratelimit.ts diff --git a/packages/core/src/utils/sdkMetadata.ts b/packages/core/src/utils/sdkMetadata.ts index 9235efbe8c0c..437668a9e7f4 100644 --- a/packages/core/src/utils/sdkMetadata.ts +++ b/packages/core/src/utils/sdkMetadata.ts @@ -1,5 +1,5 @@ import type { Options } from '../types-hoist/options'; -import { SDK_VERSION } from '../utils-hoist/version'; +import { SDK_VERSION } from '../utils/version'; /** * A builder for the SDK metadata in the options for the SDK initialization. diff --git a/packages/core/src/utils-hoist/severity.ts b/packages/core/src/utils/severity.ts similarity index 100% rename from packages/core/src/utils-hoist/severity.ts rename to packages/core/src/utils/severity.ts diff --git a/packages/core/src/utils/spanOnScope.ts b/packages/core/src/utils/spanOnScope.ts index 29eec0a2574b..ad18e1687746 100644 --- a/packages/core/src/utils/spanOnScope.ts +++ b/packages/core/src/utils/spanOnScope.ts @@ -1,6 +1,6 @@ import type { Scope } from '../scope'; import type { Span } from '../types-hoist/span'; -import { addNonEnumerableProperty } from '../utils-hoist/object'; +import { addNonEnumerableProperty } from '../utils/object'; const SCOPE_SPAN_FIELD = '_sentrySpan'; diff --git a/packages/core/src/utils/spanUtils.ts b/packages/core/src/utils/spanUtils.ts index 8018a62a20d4..361be95b6510 100644 --- a/packages/core/src/utils/spanUtils.ts +++ b/packages/core/src/utils/spanUtils.ts @@ -14,11 +14,11 @@ import type { TraceContext } from '../types-hoist/context'; import type { SpanLink, SpanLinkJSON } from '../types-hoist/link'; import type { Span, SpanAttributes, SpanJSON, SpanOrigin, SpanTimeInput } from '../types-hoist/span'; import type { SpanStatus } from '../types-hoist/spanStatus'; -import { consoleSandbox } from '../utils-hoist/logger'; -import { addNonEnumerableProperty } from '../utils-hoist/object'; -import { generateSpanId } from '../utils-hoist/propagationContext'; -import { timestampInSeconds } from '../utils-hoist/time'; -import { generateSentryTraceHeader } from '../utils-hoist/tracing'; +import { consoleSandbox } from '../utils/logger'; +import { addNonEnumerableProperty } from '../utils/object'; +import { generateSpanId } from '../utils/propagationContext'; +import { timestampInSeconds } from '../utils/time'; +import { generateSentryTraceHeader } from '../utils/tracing'; import { _getSpanForScope } from './spanOnScope'; // These are aligned with OpenTelemetry trace flags diff --git a/packages/core/src/utils-hoist/stacktrace.ts b/packages/core/src/utils/stacktrace.ts similarity index 100% rename from packages/core/src/utils-hoist/stacktrace.ts rename to packages/core/src/utils/stacktrace.ts diff --git a/packages/core/src/utils-hoist/string.ts b/packages/core/src/utils/string.ts similarity index 100% rename from packages/core/src/utils-hoist/string.ts rename to packages/core/src/utils/string.ts diff --git a/packages/core/src/utils-hoist/supports.ts b/packages/core/src/utils/supports.ts similarity index 98% rename from packages/core/src/utils-hoist/supports.ts rename to packages/core/src/utils/supports.ts index 9cb6a71d8058..b5c96a7e50d8 100644 --- a/packages/core/src/utils-hoist/supports.ts +++ b/packages/core/src/utils/supports.ts @@ -1,4 +1,4 @@ -import { DEBUG_BUILD } from './../debug-build'; +import { DEBUG_BUILD } from '../debug-build'; import { logger } from './logger'; import { GLOBAL_OBJ } from './worldwide'; diff --git a/packages/core/src/utils-hoist/syncpromise.ts b/packages/core/src/utils/syncpromise.ts similarity index 100% rename from packages/core/src/utils-hoist/syncpromise.ts rename to packages/core/src/utils/syncpromise.ts diff --git a/packages/core/src/utils-hoist/time.ts b/packages/core/src/utils/time.ts similarity index 100% rename from packages/core/src/utils-hoist/time.ts rename to packages/core/src/utils/time.ts diff --git a/packages/core/src/utils/traceData.ts b/packages/core/src/utils/traceData.ts index ada865ed396d..e65271cf5a23 100644 --- a/packages/core/src/utils/traceData.ts +++ b/packages/core/src/utils/traceData.ts @@ -7,10 +7,10 @@ import type { Scope } from '../scope'; import { getDynamicSamplingContextFromScope, getDynamicSamplingContextFromSpan } from '../tracing'; import type { Span } from '../types-hoist/span'; import type { SerializedTraceData } from '../types-hoist/tracing'; -import { dynamicSamplingContextToSentryBaggageHeader } from '../utils-hoist/baggage'; -import { logger } from '../utils-hoist/logger'; -import { generateSentryTraceHeader, TRACEPARENT_REGEXP } from '../utils-hoist/tracing'; +import { dynamicSamplingContextToSentryBaggageHeader } from './baggage'; +import { logger } from './logger'; import { getActiveSpan, spanToTraceHeader } from './spanUtils'; +import { generateSentryTraceHeader, TRACEPARENT_REGEXP } from './tracing'; /** * Extracts trace propagation data from the current span or from the client's scope (via transaction or propagation diff --git a/packages/core/src/utils-hoist/tracing.ts b/packages/core/src/utils/tracing.ts similarity index 98% rename from packages/core/src/utils-hoist/tracing.ts rename to packages/core/src/utils/tracing.ts index a3add28426f7..fe299d2d6338 100644 --- a/packages/core/src/utils-hoist/tracing.ts +++ b/packages/core/src/utils/tracing.ts @@ -1,8 +1,8 @@ import type { DynamicSamplingContext } from '../types-hoist/envelope'; import type { PropagationContext } from '../types-hoist/tracing'; import type { TraceparentData } from '../types-hoist/transaction'; -import { parseSampleRate } from '../utils/parseSampleRate'; import { baggageHeaderToDynamicSamplingContext } from './baggage'; +import { parseSampleRate } from './parseSampleRate'; import { generateSpanId, generateTraceId } from './propagationContext'; // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor -- RegExp is used for readability here diff --git a/packages/core/src/utils-hoist/url.ts b/packages/core/src/utils/url.ts similarity index 100% rename from packages/core/src/utils-hoist/url.ts rename to packages/core/src/utils/url.ts diff --git a/packages/core/src/utils-hoist/vercelWaitUntil.ts b/packages/core/src/utils/vercelWaitUntil.ts similarity index 100% rename from packages/core/src/utils-hoist/vercelWaitUntil.ts rename to packages/core/src/utils/vercelWaitUntil.ts diff --git a/packages/core/src/utils-hoist/version.ts b/packages/core/src/utils/version.ts similarity index 100% rename from packages/core/src/utils-hoist/version.ts rename to packages/core/src/utils/version.ts diff --git a/packages/core/src/utils-hoist/worldwide.ts b/packages/core/src/utils/worldwide.ts similarity index 100% rename from packages/core/src/utils-hoist/worldwide.ts rename to packages/core/src/utils/worldwide.ts diff --git a/packages/core/test/clear-global-scope.ts b/packages/core/test/clear-global-scope.ts new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/core/test/lib/api.test.ts b/packages/core/test/lib/api.test.ts index 647095a98842..be7dd70dd068 100644 --- a/packages/core/test/lib/api.test.ts +++ b/packages/core/test/lib/api.test.ts @@ -2,7 +2,7 @@ import { describe, expect, it, test } from 'vitest'; import { getEnvelopeEndpointWithUrlEncodedAuth, getReportDialogEndpoint } from '../../src/api'; import type { DsnComponents } from '../../src/types-hoist/dsn'; import type { SdkInfo } from '../../src/types-hoist/sdkinfo'; -import { makeDsn } from '../../src/utils-hoist/dsn'; +import { makeDsn } from '../../src/utils/dsn'; const ingestDsn = 'https://abc@xxxx.ingest.sentry.io:1234/subpath/123'; const dsnPublic = 'https://abc@sentry.io:1234/subpath/123'; diff --git a/packages/core/test/lib/attachments.test.ts b/packages/core/test/lib/attachments.test.ts index eab0927068fe..edab989af717 100644 --- a/packages/core/test/lib/attachments.test.ts +++ b/packages/core/test/lib/attachments.test.ts @@ -1,6 +1,6 @@ import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'; import { createTransport } from '../../src/transports/base'; -import { parseEnvelope } from '../../src/utils-hoist/envelope'; +import { parseEnvelope } from '../../src/utils/envelope'; import { getDefaultTestClientOptions, TestClient } from '../mocks/client'; describe('Attachments', () => { diff --git a/packages/core/test/lib/carrier.test.ts b/packages/core/test/lib/carrier.test.ts index 144355dc1d3b..792121310a71 100644 --- a/packages/core/test/lib/carrier.test.ts +++ b/packages/core/test/lib/carrier.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest'; import { getSentryCarrier } from '../../src/carrier'; -import { SDK_VERSION } from '../../src/utils-hoist/version'; +import { SDK_VERSION } from '../../src/utils/version'; describe('getSentryCarrier', () => { describe('base case (one SDK)', () => { diff --git a/packages/core/test/lib/clear-global-scope.ts b/packages/core/test/lib/clear-global-scope.ts deleted file mode 100644 index 8fa0340a22bb..000000000000 --- a/packages/core/test/lib/clear-global-scope.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { getSentryCarrier } from '../../src/carrier'; -import { GLOBAL_OBJ } from '../../src/utils-hoist/worldwide'; - -export function clearGlobalScope() { - const carrier = getSentryCarrier(GLOBAL_OBJ); - carrier.globalScope = undefined; -} diff --git a/packages/core/test/lib/client.test.ts b/packages/core/test/lib/client.test.ts index 07ce87fca3e2..844b49e4b55f 100644 --- a/packages/core/test/lib/client.test.ts +++ b/packages/core/test/lib/client.test.ts @@ -16,14 +16,14 @@ import * as integrationModule from '../../src/integration'; import type { Envelope } from '../../src/types-hoist/envelope'; import type { ErrorEvent, Event, TransactionEvent } from '../../src/types-hoist/event'; import type { SpanJSON } from '../../src/types-hoist/span'; -import * as loggerModule from '../../src/utils-hoist/logger'; -import * as miscModule from '../../src/utils-hoist/misc'; -import * as stringModule from '../../src/utils-hoist/string'; -import * as timeModule from '../../src/utils-hoist/time'; +import * as loggerModule from '../../src/utils/logger'; +import * as miscModule from '../../src/utils/misc'; +import * as stringModule from '../../src/utils/string'; +import * as timeModule from '../../src/utils/time'; import { getDefaultTestClientOptions, TestClient } from '../mocks/client'; import { AdHocIntegration, TestIntegration } from '../mocks/integration'; import { makeFakeTransport } from '../mocks/transport'; -import { clearGlobalScope } from './clear-global-scope'; +import { clearGlobalScope } from '../testutils'; const PUBLIC_DSN = 'https://username@domain/123'; // eslint-disable-next-line no-var diff --git a/packages/core/test/utils-hoist/instrument/fetch.test.ts b/packages/core/test/lib/instrument/fetch.test.ts similarity index 93% rename from packages/core/test/utils-hoist/instrument/fetch.test.ts rename to packages/core/test/lib/instrument/fetch.test.ts index 0f08d9f03c6e..0ad68cb53883 100644 --- a/packages/core/test/utils-hoist/instrument/fetch.test.ts +++ b/packages/core/test/lib/instrument/fetch.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest'; -import { parseFetchArgs } from '../../../src/utils-hoist/instrument/fetch'; +import { parseFetchArgs } from '../../../src/utils/instrument/fetch'; describe('instrument > parseFetchArgs', () => { it.each([ diff --git a/packages/core/test/lib/instrument.test.ts b/packages/core/test/lib/instrument/handlers.test.ts similarity index 83% rename from packages/core/test/lib/instrument.test.ts rename to packages/core/test/lib/instrument/handlers.test.ts index 458506517d01..87e227a99323 100644 --- a/packages/core/test/lib/instrument.test.ts +++ b/packages/core/test/lib/instrument/handlers.test.ts @@ -1,5 +1,5 @@ import { describe, test } from 'vitest'; -import { maybeInstrument } from '../../src/instrument/handlers'; +import { maybeInstrument } from '../../../src/instrument/handlers'; describe('maybeInstrument', () => { test('does not throw when instrumenting fails', () => { diff --git a/packages/core/test/lib/integration.test.ts b/packages/core/test/lib/integration.test.ts index 3e4c26e0b959..58fabde15ef7 100644 --- a/packages/core/test/lib/integration.test.ts +++ b/packages/core/test/lib/integration.test.ts @@ -4,7 +4,7 @@ import { addIntegration, getIntegrationsToSetup, installedIntegrations, setupInt import { setCurrentClient } from '../../src/sdk'; import type { Integration } from '../../src/types-hoist/integration'; import type { Options } from '../../src/types-hoist/options'; -import { logger } from '../../src/utils-hoist/logger'; +import { logger } from '../../src/utils/logger'; import { getDefaultTestClientOptions, TestClient } from '../mocks/client'; function getTestClient(): TestClient { diff --git a/packages/core/test/lib/integrations/captureconsole.test.ts b/packages/core/test/lib/integrations/captureconsole.test.ts index 8c4e1e55ccce..1de52ed1b21d 100644 --- a/packages/core/test/lib/integrations/captureconsole.test.ts +++ b/packages/core/test/lib/integrations/captureconsole.test.ts @@ -7,10 +7,10 @@ import * as SentryCore from '../../../src/exports'; import { captureConsoleIntegration } from '../../../src/integrations/captureconsole'; import type { Event } from '../../../src/types-hoist/event'; import type { ConsoleLevel } from '../../../src/types-hoist/instrument'; -import { addConsoleInstrumentationHandler } from '../../../src/utils-hoist/instrument/console'; -import { resetInstrumentationHandlers } from '../../../src/utils-hoist/instrument/handlers'; -import { CONSOLE_LEVELS, originalConsoleMethods } from '../../../src/utils-hoist/logger'; -import { GLOBAL_OBJ } from '../../../src/utils-hoist/worldwide'; +import { addConsoleInstrumentationHandler } from '../../../src/utils/instrument/console'; +import { resetInstrumentationHandlers } from '../../../src/utils/instrument/handlers'; +import { CONSOLE_LEVELS, originalConsoleMethods } from '../../../src/utils/logger'; +import { GLOBAL_OBJ } from '../../../src/utils/worldwide'; const mockConsole: { [key in ConsoleLevel]: Mock } = { debug: vi.fn(), diff --git a/packages/core/test/lib/integrations/third-party-errors-filter.test.ts b/packages/core/test/lib/integrations/third-party-errors-filter.test.ts index b9b705cc5cac..d68dbaeb5b56 100644 --- a/packages/core/test/lib/integrations/third-party-errors-filter.test.ts +++ b/packages/core/test/lib/integrations/third-party-errors-filter.test.ts @@ -3,9 +3,9 @@ import type { Client } from '../../../src/client'; import { thirdPartyErrorFilterIntegration } from '../../../src/integrations/third-party-errors-filter'; import { addMetadataToStackFrames } from '../../../src/metadata'; import type { Event } from '../../../src/types-hoist/event'; -import { nodeStackLineParser } from '../../../src/utils-hoist/node-stack-trace'; -import { createStackParser } from '../../../src/utils-hoist/stacktrace'; -import { GLOBAL_OBJ } from '../../../src/utils-hoist/worldwide'; +import { nodeStackLineParser } from '../../../src/utils/node-stack-trace'; +import { createStackParser } from '../../../src/utils/stacktrace'; +import { GLOBAL_OBJ } from '../../../src/utils/worldwide'; function clone(data: T): T { return JSON.parse(JSON.stringify(data)); diff --git a/packages/core/test/lib/logs/envelope.test.ts b/packages/core/test/lib/logs/envelope.test.ts index cd765cf018bc..7fbe1a439910 100644 --- a/packages/core/test/lib/logs/envelope.test.ts +++ b/packages/core/test/lib/logs/envelope.test.ts @@ -3,14 +3,14 @@ import { createLogContainerEnvelopeItem, createLogEnvelope } from '../../../src/ import type { DsnComponents } from '../../../src/types-hoist/dsn'; import type { SerializedLog } from '../../../src/types-hoist/log'; import type { SdkMetadata } from '../../../src/types-hoist/sdkmetadata'; -import * as utilsDsn from '../../../src/utils-hoist/dsn'; -import * as utilsEnvelope from '../../../src/utils-hoist/envelope'; +import * as utilsDsn from '../../../src/utils/dsn'; +import * as utilsEnvelope from '../../../src/utils/envelope'; -// Mock utils-hoist functions -vi.mock('../../../src/utils-hoist/dsn', () => ({ +// Mock utils functions +vi.mock('../../../src/utils/dsn', () => ({ dsnToString: vi.fn(dsn => `https://${dsn.publicKey}@${dsn.host}/`), })); -vi.mock('../../../src/utils-hoist/envelope', () => ({ +vi.mock('../../../src/utils/envelope', () => ({ createEnvelope: vi.fn((_headers, items) => [_headers, items]), })); diff --git a/packages/core/test/lib/logs/exports.test.ts b/packages/core/test/lib/logs/exports.test.ts index 3ba9f59b50d3..0dd73f064619 100644 --- a/packages/core/test/lib/logs/exports.test.ts +++ b/packages/core/test/lib/logs/exports.test.ts @@ -7,7 +7,7 @@ import { logAttributeToSerializedLogAttribute, } from '../../../src/logs/exports'; import type { Log } from '../../../src/types-hoist/log'; -import * as loggerModule from '../../../src/utils-hoist/logger'; +import * as loggerModule from '../../../src/utils/logger'; import { getDefaultTestClientOptions, TestClient } from '../../mocks/client'; const PUBLIC_DSN = 'https://username@domain/123'; diff --git a/packages/core/test/lib/metadata.test.ts b/packages/core/test/lib/metadata.test.ts index 87ffcc5284e0..bedf4cdcf7e9 100644 --- a/packages/core/test/lib/metadata.test.ts +++ b/packages/core/test/lib/metadata.test.ts @@ -1,9 +1,9 @@ import { beforeEach, describe, expect, it } from 'vitest'; import { addMetadataToStackFrames, getMetadataForUrl, stripMetadataFromStackFrames } from '../../src/metadata'; import type { Event } from '../../src/types-hoist/event'; -import { nodeStackLineParser } from '../../src/utils-hoist/node-stack-trace'; -import { createStackParser } from '../../src/utils-hoist/stacktrace'; -import { GLOBAL_OBJ } from '../../src/utils-hoist/worldwide'; +import { nodeStackLineParser } from '../../src/utils/node-stack-trace'; +import { createStackParser } from '../../src/utils/stacktrace'; +import { GLOBAL_OBJ } from '../../src/utils/worldwide'; const parser = createStackParser(nodeStackLineParser()); diff --git a/packages/core/test/lib/prepareEvent.test.ts b/packages/core/test/lib/prepareEvent.test.ts index 42279371dc30..d0fd86ae63f8 100644 --- a/packages/core/test/lib/prepareEvent.test.ts +++ b/packages/core/test/lib/prepareEvent.test.ts @@ -14,7 +14,7 @@ import { parseEventHintOrCaptureContext, prepareEvent, } from '../../src/utils/prepareEvent'; -import { clearGlobalScope } from './clear-global-scope'; +import { clearGlobalScope } from '../testutils'; describe('applyDebugIds', () => { afterEach(() => { diff --git a/packages/core/test/lib/scope.test.ts b/packages/core/test/lib/scope.test.ts index bac55994c199..280ba4c651ff 100644 --- a/packages/core/test/lib/scope.test.ts +++ b/packages/core/test/lib/scope.test.ts @@ -12,7 +12,7 @@ import type { Breadcrumb } from '../../src/types-hoist/breadcrumb'; import type { Event } from '../../src/types-hoist/event'; import { applyScopeDataToEvent } from '../../src/utils/applyScopeDataToEvent'; import { getDefaultTestClientOptions, TestClient } from '../mocks/client'; -import { clearGlobalScope } from './clear-global-scope'; +import { clearGlobalScope } from '../testutils'; describe('Scope', () => { beforeEach(() => { diff --git a/packages/core/test/lib/session.test.ts b/packages/core/test/lib/session.test.ts index 6744b2107e7b..9d6cfe06e426 100644 --- a/packages/core/test/lib/session.test.ts +++ b/packages/core/test/lib/session.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it, test } from 'vitest'; import { closeSession, makeSession, updateSession } from '../../src/session'; import type { SessionContext } from '../../src/types-hoist/session'; -import { timestampInSeconds } from '../../src/utils-hoist/time'; +import { timestampInSeconds } from '../../src/utils/time'; describe('Session', () => { it('initializes with the proper defaults', () => { diff --git a/packages/core/test/lib/tracing/errors.test.ts b/packages/core/test/lib/tracing/errors.test.ts index cadc8b79219b..2dd11ee03a41 100644 --- a/packages/core/test/lib/tracing/errors.test.ts +++ b/packages/core/test/lib/tracing/errors.test.ts @@ -2,8 +2,8 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'; import { setCurrentClient, spanToJSON, startInactiveSpan, startSpan } from '../../../src'; import { _resetErrorsInstrumented, registerSpanErrorInstrumentation } from '../../../src/tracing/errors'; import type { HandlerDataError, HandlerDataUnhandledRejection } from '../../../src/types-hoist/instrument'; -import * as globalErrorModule from '../../../src/utils-hoist/instrument/globalError'; -import * as globalUnhandledRejectionModule from '../../../src/utils-hoist/instrument/globalUnhandledRejection'; +import * as globalErrorModule from '../../../src/utils/instrument/globalError'; +import * as globalUnhandledRejectionModule from '../../../src/utils/instrument/globalUnhandledRejection'; import { getDefaultTestClientOptions, TestClient } from '../../mocks/client'; let mockErrorCallback: (data: HandlerDataError) => void = () => {}; diff --git a/packages/core/test/lib/tracing/sentrySpan.test.ts b/packages/core/test/lib/tracing/sentrySpan.test.ts index a63e161e5ada..601e25be0d23 100644 --- a/packages/core/test/lib/tracing/sentrySpan.test.ts +++ b/packages/core/test/lib/tracing/sentrySpan.test.ts @@ -6,7 +6,7 @@ import { SentrySpan } from '../../../src/tracing/sentrySpan'; import { SPAN_STATUS_ERROR } from '../../../src/tracing/spanstatus'; import type { SpanJSON } from '../../../src/types-hoist/span'; import { spanToJSON, TRACE_FLAG_NONE, TRACE_FLAG_SAMPLED } from '../../../src/utils/spanUtils'; -import { timestampInSeconds } from '../../../src/utils-hoist/time'; +import { timestampInSeconds } from '../../../src/utils/time'; import { getDefaultTestClientOptions, TestClient } from '../../mocks/client'; describe('SentrySpan', () => { diff --git a/packages/core/test/lib/transports/base.test.ts b/packages/core/test/lib/transports/base.test.ts index af3655d89972..ef2220ac1f8b 100644 --- a/packages/core/test/lib/transports/base.test.ts +++ b/packages/core/test/lib/transports/base.test.ts @@ -2,9 +2,9 @@ import { describe, expect, it, vi } from 'vitest'; import { createTransport } from '../../../src/transports/base'; import type { AttachmentItem, EventEnvelope, EventItem } from '../../../src/types-hoist/envelope'; import type { TransportMakeRequestResponse } from '../../../src/types-hoist/transport'; -import { createEnvelope, serializeEnvelope } from '../../../src/utils-hoist/envelope'; -import type { PromiseBuffer } from '../../../src/utils-hoist/promisebuffer'; -import { resolvedSyncPromise } from '../../../src/utils-hoist/syncpromise'; +import { createEnvelope, serializeEnvelope } from '../../../src/utils/envelope'; +import type { PromiseBuffer } from '../../../src/utils/promisebuffer'; +import { resolvedSyncPromise } from '../../../src/utils/syncpromise'; const ERROR_ENVELOPE = createEnvelope({ event_id: 'aa3ff046696b4bc6b609ce6d28fde9e2', sent_at: '123' }, [ [{ type: 'event' }, { event_id: 'aa3ff046696b4bc6b609ce6d28fde9e2' }] as EventItem, diff --git a/packages/core/test/utils-hoist/aggregate-errors.test.ts b/packages/core/test/lib/utils/aggregate-errors.test.ts similarity index 95% rename from packages/core/test/utils-hoist/aggregate-errors.test.ts rename to packages/core/test/lib/utils/aggregate-errors.test.ts index 007d81678082..01ede6d9186a 100644 --- a/packages/core/test/utils-hoist/aggregate-errors.test.ts +++ b/packages/core/test/lib/utils/aggregate-errors.test.ts @@ -1,10 +1,10 @@ import { describe, expect, test } from 'vitest'; -import type { ExtendedError } from '../../src/types-hoist/error'; -import type { Event, EventHint } from '../../src/types-hoist/event'; -import type { Exception } from '../../src/types-hoist/exception'; -import type { StackParser } from '../../src/types-hoist/stacktrace'; -import { applyAggregateErrorsToEvent } from '../../src/utils-hoist/aggregate-errors'; -import { createStackParser } from '../../src/utils-hoist/stacktrace'; +import type { ExtendedError } from '../../../src/types-hoist/error'; +import type { Event, EventHint } from '../../../src/types-hoist/event'; +import type { Exception } from '../../../src/types-hoist/exception'; +import type { StackParser } from '../../../src/types-hoist/stacktrace'; +import { applyAggregateErrorsToEvent } from '../../../src/utils/aggregate-errors'; +import { createStackParser } from '../../../src/utils/stacktrace'; const stackParser = createStackParser([0, line => ({ filename: line })]); const exceptionFromError = (_stackParser: StackParser, ex: Error): Exception => { diff --git a/packages/core/test/utils-hoist/baggage.test.ts b/packages/core/test/lib/utils/baggage.test.ts similarity index 98% rename from packages/core/test/utils-hoist/baggage.test.ts rename to packages/core/test/lib/utils/baggage.test.ts index c05ac0d5dd96..4816a3fbf079 100644 --- a/packages/core/test/utils-hoist/baggage.test.ts +++ b/packages/core/test/lib/utils/baggage.test.ts @@ -3,7 +3,7 @@ import { baggageHeaderToDynamicSamplingContext, dynamicSamplingContextToSentryBaggageHeader, parseBaggageHeader, -} from '../../src/utils-hoist/baggage'; +} from '../../../src/utils/baggage'; test.each([ ['', undefined], diff --git a/packages/core/test/utils-hoist/breadcrumb-log-level.test.ts b/packages/core/test/lib/utils/breadcrumb-log-level.test.ts similarity index 82% rename from packages/core/test/utils-hoist/breadcrumb-log-level.test.ts rename to packages/core/test/lib/utils/breadcrumb-log-level.test.ts index 86062e025f37..506567c72b8b 100644 --- a/packages/core/test/utils-hoist/breadcrumb-log-level.test.ts +++ b/packages/core/test/lib/utils/breadcrumb-log-level.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest'; -import { getBreadcrumbLogLevelFromHttpStatusCode } from '../../src/utils-hoist/breadcrumb-log-level'; +import { getBreadcrumbLogLevelFromHttpStatusCode } from '../../../src/utils/breadcrumb-log-level'; describe('getBreadcrumbLogLevelFromHttpStatusCode()', () => { it.each([ diff --git a/packages/core/test/utils-hoist/browser.test.ts b/packages/core/test/lib/utils/browser.test.ts similarity index 97% rename from packages/core/test/utils-hoist/browser.test.ts rename to packages/core/test/lib/utils/browser.test.ts index d7fc8aab022c..0bcf71884482 100644 --- a/packages/core/test/utils-hoist/browser.test.ts +++ b/packages/core/test/lib/utils/browser.test.ts @@ -1,6 +1,6 @@ import { JSDOM } from 'jsdom'; import { beforeAll, beforeEach, describe, expect, it } from 'vitest'; -import { htmlTreeAsString } from '../../src/utils-hoist/browser'; +import { htmlTreeAsString } from '../../../src/utils/browser'; beforeAll(() => { const dom = new JSDOM(); diff --git a/packages/core/test/utils-hoist/clientreport.test.ts b/packages/core/test/lib/utils/clientreport.test.ts similarity index 88% rename from packages/core/test/utils-hoist/clientreport.test.ts rename to packages/core/test/lib/utils/clientreport.test.ts index 49f6a67b35cb..8acc9c9d8dc0 100644 --- a/packages/core/test/utils-hoist/clientreport.test.ts +++ b/packages/core/test/lib/utils/clientreport.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from 'vitest'; -import type { ClientReport } from '../../src/types-hoist/clientreport'; -import { createClientReportEnvelope } from '../../src/utils-hoist/clientreport'; -import { parseEnvelope, serializeEnvelope } from '../../src/utils-hoist/envelope'; +import type { ClientReport } from '../../../src/types-hoist/clientreport'; +import { createClientReportEnvelope } from '../../../src/utils/clientreport'; +import { parseEnvelope, serializeEnvelope } from '../../../src/utils/envelope'; const DEFAULT_DISCARDED_EVENTS: ClientReport['discarded_events'] = [ { diff --git a/packages/core/test/utils-hoist/dsn.test.ts b/packages/core/test/lib/utils/dsn.test.ts similarity index 98% rename from packages/core/test/utils-hoist/dsn.test.ts rename to packages/core/test/lib/utils/dsn.test.ts index b5d22130816b..3dc081866703 100644 --- a/packages/core/test/utils-hoist/dsn.test.ts +++ b/packages/core/test/lib/utils/dsn.test.ts @@ -1,7 +1,7 @@ import { beforeEach, describe, expect, it, test, vi } from 'vitest'; -import { DEBUG_BUILD } from '../../src/debug-build'; -import { dsnToString, extractOrgIdFromDsnHost, makeDsn } from '../../src/utils-hoist/dsn'; -import { logger } from '../../src/utils-hoist/logger'; +import { DEBUG_BUILD } from '../../../src/debug-build'; +import { dsnToString, extractOrgIdFromDsnHost, makeDsn } from '../../../src/utils/dsn'; +import { logger } from '../../../src/utils/logger'; function testIf(condition: boolean) { return condition ? test : test.skip; diff --git a/packages/core/test/utils-hoist/envelope.test.ts b/packages/core/test/lib/utils/envelope.test.ts similarity index 94% rename from packages/core/test/utils-hoist/envelope.test.ts rename to packages/core/test/lib/utils/envelope.test.ts index 00a745807fcd..88f1a25047e4 100644 --- a/packages/core/test/utils-hoist/envelope.test.ts +++ b/packages/core/test/lib/utils/envelope.test.ts @@ -6,10 +6,10 @@ import { spanToJSON, } from '@sentry/core'; import { afterEach, describe, expect, it, test, vi } from 'vitest'; -import { getSentryCarrier } from '../../src/carrier'; -import type { EventEnvelope } from '../../src/types-hoist/envelope'; -import type { Event } from '../../src/types-hoist/event'; -import type { SpanAttributes } from '../../src/types-hoist/span'; +import { getSentryCarrier } from '../../../src/carrier'; +import type { EventEnvelope } from '../../../src/types-hoist/envelope'; +import type { Event } from '../../../src/types-hoist/event'; +import type { SpanAttributes } from '../../../src/types-hoist/span'; import { addItemToEnvelope, createEnvelope, @@ -17,9 +17,9 @@ import { forEachEnvelopeItem, parseEnvelope, serializeEnvelope, -} from '../../src/utils-hoist/envelope'; -import type { InternalGlobal } from '../../src/utils-hoist/worldwide'; -import { GLOBAL_OBJ } from '../../src/utils-hoist/worldwide'; +} from '../../src/utils/envelope'; +import type { InternalGlobal } from '../../src/utils/worldwide'; +import { GLOBAL_OBJ } from '../../src/utils/worldwide'; describe('envelope', () => { describe('createSpanEnvelope()', () => { diff --git a/packages/core/test/utils-hoist/eventbuilder.test.ts b/packages/core/test/lib/utils/eventbuilder.test.ts similarity index 96% rename from packages/core/test/utils-hoist/eventbuilder.test.ts rename to packages/core/test/lib/utils/eventbuilder.test.ts index 877df25d8fed..5fa795c9d239 100644 --- a/packages/core/test/utils-hoist/eventbuilder.test.ts +++ b/packages/core/test/lib/utils/eventbuilder.test.ts @@ -1,8 +1,8 @@ import { describe, expect, it, test } from 'vitest'; -import type { Client } from '../../src/client'; -import { eventFromMessage, eventFromUnknownInput } from '../../src/utils-hoist/eventbuilder'; -import { nodeStackLineParser } from '../../src/utils-hoist/node-stack-trace'; -import { createStackParser } from '../../src/utils-hoist/stacktrace'; +import type { Client } from '../../../src/client'; +import { eventFromMessage, eventFromUnknownInput } from '../../src/utils/eventbuilder'; +import { nodeStackLineParser } from '../../src/utils/node-stack-trace'; +import { createStackParser } from '../../src/utils/stacktrace'; const stackParser = createStackParser(nodeStackLineParser()); diff --git a/packages/core/test/lib/utils/featureFlags.test.ts b/packages/core/test/lib/utils/featureFlags.test.ts index 14258c2caf36..8f6e512bca7b 100644 --- a/packages/core/test/lib/utils/featureFlags.test.ts +++ b/packages/core/test/lib/utils/featureFlags.test.ts @@ -5,7 +5,7 @@ import { _INTERNAL_insertFlagToScope, _INTERNAL_insertToFlagBuffer, } from '../../../src/utils/featureFlags'; -import { logger } from '../../../src/utils-hoist/logger'; +import { logger } from '../../../src/utils/logger'; describe('flags', () => { describe('insertFlagToScope()', () => { diff --git a/packages/core/test/utils-hoist/is.test.ts b/packages/core/test/lib/utils/is.test.ts similarity index 95% rename from packages/core/test/utils-hoist/is.test.ts rename to packages/core/test/lib/utils/is.test.ts index 70a83eee5efd..5e426a8bc055 100644 --- a/packages/core/test/utils-hoist/is.test.ts +++ b/packages/core/test/lib/utils/is.test.ts @@ -9,10 +9,10 @@ import { isPrimitive, isThenable, isVueViewModel, -} from '../../src/utils-hoist/is'; -import { supportsDOMError, supportsDOMException, supportsErrorEvent } from '../../src/utils-hoist/supports'; -import { resolvedSyncPromise } from '../../src/utils-hoist/syncpromise'; -import { testOnlyIfNodeVersionAtLeast } from './testutils'; +} from '../../src/utils/is'; +import { supportsDOMError, supportsDOMException, supportsErrorEvent } from '../../src/utils/supports'; +import { resolvedSyncPromise } from '../../src/utils/syncpromise'; +import { testOnlyIfNodeVersionAtLeast } from '../../testutils'; if (supportsDOMError()) { describe('isDOMError()', () => { diff --git a/packages/core/test/utils-hoist/lru.test.ts b/packages/core/test/lib/utils/lru.test.ts similarity index 94% rename from packages/core/test/utils-hoist/lru.test.ts rename to packages/core/test/lib/utils/lru.test.ts index 28259a2700ad..506dff6ae040 100644 --- a/packages/core/test/utils-hoist/lru.test.ts +++ b/packages/core/test/lib/utils/lru.test.ts @@ -1,5 +1,5 @@ import { describe, expect, test } from 'vitest'; -import { LRUMap } from '../../src/utils-hoist/lru'; +import { LRUMap } from '../../src/utils/lru'; describe('LRUMap', () => { test('evicts older entries when reaching max size', () => { diff --git a/packages/core/test/utils-hoist/misc.test.ts b/packages/core/test/lib/utils/misc.test.ts similarity index 97% rename from packages/core/test/utils-hoist/misc.test.ts rename to packages/core/test/lib/utils/misc.test.ts index 6aece21ecb81..c6e4fb7861a6 100644 --- a/packages/core/test/utils-hoist/misc.test.ts +++ b/packages/core/test/lib/utils/misc.test.ts @@ -1,14 +1,14 @@ import { describe, expect, it, test } from 'vitest'; -import type { Event } from '../../src/types-hoist/event'; -import type { Mechanism } from '../../src/types-hoist/mechanism'; -import type { StackFrame } from '../../src/types-hoist/stackframe'; +import type { Event } from '../../../src/types-hoist/event'; +import type { Mechanism } from '../../../src/types-hoist/mechanism'; +import type { StackFrame } from '../../../src/types-hoist/stackframe'; import { addContextToFrame, addExceptionMechanism, checkOrSetAlreadyCaught, getEventDescription, uuid4, -} from '../../src/utils-hoist/misc'; +} from '../../src/utils/misc'; describe('getEventDescription()', () => { test('message event', () => { diff --git a/packages/core/test/utils-hoist/normalize-url.test.ts b/packages/core/test/lib/utils/normalize-url.test.ts similarity index 97% rename from packages/core/test/utils-hoist/normalize-url.test.ts rename to packages/core/test/lib/utils/normalize-url.test.ts index 0e8b5d787601..100cdccbf66a 100644 --- a/packages/core/test/utils-hoist/normalize-url.test.ts +++ b/packages/core/test/lib/utils/normalize-url.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest'; -import { normalizeUrlToBase } from '../../src/utils-hoist/normalize'; +import { normalizeUrlToBase } from '../../src/utils/normalize'; describe('normalizeUrlToBase()', () => { it('Example app on Windows', () => { diff --git a/packages/core/test/utils-hoist/normalize.test.ts b/packages/core/test/lib/utils/normalize.test.ts similarity index 99% rename from packages/core/test/utils-hoist/normalize.test.ts rename to packages/core/test/lib/utils/normalize.test.ts index e08c7187c839..6dbabbe2d7d2 100644 --- a/packages/core/test/utils-hoist/normalize.test.ts +++ b/packages/core/test/lib/utils/normalize.test.ts @@ -3,9 +3,9 @@ */ import { describe, expect, test, vi } from 'vitest'; -import { addNonEnumerableProperty, normalize } from '../../src'; -import * as isModule from '../../src/utils-hoist/is'; -import * as stacktraceModule from '../../src/utils-hoist/stacktrace'; +import { addNonEnumerableProperty, normalize } from '../../../src'; +import * as isModule from '../../src/utils/is'; +import * as stacktraceModule from '../../src/utils/stacktrace'; describe('normalize()', () => { describe('acts as a pass-through for simple-cases', () => { diff --git a/packages/core/test/utils-hoist/object.test.ts b/packages/core/test/lib/utils/object.test.ts similarity index 98% rename from packages/core/test/utils-hoist/object.test.ts rename to packages/core/test/lib/utils/object.test.ts index c6c5d05b6af0..647b36366335 100644 --- a/packages/core/test/utils-hoist/object.test.ts +++ b/packages/core/test/lib/utils/object.test.ts @@ -3,7 +3,7 @@ */ import { describe, expect, it, test, vi } from 'vitest'; -import type { WrappedFunction } from '../../src/types-hoist/wrappedfunction'; +import type { WrappedFunction } from '../../../src/types-hoist/wrappedfunction'; import { addNonEnumerableProperty, dropUndefinedKeys, @@ -11,8 +11,8 @@ import { fill, markFunctionWrapped, objectify, -} from '../../src/utils-hoist/object'; -import { testOnlyIfNodeVersionAtLeast } from './testutils'; +} from '../../src/utils/object'; +import { testOnlyIfNodeVersionAtLeast } from '../../testutils'; describe('fill()', () => { test('wraps a method by calling a replacement function on it', () => { diff --git a/packages/core/test/utils-hoist/path.test.ts b/packages/core/test/lib/utils/path.test.ts similarity index 95% rename from packages/core/test/utils-hoist/path.test.ts rename to packages/core/test/lib/utils/path.test.ts index 6cd760ac84aa..84e2b0ca6180 100644 --- a/packages/core/test/utils-hoist/path.test.ts +++ b/packages/core/test/lib/utils/path.test.ts @@ -1,5 +1,5 @@ import { describe, expect, test } from 'vitest'; -import { basename, dirname } from '../../src/utils-hoist/path'; +import { basename, dirname } from '../../src/utils/path'; describe('path', () => { describe('basename', () => { diff --git a/packages/core/test/utils-hoist/promisebuffer.test.ts b/packages/core/test/lib/utils/promisebuffer.test.ts similarity index 96% rename from packages/core/test/utils-hoist/promisebuffer.test.ts rename to packages/core/test/lib/utils/promisebuffer.test.ts index 6b0b81d1588e..ef22fe2df2f2 100644 --- a/packages/core/test/utils-hoist/promisebuffer.test.ts +++ b/packages/core/test/lib/utils/promisebuffer.test.ts @@ -1,6 +1,6 @@ import { describe, expect, test, vi } from 'vitest'; -import { makePromiseBuffer } from '../../src/utils-hoist/promisebuffer'; -import { SyncPromise } from '../../src/utils-hoist/syncpromise'; +import { makePromiseBuffer } from '../../src/utils/promisebuffer'; +import { SyncPromise } from '../../src/utils/syncpromise'; describe('PromiseBuffer', () => { describe('add()', () => { diff --git a/packages/core/test/utils-hoist/ratelimit.test.ts b/packages/core/test/lib/utils/ratelimit.test.ts similarity index 98% rename from packages/core/test/utils-hoist/ratelimit.test.ts rename to packages/core/test/lib/utils/ratelimit.test.ts index 556280b93ba4..8efdd8d5bc33 100644 --- a/packages/core/test/utils-hoist/ratelimit.test.ts +++ b/packages/core/test/lib/utils/ratelimit.test.ts @@ -1,12 +1,12 @@ import { describe, expect, test } from 'vitest'; -import type { RateLimits } from '../../src/utils-hoist/ratelimit'; +import type { RateLimits } from '../../src/utils/ratelimit'; import { DEFAULT_RETRY_AFTER, disabledUntil, isRateLimited, parseRetryAfterHeader, updateRateLimits, -} from '../../src/utils-hoist/ratelimit'; +} from '../../src/utils/ratelimit'; describe('parseRetryAfterHeader()', () => { test('should fallback to 60s when incorrect header provided', () => { diff --git a/packages/core/test/utils-hoist/severity.test.ts b/packages/core/test/lib/utils/severity.test.ts similarity index 87% rename from packages/core/test/utils-hoist/severity.test.ts rename to packages/core/test/lib/utils/severity.test.ts index 2f5595dfc9f0..9431240f11ce 100644 --- a/packages/core/test/utils-hoist/severity.test.ts +++ b/packages/core/test/lib/utils/severity.test.ts @@ -1,5 +1,5 @@ import { describe, expect, test } from 'vitest'; -import { severityLevelFromString } from '../../src/utils-hoist/severity'; +import { severityLevelFromString } from '../../src/utils/severity'; describe('severityLevelFromString()', () => { test("converts 'warn' to 'warning'", () => { diff --git a/packages/core/test/utils-hoist/stacktrace.test.ts b/packages/core/test/lib/utils/stacktrace.test.ts similarity index 98% rename from packages/core/test/utils-hoist/stacktrace.test.ts rename to packages/core/test/lib/utils/stacktrace.test.ts index cfcc70819fa0..a8088997cda9 100644 --- a/packages/core/test/utils-hoist/stacktrace.test.ts +++ b/packages/core/test/lib/utils/stacktrace.test.ts @@ -1,6 +1,6 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'; -import { nodeStackLineParser } from '../../src/utils-hoist/node-stack-trace'; -import { stripSentryFramesAndReverse } from '../../src/utils-hoist/stacktrace'; +import { nodeStackLineParser } from '../../src/utils/node-stack-trace'; +import { stripSentryFramesAndReverse } from '../../src/utils/stacktrace'; describe('Stacktrace', () => { describe('stripSentryFramesAndReverse()', () => { diff --git a/packages/core/test/utils-hoist/string.test.ts b/packages/core/test/lib/utils/string.test.ts similarity index 99% rename from packages/core/test/utils-hoist/string.test.ts rename to packages/core/test/lib/utils/string.test.ts index 364d29223a66..067518110e45 100644 --- a/packages/core/test/utils-hoist/string.test.ts +++ b/packages/core/test/lib/utils/string.test.ts @@ -1,5 +1,5 @@ import { describe, expect, test } from 'vitest'; -import { isMatchingPattern, stringMatchesSomePattern, truncate } from '../../src/utils-hoist/string'; +import { isMatchingPattern, stringMatchesSomePattern, truncate } from '../../src/utils/string'; describe('truncate()', () => { test('it works as expected', () => { diff --git a/packages/core/test/utils-hoist/supports.test.ts b/packages/core/test/lib/utils/supports.test.ts similarity index 93% rename from packages/core/test/utils-hoist/supports.test.ts rename to packages/core/test/lib/utils/supports.test.ts index fffc6be02e1e..28a75dc0e7bf 100644 --- a/packages/core/test/utils-hoist/supports.test.ts +++ b/packages/core/test/lib/utils/supports.test.ts @@ -1,6 +1,6 @@ import { afterEach } from 'node:test'; import { describe, expect, it } from 'vitest'; -import { supportsHistory } from '../../src/utils-hoist/supports'; +import { supportsHistory } from '../../src/utils/supports'; describe('supportsHistory', () => { const originalHistory = globalThis.history; diff --git a/packages/core/test/utils-hoist/syncpromise.test.ts b/packages/core/test/lib/utils/syncpromise.test.ts similarity index 99% rename from packages/core/test/utils-hoist/syncpromise.test.ts rename to packages/core/test/lib/utils/syncpromise.test.ts index e332de2c2141..21b966a053c4 100644 --- a/packages/core/test/utils-hoist/syncpromise.test.ts +++ b/packages/core/test/lib/utils/syncpromise.test.ts @@ -1,5 +1,5 @@ import { describe, expect, test, vi } from 'vitest'; -import { rejectedSyncPromise, resolvedSyncPromise, SyncPromise } from '../../src/utils-hoist/syncpromise'; +import { rejectedSyncPromise, resolvedSyncPromise, SyncPromise } from '../../src/utils/syncpromise'; describe('SyncPromise', () => { test('simple', async () => { diff --git a/packages/core/test/utils-hoist/tracing.test.ts b/packages/core/test/lib/utils/tracing.test.ts similarity index 99% rename from packages/core/test/utils-hoist/tracing.test.ts rename to packages/core/test/lib/utils/tracing.test.ts index 851ee7b109c4..6d90e0ce21e7 100644 --- a/packages/core/test/utils-hoist/tracing.test.ts +++ b/packages/core/test/lib/utils/tracing.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it, test } from 'vitest'; -import { extractTraceparentData, propagationContextFromHeaders } from '../../src/utils-hoist/tracing'; +import { extractTraceparentData, propagationContextFromHeaders } from '../../src/utils/tracing'; const EXAMPLE_SENTRY_TRACE = '12312012123120121231201212312012-1121201211212012-1'; const EXAMPLE_BAGGAGE = 'sentry-release=1.2.3,sentry-foo=bar,other=baz,sentry-sample_rand=0.42'; diff --git a/packages/core/test/utils-hoist/url.test.ts b/packages/core/test/lib/utils/url.test.ts similarity index 99% rename from packages/core/test/utils-hoist/url.test.ts rename to packages/core/test/lib/utils/url.test.ts index 67ec8b31644f..93131be30720 100644 --- a/packages/core/test/utils-hoist/url.test.ts +++ b/packages/core/test/lib/utils/url.test.ts @@ -7,7 +7,7 @@ import { parseStringToURLObject, parseUrl, stripUrlQueryAndFragment, -} from '../../src/utils-hoist/url'; +} from '../../src/utils/url'; describe('stripQueryStringAndFragment', () => { const urlString = 'http://dogs.are.great:1231/yay/'; diff --git a/packages/core/test/utils-hoist/vercelWaitUntil.test.ts b/packages/core/test/lib/utils/vercelWaitUntil.test.ts similarity index 90% rename from packages/core/test/utils-hoist/vercelWaitUntil.test.ts rename to packages/core/test/lib/utils/vercelWaitUntil.test.ts index c35b5f076cd4..c0bc135169f8 100644 --- a/packages/core/test/utils-hoist/vercelWaitUntil.test.ts +++ b/packages/core/test/lib/utils/vercelWaitUntil.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it, vi } from 'vitest'; -import { vercelWaitUntil } from '../../src/utils-hoist/vercelWaitUntil'; -import { GLOBAL_OBJ } from '../../src/utils-hoist/worldwide'; +import { vercelWaitUntil } from '../../src/utils/vercelWaitUntil'; +import { GLOBAL_OBJ } from '../../src/utils/worldwide'; describe('vercelWaitUntil', () => { it('should do nothing if GLOBAL_OBJ does not have the @vercel/request-context symbol', () => { diff --git a/packages/core/test/utils-hoist/worldwide.test.ts b/packages/core/test/lib/utils/worldwide.test.ts similarity index 85% rename from packages/core/test/utils-hoist/worldwide.test.ts rename to packages/core/test/lib/utils/worldwide.test.ts index efd8a152a0ab..3f80a670da54 100644 --- a/packages/core/test/utils-hoist/worldwide.test.ts +++ b/packages/core/test/lib/utils/worldwide.test.ts @@ -1,5 +1,5 @@ import { describe, expect, test } from 'vitest'; -import { GLOBAL_OBJ } from '../../src/utils-hoist/worldwide'; +import { GLOBAL_OBJ } from '../../src/utils/worldwide'; describe('GLOBAL_OBJ', () => { test('should return the same object', () => { diff --git a/packages/core/test/mocks/client.ts b/packages/core/test/mocks/client.ts index 811046972675..2b7162a112b5 100644 --- a/packages/core/test/mocks/client.ts +++ b/packages/core/test/mocks/client.ts @@ -8,7 +8,7 @@ import type { ClientOptions } from '../../src/types-hoist/options'; import type { ParameterizedString } from '../../src/types-hoist/parameterize'; import type { Session } from '../../src/types-hoist/session'; import type { SeverityLevel } from '../../src/types-hoist/severity'; -import { resolvedSyncPromise } from '../../src/utils-hoist/syncpromise'; +import { resolvedSyncPromise } from '../../src/utils/syncpromise'; export function getDefaultTestClientOptions(options: Partial = {}): TestClientOptions { return { diff --git a/packages/core/test/mocks/transport.ts b/packages/core/test/mocks/transport.ts index ba49025ce5d7..c8ae84f80d64 100644 --- a/packages/core/test/mocks/transport.ts +++ b/packages/core/test/mocks/transport.ts @@ -1,6 +1,6 @@ import { createTransport } from '../../src/transports/base'; import type { Transport } from '../../src/types-hoist/transport'; -import { SyncPromise } from '../../src/utils-hoist/syncpromise'; +import { SyncPromise } from '../../src/utils/syncpromise'; async function sleep(delay: number): Promise { return new SyncPromise(resolve => setTimeout(resolve, delay)); diff --git a/packages/core/test/utils-hoist/testutils.ts b/packages/core/test/testutils.ts similarity index 64% rename from packages/core/test/utils-hoist/testutils.ts rename to packages/core/test/testutils.ts index b830095d3393..942c0d4bdd32 100644 --- a/packages/core/test/utils-hoist/testutils.ts +++ b/packages/core/test/testutils.ts @@ -1,4 +1,6 @@ import { it } from 'vitest'; +import { GLOBAL_OBJ } from '../../src/utils/worldwide'; +import { getSentryCarrier } from '../src/carrier'; // eslint-disable-next-line @typescript-eslint/ban-types export const testOnlyIfNodeVersionAtLeast = (minVersion: number): Function => { @@ -14,3 +16,8 @@ export const testOnlyIfNodeVersionAtLeast = (minVersion: number): Function => { return it; }; + +export function clearGlobalScope() { + const carrier = getSentryCarrier(GLOBAL_OBJ); + carrier.globalScope = undefined; +} diff --git a/packages/core/test/utils-hoist/types/typedef.test.ts b/packages/core/test/types/typedef.test.ts similarity index 100% rename from packages/core/test/utils-hoist/types/typedef.test.ts rename to packages/core/test/types/typedef.test.ts From b14c18f1ab7bcdf33e25f5894da6846cd4bd6a62 Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Wed, 18 Jun 2025 13:04:18 +0200 Subject: [PATCH 4/5] fix tests --- packages/core/src/index.ts | 14 ++------------ .../core/src/tracing/dynamicSamplingContext.ts | 5 +---- packages/core/test/lib/instrument/fetch.test.ts | 2 +- .../test/lib/integrations/captureconsole.test.ts | 4 ++-- packages/core/test/lib/tracing/errors.test.ts | 4 ++-- packages/core/test/lib/utils/envelope.test.ts | 6 +++--- packages/core/test/lib/utils/eventbuilder.test.ts | 6 +++--- packages/core/test/lib/utils/is.test.ts | 6 +++--- packages/core/test/lib/utils/lru.test.ts | 2 +- packages/core/test/lib/utils/misc.test.ts | 2 +- packages/core/test/lib/utils/normalize-url.test.ts | 2 +- packages/core/test/lib/utils/normalize.test.ts | 4 ++-- packages/core/test/lib/utils/object.test.ts | 2 +- packages/core/test/lib/utils/path.test.ts | 2 +- packages/core/test/lib/utils/promisebuffer.test.ts | 4 ++-- packages/core/test/lib/utils/ratelimit.test.ts | 4 ++-- packages/core/test/lib/utils/severity.test.ts | 2 +- packages/core/test/lib/utils/stacktrace.test.ts | 4 ++-- packages/core/test/lib/utils/string.test.ts | 2 +- packages/core/test/lib/utils/supports.test.ts | 2 +- packages/core/test/lib/utils/syncpromise.test.ts | 2 +- packages/core/test/lib/utils/tracing.test.ts | 2 +- packages/core/test/lib/utils/url.test.ts | 2 +- .../core/test/lib/utils/vercelWaitUntil.test.ts | 4 ++-- packages/core/test/lib/utils/worldwide.test.ts | 2 +- packages/core/test/testutils.ts | 2 +- 26 files changed, 40 insertions(+), 53 deletions(-) diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index cdde920ec3ca..b4f09d89f381 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -145,12 +145,7 @@ export { addConsoleInstrumentationHandler } from './instrument/console'; export { addFetchEndInstrumentationHandler, addFetchInstrumentationHandler } from './instrument/fetch'; export { addGlobalErrorInstrumentationHandler } from './instrument/globalError'; export { addGlobalUnhandledRejectionInstrumentationHandler } from './instrument/globalUnhandledRejection'; -export { - addHandler, - maybeInstrument, - resetInstrumentationHandlers, - triggerHandlers, -} from './instrument/handlers'; +export { addHandler, maybeInstrument, resetInstrumentationHandlers, triggerHandlers } from './instrument/handlers'; export { isDOMError, isDOMException, @@ -270,12 +265,7 @@ export { isURLObjectRelative, getSanitizedUrlStringFromUrlObject, } from './utils/url'; -export { - eventFromMessage, - eventFromUnknownInput, - exceptionFromError, - parseStackFrames, -} from './utils/eventbuilder'; +export { eventFromMessage, eventFromUnknownInput, exceptionFromError, parseStackFrames } from './utils/eventbuilder'; export { callFrameToStackFrame, watchdogTimer } from './utils/anr'; export { LRUMap } from './utils/lru'; export { generateTraceId, generateSpanId } from './utils/propagationContext'; diff --git a/packages/core/src/tracing/dynamicSamplingContext.ts b/packages/core/src/tracing/dynamicSamplingContext.ts index 4c7d0e15bd4e..adbcf0ae032a 100644 --- a/packages/core/src/tracing/dynamicSamplingContext.ts +++ b/packages/core/src/tracing/dynamicSamplingContext.ts @@ -9,10 +9,7 @@ import { } from '../semanticAttributes'; import type { DynamicSamplingContext } from '../types-hoist/envelope'; import type { Span } from '../types-hoist/span'; -import { - baggageHeaderToDynamicSamplingContext, - dynamicSamplingContextToSentryBaggageHeader, -} from '../utils/baggage'; +import { baggageHeaderToDynamicSamplingContext, dynamicSamplingContextToSentryBaggageHeader } from '../utils/baggage'; import { extractOrgIdFromDsnHost } from '../utils/dsn'; import { hasSpansEnabled } from '../utils/hasSpansEnabled'; import { addNonEnumerableProperty } from '../utils/object'; diff --git a/packages/core/test/lib/instrument/fetch.test.ts b/packages/core/test/lib/instrument/fetch.test.ts index 0ad68cb53883..88d780a7dbad 100644 --- a/packages/core/test/lib/instrument/fetch.test.ts +++ b/packages/core/test/lib/instrument/fetch.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest'; -import { parseFetchArgs } from '../../../src/utils/instrument/fetch'; +import { parseFetchArgs } from '../../../src/instrument/fetch'; describe('instrument > parseFetchArgs', () => { it.each([ diff --git a/packages/core/test/lib/integrations/captureconsole.test.ts b/packages/core/test/lib/integrations/captureconsole.test.ts index 1de52ed1b21d..faabc2590aac 100644 --- a/packages/core/test/lib/integrations/captureconsole.test.ts +++ b/packages/core/test/lib/integrations/captureconsole.test.ts @@ -4,11 +4,11 @@ import { type Mock, afterEach, beforeEach, describe, expect, it, vi } from 'vite import type { Client } from '../../../src'; import * as CurrentScopes from '../../../src/currentScopes'; import * as SentryCore from '../../../src/exports'; +import { addConsoleInstrumentationHandler } from '../../../src/instrument/console'; +import { resetInstrumentationHandlers } from '../../../src/instrument/handlers'; import { captureConsoleIntegration } from '../../../src/integrations/captureconsole'; import type { Event } from '../../../src/types-hoist/event'; import type { ConsoleLevel } from '../../../src/types-hoist/instrument'; -import { addConsoleInstrumentationHandler } from '../../../src/utils/instrument/console'; -import { resetInstrumentationHandlers } from '../../../src/utils/instrument/handlers'; import { CONSOLE_LEVELS, originalConsoleMethods } from '../../../src/utils/logger'; import { GLOBAL_OBJ } from '../../../src/utils/worldwide'; diff --git a/packages/core/test/lib/tracing/errors.test.ts b/packages/core/test/lib/tracing/errors.test.ts index 2dd11ee03a41..128ee9180d54 100644 --- a/packages/core/test/lib/tracing/errors.test.ts +++ b/packages/core/test/lib/tracing/errors.test.ts @@ -1,9 +1,9 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'; import { setCurrentClient, spanToJSON, startInactiveSpan, startSpan } from '../../../src'; +import * as globalErrorModule from '../../../src/instrument/globalError'; +import * as globalUnhandledRejectionModule from '../../../src/instrument/globalUnhandledRejection'; import { _resetErrorsInstrumented, registerSpanErrorInstrumentation } from '../../../src/tracing/errors'; import type { HandlerDataError, HandlerDataUnhandledRejection } from '../../../src/types-hoist/instrument'; -import * as globalErrorModule from '../../../src/utils/instrument/globalError'; -import * as globalUnhandledRejectionModule from '../../../src/utils/instrument/globalUnhandledRejection'; import { getDefaultTestClientOptions, TestClient } from '../../mocks/client'; let mockErrorCallback: (data: HandlerDataError) => void = () => {}; diff --git a/packages/core/test/lib/utils/envelope.test.ts b/packages/core/test/lib/utils/envelope.test.ts index 88f1a25047e4..85bff6a662f2 100644 --- a/packages/core/test/lib/utils/envelope.test.ts +++ b/packages/core/test/lib/utils/envelope.test.ts @@ -17,9 +17,9 @@ import { forEachEnvelopeItem, parseEnvelope, serializeEnvelope, -} from '../../src/utils/envelope'; -import type { InternalGlobal } from '../../src/utils/worldwide'; -import { GLOBAL_OBJ } from '../../src/utils/worldwide'; +} from '../../../src/utils/envelope'; +import type { InternalGlobal } from '../../../src/utils/worldwide'; +import { GLOBAL_OBJ } from '../../../src/utils/worldwide'; describe('envelope', () => { describe('createSpanEnvelope()', () => { diff --git a/packages/core/test/lib/utils/eventbuilder.test.ts b/packages/core/test/lib/utils/eventbuilder.test.ts index 5fa795c9d239..77fa2ff93d96 100644 --- a/packages/core/test/lib/utils/eventbuilder.test.ts +++ b/packages/core/test/lib/utils/eventbuilder.test.ts @@ -1,8 +1,8 @@ import { describe, expect, it, test } from 'vitest'; import type { Client } from '../../../src/client'; -import { eventFromMessage, eventFromUnknownInput } from '../../src/utils/eventbuilder'; -import { nodeStackLineParser } from '../../src/utils/node-stack-trace'; -import { createStackParser } from '../../src/utils/stacktrace'; +import { eventFromMessage, eventFromUnknownInput } from '../../../src/utils/eventbuilder'; +import { nodeStackLineParser } from '../../../src/utils/node-stack-trace'; +import { createStackParser } from '../../../src/utils/stacktrace'; const stackParser = createStackParser(nodeStackLineParser()); diff --git a/packages/core/test/lib/utils/is.test.ts b/packages/core/test/lib/utils/is.test.ts index 5e426a8bc055..745cf275be06 100644 --- a/packages/core/test/lib/utils/is.test.ts +++ b/packages/core/test/lib/utils/is.test.ts @@ -9,9 +9,9 @@ import { isPrimitive, isThenable, isVueViewModel, -} from '../../src/utils/is'; -import { supportsDOMError, supportsDOMException, supportsErrorEvent } from '../../src/utils/supports'; -import { resolvedSyncPromise } from '../../src/utils/syncpromise'; +} from '../../../src/utils/is'; +import { supportsDOMError, supportsDOMException, supportsErrorEvent } from '../../../src/utils/supports'; +import { resolvedSyncPromise } from '../../../src/utils/syncpromise'; import { testOnlyIfNodeVersionAtLeast } from '../../testutils'; if (supportsDOMError()) { diff --git a/packages/core/test/lib/utils/lru.test.ts b/packages/core/test/lib/utils/lru.test.ts index 506dff6ae040..5940f10684e1 100644 --- a/packages/core/test/lib/utils/lru.test.ts +++ b/packages/core/test/lib/utils/lru.test.ts @@ -1,5 +1,5 @@ import { describe, expect, test } from 'vitest'; -import { LRUMap } from '../../src/utils/lru'; +import { LRUMap } from '../../../src/utils/lru'; describe('LRUMap', () => { test('evicts older entries when reaching max size', () => { diff --git a/packages/core/test/lib/utils/misc.test.ts b/packages/core/test/lib/utils/misc.test.ts index c6e4fb7861a6..83e7f4c05b66 100644 --- a/packages/core/test/lib/utils/misc.test.ts +++ b/packages/core/test/lib/utils/misc.test.ts @@ -8,7 +8,7 @@ import { checkOrSetAlreadyCaught, getEventDescription, uuid4, -} from '../../src/utils/misc'; +} from '../../../src/utils/misc'; describe('getEventDescription()', () => { test('message event', () => { diff --git a/packages/core/test/lib/utils/normalize-url.test.ts b/packages/core/test/lib/utils/normalize-url.test.ts index 100cdccbf66a..888383940a1a 100644 --- a/packages/core/test/lib/utils/normalize-url.test.ts +++ b/packages/core/test/lib/utils/normalize-url.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest'; -import { normalizeUrlToBase } from '../../src/utils/normalize'; +import { normalizeUrlToBase } from '../../../src/utils/normalize'; describe('normalizeUrlToBase()', () => { it('Example app on Windows', () => { diff --git a/packages/core/test/lib/utils/normalize.test.ts b/packages/core/test/lib/utils/normalize.test.ts index 6dbabbe2d7d2..17c0628e53df 100644 --- a/packages/core/test/lib/utils/normalize.test.ts +++ b/packages/core/test/lib/utils/normalize.test.ts @@ -4,8 +4,8 @@ import { describe, expect, test, vi } from 'vitest'; import { addNonEnumerableProperty, normalize } from '../../../src'; -import * as isModule from '../../src/utils/is'; -import * as stacktraceModule from '../../src/utils/stacktrace'; +import * as isModule from '../../../src/utils/is'; +import * as stacktraceModule from '../../../src/utils/stacktrace'; describe('normalize()', () => { describe('acts as a pass-through for simple-cases', () => { diff --git a/packages/core/test/lib/utils/object.test.ts b/packages/core/test/lib/utils/object.test.ts index 647b36366335..bc8c7611abb8 100644 --- a/packages/core/test/lib/utils/object.test.ts +++ b/packages/core/test/lib/utils/object.test.ts @@ -11,7 +11,7 @@ import { fill, markFunctionWrapped, objectify, -} from '../../src/utils/object'; +} from '../../../src/utils/object'; import { testOnlyIfNodeVersionAtLeast } from '../../testutils'; describe('fill()', () => { diff --git a/packages/core/test/lib/utils/path.test.ts b/packages/core/test/lib/utils/path.test.ts index 84e2b0ca6180..7e17f99228d4 100644 --- a/packages/core/test/lib/utils/path.test.ts +++ b/packages/core/test/lib/utils/path.test.ts @@ -1,5 +1,5 @@ import { describe, expect, test } from 'vitest'; -import { basename, dirname } from '../../src/utils/path'; +import { basename, dirname } from '../../../src/utils/path'; describe('path', () => { describe('basename', () => { diff --git a/packages/core/test/lib/utils/promisebuffer.test.ts b/packages/core/test/lib/utils/promisebuffer.test.ts index ef22fe2df2f2..1f0011dd6e50 100644 --- a/packages/core/test/lib/utils/promisebuffer.test.ts +++ b/packages/core/test/lib/utils/promisebuffer.test.ts @@ -1,6 +1,6 @@ import { describe, expect, test, vi } from 'vitest'; -import { makePromiseBuffer } from '../../src/utils/promisebuffer'; -import { SyncPromise } from '../../src/utils/syncpromise'; +import { makePromiseBuffer } from '../../../src/utils/promisebuffer'; +import { SyncPromise } from '../../../src/utils/syncpromise'; describe('PromiseBuffer', () => { describe('add()', () => { diff --git a/packages/core/test/lib/utils/ratelimit.test.ts b/packages/core/test/lib/utils/ratelimit.test.ts index 8efdd8d5bc33..772bd5e5c9d4 100644 --- a/packages/core/test/lib/utils/ratelimit.test.ts +++ b/packages/core/test/lib/utils/ratelimit.test.ts @@ -1,12 +1,12 @@ import { describe, expect, test } from 'vitest'; -import type { RateLimits } from '../../src/utils/ratelimit'; +import type { RateLimits } from '../../../src/utils/ratelimit'; import { DEFAULT_RETRY_AFTER, disabledUntil, isRateLimited, parseRetryAfterHeader, updateRateLimits, -} from '../../src/utils/ratelimit'; +} from '../../../src/utils/ratelimit'; describe('parseRetryAfterHeader()', () => { test('should fallback to 60s when incorrect header provided', () => { diff --git a/packages/core/test/lib/utils/severity.test.ts b/packages/core/test/lib/utils/severity.test.ts index 9431240f11ce..6cc44a5bbeee 100644 --- a/packages/core/test/lib/utils/severity.test.ts +++ b/packages/core/test/lib/utils/severity.test.ts @@ -1,5 +1,5 @@ import { describe, expect, test } from 'vitest'; -import { severityLevelFromString } from '../../src/utils/severity'; +import { severityLevelFromString } from '../../../src/utils/severity'; describe('severityLevelFromString()', () => { test("converts 'warn' to 'warning'", () => { diff --git a/packages/core/test/lib/utils/stacktrace.test.ts b/packages/core/test/lib/utils/stacktrace.test.ts index a8088997cda9..b0d74e2e9f75 100644 --- a/packages/core/test/lib/utils/stacktrace.test.ts +++ b/packages/core/test/lib/utils/stacktrace.test.ts @@ -1,6 +1,6 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'; -import { nodeStackLineParser } from '../../src/utils/node-stack-trace'; -import { stripSentryFramesAndReverse } from '../../src/utils/stacktrace'; +import { nodeStackLineParser } from '../../../src/utils/node-stack-trace'; +import { stripSentryFramesAndReverse } from '../../../src/utils/stacktrace'; describe('Stacktrace', () => { describe('stripSentryFramesAndReverse()', () => { diff --git a/packages/core/test/lib/utils/string.test.ts b/packages/core/test/lib/utils/string.test.ts index 067518110e45..b3d166568163 100644 --- a/packages/core/test/lib/utils/string.test.ts +++ b/packages/core/test/lib/utils/string.test.ts @@ -1,5 +1,5 @@ import { describe, expect, test } from 'vitest'; -import { isMatchingPattern, stringMatchesSomePattern, truncate } from '../../src/utils/string'; +import { isMatchingPattern, stringMatchesSomePattern, truncate } from '../../../src/utils/string'; describe('truncate()', () => { test('it works as expected', () => { diff --git a/packages/core/test/lib/utils/supports.test.ts b/packages/core/test/lib/utils/supports.test.ts index 28a75dc0e7bf..97ad75d6c7c3 100644 --- a/packages/core/test/lib/utils/supports.test.ts +++ b/packages/core/test/lib/utils/supports.test.ts @@ -1,6 +1,6 @@ import { afterEach } from 'node:test'; import { describe, expect, it } from 'vitest'; -import { supportsHistory } from '../../src/utils/supports'; +import { supportsHistory } from '../../../src/utils/supports'; describe('supportsHistory', () => { const originalHistory = globalThis.history; diff --git a/packages/core/test/lib/utils/syncpromise.test.ts b/packages/core/test/lib/utils/syncpromise.test.ts index 21b966a053c4..14bc5d7abbe0 100644 --- a/packages/core/test/lib/utils/syncpromise.test.ts +++ b/packages/core/test/lib/utils/syncpromise.test.ts @@ -1,5 +1,5 @@ import { describe, expect, test, vi } from 'vitest'; -import { rejectedSyncPromise, resolvedSyncPromise, SyncPromise } from '../../src/utils/syncpromise'; +import { rejectedSyncPromise, resolvedSyncPromise, SyncPromise } from '../../../src/utils/syncpromise'; describe('SyncPromise', () => { test('simple', async () => { diff --git a/packages/core/test/lib/utils/tracing.test.ts b/packages/core/test/lib/utils/tracing.test.ts index 6d90e0ce21e7..ea99555e70e1 100644 --- a/packages/core/test/lib/utils/tracing.test.ts +++ b/packages/core/test/lib/utils/tracing.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it, test } from 'vitest'; -import { extractTraceparentData, propagationContextFromHeaders } from '../../src/utils/tracing'; +import { extractTraceparentData, propagationContextFromHeaders } from '../../../src/utils/tracing'; const EXAMPLE_SENTRY_TRACE = '12312012123120121231201212312012-1121201211212012-1'; const EXAMPLE_BAGGAGE = 'sentry-release=1.2.3,sentry-foo=bar,other=baz,sentry-sample_rand=0.42'; diff --git a/packages/core/test/lib/utils/url.test.ts b/packages/core/test/lib/utils/url.test.ts index 93131be30720..33364d66daa5 100644 --- a/packages/core/test/lib/utils/url.test.ts +++ b/packages/core/test/lib/utils/url.test.ts @@ -7,7 +7,7 @@ import { parseStringToURLObject, parseUrl, stripUrlQueryAndFragment, -} from '../../src/utils/url'; +} from '../../../src/utils/url'; describe('stripQueryStringAndFragment', () => { const urlString = 'http://dogs.are.great:1231/yay/'; diff --git a/packages/core/test/lib/utils/vercelWaitUntil.test.ts b/packages/core/test/lib/utils/vercelWaitUntil.test.ts index c0bc135169f8..78637cb3ef18 100644 --- a/packages/core/test/lib/utils/vercelWaitUntil.test.ts +++ b/packages/core/test/lib/utils/vercelWaitUntil.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it, vi } from 'vitest'; -import { vercelWaitUntil } from '../../src/utils/vercelWaitUntil'; -import { GLOBAL_OBJ } from '../../src/utils/worldwide'; +import { vercelWaitUntil } from '../../../src/utils/vercelWaitUntil'; +import { GLOBAL_OBJ } from '../../../src/utils/worldwide'; describe('vercelWaitUntil', () => { it('should do nothing if GLOBAL_OBJ does not have the @vercel/request-context symbol', () => { diff --git a/packages/core/test/lib/utils/worldwide.test.ts b/packages/core/test/lib/utils/worldwide.test.ts index 3f80a670da54..f7c952a9930d 100644 --- a/packages/core/test/lib/utils/worldwide.test.ts +++ b/packages/core/test/lib/utils/worldwide.test.ts @@ -1,5 +1,5 @@ import { describe, expect, test } from 'vitest'; -import { GLOBAL_OBJ } from '../../src/utils/worldwide'; +import { GLOBAL_OBJ } from '../../../src/utils/worldwide'; describe('GLOBAL_OBJ', () => { test('should return the same object', () => { diff --git a/packages/core/test/testutils.ts b/packages/core/test/testutils.ts index 942c0d4bdd32..c00ec2b878b7 100644 --- a/packages/core/test/testutils.ts +++ b/packages/core/test/testutils.ts @@ -1,6 +1,6 @@ import { it } from 'vitest'; -import { GLOBAL_OBJ } from '../../src/utils/worldwide'; import { getSentryCarrier } from '../src/carrier'; +import { GLOBAL_OBJ } from '../src/utils/worldwide'; // eslint-disable-next-line @typescript-eslint/ban-types export const testOnlyIfNodeVersionAtLeast = (minVersion: number): Function => { From 824f18bcf86e50eb67902f24456c4ed0fffb636d Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Wed, 18 Jun 2025 13:56:13 +0200 Subject: [PATCH 5/5] fix it --- packages/node/test/integration/scope.test.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/node/test/integration/scope.test.ts b/packages/node/test/integration/scope.test.ts index 43af4214980d..6f2acaf267ee 100644 --- a/packages/node/test/integration/scope.test.ts +++ b/packages/node/test/integration/scope.test.ts @@ -1,7 +1,6 @@ import { getCapturedScopesOnSpan, getCurrentScope } from '@sentry/core'; import { getClient } from '@sentry/opentelemetry'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; -import { clearGlobalScope } from '../../../core/test/lib/clear-global-scope'; import * as Sentry from '../../src/'; import type { NodeClient } from '../../src/sdk/client'; import { cleanupOtel, mockSdkInit, resetGlobals } from '../helpers/mockSdkInit'; @@ -240,7 +239,7 @@ describe('Integration | Scope', () => { describe('global scope', () => { beforeEach(() => { - clearGlobalScope(); + resetGlobals(); }); it('works before calling init', () => {