@highlight-run/rrweb 2.0.1 → 2.0.4
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.
- package/dist/plugins/console-record.js +408 -609
- package/dist/plugins/console-record.min.js +12 -15
- package/dist/plugins/console-record.min.js.map +1 -1
- package/dist/plugins/console-replay.js +142 -271
- package/dist/plugins/console-replay.min.js +4 -15
- package/dist/plugins/console-replay.min.js.map +1 -1
- package/dist/plugins/sequential-id-record.js +23 -26
- package/dist/plugins/sequential-id-record.min.js +1 -1
- package/dist/plugins/sequential-id-record.min.js.map +1 -1
- package/dist/plugins/sequential-id-replay.js +26 -30
- package/dist/plugins/sequential-id-replay.min.js +1 -1
- package/dist/plugins/sequential-id-replay.min.js.map +1 -1
- package/dist/record/rrweb-record-pack.js +63 -146
- package/dist/record/rrweb-record-pack.min.js +3 -15
- package/dist/record/rrweb-record-pack.min.js.map +1 -1
- package/dist/record/rrweb-record.js +3002 -3118
- package/dist/record/rrweb-record.min.js +4 -15
- package/dist/record/rrweb-record.min.js.map +1 -1
- package/dist/replay/rrweb-replay-unpack.js +4354 -4054
- package/dist/replay/rrweb-replay-unpack.min.js +5 -17
- package/dist/replay/rrweb-replay-unpack.min.js.map +1 -1
- package/dist/replay/rrweb-replay.js +4286 -3984
- package/dist/replay/rrweb-replay.min.js +5 -17
- package/dist/replay/rrweb-replay.min.js.map +1 -1
- package/dist/rrweb-all.js +7634 -7453
- package/dist/rrweb-all.min.js +16 -17
- package/dist/rrweb-all.min.js.map +1 -1
- package/dist/rrweb.js +7339 -7075
- package/dist/rrweb.min.js +6 -17
- package/dist/rrweb.min.js.map +1 -1
- package/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__auto__createBase64WorkerFactory.js +12 -0
- package/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__auto__isNodeJS.js +7 -0
- package/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js +31 -0
- package/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__node__WorkerClass.js +11 -0
- package/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__node__createBase64WorkerFactory.js +18 -0
- package/es/rrweb/_virtual/image-bitmap-data-url-worker.js +6 -0
- package/es/rrweb/ext/mitt/dist/mitt.es.js +1 -1
- package/es/rrweb/ext/tslib/tslib.es6.js +38 -0
- package/es/rrweb/packages/rrdom/es/virtual-dom.js +1099 -0
- package/es/rrweb/packages/rrweb/src/index.js +6 -4
- package/es/rrweb/packages/rrweb/src/packer/base.js +1 -1
- package/es/rrweb/packages/rrweb/src/packer/pack.js +4 -5
- package/es/rrweb/packages/rrweb/src/packer/unpack.js +24 -24
- package/es/rrweb/packages/rrweb/src/plugins/console/record/error-stack-parser.js +175 -176
- package/es/rrweb/packages/rrweb/src/plugins/console/record/index.js +109 -128
- package/es/rrweb/packages/rrweb/src/plugins/console/record/stringify.js +125 -138
- package/es/rrweb/packages/rrweb/src/plugins/console/replay/index.js +88 -105
- package/es/rrweb/packages/rrweb/src/plugins/sequential-id/record/index.js +19 -20
- package/es/rrweb/packages/rrweb/src/plugins/sequential-id/replay/index.js +25 -25
- package/es/rrweb/packages/rrweb/src/record/iframe-manager.js +29 -30
- package/es/rrweb/packages/rrweb/src/record/index.js +348 -373
- package/es/rrweb/packages/rrweb/src/record/mutation.js +487 -528
- package/es/rrweb/packages/rrweb/src/record/observer.js +584 -659
- package/es/rrweb/packages/rrweb/src/record/observers/canvas/2d.js +44 -73
- package/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas-manager.js +166 -87
- package/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas.js +21 -26
- package/es/rrweb/packages/rrweb/src/record/observers/canvas/serialize-args.js +119 -112
- package/es/rrweb/packages/rrweb/src/record/observers/canvas/webgl.js +53 -72
- package/es/rrweb/packages/rrweb/src/record/shadow-dom-manager.js +38 -40
- package/es/rrweb/packages/rrweb/src/record/stylesheet-manager.js +31 -0
- package/es/rrweb/packages/rrweb/src/replay/canvas/2d.js +27 -23
- package/es/rrweb/packages/rrweb/src/replay/canvas/deserialize-args.js +67 -0
- package/es/rrweb/packages/rrweb/src/replay/canvas/index.js +37 -29
- package/es/rrweb/packages/rrweb/src/replay/canvas/webgl.js +58 -120
- package/es/rrweb/packages/rrweb/src/replay/index.js +1545 -1854
- package/es/rrweb/packages/rrweb/src/replay/machine.js +275 -315
- package/es/rrweb/packages/rrweb/src/replay/smoothscroll.js +216 -218
- package/es/rrweb/packages/rrweb/src/replay/styles/inject-style.js +7 -7
- package/es/rrweb/packages/rrweb/src/replay/timer.js +87 -91
- package/es/rrweb/packages/rrweb/src/types.js +72 -72
- package/es/rrweb/packages/rrweb/src/utils.js +312 -506
- package/es/rrweb/packages/rrweb-snapshot/es/rrweb-snapshot.js +195 -71
- package/lib/plugins/console-record.js +469 -627
- package/lib/plugins/console-replay.js +198 -268
- package/lib/plugins/sequential-id-record.js +19 -20
- package/lib/plugins/sequential-id-replay.js +25 -25
- package/lib/record/rrweb-record-pack.js +184 -139
- package/lib/record/rrweb-record.js +2473 -2425
- package/lib/replay/rrweb-replay-unpack.js +3797 -3343
- package/lib/replay/rrweb-replay.js +3742 -3288
- package/lib/rrweb-all.js +6725 -6247
- package/lib/rrweb.js +6157 -5632
- package/package.json +14 -13
- package/typings/packer/base.d.ts +1 -1
- package/typings/plugins/console/record/index.d.ts +1 -1
- package/typings/plugins/console/record/stringify.d.ts +1 -1
- package/typings/plugins/sequential-id/record/index.d.ts +1 -1
- package/typings/plugins/sequential-id/replay/index.d.ts +1 -1
- package/typings/record/iframe-manager.d.ts +3 -3
- package/typings/record/index.d.ts +1 -1
- package/typings/record/mutation.d.ts +2 -1
- package/typings/record/observers/canvas/2d.d.ts +2 -1
- package/typings/record/observers/canvas/canvas-manager.d.ts +5 -2
- package/typings/record/observers/canvas/canvas.d.ts +1 -1
- package/typings/record/observers/canvas/serialize-args.d.ts +5 -5
- package/typings/record/observers/canvas/webgl.d.ts +2 -1
- package/typings/record/shadow-dom-manager.d.ts +2 -1
- package/typings/record/stylesheet-manager.d.ts +12 -0
- package/typings/record/workers/image-bitmap-data-url-worker.d.ts +5 -0
- package/typings/replay/canvas/2d.d.ts +3 -3
- package/typings/replay/canvas/deserialize-args.d.ts +7 -0
- package/typings/replay/canvas/index.d.ts +4 -3
- package/typings/replay/canvas/webgl.d.ts +3 -5
- package/typings/replay/index.d.ts +7 -10
- package/typings/types.d.ts +45 -17
- package/typings/utils.d.ts +17 -44
- package/dist/replay/rrweb-replay-unpack.min.css +0 -2
- package/dist/replay/rrweb-replay-unpack.min.css.map +0 -1
- package/dist/replay/rrweb-replay.min.css +0 -2
- package/dist/replay/rrweb-replay.min.css.map +0 -1
- package/dist/rrweb-all.min.css +0 -2
- package/dist/rrweb-all.min.css.map +0 -1
- package/dist/rrweb.min.css +0 -2
- package/dist/rrweb.min.css.map +0 -1
- package/es/rrweb/packages/rrweb/ext/tslib/tslib.es6.js +0 -78
- package/es/rrweb/packages/rrweb/src/replay/virtual-styles.js +0 -121
- package/typings/replay/virtual-styles.d.ts +0 -43
|
@@ -1,649 +1,448 @@
|
|
|
1
1
|
var rrwebConsoleRecord = (function (exports) {
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
/*! *****************************************************************************
|
|
5
|
-
Copyright (c) Microsoft Corporation.
|
|
6
|
-
|
|
7
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
8
|
-
purpose with or without fee is hereby granted.
|
|
9
|
-
|
|
10
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
11
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
12
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
13
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
14
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
15
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
16
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
17
|
-
***************************************************************************** */
|
|
18
|
-
|
|
19
|
-
function __values(o) {
|
|
20
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
21
|
-
if (m) return m.call(o);
|
|
22
|
-
if (o && typeof o.length === "number") return {
|
|
23
|
-
next: function () {
|
|
24
|
-
if (o && i >= o.length) o = void 0;
|
|
25
|
-
return { value: o && o[i++], done: !o };
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function __read(o, n) {
|
|
32
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
33
|
-
if (!m) return o;
|
|
34
|
-
var i = m.call(o), r, ar = [], e;
|
|
35
|
-
try {
|
|
36
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
37
|
-
}
|
|
38
|
-
catch (error) { e = { error: error }; }
|
|
39
|
-
finally {
|
|
40
|
-
try {
|
|
41
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
42
|
-
}
|
|
43
|
-
finally { if (e) throw e.error; }
|
|
44
|
-
}
|
|
45
|
-
return ar;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function __spreadArray(to, from, pack) {
|
|
49
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
50
|
-
if (ar || !(i in from)) {
|
|
51
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
52
|
-
ar[i] = from[i];
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
var EventType;
|
|
59
|
-
(function (EventType) {
|
|
60
|
-
EventType[EventType["DomContentLoaded"] = 0] = "DomContentLoaded";
|
|
61
|
-
EventType[EventType["Load"] = 1] = "Load";
|
|
62
|
-
EventType[EventType["FullSnapshot"] = 2] = "FullSnapshot";
|
|
63
|
-
EventType[EventType["IncrementalSnapshot"] = 3] = "IncrementalSnapshot";
|
|
64
|
-
EventType[EventType["Meta"] = 4] = "Meta";
|
|
65
|
-
EventType[EventType["Custom"] = 5] = "Custom";
|
|
66
|
-
EventType[EventType["Plugin"] = 6] = "Plugin";
|
|
67
|
-
})(EventType || (EventType = {}));
|
|
68
|
-
var IncrementalSource;
|
|
69
|
-
(function (IncrementalSource) {
|
|
70
|
-
IncrementalSource[IncrementalSource["Mutation"] = 0] = "Mutation";
|
|
71
|
-
IncrementalSource[IncrementalSource["MouseMove"] = 1] = "MouseMove";
|
|
72
|
-
IncrementalSource[IncrementalSource["MouseInteraction"] = 2] = "MouseInteraction";
|
|
73
|
-
IncrementalSource[IncrementalSource["Scroll"] = 3] = "Scroll";
|
|
74
|
-
IncrementalSource[IncrementalSource["ViewportResize"] = 4] = "ViewportResize";
|
|
75
|
-
IncrementalSource[IncrementalSource["Input"] = 5] = "Input";
|
|
76
|
-
IncrementalSource[IncrementalSource["TouchMove"] = 6] = "TouchMove";
|
|
77
|
-
IncrementalSource[IncrementalSource["MediaInteraction"] = 7] = "MediaInteraction";
|
|
78
|
-
IncrementalSource[IncrementalSource["StyleSheetRule"] = 8] = "StyleSheetRule";
|
|
79
|
-
IncrementalSource[IncrementalSource["CanvasMutation"] = 9] = "CanvasMutation";
|
|
80
|
-
IncrementalSource[IncrementalSource["Font"] = 10] = "Font";
|
|
81
|
-
IncrementalSource[IncrementalSource["Log"] = 11] = "Log";
|
|
82
|
-
IncrementalSource[IncrementalSource["Drag"] = 12] = "Drag";
|
|
83
|
-
IncrementalSource[IncrementalSource["StyleDeclaration"] = 13] = "StyleDeclaration";
|
|
84
|
-
})(IncrementalSource || (IncrementalSource = {}));
|
|
85
|
-
var MouseInteractions;
|
|
86
|
-
(function (MouseInteractions) {
|
|
87
|
-
MouseInteractions[MouseInteractions["MouseUp"] = 0] = "MouseUp";
|
|
88
|
-
MouseInteractions[MouseInteractions["MouseDown"] = 1] = "MouseDown";
|
|
89
|
-
MouseInteractions[MouseInteractions["Click"] = 2] = "Click";
|
|
90
|
-
MouseInteractions[MouseInteractions["ContextMenu"] = 3] = "ContextMenu";
|
|
91
|
-
MouseInteractions[MouseInteractions["DblClick"] = 4] = "DblClick";
|
|
92
|
-
MouseInteractions[MouseInteractions["Focus"] = 5] = "Focus";
|
|
93
|
-
MouseInteractions[MouseInteractions["Blur"] = 6] = "Blur";
|
|
94
|
-
MouseInteractions[MouseInteractions["TouchStart"] = 7] = "TouchStart";
|
|
95
|
-
MouseInteractions[MouseInteractions["TouchMove_Departed"] = 8] = "TouchMove_Departed";
|
|
96
|
-
MouseInteractions[MouseInteractions["TouchEnd"] = 9] = "TouchEnd";
|
|
97
|
-
MouseInteractions[MouseInteractions["TouchCancel"] = 10] = "TouchCancel";
|
|
98
|
-
})(MouseInteractions || (MouseInteractions = {}));
|
|
99
|
-
var CanvasContext;
|
|
100
|
-
(function (CanvasContext) {
|
|
101
|
-
CanvasContext[CanvasContext["2D"] = 0] = "2D";
|
|
102
|
-
CanvasContext[CanvasContext["WebGL"] = 1] = "WebGL";
|
|
103
|
-
CanvasContext[CanvasContext["WebGL2"] = 2] = "WebGL2";
|
|
104
|
-
})(CanvasContext || (CanvasContext = {}));
|
|
105
|
-
var MediaInteractions;
|
|
106
|
-
(function (MediaInteractions) {
|
|
107
|
-
MediaInteractions[MediaInteractions["Play"] = 0] = "Play";
|
|
108
|
-
MediaInteractions[MediaInteractions["Pause"] = 1] = "Pause";
|
|
109
|
-
MediaInteractions[MediaInteractions["Seeked"] = 2] = "Seeked";
|
|
110
|
-
MediaInteractions[MediaInteractions["VolumeChange"] = 3] = "VolumeChange";
|
|
111
|
-
})(MediaInteractions || (MediaInteractions = {}));
|
|
112
|
-
var ReplayerEvents;
|
|
113
|
-
(function (ReplayerEvents) {
|
|
114
|
-
ReplayerEvents["Start"] = "start";
|
|
115
|
-
ReplayerEvents["Pause"] = "pause";
|
|
116
|
-
ReplayerEvents["Resume"] = "resume";
|
|
117
|
-
ReplayerEvents["Resize"] = "resize";
|
|
118
|
-
ReplayerEvents["Finish"] = "finish";
|
|
119
|
-
ReplayerEvents["FullsnapshotRebuilded"] = "fullsnapshot-rebuilded";
|
|
120
|
-
ReplayerEvents["LoadStylesheetStart"] = "load-stylesheet-start";
|
|
121
|
-
ReplayerEvents["LoadStylesheetEnd"] = "load-stylesheet-end";
|
|
122
|
-
ReplayerEvents["SkipStart"] = "skip-start";
|
|
123
|
-
ReplayerEvents["SkipEnd"] = "skip-end";
|
|
124
|
-
ReplayerEvents["MouseInteraction"] = "mouse-interaction";
|
|
125
|
-
ReplayerEvents["EventCast"] = "event-cast";
|
|
126
|
-
ReplayerEvents["CustomEvent"] = "custom-event";
|
|
127
|
-
ReplayerEvents["Flush"] = "flush";
|
|
128
|
-
ReplayerEvents["StateChange"] = "state-change";
|
|
129
|
-
ReplayerEvents["PlayBack"] = "play-back";
|
|
130
|
-
})(ReplayerEvents || (ReplayerEvents = {}));
|
|
131
|
-
|
|
132
4
|
var NodeType;
|
|
133
|
-
(function
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
5
|
+
(function(NodeType2) {
|
|
6
|
+
NodeType2[NodeType2["Document"] = 0] = "Document";
|
|
7
|
+
NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
|
|
8
|
+
NodeType2[NodeType2["Element"] = 2] = "Element";
|
|
9
|
+
NodeType2[NodeType2["Text"] = 3] = "Text";
|
|
10
|
+
NodeType2[NodeType2["CDATA"] = 4] = "CDATA";
|
|
11
|
+
NodeType2[NodeType2["Comment"] = 5] = "Comment";
|
|
140
12
|
})(NodeType || (NodeType = {}));
|
|
141
13
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
},
|
|
164
|
-
reset: function () {
|
|
165
|
-
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
166
|
-
},
|
|
14
|
+
const DEPARTED_MIRROR_ACCESS_WARNING = "Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.";
|
|
15
|
+
let _mirror = {
|
|
16
|
+
map: {},
|
|
17
|
+
getId() {
|
|
18
|
+
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
19
|
+
return -1;
|
|
20
|
+
},
|
|
21
|
+
getNode() {
|
|
22
|
+
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
23
|
+
return null;
|
|
24
|
+
},
|
|
25
|
+
removeNodeFromMap() {
|
|
26
|
+
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
27
|
+
},
|
|
28
|
+
has() {
|
|
29
|
+
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
30
|
+
return false;
|
|
31
|
+
},
|
|
32
|
+
reset() {
|
|
33
|
+
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
34
|
+
}
|
|
167
35
|
};
|
|
168
|
-
if (typeof window !==
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
36
|
+
if (typeof window !== "undefined" && window.Proxy && window.Reflect) {
|
|
37
|
+
_mirror = new Proxy(_mirror, {
|
|
38
|
+
get(target, prop, receiver) {
|
|
39
|
+
if (prop === "map") {
|
|
40
|
+
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
41
|
+
}
|
|
42
|
+
return Reflect.get(target, prop, receiver);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
177
45
|
}
|
|
178
46
|
function patch(source, name, replacement) {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
var original_1 = source[name];
|
|
184
|
-
var wrapped = replacement(original_1);
|
|
185
|
-
if (typeof wrapped === 'function') {
|
|
186
|
-
wrapped.prototype = wrapped.prototype || {};
|
|
187
|
-
Object.defineProperties(wrapped, {
|
|
188
|
-
__rrweb_original__: {
|
|
189
|
-
enumerable: false,
|
|
190
|
-
value: original_1,
|
|
191
|
-
},
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
source[name] = wrapped;
|
|
195
|
-
return function () {
|
|
196
|
-
source[name] = original_1;
|
|
197
|
-
};
|
|
47
|
+
try {
|
|
48
|
+
if (!(name in source)) {
|
|
49
|
+
return () => {
|
|
50
|
+
};
|
|
198
51
|
}
|
|
199
|
-
|
|
200
|
-
|
|
52
|
+
const original = source[name];
|
|
53
|
+
const wrapped = replacement(original);
|
|
54
|
+
if (typeof wrapped === "function") {
|
|
55
|
+
wrapped.prototype = wrapped.prototype || {};
|
|
56
|
+
Object.defineProperties(wrapped, {
|
|
57
|
+
__rrweb_original__: {
|
|
58
|
+
enumerable: false,
|
|
59
|
+
value: original
|
|
60
|
+
}
|
|
61
|
+
});
|
|
201
62
|
}
|
|
63
|
+
source[name] = wrapped;
|
|
64
|
+
return () => {
|
|
65
|
+
source[name] = original;
|
|
66
|
+
};
|
|
67
|
+
} catch (e) {
|
|
68
|
+
return () => {
|
|
69
|
+
};
|
|
70
|
+
}
|
|
202
71
|
}
|
|
203
72
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
73
|
+
class StackFrame {
|
|
74
|
+
constructor(obj) {
|
|
75
|
+
this.fileName = obj.fileName || "";
|
|
76
|
+
this.functionName = obj.functionName || "";
|
|
77
|
+
this.lineNumber = obj.lineNumber;
|
|
78
|
+
this.columnNumber = obj.columnNumber;
|
|
79
|
+
}
|
|
80
|
+
toString() {
|
|
81
|
+
const lineNumber = this.lineNumber || "";
|
|
82
|
+
const columnNumber = this.columnNumber || "";
|
|
83
|
+
if (this.functionName) {
|
|
84
|
+
return this.functionName + " (" + this.fileName + ":" + lineNumber + ":" + columnNumber + ")";
|
|
210
85
|
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
for (var i = 0, len = lines.length; i < len; i += 2) {
|
|
349
|
-
var match = lineRE.exec(lines[i]);
|
|
350
|
-
if (match) {
|
|
351
|
-
result.push(new StackFrame({
|
|
352
|
-
functionName: match[3] || undefined,
|
|
353
|
-
fileName: match[2],
|
|
354
|
-
lineNumber: parseFloat(match[1]),
|
|
355
|
-
}));
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
return result;
|
|
359
|
-
},
|
|
360
|
-
parseOpera11: function (error) {
|
|
361
|
-
var filtered = error.stack.split('\n').filter(function (line) {
|
|
362
|
-
return (!!line.match(FIREFOX_SAFARI_STACK_REGEXP) &&
|
|
363
|
-
!line.match(/^Error created at/));
|
|
364
|
-
}, this);
|
|
365
|
-
return filtered.map(function (line) {
|
|
366
|
-
var tokens = line.split('@');
|
|
367
|
-
var locationParts = this.extractLocation(tokens.pop());
|
|
368
|
-
var functionCall = tokens.shift() || '';
|
|
369
|
-
var functionName = functionCall
|
|
370
|
-
.replace(/<anonymous function(: (\w+))?>/, '$2')
|
|
371
|
-
.replace(/\([^)]*\)/g, '') || undefined;
|
|
372
|
-
return new StackFrame({
|
|
373
|
-
functionName: functionName,
|
|
374
|
-
fileName: locationParts[0],
|
|
375
|
-
lineNumber: locationParts[1],
|
|
376
|
-
columnNumber: locationParts[2],
|
|
377
|
-
});
|
|
378
|
-
}, this);
|
|
379
|
-
},
|
|
86
|
+
return this.fileName + ":" + lineNumber + ":" + columnNumber;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
const FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+:\d+/;
|
|
90
|
+
const CHROME_IE_STACK_REGEXP = /^\s*at .*(\S+:\d+|\(native\))/m;
|
|
91
|
+
const SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code])?$/;
|
|
92
|
+
const ErrorStackParser = {
|
|
93
|
+
parse: function(error) {
|
|
94
|
+
if (!error) {
|
|
95
|
+
return [];
|
|
96
|
+
}
|
|
97
|
+
if (typeof error.stacktrace !== "undefined" || typeof error["opera#sourceloc"] !== "undefined") {
|
|
98
|
+
return this.parseOpera(error);
|
|
99
|
+
} else if (error.stack && error.stack.match(CHROME_IE_STACK_REGEXP)) {
|
|
100
|
+
return this.parseV8OrIE(error);
|
|
101
|
+
} else if (error.stack) {
|
|
102
|
+
return this.parseFFOrSafari(error);
|
|
103
|
+
} else {
|
|
104
|
+
throw new Error("Cannot parse given Error object");
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
extractLocation: function(urlLike) {
|
|
108
|
+
if (urlLike.indexOf(":") === -1) {
|
|
109
|
+
return [urlLike];
|
|
110
|
+
}
|
|
111
|
+
const regExp = /(.+?)(?::(\d+))?(?::(\d+))?$/;
|
|
112
|
+
const parts = regExp.exec(urlLike.replace(/[()]/g, ""));
|
|
113
|
+
if (!parts)
|
|
114
|
+
throw new Error(`Cannot parse given url: ${urlLike}`);
|
|
115
|
+
return [parts[1], parts[2] || void 0, parts[3] || void 0];
|
|
116
|
+
},
|
|
117
|
+
parseV8OrIE: function(error) {
|
|
118
|
+
const filtered = error.stack.split("\n").filter(function(line) {
|
|
119
|
+
return !!line.match(CHROME_IE_STACK_REGEXP);
|
|
120
|
+
}, this);
|
|
121
|
+
return filtered.map(function(line) {
|
|
122
|
+
if (line.indexOf("(eval ") > -1) {
|
|
123
|
+
line = line.replace(/eval code/g, "eval").replace(/(\(eval at [^()]*)|(\),.*$)/g, "");
|
|
124
|
+
}
|
|
125
|
+
let sanitizedLine = line.replace(/^\s+/, "").replace(/\(eval code/g, "(");
|
|
126
|
+
const location = sanitizedLine.match(/ (\((.+):(\d+):(\d+)\)$)/);
|
|
127
|
+
sanitizedLine = location ? sanitizedLine.replace(location[0], "") : sanitizedLine;
|
|
128
|
+
const tokens = sanitizedLine.split(/\s+/).slice(1);
|
|
129
|
+
const locationParts = this.extractLocation(location ? location[1] : tokens.pop());
|
|
130
|
+
const functionName = tokens.join(" ") || void 0;
|
|
131
|
+
const fileName = ["eval", "<anonymous>"].indexOf(locationParts[0]) > -1 ? void 0 : locationParts[0];
|
|
132
|
+
return new StackFrame({
|
|
133
|
+
functionName,
|
|
134
|
+
fileName,
|
|
135
|
+
lineNumber: locationParts[1],
|
|
136
|
+
columnNumber: locationParts[2]
|
|
137
|
+
});
|
|
138
|
+
}, this);
|
|
139
|
+
},
|
|
140
|
+
parseFFOrSafari: function(error) {
|
|
141
|
+
const filtered = error.stack.split("\n").filter(function(line) {
|
|
142
|
+
return !line.match(SAFARI_NATIVE_CODE_REGEXP);
|
|
143
|
+
}, this);
|
|
144
|
+
return filtered.map(function(line) {
|
|
145
|
+
if (line.indexOf(" > eval") > -1) {
|
|
146
|
+
line = line.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ":$1");
|
|
147
|
+
}
|
|
148
|
+
if (line.indexOf("@") === -1 && line.indexOf(":") === -1) {
|
|
149
|
+
return new StackFrame({
|
|
150
|
+
functionName: line
|
|
151
|
+
});
|
|
152
|
+
} else {
|
|
153
|
+
const functionNameRegex = /((.*".+"[^@]*)?[^@]*)(?:@)/;
|
|
154
|
+
const matches = line.match(functionNameRegex);
|
|
155
|
+
const functionName = matches && matches[1] ? matches[1] : void 0;
|
|
156
|
+
const locationParts = this.extractLocation(line.replace(functionNameRegex, ""));
|
|
157
|
+
return new StackFrame({
|
|
158
|
+
functionName,
|
|
159
|
+
fileName: locationParts[0],
|
|
160
|
+
lineNumber: locationParts[1],
|
|
161
|
+
columnNumber: locationParts[2]
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
}, this);
|
|
165
|
+
},
|
|
166
|
+
parseOpera: function(e) {
|
|
167
|
+
if (!e.stacktrace || e.message.indexOf("\n") > -1 && e.message.split("\n").length > e.stacktrace.split("\n").length) {
|
|
168
|
+
return this.parseOpera9(e);
|
|
169
|
+
} else if (!e.stack) {
|
|
170
|
+
return this.parseOpera10(e);
|
|
171
|
+
} else {
|
|
172
|
+
return this.parseOpera11(e);
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
parseOpera9: function(e) {
|
|
176
|
+
const lineRE = /Line (\d+).*script (?:in )?(\S+)/i;
|
|
177
|
+
const lines = e.message.split("\n");
|
|
178
|
+
const result = [];
|
|
179
|
+
for (let i = 2, len = lines.length; i < len; i += 2) {
|
|
180
|
+
const match = lineRE.exec(lines[i]);
|
|
181
|
+
if (match) {
|
|
182
|
+
result.push(new StackFrame({
|
|
183
|
+
fileName: match[2],
|
|
184
|
+
lineNumber: parseFloat(match[1])
|
|
185
|
+
}));
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return result;
|
|
189
|
+
},
|
|
190
|
+
parseOpera10: function(e) {
|
|
191
|
+
const lineRE = /Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i;
|
|
192
|
+
const lines = e.stacktrace.split("\n");
|
|
193
|
+
const result = [];
|
|
194
|
+
for (let i = 0, len = lines.length; i < len; i += 2) {
|
|
195
|
+
const match = lineRE.exec(lines[i]);
|
|
196
|
+
if (match) {
|
|
197
|
+
result.push(new StackFrame({
|
|
198
|
+
functionName: match[3] || void 0,
|
|
199
|
+
fileName: match[2],
|
|
200
|
+
lineNumber: parseFloat(match[1])
|
|
201
|
+
}));
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return result;
|
|
205
|
+
},
|
|
206
|
+
parseOpera11: function(error) {
|
|
207
|
+
const filtered = error.stack.split("\n").filter(function(line) {
|
|
208
|
+
return !!line.match(FIREFOX_SAFARI_STACK_REGEXP) && !line.match(/^Error created at/);
|
|
209
|
+
}, this);
|
|
210
|
+
return filtered.map(function(line) {
|
|
211
|
+
const tokens = line.split("@");
|
|
212
|
+
const locationParts = this.extractLocation(tokens.pop());
|
|
213
|
+
const functionCall = tokens.shift() || "";
|
|
214
|
+
const functionName = functionCall.replace(/<anonymous function(: (\w+))?>/, "$2").replace(/\([^)]*\)/g, "") || void 0;
|
|
215
|
+
return new StackFrame({
|
|
216
|
+
functionName,
|
|
217
|
+
fileName: locationParts[0],
|
|
218
|
+
lineNumber: locationParts[1],
|
|
219
|
+
columnNumber: locationParts[2]
|
|
220
|
+
});
|
|
221
|
+
}, this);
|
|
222
|
+
}
|
|
380
223
|
};
|
|
381
224
|
|
|
382
225
|
function pathToSelector(node) {
|
|
383
|
-
|
|
384
|
-
|
|
226
|
+
if (!node || !node.outerHTML) {
|
|
227
|
+
return "";
|
|
228
|
+
}
|
|
229
|
+
let path = "";
|
|
230
|
+
while (node.parentElement) {
|
|
231
|
+
let name = node.localName;
|
|
232
|
+
if (!name) {
|
|
233
|
+
break;
|
|
385
234
|
}
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
if (domSiblings.length > 1) {
|
|
406
|
-
name_1 += ':eq(' + domSiblings.indexOf(node) + ')';
|
|
407
|
-
}
|
|
408
|
-
path = name_1 + (path ? '>' + path : '');
|
|
409
|
-
node = parent_1;
|
|
235
|
+
name = name.toLowerCase();
|
|
236
|
+
const parent = node.parentElement;
|
|
237
|
+
const domSiblings = [];
|
|
238
|
+
if (parent.children && parent.children.length > 0) {
|
|
239
|
+
for (let i = 0; i < parent.children.length; i++) {
|
|
240
|
+
const sibling = parent.children[i];
|
|
241
|
+
if (sibling.localName && sibling.localName.toLowerCase) {
|
|
242
|
+
if (sibling.localName.toLowerCase() === name) {
|
|
243
|
+
domSiblings.push(sibling);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
if (domSiblings.length > 1) {
|
|
249
|
+
name += ":eq(" + domSiblings.indexOf(node) + ")";
|
|
410
250
|
}
|
|
411
|
-
|
|
251
|
+
path = name + (path ? ">" + path : "");
|
|
252
|
+
node = parent;
|
|
253
|
+
}
|
|
254
|
+
return path;
|
|
412
255
|
}
|
|
413
256
|
function isObject(obj) {
|
|
414
|
-
|
|
257
|
+
return Object.prototype.toString.call(obj) === "[object Object]";
|
|
415
258
|
}
|
|
416
259
|
function isObjTooDeep(obj, limit) {
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
var key = keys_1_1.value;
|
|
425
|
-
if (isObject(obj[key]) && isObjTooDeep(obj[key], limit - 1)) {
|
|
426
|
-
return true;
|
|
427
|
-
}
|
|
428
|
-
}
|
|
260
|
+
if (limit === 0) {
|
|
261
|
+
return true;
|
|
262
|
+
}
|
|
263
|
+
const keys = Object.keys(obj);
|
|
264
|
+
for (const key of keys) {
|
|
265
|
+
if (isObject(obj[key]) && isObjTooDeep(obj[key], limit - 1)) {
|
|
266
|
+
return true;
|
|
429
267
|
}
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
try {
|
|
433
|
-
if (keys_1_1 && !keys_1_1.done && (_a = keys_1.return)) _a.call(keys_1);
|
|
434
|
-
}
|
|
435
|
-
finally { if (e_1) throw e_1.error; }
|
|
436
|
-
}
|
|
437
|
-
return false;
|
|
268
|
+
}
|
|
269
|
+
return false;
|
|
438
270
|
}
|
|
439
271
|
function stringify(obj, stringifyOptions) {
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
else {
|
|
465
|
-
stack.push(value);
|
|
466
|
-
}
|
|
467
|
-
if (value === null || value === undefined) {
|
|
468
|
-
return value;
|
|
469
|
-
}
|
|
470
|
-
if (shouldIgnore(value)) {
|
|
471
|
-
return toString(value);
|
|
472
|
-
}
|
|
473
|
-
if (value instanceof Event) {
|
|
474
|
-
var eventResult = {};
|
|
475
|
-
for (var eventKey in value) {
|
|
476
|
-
var eventValue = value[eventKey];
|
|
477
|
-
if (Array.isArray(eventValue)) {
|
|
478
|
-
eventResult[eventKey] = pathToSelector(eventValue.length ? eventValue[0] : null);
|
|
479
|
-
}
|
|
480
|
-
else {
|
|
481
|
-
eventResult[eventKey] = eventValue;
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
return eventResult;
|
|
485
|
-
}
|
|
486
|
-
else if (value instanceof Node) {
|
|
487
|
-
if (value instanceof HTMLElement) {
|
|
488
|
-
return value ? value.outerHTML : '';
|
|
489
|
-
}
|
|
490
|
-
return value.nodeName;
|
|
491
|
-
}
|
|
492
|
-
else if (value instanceof Error) {
|
|
493
|
-
return value.stack
|
|
494
|
-
? value.stack + '\nEnd of stack for Error object'
|
|
495
|
-
: value.name + ': ' + value.message;
|
|
496
|
-
}
|
|
497
|
-
return value;
|
|
498
|
-
});
|
|
499
|
-
function shouldIgnore(_obj) {
|
|
500
|
-
if (isObject(_obj) && Object.keys(_obj).length > options.numOfKeysLimit) {
|
|
501
|
-
return true;
|
|
502
|
-
}
|
|
503
|
-
if (typeof _obj === 'function') {
|
|
504
|
-
return true;
|
|
505
|
-
}
|
|
506
|
-
if (isObject(_obj) && isObjTooDeep(_obj, options.depthOfLimit)) {
|
|
507
|
-
return true;
|
|
508
|
-
}
|
|
509
|
-
return false;
|
|
272
|
+
const options = {
|
|
273
|
+
numOfKeysLimit: 50,
|
|
274
|
+
depthOfLimit: 4
|
|
275
|
+
};
|
|
276
|
+
Object.assign(options, stringifyOptions);
|
|
277
|
+
const stack = [];
|
|
278
|
+
const keys = [];
|
|
279
|
+
return JSON.stringify(obj, function(key, value) {
|
|
280
|
+
if (stack.length > 0) {
|
|
281
|
+
const thisPos = stack.indexOf(this);
|
|
282
|
+
~thisPos ? stack.splice(thisPos + 1) : stack.push(this);
|
|
283
|
+
~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key);
|
|
284
|
+
if (~stack.indexOf(value)) {
|
|
285
|
+
if (stack[0] === value) {
|
|
286
|
+
value = "[Circular ~]";
|
|
287
|
+
} else {
|
|
288
|
+
value = "[Circular ~." + keys.slice(0, stack.indexOf(value)).join(".") + "]";
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
} else {
|
|
292
|
+
stack.push(value);
|
|
510
293
|
}
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
if (options.stringLengthLimit && str.length > options.stringLengthLimit) {
|
|
514
|
-
str = "".concat(str.slice(0, options.stringLengthLimit), "...");
|
|
515
|
-
}
|
|
516
|
-
return str;
|
|
294
|
+
if (value === null || value === void 0) {
|
|
295
|
+
return value;
|
|
517
296
|
}
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
var defaultLogOptions = {
|
|
521
|
-
level: [
|
|
522
|
-
'assert',
|
|
523
|
-
'clear',
|
|
524
|
-
'count',
|
|
525
|
-
'countReset',
|
|
526
|
-
'debug',
|
|
527
|
-
'dir',
|
|
528
|
-
'dirxml',
|
|
529
|
-
'error',
|
|
530
|
-
'group',
|
|
531
|
-
'groupCollapsed',
|
|
532
|
-
'groupEnd',
|
|
533
|
-
'info',
|
|
534
|
-
'log',
|
|
535
|
-
'table',
|
|
536
|
-
'time',
|
|
537
|
-
'timeEnd',
|
|
538
|
-
'timeLog',
|
|
539
|
-
'trace',
|
|
540
|
-
'warn',
|
|
541
|
-
],
|
|
542
|
-
lengthThreshold: 1000,
|
|
543
|
-
logger: 'console',
|
|
544
|
-
};
|
|
545
|
-
function initLogObserver(cb, win, logOptions) {
|
|
546
|
-
var e_1, _a;
|
|
547
|
-
var loggerType = logOptions.logger;
|
|
548
|
-
if (!loggerType) {
|
|
549
|
-
return function () { };
|
|
297
|
+
if (shouldIgnore(value)) {
|
|
298
|
+
return toString(value);
|
|
550
299
|
}
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
300
|
+
if (value instanceof Event) {
|
|
301
|
+
const eventResult = {};
|
|
302
|
+
for (const eventKey in value) {
|
|
303
|
+
const eventValue = value[eventKey];
|
|
304
|
+
if (Array.isArray(eventValue)) {
|
|
305
|
+
eventResult[eventKey] = pathToSelector(eventValue.length ? eventValue[0] : null);
|
|
306
|
+
} else {
|
|
307
|
+
eventResult[eventKey] = eventValue;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
return eventResult;
|
|
311
|
+
} else if (value instanceof Node) {
|
|
312
|
+
if (value instanceof HTMLElement) {
|
|
313
|
+
return value ? value.outerHTML : "";
|
|
314
|
+
}
|
|
315
|
+
return value.nodeName;
|
|
316
|
+
} else if (value instanceof Error) {
|
|
317
|
+
return value.stack ? value.stack + "\nEnd of stack for Error object" : value.name + ": " + value.message;
|
|
554
318
|
}
|
|
555
|
-
|
|
556
|
-
|
|
319
|
+
return value;
|
|
320
|
+
});
|
|
321
|
+
function shouldIgnore(_obj) {
|
|
322
|
+
if (isObject(_obj) && Object.keys(_obj).length > options.numOfKeysLimit) {
|
|
323
|
+
return true;
|
|
557
324
|
}
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
if (logOptions.level.includes('error')) {
|
|
561
|
-
if (window) {
|
|
562
|
-
var errorHandler_1 = function (event) {
|
|
563
|
-
var message = event.message, error = event.error;
|
|
564
|
-
var trace = ErrorStackParser.parse(error).map(function (stackFrame) { return stackFrame.toString(); });
|
|
565
|
-
var payload = [stringify(message, logOptions.stringifyOptions)];
|
|
566
|
-
cb({
|
|
567
|
-
level: 'error',
|
|
568
|
-
trace: trace,
|
|
569
|
-
payload: payload,
|
|
570
|
-
});
|
|
571
|
-
};
|
|
572
|
-
window.addEventListener('error', errorHandler_1);
|
|
573
|
-
cancelHandlers.push(function () {
|
|
574
|
-
if (window)
|
|
575
|
-
window.removeEventListener('error', errorHandler_1);
|
|
576
|
-
});
|
|
577
|
-
}
|
|
325
|
+
if (typeof _obj === "function") {
|
|
326
|
+
return true;
|
|
578
327
|
}
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
var levelType = _c.value;
|
|
582
|
-
cancelHandlers.push(replace(logger, levelType));
|
|
583
|
-
}
|
|
328
|
+
if (isObject(_obj) && isObjTooDeep(_obj, options.depthOfLimit)) {
|
|
329
|
+
return true;
|
|
584
330
|
}
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
331
|
+
return false;
|
|
332
|
+
}
|
|
333
|
+
function toString(_obj) {
|
|
334
|
+
let str = _obj.toString();
|
|
335
|
+
if (options.stringLengthLimit && str.length > options.stringLengthLimit) {
|
|
336
|
+
str = `${str.slice(0, options.stringLengthLimit)}...`;
|
|
591
337
|
}
|
|
592
|
-
return
|
|
593
|
-
|
|
338
|
+
return str;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
const defaultLogOptions = {
|
|
343
|
+
level: [
|
|
344
|
+
"assert",
|
|
345
|
+
"clear",
|
|
346
|
+
"count",
|
|
347
|
+
"countReset",
|
|
348
|
+
"debug",
|
|
349
|
+
"dir",
|
|
350
|
+
"dirxml",
|
|
351
|
+
"error",
|
|
352
|
+
"group",
|
|
353
|
+
"groupCollapsed",
|
|
354
|
+
"groupEnd",
|
|
355
|
+
"info",
|
|
356
|
+
"log",
|
|
357
|
+
"table",
|
|
358
|
+
"time",
|
|
359
|
+
"timeEnd",
|
|
360
|
+
"timeLog",
|
|
361
|
+
"trace",
|
|
362
|
+
"warn"
|
|
363
|
+
],
|
|
364
|
+
lengthThreshold: 1e3,
|
|
365
|
+
logger: "console"
|
|
366
|
+
};
|
|
367
|
+
function initLogObserver(cb, win, logOptions) {
|
|
368
|
+
const loggerType = logOptions.logger;
|
|
369
|
+
if (!loggerType) {
|
|
370
|
+
return () => {
|
|
594
371
|
};
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
logCount++;
|
|
615
|
-
if (logCount < logOptions.lengthThreshold) {
|
|
616
|
-
cb({
|
|
617
|
-
level: level,
|
|
618
|
-
trace: trace,
|
|
619
|
-
payload: payload,
|
|
620
|
-
});
|
|
621
|
-
}
|
|
622
|
-
else if (logCount === logOptions.lengthThreshold) {
|
|
623
|
-
cb({
|
|
624
|
-
level: 'warn',
|
|
625
|
-
trace: [],
|
|
626
|
-
payload: [
|
|
627
|
-
stringify('The number of log records reached the threshold.'),
|
|
628
|
-
],
|
|
629
|
-
});
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
catch (error) {
|
|
633
|
-
original.apply(void 0, __spreadArray(['rrweb logger error:', error], __read(args), false));
|
|
634
|
-
}
|
|
635
|
-
};
|
|
372
|
+
}
|
|
373
|
+
let logger;
|
|
374
|
+
if (typeof loggerType === "string") {
|
|
375
|
+
logger = win[loggerType];
|
|
376
|
+
} else {
|
|
377
|
+
logger = loggerType;
|
|
378
|
+
}
|
|
379
|
+
let logCount = 0;
|
|
380
|
+
const cancelHandlers = [];
|
|
381
|
+
if (logOptions.level.includes("error")) {
|
|
382
|
+
if (window) {
|
|
383
|
+
const errorHandler = (event) => {
|
|
384
|
+
const { message, error } = event;
|
|
385
|
+
const trace = ErrorStackParser.parse(error).map((stackFrame) => stackFrame.toString());
|
|
386
|
+
const payload = [stringify(message, logOptions.stringifyOptions)];
|
|
387
|
+
cb({
|
|
388
|
+
level: "error",
|
|
389
|
+
trace,
|
|
390
|
+
payload
|
|
636
391
|
});
|
|
392
|
+
};
|
|
393
|
+
window.addEventListener("error", errorHandler);
|
|
394
|
+
cancelHandlers.push(() => {
|
|
395
|
+
if (window)
|
|
396
|
+
window.removeEventListener("error", errorHandler);
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
for (const levelType of logOptions.level) {
|
|
401
|
+
cancelHandlers.push(replace(logger, levelType));
|
|
402
|
+
}
|
|
403
|
+
return () => {
|
|
404
|
+
cancelHandlers.forEach((h) => h());
|
|
405
|
+
};
|
|
406
|
+
function replace(_logger, level) {
|
|
407
|
+
if (!_logger[level]) {
|
|
408
|
+
return () => {
|
|
409
|
+
};
|
|
637
410
|
}
|
|
411
|
+
return patch(_logger, level, (original) => {
|
|
412
|
+
return (...args) => {
|
|
413
|
+
original.apply(this, args);
|
|
414
|
+
try {
|
|
415
|
+
const trace = ErrorStackParser.parse(new Error()).map((stackFrame) => stackFrame.toString()).splice(1);
|
|
416
|
+
const payload = args.map((s) => stringify(s, logOptions.stringifyOptions));
|
|
417
|
+
logCount++;
|
|
418
|
+
if (logCount < logOptions.lengthThreshold) {
|
|
419
|
+
cb({
|
|
420
|
+
level,
|
|
421
|
+
trace,
|
|
422
|
+
payload
|
|
423
|
+
});
|
|
424
|
+
} else if (logCount === logOptions.lengthThreshold) {
|
|
425
|
+
cb({
|
|
426
|
+
level: "warn",
|
|
427
|
+
trace: [],
|
|
428
|
+
payload: [
|
|
429
|
+
stringify("The number of log records reached the threshold.")
|
|
430
|
+
]
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
} catch (error) {
|
|
434
|
+
original("rrweb logger error:", error, ...args);
|
|
435
|
+
}
|
|
436
|
+
};
|
|
437
|
+
});
|
|
438
|
+
}
|
|
638
439
|
}
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
: defaultLogOptions,
|
|
646
|
-
}); };
|
|
440
|
+
const PLUGIN_NAME = "rrweb/console@1";
|
|
441
|
+
const getRecordConsolePlugin = (options) => ({
|
|
442
|
+
name: PLUGIN_NAME,
|
|
443
|
+
observer: initLogObserver,
|
|
444
|
+
options: options ? Object.assign({}, defaultLogOptions, options) : defaultLogOptions
|
|
445
|
+
});
|
|
647
446
|
|
|
648
447
|
exports.PLUGIN_NAME = PLUGIN_NAME;
|
|
649
448
|
exports.getRecordConsolePlugin = getRecordConsolePlugin;
|
|
@@ -652,4 +451,4 @@ var rrwebConsoleRecord = (function (exports) {
|
|
|
652
451
|
|
|
653
452
|
return exports;
|
|
654
453
|
|
|
655
|
-
}({})
|
|
454
|
+
})({});
|