Skip to content

Commit ddf3ca4

Browse files
committed
move WINDOW to ./constants.ts
1 parent d480336 commit ddf3ca4

21 files changed

+27
-58
lines changed

packages/replay/src/createPerformanceEntry.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { browserPerformanceTimeOrigin } from '@sentry/utils';
22
import { record } from 'rrweb';
33

4-
import { AllPerformanceEntry, PerformanceNavigationTiming, PerformancePaintTiming, WINDOW } from './types';
4+
import { WINDOW } from './constants';
5+
import { AllPerformanceEntry, PerformanceNavigationTiming, PerformancePaintTiming } from './types';
56
import { isIngestHost } from './util/isIngestHost';
67

78
export interface ReplayPerformanceEntry {

packages/replay/src/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,19 @@ import debounce from 'lodash.debounce';
66
import { PerformanceObserverEntryList } from 'perf_hooks';
77
import { EventType, record } from 'rrweb';
88

9-
import { breadcrumbHandler } from './coreHandlers/breadcrumbHandler';
10-
import { spanHandler } from './coreHandlers/spanHandler';
11-
import { createMemoryEntry, createPerformanceEntries, ReplayPerformanceEntry } from './createPerformanceEntry';
12-
import { createEventBuffer, IEventBuffer } from './eventBuffer';
139
import {
1410
DEFAULT_ERROR_SAMPLE_RATE,
1511
DEFAULT_SESSION_SAMPLE_RATE,
1612
MAX_SESSION_LIFE,
1713
REPLAY_EVENT_NAME,
1814
SESSION_IDLE_DURATION,
1915
VISIBILITY_CHANGE_TIMEOUT,
20-
} from './session/constants';
16+
WINDOW,
17+
} from './constants';
18+
import { breadcrumbHandler } from './coreHandlers/breadcrumbHandler';
19+
import { spanHandler } from './coreHandlers/spanHandler';
20+
import { createMemoryEntry, createPerformanceEntries, ReplayPerformanceEntry } from './createPerformanceEntry';
21+
import { createEventBuffer, IEventBuffer } from './eventBuffer';
2122
import { deleteSession } from './session/deleteSession';
2223
import { getSession } from './session/getSession';
2324
import { saveSession } from './session/saveSession';
@@ -33,7 +34,6 @@ import {
3334
ReplayConfiguration,
3435
ReplayPluginOptions,
3536
SendReplay,
36-
WINDOW,
3737
} from './types';
3838
import { addInternalBreadcrumb } from './util/addInternalBreadcrumb';
3939
import { captureInternalException } from './util/captureInternalException';

packages/replay/src/session/constants.ts

Lines changed: 0 additions & 18 deletions
This file was deleted.

packages/replay/src/session/deleteSession.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { WINDOW } from '../types';
2-
import { REPLAY_SESSION_KEY } from './constants';
1+
import { REPLAY_SESSION_KEY, WINDOW } from '../constants';
32

43
/**
54
* Deletes a session from storage

packages/replay/src/session/fetchSession.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { SampleRates, WINDOW } from '../types';
2-
import { REPLAY_SESSION_KEY } from './constants';
1+
import { REPLAY_SESSION_KEY, WINDOW } from '../constants';
2+
import { SampleRates } from '../types';
33
import { Session } from './Session';
44

55
/**

packages/replay/src/session/saveSession.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { WINDOW } from '../types';
2-
import { REPLAY_SESSION_KEY } from './constants';
1+
import { REPLAY_SESSION_KEY, WINDOW } from '../constants';
32
import { Session } from './Session';
43

54
export function saveSession(session: Session): void {

packages/replay/src/types.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
1-
import { GLOBAL_OBJ } from '@sentry/utils';
21
import type { eventWithTime, recordOptions } from 'rrweb/typings/types';
32

4-
// exporting WINDOW from within this package instead of importing it from @sentry/browser
5-
// this avoids the Browser package being bundled into the CDN bundle as well as a
6-
// circular dependency between the Browser and Replay packages in the future
7-
export const WINDOW = GLOBAL_OBJ as typeof GLOBAL_OBJ & Window;
8-
93
export type RecordingEvent = eventWithTime;
104
export type RecordingOptions = recordOptions<eventWithTime>;
115

packages/replay/src/util/isInternal.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { WINDOW } from '../types';
1+
import { WINDOW } from '../constants';
22
import { isBrowser } from './isBrowser';
33

44
/**

packages/replay/src/util/isSessionExpired.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { MAX_SESSION_LIFE } from '../session/constants';
1+
import { MAX_SESSION_LIFE } from '../constants';
22
import { Session } from '../session/Session';
33
import { isExpired } from './isExpired';
44

packages/replay/test/unit/flush.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import * as SentryUtils from '@sentry/utils';
22
import { BASE_TIMESTAMP, mockRrweb, mockSdk } from '@test';
33

4-
import { WINDOW } from '../../src/types';
4+
import { SESSION_IDLE_DURATION, WINDOW } from '../../src/constants';
55
import { Replay } from './../../src';
66
import { createPerformanceEntries } from './../../src/createPerformanceEntry';
7-
import { SESSION_IDLE_DURATION } from './../../src/session/constants';
87
import { useFakeTimers } from './../../test/utils/use-fake-timers';
98

109
useFakeTimers();

0 commit comments

Comments
 (0)