@xifan052/monitor 0.1.5 → 0.1.7

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.
@@ -12,7 +12,6 @@ interface CaptureContext {
12
12
  declare abstract class BaseClient {
13
13
  protected sentry: any;
14
14
  protected options: any;
15
- protected initialized: boolean;
16
15
  constructor(sentry: any, options: any);
17
16
  init(): void;
18
17
  captureException(error: Error, ctx?: CaptureContext): void;
@@ -12,7 +12,6 @@ interface CaptureContext {
12
12
  declare abstract class BaseClient {
13
13
  protected sentry: any;
14
14
  protected options: any;
15
- protected initialized: boolean;
16
15
  constructor(sentry: any, options: any);
17
16
  init(): void;
18
17
  captureException(error: Error, ctx?: CaptureContext): void;
package/dist/index.cjs CHANGED
@@ -36,19 +36,16 @@ __export(src_exports, {
36
36
  module.exports = __toCommonJS(src_exports);
37
37
 
38
38
  // src/adapter/web/index.ts
39
- var Sentry = __toESM(require("@sentry/react"), 1);
39
+ var Sentry = __toESM(require("@sentry/browser"), 1);
40
40
 
41
41
  // src/core/baseClient.ts
42
42
  var BaseClient = class {
43
43
  constructor(sentry, options) {
44
44
  this.sentry = sentry;
45
45
  this.options = options;
46
- this.initialized = false;
47
46
  }
48
47
  init() {
49
- if (this.initialized) return;
50
48
  this.sentry.init(this.options);
51
- this.initialized = true;
52
49
  }
53
50
  captureException(error, ctx) {
54
51
  this.sentry.captureException(error, (scope) => {
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- export { C as CaptureContext, M as MonitorUser } from './baseClient-C7eELcmN.cjs';
1
+ export { C as CaptureContext, M as MonitorUser } from './baseClient-CpBY_Ydd.cjs';
2
2
  export { WebMonitorClient } from './web.cjs';
3
3
  export { RNMonitorClient } from './rn.cjs';
4
- import '@sentry/react';
4
+ import '@sentry/browser';
5
5
  import '@sentry/react-native';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export { C as CaptureContext, M as MonitorUser } from './baseClient-C7eELcmN.js';
1
+ export { C as CaptureContext, M as MonitorUser } from './baseClient-CpBY_Ydd.js';
2
2
  export { WebMonitorClient } from './web.js';
3
3
  export { RNMonitorClient } from './rn.js';
4
- import '@sentry/react';
4
+ import '@sentry/browser';
5
5
  import '@sentry/react-native';
package/dist/index.js CHANGED
@@ -1,17 +1,14 @@
1
1
  // src/adapter/web/index.ts
2
- import * as Sentry from "@sentry/react";
2
+ import * as Sentry from "@sentry/browser";
3
3
 
4
4
  // src/core/baseClient.ts
5
5
  var BaseClient = class {
6
6
  constructor(sentry, options) {
7
7
  this.sentry = sentry;
8
8
  this.options = options;
9
- this.initialized = false;
10
9
  }
11
10
  init() {
12
- if (this.initialized) return;
13
11
  this.sentry.init(this.options);
14
- this.initialized = true;
15
12
  }
16
13
  captureException(error, ctx) {
17
14
  this.sentry.captureException(error, (scope) => {
package/dist/rn.cjs CHANGED
@@ -40,12 +40,9 @@ var BaseClient = class {
40
40
  constructor(sentry, options) {
41
41
  this.sentry = sentry;
42
42
  this.options = options;
43
- this.initialized = false;
44
43
  }
45
44
  init() {
46
- if (this.initialized) return;
47
45
  this.sentry.init(this.options);
48
- this.initialized = true;
49
46
  }
50
47
  captureException(error, ctx) {
51
48
  this.sentry.captureException(error, (scope) => {
package/dist/rn.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as Sentry from '@sentry/react-native';
2
- import { B as BaseClient } from './baseClient-C7eELcmN.cjs';
2
+ import { B as BaseClient } from './baseClient-CpBY_Ydd.cjs';
3
3
 
4
4
  declare class RNMonitorClient extends BaseClient {
5
5
  constructor(options: Sentry.ReactNativeOptions);
package/dist/rn.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as Sentry from '@sentry/react-native';
2
- import { B as BaseClient } from './baseClient-C7eELcmN.js';
2
+ import { B as BaseClient } from './baseClient-CpBY_Ydd.js';
3
3
 
4
4
  declare class RNMonitorClient extends BaseClient {
5
5
  constructor(options: Sentry.ReactNativeOptions);
package/dist/rn.js CHANGED
@@ -6,12 +6,9 @@ var BaseClient = class {
6
6
  constructor(sentry, options) {
7
7
  this.sentry = sentry;
8
8
  this.options = options;
9
- this.initialized = false;
10
9
  }
11
10
  init() {
12
- if (this.initialized) return;
13
11
  this.sentry.init(this.options);
14
- this.initialized = true;
15
12
  }
16
13
  captureException(error, ctx) {
17
14
  this.sentry.captureException(error, (scope) => {
package/dist/web.cjs CHANGED
@@ -33,19 +33,16 @@ __export(web_exports, {
33
33
  WebMonitorClient: () => WebMonitorClient
34
34
  });
35
35
  module.exports = __toCommonJS(web_exports);
36
- var Sentry = __toESM(require("@sentry/react"), 1);
36
+ var Sentry = __toESM(require("@sentry/browser"), 1);
37
37
 
38
38
  // src/core/baseClient.ts
39
39
  var BaseClient = class {
40
40
  constructor(sentry, options) {
41
41
  this.sentry = sentry;
42
42
  this.options = options;
43
- this.initialized = false;
44
43
  }
45
44
  init() {
46
- if (this.initialized) return;
47
45
  this.sentry.init(this.options);
48
- this.initialized = true;
49
46
  }
50
47
  captureException(error, ctx) {
51
48
  this.sentry.captureException(error, (scope) => {
package/dist/web.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import * as Sentry from '@sentry/react';
2
- import { B as BaseClient } from './baseClient-C7eELcmN.cjs';
1
+ import * as Sentry from '@sentry/browser';
2
+ import { B as BaseClient } from './baseClient-CpBY_Ydd.cjs';
3
3
 
4
4
  declare class WebMonitorClient extends BaseClient {
5
5
  constructor(options: Sentry.BrowserOptions);
package/dist/web.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import * as Sentry from '@sentry/react';
2
- import { B as BaseClient } from './baseClient-C7eELcmN.js';
1
+ import * as Sentry from '@sentry/browser';
2
+ import { B as BaseClient } from './baseClient-CpBY_Ydd.js';
3
3
 
4
4
  declare class WebMonitorClient extends BaseClient {
5
5
  constructor(options: Sentry.BrowserOptions);
package/dist/web.js CHANGED
@@ -1,17 +1,14 @@
1
1
  // src/adapter/web/index.ts
2
- import * as Sentry from "@sentry/react";
2
+ import * as Sentry from "@sentry/browser";
3
3
 
4
4
  // src/core/baseClient.ts
5
5
  var BaseClient = class {
6
6
  constructor(sentry, options) {
7
7
  this.sentry = sentry;
8
8
  this.options = options;
9
- this.initialized = false;
10
9
  }
11
10
  init() {
12
- if (this.initialized) return;
13
11
  this.sentry.init(this.options);
14
- this.initialized = true;
15
12
  }
16
13
  captureException(error, ctx) {
17
14
  this.sentry.captureException(error, (scope) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xifan052/monitor",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -26,8 +26,16 @@
26
26
  "require": "./dist/rn.cjs"
27
27
  }
28
28
  },
29
+ "scripts": {
30
+ "build": "tsup --dts",
31
+ "changeset": "changeset",
32
+ "version": "changeset version",
33
+ "release": "changeset publish",
34
+ "test": "vitest",
35
+ "prepublishOnly": "pnpm build"
36
+ },
29
37
  "peerDependencies": {
30
- "@sentry/react": "^7",
38
+ "@sentry/browser": "^7",
31
39
  "@sentry/react-native": "^5"
32
40
  },
33
41
  "devDependencies": {
@@ -36,14 +44,6 @@
36
44
  "vitest": "^1"
37
45
  },
38
46
  "dependencies": {
39
- "tsup": "^8.5.1",
40
- "tslib": "^2.8.1"
41
- },
42
- "scripts": {
43
- "build": "tsup --dts",
44
- "changeset": "changeset",
45
- "version": "changeset version",
46
- "release": "changeset publish",
47
- "test": "vitest"
47
+ "tsup": "^8.5.1"
48
48
  }
49
- }
49
+ }
@@ -1,5 +0,0 @@
1
- import * as Sentry from "@sentry/react-native";
2
- import { BaseClient } from "../../core/baseClient";
3
- export declare class RNMonitorClient extends BaseClient {
4
- constructor(options: Sentry.ReactNativeOptions);
5
- }
@@ -1,7 +0,0 @@
1
- import * as Sentry from "@sentry/react-native";
2
- import { BaseClient } from "../../core/baseClient";
3
- export class RNMonitorClient extends BaseClient {
4
- constructor(options) {
5
- super(Sentry, options);
6
- }
7
- }
@@ -1,5 +0,0 @@
1
- import * as Sentry from "@sentry/browser";
2
- import { BaseClient } from "../../core/baseClient";
3
- export declare class WebMonitorClient extends BaseClient {
4
- constructor(options: Sentry.BrowserOptions);
5
- }
@@ -1,7 +0,0 @@
1
- import * as Sentry from "@sentry/browser";
2
- import { BaseClient } from "../../core/baseClient";
3
- export class WebMonitorClient extends BaseClient {
4
- constructor(options) {
5
- super(Sentry, options);
6
- }
7
- }
@@ -1,27 +0,0 @@
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
- /**
13
- * 通用的 Sentry 客户端实现
14
- * 接受 Sentry 实例和初始化选项作为参数
15
- */
16
- declare class BaseClient {
17
- private sentry;
18
- private options;
19
- constructor(sentry: any, options: any);
20
- init(): void;
21
- captureException(error: Error, ctx?: CaptureContext): void;
22
- captureMessage1(message: string, ctx?: CaptureContext): void;
23
- setUser(user: MonitorUser): void;
24
- get ErrorBoundary(): any;
25
- }
26
-
27
- export { BaseClient as B, type CaptureContext as C, type MonitorUser as M };
@@ -1,27 +0,0 @@
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
- /**
13
- * 通用的 Sentry 客户端实现
14
- * 接受 Sentry 实例和初始化选项作为参数
15
- */
16
- declare class BaseClient {
17
- private sentry;
18
- private options;
19
- constructor(sentry: any, options: any);
20
- init(): void;
21
- captureException(error: Error, ctx?: CaptureContext): void;
22
- captureMessage1(message: string, ctx?: CaptureContext): void;
23
- setUser(user: MonitorUser): void;
24
- get ErrorBoundary(): any;
25
- }
26
-
27
- export { BaseClient as B, type CaptureContext as C, type MonitorUser as M };
@@ -1,27 +0,0 @@
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
- /**
13
- * 通用的 Sentry 客户端实现
14
- * 接受 Sentry 实例和初始化选项作为参数
15
- */
16
- declare class BaseClient {
17
- private sentry;
18
- private options;
19
- constructor(sentry: any, options: any);
20
- init(): void;
21
- captureException(error: Error, ctx?: CaptureContext): void;
22
- captureMessage1(message: string, ctx?: CaptureContext): void;
23
- setUser(user: MonitorUser): void;
24
- ErrorBoundary(): any;
25
- }
26
-
27
- export { BaseClient as B, type CaptureContext as C, type MonitorUser as M };
@@ -1,27 +0,0 @@
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
- /**
13
- * 通用的 Sentry 客户端实现
14
- * 接受 Sentry 实例和初始化选项作为参数
15
- */
16
- declare class BaseClient {
17
- private sentry;
18
- private options;
19
- constructor(sentry: any, options: any);
20
- init(): void;
21
- captureException(error: Error, ctx?: CaptureContext): void;
22
- captureMessage1(message: string, ctx?: CaptureContext): void;
23
- setUser(user: MonitorUser): void;
24
- ErrorBoundary(): any;
25
- }
26
-
27
- export { BaseClient as B, type CaptureContext as C, type MonitorUser as M };
@@ -1,27 +0,0 @@
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
- /**
13
- * 通用的 Sentry 客户端实现
14
- * 接受 Sentry 实例和初始化选项作为参数
15
- */
16
- declare class BaseClient {
17
- private sentry;
18
- private options;
19
- constructor(sentry: any, options: any);
20
- init(): void;
21
- captureException(error: Error, ctx?: CaptureContext): void;
22
- captureMessage(message: string, ctx?: CaptureContext): void;
23
- setUser(user: MonitorUser): void;
24
- ErrorBoundary(): any;
25
- }
26
-
27
- export { BaseClient as B, type CaptureContext as C, type MonitorUser as M };
@@ -1,27 +0,0 @@
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
- /**
13
- * 通用的 Sentry 客户端实现
14
- * 接受 Sentry 实例和初始化选项作为参数
15
- */
16
- declare class BaseClient {
17
- private sentry;
18
- private options;
19
- constructor(sentry: any, options: any);
20
- init(): void;
21
- captureException(error: Error, ctx?: CaptureContext): void;
22
- captureMessage(message: string, ctx?: CaptureContext): void;
23
- setUser(user: MonitorUser): void;
24
- ErrorBoundary(): any;
25
- }
26
-
27
- export { BaseClient as B, type CaptureContext as C, type MonitorUser as M };
@@ -1,26 +0,0 @@
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
- /**
13
- * 通用的 Sentry 客户端实现
14
- * 接受 Sentry 实例和初始化选项作为参数
15
- */
16
- declare class BaseClient {
17
- private sentry;
18
- private options;
19
- constructor(sentry: any, options: any);
20
- init(): void;
21
- captureException(error: Error, ctx?: CaptureContext): void;
22
- captureMessage1(message: string, ctx?: CaptureContext): void;
23
- setUser(user: MonitorUser): void;
24
- }
25
-
26
- export { BaseClient as B, type CaptureContext as C, type MonitorUser as M };
@@ -1,26 +0,0 @@
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
- /**
13
- * 通用的 Sentry 客户端实现
14
- * 接受 Sentry 实例和初始化选项作为参数
15
- */
16
- declare class BaseClient {
17
- private sentry;
18
- private options;
19
- constructor(sentry: any, options: any);
20
- init(): void;
21
- captureException(error: Error, ctx?: CaptureContext): void;
22
- captureMessage1(message: string, ctx?: CaptureContext): void;
23
- setUser(user: MonitorUser): void;
24
- }
25
-
26
- export { BaseClient as B, type CaptureContext as C, type MonitorUser as M };
@@ -1,25 +0,0 @@
1
- interface MonitorUser {
2
- id?: string;
3
- email?: string;
4
- username?: string;
5
- }
6
- interface CaptureContext {
7
- tags?: Record<string, string>;
8
- extra?: Record<string, any>;
9
- }
10
-
11
- /**
12
- * 通用的 Sentry 客户端实现
13
- * 接受 Sentry 实例和初始化选项作为参数
14
- */
15
- declare class BaseClient {
16
- private sentry;
17
- private options;
18
- constructor(sentry: any, options: any);
19
- init(): void;
20
- captureException(error: Error, ctx?: CaptureContext): void;
21
- captureMessage(message: string, ctx?: CaptureContext): void;
22
- setUser(user: MonitorUser | null): void;
23
- }
24
-
25
- export { BaseClient as B, type CaptureContext as C, type MonitorUser as M };
@@ -1,25 +0,0 @@
1
- interface MonitorUser {
2
- id?: string;
3
- email?: string;
4
- username?: string;
5
- }
6
- interface CaptureContext {
7
- tags?: Record<string, string>;
8
- extra?: Record<string, any>;
9
- }
10
-
11
- /**
12
- * 通用的 Sentry 客户端实现
13
- * 接受 Sentry 实例和初始化选项作为参数
14
- */
15
- declare class BaseClient {
16
- private sentry;
17
- private options;
18
- constructor(sentry: any, options: any);
19
- init(): void;
20
- captureException(error: Error, ctx?: CaptureContext): void;
21
- captureMessage(message: string, ctx?: CaptureContext): void;
22
- setUser(user: MonitorUser | null): void;
23
- }
24
-
25
- export { BaseClient as B, type CaptureContext as C, type MonitorUser as M };
@@ -1,14 +0,0 @@
1
- import type { CaptureContext, MonitorUser } from "./types";
2
- /**
3
- * 通用的 Sentry 客户端实现
4
- * 接受 Sentry 实例和初始化选项作为参数
5
- */
6
- export declare class BaseClient {
7
- private sentry;
8
- private options;
9
- constructor(sentry: any, options: any);
10
- init(): void;
11
- captureException(error: Error, ctx?: CaptureContext): void;
12
- captureMessage(message: string, ctx?: CaptureContext): void;
13
- setUser(user: MonitorUser | null): void;
14
- }
@@ -1,30 +0,0 @@
1
- /**
2
- * 通用的 Sentry 客户端实现
3
- * 接受 Sentry 实例和初始化选项作为参数
4
- */
5
- export class BaseClient {
6
- constructor(sentry, options) {
7
- this.sentry = sentry;
8
- this.options = options;
9
- }
10
- init() {
11
- this.sentry.init(this.options);
12
- }
13
- captureException(error, ctx) {
14
- this.sentry.captureException(error, (scope) => {
15
- (ctx === null || ctx === void 0 ? void 0 : ctx.tags) && scope.setTags(ctx.tags);
16
- (ctx === null || ctx === void 0 ? void 0 : ctx.extra) && scope.setExtras(ctx.extra);
17
- return scope;
18
- });
19
- }
20
- captureMessage(message, ctx) {
21
- this.sentry.captureMessage(message, (scope) => {
22
- (ctx === null || ctx === void 0 ? void 0 : ctx.tags) && scope.setTags(ctx.tags);
23
- (ctx === null || ctx === void 0 ? void 0 : ctx.extra) && scope.setExtras(ctx.extra);
24
- return scope;
25
- });
26
- }
27
- setUser(user) {
28
- this.sentry.setUser(user);
29
- }
30
- }
@@ -1,9 +0,0 @@
1
- export interface MonitorUser {
2
- id?: string;
3
- email?: string;
4
- username?: string;
5
- }
6
- export interface CaptureContext {
7
- tags?: Record<string, string>;
8
- extra?: Record<string, any>;
9
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,18 +0,0 @@
1
- import { describe, it, expect } from "vitest";
2
- import { BaseClient } from "../core/baseClient";
3
- class MockClient extends BaseClient {
4
- constructor() {
5
- super({
6
- init: () => { },
7
- captureException: () => { },
8
- captureMessage: () => { },
9
- setUser: () => { },
10
- }, {});
11
- }
12
- }
13
- describe("SentryMonitorClient", () => {
14
- it("should instantiate", () => {
15
- const client = new MockClient();
16
- expect(client).toBeInstanceOf(BaseClient);
17
- });
18
- });