Skip to content

Commit

Permalink
ref(replay): Use Sentry's forked rrweb packages (#6935)
Browse files Browse the repository at this point in the history
As outlined in getsentry/rrweb#15, we're now releasing packages of our rrrweb fork:

* replace the original rrweb dependency with our forked one
* remove the patches for the original rrweb dependency which we now don't need anymore
* remove the `patch-package` dev dependency, as we're not patching any package anymore

In terms of building the rrweb package, nothing changes - we're still inlining the rrweb code.
  • Loading branch information
Lms24 authored Jan 26, 2023
1 parent 77de64e commit 67fec37
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 10,902 deletions.
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
"postpublish": "lerna run --stream --concurrency 1 postpublish",
"test": "lerna run --ignore @sentry-internal/* test",
"test-ci-browser": "lerna run test --ignore \"@sentry/{node,opentelemetry-node,serverless,nextjs,remix,gatsby}\" --ignore @sentry-internal/*",
"test-ci-node": "ts-node ./scripts/node-unit-tests.ts",
"postinstall": "patch-package"
"test-ci-node": "ts-node ./scripts/node-unit-tests.ts"
},
"volta": {
"node": "16.18.1",
Expand Down Expand Up @@ -91,7 +90,6 @@
"mocha": "^6.1.4",
"nodemon": "^2.0.16",
"npm-run-all": "^4.1.5",
"patch-package": "^6.5.0",
"prettier": "2.7.1",
"recast": "^0.20.5",
"replace-in-file": "^4.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/replay/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"@types/pako": "^2.0.0",
"jsdom-worker": "^0.2.1",
"pako": "^2.0.4",
"rrweb": "1.1.3",
"@sentry-internal/rrweb": "1.100.1",
"tslib": "^1.9.3"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/replay/src/coreHandlers/addBreadcrumbEvent.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EventType } from '@sentry-internal/rrweb';
import type { Breadcrumb } from '@sentry/types';
import { EventType } from 'rrweb';

import type { ReplayContainer } from '../types';
import { addEvent } from '../util/addEvent';
Expand Down
2 changes: 1 addition & 1 deletion packages/replay/src/coreHandlers/handleDom.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { record } from '@sentry-internal/rrweb';
import type { Breadcrumb } from '@sentry/types';
import { htmlTreeAsString } from '@sentry/utils';
import { record } from 'rrweb';

import type { ReplayContainer } from '../types';
import { createBreadcrumb } from '../util/createBreadcrumb';
Expand Down
2 changes: 1 addition & 1 deletion packages/replay/src/replay.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* eslint-disable max-lines */ // TODO: We might want to split this file up
import { EventType, record } from '@sentry-internal/rrweb';
import { captureException } from '@sentry/core';
import type { Breadcrumb, ReplayRecordingMode } from '@sentry/types';
import type { RateLimits } from '@sentry/utils';
import { disabledUntil, logger } from '@sentry/utils';
import { EventType, record } from 'rrweb';

import { MAX_SESSION_LIFE, SESSION_IDLE_DURATION, VISIBILITY_CHANGE_TIMEOUT, WINDOW } from './constants';
import { setupPerformanceObserver } from './coreHandlers/performanceObserver';
Expand Down
2 changes: 1 addition & 1 deletion packages/replay/src/util/createPerformanceEntries.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { record } from '@sentry-internal/rrweb';
import { browserPerformanceTimeOrigin } from '@sentry/utils';
import { record } from 'rrweb';

import { WINDOW } from '../constants';
import type {
Expand Down
2 changes: 1 addition & 1 deletion packages/replay/src/util/createPerformanceSpans.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EventType } from 'rrweb';
import { EventType } from '@sentry-internal/rrweb';

import type { AddEventResult, ReplayContainer, ReplayPerformanceEntry } from '../types';
import { addEvent } from './addEvent';
Expand Down
2 changes: 1 addition & 1 deletion packages/replay/test/integration/autoSaveSession.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EventType } from 'rrweb';
import { EventType } from '@sentry-internal/rrweb';

import type { RecordingEvent } from '../../src/types';
import { addEvent } from '../../src/util/addEvent';
Expand Down
6 changes: 3 additions & 3 deletions packages/replay/test/mocks/mockRrweb.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { record as rrwebRecord } from 'rrweb';
import type { record as rrwebRecord } from '@sentry-internal/rrweb';

import type { RecordingEvent } from '../../src/types';

Expand Down Expand Up @@ -41,8 +41,8 @@ export function mockRrweb(): { record: RecordMock } {
mockRecordFn._emitter(createCheckoutPayload(isCheckout), isCheckout);
});

jest.mock('rrweb', () => {
const ActualRrweb = jest.requireActual('rrweb');
jest.mock('@sentry-internal/rrweb', () => {
const ActualRrweb = jest.requireActual('@sentry-internal/rrweb');

return {
...ActualRrweb,
Expand Down
Loading

0 comments on commit 67fec37

Please sign in to comment.