@betterbugs/rrweb-plugin-console-record 2.0.0-alpha.19
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/README.md +178 -0
- package/dist/index.d.cts +50 -0
- package/dist/index.d.ts +50 -0
- package/dist/rrweb-plugin-console-record.cjs +490 -0
- package/dist/rrweb-plugin-console-record.cjs.map +1 -0
- package/dist/rrweb-plugin-console-record.js +490 -0
- package/dist/rrweb-plugin-console-record.js.map +1 -0
- package/dist/rrweb-plugin-console-record.umd.cjs +520 -0
- package/dist/rrweb-plugin-console-record.umd.cjs.map +7 -0
- package/dist/rrweb-plugin-console-record.umd.min.cjs +41 -0
- package/dist/rrweb-plugin-console-record.umd.min.cjs.map +7 -0
- package/package.json +63 -0
|
@@ -0,0 +1,490 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
6
|
+
function patch(source, name, replacement) {
|
|
7
|
+
try {
|
|
8
|
+
if (!(name in source)) {
|
|
9
|
+
return () => {
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
const original = source[name];
|
|
13
|
+
const wrapped = replacement(original);
|
|
14
|
+
if (typeof wrapped === "function") {
|
|
15
|
+
wrapped.prototype = wrapped.prototype || {};
|
|
16
|
+
Object.defineProperties(wrapped, {
|
|
17
|
+
__rrweb_original__: {
|
|
18
|
+
enumerable: false,
|
|
19
|
+
value: original
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
source[name] = wrapped;
|
|
24
|
+
return () => {
|
|
25
|
+
source[name] = original;
|
|
26
|
+
};
|
|
27
|
+
} catch {
|
|
28
|
+
return () => {
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
class StackFrame {
|
|
33
|
+
constructor(obj) {
|
|
34
|
+
__publicField(this, "fileName");
|
|
35
|
+
__publicField(this, "functionName");
|
|
36
|
+
__publicField(this, "lineNumber");
|
|
37
|
+
__publicField(this, "columnNumber");
|
|
38
|
+
this.fileName = obj.fileName || "";
|
|
39
|
+
this.functionName = obj.functionName || "";
|
|
40
|
+
this.lineNumber = obj.lineNumber;
|
|
41
|
+
this.columnNumber = obj.columnNumber;
|
|
42
|
+
}
|
|
43
|
+
toString() {
|
|
44
|
+
const lineNumber = this.lineNumber || "";
|
|
45
|
+
const columnNumber = this.columnNumber || "";
|
|
46
|
+
if (this.functionName)
|
|
47
|
+
return `${this.functionName} (${this.fileName}:${lineNumber}:${columnNumber})`;
|
|
48
|
+
return `${this.fileName}:${lineNumber}:${columnNumber}`;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+:\d+/;
|
|
52
|
+
const CHROME_IE_STACK_REGEXP = /^\s*at .*(\S+:\d+|\(native\))/m;
|
|
53
|
+
const SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code])?$/;
|
|
54
|
+
const ErrorStackParser = {
|
|
55
|
+
/**
|
|
56
|
+
* Given an Error object, extract the most information from it.
|
|
57
|
+
*/
|
|
58
|
+
parse: function(error) {
|
|
59
|
+
if (!error) {
|
|
60
|
+
return [];
|
|
61
|
+
}
|
|
62
|
+
if (
|
|
63
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
64
|
+
// @ts-ignore
|
|
65
|
+
typeof error.stacktrace !== "undefined" || // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
66
|
+
// @ts-ignore
|
|
67
|
+
typeof error["opera#sourceloc"] !== "undefined"
|
|
68
|
+
) {
|
|
69
|
+
return this.parseOpera(
|
|
70
|
+
error
|
|
71
|
+
);
|
|
72
|
+
} else if (error.stack && error.stack.match(CHROME_IE_STACK_REGEXP)) {
|
|
73
|
+
return this.parseV8OrIE(error);
|
|
74
|
+
} else if (error.stack) {
|
|
75
|
+
return this.parseFFOrSafari(error);
|
|
76
|
+
} else {
|
|
77
|
+
console.warn(
|
|
78
|
+
"[console-record-plugin]: Failed to parse error object:",
|
|
79
|
+
error
|
|
80
|
+
);
|
|
81
|
+
return [];
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
// Separate line and column numbers from a string of the form: (URI:Line:Column)
|
|
85
|
+
extractLocation: function(urlLike) {
|
|
86
|
+
if (urlLike.indexOf(":") === -1) {
|
|
87
|
+
return [urlLike];
|
|
88
|
+
}
|
|
89
|
+
const regExp = /(.+?)(?::(\d+))?(?::(\d+))?$/;
|
|
90
|
+
const parts = regExp.exec(urlLike.replace(/[()]/g, ""));
|
|
91
|
+
if (!parts) throw new Error(`Cannot parse given url: ${urlLike}`);
|
|
92
|
+
return [parts[1], parts[2] || void 0, parts[3] || void 0];
|
|
93
|
+
},
|
|
94
|
+
parseV8OrIE: function(error) {
|
|
95
|
+
const filtered = error.stack.split("\n").filter(function(line) {
|
|
96
|
+
return !!line.match(CHROME_IE_STACK_REGEXP);
|
|
97
|
+
}, this);
|
|
98
|
+
return filtered.map(function(line) {
|
|
99
|
+
if (line.indexOf("(eval ") > -1) {
|
|
100
|
+
line = line.replace(/eval code/g, "eval").replace(/(\(eval at [^()]*)|(\),.*$)/g, "");
|
|
101
|
+
}
|
|
102
|
+
let sanitizedLine = line.replace(/^\s+/, "").replace(/\(eval code/g, "(");
|
|
103
|
+
const location = sanitizedLine.match(/ (\((.+):(\d+):(\d+)\)$)/);
|
|
104
|
+
sanitizedLine = location ? sanitizedLine.replace(location[0], "") : sanitizedLine;
|
|
105
|
+
const tokens = sanitizedLine.split(/\s+/).slice(1);
|
|
106
|
+
const locationParts = this.extractLocation(
|
|
107
|
+
location ? location[1] : tokens.pop()
|
|
108
|
+
);
|
|
109
|
+
const functionName = tokens.join(" ") || void 0;
|
|
110
|
+
const fileName = ["eval", "<anonymous>"].indexOf(locationParts[0]) > -1 ? void 0 : locationParts[0];
|
|
111
|
+
return new StackFrame({
|
|
112
|
+
functionName,
|
|
113
|
+
fileName,
|
|
114
|
+
lineNumber: locationParts[1],
|
|
115
|
+
columnNumber: locationParts[2]
|
|
116
|
+
});
|
|
117
|
+
}, this);
|
|
118
|
+
},
|
|
119
|
+
parseFFOrSafari: function(error) {
|
|
120
|
+
const filtered = error.stack.split("\n").filter(function(line) {
|
|
121
|
+
return !line.match(SAFARI_NATIVE_CODE_REGEXP);
|
|
122
|
+
}, this);
|
|
123
|
+
return filtered.map(function(line) {
|
|
124
|
+
if (line.indexOf(" > eval") > -1) {
|
|
125
|
+
line = line.replace(
|
|
126
|
+
/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,
|
|
127
|
+
":$1"
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
if (line.indexOf("@") === -1 && line.indexOf(":") === -1) {
|
|
131
|
+
return new StackFrame({
|
|
132
|
+
functionName: line
|
|
133
|
+
});
|
|
134
|
+
} else {
|
|
135
|
+
const functionNameRegex = /((.*".+"[^@]*)?[^@]*)(?:@)/;
|
|
136
|
+
const matches = line.match(functionNameRegex);
|
|
137
|
+
const functionName = matches && matches[1] ? matches[1] : void 0;
|
|
138
|
+
const locationParts = this.extractLocation(
|
|
139
|
+
line.replace(functionNameRegex, "")
|
|
140
|
+
);
|
|
141
|
+
return new StackFrame({
|
|
142
|
+
functionName,
|
|
143
|
+
fileName: locationParts[0],
|
|
144
|
+
lineNumber: locationParts[1],
|
|
145
|
+
columnNumber: locationParts[2]
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
}, this);
|
|
149
|
+
},
|
|
150
|
+
parseOpera: function(e) {
|
|
151
|
+
if (!e.stacktrace || e.message.indexOf("\n") > -1 && e.message.split("\n").length > e.stacktrace.split("\n").length) {
|
|
152
|
+
return this.parseOpera9(e);
|
|
153
|
+
} else if (!e.stack) {
|
|
154
|
+
return this.parseOpera10(e);
|
|
155
|
+
} else {
|
|
156
|
+
return this.parseOpera11(e);
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
parseOpera9: function(e) {
|
|
160
|
+
const lineRE = /Line (\d+).*script (?:in )?(\S+)/i;
|
|
161
|
+
const lines = e.message.split("\n");
|
|
162
|
+
const result = [];
|
|
163
|
+
for (let i = 2, len = lines.length; i < len; i += 2) {
|
|
164
|
+
const match = lineRE.exec(lines[i]);
|
|
165
|
+
if (match) {
|
|
166
|
+
result.push(
|
|
167
|
+
new StackFrame({
|
|
168
|
+
fileName: match[2],
|
|
169
|
+
lineNumber: parseFloat(match[1])
|
|
170
|
+
})
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return result;
|
|
175
|
+
},
|
|
176
|
+
parseOpera10: function(e) {
|
|
177
|
+
const lineRE = /Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i;
|
|
178
|
+
const lines = e.stacktrace.split("\n");
|
|
179
|
+
const result = [];
|
|
180
|
+
for (let i = 0, len = lines.length; i < len; i += 2) {
|
|
181
|
+
const match = lineRE.exec(lines[i]);
|
|
182
|
+
if (match) {
|
|
183
|
+
result.push(
|
|
184
|
+
new StackFrame({
|
|
185
|
+
functionName: match[3] || void 0,
|
|
186
|
+
fileName: match[2],
|
|
187
|
+
lineNumber: parseFloat(match[1])
|
|
188
|
+
})
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return result;
|
|
193
|
+
},
|
|
194
|
+
// Opera 10.65+ Error.stack very similar to FF/Safari
|
|
195
|
+
parseOpera11: function(error) {
|
|
196
|
+
const filtered = error.stack.split("\n").filter(function(line) {
|
|
197
|
+
return !!line.match(FIREFOX_SAFARI_STACK_REGEXP) && !line.match(/^Error created at/);
|
|
198
|
+
}, this);
|
|
199
|
+
return filtered.map(function(line) {
|
|
200
|
+
const tokens = line.split("@");
|
|
201
|
+
const locationParts = this.extractLocation(tokens.pop());
|
|
202
|
+
const functionCall = tokens.shift() || "";
|
|
203
|
+
const functionName = functionCall.replace(/<anonymous function(: (\w+))?>/, "$2").replace(/\([^)]*\)/g, "") || void 0;
|
|
204
|
+
return new StackFrame({
|
|
205
|
+
functionName,
|
|
206
|
+
fileName: locationParts[0],
|
|
207
|
+
lineNumber: locationParts[1],
|
|
208
|
+
columnNumber: locationParts[2]
|
|
209
|
+
});
|
|
210
|
+
}, this);
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
function pathToSelector(node) {
|
|
214
|
+
if (!node || !node.outerHTML) {
|
|
215
|
+
return "";
|
|
216
|
+
}
|
|
217
|
+
let path = "";
|
|
218
|
+
while (node.parentElement) {
|
|
219
|
+
let name = node.localName;
|
|
220
|
+
if (!name) {
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
223
|
+
name = name.toLowerCase();
|
|
224
|
+
const parent = node.parentElement;
|
|
225
|
+
const domSiblings = [];
|
|
226
|
+
if (parent.children && parent.children.length > 0) {
|
|
227
|
+
for (let i = 0; i < parent.children.length; i++) {
|
|
228
|
+
const sibling = parent.children[i];
|
|
229
|
+
if (sibling.localName && sibling.localName.toLowerCase) {
|
|
230
|
+
if (sibling.localName.toLowerCase() === name) {
|
|
231
|
+
domSiblings.push(sibling);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
if (domSiblings.length > 1) {
|
|
237
|
+
name += `:eq(${domSiblings.indexOf(node)})`;
|
|
238
|
+
}
|
|
239
|
+
path = name + (path ? ">" + path : "");
|
|
240
|
+
node = parent;
|
|
241
|
+
}
|
|
242
|
+
return path;
|
|
243
|
+
}
|
|
244
|
+
function isObject(obj) {
|
|
245
|
+
return Object.prototype.toString.call(obj) === "[object Object]";
|
|
246
|
+
}
|
|
247
|
+
function isObjTooDeep(obj, limit) {
|
|
248
|
+
if (limit === 0) {
|
|
249
|
+
return true;
|
|
250
|
+
}
|
|
251
|
+
const keys = Object.keys(obj);
|
|
252
|
+
for (const key of keys) {
|
|
253
|
+
if (isObject(obj[key]) && isObjTooDeep(obj[key], limit - 1)) {
|
|
254
|
+
return true;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return false;
|
|
258
|
+
}
|
|
259
|
+
function stringify(obj, stringifyOptions) {
|
|
260
|
+
const options = {
|
|
261
|
+
numOfKeysLimit: 50,
|
|
262
|
+
depthOfLimit: 4
|
|
263
|
+
};
|
|
264
|
+
Object.assign(options, stringifyOptions);
|
|
265
|
+
const stack = [];
|
|
266
|
+
const keys = [];
|
|
267
|
+
return JSON.stringify(
|
|
268
|
+
obj,
|
|
269
|
+
function(key, value) {
|
|
270
|
+
if (stack.length > 0) {
|
|
271
|
+
const thisPos = stack.indexOf(this);
|
|
272
|
+
~thisPos ? stack.splice(thisPos + 1) : stack.push(this);
|
|
273
|
+
~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key);
|
|
274
|
+
if (~stack.indexOf(value)) {
|
|
275
|
+
if (stack[0] === value) {
|
|
276
|
+
value = "[Circular ~]";
|
|
277
|
+
} else {
|
|
278
|
+
value = "[Circular ~." + keys.slice(0, stack.indexOf(value)).join(".") + "]";
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
} else {
|
|
282
|
+
stack.push(value);
|
|
283
|
+
}
|
|
284
|
+
if (value === null) return value;
|
|
285
|
+
if (value === void 0) return "undefined";
|
|
286
|
+
if (shouldIgnore(value)) {
|
|
287
|
+
return toString(value);
|
|
288
|
+
}
|
|
289
|
+
if (typeof value === "bigint") {
|
|
290
|
+
return value.toString() + "n";
|
|
291
|
+
}
|
|
292
|
+
if (value instanceof Event) {
|
|
293
|
+
const eventResult = {};
|
|
294
|
+
for (const eventKey in value) {
|
|
295
|
+
const eventValue = value[eventKey];
|
|
296
|
+
if (Array.isArray(eventValue)) {
|
|
297
|
+
eventResult[eventKey] = pathToSelector(
|
|
298
|
+
eventValue.length ? eventValue[0] : null
|
|
299
|
+
);
|
|
300
|
+
} else {
|
|
301
|
+
eventResult[eventKey] = eventValue;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
return eventResult;
|
|
305
|
+
} else if (value instanceof Node) {
|
|
306
|
+
if (value instanceof HTMLElement) {
|
|
307
|
+
return value ? value.outerHTML : "";
|
|
308
|
+
}
|
|
309
|
+
return value.nodeName;
|
|
310
|
+
} else if (value instanceof Error) {
|
|
311
|
+
return value.stack ? value.stack + "\nEnd of stack for Error object" : value.name + ": " + value.message;
|
|
312
|
+
}
|
|
313
|
+
return value;
|
|
314
|
+
}
|
|
315
|
+
);
|
|
316
|
+
function shouldIgnore(_obj) {
|
|
317
|
+
if (isObject(_obj) && Object.keys(_obj).length > options.numOfKeysLimit) {
|
|
318
|
+
return true;
|
|
319
|
+
}
|
|
320
|
+
if (typeof _obj === "function") {
|
|
321
|
+
return true;
|
|
322
|
+
}
|
|
323
|
+
if (isObject(_obj) && isObjTooDeep(_obj, options.depthOfLimit)) {
|
|
324
|
+
return true;
|
|
325
|
+
}
|
|
326
|
+
return false;
|
|
327
|
+
}
|
|
328
|
+
function toString(_obj) {
|
|
329
|
+
let str = _obj.toString();
|
|
330
|
+
if (options.stringLengthLimit && str.length > options.stringLengthLimit) {
|
|
331
|
+
str = `${str.slice(0, options.stringLengthLimit)}...`;
|
|
332
|
+
}
|
|
333
|
+
return str;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
const defaultLogOptions = {
|
|
337
|
+
level: [
|
|
338
|
+
"assert",
|
|
339
|
+
"clear",
|
|
340
|
+
"count",
|
|
341
|
+
"countReset",
|
|
342
|
+
"debug",
|
|
343
|
+
"dir",
|
|
344
|
+
"dirxml",
|
|
345
|
+
"error",
|
|
346
|
+
"group",
|
|
347
|
+
"groupCollapsed",
|
|
348
|
+
"groupEnd",
|
|
349
|
+
"info",
|
|
350
|
+
"log",
|
|
351
|
+
"table",
|
|
352
|
+
"time",
|
|
353
|
+
"timeEnd",
|
|
354
|
+
"timeLog",
|
|
355
|
+
"trace",
|
|
356
|
+
"warn"
|
|
357
|
+
],
|
|
358
|
+
lengthThreshold: 1e3,
|
|
359
|
+
logger: "console"
|
|
360
|
+
};
|
|
361
|
+
function initLogObserver(cb, win, options) {
|
|
362
|
+
const logOptions = options ? Object.assign({}, defaultLogOptions, options) : defaultLogOptions;
|
|
363
|
+
const loggerType = logOptions.logger;
|
|
364
|
+
if (!loggerType) {
|
|
365
|
+
return () => {
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
let logger;
|
|
369
|
+
if (typeof loggerType === "string") {
|
|
370
|
+
logger = win[loggerType];
|
|
371
|
+
} else {
|
|
372
|
+
logger = loggerType;
|
|
373
|
+
}
|
|
374
|
+
let logCount = 0;
|
|
375
|
+
let inStack = false;
|
|
376
|
+
const cancelHandlers = [];
|
|
377
|
+
if (logOptions.level.includes("error")) {
|
|
378
|
+
const errorHandler = (event) => {
|
|
379
|
+
const message = event.message, error = event.error;
|
|
380
|
+
const trace = ErrorStackParser.parse(error).map(
|
|
381
|
+
(stackFrame) => stackFrame.toString()
|
|
382
|
+
);
|
|
383
|
+
const payload = [stringify(message, logOptions.stringifyOptions)];
|
|
384
|
+
cb({
|
|
385
|
+
level: "error",
|
|
386
|
+
trace,
|
|
387
|
+
payload
|
|
388
|
+
});
|
|
389
|
+
};
|
|
390
|
+
win.addEventListener("error", errorHandler);
|
|
391
|
+
cancelHandlers.push(() => {
|
|
392
|
+
win.removeEventListener("error", errorHandler);
|
|
393
|
+
});
|
|
394
|
+
const unhandledrejectionHandler = (event) => {
|
|
395
|
+
let error;
|
|
396
|
+
let payload;
|
|
397
|
+
if (event.reason instanceof Error) {
|
|
398
|
+
error = event.reason;
|
|
399
|
+
payload = [
|
|
400
|
+
stringify(
|
|
401
|
+
`Uncaught (in promise) ${error.name}: ${error.message}`,
|
|
402
|
+
logOptions.stringifyOptions
|
|
403
|
+
)
|
|
404
|
+
];
|
|
405
|
+
} else {
|
|
406
|
+
error = new Error();
|
|
407
|
+
payload = [
|
|
408
|
+
stringify("Uncaught (in promise)", logOptions.stringifyOptions),
|
|
409
|
+
stringify(event.reason, logOptions.stringifyOptions)
|
|
410
|
+
];
|
|
411
|
+
}
|
|
412
|
+
const trace = ErrorStackParser.parse(error).map(
|
|
413
|
+
(stackFrame) => stackFrame.toString()
|
|
414
|
+
);
|
|
415
|
+
cb({
|
|
416
|
+
level: "error",
|
|
417
|
+
trace,
|
|
418
|
+
payload
|
|
419
|
+
});
|
|
420
|
+
};
|
|
421
|
+
win.addEventListener("unhandledrejection", unhandledrejectionHandler);
|
|
422
|
+
cancelHandlers.push(() => {
|
|
423
|
+
win.removeEventListener("unhandledrejection", unhandledrejectionHandler);
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
for (const levelType of logOptions.level) {
|
|
427
|
+
cancelHandlers.push(replace(logger, levelType));
|
|
428
|
+
}
|
|
429
|
+
return () => {
|
|
430
|
+
cancelHandlers.forEach((h) => h());
|
|
431
|
+
};
|
|
432
|
+
function replace(_logger, level) {
|
|
433
|
+
if (!_logger[level]) {
|
|
434
|
+
return () => {
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
return patch(
|
|
438
|
+
_logger,
|
|
439
|
+
level,
|
|
440
|
+
(original) => {
|
|
441
|
+
return (...args) => {
|
|
442
|
+
original.apply(this, args);
|
|
443
|
+
if (level === "assert" && !!args[0]) {
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
if (inStack) {
|
|
447
|
+
return;
|
|
448
|
+
}
|
|
449
|
+
inStack = true;
|
|
450
|
+
try {
|
|
451
|
+
const trace = ErrorStackParser.parse(new Error()).map((stackFrame) => stackFrame.toString()).splice(1);
|
|
452
|
+
const argsForPayload = level === "assert" ? args.slice(1) : args;
|
|
453
|
+
const payload = argsForPayload.map(
|
|
454
|
+
(s) => stringify(s, logOptions.stringifyOptions)
|
|
455
|
+
);
|
|
456
|
+
logCount++;
|
|
457
|
+
if (logCount < logOptions.lengthThreshold) {
|
|
458
|
+
cb({
|
|
459
|
+
level,
|
|
460
|
+
trace,
|
|
461
|
+
payload
|
|
462
|
+
});
|
|
463
|
+
} else if (logCount === logOptions.lengthThreshold) {
|
|
464
|
+
cb({
|
|
465
|
+
level: "warn",
|
|
466
|
+
trace: [],
|
|
467
|
+
payload: [
|
|
468
|
+
stringify("The number of log records reached the threshold.")
|
|
469
|
+
]
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
} catch (error) {
|
|
473
|
+
original("rrweb logger error:", error, ...args);
|
|
474
|
+
} finally {
|
|
475
|
+
inStack = false;
|
|
476
|
+
}
|
|
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
|
|
487
|
+
});
|
|
488
|
+
exports.PLUGIN_NAME = PLUGIN_NAME;
|
|
489
|
+
exports.getRecordConsolePlugin = getRecordConsolePlugin;
|
|
490
|
+
//# sourceMappingURL=rrweb-plugin-console-record.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rrweb-plugin-console-record.cjs","sources":["../../../utils/dist/utils.js","../src/error-stack-parser.ts","../src/stringify.ts","../src/index.ts"],"sourcesContent":["const testableAccessors = {\n Node: [\"childNodes\", \"parentNode\", \"parentElement\", \"textContent\"],\n ShadowRoot: [\"host\", \"styleSheets\"],\n Element: [\"shadowRoot\", \"querySelector\", \"querySelectorAll\"],\n MutationObserver: []\n};\nconst testableMethods = {\n Node: [\"contains\", \"getRootNode\"],\n ShadowRoot: [\"getSelection\"],\n Element: [],\n MutationObserver: [\"constructor\"]\n};\nconst untaintedBasePrototype = {};\nconst isAngularZonePresent = () => {\n return !!globalThis.Zone;\n};\nfunction getUntaintedPrototype(key) {\n if (untaintedBasePrototype[key])\n return untaintedBasePrototype[key];\n const defaultObj = globalThis[key];\n const defaultPrototype = defaultObj.prototype;\n const accessorNames = key in testableAccessors ? testableAccessors[key] : void 0;\n const isUntaintedAccessors = Boolean(\n accessorNames && // @ts-expect-error 2345\n accessorNames.every(\n (accessor) => {\n var _a, _b;\n return Boolean(\n (_b = (_a = Object.getOwnPropertyDescriptor(defaultPrototype, accessor)) == null ? void 0 : _a.get) == null ? void 0 : _b.toString().includes(\"[native code]\")\n );\n }\n )\n );\n const methodNames = key in testableMethods ? testableMethods[key] : void 0;\n const isUntaintedMethods = Boolean(\n methodNames && methodNames.every(\n // @ts-expect-error 2345\n (method) => {\n var _a;\n return typeof defaultPrototype[method] === \"function\" && ((_a = defaultPrototype[method]) == null ? void 0 : _a.toString().includes(\"[native code]\"));\n }\n )\n );\n if (isUntaintedAccessors && isUntaintedMethods && !isAngularZonePresent()) {\n untaintedBasePrototype[key] = defaultObj.prototype;\n return defaultObj.prototype;\n }\n try {\n const iframeEl = document.createElement(\"iframe\");\n document.body.appendChild(iframeEl);\n const win = iframeEl.contentWindow;\n if (!win) return defaultObj.prototype;\n const untaintedObject = win[key].prototype;\n document.body.removeChild(iframeEl);\n if (!untaintedObject) return defaultPrototype;\n return untaintedBasePrototype[key] = untaintedObject;\n } catch {\n return defaultPrototype;\n }\n}\nconst untaintedAccessorCache = {};\nfunction getUntaintedAccessor(key, instance, accessor) {\n var _a;\n const cacheKey = `${key}.${String(accessor)}`;\n if (untaintedAccessorCache[cacheKey])\n return untaintedAccessorCache[cacheKey].call(\n instance\n );\n const untaintedPrototype = getUntaintedPrototype(key);\n const untaintedAccessor = (_a = Object.getOwnPropertyDescriptor(\n untaintedPrototype,\n accessor\n )) == null ? void 0 : _a.get;\n if (!untaintedAccessor) return instance[accessor];\n untaintedAccessorCache[cacheKey] = untaintedAccessor;\n return untaintedAccessor.call(instance);\n}\nconst untaintedMethodCache = {};\nfunction getUntaintedMethod(key, instance, method) {\n const cacheKey = `${key}.${String(method)}`;\n if (untaintedMethodCache[cacheKey])\n return untaintedMethodCache[cacheKey].bind(\n instance\n );\n const untaintedPrototype = getUntaintedPrototype(key);\n const untaintedMethod = untaintedPrototype[method];\n if (typeof untaintedMethod !== \"function\") return instance[method];\n untaintedMethodCache[cacheKey] = untaintedMethod;\n return untaintedMethod.bind(instance);\n}\nfunction childNodes(n) {\n return getUntaintedAccessor(\"Node\", n, \"childNodes\");\n}\nfunction parentNode(n) {\n return getUntaintedAccessor(\"Node\", n, \"parentNode\");\n}\nfunction parentElement(n) {\n return getUntaintedAccessor(\"Node\", n, \"parentElement\");\n}\nfunction textContent(n) {\n return getUntaintedAccessor(\"Node\", n, \"textContent\");\n}\nfunction contains(n, other) {\n return getUntaintedMethod(\"Node\", n, \"contains\")(other);\n}\nfunction getRootNode(n) {\n return getUntaintedMethod(\"Node\", n, \"getRootNode\")();\n}\nfunction host(n) {\n if (!n || !(\"host\" in n)) return null;\n return getUntaintedAccessor(\"ShadowRoot\", n, \"host\");\n}\nfunction styleSheets(n) {\n return n.styleSheets;\n}\nfunction shadowRoot(n) {\n if (!n || !(\"shadowRoot\" in n)) return null;\n return getUntaintedAccessor(\"Element\", n, \"shadowRoot\");\n}\nfunction querySelector(n, selectors) {\n return getUntaintedAccessor(\"Element\", n, \"querySelector\")(selectors);\n}\nfunction querySelectorAll(n, selectors) {\n return getUntaintedAccessor(\"Element\", n, \"querySelectorAll\")(selectors);\n}\nfunction mutationObserverCtor() {\n return getUntaintedPrototype(\"MutationObserver\").constructor;\n}\nfunction patch(source, name, replacement) {\n try {\n if (!(name in source)) {\n return () => {\n };\n }\n const original = source[name];\n const wrapped = replacement(original);\n if (typeof wrapped === \"function\") {\n wrapped.prototype = wrapped.prototype || {};\n Object.defineProperties(wrapped, {\n __rrweb_original__: {\n enumerable: false,\n value: original\n }\n });\n }\n source[name] = wrapped;\n return () => {\n source[name] = original;\n };\n } catch {\n return () => {\n };\n }\n}\nconst index = {\n childNodes,\n parentNode,\n parentElement,\n textContent,\n contains,\n getRootNode,\n host,\n styleSheets,\n shadowRoot,\n querySelector,\n querySelectorAll,\n mutationObserver: mutationObserverCtor,\n patch\n};\nexport {\n childNodes,\n contains,\n index as default,\n getRootNode,\n getUntaintedAccessor,\n getUntaintedMethod,\n getUntaintedPrototype,\n host,\n isAngularZonePresent,\n mutationObserverCtor,\n parentElement,\n parentNode,\n patch,\n querySelector,\n querySelectorAll,\n shadowRoot,\n styleSheets,\n textContent\n};\n//# sourceMappingURL=utils.js.map\n","/* eslint-disable @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return */\n/**\n * Class StackFrame is a fork of https://github.com/stacktracejs/stackframe/blob/master/stackframe.js\n * I fork it because:\n * 1. There are some build issues when importing this package.\n * 2. Rewrites into typescript give us a better type interface.\n * 3. StackFrame contains some functions we don't need.\n */\nexport class StackFrame {\n private fileName: string;\n private functionName: string;\n private lineNumber?: number;\n private columnNumber?: number;\n\n constructor(obj: {\n fileName?: string;\n functionName?: string;\n lineNumber?: number;\n columnNumber?: number;\n }) {\n this.fileName = obj.fileName || '';\n this.functionName = obj.functionName || '';\n this.lineNumber = obj.lineNumber;\n this.columnNumber = obj.columnNumber;\n }\n\n toString() {\n const lineNumber = this.lineNumber || '';\n const columnNumber = this.columnNumber || '';\n if (this.functionName)\n return `${this.functionName} (${this.fileName}:${lineNumber}:${columnNumber})`;\n return `${this.fileName}:${lineNumber}:${columnNumber}`;\n }\n}\n\n/**\n * ErrorStackParser is a fork of https://github.com/stacktracejs/error-stack-parser/blob/master/error-stack-parser.js\n * I fork it because:\n * 1. There are some build issues when importing this package.\n * 2. Rewrites into typescript give us a better type interface.\n */\nconst FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\\S+:\\d+/;\nconst CHROME_IE_STACK_REGEXP = /^\\s*at .*(\\S+:\\d+|\\(native\\))/m;\nconst SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\\[native code])?$/;\nexport const ErrorStackParser = {\n /**\n * Given an Error object, extract the most information from it.\n */\n parse: function (error: Error): StackFrame[] {\n // https://github.com/rrweb-io/rrweb/issues/782\n if (!error) {\n return [];\n }\n if (\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n typeof error.stacktrace !== 'undefined' ||\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n typeof error['opera#sourceloc'] !== 'undefined'\n ) {\n return this.parseOpera(\n error as {\n stacktrace?: string;\n message: string;\n stack?: string;\n },\n );\n } else if (error.stack && error.stack.match(CHROME_IE_STACK_REGEXP)) {\n return this.parseV8OrIE(error as { stack: string });\n } else if (error.stack) {\n return this.parseFFOrSafari(error as { stack: string });\n } else {\n console.warn(\n '[console-record-plugin]: Failed to parse error object:',\n error,\n );\n return [];\n }\n },\n // Separate line and column numbers from a string of the form: (URI:Line:Column)\n extractLocation: function (urlLike: string) {\n // Fail-fast but return locations like \"(native)\"\n if (urlLike.indexOf(':') === -1) {\n return [urlLike];\n }\n\n const regExp = /(.+?)(?::(\\d+))?(?::(\\d+))?$/;\n const parts = regExp.exec(urlLike.replace(/[()]/g, ''));\n if (!parts) throw new Error(`Cannot parse given url: ${urlLike}`);\n return [parts[1], parts[2] || undefined, parts[3] || undefined];\n },\n parseV8OrIE: function (error: { stack: string }) {\n const filtered = error.stack.split('\\n').filter(function (line) {\n return !!line.match(CHROME_IE_STACK_REGEXP);\n }, this);\n\n return filtered.map(function (line) {\n if (line.indexOf('(eval ') > -1) {\n // Throw away eval information until we implement stacktrace.js/stackframe#8\n line = line\n .replace(/eval code/g, 'eval')\n .replace(/(\\(eval at [^()]*)|(\\),.*$)/g, '');\n }\n let sanitizedLine = line.replace(/^\\s+/, '').replace(/\\(eval code/g, '(');\n\n // capture and preseve the parenthesized location \"(/foo/my bar.js:12:87)\" in\n // case it has spaces in it, as the string is split on \\s+ later on\n const location = sanitizedLine.match(/ (\\((.+):(\\d+):(\\d+)\\)$)/);\n\n // remove the parenthesized location from the line, if it was matched\n sanitizedLine = location\n ? sanitizedLine.replace(location[0], '')\n : sanitizedLine;\n\n const tokens = sanitizedLine.split(/\\s+/).slice(1);\n // if a location was matched, pass it to extractLocation() otherwise pop the last token\n const locationParts = this.extractLocation(\n location ? location[1] : tokens.pop(),\n );\n const functionName = tokens.join(' ') || undefined;\n const fileName =\n ['eval', '<anonymous>'].indexOf(locationParts[0]) > -1\n ? undefined\n : locationParts[0];\n\n return new StackFrame({\n functionName,\n fileName,\n lineNumber: locationParts[1],\n columnNumber: locationParts[2],\n });\n }, this);\n },\n parseFFOrSafari: function (error: { stack: string }) {\n const filtered = error.stack.split('\\n').filter(function (line) {\n return !line.match(SAFARI_NATIVE_CODE_REGEXP);\n }, this);\n\n return filtered.map(function (line) {\n // Throw away eval information until we implement stacktrace.js/stackframe#8\n if (line.indexOf(' > eval') > -1) {\n line = line.replace(\n / line (\\d+)(?: > eval line \\d+)* > eval:\\d+:\\d+/g,\n ':$1',\n );\n }\n\n if (line.indexOf('@') === -1 && line.indexOf(':') === -1) {\n // Safari eval frames only have function names and nothing else\n return new StackFrame({\n functionName: line,\n });\n } else {\n const functionNameRegex = /((.*\".+\"[^@]*)?[^@]*)(?:@)/;\n const matches = line.match(functionNameRegex);\n const functionName = matches && matches[1] ? matches[1] : undefined;\n const locationParts = this.extractLocation(\n line.replace(functionNameRegex, ''),\n );\n\n return new StackFrame({\n functionName,\n fileName: locationParts[0],\n lineNumber: locationParts[1],\n columnNumber: locationParts[2],\n });\n }\n }, this);\n },\n parseOpera: function (e: {\n stacktrace?: string;\n message: string;\n stack?: string;\n }): StackFrame[] {\n if (\n !e.stacktrace ||\n (e.message.indexOf('\\n') > -1 &&\n e.message.split('\\n').length > e.stacktrace.split('\\n').length)\n ) {\n return this.parseOpera9(e as { message: string });\n } else if (!e.stack) {\n return this.parseOpera10(e as { stacktrace: string });\n } else {\n return this.parseOpera11(e as { stack: string });\n }\n },\n parseOpera9: function (e: { message: string }) {\n const lineRE = /Line (\\d+).*script (?:in )?(\\S+)/i;\n const lines = e.message.split('\\n');\n const result = [];\n\n for (let i = 2, len = lines.length; i < len; i += 2) {\n const match = lineRE.exec(lines[i]);\n if (match) {\n result.push(\n new StackFrame({\n fileName: match[2],\n lineNumber: parseFloat(match[1]),\n }),\n );\n }\n }\n\n return result;\n },\n parseOpera10: function (e: { stacktrace: string }) {\n const lineRE = /Line (\\d+).*script (?:in )?(\\S+)(?:: In function (\\S+))?$/i;\n const lines = e.stacktrace.split('\\n');\n const result = [];\n\n for (let i = 0, len = lines.length; i < len; i += 2) {\n const match = lineRE.exec(lines[i]);\n if (match) {\n result.push(\n new StackFrame({\n functionName: match[3] || undefined,\n fileName: match[2],\n lineNumber: parseFloat(match[1]),\n }),\n );\n }\n }\n\n return result;\n },\n // Opera 10.65+ Error.stack very similar to FF/Safari\n parseOpera11: function (error: { stack: string }) {\n const filtered = error.stack.split('\\n').filter(function (line) {\n return (\n !!line.match(FIREFOX_SAFARI_STACK_REGEXP) &&\n !line.match(/^Error created at/)\n );\n }, this);\n\n return filtered.map(function (line: string) {\n const tokens = line.split('@');\n const locationParts = this.extractLocation(tokens.pop());\n const functionCall = tokens.shift() || '';\n const functionName =\n functionCall\n .replace(/<anonymous function(: (\\w+))?>/, '$2')\n .replace(/\\([^)]*\\)/g, '') || undefined;\n return new StackFrame({\n functionName,\n fileName: locationParts[0],\n lineNumber: locationParts[1],\n columnNumber: locationParts[2],\n });\n }, this);\n },\n};\n","/**\n * this file is used to serialize log message to string\n *\n */\n\nimport type { StringifyOptions } from './index';\n\n/**\n * transfer the node path in Event to string\n * @param node - the first node in a node path array\n */\nfunction pathToSelector(node: HTMLElement): string | '' {\n if (!node || !node.outerHTML) {\n return '';\n }\n\n let path = '';\n while (node.parentElement) {\n let name = node.localName;\n if (!name) {\n break;\n }\n name = name.toLowerCase();\n const parent = node.parentElement;\n\n const domSiblings = [];\n\n if (parent.children && parent.children.length > 0) {\n for (let i = 0; i < parent.children.length; i++) {\n const sibling = parent.children[i];\n if (sibling.localName && sibling.localName.toLowerCase) {\n if (sibling.localName.toLowerCase() === name) {\n domSiblings.push(sibling);\n }\n }\n }\n }\n\n if (domSiblings.length > 1) {\n name += `:eq(${domSiblings.indexOf(node)})`;\n }\n path = name + (path ? '>' + path : '');\n node = parent;\n }\n\n return path;\n}\n\n/**\n * judge is object\n */\nfunction isObject(obj: unknown): boolean {\n return Object.prototype.toString.call(obj) === '[object Object]';\n}\n\n/**\n * judge the object's depth\n */\nfunction isObjTooDeep(obj: Record<string, unknown>, limit: number): boolean {\n if (limit === 0) {\n return true;\n }\n\n const keys = Object.keys(obj);\n for (const key of keys) {\n if (\n isObject(obj[key]) &&\n isObjTooDeep(obj[key] as Record<string, unknown>, limit - 1)\n ) {\n return true;\n }\n }\n\n return false;\n}\n\n/**\n * stringify any js object\n * @param obj - the object to stringify\n */\nexport function stringify(\n obj: unknown,\n stringifyOptions?: StringifyOptions,\n): string {\n const options: StringifyOptions = {\n numOfKeysLimit: 50,\n depthOfLimit: 4,\n };\n Object.assign(options, stringifyOptions);\n const stack: unknown[] = [];\n const keys: unknown[] = [];\n return JSON.stringify(\n obj,\n function (key, value: string | bigint | object | null | undefined) {\n /**\n * forked from https://github.com/moll/json-stringify-safe/blob/master/stringify.js\n * to deCycle the object\n */\n if (stack.length > 0) {\n const thisPos = stack.indexOf(this);\n ~thisPos ? stack.splice(thisPos + 1) : stack.push(this);\n ~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key);\n if (~stack.indexOf(value)) {\n if (stack[0] === value) {\n value = '[Circular ~]';\n } else {\n value =\n '[Circular ~.' +\n keys.slice(0, stack.indexOf(value)).join('.') +\n ']';\n }\n }\n } else {\n stack.push(value);\n }\n /* END of the FORK */\n\n if (value === null) return value;\n if (value === undefined) return 'undefined';\n if (shouldIgnore(value as object)) {\n return toString(value as object);\n }\n if (typeof value === 'bigint') {\n return value.toString() + 'n';\n }\n if (value instanceof Event) {\n const eventResult: Record<string, unknown> = {};\n for (const eventKey in value) {\n const eventValue = (value as unknown as Record<string, unknown>)[\n eventKey\n ];\n if (Array.isArray(eventValue)) {\n eventResult[eventKey] = pathToSelector(\n (eventValue.length ? eventValue[0] : null) as HTMLElement,\n );\n } else {\n eventResult[eventKey] = eventValue;\n }\n }\n return eventResult;\n } else if (value instanceof Node) {\n if (value instanceof HTMLElement) {\n return value ? value.outerHTML : '';\n }\n return value.nodeName;\n } else if (value instanceof Error) {\n return value.stack\n ? value.stack + '\\nEnd of stack for Error object'\n : value.name + ': ' + value.message;\n }\n return value;\n },\n );\n\n /**\n * whether we should ignore obj's info and call toString() function instead\n */\n function shouldIgnore(_obj: object): boolean {\n // outof keys limit\n if (isObject(_obj) && Object.keys(_obj).length > options.numOfKeysLimit) {\n return true;\n }\n\n // is function or bigint\n if (typeof _obj === 'function') {\n return true;\n }\n\n /**\n * judge object's depth to avoid browser's OOM\n *\n * issues: https://github.com/rrweb-io/rrweb/issues/653\n */\n if (\n isObject(_obj) &&\n isObjTooDeep(_obj as Record<string, unknown>, options.depthOfLimit)\n ) {\n return true;\n }\n\n return false;\n }\n\n /**\n * limit the toString() result according to option\n */\n function toString(_obj: object): string {\n let str = _obj.toString();\n if (options.stringLengthLimit && str.length > options.stringLengthLimit) {\n str = `${str.slice(0, options.stringLengthLimit)}...`;\n }\n return str;\n }\n}\n","import type { listenerHandler, RecordPlugin, IWindow } from '@betterbugs/types';\nimport { patch } from '@betterbugs/utils';\nimport { ErrorStackParser, StackFrame } from './error-stack-parser';\nimport { stringify } from './stringify';\n\nexport type StringifyOptions = {\n // limit of string length\n stringLengthLimit?: number;\n /**\n * limit of number of keys in an object\n * if an object contains more keys than this limit, we would call its toString function directly\n */\n numOfKeysLimit: number;\n /**\n * limit number of depth in an object\n * if an object is too deep, toString process may cause browser OOM\n */\n depthOfLimit: number;\n};\n\ntype LogRecordOptions = {\n level?: LogLevel[];\n lengthThreshold?: number;\n stringifyOptions?: StringifyOptions;\n logger?: Logger | 'console';\n};\n\nconst defaultLogOptions: LogRecordOptions = {\n level: [\n 'assert',\n 'clear',\n 'count',\n 'countReset',\n 'debug',\n 'dir',\n 'dirxml',\n 'error',\n 'group',\n 'groupCollapsed',\n 'groupEnd',\n 'info',\n 'log',\n 'table',\n 'time',\n 'timeEnd',\n 'timeLog',\n 'trace',\n 'warn',\n ],\n lengthThreshold: 1000,\n logger: 'console',\n};\n\nexport type LogData = {\n level: LogLevel;\n trace: string[];\n payload: string[];\n};\n\ntype logCallback = (p: LogData) => void;\n\n/* fork from interface Console */\n// all kinds of console functions\nexport type Logger = {\n assert?: typeof console.assert;\n clear?: typeof console.clear;\n count?: typeof console.count;\n countReset?: typeof console.countReset;\n debug?: typeof console.debug;\n dir?: typeof console.dir;\n dirxml?: typeof console.dirxml;\n error?: typeof console.error;\n group?: typeof console.group;\n groupCollapsed?: typeof console.groupCollapsed;\n groupEnd?: () => void;\n info?: typeof console.info;\n log?: typeof console.log;\n table?: typeof console.table;\n time?: typeof console.time;\n timeEnd?: typeof console.timeEnd;\n timeLog?: typeof console.timeLog;\n trace?: typeof console.trace;\n warn?: typeof console.warn;\n};\n\nexport type LogLevel = keyof Logger;\n\nfunction initLogObserver(\n cb: logCallback,\n win: IWindow, // top window or in an iframe\n options: LogRecordOptions,\n): listenerHandler {\n const logOptions = (\n options ? Object.assign({}, defaultLogOptions, options) : defaultLogOptions\n ) as {\n level: LogLevel[];\n lengthThreshold: number;\n stringifyOptions?: StringifyOptions;\n logger: Logger | 'console';\n };\n const loggerType = logOptions.logger;\n if (!loggerType) {\n return () => {\n //\n };\n }\n let logger: Logger;\n if (typeof loggerType === 'string') {\n logger = win[loggerType];\n } else {\n logger = loggerType;\n }\n let logCount = 0;\n let inStack = false;\n const cancelHandlers: listenerHandler[] = [];\n // add listener to thrown errors\n if (logOptions.level.includes('error')) {\n const errorHandler = (event: ErrorEvent) => {\n const message = event.message,\n error = event.error as Error;\n const trace: string[] = ErrorStackParser.parse(error).map(\n (stackFrame: StackFrame) => stackFrame.toString(),\n );\n const payload = [stringify(message, logOptions.stringifyOptions)];\n cb({\n level: 'error',\n trace,\n payload,\n });\n };\n win.addEventListener('error', errorHandler);\n cancelHandlers.push(() => {\n win.removeEventListener('error', errorHandler);\n });\n const unhandledrejectionHandler = (event: PromiseRejectionEvent) => {\n let error: Error;\n let payload: string[];\n if (event.reason instanceof Error) {\n error = event.reason;\n payload = [\n stringify(\n `Uncaught (in promise) ${error.name}: ${error.message}`,\n logOptions.stringifyOptions,\n ),\n ];\n } else {\n error = new Error();\n payload = [\n stringify('Uncaught (in promise)', logOptions.stringifyOptions),\n stringify(event.reason, logOptions.stringifyOptions),\n ];\n }\n const trace: string[] = ErrorStackParser.parse(error).map(\n (stackFrame: StackFrame) => stackFrame.toString(),\n );\n cb({\n level: 'error',\n trace,\n payload,\n });\n };\n win.addEventListener('unhandledrejection', unhandledrejectionHandler);\n cancelHandlers.push(() => {\n win.removeEventListener('unhandledrejection', unhandledrejectionHandler);\n });\n }\n for (const levelType of logOptions.level) {\n cancelHandlers.push(replace(logger, levelType));\n }\n return () => {\n cancelHandlers.forEach((h) => h());\n };\n\n /**\n * replace the original console function and record logs\n * @param logger - the logger object such as Console\n * @param level - the name of log function to be replaced\n */\n function replace(_logger: Logger, level: LogLevel) {\n if (!_logger[level]) {\n return () => {\n //\n };\n }\n // replace the logger.{level}. return a restore function\n return patch(\n _logger,\n level,\n (original: (...args: Array<unknown>) => void) => {\n return (...args: Array<unknown>) => {\n original.apply(this, args);\n\n if (level === 'assert' && !!args[0]) {\n // assert does not log if the first argument evaluates to true\n return;\n }\n\n if (inStack) {\n // If we are already in a stack this means something from the following code is calling a console method\n // likely a proxy method called from stringify. We don't want to log this as it will cause an infinite loop\n return;\n }\n inStack = true;\n try {\n const trace = ErrorStackParser.parse(new Error())\n .map((stackFrame: StackFrame) => stackFrame.toString())\n .splice(1); // splice(1) to omit the hijacked log function\n\n // assert does not log its first arg, that's only used for deciding whether to log\n const argsForPayload = level === 'assert' ? args.slice(1) : args;\n\n const payload = argsForPayload.map((s) =>\n stringify(s, logOptions.stringifyOptions),\n );\n logCount++;\n if (logCount < logOptions.lengthThreshold) {\n cb({\n level,\n trace,\n payload,\n });\n } else if (logCount === logOptions.lengthThreshold) {\n // notify the user\n cb({\n level: 'warn',\n trace: [],\n payload: [\n stringify('The number of log records reached the threshold.'),\n ],\n });\n }\n } catch (error) {\n original('rrweb logger error:', error, ...args);\n } finally {\n inStack = false;\n }\n };\n },\n );\n }\n}\n\nexport const PLUGIN_NAME = 'rrweb/console@1';\n\nexport const getRecordConsolePlugin: (\n options?: LogRecordOptions,\n) => RecordPlugin = (options) => ({\n name: PLUGIN_NAME,\n observer: initLogObserver,\n options: options,\n});\n"],"names":[],"mappings":";;;;;AAgIA,SAAS,MAAM,QAAQ,MAAM,aAAa;AACxC,MAAI;AACF,QAAI,EAAE,QAAQ,SAAS;AACrB,aAAO,MAAM;AAAA,MACnB;AAAA,IACK;AACD,UAAM,WAAW,OAAO,IAAI;AAC5B,UAAM,UAAU,YAAY,QAAQ;AACpC,QAAI,OAAO,YAAY,YAAY;AACjC,cAAQ,YAAY,QAAQ,aAAa,CAAA;AACzC,aAAO,iBAAiB,SAAS;AAAA,QAC/B,oBAAoB;AAAA,UAClB,YAAY;AAAA,UACZ,OAAO;AAAA,QACR;AAAA,MACT,CAAO;AAAA,IACF;AACD,WAAO,IAAI,IAAI;AACf,WAAO,MAAM;AACX,aAAO,IAAI,IAAI;AAAA,IACrB;AAAA,EACA,QAAU;AACN,WAAO,MAAM;AAAA,IACjB;AAAA,EACG;AACH;ACjJO,MAAM,WAAW;AAAA,EAMtB,YAAY,KAKT;AAVK;AACA;AACA;AACA;AAQD,SAAA,WAAW,IAAI,YAAY;AAC3B,SAAA,eAAe,IAAI,gBAAgB;AACxC,SAAK,aAAa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