Skip to content

ref(core): Remove utils-hoist folder #16639

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/core/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -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'],
};
2 changes: 1 addition & 1 deletion packages/core/src/api.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/asyncContext/stackStrategy.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/breadcrumbs.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/carrier.ts
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/checkin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
14 changes: 7 additions & 7 deletions packages/core/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/currentScopes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions packages/core/src/envelope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/eventProcessors.ts
Original file line number Diff line number Diff line change
@@ -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).
Expand Down
10 changes: 5 additions & 5 deletions packages/core/src/exports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, string | undefined>
Expand Down
104 changes: 47 additions & 57 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,24 +133,19 @@ 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 { 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 {
addHandler,
maybeInstrument,
resetInstrumentationHandlers,
triggerHandlers,
} from './utils-hoist/instrument/handlers';
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';
export { addGlobalUnhandledRejectionInstrumentationHandler } from './instrument/globalUnhandledRejection';
export { addHandler, maybeInstrument, resetInstrumentationHandlers, triggerHandlers } from './instrument/handlers';
export {
isDOMError,
isDOMException,
Expand All @@ -167,10 +162,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,
Expand All @@ -179,9 +174,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,
Expand All @@ -192,21 +187,21 @@ 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,
getFramesFromEvent,
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,
Expand All @@ -219,17 +214,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,
Expand All @@ -242,16 +237,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,
Expand All @@ -260,7 +255,7 @@ export {
dynamicSamplingContextToSentryBaggageHeader,
parseBaggageHeader,
objectToBaggageHeader,
} from './utils-hoist/baggage';
} from './utils/baggage';
export {
getSanitizedUrlString,
parseUrl,
Expand All @@ -269,20 +264,15 @@ export {
getHttpSpanDetailsFromUrlObject,
isURLObjectRelative,
getSanitizedUrlStringFromUrlObject,
} from './utils-hoist/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';
export { escapeStringForRegex } from './utils-hoist/vendor/escapeStringForRegex';
} from './utils/url';
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';
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';
export type {
Expand Down
Original file line number Diff line number Diff line change
@@ -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/logger';
import { fill } from '../utils/object';
import { GLOBAL_OBJ } from '../utils/worldwide';
import { addHandler, maybeInstrument, triggerHandlers } from './handlers';

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -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/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 };
Expand Down
Original file line number Diff line number Diff line change
@@ -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/worldwide';
import { addHandler, maybeInstrument, triggerHandlers } from './handlers';

let _oldOnErrorHandler: (typeof GLOBAL_OBJ)['onerror'] | null = null;
Expand Down
Original file line number Diff line number Diff line change
@@ -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/worldwide';
import { addHandler, maybeInstrument, triggerHandlers } from './handlers';

let _oldOnUnhandledRejectionHandler: (typeof GLOBAL_OBJ)['onunhandledrejection'] | null = null;
Expand Down
Original file line number Diff line number Diff line change
@@ -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/logger';
import { getFunctionName } from '../utils/stacktrace';

export type InstrumentHandlerType =
| 'console'
Expand Down
Loading
Loading