@highlight-run/rrweb 2.0.20 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/plugins/console-record.js +8 -8
  2. package/dist/plugins/console-record.min.js +8 -8
  3. package/dist/plugins/console-record.min.js.map +1 -1
  4. package/dist/plugins/console-replay.min.js.map +1 -1
  5. package/dist/record/rrweb-record-pack.min.js.map +1 -1
  6. package/dist/record/rrweb-record.js +3 -3
  7. package/dist/record/rrweb-record.min.js +3 -3
  8. package/dist/record/rrweb-record.min.js.map +1 -1
  9. package/dist/replay/rrweb-replay-unpack.js +4 -4
  10. package/dist/replay/rrweb-replay-unpack.min.js +4 -4
  11. package/dist/replay/rrweb-replay-unpack.min.js.map +1 -1
  12. package/dist/replay/rrweb-replay.js +4 -4
  13. package/dist/replay/rrweb-replay.min.js +4 -4
  14. package/dist/replay/rrweb-replay.min.js.map +1 -1
  15. package/dist/rrweb-all.js +12 -12
  16. package/dist/rrweb-all.min.js +12 -12
  17. package/dist/rrweb-all.min.js.map +1 -1
  18. package/dist/rrweb.js +5 -5
  19. package/dist/rrweb.min.js +5 -5
  20. package/dist/rrweb.min.js.map +1 -1
  21. package/es/rrweb/ext/mitt/dist/mitt.mjs.js +3 -0
  22. package/es/rrweb/packages/rrdom/es/rrdom.js +66 -10
  23. package/es/rrweb/packages/rrweb/src/plugins/console/record/error-stack-parser.js +3 -11
  24. package/es/rrweb/packages/rrweb/src/plugins/console/record/index.js +10 -7
  25. package/es/rrweb/packages/rrweb/src/plugins/console/record/stringify.js +9 -6
  26. package/es/rrweb/packages/rrweb/src/record/mutation.js +5 -3
  27. package/es/rrweb/packages/rrweb/src/record/observer.js +22 -14
  28. package/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas-manager.js +1 -1
  29. package/es/rrweb/packages/rrweb/src/record/shadow-dom-manager.js +7 -4
  30. package/es/rrweb/packages/rrweb/src/replay/canvas/2d.js +3 -2
  31. package/es/rrweb/packages/rrweb/src/replay/canvas/webgl.js +1 -2
  32. package/es/rrweb/packages/rrweb/src/replay/index.js +151 -180
  33. package/es/rrweb/packages/rrweb/src/replay/timer.js +6 -7
  34. package/es/rrweb/packages/rrweb/src/utils.js +8 -6
  35. package/es/rrweb/packages/rrweb-snapshot/es/rrweb-snapshot.js +60 -10
  36. package/lib/plugins/console-record.js +26 -26
  37. package/lib/record/rrweb-record.js +91 -31
  38. package/lib/replay/rrweb-replay-unpack.js +236 -265
  39. package/lib/replay/rrweb-replay.js +236 -265
  40. package/lib/rrweb-all.js +346 -318
  41. package/lib/rrweb.js +324 -294
  42. package/package.json +9 -8
  43. package/typings/plugins/console/record/index.d.ts +1 -1
  44. package/typings/plugins/console/record/stringify.d.ts +1 -1
  45. package/typings/record/observers/canvas/serialize-args.d.ts +5 -5
  46. package/typings/record/shadow-dom-manager.d.ts +1 -1
  47. package/typings/replay/index.d.ts +0 -2
  48. package/typings/types.d.ts +5 -6
  49. package/typings/utils.d.ts +2 -2
  50. package/es/rrweb/ext/mitt/dist/mitt.es.js +0 -63
  51. package/typings/record/observers/canvas/webgl2.d.ts +0 -2
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@highlight-run/rrweb",
3
- "version": "2.0.20",
3
+ "version": "2.1.2",
4
4
  "description": "record and replay the web",
5
5
  "scripts": {
6
6
  "prepare": "npm run prepack",
7
7
  "prepack": "npm run bundle",
8
- "test": "npm run bundle:browser && jest",
9
- "test:headless": "npm run bundle:browser && PUPPETEER_HEADLESS=true jest",
8
+ "test": "npm run bundle:browser && jest --testPathIgnorePatterns test/benchmark",
9
+ "test:headless": "PUPPETEER_HEADLESS=true npm run test",
10
10
  "test:watch": "PUPPETEER_HEADLESS=true npm run test -- --watch",
11
11
  "repl": "npm run bundle:browser && node scripts/repl.js",
12
12
  "dev": "yarn bundle:browser --watch",
@@ -15,7 +15,8 @@
15
15
  "typings": "tsc -d --declarationDir typings",
16
16
  "check-types": "tsc -noEmit",
17
17
  "prepublish": "npm run typings && npm run bundle",
18
- "lint": "yarn eslint src"
18
+ "lint": "yarn eslint src",
19
+ "benchmark": "jest test/benchmark"
19
20
  },
20
21
  "repository": {
21
22
  "type": "git",
@@ -74,13 +75,13 @@
74
75
  "typescript": "^4.7.3"
75
76
  },
76
77
  "dependencies": {
77
- "@highlight-run/rrdom": "0.1.16",
78
- "@highlight-run/rrweb-snapshot": "1.1.24",
78
+ "@highlight-run/rrdom": "0.1.17",
79
+ "@highlight-run/rrweb-snapshot": "1.1.25",
79
80
  "@types/css-font-loading-module": "0.0.7",
80
81
  "@xstate/fsm": "^1.4.0",
81
82
  "base64-arraybuffer": "^1.0.1",
82
83
  "fflate": "^0.4.4",
83
- "mitt": "^1.1.3"
84
+ "mitt": "^3.0.0"
84
85
  },
85
- "gitHead": "a3e3adaccfe14de977eb580e3c257bd742bb5e28"
86
+ "gitHead": "8e06f47a84774ac76f3fac474abc62770cc1f46b"
86
87
  }
@@ -15,7 +15,6 @@ export declare type LogData = {
15
15
  trace: string[];
16
16
  payload: string[];
17
17
  };
18
- export declare type LogLevel = 'assert' | 'clear' | 'count' | 'countReset' | 'debug' | 'dir' | 'dirxml' | 'error' | 'group' | 'groupCollapsed' | 'groupEnd' | 'info' | 'log' | 'table' | 'time' | 'timeEnd' | 'timeLog' | 'trace' | 'warn';
19
18
  export declare type Logger = {
20
19
  assert?: typeof console.assert;
21
20
  clear?: typeof console.clear;
@@ -37,6 +36,7 @@ export declare type Logger = {
37
36
  trace?: typeof console.trace;
38
37
  warn?: typeof console.warn;
39
38
  };
39
+ export declare type LogLevel = keyof Logger;
40
40
  export declare const PLUGIN_NAME = "rrweb/console@1";
41
41
  export declare const getRecordConsolePlugin: (options?: LogRecordOptions) => RecordPlugin;
42
42
  export {};
@@ -1,2 +1,2 @@
1
1
  import type { StringifyOptions } from './index';
2
- export declare function stringify(obj: any, stringifyOptions?: StringifyOptions): string;
2
+ export declare function stringify(obj: unknown, stringifyOptions?: StringifyOptions): string;
@@ -1,6 +1,6 @@
1
1
  import type { IWindow, CanvasArg } from '../../../types';
2
- export declare function variableListFor(ctx: RenderingContext, ctor: string): any[];
3
- export declare const saveWebGLVar: (value: any, win: IWindow, ctx: RenderingContext) => number | void;
4
- export declare function serializeArg(value: any, win: IWindow, ctx: RenderingContext): CanvasArg;
5
- export declare const serializeArgs: (args: Array<any>, win: IWindow, ctx: RenderingContext) => CanvasArg[];
6
- export declare const isInstanceOfWebGLObject: (value: any, win: IWindow) => value is WebGLTexture | WebGLShader | WebGLBuffer | WebGLVertexArrayObject | WebGLProgram | WebGLActiveInfo | WebGLUniformLocation | WebGLFramebuffer | WebGLRenderbuffer | WebGLShaderPrecisionFormat;
2
+ export declare function variableListFor(ctx: RenderingContext, ctor: string): unknown[];
3
+ export declare const saveWebGLVar: (value: unknown, win: IWindow, ctx: RenderingContext) => number | void;
4
+ export declare function serializeArg(value: unknown, win: IWindow, ctx: RenderingContext): CanvasArg;
5
+ export declare const serializeArgs: (args: Array<unknown>, win: IWindow, ctx: RenderingContext) => CanvasArg[];
6
+ export declare const isInstanceOfWebGLObject: (value: unknown, win: IWindow) => value is WebGLTexture | WebGLShader | WebGLBuffer | WebGLVertexArrayObject | WebGLProgram | WebGLActiveInfo | WebGLUniformLocation | WebGLFramebuffer | WebGLRenderbuffer | WebGLShaderPrecisionFormat;
@@ -1,4 +1,4 @@
1
- import type { mutationCallBack, scrollCallback, MutationBufferParam, SamplingStrategy } from '../types';
1
+ import type { MutationBufferParam, mutationCallBack, SamplingStrategy, scrollCallback } from '../types';
2
2
  import type { Mirror } from '@highlight-run/rrweb-snapshot';
3
3
  declare type BypassOptions = Omit<MutationBufferParam, 'doc' | 'mutationCb' | 'mirror' | 'shadowDomManager'> & {
4
4
  sampling: SamplingStrategy;
@@ -57,8 +57,6 @@ export declare class Replayer {
57
57
  private attachDocumentToIframe;
58
58
  private collectIframeAndAttachDocument;
59
59
  private waitForStylesheetLoad;
60
- private hasImageArg;
61
- private getImageArgs;
62
60
  private preloadAllImages;
63
61
  private preloadImages;
64
62
  private deserializeAndPreloadCanvasEvents;
@@ -23,11 +23,11 @@ export declare type SessionInterval = {
23
23
  };
24
24
  export declare type domContentLoadedEvent = {
25
25
  type: EventType.DomContentLoaded;
26
- data: {};
26
+ data: unknown;
27
27
  };
28
28
  export declare type loadedEvent = {
29
29
  type: EventType.Load;
30
- data: {};
30
+ data: unknown;
31
31
  };
32
32
  export declare type fullSnapshotEvent = {
33
33
  type: EventType.FullSnapshot;
@@ -65,7 +65,6 @@ export declare type pluginEvent<T = unknown> = {
65
65
  payload: T;
66
66
  };
67
67
  };
68
- export declare type styleSheetEvent = {};
69
68
  export declare enum IncrementalSource {
70
69
  Mutation = 0,
71
70
  MouseMove = 1,
@@ -140,7 +139,7 @@ export declare type SamplingStrategy = Partial<{
140
139
  }>;
141
140
  export declare type RecordPlugin<TOptions = unknown> = {
142
141
  name: string;
143
- observer?: (cb: Function, win: IWindow, options: TOptions) => listenerHandler;
142
+ observer?: (cb: (...args: Array<unknown>) => void, win: IWindow, options: TOptions) => listenerHandler;
144
143
  eventProcessor?: <TExtend>(event: eventWithTime) => eventWithTime & TExtend;
145
144
  options: TOptions;
146
145
  };
@@ -207,8 +206,8 @@ export declare type observerParam = {
207
206
  canvasManager: CanvasManager;
208
207
  enableStrictPrivacy: boolean;
209
208
  plugins: Array<{
210
- observer: Function;
211
- callback: Function;
209
+ observer: (cb: (...arg: Array<unknown>) => void, win: IWindow, options: unknown) => listenerHandler;
210
+ callback: (...arg: Array<unknown>) => void;
212
211
  options: unknown;
213
212
  }>;
214
213
  };
@@ -3,11 +3,11 @@ import type { IMirror, Mirror } from '@highlight-run/rrweb-snapshot';
3
3
  import type { RRNode, RRIFrameElement } from '@highlight-run/rrdom';
4
4
  export declare function on(type: string, fn: EventListenerOrEventListenerObject, target?: Document | IWindow): listenerHandler;
5
5
  export declare let _mirror: DeprecatedMirror;
6
- export declare function throttle<T>(func: (arg: T) => void, wait: number, options?: throttleOptions): (arg: T) => void;
6
+ export declare function throttle<T>(func: (arg: T) => void, wait: number, options?: throttleOptions): (...args: T[]) => void;
7
7
  export declare function hookSetter<T>(target: T, key: string | number | symbol, d: PropertyDescriptor, isRevoked?: boolean, win?: Window & typeof globalThis): hookResetter;
8
8
  export declare function patch(source: {
9
9
  [key: string]: any;
10
- }, name: string, replacement: (...args: any[]) => any): () => void;
10
+ }, name: string, replacement: (...args: unknown[]) => unknown): () => void;
11
11
  export declare function getWindowHeight(): number;
12
12
  export declare function getWindowWidth(): number;
13
13
  export declare const isCanvasNode: (node: Node | null) => boolean;
@@ -1,63 +0,0 @@
1
- //
2
- // An event handler can take an optional event argument
3
- // and should not return a value
4
-
5
-
6
-
7
- // An array of all currently registered event handlers for a type
8
-
9
-
10
- // A map of event types and their corresponding event handlers.
11
-
12
-
13
-
14
-
15
-
16
- /** Mitt: Tiny (~200b) functional event emitter / pubsub.
17
- * @name mitt
18
- * @returns {Mitt}
19
- */
20
- function mitt(all ) {
21
- all = all || Object.create(null);
22
-
23
- return {
24
- /**
25
- * Register an event handler for the given type.
26
- *
27
- * @param {String} type Type of event to listen for, or `"*"` for all events
28
- * @param {Function} handler Function to call in response to given event
29
- * @memberOf mitt
30
- */
31
- on: function on(type , handler ) {
32
- (all[type] || (all[type] = [])).push(handler);
33
- },
34
-
35
- /**
36
- * Remove an event handler for the given type.
37
- *
38
- * @param {String} type Type of event to unregister `handler` from, or `"*"`
39
- * @param {Function} handler Handler function to remove
40
- * @memberOf mitt
41
- */
42
- off: function off(type , handler ) {
43
- if (all[type]) {
44
- all[type].splice(all[type].indexOf(handler) >>> 0, 1);
45
- }
46
- },
47
-
48
- /**
49
- * Invoke all handlers for the given type.
50
- * If present, `"*"` handlers are invoked after type-matched handlers.
51
- *
52
- * @param {String} type The event type to invoke
53
- * @param {Any} [evt] Any value (object is recommended and powerful), passed to each handler
54
- * @memberOf mitt
55
- */
56
- emit: function emit(type , evt ) {
57
- (all[type] || []).slice().map(function (handler) { handler(evt); });
58
- (all['*'] || []).slice().map(function (handler) { handler(type, evt); });
59
- }
60
- };
61
- }
62
-
63
- export { mitt as default };
@@ -1,2 +0,0 @@
1
- import { blockClass, canvasMutationCallback, IWindow, listenerHandler, Mirror } from '../../../types';
2
- export default function initCanvasWebGLMutationObserver(cb: canvasMutationCallback, win: IWindow, blockClass: blockClass, mirror: Mirror): listenerHandler;