miaoda-react-devkit 0.1.1-beta.16 → 0.1.1-beta.17

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.
@@ -1,10 +1,24 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+
1
5
  // src/stubs/sentry-react-noop-stub.ts
6
+ import { Component, createElement, isValidElement } from "react";
7
+ var INITIAL_ERROR_BOUNDARY_STATE = {
8
+ error: null,
9
+ componentStack: "",
10
+ hasError: false
11
+ };
2
12
  var init = (_options) => {
3
13
  };
4
14
  var configureStubSubscribers = (_subscribers) => {
5
15
  };
6
16
  var getDefaultIntegrations = (_options) => [];
7
17
  var browserTracingIntegration = () => ({});
18
+ var breadcrumbsIntegration = (_options) => ({});
19
+ var httpContextIntegration = (_options) => ({});
20
+ var linkedErrorsIntegration = (_options) => ({});
21
+ var dedupeIntegration = (_options) => ({});
8
22
  var captureException = (_err) => "";
9
23
  var captureMessage = (_msg) => "";
10
24
  var captureEvent = (_event) => "";
@@ -22,26 +36,68 @@ var setExtra = (_key, _value) => {
22
36
  };
23
37
  var setExtras = (_extras) => {
24
38
  };
25
- var withScope = (cb) => {
26
- cb({});
27
- };
28
- var withIsolationScope = (cb) => {
29
- cb({});
30
- };
31
- var startSpan = (_opts, cb) => cb();
32
39
  var getClient = () => void 0;
33
40
  var flush = () => Promise.resolve(true);
34
41
  var close = () => Promise.resolve(true);
35
42
  var lastEventId = () => void 0;
36
43
  var SDK_VERSION = "0.0.0-stub";
37
- var ErrorBoundary = ({ children }) => children ?? null;
38
- var withErrorBoundary = (Component) => Component;
39
- var withProfiler = (Component) => Component;
44
+ var ErrorBoundary = class extends Component {
45
+ constructor() {
46
+ super(...arguments);
47
+ __publicField(this, "state", INITIAL_ERROR_BOUNDARY_STATE);
48
+ }
49
+ static getDerivedStateFromError(error) {
50
+ return { error, componentStack: "", hasError: true };
51
+ }
52
+ componentDidCatch(error, errorInfo) {
53
+ const componentStack = errorInfo.componentStack ?? "";
54
+ this.setState({ componentStack });
55
+ this.props.onError?.(error, componentStack, "");
56
+ }
57
+ componentDidMount() {
58
+ this.props.onMount?.();
59
+ }
60
+ componentWillUnmount() {
61
+ if (this.state.hasError) {
62
+ this.props.onUnmount?.(this.state.error, this.state.componentStack, "");
63
+ } else {
64
+ this.props.onUnmount?.(null, null, null);
65
+ }
66
+ }
67
+ resetErrorBoundary() {
68
+ if (this.state.hasError) {
69
+ this.props.onReset?.(this.state.error, this.state.componentStack, "");
70
+ }
71
+ this.setState(INITIAL_ERROR_BOUNDARY_STATE);
72
+ }
73
+ render() {
74
+ const { children, fallback } = this.props;
75
+ if (!this.state.hasError) return typeof children === "function" ? children() : children ?? null;
76
+ const fallbackElement = typeof fallback === "function" ? createElement(fallback, {
77
+ error: this.state.error,
78
+ componentStack: this.state.componentStack,
79
+ eventId: "",
80
+ resetError: () => this.resetErrorBoundary()
81
+ }) : fallback;
82
+ return isValidElement(fallbackElement) ? fallbackElement : null;
83
+ }
84
+ };
85
+ var withErrorBoundary = (WrappedComponent, errorBoundaryOptions) => {
86
+ const Wrapped = (props) => createElement(
87
+ ErrorBoundary,
88
+ errorBoundaryOptions,
89
+ createElement(WrappedComponent, props)
90
+ );
91
+ Object.assign(Wrapped, WrappedComponent);
92
+ Wrapped.displayName = `errorBoundary(${WrappedComponent.displayName || WrappedComponent.name || "unknown"})`;
93
+ return Wrapped;
94
+ };
95
+ var withProfiler = (Component2) => Component2;
40
96
  var useProfiler = (_name) => {
41
97
  };
42
98
  var Profiler = ({ children }) => children ?? null;
43
- var withSentryRouting = (Component) => Component;
44
- var withSentryReactRouterV6Routing = (Component) => Component;
99
+ var withSentryRouting = (Component2) => Component2;
100
+ var withSentryReactRouterV6Routing = (Component2) => Component2;
45
101
  var wrapCreateBrowserRouterV6 = (fn) => fn;
46
102
  var wrapCreateBrowserRouterV7 = (fn) => fn;
47
103
  var reactRouterV6BrowserTracingIntegration = () => ({});
@@ -51,17 +107,21 @@ export {
51
107
  Profiler,
52
108
  SDK_VERSION,
53
109
  addBreadcrumb,
110
+ breadcrumbsIntegration,
54
111
  browserTracingIntegration,
55
112
  captureEvent,
56
113
  captureException,
57
114
  captureMessage,
58
115
  close,
59
116
  configureStubSubscribers,
117
+ dedupeIntegration,
60
118
  flush,
61
119
  getClient,
62
120
  getDefaultIntegrations,
121
+ httpContextIntegration,
63
122
  init,
64
123
  lastEventId,
124
+ linkedErrorsIntegration,
65
125
  reactRouterV6BrowserTracingIntegration,
66
126
  reactRouterV7BrowserTracingIntegration,
67
127
  setContext,
@@ -70,12 +130,9 @@ export {
70
130
  setTag,
71
131
  setTags,
72
132
  setUser,
73
- startSpan,
74
133
  useProfiler,
75
134
  withErrorBoundary,
76
- withIsolationScope,
77
135
  withProfiler,
78
- withScope,
79
136
  withSentryReactRouterV6Routing,
80
137
  withSentryRouting,
81
138
  wrapCreateBrowserRouterV6,
@@ -146,17 +146,21 @@ var SUPPORTED_SENTRY_APIS = [
146
146
  "Profiler",
147
147
  "SDK_VERSION",
148
148
  "addBreadcrumb",
149
+ "breadcrumbsIntegration",
149
150
  "browserTracingIntegration",
150
151
  "captureEvent",
151
152
  "captureException",
152
153
  "captureMessage",
153
154
  "close",
154
155
  "configureStubSubscribers",
156
+ "dedupeIntegration",
155
157
  "flush",
156
158
  "getClient",
157
159
  "getDefaultIntegrations",
160
+ "httpContextIntegration",
158
161
  "init",
159
162
  "lastEventId",
163
+ "linkedErrorsIntegration",
160
164
  "reactRouterV6BrowserTracingIntegration",
161
165
  "reactRouterV7BrowserTracingIntegration",
162
166
  "setContext",
@@ -165,12 +169,9 @@ var SUPPORTED_SENTRY_APIS = [
165
169
  "setTag",
166
170
  "setTags",
167
171
  "setUser",
168
- "startSpan",
169
172
  "useProfiler",
170
173
  "withErrorBoundary",
171
- "withIsolationScope",
172
174
  "withProfiler",
173
- "withScope",
174
175
  "withSentryReactRouterV6Routing",
175
176
  "withSentryRouting",
176
177
  "wrapCreateBrowserRouterV6",
@@ -103,17 +103,21 @@ var SUPPORTED_SENTRY_APIS = [
103
103
  "Profiler",
104
104
  "SDK_VERSION",
105
105
  "addBreadcrumb",
106
+ "breadcrumbsIntegration",
106
107
  "browserTracingIntegration",
107
108
  "captureEvent",
108
109
  "captureException",
109
110
  "captureMessage",
110
111
  "close",
111
112
  "configureStubSubscribers",
113
+ "dedupeIntegration",
112
114
  "flush",
113
115
  "getClient",
114
116
  "getDefaultIntegrations",
117
+ "httpContextIntegration",
115
118
  "init",
116
119
  "lastEventId",
120
+ "linkedErrorsIntegration",
117
121
  "reactRouterV6BrowserTracingIntegration",
118
122
  "reactRouterV7BrowserTracingIntegration",
119
123
  "setContext",
@@ -122,12 +126,9 @@ var SUPPORTED_SENTRY_APIS = [
122
126
  "setTag",
123
127
  "setTags",
124
128
  "setUser",
125
- "startSpan",
126
129
  "useProfiler",
127
130
  "withErrorBoundary",
128
- "withIsolationScope",
129
131
  "withProfiler",
130
- "withScope",
131
132
  "withSentryReactRouterV6Routing",
132
133
  "withSentryRouting",
133
134
  "wrapCreateBrowserRouterV6",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "miaoda-react-devkit",
3
- "version": "0.1.1-beta.16",
3
+ "version": "0.1.1-beta.17",
4
4
  "description": "React admin 应用开发工具集",
5
5
  "license": "MIT",
6
6
  "type": "module",