Skip to content

Commit ef37773

Browse files
authored
ref(v7/replay): Deprecate @sentry/replay exports (#11242)
ref #11200 on v8 #11243
1 parent 25af150 commit ef37773

File tree

11 files changed

+141
-47
lines changed

11 files changed

+141
-47
lines changed

dev-packages/browser-integration-tests/suites/replay/bufferMode/test.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { expect } from '@playwright/test';
2-
import type { Replay } from '@sentry/replay';
2+
import type { InternalReplay } from '@sentry/replay';
33
import type { ReplayContainer } from '@sentry/replay/build/npm/types/types';
44

55
import { sentryTest } from '../../../utils/fixtures';
@@ -68,7 +68,8 @@ sentryTest(
6868
expect(
6969
await page.evaluate(() => {
7070
// eslint-disable-next-line deprecation/deprecation
71-
const replayIntegration = (window as unknown as Window & { Replay: InstanceType<typeof Replay> }).Replay;
71+
const replayIntegration = (window as unknown as Window & { Replay: InstanceType<typeof InternalReplay> })
72+
.Replay;
7273
// @ts-expect-error private
7374
const replay = replayIntegration._replay;
7475
replayIntegration.startBuffering();
@@ -89,7 +90,7 @@ sentryTest(
8990
reqPromise0,
9091
page.evaluate(async () => {
9192
// eslint-disable-next-line deprecation/deprecation
92-
const replayIntegration = (window as unknown as Window & { Replay: Replay }).Replay;
93+
const replayIntegration = (window as unknown as Window & { Replay: InternalReplay }).Replay;
9394
await replayIntegration.flush();
9495
}),
9596
]);
@@ -213,7 +214,8 @@ sentryTest(
213214
expect(
214215
await page.evaluate(() => {
215216
// eslint-disable-next-line deprecation/deprecation
216-
const replayIntegration = (window as unknown as Window & { Replay: InstanceType<typeof Replay> }).Replay;
217+
const replayIntegration = (window as unknown as Window & { Replay: InstanceType<typeof InternalReplay> })
218+
.Replay;
217219
// @ts-expect-error private
218220
const replay = replayIntegration._replay;
219221
replayIntegration.startBuffering();
@@ -234,7 +236,7 @@ sentryTest(
234236
reqPromise0,
235237
page.evaluate(async () => {
236238
// eslint-disable-next-line deprecation/deprecation
237-
const replayIntegration = (window as unknown as Window & { Replay: Replay }).Replay;
239+
const replayIntegration = (window as unknown as Window & { Replay: InternalReplay }).Replay;
238240
await replayIntegration.flush({ continueRecording: false });
239241
}),
240242
]);
@@ -329,7 +331,8 @@ sentryTest(
329331
expect(
330332
await page.evaluate(() => {
331333
// eslint-disable-next-line deprecation/deprecation
332-
const replayIntegration = (window as unknown as Window & { Replay: InstanceType<typeof Replay> }).Replay;
334+
const replayIntegration = (window as unknown as Window & { Replay: InstanceType<typeof InternalReplay> })
335+
.Replay;
333336
const replay = replayIntegration['_replay'];
334337
replayIntegration.startBuffering();
335338
return replay.isEnabled();
@@ -348,7 +351,7 @@ sentryTest(
348351

349352
await page.evaluate(async () => {
350353
// eslint-disable-next-line deprecation/deprecation
351-
const replayIntegration = (window as unknown as Window & { Replay: Replay }).Replay;
354+
const replayIntegration = (window as unknown as Window & { Replay: InternalReplay }).Replay;
352355
replayIntegration['_replay'].getOptions().errorSampleRate = 1.0;
353356
});
354357

packages/browser/src/index.bundle.replay.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ import {
66
browserTracingIntegration,
77
feedbackIntegration,
88
} from '@sentry-internal/integration-shims';
9-
import { Replay, replayIntegration } from '@sentry/replay';
9+
import { InternalReplay, internalReplayIntegration } from '@sentry/replay';
1010

1111
import * as Sentry from './index.bundle.base';
1212

1313
// TODO (v8): Remove this as it was only needed for backwards compatibility
1414
// eslint-disable-next-line deprecation/deprecation
15-
Sentry.Integrations.Replay = Replay;
15+
Sentry.Integrations.Replay = InternalReplay;
1616

1717
// eslint-disable-next-line deprecation/deprecation
1818
Sentry.Integrations.BrowserTracing = BrowserTracing;
@@ -24,8 +24,8 @@ export {
2424
browserTracingIntegration,
2525
addTracingExtensions,
2626
// eslint-disable-next-line deprecation/deprecation
27-
Replay,
28-
replayIntegration,
27+
InternalReplay as Replay,
28+
internalReplayIntegration as replayIntegration,
2929
// eslint-disable-next-line deprecation/deprecation
3030
Feedback,
3131
feedbackIntegration,

packages/browser/src/index.bundle.tracing.replay.feedback.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Feedback, feedbackIntegration } from '@sentry-internal/feedback';
22
import { BrowserTracing, Span, addExtensionMethods } from '@sentry-internal/tracing';
3-
import { Replay, replayIntegration } from '@sentry/replay';
3+
import { InternalReplay, internalReplayIntegration } from '@sentry/replay';
44
import { bundleBrowserTracingIntegration as browserTracingIntegration } from './helpers';
55

66
import * as Sentry from './index.bundle.base';
@@ -9,7 +9,7 @@ import * as Sentry from './index.bundle.base';
99
// We want replay to be available under Sentry.Replay, to be consistent
1010
// with the NPM package version.
1111
// eslint-disable-next-line deprecation/deprecation
12-
Sentry.Integrations.Replay = Replay;
12+
Sentry.Integrations.Replay = InternalReplay;
1313

1414
// eslint-disable-next-line deprecation/deprecation
1515
Sentry.Integrations.BrowserTracing = BrowserTracing;
@@ -21,9 +21,9 @@ export {
2121
// eslint-disable-next-line deprecation/deprecation
2222
Feedback,
2323
// eslint-disable-next-line deprecation/deprecation
24-
Replay,
24+
InternalReplay as Replay,
2525
feedbackIntegration,
26-
replayIntegration,
26+
internalReplayIntegration as replayIntegration,
2727
// eslint-disable-next-line deprecation/deprecation
2828
BrowserTracing,
2929
browserTracingIntegration,

packages/browser/src/index.bundle.tracing.replay.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Feedback, feedbackIntegration } from '@sentry-internal/integration-shims';
22
import { BrowserTracing, Span, addExtensionMethods } from '@sentry-internal/tracing';
3-
import { Replay, replayIntegration } from '@sentry/replay';
3+
import { InternalReplay, internalReplayIntegration } from '@sentry/replay';
44
import { bundleBrowserTracingIntegration as browserTracingIntegration } from './helpers';
55

66
import * as Sentry from './index.bundle.base';
@@ -9,7 +9,7 @@ import * as Sentry from './index.bundle.base';
99
// We want replay to be available under Sentry.Replay, to be consistent
1010
// with the NPM package version.
1111
// eslint-disable-next-line deprecation/deprecation
12-
Sentry.Integrations.Replay = Replay;
12+
Sentry.Integrations.Replay = InternalReplay;
1313

1414
// eslint-disable-next-line deprecation/deprecation
1515
Sentry.Integrations.BrowserTracing = BrowserTracing;
@@ -21,8 +21,8 @@ export {
2121
// eslint-disable-next-line deprecation/deprecation
2222
Feedback,
2323
// eslint-disable-next-line deprecation/deprecation
24-
Replay,
25-
replayIntegration,
24+
InternalReplay as Replay,
25+
internalReplayIntegration as replayIntegration,
2626
feedbackIntegration,
2727
// eslint-disable-next-line deprecation/deprecation
2828
BrowserTracing,

packages/browser/src/index.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,20 @@ export { INTEGRATIONS as Integrations };
2525

2626
export {
2727
// eslint-disable-next-line deprecation/deprecation
28-
Replay,
29-
replayIntegration,
30-
getReplay,
28+
InternalReplay as Replay,
29+
internalReplayIntegration as replayIntegration,
30+
internalGetReplay as getReplay,
3131
} from '@sentry/replay';
3232
export type {
33-
ReplayEventType,
34-
ReplayEventWithTime,
35-
ReplayBreadcrumbFrame,
36-
ReplayBreadcrumbFrameEvent,
37-
ReplayOptionFrameEvent,
38-
ReplayFrame,
39-
ReplayFrameEvent,
40-
ReplaySpanFrame,
41-
ReplaySpanFrameEvent,
33+
InternalReplayEventType as ReplayEventType,
34+
InternalReplayEventWithTime as ReplayEventWithTime,
35+
InternalReplayBreadcrumbFrame as ReplayBreadcrumbFrame,
36+
InternalReplayBreadcrumbFrameEvent as ReplayBreadcrumbFrameEvent,
37+
InternalReplayOptionFrameEvent as ReplayOptionFrameEvent,
38+
InternalReplayFrame as ReplayFrame,
39+
InternalReplayFrameEvent as ReplayFrameEvent,
40+
InternalReplaySpanFrame as ReplaySpanFrame,
41+
InternalReplaySpanFrameEvent as ReplaySpanFrameEvent,
4242
} from '@sentry/replay';
4343

4444
export {

packages/replay-canvas/src/canvas.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { CanvasManager } from '@sentry-internal/rrweb';
22
import { convertIntegrationFnToClass, defineIntegration } from '@sentry/core';
3-
import type { CanvasManagerInterface, CanvasManagerOptions } from '@sentry/replay';
3+
import type { InternalCanvasManagerInterface, InternalCanvasManagerOptions } from '@sentry/replay';
44
import type { Integration, IntegrationClass, IntegrationFn } from '@sentry/types';
55

66
interface ReplayCanvasOptions {
77
enableManualSnapshot?: boolean;
88
quality: 'low' | 'medium' | 'high';
99
}
1010

11-
type GetCanvasManager = (options: CanvasManagerOptions) => CanvasManagerInterface;
11+
type GetCanvasManager = (options: InternalCanvasManagerOptions) => InternalCanvasManagerInterface;
1212
export interface ReplayCanvasIntegrationOptions {
1313
enableManualSnapshot?: boolean;
1414
recordCanvas: true;
@@ -74,7 +74,7 @@ export const _replayCanvasIntegration = ((options: Partial<ReplayCanvasOptions>
7474
return {
7575
enableManualSnapshot,
7676
recordCanvas: true,
77-
getCanvasManager: (options: CanvasManagerOptions) => {
77+
getCanvasManager: (options: InternalCanvasManagerOptions) => {
7878
const manager = new CanvasManager({
7979
...options,
8080
enableManualSnapshot,

packages/replay/src/index.ts

Lines changed: 96 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,108 @@
1-
export {
2-
// eslint-disable-next-line deprecation/deprecation
3-
Replay,
4-
replayIntegration,
5-
} from './integration';
1+
// eslint-disable-next-line deprecation/deprecation
2+
import { Replay as InternalReplay, replayIntegration as internalReplayIntegration } from './integration';
3+
import type {
4+
CanvasManagerInterface as InternalCanvasManagerInterface,
5+
CanvasManagerOptions as InternalCanvasManagerOptions,
6+
ReplayBreadcrumbFrame as InternalReplayBreadcrumbFrame,
7+
ReplayBreadcrumbFrameEvent as InternalReplayBreadcrumbFrameEvent,
8+
ReplayConfiguration as InternalReplayConfiguration,
9+
ReplayEventType as InternalReplayEventType,
10+
ReplayEventWithTime as InternalReplayEventWithTime,
11+
ReplayFrame as InternalReplayFrame,
12+
ReplayFrameEvent as InternalReplayFrameEvent,
13+
ReplayOptionFrameEvent as InternalReplayOptionFrameEvent,
14+
ReplaySpanFrame as InternalReplaySpanFrame,
15+
ReplaySpanFrameEvent as InternalReplaySpanFrameEvent,
16+
} from './types';
17+
import { getReplay as internalGetReplay } from './util/getReplay';
18+
19+
/** @deprecated Use the export from `@sentry/replay` or from framework-specific SDKs like `@sentry/react` or `@sentry/vue` */
20+
const getReplay = internalGetReplay;
21+
22+
/** @deprecated Use the export from `@sentry/replay` or from framework-specific SDKs like `@sentry/react` or `@sentry/vue` */
23+
const replayIntegration = internalReplayIntegration;
24+
25+
/** @deprecated Use the export from `@sentry/replay` or from framework-specific SDKs like `@sentry/react` or `@sentry/vue` */
26+
// eslint-disable-next-line deprecation/deprecation
27+
class Replay extends InternalReplay {}
28+
29+
// eslint-disable-next-line deprecation/deprecation
30+
export { replayIntegration, getReplay, Replay, internalReplayIntegration, internalGetReplay, InternalReplay };
31+
32+
/** @deprecated Use the export from `@sentry/replay` or from framework-specific SDKs like `@sentry/react` or `@sentry/vue` */
33+
type ReplayConfiguration = InternalReplayConfiguration;
34+
35+
/** @deprecated Use the export from `@sentry/replay` or from framework-specific SDKs like `@sentry/react` or `@sentry/vue` */
36+
type ReplayEventType = InternalReplayEventType;
37+
38+
/** @deprecated Use the export from `@sentry/replay` or from framework-specific SDKs like `@sentry/react` or `@sentry/vue` */
39+
type ReplayEventWithTime = InternalReplayEventWithTime;
40+
41+
/** @deprecated Use the export from `@sentry/replay` or from framework-specific SDKs like `@sentry/react` or `@sentry/vue` */
42+
type ReplayBreadcrumbFrame = InternalReplayBreadcrumbFrame;
43+
44+
/** @deprecated Use the export from `@sentry/replay` or from framework-specific SDKs like `@sentry/react` or `@sentry/vue` */
45+
type ReplayBreadcrumbFrameEvent = InternalReplayBreadcrumbFrameEvent;
46+
47+
/** @deprecated Use the export from `@sentry/replay` or from framework-specific SDKs like `@sentry/react` or `@sentry/vue` */
48+
type ReplayOptionFrameEvent = InternalReplayOptionFrameEvent;
49+
50+
/** @deprecated Use the export from `@sentry/replay` or from framework-specific SDKs like `@sentry/react` or `@sentry/vue` */
51+
type ReplayFrame = InternalReplayFrame;
52+
53+
/** @deprecated Use the export from `@sentry/replay` or from framework-specific SDKs like `@sentry/react` or `@sentry/vue` */
54+
type ReplayFrameEvent = InternalReplayFrameEvent;
55+
56+
/** @deprecated Use the export from `@sentry/replay` or from framework-specific SDKs like `@sentry/react` or `@sentry/vue` */
57+
type ReplaySpanFrame = InternalReplaySpanFrame;
58+
59+
/** @deprecated Use the export from `@sentry/replay` or from framework-specific SDKs like `@sentry/react` or `@sentry/vue` */
60+
type ReplaySpanFrameEvent = InternalReplaySpanFrameEvent;
61+
62+
/** @deprecated Use the export from `@sentry/replay` or from framework-specific SDKs like `@sentry/react` or `@sentry/vue` */
63+
type CanvasManagerInterface = InternalCanvasManagerInterface;
64+
65+
/** @deprecated Use the export from `@sentry/replay` or from framework-specific SDKs like `@sentry/react` or `@sentry/vue` */
66+
type CanvasManagerOptions = InternalCanvasManagerOptions;
667

768
export type {
69+
// eslint-disable-next-line deprecation/deprecation
70+
CanvasManagerInterface,
71+
// eslint-disable-next-line deprecation/deprecation
72+
CanvasManagerOptions,
73+
// eslint-disable-next-line deprecation/deprecation
74+
ReplayBreadcrumbFrame,
75+
// eslint-disable-next-line deprecation/deprecation
76+
ReplayBreadcrumbFrameEvent,
77+
// eslint-disable-next-line deprecation/deprecation
878
ReplayConfiguration,
79+
// eslint-disable-next-line deprecation/deprecation
980
ReplayEventType,
81+
// eslint-disable-next-line deprecation/deprecation
1082
ReplayEventWithTime,
11-
ReplayBreadcrumbFrame,
12-
ReplayBreadcrumbFrameEvent,
13-
ReplayOptionFrameEvent,
83+
// eslint-disable-next-line deprecation/deprecation
1484
ReplayFrame,
85+
// eslint-disable-next-line deprecation/deprecation
1586
ReplayFrameEvent,
87+
// eslint-disable-next-line deprecation/deprecation
88+
ReplayOptionFrameEvent,
89+
// eslint-disable-next-line deprecation/deprecation
1690
ReplaySpanFrame,
91+
// eslint-disable-next-line deprecation/deprecation
1792
ReplaySpanFrameEvent,
18-
CanvasManagerInterface,
19-
CanvasManagerOptions,
20-
} from './types';
21-
22-
export { getReplay } from './util/getReplay';
93+
InternalCanvasManagerInterface,
94+
InternalCanvasManagerOptions,
95+
InternalReplayBreadcrumbFrame,
96+
InternalReplayBreadcrumbFrameEvent,
97+
InternalReplayConfiguration,
98+
InternalReplayEventType,
99+
InternalReplayEventWithTime,
100+
InternalReplayFrame,
101+
InternalReplayFrameEvent,
102+
InternalReplayOptionFrameEvent,
103+
InternalReplaySpanFrame,
104+
InternalReplaySpanFrameEvent,
105+
};
23106

24107
// TODO (v8): Remove deprecated types
25108
export * from './types/deprecated';

packages/replay/test/integration/beforeAddRecordingEvent.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as SentryCore from '@sentry/core';
22
import type { Transport } from '@sentry/types';
33
import * as SentryUtils from '@sentry/utils';
44

5+
// eslint-disable-next-line deprecation/deprecation
56
import type { Replay } from '../../src';
67
import type { ReplayContainer } from '../../src/replay';
78
import { clearSession } from '../../src/session/clearSession';

packages/replay/test/integration/stop.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as SentryUtils from '@sentry/utils';
22

3+
// eslint-disable-next-line deprecation/deprecation
34
import type { Replay } from '../../src';
45
import { WINDOW } from '../../src/constants';
56
import type { ReplayContainer } from '../../src/replay';

packages/replay/test/mocks/mockSdk.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { Envelope, Transport, TransportMakeRequestResponse } from '@sentry/types';
22

3+
// eslint-disable-next-line deprecation/deprecation
34
import type { Replay as ReplayIntegration } from '../../src';
45
import type { ReplayContainer } from '../../src/replay';
56
import type { ReplayConfiguration } from '../../src/types';

packages/replay/test/utils/getTestEvent.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// eslint-disable-next-line deprecation/deprecation
12
import type { ReplayEventType, ReplayEventWithTime } from '../../src';
23
import { ReplayEventTypeFullSnapshot, ReplayEventTypeIncrementalSnapshot } from '../../src/types';
34

@@ -8,7 +9,9 @@ export function getTestEvent({
89
}: {
910
timestamp: number;
1011
data?: any;
12+
// eslint-disable-next-line deprecation/deprecation
1113
type: ReplayEventType;
14+
// eslint-disable-next-line deprecation/deprecation
1215
}): ReplayEventWithTime {
1316
return {
1417
data: data || {},
@@ -17,10 +20,12 @@ export function getTestEvent({
1720
};
1821
}
1922

23+
// eslint-disable-next-line deprecation/deprecation
2024
export function getTestEventCheckout({ timestamp, data }: { timestamp: number; data?: any }): ReplayEventWithTime {
2125
return getTestEvent({ timestamp, data, type: ReplayEventTypeFullSnapshot });
2226
}
2327

28+
// eslint-disable-next-line deprecation/deprecation
2429
export function getTestEventIncremental({ timestamp, data }: { timestamp: number; data?: any }): ReplayEventWithTime {
2530
return getTestEvent({ timestamp, data, type: ReplayEventTypeIncrementalSnapshot });
2631
}

0 commit comments

Comments
 (0)