@djvlc/runtime-web 1.0.6 → 1.1.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/dist/error-reporter.d.ts +76 -0
- package/dist/error-reporter.d.ts.map +1 -0
- package/dist/index.d.ts +77 -1329
- package/dist/index.d.ts.map +1 -0
- package/dist/mount.d.ts +114 -0
- package/dist/mount.d.ts.map +1 -0
- package/dist/performance.d.ts +88 -0
- package/dist/performance.d.ts.map +1 -0
- package/dist/runtime.esm.js +1 -1
- package/dist/runtime.iife.js +1 -1
- package/dist/storage.d.ts +33 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/tracking.d.ts +87 -0
- package/dist/tracking.d.ts.map +1 -0
- package/dist/utils.d.ts +66 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/version.d.ts +5 -0
- package/dist/version.d.ts.map +1 -0
- package/package.json +2 -3
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 错误报告
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* 错误报告配置
|
|
6
|
+
*/
|
|
7
|
+
export interface ErrorReporterConfig {
|
|
8
|
+
/** 上报端点 */
|
|
9
|
+
endpoint?: string;
|
|
10
|
+
/** 是否启用 */
|
|
11
|
+
enabled?: boolean;
|
|
12
|
+
/** 采样率 */
|
|
13
|
+
sampleRate?: number;
|
|
14
|
+
/** 忽略的错误模式 */
|
|
15
|
+
ignorePatterns?: RegExp[];
|
|
16
|
+
/** 自定义上报函数 */
|
|
17
|
+
reporter?: (error: ErrorReport) => void | Promise<void>;
|
|
18
|
+
/** 最大堆栈深度 */
|
|
19
|
+
maxStackDepth?: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* 错误报告
|
|
23
|
+
*/
|
|
24
|
+
export interface ErrorReport {
|
|
25
|
+
/** 错误消息 */
|
|
26
|
+
message: string;
|
|
27
|
+
/** 错误堆栈 */
|
|
28
|
+
stack?: string;
|
|
29
|
+
/** 错误类型 */
|
|
30
|
+
type: 'error' | 'unhandledrejection' | 'resource' | 'runtime';
|
|
31
|
+
/** 发生时间 */
|
|
32
|
+
timestamp: number;
|
|
33
|
+
/** 页面 URL */
|
|
34
|
+
url: string;
|
|
35
|
+
/** 用户代理 */
|
|
36
|
+
userAgent: string;
|
|
37
|
+
/** 额外上下文 */
|
|
38
|
+
context?: Record<string, unknown>;
|
|
39
|
+
/** 追踪 ID */
|
|
40
|
+
traceId?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* 错误报告器
|
|
44
|
+
*/
|
|
45
|
+
export declare class ErrorReporter {
|
|
46
|
+
private config;
|
|
47
|
+
private traceId;
|
|
48
|
+
private boundHandlers;
|
|
49
|
+
constructor(config?: ErrorReporterConfig);
|
|
50
|
+
/**
|
|
51
|
+
* 开始监听全局错误
|
|
52
|
+
*/
|
|
53
|
+
start(): void;
|
|
54
|
+
/**
|
|
55
|
+
* 停止监听
|
|
56
|
+
*/
|
|
57
|
+
stop(): void;
|
|
58
|
+
/**
|
|
59
|
+
* 手动报告错误
|
|
60
|
+
*/
|
|
61
|
+
report(error: Error, context?: Record<string, unknown>): void;
|
|
62
|
+
/**
|
|
63
|
+
* 设置追踪 ID
|
|
64
|
+
*/
|
|
65
|
+
setTraceId(traceId: string): void;
|
|
66
|
+
private handleError;
|
|
67
|
+
private handleUnhandledRejection;
|
|
68
|
+
private shouldIgnore;
|
|
69
|
+
private truncateStack;
|
|
70
|
+
private defaultReporter;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* 创建错误报告器
|
|
74
|
+
*/
|
|
75
|
+
export declare function createErrorReporter(config?: ErrorReporterConfig): ErrorReporter;
|
|
76
|
+
//# sourceMappingURL=error-reporter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-reporter.d.ts","sourceRoot":"","sources":["../src/error-reporter.ts"],"names":[],"mappings":"AAAA;;GAEG;AA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