@highlight-run/rrweb 1.2.0 → 2.0.1

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 (185) hide show
  1. package/dist/plugins/console-record.js +655 -0
  2. package/dist/plugins/console-record.min.js +1 -1
  3. package/dist/plugins/console-record.min.js.map +1 -1
  4. package/dist/plugins/console-replay.js +293 -0
  5. package/dist/plugins/console-replay.min.js +16 -0
  6. package/dist/plugins/console-replay.min.js.map +1 -0
  7. package/dist/plugins/sequential-id-record.js +33 -0
  8. package/dist/plugins/sequential-id-record.min.js +2 -0
  9. package/dist/plugins/sequential-id-record.min.js.map +1 -0
  10. package/dist/plugins/sequential-id-replay.js +37 -0
  11. package/dist/plugins/sequential-id-replay.min.js +2 -0
  12. package/dist/plugins/sequential-id-replay.min.js.map +1 -0
  13. package/dist/record/rrweb-record-pack.js +747 -0
  14. package/dist/record/rrweb-record-pack.min.js +16 -0
  15. package/dist/record/rrweb-record-pack.min.js.map +1 -0
  16. package/dist/record/rrweb-record.js +3318 -0
  17. package/dist/record/rrweb-record.min.js +16 -0
  18. package/dist/record/rrweb-record.min.js.map +1 -0
  19. package/dist/replay/rrweb-replay-unpack.js +4626 -0
  20. package/dist/replay/rrweb-replay-unpack.min.css +2 -0
  21. package/dist/replay/rrweb-replay-unpack.min.css.map +1 -0
  22. package/dist/replay/rrweb-replay-unpack.min.js +30 -0
  23. package/dist/replay/rrweb-replay-unpack.min.js.map +1 -0
  24. package/dist/replay/rrweb-replay.js +4216 -0
  25. package/dist/replay/rrweb-replay.min.css +2 -0
  26. package/dist/replay/rrweb-replay.min.css.map +1 -0
  27. package/dist/replay/rrweb-replay.min.js +30 -0
  28. package/dist/replay/rrweb-replay.min.js.map +1 -0
  29. package/dist/rrweb-all.js +8708 -0
  30. package/dist/rrweb-all.min.css +2 -0
  31. package/dist/rrweb-all.min.css.map +1 -0
  32. package/dist/rrweb-all.min.js +30 -0
  33. package/dist/rrweb-all.min.js.map +1 -0
  34. package/dist/rrweb.js +7294 -0
  35. package/dist/rrweb.min.css +2 -0
  36. package/dist/rrweb.min.css.map +1 -0
  37. package/dist/rrweb.min.js +2 -2
  38. package/dist/rrweb.min.js.map +1 -1
  39. package/es/rrweb/ext/@xstate/fsm/es/index.js +17 -0
  40. package/es/rrweb/ext/base64-arraybuffer/dist/base64-arraybuffer.es5.js +49 -0
  41. package/es/rrweb/ext/fflate/esm/browser.js +777 -0
  42. package/es/rrweb/ext/mitt/dist/mitt.es.js +63 -0
  43. package/es/rrweb/packages/rrweb/ext/tslib/tslib.es6.js +78 -0
  44. package/es/rrweb/packages/rrweb/src/entries/all.js +13 -0
  45. package/es/rrweb/packages/rrweb/src/index.js +12 -0
  46. package/es/rrweb/packages/rrweb/src/packer/base.js +3 -0
  47. package/es/rrweb/packages/rrweb/src/packer/pack.js +10 -0
  48. package/es/rrweb/packages/rrweb/src/packer/unpack.js +29 -0
  49. package/es/rrweb/packages/rrweb/src/plugins/console/record/error-stack-parser.js +179 -0
  50. package/es/rrweb/packages/rrweb/src/plugins/console/record/index.js +134 -0
  51. package/es/rrweb/packages/rrweb/src/plugins/console/record/stringify.js +141 -0
  52. package/es/rrweb/packages/rrweb/src/plugins/console/replay/index.js +111 -0
  53. package/es/rrweb/packages/rrweb/src/plugins/sequential-id/record/index.js +23 -0
  54. package/es/rrweb/packages/rrweb/src/plugins/sequential-id/replay/index.js +28 -0
  55. package/es/rrweb/packages/rrweb/src/record/iframe-manager.js +32 -0
  56. package/es/rrweb/packages/rrweb/src/record/index.js +381 -0
  57. package/es/rrweb/packages/rrweb/src/record/mutation.js +532 -0
  58. package/es/rrweb/packages/rrweb/src/record/observer.js +665 -0
  59. package/es/rrweb/packages/rrweb/src/record/observers/canvas/2d.js +78 -0
  60. package/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas-manager.js +93 -0
  61. package/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas.js +30 -0
  62. package/es/rrweb/packages/rrweb/src/record/observers/canvas/serialize-args.js +116 -0
  63. package/es/rrweb/packages/rrweb/src/record/observers/canvas/webgl.js +78 -0
  64. package/es/rrweb/packages/rrweb/src/record/shadow-dom-manager.js +45 -0
  65. package/es/rrweb/packages/rrweb/src/replay/canvas/2d.js +25 -0
  66. package/es/rrweb/packages/rrweb/src/replay/canvas/index.js +35 -0
  67. package/es/rrweb/packages/rrweb/src/replay/canvas/webgl.js +124 -0
  68. package/es/rrweb/packages/rrweb/src/replay/index.js +1864 -0
  69. package/es/rrweb/packages/rrweb/src/replay/machine.js +321 -0
  70. package/es/rrweb/packages/rrweb/src/replay/smoothscroll.js +221 -0
  71. package/es/rrweb/packages/rrweb/src/replay/styles/inject-style.js +8 -0
  72. package/es/rrweb/packages/rrweb/src/replay/timer.js +96 -0
  73. package/es/rrweb/packages/rrweb/src/replay/virtual-styles.js +121 -0
  74. package/es/rrweb/packages/rrweb/src/types.js +75 -0
  75. package/es/rrweb/packages/rrweb/src/utils.js +509 -0
  76. package/es/rrweb/packages/rrweb-snapshot/es/rrweb-snapshot.js +1697 -0
  77. package/lib/plugins/console-record.js +650 -0
  78. package/lib/plugins/console-replay.js +288 -0
  79. package/lib/plugins/sequential-id-record.js +28 -0
  80. package/lib/plugins/sequential-id-replay.js +32 -0
  81. package/lib/record/rrweb-record-pack.js +742 -0
  82. package/lib/record/rrweb-record.js +3315 -0
  83. package/lib/replay/rrweb-replay-unpack.js +4621 -0
  84. package/lib/replay/rrweb-replay.js +4211 -0
  85. package/lib/rrweb-all.js +8703 -0
  86. package/lib/rrweb.js +7289 -0
  87. package/package.json +41 -43
  88. package/typings/entries/all.d.ts +6 -0
  89. package/{dist → typings}/entries/record-pack.d.ts +0 -0
  90. package/{dist → typings}/entries/replay-unpack.d.ts +0 -0
  91. package/{dist → typings}/index.d.ts +1 -2
  92. package/{dist → typings}/packer/base.d.ts +0 -0
  93. package/{dist → typings}/packer/index.d.ts +0 -0
  94. package/{dist → typings}/packer/pack.d.ts +0 -0
  95. package/{dist → typings}/packer/unpack.d.ts +0 -0
  96. package/{dist → typings}/plugins/console/record/error-stack-parser.d.ts +0 -0
  97. package/{dist → typings}/plugins/console/record/index.d.ts +3 -2
  98. package/{dist → typings}/plugins/console/record/stringify.d.ts +0 -0
  99. package/{dist → typings}/plugins/console/replay/index.d.ts +2 -2
  100. package/{dist → typings}/plugins/sequential-id/record/index.d.ts +0 -0
  101. package/{dist → typings}/plugins/sequential-id/replay/index.d.ts +0 -0
  102. package/{dist → typings}/record/iframe-manager.d.ts +1 -1
  103. package/{dist → typings}/record/index.d.ts +0 -0
  104. package/{dist → typings}/record/mutation.d.ts +5 -8
  105. package/typings/record/observer.d.ts +7 -0
  106. package/{dist → typings}/record/observers/canvas/2d.d.ts +0 -0
  107. package/{dist → typings}/record/observers/canvas/canvas-manager.d.ts +0 -0
  108. package/{dist → typings}/record/observers/canvas/canvas.d.ts +0 -0
  109. package/{dist → typings}/record/observers/canvas/serialize-args.d.ts +1 -1
  110. package/{dist → typings}/record/observers/canvas/webgl.d.ts +0 -0
  111. package/typings/record/observers/canvas/webgl2.d.ts +2 -0
  112. package/typings/record/shadow-dom-manager.d.ts +21 -0
  113. package/{dist → typings}/replay/canvas/2d.d.ts +0 -0
  114. package/{dist → typings}/replay/canvas/index.d.ts +0 -0
  115. package/{dist → typings}/replay/canvas/webgl.d.ts +0 -0
  116. package/{dist → typings}/replay/index.d.ts +1 -0
  117. package/{dist → typings}/replay/machine.d.ts +0 -0
  118. package/{dist → typings}/replay/smoothscroll.d.ts +0 -0
  119. package/{dist → typings}/replay/styles/inject-style.d.ts +0 -0
  120. package/{dist → typings}/replay/timer.d.ts +0 -0
  121. package/{dist → typings}/replay/virtual-styles.d.ts +1 -1
  122. package/{dist → typings}/rrdom/index.d.ts +0 -0
  123. package/{dist → typings}/rrdom/tree-node.d.ts +0 -0
  124. package/{dist → typings}/types.d.ts +7 -8
  125. package/{dist → typings}/utils.d.ts +3 -4
  126. package/CHANGELOG.md +0 -26
  127. package/README.md +0 -124
  128. package/README.zh_CN.md +0 -122
  129. package/dist/entries/all.d.ts +0 -4
  130. package/dist/index.css +0 -82
  131. package/dist/index.css.map +0 -1
  132. package/dist/index.js +0 -3
  133. package/dist/index.js.LICENSE.txt +0 -14
  134. package/dist/index.js.map +0 -1
  135. package/dist/plugins/entries/all.d.ts +0 -4
  136. package/dist/plugins/entries/record-pack.d.ts +0 -2
  137. package/dist/plugins/entries/replay-unpack.d.ts +0 -2
  138. package/dist/plugins/index.d.ts +0 -9
  139. package/dist/plugins/packer/base.d.ts +0 -7
  140. package/dist/plugins/packer/index.d.ts +0 -2
  141. package/dist/plugins/packer/pack.d.ts +0 -2
  142. package/dist/plugins/packer/unpack.d.ts +0 -2
  143. package/dist/plugins/plugins/console/record/error-stack-parser.d.ts +0 -37
  144. package/dist/plugins/plugins/console/record/index.d.ts +0 -41
  145. package/dist/plugins/plugins/console/record/stringify.d.ts +0 -2
  146. package/dist/plugins/plugins/console/replay/index.d.ts +0 -9
  147. package/dist/plugins/plugins/sequential-id/record/index.d.ts +0 -6
  148. package/dist/plugins/plugins/sequential-id/replay/index.d.ts +0 -7
  149. package/dist/plugins/record/iframe-manager.d.ts +0 -13
  150. package/dist/plugins/record/index.d.ts +0 -9
  151. package/dist/plugins/record/mutation.d.ts +0 -45
  152. package/dist/plugins/record/observer.d.ts +0 -11
  153. package/dist/plugins/record/observers/canvas/2d.d.ts +0 -2
  154. package/dist/plugins/record/observers/canvas/canvas-manager.d.ts +0 -32
  155. package/dist/plugins/record/observers/canvas/canvas.d.ts +0 -2
  156. package/dist/plugins/record/observers/canvas/serialize-args.d.ts +0 -6
  157. package/dist/plugins/record/observers/canvas/webgl.d.ts +0 -2
  158. package/dist/plugins/record/shadow-dom-manager.d.ts +0 -34
  159. package/dist/plugins/replay/canvas/2d.d.ts +0 -9
  160. package/dist/plugins/replay/canvas/index.d.ts +0 -9
  161. package/dist/plugins/replay/canvas/webgl.d.ts +0 -11
  162. package/dist/plugins/replay/index.d.ts +0 -82
  163. package/dist/plugins/replay/machine.d.ts +0 -85
  164. package/dist/plugins/replay/smoothscroll.d.ts +0 -1
  165. package/dist/plugins/replay/styles/inject-style.d.ts +0 -2
  166. package/dist/plugins/replay/timer.d.ts +0 -19
  167. package/dist/plugins/replay/virtual-styles.d.ts +0 -43
  168. package/dist/plugins/rrdom/index.d.ts +0 -1
  169. package/dist/plugins/rrdom/tree-node.d.ts +0 -20
  170. package/dist/plugins/snapshot/css.d.ts +0 -92
  171. package/dist/plugins/snapshot/index.d.ts +0 -5
  172. package/dist/plugins/snapshot/rebuild.d.ts +0 -19
  173. package/dist/plugins/snapshot/snapshot.d.ts +0 -49
  174. package/dist/plugins/snapshot/types.d.ts +0 -99
  175. package/dist/plugins/snapshot/utils.d.ts +0 -11
  176. package/dist/plugins/types.d.ts +0 -509
  177. package/dist/plugins/utils.d.ts +0 -71
  178. package/dist/record/observer.d.ts +0 -11
  179. package/dist/record/shadow-dom-manager.d.ts +0 -34
  180. package/dist/snapshot/css.d.ts +0 -92
  181. package/dist/snapshot/index.d.ts +0 -5
  182. package/dist/snapshot/rebuild.d.ts +0 -19
  183. package/dist/snapshot/snapshot.d.ts +0 -49
  184. package/dist/snapshot/types.d.ts +0 -99
  185. package/dist/snapshot/utils.d.ts +0 -11
@@ -0,0 +1,288 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ /*! *****************************************************************************
6
+ Copyright (c) Microsoft Corporation.
7
+
8
+ Permission to use, copy, modify, and/or distribute this software for any
9
+ purpose with or without fee is hereby granted.
10
+
11
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
12
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
14
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
16
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17
+ PERFORMANCE OF THIS SOFTWARE.
18
+ ***************************************************************************** */
19
+
20
+ function __values(o) {
21
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
22
+ if (m) return m.call(o);
23
+ if (o && typeof o.length === "number") return {
24
+ next: function () {
25
+ if (o && i >= o.length) o = void 0;
26
+ return { value: o && o[i++], done: !o };
27
+ }
28
+ };
29
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
30
+ }
31
+
32
+ function __read(o, n) {
33
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
34
+ if (!m) return o;
35
+ var i = m.call(o), r, ar = [], e;
36
+ try {
37
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
38
+ }
39
+ catch (error) { e = { error: error }; }
40
+ finally {
41
+ try {
42
+ if (r && !r.done && (m = i["return"])) m.call(i);
43
+ }
44
+ finally { if (e) throw e.error; }
45
+ }
46
+ return ar;
47
+ }
48
+
49
+ function __spreadArray(to, from, pack) {
50
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
51
+ if (ar || !(i in from)) {
52
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
53
+ ar[i] = from[i];
54
+ }
55
+ }
56
+ return to.concat(ar || Array.prototype.slice.call(from));
57
+ }
58
+
59
+ var EventType;
60
+ (function (EventType) {
61
+ EventType[EventType["DomContentLoaded"] = 0] = "DomContentLoaded";
62
+ EventType[EventType["Load"] = 1] = "Load";
63
+ EventType[EventType["FullSnapshot"] = 2] = "FullSnapshot";
64
+ EventType[EventType["IncrementalSnapshot"] = 3] = "IncrementalSnapshot";
65
+ EventType[EventType["Meta"] = 4] = "Meta";
66
+ EventType[EventType["Custom"] = 5] = "Custom";
67
+ EventType[EventType["Plugin"] = 6] = "Plugin";
68
+ })(EventType || (EventType = {}));
69
+ var IncrementalSource;
70
+ (function (IncrementalSource) {
71
+ IncrementalSource[IncrementalSource["Mutation"] = 0] = "Mutation";
72
+ IncrementalSource[IncrementalSource["MouseMove"] = 1] = "MouseMove";
73
+ IncrementalSource[IncrementalSource["MouseInteraction"] = 2] = "MouseInteraction";
74
+ IncrementalSource[IncrementalSource["Scroll"] = 3] = "Scroll";
75
+ IncrementalSource[IncrementalSource["ViewportResize"] = 4] = "ViewportResize";
76
+ IncrementalSource[IncrementalSource["Input"] = 5] = "Input";
77
+ IncrementalSource[IncrementalSource["TouchMove"] = 6] = "TouchMove";
78
+ IncrementalSource[IncrementalSource["MediaInteraction"] = 7] = "MediaInteraction";
79
+ IncrementalSource[IncrementalSource["StyleSheetRule"] = 8] = "StyleSheetRule";
80
+ IncrementalSource[IncrementalSource["CanvasMutation"] = 9] = "CanvasMutation";
81
+ IncrementalSource[IncrementalSource["Font"] = 10] = "Font";
82
+ IncrementalSource[IncrementalSource["Log"] = 11] = "Log";
83
+ IncrementalSource[IncrementalSource["Drag"] = 12] = "Drag";
84
+ IncrementalSource[IncrementalSource["StyleDeclaration"] = 13] = "StyleDeclaration";
85
+ })(IncrementalSource || (IncrementalSource = {}));
86
+ var MouseInteractions;
87
+ (function (MouseInteractions) {
88
+ MouseInteractions[MouseInteractions["MouseUp"] = 0] = "MouseUp";
89
+ MouseInteractions[MouseInteractions["MouseDown"] = 1] = "MouseDown";
90
+ MouseInteractions[MouseInteractions["Click"] = 2] = "Click";
91
+ MouseInteractions[MouseInteractions["ContextMenu"] = 3] = "ContextMenu";
92
+ MouseInteractions[MouseInteractions["DblClick"] = 4] = "DblClick";
93
+ MouseInteractions[MouseInteractions["Focus"] = 5] = "Focus";
94
+ MouseInteractions[MouseInteractions["Blur"] = 6] = "Blur";
95
+ MouseInteractions[MouseInteractions["TouchStart"] = 7] = "TouchStart";
96
+ MouseInteractions[MouseInteractions["TouchMove_Departed"] = 8] = "TouchMove_Departed";
97
+ MouseInteractions[MouseInteractions["TouchEnd"] = 9] = "TouchEnd";
98
+ MouseInteractions[MouseInteractions["TouchCancel"] = 10] = "TouchCancel";
99
+ })(MouseInteractions || (MouseInteractions = {}));
100
+ var CanvasContext;
101
+ (function (CanvasContext) {
102
+ CanvasContext[CanvasContext["2D"] = 0] = "2D";
103
+ CanvasContext[CanvasContext["WebGL"] = 1] = "WebGL";
104
+ CanvasContext[CanvasContext["WebGL2"] = 2] = "WebGL2";
105
+ })(CanvasContext || (CanvasContext = {}));
106
+ var MediaInteractions;
107
+ (function (MediaInteractions) {
108
+ MediaInteractions[MediaInteractions["Play"] = 0] = "Play";
109
+ MediaInteractions[MediaInteractions["Pause"] = 1] = "Pause";
110
+ MediaInteractions[MediaInteractions["Seeked"] = 2] = "Seeked";
111
+ MediaInteractions[MediaInteractions["VolumeChange"] = 3] = "VolumeChange";
112
+ })(MediaInteractions || (MediaInteractions = {}));
113
+ var ReplayerEvents;
114
+ (function (ReplayerEvents) {
115
+ ReplayerEvents["Start"] = "start";
116
+ ReplayerEvents["Pause"] = "pause";
117
+ ReplayerEvents["Resume"] = "resume";
118
+ ReplayerEvents["Resize"] = "resize";
119
+ ReplayerEvents["Finish"] = "finish";
120
+ ReplayerEvents["FullsnapshotRebuilded"] = "fullsnapshot-rebuilded";
121
+ ReplayerEvents["LoadStylesheetStart"] = "load-stylesheet-start";
122
+ ReplayerEvents["LoadStylesheetEnd"] = "load-stylesheet-end";
123
+ ReplayerEvents["SkipStart"] = "skip-start";
124
+ ReplayerEvents["SkipEnd"] = "skip-end";
125
+ ReplayerEvents["MouseInteraction"] = "mouse-interaction";
126
+ ReplayerEvents["EventCast"] = "event-cast";
127
+ ReplayerEvents["CustomEvent"] = "custom-event";
128
+ ReplayerEvents["Flush"] = "flush";
129
+ ReplayerEvents["StateChange"] = "state-change";
130
+ ReplayerEvents["PlayBack"] = "play-back";
131
+ })(ReplayerEvents || (ReplayerEvents = {}));
132
+
133
+ var NodeType;
134
+ (function (NodeType) {
135
+ NodeType[NodeType["Document"] = 0] = "Document";
136
+ NodeType[NodeType["DocumentType"] = 1] = "DocumentType";
137
+ NodeType[NodeType["Element"] = 2] = "Element";
138
+ NodeType[NodeType["Text"] = 3] = "Text";
139
+ NodeType[NodeType["CDATA"] = 4] = "CDATA";
140
+ NodeType[NodeType["Comment"] = 5] = "Comment";
141
+ })(NodeType || (NodeType = {}));
142
+
143
+ var DEPARTED_MIRROR_ACCESS_WARNING = 'Please stop import mirror directly. Instead of that,' +
144
+ '\r\n' +
145
+ 'now you can use replayer.getMirror() to access the mirror instance of a replayer,' +
146
+ '\r\n' +
147
+ 'or you can use record.mirror to access the mirror instance during recording.';
148
+ var _mirror = {
149
+ map: {},
150
+ getId: function () {
151
+ console.error(DEPARTED_MIRROR_ACCESS_WARNING);
152
+ return -1;
153
+ },
154
+ getNode: function () {
155
+ console.error(DEPARTED_MIRROR_ACCESS_WARNING);
156
+ return null;
157
+ },
158
+ removeNodeFromMap: function () {
159
+ console.error(DEPARTED_MIRROR_ACCESS_WARNING);
160
+ },
161
+ has: function () {
162
+ console.error(DEPARTED_MIRROR_ACCESS_WARNING);
163
+ return false;
164
+ },
165
+ reset: function () {
166
+ console.error(DEPARTED_MIRROR_ACCESS_WARNING);
167
+ },
168
+ };
169
+ if (typeof window !== 'undefined' && window.Proxy && window.Reflect) {
170
+ _mirror = new Proxy(_mirror, {
171
+ get: function (target, prop, receiver) {
172
+ if (prop === 'map') {
173
+ console.error(DEPARTED_MIRROR_ACCESS_WARNING);
174
+ }
175
+ return Reflect.get(target, prop, receiver);
176
+ },
177
+ });
178
+ }
179
+
180
+ var PLUGIN_NAME = 'rrweb/console@1';
181
+
182
+ var ORIGINAL_ATTRIBUTE_NAME = '__rrweb_original__';
183
+ var defaultLogConfig = {
184
+ level: [
185
+ 'assert',
186
+ 'clear',
187
+ 'count',
188
+ 'countReset',
189
+ 'debug',
190
+ 'dir',
191
+ 'dirxml',
192
+ 'error',
193
+ 'group',
194
+ 'groupCollapsed',
195
+ 'groupEnd',
196
+ 'info',
197
+ 'log',
198
+ 'table',
199
+ 'time',
200
+ 'timeEnd',
201
+ 'timeLog',
202
+ 'trace',
203
+ 'warn',
204
+ ],
205
+ replayLogger: undefined,
206
+ };
207
+ var LogReplayPlugin = (function () {
208
+ function LogReplayPlugin(config) {
209
+ this.config = Object.assign(defaultLogConfig, config);
210
+ }
211
+ LogReplayPlugin.prototype.getConsoleLogger = function () {
212
+ var e_1, _a;
213
+ var _this = this;
214
+ var replayLogger = {};
215
+ var _loop_1 = function (level) {
216
+ if (level === 'trace') {
217
+ replayLogger[level] = function (data) {
218
+ var logger = console.log[ORIGINAL_ATTRIBUTE_NAME]
219
+ ? console.log[ORIGINAL_ATTRIBUTE_NAME]
220
+ : console.log;
221
+ logger.apply(void 0, __spreadArray(__spreadArray([], __read(data.payload.map(function (s) { return JSON.parse(s); })), false), [_this.formatMessage(data)], false));
222
+ };
223
+ }
224
+ else {
225
+ replayLogger[level] = function (data) {
226
+ var logger = console[level][ORIGINAL_ATTRIBUTE_NAME]
227
+ ? console[level][ORIGINAL_ATTRIBUTE_NAME]
228
+ : console[level];
229
+ logger.apply(void 0, __spreadArray(__spreadArray([], __read(data.payload.map(function (s) { return JSON.parse(s); })), false), [_this.formatMessage(data)], false));
230
+ };
231
+ }
232
+ };
233
+ try {
234
+ for (var _b = __values(this.config.level), _c = _b.next(); !_c.done; _c = _b.next()) {
235
+ var level = _c.value;
236
+ _loop_1(level);
237
+ }
238
+ }
239
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
240
+ finally {
241
+ try {
242
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
243
+ }
244
+ finally { if (e_1) throw e_1.error; }
245
+ }
246
+ return replayLogger;
247
+ };
248
+ LogReplayPlugin.prototype.formatMessage = function (data) {
249
+ if (data.trace.length === 0) {
250
+ return '';
251
+ }
252
+ var stackPrefix = '\n\tat ';
253
+ var result = stackPrefix;
254
+ result += data.trace.join(stackPrefix);
255
+ return result;
256
+ };
257
+ return LogReplayPlugin;
258
+ }());
259
+ var getReplayConsolePlugin = function (options) {
260
+ var replayLogger = (options === null || options === void 0 ? void 0 : options.replayLogger) || new LogReplayPlugin(options).getConsoleLogger();
261
+ return {
262
+ handler: function (event, _isSync, context) {
263
+ var logData = null;
264
+ if (event.type === EventType.IncrementalSnapshot &&
265
+ event.data.source === IncrementalSource.Log) {
266
+ logData = event.data;
267
+ }
268
+ else if (event.type === EventType.Plugin &&
269
+ event.data.plugin === PLUGIN_NAME) {
270
+ logData = event.data.payload;
271
+ }
272
+ if (logData) {
273
+ try {
274
+ if (typeof replayLogger[logData.level] === 'function') {
275
+ replayLogger[logData.level](logData);
276
+ }
277
+ }
278
+ catch (error) {
279
+ if (context.replayer.config.showWarning) {
280
+ console.warn(error);
281
+ }
282
+ }
283
+ }
284
+ },
285
+ };
286
+ };
287
+
288
+ exports.getReplayConsolePlugin = getReplayConsolePlugin;
@@ -0,0 +1,28 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var defaultOptions = {
6
+ key: '_sid',
7
+ };
8
+ var PLUGIN_NAME = 'rrweb/sequential-id@1';
9
+ var getRecordSequentialIdPlugin = function (options) {
10
+ var _options = options
11
+ ? Object.assign({}, defaultOptions, options)
12
+ : defaultOptions;
13
+ var id = 0;
14
+ return {
15
+ name: PLUGIN_NAME,
16
+ eventProcessor: function (event) {
17
+ var _a;
18
+ Object.assign(event, (_a = {},
19
+ _a[_options.key] = ++id,
20
+ _a));
21
+ return event;
22
+ },
23
+ options: _options,
24
+ };
25
+ };
26
+
27
+ exports.PLUGIN_NAME = PLUGIN_NAME;
28
+ exports.getRecordSequentialIdPlugin = getRecordSequentialIdPlugin;
@@ -0,0 +1,32 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var defaultOptions = {
6
+ key: '_sid',
7
+ warnOnMissingId: true,
8
+ };
9
+ var getReplaySequentialIdPlugin = function (options) {
10
+ var _a = options
11
+ ? Object.assign({}, defaultOptions, options)
12
+ : defaultOptions, key = _a.key, warnOnMissingId = _a.warnOnMissingId;
13
+ var currentId = 1;
14
+ return {
15
+ handler: function (event) {
16
+ if (key in event) {
17
+ var id = event[key];
18
+ if (id !== currentId) {
19
+ console.error("[sequential-id-plugin]: expect to get an id with value \"".concat(currentId, "\", but got \"").concat(id, "\""));
20
+ }
21
+ else {
22
+ currentId++;
23
+ }
24
+ }
25
+ else if (warnOnMissingId) {
26
+ console.warn("[sequential-id-plugin]: failed to get id in key: \"".concat(key, "\""));
27
+ }
28
+ },
29
+ };
30
+ };
31
+
32
+ exports.getReplaySequentialIdPlugin = getReplaySequentialIdPlugin;