@ohbug/react 2.0.8 → 2.0.10

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/README.md CHANGED
@@ -14,11 +14,11 @@ pnpm instal @ohbug/browser @ohbug/react
14
14
  ## Usage
15
15
 
16
16
  ```jsx
17
- import React from 'react'
18
- import Ohbug from '@ohbug/browser'
19
- import { OhbugErrorBoundary } from '@ohbug/react'
17
+ import React from "react";
18
+ import Ohbug from "@ohbug/browser";
19
+ import { OhbugErrorBoundary } from "@ohbug/react";
20
20
 
21
- const client = Ohbug.setup({ apiKey: 'YOUR_API_KEY' })
21
+ const client = Ohbug.setup({ apiKey: "YOUR_API_KEY" });
22
22
 
23
23
  function App() {
24
24
  return (
@@ -27,6 +27,6 @@ function App() {
27
27
  <HelloWorld />
28
28
  </OhbugErrorBoundary>
29
29
  </div>
30
- )
30
+ );
31
31
  }
32
32
  ```
package/dist/index.d.mts CHANGED
@@ -1,23 +1,25 @@
1
- import { OhbugBaseDetail, OhbugClient } from '@ohbug/types';
2
- import React from 'react';
1
+ import React from "react";
2
+ import { OhbugBaseDetail, OhbugClient } from "@ohbug/types";
3
3
 
4
+ //#region src/OhbugErrorBoundary.d.ts
4
5
  interface ReactErrorDetail extends OhbugBaseDetail {
5
- name: string;
6
- stack?: string;
7
- errorInfo: any;
6
+ name: string;
7
+ stack?: string;
8
+ errorInfo: any;
8
9
  }
9
10
  interface ErrorBoundaryProp {
10
- client: OhbugClient;
11
- FallbackComponent?: React.ReactElement;
12
- children?: React.ReactNode;
11
+ client: OhbugClient;
12
+ FallbackComponent?: React.ReactElement;
13
+ children?: React.ReactNode;
13
14
  }
14
15
  interface ErrorBoundaryState {
15
- error: any;
16
+ error: any;
16
17
  }
17
18
  declare class OhbugErrorBoundary extends React.Component<ErrorBoundaryProp, ErrorBoundaryState> {
18
- constructor(props: ErrorBoundaryProp);
19
- componentDidCatch(error: Error, info: any): void;
20
- render(): string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined;
19
+ constructor(props: ErrorBoundaryProp);
20
+ componentDidCatch(error: Error, info: any): void;
21
+ render(): string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null | undefined;
21
22
  }
22
-
23
+ //#endregion
23
24
  export { OhbugErrorBoundary, ReactErrorDetail };
25
+ //# sourceMappingURL=index.d.mts.map
package/dist/index.mjs CHANGED
@@ -1,38 +1,38 @@
1
- // src/OhbugErrorBoundary.ts
2
- import React from "react";
3
1
  import { EventTypes } from "@ohbug/core";
2
+ import React from "react";
3
+ //#region src/OhbugErrorBoundary.ts
4
4
  var OhbugErrorBoundary = class extends React.Component {
5
- constructor(props) {
6
- super(props);
7
- this.state = { error: null };
8
- }
9
- componentDidCatch(error, info) {
10
- const { client } = this.props;
11
- const detail = {
12
- name: error.name,
13
- message: error.message,
14
- stack: error.stack,
15
- errorInfo: info
16
- };
17
- const event = client.createEvent({
18
- category: "error",
19
- type: EventTypes.REACT,
20
- detail
21
- });
22
- client.notify(event);
23
- this.setState({ error });
24
- }
25
- render() {
26
- const { error } = this.state;
27
- const { FallbackComponent, children } = this.props;
28
- if (error) {
29
- if (FallbackComponent)
30
- return FallbackComponent;
31
- return null;
32
- }
33
- return children;
34
- }
35
- };
36
- export {
37
- OhbugErrorBoundary
5
+ constructor(props) {
6
+ super(props);
7
+ this.state = { error: null };
8
+ }
9
+ componentDidCatch(error, info) {
10
+ const { client } = this.props;
11
+ const detail = {
12
+ name: error.name,
13
+ message: error.message,
14
+ stack: error.stack,
15
+ errorInfo: info
16
+ };
17
+ const event = client.createEvent({
18
+ category: "error",
19
+ type: EventTypes.REACT,
20
+ detail
21
+ });
22
+ client.notify(event);
23
+ this.setState({ error });
24
+ }
25
+ render() {
26
+ const { error } = this.state;
27
+ const { FallbackComponent, children } = this.props;
28
+ if (error) {
29
+ if (FallbackComponent) return FallbackComponent;
30
+ return null;
31
+ }
32
+ return children;
33
+ }
38
34
  };
35
+ //#endregion
36
+ export { OhbugErrorBoundary };
37
+
38
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/OhbugErrorBoundary.ts"],"sourcesContent":["import { EventTypes } from \"@ohbug/core\";\nimport type { OhbugBaseDetail, OhbugClient } from \"@ohbug/types\";\nimport React from \"react\";\n\nexport interface ReactErrorDetail extends OhbugBaseDetail {\n name: string;\n stack?: string;\n errorInfo: any;\n}\n\ninterface ErrorBoundaryProp {\n client: OhbugClient;\n FallbackComponent?: React.ReactElement;\n children?: React.ReactNode;\n}\ninterface ErrorBoundaryState {\n error: any;\n}\nexport class OhbugErrorBoundary extends React.Component<ErrorBoundaryProp, ErrorBoundaryState> {\n constructor(props: ErrorBoundaryProp) {\n super(props);\n this.state = { error: null };\n }\n\n componentDidCatch(error: Error, info: any) {\n const { client } = this.props;\n const detail: ReactErrorDetail = {\n name: error.name,\n message: error.message,\n stack: error.stack,\n errorInfo: info,\n };\n\n const event = client.createEvent<ReactErrorDetail>({\n category: \"error\",\n type: EventTypes.REACT,\n detail,\n });\n void client.notify(event);\n this.setState({ error });\n }\n\n render() {\n const { error } = this.state;\n const { FallbackComponent, children } = this.props;\n if (error) {\n if (FallbackComponent) return FallbackComponent;\n return null;\n }\n return children;\n }\n}\n"],"mappings":";;;AAkBA,IAAa,qBAAb,cAAwC,MAAM,UAAiD;CAC7F,YAAY,OAA0B;AACpC,QAAM,MAAM;AACZ,OAAK,QAAQ,EAAE,OAAO,MAAM;;CAG9B,kBAAkB,OAAc,MAAW;EACzC,MAAM,EAAE,WAAW,KAAK;EACxB,MAAM,SAA2B;GAC/B,MAAM,MAAM;GACZ,SAAS,MAAM;GACf,OAAO,MAAM;GACb,WAAW;GACZ;EAED,MAAM,QAAQ,OAAO,YAA8B;GACjD,UAAU;GACV,MAAM,WAAW;GACjB;GACD,CAAC;AACG,SAAO,OAAO,MAAM;AACzB,OAAK,SAAS,EAAE,OAAO,CAAC;;CAG1B,SAAS;EACP,MAAM,EAAE,UAAU,KAAK;EACvB,MAAM,EAAE,mBAAmB,aAAa,KAAK;AAC7C,MAAI,OAAO;AACT,OAAI,kBAAmB,QAAO;AAC9B,UAAO;;AAET,SAAO"}
package/package.json CHANGED
@@ -1,47 +1,46 @@
1
1
  {
2
2
  "name": "@ohbug/react",
3
- "version": "2.0.8",
3
+ "version": "2.0.10",
4
4
  "description": "Ohbug SDK for React",
5
- "license": "Apache-2.0",
6
- "author": "chenyueban <jasonchan0527@gmail.com>",
7
- "homepage": "https://github.com/ohbug-org/ohbug",
5
+ "homepage": "https://github.com/ohbug-org/ohbug#readme",
8
6
  "bugs": {
9
7
  "url": "https://github.com/ohbug-org/ohbug/issues"
10
8
  },
9
+ "license": "Apache-2.0",
10
+ "author": {
11
+ "name": "xinyao",
12
+ "email": "hi@xinyao.me"
13
+ },
11
14
  "repository": {
12
15
  "type": "git",
13
- "url": "https://github.com/ohbug-org/ohbug"
14
- },
15
- "main": "dist/index.js",
16
- "module": "dist/index.mjs",
17
- "types": "dist/index.d.ts",
18
- "exports": {
19
- ".": {
20
- "require": "./dist/index.js",
21
- "import": "./dist/index.mjs",
22
- "types": "./dist/index.d.ts"
23
- }
16
+ "url": "git+https://github.com/ohbug-org/ohbug.git"
24
17
  },
18
+ "funding": "https://github.com/sponsors/xinyao27",
25
19
  "files": [
26
20
  "dist"
27
21
  ],
22
+ "type": "module",
28
23
  "sideEffects": false,
29
- "peerDependencies": {
30
- "react": "^16.8.6"
24
+ "types": "dist/index.d.mts",
25
+ "exports": {
26
+ ".": "./dist/index.mjs",
27
+ "./package.json": "./package.json"
28
+ },
29
+ "publishConfig": {
30
+ "access": "public"
31
31
  },
32
32
  "dependencies": {
33
- "@ohbug/types": "2.2.0",
34
- "@ohbug/core": "2.2.0"
33
+ "@ohbug/core": "2.2.2",
34
+ "@ohbug/types": "2.2.2"
35
35
  },
36
36
  "devDependencies": {
37
- "@types/react": "^18.2.14",
38
- "@ohbug/browser": "2.5.0"
37
+ "@types/react": "^19.2.14",
38
+ "@ohbug/browser": "2.5.2"
39
39
  },
40
- "publishConfig": {
41
- "access": "public"
40
+ "peerDependencies": {
41
+ "react": "^16.8.6"
42
42
  },
43
43
  "scripts": {
44
- "build": "tsup",
45
- "dev": "tsup --watch"
44
+ "dev": "vp pack --watch"
46
45
  }
47
46
  }
package/dist/index.d.ts DELETED
@@ -1,23 +0,0 @@
1
- import { OhbugBaseDetail, OhbugClient } from '@ohbug/types';
2
- import React from 'react';
3
-
4
- interface ReactErrorDetail extends OhbugBaseDetail {
5
- name: string;
6
- stack?: string;
7
- errorInfo: any;
8
- }
9
- interface ErrorBoundaryProp {
10
- client: OhbugClient;
11
- FallbackComponent?: React.ReactElement;
12
- children?: React.ReactNode;
13
- }
14
- interface ErrorBoundaryState {
15
- error: any;
16
- }
17
- declare class OhbugErrorBoundary extends React.Component<ErrorBoundaryProp, ErrorBoundaryState> {
18
- constructor(props: ErrorBoundaryProp);
19
- componentDidCatch(error: Error, info: any): void;
20
- render(): string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined;
21
- }
22
-
23
- export { OhbugErrorBoundary, ReactErrorDetail };
package/dist/index.js DELETED
@@ -1,75 +0,0 @@
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/index.ts
31
- var src_exports = {};
32
- __export(src_exports, {
33
- OhbugErrorBoundary: () => OhbugErrorBoundary
34
- });
35
- module.exports = __toCommonJS(src_exports);
36
-
37
- // src/OhbugErrorBoundary.ts
38
- var import_react = __toESM(require("react"));
39
- var import_core = require("@ohbug/core");
40
- var OhbugErrorBoundary = class extends import_react.default.Component {
41
- constructor(props) {
42
- super(props);
43
- this.state = { error: null };
44
- }
45
- componentDidCatch(error, info) {
46
- const { client } = this.props;
47
- const detail = {
48
- name: error.name,
49
- message: error.message,
50
- stack: error.stack,
51
- errorInfo: info
52
- };
53
- const event = client.createEvent({
54
- category: "error",
55
- type: import_core.EventTypes.REACT,
56
- detail
57
- });
58
- client.notify(event);
59
- this.setState({ error });
60
- }
61
- render() {
62
- const { error } = this.state;
63
- const { FallbackComponent, children } = this.props;
64
- if (error) {
65
- if (FallbackComponent)
66
- return FallbackComponent;
67
- return null;
68
- }
69
- return children;
70
- }
71
- };
72
- // Annotate the CommonJS export names for ESM import in node:
73
- 0 && (module.exports = {
74
- OhbugErrorBoundary
75
- });