diff --git a/packages/utils/src/browser.ts b/packages/utils/src/browser.ts index 30cd546c6ad8..25ccc443a03c 100644 --- a/packages/utils/src/browser.ts +++ b/packages/utils/src/browser.ts @@ -1,5 +1,5 @@ -import { GLOBAL_OBJ } from './global'; import { isString } from './is'; +import { GLOBAL_OBJ } from './worldwide'; /** * TODO: Move me to @sentry/browser when @sentry/utils no longer contains any browser code diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts index b55e3b0303be..260360522685 100644 --- a/packages/utils/src/index.ts +++ b/packages/utils/src/index.ts @@ -1,7 +1,7 @@ export * from './browser'; export * from './dsn'; export * from './error'; -export * from './global'; +export * from './worldwide'; export * from './instrument'; export * from './is'; export * from './logger'; diff --git a/packages/utils/src/logger.ts b/packages/utils/src/logger.ts index 031c969a930d..efa8f49716b9 100644 --- a/packages/utils/src/logger.ts +++ b/packages/utils/src/logger.ts @@ -1,6 +1,6 @@ import { WrappedFunction } from '@sentry/types'; -import { getGlobalSingleton, GLOBAL_OBJ } from './global'; +import { getGlobalSingleton, GLOBAL_OBJ } from './worldwide'; /** Prefix for logging strings */ const PREFIX = 'Sentry Logger '; diff --git a/packages/utils/src/misc.ts b/packages/utils/src/misc.ts index 8c24439a47d4..aacb4de786e0 100644 --- a/packages/utils/src/misc.ts +++ b/packages/utils/src/misc.ts @@ -1,9 +1,9 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import { Event, Exception, Mechanism, StackFrame } from '@sentry/types'; -import { GLOBAL_OBJ } from './global'; import { addNonEnumerableProperty } from './object'; import { snipLine } from './string'; +import { GLOBAL_OBJ } from './worldwide'; interface CryptoInternal { getRandomValues(array: Uint8Array): Uint8Array; diff --git a/packages/utils/src/global.ts b/packages/utils/src/worldwide.ts similarity index 93% rename from packages/utils/src/global.ts rename to packages/utils/src/worldwide.ts index 72163749214a..b882136689d0 100644 --- a/packages/utils/src/global.ts +++ b/packages/utils/src/worldwide.ts @@ -1,6 +1,13 @@ /** * NOTE: In order to avoid circular dependencies, if you add a function to this module and it needs to print something, * you must either a) use `console.log` rather than the logger, or b) put your function elsewhere. + * + * Note: This file was originally called `global.ts`, but was changed to unblock users which might be doing + * string replaces with bundlers like Vite for `global` (would break imports that rely on importing from utils/src/global). + * + * Why worldwide? + * + * Why not? */ /* eslint-disable @typescript-eslint/no-explicit-any */ diff --git a/packages/utils/test/global.test.ts b/packages/utils/test/worldwide.test.ts similarity index 85% rename from packages/utils/test/global.test.ts rename to packages/utils/test/worldwide.test.ts index 722abf678bb0..6137c95c093b 100644 --- a/packages/utils/test/global.test.ts +++ b/packages/utils/test/worldwide.test.ts @@ -1,4 +1,4 @@ -import { GLOBAL_OBJ } from '../src/global'; +import { GLOBAL_OBJ } from '../src/worldwide'; describe('GLOBAL_OBJ', () => { test('should return the same object', () => {