@sentry/react 7.0.0-beta.0 → 7.0.0-rc.0

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.
Files changed (90) hide show
  1. package/README.md +2 -3
  2. package/cjs/constants.js +12 -5
  3. package/cjs/constants.js.map +1 -1
  4. package/cjs/errorboundary.js +134 -102
  5. package/cjs/errorboundary.js.map +1 -1
  6. package/cjs/flags.js +7 -3
  7. package/cjs/flags.js.map +1 -1
  8. package/cjs/index.js +30 -21
  9. package/cjs/index.js.map +1 -1
  10. package/cjs/profiler.js +172 -134
  11. package/cjs/profiler.js.map +1 -1
  12. package/cjs/reactrouter.js +145 -94
  13. package/cjs/reactrouter.js.map +1 -1
  14. package/cjs/reactrouterv3.js +107 -75
  15. package/cjs/reactrouterv3.js.map +1 -1
  16. package/cjs/reactrouterv6.js +163 -0
  17. package/cjs/reactrouterv6.js.map +1 -0
  18. package/cjs/redux.js +54 -42
  19. package/cjs/redux.js.map +1 -1
  20. package/cjs/sdk.js +18 -15
  21. package/cjs/sdk.js.map +1 -1
  22. package/esm/constants.js +8 -4
  23. package/esm/constants.js.map +1 -1
  24. package/esm/errorboundary.js +120 -97
  25. package/esm/errorboundary.js.map +1 -1
  26. package/esm/flags.js +5 -2
  27. package/esm/flags.js.map +1 -1
  28. package/esm/index.js +8 -7
  29. package/esm/index.js.map +1 -1
  30. package/esm/profiler.js +154 -125
  31. package/esm/profiler.js.map +1 -1
  32. package/esm/reactrouter.js +132 -88
  33. package/esm/reactrouter.js.map +1 -1
  34. package/esm/reactrouterv3.js +104 -72
  35. package/esm/reactrouterv3.js.map +1 -1
  36. package/esm/reactrouterv6.js +153 -0
  37. package/esm/reactrouterv6.js.map +1 -0
  38. package/esm/redux.js +51 -40
  39. package/esm/redux.js.map +1 -1
  40. package/esm/sdk.js +17 -14
  41. package/esm/sdk.js.map +1 -1
  42. package/package.json +5 -4
  43. package/types/index.d.ts +1 -0
  44. package/types/index.d.ts.map +1 -1
  45. package/types/reactrouterv6.d.ts +27 -0
  46. package/types/reactrouterv6.d.ts.map +1 -0
  47. package/cjs/constants.d.ts +0 -4
  48. package/cjs/constants.d.ts.map +0 -1
  49. package/cjs/errorboundary.d.ts +0 -63
  50. package/cjs/errorboundary.d.ts.map +0 -1
  51. package/cjs/flags.d.ts +0 -3
  52. package/cjs/flags.d.ts.map +0 -1
  53. package/cjs/index.d.ts +0 -8
  54. package/cjs/index.d.ts.map +0 -1
  55. package/cjs/profiler.d.ts +0 -54
  56. package/cjs/profiler.d.ts.map +0 -1
  57. package/cjs/reactrouter.d.ts +0 -25
  58. package/cjs/reactrouter.d.ts.map +0 -1
  59. package/cjs/reactrouterv3.d.ts +0 -26
  60. package/cjs/reactrouterv3.d.ts.map +0 -1
  61. package/cjs/redux.d.ts +0 -33
  62. package/cjs/redux.d.ts.map +0 -1
  63. package/cjs/sdk.d.ts +0 -6
  64. package/cjs/sdk.d.ts.map +0 -1
  65. package/cjs/types.d.ts +0 -8
  66. package/cjs/types.d.ts.map +0 -1
  67. package/cjs/types.js +0 -2
  68. package/cjs/types.js.map +0 -1
  69. package/esm/constants.d.ts +0 -4
  70. package/esm/constants.d.ts.map +0 -1
  71. package/esm/errorboundary.d.ts +0 -63
  72. package/esm/errorboundary.d.ts.map +0 -1
  73. package/esm/flags.d.ts +0 -3
  74. package/esm/flags.d.ts.map +0 -1
  75. package/esm/index.d.ts +0 -8
  76. package/esm/index.d.ts.map +0 -1
  77. package/esm/profiler.d.ts +0 -54
  78. package/esm/profiler.d.ts.map +0 -1
  79. package/esm/reactrouter.d.ts +0 -25
  80. package/esm/reactrouter.d.ts.map +0 -1
  81. package/esm/reactrouterv3.d.ts +0 -26
  82. package/esm/reactrouterv3.d.ts.map +0 -1
  83. package/esm/redux.d.ts +0 -33
  84. package/esm/redux.d.ts.map +0 -1
  85. package/esm/sdk.d.ts +0 -6
  86. package/esm/sdk.d.ts.map +0 -1
  87. package/esm/types.d.ts +0 -8
  88. package/esm/types.d.ts.map +0 -1
  89. package/esm/types.js +0 -1
  90. package/esm/types.js.map +0 -1
package/README.md CHANGED
@@ -1,8 +1,7 @@
1
1
  <p align="center">
2
- <a href="https://sentry.io" target="_blank" align="center">
3
- <img src="https://sentry-brand.storage.googleapis.com/sentry-logo-black.png" width="280">
2
+ <a href="https://sentry.io/?utm_source=github&utm_medium=logo" target="_blank">
3
+ <img src="https://sentry-brand.storage.googleapis.com/sentry-wordmark-dark-280x84.png" alt="Sentry" width="280" height="84">
4
4
  </a>
5
- <br />
6
5
  </p>
7
6
 
8
7
  # Official Sentry SDK for ReactJS
package/cjs/constants.js CHANGED
@@ -1,5 +1,12 @@
1
- Object.defineProperty(exports, "__esModule", { value: true });
2
- exports.REACT_RENDER_OP = 'ui.react.render';
3
- exports.REACT_UPDATE_OP = 'ui.react.update';
4
- exports.REACT_MOUNT_OP = 'ui.react.mount';
5
- //# sourceMappingURL=constants.js.map
1
+ Object.defineProperty(exports, '__esModule', { value: true });
2
+
3
+ var REACT_RENDER_OP = 'ui.react.render';
4
+
5
+ var REACT_UPDATE_OP = 'ui.react.update';
6
+
7
+ var REACT_MOUNT_OP = 'ui.react.mount';
8
+
9
+ exports.REACT_MOUNT_OP = REACT_MOUNT_OP;
10
+ exports.REACT_RENDER_OP = REACT_RENDER_OP;
11
+ exports.REACT_UPDATE_OP = REACT_UPDATE_OP;
12
+ //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";AAAa,QAAA,eAAe,GAAG,iBAAiB,CAAC;AAEpC,QAAA,eAAe,GAAG,iBAAiB,CAAC;AAEpC,QAAA,cAAc,GAAG,gBAAgB,CAAC","sourcesContent":["export const REACT_RENDER_OP = 'ui.react.render';\n\nexport const REACT_UPDATE_OP = 'ui.react.update';\n\nexport const REACT_MOUNT_OP = 'ui.react.mount';\n"]}
1
+ {"version":3,"file":"constants.js","sources":["../../src/constants.ts"],"sourcesContent":["export const REACT_RENDER_OP = 'ui.react.render';\n\nexport const REACT_UPDATE_OP = 'ui.react.update';\n\nexport const REACT_MOUNT_OP = 'ui.react.mount';\n"],"names":[],"mappings":";;;AACA;;AAEA;;;;;;;"}
@@ -1,120 +1,152 @@
1
- Object.defineProperty(exports, "__esModule", { value: true });
2
- const tslib_1 = require("tslib");
3
- const browser_1 = require("@sentry/browser");
4
- const utils_1 = require("@sentry/utils");
5
- const hoist_non_react_statics_1 = tslib_1.__importDefault(require("hoist-non-react-statics"));
6
- const React = tslib_1.__importStar(require("react"));
7
- const flags_1 = require("./flags");
1
+ var {
2
+ _interopDefault,
3
+ _interopNamespace
4
+ } = require('@sentry/utils/cjs/buildPolyfills');
5
+
6
+ Object.defineProperty(exports, '__esModule', { value: true });
7
+
8
+ var browser = require('@sentry/browser');
9
+ var utils = require('@sentry/utils');
10
+ var hoistNonReactStatics = require('hoist-non-react-statics');
11
+ var React = require('react');
12
+ var flags = require('./flags.js');
13
+
14
+ var hoistNonReactStatics__default = /*#__PURE__*/_interopDefault(hoistNonReactStatics);
15
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
16
+
17
+ var _jsxFileName = "/home/runner/work/sentry-javascript/sentry-javascript/packages/react/src/errorboundary.tsx";
8
18
  function isAtLeastReact17(version) {
9
- const major = version.match(/^([^.]+)/);
10
- return major !== null && parseInt(major[0]) >= 17;
19
+ var major = version.match(/^([^.]+)/);
20
+ return major !== null && parseInt(major[0]) >= 17;
11
21
  }
12
- exports.isAtLeastReact17 = isAtLeastReact17;
13
- exports.UNKNOWN_COMPONENT = 'unknown';
14
- const INITIAL_STATE = {
15
- componentStack: null,
16
- error: null,
17
- eventId: null,
22
+
23
+ var UNKNOWN_COMPONENT = 'unknown';
24
+
25
+ var INITIAL_STATE = {
26
+ componentStack: null,
27
+ error: null,
28
+ eventId: null,
18
29
  };
30
+
19
31
  /**
20
32
  * A ErrorBoundary component that logs errors to Sentry. Requires React >= 16.
21
33
  * NOTE: If you are a Sentry user, and you are seeing this stack frame, it means the
22
34
  * Sentry React SDK ErrorBoundary caught an error invoking your application code. This
23
35
  * is expected behavior and NOT indicative of a bug with the Sentry React SDK.
24
36
  */
25
- class ErrorBoundary extends React.Component {
26
- constructor() {
27
- super(...arguments);
28
- this.state = INITIAL_STATE;
29
- this.resetErrorBoundary = () => {
30
- const { onReset } = this.props;
31
- const { error, componentStack, eventId } = this.state;
32
- if (onReset) {
33
- onReset(error, componentStack, eventId);
34
- }
35
- this.setState(INITIAL_STATE);
36
- };
37
+ class ErrorBoundary extends React__namespace.Component {constructor(...args) { super(...args); ErrorBoundary.prototype.__init.call(this);ErrorBoundary.prototype.__init2.call(this); }
38
+ __init() {this.state = INITIAL_STATE;}
39
+
40
+ componentDidCatch(error, { componentStack }) {
41
+ const { beforeCapture, onError, showDialog, dialogOptions } = this.props;
42
+
43
+ browser.withScope(scope => {
44
+ // If on React version >= 17, create stack trace from componentStack param and links
45
+ // to to the original error using `error.cause` otherwise relies on error param for stacktrace.
46
+ // Linking errors requires the `LinkedErrors` integration be enabled.
47
+ if (isAtLeastReact17(React__namespace.version)) {
48
+ var errorBoundaryError = new Error(error.message);
49
+ errorBoundaryError.name = `React ErrorBoundary ${errorBoundaryError.name}`;
50
+ errorBoundaryError.stack = componentStack;
51
+
52
+ // Using the `LinkedErrors` integration to link the errors together.
53
+ error.cause = errorBoundaryError;
54
+ }
55
+
56
+ if (beforeCapture) {
57
+ beforeCapture(scope, error, componentStack);
58
+ }
59
+ var eventId = browser.captureException(error, { contexts: { react: { componentStack } } });
60
+ if (onError) {
61
+ onError(error, componentStack, eventId);
62
+ }
63
+ if (showDialog) {
64
+ browser.showReportDialog({ ...dialogOptions, eventId });
65
+ }
66
+
67
+ // componentDidCatch is used over getDerivedStateFromError
68
+ // so that componentStack is accessible through state.
69
+ this.setState({ error, componentStack, eventId });
70
+ });
71
+ }
72
+
73
+ componentDidMount() {
74
+ const { onMount } = this.props;
75
+ if (onMount) {
76
+ onMount();
37
77
  }
38
- componentDidCatch(error, { componentStack }) {
39
- const { beforeCapture, onError, showDialog, dialogOptions } = this.props;
40
- browser_1.withScope(scope => {
41
- // If on React version >= 17, create stack trace from componentStack param and links
42
- // to to the original error using `error.cause` otherwise relies on error param for stacktrace.
43
- // Linking errors requires the `LinkedErrors` integration be enabled.
44
- if (isAtLeastReact17(React.version)) {
45
- const errorBoundaryError = new Error(error.message);
46
- errorBoundaryError.name = `React ErrorBoundary ${errorBoundaryError.name}`;
47
- errorBoundaryError.stack = componentStack;
48
- // Using the `LinkedErrors` integration to link the errors together.
49
- error.cause = errorBoundaryError;
50
- }
51
- if (beforeCapture) {
52
- beforeCapture(scope, error, componentStack);
53
- }
54
- const eventId = browser_1.captureException(error, { contexts: { react: { componentStack } } });
55
- if (onError) {
56
- onError(error, componentStack, eventId);
57
- }
58
- if (showDialog) {
59
- browser_1.showReportDialog(Object.assign(Object.assign({}, dialogOptions), { eventId }));
60
- }
61
- // componentDidCatch is used over getDerivedStateFromError
62
- // so that componentStack is accessible through state.
63
- this.setState({ error, componentStack, eventId });
64
- });
78
+ }
79
+
80
+ componentWillUnmount() {
81
+ const { error, componentStack, eventId } = this.state;
82
+ const { onUnmount } = this.props;
83
+ if (onUnmount) {
84
+ onUnmount(error, componentStack, eventId);
65
85
  }
66
- componentDidMount() {
67
- const { onMount } = this.props;
68
- if (onMount) {
69
- onMount();
70
- }
86
+ }
87
+
88
+ __init2() {this.resetErrorBoundary = () => {
89
+ const { onReset } = this.props;
90
+ const { error, componentStack, eventId } = this.state;
91
+ if (onReset) {
92
+ onReset(error, componentStack, eventId);
71
93
  }
72
- componentWillUnmount() {
73
- const { error, componentStack, eventId } = this.state;
74
- const { onUnmount } = this.props;
75
- if (onUnmount) {
76
- onUnmount(error, componentStack, eventId);
77
- }
94
+ this.setState(INITIAL_STATE);
95
+ };}
96
+
97
+ render() {
98
+ const { fallback, children } = this.props;
99
+ const { error, componentStack, eventId } = this.state;
100
+
101
+ if (error) {
102
+ let element = undefined;
103
+ if (typeof fallback === 'function') {
104
+ element = fallback({ error, componentStack, resetError: this.resetErrorBoundary, eventId });
105
+ } else {
106
+ element = fallback;
107
+ }
108
+
109
+ if (React__namespace.isValidElement(element)) {
110
+ return element;
111
+ }
112
+
113
+ if (fallback) {
114
+ flags.IS_DEBUG_BUILD && utils.logger.warn('fallback did not produce a valid ReactElement');
115
+ }
116
+
117
+ // Fail gracefully if no fallback provided or is not valid
118
+ return null;
78
119
  }
79
- render() {
80
- const { fallback, children } = this.props;
81
- const { error, componentStack, eventId } = this.state;
82
- if (error) {
83
- let element = undefined;
84
- if (typeof fallback === 'function') {
85
- element = fallback({ error, componentStack, resetError: this.resetErrorBoundary, eventId });
86
- }
87
- else {
88
- element = fallback;
89
- }
90
- if (React.isValidElement(element)) {
91
- return element;
92
- }
93
- if (fallback) {
94
- flags_1.IS_DEBUG_BUILD && utils_1.logger.warn('fallback did not produce a valid ReactElement');
95
- }
96
- // Fail gracefully if no fallback provided or is not valid
97
- return null;
98
- }
99
- if (typeof children === 'function') {
100
- return children();
101
- }
102
- return children;
120
+
121
+ if (typeof children === 'function') {
122
+ return (children )();
103
123
  }
124
+ return children;
125
+ }
104
126
  }
105
- exports.ErrorBoundary = ErrorBoundary;
106
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
107
- function withErrorBoundary(WrappedComponent, errorBoundaryOptions) {
108
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
109
- const componentDisplayName = WrappedComponent.displayName || WrappedComponent.name || exports.UNKNOWN_COMPONENT;
110
- const Wrapped = (props) => (React.createElement(ErrorBoundary, Object.assign({}, errorBoundaryOptions),
111
- React.createElement(WrappedComponent, Object.assign({}, props))));
112
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
127
+
128
+ function withErrorBoundary(
129
+ WrappedComponent,
130
+ errorBoundaryOptions,
131
+ ) {
132
+ var componentDisplayName = WrappedComponent.displayName || WrappedComponent.name || UNKNOWN_COMPONENT;
133
+
134
+ var Wrapped = (props) => (
135
+ React__namespace.createElement(ErrorBoundary, { ...errorBoundaryOptions, __self: this, __source: {fileName: _jsxFileName, lineNumber: 170}}
136
+ , React__namespace.createElement(WrappedComponent, { ...props, __self: this, __source: {fileName: _jsxFileName, lineNumber: 171}} )
137
+ )
138
+ );
139
+
113
140
  Wrapped.displayName = `errorBoundary(${componentDisplayName})`;
114
- // Copy over static methods from Wrapped component to Profiler HOC
115
- // See: https://reactjs.org/docs/higher-order-components.html#static-methods-must-be-copied-over
116
- hoist_non_react_statics_1.default(Wrapped, WrappedComponent);
117
- return Wrapped;
141
+
142
+ // Copy over static methods from Wrapped component to Profiler HOC
143
+ // See: https://reactjs.org/docs/higher-order-components.html#static-methods-must-be-copied-over
144
+ hoistNonReactStatics__default(Wrapped, WrappedComponent);
145
+ return Wrapped;
118
146
  }
147
+
148
+ exports.ErrorBoundary = ErrorBoundary;
149
+ exports.UNKNOWN_COMPONENT = UNKNOWN_COMPONENT;
150
+ exports.isAtLeastReact17 = isAtLeastReact17;
119
151
  exports.withErrorBoundary = withErrorBoundary;
120
- //# sourceMappingURL=errorboundary.js.map
152
+ //# sourceMappingURL=errorboundary.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errorboundary.js","sourceRoot":"","sources":["../../src/errorboundary.tsx"],"names":[],"mappings":";;AAAA,6CAA4G;AAC5G,yCAAuC;AACvC,8FAA2D;AAC3D,qDAA+B;AAE/B,mCAAyC;AAEzC,SAAgB,gBAAgB,CAAC,OAAe;IAC9C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IACxC,OAAO,KAAK,KAAK,IAAI,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AACpD,CAAC;AAHD,4CAGC;AAEY,QAAA,iBAAiB,GAAG,SAAS,CAAC;AA6C3C,MAAM,aAAa,GAAG;IACpB,cAAc,EAAE,IAAI;IACpB,KAAK,EAAE,IAAI;IACX,OA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AAO,CAAC,EAAE;gBACjC,OAAO,OAAO,CAAC;aAChB;YAED,IAAI,QAAQ,EAAE;gBACZ,sBAAc,IAAI,cAAM,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAC;aAChF;YAED,0DAA0D;YAC1D,OAAO,IAAI,CAAC;SACb;QAED,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE;YAClC,OAAQ,QAAkC,EAAE,CAAC;SAC9C;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AAyBQ,sCAAa;AAvBtB,8DAA8D;AAC9D,SAAS,iBAAiB,CACxB,gBAAwC,EACxC,oBAAwC;IAExC,sEAAsE;IACtE,MAAM,oBAAoB,GAAG,gBAAgB,CAAC,WAAW,IAAI,gBAAgB,CAAC,IAAI,IAAI,yBAAiB,CAAC;IAExG,MAAM,OAAO,GAAgB,CAAC,KAAQ,EAAE,EAAE,CAAC,CACzC,oBAAC,aAAa,oBAAK,oBAAoB;QACrC,oBAAC,gBAAgB,oBAAK,KAAK,EAAI,CACjB,CACjB,CAAC;IAEF,sEAAsE;IACtE,OAAO,CAAC,WAAW,GAAG,iBAAiB,oBAAoB,GAAG,CAAC;IAE/D,kEAAkE;IAClE,gGAAgG;IAChG,iCAAoB,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;IAChD,OAAO,OAAO,CAAC;AACjB,CAAC;AAEuB,8CAAiB","sourcesContent":["import { captureException, ReportDialogOptions, Scope, showReportDialog, withScope } from '@sentry/browser';\nimport { logger } from '@sentry/utils';\nimport hoistNonReactStatics from 'hoist-non-react-statics';\nimport * as React from 'react';\n\nimport { IS_DEBUG_BUILD } from './flags';\n\nexport function isAtLeastReact17(version: string): boolean {\n const major = version.match(/^([^.]+)/);\n return major !== null && parseInt(major[0]) >= 17;\n}\n\nexport const UNKNOWN_COMPONENT = 'unknown';\n\nexport type FallbackRender = (errorData: {\n error: Error;\n componentStack: string | null;\n eventId: string | null;\n resetError(): void;\n}) => React.ReactElement;\n\nexport type ErrorBoundaryProps = {\n children?: React.ReactNode | (() => React.ReactNode);\n /** If a Sentry report dialog should be rendered on error */\n showDialog?: boolean;\n /**\n * Options to be passed into the Sentry report dialog.\n * No-op if {@link showDialog} is false.\n */\n dialogOptions?: ReportDialogOptions;\n /**\n * A fallback component that gets rendered when the error boundary encounters an error.\n *\n * Can either provide a React Component, or a function that returns React Component as\n * a valid fallback prop. If a function is provided, the function will be called with\n * the error, the component stack, and an function that resets the error boundary on error.\n *\n */\n fallback?: React.ReactElement | FallbackRender;\n /** Called when the error boundary encounters an error */\n onError?(error: Error, componentStack: string, eventId: string): void;\n /** Called on componentDidMount() */\n onMount?(): void;\n /** Called if resetError() is called from the fallback render props function */\n onReset?(error: Error | null, componentStack: string | null, eventId: string | null): void;\n /** Called on componentWillUnmount() */\n onUnmount?(error: Error | null, componentStack: string | null, eventId: string | null): void;\n /** Called before the error is captured by Sentry, allows for you to add tags or context using the scope */\n beforeCapture?(scope: Scope, error: Error | null, componentStack: string | null): void;\n};\n\ntype ErrorBoundaryState = {\n componentStack: React.ErrorInfo['componentStack'] | null;\n error: Error | null;\n eventId: string | null;\n};\n\nconst INITIAL_STATE = {\n componentStack: null,\n error: null,\n eventId: null,\n};\n\n/**\n * A ErrorBoundary component that logs errors to Sentry. Requires React >= 16.\n * NOTE: If you are a Sentry user, and you are seeing this stack frame, it means the\n * Sentry React SDK ErrorBoundary caught an error invoking your application code. This\n * is expected behavior and NOT indicative of a bug with the Sentry React SDK.\n */\nclass ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {\n public state: ErrorBoundaryState = INITIAL_STATE;\n\n public componentDidCatch(error: Error & { cause?: Error }, { componentStack }: React.ErrorInfo): void {\n const { beforeCapture, onError, showDialog, dialogOptions } = this.props;\n\n withScope(scope => {\n // If on React version >= 17, create stack trace from componentStack param and links\n // to to the original error using `error.cause` otherwise relies on error param for stacktrace.\n // Linking errors requires the `LinkedErrors` integration be enabled.\n if (isAtLeastReact17(React.version)) {\n const errorBoundaryError = new Error(error.message);\n errorBoundaryError.name = `React ErrorBoundary ${errorBoundaryError.name}`;\n errorBoundaryError.stack = componentStack;\n\n // Using the `LinkedErrors` integration to link the errors together.\n error.cause = errorBoundaryError;\n }\n\n if (beforeCapture) {\n beforeCapture(scope, error, componentStack);\n }\n const eventId = captureException(error, { contexts: { react: { componentStack } } });\n if (onError) {\n onError(error, componentStack, eventId);\n }\n if (showDialog) {\n showReportDialog({ ...dialogOptions, eventId });\n }\n\n // componentDidCatch is used over getDerivedStateFromError\n // so that componentStack is accessible through state.\n this.setState({ error, componentStack, eventId });\n });\n }\n\n public componentDidMount(): void {\n const { onMount } = this.props;\n if (onMount) {\n onMount();\n }\n }\n\n public componentWillUnmount(): void {\n const { error, componentStack, eventId } = this.state;\n const { onUnmount } = this.props;\n if (onUnmount) {\n onUnmount(error, componentStack, eventId);\n }\n }\n\n public resetErrorBoundary: () => void = () => {\n const { onReset } = this.props;\n const { error, componentStack, eventId } = this.state;\n if (onReset) {\n onReset(error, componentStack, eventId);\n }\n this.setState(INITIAL_STATE);\n };\n\n public render(): React.ReactNode {\n const { fallback, children } = this.props;\n const { error, componentStack, eventId } = this.state;\n\n if (error) {\n let element: React.ReactElement | undefined = undefined;\n if (typeof fallback === 'function') {\n element = fallback({ error, componentStack, resetError: this.resetErrorBoundary, eventId });\n } else {\n element = fallback;\n }\n\n if (React.isValidElement(element)) {\n return element;\n }\n\n if (fallback) {\n IS_DEBUG_BUILD && logger.warn('fallback did not produce a valid ReactElement');\n }\n\n // Fail gracefully if no fallback provided or is not valid\n return null;\n }\n\n if (typeof children === 'function') {\n return (children as () => React.ReactNode)();\n }\n return children;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction withErrorBoundary<P extends Record<string, any>>(\n WrappedComponent: React.ComponentType<P>,\n errorBoundaryOptions: ErrorBoundaryProps,\n): React.FC<P> {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const componentDisplayName = WrappedComponent.displayName || WrappedComponent.name || UNKNOWN_COMPONENT;\n\n const Wrapped: React.FC<P> = (props: P) => (\n <ErrorBoundary {...errorBoundaryOptions}>\n <WrappedComponent {...props} />\n </ErrorBoundary>\n );\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n Wrapped.displayName = `errorBoundary(${componentDisplayName})`;\n\n // Copy over static methods from Wrapped component to Profiler HOC\n // See: https://reactjs.org/docs/higher-order-components.html#static-methods-must-be-copied-over\n hoistNonReactStatics(Wrapped, WrappedComponent);\n return Wrapped;\n}\n\nexport { ErrorBoundary, withErrorBoundary };\n"]}
1
+ {"version":3,"file":"errorboundary.js","sources":["../../src/errorboundary.tsx"],"sourcesContent":["import { captureException, ReportDialogOptions, Scope, showReportDialog, withScope } from '@sentry/browser';\nimport { logger } from '@sentry/utils';\nimport hoistNonReactStatics from 'hoist-non-react-statics';\nimport * as React from 'react';\n\nimport { IS_DEBUG_BUILD } from './flags';\n\nexport function isAtLeastReact17(version: string): boolean {\n const major = version.match(/^([^.]+)/);\n return major !== null && parseInt(major[0]) >= 17;\n}\n\nexport const UNKNOWN_COMPONENT = 'unknown';\n\nexport type FallbackRender = (errorData: {\n error: Error;\n componentStack: string | null;\n eventId: string | null;\n resetError(): void;\n}) => React.ReactElement;\n\nexport type ErrorBoundaryProps = {\n children?: React.ReactNode | (() => React.ReactNode);\n /** If a Sentry report dialog should be rendered on error */\n showDialog?: boolean;\n /**\n * Options to be passed into the Sentry report dialog.\n * No-op if {@link showDialog} is false.\n */\n dialogOptions?: ReportDialogOptions;\n /**\n * A fallback component that gets rendered when the error boundary encounters an error.\n *\n * Can either provide a React Component, or a function that returns React Component as\n * a valid fallback prop. If a function is provided, the function will be called with\n * the error, the component stack, and an function that resets the error boundary on error.\n *\n */\n fallback?: React.ReactElement | FallbackRender;\n /** Called when the error boundary encounters an error */\n onError?(error: Error, componentStack: string, eventId: string): void;\n /** Called on componentDidMount() */\n onMount?(): void;\n /** Called if resetError() is called from the fallback render props function */\n onReset?(error: Error | null, componentStack: string | null, eventId: string | null): void;\n /** Called on componentWillUnmount() */\n onUnmount?(error: Error | null, componentStack: string | null, eventId: string | null): void;\n /** Called before the error is captured by Sentry, allows for you to add tags or context using the scope */\n beforeCapture?(scope: Scope, error: Error | null, componentStack: string | null): void;\n};\n\ntype ErrorBoundaryState = {\n componentStack: React.ErrorInfo['componentStack'] | null;\n error: Error | null;\n eventId: string | null;\n};\n\nconst INITIAL_STATE = {\n componentStack: null,\n error: null,\n eventId: null,\n};\n\n/**\n * A ErrorBoundary component that logs errors to Sentry. Requires React >= 16.\n * NOTE: If you are a Sentry user, and you are seeing this stack frame, it means the\n * Sentry React SDK ErrorBoundary caught an error invoking your application code. This\n * is expected behavior and NOT indicative of a bug with the Sentry React SDK.\n */\nclass ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {\n public state: ErrorBoundaryState = INITIAL_STATE;\n\n public componentDidCatch(error: Error & { cause?: Error }, { componentStack }: React.ErrorInfo): void {\n const { beforeCapture, onError, showDialog, dialogOptions } = this.props;\n\n withScope(scope => {\n // If on React version >= 17, create stack trace from componentStack param and links\n // to to the original error using `error.cause` otherwise relies on error param for stacktrace.\n // Linking errors requires the `LinkedErrors` integration be enabled.\n if (isAtLeastReact17(React.version)) {\n const errorBoundaryError = new Error(error.message);\n errorBoundaryError.name = `React ErrorBoundary ${errorBoundaryError.name}`;\n errorBoundaryError.stack = componentStack;\n\n // Using the `LinkedErrors` integration to link the errors together.\n error.cause = errorBoundaryError;\n }\n\n if (beforeCapture) {\n beforeCapture(scope, error, componentStack);\n }\n const eventId = captureException(error, { contexts: { react: { componentStack } } });\n if (onError) {\n onError(error, componentStack, eventId);\n }\n if (showDialog) {\n showReportDialog({ ...dialogOptions, eventId });\n }\n\n // componentDidCatch is used over getDerivedStateFromError\n // so that componentStack is accessible through state.\n this.setState({ error, componentStack, eventId });\n });\n }\n\n public componentDidMount(): void {\n const { onMount } = this.props;\n if (onMount) {\n onMount();\n }\n }\n\n public componentWillUnmount(): void {\n const { error, componentStack, eventId } = this.state;\n const { onUnmount } = this.props;\n if (onUnmount) {\n onUnmount(error, componentStack, eventId);\n }\n }\n\n public resetErrorBoundary: () => void = () => {\n const { onReset } = this.props;\n const { error, componentStack, eventId } = this.state;\n if (onReset) {\n onReset(error, componentStack, eventId);\n }\n this.setState(INITIAL_STATE);\n };\n\n public render(): React.ReactNode {\n const { fallback, children } = this.props;\n const { error, componentStack, eventId } = this.state;\n\n if (error) {\n let element: React.ReactElement | undefined = undefined;\n if (typeof fallback === 'function') {\n element = fallback({ error, componentStack, resetError: this.resetErrorBoundary, eventId });\n } else {\n element = fallback;\n }\n\n if (React.isValidElement(element)) {\n return element;\n }\n\n if (fallback) {\n IS_DEBUG_BUILD && logger.warn('fallback did not produce a valid ReactElement');\n }\n\n // Fail gracefully if no fallback provided or is not valid\n return null;\n }\n\n if (typeof children === 'function') {\n return (children as () => React.ReactNode)();\n }\n return children;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction withErrorBoundary<P extends Record<string, any>>(\n WrappedComponent: React.ComponentType<P>,\n errorBoundaryOptions: ErrorBoundaryProps,\n): React.FC<P> {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const componentDisplayName = WrappedComponent.displayName || WrappedComponent.name || UNKNOWN_COMPONENT;\n\n const Wrapped: React.FC<P> = (props: P) => (\n <ErrorBoundary {...errorBoundaryOptions}>\n <WrappedComponent {...props} />\n </ErrorBoundary>\n );\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n Wrapped.displayName = `errorBoundary(${componentDisplayName})`;\n\n // Copy over static methods from Wrapped component to Profiler HOC\n // See: https://reactjs.org/docs/higher-order-components.html#static-methods-must-be-copied-over\n hoistNonReactStatics(Wrapped, WrappedComponent);\n return Wrapped;\n}\n\nexport { ErrorBoundary, withErrorBoundary };\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;AAUA;;;;AA+CA;;;;AAIA;;AAEA;;;;;;AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyFA;;AAEA;;;AAIA;;;;;;;;;;;;;;;AAiBA;;;;;"}
package/cjs/flags.js CHANGED
@@ -1,3 +1,5 @@
1
+ Object.defineProperty(exports, '__esModule', { value: true });
2
+
1
3
  /*
2
4
  * This file defines flags and constants that can be modified during compile time in order to facilitate tree shaking
3
5
  * for users.
@@ -11,7 +13,9 @@
11
13
  * our, or the user's build process. Take care when introducing new flags - they must not throw if they are not
12
14
  * replaced.
13
15
  */
14
- Object.defineProperty(exports, "__esModule", { value: true });
16
+
15
17
  /** Flag that is true for debug builds, false otherwise. */
16
- exports.IS_DEBUG_BUILD = typeof __SENTRY_DEBUG__ === 'undefined' ? true : __SENTRY_DEBUG__;
17
- //# sourceMappingURL=flags.js.map
18
+ var IS_DEBUG_BUILD = typeof __SENTRY_DEBUG__ === 'undefined' ? true : __SENTRY_DEBUG__;
19
+
20
+ exports.IS_DEBUG_BUILD = IS_DEBUG_BUILD;
21
+ //# sourceMappingURL=flags.js.map
package/cjs/flags.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"flags.js","sourceRoot":"","sources":["../../src/flags.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;;AAIH,2DAA2D;AAC9C,QAAA,cAAc,GAAG,OAAO,gBAAgB,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC","sourcesContent":["/*\n * This file defines flags and constants that can be modified during compile time in order to facilitate tree shaking\n * for users.\n *\n * Debug flags need to be declared in each package individually and must not be imported across package boundaries,\n * because some build tools have trouble tree-shaking imported guards.\n *\n * As a convention, we define debug flags in a `flags.ts` file in the root of a package's `src` folder.\n *\n * Debug flag files will contain \"magic strings\" like `__SENTRY_DEBUG__` that may get replaced with actual values during\n * our, or the user's build process. Take care when introducing new flags - they must not throw if they are not\n * replaced.\n */\n\ndeclare const __SENTRY_DEBUG__: boolean;\n\n/** Flag that is true for debug builds, false otherwise. */\nexport const IS_DEBUG_BUILD = typeof __SENTRY_DEBUG__ === 'undefined' ? true : __SENTRY_DEBUG__;\n"]}
1
+ {"version":3,"file":"flags.js","sources":["../../src/flags.ts"],"sourcesContent":["/*\n * This file defines flags and constants that can be modified during compile time in order to facilitate tree shaking\n * for users.\n *\n * Debug flags need to be declared in each package individually and must not be imported across package boundaries,\n * because some build tools have trouble tree-shaking imported guards.\n *\n * As a convention, we define debug flags in a `flags.ts` file in the root of a package's `src` folder.\n *\n * Debug flag files will contain \"magic strings\" like `__SENTRY_DEBUG__` that may get replaced with actual values during\n * our, or the user's build process. Take care when introducing new flags - they must not throw if they are not\n * replaced.\n */\n\ndeclare const __SENTRY_DEBUG__: boolean;\n\n/** Flag that is true for debug builds, false otherwise. */\nexport const IS_DEBUG_BUILD = typeof __SENTRY_DEBUG__ === 'undefined' ? true : __SENTRY_DEBUG__;\n"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;;;;;"}
package/cjs/index.js CHANGED
@@ -1,21 +1,30 @@
1
- Object.defineProperty(exports, "__esModule", { value: true });
2
- const tslib_1 = require("tslib");
3
- tslib_1.__exportStar(require("@sentry/browser"), exports);
4
- var sdk_1 = require("./sdk");
5
- exports.init = sdk_1.init;
6
- var profiler_1 = require("./profiler");
7
- exports.Profiler = profiler_1.Profiler;
8
- exports.withProfiler = profiler_1.withProfiler;
9
- exports.useProfiler = profiler_1.useProfiler;
10
- var errorboundary_1 = require("./errorboundary");
11
- exports.ErrorBoundary = errorboundary_1.ErrorBoundary;
12
- exports.withErrorBoundary = errorboundary_1.withErrorBoundary;
13
- var redux_1 = require("./redux");
14
- exports.createReduxEnhancer = redux_1.createReduxEnhancer;
15
- var reactrouterv3_1 = require("./reactrouterv3");
16
- exports.reactRouterV3Instrumentation = reactrouterv3_1.reactRouterV3Instrumentation;
17
- var reactrouter_1 = require("./reactrouter");
18
- exports.reactRouterV4Instrumentation = reactrouter_1.reactRouterV4Instrumentation;
19
- exports.reactRouterV5Instrumentation = reactrouter_1.reactRouterV5Instrumentation;
20
- exports.withSentryRouting = reactrouter_1.withSentryRouting;
21
- //# sourceMappingURL=index.js.map
1
+ Object.defineProperty(exports, '__esModule', { value: true });
2
+
3
+ var browser = require('@sentry/browser');
4
+ var sdk = require('./sdk.js');
5
+ var profiler = require('./profiler.js');
6
+ var errorboundary = require('./errorboundary.js');
7
+ var redux = require('./redux.js');
8
+ var reactrouterv3 = require('./reactrouterv3.js');
9
+ var reactrouter = require('./reactrouter.js');
10
+ var reactrouterv6 = require('./reactrouterv6.js');
11
+
12
+
13
+
14
+ exports.init = sdk.init;
15
+ exports.Profiler = profiler.Profiler;
16
+ exports.useProfiler = profiler.useProfiler;
17
+ exports.withProfiler = profiler.withProfiler;
18
+ exports.ErrorBoundary = errorboundary.ErrorBoundary;
19
+ exports.withErrorBoundary = errorboundary.withErrorBoundary;
20
+ exports.createReduxEnhancer = redux.createReduxEnhancer;
21
+ exports.reactRouterV3Instrumentation = reactrouterv3.reactRouterV3Instrumentation;
22
+ exports.reactRouterV4Instrumentation = reactrouter.reactRouterV4Instrumentation;
23
+ exports.reactRouterV5Instrumentation = reactrouter.reactRouterV5Instrumentation;
24
+ exports.withSentryRouting = reactrouter.withSentryRouting;
25
+ exports.reactRouterV6Instrumentation = reactrouterv6.reactRouterV6Instrumentation;
26
+ exports.withSentryReactRouterV6Routing = reactrouterv6.withSentryReactRouterV6Routing;
27
+ for (var k in browser) {
28
+ if (k !== 'default' && !exports.hasOwnProperty(k)) exports[k] = browser[k];
29
+ }
30
+ //# sourceMappingURL=index.js.map
package/cjs/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;AAAA,0DAAgC;AAEhC,6BAA6B;AAApB,qBAAA,IAAI,CAAA;AACb,uCAAiE;AAAxD,8BAAA,QAAQ,CAAA;AAAE,kCAAA,YAAY,CAAA;AAAE,iCAAA,WAAW,CAAA;AAC5C,iDAAmE;AAA1D,wCAAA,aAAa,CAAA;AAAE,4CAAA,iBAAiB,CAAA;AACzC,iCAA8C;AAArC,sCAAA,mBAAmB,CAAA;AAC5B,iDAA+D;AAAtD,uDAAA,4BAA4B,CAAA;AACrC,6CAA8G;AAArG,qDAAA,4BAA4B,CAAA;AAAE,qDAAA,4BAA4B,CAAA;AAAE,0CAAA,iBAAiB,CAAA","sourcesContent":["export * from '@sentry/browser';\n\nexport { init } from './sdk';\nexport { Profiler, withProfiler, useProfiler } from './profiler';\nexport { ErrorBoundary, withErrorBoundary } from './errorboundary';\nexport { createReduxEnhancer } from './redux';\nexport { reactRouterV3Instrumentation } from './reactrouterv3';\nexport { reactRouterV4Instrumentation, reactRouterV5Instrumentation, withSentryRouting } from './reactrouter';\n"]}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;"}