Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .vscode/rrweb-monorepo.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,17 @@
{
"name": "rrweb-snapshot (package)",
"path": "../packages/rrweb-snapshot"
},
{
"name": "@rrweb/types",
"path": "../packages/types"
}
],
"settings": {
"jest.disabledWorkspaceFolders": [
" rrweb monorepo",
"rrweb-player (package)"
"rrweb-player (package)",
"@rrweb/types"
]
}
}
1 change: 1 addition & 0 deletions packages/rrdom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"rollup-plugin-typescript2": "^0.31.2",
"rollup-plugin-web-worker-loader": "^1.6.1",
"ts-jest": "^27.1.3",
"@rrweb/types": "^2.0.0-alpha.3",
"typescript": "^4.7.3"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/rrdom/src/diff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type {
scrollData,
styleDeclarationData,
styleSheetRuleData,
} from 'rrweb/src/types';
} from '@rrweb/types';
import type {
IRRCDATASection,
IRRComment,
Expand Down
2 changes: 1 addition & 1 deletion packages/rrdom/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import type {
scrollData,
styleSheetRuleData,
styleDeclarationData,
} from 'rrweb/src/types';
} from '@rrweb/types';
import {
BaseRRNode as RRNode,
BaseRRCDATASectionImpl,
Expand Down
6 changes: 3 additions & 3 deletions packages/rrdom/test/diff.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ import {
import type { IRRNode } from '../src/document';
import { Replayer } from 'rrweb';
import type {
eventWithTime,
canvasMutationData,
styleDeclarationData,
styleSheetRuleData,
} from 'rrweb/src/types';
import { EventType, IncrementalSource } from 'rrweb/src/types';
import type { eventWithTime } from 'rrweb/typings/types';
} from '@rrweb/types';
import { EventType, IncrementalSource } from '@rrweb/types';

const elementSn = {
type: RRNodeType.Element,
Expand Down
3 changes: 3 additions & 0 deletions packages/rrdom/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
"references": [
{
"path": "../rrweb-snapshot"
},
{
"path": "../types"
}
],
"compileOnSave": true,
Expand Down
1 change: 1 addition & 0 deletions packages/rrweb-player/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"devDependencies": {
"@rollup/plugin-commonjs": "^22.0.0",
"@rollup/plugin-node-resolve": "^13.2.1",
"@rrweb/types": "^2.0.0-alpha.3",
"@types/offscreencanvas": "^2019.6.4",
"eslint-config-google": "^0.14.0",
"eslint-plugin-svelte3": "^4.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/rrweb-player/src/Controller.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import { EventType } from 'rrweb';
import type { Replayer } from 'rrweb';
import type { playerMetaData } from 'rrweb/typings/types';
import type { playerMetaData } from '@rrweb/types';
import type {
PlayerMachineState,
SpeedMachineState,
Expand Down
2 changes: 1 addition & 1 deletion packages/rrweb-player/src/Player.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import { onMount, onDestroy } from 'svelte';
import { Replayer, unpack } from 'rrweb';
import type { eventWithTime } from 'rrweb/typings/types';
import type { eventWithTime } from '@rrweb/types';
import {
inlineCss,
openFullscreen,
Expand Down
2 changes: 1 addition & 1 deletion packages/rrweb-player/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { eventWithTime } from 'rrweb/typings/types';
import type { eventWithTime } from '@rrweb/types';
import _Player from './Player.svelte';

type PlayerProps = {
Expand Down
3 changes: 3 additions & 0 deletions packages/rrweb-player/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
"references": [
{
"path": "../rrweb"
},
{
"path": "../types"
}
]
}
1 change: 1 addition & 0 deletions packages/rrweb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
"typescript": "^4.7.3"
},
"dependencies": {
"@rrweb/types": "^2.0.0-alpha.3",
"@types/css-font-loading-module": "0.0.7",
"@xstate/fsm": "^1.4.0",
"base64-arraybuffer": "^1.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/rrweb/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export {
IncrementalSource,
MouseInteractions,
ReplayerEvents,
} from './types';
} from '@rrweb/types';

const { addCustomEvent } = record;
const { freezePage } = record;
Expand Down
2 changes: 1 addition & 1 deletion packages/rrweb/src/packer/base.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { eventWithTime } from '../types';
import type { eventWithTime } from '@rrweb/types';

export type PackFn = (event: eventWithTime) => string;
export type UnpackFn = (raw: string) => eventWithTime;
Expand Down
2 changes: 1 addition & 1 deletion packages/rrweb/src/packer/unpack.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { strFromU8, strToU8, unzlibSync } from 'fflate';
import { UnpackFn, eventWithTimeAndPacker, MARK } from './base';
import type { eventWithTime } from '../types';
import type { eventWithTime } from '@rrweb/types';

export const unpack: UnpackFn = (raw: string) => {
if (typeof raw !== 'string') {
Expand Down
2 changes: 1 addition & 1 deletion packages/rrweb/src/plugins/canvas-webrtc/record/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Mirror } from 'rrweb-snapshot';
import SimplePeer from 'simple-peer-light';
import type { RecordPlugin } from '../../../types';
import type { RecordPlugin } from '@rrweb/types';
import type { WebRTCDataChannel } from '../types';

export const PLUGIN_NAME = 'rrweb/canvas-webrtc@1';
Expand Down
2 changes: 1 addition & 1 deletion packages/rrweb/src/plugins/console/record/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { listenerHandler, RecordPlugin, IWindow } from '../../../types';
import type { listenerHandler, RecordPlugin, IWindow } from '@rrweb/types';
import { patch } from '../../../utils';
import { ErrorStackParser, StackFrame } from './error-stack-parser';
import { stringify } from './stringify';
Expand Down
9 changes: 3 additions & 6 deletions packages/rrweb/src/plugins/console/replay/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { LogLevel, LogData, PLUGIN_NAME } from '../record';
import {
eventWithTime,
EventType,
IncrementalSource,
ReplayPlugin,
} from '../../../types';
import type { eventWithTime } from '@rrweb/types';
import { EventType, IncrementalSource } from '@rrweb/types';
import type { ReplayPlugin } from '../../../types';

/**
* define an interface to replay log records
Expand Down
2 changes: 1 addition & 1 deletion packages/rrweb/src/plugins/sequential-id/record/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { RecordPlugin } from '../../../types';
import type { RecordPlugin } from '@rrweb/types';

export type SequentialIdOptions = {
key: string;
Expand Down
3 changes: 2 additions & 1 deletion packages/rrweb/src/plugins/sequential-id/replay/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { SequentialIdOptions } from '../record';
import type { ReplayPlugin, eventWithTime } from '../../../types';
import type { ReplayPlugin } from '../../../types';
import type { eventWithTime } from '@rrweb/types';

type Options = SequentialIdOptions & {
warnOnMissingId: boolean;
Expand Down
2 changes: 1 addition & 1 deletion packages/rrweb/src/record/iframe-manager.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Mirror, serializedNodeWithId } from 'rrweb-snapshot';
import type { mutationCallBack } from '../types';
import type { mutationCallBack } from '@rrweb/types';
import type { StylesheetManager } from './stylesheet-manager';

export class IframeManager {
Expand Down
4 changes: 2 additions & 2 deletions packages/rrweb/src/record/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ import {
isSerializedIframe,
isSerializedStylesheet,
} from '../utils';
import type { recordOptions } from '../types';
import {
EventType,
event,
eventWithTime,
recordOptions,
IncrementalSource,
listenerHandler,
mutationCallbackParam,
scrollCallback,
canvasMutationParam,
adoptedStyleSheetParam,
} from '../types';
} from '@rrweb/types';
import { IframeManager } from './iframe-manager';
import { ShadowDomManager } from './shadow-dom-manager';
import { CanvasManager } from './observers/canvas/canvas-manager';
Expand Down
5 changes: 2 additions & 3 deletions packages/rrweb/src/record/mutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,16 @@ import {
Mirror,
isNativeShadowDom,
} from 'rrweb-snapshot';
import type { observerParam, MutationBufferParam } from '../types';
import type {
mutationRecord,
textCursor,
attributeCursor,
removedNodeMutation,
addedNodeMutation,
styleAttributeValue,
observerParam,
MutationBufferParam,
Optional,
} from '../types';
} from '@rrweb/types';
import {
isBlocked,
isAncestorRemoved,
Expand Down
5 changes: 2 additions & 3 deletions packages/rrweb/src/record/observer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import {
patch,
StyleSheetMirror,
} from '../utils';
import type { observerParam, MutationBufferParam } from '../types';
import {
mutationCallBack,
observerParam,
mousemoveCallBack,
mousePosition,
mouseInteractionCallBack,
Expand All @@ -35,10 +35,9 @@ import {
fontParam,
styleDeclarationCallback,
IWindow,
MutationBufferParam,
SelectionRange,
selectionCallback,
} from '../types';
} from '@rrweb/types';
import MutationBuffer from './mutation';

type WindowWithStoredMutationObserver = IWindow & {
Expand Down
2 changes: 1 addition & 1 deletion packages/rrweb/src/record/observers/canvas/2d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
canvasManagerMutationCallback,
IWindow,
listenerHandler,
} from '../../../types';
} from '@rrweb/types';
import { hookSetter, isBlocked, patch } from '../../../utils';
import { serializeArgs } from './serialize-args';

Expand Down
4 changes: 2 additions & 2 deletions packages/rrweb/src/record/observers/canvas/canvas-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import type {
IWindow,
listenerHandler,
CanvasArg,
} from '../../../types';
} from '@rrweb/types';
import { isBlocked } from '../../../utils';
import { CanvasContext } from '../../../types';
import { CanvasContext } from '@rrweb/types';
import initCanvas2DMutationObserver from './2d';
import initCanvasContextObserver from './canvas';
import initCanvasWebGLMutationObserver from './webgl';
Expand Down
2 changes: 1 addition & 1 deletion packages/rrweb/src/record/observers/canvas/canvas.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ICanvas } from 'rrweb-snapshot';
import type { blockClass, IWindow, listenerHandler } from '../../../types';
import type { blockClass, IWindow, listenerHandler } from '@rrweb/types';
import { isBlocked, patch } from '../../../utils';

export default function initCanvasContextObserver(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { encode } from 'base64-arraybuffer';
import type { IWindow, CanvasArg } from '../../../types';
import type { IWindow, CanvasArg } from '@rrweb/types';

// TODO: unify with `replay/webgl.ts`
type CanvasVarMap = Map<string, unknown[]>;
Expand Down
2 changes: 1 addition & 1 deletion packages/rrweb/src/record/observers/canvas/webgl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
canvasMutationWithType,
IWindow,
listenerHandler,
} from '../../../types';
} from '@rrweb/types';
import { hookSetter, isBlocked, patch } from '../../../utils';
import { saveWebGLVar, serializeArgs } from './serialize-args';

Expand Down
4 changes: 2 additions & 2 deletions packages/rrweb/src/record/shadow-dom-manager.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { MutationBufferParam } from '../types';
import type {
mutationCallBack,
scrollCallback,
MutationBufferParam,
SamplingStrategy,
} from '../types';
} from '@rrweb/types';
import {
initMutationObserver,
initScrollObserver,
Expand Down
2 changes: 1 addition & 1 deletion packages/rrweb/src/record/stylesheet-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type {
adoptedStyleSheetParam,
attributeMutation,
mutationCallBack,
} from '../types';
} from '@rrweb/types';
import { StyleSheetMirror } from '../utils';

export class StylesheetManager {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { DataURLOptions } from 'rrweb-snapshot';
import type {
ImageBitmapDataURLWorkerParams,
ImageBitmapDataURLWorkerResponse,
} from '../../types';
} from '@rrweb/types';

const lastBlobMap: Map<number, string> = new Map();
const transparentBlobMap: Map<string, string> = new Map();
Expand Down
2 changes: 1 addition & 1 deletion packages/rrweb/src/replay/canvas/2d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Replayer } from '../';
import type { canvasMutationCommand } from '../../types';
import type { canvasMutationCommand } from '@rrweb/types';
import { deserializeArg } from './deserialize-args';

export default async function canvasMutation({
Expand Down
2 changes: 1 addition & 1 deletion packages/rrweb/src/replay/canvas/deserialize-args.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { decode } from 'base64-arraybuffer';
import type { Replayer } from '../';
import type { CanvasArg, SerializedCanvasArg } from '../../types';
import type { CanvasArg, SerializedCanvasArg } from '@rrweb/types';

// TODO: add ability to wipe this list
type GLVarMap = Map<string, any[]>;
Expand Down
2 changes: 1 addition & 1 deletion packages/rrweb/src/replay/canvas/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
canvasMutationCommand,
canvasMutationData,
canvasMutationParam,
} from '../../types';
} from '@rrweb/types';
import webglMutation from './webgl';
import canvas2DMutation from './2d';

Expand Down
2 changes: 1 addition & 1 deletion packages/rrweb/src/replay/canvas/webgl.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Replayer } from '../';
import { CanvasContext, canvasMutationCommand } from '../../types';
import { CanvasContext, canvasMutationCommand } from '@rrweb/types';
import { deserializeArg, variableListFor } from './deserialize-args';

function getContext(
Expand Down
5 changes: 2 additions & 3 deletions packages/rrweb/src/replay/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,15 @@ import * as mittProxy from 'mitt';
import { polyfill as smoothscrollPolyfill } from './smoothscroll';
import { Timer } from './timer';
import { createPlayerService, createSpeedService } from './machine';
import type { playerConfig, missingNodeMap } from '../types';
import {
EventType,
IncrementalSource,
fullSnapshotEvent,
eventWithTime,
MouseInteractions,
playerConfig,
playerMetaData,
viewportResizeDimension,
missingNodeMap,
addedNodeMutation,
incrementalSnapshotEvent,
incrementalData,
Expand All @@ -63,7 +62,7 @@ import {
styleSheetRuleData,
styleDeclarationData,
adoptedStyleSheetData,
} from '../types';
} from '@rrweb/types';
import {
polyfill,
queueToResolveTrees,
Expand Down
Loading