@highlight-run/rrweb 2.0.1 → 2.0.6
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 +12 -655
- 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 +4 -293
- 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 +1 -33
- 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 +1 -37
- 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 +3 -747
- 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 +4 -3318
- 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.css +1 -0
- package/dist/replay/rrweb-replay-unpack.js +5 -4614
- 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.css +1 -0
- package/dist/replay/rrweb-replay.js +5 -4204
- package/dist/replay/rrweb-replay.min.js +5 -17
- package/dist/replay/rrweb-replay.min.js.map +1 -1
- package/dist/rrweb-all.css +1 -0
- package/dist/rrweb-all.js +16 -8696
- package/dist/rrweb-all.min.js +16 -17
- package/dist/rrweb-all.min.js.map +1 -1
- package/dist/rrweb.css +1 -0
- package/dist/rrweb.js +6 -7282
- 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/all.css +1 -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 +190 -72
- 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 +2467 -2425
- package/lib/replay/rrweb-replay-unpack.css +1 -0
- package/lib/replay/rrweb-replay-unpack.js +3798 -3344
- package/lib/replay/rrweb-replay.css +1 -0
- package/lib/replay/rrweb-replay.js +3743 -3289
- package/lib/rrweb-all.css +1 -0
- package/lib/rrweb-all.js +6721 -6249
- package/lib/rrweb.css +1 -0
- package/lib/rrweb.js +6151 -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/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
|
@@ -2,134 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
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
5
|
var NodeType;
|
|
134
6
|
(function (NodeType) {
|
|
135
7
|
NodeType[NodeType["Document"] = 0] = "Document";
|
|
@@ -140,511 +12,481 @@ var NodeType;
|
|
|
140
12
|
NodeType[NodeType["Comment"] = 5] = "Comment";
|
|
141
13
|
})(NodeType || (NodeType = {}));
|
|
142
14
|
|
|
143
|
-
|
|
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
|
-
|
|
149
|
-
map: {},
|
|
150
|
-
getId
|
|
151
|
-
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
152
|
-
return -1;
|
|
153
|
-
},
|
|
154
|
-
getNode
|
|
155
|
-
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
156
|
-
return null;
|
|
157
|
-
},
|
|
158
|
-
removeNodeFromMap
|
|
159
|
-
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
160
|
-
},
|
|
161
|
-
has
|
|
162
|
-
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
163
|
-
return false;
|
|
164
|
-
},
|
|
165
|
-
reset
|
|
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
|
|
172
|
-
if (prop === 'map') {
|
|
173
|
-
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
174
|
-
}
|
|
175
|
-
return Reflect.get(target, prop, receiver);
|
|
176
|
-
},
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
function patch(source, name, replacement) {
|
|
180
|
-
try {
|
|
181
|
-
if (!(name in source)) {
|
|
182
|
-
return
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
if (typeof wrapped === 'function') {
|
|
187
|
-
wrapped.prototype = wrapped.prototype || {};
|
|
188
|
-
Object.defineProperties(wrapped, {
|
|
189
|
-
__rrweb_original__: {
|
|
190
|
-
enumerable: false,
|
|
191
|
-
value:
|
|
192
|
-
},
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
source[name] = wrapped;
|
|
196
|
-
return
|
|
197
|
-
source[name] =
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
catch (_a) {
|
|
201
|
-
return
|
|
202
|
-
}
|
|
15
|
+
const DEPARTED_MIRROR_ACCESS_WARNING = 'Please stop import mirror directly. Instead of that,' +
|
|
16
|
+
'\r\n' +
|
|
17
|
+
'now you can use replayer.getMirror() to access the mirror instance of a replayer,' +
|
|
18
|
+
'\r\n' +
|
|
19
|
+
'or you can use record.mirror to access the mirror instance during recording.';
|
|
20
|
+
let _mirror = {
|
|
21
|
+
map: {},
|
|
22
|
+
getId() {
|
|
23
|
+
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
24
|
+
return -1;
|
|
25
|
+
},
|
|
26
|
+
getNode() {
|
|
27
|
+
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
28
|
+
return null;
|
|
29
|
+
},
|
|
30
|
+
removeNodeFromMap() {
|
|
31
|
+
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
32
|
+
},
|
|
33
|
+
has() {
|
|
34
|
+
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
35
|
+
return false;
|
|
36
|
+
},
|
|
37
|
+
reset() {
|
|
38
|
+
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
if (typeof window !== 'undefined' && window.Proxy && window.Reflect) {
|
|
42
|
+
_mirror = new Proxy(_mirror, {
|
|
43
|
+
get(target, prop, receiver) {
|
|
44
|
+
if (prop === 'map') {
|
|
45
|
+
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
46
|
+
}
|
|
47
|
+
return Reflect.get(target, prop, receiver);
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
function patch(source, name, replacement) {
|
|
52
|
+
try {
|
|
53
|
+
if (!(name in source)) {
|
|
54
|
+
return () => { };
|
|
55
|
+
}
|
|
56
|
+
const original = source[name];
|
|
57
|
+
const wrapped = replacement(original);
|
|
58
|
+
if (typeof wrapped === 'function') {
|
|
59
|
+
wrapped.prototype = wrapped.prototype || {};
|
|
60
|
+
Object.defineProperties(wrapped, {
|
|
61
|
+
__rrweb_original__: {
|
|
62
|
+
enumerable: false,
|
|
63
|
+
value: original,
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
source[name] = wrapped;
|
|
68
|
+
return () => {
|
|
69
|
+
source[name] = original;
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
catch (_a) {
|
|
73
|
+
return () => { };
|
|
74
|
+
}
|
|
203
75
|
}
|
|
204
76
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
this.fileName = obj.fileName || '';
|
|
208
|
-
this.functionName = obj.functionName || '';
|
|
209
|
-
this.lineNumber = obj.lineNumber;
|
|
210
|
-
this.columnNumber = obj.columnNumber;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
if (this.functionName) {
|
|
216
|
-
return (this.functionName +
|
|
217
|
-
' (' +
|
|
218
|
-
this.fileName +
|
|
219
|
-
':' +
|
|
220
|
-
lineNumber +
|
|
221
|
-
':' +
|
|
222
|
-
columnNumber +
|
|
223
|
-
')');
|
|
224
|
-
}
|
|
225
|
-
return this.fileName + ':' + lineNumber + ':' + columnNumber;
|
|
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
|
-
.replace(/eval
|
|
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
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
.replace(
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
},
|
|
77
|
+
class StackFrame {
|
|
78
|
+
constructor(obj) {
|
|
79
|
+
this.fileName = obj.fileName || '';
|
|
80
|
+
this.functionName = obj.functionName || '';
|
|
81
|
+
this.lineNumber = obj.lineNumber;
|
|
82
|
+
this.columnNumber = obj.columnNumber;
|
|
83
|
+
}
|
|
84
|
+
toString() {
|
|
85
|
+
const lineNumber = this.lineNumber || '';
|
|
86
|
+
const columnNumber = this.columnNumber || '';
|
|
87
|
+
if (this.functionName) {
|
|
88
|
+
return (this.functionName +
|
|
89
|
+
' (' +
|
|
90
|
+
this.fileName +
|
|
91
|
+
':' +
|
|
92
|
+
lineNumber +
|
|
93
|
+
':' +
|
|
94
|
+
columnNumber +
|
|
95
|
+
')');
|
|
96
|
+
}
|
|
97
|
+
return this.fileName + ':' + lineNumber + ':' + columnNumber;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
const FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+:\d+/;
|
|
101
|
+
const CHROME_IE_STACK_REGEXP = /^\s*at .*(\S+:\d+|\(native\))/m;
|
|
102
|
+
const SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code])?$/;
|
|
103
|
+
const ErrorStackParser = {
|
|
104
|
+
parse: function (error) {
|
|
105
|
+
if (!error) {
|
|
106
|
+
return [];
|
|
107
|
+
}
|
|
108
|
+
if (typeof error.stacktrace !== 'undefined' ||
|
|
109
|
+
typeof error['opera#sourceloc'] !== 'undefined') {
|
|
110
|
+
return this.parseOpera(error);
|
|
111
|
+
}
|
|
112
|
+
else if (error.stack && error.stack.match(CHROME_IE_STACK_REGEXP)) {
|
|
113
|
+
return this.parseV8OrIE(error);
|
|
114
|
+
}
|
|
115
|
+
else if (error.stack) {
|
|
116
|
+
return this.parseFFOrSafari(error);
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
throw new Error('Cannot parse given Error object');
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
extractLocation: function (urlLike) {
|
|
123
|
+
if (urlLike.indexOf(':') === -1) {
|
|
124
|
+
return [urlLike];
|
|
125
|
+
}
|
|
126
|
+
const regExp = /(.+?)(?::(\d+))?(?::(\d+))?$/;
|
|
127
|
+
const parts = regExp.exec(urlLike.replace(/[()]/g, ''));
|
|
128
|
+
if (!parts)
|
|
129
|
+
throw new Error(`Cannot parse given url: ${urlLike}`);
|
|
130
|
+
return [parts[1], parts[2] || undefined, parts[3] || undefined];
|
|
131
|
+
},
|
|
132
|
+
parseV8OrIE: function (error) {
|
|
133
|
+
const filtered = error.stack.split('\n').filter(function (line) {
|
|
134
|
+
return !!line.match(CHROME_IE_STACK_REGEXP);
|
|
135
|
+
}, this);
|
|
136
|
+
return filtered.map(function (line) {
|
|
137
|
+
if (line.indexOf('(eval ') > -1) {
|
|
138
|
+
line = line
|
|
139
|
+
.replace(/eval code/g, 'eval')
|
|
140
|
+
.replace(/(\(eval at [^()]*)|(\),.*$)/g, '');
|
|
141
|
+
}
|
|
142
|
+
let sanitizedLine = line.replace(/^\s+/, '').replace(/\(eval code/g, '(');
|
|
143
|
+
const location = sanitizedLine.match(/ (\((.+):(\d+):(\d+)\)$)/);
|
|
144
|
+
sanitizedLine = location
|
|
145
|
+
? sanitizedLine.replace(location[0], '')
|
|
146
|
+
: sanitizedLine;
|
|
147
|
+
const tokens = sanitizedLine.split(/\s+/).slice(1);
|
|
148
|
+
const locationParts = this.extractLocation(location ? location[1] : tokens.pop());
|
|
149
|
+
const functionName = tokens.join(' ') || undefined;
|
|
150
|
+
const fileName = ['eval', '<anonymous>'].indexOf(locationParts[0]) > -1
|
|
151
|
+
? undefined
|
|
152
|
+
: locationParts[0];
|
|
153
|
+
return new StackFrame({
|
|
154
|
+
functionName,
|
|
155
|
+
fileName,
|
|
156
|
+
lineNumber: locationParts[1],
|
|
157
|
+
columnNumber: locationParts[2],
|
|
158
|
+
});
|
|
159
|
+
}, this);
|
|
160
|
+
},
|
|
161
|
+
parseFFOrSafari: function (error) {
|
|
162
|
+
const filtered = error.stack.split('\n').filter(function (line) {
|
|
163
|
+
return !line.match(SAFARI_NATIVE_CODE_REGEXP);
|
|
164
|
+
}, this);
|
|
165
|
+
return filtered.map(function (line) {
|
|
166
|
+
if (line.indexOf(' > eval') > -1) {
|
|
167
|
+
line = line.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ':$1');
|
|
168
|
+
}
|
|
169
|
+
if (line.indexOf('@') === -1 && line.indexOf(':') === -1) {
|
|
170
|
+
return new StackFrame({
|
|
171
|
+
functionName: line,
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
const functionNameRegex = /((.*".+"[^@]*)?[^@]*)(?:@)/;
|
|
176
|
+
const matches = line.match(functionNameRegex);
|
|
177
|
+
const functionName = matches && matches[1] ? matches[1] : undefined;
|
|
178
|
+
const locationParts = this.extractLocation(line.replace(functionNameRegex, ''));
|
|
179
|
+
return new StackFrame({
|
|
180
|
+
functionName,
|
|
181
|
+
fileName: locationParts[0],
|
|
182
|
+
lineNumber: locationParts[1],
|
|
183
|
+
columnNumber: locationParts[2],
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
}, this);
|
|
187
|
+
},
|
|
188
|
+
parseOpera: function (e) {
|
|
189
|
+
if (!e.stacktrace ||
|
|
190
|
+
(e.message.indexOf('\n') > -1 &&
|
|
191
|
+
e.message.split('\n').length > e.stacktrace.split('\n').length)) {
|
|
192
|
+
return this.parseOpera9(e);
|
|
193
|
+
}
|
|
194
|
+
else if (!e.stack) {
|
|
195
|
+
return this.parseOpera10(e);
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
return this.parseOpera11(e);
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
parseOpera9: function (e) {
|
|
202
|
+
const lineRE = /Line (\d+).*script (?:in )?(\S+)/i;
|
|
203
|
+
const lines = e.message.split('\n');
|
|
204
|
+
const result = [];
|
|
205
|
+
for (let i = 2, len = lines.length; i < len; i += 2) {
|
|
206
|
+
const match = lineRE.exec(lines[i]);
|
|
207
|
+
if (match) {
|
|
208
|
+
result.push(new StackFrame({
|
|
209
|
+
fileName: match[2],
|
|
210
|
+
lineNumber: parseFloat(match[1]),
|
|
211
|
+
}));
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return result;
|
|
215
|
+
},
|
|
216
|
+
parseOpera10: function (e) {
|
|
217
|
+
const lineRE = /Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i;
|
|
218
|
+
const lines = e.stacktrace.split('\n');
|
|
219
|
+
const result = [];
|
|
220
|
+
for (let i = 0, len = lines.length; i < len; i += 2) {
|
|
221
|
+
const match = lineRE.exec(lines[i]);
|
|
222
|
+
if (match) {
|
|
223
|
+
result.push(new StackFrame({
|
|
224
|
+
functionName: match[3] || undefined,
|
|
225
|
+
fileName: match[2],
|
|
226
|
+
lineNumber: parseFloat(match[1]),
|
|
227
|
+
}));
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
return result;
|
|
231
|
+
},
|
|
232
|
+
parseOpera11: function (error) {
|
|
233
|
+
const filtered = error.stack.split('\n').filter(function (line) {
|
|
234
|
+
return (!!line.match(FIREFOX_SAFARI_STACK_REGEXP) &&
|
|
235
|
+
!line.match(/^Error created at/));
|
|
236
|
+
}, this);
|
|
237
|
+
return filtered.map(function (line) {
|
|
238
|
+
const tokens = line.split('@');
|
|
239
|
+
const locationParts = this.extractLocation(tokens.pop());
|
|
240
|
+
const functionCall = tokens.shift() || '';
|
|
241
|
+
const functionName = functionCall
|
|
242
|
+
.replace(/<anonymous function(: (\w+))?>/, '$2')
|
|
243
|
+
.replace(/\([^)]*\)/g, '') || undefined;
|
|
244
|
+
return new StackFrame({
|
|
245
|
+
functionName,
|
|
246
|
+
fileName: locationParts[0],
|
|
247
|
+
lineNumber: locationParts[1],
|
|
248
|
+
columnNumber: locationParts[2],
|
|
249
|
+
});
|
|
250
|
+
}, this);
|
|
251
|
+
},
|
|
381
252
|
};
|
|
382
253
|
|
|
383
|
-
function pathToSelector(node) {
|
|
384
|
-
if (!node || !node.outerHTML) {
|
|
385
|
-
return '';
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
while (node.parentElement) {
|
|
389
|
-
|
|
390
|
-
if (!
|
|
391
|
-
break;
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
if (
|
|
397
|
-
for (
|
|
398
|
-
|
|
399
|
-
if (sibling.localName && sibling.localName.toLowerCase) {
|
|
400
|
-
if (sibling.localName.toLowerCase() ===
|
|
401
|
-
domSiblings.push(sibling);
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
if (domSiblings.length > 1) {
|
|
407
|
-
|
|
408
|
-
}
|
|
409
|
-
path =
|
|
410
|
-
node =
|
|
411
|
-
}
|
|
412
|
-
return path;
|
|
413
|
-
}
|
|
414
|
-
function isObject(obj) {
|
|
415
|
-
return Object.prototype.toString.call(obj) === '[object Object]';
|
|
416
|
-
}
|
|
417
|
-
function isObjTooDeep(obj, limit) {
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
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
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
return
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
return
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
return true;
|
|
509
|
-
}
|
|
510
|
-
return false;
|
|
511
|
-
}
|
|
512
|
-
function toString(_obj) {
|
|
513
|
-
var str = _obj.toString();
|
|
514
|
-
if (options.stringLengthLimit && str.length > options.stringLengthLimit) {
|
|
515
|
-
str = "".concat(str.slice(0, options.stringLengthLimit), "...");
|
|
516
|
-
}
|
|
517
|
-
return str;
|
|
518
|
-
}
|
|
254
|
+
function pathToSelector(node) {
|
|
255
|
+
if (!node || !node.outerHTML) {
|
|
256
|
+
return '';
|
|
257
|
+
}
|
|
258
|
+
let path = '';
|
|
259
|
+
while (node.parentElement) {
|
|
260
|
+
let name = node.localName;
|
|
261
|
+
if (!name) {
|
|
262
|
+
break;
|
|
263
|
+
}
|
|
264
|
+
name = name.toLowerCase();
|
|
265
|
+
const parent = node.parentElement;
|
|
266
|
+
const domSiblings = [];
|
|
267
|
+
if (parent.children && parent.children.length > 0) {
|
|
268
|
+
for (let i = 0; i < parent.children.length; i++) {
|
|
269
|
+
const sibling = parent.children[i];
|
|
270
|
+
if (sibling.localName && sibling.localName.toLowerCase) {
|
|
271
|
+
if (sibling.localName.toLowerCase() === name) {
|
|
272
|
+
domSiblings.push(sibling);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
if (domSiblings.length > 1) {
|
|
278
|
+
name += ':eq(' + domSiblings.indexOf(node) + ')';
|
|
279
|
+
}
|
|
280
|
+
path = name + (path ? '>' + path : '');
|
|
281
|
+
node = parent;
|
|
282
|
+
}
|
|
283
|
+
return path;
|
|
284
|
+
}
|
|
285
|
+
function isObject(obj) {
|
|
286
|
+
return Object.prototype.toString.call(obj) === '[object Object]';
|
|
287
|
+
}
|
|
288
|
+
function isObjTooDeep(obj, limit) {
|
|
289
|
+
if (limit === 0) {
|
|
290
|
+
return true;
|
|
291
|
+
}
|
|
292
|
+
const keys = Object.keys(obj);
|
|
293
|
+
for (const key of keys) {
|
|
294
|
+
if (isObject(obj[key]) && isObjTooDeep(obj[key], limit - 1)) {
|
|
295
|
+
return true;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
return false;
|
|
299
|
+
}
|
|
300
|
+
function stringify(obj, stringifyOptions) {
|
|
301
|
+
const options = {
|
|
302
|
+
numOfKeysLimit: 50,
|
|
303
|
+
depthOfLimit: 4,
|
|
304
|
+
};
|
|
305
|
+
Object.assign(options, stringifyOptions);
|
|
306
|
+
const stack = [];
|
|
307
|
+
const keys = [];
|
|
308
|
+
return JSON.stringify(obj, function (key, value) {
|
|
309
|
+
if (stack.length > 0) {
|
|
310
|
+
const thisPos = stack.indexOf(this);
|
|
311
|
+
~thisPos ? stack.splice(thisPos + 1) : stack.push(this);
|
|
312
|
+
~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key);
|
|
313
|
+
if (~stack.indexOf(value)) {
|
|
314
|
+
if (stack[0] === value) {
|
|
315
|
+
value = '[Circular ~]';
|
|
316
|
+
}
|
|
317
|
+
else {
|
|
318
|
+
value =
|
|
319
|
+
'[Circular ~.' +
|
|
320
|
+
keys.slice(0, stack.indexOf(value)).join('.') +
|
|
321
|
+
']';
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
else {
|
|
326
|
+
stack.push(value);
|
|
327
|
+
}
|
|
328
|
+
if (value === null || value === undefined) {
|
|
329
|
+
return value;
|
|
330
|
+
}
|
|
331
|
+
if (shouldIgnore(value)) {
|
|
332
|
+
return toString(value);
|
|
333
|
+
}
|
|
334
|
+
if (value instanceof Event) {
|
|
335
|
+
const eventResult = {};
|
|
336
|
+
for (const eventKey in value) {
|
|
337
|
+
const eventValue = value[eventKey];
|
|
338
|
+
if (Array.isArray(eventValue)) {
|
|
339
|
+
eventResult[eventKey] = pathToSelector(eventValue.length ? eventValue[0] : null);
|
|
340
|
+
}
|
|
341
|
+
else {
|
|
342
|
+
eventResult[eventKey] = eventValue;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
return eventResult;
|
|
346
|
+
}
|
|
347
|
+
else if (value instanceof Node) {
|
|
348
|
+
if (value instanceof HTMLElement) {
|
|
349
|
+
return value ? value.outerHTML : '';
|
|
350
|
+
}
|
|
351
|
+
return value.nodeName;
|
|
352
|
+
}
|
|
353
|
+
else if (value instanceof Error) {
|
|
354
|
+
return value.stack
|
|
355
|
+
? value.stack + '\nEnd of stack for Error object'
|
|
356
|
+
: value.name + ': ' + value.message;
|
|
357
|
+
}
|
|
358
|
+
return value;
|
|
359
|
+
});
|
|
360
|
+
function shouldIgnore(_obj) {
|
|
361
|
+
if (isObject(_obj) && Object.keys(_obj).length > options.numOfKeysLimit) {
|
|
362
|
+
return true;
|
|
363
|
+
}
|
|
364
|
+
if (typeof _obj === 'function') {
|
|
365
|
+
return true;
|
|
366
|
+
}
|
|
367
|
+
if (isObject(_obj) && isObjTooDeep(_obj, options.depthOfLimit)) {
|
|
368
|
+
return true;
|
|
369
|
+
}
|
|
370
|
+
return false;
|
|
371
|
+
}
|
|
372
|
+
function toString(_obj) {
|
|
373
|
+
let str = _obj.toString();
|
|
374
|
+
if (options.stringLengthLimit && str.length > options.stringLengthLimit) {
|
|
375
|
+
str = `${str.slice(0, options.stringLengthLimit)}...`;
|
|
376
|
+
}
|
|
377
|
+
return str;
|
|
378
|
+
}
|
|
519
379
|
}
|
|
520
380
|
|
|
521
|
-
|
|
522
|
-
level: [
|
|
523
|
-
'assert',
|
|
524
|
-
'clear',
|
|
525
|
-
'count',
|
|
526
|
-
'countReset',
|
|
527
|
-
'debug',
|
|
528
|
-
'dir',
|
|
529
|
-
'dirxml',
|
|
530
|
-
'error',
|
|
531
|
-
'group',
|
|
532
|
-
'groupCollapsed',
|
|
533
|
-
'groupEnd',
|
|
534
|
-
'info',
|
|
535
|
-
'log',
|
|
536
|
-
'table',
|
|
537
|
-
'time',
|
|
538
|
-
'timeEnd',
|
|
539
|
-
'timeLog',
|
|
540
|
-
'trace',
|
|
541
|
-
'warn',
|
|
542
|
-
],
|
|
543
|
-
lengthThreshold: 1000,
|
|
544
|
-
logger: 'console',
|
|
545
|
-
};
|
|
546
|
-
function initLogObserver(cb, win, logOptions) {
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
});
|
|
631
|
-
}
|
|
632
|
-
}
|
|
633
|
-
catch (error) {
|
|
634
|
-
original.apply(void 0, __spreadArray(['rrweb logger error:', error], __read(args), false));
|
|
635
|
-
}
|
|
636
|
-
};
|
|
637
|
-
});
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
var PLUGIN_NAME = 'rrweb/console@1';
|
|
641
|
-
var getRecordConsolePlugin = function (options) { return ({
|
|
642
|
-
name: PLUGIN_NAME,
|
|
643
|
-
observer: initLogObserver,
|
|
644
|
-
options: options
|
|
645
|
-
? Object.assign({}, defaultLogOptions, options)
|
|
646
|
-
: defaultLogOptions,
|
|
647
|
-
}); };
|
|
381
|
+
const defaultLogOptions = {
|
|
382
|
+
level: [
|
|
383
|
+
'assert',
|
|
384
|
+
'clear',
|
|
385
|
+
'count',
|
|
386
|
+
'countReset',
|
|
387
|
+
'debug',
|
|
388
|
+
'dir',
|
|
389
|
+
'dirxml',
|
|
390
|
+
'error',
|
|
391
|
+
'group',
|
|
392
|
+
'groupCollapsed',
|
|
393
|
+
'groupEnd',
|
|
394
|
+
'info',
|
|
395
|
+
'log',
|
|
396
|
+
'table',
|
|
397
|
+
'time',
|
|
398
|
+
'timeEnd',
|
|
399
|
+
'timeLog',
|
|
400
|
+
'trace',
|
|
401
|
+
'warn',
|
|
402
|
+
],
|
|
403
|
+
lengthThreshold: 1000,
|
|
404
|
+
logger: 'console',
|
|
405
|
+
};
|
|
406
|
+
function initLogObserver(cb, win, logOptions) {
|
|
407
|
+
const loggerType = logOptions.logger;
|
|
408
|
+
if (!loggerType) {
|
|
409
|
+
return () => { };
|
|
410
|
+
}
|
|
411
|
+
let logger;
|
|
412
|
+
if (typeof loggerType === 'string') {
|
|
413
|
+
logger = win[loggerType];
|
|
414
|
+
}
|
|
415
|
+
else {
|
|
416
|
+
logger = loggerType;
|
|
417
|
+
}
|
|
418
|
+
let logCount = 0;
|
|
419
|
+
const cancelHandlers = [];
|
|
420
|
+
if (logOptions.level.includes('error')) {
|
|
421
|
+
if (window) {
|
|
422
|
+
const errorHandler = (event) => {
|
|
423
|
+
const { message, error } = event;
|
|
424
|
+
const trace = ErrorStackParser.parse(error).map((stackFrame) => stackFrame.toString());
|
|
425
|
+
const payload = [stringify(message, logOptions.stringifyOptions)];
|
|
426
|
+
cb({
|
|
427
|
+
level: 'error',
|
|
428
|
+
trace,
|
|
429
|
+
payload,
|
|
430
|
+
});
|
|
431
|
+
};
|
|
432
|
+
window.addEventListener('error', errorHandler);
|
|
433
|
+
cancelHandlers.push(() => {
|
|
434
|
+
if (window)
|
|
435
|
+
window.removeEventListener('error', errorHandler);
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
for (const levelType of logOptions.level) {
|
|
440
|
+
cancelHandlers.push(replace(logger, levelType));
|
|
441
|
+
}
|
|
442
|
+
return () => {
|
|
443
|
+
cancelHandlers.forEach((h) => h());
|
|
444
|
+
};
|
|
445
|
+
function replace(_logger, level) {
|
|
446
|
+
if (!_logger[level]) {
|
|
447
|
+
return () => { };
|
|
448
|
+
}
|
|
449
|
+
return patch(_logger, level, (original) => {
|
|
450
|
+
return (...args) => {
|
|
451
|
+
original.apply(this, args);
|
|
452
|
+
try {
|
|
453
|
+
const trace = ErrorStackParser.parse(new Error())
|
|
454
|
+
.map((stackFrame) => stackFrame.toString())
|
|
455
|
+
.splice(1);
|
|
456
|
+
const payload = args.map((s) => stringify(s, logOptions.stringifyOptions));
|
|
457
|
+
logCount++;
|
|
458
|
+
if (logCount < logOptions.lengthThreshold) {
|
|
459
|
+
cb({
|
|
460
|
+
level,
|
|
461
|
+
trace,
|
|
462
|
+
payload,
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
else if (logCount === logOptions.lengthThreshold) {
|
|
466
|
+
cb({
|
|
467
|
+
level: 'warn',
|
|
468
|
+
trace: [],
|
|
469
|
+
payload: [
|
|
470
|
+
stringify('The number of log records reached the threshold.'),
|
|
471
|
+
],
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
catch (error) {
|
|
476
|
+
original('rrweb logger error:', error, ...args);
|
|
477
|
+
}
|
|
478
|
+
};
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
const PLUGIN_NAME = 'rrweb/console@1';
|
|
483
|
+
const getRecordConsolePlugin = (options) => ({
|
|
484
|
+
name: PLUGIN_NAME,
|
|
485
|
+
observer: initLogObserver,
|
|
486
|
+
options: options
|
|
487
|
+
? Object.assign({}, defaultLogOptions, options)
|
|
488
|
+
: defaultLogOptions,
|
|
489
|
+
});
|
|
648
490
|
|
|
649
491
|
exports.PLUGIN_NAME = PLUGIN_NAME;
|
|
650
492
|
exports.getRecordConsolePlugin = getRecordConsolePlugin;
|