@flareapp/react 1.0.0-beta.3 → 1.0.0-beta.4
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 +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +49 -0
- package/dist/index.mjs +24 -0
- package/package.json +1 -1
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Component, PropsWithChildren, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
declare class FlareErrorBoundary extends Component<PropsWithChildren> {
|
|
4
|
+
componentDidCatch(error: Error, reactErrorInfo: React.ErrorInfo): void;
|
|
5
|
+
render(): ReactNode;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export { FlareErrorBoundary };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Component, PropsWithChildren, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
declare class FlareErrorBoundary extends Component<PropsWithChildren> {
|
|
4
|
+
componentDidCatch(error: Error, reactErrorInfo: React.ErrorInfo): void;
|
|
5
|
+
render(): ReactNode;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export { FlareErrorBoundary };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
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 __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
FlareErrorBoundary: () => FlareErrorBoundary
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(src_exports);
|
|
26
|
+
var import_react = require("react");
|
|
27
|
+
var import_js = require("@flareapp/js");
|
|
28
|
+
var FlareErrorBoundary = class extends import_react.Component {
|
|
29
|
+
componentDidCatch(error, reactErrorInfo) {
|
|
30
|
+
const context = {
|
|
31
|
+
react: {
|
|
32
|
+
componentStack: formatReactComponentStack(
|
|
33
|
+
reactErrorInfo?.componentStack ?? ""
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
import_js.flare.report(error, context, { react: { errorInfo: reactErrorInfo } });
|
|
38
|
+
}
|
|
39
|
+
render() {
|
|
40
|
+
return this.props.children;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
function formatReactComponentStack(stack) {
|
|
44
|
+
return stack.split(/\s*\n\s*/g).filter((line) => line.length > 0);
|
|
45
|
+
}
|
|
46
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
47
|
+
0 && (module.exports = {
|
|
48
|
+
FlareErrorBoundary
|
|
49
|
+
});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import { Component } from "react";
|
|
3
|
+
import { flare } from "@flareapp/js";
|
|
4
|
+
var FlareErrorBoundary = class extends Component {
|
|
5
|
+
componentDidCatch(error, reactErrorInfo) {
|
|
6
|
+
const context = {
|
|
7
|
+
react: {
|
|
8
|
+
componentStack: formatReactComponentStack(
|
|
9
|
+
reactErrorInfo?.componentStack ?? ""
|
|
10
|
+
)
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
flare.report(error, context, { react: { errorInfo: reactErrorInfo } });
|
|
14
|
+
}
|
|
15
|
+
render() {
|
|
16
|
+
return this.props.children;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
function formatReactComponentStack(stack) {
|
|
20
|
+
return stack.split(/\s*\n\s*/g).filter((line) => line.length > 0);
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
FlareErrorBoundary
|
|
24
|
+
};
|