error-monitor-web 1.0.0
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/LICENSE +21 -0
- package/README.md +323 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +89 -0
- package/dist/index.mjs +567 -0
- package/dist/index.mjs.map +1 -0
- package/dist/index.umd.js +2 -0
- package/dist/index.umd.js.map +1 -0
- package/package.json +52 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,567 @@
|
|
|
1
|
+
function g() {
|
|
2
|
+
return `${Date.now()}-${Math.random().toString(36).substring(2, 15)}`;
|
|
3
|
+
}
|
|
4
|
+
function d() {
|
|
5
|
+
return `${Date.now()}-${Math.random().toString(36).substring(2, 15)}`;
|
|
6
|
+
}
|
|
7
|
+
class p {
|
|
8
|
+
constructor(e) {
|
|
9
|
+
this.isInitialized = !1, this.breadcrumbs = [], this.maxBreadcrumbs = 50, this.plugins = [], this.sessionId = g(), this.config = {
|
|
10
|
+
autoCapture: {
|
|
11
|
+
js: !0,
|
|
12
|
+
promise: !0,
|
|
13
|
+
network: !0,
|
|
14
|
+
resource: !0,
|
|
15
|
+
console: !1
|
|
16
|
+
},
|
|
17
|
+
filter: {
|
|
18
|
+
ignoreErrors: [],
|
|
19
|
+
ignoreUrls: [],
|
|
20
|
+
minLevel: "info"
|
|
21
|
+
},
|
|
22
|
+
report: {
|
|
23
|
+
delay: 1e3,
|
|
24
|
+
batchSize: 10
|
|
25
|
+
},
|
|
26
|
+
sampleRate: 1,
|
|
27
|
+
errorSampleRate: 1,
|
|
28
|
+
enabled: !0,
|
|
29
|
+
debug: !1,
|
|
30
|
+
...e
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* 更新配置
|
|
35
|
+
*/
|
|
36
|
+
updateConfig(e) {
|
|
37
|
+
this.config = { ...this.config, ...e }, this.config.debug && console.log("[ErrorMonitor] Config updated:", this.config);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* 启用SDK
|
|
41
|
+
*/
|
|
42
|
+
enable() {
|
|
43
|
+
this.config.enabled = !0, console.log("[ErrorMonitor] SDK enabled");
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* 禁用SDK
|
|
47
|
+
*/
|
|
48
|
+
disable() {
|
|
49
|
+
this.config.enabled = !1, console.log("[ErrorMonitor] SDK disabled");
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* 添加错误过滤器
|
|
53
|
+
*/
|
|
54
|
+
addFilter(e) {
|
|
55
|
+
this.config.filter || (this.config.filter = {}), this.config.filter.ignoreErrors || (this.config.filter.ignoreErrors = []), this.config.filter.ignoreErrors.push(e);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* 移除错误过滤器
|
|
59
|
+
*/
|
|
60
|
+
removeFilter(e) {
|
|
61
|
+
var t;
|
|
62
|
+
if (!((t = this.config.filter) != null && t.ignoreErrors)) return;
|
|
63
|
+
const n = this.config.filter.ignoreErrors.indexOf(e);
|
|
64
|
+
n > -1 && this.config.filter.ignoreErrors.splice(n, 1);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* 设置采样率
|
|
68
|
+
*/
|
|
69
|
+
setSampleRate(e) {
|
|
70
|
+
this.config.sampleRate = Math.max(0, Math.min(1, e));
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* 设置错误采样率
|
|
74
|
+
*/
|
|
75
|
+
setErrorSampleRate(e) {
|
|
76
|
+
this.config.errorSampleRate = Math.max(0, Math.min(1, e));
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* 初始化监控
|
|
80
|
+
*/
|
|
81
|
+
init() {
|
|
82
|
+
if (this.isInitialized) {
|
|
83
|
+
console.warn("[ErrorMonitor] Already initialized");
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
this.isInitialized = !0, this.plugins.forEach((e) => {
|
|
87
|
+
var t;
|
|
88
|
+
(t = e.setup) == null || t.call(e, this);
|
|
89
|
+
}), console.log("[ErrorMonitor] Initialized with appId:", this.config.appId);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* 注册插件
|
|
93
|
+
*/
|
|
94
|
+
use(e) {
|
|
95
|
+
var t;
|
|
96
|
+
this.plugins.push(e), this.isInitialized && ((t = e.setup) == null || t.call(e, this));
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* 捕获错误(支持选项)
|
|
100
|
+
*/
|
|
101
|
+
capture(e, t) {
|
|
102
|
+
var n, i;
|
|
103
|
+
if (!this.isInitialized) {
|
|
104
|
+
console.warn("[ErrorMonitor] Not initialized");
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
if (this.config.enabled === !1)
|
|
108
|
+
return;
|
|
109
|
+
const o = e instanceof Error ? {
|
|
110
|
+
type: "custom",
|
|
111
|
+
message: e.message,
|
|
112
|
+
stack: e.stack,
|
|
113
|
+
context: {}
|
|
114
|
+
} : e, r = {
|
|
115
|
+
level: "error",
|
|
116
|
+
tags: {},
|
|
117
|
+
extra: {},
|
|
118
|
+
user: {},
|
|
119
|
+
skipSampling: !1,
|
|
120
|
+
skipFilter: !1,
|
|
121
|
+
...t
|
|
122
|
+
};
|
|
123
|
+
if (!r.skipFilter && this.shouldFilter(o)) {
|
|
124
|
+
this.config.debug && console.log("[ErrorMonitor] Error filtered:", o.message);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
if (!r.skipSampling && this.config.errorSampleRate !== void 0 && Math.random() > this.config.errorSampleRate)
|
|
128
|
+
return;
|
|
129
|
+
let s = o;
|
|
130
|
+
for (const l of this.plugins) {
|
|
131
|
+
const a = (n = l.beforeCapture) == null ? void 0 : n.call(l, o);
|
|
132
|
+
if (a === null)
|
|
133
|
+
return;
|
|
134
|
+
a !== void 0 && (s = a);
|
|
135
|
+
}
|
|
136
|
+
const c = {
|
|
137
|
+
appId: this.config.appId,
|
|
138
|
+
timestamp: Date.now(),
|
|
139
|
+
sessionId: this.sessionId,
|
|
140
|
+
eventId: d(),
|
|
141
|
+
type: s.type,
|
|
142
|
+
level: r.level,
|
|
143
|
+
message: s.message,
|
|
144
|
+
stack: s.stack,
|
|
145
|
+
context: {
|
|
146
|
+
userAgent: typeof navigator < "u" ? navigator.userAgent : "",
|
|
147
|
+
url: typeof location < "u" ? location.href : "",
|
|
148
|
+
viewport: {
|
|
149
|
+
width: typeof window < "u" ? window.innerWidth : 0,
|
|
150
|
+
height: typeof window < "u" ? window.innerHeight : 0
|
|
151
|
+
},
|
|
152
|
+
userId: r.user.id || this.config.userId,
|
|
153
|
+
tags: { ...this.config.tags, ...r.tags }
|
|
154
|
+
},
|
|
155
|
+
breadcrumbs: [...this.breadcrumbs],
|
|
156
|
+
extra: { ...s.context, ...r.extra }
|
|
157
|
+
};
|
|
158
|
+
for (const l of this.plugins) {
|
|
159
|
+
const a = (i = l.afterCapture) == null ? void 0 : i.call(l, c);
|
|
160
|
+
a !== void 0 && Object.assign(c, a);
|
|
161
|
+
}
|
|
162
|
+
this.report(c);
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* 检查是否应该过滤此错误
|
|
166
|
+
*/
|
|
167
|
+
shouldFilter(e) {
|
|
168
|
+
var t;
|
|
169
|
+
if (!this.config.filter) return !1;
|
|
170
|
+
const { ignoreErrors: n, ignoreUrls: i, minLevel: o } = this.config.filter;
|
|
171
|
+
if (n && n.length > 0) {
|
|
172
|
+
for (const r of n)
|
|
173
|
+
if (r.test(e.message))
|
|
174
|
+
return !0;
|
|
175
|
+
}
|
|
176
|
+
if (i && i.length > 0 && (t = e.context) != null && t.url) {
|
|
177
|
+
for (const r of i)
|
|
178
|
+
if (r.test(e.context.url))
|
|
179
|
+
return !0;
|
|
180
|
+
}
|
|
181
|
+
return !1;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* 手动上报错误(简化的API)
|
|
185
|
+
*/
|
|
186
|
+
captureError(e, t) {
|
|
187
|
+
this.capture(e, t);
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* 手动上报消息
|
|
191
|
+
*/
|
|
192
|
+
captureMessage(e, t = "info", n) {
|
|
193
|
+
this.capture({
|
|
194
|
+
type: "custom",
|
|
195
|
+
message: e,
|
|
196
|
+
context: {}
|
|
197
|
+
}, { ...n, level: t });
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* 上报错误
|
|
201
|
+
*/
|
|
202
|
+
report(e) {
|
|
203
|
+
var t;
|
|
204
|
+
let n = e;
|
|
205
|
+
for (const i of this.plugins) {
|
|
206
|
+
const o = (t = i.beforeReport) == null ? void 0 : t.call(i, e);
|
|
207
|
+
o !== void 0 && (n = o);
|
|
208
|
+
}
|
|
209
|
+
this.sendToServer(n);
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* 添加面包屑
|
|
213
|
+
*/
|
|
214
|
+
addBreadcrumb(e) {
|
|
215
|
+
this.breadcrumbs.push({
|
|
216
|
+
timestamp: e.timestamp || Date.now(),
|
|
217
|
+
type: e.type,
|
|
218
|
+
message: e.message,
|
|
219
|
+
data: e.data
|
|
220
|
+
}), this.breadcrumbs.length > this.maxBreadcrumbs && this.breadcrumbs.shift();
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* 生成ID
|
|
224
|
+
*/
|
|
225
|
+
generateId() {
|
|
226
|
+
return d();
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* 设置用户信息
|
|
230
|
+
*/
|
|
231
|
+
setUser(e) {
|
|
232
|
+
this.config.userId = e.id, this.config.tags = { ...this.config.tags, ...e };
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* 发送到服务端
|
|
236
|
+
*/
|
|
237
|
+
sendToServer(e) {
|
|
238
|
+
if (typeof navigator > "u") return;
|
|
239
|
+
const t = JSON.stringify(e);
|
|
240
|
+
if (navigator.sendBeacon) {
|
|
241
|
+
const n = new Blob([t], { type: "application/json" });
|
|
242
|
+
navigator.sendBeacon(this.config.dsn, n);
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
typeof fetch < "u" && fetch(this.config.dsn, {
|
|
246
|
+
method: "POST",
|
|
247
|
+
body: t,
|
|
248
|
+
keepalive: !0,
|
|
249
|
+
headers: {
|
|
250
|
+
"Content-Type": "application/json"
|
|
251
|
+
}
|
|
252
|
+
}).catch((n) => {
|
|
253
|
+
console.error("[ErrorMonitor] Failed to send report:", n);
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* 销毁实例
|
|
258
|
+
*/
|
|
259
|
+
destroy() {
|
|
260
|
+
this.plugins.forEach((e) => {
|
|
261
|
+
var t;
|
|
262
|
+
(t = e.teardown) == null || t.call(e);
|
|
263
|
+
}), this.plugins = [], this.breadcrumbs = [], this.isInitialized = !1, console.log("[ErrorMonitor] Destroyed");
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
class m {
|
|
267
|
+
constructor(e = {}) {
|
|
268
|
+
this.checkCount = 0, this.timerId = null, this.isBlankScreen = !1, this.config = {
|
|
269
|
+
detectionDelay: e.detectionDelay || 3e3,
|
|
270
|
+
// 3秒后开始检测
|
|
271
|
+
minElements: e.minElements || 10,
|
|
272
|
+
// 最少10个元素
|
|
273
|
+
checkInterval: e.checkInterval || 1e3,
|
|
274
|
+
// 每秒检测一次
|
|
275
|
+
maxChecks: e.maxChecks || 5,
|
|
276
|
+
// 最多检测5次
|
|
277
|
+
checkPerformance: e.checkPerformance !== !1,
|
|
278
|
+
customCheck: e.customCheck || (() => !1)
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* 开始检测
|
|
283
|
+
*/
|
|
284
|
+
start(e) {
|
|
285
|
+
console.log("[BlankScreenDetector] Starting blank screen detection..."), console.log("[BlankScreenDetector] Config:", this.config), setTimeout(() => {
|
|
286
|
+
console.log("[BlankScreenDetector] Detection delay passed, starting first check..."), this.performCheck(e);
|
|
287
|
+
}, this.config.detectionDelay);
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* 执行检测
|
|
291
|
+
*/
|
|
292
|
+
performCheck(e) {
|
|
293
|
+
this.checkCount++, console.log(`[BlankScreenDetector] Check #${this.checkCount}/${this.config.maxChecks}`);
|
|
294
|
+
const t = this.checkIfBlank();
|
|
295
|
+
if (console.log("[BlankScreenDetector] Is blank screen?", t), t && !this.isBlankScreen) {
|
|
296
|
+
console.log("[BlankScreenDetector] Blank screen detected for the first time!"), this.isBlankScreen = !0;
|
|
297
|
+
const n = this.generateReport();
|
|
298
|
+
console.log("[BlankScreenDetector] Generated report:", n), e(n);
|
|
299
|
+
}
|
|
300
|
+
this.checkCount < this.config.maxChecks && !t ? (this.timerId = window.setTimeout(() => {
|
|
301
|
+
this.performCheck(e);
|
|
302
|
+
}, this.config.checkInterval), console.log(`[BlankScreenDetector] Scheduling next check in ${this.config.checkInterval}ms`)) : console.log("[BlankScreenDetector] Stopping checks. Count:", this.checkCount, "Is blank:", t);
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* 检查是否白屏
|
|
306
|
+
*/
|
|
307
|
+
checkIfBlank() {
|
|
308
|
+
if (this.config.customCheck())
|
|
309
|
+
return console.log("[BlankScreenDetector] Custom check returned true"), !0;
|
|
310
|
+
const e = this.checkDOMElements();
|
|
311
|
+
if (console.log("[BlankScreenDetector] DOM check result:", e), e.isBlank)
|
|
312
|
+
return console.log("[BlankScreenDetector] DOM check indicates blank screen"), !0;
|
|
313
|
+
if (this.config.checkPerformance) {
|
|
314
|
+
const t = this.checkPerformanceTiming();
|
|
315
|
+
if (console.log("[BlankScreenDetector] Performance check result:", t), t.isBlank)
|
|
316
|
+
return console.log("[BlankScreenDetector] Performance check indicates blank screen"), !0;
|
|
317
|
+
}
|
|
318
|
+
return console.log("[BlankScreenDetector] All checks passed, not a blank screen"), !1;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* 检查DOM元素
|
|
322
|
+
*/
|
|
323
|
+
checkDOMElements() {
|
|
324
|
+
var a;
|
|
325
|
+
const e = document.querySelectorAll("*").length, t = ((a = document.body) == null ? void 0 : a.children.length) || 0, n = !!document.body, i = t > 0, o = document.querySelectorAll("#blank-page, #minimal-page, #temp-status").length, r = document.querySelectorAll("script").length, s = e - o - r, c = !n || s < this.config.minElements || !i, l = {
|
|
326
|
+
totalElements: e,
|
|
327
|
+
bodyElements: t,
|
|
328
|
+
hasBody: n,
|
|
329
|
+
hasContent: i,
|
|
330
|
+
testElements: o,
|
|
331
|
+
scriptElements: r,
|
|
332
|
+
elementsWithoutTestAndScripts: s,
|
|
333
|
+
minElements: this.config.minElements
|
|
334
|
+
};
|
|
335
|
+
return console.log("[BlankScreenDetector] 详细DOM信息:", l), {
|
|
336
|
+
isBlank: c,
|
|
337
|
+
info: l
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* 检查Performance API
|
|
342
|
+
*/
|
|
343
|
+
checkPerformanceTiming() {
|
|
344
|
+
var l;
|
|
345
|
+
if (!window.performance || !window.performance.timing)
|
|
346
|
+
return { isBlank: !1 };
|
|
347
|
+
const e = window.performance.timing, t = e.navigationStart, n = e.domContentLoadedEventEnd - t, i = e.loadEventEnd - t;
|
|
348
|
+
let o, r;
|
|
349
|
+
const s = (l = performance.getEntriesByType) == null ? void 0 : l.call(performance, "paint");
|
|
350
|
+
if (s) {
|
|
351
|
+
const a = s.find((f) => f.name === "first-paint"), u = s.find((f) => f.name === "first-contentful-paint");
|
|
352
|
+
o = a == null ? void 0 : a.startTime, r = u == null ? void 0 : u.startTime;
|
|
353
|
+
}
|
|
354
|
+
return {
|
|
355
|
+
isBlank: i > 0 && (o === void 0 || r === void 0) && n > 5e3,
|
|
356
|
+
timing: {
|
|
357
|
+
domContentLoaded: n,
|
|
358
|
+
loadComplete: i,
|
|
359
|
+
firstPaint: o,
|
|
360
|
+
firstContentfulPaint: r
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* 生成报告
|
|
366
|
+
*/
|
|
367
|
+
generateReport() {
|
|
368
|
+
var n;
|
|
369
|
+
const e = this.checkDOMElements(), t = this.config.checkPerformance ? this.checkPerformanceTiming() : {};
|
|
370
|
+
return {
|
|
371
|
+
type: "blank-screen",
|
|
372
|
+
message: "检测到白屏:页面加载后无内容渲染",
|
|
373
|
+
context: {
|
|
374
|
+
timestamp: Date.now(),
|
|
375
|
+
url: window.location.href,
|
|
376
|
+
domElements: document.querySelectorAll("*").length,
|
|
377
|
+
bodyElements: ((n = document.body) == null ? void 0 : n.children.length) || 0,
|
|
378
|
+
hasContent: e.info.hasContent,
|
|
379
|
+
performanceTiming: t.timing
|
|
380
|
+
}
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* 停止检测
|
|
385
|
+
*/
|
|
386
|
+
stop() {
|
|
387
|
+
console.log("[BlankScreenDetector] Stopping blank screen detection..."), this.timerId !== null && (window.clearTimeout(this.timerId), this.timerId = null, console.log("[BlankScreenDetector] Cleared timeout timer")), console.log("[BlankScreenDetector] Blank screen detection stopped");
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* 重置检测器
|
|
391
|
+
*/
|
|
392
|
+
reset() {
|
|
393
|
+
this.stop(), this.checkCount = 0, this.isBlankScreen = !1;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
function k(h) {
|
|
397
|
+
return new m(h);
|
|
398
|
+
}
|
|
399
|
+
class w extends p {
|
|
400
|
+
constructor(e) {
|
|
401
|
+
super(e), this.originalFetch = null, this.originalXHR = null, this.blankScreenDetector = null, this.config = e;
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* 初始化Web端监控
|
|
405
|
+
*/
|
|
406
|
+
init() {
|
|
407
|
+
var o, r, s, c;
|
|
408
|
+
if (super.init(), typeof window > "u") {
|
|
409
|
+
console.warn("[ErrorMonitorWeb] Not in browser environment");
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
const e = ((o = this.config.autoCapture) == null ? void 0 : o.js) !== !1 && this.config.captureJsErrors !== !1, t = ((r = this.config.autoCapture) == null ? void 0 : r.promise) !== !1 && this.config.capturePromiseErrors !== !1, n = ((s = this.config.autoCapture) == null ? void 0 : s.network) !== !1 && this.config.captureNetworkErrors !== !1, i = ((c = this.config.autoCapture) == null ? void 0 : c.resource) !== !1 && this.config.captureResourceErrors !== !1;
|
|
413
|
+
e && this.setupJsErrorHandler(), t && this.setupPromiseErrorHandler(), n && this.setupNetworkErrorHandler(), i && this.setupResourceErrorHandler(), this.config.blankScreenDetection && this.setupBlankScreenDetection(), console.log("[ErrorMonitorWeb] Web handlers initialized");
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* JavaScript错误处理
|
|
417
|
+
*/
|
|
418
|
+
setupJsErrorHandler() {
|
|
419
|
+
window.addEventListener("error", (e) => {
|
|
420
|
+
var t;
|
|
421
|
+
this.capture({
|
|
422
|
+
type: "js",
|
|
423
|
+
message: e.message,
|
|
424
|
+
stack: (t = e.error) == null ? void 0 : t.stack,
|
|
425
|
+
context: {
|
|
426
|
+
filename: e.filename,
|
|
427
|
+
lineno: e.lineno,
|
|
428
|
+
colno: e.colno
|
|
429
|
+
}
|
|
430
|
+
});
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* Promise错误处理
|
|
435
|
+
*/
|
|
436
|
+
setupPromiseErrorHandler() {
|
|
437
|
+
window.addEventListener("unhandledrejection", (e) => {
|
|
438
|
+
var t, n;
|
|
439
|
+
this.capture({
|
|
440
|
+
type: "promise",
|
|
441
|
+
message: ((t = e.reason) == null ? void 0 : t.message) || String(e.reason),
|
|
442
|
+
stack: (n = e.reason) == null ? void 0 : n.stack,
|
|
443
|
+
context: {
|
|
444
|
+
reason: e.reason
|
|
445
|
+
}
|
|
446
|
+
});
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* 网络请求错误处理
|
|
451
|
+
*/
|
|
452
|
+
setupNetworkErrorHandler() {
|
|
453
|
+
if (typeof window.fetch < "u") {
|
|
454
|
+
this.originalFetch = window.fetch;
|
|
455
|
+
const e = this;
|
|
456
|
+
window.fetch = function(...t) {
|
|
457
|
+
return e.originalFetch.apply(this, t).catch((n) => {
|
|
458
|
+
var r;
|
|
459
|
+
const i = typeof t[0] == "string" ? t[0] : String(t[0]), o = ((r = t[1]) == null ? void 0 : r.method) || "GET";
|
|
460
|
+
throw e.capture({
|
|
461
|
+
type: "network",
|
|
462
|
+
message: `Network error: ${o} ${i}`,
|
|
463
|
+
context: {
|
|
464
|
+
url: i,
|
|
465
|
+
method: o,
|
|
466
|
+
error: n.message
|
|
467
|
+
}
|
|
468
|
+
}), n;
|
|
469
|
+
});
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
if (typeof window.XMLHttpRequest < "u") {
|
|
473
|
+
this.originalXHR = window.XMLHttpRequest;
|
|
474
|
+
const e = this, t = this.originalXHR;
|
|
475
|
+
window.XMLHttpRequest = function() {
|
|
476
|
+
const n = new t(), i = n.open, o = n.send;
|
|
477
|
+
let r = "", s = "";
|
|
478
|
+
return n.open = function(...c) {
|
|
479
|
+
return s = c[0] || "GET", r = String(c[1] || ""), i.apply(this, c);
|
|
480
|
+
}, n.send = function(...c) {
|
|
481
|
+
return n.addEventListener("error", () => {
|
|
482
|
+
e.capture({
|
|
483
|
+
type: "network",
|
|
484
|
+
message: `XHR error: ${s} ${r}`,
|
|
485
|
+
context: {
|
|
486
|
+
url: r,
|
|
487
|
+
method: s,
|
|
488
|
+
status: n.status
|
|
489
|
+
}
|
|
490
|
+
});
|
|
491
|
+
}), o.apply(this, c);
|
|
492
|
+
}, n;
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* 资源加载错误处理
|
|
498
|
+
*/
|
|
499
|
+
setupResourceErrorHandler() {
|
|
500
|
+
window.addEventListener("error", (e) => {
|
|
501
|
+
if (e.target !== window) {
|
|
502
|
+
const t = e.target;
|
|
503
|
+
this.capture({
|
|
504
|
+
type: "resource",
|
|
505
|
+
message: `Resource load error: ${t.tagName}`,
|
|
506
|
+
context: {
|
|
507
|
+
tagName: t.tagName,
|
|
508
|
+
src: t.src || t.href
|
|
509
|
+
}
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
}, !0);
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* 白屏检测
|
|
516
|
+
*/
|
|
517
|
+
setupBlankScreenDetection() {
|
|
518
|
+
console.log("[ErrorMonitorWeb] Setting up blank screen detection...");
|
|
519
|
+
const e = typeof this.config.blankScreenDetection == "boolean" ? {} : this.config.blankScreenDetection;
|
|
520
|
+
console.log("[ErrorMonitorWeb] Blank screen config:", e), this.blankScreenDetector = k(e), this.blankScreenDetector.start((t) => {
|
|
521
|
+
console.log("[ErrorMonitorWeb] Blank screen detected!", t), this.capture({
|
|
522
|
+
type: t.type,
|
|
523
|
+
message: t.message,
|
|
524
|
+
context: t.context
|
|
525
|
+
});
|
|
526
|
+
}), console.log("[ErrorMonitorWeb] Blank screen detection started");
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* 手动上报错误
|
|
530
|
+
*/
|
|
531
|
+
captureError(e, t) {
|
|
532
|
+
this.capture({
|
|
533
|
+
type: "custom",
|
|
534
|
+
message: e.message,
|
|
535
|
+
stack: e.stack,
|
|
536
|
+
context: t
|
|
537
|
+
});
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* 手动上报消息
|
|
541
|
+
*/
|
|
542
|
+
captureMessage(e, t = "info") {
|
|
543
|
+
this.capture({
|
|
544
|
+
type: "custom",
|
|
545
|
+
message: e,
|
|
546
|
+
context: { level: t }
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* 销毁实例
|
|
551
|
+
*/
|
|
552
|
+
destroy() {
|
|
553
|
+
console.log("[ErrorMonitorWeb] Destroying instance..."), this.blankScreenDetector && (console.log("[ErrorMonitorWeb] Stopping blank screen detector..."), this.blankScreenDetector.stop(), this.blankScreenDetector = null), this.originalFetch && window.fetch !== this.originalFetch && (window.fetch = this.originalFetch), this.originalXHR && window.XMLHttpRequest !== this.originalXHR && (window.XMLHttpRequest = this.originalXHR), super.destroy(), console.log("[ErrorMonitorWeb] Instance destroyed");
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
function b(h) {
|
|
557
|
+
return new w(h);
|
|
558
|
+
}
|
|
559
|
+
export {
|
|
560
|
+
m as BlankScreenDetector,
|
|
561
|
+
p as ErrorMonitor,
|
|
562
|
+
w as ErrorMonitorWeb,
|
|
563
|
+
k as createBlankScreenDetector,
|
|
564
|
+
b as createErrorMonitorWeb,
|
|
565
|
+
w as default
|
|
566
|
+
};
|
|
567
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../core/dist/index.mjs","../src/blank-screen-detector.ts","../src/index.ts"],"sourcesContent":["function h() {\n return `${Date.now()}-${Math.random().toString(36).substring(2, 15)}`;\n}\nfunction l() {\n return `${Date.now()}-${Math.random().toString(36).substring(2, 15)}`;\n}\nclass g {\n constructor(e) {\n this.isInitialized = !1, this.breadcrumbs = [], this.maxBreadcrumbs = 50, this.plugins = [], this.sessionId = h(), this.config = {\n autoCapture: {\n js: !0,\n promise: !0,\n network: !0,\n resource: !0,\n console: !1\n },\n filter: {\n ignoreErrors: [],\n ignoreUrls: [],\n minLevel: \"info\"\n },\n report: {\n delay: 1e3,\n batchSize: 10\n },\n sampleRate: 1,\n errorSampleRate: 1,\n enabled: !0,\n debug: !1,\n ...e\n };\n }\n /**\n * 更新配置\n */\n updateConfig(e) {\n this.config = { ...this.config, ...e }, this.config.debug && console.log(\"[ErrorMonitor] Config updated:\", this.config);\n }\n /**\n * 启用SDK\n */\n enable() {\n this.config.enabled = !0, console.log(\"[ErrorMonitor] SDK enabled\");\n }\n /**\n * 禁用SDK\n */\n disable() {\n this.config.enabled = !1, console.log(\"[ErrorMonitor] SDK disabled\");\n }\n /**\n * 添加错误过滤器\n */\n addFilter(e) {\n this.config.filter || (this.config.filter = {}), this.config.filter.ignoreErrors || (this.config.filter.ignoreErrors = []), this.config.filter.ignoreErrors.push(e);\n }\n /**\n * 移除错误过滤器\n */\n removeFilter(e) {\n var r;\n if (!((r = this.config.filter) != null && r.ignoreErrors)) return;\n const t = this.config.filter.ignoreErrors.indexOf(e);\n t > -1 && this.config.filter.ignoreErrors.splice(t, 1);\n }\n /**\n * 设置采样率\n */\n setSampleRate(e) {\n this.config.sampleRate = Math.max(0, Math.min(1, e));\n }\n /**\n * 设置错误采样率\n */\n setErrorSampleRate(e) {\n this.config.errorSampleRate = Math.max(0, Math.min(1, e));\n }\n /**\n * 初始化监控\n */\n init() {\n if (this.isInitialized) {\n console.warn(\"[ErrorMonitor] Already initialized\");\n return;\n }\n this.isInitialized = !0, this.plugins.forEach((e) => {\n var t;\n (t = e.setup) == null || t.call(e, this);\n }), console.log(\"[ErrorMonitor] Initialized with appId:\", this.config.appId);\n }\n /**\n * 注册插件\n */\n use(e) {\n var t;\n this.plugins.push(e), this.isInitialized && ((t = e.setup) == null || t.call(e, this));\n }\n /**\n * 捕获错误(支持选项)\n */\n capture(e, t) {\n var c, d;\n if (!this.isInitialized) {\n console.warn(\"[ErrorMonitor] Not initialized\");\n return;\n }\n if (this.config.enabled === !1)\n return;\n const r = e instanceof Error ? {\n type: \"custom\",\n message: e.message,\n stack: e.stack,\n context: {}\n } : e, i = {\n level: \"error\",\n tags: {},\n extra: {},\n user: {},\n skipSampling: !1,\n skipFilter: !1,\n ...t\n };\n if (!i.skipFilter && this.shouldFilter(r)) {\n this.config.debug && console.log(\"[ErrorMonitor] Error filtered:\", r.message);\n return;\n }\n if (!i.skipSampling && this.config.errorSampleRate !== void 0 && Math.random() > this.config.errorSampleRate)\n return;\n let s = r;\n for (const n of this.plugins) {\n const a = (c = n.beforeCapture) == null ? void 0 : c.call(n, r);\n if (a === null)\n return;\n a !== void 0 && (s = a);\n }\n const o = {\n appId: this.config.appId,\n timestamp: Date.now(),\n sessionId: this.sessionId,\n eventId: l(),\n type: s.type,\n level: i.level,\n message: s.message,\n stack: s.stack,\n context: {\n userAgent: typeof navigator < \"u\" ? navigator.userAgent : \"\",\n url: typeof location < \"u\" ? location.href : \"\",\n viewport: {\n width: typeof window < \"u\" ? window.innerWidth : 0,\n height: typeof window < \"u\" ? window.innerHeight : 0\n },\n userId: i.user.id || this.config.userId,\n tags: { ...this.config.tags, ...i.tags }\n },\n breadcrumbs: [...this.breadcrumbs],\n extra: { ...s.context, ...i.extra }\n };\n for (const n of this.plugins) {\n const a = (d = n.afterCapture) == null ? void 0 : d.call(n, o);\n a !== void 0 && Object.assign(o, a);\n }\n this.report(o);\n }\n /**\n * 检查是否应该过滤此错误\n */\n shouldFilter(e) {\n var s;\n if (!this.config.filter) return !1;\n const { ignoreErrors: t, ignoreUrls: r, minLevel: i } = this.config.filter;\n if (t && t.length > 0) {\n for (const o of t)\n if (o.test(e.message))\n return !0;\n }\n if (r && r.length > 0 && ((s = e.context) != null && s.url)) {\n for (const o of r)\n if (o.test(e.context.url))\n return !0;\n }\n return !1;\n }\n /**\n * 手动上报错误(简化的API)\n */\n captureError(e, t) {\n this.capture(e, t);\n }\n /**\n * 手动上报消息\n */\n captureMessage(e, t = \"info\", r) {\n this.capture({\n type: \"custom\",\n message: e,\n context: {}\n }, { ...r, level: t });\n }\n /**\n * 上报错误\n */\n report(e) {\n var r;\n let t = e;\n for (const i of this.plugins) {\n const s = (r = i.beforeReport) == null ? void 0 : r.call(i, e);\n s !== void 0 && (t = s);\n }\n this.sendToServer(t);\n }\n /**\n * 添加面包屑\n */\n addBreadcrumb(e) {\n this.breadcrumbs.push({\n timestamp: e.timestamp || Date.now(),\n type: e.type,\n message: e.message,\n data: e.data\n }), this.breadcrumbs.length > this.maxBreadcrumbs && this.breadcrumbs.shift();\n }\n /**\n * 生成ID\n */\n generateId() {\n return l();\n }\n /**\n * 设置用户信息\n */\n setUser(e) {\n this.config.userId = e.id, this.config.tags = { ...this.config.tags, ...e };\n }\n /**\n * 发送到服务端\n */\n sendToServer(e) {\n if (typeof navigator > \"u\") return;\n const t = JSON.stringify(e);\n if (navigator.sendBeacon) {\n const r = new Blob([t], { type: \"application/json\" });\n navigator.sendBeacon(this.config.dsn, r);\n return;\n }\n typeof fetch < \"u\" && fetch(this.config.dsn, {\n method: \"POST\",\n body: t,\n keepalive: !0,\n headers: {\n \"Content-Type\": \"application/json\"\n }\n }).catch((r) => {\n console.error(\"[ErrorMonitor] Failed to send report:\", r);\n });\n }\n /**\n * 销毁实例\n */\n destroy() {\n this.plugins.forEach((e) => {\n var t;\n (t = e.teardown) == null || t.call(e);\n }), this.plugins = [], this.breadcrumbs = [], this.isInitialized = !1, console.log(\"[ErrorMonitor] Destroyed\");\n }\n}\nfunction u(f) {\n return new g(f);\n}\nexport {\n g as ErrorMonitor,\n u as createErrorMonitor\n};\n//# sourceMappingURL=index.mjs.map\n","/**\n * 白屏检测模块\n * 检测页面是否白屏(无内容渲染)\n */\n\nexport interface BlankScreenConfig {\n // 检测阈值:页面加载后多久开始检测(毫秒)\n detectionDelay?: number\n // 最小DOM元素数量阈值\n minElements?: number\n // 检测间隔(毫秒)\n checkInterval?: number\n // 最大检测次数\n maxChecks?: number\n // 是否检测Performance API\n checkPerformance?: boolean\n // 自定义检测函数\n customCheck?: () => boolean\n}\n\nexport interface BlankScreenReport {\n type: 'blank-screen'\n message: string\n context: {\n timestamp: number\n url: string\n domElements: number\n bodyElements: number\n hasContent: boolean\n performanceTiming?: {\n domContentLoaded?: number\n loadComplete?: number\n firstPaint?: number\n firstContentfulPaint?: number\n }\n }\n}\n\n/**\n * 白屏检测器类\n */\nexport class BlankScreenDetector {\n private config: Required<BlankScreenConfig>\n private checkCount: number = 0\n private timerId: number | null = null\n private isBlankScreen: boolean = false\n\n constructor(config: BlankScreenConfig = {}) {\n this.config = {\n detectionDelay: config.detectionDelay || 3000, // 3秒后开始检测\n minElements: config.minElements || 10, // 最少10个元素\n checkInterval: config.checkInterval || 1000, // 每秒检测一次\n maxChecks: config.maxChecks || 5, // 最多检测5次\n checkPerformance: config.checkPerformance !== false,\n customCheck: config.customCheck || (() => false)\n }\n }\n\n /**\n * 开始检测\n */\n start(callback: (report: BlankScreenReport) => void): void {\n console.log('[BlankScreenDetector] Starting blank screen detection...')\n console.log('[BlankScreenDetector] Config:', this.config)\n\n // 延迟开始检测,等待页面加载\n setTimeout(() => {\n console.log('[BlankScreenDetector] Detection delay passed, starting first check...')\n this.performCheck(callback)\n }, this.config.detectionDelay)\n }\n\n /**\n * 执行检测\n */\n private performCheck(callback: (report: BlankScreenReport) => void): void {\n this.checkCount++\n console.log(`[BlankScreenDetector] Check #${this.checkCount}/${this.config.maxChecks}`)\n\n const isBlank = this.checkIfBlank()\n console.log('[BlankScreenDetector] Is blank screen?', isBlank)\n\n if (isBlank && !this.isBlankScreen) {\n // 首次检测到白屏\n console.log('[BlankScreenDetector] Blank screen detected for the first time!')\n this.isBlankScreen = true\n const report = this.generateReport()\n console.log('[BlankScreenDetector] Generated report:', report)\n callback(report)\n }\n\n // 如果还未达到最大检测次数,继续检测\n if (this.checkCount < this.config.maxChecks && !isBlank) {\n this.timerId = window.setTimeout(() => {\n this.performCheck(callback)\n }, this.config.checkInterval)\n console.log(`[BlankScreenDetector] Scheduling next check in ${this.config.checkInterval}ms`)\n } else {\n console.log('[BlankScreenDetector] Stopping checks. Count:', this.checkCount, 'Is blank:', isBlank)\n }\n }\n\n /**\n * 检查是否白屏\n */\n private checkIfBlank(): boolean {\n // 1. 检查自定义检测函数\n if (this.config.customCheck()) {\n console.log('[BlankScreenDetector] Custom check returned true')\n return true\n }\n\n // 2. 检查DOM元素数量\n const domCheck = this.checkDOMElements()\n console.log('[BlankScreenDetector] DOM check result:', domCheck)\n if (domCheck.isBlank) {\n console.log('[BlankScreenDetector] DOM check indicates blank screen')\n return true\n }\n\n // 3. 检查Performance API\n if (this.config.checkPerformance) {\n const perfCheck = this.checkPerformanceTiming()\n console.log('[BlankScreenDetector] Performance check result:', perfCheck)\n if (perfCheck.isBlank) {\n console.log('[BlankScreenDetector] Performance check indicates blank screen')\n return true\n }\n }\n\n console.log('[BlankScreenDetector] All checks passed, not a blank screen')\n return false\n }\n\n /**\n * 检查DOM元素\n */\n private checkDOMElements(): { isBlank: boolean; info: any } {\n const totalElements = document.querySelectorAll('*').length\n const bodyElements = document.body?.children.length || 0\n\n // 检查body是否存在且不为空\n const hasBody = !!document.body\n const hasContent = bodyElements > 0\n\n // 排除测试相关的元素(blank-page, minimal-page, temp-status等)\n const testElements = document.querySelectorAll('#blank-page, #minimal-page, #temp-status').length\n\n // 排除script标签(测试时script标签不算作内容)\n const scriptElements = document.querySelectorAll('script').length\n\n const elementsWithoutTestAndScripts = totalElements - testElements - scriptElements\n\n // 改进的白屏判断:排除测试元素和script后仍然很少,才认为是白屏\n const isBlank = !hasBody || elementsWithoutTestAndScripts < this.config.minElements || !hasContent\n\n const info = {\n totalElements,\n bodyElements,\n hasBody,\n hasContent,\n testElements,\n scriptElements,\n elementsWithoutTestAndScripts,\n minElements: this.config.minElements\n }\n\n console.log('[BlankScreenDetector] 详细DOM信息:', info)\n\n return {\n isBlank,\n info\n }\n }\n\n /**\n * 检查Performance API\n */\n private checkPerformanceTiming(): { isBlank: boolean; timing?: any } {\n if (!window.performance || !window.performance.timing) {\n return { isBlank: false }\n }\n\n const timing = window.performance.timing\n const navigationStart = timing.navigationStart\n\n const domContentLoaded = timing.domContentLoadedEventEnd - navigationStart\n const loadComplete = timing.loadEventEnd - navigationStart\n\n // 获取首次绘制时间\n let firstPaint: number | undefined\n let firstContentfulPaint: number | undefined\n\n const perfEntries = performance.getEntriesByType?.('paint') as PerformanceEntry[]\n if (perfEntries) {\n const fp = perfEntries.find(e => e.name === 'first-paint')\n const fcp = perfEntries.find(e => e.name === 'first-contentful-paint')\n firstPaint = fp?.startTime\n firstContentfulPaint = fcp?.startTime\n }\n\n // 如果页面加载完成但没有任何绘制,可能是白屏\n const isBlank =\n loadComplete > 0 &&\n (firstPaint === undefined || firstContentfulPaint === undefined) &&\n domContentLoaded > 5000 // DOM加载超过5秒但没有绘制\n\n return {\n isBlank,\n timing: {\n domContentLoaded,\n loadComplete,\n firstPaint,\n firstContentfulPaint\n }\n }\n }\n\n /**\n * 生成报告\n */\n private generateReport(): BlankScreenReport {\n const domInfo = this.checkDOMElements()\n const perfInfo = this.config.checkPerformance ? this.checkPerformanceTiming() : {}\n\n return {\n type: 'blank-screen',\n message: '检测到白屏:页面加载后无内容渲染',\n context: {\n timestamp: Date.now(),\n url: window.location.href,\n domElements: document.querySelectorAll('*').length,\n bodyElements: document.body?.children.length || 0,\n hasContent: domInfo.info.hasContent,\n performanceTiming: perfInfo.timing\n }\n }\n }\n\n /**\n * 停止检测\n */\n stop(): void {\n console.log('[BlankScreenDetector] Stopping blank screen detection...')\n if (this.timerId !== null) {\n window.clearTimeout(this.timerId)\n this.timerId = null\n console.log('[BlankScreenDetector] Cleared timeout timer')\n }\n console.log('[BlankScreenDetector] Blank screen detection stopped')\n }\n\n /**\n * 重置检测器\n */\n reset(): void {\n this.stop()\n this.checkCount = 0\n this.isBlankScreen = false\n }\n}\n\n/**\n * 创建白屏检测器实例\n */\nexport function createBlankScreenDetector(config?: BlankScreenConfig): BlankScreenDetector {\n return new BlankScreenDetector(config)\n}\n","/**\n * Error Monitor Web\n * Web端错误监控模块\n */\n\nimport { ErrorMonitor, Config } from 'error-monitor-core'\nimport {\n BlankScreenDetector,\n BlankScreenConfig,\n createBlankScreenDetector\n} from './blank-screen-detector'\n\n// 导出核心\nexport { ErrorMonitor } from 'error-monitor-core'\nexport type { Config, Plugin, Breadcrumb } from 'error-monitor-core'\n\n// 导出白屏检测\nexport { BlankScreenDetector, createBlankScreenDetector }\nexport type { BlankScreenConfig, BlankScreenReport } from './blank-screen-detector'\n\n/**\n * Web端配置\n */\nexport interface WebConfig extends Config {\n // 是否自动捕获全局错误 (已弃用,请使用 autoCapture)\n captureJsErrors?: boolean\n // 是否捕获Promise错误 (已弃用,请使用 autoCapture)\n capturePromiseErrors?: boolean\n // 是否捕获网络错误 (已弃用,请使用 autoCapture)\n captureNetworkErrors?: boolean\n // 是否捕获资源加载错误 (已弃用,请使用 autoCapture)\n captureResourceErrors?: boolean\n // 是否启用白屏检测\n blankScreenDetection?: boolean | BlankScreenConfig\n // 自定义上报函数\n customReporter?: (data: any) => void\n}\n\n/**\n * Web端错误监控类\n */\nexport class ErrorMonitorWeb extends ErrorMonitor {\n protected config: WebConfig\n private originalFetch: typeof fetch | null = null\n private originalXHR: typeof XMLHttpRequest | null = null\n private blankScreenDetector: BlankScreenDetector | null = null\n\n constructor(config: WebConfig) {\n super(config)\n this.config = config\n }\n\n /**\n * 初始化Web端监控\n */\n init(): void {\n super.init()\n\n if (typeof window === 'undefined') {\n console.warn('[ErrorMonitorWeb] Not in browser environment')\n return\n }\n\n // 支持新旧两种配置格式\n // 新格式: autoCapture.js\n // 旧格式: captureJsErrors\n const captureJs = this.config.autoCapture?.js !== false && this.config.captureJsErrors !== false\n const capturePromise = this.config.autoCapture?.promise !== false && this.config.capturePromiseErrors !== false\n const captureNetwork = this.config.autoCapture?.network !== false && this.config.captureNetworkErrors !== false\n const captureResource = this.config.autoCapture?.resource !== false && this.config.captureResourceErrors !== false\n\n // 自动捕获各种错误\n if (captureJs) {\n this.setupJsErrorHandler()\n }\n\n if (capturePromise) {\n this.setupPromiseErrorHandler()\n }\n\n if (captureNetwork) {\n this.setupNetworkErrorHandler()\n }\n\n if (captureResource) {\n this.setupResourceErrorHandler()\n }\n\n // 初始化白屏检测\n if (this.config.blankScreenDetection) {\n this.setupBlankScreenDetection()\n }\n\n console.log('[ErrorMonitorWeb] Web handlers initialized')\n }\n\n /**\n * JavaScript错误处理\n */\n private setupJsErrorHandler(): void {\n window.addEventListener('error', (event) => {\n this.capture({\n type: 'js',\n message: event.message,\n stack: event.error?.stack,\n context: {\n filename: event.filename,\n lineno: event.lineno,\n colno: event.colno\n }\n })\n })\n }\n\n /**\n * Promise错误处理\n */\n private setupPromiseErrorHandler(): void {\n window.addEventListener('unhandledrejection', (event) => {\n this.capture({\n type: 'promise',\n message: event.reason?.message || String(event.reason),\n stack: event.reason?.stack,\n context: {\n reason: event.reason\n }\n })\n })\n }\n\n /**\n * 网络请求错误处理\n */\n private setupNetworkErrorHandler(): void {\n // 拦截fetch\n if (typeof window.fetch !== 'undefined') {\n this.originalFetch = window.fetch\n const self = this\n\n window.fetch = function (...args: Parameters<typeof fetch>) {\n return self.originalFetch!\n .apply(this, args as any)\n .catch((error) => {\n const url = typeof args[0] === 'string' ? args[0] : String(args[0])\n const method = args[1]?.method || 'GET'\n\n self.capture({\n type: 'network',\n message: `Network error: ${method} ${url}`,\n context: {\n url,\n method,\n error: error.message\n }\n })\n\n throw error\n })\n }\n }\n\n // 拦截XMLHttpRequest(简化版)\n if (typeof window.XMLHttpRequest !== 'undefined') {\n this.originalXHR = window.XMLHttpRequest\n const self = this\n\n const OriginalXHR = this.originalXHR\n window.XMLHttpRequest = function () {\n const xhr = new OriginalXHR()\n const originalOpen = xhr.open\n const originalSend = xhr.send\n let url = ''\n let method = ''\n\n xhr.open = function (...args: any[]) {\n method = args[0] || 'GET'\n url = String(args[1] || '')\n return originalOpen.apply(this, args as any)\n }\n\n xhr.send = function (...args: any[]) {\n xhr.addEventListener('error', () => {\n self.capture({\n type: 'network',\n message: `XHR error: ${method} ${url}`,\n context: {\n url,\n method,\n status: xhr.status\n }\n })\n })\n\n return originalSend.apply(this, args as any)\n }\n\n return xhr\n } as any\n }\n }\n\n /**\n * 资源加载错误处理\n */\n private setupResourceErrorHandler(): void {\n window.addEventListener('error', (event) => {\n if (event.target !== window) {\n const target = event.target as HTMLElement\n this.capture({\n type: 'resource',\n message: `Resource load error: ${target.tagName}`,\n context: {\n tagName: target.tagName,\n src: (target as any).src || (target as any).href\n }\n })\n }\n }, true)\n }\n\n /**\n * 白屏检测\n */\n private setupBlankScreenDetection(): void {\n console.log('[ErrorMonitorWeb] Setting up blank screen detection...')\n const config =\n typeof this.config.blankScreenDetection === 'boolean'\n ? {}\n : this.config.blankScreenDetection\n\n console.log('[ErrorMonitorWeb] Blank screen config:', config)\n this.blankScreenDetector = createBlankScreenDetector(config)\n\n this.blankScreenDetector.start((report) => {\n console.log('[ErrorMonitorWeb] Blank screen detected!', report)\n this.capture({\n type: report.type,\n message: report.message,\n context: report.context\n })\n })\n\n console.log('[ErrorMonitorWeb] Blank screen detection started')\n }\n\n /**\n * 手动上报错误\n */\n captureError(error: Error, context?: Record<string, any>): void {\n this.capture({\n type: 'custom',\n message: error.message,\n stack: error.stack,\n context\n })\n }\n\n /**\n * 手动上报消息\n */\n captureMessage(message: string, level: string = 'info'): void {\n this.capture({\n type: 'custom',\n message,\n context: { level }\n })\n }\n\n /**\n * 销毁实例\n */\n destroy(): void {\n console.log('[ErrorMonitorWeb] Destroying instance...')\n\n // 停止白屏检测\n if (this.blankScreenDetector) {\n console.log('[ErrorMonitorWeb] Stopping blank screen detector...')\n this.blankScreenDetector.stop()\n this.blankScreenDetector = null\n }\n\n // 恢复原生方法\n if (this.originalFetch && window.fetch !== this.originalFetch) {\n window.fetch = this.originalFetch\n }\n\n if (this.originalXHR && window.XMLHttpRequest !== this.originalXHR) {\n window.XMLHttpRequest = this.originalXHR\n }\n\n super.destroy()\n\n console.log('[ErrorMonitorWeb] Instance destroyed')\n }\n}\n\n/**\n * 创建Web端实例工厂函数\n */\nexport function createErrorMonitorWeb(config: WebConfig): ErrorMonitorWeb {\n return new ErrorMonitorWeb(config)\n}\n\n// 默认导出\nexport default ErrorMonitorWeb\n"],"names":["h","l","g","r","t","c","d","i","n","o","s","BlankScreenDetector","config","callback","isBlank","report","domCheck","perfCheck","_a","totalElements","bodyElements","hasBody","hasContent","testElements","scriptElements","elementsWithoutTestAndScripts","info","timing","navigationStart","domContentLoaded","loadComplete","firstPaint","firstContentfulPaint","perfEntries","fp","e","fcp","domInfo","perfInfo","createBlankScreenDetector","ErrorMonitorWeb","ErrorMonitor","_b","_c","_d","captureJs","capturePromise","captureNetwork","captureResource","event","self","args","error","url","method","OriginalXHR","xhr","originalOpen","originalSend","target","context","message","level","createErrorMonitorWeb"],"mappings":"AAAA,SAASA,IAAI;AACX,SAAO,GAAG,KAAK,IAAG,CAAE,IAAI,KAAK,OAAM,EAAG,SAAS,EAAE,EAAE,UAAU,GAAG,EAAE,CAAC;AACrE;AACA,SAASC,IAAI;AACX,SAAO,GAAG,KAAK,IAAG,CAAE,IAAI,KAAK,OAAM,EAAG,SAAS,EAAE,EAAE,UAAU,GAAG,EAAE,CAAC;AACrE;AACA,MAAMC,EAAE;AAAA,EACN,YAAY,GAAG;AACb,SAAK,gBAAgB,IAAI,KAAK,cAAc,CAAA,GAAI,KAAK,iBAAiB,IAAI,KAAK,UAAU,CAAA,GAAI,KAAK,YAAYF,EAAC,GAAI,KAAK,SAAS;AAAA,MAC/H,aAAa;AAAA,QACX,IAAI;AAAA,QACJ,SAAS;AAAA,QACT,SAAS;AAAA,QACT,UAAU;AAAA,QACV,SAAS;AAAA,MACjB;AAAA,MACM,QAAQ;AAAA,QACN,cAAc,CAAA;AAAA,QACd,YAAY,CAAA;AAAA,QACZ,UAAU;AAAA,MAClB;AAAA,MACM,QAAQ;AAAA,QACN,OAAO;AAAA,QACP,WAAW;AAAA,MACnB;AAAA,MACM,YAAY;AAAA,MACZ,iBAAiB;AAAA,MACjB,SAAS;AAAA,MACT,OAAO;AAAA,MACP,GAAG;AAAA,IACT;AAAA,EACE;AAAA;AAAA;AAAA;AAAA,EAIA,aAAa,GAAG;AACd,SAAK,SAAS,EAAE,GAAG,KAAK,QAAQ,GAAG,EAAC,GAAI,KAAK,OAAO,SAAS,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