Skip to content

Commit 45e4156

Browse files
committed
ref: Move isBrowser util fn from replay to util
We need this in the new feedback integration.
1 parent 753f82b commit 45e4156

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

packages/replay/jest.setup.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ import type { ReplayContainer, Session } from './src/types';
1010

1111
type MockTransport = jest.MockedFunction<Transport['send']>;
1212

13-
jest.mock('./src/util/isBrowser', () => {
13+
jest.mock('@sentry/utils', () => {
14+
const original = jest.requireActual('@sentry/utils');
1415
return {
16+
...original,
1517
isBrowser: () => true,
1618
};
1719
});

packages/replay/src/integration.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { getCurrentHub } from '@sentry/core';
22
import type { BrowserClientReplayOptions, Integration } from '@sentry/types';
3-
import { dropUndefinedKeys } from '@sentry/utils';
3+
import { dropUndefinedKeys, isBrowser } from '@sentry/utils';
44

55
import {
66
DEFAULT_FLUSH_MAX_DELAY,
@@ -12,7 +12,6 @@ import {
1212
import { ReplayContainer } from './replay';
1313
import type { RecordingOptions, ReplayConfiguration, ReplayPluginOptions, SendBufferedReplayOptions } from './types';
1414
import { getPrivacyOptions } from './util/getPrivacyOptions';
15-
import { isBrowser } from './util/isBrowser';
1615
import { maskAttribute } from './util/maskAttribute';
1716

1817
const MEDIA_SELECTORS =

packages/utils/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export * from './error';
55
export * from './worldwide';
66
export * from './instrument';
77
export * from './is';
8+
export * from './isBrowser';
89
export * from './logger';
910
export * from './memo';
1011
export * from './misc';

packages/replay/src/util/isBrowser.ts renamed to packages/utils/src/isBrowser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { isNodeEnv } from '@sentry/utils';
1+
import { isNodeEnv } from './node';
22

33
/**
44
* Returns true if we are in the browser.

0 commit comments

Comments
 (0)