@xifan0/monitor-web 0.0.2-beta.15 → 0.0.2-beta.16

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/index.d.mts CHANGED
@@ -1,9 +1,34 @@
1
- import * as _xifan0_monitor_core from '@xifan0/monitor-core';
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
+ interface Monitor$1 {
12
+ init(options: any): any;
13
+ /** 上报异常 */
14
+ captureException(error: Error, ctx?: CaptureContext): any;
15
+ /** 发送消息/提醒/日志 */
16
+ captureMessage(message: string, ctx?: CaptureContext): any;
17
+ /** 设置用户信息 */
18
+ setUser(user: MonitorUser): any;
19
+ /** sentry事件 */
20
+ addBreadcrumb?(crumb: any): any;
21
+ setTag?(key: string, value: string): any;
22
+ setContext?(key: string, ctx: any): any;
23
+ withScope?(cb: (scope: any) => void): any;
24
+ /** 未声明事件的调用 */
25
+ [key: string]: any;
26
+ }
2
27
 
3
- declare const Monitor: _xifan0_monitor_core.Monitor;
28
+ declare const Monitor: Monitor$1;
4
29
  declare const init: (options: any) => any;
5
- declare const captureException: (error: Error, ctx?: _xifan0_monitor_core.CaptureContext) => any;
6
- declare const captureMessage: (message: string, ctx?: _xifan0_monitor_core.CaptureContext) => any;
7
- declare const setUser: (user: _xifan0_monitor_core.MonitorUser) => any;
30
+ declare const captureException: (error: Error, ctx?: CaptureContext) => any;
31
+ declare const captureMessage: (message: string, ctx?: CaptureContext) => any;
32
+ declare const setUser: (user: MonitorUser) => any;
8
33
 
9
34
  export { captureException, captureMessage, Monitor as default, init, setUser };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,34 @@
1
- import * as _xifan0_monitor_core from '@xifan0/monitor-core';
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
+ interface Monitor$1 {
12
+ init(options: any): any;
13
+ /** 上报异常 */
14
+ captureException(error: Error, ctx?: CaptureContext): any;
15
+ /** 发送消息/提醒/日志 */
16
+ captureMessage(message: string, ctx?: CaptureContext): any;
17
+ /** 设置用户信息 */
18
+ setUser(user: MonitorUser): any;
19
+ /** sentry事件 */
20
+ addBreadcrumb?(crumb: any): any;
21
+ setTag?(key: string, value: string): any;
22
+ setContext?(key: string, ctx: any): any;
23
+ withScope?(cb: (scope: any) => void): any;
24
+ /** 未声明事件的调用 */
25
+ [key: string]: any;
26
+ }
2
27
 
3
- declare const Monitor: _xifan0_monitor_core.Monitor;
28
+ declare const Monitor: Monitor$1;
4
29
  declare const init: (options: any) => any;
5
- declare const captureException: (error: Error, ctx?: _xifan0_monitor_core.CaptureContext) => any;
6
- declare const captureMessage: (message: string, ctx?: _xifan0_monitor_core.CaptureContext) => any;
7
- declare const setUser: (user: _xifan0_monitor_core.MonitorUser) => any;
30
+ declare const captureException: (error: Error, ctx?: CaptureContext) => any;
31
+ declare const captureMessage: (message: string, ctx?: CaptureContext) => any;
32
+ declare const setUser: (user: MonitorUser) => any;
8
33
 
9
34
  export { captureException, captureMessage, Monitor as default, init, setUser };
package/dist/index.js CHANGED
@@ -41,13 +41,11 @@ var Sentry = __toESM(require("@sentry/react"));
41
41
 
42
42
  // ../monitor-core/src/createMonitor.ts
43
43
  function createMonitor(sentry) {
44
- const sentryInstance = sentry && typeof sentry === "object" && sentry.default ? sentry.default : sentry;
44
+ const sentryInstance = (sentry == null ? void 0 : sentry.default) || sentry;
45
45
  const monitor = {
46
46
  init(options) {
47
47
  if (!sentryInstance || typeof sentryInstance.init !== "function") {
48
- throw new Error(
49
- "Sentry.init is not a function. Please ensure @sentry/react is properly imported."
50
- );
48
+ throw new Error("Sentry.init is not a function");
51
49
  }
52
50
  return sentryInstance.init(options);
53
51
  },
@@ -70,7 +68,8 @@ function createMonitor(sentry) {
70
68
  /** 设置用户信息 */
71
69
  setUser(user) {
72
70
  return sentryInstance.setUser(user);
73
- }
71
+ },
72
+ ErrorBoundary: sentryInstance.ErrorBoundary
74
73
  };
75
74
  const proxy = new Proxy(monitor, {
76
75
  get(target, key, receiver) {
package/dist/index.mjs CHANGED
@@ -3,13 +3,11 @@ import * as Sentry from "@sentry/react";
3
3
 
4
4
  // ../monitor-core/src/createMonitor.ts
5
5
  function createMonitor(sentry) {
6
- const sentryInstance = sentry && typeof sentry === "object" && sentry.default ? sentry.default : sentry;
6
+ const sentryInstance = (sentry == null ? void 0 : sentry.default) || sentry;
7
7
  const monitor = {
8
8
  init(options) {
9
9
  if (!sentryInstance || typeof sentryInstance.init !== "function") {
10
- throw new Error(
11
- "Sentry.init is not a function. Please ensure @sentry/react is properly imported."
12
- );
10
+ throw new Error("Sentry.init is not a function");
13
11
  }
14
12
  return sentryInstance.init(options);
15
13
  },
@@ -32,7 +30,8 @@ function createMonitor(sentry) {
32
30
  /** 设置用户信息 */
33
31
  setUser(user) {
34
32
  return sentryInstance.setUser(user);
35
- }
33
+ },
34
+ ErrorBoundary: sentryInstance.ErrorBoundary
36
35
  };
37
36
  const proxy = new Proxy(monitor, {
38
37
  get(target, key, receiver) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xifan0/monitor-web",
3
- "version": "0.0.2-beta.15",
3
+ "version": "0.0.2-beta.16",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
@@ -19,14 +19,12 @@
19
19
  "@sentry/react": "^7"
20
20
  },
21
21
  "dependencies": {
22
- "@sentry/react": "^7",
23
- "@xifan0/monitor-core": "0.0.2-beta.15"
22
+ "@sentry/react": "^7"
24
23
  },
25
24
  "devDependencies": {
26
- "@sentry/react": "^7",
27
25
  "typescript": "^5",
28
26
  "tsup": "^8.5.1",
29
- "@xifan0/monitor-core": "0.0.2-beta.15"
27
+ "@xifan0/monitor-core": "0.0.2-beta.16"
30
28
  },
31
29
  "scripts": {
32
30
  "build": "tsup --dts"