@xifan052/monitor 0.0.1
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/baseClient--kldMm4n.d.ts +14 -0
- package/dist/baseClient-CStLSuih.d.cts +23 -0
- package/dist/baseClient-Ce8FQx7I.d.ts +23 -0
- package/dist/baseClient-CpBY_Ydd.d.cts +23 -0
- package/dist/baseClient-CpBY_Ydd.d.ts +23 -0
- package/dist/baseClient-CzPUJKaJ.d.ts +13 -0
- package/dist/baseClient-Dq6Nxof9.d.cts +14 -0
- package/dist/baseClient-DuhASKYf.d.cts +13 -0
- package/dist/index.cjs +18 -0
- package/dist/index.d.cts +12 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +0 -0
- package/dist/metro.cjs +24 -0
- package/dist/metro.d.cts +1 -0
- package/dist/metro.d.ts +1 -0
- package/dist/metro.js +2 -0
- package/dist/rn.cjs +98 -0
- package/dist/rn.d.cts +9 -0
- package/dist/rn.d.ts +9 -0
- package/dist/rn.js +63 -0
- package/dist/web.cjs +98 -0
- package/dist/web.d.cts +9 -0
- package/dist/web.d.ts +9 -0
- package/dist/web.js +63 -0
- package/package.json +49 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CaptureContext, MonitorUser } from './index.js';
|
|
2
|
+
|
|
3
|
+
declare abstract class BaseClient {
|
|
4
|
+
protected sentry: any;
|
|
5
|
+
protected options: any;
|
|
6
|
+
constructor(sentry: any, options: any);
|
|
7
|
+
init(): void;
|
|
8
|
+
captureException(error: Error, ctx?: CaptureContext): void;
|
|
9
|
+
captureMessage(message: string, ctx?: CaptureContext): void;
|
|
10
|
+
setUser(user: MonitorUser): void;
|
|
11
|
+
get ErrorBoundary(): any;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { BaseClient as B };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { CaptureContext, MonitorUser } from './index.cjs';
|
|
2
|
+
|
|
3
|
+
declare abstract class BaseClient {
|
|
4
|
+
protected sentry: any;
|
|
5
|
+
protected options: any;
|
|
6
|
+
constructor(sentry: any, options: any);
|
|
7
|
+
init(): void;
|
|
8
|
+
/**
|
|
9
|
+
* 上报异常
|
|
10
|
+
* @param error - 捕获的Error对象
|
|
11
|
+
* @param ctx - 上下文信息,tags:错误分组;extra:错误的参数json信息
|
|
12
|
+
*/
|
|
13
|
+
captureException(error: Error, ctx?: CaptureContext): void;
|
|
14
|
+
/**
|
|
15
|
+
* 上报自定义消息
|
|
16
|
+
* @param message - 文本消息
|
|
17
|
+
* @param ctx - 上下文信息,tags:错误分组;extra:本条消息相关的参数json
|
|
18
|
+
*/
|
|
19
|
+
captureMessage(message: string, ctx?: CaptureContext): void;
|
|
20
|
+
setUser(user: MonitorUser): void;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { BaseClient as B };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { CaptureContext, MonitorUser } from './index.js';
|
|
2
|
+
|
|
3
|
+
declare abstract class BaseClient {
|
|
4
|
+
protected sentry: any;
|
|
5
|
+
protected options: any;
|
|
6
|
+
constructor(sentry: any, options: any);
|
|
7
|
+
init(): void;
|
|
8
|
+
/**
|
|
9
|
+
* 上报异常
|
|
10
|
+
* @param error - 捕获的Error对象
|
|
11
|
+
* @param ctx - 上下文信息,tags:错误分组;extra:错误的参数json信息
|
|
12
|
+
*/
|
|
13
|
+
captureException(error: Error, ctx?: CaptureContext): void;
|
|
14
|
+
/**
|
|
15
|
+
* 上报自定义消息
|
|
16
|
+
* @param message - 文本消息
|
|
17
|
+
* @param ctx - 上下文信息,tags:错误分组;extra:本条消息相关的参数json
|
|
18
|
+
*/
|
|
19
|
+
captureMessage(message: string, ctx?: CaptureContext): void;
|
|
20
|
+
setUser(user: MonitorUser): void;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { BaseClient as B };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
interface MonitorUser {
|
|
2
|
+
id?: string;
|
|
3
|
+
email?: string;
|
|
4
|
+
username?: string;
|
|
5
|
+
[key: string]: string | undefined;
|
|
6
|
+
}
|
|
7
|
+
interface CaptureContext {
|
|
8
|
+
tags?: Record<string, string>;
|
|
9
|
+
extra?: Record<string, any>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
declare abstract class BaseClient {
|
|
13
|
+
protected sentry: any;
|
|
14
|
+
protected options: any;
|
|
15
|
+
constructor(sentry: any, options: any);
|
|
16
|
+
init(): void;
|
|
17
|
+
captureException(error: Error, ctx?: CaptureContext): void;
|
|
18
|
+
captureMessage(message: string, ctx?: CaptureContext): void;
|
|
19
|
+
setUser(user: MonitorUser): void;
|
|
20
|
+
get ErrorBoundary(): any;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { BaseClient as B, type CaptureContext as C, type MonitorUser as M };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
interface MonitorUser {
|
|
2
|
+
id?: string;
|
|
3
|
+
email?: string;
|
|
4
|
+
username?: string;
|
|
5
|
+
[key: string]: string | undefined;
|
|
6
|
+
}
|
|
7
|
+
interface CaptureContext {
|
|
8
|
+
tags?: Record<string, string>;
|
|
9
|
+
extra?: Record<string, any>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
declare abstract class BaseClient {
|
|
13
|
+
protected sentry: any;
|
|
14
|
+
protected options: any;
|
|
15
|
+
constructor(sentry: any, options: any);
|
|
16
|
+
init(): void;
|
|
17
|
+
captureException(error: Error, ctx?: CaptureContext): void;
|
|
18
|
+
captureMessage(message: string, ctx?: CaptureContext): void;
|
|
19
|
+
setUser(user: MonitorUser): void;
|
|
20
|
+
get ErrorBoundary(): any;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { BaseClient as B, type CaptureContext as C, type MonitorUser as M };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CaptureContext, MonitorUser } from './index.js';
|
|
2
|
+
|
|
3
|
+
declare abstract class BaseClient {
|
|
4
|
+
protected sentry: any;
|
|
5
|
+
protected options: any;
|
|
6
|
+
constructor(sentry: any, options: any);
|
|
7
|
+
init(): void;
|
|
8
|
+
captureException(error: Error, ctx?: CaptureContext): void;
|
|
9
|
+
captureMessage(message: string, ctx?: CaptureContext): void;
|
|
10
|
+
setUser(user: MonitorUser): void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { BaseClient as B };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CaptureContext, MonitorUser } from './index.cjs';
|
|
2
|
+
|
|
3
|
+
declare abstract class BaseClient {
|
|
4
|
+
protected sentry: any;
|
|
5
|
+
protected options: any;
|
|
6
|
+
constructor(sentry: any, options: any);
|
|
7
|
+
init(): void;
|
|
8
|
+
captureException(error: Error, ctx?: CaptureContext): void;
|
|
9
|
+
captureMessage(message: string, ctx?: CaptureContext): void;
|
|
10
|
+
setUser(user: MonitorUser): void;
|
|
11
|
+
get ErrorBoundary(): any;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { BaseClient as B };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CaptureContext, MonitorUser } from './index.cjs';
|
|
2
|
+
|
|
3
|
+
declare abstract class BaseClient {
|
|
4
|
+
protected sentry: any;
|
|
5
|
+
protected options: any;
|
|
6
|
+
constructor(sentry: any, options: any);
|
|
7
|
+
init(): void;
|
|
8
|
+
captureException(error: Error, ctx?: CaptureContext): void;
|
|
9
|
+
captureMessage(message: string, ctx?: CaptureContext): void;
|
|
10
|
+
setUser(user: MonitorUser): void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { BaseClient as B };
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
|
|
16
|
+
// src/index.ts
|
|
17
|
+
var src_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(src_exports);
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface MonitorUser {
|
|
2
|
+
id?: string;
|
|
3
|
+
email?: string;
|
|
4
|
+
username?: string;
|
|
5
|
+
[key: string]: string | undefined;
|
|
6
|
+
}
|
|
7
|
+
interface CaptureContext {
|
|
8
|
+
tags?: Record<string, string>;
|
|
9
|
+
extra?: Record<string, any>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type { CaptureContext, MonitorUser };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface MonitorUser {
|
|
2
|
+
id?: string;
|
|
3
|
+
email?: string;
|
|
4
|
+
username?: string;
|
|
5
|
+
[key: string]: string | undefined;
|
|
6
|
+
}
|
|
7
|
+
interface CaptureContext {
|
|
8
|
+
tags?: Record<string, string>;
|
|
9
|
+
extra?: Record<string, any>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type { CaptureContext, MonitorUser };
|
package/dist/index.js
ADDED
|
File without changes
|
package/dist/metro.cjs
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
|
|
17
|
+
// src/adapter/rn/metro.ts
|
|
18
|
+
var metro_exports = {};
|
|
19
|
+
module.exports = __toCommonJS(metro_exports);
|
|
20
|
+
__reExport(metro_exports, require("@sentry/react-native/metro"), module.exports);
|
|
21
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
22
|
+
0 && (module.exports = {
|
|
23
|
+
...require("@sentry/react-native/metro")
|
|
24
|
+
});
|
package/dist/metro.d.cts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@sentry/react-native/metro';
|
package/dist/metro.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@sentry/react-native/metro';
|
package/dist/metro.js
ADDED
package/dist/rn.cjs
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/adapter/rn/index.ts
|
|
31
|
+
var rn_exports = {};
|
|
32
|
+
__export(rn_exports, {
|
|
33
|
+
MonitorClient: () => MonitorClient
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(rn_exports);
|
|
36
|
+
var Sentry = __toESM(require("@sentry/react-native"), 1);
|
|
37
|
+
|
|
38
|
+
// src/core/baseClient.ts
|
|
39
|
+
var BaseClient = class {
|
|
40
|
+
constructor(sentry, options) {
|
|
41
|
+
this.sentry = sentry;
|
|
42
|
+
this.options = options;
|
|
43
|
+
}
|
|
44
|
+
init() {
|
|
45
|
+
this.sentry.init(this.options);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* 上报异常
|
|
49
|
+
* @param error - 捕获的Error对象
|
|
50
|
+
* @param ctx - 上下文信息,tags:错误分组;extra:错误的参数json信息
|
|
51
|
+
*/
|
|
52
|
+
captureException(error, ctx) {
|
|
53
|
+
this.sentry.captureException(error, (scope) => {
|
|
54
|
+
(ctx == null ? void 0 : ctx.tags) && scope.setTags(ctx.tags);
|
|
55
|
+
(ctx == null ? void 0 : ctx.extra) && scope.setExtras(ctx.extra);
|
|
56
|
+
return scope;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* 上报自定义消息
|
|
61
|
+
* @param message - 文本消息
|
|
62
|
+
* @param ctx - 上下文信息,tags:错误分组;extra:本条消息相关的参数json
|
|
63
|
+
*/
|
|
64
|
+
captureMessage(message, ctx) {
|
|
65
|
+
this.sentry.captureMessage(message, (scope) => {
|
|
66
|
+
(ctx == null ? void 0 : ctx.tags) && scope.setTags(ctx.tags);
|
|
67
|
+
(ctx == null ? void 0 : ctx.extra) && scope.setExtras(ctx.extra);
|
|
68
|
+
return scope;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
// 设置当前用户信息
|
|
72
|
+
setUser(user) {
|
|
73
|
+
this.sentry.setUser(user);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
// src/adapter/rn/index.ts
|
|
78
|
+
var MonitorClient = class extends BaseClient {
|
|
79
|
+
constructor(options) {
|
|
80
|
+
super(Sentry, options);
|
|
81
|
+
return new Proxy(this, {
|
|
82
|
+
get(target, key, receiver) {
|
|
83
|
+
if (key in target) {
|
|
84
|
+
return Reflect.get(target, key, receiver);
|
|
85
|
+
}
|
|
86
|
+
const sentryValue = Sentry[key];
|
|
87
|
+
if (typeof sentryValue === "function") {
|
|
88
|
+
return sentryValue.bind(Sentry);
|
|
89
|
+
}
|
|
90
|
+
return sentryValue;
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
96
|
+
0 && (module.exports = {
|
|
97
|
+
MonitorClient
|
|
98
|
+
});
|
package/dist/rn.d.cts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactNativeOptions } from '@sentry/react-native';
|
|
2
|
+
import { B as BaseClient } from './baseClient-CStLSuih.cjs';
|
|
3
|
+
import './index.cjs';
|
|
4
|
+
|
|
5
|
+
declare class MonitorClient extends BaseClient {
|
|
6
|
+
constructor(options: ReactNativeOptions);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export { MonitorClient };
|
package/dist/rn.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactNativeOptions } from '@sentry/react-native';
|
|
2
|
+
import { B as BaseClient } from './baseClient-Ce8FQx7I.js';
|
|
3
|
+
import './index.js';
|
|
4
|
+
|
|
5
|
+
declare class MonitorClient extends BaseClient {
|
|
6
|
+
constructor(options: ReactNativeOptions);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export { MonitorClient };
|
package/dist/rn.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// src/adapter/rn/index.ts
|
|
2
|
+
import * as Sentry from "@sentry/react-native";
|
|
3
|
+
|
|
4
|
+
// src/core/baseClient.ts
|
|
5
|
+
var BaseClient = class {
|
|
6
|
+
constructor(sentry, options) {
|
|
7
|
+
this.sentry = sentry;
|
|
8
|
+
this.options = options;
|
|
9
|
+
}
|
|
10
|
+
init() {
|
|
11
|
+
this.sentry.init(this.options);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* 上报异常
|
|
15
|
+
* @param error - 捕获的Error对象
|
|
16
|
+
* @param ctx - 上下文信息,tags:错误分组;extra:错误的参数json信息
|
|
17
|
+
*/
|
|
18
|
+
captureException(error, ctx) {
|
|
19
|
+
this.sentry.captureException(error, (scope) => {
|
|
20
|
+
(ctx == null ? void 0 : ctx.tags) && scope.setTags(ctx.tags);
|
|
21
|
+
(ctx == null ? void 0 : ctx.extra) && scope.setExtras(ctx.extra);
|
|
22
|
+
return scope;
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* 上报自定义消息
|
|
27
|
+
* @param message - 文本消息
|
|
28
|
+
* @param ctx - 上下文信息,tags:错误分组;extra:本条消息相关的参数json
|
|
29
|
+
*/
|
|
30
|
+
captureMessage(message, ctx) {
|
|
31
|
+
this.sentry.captureMessage(message, (scope) => {
|
|
32
|
+
(ctx == null ? void 0 : ctx.tags) && scope.setTags(ctx.tags);
|
|
33
|
+
(ctx == null ? void 0 : ctx.extra) && scope.setExtras(ctx.extra);
|
|
34
|
+
return scope;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
// 设置当前用户信息
|
|
38
|
+
setUser(user) {
|
|
39
|
+
this.sentry.setUser(user);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// src/adapter/rn/index.ts
|
|
44
|
+
var MonitorClient = class extends BaseClient {
|
|
45
|
+
constructor(options) {
|
|
46
|
+
super(Sentry, options);
|
|
47
|
+
return new Proxy(this, {
|
|
48
|
+
get(target, key, receiver) {
|
|
49
|
+
if (key in target) {
|
|
50
|
+
return Reflect.get(target, key, receiver);
|
|
51
|
+
}
|
|
52
|
+
const sentryValue = Sentry[key];
|
|
53
|
+
if (typeof sentryValue === "function") {
|
|
54
|
+
return sentryValue.bind(Sentry);
|
|
55
|
+
}
|
|
56
|
+
return sentryValue;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
export {
|
|
62
|
+
MonitorClient
|
|
63
|
+
};
|
package/dist/web.cjs
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/adapter/web/index.ts
|
|
31
|
+
var web_exports = {};
|
|
32
|
+
__export(web_exports, {
|
|
33
|
+
MonitorClient: () => MonitorClient
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(web_exports);
|
|
36
|
+
var Sentry = __toESM(require("@sentry/react"), 1);
|
|
37
|
+
|
|
38
|
+
// src/core/baseClient.ts
|
|
39
|
+
var BaseClient = class {
|
|
40
|
+
constructor(sentry, options) {
|
|
41
|
+
this.sentry = sentry;
|
|
42
|
+
this.options = options;
|
|
43
|
+
}
|
|
44
|
+
init() {
|
|
45
|
+
this.sentry.init(this.options);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* 上报异常
|
|
49
|
+
* @param error - 捕获的Error对象
|
|
50
|
+
* @param ctx - 上下文信息,tags:错误分组;extra:错误的参数json信息
|
|
51
|
+
*/
|
|
52
|
+
captureException(error, ctx) {
|
|
53
|
+
this.sentry.captureException(error, (scope) => {
|
|
54
|
+
(ctx == null ? void 0 : ctx.tags) && scope.setTags(ctx.tags);
|
|
55
|
+
(ctx == null ? void 0 : ctx.extra) && scope.setExtras(ctx.extra);
|
|
56
|
+
return scope;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* 上报自定义消息
|
|
61
|
+
* @param message - 文本消息
|
|
62
|
+
* @param ctx - 上下文信息,tags:错误分组;extra:本条消息相关的参数json
|
|
63
|
+
*/
|
|
64
|
+
captureMessage(message, ctx) {
|
|
65
|
+
this.sentry.captureMessage(message, (scope) => {
|
|
66
|
+
(ctx == null ? void 0 : ctx.tags) && scope.setTags(ctx.tags);
|
|
67
|
+
(ctx == null ? void 0 : ctx.extra) && scope.setExtras(ctx.extra);
|
|
68
|
+
return scope;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
// 设置当前用户信息
|
|
72
|
+
setUser(user) {
|
|
73
|
+
this.sentry.setUser(user);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
// src/adapter/web/index.ts
|
|
78
|
+
var MonitorClient = class extends BaseClient {
|
|
79
|
+
constructor(options) {
|
|
80
|
+
super(Sentry, options);
|
|
81
|
+
return new Proxy(this, {
|
|
82
|
+
get(target, key, receiver) {
|
|
83
|
+
if (key in target) {
|
|
84
|
+
return Reflect.get(target, key, receiver);
|
|
85
|
+
}
|
|
86
|
+
const sentryValue = Sentry[key];
|
|
87
|
+
if (typeof sentryValue === "function") {
|
|
88
|
+
return sentryValue.bind(Sentry);
|
|
89
|
+
}
|
|
90
|
+
return sentryValue;
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
96
|
+
0 && (module.exports = {
|
|
97
|
+
MonitorClient
|
|
98
|
+
});
|
package/dist/web.d.cts
ADDED
package/dist/web.d.ts
ADDED
package/dist/web.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// src/adapter/web/index.ts
|
|
2
|
+
import * as Sentry from "@sentry/react";
|
|
3
|
+
|
|
4
|
+
// src/core/baseClient.ts
|
|
5
|
+
var BaseClient = class {
|
|
6
|
+
constructor(sentry, options) {
|
|
7
|
+
this.sentry = sentry;
|
|
8
|
+
this.options = options;
|
|
9
|
+
}
|
|
10
|
+
init() {
|
|
11
|
+
this.sentry.init(this.options);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* 上报异常
|
|
15
|
+
* @param error - 捕获的Error对象
|
|
16
|
+
* @param ctx - 上下文信息,tags:错误分组;extra:错误的参数json信息
|
|
17
|
+
*/
|
|
18
|
+
captureException(error, ctx) {
|
|
19
|
+
this.sentry.captureException(error, (scope) => {
|
|
20
|
+
(ctx == null ? void 0 : ctx.tags) && scope.setTags(ctx.tags);
|
|
21
|
+
(ctx == null ? void 0 : ctx.extra) && scope.setExtras(ctx.extra);
|
|
22
|
+
return scope;
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* 上报自定义消息
|
|
27
|
+
* @param message - 文本消息
|
|
28
|
+
* @param ctx - 上下文信息,tags:错误分组;extra:本条消息相关的参数json
|
|
29
|
+
*/
|
|
30
|
+
captureMessage(message, ctx) {
|
|
31
|
+
this.sentry.captureMessage(message, (scope) => {
|
|
32
|
+
(ctx == null ? void 0 : ctx.tags) && scope.setTags(ctx.tags);
|
|
33
|
+
(ctx == null ? void 0 : ctx.extra) && scope.setExtras(ctx.extra);
|
|
34
|
+
return scope;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
// 设置当前用户信息
|
|
38
|
+
setUser(user) {
|
|
39
|
+
this.sentry.setUser(user);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// src/adapter/web/index.ts
|
|
44
|
+
var MonitorClient = class extends BaseClient {
|
|
45
|
+
constructor(options) {
|
|
46
|
+
super(Sentry, options);
|
|
47
|
+
return new Proxy(this, {
|
|
48
|
+
get(target, key, receiver) {
|
|
49
|
+
if (key in target) {
|
|
50
|
+
return Reflect.get(target, key, receiver);
|
|
51
|
+
}
|
|
52
|
+
const sentryValue = Sentry[key];
|
|
53
|
+
if (typeof sentryValue === "function") {
|
|
54
|
+
return sentryValue.bind(Sentry);
|
|
55
|
+
}
|
|
56
|
+
return sentryValue;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
export {
|
|
62
|
+
MonitorClient
|
|
63
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@xifan052/monitor",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "dist/index.cjs",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"sideEffects": false,
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"exports": {
|
|
13
|
+
"./web": {
|
|
14
|
+
"types": "./dist/web.d.ts",
|
|
15
|
+
"import": "./dist/web.js",
|
|
16
|
+
"require": "./dist/web.cjs"
|
|
17
|
+
},
|
|
18
|
+
"./rn": {
|
|
19
|
+
"types": "./dist/rn.d.ts",
|
|
20
|
+
"import": "./dist/rn.js",
|
|
21
|
+
"require": "./dist/rn.cjs"
|
|
22
|
+
},
|
|
23
|
+
"./metro": {
|
|
24
|
+
"import": "./dist/metro.mjs",
|
|
25
|
+
"require": "./dist/metro.js"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "tsup --dts",
|
|
30
|
+
"changeset": "changeset",
|
|
31
|
+
"version": "changeset version",
|
|
32
|
+
"release": "changeset publish",
|
|
33
|
+
"test": "vitest",
|
|
34
|
+
"prepublishOnly": "pnpm build"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"@sentry/react": "^7",
|
|
38
|
+
"@sentry/react-native": "^5"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@changesets/cli": "^2.27.10",
|
|
42
|
+
"jsdom": "^27.3.0",
|
|
43
|
+
"typescript": "^5",
|
|
44
|
+
"vitest": "^1"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"tsup": "^8.5.1"
|
|
48
|
+
}
|
|
49
|
+
}
|